From 49185f4a1db98782b2cd5906e439fc6d55e5752d Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Fri, 3 Jan 2025 14:56:22 +0300 Subject: [PATCH] chore: rm tdapi --- .github/workflows/nightly.yml | 10 - _schema/tdapi.tl | 13236 ------ td.go | 2 - tdapi/tl_accent_color_gen.go | 379 - tdapi/tl_accept_call_gen.go | 237 - tdapi/tl_accept_terms_of_service_gen.go | 206 - tdapi/tl_account_ttl_gen.go | 194 - tdapi/tl_activate_story_stealth_mode_gen.go | 169 - tdapi/tl_add_bot_media_preview_gen.go | 282 - .../tl_add_chat_folder_by_invite_link_gen.go | 262 - tdapi/tl_add_chat_member_gen.go | 272 - tdapi/tl_add_chat_members_gen.go | 262 - tdapi/tl_add_chat_to_list_gen.go | 247 - tdapi/tl_add_contact_gen.go | 239 - .../tl_add_custom_server_language_pack_gen.go | 206 - tdapi/tl_add_favorite_sticker_gen.go | 216 - tdapi/tl_add_file_to_downloads_gen.go | 307 - tdapi/tl_add_local_message_gen.go | 369 - tdapi/tl_add_log_message_gen.go | 237 - tdapi/tl_add_message_reaction_gen.go | 351 - tdapi/tl_add_network_statistics_gen.go | 216 - ...l_add_pending_paid_message_reaction_gen.go | 343 - tdapi/tl_add_proxy_gen.go | 315 - ...hortcut_inline_query_result_message_gen.go | 341 - ..._quick_reply_shortcut_message_album_gen.go | 306 - ...tl_add_quick_reply_shortcut_message_gen.go | 282 - tdapi/tl_add_recent_sticker_gen.go | 248 - tdapi/tl_add_recently_found_chat_gen.go | 206 - tdapi/tl_add_saved_animation_gen.go | 217 - tdapi/tl_add_saved_notification_sound_gen.go | 216 - tdapi/tl_add_sticker_to_set_gen.go | 272 - tdapi/tl_added_reaction_gen.go | 315 - tdapi/tl_added_reactions_gen.go | 289 - tdapi/tl_address_gen.go | 363 - tdapi/tl_affiliate_info_gen.go | 263 - tdapi/tl_affiliate_program_info_gen.go | 263 - tdapi/tl_affiliate_program_parameters_gen.go | 228 - tdapi/tl_affiliate_program_sort_order_gen.go | 577 - tdapi/tl_affiliate_type_gen.go | 647 - tdapi/tl_allow_bot_to_send_messages_gen.go | 206 - tdapi/tl_alternative_video_gen.go | 329 - tdapi/tl_animated_chat_photo_gen.go | 261 - tdapi/tl_animated_emoji_gen.go | 331 - tdapi/tl_animation_gen.go | 466 - tdapi/tl_animations_gen.go | 221 - tdapi/tl_answer_callback_query_gen.go | 339 - tdapi/tl_answer_custom_query_gen.go | 237 - tdapi/tl_answer_inline_query_gen.go | 408 - tdapi/tl_answer_pre_checkout_query_gen.go | 237 - tdapi/tl_answer_shipping_query_gen.go | 299 - tdapi/tl_answer_web_app_query_gen.go | 247 - tdapi/tl_apply_premium_gift_code_gen.go | 206 - tdapi/tl_archive_chat_list_settings_gen.go | 266 - tdapi/tl_assign_app_store_transaction_gen.go | 247 - .../tl_assign_google_play_transaction_gen.go | 315 - tdapi/tl_attachment_menu_bot_color_gen.go | 227 - tdapi/tl_attachment_menu_bot_gen.go | 946 - tdapi/tl_audio_gen.go | 495 - tdapi/tl_authentication_code_info_gen.go | 315 - tdapi/tl_authentication_code_type_gen.go | 2131 - tdapi/tl_authorization_state_gen.go | 2350 - tdapi/tl_auto_download_settings_gen.go | 466 - .../tl_auto_download_settings_presets_gen.go | 261 - tdapi/tl_autosave_settings_exception_gen.go | 227 - tdapi/tl_autosave_settings_gen.go | 323 - tdapi/tl_autosave_settings_scope_gen.go | 758 - tdapi/tl_available_reaction_gen.go | 237 - tdapi/tl_available_reactions_gen.go | 458 - tdapi/tl_background_fill_gen.go | 775 - tdapi/tl_background_gen.go | 374 - tdapi/tl_background_type_gen.go | 1021 - tdapi/tl_backgrounds_gen.go | 221 - tdapi/tl_ban_chat_member_gen.go | 319 - tdapi/tl_bank_card_action_open_url_gen.go | 227 - tdapi/tl_bank_card_info_gen.go | 255 - tdapi/tl_basic_group_full_info_gen.go | 492 - tdapi/tl_basic_group_gen.go | 339 - tdapi/tl_birthdate_gen.go | 261 - tdapi/tl_block_list_gen.go | 431 - ...l_block_message_sender_from_replies_gen.go | 305 - tdapi/tl_bool_gen.go | 431 - tdapi/tl_boost_chat_gen.go | 261 - tdapi/tl_bot_command_gen.go | 227 - tdapi/tl_bot_command_scope_gen.go | 1300 - tdapi/tl_bot_commands_gen.go | 255 - tdapi/tl_bot_info_gen.go | 982 - tdapi/tl_bot_media_preview_gen.go | 237 - tdapi/tl_bot_media_preview_info_gen.go | 279 - tdapi/tl_bot_media_previews_gen.go | 221 - tdapi/tl_bot_menu_button_gen.go | 229 - tdapi/tl_bot_verification_gen.go | 261 - tdapi/tl_bot_verification_parameters_gen.go | 296 - tdapi/tl_bot_write_access_allow_reason_gen.go | 801 - .../tl_business_away_message_schedule_gen.go | 648 - .../tl_business_away_message_settings_gen.go | 306 - tdapi/tl_business_bot_manage_bar_gen.go | 296 - tdapi/tl_business_chat_link_gen.go | 295 - tdapi/tl_business_chat_link_info_gen.go | 227 - tdapi/tl_business_chat_links_gen.go | 221 - tdapi/tl_business_connected_bot_gen.go | 261 - tdapi/tl_business_connection_gen.go | 363 - tdapi/tl_business_feature_gen.go | 1745 - ...usiness_feature_promotion_animation_gen.go | 237 - tdapi/tl_business_features_gen.go | 227 - ..._business_greeting_message_settings_gen.go | 262 - tdapi/tl_business_info_gen.go | 437 - tdapi/tl_business_location_gen.go | 227 - tdapi/tl_business_message_gen.go | 227 - tdapi/tl_business_messages_gen.go | 221 - tdapi/tl_business_opening_hours_gen.go | 255 - .../tl_business_opening_hours_interval_gen.go | 229 - tdapi/tl_business_recipients_gen.go | 446 - tdapi/tl_business_start_page_gen.go | 261 - tdapi/tl_bytes_gen.go | 158 - tdapi/tl_call_discard_reason_gen.go | 1050 - tdapi/tl_call_gen.go | 374 - tdapi/tl_call_id_gen.go | 193 - tdapi/tl_call_problem_gen.go | 1453 - tdapi/tl_call_protocol_gen.go | 353 - tdapi/tl_call_server_gen.go | 339 - tdapi/tl_call_server_type_gen.go | 637 - tdapi/tl_call_state_gen.go | 1558 - tdapi/tl_callback_query_answer_gen.go | 261 - tdapi/tl_callback_query_payload_gen.go | 716 - tdapi/tl_can_bot_send_messages_gen.go | 206 - tdapi/tl_can_purchase_from_store_gen.go | 216 - tdapi/tl_can_send_message_to_user_gen.go | 237 - .../tl_can_send_message_to_user_result_gen.go | 581 - tdapi/tl_can_send_story_gen.go | 207 - tdapi/tl_can_send_story_result_gen.go | 1085 - tdapi/tl_can_transfer_ownership_gen.go | 169 - tdapi/tl_can_transfer_ownership_result_gen.go | 799 - tdapi/tl_cancel_download_file_gen.go | 238 - tdapi/tl_cancel_password_reset_gen.go | 169 - .../tl_cancel_preliminary_upload_file_gen.go | 206 - ...recovery_email_address_verification_gen.go | 169 - tdapi/tl_change_imported_contacts_gen.go | 234 - tdapi/tl_change_sticker_set_gen.go | 272 - tdapi/tl_chat_action_bar_gen.go | 1192 - tdapi/tl_chat_action_gen.go | 2539 -- tdapi/tl_chat_active_stories_gen.go | 372 - tdapi/tl_chat_administrator_gen.go | 261 - tdapi/tl_chat_administrator_rights_gen.go | 682 - tdapi/tl_chat_administrators_gen.go | 221 - tdapi/tl_chat_available_reactions_gen.go | 572 - tdapi/tl_chat_background_gen.go | 228 - tdapi/tl_chat_boost_features_gen.go | 497 - tdapi/tl_chat_boost_gen.go | 339 - tdapi/tl_chat_boost_level_features_gen.go | 637 - tdapi/tl_chat_boost_link_gen.go | 227 - tdapi/tl_chat_boost_link_info_gen.go | 227 - tdapi/tl_chat_boost_slot_gen.go | 329 - tdapi/tl_chat_boost_slots_gen.go | 221 - tdapi/tl_chat_boost_source_gen.go | 859 - tdapi/tl_chat_boost_status_gen.go | 555 - tdapi/tl_chat_event_action_gen.go | 10729 ----- tdapi/tl_chat_event_gen.go | 315 - tdapi/tl_chat_event_log_filters_gen.go | 635 - tdapi/tl_chat_events_gen.go | 221 - tdapi/tl_chat_folder_gen.go | 752 - tdapi/tl_chat_folder_icon_gen.go | 194 - tdapi/tl_chat_folder_info_gen.go | 364 - tdapi/tl_chat_folder_invite_link_gen.go | 285 - tdapi/tl_chat_folder_invite_link_info_gen.go | 310 - tdapi/tl_chat_folder_invite_links_gen.go | 221 - tdapi/tl_chat_folder_name_gen.go | 228 - tdapi/tl_chat_gen.go | 1681 - tdapi/tl_chat_invite_link_count_gen.go | 261 - tdapi/tl_chat_invite_link_counts_gen.go | 221 - tdapi/tl_chat_invite_link_gen.go | 641 - tdapi/tl_chat_invite_link_info_gen.go | 639 - tdapi/tl_chat_invite_link_member_gen.go | 295 - tdapi/tl_chat_invite_link_members_gen.go | 255 - ..._chat_invite_link_subscription_info_gen.go | 263 - tdapi/tl_chat_invite_links_gen.go | 255 - tdapi/tl_chat_join_request_gen.go | 261 - tdapi/tl_chat_join_requests_gen.go | 255 - tdapi/tl_chat_join_requests_info_gen.go | 251 - tdapi/tl_chat_list_gen.go | 612 - tdapi/tl_chat_lists_gen.go | 227 - tdapi/tl_chat_location_gen.go | 227 - tdapi/tl_chat_member_gen.go | 319 - tdapi/tl_chat_member_status_gen.go | 1402 - tdapi/tl_chat_members_filter_gen.go | 1196 - tdapi/tl_chat_members_gen.go | 255 - tdapi/tl_chat_message_sender_gen.go | 237 - tdapi/tl_chat_message_senders_gen.go | 221 - tdapi/tl_chat_notification_settings_gen.go | 710 - tdapi/tl_chat_permissions_gen.go | 636 - tdapi/tl_chat_photo_gen.go | 426 - tdapi/tl_chat_photo_info_gen.go | 331 - tdapi/tl_chat_photo_sticker_gen.go | 248 - tdapi/tl_chat_photo_sticker_type_gen.go | 535 - tdapi/tl_chat_photos_gen.go | 255 - tdapi/tl_chat_position_gen.go | 316 - tdapi/tl_chat_revenue_amount_gen.go | 331 - tdapi/tl_chat_revenue_statistics_gen.go | 315 - tdapi/tl_chat_revenue_transaction_gen.go | 271 - tdapi/tl_chat_revenue_transaction_type_gen.go | 828 - tdapi/tl_chat_revenue_transactions_gen.go | 255 - tdapi/tl_chat_source_gen.go | 500 - ...atistics_administrator_actions_info_gen.go | 295 - tdapi/tl_chat_statistics_gen.go | 2051 - ...tl_chat_statistics_interaction_info_gen.go | 305 - tdapi/tl_chat_statistics_inviter_info_gen.go | 227 - ...chat_statistics_message_sender_info_gen.go | 261 - tdapi/tl_chat_statistics_object_type_gen.go | 501 - tdapi/tl_chat_theme_gen.go | 261 - tdapi/tl_chat_type_gen.go | 931 - tdapi/tl_chats_gen.go | 251 - .../tl_check_authentication_bot_token_gen.go | 206 - tdapi/tl_check_authentication_code_gen.go | 206 - .../tl_check_authentication_email_code_gen.go | 216 - tdapi/tl_check_authentication_password_gen.go | 206 - ...thentication_password_recovery_code_gen.go | 206 - tdapi/tl_check_chat_folder_invite_link_gen.go | 206 - tdapi/tl_check_chat_invite_link_gen.go | 206 - tdapi/tl_check_chat_username_gen.go | 238 - tdapi/tl_check_chat_username_result_gen.go | 1021 - ...tl_check_created_public_chats_limit_gen.go | 216 - ...eck_email_address_verification_code_gen.go | 206 - .../tl_check_login_email_address_code_gen.go | 216 - tdapi/tl_check_password_recovery_code_gen.go | 206 - tdapi/tl_check_phone_number_code_gen.go | 206 - tdapi/tl_check_premium_gift_code_gen.go | 206 - .../tl_check_quick_reply_shortcut_name_gen.go | 206 - ...l_check_recovery_email_address_code_gen.go | 206 - tdapi/tl_check_sticker_set_name_gen.go | 206 - tdapi/tl_check_sticker_set_name_result_gen.go | 577 - tdapi/tl_check_web_app_file_download_gen.go | 271 - tdapi/tl_clean_file_name_gen.go | 206 - tdapi/tl_clear_all_draft_messages_gen.go | 206 - ..._clear_autosave_settings_exceptions_gen.go | 169 - tdapi/tl_clear_imported_contacts_gen.go | 169 - tdapi/tl_clear_recent_emoji_statuses_gen.go | 169 - tdapi/tl_clear_recent_reactions_gen.go | 169 - tdapi/tl_clear_recent_stickers_gen.go | 207 - tdapi/tl_clear_recently_found_chats_gen.go | 169 - tdapi/tl_clear_searched_for_tags_gen.go | 207 - tdapi/tl_click_animated_emoji_message_gen.go | 237 - tdapi/tl_click_chat_sponsored_message_gen.go | 306 - ...l_click_premium_subscription_button_gen.go | 169 - tdapi/tl_client_gen.go | 54 - tdapi/tl_close_birthday_user_gen.go | 227 - tdapi/tl_close_chat_gen.go | 206 - tdapi/tl_close_gen.go | 169 - tdapi/tl_close_secret_chat_gen.go | 206 - tdapi/tl_close_story_gen.go | 237 - tdapi/tl_close_web_app_gen.go | 206 - tdapi/tl_closed_vector_path_gen.go | 227 - tdapi/tl_collectible_item_info_gen.go | 363 - tdapi/tl_collectible_item_type_gen.go | 501 - ...mmit_pending_paid_message_reactions_gen.go | 237 - .../tl_confirm_qr_code_authentication_gen.go | 206 - tdapi/tl_confirm_session_gen.go | 206 - tdapi/tl_connect_affiliate_program_gen.go | 247 - tdapi/tl_connected_affiliate_program_gen.go | 398 - tdapi/tl_connected_affiliate_programs_gen.go | 289 - tdapi/tl_connected_website_gen.go | 466 - tdapi/tl_connected_websites_gen.go | 221 - tdapi/tl_connection_state_gen.go | 869 - tdapi/tl_contact_gen.go | 329 - tdapi/tl_count_gen.go | 193 - tdapi/tl_countries_gen.go | 221 - tdapi/tl_country_info_gen.go | 353 - tdapi/tl_create_basic_group_chat_gen.go | 238 - tdapi/tl_create_business_chat_link_gen.go | 206 - tdapi/tl_create_call_gen.go | 306 - tdapi/tl_create_chat_folder_gen.go | 206 - .../tl_create_chat_folder_invite_link_gen.go | 297 - tdapi/tl_create_chat_invite_link_gen.go | 341 - ...reate_chat_subscription_invite_link_gen.go | 272 - tdapi/tl_create_forum_topic_gen.go | 273 - tdapi/tl_create_group_call_gen.go | 206 - tdapi/tl_create_invoice_link_gen.go | 247 - tdapi/tl_create_new_basic_group_chat_gen.go | 297 - tdapi/tl_create_new_secret_chat_gen.go | 206 - tdapi/tl_create_new_sticker_set_gen.go | 450 - tdapi/tl_create_new_supergroup_chat_gen.go | 410 - tdapi/tl_create_private_chat_gen.go | 238 - tdapi/tl_create_secret_chat_gen.go | 206 - tdapi/tl_create_supergroup_chat_gen.go | 238 - tdapi/tl_create_temporary_password_gen.go | 238 - tdapi/tl_create_video_chat_gen.go | 307 - tdapi/tl_created_basic_group_chat_gen.go | 227 - tdapi/tl_current_weather_gen.go | 227 - tdapi/tl_custom_request_result_gen.go | 193 - tdapi/tl_database_statistics_gen.go | 193 - tdapi/tl_date_gen.go | 261 - tdapi/tl_date_range_gen.go | 227 - tdapi/tl_dated_file_gen.go | 227 - tdapi/tl_deep_link_info_gen.go | 227 - tdapi/tl_delete_account_gen.go | 239 - tdapi/tl_delete_all_call_messages_gen.go | 206 - ...elete_all_revoked_chat_invite_links_gen.go | 238 - tdapi/tl_delete_bot_media_previews_gen.go | 295 - tdapi/tl_delete_business_chat_link_gen.go | 206 - tdapi/tl_delete_business_connected_bot_gen.go | 206 - tdapi/tl_delete_chat_background_gen.go | 238 - tdapi/tl_delete_chat_folder_gen.go | 262 - .../tl_delete_chat_folder_invite_link_gen.go | 237 - tdapi/tl_delete_chat_gen.go | 206 - tdapi/tl_delete_chat_history_gen.go | 271 - tdapi/tl_delete_chat_messages_by_date_gen.go | 305 - .../tl_delete_chat_messages_by_sender_gen.go | 247 - tdapi/tl_delete_chat_reply_markup_gen.go | 237 - tdapi/tl_delete_commands_gen.go | 248 - tdapi/tl_delete_default_background_gen.go | 206 - tdapi/tl_delete_file_gen.go | 206 - tdapi/tl_delete_forum_topic_gen.go | 237 - tdapi/tl_delete_language_pack_gen.go | 206 - tdapi/tl_delete_messages_gen.go | 298 - tdapi/tl_delete_passport_element_gen.go | 216 - tdapi/tl_delete_profile_photo_gen.go | 206 - tdapi/tl_delete_quick_reply_shortcut_gen.go | 206 - ...elete_quick_reply_shortcut_messages_gen.go | 261 - .../tl_delete_revoked_chat_invite_link_gen.go | 237 - tdapi/tl_delete_saved_credentials_gen.go | 169 - ...delete_saved_messages_topic_history_gen.go | 206 - ...ved_messages_topic_messages_by_date_gen.go | 271 - tdapi/tl_delete_saved_order_info_gen.go | 169 - tdapi/tl_delete_sticker_set_gen.go | 206 - tdapi/tl_delete_story_gen.go | 237 - tdapi/tl_destroy_gen.go | 169 - tdapi/tl_device_token_gen.go | 2552 -- tdapi/tl_dice_stickers_gen.go | 639 - ...tl_disable_all_supergroup_usernames_gen.go | 206 - tdapi/tl_disable_proxy_gen.go | 169 - tdapi/tl_discard_call_gen.go | 339 - tdapi/tl_disconnect_affiliate_program_gen.go | 247 - tdapi/tl_disconnect_all_websites_gen.go | 169 - tdapi/tl_disconnect_website_gen.go | 206 - tdapi/tl_document_gen.go | 330 - tdapi/tl_double_gen.go | 158 - tdapi/tl_download_file_gen.go | 345 - tdapi/tl_downloaded_file_counts_gen.go | 261 - tdapi/tl_draft_message_gen.go | 317 - tdapi/tl_edit_bot_media_preview_gen.go | 315 - tdapi/tl_edit_business_chat_link_gen.go | 237 - tdapi/tl_edit_business_message_caption_gen.go | 385 - ...edit_business_message_live_location_gen.go | 453 - tdapi/tl_edit_business_message_media_gen.go | 360 - ..._edit_business_message_reply_markup_gen.go | 315 - tdapi/tl_edit_business_message_text_gen.go | 359 - tdapi/tl_edit_chat_folder_gen.go | 237 - tdapi/tl_edit_chat_folder_invite_link_gen.go | 331 - tdapi/tl_edit_chat_invite_link_gen.go | 375 - ..._edit_chat_subscription_invite_link_gen.go | 271 - .../tl_edit_custom_language_pack_info_gen.go | 206 - tdapi/tl_edit_forum_topic_gen.go | 341 - tdapi/tl_edit_inline_message_caption_gen.go | 317 - ...l_edit_inline_message_live_location_gen.go | 385 - tdapi/tl_edit_inline_message_media_gen.go | 292 - ...tl_edit_inline_message_reply_markup_gen.go | 247 - tdapi/tl_edit_inline_message_text_gen.go | 291 - tdapi/tl_edit_message_caption_gen.go | 352 - tdapi/tl_edit_message_live_location_gen.go | 420 - tdapi/tl_edit_message_media_gen.go | 327 - tdapi/tl_edit_message_reply_markup_gen.go | 282 - tdapi/tl_edit_message_scheduling_state_gen.go | 283 - tdapi/tl_edit_message_text_gen.go | 326 - tdapi/tl_edit_proxy_gen.go | 349 - tdapi/tl_edit_quick_reply_message_gen.go | 283 - tdapi/tl_edit_star_subscription_gen.go | 237 - tdapi/tl_edit_story_cover_gen.go | 271 - tdapi/tl_edit_story_gen.go | 350 - tdapi/tl_edit_user_star_subscription_gen.go | 271 - ...il_address_authentication_code_info_gen.go | 227 - tdapi/tl_email_address_authentication_gen.go | 682 - tdapi/tl_email_address_reset_state_gen.go | 503 - tdapi/tl_emoji_categories_gen.go | 221 - tdapi/tl_emoji_category_gen.go | 305 - tdapi/tl_emoji_category_source_gen.go | 490 - tdapi/tl_emoji_category_type_gen.go | 723 - tdapi/tl_emoji_keyword_gen.go | 227 - tdapi/tl_emoji_keywords_gen.go | 221 - tdapi/tl_emoji_reaction_gen.go | 499 - tdapi/tl_emoji_status_gen.go | 227 - tdapi/tl_emoji_statuses_gen.go | 217 - tdapi/tl_emojis_gen.go | 217 - tdapi/tl_enable_proxy_gen.go | 206 - tdapi/tl_encrypted_credentials_gen.go | 261 - tdapi/tl_encrypted_passport_element_gen.go | 531 - tdapi/tl_end_group_call_gen.go | 206 - tdapi/tl_end_group_call_recording_gen.go | 206 - tdapi/tl_end_group_call_screen_sharing_gen.go | 206 - tdapi/tl_error_gen.go | 228 - tdapi/tl_fact_check_gen.go | 228 - tdapi/tl_failed_to_add_member_gen.go | 263 - tdapi/tl_failed_to_add_members_gen.go | 221 - tdapi/tl_file_download_gen.go | 330 - tdapi/tl_file_downloaded_prefix_size_gen.go | 193 - tdapi/tl_file_gen.go | 330 - tdapi/tl_file_part_gen.go | 193 - tdapi/tl_file_type_gen.go | 3497 -- tdapi/tl_finish_file_generation_gen.go | 238 - ...tl_firebase_authentication_settings_gen.go | 502 - ...base_device_verification_parameters_gen.go | 539 - tdapi/tl_formatted_text_gen.go | 256 - tdapi/tl_forum_topic_gen.go | 499 - tdapi/tl_forum_topic_icon_gen.go | 227 - tdapi/tl_forum_topic_info_gen.go | 475 - tdapi/tl_forum_topics_gen.go | 357 - tdapi/tl_forward_messages_gen.go | 435 - tdapi/tl_forward_source_gen.go | 375 - tdapi/tl_found_affiliate_program_gen.go | 227 - tdapi/tl_found_affiliate_programs_gen.go | 289 - tdapi/tl_found_chat_boosts_gen.go | 289 - tdapi/tl_found_chat_messages_gen.go | 289 - tdapi/tl_found_file_downloads_gen.go | 289 - tdapi/tl_found_messages_gen.go | 289 - tdapi/tl_found_position_gen.go | 193 - tdapi/tl_found_positions_gen.go | 251 - tdapi/tl_found_stories_gen.go | 289 - tdapi/tl_found_users_gen.go | 251 - tdapi/tl_found_web_app_gen.go | 263 - tdapi/tl_game_gen.go | 397 - tdapi/tl_game_high_score_gen.go | 261 - tdapi/tl_game_high_scores_gen.go | 221 - tdapi/tl_get_account_ttl_gen.go | 169 - tdapi/tl_get_active_sessions_gen.go | 169 - tdapi/tl_get_all_passport_elements_gen.go | 206 - tdapi/tl_get_all_sticker_emojis_gen.go | 315 - tdapi/tl_get_animated_emoji_gen.go | 206 - tdapi/tl_get_application_config_gen.go | 169 - tdapi/tl_get_application_download_link_gen.go | 169 - .../tl_get_archive_chat_list_settings_gen.go | 169 - tdapi/tl_get_archived_sticker_sets_gen.go | 282 - tdapi/tl_get_attached_sticker_sets_gen.go | 206 - tdapi/tl_get_attachment_menu_bot_gen.go | 206 - tdapi/tl_get_authorization_state_gen.go | 169 - ..._get_auto_download_settings_presets_gen.go | 169 - tdapi/tl_get_autosave_settings_gen.go | 169 - .../tl_get_available_chat_boost_slots_gen.go | 169 - tdapi/tl_get_available_gifts_gen.go | 169 - tdapi/tl_get_background_url_gen.go | 247 - tdapi/tl_get_bank_card_info_gen.go | 206 - tdapi/tl_get_basic_group_full_info_gen.go | 206 - tdapi/tl_get_basic_group_gen.go | 206 - tdapi/tl_get_blocked_message_senders_gen.go | 281 - tdapi/tl_get_bot_info_description_gen.go | 237 - .../tl_get_bot_info_short_description_gen.go | 237 - tdapi/tl_get_bot_media_preview_info_gen.go | 238 - tdapi/tl_get_bot_media_previews_gen.go | 206 - tdapi/tl_get_bot_name_gen.go | 237 - tdapi/tl_get_business_chat_link_info_gen.go | 206 - tdapi/tl_get_business_chat_links_gen.go | 169 - tdapi/tl_get_business_connected_bot_gen.go | 169 - tdapi/tl_get_business_connection_gen.go | 206 - tdapi/tl_get_business_features_gen.go | 217 - tdapi/tl_get_callback_query_answer_gen.go | 282 - tdapi/tl_get_callback_query_message_gen.go | 271 - tdapi/tl_get_chat_active_stories_gen.go | 206 - tdapi/tl_get_chat_administrators_gen.go | 206 - tdapi/tl_get_chat_archived_stories_gen.go | 272 - ..._get_chat_available_message_senders_gen.go | 206 - tdapi/tl_get_chat_boost_features_gen.go | 207 - tdapi/tl_get_chat_boost_level_features_gen.go | 238 - tdapi/tl_get_chat_boost_link_gen.go | 206 - tdapi/tl_get_chat_boost_link_info_gen.go | 206 - tdapi/tl_get_chat_boost_status_gen.go | 206 - tdapi/tl_get_chat_boosts_gen.go | 308 - tdapi/tl_get_chat_event_log_gen.go | 399 - tdapi/tl_get_chat_folder_chat_count_gen.go | 206 - .../tl_get_chat_folder_chats_to_leave_gen.go | 206 - ...l_get_chat_folder_default_icon_name_gen.go | 206 - tdapi/tl_get_chat_folder_gen.go | 206 - tdapi/tl_get_chat_folder_invite_links_gen.go | 206 - tdapi/tl_get_chat_folder_new_chats_gen.go | 206 - tdapi/tl_get_chat_gen.go | 206 - tdapi/tl_get_chat_history_gen.go | 343 - tdapi/tl_get_chat_invite_link_counts_gen.go | 206 - tdapi/tl_get_chat_invite_link_gen.go | 237 - tdapi/tl_get_chat_invite_link_members_gen.go | 341 - tdapi/tl_get_chat_invite_links_gen.go | 376 - tdapi/tl_get_chat_join_requests_gen.go | 343 - tdapi/tl_get_chat_lists_to_add_chat_gen.go | 206 - tdapi/tl_get_chat_member_gen.go | 247 - tdapi/tl_get_chat_message_by_date_gen.go | 237 - tdapi/tl_get_chat_message_calendar_gen.go | 319 - tdapi/tl_get_chat_message_count_gen.go | 317 - tdapi/tl_get_chat_message_position_gen.go | 352 - ...at_notification_settings_exceptions_gen.go | 248 - tdapi/tl_get_chat_pinned_message_gen.go | 206 - ...et_chat_posted_to_chat_page_stories_gen.go | 272 - tdapi/tl_get_chat_revenue_statistics_gen.go | 237 - tdapi/tl_get_chat_revenue_transactions_gen.go | 271 - .../tl_get_chat_revenue_withdrawal_url_gen.go | 237 - tdapi/tl_get_chat_scheduled_messages_gen.go | 206 - tdapi/tl_get_chat_similar_chat_count_gen.go | 238 - tdapi/tl_get_chat_similar_chats_gen.go | 206 - ...l_get_chat_sparse_message_positions_gen.go | 353 - tdapi/tl_get_chat_sponsored_messages_gen.go | 206 - tdapi/tl_get_chat_statistics_gen.go | 237 - tdapi/tl_get_chat_story_interactions_gen.go | 387 - ...t_chats_for_chat_folder_invite_link_gen.go | 206 - tdapi/tl_get_chats_gen.go | 247 - tdapi/tl_get_chats_to_send_stories_gen.go | 169 - tdapi/tl_get_close_friends_gen.go | 169 - tdapi/tl_get_collectible_item_info_gen.go | 217 - tdapi/tl_get_commands_gen.go | 248 - .../tl_get_connected_affiliate_program_gen.go | 247 - ...tl_get_connected_affiliate_programs_gen.go | 282 - tdapi/tl_get_connected_websites_gen.go | 169 - tdapi/tl_get_contacts_gen.go | 169 - tdapi/tl_get_countries_gen.go | 169 - tdapi/tl_get_country_code_gen.go | 169 - tdapi/tl_get_country_flag_emoji_gen.go | 206 - tdapi/tl_get_created_public_chats_gen.go | 216 - tdapi/tl_get_current_state_gen.go | 169 - tdapi/tl_get_current_weather_gen.go | 206 - ...et_custom_emoji_reaction_animations_gen.go | 169 - tdapi/tl_get_custom_emoji_stickers_gen.go | 231 - tdapi/tl_get_database_statistics_gen.go | 169 - tdapi/tl_get_deep_link_info_gen.go | 206 - ...lt_background_custom_emoji_stickers_gen.go | 169 - .../tl_get_default_chat_emoji_statuses_gen.go | 169 - ...lt_chat_photo_custom_emoji_stickers_gen.go | 169 - tdapi/tl_get_default_emoji_statuses_gen.go | 169 - ...et_default_message_auto_delete_time_gen.go | 169 - ...profile_photo_custom_emoji_stickers_gen.go | 169 - ..._get_disallowed_chat_emoji_statuses_gen.go | 169 - tdapi/tl_get_emoji_categories_gen.go | 216 - tdapi/tl_get_emoji_reaction_gen.go | 206 - tdapi/tl_get_emoji_suggestions_url_gen.go | 206 - tdapi/tl_get_external_link_gen.go | 238 - tdapi/tl_get_external_link_info_gen.go | 206 - tdapi/tl_get_favorite_stickers_gen.go | 169 - .../tl_get_file_downloaded_prefix_size_gen.go | 237 - tdapi/tl_get_file_extension_gen.go | 206 - tdapi/tl_get_file_gen.go | 206 - tdapi/tl_get_file_mime_type_gen.go | 206 - tdapi/tl_get_forum_topic_default_icons_gen.go | 169 - tdapi/tl_get_forum_topic_gen.go | 237 - tdapi/tl_get_forum_topic_link_gen.go | 237 - tdapi/tl_get_forum_topics_gen.go | 377 - tdapi/tl_get_game_high_scores_gen.go | 271 - tdapi/tl_get_gift_upgrade_preview_gen.go | 206 - tdapi/tl_get_giveaway_info_gen.go | 237 - tdapi/tl_get_greeting_stickers_gen.go | 169 - tdapi/tl_get_grossing_web_app_bots_gen.go | 238 - tdapi/tl_get_group_call_gen.go | 206 - tdapi/tl_get_group_call_invite_link_gen.go | 239 - tdapi/tl_get_group_call_stream_segment_gen.go | 349 - tdapi/tl_get_group_call_streams_gen.go | 206 - tdapi/tl_get_groups_in_common_gen.go | 271 - tdapi/tl_get_imported_contact_count_gen.go | 169 - tdapi/tl_get_inactive_supergroup_chats_gen.go | 169 - tdapi/tl_get_inline_game_high_scores_gen.go | 237 - tdapi/tl_get_inline_query_results_gen.go | 340 - tdapi/tl_get_installed_backgrounds_gen.go | 206 - tdapi/tl_get_installed_sticker_sets_gen.go | 216 - tdapi/tl_get_internal_link_gen.go | 248 - tdapi/tl_get_internal_link_type_gen.go | 206 - tdapi/tl_get_json_string_gen.go | 216 - tdapi/tl_get_json_value_gen.go | 206 - tdapi/tl_get_keyword_emojis_gen.go | 262 - tdapi/tl_get_language_pack_info_gen.go | 206 - tdapi/tl_get_language_pack_string_gen.go | 305 - tdapi/tl_get_language_pack_strings_gen.go | 262 - tdapi/tl_get_link_preview_gen.go | 238 - tdapi/tl_get_localization_target_info_gen.go | 206 - tdapi/tl_get_log_stream_gen.go | 169 - tdapi/tl_get_log_tag_verbosity_level_gen.go | 206 - tdapi/tl_get_log_tags_gen.go | 169 - tdapi/tl_get_log_verbosity_level_gen.go | 169 - tdapi/tl_get_login_url_gen.go | 305 - tdapi/tl_get_login_url_info_gen.go | 271 - tdapi/tl_get_main_web_app_gen.go | 305 - tdapi/tl_get_map_thumbnail_file_gen.go | 373 - tdapi/tl_get_markdown_text_gen.go | 206 - tdapi/tl_get_me_gen.go | 169 - tdapi/tl_get_menu_button_gen.go | 206 - tdapi/tl_get_message_added_reactions_gen.go | 354 - .../tl_get_message_available_reactions_gen.go | 271 - tdapi/tl_get_message_effect_gen.go | 206 - tdapi/tl_get_message_embedding_code_gen.go | 271 - tdapi/tl_get_message_file_type_gen.go | 206 - tdapi/tl_get_message_gen.go | 237 - ...et_message_import_confirmation_text_gen.go | 208 - tdapi/tl_get_message_link_gen.go | 341 - tdapi/tl_get_message_link_info_gen.go | 206 - tdapi/tl_get_message_locally_gen.go | 237 - tdapi/tl_get_message_properties_gen.go | 237 - tdapi/tl_get_message_public_forwards_gen.go | 308 - tdapi/tl_get_message_read_date_gen.go | 237 - tdapi/tl_get_message_statistics_gen.go | 271 - tdapi/tl_get_message_thread_gen.go | 237 - tdapi/tl_get_message_thread_history_gen.go | 343 - tdapi/tl_get_message_viewers_gen.go | 237 - tdapi/tl_get_messages_gen.go | 261 - tdapi/tl_get_network_statistics_gen.go | 206 - tdapi/tl_get_new_chat_privacy_settings_gen.go | 169 - tdapi/tl_get_option_gen.go | 206 - tdapi/tl_get_owned_bots_gen.go | 169 - tdapi/tl_get_owned_sticker_sets_gen.go | 240 - ...thorization_form_available_elements_gen.go | 237 - .../tl_get_passport_authorization_form_gen.go | 305 - tdapi/tl_get_passport_element_gen.go | 247 - tdapi/tl_get_password_state_gen.go | 169 - tdapi/tl_get_payment_form_gen.go | 247 - tdapi/tl_get_payment_receipt_gen.go | 237 - tdapi/tl_get_phone_number_info_gen.go | 206 - tdapi/tl_get_phone_number_info_sync_gen.go | 237 - tdapi/tl_get_poll_voters_gen.go | 342 - .../tl_get_preferred_country_language_gen.go | 206 - tdapi/tl_get_premium_features_gen.go | 216 - ...t_premium_gift_code_payment_options_gen.go | 207 - tdapi/tl_get_premium_info_sticker_gen.go | 206 - tdapi/tl_get_premium_limit_gen.go | 216 - tdapi/tl_get_premium_state_gen.go | 169 - tdapi/tl_get_premium_sticker_examples_gen.go | 169 - tdapi/tl_get_premium_stickers_gen.go | 206 - tdapi/tl_get_prepared_inline_message_gen.go | 237 - tdapi/tl_get_proxies_gen.go | 169 - tdapi/tl_get_proxy_link_gen.go | 206 - tdapi/tl_get_push_receiver_id_gen.go | 206 - .../tl_get_read_date_privacy_settings_gen.go | 169 - tdapi/tl_get_recent_emoji_statuses_gen.go | 169 - tdapi/tl_get_recent_inline_bots_gen.go | 169 - tdapi/tl_get_recent_stickers_gen.go | 207 - tdapi/tl_get_recently_opened_chats_gen.go | 206 - .../tl_get_recently_visited_t_me_urls_gen.go | 206 - tdapi/tl_get_recommended_chat_folders_gen.go | 169 - tdapi/tl_get_recommended_chats_gen.go | 169 - tdapi/tl_get_recovery_email_address_gen.go | 206 - tdapi/tl_get_remote_file_gen.go | 247 - tdapi/tl_get_replied_message_gen.go | 237 - tdapi/tl_get_saved_animations_gen.go | 169 - tdapi/tl_get_saved_messages_tags_gen.go | 207 - ...tl_get_saved_messages_topic_history_gen.go | 309 - ...aved_messages_topic_message_by_date_gen.go | 237 - tdapi/tl_get_saved_notification_sound_gen.go | 206 - tdapi/tl_get_saved_notification_sounds_gen.go | 169 - tdapi/tl_get_saved_order_info_gen.go | 169 - .../tl_get_scope_notification_settings_gen.go | 216 - tdapi/tl_get_searched_for_tags_gen.go | 237 - tdapi/tl_get_secret_chat_gen.go | 206 - tdapi/tl_get_star_ad_account_url_gen.go | 217 - tdapi/tl_get_star_gift_payment_options_gen.go | 207 - ...l_get_star_giveaway_payment_options_gen.go | 169 - tdapi/tl_get_star_payment_options_gen.go | 169 - tdapi/tl_get_star_revenue_statistics_gen.go | 249 - tdapi/tl_get_star_subscriptions_gen.go | 239 - tdapi/tl_get_star_transactions_gen.go | 361 - tdapi/tl_get_star_withdrawal_url_gen.go | 283 - tdapi/tl_get_statistical_graph_gen.go | 271 - tdapi/tl_get_sticker_emojis_gen.go | 216 - tdapi/tl_get_sticker_outline_gen.go | 271 - tdapi/tl_get_sticker_set_gen.go | 206 - tdapi/tl_get_sticker_set_name_gen.go | 206 - tdapi/tl_get_stickers_gen.go | 317 - tdapi/tl_get_storage_statistics_fast_gen.go | 169 - tdapi/tl_get_storage_statistics_gen.go | 209 - tdapi/tl_get_story_available_reactions_gen.go | 206 - tdapi/tl_get_story_gen.go | 271 - tdapi/tl_get_story_interactions_gen.go | 412 - ...ry_notification_settings_exceptions_gen.go | 169 - tdapi/tl_get_story_public_forwards_gen.go | 308 - tdapi/tl_get_story_statistics_gen.go | 271 - tdapi/tl_get_suggested_file_name_gen.go | 237 - .../tl_get_suggested_sticker_set_name_gen.go | 206 - tdapi/tl_get_suitable_discussion_chats_gen.go | 169 - tdapi/tl_get_suitable_personal_chats_gen.go | 169 - tdapi/tl_get_supergroup_full_info_gen.go | 206 - tdapi/tl_get_supergroup_gen.go | 206 - tdapi/tl_get_supergroup_members_gen.go | 315 - tdapi/tl_get_support_name_gen.go | 169 - tdapi/tl_get_support_user_gen.go | 169 - tdapi/tl_get_temporary_password_state_gen.go | 169 - tdapi/tl_get_text_entities_gen.go | 206 - ...tl_get_theme_parameters_json_string_gen.go | 206 - .../tl_get_themed_chat_emoji_statuses_gen.go | 169 - tdapi/tl_get_themed_emoji_statuses_gen.go | 169 - tdapi/tl_get_time_zones_gen.go | 169 - tdapi/tl_get_top_chats_gen.go | 247 - tdapi/tl_get_trending_sticker_sets_gen.go | 283 - tdapi/tl_get_user_chat_boosts_gen.go | 237 - tdapi/tl_get_user_full_info_gen.go | 206 - tdapi/tl_get_user_gen.go | 206 - tdapi/tl_get_user_gift_gen.go | 206 - tdapi/tl_get_user_gifts_gen.go | 274 - tdapi/tl_get_user_link_gen.go | 169 - .../tl_get_user_privacy_setting_rules_gen.go | 216 - tdapi/tl_get_user_profile_photos_gen.go | 271 - tdapi/tl_get_user_support_info_gen.go | 206 - ...t_video_chat_available_participants_gen.go | 206 - tdapi/tl_get_video_chat_rtmp_url_gen.go | 206 - tdapi/tl_get_web_app_link_url_gen.go | 373 - tdapi/tl_get_web_app_placeholder_gen.go | 206 - tdapi/tl_get_web_app_url_gen.go | 272 - tdapi/tl_get_web_page_instant_view_gen.go | 237 - tdapi/tl_gift_gen.go | 505 - tdapi/tl_gift_upgrade_preview_gen.go | 345 - tdapi/tl_gifts_gen.go | 221 - tdapi/tl_giveaway_info_gen.go | 824 - tdapi/tl_giveaway_parameters_gen.go | 450 - tdapi/tl_giveaway_participant_status_gen.go | 978 - tdapi/tl_giveaway_prize_gen.go | 502 - tdapi/tl_group_call_gen.go | 906 - tdapi/tl_group_call_id_gen.go | 193 - tdapi/tl_group_call_participant_gen.go | 786 - ...l_group_call_participant_video_info_gen.go | 290 - tdapi/tl_group_call_recent_speaker_gen.go | 237 - tdapi/tl_group_call_stream_gen.go | 261 - tdapi/tl_group_call_streams_gen.go | 221 - tdapi/tl_group_call_video_quality_gen.go | 577 - tdapi/tl_group_call_video_source_group_gen.go | 251 - tdapi/tl_hashtags_gen.go | 217 - tdapi/tl_hide_contact_close_birthdays_gen.go | 169 - tdapi/tl_hide_suggested_action_gen.go | 216 - tdapi/tl_http_url_gen.go | 193 - tdapi/tl_identity_document_gen.go | 391 - tdapi/tl_import_contacts_gen.go | 235 - tdapi/tl_import_messages_gen.go | 319 - tdapi/tl_imported_contacts_gen.go | 277 - tdapi/tl_inline_keyboard_button_gen.go | 237 - tdapi/tl_inline_keyboard_button_type_gen.go | 1994 - tdapi/tl_inline_query_result_gen.go | 3232 -- tdapi/tl_inline_query_results_button_gen.go | 237 - ...tl_inline_query_results_button_type_gen.go | 503 - tdapi/tl_inline_query_results_gen.go | 329 - tdapi/tl_input_background_gen.go | 693 - tdapi/tl_input_business_chat_link_gen.go | 227 - tdapi/tl_input_business_start_page_gen.go | 274 - tdapi/tl_input_chat_photo_gen.go | 919 - tdapi/tl_input_credentials_gen.go | 897 - tdapi/tl_input_file_gen.go | 935 - tdapi/tl_input_identity_document_gen.go | 428 - tdapi/tl_input_inline_query_result_gen.go | 5441 --- tdapi/tl_input_invoice_gen.go | 727 - tdapi/tl_input_message_content_gen.go | 6562 --- tdapi/tl_input_message_reply_to_gen.go | 824 - tdapi/tl_input_paid_media_gen.go | 407 - tdapi/tl_input_paid_media_type_gen.go | 500 - tdapi/tl_input_passport_element_error_gen.go | 281 - ...input_passport_element_error_source_gen.go | 1868 - tdapi/tl_input_passport_element_gen.go | 2492 -- tdapi/tl_input_personal_document_gen.go | 295 - tdapi/tl_input_sticker_gen.go | 375 - tdapi/tl_input_story_area_gen.go | 237 - tdapi/tl_input_story_area_type_gen.go | 1690 - tdapi/tl_input_story_areas_gen.go | 221 - tdapi/tl_input_story_content_gen.go | 745 - tdapi/tl_input_text_quote_gen.go | 229 - tdapi/tl_input_thumbnail_gen.go | 271 - tdapi/tl_int32_gen.go | 158 - tdapi/tl_int53_gen.go | 158 - tdapi/tl_int64_gen.go | 158 - tdapi/tl_internal_link_type_gen.go | 9184 ---- .../tl_invite_group_call_participants_gen.go | 261 - tdapi/tl_invite_link_chat_type_gen.go | 577 - tdapi/tl_invoice_gen.go | 725 - tdapi/tl_join_chat_by_invite_link_gen.go | 206 - tdapi/tl_join_chat_gen.go | 206 - tdapi/tl_join_group_call_gen.go | 419 - tdapi/tl_json_object_member_gen.go | 237 - tdapi/tl_json_value_gen.go | 1252 - tdapi/tl_keyboard_button_gen.go | 237 - tdapi/tl_keyboard_button_type_gen.go | 2021 - tdapi/tl_labeled_price_part_gen.go | 227 - tdapi/tl_language_pack_info_gen.go | 604 - tdapi/tl_language_pack_string_gen.go | 238 - tdapi/tl_language_pack_string_value_gen.go | 817 - tdapi/tl_language_pack_strings_gen.go | 221 - tdapi/tl_launch_prepaid_giveaway_gen.go | 306 - tdapi/tl_leave_chat_gen.go | 206 - tdapi/tl_leave_group_call_gen.go | 206 - tdapi/tl_link_preview_album_media_gen.go | 501 - tdapi/tl_link_preview_gen.go | 615 - tdapi/tl_link_preview_options_gen.go | 333 - tdapi/tl_link_preview_type_gen.go | 6570 --- tdapi/tl_load_active_stories_gen.go | 216 - tdapi/tl_load_chats_gen.go | 249 - tdapi/tl_load_group_call_participants_gen.go | 238 - ..._load_quick_reply_shortcut_messages_gen.go | 206 - tdapi/tl_load_quick_reply_shortcuts_gen.go | 169 - tdapi/tl_load_saved_messages_topics_gen.go | 208 - tdapi/tl_local_file_gen.go | 436 - tdapi/tl_localization_target_info_gen.go | 221 - tdapi/tl_location_address_gen.go | 295 - tdapi/tl_location_gen.go | 262 - tdapi/tl_log_out_gen.go | 169 - tdapi/tl_log_stream_gen.go | 681 - tdapi/tl_log_tags_gen.go | 217 - tdapi/tl_log_verbosity_level_gen.go | 193 - tdapi/tl_login_url_info_gen.go | 640 - tdapi/tl_main_web_app_gen.go | 237 - tdapi/tl_mask_point_gen.go | 723 - tdapi/tl_mask_position_gen.go | 308 - tdapi/tl_message_auto_delete_time_gen.go | 193 - tdapi/tl_message_calendar_day_gen.go | 227 - tdapi/tl_message_calendar_gen.go | 255 - tdapi/tl_message_content_gen.go | 19019 --------- tdapi/tl_message_copy_options_gen.go | 300 - tdapi/tl_message_effect_gen.go | 339 - tdapi/tl_message_effect_type_gen.go | 535 - tdapi/tl_message_file_type_gen.go | 647 - tdapi/tl_message_forward_info_gen.go | 308 - tdapi/tl_message_gen.go | 1497 - tdapi/tl_message_import_info_gen.go | 227 - tdapi/tl_message_interaction_info_gen.go | 297 - tdapi/tl_message_link_gen.go | 227 - tdapi/tl_message_link_info_gen.go | 366 - tdapi/tl_message_origin_gen.go | 966 - tdapi/tl_message_position_gen.go | 261 - tdapi/tl_message_positions_gen.go | 255 - tdapi/tl_message_properties_gen.go | 1055 - tdapi/tl_message_reaction_gen.go | 385 - tdapi/tl_message_reactions_gen.go | 351 - tdapi/tl_message_read_date_gen.go | 904 - tdapi/tl_message_reply_info_gen.go | 365 - tdapi/tl_message_reply_to_gen.go | 729 - tdapi/tl_message_scheduling_state_gen.go | 650 - tdapi/tl_message_self_destruct_type_gen.go | 467 - tdapi/tl_message_send_options_gen.go | 482 - tdapi/tl_message_sender_gen.go | 501 - tdapi/tl_message_senders_gen.go | 261 - tdapi/tl_message_sending_state_gen.go | 675 - tdapi/tl_message_source_gen.go | 1599 - tdapi/tl_message_sponsor_gen.go | 261 - tdapi/tl_message_statistics_gen.go | 247 - tdapi/tl_message_thread_info_gen.go | 392 - tdapi/tl_message_viewer_gen.go | 227 - tdapi/tl_message_viewers_gen.go | 221 - tdapi/tl_messages_gen.go | 255 - tdapi/tl_network_statistics_entry_gen.go | 745 - tdapi/tl_network_statistics_gen.go | 261 - tdapi/tl_network_type_gen.go | 869 - tdapi/tl_new_chat_privacy_settings_gen.go | 194 - tdapi/tl_notification_gen.go | 305 - tdapi/tl_notification_group_gen.go | 367 - tdapi/tl_notification_group_type_gen.go | 723 - tdapi/tl_notification_settings_scope_gen.go | 577 - tdapi/tl_notification_sound_gen.go | 363 - tdapi/tl_notification_sounds_gen.go | 221 - tdapi/tl_notification_type_gen.go | 1020 - tdapi/tl_ok_gen.go | 158 - tdapi/tl_open_chat_gen.go | 206 - tdapi/tl_open_chat_similar_chat_gen.go | 237 - tdapi/tl_open_message_content_gen.go | 237 - tdapi/tl_open_story_gen.go | 237 - tdapi/tl_open_web_app_gen.go | 386 - tdapi/tl_optimize_storage_gen.go | 564 - tdapi/tl_option_value_gen.go | 828 - tdapi/tl_order_info_gen.go | 295 - tdapi/tl_outline_gen.go | 221 - tdapi/tl_page_block_caption_gen.go | 247 - tdapi/tl_page_block_gen.go | 7131 ---- .../tl_page_block_horizontal_alignment_gen.go | 577 - tdapi/tl_page_block_list_item_gen.go | 261 - tdapi/tl_page_block_related_article_gen.go | 363 - tdapi/tl_page_block_table_cell_gen.go | 393 - tdapi/tl_page_block_vertical_alignment_gen.go | 577 - tdapi/tl_paid_media_gen.go | 930 - tdapi/tl_paid_reactor_gen.go | 341 - tdapi/tl_parse_markdown_gen.go | 207 - tdapi/tl_parse_text_entities_gen.go | 247 - tdapi/tl_passport_authorization_form_gen.go | 289 - tdapi/tl_passport_element_error_gen.go | 281 - tdapi/tl_passport_element_error_source_gen.go | 1562 - tdapi/tl_passport_element_gen.go | 2492 -- tdapi/tl_passport_element_type_gen.go | 2037 - tdapi/tl_passport_elements_gen.go | 227 - tdapi/tl_passport_elements_with_errors_gen.go | 289 - tdapi/tl_passport_required_element_gen.go | 221 - tdapi/tl_passport_suitable_element_gen.go | 306 - tdapi/tl_password_state_gen.go | 399 - tdapi/tl_payment_form_gen.go | 305 - tdapi/tl_payment_form_type_gen.go | 987 - tdapi/tl_payment_option_gen.go | 227 - tdapi/tl_payment_provider_gen.go | 818 - tdapi/tl_payment_receipt_gen.go | 305 - tdapi/tl_payment_receipt_type_gen.go | 705 - tdapi/tl_payment_result_gen.go | 228 - tdapi/tl_personal_details_gen.go | 499 - tdapi/tl_personal_document_gen.go | 283 - ...hone_number_authentication_settings_gen.go | 439 - tdapi/tl_phone_number_code_type_gen.go | 612 - tdapi/tl_phone_number_info_gen.go | 297 - tdapi/tl_photo_gen.go | 290 - tdapi/tl_photo_size_gen.go | 354 - tdapi/tl_pin_chat_message_gen.go | 306 - tdapi/tl_ping_proxy_gen.go | 206 - tdapi/tl_point_gen.go | 227 - tdapi/tl_poll_gen.go | 571 - tdapi/tl_poll_option_gen.go | 329 - tdapi/tl_poll_type_gen.go | 536 - tdapi/tl_preliminary_upload_file_gen.go | 293 - tdapi/tl_premium_feature_gen.go | 3643 -- ...premium_feature_promotion_animation_gen.go | 237 - tdapi/tl_premium_features_gen.go | 334 - tdapi/tl_premium_gift_code_info_gen.go | 411 - ...tl_premium_gift_code_payment_option_gen.go | 431 - ...l_premium_gift_code_payment_options_gen.go | 221 - tdapi/tl_premium_limit_gen.go | 271 - tdapi/tl_premium_limit_type_gen.go | 2913 -- tdapi/tl_premium_payment_option_gen.go | 376 - tdapi/tl_premium_source_gen.go | 1230 - tdapi/tl_premium_state_gen.go | 380 - tdapi/tl_premium_state_payment_option_gen.go | 296 - tdapi/tl_premium_story_feature_gen.go | 1161 - tdapi/tl_prepaid_giveaway_gen.go | 340 - tdapi/tl_prepared_inline_message_gen.go | 271 - tdapi/tl_prepared_inline_message_id_gen.go | 227 - tdapi/tl_process_chat_folder_new_chats_gen.go | 262 - tdapi/tl_process_chat_join_request_gen.go | 271 - tdapi/tl_process_chat_join_requests_gen.go | 273 - tdapi/tl_process_push_notification_gen.go | 207 - tdapi/tl_product_info_gen.go | 261 - tdapi/tl_profile_accent_color_gen.go | 329 - tdapi/tl_profile_accent_colors_gen.go | 336 - tdapi/tl_profile_photo_gen.go | 366 - tdapi/tl_proxies_gen.go | 221 - tdapi/tl_proxy_gen.go | 373 - tdapi/tl_proxy_type_gen.go | 785 - tdapi/tl_public_chat_type_gen.go | 431 - tdapi/tl_public_forward_gen.go | 501 - tdapi/tl_public_forwards_gen.go | 295 - tdapi/tl_push_message_content_gen.go | 7761 ---- tdapi/tl_push_receiver_id_gen.go | 193 - tdapi/tl_quick_reply_message_gen.go | 463 - tdapi/tl_quick_reply_messages_gen.go | 221 - tdapi/tl_quick_reply_shortcut_gen.go | 295 - tdapi/tl_rate_speech_recognition_gen.go | 271 - .../tl_reaction_notification_settings_gen.go | 315 - tdapi/tl_reaction_notification_source_gen.go | 577 - tdapi/tl_reaction_type_gen.go | 647 - .../tl_reaction_unavailability_reason_gen.go | 433 - tdapi/tl_read_all_chat_mentions_gen.go | 206 - tdapi/tl_read_all_chat_reactions_gen.go | 206 - ...tl_read_all_message_thread_mentions_gen.go | 237 - ...l_read_all_message_thread_reactions_gen.go | 237 - tdapi/tl_read_chat_list_gen.go | 216 - tdapi/tl_read_date_privacy_settings_gen.go | 195 - tdapi/tl_read_file_part_gen.go | 273 - ...readd_quick_reply_shortcut_messages_gen.go | 262 - tdapi/tl_recognize_speech_gen.go | 238 - tdapi/tl_recommended_chat_folder_gen.go | 227 - tdapi/tl_recommended_chat_folders_gen.go | 221 - .../tl_recover_authentication_password_gen.go | 271 - tdapi/tl_recover_password_gen.go | 271 - tdapi/tl_recovery_email_address_gen.go | 193 - tdapi/tl_refund_star_payment_gen.go | 237 - tdapi/tl_register_device_gen.go | 271 - tdapi/tl_register_user_gen.go | 272 - tdapi/tl_registry_gen.go | 9193 ---- tdapi/tl_remote_file_gen.go | 333 - .../tl_remove_all_files_from_downloads_gen.go | 271 - ...ve_business_connected_bot_from_chat_gen.go | 206 - tdapi/tl_remove_chat_action_bar_gen.go | 206 - tdapi/tl_remove_contacts_gen.go | 230 - tdapi/tl_remove_favorite_sticker_gen.go | 216 - tdapi/tl_remove_file_from_downloads_gen.go | 237 - tdapi/tl_remove_installed_background_gen.go | 206 - tdapi/tl_remove_message_reaction_gen.go | 281 - ...ove_message_sender_bot_verification_gen.go | 248 - tdapi/tl_remove_notification_gen.go | 237 - tdapi/tl_remove_notification_group_gen.go | 237 - ...move_pending_paid_message_reactions_gen.go | 237 - tdapi/tl_remove_proxy_gen.go | 206 - tdapi/tl_remove_recent_hashtag_gen.go | 206 - tdapi/tl_remove_recent_sticker_gen.go | 249 - tdapi/tl_remove_recently_found_chat_gen.go | 206 - tdapi/tl_remove_saved_animation_gen.go | 216 - .../tl_remove_saved_notification_sound_gen.go | 206 - tdapi/tl_remove_searched_for_tag_gen.go | 206 - tdapi/tl_remove_sticker_from_set_gen.go | 216 - tdapi/tl_remove_top_chat_gen.go | 247 - tdapi/tl_reorder_active_usernames_gen.go | 230 - tdapi/tl_reorder_bot_active_usernames_gen.go | 261 - tdapi/tl_reorder_bot_media_previews_gen.go | 295 - tdapi/tl_reorder_chat_folders_gen.go | 262 - .../tl_reorder_installed_sticker_sets_gen.go | 271 - tdapi/tl_reorder_quick_reply_shortcuts_gen.go | 230 - ...reorder_supergroup_active_usernames_gen.go | 261 - ...tl_replace_primary_chat_invite_link_gen.go | 206 - tdapi/tl_replace_sticker_in_set_gen.go | 315 - tdapi/tl_replace_video_chat_rtmp_url_gen.go | 206 - tdapi/tl_reply_markup_gen.go | 1187 - ..._report_authentication_code_missing_gen.go | 206 - tdapi/tl_report_chat_gen.go | 331 - tdapi/tl_report_chat_photo_gen.go | 315 - tdapi/tl_report_chat_result_gen.go | 889 - tdapi/tl_report_chat_sponsored_message_gen.go | 271 - ...eport_chat_sponsored_message_result_gen.go | 976 - tdapi/tl_report_message_reactions_gen.go | 281 - tdapi/tl_report_option_gen.go | 227 - ...tl_report_phone_number_code_missing_gen.go | 206 - tdapi/tl_report_reason_gen.go | 1599 - tdapi/tl_report_story_gen.go | 305 - tdapi/tl_report_story_result_gen.go | 743 - ...supergroup_anti_spam_false_positive_gen.go | 237 - tdapi/tl_report_supergroup_spam_gen.go | 262 - ...st_authentication_password_recovery_gen.go | 169 - tdapi/tl_request_password_recovery_gen.go | 169 - .../tl_request_qr_code_authentication_gen.go | 230 - tdapi/tl_resend_authentication_code_gen.go | 216 - tdapi/tl_resend_code_reason_gen.go | 467 - ...end_email_address_verification_code_gen.go | 169 - .../tl_resend_login_email_address_code_gen.go | 169 - tdapi/tl_resend_messages_gen.go | 298 - tdapi/tl_resend_phone_number_code_gen.go | 216 - ..._resend_recovery_email_address_code_gen.go | 169 - .../tl_reset_all_notification_settings_gen.go | 169 - ..._reset_authentication_email_address_gen.go | 169 - tdapi/tl_reset_installed_backgrounds_gen.go | 169 - tdapi/tl_reset_network_statistics_gen.go | 169 - tdapi/tl_reset_password_gen.go | 169 - tdapi/tl_reset_password_result_gen.go | 648 - tdapi/tl_reuse_star_subscription_gen.go | 206 - tdapi/tl_revenue_withdrawal_state_gen.go | 646 - tdapi/tl_revoke_chat_invite_link_gen.go | 237 - tdapi/tl_revoke_group_call_invite_link_gen.go | 206 - tdapi/tl_rich_text_gen.go | 3721 -- tdapi/tl_rtmp_url_gen.go | 227 - tdapi/tl_save_application_log_event_gen.go | 281 - tdapi/tl_save_prepared_inline_message_gen.go | 281 - tdapi/tl_saved_credentials_gen.go | 227 - tdapi/tl_saved_messages_tag_gen.go | 272 - tdapi/tl_saved_messages_tags_gen.go | 221 - tdapi/tl_saved_messages_topic_gen.go | 374 - tdapi/tl_saved_messages_topic_type_gen.go | 612 - tdapi/tl_scope_autosave_settings_gen.go | 261 - tdapi/tl_scope_notification_settings_gen.go | 468 - tdapi/tl_search_affiliate_programs_gen.go | 326 - tdapi/tl_search_background_gen.go | 206 - tdapi/tl_search_call_messages_gen.go | 274 - tdapi/tl_search_chat_affiliate_program_gen.go | 237 - tdapi/tl_search_chat_members_gen.go | 315 - tdapi/tl_search_chat_messages_gen.go | 500 - ...earch_chat_recent_location_messages_gen.go | 237 - tdapi/tl_search_chats_gen.go | 237 - tdapi/tl_search_chats_on_server_gen.go | 237 - tdapi/tl_search_contacts_gen.go | 237 - tdapi/tl_search_emojis_gen.go | 262 - tdapi/tl_search_file_downloads_gen.go | 340 - tdapi/tl_search_hashtags_gen.go | 237 - tdapi/tl_search_installed_sticker_sets_gen.go | 281 - ...tl_search_messages_chat_type_filter_gen.go | 577 - tdapi/tl_search_messages_filter_gen.go | 2621 -- tdapi/tl_search_messages_gen.go | 479 - ...l_search_outgoing_document_messages_gen.go | 237 - tdapi/tl_search_public_chat_gen.go | 206 - tdapi/tl_search_public_chats_gen.go | 206 - tdapi/tl_search_public_messages_by_tag_gen.go | 274 - ...l_search_public_stories_by_location_gen.go | 274 - tdapi/tl_search_public_stories_by_tag_gen.go | 309 - .../tl_search_public_stories_by_venue_gen.go | 308 - tdapi/tl_search_quote_gen.go | 271 - tdapi/tl_search_recently_found_chats_gen.go | 237 - tdapi/tl_search_saved_messages_gen.go | 387 - tdapi/tl_search_secret_messages_gen.go | 352 - tdapi/tl_search_sticker_set_gen.go | 237 - tdapi/tl_search_sticker_sets_gen.go | 247 - tdapi/tl_search_stickers_gen.go | 408 - tdapi/tl_search_strings_by_prefix_gen.go | 329 - tdapi/tl_search_user_by_phone_number_gen.go | 237 - tdapi/tl_search_user_by_token_gen.go | 206 - tdapi/tl_search_web_app_gen.go | 237 - tdapi/tl_seconds_gen.go | 193 - tdapi/tl_secret_chat_gen.go | 377 - tdapi/tl_secret_chat_state_gen.go | 577 - tdapi/tl_sell_gift_gen.go | 237 - ...tl_send_authentication_firebase_sms_gen.go | 207 - tdapi/tl_send_bot_start_message_gen.go | 272 - tdapi/tl_send_business_message_album_gen.go | 452 - tdapi/tl_send_business_message_gen.go | 471 - tdapi/tl_send_call_debug_information_gen.go | 237 - tdapi/tl_send_call_log_gen.go | 247 - tdapi/tl_send_call_rating_gen.go | 339 - tdapi/tl_send_call_signaling_data_gen.go | 237 - tdapi/tl_send_chat_action_gen.go | 316 - tdapi/tl_send_custom_request_gen.go | 237 - ...end_email_address_verification_code_gen.go | 206 - tdapi/tl_send_gift_gen.go | 342 - ...tl_send_inline_query_result_message_gen.go | 419 - tdapi/tl_send_message_album_gen.go | 384 - tdapi/tl_send_message_gen.go | 403 - ...tl_send_passport_authorization_form_gen.go | 271 - tdapi/tl_send_payment_form_gen.go | 393 - tdapi/tl_send_phone_number_code_gen.go | 282 - .../tl_send_phone_number_firebase_sms_gen.go | 207 - ..._send_quick_reply_shortcut_messages_gen.go | 274 - tdapi/tl_send_story_gen.go | 502 - tdapi/tl_send_web_app_custom_request_gen.go | 271 - tdapi/tl_send_web_app_data_gen.go | 271 - tdapi/tl_sent_gift_gen.go | 501 - tdapi/tl_sent_web_app_message_gen.go | 193 - tdapi/tl_session_gen.go | 788 - tdapi/tl_session_type_gen.go | 2621 -- tdapi/tl_sessions_gen.go | 256 - tdapi/tl_set_accent_color_gen.go | 238 - tdapi/tl_set_account_ttl_gen.go | 206 - tdapi/tl_set_alarm_gen.go | 206 - ..._set_application_verification_token_gen.go | 239 - .../tl_set_archive_chat_list_settings_gen.go | 206 - ...tl_set_authentication_email_address_gen.go | 206 - .../tl_set_authentication_phone_number_gen.go | 238 - tdapi/tl_set_auto_download_settings_gen.go | 247 - tdapi/tl_set_autosave_settings_gen.go | 247 - tdapi/tl_set_bio_gen.go | 207 - tdapi/tl_set_birthdate_gen.go | 206 - tdapi/tl_set_bot_info_description_gen.go | 273 - .../tl_set_bot_info_short_description_gen.go | 272 - tdapi/tl_set_bot_name_gen.go | 273 - tdapi/tl_set_bot_profile_photo_gen.go | 247 - tdapi/tl_set_bot_updates_status_gen.go | 237 - ..._set_business_away_message_settings_gen.go | 207 - tdapi/tl_set_business_connected_bot_gen.go | 206 - ..._business_greeting_message_settings_gen.go | 207 - tdapi/tl_set_business_location_gen.go | 206 - .../tl_set_business_message_is_pinned_gen.go | 305 - tdapi/tl_set_business_opening_hours_gen.go | 207 - tdapi/tl_set_business_start_page_gen.go | 206 - tdapi/tl_set_chat_accent_color_gen.go | 274 - tdapi/tl_set_chat_active_stories_list_gen.go | 247 - tdapi/tl_set_chat_affiliate_program_gen.go | 239 - tdapi/tl_set_chat_available_reactions_gen.go | 249 - tdapi/tl_set_chat_background_gen.go | 364 - tdapi/tl_set_chat_client_data_gen.go | 237 - tdapi/tl_set_chat_description_gen.go | 238 - tdapi/tl_set_chat_discussion_group_gen.go | 240 - tdapi/tl_set_chat_draft_message_gen.go | 272 - tdapi/tl_set_chat_emoji_status_gen.go | 237 - tdapi/tl_set_chat_location_gen.go | 237 - tdapi/tl_set_chat_member_status_gen.go | 291 - ...l_set_chat_message_auto_delete_time_gen.go | 238 - tdapi/tl_set_chat_message_sender_gen.go | 247 - .../tl_set_chat_notification_settings_gen.go | 238 - tdapi/tl_set_chat_permissions_gen.go | 237 - tdapi/tl_set_chat_photo_gen.go | 247 - tdapi/tl_set_chat_pinned_stories_gen.go | 262 - tdapi/tl_set_chat_profile_accent_color_gen.go | 274 - tdapi/tl_set_chat_slow_mode_delay_gen.go | 238 - tdapi/tl_set_chat_theme_gen.go | 237 - tdapi/tl_set_chat_title_gen.go | 237 - tdapi/tl_set_close_friends_gen.go | 230 - tdapi/tl_set_commands_gen.go | 311 - ..._custom_emoji_sticker_set_thumbnail_gen.go | 238 - tdapi/tl_set_custom_language_pack_gen.go | 267 - .../tl_set_custom_language_pack_string_gen.go | 238 - tdapi/tl_set_database_encryption_key_gen.go | 206 - tdapi/tl_set_default_background_gen.go | 292 - ...efault_channel_administrator_rights_gen.go | 207 - ..._default_group_administrator_rights_gen.go | 207 - ...et_default_message_auto_delete_time_gen.go | 207 - tdapi/tl_set_default_reaction_type_gen.go | 216 - tdapi/tl_set_emoji_status_gen.go | 206 - tdapi/tl_set_file_generation_progress_gen.go | 271 - ...t_forum_topic_notification_settings_gen.go | 272 - tdapi/tl_set_game_score_gen.go | 374 - ..._group_call_participant_is_speaking_gen.go | 272 - ...group_call_participant_volume_level_gen.go | 281 - tdapi/tl_set_group_call_title_gen.go | 237 - tdapi/tl_set_inactive_session_ttl_gen.go | 207 - tdapi/tl_set_inline_game_score_gen.go | 340 - tdapi/tl_set_log_stream_gen.go | 216 - tdapi/tl_set_log_tag_verbosity_level_gen.go | 237 - tdapi/tl_set_log_verbosity_level_gen.go | 207 - tdapi/tl_set_login_email_address_gen.go | 206 - tdapi/tl_set_menu_button_gen.go | 237 - tdapi/tl_set_message_fact_check_gen.go | 273 - tdapi/tl_set_message_reactions_gen.go | 339 - tdapi/tl_set_message_sender_block_list_gen.go | 257 - ...set_message_sender_bot_verification_gen.go | 283 - tdapi/tl_set_name_gen.go | 237 - tdapi/tl_set_network_type_gen.go | 216 - tdapi/tl_set_new_chat_privacy_settings_gen.go | 206 - tdapi/tl_set_option_gen.go | 247 - tdapi/tl_set_passport_element_errors_gen.go | 265 - tdapi/tl_set_passport_element_gen.go | 247 - tdapi/tl_set_password_gen.go | 339 - tdapi/tl_set_personal_chat_gen.go | 207 - tdapi/tl_set_pinned_chats_gen.go | 271 - tdapi/tl_set_pinned_forum_topics_gen.go | 261 - ...tl_set_pinned_saved_messages_topics_gen.go | 230 - tdapi/tl_set_poll_answer_gen.go | 296 - tdapi/tl_set_profile_accent_color_gen.go | 238 - tdapi/tl_set_profile_photo_gen.go | 248 - tdapi/tl_set_quick_reply_shortcut_name_gen.go | 237 - ..._set_reaction_notification_settings_gen.go | 206 - .../tl_set_read_date_privacy_settings_gen.go | 206 - tdapi/tl_set_recovery_email_address_gen.go | 237 - tdapi/tl_set_saved_messages_tag_label_gen.go | 247 - .../tl_set_scope_notification_settings_gen.go | 247 - tdapi/tl_set_sticker_emojis_gen.go | 247 - tdapi/tl_set_sticker_keywords_gen.go | 272 - tdapi/tl_set_sticker_mask_position_gen.go | 247 - tdapi/tl_set_sticker_position_in_set_gen.go | 247 - tdapi/tl_set_sticker_set_thumbnail_gen.go | 325 - tdapi/tl_set_sticker_set_title_gen.go | 237 - tdapi/tl_set_story_privacy_settings_gen.go | 247 - tdapi/tl_set_story_reaction_gen.go | 316 - ...supergroup_custom_emoji_sticker_set_gen.go | 238 - tdapi/tl_set_supergroup_sticker_set_gen.go | 238 - ...t_supergroup_unrestrict_boost_count_gen.go | 238 - tdapi/tl_set_supergroup_username_gen.go | 238 - tdapi/tl_set_tdlib_parameters_gen.go | 653 - tdapi/tl_set_user_emoji_status_gen.go | 237 - .../tl_set_user_personal_profile_photo_gen.go | 248 - .../tl_set_user_privacy_setting_rules_gen.go | 247 - tdapi/tl_set_user_support_info_gen.go | 237 - tdapi/tl_set_username_gen.go | 207 - ..._set_video_chat_default_participant_gen.go | 247 - tdapi/tl_share_chat_with_bot_gen.go | 340 - tdapi/tl_share_phone_number_gen.go | 207 - tdapi/tl_share_users_with_bot_gen.go | 364 - tdapi/tl_shared_chat_gen.go | 295 - tdapi/tl_shared_user_gen.go | 329 - tdapi/tl_shipping_option_gen.go | 289 - tdapi/tl_speech_recognition_result_gen.go | 683 - tdapi/tl_sponsored_message_gen.go | 514 - tdapi/tl_sponsored_messages_gen.go | 256 - tdapi/tl_star_amount_gen.go | 227 - tdapi/tl_star_giveaway_payment_option_gen.go | 459 - tdapi/tl_star_giveaway_payment_options_gen.go | 221 - tdapi/tl_star_giveaway_winner_option_gen.go | 261 - tdapi/tl_star_payment_option_gen.go | 329 - tdapi/tl_star_payment_options_gen.go | 221 - tdapi/tl_star_revenue_statistics_gen.go | 271 - tdapi/tl_star_revenue_status_gen.go | 330 - tdapi/tl_star_subscription_gen.go | 408 - tdapi/tl_star_subscription_pricing_gen.go | 227 - tdapi/tl_star_subscription_type_gen.go | 639 - tdapi/tl_star_subscriptions_gen.go | 323 - tdapi/tl_star_transaction_direction_gen.go | 431 - tdapi/tl_star_transaction_gen.go | 339 - tdapi/tl_star_transaction_type_gen.go | 5927 --- tdapi/tl_star_transactions_gen.go | 289 - tdapi/tl_start_group_call_recording_gen.go | 305 - .../tl_start_group_call_screen_sharing_gen.go | 271 - tdapi/tl_start_scheduled_group_call_gen.go | 206 - tdapi/tl_statistical_graph_gen.go | 716 - tdapi/tl_statistical_value_gen.go | 261 - tdapi/tl_sticker_format_gen.go | 577 - tdapi/tl_sticker_full_type_gen.go | 719 - tdapi/tl_sticker_gen.go | 485 - tdapi/tl_sticker_set_gen.go | 741 - tdapi/tl_sticker_set_info_gen.go | 712 - tdapi/tl_sticker_sets_gen.go | 255 - tdapi/tl_sticker_type_gen.go | 577 - tdapi/tl_stickers_gen.go | 221 - tdapi/tl_stop_business_poll_gen.go | 316 - tdapi/tl_stop_poll_gen.go | 282 - tdapi/tl_storage_statistics_by_chat_gen.go | 323 - .../tl_storage_statistics_by_file_type_gen.go | 271 - tdapi/tl_storage_statistics_fast_gen.go | 329 - tdapi/tl_storage_statistics_gen.go | 289 - tdapi/tl_store_payment_purpose_gen.go | 1798 - tdapi/tl_stories_gen.go | 314 - tdapi/tl_story_area_gen.go | 237 - tdapi/tl_story_area_position_gen.go | 363 - tdapi/tl_story_area_type_gen.go | 1473 - tdapi/tl_story_content_gen.go | 682 - tdapi/tl_story_full_id_gen.go | 227 - tdapi/tl_story_gen.go | 1048 - tdapi/tl_story_info_gen.go | 261 - tdapi/tl_story_interaction_gen.go | 325 - tdapi/tl_story_interaction_info_gen.go | 319 - tdapi/tl_story_interaction_type_gen.go | 692 - tdapi/tl_story_interactions_gen.go | 357 - tdapi/tl_story_list_gen.go | 431 - tdapi/tl_story_origin_gen.go | 535 - tdapi/tl_story_privacy_settings_gen.go | 902 - tdapi/tl_story_repost_info_gen.go | 237 - tdapi/tl_story_statistics_gen.go | 247 - tdapi/tl_story_video_gen.go | 500 - tdapi/tl_string_gen.go | 158 - tdapi/tl_suggest_user_profile_photo_gen.go | 247 - tdapi/tl_suggested_action_gen.go | 2289 - tdapi/tl_supergroup_full_info_gen.go | 1360 - tdapi/tl_supergroup_gen.go | 899 - tdapi/tl_supergroup_members_filter_gen.go | 1516 - tdapi/tl_synchronize_language_pack_gen.go | 206 - tdapi/tl_t_me_url_gen.go | 237 - tdapi/tl_t_me_url_type_gen.go | 863 - tdapi/tl_t_me_urls_gen.go | 221 - tdapi/tl_target_chat_gen.go | 657 - tdapi/tl_target_chat_types_gen.go | 295 - tdapi/tl_telegram_payment_purpose_gen.go | 1865 - tdapi/tl_temporary_password_state_gen.go | 227 - tdapi/tl_terminate_all_other_sessions_gen.go | 169 - tdapi/tl_terminate_session_gen.go | 206 - tdapi/tl_terms_of_service_gen.go | 261 - tdapi/tl_test_bytes_gen.go | 193 - tdapi/tl_test_call_bytes_gen.go | 206 - tdapi/tl_test_call_empty_gen.go | 169 - tdapi/tl_test_call_string_gen.go | 206 - tdapi/tl_test_call_vector_int_gen.go | 230 - tdapi/tl_test_call_vector_int_object_gen.go | 234 - tdapi/tl_test_call_vector_string_gen.go | 230 - .../tl_test_call_vector_string_object_gen.go | 234 - tdapi/tl_test_get_difference_gen.go | 169 - tdapi/tl_test_int_gen.go | 193 - tdapi/tl_test_network_gen.go | 169 - tdapi/tl_test_proxy_gen.go | 349 - tdapi/tl_test_return_error_gen.go | 206 - tdapi/tl_test_square_int_gen.go | 206 - tdapi/tl_test_string_gen.go | 193 - tdapi/tl_test_use_update_gen.go | 169 - tdapi/tl_test_vector_int_gen.go | 217 - tdapi/tl_test_vector_int_object_gen.go | 221 - tdapi/tl_test_vector_string_gen.go | 217 - tdapi/tl_test_vector_string_object_gen.go | 221 - tdapi/tl_text_entities_gen.go | 221 - tdapi/tl_text_entity_gen.go | 271 - tdapi/tl_text_entity_type_gen.go | 3528 -- tdapi/tl_text_gen.go | 193 - tdapi/tl_text_parse_mode_gen.go | 467 - tdapi/tl_text_quote_gen.go | 263 - tdapi/tl_theme_parameters_gen.go | 669 - tdapi/tl_theme_settings_gen.go | 339 - tdapi/tl_thumbnail_format_gen.go | 1161 - tdapi/tl_thumbnail_gen.go | 305 - tdapi/tl_time_zone_gen.go | 261 - tdapi/tl_time_zones_gen.go | 221 - .../tl_toggle_all_downloads_are_paused_gen.go | 206 - ..._toggle_bot_can_manage_emoji_status_gen.go | 238 - ...gle_bot_is_added_to_attachment_menu_gen.go | 273 - tdapi/tl_toggle_bot_username_is_active_gen.go | 271 - ...siness_connected_bot_chat_is_paused_gen.go | 237 - ...e_chat_default_disable_notification_gen.go | 237 - tdapi/tl_toggle_chat_folder_tags_gen.go | 206 - ...l_toggle_chat_has_protected_content_gen.go | 237 - .../tl_toggle_chat_is_marked_as_unread_gen.go | 237 - tdapi/tl_toggle_chat_is_pinned_gen.go | 281 - tdapi/tl_toggle_chat_is_translatable_gen.go | 237 - tdapi/tl_toggle_chat_view_as_topics_gen.go | 237 - tdapi/tl_toggle_download_is_paused_gen.go | 237 - tdapi/tl_toggle_forum_topic_is_closed_gen.go | 271 - tdapi/tl_toggle_forum_topic_is_pinned_gen.go | 271 - ...oggle_general_forum_topic_is_hidden_gen.go | 237 - tdapi/tl_toggle_gift_is_saved_gen.go | 272 - ...oup_call_enabled_start_notification_gen.go | 237 - ...ggle_group_call_is_my_video_enabled_gen.go | 237 - ...oggle_group_call_is_my_video_paused_gen.go | 237 - ...le_group_call_mute_new_participants_gen.go | 237 - ...oup_call_participant_is_hand_raised_gen.go | 282 - ...gle_group_call_participant_is_muted_gen.go | 281 - ...group_call_screen_sharing_is_paused_gen.go | 237 - ...ggle_has_sponsored_messages_enabled_gen.go | 206 - ..._paid_message_reaction_is_anonymous_gen.go | 272 - ...ggle_saved_messages_topic_is_pinned_gen.go | 237 - .../tl_toggle_session_can_accept_calls_gen.go | 237 - ...gle_session_can_accept_secret_chats_gen.go | 237 - ...toggle_story_is_posted_to_chat_page_gen.go | 271 - ...ergroup_can_have_sponsored_messages_gen.go | 237 - ...up_has_aggressive_anti_spam_enabled_gen.go | 237 - ...oggle_supergroup_has_hidden_members_gen.go | 237 - ...supergroup_is_all_history_available_gen.go | 237 - ...oggle_supergroup_is_broadcast_group_gen.go | 206 - tdapi/tl_toggle_supergroup_is_forum_gen.go | 237 - ...l_toggle_supergroup_join_by_request_gen.go | 237 - ...le_supergroup_join_to_send_messages_gen.go | 237 - .../tl_toggle_supergroup_sign_messages_gen.go | 271 - ...oggle_supergroup_username_is_active_gen.go | 271 - tdapi/tl_toggle_username_is_active_gen.go | 237 - tdapi/tl_top_chat_category_gen.go | 1307 - tdapi/tl_transfer_chat_ownership_gen.go | 272 - tdapi/tl_transfer_gift_gen.go | 305 - tdapi/tl_translate_message_text_gen.go | 271 - tdapi/tl_translate_text_gen.go | 237 - tdapi/tl_trending_sticker_sets_gen.go | 289 - tdapi/tl_unconfirmed_session_gen.go | 297 - tdapi/tl_unpin_all_chat_messages_gen.go | 206 - ...l_unpin_all_message_thread_messages_gen.go | 237 - tdapi/tl_unpin_chat_message_gen.go | 237 - tdapi/tl_unread_reaction_gen.go | 281 - tdapi/tl_update_gen.go | 35488 ---------------- tdapi/tl_updates_gen.go | 227 - ...basic_group_chat_to_supergroup_chat_gen.go | 206 - tdapi/tl_upgrade_gift_gen.go | 271 - tdapi/tl_upgrade_gift_result_gen.go | 330 - tdapi/tl_upgraded_gift_backdrop_gen.go | 363 - tdapi/tl_upgraded_gift_gen.go | 499 - tdapi/tl_upgraded_gift_model_gen.go | 261 - .../tl_upgraded_gift_original_details_gen.go | 295 - tdapi/tl_upgraded_gift_symbol_gen.go | 261 - tdapi/tl_upload_sticker_file_gen.go | 292 - tdapi/tl_user_full_info_gen.go | 891 - tdapi/tl_user_gen.go | 1071 - tdapi/tl_user_gift_gen.go | 655 - tdapi/tl_user_gifts_gen.go | 289 - tdapi/tl_user_link_gen.go | 228 - tdapi/tl_user_privacy_setting_gen.go | 1893 - tdapi/tl_user_privacy_setting_rule_gen.go | 1981 - tdapi/tl_user_privacy_setting_rules_gen.go | 227 - tdapi/tl_user_status_gen.go | 1193 - tdapi/tl_user_support_info_gen.go | 261 - tdapi/tl_user_type_gen.go | 1069 - tdapi/tl_usernames_gen.go | 313 - tdapi/tl_users_gen.go | 251 - tdapi/tl_validate_order_info_gen.go | 281 - tdapi/tl_validated_order_info_gen.go | 255 - tdapi/tl_vector_path_command_gen.go | 572 - tdapi/tl_venue_gen.go | 364 - tdapi/tl_verification_status_gen.go | 296 - tdapi/tl_video_chat_gen.go | 272 - tdapi/tl_video_gen.go | 500 - tdapi/tl_video_note_gen.go | 408 - tdapi/tl_view_messages_gen.go | 339 - tdapi/tl_view_premium_feature_gen.go | 216 - tdapi/tl_view_trending_sticker_sets_gen.go | 230 - tdapi/tl_voice_note_gen.go | 340 - tdapi/tl_web_app_gen.go | 330 - tdapi/tl_web_app_info_gen.go | 227 - tdapi/tl_web_app_open_mode_gen.go | 577 - tdapi/tl_web_app_open_parameters_gen.go | 271 - tdapi/tl_web_page_instant_view_gen.go | 408 - tdapi/tl_write_generated_file_part_gen.go | 271 - tdjson/encoder_test.go | 52 +- .../tl_minithumbnail_gen_test.go | 2 +- 1413 files changed, 5 insertions(+), 636602 deletions(-) delete mode 100644 _schema/tdapi.tl delete mode 100644 tdapi/tl_accent_color_gen.go delete mode 100644 tdapi/tl_accept_call_gen.go delete mode 100644 tdapi/tl_accept_terms_of_service_gen.go delete mode 100644 tdapi/tl_account_ttl_gen.go delete mode 100644 tdapi/tl_activate_story_stealth_mode_gen.go delete mode 100644 tdapi/tl_add_bot_media_preview_gen.go delete mode 100644 tdapi/tl_add_chat_folder_by_invite_link_gen.go delete mode 100644 tdapi/tl_add_chat_member_gen.go delete mode 100644 tdapi/tl_add_chat_members_gen.go delete mode 100644 tdapi/tl_add_chat_to_list_gen.go delete mode 100644 tdapi/tl_add_contact_gen.go delete mode 100644 tdapi/tl_add_custom_server_language_pack_gen.go delete mode 100644 tdapi/tl_add_favorite_sticker_gen.go delete mode 100644 tdapi/tl_add_file_to_downloads_gen.go delete mode 100644 tdapi/tl_add_local_message_gen.go delete mode 100644 tdapi/tl_add_log_message_gen.go delete mode 100644 tdapi/tl_add_message_reaction_gen.go delete mode 100644 tdapi/tl_add_network_statistics_gen.go delete mode 100644 tdapi/tl_add_pending_paid_message_reaction_gen.go delete mode 100644 tdapi/tl_add_proxy_gen.go delete mode 100644 tdapi/tl_add_quick_reply_shortcut_inline_query_result_message_gen.go delete mode 100644 tdapi/tl_add_quick_reply_shortcut_message_album_gen.go delete mode 100644 tdapi/tl_add_quick_reply_shortcut_message_gen.go delete mode 100644 tdapi/tl_add_recent_sticker_gen.go delete mode 100644 tdapi/tl_add_recently_found_chat_gen.go delete mode 100644 tdapi/tl_add_saved_animation_gen.go delete mode 100644 tdapi/tl_add_saved_notification_sound_gen.go delete mode 100644 tdapi/tl_add_sticker_to_set_gen.go delete mode 100644 tdapi/tl_added_reaction_gen.go delete mode 100644 tdapi/tl_added_reactions_gen.go delete mode 100644 tdapi/tl_address_gen.go delete mode 100644 tdapi/tl_affiliate_info_gen.go delete mode 100644 tdapi/tl_affiliate_program_info_gen.go delete mode 100644 tdapi/tl_affiliate_program_parameters_gen.go delete mode 100644 tdapi/tl_affiliate_program_sort_order_gen.go delete mode 100644 tdapi/tl_affiliate_type_gen.go delete mode 100644 tdapi/tl_allow_bot_to_send_messages_gen.go delete mode 100644 tdapi/tl_alternative_video_gen.go delete mode 100644 tdapi/tl_animated_chat_photo_gen.go delete mode 100644 tdapi/tl_animated_emoji_gen.go delete mode 100644 tdapi/tl_animation_gen.go delete mode 100644 tdapi/tl_animations_gen.go delete mode 100644 tdapi/tl_answer_callback_query_gen.go delete mode 100644 tdapi/tl_answer_custom_query_gen.go delete mode 100644 tdapi/tl_answer_inline_query_gen.go delete mode 100644 tdapi/tl_answer_pre_checkout_query_gen.go delete mode 100644 tdapi/tl_answer_shipping_query_gen.go delete mode 100644 tdapi/tl_answer_web_app_query_gen.go delete mode 100644 tdapi/tl_apply_premium_gift_code_gen.go delete mode 100644 tdapi/tl_archive_chat_list_settings_gen.go delete mode 100644 tdapi/tl_assign_app_store_transaction_gen.go delete mode 100644 tdapi/tl_assign_google_play_transaction_gen.go delete mode 100644 tdapi/tl_attachment_menu_bot_color_gen.go delete mode 100644 tdapi/tl_attachment_menu_bot_gen.go delete mode 100644 tdapi/tl_audio_gen.go delete mode 100644 tdapi/tl_authentication_code_info_gen.go delete mode 100644 tdapi/tl_authentication_code_type_gen.go delete mode 100644 tdapi/tl_authorization_state_gen.go delete mode 100644 tdapi/tl_auto_download_settings_gen.go delete mode 100644 tdapi/tl_auto_download_settings_presets_gen.go delete mode 100644 tdapi/tl_autosave_settings_exception_gen.go delete mode 100644 tdapi/tl_autosave_settings_gen.go delete mode 100644 tdapi/tl_autosave_settings_scope_gen.go delete mode 100644 tdapi/tl_available_reaction_gen.go delete mode 100644 tdapi/tl_available_reactions_gen.go delete mode 100644 tdapi/tl_background_fill_gen.go delete mode 100644 tdapi/tl_background_gen.go delete mode 100644 tdapi/tl_background_type_gen.go delete mode 100644 tdapi/tl_backgrounds_gen.go delete mode 100644 tdapi/tl_ban_chat_member_gen.go delete mode 100644 tdapi/tl_bank_card_action_open_url_gen.go delete mode 100644 tdapi/tl_bank_card_info_gen.go delete mode 100644 tdapi/tl_basic_group_full_info_gen.go delete mode 100644 tdapi/tl_basic_group_gen.go delete mode 100644 tdapi/tl_birthdate_gen.go delete mode 100644 tdapi/tl_block_list_gen.go delete mode 100644 tdapi/tl_block_message_sender_from_replies_gen.go delete mode 100644 tdapi/tl_bool_gen.go delete mode 100644 tdapi/tl_boost_chat_gen.go delete mode 100644 tdapi/tl_bot_command_gen.go delete mode 100644 tdapi/tl_bot_command_scope_gen.go delete mode 100644 tdapi/tl_bot_commands_gen.go delete mode 100644 tdapi/tl_bot_info_gen.go delete mode 100644 tdapi/tl_bot_media_preview_gen.go delete mode 100644 tdapi/tl_bot_media_preview_info_gen.go delete mode 100644 tdapi/tl_bot_media_previews_gen.go delete mode 100644 tdapi/tl_bot_menu_button_gen.go delete mode 100644 tdapi/tl_bot_verification_gen.go delete mode 100644 tdapi/tl_bot_verification_parameters_gen.go delete mode 100644 tdapi/tl_bot_write_access_allow_reason_gen.go delete mode 100644 tdapi/tl_business_away_message_schedule_gen.go delete mode 100644 tdapi/tl_business_away_message_settings_gen.go delete mode 100644 tdapi/tl_business_bot_manage_bar_gen.go delete mode 100644 tdapi/tl_business_chat_link_gen.go delete mode 100644 tdapi/tl_business_chat_link_info_gen.go delete mode 100644 tdapi/tl_business_chat_links_gen.go delete mode 100644 tdapi/tl_business_connected_bot_gen.go delete mode 100644 tdapi/tl_business_connection_gen.go delete mode 100644 tdapi/tl_business_feature_gen.go delete mode 100644 tdapi/tl_business_feature_promotion_animation_gen.go delete mode 100644 tdapi/tl_business_features_gen.go delete mode 100644 tdapi/tl_business_greeting_message_settings_gen.go delete mode 100644 tdapi/tl_business_info_gen.go delete mode 100644 tdapi/tl_business_location_gen.go delete mode 100644 tdapi/tl_business_message_gen.go delete mode 100644 tdapi/tl_business_messages_gen.go delete mode 100644 tdapi/tl_business_opening_hours_gen.go delete mode 100644 tdapi/tl_business_opening_hours_interval_gen.go delete mode 100644 tdapi/tl_business_recipients_gen.go delete mode 100644 tdapi/tl_business_start_page_gen.go delete mode 100644 tdapi/tl_bytes_gen.go delete mode 100644 tdapi/tl_call_discard_reason_gen.go delete mode 100644 tdapi/tl_call_gen.go delete mode 100644 tdapi/tl_call_id_gen.go delete mode 100644 tdapi/tl_call_problem_gen.go delete mode 100644 tdapi/tl_call_protocol_gen.go delete mode 100644 tdapi/tl_call_server_gen.go delete mode 100644 tdapi/tl_call_server_type_gen.go delete mode 100644 tdapi/tl_call_state_gen.go delete mode 100644 tdapi/tl_callback_query_answer_gen.go delete mode 100644 tdapi/tl_callback_query_payload_gen.go delete mode 100644 tdapi/tl_can_bot_send_messages_gen.go delete mode 100644 tdapi/tl_can_purchase_from_store_gen.go delete mode 100644 tdapi/tl_can_send_message_to_user_gen.go delete mode 100644 tdapi/tl_can_send_message_to_user_result_gen.go delete mode 100644 tdapi/tl_can_send_story_gen.go delete mode 100644 tdapi/tl_can_send_story_result_gen.go delete mode 100644 tdapi/tl_can_transfer_ownership_gen.go delete mode 100644 tdapi/tl_can_transfer_ownership_result_gen.go delete mode 100644 tdapi/tl_cancel_download_file_gen.go delete mode 100644 tdapi/tl_cancel_password_reset_gen.go delete mode 100644 tdapi/tl_cancel_preliminary_upload_file_gen.go delete mode 100644 tdapi/tl_cancel_recovery_email_address_verification_gen.go delete mode 100644 tdapi/tl_change_imported_contacts_gen.go delete mode 100644 tdapi/tl_change_sticker_set_gen.go delete mode 100644 tdapi/tl_chat_action_bar_gen.go delete mode 100644 tdapi/tl_chat_action_gen.go delete mode 100644 tdapi/tl_chat_active_stories_gen.go delete mode 100644 tdapi/tl_chat_administrator_gen.go delete mode 100644 tdapi/tl_chat_administrator_rights_gen.go delete mode 100644 tdapi/tl_chat_administrators_gen.go delete mode 100644 tdapi/tl_chat_available_reactions_gen.go delete mode 100644 tdapi/tl_chat_background_gen.go delete mode 100644 tdapi/tl_chat_boost_features_gen.go delete mode 100644 tdapi/tl_chat_boost_gen.go delete mode 100644 tdapi/tl_chat_boost_level_features_gen.go delete mode 100644 tdapi/tl_chat_boost_link_gen.go delete mode 100644 tdapi/tl_chat_boost_link_info_gen.go delete mode 100644 tdapi/tl_chat_boost_slot_gen.go delete mode 100644 tdapi/tl_chat_boost_slots_gen.go delete mode 100644 tdapi/tl_chat_boost_source_gen.go delete mode 100644 tdapi/tl_chat_boost_status_gen.go delete mode 100644 tdapi/tl_chat_event_action_gen.go delete mode 100644 tdapi/tl_chat_event_gen.go delete mode 100644 tdapi/tl_chat_event_log_filters_gen.go delete mode 100644 tdapi/tl_chat_events_gen.go delete mode 100644 tdapi/tl_chat_folder_gen.go delete mode 100644 tdapi/tl_chat_folder_icon_gen.go delete mode 100644 tdapi/tl_chat_folder_info_gen.go delete mode 100644 tdapi/tl_chat_folder_invite_link_gen.go delete mode 100644 tdapi/tl_chat_folder_invite_link_info_gen.go delete mode 100644 tdapi/tl_chat_folder_invite_links_gen.go delete mode 100644 tdapi/tl_chat_folder_name_gen.go delete mode 100644 tdapi/tl_chat_gen.go delete mode 100644 tdapi/tl_chat_invite_link_count_gen.go delete mode 100644 tdapi/tl_chat_invite_link_counts_gen.go delete mode 100644 tdapi/tl_chat_invite_link_gen.go delete mode 100644 tdapi/tl_chat_invite_link_info_gen.go delete mode 100644 tdapi/tl_chat_invite_link_member_gen.go delete mode 100644 tdapi/tl_chat_invite_link_members_gen.go delete mode 100644 tdapi/tl_chat_invite_link_subscription_info_gen.go delete mode 100644 tdapi/tl_chat_invite_links_gen.go delete mode 100644 tdapi/tl_chat_join_request_gen.go delete mode 100644 tdapi/tl_chat_join_requests_gen.go delete mode 100644 tdapi/tl_chat_join_requests_info_gen.go delete mode 100644 tdapi/tl_chat_list_gen.go delete mode 100644 tdapi/tl_chat_lists_gen.go delete mode 100644 tdapi/tl_chat_location_gen.go delete mode 100644 tdapi/tl_chat_member_gen.go delete mode 100644 tdapi/tl_chat_member_status_gen.go delete mode 100644 tdapi/tl_chat_members_filter_gen.go delete mode 100644 tdapi/tl_chat_members_gen.go delete mode 100644 tdapi/tl_chat_message_sender_gen.go delete mode 100644 tdapi/tl_chat_message_senders_gen.go delete mode 100644 tdapi/tl_chat_notification_settings_gen.go delete mode 100644 tdapi/tl_chat_permissions_gen.go delete mode 100644 tdapi/tl_chat_photo_gen.go delete mode 100644 tdapi/tl_chat_photo_info_gen.go delete mode 100644 tdapi/tl_chat_photo_sticker_gen.go delete mode 100644 tdapi/tl_chat_photo_sticker_type_gen.go delete mode 100644 tdapi/tl_chat_photos_gen.go delete mode 100644 tdapi/tl_chat_position_gen.go delete mode 100644 tdapi/tl_chat_revenue_amount_gen.go delete mode 100644 tdapi/tl_chat_revenue_statistics_gen.go delete mode 100644 tdapi/tl_chat_revenue_transaction_gen.go delete mode 100644 tdapi/tl_chat_revenue_transaction_type_gen.go delete mode 100644 tdapi/tl_chat_revenue_transactions_gen.go delete mode 100644 tdapi/tl_chat_source_gen.go delete mode 100644 tdapi/tl_chat_statistics_administrator_actions_info_gen.go delete mode 100644 tdapi/tl_chat_statistics_gen.go delete mode 100644 tdapi/tl_chat_statistics_interaction_info_gen.go delete mode 100644 tdapi/tl_chat_statistics_inviter_info_gen.go delete mode 100644 tdapi/tl_chat_statistics_message_sender_info_gen.go delete mode 100644 tdapi/tl_chat_statistics_object_type_gen.go delete mode 100644 tdapi/tl_chat_theme_gen.go delete mode 100644 tdapi/tl_chat_type_gen.go delete mode 100644 tdapi/tl_chats_gen.go delete mode 100644 tdapi/tl_check_authentication_bot_token_gen.go delete mode 100644 tdapi/tl_check_authentication_code_gen.go delete mode 100644 tdapi/tl_check_authentication_email_code_gen.go delete mode 100644 tdapi/tl_check_authentication_password_gen.go delete mode 100644 tdapi/tl_check_authentication_password_recovery_code_gen.go delete mode 100644 tdapi/tl_check_chat_folder_invite_link_gen.go delete mode 100644 tdapi/tl_check_chat_invite_link_gen.go delete mode 100644 tdapi/tl_check_chat_username_gen.go delete mode 100644 tdapi/tl_check_chat_username_result_gen.go delete mode 100644 tdapi/tl_check_created_public_chats_limit_gen.go delete mode 100644 tdapi/tl_check_email_address_verification_code_gen.go delete mode 100644 tdapi/tl_check_login_email_address_code_gen.go delete mode 100644 tdapi/tl_check_password_recovery_code_gen.go delete mode 100644 tdapi/tl_check_phone_number_code_gen.go delete mode 100644 tdapi/tl_check_premium_gift_code_gen.go delete mode 100644 tdapi/tl_check_quick_reply_shortcut_name_gen.go delete mode 100644 tdapi/tl_check_recovery_email_address_code_gen.go delete mode 100644 tdapi/tl_check_sticker_set_name_gen.go delete mode 100644 tdapi/tl_check_sticker_set_name_result_gen.go delete mode 100644 tdapi/tl_check_web_app_file_download_gen.go delete mode 100644 tdapi/tl_clean_file_name_gen.go delete mode 100644 tdapi/tl_clear_all_draft_messages_gen.go delete mode 100644 tdapi/tl_clear_autosave_settings_exceptions_gen.go delete mode 100644 tdapi/tl_clear_imported_contacts_gen.go delete mode 100644 tdapi/tl_clear_recent_emoji_statuses_gen.go delete mode 100644 tdapi/tl_clear_recent_reactions_gen.go delete mode 100644 tdapi/tl_clear_recent_stickers_gen.go delete mode 100644 tdapi/tl_clear_recently_found_chats_gen.go delete mode 100644 tdapi/tl_clear_searched_for_tags_gen.go delete mode 100644 tdapi/tl_click_animated_emoji_message_gen.go delete mode 100644 tdapi/tl_click_chat_sponsored_message_gen.go delete mode 100644 tdapi/tl_click_premium_subscription_button_gen.go delete mode 100644 tdapi/tl_client_gen.go delete mode 100644 tdapi/tl_close_birthday_user_gen.go delete mode 100644 tdapi/tl_close_chat_gen.go delete mode 100644 tdapi/tl_close_gen.go delete mode 100644 tdapi/tl_close_secret_chat_gen.go delete mode 100644 tdapi/tl_close_story_gen.go delete mode 100644 tdapi/tl_close_web_app_gen.go delete mode 100644 tdapi/tl_closed_vector_path_gen.go delete mode 100644 tdapi/tl_collectible_item_info_gen.go delete mode 100644 tdapi/tl_collectible_item_type_gen.go delete mode 100644 tdapi/tl_commit_pending_paid_message_reactions_gen.go delete mode 100644 tdapi/tl_confirm_qr_code_authentication_gen.go delete mode 100644 tdapi/tl_confirm_session_gen.go delete mode 100644 tdapi/tl_connect_affiliate_program_gen.go delete mode 100644 tdapi/tl_connected_affiliate_program_gen.go delete mode 100644 tdapi/tl_connected_affiliate_programs_gen.go delete mode 100644 tdapi/tl_connected_website_gen.go delete mode 100644 tdapi/tl_connected_websites_gen.go delete mode 100644 tdapi/tl_connection_state_gen.go delete mode 100644 tdapi/tl_contact_gen.go delete mode 100644 tdapi/tl_count_gen.go delete mode 100644 tdapi/tl_countries_gen.go delete mode 100644 tdapi/tl_country_info_gen.go delete mode 100644 tdapi/tl_create_basic_group_chat_gen.go delete mode 100644 tdapi/tl_create_business_chat_link_gen.go delete mode 100644 tdapi/tl_create_call_gen.go delete mode 100644 tdapi/tl_create_chat_folder_gen.go delete mode 100644 tdapi/tl_create_chat_folder_invite_link_gen.go delete mode 100644 tdapi/tl_create_chat_invite_link_gen.go delete mode 100644 tdapi/tl_create_chat_subscription_invite_link_gen.go delete mode 100644 tdapi/tl_create_forum_topic_gen.go delete mode 100644 tdapi/tl_create_group_call_gen.go delete mode 100644 tdapi/tl_create_invoice_link_gen.go delete mode 100644 tdapi/tl_create_new_basic_group_chat_gen.go delete mode 100644 tdapi/tl_create_new_secret_chat_gen.go delete mode 100644 tdapi/tl_create_new_sticker_set_gen.go delete mode 100644 tdapi/tl_create_new_supergroup_chat_gen.go delete mode 100644 tdapi/tl_create_private_chat_gen.go delete mode 100644 tdapi/tl_create_secret_chat_gen.go delete mode 100644 tdapi/tl_create_supergroup_chat_gen.go delete mode 100644 tdapi/tl_create_temporary_password_gen.go delete mode 100644 tdapi/tl_create_video_chat_gen.go delete mode 100644 tdapi/tl_created_basic_group_chat_gen.go delete mode 100644 tdapi/tl_current_weather_gen.go delete mode 100644 tdapi/tl_custom_request_result_gen.go delete mode 100644 tdapi/tl_database_statistics_gen.go delete mode 100644 tdapi/tl_date_gen.go delete mode 100644 tdapi/tl_date_range_gen.go delete mode 100644 tdapi/tl_dated_file_gen.go delete mode 100644 tdapi/tl_deep_link_info_gen.go delete mode 100644 tdapi/tl_delete_account_gen.go delete mode 100644 tdapi/tl_delete_all_call_messages_gen.go delete mode 100644 tdapi/tl_delete_all_revoked_chat_invite_links_gen.go delete mode 100644 tdapi/tl_delete_bot_media_previews_gen.go delete mode 100644 tdapi/tl_delete_business_chat_link_gen.go delete mode 100644 tdapi/tl_delete_business_connected_bot_gen.go delete mode 100644 tdapi/tl_delete_chat_background_gen.go delete mode 100644 tdapi/tl_delete_chat_folder_gen.go delete mode 100644 tdapi/tl_delete_chat_folder_invite_link_gen.go delete mode 100644 tdapi/tl_delete_chat_gen.go delete mode 100644 tdapi/tl_delete_chat_history_gen.go delete mode 100644 tdapi/tl_delete_chat_messages_by_date_gen.go delete mode 100644 tdapi/tl_delete_chat_messages_by_sender_gen.go delete mode 100644 tdapi/tl_delete_chat_reply_markup_gen.go delete mode 100644 tdapi/tl_delete_commands_gen.go delete mode 100644 tdapi/tl_delete_default_background_gen.go delete mode 100644 tdapi/tl_delete_file_gen.go delete mode 100644 tdapi/tl_delete_forum_topic_gen.go delete mode 100644 tdapi/tl_delete_language_pack_gen.go delete mode 100644 tdapi/tl_delete_messages_gen.go delete mode 100644 tdapi/tl_delete_passport_element_gen.go delete mode 100644 tdapi/tl_delete_profile_photo_gen.go delete mode 100644 tdapi/tl_delete_quick_reply_shortcut_gen.go delete mode 100644 tdapi/tl_delete_quick_reply_shortcut_messages_gen.go delete mode 100644 tdapi/tl_delete_revoked_chat_invite_link_gen.go delete mode 100644 tdapi/tl_delete_saved_credentials_gen.go delete mode 100644 tdapi/tl_delete_saved_messages_topic_history_gen.go delete mode 100644 tdapi/tl_delete_saved_messages_topic_messages_by_date_gen.go delete mode 100644 tdapi/tl_delete_saved_order_info_gen.go delete mode 100644 tdapi/tl_delete_sticker_set_gen.go delete mode 100644 tdapi/tl_delete_story_gen.go delete mode 100644 tdapi/tl_destroy_gen.go delete mode 100644 tdapi/tl_device_token_gen.go delete mode 100644 tdapi/tl_dice_stickers_gen.go delete mode 100644 tdapi/tl_disable_all_supergroup_usernames_gen.go delete mode 100644 tdapi/tl_disable_proxy_gen.go delete mode 100644 tdapi/tl_discard_call_gen.go delete mode 100644 tdapi/tl_disconnect_affiliate_program_gen.go delete mode 100644 tdapi/tl_disconnect_all_websites_gen.go delete mode 100644 tdapi/tl_disconnect_website_gen.go delete mode 100644 tdapi/tl_document_gen.go delete mode 100644 tdapi/tl_double_gen.go delete mode 100644 tdapi/tl_download_file_gen.go delete mode 100644 tdapi/tl_downloaded_file_counts_gen.go delete mode 100644 tdapi/tl_draft_message_gen.go delete mode 100644 tdapi/tl_edit_bot_media_preview_gen.go delete mode 100644 tdapi/tl_edit_business_chat_link_gen.go delete mode 100644 tdapi/tl_edit_business_message_caption_gen.go delete mode 100644 tdapi/tl_edit_business_message_live_location_gen.go delete mode 100644 tdapi/tl_edit_business_message_media_gen.go delete mode 100644 tdapi/tl_edit_business_message_reply_markup_gen.go delete mode 100644 tdapi/tl_edit_business_message_text_gen.go delete mode 100644 tdapi/tl_edit_chat_folder_gen.go delete mode 100644 tdapi/tl_edit_chat_folder_invite_link_gen.go delete mode 100644 tdapi/tl_edit_chat_invite_link_gen.go delete mode 100644 tdapi/tl_edit_chat_subscription_invite_link_gen.go delete mode 100644 tdapi/tl_edit_custom_language_pack_info_gen.go delete mode 100644 tdapi/tl_edit_forum_topic_gen.go delete mode 100644 tdapi/tl_edit_inline_message_caption_gen.go delete mode 100644 tdapi/tl_edit_inline_message_live_location_gen.go delete mode 100644 tdapi/tl_edit_inline_message_media_gen.go delete mode 100644 tdapi/tl_edit_inline_message_reply_markup_gen.go delete mode 100644 tdapi/tl_edit_inline_message_text_gen.go delete mode 100644 tdapi/tl_edit_message_caption_gen.go delete mode 100644 tdapi/tl_edit_message_live_location_gen.go delete mode 100644 tdapi/tl_edit_message_media_gen.go delete mode 100644 tdapi/tl_edit_message_reply_markup_gen.go delete mode 100644 tdapi/tl_edit_message_scheduling_state_gen.go delete mode 100644 tdapi/tl_edit_message_text_gen.go delete mode 100644 tdapi/tl_edit_proxy_gen.go delete mode 100644 tdapi/tl_edit_quick_reply_message_gen.go delete mode 100644 tdapi/tl_edit_star_subscription_gen.go delete mode 100644 tdapi/tl_edit_story_cover_gen.go delete mode 100644 tdapi/tl_edit_story_gen.go delete mode 100644 tdapi/tl_edit_user_star_subscription_gen.go delete mode 100644 tdapi/tl_email_address_authentication_code_info_gen.go delete mode 100644 tdapi/tl_email_address_authentication_gen.go delete mode 100644 tdapi/tl_email_address_reset_state_gen.go delete mode 100644 tdapi/tl_emoji_categories_gen.go delete mode 100644 tdapi/tl_emoji_category_gen.go delete mode 100644 tdapi/tl_emoji_category_source_gen.go delete mode 100644 tdapi/tl_emoji_category_type_gen.go delete mode 100644 tdapi/tl_emoji_keyword_gen.go delete mode 100644 tdapi/tl_emoji_keywords_gen.go delete mode 100644 tdapi/tl_emoji_reaction_gen.go delete mode 100644 tdapi/tl_emoji_status_gen.go delete mode 100644 tdapi/tl_emoji_statuses_gen.go delete mode 100644 tdapi/tl_emojis_gen.go delete mode 100644 tdapi/tl_enable_proxy_gen.go delete mode 100644 tdapi/tl_encrypted_credentials_gen.go delete mode 100644 tdapi/tl_encrypted_passport_element_gen.go delete mode 100644 tdapi/tl_end_group_call_gen.go delete mode 100644 tdapi/tl_end_group_call_recording_gen.go delete mode 100644 tdapi/tl_end_group_call_screen_sharing_gen.go delete mode 100644 tdapi/tl_error_gen.go delete mode 100644 tdapi/tl_fact_check_gen.go delete mode 100644 tdapi/tl_failed_to_add_member_gen.go delete mode 100644 tdapi/tl_failed_to_add_members_gen.go delete mode 100644 tdapi/tl_file_download_gen.go delete mode 100644 tdapi/tl_file_downloaded_prefix_size_gen.go delete mode 100644 tdapi/tl_file_gen.go delete mode 100644 tdapi/tl_file_part_gen.go delete mode 100644 tdapi/tl_file_type_gen.go delete mode 100644 tdapi/tl_finish_file_generation_gen.go delete mode 100644 tdapi/tl_firebase_authentication_settings_gen.go delete mode 100644 tdapi/tl_firebase_device_verification_parameters_gen.go delete mode 100644 tdapi/tl_formatted_text_gen.go delete mode 100644 tdapi/tl_forum_topic_gen.go delete mode 100644 tdapi/tl_forum_topic_icon_gen.go delete mode 100644 tdapi/tl_forum_topic_info_gen.go delete mode 100644 tdapi/tl_forum_topics_gen.go delete mode 100644 tdapi/tl_forward_messages_gen.go delete mode 100644 tdapi/tl_forward_source_gen.go delete mode 100644 tdapi/tl_found_affiliate_program_gen.go delete mode 100644 tdapi/tl_found_affiliate_programs_gen.go delete mode 100644 tdapi/tl_found_chat_boosts_gen.go delete mode 100644 tdapi/tl_found_chat_messages_gen.go delete mode 100644 tdapi/tl_found_file_downloads_gen.go delete mode 100644 tdapi/tl_found_messages_gen.go delete mode 100644 tdapi/tl_found_position_gen.go delete mode 100644 tdapi/tl_found_positions_gen.go delete mode 100644 tdapi/tl_found_stories_gen.go delete mode 100644 tdapi/tl_found_users_gen.go delete mode 100644 tdapi/tl_found_web_app_gen.go delete mode 100644 tdapi/tl_game_gen.go delete mode 100644 tdapi/tl_game_high_score_gen.go delete mode 100644 tdapi/tl_game_high_scores_gen.go delete mode 100644 tdapi/tl_get_account_ttl_gen.go delete mode 100644 tdapi/tl_get_active_sessions_gen.go delete mode 100644 tdapi/tl_get_all_passport_elements_gen.go delete mode 100644 tdapi/tl_get_all_sticker_emojis_gen.go delete mode 100644 tdapi/tl_get_animated_emoji_gen.go delete mode 100644 tdapi/tl_get_application_config_gen.go delete mode 100644 tdapi/tl_get_application_download_link_gen.go delete mode 100644 tdapi/tl_get_archive_chat_list_settings_gen.go delete mode 100644 tdapi/tl_get_archived_sticker_sets_gen.go delete mode 100644 tdapi/tl_get_attached_sticker_sets_gen.go delete mode 100644 tdapi/tl_get_attachment_menu_bot_gen.go delete mode 100644 tdapi/tl_get_authorization_state_gen.go delete mode 100644 tdapi/tl_get_auto_download_settings_presets_gen.go delete mode 100644 tdapi/tl_get_autosave_settings_gen.go delete mode 100644 tdapi/tl_get_available_chat_boost_slots_gen.go delete mode 100644 tdapi/tl_get_available_gifts_gen.go delete mode 100644 tdapi/tl_get_background_url_gen.go delete mode 100644 tdapi/tl_get_bank_card_info_gen.go delete mode 100644 tdapi/tl_get_basic_group_full_info_gen.go delete mode 100644 tdapi/tl_get_basic_group_gen.go delete mode 100644 tdapi/tl_get_blocked_message_senders_gen.go delete mode 100644 tdapi/tl_get_bot_info_description_gen.go delete mode 100644 tdapi/tl_get_bot_info_short_description_gen.go delete mode 100644 tdapi/tl_get_bot_media_preview_info_gen.go delete mode 100644 tdapi/tl_get_bot_media_previews_gen.go delete mode 100644 tdapi/tl_get_bot_name_gen.go delete mode 100644 tdapi/tl_get_business_chat_link_info_gen.go delete mode 100644 tdapi/tl_get_business_chat_links_gen.go delete mode 100644 tdapi/tl_get_business_connected_bot_gen.go delete mode 100644 tdapi/tl_get_business_connection_gen.go delete mode 100644 tdapi/tl_get_business_features_gen.go delete mode 100644 tdapi/tl_get_callback_query_answer_gen.go delete mode 100644 tdapi/tl_get_callback_query_message_gen.go delete mode 100644 tdapi/tl_get_chat_active_stories_gen.go delete mode 100644 tdapi/tl_get_chat_administrators_gen.go delete mode 100644 tdapi/tl_get_chat_archived_stories_gen.go delete mode 100644 tdapi/tl_get_chat_available_message_senders_gen.go delete mode 100644 tdapi/tl_get_chat_boost_features_gen.go delete mode 100644 tdapi/tl_get_chat_boost_level_features_gen.go delete mode 100644 tdapi/tl_get_chat_boost_link_gen.go delete mode 100644 tdapi/tl_get_chat_boost_link_info_gen.go delete mode 100644 tdapi/tl_get_chat_boost_status_gen.go delete mode 100644 tdapi/tl_get_chat_boosts_gen.go delete mode 100644 tdapi/tl_get_chat_event_log_gen.go delete mode 100644 tdapi/tl_get_chat_folder_chat_count_gen.go delete mode 100644 tdapi/tl_get_chat_folder_chats_to_leave_gen.go delete mode 100644 tdapi/tl_get_chat_folder_default_icon_name_gen.go delete mode 100644 tdapi/tl_get_chat_folder_gen.go delete mode 100644 tdapi/tl_get_chat_folder_invite_links_gen.go delete mode 100644 tdapi/tl_get_chat_folder_new_chats_gen.go delete mode 100644 tdapi/tl_get_chat_gen.go delete mode 100644 tdapi/tl_get_chat_history_gen.go delete mode 100644 tdapi/tl_get_chat_invite_link_counts_gen.go delete mode 100644 tdapi/tl_get_chat_invite_link_gen.go delete mode 100644 tdapi/tl_get_chat_invite_link_members_gen.go delete mode 100644 tdapi/tl_get_chat_invite_links_gen.go delete mode 100644 tdapi/tl_get_chat_join_requests_gen.go delete mode 100644 tdapi/tl_get_chat_lists_to_add_chat_gen.go delete mode 100644 tdapi/tl_get_chat_member_gen.go delete mode 100644 tdapi/tl_get_chat_message_by_date_gen.go delete mode 100644 tdapi/tl_get_chat_message_calendar_gen.go delete mode 100644 tdapi/tl_get_chat_message_count_gen.go delete mode 100644 tdapi/tl_get_chat_message_position_gen.go delete mode 100644 tdapi/tl_get_chat_notification_settings_exceptions_gen.go delete mode 100644 tdapi/tl_get_chat_pinned_message_gen.go delete mode 100644 tdapi/tl_get_chat_posted_to_chat_page_stories_gen.go delete mode 100644 tdapi/tl_get_chat_revenue_statistics_gen.go delete mode 100644 tdapi/tl_get_chat_revenue_transactions_gen.go delete mode 100644 tdapi/tl_get_chat_revenue_withdrawal_url_gen.go delete mode 100644 tdapi/tl_get_chat_scheduled_messages_gen.go delete mode 100644 tdapi/tl_get_chat_similar_chat_count_gen.go delete mode 100644 tdapi/tl_get_chat_similar_chats_gen.go delete mode 100644 tdapi/tl_get_chat_sparse_message_positions_gen.go delete mode 100644 tdapi/tl_get_chat_sponsored_messages_gen.go delete mode 100644 tdapi/tl_get_chat_statistics_gen.go delete mode 100644 tdapi/tl_get_chat_story_interactions_gen.go delete mode 100644 tdapi/tl_get_chats_for_chat_folder_invite_link_gen.go delete mode 100644 tdapi/tl_get_chats_gen.go delete mode 100644 tdapi/tl_get_chats_to_send_stories_gen.go delete mode 100644 tdapi/tl_get_close_friends_gen.go delete mode 100644 tdapi/tl_get_collectible_item_info_gen.go delete mode 100644 tdapi/tl_get_commands_gen.go delete mode 100644 tdapi/tl_get_connected_affiliate_program_gen.go delete mode 100644 tdapi/tl_get_connected_affiliate_programs_gen.go delete mode 100644 tdapi/tl_get_connected_websites_gen.go delete mode 100644 tdapi/tl_get_contacts_gen.go delete mode 100644 tdapi/tl_get_countries_gen.go delete mode 100644 tdapi/tl_get_country_code_gen.go delete mode 100644 tdapi/tl_get_country_flag_emoji_gen.go delete mode 100644 tdapi/tl_get_created_public_chats_gen.go delete mode 100644 tdapi/tl_get_current_state_gen.go delete mode 100644 tdapi/tl_get_current_weather_gen.go delete mode 100644 tdapi/tl_get_custom_emoji_reaction_animations_gen.go delete mode 100644 tdapi/tl_get_custom_emoji_stickers_gen.go delete mode 100644 tdapi/tl_get_database_statistics_gen.go delete mode 100644 tdapi/tl_get_deep_link_info_gen.go delete mode 100644 tdapi/tl_get_default_background_custom_emoji_stickers_gen.go delete mode 100644 tdapi/tl_get_default_chat_emoji_statuses_gen.go delete mode 100644 tdapi/tl_get_default_chat_photo_custom_emoji_stickers_gen.go delete mode 100644 tdapi/tl_get_default_emoji_statuses_gen.go delete mode 100644 tdapi/tl_get_default_message_auto_delete_time_gen.go delete mode 100644 tdapi/tl_get_default_profile_photo_custom_emoji_stickers_gen.go delete mode 100644 tdapi/tl_get_disallowed_chat_emoji_statuses_gen.go delete mode 100644 tdapi/tl_get_emoji_categories_gen.go delete mode 100644 tdapi/tl_get_emoji_reaction_gen.go delete mode 100644 tdapi/tl_get_emoji_suggestions_url_gen.go delete mode 100644 tdapi/tl_get_external_link_gen.go delete mode 100644 tdapi/tl_get_external_link_info_gen.go delete mode 100644 tdapi/tl_get_favorite_stickers_gen.go delete mode 100644 tdapi/tl_get_file_downloaded_prefix_size_gen.go delete mode 100644 tdapi/tl_get_file_extension_gen.go delete mode 100644 tdapi/tl_get_file_gen.go delete mode 100644 tdapi/tl_get_file_mime_type_gen.go delete mode 100644 tdapi/tl_get_forum_topic_default_icons_gen.go delete mode 100644 tdapi/tl_get_forum_topic_gen.go delete mode 100644 tdapi/tl_get_forum_topic_link_gen.go delete mode 100644 tdapi/tl_get_forum_topics_gen.go delete mode 100644 tdapi/tl_get_game_high_scores_gen.go delete mode 100644 tdapi/tl_get_gift_upgrade_preview_gen.go delete mode 100644 tdapi/tl_get_giveaway_info_gen.go delete mode 100644 tdapi/tl_get_greeting_stickers_gen.go delete mode 100644 tdapi/tl_get_grossing_web_app_bots_gen.go delete mode 100644 tdapi/tl_get_group_call_gen.go delete mode 100644 tdapi/tl_get_group_call_invite_link_gen.go delete mode 100644 tdapi/tl_get_group_call_stream_segment_gen.go delete mode 100644 tdapi/tl_get_group_call_streams_gen.go delete mode 100644 tdapi/tl_get_groups_in_common_gen.go delete mode 100644 tdapi/tl_get_imported_contact_count_gen.go delete mode 100644 tdapi/tl_get_inactive_supergroup_chats_gen.go delete mode 100644 tdapi/tl_get_inline_game_high_scores_gen.go delete mode 100644 tdapi/tl_get_inline_query_results_gen.go delete mode 100644 tdapi/tl_get_installed_backgrounds_gen.go delete mode 100644 tdapi/tl_get_installed_sticker_sets_gen.go delete mode 100644 tdapi/tl_get_internal_link_gen.go delete mode 100644 tdapi/tl_get_internal_link_type_gen.go delete mode 100644 tdapi/tl_get_json_string_gen.go delete mode 100644 tdapi/tl_get_json_value_gen.go delete mode 100644 tdapi/tl_get_keyword_emojis_gen.go delete mode 100644 tdapi/tl_get_language_pack_info_gen.go delete mode 100644 tdapi/tl_get_language_pack_string_gen.go delete mode 100644 tdapi/tl_get_language_pack_strings_gen.go delete mode 100644 tdapi/tl_get_link_preview_gen.go delete mode 100644 tdapi/tl_get_localization_target_info_gen.go delete mode 100644 tdapi/tl_get_log_stream_gen.go delete mode 100644 tdapi/tl_get_log_tag_verbosity_level_gen.go delete mode 100644 tdapi/tl_get_log_tags_gen.go delete mode 100644 tdapi/tl_get_log_verbosity_level_gen.go delete mode 100644 tdapi/tl_get_login_url_gen.go delete mode 100644 tdapi/tl_get_login_url_info_gen.go delete mode 100644 tdapi/tl_get_main_web_app_gen.go delete mode 100644 tdapi/tl_get_map_thumbnail_file_gen.go delete mode 100644 tdapi/tl_get_markdown_text_gen.go delete mode 100644 tdapi/tl_get_me_gen.go delete mode 100644 tdapi/tl_get_menu_button_gen.go delete mode 100644 tdapi/tl_get_message_added_reactions_gen.go delete mode 100644 tdapi/tl_get_message_available_reactions_gen.go delete mode 100644 tdapi/tl_get_message_effect_gen.go delete mode 100644 tdapi/tl_get_message_embedding_code_gen.go delete mode 100644 tdapi/tl_get_message_file_type_gen.go delete mode 100644 tdapi/tl_get_message_gen.go delete mode 100644 tdapi/tl_get_message_import_confirmation_text_gen.go delete mode 100644 tdapi/tl_get_message_link_gen.go delete mode 100644 tdapi/tl_get_message_link_info_gen.go delete mode 100644 tdapi/tl_get_message_locally_gen.go delete mode 100644 tdapi/tl_get_message_properties_gen.go delete mode 100644 tdapi/tl_get_message_public_forwards_gen.go delete mode 100644 tdapi/tl_get_message_read_date_gen.go delete mode 100644 tdapi/tl_get_message_statistics_gen.go delete mode 100644 tdapi/tl_get_message_thread_gen.go delete mode 100644 tdapi/tl_get_message_thread_history_gen.go delete mode 100644 tdapi/tl_get_message_viewers_gen.go delete mode 100644 tdapi/tl_get_messages_gen.go delete mode 100644 tdapi/tl_get_network_statistics_gen.go delete mode 100644 tdapi/tl_get_new_chat_privacy_settings_gen.go delete mode 100644 tdapi/tl_get_option_gen.go delete mode 100644 tdapi/tl_get_owned_bots_gen.go delete mode 100644 tdapi/tl_get_owned_sticker_sets_gen.go delete mode 100644 tdapi/tl_get_passport_authorization_form_available_elements_gen.go delete mode 100644 tdapi/tl_get_passport_authorization_form_gen.go delete mode 100644 tdapi/tl_get_passport_element_gen.go delete mode 100644 tdapi/tl_get_password_state_gen.go delete mode 100644 tdapi/tl_get_payment_form_gen.go delete mode 100644 tdapi/tl_get_payment_receipt_gen.go delete mode 100644 tdapi/tl_get_phone_number_info_gen.go delete mode 100644 tdapi/tl_get_phone_number_info_sync_gen.go delete mode 100644 tdapi/tl_get_poll_voters_gen.go delete mode 100644 tdapi/tl_get_preferred_country_language_gen.go delete mode 100644 tdapi/tl_get_premium_features_gen.go delete mode 100644 tdapi/tl_get_premium_gift_code_payment_options_gen.go delete mode 100644 tdapi/tl_get_premium_info_sticker_gen.go delete mode 100644 tdapi/tl_get_premium_limit_gen.go delete mode 100644 tdapi/tl_get_premium_state_gen.go delete mode 100644 tdapi/tl_get_premium_sticker_examples_gen.go delete mode 100644 tdapi/tl_get_premium_stickers_gen.go delete mode 100644 tdapi/tl_get_prepared_inline_message_gen.go delete mode 100644 tdapi/tl_get_proxies_gen.go delete mode 100644 tdapi/tl_get_proxy_link_gen.go delete mode 100644 tdapi/tl_get_push_receiver_id_gen.go delete mode 100644 tdapi/tl_get_read_date_privacy_settings_gen.go delete mode 100644 tdapi/tl_get_recent_emoji_statuses_gen.go delete mode 100644 tdapi/tl_get_recent_inline_bots_gen.go delete mode 100644 tdapi/tl_get_recent_stickers_gen.go delete mode 100644 tdapi/tl_get_recently_opened_chats_gen.go delete mode 100644 tdapi/tl_get_recently_visited_t_me_urls_gen.go delete mode 100644 tdapi/tl_get_recommended_chat_folders_gen.go delete mode 100644 tdapi/tl_get_recommended_chats_gen.go delete mode 100644 tdapi/tl_get_recovery_email_address_gen.go delete mode 100644 tdapi/tl_get_remote_file_gen.go delete mode 100644 tdapi/tl_get_replied_message_gen.go delete mode 100644 tdapi/tl_get_saved_animations_gen.go delete mode 100644 tdapi/tl_get_saved_messages_tags_gen.go delete mode 100644 tdapi/tl_get_saved_messages_topic_history_gen.go delete mode 100644 tdapi/tl_get_saved_messages_topic_message_by_date_gen.go delete mode 100644 tdapi/tl_get_saved_notification_sound_gen.go delete mode 100644 tdapi/tl_get_saved_notification_sounds_gen.go delete mode 100644 tdapi/tl_get_saved_order_info_gen.go delete mode 100644 tdapi/tl_get_scope_notification_settings_gen.go delete mode 100644 tdapi/tl_get_searched_for_tags_gen.go delete mode 100644 tdapi/tl_get_secret_chat_gen.go delete mode 100644 tdapi/tl_get_star_ad_account_url_gen.go delete mode 100644 tdapi/tl_get_star_gift_payment_options_gen.go delete mode 100644 tdapi/tl_get_star_giveaway_payment_options_gen.go delete mode 100644 tdapi/tl_get_star_payment_options_gen.go delete mode 100644 tdapi/tl_get_star_revenue_statistics_gen.go delete mode 100644 tdapi/tl_get_star_subscriptions_gen.go delete mode 100644 tdapi/tl_get_star_transactions_gen.go delete mode 100644 tdapi/tl_get_star_withdrawal_url_gen.go delete mode 100644 tdapi/tl_get_statistical_graph_gen.go delete mode 100644 tdapi/tl_get_sticker_emojis_gen.go delete mode 100644 tdapi/tl_get_sticker_outline_gen.go delete mode 100644 tdapi/tl_get_sticker_set_gen.go delete mode 100644 tdapi/tl_get_sticker_set_name_gen.go delete mode 100644 tdapi/tl_get_stickers_gen.go delete mode 100644 tdapi/tl_get_storage_statistics_fast_gen.go delete mode 100644 tdapi/tl_get_storage_statistics_gen.go delete mode 100644 tdapi/tl_get_story_available_reactions_gen.go delete mode 100644 tdapi/tl_get_story_gen.go delete mode 100644 tdapi/tl_get_story_interactions_gen.go delete mode 100644 tdapi/tl_get_story_notification_settings_exceptions_gen.go delete mode 100644 tdapi/tl_get_story_public_forwards_gen.go delete mode 100644 tdapi/tl_get_story_statistics_gen.go delete mode 100644 tdapi/tl_get_suggested_file_name_gen.go delete mode 100644 tdapi/tl_get_suggested_sticker_set_name_gen.go delete mode 100644 tdapi/tl_get_suitable_discussion_chats_gen.go delete mode 100644 tdapi/tl_get_suitable_personal_chats_gen.go delete mode 100644 tdapi/tl_get_supergroup_full_info_gen.go delete mode 100644 tdapi/tl_get_supergroup_gen.go delete mode 100644 tdapi/tl_get_supergroup_members_gen.go delete mode 100644 tdapi/tl_get_support_name_gen.go delete mode 100644 tdapi/tl_get_support_user_gen.go delete mode 100644 tdapi/tl_get_temporary_password_state_gen.go delete mode 100644 tdapi/tl_get_text_entities_gen.go delete mode 100644 tdapi/tl_get_theme_parameters_json_string_gen.go delete mode 100644 tdapi/tl_get_themed_chat_emoji_statuses_gen.go delete mode 100644 tdapi/tl_get_themed_emoji_statuses_gen.go delete mode 100644 tdapi/tl_get_time_zones_gen.go delete mode 100644 tdapi/tl_get_top_chats_gen.go delete mode 100644 tdapi/tl_get_trending_sticker_sets_gen.go delete mode 100644 tdapi/tl_get_user_chat_boosts_gen.go delete mode 100644 tdapi/tl_get_user_full_info_gen.go delete mode 100644 tdapi/tl_get_user_gen.go delete mode 100644 tdapi/tl_get_user_gift_gen.go delete mode 100644 tdapi/tl_get_user_gifts_gen.go delete mode 100644 tdapi/tl_get_user_link_gen.go delete mode 100644 tdapi/tl_get_user_privacy_setting_rules_gen.go delete mode 100644 tdapi/tl_get_user_profile_photos_gen.go delete mode 100644 tdapi/tl_get_user_support_info_gen.go delete mode 100644 tdapi/tl_get_video_chat_available_participants_gen.go delete mode 100644 tdapi/tl_get_video_chat_rtmp_url_gen.go delete mode 100644 tdapi/tl_get_web_app_link_url_gen.go delete mode 100644 tdapi/tl_get_web_app_placeholder_gen.go delete mode 100644 tdapi/tl_get_web_app_url_gen.go delete mode 100644 tdapi/tl_get_web_page_instant_view_gen.go delete mode 100644 tdapi/tl_gift_gen.go delete mode 100644 tdapi/tl_gift_upgrade_preview_gen.go delete mode 100644 tdapi/tl_gifts_gen.go delete mode 100644 tdapi/tl_giveaway_info_gen.go delete mode 100644 tdapi/tl_giveaway_parameters_gen.go delete mode 100644 tdapi/tl_giveaway_participant_status_gen.go delete mode 100644 tdapi/tl_giveaway_prize_gen.go delete mode 100644 tdapi/tl_group_call_gen.go delete mode 100644 tdapi/tl_group_call_id_gen.go delete mode 100644 tdapi/tl_group_call_participant_gen.go delete mode 100644 tdapi/tl_group_call_participant_video_info_gen.go delete mode 100644 tdapi/tl_group_call_recent_speaker_gen.go delete mode 100644 tdapi/tl_group_call_stream_gen.go delete mode 100644 tdapi/tl_group_call_streams_gen.go delete mode 100644 tdapi/tl_group_call_video_quality_gen.go delete mode 100644 tdapi/tl_group_call_video_source_group_gen.go delete mode 100644 tdapi/tl_hashtags_gen.go delete mode 100644 tdapi/tl_hide_contact_close_birthdays_gen.go delete mode 100644 tdapi/tl_hide_suggested_action_gen.go delete mode 100644 tdapi/tl_http_url_gen.go delete mode 100644 tdapi/tl_identity_document_gen.go delete mode 100644 tdapi/tl_import_contacts_gen.go delete mode 100644 tdapi/tl_import_messages_gen.go delete mode 100644 tdapi/tl_imported_contacts_gen.go delete mode 100644 tdapi/tl_inline_keyboard_button_gen.go delete mode 100644 tdapi/tl_inline_keyboard_button_type_gen.go delete mode 100644 tdapi/tl_inline_query_result_gen.go delete mode 100644 tdapi/tl_inline_query_results_button_gen.go delete mode 100644 tdapi/tl_inline_query_results_button_type_gen.go delete mode 100644 tdapi/tl_inline_query_results_gen.go delete mode 100644 tdapi/tl_input_background_gen.go delete mode 100644 tdapi/tl_input_business_chat_link_gen.go delete mode 100644 tdapi/tl_input_business_start_page_gen.go delete mode 100644 tdapi/tl_input_chat_photo_gen.go delete mode 100644 tdapi/tl_input_credentials_gen.go delete mode 100644 tdapi/tl_input_file_gen.go delete mode 100644 tdapi/tl_input_identity_document_gen.go delete mode 100644 tdapi/tl_input_inline_query_result_gen.go delete mode 100644 tdapi/tl_input_invoice_gen.go delete mode 100644 tdapi/tl_input_message_content_gen.go delete mode 100644 tdapi/tl_input_message_reply_to_gen.go delete mode 100644 tdapi/tl_input_paid_media_gen.go delete mode 100644 tdapi/tl_input_paid_media_type_gen.go delete mode 100644 tdapi/tl_input_passport_element_error_gen.go delete mode 100644 tdapi/tl_input_passport_element_error_source_gen.go delete mode 100644 tdapi/tl_input_passport_element_gen.go delete mode 100644 tdapi/tl_input_personal_document_gen.go delete mode 100644 tdapi/tl_input_sticker_gen.go delete mode 100644 tdapi/tl_input_story_area_gen.go delete mode 100644 tdapi/tl_input_story_area_type_gen.go delete mode 100644 tdapi/tl_input_story_areas_gen.go delete mode 100644 tdapi/tl_input_story_content_gen.go delete mode 100644 tdapi/tl_input_text_quote_gen.go delete mode 100644 tdapi/tl_input_thumbnail_gen.go delete mode 100644 tdapi/tl_int32_gen.go delete mode 100644 tdapi/tl_int53_gen.go delete mode 100644 tdapi/tl_int64_gen.go delete mode 100644 tdapi/tl_internal_link_type_gen.go delete mode 100644 tdapi/tl_invite_group_call_participants_gen.go delete mode 100644 tdapi/tl_invite_link_chat_type_gen.go delete mode 100644 tdapi/tl_invoice_gen.go delete mode 100644 tdapi/tl_join_chat_by_invite_link_gen.go delete mode 100644 tdapi/tl_join_chat_gen.go delete mode 100644 tdapi/tl_join_group_call_gen.go delete mode 100644 tdapi/tl_json_object_member_gen.go delete mode 100644 tdapi/tl_json_value_gen.go delete mode 100644 tdapi/tl_keyboard_button_gen.go delete mode 100644 tdapi/tl_keyboard_button_type_gen.go delete mode 100644 tdapi/tl_labeled_price_part_gen.go delete mode 100644 tdapi/tl_language_pack_info_gen.go delete mode 100644 tdapi/tl_language_pack_string_gen.go delete mode 100644 tdapi/tl_language_pack_string_value_gen.go delete mode 100644 tdapi/tl_language_pack_strings_gen.go delete mode 100644 tdapi/tl_launch_prepaid_giveaway_gen.go delete mode 100644 tdapi/tl_leave_chat_gen.go delete mode 100644 tdapi/tl_leave_group_call_gen.go delete mode 100644 tdapi/tl_link_preview_album_media_gen.go delete mode 100644 tdapi/tl_link_preview_gen.go delete mode 100644 tdapi/tl_link_preview_options_gen.go delete mode 100644 tdapi/tl_link_preview_type_gen.go delete mode 100644 tdapi/tl_load_active_stories_gen.go delete mode 100644 tdapi/tl_load_chats_gen.go delete mode 100644 tdapi/tl_load_group_call_participants_gen.go delete mode 100644 tdapi/tl_load_quick_reply_shortcut_messages_gen.go delete mode 100644 tdapi/tl_load_quick_reply_shortcuts_gen.go delete mode 100644 tdapi/tl_load_saved_messages_topics_gen.go delete mode 100644 tdapi/tl_local_file_gen.go delete mode 100644 tdapi/tl_localization_target_info_gen.go delete mode 100644 tdapi/tl_location_address_gen.go delete mode 100644 tdapi/tl_location_gen.go delete mode 100644 tdapi/tl_log_out_gen.go delete mode 100644 tdapi/tl_log_stream_gen.go delete mode 100644 tdapi/tl_log_tags_gen.go delete mode 100644 tdapi/tl_log_verbosity_level_gen.go delete mode 100644 tdapi/tl_login_url_info_gen.go delete mode 100644 tdapi/tl_main_web_app_gen.go delete mode 100644 tdapi/tl_mask_point_gen.go delete mode 100644 tdapi/tl_mask_position_gen.go delete mode 100644 tdapi/tl_message_auto_delete_time_gen.go delete mode 100644 tdapi/tl_message_calendar_day_gen.go delete mode 100644 tdapi/tl_message_calendar_gen.go delete mode 100644 tdapi/tl_message_content_gen.go delete mode 100644 tdapi/tl_message_copy_options_gen.go delete mode 100644 tdapi/tl_message_effect_gen.go delete mode 100644 tdapi/tl_message_effect_type_gen.go delete mode 100644 tdapi/tl_message_file_type_gen.go delete mode 100644 tdapi/tl_message_forward_info_gen.go delete mode 100644 tdapi/tl_message_gen.go delete mode 100644 tdapi/tl_message_import_info_gen.go delete mode 100644 tdapi/tl_message_interaction_info_gen.go delete mode 100644 tdapi/tl_message_link_gen.go delete mode 100644 tdapi/tl_message_link_info_gen.go delete mode 100644 tdapi/tl_message_origin_gen.go delete mode 100644 tdapi/tl_message_position_gen.go delete mode 100644 tdapi/tl_message_positions_gen.go delete mode 100644 tdapi/tl_message_properties_gen.go delete mode 100644 tdapi/tl_message_reaction_gen.go delete mode 100644 tdapi/tl_message_reactions_gen.go delete mode 100644 tdapi/tl_message_read_date_gen.go delete mode 100644 tdapi/tl_message_reply_info_gen.go delete mode 100644 tdapi/tl_message_reply_to_gen.go delete mode 100644 tdapi/tl_message_scheduling_state_gen.go delete mode 100644 tdapi/tl_message_self_destruct_type_gen.go delete mode 100644 tdapi/tl_message_send_options_gen.go delete mode 100644 tdapi/tl_message_sender_gen.go delete mode 100644 tdapi/tl_message_senders_gen.go delete mode 100644 tdapi/tl_message_sending_state_gen.go delete mode 100644 tdapi/tl_message_source_gen.go delete mode 100644 tdapi/tl_message_sponsor_gen.go delete mode 100644 tdapi/tl_message_statistics_gen.go delete mode 100644 tdapi/tl_message_thread_info_gen.go delete mode 100644 tdapi/tl_message_viewer_gen.go delete mode 100644 tdapi/tl_message_viewers_gen.go delete mode 100644 tdapi/tl_messages_gen.go delete mode 100644 tdapi/tl_network_statistics_entry_gen.go delete mode 100644 tdapi/tl_network_statistics_gen.go delete mode 100644 tdapi/tl_network_type_gen.go delete mode 100644 tdapi/tl_new_chat_privacy_settings_gen.go delete mode 100644 tdapi/tl_notification_gen.go delete mode 100644 tdapi/tl_notification_group_gen.go delete mode 100644 tdapi/tl_notification_group_type_gen.go delete mode 100644 tdapi/tl_notification_settings_scope_gen.go delete mode 100644 tdapi/tl_notification_sound_gen.go delete mode 100644 tdapi/tl_notification_sounds_gen.go delete mode 100644 tdapi/tl_notification_type_gen.go delete mode 100644 tdapi/tl_ok_gen.go delete mode 100644 tdapi/tl_open_chat_gen.go delete mode 100644 tdapi/tl_open_chat_similar_chat_gen.go delete mode 100644 tdapi/tl_open_message_content_gen.go delete mode 100644 tdapi/tl_open_story_gen.go delete mode 100644 tdapi/tl_open_web_app_gen.go delete mode 100644 tdapi/tl_optimize_storage_gen.go delete mode 100644 tdapi/tl_option_value_gen.go delete mode 100644 tdapi/tl_order_info_gen.go delete mode 100644 tdapi/tl_outline_gen.go delete mode 100644 tdapi/tl_page_block_caption_gen.go delete mode 100644 tdapi/tl_page_block_gen.go delete mode 100644 tdapi/tl_page_block_horizontal_alignment_gen.go delete mode 100644 tdapi/tl_page_block_list_item_gen.go delete mode 100644 tdapi/tl_page_block_related_article_gen.go delete mode 100644 tdapi/tl_page_block_table_cell_gen.go delete mode 100644 tdapi/tl_page_block_vertical_alignment_gen.go delete mode 100644 tdapi/tl_paid_media_gen.go delete mode 100644 tdapi/tl_paid_reactor_gen.go delete mode 100644 tdapi/tl_parse_markdown_gen.go delete mode 100644 tdapi/tl_parse_text_entities_gen.go delete mode 100644 tdapi/tl_passport_authorization_form_gen.go delete mode 100644 tdapi/tl_passport_element_error_gen.go delete mode 100644 tdapi/tl_passport_element_error_source_gen.go delete mode 100644 tdapi/tl_passport_element_gen.go delete mode 100644 tdapi/tl_passport_element_type_gen.go delete mode 100644 tdapi/tl_passport_elements_gen.go delete mode 100644 tdapi/tl_passport_elements_with_errors_gen.go delete mode 100644 tdapi/tl_passport_required_element_gen.go delete mode 100644 tdapi/tl_passport_suitable_element_gen.go delete mode 100644 tdapi/tl_password_state_gen.go delete mode 100644 tdapi/tl_payment_form_gen.go delete mode 100644 tdapi/tl_payment_form_type_gen.go delete mode 100644 tdapi/tl_payment_option_gen.go delete mode 100644 tdapi/tl_payment_provider_gen.go delete mode 100644 tdapi/tl_payment_receipt_gen.go delete mode 100644 tdapi/tl_payment_receipt_type_gen.go delete mode 100644 tdapi/tl_payment_result_gen.go delete mode 100644 tdapi/tl_personal_details_gen.go delete mode 100644 tdapi/tl_personal_document_gen.go delete mode 100644 tdapi/tl_phone_number_authentication_settings_gen.go delete mode 100644 tdapi/tl_phone_number_code_type_gen.go delete mode 100644 tdapi/tl_phone_number_info_gen.go delete mode 100644 tdapi/tl_photo_gen.go delete mode 100644 tdapi/tl_photo_size_gen.go delete mode 100644 tdapi/tl_pin_chat_message_gen.go delete mode 100644 tdapi/tl_ping_proxy_gen.go delete mode 100644 tdapi/tl_point_gen.go delete mode 100644 tdapi/tl_poll_gen.go delete mode 100644 tdapi/tl_poll_option_gen.go delete mode 100644 tdapi/tl_poll_type_gen.go delete mode 100644 tdapi/tl_preliminary_upload_file_gen.go delete mode 100644 tdapi/tl_premium_feature_gen.go delete mode 100644 tdapi/tl_premium_feature_promotion_animation_gen.go delete mode 100644 tdapi/tl_premium_features_gen.go delete mode 100644 tdapi/tl_premium_gift_code_info_gen.go delete mode 100644 tdapi/tl_premium_gift_code_payment_option_gen.go delete mode 100644 tdapi/tl_premium_gift_code_payment_options_gen.go delete mode 100644 tdapi/tl_premium_limit_gen.go delete mode 100644 tdapi/tl_premium_limit_type_gen.go delete mode 100644 tdapi/tl_premium_payment_option_gen.go delete mode 100644 tdapi/tl_premium_source_gen.go delete mode 100644 tdapi/tl_premium_state_gen.go delete mode 100644 tdapi/tl_premium_state_payment_option_gen.go delete mode 100644 tdapi/tl_premium_story_feature_gen.go delete mode 100644 tdapi/tl_prepaid_giveaway_gen.go delete mode 100644 tdapi/tl_prepared_inline_message_gen.go delete mode 100644 tdapi/tl_prepared_inline_message_id_gen.go delete mode 100644 tdapi/tl_process_chat_folder_new_chats_gen.go delete mode 100644 tdapi/tl_process_chat_join_request_gen.go delete mode 100644 tdapi/tl_process_chat_join_requests_gen.go delete mode 100644 tdapi/tl_process_push_notification_gen.go delete mode 100644 tdapi/tl_product_info_gen.go delete mode 100644 tdapi/tl_profile_accent_color_gen.go delete mode 100644 tdapi/tl_profile_accent_colors_gen.go delete mode 100644 tdapi/tl_profile_photo_gen.go delete mode 100644 tdapi/tl_proxies_gen.go delete mode 100644 tdapi/tl_proxy_gen.go delete mode 100644 tdapi/tl_proxy_type_gen.go delete mode 100644 tdapi/tl_public_chat_type_gen.go delete mode 100644 tdapi/tl_public_forward_gen.go delete mode 100644 tdapi/tl_public_forwards_gen.go delete mode 100644 tdapi/tl_push_message_content_gen.go delete mode 100644 tdapi/tl_push_receiver_id_gen.go delete mode 100644 tdapi/tl_quick_reply_message_gen.go delete mode 100644 tdapi/tl_quick_reply_messages_gen.go delete mode 100644 tdapi/tl_quick_reply_shortcut_gen.go delete mode 100644 tdapi/tl_rate_speech_recognition_gen.go delete mode 100644 tdapi/tl_reaction_notification_settings_gen.go delete mode 100644 tdapi/tl_reaction_notification_source_gen.go delete mode 100644 tdapi/tl_reaction_type_gen.go delete mode 100644 tdapi/tl_reaction_unavailability_reason_gen.go delete mode 100644 tdapi/tl_read_all_chat_mentions_gen.go delete mode 100644 tdapi/tl_read_all_chat_reactions_gen.go delete mode 100644 tdapi/tl_read_all_message_thread_mentions_gen.go delete mode 100644 tdapi/tl_read_all_message_thread_reactions_gen.go delete mode 100644 tdapi/tl_read_chat_list_gen.go delete mode 100644 tdapi/tl_read_date_privacy_settings_gen.go delete mode 100644 tdapi/tl_read_file_part_gen.go delete mode 100644 tdapi/tl_readd_quick_reply_shortcut_messages_gen.go delete mode 100644 tdapi/tl_recognize_speech_gen.go delete mode 100644 tdapi/tl_recommended_chat_folder_gen.go delete mode 100644 tdapi/tl_recommended_chat_folders_gen.go delete mode 100644 tdapi/tl_recover_authentication_password_gen.go delete mode 100644 tdapi/tl_recover_password_gen.go delete mode 100644 tdapi/tl_recovery_email_address_gen.go delete mode 100644 tdapi/tl_refund_star_payment_gen.go delete mode 100644 tdapi/tl_register_device_gen.go delete mode 100644 tdapi/tl_register_user_gen.go delete mode 100644 tdapi/tl_registry_gen.go delete mode 100644 tdapi/tl_remote_file_gen.go delete mode 100644 tdapi/tl_remove_all_files_from_downloads_gen.go delete mode 100644 tdapi/tl_remove_business_connected_bot_from_chat_gen.go delete mode 100644 tdapi/tl_remove_chat_action_bar_gen.go delete mode 100644 tdapi/tl_remove_contacts_gen.go delete mode 100644 tdapi/tl_remove_favorite_sticker_gen.go delete mode 100644 tdapi/tl_remove_file_from_downloads_gen.go delete mode 100644 tdapi/tl_remove_installed_background_gen.go delete mode 100644 tdapi/tl_remove_message_reaction_gen.go delete mode 100644 tdapi/tl_remove_message_sender_bot_verification_gen.go delete mode 100644 tdapi/tl_remove_notification_gen.go delete mode 100644 tdapi/tl_remove_notification_group_gen.go delete mode 100644 tdapi/tl_remove_pending_paid_message_reactions_gen.go delete mode 100644 tdapi/tl_remove_proxy_gen.go delete mode 100644 tdapi/tl_remove_recent_hashtag_gen.go delete mode 100644 tdapi/tl_remove_recent_sticker_gen.go delete mode 100644 tdapi/tl_remove_recently_found_chat_gen.go delete mode 100644 tdapi/tl_remove_saved_animation_gen.go delete mode 100644 tdapi/tl_remove_saved_notification_sound_gen.go delete mode 100644 tdapi/tl_remove_searched_for_tag_gen.go delete mode 100644 tdapi/tl_remove_sticker_from_set_gen.go delete mode 100644 tdapi/tl_remove_top_chat_gen.go delete mode 100644 tdapi/tl_reorder_active_usernames_gen.go delete mode 100644 tdapi/tl_reorder_bot_active_usernames_gen.go delete mode 100644 tdapi/tl_reorder_bot_media_previews_gen.go delete mode 100644 tdapi/tl_reorder_chat_folders_gen.go delete mode 100644 tdapi/tl_reorder_installed_sticker_sets_gen.go delete mode 100644 tdapi/tl_reorder_quick_reply_shortcuts_gen.go delete mode 100644 tdapi/tl_reorder_supergroup_active_usernames_gen.go delete mode 100644 tdapi/tl_replace_primary_chat_invite_link_gen.go delete mode 100644 tdapi/tl_replace_sticker_in_set_gen.go delete mode 100644 tdapi/tl_replace_video_chat_rtmp_url_gen.go delete mode 100644 tdapi/tl_reply_markup_gen.go delete mode 100644 tdapi/tl_report_authentication_code_missing_gen.go delete mode 100644 tdapi/tl_report_chat_gen.go delete mode 100644 tdapi/tl_report_chat_photo_gen.go delete mode 100644 tdapi/tl_report_chat_result_gen.go delete mode 100644 tdapi/tl_report_chat_sponsored_message_gen.go delete mode 100644 tdapi/tl_report_chat_sponsored_message_result_gen.go delete mode 100644 tdapi/tl_report_message_reactions_gen.go delete mode 100644 tdapi/tl_report_option_gen.go delete mode 100644 tdapi/tl_report_phone_number_code_missing_gen.go delete mode 100644 tdapi/tl_report_reason_gen.go delete mode 100644 tdapi/tl_report_story_gen.go delete mode 100644 tdapi/tl_report_story_result_gen.go delete mode 100644 tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go delete mode 100644 tdapi/tl_report_supergroup_spam_gen.go delete mode 100644 tdapi/tl_request_authentication_password_recovery_gen.go delete mode 100644 tdapi/tl_request_password_recovery_gen.go delete mode 100644 tdapi/tl_request_qr_code_authentication_gen.go delete mode 100644 tdapi/tl_resend_authentication_code_gen.go delete mode 100644 tdapi/tl_resend_code_reason_gen.go delete mode 100644 tdapi/tl_resend_email_address_verification_code_gen.go delete mode 100644 tdapi/tl_resend_login_email_address_code_gen.go delete mode 100644 tdapi/tl_resend_messages_gen.go delete mode 100644 tdapi/tl_resend_phone_number_code_gen.go delete mode 100644 tdapi/tl_resend_recovery_email_address_code_gen.go delete mode 100644 tdapi/tl_reset_all_notification_settings_gen.go delete mode 100644 tdapi/tl_reset_authentication_email_address_gen.go delete mode 100644 tdapi/tl_reset_installed_backgrounds_gen.go delete mode 100644 tdapi/tl_reset_network_statistics_gen.go delete mode 100644 tdapi/tl_reset_password_gen.go delete mode 100644 tdapi/tl_reset_password_result_gen.go delete mode 100644 tdapi/tl_reuse_star_subscription_gen.go delete mode 100644 tdapi/tl_revenue_withdrawal_state_gen.go delete mode 100644 tdapi/tl_revoke_chat_invite_link_gen.go delete mode 100644 tdapi/tl_revoke_group_call_invite_link_gen.go delete mode 100644 tdapi/tl_rich_text_gen.go delete mode 100644 tdapi/tl_rtmp_url_gen.go delete mode 100644 tdapi/tl_save_application_log_event_gen.go delete mode 100644 tdapi/tl_save_prepared_inline_message_gen.go delete mode 100644 tdapi/tl_saved_credentials_gen.go delete mode 100644 tdapi/tl_saved_messages_tag_gen.go delete mode 100644 tdapi/tl_saved_messages_tags_gen.go delete mode 100644 tdapi/tl_saved_messages_topic_gen.go delete mode 100644 tdapi/tl_saved_messages_topic_type_gen.go delete mode 100644 tdapi/tl_scope_autosave_settings_gen.go delete mode 100644 tdapi/tl_scope_notification_settings_gen.go delete mode 100644 tdapi/tl_search_affiliate_programs_gen.go delete mode 100644 tdapi/tl_search_background_gen.go delete mode 100644 tdapi/tl_search_call_messages_gen.go delete mode 100644 tdapi/tl_search_chat_affiliate_program_gen.go delete mode 100644 tdapi/tl_search_chat_members_gen.go delete mode 100644 tdapi/tl_search_chat_messages_gen.go delete mode 100644 tdapi/tl_search_chat_recent_location_messages_gen.go delete mode 100644 tdapi/tl_search_chats_gen.go delete mode 100644 tdapi/tl_search_chats_on_server_gen.go delete mode 100644 tdapi/tl_search_contacts_gen.go delete mode 100644 tdapi/tl_search_emojis_gen.go delete mode 100644 tdapi/tl_search_file_downloads_gen.go delete mode 100644 tdapi/tl_search_hashtags_gen.go delete mode 100644 tdapi/tl_search_installed_sticker_sets_gen.go delete mode 100644 tdapi/tl_search_messages_chat_type_filter_gen.go delete mode 100644 tdapi/tl_search_messages_filter_gen.go delete mode 100644 tdapi/tl_search_messages_gen.go delete mode 100644 tdapi/tl_search_outgoing_document_messages_gen.go delete mode 100644 tdapi/tl_search_public_chat_gen.go delete mode 100644 tdapi/tl_search_public_chats_gen.go delete mode 100644 tdapi/tl_search_public_messages_by_tag_gen.go delete mode 100644 tdapi/tl_search_public_stories_by_location_gen.go delete mode 100644 tdapi/tl_search_public_stories_by_tag_gen.go delete mode 100644 tdapi/tl_search_public_stories_by_venue_gen.go delete mode 100644 tdapi/tl_search_quote_gen.go delete mode 100644 tdapi/tl_search_recently_found_chats_gen.go delete mode 100644 tdapi/tl_search_saved_messages_gen.go delete mode 100644 tdapi/tl_search_secret_messages_gen.go delete mode 100644 tdapi/tl_search_sticker_set_gen.go delete mode 100644 tdapi/tl_search_sticker_sets_gen.go delete mode 100644 tdapi/tl_search_stickers_gen.go delete mode 100644 tdapi/tl_search_strings_by_prefix_gen.go delete mode 100644 tdapi/tl_search_user_by_phone_number_gen.go delete mode 100644 tdapi/tl_search_user_by_token_gen.go delete mode 100644 tdapi/tl_search_web_app_gen.go delete mode 100644 tdapi/tl_seconds_gen.go delete mode 100644 tdapi/tl_secret_chat_gen.go delete mode 100644 tdapi/tl_secret_chat_state_gen.go delete mode 100644 tdapi/tl_sell_gift_gen.go delete mode 100644 tdapi/tl_send_authentication_firebase_sms_gen.go delete mode 100644 tdapi/tl_send_bot_start_message_gen.go delete mode 100644 tdapi/tl_send_business_message_album_gen.go delete mode 100644 tdapi/tl_send_business_message_gen.go delete mode 100644 tdapi/tl_send_call_debug_information_gen.go delete mode 100644 tdapi/tl_send_call_log_gen.go delete mode 100644 tdapi/tl_send_call_rating_gen.go delete mode 100644 tdapi/tl_send_call_signaling_data_gen.go delete mode 100644 tdapi/tl_send_chat_action_gen.go delete mode 100644 tdapi/tl_send_custom_request_gen.go delete mode 100644 tdapi/tl_send_email_address_verification_code_gen.go delete mode 100644 tdapi/tl_send_gift_gen.go delete mode 100644 tdapi/tl_send_inline_query_result_message_gen.go delete mode 100644 tdapi/tl_send_message_album_gen.go delete mode 100644 tdapi/tl_send_message_gen.go delete mode 100644 tdapi/tl_send_passport_authorization_form_gen.go delete mode 100644 tdapi/tl_send_payment_form_gen.go delete mode 100644 tdapi/tl_send_phone_number_code_gen.go delete mode 100644 tdapi/tl_send_phone_number_firebase_sms_gen.go delete mode 100644 tdapi/tl_send_quick_reply_shortcut_messages_gen.go delete mode 100644 tdapi/tl_send_story_gen.go delete mode 100644 tdapi/tl_send_web_app_custom_request_gen.go delete mode 100644 tdapi/tl_send_web_app_data_gen.go delete mode 100644 tdapi/tl_sent_gift_gen.go delete mode 100644 tdapi/tl_sent_web_app_message_gen.go delete mode 100644 tdapi/tl_session_gen.go delete mode 100644 tdapi/tl_session_type_gen.go delete mode 100644 tdapi/tl_sessions_gen.go delete mode 100644 tdapi/tl_set_accent_color_gen.go delete mode 100644 tdapi/tl_set_account_ttl_gen.go delete mode 100644 tdapi/tl_set_alarm_gen.go delete mode 100644 tdapi/tl_set_application_verification_token_gen.go delete mode 100644 tdapi/tl_set_archive_chat_list_settings_gen.go delete mode 100644 tdapi/tl_set_authentication_email_address_gen.go delete mode 100644 tdapi/tl_set_authentication_phone_number_gen.go delete mode 100644 tdapi/tl_set_auto_download_settings_gen.go delete mode 100644 tdapi/tl_set_autosave_settings_gen.go delete mode 100644 tdapi/tl_set_bio_gen.go delete mode 100644 tdapi/tl_set_birthdate_gen.go delete mode 100644 tdapi/tl_set_bot_info_description_gen.go delete mode 100644 tdapi/tl_set_bot_info_short_description_gen.go delete mode 100644 tdapi/tl_set_bot_name_gen.go delete mode 100644 tdapi/tl_set_bot_profile_photo_gen.go delete mode 100644 tdapi/tl_set_bot_updates_status_gen.go delete mode 100644 tdapi/tl_set_business_away_message_settings_gen.go delete mode 100644 tdapi/tl_set_business_connected_bot_gen.go delete mode 100644 tdapi/tl_set_business_greeting_message_settings_gen.go delete mode 100644 tdapi/tl_set_business_location_gen.go delete mode 100644 tdapi/tl_set_business_message_is_pinned_gen.go delete mode 100644 tdapi/tl_set_business_opening_hours_gen.go delete mode 100644 tdapi/tl_set_business_start_page_gen.go delete mode 100644 tdapi/tl_set_chat_accent_color_gen.go delete mode 100644 tdapi/tl_set_chat_active_stories_list_gen.go delete mode 100644 tdapi/tl_set_chat_affiliate_program_gen.go delete mode 100644 tdapi/tl_set_chat_available_reactions_gen.go delete mode 100644 tdapi/tl_set_chat_background_gen.go delete mode 100644 tdapi/tl_set_chat_client_data_gen.go delete mode 100644 tdapi/tl_set_chat_description_gen.go delete mode 100644 tdapi/tl_set_chat_discussion_group_gen.go delete mode 100644 tdapi/tl_set_chat_draft_message_gen.go delete mode 100644 tdapi/tl_set_chat_emoji_status_gen.go delete mode 100644 tdapi/tl_set_chat_location_gen.go delete mode 100644 tdapi/tl_set_chat_member_status_gen.go delete mode 100644 tdapi/tl_set_chat_message_auto_delete_time_gen.go delete mode 100644 tdapi/tl_set_chat_message_sender_gen.go delete mode 100644 tdapi/tl_set_chat_notification_settings_gen.go delete mode 100644 tdapi/tl_set_chat_permissions_gen.go delete mode 100644 tdapi/tl_set_chat_photo_gen.go delete mode 100644 tdapi/tl_set_chat_pinned_stories_gen.go delete mode 100644 tdapi/tl_set_chat_profile_accent_color_gen.go delete mode 100644 tdapi/tl_set_chat_slow_mode_delay_gen.go delete mode 100644 tdapi/tl_set_chat_theme_gen.go delete mode 100644 tdapi/tl_set_chat_title_gen.go delete mode 100644 tdapi/tl_set_close_friends_gen.go delete mode 100644 tdapi/tl_set_commands_gen.go delete mode 100644 tdapi/tl_set_custom_emoji_sticker_set_thumbnail_gen.go delete mode 100644 tdapi/tl_set_custom_language_pack_gen.go delete mode 100644 tdapi/tl_set_custom_language_pack_string_gen.go delete mode 100644 tdapi/tl_set_database_encryption_key_gen.go delete mode 100644 tdapi/tl_set_default_background_gen.go delete mode 100644 tdapi/tl_set_default_channel_administrator_rights_gen.go delete mode 100644 tdapi/tl_set_default_group_administrator_rights_gen.go delete mode 100644 tdapi/tl_set_default_message_auto_delete_time_gen.go delete mode 100644 tdapi/tl_set_default_reaction_type_gen.go delete mode 100644 tdapi/tl_set_emoji_status_gen.go delete mode 100644 tdapi/tl_set_file_generation_progress_gen.go delete mode 100644 tdapi/tl_set_forum_topic_notification_settings_gen.go delete mode 100644 tdapi/tl_set_game_score_gen.go delete mode 100644 tdapi/tl_set_group_call_participant_is_speaking_gen.go delete mode 100644 tdapi/tl_set_group_call_participant_volume_level_gen.go delete mode 100644 tdapi/tl_set_group_call_title_gen.go delete mode 100644 tdapi/tl_set_inactive_session_ttl_gen.go delete mode 100644 tdapi/tl_set_inline_game_score_gen.go delete mode 100644 tdapi/tl_set_log_stream_gen.go delete mode 100644 tdapi/tl_set_log_tag_verbosity_level_gen.go delete mode 100644 tdapi/tl_set_log_verbosity_level_gen.go delete mode 100644 tdapi/tl_set_login_email_address_gen.go delete mode 100644 tdapi/tl_set_menu_button_gen.go delete mode 100644 tdapi/tl_set_message_fact_check_gen.go delete mode 100644 tdapi/tl_set_message_reactions_gen.go delete mode 100644 tdapi/tl_set_message_sender_block_list_gen.go delete mode 100644 tdapi/tl_set_message_sender_bot_verification_gen.go delete mode 100644 tdapi/tl_set_name_gen.go delete mode 100644 tdapi/tl_set_network_type_gen.go delete mode 100644 tdapi/tl_set_new_chat_privacy_settings_gen.go delete mode 100644 tdapi/tl_set_option_gen.go delete mode 100644 tdapi/tl_set_passport_element_errors_gen.go delete mode 100644 tdapi/tl_set_passport_element_gen.go delete mode 100644 tdapi/tl_set_password_gen.go delete mode 100644 tdapi/tl_set_personal_chat_gen.go delete mode 100644 tdapi/tl_set_pinned_chats_gen.go delete mode 100644 tdapi/tl_set_pinned_forum_topics_gen.go delete mode 100644 tdapi/tl_set_pinned_saved_messages_topics_gen.go delete mode 100644 tdapi/tl_set_poll_answer_gen.go delete mode 100644 tdapi/tl_set_profile_accent_color_gen.go delete mode 100644 tdapi/tl_set_profile_photo_gen.go delete mode 100644 tdapi/tl_set_quick_reply_shortcut_name_gen.go delete mode 100644 tdapi/tl_set_reaction_notification_settings_gen.go delete mode 100644 tdapi/tl_set_read_date_privacy_settings_gen.go delete mode 100644 tdapi/tl_set_recovery_email_address_gen.go delete mode 100644 tdapi/tl_set_saved_messages_tag_label_gen.go delete mode 100644 tdapi/tl_set_scope_notification_settings_gen.go delete mode 100644 tdapi/tl_set_sticker_emojis_gen.go delete mode 100644 tdapi/tl_set_sticker_keywords_gen.go delete mode 100644 tdapi/tl_set_sticker_mask_position_gen.go delete mode 100644 tdapi/tl_set_sticker_position_in_set_gen.go delete mode 100644 tdapi/tl_set_sticker_set_thumbnail_gen.go delete mode 100644 tdapi/tl_set_sticker_set_title_gen.go delete mode 100644 tdapi/tl_set_story_privacy_settings_gen.go delete mode 100644 tdapi/tl_set_story_reaction_gen.go delete mode 100644 tdapi/tl_set_supergroup_custom_emoji_sticker_set_gen.go delete mode 100644 tdapi/tl_set_supergroup_sticker_set_gen.go delete mode 100644 tdapi/tl_set_supergroup_unrestrict_boost_count_gen.go delete mode 100644 tdapi/tl_set_supergroup_username_gen.go delete mode 100644 tdapi/tl_set_tdlib_parameters_gen.go delete mode 100644 tdapi/tl_set_user_emoji_status_gen.go delete mode 100644 tdapi/tl_set_user_personal_profile_photo_gen.go delete mode 100644 tdapi/tl_set_user_privacy_setting_rules_gen.go delete mode 100644 tdapi/tl_set_user_support_info_gen.go delete mode 100644 tdapi/tl_set_username_gen.go delete mode 100644 tdapi/tl_set_video_chat_default_participant_gen.go delete mode 100644 tdapi/tl_share_chat_with_bot_gen.go delete mode 100644 tdapi/tl_share_phone_number_gen.go delete mode 100644 tdapi/tl_share_users_with_bot_gen.go delete mode 100644 tdapi/tl_shared_chat_gen.go delete mode 100644 tdapi/tl_shared_user_gen.go delete mode 100644 tdapi/tl_shipping_option_gen.go delete mode 100644 tdapi/tl_speech_recognition_result_gen.go delete mode 100644 tdapi/tl_sponsored_message_gen.go delete mode 100644 tdapi/tl_sponsored_messages_gen.go delete mode 100644 tdapi/tl_star_amount_gen.go delete mode 100644 tdapi/tl_star_giveaway_payment_option_gen.go delete mode 100644 tdapi/tl_star_giveaway_payment_options_gen.go delete mode 100644 tdapi/tl_star_giveaway_winner_option_gen.go delete mode 100644 tdapi/tl_star_payment_option_gen.go delete mode 100644 tdapi/tl_star_payment_options_gen.go delete mode 100644 tdapi/tl_star_revenue_statistics_gen.go delete mode 100644 tdapi/tl_star_revenue_status_gen.go delete mode 100644 tdapi/tl_star_subscription_gen.go delete mode 100644 tdapi/tl_star_subscription_pricing_gen.go delete mode 100644 tdapi/tl_star_subscription_type_gen.go delete mode 100644 tdapi/tl_star_subscriptions_gen.go delete mode 100644 tdapi/tl_star_transaction_direction_gen.go delete mode 100644 tdapi/tl_star_transaction_gen.go delete mode 100644 tdapi/tl_star_transaction_type_gen.go delete mode 100644 tdapi/tl_star_transactions_gen.go delete mode 100644 tdapi/tl_start_group_call_recording_gen.go delete mode 100644 tdapi/tl_start_group_call_screen_sharing_gen.go delete mode 100644 tdapi/tl_start_scheduled_group_call_gen.go delete mode 100644 tdapi/tl_statistical_graph_gen.go delete mode 100644 tdapi/tl_statistical_value_gen.go delete mode 100644 tdapi/tl_sticker_format_gen.go delete mode 100644 tdapi/tl_sticker_full_type_gen.go delete mode 100644 tdapi/tl_sticker_gen.go delete mode 100644 tdapi/tl_sticker_set_gen.go delete mode 100644 tdapi/tl_sticker_set_info_gen.go delete mode 100644 tdapi/tl_sticker_sets_gen.go delete mode 100644 tdapi/tl_sticker_type_gen.go delete mode 100644 tdapi/tl_stickers_gen.go delete mode 100644 tdapi/tl_stop_business_poll_gen.go delete mode 100644 tdapi/tl_stop_poll_gen.go delete mode 100644 tdapi/tl_storage_statistics_by_chat_gen.go delete mode 100644 tdapi/tl_storage_statistics_by_file_type_gen.go delete mode 100644 tdapi/tl_storage_statistics_fast_gen.go delete mode 100644 tdapi/tl_storage_statistics_gen.go delete mode 100644 tdapi/tl_store_payment_purpose_gen.go delete mode 100644 tdapi/tl_stories_gen.go delete mode 100644 tdapi/tl_story_area_gen.go delete mode 100644 tdapi/tl_story_area_position_gen.go delete mode 100644 tdapi/tl_story_area_type_gen.go delete mode 100644 tdapi/tl_story_content_gen.go delete mode 100644 tdapi/tl_story_full_id_gen.go delete mode 100644 tdapi/tl_story_gen.go delete mode 100644 tdapi/tl_story_info_gen.go delete mode 100644 tdapi/tl_story_interaction_gen.go delete mode 100644 tdapi/tl_story_interaction_info_gen.go delete mode 100644 tdapi/tl_story_interaction_type_gen.go delete mode 100644 tdapi/tl_story_interactions_gen.go delete mode 100644 tdapi/tl_story_list_gen.go delete mode 100644 tdapi/tl_story_origin_gen.go delete mode 100644 tdapi/tl_story_privacy_settings_gen.go delete mode 100644 tdapi/tl_story_repost_info_gen.go delete mode 100644 tdapi/tl_story_statistics_gen.go delete mode 100644 tdapi/tl_story_video_gen.go delete mode 100644 tdapi/tl_string_gen.go delete mode 100644 tdapi/tl_suggest_user_profile_photo_gen.go delete mode 100644 tdapi/tl_suggested_action_gen.go delete mode 100644 tdapi/tl_supergroup_full_info_gen.go delete mode 100644 tdapi/tl_supergroup_gen.go delete mode 100644 tdapi/tl_supergroup_members_filter_gen.go delete mode 100644 tdapi/tl_synchronize_language_pack_gen.go delete mode 100644 tdapi/tl_t_me_url_gen.go delete mode 100644 tdapi/tl_t_me_url_type_gen.go delete mode 100644 tdapi/tl_t_me_urls_gen.go delete mode 100644 tdapi/tl_target_chat_gen.go delete mode 100644 tdapi/tl_target_chat_types_gen.go delete mode 100644 tdapi/tl_telegram_payment_purpose_gen.go delete mode 100644 tdapi/tl_temporary_password_state_gen.go delete mode 100644 tdapi/tl_terminate_all_other_sessions_gen.go delete mode 100644 tdapi/tl_terminate_session_gen.go delete mode 100644 tdapi/tl_terms_of_service_gen.go delete mode 100644 tdapi/tl_test_bytes_gen.go delete mode 100644 tdapi/tl_test_call_bytes_gen.go delete mode 100644 tdapi/tl_test_call_empty_gen.go delete mode 100644 tdapi/tl_test_call_string_gen.go delete mode 100644 tdapi/tl_test_call_vector_int_gen.go delete mode 100644 tdapi/tl_test_call_vector_int_object_gen.go delete mode 100644 tdapi/tl_test_call_vector_string_gen.go delete mode 100644 tdapi/tl_test_call_vector_string_object_gen.go delete mode 100644 tdapi/tl_test_get_difference_gen.go delete mode 100644 tdapi/tl_test_int_gen.go delete mode 100644 tdapi/tl_test_network_gen.go delete mode 100644 tdapi/tl_test_proxy_gen.go delete mode 100644 tdapi/tl_test_return_error_gen.go delete mode 100644 tdapi/tl_test_square_int_gen.go delete mode 100644 tdapi/tl_test_string_gen.go delete mode 100644 tdapi/tl_test_use_update_gen.go delete mode 100644 tdapi/tl_test_vector_int_gen.go delete mode 100644 tdapi/tl_test_vector_int_object_gen.go delete mode 100644 tdapi/tl_test_vector_string_gen.go delete mode 100644 tdapi/tl_test_vector_string_object_gen.go delete mode 100644 tdapi/tl_text_entities_gen.go delete mode 100644 tdapi/tl_text_entity_gen.go delete mode 100644 tdapi/tl_text_entity_type_gen.go delete mode 100644 tdapi/tl_text_gen.go delete mode 100644 tdapi/tl_text_parse_mode_gen.go delete mode 100644 tdapi/tl_text_quote_gen.go delete mode 100644 tdapi/tl_theme_parameters_gen.go delete mode 100644 tdapi/tl_theme_settings_gen.go delete mode 100644 tdapi/tl_thumbnail_format_gen.go delete mode 100644 tdapi/tl_thumbnail_gen.go delete mode 100644 tdapi/tl_time_zone_gen.go delete mode 100644 tdapi/tl_time_zones_gen.go delete mode 100644 tdapi/tl_toggle_all_downloads_are_paused_gen.go delete mode 100644 tdapi/tl_toggle_bot_can_manage_emoji_status_gen.go delete mode 100644 tdapi/tl_toggle_bot_is_added_to_attachment_menu_gen.go delete mode 100644 tdapi/tl_toggle_bot_username_is_active_gen.go delete mode 100644 tdapi/tl_toggle_business_connected_bot_chat_is_paused_gen.go delete mode 100644 tdapi/tl_toggle_chat_default_disable_notification_gen.go delete mode 100644 tdapi/tl_toggle_chat_folder_tags_gen.go delete mode 100644 tdapi/tl_toggle_chat_has_protected_content_gen.go delete mode 100644 tdapi/tl_toggle_chat_is_marked_as_unread_gen.go delete mode 100644 tdapi/tl_toggle_chat_is_pinned_gen.go delete mode 100644 tdapi/tl_toggle_chat_is_translatable_gen.go delete mode 100644 tdapi/tl_toggle_chat_view_as_topics_gen.go delete mode 100644 tdapi/tl_toggle_download_is_paused_gen.go delete mode 100644 tdapi/tl_toggle_forum_topic_is_closed_gen.go delete mode 100644 tdapi/tl_toggle_forum_topic_is_pinned_gen.go delete mode 100644 tdapi/tl_toggle_general_forum_topic_is_hidden_gen.go delete mode 100644 tdapi/tl_toggle_gift_is_saved_gen.go delete mode 100644 tdapi/tl_toggle_group_call_enabled_start_notification_gen.go delete mode 100644 tdapi/tl_toggle_group_call_is_my_video_enabled_gen.go delete mode 100644 tdapi/tl_toggle_group_call_is_my_video_paused_gen.go delete mode 100644 tdapi/tl_toggle_group_call_mute_new_participants_gen.go delete mode 100644 tdapi/tl_toggle_group_call_participant_is_hand_raised_gen.go delete mode 100644 tdapi/tl_toggle_group_call_participant_is_muted_gen.go delete mode 100644 tdapi/tl_toggle_group_call_screen_sharing_is_paused_gen.go delete mode 100644 tdapi/tl_toggle_has_sponsored_messages_enabled_gen.go delete mode 100644 tdapi/tl_toggle_paid_message_reaction_is_anonymous_gen.go delete mode 100644 tdapi/tl_toggle_saved_messages_topic_is_pinned_gen.go delete mode 100644 tdapi/tl_toggle_session_can_accept_calls_gen.go delete mode 100644 tdapi/tl_toggle_session_can_accept_secret_chats_gen.go delete mode 100644 tdapi/tl_toggle_story_is_posted_to_chat_page_gen.go delete mode 100644 tdapi/tl_toggle_supergroup_can_have_sponsored_messages_gen.go delete mode 100644 tdapi/tl_toggle_supergroup_has_aggressive_anti_spam_enabled_gen.go delete mode 100644 tdapi/tl_toggle_supergroup_has_hidden_members_gen.go delete mode 100644 tdapi/tl_toggle_supergroup_is_all_history_available_gen.go delete mode 100644 tdapi/tl_toggle_supergroup_is_broadcast_group_gen.go delete mode 100644 tdapi/tl_toggle_supergroup_is_forum_gen.go delete mode 100644 tdapi/tl_toggle_supergroup_join_by_request_gen.go delete mode 100644 tdapi/tl_toggle_supergroup_join_to_send_messages_gen.go delete mode 100644 tdapi/tl_toggle_supergroup_sign_messages_gen.go delete mode 100644 tdapi/tl_toggle_supergroup_username_is_active_gen.go delete mode 100644 tdapi/tl_toggle_username_is_active_gen.go delete mode 100644 tdapi/tl_top_chat_category_gen.go delete mode 100644 tdapi/tl_transfer_chat_ownership_gen.go delete mode 100644 tdapi/tl_transfer_gift_gen.go delete mode 100644 tdapi/tl_translate_message_text_gen.go delete mode 100644 tdapi/tl_translate_text_gen.go delete mode 100644 tdapi/tl_trending_sticker_sets_gen.go delete mode 100644 tdapi/tl_unconfirmed_session_gen.go delete mode 100644 tdapi/tl_unpin_all_chat_messages_gen.go delete mode 100644 tdapi/tl_unpin_all_message_thread_messages_gen.go delete mode 100644 tdapi/tl_unpin_chat_message_gen.go delete mode 100644 tdapi/tl_unread_reaction_gen.go delete mode 100644 tdapi/tl_update_gen.go delete mode 100644 tdapi/tl_updates_gen.go delete mode 100644 tdapi/tl_upgrade_basic_group_chat_to_supergroup_chat_gen.go delete mode 100644 tdapi/tl_upgrade_gift_gen.go delete mode 100644 tdapi/tl_upgrade_gift_result_gen.go delete mode 100644 tdapi/tl_upgraded_gift_backdrop_gen.go delete mode 100644 tdapi/tl_upgraded_gift_gen.go delete mode 100644 tdapi/tl_upgraded_gift_model_gen.go delete mode 100644 tdapi/tl_upgraded_gift_original_details_gen.go delete mode 100644 tdapi/tl_upgraded_gift_symbol_gen.go delete mode 100644 tdapi/tl_upload_sticker_file_gen.go delete mode 100644 tdapi/tl_user_full_info_gen.go delete mode 100644 tdapi/tl_user_gen.go delete mode 100644 tdapi/tl_user_gift_gen.go delete mode 100644 tdapi/tl_user_gifts_gen.go delete mode 100644 tdapi/tl_user_link_gen.go delete mode 100644 tdapi/tl_user_privacy_setting_gen.go delete mode 100644 tdapi/tl_user_privacy_setting_rule_gen.go delete mode 100644 tdapi/tl_user_privacy_setting_rules_gen.go delete mode 100644 tdapi/tl_user_status_gen.go delete mode 100644 tdapi/tl_user_support_info_gen.go delete mode 100644 tdapi/tl_user_type_gen.go delete mode 100644 tdapi/tl_usernames_gen.go delete mode 100644 tdapi/tl_users_gen.go delete mode 100644 tdapi/tl_validate_order_info_gen.go delete mode 100644 tdapi/tl_validated_order_info_gen.go delete mode 100644 tdapi/tl_vector_path_command_gen.go delete mode 100644 tdapi/tl_venue_gen.go delete mode 100644 tdapi/tl_verification_status_gen.go delete mode 100644 tdapi/tl_video_chat_gen.go delete mode 100644 tdapi/tl_video_gen.go delete mode 100644 tdapi/tl_video_note_gen.go delete mode 100644 tdapi/tl_view_messages_gen.go delete mode 100644 tdapi/tl_view_premium_feature_gen.go delete mode 100644 tdapi/tl_view_trending_sticker_sets_gen.go delete mode 100644 tdapi/tl_voice_note_gen.go delete mode 100644 tdapi/tl_web_app_gen.go delete mode 100644 tdapi/tl_web_app_info_gen.go delete mode 100644 tdapi/tl_web_app_open_mode_gen.go delete mode 100644 tdapi/tl_web_app_open_parameters_gen.go delete mode 100644 tdapi/tl_web_page_instant_view_gen.go delete mode 100644 tdapi/tl_write_generated_file_part_gen.go rename tdapi/tl_minithumbnail_gen.go => tdjson/tl_minithumbnail_gen_test.go (99%) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index bc51d5b6f..4cd56c69f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -23,13 +23,3 @@ jobs: secrets: APP_ID: ${{ secrets.APP_ID }} APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} - - tdlib: - uses: gotd/td/.github/workflows/update-schema.yml@main - with: - schema-name: "TDLib" - branch: "feat/update-tdlib-schema" - make-command: "download_tdlib_schema" - secrets: - APP_ID: ${{ secrets.APP_ID }} - APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/_schema/tdapi.tl b/_schema/tdapi.tl deleted file mode 100644 index 6dbe7750b..000000000 --- a/_schema/tdapi.tl +++ /dev/null @@ -1,13236 +0,0 @@ -// Code generated by ./cmd/dltl, DO NOT EDIT. -// -// Source: https://raw.githubusercontent.com/tdlib/td/master/td/generate/scheme/td_api.tl -// SHA256: 1c0e24ffba9d393c5dd25aee81b4fa2629fca3e208938d67c66cb8e5541e6655 - -double#2210c154 ? = Double; - -string#b5286e24 ? = String; - -int32#5cb934fa = Int32; - -int53#6781c7ee = Int53; - -int64#5d9ed744 = Int64; - -bytes#e937bb82 = Bytes; - -boolFalse#bc799737 = Bool; - -boolTrue#997275b5 = Bool; - -//@description An object of this type can be returned on every function call, in case of an error -//@code Error code; subject to future changes. If the error code is 406, the error message must not be processed in any way and must not be displayed to the user -//@message Error message; subject to future changes -error#9bdd8f1a code:int32 message:string = Error; - -//@description An object of this type is returned on a successful function call for certain functions -ok#d4edbe69 = Ok; - -//@class AuthenticationCodeType @description Provides information about the method by which an authentication code is delivered to the user - -//@description A digit-only authentication code is delivered via a private Telegram message, which can be viewed from another active session -//@length Length of the code -authenticationCodeTypeTelegramMessage#7bf49b2a length:int32 = AuthenticationCodeType; - -//@description A digit-only authentication code is delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code -//@length Length of the code -authenticationCodeTypeSms#3960e288 length:int32 = AuthenticationCodeType; - -//@description An authentication code is a word delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code -//@first_letter The first letters of the word if known -authenticationCodeTypeSmsWord#a6063c63 first_letter:string = AuthenticationCodeType; - -//@description An authentication code is a phrase from multiple words delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code -//@first_word The first word of the phrase if known -authenticationCodeTypeSmsPhrase#2ebc8cd1 first_word:string = AuthenticationCodeType; - -//@description A digit-only authentication code is delivered via a phone call to the specified phone number -//@length Length of the code -authenticationCodeTypeCall#61876c67 length:int32 = AuthenticationCodeType; - -//@description An authentication code is delivered by an immediately canceled call to the specified phone number. The phone number that calls is the code that must be entered automatically -//@pattern Pattern of the phone number from which the call will be made -authenticationCodeTypeFlashCall#533379a2 pattern:string = AuthenticationCodeType; - -//@description An authentication code is delivered by an immediately canceled call to the specified phone number. The last digits of the phone number that calls are the code that must be entered manually by the user -//@phone_number_prefix Prefix of the phone number from which the call will be made -//@length Number of digits in the code, excluding the prefix -authenticationCodeTypeMissedCall#29bb0a87 phone_number_prefix:string length:int32 = AuthenticationCodeType; - -//@description A digit-only authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT -//@url URL to open to receive the code -//@length Length of the code -authenticationCodeTypeFragment#810f74cd url:string length:int32 = AuthenticationCodeType; - -//@description A digit-only authentication code is delivered via Firebase Authentication to the official Android application -//@device_verification_parameters Parameters to be used for device verification -//@length Length of the code -authenticationCodeTypeFirebaseAndroid#6f9bb51e device_verification_parameters:FirebaseDeviceVerificationParameters length:int32 = AuthenticationCodeType; - -//@description A digit-only authentication code is delivered via Firebase Authentication to the official iOS application -//@receipt Receipt of successful application token validation to compare with receipt from push notification -//@push_timeout Time after the next authentication method is expected to be used if verification push notification isn't received, in seconds -//@length Length of the code -authenticationCodeTypeFirebaseIos#ff55aa93 receipt:string push_timeout:int32 length:int32 = AuthenticationCodeType; - -//@description Information about the authentication code that was sent -//@phone_number A phone number that is being authenticated -//@type The way the code was sent to the user -//@next_type The way the next code will be sent to the user; may be null -//@timeout Timeout before the code can be re-sent, in seconds -authenticationCodeInfo#ccb82bb8 phone_number:string type:AuthenticationCodeType next_type:AuthenticationCodeType timeout:int32 = AuthenticationCodeInfo; - -//@description Information about the email address authentication code that was sent -//@email_address_pattern Pattern of the email address to which an authentication code was sent -//@length Length of the code; 0 if unknown -emailAddressAuthenticationCodeInfo#449be223 email_address_pattern:string length:int32 = EmailAddressAuthenticationCodeInfo; - -//@class EmailAddressAuthentication @description Contains authentication data for an email address - -//@description An authentication code delivered to a user's email address -//@code The code -emailAddressAuthenticationCode#c4cc19c2 code:string = EmailAddressAuthentication; - -//@description An authentication token received through Apple ID -//@token The token -emailAddressAuthenticationAppleId#25c94869 token:string = EmailAddressAuthentication; - -//@description An authentication token received through Google ID -//@token The token -emailAddressAuthenticationGoogleId#fedbe742 token:string = EmailAddressAuthentication; - -//@class EmailAddressResetState @description Describes reset state of an email address - -//@description Email address can be reset after the given period. Call resetAuthenticationEmailAddress to reset it and allow the user to authorize with a code sent to the user's phone number -//@wait_period Time required to wait before the email address can be reset; 0 if the user is subscribed to Telegram Premium -emailAddressResetStateAvailable#8dba3100 wait_period:int32 = EmailAddressResetState; - -//@description Email address reset has already been requested. Call resetAuthenticationEmailAddress to check whether immediate reset is possible -//@reset_in Left time before the email address will be reset, in seconds. updateAuthorizationState is not sent when this field changes -emailAddressResetStatePending#8f966e2b reset_in:int32 = EmailAddressResetState; - -//@description Represents a part of the text that needs to be formatted in some unusual way -//@offset Offset of the entity, in UTF-16 code units -//@length Length of the entity, in UTF-16 code units -//@type Type of the entity -textEntity#8bab99a8 offset:int32 length:int32 type:TextEntityType = TextEntity; - -//@description Contains a list of text entities -//@entities List of text entities -textEntities#cf89c258 entities:vector = TextEntities; - -//@description A text with some entities -//@text The text -//@entities Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. -formattedText#a38d39ee text:string entities:vector = FormattedText; - -//@description Contains Telegram terms of service -//@text Text of the terms of service -//@min_user_age The minimum age of a user to be able to accept the terms; 0 if age isn't restricted -//@show_popup True, if a blocking popup with terms of service must be shown to the user -termsOfService#2c12b185 text:formattedText min_user_age:int32 show_popup:Bool = TermsOfService; - -//@class AuthorizationState @description Represents the current authorization state of the TDLib client - -//@description Initialization parameters are needed. Call setTdlibParameters to provide them -authorizationStateWaitTdlibParameters#35ecf25c = AuthorizationState; - -//@description TDLib needs the user's phone number to authorize. Call setAuthenticationPhoneNumber to provide the phone number, or use requestQrCodeAuthentication or checkAuthenticationBotToken for other authentication options -authorizationStateWaitPhoneNumber#124354e3 = AuthorizationState; - -//@description TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed -//@allow_apple_id True, if authorization through Apple ID is allowed -//@allow_google_id True, if authorization through Google ID is allowed -authorizationStateWaitEmailAddress#3e0471c7 allow_apple_id:Bool allow_google_id:Bool = AuthorizationState; - -//@description TDLib needs the user's authentication code sent to an email address to authorize. Call checkAuthenticationEmailCode to provide the code -//@allow_apple_id True, if authorization through Apple ID is allowed -//@allow_google_id True, if authorization through Google ID is allowed -//@code_info Information about the sent authentication code -//@email_address_reset_state Reset state of the email address; may be null if the email address can't be reset -authorizationStateWaitEmailCode#909f025b allow_apple_id:Bool allow_google_id:Bool code_info:emailAddressAuthenticationCodeInfo email_address_reset_state:EmailAddressResetState = AuthorizationState; - -//@description TDLib needs the user's authentication code to authorize. Call checkAuthenticationCode to check the code -//@code_info Information about the authorization code that was sent -authorizationStateWaitCode#3234501 code_info:authenticationCodeInfo = AuthorizationState; - -//@description The user needs to confirm authorization on another logged in device by scanning a QR code with the provided link -//@link A tg:// URL for the QR code. The link will be updated frequently -authorizationStateWaitOtherDeviceConfirmation#334518ea link:string = AuthorizationState; - -//@description The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration. Call registerUser to accept the terms of service and provide the data -//@terms_of_service Telegram terms of service -authorizationStateWaitRegistration#20cdaeaf terms_of_service:termsOfService = AuthorizationState; - -//@description The user has been authorized, but needs to enter a 2-step verification password to start using the application. -//@password_hint Hint for the password; may be empty -//@has_recovery_email_address True, if a recovery email address has been set up -//@has_passport_data True, if some Telegram Passport elements were saved -//@recovery_email_address_pattern Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent -authorizationStateWaitPassword#6b09dce password_hint:string has_recovery_email_address:Bool has_passport_data:Bool recovery_email_address_pattern:string = AuthorizationState; - -//@description The user has been successfully authorized. TDLib is now ready to answer general requests -authorizationStateReady#92a21447 = AuthorizationState; - -//@description The user is currently logging out -authorizationStateLoggingOut#934b576 = AuthorizationState; - -//@description TDLib is closing, all subsequent queries will be answered with the error 500. Note that closing TDLib can take a while. All resources will be freed only after authorizationStateClosed has been received -authorizationStateClosing#1a93364f = AuthorizationState; - -//@description TDLib client is in its final state. All databases are closed and all resources are released. No other updates will be received after this. All queries will be responded to -authorizationStateClosed#5af5a360 = AuthorizationState; - -//@class FirebaseDeviceVerificationParameters @description Describes parameters to be used for device verification - -//@description Device verification must be performed with the SafetyNet Attestation API -//@nonce Nonce to pass to the SafetyNet Attestation API -firebaseDeviceVerificationParametersSafetyNet#2b96b2f1 nonce:bytes = FirebaseDeviceVerificationParameters; - -//@description Device verification must be performed with the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) -//@nonce Base64url-encoded nonce to pass to the Play Integrity API -//@cloud_project_number Cloud project number to pass to the Play Integrity API -firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a nonce:string cloud_project_number:int64 = FirebaseDeviceVerificationParameters; - -//@description Represents the current state of 2-step verification -//@has_password True, if a 2-step verification password is set -//@password_hint Hint for the password; may be empty -//@has_recovery_email_address True, if a recovery email is set -//@has_passport_data True, if some Telegram Passport elements were saved -//@recovery_email_address_code_info Information about the recovery email address to which the confirmation email was sent; may be null -//@login_email_address_pattern Pattern of the email address set up for logging in -//@pending_reset_date If not 0, point in time (Unix timestamp) after which the 2-step verification password can be reset immediately using resetPassword -passwordState#1cd63828 has_password:Bool password_hint:string has_recovery_email_address:Bool has_passport_data:Bool recovery_email_address_code_info:emailAddressAuthenticationCodeInfo login_email_address_pattern:string pending_reset_date:int32 = PasswordState; - -//@description Contains information about the current recovery email address -//@recovery_email_address Recovery email address -recoveryEmailAddress#4cebddeb recovery_email_address:string = RecoveryEmailAddress; - -//@description Returns information about the availability of a temporary password, which can be used for payments -//@has_password True, if a temporary password is available -//@valid_for Time left before the temporary password expires, in seconds -temporaryPasswordState#3804c7e2 has_password:Bool valid_for:int32 = TemporaryPasswordState; - -//@description Represents a local file -//@path Local path to the locally available file part; may be empty -//@can_be_downloaded True, if it is possible to download or generate the file -//@can_be_deleted True, if the file can be deleted -//@is_downloading_active True, if the file is currently being downloaded (or a local copy is being generated by some other means) -//@is_downloading_completed True, if the local copy is fully available -//@download_offset Download will be started from this offset. downloaded_prefix_size is calculated from this offset -//@downloaded_prefix_size If is_downloading_completed is false, then only some prefix of the file starting from download_offset is ready to be read. downloaded_prefix_size is the size of that prefix in bytes -//@downloaded_size Total downloaded file size, in bytes. Can be used only for calculating download progress. The actual file size may be bigger, and some parts of it may contain garbage -localFile#a2da9987 path:string can_be_downloaded:Bool can_be_deleted:Bool is_downloading_active:Bool is_downloading_completed:Bool download_offset:int53 downloaded_prefix_size:int53 downloaded_size:int53 = LocalFile; - -//@description Represents a remote file -//@id Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. -//@unique_id Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time -//@is_uploading_active True, if the file is currently being uploaded (or a remote copy is being generated by some other means) -//@is_uploading_completed True, if a remote copy is fully available -//@uploaded_size Size of the remote available part of the file, in bytes; 0 if unknown -remoteFile#2c917856 id:string unique_id:string is_uploading_active:Bool is_uploading_completed:Bool uploaded_size:int53 = RemoteFile; - -//@description Represents a file -//@id Unique file identifier -//@size File size, in bytes; 0 if unknown -//@expected_size Approximate file size in bytes in case the exact file size is unknown. Can be used to show download/upload progress -//@local Information about the local copy of the file -//@remote Information about the remote copy of the file -file#4b4c4e34 id:int32 size:int53 expected_size:int53 local:localFile remote:remoteFile = File; - -//@class InputFile @description Points to a file - -//@description A file defined by its unique identifier -//@id Unique file identifier -inputFileId#6aa08b0d id:int32 = InputFile; - -//@description A file defined by its remote identifier. The remote identifier is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. -//@id Remote file identifier -inputFileRemote#f9968b3e id:string = InputFile; - -//@description A file defined by a local path -//@path Local path to the file -inputFileLocal#7a8c8ac7 path:string = InputFile; - -//@description A file generated by the application. The application must handle updates updateFileGenerationStart and updateFileGenerationStop to generate the file when asked by TDLib -//@original_path Local path to a file from which the file is generated. The path doesn't have to be a valid path and is used by TDLib only to detect name and MIME type of the generated file -//@conversion String specifying the conversion applied to the original file; must be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage -//@expected_size Expected size of the generated file, in bytes; pass 0 if unknown -inputFileGenerated#b0862800 original_path:string conversion:string expected_size:int53 = InputFile; - -//@description Describes an image in JPEG format -//@type Image type (see https://core.telegram.org/constructor/photoSize) -//@photo Information about the image file -//@width Image width -//@height Image height -//@progressive_sizes Sizes of progressive JPEG file prefixes, which can be used to preliminarily show the image; in bytes -photoSize#18e56d39 type:string photo:file width:int32 height:int32 progressive_sizes:vector = PhotoSize; - -//@description Thumbnail image of a very poor quality and low resolution -//@width Thumbnail width, usually doesn't exceed 40 -//@height Thumbnail height, usually doesn't exceed 40 -//@data The thumbnail in JPEG format -minithumbnail#ec6addaa width:int32 height:int32 data:bytes = Minithumbnail; - -//@class ThumbnailFormat @description Describes format of a thumbnail - -//@description The thumbnail is in JPEG format -thumbnailFormatJpeg#d90c5488 = ThumbnailFormat; - -//@description The thumbnail is in static GIF format. It will be used only for some bot inline query results -thumbnailFormatGif#4aa3258a = ThumbnailFormat; - -//@description The thumbnail is in MPEG4 format. It will be used only for some animations and videos -thumbnailFormatMpeg4#109b57fe = ThumbnailFormat; - -//@description The thumbnail is in PNG format. It will be used only for background patterns -thumbnailFormatPng#5e0697f5 = ThumbnailFormat; - -//@description The thumbnail is in TGS format. It will be used only for sticker sets -thumbnailFormatTgs#4e694852 = ThumbnailFormat; - -//@description The thumbnail is in WEBM format. It will be used only for sticker sets -thumbnailFormatWebm#d8a7e727 = ThumbnailFormat; - -//@description The thumbnail is in WEBP format. It will be used only for some stickers and sticker sets -thumbnailFormatWebp#fcce4c12 = ThumbnailFormat; - -//@description Represents a thumbnail -//@format Thumbnail format -//@width Thumbnail width -//@height Thumbnail height -//@file The thumbnail -thumbnail#4a1ae06b format:ThumbnailFormat width:int32 height:int32 file:file = Thumbnail; - -//@class MaskPoint @description Part of the face, relative to which a mask is placed - -//@description The mask is placed relatively to the forehead -maskPointForehead#3d3e96c5 = MaskPoint; - -//@description The mask is placed relatively to the eyes -maskPointEyes#68351b4d = MaskPoint; - -//@description The mask is placed relatively to the mouth -maskPointMouth#188b29de = MaskPoint; - -//@description The mask is placed relatively to the chin -maskPointChin#1fe36187 = MaskPoint; - -//@description Position on a photo where a mask is placed -//@point Part of the face, relative to which the mask is placed -//@x_shift Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position) -//@y_shift Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. (For example, 1.0 will place the mask just below the default mask position) -//@scale Mask scaling coefficient. (For example, 2.0 means a doubled size) -maskPosition#82fbb63e point:MaskPoint x_shift:double y_shift:double scale:double = MaskPosition; - -//@class StickerFormat @description Describes format of a sticker - -//@description The sticker is an image in WEBP format -stickerFormatWebp#8174ef20 = StickerFormat; - -//@description The sticker is an animation in TGS format -stickerFormatTgs#603caaf6 = StickerFormat; - -//@description The sticker is a video in WEBM format -stickerFormatWebm#849bd54f = StickerFormat; - -//@class StickerType @description Describes type of sticker - -//@description The sticker is a regular sticker -stickerTypeRegular#35bc575 = StickerType; - -//@description The sticker is a mask in WEBP format to be placed on photos or videos -stickerTypeMask#96c63694 = StickerType; - -//@description The sticker is a custom emoji to be used inside message text and caption -stickerTypeCustomEmoji#f8cd7787 = StickerType; - -//@class StickerFullType @description Contains full information about sticker type - -//@description The sticker is a regular sticker -//@premium_animation Premium animation of the sticker; may be null. If present, only Telegram Premium users can use the sticker -stickerFullTypeRegular#88685ef7 premium_animation:file = StickerFullType; - -//@description The sticker is a mask in WEBP format to be placed on photos or videos -//@mask_position Position where the mask is placed; may be null -stickerFullTypeMask#26dfbf37 mask_position:maskPosition = StickerFullType; - -//@description The sticker is a custom emoji to be used inside message text and caption. Currently, only Telegram Premium users can use custom emoji -//@custom_emoji_id Identifier of the custom emoji -//@needs_repainting True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places -stickerFullTypeCustomEmoji#c37f05ab custom_emoji_id:int64 needs_repainting:Bool = StickerFullType; - -//@description Represents a closed vector path. The path begins at the end point of the last command. The coordinate system origin is in the upper-left corner -//@commands List of vector path commands -closedVectorPath#2f9276b9 commands:vector = ClosedVectorPath; - -//@description Represents outline of an image -//@paths The list of closed vector paths -outline#7d2ec0be paths:vector = Outline; - -//@description Describes one answer option of a poll -//@text Option text; 1-100 characters. Only custom emoji entities are allowed -//@voter_count Number of voters for this option, available only for closed or voted polls -//@vote_percentage The percentage of votes for this option; 0-100 -//@is_chosen True, if the option was chosen by the user -//@is_being_chosen True, if the option is being chosen by a pending setPollAnswer request -pollOption#63e97090 text:formattedText voter_count:int32 vote_percentage:int32 is_chosen:Bool is_being_chosen:Bool = PollOption; - -//@class PollType @description Describes the type of poll - -//@description A regular poll -//@allow_multiple_answers True, if multiple answer options can be chosen simultaneously -pollTypeRegular#2638f022 allow_multiple_answers:Bool = PollType; - -//@description A poll in quiz mode, which has exactly one correct answer option and can be answered only once -//@correct_option_id 0-based identifier of the correct answer option; -1 for a yet unanswered poll -//@explanation Text that is shown when the user chooses an incorrect answer or taps on the lamp icon; 0-200 characters with at most 2 line feeds; empty for a yet unanswered poll -pollTypeQuiz#27293c99 correct_option_id:int32 explanation:formattedText = PollType; - -//@description Describes an animation file. The animation must be encoded in GIF or MPEG4 format -//@duration Duration of the animation, in seconds; as defined by the sender -//@width Width of the animation -//@height Height of the animation -//@file_name Original name of the file; as defined by the sender -//@mime_type MIME type of the file, usually "image/gif" or "video/mp4" -//@has_stickers True, if stickers were added to the animation. The list of corresponding sticker set can be received using getAttachedStickerSets -//@minithumbnail Animation minithumbnail; may be null -//@thumbnail Animation thumbnail in JPEG or MPEG4 format; may be null -//@animation File containing the animation -animation#cc00db3e duration:int32 width:int32 height:int32 file_name:string mime_type:string has_stickers:Bool minithumbnail:minithumbnail thumbnail:thumbnail animation:file = Animation; - -//@description Describes an audio file. Audio is usually in MP3 or M4A format -//@duration Duration of the audio, in seconds; as defined by the sender -//@title Title of the audio; as defined by the sender -//@performer Performer of the audio; as defined by the sender -//@file_name Original name of the file; as defined by the sender -//@mime_type The MIME type of the file; as defined by the sender -//@album_cover_minithumbnail The minithumbnail of the album cover; may be null -//@album_cover_thumbnail The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is expected to be extracted from the downloaded audio file; may be null -//@external_album_covers Album cover variants to use if the downloaded audio file contains no album cover. Provided thumbnail dimensions are approximate -//@audio File containing the audio -audio#a3769600 duration:int32 title:string performer:string file_name:string mime_type:string album_cover_minithumbnail:minithumbnail album_cover_thumbnail:thumbnail external_album_covers:vector audio:file = Audio; - -//@description Describes a document of any type -//@file_name Original name of the file; as defined by the sender -//@mime_type MIME type of the file; as defined by the sender -//@minithumbnail Document minithumbnail; may be null -//@thumbnail Document thumbnail in JPEG or PNG format (PNG will be used only for background patterns); as defined by the sender; may be null -//@document File containing the document -document#af19afd8 file_name:string mime_type:string minithumbnail:minithumbnail thumbnail:thumbnail document:file = Document; - -//@description Describes a photo -//@has_stickers True, if stickers were added to the photo. The list of corresponding sticker sets can be received using getAttachedStickerSets -//@minithumbnail Photo minithumbnail; may be null -//@sizes Available variants of the photo, in different sizes -photo#105a0689 has_stickers:Bool minithumbnail:minithumbnail sizes:vector = Photo; - -//@description Describes a sticker -//@id Unique sticker identifier within the set; 0 if none -//@set_id Identifier of the sticker set to which the sticker belongs; 0 if none -//@width Sticker width; as defined by the sender -//@height Sticker height; as defined by the sender -//@emoji Emoji corresponding to the sticker -//@format Sticker format -//@full_type Sticker's full type -//@thumbnail Sticker thumbnail in WEBP or JPEG format; may be null -//@sticker File containing the sticker -sticker#d96f5d3f id:int64 set_id:int64 width:int32 height:int32 emoji:string format:StickerFormat full_type:StickerFullType thumbnail:thumbnail sticker:file = Sticker; - -//@description Describes a video file -//@duration Duration of the video, in seconds; as defined by the sender -//@width Video width; as defined by the sender -//@height Video height; as defined by the sender -//@file_name Original name of the file; as defined by the sender -//@mime_type MIME type of the file; as defined by the sender -//@has_stickers True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets -//@supports_streaming True, if the video is expected to be streamed -//@minithumbnail Video minithumbnail; may be null -//@thumbnail Video thumbnail in JPEG or MPEG4 format; as defined by the sender; may be null -//@video File containing the video -video#31a460cc duration:int32 width:int32 height:int32 file_name:string mime_type:string has_stickers:Bool supports_streaming:Bool minithumbnail:minithumbnail thumbnail:thumbnail video:file = Video; - -//@description Describes a video note. The video must be equal in width and height, cropped to a circle, and stored in MPEG4 format -//@duration Duration of the video, in seconds; as defined by the sender -//@waveform A waveform representation of the video note's audio in 5-bit format; may be empty if unknown -//@length Video width and height; as defined by the sender -//@minithumbnail Video minithumbnail; may be null -//@thumbnail Video thumbnail in JPEG format; as defined by the sender; may be null -//@speech_recognition_result Result of speech recognition in the video note; may be null -//@video File containing the video -videoNote#7ae918c5 duration:int32 waveform:bytes length:int32 minithumbnail:minithumbnail thumbnail:thumbnail speech_recognition_result:SpeechRecognitionResult video:file = VideoNote; - -//@description Describes a voice note -//@duration Duration of the voice note, in seconds; as defined by the sender -//@waveform A waveform representation of the voice note in 5-bit format -//@mime_type MIME type of the file; as defined by the sender. Usually, one of "audio/ogg" for Opus in an OGG container, "audio/mpeg" for an MP3 audio, or "audio/mp4" for an M4A audio -//@speech_recognition_result Result of speech recognition in the voice note; may be null -//@voice File containing the voice note -voiceNote#b9f24cf5 duration:int32 waveform:bytes mime_type:string speech_recognition_result:SpeechRecognitionResult voice:file = VoiceNote; - -//@description Describes an animated or custom representation of an emoji -//@sticker Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker is a custom emoji, then it can have arbitrary format -//@sticker_width Expected width of the sticker, which can be used if the sticker is null -//@sticker_height Expected height of the sticker, which can be used if the sticker is null -//@fitzpatrick_type Emoji modifier fitzpatrick type; 0-6; 0 if none -//@sound File containing the sound to be played when the sticker is clicked; may be null. The sound is encoded with the Opus codec, and stored inside an OGG container -animatedEmoji#52309ebf sticker:sticker sticker_width:int32 sticker_height:int32 fitzpatrick_type:int32 sound:file = AnimatedEmoji; - -//@description Describes a user contact -//@phone_number Phone number of the user -//@first_name First name of the user; 1-255 characters in length -//@last_name Last name of the user -//@vcard Additional data about the user in a form of vCard; 0-2048 bytes in length -//@user_id Identifier of the user, if known; 0 otherwise -contact#89285774 phone_number:string first_name:string last_name:string vcard:string user_id:int53 = Contact; - -//@description Describes a location on planet Earth -//@latitude Latitude of the location in degrees; as defined by the sender -//@longitude Longitude of the location, in degrees; as defined by the sender -//@horizontal_accuracy The estimated horizontal accuracy of the location, in meters; as defined by the sender. 0 if unknown -location#e5925f73 latitude:double longitude:double horizontal_accuracy:double = Location; - -//@description Describes a venue -//@location Venue location; as defined by the sender -//@title Venue name; as defined by the sender -//@address Venue address; as defined by the sender -//@provider Provider of the venue database; as defined by the sender. Currently, only "foursquare" and "gplaces" (Google Places) need to be supported -//@id Identifier of the venue in the provider database; as defined by the sender -//@type Type of the venue in the provider database; as defined by the sender -venue#3fcd1af9 location:location title:string address:string provider:string id:string type:string = Venue; - -//@description Describes a game. Use getInternalLink with internalLinkTypeGame to share the game -//@id Unique game identifier -//@short_name Game short name -//@title Game title -//@text Game text, usually containing scoreboards for a game -//@param_description Game description -//@photo Game photo -//@animation Game animation; may be null -game#a2aedfc8 id:int64 short_name:string title:string text:formattedText description:string photo:photo animation:animation = Game; - -//@description Describes a Web App. Use getInternalLink with internalLinkTypeWebApp to share the Web App -//@short_name Web App short name -//@title Web App title -//@param_description Web App description -//@photo Web App photo -//@animation Web App animation; may be null -webApp#605ba8f3 short_name:string title:string description:string photo:photo animation:animation = WebApp; - -//@description Describes a poll -//@id Unique poll identifier -//@question Poll question; 1-300 characters. Only custom emoji entities are allowed -//@options List of poll answer options -//@total_voter_count Total number of voters, participating in the poll -//@recent_voter_ids Identifiers of recent voters, if the poll is non-anonymous -//@is_anonymous True, if the poll is anonymous -//@type Type of the poll -//@open_period Amount of time the poll will be active after creation, in seconds -//@close_date Point in time (Unix timestamp) when the poll will automatically be closed -//@is_closed True, if the poll is closed -poll#71d4870c id:int64 question:formattedText options:vector total_voter_count:int32 recent_voter_ids:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = Poll; - -//@description Describes an alternative re-encoded quality of a video file -//@width Video width -//@height Video height -//@codec Codec used for video file encoding, for example, "h264", "h265", or "av1" -//@hls_file HLS file describing the video -//@video File containing the video -alternativeVideo#bfda3bb3 width:int32 height:int32 codec:string hls_file:file video:file = AlternativeVideo; - -//@description Describes a chat background -//@id Unique background identifier -//@is_default True, if this is one of default backgrounds -//@is_dark True, if the background is dark and is recommended to be used with dark theme -//@name Unique background name -//@document Document with the background; may be null. Null only for filled and chat theme backgrounds -//@type Type of the background -background#e65f291c id:int64 is_default:Bool is_dark:Bool name:string document:document type:BackgroundType = Background; - -//@description Contains a list of backgrounds -//@backgrounds A list of backgrounds -backgrounds#b4671319 backgrounds:vector = Backgrounds; - -//@description Describes a background set for a specific chat -//@background The background -//@dark_theme_dimming Dimming of the background in dark themes, as a percentage; 0-100. Applied only to Wallpaper and Fill types of background -chatBackground#62891968 background:background dark_theme_dimming:int32 = ChatBackground; - -//@description Describes a user profile photo -//@id Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of user profile photos -//@small A small (160x160) user profile photo. The file can be downloaded only before the photo is changed -//@big A big (640x640) user profile photo. The file can be downloaded only before the photo is changed -//@minithumbnail User profile photo minithumbnail; may be null -//@has_animation True, if the photo has animated variant -//@is_personal True, if the photo is visible only for the current user -profilePhoto#c2dc3c5e id:int64 small:file big:file minithumbnail:minithumbnail has_animation:Bool is_personal:Bool = ProfilePhoto; - -//@description Contains basic information about the photo of a chat -//@small A small (160x160) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed -//@big A big (640x640) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed -//@minithumbnail Chat photo minithumbnail; may be null -//@has_animation True, if the photo has animated variant -//@is_personal True, if the photo is visible only for the current user -chatPhotoInfo#10c2b4a6 small:file big:file minithumbnail:minithumbnail has_animation:Bool is_personal:Bool = ChatPhotoInfo; - -//@class UserType @description Represents the type of user. The following types are possible: regular users, deleted users and bots - -//@description A regular user -userTypeRegular#dc51699b = UserType; - -//@description A deleted user or deleted bot. No information on the user besides the user identifier is available. It is not possible to perform any active actions on this type of user -userTypeDeleted#94403d24 = UserType; - -//@description A bot (see https://core.telegram.org/bots) -//@can_be_edited True, if the bot is owned by the current user and can be edited using the methods toggleBotUsernameIsActive, reorderBotActiveUsernames, setBotProfilePhoto, setBotName, setBotInfoDescription, and setBotInfoShortDescription -//@can_join_groups True, if the bot can be invited to basic group and supergroup chats -//@can_read_all_group_messages True, if the bot can read all messages in basic group or supergroup chats and not just those addressed to the bot. In private and channel chats a bot can always read all messages -//@has_main_web_app True, if the bot has the main Web App -//@is_inline True, if the bot supports inline queries -//@inline_query_placeholder Placeholder for inline queries (displayed on the application input field) -//@need_location True, if the location of the user is expected to be sent with every inline query to this bot -//@can_connect_to_business True, if the bot supports connection to Telegram Business accounts -//@can_be_added_to_attachment_menu True, if the bot can be added to attachment or side menu -//@active_user_count The number of recently active users of the bot -userTypeBot#8ba3cc26 can_be_edited:Bool can_join_groups:Bool can_read_all_group_messages:Bool has_main_web_app:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool can_connect_to_business:Bool can_be_added_to_attachment_menu:Bool active_user_count:int32 = UserType; - -//@description No information on the user besides the user identifier is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type -userTypeUnknown#d4d0613d = UserType; - -//@description Represents a command supported by a bot -//@command Text of the bot command -//@param_description Description of the bot command -botCommand#c27ac8c7 command:string description:string = BotCommand; - -//@description Contains a list of bot commands -//@bot_user_id Bot's user identifier -//@commands List of bot commands -botCommands#4f9aa2c5 bot_user_id:int53 commands:vector = BotCommands; - -//@description Describes a button to be shown instead of bot commands menu button -//@text Text of the button -//@url URL of a Web App to open when the button is pressed. If the link is of the type internalLinkTypeWebApp, then it must be processed accordingly. Otherwise, the link must be passed to openWebApp -botMenuButton#c7b57ce6 text:string url:string = BotMenuButton; - -//@description Describes parameters of verification that is provided by a bot -//@icon_custom_emoji_id Identifier of the custom emoji that is used as the verification sign -//@organization_name Name of the organization that provides verification -//@default_custom_description Default custom description of verification reason to be used as placeholder in setMessageSenderBotVerification; may be null if none -//@can_set_custom_description True, if the bot is allowed to provide custom description for verified entities -botVerificationParameters#d4dca55f icon_custom_emoji_id:int64 organization_name:string default_custom_description:formattedText can_set_custom_description:Bool = BotVerificationParameters; - -//@description Describes verification status provided by a bot -//@bot_user_id Identifier of the bot that provided the verification -//@icon_custom_emoji_id Identifier of the custom emoji that is used as the verification sign -//@custom_description Custom description of verification reason set by the bot -botVerification#b160b6f2 bot_user_id:int53 icon_custom_emoji_id:int64 custom_description:formattedText = BotVerification; - -//@description Contains information about verification status of a chat or a user -//@is_verified True, if the chat or the user is verified by Telegram -//@is_scam True, if the chat or the user is marked as scam by Telegram -//@is_fake True, if the chat or the user is marked as fake by Telegram -//@bot_verification_icon_custom_emoji_id Identifier of the custom emoji to be shown as verification sign provided by a bot for the user; 0 if none -verificationStatus#3ae6a18c is_verified:Bool is_scam:Bool is_fake:Bool bot_verification_icon_custom_emoji_id:int64 = VerificationStatus; - -//@description Represents a location to which a chat is connected -//@location The location -//@address Location address; 1-64 characters, as defined by the chat owner -chatLocation#a29b8f21 location:location address:string = ChatLocation; - -//@description Represents a birthdate of a user -//@day Day of the month; 1-31 -//@month Month of the year; 1-12 -//@year Birth year; 0 if unknown -birthdate#61fe6d1e day:int32 month:int32 year:int32 = Birthdate; - -//@description Describes a user that had or will have a birthday soon -//@user_id User identifier -//@birthdate Birthdate of the user -closeBirthdayUser#800659ee user_id:int53 birthdate:birthdate = CloseBirthdayUser; - -//@class BusinessAwayMessageSchedule @description Describes conditions for sending of away messages by a Telegram Business account - -//@description Send away messages always -businessAwayMessageScheduleAlways#c9b9e2b9 = BusinessAwayMessageSchedule; - -//@description Send away messages outside of the business opening hours -businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 = BusinessAwayMessageSchedule; - -//@description Send away messages only in the specified time span -//@start_date Point in time (Unix timestamp) when the away messages will start to be sent -//@end_date Point in time (Unix timestamp) when the away messages will stop to be sent -businessAwayMessageScheduleCustom#8ac04dd2 start_date:int32 end_date:int32 = BusinessAwayMessageSchedule; - -//@description Represents a location of a business -//@location The location; may be null if not specified -//@address Location address; 1-96 characters -businessLocation#bf54af5a location:location address:string = BusinessLocation; - -//@description Describes private chats chosen for automatic interaction with a business -//@chat_ids Identifiers of selected private chats -//@excluded_chat_ids Identifiers of private chats that are always excluded; for businessConnectedBot only -//@select_existing_chats True, if all existing private chats are selected -//@select_new_chats True, if all new private chats are selected -//@select_contacts True, if all private chats with contacts are selected -//@select_non_contacts True, if all private chats with non-contacts are selected -//@exclude_selected If true, then all private chats except the selected are chosen. Otherwise, only the selected chats are chosen -businessRecipients#802011e2 chat_ids:vector excluded_chat_ids:vector select_existing_chats:Bool select_new_chats:Bool select_contacts:Bool select_non_contacts:Bool exclude_selected:Bool = BusinessRecipients; - -//@description Describes settings for messages that are automatically sent by a Telegram Business account when it is away -//@shortcut_id Unique quick reply shortcut identifier for the away messages -//@recipients Chosen recipients of the away messages -//@schedule Settings used to check whether the current user is away -//@offline_only True, if the messages must not be sent if the account was online in the last 10 minutes -businessAwayMessageSettings#150ba2e9 shortcut_id:int32 recipients:businessRecipients schedule:BusinessAwayMessageSchedule offline_only:Bool = BusinessAwayMessageSettings; - -//@description Describes settings for greeting messages that are automatically sent by a Telegram Business account as response to incoming messages in an inactive private chat -//@shortcut_id Unique quick reply shortcut identifier for the greeting messages -//@recipients Chosen recipients of the greeting messages -//@inactivity_days The number of days after which a chat will be considered as inactive; currently, must be on of 7, 14, 21, or 28 -businessGreetingMessageSettings#64ae3e12 shortcut_id:int32 recipients:businessRecipients inactivity_days:int32 = BusinessGreetingMessageSettings; - -//@description Describes a bot connected to a business account -//@bot_user_id User identifier of the bot -//@recipients Private chats that will be accessible to the bot -//@can_reply True, if the bot can send messages to the private chats; false otherwise -businessConnectedBot#ec50ead7 bot_user_id:int53 recipients:businessRecipients can_reply:Bool = BusinessConnectedBot; - -//@description Describes settings for a business account start page -//@title Title text of the start page -//@message Message text of the start page -//@sticker Greeting sticker of the start page; may be null if none -businessStartPage#9fa2f7cf title:string message:string sticker:sticker = BusinessStartPage; - -//@description Describes settings for a business account start page to set -//@title Title text of the start page; 0-getOption("business_start_page_title_length_max") characters -//@message Message text of the start page; 0-getOption("business_start_page_message_length_max") characters -//@sticker Greeting sticker of the start page; pass null if none. The sticker must belong to a sticker set and must not be a custom emoji -inputBusinessStartPage#ec7c87e0 title:string message:string sticker:InputFile = InputBusinessStartPage; - -//@description Describes an interval of time when the business is open -//@start_minute The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0-7*24*60 -//@end_minute The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 1-8*24*60 -businessOpeningHoursInterval#bdf05654 start_minute:int32 end_minute:int32 = BusinessOpeningHoursInterval; - -//@description Describes opening hours of a business -//@time_zone_id Unique time zone identifier -//@opening_hours Intervals of the time when the business is open -businessOpeningHours#a623e64a time_zone_id:string opening_hours:vector = BusinessOpeningHours; - -//@description Contains information about a Telegram Business account -//@location Location of the business; may be null if none -//@opening_hours Opening hours of the business; may be null if none. The hours are guaranteed to be valid and has already been split by week days -//@local_opening_hours Opening hours of the business in the local time; may be null if none. The hours are guaranteed to be valid and has already been split by week days. -//@next_open_in Time left before the business will open the next time, in seconds; 0 if unknown. An updateUserFullInfo update is not triggered when value of this field changes -//@next_close_in Time left before the business will close the next time, in seconds; 0 if unknown. An updateUserFullInfo update is not triggered when value of this field changes -//@greeting_message_settings The greeting message; may be null if none or the Business account is not of the current user -//@away_message_settings The away message; may be null if none or the Business account is not of the current user -//@start_page Information about start page of the account; may be null if none -businessInfo#5520498e location:businessLocation opening_hours:businessOpeningHours local_opening_hours:businessOpeningHours next_open_in:int32 next_close_in:int32 greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings start_page:businessStartPage = BusinessInfo; - -//@description Contains information about a business chat link -//@link The HTTPS link -//@text Message draft text that will be added to the input field -//@title Link title -//@view_count Number of times the link was used -businessChatLink#8e998b83 link:string text:formattedText title:string view_count:int32 = BusinessChatLink; - -//@description Contains a list of business chat links created by the user -//@links List of links -businessChatLinks#1569924 links:vector = BusinessChatLinks; - -//@description Describes a business chat link to create or edit -//@text Message draft text that will be added to the input field -//@title Link title -inputBusinessChatLink#e2d6df8 text:formattedText title:string = InputBusinessChatLink; - -//@description Contains information about a business chat link -//@chat_id Identifier of the private chat that created the link -//@text Message draft text that must be added to the input field -businessChatLinkInfo#cc7334af chat_id:int53 text:formattedText = BusinessChatLinkInfo; - -//@class ChatPhotoStickerType @description Describes type of sticker, which was used to create a chat photo - -//@description Information about the sticker, which was used to create the chat photo -//@sticker_set_id Sticker set identifier -//@sticker_id Identifier of the sticker in the set -chatPhotoStickerTypeRegularOrMask#e741599c sticker_set_id:int64 sticker_id:int64 = ChatPhotoStickerType; - -//@description Information about the custom emoji, which was used to create the chat photo -//@custom_emoji_id Identifier of the custom emoji -chatPhotoStickerTypeCustomEmoji#f021bad1 custom_emoji_id:int64 = ChatPhotoStickerType; - -//@description Information about the sticker, which was used to create the chat photo. The sticker is shown at the center of the photo and occupies at most 67% of it -//@type Type of the sticker -//@background_fill The fill to be used as background for the sticker; rotation angle in backgroundFillGradient isn't supported -chatPhotoSticker#a90383a3 type:ChatPhotoStickerType background_fill:BackgroundFill = ChatPhotoSticker; - -//@description Animated variant of a chat photo in MPEG4 format -//@length Animation width and height -//@file Information about the animation file -//@main_frame_timestamp Timestamp of the frame, used as a static chat photo -animatedChatPhoto#b719c2e length:int32 file:file main_frame_timestamp:double = AnimatedChatPhoto; - -//@description Describes a chat or user profile photo -//@id Unique photo identifier -//@added_date Point in time (Unix timestamp) when the photo has been added -//@minithumbnail Photo minithumbnail; may be null -//@sizes Available variants of the photo in JPEG format, in different size -//@animation A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null -//@small_animation A small (160x160) animated variant of the photo in MPEG4 format; may be null even the big animation is available -//@sticker Sticker-based version of the chat photo; may be null -chatPhoto#96e90714 id:int64 added_date:int32 minithumbnail:minithumbnail sizes:vector animation:animatedChatPhoto small_animation:animatedChatPhoto sticker:chatPhotoSticker = ChatPhoto; - -//@description Contains a list of chat or user profile photos -//@total_count Total number of photos -//@photos List of photos -chatPhotos#89ec34e8 total_count:int32 photos:vector = ChatPhotos; - -//@class InputChatPhoto @description Describes a photo to be set as a user profile or chat photo - -//@description A previously used profile photo of the current user -//@chat_photo_id Identifier of the current user's profile photo to reuse -inputChatPhotoPrevious#160e9d1 chat_photo_id:int64 = InputChatPhoto; - -//@description A static photo in JPEG format -//@photo Photo to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed -inputChatPhotoStatic#75f7e2b3 photo:InputFile = InputChatPhoto; - -//@description An animation in MPEG4 format; must be square, at most 10 seconds long, have width between 160 and 1280 and be at most 2MB in size -//@animation Animation to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed -//@main_frame_timestamp Timestamp of the frame, which will be used as static chat photo -inputChatPhotoAnimation#56a3422 animation:InputFile main_frame_timestamp:double = InputChatPhoto; - -//@description A sticker on a custom background -//@sticker Information about the sticker -inputChatPhotoSticker#4e6e735d sticker:chatPhotoSticker = InputChatPhoto; - -//@description Describes actions that a user is allowed to take in a chat -//@can_send_basic_messages True, if the user can send text messages, contacts, giveaways, giveaway winners, invoices, locations, and venues -//@can_send_audios True, if the user can send music files -//@can_send_documents True, if the user can send documents -//@can_send_photos True, if the user can send photos -//@can_send_videos True, if the user can send videos -//@can_send_video_notes True, if the user can send video notes -//@can_send_voice_notes True, if the user can send voice notes -//@can_send_polls True, if the user can send polls -//@can_send_other_messages True, if the user can send animations, games, stickers, and dice and use inline bots -//@can_add_link_previews True, if the user may add a link preview to their messages -//@can_change_info True, if the user can change the chat title, photo, and other settings -//@can_invite_users True, if the user can invite new users to the chat -//@can_pin_messages True, if the user can pin messages -//@can_create_topics True, if the user can create topics -chatPermissions#f8f25a79 can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_other_messages:Bool can_add_link_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_create_topics:Bool = ChatPermissions; - -//@description Describes rights of the administrator -//@can_manage_chat True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only -//@can_change_info True, if the administrator can change the chat title, photo, and other settings -//@can_post_messages True, if the administrator can create channel posts or view channel statistics; applicable to channels only -//@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only -//@can_delete_messages True, if the administrator can delete messages of other users -//@can_invite_users True, if the administrator can invite new users to the chat -//@can_restrict_members True, if the administrator can restrict, ban, or unban chat members or view supergroup statistics; always true for channels -//@can_pin_messages True, if the administrator can pin messages; applicable to basic groups and supergroups only -//@can_manage_topics True, if the administrator can create, rename, close, reopen, hide, and unhide forum topics; applicable to forum supergroups only -//@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them -//@can_manage_video_chats True, if the administrator can manage video chats -//@can_post_stories True, if the administrator can create new chat stories, or edit and delete posted stories; applicable to supergroups and channels only -//@can_edit_stories True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access story archive; applicable to supergroups and channels only -//@can_delete_stories True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only -//@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only -chatAdministratorRights#5f4f9044 can_manage_chat:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_manage_topics:Bool can_promote_members:Bool can_manage_video_chats:Bool can_post_stories:Bool can_edit_stories:Bool can_delete_stories:Bool is_anonymous:Bool = ChatAdministratorRights; - -//@description Describes a possibly non-integer amount of Telegram Stars -//@star_count The integer amount of Telegram Stars rounded to 0 -//@nanostar_count The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999 -starAmount#6f0e6d80 star_count:int53 nanostar_count:int32 = StarAmount; - -//@class StarSubscriptionType @description Describes type of subscription paid in Telegram Stars - -//@description Describes a subscription to a channel chat -//@can_reuse True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again -//@invite_link The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore -starSubscriptionTypeChannel#c29ab6f5 can_reuse:Bool invite_link:string = StarSubscriptionType; - -//@description Describes a subscription in a bot or a business account -//@is_canceled_by_bot True, if the subscription was canceled by the bot and can't be extended -//@title Subscription invoice title -//@photo Subscription invoice photo -//@invoice_link The link to the subscription invoice -starSubscriptionTypeBot#d78ddd2 is_canceled_by_bot:Bool title:string photo:photo invoice_link:string = StarSubscriptionType; - -//@description Describes subscription plan paid in Telegram Stars -//@period The number of seconds between consecutive Telegram Star debiting -//@star_count The amount of Telegram Stars that must be paid for each period -starSubscriptionPricing#96a28856 period:int32 star_count:int53 = StarSubscriptionPricing; - -//@description Contains information about subscription to a channel chat, a bot, or a business account that was paid in Telegram Stars -//@id Unique identifier of the subscription -//@chat_id Identifier of the chat that is subscribed -//@expiration_date Point in time (Unix timestamp) when the subscription will expire or expired -//@is_canceled True, if the subscription was canceled -//@is_expiring True, if the subscription expires soon and there are no enough Telegram Stars on the user's balance to extend it -//@pricing The subscription plan -//@type Type of the subscription -starSubscription#3a3811f5 id:string chat_id:int53 expiration_date:int32 is_canceled:Bool is_expiring:Bool pricing:starSubscriptionPricing type:StarSubscriptionType = StarSubscription; - -//@description Represents a list of Telegram Star subscriptions -//@star_amount The amount of owned Telegram Stars -//@subscriptions List of subscriptions for Telegram Stars -//@required_star_count The number of Telegram Stars required to buy to extend subscriptions expiring soon -//@next_offset The offset for the next request. If empty, then there are no more results -starSubscriptions#a2f27c8d star_amount:starAmount subscriptions:vector required_star_count:int53 next_offset:string = StarSubscriptions; - -//@class AffiliateType @description Describes type of affiliate for an affiliate program - -//@description The affiliate is the current user -affiliateTypeCurrentUser#56a701f5 = AffiliateType; - -//@description The affiliate is a bot owned by the current user -//@user_id User identifier of the bot -affiliateTypeBot#c273f840 user_id:int53 = AffiliateType; - -//@description The affiliate is a channel chat where the current user has can_post_messages administrator right -//@chat_id Identifier of the channel chat -affiliateTypeChannel#d73be869 chat_id:int53 = AffiliateType; - -//@class AffiliateProgramSortOrder @description Describes the order of the found affiliate programs - -//@description The affiliate programs must be sorted by the profitability -affiliateProgramSortOrderProfitability#8afaaf67 = AffiliateProgramSortOrder; - -//@description The affiliate programs must be sorted by creation date -affiliateProgramSortOrderCreationDate#a319390d = AffiliateProgramSortOrder; - -//@description The affiliate programs must be sorted by the expected revenue -affiliateProgramSortOrderRevenue#72a2c2b8 = AffiliateProgramSortOrder; - -//@description Describes parameters of an affiliate program -//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner; -//@month_count Number of months the program will be active; 0-36. If 0, then the program is eternal -affiliateProgramParameters#61e90c54 commission_per_mille:int32 month_count:int32 = AffiliateProgramParameters; - -//@description Contains information about an active affiliate program -//@parameters Parameters of the affiliate program -//@end_date Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the affiliate program isn't scheduled to be closed. -//@daily_revenue_per_user_amount The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program -affiliateProgramInfo#96fce8b5 parameters:affiliateProgramParameters end_date:int32 daily_revenue_per_user_amount:starAmount = AffiliateProgramInfo; - -//@description Contains information about an affiliate that received commission from a Telegram Star transaction -//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner -//@affiliate_chat_id Identifier of the chat which received the commission -//@star_amount The amount of Telegram Stars that were received by the affiliate; can be negative for refunds -affiliateInfo#b1c1dcfa commission_per_mille:int32 affiliate_chat_id:int53 star_amount:starAmount = AffiliateInfo; - -//@description Describes a found affiliate program -//@bot_user_id User identifier of the bot created the program -//@info Information about the affiliate program -foundAffiliateProgram#c6636286 bot_user_id:int53 info:affiliateProgramInfo = FoundAffiliateProgram; - -//@description Represents a list of found affiliate programs -//@total_count The total number of found affiliate programs -//@programs The list of affiliate programs -//@next_offset The offset for the next request. If empty, then there are no more results -foundAffiliatePrograms#b6228108 total_count:int32 programs:vector next_offset:string = FoundAffiliatePrograms; - -//@description Describes an affiliate program that was connected to an affiliate -//@url The link that can be used to refer users if the program is still active -//@bot_user_id User identifier of the bot created the program -//@parameters The parameters of the affiliate program -//@connection_date Point in time (Unix timestamp) when the affiliate program was connected -//@is_disconnected True, if the program was canceled by the bot, or disconnected by the chat owner and isn't available anymore -//@user_count The number of users that used the affiliate program -//@revenue_star_count The number of Telegram Stars that were earned by the affiliate program -connectedAffiliateProgram#58bf7415 url:string bot_user_id:int53 parameters:affiliateProgramParameters connection_date:int32 is_disconnected:Bool user_count:int64 revenue_star_count:int64 = ConnectedAffiliateProgram; - -//@description Represents a list of affiliate programs that were connected to an affiliate -//@total_count The total number of affiliate programs that were connected to the affiliate -//@programs The list of connected affiliate programs -//@next_offset The offset for the next request. If empty, then there are no more results -connectedAffiliatePrograms#59231e33 total_count:int32 programs:vector next_offset:string = ConnectedAffiliatePrograms; - -//@description Contains information about a product that can be paid with invoice -//@title Product title -//@param_description Product description -//@photo Product photo; may be null -productInfo#87e47ca4 title:string description:formattedText photo:photo = ProductInfo; - -//@description Describes an option for buying Telegram Premium to a user -//@currency ISO 4217 currency code for Telegram Premium subscription payment -//@amount The amount to pay, in the smallest units of the currency -//@discount_percentage The discount associated with this option, as a percentage -//@month_count Number of months the Telegram Premium subscription will be active. Use getPremiumInfoSticker to get the sticker to be used as representation of the Telegram Premium subscription -//@store_product_id Identifier of the store product associated with the option -//@payment_link An internal link to be opened for buying Telegram Premium to the user if store payment isn't possible; may be null if direct payment isn't available -premiumPaymentOption#8c0c5fb2 currency:string amount:int53 discount_percentage:int32 month_count:int32 store_product_id:string payment_link:InternalLinkType = PremiumPaymentOption; - -//@description Describes an option for buying or upgrading Telegram Premium for self -//@payment_option Information about the payment option -//@is_current True, if this is the currently used Telegram Premium subscription option -//@is_upgrade True, if the payment option can be used to upgrade the existing Telegram Premium subscription -//@last_transaction_id Identifier of the last in-store transaction for the currently used option -premiumStatePaymentOption#7d06b579 payment_option:premiumPaymentOption is_current:Bool is_upgrade:Bool last_transaction_id:string = PremiumStatePaymentOption; - -//@description Describes an option for creating Telegram Premium gift codes or Telegram Premium giveaway. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments -//@currency ISO 4217 currency code for Telegram Premium gift code payment -//@amount The amount to pay, in the smallest units of the currency -//@discount_percentage The discount associated with this option, as a percentage -//@winner_count Number of users which will be able to activate the gift codes -//@month_count Number of months the Telegram Premium subscription will be active -//@store_product_id Identifier of the store product associated with the option; may be empty if none -//@store_product_quantity Number of times the store product must be paid -//@sticker A sticker to be shown along with the gift code; may be null if unknown -premiumGiftCodePaymentOption#d89959ed currency:string amount:int53 discount_percentage:int32 winner_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 sticker:sticker = PremiumGiftCodePaymentOption; - -//@description Contains a list of options for creating Telegram Premium gift codes or Telegram Premium giveaway -//@options The list of options -premiumGiftCodePaymentOptions#97a8cf2e options:vector = PremiumGiftCodePaymentOptions; - -//@description Contains information about a Telegram Premium gift code -//@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown. If null and the code is from messagePremiumGiftCode message, then creator_id from the message can be used -//@creation_date Point in time (Unix timestamp) when the code was created -//@is_from_giveaway True, if the gift code was created for a giveaway -//@giveaway_message_id Identifier of the corresponding giveaway message in the creator_id chat; can be 0 or an identifier of a deleted message -//@month_count Number of months the Telegram Premium subscription will be active after code activation -//@user_id Identifier of a user for which the code was created; 0 if none -//@use_date Point in time (Unix timestamp) when the code was activated; 0 if none -premiumGiftCodeInfo#b88fa8de creator_id:MessageSender creation_date:int32 is_from_giveaway:Bool giveaway_message_id:int53 month_count:int32 user_id:int53 use_date:int32 = PremiumGiftCodeInfo; - -//@description Describes an option for buying Telegram Stars. Use telegramPaymentPurposeStars for out-of-store payments -//@currency ISO 4217 currency code for the payment -//@amount The amount to pay, in the smallest units of the currency -//@star_count Number of Telegram Stars that will be purchased -//@store_product_id Identifier of the store product associated with the option; may be empty if none -//@is_additional True, if the option must be shown only in the full list of payment options -starPaymentOption#aeb22811 currency:string amount:int53 star_count:int53 store_product_id:string is_additional:Bool = StarPaymentOption; - -//@description Contains a list of options for buying Telegram Stars -//@options The list of options -starPaymentOptions#77c3bbad options:vector = StarPaymentOptions; - -//@description Describes an option for the number of winners of a Telegram Star giveaway -//@winner_count The number of users that will be chosen as winners -//@won_star_count The number of Telegram Stars that will be won by the winners of the giveaway -//@is_default True, if the option must be chosen by default -starGiveawayWinnerOption#cc639607 winner_count:int32 won_star_count:int53 is_default:Bool = StarGiveawayWinnerOption; - -//@description Describes an option for creating Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments -//@currency ISO 4217 currency code for the payment -//@amount The amount to pay, in the smallest units of the currency -//@star_count Number of Telegram Stars that will be distributed among winners -//@store_product_id Identifier of the store product associated with the option; may be empty if none -//@yearly_boost_count Number of times the chat will be boosted for one year if the option is chosen -//@winner_options Allowed options for the number of giveaway winners -//@is_default True, if the option must be chosen by default -//@is_additional True, if the option must be shown only in the full list of payment options -starGiveawayPaymentOption#bca2d5e5 currency:string amount:int53 star_count:int53 store_product_id:string yearly_boost_count:int32 winner_options:vector is_default:Bool is_additional:Bool = StarGiveawayPaymentOption; - -//@description Contains a list of options for creating Telegram Star giveaway -//@options The list of options -starGiveawayPaymentOptions#909fbf18 options:vector = StarGiveawayPaymentOptions; - -//@description Describes a model of an upgraded gift -//@name Name of the model -//@sticker The sticker representing the upgraded gift -//@rarity_per_mille The number of upgraded gift that receive this model for each 1000 gifts upgraded -upgradedGiftModel#5112584f name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftModel; - -//@description Describes a symbol shown on the pattern of an upgraded gift -//@name Name of the symbol -//@sticker The sticker representing the upgraded gift -//@rarity_per_mille The number of upgraded gift that receive this symbol for each 1000 gifts upgraded -upgradedGiftSymbol#4340c5af name:string sticker:sticker rarity_per_mille:int32 = UpgradedGiftSymbol; - -//@description Describes a backdrop of an upgraded gift -//@name Name of the backdrop -//@center_color A color in the center of the backdrop in the RGB format -//@edge_color A color on the edges of the backdrop in the RGB format -//@symbol_color A color to be applied for the symbol in the RGB format -//@text_color A color for the text on the backdrop in the RGB format -//@rarity_per_mille The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded -upgradedGiftBackdrop#fc371c7e name:string center_color:int32 edge_color:int32 symbol_color:int32 text_color:int32 rarity_per_mille:int32 = UpgradedGiftBackdrop; - -//@description Describes the original details about the gift -//@sender_user_id Identifier of the user that sent the gift; 0 if the gift was private -//@receiver_user_id Identifier of the user that received the gift -//@text Message added to the gift -//@date Point in time (Unix timestamp) when the gift was sent -upgradedGiftOriginalDetails#44d2b2dd sender_user_id:int53 receiver_user_id:int53 text:formattedText date:int32 = UpgradedGiftOriginalDetails; - -//@description Describes a gift that can be sent to another user -//@id Unique identifier of the gift -//@sticker The sticker representing the gift -//@star_count Number of Telegram Stars that must be paid for the gift -//@default_sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed -//@upgrade_star_count Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible -//@is_for_birthday True, if the gift is a birthday gift -//@remaining_count Number of remaining times the gift can be purchased by all users; 0 if not limited or the gift was sold out -//@total_count Number of total times the gift can be purchased by all users; 0 if not limited -//@first_send_date Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only -//@last_send_date Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only -gift#7cf9442d id:int64 sticker:sticker star_count:int53 default_sell_star_count:int53 upgrade_star_count:int53 is_for_birthday:Bool remaining_count:int32 total_count:int32 first_send_date:int32 last_send_date:int32 = Gift; - -//@description Contains a list of gifts that can be sent to another user -//@gifts The list of gifts -gifts#7ea494b8 gifts:vector = Gifts; - -//@description Describes an upgraded gift that can be gifted to another user or transferred to TON blockchain as an NFT -//@id Unique identifier of the gift -//@title The title of the upgraded gift -//@number Unique number of the upgraded gift among gifts upgraded from the same gift -//@total_upgraded_count Total number of gifts that were upgraded from the same gift -//@max_upgraded_count The maximum number of gifts that can be upgraded from the same gift -//@owner_user_id User identifier of the user that owns the upgraded gift; 0 if none -//@model Model of the upgraded gift -//@symbol Symbol of the upgraded gift -//@backdrop Backdrop of the upgraded gift -//@original_details Information about the originally sent gift; may be null if unknown -upgradedGift#e5f50e98 id:int64 title:string number:int32 total_upgraded_count:int32 max_upgraded_count:int32 owner_user_id:int53 model:upgradedGiftModel symbol:upgradedGiftSymbol backdrop:upgradedGiftBackdrop original_details:upgradedGiftOriginalDetails = UpgradedGift; - -//@description Contains result of gift upgrading -//@gift The upgraded gift -//@is_saved True, if the gift is displayed on the user's profile page -//@can_be_transferred True, if the gift can be transferred to another user -//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT -upgradeGiftResult#3d9e8331 gift:upgradedGift is_saved:Bool can_be_transferred:Bool transfer_star_count:int53 export_date:int32 = UpgradeGiftResult; - -//@class SentGift @description Represents a gift received by a user - -//@description Regular gift -//@gift The gift -sentGiftRegular#2368ad19 gift:gift = SentGift; - -//@description Upgraded gift -//@gift The gift -sentGiftUpgraded#25674480 gift:upgradedGift = SentGift; - -//@description Represents a gift received by a user -//@sender_user_id Identifier of the user that sent the gift; 0 if unknown -//@text Message added to the gift -//@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them -//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift -//@can_be_upgraded True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift -//@can_be_transferred True, if the gift is an upgraded gift that can be transferred to another user; only for the receiver of the gift -//@was_refunded True, if the gift was refunded and isn't available anymore -//@date Point in time (Unix timestamp) when the gift was sent -//@gift The gift -//@message_id Identifier of the message with the gift in the chat with the sender of the gift; can be 0 or an identifier of a deleted message; only for the receiver of the gift -//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user -//@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift -//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the upgraded gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -userGift#a39db860 sender_user_id:int53 text:formattedText is_private:Bool is_saved:Bool can_be_upgraded:Bool can_be_transferred:Bool was_refunded:Bool date:int32 gift:SentGift message_id:int53 sell_star_count:int53 prepaid_upgrade_star_count:int53 transfer_star_count:int53 export_date:int32 = UserGift; - -//@description Represents a list of gifts received by a user -//@total_count The total number of received gifts -//@gifts The list of gifts -//@next_offset The offset for the next request. If empty, then there are no more results -userGifts#e274219f total_count:int32 gifts:vector next_offset:string = UserGifts; - -//@description Contains examples of possible upgraded gifts for the given regular gift -//@models Examples of possible models that can be chosen for the gift after upgrade -//@symbols Examples of possible symbols that can be chosen for the gift after upgrade -//@backdrops Examples of possible backdrops that can be chosen for the gift after upgrade -giftUpgradePreview#4319deef models:vector symbols:vector backdrops:vector = GiftUpgradePreview; - -//@class StarTransactionDirection @description Describes direction of a transaction with Telegram Stars - -//@description The transaction is incoming and increases the number of owned Telegram Stars -starTransactionDirectionIncoming#b2cabe46 = StarTransactionDirection; - -//@description The transaction is outgoing and decreases the number of owned Telegram Stars -starTransactionDirectionOutgoing#6e83b5a0 = StarTransactionDirection; - -//@class StarTransactionType @description Describes type of transaction with Telegram Stars - -//@description The transaction is a deposit of Telegram Stars from the Premium bot; for regular users only -starTransactionTypePremiumBotDeposit#d879090e = StarTransactionType; - -//@description The transaction is a deposit of Telegram Stars from App Store; for regular users only -starTransactionTypeAppStoreDeposit#8283941 = StarTransactionType; - -//@description The transaction is a deposit of Telegram Stars from Google Play; for regular users only -starTransactionTypeGooglePlayDeposit#ecbdb656 = StarTransactionType; - -//@description The transaction is a deposit of Telegram Stars from Fragment; for regular users and bots only -starTransactionTypeFragmentDeposit#7625e44 = StarTransactionType; - -//@description The transaction is a deposit of Telegram Stars by another user; for regular users only -//@user_id Identifier of the user that gifted Telegram Stars; 0 if the user was anonymous -//@sticker The sticker to be shown in the transaction information; may be null if unknown -starTransactionTypeUserDeposit#c2a18e9 user_id:int53 sticker:sticker = StarTransactionType; - -//@description The transaction is a deposit of Telegram Stars from a giveaway; for regular users only -//@chat_id Identifier of a supergroup or a channel chat that created the giveaway -//@giveaway_message_id Identifier of the message with the giveaway; can be 0 or an identifier of a deleted message -starTransactionTypeGiveawayDeposit#b16200c6 chat_id:int53 giveaway_message_id:int53 = StarTransactionType; - -//@description The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only -//@withdrawal_state State of the withdrawal; may be null for refunds from Fragment -starTransactionTypeFragmentWithdrawal#af3a2992 withdrawal_state:RevenueWithdrawalState = StarTransactionType; - -//@description The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; for bots and channel chats only -starTransactionTypeTelegramAdsWithdrawal#a58e8469 = StarTransactionType; - -//@description The transaction is a payment for Telegram API usage; for bots only -//@request_count The number of billed requests -starTransactionTypeTelegramApiUsage#27a82afe request_count:int32 = StarTransactionType; - -//@description The transaction is a purchase of paid media from a bot or a business account by the current user; for regular users only -//@user_id Identifier of the bot or the business account user that sent the paid media -//@media The bought media if the transaction wasn't refunded -starTransactionTypeBotPaidMediaPurchase#7f48cc6a user_id:int53 media:vector = StarTransactionType; - -//@description The transaction is a sale of paid media by the bot or a business account managed by the bot; for bots only -//@user_id Identifier of the user that bought the media -//@media The bought media -//@payload Bot-provided payload -//@affiliate Information about the affiliate which received commission from the transaction; may be null if none -starTransactionTypeBotPaidMediaSale#6e07eeb2 user_id:int53 media:vector payload:string affiliate:affiliateInfo = StarTransactionType; - -//@description The transaction is a purchase of paid media from a channel by the current user; for regular users only -//@chat_id Identifier of the channel chat that sent the paid media -//@message_id Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message -//@media The bought media if the transaction wasn't refunded -starTransactionTypeChannelPaidMediaPurchase#9016d4f5 chat_id:int53 message_id:int53 media:vector = StarTransactionType; - -//@description The transaction is a sale of paid media by the channel chat; for channel chats only -//@user_id Identifier of the user that bought the media -//@message_id Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message -//@media The bought media -starTransactionTypeChannelPaidMediaSale#eace92ef user_id:int53 message_id:int53 media:vector = StarTransactionType; - -//@description The transaction is a purchase of a product from a bot or a business account by the current user; for regular users only -//@user_id Identifier of the bot or the business account user that created the invoice -//@product_info Information about the bought product -starTransactionTypeBotInvoicePurchase#1dddac0c user_id:int53 product_info:productInfo = StarTransactionType; - -//@description The transaction is a sale of a product by the bot; for bots only -//@user_id Identifier of the user that bought the product -//@product_info Information about the bought product -//@invoice_payload Invoice payload -//@affiliate Information about the affiliate which received commission from the transaction; may be null if none -starTransactionTypeBotInvoiceSale#5b7d8d2f user_id:int53 product_info:productInfo invoice_payload:bytes affiliate:affiliateInfo = StarTransactionType; - -//@description The transaction is a purchase of a subscription from a bot or a business account by the current user; for regular users only -//@user_id Identifier of the bot or the business account user that created the subscription link -//@subscription_period The number of seconds between consecutive Telegram Star debitings -//@product_info Information about the bought subscription -starTransactionTypeBotSubscriptionPurchase#40bf1355 user_id:int53 subscription_period:int32 product_info:productInfo = StarTransactionType; - -//@description The transaction is a sale of a subscription by the bot; for bots only -//@user_id Identifier of the user that bought the subscription -//@subscription_period The number of seconds between consecutive Telegram Star debitings -//@product_info Information about the bought subscription -//@invoice_payload Invoice payload -//@affiliate Information about the affiliate which received commission from the transaction; may be null if none -starTransactionTypeBotSubscriptionSale#1f686889 user_id:int53 subscription_period:int32 product_info:productInfo invoice_payload:bytes affiliate:affiliateInfo = StarTransactionType; - -//@description The transaction is a purchase of a subscription to a channel chat by the current user; for regular users only -//@chat_id Identifier of the channel chat that created the subscription -//@subscription_period The number of seconds between consecutive Telegram Star debitings -starTransactionTypeChannelSubscriptionPurchase#380eb3d1 chat_id:int53 subscription_period:int32 = StarTransactionType; - -//@description The transaction is a sale of a subscription by the channel chat; for channel chats only -//@user_id Identifier of the user that bought the subscription -//@subscription_period The number of seconds between consecutive Telegram Star debitings -starTransactionTypeChannelSubscriptionSale#fe127c82 user_id:int53 subscription_period:int32 = StarTransactionType; - -//@description The transaction is a purchase of a regular gift to another user; for regular users and bots only -//@user_id Identifier of the user that received the gift -//@gift The gift -starTransactionTypeGiftPurchase#ef5f1d52 user_id:int53 gift:gift = StarTransactionType; - -//@description The transaction is a transfer of an upgraded gift to another user; for regular users only -//@user_id Identifier of the user that received the gift -//@gift The gift -starTransactionTypeGiftTransfer#ef323c55 user_id:int53 gift:upgradedGift = StarTransactionType; - -//@description The transaction is a sale of a gift received from another user or bot; for regular users only -//@user_id Identifier of the user that sent the gift -//@gift The gift -starTransactionTypeGiftSale#64d61157 user_id:int53 gift:gift = StarTransactionType; - -//@description The transaction is an upgrade of a gift; for regular users only -//@gift The upgraded gift -starTransactionTypeGiftUpgrade#2697844b gift:upgradedGift = StarTransactionType; - -//@description The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only -//@chat_id Identifier of the channel chat -//@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message -starTransactionTypeChannelPaidReactionSend#c02667c0 chat_id:int53 message_id:int53 = StarTransactionType; - -//@description The transaction is a receiving of a paid reaction to a message by the channel chat; for channel chats only -//@user_id Identifier of the user that added the paid reaction -//@message_id Identifier of the reacted message; can be 0 or an identifier of a deleted message -starTransactionTypeChannelPaidReactionReceive#23d6f9eb user_id:int53 message_id:int53 = StarTransactionType; - -//@description The transaction is a receiving of a commission from an affiliate program; for regular users, bots and channel chats only -//@chat_id Identifier of the chat that created the affiliate program -//@commission_per_mille The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner -starTransactionTypeAffiliateProgramCommission#9a637573 chat_id:int53 commission_per_mille:int32 = StarTransactionType; - -//@description The transaction is a transaction of an unsupported type -starTransactionTypeUnsupported#76cfcab2 = StarTransactionType; - -//@description Represents a transaction changing the amount of owned Telegram Stars -//@id Unique identifier of the transaction -//@star_amount The amount of added owned Telegram Stars; negative for outgoing transactions -//@is_refund True, if the transaction is a refund of a previous transaction -//@date Point in time (Unix timestamp) when the transaction was completed -//@type Type of the transaction -starTransaction#7f820a90 id:string star_amount:starAmount is_refund:Bool date:int32 type:StarTransactionType = StarTransaction; - -//@description Represents a list of Telegram Star transactions -//@star_amount The amount of owned Telegram Stars -//@transactions List of transactions with Telegram Stars -//@next_offset The offset for the next request. If empty, then there are no more results -starTransactions#b5f5820b star_amount:starAmount transactions:vector next_offset:string = StarTransactions; - -//@class GiveawayParticipantStatus @description Contains information about status of a user in a giveaway - -//@description The user is eligible for the giveaway -giveawayParticipantStatusEligible#122ade97 = GiveawayParticipantStatus; - -//@description The user participates in the giveaway -giveawayParticipantStatusParticipating#1d53e36f = GiveawayParticipantStatus; - -//@description The user can't participate in the giveaway, because they have already been member of the chat -//@joined_chat_date Point in time (Unix timestamp) when the user joined the chat -giveawayParticipantStatusAlreadyWasMember#11f9b5a0 joined_chat_date:int32 = GiveawayParticipantStatus; - -//@description The user can't participate in the giveaway, because they are an administrator in one of the chats that created the giveaway -//@chat_id Identifier of the chat administered by the user -giveawayParticipantStatusAdministrator#c84b3a75 chat_id:int53 = GiveawayParticipantStatus; - -//@description The user can't participate in the giveaway, because they phone number is from a disallowed country -//@user_country_code A two-letter ISO 3166-1 alpha-2 country code of the user's country -giveawayParticipantStatusDisallowedCountry#700b645b user_country_code:string = GiveawayParticipantStatus; - -//@class GiveawayInfo @description Contains information about a giveaway - -//@description Describes an ongoing giveaway -//@creation_date Point in time (Unix timestamp) when the giveaway was created -//@status Status of the current user in the giveaway -//@is_ended True, if the giveaway has ended and results are being prepared -giveawayInfoOngoing#624ee050 creation_date:int32 status:GiveawayParticipantStatus is_ended:Bool = GiveawayInfo; - -//@description Describes a completed giveaway -//@creation_date Point in time (Unix timestamp) when the giveaway was created -//@actual_winners_selection_date Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway -//@was_refunded True, if the giveaway was canceled and was fully refunded -//@is_winner True, if the current user is a winner of the giveaway -//@winner_count Number of winners in the giveaway -//@activation_count Number of winners, which activated their gift codes; for Telegram Premium giveaways only -//@gift_code Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Premium giveaway -//@won_star_count The amount of Telegram Stars won by the current user; 0 if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Star giveaway -giveawayInfoCompleted#328cc35c creation_date:int32 actual_winners_selection_date:int32 was_refunded:Bool is_winner:Bool winner_count:int32 activation_count:int32 gift_code:string won_star_count:int53 = GiveawayInfo; - -//@class GiveawayPrize @description Contains information about a giveaway prize - -//@description The giveaway sends Telegram Premium subscriptions to the winners -//@month_count Number of months the Telegram Premium subscription will be active after code activation -giveawayPrizePremium#1b12e978 month_count:int32 = GiveawayPrize; - -//@description The giveaway sends Telegram Stars to the winners -//@star_count Number of Telegram Stars that will be shared by all winners -giveawayPrizeStars#954c1fa4 star_count:int53 = GiveawayPrize; - -//@description Contains information about supported accent color for user/chat name, background of empty chat photo, replies to messages and link previews -//@id Accent color identifier -//@built_in_accent_color_id Identifier of a built-in color to use in places, where only one color is needed; 0-6 -//@light_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes -//@dark_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes -//@min_channel_chat_boost_level The minimum chat boost level required to use the color in a channel chat -accentColor#53312690 id:int32 built_in_accent_color_id:int32 light_theme_colors:vector dark_theme_colors:vector min_channel_chat_boost_level:int32 = AccentColor; - -//@description Contains information about supported accent colors for user profile photo background in RGB format -//@palette_colors The list of 1-2 colors in RGB format, describing the colors, as expected to be shown in the color palette settings -//@background_colors The list of 1-2 colors in RGB format, describing the colors, as expected to be used for the profile photo background -//@story_colors The list of 2 colors in RGB format, describing the colors of the gradient to be used for the unread active story indicator around profile photo -profileAccentColors#218e9367 palette_colors:vector background_colors:vector story_colors:vector = ProfileAccentColors; - -//@description Contains information about supported accent color for user profile photo background -//@id Profile accent color identifier -//@light_theme_colors Accent colors expected to be used in light themes -//@dark_theme_colors Accent colors expected to be used in dark themes -//@min_supergroup_chat_boost_level The minimum chat boost level required to use the color in a supergroup chat -//@min_channel_chat_boost_level The minimum chat boost level required to use the color in a channel chat -profileAccentColor#213d8295 id:int32 light_theme_colors:profileAccentColors dark_theme_colors:profileAccentColors min_supergroup_chat_boost_level:int32 min_channel_chat_boost_level:int32 = ProfileAccentColor; - -//@description Describes a custom emoji to be shown instead of the Telegram Premium badge -//@custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format -//@expiration_date Point in time (Unix timestamp) when the status will expire; 0 if never -emojiStatus#dbd91636 custom_emoji_id:int64 expiration_date:int32 = EmojiStatus; - -//@description Contains a list of custom emoji identifiers for emoji statuses -//@custom_emoji_ids The list of custom emoji identifiers -emojiStatuses#eaeb9bdc custom_emoji_ids:vector = EmojiStatuses; - -//@description Describes usernames assigned to a user, a supergroup, or a channel -//@active_usernames List of active usernames; the first one must be shown as the primary username. The order of active usernames can be changed with reorderActiveUsernames, reorderBotActiveUsernames or reorderSupergroupActiveUsernames -//@disabled_usernames List of currently disabled usernames; the username can be activated with toggleUsernameIsActive, toggleBotUsernameIsActive, or toggleSupergroupUsernameIsActive -//@editable_username The active username, which can be changed with setUsername or setSupergroupUsername. Information about other active usernames can be received using getCollectibleItemInfo -usernames#bf343063 active_usernames:vector disabled_usernames:vector editable_username:string = Usernames; - -//@description Represents a user -//@id User identifier -//@first_name First name of the user -//@last_name Last name of the user -//@usernames Usernames of the user; may be null -//@phone_number Phone number of the user -//@status Current online status of the user -//@profile_photo Profile photo of the user; may be null -//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none -//@profile_accent_color_id Identifier of the accent color for the user's profile; -1 if none -//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the user's profile; 0 if none -//@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null -//@is_contact The user is a contact of the current user -//@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user -//@is_close_friend The user is a close friend of the current user; implies that the user is a contact -//@verification_status Information about verification status of the user; may be null if none -//@is_premium True, if the user is a Telegram Premium user -//@is_support True, if the user is Telegram support account -//@restriction_reason If non-empty, it contains a human-readable description of the reason why access to this user must be restricted -//@has_active_stories True, if the user has non-expired stories available to the current user -//@has_unread_active_stories True, if the user has unread non-expired stories available to the current user -//@restricts_new_chats True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them -//@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method -//@type Type of the user -//@language_code IETF language tag of the user's language; only available to bots -//@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user#598c3933 id:int53 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool verification_status:verificationStatus is_premium:Bool is_support:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; - -//@description Contains information about a bot -//@short_description The text that is shown on the bot's profile page and is sent together with the link when users share the bot -//@param_description The text shown in the chat with the bot if the chat is empty -//@photo Photo shown in the chat with the bot if the chat is empty; may be null -//@animation Animation shown in the chat with the bot if the chat is empty; may be null -//@menu_button Information about a button to show instead of the bot commands menu button; may be null if ordinary bot commands menu must be shown -//@commands List of the bot commands -//@privacy_policy_url The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened -//@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; may be null -//@default_channel_administrator_rights Default administrator rights for adding the bot to channels; may be null -//@affiliate_program Information about the affiliate program of the bot; may be null if none -//@web_app_background_light_color Default light background color for bot Web Apps; -1 if not specified -//@web_app_background_dark_color Default dark background color for bot Web Apps; -1 if not specified -//@web_app_header_light_color Default light header color for bot Web Apps; -1 if not specified -//@web_app_header_dark_color Default dark header color for bot Web Apps; -1 if not specified -//@verification_parameters Parameters of the verification that can be provided by the bot; may be null if none or the current user isn't the owner of the bot -//@can_get_revenue_statistics True, if the bot's revenue statistics are available to the current user -//@can_manage_emoji_status True, if the bot can manage emoji status of the current user -//@has_media_previews True, if the bot has media previews -//@edit_commands_link The internal link, which can be used to edit bot commands; may be null -//@edit_description_link The internal link, which can be used to edit bot description; may be null -//@edit_description_media_link The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null -//@edit_settings_link The internal link, which can be used to edit bot settings; may be null -botInfo#d16edb85 short_description:string description:string photo:photo animation:animation menu_button:botMenuButton commands:vector privacy_policy_url:string default_group_administrator_rights:chatAdministratorRights default_channel_administrator_rights:chatAdministratorRights affiliate_program:affiliateProgramInfo web_app_background_light_color:int32 web_app_background_dark_color:int32 web_app_header_light_color:int32 web_app_header_dark_color:int32 verification_parameters:botVerificationParameters can_get_revenue_statistics:Bool can_manage_emoji_status:Bool has_media_previews:Bool edit_commands_link:InternalLinkType edit_description_link:InternalLinkType edit_description_media_link:InternalLinkType edit_settings_link:InternalLinkType = BotInfo; - -//@description Contains full information about a user -//@personal_photo User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. -//@photo User profile photo; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. -//@public_photo User profile photo visible if the main photo is hidden by privacy settings; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. -//@block_list Block list to which the user is added; may be null if none -//@can_be_called True, if the user can be called -//@supports_video_calls True, if a video call can be created with the user -//@has_private_calls True, if the user can't be called due to their privacy settings -//@has_private_forwards True, if the user can't be linked in forwarded messages due to their privacy settings -//@has_restricted_voice_and_video_note_messages True, if voice and video notes can't be sent or forwarded to the user -//@has_posted_to_profile_stories True, if the user has posted to profile stories -//@has_sponsored_messages_enabled True, if the user always enabled sponsored messages; known only for the current user -//@need_phone_number_privacy_exception True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used -//@set_chat_background True, if the user set chat background for both chat users and it wasn't reverted yet -//@bio A short user bio; may be null for bots -//@birthdate Birthdate of the user; may be null if unknown -//@personal_chat_id Identifier of the personal chat of the user; 0 if none -//@gift_count Number of gifts saved to profile by the user -//@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user -//@bot_verification Information about verification status of the user provided by a bot; may be null if none or unknown -//@business_info Information about business settings for Telegram Business accounts; may be null if none -//@bot_info For bots, information about the bot; may be null if the user isn't a bot -userFullInfo#ae9201c2 personal_photo:chatPhoto photo:chatPhoto public_photo:chatPhoto block_list:BlockList can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool has_posted_to_profile_stories:Bool has_sponsored_messages_enabled:Bool need_phone_number_privacy_exception:Bool set_chat_background:Bool bio:formattedText birthdate:birthdate personal_chat_id:int53 gift_count:int32 group_in_common_count:int32 bot_verification:botVerification business_info:businessInfo bot_info:botInfo = UserFullInfo; - -//@description Represents a list of users -//@total_count Approximate total number of users found -//@user_ids A list of user identifiers -users#9d955a12 total_count:int32 user_ids:vector = Users; - -//@description Represents a list of found users -//@user_ids Identifiers of the found users -//@next_offset The offset for the next request. If empty, then there are no more results -foundUsers#c531e854 user_ids:vector next_offset:string = FoundUsers; - -//@description Contains information about a chat administrator -//@user_id User identifier of the administrator -//@custom_title Custom title of the administrator -//@is_owner True, if the user is the owner of the chat -chatAdministrator#7277bd2c user_id:int53 custom_title:string is_owner:Bool = ChatAdministrator; - -//@description Represents a list of chat administrators -//@administrators A list of chat administrators -chatAdministrators#5141ca21 administrators:vector = ChatAdministrators; - -//@class ChatMemberStatus @description Provides information about the status of a member in a chat - -//@description The user is the owner of the chat and has all the administrator privileges -//@custom_title A custom title of the owner; 0-16 characters without emoji; applicable to supergroups only -//@is_anonymous True, if the creator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only -//@is_member True, if the user is a member of the chat -chatMemberStatusCreator#f6764afe custom_title:string is_anonymous:Bool is_member:Bool = ChatMemberStatus; - -//@description The user is a member of the chat and has some additional privileges. In basic groups, administrators can edit and delete messages sent by others, add new members, ban unprivileged members, and manage video chats. -//@custom_title A custom title of the administrator; 0-16 characters without emoji; applicable to supergroups only -//@can_be_edited True, if the current user can edit the administrator privileges for the called user -//@rights Rights of the administrator -chatMemberStatusAdministrator#fbd3841d custom_title:string can_be_edited:Bool rights:chatAdministratorRights = ChatMemberStatus; - -//@description The user is a member of the chat, without any additional privileges or restrictions -//@member_until_date Point in time (Unix timestamp) when the user will be removed from the chat because of the expired subscription; 0 if never. Ignored in setChatMemberStatus -chatMemberStatusMember#fe0cec16 member_until_date:int32 = ChatMemberStatus; - -//@description The user is under certain restrictions in the chat. Not supported in basic groups and channels -//@is_member True, if the user is a member of the chat -//@restricted_until_date Point in time (Unix timestamp) when restrictions will be lifted from the user; 0 if never. If the user is restricted for more than 366 days or for less than 30 seconds from the current time, the user is considered to be restricted forever -//@permissions User permissions in the chat -chatMemberStatusRestricted#630774a6 is_member:Bool restricted_until_date:int32 permissions:chatPermissions = ChatMemberStatus; - -//@description The user or the chat is not a chat member -chatMemberStatusLeft#ffa74425 = ChatMemberStatus; - -//@description The user or the chat was banned (and hence is not a member of the chat). Implies the user can't return to the chat, view messages, or be used as a participant identifier to join a video chat of the chat -//@banned_until_date Point in time (Unix timestamp) when the user will be unbanned; 0 if never. If the user is banned for more than 366 days or for less than 30 seconds from the current time, the user is considered to be banned forever. Always 0 in basic groups -chatMemberStatusBanned#9d714eb6 banned_until_date:int32 = ChatMemberStatus; - -//@description Describes a user or a chat as a member of another chat -//@member_id Identifier of the chat member. Currently, other chats can be only Left or Banned. Only supergroups and channels can have other chats as Left or Banned members and these chats must be supergroups or channels -//@inviter_user_id Identifier of a user that invited/promoted/banned this member in the chat; 0 if unknown -//@joined_chat_date Point in time (Unix timestamp) when the user joined/was promoted/was banned in the chat -//@status Status of the member in the chat -chatMember#6d12e175 member_id:MessageSender inviter_user_id:int53 joined_chat_date:int32 status:ChatMemberStatus = ChatMember; - -//@description Contains a list of chat members -//@total_count Approximate total number of chat members found -//@members A list of chat members -chatMembers#8ecbb24 total_count:int32 members:vector = ChatMembers; - -//@class ChatMembersFilter @description Specifies the kind of chat members to return in searchChatMembers - -//@description Returns contacts of the user -chatMembersFilterContacts#69c480a7 = ChatMembersFilter; - -//@description Returns the owner and administrators -chatMembersFilterAdministrators#b47cbc1c = ChatMembersFilter; - -//@description Returns all chat members, including restricted chat members -chatMembersFilterMembers#27f71596 = ChatMembersFilter; - -//@description Returns users which can be mentioned in the chat -//@message_thread_id If non-zero, the identifier of the current message thread -chatMembersFilterMention#330bedf7 message_thread_id:int53 = ChatMembersFilter; - -//@description Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup -chatMembersFilterRestricted#4ae15abd = ChatMembersFilter; - -//@description Returns users banned from the chat; can be used only by administrators in a supergroup or in a channel -chatMembersFilterBanned#90f34f48 = ChatMembersFilter; - -//@description Returns bot members of the chat -chatMembersFilterBots#ab355888 = ChatMembersFilter; - -//@class SupergroupMembersFilter @description Specifies the kind of chat members to return in getSupergroupMembers - -//@description Returns recently active users in reverse chronological order -supergroupMembersFilterRecent#4639e5d5 = SupergroupMembersFilter; - -//@description Returns contacts of the user, which are members of the supergroup or channel -//@query Query to search for -supergroupMembersFilterContacts#b3885578 query:string = SupergroupMembersFilter; - -//@description Returns the owner and administrators -supergroupMembersFilterAdministrators#82fc8457 = SupergroupMembersFilter; - -//@description Used to search for supergroup or channel members via a (string) query -//@query Query to search for -supergroupMembersFilterSearch#9ae39fbb query:string = SupergroupMembersFilter; - -//@description Returns restricted supergroup members; can be used only by administrators -//@query Query to search for -supergroupMembersFilterRestricted#bdf8501e query:string = SupergroupMembersFilter; - -//@description Returns users banned from the supergroup or channel; can be used only by administrators -//@query Query to search for -supergroupMembersFilterBanned#b7d7610d query:string = SupergroupMembersFilter; - -//@description Returns users which can be mentioned in the supergroup -//@query Query to search for -//@message_thread_id If non-zero, the identifier of the current message thread -supergroupMembersFilterMention#3880091c query:string message_thread_id:int53 = SupergroupMembersFilter; - -//@description Returns bot members of the supergroup or channel -supergroupMembersFilterBots#1d5571a6 = SupergroupMembersFilter; - -//@description Contains a chat invite link -//@invite_link Chat invite link -//@name Name of the link -//@creator_user_id User identifier of an administrator created the link -//@date Point in time (Unix timestamp) when the link was created -//@edit_date Point in time (Unix timestamp) when the link was last edited; 0 if never or unknown -//@expiration_date Point in time (Unix timestamp) when the link will expire; 0 if never -//@subscription_pricing Information about subscription plan that is applied to the users joining the chat by the link; may be null if the link doesn't require subscription -//@member_limit The maximum number of members, which can join the chat using the link simultaneously; 0 if not limited. Always 0 if the link requires approval -//@member_count Number of chat members, which joined the chat using the link -//@expired_member_count Number of chat members, which joined the chat using the link, but have already left because of expired subscription; for subscription links only -//@pending_join_request_count Number of pending join requests created using this link -//@creates_join_request True, if the link only creates join request. If true, total number of joining members will be unlimited -//@is_primary True, if the link is primary. Primary invite link can't have name, expiration date, or usage limit. There is exactly one primary invite link for each administrator with can_invite_users right at a given time -//@is_revoked True, if the link was revoked -chatInviteLink#c6eb6530 invite_link:string name:string creator_user_id:int53 date:int32 edit_date:int32 expiration_date:int32 subscription_pricing:starSubscriptionPricing member_limit:int32 member_count:int32 expired_member_count:int32 pending_join_request_count:int32 creates_join_request:Bool is_primary:Bool is_revoked:Bool = ChatInviteLink; - -//@description Contains a list of chat invite links -//@total_count Approximate total number of chat invite links found -//@invite_links List of invite links -chatInviteLinks#9b1eddfa total_count:int32 invite_links:vector = ChatInviteLinks; - -//@description Describes a chat administrator with a number of active and revoked chat invite links -//@user_id Administrator's user identifier -//@invite_link_count Number of active invite links -//@revoked_invite_link_count Number of revoked invite links -chatInviteLinkCount#c3158796 user_id:int53 invite_link_count:int32 revoked_invite_link_count:int32 = ChatInviteLinkCount; - -//@description Contains a list of chat invite link counts -//@invite_link_counts List of invite link counts -chatInviteLinkCounts#c953d7f8 invite_link_counts:vector = ChatInviteLinkCounts; - -//@description Describes a chat member joined a chat via an invite link -//@user_id User identifier -//@joined_chat_date Point in time (Unix timestamp) when the user joined the chat -//@via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder -//@approver_user_id User identifier of the chat administrator, approved user join request -chatInviteLinkMember#1bce5bb user_id:int53 joined_chat_date:int32 via_chat_folder_invite_link:Bool approver_user_id:int53 = ChatInviteLinkMember; - -//@description Contains a list of chat members joined a chat via an invite link -//@total_count Approximate total number of chat members found -//@members List of chat members, joined a chat via an invite link -chatInviteLinkMembers#c2ca3a61 total_count:int32 members:vector = ChatInviteLinkMembers; - -//@class InviteLinkChatType @description Describes the type of chat to which points an invite link - -//@description The link is an invite link for a basic group -inviteLinkChatTypeBasicGroup#4d43c5ee = InviteLinkChatType; - -//@description The link is an invite link for a supergroup -inviteLinkChatTypeSupergroup#3de86758 = InviteLinkChatType; - -//@description The link is an invite link for a channel -inviteLinkChatTypeChannel#3012ef0b = InviteLinkChatType; - -//@description Contains information about subscription plan that must be paid by the user to use a chat invite link -//@pricing Information about subscription plan that must be paid by the user to use the link -//@can_reuse True, if the user has already paid for the subscription and can use joinChatByInviteLink to join the subscribed chat again -//@form_id Identifier of the payment form to use for subscription payment; 0 if the subscription can't be paid -chatInviteLinkSubscriptionInfo#38cf7368 pricing:starSubscriptionPricing can_reuse:Bool form_id:int64 = ChatInviteLinkSubscriptionInfo; - -//@description Contains information about a chat invite link -//@chat_id Chat identifier of the invite link; 0 if the user has no access to the chat before joining -//@accessible_for If non-zero, the amount of time for which read access to the chat will remain available, in seconds -//@type Type of the chat -//@title Title of the chat -//@photo Chat photo; may be null -//@accent_color_id Identifier of the accent color for chat title and background of chat photo -//@param_description Chat description -//@member_count Number of members in the chat -//@member_user_ids User identifiers of some chat members that may be known to the current user -//@subscription_info Information about subscription plan that must be paid by the user to use the link; may be null if the link doesn't require subscription -//@creates_join_request True, if the link only creates join request -//@is_public True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup -//@verification_status Information about verification status of the chat; may be null if none -chatInviteLinkInfo#c3fe73a chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector subscription_info:chatInviteLinkSubscriptionInfo creates_join_request:Bool is_public:Bool verification_status:verificationStatus = ChatInviteLinkInfo; - -//@description Describes a user that sent a join request and waits for administrator approval -//@user_id User identifier -//@date Point in time (Unix timestamp) when the user sent the join request -//@bio A short bio of the user -chatJoinRequest#3897a68 user_id:int53 date:int32 bio:string = ChatJoinRequest; - -//@description Contains a list of requests to join a chat -//@total_count Approximate total number of requests found -//@requests List of the requests -chatJoinRequests#b2c5fd31 total_count:int32 requests:vector = ChatJoinRequests; - -//@description Contains information about pending join requests for a chat -//@total_count Total number of pending join requests -//@user_ids Identifiers of at most 3 users sent the newest pending join requests -chatJoinRequestsInfo#6aff5df5 total_count:int32 user_ids:vector = ChatJoinRequestsInfo; - -//@description Represents a basic group of 0-200 users (must be upgraded to a supergroup to accommodate more than 200 users) -//@id Group identifier -//@member_count Number of members in the group -//@status Status of the current user in the group -//@is_active True, if the group is active -//@upgraded_to_supergroup_id Identifier of the supergroup to which this group was upgraded; 0 if none -basicGroup#f464168f id:int53 member_count:int32 status:ChatMemberStatus is_active:Bool upgraded_to_supergroup_id:int53 = BasicGroup; - -//@description Contains full information about a basic group -//@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo -//@param_description Group description. Updated only after the basic group is opened -//@creator_user_id User identifier of the creator of the group; 0 if unknown -//@members Group members -//@can_hide_members True, if non-administrators and non-bots can be hidden in responses to getSupergroupMembers and searchChatMembers for non-administrators after upgrading the basic group to a supergroup -//@can_toggle_aggressive_anti_spam True, if aggressive anti-spam checks can be enabled or disabled in the supergroup after upgrading the basic group to a supergroup -//@invite_link Primary invite link for this group; may be null. For chat administrators with can_invite_users right only. Updated only after the basic group is opened -//@bot_commands List of commands of bots in the group -basicGroupFullInfo#d62e521e photo:chatPhoto description:string creator_user_id:int53 members:vector can_hide_members:Bool can_toggle_aggressive_anti_spam:Bool invite_link:chatInviteLink bot_commands:vector = BasicGroupFullInfo; - -//@description Represents a supergroup or channel with zero or more members (subscribers in the case of channels). From the point of view of the system, a channel is a special kind of a supergroup: -//@id Supergroup or channel identifier -//@usernames Usernames of the supergroup or channel; may be null -//@date Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member -//@status Status of the current user in the supergroup or channel; custom title will always be empty -//@member_count Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through -//@boost_level Approximate boost level for the chat -//@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel -//@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup -//@sign_messages True, if messages sent to the channel contains name of the sender. This field is only applicable to channels -//@show_message_sender True, if messages sent to the channel have information about the sender user. This field is only applicable to channels -//@join_to_send_messages True, if users need to join the supergroup before they can send messages. Always true for channels and non-discussion supergroups -//@join_by_request True, if all users directly joining the supergroup need to be approved by supergroup administrators. Always false for channels and supergroups without username, location, or a linked chat -//@is_slow_mode_enabled True, if the slow mode is enabled in the supergroup -//@is_channel True, if the supergroup is a channel -//@is_broadcast_group True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members -//@is_forum True, if the supergroup is a forum with topics -//@verification_status Information about verification status of the supergroup or channel; may be null if none -//@has_sensitive_content True, if content of media messages in the supergroup or channel chat must be hidden with 18+ spoiler -//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted -//@has_active_stories True, if the supergroup or channel has non-expired stories available to the current user -//@has_unread_active_stories True, if the supergroup or channel has unread non-expired stories available to the current user -supergroup#9ebc0c42 id:int53 usernames:usernames date:int32 status:ChatMemberStatus member_count:int32 boost_level:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool show_message_sender:Bool join_to_send_messages:Bool join_by_request:Bool is_slow_mode_enabled:Bool is_channel:Bool is_broadcast_group:Bool is_forum:Bool verification_status:verificationStatus has_sensitive_content:Bool restriction_reason:string has_active_stories:Bool has_unread_active_stories:Bool = Supergroup; - -//@description Contains full information about a supergroup or channel -//@photo Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo -//@param_description Supergroup or channel description -//@member_count Number of members in the supergroup or channel; 0 if unknown -//@administrator_count Number of privileged users in the supergroup or channel; 0 if unknown -//@restricted_count Number of restricted users in the supergroup; 0 if unknown -//@banned_count Number of users banned from chat; 0 if unknown -//@linked_chat_id Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown -//@slow_mode_delay Delay between consecutive sent messages for non-administrator supergroup members, in seconds -//@slow_mode_delay_expires_in Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero -//@can_enable_paid_reaction True, if paid reaction can be enabled in the channel chat; for channels only -//@can_get_members True, if members of the chat can be retrieved via getSupergroupMembers or searchChatMembers -//@has_hidden_members True, if non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers -//@can_hide_members True, if non-administrators and non-bots can be hidden in responses to getSupergroupMembers and searchChatMembers for non-administrators -//@can_set_sticker_set True, if the supergroup sticker set can be changed -//@can_set_location True, if the supergroup location can be changed -//@can_get_statistics True, if the supergroup or channel statistics are available -//@can_get_revenue_statistics True, if the supergroup or channel revenue statistics are available -//@can_get_star_revenue_statistics True, if the supergroup or channel Telegram Star revenue statistics are available -//@can_toggle_aggressive_anti_spam True, if aggressive anti-spam checks can be enabled or disabled in the supergroup -//@is_all_history_available True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available, -//@can_have_sponsored_messages True, if the chat can have sponsored messages. The value of this field is only available to the owner of the chat -//@has_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators -//@has_paid_media_allowed True, if paid media can be sent and forwarded to the channel chat; for channels only -//@has_pinned_stories True, if the supergroup or channel has pinned stories -//@my_boost_count Number of times the current user boosted the supergroup or channel -//@unrestrict_boost_count Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified -//@sticker_set_id Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none -//@custom_emoji_sticker_set_id Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none -//@location Location to which the supergroup is connected; may be null if none -//@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only -//@bot_commands List of commands of bots in the group -//@bot_verification Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown -//@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none -//@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo#f763d79d photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_enable_paid_reaction:Bool can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_get_revenue_statistics:Bool can_get_star_revenue_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool can_have_sponsored_messages:Bool has_aggressive_anti_spam_enabled:Bool has_paid_media_allowed:Bool has_pinned_stories:Bool my_boost_count:int32 unrestrict_boost_count:int32 sticker_set_id:int64 custom_emoji_sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector bot_verification:botVerification upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; - -//@class SecretChatState @description Describes the current secret chat state - -//@description The secret chat is not yet created; waiting for the other user to get online -secretChatStatePending#9e6c967c = SecretChatState; - -//@description The secret chat is ready to use -secretChatStateReady#9ff4b7e9 = SecretChatState; - -//@description The secret chat is closed -secretChatStateClosed#8c1006ed = SecretChatState; - -//@description Represents a secret chat -//@id Secret chat identifier -//@user_id Identifier of the chat partner -//@state State of the secret chat -//@is_outbound True, if the chat was created by the current user; false otherwise -//@key_hash Hash of the currently used key for comparison with the hash of the chat partner's key. This is a string of 36 little-endian bytes, which must be split into groups of 2 bits, each denoting a pixel of one of 4 colors FFFFFF, D5E6F3, 2D5775, and 2F99C9. -//@layer Secret chat layer; determines features supported by the chat partner's application. Nested text entities and underline and strikethrough entities are supported if the layer >= 101, -secretChat#d7a70bcb id:int32 user_id:int53 state:SecretChatState is_outbound:Bool key_hash:bytes layer:int32 = SecretChat; - -//@class MessageSender @description Contains information about the sender of a message - -//@description The message was sent by a known user -//@user_id Identifier of the user that sent the message -messageSenderUser#ebf760e3 user_id:int53 = MessageSender; - -//@description The message was sent on behalf of a chat -//@chat_id Identifier of the chat that sent the message -messageSenderChat#f1b71131 chat_id:int53 = MessageSender; - -//@description Represents a list of message senders -//@total_count Approximate total number of messages senders found -//@senders List of message senders -messageSenders#f6929bcc total_count:int32 senders:vector = MessageSenders; - -//@description Represents a message sender, which can be used to send messages in a chat -//@sender The message sender -//@needs_premium True, if Telegram Premium is needed to use the message sender -chatMessageSender#2d55aeba sender:MessageSender needs_premium:Bool = ChatMessageSender; - -//@description Represents a list of message senders, which can be used to send messages in a chat -//@senders List of available message senders -chatMessageSenders#d80d336 senders:vector = ChatMessageSenders; - -//@class MessageReadDate @description Describes read date of a recent outgoing message in a private chat - -//@description Contains read date of the message -//@read_date Point in time (Unix timestamp) when the message was read by the other user -messageReadDateRead#758d2e30 read_date:int32 = MessageReadDate; - -//@description The message is unread yet -messageReadDateUnread#17b2212c = MessageReadDate; - -//@description The message is too old to get read date -messageReadDateTooOld#b6761e20 = MessageReadDate; - -//@description The read date is unknown due to privacy settings of the other user -messageReadDateUserPrivacyRestricted#b38d9426 = MessageReadDate; - -//@description The read date is unknown due to privacy settings of the current user, but will be known if the user subscribes to Telegram Premium -messageReadDateMyPrivacyRestricted#d6a2d474 = MessageReadDate; - -//@description Represents a viewer of a message -//@user_id User identifier of the viewer -//@view_date Approximate point in time (Unix timestamp) when the message was viewed -messageViewer#56f111cd user_id:int53 view_date:int32 = MessageViewer; - -//@description Represents a list of message viewers -//@viewers List of message viewers -messageViewers#87c73f6c viewers:vector = MessageViewers; - -//@class MessageOrigin @description Contains information about the origin of a message - -//@description The message was originally sent by a known user -//@sender_user_id Identifier of the user that originally sent the message -messageOriginUser#9c009043 sender_user_id:int53 = MessageOrigin; - -//@description The message was originally sent by a user, which is hidden by their privacy settings -//@sender_name Name of the sender -messageOriginHiddenUser#ed0c23da sender_name:string = MessageOrigin; - -//@description The message was originally sent on behalf of a chat -//@sender_chat_id Identifier of the chat that originally sent the message -//@author_signature For messages originally sent by an anonymous chat administrator, original message author signature -messageOriginChat#f3bb5eb4 sender_chat_id:int53 author_signature:string = MessageOrigin; - -//@description The message was originally a post in a channel -//@chat_id Identifier of the channel chat to which the message was originally sent -//@message_id Message identifier of the original message -//@author_signature Original post author signature -messageOriginChannel#a97b51be chat_id:int53 message_id:int53 author_signature:string = MessageOrigin; - -//@description Contains information about the last message from which a new message was forwarded last time -//@chat_id Identifier of the chat to which the message that was forwarded belonged; may be 0 if unknown -//@message_id Identifier of the message; may be 0 if unknown -//@sender_id Identifier of the sender of the message; may be null if unknown or the new message was forwarded not to Saved Messages -//@sender_name Name of the sender of the message if the sender is hidden by their privacy settings -//@date Point in time (Unix timestamp) when the message is sent; 0 if unknown -//@is_outgoing True, if the message that was forwarded is outgoing; always false if sender is unknown -forwardSource#6b02aec9 chat_id:int53 message_id:int53 sender_id:MessageSender sender_name:string date:int32 is_outgoing:Bool = ForwardSource; - -//@class ReactionType @description Describes type of message reaction - -//@description A reaction with an emoji -//@emoji Text representation of the reaction -reactionTypeEmoji#8c3e22c8 emoji:string = ReactionType; - -//@description A reaction with a custom emoji -//@custom_emoji_id Unique identifier of the custom emoji -reactionTypeCustomEmoji#c50b42f3 custom_emoji_id:int64 = ReactionType; - -//@description The paid reaction in a channel chat -reactionTypePaid#1a0152ed = ReactionType; - -//@description Contains information about a user that added paid reactions -//@sender_id Identifier of the user or chat that added the reactions; may be null for anonymous reactors that aren't the current user -//@star_count Number of Telegram Stars added -//@is_top True, if the reactor is one of the most active reactors; may be false if the reactor is the current user -//@is_me True, if the paid reaction was added by the current user -//@is_anonymous True, if the reactor is anonymous -paidReactor#9d379008 sender_id:MessageSender star_count:int32 is_top:Bool is_me:Bool is_anonymous:Bool = PaidReactor; - -//@description Contains information about a forwarded message -//@origin Origin of the forwarded message -//@date Point in time (Unix timestamp) when the message was originally sent -//@source For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, information about the source message from which the message was forwarded last time; may be null for other forwards or if unknown -//@public_service_announcement_type The type of public service announcement for the forwarded message -messageForwardInfo#cb877b7d origin:MessageOrigin date:int32 source:forwardSource public_service_announcement_type:string = MessageForwardInfo; - -//@description Contains information about a message created with importMessages -//@sender_name Name of the original sender -//@date Point in time (Unix timestamp) when the message was originally sent -messageImportInfo#e6dfabcf sender_name:string date:int32 = MessageImportInfo; - -//@description Contains information about replies to a message -//@reply_count Number of times the message was directly or indirectly replied -//@recent_replier_ids Identifiers of at most 3 recent repliers to the message; available in channels with a discussion supergroup. The users and chats are expected to be inaccessible: only their photo and name will be available -//@last_read_inbox_message_id Identifier of the last read incoming reply to the message -//@last_read_outbox_message_id Identifier of the last read outgoing reply to the message -//@last_message_id Identifier of the last reply to the message -messageReplyInfo#69240cb9 reply_count:int32 recent_replier_ids:vector last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 last_message_id:int53 = MessageReplyInfo; - -//@description Contains information about a reaction to a message -//@type Type of the reaction -//@total_count Number of times the reaction was added -//@is_chosen True, if the reaction is chosen by the current user -//@used_sender_id Identifier of the message sender used by the current user to add the reaction; may be null if unknown or the reaction isn't chosen -//@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats -messageReaction#7d9e9864 type:ReactionType total_count:int32 is_chosen:Bool used_sender_id:MessageSender recent_sender_ids:vector = MessageReaction; - -//@description Contains a list of reactions added to a message -//@reactions List of added reactions -//@are_tags True, if the reactions are tags and Telegram Premium users can filter messages by them -//@paid_reactors Information about top users that added the paid reaction -//@can_get_added_reactions True, if the list of added reactions is available using getMessageAddedReactions -messageReactions#9d558cb reactions:vector are_tags:Bool paid_reactors:vector can_get_added_reactions:Bool = MessageReactions; - -//@description Contains information about interactions with a message -//@view_count Number of times the message was viewed -//@forward_count Number of times the message was forwarded -//@reply_info Information about direct or indirect replies to the message; may be null. Currently, available only in channels with a discussion supergroup and discussion supergroups for messages, which are not replies itself -//@reactions The list of reactions or tags added to the message; may be null -messageInteractionInfo#2bbcde05 view_count:int32 forward_count:int32 reply_info:messageReplyInfo reactions:messageReactions = MessageInteractionInfo; - -//@description Contains information about an unread reaction to a message -//@type Type of the reaction -//@sender_id Identifier of the sender, added the reaction -//@is_big True, if the reaction was added with a big animation -unreadReaction#8c5b3b82 type:ReactionType sender_id:MessageSender is_big:Bool = UnreadReaction; - -//@class MessageEffectType @description Describes type of emoji effect - -//@description An effect from an emoji reaction -//@select_animation Select animation for the effect in TGS format -//@effect_animation Effect animation for the effect in TGS format -messageEffectTypeEmojiReaction#68aba63e select_animation:sticker effect_animation:sticker = MessageEffectType; - -//@description An effect from a premium sticker -//@sticker The premium sticker. The effect can be found at sticker.full_type.premium_animation -messageEffectTypePremiumSticker#61962bf9 sticker:sticker = MessageEffectType; - -//@description Contains information about an effect added to a message -//@id Unique identifier of the effect -//@static_icon Static icon for the effect in WEBP format; may be null if none -//@emoji Emoji corresponding to the effect that can be used if static icon isn't available -//@is_premium True, if Telegram Premium subscription is required to use the effect -//@type Type of the effect -messageEffect#972a492f id:int64 static_icon:sticker emoji:string is_premium:Bool type:MessageEffectType = MessageEffect; - -//@class MessageSendingState @description Contains information about the sending state of the message - -//@description The message is being sent now, but has not yet been delivered to the server -//@sending_id Non-persistent message sending identifier, specified by the application -messageSendingStatePending#f32b63b4 sending_id:int32 = MessageSendingState; - -//@description The message failed to be sent -//@error The cause of the message sending failure -//@can_retry True, if the message can be re-sent using resendMessages or readdQuickReplyShortcutMessages -//@need_another_sender True, if the message can be re-sent only on behalf of a different sender -//@need_another_reply_quote True, if the message can be re-sent only if another quote is chosen in the message that is replied by the given message -//@need_drop_reply True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages -//@retry_after Time left before the message can be re-sent, in seconds. No update is sent when this field changes -messageSendingStateFailed#ac81ee5e error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool need_drop_reply:Bool retry_after:double = MessageSendingState; - -//@description Describes manually or automatically chosen quote from another message -//@text Text of the quote. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the text -//@position Approximate quote position in the original message in UTF-16 code units as specified by the message sender -//@is_manual True, if the quote was manually chosen by the message sender -textQuote#8675b8b2 text:formattedText position:int32 is_manual:Bool = TextQuote; - -//@description Describes manually chosen quote from another message -//@text Text of the quote; 0-getOption("message_reply_quote_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be kept and must be kept in the quote -//@position Quote position in the original message in UTF-16 code units -inputTextQuote#b74a6d1c text:formattedText position:int32 = InputTextQuote; - -//@class MessageReplyTo @description Contains information about the message or the story a message is replying to - -//@description Describes a message replied by a given message -//@chat_id The identifier of the chat to which the message belongs; may be 0 if the replied message is in unknown chat -//@message_id The identifier of the message; may be 0 if the replied message is in unknown chat -//@quote Chosen quote from the replied message; may be null if none -//@origin Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat -//@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat -//@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. -messageReplyToMessage#ee105987 chat_id:int53 message_id:int53 quote:textQuote origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; - -//@description Describes a story replied by a given message -//@story_sender_chat_id The identifier of the sender of the story -//@story_id The identifier of the story -messageReplyToStory#708ca939 story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; - -//@class InputMessageReplyTo @description Contains information about the message or the story to be replied - -//@description Describes a message to be replied in the same chat and forum topic -//@message_id The identifier of the message to be replied in the same chat and forum topic. A message can be replied in the same chat and forum topic only if messageProperties.can_be_replied -//@quote Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats -inputMessageReplyToMessage#c25e9903 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; - -//@description Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats -//@chat_id The identifier of the chat to which the message to be replied belongs -//@message_id The identifier of the message to be replied in the specified chat. A message can be replied in another chat or forum topic only if messageProperties.can_be_replied_in_another_chat -//@quote Quote from the message to be replied; pass null if none -inputMessageReplyToExternalMessage#892d232a chat_id:int53 message_id:int53 quote:inputTextQuote = InputMessageReplyTo; - -//@description Describes a story to be replied -//@story_sender_chat_id The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat and channel stories can't be replied -//@story_id The identifier of the story -inputMessageReplyToStory#51aece78 story_sender_chat_id:int53 story_id:int32 = InputMessageReplyTo; - -//@description Describes a fact-check added to the message by an independent checker -//@text Text of the fact-check -//@country_code A two-letter ISO 3166-1 alpha-2 country code of the country for which the fact-check is shown -factCheck#c185f918 text:formattedText country_code:string = FactCheck; - -//@description Describes a message -//@id Message identifier; unique for the chat to which the message belongs -//@sender_id Identifier of the sender of the message -//@chat_id Chat identifier -//@sending_state The sending state of the message; may be null if the message isn't being sent and didn't fail to be sent -//@scheduling_state The scheduling state of the message; may be null if the message isn't scheduled -//@is_outgoing True, if the message is outgoing -//@is_pinned True, if the message is pinned -//@is_from_offline True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message -//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options -//@has_timestamped_media True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message -//@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts -//@is_topic_message True, if the message is a forum topic message -//@contains_unread_mention True, if the message contains an unread mention for the current user -//@date Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages -//@edit_date Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages -//@forward_info Information about the initial message sender; may be null if none or unknown -//@import_info Information about the initial message for messages created with importMessages; may be null if the message isn't imported -//@interaction_info Information about interactions with the message; may be null if none -//@unread_reactions Information about unread reactions added to the message -//@fact_check Information about fact-check added to the message; may be null if none -//@reply_to Information about the message or the story this message is replying to; may be null if none -//@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs -//@saved_messages_topic_id Identifier of the Saved Messages topic for the message; 0 for messages not from Saved Messages -//@self_destruct_type The message's self-destruct type; may be null if none -//@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet -//@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never -//@via_bot_user_id If non-zero, the user identifier of the inline bot through which this message was sent -//@sender_business_bot_user_id If non-zero, the user identifier of the business bot that sent this message -//@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead -//@author_signature For channel posts and anonymous group messages, optional author signature -//@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums -//@effect_id Unique identifier of the effect added to the message; 0 if none -//@has_sensitive_content True, if media content of the message must be hidden with 18+ spoiler -//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted -//@content Content of the message -//@reply_markup Reply markup for the message; may be null if none -message#a9c04bbc id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool is_from_offline:Bool can_be_saved:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector fact_check:factCheck reply_to:MessageReplyTo message_thread_id:int53 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_id:int64 has_sensitive_content:Bool restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; - -//@description Contains a list of messages -//@total_count Approximate total number of messages found -//@messages List of messages; messages may be null -messages#b34c8c60 total_count:int32 messages:vector = Messages; - -//@description Contains a list of messages found by a search -//@total_count Approximate total number of messages found; -1 if unknown -//@messages List of messages -//@next_offset The offset for the next request. If empty, then there are no more results -foundMessages#2515f708 total_count:int32 messages:vector next_offset:string = FoundMessages; - -//@description Contains a list of messages found by a search in a given chat -//@total_count Approximate total number of messages found; -1 if unknown -//@messages List of messages -//@next_from_message_id The offset for the next request. If 0, there are no more results -foundChatMessages#4a25270c total_count:int32 messages:vector next_from_message_id:int53 = FoundChatMessages; - -//@description Contains information about a message in a specific position -//@position 0-based message position in the full list of suitable messages -//@message_id Message identifier -//@date Point in time (Unix timestamp) when the message was sent -messagePosition#4d0540ef position:int32 message_id:int53 date:int32 = MessagePosition; - -//@description Contains a list of message positions -//@total_count Total number of messages found -//@positions List of message positions -messagePositions#912eab72 total_count:int32 positions:vector = MessagePositions; - -//@description Contains information about found messages sent on a specific day -//@total_count Total number of found messages sent on the day -//@message First message sent on the day -messageCalendarDay#e98f8f62 total_count:int32 message:message = MessageCalendarDay; - -//@description Contains information about found messages, split by days according to the option "utc_time_offset" -//@total_count Total number of found messages -//@days Information about messages sent -messageCalendar#2582bbd7 total_count:int32 days:vector = MessageCalendar; - -//@description Describes a message from a business account as received by a bot -//@message The message -//@reply_to_message Message that is replied by the message in the same chat; may be null if none -businessMessage#fa604646 message:message reply_to_message:message = BusinessMessage; - -//@description Contains a list of messages from a business account as received by a bot -//@messages List of business messages -businessMessages#355963fa messages:vector = BusinessMessages; - -//@class MessageSource @description Describes source of a message - -//@description The message is from a chat history -messageSourceChatHistory#bf02073c = MessageSource; - -//@description The message is from a message thread history -messageSourceMessageThreadHistory#114f9106 = MessageSource; - -//@description The message is from a forum topic history -messageSourceForumTopicHistory#a5842cb7 = MessageSource; - -//@description The message is from chat, message thread or forum topic history preview -messageSourceHistoryPreview#3d0ce411 = MessageSource; - -//@description The message is from a chat list or a forum topic list -messageSourceChatList#85f70fea = MessageSource; - -//@description The message is from search results, including file downloads, local file list, outgoing document messages, calendar -messageSourceSearch#72853771 = MessageSource; - -//@description The message is from a chat event log -messageSourceChatEventLog#c2ae19bc = MessageSource; - -//@description The message is from a notification -messageSourceNotification#c1a11bed = MessageSource; - -//@description The message was screenshotted; the source must be used only if the message content was visible during the screenshot -messageSourceScreenshot#1c035d0a = MessageSource; - -//@description The message is from some other source -messageSourceOther#35c0a702 = MessageSource; - -//@description Information about the sponsor of a message -//@url URL of the sponsor to be opened when the message is clicked -//@photo Photo of the sponsor; may be null if must not be shown -//@info Additional optional information about the sponsor to be shown along with the message -messageSponsor#77c251de url:string photo:photo info:string = MessageSponsor; - -//@description Describes a sponsored message -//@message_id Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages -//@is_recommended True, if the message needs to be labeled as "recommended" instead of "sponsored" -//@can_be_reported True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage -//@content Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo. Video messages can be viewed fullscreen -//@sponsor Information about the sponsor of the message -//@title Title of the sponsored message -//@button_text Text for the message action button -//@accent_color_id Identifier of the accent color for title, button text and message background -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the message background; 0 if none -//@additional_info If non-empty, additional information about the sponsored message to be shown along with the message -sponsoredMessage#b78d4c25 message_id:int53 is_recommended:Bool can_be_reported:Bool content:MessageContent sponsor:messageSponsor title:string button_text:string accent_color_id:int32 background_custom_emoji_id:int64 additional_info:string = SponsoredMessage; - -//@description Contains a list of sponsored messages -//@messages List of sponsored messages -//@messages_between The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages -sponsoredMessages#e402a0f messages:vector messages_between:int32 = SponsoredMessages; - -//@description Describes an option to report an entity to Telegram -//@id Unique identifier of the option -//@text Text of the option -reportOption#41f22c20 id:bytes text:string = ReportOption; - -//@class ReportChatSponsoredMessageResult @description Describes result of sponsored message report - -//@description The message was reported successfully -reportChatSponsoredMessageResultOk#754f721f = ReportChatSponsoredMessageResult; - -//@description The sponsored message is too old or not found -reportChatSponsoredMessageResultFailed#7f1f9bc6 = ReportChatSponsoredMessageResult; - -//@description The user must choose an option to report the message and repeat request with the chosen option -//@title Title for the option choice -//@options List of available options -reportChatSponsoredMessageResultOptionRequired#34fc24b2 title:string options:vector = ReportChatSponsoredMessageResult; - -//@description Sponsored messages were hidden for the user in all chats -reportChatSponsoredMessageResultAdsHidden#e8eade1e = ReportChatSponsoredMessageResult; - -//@description The user asked to hide sponsored messages, but Telegram Premium is required for this -reportChatSponsoredMessageResultPremiumRequired#770c2ed0 = ReportChatSponsoredMessageResult; - -//@description Describes a file added to file download list -//@file_id File identifier -//@message The message with the file -//@add_date Point in time (Unix timestamp) when the file was added to the download list -//@complete_date Point in time (Unix timestamp) when the file downloading was completed; 0 if the file downloading isn't completed -//@is_paused True, if downloading of the file is paused -fileDownload#834d1354 file_id:int32 message:message add_date:int32 complete_date:int32 is_paused:Bool = FileDownload; - -//@description Contains number of being downloaded and recently downloaded files found -//@active_count Number of active file downloads found, including paused -//@paused_count Number of paused file downloads found -//@completed_count Number of completed file downloads found -downloadedFileCounts#8a572842 active_count:int32 paused_count:int32 completed_count:int32 = DownloadedFileCounts; - -//@description Contains a list of downloaded files, found by a search -//@total_counts Total number of suitable files, ignoring offset -//@files The list of files -//@next_offset The offset for the next request. If empty, then there are no more results -foundFileDownloads#c7db4128 total_counts:downloadedFileCounts files:vector next_offset:string = FoundFileDownloads; - -//@class NotificationSettingsScope @description Describes the types of chats to which notification settings are relevant - -//@description Notification settings applied to all private and secret chats when the corresponding chat setting has a default value -notificationSettingsScopePrivateChats#37e04d67 = NotificationSettingsScope; - -//@description Notification settings applied to all basic group and supergroup chats when the corresponding chat setting has a default value -notificationSettingsScopeGroupChats#483fd1f3 = NotificationSettingsScope; - -//@description Notification settings applied to all channel chats when the corresponding chat setting has a default value -notificationSettingsScopeChannelChats#20aa0588 = NotificationSettingsScope; - -//@description Contains information about notification settings for a chat or a forum topic -//@use_default_mute_for If true, the value for the relevant type of chat or the forum chat is used instead of mute_for -//@mute_for Time left before notifications will be unmuted, in seconds -//@use_default_sound If true, the value for the relevant type of chat or the forum chat is used instead of sound_id -//@sound_id Identifier of the notification sound to be played for messages; 0 if sound is disabled -//@use_default_show_preview If true, the value for the relevant type of chat or the forum chat is used instead of show_preview -//@show_preview True, if message content must be displayed in notifications -//@use_default_mute_stories If true, the value for the relevant type of chat is used instead of mute_stories -//@mute_stories True, if story notifications are disabled for the chat -//@use_default_story_sound If true, the value for the relevant type of chat is used instead of story_sound_id -//@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled -//@use_default_show_story_sender If true, the value for the relevant type of chat is used instead of show_story_sender -//@show_story_sender True, if the sender of stories must be displayed in notifications -//@use_default_disable_pinned_message_notifications If true, the value for the relevant type of chat or the forum chat is used instead of disable_pinned_message_notifications -//@disable_pinned_message_notifications If true, notifications for incoming pinned messages will be created as for an ordinary unread message -//@use_default_disable_mention_notifications If true, the value for the relevant type of chat or the forum chat is used instead of disable_mention_notifications -//@disable_mention_notifications If true, notifications for messages with mentions will be created as for an ordinary unread message -chatNotificationSettings#dddc12cf use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound_id:int64 use_default_show_preview:Bool show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool use_default_story_sound:Bool story_sound_id:int64 use_default_show_story_sender:Bool show_story_sender:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications:Bool = ChatNotificationSettings; - -//@description Contains information about notification settings for several chats -//@mute_for Time left before notifications will be unmuted, in seconds -//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled -//@show_preview True, if message content must be displayed in notifications -//@use_default_mute_stories If true, story notifications are received only for the first 5 chats from topChatCategoryUsers regardless of the value of mute_stories -//@mute_stories True, if story notifications are disabled -//@story_sound_id Identifier of the notification sound to be played for stories; 0 if sound is disabled -//@show_story_sender True, if the sender of stories must be displayed in notifications -//@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message -//@disable_mention_notifications True, if notifications for messages with mentions will be created as for an ordinary unread message -scopeNotificationSettings#dc4a615f mute_for:int32 sound_id:int64 show_preview:Bool use_default_mute_stories:Bool mute_stories:Bool story_sound_id:int64 show_story_sender:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings; - -//@class ReactionNotificationSource @description Describes sources of reactions for which notifications will be shown - -//@description Notifications for reactions are disabled -reactionNotificationSourceNone#15d6701c = ReactionNotificationSource; - -//@description Notifications for reactions are shown only for reactions from contacts -reactionNotificationSourceContacts#211c4835 = ReactionNotificationSource; - -//@description Notifications for reactions are shown for all reactions -reactionNotificationSourceAll#4a02ac92 = ReactionNotificationSource; - -//@description Contains information about notification settings for reactions -//@message_reaction_source Source of message reactions for which notifications are shown -//@story_reaction_source Source of story reactions for which notifications are shown -//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled -//@show_preview True, if reaction sender and emoji must be displayed in notifications -reactionNotificationSettings#2bb0f654 message_reaction_source:ReactionNotificationSource story_reaction_source:ReactionNotificationSource sound_id:int64 show_preview:Bool = ReactionNotificationSettings; - -//@description Contains information about a message draft -//@reply_to Information about the message to be replied; must be of the type inputMessageReplyToMessage; may be null if none -//@date Point in time (Unix timestamp) when the draft was created -//@input_message_text Content of the message draft; must be of the type inputMessageText, inputMessageVideoNote, or inputMessageVoiceNote -//@effect_id Identifier of the effect to apply to the message when it is sent; 0 if none -draftMessage#4313276d reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent effect_id:int64 = DraftMessage; - -//@class ChatType @description Describes the type of chat - -//@description An ordinary chat with a user -//@user_id User identifier -chatTypePrivate#5e1e6374 user_id:int53 = ChatType; - -//@description A basic group (a chat with 0-200 other users) -//@basic_group_id Basic group identifier -chatTypeBasicGroup#3a0c4c5c basic_group_id:int53 = ChatType; - -//@description A supergroup or channel (with unlimited members) -//@supergroup_id Supergroup or channel identifier -//@is_channel True, if the supergroup is a channel -chatTypeSupergroup#a83a5a6a supergroup_id:int53 is_channel:Bool = ChatType; - -//@description A secret chat with a user -//@secret_chat_id Secret chat identifier -//@user_id User identifier of the other user in the secret chat -chatTypeSecret#3366ab31 secret_chat_id:int32 user_id:int53 = ChatType; - -//@description Represents an icon for a chat folder -//@name The chosen icon name for short folder representation; one of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", -chatFolderIcon#f74aa0e6 name:string = ChatFolderIcon; - -//@description Describes name of a chat folder -//@text The text of the chat folder name; 1-12 characters without line feeds. May contain only CustomEmoji entities -//@animate_custom_emoji True, if custom emoji in the name must be animated -chatFolderName#ec4d3d9e text:formattedText animate_custom_emoji:Bool = ChatFolderName; - -//@description Represents a folder for user chats -//@name The name of the folder -//@icon The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder -//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription -//@is_shareable True, if at least one link has been created for the folder -//@pinned_chat_ids The chat identifiers of pinned chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium -//@included_chat_ids The chat identifiers of always included chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium -//@excluded_chat_ids The chat identifiers of always excluded chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") always excluded non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium -//@exclude_muted True, if muted chats need to be excluded -//@exclude_read True, if read chats need to be excluded -//@exclude_archived True, if archived chats need to be excluded -//@include_contacts True, if contacts need to be included -//@include_non_contacts True, if non-contact users need to be included -//@include_bots True, if bots need to be included -//@include_groups True, if basic groups and supergroups need to be included -//@include_channels True, if channels need to be included -chatFolder#a2e17d38 name:chatFolderName icon:chatFolderIcon color_id:int32 is_shareable:Bool pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFolder; - -//@description Contains basic information about a chat folder -//@id Unique chat folder identifier -//@name The name of the folder -//@icon The chosen or default icon for the chat folder -//@color_id The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled -//@is_shareable True, if at least one link has been created for the folder -//@has_my_invite_links True, if the chat folder has invite links created by the current user -chatFolderInfo#309c140d id:int32 name:chatFolderName icon:chatFolderIcon color_id:int32 is_shareable:Bool has_my_invite_links:Bool = ChatFolderInfo; - -//@description Contains a chat folder invite link -//@invite_link The chat folder invite link -//@name Name of the link -//@chat_ids Identifiers of chats, included in the link -chatFolderInviteLink#d33caf97 invite_link:string name:string chat_ids:vector = ChatFolderInviteLink; - -//@description Represents a list of chat folder invite links -//@invite_links List of the invite links -chatFolderInviteLinks#6c135313 invite_links:vector = ChatFolderInviteLinks; - -//@description Contains information about an invite link to a chat folder -//@chat_folder_info Basic information about the chat folder; chat folder identifier will be 0 if the user didn't have the chat folder yet -//@missing_chat_ids Identifiers of the chats from the link, which aren't added to the folder yet -//@added_chat_ids Identifiers of the chats from the link, which are added to the folder already -chatFolderInviteLinkInfo#776fe405 chat_folder_info:chatFolderInfo missing_chat_ids:vector added_chat_ids:vector = ChatFolderInviteLinkInfo; - -//@description Describes a recommended chat folder -//@folder The chat folder -//@param_description Chat folder description -recommendedChatFolder#81d7b4b6 folder:chatFolder description:string = RecommendedChatFolder; - -//@description Contains a list of recommended chat folders -//@chat_folders List of recommended chat folders -recommendedChatFolders#32208553 chat_folders:vector = RecommendedChatFolders; - -//@description Contains settings for automatic moving of chats to and from the Archive chat lists -//@archive_and_mute_new_chats_from_unknown_users True, if new chats from non-contacts will be automatically archived and muted. Can be set to true only if the option "can_archive_and_mute_new_chats_from_unknown_users" is true -//@keep_unmuted_chats_archived True, if unmuted chats will be kept in the Archive chat list when they get a new message -//@keep_chats_from_folders_archived True, if unmuted chats, that are always included or pinned in a folder, will be kept in the Archive chat list when they get a new message. Ignored if keep_unmuted_chats_archived == true -archiveChatListSettings#3f176aa4 archive_and_mute_new_chats_from_unknown_users:Bool keep_unmuted_chats_archived:Bool keep_chats_from_folders_archived:Bool = ArchiveChatListSettings; - -//@class ChatList @description Describes a list of chats - -//@description A main list of chats -chatListMain#e8195bac = ChatList; - -//@description A list of chats usually located at the top of the main chat list. Unmuted chats are automatically moved from the Archive to the Main chat list when a new message arrives -chatListArchive#159f6ec3 = ChatList; - -//@description A list of chats added to a chat folder -//@chat_folder_id Chat folder identifier -chatListFolder#16fe3e58 chat_folder_id:int32 = ChatList; - -//@description Contains a list of chat lists -//@chat_lists List of chat lists -chatLists#92c2d216 chat_lists:vector = ChatLists; - -//@class ChatSource @description Describes a reason why an external chat is shown in a chat list - -//@description The chat is sponsored by the user's MTProxy server -chatSourceMtprotoProxy#177d1803 = ChatSource; - -//@description The chat contains a public service announcement -//@type The type of the announcement -//@text The text of the announcement -chatSourcePublicServiceAnnouncement#ec6a6694 type:string text:string = ChatSource; - -//@description Describes a position of a chat in a chat list -//@list The chat list -//@order A parameter used to determine order of the chat in the chat list. Chats must be sorted by the pair (order, chat.id) in descending order -//@is_pinned True, if the chat is pinned in the chat list -//@source Source of the chat in the chat list; may be null -chatPosition#dae48755 list:ChatList order:int64 is_pinned:Bool source:ChatSource = ChatPosition; - -//@class ChatAvailableReactions @description Describes reactions available in the chat - -//@description All reactions are available in the chat, excluding the paid reaction and custom reactions in channel chats -//@max_reaction_count The maximum allowed number of reactions per message; 1-11 -chatAvailableReactionsAll#29600b97 max_reaction_count:int32 = ChatAvailableReactions; - -//@description Only specific reactions are available in the chat -//@reactions The list of reactions -//@max_reaction_count The maximum allowed number of reactions per message; 1-11 -chatAvailableReactionsSome#36b46b7d reactions:vector max_reaction_count:int32 = ChatAvailableReactions; - -//@description Represents a tag used in Saved Messages or a Saved Messages topic -//@tag The tag -//@label Label of the tag; 0-12 characters. Always empty if the tag is returned for a Saved Messages topic -//@count Number of times the tag was used; may be 0 if the tag has non-empty label -savedMessagesTag#6a67bc61 tag:ReactionType label:string count:int32 = SavedMessagesTag; - -//@description Contains a list of tags used in Saved Messages -//@tags List of tags -savedMessagesTags#ca94a1b3 tags:vector = SavedMessagesTags; - -//@description Contains information about a business bot that manages the chat -//@bot_user_id User identifier of the bot -//@manage_url URL to be opened to manage the bot -//@is_bot_paused True, if the bot is paused. Use toggleBusinessConnectedBotChatIsPaused to change the value of the field -//@can_bot_reply True, if the bot can reply -businessBotManageBar#ed706a82 bot_user_id:int53 manage_url:string is_bot_paused:Bool can_bot_reply:Bool = BusinessBotManageBar; - -//@description Describes a video chat -//@group_call_id Group call identifier of an active video chat; 0 if none. Full information about the video chat can be received through the method getGroupCall -//@has_participants True, if the video chat has participants -//@default_participant_id Default group call participant identifier to join the video chat; may be null -videoChat#ae158d28 group_call_id:int32 has_participants:Bool default_participant_id:MessageSender = VideoChat; - -//@description A chat. (Can be a private chat, basic group, supergroup, or secret chat) -//@id Chat unique identifier -//@type Type of the chat -//@title Chat title -//@photo Chat photo; may be null -//@accent_color_id Identifier of the accent color for message sender name, and backgrounds of chat photo, reply header, and link preview -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background for messages sent by the chat; 0 if none -//@profile_accent_color_id Identifier of the profile accent color for the chat's profile; -1 if none -//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the background of the chat's profile; 0 if none -//@permissions Actions that non-administrator chat members are allowed to take in the chat -//@last_message Last message in the chat; may be null if none or unknown -//@positions Positions of the chat in chat lists -//@chat_lists Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even it doesn't belong to the chat list and have no position in a chat list even it belongs to the chat list -//@message_sender_id Identifier of a user or chat that is selected to send messages in the chat; may be null if the user can't change message sender -//@block_list Block list to which the chat is added; may be null if none -//@has_protected_content True, if chat content can't be saved locally, forwarded, or copied -//@is_translatable True, if translation of all messages in the chat must be suggested to the user -//@is_marked_as_unread True, if the chat is marked as unread -//@view_as_topics True, if the chat is a forum supergroup that must be shown in the "View as topics" mode, or Saved Messages chat that must be shown in the "View as chats" -//@has_scheduled_messages True, if the chat has scheduled messages -//@can_be_deleted_only_for_self True, if the chat messages can be deleted only for the current user while other users will continue to see the messages -//@can_be_deleted_for_all_users True, if the chat messages can be deleted for all users -//@can_be_reported True, if the chat can be reported to Telegram moderators through reportChat or reportChatPhoto -//@default_disable_notification Default value of the disable_notification parameter, used when a message is sent to the chat -//@unread_count Number of unread messages in the chat -//@last_read_inbox_message_id Identifier of the last read incoming message -//@last_read_outbox_message_id Identifier of the last read outgoing message -//@unread_mention_count Number of unread messages with a mention/reply in the chat -//@unread_reaction_count Number of messages with unread reactions in the chat -//@notification_settings Notification settings for the chat -//@available_reactions Types of reaction, available in the chat -//@message_auto_delete_time Current message auto-delete or self-destruct timer setting for the chat, in seconds; 0 if disabled. Self-destruct timer in secret chats starts after the message or its content is viewed. Auto-delete timer in other chats starts from the send date -//@emoji_status Emoji status to be shown along with chat title; may be null -//@background Background set for the chat; may be null if none -//@theme_name If non-empty, name of a theme, set for the chat -//@action_bar Information about actions which must be possible to do through the chat action bar; may be null if none -//@business_bot_manage_bar Information about bar for managing a business bot in the chat; may be null if none -//@video_chat Information about video chat of the chat -//@pending_join_requests Information about pending join requests; may be null if none -//@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat -//@draft_message A draft of a message in the chat; may be null if none -//@client_data Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used -chat#e5bae2e4 id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector chat_lists:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool view_as_topics:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 emoji_status:emojiStatus background:chatBackground theme_name:string action_bar:ChatActionBar business_bot_manage_bar:businessBotManageBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; - -//@description Represents a list of chats -//@total_count Approximate total number of chats found -//@chat_ids List of chat identifiers -chats#9b93e3eb total_count:int32 chat_ids:vector = Chats; - -//@description Contains information about a user that has failed to be added to a chat -//@user_id User identifier -//@premium_would_allow_invite True, if subscription to Telegram Premium would have allowed to add the user to the chat -//@premium_required_to_send_messages True, if subscription to Telegram Premium is required to send the user chat invite link -failedToAddMember#ef236cc2 user_id:int53 premium_would_allow_invite:Bool premium_required_to_send_messages:Bool = FailedToAddMember; - -//@description Represents a list of users that has failed to be added to a chat -//@failed_to_add_members Information about users that weren't added to the chat -failedToAddMembers#98b4b04 failed_to_add_members:vector = FailedToAddMembers; - -//@description Contains information about a newly created basic group chat -//@chat_id Chat identifier -//@failed_to_add_members Information about failed to add members -createdBasicGroupChat#fec875d4 chat_id:int53 failed_to_add_members:failedToAddMembers = CreatedBasicGroupChat; - -//@class PublicChatType @description Describes type of public chat - -//@description The chat is public, because it has an active username -publicChatTypeHasUsername#14e8a07e = PublicChatType; - -//@description The chat is public, because it is a location-based supergroup -publicChatTypeIsLocationBased#468e6090 = PublicChatType; - -//@class ChatActionBar @description Describes actions which must be possible to do through a chat action bar - -//@description The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown -//@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings -chatActionBarReportSpam#b1c0e61a can_unarchive:Bool = ChatActionBar; - -//@description The chat is a recently created group chat to which new members can be invited -chatActionBarInviteMembers#76557c70 = ChatActionBar; - -//@description The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method setMessageSenderBlockList, -//@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings -chatActionBarReportAddBlock#a9748a2a can_unarchive:Bool = ChatActionBar; - -//@description The chat is a private or secret chat and the other user can be added to the contact list using the method addContact -chatActionBarAddContact#d44a5811 = ChatActionBar; - -//@description The chat is a private or secret chat with a mutual contact and the user's phone number can be shared with the other user using the method sharePhoneNumber -chatActionBarSharePhoneNumber#218efd9 = ChatActionBar; - -//@description The chat is a private chat with an administrator of a chat to which the user sent join request -//@title Title of the chat to which the join request was sent -//@is_channel True, if the join request was sent to a channel chat -//@request_date Point in time (Unix timestamp) when the join request was sent -chatActionBarJoinRequest#3dd18308 title:string is_channel:Bool request_date:int32 = ChatActionBar; - -//@class KeyboardButtonType @description Describes a keyboard button type - -//@description A simple button, with text that must be sent when the button is pressed -keyboardButtonTypeText#96519938 = KeyboardButtonType; - -//@description A button that sends the user's phone number when pressed; available only in private chats -keyboardButtonTypeRequestPhoneNumber#a4d9b7b9 = KeyboardButtonType; - -//@description A button that sends the user's location when pressed; available only in private chats -keyboardButtonTypeRequestLocation#f8828cfd = KeyboardButtonType; - -//@description A button that allows the user to create and send a poll when pressed; available only in private chats -//@force_regular If true, only regular polls must be allowed to create -//@force_quiz If true, only polls in quiz mode must be allowed to create -keyboardButtonTypeRequestPoll#7164dcb8 force_regular:Bool force_quiz:Bool = KeyboardButtonType; - -//@description A button that requests users to be shared by the current user; available only in private chats. Use the method shareUsersWithBot to complete the request -//@id Unique button identifier -//@restrict_user_is_bot True, if the shared users must or must not be bots -//@user_is_bot True, if the shared users must be bots; otherwise, the shared users must not be bots. Ignored if restrict_user_is_bot is false -//@restrict_user_is_premium True, if the shared users must or must not be Telegram Premium users -//@user_is_premium True, if the shared users must be Telegram Premium users; otherwise, the shared users must not be Telegram Premium users. Ignored if restrict_user_is_premium is false -//@max_quantity The maximum number of users to share -//@request_name Pass true to request name of the users; bots only -//@request_username Pass true to request username of the users; bots only -//@request_photo Pass true to request photo of the users; bots only -keyboardButtonTypeRequestUsers#985c8bfd id:int32 restrict_user_is_bot:Bool user_is_bot:Bool restrict_user_is_premium:Bool user_is_premium:Bool max_quantity:int32 request_name:Bool request_username:Bool request_photo:Bool = KeyboardButtonType; - -//@description A button that requests a chat to be shared by the current user; available only in private chats. Use the method shareChatWithBot to complete the request -//@id Unique button identifier -//@chat_is_channel True, if the chat must be a channel; otherwise, a basic group or a supergroup chat is shared -//@restrict_chat_is_forum True, if the chat must or must not be a forum supergroup -//@chat_is_forum True, if the chat must be a forum supergroup; otherwise, the chat must not be a forum supergroup. Ignored if restrict_chat_is_forum is false -//@restrict_chat_has_username True, if the chat must or must not have a username -//@chat_has_username True, if the chat must have a username; otherwise, the chat must not have a username. Ignored if restrict_chat_has_username is false -//@chat_is_created True, if the chat must be created by the current user -//@user_administrator_rights Expected user administrator rights in the chat; may be null if they aren't restricted -//@bot_administrator_rights Expected bot administrator rights in the chat; may be null if they aren't restricted -//@bot_is_member True, if the bot must be a member of the chat; for basic group and supergroup chats only -//@request_title Pass true to request title of the chat; bots only -//@request_username Pass true to request username of the chat; bots only -//@request_photo Pass true to request photo of the chat; bots only -keyboardButtonTypeRequestChat#5a1224b5 id:int32 chat_is_channel:Bool restrict_chat_is_forum:Bool chat_is_forum:Bool restrict_chat_has_username:Bool chat_has_username:Bool chat_is_created:Bool user_administrator_rights:chatAdministratorRights bot_administrator_rights:chatAdministratorRights bot_is_member:Bool request_title:Bool request_username:Bool request_photo:Bool = KeyboardButtonType; - -//@description A button that opens a Web App by calling getWebAppUrl -//@url An HTTP URL to pass to getWebAppUrl -keyboardButtonTypeWebApp#70c8ff62 url:string = KeyboardButtonType; - -//@description Represents a single button in a bot keyboard -//@text Text of the button -//@type Type of the button -keyboardButton#84a0ce74 text:string type:KeyboardButtonType = KeyboardButton; - -//@class InlineKeyboardButtonType @description Describes the type of inline keyboard button - -//@description A button that opens a specified URL -//@url HTTP or tg:// URL to open. If the link is of the type internalLinkTypeWebApp, then the button must be marked as a Web App button -inlineKeyboardButtonTypeUrl#4365beac url:string = InlineKeyboardButtonType; - -//@description A button that opens a specified URL and automatically authorize the current user by calling getLoginUrlInfo -//@url An HTTP URL to pass to getLoginUrlInfo -//@id Unique button identifier -//@forward_text If non-empty, new text of the button in forwarded messages -inlineKeyboardButtonTypeLoginUrl#b8455fa7 url:string id:int53 forward_text:string = InlineKeyboardButtonType; - -//@description A button that opens a Web App by calling openWebApp -//@url An HTTP URL to pass to openWebApp -inlineKeyboardButtonTypeWebApp#96a685c8 url:string = InlineKeyboardButtonType; - -//@description A button that sends a callback query to a bot -//@data Data to be sent to the bot via a callback query -inlineKeyboardButtonTypeCallback#bccb7bfd data:bytes = InlineKeyboardButtonType; - -//@description A button that asks for the 2-step verification password of the current user and then sends a callback query to a bot -//@data Data to be sent to the bot via a callback query -inlineKeyboardButtonTypeCallbackWithPassword#361f4248 data:bytes = InlineKeyboardButtonType; - -//@description A button with a game that sends a callback query to a bot. This button must be in the first column and row of the keyboard and can be attached only to a message with content of the type messageGame -inlineKeyboardButtonTypeCallbackGame#e9255468 = InlineKeyboardButtonType; - -//@description A button that forces an inline query to the bot to be inserted in the input field -//@query Inline query to be sent to the bot -//@target_chat Target chat from which to send the inline query -inlineKeyboardButtonTypeSwitchInline#207a9cf5 query:string target_chat:TargetChat = InlineKeyboardButtonType; - -//@description A button to buy something. This button must be in the first column and row of the keyboard and can be attached only to a message with content of the type messageInvoice -inlineKeyboardButtonTypeBuy#511b3c70 = InlineKeyboardButtonType; - -//@description A button with a user reference to be handled in the same way as textEntityTypeMentionName entities -//@user_id User identifier -inlineKeyboardButtonTypeUser#6d77e5a2 user_id:int53 = InlineKeyboardButtonType; - -//@description A button that copies specified text to clipboard -//@text The text to copy to clipboard -inlineKeyboardButtonTypeCopyText#41b1306 text:string = InlineKeyboardButtonType; - -//@description Represents a single button in an inline keyboard -//@text Text of the button -//@type Type of the button -inlineKeyboardButton#e9d21e18 text:string type:InlineKeyboardButtonType = InlineKeyboardButton; - -//@class ReplyMarkup @description Contains a description of a custom keyboard and actions that can be done with it to quickly reply to bots - -//@description Instructs application to remove the keyboard once this message has been received. This kind of keyboard can't be received in an incoming message; instead, updateChatReplyMarkup with message_id == 0 will be sent -//@is_personal True, if the keyboard is removed only for the mentioned users or the target user of a reply -replyMarkupRemoveKeyboard#d6cc5171 is_personal:Bool = ReplyMarkup; - -//@description Instructs application to force a reply to this message -//@is_personal True, if a forced reply must automatically be shown to the current user. For outgoing messages, specify true to show the forced reply only for the mentioned users and for the target user of a reply -//@input_field_placeholder If non-empty, the placeholder to be shown in the input field when the reply is active; 0-64 characters -replyMarkupForceReply#41a6f99f is_personal:Bool input_field_placeholder:string = ReplyMarkup; - -//@description Contains a custom keyboard layout to quickly reply to bots -//@rows A list of rows of bot keyboard buttons -//@is_persistent True, if the keyboard is expected to always be shown when the ordinary keyboard is hidden -//@resize_keyboard True, if the application needs to resize the keyboard vertically -//@one_time True, if the application needs to hide the keyboard after use -//@is_personal True, if the keyboard must automatically be shown to the current user. For outgoing messages, specify true to show the keyboard only for the mentioned users and for the target user of a reply -//@input_field_placeholder If non-empty, the placeholder to be shown in the input field when the keyboard is active; 0-64 characters -replyMarkupShowKeyboard#802461d3 rows:vector> is_persistent:Bool resize_keyboard:Bool one_time:Bool is_personal:Bool input_field_placeholder:string = ReplyMarkup; - -//@description Contains an inline keyboard layout -//@rows A list of rows of inline keyboard buttons -replyMarkupInlineKeyboard#92ac0efb rows:vector> = ReplyMarkup; - -//@class LoginUrlInfo @description Contains information about an inline button of type inlineKeyboardButtonTypeLoginUrl - -//@description An HTTP URL needs to be open -//@url The URL to open -//@skip_confirmation True, if there is no need to show an ordinary open URL confirmation -loginUrlInfoOpen#31e7ea02 url:string skip_confirmation:Bool = LoginUrlInfo; - -//@description An authorization confirmation dialog needs to be shown to the user -//@url An HTTP URL to be opened -//@domain A domain of the URL -//@bot_user_id User identifier of a bot linked with the website -//@request_write_access True, if the user must be asked for the permission to the bot to send them messages -loginUrlInfoRequestConfirmation#7edb242f url:string domain:string bot_user_id:int53 request_write_access:Bool = LoginUrlInfo; - -//@description Contains parameters of the application theme -//@background_color A color of the background in the RGB format -//@secondary_background_color A secondary color for the background in the RGB format -//@header_background_color A color of the header background in the RGB format -//@bottom_bar_background_color A color of the bottom bar background in the RGB format -//@section_background_color A color of the section background in the RGB format -//@section_separator_color A color of the section separator in the RGB format -//@text_color A color of text in the RGB format -//@accent_text_color An accent color of the text in the RGB format -//@section_header_text_color A color of text on the section headers in the RGB format -//@subtitle_text_color A color of the subtitle text in the RGB format -//@destructive_text_color A color of the text for destructive actions in the RGB format -//@hint_color A color of hints in the RGB format -//@link_color A color of links in the RGB format -//@button_color A color of the buttons in the RGB format -//@button_text_color A color of text on the buttons in the RGB format -themeParameters#ef8395af background_color:int32 secondary_background_color:int32 header_background_color:int32 bottom_bar_background_color:int32 section_background_color:int32 section_separator_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; - -//@class WebAppOpenMode @description Describes mode in which a Web App is opened - -//@description The Web App is opened in the compact mode -webAppOpenModeCompact#6604ffdb = WebAppOpenMode; - -//@description The Web App is opened in the full-size mode -webAppOpenModeFullSize#b48cd41 = WebAppOpenMode; - -//@description The Web App is opened in the full-screen mode -webAppOpenModeFullScreen#6f8a019d = WebAppOpenMode; - -//@description Contains information about a Web App found by its short name -//@web_app The Web App -//@request_write_access True, if the user must be asked for the permission to the bot to send them messages -//@skip_confirmation True, if there is no need to show an ordinary open URL confirmation before opening the Web App. The field must be ignored and confirmation must be shown anyway if the Web App link was hidden -foundWebApp#eea8d01e web_app:webApp request_write_access:Bool skip_confirmation:Bool = FoundWebApp; - -//@description Contains information about a Web App -//@launch_id Unique identifier for the Web App launch -//@url A Web App URL to open in a web view -webAppInfo#2efdb2e8 launch_id:int64 url:string = WebAppInfo; - -//@description Contains information about the main Web App of a bot -//@url URL of the Web App to open -//@mode The mode in which the Web App must be opened -mainWebApp#73a7ac7a url:string mode:WebAppOpenMode = MainWebApp; - -//@description Options to be used when a Web App is opened -//@theme Preferred Web App theme; pass null to use the default theme -//@application_name Short name of the current application; 0-64 English letters, digits, and underscores -//@mode The mode in which the Web App is opened; pass null to open in webAppOpenModeFullSize -webAppOpenParameters#51fa466f theme:themeParameters application_name:string mode:WebAppOpenMode = WebAppOpenParameters; - -//@description Contains information about a message thread -//@chat_id Identifier of the chat to which the message thread belongs -//@message_thread_id Message thread identifier, unique within the chat -//@reply_info Information about the message thread; may be null for forum topic threads -//@unread_message_count Approximate number of unread messages in the message thread -//@messages The messages from which the thread starts. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) -//@draft_message A draft of a message in the message thread; may be null if none -messageThreadInfo#683fd5ad chat_id:int53 message_thread_id:int53 reply_info:messageReplyInfo unread_message_count:int32 messages:vector draft_message:draftMessage = MessageThreadInfo; - -//@class SavedMessagesTopicType @description Describes type of Saved Messages topic - -//@description Topic containing messages sent by the current user of forwarded from an unknown chat -savedMessagesTopicTypeMyNotes#b38a41f5 = SavedMessagesTopicType; - -//@description Topic containing messages forwarded from a user with hidden privacy -savedMessagesTopicTypeAuthorHidden#703c4195 = SavedMessagesTopicType; - -//@description Topic containing messages forwarded from a specific chat -//@chat_id Identifier of the chat -savedMessagesTopicTypeSavedFromChat#993fad58 chat_id:int53 = SavedMessagesTopicType; - -//@description Contains information about a Saved Messages topic -//@id Unique topic identifier -//@type Type of the topic -//@is_pinned True, if the topic is pinned -//@order A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order -//@last_message Last message in the topic; may be null if none or unknown -//@draft_message A draft of a message in the topic; may be null if none -savedMessagesTopic#d2a8e1a4 id:int53 type:SavedMessagesTopicType is_pinned:Bool order:int64 last_message:message draft_message:draftMessage = SavedMessagesTopic; - -//@description Describes a forum topic icon -//@color Color of the topic icon in RGB format -//@custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none -forumTopicIcon#cf32a193 color:int32 custom_emoji_id:int64 = ForumTopicIcon; - -//@description Contains basic information about a forum topic -//@message_thread_id Message thread identifier of the topic -//@name Name of the topic -//@icon Icon of the topic -//@creation_date Point in time (Unix timestamp) when the topic was created -//@creator_id Identifier of the creator of the topic -//@is_general True, if the topic is the General topic list -//@is_outgoing True, if the topic was created by the current user -//@is_closed True, if the topic is closed -//@is_hidden True, if the topic is hidden above the topic list and closed; for General topic only -forumTopicInfo#8ff3df9e message_thread_id:int53 name:string icon:forumTopicIcon creation_date:int32 creator_id:MessageSender is_general:Bool is_outgoing:Bool is_closed:Bool is_hidden:Bool = ForumTopicInfo; - -//@description Describes a forum topic -//@info Basic information about the topic -//@last_message Last message in the topic; may be null if unknown -//@is_pinned True, if the topic is pinned in the topic list -//@unread_count Number of unread messages in the topic -//@last_read_inbox_message_id Identifier of the last read incoming message -//@last_read_outbox_message_id Identifier of the last read outgoing message -//@unread_mention_count Number of unread messages with a mention/reply in the topic -//@unread_reaction_count Number of messages with unread reactions in the topic -//@notification_settings Notification settings for the topic -//@draft_message A draft of a message in the topic; may be null if none -forumTopic#1213ace6 info:forumTopicInfo last_message:message is_pinned:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings draft_message:draftMessage = ForumTopic; - -//@description Describes a list of forum topics -//@total_count Approximate total number of forum topics found -//@topics List of forum topics -//@next_offset_date Offset date for the next getForumTopics request -//@next_offset_message_id Offset message identifier for the next getForumTopics request -//@next_offset_message_thread_id Offset message thread identifier for the next getForumTopics request -forumTopics#2d99b4ae total_count:int32 topics:vector next_offset_date:int32 next_offset_message_id:int53 next_offset_message_thread_id:int53 = ForumTopics; - -//@description Options to be used for generation of a link preview -//@is_disabled True, if link preview must be disabled -//@url URL to use for link preview. If empty, then the first URL found in the message text will be used -//@force_small_media True, if shown media preview must be small; ignored in secret chats or if the URL isn't explicitly specified -//@force_large_media True, if shown media preview must be large; ignored in secret chats or if the URL isn't explicitly specified -//@show_above_text True, if link preview must be shown above message text; otherwise, the link preview will be shown below the message text; ignored in secret chats -linkPreviewOptions#3e61b3f3 is_disabled:Bool url:string force_small_media:Bool force_large_media:Bool show_above_text:Bool = LinkPreviewOptions; - -//@description Contains information about a user shared with a bot -//@user_id User identifier -//@first_name First name of the user; for bots only -//@last_name Last name of the user; for bots only -//@username Username of the user; for bots only -//@photo Profile photo of the user; for bots only; may be null -sharedUser#117724f7 user_id:int53 first_name:string last_name:string username:string photo:photo = SharedUser; - -//@description Contains information about a chat shared with a bot -//@chat_id Chat identifier -//@title Title of the chat; for bots only -//@username Username of the chat; for bots only -//@photo Photo of the chat; for bots only; may be null -sharedChat#4a87b01a chat_id:int53 title:string username:string photo:photo = SharedChat; - -//@description Describes theme settings -//@accent_color Theme accent color in ARGB format -//@background The background to be used in chats; may be null -//@outgoing_message_fill The fill to be used as a background for outgoing messages -//@animate_outgoing_message_fill If true, the freeform gradient fill needs to be animated on every sent message -//@outgoing_message_accent_color Accent color of outgoing messages in ARGB format -themeSettings#fc4c1c12 accent_color:int32 background:background outgoing_message_fill:BackgroundFill animate_outgoing_message_fill:Bool outgoing_message_accent_color:int32 = ThemeSettings; - -//@class RichText @description Describes a formatted text object - -//@description A plain text -//@text Text -richTextPlain#1cc42966 text:string = RichText; - -//@description A bold rich text -//@text Text -richTextBold#63970f6c text:RichText = RichText; - -//@description An italicized rich text -//@text Text -richTextItalic#6e77f03f text:RichText = RichText; - -//@description An underlined rich text -//@text Text -richTextUnderline#e00cfd8c text:RichText = RichText; - -//@description A strikethrough rich text -//@text Text -richTextStrikethrough#2b1e6a51 text:RichText = RichText; - -//@description A fixed-width rich text -//@text Text -richTextFixed#b43681c7 text:RichText = RichText; - -//@description A rich text URL link -//@text Text -//@url URL -//@is_cached True, if the URL has cached instant view server-side -richTextUrl#500cf14 text:RichText url:string is_cached:Bool = RichText; - -//@description A rich text email link -//@text Text -//@email_address Email address -richTextEmailAddress#262a2f7 text:RichText email_address:string = RichText; - -//@description A subscript rich text -//@text Text -richTextSubscript#cc405a4c text:RichText = RichText; - -//@description A superscript rich text -//@text Text -richTextSuperscript#e9377563 text:RichText = RichText; - -//@description A marked rich text -//@text Text -richTextMarked#b42ed382 text:RichText = RichText; - -//@description A rich text phone number -//@text Text -//@phone_number Phone number -richTextPhoneNumber#7a91543 text:RichText phone_number:string = RichText; - -//@description A small image inside the text -//@document The image represented as a document. The image can be in GIF, JPEG or PNG format -//@width Width of a bounding box in which the image must be shown; 0 if unknown -//@height Height of a bounding box in which the image must be shown; 0 if unknown -richTextIcon#a7c42b02 document:document width:int32 height:int32 = RichText; - -//@description A reference to a richTexts object on the same page -//@text The text -//@anchor_name The name of a richTextAnchor object, which is the first element of the target richTexts object -//@url An HTTP URL, opening the reference -richTextReference#bb9a1276 text:RichText anchor_name:string url:string = RichText; - -//@description An anchor -//@name Anchor name -richTextAnchor#4e7f1034 name:string = RichText; - -//@description A link to an anchor on the same page -//@text The link text -//@anchor_name The anchor name. If the name is empty, the link must bring back to top -//@url An HTTP URL, opening the anchor -richTextAnchorLink#a41fd2d6 text:RichText anchor_name:string url:string = RichText; - -//@description A concatenation of rich texts -//@texts Texts -richTexts#94b21889 texts:vector = RichText; - -//@description Contains a caption of another block -//@text Content of the caption -//@credit Block credit (like HTML tag ) -pageBlockCaption#b9a9a476 text:RichText credit:RichText = PageBlockCaption; - -//@description Describes an item of a list page block -//@label Item label -//@page_blocks Item blocks -pageBlockListItem#5f521776 label:string page_blocks:vector = PageBlockListItem; - -//@class PageBlockHorizontalAlignment @description Describes a horizontal alignment of a table cell content - -//@description The content must be left-aligned -pageBlockHorizontalAlignmentLeft#329627e9 = PageBlockHorizontalAlignment; - -//@description The content must be center-aligned -pageBlockHorizontalAlignmentCenter#c3d8c4ea = PageBlockHorizontalAlignment; - -//@description The content must be right-aligned -pageBlockHorizontalAlignmentRight#51bd6efe = PageBlockHorizontalAlignment; - -//@class PageBlockVerticalAlignment @description Describes a Vertical alignment of a table cell content - -//@description The content must be top-aligned -pageBlockVerticalAlignmentTop#ba719a6 = PageBlockVerticalAlignment; - -//@description The content must be middle-aligned -pageBlockVerticalAlignmentMiddle#81741df5 = PageBlockVerticalAlignment; - -//@description The content must be bottom-aligned -pageBlockVerticalAlignmentBottom#7cb97dd6 = PageBlockVerticalAlignment; - -//@description Represents a cell of a table -//@text Cell text; may be null. If the text is null, then the cell must be invisible -//@is_header True, if it is a header cell -//@colspan The number of columns the cell spans -//@rowspan The number of rows the cell spans -//@align Horizontal cell content alignment -//@valign Vertical cell content alignment -pageBlockTableCell#547fbf66 text:RichText is_header:Bool colspan:int32 rowspan:int32 align:PageBlockHorizontalAlignment valign:PageBlockVerticalAlignment = PageBlockTableCell; - -//@description Contains information about a related article -//@url Related article URL -//@title Article title; may be empty -//@param_description Article description; may be empty -//@photo Article photo; may be null -//@author Article author; may be empty -//@publish_date Point in time (Unix timestamp) when the article was published; 0 if unknown -pageBlockRelatedArticle#1cae8493 url:string title:string description:string photo:photo author:string publish_date:int32 = PageBlockRelatedArticle; - -//@class PageBlock @description Describes a block of an instant view for a web page - -//@description The title of a page -//@title Title -pageBlockTitle#6122b610 title:RichText = PageBlock; - -//@description The subtitle of a page -//@subtitle Subtitle -pageBlockSubtitle#fc451e7 subtitle:RichText = PageBlock; - -//@description The author and publishing date of a page -//@author Author -//@publish_date Point in time (Unix timestamp) when the article was published; 0 if unknown -pageBlockAuthorDate#4d7ff410 author:RichText publish_date:int32 = PageBlock; - -//@description A header -//@header Header -pageBlockHeader#539ddd9b header:RichText = PageBlock; - -//@description A subheader -//@subheader Subheader -pageBlockSubheader#4b567326 subheader:RichText = PageBlock; - -//@description A kicker -//@kicker Kicker -pageBlockKicker#5123864b kicker:RichText = PageBlock; - -//@description A text paragraph -//@text Paragraph text -pageBlockParagraph#467a0766 text:RichText = PageBlock; - -//@description A preformatted text paragraph -//@text Paragraph text -//@language Programming language for which the text needs to be formatted -pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; - -//@description The footer of a page -//@footer Footer -pageBlockFooter#34d5d728 footer:RichText = PageBlock; - -//@description An empty block separating a page -pageBlockDivider#db20b188 = PageBlock; - -//@description An invisible anchor on a page, which can be used in a URL to open the page from the specified anchor -//@name Name of the anchor -pageBlockAnchor#ce0d37b0 name:string = PageBlock; - -//@description A list of data blocks -//@items The items of the list -pageBlockList#584af35a items:vector = PageBlock; - -//@description A block quote -//@text Quote text -//@credit Quote credit -pageBlockBlockQuote#62d08a9e text:RichText credit:RichText = PageBlock; - -//@description A pull quote -//@text Quote text -//@credit Quote credit -pageBlockPullQuote#1d38810d text:RichText credit:RichText = PageBlock; - -//@description An animation -//@animation Animation file; may be null -//@caption Animation caption -//@need_autoplay True, if the animation must be played automatically -pageBlockAnimation#50cde009 animation:animation caption:pageBlockCaption need_autoplay:Bool = PageBlock; - -//@description An audio file -//@audio Audio file; may be null -//@caption Audio file caption -pageBlockAudio#fc390813 audio:audio caption:pageBlockCaption = PageBlock; - -//@description A photo -//@photo Photo file; may be null -//@caption Photo caption -//@url URL that needs to be opened when the photo is clicked -pageBlockPhoto#18e41684 photo:photo caption:pageBlockCaption url:string = PageBlock; - -//@description A video -//@video Video file; may be null -//@caption Video caption -//@need_autoplay True, if the video must be played automatically -//@is_looped True, if the video must be looped -pageBlockVideo#1e669d32 video:video caption:pageBlockCaption need_autoplay:Bool is_looped:Bool = PageBlock; - -//@description A voice note -//@voice_note Voice note; may be null -//@caption Voice note caption -pageBlockVoiceNote#6cad827f voice_note:voiceNote caption:pageBlockCaption = PageBlock; - -//@description A page cover -//@cover Cover -pageBlockCover#39f23300 cover:PageBlock = PageBlock; - -//@description An embedded web page -//@url URL of the embedded page, if available -//@html HTML-markup of the embedded page -//@poster_photo Poster photo, if available; may be null -//@width Block width; 0 if unknown -//@height Block height; 0 if unknown -//@caption Block caption -//@is_full_width True, if the block must be full width -//@allow_scrolling True, if scrolling needs to be allowed -pageBlockEmbedded#8c369d9d url:string html:string poster_photo:photo width:int32 height:int32 caption:pageBlockCaption is_full_width:Bool allow_scrolling:Bool = PageBlock; - -//@description An embedded post -//@url URL of the embedded post -//@author Post author -//@author_photo Post author photo; may be null -//@date Point in time (Unix timestamp) when the post was created; 0 if unknown -//@page_blocks Post content -//@caption Post caption -pageBlockEmbeddedPost#bc57cdf5 url:string author:string author_photo:photo date:int32 page_blocks:vector caption:pageBlockCaption = PageBlock; - -//@description A collage -//@page_blocks Collage item contents -//@caption Block caption -pageBlockCollage#40bcaaf0 page_blocks:vector caption:pageBlockCaption = PageBlock; - -//@description A slideshow -//@page_blocks Slideshow item contents -//@caption Block caption -pageBlockSlideshow#1107d496 page_blocks:vector caption:pageBlockCaption = PageBlock; - -//@description A link to a chat -//@title Chat title -//@photo Chat photo; may be null -//@accent_color_id Identifier of the accent color for chat title and background of chat photo -//@username Chat username by which all other information about the chat can be resolved -pageBlockChatLink#621ed8bb title:string photo:chatPhotoInfo accent_color_id:int32 username:string = PageBlock; - -//@description A table -//@caption Table caption -//@cells Table cells -//@is_bordered True, if the table is bordered -//@is_striped True, if the table is striped -pageBlockTable#cc6352c3 caption:RichText cells:vector> is_bordered:Bool is_striped:Bool = PageBlock; - -//@description A collapsible block -//@header Always visible heading for the block -//@page_blocks Block contents -//@is_open True, if the block is open by default -pageBlockDetails#990a0c0b header:RichText page_blocks:vector is_open:Bool = PageBlock; - -//@description Related articles -//@header Block header -//@articles List of related articles -pageBlockRelatedArticles#936d81e6 header:RichText articles:vector = PageBlock; - -//@description A map -//@location Location of the map center -//@zoom Map zoom level -//@width Map width -//@height Map height -//@caption Block caption -pageBlockMap#5a0f7013 location:location zoom:int32 width:int32 height:int32 caption:pageBlockCaption = PageBlock; - -//@description Describes an instant view page for a web page -//@page_blocks Content of the instant view page -//@view_count Number of the instant view views; 0 if unknown -//@version Version of the instant view; currently, can be 1 or 2 -//@is_rtl True, if the instant view must be shown from right to left -//@is_full True, if the instant view contains the full page. A network request might be needed to get the full instant view -//@feedback_link An internal link to be opened to leave feedback about the instant view -webPageInstantView#2c0ec99c page_blocks:vector view_count:int32 version:int32 is_rtl:Bool is_full:Bool feedback_link:InternalLinkType = WebPageInstantView; - -//@class LinkPreviewAlbumMedia @description Describes a media from a link preview album - -//@description The media is a photo -//@photo Photo description -linkPreviewAlbumMediaPhoto#c83db38e photo:photo = LinkPreviewAlbumMedia; - -//@description The media is a video -//@video Video description -linkPreviewAlbumMediaVideo#174856db video:video = LinkPreviewAlbumMedia; - -//@class LinkPreviewType @description Describes type of link preview - -//@description The link is a link to a media album consisting of photos and videos -//@media The list of album media -//@caption Album caption -linkPreviewTypeAlbum#186d97b4 media:vector caption:string = LinkPreviewType; - -//@description The link is a link to an animation -//@animation The animation -linkPreviewTypeAnimation#ad5cc534 animation:animation = LinkPreviewType; - -//@description The link is a link to an app at App Store or Google Play -//@photo Photo for the app -linkPreviewTypeApp#e3a68def photo:photo = LinkPreviewType; - -//@description The link is a link to a web site -//@photo Article's main photo; may be null -linkPreviewTypeArticle#7cce9bd9 photo:photo = LinkPreviewType; - -//@description The link is a link to an audio -//@audio The audio description -linkPreviewTypeAudio#75e407d2 audio:audio = LinkPreviewType; - -//@description The link is a link to a background. Link preview title and description are available only for filled backgrounds -//@document Document with the background; may be null for filled backgrounds -//@background_type Type of the background; may be null if unknown -linkPreviewTypeBackground#3a48a1e0 document:document background_type:BackgroundType = LinkPreviewType; - -//@description The link is a link to boost a channel chat -//@photo Photo of the chat; may be null -linkPreviewTypeChannelBoost#c6f40456 photo:chatPhoto = LinkPreviewType; - -//@description The link is a link to a chat -//@type Type of the chat -//@photo Photo of the chat; may be null -//@creates_join_request True, if the link only creates join request -linkPreviewTypeChat#ae2fa122 type:InviteLinkChatType photo:chatPhoto creates_join_request:Bool = LinkPreviewType; - -//@description The link is a link to a general file -//@document The document description -linkPreviewTypeDocument#bf0169a2 document:document = LinkPreviewType; - -//@description The link is a link to an animation player -//@url URL of the external animation player -//@thumbnail Thumbnail of the animation; may be null if unknown -//@duration Duration of the animation, in seconds -//@width Expected width of the embedded player -//@height Expected height of the embedded player -linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 url:string thumbnail:photo duration:int32 width:int32 height:int32 = LinkPreviewType; - -//@description The link is a link to an audio player -//@url URL of the external audio player -//@thumbnail Thumbnail of the audio; may be null if unknown -//@duration Duration of the audio, in seconds -//@width Expected width of the embedded player -//@height Expected height of the embedded player -linkPreviewTypeEmbeddedAudioPlayer#220b429c url:string thumbnail:photo duration:int32 width:int32 height:int32 = LinkPreviewType; - -//@description The link is a link to a video player -//@url URL of the external video player -//@thumbnail Thumbnail of the video; may be null if unknown -//@duration Duration of the video, in seconds -//@width Expected width of the embedded player -//@height Expected height of the embedded player -linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 url:string thumbnail:photo duration:int32 width:int32 height:int32 = LinkPreviewType; - -//@description The link is a link to an audio file -//@url URL of the audio file -//@mime_type MIME type of the audio file -//@duration Duration of the audio, in seconds; 0 if unknown -linkPreviewTypeExternalAudio#8a82ffed url:string mime_type:string duration:int32 = LinkPreviewType; - -//@description The link is a link to a video file -//@url URL of the video file -//@mime_type MIME type of the video file -//@width Expected width of the video preview; 0 if unknown -//@height Expected height of the video preview; 0 if unknown -//@duration Duration of the video, in seconds; 0 if unknown -linkPreviewTypeExternalVideo#517dcb98 url:string mime_type:string width:int32 height:int32 duration:int32 = LinkPreviewType; - -//@description The link is a link to an invoice -linkPreviewTypeInvoice#d47f48da = LinkPreviewType; - -//@description The link is a link to a text or a poll Telegram message -linkPreviewTypeMessage#19f4c19e = LinkPreviewType; - -//@description The link is a link to a photo -//@photo The photo -linkPreviewTypePhoto#aecfaaac photo:photo = LinkPreviewType; - -//@description The link is a link to a Telegram Premium gift code -linkPreviewTypePremiumGiftCode#4e0d80b1 = LinkPreviewType; - -//@description The link is a link to a shareable chat folder -linkPreviewTypeShareableChatFolder#805ab33c = LinkPreviewType; - -//@description The link is a link to a sticker -//@sticker The sticker. It can be an arbitrary WEBP image and can have dimensions bigger than 512 -linkPreviewTypeSticker#245f4d25 sticker:sticker = LinkPreviewType; - -//@description The link is a link to a sticker set -//@stickers Up to 4 stickers from the sticker set -linkPreviewTypeStickerSet#cb82a523 stickers:vector = LinkPreviewType; - -//@description The link is a link to a story. Link preview description is unavailable -//@story_sender_chat_id The identifier of the chat that posted the story -//@story_id Story identifier -linkPreviewTypeStory#1e9c87ce story_sender_chat_id:int53 story_id:int32 = LinkPreviewType; - -//@description The link is a link to boost a supergroup chat -//@photo Photo of the chat; may be null -linkPreviewTypeSupergroupBoost#90570476 photo:chatPhoto = LinkPreviewType; - -//@description The link is a link to a cloud theme. TDLib has no theme support yet -//@documents The list of files with theme description -//@settings Settings for the cloud theme; may be null if unknown -linkPreviewTypeTheme#6b7a9ba5 documents:vector settings:themeSettings = LinkPreviewType; - -//@description The link preview type is unsupported yet -linkPreviewTypeUnsupported#72b92cb9 = LinkPreviewType; - -//@description The link is a link to a user -//@photo Photo of the user; may be null if none -//@is_bot True, if the user is a bot -linkPreviewTypeUser#a8ad817c photo:chatPhoto is_bot:Bool = LinkPreviewType; - -//@description The link is a link to a video -//@video The video description -linkPreviewTypeVideo#10c9fc08 video:video = LinkPreviewType; - -//@description The link is a link to a video chat -//@photo Photo of the chat with the video chat; may be null if none -//@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group -linkPreviewTypeVideoChat#1908ee13 photo:chatPhoto is_live_stream:Bool = LinkPreviewType; - -//@description The link is a link to a video note message -//@video_note The video note -linkPreviewTypeVideoNote#cf70db61 video_note:videoNote = LinkPreviewType; - -//@description The link is a link to a voice note message -//@voice_note The voice note -linkPreviewTypeVoiceNote#d2d2cf2b voice_note:voiceNote = LinkPreviewType; - -//@description The link is a link to a Web App -//@photo Web App photo; may be null if none -linkPreviewTypeWebApp#a62eef8a photo:photo = LinkPreviewType; - -//@description Describes a link preview -//@url Original URL of the link -//@display_url URL to display -//@site_name Short name of the site (e.g., Google Docs, App Store) -//@title Title of the content -//@param_description Description of the content -//@author Author of the content -//@type Type of the link preview -//@has_large_media True, if size of media in the preview can be changed -//@show_large_media True, if large media preview must be shown; otherwise, the media preview must be shown small and only the first frame must be shown for videos -//@show_media_above_description True, if media must be shown above link preview description; otherwise, the media must be shown below the description -//@skip_confirmation True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear -//@show_above_text True, if the link preview must be shown above message text; otherwise, the link preview must be shown below the message text -//@instant_view_version Version of instant view (currently, can be 1 or 2) for the web page; 0 if none -linkPreview#6714d1f2 url:string display_url:string site_name:string title:string description:formattedText author:string type:LinkPreviewType has_large_media:Bool show_large_media:Bool show_media_above_description:Bool skip_confirmation:Bool show_above_text:Bool instant_view_version:int32 = LinkPreview; - -//@description Contains information about a country -//@country_code A two-letter ISO 3166-1 alpha-2 country code -//@name Native name of the country -//@english_name English name of the country -//@is_hidden True, if the country must be hidden from the list of all countries -//@calling_codes List of country calling codes -countryInfo#d9936dff country_code:string name:string english_name:string is_hidden:Bool calling_codes:vector = CountryInfo; - -//@description Contains information about countries -//@countries The list of countries -countries#94b50e0f countries:vector = Countries; - -//@description Contains information about a phone number -//@country Information about the country to which the phone number belongs; may be null -//@country_calling_code The part of the phone number denoting country calling code or its part -//@formatted_phone_number The phone number without country calling code formatted accordingly to local rules. Expected digits are returned as '-', but even more digits might be entered by the user -//@is_anonymous True, if the phone number was bought at https://fragment.com and isn't tied to a SIM card. Information about the phone number can be received using getCollectibleItemInfo -phoneNumberInfo#d2c398a1 country:countryInfo country_calling_code:string formatted_phone_number:string is_anonymous:Bool = PhoneNumberInfo; - -//@class CollectibleItemType @description Describes a collectible item that can be purchased at https://fragment.com - -//@description A username -//@username The username -collectibleItemTypeUsername#1b56e7d1 username:string = CollectibleItemType; - -//@description A phone number -//@phone_number The phone number -collectibleItemTypePhoneNumber#4ae0e142 phone_number:string = CollectibleItemType; - -//@description Contains information about a collectible item and its last purchase -//@purchase_date Point in time (Unix timestamp) when the item was purchased -//@currency Currency for the paid amount -//@amount The paid amount, in the smallest units of the currency -//@cryptocurrency Cryptocurrency used to pay for the item -//@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency -//@url Individual URL for the item on https://fragment.com -collectibleItemInfo#570f9bcd purchase_date:int32 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 url:string = CollectibleItemInfo; - -//@description Describes an action associated with a bank card number -//@text Action text -//@url The URL to be opened -bankCardActionOpenUrl#f44a5885 text:string url:string = BankCardActionOpenUrl; - -//@description Information about a bank card -//@title Title of the bank card description -//@actions Actions that can be done with the bank card number -bankCardInfo#2bc7da9f title:string actions:vector = BankCardInfo; - -//@description Describes an address -//@country_code A two-letter ISO 3166-1 alpha-2 country code -//@state State, if applicable -//@city City -//@street_line1 First line of the address -//@street_line2 Second line of the address -//@postal_code Address postal code -address#86304f3a country_code:string state:string city:string street_line1:string street_line2:string postal_code:string = Address; - -//@description Describes an address of a location -//@country_code A two-letter ISO 3166-1 alpha-2 country code -//@state State, if applicable; empty if unknown -//@city City; empty if unknown -//@street The address; empty if unknown -locationAddress#a3dad322 country_code:string state:string city:string street:string = LocationAddress; - -//@description Portion of the price of a product (e.g., "delivery cost", "tax amount") -//@label Label for this portion of the product price -//@amount Currency amount in the smallest units of the currency -labeledPricePart#20f2e726 label:string amount:int53 = LabeledPricePart; - -//@description Product invoice -//@currency ISO 4217 currency code -//@price_parts A list of objects used to calculate the total price of the product -//@subscription_period The number of seconds between consecutive Telegram Star debiting for subscription invoices; 0 if the invoice doesn't create subscription -//@max_tip_amount The maximum allowed amount of tip in the smallest units of the currency -//@suggested_tip_amounts Suggested amounts of tip in the smallest units of the currency -//@recurring_payment_terms_of_service_url An HTTP URL with terms of service for recurring payments. If non-empty, the invoice payment will result in recurring payments and the user must accept the terms of service before allowed to pay -//@terms_of_service_url An HTTP URL with terms of service for non-recurring payments. If non-empty, then the user must accept the terms of service before allowed to pay -//@is_test True, if the payment is a test payment -//@need_name True, if the user's name is needed for payment -//@need_phone_number True, if the user's phone number is needed for payment -//@need_email_address True, if the user's email address is needed for payment -//@need_shipping_address True, if the user's shipping address is needed for payment -//@send_phone_number_to_provider True, if the user's phone number will be sent to the provider -//@send_email_address_to_provider True, if the user's email address will be sent to the provider -//@is_flexible True, if the total price depends on the shipping method -invoice#67dc0e89 currency:string price_parts:vector subscription_period:int32 max_tip_amount:int53 suggested_tip_amounts:vector recurring_payment_terms_of_service_url:string terms_of_service_url:string is_test:Bool need_name:Bool need_phone_number:Bool need_email_address:Bool need_shipping_address:Bool send_phone_number_to_provider:Bool send_email_address_to_provider:Bool is_flexible:Bool = Invoice; - -//@description Order information -//@name Name of the user -//@phone_number Phone number of the user -//@email_address Email address of the user -//@shipping_address Shipping address for this order; may be null -orderInfo#2ebad96e name:string phone_number:string email_address:string shipping_address:address = OrderInfo; - -//@description One shipping option -//@id Shipping option identifier -//@title Option title -//@price_parts A list of objects used to calculate the total shipping costs -shippingOption#731bffce id:string title:string price_parts:vector = ShippingOption; - -//@description Contains information about saved payment credentials -//@id Unique identifier of the saved credentials -//@title Title of the saved credentials -savedCredentials#e9ee14dc id:string title:string = SavedCredentials; - -//@class InputCredentials @description Contains information about the payment method chosen by the user - -//@description Applies if a user chooses some previously saved payment credentials. To use their previously saved credentials, the user must have a valid temporary password -//@saved_credentials_id Identifier of the saved credentials -inputCredentialsSaved#86bdbe2c saved_credentials_id:string = InputCredentials; - -//@description Applies if a user enters new credentials on a payment provider website -//@data JSON-encoded data with the credential identifier from the payment provider -//@allow_save True, if the credential identifier can be saved on the server side -inputCredentialsNew#ce8bf12a data:string allow_save:Bool = InputCredentials; - -//@description Applies if a user enters new credentials using Apple Pay -//@data JSON-encoded data with the credential identifier -inputCredentialsApplePay#b5b2d6d1 data:string = InputCredentials; - -//@description Applies if a user enters new credentials using Google Pay -//@data JSON-encoded data with the credential identifier -inputCredentialsGooglePay#32544764 data:string = InputCredentials; - -//@class PaymentProvider @description Contains information about a payment provider - -//@description Smart Glocal payment provider -//@public_token Public payment token -//@tokenize_url URL for sending card tokenization requests -paymentProviderSmartGlocal#ba047774 public_token:string tokenize_url:string = PaymentProvider; - -//@description Stripe payment provider -//@publishable_key Stripe API publishable key -//@need_country True, if the user country must be provided -//@need_postal_code True, if the user ZIP/postal code must be provided -//@need_cardholder_name True, if the cardholder name must be provided -paymentProviderStripe#1614e19b publishable_key:string need_country:Bool need_postal_code:Bool need_cardholder_name:Bool = PaymentProvider; - -//@description Some other payment provider, for which a web payment form must be shown -//@url Payment form URL -paymentProviderOther#b050e0e4 url:string = PaymentProvider; - -//@description Describes an additional payment option -//@title Title for the payment option -//@url Payment form URL to be opened in a web view -paymentOption#ee79989b title:string url:string = PaymentOption; - -//@class PaymentFormType @description Describes type of payment form - -//@description The payment form is for a regular payment -//@invoice Full information about the invoice -//@payment_provider_user_id User identifier of the payment provider bot -//@payment_provider Information about the payment provider -//@additional_payment_options The list of additional payment options -//@saved_order_info Saved server-side order information; may be null -//@saved_credentials The list of saved payment credentials -//@can_save_credentials True, if the user can choose to save credentials -//@need_password True, if the user will be able to save credentials, if sets up a 2-step verification password -paymentFormTypeRegular#ba6d2f0f invoice:invoice payment_provider_user_id:int53 payment_provider:PaymentProvider additional_payment_options:vector saved_order_info:orderInfo saved_credentials:vector can_save_credentials:Bool need_password:Bool = PaymentFormType; - -//@description The payment form is for a payment in Telegram Stars -//@star_count Number of Telegram Stars that will be paid -paymentFormTypeStars#56b9d3d star_count:int53 = PaymentFormType; - -//@description The payment form is for a payment in Telegram Stars for subscription -//@pricing Information about subscription plan -paymentFormTypeStarSubscription#102deb5b pricing:starSubscriptionPricing = PaymentFormType; - -//@description Contains information about an invoice payment form -//@id The payment form identifier -//@type Type of the payment form -//@seller_bot_user_id User identifier of the seller bot -//@product_info Information about the product -paymentForm#7720ffb3 id:int64 type:PaymentFormType seller_bot_user_id:int53 product_info:productInfo = PaymentForm; - -//@description Contains a temporary identifier of validated order information, which is stored for one hour, and the available shipping options -//@order_info_id Temporary identifier of the order information -//@shipping_options Available shipping options -validatedOrderInfo#ac585f14 order_info_id:string shipping_options:vector = ValidatedOrderInfo; - -//@description Contains the result of a payment request -//@success True, if the payment request was successful; otherwise, the verification_url will be non-empty -//@verification_url URL for additional payment credentials verification -paymentResult#d00fe85d success:Bool verification_url:string = PaymentResult; - -//@class PaymentReceiptType @description Describes type of successful payment - -//@description The payment was done using a third-party payment provider -//@payment_provider_user_id User identifier of the payment provider bot -//@invoice Information about the invoice -//@order_info Order information; may be null -//@shipping_option Chosen shipping option; may be null -//@credentials_title Title of the saved credentials chosen by the buyer -//@tip_amount The amount of tip chosen by the buyer in the smallest units of the currency -paymentReceiptTypeRegular#9e7715b6 payment_provider_user_id:int53 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string tip_amount:int53 = PaymentReceiptType; - -//@description The payment was done using Telegram Stars -//@star_count Number of Telegram Stars that were paid -//@transaction_id Unique identifier of the transaction that can be used to dispute it -paymentReceiptTypeStars#1194074c star_count:int53 transaction_id:string = PaymentReceiptType; - -//@description Contains information about a successful payment -//@product_info Information about the product -//@date Point in time (Unix timestamp) when the payment was made -//@seller_bot_user_id User identifier of the seller bot -//@type Type of the payment receipt -paymentReceipt#2d313392 product_info:productInfo date:int32 seller_bot_user_id:int53 type:PaymentReceiptType = PaymentReceipt; - -//@class InputInvoice @description Describes an invoice to process - -//@description An invoice from a message of the type messageInvoice or paid media purchase from messagePaidMedia -//@chat_id Chat identifier of the message -//@message_id Message identifier. Use messageProperties.can_be_paid to check whether the message can be used in the method -inputInvoiceMessage#58dcea10 chat_id:int53 message_id:int53 = InputInvoice; - -//@description An invoice from a link of the type internalLinkTypeInvoice -//@name Name of the invoice -inputInvoiceName#b1ca16f3 name:string = InputInvoice; - -//@description An invoice for a payment toward Telegram; must not be used in the in-store apps -//@purpose Transaction purpose -inputInvoiceTelegram#96ecfeed purpose:TelegramPaymentPurpose = InputInvoice; - -//@class PaidMedia @description Describes a paid media - -//@description The media is hidden until the invoice is paid -//@width Media width; 0 if unknown -//@height Media height; 0 if unknown -//@duration Media duration, in seconds; 0 if unknown -//@minithumbnail Media minithumbnail; may be null -paidMediaPreview#bcc1c474 width:int32 height:int32 duration:int32 minithumbnail:minithumbnail = PaidMedia; - -//@description The media is a photo -//@photo The photo -paidMediaPhoto#ba82551a photo:photo = PaidMedia; - -//@description The media is a video -//@video The video -paidMediaVideo#1bb52e09 video:video = PaidMedia; - -//@description The media is unsupported -paidMediaUnsupported#6bc3e26 = PaidMedia; - -//@description Describes parameters of a giveaway -//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, -//@additional_chat_ids Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats -//@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways -//@only_new_members True, if only new members of the chats will be eligible for the giveaway -//@has_public_winners True, if the list of winners of the giveaway will be available to everyone -//@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. -//@prize_description Additional description of the giveaway prize; 0-128 characters -giveawayParameters#16f1de3d boosted_chat_id:int53 additional_chat_ids:vector winners_selection_date:int32 only_new_members:Bool has_public_winners:Bool country_codes:vector prize_description:string = GiveawayParameters; - -//@description File with the date it was uploaded -//@file The file -//@date Point in time (Unix timestamp) when the file was uploaded -datedFile#9247b09d file:file date:int32 = DatedFile; - -//@class PassportElementType @description Contains the type of Telegram Passport element - -//@description A Telegram Passport element containing the user's personal details -passportElementTypePersonalDetails#c27ad953 = PassportElementType; - -//@description A Telegram Passport element containing the user's passport -passportElementTypePassport#e5fdab48 = PassportElementType; - -//@description A Telegram Passport element containing the user's driver license -passportElementTypeDriverLicense#6cea5c4b = PassportElementType; - -//@description A Telegram Passport element containing the user's identity card -passportElementTypeIdentityCard#e20ea75c = PassportElementType; - -//@description A Telegram Passport element containing the user's internal passport -passportElementTypeInternalPassport#d0afd939 = PassportElementType; - -//@description A Telegram Passport element containing the user's address -passportElementTypeAddress#1d955cc2 = PassportElementType; - -//@description A Telegram Passport element containing the user's utility bill -passportElementTypeUtilityBill#25608e6a = PassportElementType; - -//@description A Telegram Passport element containing the user's bank statement -passportElementTypeBankStatement#22380133 = PassportElementType; - -//@description A Telegram Passport element containing the user's rental agreement -passportElementTypeRentalAgreement#852dfe90 = PassportElementType; - -//@description A Telegram Passport element containing the registration page of the user's passport -passportElementTypePassportRegistration#f67e8e3f = PassportElementType; - -//@description A Telegram Passport element containing the user's temporary registration -passportElementTypeTemporaryRegistration#411e345f = PassportElementType; - -//@description A Telegram Passport element containing the user's phone number -passportElementTypePhoneNumber#c4abfe6c = PassportElementType; - -//@description A Telegram Passport element containing the user's email address -passportElementTypeEmailAddress#fb45a6c3 = PassportElementType; - -//@description Represents a date according to the Gregorian calendar -//@day Day of the month; 1-31 -//@month Month; 1-12 -//@year Year; 1-9999 -date#ef6eb6a0 day:int32 month:int32 year:int32 = Date; - -//@description Contains the user's personal details -//@first_name First name of the user written in English; 1-255 characters -//@middle_name Middle name of the user written in English; 0-255 characters -//@last_name Last name of the user written in English; 1-255 characters -//@native_first_name Native first name of the user; 1-255 characters -//@native_middle_name Native middle name of the user; 0-255 characters -//@native_last_name Native last name of the user; 1-255 characters -//@birthdate Birthdate of the user -//@gender Gender of the user, "male" or "female" -//@country_code A two-letter ISO 3166-1 alpha-2 country code of the user's country -//@residence_country_code A two-letter ISO 3166-1 alpha-2 country code of the user's residence country -personalDetails#c0b869b7 first_name:string middle_name:string last_name:string native_first_name:string native_middle_name:string native_last_name:string birthdate:date gender:string country_code:string residence_country_code:string = PersonalDetails; - -//@description An identity document -//@number Document number; 1-24 characters -//@expiration_date Document expiration date; may be null if not applicable -//@front_side Front side of the document -//@reverse_side Reverse side of the document; only for driver license and identity card; may be null -//@selfie Selfie with the document; may be null -//@translation List of files containing a certified English translation of the document -identityDocument#289299ff number:string expiration_date:date front_side:datedFile reverse_side:datedFile selfie:datedFile translation:vector = IdentityDocument; - -//@description An identity document to be saved to Telegram Passport -//@number Document number; 1-24 characters -//@expiration_date Document expiration date; pass null if not applicable -//@front_side Front side of the document -//@reverse_side Reverse side of the document; only for driver license and identity card; pass null otherwise -//@selfie Selfie with the document; pass null if unavailable -//@translation List of files containing a certified English translation of the document -inputIdentityDocument#185f2052 number:string expiration_date:date front_side:InputFile reverse_side:InputFile selfie:InputFile translation:vector = InputIdentityDocument; - -//@description A personal document, containing some information about a user -//@files List of files containing the pages of the document -//@translation List of files containing a certified English translation of the document -personalDocument#a8357e38 files:vector translation:vector = PersonalDocument; - -//@description A personal document to be saved to Telegram Passport -//@files List of files containing the pages of the document -//@translation List of files containing a certified English translation of the document -inputPersonalDocument#bb343fae files:vector translation:vector = InputPersonalDocument; - -//@class PassportElement @description Contains information about a Telegram Passport element - -//@description A Telegram Passport element containing the user's personal details -//@personal_details Personal details of the user -passportElementPersonalDetails#4894fe83 personal_details:personalDetails = PassportElement; - -//@description A Telegram Passport element containing the user's passport -//@passport Passport -passportElementPassport#f043e723 passport:identityDocument = PassportElement; - -//@description A Telegram Passport element containing the user's driver license -//@driver_license Driver license -passportElementDriverLicense#61f70cad driver_license:identityDocument = PassportElement; - -//@description A Telegram Passport element containing the user's identity card -//@identity_card Identity card -passportElementIdentityCard#7c33e535 identity_card:identityDocument = PassportElement; - -//@description A Telegram Passport element containing the user's internal passport -//@internal_passport Internal passport -passportElementInternalPassport#228ad87 internal_passport:identityDocument = PassportElement; - -//@description A Telegram Passport element containing the user's address -//@address Address -passportElementAddress#d15a1630 address:address = PassportElement; - -//@description A Telegram Passport element containing the user's utility bill -//@utility_bill Utility bill -passportElementUtilityBill#f2041dd2 utility_bill:personalDocument = PassportElement; - -//@description A Telegram Passport element containing the user's bank statement -//@bank_statement Bank statement -passportElementBankStatement#ea283268 bank_statement:personalDocument = PassportElement; - -//@description A Telegram Passport element containing the user's rental agreement -//@rental_agreement Rental agreement -passportElementRentalAgreement#eeb4cb28 rental_agreement:personalDocument = PassportElement; - -//@description A Telegram Passport element containing the user's passport registration pages -//@passport_registration Passport registration pages -passportElementPassportRegistration#24dadc7f passport_registration:personalDocument = PassportElement; - -//@description A Telegram Passport element containing the user's temporary registration -//@temporary_registration Temporary registration -passportElementTemporaryRegistration#49c4aff0 temporary_registration:personalDocument = PassportElement; - -//@description A Telegram Passport element containing the user's phone number -//@phone_number Phone number -passportElementPhoneNumber#b1509799 phone_number:string = PassportElement; - -//@description A Telegram Passport element containing the user's email address -//@email_address Email address -passportElementEmailAddress#a4ea9805 email_address:string = PassportElement; - -//@class InputPassportElement @description Contains information about a Telegram Passport element to be saved - -//@description A Telegram Passport element to be saved containing the user's personal details -//@personal_details Personal details of the user -inputPassportElementPersonalDetails#9d2843f personal_details:personalDetails = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's passport -//@passport The passport to be saved -inputPassportElementPassport#e2603564 passport:inputIdentityDocument = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's driver license -//@driver_license The driver license to be saved -inputPassportElementDriverLicense#122b14d0 driver_license:inputIdentityDocument = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's identity card -//@identity_card The identity card to be saved -inputPassportElementIdentityCard#ff67f882 identity_card:inputIdentityDocument = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's internal passport -//@internal_passport The internal passport to be saved -inputPassportElementInternalPassport#2aa3872b internal_passport:inputIdentityDocument = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's address -//@address The address to be saved -inputPassportElementAddress#1b83ec10 address:address = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's utility bill -//@utility_bill The utility bill to be saved -inputPassportElementUtilityBill#52cd9181 utility_bill:inputPersonalDocument = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's bank statement -//@bank_statement The bank statement to be saved -inputPassportElementBankStatement#fe6a5788 bank_statement:inputPersonalDocument = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's rental agreement -//@rental_agreement The rental agreement to be saved -inputPassportElementRentalAgreement#677b9c2b rental_agreement:inputPersonalDocument = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's passport registration -//@passport_registration The passport registration page to be saved -inputPassportElementPassportRegistration#4e5aa050 passport_registration:inputPersonalDocument = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's temporary registration -//@temporary_registration The temporary registration document to be saved -inputPassportElementTemporaryRegistration#8df64de1 temporary_registration:inputPersonalDocument = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's phone number -//@phone_number The phone number to be saved -inputPassportElementPhoneNumber#4ea3cc39 phone_number:string = InputPassportElement; - -//@description A Telegram Passport element to be saved containing the user's email address -//@email_address The email address to be saved -inputPassportElementEmailAddress#f12e9425 email_address:string = InputPassportElement; - -//@description Contains information about saved Telegram Passport elements -//@elements Telegram Passport elements -passportElements#bd8eaceb elements:vector = PassportElements; - -//@class PassportElementErrorSource @description Contains the description of an error in a Telegram Passport element - -//@description The element contains an error in an unspecified place. The error will be considered resolved when new data is added -passportElementErrorSourceUnspecified#e9734842 = PassportElementErrorSource; - -//@description One of the data fields contains an error. The error will be considered resolved when the value of the field changes -//@field_name Field name -passportElementErrorSourceDataField#ed9a5ce8 field_name:string = PassportElementErrorSource; - -//@description The front side of the document contains an error. The error will be considered resolved when the file with the front side changes -passportElementErrorSourceFrontSide#70fd7334 = PassportElementErrorSource; - -//@description The reverse side of the document contains an error. The error will be considered resolved when the file with the reverse side changes -passportElementErrorSourceReverseSide#725bf9f7 = PassportElementErrorSource; - -//@description The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes -passportElementErrorSourceSelfie#d07e1428 = PassportElementErrorSource; - -//@description One of files with the translation of the document contains an error. The error will be considered resolved when the file changes -//@file_index Index of a file with the error -passportElementErrorSourceTranslationFile#d6e53714 file_index:int32 = PassportElementErrorSource; - -//@description The translation of the document contains an error. The error will be considered resolved when the list of translation files changes -passportElementErrorSourceTranslationFiles#22a5a41c = PassportElementErrorSource; - -//@description The file contains an error. The error will be considered resolved when the file changes -//@file_index Index of a file with the error -passportElementErrorSourceFile#786c3b30 file_index:int32 = PassportElementErrorSource; - -//@description The list of attached files contains an error. The error will be considered resolved when the list of files changes -passportElementErrorSourceFiles#70e6a6d2 = PassportElementErrorSource; - -//@description Contains the description of an error in a Telegram Passport element -//@type Type of the Telegram Passport element which has the error -//@message Error message -//@source Error source -passportElementError#91059fc5 type:PassportElementType message:string source:PassportElementErrorSource = PassportElementError; - -//@description Contains information about a Telegram Passport element that was requested by a service -//@type Type of the element -//@is_selfie_required True, if a selfie is required with the identity document -//@is_translation_required True, if a certified English translation is required with the document -//@is_native_name_required True, if personal details must include the user's name in the language of their country of residence -passportSuitableElement#d0f8831c type:PassportElementType is_selfie_required:Bool is_translation_required:Bool is_native_name_required:Bool = PassportSuitableElement; - -//@description Contains a description of the required Telegram Passport element that was requested by a service -//@suitable_elements List of Telegram Passport elements any of which is enough to provide -passportRequiredElement#f2ad05fd suitable_elements:vector = PassportRequiredElement; - -//@description Contains information about a Telegram Passport authorization form that was requested -//@id Unique identifier of the authorization form -//@required_elements Telegram Passport elements that must be provided to complete the form -//@privacy_policy_url URL for the privacy policy of the service; may be empty -passportAuthorizationForm#3fe28cb0 id:int32 required_elements:vector privacy_policy_url:string = PassportAuthorizationForm; - -//@description Contains information about a Telegram Passport elements and corresponding errors -//@elements Telegram Passport elements -//@errors Errors in the elements that are already available -passportElementsWithErrors#438d1abf elements:vector errors:vector = PassportElementsWithErrors; - -//@description Contains encrypted Telegram Passport data credentials -//@data The encrypted credentials -//@hash The decrypted data hash -//@secret Secret for data decryption, encrypted with the service's public key -encryptedCredentials#4f5713ce data:bytes hash:bytes secret:bytes = EncryptedCredentials; - -//@description Contains information about an encrypted Telegram Passport element; for bots only -//@type Type of Telegram Passport element -//@data Encrypted JSON-encoded data about the user -//@front_side The front side of an identity document -//@reverse_side The reverse side of an identity document; may be null -//@selfie Selfie with the document; may be null -//@translation List of files containing a certified English translation of the document -//@files List of attached files -//@value Unencrypted data, phone number or email address -//@hash Hash of the entire element -encryptedPassportElement#262d248 type:PassportElementType data:bytes front_side:datedFile reverse_side:datedFile selfie:datedFile translation:vector files:vector value:string hash:string = EncryptedPassportElement; - -//@class InputPassportElementErrorSource @description Contains the description of an error in a Telegram Passport element; for bots only - -//@description The element contains an error in an unspecified place. The error will be considered resolved when new data is added -//@element_hash Current hash of the entire element -inputPassportElementErrorSourceUnspecified#fed9c6f element_hash:bytes = InputPassportElementErrorSource; - -//@description A data field contains an error. The error is considered resolved when the field's value changes -//@field_name Field name -//@data_hash Current data hash -inputPassportElementErrorSourceDataField#e68fa006 field_name:string data_hash:bytes = InputPassportElementErrorSource; - -//@description The front side of the document contains an error. The error is considered resolved when the file with the front side of the document changes -//@file_hash Current hash of the file containing the front side -inputPassportElementErrorSourceFrontSide#230c87bd file_hash:bytes = InputPassportElementErrorSource; - -//@description The reverse side of the document contains an error. The error is considered resolved when the file with the reverse side of the document changes -//@file_hash Current hash of the file containing the reverse side -inputPassportElementErrorSourceReverseSide#189efdfb file_hash:bytes = InputPassportElementErrorSource; - -//@description The selfie contains an error. The error is considered resolved when the file with the selfie changes -//@file_hash Current hash of the file containing the selfie -inputPassportElementErrorSourceSelfie#d1e42c98 file_hash:bytes = InputPassportElementErrorSource; - -//@description One of the files containing the translation of the document contains an error. The error is considered resolved when the file with the translation changes -//@file_hash Current hash of the file containing the translation -inputPassportElementErrorSourceTranslationFile#1e268a7b file_hash:bytes = InputPassportElementErrorSource; - -//@description The translation of the document contains an error. The error is considered resolved when the list of files changes -//@file_hashes Current hashes of all files with the translation -inputPassportElementErrorSourceTranslationFiles#ef54819b file_hashes:vector = InputPassportElementErrorSource; - -//@description The file contains an error. The error is considered resolved when the file changes -//@file_hash Current hash of the file which has the error -inputPassportElementErrorSourceFile#ee355dcb file_hash:bytes = InputPassportElementErrorSource; - -//@description The list of attached files contains an error. The error is considered resolved when the file list changes -//@file_hashes Current hashes of all attached files -inputPassportElementErrorSourceFiles#673401d6 file_hashes:vector = InputPassportElementErrorSource; - -//@description Contains the description of an error in a Telegram Passport element; for bots only -//@type Type of Telegram Passport element that has the error -//@message Error message -//@source Error source -inputPassportElementError#11084de2 type:PassportElementType message:string source:InputPassportElementErrorSource = InputPassportElementError; - -//@class MessageContent @description Contains the content of a message - -//@description A text message -//@text Text of the message -//@link_preview A link preview attached to the message; may be null -//@link_preview_options Options which were used for generation of the link preview; may be null if default options were used -messageText#68654c84 text:formattedText link_preview:linkPreview link_preview_options:linkPreviewOptions = MessageContent; - -//@description An animation message (GIF-style). -//@animation The animation description -//@caption Animation caption -//@show_caption_above_media True, if the caption must be shown above the animation; otherwise, the caption must be shown below the animation -//@has_spoiler True, if the animation preview must be covered by a spoiler animation -//@is_secret True, if the animation thumbnail must be blurred and the animation must be shown only while tapped -messageAnimation#8ecb1128 animation:animation caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; - -//@description An audio message -//@audio The audio description -//@caption Audio caption -messageAudio#107e741c audio:audio caption:formattedText = MessageContent; - -//@description A document message (general file) -//@document The document description -//@caption Document caption -messageDocument#2394ab77 document:document caption:formattedText = MessageContent; - -//@description A message with paid media -//@star_count Number of Telegram Stars needed to buy access to the media in the message -//@media Information about the media -//@caption Media caption -//@show_caption_above_media True, if the caption must be shown above the media; otherwise, the caption must be shown below the media -messagePaidMedia#3e5fd7c2 star_count:int53 media:vector caption:formattedText show_caption_above_media:Bool = MessageContent; - -//@description A photo message -//@photo The photo -//@caption Photo caption -//@show_caption_above_media True, if the caption must be shown above the photo; otherwise, the caption must be shown below the photo -//@has_spoiler True, if the photo preview must be covered by a spoiler animation -//@is_secret True, if the photo must be blurred and must be shown only while tapped -messagePhoto#754c7e1f photo:photo caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; - -//@description A sticker message -//@sticker The sticker description -//@is_premium True, if premium animation of the sticker must be played -messageSticker#e5f0dcca sticker:sticker is_premium:Bool = MessageContent; - -//@description A video message -//@video The video description -//@alternative_videos Alternative qualities of the video -//@caption Video caption -//@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video -//@has_spoiler True, if the video preview must be covered by a spoiler animation -//@is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped -messageVideo#fdcc35d5 video:video alternative_videos:vector caption:formattedText show_caption_above_media:Bool has_spoiler:Bool is_secret:Bool = MessageContent; - -//@description A video note message -//@video_note The video note description -//@is_viewed True, if at least one of the recipients has viewed the video note -//@is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped -messageVideoNote#396b2486 video_note:videoNote is_viewed:Bool is_secret:Bool = MessageContent; - -//@description A voice note message -//@voice_note The voice note description -//@caption Voice note caption -//@is_listened True, if at least one of the recipients has listened to the voice note -messageVoiceNote#1f753ff5 voice_note:voiceNote caption:formattedText is_listened:Bool = MessageContent; - -//@description A self-destructed photo message -messageExpiredPhoto#ac46ddf7 = MessageContent; - -//@description A self-destructed video message -messageExpiredVideo#b7bf24c3 = MessageContent; - -//@description A self-destructed video note message -messageExpiredVideoNote#23bc43e7 = MessageContent; - -//@description A self-destructed voice note message -messageExpiredVoiceNote#890757d = MessageContent; - -//@description A message with a location -//@location The location description -//@live_period Time relative to the message send date, for which the location can be updated, in seconds; if 0x7FFFFFFF, then location can be updated forever -//@expires_in Left time for which the location can be updated, in seconds. If 0, then the location can't be updated anymore. The update updateMessageContent is not sent when this field changes -//@heading For live locations, a direction in which the location moves, in degrees; 1-360. If 0 the direction is unknown -//@proximity_alert_radius For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). 0 if the notification is disabled. Available only to the message sender -messageLocation#121e4474 location:location live_period:int32 expires_in:int32 heading:int32 proximity_alert_radius:int32 = MessageContent; - -//@description A message with information about a venue -//@venue The venue description -messageVenue#800f2175 venue:venue = MessageContent; - -//@description A message with a user contact -//@contact The contact description -messageContact#e1710c5a contact:contact = MessageContent; - -//@description A message with an animated emoji -//@animated_emoji The animated emoji -//@emoji The corresponding emoji -messageAnimatedEmoji#3621f5e2 animated_emoji:animatedEmoji emoji:string = MessageContent; - -//@description A dice message. The dice value is randomly generated by the server -//@initial_state The animated stickers with the initial dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known -//@final_state The animated stickers with the final dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known -//@emoji Emoji on which the dice throw animation is based -//@value The dice value. If the value is 0, the dice don't have final state yet -//@success_animation_frame_number Number of frame after which a success animation like a shower of confetti needs to be shown on updateMessageSendSucceeded -messageDice#42817239 initial_state:DiceStickers final_state:DiceStickers emoji:string value:int32 success_animation_frame_number:int32 = MessageContent; - -//@description A message with a game -//@game The game description -messageGame#fbdc6976 game:game = MessageContent; - -//@description A message with a poll -//@poll The poll description -messagePoll#d888b24d poll:poll = MessageContent; - -//@description A message with a forwarded story -//@story_sender_chat_id Identifier of the chat that posted the story -//@story_id Story identifier -//@via_mention True, if the story was automatically forwarded because of a mention of the user -messageStory#3329f2d4 story_sender_chat_id:int53 story_id:int32 via_mention:Bool = MessageContent; - -//@description A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice -//@product_info Information about the product -//@currency Currency for the product price -//@total_amount Product total price in the smallest units of the currency -//@start_parameter Unique invoice bot start_parameter to be passed to getInternalLink -//@is_test True, if the invoice is a test invoice -//@need_shipping_address True, if the shipping address must be specified -//@receipt_message_id The identifier of the message with the receipt, after the product has been purchased -//@paid_media Extended media attached to the invoice; may be null if none -//@paid_media_caption Extended media caption; may be null if none -messageInvoice#fadfd46 product_info:productInfo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 paid_media:PaidMedia paid_media_caption:formattedText = MessageContent; - -//@description A message with information about an ended call -//@is_video True, if the call was a video call -//@discard_reason Reason why the call was discarded -//@duration Call duration, in seconds -messageCall#201ede00 is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent; - -//@description A new video chat was scheduled -//@group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall -//@start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator -messageVideoChatScheduled#916c1db7 group_call_id:int32 start_date:int32 = MessageContent; - -//@description A newly created video chat -//@group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall -messageVideoChatStarted#1f114559 group_call_id:int32 = MessageContent; - -//@description A message with information about an ended video chat -//@duration Call duration, in seconds -messageVideoChatEnded#79262c57 duration:int32 = MessageContent; - -//@description A message with information about an invitation to a video chat -//@group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall -//@user_ids Invited user identifiers -messageInviteVideoChatParticipants#f58d603 group_call_id:int32 user_ids:vector = MessageContent; - -//@description A newly created basic group -//@title Title of the basic group -//@member_user_ids User identifiers of members in the basic group -messageBasicGroupChatCreate#8b60f757 title:string member_user_ids:vector = MessageContent; - -//@description A newly created supergroup or channel -//@title Title of the supergroup or channel -messageSupergroupChatCreate#e61cb71b title:string = MessageContent; - -//@description An updated chat title -//@title New chat title -messageChatChangeTitle#2c99bb41 title:string = MessageContent; - -//@description An updated chat photo -//@photo New chat photo -messageChatChangePhoto#cf84454b photo:chatPhoto = MessageContent; - -//@description A deleted chat photo -messageChatDeletePhoto#f502a9e7 = MessageContent; - -//@description New chat members were added -//@member_user_ids User identifiers of the new members -messageChatAddMembers#1e95b1cd member_user_ids:vector = MessageContent; - -//@description A new member joined the chat via an invite link -messageChatJoinByLink#6e0f407f = MessageContent; - -//@description A new member was accepted to the chat by an administrator -messageChatJoinByRequest#4740cb7c = MessageContent; - -//@description A chat member was deleted -//@user_id User identifier of the deleted chat member -messageChatDeleteMember#37e931a9 user_id:int53 = MessageContent; - -//@description A basic group was upgraded to a supergroup and was deactivated as the result -//@supergroup_id Identifier of the supergroup to which the basic group was upgraded -messageChatUpgradeTo#63f549b supergroup_id:int53 = MessageContent; - -//@description A supergroup has been created from a basic group -//@title Title of the newly created supergroup -//@basic_group_id The identifier of the original basic group -messageChatUpgradeFrom#136daadc title:string basic_group_id:int53 = MessageContent; - -//@description A message has been pinned -//@message_id Identifier of the pinned message, can be an identifier of a deleted message or 0 -messagePinMessage#38d55039 message_id:int53 = MessageContent; - -//@description A screenshot of a message in the chat has been taken -messageScreenshotTaken#a2b86dab = MessageContent; - -//@description A new background was set in the chat -//@old_background_message_id Identifier of the message with a previously set same background; 0 if none. Can be an identifier of a deleted message -//@background The new background -//@only_for_self True, if the background was set only for self -messageChatSetBackground#3d5d7c40 old_background_message_id:int53 background:chatBackground only_for_self:Bool = MessageContent; - -//@description A theme in the chat has been changed -//@theme_name If non-empty, name of a new theme, set for the chat. Otherwise, chat theme was reset to the default one -messageChatSetTheme#99ae9408 theme_name:string = MessageContent; - -//@description The auto-delete or self-destruct timer for messages in the chat has been changed -//@message_auto_delete_time New value auto-delete or self-destruct time, in seconds; 0 if disabled -//@from_user_id If not 0, a user identifier, which default setting was automatically applied -messageChatSetMessageAutoDeleteTime#619e052e message_auto_delete_time:int32 from_user_id:int53 = MessageContent; - -//@description The chat was boosted by the sender of the message -//@boost_count Number of times the chat was boosted -messageChatBoost#5e5f658b boost_count:int32 = MessageContent; - -//@description A forum topic has been created -//@name Name of the topic -//@icon Icon of the topic -messageForumTopicCreated#b8ce47d1 name:string icon:forumTopicIcon = MessageContent; - -//@description A forum topic has been edited -//@name If non-empty, the new name of the topic -//@edit_icon_custom_emoji_id True, if icon's custom_emoji_id is changed -//@icon_custom_emoji_id New unique identifier of the custom emoji shown on the topic icon; 0 if none. Must be ignored if edit_icon_custom_emoji_id is false -messageForumTopicEdited#c0b780 name:string edit_icon_custom_emoji_id:Bool icon_custom_emoji_id:int64 = MessageContent; - -//@description A forum topic has been closed or opened -//@is_closed True, if the topic was closed; otherwise, the topic was reopened -messageForumTopicIsClosedToggled#4b578fe0 is_closed:Bool = MessageContent; - -//@description A General forum topic has been hidden or unhidden -//@is_hidden True, if the topic was hidden; otherwise, the topic was unhidden -messageForumTopicIsHiddenToggled#979393fe is_hidden:Bool = MessageContent; - -//@description A profile photo was suggested to a user in a private chat -//@photo The suggested chat photo. Use the method setProfilePhoto with inputChatPhotoPrevious to apply the photo -messageSuggestProfilePhoto#b5611ee7 photo:chatPhoto = MessageContent; - -//@description A non-standard action has happened in the chat -//@text Message text to be shown in the chat -messageCustomServiceAction#5595c772 text:string = MessageContent; - -//@description A new high score was achieved in a game -//@game_message_id Identifier of the message with the game, can be an identifier of a deleted message -//@game_id Identifier of the game; may be different from the games presented in the message with the game -//@score New score -messageGameScore#50299d7f game_message_id:int53 game_id:int64 score:int32 = MessageContent; - -//@description A payment has been sent to a bot or a business account -//@invoice_chat_id Identifier of the chat, containing the corresponding invoice message -//@invoice_message_id Identifier of the message with the corresponding invoice; can be 0 or an identifier of a deleted message -//@currency Currency for the price of the product -//@total_amount Total price for the product, in the smallest units of the currency -//@subscription_until_date Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring -//@is_recurring True, if this is a recurring payment -//@is_first_recurring True, if this is the first recurring payment -//@invoice_name Name of the invoice; may be empty if unknown -messagePaymentSuccessful#3e661911 invoice_chat_id:int53 invoice_message_id:int53 currency:string total_amount:int53 subscription_until_date:int32 is_recurring:Bool is_first_recurring:Bool invoice_name:string = MessageContent; - -//@description A payment has been received by the bot or the business account -//@currency Currency for price of the product -//@total_amount Total price for the product, in the smallest units of the currency -//@subscription_until_date Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring -//@is_recurring True, if this is a recurring payment -//@is_first_recurring True, if this is the first recurring payment -//@invoice_payload Invoice payload -//@shipping_option_id Identifier of the shipping option chosen by the user; may be empty if not applicable; for bots only -//@order_info Information about the order; may be null; for bots only -//@telegram_payment_charge_id Telegram payment identifier -//@provider_payment_charge_id Provider payment identifier -messagePaymentSuccessfulBot#c7664dbf currency:string total_amount:int53 subscription_until_date:int32 is_recurring:Bool is_first_recurring:Bool invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; - -//@description A payment has been refunded -//@owner_id Identifier of the previous owner of the Telegram Stars that refunds them -//@currency Currency for the price of the product -//@total_amount Total price for the product, in the smallest units of the currency -//@invoice_payload Invoice payload; only for bots -//@telegram_payment_charge_id Telegram payment identifier -//@provider_payment_charge_id Provider payment identifier -messagePaymentRefunded#11bcb8f3 owner_id:MessageSender currency:string total_amount:int53 invoice_payload:bytes telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; - -//@description Telegram Premium was gifted to a user -//@gifter_user_id The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous or is outgoing -//@receiver_user_id The identifier of a user that received Telegram Premium; 0 if the gift is incoming -//@text Message added to the gifted Telegram Premium by the sender -//@currency Currency for the paid amount -//@amount The paid amount, in the smallest units of the currency -//@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none -//@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency; 0 if none -//@month_count Number of months the Telegram Premium subscription will be active -//@sticker A sticker to be shown in the message; may be null if unknown -messageGiftedPremium#e4d0e07a gifter_user_id:int53 receiver_user_id:int53 text:formattedText currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; - -//@description A Telegram Premium gift code was created for the user -//@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown -//@text Message added to the gift -//@is_from_giveaway True, if the gift code was created for a giveaway -//@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen -//@currency Currency for the paid amount; empty if unknown -//@amount The paid amount, in the smallest units of the currency; 0 if unknown -//@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none or unknown -//@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency; 0 if unknown -//@month_count Number of months the Telegram Premium subscription will be active after code activation -//@sticker A sticker to be shown in the message; may be null if unknown -//@code The gift code -messagePremiumGiftCode#29d22e4e creator_id:MessageSender text:formattedText is_from_giveaway:Bool is_unclaimed:Bool currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker code:string = MessageContent; - -//@description A giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway, storePaymentPurposePremiumGiveaway, telegramPaymentPurposeStarGiveaway, or storePaymentPurposeStarGiveaway to create a giveaway -//@star_count Number of Telegram Stars that will be shared by winners of the giveaway; 0 for Telegram Premium giveaways -messageGiveawayCreated#39f3639f star_count:int53 = MessageContent; - -//@description A giveaway -//@parameters Giveaway parameters -//@winner_count Number of users which will receive Telegram Premium subscription gift codes -//@prize Prize of the giveaway -//@sticker A sticker to be shown in the message; may be null if unknown -messageGiveaway#eb61daa8 parameters:giveawayParameters winner_count:int32 prize:GiveawayPrize sticker:sticker = MessageContent; - -//@description A giveaway without public winners has been completed for the chat -//@giveaway_message_id Identifier of the message with the giveaway; can be 0 if the message was deleted -//@winner_count Number of winners in the giveaway -//@is_star_giveaway True, if the giveaway is a Telegram Star giveaway -//@unclaimed_prize_count Number of undistributed prizes; for Telegram Premium giveaways only -messageGiveawayCompleted#e424c8f7 giveaway_message_id:int53 winner_count:int32 is_star_giveaway:Bool unclaimed_prize_count:int32 = MessageContent; - -//@description A giveaway with public winners has been completed for the chat -//@boosted_chat_id Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway -//@giveaway_message_id Identifier of the message with the giveaway in the boosted chat -//@additional_chat_count Number of other chats that participated in the giveaway -//@actual_winners_selection_date Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway -//@only_new_members True, if only new members of the chats were eligible for the giveaway -//@was_refunded True, if the giveaway was canceled and was fully refunded -//@prize Prize of the giveaway -//@prize_description Additional description of the giveaway prize -//@winner_count Total number of winners in the giveaway -//@winner_user_ids Up to 100 user identifiers of the winners of the giveaway -//@unclaimed_prize_count Number of undistributed prizes; for Telegram Premium giveaways only -messageGiveawayWinners#1d99a27a boosted_chat_id:int53 giveaway_message_id:int53 additional_chat_count:int32 actual_winners_selection_date:int32 only_new_members:Bool was_refunded:Bool prize:GiveawayPrize prize_description:string winner_count:int32 winner_user_ids:vector unclaimed_prize_count:int32 = MessageContent; - -//@description Telegram Stars were gifted to a user -//@gifter_user_id The identifier of a user that gifted Telegram Stars; 0 if the gift was anonymous or is outgoing -//@receiver_user_id The identifier of a user that received Telegram Stars; 0 if the gift is incoming -//@currency Currency for the paid amount -//@amount The paid amount, in the smallest units of the currency -//@cryptocurrency Cryptocurrency used to pay for the gift; may be empty if none -//@cryptocurrency_amount The paid amount, in the smallest units of the cryptocurrency; 0 if none -//@star_count Number of Telegram Stars that were gifted -//@transaction_id Identifier of the transaction for Telegram Stars purchase; for receiver only -//@sticker A sticker to be shown in the message; may be null if unknown -messageGiftedStars#41bdbea7 gifter_user_id:int53 receiver_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 star_count:int53 transaction_id:string sticker:sticker = MessageContent; - -//@description A Telegram Stars were received by the current user from a giveaway -//@star_count Number of Telegram Stars that were received -//@transaction_id Identifier of the transaction for Telegram Stars credit -//@boosted_chat_id Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway -//@giveaway_message_id Identifier of the message with the giveaway in the boosted chat; can be 0 if the message was deleted -//@is_unclaimed True, if the corresponding winner wasn't chosen and the Telegram Stars were received by the owner of the boosted chat -//@sticker A sticker to be shown in the message; may be null if unknown -messageGiveawayPrizeStars#aa0f5de3 star_count:int53 transaction_id:string boosted_chat_id:int53 giveaway_message_id:int53 is_unclaimed:Bool sticker:sticker = MessageContent; - -//@description A regular gift was received or sent by the current user -//@gift The gift -//@text Message added to the gift -//@sell_star_count Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver -//@prepaid_upgrade_star_count Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift -//@is_private True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them -//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift -//@can_be_upgraded True, if the gift can be upgraded to a unique gift; only for the receiver of the gift -//@was_converted True, if the gift was converted to Telegram Stars; only for the receiver of the gift -//@was_upgraded True, if the gift was upgraded to a unique gift -//@was_refunded True, if the gift was refunded and isn't available anymore -//@upgrade_message_id Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift with upgraded version of the gift; can be 0 if none or an identifier of a deleted message. -messageGift#621a3876 gift:gift text:formattedText sell_star_count:int53 prepaid_upgrade_star_count:int53 is_private:Bool is_saved:Bool can_be_upgraded:Bool was_converted:Bool was_upgraded:Bool was_refunded:Bool upgrade_message_id:int53 = MessageContent; - -//@description An upgraded gift was received or sent by the current user -//@gift The gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift -//@is_saved True, if the gift is displayed on the user's profile page; only for the receiver of the gift -//@can_be_transferred True, if the gift can be transferred to another user; only for the receiver of the gift -//@was_transferred True, if the gift was transferred to another user; only for the receiver of the gift -//@transfer_star_count Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift -//@export_date Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the gift -messageUpgradedGift#4932f215 gift:upgradedGift is_upgrade:Bool is_saved:Bool can_be_transferred:Bool was_transferred:Bool transfer_star_count:int53 export_date:int32 = MessageContent; - -//@description A gift which purchase, upgrade or transfer were refunded -//@gift The gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift -messageRefundedUpgradedGift#d373886d gift:gift is_upgrade:Bool = MessageContent; - -//@description A contact has registered with Telegram -messageContactRegistered#a678fcff = MessageContent; - -//@description The current user shared users, which were requested by the bot -//@users The shared users -//@button_id Identifier of the keyboard button with the request -messageUsersShared#7f1f4a22 users:vector button_id:int32 = MessageContent; - -//@description The current user shared a chat, which was requested by the bot -//@chat The shared chat -//@button_id Identifier of the keyboard button with the request -messageChatShared#aec6d961 chat:sharedChat button_id:int32 = MessageContent; - -//@description The user allowed the bot to send messages -//@reason The reason why the bot was allowed to write messages -messageBotWriteAccessAllowed#9a8ab7b4 reason:BotWriteAccessAllowReason = MessageContent; - -//@description Data from a Web App has been sent to a bot -//@button_text Text of the keyboardButtonTypeWebApp button, which opened the Web App -messageWebAppDataSent#fb033912 button_text:string = MessageContent; - -//@description Data from a Web App has been received; for bots only -//@button_text Text of the keyboardButtonTypeWebApp button, which opened the Web App -//@data The data -messageWebAppDataReceived#ff7d1a15 button_text:string data:string = MessageContent; - -//@description Telegram Passport data has been sent to a bot -//@types List of Telegram Passport element types sent -messagePassportDataSent#26c5ed6b types:vector = MessageContent; - -//@description Telegram Passport data has been received; for bots only -//@elements List of received Telegram Passport elements -//@credentials Encrypted data credentials -messagePassportDataReceived#e0b936b9 elements:vector credentials:encryptedCredentials = MessageContent; - -//@description A user in the chat came within proximity alert range -//@traveler_id The identifier of a user or chat that triggered the proximity alert -//@watcher_id The identifier of a user or chat that subscribed for the proximity alert -//@distance The distance between the users -messageProximityAlertTriggered#409f6d3 traveler_id:MessageSender watcher_id:MessageSender distance:int32 = MessageContent; - -//@description A message content that is not supported in the current TDLib version -messageUnsupported#93b6f585 = MessageContent; - -//@class TextEntityType @description Represents a part of the text which must be formatted differently - -//@description A mention of a user, a supergroup, or a channel by their username -textEntityTypeMention#37b3df65 = TextEntityType; - -//@description A hashtag text, beginning with "#" and optionally containing a chat username at the end -textEntityTypeHashtag#c2f7a2dd = TextEntityType; - -//@description A cashtag text, beginning with "$", consisting of capital English letters (e.g., "$USD"), and optionally containing a chat username at the end -textEntityTypeCashtag#48e4374b = TextEntityType; - -//@description A bot command, beginning with "/" -textEntityTypeBotCommand#bb652bb3 = TextEntityType; - -//@description An HTTP URL -textEntityTypeUrl#b1c0d47c = TextEntityType; - -//@description An email address -textEntityTypeEmailAddress#54f81821 = TextEntityType; - -//@description A phone number -textEntityTypePhoneNumber#bad9aa2a = TextEntityType; - -//@description A bank card number. The getBankCardInfo method can be used to get information about the bank card -textEntityTypeBankCardNumber#6513910 = TextEntityType; - -//@description A bold text -textEntityTypeBold#bcc0e1b0 = TextEntityType; - -//@description An italic text -textEntityTypeItalic#f8f3965d = TextEntityType; - -//@description An underlined text -textEntityTypeUnderline#2f39cf92 = TextEntityType; - -//@description A strikethrough text -textEntityTypeStrikethrough#394fc4fa = TextEntityType; - -//@description A spoiler text -textEntityTypeSpoiler#206d15bb = TextEntityType; - -//@description Text that must be formatted as if inside a code HTML tag -textEntityTypeCode#c5e9c94a = TextEntityType; - -//@description Text that must be formatted as if inside a pre HTML tag -textEntityTypePre#62491c8e = TextEntityType; - -//@description Text that must be formatted as if inside pre, and code HTML tags -//@language Programming language of the code; as defined by the sender -textEntityTypePreCode#c7a77aab language:string = TextEntityType; - -//@description Text that must be formatted as if inside a blockquote HTML tag; not supported in secret chats -textEntityTypeBlockQuote#c42830c8 = TextEntityType; - -//@description Text that must be formatted as if inside a blockquote HTML tag and collapsed by default to 3 lines with the ability to show full text; not supported in secret chats -textEntityTypeExpandableBlockQuote#22e0c65 = TextEntityType; - -//@description A text description shown instead of a raw URL -//@url HTTP or tg:// URL to be opened when the link is clicked -textEntityTypeTextUrl#1a912463 url:string = TextEntityType; - -//@description A text shows instead of a raw mention of the user (e.g., when the user has no username) -//@user_id Identifier of the mentioned user -textEntityTypeMentionName#a25cd5af user_id:int53 = TextEntityType; - -//@description A custom emoji. The text behind a custom emoji must be an emoji. Only premium users can use premium custom emoji -//@custom_emoji_id Unique identifier of the custom emoji -textEntityTypeCustomEmoji#66ceacc5 custom_emoji_id:int64 = TextEntityType; - -//@description A media timestamp -//@media_timestamp Timestamp from which a video/audio/video note/voice note/story playing must start, in seconds. The media can be in the content or the link preview of the current message, or in the same places in the replied message -textEntityTypeMediaTimestamp#9236da10 media_timestamp:int32 = TextEntityType; - -//@description A thumbnail to be sent along with a file; must be in JPEG or WEBP format for stickers, and less than 200 KB in size -//@thumbnail Thumbnail file to send. Sending thumbnails by file_id is currently not supported -//@width Thumbnail width, usually shouldn't exceed 320. Use 0 if unknown -//@height Thumbnail height, usually shouldn't exceed 320. Use 0 if unknown -inputThumbnail#5e515024 thumbnail:InputFile width:int32 height:int32 = InputThumbnail; - -//@class InputPaidMediaType @description Describes type of paid media to sent - -//@description The media is a photo. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20 -inputPaidMediaTypePhoto#d299fd1a = InputPaidMediaType; - -//@description The media is a video -//@duration Duration of the video, in seconds -//@supports_streaming True, if the video is expected to be streamed -inputPaidMediaTypeVideo#b053f9fc duration:int32 supports_streaming:Bool = InputPaidMediaType; - -//@description Describes a paid media to be sent -//@type Type of the media -//@media Photo or video to be sent -//@thumbnail Media thumbnail; pass null to skip thumbnail uploading -//@added_sticker_file_ids File identifiers of the stickers added to the media, if applicable -//@width Media width -//@height Media height -inputPaidMedia#19f0fc79 type:InputPaidMediaType media:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 = InputPaidMedia; - -//@class MessageSchedulingState @description Contains information about the time when a scheduled message will be sent - -//@description The message will be sent at the specified date -//@send_date Point in time (Unix timestamp) when the message will be sent. The date must be within 367 days in the future -messageSchedulingStateSendAtDate#a773ffe7 send_date:int32 = MessageSchedulingState; - -//@description The message will be sent when the other user is online. Applicable to private chats only and when the exact online status of the other user is known -messageSchedulingStateSendWhenOnline#7cbfd808 = MessageSchedulingState; - -//@description The message will be sent when the video in the message is converted and optimized; can be used only by the server -//@send_date Approximate point in time (Unix timestamp) when the message is expected to be sent -messageSchedulingStateSendWhenVideoProcessed#7d438bee send_date:int32 = MessageSchedulingState; - -//@class MessageSelfDestructType @description Describes when a message will be self-destructed - -//@description The message will be self-destructed in the specified time after its content was opened -//@self_destruct_time The message's self-destruct time, in seconds; must be between 0 and 60 in private chats -messageSelfDestructTypeTimer#508d57cd self_destruct_time:int32 = MessageSelfDestructType; - -//@description The message can be opened only once and will be self-destructed once closed -messageSelfDestructTypeImmediately#c23c9005 = MessageSelfDestructType; - -//@description Options to be used when a message is sent -//@disable_notification Pass true to disable notification for the message -//@from_background Pass true if the message is sent from the background -//@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only -//@allow_paid_broadcast Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only -//@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum -//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled -//@effect_id Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage and sendMessageAlbum in private chats -//@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates -//@only_preview Pass true to get a fake message instead of actually sending them -messageSendOptions#2e463a4a disable_notification:Bool from_background:Bool protect_content:Bool allow_paid_broadcast:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState effect_id:int64 sending_id:int32 only_preview:Bool = MessageSendOptions; - -//@description Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied -//@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. -//@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false -//@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false -//@new_show_caption_above_media True, if new caption must be shown above the media; otherwise, new caption must be shown below the media; not supported in secret chats. Ignored if replace_caption is false -messageCopyOptions#405c03ba send_copy:Bool replace_caption:Bool new_caption:formattedText new_show_caption_above_media:Bool = MessageCopyOptions; - -//@class InputMessageContent @description The content of a message to send - -//@description A text message -//@text Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, ExpandableBlockQuote, -//@link_preview_options Options to be used for generation of a link preview; may be null if none; pass null to use default link preview options -//@clear_draft True, if a chat message draft must be deleted -inputMessageText#f350d894 text:formattedText link_preview_options:linkPreviewOptions clear_draft:Bool = InputMessageContent; - -//@description An animation message (GIF-style). -//@animation Animation file to be sent -//@thumbnail Animation thumbnail; pass null to skip thumbnail uploading -//@added_sticker_file_ids File identifiers of the stickers added to the animation, if applicable -//@duration Duration of the animation, in seconds -//@width Width of the animation; may be replaced by the server -//@height Height of the animation; may be replaced by the server -//@caption Animation caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media True, if the caption must be shown above the animation; otherwise, the caption must be shown below the animation; not supported in secret chats -//@has_spoiler True, if the animation preview must be covered by a spoiler animation; not supported in secret chats -inputMessageAnimation#19fe563 animation:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 caption:formattedText show_caption_above_media:Bool has_spoiler:Bool = InputMessageContent; - -//@description An audio message -//@audio Audio file to be sent -//@album_cover_thumbnail Thumbnail of the cover for the album; pass null to skip thumbnail uploading -//@duration Duration of the audio, in seconds; may be replaced by the server -//@title Title of the audio; 0-64 characters; may be replaced by the server -//@performer Performer of the audio; 0-64 characters, may be replaced by the server -//@caption Audio caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -inputMessageAudio#daa400b2 audio:InputFile album_cover_thumbnail:inputThumbnail duration:int32 title:string performer:string caption:formattedText = InputMessageContent; - -//@description A document message (general file) -//@document Document to be sent -//@thumbnail Document thumbnail; pass null to skip thumbnail uploading -//@disable_content_type_detection Pass true to disable automatic file type detection and send the document as a file. Always true for files sent to secret chats -//@caption Document caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -inputMessageDocument#615b72b9 document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent; - -//@description A message with paid media; can be used only in channel chats with supergroupFullInfo.has_paid_media_allowed -//@star_count The number of Telegram Stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") -//@paid_media The content of the paid media -//@caption Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media True, if the caption must be shown above the media; otherwise, the caption must be shown below the media; not supported in secret chats -//@payload Bot-provided data for the paid media; bots only -inputMessagePaidMedia#370c4490 star_count:int53 paid_media:vector caption:formattedText show_caption_above_media:Bool payload:string = InputMessageContent; - -//@description A photo message -//@photo Photo to send. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20 -//@thumbnail Photo thumbnail to be sent; pass null to skip thumbnail uploading. The thumbnail is sent to the other party only in secret chats -//@added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable -//@width Photo width -//@height Photo height -//@caption Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media True, if the caption must be shown above the photo; otherwise, the caption must be shown below the photo; not supported in secret chats -//@self_destruct_type Photo self-destruct type; pass null if none; private chats only -//@has_spoiler True, if the photo preview must be covered by a spoiler animation; not supported in secret chats -inputMessagePhoto#bc78dbcc photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; - -//@description A sticker message -//@sticker Sticker to be sent -//@thumbnail Sticker thumbnail; pass null to skip thumbnail uploading -//@width Sticker width -//@height Sticker height -//@emoji Emoji used to choose the sticker -inputMessageSticker#3ff1b6f9 sticker:InputFile thumbnail:inputThumbnail width:int32 height:int32 emoji:string = InputMessageContent; - -//@description A video message -//@video Video to be sent. The video is expected to be re-encoded to MPEG4 format with H.264 codec by the sender -//@thumbnail Video thumbnail; pass null to skip thumbnail uploading -//@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable -//@duration Duration of the video, in seconds -//@width Video width -//@height Video height -//@supports_streaming True, if the video is expected to be streamed -//@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats -//@self_destruct_type Video self-destruct type; pass null if none; private chats only -//@has_spoiler True, if the video preview must be covered by a spoiler animation; not supported in secret chats -inputMessageVideo#1a64cc26 video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText show_caption_above_media:Bool self_destruct_type:MessageSelfDestructType has_spoiler:Bool = InputMessageContent; - -//@description A video note message -//@video_note Video note to be sent. The video is expected to be encoded to MPEG4 format with H.264 codec and have no data outside of the visible circle -//@thumbnail Video thumbnail; may be null if empty; pass null to skip thumbnail uploading -//@duration Duration of the video, in seconds; 0-60 -//@length Video width and height; must be positive and not greater than 640 -//@self_destruct_type Video note self-destruct type; may be null if none; pass null if none; private chats only -inputMessageVideoNote#d56816dd video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 self_destruct_type:MessageSelfDestructType = InputMessageContent; - -//@description A voice note message -//@voice_note Voice note to be sent. The voice note must be encoded with the Opus codec and stored inside an OGG container with a single audio channel, or be in MP3 or M4A format as regular audio -//@duration Duration of the voice note, in seconds -//@waveform Waveform representation of the voice note in 5-bit format -//@caption Voice note caption; may be null if empty; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -//@self_destruct_type Voice note self-destruct type; may be null if none; pass null if none; private chats only -inputMessageVoiceNote#5723ffac voice_note:InputFile duration:int32 waveform:bytes caption:formattedText self_destruct_type:MessageSelfDestructType = InputMessageContent; - -//@description A message with a location -//@location Location to be sent -//@live_period Period for which the location can be updated, in seconds; must be between 60 and 86400 for a temporary live location, 0x7FFFFFFF for permanent live location, and 0 otherwise -//@heading For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown -//@proximity_alert_radius For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in channels and Saved Messages -inputMessageLocation#26aae970 location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = InputMessageContent; - -//@description A message with information about a venue -//@venue Venue to send -inputMessageVenue#564d99fd venue:venue = InputMessageContent; - -//@description A message containing a user contact -//@contact Contact to send -inputMessageContact#c5710cff contact:contact = InputMessageContent; - -//@description A dice message -//@emoji Emoji on which the dice throw animation is based -//@clear_draft True, if the chat message draft must be deleted -inputMessageDice#322967a9 emoji:string clear_draft:Bool = InputMessageContent; - -//@description A message with a game; not supported for channels or secret chats -//@bot_user_id User identifier of the bot that owns the game -//@game_short_name Short name of the game -inputMessageGame#4aae6ae2 bot_user_id:int53 game_short_name:string = InputMessageContent; - -//@description A message with an invoice; can be used only by bots -//@invoice Invoice -//@title Product title; 1-32 characters -//@param_description Product description; 0-255 characters -//@photo_url Product photo URL; optional -//@photo_size Product photo size -//@photo_width Product photo width -//@photo_height Product photo height -//@payload The invoice payload -//@provider_token Payment provider token; may be empty for payments in Telegram Stars -//@provider_data JSON-encoded data about the invoice, which will be shared with the payment provider -//@start_parameter Unique invoice bot deep link parameter for the generation of this invoice. If empty, it would be possible to pay directly from forwards of the invoice message -//@paid_media The content of paid media attached to the invoice; pass null if none -//@paid_media_caption Paid media caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters -inputMessageInvoice#babc8f71 invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string paid_media:inputPaidMedia paid_media_caption:formattedText = InputMessageContent; - -//@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot -//@question Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users -//@options List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users -//@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels -//@type Type of the poll -//@open_period Amount of time the poll will be active after creation, in seconds; for bots only -//@close_date Point in time (Unix timestamp) when the poll will automatically be closed; for bots only -//@is_closed True, if the poll needs to be sent already closed; for bots only -inputMessagePoll#9046c716 question:formattedText options:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = InputMessageContent; - -//@description A message with a forwarded story. Stories can't be sent to secret chats. A story can be forwarded only if story.can_be_forwarded -//@story_sender_chat_id Identifier of the chat that posted the story -//@story_id Story identifier -inputMessageStory#21099d63 story_sender_chat_id:int53 story_id:int32 = InputMessageContent; - -//@description A forwarded message -//@from_chat_id Identifier for the chat this forwarded message came from -//@message_id Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded -//@in_game_share True, if a game message is being shared from a launched game; applies only to game messages -//@copy_options Options to be used to copy content of the message without reference to the original sender; pass null to forward the message as usual -inputMessageForwarded#651a73f8 from_chat_id:int53 message_id:int53 in_game_share:Bool copy_options:messageCopyOptions = InputMessageContent; - -//@description Contains properties of a message and describes actions that can be done with the message right now -//@can_be_copied_to_secret_chat True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options -//@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false -//@can_be_deleted_for_all_users True, if the message can be deleted for all users using the method deleteMessages with revoke == true -//@can_be_edited True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. -//@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages -//@can_be_paid True, if the message can be paid using inputInvoiceMessage -//@can_be_pinned True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage -//@can_be_replied True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage -//@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage -//@can_be_saved True, if content of the message can be saved locally or copied using inputMessageForwarded or forwardMessages with copy options -//@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage -//@can_edit_media True, if the message can be edited using the method editMessageMedia -//@can_edit_scheduling_state True, if scheduling state of the message can be edited -//@can_get_embedding_code True, if code for message embedding can be received using getMessageEmbeddingCode -//@can_get_link True, if a link can be generated for the message using getMessageLink -//@can_get_media_timestamp_links True, if media timestamp links can be generated for media timestamp entities in the message text, caption or link preview description using getMessageLink -//@can_get_message_thread True, if information about the message thread is available through getMessageThread and getMessageThreadHistory -//@can_get_read_date True, if read date of the message can be received through getMessageReadDate -//@can_get_statistics True, if message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards -//@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers -//@can_recognize_speech True, if speech can be recognized for the message through recognizeSpeech -//@can_report_chat True, if the message can be reported using reportChat -//@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions -//@can_report_supergroup_spam True, if the message can be reported using reportSupergroupSpam -//@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck -//@need_show_statistics True, if message statistics must be available from context menu of the message -messageProperties#fe63ca01 can_be_copied_to_secret_chat:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_pinned:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_edit_media:Bool can_edit_scheduling_state:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_recognize_speech:Bool can_report_chat:Bool can_report_reactions:Bool can_report_supergroup_spam:Bool can_set_fact_check:Bool need_show_statistics:Bool = MessageProperties; - -//@class SearchMessagesFilter @description Represents a filter for message search results - -//@description Returns all found messages, no filter is applied -searchMessagesFilterEmpty#cc2e1337 = SearchMessagesFilter; - -//@description Returns only animation messages -searchMessagesFilterAnimation#f6b800c5 = SearchMessagesFilter; - -//@description Returns only audio messages -searchMessagesFilterAudio#33b5147b = SearchMessagesFilter; - -//@description Returns only document messages -searchMessagesFilterDocument#5af9f74f = SearchMessagesFilter; - -//@description Returns only photo messages -searchMessagesFilterPhoto#37309b05 = SearchMessagesFilter; - -//@description Returns only video messages -searchMessagesFilterVideo#6e2f92e = SearchMessagesFilter; - -//@description Returns only voice note messages -searchMessagesFilterVoiceNote#6dc2227d = SearchMessagesFilter; - -//@description Returns only photo and video messages -searchMessagesFilterPhotoAndVideo#5097e193 = SearchMessagesFilter; - -//@description Returns only messages containing URLs -searchMessagesFilterUrl#92ffe18b = SearchMessagesFilter; - -//@description Returns only messages containing chat photos -searchMessagesFilterChatPhoto#b5a0d35f = SearchMessagesFilter; - -//@description Returns only video note messages -searchMessagesFilterVideoNote#21a2e3f9 = SearchMessagesFilter; - -//@description Returns only voice and video note messages -searchMessagesFilterVoiceAndVideoNote#279680e3 = SearchMessagesFilter; - -//@description Returns only messages with mentions of the current user, or messages that are replies to their messages -searchMessagesFilterMention#7748c89c = SearchMessagesFilter; - -//@description Returns only messages with unread mentions of the current user, or messages that are replies to their messages. When using this filter the results can't be additionally filtered by a query, a message thread or by the sending user -searchMessagesFilterUnreadMention#fa4aadc3 = SearchMessagesFilter; - -//@description Returns only messages with unread reactions for the current user. When using this filter the results can't be additionally filtered by a query, a message thread or by the sending user -searchMessagesFilterUnreadReaction#adc43100 = SearchMessagesFilter; - -//@description Returns only failed to send messages. This filter can be used only if the message database is used -searchMessagesFilterFailedToSend#dc74d6fc = SearchMessagesFilter; - -//@description Returns only pinned messages -searchMessagesFilterPinned#16294d48 = SearchMessagesFilter; - -//@class SearchMessagesChatTypeFilter @description Represents a filter for type of the chats in which to search messages - -//@description Returns only messages in private chats -searchMessagesChatTypeFilterPrivate#45b152cf = SearchMessagesChatTypeFilter; - -//@description Returns only messages in basic group and supergroup chats -searchMessagesChatTypeFilterGroup#853fa71a = SearchMessagesChatTypeFilter; - -//@description Returns only messages in channel chats -searchMessagesChatTypeFilterChannel#d1e4b6d5 = SearchMessagesChatTypeFilter; - -//@class ChatAction @description Describes the different types of activity in a chat - -//@description The user is typing a message -chatActionTyping#16a83437 = ChatAction; - -//@description The user is recording a video -chatActionRecordingVideo#ce85792 = ChatAction; - -//@description The user is uploading a video -//@progress Upload progress, as a percentage -chatActionUploadingVideo#49902c36 progress:int32 = ChatAction; - -//@description The user is recording a voice note -chatActionRecordingVoiceNote#cfc9ed76 = ChatAction; - -//@description The user is uploading a voice note -//@progress Upload progress, as a percentage -chatActionUploadingVoiceNote#db6c8a6e progress:int32 = ChatAction; - -//@description The user is uploading a photo -//@progress Upload progress, as a percentage -chatActionUploadingPhoto#26feeb47 progress:int32 = ChatAction; - -//@description The user is uploading a document -//@progress Upload progress, as a percentage -chatActionUploadingDocument#a01b64a progress:int32 = ChatAction; - -//@description The user is picking a sticker to send -chatActionChoosingSticker#1637c521 = ChatAction; - -//@description The user is picking a location or venue to send -chatActionChoosingLocation#87b96324 = ChatAction; - -//@description The user is picking a contact to send -chatActionChoosingContact#b7220418 = ChatAction; - -//@description The user has started to play a game -chatActionStartPlayingGame#cc63a7fc = ChatAction; - -//@description The user is recording a video note -chatActionRecordingVideoNote#fc2081 = ChatAction; - -//@description The user is uploading a video note -//@progress Upload progress, as a percentage -chatActionUploadingVideoNote#45e0de76 progress:int32 = ChatAction; - -//@description The user is watching animations sent by the other party by clicking on an animated emoji -//@emoji The animated emoji -chatActionWatchingAnimations#7a5e26b1 emoji:string = ChatAction; - -//@description The user has canceled the previous action -chatActionCancel#452c30b6 = ChatAction; - -//@class UserStatus @description Describes the last time the user was online - -//@description The user's status has never been changed -userStatusEmpty#9d05049 = UserStatus; - -//@description The user is online -//@expires Point in time (Unix timestamp) when the user's online status will expire -userStatusOnline#a4d64774 expires:int32 = UserStatus; - -//@description The user is offline -//@was_online Point in time (Unix timestamp) when the user was last online -userStatusOffline#d2b38d05 was_online:int32 = UserStatus; - -//@description The user was online recently -//@by_my_privacy_settings Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium -userStatusRecently#faa60b5 by_my_privacy_settings:Bool = UserStatus; - -//@description The user is offline, but was online last week -//@by_my_privacy_settings Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium -userStatusLastWeek#12801b57 by_my_privacy_settings:Bool = UserStatus; - -//@description The user is offline, but was online last month -//@by_my_privacy_settings Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium -userStatusLastMonth#b8cb29fc by_my_privacy_settings:Bool = UserStatus; - -//@description Represents an emoji with its keyword -//@emoji The emoji -//@keyword The keyword -emojiKeyword#821912df emoji:string keyword:string = EmojiKeyword; - -//@description Represents a list of emojis with their keywords -//@emoji_keywords List of emojis with their keywords -emojiKeywords#de023f4 emoji_keywords:vector = EmojiKeywords; - -//@description Represents a list of stickers -//@stickers List of stickers -stickers#83491d00 stickers:vector = Stickers; - -//@description Represents a list of emojis -//@emojis List of emojis -emojis#77274a16 emojis:vector = Emojis; - -//@description Represents a sticker set -//@id Identifier of the sticker set -//@title Title of the sticker set -//@name Name of the sticker set -//@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed -//@thumbnail_outline Sticker set thumbnail's outline; may be null if unknown -//@is_owned True, if the sticker set is owned by the current user -//@is_installed True, if the sticker set has been installed by the current user -//@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously -//@is_official True, if the sticker set is official -//@sticker_type Type of the stickers in the set -//@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only -//@is_allowed_as_chat_emoji_status True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only -//@is_viewed True for already viewed trending sticker sets -//@stickers List of stickers in this set -//@emojis A list of emojis corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -stickerSet#e3b8a114 id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:outline is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; - -//@description Represents short information about a sticker set -//@id Identifier of the sticker set -//@title Title of the sticker set -//@name Name of the sticker set -//@thumbnail Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed -//@thumbnail_outline Sticker set thumbnail's outline; may be null if unknown -//@is_owned True, if the sticker set is owned by the current user -//@is_installed True, if the sticker set has been installed by the current user -//@is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously -//@is_official True, if the sticker set is official -//@sticker_type Type of the stickers in the set -//@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only -//@is_allowed_as_chat_emoji_status True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only -//@is_viewed True for already viewed trending sticker sets -//@size Total number of stickers in the set -//@covers Up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full sticker set needs to be requested -stickerSetInfo#58991994 id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:outline is_owned:Bool is_installed:Bool is_archived:Bool is_official:Bool sticker_type:StickerType needs_repainting:Bool is_allowed_as_chat_emoji_status:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; - -//@description Represents a list of sticker sets -//@total_count Approximate total number of sticker sets found -//@sets List of sticker sets -stickerSets#b8a6490d total_count:int32 sets:vector = StickerSets; - -//@description Represents a list of trending sticker sets -//@total_count Approximate total number of trending sticker sets -//@sets List of trending sticker sets -//@is_premium True, if the list contains sticker sets with premium stickers -trendingStickerSets#298f12cc total_count:int32 sets:vector is_premium:Bool = TrendingStickerSets; - -//@class EmojiCategorySource @description Describes source of stickers for an emoji category - -//@description The category contains a list of similar emoji to search for in getStickers and searchStickers for stickers, -//@emojis List of emojis to search for -emojiCategorySourceSearch#5e126d32 emojis:vector = EmojiCategorySource; - -//@description The category contains premium stickers that must be found by getPremiumStickers -emojiCategorySourcePremium#8cd28d0c = EmojiCategorySource; - -//@description Describes an emoji category -//@name Name of the category -//@icon Custom emoji sticker, which represents icon of the category -//@source Source of stickers for the emoji category -//@is_greeting True, if the category must be shown first when choosing a sticker for the start page -emojiCategory#220de4ef name:string icon:sticker source:EmojiCategorySource is_greeting:Bool = EmojiCategory; - -//@description Represents a list of emoji categories -//@categories List of categories -emojiCategories#c680f27a categories:vector = EmojiCategories; - -//@class EmojiCategoryType @description Describes type of emoji category - -//@description The category must be used by default (e.g., for custom emoji or animation search) -emojiCategoryTypeDefault#46db626b = EmojiCategoryType; - -//@description The category must be used by default for regular sticker selection. It may contain greeting emoji category and premium stickers -emojiCategoryTypeRegularStickers#b04799d2 = EmojiCategoryType; - -//@description The category must be used for emoji status selection -emojiCategoryTypeEmojiStatus#5254b347 = EmojiCategoryType; - -//@description The category must be used for chat photo emoji selection -emojiCategoryTypeChatPhoto#3f200529 = EmojiCategoryType; - -//@description Describes the current weather -//@temperature Temperature, in degree Celsius -//@emoji Emoji representing the weather -currentWeather#eacea8c0 temperature:double emoji:string = CurrentWeather; - -//@description Describes position of a clickable rectangle area on a story media -//@x_percentage The abscissa of the rectangle's center, as a percentage of the media width -//@y_percentage The ordinate of the rectangle's center, as a percentage of the media height -//@width_percentage The width of the rectangle, as a percentage of the media width -//@height_percentage The height of the rectangle, as a percentage of the media height -//@rotation_angle Clockwise rotation angle of the rectangle, in degrees; 0-360 -//@corner_radius_percentage The radius of the rectangle corner rounding, as a percentage of the media width -storyAreaPosition#a49fec6c x_percentage:double y_percentage:double width_percentage:double height_percentage:double rotation_angle:double corner_radius_percentage:double = StoryAreaPosition; - -//@class StoryAreaType @description Describes type of clickable area on a story media - -//@description An area pointing to a location -//@location The location -//@address Address of the location; may be null if unknown -storyAreaTypeLocation#a8b3caa3 location:location address:locationAddress = StoryAreaType; - -//@description An area pointing to a venue -//@venue Information about the venue -storyAreaTypeVenue#18ae4d06 venue:venue = StoryAreaType; - -//@description An area pointing to a suggested reaction. App needs to show a clickable reaction on the area and call setStoryReaction when the are is clicked -//@reaction_type Type of the reaction -//@total_count Number of times the reaction was added -//@is_dark True, if reaction has a dark background -//@is_flipped True, if reaction corner is flipped -storyAreaTypeSuggestedReaction#f95f927c reaction_type:ReactionType total_count:int32 is_dark:Bool is_flipped:Bool = StoryAreaType; - -//@description An area pointing to a message -//@chat_id Identifier of the chat with the message -//@message_id Identifier of the message -storyAreaTypeMessage#bfef76b4 chat_id:int53 message_id:int53 = StoryAreaType; - -//@description An area pointing to a HTTP or tg:// link -//@url HTTP or tg:// URL to be opened when the area is clicked -storyAreaTypeLink#f8626185 url:string = StoryAreaType; - -//@description An area with information about weather -//@temperature Temperature, in degree Celsius -//@emoji Emoji representing the weather -//@background_color A color of the area background in the ARGB format -storyAreaTypeWeather#a6587dbe temperature:double emoji:string background_color:int32 = StoryAreaType; - -//@description Describes a clickable rectangle area on a story media -//@position Position of the area -//@type Type of the area -storyArea#c9ff075e position:storyAreaPosition type:StoryAreaType = StoryArea; - -//@class InputStoryAreaType @description Describes type of clickable area on a story media to be added - -//@description An area pointing to a location -//@location The location -//@address Address of the location; pass null if unknown -inputStoryAreaTypeLocation#aa8b3f39 location:location address:locationAddress = InputStoryAreaType; - -//@description An area pointing to a venue found by the bot getOption("venue_search_bot_username") -//@query_id Identifier of the inline query, used to found the venue -//@result_id Identifier of the inline query result -inputStoryAreaTypeFoundVenue#accda496 query_id:int64 result_id:string = InputStoryAreaType; - -//@description An area pointing to a venue already added to the story -//@venue_provider Provider of the venue -//@venue_id Identifier of the venue in the provider database -inputStoryAreaTypePreviousVenue#6e124e0c venue_provider:string venue_id:string = InputStoryAreaType; - -//@description An area pointing to a suggested reaction -//@reaction_type Type of the reaction -//@is_dark True, if reaction has a dark background -//@is_flipped True, if reaction corner is flipped -inputStoryAreaTypeSuggestedReaction#7d4751d3 reaction_type:ReactionType is_dark:Bool is_flipped:Bool = InputStoryAreaType; - -//@description An area pointing to a message -//@chat_id Identifier of the chat with the message. Currently, the chat must be a supergroup or a channel chat -//@message_id Identifier of the message. Use messageProperties.can_be_shared_in_story to check whether the message is suitable -inputStoryAreaTypeMessage#f01be457 chat_id:int53 message_id:int53 = InputStoryAreaType; - -//@description An area pointing to a HTTP or tg:// link -//@url HTTP or tg:// URL to be opened when the area is clicked -inputStoryAreaTypeLink#53f31b48 url:string = InputStoryAreaType; - -//@description An area with information about weather -//@temperature Temperature, in degree Celsius -//@emoji Emoji representing the weather -//@background_color A color of the area background in the ARGB format -inputStoryAreaTypeWeather#b7b7de9d temperature:double emoji:string background_color:int32 = InputStoryAreaType; - -//@description Describes a clickable rectangle area on a story media to be added -//@position Position of the area -//@type Type of the area -inputStoryArea#752ae7f position:storyAreaPosition type:InputStoryAreaType = InputStoryArea; - -//@description Contains a list of story areas to be added -//@areas List of input story areas. Currently, a story can have -inputStoryAreas#b8ba29fe areas:vector = InputStoryAreas; - -//@description Describes a video file sent in a story -//@duration Duration of the video, in seconds -//@width Video width -//@height Video height -//@has_stickers True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets -//@is_animation True, if the video has no sound -//@minithumbnail Video minithumbnail; may be null -//@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null -//@preload_prefix_size Size of file prefix, which is expected to be preloaded, in bytes -//@cover_frame_timestamp Timestamp of the frame used as video thumbnail -//@video File containing the video -storyVideo#562b0a45 duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 cover_frame_timestamp:double video:file = StoryVideo; - -//@class StoryContent @description Contains the content of a story - -//@description A photo story -//@photo The photo -storyContentPhoto#d45f0050 photo:photo = StoryContent; - -//@description A video story -//@video The video in MPEG4 format -//@alternative_video Alternative version of the video in MPEG4 format, encoded with H.264 codec; may be null -storyContentVideo#b30162a6 video:storyVideo alternative_video:storyVideo = StoryContent; - -//@description A story content that is not supported in the current TDLib version -storyContentUnsupported#86c7f56e = StoryContent; - -//@class InputStoryContent @description The content of a story to send - -//@description A photo story -//@photo Photo to send. The photo must be at most 10 MB in size. The photo size must be 1080x1920 -//@added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable -inputStoryContentPhoto#3286fbe0 photo:InputFile added_sticker_file_ids:vector = InputStoryContent; - -//@description A video story -//@video Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with H.265 codec and key frames added each second -//@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable -//@duration Precise duration of the video, in seconds; 0-60 -//@cover_frame_timestamp Timestamp of the frame, which will be used as video thumbnail -//@is_animation True, if the video has no sound -inputStoryContentVideo#cc1e4239 video:InputFile added_sticker_file_ids:vector duration:double cover_frame_timestamp:double is_animation:Bool = InputStoryContent; - -//@class StoryList @description Describes a list of stories - -//@description The list of stories, shown in the main chat list and folder chat lists -storyListMain#d7eeb3ff = StoryList; - -//@description The list of stories, shown in the Arvhive chat list -storyListArchive#fd80a741 = StoryList; - -//@class StoryOrigin @description Contains information about the origin of a story that was reposted - -//@description The original story was a public story with known sender -//@chat_id Identifier of the chat that posted original story -//@story_id Story identifier of the original story -storyOriginPublicStory#2c379fbe chat_id:int53 story_id:int32 = StoryOrigin; - -//@description The original story was sent by an unknown user -//@sender_name Name of the story sender -storyOriginHiddenUser#5a1f89ec sender_name:string = StoryOrigin; - -//@description Contains information about original story that was reposted -//@origin Origin of the story that was reposted -//@is_content_modified True, if story content was modified during reposting; otherwise, story wasn't modified -storyRepostInfo#ff7fa440 origin:StoryOrigin is_content_modified:Bool = StoryRepostInfo; - -//@description Contains information about interactions with a story -//@view_count Number of times the story was viewed -//@forward_count Number of times the story was forwarded; 0 if none or unknown -//@reaction_count Number of reactions added to the story; 0 if none or unknown -//@recent_viewer_user_ids Identifiers of at most 3 recent viewers of the story -storyInteractionInfo#e1557fc7 view_count:int32 forward_count:int32 reaction_count:int32 recent_viewer_user_ids:vector = StoryInteractionInfo; - -//@description Represents a story -//@id Unique story identifier among stories of the given sender -//@sender_chat_id Identifier of the chat that posted the story -//@sender_id Identifier of the sender of the story; may be null if the story is posted on behalf of the sender_chat_id -//@date Point in time (Unix timestamp) when the story was published -//@is_being_sent True, if the story is being sent by the current user -//@is_being_edited True, if the story is being edited by the current user -//@is_edited True, if the story was edited -//@is_posted_to_chat_page True, if the story is saved in the sender's profile and will be available there after expiration -//@is_visible_only_for_self True, if the story is visible only for the current user -//@can_be_deleted True, if the story can be deleted -//@can_be_edited True, if the story can be edited -//@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden -//@can_be_replied True, if the story can be replied in the chat with the story sender -//@can_toggle_is_posted_to_chat_page True, if the story's is_posted_to_chat_page value can be changed -//@can_get_statistics True, if the story statistics are available through getStoryStatistics -//@can_get_interactions True, if interactions with the story can be received through getStoryInteractions -//@has_expired_viewers True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago -//@repost_info Information about the original story; may be null if the story wasn't reposted -//@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions -//@chosen_reaction_type Type of the chosen reaction; may be null if none -//@privacy_settings Privacy rules affecting story visibility; may be approximate for non-owned stories -//@content Content of the story -//@areas Clickable areas to be shown on the story content -//@caption Caption of the story -story#84cdc9d1 id:int32 sender_chat_id:int53 sender_id:MessageSender date:int32 is_being_sent:Bool is_being_edited:Bool is_edited:Bool is_posted_to_chat_page:Bool is_visible_only_for_self:Bool can_be_deleted:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied:Bool can_toggle_is_posted_to_chat_page:Bool can_get_statistics:Bool can_get_interactions:Bool has_expired_viewers:Bool repost_info:storyRepostInfo interaction_info:storyInteractionInfo chosen_reaction_type:ReactionType privacy_settings:StoryPrivacySettings content:StoryContent areas:vector caption:formattedText = Story; - -//@description Represents a list of stories -//@total_count Approximate total number of stories found -//@stories The list of stories -//@pinned_story_ids Identifiers of the pinned stories; returned only in getChatPostedToChatPageStories with from_story_id == 0 -stories#b88ff8ff total_count:int32 stories:vector pinned_story_ids:vector = Stories; - -//@description Contains a list of stories found by a search -//@total_count Approximate total number of stories found -//@stories List of stories -//@next_offset The offset for the next request. If empty, then there are no more results -foundStories#854b067c total_count:int32 stories:vector next_offset:string = FoundStories; - -//@description Contains identifier of a story along with identifier of its sender -//@sender_chat_id Identifier of the chat that posted the story -//@story_id Unique story identifier among stories of the given sender -storyFullId#701d31f5 sender_chat_id:int53 story_id:int32 = StoryFullId; - -//@description Contains basic information about a story -//@story_id Unique story identifier among stories of the given sender -//@date Point in time (Unix timestamp) when the story was published -//@is_for_close_friends True, if the story is available only to close friends -storyInfo#8997c352 story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; - -//@description Describes active stories posted by a chat -//@chat_id Identifier of the chat that posted the stories -//@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list -//@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order -//@max_read_story_id Identifier of the last read active story -//@stories Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) -chatActiveStories#d923d773 chat_id:int53 list:StoryList order:int53 max_read_story_id:int32 stories:vector = ChatActiveStories; - -//@class StoryInteractionType @description Describes type of interaction with a story - -//@description A view of the story -//@chosen_reaction_type Type of the reaction that was chosen by the viewer; may be null if none -storyInteractionTypeView#53e337d0 chosen_reaction_type:ReactionType = StoryInteractionType; - -//@description A forward of the story as a message -//@message The message with story forward -storyInteractionTypeForward#27d23cff message:message = StoryInteractionType; - -//@description A repost of the story as a story -//@story The reposted story -storyInteractionTypeRepost#c32279c4 story:story = StoryInteractionType; - -//@description Represents interaction with a story -//@actor_id Identifier of the user or chat that made the interaction -//@interaction_date Approximate point in time (Unix timestamp) when the interaction happened -//@block_list Block list to which the actor is added; may be null if none or for chat stories -//@type Type of the interaction -storyInteraction#d624d222 actor_id:MessageSender interaction_date:int32 block_list:BlockList type:StoryInteractionType = StoryInteraction; - -//@description Represents a list of interactions with a story -//@total_count Approximate total number of interactions found -//@total_forward_count Approximate total number of found forwards and reposts; always 0 for chat stories -//@total_reaction_count Approximate total number of found reactions; always 0 for chat stories -//@interactions List of story interactions -//@next_offset The offset for the next request. If empty, then there are no more results -storyInteractions#f9f5d50f total_count:int32 total_forward_count:int32 total_reaction_count:int32 interactions:vector next_offset:string = StoryInteractions; - -//@description Describes a message that can be used for quick reply -//@id Unique message identifier among all quick replies -//@sending_state The sending state of the message; may be null if the message isn't being sent and didn't fail to be sent -//@can_be_edited True, if the message can be edited -//@reply_to_message_id The identifier of the quick reply message to which the message replies; 0 if none -//@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent -//@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums -//@content Content of the message -//@reply_markup Inline keyboard reply markup for the message; may be null if none -quickReplyMessage#bef92f03 id:int53 sending_state:MessageSendingState can_be_edited:Bool reply_to_message_id:int53 via_bot_user_id:int53 media_album_id:int64 content:MessageContent reply_markup:ReplyMarkup = QuickReplyMessage; - -//@description Contains a list of quick reply messages -//@messages List of quick reply messages; messages may be null -quickReplyMessages#8426549b messages:vector = QuickReplyMessages; - -//@description Describes a shortcut that can be used for a quick reply -//@id Unique shortcut identifier -//@name The name of the shortcut that can be used to use the shortcut -//@first_message The first shortcut message -//@message_count The total number of messages in the shortcut -quickReplyShortcut#bdfd9a95 id:int32 name:string first_message:quickReplyMessage message_count:int32 = QuickReplyShortcut; - -//@class PublicForward @description Describes a public forward or repost of a story - -//@description Contains a public forward as a message -//@message Information about the message -publicForwardMessage#317b3d2 message:message = PublicForward; - -//@description Contains a public repost to a story -//@story Information about the story -publicForwardStory#7fdf26af story:story = PublicForward; - -//@description Represents a list of public forwards and reposts as a story of a message or a story -//@total_count Approximate total number of messages and stories found -//@forwards List of found public forwards and reposts -//@next_offset The offset for the next request. If empty, then there are no more results -publicForwards#3ed29447 total_count:int32 forwards:vector next_offset:string = PublicForwards; - -//@description Describes media previews of a bot -//@date Point in time (Unix timestamp) when the preview was added or changed last time -//@content Content of the preview -botMediaPreview#9eb59ce8 date:int32 content:StoryContent = BotMediaPreview; - -//@description Contains a list of media previews of a bot -//@previews List of media previews -botMediaPreviews#f1b8f27d previews:vector = BotMediaPreviews; - -//@description Contains a list of media previews of a bot for the given language and the list of languages for which the bot has dedicated previews -//@previews List of media previews -//@language_codes List of language codes for which the bot has dedicated previews -botMediaPreviewInfo#e49169db previews:vector language_codes:vector = BotMediaPreviewInfo; - -//@description Contains a list of features available on a specific chat boost level -//@level Target chat boost level -//@story_per_day_count Number of stories that the chat can publish daily -//@custom_emoji_reaction_count Number of custom emoji reactions that can be added to the list of available reactions -//@title_color_count Number of custom colors for chat title -//@profile_accent_color_count Number of custom colors for profile photo background -//@can_set_profile_background_custom_emoji True, if custom emoji for profile background can be set -//@accent_color_count Number of custom colors for background of empty chat photo, replies to messages and link previews -//@can_set_background_custom_emoji True, if custom emoji for reply header and link preview background can be set -//@can_set_emoji_status True, if emoji status can be set -//@chat_theme_background_count Number of chat theme backgrounds that can be set as chat background -//@can_set_custom_background True, if custom background can be set in the chat for all users -//@can_set_custom_emoji_sticker_set True, if custom emoji sticker set can be set for the chat -//@can_recognize_speech True, if speech recognition can be used for video note and voice note messages by all users -//@can_disable_sponsored_messages True, if sponsored messages can be disabled in the chat -chatBoostLevelFeatures#f4b51914 level:int32 story_per_day_count:int32 custom_emoji_reaction_count:int32 title_color_count:int32 profile_accent_color_count:int32 can_set_profile_background_custom_emoji:Bool accent_color_count:int32 can_set_background_custom_emoji:Bool can_set_emoji_status:Bool chat_theme_background_count:int32 can_set_custom_background:Bool can_set_custom_emoji_sticker_set:Bool can_recognize_speech:Bool can_disable_sponsored_messages:Bool = ChatBoostLevelFeatures; - -//@description Contains a list of features available on the first chat boost levels -//@features The list of features -//@min_profile_background_custom_emoji_boost_level The minimum boost level required to set custom emoji for profile background -//@min_background_custom_emoji_boost_level The minimum boost level required to set custom emoji for reply header and link preview background; for channel chats only -//@min_emoji_status_boost_level The minimum boost level required to set emoji status -//@min_chat_theme_background_boost_level The minimum boost level required to set a chat theme background as chat background -//@min_custom_background_boost_level The minimum boost level required to set custom chat background -//@min_custom_emoji_sticker_set_boost_level The minimum boost level required to set custom emoji sticker set for the chat; for supergroup chats only -//@min_speech_recognition_boost_level The minimum boost level allowing to recognize speech in video note and voice note messages for non-Premium users; for supergroup chats only -//@min_sponsored_message_disable_boost_level The minimum boost level allowing to disable sponsored messages in the chat; for channel chats only -chatBoostFeatures#803214be features:vector min_profile_background_custom_emoji_boost_level:int32 min_background_custom_emoji_boost_level:int32 min_emoji_status_boost_level:int32 min_chat_theme_background_boost_level:int32 min_custom_background_boost_level:int32 min_custom_emoji_sticker_set_boost_level:int32 min_speech_recognition_boost_level:int32 min_sponsored_message_disable_boost_level:int32 = ChatBoostFeatures; - -//@class ChatBoostSource @description Describes source of a chat boost - -//@description The chat created a Telegram Premium gift code for a user -//@user_id Identifier of a user, for which the gift code was created -//@gift_code The created Telegram Premium gift code, which is known only if this is a gift code for the current user, or it has already been claimed -chatBoostSourceGiftCode#fa2412ba user_id:int53 gift_code:string = ChatBoostSource; - -//@description The chat created a giveaway -//@user_id Identifier of a user that won in the giveaway; 0 if none -//@gift_code The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise; for Telegram Premium giveways only -//@star_count Number of Telegram Stars distributed among winners of the giveaway -//@giveaway_message_id Identifier of the corresponding giveaway message; can be an identifier of a deleted message -//@is_unclaimed True, if the winner for the corresponding giveaway prize wasn't chosen, because there were not enough participants -chatBoostSourceGiveaway#7254949a user_id:int53 gift_code:string star_count:int53 giveaway_message_id:int53 is_unclaimed:Bool = ChatBoostSource; - -//@description A user with Telegram Premium subscription or gifted Telegram Premium boosted the chat -//@user_id Identifier of the user -chatBoostSourcePremium#ed4eb user_id:int53 = ChatBoostSource; - -//@description Describes a prepaid giveaway -//@id Unique identifier of the prepaid giveaway -//@winner_count Number of users which will receive giveaway prize -//@prize Prize of the giveaway -//@boost_count The number of boosts received by the chat from the giveaway; for Telegram Star giveaways only -//@payment_date Point in time (Unix timestamp) when the giveaway was paid -prepaidGiveaway#ef70338f id:int64 winner_count:int32 prize:GiveawayPrize boost_count:int32 payment_date:int32 = PrepaidGiveaway; - -//@description Describes current boost status of a chat -//@boost_url An HTTP URL, which can be used to boost the chat -//@applied_slot_ids Identifiers of boost slots of the current user applied to the chat -//@level Current boost level of the chat -//@gift_code_boost_count The number of boosts received by the chat from created Telegram Premium gift codes and giveaways; always 0 if the current user isn't an administrator in the chat -//@boost_count The number of boosts received by the chat -//@current_level_boost_count The number of boosts added to reach the current level -//@next_level_boost_count The number of boosts needed to reach the next level; 0 if the next level isn't available -//@premium_member_count Approximate number of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat -//@premium_member_percentage A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat -//@prepaid_giveaways The list of prepaid giveaways available for the chat; only for chat administrators -chatBoostStatus#401e753c boost_url:string applied_slot_ids:vector level:int32 gift_code_boost_count:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double prepaid_giveaways:vector = ChatBoostStatus; - -//@description Describes a boost applied to a chat -//@id Unique identifier of the boost -//@count The number of identical boosts applied -//@source Source of the boost -//@start_date Point in time (Unix timestamp) when the chat was boosted -//@expiration_date Point in time (Unix timestamp) when the boost will expire -chatBoost#96bfccb2 id:string count:int32 source:ChatBoostSource start_date:int32 expiration_date:int32 = ChatBoost; - -//@description Contains a list of boosts applied to a chat -//@total_count Total number of boosts applied to the chat -//@boosts List of boosts -//@next_offset The offset for the next request. If empty, then there are no more results -foundChatBoosts#dc80d52e total_count:int32 boosts:vector next_offset:string = FoundChatBoosts; - -//@description Describes a slot for chat boost -//@slot_id Unique identifier of the slot -//@currently_boosted_chat_id Identifier of the currently boosted chat; 0 if none -//@start_date Point in time (Unix timestamp) when the chat was boosted; 0 if none -//@expiration_date Point in time (Unix timestamp) when the boost will expire -//@cooldown_until_date Point in time (Unix timestamp) after which the boost can be used for another chat -chatBoostSlot#757fac7 slot_id:int32 currently_boosted_chat_id:int53 start_date:int32 expiration_date:int32 cooldown_until_date:int32 = ChatBoostSlot; - -//@description Contains a list of chat boost slots -//@slots List of boost slots -chatBoostSlots#6859c79 slots:vector = ChatBoostSlots; - -//@class ResendCodeReason @description Describes the reason why a code needs to be re-sent - -//@description The user requested to resend the code -resendCodeReasonUserRequest#e5a8c880 = ResendCodeReason; - -//@description The code is re-sent, because device verification has failed -//@error_message Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, APNS_RECEIVE_TIMEOUT, or APNS_INIT_FAILED -resendCodeReasonVerificationFailed#1f952dc1 error_message:string = ResendCodeReason; - -//@class CallDiscardReason @description Describes the reason why a call was discarded - -//@description The call wasn't discarded, or the reason is unknown -callDiscardReasonEmpty#b4f66fc3 = CallDiscardReason; - -//@description The call was ended before the conversation started. It was canceled by the caller or missed by the other party -callDiscardReasonMissed#64283a7c = CallDiscardReason; - -//@description The call was ended before the conversation started. It was declined by the other party -callDiscardReasonDeclined#98e36c32 = CallDiscardReason; - -//@description The call was ended during the conversation because the users were disconnected -callDiscardReasonDisconnected#aff563a2 = CallDiscardReason; - -//@description The call was ended because one of the parties hung up -callDiscardReasonHungUp#1a1ea5e6 = CallDiscardReason; - -//@description The call was ended because it has been used successfully to transfer private encryption key for the associated group call -//@encrypted_group_call_key Encrypted using the call private key encryption key for the associated group call -callDiscardReasonAllowGroupCall#af177fd5 encrypted_group_call_key:bytes = CallDiscardReason; - -//@description Specifies the supported call protocols -//@udp_p2p True, if UDP peer-to-peer connections are supported -//@udp_reflector True, if connection through UDP reflectors is supported -//@min_layer The minimum supported API layer; use 65 -//@max_layer The maximum supported API layer; use 92 -//@library_versions List of supported tgcalls versions -callProtocol#a9a037e udp_p2p:Bool udp_reflector:Bool min_layer:int32 max_layer:int32 library_versions:vector = CallProtocol; - -//@class CallServerType @description Describes the type of call server - -//@description A Telegram call reflector -//@peer_tag A peer tag to be used with the reflector -//@is_tcp True, if the server uses TCP instead of UDP -callServerTypeTelegramReflector#32af3515 peer_tag:bytes is_tcp:Bool = CallServerType; - -//@description A WebRTC server -//@username Username to be used for authentication -//@password Authentication password -//@supports_turn True, if the server supports TURN -//@supports_stun True, if the server supports STUN -callServerTypeWebrtc#4a8afd65 username:string password:string supports_turn:Bool supports_stun:Bool = CallServerType; - -//@description Describes a server for relaying call data -//@id Server identifier -//@ip_address Server IPv4 address -//@ipv6_address Server IPv6 address -//@port Server port number -//@type Server type -callServer#6f37df97 id:int64 ip_address:string ipv6_address:string port:int32 type:CallServerType = CallServer; - -//@description Contains the call identifier -//@id Call identifier -callId#3eac609 id:int32 = CallId; - -//@description Contains the group call identifier -//@id Group call identifier -groupCallId#14e4bb45 id:int32 = GroupCallId; - -//@class CallState @description Describes the current call state - -//@description The call is pending, waiting to be accepted by a user -//@is_created True, if the call has already been created by the server -//@is_received True, if the call has already been received by the other party -callStatePending#3ff56c2c is_created:Bool is_received:Bool = CallState; - -//@description The call has been answered and encryption keys are being exchanged -callStateExchangingKeys#91d77a65 = CallState; - -//@description The call is ready to use -//@protocol Call protocols supported by the other call participant -//@servers List of available call servers -//@config A JSON-encoded call config -//@encryption_key Call encryption key -//@emojis Encryption key fingerprint represented as 4 emoji -//@allow_p2p True, if peer-to-peer connection is allowed by users privacy settings -//@custom_parameters Custom JSON-encoded call parameters to be passed to tgcalls -callStateReady#17038381 protocol:callProtocol servers:vector config:string encryption_key:bytes emojis:vector allow_p2p:Bool custom_parameters:string = CallState; - -//@description The call is hanging up after discardCall has been called -callStateHangingUp#80d0f2aa = CallState; - -//@description The call has ended successfully -//@reason The reason why the call has ended -//@need_rating True, if the call rating must be sent to the server -//@need_debug_information True, if the call debug information must be sent to the server -//@need_log True, if the call log must be sent to the server -callStateDiscarded#531b7c45 reason:CallDiscardReason need_rating:Bool need_debug_information:Bool need_log:Bool = CallState; - -//@description The call has ended with an error -//@error Error. An error with the code 4005000 will be returned if an outgoing call is missed because of an expired timeout -callStateError#c5df6495 error:error = CallState; - -//@class GroupCallVideoQuality @description Describes the quality of a group call video - -//@description The worst available video quality -groupCallVideoQualityThumbnail#e9661380 = GroupCallVideoQuality; - -//@description The medium video quality -groupCallVideoQualityMedium#178abcaa = GroupCallVideoQuality; - -//@description The best available video quality -groupCallVideoQualityFull#81491637 = GroupCallVideoQuality; - -//@description Describes an available stream in a group call -//@channel_id Identifier of an audio/video channel -//@scale Scale of segment durations in the stream. The duration is 1000/(2**scale) milliseconds -//@time_offset Point in time when the stream currently ends; Unix timestamp in milliseconds -groupCallStream#f03b0fc5 channel_id:int32 scale:int32 time_offset:int53 = GroupCallStream; - -//@description Represents a list of group call streams -//@streams A list of group call streams -groupCallStreams#c89191b streams:vector = GroupCallStreams; - -//@description Represents an RTMP URL -//@url The URL -//@stream_key Stream key -rtmpUrl#3c28bc55 url:string stream_key:string = RtmpUrl; - -//@description Describes a recently speaking participant in a group call -//@participant_id Group call participant identifier -//@is_speaking True, is the user has spoken recently -groupCallRecentSpeaker#6c73a9cc participant_id:MessageSender is_speaking:Bool = GroupCallRecentSpeaker; - -//@description Describes a group call -//@id Group call identifier -//@title Group call title -//@scheduled_start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended -//@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call starts -//@is_active True, if the call is active -//@is_rtmp_stream True, if the chat is an RTMP stream instead of an ordinary video chat -//@is_joined True, if the call is joined -//@need_rejoin True, if user was kicked from the call because of network loss and the call needs to be rejoined -//@can_be_managed True, if the current user can manage the group call -//@participant_count Number of participants in the group call -//@has_hidden_listeners True, if group call participants, which are muted, aren't returned in participant list -//@loaded_all_participants True, if all group call participants are loaded -//@recent_speakers At most 3 recently speaking users in the group call -//@is_my_video_enabled True, if the current user's video is enabled -//@is_my_video_paused True, if the current user's video is paused -//@can_enable_video True, if the current user can broadcast video or share screen -//@mute_new_participants True, if only group call administrators can unmute new participants -//@can_toggle_mute_new_participants True, if the current user can enable or disable mute_new_participants setting -//@record_duration Duration of the ongoing group call recording, in seconds; 0 if none. An updateGroupCall update is not triggered when value of this field changes, but the same recording goes on -//@is_video_recorded True, if a video file is being recorded for the call -//@duration Call duration, in seconds; for ended calls only -groupCall#9ac55fff id:int32 title:string scheduled_start_date:int32 enabled_start_notification:Bool is_active:Bool is_rtmp_stream:Bool is_joined:Bool need_rejoin:Bool can_be_managed:Bool participant_count:int32 has_hidden_listeners:Bool loaded_all_participants:Bool recent_speakers:vector is_my_video_enabled:Bool is_my_video_paused:Bool can_enable_video:Bool mute_new_participants:Bool can_toggle_mute_new_participants:Bool record_duration:int32 is_video_recorded:Bool duration:int32 = GroupCall; - -//@description Describes a group of video synchronization source identifiers -//@semantics The semantics of sources, one of "SIM" or "FID" -//@source_ids The list of synchronization source identifiers -groupCallVideoSourceGroup#4ef8a4af semantics:string source_ids:vector = GroupCallVideoSourceGroup; - -//@description Contains information about a group call participant's video channel -//@source_groups List of synchronization source groups of the video -//@endpoint_id Video channel endpoint identifier -//@is_paused True, if the video is paused. This flag needs to be ignored, if new video frames are received -groupCallParticipantVideoInfo#70f7eff6 source_groups:vector endpoint_id:string is_paused:Bool = GroupCallParticipantVideoInfo; - -//@description Represents a group call participant -//@participant_id Identifier of the group call participant -//@audio_source_id User's audio channel synchronization source identifier -//@screen_sharing_audio_source_id User's screen sharing audio channel synchronization source identifier -//@video_info Information about user's video channel; may be null if there is no active video -//@screen_sharing_video_info Information about user's screen sharing video channel; may be null if there is no active screen sharing video -//@bio The participant user's bio or the participant chat's description -//@is_current_user True, if the participant is the current user -//@is_speaking True, if the participant is speaking as set by setGroupCallParticipantIsSpeaking -//@is_hand_raised True, if the participant hand is raised -//@can_be_muted_for_all_users True, if the current user can mute the participant for all other group call participants -//@can_be_unmuted_for_all_users True, if the current user can allow the participant to unmute themselves or unmute the participant (if the participant is the current user) -//@can_be_muted_for_current_user True, if the current user can mute the participant only for self -//@can_be_unmuted_for_current_user True, if the current user can unmute the participant for self -//@is_muted_for_all_users True, if the participant is muted for all users -//@is_muted_for_current_user True, if the participant is muted for the current user -//@can_unmute_self True, if the participant is muted for all users, but can unmute themselves -//@volume_level Participant's volume level; 1-20000 in hundreds of percents -//@order User's order in the group call participant list. Orders must be compared lexicographically. The bigger is order, the higher is user in the list. If order is empty, the user must be removed from the participant list -groupCallParticipant#7abca1eb participant_id:MessageSender audio_source_id:int32 screen_sharing_audio_source_id:int32 video_info:groupCallParticipantVideoInfo screen_sharing_video_info:groupCallParticipantVideoInfo bio:string is_current_user:Bool is_speaking:Bool is_hand_raised:Bool can_be_muted_for_all_users:Bool can_be_unmuted_for_all_users:Bool can_be_muted_for_current_user:Bool can_be_unmuted_for_current_user:Bool is_muted_for_all_users:Bool is_muted_for_current_user:Bool can_unmute_self:Bool volume_level:int32 order:string = GroupCallParticipant; - -//@class CallProblem @description Describes the exact type of problem with a call - -//@description The user heard their own voice -callProblemEcho#2fc01184 = CallProblem; - -//@description The user heard background noise -callProblemNoise#3ec4808f = CallProblem; - -//@description The other side kept disappearing -callProblemInterruptions#42ba1c62 = CallProblem; - -//@description The speech was distorted -callProblemDistortedSpeech#16a5bd05 = CallProblem; - -//@description The user couldn't hear the other side -callProblemSilentLocal#f1e6f36 = CallProblem; - -//@description The other side couldn't hear the user -callProblemSilentRemote#2230f89a = CallProblem; - -//@description The call ended unexpectedly -callProblemDropped#b809e381 = CallProblem; - -//@description The video was distorted -callProblemDistortedVideo#16f6620a = CallProblem; - -//@description The video was pixelated -callProblemPixelatedVideo#7e1526d3 = CallProblem; - -//@description Describes a call -//@id Call identifier, not persistent -//@user_id User identifier of the other call participant -//@is_outgoing True, if the call is outgoing -//@is_video True, if the call is a video call -//@state Call state -//@group_call_id Identifier of the group call associated with the call; 0 if the group call isn't created yet. The group call can be received through the method getGroupCall -call#9e0dd8aa id:int32 user_id:int53 is_outgoing:Bool is_video:Bool state:CallState group_call_id:int32 = Call; - -//@class FirebaseAuthenticationSettings @description Contains settings for Firebase Authentication in the official applications - -//@description Settings for Firebase Authentication in the official Android application -firebaseAuthenticationSettingsAndroid#966ef61c = FirebaseAuthenticationSettings; - -//@description Settings for Firebase Authentication in the official iOS application -//@device_token Device token from Apple Push Notification service -//@is_app_sandbox True, if App Sandbox is enabled -firebaseAuthenticationSettingsIos#d49a4c4 device_token:string is_app_sandbox:Bool = FirebaseAuthenticationSettings; - -//@description Contains settings for the authentication of the user's phone number -//@allow_flash_call Pass true if the authentication code may be sent via a flash call to the specified phone number -//@allow_missed_call Pass true if the authentication code may be sent via a missed call to the specified phone number -//@is_current_phone_number Pass true if the authenticated phone number is used on the current device -//@has_unknown_phone_number Pass true if there is a SIM card in the current device, but it is not possible to check whether phone number matches -//@allow_sms_retriever_api For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details -//@firebase_authentication_settings For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication -//@authentication_tokens List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions -phoneNumberAuthenticationSettings#3e1183db allow_flash_call:Bool allow_missed_call:Bool is_current_phone_number:Bool has_unknown_phone_number:Bool allow_sms_retriever_api:Bool firebase_authentication_settings:FirebaseAuthenticationSettings authentication_tokens:vector = PhoneNumberAuthenticationSettings; - -//@description Represents a reaction applied to a message -//@type Type of the reaction -//@sender_id Identifier of the chat member, applied the reaction -//@is_outgoing True, if the reaction was added by the current user -//@date Point in time (Unix timestamp) when the reaction was added -addedReaction#4b04819d type:ReactionType sender_id:MessageSender is_outgoing:Bool date:int32 = AddedReaction; - -//@description Represents a list of reactions added to a message -//@total_count The total number of found reactions -//@reactions The list of added reactions -//@next_offset The offset for the next request. If empty, then there are no more results -addedReactions#77bf7590 total_count:int32 reactions:vector next_offset:string = AddedReactions; - -//@description Represents an available reaction -//@type Type of the reaction -//@needs_premium True, if Telegram Premium is needed to send the reaction -availableReaction#f9024387 type:ReactionType needs_premium:Bool = AvailableReaction; - -//@description Represents a list of reactions that can be added to a message -//@top_reactions List of reactions to be shown at the top -//@recent_reactions List of recently used reactions -//@popular_reactions List of popular reactions -//@allow_custom_emoji True, if any custom emoji reaction can be added by Telegram Premium subscribers -//@are_tags True, if the reactions will be tags and the message can be found by them -//@unavailability_reason The reason why the current user can't add reactions to the message, despite some other users can; may be null if none -availableReactions#3596f453 top_reactions:vector recent_reactions:vector popular_reactions:vector allow_custom_emoji:Bool are_tags:Bool unavailability_reason:ReactionUnavailabilityReason = AvailableReactions; - -//@description Contains information about an emoji reaction -//@emoji Text representation of the reaction -//@title Reaction title -//@is_active True, if the reaction can be added to new messages and enabled in chats -//@static_icon Static icon for the reaction -//@appear_animation Appear animation for the reaction -//@select_animation Select animation for the reaction -//@activate_animation Activate animation for the reaction -//@effect_animation Effect animation for the reaction -//@around_animation Around animation for the reaction; may be null -//@center_animation Center animation for the reaction; may be null -emojiReaction#60532c5f emoji:string title:string is_active:Bool static_icon:sticker appear_animation:sticker select_animation:sticker activate_animation:sticker effect_animation:sticker around_animation:sticker center_animation:sticker = EmojiReaction; - -//@class ReactionUnavailabilityReason @description Describes why the current user can't add reactions to the message, despite some other users can - -//@description The user is an anonymous administrator in the supergroup, but isn't a creator of it, so they can't vote on behalf of the supergroup -reactionUnavailabilityReasonAnonymousAdministrator#e23883fb = ReactionUnavailabilityReason; - -//@description The user isn't a member of the supergroup and can't send messages and reactions there without joining -reactionUnavailabilityReasonGuest#50ef5244 = ReactionUnavailabilityReason; - -//@description Represents a list of animations -//@animations List of animations -animations#2ce4157c animations:vector = Animations; - -//@class DiceStickers @description Contains animated stickers which must be used for dice animation rendering - -//@description A regular animated sticker -//@sticker The animated sticker with the dice animation -diceStickersRegular#d3dfecce sticker:sticker = DiceStickers; - -//@description Animated stickers to be combined into a slot machine -//@background The animated sticker with the slot machine background. The background animation must start playing after all reel animations finish -//@lever The animated sticker with the lever animation. The lever animation must play once in the initial dice state -//@left_reel The animated sticker with the left reel -//@center_reel The animated sticker with the center reel -//@right_reel The animated sticker with the right reel -diceStickersSlotMachine#e9a28cac background:sticker lever:sticker left_reel:sticker center_reel:sticker right_reel:sticker = DiceStickers; - -//@description Represents the result of an importContacts request -//@user_ids User identifiers of the imported contacts in the same order as they were specified in the request; 0 if the contact is not yet a registered user -//@importer_count The number of users that imported the corresponding contact; 0 for already registered users or if unavailable -importedContacts#1119a03e user_ids:vector importer_count:vector = ImportedContacts; - -//@class SpeechRecognitionResult @description Describes result of speech recognition in a voice note - -//@description The speech recognition is ongoing -//@partial_text Partially recognized text -speechRecognitionResultPending#9ebc8e00 partial_text:string = SpeechRecognitionResult; - -//@description The speech recognition successfully finished -//@text Recognized text -speechRecognitionResultText#80e681dd text:string = SpeechRecognitionResult; - -//@description The speech recognition failed -//@error Recognition error. An error with a message "MSG_VOICE_TOO_LONG" is returned when media duration is too big to be recognized -speechRecognitionResultError#9d243fc error:error = SpeechRecognitionResult; - -//@description Describes a connection of the bot with a business account -//@id Unique identifier of the connection -//@user_id Identifier of the business user that created the connection -//@user_chat_id Chat identifier of the private chat with the user -//@date Point in time (Unix timestamp) when the connection was established -//@can_reply True, if the bot can send messages to the connected user; false otherwise -//@is_enabled True, if the connection is enabled; false otherwise -businessConnection#4436e234 id:string user_id:int53 user_chat_id:int53 date:int32 can_reply:Bool is_enabled:Bool = BusinessConnection; - -//@description Describes a color to highlight a bot added to attachment menu -//@light_color Color in the RGB format for light themes -//@dark_color Color in the RGB format for dark themes -attachmentMenuBotColor#64235ebc light_color:int32 dark_color:int32 = AttachmentMenuBotColor; - -//@description Represents a bot, which can be added to attachment or side menu -//@bot_user_id User identifier of the bot -//@supports_self_chat True, if the bot supports opening from attachment menu in the chat with the bot -//@supports_user_chats True, if the bot supports opening from attachment menu in private chats with ordinary users -//@supports_bot_chats True, if the bot supports opening from attachment menu in private chats with other bots -//@supports_group_chats True, if the bot supports opening from attachment menu in basic group and supergroup chats -//@supports_channel_chats True, if the bot supports opening from attachment menu in channel chats -//@request_write_access True, if the user must be asked for the permission to send messages to the bot -//@is_added True, if the bot was explicitly added by the user. If the bot isn't added, then on the first bot launch toggleBotIsAddedToAttachmentMenu must be called and the bot must be added or removed -//@show_in_attachment_menu True, if the bot must be shown in the attachment menu -//@show_in_side_menu True, if the bot must be shown in the side menu -//@show_disclaimer_in_side_menu True, if a disclaimer, why the bot is shown in the side menu, is needed -//@name Name for the bot in attachment menu -//@name_color Color to highlight selected name of the bot if appropriate; may be null -//@default_icon Default icon for the bot in SVG format; may be null -//@ios_static_icon Icon for the bot in SVG format for the official iOS app; may be null -//@ios_animated_icon Icon for the bot in TGS format for the official iOS app; may be null -//@ios_side_menu_icon Icon for the bot in PNG format for the official iOS app side menu; may be null -//@android_icon Icon for the bot in TGS format for the official Android app; may be null -//@android_side_menu_icon Icon for the bot in SVG format for the official Android app side menu; may be null -//@macos_icon Icon for the bot in TGS format for the official native macOS app; may be null -//@macos_side_menu_icon Icon for the bot in PNG format for the official macOS app side menu; may be null -//@icon_color Color to highlight selected icon of the bot if appropriate; may be null -//@web_app_placeholder Default placeholder for opened Web Apps in SVG format; may be null -attachmentMenuBot#b96e1bbf bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool request_write_access:Bool is_added:Bool show_in_attachment_menu:Bool show_in_side_menu:Bool show_disclaimer_in_side_menu:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file ios_side_menu_icon:file android_icon:file android_side_menu_icon:file macos_icon:file macos_side_menu_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; - -//@description Information about the message sent by answerWebAppQuery -//@inline_message_id Identifier of the sent inline message, if known -sentWebAppMessage#4a24eec0 inline_message_id:string = SentWebAppMessage; - -//@class BotWriteAccessAllowReason @description Describes a reason why a bot was allowed to write messages to the current user - -//@description The user connected a website by logging in using Telegram Login Widget on it -//@domain_name Domain name of the connected website -botWriteAccessAllowReasonConnectedWebsite#782eafe3 domain_name:string = BotWriteAccessAllowReason; - -//@description The user added the bot to attachment or side menu using toggleBotIsAddedToAttachmentMenu -botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d = BotWriteAccessAllowReason; - -//@description The user launched a Web App using getWebAppLinkUrl -//@web_app Information about the Web App -botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 web_app:webApp = BotWriteAccessAllowReason; - -//@description The user accepted bot's request to send messages with allowBotToSendMessages -botWriteAccessAllowReasonAcceptedRequest#89c63bfc = BotWriteAccessAllowReason; - -//@description Contains an HTTP URL -//@url The URL -httpUrl#87b775a6 url:string = HttpUrl; - -//@description Contains an HTTPS URL, which can be used to get information about a user -//@url The URL -//@expires_in Left time for which the link is valid, in seconds; 0 if the link is a public username link -userLink#1db0fef8 url:string expires_in:int32 = UserLink; - -//@description Describes allowed types for the target chat -//@allow_user_chats True, if private chats with ordinary users are allowed -//@allow_bot_chats True, if private chats with other bots are allowed -//@allow_group_chats True, if basic group and supergroup chats are allowed -//@allow_channel_chats True, if channel chats are allowed -targetChatTypes#5a300e51 allow_user_chats:Bool allow_bot_chats:Bool allow_group_chats:Bool allow_channel_chats:Bool = TargetChatTypes; - -//@class TargetChat @description Describes the target chat to be opened - -//@description The currently opened chat and forum topic must be kept -targetChatCurrent#e729d110 = TargetChat; - -//@description The chat needs to be chosen by the user among chats of the specified types -//@types Allowed types for the chat -targetChatChosen#acf8d5a6 types:targetChatTypes = TargetChat; - -//@description The chat needs to be open with the provided internal link -//@link An internal link pointing to the chat -targetChatInternalLink#dd788fe0 link:InternalLinkType = TargetChat; - -//@class InputInlineQueryResult @description Represents a single result of an inline query; for bots only - -//@description Represents a link to an animated GIF or an animated (i.e., without sound) H.264/MPEG-4 AVC video -//@id Unique identifier of the query result -//@title Title of the query result -//@thumbnail_url URL of the result thumbnail (JPEG, GIF, or MPEG4), if it exists -//@thumbnail_mime_type MIME type of the video thumbnail. If non-empty, must be one of "image/jpeg", "image/gif" and "video/mp4" -//@video_url The URL of the video file (file size must not exceed 1MB) -//@video_mime_type MIME type of the video file. Must be one of "image/gif" and "video/mp4" -//@video_duration Duration of the video, in seconds -//@video_width Width of the video -//@video_height Height of the video -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultAnimation#a7335216 id:string title:string thumbnail_url:string thumbnail_mime_type:string video_url:string video_mime_type:string video_duration:int32 video_width:int32 video_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; - -//@description Represents a link to an article or web page -//@id Unique identifier of the query result -//@url URL of the result, if it exists -//@title Title of the result -//@param_description A short description of the result -//@thumbnail_url URL of the result thumbnail, if it exists -//@thumbnail_width Thumbnail width, if known -//@thumbnail_height Thumbnail height, if known -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultArticle#763583bc id:string url:string title:string description:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; - -//@description Represents a link to an MP3 audio file -//@id Unique identifier of the query result -//@title Title of the audio file -//@performer Performer of the audio file -//@audio_url The URL of the audio file -//@audio_duration Audio file duration, in seconds -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageAudio, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultAudio#4b1c35d4 id:string title:string performer:string audio_url:string audio_duration:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; - -//@description Represents a user contact -//@id Unique identifier of the query result -//@contact User contact -//@thumbnail_url URL of the result thumbnail, if it exists -//@thumbnail_width Thumbnail width, if known -//@thumbnail_height Thumbnail height, if known -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultContact#6e08b5d2 id:string contact:contact thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; - -//@description Represents a link to a file -//@id Unique identifier of the query result -//@title Title of the resulting file -//@param_description Short description of the result, if known -//@document_url URL of the file -//@mime_type MIME type of the file content; only "application/pdf" and "application/zip" are currently allowed -//@thumbnail_url The URL of the file thumbnail, if it exists -//@thumbnail_width Width of the thumbnail -//@thumbnail_height Height of the thumbnail -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageDocument, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultDocument#227fd0cd id:string title:string description:string document_url:string mime_type:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; - -//@description Represents a game -//@id Unique identifier of the query result -//@game_short_name Short name of the game -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -inputInlineQueryResultGame#39951fd7 id:string game_short_name:string reply_markup:ReplyMarkup = InputInlineQueryResult; - -//@description Represents a point on the map -//@id Unique identifier of the query result -//@location Location result -//@live_period Amount of time relative to the message sent time until the location can be updated, in seconds -//@title Title of the result -//@thumbnail_url URL of the result thumbnail, if it exists -//@thumbnail_width Thumbnail width, if known -//@thumbnail_height Thumbnail height, if known -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultLocation#8f7cbe56 id:string location:location live_period:int32 title:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; - -//@description Represents link to a JPEG image -//@id Unique identifier of the query result -//@title Title of the result, if known -//@param_description A short description of the result, if known -//@thumbnail_url URL of the photo thumbnail, if it exists -//@photo_url The URL of the JPEG photo (photo size must not exceed 5MB) -//@photo_width Width of the photo -//@photo_height Height of the photo -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessagePhoto, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultPhoto#bd0b361f id:string title:string description:string thumbnail_url:string photo_url:string photo_width:int32 photo_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; - -//@description Represents a link to a WEBP, TGS, or WEBM sticker -//@id Unique identifier of the query result -//@thumbnail_url URL of the sticker thumbnail, if it exists -//@sticker_url The URL of the WEBP, TGS, or WEBM sticker (sticker file size must not exceed 5MB) -//@sticker_width Width of the sticker -//@sticker_height Height of the sticker -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageSticker, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultSticker#10550459 id:string thumbnail_url:string sticker_url:string sticker_width:int32 sticker_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; - -//@description Represents information about a venue -//@id Unique identifier of the query result -//@venue Venue result -//@thumbnail_url URL of the result thumbnail, if it exists -//@thumbnail_width Thumbnail width, if known -//@thumbnail_height Thumbnail height, if known -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultVenue#2049c13d id:string venue:venue thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; - -//@description Represents a link to a page containing an embedded video player or a video file -//@id Unique identifier of the query result -//@title Title of the result -//@param_description A short description of the result, if known -//@thumbnail_url The URL of the video thumbnail (JPEG), if it exists -//@video_url URL of the embedded video player or video file -//@mime_type MIME type of the content of the video URL, only "text/html" or "video/mp4" are currently supported -//@video_width Width of the video -//@video_height Height of the video -//@video_duration Video duration, in seconds -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageVideo, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultVideo#66c344e7 id:string title:string description:string thumbnail_url:string video_url:string mime_type:string video_width:int32 video_height:int32 video_duration:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; - -//@description Represents a link to an opus-encoded audio file within an OGG container, single channel audio -//@id Unique identifier of the query result -//@title Title of the voice note -//@voice_note_url The URL of the voice note file -//@voice_note_duration Duration of the voice note, in seconds -//@reply_markup The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard or null -//@input_message_content The content of the message to be sent. Must be one of the following types: inputMessageText, inputMessageVoiceNote, inputMessageInvoice, inputMessageLocation, inputMessageVenue or inputMessageContact -inputInlineQueryResultVoiceNote#954da949 id:string title:string voice_note_url:string voice_note_duration:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; - -//@class InlineQueryResult @description Represents a single result of an inline query - -//@description Represents a link to an article or web page -//@id Unique identifier of the query result -//@url URL of the result, if it exists -//@title Title of the result -//@param_description A short description of the result -//@thumbnail Result thumbnail in JPEG format; may be null -inlineQueryResultArticle#1016d01a id:string url:string title:string description:string thumbnail:thumbnail = InlineQueryResult; - -//@description Represents a user contact -//@id Unique identifier of the query result -//@contact A user contact -//@thumbnail Result thumbnail in JPEG format; may be null -inlineQueryResultContact#f5278212 id:string contact:contact thumbnail:thumbnail = InlineQueryResult; - -//@description Represents a point on the map -//@id Unique identifier of the query result -//@location Location result -//@title Title of the result -//@thumbnail Result thumbnail in JPEG format; may be null -inlineQueryResultLocation#1bc6ab10 id:string location:location title:string thumbnail:thumbnail = InlineQueryResult; - -//@description Represents information about a venue -//@id Unique identifier of the query result -//@venue Venue result -//@thumbnail Result thumbnail in JPEG format; may be null -inlineQueryResultVenue#4c5b105e id:string venue:venue thumbnail:thumbnail = InlineQueryResult; - -//@description Represents information about a game -//@id Unique identifier of the query result -//@game Game result -inlineQueryResultGame#65bd7c7b id:string game:game = InlineQueryResult; - -//@description Represents an animation file -//@id Unique identifier of the query result -//@animation Animation file -//@title Animation title -inlineQueryResultAnimation#77cded0b id:string animation:animation title:string = InlineQueryResult; - -//@description Represents an audio file -//@id Unique identifier of the query result -//@audio Audio file -inlineQueryResultAudio#3239d2f8 id:string audio:audio = InlineQueryResult; - -//@description Represents a document -//@id Unique identifier of the query result -//@document Document -//@title Document title -//@param_description Document description -inlineQueryResultDocument#a71d0c45 id:string document:document title:string description:string = InlineQueryResult; - -//@description Represents a photo -//@id Unique identifier of the query result -//@photo Photo -//@title Title of the result, if known -//@param_description A short description of the result, if known -inlineQueryResultPhoto#6e2b1dd0 id:string photo:photo title:string description:string = InlineQueryResult; - -//@description Represents a sticker -//@id Unique identifier of the query result -//@sticker Sticker -inlineQueryResultSticker#91d6560b id:string sticker:sticker = InlineQueryResult; - -//@description Represents a video -//@id Unique identifier of the query result -//@video Video -//@title Title of the video -//@param_description Description of the video -inlineQueryResultVideo#ae2742e5 id:string video:video title:string description:string = InlineQueryResult; - -//@description Represents a voice note -//@id Unique identifier of the query result -//@voice_note Voice note -//@title Title of the voice note -inlineQueryResultVoiceNote#8ee8142f id:string voice_note:voiceNote title:string = InlineQueryResult; - -//@class InlineQueryResultsButtonType @description Represents type of button in results of inline query - -//@description Describes the button that opens a private chat with the bot and sends a start message to the bot with the given parameter -//@parameter The parameter for the bot start message -inlineQueryResultsButtonTypeStartBot#fe9af0d5 parameter:string = InlineQueryResultsButtonType; - -//@description Describes the button that opens a Web App by calling getWebAppUrl -//@url An HTTP URL to pass to getWebAppUrl -inlineQueryResultsButtonTypeWebApp#b8a16362 url:string = InlineQueryResultsButtonType; - -//@description Represents a button to be shown above inline query results -//@text The text of the button -//@type Type of the button -inlineQueryResultsButton#d0df08ae text:string type:InlineQueryResultsButtonType = InlineQueryResultsButton; - -//@description Represents the results of the inline query. Use sendInlineQueryResultMessage to send the result of the query -//@inline_query_id Unique identifier of the inline query -//@button Button to be shown above inline query results; may be null -//@results Results of the query -//@next_offset The offset for the next request. If empty, then there are no more results -inlineQueryResults#ffd17579 inline_query_id:int64 button:inlineQueryResultsButton results:vector next_offset:string = InlineQueryResults; - -//@description Represents an inline message that can be sent via the bot -//@id Unique identifier for the message -//@expiration_date Point in time (Unix timestamp) when the message can't be used anymore -preparedInlineMessageId#380d9be4 id:string expiration_date:int32 = PreparedInlineMessageId; - -//@description Represents a ready to send inline message. Use sendInlineQueryResultMessage to send the message -//@inline_query_id Unique identifier of the inline query to pass to sendInlineQueryResultMessage -//@result Resulted inline message of the query -//@chat_types Types of the chats to which the message can be sent -preparedInlineMessage#942e7cc2 inline_query_id:int64 result:InlineQueryResult chat_types:targetChatTypes = PreparedInlineMessage; - -//@class CallbackQueryPayload @description Represents a payload of a callback query - -//@description The payload for a general callback button -//@data Data that was attached to the callback button -callbackQueryPayloadData#8a1e3c66 data:bytes = CallbackQueryPayload; - -//@description The payload for a callback button requiring password -//@password The 2-step verification password for the current user -//@data Data that was attached to the callback button -callbackQueryPayloadDataWithPassword#4fe2d8f2 password:string data:bytes = CallbackQueryPayload; - -//@description The payload for a game callback button -//@game_short_name A short name of the game that was attached to the callback button -callbackQueryPayloadGame#4db2ec38 game_short_name:string = CallbackQueryPayload; - -//@description Contains a bot's answer to a callback query -//@text Text of the answer -//@show_alert True, if an alert must be shown to the user instead of a toast notification -//@url URL to be opened -callbackQueryAnswer#1582685d text:string show_alert:Bool url:string = CallbackQueryAnswer; - -//@description Contains the result of a custom request -//@result A JSON-serialized result -customRequestResult#88326ffc result:string = CustomRequestResult; - -//@description Contains one row of the game high score table -//@position Position in the high score table -//@user_id User identifier -//@score User score -gameHighScore#146fcf1e position:int32 user_id:int53 score:int32 = GameHighScore; - -//@description Contains a list of game high scores -//@scores A list of game high scores -gameHighScores#6d4cd30d scores:vector = GameHighScores; - -//@class ChatEventAction @description Represents a chat event - -//@description A message was edited -//@old_message The original message before the edit -//@new_message The message after it was edited -chatEventMessageEdited#e64ff5f8 old_message:message new_message:message = ChatEventAction; - -//@description A message was deleted -//@message Deleted message -//@can_report_anti_spam_false_positive True, if the message deletion can be reported via reportSupergroupAntiSpamFalsePositive -chatEventMessageDeleted#37bfcd73 message:message can_report_anti_spam_false_positive:Bool = ChatEventAction; - -//@description A message was pinned -//@message Pinned message -chatEventMessagePinned#1a26ad1a message:message = ChatEventAction; - -//@description A message was unpinned -//@message Unpinned message -chatEventMessageUnpinned#e9943b17 message:message = ChatEventAction; - -//@description A poll in a message was stopped -//@message The message with the poll -chatEventPollStopped#77cc8be5 message:message = ChatEventAction; - -//@description A new member joined the chat -chatEventMemberJoined#f1f70924 = ChatEventAction; - -//@description A new member joined the chat via an invite link -//@invite_link Invite link used to join the chat -//@via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder -chatEventMemberJoinedByInviteLink#a9d6dd7a invite_link:chatInviteLink via_chat_folder_invite_link:Bool = ChatEventAction; - -//@description A new member was accepted to the chat by an administrator -//@approver_user_id User identifier of the chat administrator, approved user join request -//@invite_link Invite link used to join the chat; may be null -chatEventMemberJoinedByRequest#9dc87e3f approver_user_id:int53 invite_link:chatInviteLink = ChatEventAction; - -//@description A new chat member was invited -//@user_id New member user identifier -//@status New member status -chatEventMemberInvited#38d7bfc9 user_id:int53 status:ChatMemberStatus = ChatEventAction; - -//@description A member left the chat -chatEventMemberLeft#c778400f = ChatEventAction; - -//@description A chat member has gained/lost administrator status, or the list of their administrator privileges has changed -//@user_id Affected chat member user identifier -//@old_status Previous status of the chat member -//@new_status New status of the chat member -chatEventMemberPromoted#1f4f6861 user_id:int53 old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; - -//@description A chat member was restricted/unrestricted or banned/unbanned, or the list of their restrictions has changed -//@member_id Affected chat member identifier -//@old_status Previous status of the chat member -//@new_status New status of the chat member -chatEventMemberRestricted#5f951e05 member_id:MessageSender old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; - -//@description A chat member extended their subscription to the chat -//@user_id Affected chat member user identifier -//@old_status Previous status of the chat member -//@new_status New status of the chat member -chatEventMemberSubscriptionExtended#bbfab002 user_id:int53 old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; - -//@description The chat available reactions were changed -//@old_available_reactions Previous chat available reactions -//@new_available_reactions New chat available reactions -chatEventAvailableReactionsChanged#97b8e0bf old_available_reactions:ChatAvailableReactions new_available_reactions:ChatAvailableReactions = ChatEventAction; - -//@description The chat background was changed -//@old_background Previous background; may be null if none -//@new_background New background; may be null if none -chatEventBackgroundChanged#b6ed6d38 old_background:chatBackground new_background:chatBackground = ChatEventAction; - -//@description The chat description was changed -//@old_description Previous chat description -//@new_description New chat description -chatEventDescriptionChanged#254cf1e old_description:string new_description:string = ChatEventAction; - -//@description The chat emoji status was changed -//@old_emoji_status Previous emoji status; may be null if none -//@new_emoji_status New emoji status; may be null if none -chatEventEmojiStatusChanged#83e97b1e old_emoji_status:emojiStatus new_emoji_status:emojiStatus = ChatEventAction; - -//@description The linked chat of a supergroup was changed -//@old_linked_chat_id Previous supergroup linked chat identifier -//@new_linked_chat_id New supergroup linked chat identifier -chatEventLinkedChatChanged#6b2271af old_linked_chat_id:int53 new_linked_chat_id:int53 = ChatEventAction; - -//@description The supergroup location was changed -//@old_location Previous location; may be null -//@new_location New location; may be null -chatEventLocationChanged#e7cdfd4e old_location:chatLocation new_location:chatLocation = ChatEventAction; - -//@description The message auto-delete timer was changed -//@old_message_auto_delete_time Previous value of message_auto_delete_time -//@new_message_auto_delete_time New value of message_auto_delete_time -chatEventMessageAutoDeleteTimeChanged#1083f24 old_message_auto_delete_time:int32 new_message_auto_delete_time:int32 = ChatEventAction; - -//@description The chat permissions were changed -//@old_permissions Previous chat permissions -//@new_permissions New chat permissions -chatEventPermissionsChanged#b1d337a8 old_permissions:chatPermissions new_permissions:chatPermissions = ChatEventAction; - -//@description The chat photo was changed -//@old_photo Previous chat photo value; may be null -//@new_photo New chat photo value; may be null -chatEventPhotoChanged#cfa062c3 old_photo:chatPhoto new_photo:chatPhoto = ChatEventAction; - -//@description The slow_mode_delay setting of a supergroup was changed -//@old_slow_mode_delay Previous value of slow_mode_delay, in seconds -//@new_slow_mode_delay New value of slow_mode_delay, in seconds -chatEventSlowModeDelayChanged#9d763c0b old_slow_mode_delay:int32 new_slow_mode_delay:int32 = ChatEventAction; - -//@description The supergroup sticker set was changed -//@old_sticker_set_id Previous identifier of the chat sticker set; 0 if none -//@new_sticker_set_id New identifier of the chat sticker set; 0 if none -chatEventStickerSetChanged#b5e7558f old_sticker_set_id:int64 new_sticker_set_id:int64 = ChatEventAction; - -//@description The supergroup sticker set with allowed custom emoji was changed -//@old_sticker_set_id Previous identifier of the chat sticker set; 0 if none -//@new_sticker_set_id New identifier of the chat sticker set; 0 if none -chatEventCustomEmojiStickerSetChanged#70c431b old_sticker_set_id:int64 new_sticker_set_id:int64 = ChatEventAction; - -//@description The chat title was changed -//@old_title Previous chat title -//@new_title New chat title -chatEventTitleChanged#43990ad2 old_title:string new_title:string = ChatEventAction; - -//@description The chat editable username was changed -//@old_username Previous chat username -//@new_username New chat username -chatEventUsernameChanged#6707b56b old_username:string new_username:string = ChatEventAction; - -//@description The chat active usernames were changed -//@old_usernames Previous list of active usernames -//@new_usernames New list of active usernames -chatEventActiveUsernamesChanged#95e54656 old_usernames:vector new_usernames:vector = ChatEventAction; - -//@description The chat accent color or background custom emoji were changed -//@old_accent_color_id Previous identifier of chat accent color -//@old_background_custom_emoji_id Previous identifier of the custom emoji; 0 if none -//@new_accent_color_id New identifier of chat accent color -//@new_background_custom_emoji_id New identifier of the custom emoji; 0 if none -chatEventAccentColorChanged#e6837733 old_accent_color_id:int32 old_background_custom_emoji_id:int64 new_accent_color_id:int32 new_background_custom_emoji_id:int64 = ChatEventAction; - -//@description The chat's profile accent color or profile background custom emoji were changed -//@old_profile_accent_color_id Previous identifier of chat's profile accent color; -1 if none -//@old_profile_background_custom_emoji_id Previous identifier of the custom emoji; 0 if none -//@new_profile_accent_color_id New identifier of chat's profile accent color; -1 if none -//@new_profile_background_custom_emoji_id New identifier of the custom emoji; 0 if none -chatEventProfileAccentColorChanged#a5b8da64 old_profile_accent_color_id:int32 old_profile_background_custom_emoji_id:int64 new_profile_accent_color_id:int32 new_profile_background_custom_emoji_id:int64 = ChatEventAction; - -//@description The has_protected_content setting of a channel was toggled -//@has_protected_content New value of has_protected_content -chatEventHasProtectedContentToggled#f5044201 has_protected_content:Bool = ChatEventAction; - -//@description The can_invite_users permission of a supergroup chat was toggled -//@can_invite_users New value of can_invite_users permission -chatEventInvitesToggled#fc45966b can_invite_users:Bool = ChatEventAction; - -//@description The is_all_history_available setting of a supergroup was toggled -//@is_all_history_available New value of is_all_history_available -chatEventIsAllHistoryAvailableToggled#a0b03c15 is_all_history_available:Bool = ChatEventAction; - -//@description The has_aggressive_anti_spam_enabled setting of a supergroup was toggled -//@has_aggressive_anti_spam_enabled New value of has_aggressive_anti_spam_enabled -chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 has_aggressive_anti_spam_enabled:Bool = ChatEventAction; - -//@description The sign_messages setting of a channel was toggled -//@sign_messages New value of sign_messages -chatEventSignMessagesToggled#b1b9281e sign_messages:Bool = ChatEventAction; - -//@description The show_message_sender setting of a channel was toggled -//@show_message_sender New value of show_message_sender -chatEventShowMessageSenderToggled#d0a747e3 show_message_sender:Bool = ChatEventAction; - -//@description A chat invite link was edited -//@old_invite_link Previous information about the invite link -//@new_invite_link New information about the invite link -chatEventInviteLinkEdited#e4920d62 old_invite_link:chatInviteLink new_invite_link:chatInviteLink = ChatEventAction; - -//@description A chat invite link was revoked -//@invite_link The invite link -chatEventInviteLinkRevoked#a1dbffe3 invite_link:chatInviteLink = ChatEventAction; - -//@description A revoked chat invite link was deleted -//@invite_link The invite link -chatEventInviteLinkDeleted#acda6167 invite_link:chatInviteLink = ChatEventAction; - -//@description A video chat was created -//@group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall -chatEventVideoChatCreated#6ca68a7b group_call_id:int32 = ChatEventAction; - -//@description A video chat was ended -//@group_call_id Identifier of the video chat. The video chat can be received through the method getGroupCall -chatEventVideoChatEnded#61286c48 group_call_id:int32 = ChatEventAction; - -//@description The mute_new_participants setting of a video chat was toggled -//@mute_new_participants New value of the mute_new_participants setting -chatEventVideoChatMuteNewParticipantsToggled#f87507fe mute_new_participants:Bool = ChatEventAction; - -//@description A video chat participant was muted or unmuted -//@participant_id Identifier of the affected group call participant -//@is_muted New value of is_muted -chatEventVideoChatParticipantIsMutedToggled#1f1058f7 participant_id:MessageSender is_muted:Bool = ChatEventAction; - -//@description A video chat participant volume level was changed -//@participant_id Identifier of the affected group call participant -//@volume_level New value of volume_level; 1-20000 in hundreds of percents -chatEventVideoChatParticipantVolumeLevelChanged#436f92be participant_id:MessageSender volume_level:int32 = ChatEventAction; - -//@description The is_forum setting of a channel was toggled -//@is_forum New value of is_forum -chatEventIsForumToggled#5a63d119 is_forum:Bool = ChatEventAction; - -//@description A new forum topic was created -//@topic_info Information about the topic -chatEventForumTopicCreated#7785fb42 topic_info:forumTopicInfo = ChatEventAction; - -//@description A forum topic was edited -//@old_topic_info Old information about the topic -//@new_topic_info New information about the topic -chatEventForumTopicEdited#60da2c0c old_topic_info:forumTopicInfo new_topic_info:forumTopicInfo = ChatEventAction; - -//@description A forum topic was closed or reopened -//@topic_info New information about the topic -chatEventForumTopicToggleIsClosed#c69e4d3a topic_info:forumTopicInfo = ChatEventAction; - -//@description The General forum topic was hidden or unhidden -//@topic_info New information about the topic -chatEventForumTopicToggleIsHidden#a015ef2e topic_info:forumTopicInfo = ChatEventAction; - -//@description A forum topic was deleted -//@topic_info Information about the topic -chatEventForumTopicDeleted#b08f290d topic_info:forumTopicInfo = ChatEventAction; - -//@description A pinned forum topic was changed -//@old_topic_info Information about the old pinned topic; may be null -//@new_topic_info Information about the new pinned topic; may be null -chatEventForumTopicPinned#7fc523ee old_topic_info:forumTopicInfo new_topic_info:forumTopicInfo = ChatEventAction; - -//@description Represents a chat event -//@id Chat event identifier -//@date Point in time (Unix timestamp) when the event happened -//@member_id Identifier of the user or chat who performed the action -//@action The action -chatEvent#d921b3d0 id:int64 date:int32 member_id:MessageSender action:ChatEventAction = ChatEvent; - -//@description Contains a list of chat events -//@events List of events -chatEvents#d73ecdc4 events:vector = ChatEvents; - -//@description Represents a set of filters used to obtain a chat event log -//@message_edits True, if message edits need to be returned -//@message_deletions True, if message deletions need to be returned -//@message_pins True, if pin/unpin events need to be returned -//@member_joins True, if members joining events need to be returned -//@member_leaves True, if members leaving events need to be returned -//@member_invites True, if invited member events need to be returned -//@member_promotions True, if member promotion/demotion events need to be returned -//@member_restrictions True, if member restricted/unrestricted/banned/unbanned events need to be returned -//@info_changes True, if changes in chat information need to be returned -//@setting_changes True, if changes in chat settings need to be returned -//@invite_link_changes True, if changes to invite links need to be returned -//@video_chat_changes True, if video chat actions need to be returned -//@forum_changes True, if forum-related actions need to be returned -//@subscription_extensions True, if subscription extensions need to be returned -chatEventLogFilters#c26e31b1 message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool invite_link_changes:Bool video_chat_changes:Bool forum_changes:Bool subscription_extensions:Bool = ChatEventLogFilters; - -//@class LanguagePackStringValue @description Represents the value of a string in a language pack - -//@description An ordinary language pack string -//@value String value -languagePackStringValueOrdinary#f124a660 value:string = LanguagePackStringValue; - -//@description A language pack string which has different forms based on the number of some object it mentions. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more information -//@zero_value Value for zero objects -//@one_value Value for one object -//@two_value Value for two objects -//@few_value Value for few objects -//@many_value Value for many objects -//@other_value Default value -languagePackStringValuePluralized#71a812c5 zero_value:string one_value:string two_value:string few_value:string many_value:string other_value:string = LanguagePackStringValue; - -//@description A deleted language pack string, the value must be taken from the built-in English language pack -languagePackStringValueDeleted#6d5cb6fa = LanguagePackStringValue; - -//@description Represents one language pack string -//@key String key -//@value String value; pass null if the string needs to be taken from the built-in English language pack -languagePackString#4df0e460 key:string value:LanguagePackStringValue = LanguagePackString; - -//@description Contains a list of language pack strings -//@strings A list of language pack strings -languagePackStrings#4aa681ef strings:vector = LanguagePackStrings; - -//@description Contains information about a language pack -//@id Unique language pack identifier -//@base_language_pack_id Identifier of a base language pack; may be empty. If a string is missed in the language pack, then it must be fetched from base language pack. Unsupported in custom language packs -//@name Language name -//@native_name Name of the language in that language -//@plural_code A language code to be used to apply plural forms. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more information -//@is_official True, if the language pack is official -//@is_rtl True, if the language pack strings are RTL -//@is_beta True, if the language pack is a beta language pack -//@is_installed True, if the language pack is installed by the current user -//@total_string_count Total number of non-deleted strings from the language pack -//@translated_string_count Total number of translated strings from the language pack -//@local_string_count Total number of non-deleted strings from the language pack available locally -//@translation_url Link to language translation interface; empty for custom local language packs -languagePackInfo#20514f5a id:string base_language_pack_id:string name:string native_name:string plural_code:string is_official:Bool is_rtl:Bool is_beta:Bool is_installed:Bool total_string_count:int32 translated_string_count:int32 local_string_count:int32 translation_url:string = LanguagePackInfo; - -//@description Contains information about the current localization target -//@language_packs List of available language packs for this application -localizationTargetInfo#2ca3903b language_packs:vector = LocalizationTargetInfo; - -//@class PremiumLimitType @description Describes type of limit, increased for Premium users - -//@description The maximum number of joined supergroups and channels -premiumLimitTypeSupergroupCount#f13ff385 = PremiumLimitType; - -//@description The maximum number of pinned chats in the main chat list -premiumLimitTypePinnedChatCount#c47543e1 = PremiumLimitType; - -//@description The maximum number of created public chats -premiumLimitTypeCreatedPublicChatCount#1a96beb9 = PremiumLimitType; - -//@description The maximum number of saved animations -premiumLimitTypeSavedAnimationCount#fed27d89 = PremiumLimitType; - -//@description The maximum number of favorite stickers -premiumLimitTypeFavoriteStickerCount#2621e223 = PremiumLimitType; - -//@description The maximum number of chat folders -premiumLimitTypeChatFolderCount#1680096e = PremiumLimitType; - -//@description The maximum number of pinned and always included, or always excluded chats in a chat folder -premiumLimitTypeChatFolderChosenChatCount#64d14355 = PremiumLimitType; - -//@description The maximum number of pinned chats in the archive chat list -premiumLimitTypePinnedArchivedChatCount#588b2a0c = PremiumLimitType; - -//@description The maximum number of pinned Saved Messages topics -premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df = PremiumLimitType; - -//@description The maximum length of sent media caption -premiumLimitTypeCaptionLength#1185d83a = PremiumLimitType; - -//@description The maximum length of the user's bio -premiumLimitTypeBioLength#bba28603 = PremiumLimitType; - -//@description The maximum number of invite links for a chat folder -premiumLimitTypeChatFolderInviteLinkCount#f854261a = PremiumLimitType; - -//@description The maximum number of added shareable chat folders -premiumLimitTypeShareableChatFolderCount#601eb4c7 = PremiumLimitType; - -//@description The maximum number of active stories -premiumLimitTypeActiveStoryCount#8d2c269c = PremiumLimitType; - -//@description The maximum number of stories sent per week -premiumLimitTypeWeeklySentStoryCount#269c34b = PremiumLimitType; - -//@description The maximum number of stories sent per month -premiumLimitTypeMonthlySentStoryCount#30d84b83 = PremiumLimitType; - -//@description The maximum length of captions of sent stories -premiumLimitTypeStoryCaptionLength#bed53302 = PremiumLimitType; - -//@description The maximum number of suggested reaction areas on a story -premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 = PremiumLimitType; - -//@description The maximum number of received similar chats -premiumLimitTypeSimilarChatCount#a2ce1f11 = PremiumLimitType; - -//@class PremiumFeature @description Describes a feature available to Premium users - -//@description Increased limits -premiumFeatureIncreasedLimits#6a6be1b7 = PremiumFeature; - -//@description Increased maximum upload file size -premiumFeatureIncreasedUploadFileSize#6ccce473 = PremiumFeature; - -//@description Improved download speed -premiumFeatureImprovedDownloadSpeed#f00b4a3e = PremiumFeature; - -//@description The ability to convert voice notes to text -premiumFeatureVoiceRecognition#4cc89fde = PremiumFeature; - -//@description Disabled ads -premiumFeatureDisabledAds#8847624a = PremiumFeature; - -//@description Allowed to use more reactions -premiumFeatureUniqueReactions#2db3b017 = PremiumFeature; - -//@description Allowed to use premium stickers with unique effects -premiumFeatureUniqueStickers#82b97c00 = PremiumFeature; - -//@description Allowed to use custom emoji stickers in message texts and captions -premiumFeatureCustomEmoji#4f6ddb4c = PremiumFeature; - -//@description Ability to change position of the main chat list, archive and mute all new chats from non-contacts, and completely disable notifications about the user's contacts joined Telegram -premiumFeatureAdvancedChatManagement#2f774d1a = PremiumFeature; - -//@description A badge in the user's profile -premiumFeatureProfileBadge#ded30c2 = PremiumFeature; - -//@description The ability to show an emoji status along with the user's name -premiumFeatureEmojiStatus#fdd2cce1 = PremiumFeature; - -//@description Profile photo animation on message and chat screens -premiumFeatureAnimatedProfilePhoto#f9fecce6 = PremiumFeature; - -//@description The ability to set a custom emoji as a forum topic icon -premiumFeatureForumTopicIcon#ceef6342 = PremiumFeature; - -//@description Allowed to set a premium application icons -premiumFeatureAppIcons#5e79f489 = PremiumFeature; - -//@description Allowed to translate chat messages real-time -premiumFeatureRealTimeChatTranslation#bbd80280 = PremiumFeature; - -//@description Allowed to use many additional features for stories -premiumFeatureUpgradedStories#9008051b = PremiumFeature; - -//@description The ability to boost chats -premiumFeatureChatBoost#5df89f1b = PremiumFeature; - -//@description The ability to choose accent color for replies and user profile -premiumFeatureAccentColor#361ac59e = PremiumFeature; - -//@description The ability to set private chat background for both users -premiumFeatureBackgroundForBoth#2246eefa = PremiumFeature; - -//@description The ability to use tags in Saved Messages -premiumFeatureSavedMessagesTags#3bcbe986 = PremiumFeature; - -//@description The ability to disallow incoming voice and video note messages in private chats using setUserPrivacySettingRules with userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages -premiumFeatureMessagePrivacy#2fd278f6 = PremiumFeature; - -//@description The ability to view last seen and read times of other users even they can't view last seen or read time for the current user -premiumFeatureLastSeenTimes#d2914a8f = PremiumFeature; - -//@description The ability to use Business features -premiumFeatureBusiness#a6609704 = PremiumFeature; - -//@description The ability to use all available message effects -premiumFeatureMessageEffects#d4e35061 = PremiumFeature; - -//@class BusinessFeature @description Describes a feature available to Business user accounts - -//@description The ability to set location -businessFeatureLocation#c090027c = BusinessFeature; - -//@description The ability to set opening hours -businessFeatureOpeningHours#1b7b22ed = BusinessFeature; - -//@description The ability to use quick replies -businessFeatureQuickReplies#9c380a82 = BusinessFeature; - -//@description The ability to set up a greeting message -businessFeatureGreetingMessage#6aa87474 = BusinessFeature; - -//@description The ability to set up an away message -businessFeatureAwayMessage#40f9e8dd = BusinessFeature; - -//@description The ability to create links to the business account with predefined message text -businessFeatureAccountLinks#6ffa970e = BusinessFeature; - -//@description The ability to customize start page -businessFeatureStartPage#17edf7e1 = BusinessFeature; - -//@description The ability to connect a bot to the account -businessFeatureBots#106575e5 = BusinessFeature; - -//@description The ability to show an emoji status along with the business name -businessFeatureEmojiStatus#cd8ec0e5 = BusinessFeature; - -//@description The ability to display folder names for each chat in the chat list -businessFeatureChatFolderTags#df95092a = BusinessFeature; - -//@description Allowed to use many additional features for stories -businessFeatureUpgradedStories#93fb53d2 = BusinessFeature; - -//@class PremiumStoryFeature @description Describes a story feature available to Premium users - -//@description Stories of the current user are displayed before stories of non-Premium contacts, supergroups, and channels -premiumStoryFeaturePriorityOrder#8ff172c7 = PremiumStoryFeature; - -//@description The ability to hide the fact that the user viewed other's stories -premiumStoryFeatureStealthMode#47343da4 = PremiumStoryFeature; - -//@description The ability to check who opened the current user's stories after they expire -premiumStoryFeaturePermanentViewsHistory#c2a047a0 = PremiumStoryFeature; - -//@description The ability to set custom expiration duration for stories -premiumStoryFeatureCustomExpirationDuration#dca40a96 = PremiumStoryFeature; - -//@description The ability to save other's unprotected stories -premiumStoryFeatureSaveStories#a6842fbd = PremiumStoryFeature; - -//@description The ability to use links and formatting in story caption, and use inputStoryAreaTypeLink areas -premiumStoryFeatureLinksAndFormatting#dae383f7 = PremiumStoryFeature; - -//@description The ability to choose better quality for viewed stories -premiumStoryFeatureVideoQuality#baafbea9 = PremiumStoryFeature; - -//@description Contains information about a limit, increased for Premium users -//@type The type of the limit -//@default_value Default value of the limit -//@premium_value Value of the limit for Premium users -premiumLimit#7ed372e6 type:PremiumLimitType default_value:int32 premium_value:int32 = PremiumLimit; - -//@description Contains information about features, available to Premium users -//@features The list of available features -//@limits The list of limits, increased for Premium users -//@payment_link An internal link to be opened to pay for Telegram Premium if store payment isn't possible; may be null if direct payment isn't available -premiumFeatures#4cf10e82 features:vector limits:vector payment_link:InternalLinkType = PremiumFeatures; - -//@description Contains information about features, available to Business user accounts -//@features The list of available business features -businessFeatures#e1593e48 features:vector = BusinessFeatures; - -//@class PremiumSource @description Describes a source from which the Premium features screen is opened - -//@description A limit was exceeded -//@limit_type Type of the exceeded limit -premiumSourceLimitExceeded#85ae8702 limit_type:PremiumLimitType = PremiumSource; - -//@description A user tried to use a Premium feature -//@feature The used feature -premiumSourceFeature#1a929325 feature:PremiumFeature = PremiumSource; - -//@description A user tried to use a Business feature -//@feature The used feature; pass null if none specific feature was used -premiumSourceBusinessFeature#a703725c feature:BusinessFeature = PremiumSource; - -//@description A user tried to use a Premium story feature -//@feature The used feature -premiumSourceStoryFeature#c290316c feature:PremiumStoryFeature = PremiumSource; - -//@description A user opened an internal link of the type internalLinkTypePremiumFeatures -//@referrer The referrer from the link -premiumSourceLink#7f42999c referrer:string = PremiumSource; - -//@description A user opened the Premium features screen from settings -premiumSourceSettings#eef88535 = PremiumSource; - -//@description Describes a promotion animation for a Premium feature -//@feature Premium feature -//@animation Promotion animation for the feature -premiumFeaturePromotionAnimation#899dab1c feature:PremiumFeature animation:animation = PremiumFeaturePromotionAnimation; - -//@description Describes a promotion animation for a Business feature -//@feature Business feature -//@animation Promotion animation for the feature -businessFeaturePromotionAnimation#7a05680a feature:BusinessFeature animation:animation = BusinessFeaturePromotionAnimation; - -//@description Contains state of Telegram Premium subscription and promotion videos for Premium features -//@state Text description of the state of the current Premium subscription; may be empty if the current user has no Telegram Premium subscription -//@payment_options The list of available options for buying Telegram Premium -//@animations The list of available promotion animations for Premium features -//@business_animations The list of available promotion animations for Business features -premiumState#91a8799 state:formattedText payment_options:vector animations:vector business_animations:vector = PremiumState; - -//@class StorePaymentPurpose @description Describes a purpose of an in-store payment - -//@description The user subscribing to Telegram Premium -//@is_restore Pass true if this is a restore of a Telegram Premium purchase; only for App Store -//@is_upgrade Pass true if this is an upgrade from a monthly subscription to early subscription; only for App Store -storePaymentPurposePremiumSubscription#4b558114 is_restore:Bool is_upgrade:Bool = StorePaymentPurpose; - -//@description The user creating Telegram Premium gift codes for other users -//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none -//@currency ISO 4217 currency code of the payment currency -//@amount Paid amount, in the smallest units of the currency -//@user_ids Identifiers of the users which can activate the gift codes -//@text Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed -storePaymentPurposePremiumGiftCodes#1277b01d boosted_chat_id:int53 currency:string amount:int53 user_ids:vector text:formattedText = StorePaymentPurpose; - -//@description The user creating a Telegram Premium giveaway -//@parameters Giveaway parameters -//@currency ISO 4217 currency code of the payment currency -//@amount Paid amount, in the smallest units of the currency -storePaymentPurposePremiumGiveaway#4da47aaa parameters:giveawayParameters currency:string amount:int53 = StorePaymentPurpose; - -//@description The user creating a Telegram Star giveaway -//@parameters Giveaway parameters -//@currency ISO 4217 currency code of the payment currency -//@amount Paid amount, in the smallest units of the currency -//@winner_count The number of users to receive Telegram Stars -//@star_count The number of Telegram Stars to be distributed through the giveaway -storePaymentPurposeStarGiveaway#c96d899 parameters:giveawayParameters currency:string amount:int53 winner_count:int32 star_count:int53 = StorePaymentPurpose; - -//@description The user buying Telegram Stars -//@currency ISO 4217 currency code of the payment currency -//@amount Paid amount, in the smallest units of the currency -//@star_count Number of bought Telegram Stars -storePaymentPurposeStars#9480cf14 currency:string amount:int53 star_count:int53 = StorePaymentPurpose; - -//@description The user buying Telegram Stars for other users -//@user_id Identifier of the user to which Telegram Stars are gifted -//@currency ISO 4217 currency code of the payment currency -//@amount Paid amount, in the smallest units of the currency -//@star_count Number of bought Telegram Stars -storePaymentPurposeGiftedStars#3544a624 user_id:int53 currency:string amount:int53 star_count:int53 = StorePaymentPurpose; - -//@class TelegramPaymentPurpose @description Describes a purpose of a payment toward Telegram - -//@description The user creating Telegram Premium gift codes for other users -//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none -//@currency ISO 4217 currency code of the payment currency -//@amount Paid amount, in the smallest units of the currency -//@user_ids Identifiers of the users which can activate the gift codes -//@month_count Number of months the Telegram Premium subscription will be active for the users -//@text Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed -telegramPaymentPurposePremiumGiftCodes#b13f14a9 boosted_chat_id:int53 currency:string amount:int53 user_ids:vector month_count:int32 text:formattedText = TelegramPaymentPurpose; - -//@description The user creating a Telegram Premium giveaway -//@parameters Giveaway parameters -//@currency ISO 4217 currency code of the payment currency -//@amount Paid amount, in the smallest units of the currency -//@winner_count Number of users which will be able to activate the gift codes -//@month_count Number of months the Telegram Premium subscription will be active for the users -telegramPaymentPurposePremiumGiveaway#d2a7c33f parameters:giveawayParameters currency:string amount:int53 winner_count:int32 month_count:int32 = TelegramPaymentPurpose; - -//@description The user buying Telegram Stars -//@currency ISO 4217 currency code of the payment currency -//@amount Paid amount, in the smallest units of the currency -//@star_count Number of bought Telegram Stars -telegramPaymentPurposeStars#e273ee52 currency:string amount:int53 star_count:int53 = TelegramPaymentPurpose; - -//@description The user buying Telegram Stars for other users -//@user_id Identifier of the user to which Telegram Stars are gifted -//@currency ISO 4217 currency code of the payment currency -//@amount Paid amount, in the smallest units of the currency -//@star_count Number of bought Telegram Stars -telegramPaymentPurposeGiftedStars#91b68a36 user_id:int53 currency:string amount:int53 star_count:int53 = TelegramPaymentPurpose; - -//@description The user creating a Telegram Star giveaway -//@parameters Giveaway parameters -//@currency ISO 4217 currency code of the payment currency -//@amount Paid amount, in the smallest units of the currency -//@winner_count The number of users to receive Telegram Stars -//@star_count The number of Telegram Stars to be distributed through the giveaway -telegramPaymentPurposeStarGiveaway#3c79a391 parameters:giveawayParameters currency:string amount:int53 winner_count:int32 star_count:int53 = TelegramPaymentPurpose; - -//@description The user joins a chat and subscribes to regular payments in Telegram Stars -//@invite_link Invite link to use -telegramPaymentPurposeJoinChat#8ddd6788 invite_link:string = TelegramPaymentPurpose; - -//@class DeviceToken @description Represents a data needed to subscribe for push notifications through registerDevice method. - -//@description A token for Firebase Cloud Messaging -//@token Device registration token; may be empty to deregister a device -//@encrypt True, if push notifications must be additionally encrypted -deviceTokenFirebaseCloudMessaging#d0714a07 token:string encrypt:Bool = DeviceToken; - -//@description A token for Apple Push Notification service -//@device_token Device token; may be empty to deregister a device -//@is_app_sandbox True, if App Sandbox is enabled -deviceTokenApplePush#17196bc3 device_token:string is_app_sandbox:Bool = DeviceToken; - -//@description A token for Apple Push Notification service VoIP notifications -//@device_token Device token; may be empty to deregister a device -//@is_app_sandbox True, if App Sandbox is enabled -//@encrypt True, if push notifications must be additionally encrypted -deviceTokenApplePushVoIP#2ff045e9 device_token:string is_app_sandbox:Bool encrypt:Bool = DeviceToken; - -//@description A token for Windows Push Notification Services -//@access_token The access token that will be used to send notifications; may be empty to deregister a device -deviceTokenWindowsPush#abed428f access_token:string = DeviceToken; - -//@description A token for Microsoft Push Notification Service -//@channel_uri Push notification channel URI; may be empty to deregister a device -deviceTokenMicrosoftPush#48f8e04c channel_uri:string = DeviceToken; - -//@description A token for Microsoft Push Notification Service VoIP channel -//@channel_uri Push notification channel URI; may be empty to deregister a device -deviceTokenMicrosoftPushVoIP#d12ca351 channel_uri:string = DeviceToken; - -//@description A token for web Push API -//@endpoint Absolute URL exposed by the push service where the application server can send push messages; may be empty to deregister a device -//@p256dh_base64url Base64url-encoded P-256 elliptic curve Diffie-Hellman public key -//@auth_base64url Base64url-encoded authentication secret -deviceTokenWebPush#9affdef7 endpoint:string p256dh_base64url:string auth_base64url:string = DeviceToken; - -//@description A token for Simple Push API for Firefox OS -//@endpoint Absolute URL exposed by the push service where the application server can send push messages; may be empty to deregister a device -deviceTokenSimplePush#2f49a60 endpoint:string = DeviceToken; - -//@description A token for Ubuntu Push Client service -//@token Token; may be empty to deregister a device -deviceTokenUbuntuPush#6a3c0d26 token:string = DeviceToken; - -//@description A token for BlackBerry Push Service -//@token Token; may be empty to deregister a device -deviceTokenBlackBerryPush#5cef0102 token:string = DeviceToken; - -//@description A token for Tizen Push Service -//@reg_id Push service registration identifier; may be empty to deregister a device -deviceTokenTizenPush#aef0da33 reg_id:string = DeviceToken; - -//@description A token for HUAWEI Push Service -//@token Device registration token; may be empty to deregister a device -//@encrypt True, if push notifications must be additionally encrypted -deviceTokenHuaweiPush#768f4e26 token:string encrypt:Bool = DeviceToken; - -//@description Contains a globally unique push receiver identifier, which can be used to identify which account has received a push notification -//@id The globally unique identifier of push notification subscription -pushReceiverId#161ddf2c id:int64 = PushReceiverId; - -//@class BackgroundFill @description Describes a fill of a background - -//@description Describes a solid fill of a background -//@color A color of the background in the RGB format -backgroundFillSolid#3c3dbc1d color:int32 = BackgroundFill; - -//@description Describes a gradient fill of a background -//@top_color A top color of the background in the RGB format -//@bottom_color A bottom color of the background in the RGB format -//@rotation_angle Clockwise rotation angle of the gradient, in degrees; 0-359. Must always be divisible by 45 -backgroundFillGradient#925ff17f top_color:int32 bottom_color:int32 rotation_angle:int32 = BackgroundFill; - -//@description Describes a freeform gradient fill of a background -//@colors A list of 3 or 4 colors of the freeform gradient in the RGB format -backgroundFillFreeformGradient#fa31756a colors:vector = BackgroundFill; - -//@class BackgroundType @description Describes the type of background - -//@description A wallpaper in JPEG format -//@is_blurred True, if the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12 -//@is_moving True, if the background needs to be slightly moved when device is tilted -backgroundTypeWallpaper#758c4c7b is_blurred:Bool is_moving:Bool = BackgroundType; - -//@description A PNG or TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern to be combined with the background fill chosen by the user -//@fill Fill of the background -//@intensity Intensity of the pattern when it is shown above the filled background; 0-100 -//@is_inverted True, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only -//@is_moving True, if the background needs to be slightly moved when device is tilted -backgroundTypePattern#4ce716fd fill:BackgroundFill intensity:int32 is_inverted:Bool is_moving:Bool = BackgroundType; - -//@description A filled background -//@fill The background fill -backgroundTypeFill#3b301c2c fill:BackgroundFill = BackgroundType; - -//@description A background from a chat theme; can be used only as a chat background in channels -//@theme_name Name of the chat theme -backgroundTypeChatTheme#4d7a9752 theme_name:string = BackgroundType; - -//@class InputBackground @description Contains information about background to set - -//@description A background from a local file -//@background Background file to use. Only inputFileLocal and inputFileGenerated are supported. The file must be in JPEG format for wallpapers and in PNG format for patterns -inputBackgroundLocal#97dd74a4 background:InputFile = InputBackground; - -//@description A background from the server -//@background_id The background identifier -inputBackgroundRemote#ef9c3219 background_id:int64 = InputBackground; - -//@description A background previously set in the chat; for chat backgrounds only -//@message_id Identifier of the message with the background -inputBackgroundPrevious#eb06575e message_id:int53 = InputBackground; - -//@description Describes a chat theme -//@name Theme name -//@light_settings Theme settings for a light chat theme -//@dark_settings Theme settings for a dark chat theme -chatTheme#f9406c39 name:string light_settings:themeSettings dark_settings:themeSettings = ChatTheme; - -//@description Describes a time zone -//@id Unique time zone identifier -//@name Time zone name -//@utc_time_offset Current UTC time offset for the time zone -timeZone#b919f2dd id:string name:string utc_time_offset:int32 = TimeZone; - -//@description Contains a list of time zones -//@time_zones A list of time zones -timeZones#7c4881b9 time_zones:vector = TimeZones; - -//@description Contains a list of hashtags -//@hashtags A list of hashtags -hashtags#6c2c0ae1 hashtags:vector = Hashtags; - -//@class CanSendStoryResult @description Represents result of checking whether the current user can send a story in the specific chat - -//@description A story can be sent -canSendStoryResultOk#503cf0fd = CanSendStoryResult; - -//@description The user must subscribe to Telegram Premium to be able to post stories -canSendStoryResultPremiumNeeded#567fde69 = CanSendStoryResult; - -//@description The chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat -canSendStoryResultBoostNeeded#9e60e92f = CanSendStoryResult; - -//@description The limit for the number of active stories exceeded. The user can buy Telegram Premium, delete an active story, or wait for the oldest story to expire -canSendStoryResultActiveStoryLimitExceeded#afd9aad6 = CanSendStoryResult; - -//@description The weekly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time -//@retry_after Time left before the user can send the next story -canSendStoryResultWeeklyLimitExceeded#1341a0b8 retry_after:int32 = CanSendStoryResult; - -//@description The monthly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time -//@retry_after Time left before the user can send the next story -canSendStoryResultMonthlyLimitExceeded#dd8242d5 retry_after:int32 = CanSendStoryResult; - -//@class CanTransferOwnershipResult @description Represents result of checking whether the current session can be used to transfer a chat ownership to another user - -//@description The session can be used -canTransferOwnershipResultOk#faa48643 = CanTransferOwnershipResult; - -//@description The 2-step verification needs to be enabled first -canTransferOwnershipResultPasswordNeeded#5c4a4adf = CanTransferOwnershipResult; - -//@description The 2-step verification was enabled recently, user needs to wait -//@retry_after Time left before the session can be used to transfer ownership of a chat, in seconds -canTransferOwnershipResultPasswordTooFresh#305d9b11 retry_after:int32 = CanTransferOwnershipResult; - -//@description The session was created recently, user needs to wait -//@retry_after Time left before the session can be used to transfer ownership of a chat, in seconds -canTransferOwnershipResultSessionTooFresh#3ab0c8e1 retry_after:int32 = CanTransferOwnershipResult; - -//@class CheckChatUsernameResult @description Represents result of checking whether a username can be set for a chat - -//@description The username can be set -checkChatUsernameResultOk#a6a7bb5c = CheckChatUsernameResult; - -//@description The username is invalid -checkChatUsernameResultUsernameInvalid#da087756 = CheckChatUsernameResult; - -//@description The username is occupied -checkChatUsernameResultUsernameOccupied#4ebb3729 = CheckChatUsernameResult; - -//@description The username can be purchased at https://fragment.com. Information about the username can be received using getCollectibleItemInfo -checkChatUsernameResultUsernamePurchasable#59ce59 = CheckChatUsernameResult; - -//@description The user has too many chats with username, one of them must be made private first -checkChatUsernameResultPublicChatsTooMany#d8b46c7c = CheckChatUsernameResult; - -//@description The user can't be a member of a public supergroup -checkChatUsernameResultPublicGroupsUnavailable#fce914d7 = CheckChatUsernameResult; - -//@class CheckStickerSetNameResult @description Represents result of checking whether a name can be used for a new sticker set - -//@description The name can be set -checkStickerSetNameResultOk#ac4bf258 = CheckStickerSetNameResult; - -//@description The name is invalid -checkStickerSetNameResultNameInvalid#a9bf234 = CheckStickerSetNameResult; - -//@description The name is occupied -checkStickerSetNameResultNameOccupied#3c60dc88 = CheckStickerSetNameResult; - -//@class ResetPasswordResult @description Represents result of 2-step verification password reset - -//@description The password was reset -resetPasswordResultOk#acb763f9 = ResetPasswordResult; - -//@description The password reset request is pending -//@pending_reset_date Point in time (Unix timestamp) after which the password can be reset immediately using resetPassword -resetPasswordResultPending#4729dc59 pending_reset_date:int32 = ResetPasswordResult; - -//@description The password reset request was declined -//@retry_date Point in time (Unix timestamp) when the password reset can be retried -resetPasswordResultDeclined#b857e0cb retry_date:int32 = ResetPasswordResult; - -//@class MessageFileType @description Contains information about a file with messages exported from another app - -//@description The messages were exported from a private chat -//@name Name of the other party; may be empty if unrecognized -messageFileTypePrivate#e0e44ed4 name:string = MessageFileType; - -//@description The messages were exported from a group chat -//@title Title of the group chat; may be empty if unrecognized -messageFileTypeGroup#f2e58f68 title:string = MessageFileType; - -//@description The messages were exported from a chat of unknown type -messageFileTypeUnknown#461dbab2 = MessageFileType; - -//@class PushMessageContent @description Contains content of a push message notification - -//@description A general message with hidden content -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentHidden#ed1bb85c is_pinned:Bool = PushMessageContent; - -//@description An animation message (GIF-style). -//@animation Message content; may be null -//@caption Animation caption -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentAnimation#3da4dfe4 animation:animation caption:string is_pinned:Bool = PushMessageContent; - -//@description An audio message -//@audio Message content; may be null -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentAudio#16be7872 audio:audio is_pinned:Bool = PushMessageContent; - -//@description A message with a user contact -//@name Contact's name -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentContact#ff458a54 name:string is_pinned:Bool = PushMessageContent; - -//@description A contact has registered with Telegram -pushMessageContentContactRegistered#ede1e5a0 = PushMessageContent; - -//@description A document message (a general file) -//@document Message content; may be null -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentDocument#e4adae01 document:document is_pinned:Bool = PushMessageContent; - -//@description A message with a game -//@title Game title, empty for pinned game message -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentGame#e14bb91b title:string is_pinned:Bool = PushMessageContent; - -//@description A new high score was achieved in a game -//@title Game title, empty for pinned message -//@score New score, 0 for pinned message -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentGameScore#35b8cd88 title:string score:int32 is_pinned:Bool = PushMessageContent; - -//@description A message with an invoice from a bot -//@price Product price -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentInvoice#98c88bbc price:string is_pinned:Bool = PushMessageContent; - -//@description A message with a location -//@is_live True, if the location is live -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentLocation#b33a97b3 is_live:Bool is_pinned:Bool = PushMessageContent; - -//@description A message with paid media -//@star_count Number of Telegram Stars needed to buy access to the media in the message; 0 for pinned message -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentPaidMedia#b556e74a star_count:int53 is_pinned:Bool = PushMessageContent; - -//@description A photo message -//@photo Message content; may be null -//@caption Photo caption -//@is_secret True, if the photo is secret -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentPhoto#861dc52 photo:photo caption:string is_secret:Bool is_pinned:Bool = PushMessageContent; - -//@description A message with a poll -//@question Poll question -//@is_regular True, if the poll is regular and not in quiz mode -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentPoll#fd5a743a question:string is_regular:Bool is_pinned:Bool = PushMessageContent; - -//@description A message with a Telegram Premium gift code created for the user -//@month_count Number of months the Telegram Premium subscription will be active after code activation -pushMessageContentPremiumGiftCode#18a15025 month_count:int32 = PushMessageContent; - -//@description A message with a giveaway -//@winner_count Number of users which will receive giveaway prizes; 0 for pinned message -//@prize Prize of the giveaway; may be null for pinned message -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentGiveaway#d63e7f8e winner_count:int32 prize:GiveawayPrize is_pinned:Bool = PushMessageContent; - -//@description A message with a gift -//@star_count Number of Telegram Stars that sender paid for the gift -pushMessageContentGift#84a8cd0b star_count:int53 = PushMessageContent; - -//@description A message with an upgraded gift -//@is_upgrade True, if the gift was obtained by upgrading of a previously received gift; otherwise, this is a transferred gift -pushMessageContentUpgradedGift#99fa0ade is_upgrade:Bool = PushMessageContent; - -//@description A screenshot of a message in the chat has been taken -pushMessageContentScreenshotTaken#cc51ff9 = PushMessageContent; - -//@description A message with a sticker -//@sticker Message content; may be null -//@emoji Emoji corresponding to the sticker; may be empty -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentSticker#5c98bdd3 sticker:sticker emoji:string is_pinned:Bool = PushMessageContent; - -//@description A message with a story -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentStory#996471c9 is_pinned:Bool = PushMessageContent; - -//@description A text message -//@text Message text -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentText#105ddea9 text:string is_pinned:Bool = PushMessageContent; - -//@description A video message -//@video Message content; may be null -//@caption Video caption -//@is_secret True, if the video is secret -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentVideo#127ad12f video:video caption:string is_secret:Bool is_pinned:Bool = PushMessageContent; - -//@description A video note message -//@video_note Message content; may be null -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentVideoNote#bd13f97f video_note:videoNote is_pinned:Bool = PushMessageContent; - -//@description A voice note message -//@voice_note Message content; may be null -//@is_pinned True, if the message is a pinned message with the specified content -pushMessageContentVoiceNote#54cac8b voice_note:voiceNote is_pinned:Bool = PushMessageContent; - -//@description A newly created basic group -pushMessageContentBasicGroupChatCreate#81f1defc = PushMessageContent; - -//@description New chat members were invited to a group -//@member_name Name of the added member -//@is_current_user True, if the current user was added to the group -//@is_returned True, if the user has returned to the group themselves -pushMessageContentChatAddMembers#bf337b3a member_name:string is_current_user:Bool is_returned:Bool = PushMessageContent; - -//@description A chat photo was edited -pushMessageContentChatChangePhoto#bd96521d = PushMessageContent; - -//@description A chat title was edited -//@title New chat title -pushMessageContentChatChangeTitle#8ae1f6a3 title:string = PushMessageContent; - -//@description A chat background was edited -//@is_same True, if the set background is the same as the background of the current user -pushMessageContentChatSetBackground#a72b56e3 is_same:Bool = PushMessageContent; - -//@description A chat theme was edited -//@theme_name If non-empty, name of a new theme, set for the chat. Otherwise, the chat theme was reset to the default one -pushMessageContentChatSetTheme#a5d3b68 theme_name:string = PushMessageContent; - -//@description A chat member was deleted -//@member_name Name of the deleted member -//@is_current_user True, if the current user was deleted from the group -//@is_left True, if the user has left the group themselves -pushMessageContentChatDeleteMember#23afa99f member_name:string is_current_user:Bool is_left:Bool = PushMessageContent; - -//@description A new member joined the chat via an invite link -pushMessageContentChatJoinByLink#5c9bdf49 = PushMessageContent; - -//@description A new member was accepted to the chat by an administrator -pushMessageContentChatJoinByRequest#f3bb6175 = PushMessageContent; - -//@description A new recurring payment was made by the current user -//@amount The paid amount -pushMessageContentRecurringPayment#6083361a amount:string = PushMessageContent; - -//@description A profile photo was suggested to the user -pushMessageContentSuggestProfilePhoto#7d6bf0ab = PushMessageContent; - -//@description A forwarded messages -//@total_count Number of forwarded messages -pushMessageContentMessageForwards#8df8a81c total_count:int32 = PushMessageContent; - -//@description A media album -//@total_count Number of messages in the album -//@has_photos True, if the album has at least one photo -//@has_videos True, if the album has at least one video file -//@has_audios True, if the album has at least one audio file -//@has_documents True, if the album has at least one document -pushMessageContentMediaAlbum#d363e96f total_count:int32 has_photos:Bool has_videos:Bool has_audios:Bool has_documents:Bool = PushMessageContent; - -//@class NotificationType @description Contains detailed information about a notification - -//@description New message was received -//@message The message -//@show_preview True, if message content must be displayed in notifications -notificationTypeNewMessage#f0d0e3f2 message:message show_preview:Bool = NotificationType; - -//@description New secret chat was created -notificationTypeNewSecretChat#4771c6b0 = NotificationType; - -//@description New call was received -//@call_id Call identifier -notificationTypeNewCall#66164179 call_id:int32 = NotificationType; - -//@description New message was received through a push notification -//@message_id The message identifier. The message will not be available in the chat history, but the identifier can be used in viewMessages, or as a message to be replied in the same chat -//@sender_id Identifier of the sender of the message. Corresponding user or chat may be inaccessible -//@sender_name Name of the sender -//@is_outgoing True, if the message is outgoing -//@content Push message content -notificationTypeNewPushMessage#d5949e32 message_id:int53 sender_id:MessageSender sender_name:string is_outgoing:Bool content:PushMessageContent = NotificationType; - -//@class NotificationGroupType @description Describes the type of notifications in a notification group - -//@description A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with ordinary unread messages -notificationGroupTypeMessages#9a86331d = NotificationGroupType; - -//@description A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with unread mentions of the current user, replies to their messages, or a pinned message -notificationGroupTypeMentions#85ca89ad = NotificationGroupType; - -//@description A group containing a notification of type notificationTypeNewSecretChat -notificationGroupTypeSecretChat#52e54e34 = NotificationGroupType; - -//@description A group containing notifications of type notificationTypeNewCall -notificationGroupTypeCalls#5233c152 = NotificationGroupType; - -//@description Describes a notification sound in MP3 format -//@id Unique identifier of the notification sound -//@duration Duration of the sound, in seconds -//@date Point in time (Unix timestamp) when the sound was created -//@title Title of the notification sound -//@data Arbitrary data, defined while the sound was uploaded -//@sound File containing the sound -notificationSound#f4ef6137 id:int64 duration:int32 date:int32 title:string data:string sound:file = NotificationSound; - -//@description Contains a list of notification sounds -//@notification_sounds A list of notification sounds -notificationSounds#7ba3c849 notification_sounds:vector = NotificationSounds; - -//@description Contains information about a notification -//@id Unique persistent identifier of this notification -//@date Notification date -//@is_silent True, if the notification was explicitly sent without sound -//@type Notification type -notification#2f0343d0 id:int32 date:int32 is_silent:Bool type:NotificationType = Notification; - -//@description Describes a group of notifications -//@id Unique persistent auto-incremented from 1 identifier of the notification group -//@type Type of the group -//@chat_id Identifier of a chat to which all notifications in the group belong -//@total_count Total number of active notifications in the group -//@notifications The list of active notifications -notificationGroup#d02a41ba id:int32 type:NotificationGroupType chat_id:int53 total_count:int32 notifications:vector = NotificationGroup; - -//@class OptionValue @description Represents the value of an option - -//@description Represents a boolean option -//@value The value of the option -optionValueBoolean#3c35f1e value:Bool = OptionValue; - -//@description Represents an unknown option or an option which has a default value -optionValueEmpty#36c62493 = OptionValue; - -//@description Represents an integer option -//@value The value of the option -optionValueInteger#f4dcc2e4 value:int64 = OptionValue; - -//@description Represents a string option -//@value The value of the option -optionValueString#2d136e94 value:string = OptionValue; - -//@description Represents one member of a JSON object -//@key Member's key -//@value Member's value -jsonObjectMember#9483ae96 key:string value:JsonValue = JsonObjectMember; - -//@class JsonValue @description Represents a JSON value - -//@description Represents a null JSON value -jsonValueNull#fa76e0cd = JsonValue; - -//@description Represents a boolean JSON value -//@value The value -jsonValueBoolean#8050d3b0 value:Bool = JsonValue; - -//@description Represents a numeric JSON value -//@value The value -jsonValueNumber#c3c0146f value:double = JsonValue; - -//@description Represents a string JSON value -//@value The value -jsonValueString#5f3ebdb1 value:string = JsonValue; - -//@description Represents a JSON array -//@values The list of array elements -jsonValueArray#eccdb0d8 values:vector = JsonValue; - -//@description Represents a JSON object -//@members The list of object members -jsonValueObject#c67bff40 members:vector = JsonValue; - -//@class StoryPrivacySettings @description Describes privacy settings of a story - -//@description The story can be viewed by everyone -//@except_user_ids Identifiers of the users that can't see the story; always unknown and empty for non-owned stories -storyPrivacySettingsEveryone#22d1053a except_user_ids:vector = StoryPrivacySettings; - -//@description The story can be viewed by all contacts except chosen users -//@except_user_ids User identifiers of the contacts that can't see the story; always unknown and empty for non-owned stories -storyPrivacySettingsContacts#35515d71 except_user_ids:vector = StoryPrivacySettings; - -//@description The story can be viewed by all close friends -storyPrivacySettingsCloseFriends#7cff8b60 = StoryPrivacySettings; - -//@description The story can be viewed by certain specified users -//@user_ids Identifiers of the users; always unknown and empty for non-owned stories -storyPrivacySettingsSelectedUsers#84d7d27b user_ids:vector = StoryPrivacySettings; - -//@class UserPrivacySettingRule @description Represents a single rule for managing user privacy settings - -//@description A rule to allow all users to do something -userPrivacySettingRuleAllowAll#8abf1c3f = UserPrivacySettingRule; - -//@description A rule to allow all contacts of the user to do something -userPrivacySettingRuleAllowContacts#8f2f2d10 = UserPrivacySettingRule; - -//@description A rule to allow all bots to do something -userPrivacySettingRuleAllowBots#53b2871d = UserPrivacySettingRule; - -//@description A rule to allow all Premium Users to do something; currently, allowed only for userPrivacySettingAllowChatInvites -userPrivacySettingRuleAllowPremiumUsers#60ce8541 = UserPrivacySettingRule; - -//@description A rule to allow certain specified users to do something -//@user_ids The user identifiers, total number of users in all rules must not exceed 1000 -userPrivacySettingRuleAllowUsers#d1570b70 user_ids:vector = UserPrivacySettingRule; - -//@description A rule to allow all members of certain specified basic groups and supergroups to doing something -//@chat_ids The chat identifiers, total number of chats in all rules must not exceed 20 -userPrivacySettingRuleAllowChatMembers#f249b617 chat_ids:vector = UserPrivacySettingRule; - -//@description A rule to restrict all users from doing something -userPrivacySettingRuleRestrictAll#ac2a9550 = UserPrivacySettingRule; - -//@description A rule to restrict all contacts of the user from doing something -userPrivacySettingRuleRestrictContacts#3c1acd02 = UserPrivacySettingRule; - -//@description A rule to restrict all bots from doing something -userPrivacySettingRuleRestrictBots#8e996e5d = UserPrivacySettingRule; - -//@description A rule to restrict all specified users from doing something -//@user_ids The user identifiers, total number of users in all rules must not exceed 1000 -userPrivacySettingRuleRestrictUsers#4d392a91 user_ids:vector = UserPrivacySettingRule; - -//@description A rule to restrict all members of specified basic groups and supergroups from doing something -//@chat_ids The chat identifiers, total number of chats in all rules must not exceed 20 -userPrivacySettingRuleRestrictChatMembers#fc00b920 chat_ids:vector = UserPrivacySettingRule; - -//@description A list of privacy rules. Rules are matched in the specified order. The first matched rule defines the privacy setting for a given user. If no rule matches, the action is not allowed -//@rules A list of rules -userPrivacySettingRules#425e6b37 rules:vector = UserPrivacySettingRules; - -//@class UserPrivacySetting @description Describes available user privacy settings - -//@description A privacy setting for managing whether the user's online status is visible -userPrivacySettingShowStatus#6f0884fe = UserPrivacySetting; - -//@description A privacy setting for managing whether the user's profile photo is visible -userPrivacySettingShowProfilePhoto#53f3c9f5 = UserPrivacySetting; - -//@description A privacy setting for managing whether a link to the user's account is included in forwarded messages -userPrivacySettingShowLinkInForwardedMessages#2353b6e6 = UserPrivacySetting; - -//@description A privacy setting for managing whether the user's phone number is visible -userPrivacySettingShowPhoneNumber#d0d1a229 = UserPrivacySetting; - -//@description A privacy setting for managing whether the user's bio is visible -userPrivacySettingShowBio#39382761 = UserPrivacySetting; - -//@description A privacy setting for managing whether the user's birthdate is visible -userPrivacySettingShowBirthdate#4596b4df = UserPrivacySetting; - -//@description A privacy setting for managing whether the user can be invited to chats -userPrivacySettingAllowChatInvites#4bcc1d27 = UserPrivacySetting; - -//@description A privacy setting for managing whether the user can be called -userPrivacySettingAllowCalls#c9f0c705 = UserPrivacySetting; - -//@description A privacy setting for managing whether peer-to-peer connections can be used for calls -userPrivacySettingAllowPeerToPeerCalls#1502b940 = UserPrivacySetting; - -//@description A privacy setting for managing whether the user can be found by their phone number. Checked only if the phone number is not known to the other user. Can be set only to "Allow contacts" or "Allow all" -userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 = UserPrivacySetting; - -//@description A privacy setting for managing whether the user can receive voice and video messages in private chats; for Telegram Premium users only -userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c = UserPrivacySetting; - -//@description A privacy setting for managing whether received gifts are automatically shown on the user's profile page -userPrivacySettingAutosaveGifts#709a69cd = UserPrivacySetting; - -//@description Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting -//@show_read_date True, if message read date is shown to other users in private chats. If false and the current user isn't a Telegram Premium user, then they will not be able to see other's message read date -readDatePrivacySettings#62a2e628 show_read_date:Bool = ReadDatePrivacySettings; - -//@description Contains privacy settings for new chats with non-contacts -//@allow_new_chats_from_unknown_users True, if non-contacts users are able to write first to the current user. Telegram Premium subscribers are able to write first regardless of this setting -newChatPrivacySettings#5b15ca46 allow_new_chats_from_unknown_users:Bool = NewChatPrivacySettings; - -//@class CanSendMessageToUserResult @description Describes result of canSendMessageToUser - -//@description The user can be messaged -canSendMessageToUserResultOk#5b3ad802 = CanSendMessageToUserResult; - -//@description The user can't be messaged, because they are deleted or unknown -canSendMessageToUserResultUserIsDeleted#8c172661 = CanSendMessageToUserResult; - -//@description The user can't be messaged, because they restrict new chats with non-contacts -canSendMessageToUserResultUserRestrictsNewChats#7304e1d5 = CanSendMessageToUserResult; - -//@description Contains information about the period of inactivity after which the current user's account will automatically be deleted -//@days Number of days of inactivity before the account will be flagged for deletion; 30-730 days -accountTtl#4ef23284 days:int32 = AccountTtl; - -//@description Contains default auto-delete timer setting for new chats -//@time Message auto-delete time, in seconds. If 0, then messages aren't deleted automatically -messageAutoDeleteTime#758b0715 time:int32 = MessageAutoDeleteTime; - -//@class SessionType @description Represents the type of session - -//@description The session is running on an Android device -sessionTypeAndroid#84836098 = SessionType; - -//@description The session is running on a generic Apple device -sessionTypeApple#9399d24b = SessionType; - -//@description The session is running on the Brave browser -sessionTypeBrave#b778e9ed = SessionType; - -//@description The session is running on the Chrome browser -sessionTypeChrome#5dc92969 = SessionType; - -//@description The session is running on the Edge browser -sessionTypeEdge#dfe0cb5b = SessionType; - -//@description The session is running on the Firefox browser -sessionTypeFirefox#7e83fda4 = SessionType; - -//@description The session is running on an iPad device -sessionTypeIpad#4d2abeef = SessionType; - -//@description The session is running on an iPhone device -sessionTypeIphone#5d182bd = SessionType; - -//@description The session is running on a Linux device -sessionTypeLinux#a757ba69 = SessionType; - -//@description The session is running on a Mac device -sessionTypeMac#db81caa1 = SessionType; - -//@description The session is running on the Opera browser -sessionTypeOpera#a8c21c7a = SessionType; - -//@description The session is running on the Safari browser -sessionTypeSafari#2a5b9c59 = SessionType; - -//@description The session is running on an Ubuntu device -sessionTypeUbuntu#5d8f6ac5 = SessionType; - -//@description The session is running on an unknown type of device -sessionTypeUnknown#df17030 = SessionType; - -//@description The session is running on the Vivaldi browser -sessionTypeVivaldi#42c985ef = SessionType; - -//@description The session is running on a Windows device -sessionTypeWindows#9c1272a8 = SessionType; - -//@description The session is running on an Xbox console -sessionTypeXbox#6ea39dac = SessionType; - -//@description Contains information about one session in a Telegram application used by the current user. Sessions must be shown to the user in the returned order -//@id Session identifier -//@is_current True, if this session is the current session -//@is_password_pending True, if a 2-step verification password is needed to complete authorization of the session -//@is_unconfirmed True, if the session wasn't confirmed from another session -//@can_accept_secret_chats True, if incoming secret chats can be accepted by the session -//@can_accept_calls True, if incoming calls can be accepted by the session -//@type Session type based on the system and application version, which can be used to display a corresponding icon -//@api_id Telegram API identifier, as provided by the application -//@application_name Name of the application, as provided by the application -//@application_version The version of the application, as provided by the application -//@is_official_application True, if the application is an official application or uses the api_id of an official application -//@device_model Model of the device the application has been run or is running on, as provided by the application -//@platform Operating system the application has been run or is running on, as provided by the application -//@system_version Version of the operating system the application has been run or is running on, as provided by the application -//@log_in_date Point in time (Unix timestamp) when the user has logged in -//@last_active_date Point in time (Unix timestamp) when the session was last used -//@ip_address IP address from which the session was created, in human-readable format -//@location A human-readable description of the location from which the session was created, based on the IP address -session#9759a3c id:int64 is_current:Bool is_password_pending:Bool is_unconfirmed:Bool can_accept_secret_chats:Bool can_accept_calls:Bool type:SessionType api_id:int32 application_name:string application_version:string is_official_application:Bool device_model:string platform:string system_version:string log_in_date:int32 last_active_date:int32 ip_address:string location:string = Session; - -//@description Contains a list of sessions -//@sessions List of sessions -//@inactive_session_ttl_days Number of days of inactivity before sessions will automatically be terminated; 1-366 days -sessions#997833aa sessions:vector inactive_session_ttl_days:int32 = Sessions; - -//@description Contains information about an unconfirmed session -//@id Session identifier -//@log_in_date Point in time (Unix timestamp) when the user has logged in -//@device_model Model of the device that was used for the session creation, as provided by the application -//@location A human-readable description of the location from which the session was created, based on the IP address -unconfirmedSession#850d49f9 id:int64 log_in_date:int32 device_model:string location:string = UnconfirmedSession; - -//@description Contains information about one website the current user is logged in with Telegram -//@id Website identifier -//@domain_name The domain name of the website -//@bot_user_id User identifier of a bot linked with the website -//@browser The version of a browser used to log in -//@platform Operating system the browser is running on -//@log_in_date Point in time (Unix timestamp) when the user was logged in -//@last_active_date Point in time (Unix timestamp) when obtained authorization was last used -//@ip_address IP address from which the user was logged in, in human-readable format -//@location Human-readable description of a country and a region from which the user was logged in, based on the IP address -connectedWebsite#75e7a78a id:int64 domain_name:string bot_user_id:int53 browser:string platform:string log_in_date:int32 last_active_date:int32 ip_address:string location:string = ConnectedWebsite; - -//@description Contains a list of websites the current user is logged in with Telegram -//@websites List of connected websites -connectedWebsites#f0c8b5ea websites:vector = ConnectedWebsites; - -//@class ReportReason @description Describes the reason why a chat is reported - -//@description The chat contains spam messages -reportReasonSpam#b80e23bf = ReportReason; - -//@description The chat promotes violence -reportReasonViolence#7983c739 = ReportReason; - -//@description The chat contains pornographic messages -reportReasonPornography#4ddf1cf7 = ReportReason; - -//@description The chat has child abuse related content -reportReasonChildAbuse#2d5d42fe = ReportReason; - -//@description The chat contains copyrighted content -reportReasonCopyright#57e22faf = ReportReason; - -//@description The location-based chat is unrelated to its stated location -reportReasonUnrelatedLocation#5381830 = ReportReason; - -//@description The chat represents a fake account -reportReasonFake#15083fe0 = ReportReason; - -//@description The chat has illegal drugs related content -reportReasonIllegalDrugs#fc541220 = ReportReason; - -//@description The chat contains messages with personal details -reportReasonPersonalDetails#a14b9412 = ReportReason; - -//@description A custom reason provided by the user -reportReasonCustom#adb7da73 = ReportReason; - -//@class ReportChatResult @description Describes result of chat report - -//@description The chat was reported successfully -reportChatResultOk#481a557d = ReportChatResult; - -//@description The user must choose an option to report the chat and repeat request with the chosen option -//@title Title for the option choice -//@options List of available options -reportChatResultOptionRequired#2d89acaa title:string options:vector = ReportChatResult; - -//@description The user must add additional text details to the report -//@option_id Option identifier for the next reportChat request -//@is_optional True, if the user can skip text adding -reportChatResultTextRequired#8bcc30c1 option_id:bytes is_optional:Bool = ReportChatResult; - -//@description The user must choose messages to report and repeat the reportChat request with the chosen messages -reportChatResultMessagesRequired#6521790 = ReportChatResult; - -//@class ReportStoryResult @description Describes result of story report - -//@description The story was reported successfully -reportStoryResultOk#ac3c63b3 = ReportStoryResult; - -//@description The user must choose an option to report the story and repeat request with the chosen option -//@title Title for the option choice -//@options List of available options -reportStoryResultOptionRequired#bf79aa9b title:string options:vector = ReportStoryResult; - -//@description The user must add additional text details to the report -//@option_id Option identifier for the next reportStory request -//@is_optional True, if the user can skip text adding -reportStoryResultTextRequired#13ed9d91 option_id:bytes is_optional:Bool = ReportStoryResult; - -//@class InternalLinkType @description Describes an internal https://t.me or tg: link, which must be processed by the application in a special way - -//@description The link is a link to the Devices section of the application. Use getActiveSessions to get the list of active sessions and show them to the user -internalLinkTypeActiveSessions#706bbbad = InternalLinkType; - -//@description The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. -//@target_chat Target chat to be opened -//@bot_username Username of the bot -//@url URL to be passed to openWebApp -internalLinkTypeAttachmentMenuBot#644c4225 target_chat:TargetChat bot_username:string url:string = InternalLinkType; - -//@description The link contains an authentication code. Call checkAuthenticationCode with the code if the current authorization state is authorizationStateWaitCode -//@code The authentication code -internalLinkTypeAuthenticationCode#f3874ff2 code:string = InternalLinkType; - -//@description The link is a link to a background. Call searchBackground with the given background name to process the link. -//@background_name Name of the background -internalLinkTypeBackground#b0d2908 background_name:string = InternalLinkType; - -//@description The link is a link to a Telegram bot, which is expected to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, -//@bot_username Username of the bot -//@administrator_rights Expected administrator rights for the bot -internalLinkTypeBotAddToChannel#538ac2c0 bot_username:string administrator_rights:chatAdministratorRights = InternalLinkType; - -//@description The link is a link to a chat with a Telegram bot. Call searchPublicChat with the given bot username, check that the user is a bot, show START button in the chat with the bot, -//@bot_username Username of the bot -//@start_parameter The parameter to be passed to sendBotStartMessage -//@autostart True, if sendBotStartMessage must be called automatically without showing the START button -internalLinkTypeBotStart#3f985fed bot_username:string start_parameter:string autostart:Bool = InternalLinkType; - -//@description The link is a link to a Telegram bot, which is expected to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, -//@bot_username Username of the bot -//@start_parameter The parameter to be passed to sendBotStartMessage -//@administrator_rights Expected administrator rights for the bot; may be null -internalLinkTypeBotStartInGroup#ca0d8cce bot_username:string start_parameter:string administrator_rights:chatAdministratorRights = InternalLinkType; - -//@description The link is a link to a business chat. Use getBusinessChatLinkInfo with the provided link name to get information about the link, -//@link_name Name of the link -internalLinkTypeBusinessChat#a03ae9d7 link_name:string = InternalLinkType; - -//@description The link is a link to the Telegram Star purchase section of the application -//@star_count The number of Telegram Stars that must be owned by the user -//@purpose Purpose of Telegram Star purchase. Arbitrary string specified by the server, for example, "subs" if the Telegram Stars are required to extend channel subscriptions -internalLinkTypeBuyStars#a94cc347 star_count:int53 purpose:string = InternalLinkType; - -//@description The link is a link to the change phone number section of the application -internalLinkTypeChangePhoneNumber#f0275b01 = InternalLinkType; - -//@description The link is an affiliate program link. Call searchChatAffiliateProgram with the given username and referrer to process the link -//@username Username to be passed to searchChatAffiliateProgram -//@referrer Referrer to be passed to searchChatAffiliateProgram -internalLinkTypeChatAffiliateProgram#25ac5024 username:string referrer:string = InternalLinkType; - -//@description The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. -//@url URL to be passed to getChatBoostLinkInfo -internalLinkTypeChatBoost#d549fd40 url:string = InternalLinkType; - -//@description The link is an invite link to a chat folder. Call checkChatFolderInviteLink with the given invite link to process the link. -//@invite_link Internal representation of the invite link -internalLinkTypeChatFolderInvite#89b2493e invite_link:string = InternalLinkType; - -//@description The link is a link to the folder section of the application settings -internalLinkTypeChatFolderSettings#bfff055c = InternalLinkType; - -//@description The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link. -//@invite_link Internal representation of the invite link -internalLinkTypeChatInvite#198c3cd9 invite_link:string = InternalLinkType; - -//@description The link is a link to the default message auto-delete timer settings section of the application settings -internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 = InternalLinkType; - -//@description The link is a link to the edit profile section of the application settings -internalLinkTypeEditProfileSettings#c30e5066 = InternalLinkType; - -//@description The link is a link to a game. Call searchPublicChat with the given bot username, check that the user is a bot, -//@bot_username Username of the bot that owns the game -//@game_short_name Short name of the game -internalLinkTypeGame#f074adcd bot_username:string game_short_name:string = InternalLinkType; - -//@description The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link. -//@url URL to be passed to getWebPageInstantView -//@fallback_url An URL to open if getWebPageInstantView fails -internalLinkTypeInstantView#69e4df3f url:string fallback_url:string = InternalLinkType; - -//@description The link is a link to an invoice. Call getPaymentForm with the given invoice name to process the link -//@invoice_name Name of the invoice -internalLinkTypeInvoice#f34c6dac invoice_name:string = InternalLinkType; - -//@description The link is a link to a language pack. Call getLanguagePackInfo with the given language pack identifier to process the link. -//@language_pack_id Language pack identifier -internalLinkTypeLanguagePack#a9870d6c language_pack_id:string = InternalLinkType; - -//@description The link is a link to the language section of the application settings -internalLinkTypeLanguageSettings#b019e6e6 = InternalLinkType; - -//@description The link is a link to the main Web App of a bot. Call searchPublicChat with the given bot username, check that the user is a bot and has the main Web App. -//@bot_username Username of the bot -//@start_parameter Start parameter to be passed to getMainWebApp -//@mode The mode to be passed to getMainWebApp -internalLinkTypeMainWebApp#5ddf72e9 bot_username:string start_parameter:string mode:WebAppOpenMode = InternalLinkType; - -//@description The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link, -//@url URL to be passed to getMessageLinkInfo -internalLinkTypeMessage#3a535c52 url:string = InternalLinkType; - -//@description The link contains a message draft text. A share screen needs to be shown to the user, then the chosen chat must be opened and the text is added to the input field -//@text Message draft text -//@contains_link True, if the first line of the text contains a link. If true, the input field needs to be focused and the text after the link must be selected -internalLinkTypeMessageDraft#276fbad5 text:formattedText contains_link:Bool = InternalLinkType; - -//@description The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it -//@bot_user_id User identifier of the service's bot; the corresponding user may be unknown yet -//@scope Telegram Passport element types requested by the service -//@public_key Service's public key -//@nonce Unique request identifier provided by the service -//@callback_url An HTTP URL to open once the request is finished, canceled, or failed with the parameters tg_passport=success, tg_passport=cancel, or tg_passport=error&error=... respectively. -internalLinkTypePassportDataRequest#c50fce81 bot_user_id:int53 scope:string public_key:string nonce:string callback_url:string = InternalLinkType; - -//@description The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberCode with the given phone number and with phoneNumberCodeTypeConfirmOwnership with the given hash to process the link. -//@hash Hash value from the link -//@phone_number Phone number value from the link -internalLinkTypePhoneNumberConfirmation#68bf6b16 hash:string phone_number:string = InternalLinkType; - -//@description The link is a link to the Premium features screen of the application from which the user can subscribe to Telegram Premium. Call getPremiumFeatures with the given referrer to process the link -//@referrer Referrer specified in the link -internalLinkTypePremiumFeatures#48884f49 referrer:string = InternalLinkType; - -//@description The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGiftCodes payments or in-store purchases -//@referrer Referrer specified in the link -internalLinkTypePremiumGift#5ad56d41 referrer:string = InternalLinkType; - -//@description The link is a link with a Telegram Premium gift code. Call checkPremiumGiftCode with the given code to process the link. -//@code The Telegram Premium gift code -internalLinkTypePremiumGiftCode#de5c9892 code:string = InternalLinkType; - -//@description The link is a link to the privacy and security section of the application settings -internalLinkTypePrivacyAndSecuritySettings#ad5f6acf = InternalLinkType; - -//@description The link is a link to a proxy. Call addProxy with the given parameters to process the link and add the proxy -//@server Proxy server domain or IP address -//@port Proxy server port -//@type Type of the proxy -internalLinkTypeProxy#b1b12cea server:string port:int32 type:ProxyType = InternalLinkType; - -//@description The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link. -//@chat_username Username of the chat -//@draft_text Draft text for message to send in the chat -//@open_profile True, if chat profile information screen must be opened; otherwise, the chat itself must be opened -internalLinkTypePublicChat#697a2d00 chat_username:string draft_text:string open_profile:Bool = InternalLinkType; - -//@description The link can be used to login the current user on another device, but it must be scanned from QR-code using in-app camera. An alert similar to -internalLinkTypeQrCodeAuthentication#bf121924 = InternalLinkType; - -//@description The link forces restore of App Store purchases when opened. For official iOS application only -internalLinkTypeRestorePurchases#24203483 = InternalLinkType; - -//@description The link is a link to application settings -internalLinkTypeSettings#177545b4 = InternalLinkType; - -//@description The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set. -//@sticker_set_name Name of the sticker set -//@expect_custom_emoji True, if the sticker set is expected to contain custom emoji -internalLinkTypeStickerSet#a1464fa2 sticker_set_name:string expect_custom_emoji:Bool = InternalLinkType; - -//@description The link is a link to a story. Call searchPublicChat with the given sender username, then call getStory with the received chat identifier and the given story identifier, then show the story if received -//@story_sender_username Username of the sender of the story -//@story_id Story identifier -internalLinkTypeStory#57bce647 story_sender_username:string story_id:int32 = InternalLinkType; - -//@description The link is a link to a cloud theme. TDLib has no theme support yet -//@theme_name Name of the theme -internalLinkTypeTheme#f405f807 theme_name:string = InternalLinkType; - -//@description The link is a link to the theme section of the application settings -internalLinkTypeThemeSettings#c14d3916 = InternalLinkType; - -//@description The link is an unknown tg: link. Call getDeepLinkInfo to process the link -//@link Link to be passed to getDeepLinkInfo -internalLinkTypeUnknownDeepLink#2549d7db link:string = InternalLinkType; - -//@description The link is a link to an unsupported proxy. An alert can be shown to the user -internalLinkTypeUnsupportedProxy#de399f09 = InternalLinkType; - -//@description The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. -//@phone_number Phone number of the user -//@draft_text Draft text for message to send in the chat -//@open_profile True, if user's profile information screen must be opened; otherwise, the chat itself must be opened -internalLinkTypeUserPhoneNumber#104bbb08 phone_number:string draft_text:string open_profile:Bool = InternalLinkType; - -//@description The link is a link to a user by a temporary token. Call searchUserByToken with the given token to process the link. -//@token The token -internalLinkTypeUserToken#a8d7db59 token:string = InternalLinkType; - -//@description The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinGroupCall with the given invite hash to process the link -//@chat_username Username of the chat with the video chat -//@invite_hash If non-empty, invite hash to be used to join the video chat without being muted by administrators -//@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group -internalLinkTypeVideoChat#8796f8b4 chat_username:string invite_hash:string is_live_stream:Bool = InternalLinkType; - -//@description The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. -//@bot_username Username of the bot that owns the Web App -//@web_app_short_name Short name of the Web App -//@start_parameter Start parameter to be passed to getWebAppLinkUrl -//@mode The mode in which the Web App must be opened -internalLinkTypeWebApp#7ae9552d bot_username:string web_app_short_name:string start_parameter:string mode:WebAppOpenMode = InternalLinkType; - -//@description Contains an HTTPS link to a message in a supergroup or channel, or a forum topic -//@link The link -//@is_public True, if the link will work for non-members of the chat -messageLink#af4a3aa6 link:string is_public:Bool = MessageLink; - -//@description Contains information about a link to a message or a forum topic in a chat -//@is_public True, if the link is a public link for a message or a forum topic in a chat -//@chat_id If found, identifier of the chat to which the link points, 0 otherwise -//@message_thread_id If found, identifier of the message thread in which to open the message, or a forum topic to open if the message is missing -//@message If found, the linked message; may be null -//@media_timestamp Timestamp from which the video/audio/video note/voice note/story playing must start, in seconds; 0 if not specified. The media can be in the message content or in its link preview -//@for_album True, if the whole media album to which the message belongs is linked -messageLinkInfo#2b96fb50 is_public:Bool chat_id:int53 message_thread_id:int53 message:message media_timestamp:int32 for_album:Bool = MessageLinkInfo; - -//@description Contains an HTTPS link to boost a chat -//@link The link -//@is_public True, if the link will work for non-members of the chat -chatBoostLink#b5417c71 link:string is_public:Bool = ChatBoostLink; - -//@description Contains information about a link to boost a chat -//@is_public True, if the link will work for non-members of the chat -//@chat_id Identifier of the chat to which the link points; 0 if the chat isn't found -chatBoostLinkInfo#dc123884 is_public:Bool chat_id:int53 = ChatBoostLinkInfo; - -//@class BlockList @description Describes type of block list - -//@description The main block list that disallows writing messages to the current user, receiving their status and photo, viewing of stories, and some other actions -blockListMain#50a4137c = BlockList; - -//@description The block list that disallows viewing of stories of the current user -blockListStories#628965c = BlockList; - -//@description Contains a part of a file -//@data File bytes -filePart#36594c36 data:bytes = FilePart; - -//@class FileType @description Represents the type of file - -//@description The data is not a file -fileTypeNone#77637ea5 = FileType; - -//@description The file is an animation -fileTypeAnimation#eeaa7dba = FileType; - -//@description The file is an audio file -fileTypeAudio#d5bbcea0 = FileType; - -//@description The file is a document -fileTypeDocument#de57030f = FileType; - -//@description The file is a notification sound -fileTypeNotificationSound#c32f9f09 = FileType; - -//@description The file is a photo -fileTypePhoto#998b71a5 = FileType; - -//@description The file is a photo published as a story -fileTypePhotoStory#78576ef4 = FileType; - -//@description The file is a profile photo -fileTypeProfilePhoto#6afee3a3 = FileType; - -//@description The file was sent to a secret chat (the file type is not known to the server) -fileTypeSecret#906d14f7 = FileType; - -//@description The file is a thumbnail of a file from a secret chat -fileTypeSecretThumbnail#ac797636 = FileType; - -//@description The file is a file from Secure storage used for storing Telegram Passport files -fileTypeSecure#ab69bf26 = FileType; - -//@description The file is a self-destructing photo in a private chat -fileTypeSelfDestructingPhoto#7bcf329b = FileType; - -//@description The file is a self-destructing video in a private chat -fileTypeSelfDestructingVideo#b70cc425 = FileType; - -//@description The file is a self-destructing video note in a private chat -fileTypeSelfDestructingVideoNote#592012c1 = FileType; - -//@description The file is a self-destructing voice note in a private chat -fileTypeSelfDestructingVoiceNote#64d0db1d = FileType; - -//@description The file is a sticker -fileTypeSticker#1c537c69 = FileType; - -//@description The file is a thumbnail of another file -fileTypeThumbnail#ff42215e = FileType; - -//@description The file type is not yet known -fileTypeUnknown#8819ed50 = FileType; - -//@description The file is a video -fileTypeVideo#5548871b = FileType; - -//@description The file is a video note -fileTypeVideoNote#e119a79f = FileType; - -//@description The file is a video published as a story -fileTypeVideoStory#800b21a1 = FileType; - -//@description The file is a voice note -fileTypeVoiceNote#dce96e43 = FileType; - -//@description The file is a wallpaper or a background pattern -fileTypeWallpaper#6e8ffc9c = FileType; - -//@description Contains the storage usage statistics for a specific file type -//@file_type File type -//@size Total size of the files, in bytes -//@count Total number of files -storageStatisticsByFileType#2a8ef8a8 file_type:FileType size:int53 count:int32 = StorageStatisticsByFileType; - -//@description Contains the storage usage statistics for a specific chat -//@chat_id Chat identifier; 0 if none -//@size Total size of the files in the chat, in bytes -//@count Total number of files in the chat -//@by_file_type Statistics split by file types -storageStatisticsByChat#a5498fe4 chat_id:int53 size:int53 count:int32 by_file_type:vector = StorageStatisticsByChat; - -//@description Contains the exact storage usage statistics split by chats and file type -//@size Total size of files, in bytes -//@count Total number of files -//@by_chat Statistics split by chats -storageStatistics#69b98672 size:int53 count:int32 by_chat:vector = StorageStatistics; - -//@description Contains approximate storage usage statistics, excluding files of unknown file type -//@files_size Approximate total size of files, in bytes -//@file_count Approximate number of files -//@database_size Size of the database -//@language_pack_database_size Size of the language pack database -//@log_size Size of the TDLib internal log -storageStatisticsFast#cb412861 files_size:int53 file_count:int32 database_size:int53 language_pack_database_size:int53 log_size:int53 = StorageStatisticsFast; - -//@description Contains database statistics -//@statistics Database statistics in an unspecified human-readable format -databaseStatistics#bd027350 statistics:string = DatabaseStatistics; - -//@class NetworkType @description Represents the type of network - -//@description The network is not available -networkTypeNone#8a7a5f11 = NetworkType; - -//@description A mobile network -networkTypeMobile#30d46e4f = NetworkType; - -//@description A mobile roaming network -networkTypeMobileRoaming#aa7496f0 = NetworkType; - -//@description A Wi-Fi network -networkTypeWiFi#da37e13a = NetworkType; - -//@description A different network type (e.g., Ethernet network) -networkTypeOther#73c2879b = NetworkType; - -//@class NetworkStatisticsEntry @description Contains statistics about network usage - -//@description Contains information about the total amount of data that was used to send and receive files -//@file_type Type of the file the data is part of; pass null if the data isn't related to files -//@network_type Type of the network the data was sent through. Call setNetworkType to maintain the actual network type -//@sent_bytes Total number of bytes sent -//@received_bytes Total number of bytes received -networkStatisticsEntryFile#b3b8f62 file_type:FileType network_type:NetworkType sent_bytes:int53 received_bytes:int53 = NetworkStatisticsEntry; - -//@description Contains information about the total amount of data that was used for calls -//@network_type Type of the network the data was sent through. Call setNetworkType to maintain the actual network type -//@sent_bytes Total number of bytes sent -//@received_bytes Total number of bytes received -//@duration Total call duration, in seconds -networkStatisticsEntryCall#2bedbbad network_type:NetworkType sent_bytes:int53 received_bytes:int53 duration:double = NetworkStatisticsEntry; - -//@description A full list of available network statistic entries -//@since_date Point in time (Unix timestamp) from which the statistics are collected -//@entries Network statistics entries -networkStatistics#d86acb3c since_date:int32 entries:vector = NetworkStatistics; - -//@description Contains auto-download settings -//@is_auto_download_enabled True, if the auto-download is enabled -//@max_photo_file_size The maximum size of a photo file to be auto-downloaded, in bytes -//@max_video_file_size The maximum size of a video file to be auto-downloaded, in bytes -//@max_other_file_size The maximum size of other file types to be auto-downloaded, in bytes -//@video_upload_bitrate The maximum suggested bitrate for uploaded videos, in kbit/s -//@preload_large_videos True, if the beginning of video files needs to be preloaded for instant playback -//@preload_next_audio True, if the next audio track needs to be preloaded while the user is listening to an audio file -//@preload_stories True, if stories needs to be preloaded -//@use_less_data_for_calls True, if "use less data for calls" option needs to be enabled -autoDownloadSettings#3b1813e0 is_auto_download_enabled:Bool max_photo_file_size:int32 max_video_file_size:int53 max_other_file_size:int53 video_upload_bitrate:int32 preload_large_videos:Bool preload_next_audio:Bool preload_stories:Bool use_less_data_for_calls:Bool = AutoDownloadSettings; - -//@description Contains auto-download settings presets for the current user -//@low Preset with lowest settings; expected to be used by default when roaming -//@medium Preset with medium settings; expected to be used by default when using mobile data -//@high Preset with highest settings; expected to be used by default when connected on Wi-Fi -autoDownloadSettingsPresets#d1621d22 low:autoDownloadSettings medium:autoDownloadSettings high:autoDownloadSettings = AutoDownloadSettingsPresets; - -//@class AutosaveSettingsScope @description Describes scope of autosave settings - -//@description Autosave settings applied to all private chats without chat-specific settings -autosaveSettingsScopePrivateChats#5329797f = AutosaveSettingsScope; - -//@description Autosave settings applied to all basic group and supergroup chats without chat-specific settings -autosaveSettingsScopeGroupChats#32e00e4e = AutosaveSettingsScope; - -//@description Autosave settings applied to all channel chats without chat-specific settings -autosaveSettingsScopeChannelChats#e2391fd1 = AutosaveSettingsScope; - -//@description Autosave settings applied to a chat -//@chat_id Chat identifier -autosaveSettingsScopeChat#9eb5c2e9 chat_id:int53 = AutosaveSettingsScope; - -//@description Contains autosave settings for an autosave settings scope -//@autosave_photos True, if photo autosave is enabled -//@autosave_videos True, if video autosave is enabled -//@max_video_file_size The maximum size of a video file to be autosaved, in bytes; 512 KB - 4000 MB -scopeAutosaveSettings#5c329f33 autosave_photos:Bool autosave_videos:Bool max_video_file_size:int53 = ScopeAutosaveSettings; - -//@description Contains autosave settings for a chat, which overrides default settings for the corresponding scope -//@chat_id Chat identifier -//@settings Autosave settings for the chat -autosaveSettingsException#586bf5c8 chat_id:int53 settings:scopeAutosaveSettings = AutosaveSettingsException; - -//@description Describes autosave settings -//@private_chat_settings Default autosave settings for private chats -//@group_settings Default autosave settings for basic group and supergroup chats -//@channel_settings Default autosave settings for channel chats -//@exceptions Autosave settings for specific chats -autosaveSettings#c0d11a28 private_chat_settings:scopeAutosaveSettings group_settings:scopeAutosaveSettings channel_settings:scopeAutosaveSettings exceptions:vector = AutosaveSettings; - -//@class ConnectionState @description Describes the current state of the connection to Telegram servers - -//@description Waiting for the network to become available. Use setNetworkType to change the available network type -connectionStateWaitingForNetwork#650dd758 = ConnectionState; - -//@description Establishing a connection with a proxy server -connectionStateConnectingToProxy#fa721359 = ConnectionState; - -//@description Establishing a connection to the Telegram servers -connectionStateConnecting#b29bfa62 = ConnectionState; - -//@description Downloading data expected to be received while the application was offline -connectionStateUpdating#f4c9c2b7 = ConnectionState; - -//@description There is a working connection to the Telegram servers -connectionStateReady#2e5b4ec = ConnectionState; - -//@class TopChatCategory @description Represents the categories of chats for which a list of frequently used chats can be retrieved - -//@description A category containing frequently used private chats with non-bot users -topChatCategoryUsers#3d324d80 = TopChatCategory; - -//@description A category containing frequently used private chats with bot users -topChatCategoryBots#a1feeb15 = TopChatCategory; - -//@description A category containing frequently used basic groups and supergroups -topChatCategoryGroups#5b32d08e = TopChatCategory; - -//@description A category containing frequently used channels -topChatCategoryChannels#e22600e3 = TopChatCategory; - -//@description A category containing frequently used chats with inline bots sorted by their usage in inline mode -topChatCategoryInlineBots#1678eb7c = TopChatCategory; - -//@description A category containing frequently used chats with bots, which Web Apps were opened -topChatCategoryWebAppBots#5f6d6fd = TopChatCategory; - -//@description A category containing frequently used chats used for calls -topChatCategoryCalls#153b50dd = TopChatCategory; - -//@description A category containing frequently used chats used to forward messages -topChatCategoryForwardChats#6515b7d5 = TopChatCategory; - -//@description Contains 0-based match position -//@position The position of the match -foundPosition#8f8adf88 position:int32 = FoundPosition; - -//@description Contains 0-based positions of matched objects -//@total_count Total number of matched objects -//@positions The positions of the matched objects -foundPositions#afab1f62 total_count:int32 positions:vector = FoundPositions; - -//@class TMeUrlType @description Describes the type of URL linking to an internal Telegram entity - -//@description A URL linking to a user -//@user_id Identifier of the user -tMeUrlTypeUser#7787c1a user_id:int53 = TMeUrlType; - -//@description A URL linking to a public supergroup or channel -//@supergroup_id Identifier of the supergroup or channel -tMeUrlTypeSupergroup#af5536a8 supergroup_id:int53 = TMeUrlType; - -//@description A chat invite link -//@info Information about the chat invite link -tMeUrlTypeChatInvite#12b5da49 info:chatInviteLinkInfo = TMeUrlType; - -//@description A URL linking to a sticker set -//@sticker_set_id Identifier of the sticker set -tMeUrlTypeStickerSet#5f83ccec sticker_set_id:int64 = TMeUrlType; - -//@description Represents a URL linking to an internal Telegram entity -//@url URL -//@type Type of the URL -tMeUrl#bc00fa42 url:string type:TMeUrlType = TMeUrl; - -//@description Contains a list of t.me URLs -//@urls List of URLs -tMeUrls#655b1f52 urls:vector = TMeUrls; - -//@class SuggestedAction @description Describes an action suggested to the current user - -//@description Suggests the user to enable archive_and_mute_new_chats_from_unknown_users setting in archiveChatListSettings -suggestedActionEnableArchiveAndMuteNewChats#7841ec4f = SuggestedAction; - -//@description Suggests the user to check whether they still remember their 2-step verification password -suggestedActionCheckPassword#71e072b7 = SuggestedAction; - -//@description Suggests the user to check whether authorization phone number is correct and change the phone number if it is inaccessible -suggestedActionCheckPhoneNumber#26ab77eb = SuggestedAction; - -//@description Suggests the user to view a hint about the meaning of one and two check marks on sent messages -suggestedActionViewChecksHint#35203547 = SuggestedAction; - -//@description Suggests the user to convert specified supergroup to a broadcast group -//@supergroup_id Supergroup identifier -suggestedActionConvertToBroadcastGroup#c67a2e38 supergroup_id:int53 = SuggestedAction; - -//@description Suggests the user to set a 2-step verification password to be able to log in again -//@authorization_delay The number of days to pass between consecutive authorizations if the user declines to set password; if 0, then the user is advised to set the password for security reasons -suggestedActionSetPassword#6f147d98 authorization_delay:int32 = SuggestedAction; - -//@description Suggests the user to upgrade the Premium subscription from monthly payments to annual payments -suggestedActionUpgradePremium#70aa79fb = SuggestedAction; - -//@description Suggests the user to restore a recently expired Premium subscription -suggestedActionRestorePremium#e909dd64 = SuggestedAction; - -//@description Suggests the user to subscribe to the Premium subscription with annual payments -suggestedActionSubscribeToAnnualPremium#164978bb = SuggestedAction; - -//@description Suggests the user to gift Telegram Premium to friends for Christmas -suggestedActionGiftPremiumForChristmas#93b3ee6f = SuggestedAction; - -//@description Suggests the user to set birthdate -suggestedActionSetBirthdate#eabd9b02 = SuggestedAction; - -//@description Suggests the user to set profile photo -suggestedActionSetProfilePhoto#9fe23d6b = SuggestedAction; - -//@description Suggests the user to extend their expiring Telegram Premium subscription -//@manage_premium_subscription_url A URL for managing Telegram Premium subscription -suggestedActionExtendPremium#de405cca manage_premium_subscription_url:string = SuggestedAction; - -//@description Suggests the user to extend their expiring Telegram Star subscriptions. Call getStarSubscriptions with only_expiring == true -suggestedActionExtendStarSubscriptions#fd32d556 = SuggestedAction; - -//@description Contains a counter -//@count Count -count#4d38f104 count:int32 = Count; - -//@description Contains some text -//@text Text -text#22765898 text:string = Text; - -//@description Contains a value representing a number of seconds -//@seconds Number of seconds -seconds#3936e58e seconds:double = Seconds; - -//@description Contains size of downloaded prefix of a file -//@size The prefix size, in bytes -fileDownloadedPrefixSize#87e267fb size:int53 = FileDownloadedPrefixSize; - -//@description Contains information about a tg: deep link -//@text Text to be shown to the user -//@need_update_application True, if the user must be asked to update the application -deepLinkInfo#6f1ba0fe text:formattedText need_update_application:Bool = DeepLinkInfo; - -//@class TextParseMode @description Describes the way the text needs to be parsed for text entities - -//@description The text uses Markdown-style formatting -//@version Version of the parser: 0 or 1 - Telegram Bot API "Markdown" parse mode, 2 - Telegram Bot API "MarkdownV2" parse mode -textParseModeMarkdown#157648bf version:int32 = TextParseMode; - -//@description The text uses HTML-style formatting. The same as Telegram Bot API "HTML" parse mode -textParseModeHTML#62f4c5f3 = TextParseMode; - -//@class ProxyType @description Describes the type of proxy server - -//@description A SOCKS5 proxy server -//@username Username for logging in; may be empty -//@password Password for logging in; may be empty -proxyTypeSocks5#caf342b3 username:string password:string = ProxyType; - -//@description A HTTP transparent proxy server -//@username Username for logging in; may be empty -//@password Password for logging in; may be empty -//@http_only Pass true if the proxy supports only HTTP requests and doesn't support transparent TCP connections via HTTP CONNECT method -proxyTypeHttp#a3c7c777 username:string password:string http_only:Bool = ProxyType; - -//@description An MTProto proxy server -//@secret The proxy's secret in hexadecimal encoding -proxyTypeMtproto#8ae31ffd secret:string = ProxyType; - -//@description Contains information about a proxy server -//@id Unique identifier of the proxy -//@server Proxy server domain or IP address -//@port Proxy server port -//@last_used_date Point in time (Unix timestamp) when the proxy was last used; 0 if never -//@is_enabled True, if the proxy is enabled now -//@type Type of the proxy -proxy#baf7b73 id:int32 server:string port:int32 last_used_date:int32 is_enabled:Bool type:ProxyType = Proxy; - -//@description Represents a list of proxy servers -//@proxies List of proxy servers -proxies#5ee27a86 proxies:vector = Proxies; - -//@description A sticker to be added to a sticker set -//@sticker File with the sticker; must fit in a 512x512 square. For WEBP stickers the file must be in WEBP or PNG format, which will be converted to WEBP server-side. -//@format Format of the sticker -//@emojis String with 1-20 emoji corresponding to the sticker -//@mask_position Position where the mask is placed; pass null if not specified -//@keywords List of up to 20 keywords with total length up to 64 characters, which can be used to find the sticker -inputSticker#1f1d0998 sticker:InputFile format:StickerFormat emojis:string mask_position:maskPosition keywords:vector = InputSticker; - -//@description Represents a date range -//@start_date Point in time (Unix timestamp) at which the date range begins -//@end_date Point in time (Unix timestamp) at which the date range ends -dateRange#51150c66 start_date:int32 end_date:int32 = DateRange; - -//@description A value with information about its recent changes -//@value The current value -//@previous_value The value for the previous day -//@growth_rate_percentage The growth rate of the value, as a percentage -statisticalValue#626d6a76 value:double previous_value:double growth_rate_percentage:double = StatisticalValue; - -//@class StatisticalGraph @description Describes a statistical graph - -//@description A graph data -//@json_data Graph data in JSON format -//@zoom_token If non-empty, a token which can be used to receive a zoomed in graph -statisticalGraphData#89732e2c json_data:string zoom_token:string = StatisticalGraph; - -//@description The graph data to be asynchronously loaded through getStatisticalGraph -//@token The token to use for data loading -statisticalGraphAsync#19fb2b9f token:string = StatisticalGraph; - -//@description An error message to be shown to the user instead of the graph -//@error_message The error message -statisticalGraphError#c3fda052 error_message:string = StatisticalGraph; - -//@class ChatStatisticsObjectType @description Describes type of object, for which statistics are provided - -//@description Describes a message sent in the chat -//@message_id Message identifier -chatStatisticsObjectTypeMessage#6f9f24f6 message_id:int53 = ChatStatisticsObjectType; - -//@description Describes a story sent by the chat -//@story_id Story identifier -chatStatisticsObjectTypeStory#15baf9b0 story_id:int32 = ChatStatisticsObjectType; - -//@description Contains statistics about interactions with a message sent in the chat or a story sent by the chat -//@object_type Type of the object -//@view_count Number of times the object was viewed -//@forward_count Number of times the object was forwarded -//@reaction_count Number of times reactions were added to the object -chatStatisticsInteractionInfo#694a9a8d object_type:ChatStatisticsObjectType view_count:int32 forward_count:int32 reaction_count:int32 = ChatStatisticsInteractionInfo; - -//@description Contains statistics about messages sent by a user -//@user_id User identifier -//@sent_message_count Number of sent messages -//@average_character_count Average number of characters in sent messages; 0 if unknown -chatStatisticsMessageSenderInfo#690a7e4b user_id:int53 sent_message_count:int32 average_character_count:int32 = ChatStatisticsMessageSenderInfo; - -//@description Contains statistics about administrator actions done by a user -//@user_id Administrator user identifier -//@deleted_message_count Number of messages deleted by the administrator -//@banned_user_count Number of users banned by the administrator -//@restricted_user_count Number of users restricted by the administrator -chatStatisticsAdministratorActionsInfo#e7c5cd7e user_id:int53 deleted_message_count:int32 banned_user_count:int32 restricted_user_count:int32 = ChatStatisticsAdministratorActionsInfo; - -//@description Contains statistics about number of new members invited by a user -//@user_id User identifier -//@added_member_count Number of new members invited by the user -chatStatisticsInviterInfo#2583d48b user_id:int53 added_member_count:int32 = ChatStatisticsInviterInfo; - -//@class ChatStatistics @description Contains a detailed statistics about a chat - -//@description A detailed statistics about a supergroup chat -//@period A period to which the statistics applies -//@member_count Number of members in the chat -//@message_count Number of messages sent to the chat -//@viewer_count Number of users who viewed messages in the chat -//@sender_count Number of users who sent messages to the chat -//@member_count_graph A graph containing number of members in the chat -//@join_graph A graph containing number of members joined and left the chat -//@join_by_source_graph A graph containing number of new member joins per source -//@language_graph A graph containing distribution of active users per language -//@message_content_graph A graph containing distribution of sent messages by content type -//@action_graph A graph containing number of different actions in the chat -//@day_graph A graph containing distribution of message views per hour -//@week_graph A graph containing distribution of message views per day of week -//@top_senders List of users sent most messages in the last week -//@top_administrators List of most active administrators in the last week -//@top_inviters List of most active inviters of new members in the last week -chatStatisticsSupergroup#c67549ef period:dateRange member_count:statisticalValue message_count:statisticalValue viewer_count:statisticalValue sender_count:statisticalValue member_count_graph:StatisticalGraph join_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_content_graph:StatisticalGraph action_graph:StatisticalGraph day_graph:StatisticalGraph week_graph:StatisticalGraph top_senders:vector top_administrators:vector top_inviters:vector = ChatStatistics; - -//@description A detailed statistics about a channel chat -//@period A period to which the statistics applies -//@member_count Number of members in the chat -//@mean_message_view_count Mean number of times the recently sent messages were viewed -//@mean_message_share_count Mean number of times the recently sent messages were shared -//@mean_message_reaction_count Mean number of times reactions were added to the recently sent messages -//@mean_story_view_count Mean number of times the recently sent stories were viewed -//@mean_story_share_count Mean number of times the recently sent stories were shared -//@mean_story_reaction_count Mean number of times reactions were added to the recently sent stories -//@enabled_notifications_percentage A percentage of users with enabled notifications for the chat; 0-100 -//@member_count_graph A graph containing number of members in the chat -//@join_graph A graph containing number of members joined and left the chat -//@mute_graph A graph containing number of members muted and unmuted the chat -//@view_count_by_hour_graph A graph containing number of message views in a given hour in the last two weeks -//@view_count_by_source_graph A graph containing number of message views per source -//@join_by_source_graph A graph containing number of new member joins per source -//@language_graph A graph containing number of users viewed chat messages per language -//@message_interaction_graph A graph containing number of chat message views and shares -//@message_reaction_graph A graph containing number of reactions on messages -//@story_interaction_graph A graph containing number of story views and shares -//@story_reaction_graph A graph containing number of reactions on stories -//@instant_view_interaction_graph A graph containing number of views of associated with the chat instant views -//@recent_interactions Detailed statistics about number of views and shares of recently sent messages and stories -chatStatisticsChannel#b8e95b4 period:dateRange member_count:statisticalValue mean_message_view_count:statisticalValue mean_message_share_count:statisticalValue mean_message_reaction_count:statisticalValue mean_story_view_count:statisticalValue mean_story_share_count:statisticalValue mean_story_reaction_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_interactions:vector = ChatStatistics; - -//@description Contains information about revenue earned from sponsored messages in a chat -//@cryptocurrency Cryptocurrency in which revenue is calculated -//@total_amount Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency -//@balance_amount Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency -//@available_amount Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency -//@withdrawal_enabled True, if Telegram Stars can be withdrawn now or later -chatRevenueAmount#a648ce58 cryptocurrency:string total_amount:int64 balance_amount:int64 available_amount:int64 withdrawal_enabled:Bool = ChatRevenueAmount; - -//@description A detailed statistics about revenue earned from sponsored messages in a chat -//@revenue_by_hour_graph A graph containing amount of revenue in a given hour -//@revenue_graph A graph containing amount of revenue -//@revenue_amount Amount of earned revenue -//@usd_rate Current conversion rate of the cryptocurrency in which revenue is calculated to USD -chatRevenueStatistics#636318bb revenue_by_hour_graph:StatisticalGraph revenue_graph:StatisticalGraph revenue_amount:chatRevenueAmount usd_rate:double = ChatRevenueStatistics; - -//@description A detailed statistics about a message -//@message_interaction_graph A graph containing number of message views and shares -//@message_reaction_graph A graph containing number of message reactions -messageStatistics#a2ce4f07 message_interaction_graph:StatisticalGraph message_reaction_graph:StatisticalGraph = MessageStatistics; - -//@description A detailed statistics about a story -//@story_interaction_graph A graph containing number of story views and shares -//@story_reaction_graph A graph containing number of story reactions -storyStatistics#46448b6b story_interaction_graph:StatisticalGraph story_reaction_graph:StatisticalGraph = StoryStatistics; - -//@class RevenueWithdrawalState @description Describes state of a revenue withdrawal - -//@description Withdrawal is pending -revenueWithdrawalStatePending#5d314fa5 = RevenueWithdrawalState; - -//@description Withdrawal succeeded -//@date Point in time (Unix timestamp) when the withdrawal was completed -//@url The URL where the withdrawal transaction can be viewed -revenueWithdrawalStateSucceeded#fd14e0a date:int32 url:string = RevenueWithdrawalState; - -//@description Withdrawal failed -revenueWithdrawalStateFailed#ff413089 = RevenueWithdrawalState; - -//@class ChatRevenueTransactionType @description Describes type of transaction for revenue earned from sponsored messages in a chat - -//@description Describes earnings from sponsored messages in a chat in some time frame -//@start_date Point in time (Unix timestamp) when the earnings started -//@end_date Point in time (Unix timestamp) when the earnings ended -chatRevenueTransactionTypeEarnings#e81ca488 start_date:int32 end_date:int32 = ChatRevenueTransactionType; - -//@description Describes a withdrawal of earnings -//@withdrawal_date Point in time (Unix timestamp) when the earnings withdrawal started -//@provider Name of the payment provider -//@state State of the withdrawal -chatRevenueTransactionTypeWithdrawal#f138deb withdrawal_date:int32 provider:string state:RevenueWithdrawalState = ChatRevenueTransactionType; - -//@description Describes a refund for failed withdrawal of earnings -//@refund_date Point in time (Unix timestamp) when the transaction was refunded -//@provider Name of the payment provider -chatRevenueTransactionTypeRefund#1206b847 refund_date:int32 provider:string = ChatRevenueTransactionType; - -//@description Contains a chat revenue transactions -//@cryptocurrency Cryptocurrency in which revenue is calculated -//@cryptocurrency_amount The withdrawn amount, in the smallest units of the cryptocurrency -//@type Type of the transaction -chatRevenueTransaction#4c7a4ff cryptocurrency:string cryptocurrency_amount:int64 type:ChatRevenueTransactionType = ChatRevenueTransaction; - -//@description Contains a list of chat revenue transactions -//@total_count Total number of transactions -//@transactions List of transactions -chatRevenueTransactions#95e61144 total_count:int32 transactions:vector = ChatRevenueTransactions; - -//@description Contains information about Telegram Stars earned by a bot or a chat -//@total_amount Total amount of Telegram Stars earned -//@current_amount The amount of Telegram Stars that aren't withdrawn yet -//@available_amount The amount of Telegram Stars that are available for withdrawal -//@withdrawal_enabled True, if Telegram Stars can be withdrawn now or later -//@next_withdrawal_in Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can be started now -starRevenueStatus#779532e8 total_amount:starAmount current_amount:starAmount available_amount:starAmount withdrawal_enabled:Bool next_withdrawal_in:int32 = StarRevenueStatus; - -//@description A detailed statistics about Telegram Stars earned by a bot or a chat -//@revenue_by_day_graph A graph containing amount of revenue in a given day -//@status Telegram Star revenue status -//@usd_rate Current conversion rate of a Telegram Star to USD -starRevenueStatistics#bd2d9257 revenue_by_day_graph:StatisticalGraph status:starRevenueStatus usd_rate:double = StarRevenueStatistics; - -//@description A point on a Cartesian plane -//@x The point's first coordinate -//@y The point's second coordinate -point#1a13f5b9 x:double y:double = Point; - -//@class VectorPathCommand @description Represents a vector path command - -//@description A straight line to a given point -//@end_point The end point of the straight line -vectorPathCommandLine#db663c8a end_point:point = VectorPathCommand; - -//@description A cubic Bézier curve to a given point -//@start_control_point The start control point of the curve -//@end_control_point The end control point of the curve -//@end_point The end point of the curve -vectorPathCommandCubicBezierCurve#494c3e3a start_control_point:point end_control_point:point end_point:point = VectorPathCommand; - -//@class BotCommandScope @description Represents the scope to which bot commands are relevant - -//@description A scope covering all users -botCommandScopeDefault#2f6cb2ab = BotCommandScope; - -//@description A scope covering all private chats -botCommandScopeAllPrivateChats#eb716739 = BotCommandScope; - -//@description A scope covering all group and supergroup chats -botCommandScopeAllGroupChats#c585c85e = BotCommandScope; - -//@description A scope covering all group and supergroup chat administrators -botCommandScopeAllChatAdministrators#771c1551 = BotCommandScope; - -//@description A scope covering all members of a chat -//@chat_id Chat identifier -botCommandScopeChat#e65b22a5 chat_id:int53 = BotCommandScope; - -//@description A scope covering all administrators of a chat -//@chat_id Chat identifier -botCommandScopeChatAdministrators#42bcfe4e chat_id:int53 = BotCommandScope; - -//@description A scope covering a member of a chat -//@chat_id Chat identifier -//@user_id User identifier -botCommandScopeChatMember#f36696f2 chat_id:int53 user_id:int53 = BotCommandScope; - -//@class PhoneNumberCodeType @description Describes type of the request for which a code is sent to a phone number - -//@description Checks ownership of a new phone number to change the user's authentication phone number; for official Android and iOS applications only -phoneNumberCodeTypeChange#531ba1a = PhoneNumberCodeType; - -//@description Verifies ownership of a phone number to be added to the user's Telegram Passport -phoneNumberCodeTypeVerify#c2a48fdb = PhoneNumberCodeType; - -//@description Confirms ownership of a phone number to prevent account deletion while handling links of the type internalLinkTypePhoneNumberConfirmation -//@hash Hash value from the link -phoneNumberCodeTypeConfirmOwnership#e3114fe8 hash:string = PhoneNumberCodeType; - -//@class Update @description Contains notifications about data changes - -//@description The user authorization state has changed -//@authorization_state New authorization state -updateAuthorizationState#60b30ee2 authorization_state:AuthorizationState = Update; - -//@description A new message was received; can also be an outgoing message -//@message The new message -updateNewMessage#de6fb20e message:message = Update; - -//@description A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully. -//@chat_id The chat identifier of the sent message -//@message_id A temporary message identifier -updateMessageSendAcknowledged#4da7d239 chat_id:int53 message_id:int53 = Update; - -//@description A message has been successfully sent -//@message The sent message. Almost any field of the new message can be different from the corresponding field of the original message. -//@old_message_id The previous temporary message identifier -updateMessageSendSucceeded#6c399d7d message:message old_message_id:int53 = Update; - -//@description A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update -//@message The failed to send message -//@old_message_id The previous temporary message identifier -//@error The cause of the message sending failure -updateMessageSendFailed#da1bf8e7 message:message old_message_id:int53 error:error = Update; - -//@description The message content has changed -//@chat_id Chat identifier -//@message_id Message identifier -//@new_content New message content -updateMessageContent#1e36bb24 chat_id:int53 message_id:int53 new_content:MessageContent = Update; - -//@description A message was edited. Changes in the message content will come in a separate updateMessageContent -//@chat_id Chat identifier -//@message_id Message identifier -//@edit_date Point in time (Unix timestamp) when the message was edited -//@reply_markup New message reply markup; may be null -updateMessageEdited#dea602e6 chat_id:int53 message_id:int53 edit_date:int32 reply_markup:ReplyMarkup = Update; - -//@description The message pinned state was changed -//@chat_id Chat identifier -//@message_id The message identifier -//@is_pinned True, if the message is pinned -updateMessageIsPinned#41bc233d chat_id:int53 message_id:int53 is_pinned:Bool = Update; - -//@description The information about interactions with a message has changed -//@chat_id Chat identifier -//@message_id Message identifier -//@interaction_info New information about interactions with the message; may be null -updateMessageInteractionInfo#ab803bfe chat_id:int53 message_id:int53 interaction_info:messageInteractionInfo = Update; - -//@description The message content was opened. Updates voice note messages to "listened", video note messages to "viewed" and starts the self-destruct timer -//@chat_id Chat identifier -//@message_id Message identifier -updateMessageContentOpened#a55ea885 chat_id:int53 message_id:int53 = Update; - -//@description A message with an unread mention was read -//@chat_id Chat identifier -//@message_id Message identifier -//@unread_mention_count The new number of unread mention messages left in the chat -updateMessageMentionRead#f0f74d46 chat_id:int53 message_id:int53 unread_mention_count:int32 = Update; - -//@description The list of unread reactions added to a message was changed -//@chat_id Chat identifier -//@message_id Message identifier -//@unread_reactions The new list of unread reactions -//@unread_reaction_count The new number of messages with unread reactions left in the chat -updateMessageUnreadReactions#12a7220a chat_id:int53 message_id:int53 unread_reactions:vector unread_reaction_count:int32 = Update; - -//@description A fact-check added to a message was changed -//@chat_id Chat identifier -//@message_id Message identifier -//@fact_check The new fact-check -updateMessageFactCheck#3c78fb02 chat_id:int53 message_id:int53 fact_check:factCheck = Update; - -//@description A message with a live location was viewed. When the update is received, the application is expected to update the live location -//@chat_id Identifier of the chat with the live location message -//@message_id Identifier of the message with live location -updateMessageLiveLocationViewed#b2058595 chat_id:int53 message_id:int53 = Update; - -//@description An automatically scheduled message with video has been successfully sent after conversion -//@chat_id Identifier of the chat with the message -//@message_id Identifier of the sent message -updateVideoPublished#eafc2052 chat_id:int53 message_id:int53 = Update; - -//@description A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the application. The chat field changes will be reported through separate updates -//@chat The chat -updateNewChat#7bb98ccd chat:chat = Update; - -//@description The title of a chat was changed -//@chat_id Chat identifier -//@title The new chat title -updateChatTitle#f58b85a4 chat_id:int53 title:string = Update; - -//@description A chat photo was changed -//@chat_id Chat identifier -//@photo The new chat photo; may be null -updateChatPhoto#eca5423f chat_id:int53 photo:chatPhotoInfo = Update; - -//@description Chat accent colors have changed -//@chat_id Chat identifier -//@accent_color_id The new chat accent color identifier -//@background_custom_emoji_id The new identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none -//@profile_accent_color_id The new chat profile accent color identifier; -1 if none -//@profile_background_custom_emoji_id The new identifier of a custom emoji to be shown on the profile background; 0 if none -updateChatAccentColors#b7b8f8f9 chat_id:int53 accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Update; - -//@description Chat permissions were changed -//@chat_id Chat identifier -//@permissions The new chat permissions -updateChatPermissions#9f52176d chat_id:int53 permissions:chatPermissions = Update; - -//@description The last message of a chat was changed -//@chat_id Chat identifier -//@last_message The new last message in the chat; may be null if the last message became unknown. While the last message is unknown, new messages can be added to the chat without corresponding updateNewMessage update -//@positions The new chat positions in the chat lists -updateChatLastMessage#f10cab1d chat_id:int53 last_message:message positions:vector = Update; - -//@description The position of a chat in a chat list has changed. An updateChatLastMessage or updateChatDraftMessage update might be sent instead of the update -//@chat_id Chat identifier -//@position New chat position. If new order is 0, then the chat needs to be removed from the list -updateChatPosition#ff76fa77 chat_id:int53 position:chatPosition = Update; - -//@description A chat was added to a chat list -//@chat_id Chat identifier -//@chat_list The chat list to which the chat was added -updateChatAddedToList#ab7004ec chat_id:int53 chat_list:ChatList = Update; - -//@description A chat was removed from a chat list -//@chat_id Chat identifier -//@chat_list The chat list from which the chat was removed -updateChatRemovedFromList#4d2ac21c chat_id:int53 chat_list:ChatList = Update; - -//@description Incoming messages were read or the number of unread messages has been changed -//@chat_id Chat identifier -//@last_read_inbox_message_id Identifier of the last read incoming message -//@unread_count The number of unread messages left in the chat -updateChatReadInbox#d07036e7 chat_id:int53 last_read_inbox_message_id:int53 unread_count:int32 = Update; - -//@description Outgoing messages were read -//@chat_id Chat identifier -//@last_read_outbox_message_id Identifier of last read outgoing message -updateChatReadOutbox#2a385285 chat_id:int53 last_read_outbox_message_id:int53 = Update; - -//@description The chat action bar was changed -//@chat_id Chat identifier -//@action_bar The new value of the action bar; may be null -updateChatActionBar#d9a258c2 chat_id:int53 action_bar:ChatActionBar = Update; - -//@description The bar for managing business bot was changed in a chat -//@chat_id Chat identifier -//@business_bot_manage_bar The new value of the business bot manage bar; may be null -updateChatBusinessBotManageBar#be30e7f7 chat_id:int53 business_bot_manage_bar:businessBotManageBar = Update; - -//@description The chat available reactions were changed -//@chat_id Chat identifier -//@available_reactions The new reactions, available in the chat -updateChatAvailableReactions#8ab413f9 chat_id:int53 available_reactions:ChatAvailableReactions = Update; - -//@description A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update mustn't be applied -//@chat_id Chat identifier -//@draft_message The new draft message; may be null if none -//@positions The new chat positions in the chat lists -updateChatDraftMessage#2bf257d4 chat_id:int53 draft_message:draftMessage positions:vector = Update; - -//@description Chat emoji status has changed -//@chat_id Chat identifier -//@emoji_status The new chat emoji status; may be null -updateChatEmojiStatus#77796510 chat_id:int53 emoji_status:emojiStatus = Update; - -//@description The message sender that is selected to send messages in a chat has changed -//@chat_id Chat identifier -//@message_sender_id New value of message_sender_id; may be null if the user can't change message sender -updateChatMessageSender#77705241 chat_id:int53 message_sender_id:MessageSender = Update; - -//@description The message auto-delete or self-destruct timer setting for a chat was changed -//@chat_id Chat identifier -//@message_auto_delete_time New value of message_auto_delete_time -updateChatMessageAutoDeleteTime#71425de5 chat_id:int53 message_auto_delete_time:int32 = Update; - -//@description Notification settings for a chat were changed -//@chat_id Chat identifier -//@notification_settings The new notification settings -updateChatNotificationSettings#d020b456 chat_id:int53 notification_settings:chatNotificationSettings = Update; - -//@description The chat pending join requests were changed -//@chat_id Chat identifier -//@pending_join_requests The new data about pending join requests; may be null -updateChatPendingJoinRequests#14c6e3e1 chat_id:int53 pending_join_requests:chatJoinRequestsInfo = Update; - -//@description The default chat reply markup was changed. Can occur because new messages with reply markup were received or because an old reply markup was hidden by the user -//@chat_id Chat identifier -//@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat -updateChatReplyMarkup#4e0ba5a0 chat_id:int53 reply_markup_message_id:int53 = Update; - -//@description The chat background was changed -//@chat_id Chat identifier -//@background The new chat background; may be null if background was reset to default -updateChatBackground#ff9d38b3 chat_id:int53 background:chatBackground = Update; - -//@description The chat theme was changed -//@chat_id Chat identifier -//@theme_name The new name of the chat theme; may be empty if theme was reset to default -updateChatTheme#31f3d465 chat_id:int53 theme_name:string = Update; - -//@description The chat unread_mention_count has changed -//@chat_id Chat identifier -//@unread_mention_count The number of unread mention messages left in the chat -updateChatUnreadMentionCount#80f47b1c chat_id:int53 unread_mention_count:int32 = Update; - -//@description The chat unread_reaction_count has changed -//@chat_id Chat identifier -//@unread_reaction_count The number of messages with unread reactions left in the chat -updateChatUnreadReactionCount#81603cdd chat_id:int53 unread_reaction_count:int32 = Update; - -//@description A chat video chat state has changed -//@chat_id Chat identifier -//@video_chat New value of video_chat -updateChatVideoChat#25fb4ca6 chat_id:int53 video_chat:videoChat = Update; - -//@description The value of the default disable_notification parameter, used when a message is sent to the chat, was changed -//@chat_id Chat identifier -//@default_disable_notification The new default_disable_notification value -updateChatDefaultDisableNotification#1ba96a9b chat_id:int53 default_disable_notification:Bool = Update; - -//@description A chat content was allowed or restricted for saving -//@chat_id Chat identifier -//@has_protected_content New value of has_protected_content -updateChatHasProtectedContent#6b50071b chat_id:int53 has_protected_content:Bool = Update; - -//@description Translation of chat messages was enabled or disabled -//@chat_id Chat identifier -//@is_translatable New value of is_translatable -updateChatIsTranslatable#7b031617 chat_id:int53 is_translatable:Bool = Update; - -//@description A chat was marked as unread or was read -//@chat_id Chat identifier -//@is_marked_as_unread New value of is_marked_as_unread -updateChatIsMarkedAsUnread#57853334 chat_id:int53 is_marked_as_unread:Bool = Update; - -//@description A chat default appearance has changed -//@chat_id Chat identifier -//@view_as_topics New value of view_as_topics -updateChatViewAsTopics#5bff163d chat_id:int53 view_as_topics:Bool = Update; - -//@description A chat was blocked or unblocked -//@chat_id Chat identifier -//@block_list Block list to which the chat is added; may be null if none -updateChatBlockList#872af48e chat_id:int53 block_list:BlockList = Update; - -//@description A chat's has_scheduled_messages field has changed -//@chat_id Chat identifier -//@has_scheduled_messages New value of has_scheduled_messages -updateChatHasScheduledMessages#7b14c2d7 chat_id:int53 has_scheduled_messages:Bool = Update; - -//@description The list of chat folders or a chat folder has changed -//@chat_folders The new list of chat folders -//@main_chat_list_position Position of the main chat list among chat folders, 0-based -//@are_tags_enabled True, if folder tags are enabled -updateChatFolders#e110242a chat_folders:vector main_chat_list_position:int32 are_tags_enabled:Bool = Update; - -//@description The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. -//@chat_id Identifier of the chat -//@online_member_count New number of online members in the chat, or 0 if unknown -updateChatOnlineMemberCount#1d0caa9d chat_id:int53 online_member_count:int32 = Update; - -//@description Basic information about a Saved Messages topic has changed. This update is guaranteed to come before the topic identifier is returned to the application -//@topic New data about the topic -updateSavedMessagesTopic#9f823b30 topic:savedMessagesTopic = Update; - -//@description Number of Saved Messages topics has changed -//@topic_count Approximate total number of Saved Messages topics -updateSavedMessagesTopicCount#fbd279d1 topic_count:int32 = Update; - -//@description Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application -//@shortcut New data about the shortcut -updateQuickReplyShortcut#c69338cf shortcut:quickReplyShortcut = Update; - -//@description A quick reply shortcut and all its messages were deleted -//@shortcut_id The identifier of the deleted shortcut -updateQuickReplyShortcutDeleted#e8b9bc3a shortcut_id:int32 = Update; - -//@description The list of quick reply shortcuts has changed -//@shortcut_ids The new list of identifiers of quick reply shortcuts -updateQuickReplyShortcuts#77d31a6a shortcut_ids:vector = Update; - -//@description The list of quick reply shortcut messages has changed -//@shortcut_id The identifier of the shortcut -//@messages The new list of quick reply messages for the shortcut in order from the first to the last sent -updateQuickReplyShortcutMessages#8bb36b72 shortcut_id:int32 messages:vector = Update; - -//@description Basic information about a topic in a forum chat was changed -//@chat_id Chat identifier -//@info New information about the topic -updateForumTopicInfo#6b6f2cc9 chat_id:int53 info:forumTopicInfo = Update; - -//@description Notification settings for some type of chats were updated -//@scope Types of chats for which notification settings were updated -//@notification_settings The new notification settings -updateScopeNotificationSettings#b83ccb73 scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; - -//@description Notification settings for reactions were updated -//@notification_settings The new notification settings -updateReactionNotificationSettings#e54d17ec notification_settings:reactionNotificationSettings = Update; - -//@description A notification was changed -//@notification_group_id Unique notification group identifier -//@notification Changed notification -updateNotification#8ee67ed4 notification_group_id:int32 notification:notification = Update; - -//@description A list of active notifications in a notification group has changed -//@notification_group_id Unique notification group identifier -//@type New type of the notification group -//@chat_id Identifier of a chat to which all notifications in the group belong -//@notification_settings_chat_id Chat identifier, which notification settings must be applied to the added notifications -//@notification_sound_id Identifier of the notification sound to be played; 0 if sound is disabled -//@total_count Total number of unread notifications in the group, can be bigger than number of active notifications -//@added_notifications List of added group notifications, sorted by notification identifier -//@removed_notification_ids Identifiers of removed group notifications, sorted by notification identifier -updateNotificationGroup#96cd9e06 notification_group_id:int32 type:NotificationGroupType chat_id:int53 notification_settings_chat_id:int53 notification_sound_id:int64 total_count:int32 added_notifications:vector removed_notification_ids:vector = Update; - -//@description Contains active notifications that were shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update -//@groups Lists of active notification groups -updateActiveNotifications#317d80f2 groups:vector = Update; - -//@description Describes whether there are some pending notification updates. Can be used to prevent application from killing, while there are some pending notifications -//@have_delayed_notifications True, if there are some delayed notification updates, which will be sent soon -//@have_unreceived_notifications True, if there can be some yet unreceived notifications, which are being fetched from the server -updateHavePendingNotifications#aaee1db have_delayed_notifications:Bool have_unreceived_notifications:Bool = Update; - -//@description Some messages were deleted -//@chat_id Chat identifier -//@message_ids Identifiers of the deleted messages -//@is_permanent True, if the messages are permanently deleted by a user (as opposed to just becoming inaccessible) -//@from_cache True, if the messages are deleted only from the cache and can possibly be retrieved again in the future -updateDeleteMessages#6a05bf9 chat_id:int53 message_ids:vector is_permanent:Bool from_cache:Bool = Update; - -//@description A message sender activity in the chat has changed -//@chat_id Chat identifier -//@message_thread_id If not 0, the message thread identifier in which the action was performed -//@sender_id Identifier of a message sender performing the action -//@action The action -updateChatAction#9abfd628 chat_id:int53 message_thread_id:int53 sender_id:MessageSender action:ChatAction = Update; - -//@description The user went online or offline -//@user_id User identifier -//@status New status of the user -updateUserStatus#39211211 user_id:int53 status:UserStatus = Update; - -//@description Some data of a user has changed. This update is guaranteed to come before the user identifier is returned to the application -//@user New data about the user -updateUser#468928f9 user:user = Update; - -//@description Some data of a basic group has changed. This update is guaranteed to come before the basic group identifier is returned to the application -//@basic_group New data about the group -updateBasicGroup#c433c763 basic_group:basicGroup = Update; - -//@description Some data of a supergroup or a channel has changed. This update is guaranteed to come before the supergroup identifier is returned to the application -//@supergroup New data about the supergroup -updateSupergroup#fb6c6524 supergroup:supergroup = Update; - -//@description Some data of a secret chat has changed. This update is guaranteed to come before the secret chat identifier is returned to the application -//@secret_chat New data about the secret chat -updateSecretChat#9ca5132b secret_chat:secretChat = Update; - -//@description Some data in userFullInfo has been changed -//@user_id User identifier -//@user_full_info New full information about the user -updateUserFullInfo#fcf2cb17 user_id:int53 user_full_info:userFullInfo = Update; - -//@description Some data in basicGroupFullInfo has been changed -//@basic_group_id Identifier of a basic group -//@basic_group_full_info New full information about the group -updateBasicGroupFullInfo#52f66bbf basic_group_id:int53 basic_group_full_info:basicGroupFullInfo = Update; - -//@description Some data in supergroupFullInfo has been changed -//@supergroup_id Identifier of the supergroup or channel -//@supergroup_full_info New full information about the supergroup -updateSupergroupFullInfo#19f5cd0e supergroup_id:int53 supergroup_full_info:supergroupFullInfo = Update; - -//@description A service notification from the server was received. Upon receiving this the application must show a popup with the content of the notification -//@type Notification type. If type begins with "AUTH_KEY_DROP_", then two buttons "Cancel" and "Log out" must be shown under notification; if user presses the second, all local data must be destroyed using Destroy method -//@content Notification content -updateServiceNotification#4e9895ad type:string content:MessageContent = Update; - -//@description Information about a file was updated -//@file New data about the file -updateFile#6cd875f file:file = Update; - -//@description The file generation process needs to be started by the application. Use setFileGenerationProgress and finishFileGeneration to generate the file -//@generation_id Unique identifier for the generation process -//@original_path The original path specified by the application in inputFileGenerated -//@destination_path The path to a file that must be created and where the new file must be generated by the application. -//@conversion If the conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file that must be downloaded by the application. -updateFileGenerationStart#cec5eec generation_id:int64 original_path:string destination_path:string conversion:string = Update; - -//@description File generation is no longer needed -//@generation_id Unique identifier for the generation process -updateFileGenerationStop#8f14fdeb generation_id:int64 = Update; - -//@description The state of the file download list has changed -//@total_size Total size of files in the file download list, in bytes -//@total_count Total number of files in the file download list -//@downloaded_size Total downloaded size of files in the file download list, in bytes -updateFileDownloads#e8cd12c7 total_size:int53 total_count:int32 downloaded_size:int53 = Update; - -//@description A file was added to the file download list. This update is sent only after file download list is loaded for the first time -//@file_download The added file download -//@counts New number of being downloaded and recently downloaded files found -updateFileAddedToDownloads#5ff5921a file_download:fileDownload counts:downloadedFileCounts = Update; - -//@description A file download was changed. This update is sent only after file download list is loaded for the first time -//@file_id File identifier -//@complete_date Point in time (Unix timestamp) when the file downloading was completed; 0 if the file downloading isn't completed -//@is_paused True, if downloading of the file is paused -//@counts New number of being downloaded and recently downloaded files found -updateFileDownload#342f83ca file_id:int32 complete_date:int32 is_paused:Bool counts:downloadedFileCounts = Update; - -//@description A file was removed from the file download list. This update is sent only after file download list is loaded for the first time -//@file_id File identifier -//@counts New number of being downloaded and recently downloaded files found -updateFileRemovedFromDownloads#6e7c14e8 file_id:int32 counts:downloadedFileCounts = Update; - -//@description A request can't be completed unless application verification is performed; for official mobile applications only. -//@verification_id Unique identifier for the verification process -//@nonce Unique base64url-encoded nonce for the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) for Android, -//@cloud_project_number Cloud project number to pass to the Play Integrity API on Android -updateApplicationVerificationRequired#c59c61d7 verification_id:int53 nonce:string cloud_project_number:int64 = Update; - -//@description New call was created or information about a call was updated -//@call New data about a call -updateCall#4fb3d0dd call:call = Update; - -//@description Information about a group call was updated -//@group_call New data about a group call -updateGroupCall#30324e00 group_call:groupCall = Update; - -//@description Information about a group call participant was changed. The updates are sent only after the group call is received through getGroupCall and only if the call is joined or being joined -//@group_call_id Identifier of group call -//@participant New data about a participant -updateGroupCallParticipant#d0213cf9 group_call_id:int32 participant:groupCallParticipant = Update; - -//@description New call signaling data arrived -//@call_id The call identifier -//@data The data -updateNewCallSignalingData#22c98d8d call_id:int32 data:bytes = Update; - -//@description Some privacy setting rules have been changed -//@setting The privacy setting -//@rules New privacy rules -updateUserPrivacySettingRules#c99552f6 setting:UserPrivacySetting rules:userPrivacySettingRules = Update; - -//@description Number of unread messages in a chat list has changed. This update is sent only if the message database is used -//@chat_list The chat list with changed number of unread messages -//@unread_count Total number of unread messages -//@unread_unmuted_count Total number of unread messages in unmuted chats -updateUnreadMessageCount#4b541c9 chat_list:ChatList unread_count:int32 unread_unmuted_count:int32 = Update; - -//@description Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if the message database is used -//@chat_list The chat list with changed number of unread messages -//@total_count Approximate total number of chats in the chat list -//@unread_count Total number of unread chats -//@unread_unmuted_count Total number of unread unmuted chats -//@marked_as_unread_count Total number of chats marked as unread -//@marked_as_unread_unmuted_count Total number of unmuted chats marked as unread -updateUnreadChatCount#76e19242 chat_list:ChatList total_count:int32 unread_count:int32 unread_unmuted_count:int32 marked_as_unread_count:int32 marked_as_unread_unmuted_count:int32 = Update; - -//@description A story was changed -//@story The new information about the story -updateStory#1906572f story:story = Update; - -//@description A story became inaccessible -//@story_sender_chat_id Identifier of the chat that posted the story -//@story_id Story identifier -updateStoryDeleted#7007eb9d story_sender_chat_id:int53 story_id:int32 = Update; - -//@description A story has been successfully sent -//@story The sent story -//@old_story_id The previous temporary story identifier -updateStorySendSucceeded#b9269e57 story:story old_story_id:int32 = Update; - -//@description A story failed to send. If the story sending is canceled, then updateStoryDeleted will be received instead of this update -//@story The failed to send story -//@error The cause of the story sending failure -//@error_type Type of the error; may be null if unknown -updateStorySendFailed#e046f199 story:story error:error error_type:CanSendStoryResult = Update; - -//@description The list of active stories posted by a specific chat has changed -//@active_stories The new list of active stories -updateChatActiveStories#79786c2c active_stories:chatActiveStories = Update; - -//@description Number of chats in a story list has changed -//@story_list The story list -//@chat_count Approximate total number of chats with active stories in the list -updateStoryListChatCount#8833cd3f story_list:StoryList chat_count:int32 = Update; - -//@description Story stealth mode settings have changed -//@active_until_date Point in time (Unix timestamp) until stealth mode is active; 0 if it is disabled -//@cooldown_until_date Point in time (Unix timestamp) when stealth mode can be enabled again; 0 if there is no active cooldown -updateStoryStealthMode#6ff7bd1a active_until_date:int32 cooldown_until_date:int32 = Update; - -//@description An option changed its value -//@name The option name -//@value The new option value -updateOption#35b17404 name:string value:OptionValue = Update; - -//@description A sticker set has changed -//@sticker_set The sticker set -updateStickerSet#70035dcc sticker_set:stickerSet = Update; - -//@description The list of installed sticker sets was updated -//@sticker_type Type of the affected stickers -//@sticker_set_ids The new list of installed ordinary sticker sets -updateInstalledStickerSets#82cd5388 sticker_type:StickerType sticker_set_ids:vector = Update; - -//@description The list of trending sticker sets was updated or some of them were viewed -//@sticker_type Type of the affected stickers -//@sticker_sets The prefix of the list of trending sticker sets with the newest trending sticker sets -updateTrendingStickerSets#4b7a50a7 sticker_type:StickerType sticker_sets:trendingStickerSets = Update; - -//@description The list of recently used stickers was updated -//@is_attached True, if the list of stickers attached to photo or video files was updated; otherwise, the list of sent stickers is updated -//@sticker_ids The new list of file identifiers of recently used stickers -updateRecentStickers#aefdf8dc is_attached:Bool sticker_ids:vector = Update; - -//@description The list of favorite stickers was updated -//@sticker_ids The new list of file identifiers of favorite stickers -updateFavoriteStickers#113f2b6a sticker_ids:vector = Update; - -//@description The list of saved animations was updated -//@animation_ids The new list of file identifiers of saved animations -updateSavedAnimations#1084a1c8 animation_ids:vector = Update; - -//@description The list of saved notification sounds was updated. This update may not be sent until information about a notification sound was requested for the first time -//@notification_sound_ids The new list of identifiers of saved notification sounds -updateSavedNotificationSounds#5a6653b4 notification_sound_ids:vector = Update; - -//@description The default background has changed -//@for_dark_theme True, if default background for dark theme has changed -//@background The new default background; may be null -updateDefaultBackground#d550952f for_dark_theme:Bool background:background = Update; - -//@description The list of available chat themes has changed -//@chat_themes The new list of chat themes -updateChatThemes#98dc58d5 chat_themes:vector = Update; - -//@description The list of supported accent colors has changed -//@colors Information about supported colors; colors with identifiers 0 (red), 1 (orange), 2 (purple/violet), 3 (green), 4 (cyan), 5 (blue), 6 (pink) must always be supported -//@available_accent_color_ids The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specified order -updateAccentColors#1316555e colors:vector available_accent_color_ids:vector = Update; - -//@description The list of supported accent colors for user profiles has changed -//@colors Information about supported colors -//@available_accent_color_ids The list of accent color identifiers, which can be set through setProfileAccentColor and setChatProfileAccentColor. The colors must be shown in the specified order -updateProfileAccentColors#bf8e7430 colors:vector available_accent_color_ids:vector = Update; - -//@description Some language pack strings have been updated -//@localization_target Localization target to which the language pack belongs -//@language_pack_id Identifier of the updated language pack -//@strings List of changed language pack strings; empty if all strings have changed -updateLanguagePackStrings#af87919f localization_target:string language_pack_id:string strings:vector = Update; - -//@description The connection state has changed. This update must be used only to show a human-readable description of the connection state -//@state The new connection state -updateConnectionState#57939e2e state:ConnectionState = Update; - -//@description New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" -//@terms_of_service_id Identifier of the terms of service -//@terms_of_service The new terms of service -updateTermsOfService#b23cc55e terms_of_service_id:string terms_of_service:termsOfService = Update; - -//@description The first unconfirmed session has changed -//@session The unconfirmed session; may be null if none -updateUnconfirmedSession#fea6088c session:unconfirmedSession = Update; - -//@description The list of bots added to attachment or side menu has changed -//@bots The new list of bots. The bots must not be shown on scheduled messages screen -updateAttachmentMenuBots#b6b910c bots:vector = Update; - -//@description A message was sent by an opened Web App, so the Web App needs to be closed -//@web_app_launch_id Identifier of Web App launch -updateWebAppMessageSent#58431229 web_app_launch_id:int64 = Update; - -//@description The list of active emoji reactions has changed -//@emojis The new list of active emoji reactions -updateActiveEmojiReactions#691ffcb7 emojis:vector = Update; - -//@description The list of available message effects has changed -//@reaction_effect_ids The new list of available message effects from emoji reactions -//@sticker_effect_ids The new list of available message effects from Premium stickers -updateAvailableMessageEffects#a1cb72b9 reaction_effect_ids:vector sticker_effect_ids:vector = Update; - -//@description The type of default reaction has changed -//@reaction_type The new type of the default reaction -updateDefaultReactionType#4b615105 reaction_type:ReactionType = Update; - -//@description Tags used in Saved Messages or a Saved Messages topic have changed -//@saved_messages_topic_id Identifier of Saved Messages topic which tags were changed; 0 if tags for the whole chat has changed -//@tags The new tags -updateSavedMessagesTags#7386424a saved_messages_topic_id:int53 tags:savedMessagesTags = Update; - -//@description The list of messages with active live location that need to be updated by the application has changed. The list is persistent across application restarts only if the message database is used -//@messages The list of messages with active live locations -updateActiveLiveLocationMessages#a20b9b1f messages:vector = Update; - -//@description The number of Telegram Stars owned by the current user has changed -//@star_amount The new amount of owned Telegram Stars -updateOwnedStarCount#af7ebf88 star_amount:starAmount = Update; - -//@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions -//@chat_id Identifier of the chat -//@revenue_amount New amount of earned revenue -updateChatRevenueAmount#c6c9bcc4 chat_id:int53 revenue_amount:chatRevenueAmount = Update; - -//@description The Telegram Star revenue earned by a bot or a chat has changed. If Telegram Star transaction screen of the chat is opened, then getStarTransactions may be called to fetch new transactions -//@owner_id Identifier of the owner of the Telegram Stars -//@status New Telegram Star revenue status -updateStarRevenueStatus#ef4bfccb owner_id:MessageSender status:starRevenueStatus = Update; - -//@description The parameters of speech recognition without Telegram Premium subscription has changed -//@max_media_duration The maximum allowed duration of media for speech recognition without Telegram Premium subscription, in seconds -//@weekly_count The total number of allowed speech recognitions per week; 0 if none -//@left_count Number of left speech recognition attempts this week -//@next_reset_date Point in time (Unix timestamp) when the weekly number of tries will reset; 0 if unknown -updateSpeechRecognitionTrial#ff4efcc1 max_media_duration:int32 weekly_count:int32 left_count:int32 next_reset_date:int32 = Update; - -//@description The list of supported dice emojis has changed -//@emojis The new list of supported dice emojis -updateDiceEmojis#9d0f91df emojis:vector = Update; - -//@description Some animated emoji message was clicked and a big animated sticker must be played if the message is visible on the screen. chatActionWatchingAnimations with the text of the message needs to be sent if the sticker is played -//@chat_id Chat identifier -//@message_id Message identifier -//@sticker The animated sticker to be played -updateAnimatedEmojiMessageClicked#a3167405 chat_id:int53 message_id:int53 sticker:sticker = Update; - -//@description The parameters of animation search through getOption("animation_search_bot_username") bot has changed -//@provider Name of the animation search provider -//@emojis The new list of emojis suggested for searching -updateAnimationSearchParameters#6016ef01 provider:string emojis:vector = Update; - -//@description The list of suggested to the user actions has changed -//@added_actions Added suggested actions -//@removed_actions Removed suggested actions -updateSuggestedActions#c2e5cccb added_actions:vector removed_actions:vector = Update; - -//@description Download or upload file speed for the user was limited, but it can be restored by subscription to Telegram Premium. The notification can be postponed until a being downloaded or uploaded file is visible to the user. -//@is_upload True, if upload speed was limited; false, if download speed was limited -updateSpeedLimitNotification#c683d868 is_upload:Bool = Update; - -//@description The list of contacts that had birthdays recently or will have birthday soon has changed -//@close_birthday_users List of contact users with close birthday -updateContactCloseBirthdays#c88b98ce close_birthday_users:vector = Update; - -//@description Autosave settings for some type of chats were updated -//@scope Type of chats for which autosave settings were updated -//@settings The new autosave settings; may be null if the settings are reset to default -updateAutosaveSettings#da274f0b scope:AutosaveSettingsScope settings:scopeAutosaveSettings = Update; - -//@description A business connection has changed; for bots only -//@connection New data about the connection -updateBusinessConnection#8632f476 connection:businessConnection = Update; - -//@description A new message was added to a business account; for bots only -//@connection_id Unique identifier of the business connection -//@message The new message -updateNewBusinessMessage#86be4644 connection_id:string message:businessMessage = Update; - -//@description A message in a business account was edited; for bots only -//@connection_id Unique identifier of the business connection -//@message The edited message -updateBusinessMessageEdited#81a66d89 connection_id:string message:businessMessage = Update; - -//@description Messages in a business account were deleted; for bots only -//@connection_id Unique identifier of the business connection -//@chat_id Identifier of a chat in the business account in which messages were deleted -//@message_ids Unique message identifiers of the deleted messages -updateBusinessMessagesDeleted#e036d3ed connection_id:string chat_id:int53 message_ids:vector = Update; - -//@description A new incoming inline query; for bots only -//@id Unique query identifier -//@sender_user_id Identifier of the user who sent the query -//@user_location User location; may be null -//@chat_type The type of the chat from which the query originated; may be null if unknown -//@query Text of the query -//@offset Offset of the first entry to return -updateNewInlineQuery#7171bf34 id:int64 sender_user_id:int53 user_location:location chat_type:ChatType query:string offset:string = Update; - -//@description The user has chosen a result of an inline query; for bots only -//@sender_user_id Identifier of the user who sent the query -//@user_location User location; may be null -//@query Text of the query -//@result_id Identifier of the chosen result -//@inline_message_id Identifier of the sent inline message, if known -updateNewChosenInlineResult#cb4c4f5d sender_user_id:int53 user_location:location query:string result_id:string inline_message_id:string = Update; - -//@description A new incoming callback query; for bots only -//@id Unique query identifier -//@sender_user_id Identifier of the user who sent the query -//@chat_id Identifier of the chat where the query was sent -//@message_id Identifier of the message from which the query originated -//@chat_instance Identifier that uniquely corresponds to the chat to which the message was sent -//@payload Query payload -updateNewCallbackQuery#8964d05e id:int64 sender_user_id:int53 chat_id:int53 message_id:int53 chat_instance:int64 payload:CallbackQueryPayload = Update; - -//@description A new incoming callback query from a message sent via a bot; for bots only -//@id Unique query identifier -//@sender_user_id Identifier of the user who sent the query -//@inline_message_id Identifier of the inline message from which the query originated -//@chat_instance An identifier uniquely corresponding to the chat a message was sent to -//@payload Query payload -updateNewInlineCallbackQuery#ecf934ba id:int64 sender_user_id:int53 inline_message_id:string chat_instance:int64 payload:CallbackQueryPayload = Update; - -//@description A new incoming callback query from a business message; for bots only -//@id Unique query identifier -//@sender_user_id Identifier of the user who sent the query -//@connection_id Unique identifier of the business connection -//@message The message from the business account from which the query originated -//@chat_instance An identifier uniquely corresponding to the chat a message was sent to -//@payload Query payload -updateNewBusinessCallbackQuery#14125364 id:int64 sender_user_id:int53 connection_id:string message:businessMessage chat_instance:int64 payload:CallbackQueryPayload = Update; - -//@description A new incoming shipping query; for bots only. Only for invoices with flexible price -//@id Unique query identifier -//@sender_user_id Identifier of the user who sent the query -//@invoice_payload Invoice payload -//@shipping_address User shipping address -updateNewShippingQuery#29584672 id:int64 sender_user_id:int53 invoice_payload:string shipping_address:address = Update; - -//@description A new incoming pre-checkout query; for bots only. Contains full information about a checkout -//@id Unique query identifier -//@sender_user_id Identifier of the user who sent the query -//@currency Currency for the product price -//@total_amount Total price for the product, in the smallest units of the currency -//@invoice_payload Invoice payload -//@shipping_option_id Identifier of a shipping option chosen by the user; may be empty if not applicable -//@order_info Information about the order; may be null -updateNewPreCheckoutQuery#2a3871c9 id:int64 sender_user_id:int53 currency:string total_amount:int53 invoice_payload:bytes shipping_option_id:string order_info:orderInfo = Update; - -//@description A new incoming event; for bots only -//@event A JSON-serialized event -updateNewCustomEvent#76dd6a0c event:string = Update; - -//@description A new incoming query; for bots only -//@id The query identifier -//@data JSON-serialized query data -//@timeout Query timeout -updateNewCustomQuery#d702f9a6 id:int64 data:string timeout:int32 = Update; - -//@description A poll was updated; for bots only -//@poll New data about the poll -updatePoll#966b73ca poll:poll = Update; - -//@description A user changed the answer to a poll; for bots only -//@poll_id Unique poll identifier -//@voter_id Identifier of the message sender that changed the answer to the poll -//@option_ids 0-based identifiers of answer options, chosen by the user -updatePollAnswer#b67ac547 poll_id:int64 voter_id:MessageSender option_ids:vector = Update; - -//@description User rights changed in a chat; for bots only -//@chat_id Chat identifier -//@actor_user_id Identifier of the user, changing the rights -//@date Point in time (Unix timestamp) when the user rights were changed -//@invite_link If user has joined the chat using an invite link, the invite link; may be null -//@via_join_request True, if the user has joined the chat after sending a join request and being approved by an administrator -//@via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder -//@old_chat_member Previous chat member -//@new_chat_member New chat member -updateChatMember#98865bc7 chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatInviteLink via_join_request:Bool via_chat_folder_invite_link:Bool old_chat_member:chatMember new_chat_member:chatMember = Update; - -//@description A user sent a join request to a chat; for bots only -//@chat_id Chat identifier -//@request Join request -//@user_chat_id Chat identifier of the private chat with the user -//@invite_link The invite link, which was used to send join request; may be null -updateNewChatJoinRequest#7e48b843 chat_id:int53 request:chatJoinRequest user_chat_id:int53 invite_link:chatInviteLink = Update; - -//@description A chat boost has changed; for bots only -//@chat_id Chat identifier -//@boost New information about the boost -updateChatBoost#50727e24 chat_id:int53 boost:chatBoost = Update; - -//@description User changed its reactions on a message with public reactions; for bots only -//@chat_id Chat identifier -//@message_id Message identifier -//@actor_id Identifier of the user or chat that changed reactions -//@date Point in time (Unix timestamp) when the reactions were changed -//@old_reaction_types Old list of chosen reactions -//@new_reaction_types New list of chosen reactions -updateMessageReaction#f46c854a chat_id:int53 message_id:int53 actor_id:MessageSender date:int32 old_reaction_types:vector new_reaction_types:vector = Update; - -//@description Reactions added to a message with anonymous reactions have changed; for bots only -//@chat_id Chat identifier -//@message_id Message identifier -//@date Point in time (Unix timestamp) when the reactions were changed -//@reactions The list of reactions added to the message -updateMessageReactions#bd5618e9 chat_id:int53 message_id:int53 date:int32 reactions:vector = Update; - -//@description Paid media were purchased by a user; for bots only -//@user_id User identifier -//@payload Bot-specified payload for the paid media -updatePaidMediaPurchased#a410e65b user_id:int53 payload:string = Update; - -//@description Contains a list of updates -//@updates List of updates -updates#b9829222 updates:vector = Updates; - -//@class LogStream @description Describes a stream to which TDLib internal log is written - -//@description The log is written to stderr or an OS specific log -logStreamDefault#52e296bc = LogStream; - -//@description The log is written to a file -//@path Path to the file to where the internal TDLib log will be written -//@max_file_size The maximum size of the file to where the internal TDLib log is written before the file will automatically be rotated, in bytes -//@redirect_stderr Pass true to additionally redirect stderr to the log file. Ignored on Windows -logStreamFile#5b528de5 path:string max_file_size:int53 redirect_stderr:Bool = LogStream; - -//@description The log is written nowhere -logStreamEmpty#e233f1cc = LogStream; - -//@description Contains a TDLib internal log verbosity level -//@verbosity_level Log verbosity level -logVerbosityLevel#676443ea verbosity_level:int32 = LogVerbosityLevel; - -//@description Contains a list of available TDLib internal log tags -//@tags List of log tags -logTags#dc09ced4 tags:vector = LogTags; - -//@description Contains custom information about the user -//@message Information message -//@author Information author -//@date Information change date -userSupportInfo#b50e1c29 message:formattedText author:string date:int32 = UserSupportInfo; - -//@description A simple object containing a number; for testing only -//@value Number -testInt#ddbd2c09 value:int32 = TestInt; - -//@description A simple object containing a string; for testing only -//@value String -testString#fe56688c value:string = TestString; - -//@description A simple object containing a sequence of bytes; for testing only -//@value Bytes -testBytes#a422c4de value:bytes = TestBytes; - -//@description A simple object containing a vector of numbers; for testing only -//@value Vector of numbers -testVectorInt#df9eb113 value:vector = TestVectorInt; - -//@description A simple object containing a vector of objects that hold a number; for testing only -//@value Vector of objects -testVectorIntObject#f152999b value:vector = TestVectorIntObject; - -//@description A simple object containing a vector of strings; for testing only -//@value Vector of strings -testVectorString#5d6f85bc value:vector = TestVectorString; - -//@description A simple object containing a vector of objects that hold a string; for testing only -//@value Vector of objects -testVectorStringObject#e5ecc0d value:vector = TestVectorStringObject; - - ----functions--- - -//@description Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization -getAuthorizationState#742dbe3d = AuthorizationState; - -//@description Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters -//@use_test_dc Pass true to use Telegram test environment instead of the production environment -//@database_directory The path to the directory for the persistent database; if empty, the current working directory will be used -//@files_directory The path to the directory for storing files; if empty, database_directory will be used -//@database_encryption_key Encryption key for the database. If the encryption key is invalid, then an error with code 401 will be returned -//@use_file_database Pass true to keep information about downloaded and uploaded files between application restarts -//@use_chat_info_database Pass true to keep cache of users, basic groups, supergroups, channels and secret chats between restarts. Implies use_file_database -//@use_message_database Pass true to keep cache of chats and messages between restarts. Implies use_chat_info_database -//@use_secret_chats Pass true to enable support for secret chats -//@api_id Application identifier for Telegram API access, which can be obtained at https://my.telegram.org -//@api_hash Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org -//@system_language_code IETF language tag of the user's operating system language; must be non-empty -//@device_model Model of the device the application is being run on; must be non-empty -//@system_version Version of the operating system the application is being run on. If empty, the version is automatically detected by TDLib -//@application_version Application version; must be non-empty -setTdlibParameters#d1c0f62e use_test_dc:Bool database_directory:string files_directory:string database_encryption_key:bytes use_file_database:Bool use_chat_info_database:Bool use_message_database:Bool use_secret_chats:Bool api_id:int32 api_hash:string system_language_code:string device_model:string system_version:string application_version:string = Ok; - -//@description Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, -//@phone_number The phone number of the user, in international format -//@settings Settings for the authentication of the user's phone number; pass null to use default settings -setAuthenticationPhoneNumber#33c0d823 phone_number:string settings:phoneNumberAuthenticationSettings = Ok; - -//@description Sets the email address of the user and sends an authentication code to the email address. Works only when the current authorization state is authorizationStateWaitEmailAddress -//@email_address The email address of the user -setAuthenticationEmailAddress#69b2c502 email_address:string = Ok; - -//@description Resends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode, the next_code_type of the result is not null -//@reason Reason of code resending; pass null if unknown -resendAuthenticationCode#a630bbb8 reason:ResendCodeReason = Ok; - -//@description Checks the authentication of an email address. Works only when the current authorization state is authorizationStateWaitEmailCode -//@code Email address authentication to check -checkAuthenticationEmailCode#dd42c29f code:EmailAddressAuthentication = Ok; - -//@description Checks the authentication code. Works only when the current authorization state is authorizationStateWaitCode -//@code Authentication code to check -checkAuthenticationCode#edfe44aa code:string = Ok; - -//@description Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, -//@other_user_ids List of user identifiers of other users currently using the application -requestQrCodeAuthentication#56fe3c4e other_user_ids:vector = Ok; - -//@description Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration -//@first_name The first name of the user; 1-64 characters -//@last_name The last name of the user; 0-64 characters -//@disable_notification Pass true to disable notification about the current user joining Telegram for other users that added them to contact list -registerUser#c3aa52ec first_name:string last_name:string disable_notification:Bool = Ok; - -//@description Resets the login email address. May return an error with a message "TASK_ALREADY_EXISTS" if reset is still pending. -resetAuthenticationEmailAddress#e742722c = Ok; - -//@description Checks the 2-step verification password for correctness. Works only when the current authorization state is authorizationStateWaitPassword -//@password The 2-step verification password to check -checkAuthenticationPassword#87424ba0 password:string = Ok; - -//@description Requests to send a 2-step verification password recovery code to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword -requestAuthenticationPasswordRecovery#53152ab6 = Ok; - -//@description Checks whether a 2-step verification password recovery code sent to an email address is valid. Works only when the current authorization state is authorizationStateWaitPassword -//@recovery_code Recovery code to check -checkAuthenticationPasswordRecoveryCode#dc0a3be5 recovery_code:string = Ok; - -//@description Recovers the 2-step verification password with a password recovery code sent to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword -//@recovery_code Recovery code to check -//@new_password New 2-step verification password of the user; may be empty to remove the password -//@new_hint New password hint; may be empty -recoverAuthenticationPassword#f8311523 recovery_code:string new_password:string new_hint:string = Ok; - -//@description Sends Firebase Authentication SMS to the phone number of the user. Works only when the current authorization state is authorizationStateWaitCode and the server returned code of the type authenticationCodeTypeFirebaseAndroid or authenticationCodeTypeFirebaseIos -//@token Play Integrity API or SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application -sendAuthenticationFirebaseSms#15c15e3f token:string = Ok; - -//@description Reports that authentication code wasn't delivered via SMS; for official mobile applications only. Works only when the current authorization state is authorizationStateWaitCode -//@mobile_network_code Current mobile network code -reportAuthenticationCodeMissing#91efce48 mobile_network_code:string = Ok; - -//@description Checks the authentication token of a bot; to log in as a bot. Works only when the current authorization state is authorizationStateWaitPhoneNumber. Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in -//@token The bot token -checkAuthenticationBotToken#261b4476 token:string = Ok; - -//@description Closes the TDLib instance after a proper logout. Requires an available network connection. All local data will be destroyed. After the logout completes, updateAuthorizationState with authorizationStateClosed will be sent -logOut#a1b5c41b = Ok; - -//@description Closes the TDLib instance. All databases will be flushed to disk and properly closed. After the close completes, updateAuthorizationState with authorizationStateClosed will be sent. Can be called before initialization -close#b933e17f = Ok; - -//@description Closes the TDLib instance, destroying all local data without a proper logout. The current user session will remain in the list of all active sessions. All local data will be destroyed. -destroy#28d9534a = Ok; - -//@description Confirms QR code authentication on another device. Returns created session on success -//@link A link from a QR code. The link must be scanned by the in-app camera -confirmQrCodeAuthentication#e993a72d link:string = Session; - -//@description Returns all updates needed to restore current TDLib state, i.e. all actual updateAuthorizationState/updateUser/updateNewChat and others. This is especially useful if TDLib is run in a separate process. Can be called before initialization -getCurrentState#b8fc6889 = Updates; - -//@description Changes the database encryption key. Usually the encryption key is never changed and is stored in some OS keychain -//@new_encryption_key New encryption key -setDatabaseEncryptionKey#b83345b5 new_encryption_key:bytes = Ok; - -//@description Returns the current state of 2-step verification -getPasswordState#f5957b78 = PasswordState; - -//@description Changes the 2-step verification password for the current user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed -//@old_password Previous 2-step verification password of the user -//@new_password New 2-step verification password of the user; may be empty to remove the password -//@new_hint New password hint; may be empty -//@set_recovery_email_address Pass true to change also the recovery email address -//@new_recovery_email_address New recovery email address; may be empty -setPassword#b8db46dd old_password:string new_password:string new_hint:string set_recovery_email_address:Bool new_recovery_email_address:string = PasswordState; - -//@description Changes the login email address of the user. The email address can be changed only if the current user already has login email and passwordState.login_email_address_pattern is non-empty. -//@new_login_email_address New login email address -setLoginEmailAddress#37bb43d4 new_login_email_address:string = EmailAddressAuthenticationCodeInfo; - -//@description Resends the login email address verification code -resendLoginEmailAddressCode#11765215 = EmailAddressAuthenticationCodeInfo; - -//@description Checks the login email address authentication -//@code Email address authentication to check -checkLoginEmailAddressCode#a951fc62 code:EmailAddressAuthentication = Ok; - -//@description Returns a 2-step verification recovery email address that was previously set up. This method can be used to verify a password provided by the user -//@password The 2-step verification password for the current user -getRecoveryEmailAddress#a0f1b9fd password:string = RecoveryEmailAddress; - -//@description Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed. -//@password The 2-step verification password of the current user -//@new_recovery_email_address New recovery email address -setRecoveryEmailAddress#89df939f password:string new_recovery_email_address:string = PasswordState; - -//@description Checks the 2-step verification recovery email address verification code -//@code Verification code to check -checkRecoveryEmailAddressCode#88f7981b code:string = PasswordState; - -//@description Resends the 2-step verification recovery email address verification code -resendRecoveryEmailAddressCode#19d66f1c = PasswordState; - -//@description Cancels verification of the 2-step verification recovery email address -cancelRecoveryEmailAddressVerification#a5988e8d = PasswordState; - -//@description Requests to send a 2-step verification password recovery code to an email address that was previously set up -requestPasswordRecovery#ff2dc552 = EmailAddressAuthenticationCodeInfo; - -//@description Checks whether a 2-step verification password recovery code sent to an email address is valid -//@recovery_code Recovery code to check -checkPasswordRecoveryCode#f4081e18 recovery_code:string = Ok; - -//@description Recovers the 2-step verification password using a recovery code sent to an email address that was previously set up -//@recovery_code Recovery code to check -//@new_password New 2-step verification password of the user; may be empty to remove the password -//@new_hint New password hint; may be empty -recoverPassword#a5259973 recovery_code:string new_password:string new_hint:string = PasswordState; - -//@description Removes 2-step verification password without previous password and access to recovery email address. The password can't be reset immediately and the request needs to be repeated after the specified time -resetPassword#dc9e8c9d = ResetPasswordResult; - -//@description Cancels reset of 2-step verification password. The method can be called if passwordState.pending_reset_date > 0 -cancelPasswordReset#38127462 = Ok; - -//@description Creates a new temporary password for processing payments -//@password The 2-step verification password of the current user -//@valid_for Time during which the temporary password will be valid, in seconds; must be between 60 and 86400 -createTemporaryPassword#9f0d6f86 password:string valid_for:int32 = TemporaryPasswordState; - -//@description Returns information about the current temporary password -getTemporaryPasswordState#ff3ea892 = TemporaryPasswordState; - -//@description Returns the current user -getMe#f495b27f = User; - -//@description Returns information about a user by their identifier. This is an offline request if the current user is not a bot -//@user_id User identifier -getUser#42999c0b user_id:int53 = User; - -//@description Returns full information about a user by their identifier -//@user_id User identifier -getUserFullInfo#d1b29c58 user_id:int53 = UserFullInfo; - -//@description Returns information about a basic group by its identifier. This is an offline request if the current user is not a bot -//@basic_group_id Basic group identifier -getBasicGroup#9e893654 basic_group_id:int53 = BasicGroup; - -//@description Returns full information about a basic group by its identifier -//@basic_group_id Basic group identifier -getBasicGroupFullInfo#9365e32b basic_group_id:int53 = BasicGroupFullInfo; - -//@description Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot -//@supergroup_id Supergroup or channel identifier -getSupergroup#3afd10e2 supergroup_id:int53 = Supergroup; - -//@description Returns full information about a supergroup or a channel by its identifier, cached for up to 1 minute -//@supergroup_id Supergroup or channel identifier -getSupergroupFullInfo#418d4038 supergroup_id:int53 = SupergroupFullInfo; - -//@description Returns information about a secret chat by its identifier. This is an offline request -//@secret_chat_id Secret chat identifier -getSecretChat#26b7e81 secret_chat_id:int32 = SecretChat; - -//@description Returns information about a chat by its identifier; this is an offline request if the current user is not a bot -//@chat_id Chat identifier -getChat#6f421440 chat_id:int53 = Chat; - -//@description Returns information about a message. Returns a 404 error if the message doesn't exist -//@chat_id Identifier of the chat the message belongs to -//@message_id Identifier of the message to get -getMessage#9372c080 chat_id:int53 message_id:int53 = Message; - -//@description Returns information about a message, if it is available without sending network request. Returns a 404 error if message isn't available locally. This is an offline request -//@chat_id Identifier of the chat the message belongs to -//@message_id Identifier of the message to get -getMessageLocally#dc062b6c chat_id:int53 message_id:int53 = Message; - -//@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, -//@chat_id Identifier of the chat the message belongs to -//@message_id Identifier of the reply message -getRepliedMessage#d9bd19bd chat_id:int53 message_id:int53 = Message; - -//@description Returns information about a newest pinned message in the chat. Returns a 404 error if the message doesn't exist -//@chat_id Identifier of the chat the message belongs to -getChatPinnedMessage#15731ab0 chat_id:int53 = Message; - -//@description Returns information about a message with the callback button that originated a callback query; for bots only -//@chat_id Identifier of the chat the message belongs to -//@message_id Message identifier -//@callback_query_id Identifier of the callback query -getCallbackQueryMessage#bd209172 chat_id:int53 message_id:int53 callback_query_id:int64 = Message; - -//@description Returns information about messages. If a message is not found, returns null on the corresponding position of the result -//@chat_id Identifier of the chat the messages belong to -//@message_ids Identifiers of the messages to get -getMessages#d5dd28bf chat_id:int53 message_ids:vector = Messages; - -//@description Returns properties of a message; this is an offline request -//@chat_id Chat identifier -//@message_id Identifier of the message -getMessageProperties#2e18e1ab chat_id:int53 message_id:int53 = MessageProperties; - -//@description Returns information about a message thread. Can be used only if messageProperties.can_get_message_thread == true -//@chat_id Chat identifier -//@message_id Identifier of the message -getMessageThread#7af23e3e chat_id:int53 message_id:int53 = MessageThreadInfo; - -//@description Returns read date of a recent outgoing message in a private chat. The method can be called if messageProperties.can_get_read_date == true -//@chat_id Chat identifier -//@message_id Identifier of the message -getMessageReadDate#a7850343 chat_id:int53 message_id:int53 = MessageReadDate; - -//@description Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if messageProperties.can_get_viewers == true -//@chat_id Chat identifier -//@message_id Identifier of the message -getMessageViewers#a18f1ace chat_id:int53 message_id:int53 = MessageViewers; - -//@description Returns information about a file; this is an offline request -//@file_id Identifier of the file to get -getFile#5c9efd4e file_id:int32 = File; - -//@description Returns information about a file by its remote identifier; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. -//@remote_file_id Remote identifier of the file to get -//@file_type File type; pass null if unknown -getRemoteFile#7f632732 remote_file_id:string file_type:FileType = File; - -//@description Loads more chats from a chat list. The loaded chats and their positions in the chat list will be sent through updates. Chats are sorted by the pair (chat.position.order, chat.id) in descending order. Returns a 404 error if all chats have been loaded -//@chat_list The chat list in which to load chats; pass null to load chats from the main chat list -//@limit The maximum number of chats to be loaded. For optimal performance, the number of loaded chats is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached -loadChats#8f9b7d7b chat_list:ChatList limit:int32 = Ok; - -//@description Returns an ordered list of chats from the beginning of a chat list. For informational purposes only. Use loadChats and updates processing instead to maintain chat lists in a consistent state -//@chat_list The chat list in which to return chats; pass null to get chats from the main chat list -//@limit The maximum number of chats to be returned -getChats#c604bac2 chat_list:ChatList limit:int32 = Chats; - -//@description Searches a public chat by its username. Currently, only private chats, supergroups and channels can be public. Returns the chat if found; otherwise, an error is returned -//@username Username to be resolved -searchPublicChat#3316d9ad username:string = Chat; - -//@description Searches public chats by looking for specified query in their username and title. Currently, only private chats, supergroups and channels can be public. Returns a meaningful number of results. -//@query Query to search for -searchPublicChats#39d6e7b9 query:string = Chats; - -//@description Searches for the specified query in the title and username of already known chats; this is an offline request. Returns chats in the order seen in the main chat list -//@query Query to search for. If the query is empty, returns up to 50 recently found chats -//@limit The maximum number of chats to be returned -searchChats#8ff4b9cc query:string limit:int32 = Chats; - -//@description Searches for the specified query in the title and username of already known chats via request to the server. Returns chats in the order seen in the main chat list -//@query Query to search for -//@limit The maximum number of chats to be returned -searchChatsOnServer#baf42f74 query:string limit:int32 = Chats; - -//@description Returns a list of channel chats recommended to the current user -getRecommendedChats#d9438d71 = Chats; - -//@description Returns a list of chats similar to the given chat -//@chat_id Identifier of the target chat; must be an identifier of a channel chat -getChatSimilarChats#bb508f83 chat_id:int53 = Chats; - -//@description Returns approximate number of chats similar to the given chat -//@chat_id Identifier of the target chat; must be an identifier of a channel chat -//@return_local Pass true to get the number of chats without sending network requests, or -1 if the number of chats is unknown locally -getChatSimilarChatCount#463e968e chat_id:int53 return_local:Bool = Count; - -//@description Informs TDLib that a chat was opened from the list of similar chats. The method is independent of openChat and closeChat methods -//@chat_id Identifier of the original chat, which similar chats were requested -//@opened_chat_id Identifier of the opened chat -openChatSimilarChat#8fa6f413 chat_id:int53 opened_chat_id:int53 = Ok; - -//@description Returns a list of frequently used chats -//@category Category of chats to be returned -//@limit The maximum number of chats to be returned; up to 30 -getTopChats#e8d95221 category:TopChatCategory limit:int32 = Chats; - -//@description Removes a chat from the list of frequently used chats. Supported only if the chat info database is enabled -//@category Category of frequently used chats -//@chat_id Chat identifier -removeTopChat#8e481e55 category:TopChatCategory chat_id:int53 = Ok; - -//@description Searches for the specified query in the title and username of up to 50 recently found chats; this is an offline request -//@query Query to search for -//@limit The maximum number of chats to be returned -searchRecentlyFoundChats#62320591 query:string limit:int32 = Chats; - -//@description Adds a chat to the list of recently found chats. The chat is added to the beginning of the list. If the chat is already in the list, it will be removed from the list first -//@chat_id Identifier of the chat to add -addRecentlyFoundChat#97e8198d chat_id:int53 = Ok; - -//@description Removes a chat from the list of recently found chats -//@chat_id Identifier of the chat to be removed -removeRecentlyFoundChat#2ac1bf1c chat_id:int53 = Ok; - -//@description Clears the list of recently found chats -clearRecentlyFoundChats#eefa5b32 = Ok; - -//@description Returns recently opened chats; this is an offline request. Returns chats in the order of last opening -//@limit The maximum number of chats to be returned -getRecentlyOpenedChats#8d4fb223 limit:int32 = Chats; - -//@description Checks whether a username can be set for a chat -//@chat_id Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or 0 if the chat is being created -//@username Username to be checked -checkChatUsername#f8e66210 chat_id:int53 username:string = CheckChatUsernameResult; - -//@description Returns a list of public chats of the specified type, owned by the user -//@type Type of the public chats to return -getCreatedPublicChats#2a5725ef type:PublicChatType = Chats; - -//@description Checks whether the maximum number of owned public chats has been reached. Returns corresponding error if the limit was reached. The limit can be increased with Telegram Premium -//@type Type of the public chats, for which to check the limit -checkCreatedPublicChatsLimit#e5717fa1 type:PublicChatType = Ok; - -//@description Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel. Returned basic group chats must be first upgraded to supergroups before they can be set as a discussion group. -getSuitableDiscussionChats#2ec5df6 = Chats; - -//@description Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error. Also, the limit can be increased with Telegram Premium -getInactiveSupergroupChats#d8cbf9b5 = Chats; - -//@description Returns a list of channel chats, which can be used as a personal chat -getSuitablePersonalChats#90849bf5 = Chats; - -//@description Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded -//@limit The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached -loadSavedMessagesTopics#1146d6b8 limit:int32 = Ok; - -//@description Returns messages in a Saved Messages topic. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) -//@saved_messages_topic_id Identifier of Saved Messages topic which messages will be fetched -//@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. -getSavedMessagesTopicHistory#77e5da68 saved_messages_topic_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; - -//@description Returns the last message sent in a Saved Messages topic no later than the specified date -//@saved_messages_topic_id Identifier of Saved Messages topic which message will be returned -//@date Point in time (Unix timestamp) relative to which to search for messages -getSavedMessagesTopicMessageByDate#c15e4680 saved_messages_topic_id:int53 date:int32 = Message; - -//@description Deletes all messages in a Saved Messages topic -//@saved_messages_topic_id Identifier of Saved Messages topic which messages will be deleted -deleteSavedMessagesTopicHistory#69df3d6a saved_messages_topic_id:int53 = Ok; - -//@description Deletes all messages between the specified dates in a Saved Messages topic. Messages sent in the last 30 seconds will not be deleted -//@saved_messages_topic_id Identifier of Saved Messages topic which messages will be deleted -//@min_date The minimum date of the messages to delete -//@max_date The maximum date of the messages to delete -deleteSavedMessagesTopicMessagesByDate#160a25 saved_messages_topic_id:int53 min_date:int32 max_date:int32 = Ok; - -//@description Changes the pinned state of a Saved Messages topic. There can be up to getOption("pinned_saved_messages_topic_count_max") pinned topics. The limit can be increased with Telegram Premium -//@saved_messages_topic_id Identifier of Saved Messages topic to pin or unpin -//@is_pinned Pass true to pin the topic; pass false to unpin it -toggleSavedMessagesTopicIsPinned#a15345cc saved_messages_topic_id:int53 is_pinned:Bool = Ok; - -//@description Changes the order of pinned Saved Messages topics -//@saved_messages_topic_ids Identifiers of the new pinned Saved Messages topics -setPinnedSavedMessagesTopics#475a1110 saved_messages_topic_ids:vector = Ok; - -//@description Returns a list of common group chats with a given user. Chats are sorted by their type and creation date -//@user_id User identifier -//@offset_chat_id Chat identifier starting from which to return chats; use 0 for the first request -//@limit The maximum number of chats to be returned; up to 100 -getGroupsInCommon#16bdd36a user_id:int53 offset_chat_id:int53 limit:int32 = Chats; - -//@description Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). -//@chat_id Chat identifier -//@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. -//@only_local Pass true to get only messages that are available without sending network requests -getChatHistory#d051927d chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only_local:Bool = Messages; - -//@description Returns messages in a message thread of a message. Can be used only if messageProperties.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. -//@chat_id Chat identifier -//@message_id Message identifier, which thread history needs to be returned -//@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset up to 99 to get additionally some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. -getMessageThreadHistory#9435d428 chat_id:int53 message_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; - -//@description Deletes all messages in the chat. Use chat.can_be_deleted_only_for_self and chat.can_be_deleted_for_all_users fields to find whether and how the method can be applied to the chat -//@chat_id Chat identifier -//@remove_from_chat_list Pass true to remove the chat from all chat lists -//@revoke Pass true to delete chat history for all users -deleteChatHistory#a841d09f chat_id:int53 remove_from_chat_list:Bool revoke:Bool = Ok; - -//@description Deletes a chat along with all messages in the corresponding chat for all chat members. For group chats this will release the usernames and remove all members. -//@chat_id Chat identifier -deleteChat#f5cae05e chat_id:int53 = Ok; - -//@description Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query -//@chat_id Identifier of the chat in which to search messages -//@query Query to search for -//@sender_id Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats -//@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. -//@filter Additional filter for messages to search; pass null to search for all messages -//@message_thread_id If not 0, only messages in the specified thread will be returned; supergroups only -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 to return all messages, or for chats other than Saved Messages -searchChatMessages#dfdeb5c6 chat_id:int53 query:string sender_id:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = FoundChatMessages; - -//@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). -//@chat_list Chat list in which to search messages; pass null to search in all chats regardless of their chat list. Only Main and Archive chat lists are supported -//@query Query to search for -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -//@filter Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function -//@chat_type_filter Additional filter for type of the chat of the searched messages; pass null to search for messages in all chats -//@min_date If not 0, the minimum date of the messages to return -//@max_date If not 0, the maximum date of the messages to return -searchMessages#490addb5 chat_list:ChatList query:string offset:string limit:int32 filter:SearchMessagesFilter chat_type_filter:SearchMessagesChatTypeFilter min_date:int32 max_date:int32 = FoundMessages; - -//@description Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance, the number of returned messages is chosen by TDLib -//@chat_id Identifier of the chat in which to search. Specify 0 to search in all secret chats -//@query Query to search for. If empty, searchChatMessages must be used instead -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -//@filter Additional filter for messages to search; pass null to search for all messages -searchSecretMessages#cd2a4c9c chat_id:int53 query:string offset:string limit:int32 filter:SearchMessagesFilter = FoundMessages; - -//@description Searches for messages tagged by the given reaction and with the given words in the Saved Messages chat; for Telegram Premium users only. -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages -//@tag Tag to search for; pass null to return all suitable messages -//@query Query to search for -//@from_message_id Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message -//@offset Specify 0 to get results from exactly the message from_message_id or a negative offset to get the specified message and some newer messages -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. -searchSavedMessages#8a9b9f96 saved_messages_topic_id:int53 tag:ReactionType query:string from_message_id:int53 offset:int32 limit:int32 = FoundChatMessages; - -//@description Searches for call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -//@only_missed Pass true to search only for messages with missed/declined calls -searchCallMessages#8c3bef1b offset:string limit:int32 only_missed:Bool = FoundMessages; - -//@description Searches for outgoing messages with content of the type messageDocument in all chats except secret chats. Returns the results in reverse chronological order -//@query Query to search for in document file name and message caption -//@limit The maximum number of messages to be returned; up to 100 -searchOutgoingDocumentMessages#c023c47e query:string limit:int32 = FoundMessages; - -//@description Searches for public channel posts containing the given hashtag or cashtag. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -//@tag Hashtag or cashtag to search for -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -searchPublicMessagesByTag#25976caa tag:string offset:string limit:int32 = FoundMessages; - -//@description Searches for public stories containing the given hashtag or cashtag. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -//@story_sender_chat_id Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats -//@tag Hashtag or cashtag to search for -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -searchPublicStoriesByTag#a2ca6a03 story_sender_chat_id:int53 tag:string offset:string limit:int32 = FoundStories; - -//@description Searches for public stories by the given address location. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -//@address Address of the location -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -searchPublicStoriesByLocation#5f2bd988 address:locationAddress offset:string limit:int32 = FoundStories; - -//@description Searches for public stories from the given venue. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -//@venue_provider Provider of the venue -//@venue_id Identifier of the venue in the provider database -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit -searchPublicStoriesByVenue#d71a622a venue_provider:string venue_id:string offset:string limit:int32 = FoundStories; - -//@description Returns recently searched for hashtags or cashtags by their prefix -//@tag_prefix Prefix of hashtags or cashtags to return -//@limit The maximum number of items to be returned -getSearchedForTags#9b1b30cd tag_prefix:string limit:int32 = Hashtags; - -//@description Removes a hashtag or a cashtag from the list of recently searched for hashtags or cashtags -//@tag Hashtag or cashtag to delete -removeSearchedForTag#35216bca tag:string = Ok; - -//@description Clears the list of recently searched for hashtags or cashtags -//@clear_cashtags Pass true to clear the list of recently searched for cashtags; otherwise, the list of recently searched for hashtags will be cleared -clearSearchedForTags#1e84c356 clear_cashtags:Bool = Ok; - -//@description Deletes all call messages -//@revoke Pass true to delete the messages for all users -deleteAllCallMessages#a897d1f3 revoke:Bool = Ok; - -//@description Returns information about the recent locations of chat members that were sent to the chat. Returns up to 1 location message per user -//@chat_id Chat identifier -//@limit The maximum number of messages to be returned -searchChatRecentLocationMessages#38a37ee6 chat_id:int53 limit:int32 = Messages; - -//@description Returns the last message sent in a chat no later than the specified date. Returns a 404 error if such message doesn't exist -//@chat_id Chat identifier -//@date Point in time (Unix timestamp) relative to which to search for messages -getChatMessageByDate#3f557136 chat_id:int53 date:int32 = Message; - -//@description Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). -//@chat_id Identifier of the chat in which to return information about message positions -//@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function -//@from_message_id The message identifier from which to return information about message positions -//@limit The expected number of message positions to be returned; 50-2000. A smaller number of positions can be returned, if there are not enough appropriate messages -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages -getChatSparseMessagePositions#3b452efd chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 limit:int32 saved_messages_topic_id:int53 = MessagePositions; - -//@description Returns information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" -//@chat_id Identifier of the chat in which to return information about messages -//@filter Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function -//@from_message_id The message identifier from which to return information about messages; use 0 to get results from the last message -//@saved_messages_topic_id If not0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages -getChatMessageCalendar#81af2db7 chat_id:int53 filter:SearchMessagesFilter from_message_id:int53 saved_messages_topic_id:int53 = MessageCalendar; - -//@description Returns approximate number of messages of the specified type in the chat -//@chat_id Identifier of the chat in which to count messages -//@filter Filter for message content; searchMessagesFilterEmpty is unsupported in this function -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 to count all messages, or for chats other than Saved Messages -//@return_local Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally -getChatMessageCount#38f78909 chat_id:int53 filter:SearchMessagesFilter saved_messages_topic_id:int53 return_local:Bool = Count; - -//@description Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats -//@chat_id Identifier of the chat in which to find message position -//@message_id Message identifier -//@filter Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function -//@message_thread_id If not 0, only messages in the specified thread will be considered; supergroups only -//@saved_messages_topic_id If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages -getChatMessagePosition#81bfcc7 chat_id:int53 message_id:int53 filter:SearchMessagesFilter message_thread_id:int53 saved_messages_topic_id:int53 = Count; - -//@description Returns all scheduled messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) -//@chat_id Chat identifier -getChatScheduledMessages#df3d2ffb chat_id:int53 = Messages; - -//@description Returns sponsored messages to be shown in a chat; for channel chats and chats with bots only -//@chat_id Identifier of the chat -getChatSponsoredMessages#50a84098 chat_id:int53 = SponsoredMessages; - -//@description Informs TDLib that the user opened the sponsored chat via the button, the name, the chat photo, a mention in the sponsored message text, or the media in the sponsored message -//@chat_id Chat identifier of the sponsored message -//@message_id Identifier of the sponsored message -//@is_media_click Pass true if the media was clicked in the sponsored message -//@from_fullscreen Pass true if the user expanded the video from the sponsored message fullscreen before the click -clickChatSponsoredMessage#39ef7a17 chat_id:int53 message_id:int53 is_media_click:Bool from_fullscreen:Bool = Ok; - -//@description Reports a sponsored message to Telegram moderators -//@chat_id Chat identifier of the sponsored message -//@message_id Identifier of the sponsored message -//@option_id Option identifier chosen by the user; leave empty for the initial request -reportChatSponsoredMessage#cc3e53be chat_id:int53 message_id:int53 option_id:bytes = ReportChatSponsoredMessageResult; - -//@description Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user -//@notification_group_id Identifier of notification group to which the notification belongs -//@notification_id Identifier of removed notification -removeNotification#336ab34e notification_group_id:int32 notification_id:int32 = Ok; - -//@description Removes a group of active notifications. Needs to be called only if the notification group is removed by the current user -//@notification_group_id Notification group identifier -//@max_notification_id The maximum identifier of removed notifications -removeNotificationGroup#661a638e notification_group_id:int32 max_notification_id:int32 = Ok; - -//@description Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -//@media_timestamp If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its link preview -//@for_album Pass true to create a link for the whole media album -//@in_message_thread Pass true to create a link to the message as a channel post comment, in a message thread, or a forum topic -getMessageLink#c556ef7a chat_id:int53 message_id:int53 media_timestamp:int32 for_album:Bool in_message_thread:Bool = MessageLink; - -//@description Returns an HTML code for embedding the message. Available only if messageProperties.can_get_embedding_code -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -//@for_album Pass true to return an HTML code for embedding of the whole media album -getMessageEmbeddingCode#62a4cd09 chat_id:int53 message_id:int53 for_album:Bool = Text; - -//@description Returns information about a public or private message link. Can be called for any internal link of the type internalLinkTypeMessage -//@url The message link -getMessageLinkInfo#d63eb458 url:string = MessageLinkInfo; - -//@description Translates a text to the given language. If the current user is a Telegram Premium user, then text formatting is preserved -//@text Text to translate -//@to_language_code Language code of the language to which the message is translated. Must be one of -translateText#252264f2 text:formattedText to_language_code:string = FormattedText; - -//@description Extracts text or caption of the given message and translates it to the given language. If the current user is a Telegram Premium user, then text formatting is preserved -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -//@to_language_code Language code of the language to which the message is translated. Must be one of -translateMessageText#53c51ed2 chat_id:int53 message_id:int53 to_language_code:string = FormattedText; - -//@description Recognizes speech in a video note or a voice note message -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message. Use messageProperties.can_recognize_speech to check whether the message is suitable -recognizeSpeech#67d402b9 chat_id:int53 message_id:int53 = Ok; - -//@description Rates recognized speech in a video note or a voice note message -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -//@is_good Pass true if the speech recognition is good -rateSpeechRecognition#eedcc3b5 chat_id:int53 message_id:int53 is_good:Bool = Ok; - -//@description Returns the list of message sender identifiers, which can be used to send messages in a chat -//@chat_id Chat identifier -getChatAvailableMessageSenders#450fe92b chat_id:int53 = ChatMessageSenders; - -//@description Selects a message sender to send messages in a chat -//@chat_id Chat identifier -//@message_sender_id New message sender for the chat -setChatMessageSender#ab456b7e chat_id:int53 message_sender_id:MessageSender = Ok; - -//@description Sends a message. Returns the sent message -//@chat_id Target chat -//@message_thread_id If not 0, the message thread identifier in which the message will be sent -//@reply_to Information about the message or story to be replied; pass null if none -//@options Options to be used to send the message; pass null to use default options -//@reply_markup Markup for replying to the message; pass null if none; for bots only -//@input_message_content The content of the message to be sent -sendMessage#e02d01e9 chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; - -//@description Sends 2-10 messages grouped together into an album. Currently, only audio, document, photo and video messages can be grouped into an album. -//@chat_id Target chat -//@message_thread_id If not 0, the message thread identifier in which the messages will be sent -//@reply_to Information about the message or story to be replied; pass null if none -//@options Options to be used to send the messages; pass null to use default options -//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media -sendMessageAlbum#74bcdacf chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions input_message_contents:vector = Messages; - -//@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command; requires can_invite_users member right. Bots can't be invited to a private chat other than the chat with the bot. -//@bot_user_id Identifier of the bot -//@chat_id Identifier of the target chat -//@parameter A hidden parameter sent to the bot for deep linking purposes (https://core.telegram.org/bots#deep-linking) -sendBotStartMessage#aa6a3eee bot_user_id:int53 chat_id:int53 parameter:string = Message; - -//@description Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message -//@chat_id Target chat -//@message_thread_id If not 0, the message thread identifier in which the message will be sent -//@reply_to Information about the message or story to be replied; pass null if none -//@options Options to be used to send the message; pass null to use default options -//@query_id Identifier of the inline query -//@result_id Identifier of the inline query result -//@hide_via_bot Pass true to hide the bot, via which the message is sent. Can be used only for bots getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), and getOption("venue_search_bot_username") -sendInlineQueryResultMessage#467c5478 chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions query_id:int64 result_id:string hide_via_bot:Bool = Message; - -//@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message -//@chat_id Identifier of the chat to which to forward messages -//@message_thread_id If not 0, the message thread identifier in which the message will be sent; for forum threads only -//@from_chat_id Identifier of the chat from which to forward messages -//@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if messageProperties.can_be_forwarded -//@options Options to be used to send the messages; pass null to use default options -//@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. -//@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false -forwardMessages#34de5b20 chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; - -//@description Sends messages from a quick reply shortcut. Requires Telegram Business subscription -//@chat_id Identifier of the chat to which to send messages. The chat must be a private chat with a regular user -//@shortcut_id Unique identifier of the quick reply shortcut -//@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates -sendQuickReplyShortcutMessages#dd5169d chat_id:int53 shortcut_id:int32 sending_id:int32 = Messages; - -//@description Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. -//@chat_id Identifier of the chat to send messages -//@message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order -//@quote New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false -resendMessages#90e36776 chat_id:int53 message_ids:vector quote:inputTextQuote = Messages; - -//@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message -//@chat_id Target chat -//@sender_id Identifier of the sender of the message -//@reply_to Information about the message or story to be replied; pass null if none -//@disable_notification Pass true to disable notification for the message -//@input_message_content The content of the message to be added -addLocalMessage#f617b7a1 chat_id:int53 sender_id:MessageSender reply_to:InputMessageReplyTo disable_notification:Bool input_message_content:InputMessageContent = Message; - -//@description Deletes messages -//@chat_id Chat identifier -//@message_ids Identifiers of the messages to be deleted. Use messageProperties.can_be_deleted_only_for_self and messageProperties.can_be_deleted_for_all_users to get suitable messages -//@revoke Pass true to delete messages for all chat members. Always true for supergroups, channels and secret chats -deleteMessages#c3ed9de2 chat_id:int53 message_ids:vector revoke:Bool = Ok; - -//@description Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator privileges -//@chat_id Chat identifier -//@sender_id Identifier of the sender of messages to delete -deleteChatMessagesBySender#ba9b2e67 chat_id:int53 sender_id:MessageSender = Ok; - -//@description Deletes all messages between the specified dates in a chat. Supported only for private chats and basic groups. Messages sent in the last 30 seconds will not be deleted -//@chat_id Chat identifier -//@min_date The minimum date of the messages to delete -//@max_date The maximum date of the messages to delete -//@revoke Pass true to delete chat messages for all users; private chats only -deleteChatMessagesByDate#9e44e0bf chat_id:int53 min_date:int32 max_date:int32 revoke:Bool = Ok; - -//@description Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side -//@chat_id The chat the message belongs to -//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited -//@reply_markup The new message reply markup; pass null if none; for bots only -//@input_message_content New text content of the message. Must be of type inputMessageText -editMessageText#bb2e1b7 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; - -//@description Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. -//@chat_id The chat the message belongs to -//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited -//@reply_markup The new message reply markup; pass null if none; for bots only -//@location New location content of the message; pass null to stop sharing the live location -//@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. -//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown -//@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled -editMessageLiveLocation#8f511394 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Message; - -//@description Edits the media content of a message, including message caption. If only the caption needs to be edited, use editMessageCaption instead. -//@chat_id The chat the message belongs to -//@message_id Identifier of the message. Use messageProperties.can_edit_media to check whether the message can be edited -//@reply_markup The new message reply markup; pass null if none; for bots only -//@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo -editMessageMedia#bb4b8713 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; - -//@description Edits the message content caption. Returns the edited message after the edit is completed on the server side -//@chat_id The chat the message belongs to -//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited -//@reply_markup The new message reply markup; pass null if none; for bots only -//@caption New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption -//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages -editMessageCaption#87977241 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Message; - -//@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side -//@chat_id The chat the message belongs to -//@message_id Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited -//@reply_markup The new message reply markup; pass null if none -editMessageReplyMarkup#13cbde89 chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Message; - -//@description Edits the text of an inline text or game message sent via a bot; for bots only -//@inline_message_id Inline message identifier -//@reply_markup The new message reply markup; pass null if none -//@input_message_content New text content of the message. Must be of type inputMessageText -editInlineMessageText#cd02c1e5 inline_message_id:string reply_markup:ReplyMarkup input_message_content:InputMessageContent = Ok; - -//@description Edits the content of a live location in an inline message sent via a bot; for bots only -//@inline_message_id Inline message identifier -//@reply_markup The new message reply markup; pass null if none -//@location New location content of the message; pass null to stop sharing the live location -//@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. -//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown -//@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled -editInlineMessageLiveLocation#7f37a0ac inline_message_id:string reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = Ok; - -//@description Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only -//@inline_message_id Inline message identifier -//@reply_markup The new message reply markup; pass null if none; for bots only -//@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo -editInlineMessageMedia#1676781 inline_message_id:string reply_markup:ReplyMarkup input_message_content:InputMessageContent = Ok; - -//@description Edits the caption of an inline message sent via a bot; for bots only -//@inline_message_id Inline message identifier -//@reply_markup The new message reply markup; pass null if none -//@caption New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages -editInlineMessageCaption#540744f8 inline_message_id:string reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = Ok; - -//@description Edits the reply markup of an inline message sent via a bot; for bots only -//@inline_message_id Inline message identifier -//@reply_markup The new message reply markup; pass null if none -editInlineMessageReplyMarkup#fbf906de inline_message_id:string reply_markup:ReplyMarkup = Ok; - -//@description Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed -//@chat_id The chat the message belongs to -//@message_id Identifier of the message. Use messageProperties.can_edit_scheduling_state to check whether the message is suitable -//@scheduling_state The new message scheduling state; pass null to send the message immediately. Must be null for messages in the state messageSchedulingStateSendWhenVideoProcessed -editMessageSchedulingState#ae2a0bc0 chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; - -//@description Changes the fact-check of a message. Can be only used if messageProperties.can_set_fact_check == true -//@chat_id The channel chat the message belongs to -//@message_id Identifier of the message -//@text New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are supported -setMessageFactCheck#ffbe3d08 chat_id:int53 message_id:int53 text:formattedText = Ok; - -//@description Sends a message on behalf of a business account; for bots only. Returns the message after it was sent -//@business_connection_id Unique identifier of business connection on behalf of which to send the request -//@chat_id Target chat -//@reply_to Information about the message to be replied; pass null if none -//@disable_notification Pass true to disable notification for the message -//@protect_content Pass true if the content of the message must be protected from forwarding and saving -//@effect_id Identifier of the effect to apply to the message -//@reply_markup Markup for replying to the message; pass null if none -//@input_message_content The content of the message to be sent -sendBusinessMessage#987b403 business_connection_id:string chat_id:int53 reply_to:InputMessageReplyTo disable_notification:Bool protect_content:Bool effect_id:int64 reply_markup:ReplyMarkup input_message_content:InputMessageContent = BusinessMessage; - -//@description Sends 2-10 messages grouped together into an album on behalf of a business account; for bots only. Currently, only audio, document, photo and video messages can be grouped into an album. -//@business_connection_id Unique identifier of business connection on behalf of which to send the request -//@chat_id Target chat -//@reply_to Information about the message to be replied; pass null if none -//@disable_notification Pass true to disable notification for the message -//@protect_content Pass true if the content of the message must be protected from forwarding and saving -//@effect_id Identifier of the effect to apply to the message -//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media -sendBusinessMessageAlbum#70bd4e6f business_connection_id:string chat_id:int53 reply_to:InputMessageReplyTo disable_notification:Bool protect_content:Bool effect_id:int64 input_message_contents:vector = BusinessMessages; - -//@description Edits the text of a text or game message sent on behalf of a business account; for bots only -//@business_connection_id Unique identifier of business connection on behalf of which the message was sent -//@chat_id The chat the message belongs to -//@message_id Identifier of the message -//@reply_markup The new message reply markup; pass null if none -//@input_message_content New text content of the message. Must be of type inputMessageText -editBusinessMessageText#bb81119c business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = BusinessMessage; - -//@description Edits the content of a live location in a message sent on behalf of a business account; for bots only -//@business_connection_id Unique identifier of business connection on behalf of which the message was sent -//@chat_id The chat the message belongs to -//@message_id Identifier of the message -//@reply_markup The new message reply markup; pass null if none -//@location New location content of the message; pass null to stop sharing the live location -//@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. -//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown -//@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled -editBusinessMessageLiveLocation#1d80ae1f business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = BusinessMessage; - -//@description Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only -//@business_connection_id Unique identifier of business connection on behalf of which the message was sent -//@chat_id The chat the message belongs to -//@message_id Identifier of the message -//@reply_markup The new message reply markup; pass null if none; for bots only -//@input_message_content New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo -editBusinessMessageMedia#fc614778 business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = BusinessMessage; - -//@description Edits the caption of a message sent on behalf of a business account; for bots only -//@business_connection_id Unique identifier of business connection on behalf of which the message was sent -//@chat_id The chat the message belongs to -//@message_id Identifier of the message -//@reply_markup The new message reply markup; pass null if none -//@caption New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters -//@show_caption_above_media Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages -editBusinessMessageCaption#c02142c3 business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = BusinessMessage; - -//@description Edits the reply markup of a message sent on behalf of a business account; for bots only -//@business_connection_id Unique identifier of business connection on behalf of which the message was sent -//@chat_id The chat the message belongs to -//@message_id Identifier of the message -//@reply_markup The new message reply markup; pass null if none -editBusinessMessageReplyMarkup#29d46c17 business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = BusinessMessage; - -//@description Stops a poll sent on behalf of a business account; for bots only -//@business_connection_id Unique identifier of business connection on behalf of which the message with the poll was sent -//@chat_id The chat the message belongs to -//@message_id Identifier of the message containing the poll -//@reply_markup The new message reply markup; pass null if none -stopBusinessPoll#bbeb2160 business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = BusinessMessage; - -//@description Pins or unpins a message sent on behalf of a business account; for bots only -//@business_connection_id Unique identifier of business connection on behalf of which the message was sent -//@chat_id The chat the message belongs to -//@message_id Identifier of the message -//@is_pinned Pass true to pin the message, pass false to unpin it -setBusinessMessageIsPinned#ff14f5f0 business_connection_id:string chat_id:int53 message_id:int53 is_pinned:Bool = Ok; - -//@description Checks validness of a name for a quick reply shortcut. Can be called synchronously -//@name The name of the shortcut; 1-32 characters -checkQuickReplyShortcutName#7d3dd129 name:string = Ok; - -//@description Loads quick reply shortcuts created by the current user. The loaded data will be sent through updateQuickReplyShortcut and updateQuickReplyShortcuts -loadQuickReplyShortcuts#c367b29d = Ok; - -//@description Changes name of a quick reply shortcut -//@shortcut_id Unique identifier of the quick reply shortcut -//@name New name for the shortcut. Use checkQuickReplyShortcutName to check its validness -setQuickReplyShortcutName#b20f471 shortcut_id:int32 name:string = Ok; - -//@description Deletes a quick reply shortcut -//@shortcut_id Unique identifier of the quick reply shortcut -deleteQuickReplyShortcut#f1486c16 shortcut_id:int32 = Ok; - -//@description Changes the order of quick reply shortcuts -//@shortcut_ids The new order of quick reply shortcuts -reorderQuickReplyShortcuts#b04981c4 shortcut_ids:vector = Ok; - -//@description Loads quick reply messages that can be sent by a given quick reply shortcut. The loaded messages will be sent through updateQuickReplyShortcutMessages -//@shortcut_id Unique identifier of the quick reply shortcut -loadQuickReplyShortcutMessages#fd40aed4 shortcut_id:int32 = Ok; - -//@description Deletes specified quick reply messages -//@shortcut_id Unique identifier of the quick reply shortcut to which the messages belong -//@message_ids Unique identifiers of the messages -deleteQuickReplyShortcutMessages#e859fcbb shortcut_id:int32 message_ids:vector = Ok; - -//@description Adds a message to a quick reply shortcut. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. -//@shortcut_name Name of the target shortcut -//@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none -//@input_message_content The content of the message to be added; inputMessagePoll, inputMessageForwarded and inputMessageLocation with live_period aren't supported -addQuickReplyShortcutMessage#3f188b2a shortcut_name:string reply_to_message_id:int53 input_message_content:InputMessageContent = QuickReplyMessage; - -//@description Adds a message to a quick reply shortcut via inline bot. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. -//@shortcut_name Name of the target shortcut -//@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none -//@query_id Identifier of the inline query -//@result_id Identifier of the inline query result -//@hide_via_bot Pass true to hide the bot, via which the message is sent. Can be used only for bots getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), and getOption("venue_search_bot_username") -addQuickReplyShortcutInlineQueryResultMessage#87c02a04 shortcut_name:string reply_to_message_id:int53 query_id:int64 result_id:string hide_via_bot:Bool = QuickReplyMessage; - -//@description Adds 2-10 messages grouped together into an album to a quick reply shortcut. Currently, only audio, document, photo and video messages can be grouped into an album. -//@shortcut_name Name of the target shortcut -//@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none -//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media -addQuickReplyShortcutMessageAlbum#9647a3fd shortcut_name:string reply_to_message_id:int53 input_message_contents:vector = QuickReplyMessages; - -//@description Readds quick reply messages which failed to add. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. -//@shortcut_name Name of the target shortcut -//@message_ids Identifiers of the quick reply messages to readd. Message identifiers must be in a strictly increasing order -readdQuickReplyShortcutMessages#652518f7 shortcut_name:string message_ids:vector = QuickReplyMessages; - -//@description Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. -//@shortcut_id Unique identifier of the quick reply shortcut with the message -//@message_id Identifier of the message -//@input_message_content New content of the message. Must be one of the following types: inputMessageText, inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo -editQuickReplyMessage#4cc978e shortcut_id:int32 message_id:int53 input_message_content:InputMessageContent = Ok; - -//@description Returns the list of custom emoji, which can be used as forum topic icon by all users -getForumTopicDefaultIcons#583574dc = Stickers; - -//@description Creates a topic in a forum supergroup chat; requires can_manage_topics administrator or can_create_topics member right in the supergroup -//@chat_id Identifier of the chat -//@name Name of the topic; 1-128 characters -//@icon Icon of the topic. Icon color must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. Telegram Premium users can use any custom emoji as topic icon, other users can use only a custom emoji returned by getForumTopicDefaultIcons -createForumTopic#c1fa28e4 chat_id:int53 name:string icon:forumTopicIcon = ForumTopicInfo; - -//@description Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic -//@chat_id Identifier of the chat -//@message_thread_id Message thread identifier of the forum topic -//@name New name of the topic; 0-128 characters. If empty, the previous topic name is kept -//@edit_icon_custom_emoji Pass true to edit the icon of the topic. Icon of the General topic can't be edited -//@icon_custom_emoji_id Identifier of the new custom emoji for topic icon; pass 0 to remove the custom emoji. Ignored if edit_icon_custom_emoji is false. Telegram Premium users can use any custom emoji, other users can use only a custom emoji returned by getForumTopicDefaultIcons -editForumTopic#a7769060 chat_id:int53 message_thread_id:int53 name:string edit_icon_custom_emoji:Bool icon_custom_emoji_id:int64 = Ok; - -//@description Returns information about a forum topic -//@chat_id Identifier of the chat -//@message_thread_id Message thread identifier of the forum topic -getForumTopic#e59bfe41 chat_id:int53 message_thread_id:int53 = ForumTopic; - -//@description Returns an HTTPS link to a topic in a forum chat. This is an offline request -//@chat_id Identifier of the chat -//@message_thread_id Message thread identifier of the forum topic -getForumTopicLink#c97b88cb chat_id:int53 message_thread_id:int53 = MessageLink; - -//@description Returns found forum topics in a forum chat. This is a temporary method for getting information about topic list from the server -//@chat_id Identifier of the forum chat -//@query Query to search for in the forum topic's name -//@offset_date The date starting from which the results need to be fetched. Use 0 or any date in the future to get results from the last topic -//@offset_message_id The message identifier of the last message in the last found topic, or 0 for the first request -//@offset_message_thread_id The message thread identifier of the last found topic, or 0 for the first request -//@limit The maximum number of forum topics to be returned; up to 100. For optimal performance, the number of returned forum topics is chosen by TDLib and can be smaller than the specified limit -getForumTopics#fbab7d5a chat_id:int53 query:string offset_date:int32 offset_message_id:int53 offset_message_thread_id:int53 limit:int32 = ForumTopics; - -//@description Changes the notification settings of a forum topic -//@chat_id Chat identifier -//@message_thread_id Message thread identifier of the forum topic -//@notification_settings New notification settings for the forum topic. If the topic is muted for more than 366 days, it is considered to be muted forever -setForumTopicNotificationSettings#1f433467 chat_id:int53 message_thread_id:int53 notification_settings:chatNotificationSettings = Ok; - -//@description Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic -//@chat_id Identifier of the chat -//@message_thread_id Message thread identifier of the forum topic -//@is_closed Pass true to close the topic; pass false to reopen it -toggleForumTopicIsClosed#c7648af3 chat_id:int53 message_thread_id:int53 is_closed:Bool = Ok; - -//@description Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics right in the supergroup -//@chat_id Identifier of the chat -//@is_hidden Pass true to hide and close the General topic; pass false to unhide it -toggleGeneralForumTopicIsHidden#5f1d1448 chat_id:int53 is_hidden:Bool = Ok; - -//@description Changes the pinned state of a forum topic; requires can_manage_topics right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics -//@chat_id Chat identifier -//@message_thread_id Message thread identifier of the forum topic -//@is_pinned Pass true to pin the topic; pass false to unpin it -toggleForumTopicIsPinned#466ceab4 chat_id:int53 message_thread_id:int53 is_pinned:Bool = Ok; - -//@description Changes the order of pinned forum topics; requires can_manage_topics right in the supergroup -//@chat_id Chat identifier -//@message_thread_ids The new list of pinned forum topics -setPinnedForumTopics#ddf26f21 chat_id:int53 message_thread_ids:vector = Ok; - -//@description Deletes all messages in a forum topic; requires can_delete_messages administrator right in the supergroup unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages -//@chat_id Identifier of the chat -//@message_thread_id Message thread identifier of the forum topic -deleteForumTopic#6f285cb8 chat_id:int53 message_thread_id:int53 = Ok; - -//@description Returns information about an emoji reaction. Returns a 404 error if the reaction is not found -//@emoji Text representation of the reaction -getEmojiReaction#e53411dc emoji:string = EmojiReaction; - -//@description Returns TGS stickers with generic animations for custom emoji reactions -getCustomEmojiReactionAnimations#49748dd2 = Stickers; - -//@description Returns reactions, which can be added to a message. The list can change after updateActiveEmojiReactions, updateChatAvailableReactions for the chat, or updateMessageInteractionInfo for the message -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -//@row_size Number of reaction per row, 5-25 -getMessageAvailableReactions#76db86b2 chat_id:int53 message_id:int53 row_size:int32 = AvailableReactions; - -//@description Clears the list of recently used reactions -clearRecentReactions#4d61c752 = Ok; - -//@description Adds a reaction or a tag to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -//@reaction_type Type of the reaction to add. Use addPendingPaidMessageReaction instead to add the paid reaction -//@is_big Pass true if the reaction is added with a big animation -//@update_recent_reactions Pass true if the reaction needs to be added to recent reactions; tags are never added to the list of recent reactions -addMessageReaction#549855ed chat_id:int53 message_id:int53 reaction_type:ReactionType is_big:Bool update_recent_reactions:Bool = Ok; - -//@description Removes a reaction from a message. A chosen reaction can always be removed -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -//@reaction_type Type of the reaction to remove. The paid reaction can't be removed -removeMessageReaction#97474d7b chat_id:int53 message_id:int53 reaction_type:ReactionType = Ok; - -//@description Adds the paid message reaction to a message. Use getMessageAvailableReactions to check whether the reaction is available for the message -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -//@star_count Number of Telegram Stars to be used for the reaction. The total number of pending paid reactions must not exceed getOption("paid_reaction_star_count_max") -//@use_default_is_anonymous Pass true if the user didn't choose anonymity explicitly, for example, the reaction is set from the message bubble -//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors. Ignored if use_default_is_anonymous == true -addPendingPaidMessageReaction#66548919 chat_id:int53 message_id:int53 star_count:int53 use_default_is_anonymous:Bool is_anonymous:Bool = Ok; - -//@description Applies all pending paid reactions on a message -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -commitPendingPaidMessageReactions#f5c95606 chat_id:int53 message_id:int53 = Ok; - -//@description Removes all pending paid reactions on a message -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -removePendingPaidMessageReactions#41949cfb chat_id:int53 message_id:int53 = Ok; - -//@description Changes whether the paid message reaction of the user to a message is anonymous. The message must have paid reaction added by the user -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -//@is_anonymous Pass true to make paid reaction of the user on the message anonymous; pass false to make the user's profile visible among top reactors -togglePaidMessageReactionIsAnonymous#9774db11 chat_id:int53 message_id:int53 is_anonymous:Bool = Ok; - -//@description Sets reactions on a message; for bots only -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message -//@reaction_types Types of the reaction to set; pass an empty list to remove the reactions -//@is_big Pass true if the reactions are added with a big animation -setMessageReactions#71fa9e8f chat_id:int53 message_id:int53 reaction_types:vector is_big:Bool = Ok; - -//@description Returns reactions added for a message, along with their sender -//@chat_id Identifier of the chat to which the message belongs -//@message_id Identifier of the message. Use message.interaction_info.reactions.can_get_added_reactions to check whether added reactions can be received for the message -//@reaction_type Type of the reactions to return; pass null to return all added reactions; reactionTypePaid isn't supported -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of reactions to be returned; must be positive and can't be greater than 100 -getMessageAddedReactions#7dc6ae52 chat_id:int53 message_id:int53 reaction_type:ReactionType offset:string limit:int32 = AddedReactions; - -//@description Changes type of default reaction for the current user -//@reaction_type New type of the default reaction. The paid reaction can't be set as default -setDefaultReactionType#65038a3d reaction_type:ReactionType = Ok; - -//@description Returns tags used in Saved Messages or a Saved Messages topic -//@saved_messages_topic_id Identifier of Saved Messages topic which tags will be returned; pass 0 to get all Saved Messages tags -getSavedMessagesTags#8cd667a9 saved_messages_topic_id:int53 = SavedMessagesTags; - -//@description Changes label of a Saved Messages tag; for Telegram Premium users only -//@tag The tag which label will be changed -//@label New label for the tag; 0-12 characters -setSavedMessagesTagLabel#b03acd10 tag:ReactionType label:string = Ok; - -//@description Returns information about a message effect. Returns a 404 error if the effect is not found -//@effect_id Unique identifier of the effect -getMessageEffect#9e513d14 effect_id:int64 = MessageEffect; - -//@description Searches for a given quote in a text. Returns found quote start position in UTF-16 code units. Returns a 404 error if the quote is not found. Can be called synchronously -//@text Text in which to search for the quote -//@quote Quote to search for -//@quote_position Approximate quote position in UTF-16 code units -searchQuote#6864011f text:formattedText quote:formattedText quote_position:int32 = FoundPosition; - -//@description Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) found in the text. Can be called synchronously -//@text The text in which to look for entities -getTextEntities#eba543fb text:string = TextEntities; - -//@description Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, ExpandableBlockQuote, Code, Pre, PreCode, TextUrl -//@text The text to parse -//@parse_mode Text parse mode -parseTextEntities#9a1fc29f text:string parse_mode:TextParseMode = FormattedText; - -//@description Parses Markdown entities in a human-friendly format, ignoring markup errors. Can be called synchronously -//@text The text to parse. For example, "__italic__ ~~strikethrough~~ ||spoiler|| **bold** `code` ```pre``` __[italic__ text_url](telegram.org) __italic**bold italic__bold**" -parseMarkdown#2d153aef text:formattedText = FormattedText; - -//@description Replaces text entities with Markdown formatting in a human-friendly format. Entities that can't be represented in Markdown unambiguously are kept as is. Can be called synchronously -//@text The text -getMarkdownText#9ce7228 text:formattedText = FormattedText; - -//@description Returns an emoji for the given country. Returns an empty string on failure. Can be called synchronously -//@country_code A two-letter ISO 3166-1 alpha-2 country code as received from getCountries -getCountryFlagEmoji#3a8629fa country_code:string = Text; - -//@description Returns the MIME type of a file, guessed by its extension. Returns an empty string on failure. Can be called synchronously -//@file_name The name of the file or path to the file -getFileMimeType#84631b89 file_name:string = Text; - -//@description Returns the extension of a file, guessed by its MIME type. Returns an empty string on failure. Can be called synchronously -//@mime_type The MIME type of the file -getFileExtension#f9adb934 mime_type:string = Text; - -//@description Removes potentially dangerous characters from the name of a file. Returns an empty string on failure. Can be called synchronously -//@file_name File name or path to the file -cleanFileName#39b1f7fb file_name:string = Text; - -//@description Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. Can be called synchronously -//@language_pack_database_path Path to the language pack database in which strings are stored -//@localization_target Localization target to which the language pack belongs -//@language_pack_id Language pack identifier -//@key Language pack key of the string to be returned -getLanguagePackString#8fcde73 language_pack_database_path:string localization_target:string language_pack_id:string key:string = LanguagePackStringValue; - -//@description Converts a JSON-serialized string to corresponding JsonValue object. Can be called synchronously -//@json The JSON-serialized string -getJsonValue#92fa5a05 json:string = JsonValue; - -//@description Converts a JsonValue object to corresponding JSON-serialized string. Can be called synchronously -//@json_value The JsonValue object -getJsonString#278b9421 json_value:JsonValue = Text; - -//@description Converts a themeParameters object to corresponding JSON-serialized string. Can be called synchronously -//@theme Theme parameters to convert to JSON -getThemeParametersJsonString#91b905f8 theme:themeParameters = Text; - -//@description Changes the user answer to a poll. A poll in quiz mode can be answered only once -//@chat_id Identifier of the chat to which the poll belongs -//@message_id Identifier of the message containing the poll -//@option_ids 0-based identifiers of answer options, chosen by the user. User can choose more than 1 answer option only is the poll allows multiple answers -setPollAnswer#5303b916 chat_id:int53 message_id:int53 option_ids:vector = Ok; - -//@description Returns message senders voted for the specified option in a non-anonymous polls. For optimal performance, the number of returned users is chosen by TDLib -//@chat_id Identifier of the chat to which the poll belongs -//@message_id Identifier of the message containing the poll -//@option_id 0-based identifier of the answer option -//@offset Number of voters to skip in the result; must be non-negative -//@limit The maximum number of voters to be returned; must be positive and can't be greater than 50. For optimal performance, the number of returned voters is chosen by TDLib and can be smaller than the specified limit, even if the end of the voter list has not been reached -getPollVoters#c45ba9ac chat_id:int53 message_id:int53 option_id:int32 offset:int32 limit:int32 = MessageSenders; - -//@description Stops a poll -//@chat_id Identifier of the chat to which the poll belongs -//@message_id Identifier of the message containing the poll. Use messageProperties.can_be_edited to check whether the poll can be stopped -//@reply_markup The new message reply markup; pass null if none; for bots only -stopPoll#62e80aad chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok; - -//@description Hides a suggested action -//@action Suggested action to hide -hideSuggestedAction#a2ef2b7f action:SuggestedAction = Ok; - -//@description Hides the list of contacts that have close birthdays for 24 hours -hideContactCloseBirthdays#baad087b = Ok; - -//@description Returns information about a business connection by its identifier; for bots only -//@connection_id Identifier of the business connection to return -getBusinessConnection#81f42420 connection_id:string = BusinessConnection; - -//@description Returns information about a button of type inlineKeyboardButtonTypeLoginUrl. The method needs to be called when the user presses the button -//@chat_id Chat identifier of the message with the button -//@message_id Message identifier of the message with the button. The message must not be scheduled -//@button_id Button identifier -getLoginUrlInfo#ccc99db3 chat_id:int53 message_id:int53 button_id:int53 = LoginUrlInfo; - -//@description Returns an HTTP URL which can be used to automatically authorize the user on a website after clicking an inline button of type inlineKeyboardButtonTypeLoginUrl. -//@chat_id Chat identifier of the message with the button -//@message_id Message identifier of the message with the button -//@button_id Button identifier -//@allow_write_access Pass true to allow the bot to send messages to the current user -getLoginUrl#2f3295d1 chat_id:int53 message_id:int53 button_id:int53 allow_write_access:Bool = HttpUrl; - -//@description Shares users after pressing a keyboardButtonTypeRequestUsers button with the bot -//@chat_id Identifier of the chat with the bot -//@message_id Identifier of the message with the button -//@button_id Identifier of the button -//@shared_user_ids Identifiers of the shared users -//@only_check Pass true to check that the users can be shared by the button instead of actually sharing them -shareUsersWithBot#58448550 chat_id:int53 message_id:int53 button_id:int32 shared_user_ids:vector only_check:Bool = Ok; - -//@description Shares a chat after pressing a keyboardButtonTypeRequestChat button with the bot -//@chat_id Identifier of the chat with the bot -//@message_id Identifier of the message with the button -//@button_id Identifier of the button -//@shared_chat_id Identifier of the shared chat -//@only_check Pass true to check that the chat can be shared by the button instead of actually sharing it. Doesn't check bot_is_member and bot_administrator_rights restrictions. -shareChatWithBot#a6530ae2 chat_id:int53 message_id:int53 button_id:int32 shared_chat_id:int53 only_check:Bool = Ok; - -//@description Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires -//@bot_user_id Identifier of the target bot -//@chat_id Identifier of the chat where the query was sent -//@user_location Location of the user; pass null if unknown or the bot doesn't need user's location -//@query Text of the query -//@offset Offset of the first entry to return; use empty string to get the first chunk of results -getInlineQueryResults#79dcf86c bot_user_id:int53 chat_id:int53 user_location:location query:string offset:string = InlineQueryResults; - -//@description Sets the result of an inline query; for bots only -//@inline_query_id Identifier of the inline query -//@is_personal Pass true if results may be cached and returned only for the user that sent the query. By default, results may be returned to any user who sends the same query -//@button Button to be shown above inline query results; pass null if none -//@results The results of the query -//@cache_time Allowed time to cache the results of the query, in seconds -//@next_offset Offset for the next inline query; pass an empty string if there are no more results -answerInlineQuery#ac7cc5e6 inline_query_id:int64 is_personal:Bool button:inlineQueryResultsButton results:vector cache_time:int32 next_offset:string = Ok; - -//@description Saves an inline message to be sent by the given user; for bots only -//@user_id Identifier of the user -//@result The description of the message -//@chat_types Types of the chats to which the message can be sent -savePreparedInlineMessage#c71468d9 user_id:int53 result:InputInlineQueryResult chat_types:targetChatTypes = PreparedInlineMessageId; - -//@description Saves an inline message to be sent by the given user -//@bot_user_id Identifier of the bot that created the message -//@prepared_message_id Identifier of the prepared message -getPreparedInlineMessage#fb0ac74b bot_user_id:int53 prepared_message_id:string = PreparedInlineMessage; - -//@description Returns the most grossing Web App bots -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of bots to be returned; up to 100 -getGrossingWebAppBots#6522ce1a offset:string limit:int32 = FoundUsers; - -//@description Returns information about a Web App by its short name. Returns a 404 error if the Web App is not found -//@bot_user_id Identifier of the target bot -//@web_app_short_name Short name of the Web App -searchWebApp#b5fc8a35 bot_user_id:int53 web_app_short_name:string = FoundWebApp; - -//@description Returns a default placeholder for Web Apps of a bot; this is an offline request. Returns a 404 error if the placeholder isn't known -//@bot_user_id Identifier of the target bot -getWebAppPlaceholder#22c70d8f bot_user_id:int53 = Outline; - -//@description Returns an HTTPS URL of a Web App to open after a link of the type internalLinkTypeWebApp is clicked -//@chat_id Identifier of the chat in which the link was clicked; pass 0 if none -//@bot_user_id Identifier of the target bot -//@web_app_short_name Short name of the Web App -//@start_parameter Start parameter from internalLinkTypeWebApp -//@allow_write_access Pass true if the current user allowed the bot to send them messages -//@parameters Parameters to use to open the Web App -getWebAppLinkUrl#60fe62c1 chat_id:int53 bot_user_id:int53 web_app_short_name:string start_parameter:string allow_write_access:Bool parameters:webAppOpenParameters = HttpUrl; - -//@description Returns information needed to open the main Web App of a bot -//@chat_id Identifier of the chat in which the Web App is opened; pass 0 if none -//@bot_user_id Identifier of the target bot -//@start_parameter Start parameter from internalLinkTypeMainWebApp -//@parameters Parameters to use to open the Web App -getMainWebApp#23687ca6 chat_id:int53 bot_user_id:int53 start_parameter:string parameters:webAppOpenParameters = MainWebApp; - -//@description Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, or an inlineQueryResultsButtonTypeWebApp button -//@bot_user_id Identifier of the target bot -//@url The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu -//@parameters Parameters to use to open the Web App -getWebAppUrl#a4ff1f44 bot_user_id:int53 url:string parameters:webAppOpenParameters = HttpUrl; - -//@description Sends data received from a keyboardButtonTypeWebApp Web App to a bot -//@bot_user_id Identifier of the target bot -//@button_text Text of the keyboardButtonTypeWebApp button, which opened the Web App -//@data The data -sendWebAppData#ab1fce0c bot_user_id:int53 button_text:string data:string = Ok; - -//@description Informs TDLib that a Web App is being opened from the attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. -//@chat_id Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats -//@bot_user_id Identifier of the bot, providing the Web App -//@url The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise -//@message_thread_id If not 0, the message thread identifier in which the message will be sent -//@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none -//@parameters Parameters to use to open the Web App -openWebApp#278173a2 chat_id:int53 bot_user_id:int53 url:string message_thread_id:int53 reply_to:InputMessageReplyTo parameters:webAppOpenParameters = WebAppInfo; - -//@description Informs TDLib that a previously opened Web App was closed -//@web_app_launch_id Identifier of Web App launch, received from openWebApp -closeWebApp#68a124c6 web_app_launch_id:int64 = Ok; - -//@description Sets the result of interaction with a Web App and sends corresponding message on behalf of the user to the chat from which the query originated; for bots only -//@web_app_query_id Identifier of the Web App query -//@result The result of the query -answerWebAppQuery#a0b49cf1 web_app_query_id:string result:InputInlineQueryResult = SentWebAppMessage; - -//@description Checks whether a file can be downloaded and saved locally by Web App request -//@bot_user_id Identifier of the bot, providing the Web App -//@file_name Name of the file -//@url URL of the file -checkWebAppFileDownload#e8ca44e2 bot_user_id:int53 file_name:string url:string = Ok; - -//@description Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires -//@chat_id Identifier of the chat with the message -//@message_id Identifier of the message from which the query originated. The message must not be scheduled -//@payload Query payload -getCallbackQueryAnswer#6ef7a5f chat_id:int53 message_id:int53 payload:CallbackQueryPayload = CallbackQueryAnswer; - -//@description Sets the result of a callback query; for bots only -//@callback_query_id Identifier of the callback query -//@text Text of the answer -//@show_alert Pass true to show an alert to the user instead of a toast notification -//@url URL to be opened -//@cache_time Time during which the result of the query can be cached, in seconds -answerCallbackQuery#bb462e76 callback_query_id:int64 text:string show_alert:Bool url:string cache_time:int32 = Ok; - -//@description Sets the result of a shipping query; for bots only -//@shipping_query_id Identifier of the shipping query -//@shipping_options Available shipping options -//@error_message An error message, empty on success -answerShippingQuery#7a3c2432 shipping_query_id:int64 shipping_options:vector error_message:string = Ok; - -//@description Sets the result of a pre-checkout query; for bots only -//@pre_checkout_query_id Identifier of the pre-checkout query -//@error_message An error message, empty on success -answerPreCheckoutQuery#a76163eb pre_checkout_query_id:int64 error_message:string = Ok; - -//@description Updates the game score of the specified user in the game; for bots only -//@chat_id The chat to which the message with the game belongs -//@message_id Identifier of the message -//@edit_message Pass true to edit the game message to include the current scoreboard -//@user_id User identifier -//@score The new score -//@force Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table -setGameScore#7eccedc6 chat_id:int53 message_id:int53 edit_message:Bool user_id:int53 score:int32 force:Bool = Message; - -//@description Updates the game score of the specified user in a game; for bots only -//@inline_message_id Inline message identifier -//@edit_message Pass true to edit the game message to include the current scoreboard -//@user_id User identifier -//@score The new score -//@force Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table -setInlineGameScore#c7715d8b inline_message_id:string edit_message:Bool user_id:int53 score:int32 force:Bool = Ok; - -//@description Returns the high scores for a game and some part of the high score table in the range of the specified user; for bots only -//@chat_id The chat that contains the message with the game -//@message_id Identifier of the message -//@user_id User identifier -getGameHighScores#f0459b chat_id:int53 message_id:int53 user_id:int53 = GameHighScores; - -//@description Returns game high scores and some part of the high score table in the range of the specified user; for bots only -//@inline_message_id Inline message identifier -//@user_id User identifier -getInlineGameHighScores#e0396baa inline_message_id:string user_id:int53 = GameHighScores; - -//@description Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a replyMarkupForceReply reply markup has been used. An updateChatReplyMarkup update will be sent if the reply markup is changed -//@chat_id Chat identifier -//@message_id The message identifier of the used keyboard -deleteChatReplyMarkup#5ff9b5b chat_id:int53 message_id:int53 = Ok; - -//@description Sends a notification about user activity in a chat -//@chat_id Chat identifier -//@message_thread_id If not 0, the message thread identifier in which the action was performed -//@business_connection_id Unique identifier of business connection on behalf of which to send the request; for bots only -//@action The action description; pass null to cancel the currently active action -sendChatAction#8823f29e chat_id:int53 message_thread_id:int53 business_connection_id:string action:ChatAction = Ok; - -//@description Informs TDLib that the chat is opened by the user. Many useful activities depend on the chat being opened or closed (e.g., in supergroups and channels all updates are received only for opened chats) -//@chat_id Chat identifier -openChat#ecb9be0b chat_id:int53 = Ok; - -//@description Informs TDLib that the chat is closed by the user. Many useful activities depend on the chat being opened or closed -//@chat_id Chat identifier -closeChat#25e86e9 chat_id:int53 = Ok; - -//@description Informs TDLib that messages are being viewed by the user. Sponsored messages must be marked as viewed only when the entire text of the message is shown on the screen (excluding the button). -//@chat_id Chat identifier -//@message_ids The identifiers of the messages being viewed -//@source Source of the message view; pass null to guess the source based on chat open state -//@force_read Pass true to mark as read the specified messages even the chat is closed -viewMessages#aa2f0438 chat_id:int53 message_ids:vector source:MessageSource force_read:Bool = Ok; - -//@description Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). -//@chat_id Chat identifier of the message -//@message_id Identifier of the message with the opened content -openMessageContent#d3f2697b chat_id:int53 message_id:int53 = Ok; - -//@description Informs TDLib that a message with an animated emoji was clicked by the user. Returns a big animated sticker to be played or a 404 error if usual animation needs to be played -//@chat_id Chat identifier of the message -//@message_id Identifier of the clicked message -clickAnimatedEmojiMessage#bb17662 chat_id:int53 message_id:int53 = Sticker; - -//@description Returns an HTTPS or a tg: link with the given type. Can be called before authorization -//@type Expected type of the link -//@is_http Pass true to create an HTTPS link (only available for some link types); pass false to create a tg: link -getInternalLink#3960f1b0 type:InternalLinkType is_http:Bool = HttpUrl; - -//@description Returns information about the type of internal link. Returns a 404 error if the link is not internal. Can be called before authorization -//@link The link -getInternalLinkType#8bdd5709 link:string = InternalLinkType; - -//@description Returns information about an action to be done when the current user clicks an external link. Don't use this method for links from secret chats if link preview is disabled in secret chats -//@link The link -getExternalLinkInfo#460d7a3f link:string = LoginUrlInfo; - -//@description Returns an HTTP URL which can be used to automatically authorize the current user on a website after clicking an HTTP link. Use the method getExternalLinkInfo to find whether a prior user confirmation is needed -//@link The HTTP link -//@allow_write_access Pass true if the current user allowed the bot, returned in getExternalLinkInfo, to send them messages -getExternalLink#5e92f0eb link:string allow_write_access:Bool = HttpUrl; - -//@description Marks all mentions in a chat as read -//@chat_id Chat identifier -readAllChatMentions#50eab2b5 chat_id:int53 = Ok; - -//@description Marks all mentions in a forum topic as read -//@chat_id Chat identifier -//@message_thread_id Message thread identifier in which mentions are marked as read -readAllMessageThreadMentions#4edd7555 chat_id:int53 message_thread_id:int53 = Ok; - -//@description Marks all reactions in a chat or a forum topic as read -//@chat_id Chat identifier -readAllChatReactions#54c1976d chat_id:int53 = Ok; - -//@description Marks all reactions in a forum topic as read -//@chat_id Chat identifier -//@message_thread_id Message thread identifier in which reactions are marked as read -readAllMessageThreadReactions#d0bc273e chat_id:int53 message_thread_id:int53 = Ok; - -//@description Returns an existing chat corresponding to a given user -//@user_id User identifier -//@force Pass true to create the chat without a network request. In this case all information about the chat except its type, title and photo can be incorrect -createPrivateChat#c7825b09 user_id:int53 force:Bool = Chat; - -//@description Returns an existing chat corresponding to a known basic group -//@basic_group_id Basic group identifier -//@force Pass true to create the chat without a network request. In this case all information about the chat except its type, title and photo can be incorrect -createBasicGroupChat#758ab4e4 basic_group_id:int53 force:Bool = Chat; - -//@description Returns an existing chat corresponding to a known supergroup or channel -//@supergroup_id Supergroup or channel identifier -//@force Pass true to create the chat without a network request. In this case all information about the chat except its type, title and photo can be incorrect -createSupergroupChat#46c770eb supergroup_id:int53 force:Bool = Chat; - -//@description Returns an existing chat corresponding to a known secret chat -//@secret_chat_id Secret chat identifier -createSecretChat#730dd22f secret_chat_id:int32 = Chat; - -//@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns information about the newly created chat -//@user_ids Identifiers of users to be added to the basic group; may be empty to create a basic group without other members -//@title Title of the new basic group; 1-128 characters -//@message_auto_delete_time Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically -createNewBasicGroupChat#8b9517af user_ids:vector title:string message_auto_delete_time:int32 = CreatedBasicGroupChat; - -//@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat -//@title Title of the new chat; 1-128 characters -//@is_forum Pass true to create a forum supergroup chat -//@is_channel Pass true to create a channel chat; ignored if a forum is created -//@param_description Chat description; 0-255 characters -//@location Chat location if a location-based supergroup is being created; pass null to create an ordinary supergroup chat -//@message_auto_delete_time Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically -//@for_import Pass true to create a supergroup for importing messages using importMessages -createNewSupergroupChat#2fecf6c6 title:string is_forum:Bool is_channel:Bool description:string location:chatLocation message_auto_delete_time:int32 for_import:Bool = Chat; - -//@description Creates a new secret chat. Returns the newly created chat -//@user_id Identifier of the target user -createNewSecretChat#db012265 user_id:int53 = Chat; - -//@description Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires owner privileges. Deactivates the original basic group -//@chat_id Identifier of the chat to upgrade -upgradeBasicGroupChatToSupergroupChat#11e915ba chat_id:int53 = Chat; - -//@description Returns chat lists to which the chat can be added. This is an offline request -//@chat_id Chat identifier -getChatListsToAddChat#2709d6a1 chat_id:int53 = ChatLists; - -//@description Adds a chat to a chat list. A chat can't be simultaneously in Main and Archive chat lists, so it is automatically removed from another one if needed -//@chat_id Chat identifier -//@chat_list The chat list. Use getChatListsToAddChat to get suitable chat lists -addChatToList#fb334eb5 chat_id:int53 chat_list:ChatList = Ok; - -//@description Returns information about a chat folder by its identifier -//@chat_folder_id Chat folder identifier -getChatFolder#5882a98 chat_folder_id:int32 = ChatFolder; - -//@description Creates new chat folder. Returns information about the created chat folder. There can be up to getOption("chat_folder_count_max") chat folders, but the limit can be increased with Telegram Premium -//@folder The new chat folder -createChatFolder#3c85c500 folder:chatFolder = ChatFolderInfo; - -//@description Edits existing chat folder. Returns information about the edited chat folder -//@chat_folder_id Chat folder identifier -//@folder The edited chat folder -editChatFolder#332fb32 chat_folder_id:int32 folder:chatFolder = ChatFolderInfo; - -//@description Deletes existing chat folder -//@chat_folder_id Chat folder identifier -//@leave_chat_ids Identifiers of the chats to leave. The chats must be pinned or always included in the folder -deleteChatFolder#74260b87 chat_folder_id:int32 leave_chat_ids:vector = Ok; - -//@description Returns identifiers of pinned or always included chats from a chat folder, which are suggested to be left when the chat folder is deleted -//@chat_folder_id Chat folder identifier -getChatFolderChatsToLeave#8dc1e6af chat_folder_id:int32 = Chats; - -//@description Returns approximate number of chats in a being created chat folder. Main and archive chat lists must be fully preloaded for this function to work correctly -//@folder The new chat folder -getChatFolderChatCount#7dd4cbbe folder:chatFolder = Count; - -//@description Changes the order of chat folders -//@chat_folder_ids Identifiers of chat folders in the new correct order -//@main_chat_list_position Position of the main chat list among chat folders, 0-based. Can be non-zero only for Premium users -reorderChatFolders#59544c32 chat_folder_ids:vector main_chat_list_position:int32 = Ok; - -//@description Toggles whether chat folder tags are enabled -//@are_tags_enabled Pass true to enable folder tags; pass false to disable them -toggleChatFolderTags#834b6c44 are_tags_enabled:Bool = Ok; - -//@description Returns recommended chat folders for the current user -getRecommendedChatFolders#f7533b87 = RecommendedChatFolders; - -//@description Returns default icon name for a folder. Can be called synchronously -//@folder Chat folder -getChatFolderDefaultIconName#2cf7a067 folder:chatFolder = ChatFolderIcon; - -//@description Returns identifiers of chats from a chat folder, suitable for adding to a chat folder invite link -//@chat_folder_id Chat folder identifier -getChatsForChatFolderInviteLink#6fac4949 chat_folder_id:int32 = Chats; - -//@description Creates a new invite link for a chat folder. A link can be created for a chat folder if it has only pinned and included chats -//@chat_folder_id Chat folder identifier -//@name Name of the link; 0-32 characters -//@chat_ids Identifiers of chats to be accessible by the invite link. Use getChatsForChatFolderInviteLink to get suitable chats. Basic groups will be automatically converted to supergroups before link creation -createChatFolderInviteLink#fba5e198 chat_folder_id:int32 name:string chat_ids:vector = ChatFolderInviteLink; - -//@description Returns invite links created by the current user for a shareable chat folder -//@chat_folder_id Chat folder identifier -getChatFolderInviteLinks#139d5be0 chat_folder_id:int32 = ChatFolderInviteLinks; - -//@description Edits an invite link for a chat folder -//@chat_folder_id Chat folder identifier -//@invite_link Invite link to be edited -//@name New name of the link; 0-32 characters -//@chat_ids New identifiers of chats to be accessible by the invite link. Use getChatsForChatFolderInviteLink to get suitable chats. Basic groups will be automatically converted to supergroups before link editing -editChatFolderInviteLink#5cc415a8 chat_folder_id:int32 invite_link:string name:string chat_ids:vector = ChatFolderInviteLink; - -//@description Deletes an invite link for a chat folder -//@chat_folder_id Chat folder identifier -//@invite_link Invite link to be deleted -deleteChatFolderInviteLink#c890717e chat_folder_id:int32 invite_link:string = Ok; - -//@description Checks the validity of an invite link for a chat folder and returns information about the corresponding chat folder -//@invite_link Invite link to be checked -checkChatFolderInviteLink#1f25999b invite_link:string = ChatFolderInviteLinkInfo; - -//@description Adds a chat folder by an invite link -//@invite_link Invite link for the chat folder -//@chat_ids Identifiers of the chats added to the chat folder. The chats are automatically joined if they aren't joined yet -addChatFolderByInviteLink#1ed19dae invite_link:string chat_ids:vector = Ok; - -//@description Returns new chats added to a shareable chat folder by its owner. The method must be called at most once in getOption("chat_folder_new_chats_update_period") for the given chat folder -//@chat_folder_id Chat folder identifier -getChatFolderNewChats#7e8d2ccc chat_folder_id:int32 = Chats; - -//@description Process new chats added to a shareable chat folder by its owner -//@chat_folder_id Chat folder identifier -//@added_chat_ids Identifiers of the new chats, which are added to the chat folder. The chats are automatically joined if they aren't joined yet -processChatFolderNewChats#109f8a8b chat_folder_id:int32 added_chat_ids:vector = Ok; - -//@description Returns settings for automatic moving of chats to and from the Archive chat lists -getArchiveChatListSettings#838d8e60 = ArchiveChatListSettings; - -//@description Changes settings for automatic moving of chats to and from the Archive chat lists -//@settings New settings -setArchiveChatListSettings#cb454c0a settings:archiveChatListSettings = Ok; - -//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info member right -//@chat_id Chat identifier -//@title New title of the chat; 1-128 characters -setChatTitle#9cabebf chat_id:int53 title:string = Ok; - -//@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info member right -//@chat_id Chat identifier -//@photo New chat photo; pass null to delete the chat photo -setChatPhoto#e97b8d03 chat_id:int53 photo:InputChatPhoto = Ok; - -//@description Changes accent color and background custom emoji of a channel chat. Requires can_change_info administrator right -//@chat_id Chat identifier -//@accent_color_id Identifier of the accent color to use. The chat must have at least accentColor.min_channel_chat_boost_level boost level to pass the corresponding color -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. Use chatBoostLevelFeatures.can_set_background_custom_emoji to check whether a custom emoji can be set -setChatAccentColor#349f57ca chat_id:int53 accent_color_id:int32 background_custom_emoji_id:int64 = Ok; - -//@description Changes accent color and background custom emoji for profile of a supergroup or channel chat. Requires can_change_info administrator right -//@chat_id Chat identifier -//@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_supergroup_chat_boost_level for supergroups -//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check whether a custom emoji can be set -setChatProfileAccentColor#4227ae7a chat_id:int53 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Ok; - -//@description Changes the message auto-delete or self-destruct (for secret chats) time in a chat. Requires change_info administrator right in basic groups, supergroups and channels. -//@chat_id Chat identifier -//@message_auto_delete_time New time value, in seconds; unless the chat is secret, it must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically -setChatMessageAutoDeleteTime#a641b4ff chat_id:int53 message_auto_delete_time:int32 = Ok; - -//@description Changes the emoji status of a chat. Use chatBoostLevelFeatures.can_set_emoji_status to check whether an emoji status can be set. Requires can_change_info administrator right -//@chat_id Chat identifier -//@emoji_status New emoji status; pass null to remove emoji status -setChatEmojiStatus#55881912 chat_id:int53 emoji_status:emojiStatus = Ok; - -//@description Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right -//@chat_id Chat identifier -//@permissions New non-administrator members permissions in the chat -setChatPermissions#7f7706fe chat_id:int53 permissions:chatPermissions = Ok; - -//@description Sets the background in a specific chat. Supported only in private and secret chats with non-deleted users, and in chats with sufficient boost level and can_change_info administrator right -//@chat_id Chat identifier -//@background The input background to use; pass null to create a new filled or chat theme background -//@type Background type; pass null to use default background type for the chosen background; backgroundTypeChatTheme isn't supported for private and secret chats. -//@dark_theme_dimming Dimming of the background in dark themes, as a percentage; 0-100. Applied only to Wallpaper and Fill types of background -//@only_for_self Pass true to set background only for self; pass false to set background for all chat users. Always false for backgrounds set in boosted chats. Background can be set for both users only by Telegram Premium users and if set background isn't of the type inputBackgroundPrevious -setChatBackground#eb4c3fe chat_id:int53 background:InputBackground type:BackgroundType dark_theme_dimming:int32 only_for_self:Bool = Ok; - -//@description Deletes background in a specific chat -//@chat_id Chat identifier -//@restore_previous Pass true to restore previously set background. Can be used only in private and secret chats with non-deleted users if userFullInfo.set_chat_background == true. -deleteChatBackground#1316e678 chat_id:int53 restore_previous:Bool = Ok; - -//@description Changes the chat theme. Supported only in private and secret chats -//@chat_id Chat identifier -//@theme_name Name of the new chat theme; pass an empty string to return the default theme -setChatTheme#8f090293 chat_id:int53 theme_name:string = Ok; - -//@description Changes the draft message in a chat -//@chat_id Chat identifier -//@message_thread_id If not 0, the message thread identifier in which the draft was changed -//@draft_message New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored -setChatDraftMessage#645e1f1a chat_id:int53 message_thread_id:int53 draft_message:draftMessage = Ok; - -//@description Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can't be changed -//@chat_id Chat identifier -//@notification_settings New notification settings for the chat. If the chat is muted for more than 366 days, it is considered to be muted forever -setChatNotificationSettings#2e531ffe chat_id:int53 notification_settings:chatNotificationSettings = Ok; - -//@description Changes the ability of users to save, forward, or copy chat content. Supported only for basic groups, supergroups and channels. Requires owner privileges -//@chat_id Chat identifier -//@has_protected_content New value of has_protected_content -toggleChatHasProtectedContent#3a20d94d chat_id:int53 has_protected_content:Bool = Ok; - -//@description Changes the view_as_topics setting of a forum chat or Saved Messages -//@chat_id Chat identifier -//@view_as_topics New value of view_as_topics -toggleChatViewAsTopics#2b2783dc chat_id:int53 view_as_topics:Bool = Ok; - -//@description Changes the translatable state of a chat -//@chat_id Chat identifier -//@is_translatable New value of is_translatable -toggleChatIsTranslatable#93f9cbdf chat_id:int53 is_translatable:Bool = Ok; - -//@description Changes the marked as unread state of a chat -//@chat_id Chat identifier -//@is_marked_as_unread New value of is_marked_as_unread -toggleChatIsMarkedAsUnread#c538dadf chat_id:int53 is_marked_as_unread:Bool = Ok; - -//@description Changes the value of the default disable_notification parameter, used when a message is sent to a chat -//@chat_id Chat identifier -//@default_disable_notification New value of default_disable_notification -toggleChatDefaultDisableNotification#12c36012 chat_id:int53 default_disable_notification:Bool = Ok; - -//@description Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info member right -//@chat_id Identifier of the chat -//@available_reactions Reactions available in the chat. All explicitly specified emoji reactions must be active. In channel chats up to the chat's boost level custom emoji reactions can be explicitly specified -setChatAvailableReactions#feb3e06 chat_id:int53 available_reactions:ChatAvailableReactions = Ok; - -//@description Changes application-specific data associated with a chat -//@chat_id Chat identifier -//@client_data New value of client_data -setChatClientData#ceb3273d chat_id:int53 client_data:string = Ok; - -//@description Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info member right -//@chat_id Identifier of the chat -//@param_description New chat description; 0-255 characters -setChatDescription#74a8b45d chat_id:int53 description:string = Ok; - -//@description Changes the discussion group of a channel chat; requires can_change_info administrator right in the channel if it is specified -//@chat_id Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages member right in the supergroup) -//@discussion_chat_id Identifier of a new channel's discussion group. Use 0 to remove the discussion group. Use the method getSuitableDiscussionChats to find all suitable groups. -setChatDiscussionGroup#c93c32b8 chat_id:int53 discussion_chat_id:int53 = Ok; - -//@description Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use -//@chat_id Chat identifier -//@location New location for the chat; must be valid and not null -setChatLocation#d2471daa chat_id:int53 location:chatLocation = Ok; - -//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members right -//@chat_id Chat identifier -//@slow_mode_delay New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 -setChatSlowModeDelay#dfcae63e chat_id:int53 slow_mode_delay:int32 = Ok; - -//@description Pins a message in a chat. A message can be pinned only if messageProperties.can_be_pinned -//@chat_id Identifier of the chat -//@message_id Identifier of the new pinned message -//@disable_notification Pass true to disable notification about the pinned message. Notifications are always disabled in channels and private chats -//@only_for_self Pass true to pin the message only for self; private chats only -pinChatMessage#79475baf chat_id:int53 message_id:int53 disable_notification:Bool only_for_self:Bool = Ok; - -//@description Removes a pinned message from a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel -//@chat_id Identifier of the chat -//@message_id Identifier of the removed pinned message -unpinChatMessage#7b1c3ede chat_id:int53 message_id:int53 = Ok; - -//@description Removes all pinned messages from a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel -//@chat_id Identifier of the chat -unpinAllChatMessages#aa4cd4b7 chat_id:int53 = Ok; - -//@description Removes all pinned messages from a forum topic; requires can_pin_messages member right in the supergroup -//@chat_id Identifier of the chat -//@message_thread_id Message thread identifier in which messages will be unpinned -unpinAllMessageThreadMessages#b7c69f00 chat_id:int53 message_thread_id:int53 = Ok; - -//@description Adds the current user as a new member to a chat. Private and secret chats can't be joined using this method. May return an error with a message "INVITE_REQUEST_SENT" if only a join request was created -//@chat_id Chat identifier -joinChat#137a1aa1 chat_id:int53 = Ok; - -//@description Removes the current user from chat members. Private and secret chats can't be left using this method -//@chat_id Chat identifier -leaveChat#93377a61 chat_id:int53 = Ok; - -//@description Adds a new member to a chat; requires can_invite_users member right. Members can't be added to private or secret chats. Returns information about members that weren't added -//@chat_id Chat identifier -//@user_id Identifier of the user -//@forward_limit The number of earlier messages from the chat to be forwarded to the new member; up to 100. Ignored for supergroups and channels, or if the added user is a bot -addChatMember#66875217 chat_id:int53 user_id:int53 forward_limit:int32 = FailedToAddMembers; - -//@description Adds multiple new members to a chat; requires can_invite_users member right. Currently, this method is only available for supergroups and channels. -//@chat_id Chat identifier -//@user_ids Identifiers of the users to be added to the chat. The maximum number of added users is 20 for supergroups and 100 for channels -addChatMembers#1a3232f chat_id:int53 user_ids:vector = FailedToAddMembers; - -//@description Changes the status of a chat member; requires can_invite_users member right to add a chat member, can_promote_members administrator right to change administrator rights of the member, -//@chat_id Chat identifier -//@member_id Member identifier. Chats can be only banned and unbanned in supergroups and channels -//@status The new status of the member in the chat -setChatMemberStatus#4e0171f chat_id:int53 member_id:MessageSender status:ChatMemberStatus = Ok; - -//@description Bans a member in a chat; requires can_restrict_members administrator right. Members can't be banned in private or secret chats. In supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first -//@chat_id Chat identifier -//@member_id Member identifier -//@banned_until_date Point in time (Unix timestamp) when the user will be unbanned; 0 if never. If the user is banned for more than 366 days or for less than 30 seconds from the current time, the user is considered to be banned forever. Ignored in basic groups and if a chat is banned -//@revoke_messages Pass true to delete all messages in the chat for the user that is being removed. Always true for supergroups and channels -banChatMember#cb107d7c chat_id:int53 member_id:MessageSender banned_until_date:int32 revoke_messages:Bool = Ok; - -//@description Checks whether the current session can be used to transfer a chat ownership to another user -canTransferOwnership#25d3440c = CanTransferOwnershipResult; - -//@description Changes the owner of a chat; requires owner privileges in the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats -//@chat_id Chat identifier -//@user_id Identifier of the user to which transfer the ownership. The ownership can't be transferred to a bot or to a deleted user -//@password The 2-step verification password of the current user -transferChatOwnership#77a00a13 chat_id:int53 user_id:int53 password:string = Ok; - -//@description Returns information about a single member of a chat -//@chat_id Chat identifier -//@member_id Member identifier -getChatMember#d0c15272 chat_id:int53 member_id:MessageSender = ChatMember; - -//@description Searches for a specified query in the first name, last name and usernames of the members of a specified chat. Requires administrator rights if the chat is a channel -//@chat_id Chat identifier -//@query Query to search for -//@limit The maximum number of users to be returned; up to 200 -//@filter The type of users to search for; pass null to search among all chat members -searchChatMembers#e56d46c5 chat_id:int53 query:string limit:int32 filter:ChatMembersFilter = ChatMembers; - -//@description Returns a list of administrators of the chat with their custom titles -//@chat_id Chat identifier -getChatAdministrators#5c0eb6bb chat_id:int53 = ChatAdministrators; - -//@description Clears message drafts in all chats -//@exclude_secret_chats Pass true to keep local message drafts in secret chats -clearAllDraftMessages#fd3c74db exclude_secret_chats:Bool = Ok; - -//@description Returns saved notification sound by its identifier. Returns a 404 error if there is no saved notification sound with the specified identifier -//@notification_sound_id Identifier of the notification sound -getSavedNotificationSound#1b647917 notification_sound_id:int64 = NotificationSounds; - -//@description Returns the list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used -getSavedNotificationSounds#c0346fa8 = NotificationSounds; - -//@description Adds a new notification sound to the list of saved notification sounds. The new notification sound is added to the top of the list. If it is already in the list, its position isn't changed -//@sound Notification sound file to add -addSavedNotificationSound#3e3984ef sound:InputFile = NotificationSound; - -//@description Removes a notification sound from the list of saved notification sounds -//@notification_sound_id Identifier of the notification sound -removeSavedNotificationSound#e363474e notification_sound_id:int64 = Ok; - -//@description Returns the list of chats with non-default notification settings for new messages -//@scope If specified, only chats from the scope will be returned; pass null to return chats from all scopes -//@compare_sound Pass true to include in the response chats with only non-default sound -getChatNotificationSettingsExceptions#bfe0e11 scope:NotificationSettingsScope compare_sound:Bool = Chats; - -//@description Returns the notification settings for chats of a given type -//@scope Types of chats for which to return the notification settings information -getScopeNotificationSettings#c4a8254f scope:NotificationSettingsScope = ScopeNotificationSettings; - -//@description Changes notification settings for chats of a given type -//@scope Types of chats for which to change the notification settings -//@notification_settings The new notification settings for the given scope -setScopeNotificationSettings#85cfb63a scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Ok; - -//@description Changes notification settings for reactions -//@notification_settings The new notification settings for reactions -setReactionNotificationSettings#46b2d495 notification_settings:reactionNotificationSettings = Ok; - -//@description Resets all chat and scope notification settings to their default values. By default, all chats are unmuted and message previews are shown -resetAllNotificationSettings#f5a0a8f9 = Ok; - -//@description Changes the pinned state of a chat. There can be up to getOption("pinned_chat_count_max")/getOption("pinned_archived_chat_count_max") pinned non-secret chats and the same number of secret chats in the main/archive chat list. The limit can be increased with Telegram Premium -//@chat_list Chat list in which to change the pinned state of the chat -//@chat_id Chat identifier -//@is_pinned Pass true to pin the chat; pass false to unpin it -toggleChatIsPinned#a776263e chat_list:ChatList chat_id:int53 is_pinned:Bool = Ok; - -//@description Changes the order of pinned chats -//@chat_list Chat list in which to change the order of pinned chats -//@chat_ids The new list of pinned chats -setPinnedChats#c6c6edf1 chat_list:ChatList chat_ids:vector = Ok; - -//@description Traverse all chats in a chat list and marks all messages in the chats as read -//@chat_list Chat list in which to mark all chats as read -readChatList#bd6498aa chat_list:ChatList = Ok; - -//@description Returns the current weather in the given location -//@location The location -getCurrentWeather#8ada9bc9 location:location = CurrentWeather; - -//@description Returns a story -//@story_sender_chat_id Identifier of the chat that posted the story -//@story_id Story identifier -//@only_local Pass true to get only locally available information without sending network requests -getStory#717b1c78 story_sender_chat_id:int53 story_id:int32 only_local:Bool = Story; - -//@description Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there -getChatsToSendStories#22f9e3a4 = Chats; - -//@description Checks whether the current user can send a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats -//@chat_id Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of the current user -canSendStory#b6e0216b chat_id:int53 = CanSendStoryResult; - -//@description Sends a new story to a chat; requires can_post_stories right for supergroup and channel chats. Returns a temporary story -//@chat_id Identifier of the chat that will post the story. Pass Saved Messages chat identifier when posting a story on behalf of the current user -//@content Content of the story -//@areas Clickable rectangle areas to be shown on the story media; pass null if none -//@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") -//@privacy_settings The privacy settings for the story; ignored for stories sent to supergroup and channel chats -//@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise -//@from_story_full_id Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story -//@is_posted_to_chat_page Pass true to keep the story accessible after expiration -//@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting -sendStory#e6ab3302 chat_id:int53 content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 from_story_full_id:storyFullId is_posted_to_chat_page:Bool protect_content:Bool = Story; - -//@description Changes content and caption of a story. Can be called only if story.can_be_edited == true -//@story_sender_chat_id Identifier of the chat that posted the story -//@story_id Identifier of the story to edit -//@content New content of the story; pass null to keep the current content -//@areas New clickable rectangle areas to be shown on the story media; pass null to keep the current areas. Areas can't be edited if story content isn't changed -//@caption New story caption; pass null to keep the current caption -editStory#5e6a21b1 story_sender_chat_id:int53 story_id:int32 content:InputStoryContent areas:inputStoryAreas caption:formattedText = Ok; - -//@description Changes cover of a video story. Can be called only if story.can_be_edited == true and the story isn't being edited now -//@story_sender_chat_id Identifier of the chat that posted the story -//@story_id Identifier of the story to edit -//@cover_frame_timestamp New timestamp of the frame, which will be used as video thumbnail -editStoryCover#ab2a0c4b story_sender_chat_id:int53 story_id:int32 cover_frame_timestamp:double = Ok; - -//@description Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true -//@story_id Identifier of the story -//@privacy_settings The new privacy settings for the story -setStoryPrivacySettings#d8e94332 story_id:int32 privacy_settings:StoryPrivacySettings = Ok; - -//@description Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_posted_to_chat_page == true -//@story_sender_chat_id Identifier of the chat that posted the story -//@story_id Identifier of the story -//@is_posted_to_chat_page Pass true to make the story accessible after expiration; pass false to make it private -toggleStoryIsPostedToChatPage#ee0f4aff story_sender_chat_id:int53 story_id:int32 is_posted_to_chat_page:Bool = Ok; - -//@description Deletes a previously sent story. Can be called only if story.can_be_deleted == true -//@story_sender_chat_id Identifier of the chat that posted the story -//@story_id Identifier of the story to delete -deleteStory#9f35af16 story_sender_chat_id:int53 story_id:int32 = Ok; - -//@description Returns the list of chats with non-default notification settings for stories -getStoryNotificationSettingsExceptions#256a2eb0 = Chats; - -//@description Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by -//@story_list The story list in which to load active stories -loadActiveStories#7d8cf738 story_list:StoryList = Ok; - -//@description Changes story list in which stories from the chat are shown -//@chat_id Identifier of the chat that posted stories -//@story_list New list for active stories posted by the chat -setChatActiveStoriesList#e0e35d11 chat_id:int53 story_list:StoryList = Ok; - -//@description Returns the list of active stories posted by the given chat -//@chat_id Chat identifier -getChatActiveStories#2e4ffbf5 chat_id:int53 = ChatActiveStories; - -//@description Returns the list of stories that posted by the given chat to its chat page. If from_story_id == 0, then pinned stories are returned first. -//@chat_id Chat identifier -//@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from pinned and the newest story -//@limit The maximum number of stories to be returned. -getChatPostedToChatPageStories#fd3bc72b chat_id:int53 from_story_id:int32 limit:int32 = Stories; - -//@description Returns the list of all stories posted by the given chat; requires can_edit_stories right in the chat. -//@chat_id Chat identifier -//@from_story_id Identifier of the story starting from which stories must be returned; use 0 to get results from the last story -//@limit The maximum number of stories to be returned. -getChatArchivedStories#af1e9488 chat_id:int53 from_story_id:int32 limit:int32 = Stories; - -//@description Changes the list of pinned stories on a chat page; requires can_edit_stories right in the chat -//@chat_id Identifier of the chat that posted the stories -//@story_ids New list of pinned stories. All stories must be posted to the chat page first. There can be up to getOption("pinned_story_count_max") pinned stories on a chat page -setChatPinnedStories#f5cb679f chat_id:int53 story_ids:vector = Ok; - -//@description Informs TDLib that a story is opened and is being viewed by the user -//@story_sender_chat_id The identifier of the sender of the opened story -//@story_id The identifier of the story -openStory#ceda7c7d story_sender_chat_id:int53 story_id:int32 = Ok; - -//@description Informs TDLib that a story is closed by the user -//@story_sender_chat_id The identifier of the sender of the story to close -//@story_id The identifier of the story -closeStory#443d0f55 story_sender_chat_id:int53 story_id:int32 = Ok; - -//@description Returns reactions, which can be chosen for a story -//@row_size Number of reaction per row, 5-25 -getStoryAvailableReactions#23854d3b row_size:int32 = AvailableReactions; - -//@description Changes chosen reaction on a story that has already been sent -//@story_sender_chat_id The identifier of the sender of the story -//@story_id The identifier of the story -//@reaction_type Type of the reaction to set; pass null to remove the reaction. Custom emoji reactions can be used only by Telegram Premium users. Paid reactions can't be set -//@update_recent_reactions Pass true if the reaction needs to be added to recent reactions -setStoryReaction#ac8b4fa7 story_sender_chat_id:int53 story_id:int32 reaction_type:ReactionType update_recent_reactions:Bool = Ok; - -//@description Returns interactions with a story. The method can be called only for stories posted on behalf of the current user -//@story_id Story identifier -//@query Query to search for in names, usernames and titles; may be empty to get all relevant interactions -//@only_contacts Pass true to get only interactions by contacts; pass false to get all relevant interactions -//@prefer_forwards Pass true to get forwards and reposts first, then reactions, then other views; pass false to get interactions sorted just by interaction date -//@prefer_with_reaction Pass true to get interactions with reaction first; pass false to get interactions sorted just by interaction date. Ignored if prefer_forwards == true -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of story interactions to return -getStoryInteractions#1cd1400d story_id:int32 query:string only_contacts:Bool prefer_forwards:Bool prefer_with_reaction:Bool offset:string limit:int32 = StoryInteractions; - -//@description Returns interactions with a story posted in a chat. Can be used only if story is posted on behalf of a chat and the user is an administrator in the chat -//@story_sender_chat_id The identifier of the sender of the story -//@story_id Story identifier -//@reaction_type Pass the default heart reaction or a suggested reaction type to receive only interactions with the specified reaction type; pass null to receive all interactions; reactionTypePaid isn't supported -//@prefer_forwards Pass true to get forwards and reposts first, then reactions, then other views; pass false to get interactions sorted just by interaction date -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of story interactions to return -getChatStoryInteractions#c5ec7376 story_sender_chat_id:int53 story_id:int32 reaction_type:ReactionType prefer_forwards:Bool offset:string limit:int32 = StoryInteractions; - -//@description Reports a story to the Telegram moderators -//@story_sender_chat_id The identifier of the sender of the story to report -//@story_id The identifier of the story to report -//@option_id Option identifier chosen by the user; leave empty for the initial request -//@text Additional report details; 0-1024 characters; leave empty for the initial request -reportStory#78de7310 story_sender_chat_id:int53 story_id:int32 option_id:bytes text:string = ReportStoryResult; - -//@description Activates stealth mode for stories, which hides all views of stories from the current user in the last "story_stealth_mode_past_period" seconds -activateStoryStealthMode#c3db8491 = Ok; - -//@description Returns forwards of a story as a message to public chats and reposts by public channels. Can be used only if the story is posted on behalf of the current user or story.can_get_statistics == true. -//@story_sender_chat_id The identifier of the sender of the story -//@story_id The identifier of the story -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit -getStoryPublicForwards#68f7dcbb story_sender_chat_id:int53 story_id:int32 offset:string limit:int32 = PublicForwards; - -//@description Returns the list of features available on the specific chat boost level; this is an offline request -//@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups -//@level Chat boost level -getChatBoostLevelFeatures#45e63e8b is_channel:Bool level:int32 = ChatBoostLevelFeatures; - -//@description Returns the list of features available for different chat boost levels; this is an offline request -//@is_channel Pass true to get the list of features for channels; pass false to get the list of features for supergroups -getChatBoostFeatures#e8c128a0 is_channel:Bool = ChatBoostFeatures; - -//@description Returns the list of available chat boost slots for the current user -getAvailableChatBoostSlots#7307ebd5 = ChatBoostSlots; - -//@description Returns the current boost status for a supergroup or a channel chat -//@chat_id Identifier of the chat -getChatBoostStatus#cfac8acf chat_id:int53 = ChatBoostStatus; - -//@description Boosts a chat and returns the list of available chat boost slots for the current user after the boost -//@chat_id Identifier of the chat -//@slot_ids Identifiers of boost slots of the current user from which to apply boosts to the chat -boostChat#890ccd68 chat_id:int53 slot_ids:vector = ChatBoostSlots; - -//@description Returns an HTTPS link to boost the specified supergroup or channel chat -//@chat_id Identifier of the chat -getChatBoostLink#56f16c85 chat_id:int53 = ChatBoostLink; - -//@description Returns information about a link to boost a chat. Can be called for any internal link of the type internalLinkTypeChatBoost -//@url The link to boost a chat -getChatBoostLinkInfo#26fc4b5c url:string = ChatBoostLinkInfo; - -//@description Returns the list of boosts applied to a chat; requires administrator rights in the chat -//@chat_id Identifier of the chat -//@only_gift_codes Pass true to receive only boosts received from gift codes and giveaways created by the chat -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of boosts to be returned; up to 100. For optimal performance, the number of returned boosts can be smaller than the specified limit -getChatBoosts#ab5eaa38 chat_id:int53 only_gift_codes:Bool offset:string limit:int32 = FoundChatBoosts; - -//@description Returns the list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only -//@chat_id Identifier of the chat -//@user_id Identifier of the user -getUserChatBoosts#b90ee799 chat_id:int53 user_id:int53 = FoundChatBoosts; - -//@description Returns information about a bot that can be added to attachment or side menu -//@bot_user_id Bot's user identifier -getAttachmentMenuBot#3da561fb bot_user_id:int53 = AttachmentMenuBot; - -//@description Adds or removes a bot to attachment and side menu. Bot can be added to the menu, only if userTypeBot.can_be_added_to_attachment_menu == true -//@bot_user_id Bot's user identifier -//@is_added Pass true to add the bot to attachment menu; pass false to remove the bot from attachment menu -//@allow_write_access Pass true if the current user allowed the bot to send them messages. Ignored if is_added is false -toggleBotIsAddedToAttachmentMenu#8e59de9a bot_user_id:int53 is_added:Bool allow_write_access:Bool = Ok; - -//@description Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list for self status -getThemedEmojiStatuses#6ac5c8c2 = EmojiStatuses; - -//@description Returns recent emoji statuses for self status -getRecentEmojiStatuses#ae3a3d29 = EmojiStatuses; - -//@description Returns default emoji statuses for self status -getDefaultEmojiStatuses#24e45ec3 = EmojiStatuses; - -//@description Clears the list of recently used emoji statuses for self status -clearRecentEmojiStatuses#e671cb5e = Ok; - -//@description Returns up to 8 emoji statuses, which must be shown in the emoji status list for chats -getThemedChatEmojiStatuses#fb735cb5 = EmojiStatuses; - -//@description Returns default emoji statuses for chats -getDefaultChatEmojiStatuses#a7aa86e6 = EmojiStatuses; - -//@description Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true -getDisallowedChatEmojiStatuses#d2144da0 = EmojiStatuses; - -//@description Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates -//@file_id Identifier of the file to download -//@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile/addFileToDownloads was called will be downloaded first -//@offset The starting position from which the file needs to be downloaded -//@limit Number of bytes which need to be downloaded starting from the "offset" position before the download will automatically be canceled; use 0 to download without a limit -//@synchronous Pass true to return response only after the file download has succeeded, has failed, has been canceled, or a new downloadFile request with different offset/limit parameters was sent; pass false to return file state immediately, just after the download has been started -downloadFile#3f253234 file_id:int32 priority:int32 offset:int53 limit:int53 synchronous:Bool = File; - -//@description Returns file downloaded prefix size from a given offset, in bytes -//@file_id Identifier of the file -//@offset Offset from which downloaded prefix size needs to be calculated -getFileDownloadedPrefixSize#3304bd2d file_id:int32 offset:int53 = FileDownloadedPrefixSize; - -//@description Stops the downloading of a file. If a file has already been downloaded, does nothing -//@file_id Identifier of a file to stop downloading -//@only_if_pending Pass true to stop downloading only if it hasn't been started, i.e. request hasn't been sent to server -cancelDownloadFile#8b8052de file_id:int32 only_if_pending:Bool = Ok; - -//@description Returns suggested name for saving a file in a given directory -//@file_id Identifier of the file -//@directory Directory in which the file is expected to be saved -getSuggestedFileName#85d8a486 file_id:int32 directory:string = Text; - -//@description Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. -//@file File to upload -//@file_type File type; pass null if unknown -//@priority Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which preliminaryUploadFile was called will be uploaded first -preliminaryUploadFile#70e7cb99 file:InputFile file_type:FileType priority:int32 = File; - -//@description Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile -//@file_id Identifier of the file to stop uploading -cancelPreliminaryUploadFile#311446be file_id:int32 = Ok; - -//@description Writes a part of a generated file. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct write to the destination file -//@generation_id The identifier of the generation process -//@offset The offset from which to write the data to the file -//@data The data to write -writeGeneratedFilePart#cc89e95 generation_id:int64 offset:int53 data:bytes = Ok; - -//@description Informs TDLib on a file generation progress -//@generation_id The identifier of the generation process -//@expected_size Expected size of the generated file, in bytes; 0 if unknown -//@local_prefix_size The number of bytes already generated -setFileGenerationProgress#6d754b3e generation_id:int64 expected_size:int53 local_prefix_size:int53 = Ok; - -//@description Finishes the file generation -//@generation_id The identifier of the generation process -//@error If passed, the file generation has failed and must be terminated; pass null if the file generation succeeded -finishFileGeneration#c11d0c9d generation_id:int64 error:error = Ok; - -//@description Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct read from the file -//@file_id Identifier of the file. The file must be located in the TDLib file cache -//@offset The offset from which to read the file -//@count Number of bytes to read. An error will be returned if there are not enough bytes available in the file from the specified position. Pass 0 to read all available data from the specified position -readFilePart#360ca70d file_id:int32 offset:int53 count:int53 = FilePart; - -//@description Deletes a file from the TDLib file cache -//@file_id Identifier of the file to delete -deleteFile#6bbe9b2c file_id:int32 = Ok; - -//@description Adds a file from a message to the list of file downloads. Download progress and completion of the download will be notified through updateFile updates. -//@file_id Identifier of the file to download -//@chat_id Chat identifier of the message with the file -//@message_id Message identifier -//@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile/addFileToDownloads was called will be downloaded first -addFileToDownloads#33b583b7 file_id:int32 chat_id:int53 message_id:int53 priority:int32 = File; - -//@description Changes pause state of a file in the file download list -//@file_id Identifier of the downloaded file -//@is_paused Pass true if the download is paused -toggleDownloadIsPaused#c7866715 file_id:int32 is_paused:Bool = Ok; - -//@description Changes pause state of all files in the file download list -//@are_paused Pass true to pause all downloads; pass false to unpause them -toggleAllDownloadsArePaused#4a989002 are_paused:Bool = Ok; - -//@description Removes a file from the file download list -//@file_id Identifier of the downloaded file -//@delete_from_cache Pass true to delete the file from the TDLib file cache -removeFileFromDownloads#5706bfee file_id:int32 delete_from_cache:Bool = Ok; - -//@description Removes all files from the file download list -//@only_active Pass true to remove only active downloads, including paused -//@only_completed Pass true to remove only completed downloads -//@delete_from_cache Pass true to delete the file from the TDLib file cache -removeAllFilesFromDownloads#b9487686 only_active:Bool only_completed:Bool delete_from_cache:Bool = Ok; - -//@description Searches for files in the file download list or recently downloaded files from the list -//@query Query to search for; may be empty to return all downloaded files -//@only_active Pass true to search only for active downloads, including paused -//@only_completed Pass true to search only for completed downloads -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of files to be returned -searchFileDownloads#2a1e0856 query:string only_active:Bool only_completed:Bool offset:string limit:int32 = FoundFileDownloads; - -//@description Application verification has been completed. Can be called before authorization -//@verification_id Unique identifier for the verification process as received from updateApplicationVerificationRequired -//@token Play Integrity API token for the Android application, or secret from push notification for the iOS application; -setApplicationVerificationToken#3744af85 verification_id:int53 token:string = Ok; - -//@description Returns information about a file with messages exported from another application -//@message_file_head Beginning of the message file; up to 100 first lines -getMessageFileType#e2c70fd4 message_file_head:string = MessageFileType; - -//@description Returns a confirmation text to be shown to the user before starting message import -//@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info member right -getMessageImportConfirmationText#174881a8 chat_id:int53 = Text; - -//@description Imports messages exported from another app -//@chat_id Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info member right -//@message_file File with messages to import. Only inputFileLocal and inputFileGenerated are supported. The file must not be previously uploaded -//@attached_files Files used in the imported messages. Only inputFileLocal and inputFileGenerated are supported. The files must not be previously uploaded -importMessages#7e98592b chat_id:int53 message_file:InputFile attached_files:vector = Ok; - -//@description Replaces current primary invite link for a chat with a new primary invite link. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right -//@chat_id Chat identifier -replacePrimaryChatInviteLink#3f9e7b9d chat_id:int53 = ChatInviteLink; - -//@description Creates a new invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat -//@chat_id Chat identifier -//@name Invite link name; 0-32 characters -//@expiration_date Point in time (Unix timestamp) when the link will expire; pass 0 if never -//@member_limit The maximum number of chat members that can join the chat via the link simultaneously; 0-99999; pass 0 if not limited -//@creates_join_request Pass true if users joining the chat via the link need to be approved by chat administrators. In this case, member_limit must be 0 -createChatInviteLink#1126a341 chat_id:int53 name:string expiration_date:int32 member_limit:int32 creates_join_request:Bool = ChatInviteLink; - -//@description Creates a new subscription invite link for a channel chat. Requires can_invite_users right in the chat -//@chat_id Chat identifier -//@name Invite link name; 0-32 characters -//@subscription_pricing Information about subscription plan that will be applied to the users joining the chat via the link. -createChatSubscriptionInviteLink#226b65 chat_id:int53 name:string subscription_pricing:starSubscriptionPricing = ChatInviteLink; - -//@description Edits a non-primary invite link for a chat. Available for basic groups, supergroups, and channels. -//@chat_id Chat identifier -//@invite_link Invite link to be edited -//@name Invite link name; 0-32 characters -//@expiration_date Point in time (Unix timestamp) when the link will expire; pass 0 if never -//@member_limit The maximum number of chat members that can join the chat via the link simultaneously; 0-99999; pass 0 if not limited -//@creates_join_request Pass true if users joining the chat via the link need to be approved by chat administrators. In this case, member_limit must be 0 -editChatInviteLink#4eb23d7c chat_id:int53 invite_link:string name:string expiration_date:int32 member_limit:int32 creates_join_request:Bool = ChatInviteLink; - -//@description Edits a subscription invite link for a channel chat. Requires can_invite_users right in the chat for own links and owner privileges for other links -//@chat_id Chat identifier -//@invite_link Invite link to be edited -//@name Invite link name; 0-32 characters -editChatSubscriptionInviteLink#c74445d3 chat_id:int53 invite_link:string name:string = ChatInviteLink; - -//@description Returns information about an invite link. Requires administrator privileges and can_invite_users right in the chat to get own links and owner privileges to get other links -//@chat_id Chat identifier -//@invite_link Invite link to get -getChatInviteLink#e36a41fd chat_id:int53 invite_link:string = ChatInviteLink; - -//@description Returns the list of chat administrators with number of their invite links. Requires owner privileges in the chat -//@chat_id Chat identifier -getChatInviteLinkCounts#3510e291 chat_id:int53 = ChatInviteLinkCounts; - -//@description Returns invite links for a chat created by specified administrator. Requires administrator privileges and can_invite_users right in the chat to get own links and owner privileges to get other links -//@chat_id Chat identifier -//@creator_user_id User identifier of a chat administrator. Must be an identifier of the current user for non-owner -//@is_revoked Pass true if revoked links needs to be returned instead of active or expired -//@offset_date Creation date of an invite link starting after which to return invite links; use 0 to get results from the beginning -//@offset_invite_link Invite link starting after which to return invite links; use empty string to get results from the beginning -//@limit The maximum number of invite links to return; up to 100 -getChatInviteLinks#34a55cac chat_id:int53 creator_user_id:int53 is_revoked:Bool offset_date:int32 offset_invite_link:string limit:int32 = ChatInviteLinks; - -//@description Returns chat members joined a chat via an invite link. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links -//@chat_id Chat identifier -//@invite_link Invite link for which to return chat members -//@only_with_expired_subscription Pass true if the link is a subscription link and only members with expired subscription must be returned -//@offset_member A chat member from which to return next chat members; pass null to get results from the beginning -//@limit The maximum number of chat members to return; up to 100 -getChatInviteLinkMembers#6704ed3c chat_id:int53 invite_link:string only_with_expired_subscription:Bool offset_member:chatInviteLinkMember limit:int32 = ChatInviteLinkMembers; - -//@description Revokes invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links. -//@chat_id Chat identifier -//@invite_link Invite link to be revoked -revokeChatInviteLink#d1b755a9 chat_id:int53 invite_link:string = ChatInviteLinks; - -//@description Deletes revoked chat invite links. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links -//@chat_id Chat identifier -//@invite_link Invite link to revoke -deleteRevokedChatInviteLink#91270c7f chat_id:int53 invite_link:string = Ok; - -//@description Deletes all revoked chat invite links created by a given chat administrator. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links -//@chat_id Chat identifier -//@creator_user_id User identifier of a chat administrator, which links will be deleted. Must be an identifier of the current user for non-owner -deleteAllRevokedChatInviteLinks#424816da chat_id:int53 creator_user_id:int53 = Ok; - -//@description Checks the validity of an invite link for a chat and returns information about the corresponding chat -//@invite_link Invite link to be checked -checkChatInviteLink#e261483b invite_link:string = ChatInviteLinkInfo; - -//@description Uses an invite link to add the current user to the chat if possible. May return an error with a message "INVITE_REQUEST_SENT" if only a join request was created -//@invite_link Invite link to use -joinChatByInviteLink#c16aab86 invite_link:string = Chat; - -//@description Returns pending join requests in a chat -//@chat_id Chat identifier -//@invite_link Invite link for which to return join requests. If empty, all join requests will be returned. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links -//@query A query to search for in the first names, last names and usernames of the users to return -//@offset_request A chat join request from which to return next requests; pass null to get results from the beginning -//@limit The maximum number of requests to join the chat to return -getChatJoinRequests#e8d90ea2 chat_id:int53 invite_link:string query:string offset_request:chatJoinRequest limit:int32 = ChatJoinRequests; - -//@description Handles a pending join request in a chat -//@chat_id Chat identifier -//@user_id Identifier of the user that sent the request -//@approve Pass true to approve the request; pass false to decline it -processChatJoinRequest#3be534a3 chat_id:int53 user_id:int53 approve:Bool = Ok; - -//@description Handles all pending join requests for a given link in a chat -//@chat_id Chat identifier -//@invite_link Invite link for which to process join requests. If empty, all join requests will be processed. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links -//@approve Pass true to approve all requests; pass false to decline them -processChatJoinRequests#3e823dce chat_id:int53 invite_link:string approve:Bool = Ok; - -//@description Creates a new call -//@user_id Identifier of the user to be called -//@protocol The call protocols supported by the application -//@is_video Pass true to create a video call -//@group_call_id Identifier of the group call to which the user will be added after exchanging private key via the call; pass 0 if none; currently, ignored -createCall#b4410c99 user_id:int53 protocol:callProtocol is_video:Bool group_call_id:int32 = CallId; - -//@description Accepts an incoming call -//@call_id Call identifier -//@protocol The call protocols supported by the application -acceptCall#d97562d0 call_id:int32 protocol:callProtocol = Ok; - -//@description Sends call signaling data -//@call_id Call identifier -//@data The data -sendCallSignalingData#542db19c call_id:int32 data:bytes = Ok; - -//@description Discards a call -//@call_id Call identifier -//@is_disconnected Pass true if the user was disconnected -//@duration The call duration, in seconds -//@is_video Pass true if the call was a video call -//@connection_id Identifier of the connection used during the call -discardCall#95a9a57e call_id:int32 is_disconnected:Bool duration:int32 is_video:Bool connection_id:int64 = Ok; - -//@description Sends a call rating -//@call_id Call identifier -//@rating Call rating; 1-5 -//@comment An optional user comment if the rating is less than 5 -//@problems List of the exact types of problems with the call, specified by the user -sendCallRating#d89b576c call_id:int32 rating:int32 comment:string problems:vector = Ok; - -//@description Sends debug information for a call to Telegram servers -//@call_id Call identifier -//@debug_information Debug information in application-specific format -sendCallDebugInformation#785b373f call_id:int32 debug_information:string = Ok; - -//@description Sends log file for a call to Telegram servers -//@call_id Call identifier -//@log_file Call log file. Only inputFileLocal and inputFileGenerated are supported -sendCallLog#3f0a47d1 call_id:int32 log_file:InputFile = Ok; - -//@description Returns the list of participant identifiers, on whose behalf a video chat in the chat can be joined -//@chat_id Chat identifier -getVideoChatAvailableParticipants#c45da305 chat_id:int53 = MessageSenders; - -//@description Changes default participant identifier, on whose behalf a video chat in the chat will be joined -//@chat_id Chat identifier -//@default_participant_id Default group call participant identifier to join the video chats -setVideoChatDefaultParticipant#f1a672b3 chat_id:int53 default_participant_id:MessageSender = Ok; - -//@description Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats administrator right -//@chat_id Identifier of a chat in which the video chat will be created -//@title Group call title; if empty, chat title will be used -//@start_date Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 to start the video chat immediately. The date must be at least 10 seconds and at most 8 days in the future -//@is_rtmp_stream Pass true to create an RTMP stream instead of an ordinary video chat -createVideoChat#7ea4958d chat_id:int53 title:string start_date:int32 is_rtmp_stream:Bool = GroupCallId; - -//@description Creates a group call from a one-to-one call -//@call_id Call identifier -createGroupCall#87b855fb call_id:int32 = Ok; - -//@description Returns RTMP URL for streaming to the chat; requires can_manage_video_chats administrator right -//@chat_id Chat identifier -getVideoChatRtmpUrl#482b1b1f chat_id:int53 = RtmpUrl; - -//@description Replaces the current RTMP URL for streaming to the chat; requires owner privileges -//@chat_id Chat identifier -replaceVideoChatRtmpUrl#214f8fe0 chat_id:int53 = RtmpUrl; - -//@description Returns information about a group call -//@group_call_id Group call identifier -getGroupCall#5787668e group_call_id:int32 = GroupCall; - -//@description Starts a scheduled group call -//@group_call_id Group call identifier -startScheduledGroupCall#5a986d16 group_call_id:int32 = Ok; - -//@description Toggles whether the current user will receive a notification when the group call starts; scheduled group calls only -//@group_call_id Group call identifier -//@enabled_start_notification New value of the enabled_start_notification setting -toggleGroupCallEnabledStartNotification#2a30c752 group_call_id:int32 enabled_start_notification:Bool = Ok; - -//@description Joins an active group call. Returns join response payload for tgcalls -//@group_call_id Group call identifier -//@participant_id Identifier of a group call participant, which will be used to join the call; pass null to join as self; video chats only -//@audio_source_id Caller audio channel synchronization source identifier; received from tgcalls -//@payload Group call join payload; received from tgcalls -//@is_muted Pass true to join the call with muted microphone -//@is_my_video_enabled Pass true if the user's video is enabled -//@invite_hash If non-empty, invite hash to be used to join the group call without being muted by administrators -joinGroupCall#c1c947e5 group_call_id:int32 participant_id:MessageSender audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool invite_hash:string = Text; - -//@description Starts screen sharing in a joined group call. Returns join response payload for tgcalls -//@group_call_id Group call identifier -//@audio_source_id Screen sharing audio channel synchronization source identifier; received from tgcalls -//@payload Group call join payload; received from tgcalls -startGroupCallScreenSharing#cb4e312d group_call_id:int32 audio_source_id:int32 payload:string = Text; - -//@description Pauses or unpauses screen sharing in a joined group call -//@group_call_id Group call identifier -//@is_paused Pass true to pause screen sharing; pass false to unpause it -toggleGroupCallScreenSharingIsPaused#a07b5360 group_call_id:int32 is_paused:Bool = Ok; - -//@description Ends screen sharing in a joined group call -//@group_call_id Group call identifier -endGroupCallScreenSharing#85f41c4c group_call_id:int32 = Ok; - -//@description Sets group call title. Requires groupCall.can_be_managed group call flag -//@group_call_id Group call identifier -//@title New group call title; 1-64 characters -setGroupCallTitle#b6c19dcd group_call_id:int32 title:string = Ok; - -//@description Toggles whether new participants of a group call can be unmuted only by administrators of the group call. Requires groupCall.can_toggle_mute_new_participants group call flag -//@group_call_id Group call identifier -//@mute_new_participants New value of the mute_new_participants setting -toggleGroupCallMuteNewParticipants#10eec1c2 group_call_id:int32 mute_new_participants:Bool = Ok; - -//@description Invites users to an active group call. Sends a service message of type messageInviteVideoChatParticipants for video chats -//@group_call_id Group call identifier -//@user_ids User identifiers. At most 10 users can be invited simultaneously -inviteGroupCallParticipants#56c030a6 group_call_id:int32 user_ids:vector = Ok; - -//@description Returns invite link to a video chat in a public chat -//@group_call_id Group call identifier -//@can_self_unmute Pass true if the invite link needs to contain an invite hash, passing which to joinGroupCall would allow the invited user to unmute themselves. Requires groupCall.can_be_managed group call flag -getGroupCallInviteLink#2ae14924 group_call_id:int32 can_self_unmute:Bool = HttpUrl; - -//@description Revokes invite link for a group call. Requires groupCall.can_be_managed group call flag -//@group_call_id Group call identifier -revokeGroupCallInviteLink#1de5a494 group_call_id:int32 = Ok; - -//@description Starts recording of an active group call. Requires groupCall.can_be_managed group call flag -//@group_call_id Group call identifier -//@title Group call recording title; 0-64 characters -//@record_video Pass true to record a video file instead of an audio file -//@use_portrait_orientation Pass true to use portrait orientation for video instead of landscape one -startGroupCallRecording#68c5847b group_call_id:int32 title:string record_video:Bool use_portrait_orientation:Bool = Ok; - -//@description Ends recording of an active group call. Requires groupCall.can_be_managed group call flag -//@group_call_id Group call identifier -endGroupCallRecording#fb7b6289 group_call_id:int32 = Ok; - -//@description Toggles whether current user's video is paused -//@group_call_id Group call identifier -//@is_my_video_paused Pass true if the current user's video is paused -toggleGroupCallIsMyVideoPaused#e374f199 group_call_id:int32 is_my_video_paused:Bool = Ok; - -//@description Toggles whether current user's video is enabled -//@group_call_id Group call identifier -//@is_my_video_enabled Pass true if the current user's video is enabled -toggleGroupCallIsMyVideoEnabled#9f2f50fa group_call_id:int32 is_my_video_enabled:Bool = Ok; - -//@description Informs TDLib that speaking state of a participant of an active group has changed -//@group_call_id Group call identifier -//@audio_source Group call participant's synchronization audio source identifier, or 0 for the current user -//@is_speaking Pass true if the user is speaking -setGroupCallParticipantIsSpeaking#3748a1e5 group_call_id:int32 audio_source:int32 is_speaking:Bool = Ok; - -//@description Toggles whether a participant of an active group call is muted, unmuted, or allowed to unmute themselves -//@group_call_id Group call identifier -//@participant_id Participant identifier -//@is_muted Pass true to mute the user; pass false to unmute them -toggleGroupCallParticipantIsMuted#b2081407 group_call_id:int32 participant_id:MessageSender is_muted:Bool = Ok; - -//@description Changes volume level of a participant of an active group call. If the current user can manage the group call, then the participant's volume level will be changed for all users with the default volume level -//@group_call_id Group call identifier -//@participant_id Participant identifier -//@volume_level New participant's volume level; 1-20000 in hundreds of percents -setGroupCallParticipantVolumeLevel#97779828 group_call_id:int32 participant_id:MessageSender volume_level:int32 = Ok; - -//@description Toggles whether a group call participant hand is rased -//@group_call_id Group call identifier -//@participant_id Participant identifier -//@is_hand_raised Pass true if the user's hand needs to be raised. Only self hand can be raised. Requires groupCall.can_be_managed group call flag to lower other's hand -toggleGroupCallParticipantIsHandRaised#8efb63e1 group_call_id:int32 participant_id:MessageSender is_hand_raised:Bool = Ok; - -//@description Loads more participants of a group call. The loaded participants will be received through updates. Use the field groupCall.loaded_all_participants to check whether all participants have already been loaded -//@group_call_id Group call identifier. The group call must be previously received through getGroupCall and must be joined or being joined -//@limit The maximum number of participants to load; up to 100 -loadGroupCallParticipants#37f3bece group_call_id:int32 limit:int32 = Ok; - -//@description Leaves a group call -//@group_call_id Group call identifier -leaveGroupCall#3a6befa9 group_call_id:int32 = Ok; - -//@description Ends a group call. Requires groupCall.can_be_managed -//@group_call_id Group call identifier -endGroupCall#22294cb7 group_call_id:int32 = Ok; - -//@description Returns information about available group call streams -//@group_call_id Group call identifier -getGroupCallStreams#9f7c9164 group_call_id:int32 = GroupCallStreams; - -//@description Returns a file with a segment of a group call stream in a modified OGG format for audio or MPEG-4 format for video -//@group_call_id Group call identifier -//@time_offset Point in time when the stream segment begins; Unix timestamp in milliseconds -//@scale Segment duration scale; 0-1. Segment's duration is 1000/(2**scale) milliseconds -//@channel_id Identifier of an audio/video channel to get as received from tgcalls -//@video_quality Video quality as received from tgcalls; pass null to get the worst available quality -getGroupCallStreamSegment#8424daa5 group_call_id:int32 time_offset:int53 scale:int32 channel_id:int32 video_quality:GroupCallVideoQuality = FilePart; - -//@description Changes the block list of a message sender. Currently, only users and supergroup chats can be blocked -//@sender_id Identifier of a message sender to block/unblock -//@block_list New block list for the message sender; pass null to unblock the message sender -setMessageSenderBlockList#898b5c91 sender_id:MessageSender block_list:BlockList = Ok; - -//@description Blocks an original sender of a message in the Replies chat -//@message_id The identifier of an incoming message in the Replies chat -//@delete_message Pass true to delete the message -//@delete_all_messages Pass true to delete all messages from the same sender -//@report_spam Pass true to report the sender to the Telegram moderators -blockMessageSenderFromReplies#b79df58b message_id:int53 delete_message:Bool delete_all_messages:Bool report_spam:Bool = Ok; - -//@description Returns users and chats that were blocked by the current user -//@block_list Block list from which to return users -//@offset Number of users and chats to skip in the result; must be non-negative -//@limit The maximum number of users and chats to return; up to 100 -getBlockedMessageSenders#8ce52f16 block_list:BlockList offset:int32 limit:int32 = MessageSenders; - -//@description Adds a user to the contact list or edits an existing contact by their user identifier -//@contact The contact to add or edit; phone number may be empty and needs to be specified only if known, vCard is ignored -//@share_phone_number Pass true to share the current user's phone number with the new contact. A corresponding rule to userPrivacySettingShowPhoneNumber will be added if needed. -addContact#6f707140 contact:contact share_phone_number:Bool = Ok; - -//@description Adds new contacts or edits existing contacts by their phone numbers; contacts' user identifiers are ignored -//@contacts The list of contacts to import or edit; contacts' vCard are ignored and are not imported -importContacts#77bdb718 contacts:vector = ImportedContacts; - -//@description Returns all contacts of the user -getContacts#ab7f4470 = Users; - -//@description Searches for the specified query in the first names, last names and usernames of the known user contacts -//@query Query to search for; may be empty to return all contacts -//@limit The maximum number of users to be returned -searchContacts#95073165 query:string limit:int32 = Users; - -//@description Removes users from the contact list -//@user_ids Identifiers of users to be deleted -removeContacts#b464dfff user_ids:vector = Ok; - -//@description Returns the total number of imported contacts -getImportedContactCount#d8e11a26 = Count; - -//@description Changes imported contacts using the list of contacts saved on the device. Imports newly added contacts and, if at least the file database is enabled, deletes recently deleted contacts. -//@contacts The new list of contacts, contact's vCard are ignored and are not imported -changeImportedContacts#24885905 contacts:vector = ImportedContacts; - -//@description Clears all imported contacts, contact list remains unchanged -clearImportedContacts#33d39142 = Ok; - -//@description Changes the list of close friends of the current user -//@user_ids User identifiers of close friends; the users must be contacts of the current user -setCloseFriends#7ff8f69f user_ids:vector = Ok; - -//@description Returns all close friends of the current user -getCloseFriends#a9d574ce = Users; - -//@description Changes a personal profile photo of a contact user -//@user_id User identifier -//@photo Profile photo to set; pass null to delete the photo; inputChatPhotoPrevious isn't supported in this function -setUserPersonalProfilePhoto#1baa28f6 user_id:int53 photo:InputChatPhoto = Ok; - -//@description Suggests a profile photo to another regular user with common messages -//@user_id User identifier -//@photo Profile photo to suggest; inputChatPhotoPrevious isn't supported in this function -suggestUserProfilePhoto#9561f463 user_id:int53 photo:InputChatPhoto = Ok; - -//@description Toggles whether the bot can manage emoji status of the current user -//@bot_user_id User identifier of the bot -//@can_manage_emoji_status Pass true if the bot is allowed to change emoji status of the user; pass false otherwise -toggleBotCanManageEmojiStatus#251a881a bot_user_id:int53 can_manage_emoji_status:Bool = Ok; - -//@description Changes the emoji status of a user; for bots only -//@user_id Identifier of the user -//@emoji_status New emoji status; pass null to switch to the default badge -setUserEmojiStatus#e5165bcb user_id:int53 emoji_status:emojiStatus = Ok; - -//@description Searches a user by their phone number. Returns a 404 error if the user can't be found -//@phone_number Phone number to search for -//@only_local Pass true to get only locally available information without sending network requests -searchUserByPhoneNumber#eb82adc8 phone_number:string only_local:Bool = User; - -//@description Shares the phone number of the current user with a mutual contact. Supposed to be called when the user clicks on chatActionBarSharePhoneNumber -//@user_id Identifier of the user with whom to share the phone number. The user must be a mutual contact -sharePhoneNumber#4164e055 user_id:int53 = Ok; - -//@description Returns the profile photos of a user. Personal and public photo aren't returned -//@user_id User identifier -//@offset The number of photos to skip; must be non-negative -//@limit The maximum number of photos to be returned; up to 100 -getUserProfilePhotos#c9defe42 user_id:int53 offset:int32 limit:int32 = ChatPhotos; - -//@description Returns outline of a sticker; this is an offline request. Returns a 404 error if the outline isn't known -//@sticker_file_id File identifier of the sticker -//@for_animated_emoji Pass true to get the outline scaled for animated emoji -//@for_clicked_animated_emoji_message Pass true to get the outline scaled for clicked animated emoji message -getStickerOutline#a3952da5 sticker_file_id:int32 for_animated_emoji:Bool for_clicked_animated_emoji_message:Bool = Outline; - -//@description Returns stickers from the installed sticker sets that correspond to any of the given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned -//@sticker_type Type of the stickers to return -//@query Search query; a space-separated list of emojis or a keyword prefix. If empty, returns all known installed stickers -//@limit The maximum number of stickers to be returned -//@chat_id Chat identifier for which to return stickers. Available custom emoji stickers may be different for different chats -getStickers#45069343 sticker_type:StickerType query:string limit:int32 chat_id:int53 = Stickers; - -//@description Returns unique emoji that correspond to stickers to be found by the getStickers(sticker_type, query, 1000000, chat_id) -//@sticker_type Type of the stickers to search for -//@query Search query -//@chat_id Chat identifier for which to find stickers -//@return_only_main_emoji Pass true if only main emoji for each found sticker must be included in the result -getAllStickerEmojis#11ad2e30 sticker_type:StickerType query:string chat_id:int53 return_only_main_emoji:Bool = Emojis; - -//@description Searches for stickers from public sticker sets that correspond to any of the given emoji -//@sticker_type Type of the stickers to return -//@emojis Space-separated list of emojis to search for -//@query Query to search for; may be empty to search for emoji only -//@input_language_codes List of possible IETF language tags of the user's input language; may be empty if unknown -//@offset The offset from which to return the stickers; must be non-negative -//@limit The maximum number of stickers to be returned; 0-100 -searchStickers#66428c3a sticker_type:StickerType emojis:string query:string input_language_codes:vector offset:int32 limit:int32 = Stickers; - -//@description Returns greeting stickers from regular sticker sets that can be used for the start page of other users -getGreetingStickers#16581d1c = Stickers; - -//@description Returns premium stickers from regular sticker sets -//@limit The maximum number of stickers to be returned; 0-100 -getPremiumStickers#ef410a50 limit:int32 = Stickers; - -//@description Returns a list of installed sticker sets -//@sticker_type Type of the sticker sets to return -getInstalledStickerSets#612ef6f6 sticker_type:StickerType = StickerSets; - -//@description Returns a list of archived sticker sets -//@sticker_type Type of the sticker sets to return -//@offset_sticker_set_id Identifier of the sticker set from which to return the result; use 0 to get results from the beginning -//@limit The maximum number of sticker sets to return; up to 100 -getArchivedStickerSets#3bb8424d sticker_type:StickerType offset_sticker_set_id:int64 limit:int32 = StickerSets; - -//@description Returns a list of trending sticker sets. For optimal performance, the number of returned sticker sets is chosen by TDLib -//@sticker_type Type of the sticker sets to return -//@offset The offset from which to return the sticker sets; must be non-negative -//@limit The maximum number of sticker sets to be returned; up to 100. For optimal performance, the number of returned sticker sets is chosen by TDLib and can be smaller than the specified limit, even if the end of the list has not been reached -getTrendingStickerSets#e058455e sticker_type:StickerType offset:int32 limit:int32 = TrendingStickerSets; - -//@description Returns a list of sticker sets attached to a file, including regular, mask, and emoji sticker sets. Currently, only animations, photos, and videos can have attached sticker sets -//@file_id File identifier -getAttachedStickerSets#4d9d930d file_id:int32 = StickerSets; - -//@description Returns information about a sticker set by its identifier -//@set_id Identifier of the sticker set -getStickerSet#3eb91bc3 set_id:int64 = StickerSet; - -//@description Returns name of a sticker set by its identifier -//@set_id Identifier of the sticker set -getStickerSetName#3dfad681 set_id:int64 = Text; - -//@description Searches for a sticker set by its name -//@name Name of the sticker set -//@ignore_cache Pass true to ignore local cache of sticker sets and always send a network request -searchStickerSet#63eec702 name:string ignore_cache:Bool = StickerSet; - -//@description Searches for installed sticker sets by looking for specified query in their title and name -//@sticker_type Type of the sticker sets to search for -//@query Query to search for -//@limit The maximum number of sticker sets to return -searchInstalledStickerSets#7e5e7fa4 sticker_type:StickerType query:string limit:int32 = StickerSets; - -//@description Searches for sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results -//@sticker_type Type of the sticker sets to return -//@query Query to search for -searchStickerSets#faa066c sticker_type:StickerType query:string = StickerSets; - -//@description Installs/uninstalls or activates/archives a sticker set -//@set_id Identifier of the sticker set -//@is_installed The new value of is_installed -//@is_archived The new value of is_archived. A sticker set can't be installed and archived simultaneously -changeStickerSet#1ac8a5ed set_id:int64 is_installed:Bool is_archived:Bool = Ok; - -//@description Informs the server that some trending sticker sets have been viewed by the user -//@sticker_set_ids Identifiers of viewed trending sticker sets -viewTrendingStickerSets#36d6469 sticker_set_ids:vector = Ok; - -//@description Changes the order of installed sticker sets -//@sticker_type Type of the sticker sets to reorder -//@sticker_set_ids Identifiers of installed sticker sets in the new correct order -reorderInstalledStickerSets#4a830a78 sticker_type:StickerType sticker_set_ids:vector = Ok; - -//@description Returns a list of recently used stickers -//@is_attached Pass true to return stickers and masks that were recently attached to photos or video files; pass false to return recently sent stickers -getRecentStickers#dd73aa9f is_attached:Bool = Stickers; - -//@description Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. -//@is_attached Pass true to add the sticker to the list of stickers recently attached to photo or video files; pass false to add the sticker to the list of recently sent stickers -//@sticker Sticker file to add -addRecentSticker#a7e5d89e is_attached:Bool sticker:InputFile = Stickers; - -//@description Removes a sticker from the list of recently used stickers -//@is_attached Pass true to remove the sticker from the list of stickers recently attached to photo or video files; pass false to remove the sticker from the list of recently sent stickers -//@sticker Sticker file to delete -removeRecentSticker#4a4d440d is_attached:Bool sticker:InputFile = Ok; - -//@description Clears the list of recently used stickers -//@is_attached Pass true to clear the list of stickers recently attached to photo or video files; pass false to clear the list of recently sent stickers -clearRecentStickers#ecda39c4 is_attached:Bool = Ok; - -//@description Returns favorite stickers -getFavoriteStickers#ebcbcf40 = Stickers; - -//@description Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. -//@sticker Sticker file to add -addFavoriteSticker#13578cdf sticker:InputFile = Ok; - -//@description Removes a sticker from the list of favorite stickers -//@sticker Sticker file to delete from the list -removeFavoriteSticker#44b88c70 sticker:InputFile = Ok; - -//@description Returns emoji corresponding to a sticker. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -//@sticker Sticker file identifier -getStickerEmojis#8f04d547 sticker:InputFile = Emojis; - -//@description Searches for emojis by keywords. Supported only if the file database is enabled. Order of results is unspecified -//@text Text to search for -//@input_language_codes List of possible IETF language tags of the user's input language; may be empty if unknown -searchEmojis#d513cd61 text:string input_language_codes:vector = EmojiKeywords; - -//@description Return emojis matching the keyword. Supported only if the file database is enabled. Order of results is unspecified -//@text Text to search for -//@input_language_codes List of possible IETF language tags of the user's input language; may be empty if unknown -getKeywordEmojis#7af81263 text:string input_language_codes:vector = Emojis; - -//@description Returns available emoji categories -//@type Type of emoji categories to return; pass null to get default emoji categories -getEmojiCategories#7f86c16e type:EmojiCategoryType = EmojiCategories; - -//@description Returns an animated emoji corresponding to a given emoji. Returns a 404 error if the emoji has no animated emoji -//@emoji The emoji -getAnimatedEmoji#3f844f76 emoji:string = AnimatedEmoji; - -//@description Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation -//@language_code Language code for which the emoji replacements will be suggested -getEmojiSuggestionsUrl#ac4f1b2f language_code:string = HttpUrl; - -//@description Returns the list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned -//@custom_emoji_ids Identifiers of custom emoji stickers. At most 200 custom emoji stickers can be received simultaneously -getCustomEmojiStickers#a5156885 custom_emoji_ids:vector = Stickers; - -//@description Returns default list of custom emoji stickers for placing on a chat photo -getDefaultChatPhotoCustomEmojiStickers#e9917765 = Stickers; - -//@description Returns default list of custom emoji stickers for placing on a profile photo -getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7 = Stickers; - -//@description Returns default list of custom emoji stickers for reply background -getDefaultBackgroundCustomEmojiStickers#1cf6680e = Stickers; - -//@description Returns saved animations -getSavedAnimations#6b9718 = Animations; - -//@description Manually adds a new animation to the list of saved animations. The new animation is added to the beginning of the list. If the animation was already in the list, it is removed first. -//@animation The animation file to be added. Only animations known to the server (i.e., successfully sent via a message) can be added to the list -addSavedAnimation#a44bf860 animation:InputFile = Ok; - -//@description Removes an animation from the list of saved animations -//@animation Animation file to be removed -removeSavedAnimation#e275a919 animation:InputFile = Ok; - -//@description Returns up to 20 recently used inline bots in the order of their last usage -getRecentInlineBots#55b3723c = Users; - -//@description Returns the list of bots owned by the current user -getOwnedBots#8b87c7fd = Users; - -//@description Searches for recently used hashtags by their prefix -//@prefix Hashtag prefix to search for -//@limit The maximum number of hashtags to be returned -searchHashtags#3e34a571 prefix:string limit:int32 = Hashtags; - -//@description Removes a hashtag from the list of recently used hashtags -//@hashtag Hashtag to delete -removeRecentHashtag#c393a0a4 hashtag:string = Ok; - -//@description Returns a link preview by the text of a message. Do not call this function too often. Returns a 404 error if the text has no link preview -//@text Message text with formatting -//@link_preview_options Options to be used for generation of the link preview; pass null to use default link preview options -getLinkPreview#c2096321 text:formattedText link_preview_options:linkPreviewOptions = LinkPreview; - -//@description Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page -//@url The web page URL -//@force_full Pass true to get full instant view for the web page -getWebPageInstantView#8b045689 url:string force_full:Bool = WebPageInstantView; - -//@description Changes a profile photo for the current user -//@photo Profile photo to set -//@is_public Pass true to set a public photo, which will be visible even the main photo is hidden by privacy settings -setProfilePhoto#85ea05ed photo:InputChatPhoto is_public:Bool = Ok; - -//@description Deletes a profile photo -//@profile_photo_id Identifier of the profile photo to delete -deleteProfilePhoto#4eaa77c1 profile_photo_id:int64 = Ok; - -//@description Changes accent color and background custom emoji for the current user; for Telegram Premium users only -//@accent_color_id Identifier of the accent color to use -//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none -setAccentColor#6389cb39 accent_color_id:int32 background_custom_emoji_id:int64 = Ok; - -//@description Changes accent color and background custom emoji for profile of the current user; for Telegram Premium users only -//@profile_accent_color_id Identifier of the accent color to use for profile; pass -1 if none -//@profile_background_custom_emoji_id Identifier of a custom emoji to be shown on the user's profile photo background; 0 if none -setProfileAccentColor#899bc168 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 = Ok; - -//@description Changes the first and last name of the current user -//@first_name The new value of the first name for the current user; 1-64 characters -//@last_name The new value of the optional last name for the current user; 0-64 characters -setName#66065f10 first_name:string last_name:string = Ok; - -//@description Changes the bio of the current user -//@bio The new value of the user bio; 0-getOption("bio_length_max") characters without line feeds -setBio#9f772354 bio:string = Ok; - -//@description Changes the editable username of the current user -//@username The new value of the username. Use an empty string to remove the username. The username can't be completely removed if there is another active or disabled username -setUsername#1a385c1e username:string = Ok; - -//@description Changes active state for a username of the current user. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached -//@username The username to change -//@is_active Pass true to activate the username; pass false to disable it -toggleUsernameIsActive#4a276de3 username:string is_active:Bool = Ok; - -//@description Changes order of active usernames of the current user -//@usernames The new order of active usernames. All currently active usernames must be specified -reorderActiveUsernames#c659414f usernames:vector = Ok; - -//@description Changes the birthdate of the current user -//@birthdate The new value of the current user's birthdate; pass null to remove the birthdate -setBirthdate#4ea9dd98 birthdate:birthdate = Ok; - -//@description Changes the personal chat of the current user -//@chat_id Identifier of the new personal chat; pass 0 to remove the chat. Use getSuitablePersonalChats to get suitable chats -setPersonalChat#c04babb4 chat_id:int53 = Ok; - -//@description Changes the emoji status of the current user; for Telegram Premium users only -//@emoji_status New emoji status; pass null to switch to the default badge -setEmojiStatus#92f83e5d emoji_status:emojiStatus = Ok; - -//@description Toggles whether the current user has sponsored messages enabled. The setting has no effect for users without Telegram Premium for which sponsored messages are always enabled -//@has_sponsored_messages_enabled Pass true to enable sponsored messages for the current user; false to disable them -toggleHasSponsoredMessagesEnabled#75055cec has_sponsored_messages_enabled:Bool = Ok; - -//@description Changes the business location of the current user. Requires Telegram Business subscription -//@location The new location of the business; pass null to remove the location -setBusinessLocation#eb740715 location:businessLocation = Ok; - -//@description Changes the business opening hours of the current user. Requires Telegram Business subscription -//@opening_hours The new opening hours of the business; pass null to remove the opening hours; up to 28 time intervals can be specified -setBusinessOpeningHours#e470a472 opening_hours:businessOpeningHours = Ok; - -//@description Changes the business greeting message settings of the current user. Requires Telegram Business subscription -//@greeting_message_settings The new settings for the greeting message of the business; pass null to disable the greeting message -setBusinessGreetingMessageSettings#cbf53c3d greeting_message_settings:businessGreetingMessageSettings = Ok; - -//@description Changes the business away message settings of the current user. Requires Telegram Business subscription -//@away_message_settings The new settings for the away message of the business; pass null to disable the away message -setBusinessAwayMessageSettings#4974486c away_message_settings:businessAwayMessageSettings = Ok; - -//@description Changes the business start page of the current user. Requires Telegram Business subscription -//@start_page The new start page of the business; pass null to remove custom start page -setBusinessStartPage#9eed499e start_page:inputBusinessStartPage = Ok; - -//@description Sends a code to the specified phone number. Aborts previous phone number verification if there was one. On success, returns information about the sent code -//@phone_number The phone number, in international format -//@settings Settings for the authentication of the user's phone number; pass null to use default settings -//@type Type of the request for which the code is sent -sendPhoneNumberCode#409e3d10 phone_number:string settings:phoneNumberAuthenticationSettings type:PhoneNumberCodeType = AuthenticationCodeInfo; - -//@description Sends Firebase Authentication SMS to the specified phone number. Works only when received a code of the type authenticationCodeTypeFirebaseAndroid or authenticationCodeTypeFirebaseIos -//@token Play Integrity API or SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application -sendPhoneNumberFirebaseSms#f9c7084 token:string = Ok; - -//@description Reports that authentication code wasn't delivered via SMS to the specified phone number; for official mobile applications only -//@mobile_network_code Current mobile network code -reportPhoneNumberCodeMissing#caa4b553 mobile_network_code:string = Ok; - -//@description Resends the authentication code sent to a phone number. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed -//@reason Reason of code resending; pass null if unknown -resendPhoneNumberCode#6bcea427 reason:ResendCodeReason = AuthenticationCodeInfo; - -//@description Check the authentication code and completes the request for which the code was sent if appropriate -//@code Authentication code to check -checkPhoneNumberCode#dc0565a1 code:string = Ok; - -//@description Returns the business bot that is connected to the current user account. Returns a 404 error if there is no connected bot -getBusinessConnectedBot#364da7c3 = BusinessConnectedBot; - -//@description Adds or changes business bot that is connected to the current user account -//@bot Connection settings for the bot -setBusinessConnectedBot#acf17ef0 bot:businessConnectedBot = Ok; - -//@description Deletes the business bot that is connected to the current user account -//@bot_user_id Unique user identifier for the bot -deleteBusinessConnectedBot#9e9b7e55 bot_user_id:int53 = Ok; - -//@description Pauses or resumes the connected business bot in a specific chat -//@chat_id Chat identifier -//@is_paused Pass true to pause the connected bot in the chat; pass false to resume the bot -toggleBusinessConnectedBotChatIsPaused#4f364845 chat_id:int53 is_paused:Bool = Ok; - -//@description Removes the connected business bot from a specific chat by adding the chat to businessRecipients.excluded_chat_ids -//@chat_id Chat identifier -removeBusinessConnectedBotFromChat#787273f3 chat_id:int53 = Ok; - -//@description Returns business chat links created for the current account -getBusinessChatLinks#2a562157 = BusinessChatLinks; - -//@description Creates a business chat link for the current account. Requires Telegram Business subscription. There can be up to getOption("business_chat_link_count_max") links created. Returns the created link -//@link_info Information about the link to create -createBusinessChatLink#91131d40 link_info:inputBusinessChatLink = BusinessChatLink; - -//@description Edits a business chat link of the current account. Requires Telegram Business subscription. Returns the edited link -//@link The link to edit -//@link_info New description of the link -editBusinessChatLink#5f10f626 link:string link_info:inputBusinessChatLink = BusinessChatLink; - -//@description Deletes a business chat link of the current account -//@link The link to delete -deleteBusinessChatLink#be526747 link:string = Ok; - -//@description Returns information about a business chat link -//@link_name Name of the link -getBusinessChatLinkInfo#2f8b7e4a link_name:string = BusinessChatLinkInfo; - -//@description Returns an HTTPS link, which can be used to get information about the current user -getUserLink#492014e6 = UserLink; - -//@description Searches a user by a token from the user's link -//@token Token to search for -searchUserByToken#d841f436 token:string = User; - -//@description Sets the list of commands supported by the bot for the given user scope and language; for bots only -//@scope The scope to which the commands are relevant; pass null to change commands in the default bot command scope -//@language_code A two-letter ISO 639-1 language code. If empty, the commands will be applied to all users from the given scope, for which language there are no dedicated commands -//@commands List of the bot's commands -setCommands#b0e0217a scope:BotCommandScope language_code:string commands:vector = Ok; - -//@description Deletes commands supported by the bot for the given user scope and language; for bots only -//@scope The scope to which the commands are relevant; pass null to delete commands in the default bot command scope -//@language_code A two-letter ISO 639-1 language code or an empty string -deleteCommands#3bc47c2a scope:BotCommandScope language_code:string = Ok; - -//@description Returns the list of commands supported by the bot for the given user scope and language; for bots only -//@scope The scope to which the commands are relevant; pass null to get commands in the default bot command scope -//@language_code A two-letter ISO 639-1 language code or an empty string -getCommands#58ba8ff7 scope:BotCommandScope language_code:string = BotCommands; - -//@description Sets menu button for the given user or for all users; for bots only -//@user_id Identifier of the user or 0 to set menu button for all users -//@menu_button New menu button -setMenuButton#b44fc141 user_id:int53 menu_button:botMenuButton = Ok; - -//@description Returns menu button set by the bot for the given user; for bots only -//@user_id Identifier of the user or 0 to get the default menu button -getMenuButton#e5eef440 user_id:int53 = BotMenuButton; - -//@description Sets default administrator rights for adding the bot to basic group and supergroup chats; for bots only -//@default_group_administrator_rights Default administrator rights for adding the bot to basic group and supergroup chats; pass null to remove default rights -setDefaultGroupAdministratorRights#65577768 default_group_administrator_rights:chatAdministratorRights = Ok; - -//@description Sets default administrator rights for adding the bot to channel chats; for bots only -//@default_channel_administrator_rights Default administrator rights for adding the bot to channels; pass null to remove default rights -setDefaultChannelAdministratorRights#f20d5e19 default_channel_administrator_rights:chatAdministratorRights = Ok; - -//@description Checks whether the specified bot can send messages to the user. Returns a 404 error if can't and the access can be granted by call to allowBotToSendMessages -//@bot_user_id Identifier of the target bot -canBotSendMessages#206d948c bot_user_id:int53 = Ok; - -//@description Allows the specified bot to send messages to the user -//@bot_user_id Identifier of the target bot -allowBotToSendMessages#69e9c58e bot_user_id:int53 = Ok; - -//@description Sends a custom request from a Web App -//@bot_user_id Identifier of the bot -//@method The method name -//@parameters JSON-serialized method parameters -sendWebAppCustomRequest#36ff5dc8 bot_user_id:int53 method:string parameters:string = CustomRequestResult; - -//@description Returns the list of media previews of a bot -//@bot_user_id Identifier of the target bot. The bot must have the main Web App -getBotMediaPreviews#22665458 bot_user_id:int53 = BotMediaPreviews; - -//@description Returns the list of media previews for the given language and the list of languages for which the bot has dedicated previews -//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App -//@language_code A two-letter ISO 639-1 language code for which to get previews. If empty, then default previews are returned -getBotMediaPreviewInfo#50f60136 bot_user_id:int53 language_code:string = BotMediaPreviewInfo; - -//@description Adds a new media preview to the beginning of the list of media previews of a bot. Returns the added preview after addition is completed server-side. The total number of previews must not exceed getOption("bot_media_preview_count_max") for the given language -//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App -//@language_code A two-letter ISO 639-1 language code for which preview is added. If empty, then the preview will be shown to all users for whose languages there are no dedicated previews. -//@content Content of the added preview -addBotMediaPreview#504b852b bot_user_id:int53 language_code:string content:InputStoryContent = BotMediaPreview; - -//@description Replaces media preview in the list of media previews of a bot. Returns the new preview after edit is completed server-side -//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App -//@language_code Language code of the media preview to edit -//@file_id File identifier of the media to replace -//@content Content of the new preview -editBotMediaPreview#86955d62 bot_user_id:int53 language_code:string file_id:int32 content:InputStoryContent = BotMediaPreview; - -//@description Changes order of media previews in the list of media previews of a bot -//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App -//@language_code Language code of the media previews to reorder -//@file_ids File identifiers of the media in the new order -reorderBotMediaPreviews#89ea0cc6 bot_user_id:int53 language_code:string file_ids:vector = Ok; - -//@description Delete media previews from the list of media previews of a bot -//@bot_user_id Identifier of the target bot. The bot must be owned and must have the main Web App -//@language_code Language code of the media previews to delete -//@file_ids File identifiers of the media to delete -deleteBotMediaPreviews#f7d259db bot_user_id:int53 language_code:string file_ids:vector = Ok; - -//@description Sets the name of a bot. Can be called only if userTypeBot.can_be_edited == true -//@bot_user_id Identifier of the target bot -//@language_code A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose languages there is no dedicated name -//@name New bot's name on the specified language; 0-64 characters; must be non-empty if language code is empty -setBotName#d295fa71 bot_user_id:int53 language_code:string name:string = Ok; - -//@description Returns the name of a bot in the given language. Can be called only if userTypeBot.can_be_edited == true -//@bot_user_id Identifier of the target bot -//@language_code A two-letter ISO 639-1 language code or an empty string -getBotName#9a3f722c bot_user_id:int53 language_code:string = Text; - -//@description Changes a profile photo for a bot -//@bot_user_id Identifier of the target bot -//@photo Profile photo to set; pass null to delete the chat photo -setBotProfilePhoto#bd864b66 bot_user_id:int53 photo:InputChatPhoto = Ok; - -//@description Changes active state for a username of a bot. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached. Can be called only if userTypeBot.can_be_edited == true -//@bot_user_id Identifier of the target bot -//@username The username to change -//@is_active Pass true to activate the username; pass false to disable it -toggleBotUsernameIsActive#79639409 bot_user_id:int53 username:string is_active:Bool = Ok; - -//@description Changes order of active usernames of a bot. Can be called only if userTypeBot.can_be_edited == true -//@bot_user_id Identifier of the target bot -//@usernames The new order of active usernames. All currently active usernames must be specified -reorderBotActiveUsernames#acadc444 bot_user_id:int53 usernames:vector = Ok; - -//@description Sets the text shown in the chat with a bot if the chat is empty. Can be called only if userTypeBot.can_be_edited == true -//@bot_user_id Identifier of the target bot -//@language_code A two-letter ISO 639-1 language code. If empty, the description will be shown to all users for whose languages there is no dedicated description -//@param_description New bot's description on the specified language -setBotInfoDescription#29571d48 bot_user_id:int53 language_code:string description:string = Ok; - -//@description Returns the text shown in the chat with a bot if the chat is empty in the given language. Can be called only if userTypeBot.can_be_edited == true -//@bot_user_id Identifier of the target bot -//@language_code A two-letter ISO 639-1 language code or an empty string -getBotInfoDescription#d287f835 bot_user_id:int53 language_code:string = Text; - -//@description Sets the text shown on a bot's profile page and sent together with the link when users share the bot. Can be called only if userTypeBot.can_be_edited == true -//@bot_user_id Identifier of the target bot -//@language_code A two-letter ISO 639-1 language code. If empty, the short description will be shown to all users for whose languages there is no dedicated description -//@short_description New bot's short description on the specified language -setBotInfoShortDescription#3a96bae3 bot_user_id:int53 language_code:string short_description:string = Ok; - -//@description Returns the text shown on a bot's profile page and sent together with the link when users share the bot in the given language. Can be called only if userTypeBot.can_be_edited == true -//@bot_user_id Identifier of the target bot -//@language_code A two-letter ISO 639-1 language code or an empty string -getBotInfoShortDescription#4a1c2614 bot_user_id:int53 language_code:string = Text; - -//@description Changes the verification status of a user or a chat by an owned bot -//@bot_user_id Identifier of the owned bot, which will verify the user or the chat -//@verified_id Identifier of the user or the supergroup or channel chat, which will be verified by the bot -//@custom_description Custom description of verification reason; 0-getOption("bot_verification_custom_description_length_max"). -setMessageSenderBotVerification#b4c1da4a bot_user_id:int53 verified_id:MessageSender custom_description:string = Ok; - -//@description Removes the verification status of a user or a chat by an owned bot -//@bot_user_id Identifier of the owned bot, which verified the user or the chat -//@verified_id Identifier of the user or the supergroup or channel chat, which verification is removed -removeMessageSenderBotVerification#9a10cf5a bot_user_id:int53 verified_id:MessageSender = Ok; - -//@description Returns all active sessions of the current user -getActiveSessions#42bd6d3e = Sessions; - -//@description Terminates a session of the current user -//@session_id Session identifier -terminateSession#e7b7c92c session_id:int64 = Ok; - -//@description Terminates all other sessions of the current user -terminateAllOtherSessions#6fba6113 = Ok; - -//@description Confirms an unconfirmed session of the current user from another device -//@session_id Session identifier -confirmSession#d7c9b41f session_id:int64 = Ok; - -//@description Toggles whether a session can accept incoming calls -//@session_id Session identifier -//@can_accept_calls Pass true to allow accepting incoming calls by the session; pass false otherwise -toggleSessionCanAcceptCalls#6c6c2708 session_id:int64 can_accept_calls:Bool = Ok; - -//@description Toggles whether a session can accept incoming secret chats -//@session_id Session identifier -//@can_accept_secret_chats Pass true to allow accepting secret chats by the session; pass false otherwise -toggleSessionCanAcceptSecretChats#3ba7a87e session_id:int64 can_accept_secret_chats:Bool = Ok; - -//@description Changes the period of inactivity after which sessions will automatically be terminated -//@inactive_session_ttl_days New number of days of inactivity before sessions will be automatically terminated; 1-366 days -setInactiveSessionTtl#5d9ca950 inactive_session_ttl_days:int32 = Ok; - -//@description Returns all website where the current user used Telegram to log in -getConnectedWebsites#f5d5d352 = ConnectedWebsites; - -//@description Disconnects website from the current user's Telegram account -//@website_id Website identifier -disconnectWebsite#d194f3dd website_id:int64 = Ok; - -//@description Disconnects all websites from the current user's Telegram account -disconnectAllWebsites#bf72f203 = Ok; - -//@description Changes the editable username of a supergroup or channel, requires owner privileges in the supergroup or channel -//@supergroup_id Identifier of the supergroup or channel -//@username New value of the username. Use an empty string to remove the username. The username can't be completely removed if there is another active or disabled username -setSupergroupUsername#503f4b04 supergroup_id:int53 username:string = Ok; - -//@description Changes active state for a username of a supergroup or channel, requires owner privileges in the supergroup or channel. The editable username can't be disabled. -//@supergroup_id Identifier of the supergroup or channel -//@username The username to change -//@is_active Pass true to activate the username; pass false to disable it -toggleSupergroupUsernameIsActive#a68b6dff supergroup_id:int53 username:string is_active:Bool = Ok; - -//@description Disables all active non-editable usernames of a supergroup or channel, requires owner privileges in the supergroup or channel -//@supergroup_id Identifier of the supergroup or channel -disableAllSupergroupUsernames#3246f5b0 supergroup_id:int53 = Ok; - -//@description Changes order of active usernames of a supergroup or channel, requires owner privileges in the supergroup or channel -//@supergroup_id Identifier of the supergroup or channel -//@usernames The new order of active usernames. All currently active usernames must be specified -reorderSupergroupActiveUsernames#663c7f3b supergroup_id:int53 usernames:vector = Ok; - -//@description Changes the sticker set of a supergroup; requires can_change_info administrator right -//@supergroup_id Identifier of the supergroup -//@sticker_set_id New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set -setSupergroupStickerSet#856ead69 supergroup_id:int53 sticker_set_id:int64 = Ok; - -//@description Changes the custom emoji sticker set of a supergroup; requires can_change_info administrator right. The chat must have at least chatBoostFeatures.min_custom_emoji_sticker_set_boost_level boost level to pass the corresponding color -//@supergroup_id Identifier of the supergroup -//@custom_emoji_sticker_set_id New value of the custom emoji sticker set identifier for the supergroup. Use 0 to remove the custom emoji sticker set in the supergroup -setSupergroupCustomEmojiStickerSet#4f3552af supergroup_id:int53 custom_emoji_sticker_set_id:int64 = Ok; - -//@description Changes the number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; requires can_restrict_members administrator right -//@supergroup_id Identifier of the supergroup -//@unrestrict_boost_count New value of the unrestrict_boost_count supergroup setting; 0-8. Use 0 to remove the setting -setSupergroupUnrestrictBoostCount#39ce30a3 supergroup_id:int53 unrestrict_boost_count:int32 = Ok; - -//@description Toggles whether sender signature or link to the account is added to sent messages in a channel; requires can_change_info member right -//@supergroup_id Identifier of the channel -//@sign_messages New value of sign_messages -//@show_message_sender New value of show_message_sender -toggleSupergroupSignMessages#221c1fcb supergroup_id:int53 sign_messages:Bool show_message_sender:Bool = Ok; - -//@description Toggles whether joining is mandatory to send messages to a discussion supergroup; requires can_restrict_members administrator right -//@supergroup_id Identifier of the supergroup that isn't a broadcast group -//@join_to_send_messages New value of join_to_send_messages -toggleSupergroupJoinToSendMessages#f5268e0e supergroup_id:int53 join_to_send_messages:Bool = Ok; - -//@description Toggles whether all users directly joining the supergroup need to be approved by supergroup administrators; requires can_restrict_members administrator right -//@supergroup_id Identifier of the supergroup that isn't a broadcast group -//@join_by_request New value of join_by_request -toggleSupergroupJoinByRequest#7ddf9fde supergroup_id:int53 join_by_request:Bool = Ok; - -//@description Toggles whether the message history of a supergroup is available to new members; requires can_change_info member right -//@supergroup_id The identifier of the supergroup -//@is_all_history_available The new value of is_all_history_available -toggleSupergroupIsAllHistoryAvailable#44d9964e supergroup_id:int53 is_all_history_available:Bool = Ok; - -//@description Toggles whether sponsored messages are shown in the channel chat; requires owner privileges in the channel. The chat must have at least chatBoostFeatures.min_sponsored_message_disable_boost_level boost level to disable sponsored messages -//@supergroup_id The identifier of the channel -//@can_have_sponsored_messages The new value of can_have_sponsored_messages -toggleSupergroupCanHaveSponsoredMessages#be8abb72 supergroup_id:int53 can_have_sponsored_messages:Bool = Ok; - -//@description Toggles whether non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers. Can be called only if supergroupFullInfo.can_hide_members == true -//@supergroup_id Identifier of the supergroup -//@has_hidden_members New value of has_hidden_members -toggleSupergroupHasHiddenMembers#a4559dca supergroup_id:int53 has_hidden_members:Bool = Ok; - -//@description Toggles whether aggressive anti-spam checks are enabled in the supergroup. Can be called only if supergroupFullInfo.can_toggle_aggressive_anti_spam == true -//@supergroup_id The identifier of the supergroup, which isn't a broadcast group -//@has_aggressive_anti_spam_enabled The new value of has_aggressive_anti_spam_enabled -toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f supergroup_id:int53 has_aggressive_anti_spam_enabled:Bool = Ok; - -//@description Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums -//@supergroup_id Identifier of the supergroup -//@is_forum New value of is_forum -toggleSupergroupIsForum#966f960a supergroup_id:int53 is_forum:Bool = Ok; - -//@description Upgrades supergroup to a broadcast group; requires owner privileges in the supergroup -//@supergroup_id Identifier of the supergroup -toggleSupergroupIsBroadcastGroup#34b22215 supergroup_id:int53 = Ok; - -//@description Reports messages in a supergroup as spam; requires administrator rights in the supergroup -//@supergroup_id Supergroup identifier -//@message_ids Identifiers of messages to report. Use messageProperties.can_report_supergroup_spam to check whether the message can be reported -reportSupergroupSpam#383e26f2 supergroup_id:int53 message_ids:vector = Ok; - -//@description Reports a false deletion of a message by aggressive anti-spam checks; requires administrator rights in the supergroup. Can be called only for messages from chatEventMessageDeleted with can_report_anti_spam_false_positive == true -//@supergroup_id Supergroup identifier -//@message_id Identifier of the erroneously deleted message from chatEventMessageDeleted -reportSupergroupAntiSpamFalsePositive#e13db048 supergroup_id:int53 message_id:int53 = Ok; - -//@description Returns information about members or banned users in a supergroup or channel. Can be used only if supergroupFullInfo.can_get_members == true; additionally, administrator privileges may be required for some filters -//@supergroup_id Identifier of the supergroup or channel -//@filter The type of users to return; pass null to use supergroupMembersFilterRecent -//@offset Number of users to skip -//@limit The maximum number of users to be returned; up to 200 -getSupergroupMembers#ddf821c8 supergroup_id:int53 filter:SupergroupMembersFilter offset:int32 limit:int32 = ChatMembers; - -//@description Closes a secret chat, effectively transferring its state to secretChatStateClosed -//@secret_chat_id Secret chat identifier -closeSecretChat#e3ed044b secret_chat_id:int32 = Ok; - -//@description Returns a list of service actions taken by chat members and administrators in the last 48 hours. Available only for supergroups and channels. Requires administrator rights. Returns results in reverse chronological order (i.e., in order of decreasing event_id) -//@chat_id Chat identifier -//@query Search query by which to filter events -//@from_event_id Identifier of an event from which to return results. Use 0 to get results from the latest events -//@limit The maximum number of events to return; up to 100 -//@filters The types of events to return; pass null to get chat events of all types -//@user_ids User identifiers by which to filter events. By default, events relating to all users will be returned -getChatEventLog#f47b0a9b chat_id:int53 query:string from_event_id:int64 limit:int32 filters:chatEventLogFilters user_ids:vector = ChatEvents; - -//@description Returns the list of supported time zones -getTimeZones#4fe2e058 = TimeZones; - -//@description Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy, or wants to buy access to media in a messagePaidMedia message -//@input_invoice The invoice -//@theme Preferred payment form theme; pass null to use the default theme -getPaymentForm#8d4f76d4 input_invoice:InputInvoice theme:themeParameters = PaymentForm; - -//@description Validates the order information provided by a user and returns the available shipping options for a flexible invoice -//@input_invoice The invoice -//@order_info The order information, provided by the user; pass null if empty -//@allow_save Pass true to save the order information -validateOrderInfo#b5985fcf input_invoice:InputInvoice order_info:orderInfo allow_save:Bool = ValidatedOrderInfo; - -//@description Sends a filled-out payment form to the bot for final verification -//@input_invoice The invoice -//@payment_form_id Payment form identifier returned by getPaymentForm -//@order_info_id Identifier returned by validateOrderInfo, or an empty string -//@shipping_option_id Identifier of a chosen shipping option, if applicable -//@credentials The credentials chosen by user for payment; pass null for a payment in Telegram Stars -//@tip_amount Chosen by the user amount of tip in the smallest units of the currency -sendPaymentForm#c66e388a input_invoice:InputInvoice payment_form_id:int64 order_info_id:string shipping_option_id:string credentials:InputCredentials tip_amount:int53 = PaymentResult; - -//@description Returns information about a successful payment -//@chat_id Chat identifier of the messagePaymentSuccessful message -//@message_id Message identifier -getPaymentReceipt#3c6cb956 chat_id:int53 message_id:int53 = PaymentReceipt; - -//@description Returns saved order information. Returns a 404 error if there is no saved order information -getSavedOrderInfo#bb559edd = OrderInfo; - -//@description Deletes saved order information -deleteSavedOrderInfo#61197474 = Ok; - -//@description Deletes saved credentials for all payment provider bots -deleteSavedCredentials#314056d2 = Ok; - -//@description Returns gifts that can be sent to other users -getAvailableGifts#f6d565eb = Gifts; - -//@description Sends a gift to another user. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out -//@gift_id Identifier of the gift to send -//@user_id Identifier of the user that will receive the gift -//@text Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed -//@is_private Pass true to show the current user as sender and gift text only to the gift receiver; otherwise, everyone will be able to see them -//@pay_for_upgrade Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free -sendGift#13a97db gift_id:int64 user_id:int53 text:formattedText is_private:Bool pay_for_upgrade:Bool = Ok; - -//@description Sells a gift received by the current user for Telegram Stars -//@sender_user_id Identifier of the user that sent the gift -//@message_id Identifier of the message with the gift in the chat with the user -sellGift#671b88b4 sender_user_id:int53 message_id:int53 = Ok; - -//@description Toggles whether a gift is shown on the current user's profile page -//@sender_user_id Identifier of the user that sent the gift -//@message_id Identifier of the message with the gift in the chat with the user -//@is_saved Pass true to display the gift on the user's profile page; pass false to remove it from the profile page -toggleGiftIsSaved#91c2f183 sender_user_id:int53 message_id:int53 is_saved:Bool = Ok; - -//@description Returns examples of possible upgraded gifts for a regular gift -//@gift_id Identifier of the gift -getGiftUpgradePreview#bdcbc25d gift_id:int64 = GiftUpgradePreview; - -//@description Upgrades a gift received by the current user. Unless the gift has prepaid_upgrade_star_count > 0, the user must pay gift.upgrade_star_count Telegram Stars for the upgrade -//@sender_user_id Identifier of the user that sent the gift -//@message_id Identifier of the message with the gift in the chat with the user -//@keep_original_details Pass true to keep the original gift text, sender and receiver in the upgraded gift -upgradeGift#e0c0953e sender_user_id:int53 message_id:int53 keep_original_details:Bool = UpgradeGiftResult; - -//@description Sends a gift upgraded by the current user to another user -//@sender_user_id Identifier of the user that sent the gift -//@message_id Identifier of the message with the upgraded gift in the chat with the user -//@receiver_user_id Identifier of the user that will receive the gift -//@star_count The amount of Telegram Stars required for the transfer -transferGift#7f379a4e sender_user_id:int53 message_id:int53 receiver_user_id:int53 star_count:int53 = Ok; - -//@description Returns gifts saved to profile by the given user -//@user_id Identifier of the user -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit -getUserGifts#b7cdbc7c user_id:int53 offset:string limit:int32 = UserGifts; - -//@description Returns information about a gift received or sent by the current user -//@message_id Identifier of the message with the gift -getUserGift#74e6a939 message_id:int53 = UserGift; - -//@description Creates a link for the given invoice; for bots only -//@business_connection_id Unique identifier of business connection on behalf of which to send the request -//@invoice Information about the invoice of the type inputMessageInvoice -createInvoiceLink#cf70c867 business_connection_id:string invoice:InputMessageContent = HttpUrl; - -//@description Refunds a previously done payment in Telegram Stars; for bots only -//@user_id Identifier of the user that did the payment -//@telegram_payment_charge_id Telegram payment identifier -refundStarPayment#9476a055 user_id:int53 telegram_payment_charge_id:string = Ok; - -//@description Returns a user that can be contacted to get support -getSupportUser#98acec9c = User; - -//@description Constructs a persistent HTTP URL for a background -//@name Background name -//@type Background type; backgroundTypeChatTheme isn't supported -getBackgroundUrl#2bbc6fd2 name:string type:BackgroundType = HttpUrl; - -//@description Searches for a background by its name -//@name The name of the background -searchBackground#80fb9121 name:string = Background; - -//@description Sets default background for chats; adds the background to the list of installed backgrounds -//@background The input background to use; pass null to create a new filled background -//@type Background type; pass null to use the default type of the remote background; backgroundTypeChatTheme isn't supported -//@for_dark_theme Pass true if the background is set for a dark theme -setDefaultBackground#89d1a8a1 background:InputBackground type:BackgroundType for_dark_theme:Bool = Background; - -//@description Deletes default background for chats -//@for_dark_theme Pass true if the background is deleted for a dark theme -deleteDefaultBackground#b2a4ed3e for_dark_theme:Bool = Ok; - -//@description Returns backgrounds installed by the user -//@for_dark_theme Pass true to order returned backgrounds for a dark theme -getInstalledBackgrounds#c154d05f for_dark_theme:Bool = Backgrounds; - -//@description Removes background from the list of installed backgrounds -//@background_id The background identifier -removeInstalledBackground#5041253c background_id:int64 = Ok; - -//@description Resets list of installed backgrounds to its default value -resetInstalledBackgrounds#70540157 = Ok; - -//@description Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization -//@only_local Pass true to get only locally available information without sending network requests -getLocalizationTargetInfo#6e3d1f86 only_local:Bool = LocalizationTargetInfo; - -//@description Returns information about a language pack. Returned language pack identifier may be different from a provided one. Can be called before authorization -//@language_pack_id Language pack identifier -getLanguagePackInfo#7bd8daa8 language_pack_id:string = LanguagePackInfo; - -//@description Returns strings from a language pack in the current localization target by their keys. Can be called before authorization -//@language_pack_id Language pack identifier of the strings to be returned -//@keys Language pack keys of the strings to be returned; leave empty to request all available strings -getLanguagePackStrings#b0b867bb language_pack_id:string keys:vector = LanguagePackStrings; - -//@description Fetches the latest versions of all strings from a language pack in the current localization target from the server. -//@language_pack_id Language pack identifier -synchronizeLanguagePack#84e5e72e language_pack_id:string = Ok; - -//@description Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization -//@language_pack_id Identifier of a language pack to be added -addCustomServerLanguagePack#448de3 language_pack_id:string = Ok; - -//@description Adds or changes a custom local language pack to the current localization target -//@info Information about the language pack. Language pack identifier must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization -//@strings Strings of the new language pack -setCustomLanguagePack#234b0607 info:languagePackInfo strings:vector = Ok; - -//@description Edits information about a custom local language pack in the current localization target. Can be called before authorization -//@info New information about the custom local language pack -editCustomLanguagePackInfo#4eb91099 info:languagePackInfo = Ok; - -//@description Adds, edits or deletes a string in a custom local language pack. Can be called before authorization -//@language_pack_id Identifier of a previously added custom local language pack in the current localization target -//@new_string New language pack string -setCustomLanguagePackString#4e762518 language_pack_id:string new_string:languagePackString = Ok; - -//@description Deletes all information about a language pack in the current localization target. The language pack which is currently in use (including base language pack) or is being synchronized can't be deleted. -//@language_pack_id Identifier of the language pack to delete -deleteLanguagePack#824edc3e language_pack_id:string = Ok; - -//@description Registers the currently used device for receiving push notifications. Returns a globally unique identifier of the push notification subscription -//@device_token Device token -//@other_user_ids List of user identifiers of other users currently using the application -registerDevice#ff140196 device_token:DeviceToken other_user_ids:vector = PushReceiverId; - -//@description Handles a push notification. Returns error with code 406 if the push notification is not supported and connection to the server is required to fetch new data. Can be called before authorization -//@payload JSON-encoded push notification payload with all fields sent by the server, and "google.sent_time" and "google.notification.sound" fields added -processPushNotification#2ee3c890 payload:string = Ok; - -//@description Returns a globally unique push notification subscription identifier for identification of an account, which has received a push notification. Can be called synchronously -//@payload JSON-encoded push notification payload -getPushReceiverId#eeec46b2 payload:string = PushReceiverId; - -//@description Returns t.me URLs recently visited by a newly registered user -//@referrer Google Play referrer to identify the user -getRecentlyVisitedTMeUrls#30161a91 referrer:string = TMeUrls; - -//@description Changes user privacy settings -//@setting The privacy setting -//@rules The new privacy rules -setUserPrivacySettingRules#e3c230fb setting:UserPrivacySetting rules:userPrivacySettingRules = Ok; - -//@description Returns the current privacy settings -//@setting The privacy setting -getUserPrivacySettingRules#84301671 setting:UserPrivacySetting = UserPrivacySettingRules; - -//@description Changes privacy settings for message read date -//@settings New settings -setReadDatePrivacySettings#1d7086b6 settings:readDatePrivacySettings = Ok; - -//@description Returns privacy settings for message read date -getReadDatePrivacySettings#1ae85bbb = ReadDatePrivacySettings; - -//@description Changes privacy settings for new chat creation; can be used only if getOption("can_set_new_chat_privacy_settings") -//@settings New settings -setNewChatPrivacySettings#69bf374f settings:newChatPrivacySettings = Ok; - -//@description Returns privacy settings for new chat creation -getNewChatPrivacySettings#b2cb4bb7 = NewChatPrivacySettings; - -//@description Check whether the current user can message another user or try to create a chat with them -//@user_id Identifier of the other user -//@only_local Pass true to get only locally available information without sending network requests -canSendMessageToUser#5b2a2836 user_id:int53 only_local:Bool = CanSendMessageToUserResult; - -//@description Returns the value of an option by its name. (Check the list of available options on https://core.telegram.org/tdlib/options.) Can be called before authorization. Can be called synchronously for options "version" and "commit_hash" -//@name The name of the option -getOption#a2459e7e name:string = OptionValue; - -//@description Sets the value of an option. (Check the list of available options on https://core.telegram.org/tdlib/options.) Only writable options can be set. Can be called before authorization -//@name The name of the option -//@value The new value of the option; pass null to reset option value to a default value -setOption#7e0b4ef2 name:string value:OptionValue = Ok; - -//@description Changes the period of inactivity after which the account of the current user will automatically be deleted -//@ttl New account TTL -setAccountTtl#29ce58e8 ttl:accountTtl = Ok; - -//@description Returns the period of inactivity after which the account of the current user will automatically be deleted -getAccountTtl#e58a8b77 = AccountTtl; - -//@description Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account. -//@reason The reason why the account was deleted; optional -//@password The 2-step verification password of the current user. If the current user isn't authorized, then an empty string can be passed and account deletion can be canceled within one week -deleteAccount#533276c6 reason:string password:string = Ok; - -//@description Changes the default message auto-delete time for new chats -//@message_auto_delete_time New default message auto-delete time; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically -setDefaultMessageAutoDeleteTime#965cd36c message_auto_delete_time:messageAutoDeleteTime = Ok; - -//@description Returns default message auto-delete time setting for new chats -getDefaultMessageAutoDeleteTime#e520759a = MessageAutoDeleteTime; - -//@description Removes a chat action bar without any other action -//@chat_id Chat identifier -removeChatActionBar#9d9839fa chat_id:int53 = Ok; - -//@description Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if chat.can_be_reported -//@chat_id Chat identifier -//@option_id Option identifier chosen by the user; leave empty for the initial request -//@message_ids Identifiers of reported messages. Use messageProperties.can_report_chat to check whether the message can be reported -//@text Additional report details if asked by the server; 0-1024 characters; leave empty for the initial request -reportChat#54f7972f chat_id:int53 option_id:bytes message_ids:vector text:string = ReportChatResult; - -//@description Reports a chat photo to the Telegram moderators. A chat photo can be reported only if chat.can_be_reported -//@chat_id Chat identifier -//@file_id Identifier of the photo to report. Only full photos from chatPhoto can be reported -//@reason The reason for reporting the chat photo -//@text Additional report details; 0-1024 characters -reportChatPhoto#d9701288 chat_id:int53 file_id:int32 reason:ReportReason text:string = Ok; - -//@description Reports reactions set on a message to the Telegram moderators. Reactions on a message can be reported only if messageProperties.can_report_reactions -//@chat_id Chat identifier -//@message_id Message identifier -//@sender_id Identifier of the sender, which added the reaction -reportMessageReactions#36c88827 chat_id:int53 message_id:int53 sender_id:MessageSender = Ok; - -//@description Returns detailed revenue statistics about a chat. Currently, this method can be used only -//@chat_id Chat identifier -//@is_dark Pass true if a dark theme is used by the application -getChatRevenueStatistics#29d79b3c chat_id:int53 is_dark:Bool = ChatRevenueStatistics; - -//@description Returns a URL for chat revenue withdrawal; requires owner privileges in the channel chat or the bot. Currently, this method can be used only -//@chat_id Chat identifier -//@password The 2-step verification password of the current user -getChatRevenueWithdrawalUrl#1e320720 chat_id:int53 password:string = HttpUrl; - -//@description Returns the list of revenue transactions for a chat. Currently, this method can be used only -//@chat_id Chat identifier -//@offset Number of transactions to skip -//@limit The maximum number of transactions to be returned; up to 200 -getChatRevenueTransactions#472f0715 chat_id:int53 offset:int32 limit:int32 = ChatRevenueTransactions; - -//@description Returns detailed Telegram Star revenue statistics -//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true -//@is_dark Pass true if a dark theme is used by the application -getStarRevenueStatistics#f07b4517 owner_id:MessageSender is_dark:Bool = StarRevenueStatistics; - -//@description Returns a URL for Telegram Star withdrawal -//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat -//@star_count The number of Telegram Stars to withdraw. Must be at least getOption("star_withdrawal_count_min") -//@password The 2-step verification password of the current user -getStarWithdrawalUrl#a9d23712 owner_id:MessageSender star_count:int53 password:string = HttpUrl; - -//@description Returns a URL for a Telegram Ad platform account that can be used to set up advertisements for the chat paid in the owned Telegram Stars -//@owner_id Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat -getStarAdAccountUrl#73a9455d owner_id:MessageSender = HttpUrl; - -//@description Returns detailed statistics about a chat. Currently, this method can be used only for supergroups and channels. Can be used only if supergroupFullInfo.can_get_statistics == true -//@chat_id Chat identifier -//@is_dark Pass true if a dark theme is used by the application -getChatStatistics#137e8198 chat_id:int53 is_dark:Bool = ChatStatistics; - -//@description Returns detailed statistics about a message. Can be used only if messageProperties.can_get_statistics == true -//@chat_id Chat identifier -//@message_id Message identifier -//@is_dark Pass true if a dark theme is used by the application -getMessageStatistics#4bb5a1d8 chat_id:int53 message_id:int53 is_dark:Bool = MessageStatistics; - -//@description Returns forwarded copies of a channel message to different public channels and public reposts as a story. Can be used only if messageProperties.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib -//@chat_id Chat identifier of the message -//@message_id Message identifier -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit -getMessagePublicForwards#519da4b4 chat_id:int53 message_id:int53 offset:string limit:int32 = PublicForwards; - -//@description Returns detailed statistics about a story. Can be used only if story.can_get_statistics == true -//@chat_id Chat identifier -//@story_id Story identifier -//@is_dark Pass true if a dark theme is used by the application -getStoryStatistics#3a964342 chat_id:int53 story_id:int32 is_dark:Bool = StoryStatistics; - -//@description Loads an asynchronous or a zoomed in statistical graph -//@chat_id Chat identifier -//@token The token for graph loading -//@x X-value for zoomed in graph or 0 otherwise -getStatisticalGraph#419f8d9b chat_id:int53 token:string x:int53 = StatisticalGraph; - -//@description Returns storage usage statistics. Can be called before authorization -//@chat_limit The maximum number of chats with the largest storage usage for which separate statistics need to be returned. All other chats will be grouped in entries with chat_id == 0. If the chat info database is not used, the chat_limit is ignored and is always set to 0 -getStorageStatistics#cd254b37 chat_limit:int32 = StorageStatistics; - -//@description Quickly returns approximate storage usage statistics. Can be called before authorization -getStorageStatisticsFast#3a86702 = StorageStatisticsFast; - -//@description Returns database statistics -getDatabaseStatistics#8c33d4b9 = DatabaseStatistics; - -//@description Optimizes storage usage, i.e. deletes some files and returns new storage usage statistics. Secret thumbnails can't be deleted -//@size Limit on the total size of files after deletion, in bytes. Pass -1 to use the default limit -//@ttl Limit on the time that has passed since the last time a file was accessed (or creation time for some filesystems). Pass -1 to use the default limit -//@count Limit on the total number of files after deletion. Pass -1 to use the default limit -//@immunity_delay The amount of time after the creation of a file during which it can't be deleted, in seconds. Pass -1 to use the default value -//@file_types If non-empty, only files with the given types are considered. By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted -//@chat_ids If non-empty, only files from the given chats are considered. Use 0 as chat identifier to delete files not belonging to any chat (e.g., profile photos) -//@exclude_chat_ids If non-empty, files from the given chats are excluded. Use 0 as chat identifier to exclude all files not belonging to any chat (e.g., profile photos) -//@return_deleted_file_statistics Pass true if statistics about the files that were deleted must be returned instead of the whole storage usage statistics. Affects only returned statistics -//@chat_limit Same as in getStorageStatistics. Affects only returned statistics -optimizeStorage#ef73c8c5 size:int53 ttl:int32 count:int32 immunity_delay:int32 file_types:vector chat_ids:vector exclude_chat_ids:vector return_deleted_file_statistics:Bool chat_limit:int32 = StorageStatistics; - -//@description Sets the current network type. Can be called before authorization. Calling this method forces all network connections to reopen, mitigating the delay in switching between different networks, -//@type The new network type; pass null to set network type to networkTypeOther -setNetworkType#d62de55e type:NetworkType = Ok; - -//@description Returns network data usage statistics. Can be called before authorization -//@only_current Pass true to get statistics only for the current library launch -getNetworkStatistics#c537581e only_current:Bool = NetworkStatistics; - -//@description Adds the specified data to data usage statistics. Can be called before authorization -//@entry The network statistics entry with the data to be added to statistics -addNetworkStatistics#4b63b3d9 entry:NetworkStatisticsEntry = Ok; - -//@description Resets all network data usage statistics to zero. Can be called before authorization -resetNetworkStatistics#6222dd86 = Ok; - -//@description Returns auto-download settings presets for the current user -getAutoDownloadSettingsPresets#996a4737 = AutoDownloadSettingsPresets; - -//@description Sets auto-download settings -//@settings New user auto-download settings -//@type Type of the network for which the new settings are relevant -setAutoDownloadSettings#eaeb64f4 settings:autoDownloadSettings type:NetworkType = Ok; - -//@description Returns autosave settings for the current user -getAutosaveSettings#7f53f22a = AutosaveSettings; - -//@description Sets autosave settings for the given scope. The method is guaranteed to work only after at least one call to getAutosaveSettings -//@scope Autosave settings scope -//@settings New autosave settings for the scope; pass null to set autosave settings to default -setAutosaveSettings#6878c0 scope:AutosaveSettingsScope settings:scopeAutosaveSettings = Ok; - -//@description Clears the list of all autosave settings exceptions. The method is guaranteed to work only after at least one call to getAutosaveSettings -clearAutosaveSettingsExceptions#57ec63f2 = Ok; - -//@description Returns information about a bank card -//@bank_card_number The bank card number -getBankCardInfo#b1e31db0 bank_card_number:string = BankCardInfo; - -//@description Returns one of the available Telegram Passport elements -//@type Telegram Passport element type -//@password The 2-step verification password of the current user -getPassportElement#8fcce17a type:PassportElementType password:string = PassportElement; - -//@description Returns all available Telegram Passport elements -//@password The 2-step verification password of the current user -getAllPassportElements#86782aeb password:string = PassportElements; - -//@description Adds an element to the user's Telegram Passport. May return an error with a message "PHONE_VERIFICATION_NEEDED" or "EMAIL_VERIFICATION_NEEDED" if the chosen phone number or the chosen email address must be verified first -//@element Input Telegram Passport element -//@password The 2-step verification password of the current user -setPassportElement#7b45d19c element:InputPassportElement password:string = PassportElement; - -//@description Deletes a Telegram Passport element -//@type Element type -deletePassportElement#9981aa74 type:PassportElementType = Ok; - -//@description Informs the user that some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed -//@user_id User identifier -//@errors The errors -setPassportElementErrors#80fa80bf user_id:int53 errors:vector = Ok; - -//@description Returns an IETF language tag of the language preferred in the country, which must be used to fill native fields in Telegram Passport personal details. Returns a 404 error if unknown -//@country_code A two-letter ISO 3166-1 alpha-2 country code -getPreferredCountryLanguage#c862cbd6 country_code:string = Text; - -//@description Sends a code to verify an email address to be added to a user's Telegram Passport -//@email_address Email address -sendEmailAddressVerificationCode#f2ca537d email_address:string = EmailAddressAuthenticationCodeInfo; - -//@description Resends the code to verify an email address to be added to a user's Telegram Passport -resendEmailAddressVerificationCode#90653024 = EmailAddressAuthenticationCodeInfo; - -//@description Checks the email address verification code for Telegram Passport -//@code Verification code to check -checkEmailAddressVerificationCode#e695db03 code:string = Ok; - -//@description Returns a Telegram Passport authorization form for sharing data with a service -//@bot_user_id User identifier of the service's bot -//@scope Telegram Passport element types requested by the service -//@public_key Service's public key -//@nonce Unique request identifier provided by the service -getPassportAuthorizationForm#61850486 bot_user_id:int53 scope:string public_key:string nonce:string = PassportAuthorizationForm; - -//@description Returns already available Telegram Passport elements suitable for completing a Telegram Passport authorization form. Result can be received only once for each authorization form -//@authorization_form_id Authorization form identifier -//@password The 2-step verification password of the current user -getPassportAuthorizationFormAvailableElements#3fb314fc authorization_form_id:int32 password:string = PassportElementsWithErrors; - -//@description Sends a Telegram Passport authorization form, effectively sharing data with the service. This method must be called after getPassportAuthorizationFormAvailableElements if some previously available elements are going to be reused -//@authorization_form_id Authorization form identifier -//@types Types of Telegram Passport elements chosen by user to complete the authorization form -sendPassportAuthorizationForm#d9c77579 authorization_form_id:int32 types:vector = Ok; - -//@description Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only -//@pending_update_count The number of pending updates -//@error_message The last error message -setBotUpdatesStatus#bb293991 pending_update_count:int32 error_message:string = Ok; - -//@description Uploads a file with a sticker; returns the uploaded file -//@user_id Sticker file owner; ignored for regular users -//@sticker_format Sticker format -//@sticker File file to upload; must fit in a 512x512 square. For WEBP stickers the file must be in WEBP or PNG format, which will be converted to WEBP server-side. -uploadStickerFile#269650c3 user_id:int53 sticker_format:StickerFormat sticker:InputFile = File; - -//@description Returns a suggested name for a new sticker set with a given title -//@title Sticker set title; 1-64 characters -getSuggestedStickerSetName#b0120840 title:string = Text; - -//@description Checks whether a name can be used for a new sticker set -//@name Name to be checked -checkStickerSetName#955808fe name:string = CheckStickerSetNameResult; - -//@description Creates a new sticker set. Returns the newly created sticker set -//@user_id Sticker set owner; ignored for regular users -//@title Sticker set title; 1-64 characters -//@name Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive) for bots; 0-64 characters. -//@sticker_type Type of the stickers in the set -//@needs_repainting Pass true if stickers in the sticker set must be repainted; for custom emoji sticker sets only -//@stickers List of stickers to be added to the set; 1-200 stickers for custom emoji sticker sets, and 1-120 stickers otherwise. For TGS stickers, uploadStickerFile must be used before the sticker is shown -//@source Source of the sticker set; may be empty if unknown -createNewStickerSet#87fd8611 user_id:int53 title:string name:string sticker_type:StickerType needs_repainting:Bool stickers:vector source:string = StickerSet; - -//@description Adds a new sticker to a set -//@user_id Sticker set owner; ignored for regular users -//@name Sticker set name. The sticker set must be owned by the current user, and contain less than 200 stickers for custom emoji sticker sets and less than 120 otherwise -//@sticker Sticker to add to the set -addStickerToSet#56dc1e3b user_id:int53 name:string sticker:inputSticker = Ok; - -//@description Replaces existing sticker in a set. The function is equivalent to removeStickerFromSet, then addStickerToSet, then setStickerPositionInSet -//@user_id Sticker set owner; ignored for regular users -//@name Sticker set name. The sticker set must be owned by the current user -//@old_sticker Sticker to remove from the set -//@new_sticker Sticker to add to the set -replaceStickerInSet#e7c82e19 user_id:int53 name:string old_sticker:InputFile new_sticker:inputSticker = Ok; - -//@description Sets a sticker set thumbnail -//@user_id Sticker set owner; ignored for regular users -//@name Sticker set name. The sticker set must be owned by the current user -//@thumbnail Thumbnail to set; pass null to remove the sticker set thumbnail -//@format Format of the thumbnail; pass null if thumbnail is removed -setStickerSetThumbnail#63fe6932 user_id:int53 name:string thumbnail:InputFile format:StickerFormat = Ok; - -//@description Sets a custom emoji sticker set thumbnail -//@name Sticker set name. The sticker set must be owned by the current user -//@custom_emoji_id Identifier of the custom emoji from the sticker set, which will be set as sticker set thumbnail; pass 0 to remove the sticker set thumbnail -setCustomEmojiStickerSetThumbnail#bd12e0ea name:string custom_emoji_id:int64 = Ok; - -//@description Sets a sticker set title -//@name Sticker set name. The sticker set must be owned by the current user -//@title New sticker set title -setStickerSetTitle#64e933a2 name:string title:string = Ok; - -//@description Completely deletes a sticker set -//@name Sticker set name. The sticker set must be owned by the current user -deleteStickerSet#5e0a7bad name:string = Ok; - -//@description Changes the position of a sticker in the set to which it belongs. The sticker set must be owned by the current user -//@sticker Sticker -//@position New position of the sticker in the set, 0-based -setStickerPositionInSet#7bb24721 sticker:InputFile position:int32 = Ok; - -//@description Removes a sticker from the set to which it belongs. The sticker set must be owned by the current user -//@sticker Sticker to remove from the set -removeStickerFromSet#61e1eea4 sticker:InputFile = Ok; - -//@description Changes the list of emojis corresponding to a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user -//@sticker Sticker -//@emojis New string with 1-20 emoji corresponding to the sticker -setStickerEmojis#d9ec0431 sticker:InputFile emojis:string = Ok; - -//@description Changes the list of keywords of a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user -//@sticker Sticker -//@keywords List of up to 20 keywords with total length up to 64 characters, which can be used to find the sticker -setStickerKeywords#462481d sticker:InputFile keywords:vector = Ok; - -//@description Changes the mask position of a mask sticker. The sticker must belong to a mask sticker set that is owned by the current user -//@sticker Sticker -//@mask_position Position where the mask is placed; pass null to remove mask position -setStickerMaskPosition#47a959d0 sticker:InputFile mask_position:maskPosition = Ok; - -//@description Returns sticker sets owned by the current user -//@offset_sticker_set_id Identifier of the sticker set from which to return owned sticker sets; use 0 to get results from the beginning -//@limit The maximum number of sticker sets to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit -getOwnedStickerSets#58fe8120 offset_sticker_set_id:int64 limit:int32 = StickerSets; - -//@description Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded -//@location Location of the map center -//@zoom Map zoom level; 13-20 -//@width Map width in pixels before applying scale; 16-1024 -//@height Map height in pixels before applying scale; 16-1024 -//@scale Map scale; 1-3 -//@chat_id Identifier of a chat in which the thumbnail will be shown. Use 0 if unknown -getMapThumbnailFile#f6e6979a location:location zoom:int32 width:int32 height:int32 scale:int32 chat_id:int53 = File; - -//@description Returns information about a limit, increased for Premium users. Returns a 404 error if the limit is unknown -//@limit_type Type of the limit -getPremiumLimit#4017fcea limit_type:PremiumLimitType = PremiumLimit; - -//@description Returns information about features, available to Premium users -//@source Source of the request; pass null if the method is called from some non-standard source -getPremiumFeatures#b4dc2649 source:PremiumSource = PremiumFeatures; - -//@description Returns examples of premium stickers for demonstration purposes -getPremiumStickerExamples#5369cb98 = Stickers; - -//@description Returns the sticker to be used as representation of the Telegram Premium subscription -//@month_count Number of months the Telegram Premium subscription will be active -getPremiumInfoSticker#79ce4a9b month_count:int32 = Sticker; - -//@description Informs TDLib that the user viewed detailed information about a Premium feature on the Premium features screen -//@feature The viewed premium feature -viewPremiumFeature#b8031b2 feature:PremiumFeature = Ok; - -//@description Informs TDLib that the user clicked Premium subscription button on the Premium features screen -clickPremiumSubscriptionButton#e9fca306 = Ok; - -//@description Returns state of Telegram Premium subscription and promotion videos for Premium features -getPremiumState#278e3ae2 = PremiumState; - -//@description Returns available options for Telegram Premium gift code or Telegram Premium giveaway creation -//@boosted_chat_id Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none -getPremiumGiftCodePaymentOptions#89523a2c boosted_chat_id:int53 = PremiumGiftCodePaymentOptions; - -//@description Return information about a Telegram Premium gift code -//@code The code to check -checkPremiumGiftCode#958ad664 code:string = PremiumGiftCodeInfo; - -//@description Applies a Telegram Premium gift code -//@code The code to apply -applyPremiumGiftCode#afb44c1e code:string = Ok; - -//@description Launches a prepaid giveaway -//@giveaway_id Unique identifier of the prepaid giveaway -//@parameters Giveaway parameters -//@winner_count The number of users to receive giveaway prize -//@star_count The number of Telegram Stars to be distributed through the giveaway; pass 0 for Telegram Premium giveaways -launchPrepaidGiveaway#261d783a giveaway_id:int64 parameters:giveawayParameters winner_count:int32 star_count:int53 = Ok; - -//@description Returns information about a giveaway -//@chat_id Identifier of the channel chat which started the giveaway -//@message_id Identifier of the giveaway or a giveaway winners message in the chat -getGiveawayInfo#b78790bb chat_id:int53 message_id:int53 = GiveawayInfo; - -//@description Returns available options for Telegram Stars purchase -getStarPaymentOptions#6d930644 = StarPaymentOptions; - -//@description Returns available options for Telegram Stars gifting -//@user_id Identifier of the user that will receive Telegram Stars; pass 0 to get options for an unspecified user -getStarGiftPaymentOptions#e22760e3 user_id:int53 = StarPaymentOptions; - -//@description Returns available options for Telegram Star giveaway creation -getStarGiveawayPaymentOptions#cb5bdb1e = StarGiveawayPaymentOptions; - -//@description Returns the list of Telegram Star transactions for the specified owner -//@owner_id Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, -//@subscription_id If non-empty, only transactions related to the Star Subscription will be returned -//@direction Direction of the transactions to receive; pass null to get all transactions -//@offset Offset of the first transaction to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of transactions to return -getStarTransactions#f096f8f1 owner_id:MessageSender subscription_id:string direction:StarTransactionDirection offset:string limit:int32 = StarTransactions; - -//@description Returns the list of Telegram Star subscriptions for the current user -//@only_expiring Pass true to receive only expiring subscriptions for which there are no enough Telegram Stars to extend -//@offset Offset of the first subscription to return as received from the previous request; use empty string to get the first chunk of results -getStarSubscriptions#d9c7b2ec only_expiring:Bool offset:string = StarSubscriptions; - -//@description Checks whether an in-store purchase is possible. Must be called before any in-store purchase -//@purpose Transaction purpose -canPurchaseFromStore#3caa9368 purpose:StorePaymentPurpose = Ok; - -//@description Informs server about a purchase through App Store. For official applications only -//@receipt App Store receipt -//@purpose Transaction purpose -assignAppStoreTransaction#86f30bb0 receipt:bytes purpose:StorePaymentPurpose = Ok; - -//@description Informs server about a purchase through Google Play. For official applications only -//@package_name Application package name -//@store_product_id Identifier of the purchased store product -//@purchase_token Google Play purchase token -//@purpose Transaction purpose -assignGooglePlayTransaction#8939bca4 package_name:string store_product_id:string purchase_token:string purpose:StorePaymentPurpose = Ok; - -//@description Cancels or re-enables Telegram Star subscription -//@subscription_id Identifier of the subscription to change -//@is_canceled New value of is_canceled -editStarSubscription#7a1a3918 subscription_id:string is_canceled:Bool = Ok; - -//@description Cancels or re-enables Telegram Star subscription for a user; for bots only -//@user_id User identifier -//@telegram_payment_charge_id Telegram payment identifier of the subscription -//@is_canceled Pass true to cancel the subscription; pass false to allow the user to enable it -editUserStarSubscription#51b16e89 user_id:int53 telegram_payment_charge_id:string is_canceled:Bool = Ok; - -//@description Reuses an active Telegram Star subscription to a channel chat and joins the chat again -//@subscription_id Identifier of the subscription -reuseStarSubscription#2e677441 subscription_id:string = Ok; - -//@description Changes affiliate program for a bot -//@chat_id Identifier of the chat with an owned bot for which affiliate program is changed -//@parameters Parameters of the affiliate program; pass null to close the currently active program. If there is an active program, then commission and program duration can only be increased. -setChatAffiliateProgram#e00237 chat_id:int53 parameters:affiliateProgramParameters = Ok; - -//@description Searches a chat with an affiliate program. Returns the chat if found and the program is active -//@username Username of the chat -//@referrer The referrer from an internalLinkTypeChatAffiliateProgram link -searchChatAffiliateProgram#b02c09ba username:string referrer:string = Chat; - -//@description Searches affiliate programs that can be connected to the given affiliate -//@affiliate The affiliate for which affiliate programs are searched for -//@sort_order Sort order for the results -//@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of affiliate programs to return -searchAffiliatePrograms#2899a011 affiliate:AffiliateType sort_order:AffiliateProgramSortOrder offset:string limit:int32 = FoundAffiliatePrograms; - -//@description Connects an affiliate program to the given affiliate. Returns information about the connected affiliate program -//@affiliate The affiliate to which the affiliate program will be connected -//@bot_user_id Identifier of the bot, which affiliate program is connected -connectAffiliateProgram#6306d72c affiliate:AffiliateType bot_user_id:int53 = ConnectedAffiliateProgram; - -//@description Disconnects an affiliate program from the given affiliate and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program -//@affiliate The affiliate to which the affiliate program is connected -//@url The referral link of the affiliate program -disconnectAffiliateProgram#f9b124fc affiliate:AffiliateType url:string = ConnectedAffiliateProgram; - -//@description Returns an affiliate program that were connected to the given affiliate by identifier of the bot that created the program -//@affiliate The affiliate to which the affiliate program will be connected -//@bot_user_id Identifier of the bot that created the program -getConnectedAffiliateProgram#9761e770 affiliate:AffiliateType bot_user_id:int53 = ConnectedAffiliateProgram; - -//@description Returns affiliate programs that were connected to the given affiliate -//@affiliate The affiliate to which the affiliate program were connected -//@offset Offset of the first affiliate program to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of affiliate programs to return -getConnectedAffiliatePrograms#8b2c5272 affiliate:AffiliateType offset:string limit:int32 = ConnectedAffiliatePrograms; - -//@description Returns information about features, available to Business users -//@source Source of the request; pass null if the method is called from settings or some non-standard source -getBusinessFeatures#c4906001 source:BusinessFeature = BusinessFeatures; - -//@description Accepts Telegram terms of services -//@terms_of_service_id Terms of service identifier -acceptTermsOfService#7efe03e4 terms_of_service_id:string = Ok; - -//@description Searches specified query by word prefixes in the provided strings. Returns 0-based positions of strings that matched. Can be called synchronously -//@strings The strings to search in for the query -//@query Query to search for -//@limit The maximum number of objects to return -//@return_none_for_empty_query Pass true to receive no results for an empty query -searchStringsByPrefix#a8145813 strings:vector query:string limit:int32 return_none_for_empty_query:Bool = FoundPositions; - -//@description Sends a custom request; for bots only -//@method The method name -//@parameters JSON-serialized method parameters -sendCustomRequest#10fd71a1 method:string parameters:string = CustomRequestResult; - -//@description Answers a custom query; for bots only -//@custom_query_id Identifier of a custom query -//@data JSON-serialized answer to the query -answerCustomQuery#b2e52d3f custom_query_id:int64 data:string = Ok; - -//@description Succeeds after a specified amount of time has passed. Can be called before initialization -//@seconds Number of seconds before the function returns -setAlarm#cbef7e15 seconds:double = Ok; - -//@description Returns information about existing countries. Can be called before authorization -getCountries#fce8099e = Countries; - -//@description Uses the current IP address to find the current country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization -getCountryCode#5bd398f2 = Text; - -//@description Returns information about a phone number by its prefix. Can be called before authorization -//@phone_number_prefix The phone number prefix -getPhoneNumberInfo#a0229bf9 phone_number_prefix:string = PhoneNumberInfo; - -//@description Returns information about a phone number by its prefix synchronously. getCountries must be called at least once after changing localization to the specified language if properly localized country information is expected. Can be called synchronously -//@language_code A two-letter ISO 639-1 language code for country information localization -//@phone_number_prefix The phone number prefix -getPhoneNumberInfoSync#209b7d38 language_code:string phone_number_prefix:string = PhoneNumberInfo; - -//@description Returns information about a given collectible item that was purchased at https://fragment.com -//@type Type of the collectible item. The item must be used by a user and must be visible to the current user -getCollectibleItemInfo#f304ad8a type:CollectibleItemType = CollectibleItemInfo; - -//@description Returns information about a tg:// deep link. Use "tg://need_update_for_some_feature" or "tg:some_unsupported_feature" for testing. Returns a 404 error for unknown links. Can be called before authorization -//@link The link -getDeepLinkInfo#28923f7e link:string = DeepLinkInfo; - -//@description Returns application config, provided by the server. Can be called before authorization -getApplicationConfig#93550682 = JsonValue; - -//@description Saves application log event on the server. Can be called before authorization -//@type Event type -//@chat_id Optional chat identifier, associated with the event -//@data The log event data -saveApplicationLogEvent#cfa6c20e type:string chat_id:int53 data:JsonValue = Ok; - -//@description Returns the link for downloading official Telegram application to be used when the current user invites friends to Telegram -getApplicationDownloadLink#6ad2fc4 = HttpUrl; - -//@description Adds a proxy server for network requests. Can be called before authorization -//@server Proxy server domain or IP address -//@port Proxy server port -//@enable Pass true to immediately enable the proxy -//@type Proxy type -addProxy#13c2bcd8 server:string port:int32 enable:Bool type:ProxyType = Proxy; - -//@description Edits an existing proxy server for network requests. Can be called before authorization -//@proxy_id Proxy identifier -//@server Proxy server domain or IP address -//@port Proxy server port -//@enable Pass true to immediately enable the proxy -//@type Proxy type -editProxy#a0482853 proxy_id:int32 server:string port:int32 enable:Bool type:ProxyType = Proxy; - -//@description Enables a proxy. Only one proxy can be enabled at a time. Can be called before authorization -//@proxy_id Proxy identifier -enableProxy#59138296 proxy_id:int32 = Ok; - -//@description Disables the currently enabled proxy. Can be called before authorization -disableProxy#82d31782 = Ok; - -//@description Removes a proxy server. Can be called before authorization -//@proxy_id Proxy identifier -removeProxy#519ca307 proxy_id:int32 = Ok; - -//@description Returns the list of proxies that are currently set up. Can be called before authorization -getProxies#fa560333 = Proxies; - -//@description Returns an HTTPS link, which can be used to add a proxy. Available only for SOCKS5 and MTProto proxies. Can be called before authorization -//@proxy_id Proxy identifier -getProxyLink#c125ae78 proxy_id:int32 = HttpUrl; - -//@description Computes time needed to receive a response from a Telegram server through a proxy. Can be called before authorization -//@proxy_id Proxy identifier. Use 0 to ping a Telegram server without a proxy -pingProxy#c59b40b1 proxy_id:int32 = Seconds; - -//@description Sets new log stream for internal logging of TDLib. Can be called synchronously -//@log_stream New log stream -setLogStream#aeaff791 log_stream:LogStream = Ok; - -//@description Returns information about currently used log stream for internal logging of TDLib. Can be called synchronously -getLogStream#45984b5b = LogStream; - -//@description Sets the verbosity level of the internal logging of TDLib. Can be called synchronously -//@new_verbosity_level New value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, -setLogVerbosityLevel#edea07d2 new_verbosity_level:int32 = Ok; - -//@description Returns current verbosity level of the internal logging of TDLib. Can be called synchronously -getLogVerbosityLevel#23689ae4 = LogVerbosityLevel; - -//@description Returns the list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously -getLogTags#f0d569da = LogTags; - -//@description Sets the verbosity level for a specified TDLib internal log tag. Can be called synchronously -//@tag Logging tag to change verbosity level -//@new_verbosity_level New verbosity level; 1-1024 -setLogTagVerbosityLevel#8317d696 tag:string new_verbosity_level:int32 = Ok; - -//@description Returns current verbosity level for a specified TDLib internal log tag. Can be called synchronously -//@tag Logging tag to change verbosity level -getLogTagVerbosityLevel#38af2d83 tag:string = LogVerbosityLevel; - -//@description Adds a message to TDLib internal log. Can be called synchronously -//@verbosity_level The minimum verbosity level needed for the message to be logged; 0-1023 -//@text Text of a message to log -addLogMessage#5f36cfec verbosity_level:int32 text:string = Ok; - -//@description Returns support information for the given user; for Telegram support only -//@user_id User identifier -getUserSupportInfo#74a59305 user_id:int53 = UserSupportInfo; - -//@description Sets support information for the given user; for Telegram support only -//@user_id User identifier -//@message New information message -setUserSupportInfo#837c9803 user_id:int53 message:formattedText = UserSupportInfo; - -//@description Returns localized name of the Telegram support user; for Telegram support only -getSupportName#4d9e1562 = Text; - -//@description Does nothing; for testing only. This is an offline method. Can be called before authorization -testCallEmpty#da9c4a16 = Ok; - -//@description Returns the received string; for testing only. This is an offline method. Can be called before authorization -//@x String to return -testCallString#98b74a2f x:string = TestString; - -//@description Returns the received bytes; for testing only. This is an offline method. Can be called before authorization -//@x Bytes to return -testCallBytes#d4215aa9 x:bytes = TestBytes; - -//@description Returns the received vector of numbers; for testing only. This is an offline method. Can be called before authorization -//@x Vector of numbers to return -testCallVectorInt#65ed7e72 x:vector = TestVectorInt; - -//@description Returns the received vector of objects containing a number; for testing only. This is an offline method. Can be called before authorization -//@x Vector of objects to return -testCallVectorIntObject#ca57f472 x:vector = TestVectorIntObject; - -//@description Returns the received vector of strings; for testing only. This is an offline method. Can be called before authorization -//@x Vector of strings to return -testCallVectorString#8e5a6ed8 x:vector = TestVectorString; - -//@description Returns the received vector of objects containing a string; for testing only. This is an offline method. Can be called before authorization -//@x Vector of objects to return -testCallVectorStringObject#96cd6de x:vector = TestVectorStringObject; - -//@description Returns the squared received number; for testing only. This is an offline method. Can be called before authorization -//@x Number to square -testSquareInt#fc6a6990 x:int32 = TestInt; - -//@description Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization -testNetwork#afe4344b = Ok; - -//@description Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization -//@server Proxy server domain or IP address -//@port Proxy server port -//@type Proxy type -//@dc_id Identifier of a datacenter with which to test connection -//@timeout The maximum overall timeout for the request -testProxy#b8a1a29e server:string port:int32 type:ProxyType dc_id:int32 timeout:double = Ok; - -//@description Forces an updates.getDifference call to the Telegram servers; for testing only -testGetDifference#68226325 = Ok; - -//@description Does nothing and ensures that the Update object is used; for testing only. This is an offline method. Can be called before authorization -testUseUpdate#2abdff1e = Update; - -//@description Returns the specified error and ensures that the Error object is used; for testing only. Can be called synchronously -//@error The error to be returned -testReturnError#1b217cf2 error:error = Error; - diff --git a/td.go b/td.go index 9a87fa12a..d3dfc3111 100644 --- a/td.go +++ b/td.go @@ -4,8 +4,6 @@ package td //go:generate go run github.com/gotd/td/cmd/gotdgen --doc "https://core.telegram.org/" --clean --server --handlers --mapping --slices --package tg --target tg --schema _schema/telegram.tl //go:generate go run github.com/gotd/td/cmd/gotdgen --doc "https://core.telegram.org/" --clean --package e2e --target tg/e2e --schema _schema/encrypted.tl -//go:generate go run github.com/gotd/td/cmd/gotdgen --clean --package tdapi --tdlib-json --target tdapi --schema _schema/tdapi.tl - //go:generate go run github.com/gotd/td/cmd/gotdgen --clean --client=false --package tgtrace --target tgtrace --schema _schema/trace.tl //go:generate go run github.com/gotd/td/cmd/gotdgen --clean --package mt --target mt --client=false --schema _schema/mt.tl diff --git a/tdapi/tl_accent_color_gen.go b/tdapi/tl_accent_color_gen.go deleted file mode 100644 index cb6cddff3..000000000 --- a/tdapi/tl_accent_color_gen.go +++ /dev/null @@ -1,379 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AccentColor represents TL type `accentColor#53312690`. -type AccentColor struct { - // Accent color identifier - ID int32 - // Identifier of a built-in color to use in places, where only one color is needed; 0-6 - BuiltInAccentColorID int32 - // The list of 1-3 colors in RGB format, describing the accent color, as expected to be - // shown in light themes - LightThemeColors []int32 - // The list of 1-3 colors in RGB format, describing the accent color, as expected to be - // shown in dark themes - DarkThemeColors []int32 - // The minimum chat boost level required to use the color in a channel chat - MinChannelChatBoostLevel int32 -} - -// AccentColorTypeID is TL type id of AccentColor. -const AccentColorTypeID = 0x53312690 - -// Ensuring interfaces in compile-time for AccentColor. -var ( - _ bin.Encoder = &AccentColor{} - _ bin.Decoder = &AccentColor{} - _ bin.BareEncoder = &AccentColor{} - _ bin.BareDecoder = &AccentColor{} -) - -func (a *AccentColor) Zero() bool { - if a == nil { - return true - } - if !(a.ID == 0) { - return false - } - if !(a.BuiltInAccentColorID == 0) { - return false - } - if !(a.LightThemeColors == nil) { - return false - } - if !(a.DarkThemeColors == nil) { - return false - } - if !(a.MinChannelChatBoostLevel == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AccentColor) String() string { - if a == nil { - return "AccentColor(nil)" - } - type Alias AccentColor - return fmt.Sprintf("AccentColor%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AccentColor) TypeID() uint32 { - return AccentColorTypeID -} - -// TypeName returns name of type in TL schema. -func (*AccentColor) TypeName() string { - return "accentColor" -} - -// TypeInfo returns info about TL type. -func (a *AccentColor) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "accentColor", - ID: AccentColorTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "BuiltInAccentColorID", - SchemaName: "built_in_accent_color_id", - }, - { - Name: "LightThemeColors", - SchemaName: "light_theme_colors", - }, - { - Name: "DarkThemeColors", - SchemaName: "dark_theme_colors", - }, - { - Name: "MinChannelChatBoostLevel", - SchemaName: "min_channel_chat_boost_level", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AccentColor) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode accentColor#53312690 as nil") - } - b.PutID(AccentColorTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AccentColor) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode accentColor#53312690 as nil") - } - b.PutInt32(a.ID) - b.PutInt32(a.BuiltInAccentColorID) - b.PutInt(len(a.LightThemeColors)) - for _, v := range a.LightThemeColors { - b.PutInt32(v) - } - b.PutInt(len(a.DarkThemeColors)) - for _, v := range a.DarkThemeColors { - b.PutInt32(v) - } - b.PutInt32(a.MinChannelChatBoostLevel) - return nil -} - -// Decode implements bin.Decoder. -func (a *AccentColor) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode accentColor#53312690 to nil") - } - if err := b.ConsumeID(AccentColorTypeID); err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AccentColor) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode accentColor#53312690 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field id: %w", err) - } - a.ID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field built_in_accent_color_id: %w", err) - } - a.BuiltInAccentColorID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field light_theme_colors: %w", err) - } - - if headerLen > 0 { - a.LightThemeColors = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field light_theme_colors: %w", err) - } - a.LightThemeColors = append(a.LightThemeColors, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field dark_theme_colors: %w", err) - } - - if headerLen > 0 { - a.DarkThemeColors = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field dark_theme_colors: %w", err) - } - a.DarkThemeColors = append(a.DarkThemeColors, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field min_channel_chat_boost_level: %w", err) - } - a.MinChannelChatBoostLevel = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AccentColor) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode accentColor#53312690 as nil") - } - b.ObjStart() - b.PutID("accentColor") - b.Comma() - b.FieldStart("id") - b.PutInt32(a.ID) - b.Comma() - b.FieldStart("built_in_accent_color_id") - b.PutInt32(a.BuiltInAccentColorID) - b.Comma() - b.FieldStart("light_theme_colors") - b.ArrStart() - for _, v := range a.LightThemeColors { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("dark_theme_colors") - b.ArrStart() - for _, v := range a.DarkThemeColors { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("min_channel_chat_boost_level") - b.PutInt32(a.MinChannelChatBoostLevel) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AccentColor) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode accentColor#53312690 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("accentColor"); err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field id: %w", err) - } - a.ID = value - case "built_in_accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field built_in_accent_color_id: %w", err) - } - a.BuiltInAccentColorID = value - case "light_theme_colors": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field light_theme_colors: %w", err) - } - a.LightThemeColors = append(a.LightThemeColors, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field light_theme_colors: %w", err) - } - case "dark_theme_colors": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field dark_theme_colors: %w", err) - } - a.DarkThemeColors = append(a.DarkThemeColors, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field dark_theme_colors: %w", err) - } - case "min_channel_chat_boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accentColor#53312690: field min_channel_chat_boost_level: %w", err) - } - a.MinChannelChatBoostLevel = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (a *AccentColor) GetID() (value int32) { - if a == nil { - return - } - return a.ID -} - -// GetBuiltInAccentColorID returns value of BuiltInAccentColorID field. -func (a *AccentColor) GetBuiltInAccentColorID() (value int32) { - if a == nil { - return - } - return a.BuiltInAccentColorID -} - -// GetLightThemeColors returns value of LightThemeColors field. -func (a *AccentColor) GetLightThemeColors() (value []int32) { - if a == nil { - return - } - return a.LightThemeColors -} - -// GetDarkThemeColors returns value of DarkThemeColors field. -func (a *AccentColor) GetDarkThemeColors() (value []int32) { - if a == nil { - return - } - return a.DarkThemeColors -} - -// GetMinChannelChatBoostLevel returns value of MinChannelChatBoostLevel field. -func (a *AccentColor) GetMinChannelChatBoostLevel() (value int32) { - if a == nil { - return - } - return a.MinChannelChatBoostLevel -} diff --git a/tdapi/tl_accept_call_gen.go b/tdapi/tl_accept_call_gen.go deleted file mode 100644 index e08d887d4..000000000 --- a/tdapi/tl_accept_call_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AcceptCallRequest represents TL type `acceptCall#d97562d0`. -type AcceptCallRequest struct { - // Call identifier - CallID int32 - // The call protocols supported by the application - Protocol CallProtocol -} - -// AcceptCallRequestTypeID is TL type id of AcceptCallRequest. -const AcceptCallRequestTypeID = 0xd97562d0 - -// Ensuring interfaces in compile-time for AcceptCallRequest. -var ( - _ bin.Encoder = &AcceptCallRequest{} - _ bin.Decoder = &AcceptCallRequest{} - _ bin.BareEncoder = &AcceptCallRequest{} - _ bin.BareDecoder = &AcceptCallRequest{} -) - -func (a *AcceptCallRequest) Zero() bool { - if a == nil { - return true - } - if !(a.CallID == 0) { - return false - } - if !(a.Protocol.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AcceptCallRequest) String() string { - if a == nil { - return "AcceptCallRequest(nil)" - } - type Alias AcceptCallRequest - return fmt.Sprintf("AcceptCallRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AcceptCallRequest) TypeID() uint32 { - return AcceptCallRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AcceptCallRequest) TypeName() string { - return "acceptCall" -} - -// TypeInfo returns info about TL type. -func (a *AcceptCallRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "acceptCall", - ID: AcceptCallRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CallID", - SchemaName: "call_id", - }, - { - Name: "Protocol", - SchemaName: "protocol", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AcceptCallRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode acceptCall#d97562d0 as nil") - } - b.PutID(AcceptCallRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AcceptCallRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode acceptCall#d97562d0 as nil") - } - b.PutInt32(a.CallID) - if err := a.Protocol.Encode(b); err != nil { - return fmt.Errorf("unable to encode acceptCall#d97562d0: field protocol: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AcceptCallRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode acceptCall#d97562d0 to nil") - } - if err := b.ConsumeID(AcceptCallRequestTypeID); err != nil { - return fmt.Errorf("unable to decode acceptCall#d97562d0: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AcceptCallRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode acceptCall#d97562d0 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode acceptCall#d97562d0: field call_id: %w", err) - } - a.CallID = value - } - { - if err := a.Protocol.Decode(b); err != nil { - return fmt.Errorf("unable to decode acceptCall#d97562d0: field protocol: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AcceptCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode acceptCall#d97562d0 as nil") - } - b.ObjStart() - b.PutID("acceptCall") - b.Comma() - b.FieldStart("call_id") - b.PutInt32(a.CallID) - b.Comma() - b.FieldStart("protocol") - if err := a.Protocol.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode acceptCall#d97562d0: field protocol: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AcceptCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode acceptCall#d97562d0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("acceptCall"); err != nil { - return fmt.Errorf("unable to decode acceptCall#d97562d0: %w", err) - } - case "call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode acceptCall#d97562d0: field call_id: %w", err) - } - a.CallID = value - case "protocol": - if err := a.Protocol.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode acceptCall#d97562d0: field protocol: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCallID returns value of CallID field. -func (a *AcceptCallRequest) GetCallID() (value int32) { - if a == nil { - return - } - return a.CallID -} - -// GetProtocol returns value of Protocol field. -func (a *AcceptCallRequest) GetProtocol() (value CallProtocol) { - if a == nil { - return - } - return a.Protocol -} - -// AcceptCall invokes method acceptCall#d97562d0 returning error if any. -func (c *Client) AcceptCall(ctx context.Context, request *AcceptCallRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_accept_terms_of_service_gen.go b/tdapi/tl_accept_terms_of_service_gen.go deleted file mode 100644 index 9e26638ee..000000000 --- a/tdapi/tl_accept_terms_of_service_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AcceptTermsOfServiceRequest represents TL type `acceptTermsOfService#7efe03e4`. -type AcceptTermsOfServiceRequest struct { - // Terms of service identifier - TermsOfServiceID string -} - -// AcceptTermsOfServiceRequestTypeID is TL type id of AcceptTermsOfServiceRequest. -const AcceptTermsOfServiceRequestTypeID = 0x7efe03e4 - -// Ensuring interfaces in compile-time for AcceptTermsOfServiceRequest. -var ( - _ bin.Encoder = &AcceptTermsOfServiceRequest{} - _ bin.Decoder = &AcceptTermsOfServiceRequest{} - _ bin.BareEncoder = &AcceptTermsOfServiceRequest{} - _ bin.BareDecoder = &AcceptTermsOfServiceRequest{} -) - -func (a *AcceptTermsOfServiceRequest) Zero() bool { - if a == nil { - return true - } - if !(a.TermsOfServiceID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AcceptTermsOfServiceRequest) String() string { - if a == nil { - return "AcceptTermsOfServiceRequest(nil)" - } - type Alias AcceptTermsOfServiceRequest - return fmt.Sprintf("AcceptTermsOfServiceRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AcceptTermsOfServiceRequest) TypeID() uint32 { - return AcceptTermsOfServiceRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AcceptTermsOfServiceRequest) TypeName() string { - return "acceptTermsOfService" -} - -// TypeInfo returns info about TL type. -func (a *AcceptTermsOfServiceRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "acceptTermsOfService", - ID: AcceptTermsOfServiceRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TermsOfServiceID", - SchemaName: "terms_of_service_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AcceptTermsOfServiceRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode acceptTermsOfService#7efe03e4 as nil") - } - b.PutID(AcceptTermsOfServiceRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AcceptTermsOfServiceRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode acceptTermsOfService#7efe03e4 as nil") - } - b.PutString(a.TermsOfServiceID) - return nil -} - -// Decode implements bin.Decoder. -func (a *AcceptTermsOfServiceRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode acceptTermsOfService#7efe03e4 to nil") - } - if err := b.ConsumeID(AcceptTermsOfServiceRequestTypeID); err != nil { - return fmt.Errorf("unable to decode acceptTermsOfService#7efe03e4: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AcceptTermsOfServiceRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode acceptTermsOfService#7efe03e4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode acceptTermsOfService#7efe03e4: field terms_of_service_id: %w", err) - } - a.TermsOfServiceID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AcceptTermsOfServiceRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode acceptTermsOfService#7efe03e4 as nil") - } - b.ObjStart() - b.PutID("acceptTermsOfService") - b.Comma() - b.FieldStart("terms_of_service_id") - b.PutString(a.TermsOfServiceID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AcceptTermsOfServiceRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode acceptTermsOfService#7efe03e4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("acceptTermsOfService"); err != nil { - return fmt.Errorf("unable to decode acceptTermsOfService#7efe03e4: %w", err) - } - case "terms_of_service_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode acceptTermsOfService#7efe03e4: field terms_of_service_id: %w", err) - } - a.TermsOfServiceID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTermsOfServiceID returns value of TermsOfServiceID field. -func (a *AcceptTermsOfServiceRequest) GetTermsOfServiceID() (value string) { - if a == nil { - return - } - return a.TermsOfServiceID -} - -// AcceptTermsOfService invokes method acceptTermsOfService#7efe03e4 returning error if any. -func (c *Client) AcceptTermsOfService(ctx context.Context, termsofserviceid string) error { - var ok Ok - - request := &AcceptTermsOfServiceRequest{ - TermsOfServiceID: termsofserviceid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_account_ttl_gen.go b/tdapi/tl_account_ttl_gen.go deleted file mode 100644 index a0a36dbcc..000000000 --- a/tdapi/tl_account_ttl_gen.go +++ /dev/null @@ -1,194 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AccountTTL represents TL type `accountTtl#4ef23284`. -type AccountTTL struct { - // Number of days of inactivity before the account will be flagged for deletion; 30-730 - // days - Days int32 -} - -// AccountTTLTypeID is TL type id of AccountTTL. -const AccountTTLTypeID = 0x4ef23284 - -// Ensuring interfaces in compile-time for AccountTTL. -var ( - _ bin.Encoder = &AccountTTL{} - _ bin.Decoder = &AccountTTL{} - _ bin.BareEncoder = &AccountTTL{} - _ bin.BareDecoder = &AccountTTL{} -) - -func (a *AccountTTL) Zero() bool { - if a == nil { - return true - } - if !(a.Days == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AccountTTL) String() string { - if a == nil { - return "AccountTTL(nil)" - } - type Alias AccountTTL - return fmt.Sprintf("AccountTTL%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AccountTTL) TypeID() uint32 { - return AccountTTLTypeID -} - -// TypeName returns name of type in TL schema. -func (*AccountTTL) TypeName() string { - return "accountTtl" -} - -// TypeInfo returns info about TL type. -func (a *AccountTTL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "accountTtl", - ID: AccountTTLTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Days", - SchemaName: "days", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AccountTTL) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode accountTtl#4ef23284 as nil") - } - b.PutID(AccountTTLTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AccountTTL) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode accountTtl#4ef23284 as nil") - } - b.PutInt32(a.Days) - return nil -} - -// Decode implements bin.Decoder. -func (a *AccountTTL) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode accountTtl#4ef23284 to nil") - } - if err := b.ConsumeID(AccountTTLTypeID); err != nil { - return fmt.Errorf("unable to decode accountTtl#4ef23284: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AccountTTL) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode accountTtl#4ef23284 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accountTtl#4ef23284: field days: %w", err) - } - a.Days = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AccountTTL) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode accountTtl#4ef23284 as nil") - } - b.ObjStart() - b.PutID("accountTtl") - b.Comma() - b.FieldStart("days") - b.PutInt32(a.Days) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AccountTTL) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode accountTtl#4ef23284 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("accountTtl"); err != nil { - return fmt.Errorf("unable to decode accountTtl#4ef23284: %w", err) - } - case "days": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode accountTtl#4ef23284: field days: %w", err) - } - a.Days = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDays returns value of Days field. -func (a *AccountTTL) GetDays() (value int32) { - if a == nil { - return - } - return a.Days -} diff --git a/tdapi/tl_activate_story_stealth_mode_gen.go b/tdapi/tl_activate_story_stealth_mode_gen.go deleted file mode 100644 index 63e9f087c..000000000 --- a/tdapi/tl_activate_story_stealth_mode_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ActivateStoryStealthModeRequest represents TL type `activateStoryStealthMode#c3db8491`. -type ActivateStoryStealthModeRequest struct { -} - -// ActivateStoryStealthModeRequestTypeID is TL type id of ActivateStoryStealthModeRequest. -const ActivateStoryStealthModeRequestTypeID = 0xc3db8491 - -// Ensuring interfaces in compile-time for ActivateStoryStealthModeRequest. -var ( - _ bin.Encoder = &ActivateStoryStealthModeRequest{} - _ bin.Decoder = &ActivateStoryStealthModeRequest{} - _ bin.BareEncoder = &ActivateStoryStealthModeRequest{} - _ bin.BareDecoder = &ActivateStoryStealthModeRequest{} -) - -func (a *ActivateStoryStealthModeRequest) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *ActivateStoryStealthModeRequest) String() string { - if a == nil { - return "ActivateStoryStealthModeRequest(nil)" - } - type Alias ActivateStoryStealthModeRequest - return fmt.Sprintf("ActivateStoryStealthModeRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ActivateStoryStealthModeRequest) TypeID() uint32 { - return ActivateStoryStealthModeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ActivateStoryStealthModeRequest) TypeName() string { - return "activateStoryStealthMode" -} - -// TypeInfo returns info about TL type. -func (a *ActivateStoryStealthModeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "activateStoryStealthMode", - ID: ActivateStoryStealthModeRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *ActivateStoryStealthModeRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode activateStoryStealthMode#c3db8491 as nil") - } - b.PutID(ActivateStoryStealthModeRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *ActivateStoryStealthModeRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode activateStoryStealthMode#c3db8491 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *ActivateStoryStealthModeRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode activateStoryStealthMode#c3db8491 to nil") - } - if err := b.ConsumeID(ActivateStoryStealthModeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode activateStoryStealthMode#c3db8491: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *ActivateStoryStealthModeRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode activateStoryStealthMode#c3db8491 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *ActivateStoryStealthModeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode activateStoryStealthMode#c3db8491 as nil") - } - b.ObjStart() - b.PutID("activateStoryStealthMode") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *ActivateStoryStealthModeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode activateStoryStealthMode#c3db8491 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("activateStoryStealthMode"); err != nil { - return fmt.Errorf("unable to decode activateStoryStealthMode#c3db8491: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ActivateStoryStealthMode invokes method activateStoryStealthMode#c3db8491 returning error if any. -func (c *Client) ActivateStoryStealthMode(ctx context.Context) error { - var ok Ok - - request := &ActivateStoryStealthModeRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_bot_media_preview_gen.go b/tdapi/tl_add_bot_media_preview_gen.go deleted file mode 100644 index 9a8383434..000000000 --- a/tdapi/tl_add_bot_media_preview_gen.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddBotMediaPreviewRequest represents TL type `addBotMediaPreview#504b852b`. -type AddBotMediaPreviewRequest struct { - // Identifier of the target bot. The bot must be owned and must have the main Web App - BotUserID int64 - // A two-letter ISO 639-1 language code for which preview is added. If empty, then the - // preview will be shown to all users for whose languages there are no dedicated previews. - LanguageCode string - // Content of the added preview - Content InputStoryContentClass -} - -// AddBotMediaPreviewRequestTypeID is TL type id of AddBotMediaPreviewRequest. -const AddBotMediaPreviewRequestTypeID = 0x504b852b - -// Ensuring interfaces in compile-time for AddBotMediaPreviewRequest. -var ( - _ bin.Encoder = &AddBotMediaPreviewRequest{} - _ bin.Decoder = &AddBotMediaPreviewRequest{} - _ bin.BareEncoder = &AddBotMediaPreviewRequest{} - _ bin.BareDecoder = &AddBotMediaPreviewRequest{} -) - -func (a *AddBotMediaPreviewRequest) Zero() bool { - if a == nil { - return true - } - if !(a.BotUserID == 0) { - return false - } - if !(a.LanguageCode == "") { - return false - } - if !(a.Content == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddBotMediaPreviewRequest) String() string { - if a == nil { - return "AddBotMediaPreviewRequest(nil)" - } - type Alias AddBotMediaPreviewRequest - return fmt.Sprintf("AddBotMediaPreviewRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddBotMediaPreviewRequest) TypeID() uint32 { - return AddBotMediaPreviewRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddBotMediaPreviewRequest) TypeName() string { - return "addBotMediaPreview" -} - -// TypeInfo returns info about TL type. -func (a *AddBotMediaPreviewRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addBotMediaPreview", - ID: AddBotMediaPreviewRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - { - Name: "Content", - SchemaName: "content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddBotMediaPreviewRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addBotMediaPreview#504b852b as nil") - } - b.PutID(AddBotMediaPreviewRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddBotMediaPreviewRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addBotMediaPreview#504b852b as nil") - } - b.PutInt53(a.BotUserID) - b.PutString(a.LanguageCode) - if a.Content == nil { - return fmt.Errorf("unable to encode addBotMediaPreview#504b852b: field content is nil") - } - if err := a.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode addBotMediaPreview#504b852b: field content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddBotMediaPreviewRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addBotMediaPreview#504b852b to nil") - } - if err := b.ConsumeID(AddBotMediaPreviewRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddBotMediaPreviewRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addBotMediaPreview#504b852b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field bot_user_id: %w", err) - } - a.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field language_code: %w", err) - } - a.LanguageCode = value - } - { - value, err := DecodeInputStoryContent(b) - if err != nil { - return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field content: %w", err) - } - a.Content = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddBotMediaPreviewRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addBotMediaPreview#504b852b as nil") - } - b.ObjStart() - b.PutID("addBotMediaPreview") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(a.BotUserID) - b.Comma() - b.FieldStart("language_code") - b.PutString(a.LanguageCode) - b.Comma() - b.FieldStart("content") - if a.Content == nil { - return fmt.Errorf("unable to encode addBotMediaPreview#504b852b: field content is nil") - } - if err := a.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addBotMediaPreview#504b852b: field content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddBotMediaPreviewRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addBotMediaPreview#504b852b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addBotMediaPreview"); err != nil { - return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field bot_user_id: %w", err) - } - a.BotUserID = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field language_code: %w", err) - } - a.LanguageCode = value - case "content": - value, err := DecodeTDLibJSONInputStoryContent(b) - if err != nil { - return fmt.Errorf("unable to decode addBotMediaPreview#504b852b: field content: %w", err) - } - a.Content = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (a *AddBotMediaPreviewRequest) GetBotUserID() (value int64) { - if a == nil { - return - } - return a.BotUserID -} - -// GetLanguageCode returns value of LanguageCode field. -func (a *AddBotMediaPreviewRequest) GetLanguageCode() (value string) { - if a == nil { - return - } - return a.LanguageCode -} - -// GetContent returns value of Content field. -func (a *AddBotMediaPreviewRequest) GetContent() (value InputStoryContentClass) { - if a == nil { - return - } - return a.Content -} - -// AddBotMediaPreview invokes method addBotMediaPreview#504b852b returning error if any. -func (c *Client) AddBotMediaPreview(ctx context.Context, request *AddBotMediaPreviewRequest) (*BotMediaPreview, error) { - var result BotMediaPreview - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_add_chat_folder_by_invite_link_gen.go b/tdapi/tl_add_chat_folder_by_invite_link_gen.go deleted file mode 100644 index ad6b2742d..000000000 --- a/tdapi/tl_add_chat_folder_by_invite_link_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddChatFolderByInviteLinkRequest represents TL type `addChatFolderByInviteLink#1ed19dae`. -type AddChatFolderByInviteLinkRequest struct { - // Invite link for the chat folder - InviteLink string - // Identifiers of the chats added to the chat folder. The chats are automatically joined - // if they aren't joined yet - ChatIDs []int64 -} - -// AddChatFolderByInviteLinkRequestTypeID is TL type id of AddChatFolderByInviteLinkRequest. -const AddChatFolderByInviteLinkRequestTypeID = 0x1ed19dae - -// Ensuring interfaces in compile-time for AddChatFolderByInviteLinkRequest. -var ( - _ bin.Encoder = &AddChatFolderByInviteLinkRequest{} - _ bin.Decoder = &AddChatFolderByInviteLinkRequest{} - _ bin.BareEncoder = &AddChatFolderByInviteLinkRequest{} - _ bin.BareDecoder = &AddChatFolderByInviteLinkRequest{} -) - -func (a *AddChatFolderByInviteLinkRequest) Zero() bool { - if a == nil { - return true - } - if !(a.InviteLink == "") { - return false - } - if !(a.ChatIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddChatFolderByInviteLinkRequest) String() string { - if a == nil { - return "AddChatFolderByInviteLinkRequest(nil)" - } - type Alias AddChatFolderByInviteLinkRequest - return fmt.Sprintf("AddChatFolderByInviteLinkRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddChatFolderByInviteLinkRequest) TypeID() uint32 { - return AddChatFolderByInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddChatFolderByInviteLinkRequest) TypeName() string { - return "addChatFolderByInviteLink" -} - -// TypeInfo returns info about TL type. -func (a *AddChatFolderByInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addChatFolderByInviteLink", - ID: AddChatFolderByInviteLinkRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "ChatIDs", - SchemaName: "chat_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddChatFolderByInviteLinkRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addChatFolderByInviteLink#1ed19dae as nil") - } - b.PutID(AddChatFolderByInviteLinkRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddChatFolderByInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addChatFolderByInviteLink#1ed19dae as nil") - } - b.PutString(a.InviteLink) - b.PutInt(len(a.ChatIDs)) - for _, v := range a.ChatIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddChatFolderByInviteLinkRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addChatFolderByInviteLink#1ed19dae to nil") - } - if err := b.ConsumeID(AddChatFolderByInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addChatFolderByInviteLink#1ed19dae: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddChatFolderByInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addChatFolderByInviteLink#1ed19dae to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addChatFolderByInviteLink#1ed19dae: field invite_link: %w", err) - } - a.InviteLink = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode addChatFolderByInviteLink#1ed19dae: field chat_ids: %w", err) - } - - if headerLen > 0 { - a.ChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatFolderByInviteLink#1ed19dae: field chat_ids: %w", err) - } - a.ChatIDs = append(a.ChatIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddChatFolderByInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addChatFolderByInviteLink#1ed19dae as nil") - } - b.ObjStart() - b.PutID("addChatFolderByInviteLink") - b.Comma() - b.FieldStart("invite_link") - b.PutString(a.InviteLink) - b.Comma() - b.FieldStart("chat_ids") - b.ArrStart() - for _, v := range a.ChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddChatFolderByInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addChatFolderByInviteLink#1ed19dae to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addChatFolderByInviteLink"); err != nil { - return fmt.Errorf("unable to decode addChatFolderByInviteLink#1ed19dae: %w", err) - } - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addChatFolderByInviteLink#1ed19dae: field invite_link: %w", err) - } - a.InviteLink = value - case "chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatFolderByInviteLink#1ed19dae: field chat_ids: %w", err) - } - a.ChatIDs = append(a.ChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode addChatFolderByInviteLink#1ed19dae: field chat_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (a *AddChatFolderByInviteLinkRequest) GetInviteLink() (value string) { - if a == nil { - return - } - return a.InviteLink -} - -// GetChatIDs returns value of ChatIDs field. -func (a *AddChatFolderByInviteLinkRequest) GetChatIDs() (value []int64) { - if a == nil { - return - } - return a.ChatIDs -} - -// AddChatFolderByInviteLink invokes method addChatFolderByInviteLink#1ed19dae returning error if any. -func (c *Client) AddChatFolderByInviteLink(ctx context.Context, request *AddChatFolderByInviteLinkRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_chat_member_gen.go b/tdapi/tl_add_chat_member_gen.go deleted file mode 100644 index 43c9ec640..000000000 --- a/tdapi/tl_add_chat_member_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddChatMemberRequest represents TL type `addChatMember#66875217`. -type AddChatMemberRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the user - UserID int64 - // The number of earlier messages from the chat to be forwarded to the new member; up to - // 100. Ignored for supergroups and channels, or if the added user is a bot - ForwardLimit int32 -} - -// AddChatMemberRequestTypeID is TL type id of AddChatMemberRequest. -const AddChatMemberRequestTypeID = 0x66875217 - -// Ensuring interfaces in compile-time for AddChatMemberRequest. -var ( - _ bin.Encoder = &AddChatMemberRequest{} - _ bin.Decoder = &AddChatMemberRequest{} - _ bin.BareEncoder = &AddChatMemberRequest{} - _ bin.BareDecoder = &AddChatMemberRequest{} -) - -func (a *AddChatMemberRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ChatID == 0) { - return false - } - if !(a.UserID == 0) { - return false - } - if !(a.ForwardLimit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddChatMemberRequest) String() string { - if a == nil { - return "AddChatMemberRequest(nil)" - } - type Alias AddChatMemberRequest - return fmt.Sprintf("AddChatMemberRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddChatMemberRequest) TypeID() uint32 { - return AddChatMemberRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddChatMemberRequest) TypeName() string { - return "addChatMember" -} - -// TypeInfo returns info about TL type. -func (a *AddChatMemberRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addChatMember", - ID: AddChatMemberRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "ForwardLimit", - SchemaName: "forward_limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddChatMemberRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addChatMember#66875217 as nil") - } - b.PutID(AddChatMemberRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddChatMemberRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addChatMember#66875217 as nil") - } - b.PutInt53(a.ChatID) - b.PutInt53(a.UserID) - b.PutInt32(a.ForwardLimit) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddChatMemberRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addChatMember#66875217 to nil") - } - if err := b.ConsumeID(AddChatMemberRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addChatMember#66875217: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddChatMemberRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addChatMember#66875217 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatMember#66875217: field chat_id: %w", err) - } - a.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatMember#66875217: field user_id: %w", err) - } - a.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addChatMember#66875217: field forward_limit: %w", err) - } - a.ForwardLimit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddChatMemberRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addChatMember#66875217 as nil") - } - b.ObjStart() - b.PutID("addChatMember") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(a.UserID) - b.Comma() - b.FieldStart("forward_limit") - b.PutInt32(a.ForwardLimit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddChatMemberRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addChatMember#66875217 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addChatMember"); err != nil { - return fmt.Errorf("unable to decode addChatMember#66875217: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatMember#66875217: field chat_id: %w", err) - } - a.ChatID = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatMember#66875217: field user_id: %w", err) - } - a.UserID = value - case "forward_limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addChatMember#66875217: field forward_limit: %w", err) - } - a.ForwardLimit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (a *AddChatMemberRequest) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// GetUserID returns value of UserID field. -func (a *AddChatMemberRequest) GetUserID() (value int64) { - if a == nil { - return - } - return a.UserID -} - -// GetForwardLimit returns value of ForwardLimit field. -func (a *AddChatMemberRequest) GetForwardLimit() (value int32) { - if a == nil { - return - } - return a.ForwardLimit -} - -// AddChatMember invokes method addChatMember#66875217 returning error if any. -func (c *Client) AddChatMember(ctx context.Context, request *AddChatMemberRequest) (*FailedToAddMembers, error) { - var result FailedToAddMembers - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_add_chat_members_gen.go b/tdapi/tl_add_chat_members_gen.go deleted file mode 100644 index e9de4e4b4..000000000 --- a/tdapi/tl_add_chat_members_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddChatMembersRequest represents TL type `addChatMembers#1a3232f`. -type AddChatMembersRequest struct { - // Chat identifier - ChatID int64 - // Identifiers of the users to be added to the chat. The maximum number of added users is - // 20 for supergroups and 100 for channels - UserIDs []int64 -} - -// AddChatMembersRequestTypeID is TL type id of AddChatMembersRequest. -const AddChatMembersRequestTypeID = 0x1a3232f - -// Ensuring interfaces in compile-time for AddChatMembersRequest. -var ( - _ bin.Encoder = &AddChatMembersRequest{} - _ bin.Decoder = &AddChatMembersRequest{} - _ bin.BareEncoder = &AddChatMembersRequest{} - _ bin.BareDecoder = &AddChatMembersRequest{} -) - -func (a *AddChatMembersRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ChatID == 0) { - return false - } - if !(a.UserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddChatMembersRequest) String() string { - if a == nil { - return "AddChatMembersRequest(nil)" - } - type Alias AddChatMembersRequest - return fmt.Sprintf("AddChatMembersRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddChatMembersRequest) TypeID() uint32 { - return AddChatMembersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddChatMembersRequest) TypeName() string { - return "addChatMembers" -} - -// TypeInfo returns info about TL type. -func (a *AddChatMembersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addChatMembers", - ID: AddChatMembersRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddChatMembersRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addChatMembers#1a3232f as nil") - } - b.PutID(AddChatMembersRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddChatMembersRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addChatMembers#1a3232f as nil") - } - b.PutInt53(a.ChatID) - b.PutInt(len(a.UserIDs)) - for _, v := range a.UserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddChatMembersRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addChatMembers#1a3232f to nil") - } - if err := b.ConsumeID(AddChatMembersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addChatMembers#1a3232f: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddChatMembersRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addChatMembers#1a3232f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatMembers#1a3232f: field chat_id: %w", err) - } - a.ChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode addChatMembers#1a3232f: field user_ids: %w", err) - } - - if headerLen > 0 { - a.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatMembers#1a3232f: field user_ids: %w", err) - } - a.UserIDs = append(a.UserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddChatMembersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addChatMembers#1a3232f as nil") - } - b.ObjStart() - b.PutID("addChatMembers") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range a.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddChatMembersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addChatMembers#1a3232f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addChatMembers"); err != nil { - return fmt.Errorf("unable to decode addChatMembers#1a3232f: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatMembers#1a3232f: field chat_id: %w", err) - } - a.ChatID = value - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatMembers#1a3232f: field user_ids: %w", err) - } - a.UserIDs = append(a.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode addChatMembers#1a3232f: field user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (a *AddChatMembersRequest) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// GetUserIDs returns value of UserIDs field. -func (a *AddChatMembersRequest) GetUserIDs() (value []int64) { - if a == nil { - return - } - return a.UserIDs -} - -// AddChatMembers invokes method addChatMembers#1a3232f returning error if any. -func (c *Client) AddChatMembers(ctx context.Context, request *AddChatMembersRequest) (*FailedToAddMembers, error) { - var result FailedToAddMembers - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_add_chat_to_list_gen.go b/tdapi/tl_add_chat_to_list_gen.go deleted file mode 100644 index ba01cc8ec..000000000 --- a/tdapi/tl_add_chat_to_list_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddChatToListRequest represents TL type `addChatToList#fb334eb5`. -type AddChatToListRequest struct { - // Chat identifier - ChatID int64 - // The chat list. Use getChatListsToAddChat to get suitable chat lists - ChatList ChatListClass -} - -// AddChatToListRequestTypeID is TL type id of AddChatToListRequest. -const AddChatToListRequestTypeID = 0xfb334eb5 - -// Ensuring interfaces in compile-time for AddChatToListRequest. -var ( - _ bin.Encoder = &AddChatToListRequest{} - _ bin.Decoder = &AddChatToListRequest{} - _ bin.BareEncoder = &AddChatToListRequest{} - _ bin.BareDecoder = &AddChatToListRequest{} -) - -func (a *AddChatToListRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ChatID == 0) { - return false - } - if !(a.ChatList == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddChatToListRequest) String() string { - if a == nil { - return "AddChatToListRequest(nil)" - } - type Alias AddChatToListRequest - return fmt.Sprintf("AddChatToListRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddChatToListRequest) TypeID() uint32 { - return AddChatToListRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddChatToListRequest) TypeName() string { - return "addChatToList" -} - -// TypeInfo returns info about TL type. -func (a *AddChatToListRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addChatToList", - ID: AddChatToListRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ChatList", - SchemaName: "chat_list", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddChatToListRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addChatToList#fb334eb5 as nil") - } - b.PutID(AddChatToListRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddChatToListRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addChatToList#fb334eb5 as nil") - } - b.PutInt53(a.ChatID) - if a.ChatList == nil { - return fmt.Errorf("unable to encode addChatToList#fb334eb5: field chat_list is nil") - } - if err := a.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode addChatToList#fb334eb5: field chat_list: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddChatToListRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addChatToList#fb334eb5 to nil") - } - if err := b.ConsumeID(AddChatToListRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addChatToList#fb334eb5: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddChatToListRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addChatToList#fb334eb5 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatToList#fb334eb5: field chat_id: %w", err) - } - a.ChatID = value - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode addChatToList#fb334eb5: field chat_list: %w", err) - } - a.ChatList = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddChatToListRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addChatToList#fb334eb5 as nil") - } - b.ObjStart() - b.PutID("addChatToList") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.FieldStart("chat_list") - if a.ChatList == nil { - return fmt.Errorf("unable to encode addChatToList#fb334eb5: field chat_list is nil") - } - if err := a.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addChatToList#fb334eb5: field chat_list: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddChatToListRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addChatToList#fb334eb5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addChatToList"); err != nil { - return fmt.Errorf("unable to decode addChatToList#fb334eb5: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addChatToList#fb334eb5: field chat_id: %w", err) - } - a.ChatID = value - case "chat_list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode addChatToList#fb334eb5: field chat_list: %w", err) - } - a.ChatList = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (a *AddChatToListRequest) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// GetChatList returns value of ChatList field. -func (a *AddChatToListRequest) GetChatList() (value ChatListClass) { - if a == nil { - return - } - return a.ChatList -} - -// AddChatToList invokes method addChatToList#fb334eb5 returning error if any. -func (c *Client) AddChatToList(ctx context.Context, request *AddChatToListRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_contact_gen.go b/tdapi/tl_add_contact_gen.go deleted file mode 100644 index 7139e27cb..000000000 --- a/tdapi/tl_add_contact_gen.go +++ /dev/null @@ -1,239 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddContactRequest represents TL type `addContact#6f707140`. -type AddContactRequest struct { - // The contact to add or edit; phone number may be empty and needs to be specified only - // if known, vCard is ignored - Contact Contact - // Pass true to share the current user's phone number with the new contact. A - // corresponding rule to userPrivacySettingShowPhoneNumber will be added if needed. - SharePhoneNumber bool -} - -// AddContactRequestTypeID is TL type id of AddContactRequest. -const AddContactRequestTypeID = 0x6f707140 - -// Ensuring interfaces in compile-time for AddContactRequest. -var ( - _ bin.Encoder = &AddContactRequest{} - _ bin.Decoder = &AddContactRequest{} - _ bin.BareEncoder = &AddContactRequest{} - _ bin.BareDecoder = &AddContactRequest{} -) - -func (a *AddContactRequest) Zero() bool { - if a == nil { - return true - } - if !(a.Contact.Zero()) { - return false - } - if !(a.SharePhoneNumber == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddContactRequest) String() string { - if a == nil { - return "AddContactRequest(nil)" - } - type Alias AddContactRequest - return fmt.Sprintf("AddContactRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddContactRequest) TypeID() uint32 { - return AddContactRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddContactRequest) TypeName() string { - return "addContact" -} - -// TypeInfo returns info about TL type. -func (a *AddContactRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addContact", - ID: AddContactRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Contact", - SchemaName: "contact", - }, - { - Name: "SharePhoneNumber", - SchemaName: "share_phone_number", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddContactRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addContact#6f707140 as nil") - } - b.PutID(AddContactRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddContactRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addContact#6f707140 as nil") - } - if err := a.Contact.Encode(b); err != nil { - return fmt.Errorf("unable to encode addContact#6f707140: field contact: %w", err) - } - b.PutBool(a.SharePhoneNumber) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddContactRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addContact#6f707140 to nil") - } - if err := b.ConsumeID(AddContactRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addContact#6f707140: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddContactRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addContact#6f707140 to nil") - } - { - if err := a.Contact.Decode(b); err != nil { - return fmt.Errorf("unable to decode addContact#6f707140: field contact: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addContact#6f707140: field share_phone_number: %w", err) - } - a.SharePhoneNumber = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddContactRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addContact#6f707140 as nil") - } - b.ObjStart() - b.PutID("addContact") - b.Comma() - b.FieldStart("contact") - if err := a.Contact.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addContact#6f707140: field contact: %w", err) - } - b.Comma() - b.FieldStart("share_phone_number") - b.PutBool(a.SharePhoneNumber) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddContactRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addContact#6f707140 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addContact"); err != nil { - return fmt.Errorf("unable to decode addContact#6f707140: %w", err) - } - case "contact": - if err := a.Contact.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode addContact#6f707140: field contact: %w", err) - } - case "share_phone_number": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addContact#6f707140: field share_phone_number: %w", err) - } - a.SharePhoneNumber = value - default: - return b.Skip() - } - return nil - }) -} - -// GetContact returns value of Contact field. -func (a *AddContactRequest) GetContact() (value Contact) { - if a == nil { - return - } - return a.Contact -} - -// GetSharePhoneNumber returns value of SharePhoneNumber field. -func (a *AddContactRequest) GetSharePhoneNumber() (value bool) { - if a == nil { - return - } - return a.SharePhoneNumber -} - -// AddContact invokes method addContact#6f707140 returning error if any. -func (c *Client) AddContact(ctx context.Context, request *AddContactRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_custom_server_language_pack_gen.go b/tdapi/tl_add_custom_server_language_pack_gen.go deleted file mode 100644 index f766ebdb9..000000000 --- a/tdapi/tl_add_custom_server_language_pack_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddCustomServerLanguagePackRequest represents TL type `addCustomServerLanguagePack#448de3`. -type AddCustomServerLanguagePackRequest struct { - // Identifier of a language pack to be added - LanguagePackID string -} - -// AddCustomServerLanguagePackRequestTypeID is TL type id of AddCustomServerLanguagePackRequest. -const AddCustomServerLanguagePackRequestTypeID = 0x448de3 - -// Ensuring interfaces in compile-time for AddCustomServerLanguagePackRequest. -var ( - _ bin.Encoder = &AddCustomServerLanguagePackRequest{} - _ bin.Decoder = &AddCustomServerLanguagePackRequest{} - _ bin.BareEncoder = &AddCustomServerLanguagePackRequest{} - _ bin.BareDecoder = &AddCustomServerLanguagePackRequest{} -) - -func (a *AddCustomServerLanguagePackRequest) Zero() bool { - if a == nil { - return true - } - if !(a.LanguagePackID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddCustomServerLanguagePackRequest) String() string { - if a == nil { - return "AddCustomServerLanguagePackRequest(nil)" - } - type Alias AddCustomServerLanguagePackRequest - return fmt.Sprintf("AddCustomServerLanguagePackRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddCustomServerLanguagePackRequest) TypeID() uint32 { - return AddCustomServerLanguagePackRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddCustomServerLanguagePackRequest) TypeName() string { - return "addCustomServerLanguagePack" -} - -// TypeInfo returns info about TL type. -func (a *AddCustomServerLanguagePackRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addCustomServerLanguagePack", - ID: AddCustomServerLanguagePackRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LanguagePackID", - SchemaName: "language_pack_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddCustomServerLanguagePackRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addCustomServerLanguagePack#448de3 as nil") - } - b.PutID(AddCustomServerLanguagePackRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddCustomServerLanguagePackRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addCustomServerLanguagePack#448de3 as nil") - } - b.PutString(a.LanguagePackID) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddCustomServerLanguagePackRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addCustomServerLanguagePack#448de3 to nil") - } - if err := b.ConsumeID(AddCustomServerLanguagePackRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addCustomServerLanguagePack#448de3: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddCustomServerLanguagePackRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addCustomServerLanguagePack#448de3 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addCustomServerLanguagePack#448de3: field language_pack_id: %w", err) - } - a.LanguagePackID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddCustomServerLanguagePackRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addCustomServerLanguagePack#448de3 as nil") - } - b.ObjStart() - b.PutID("addCustomServerLanguagePack") - b.Comma() - b.FieldStart("language_pack_id") - b.PutString(a.LanguagePackID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddCustomServerLanguagePackRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addCustomServerLanguagePack#448de3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addCustomServerLanguagePack"); err != nil { - return fmt.Errorf("unable to decode addCustomServerLanguagePack#448de3: %w", err) - } - case "language_pack_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addCustomServerLanguagePack#448de3: field language_pack_id: %w", err) - } - a.LanguagePackID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguagePackID returns value of LanguagePackID field. -func (a *AddCustomServerLanguagePackRequest) GetLanguagePackID() (value string) { - if a == nil { - return - } - return a.LanguagePackID -} - -// AddCustomServerLanguagePack invokes method addCustomServerLanguagePack#448de3 returning error if any. -func (c *Client) AddCustomServerLanguagePack(ctx context.Context, languagepackid string) error { - var ok Ok - - request := &AddCustomServerLanguagePackRequest{ - LanguagePackID: languagepackid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_favorite_sticker_gen.go b/tdapi/tl_add_favorite_sticker_gen.go deleted file mode 100644 index eaadb05b5..000000000 --- a/tdapi/tl_add_favorite_sticker_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddFavoriteStickerRequest represents TL type `addFavoriteSticker#13578cdf`. -type AddFavoriteStickerRequest struct { - // Sticker file to add - Sticker InputFileClass -} - -// AddFavoriteStickerRequestTypeID is TL type id of AddFavoriteStickerRequest. -const AddFavoriteStickerRequestTypeID = 0x13578cdf - -// Ensuring interfaces in compile-time for AddFavoriteStickerRequest. -var ( - _ bin.Encoder = &AddFavoriteStickerRequest{} - _ bin.Decoder = &AddFavoriteStickerRequest{} - _ bin.BareEncoder = &AddFavoriteStickerRequest{} - _ bin.BareDecoder = &AddFavoriteStickerRequest{} -) - -func (a *AddFavoriteStickerRequest) Zero() bool { - if a == nil { - return true - } - if !(a.Sticker == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddFavoriteStickerRequest) String() string { - if a == nil { - return "AddFavoriteStickerRequest(nil)" - } - type Alias AddFavoriteStickerRequest - return fmt.Sprintf("AddFavoriteStickerRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddFavoriteStickerRequest) TypeID() uint32 { - return AddFavoriteStickerRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddFavoriteStickerRequest) TypeName() string { - return "addFavoriteSticker" -} - -// TypeInfo returns info about TL type. -func (a *AddFavoriteStickerRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addFavoriteSticker", - ID: AddFavoriteStickerRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddFavoriteStickerRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addFavoriteSticker#13578cdf as nil") - } - b.PutID(AddFavoriteStickerRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddFavoriteStickerRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addFavoriteSticker#13578cdf as nil") - } - if a.Sticker == nil { - return fmt.Errorf("unable to encode addFavoriteSticker#13578cdf: field sticker is nil") - } - if err := a.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode addFavoriteSticker#13578cdf: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddFavoriteStickerRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addFavoriteSticker#13578cdf to nil") - } - if err := b.ConsumeID(AddFavoriteStickerRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addFavoriteSticker#13578cdf: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddFavoriteStickerRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addFavoriteSticker#13578cdf to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode addFavoriteSticker#13578cdf: field sticker: %w", err) - } - a.Sticker = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddFavoriteStickerRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addFavoriteSticker#13578cdf as nil") - } - b.ObjStart() - b.PutID("addFavoriteSticker") - b.Comma() - b.FieldStart("sticker") - if a.Sticker == nil { - return fmt.Errorf("unable to encode addFavoriteSticker#13578cdf: field sticker is nil") - } - if err := a.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addFavoriteSticker#13578cdf: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddFavoriteStickerRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addFavoriteSticker#13578cdf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addFavoriteSticker"); err != nil { - return fmt.Errorf("unable to decode addFavoriteSticker#13578cdf: %w", err) - } - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode addFavoriteSticker#13578cdf: field sticker: %w", err) - } - a.Sticker = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (a *AddFavoriteStickerRequest) GetSticker() (value InputFileClass) { - if a == nil { - return - } - return a.Sticker -} - -// AddFavoriteSticker invokes method addFavoriteSticker#13578cdf returning error if any. -func (c *Client) AddFavoriteSticker(ctx context.Context, sticker InputFileClass) error { - var ok Ok - - request := &AddFavoriteStickerRequest{ - Sticker: sticker, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_file_to_downloads_gen.go b/tdapi/tl_add_file_to_downloads_gen.go deleted file mode 100644 index 744d903b9..000000000 --- a/tdapi/tl_add_file_to_downloads_gen.go +++ /dev/null @@ -1,307 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddFileToDownloadsRequest represents TL type `addFileToDownloads#33b583b7`. -type AddFileToDownloadsRequest struct { - // Identifier of the file to download - FileID int32 - // Chat identifier of the message with the file - ChatID int64 - // Message identifier - MessageID int64 - // Priority of the download (1-32). The higher the priority, the earlier the file will be - // downloaded. If the priorities of two files are equal, then the last one for which - // downloadFile/addFileToDownloads was called will be downloaded first - Priority int32 -} - -// AddFileToDownloadsRequestTypeID is TL type id of AddFileToDownloadsRequest. -const AddFileToDownloadsRequestTypeID = 0x33b583b7 - -// Ensuring interfaces in compile-time for AddFileToDownloadsRequest. -var ( - _ bin.Encoder = &AddFileToDownloadsRequest{} - _ bin.Decoder = &AddFileToDownloadsRequest{} - _ bin.BareEncoder = &AddFileToDownloadsRequest{} - _ bin.BareDecoder = &AddFileToDownloadsRequest{} -) - -func (a *AddFileToDownloadsRequest) Zero() bool { - if a == nil { - return true - } - if !(a.FileID == 0) { - return false - } - if !(a.ChatID == 0) { - return false - } - if !(a.MessageID == 0) { - return false - } - if !(a.Priority == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddFileToDownloadsRequest) String() string { - if a == nil { - return "AddFileToDownloadsRequest(nil)" - } - type Alias AddFileToDownloadsRequest - return fmt.Sprintf("AddFileToDownloadsRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddFileToDownloadsRequest) TypeID() uint32 { - return AddFileToDownloadsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddFileToDownloadsRequest) TypeName() string { - return "addFileToDownloads" -} - -// TypeInfo returns info about TL type. -func (a *AddFileToDownloadsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addFileToDownloads", - ID: AddFileToDownloadsRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Priority", - SchemaName: "priority", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddFileToDownloadsRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addFileToDownloads#33b583b7 as nil") - } - b.PutID(AddFileToDownloadsRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddFileToDownloadsRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addFileToDownloads#33b583b7 as nil") - } - b.PutInt32(a.FileID) - b.PutInt53(a.ChatID) - b.PutInt53(a.MessageID) - b.PutInt32(a.Priority) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddFileToDownloadsRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addFileToDownloads#33b583b7 to nil") - } - if err := b.ConsumeID(AddFileToDownloadsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addFileToDownloads#33b583b7: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddFileToDownloadsRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addFileToDownloads#33b583b7 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addFileToDownloads#33b583b7: field file_id: %w", err) - } - a.FileID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addFileToDownloads#33b583b7: field chat_id: %w", err) - } - a.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addFileToDownloads#33b583b7: field message_id: %w", err) - } - a.MessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addFileToDownloads#33b583b7: field priority: %w", err) - } - a.Priority = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddFileToDownloadsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addFileToDownloads#33b583b7 as nil") - } - b.ObjStart() - b.PutID("addFileToDownloads") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(a.FileID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(a.MessageID) - b.Comma() - b.FieldStart("priority") - b.PutInt32(a.Priority) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddFileToDownloadsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addFileToDownloads#33b583b7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addFileToDownloads"); err != nil { - return fmt.Errorf("unable to decode addFileToDownloads#33b583b7: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addFileToDownloads#33b583b7: field file_id: %w", err) - } - a.FileID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addFileToDownloads#33b583b7: field chat_id: %w", err) - } - a.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addFileToDownloads#33b583b7: field message_id: %w", err) - } - a.MessageID = value - case "priority": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addFileToDownloads#33b583b7: field priority: %w", err) - } - a.Priority = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (a *AddFileToDownloadsRequest) GetFileID() (value int32) { - if a == nil { - return - } - return a.FileID -} - -// GetChatID returns value of ChatID field. -func (a *AddFileToDownloadsRequest) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// GetMessageID returns value of MessageID field. -func (a *AddFileToDownloadsRequest) GetMessageID() (value int64) { - if a == nil { - return - } - return a.MessageID -} - -// GetPriority returns value of Priority field. -func (a *AddFileToDownloadsRequest) GetPriority() (value int32) { - if a == nil { - return - } - return a.Priority -} - -// AddFileToDownloads invokes method addFileToDownloads#33b583b7 returning error if any. -func (c *Client) AddFileToDownloads(ctx context.Context, request *AddFileToDownloadsRequest) (*File, error) { - var result File - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_add_local_message_gen.go b/tdapi/tl_add_local_message_gen.go deleted file mode 100644 index 89a6ddb53..000000000 --- a/tdapi/tl_add_local_message_gen.go +++ /dev/null @@ -1,369 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddLocalMessageRequest represents TL type `addLocalMessage#f617b7a1`. -type AddLocalMessageRequest struct { - // Target chat - ChatID int64 - // Identifier of the sender of the message - SenderID MessageSenderClass - // Information about the message or story to be replied; pass null if none - ReplyTo InputMessageReplyToClass - // Pass true to disable notification for the message - DisableNotification bool - // The content of the message to be added - InputMessageContent InputMessageContentClass -} - -// AddLocalMessageRequestTypeID is TL type id of AddLocalMessageRequest. -const AddLocalMessageRequestTypeID = 0xf617b7a1 - -// Ensuring interfaces in compile-time for AddLocalMessageRequest. -var ( - _ bin.Encoder = &AddLocalMessageRequest{} - _ bin.Decoder = &AddLocalMessageRequest{} - _ bin.BareEncoder = &AddLocalMessageRequest{} - _ bin.BareDecoder = &AddLocalMessageRequest{} -) - -func (a *AddLocalMessageRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ChatID == 0) { - return false - } - if !(a.SenderID == nil) { - return false - } - if !(a.ReplyTo == nil) { - return false - } - if !(a.DisableNotification == false) { - return false - } - if !(a.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddLocalMessageRequest) String() string { - if a == nil { - return "AddLocalMessageRequest(nil)" - } - type Alias AddLocalMessageRequest - return fmt.Sprintf("AddLocalMessageRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddLocalMessageRequest) TypeID() uint32 { - return AddLocalMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddLocalMessageRequest) TypeName() string { - return "addLocalMessage" -} - -// TypeInfo returns info about TL type. -func (a *AddLocalMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addLocalMessage", - ID: AddLocalMessageRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "SenderID", - SchemaName: "sender_id", - }, - { - Name: "ReplyTo", - SchemaName: "reply_to", - }, - { - Name: "DisableNotification", - SchemaName: "disable_notification", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddLocalMessageRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addLocalMessage#f617b7a1 as nil") - } - b.PutID(AddLocalMessageRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddLocalMessageRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addLocalMessage#f617b7a1 as nil") - } - b.PutInt53(a.ChatID) - if a.SenderID == nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field sender_id is nil") - } - if err := a.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field sender_id: %w", err) - } - if a.ReplyTo == nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field reply_to is nil") - } - if err := a.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field reply_to: %w", err) - } - b.PutBool(a.DisableNotification) - if a.InputMessageContent == nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field input_message_content is nil") - } - if err := a.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddLocalMessageRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addLocalMessage#f617b7a1 to nil") - } - if err := b.ConsumeID(AddLocalMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddLocalMessageRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addLocalMessage#f617b7a1 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: field chat_id: %w", err) - } - a.ChatID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: field sender_id: %w", err) - } - a.SenderID = value - } - { - value, err := DecodeInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: field reply_to: %w", err) - } - a.ReplyTo = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: field disable_notification: %w", err) - } - a.DisableNotification = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: field input_message_content: %w", err) - } - a.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddLocalMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addLocalMessage#f617b7a1 as nil") - } - b.ObjStart() - b.PutID("addLocalMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.FieldStart("sender_id") - if a.SenderID == nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field sender_id is nil") - } - if err := a.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field sender_id: %w", err) - } - b.Comma() - b.FieldStart("reply_to") - if a.ReplyTo == nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field reply_to is nil") - } - if err := a.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field reply_to: %w", err) - } - b.Comma() - b.FieldStart("disable_notification") - b.PutBool(a.DisableNotification) - b.Comma() - b.FieldStart("input_message_content") - if a.InputMessageContent == nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field input_message_content is nil") - } - if err := a.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addLocalMessage#f617b7a1: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddLocalMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addLocalMessage#f617b7a1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addLocalMessage"); err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: field chat_id: %w", err) - } - a.ChatID = value - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: field sender_id: %w", err) - } - a.SenderID = value - case "reply_to": - value, err := DecodeTDLibJSONInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: field reply_to: %w", err) - } - a.ReplyTo = value - case "disable_notification": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: field disable_notification: %w", err) - } - a.DisableNotification = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode addLocalMessage#f617b7a1: field input_message_content: %w", err) - } - a.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (a *AddLocalMessageRequest) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// GetSenderID returns value of SenderID field. -func (a *AddLocalMessageRequest) GetSenderID() (value MessageSenderClass) { - if a == nil { - return - } - return a.SenderID -} - -// GetReplyTo returns value of ReplyTo field. -func (a *AddLocalMessageRequest) GetReplyTo() (value InputMessageReplyToClass) { - if a == nil { - return - } - return a.ReplyTo -} - -// GetDisableNotification returns value of DisableNotification field. -func (a *AddLocalMessageRequest) GetDisableNotification() (value bool) { - if a == nil { - return - } - return a.DisableNotification -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (a *AddLocalMessageRequest) GetInputMessageContent() (value InputMessageContentClass) { - if a == nil { - return - } - return a.InputMessageContent -} - -// AddLocalMessage invokes method addLocalMessage#f617b7a1 returning error if any. -func (c *Client) AddLocalMessage(ctx context.Context, request *AddLocalMessageRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_add_log_message_gen.go b/tdapi/tl_add_log_message_gen.go deleted file mode 100644 index 9dd354554..000000000 --- a/tdapi/tl_add_log_message_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddLogMessageRequest represents TL type `addLogMessage#5f36cfec`. -type AddLogMessageRequest struct { - // The minimum verbosity level needed for the message to be logged; 0-1023 - VerbosityLevel int32 - // Text of a message to log - Text string -} - -// AddLogMessageRequestTypeID is TL type id of AddLogMessageRequest. -const AddLogMessageRequestTypeID = 0x5f36cfec - -// Ensuring interfaces in compile-time for AddLogMessageRequest. -var ( - _ bin.Encoder = &AddLogMessageRequest{} - _ bin.Decoder = &AddLogMessageRequest{} - _ bin.BareEncoder = &AddLogMessageRequest{} - _ bin.BareDecoder = &AddLogMessageRequest{} -) - -func (a *AddLogMessageRequest) Zero() bool { - if a == nil { - return true - } - if !(a.VerbosityLevel == 0) { - return false - } - if !(a.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddLogMessageRequest) String() string { - if a == nil { - return "AddLogMessageRequest(nil)" - } - type Alias AddLogMessageRequest - return fmt.Sprintf("AddLogMessageRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddLogMessageRequest) TypeID() uint32 { - return AddLogMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddLogMessageRequest) TypeName() string { - return "addLogMessage" -} - -// TypeInfo returns info about TL type. -func (a *AddLogMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addLogMessage", - ID: AddLogMessageRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VerbosityLevel", - SchemaName: "verbosity_level", - }, - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddLogMessageRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addLogMessage#5f36cfec as nil") - } - b.PutID(AddLogMessageRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddLogMessageRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addLogMessage#5f36cfec as nil") - } - b.PutInt32(a.VerbosityLevel) - b.PutString(a.Text) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddLogMessageRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addLogMessage#5f36cfec to nil") - } - if err := b.ConsumeID(AddLogMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addLogMessage#5f36cfec: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddLogMessageRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addLogMessage#5f36cfec to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addLogMessage#5f36cfec: field verbosity_level: %w", err) - } - a.VerbosityLevel = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addLogMessage#5f36cfec: field text: %w", err) - } - a.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddLogMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addLogMessage#5f36cfec as nil") - } - b.ObjStart() - b.PutID("addLogMessage") - b.Comma() - b.FieldStart("verbosity_level") - b.PutInt32(a.VerbosityLevel) - b.Comma() - b.FieldStart("text") - b.PutString(a.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddLogMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addLogMessage#5f36cfec to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addLogMessage"); err != nil { - return fmt.Errorf("unable to decode addLogMessage#5f36cfec: %w", err) - } - case "verbosity_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addLogMessage#5f36cfec: field verbosity_level: %w", err) - } - a.VerbosityLevel = value - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addLogMessage#5f36cfec: field text: %w", err) - } - a.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVerbosityLevel returns value of VerbosityLevel field. -func (a *AddLogMessageRequest) GetVerbosityLevel() (value int32) { - if a == nil { - return - } - return a.VerbosityLevel -} - -// GetText returns value of Text field. -func (a *AddLogMessageRequest) GetText() (value string) { - if a == nil { - return - } - return a.Text -} - -// AddLogMessage invokes method addLogMessage#5f36cfec returning error if any. -func (c *Client) AddLogMessage(ctx context.Context, request *AddLogMessageRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_message_reaction_gen.go b/tdapi/tl_add_message_reaction_gen.go deleted file mode 100644 index 294f853bb..000000000 --- a/tdapi/tl_add_message_reaction_gen.go +++ /dev/null @@ -1,351 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddMessageReactionRequest represents TL type `addMessageReaction#549855ed`. -type AddMessageReactionRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // Type of the reaction to add. Use addPendingPaidMessageReaction instead to add the paid - // reaction - ReactionType ReactionTypeClass - // Pass true if the reaction is added with a big animation - IsBig bool - // Pass true if the reaction needs to be added to recent reactions; tags are never added - // to the list of recent reactions - UpdateRecentReactions bool -} - -// AddMessageReactionRequestTypeID is TL type id of AddMessageReactionRequest. -const AddMessageReactionRequestTypeID = 0x549855ed - -// Ensuring interfaces in compile-time for AddMessageReactionRequest. -var ( - _ bin.Encoder = &AddMessageReactionRequest{} - _ bin.Decoder = &AddMessageReactionRequest{} - _ bin.BareEncoder = &AddMessageReactionRequest{} - _ bin.BareDecoder = &AddMessageReactionRequest{} -) - -func (a *AddMessageReactionRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ChatID == 0) { - return false - } - if !(a.MessageID == 0) { - return false - } - if !(a.ReactionType == nil) { - return false - } - if !(a.IsBig == false) { - return false - } - if !(a.UpdateRecentReactions == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddMessageReactionRequest) String() string { - if a == nil { - return "AddMessageReactionRequest(nil)" - } - type Alias AddMessageReactionRequest - return fmt.Sprintf("AddMessageReactionRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddMessageReactionRequest) TypeID() uint32 { - return AddMessageReactionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddMessageReactionRequest) TypeName() string { - return "addMessageReaction" -} - -// TypeInfo returns info about TL type. -func (a *AddMessageReactionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addMessageReaction", - ID: AddMessageReactionRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReactionType", - SchemaName: "reaction_type", - }, - { - Name: "IsBig", - SchemaName: "is_big", - }, - { - Name: "UpdateRecentReactions", - SchemaName: "update_recent_reactions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddMessageReactionRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addMessageReaction#549855ed as nil") - } - b.PutID(AddMessageReactionRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddMessageReactionRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addMessageReaction#549855ed as nil") - } - b.PutInt53(a.ChatID) - b.PutInt53(a.MessageID) - if a.ReactionType == nil { - return fmt.Errorf("unable to encode addMessageReaction#549855ed: field reaction_type is nil") - } - if err := a.ReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode addMessageReaction#549855ed: field reaction_type: %w", err) - } - b.PutBool(a.IsBig) - b.PutBool(a.UpdateRecentReactions) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddMessageReactionRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addMessageReaction#549855ed to nil") - } - if err := b.ConsumeID(AddMessageReactionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddMessageReactionRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addMessageReaction#549855ed to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: field chat_id: %w", err) - } - a.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: field message_id: %w", err) - } - a.MessageID = value - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: field reaction_type: %w", err) - } - a.ReactionType = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: field is_big: %w", err) - } - a.IsBig = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: field update_recent_reactions: %w", err) - } - a.UpdateRecentReactions = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddMessageReactionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addMessageReaction#549855ed as nil") - } - b.ObjStart() - b.PutID("addMessageReaction") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(a.MessageID) - b.Comma() - b.FieldStart("reaction_type") - if a.ReactionType == nil { - return fmt.Errorf("unable to encode addMessageReaction#549855ed: field reaction_type is nil") - } - if err := a.ReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addMessageReaction#549855ed: field reaction_type: %w", err) - } - b.Comma() - b.FieldStart("is_big") - b.PutBool(a.IsBig) - b.Comma() - b.FieldStart("update_recent_reactions") - b.PutBool(a.UpdateRecentReactions) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddMessageReactionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addMessageReaction#549855ed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addMessageReaction"); err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: field chat_id: %w", err) - } - a.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: field message_id: %w", err) - } - a.MessageID = value - case "reaction_type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: field reaction_type: %w", err) - } - a.ReactionType = value - case "is_big": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: field is_big: %w", err) - } - a.IsBig = value - case "update_recent_reactions": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addMessageReaction#549855ed: field update_recent_reactions: %w", err) - } - a.UpdateRecentReactions = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (a *AddMessageReactionRequest) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// GetMessageID returns value of MessageID field. -func (a *AddMessageReactionRequest) GetMessageID() (value int64) { - if a == nil { - return - } - return a.MessageID -} - -// GetReactionType returns value of ReactionType field. -func (a *AddMessageReactionRequest) GetReactionType() (value ReactionTypeClass) { - if a == nil { - return - } - return a.ReactionType -} - -// GetIsBig returns value of IsBig field. -func (a *AddMessageReactionRequest) GetIsBig() (value bool) { - if a == nil { - return - } - return a.IsBig -} - -// GetUpdateRecentReactions returns value of UpdateRecentReactions field. -func (a *AddMessageReactionRequest) GetUpdateRecentReactions() (value bool) { - if a == nil { - return - } - return a.UpdateRecentReactions -} - -// AddMessageReaction invokes method addMessageReaction#549855ed returning error if any. -func (c *Client) AddMessageReaction(ctx context.Context, request *AddMessageReactionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_network_statistics_gen.go b/tdapi/tl_add_network_statistics_gen.go deleted file mode 100644 index 6222dfe96..000000000 --- a/tdapi/tl_add_network_statistics_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddNetworkStatisticsRequest represents TL type `addNetworkStatistics#4b63b3d9`. -type AddNetworkStatisticsRequest struct { - // The network statistics entry with the data to be added to statistics - Entry NetworkStatisticsEntryClass -} - -// AddNetworkStatisticsRequestTypeID is TL type id of AddNetworkStatisticsRequest. -const AddNetworkStatisticsRequestTypeID = 0x4b63b3d9 - -// Ensuring interfaces in compile-time for AddNetworkStatisticsRequest. -var ( - _ bin.Encoder = &AddNetworkStatisticsRequest{} - _ bin.Decoder = &AddNetworkStatisticsRequest{} - _ bin.BareEncoder = &AddNetworkStatisticsRequest{} - _ bin.BareDecoder = &AddNetworkStatisticsRequest{} -) - -func (a *AddNetworkStatisticsRequest) Zero() bool { - if a == nil { - return true - } - if !(a.Entry == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddNetworkStatisticsRequest) String() string { - if a == nil { - return "AddNetworkStatisticsRequest(nil)" - } - type Alias AddNetworkStatisticsRequest - return fmt.Sprintf("AddNetworkStatisticsRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddNetworkStatisticsRequest) TypeID() uint32 { - return AddNetworkStatisticsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddNetworkStatisticsRequest) TypeName() string { - return "addNetworkStatistics" -} - -// TypeInfo returns info about TL type. -func (a *AddNetworkStatisticsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addNetworkStatistics", - ID: AddNetworkStatisticsRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Entry", - SchemaName: "entry", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddNetworkStatisticsRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addNetworkStatistics#4b63b3d9 as nil") - } - b.PutID(AddNetworkStatisticsRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddNetworkStatisticsRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addNetworkStatistics#4b63b3d9 as nil") - } - if a.Entry == nil { - return fmt.Errorf("unable to encode addNetworkStatistics#4b63b3d9: field entry is nil") - } - if err := a.Entry.Encode(b); err != nil { - return fmt.Errorf("unable to encode addNetworkStatistics#4b63b3d9: field entry: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddNetworkStatisticsRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addNetworkStatistics#4b63b3d9 to nil") - } - if err := b.ConsumeID(AddNetworkStatisticsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addNetworkStatistics#4b63b3d9: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddNetworkStatisticsRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addNetworkStatistics#4b63b3d9 to nil") - } - { - value, err := DecodeNetworkStatisticsEntry(b) - if err != nil { - return fmt.Errorf("unable to decode addNetworkStatistics#4b63b3d9: field entry: %w", err) - } - a.Entry = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddNetworkStatisticsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addNetworkStatistics#4b63b3d9 as nil") - } - b.ObjStart() - b.PutID("addNetworkStatistics") - b.Comma() - b.FieldStart("entry") - if a.Entry == nil { - return fmt.Errorf("unable to encode addNetworkStatistics#4b63b3d9: field entry is nil") - } - if err := a.Entry.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addNetworkStatistics#4b63b3d9: field entry: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddNetworkStatisticsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addNetworkStatistics#4b63b3d9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addNetworkStatistics"); err != nil { - return fmt.Errorf("unable to decode addNetworkStatistics#4b63b3d9: %w", err) - } - case "entry": - value, err := DecodeTDLibJSONNetworkStatisticsEntry(b) - if err != nil { - return fmt.Errorf("unable to decode addNetworkStatistics#4b63b3d9: field entry: %w", err) - } - a.Entry = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEntry returns value of Entry field. -func (a *AddNetworkStatisticsRequest) GetEntry() (value NetworkStatisticsEntryClass) { - if a == nil { - return - } - return a.Entry -} - -// AddNetworkStatistics invokes method addNetworkStatistics#4b63b3d9 returning error if any. -func (c *Client) AddNetworkStatistics(ctx context.Context, entry NetworkStatisticsEntryClass) error { - var ok Ok - - request := &AddNetworkStatisticsRequest{ - Entry: entry, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_pending_paid_message_reaction_gen.go b/tdapi/tl_add_pending_paid_message_reaction_gen.go deleted file mode 100644 index 901c5f0b6..000000000 --- a/tdapi/tl_add_pending_paid_message_reaction_gen.go +++ /dev/null @@ -1,343 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddPendingPaidMessageReactionRequest represents TL type `addPendingPaidMessageReaction#66548919`. -type AddPendingPaidMessageReactionRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // Number of Telegram Stars to be used for the reaction. The total number of pending paid - // reactions must not exceed getOption("paid_reaction_star_count_max") - StarCount int64 - // Pass true if the user didn't choose anonymity explicitly, for example, the reaction is - // set from the message bubble - UseDefaultIsAnonymous bool - // Pass true to make paid reaction of the user on the message anonymous; pass false to - // make the user's profile visible among top reactors. Ignored if - // use_default_is_anonymous == true - IsAnonymous bool -} - -// AddPendingPaidMessageReactionRequestTypeID is TL type id of AddPendingPaidMessageReactionRequest. -const AddPendingPaidMessageReactionRequestTypeID = 0x66548919 - -// Ensuring interfaces in compile-time for AddPendingPaidMessageReactionRequest. -var ( - _ bin.Encoder = &AddPendingPaidMessageReactionRequest{} - _ bin.Decoder = &AddPendingPaidMessageReactionRequest{} - _ bin.BareEncoder = &AddPendingPaidMessageReactionRequest{} - _ bin.BareDecoder = &AddPendingPaidMessageReactionRequest{} -) - -func (a *AddPendingPaidMessageReactionRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ChatID == 0) { - return false - } - if !(a.MessageID == 0) { - return false - } - if !(a.StarCount == 0) { - return false - } - if !(a.UseDefaultIsAnonymous == false) { - return false - } - if !(a.IsAnonymous == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddPendingPaidMessageReactionRequest) String() string { - if a == nil { - return "AddPendingPaidMessageReactionRequest(nil)" - } - type Alias AddPendingPaidMessageReactionRequest - return fmt.Sprintf("AddPendingPaidMessageReactionRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddPendingPaidMessageReactionRequest) TypeID() uint32 { - return AddPendingPaidMessageReactionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddPendingPaidMessageReactionRequest) TypeName() string { - return "addPendingPaidMessageReaction" -} - -// TypeInfo returns info about TL type. -func (a *AddPendingPaidMessageReactionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addPendingPaidMessageReaction", - ID: AddPendingPaidMessageReactionRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "UseDefaultIsAnonymous", - SchemaName: "use_default_is_anonymous", - }, - { - Name: "IsAnonymous", - SchemaName: "is_anonymous", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddPendingPaidMessageReactionRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addPendingPaidMessageReaction#66548919 as nil") - } - b.PutID(AddPendingPaidMessageReactionRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddPendingPaidMessageReactionRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addPendingPaidMessageReaction#66548919 as nil") - } - b.PutInt53(a.ChatID) - b.PutInt53(a.MessageID) - b.PutInt53(a.StarCount) - b.PutBool(a.UseDefaultIsAnonymous) - b.PutBool(a.IsAnonymous) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddPendingPaidMessageReactionRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addPendingPaidMessageReaction#66548919 to nil") - } - if err := b.ConsumeID(AddPendingPaidMessageReactionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddPendingPaidMessageReactionRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addPendingPaidMessageReaction#66548919 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field chat_id: %w", err) - } - a.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field message_id: %w", err) - } - a.MessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field star_count: %w", err) - } - a.StarCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field use_default_is_anonymous: %w", err) - } - a.UseDefaultIsAnonymous = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field is_anonymous: %w", err) - } - a.IsAnonymous = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddPendingPaidMessageReactionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addPendingPaidMessageReaction#66548919 as nil") - } - b.ObjStart() - b.PutID("addPendingPaidMessageReaction") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(a.MessageID) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(a.StarCount) - b.Comma() - b.FieldStart("use_default_is_anonymous") - b.PutBool(a.UseDefaultIsAnonymous) - b.Comma() - b.FieldStart("is_anonymous") - b.PutBool(a.IsAnonymous) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddPendingPaidMessageReactionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addPendingPaidMessageReaction#66548919 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addPendingPaidMessageReaction"); err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field chat_id: %w", err) - } - a.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field message_id: %w", err) - } - a.MessageID = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field star_count: %w", err) - } - a.StarCount = value - case "use_default_is_anonymous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field use_default_is_anonymous: %w", err) - } - a.UseDefaultIsAnonymous = value - case "is_anonymous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addPendingPaidMessageReaction#66548919: field is_anonymous: %w", err) - } - a.IsAnonymous = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (a *AddPendingPaidMessageReactionRequest) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// GetMessageID returns value of MessageID field. -func (a *AddPendingPaidMessageReactionRequest) GetMessageID() (value int64) { - if a == nil { - return - } - return a.MessageID -} - -// GetStarCount returns value of StarCount field. -func (a *AddPendingPaidMessageReactionRequest) GetStarCount() (value int64) { - if a == nil { - return - } - return a.StarCount -} - -// GetUseDefaultIsAnonymous returns value of UseDefaultIsAnonymous field. -func (a *AddPendingPaidMessageReactionRequest) GetUseDefaultIsAnonymous() (value bool) { - if a == nil { - return - } - return a.UseDefaultIsAnonymous -} - -// GetIsAnonymous returns value of IsAnonymous field. -func (a *AddPendingPaidMessageReactionRequest) GetIsAnonymous() (value bool) { - if a == nil { - return - } - return a.IsAnonymous -} - -// AddPendingPaidMessageReaction invokes method addPendingPaidMessageReaction#66548919 returning error if any. -func (c *Client) AddPendingPaidMessageReaction(ctx context.Context, request *AddPendingPaidMessageReactionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_proxy_gen.go b/tdapi/tl_add_proxy_gen.go deleted file mode 100644 index 5a048fb60..000000000 --- a/tdapi/tl_add_proxy_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddProxyRequest represents TL type `addProxy#13c2bcd8`. -type AddProxyRequest struct { - // Proxy server domain or IP address - Server string - // Proxy server port - Port int32 - // Pass true to immediately enable the proxy - Enable bool - // Proxy type - Type ProxyTypeClass -} - -// AddProxyRequestTypeID is TL type id of AddProxyRequest. -const AddProxyRequestTypeID = 0x13c2bcd8 - -// Ensuring interfaces in compile-time for AddProxyRequest. -var ( - _ bin.Encoder = &AddProxyRequest{} - _ bin.Decoder = &AddProxyRequest{} - _ bin.BareEncoder = &AddProxyRequest{} - _ bin.BareDecoder = &AddProxyRequest{} -) - -func (a *AddProxyRequest) Zero() bool { - if a == nil { - return true - } - if !(a.Server == "") { - return false - } - if !(a.Port == 0) { - return false - } - if !(a.Enable == false) { - return false - } - if !(a.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddProxyRequest) String() string { - if a == nil { - return "AddProxyRequest(nil)" - } - type Alias AddProxyRequest - return fmt.Sprintf("AddProxyRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddProxyRequest) TypeID() uint32 { - return AddProxyRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddProxyRequest) TypeName() string { - return "addProxy" -} - -// TypeInfo returns info about TL type. -func (a *AddProxyRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addProxy", - ID: AddProxyRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Server", - SchemaName: "server", - }, - { - Name: "Port", - SchemaName: "port", - }, - { - Name: "Enable", - SchemaName: "enable", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddProxyRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addProxy#13c2bcd8 as nil") - } - b.PutID(AddProxyRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddProxyRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addProxy#13c2bcd8 as nil") - } - b.PutString(a.Server) - b.PutInt32(a.Port) - b.PutBool(a.Enable) - if a.Type == nil { - return fmt.Errorf("unable to encode addProxy#13c2bcd8: field type is nil") - } - if err := a.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode addProxy#13c2bcd8: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddProxyRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addProxy#13c2bcd8 to nil") - } - if err := b.ConsumeID(AddProxyRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addProxy#13c2bcd8: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddProxyRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addProxy#13c2bcd8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addProxy#13c2bcd8: field server: %w", err) - } - a.Server = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addProxy#13c2bcd8: field port: %w", err) - } - a.Port = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addProxy#13c2bcd8: field enable: %w", err) - } - a.Enable = value - } - { - value, err := DecodeProxyType(b) - if err != nil { - return fmt.Errorf("unable to decode addProxy#13c2bcd8: field type: %w", err) - } - a.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddProxyRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addProxy#13c2bcd8 as nil") - } - b.ObjStart() - b.PutID("addProxy") - b.Comma() - b.FieldStart("server") - b.PutString(a.Server) - b.Comma() - b.FieldStart("port") - b.PutInt32(a.Port) - b.Comma() - b.FieldStart("enable") - b.PutBool(a.Enable) - b.Comma() - b.FieldStart("type") - if a.Type == nil { - return fmt.Errorf("unable to encode addProxy#13c2bcd8: field type is nil") - } - if err := a.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addProxy#13c2bcd8: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddProxyRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addProxy#13c2bcd8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addProxy"); err != nil { - return fmt.Errorf("unable to decode addProxy#13c2bcd8: %w", err) - } - case "server": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addProxy#13c2bcd8: field server: %w", err) - } - a.Server = value - case "port": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addProxy#13c2bcd8: field port: %w", err) - } - a.Port = value - case "enable": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addProxy#13c2bcd8: field enable: %w", err) - } - a.Enable = value - case "type": - value, err := DecodeTDLibJSONProxyType(b) - if err != nil { - return fmt.Errorf("unable to decode addProxy#13c2bcd8: field type: %w", err) - } - a.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetServer returns value of Server field. -func (a *AddProxyRequest) GetServer() (value string) { - if a == nil { - return - } - return a.Server -} - -// GetPort returns value of Port field. -func (a *AddProxyRequest) GetPort() (value int32) { - if a == nil { - return - } - return a.Port -} - -// GetEnable returns value of Enable field. -func (a *AddProxyRequest) GetEnable() (value bool) { - if a == nil { - return - } - return a.Enable -} - -// GetType returns value of Type field. -func (a *AddProxyRequest) GetType() (value ProxyTypeClass) { - if a == nil { - return - } - return a.Type -} - -// AddProxy invokes method addProxy#13c2bcd8 returning error if any. -func (c *Client) AddProxy(ctx context.Context, request *AddProxyRequest) (*Proxy, error) { - var result Proxy - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_add_quick_reply_shortcut_inline_query_result_message_gen.go b/tdapi/tl_add_quick_reply_shortcut_inline_query_result_message_gen.go deleted file mode 100644 index 0035c6060..000000000 --- a/tdapi/tl_add_quick_reply_shortcut_inline_query_result_message_gen.go +++ /dev/null @@ -1,341 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddQuickReplyShortcutInlineQueryResultMessageRequest represents TL type `addQuickReplyShortcutInlineQueryResultMessage#87c02a04`. -type AddQuickReplyShortcutInlineQueryResultMessageRequest struct { - // Name of the target shortcut - ShortcutName string - // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none - ReplyToMessageID int64 - // Identifier of the inline query - QueryID int64 - // Identifier of the inline query result - ResultID string - // Pass true to hide the bot, via which the message is sent. Can be used only for bots - // getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), - // and getOption("venue_search_bot_username") - HideViaBot bool -} - -// AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID is TL type id of AddQuickReplyShortcutInlineQueryResultMessageRequest. -const AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID = 0x87c02a04 - -// Ensuring interfaces in compile-time for AddQuickReplyShortcutInlineQueryResultMessageRequest. -var ( - _ bin.Encoder = &AddQuickReplyShortcutInlineQueryResultMessageRequest{} - _ bin.Decoder = &AddQuickReplyShortcutInlineQueryResultMessageRequest{} - _ bin.BareEncoder = &AddQuickReplyShortcutInlineQueryResultMessageRequest{} - _ bin.BareDecoder = &AddQuickReplyShortcutInlineQueryResultMessageRequest{} -) - -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ShortcutName == "") { - return false - } - if !(a.ReplyToMessageID == 0) { - return false - } - if !(a.QueryID == 0) { - return false - } - if !(a.ResultID == "") { - return false - } - if !(a.HideViaBot == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) String() string { - if a == nil { - return "AddQuickReplyShortcutInlineQueryResultMessageRequest(nil)" - } - type Alias AddQuickReplyShortcutInlineQueryResultMessageRequest - return fmt.Sprintf("AddQuickReplyShortcutInlineQueryResultMessageRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddQuickReplyShortcutInlineQueryResultMessageRequest) TypeID() uint32 { - return AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddQuickReplyShortcutInlineQueryResultMessageRequest) TypeName() string { - return "addQuickReplyShortcutInlineQueryResultMessage" -} - -// TypeInfo returns info about TL type. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addQuickReplyShortcutInlineQueryResultMessage", - ID: AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutName", - SchemaName: "shortcut_name", - }, - { - Name: "ReplyToMessageID", - SchemaName: "reply_to_message_id", - }, - { - Name: "QueryID", - SchemaName: "query_id", - }, - { - Name: "ResultID", - SchemaName: "result_id", - }, - { - Name: "HideViaBot", - SchemaName: "hide_via_bot", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addQuickReplyShortcutInlineQueryResultMessage#87c02a04 as nil") - } - b.PutID(AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addQuickReplyShortcutInlineQueryResultMessage#87c02a04 as nil") - } - b.PutString(a.ShortcutName) - b.PutInt53(a.ReplyToMessageID) - b.PutLong(a.QueryID) - b.PutString(a.ResultID) - b.PutBool(a.HideViaBot) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04 to nil") - } - if err := b.ConsumeID(AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: field shortcut_name: %w", err) - } - a.ShortcutName = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: field reply_to_message_id: %w", err) - } - a.ReplyToMessageID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: field query_id: %w", err) - } - a.QueryID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: field result_id: %w", err) - } - a.ResultID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: field hide_via_bot: %w", err) - } - a.HideViaBot = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addQuickReplyShortcutInlineQueryResultMessage#87c02a04 as nil") - } - b.ObjStart() - b.PutID("addQuickReplyShortcutInlineQueryResultMessage") - b.Comma() - b.FieldStart("shortcut_name") - b.PutString(a.ShortcutName) - b.Comma() - b.FieldStart("reply_to_message_id") - b.PutInt53(a.ReplyToMessageID) - b.Comma() - b.FieldStart("query_id") - b.PutLong(a.QueryID) - b.Comma() - b.FieldStart("result_id") - b.PutString(a.ResultID) - b.Comma() - b.FieldStart("hide_via_bot") - b.PutBool(a.HideViaBot) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addQuickReplyShortcutInlineQueryResultMessage"); err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: %w", err) - } - case "shortcut_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: field shortcut_name: %w", err) - } - a.ShortcutName = value - case "reply_to_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: field reply_to_message_id: %w", err) - } - a.ReplyToMessageID = value - case "query_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: field query_id: %w", err) - } - a.QueryID = value - case "result_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: field result_id: %w", err) - } - a.ResultID = value - case "hide_via_bot": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutInlineQueryResultMessage#87c02a04: field hide_via_bot: %w", err) - } - a.HideViaBot = value - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutName returns value of ShortcutName field. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) GetShortcutName() (value string) { - if a == nil { - return - } - return a.ShortcutName -} - -// GetReplyToMessageID returns value of ReplyToMessageID field. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) GetReplyToMessageID() (value int64) { - if a == nil { - return - } - return a.ReplyToMessageID -} - -// GetQueryID returns value of QueryID field. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) GetQueryID() (value int64) { - if a == nil { - return - } - return a.QueryID -} - -// GetResultID returns value of ResultID field. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) GetResultID() (value string) { - if a == nil { - return - } - return a.ResultID -} - -// GetHideViaBot returns value of HideViaBot field. -func (a *AddQuickReplyShortcutInlineQueryResultMessageRequest) GetHideViaBot() (value bool) { - if a == nil { - return - } - return a.HideViaBot -} - -// AddQuickReplyShortcutInlineQueryResultMessage invokes method addQuickReplyShortcutInlineQueryResultMessage#87c02a04 returning error if any. -func (c *Client) AddQuickReplyShortcutInlineQueryResultMessage(ctx context.Context, request *AddQuickReplyShortcutInlineQueryResultMessageRequest) (*QuickReplyMessage, error) { - var result QuickReplyMessage - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_add_quick_reply_shortcut_message_album_gen.go b/tdapi/tl_add_quick_reply_shortcut_message_album_gen.go deleted file mode 100644 index d514c5958..000000000 --- a/tdapi/tl_add_quick_reply_shortcut_message_album_gen.go +++ /dev/null @@ -1,306 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddQuickReplyShortcutMessageAlbumRequest represents TL type `addQuickReplyShortcutMessageAlbum#9647a3fd`. -type AddQuickReplyShortcutMessageAlbumRequest struct { - // Name of the target shortcut - ShortcutName string - // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none - ReplyToMessageID int64 - // Contents of messages to be sent. At most 10 messages can be added to an album. All - // messages must have the same value of show_caption_above_media - InputMessageContents []InputMessageContentClass -} - -// AddQuickReplyShortcutMessageAlbumRequestTypeID is TL type id of AddQuickReplyShortcutMessageAlbumRequest. -const AddQuickReplyShortcutMessageAlbumRequestTypeID = 0x9647a3fd - -// Ensuring interfaces in compile-time for AddQuickReplyShortcutMessageAlbumRequest. -var ( - _ bin.Encoder = &AddQuickReplyShortcutMessageAlbumRequest{} - _ bin.Decoder = &AddQuickReplyShortcutMessageAlbumRequest{} - _ bin.BareEncoder = &AddQuickReplyShortcutMessageAlbumRequest{} - _ bin.BareDecoder = &AddQuickReplyShortcutMessageAlbumRequest{} -) - -func (a *AddQuickReplyShortcutMessageAlbumRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ShortcutName == "") { - return false - } - if !(a.ReplyToMessageID == 0) { - return false - } - if !(a.InputMessageContents == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddQuickReplyShortcutMessageAlbumRequest) String() string { - if a == nil { - return "AddQuickReplyShortcutMessageAlbumRequest(nil)" - } - type Alias AddQuickReplyShortcutMessageAlbumRequest - return fmt.Sprintf("AddQuickReplyShortcutMessageAlbumRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddQuickReplyShortcutMessageAlbumRequest) TypeID() uint32 { - return AddQuickReplyShortcutMessageAlbumRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddQuickReplyShortcutMessageAlbumRequest) TypeName() string { - return "addQuickReplyShortcutMessageAlbum" -} - -// TypeInfo returns info about TL type. -func (a *AddQuickReplyShortcutMessageAlbumRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addQuickReplyShortcutMessageAlbum", - ID: AddQuickReplyShortcutMessageAlbumRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutName", - SchemaName: "shortcut_name", - }, - { - Name: "ReplyToMessageID", - SchemaName: "reply_to_message_id", - }, - { - Name: "InputMessageContents", - SchemaName: "input_message_contents", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddQuickReplyShortcutMessageAlbumRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addQuickReplyShortcutMessageAlbum#9647a3fd as nil") - } - b.PutID(AddQuickReplyShortcutMessageAlbumRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddQuickReplyShortcutMessageAlbumRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addQuickReplyShortcutMessageAlbum#9647a3fd as nil") - } - b.PutString(a.ShortcutName) - b.PutInt53(a.ReplyToMessageID) - b.PutInt(len(a.InputMessageContents)) - for idx, v := range a.InputMessageContents { - if v == nil { - return fmt.Errorf("unable to encode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddQuickReplyShortcutMessageAlbumRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addQuickReplyShortcutMessageAlbum#9647a3fd to nil") - } - if err := b.ConsumeID(AddQuickReplyShortcutMessageAlbumRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddQuickReplyShortcutMessageAlbumRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addQuickReplyShortcutMessageAlbum#9647a3fd to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field shortcut_name: %w", err) - } - a.ShortcutName = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field reply_to_message_id: %w", err) - } - a.ReplyToMessageID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents: %w", err) - } - - if headerLen > 0 { - a.InputMessageContents = make([]InputMessageContentClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents: %w", err) - } - a.InputMessageContents = append(a.InputMessageContents, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddQuickReplyShortcutMessageAlbumRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addQuickReplyShortcutMessageAlbum#9647a3fd as nil") - } - b.ObjStart() - b.PutID("addQuickReplyShortcutMessageAlbum") - b.Comma() - b.FieldStart("shortcut_name") - b.PutString(a.ShortcutName) - b.Comma() - b.FieldStart("reply_to_message_id") - b.PutInt53(a.ReplyToMessageID) - b.Comma() - b.FieldStart("input_message_contents") - b.ArrStart() - for idx, v := range a.InputMessageContents { - if v == nil { - return fmt.Errorf("unable to encode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddQuickReplyShortcutMessageAlbumRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addQuickReplyShortcutMessageAlbum#9647a3fd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addQuickReplyShortcutMessageAlbum"); err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: %w", err) - } - case "shortcut_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field shortcut_name: %w", err) - } - a.ShortcutName = value - case "reply_to_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field reply_to_message_id: %w", err) - } - a.ReplyToMessageID = value - case "input_message_contents": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents: %w", err) - } - a.InputMessageContents = append(a.InputMessageContents, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessageAlbum#9647a3fd: field input_message_contents: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutName returns value of ShortcutName field. -func (a *AddQuickReplyShortcutMessageAlbumRequest) GetShortcutName() (value string) { - if a == nil { - return - } - return a.ShortcutName -} - -// GetReplyToMessageID returns value of ReplyToMessageID field. -func (a *AddQuickReplyShortcutMessageAlbumRequest) GetReplyToMessageID() (value int64) { - if a == nil { - return - } - return a.ReplyToMessageID -} - -// GetInputMessageContents returns value of InputMessageContents field. -func (a *AddQuickReplyShortcutMessageAlbumRequest) GetInputMessageContents() (value []InputMessageContentClass) { - if a == nil { - return - } - return a.InputMessageContents -} - -// AddQuickReplyShortcutMessageAlbum invokes method addQuickReplyShortcutMessageAlbum#9647a3fd returning error if any. -func (c *Client) AddQuickReplyShortcutMessageAlbum(ctx context.Context, request *AddQuickReplyShortcutMessageAlbumRequest) (*QuickReplyMessages, error) { - var result QuickReplyMessages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_add_quick_reply_shortcut_message_gen.go b/tdapi/tl_add_quick_reply_shortcut_message_gen.go deleted file mode 100644 index 53f67edab..000000000 --- a/tdapi/tl_add_quick_reply_shortcut_message_gen.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddQuickReplyShortcutMessageRequest represents TL type `addQuickReplyShortcutMessage#3f188b2a`. -type AddQuickReplyShortcutMessageRequest struct { - // Name of the target shortcut - ShortcutName string - // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none - ReplyToMessageID int64 - // The content of the message to be added; inputMessagePoll, inputMessageForwarded and - // inputMessageLocation with live_period aren't supported - InputMessageContent InputMessageContentClass -} - -// AddQuickReplyShortcutMessageRequestTypeID is TL type id of AddQuickReplyShortcutMessageRequest. -const AddQuickReplyShortcutMessageRequestTypeID = 0x3f188b2a - -// Ensuring interfaces in compile-time for AddQuickReplyShortcutMessageRequest. -var ( - _ bin.Encoder = &AddQuickReplyShortcutMessageRequest{} - _ bin.Decoder = &AddQuickReplyShortcutMessageRequest{} - _ bin.BareEncoder = &AddQuickReplyShortcutMessageRequest{} - _ bin.BareDecoder = &AddQuickReplyShortcutMessageRequest{} -) - -func (a *AddQuickReplyShortcutMessageRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ShortcutName == "") { - return false - } - if !(a.ReplyToMessageID == 0) { - return false - } - if !(a.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddQuickReplyShortcutMessageRequest) String() string { - if a == nil { - return "AddQuickReplyShortcutMessageRequest(nil)" - } - type Alias AddQuickReplyShortcutMessageRequest - return fmt.Sprintf("AddQuickReplyShortcutMessageRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddQuickReplyShortcutMessageRequest) TypeID() uint32 { - return AddQuickReplyShortcutMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddQuickReplyShortcutMessageRequest) TypeName() string { - return "addQuickReplyShortcutMessage" -} - -// TypeInfo returns info about TL type. -func (a *AddQuickReplyShortcutMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addQuickReplyShortcutMessage", - ID: AddQuickReplyShortcutMessageRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutName", - SchemaName: "shortcut_name", - }, - { - Name: "ReplyToMessageID", - SchemaName: "reply_to_message_id", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddQuickReplyShortcutMessageRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addQuickReplyShortcutMessage#3f188b2a as nil") - } - b.PutID(AddQuickReplyShortcutMessageRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddQuickReplyShortcutMessageRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addQuickReplyShortcutMessage#3f188b2a as nil") - } - b.PutString(a.ShortcutName) - b.PutInt53(a.ReplyToMessageID) - if a.InputMessageContent == nil { - return fmt.Errorf("unable to encode addQuickReplyShortcutMessage#3f188b2a: field input_message_content is nil") - } - if err := a.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode addQuickReplyShortcutMessage#3f188b2a: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddQuickReplyShortcutMessageRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addQuickReplyShortcutMessage#3f188b2a to nil") - } - if err := b.ConsumeID(AddQuickReplyShortcutMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessage#3f188b2a: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddQuickReplyShortcutMessageRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addQuickReplyShortcutMessage#3f188b2a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessage#3f188b2a: field shortcut_name: %w", err) - } - a.ShortcutName = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessage#3f188b2a: field reply_to_message_id: %w", err) - } - a.ReplyToMessageID = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessage#3f188b2a: field input_message_content: %w", err) - } - a.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddQuickReplyShortcutMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addQuickReplyShortcutMessage#3f188b2a as nil") - } - b.ObjStart() - b.PutID("addQuickReplyShortcutMessage") - b.Comma() - b.FieldStart("shortcut_name") - b.PutString(a.ShortcutName) - b.Comma() - b.FieldStart("reply_to_message_id") - b.PutInt53(a.ReplyToMessageID) - b.Comma() - b.FieldStart("input_message_content") - if a.InputMessageContent == nil { - return fmt.Errorf("unable to encode addQuickReplyShortcutMessage#3f188b2a: field input_message_content is nil") - } - if err := a.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addQuickReplyShortcutMessage#3f188b2a: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddQuickReplyShortcutMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addQuickReplyShortcutMessage#3f188b2a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addQuickReplyShortcutMessage"); err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessage#3f188b2a: %w", err) - } - case "shortcut_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessage#3f188b2a: field shortcut_name: %w", err) - } - a.ShortcutName = value - case "reply_to_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessage#3f188b2a: field reply_to_message_id: %w", err) - } - a.ReplyToMessageID = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode addQuickReplyShortcutMessage#3f188b2a: field input_message_content: %w", err) - } - a.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutName returns value of ShortcutName field. -func (a *AddQuickReplyShortcutMessageRequest) GetShortcutName() (value string) { - if a == nil { - return - } - return a.ShortcutName -} - -// GetReplyToMessageID returns value of ReplyToMessageID field. -func (a *AddQuickReplyShortcutMessageRequest) GetReplyToMessageID() (value int64) { - if a == nil { - return - } - return a.ReplyToMessageID -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (a *AddQuickReplyShortcutMessageRequest) GetInputMessageContent() (value InputMessageContentClass) { - if a == nil { - return - } - return a.InputMessageContent -} - -// AddQuickReplyShortcutMessage invokes method addQuickReplyShortcutMessage#3f188b2a returning error if any. -func (c *Client) AddQuickReplyShortcutMessage(ctx context.Context, request *AddQuickReplyShortcutMessageRequest) (*QuickReplyMessage, error) { - var result QuickReplyMessage - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_add_recent_sticker_gen.go b/tdapi/tl_add_recent_sticker_gen.go deleted file mode 100644 index 6a9475356..000000000 --- a/tdapi/tl_add_recent_sticker_gen.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddRecentStickerRequest represents TL type `addRecentSticker#a7e5d89e`. -type AddRecentStickerRequest struct { - // Pass true to add the sticker to the list of stickers recently attached to photo or - // video files; pass false to add the sticker to the list of recently sent stickers - IsAttached bool - // Sticker file to add - Sticker InputFileClass -} - -// AddRecentStickerRequestTypeID is TL type id of AddRecentStickerRequest. -const AddRecentStickerRequestTypeID = 0xa7e5d89e - -// Ensuring interfaces in compile-time for AddRecentStickerRequest. -var ( - _ bin.Encoder = &AddRecentStickerRequest{} - _ bin.Decoder = &AddRecentStickerRequest{} - _ bin.BareEncoder = &AddRecentStickerRequest{} - _ bin.BareDecoder = &AddRecentStickerRequest{} -) - -func (a *AddRecentStickerRequest) Zero() bool { - if a == nil { - return true - } - if !(a.IsAttached == false) { - return false - } - if !(a.Sticker == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddRecentStickerRequest) String() string { - if a == nil { - return "AddRecentStickerRequest(nil)" - } - type Alias AddRecentStickerRequest - return fmt.Sprintf("AddRecentStickerRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddRecentStickerRequest) TypeID() uint32 { - return AddRecentStickerRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddRecentStickerRequest) TypeName() string { - return "addRecentSticker" -} - -// TypeInfo returns info about TL type. -func (a *AddRecentStickerRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addRecentSticker", - ID: AddRecentStickerRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsAttached", - SchemaName: "is_attached", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddRecentStickerRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addRecentSticker#a7e5d89e as nil") - } - b.PutID(AddRecentStickerRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddRecentStickerRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addRecentSticker#a7e5d89e as nil") - } - b.PutBool(a.IsAttached) - if a.Sticker == nil { - return fmt.Errorf("unable to encode addRecentSticker#a7e5d89e: field sticker is nil") - } - if err := a.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode addRecentSticker#a7e5d89e: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddRecentStickerRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addRecentSticker#a7e5d89e to nil") - } - if err := b.ConsumeID(AddRecentStickerRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addRecentSticker#a7e5d89e: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddRecentStickerRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addRecentSticker#a7e5d89e to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addRecentSticker#a7e5d89e: field is_attached: %w", err) - } - a.IsAttached = value - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode addRecentSticker#a7e5d89e: field sticker: %w", err) - } - a.Sticker = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddRecentStickerRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addRecentSticker#a7e5d89e as nil") - } - b.ObjStart() - b.PutID("addRecentSticker") - b.Comma() - b.FieldStart("is_attached") - b.PutBool(a.IsAttached) - b.Comma() - b.FieldStart("sticker") - if a.Sticker == nil { - return fmt.Errorf("unable to encode addRecentSticker#a7e5d89e: field sticker is nil") - } - if err := a.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addRecentSticker#a7e5d89e: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddRecentStickerRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addRecentSticker#a7e5d89e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addRecentSticker"); err != nil { - return fmt.Errorf("unable to decode addRecentSticker#a7e5d89e: %w", err) - } - case "is_attached": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addRecentSticker#a7e5d89e: field is_attached: %w", err) - } - a.IsAttached = value - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode addRecentSticker#a7e5d89e: field sticker: %w", err) - } - a.Sticker = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsAttached returns value of IsAttached field. -func (a *AddRecentStickerRequest) GetIsAttached() (value bool) { - if a == nil { - return - } - return a.IsAttached -} - -// GetSticker returns value of Sticker field. -func (a *AddRecentStickerRequest) GetSticker() (value InputFileClass) { - if a == nil { - return - } - return a.Sticker -} - -// AddRecentSticker invokes method addRecentSticker#a7e5d89e returning error if any. -func (c *Client) AddRecentSticker(ctx context.Context, request *AddRecentStickerRequest) (*Stickers, error) { - var result Stickers - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_add_recently_found_chat_gen.go b/tdapi/tl_add_recently_found_chat_gen.go deleted file mode 100644 index 503e3aa01..000000000 --- a/tdapi/tl_add_recently_found_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddRecentlyFoundChatRequest represents TL type `addRecentlyFoundChat#97e8198d`. -type AddRecentlyFoundChatRequest struct { - // Identifier of the chat to add - ChatID int64 -} - -// AddRecentlyFoundChatRequestTypeID is TL type id of AddRecentlyFoundChatRequest. -const AddRecentlyFoundChatRequestTypeID = 0x97e8198d - -// Ensuring interfaces in compile-time for AddRecentlyFoundChatRequest. -var ( - _ bin.Encoder = &AddRecentlyFoundChatRequest{} - _ bin.Decoder = &AddRecentlyFoundChatRequest{} - _ bin.BareEncoder = &AddRecentlyFoundChatRequest{} - _ bin.BareDecoder = &AddRecentlyFoundChatRequest{} -) - -func (a *AddRecentlyFoundChatRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddRecentlyFoundChatRequest) String() string { - if a == nil { - return "AddRecentlyFoundChatRequest(nil)" - } - type Alias AddRecentlyFoundChatRequest - return fmt.Sprintf("AddRecentlyFoundChatRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddRecentlyFoundChatRequest) TypeID() uint32 { - return AddRecentlyFoundChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddRecentlyFoundChatRequest) TypeName() string { - return "addRecentlyFoundChat" -} - -// TypeInfo returns info about TL type. -func (a *AddRecentlyFoundChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addRecentlyFoundChat", - ID: AddRecentlyFoundChatRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddRecentlyFoundChatRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addRecentlyFoundChat#97e8198d as nil") - } - b.PutID(AddRecentlyFoundChatRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddRecentlyFoundChatRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addRecentlyFoundChat#97e8198d as nil") - } - b.PutInt53(a.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddRecentlyFoundChatRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addRecentlyFoundChat#97e8198d to nil") - } - if err := b.ConsumeID(AddRecentlyFoundChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addRecentlyFoundChat#97e8198d: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddRecentlyFoundChatRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addRecentlyFoundChat#97e8198d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addRecentlyFoundChat#97e8198d: field chat_id: %w", err) - } - a.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddRecentlyFoundChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addRecentlyFoundChat#97e8198d as nil") - } - b.ObjStart() - b.PutID("addRecentlyFoundChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddRecentlyFoundChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addRecentlyFoundChat#97e8198d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addRecentlyFoundChat"); err != nil { - return fmt.Errorf("unable to decode addRecentlyFoundChat#97e8198d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addRecentlyFoundChat#97e8198d: field chat_id: %w", err) - } - a.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (a *AddRecentlyFoundChatRequest) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// AddRecentlyFoundChat invokes method addRecentlyFoundChat#97e8198d returning error if any. -func (c *Client) AddRecentlyFoundChat(ctx context.Context, chatid int64) error { - var ok Ok - - request := &AddRecentlyFoundChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_saved_animation_gen.go b/tdapi/tl_add_saved_animation_gen.go deleted file mode 100644 index 456d6db42..000000000 --- a/tdapi/tl_add_saved_animation_gen.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddSavedAnimationRequest represents TL type `addSavedAnimation#a44bf860`. -type AddSavedAnimationRequest struct { - // The animation file to be added. Only animations known to the server (i.e., - // successfully sent via a message) can be added to the list - Animation InputFileClass -} - -// AddSavedAnimationRequestTypeID is TL type id of AddSavedAnimationRequest. -const AddSavedAnimationRequestTypeID = 0xa44bf860 - -// Ensuring interfaces in compile-time for AddSavedAnimationRequest. -var ( - _ bin.Encoder = &AddSavedAnimationRequest{} - _ bin.Decoder = &AddSavedAnimationRequest{} - _ bin.BareEncoder = &AddSavedAnimationRequest{} - _ bin.BareDecoder = &AddSavedAnimationRequest{} -) - -func (a *AddSavedAnimationRequest) Zero() bool { - if a == nil { - return true - } - if !(a.Animation == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddSavedAnimationRequest) String() string { - if a == nil { - return "AddSavedAnimationRequest(nil)" - } - type Alias AddSavedAnimationRequest - return fmt.Sprintf("AddSavedAnimationRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddSavedAnimationRequest) TypeID() uint32 { - return AddSavedAnimationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddSavedAnimationRequest) TypeName() string { - return "addSavedAnimation" -} - -// TypeInfo returns info about TL type. -func (a *AddSavedAnimationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addSavedAnimation", - ID: AddSavedAnimationRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Animation", - SchemaName: "animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddSavedAnimationRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addSavedAnimation#a44bf860 as nil") - } - b.PutID(AddSavedAnimationRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddSavedAnimationRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addSavedAnimation#a44bf860 as nil") - } - if a.Animation == nil { - return fmt.Errorf("unable to encode addSavedAnimation#a44bf860: field animation is nil") - } - if err := a.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode addSavedAnimation#a44bf860: field animation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddSavedAnimationRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addSavedAnimation#a44bf860 to nil") - } - if err := b.ConsumeID(AddSavedAnimationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addSavedAnimation#a44bf860: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddSavedAnimationRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addSavedAnimation#a44bf860 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode addSavedAnimation#a44bf860: field animation: %w", err) - } - a.Animation = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddSavedAnimationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addSavedAnimation#a44bf860 as nil") - } - b.ObjStart() - b.PutID("addSavedAnimation") - b.Comma() - b.FieldStart("animation") - if a.Animation == nil { - return fmt.Errorf("unable to encode addSavedAnimation#a44bf860: field animation is nil") - } - if err := a.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addSavedAnimation#a44bf860: field animation: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddSavedAnimationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addSavedAnimation#a44bf860 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addSavedAnimation"); err != nil { - return fmt.Errorf("unable to decode addSavedAnimation#a44bf860: %w", err) - } - case "animation": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode addSavedAnimation#a44bf860: field animation: %w", err) - } - a.Animation = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAnimation returns value of Animation field. -func (a *AddSavedAnimationRequest) GetAnimation() (value InputFileClass) { - if a == nil { - return - } - return a.Animation -} - -// AddSavedAnimation invokes method addSavedAnimation#a44bf860 returning error if any. -func (c *Client) AddSavedAnimation(ctx context.Context, animation InputFileClass) error { - var ok Ok - - request := &AddSavedAnimationRequest{ - Animation: animation, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_add_saved_notification_sound_gen.go b/tdapi/tl_add_saved_notification_sound_gen.go deleted file mode 100644 index 7584082d3..000000000 --- a/tdapi/tl_add_saved_notification_sound_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddSavedNotificationSoundRequest represents TL type `addSavedNotificationSound#3e3984ef`. -type AddSavedNotificationSoundRequest struct { - // Notification sound file to add - Sound InputFileClass -} - -// AddSavedNotificationSoundRequestTypeID is TL type id of AddSavedNotificationSoundRequest. -const AddSavedNotificationSoundRequestTypeID = 0x3e3984ef - -// Ensuring interfaces in compile-time for AddSavedNotificationSoundRequest. -var ( - _ bin.Encoder = &AddSavedNotificationSoundRequest{} - _ bin.Decoder = &AddSavedNotificationSoundRequest{} - _ bin.BareEncoder = &AddSavedNotificationSoundRequest{} - _ bin.BareDecoder = &AddSavedNotificationSoundRequest{} -) - -func (a *AddSavedNotificationSoundRequest) Zero() bool { - if a == nil { - return true - } - if !(a.Sound == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddSavedNotificationSoundRequest) String() string { - if a == nil { - return "AddSavedNotificationSoundRequest(nil)" - } - type Alias AddSavedNotificationSoundRequest - return fmt.Sprintf("AddSavedNotificationSoundRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddSavedNotificationSoundRequest) TypeID() uint32 { - return AddSavedNotificationSoundRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddSavedNotificationSoundRequest) TypeName() string { - return "addSavedNotificationSound" -} - -// TypeInfo returns info about TL type. -func (a *AddSavedNotificationSoundRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addSavedNotificationSound", - ID: AddSavedNotificationSoundRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sound", - SchemaName: "sound", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddSavedNotificationSoundRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addSavedNotificationSound#3e3984ef as nil") - } - b.PutID(AddSavedNotificationSoundRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddSavedNotificationSoundRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addSavedNotificationSound#3e3984ef as nil") - } - if a.Sound == nil { - return fmt.Errorf("unable to encode addSavedNotificationSound#3e3984ef: field sound is nil") - } - if err := a.Sound.Encode(b); err != nil { - return fmt.Errorf("unable to encode addSavedNotificationSound#3e3984ef: field sound: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddSavedNotificationSoundRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addSavedNotificationSound#3e3984ef to nil") - } - if err := b.ConsumeID(AddSavedNotificationSoundRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addSavedNotificationSound#3e3984ef: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddSavedNotificationSoundRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addSavedNotificationSound#3e3984ef to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode addSavedNotificationSound#3e3984ef: field sound: %w", err) - } - a.Sound = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddSavedNotificationSoundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addSavedNotificationSound#3e3984ef as nil") - } - b.ObjStart() - b.PutID("addSavedNotificationSound") - b.Comma() - b.FieldStart("sound") - if a.Sound == nil { - return fmt.Errorf("unable to encode addSavedNotificationSound#3e3984ef: field sound is nil") - } - if err := a.Sound.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addSavedNotificationSound#3e3984ef: field sound: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddSavedNotificationSoundRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addSavedNotificationSound#3e3984ef to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addSavedNotificationSound"); err != nil { - return fmt.Errorf("unable to decode addSavedNotificationSound#3e3984ef: %w", err) - } - case "sound": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode addSavedNotificationSound#3e3984ef: field sound: %w", err) - } - a.Sound = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSound returns value of Sound field. -func (a *AddSavedNotificationSoundRequest) GetSound() (value InputFileClass) { - if a == nil { - return - } - return a.Sound -} - -// AddSavedNotificationSound invokes method addSavedNotificationSound#3e3984ef returning error if any. -func (c *Client) AddSavedNotificationSound(ctx context.Context, sound InputFileClass) (*NotificationSound, error) { - var result NotificationSound - - request := &AddSavedNotificationSoundRequest{ - Sound: sound, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_add_sticker_to_set_gen.go b/tdapi/tl_add_sticker_to_set_gen.go deleted file mode 100644 index 9dada8888..000000000 --- a/tdapi/tl_add_sticker_to_set_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddStickerToSetRequest represents TL type `addStickerToSet#56dc1e3b`. -type AddStickerToSetRequest struct { - // Sticker set owner; ignored for regular users - UserID int64 - // Sticker set name. The sticker set must be owned by the current user, and contain less - // than 200 stickers for custom emoji sticker sets and less than 120 otherwise - Name string - // Sticker to add to the set - Sticker InputSticker -} - -// AddStickerToSetRequestTypeID is TL type id of AddStickerToSetRequest. -const AddStickerToSetRequestTypeID = 0x56dc1e3b - -// Ensuring interfaces in compile-time for AddStickerToSetRequest. -var ( - _ bin.Encoder = &AddStickerToSetRequest{} - _ bin.Decoder = &AddStickerToSetRequest{} - _ bin.BareEncoder = &AddStickerToSetRequest{} - _ bin.BareDecoder = &AddStickerToSetRequest{} -) - -func (a *AddStickerToSetRequest) Zero() bool { - if a == nil { - return true - } - if !(a.UserID == 0) { - return false - } - if !(a.Name == "") { - return false - } - if !(a.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddStickerToSetRequest) String() string { - if a == nil { - return "AddStickerToSetRequest(nil)" - } - type Alias AddStickerToSetRequest - return fmt.Sprintf("AddStickerToSetRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddStickerToSetRequest) TypeID() uint32 { - return AddStickerToSetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddStickerToSetRequest) TypeName() string { - return "addStickerToSet" -} - -// TypeInfo returns info about TL type. -func (a *AddStickerToSetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addStickerToSet", - ID: AddStickerToSetRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddStickerToSetRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addStickerToSet#56dc1e3b as nil") - } - b.PutID(AddStickerToSetRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddStickerToSetRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addStickerToSet#56dc1e3b as nil") - } - b.PutInt53(a.UserID) - b.PutString(a.Name) - if err := a.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode addStickerToSet#56dc1e3b: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AddStickerToSetRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addStickerToSet#56dc1e3b to nil") - } - if err := b.ConsumeID(AddStickerToSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode addStickerToSet#56dc1e3b: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddStickerToSetRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addStickerToSet#56dc1e3b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addStickerToSet#56dc1e3b: field user_id: %w", err) - } - a.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addStickerToSet#56dc1e3b: field name: %w", err) - } - a.Name = value - } - { - if err := a.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode addStickerToSet#56dc1e3b: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddStickerToSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addStickerToSet#56dc1e3b as nil") - } - b.ObjStart() - b.PutID("addStickerToSet") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(a.UserID) - b.Comma() - b.FieldStart("name") - b.PutString(a.Name) - b.Comma() - b.FieldStart("sticker") - if err := a.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addStickerToSet#56dc1e3b: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddStickerToSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addStickerToSet#56dc1e3b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addStickerToSet"); err != nil { - return fmt.Errorf("unable to decode addStickerToSet#56dc1e3b: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode addStickerToSet#56dc1e3b: field user_id: %w", err) - } - a.UserID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addStickerToSet#56dc1e3b: field name: %w", err) - } - a.Name = value - case "sticker": - if err := a.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode addStickerToSet#56dc1e3b: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (a *AddStickerToSetRequest) GetUserID() (value int64) { - if a == nil { - return - } - return a.UserID -} - -// GetName returns value of Name field. -func (a *AddStickerToSetRequest) GetName() (value string) { - if a == nil { - return - } - return a.Name -} - -// GetSticker returns value of Sticker field. -func (a *AddStickerToSetRequest) GetSticker() (value InputSticker) { - if a == nil { - return - } - return a.Sticker -} - -// AddStickerToSet invokes method addStickerToSet#56dc1e3b returning error if any. -func (c *Client) AddStickerToSet(ctx context.Context, request *AddStickerToSetRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_added_reaction_gen.go b/tdapi/tl_added_reaction_gen.go deleted file mode 100644 index 2c5e49a2e..000000000 --- a/tdapi/tl_added_reaction_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddedReaction represents TL type `addedReaction#4b04819d`. -type AddedReaction struct { - // Type of the reaction - Type ReactionTypeClass - // Identifier of the chat member, applied the reaction - SenderID MessageSenderClass - // True, if the reaction was added by the current user - IsOutgoing bool - // Point in time (Unix timestamp) when the reaction was added - Date int32 -} - -// AddedReactionTypeID is TL type id of AddedReaction. -const AddedReactionTypeID = 0x4b04819d - -// Ensuring interfaces in compile-time for AddedReaction. -var ( - _ bin.Encoder = &AddedReaction{} - _ bin.Decoder = &AddedReaction{} - _ bin.BareEncoder = &AddedReaction{} - _ bin.BareDecoder = &AddedReaction{} -) - -func (a *AddedReaction) Zero() bool { - if a == nil { - return true - } - if !(a.Type == nil) { - return false - } - if !(a.SenderID == nil) { - return false - } - if !(a.IsOutgoing == false) { - return false - } - if !(a.Date == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddedReaction) String() string { - if a == nil { - return "AddedReaction(nil)" - } - type Alias AddedReaction - return fmt.Sprintf("AddedReaction%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddedReaction) TypeID() uint32 { - return AddedReactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddedReaction) TypeName() string { - return "addedReaction" -} - -// TypeInfo returns info about TL type. -func (a *AddedReaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addedReaction", - ID: AddedReactionTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "SenderID", - SchemaName: "sender_id", - }, - { - Name: "IsOutgoing", - SchemaName: "is_outgoing", - }, - { - Name: "Date", - SchemaName: "date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddedReaction) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addedReaction#4b04819d as nil") - } - b.PutID(AddedReactionTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddedReaction) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addedReaction#4b04819d as nil") - } - if a.Type == nil { - return fmt.Errorf("unable to encode addedReaction#4b04819d: field type is nil") - } - if err := a.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode addedReaction#4b04819d: field type: %w", err) - } - if a.SenderID == nil { - return fmt.Errorf("unable to encode addedReaction#4b04819d: field sender_id is nil") - } - if err := a.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode addedReaction#4b04819d: field sender_id: %w", err) - } - b.PutBool(a.IsOutgoing) - b.PutInt32(a.Date) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddedReaction) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addedReaction#4b04819d to nil") - } - if err := b.ConsumeID(AddedReactionTypeID); err != nil { - return fmt.Errorf("unable to decode addedReaction#4b04819d: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddedReaction) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addedReaction#4b04819d to nil") - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode addedReaction#4b04819d: field type: %w", err) - } - a.Type = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode addedReaction#4b04819d: field sender_id: %w", err) - } - a.SenderID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addedReaction#4b04819d: field is_outgoing: %w", err) - } - a.IsOutgoing = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addedReaction#4b04819d: field date: %w", err) - } - a.Date = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddedReaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addedReaction#4b04819d as nil") - } - b.ObjStart() - b.PutID("addedReaction") - b.Comma() - b.FieldStart("type") - if a.Type == nil { - return fmt.Errorf("unable to encode addedReaction#4b04819d: field type is nil") - } - if err := a.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addedReaction#4b04819d: field type: %w", err) - } - b.Comma() - b.FieldStart("sender_id") - if a.SenderID == nil { - return fmt.Errorf("unable to encode addedReaction#4b04819d: field sender_id is nil") - } - if err := a.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addedReaction#4b04819d: field sender_id: %w", err) - } - b.Comma() - b.FieldStart("is_outgoing") - b.PutBool(a.IsOutgoing) - b.Comma() - b.FieldStart("date") - b.PutInt32(a.Date) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddedReaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addedReaction#4b04819d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addedReaction"); err != nil { - return fmt.Errorf("unable to decode addedReaction#4b04819d: %w", err) - } - case "type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode addedReaction#4b04819d: field type: %w", err) - } - a.Type = value - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode addedReaction#4b04819d: field sender_id: %w", err) - } - a.SenderID = value - case "is_outgoing": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode addedReaction#4b04819d: field is_outgoing: %w", err) - } - a.IsOutgoing = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addedReaction#4b04819d: field date: %w", err) - } - a.Date = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (a *AddedReaction) GetType() (value ReactionTypeClass) { - if a == nil { - return - } - return a.Type -} - -// GetSenderID returns value of SenderID field. -func (a *AddedReaction) GetSenderID() (value MessageSenderClass) { - if a == nil { - return - } - return a.SenderID -} - -// GetIsOutgoing returns value of IsOutgoing field. -func (a *AddedReaction) GetIsOutgoing() (value bool) { - if a == nil { - return - } - return a.IsOutgoing -} - -// GetDate returns value of Date field. -func (a *AddedReaction) GetDate() (value int32) { - if a == nil { - return - } - return a.Date -} diff --git a/tdapi/tl_added_reactions_gen.go b/tdapi/tl_added_reactions_gen.go deleted file mode 100644 index e0faa8677..000000000 --- a/tdapi/tl_added_reactions_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AddedReactions represents TL type `addedReactions#77bf7590`. -type AddedReactions struct { - // The total number of found reactions - TotalCount int32 - // The list of added reactions - Reactions []AddedReaction - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// AddedReactionsTypeID is TL type id of AddedReactions. -const AddedReactionsTypeID = 0x77bf7590 - -// Ensuring interfaces in compile-time for AddedReactions. -var ( - _ bin.Encoder = &AddedReactions{} - _ bin.Decoder = &AddedReactions{} - _ bin.BareEncoder = &AddedReactions{} - _ bin.BareDecoder = &AddedReactions{} -) - -func (a *AddedReactions) Zero() bool { - if a == nil { - return true - } - if !(a.TotalCount == 0) { - return false - } - if !(a.Reactions == nil) { - return false - } - if !(a.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AddedReactions) String() string { - if a == nil { - return "AddedReactions(nil)" - } - type Alias AddedReactions - return fmt.Sprintf("AddedReactions%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AddedReactions) TypeID() uint32 { - return AddedReactionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*AddedReactions) TypeName() string { - return "addedReactions" -} - -// TypeInfo returns info about TL type. -func (a *AddedReactions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "addedReactions", - ID: AddedReactionsTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Reactions", - SchemaName: "reactions", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AddedReactions) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addedReactions#77bf7590 as nil") - } - b.PutID(AddedReactionsTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AddedReactions) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode addedReactions#77bf7590 as nil") - } - b.PutInt32(a.TotalCount) - b.PutInt(len(a.Reactions)) - for idx, v := range a.Reactions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare addedReactions#77bf7590: field reactions element with index %d: %w", idx, err) - } - } - b.PutString(a.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (a *AddedReactions) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addedReactions#77bf7590 to nil") - } - if err := b.ConsumeID(AddedReactionsTypeID); err != nil { - return fmt.Errorf("unable to decode addedReactions#77bf7590: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AddedReactions) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode addedReactions#77bf7590 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addedReactions#77bf7590: field total_count: %w", err) - } - a.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode addedReactions#77bf7590: field reactions: %w", err) - } - - if headerLen > 0 { - a.Reactions = make([]AddedReaction, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value AddedReaction - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare addedReactions#77bf7590: field reactions: %w", err) - } - a.Reactions = append(a.Reactions, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addedReactions#77bf7590: field next_offset: %w", err) - } - a.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AddedReactions) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode addedReactions#77bf7590 as nil") - } - b.ObjStart() - b.PutID("addedReactions") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(a.TotalCount) - b.Comma() - b.FieldStart("reactions") - b.ArrStart() - for idx, v := range a.Reactions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode addedReactions#77bf7590: field reactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(a.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AddedReactions) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode addedReactions#77bf7590 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("addedReactions"); err != nil { - return fmt.Errorf("unable to decode addedReactions#77bf7590: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode addedReactions#77bf7590: field total_count: %w", err) - } - a.TotalCount = value - case "reactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value AddedReaction - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode addedReactions#77bf7590: field reactions: %w", err) - } - a.Reactions = append(a.Reactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode addedReactions#77bf7590: field reactions: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode addedReactions#77bf7590: field next_offset: %w", err) - } - a.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (a *AddedReactions) GetTotalCount() (value int32) { - if a == nil { - return - } - return a.TotalCount -} - -// GetReactions returns value of Reactions field. -func (a *AddedReactions) GetReactions() (value []AddedReaction) { - if a == nil { - return - } - return a.Reactions -} - -// GetNextOffset returns value of NextOffset field. -func (a *AddedReactions) GetNextOffset() (value string) { - if a == nil { - return - } - return a.NextOffset -} diff --git a/tdapi/tl_address_gen.go b/tdapi/tl_address_gen.go deleted file mode 100644 index 02211304a..000000000 --- a/tdapi/tl_address_gen.go +++ /dev/null @@ -1,363 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Address represents TL type `address#86304f3a`. -type Address struct { - // A two-letter ISO 3166-1 alpha-2 country code - CountryCode string - // State, if applicable - State string - // City - City string - // First line of the address - StreetLine1 string - // Second line of the address - StreetLine2 string - // Address postal code - PostalCode string -} - -// AddressTypeID is TL type id of Address. -const AddressTypeID = 0x86304f3a - -// Ensuring interfaces in compile-time for Address. -var ( - _ bin.Encoder = &Address{} - _ bin.Decoder = &Address{} - _ bin.BareEncoder = &Address{} - _ bin.BareDecoder = &Address{} -) - -func (a *Address) Zero() bool { - if a == nil { - return true - } - if !(a.CountryCode == "") { - return false - } - if !(a.State == "") { - return false - } - if !(a.City == "") { - return false - } - if !(a.StreetLine1 == "") { - return false - } - if !(a.StreetLine2 == "") { - return false - } - if !(a.PostalCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *Address) String() string { - if a == nil { - return "Address(nil)" - } - type Alias Address - return fmt.Sprintf("Address%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Address) TypeID() uint32 { - return AddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*Address) TypeName() string { - return "address" -} - -// TypeInfo returns info about TL type. -func (a *Address) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "address", - ID: AddressTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CountryCode", - SchemaName: "country_code", - }, - { - Name: "State", - SchemaName: "state", - }, - { - Name: "City", - SchemaName: "city", - }, - { - Name: "StreetLine1", - SchemaName: "street_line1", - }, - { - Name: "StreetLine2", - SchemaName: "street_line2", - }, - { - Name: "PostalCode", - SchemaName: "postal_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *Address) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode address#86304f3a as nil") - } - b.PutID(AddressTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *Address) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode address#86304f3a as nil") - } - b.PutString(a.CountryCode) - b.PutString(a.State) - b.PutString(a.City) - b.PutString(a.StreetLine1) - b.PutString(a.StreetLine2) - b.PutString(a.PostalCode) - return nil -} - -// Decode implements bin.Decoder. -func (a *Address) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode address#86304f3a to nil") - } - if err := b.ConsumeID(AddressTypeID); err != nil { - return fmt.Errorf("unable to decode address#86304f3a: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *Address) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode address#86304f3a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field country_code: %w", err) - } - a.CountryCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field state: %w", err) - } - a.State = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field city: %w", err) - } - a.City = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field street_line1: %w", err) - } - a.StreetLine1 = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field street_line2: %w", err) - } - a.StreetLine2 = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field postal_code: %w", err) - } - a.PostalCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *Address) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode address#86304f3a as nil") - } - b.ObjStart() - b.PutID("address") - b.Comma() - b.FieldStart("country_code") - b.PutString(a.CountryCode) - b.Comma() - b.FieldStart("state") - b.PutString(a.State) - b.Comma() - b.FieldStart("city") - b.PutString(a.City) - b.Comma() - b.FieldStart("street_line1") - b.PutString(a.StreetLine1) - b.Comma() - b.FieldStart("street_line2") - b.PutString(a.StreetLine2) - b.Comma() - b.FieldStart("postal_code") - b.PutString(a.PostalCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *Address) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode address#86304f3a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("address"); err != nil { - return fmt.Errorf("unable to decode address#86304f3a: %w", err) - } - case "country_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field country_code: %w", err) - } - a.CountryCode = value - case "state": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field state: %w", err) - } - a.State = value - case "city": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field city: %w", err) - } - a.City = value - case "street_line1": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field street_line1: %w", err) - } - a.StreetLine1 = value - case "street_line2": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field street_line2: %w", err) - } - a.StreetLine2 = value - case "postal_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode address#86304f3a: field postal_code: %w", err) - } - a.PostalCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCountryCode returns value of CountryCode field. -func (a *Address) GetCountryCode() (value string) { - if a == nil { - return - } - return a.CountryCode -} - -// GetState returns value of State field. -func (a *Address) GetState() (value string) { - if a == nil { - return - } - return a.State -} - -// GetCity returns value of City field. -func (a *Address) GetCity() (value string) { - if a == nil { - return - } - return a.City -} - -// GetStreetLine1 returns value of StreetLine1 field. -func (a *Address) GetStreetLine1() (value string) { - if a == nil { - return - } - return a.StreetLine1 -} - -// GetStreetLine2 returns value of StreetLine2 field. -func (a *Address) GetStreetLine2() (value string) { - if a == nil { - return - } - return a.StreetLine2 -} - -// GetPostalCode returns value of PostalCode field. -func (a *Address) GetPostalCode() (value string) { - if a == nil { - return - } - return a.PostalCode -} diff --git a/tdapi/tl_affiliate_info_gen.go b/tdapi/tl_affiliate_info_gen.go deleted file mode 100644 index ceeba40bc..000000000 --- a/tdapi/tl_affiliate_info_gen.go +++ /dev/null @@ -1,263 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AffiliateInfo represents TL type `affiliateInfo#b1c1dcfa`. -type AffiliateInfo struct { - // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars - // received by the program owner - CommissionPerMille int32 - // Identifier of the chat which received the commission - AffiliateChatID int64 - // The amount of Telegram Stars that were received by the affiliate; can be negative for - // refunds - StarAmount StarAmount -} - -// AffiliateInfoTypeID is TL type id of AffiliateInfo. -const AffiliateInfoTypeID = 0xb1c1dcfa - -// Ensuring interfaces in compile-time for AffiliateInfo. -var ( - _ bin.Encoder = &AffiliateInfo{} - _ bin.Decoder = &AffiliateInfo{} - _ bin.BareEncoder = &AffiliateInfo{} - _ bin.BareDecoder = &AffiliateInfo{} -) - -func (a *AffiliateInfo) Zero() bool { - if a == nil { - return true - } - if !(a.CommissionPerMille == 0) { - return false - } - if !(a.AffiliateChatID == 0) { - return false - } - if !(a.StarAmount.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AffiliateInfo) String() string { - if a == nil { - return "AffiliateInfo(nil)" - } - type Alias AffiliateInfo - return fmt.Sprintf("AffiliateInfo%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AffiliateInfo) TypeID() uint32 { - return AffiliateInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*AffiliateInfo) TypeName() string { - return "affiliateInfo" -} - -// TypeInfo returns info about TL type. -func (a *AffiliateInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "affiliateInfo", - ID: AffiliateInfoTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CommissionPerMille", - SchemaName: "commission_per_mille", - }, - { - Name: "AffiliateChatID", - SchemaName: "affiliate_chat_id", - }, - { - Name: "StarAmount", - SchemaName: "star_amount", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AffiliateInfo) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateInfo#b1c1dcfa as nil") - } - b.PutID(AffiliateInfoTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AffiliateInfo) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateInfo#b1c1dcfa as nil") - } - b.PutInt32(a.CommissionPerMille) - b.PutInt53(a.AffiliateChatID) - if err := a.StarAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode affiliateInfo#b1c1dcfa: field star_amount: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AffiliateInfo) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateInfo#b1c1dcfa to nil") - } - if err := b.ConsumeID(AffiliateInfoTypeID); err != nil { - return fmt.Errorf("unable to decode affiliateInfo#b1c1dcfa: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AffiliateInfo) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateInfo#b1c1dcfa to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode affiliateInfo#b1c1dcfa: field commission_per_mille: %w", err) - } - a.CommissionPerMille = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode affiliateInfo#b1c1dcfa: field affiliate_chat_id: %w", err) - } - a.AffiliateChatID = value - } - { - if err := a.StarAmount.Decode(b); err != nil { - return fmt.Errorf("unable to decode affiliateInfo#b1c1dcfa: field star_amount: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AffiliateInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode affiliateInfo#b1c1dcfa as nil") - } - b.ObjStart() - b.PutID("affiliateInfo") - b.Comma() - b.FieldStart("commission_per_mille") - b.PutInt32(a.CommissionPerMille) - b.Comma() - b.FieldStart("affiliate_chat_id") - b.PutInt53(a.AffiliateChatID) - b.Comma() - b.FieldStart("star_amount") - if err := a.StarAmount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode affiliateInfo#b1c1dcfa: field star_amount: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AffiliateInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode affiliateInfo#b1c1dcfa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("affiliateInfo"); err != nil { - return fmt.Errorf("unable to decode affiliateInfo#b1c1dcfa: %w", err) - } - case "commission_per_mille": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode affiliateInfo#b1c1dcfa: field commission_per_mille: %w", err) - } - a.CommissionPerMille = value - case "affiliate_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode affiliateInfo#b1c1dcfa: field affiliate_chat_id: %w", err) - } - a.AffiliateChatID = value - case "star_amount": - if err := a.StarAmount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode affiliateInfo#b1c1dcfa: field star_amount: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCommissionPerMille returns value of CommissionPerMille field. -func (a *AffiliateInfo) GetCommissionPerMille() (value int32) { - if a == nil { - return - } - return a.CommissionPerMille -} - -// GetAffiliateChatID returns value of AffiliateChatID field. -func (a *AffiliateInfo) GetAffiliateChatID() (value int64) { - if a == nil { - return - } - return a.AffiliateChatID -} - -// GetStarAmount returns value of StarAmount field. -func (a *AffiliateInfo) GetStarAmount() (value StarAmount) { - if a == nil { - return - } - return a.StarAmount -} diff --git a/tdapi/tl_affiliate_program_info_gen.go b/tdapi/tl_affiliate_program_info_gen.go deleted file mode 100644 index 4e7a41ff7..000000000 --- a/tdapi/tl_affiliate_program_info_gen.go +++ /dev/null @@ -1,263 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AffiliateProgramInfo represents TL type `affiliateProgramInfo#96fce8b5`. -type AffiliateProgramInfo struct { - // Parameters of the affiliate program - Parameters AffiliateProgramParameters - // Point in time (Unix timestamp) when the affiliate program will be closed; 0 if the - // affiliate program isn't scheduled to be closed. - EndDate int32 - // The amount of daily revenue per user in Telegram Stars of the bot that created the - // affiliate program - DailyRevenuePerUserAmount StarAmount -} - -// AffiliateProgramInfoTypeID is TL type id of AffiliateProgramInfo. -const AffiliateProgramInfoTypeID = 0x96fce8b5 - -// Ensuring interfaces in compile-time for AffiliateProgramInfo. -var ( - _ bin.Encoder = &AffiliateProgramInfo{} - _ bin.Decoder = &AffiliateProgramInfo{} - _ bin.BareEncoder = &AffiliateProgramInfo{} - _ bin.BareDecoder = &AffiliateProgramInfo{} -) - -func (a *AffiliateProgramInfo) Zero() bool { - if a == nil { - return true - } - if !(a.Parameters.Zero()) { - return false - } - if !(a.EndDate == 0) { - return false - } - if !(a.DailyRevenuePerUserAmount.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AffiliateProgramInfo) String() string { - if a == nil { - return "AffiliateProgramInfo(nil)" - } - type Alias AffiliateProgramInfo - return fmt.Sprintf("AffiliateProgramInfo%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AffiliateProgramInfo) TypeID() uint32 { - return AffiliateProgramInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*AffiliateProgramInfo) TypeName() string { - return "affiliateProgramInfo" -} - -// TypeInfo returns info about TL type. -func (a *AffiliateProgramInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "affiliateProgramInfo", - ID: AffiliateProgramInfoTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Parameters", - SchemaName: "parameters", - }, - { - Name: "EndDate", - SchemaName: "end_date", - }, - { - Name: "DailyRevenuePerUserAmount", - SchemaName: "daily_revenue_per_user_amount", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AffiliateProgramInfo) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramInfo#96fce8b5 as nil") - } - b.PutID(AffiliateProgramInfoTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AffiliateProgramInfo) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramInfo#96fce8b5 as nil") - } - if err := a.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode affiliateProgramInfo#96fce8b5: field parameters: %w", err) - } - b.PutInt32(a.EndDate) - if err := a.DailyRevenuePerUserAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode affiliateProgramInfo#96fce8b5: field daily_revenue_per_user_amount: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AffiliateProgramInfo) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramInfo#96fce8b5 to nil") - } - if err := b.ConsumeID(AffiliateProgramInfoTypeID); err != nil { - return fmt.Errorf("unable to decode affiliateProgramInfo#96fce8b5: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AffiliateProgramInfo) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramInfo#96fce8b5 to nil") - } - { - if err := a.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode affiliateProgramInfo#96fce8b5: field parameters: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode affiliateProgramInfo#96fce8b5: field end_date: %w", err) - } - a.EndDate = value - } - { - if err := a.DailyRevenuePerUserAmount.Decode(b); err != nil { - return fmt.Errorf("unable to decode affiliateProgramInfo#96fce8b5: field daily_revenue_per_user_amount: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AffiliateProgramInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramInfo#96fce8b5 as nil") - } - b.ObjStart() - b.PutID("affiliateProgramInfo") - b.Comma() - b.FieldStart("parameters") - if err := a.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode affiliateProgramInfo#96fce8b5: field parameters: %w", err) - } - b.Comma() - b.FieldStart("end_date") - b.PutInt32(a.EndDate) - b.Comma() - b.FieldStart("daily_revenue_per_user_amount") - if err := a.DailyRevenuePerUserAmount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode affiliateProgramInfo#96fce8b5: field daily_revenue_per_user_amount: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AffiliateProgramInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramInfo#96fce8b5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("affiliateProgramInfo"); err != nil { - return fmt.Errorf("unable to decode affiliateProgramInfo#96fce8b5: %w", err) - } - case "parameters": - if err := a.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode affiliateProgramInfo#96fce8b5: field parameters: %w", err) - } - case "end_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode affiliateProgramInfo#96fce8b5: field end_date: %w", err) - } - a.EndDate = value - case "daily_revenue_per_user_amount": - if err := a.DailyRevenuePerUserAmount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode affiliateProgramInfo#96fce8b5: field daily_revenue_per_user_amount: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetParameters returns value of Parameters field. -func (a *AffiliateProgramInfo) GetParameters() (value AffiliateProgramParameters) { - if a == nil { - return - } - return a.Parameters -} - -// GetEndDate returns value of EndDate field. -func (a *AffiliateProgramInfo) GetEndDate() (value int32) { - if a == nil { - return - } - return a.EndDate -} - -// GetDailyRevenuePerUserAmount returns value of DailyRevenuePerUserAmount field. -func (a *AffiliateProgramInfo) GetDailyRevenuePerUserAmount() (value StarAmount) { - if a == nil { - return - } - return a.DailyRevenuePerUserAmount -} diff --git a/tdapi/tl_affiliate_program_parameters_gen.go b/tdapi/tl_affiliate_program_parameters_gen.go deleted file mode 100644 index 485f9b41a..000000000 --- a/tdapi/tl_affiliate_program_parameters_gen.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AffiliateProgramParameters represents TL type `affiliateProgramParameters#61e90c54`. -type AffiliateProgramParameters struct { - // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars - // received by the program owner; - CommissionPerMille int32 - // Number of months the program will be active; 0-36. If 0, then the program is eternal - MonthCount int32 -} - -// AffiliateProgramParametersTypeID is TL type id of AffiliateProgramParameters. -const AffiliateProgramParametersTypeID = 0x61e90c54 - -// Ensuring interfaces in compile-time for AffiliateProgramParameters. -var ( - _ bin.Encoder = &AffiliateProgramParameters{} - _ bin.Decoder = &AffiliateProgramParameters{} - _ bin.BareEncoder = &AffiliateProgramParameters{} - _ bin.BareDecoder = &AffiliateProgramParameters{} -) - -func (a *AffiliateProgramParameters) Zero() bool { - if a == nil { - return true - } - if !(a.CommissionPerMille == 0) { - return false - } - if !(a.MonthCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AffiliateProgramParameters) String() string { - if a == nil { - return "AffiliateProgramParameters(nil)" - } - type Alias AffiliateProgramParameters - return fmt.Sprintf("AffiliateProgramParameters%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AffiliateProgramParameters) TypeID() uint32 { - return AffiliateProgramParametersTypeID -} - -// TypeName returns name of type in TL schema. -func (*AffiliateProgramParameters) TypeName() string { - return "affiliateProgramParameters" -} - -// TypeInfo returns info about TL type. -func (a *AffiliateProgramParameters) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "affiliateProgramParameters", - ID: AffiliateProgramParametersTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CommissionPerMille", - SchemaName: "commission_per_mille", - }, - { - Name: "MonthCount", - SchemaName: "month_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AffiliateProgramParameters) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramParameters#61e90c54 as nil") - } - b.PutID(AffiliateProgramParametersTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AffiliateProgramParameters) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramParameters#61e90c54 as nil") - } - b.PutInt32(a.CommissionPerMille) - b.PutInt32(a.MonthCount) - return nil -} - -// Decode implements bin.Decoder. -func (a *AffiliateProgramParameters) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramParameters#61e90c54 to nil") - } - if err := b.ConsumeID(AffiliateProgramParametersTypeID); err != nil { - return fmt.Errorf("unable to decode affiliateProgramParameters#61e90c54: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AffiliateProgramParameters) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramParameters#61e90c54 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode affiliateProgramParameters#61e90c54: field commission_per_mille: %w", err) - } - a.CommissionPerMille = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode affiliateProgramParameters#61e90c54: field month_count: %w", err) - } - a.MonthCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AffiliateProgramParameters) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramParameters#61e90c54 as nil") - } - b.ObjStart() - b.PutID("affiliateProgramParameters") - b.Comma() - b.FieldStart("commission_per_mille") - b.PutInt32(a.CommissionPerMille) - b.Comma() - b.FieldStart("month_count") - b.PutInt32(a.MonthCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AffiliateProgramParameters) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramParameters#61e90c54 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("affiliateProgramParameters"); err != nil { - return fmt.Errorf("unable to decode affiliateProgramParameters#61e90c54: %w", err) - } - case "commission_per_mille": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode affiliateProgramParameters#61e90c54: field commission_per_mille: %w", err) - } - a.CommissionPerMille = value - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode affiliateProgramParameters#61e90c54: field month_count: %w", err) - } - a.MonthCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCommissionPerMille returns value of CommissionPerMille field. -func (a *AffiliateProgramParameters) GetCommissionPerMille() (value int32) { - if a == nil { - return - } - return a.CommissionPerMille -} - -// GetMonthCount returns value of MonthCount field. -func (a *AffiliateProgramParameters) GetMonthCount() (value int32) { - if a == nil { - return - } - return a.MonthCount -} diff --git a/tdapi/tl_affiliate_program_sort_order_gen.go b/tdapi/tl_affiliate_program_sort_order_gen.go deleted file mode 100644 index 91c60c04d..000000000 --- a/tdapi/tl_affiliate_program_sort_order_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AffiliateProgramSortOrderProfitability represents TL type `affiliateProgramSortOrderProfitability#8afaaf67`. -type AffiliateProgramSortOrderProfitability struct { -} - -// AffiliateProgramSortOrderProfitabilityTypeID is TL type id of AffiliateProgramSortOrderProfitability. -const AffiliateProgramSortOrderProfitabilityTypeID = 0x8afaaf67 - -// construct implements constructor of AffiliateProgramSortOrderClass. -func (a AffiliateProgramSortOrderProfitability) construct() AffiliateProgramSortOrderClass { return &a } - -// Ensuring interfaces in compile-time for AffiliateProgramSortOrderProfitability. -var ( - _ bin.Encoder = &AffiliateProgramSortOrderProfitability{} - _ bin.Decoder = &AffiliateProgramSortOrderProfitability{} - _ bin.BareEncoder = &AffiliateProgramSortOrderProfitability{} - _ bin.BareDecoder = &AffiliateProgramSortOrderProfitability{} - - _ AffiliateProgramSortOrderClass = &AffiliateProgramSortOrderProfitability{} -) - -func (a *AffiliateProgramSortOrderProfitability) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AffiliateProgramSortOrderProfitability) String() string { - if a == nil { - return "AffiliateProgramSortOrderProfitability(nil)" - } - type Alias AffiliateProgramSortOrderProfitability - return fmt.Sprintf("AffiliateProgramSortOrderProfitability%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AffiliateProgramSortOrderProfitability) TypeID() uint32 { - return AffiliateProgramSortOrderProfitabilityTypeID -} - -// TypeName returns name of type in TL schema. -func (*AffiliateProgramSortOrderProfitability) TypeName() string { - return "affiliateProgramSortOrderProfitability" -} - -// TypeInfo returns info about TL type. -func (a *AffiliateProgramSortOrderProfitability) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "affiliateProgramSortOrderProfitability", - ID: AffiliateProgramSortOrderProfitabilityTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AffiliateProgramSortOrderProfitability) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramSortOrderProfitability#8afaaf67 as nil") - } - b.PutID(AffiliateProgramSortOrderProfitabilityTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AffiliateProgramSortOrderProfitability) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramSortOrderProfitability#8afaaf67 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AffiliateProgramSortOrderProfitability) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramSortOrderProfitability#8afaaf67 to nil") - } - if err := b.ConsumeID(AffiliateProgramSortOrderProfitabilityTypeID); err != nil { - return fmt.Errorf("unable to decode affiliateProgramSortOrderProfitability#8afaaf67: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AffiliateProgramSortOrderProfitability) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramSortOrderProfitability#8afaaf67 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AffiliateProgramSortOrderProfitability) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramSortOrderProfitability#8afaaf67 as nil") - } - b.ObjStart() - b.PutID("affiliateProgramSortOrderProfitability") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AffiliateProgramSortOrderProfitability) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramSortOrderProfitability#8afaaf67 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("affiliateProgramSortOrderProfitability"); err != nil { - return fmt.Errorf("unable to decode affiliateProgramSortOrderProfitability#8afaaf67: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AffiliateProgramSortOrderCreationDate represents TL type `affiliateProgramSortOrderCreationDate#a319390d`. -type AffiliateProgramSortOrderCreationDate struct { -} - -// AffiliateProgramSortOrderCreationDateTypeID is TL type id of AffiliateProgramSortOrderCreationDate. -const AffiliateProgramSortOrderCreationDateTypeID = 0xa319390d - -// construct implements constructor of AffiliateProgramSortOrderClass. -func (a AffiliateProgramSortOrderCreationDate) construct() AffiliateProgramSortOrderClass { return &a } - -// Ensuring interfaces in compile-time for AffiliateProgramSortOrderCreationDate. -var ( - _ bin.Encoder = &AffiliateProgramSortOrderCreationDate{} - _ bin.Decoder = &AffiliateProgramSortOrderCreationDate{} - _ bin.BareEncoder = &AffiliateProgramSortOrderCreationDate{} - _ bin.BareDecoder = &AffiliateProgramSortOrderCreationDate{} - - _ AffiliateProgramSortOrderClass = &AffiliateProgramSortOrderCreationDate{} -) - -func (a *AffiliateProgramSortOrderCreationDate) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AffiliateProgramSortOrderCreationDate) String() string { - if a == nil { - return "AffiliateProgramSortOrderCreationDate(nil)" - } - type Alias AffiliateProgramSortOrderCreationDate - return fmt.Sprintf("AffiliateProgramSortOrderCreationDate%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AffiliateProgramSortOrderCreationDate) TypeID() uint32 { - return AffiliateProgramSortOrderCreationDateTypeID -} - -// TypeName returns name of type in TL schema. -func (*AffiliateProgramSortOrderCreationDate) TypeName() string { - return "affiliateProgramSortOrderCreationDate" -} - -// TypeInfo returns info about TL type. -func (a *AffiliateProgramSortOrderCreationDate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "affiliateProgramSortOrderCreationDate", - ID: AffiliateProgramSortOrderCreationDateTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AffiliateProgramSortOrderCreationDate) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramSortOrderCreationDate#a319390d as nil") - } - b.PutID(AffiliateProgramSortOrderCreationDateTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AffiliateProgramSortOrderCreationDate) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramSortOrderCreationDate#a319390d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AffiliateProgramSortOrderCreationDate) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramSortOrderCreationDate#a319390d to nil") - } - if err := b.ConsumeID(AffiliateProgramSortOrderCreationDateTypeID); err != nil { - return fmt.Errorf("unable to decode affiliateProgramSortOrderCreationDate#a319390d: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AffiliateProgramSortOrderCreationDate) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramSortOrderCreationDate#a319390d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AffiliateProgramSortOrderCreationDate) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramSortOrderCreationDate#a319390d as nil") - } - b.ObjStart() - b.PutID("affiliateProgramSortOrderCreationDate") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AffiliateProgramSortOrderCreationDate) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramSortOrderCreationDate#a319390d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("affiliateProgramSortOrderCreationDate"); err != nil { - return fmt.Errorf("unable to decode affiliateProgramSortOrderCreationDate#a319390d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AffiliateProgramSortOrderRevenue represents TL type `affiliateProgramSortOrderRevenue#72a2c2b8`. -type AffiliateProgramSortOrderRevenue struct { -} - -// AffiliateProgramSortOrderRevenueTypeID is TL type id of AffiliateProgramSortOrderRevenue. -const AffiliateProgramSortOrderRevenueTypeID = 0x72a2c2b8 - -// construct implements constructor of AffiliateProgramSortOrderClass. -func (a AffiliateProgramSortOrderRevenue) construct() AffiliateProgramSortOrderClass { return &a } - -// Ensuring interfaces in compile-time for AffiliateProgramSortOrderRevenue. -var ( - _ bin.Encoder = &AffiliateProgramSortOrderRevenue{} - _ bin.Decoder = &AffiliateProgramSortOrderRevenue{} - _ bin.BareEncoder = &AffiliateProgramSortOrderRevenue{} - _ bin.BareDecoder = &AffiliateProgramSortOrderRevenue{} - - _ AffiliateProgramSortOrderClass = &AffiliateProgramSortOrderRevenue{} -) - -func (a *AffiliateProgramSortOrderRevenue) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AffiliateProgramSortOrderRevenue) String() string { - if a == nil { - return "AffiliateProgramSortOrderRevenue(nil)" - } - type Alias AffiliateProgramSortOrderRevenue - return fmt.Sprintf("AffiliateProgramSortOrderRevenue%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AffiliateProgramSortOrderRevenue) TypeID() uint32 { - return AffiliateProgramSortOrderRevenueTypeID -} - -// TypeName returns name of type in TL schema. -func (*AffiliateProgramSortOrderRevenue) TypeName() string { - return "affiliateProgramSortOrderRevenue" -} - -// TypeInfo returns info about TL type. -func (a *AffiliateProgramSortOrderRevenue) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "affiliateProgramSortOrderRevenue", - ID: AffiliateProgramSortOrderRevenueTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AffiliateProgramSortOrderRevenue) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramSortOrderRevenue#72a2c2b8 as nil") - } - b.PutID(AffiliateProgramSortOrderRevenueTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AffiliateProgramSortOrderRevenue) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramSortOrderRevenue#72a2c2b8 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AffiliateProgramSortOrderRevenue) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramSortOrderRevenue#72a2c2b8 to nil") - } - if err := b.ConsumeID(AffiliateProgramSortOrderRevenueTypeID); err != nil { - return fmt.Errorf("unable to decode affiliateProgramSortOrderRevenue#72a2c2b8: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AffiliateProgramSortOrderRevenue) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramSortOrderRevenue#72a2c2b8 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AffiliateProgramSortOrderRevenue) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode affiliateProgramSortOrderRevenue#72a2c2b8 as nil") - } - b.ObjStart() - b.PutID("affiliateProgramSortOrderRevenue") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AffiliateProgramSortOrderRevenue) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode affiliateProgramSortOrderRevenue#72a2c2b8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("affiliateProgramSortOrderRevenue"); err != nil { - return fmt.Errorf("unable to decode affiliateProgramSortOrderRevenue#72a2c2b8: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AffiliateProgramSortOrderClassName is schema name of AffiliateProgramSortOrderClass. -const AffiliateProgramSortOrderClassName = "AffiliateProgramSortOrder" - -// AffiliateProgramSortOrderClass represents AffiliateProgramSortOrder generic type. -// -// Example: -// -// g, err := tdapi.DecodeAffiliateProgramSortOrder(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.AffiliateProgramSortOrderProfitability: // affiliateProgramSortOrderProfitability#8afaaf67 -// case *tdapi.AffiliateProgramSortOrderCreationDate: // affiliateProgramSortOrderCreationDate#a319390d -// case *tdapi.AffiliateProgramSortOrderRevenue: // affiliateProgramSortOrderRevenue#72a2c2b8 -// default: panic(v) -// } -type AffiliateProgramSortOrderClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() AffiliateProgramSortOrderClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeAffiliateProgramSortOrder implements binary de-serialization for AffiliateProgramSortOrderClass. -func DecodeAffiliateProgramSortOrder(buf *bin.Buffer) (AffiliateProgramSortOrderClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case AffiliateProgramSortOrderProfitabilityTypeID: - // Decoding affiliateProgramSortOrderProfitability#8afaaf67. - v := AffiliateProgramSortOrderProfitability{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateProgramSortOrderClass: %w", err) - } - return &v, nil - case AffiliateProgramSortOrderCreationDateTypeID: - // Decoding affiliateProgramSortOrderCreationDate#a319390d. - v := AffiliateProgramSortOrderCreationDate{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateProgramSortOrderClass: %w", err) - } - return &v, nil - case AffiliateProgramSortOrderRevenueTypeID: - // Decoding affiliateProgramSortOrderRevenue#72a2c2b8. - v := AffiliateProgramSortOrderRevenue{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateProgramSortOrderClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode AffiliateProgramSortOrderClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONAffiliateProgramSortOrder implements binary de-serialization for AffiliateProgramSortOrderClass. -func DecodeTDLibJSONAffiliateProgramSortOrder(buf tdjson.Decoder) (AffiliateProgramSortOrderClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "affiliateProgramSortOrderProfitability": - // Decoding affiliateProgramSortOrderProfitability#8afaaf67. - v := AffiliateProgramSortOrderProfitability{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateProgramSortOrderClass: %w", err) - } - return &v, nil - case "affiliateProgramSortOrderCreationDate": - // Decoding affiliateProgramSortOrderCreationDate#a319390d. - v := AffiliateProgramSortOrderCreationDate{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateProgramSortOrderClass: %w", err) - } - return &v, nil - case "affiliateProgramSortOrderRevenue": - // Decoding affiliateProgramSortOrderRevenue#72a2c2b8. - v := AffiliateProgramSortOrderRevenue{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateProgramSortOrderClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode AffiliateProgramSortOrderClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// AffiliateProgramSortOrder boxes the AffiliateProgramSortOrderClass providing a helper. -type AffiliateProgramSortOrderBox struct { - AffiliateProgramSortOrder AffiliateProgramSortOrderClass -} - -// Decode implements bin.Decoder for AffiliateProgramSortOrderBox. -func (b *AffiliateProgramSortOrderBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode AffiliateProgramSortOrderBox to nil") - } - v, err := DecodeAffiliateProgramSortOrder(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.AffiliateProgramSortOrder = v - return nil -} - -// Encode implements bin.Encode for AffiliateProgramSortOrderBox. -func (b *AffiliateProgramSortOrderBox) Encode(buf *bin.Buffer) error { - if b == nil || b.AffiliateProgramSortOrder == nil { - return fmt.Errorf("unable to encode AffiliateProgramSortOrderClass as nil") - } - return b.AffiliateProgramSortOrder.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for AffiliateProgramSortOrderBox. -func (b *AffiliateProgramSortOrderBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode AffiliateProgramSortOrderBox to nil") - } - v, err := DecodeTDLibJSONAffiliateProgramSortOrder(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.AffiliateProgramSortOrder = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for AffiliateProgramSortOrderBox. -func (b *AffiliateProgramSortOrderBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.AffiliateProgramSortOrder == nil { - return fmt.Errorf("unable to encode AffiliateProgramSortOrderClass as nil") - } - return b.AffiliateProgramSortOrder.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_affiliate_type_gen.go b/tdapi/tl_affiliate_type_gen.go deleted file mode 100644 index 2af384a56..000000000 --- a/tdapi/tl_affiliate_type_gen.go +++ /dev/null @@ -1,647 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AffiliateTypeCurrentUser represents TL type `affiliateTypeCurrentUser#56a701f5`. -type AffiliateTypeCurrentUser struct { -} - -// AffiliateTypeCurrentUserTypeID is TL type id of AffiliateTypeCurrentUser. -const AffiliateTypeCurrentUserTypeID = 0x56a701f5 - -// construct implements constructor of AffiliateTypeClass. -func (a AffiliateTypeCurrentUser) construct() AffiliateTypeClass { return &a } - -// Ensuring interfaces in compile-time for AffiliateTypeCurrentUser. -var ( - _ bin.Encoder = &AffiliateTypeCurrentUser{} - _ bin.Decoder = &AffiliateTypeCurrentUser{} - _ bin.BareEncoder = &AffiliateTypeCurrentUser{} - _ bin.BareDecoder = &AffiliateTypeCurrentUser{} - - _ AffiliateTypeClass = &AffiliateTypeCurrentUser{} -) - -func (a *AffiliateTypeCurrentUser) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AffiliateTypeCurrentUser) String() string { - if a == nil { - return "AffiliateTypeCurrentUser(nil)" - } - type Alias AffiliateTypeCurrentUser - return fmt.Sprintf("AffiliateTypeCurrentUser%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AffiliateTypeCurrentUser) TypeID() uint32 { - return AffiliateTypeCurrentUserTypeID -} - -// TypeName returns name of type in TL schema. -func (*AffiliateTypeCurrentUser) TypeName() string { - return "affiliateTypeCurrentUser" -} - -// TypeInfo returns info about TL type. -func (a *AffiliateTypeCurrentUser) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "affiliateTypeCurrentUser", - ID: AffiliateTypeCurrentUserTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AffiliateTypeCurrentUser) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateTypeCurrentUser#56a701f5 as nil") - } - b.PutID(AffiliateTypeCurrentUserTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AffiliateTypeCurrentUser) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateTypeCurrentUser#56a701f5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AffiliateTypeCurrentUser) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateTypeCurrentUser#56a701f5 to nil") - } - if err := b.ConsumeID(AffiliateTypeCurrentUserTypeID); err != nil { - return fmt.Errorf("unable to decode affiliateTypeCurrentUser#56a701f5: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AffiliateTypeCurrentUser) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateTypeCurrentUser#56a701f5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AffiliateTypeCurrentUser) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode affiliateTypeCurrentUser#56a701f5 as nil") - } - b.ObjStart() - b.PutID("affiliateTypeCurrentUser") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AffiliateTypeCurrentUser) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode affiliateTypeCurrentUser#56a701f5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("affiliateTypeCurrentUser"); err != nil { - return fmt.Errorf("unable to decode affiliateTypeCurrentUser#56a701f5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AffiliateTypeBot represents TL type `affiliateTypeBot#c273f840`. -type AffiliateTypeBot struct { - // User identifier of the bot - UserID int64 -} - -// AffiliateTypeBotTypeID is TL type id of AffiliateTypeBot. -const AffiliateTypeBotTypeID = 0xc273f840 - -// construct implements constructor of AffiliateTypeClass. -func (a AffiliateTypeBot) construct() AffiliateTypeClass { return &a } - -// Ensuring interfaces in compile-time for AffiliateTypeBot. -var ( - _ bin.Encoder = &AffiliateTypeBot{} - _ bin.Decoder = &AffiliateTypeBot{} - _ bin.BareEncoder = &AffiliateTypeBot{} - _ bin.BareDecoder = &AffiliateTypeBot{} - - _ AffiliateTypeClass = &AffiliateTypeBot{} -) - -func (a *AffiliateTypeBot) Zero() bool { - if a == nil { - return true - } - if !(a.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AffiliateTypeBot) String() string { - if a == nil { - return "AffiliateTypeBot(nil)" - } - type Alias AffiliateTypeBot - return fmt.Sprintf("AffiliateTypeBot%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AffiliateTypeBot) TypeID() uint32 { - return AffiliateTypeBotTypeID -} - -// TypeName returns name of type in TL schema. -func (*AffiliateTypeBot) TypeName() string { - return "affiliateTypeBot" -} - -// TypeInfo returns info about TL type. -func (a *AffiliateTypeBot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "affiliateTypeBot", - ID: AffiliateTypeBotTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AffiliateTypeBot) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateTypeBot#c273f840 as nil") - } - b.PutID(AffiliateTypeBotTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AffiliateTypeBot) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateTypeBot#c273f840 as nil") - } - b.PutInt53(a.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (a *AffiliateTypeBot) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateTypeBot#c273f840 to nil") - } - if err := b.ConsumeID(AffiliateTypeBotTypeID); err != nil { - return fmt.Errorf("unable to decode affiliateTypeBot#c273f840: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AffiliateTypeBot) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateTypeBot#c273f840 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode affiliateTypeBot#c273f840: field user_id: %w", err) - } - a.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AffiliateTypeBot) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode affiliateTypeBot#c273f840 as nil") - } - b.ObjStart() - b.PutID("affiliateTypeBot") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(a.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AffiliateTypeBot) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode affiliateTypeBot#c273f840 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("affiliateTypeBot"); err != nil { - return fmt.Errorf("unable to decode affiliateTypeBot#c273f840: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode affiliateTypeBot#c273f840: field user_id: %w", err) - } - a.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (a *AffiliateTypeBot) GetUserID() (value int64) { - if a == nil { - return - } - return a.UserID -} - -// AffiliateTypeChannel represents TL type `affiliateTypeChannel#d73be869`. -type AffiliateTypeChannel struct { - // Identifier of the channel chat - ChatID int64 -} - -// AffiliateTypeChannelTypeID is TL type id of AffiliateTypeChannel. -const AffiliateTypeChannelTypeID = 0xd73be869 - -// construct implements constructor of AffiliateTypeClass. -func (a AffiliateTypeChannel) construct() AffiliateTypeClass { return &a } - -// Ensuring interfaces in compile-time for AffiliateTypeChannel. -var ( - _ bin.Encoder = &AffiliateTypeChannel{} - _ bin.Decoder = &AffiliateTypeChannel{} - _ bin.BareEncoder = &AffiliateTypeChannel{} - _ bin.BareDecoder = &AffiliateTypeChannel{} - - _ AffiliateTypeClass = &AffiliateTypeChannel{} -) - -func (a *AffiliateTypeChannel) Zero() bool { - if a == nil { - return true - } - if !(a.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AffiliateTypeChannel) String() string { - if a == nil { - return "AffiliateTypeChannel(nil)" - } - type Alias AffiliateTypeChannel - return fmt.Sprintf("AffiliateTypeChannel%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AffiliateTypeChannel) TypeID() uint32 { - return AffiliateTypeChannelTypeID -} - -// TypeName returns name of type in TL schema. -func (*AffiliateTypeChannel) TypeName() string { - return "affiliateTypeChannel" -} - -// TypeInfo returns info about TL type. -func (a *AffiliateTypeChannel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "affiliateTypeChannel", - ID: AffiliateTypeChannelTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AffiliateTypeChannel) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateTypeChannel#d73be869 as nil") - } - b.PutID(AffiliateTypeChannelTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AffiliateTypeChannel) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode affiliateTypeChannel#d73be869 as nil") - } - b.PutInt53(a.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (a *AffiliateTypeChannel) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateTypeChannel#d73be869 to nil") - } - if err := b.ConsumeID(AffiliateTypeChannelTypeID); err != nil { - return fmt.Errorf("unable to decode affiliateTypeChannel#d73be869: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AffiliateTypeChannel) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode affiliateTypeChannel#d73be869 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode affiliateTypeChannel#d73be869: field chat_id: %w", err) - } - a.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AffiliateTypeChannel) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode affiliateTypeChannel#d73be869 as nil") - } - b.ObjStart() - b.PutID("affiliateTypeChannel") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AffiliateTypeChannel) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode affiliateTypeChannel#d73be869 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("affiliateTypeChannel"); err != nil { - return fmt.Errorf("unable to decode affiliateTypeChannel#d73be869: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode affiliateTypeChannel#d73be869: field chat_id: %w", err) - } - a.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (a *AffiliateTypeChannel) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// AffiliateTypeClassName is schema name of AffiliateTypeClass. -const AffiliateTypeClassName = "AffiliateType" - -// AffiliateTypeClass represents AffiliateType generic type. -// -// Example: -// -// g, err := tdapi.DecodeAffiliateType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.AffiliateTypeCurrentUser: // affiliateTypeCurrentUser#56a701f5 -// case *tdapi.AffiliateTypeBot: // affiliateTypeBot#c273f840 -// case *tdapi.AffiliateTypeChannel: // affiliateTypeChannel#d73be869 -// default: panic(v) -// } -type AffiliateTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() AffiliateTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeAffiliateType implements binary de-serialization for AffiliateTypeClass. -func DecodeAffiliateType(buf *bin.Buffer) (AffiliateTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case AffiliateTypeCurrentUserTypeID: - // Decoding affiliateTypeCurrentUser#56a701f5. - v := AffiliateTypeCurrentUser{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) - } - return &v, nil - case AffiliateTypeBotTypeID: - // Decoding affiliateTypeBot#c273f840. - v := AffiliateTypeBot{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) - } - return &v, nil - case AffiliateTypeChannelTypeID: - // Decoding affiliateTypeChannel#d73be869. - v := AffiliateTypeChannel{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONAffiliateType implements binary de-serialization for AffiliateTypeClass. -func DecodeTDLibJSONAffiliateType(buf tdjson.Decoder) (AffiliateTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "affiliateTypeCurrentUser": - // Decoding affiliateTypeCurrentUser#56a701f5. - v := AffiliateTypeCurrentUser{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) - } - return &v, nil - case "affiliateTypeBot": - // Decoding affiliateTypeBot#c273f840. - v := AffiliateTypeBot{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) - } - return &v, nil - case "affiliateTypeChannel": - // Decoding affiliateTypeChannel#d73be869. - v := AffiliateTypeChannel{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode AffiliateTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// AffiliateType boxes the AffiliateTypeClass providing a helper. -type AffiliateTypeBox struct { - AffiliateType AffiliateTypeClass -} - -// Decode implements bin.Decoder for AffiliateTypeBox. -func (b *AffiliateTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode AffiliateTypeBox to nil") - } - v, err := DecodeAffiliateType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.AffiliateType = v - return nil -} - -// Encode implements bin.Encode for AffiliateTypeBox. -func (b *AffiliateTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.AffiliateType == nil { - return fmt.Errorf("unable to encode AffiliateTypeClass as nil") - } - return b.AffiliateType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for AffiliateTypeBox. -func (b *AffiliateTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode AffiliateTypeBox to nil") - } - v, err := DecodeTDLibJSONAffiliateType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.AffiliateType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for AffiliateTypeBox. -func (b *AffiliateTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.AffiliateType == nil { - return fmt.Errorf("unable to encode AffiliateTypeClass as nil") - } - return b.AffiliateType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_allow_bot_to_send_messages_gen.go b/tdapi/tl_allow_bot_to_send_messages_gen.go deleted file mode 100644 index 0b1302a5c..000000000 --- a/tdapi/tl_allow_bot_to_send_messages_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AllowBotToSendMessagesRequest represents TL type `allowBotToSendMessages#69e9c58e`. -type AllowBotToSendMessagesRequest struct { - // Identifier of the target bot - BotUserID int64 -} - -// AllowBotToSendMessagesRequestTypeID is TL type id of AllowBotToSendMessagesRequest. -const AllowBotToSendMessagesRequestTypeID = 0x69e9c58e - -// Ensuring interfaces in compile-time for AllowBotToSendMessagesRequest. -var ( - _ bin.Encoder = &AllowBotToSendMessagesRequest{} - _ bin.Decoder = &AllowBotToSendMessagesRequest{} - _ bin.BareEncoder = &AllowBotToSendMessagesRequest{} - _ bin.BareDecoder = &AllowBotToSendMessagesRequest{} -) - -func (a *AllowBotToSendMessagesRequest) Zero() bool { - if a == nil { - return true - } - if !(a.BotUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AllowBotToSendMessagesRequest) String() string { - if a == nil { - return "AllowBotToSendMessagesRequest(nil)" - } - type Alias AllowBotToSendMessagesRequest - return fmt.Sprintf("AllowBotToSendMessagesRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AllowBotToSendMessagesRequest) TypeID() uint32 { - return AllowBotToSendMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AllowBotToSendMessagesRequest) TypeName() string { - return "allowBotToSendMessages" -} - -// TypeInfo returns info about TL type. -func (a *AllowBotToSendMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "allowBotToSendMessages", - ID: AllowBotToSendMessagesRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AllowBotToSendMessagesRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode allowBotToSendMessages#69e9c58e as nil") - } - b.PutID(AllowBotToSendMessagesRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AllowBotToSendMessagesRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode allowBotToSendMessages#69e9c58e as nil") - } - b.PutInt53(a.BotUserID) - return nil -} - -// Decode implements bin.Decoder. -func (a *AllowBotToSendMessagesRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode allowBotToSendMessages#69e9c58e to nil") - } - if err := b.ConsumeID(AllowBotToSendMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode allowBotToSendMessages#69e9c58e: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AllowBotToSendMessagesRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode allowBotToSendMessages#69e9c58e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode allowBotToSendMessages#69e9c58e: field bot_user_id: %w", err) - } - a.BotUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AllowBotToSendMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode allowBotToSendMessages#69e9c58e as nil") - } - b.ObjStart() - b.PutID("allowBotToSendMessages") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(a.BotUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AllowBotToSendMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode allowBotToSendMessages#69e9c58e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("allowBotToSendMessages"); err != nil { - return fmt.Errorf("unable to decode allowBotToSendMessages#69e9c58e: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode allowBotToSendMessages#69e9c58e: field bot_user_id: %w", err) - } - a.BotUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (a *AllowBotToSendMessagesRequest) GetBotUserID() (value int64) { - if a == nil { - return - } - return a.BotUserID -} - -// AllowBotToSendMessages invokes method allowBotToSendMessages#69e9c58e returning error if any. -func (c *Client) AllowBotToSendMessages(ctx context.Context, botuserid int64) error { - var ok Ok - - request := &AllowBotToSendMessagesRequest{ - BotUserID: botuserid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_alternative_video_gen.go b/tdapi/tl_alternative_video_gen.go deleted file mode 100644 index e79f30def..000000000 --- a/tdapi/tl_alternative_video_gen.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AlternativeVideo represents TL type `alternativeVideo#bfda3bb3`. -type AlternativeVideo struct { - // Video width - Width int32 - // Video height - Height int32 - // Codec used for video file encoding, for example, "h264", "h265", or "av1" - Codec string - // HLS file describing the video - HlsFile File - // File containing the video - Video File -} - -// AlternativeVideoTypeID is TL type id of AlternativeVideo. -const AlternativeVideoTypeID = 0xbfda3bb3 - -// Ensuring interfaces in compile-time for AlternativeVideo. -var ( - _ bin.Encoder = &AlternativeVideo{} - _ bin.Decoder = &AlternativeVideo{} - _ bin.BareEncoder = &AlternativeVideo{} - _ bin.BareDecoder = &AlternativeVideo{} -) - -func (a *AlternativeVideo) Zero() bool { - if a == nil { - return true - } - if !(a.Width == 0) { - return false - } - if !(a.Height == 0) { - return false - } - if !(a.Codec == "") { - return false - } - if !(a.HlsFile.Zero()) { - return false - } - if !(a.Video.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AlternativeVideo) String() string { - if a == nil { - return "AlternativeVideo(nil)" - } - type Alias AlternativeVideo - return fmt.Sprintf("AlternativeVideo%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AlternativeVideo) TypeID() uint32 { - return AlternativeVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*AlternativeVideo) TypeName() string { - return "alternativeVideo" -} - -// TypeInfo returns info about TL type. -func (a *AlternativeVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "alternativeVideo", - ID: AlternativeVideoTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "Codec", - SchemaName: "codec", - }, - { - Name: "HlsFile", - SchemaName: "hls_file", - }, - { - Name: "Video", - SchemaName: "video", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AlternativeVideo) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode alternativeVideo#bfda3bb3 as nil") - } - b.PutID(AlternativeVideoTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AlternativeVideo) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode alternativeVideo#bfda3bb3 as nil") - } - b.PutInt32(a.Width) - b.PutInt32(a.Height) - b.PutString(a.Codec) - if err := a.HlsFile.Encode(b); err != nil { - return fmt.Errorf("unable to encode alternativeVideo#bfda3bb3: field hls_file: %w", err) - } - if err := a.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode alternativeVideo#bfda3bb3: field video: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AlternativeVideo) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode alternativeVideo#bfda3bb3 to nil") - } - if err := b.ConsumeID(AlternativeVideoTypeID); err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AlternativeVideo) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode alternativeVideo#bfda3bb3 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: field width: %w", err) - } - a.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: field height: %w", err) - } - a.Height = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: field codec: %w", err) - } - a.Codec = value - } - { - if err := a.HlsFile.Decode(b); err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: field hls_file: %w", err) - } - } - { - if err := a.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: field video: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AlternativeVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode alternativeVideo#bfda3bb3 as nil") - } - b.ObjStart() - b.PutID("alternativeVideo") - b.Comma() - b.FieldStart("width") - b.PutInt32(a.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(a.Height) - b.Comma() - b.FieldStart("codec") - b.PutString(a.Codec) - b.Comma() - b.FieldStart("hls_file") - if err := a.HlsFile.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode alternativeVideo#bfda3bb3: field hls_file: %w", err) - } - b.Comma() - b.FieldStart("video") - if err := a.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode alternativeVideo#bfda3bb3: field video: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AlternativeVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode alternativeVideo#bfda3bb3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("alternativeVideo"); err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: %w", err) - } - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: field width: %w", err) - } - a.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: field height: %w", err) - } - a.Height = value - case "codec": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: field codec: %w", err) - } - a.Codec = value - case "hls_file": - if err := a.HlsFile.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: field hls_file: %w", err) - } - case "video": - if err := a.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode alternativeVideo#bfda3bb3: field video: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetWidth returns value of Width field. -func (a *AlternativeVideo) GetWidth() (value int32) { - if a == nil { - return - } - return a.Width -} - -// GetHeight returns value of Height field. -func (a *AlternativeVideo) GetHeight() (value int32) { - if a == nil { - return - } - return a.Height -} - -// GetCodec returns value of Codec field. -func (a *AlternativeVideo) GetCodec() (value string) { - if a == nil { - return - } - return a.Codec -} - -// GetHlsFile returns value of HlsFile field. -func (a *AlternativeVideo) GetHlsFile() (value File) { - if a == nil { - return - } - return a.HlsFile -} - -// GetVideo returns value of Video field. -func (a *AlternativeVideo) GetVideo() (value File) { - if a == nil { - return - } - return a.Video -} diff --git a/tdapi/tl_animated_chat_photo_gen.go b/tdapi/tl_animated_chat_photo_gen.go deleted file mode 100644 index 69c55611e..000000000 --- a/tdapi/tl_animated_chat_photo_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AnimatedChatPhoto represents TL type `animatedChatPhoto#b719c2e`. -type AnimatedChatPhoto struct { - // Animation width and height - Length int32 - // Information about the animation file - File File - // Timestamp of the frame, used as a static chat photo - MainFrameTimestamp float64 -} - -// AnimatedChatPhotoTypeID is TL type id of AnimatedChatPhoto. -const AnimatedChatPhotoTypeID = 0xb719c2e - -// Ensuring interfaces in compile-time for AnimatedChatPhoto. -var ( - _ bin.Encoder = &AnimatedChatPhoto{} - _ bin.Decoder = &AnimatedChatPhoto{} - _ bin.BareEncoder = &AnimatedChatPhoto{} - _ bin.BareDecoder = &AnimatedChatPhoto{} -) - -func (a *AnimatedChatPhoto) Zero() bool { - if a == nil { - return true - } - if !(a.Length == 0) { - return false - } - if !(a.File.Zero()) { - return false - } - if !(a.MainFrameTimestamp == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AnimatedChatPhoto) String() string { - if a == nil { - return "AnimatedChatPhoto(nil)" - } - type Alias AnimatedChatPhoto - return fmt.Sprintf("AnimatedChatPhoto%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AnimatedChatPhoto) TypeID() uint32 { - return AnimatedChatPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*AnimatedChatPhoto) TypeName() string { - return "animatedChatPhoto" -} - -// TypeInfo returns info about TL type. -func (a *AnimatedChatPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "animatedChatPhoto", - ID: AnimatedChatPhotoTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Length", - SchemaName: "length", - }, - { - Name: "File", - SchemaName: "file", - }, - { - Name: "MainFrameTimestamp", - SchemaName: "main_frame_timestamp", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AnimatedChatPhoto) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode animatedChatPhoto#b719c2e as nil") - } - b.PutID(AnimatedChatPhotoTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AnimatedChatPhoto) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode animatedChatPhoto#b719c2e as nil") - } - b.PutInt32(a.Length) - if err := a.File.Encode(b); err != nil { - return fmt.Errorf("unable to encode animatedChatPhoto#b719c2e: field file: %w", err) - } - b.PutDouble(a.MainFrameTimestamp) - return nil -} - -// Decode implements bin.Decoder. -func (a *AnimatedChatPhoto) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode animatedChatPhoto#b719c2e to nil") - } - if err := b.ConsumeID(AnimatedChatPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode animatedChatPhoto#b719c2e: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AnimatedChatPhoto) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode animatedChatPhoto#b719c2e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animatedChatPhoto#b719c2e: field length: %w", err) - } - a.Length = value - } - { - if err := a.File.Decode(b); err != nil { - return fmt.Errorf("unable to decode animatedChatPhoto#b719c2e: field file: %w", err) - } - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode animatedChatPhoto#b719c2e: field main_frame_timestamp: %w", err) - } - a.MainFrameTimestamp = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AnimatedChatPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode animatedChatPhoto#b719c2e as nil") - } - b.ObjStart() - b.PutID("animatedChatPhoto") - b.Comma() - b.FieldStart("length") - b.PutInt32(a.Length) - b.Comma() - b.FieldStart("file") - if err := a.File.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode animatedChatPhoto#b719c2e: field file: %w", err) - } - b.Comma() - b.FieldStart("main_frame_timestamp") - b.PutDouble(a.MainFrameTimestamp) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AnimatedChatPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode animatedChatPhoto#b719c2e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("animatedChatPhoto"); err != nil { - return fmt.Errorf("unable to decode animatedChatPhoto#b719c2e: %w", err) - } - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animatedChatPhoto#b719c2e: field length: %w", err) - } - a.Length = value - case "file": - if err := a.File.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode animatedChatPhoto#b719c2e: field file: %w", err) - } - case "main_frame_timestamp": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode animatedChatPhoto#b719c2e: field main_frame_timestamp: %w", err) - } - a.MainFrameTimestamp = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLength returns value of Length field. -func (a *AnimatedChatPhoto) GetLength() (value int32) { - if a == nil { - return - } - return a.Length -} - -// GetFile returns value of File field. -func (a *AnimatedChatPhoto) GetFile() (value File) { - if a == nil { - return - } - return a.File -} - -// GetMainFrameTimestamp returns value of MainFrameTimestamp field. -func (a *AnimatedChatPhoto) GetMainFrameTimestamp() (value float64) { - if a == nil { - return - } - return a.MainFrameTimestamp -} diff --git a/tdapi/tl_animated_emoji_gen.go b/tdapi/tl_animated_emoji_gen.go deleted file mode 100644 index 37e1093b1..000000000 --- a/tdapi/tl_animated_emoji_gen.go +++ /dev/null @@ -1,331 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AnimatedEmoji represents TL type `animatedEmoji#52309ebf`. -type AnimatedEmoji struct { - // Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker - // is a custom emoji, then it can have arbitrary format - Sticker Sticker - // Expected width of the sticker, which can be used if the sticker is null - StickerWidth int32 - // Expected height of the sticker, which can be used if the sticker is null - StickerHeight int32 - // Emoji modifier fitzpatrick type; 0-6; 0 if none - FitzpatrickType int32 - // File containing the sound to be played when the sticker is clicked; may be null. The - // sound is encoded with the Opus codec, and stored inside an OGG container - Sound File -} - -// AnimatedEmojiTypeID is TL type id of AnimatedEmoji. -const AnimatedEmojiTypeID = 0x52309ebf - -// Ensuring interfaces in compile-time for AnimatedEmoji. -var ( - _ bin.Encoder = &AnimatedEmoji{} - _ bin.Decoder = &AnimatedEmoji{} - _ bin.BareEncoder = &AnimatedEmoji{} - _ bin.BareDecoder = &AnimatedEmoji{} -) - -func (a *AnimatedEmoji) Zero() bool { - if a == nil { - return true - } - if !(a.Sticker.Zero()) { - return false - } - if !(a.StickerWidth == 0) { - return false - } - if !(a.StickerHeight == 0) { - return false - } - if !(a.FitzpatrickType == 0) { - return false - } - if !(a.Sound.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AnimatedEmoji) String() string { - if a == nil { - return "AnimatedEmoji(nil)" - } - type Alias AnimatedEmoji - return fmt.Sprintf("AnimatedEmoji%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AnimatedEmoji) TypeID() uint32 { - return AnimatedEmojiTypeID -} - -// TypeName returns name of type in TL schema. -func (*AnimatedEmoji) TypeName() string { - return "animatedEmoji" -} - -// TypeInfo returns info about TL type. -func (a *AnimatedEmoji) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "animatedEmoji", - ID: AnimatedEmojiTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "StickerWidth", - SchemaName: "sticker_width", - }, - { - Name: "StickerHeight", - SchemaName: "sticker_height", - }, - { - Name: "FitzpatrickType", - SchemaName: "fitzpatrick_type", - }, - { - Name: "Sound", - SchemaName: "sound", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AnimatedEmoji) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode animatedEmoji#52309ebf as nil") - } - b.PutID(AnimatedEmojiTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AnimatedEmoji) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode animatedEmoji#52309ebf as nil") - } - if err := a.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode animatedEmoji#52309ebf: field sticker: %w", err) - } - b.PutInt32(a.StickerWidth) - b.PutInt32(a.StickerHeight) - b.PutInt32(a.FitzpatrickType) - if err := a.Sound.Encode(b); err != nil { - return fmt.Errorf("unable to encode animatedEmoji#52309ebf: field sound: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AnimatedEmoji) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode animatedEmoji#52309ebf to nil") - } - if err := b.ConsumeID(AnimatedEmojiTypeID); err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AnimatedEmoji) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode animatedEmoji#52309ebf to nil") - } - { - if err := a.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: field sticker: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: field sticker_width: %w", err) - } - a.StickerWidth = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: field sticker_height: %w", err) - } - a.StickerHeight = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: field fitzpatrick_type: %w", err) - } - a.FitzpatrickType = value - } - { - if err := a.Sound.Decode(b); err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: field sound: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AnimatedEmoji) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode animatedEmoji#52309ebf as nil") - } - b.ObjStart() - b.PutID("animatedEmoji") - b.Comma() - b.FieldStart("sticker") - if err := a.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode animatedEmoji#52309ebf: field sticker: %w", err) - } - b.Comma() - b.FieldStart("sticker_width") - b.PutInt32(a.StickerWidth) - b.Comma() - b.FieldStart("sticker_height") - b.PutInt32(a.StickerHeight) - b.Comma() - b.FieldStart("fitzpatrick_type") - b.PutInt32(a.FitzpatrickType) - b.Comma() - b.FieldStart("sound") - if err := a.Sound.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode animatedEmoji#52309ebf: field sound: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AnimatedEmoji) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode animatedEmoji#52309ebf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("animatedEmoji"); err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: %w", err) - } - case "sticker": - if err := a.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: field sticker: %w", err) - } - case "sticker_width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: field sticker_width: %w", err) - } - a.StickerWidth = value - case "sticker_height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: field sticker_height: %w", err) - } - a.StickerHeight = value - case "fitzpatrick_type": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: field fitzpatrick_type: %w", err) - } - a.FitzpatrickType = value - case "sound": - if err := a.Sound.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode animatedEmoji#52309ebf: field sound: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (a *AnimatedEmoji) GetSticker() (value Sticker) { - if a == nil { - return - } - return a.Sticker -} - -// GetStickerWidth returns value of StickerWidth field. -func (a *AnimatedEmoji) GetStickerWidth() (value int32) { - if a == nil { - return - } - return a.StickerWidth -} - -// GetStickerHeight returns value of StickerHeight field. -func (a *AnimatedEmoji) GetStickerHeight() (value int32) { - if a == nil { - return - } - return a.StickerHeight -} - -// GetFitzpatrickType returns value of FitzpatrickType field. -func (a *AnimatedEmoji) GetFitzpatrickType() (value int32) { - if a == nil { - return - } - return a.FitzpatrickType -} - -// GetSound returns value of Sound field. -func (a *AnimatedEmoji) GetSound() (value File) { - if a == nil { - return - } - return a.Sound -} diff --git a/tdapi/tl_animation_gen.go b/tdapi/tl_animation_gen.go deleted file mode 100644 index 8624cc898..000000000 --- a/tdapi/tl_animation_gen.go +++ /dev/null @@ -1,466 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Animation represents TL type `animation#cc00db3e`. -type Animation struct { - // Duration of the animation, in seconds; as defined by the sender - Duration int32 - // Width of the animation - Width int32 - // Height of the animation - Height int32 - // Original name of the file; as defined by the sender - FileName string - // MIME type of the file, usually "image/gif" or "video/mp4" - MimeType string - // True, if stickers were added to the animation. The list of corresponding sticker set - // can be received using getAttachedStickerSets - HasStickers bool - // Animation minithumbnail; may be null - Minithumbnail Minithumbnail - // Animation thumbnail in JPEG or MPEG4 format; may be null - Thumbnail Thumbnail - // File containing the animation - Animation File -} - -// AnimationTypeID is TL type id of Animation. -const AnimationTypeID = 0xcc00db3e - -// Ensuring interfaces in compile-time for Animation. -var ( - _ bin.Encoder = &Animation{} - _ bin.Decoder = &Animation{} - _ bin.BareEncoder = &Animation{} - _ bin.BareDecoder = &Animation{} -) - -func (a *Animation) Zero() bool { - if a == nil { - return true - } - if !(a.Duration == 0) { - return false - } - if !(a.Width == 0) { - return false - } - if !(a.Height == 0) { - return false - } - if !(a.FileName == "") { - return false - } - if !(a.MimeType == "") { - return false - } - if !(a.HasStickers == false) { - return false - } - if !(a.Minithumbnail.Zero()) { - return false - } - if !(a.Thumbnail.Zero()) { - return false - } - if !(a.Animation.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *Animation) String() string { - if a == nil { - return "Animation(nil)" - } - type Alias Animation - return fmt.Sprintf("Animation%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Animation) TypeID() uint32 { - return AnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*Animation) TypeName() string { - return "animation" -} - -// TypeInfo returns info about TL type. -func (a *Animation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "animation", - ID: AnimationTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "FileName", - SchemaName: "file_name", - }, - { - Name: "MimeType", - SchemaName: "mime_type", - }, - { - Name: "HasStickers", - SchemaName: "has_stickers", - }, - { - Name: "Minithumbnail", - SchemaName: "minithumbnail", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "Animation", - SchemaName: "animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *Animation) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode animation#cc00db3e as nil") - } - b.PutID(AnimationTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *Animation) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode animation#cc00db3e as nil") - } - b.PutInt32(a.Duration) - b.PutInt32(a.Width) - b.PutInt32(a.Height) - b.PutString(a.FileName) - b.PutString(a.MimeType) - b.PutBool(a.HasStickers) - if err := a.Minithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode animation#cc00db3e: field minithumbnail: %w", err) - } - if err := a.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode animation#cc00db3e: field thumbnail: %w", err) - } - if err := a.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode animation#cc00db3e: field animation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *Animation) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode animation#cc00db3e to nil") - } - if err := b.ConsumeID(AnimationTypeID); err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *Animation) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode animation#cc00db3e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field duration: %w", err) - } - a.Duration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field width: %w", err) - } - a.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field height: %w", err) - } - a.Height = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field file_name: %w", err) - } - a.FileName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field mime_type: %w", err) - } - a.MimeType = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field has_stickers: %w", err) - } - a.HasStickers = value - } - { - if err := a.Minithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field minithumbnail: %w", err) - } - } - { - if err := a.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field thumbnail: %w", err) - } - } - { - if err := a.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field animation: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *Animation) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode animation#cc00db3e as nil") - } - b.ObjStart() - b.PutID("animation") - b.Comma() - b.FieldStart("duration") - b.PutInt32(a.Duration) - b.Comma() - b.FieldStart("width") - b.PutInt32(a.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(a.Height) - b.Comma() - b.FieldStart("file_name") - b.PutString(a.FileName) - b.Comma() - b.FieldStart("mime_type") - b.PutString(a.MimeType) - b.Comma() - b.FieldStart("has_stickers") - b.PutBool(a.HasStickers) - b.Comma() - b.FieldStart("minithumbnail") - if err := a.Minithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode animation#cc00db3e: field minithumbnail: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := a.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode animation#cc00db3e: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("animation") - if err := a.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode animation#cc00db3e: field animation: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *Animation) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode animation#cc00db3e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("animation"); err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field duration: %w", err) - } - a.Duration = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field width: %w", err) - } - a.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field height: %w", err) - } - a.Height = value - case "file_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field file_name: %w", err) - } - a.FileName = value - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field mime_type: %w", err) - } - a.MimeType = value - case "has_stickers": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field has_stickers: %w", err) - } - a.HasStickers = value - case "minithumbnail": - if err := a.Minithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field minithumbnail: %w", err) - } - case "thumbnail": - if err := a.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field thumbnail: %w", err) - } - case "animation": - if err := a.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode animation#cc00db3e: field animation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDuration returns value of Duration field. -func (a *Animation) GetDuration() (value int32) { - if a == nil { - return - } - return a.Duration -} - -// GetWidth returns value of Width field. -func (a *Animation) GetWidth() (value int32) { - if a == nil { - return - } - return a.Width -} - -// GetHeight returns value of Height field. -func (a *Animation) GetHeight() (value int32) { - if a == nil { - return - } - return a.Height -} - -// GetFileName returns value of FileName field. -func (a *Animation) GetFileName() (value string) { - if a == nil { - return - } - return a.FileName -} - -// GetMimeType returns value of MimeType field. -func (a *Animation) GetMimeType() (value string) { - if a == nil { - return - } - return a.MimeType -} - -// GetHasStickers returns value of HasStickers field. -func (a *Animation) GetHasStickers() (value bool) { - if a == nil { - return - } - return a.HasStickers -} - -// GetMinithumbnail returns value of Minithumbnail field. -func (a *Animation) GetMinithumbnail() (value Minithumbnail) { - if a == nil { - return - } - return a.Minithumbnail -} - -// GetThumbnail returns value of Thumbnail field. -func (a *Animation) GetThumbnail() (value Thumbnail) { - if a == nil { - return - } - return a.Thumbnail -} - -// GetAnimation returns value of Animation field. -func (a *Animation) GetAnimation() (value File) { - if a == nil { - return - } - return a.Animation -} diff --git a/tdapi/tl_animations_gen.go b/tdapi/tl_animations_gen.go deleted file mode 100644 index 5c51d23ab..000000000 --- a/tdapi/tl_animations_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Animations represents TL type `animations#2ce4157c`. -type Animations struct { - // List of animations - Animations []Animation -} - -// AnimationsTypeID is TL type id of Animations. -const AnimationsTypeID = 0x2ce4157c - -// Ensuring interfaces in compile-time for Animations. -var ( - _ bin.Encoder = &Animations{} - _ bin.Decoder = &Animations{} - _ bin.BareEncoder = &Animations{} - _ bin.BareDecoder = &Animations{} -) - -func (a *Animations) Zero() bool { - if a == nil { - return true - } - if !(a.Animations == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *Animations) String() string { - if a == nil { - return "Animations(nil)" - } - type Alias Animations - return fmt.Sprintf("Animations%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Animations) TypeID() uint32 { - return AnimationsTypeID -} - -// TypeName returns name of type in TL schema. -func (*Animations) TypeName() string { - return "animations" -} - -// TypeInfo returns info about TL type. -func (a *Animations) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "animations", - ID: AnimationsTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Animations", - SchemaName: "animations", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *Animations) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode animations#2ce4157c as nil") - } - b.PutID(AnimationsTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *Animations) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode animations#2ce4157c as nil") - } - b.PutInt(len(a.Animations)) - for idx, v := range a.Animations { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare animations#2ce4157c: field animations element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (a *Animations) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode animations#2ce4157c to nil") - } - if err := b.ConsumeID(AnimationsTypeID); err != nil { - return fmt.Errorf("unable to decode animations#2ce4157c: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *Animations) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode animations#2ce4157c to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode animations#2ce4157c: field animations: %w", err) - } - - if headerLen > 0 { - a.Animations = make([]Animation, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Animation - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare animations#2ce4157c: field animations: %w", err) - } - a.Animations = append(a.Animations, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *Animations) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode animations#2ce4157c as nil") - } - b.ObjStart() - b.PutID("animations") - b.Comma() - b.FieldStart("animations") - b.ArrStart() - for idx, v := range a.Animations { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode animations#2ce4157c: field animations element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *Animations) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode animations#2ce4157c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("animations"); err != nil { - return fmt.Errorf("unable to decode animations#2ce4157c: %w", err) - } - case "animations": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Animation - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode animations#2ce4157c: field animations: %w", err) - } - a.Animations = append(a.Animations, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode animations#2ce4157c: field animations: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAnimations returns value of Animations field. -func (a *Animations) GetAnimations() (value []Animation) { - if a == nil { - return - } - return a.Animations -} diff --git a/tdapi/tl_answer_callback_query_gen.go b/tdapi/tl_answer_callback_query_gen.go deleted file mode 100644 index 026701507..000000000 --- a/tdapi/tl_answer_callback_query_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AnswerCallbackQueryRequest represents TL type `answerCallbackQuery#bb462e76`. -type AnswerCallbackQueryRequest struct { - // Identifier of the callback query - CallbackQueryID int64 - // Text of the answer - Text string - // Pass true to show an alert to the user instead of a toast notification - ShowAlert bool - // URL to be opened - URL string - // Time during which the result of the query can be cached, in seconds - CacheTime int32 -} - -// AnswerCallbackQueryRequestTypeID is TL type id of AnswerCallbackQueryRequest. -const AnswerCallbackQueryRequestTypeID = 0xbb462e76 - -// Ensuring interfaces in compile-time for AnswerCallbackQueryRequest. -var ( - _ bin.Encoder = &AnswerCallbackQueryRequest{} - _ bin.Decoder = &AnswerCallbackQueryRequest{} - _ bin.BareEncoder = &AnswerCallbackQueryRequest{} - _ bin.BareDecoder = &AnswerCallbackQueryRequest{} -) - -func (a *AnswerCallbackQueryRequest) Zero() bool { - if a == nil { - return true - } - if !(a.CallbackQueryID == 0) { - return false - } - if !(a.Text == "") { - return false - } - if !(a.ShowAlert == false) { - return false - } - if !(a.URL == "") { - return false - } - if !(a.CacheTime == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AnswerCallbackQueryRequest) String() string { - if a == nil { - return "AnswerCallbackQueryRequest(nil)" - } - type Alias AnswerCallbackQueryRequest - return fmt.Sprintf("AnswerCallbackQueryRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AnswerCallbackQueryRequest) TypeID() uint32 { - return AnswerCallbackQueryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AnswerCallbackQueryRequest) TypeName() string { - return "answerCallbackQuery" -} - -// TypeInfo returns info about TL type. -func (a *AnswerCallbackQueryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "answerCallbackQuery", - ID: AnswerCallbackQueryRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CallbackQueryID", - SchemaName: "callback_query_id", - }, - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "ShowAlert", - SchemaName: "show_alert", - }, - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "CacheTime", - SchemaName: "cache_time", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AnswerCallbackQueryRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerCallbackQuery#bb462e76 as nil") - } - b.PutID(AnswerCallbackQueryRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AnswerCallbackQueryRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerCallbackQuery#bb462e76 as nil") - } - b.PutLong(a.CallbackQueryID) - b.PutString(a.Text) - b.PutBool(a.ShowAlert) - b.PutString(a.URL) - b.PutInt32(a.CacheTime) - return nil -} - -// Decode implements bin.Decoder. -func (a *AnswerCallbackQueryRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerCallbackQuery#bb462e76 to nil") - } - if err := b.ConsumeID(AnswerCallbackQueryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AnswerCallbackQueryRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerCallbackQuery#bb462e76 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: field callback_query_id: %w", err) - } - a.CallbackQueryID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: field text: %w", err) - } - a.Text = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: field show_alert: %w", err) - } - a.ShowAlert = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: field url: %w", err) - } - a.URL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: field cache_time: %w", err) - } - a.CacheTime = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AnswerCallbackQueryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode answerCallbackQuery#bb462e76 as nil") - } - b.ObjStart() - b.PutID("answerCallbackQuery") - b.Comma() - b.FieldStart("callback_query_id") - b.PutLong(a.CallbackQueryID) - b.Comma() - b.FieldStart("text") - b.PutString(a.Text) - b.Comma() - b.FieldStart("show_alert") - b.PutBool(a.ShowAlert) - b.Comma() - b.FieldStart("url") - b.PutString(a.URL) - b.Comma() - b.FieldStart("cache_time") - b.PutInt32(a.CacheTime) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AnswerCallbackQueryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode answerCallbackQuery#bb462e76 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("answerCallbackQuery"); err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: %w", err) - } - case "callback_query_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: field callback_query_id: %w", err) - } - a.CallbackQueryID = value - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: field text: %w", err) - } - a.Text = value - case "show_alert": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: field show_alert: %w", err) - } - a.ShowAlert = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: field url: %w", err) - } - a.URL = value - case "cache_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode answerCallbackQuery#bb462e76: field cache_time: %w", err) - } - a.CacheTime = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCallbackQueryID returns value of CallbackQueryID field. -func (a *AnswerCallbackQueryRequest) GetCallbackQueryID() (value int64) { - if a == nil { - return - } - return a.CallbackQueryID -} - -// GetText returns value of Text field. -func (a *AnswerCallbackQueryRequest) GetText() (value string) { - if a == nil { - return - } - return a.Text -} - -// GetShowAlert returns value of ShowAlert field. -func (a *AnswerCallbackQueryRequest) GetShowAlert() (value bool) { - if a == nil { - return - } - return a.ShowAlert -} - -// GetURL returns value of URL field. -func (a *AnswerCallbackQueryRequest) GetURL() (value string) { - if a == nil { - return - } - return a.URL -} - -// GetCacheTime returns value of CacheTime field. -func (a *AnswerCallbackQueryRequest) GetCacheTime() (value int32) { - if a == nil { - return - } - return a.CacheTime -} - -// AnswerCallbackQuery invokes method answerCallbackQuery#bb462e76 returning error if any. -func (c *Client) AnswerCallbackQuery(ctx context.Context, request *AnswerCallbackQueryRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_answer_custom_query_gen.go b/tdapi/tl_answer_custom_query_gen.go deleted file mode 100644 index ef4a01b80..000000000 --- a/tdapi/tl_answer_custom_query_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AnswerCustomQueryRequest represents TL type `answerCustomQuery#b2e52d3f`. -type AnswerCustomQueryRequest struct { - // Identifier of a custom query - CustomQueryID int64 - // JSON-serialized answer to the query - Data string -} - -// AnswerCustomQueryRequestTypeID is TL type id of AnswerCustomQueryRequest. -const AnswerCustomQueryRequestTypeID = 0xb2e52d3f - -// Ensuring interfaces in compile-time for AnswerCustomQueryRequest. -var ( - _ bin.Encoder = &AnswerCustomQueryRequest{} - _ bin.Decoder = &AnswerCustomQueryRequest{} - _ bin.BareEncoder = &AnswerCustomQueryRequest{} - _ bin.BareDecoder = &AnswerCustomQueryRequest{} -) - -func (a *AnswerCustomQueryRequest) Zero() bool { - if a == nil { - return true - } - if !(a.CustomQueryID == 0) { - return false - } - if !(a.Data == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AnswerCustomQueryRequest) String() string { - if a == nil { - return "AnswerCustomQueryRequest(nil)" - } - type Alias AnswerCustomQueryRequest - return fmt.Sprintf("AnswerCustomQueryRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AnswerCustomQueryRequest) TypeID() uint32 { - return AnswerCustomQueryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AnswerCustomQueryRequest) TypeName() string { - return "answerCustomQuery" -} - -// TypeInfo returns info about TL type. -func (a *AnswerCustomQueryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "answerCustomQuery", - ID: AnswerCustomQueryRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CustomQueryID", - SchemaName: "custom_query_id", - }, - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AnswerCustomQueryRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerCustomQuery#b2e52d3f as nil") - } - b.PutID(AnswerCustomQueryRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AnswerCustomQueryRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerCustomQuery#b2e52d3f as nil") - } - b.PutLong(a.CustomQueryID) - b.PutString(a.Data) - return nil -} - -// Decode implements bin.Decoder. -func (a *AnswerCustomQueryRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerCustomQuery#b2e52d3f to nil") - } - if err := b.ConsumeID(AnswerCustomQueryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode answerCustomQuery#b2e52d3f: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AnswerCustomQueryRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerCustomQuery#b2e52d3f to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode answerCustomQuery#b2e52d3f: field custom_query_id: %w", err) - } - a.CustomQueryID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerCustomQuery#b2e52d3f: field data: %w", err) - } - a.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AnswerCustomQueryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode answerCustomQuery#b2e52d3f as nil") - } - b.ObjStart() - b.PutID("answerCustomQuery") - b.Comma() - b.FieldStart("custom_query_id") - b.PutLong(a.CustomQueryID) - b.Comma() - b.FieldStart("data") - b.PutString(a.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AnswerCustomQueryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode answerCustomQuery#b2e52d3f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("answerCustomQuery"); err != nil { - return fmt.Errorf("unable to decode answerCustomQuery#b2e52d3f: %w", err) - } - case "custom_query_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode answerCustomQuery#b2e52d3f: field custom_query_id: %w", err) - } - a.CustomQueryID = value - case "data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerCustomQuery#b2e52d3f: field data: %w", err) - } - a.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCustomQueryID returns value of CustomQueryID field. -func (a *AnswerCustomQueryRequest) GetCustomQueryID() (value int64) { - if a == nil { - return - } - return a.CustomQueryID -} - -// GetData returns value of Data field. -func (a *AnswerCustomQueryRequest) GetData() (value string) { - if a == nil { - return - } - return a.Data -} - -// AnswerCustomQuery invokes method answerCustomQuery#b2e52d3f returning error if any. -func (c *Client) AnswerCustomQuery(ctx context.Context, request *AnswerCustomQueryRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_answer_inline_query_gen.go b/tdapi/tl_answer_inline_query_gen.go deleted file mode 100644 index 8eb0201b5..000000000 --- a/tdapi/tl_answer_inline_query_gen.go +++ /dev/null @@ -1,408 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AnswerInlineQueryRequest represents TL type `answerInlineQuery#ac7cc5e6`. -type AnswerInlineQueryRequest struct { - // Identifier of the inline query - InlineQueryID int64 - // Pass true if results may be cached and returned only for the user that sent the query. - // By default, results may be returned to any user who sends the same query - IsPersonal bool - // Button to be shown above inline query results; pass null if none - Button InlineQueryResultsButton - // The results of the query - Results []InputInlineQueryResultClass - // Allowed time to cache the results of the query, in seconds - CacheTime int32 - // Offset for the next inline query; pass an empty string if there are no more results - NextOffset string -} - -// AnswerInlineQueryRequestTypeID is TL type id of AnswerInlineQueryRequest. -const AnswerInlineQueryRequestTypeID = 0xac7cc5e6 - -// Ensuring interfaces in compile-time for AnswerInlineQueryRequest. -var ( - _ bin.Encoder = &AnswerInlineQueryRequest{} - _ bin.Decoder = &AnswerInlineQueryRequest{} - _ bin.BareEncoder = &AnswerInlineQueryRequest{} - _ bin.BareDecoder = &AnswerInlineQueryRequest{} -) - -func (a *AnswerInlineQueryRequest) Zero() bool { - if a == nil { - return true - } - if !(a.InlineQueryID == 0) { - return false - } - if !(a.IsPersonal == false) { - return false - } - if !(a.Button.Zero()) { - return false - } - if !(a.Results == nil) { - return false - } - if !(a.CacheTime == 0) { - return false - } - if !(a.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AnswerInlineQueryRequest) String() string { - if a == nil { - return "AnswerInlineQueryRequest(nil)" - } - type Alias AnswerInlineQueryRequest - return fmt.Sprintf("AnswerInlineQueryRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AnswerInlineQueryRequest) TypeID() uint32 { - return AnswerInlineQueryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AnswerInlineQueryRequest) TypeName() string { - return "answerInlineQuery" -} - -// TypeInfo returns info about TL type. -func (a *AnswerInlineQueryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "answerInlineQuery", - ID: AnswerInlineQueryRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InlineQueryID", - SchemaName: "inline_query_id", - }, - { - Name: "IsPersonal", - SchemaName: "is_personal", - }, - { - Name: "Button", - SchemaName: "button", - }, - { - Name: "Results", - SchemaName: "results", - }, - { - Name: "CacheTime", - SchemaName: "cache_time", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AnswerInlineQueryRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerInlineQuery#ac7cc5e6 as nil") - } - b.PutID(AnswerInlineQueryRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AnswerInlineQueryRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerInlineQuery#ac7cc5e6 as nil") - } - b.PutLong(a.InlineQueryID) - b.PutBool(a.IsPersonal) - if err := a.Button.Encode(b); err != nil { - return fmt.Errorf("unable to encode answerInlineQuery#ac7cc5e6: field button: %w", err) - } - b.PutInt(len(a.Results)) - for idx, v := range a.Results { - if v == nil { - return fmt.Errorf("unable to encode answerInlineQuery#ac7cc5e6: field results element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare answerInlineQuery#ac7cc5e6: field results element with index %d: %w", idx, err) - } - } - b.PutInt32(a.CacheTime) - b.PutString(a.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (a *AnswerInlineQueryRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerInlineQuery#ac7cc5e6 to nil") - } - if err := b.ConsumeID(AnswerInlineQueryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AnswerInlineQueryRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerInlineQuery#ac7cc5e6 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field inline_query_id: %w", err) - } - a.InlineQueryID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field is_personal: %w", err) - } - a.IsPersonal = value - } - { - if err := a.Button.Decode(b); err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field button: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field results: %w", err) - } - - if headerLen > 0 { - a.Results = make([]InputInlineQueryResultClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeInputInlineQueryResult(b) - if err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field results: %w", err) - } - a.Results = append(a.Results, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field cache_time: %w", err) - } - a.CacheTime = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field next_offset: %w", err) - } - a.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AnswerInlineQueryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode answerInlineQuery#ac7cc5e6 as nil") - } - b.ObjStart() - b.PutID("answerInlineQuery") - b.Comma() - b.FieldStart("inline_query_id") - b.PutLong(a.InlineQueryID) - b.Comma() - b.FieldStart("is_personal") - b.PutBool(a.IsPersonal) - b.Comma() - b.FieldStart("button") - if err := a.Button.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode answerInlineQuery#ac7cc5e6: field button: %w", err) - } - b.Comma() - b.FieldStart("results") - b.ArrStart() - for idx, v := range a.Results { - if v == nil { - return fmt.Errorf("unable to encode answerInlineQuery#ac7cc5e6: field results element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode answerInlineQuery#ac7cc5e6: field results element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("cache_time") - b.PutInt32(a.CacheTime) - b.Comma() - b.FieldStart("next_offset") - b.PutString(a.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AnswerInlineQueryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode answerInlineQuery#ac7cc5e6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("answerInlineQuery"); err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: %w", err) - } - case "inline_query_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field inline_query_id: %w", err) - } - a.InlineQueryID = value - case "is_personal": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field is_personal: %w", err) - } - a.IsPersonal = value - case "button": - if err := a.Button.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field button: %w", err) - } - case "results": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONInputInlineQueryResult(b) - if err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field results: %w", err) - } - a.Results = append(a.Results, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field results: %w", err) - } - case "cache_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field cache_time: %w", err) - } - a.CacheTime = value - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerInlineQuery#ac7cc5e6: field next_offset: %w", err) - } - a.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInlineQueryID returns value of InlineQueryID field. -func (a *AnswerInlineQueryRequest) GetInlineQueryID() (value int64) { - if a == nil { - return - } - return a.InlineQueryID -} - -// GetIsPersonal returns value of IsPersonal field. -func (a *AnswerInlineQueryRequest) GetIsPersonal() (value bool) { - if a == nil { - return - } - return a.IsPersonal -} - -// GetButton returns value of Button field. -func (a *AnswerInlineQueryRequest) GetButton() (value InlineQueryResultsButton) { - if a == nil { - return - } - return a.Button -} - -// GetResults returns value of Results field. -func (a *AnswerInlineQueryRequest) GetResults() (value []InputInlineQueryResultClass) { - if a == nil { - return - } - return a.Results -} - -// GetCacheTime returns value of CacheTime field. -func (a *AnswerInlineQueryRequest) GetCacheTime() (value int32) { - if a == nil { - return - } - return a.CacheTime -} - -// GetNextOffset returns value of NextOffset field. -func (a *AnswerInlineQueryRequest) GetNextOffset() (value string) { - if a == nil { - return - } - return a.NextOffset -} - -// AnswerInlineQuery invokes method answerInlineQuery#ac7cc5e6 returning error if any. -func (c *Client) AnswerInlineQuery(ctx context.Context, request *AnswerInlineQueryRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_answer_pre_checkout_query_gen.go b/tdapi/tl_answer_pre_checkout_query_gen.go deleted file mode 100644 index c84e7d5da..000000000 --- a/tdapi/tl_answer_pre_checkout_query_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AnswerPreCheckoutQueryRequest represents TL type `answerPreCheckoutQuery#a76163eb`. -type AnswerPreCheckoutQueryRequest struct { - // Identifier of the pre-checkout query - PreCheckoutQueryID int64 - // An error message, empty on success - ErrorMessage string -} - -// AnswerPreCheckoutQueryRequestTypeID is TL type id of AnswerPreCheckoutQueryRequest. -const AnswerPreCheckoutQueryRequestTypeID = 0xa76163eb - -// Ensuring interfaces in compile-time for AnswerPreCheckoutQueryRequest. -var ( - _ bin.Encoder = &AnswerPreCheckoutQueryRequest{} - _ bin.Decoder = &AnswerPreCheckoutQueryRequest{} - _ bin.BareEncoder = &AnswerPreCheckoutQueryRequest{} - _ bin.BareDecoder = &AnswerPreCheckoutQueryRequest{} -) - -func (a *AnswerPreCheckoutQueryRequest) Zero() bool { - if a == nil { - return true - } - if !(a.PreCheckoutQueryID == 0) { - return false - } - if !(a.ErrorMessage == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AnswerPreCheckoutQueryRequest) String() string { - if a == nil { - return "AnswerPreCheckoutQueryRequest(nil)" - } - type Alias AnswerPreCheckoutQueryRequest - return fmt.Sprintf("AnswerPreCheckoutQueryRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AnswerPreCheckoutQueryRequest) TypeID() uint32 { - return AnswerPreCheckoutQueryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AnswerPreCheckoutQueryRequest) TypeName() string { - return "answerPreCheckoutQuery" -} - -// TypeInfo returns info about TL type. -func (a *AnswerPreCheckoutQueryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "answerPreCheckoutQuery", - ID: AnswerPreCheckoutQueryRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PreCheckoutQueryID", - SchemaName: "pre_checkout_query_id", - }, - { - Name: "ErrorMessage", - SchemaName: "error_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AnswerPreCheckoutQueryRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerPreCheckoutQuery#a76163eb as nil") - } - b.PutID(AnswerPreCheckoutQueryRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AnswerPreCheckoutQueryRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerPreCheckoutQuery#a76163eb as nil") - } - b.PutLong(a.PreCheckoutQueryID) - b.PutString(a.ErrorMessage) - return nil -} - -// Decode implements bin.Decoder. -func (a *AnswerPreCheckoutQueryRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerPreCheckoutQuery#a76163eb to nil") - } - if err := b.ConsumeID(AnswerPreCheckoutQueryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode answerPreCheckoutQuery#a76163eb: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AnswerPreCheckoutQueryRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerPreCheckoutQuery#a76163eb to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode answerPreCheckoutQuery#a76163eb: field pre_checkout_query_id: %w", err) - } - a.PreCheckoutQueryID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerPreCheckoutQuery#a76163eb: field error_message: %w", err) - } - a.ErrorMessage = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AnswerPreCheckoutQueryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode answerPreCheckoutQuery#a76163eb as nil") - } - b.ObjStart() - b.PutID("answerPreCheckoutQuery") - b.Comma() - b.FieldStart("pre_checkout_query_id") - b.PutLong(a.PreCheckoutQueryID) - b.Comma() - b.FieldStart("error_message") - b.PutString(a.ErrorMessage) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AnswerPreCheckoutQueryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode answerPreCheckoutQuery#a76163eb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("answerPreCheckoutQuery"); err != nil { - return fmt.Errorf("unable to decode answerPreCheckoutQuery#a76163eb: %w", err) - } - case "pre_checkout_query_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode answerPreCheckoutQuery#a76163eb: field pre_checkout_query_id: %w", err) - } - a.PreCheckoutQueryID = value - case "error_message": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerPreCheckoutQuery#a76163eb: field error_message: %w", err) - } - a.ErrorMessage = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPreCheckoutQueryID returns value of PreCheckoutQueryID field. -func (a *AnswerPreCheckoutQueryRequest) GetPreCheckoutQueryID() (value int64) { - if a == nil { - return - } - return a.PreCheckoutQueryID -} - -// GetErrorMessage returns value of ErrorMessage field. -func (a *AnswerPreCheckoutQueryRequest) GetErrorMessage() (value string) { - if a == nil { - return - } - return a.ErrorMessage -} - -// AnswerPreCheckoutQuery invokes method answerPreCheckoutQuery#a76163eb returning error if any. -func (c *Client) AnswerPreCheckoutQuery(ctx context.Context, request *AnswerPreCheckoutQueryRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_answer_shipping_query_gen.go b/tdapi/tl_answer_shipping_query_gen.go deleted file mode 100644 index 9526d8d25..000000000 --- a/tdapi/tl_answer_shipping_query_gen.go +++ /dev/null @@ -1,299 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AnswerShippingQueryRequest represents TL type `answerShippingQuery#7a3c2432`. -type AnswerShippingQueryRequest struct { - // Identifier of the shipping query - ShippingQueryID int64 - // Available shipping options - ShippingOptions []ShippingOption - // An error message, empty on success - ErrorMessage string -} - -// AnswerShippingQueryRequestTypeID is TL type id of AnswerShippingQueryRequest. -const AnswerShippingQueryRequestTypeID = 0x7a3c2432 - -// Ensuring interfaces in compile-time for AnswerShippingQueryRequest. -var ( - _ bin.Encoder = &AnswerShippingQueryRequest{} - _ bin.Decoder = &AnswerShippingQueryRequest{} - _ bin.BareEncoder = &AnswerShippingQueryRequest{} - _ bin.BareDecoder = &AnswerShippingQueryRequest{} -) - -func (a *AnswerShippingQueryRequest) Zero() bool { - if a == nil { - return true - } - if !(a.ShippingQueryID == 0) { - return false - } - if !(a.ShippingOptions == nil) { - return false - } - if !(a.ErrorMessage == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AnswerShippingQueryRequest) String() string { - if a == nil { - return "AnswerShippingQueryRequest(nil)" - } - type Alias AnswerShippingQueryRequest - return fmt.Sprintf("AnswerShippingQueryRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AnswerShippingQueryRequest) TypeID() uint32 { - return AnswerShippingQueryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AnswerShippingQueryRequest) TypeName() string { - return "answerShippingQuery" -} - -// TypeInfo returns info about TL type. -func (a *AnswerShippingQueryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "answerShippingQuery", - ID: AnswerShippingQueryRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShippingQueryID", - SchemaName: "shipping_query_id", - }, - { - Name: "ShippingOptions", - SchemaName: "shipping_options", - }, - { - Name: "ErrorMessage", - SchemaName: "error_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AnswerShippingQueryRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerShippingQuery#7a3c2432 as nil") - } - b.PutID(AnswerShippingQueryRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AnswerShippingQueryRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerShippingQuery#7a3c2432 as nil") - } - b.PutLong(a.ShippingQueryID) - b.PutInt(len(a.ShippingOptions)) - for idx, v := range a.ShippingOptions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare answerShippingQuery#7a3c2432: field shipping_options element with index %d: %w", idx, err) - } - } - b.PutString(a.ErrorMessage) - return nil -} - -// Decode implements bin.Decoder. -func (a *AnswerShippingQueryRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerShippingQuery#7a3c2432 to nil") - } - if err := b.ConsumeID(AnswerShippingQueryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode answerShippingQuery#7a3c2432: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AnswerShippingQueryRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerShippingQuery#7a3c2432 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode answerShippingQuery#7a3c2432: field shipping_query_id: %w", err) - } - a.ShippingQueryID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode answerShippingQuery#7a3c2432: field shipping_options: %w", err) - } - - if headerLen > 0 { - a.ShippingOptions = make([]ShippingOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ShippingOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare answerShippingQuery#7a3c2432: field shipping_options: %w", err) - } - a.ShippingOptions = append(a.ShippingOptions, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerShippingQuery#7a3c2432: field error_message: %w", err) - } - a.ErrorMessage = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AnswerShippingQueryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode answerShippingQuery#7a3c2432 as nil") - } - b.ObjStart() - b.PutID("answerShippingQuery") - b.Comma() - b.FieldStart("shipping_query_id") - b.PutLong(a.ShippingQueryID) - b.Comma() - b.FieldStart("shipping_options") - b.ArrStart() - for idx, v := range a.ShippingOptions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode answerShippingQuery#7a3c2432: field shipping_options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("error_message") - b.PutString(a.ErrorMessage) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AnswerShippingQueryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode answerShippingQuery#7a3c2432 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("answerShippingQuery"); err != nil { - return fmt.Errorf("unable to decode answerShippingQuery#7a3c2432: %w", err) - } - case "shipping_query_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode answerShippingQuery#7a3c2432: field shipping_query_id: %w", err) - } - a.ShippingQueryID = value - case "shipping_options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ShippingOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode answerShippingQuery#7a3c2432: field shipping_options: %w", err) - } - a.ShippingOptions = append(a.ShippingOptions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode answerShippingQuery#7a3c2432: field shipping_options: %w", err) - } - case "error_message": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerShippingQuery#7a3c2432: field error_message: %w", err) - } - a.ErrorMessage = value - default: - return b.Skip() - } - return nil - }) -} - -// GetShippingQueryID returns value of ShippingQueryID field. -func (a *AnswerShippingQueryRequest) GetShippingQueryID() (value int64) { - if a == nil { - return - } - return a.ShippingQueryID -} - -// GetShippingOptions returns value of ShippingOptions field. -func (a *AnswerShippingQueryRequest) GetShippingOptions() (value []ShippingOption) { - if a == nil { - return - } - return a.ShippingOptions -} - -// GetErrorMessage returns value of ErrorMessage field. -func (a *AnswerShippingQueryRequest) GetErrorMessage() (value string) { - if a == nil { - return - } - return a.ErrorMessage -} - -// AnswerShippingQuery invokes method answerShippingQuery#7a3c2432 returning error if any. -func (c *Client) AnswerShippingQuery(ctx context.Context, request *AnswerShippingQueryRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_answer_web_app_query_gen.go b/tdapi/tl_answer_web_app_query_gen.go deleted file mode 100644 index 55d02a235..000000000 --- a/tdapi/tl_answer_web_app_query_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AnswerWebAppQueryRequest represents TL type `answerWebAppQuery#a0b49cf1`. -type AnswerWebAppQueryRequest struct { - // Identifier of the Web App query - WebAppQueryID string - // The result of the query - Result InputInlineQueryResultClass -} - -// AnswerWebAppQueryRequestTypeID is TL type id of AnswerWebAppQueryRequest. -const AnswerWebAppQueryRequestTypeID = 0xa0b49cf1 - -// Ensuring interfaces in compile-time for AnswerWebAppQueryRequest. -var ( - _ bin.Encoder = &AnswerWebAppQueryRequest{} - _ bin.Decoder = &AnswerWebAppQueryRequest{} - _ bin.BareEncoder = &AnswerWebAppQueryRequest{} - _ bin.BareDecoder = &AnswerWebAppQueryRequest{} -) - -func (a *AnswerWebAppQueryRequest) Zero() bool { - if a == nil { - return true - } - if !(a.WebAppQueryID == "") { - return false - } - if !(a.Result == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AnswerWebAppQueryRequest) String() string { - if a == nil { - return "AnswerWebAppQueryRequest(nil)" - } - type Alias AnswerWebAppQueryRequest - return fmt.Sprintf("AnswerWebAppQueryRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AnswerWebAppQueryRequest) TypeID() uint32 { - return AnswerWebAppQueryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AnswerWebAppQueryRequest) TypeName() string { - return "answerWebAppQuery" -} - -// TypeInfo returns info about TL type. -func (a *AnswerWebAppQueryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "answerWebAppQuery", - ID: AnswerWebAppQueryRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WebAppQueryID", - SchemaName: "web_app_query_id", - }, - { - Name: "Result", - SchemaName: "result", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AnswerWebAppQueryRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerWebAppQuery#a0b49cf1 as nil") - } - b.PutID(AnswerWebAppQueryRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AnswerWebAppQueryRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode answerWebAppQuery#a0b49cf1 as nil") - } - b.PutString(a.WebAppQueryID) - if a.Result == nil { - return fmt.Errorf("unable to encode answerWebAppQuery#a0b49cf1: field result is nil") - } - if err := a.Result.Encode(b); err != nil { - return fmt.Errorf("unable to encode answerWebAppQuery#a0b49cf1: field result: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AnswerWebAppQueryRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerWebAppQuery#a0b49cf1 to nil") - } - if err := b.ConsumeID(AnswerWebAppQueryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode answerWebAppQuery#a0b49cf1: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AnswerWebAppQueryRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode answerWebAppQuery#a0b49cf1 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerWebAppQuery#a0b49cf1: field web_app_query_id: %w", err) - } - a.WebAppQueryID = value - } - { - value, err := DecodeInputInlineQueryResult(b) - if err != nil { - return fmt.Errorf("unable to decode answerWebAppQuery#a0b49cf1: field result: %w", err) - } - a.Result = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AnswerWebAppQueryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode answerWebAppQuery#a0b49cf1 as nil") - } - b.ObjStart() - b.PutID("answerWebAppQuery") - b.Comma() - b.FieldStart("web_app_query_id") - b.PutString(a.WebAppQueryID) - b.Comma() - b.FieldStart("result") - if a.Result == nil { - return fmt.Errorf("unable to encode answerWebAppQuery#a0b49cf1: field result is nil") - } - if err := a.Result.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode answerWebAppQuery#a0b49cf1: field result: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AnswerWebAppQueryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode answerWebAppQuery#a0b49cf1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("answerWebAppQuery"); err != nil { - return fmt.Errorf("unable to decode answerWebAppQuery#a0b49cf1: %w", err) - } - case "web_app_query_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode answerWebAppQuery#a0b49cf1: field web_app_query_id: %w", err) - } - a.WebAppQueryID = value - case "result": - value, err := DecodeTDLibJSONInputInlineQueryResult(b) - if err != nil { - return fmt.Errorf("unable to decode answerWebAppQuery#a0b49cf1: field result: %w", err) - } - a.Result = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWebAppQueryID returns value of WebAppQueryID field. -func (a *AnswerWebAppQueryRequest) GetWebAppQueryID() (value string) { - if a == nil { - return - } - return a.WebAppQueryID -} - -// GetResult returns value of Result field. -func (a *AnswerWebAppQueryRequest) GetResult() (value InputInlineQueryResultClass) { - if a == nil { - return - } - return a.Result -} - -// AnswerWebAppQuery invokes method answerWebAppQuery#a0b49cf1 returning error if any. -func (c *Client) AnswerWebAppQuery(ctx context.Context, request *AnswerWebAppQueryRequest) (*SentWebAppMessage, error) { - var result SentWebAppMessage - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_apply_premium_gift_code_gen.go b/tdapi/tl_apply_premium_gift_code_gen.go deleted file mode 100644 index 7a34b8576..000000000 --- a/tdapi/tl_apply_premium_gift_code_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ApplyPremiumGiftCodeRequest represents TL type `applyPremiumGiftCode#afb44c1e`. -type ApplyPremiumGiftCodeRequest struct { - // The code to apply - Code string -} - -// ApplyPremiumGiftCodeRequestTypeID is TL type id of ApplyPremiumGiftCodeRequest. -const ApplyPremiumGiftCodeRequestTypeID = 0xafb44c1e - -// Ensuring interfaces in compile-time for ApplyPremiumGiftCodeRequest. -var ( - _ bin.Encoder = &ApplyPremiumGiftCodeRequest{} - _ bin.Decoder = &ApplyPremiumGiftCodeRequest{} - _ bin.BareEncoder = &ApplyPremiumGiftCodeRequest{} - _ bin.BareDecoder = &ApplyPremiumGiftCodeRequest{} -) - -func (a *ApplyPremiumGiftCodeRequest) Zero() bool { - if a == nil { - return true - } - if !(a.Code == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *ApplyPremiumGiftCodeRequest) String() string { - if a == nil { - return "ApplyPremiumGiftCodeRequest(nil)" - } - type Alias ApplyPremiumGiftCodeRequest - return fmt.Sprintf("ApplyPremiumGiftCodeRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ApplyPremiumGiftCodeRequest) TypeID() uint32 { - return ApplyPremiumGiftCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ApplyPremiumGiftCodeRequest) TypeName() string { - return "applyPremiumGiftCode" -} - -// TypeInfo returns info about TL type. -func (a *ApplyPremiumGiftCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "applyPremiumGiftCode", - ID: ApplyPremiumGiftCodeRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *ApplyPremiumGiftCodeRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode applyPremiumGiftCode#afb44c1e as nil") - } - b.PutID(ApplyPremiumGiftCodeRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *ApplyPremiumGiftCodeRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode applyPremiumGiftCode#afb44c1e as nil") - } - b.PutString(a.Code) - return nil -} - -// Decode implements bin.Decoder. -func (a *ApplyPremiumGiftCodeRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode applyPremiumGiftCode#afb44c1e to nil") - } - if err := b.ConsumeID(ApplyPremiumGiftCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode applyPremiumGiftCode#afb44c1e: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *ApplyPremiumGiftCodeRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode applyPremiumGiftCode#afb44c1e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode applyPremiumGiftCode#afb44c1e: field code: %w", err) - } - a.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *ApplyPremiumGiftCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode applyPremiumGiftCode#afb44c1e as nil") - } - b.ObjStart() - b.PutID("applyPremiumGiftCode") - b.Comma() - b.FieldStart("code") - b.PutString(a.Code) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *ApplyPremiumGiftCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode applyPremiumGiftCode#afb44c1e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("applyPremiumGiftCode"); err != nil { - return fmt.Errorf("unable to decode applyPremiumGiftCode#afb44c1e: %w", err) - } - case "code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode applyPremiumGiftCode#afb44c1e: field code: %w", err) - } - a.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (a *ApplyPremiumGiftCodeRequest) GetCode() (value string) { - if a == nil { - return - } - return a.Code -} - -// ApplyPremiumGiftCode invokes method applyPremiumGiftCode#afb44c1e returning error if any. -func (c *Client) ApplyPremiumGiftCode(ctx context.Context, code string) error { - var ok Ok - - request := &ApplyPremiumGiftCodeRequest{ - Code: code, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_archive_chat_list_settings_gen.go b/tdapi/tl_archive_chat_list_settings_gen.go deleted file mode 100644 index 658551da7..000000000 --- a/tdapi/tl_archive_chat_list_settings_gen.go +++ /dev/null @@ -1,266 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ArchiveChatListSettings represents TL type `archiveChatListSettings#3f176aa4`. -type ArchiveChatListSettings struct { - // True, if new chats from non-contacts will be automatically archived and muted. Can be - // set to true only if the option "can_archive_and_mute_new_chats_from_unknown_users" is - // true - ArchiveAndMuteNewChatsFromUnknownUsers bool - // True, if unmuted chats will be kept in the Archive chat list when they get a new - // message - KeepUnmutedChatsArchived bool - // True, if unmuted chats, that are always included or pinned in a folder, will be kept - // in the Archive chat list when they get a new message. Ignored if - // keep_unmuted_chats_archived == true - KeepChatsFromFoldersArchived bool -} - -// ArchiveChatListSettingsTypeID is TL type id of ArchiveChatListSettings. -const ArchiveChatListSettingsTypeID = 0x3f176aa4 - -// Ensuring interfaces in compile-time for ArchiveChatListSettings. -var ( - _ bin.Encoder = &ArchiveChatListSettings{} - _ bin.Decoder = &ArchiveChatListSettings{} - _ bin.BareEncoder = &ArchiveChatListSettings{} - _ bin.BareDecoder = &ArchiveChatListSettings{} -) - -func (a *ArchiveChatListSettings) Zero() bool { - if a == nil { - return true - } - if !(a.ArchiveAndMuteNewChatsFromUnknownUsers == false) { - return false - } - if !(a.KeepUnmutedChatsArchived == false) { - return false - } - if !(a.KeepChatsFromFoldersArchived == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *ArchiveChatListSettings) String() string { - if a == nil { - return "ArchiveChatListSettings(nil)" - } - type Alias ArchiveChatListSettings - return fmt.Sprintf("ArchiveChatListSettings%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ArchiveChatListSettings) TypeID() uint32 { - return ArchiveChatListSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ArchiveChatListSettings) TypeName() string { - return "archiveChatListSettings" -} - -// TypeInfo returns info about TL type. -func (a *ArchiveChatListSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "archiveChatListSettings", - ID: ArchiveChatListSettingsTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ArchiveAndMuteNewChatsFromUnknownUsers", - SchemaName: "archive_and_mute_new_chats_from_unknown_users", - }, - { - Name: "KeepUnmutedChatsArchived", - SchemaName: "keep_unmuted_chats_archived", - }, - { - Name: "KeepChatsFromFoldersArchived", - SchemaName: "keep_chats_from_folders_archived", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *ArchiveChatListSettings) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode archiveChatListSettings#3f176aa4 as nil") - } - b.PutID(ArchiveChatListSettingsTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *ArchiveChatListSettings) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode archiveChatListSettings#3f176aa4 as nil") - } - b.PutBool(a.ArchiveAndMuteNewChatsFromUnknownUsers) - b.PutBool(a.KeepUnmutedChatsArchived) - b.PutBool(a.KeepChatsFromFoldersArchived) - return nil -} - -// Decode implements bin.Decoder. -func (a *ArchiveChatListSettings) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode archiveChatListSettings#3f176aa4 to nil") - } - if err := b.ConsumeID(ArchiveChatListSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode archiveChatListSettings#3f176aa4: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *ArchiveChatListSettings) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode archiveChatListSettings#3f176aa4 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode archiveChatListSettings#3f176aa4: field archive_and_mute_new_chats_from_unknown_users: %w", err) - } - a.ArchiveAndMuteNewChatsFromUnknownUsers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode archiveChatListSettings#3f176aa4: field keep_unmuted_chats_archived: %w", err) - } - a.KeepUnmutedChatsArchived = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode archiveChatListSettings#3f176aa4: field keep_chats_from_folders_archived: %w", err) - } - a.KeepChatsFromFoldersArchived = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *ArchiveChatListSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode archiveChatListSettings#3f176aa4 as nil") - } - b.ObjStart() - b.PutID("archiveChatListSettings") - b.Comma() - b.FieldStart("archive_and_mute_new_chats_from_unknown_users") - b.PutBool(a.ArchiveAndMuteNewChatsFromUnknownUsers) - b.Comma() - b.FieldStart("keep_unmuted_chats_archived") - b.PutBool(a.KeepUnmutedChatsArchived) - b.Comma() - b.FieldStart("keep_chats_from_folders_archived") - b.PutBool(a.KeepChatsFromFoldersArchived) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *ArchiveChatListSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode archiveChatListSettings#3f176aa4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("archiveChatListSettings"); err != nil { - return fmt.Errorf("unable to decode archiveChatListSettings#3f176aa4: %w", err) - } - case "archive_and_mute_new_chats_from_unknown_users": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode archiveChatListSettings#3f176aa4: field archive_and_mute_new_chats_from_unknown_users: %w", err) - } - a.ArchiveAndMuteNewChatsFromUnknownUsers = value - case "keep_unmuted_chats_archived": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode archiveChatListSettings#3f176aa4: field keep_unmuted_chats_archived: %w", err) - } - a.KeepUnmutedChatsArchived = value - case "keep_chats_from_folders_archived": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode archiveChatListSettings#3f176aa4: field keep_chats_from_folders_archived: %w", err) - } - a.KeepChatsFromFoldersArchived = value - default: - return b.Skip() - } - return nil - }) -} - -// GetArchiveAndMuteNewChatsFromUnknownUsers returns value of ArchiveAndMuteNewChatsFromUnknownUsers field. -func (a *ArchiveChatListSettings) GetArchiveAndMuteNewChatsFromUnknownUsers() (value bool) { - if a == nil { - return - } - return a.ArchiveAndMuteNewChatsFromUnknownUsers -} - -// GetKeepUnmutedChatsArchived returns value of KeepUnmutedChatsArchived field. -func (a *ArchiveChatListSettings) GetKeepUnmutedChatsArchived() (value bool) { - if a == nil { - return - } - return a.KeepUnmutedChatsArchived -} - -// GetKeepChatsFromFoldersArchived returns value of KeepChatsFromFoldersArchived field. -func (a *ArchiveChatListSettings) GetKeepChatsFromFoldersArchived() (value bool) { - if a == nil { - return - } - return a.KeepChatsFromFoldersArchived -} diff --git a/tdapi/tl_assign_app_store_transaction_gen.go b/tdapi/tl_assign_app_store_transaction_gen.go deleted file mode 100644 index a3a8bdce8..000000000 --- a/tdapi/tl_assign_app_store_transaction_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AssignAppStoreTransactionRequest represents TL type `assignAppStoreTransaction#86f30bb0`. -type AssignAppStoreTransactionRequest struct { - // App Store receipt - Receipt []byte - // Transaction purpose - Purpose StorePaymentPurposeClass -} - -// AssignAppStoreTransactionRequestTypeID is TL type id of AssignAppStoreTransactionRequest. -const AssignAppStoreTransactionRequestTypeID = 0x86f30bb0 - -// Ensuring interfaces in compile-time for AssignAppStoreTransactionRequest. -var ( - _ bin.Encoder = &AssignAppStoreTransactionRequest{} - _ bin.Decoder = &AssignAppStoreTransactionRequest{} - _ bin.BareEncoder = &AssignAppStoreTransactionRequest{} - _ bin.BareDecoder = &AssignAppStoreTransactionRequest{} -) - -func (a *AssignAppStoreTransactionRequest) Zero() bool { - if a == nil { - return true - } - if !(a.Receipt == nil) { - return false - } - if !(a.Purpose == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AssignAppStoreTransactionRequest) String() string { - if a == nil { - return "AssignAppStoreTransactionRequest(nil)" - } - type Alias AssignAppStoreTransactionRequest - return fmt.Sprintf("AssignAppStoreTransactionRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AssignAppStoreTransactionRequest) TypeID() uint32 { - return AssignAppStoreTransactionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AssignAppStoreTransactionRequest) TypeName() string { - return "assignAppStoreTransaction" -} - -// TypeInfo returns info about TL type. -func (a *AssignAppStoreTransactionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "assignAppStoreTransaction", - ID: AssignAppStoreTransactionRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Receipt", - SchemaName: "receipt", - }, - { - Name: "Purpose", - SchemaName: "purpose", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AssignAppStoreTransactionRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode assignAppStoreTransaction#86f30bb0 as nil") - } - b.PutID(AssignAppStoreTransactionRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AssignAppStoreTransactionRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode assignAppStoreTransaction#86f30bb0 as nil") - } - b.PutBytes(a.Receipt) - if a.Purpose == nil { - return fmt.Errorf("unable to encode assignAppStoreTransaction#86f30bb0: field purpose is nil") - } - if err := a.Purpose.Encode(b); err != nil { - return fmt.Errorf("unable to encode assignAppStoreTransaction#86f30bb0: field purpose: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AssignAppStoreTransactionRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode assignAppStoreTransaction#86f30bb0 to nil") - } - if err := b.ConsumeID(AssignAppStoreTransactionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode assignAppStoreTransaction#86f30bb0: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AssignAppStoreTransactionRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode assignAppStoreTransaction#86f30bb0 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode assignAppStoreTransaction#86f30bb0: field receipt: %w", err) - } - a.Receipt = value - } - { - value, err := DecodeStorePaymentPurpose(b) - if err != nil { - return fmt.Errorf("unable to decode assignAppStoreTransaction#86f30bb0: field purpose: %w", err) - } - a.Purpose = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AssignAppStoreTransactionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode assignAppStoreTransaction#86f30bb0 as nil") - } - b.ObjStart() - b.PutID("assignAppStoreTransaction") - b.Comma() - b.FieldStart("receipt") - b.PutBytes(a.Receipt) - b.Comma() - b.FieldStart("purpose") - if a.Purpose == nil { - return fmt.Errorf("unable to encode assignAppStoreTransaction#86f30bb0: field purpose is nil") - } - if err := a.Purpose.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode assignAppStoreTransaction#86f30bb0: field purpose: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AssignAppStoreTransactionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode assignAppStoreTransaction#86f30bb0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("assignAppStoreTransaction"); err != nil { - return fmt.Errorf("unable to decode assignAppStoreTransaction#86f30bb0: %w", err) - } - case "receipt": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode assignAppStoreTransaction#86f30bb0: field receipt: %w", err) - } - a.Receipt = value - case "purpose": - value, err := DecodeTDLibJSONStorePaymentPurpose(b) - if err != nil { - return fmt.Errorf("unable to decode assignAppStoreTransaction#86f30bb0: field purpose: %w", err) - } - a.Purpose = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReceipt returns value of Receipt field. -func (a *AssignAppStoreTransactionRequest) GetReceipt() (value []byte) { - if a == nil { - return - } - return a.Receipt -} - -// GetPurpose returns value of Purpose field. -func (a *AssignAppStoreTransactionRequest) GetPurpose() (value StorePaymentPurposeClass) { - if a == nil { - return - } - return a.Purpose -} - -// AssignAppStoreTransaction invokes method assignAppStoreTransaction#86f30bb0 returning error if any. -func (c *Client) AssignAppStoreTransaction(ctx context.Context, request *AssignAppStoreTransactionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_assign_google_play_transaction_gen.go b/tdapi/tl_assign_google_play_transaction_gen.go deleted file mode 100644 index 9aac6c418..000000000 --- a/tdapi/tl_assign_google_play_transaction_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AssignGooglePlayTransactionRequest represents TL type `assignGooglePlayTransaction#8939bca4`. -type AssignGooglePlayTransactionRequest struct { - // Application package name - PackageName string - // Identifier of the purchased store product - StoreProductID string - // Google Play purchase token - PurchaseToken string - // Transaction purpose - Purpose StorePaymentPurposeClass -} - -// AssignGooglePlayTransactionRequestTypeID is TL type id of AssignGooglePlayTransactionRequest. -const AssignGooglePlayTransactionRequestTypeID = 0x8939bca4 - -// Ensuring interfaces in compile-time for AssignGooglePlayTransactionRequest. -var ( - _ bin.Encoder = &AssignGooglePlayTransactionRequest{} - _ bin.Decoder = &AssignGooglePlayTransactionRequest{} - _ bin.BareEncoder = &AssignGooglePlayTransactionRequest{} - _ bin.BareDecoder = &AssignGooglePlayTransactionRequest{} -) - -func (a *AssignGooglePlayTransactionRequest) Zero() bool { - if a == nil { - return true - } - if !(a.PackageName == "") { - return false - } - if !(a.StoreProductID == "") { - return false - } - if !(a.PurchaseToken == "") { - return false - } - if !(a.Purpose == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AssignGooglePlayTransactionRequest) String() string { - if a == nil { - return "AssignGooglePlayTransactionRequest(nil)" - } - type Alias AssignGooglePlayTransactionRequest - return fmt.Sprintf("AssignGooglePlayTransactionRequest%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AssignGooglePlayTransactionRequest) TypeID() uint32 { - return AssignGooglePlayTransactionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*AssignGooglePlayTransactionRequest) TypeName() string { - return "assignGooglePlayTransaction" -} - -// TypeInfo returns info about TL type. -func (a *AssignGooglePlayTransactionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "assignGooglePlayTransaction", - ID: AssignGooglePlayTransactionRequestTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PackageName", - SchemaName: "package_name", - }, - { - Name: "StoreProductID", - SchemaName: "store_product_id", - }, - { - Name: "PurchaseToken", - SchemaName: "purchase_token", - }, - { - Name: "Purpose", - SchemaName: "purpose", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AssignGooglePlayTransactionRequest) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode assignGooglePlayTransaction#8939bca4 as nil") - } - b.PutID(AssignGooglePlayTransactionRequestTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AssignGooglePlayTransactionRequest) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode assignGooglePlayTransaction#8939bca4 as nil") - } - b.PutString(a.PackageName) - b.PutString(a.StoreProductID) - b.PutString(a.PurchaseToken) - if a.Purpose == nil { - return fmt.Errorf("unable to encode assignGooglePlayTransaction#8939bca4: field purpose is nil") - } - if err := a.Purpose.Encode(b); err != nil { - return fmt.Errorf("unable to encode assignGooglePlayTransaction#8939bca4: field purpose: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AssignGooglePlayTransactionRequest) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode assignGooglePlayTransaction#8939bca4 to nil") - } - if err := b.ConsumeID(AssignGooglePlayTransactionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode assignGooglePlayTransaction#8939bca4: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AssignGooglePlayTransactionRequest) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode assignGooglePlayTransaction#8939bca4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode assignGooglePlayTransaction#8939bca4: field package_name: %w", err) - } - a.PackageName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode assignGooglePlayTransaction#8939bca4: field store_product_id: %w", err) - } - a.StoreProductID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode assignGooglePlayTransaction#8939bca4: field purchase_token: %w", err) - } - a.PurchaseToken = value - } - { - value, err := DecodeStorePaymentPurpose(b) - if err != nil { - return fmt.Errorf("unable to decode assignGooglePlayTransaction#8939bca4: field purpose: %w", err) - } - a.Purpose = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AssignGooglePlayTransactionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode assignGooglePlayTransaction#8939bca4 as nil") - } - b.ObjStart() - b.PutID("assignGooglePlayTransaction") - b.Comma() - b.FieldStart("package_name") - b.PutString(a.PackageName) - b.Comma() - b.FieldStart("store_product_id") - b.PutString(a.StoreProductID) - b.Comma() - b.FieldStart("purchase_token") - b.PutString(a.PurchaseToken) - b.Comma() - b.FieldStart("purpose") - if a.Purpose == nil { - return fmt.Errorf("unable to encode assignGooglePlayTransaction#8939bca4: field purpose is nil") - } - if err := a.Purpose.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode assignGooglePlayTransaction#8939bca4: field purpose: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AssignGooglePlayTransactionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode assignGooglePlayTransaction#8939bca4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("assignGooglePlayTransaction"); err != nil { - return fmt.Errorf("unable to decode assignGooglePlayTransaction#8939bca4: %w", err) - } - case "package_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode assignGooglePlayTransaction#8939bca4: field package_name: %w", err) - } - a.PackageName = value - case "store_product_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode assignGooglePlayTransaction#8939bca4: field store_product_id: %w", err) - } - a.StoreProductID = value - case "purchase_token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode assignGooglePlayTransaction#8939bca4: field purchase_token: %w", err) - } - a.PurchaseToken = value - case "purpose": - value, err := DecodeTDLibJSONStorePaymentPurpose(b) - if err != nil { - return fmt.Errorf("unable to decode assignGooglePlayTransaction#8939bca4: field purpose: %w", err) - } - a.Purpose = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPackageName returns value of PackageName field. -func (a *AssignGooglePlayTransactionRequest) GetPackageName() (value string) { - if a == nil { - return - } - return a.PackageName -} - -// GetStoreProductID returns value of StoreProductID field. -func (a *AssignGooglePlayTransactionRequest) GetStoreProductID() (value string) { - if a == nil { - return - } - return a.StoreProductID -} - -// GetPurchaseToken returns value of PurchaseToken field. -func (a *AssignGooglePlayTransactionRequest) GetPurchaseToken() (value string) { - if a == nil { - return - } - return a.PurchaseToken -} - -// GetPurpose returns value of Purpose field. -func (a *AssignGooglePlayTransactionRequest) GetPurpose() (value StorePaymentPurposeClass) { - if a == nil { - return - } - return a.Purpose -} - -// AssignGooglePlayTransaction invokes method assignGooglePlayTransaction#8939bca4 returning error if any. -func (c *Client) AssignGooglePlayTransaction(ctx context.Context, request *AssignGooglePlayTransactionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_attachment_menu_bot_color_gen.go b/tdapi/tl_attachment_menu_bot_color_gen.go deleted file mode 100644 index 2ca39abf1..000000000 --- a/tdapi/tl_attachment_menu_bot_color_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AttachmentMenuBotColor represents TL type `attachmentMenuBotColor#64235ebc`. -type AttachmentMenuBotColor struct { - // Color in the RGB format for light themes - LightColor int32 - // Color in the RGB format for dark themes - DarkColor int32 -} - -// AttachmentMenuBotColorTypeID is TL type id of AttachmentMenuBotColor. -const AttachmentMenuBotColorTypeID = 0x64235ebc - -// Ensuring interfaces in compile-time for AttachmentMenuBotColor. -var ( - _ bin.Encoder = &AttachmentMenuBotColor{} - _ bin.Decoder = &AttachmentMenuBotColor{} - _ bin.BareEncoder = &AttachmentMenuBotColor{} - _ bin.BareDecoder = &AttachmentMenuBotColor{} -) - -func (a *AttachmentMenuBotColor) Zero() bool { - if a == nil { - return true - } - if !(a.LightColor == 0) { - return false - } - if !(a.DarkColor == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AttachmentMenuBotColor) String() string { - if a == nil { - return "AttachmentMenuBotColor(nil)" - } - type Alias AttachmentMenuBotColor - return fmt.Sprintf("AttachmentMenuBotColor%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AttachmentMenuBotColor) TypeID() uint32 { - return AttachmentMenuBotColorTypeID -} - -// TypeName returns name of type in TL schema. -func (*AttachmentMenuBotColor) TypeName() string { - return "attachmentMenuBotColor" -} - -// TypeInfo returns info about TL type. -func (a *AttachmentMenuBotColor) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "attachmentMenuBotColor", - ID: AttachmentMenuBotColorTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LightColor", - SchemaName: "light_color", - }, - { - Name: "DarkColor", - SchemaName: "dark_color", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AttachmentMenuBotColor) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode attachmentMenuBotColor#64235ebc as nil") - } - b.PutID(AttachmentMenuBotColorTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AttachmentMenuBotColor) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode attachmentMenuBotColor#64235ebc as nil") - } - b.PutInt32(a.LightColor) - b.PutInt32(a.DarkColor) - return nil -} - -// Decode implements bin.Decoder. -func (a *AttachmentMenuBotColor) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode attachmentMenuBotColor#64235ebc to nil") - } - if err := b.ConsumeID(AttachmentMenuBotColorTypeID); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBotColor#64235ebc: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AttachmentMenuBotColor) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode attachmentMenuBotColor#64235ebc to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBotColor#64235ebc: field light_color: %w", err) - } - a.LightColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBotColor#64235ebc: field dark_color: %w", err) - } - a.DarkColor = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AttachmentMenuBotColor) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode attachmentMenuBotColor#64235ebc as nil") - } - b.ObjStart() - b.PutID("attachmentMenuBotColor") - b.Comma() - b.FieldStart("light_color") - b.PutInt32(a.LightColor) - b.Comma() - b.FieldStart("dark_color") - b.PutInt32(a.DarkColor) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AttachmentMenuBotColor) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode attachmentMenuBotColor#64235ebc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("attachmentMenuBotColor"); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBotColor#64235ebc: %w", err) - } - case "light_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBotColor#64235ebc: field light_color: %w", err) - } - a.LightColor = value - case "dark_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBotColor#64235ebc: field dark_color: %w", err) - } - a.DarkColor = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLightColor returns value of LightColor field. -func (a *AttachmentMenuBotColor) GetLightColor() (value int32) { - if a == nil { - return - } - return a.LightColor -} - -// GetDarkColor returns value of DarkColor field. -func (a *AttachmentMenuBotColor) GetDarkColor() (value int32) { - if a == nil { - return - } - return a.DarkColor -} diff --git a/tdapi/tl_attachment_menu_bot_gen.go b/tdapi/tl_attachment_menu_bot_gen.go deleted file mode 100644 index 76736c955..000000000 --- a/tdapi/tl_attachment_menu_bot_gen.go +++ /dev/null @@ -1,946 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AttachmentMenuBot represents TL type `attachmentMenuBot#b96e1bbf`. -type AttachmentMenuBot struct { - // User identifier of the bot - BotUserID int64 - // True, if the bot supports opening from attachment menu in the chat with the bot - SupportsSelfChat bool - // True, if the bot supports opening from attachment menu in private chats with ordinary - // users - SupportsUserChats bool - // True, if the bot supports opening from attachment menu in private chats with other - // bots - SupportsBotChats bool - // True, if the bot supports opening from attachment menu in basic group and supergroup - // chats - SupportsGroupChats bool - // True, if the bot supports opening from attachment menu in channel chats - SupportsChannelChats bool - // True, if the user must be asked for the permission to send messages to the bot - RequestWriteAccess bool - // True, if the bot was explicitly added by the user. If the bot isn't added, then on the - // first bot launch toggleBotIsAddedToAttachmentMenu must be called and the bot must be - // added or removed - IsAdded bool - // True, if the bot must be shown in the attachment menu - ShowInAttachmentMenu bool - // True, if the bot must be shown in the side menu - ShowInSideMenu bool - // True, if a disclaimer, why the bot is shown in the side menu, is needed - ShowDisclaimerInSideMenu bool - // Name for the bot in attachment menu - Name string - // Color to highlight selected name of the bot if appropriate; may be null - NameColor AttachmentMenuBotColor - // Default icon for the bot in SVG format; may be null - DefaultIcon File - // Icon for the bot in SVG format for the official iOS app; may be null - IosStaticIcon File - // Icon for the bot in TGS format for the official iOS app; may be null - IosAnimatedIcon File - // Icon for the bot in PNG format for the official iOS app side menu; may be null - IosSideMenuIcon File - // Icon for the bot in TGS format for the official Android app; may be null - AndroidIcon File - // Icon for the bot in SVG format for the official Android app side menu; may be null - AndroidSideMenuIcon File - // Icon for the bot in TGS format for the official native macOS app; may be null - MacosIcon File - // Icon for the bot in PNG format for the official macOS app side menu; may be null - MacosSideMenuIcon File - // Color to highlight selected icon of the bot if appropriate; may be null - IconColor AttachmentMenuBotColor - // Default placeholder for opened Web Apps in SVG format; may be null - WebAppPlaceholder File -} - -// AttachmentMenuBotTypeID is TL type id of AttachmentMenuBot. -const AttachmentMenuBotTypeID = 0xb96e1bbf - -// Ensuring interfaces in compile-time for AttachmentMenuBot. -var ( - _ bin.Encoder = &AttachmentMenuBot{} - _ bin.Decoder = &AttachmentMenuBot{} - _ bin.BareEncoder = &AttachmentMenuBot{} - _ bin.BareDecoder = &AttachmentMenuBot{} -) - -func (a *AttachmentMenuBot) Zero() bool { - if a == nil { - return true - } - if !(a.BotUserID == 0) { - return false - } - if !(a.SupportsSelfChat == false) { - return false - } - if !(a.SupportsUserChats == false) { - return false - } - if !(a.SupportsBotChats == false) { - return false - } - if !(a.SupportsGroupChats == false) { - return false - } - if !(a.SupportsChannelChats == false) { - return false - } - if !(a.RequestWriteAccess == false) { - return false - } - if !(a.IsAdded == false) { - return false - } - if !(a.ShowInAttachmentMenu == false) { - return false - } - if !(a.ShowInSideMenu == false) { - return false - } - if !(a.ShowDisclaimerInSideMenu == false) { - return false - } - if !(a.Name == "") { - return false - } - if !(a.NameColor.Zero()) { - return false - } - if !(a.DefaultIcon.Zero()) { - return false - } - if !(a.IosStaticIcon.Zero()) { - return false - } - if !(a.IosAnimatedIcon.Zero()) { - return false - } - if !(a.IosSideMenuIcon.Zero()) { - return false - } - if !(a.AndroidIcon.Zero()) { - return false - } - if !(a.AndroidSideMenuIcon.Zero()) { - return false - } - if !(a.MacosIcon.Zero()) { - return false - } - if !(a.MacosSideMenuIcon.Zero()) { - return false - } - if !(a.IconColor.Zero()) { - return false - } - if !(a.WebAppPlaceholder.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AttachmentMenuBot) String() string { - if a == nil { - return "AttachmentMenuBot(nil)" - } - type Alias AttachmentMenuBot - return fmt.Sprintf("AttachmentMenuBot%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AttachmentMenuBot) TypeID() uint32 { - return AttachmentMenuBotTypeID -} - -// TypeName returns name of type in TL schema. -func (*AttachmentMenuBot) TypeName() string { - return "attachmentMenuBot" -} - -// TypeInfo returns info about TL type. -func (a *AttachmentMenuBot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "attachmentMenuBot", - ID: AttachmentMenuBotTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "SupportsSelfChat", - SchemaName: "supports_self_chat", - }, - { - Name: "SupportsUserChats", - SchemaName: "supports_user_chats", - }, - { - Name: "SupportsBotChats", - SchemaName: "supports_bot_chats", - }, - { - Name: "SupportsGroupChats", - SchemaName: "supports_group_chats", - }, - { - Name: "SupportsChannelChats", - SchemaName: "supports_channel_chats", - }, - { - Name: "RequestWriteAccess", - SchemaName: "request_write_access", - }, - { - Name: "IsAdded", - SchemaName: "is_added", - }, - { - Name: "ShowInAttachmentMenu", - SchemaName: "show_in_attachment_menu", - }, - { - Name: "ShowInSideMenu", - SchemaName: "show_in_side_menu", - }, - { - Name: "ShowDisclaimerInSideMenu", - SchemaName: "show_disclaimer_in_side_menu", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "NameColor", - SchemaName: "name_color", - }, - { - Name: "DefaultIcon", - SchemaName: "default_icon", - }, - { - Name: "IosStaticIcon", - SchemaName: "ios_static_icon", - }, - { - Name: "IosAnimatedIcon", - SchemaName: "ios_animated_icon", - }, - { - Name: "IosSideMenuIcon", - SchemaName: "ios_side_menu_icon", - }, - { - Name: "AndroidIcon", - SchemaName: "android_icon", - }, - { - Name: "AndroidSideMenuIcon", - SchemaName: "android_side_menu_icon", - }, - { - Name: "MacosIcon", - SchemaName: "macos_icon", - }, - { - Name: "MacosSideMenuIcon", - SchemaName: "macos_side_menu_icon", - }, - { - Name: "IconColor", - SchemaName: "icon_color", - }, - { - Name: "WebAppPlaceholder", - SchemaName: "web_app_placeholder", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AttachmentMenuBot) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode attachmentMenuBot#b96e1bbf as nil") - } - b.PutID(AttachmentMenuBotTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AttachmentMenuBot) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode attachmentMenuBot#b96e1bbf as nil") - } - b.PutInt53(a.BotUserID) - b.PutBool(a.SupportsSelfChat) - b.PutBool(a.SupportsUserChats) - b.PutBool(a.SupportsBotChats) - b.PutBool(a.SupportsGroupChats) - b.PutBool(a.SupportsChannelChats) - b.PutBool(a.RequestWriteAccess) - b.PutBool(a.IsAdded) - b.PutBool(a.ShowInAttachmentMenu) - b.PutBool(a.ShowInSideMenu) - b.PutBool(a.ShowDisclaimerInSideMenu) - b.PutString(a.Name) - if err := a.NameColor.Encode(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field name_color: %w", err) - } - if err := a.DefaultIcon.Encode(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field default_icon: %w", err) - } - if err := a.IosStaticIcon.Encode(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_static_icon: %w", err) - } - if err := a.IosAnimatedIcon.Encode(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_animated_icon: %w", err) - } - if err := a.IosSideMenuIcon.Encode(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_side_menu_icon: %w", err) - } - if err := a.AndroidIcon.Encode(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field android_icon: %w", err) - } - if err := a.AndroidSideMenuIcon.Encode(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field android_side_menu_icon: %w", err) - } - if err := a.MacosIcon.Encode(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field macos_icon: %w", err) - } - if err := a.MacosSideMenuIcon.Encode(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field macos_side_menu_icon: %w", err) - } - if err := a.IconColor.Encode(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field icon_color: %w", err) - } - if err := a.WebAppPlaceholder.Encode(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field web_app_placeholder: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AttachmentMenuBot) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode attachmentMenuBot#b96e1bbf to nil") - } - if err := b.ConsumeID(AttachmentMenuBotTypeID); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AttachmentMenuBot) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode attachmentMenuBot#b96e1bbf to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field bot_user_id: %w", err) - } - a.BotUserID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_self_chat: %w", err) - } - a.SupportsSelfChat = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_user_chats: %w", err) - } - a.SupportsUserChats = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_bot_chats: %w", err) - } - a.SupportsBotChats = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_group_chats: %w", err) - } - a.SupportsGroupChats = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_channel_chats: %w", err) - } - a.SupportsChannelChats = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field request_write_access: %w", err) - } - a.RequestWriteAccess = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field is_added: %w", err) - } - a.IsAdded = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_in_attachment_menu: %w", err) - } - a.ShowInAttachmentMenu = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_in_side_menu: %w", err) - } - a.ShowInSideMenu = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_disclaimer_in_side_menu: %w", err) - } - a.ShowDisclaimerInSideMenu = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field name: %w", err) - } - a.Name = value - } - { - if err := a.NameColor.Decode(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field name_color: %w", err) - } - } - { - if err := a.DefaultIcon.Decode(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field default_icon: %w", err) - } - } - { - if err := a.IosStaticIcon.Decode(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_static_icon: %w", err) - } - } - { - if err := a.IosAnimatedIcon.Decode(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_animated_icon: %w", err) - } - } - { - if err := a.IosSideMenuIcon.Decode(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_side_menu_icon: %w", err) - } - } - { - if err := a.AndroidIcon.Decode(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field android_icon: %w", err) - } - } - { - if err := a.AndroidSideMenuIcon.Decode(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field android_side_menu_icon: %w", err) - } - } - { - if err := a.MacosIcon.Decode(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field macos_icon: %w", err) - } - } - { - if err := a.MacosSideMenuIcon.Decode(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field macos_side_menu_icon: %w", err) - } - } - { - if err := a.IconColor.Decode(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field icon_color: %w", err) - } - } - { - if err := a.WebAppPlaceholder.Decode(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field web_app_placeholder: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AttachmentMenuBot) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode attachmentMenuBot#b96e1bbf as nil") - } - b.ObjStart() - b.PutID("attachmentMenuBot") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(a.BotUserID) - b.Comma() - b.FieldStart("supports_self_chat") - b.PutBool(a.SupportsSelfChat) - b.Comma() - b.FieldStart("supports_user_chats") - b.PutBool(a.SupportsUserChats) - b.Comma() - b.FieldStart("supports_bot_chats") - b.PutBool(a.SupportsBotChats) - b.Comma() - b.FieldStart("supports_group_chats") - b.PutBool(a.SupportsGroupChats) - b.Comma() - b.FieldStart("supports_channel_chats") - b.PutBool(a.SupportsChannelChats) - b.Comma() - b.FieldStart("request_write_access") - b.PutBool(a.RequestWriteAccess) - b.Comma() - b.FieldStart("is_added") - b.PutBool(a.IsAdded) - b.Comma() - b.FieldStart("show_in_attachment_menu") - b.PutBool(a.ShowInAttachmentMenu) - b.Comma() - b.FieldStart("show_in_side_menu") - b.PutBool(a.ShowInSideMenu) - b.Comma() - b.FieldStart("show_disclaimer_in_side_menu") - b.PutBool(a.ShowDisclaimerInSideMenu) - b.Comma() - b.FieldStart("name") - b.PutString(a.Name) - b.Comma() - b.FieldStart("name_color") - if err := a.NameColor.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field name_color: %w", err) - } - b.Comma() - b.FieldStart("default_icon") - if err := a.DefaultIcon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field default_icon: %w", err) - } - b.Comma() - b.FieldStart("ios_static_icon") - if err := a.IosStaticIcon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_static_icon: %w", err) - } - b.Comma() - b.FieldStart("ios_animated_icon") - if err := a.IosAnimatedIcon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_animated_icon: %w", err) - } - b.Comma() - b.FieldStart("ios_side_menu_icon") - if err := a.IosSideMenuIcon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field ios_side_menu_icon: %w", err) - } - b.Comma() - b.FieldStart("android_icon") - if err := a.AndroidIcon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field android_icon: %w", err) - } - b.Comma() - b.FieldStart("android_side_menu_icon") - if err := a.AndroidSideMenuIcon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field android_side_menu_icon: %w", err) - } - b.Comma() - b.FieldStart("macos_icon") - if err := a.MacosIcon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field macos_icon: %w", err) - } - b.Comma() - b.FieldStart("macos_side_menu_icon") - if err := a.MacosSideMenuIcon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field macos_side_menu_icon: %w", err) - } - b.Comma() - b.FieldStart("icon_color") - if err := a.IconColor.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field icon_color: %w", err) - } - b.Comma() - b.FieldStart("web_app_placeholder") - if err := a.WebAppPlaceholder.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode attachmentMenuBot#b96e1bbf: field web_app_placeholder: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AttachmentMenuBot) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode attachmentMenuBot#b96e1bbf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("attachmentMenuBot"); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field bot_user_id: %w", err) - } - a.BotUserID = value - case "supports_self_chat": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_self_chat: %w", err) - } - a.SupportsSelfChat = value - case "supports_user_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_user_chats: %w", err) - } - a.SupportsUserChats = value - case "supports_bot_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_bot_chats: %w", err) - } - a.SupportsBotChats = value - case "supports_group_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_group_chats: %w", err) - } - a.SupportsGroupChats = value - case "supports_channel_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field supports_channel_chats: %w", err) - } - a.SupportsChannelChats = value - case "request_write_access": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field request_write_access: %w", err) - } - a.RequestWriteAccess = value - case "is_added": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field is_added: %w", err) - } - a.IsAdded = value - case "show_in_attachment_menu": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_in_attachment_menu: %w", err) - } - a.ShowInAttachmentMenu = value - case "show_in_side_menu": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_in_side_menu: %w", err) - } - a.ShowInSideMenu = value - case "show_disclaimer_in_side_menu": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field show_disclaimer_in_side_menu: %w", err) - } - a.ShowDisclaimerInSideMenu = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field name: %w", err) - } - a.Name = value - case "name_color": - if err := a.NameColor.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field name_color: %w", err) - } - case "default_icon": - if err := a.DefaultIcon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field default_icon: %w", err) - } - case "ios_static_icon": - if err := a.IosStaticIcon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_static_icon: %w", err) - } - case "ios_animated_icon": - if err := a.IosAnimatedIcon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_animated_icon: %w", err) - } - case "ios_side_menu_icon": - if err := a.IosSideMenuIcon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field ios_side_menu_icon: %w", err) - } - case "android_icon": - if err := a.AndroidIcon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field android_icon: %w", err) - } - case "android_side_menu_icon": - if err := a.AndroidSideMenuIcon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field android_side_menu_icon: %w", err) - } - case "macos_icon": - if err := a.MacosIcon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field macos_icon: %w", err) - } - case "macos_side_menu_icon": - if err := a.MacosSideMenuIcon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field macos_side_menu_icon: %w", err) - } - case "icon_color": - if err := a.IconColor.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field icon_color: %w", err) - } - case "web_app_placeholder": - if err := a.WebAppPlaceholder.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode attachmentMenuBot#b96e1bbf: field web_app_placeholder: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (a *AttachmentMenuBot) GetBotUserID() (value int64) { - if a == nil { - return - } - return a.BotUserID -} - -// GetSupportsSelfChat returns value of SupportsSelfChat field. -func (a *AttachmentMenuBot) GetSupportsSelfChat() (value bool) { - if a == nil { - return - } - return a.SupportsSelfChat -} - -// GetSupportsUserChats returns value of SupportsUserChats field. -func (a *AttachmentMenuBot) GetSupportsUserChats() (value bool) { - if a == nil { - return - } - return a.SupportsUserChats -} - -// GetSupportsBotChats returns value of SupportsBotChats field. -func (a *AttachmentMenuBot) GetSupportsBotChats() (value bool) { - if a == nil { - return - } - return a.SupportsBotChats -} - -// GetSupportsGroupChats returns value of SupportsGroupChats field. -func (a *AttachmentMenuBot) GetSupportsGroupChats() (value bool) { - if a == nil { - return - } - return a.SupportsGroupChats -} - -// GetSupportsChannelChats returns value of SupportsChannelChats field. -func (a *AttachmentMenuBot) GetSupportsChannelChats() (value bool) { - if a == nil { - return - } - return a.SupportsChannelChats -} - -// GetRequestWriteAccess returns value of RequestWriteAccess field. -func (a *AttachmentMenuBot) GetRequestWriteAccess() (value bool) { - if a == nil { - return - } - return a.RequestWriteAccess -} - -// GetIsAdded returns value of IsAdded field. -func (a *AttachmentMenuBot) GetIsAdded() (value bool) { - if a == nil { - return - } - return a.IsAdded -} - -// GetShowInAttachmentMenu returns value of ShowInAttachmentMenu field. -func (a *AttachmentMenuBot) GetShowInAttachmentMenu() (value bool) { - if a == nil { - return - } - return a.ShowInAttachmentMenu -} - -// GetShowInSideMenu returns value of ShowInSideMenu field. -func (a *AttachmentMenuBot) GetShowInSideMenu() (value bool) { - if a == nil { - return - } - return a.ShowInSideMenu -} - -// GetShowDisclaimerInSideMenu returns value of ShowDisclaimerInSideMenu field. -func (a *AttachmentMenuBot) GetShowDisclaimerInSideMenu() (value bool) { - if a == nil { - return - } - return a.ShowDisclaimerInSideMenu -} - -// GetName returns value of Name field. -func (a *AttachmentMenuBot) GetName() (value string) { - if a == nil { - return - } - return a.Name -} - -// GetNameColor returns value of NameColor field. -func (a *AttachmentMenuBot) GetNameColor() (value AttachmentMenuBotColor) { - if a == nil { - return - } - return a.NameColor -} - -// GetDefaultIcon returns value of DefaultIcon field. -func (a *AttachmentMenuBot) GetDefaultIcon() (value File) { - if a == nil { - return - } - return a.DefaultIcon -} - -// GetIosStaticIcon returns value of IosStaticIcon field. -func (a *AttachmentMenuBot) GetIosStaticIcon() (value File) { - if a == nil { - return - } - return a.IosStaticIcon -} - -// GetIosAnimatedIcon returns value of IosAnimatedIcon field. -func (a *AttachmentMenuBot) GetIosAnimatedIcon() (value File) { - if a == nil { - return - } - return a.IosAnimatedIcon -} - -// GetIosSideMenuIcon returns value of IosSideMenuIcon field. -func (a *AttachmentMenuBot) GetIosSideMenuIcon() (value File) { - if a == nil { - return - } - return a.IosSideMenuIcon -} - -// GetAndroidIcon returns value of AndroidIcon field. -func (a *AttachmentMenuBot) GetAndroidIcon() (value File) { - if a == nil { - return - } - return a.AndroidIcon -} - -// GetAndroidSideMenuIcon returns value of AndroidSideMenuIcon field. -func (a *AttachmentMenuBot) GetAndroidSideMenuIcon() (value File) { - if a == nil { - return - } - return a.AndroidSideMenuIcon -} - -// GetMacosIcon returns value of MacosIcon field. -func (a *AttachmentMenuBot) GetMacosIcon() (value File) { - if a == nil { - return - } - return a.MacosIcon -} - -// GetMacosSideMenuIcon returns value of MacosSideMenuIcon field. -func (a *AttachmentMenuBot) GetMacosSideMenuIcon() (value File) { - if a == nil { - return - } - return a.MacosSideMenuIcon -} - -// GetIconColor returns value of IconColor field. -func (a *AttachmentMenuBot) GetIconColor() (value AttachmentMenuBotColor) { - if a == nil { - return - } - return a.IconColor -} - -// GetWebAppPlaceholder returns value of WebAppPlaceholder field. -func (a *AttachmentMenuBot) GetWebAppPlaceholder() (value File) { - if a == nil { - return - } - return a.WebAppPlaceholder -} diff --git a/tdapi/tl_audio_gen.go b/tdapi/tl_audio_gen.go deleted file mode 100644 index 1ac06068e..000000000 --- a/tdapi/tl_audio_gen.go +++ /dev/null @@ -1,495 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Audio represents TL type `audio#a3769600`. -type Audio struct { - // Duration of the audio, in seconds; as defined by the sender - Duration int32 - // Title of the audio; as defined by the sender - Title string - // Performer of the audio; as defined by the sender - Performer string - // Original name of the file; as defined by the sender - FileName string - // The MIME type of the file; as defined by the sender - MimeType string - // The minithumbnail of the album cover; may be null - AlbumCoverMinithumbnail Minithumbnail - // The thumbnail of the album cover in JPEG format; as defined by the sender. The full - // size thumbnail is expected to be extracted from the downloaded audio file; may be null - AlbumCoverThumbnail Thumbnail - // Album cover variants to use if the downloaded audio file contains no album cover. - // Provided thumbnail dimensions are approximate - ExternalAlbumCovers []Thumbnail - // File containing the audio - Audio File -} - -// AudioTypeID is TL type id of Audio. -const AudioTypeID = 0xa3769600 - -// Ensuring interfaces in compile-time for Audio. -var ( - _ bin.Encoder = &Audio{} - _ bin.Decoder = &Audio{} - _ bin.BareEncoder = &Audio{} - _ bin.BareDecoder = &Audio{} -) - -func (a *Audio) Zero() bool { - if a == nil { - return true - } - if !(a.Duration == 0) { - return false - } - if !(a.Title == "") { - return false - } - if !(a.Performer == "") { - return false - } - if !(a.FileName == "") { - return false - } - if !(a.MimeType == "") { - return false - } - if !(a.AlbumCoverMinithumbnail.Zero()) { - return false - } - if !(a.AlbumCoverThumbnail.Zero()) { - return false - } - if !(a.ExternalAlbumCovers == nil) { - return false - } - if !(a.Audio.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *Audio) String() string { - if a == nil { - return "Audio(nil)" - } - type Alias Audio - return fmt.Sprintf("Audio%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Audio) TypeID() uint32 { - return AudioTypeID -} - -// TypeName returns name of type in TL schema. -func (*Audio) TypeName() string { - return "audio" -} - -// TypeInfo returns info about TL type. -func (a *Audio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "audio", - ID: AudioTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Performer", - SchemaName: "performer", - }, - { - Name: "FileName", - SchemaName: "file_name", - }, - { - Name: "MimeType", - SchemaName: "mime_type", - }, - { - Name: "AlbumCoverMinithumbnail", - SchemaName: "album_cover_minithumbnail", - }, - { - Name: "AlbumCoverThumbnail", - SchemaName: "album_cover_thumbnail", - }, - { - Name: "ExternalAlbumCovers", - SchemaName: "external_album_covers", - }, - { - Name: "Audio", - SchemaName: "audio", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *Audio) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode audio#a3769600 as nil") - } - b.PutID(AudioTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *Audio) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode audio#a3769600 as nil") - } - b.PutInt32(a.Duration) - b.PutString(a.Title) - b.PutString(a.Performer) - b.PutString(a.FileName) - b.PutString(a.MimeType) - if err := a.AlbumCoverMinithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode audio#a3769600: field album_cover_minithumbnail: %w", err) - } - if err := a.AlbumCoverThumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode audio#a3769600: field album_cover_thumbnail: %w", err) - } - b.PutInt(len(a.ExternalAlbumCovers)) - for idx, v := range a.ExternalAlbumCovers { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare audio#a3769600: field external_album_covers element with index %d: %w", idx, err) - } - } - if err := a.Audio.Encode(b); err != nil { - return fmt.Errorf("unable to encode audio#a3769600: field audio: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *Audio) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode audio#a3769600 to nil") - } - if err := b.ConsumeID(AudioTypeID); err != nil { - return fmt.Errorf("unable to decode audio#a3769600: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *Audio) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode audio#a3769600 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field duration: %w", err) - } - a.Duration = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field title: %w", err) - } - a.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field performer: %w", err) - } - a.Performer = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field file_name: %w", err) - } - a.FileName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field mime_type: %w", err) - } - a.MimeType = value - } - { - if err := a.AlbumCoverMinithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field album_cover_minithumbnail: %w", err) - } - } - { - if err := a.AlbumCoverThumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field album_cover_thumbnail: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field external_album_covers: %w", err) - } - - if headerLen > 0 { - a.ExternalAlbumCovers = make([]Thumbnail, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Thumbnail - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare audio#a3769600: field external_album_covers: %w", err) - } - a.ExternalAlbumCovers = append(a.ExternalAlbumCovers, value) - } - } - { - if err := a.Audio.Decode(b); err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field audio: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *Audio) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode audio#a3769600 as nil") - } - b.ObjStart() - b.PutID("audio") - b.Comma() - b.FieldStart("duration") - b.PutInt32(a.Duration) - b.Comma() - b.FieldStart("title") - b.PutString(a.Title) - b.Comma() - b.FieldStart("performer") - b.PutString(a.Performer) - b.Comma() - b.FieldStart("file_name") - b.PutString(a.FileName) - b.Comma() - b.FieldStart("mime_type") - b.PutString(a.MimeType) - b.Comma() - b.FieldStart("album_cover_minithumbnail") - if err := a.AlbumCoverMinithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode audio#a3769600: field album_cover_minithumbnail: %w", err) - } - b.Comma() - b.FieldStart("album_cover_thumbnail") - if err := a.AlbumCoverThumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode audio#a3769600: field album_cover_thumbnail: %w", err) - } - b.Comma() - b.FieldStart("external_album_covers") - b.ArrStart() - for idx, v := range a.ExternalAlbumCovers { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode audio#a3769600: field external_album_covers element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("audio") - if err := a.Audio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode audio#a3769600: field audio: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *Audio) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode audio#a3769600 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("audio"); err != nil { - return fmt.Errorf("unable to decode audio#a3769600: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field duration: %w", err) - } - a.Duration = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field title: %w", err) - } - a.Title = value - case "performer": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field performer: %w", err) - } - a.Performer = value - case "file_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field file_name: %w", err) - } - a.FileName = value - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field mime_type: %w", err) - } - a.MimeType = value - case "album_cover_minithumbnail": - if err := a.AlbumCoverMinithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field album_cover_minithumbnail: %w", err) - } - case "album_cover_thumbnail": - if err := a.AlbumCoverThumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field album_cover_thumbnail: %w", err) - } - case "external_album_covers": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Thumbnail - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field external_album_covers: %w", err) - } - a.ExternalAlbumCovers = append(a.ExternalAlbumCovers, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field external_album_covers: %w", err) - } - case "audio": - if err := a.Audio.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode audio#a3769600: field audio: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDuration returns value of Duration field. -func (a *Audio) GetDuration() (value int32) { - if a == nil { - return - } - return a.Duration -} - -// GetTitle returns value of Title field. -func (a *Audio) GetTitle() (value string) { - if a == nil { - return - } - return a.Title -} - -// GetPerformer returns value of Performer field. -func (a *Audio) GetPerformer() (value string) { - if a == nil { - return - } - return a.Performer -} - -// GetFileName returns value of FileName field. -func (a *Audio) GetFileName() (value string) { - if a == nil { - return - } - return a.FileName -} - -// GetMimeType returns value of MimeType field. -func (a *Audio) GetMimeType() (value string) { - if a == nil { - return - } - return a.MimeType -} - -// GetAlbumCoverMinithumbnail returns value of AlbumCoverMinithumbnail field. -func (a *Audio) GetAlbumCoverMinithumbnail() (value Minithumbnail) { - if a == nil { - return - } - return a.AlbumCoverMinithumbnail -} - -// GetAlbumCoverThumbnail returns value of AlbumCoverThumbnail field. -func (a *Audio) GetAlbumCoverThumbnail() (value Thumbnail) { - if a == nil { - return - } - return a.AlbumCoverThumbnail -} - -// GetExternalAlbumCovers returns value of ExternalAlbumCovers field. -func (a *Audio) GetExternalAlbumCovers() (value []Thumbnail) { - if a == nil { - return - } - return a.ExternalAlbumCovers -} - -// GetAudio returns value of Audio field. -func (a *Audio) GetAudio() (value File) { - if a == nil { - return - } - return a.Audio -} diff --git a/tdapi/tl_authentication_code_info_gen.go b/tdapi/tl_authentication_code_info_gen.go deleted file mode 100644 index 8c96a34dc..000000000 --- a/tdapi/tl_authentication_code_info_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AuthenticationCodeInfo represents TL type `authenticationCodeInfo#ccb82bb8`. -type AuthenticationCodeInfo struct { - // A phone number that is being authenticated - PhoneNumber string - // The way the code was sent to the user - Type AuthenticationCodeTypeClass - // The way the next code will be sent to the user; may be null - NextType AuthenticationCodeTypeClass - // Timeout before the code can be re-sent, in seconds - Timeout int32 -} - -// AuthenticationCodeInfoTypeID is TL type id of AuthenticationCodeInfo. -const AuthenticationCodeInfoTypeID = 0xccb82bb8 - -// Ensuring interfaces in compile-time for AuthenticationCodeInfo. -var ( - _ bin.Encoder = &AuthenticationCodeInfo{} - _ bin.Decoder = &AuthenticationCodeInfo{} - _ bin.BareEncoder = &AuthenticationCodeInfo{} - _ bin.BareDecoder = &AuthenticationCodeInfo{} -) - -func (a *AuthenticationCodeInfo) Zero() bool { - if a == nil { - return true - } - if !(a.PhoneNumber == "") { - return false - } - if !(a.Type == nil) { - return false - } - if !(a.NextType == nil) { - return false - } - if !(a.Timeout == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthenticationCodeInfo) String() string { - if a == nil { - return "AuthenticationCodeInfo(nil)" - } - type Alias AuthenticationCodeInfo - return fmt.Sprintf("AuthenticationCodeInfo%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthenticationCodeInfo) TypeID() uint32 { - return AuthenticationCodeInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthenticationCodeInfo) TypeName() string { - return "authenticationCodeInfo" -} - -// TypeInfo returns info about TL type. -func (a *AuthenticationCodeInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authenticationCodeInfo", - ID: AuthenticationCodeInfoTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "NextType", - SchemaName: "next_type", - }, - { - Name: "Timeout", - SchemaName: "timeout", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthenticationCodeInfo) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeInfo#ccb82bb8 as nil") - } - b.PutID(AuthenticationCodeInfoTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthenticationCodeInfo) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeInfo#ccb82bb8 as nil") - } - b.PutString(a.PhoneNumber) - if a.Type == nil { - return fmt.Errorf("unable to encode authenticationCodeInfo#ccb82bb8: field type is nil") - } - if err := a.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode authenticationCodeInfo#ccb82bb8: field type: %w", err) - } - if a.NextType == nil { - return fmt.Errorf("unable to encode authenticationCodeInfo#ccb82bb8: field next_type is nil") - } - if err := a.NextType.Encode(b); err != nil { - return fmt.Errorf("unable to encode authenticationCodeInfo#ccb82bb8: field next_type: %w", err) - } - b.PutInt32(a.Timeout) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthenticationCodeInfo) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeInfo#ccb82bb8 to nil") - } - if err := b.ConsumeID(AuthenticationCodeInfoTypeID); err != nil { - return fmt.Errorf("unable to decode authenticationCodeInfo#ccb82bb8: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthenticationCodeInfo) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeInfo#ccb82bb8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeInfo#ccb82bb8: field phone_number: %w", err) - } - a.PhoneNumber = value - } - { - value, err := DecodeAuthenticationCodeType(b) - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeInfo#ccb82bb8: field type: %w", err) - } - a.Type = value - } - { - value, err := DecodeAuthenticationCodeType(b) - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeInfo#ccb82bb8: field next_type: %w", err) - } - a.NextType = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeInfo#ccb82bb8: field timeout: %w", err) - } - a.Timeout = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthenticationCodeInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeInfo#ccb82bb8 as nil") - } - b.ObjStart() - b.PutID("authenticationCodeInfo") - b.Comma() - b.FieldStart("phone_number") - b.PutString(a.PhoneNumber) - b.Comma() - b.FieldStart("type") - if a.Type == nil { - return fmt.Errorf("unable to encode authenticationCodeInfo#ccb82bb8: field type is nil") - } - if err := a.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode authenticationCodeInfo#ccb82bb8: field type: %w", err) - } - b.Comma() - b.FieldStart("next_type") - if a.NextType == nil { - return fmt.Errorf("unable to encode authenticationCodeInfo#ccb82bb8: field next_type is nil") - } - if err := a.NextType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode authenticationCodeInfo#ccb82bb8: field next_type: %w", err) - } - b.Comma() - b.FieldStart("timeout") - b.PutInt32(a.Timeout) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthenticationCodeInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeInfo#ccb82bb8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authenticationCodeInfo"); err != nil { - return fmt.Errorf("unable to decode authenticationCodeInfo#ccb82bb8: %w", err) - } - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeInfo#ccb82bb8: field phone_number: %w", err) - } - a.PhoneNumber = value - case "type": - value, err := DecodeTDLibJSONAuthenticationCodeType(b) - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeInfo#ccb82bb8: field type: %w", err) - } - a.Type = value - case "next_type": - value, err := DecodeTDLibJSONAuthenticationCodeType(b) - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeInfo#ccb82bb8: field next_type: %w", err) - } - a.NextType = value - case "timeout": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeInfo#ccb82bb8: field timeout: %w", err) - } - a.Timeout = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (a *AuthenticationCodeInfo) GetPhoneNumber() (value string) { - if a == nil { - return - } - return a.PhoneNumber -} - -// GetType returns value of Type field. -func (a *AuthenticationCodeInfo) GetType() (value AuthenticationCodeTypeClass) { - if a == nil { - return - } - return a.Type -} - -// GetNextType returns value of NextType field. -func (a *AuthenticationCodeInfo) GetNextType() (value AuthenticationCodeTypeClass) { - if a == nil { - return - } - return a.NextType -} - -// GetTimeout returns value of Timeout field. -func (a *AuthenticationCodeInfo) GetTimeout() (value int32) { - if a == nil { - return - } - return a.Timeout -} diff --git a/tdapi/tl_authentication_code_type_gen.go b/tdapi/tl_authentication_code_type_gen.go deleted file mode 100644 index df37c7e03..000000000 --- a/tdapi/tl_authentication_code_type_gen.go +++ /dev/null @@ -1,2131 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AuthenticationCodeTypeTelegramMessage represents TL type `authenticationCodeTypeTelegramMessage#7bf49b2a`. -type AuthenticationCodeTypeTelegramMessage struct { - // Length of the code - Length int32 -} - -// AuthenticationCodeTypeTelegramMessageTypeID is TL type id of AuthenticationCodeTypeTelegramMessage. -const AuthenticationCodeTypeTelegramMessageTypeID = 0x7bf49b2a - -// construct implements constructor of AuthenticationCodeTypeClass. -func (a AuthenticationCodeTypeTelegramMessage) construct() AuthenticationCodeTypeClass { return &a } - -// Ensuring interfaces in compile-time for AuthenticationCodeTypeTelegramMessage. -var ( - _ bin.Encoder = &AuthenticationCodeTypeTelegramMessage{} - _ bin.Decoder = &AuthenticationCodeTypeTelegramMessage{} - _ bin.BareEncoder = &AuthenticationCodeTypeTelegramMessage{} - _ bin.BareDecoder = &AuthenticationCodeTypeTelegramMessage{} - - _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeTelegramMessage{} -) - -func (a *AuthenticationCodeTypeTelegramMessage) Zero() bool { - if a == nil { - return true - } - if !(a.Length == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthenticationCodeTypeTelegramMessage) String() string { - if a == nil { - return "AuthenticationCodeTypeTelegramMessage(nil)" - } - type Alias AuthenticationCodeTypeTelegramMessage - return fmt.Sprintf("AuthenticationCodeTypeTelegramMessage%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthenticationCodeTypeTelegramMessage) TypeID() uint32 { - return AuthenticationCodeTypeTelegramMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthenticationCodeTypeTelegramMessage) TypeName() string { - return "authenticationCodeTypeTelegramMessage" -} - -// TypeInfo returns info about TL type. -func (a *AuthenticationCodeTypeTelegramMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authenticationCodeTypeTelegramMessage", - ID: AuthenticationCodeTypeTelegramMessageTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Length", - SchemaName: "length", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthenticationCodeTypeTelegramMessage) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeTelegramMessage#7bf49b2a as nil") - } - b.PutID(AuthenticationCodeTypeTelegramMessageTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthenticationCodeTypeTelegramMessage) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeTelegramMessage#7bf49b2a as nil") - } - b.PutInt32(a.Length) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthenticationCodeTypeTelegramMessage) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeTelegramMessage#7bf49b2a to nil") - } - if err := b.ConsumeID(AuthenticationCodeTypeTelegramMessageTypeID); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeTelegramMessage#7bf49b2a: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthenticationCodeTypeTelegramMessage) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeTelegramMessage#7bf49b2a to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeTelegramMessage#7bf49b2a: field length: %w", err) - } - a.Length = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthenticationCodeTypeTelegramMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeTelegramMessage#7bf49b2a as nil") - } - b.ObjStart() - b.PutID("authenticationCodeTypeTelegramMessage") - b.Comma() - b.FieldStart("length") - b.PutInt32(a.Length) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthenticationCodeTypeTelegramMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeTelegramMessage#7bf49b2a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authenticationCodeTypeTelegramMessage"); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeTelegramMessage#7bf49b2a: %w", err) - } - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeTelegramMessage#7bf49b2a: field length: %w", err) - } - a.Length = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLength returns value of Length field. -func (a *AuthenticationCodeTypeTelegramMessage) GetLength() (value int32) { - if a == nil { - return - } - return a.Length -} - -// AuthenticationCodeTypeSMS represents TL type `authenticationCodeTypeSms#3960e288`. -type AuthenticationCodeTypeSMS struct { - // Length of the code - Length int32 -} - -// AuthenticationCodeTypeSMSTypeID is TL type id of AuthenticationCodeTypeSMS. -const AuthenticationCodeTypeSMSTypeID = 0x3960e288 - -// construct implements constructor of AuthenticationCodeTypeClass. -func (a AuthenticationCodeTypeSMS) construct() AuthenticationCodeTypeClass { return &a } - -// Ensuring interfaces in compile-time for AuthenticationCodeTypeSMS. -var ( - _ bin.Encoder = &AuthenticationCodeTypeSMS{} - _ bin.Decoder = &AuthenticationCodeTypeSMS{} - _ bin.BareEncoder = &AuthenticationCodeTypeSMS{} - _ bin.BareDecoder = &AuthenticationCodeTypeSMS{} - - _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeSMS{} -) - -func (a *AuthenticationCodeTypeSMS) Zero() bool { - if a == nil { - return true - } - if !(a.Length == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthenticationCodeTypeSMS) String() string { - if a == nil { - return "AuthenticationCodeTypeSMS(nil)" - } - type Alias AuthenticationCodeTypeSMS - return fmt.Sprintf("AuthenticationCodeTypeSMS%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthenticationCodeTypeSMS) TypeID() uint32 { - return AuthenticationCodeTypeSMSTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthenticationCodeTypeSMS) TypeName() string { - return "authenticationCodeTypeSms" -} - -// TypeInfo returns info about TL type. -func (a *AuthenticationCodeTypeSMS) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authenticationCodeTypeSms", - ID: AuthenticationCodeTypeSMSTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Length", - SchemaName: "length", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthenticationCodeTypeSMS) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeSms#3960e288 as nil") - } - b.PutID(AuthenticationCodeTypeSMSTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthenticationCodeTypeSMS) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeSms#3960e288 as nil") - } - b.PutInt32(a.Length) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthenticationCodeTypeSMS) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeSms#3960e288 to nil") - } - if err := b.ConsumeID(AuthenticationCodeTypeSMSTypeID); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSms#3960e288: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthenticationCodeTypeSMS) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeSms#3960e288 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSms#3960e288: field length: %w", err) - } - a.Length = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthenticationCodeTypeSMS) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeSms#3960e288 as nil") - } - b.ObjStart() - b.PutID("authenticationCodeTypeSms") - b.Comma() - b.FieldStart("length") - b.PutInt32(a.Length) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthenticationCodeTypeSMS) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeSms#3960e288 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authenticationCodeTypeSms"); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSms#3960e288: %w", err) - } - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSms#3960e288: field length: %w", err) - } - a.Length = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLength returns value of Length field. -func (a *AuthenticationCodeTypeSMS) GetLength() (value int32) { - if a == nil { - return - } - return a.Length -} - -// AuthenticationCodeTypeSMSWord represents TL type `authenticationCodeTypeSmsWord#a6063c63`. -type AuthenticationCodeTypeSMSWord struct { - // The first letters of the word if known - FirstLetter string -} - -// AuthenticationCodeTypeSMSWordTypeID is TL type id of AuthenticationCodeTypeSMSWord. -const AuthenticationCodeTypeSMSWordTypeID = 0xa6063c63 - -// construct implements constructor of AuthenticationCodeTypeClass. -func (a AuthenticationCodeTypeSMSWord) construct() AuthenticationCodeTypeClass { return &a } - -// Ensuring interfaces in compile-time for AuthenticationCodeTypeSMSWord. -var ( - _ bin.Encoder = &AuthenticationCodeTypeSMSWord{} - _ bin.Decoder = &AuthenticationCodeTypeSMSWord{} - _ bin.BareEncoder = &AuthenticationCodeTypeSMSWord{} - _ bin.BareDecoder = &AuthenticationCodeTypeSMSWord{} - - _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeSMSWord{} -) - -func (a *AuthenticationCodeTypeSMSWord) Zero() bool { - if a == nil { - return true - } - if !(a.FirstLetter == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthenticationCodeTypeSMSWord) String() string { - if a == nil { - return "AuthenticationCodeTypeSMSWord(nil)" - } - type Alias AuthenticationCodeTypeSMSWord - return fmt.Sprintf("AuthenticationCodeTypeSMSWord%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthenticationCodeTypeSMSWord) TypeID() uint32 { - return AuthenticationCodeTypeSMSWordTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthenticationCodeTypeSMSWord) TypeName() string { - return "authenticationCodeTypeSmsWord" -} - -// TypeInfo returns info about TL type. -func (a *AuthenticationCodeTypeSMSWord) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authenticationCodeTypeSmsWord", - ID: AuthenticationCodeTypeSMSWordTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FirstLetter", - SchemaName: "first_letter", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthenticationCodeTypeSMSWord) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeSmsWord#a6063c63 as nil") - } - b.PutID(AuthenticationCodeTypeSMSWordTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthenticationCodeTypeSMSWord) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeSmsWord#a6063c63 as nil") - } - b.PutString(a.FirstLetter) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthenticationCodeTypeSMSWord) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeSmsWord#a6063c63 to nil") - } - if err := b.ConsumeID(AuthenticationCodeTypeSMSWordTypeID); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSmsWord#a6063c63: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthenticationCodeTypeSMSWord) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeSmsWord#a6063c63 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSmsWord#a6063c63: field first_letter: %w", err) - } - a.FirstLetter = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthenticationCodeTypeSMSWord) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeSmsWord#a6063c63 as nil") - } - b.ObjStart() - b.PutID("authenticationCodeTypeSmsWord") - b.Comma() - b.FieldStart("first_letter") - b.PutString(a.FirstLetter) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthenticationCodeTypeSMSWord) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeSmsWord#a6063c63 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authenticationCodeTypeSmsWord"); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSmsWord#a6063c63: %w", err) - } - case "first_letter": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSmsWord#a6063c63: field first_letter: %w", err) - } - a.FirstLetter = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFirstLetter returns value of FirstLetter field. -func (a *AuthenticationCodeTypeSMSWord) GetFirstLetter() (value string) { - if a == nil { - return - } - return a.FirstLetter -} - -// AuthenticationCodeTypeSMSPhrase represents TL type `authenticationCodeTypeSmsPhrase#2ebc8cd1`. -type AuthenticationCodeTypeSMSPhrase struct { - // The first word of the phrase if known - FirstWord string -} - -// AuthenticationCodeTypeSMSPhraseTypeID is TL type id of AuthenticationCodeTypeSMSPhrase. -const AuthenticationCodeTypeSMSPhraseTypeID = 0x2ebc8cd1 - -// construct implements constructor of AuthenticationCodeTypeClass. -func (a AuthenticationCodeTypeSMSPhrase) construct() AuthenticationCodeTypeClass { return &a } - -// Ensuring interfaces in compile-time for AuthenticationCodeTypeSMSPhrase. -var ( - _ bin.Encoder = &AuthenticationCodeTypeSMSPhrase{} - _ bin.Decoder = &AuthenticationCodeTypeSMSPhrase{} - _ bin.BareEncoder = &AuthenticationCodeTypeSMSPhrase{} - _ bin.BareDecoder = &AuthenticationCodeTypeSMSPhrase{} - - _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeSMSPhrase{} -) - -func (a *AuthenticationCodeTypeSMSPhrase) Zero() bool { - if a == nil { - return true - } - if !(a.FirstWord == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthenticationCodeTypeSMSPhrase) String() string { - if a == nil { - return "AuthenticationCodeTypeSMSPhrase(nil)" - } - type Alias AuthenticationCodeTypeSMSPhrase - return fmt.Sprintf("AuthenticationCodeTypeSMSPhrase%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthenticationCodeTypeSMSPhrase) TypeID() uint32 { - return AuthenticationCodeTypeSMSPhraseTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthenticationCodeTypeSMSPhrase) TypeName() string { - return "authenticationCodeTypeSmsPhrase" -} - -// TypeInfo returns info about TL type. -func (a *AuthenticationCodeTypeSMSPhrase) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authenticationCodeTypeSmsPhrase", - ID: AuthenticationCodeTypeSMSPhraseTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FirstWord", - SchemaName: "first_word", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthenticationCodeTypeSMSPhrase) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeSmsPhrase#2ebc8cd1 as nil") - } - b.PutID(AuthenticationCodeTypeSMSPhraseTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthenticationCodeTypeSMSPhrase) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeSmsPhrase#2ebc8cd1 as nil") - } - b.PutString(a.FirstWord) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthenticationCodeTypeSMSPhrase) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeSmsPhrase#2ebc8cd1 to nil") - } - if err := b.ConsumeID(AuthenticationCodeTypeSMSPhraseTypeID); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSmsPhrase#2ebc8cd1: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthenticationCodeTypeSMSPhrase) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeSmsPhrase#2ebc8cd1 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSmsPhrase#2ebc8cd1: field first_word: %w", err) - } - a.FirstWord = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthenticationCodeTypeSMSPhrase) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeSmsPhrase#2ebc8cd1 as nil") - } - b.ObjStart() - b.PutID("authenticationCodeTypeSmsPhrase") - b.Comma() - b.FieldStart("first_word") - b.PutString(a.FirstWord) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthenticationCodeTypeSMSPhrase) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeSmsPhrase#2ebc8cd1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authenticationCodeTypeSmsPhrase"); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSmsPhrase#2ebc8cd1: %w", err) - } - case "first_word": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeSmsPhrase#2ebc8cd1: field first_word: %w", err) - } - a.FirstWord = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFirstWord returns value of FirstWord field. -func (a *AuthenticationCodeTypeSMSPhrase) GetFirstWord() (value string) { - if a == nil { - return - } - return a.FirstWord -} - -// AuthenticationCodeTypeCall represents TL type `authenticationCodeTypeCall#61876c67`. -type AuthenticationCodeTypeCall struct { - // Length of the code - Length int32 -} - -// AuthenticationCodeTypeCallTypeID is TL type id of AuthenticationCodeTypeCall. -const AuthenticationCodeTypeCallTypeID = 0x61876c67 - -// construct implements constructor of AuthenticationCodeTypeClass. -func (a AuthenticationCodeTypeCall) construct() AuthenticationCodeTypeClass { return &a } - -// Ensuring interfaces in compile-time for AuthenticationCodeTypeCall. -var ( - _ bin.Encoder = &AuthenticationCodeTypeCall{} - _ bin.Decoder = &AuthenticationCodeTypeCall{} - _ bin.BareEncoder = &AuthenticationCodeTypeCall{} - _ bin.BareDecoder = &AuthenticationCodeTypeCall{} - - _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeCall{} -) - -func (a *AuthenticationCodeTypeCall) Zero() bool { - if a == nil { - return true - } - if !(a.Length == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthenticationCodeTypeCall) String() string { - if a == nil { - return "AuthenticationCodeTypeCall(nil)" - } - type Alias AuthenticationCodeTypeCall - return fmt.Sprintf("AuthenticationCodeTypeCall%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthenticationCodeTypeCall) TypeID() uint32 { - return AuthenticationCodeTypeCallTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthenticationCodeTypeCall) TypeName() string { - return "authenticationCodeTypeCall" -} - -// TypeInfo returns info about TL type. -func (a *AuthenticationCodeTypeCall) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authenticationCodeTypeCall", - ID: AuthenticationCodeTypeCallTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Length", - SchemaName: "length", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthenticationCodeTypeCall) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeCall#61876c67 as nil") - } - b.PutID(AuthenticationCodeTypeCallTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthenticationCodeTypeCall) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeCall#61876c67 as nil") - } - b.PutInt32(a.Length) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthenticationCodeTypeCall) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeCall#61876c67 to nil") - } - if err := b.ConsumeID(AuthenticationCodeTypeCallTypeID); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeCall#61876c67: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthenticationCodeTypeCall) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeCall#61876c67 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeCall#61876c67: field length: %w", err) - } - a.Length = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthenticationCodeTypeCall) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeCall#61876c67 as nil") - } - b.ObjStart() - b.PutID("authenticationCodeTypeCall") - b.Comma() - b.FieldStart("length") - b.PutInt32(a.Length) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthenticationCodeTypeCall) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeCall#61876c67 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authenticationCodeTypeCall"); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeCall#61876c67: %w", err) - } - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeCall#61876c67: field length: %w", err) - } - a.Length = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLength returns value of Length field. -func (a *AuthenticationCodeTypeCall) GetLength() (value int32) { - if a == nil { - return - } - return a.Length -} - -// AuthenticationCodeTypeFlashCall represents TL type `authenticationCodeTypeFlashCall#533379a2`. -type AuthenticationCodeTypeFlashCall struct { - // Pattern of the phone number from which the call will be made - Pattern string -} - -// AuthenticationCodeTypeFlashCallTypeID is TL type id of AuthenticationCodeTypeFlashCall. -const AuthenticationCodeTypeFlashCallTypeID = 0x533379a2 - -// construct implements constructor of AuthenticationCodeTypeClass. -func (a AuthenticationCodeTypeFlashCall) construct() AuthenticationCodeTypeClass { return &a } - -// Ensuring interfaces in compile-time for AuthenticationCodeTypeFlashCall. -var ( - _ bin.Encoder = &AuthenticationCodeTypeFlashCall{} - _ bin.Decoder = &AuthenticationCodeTypeFlashCall{} - _ bin.BareEncoder = &AuthenticationCodeTypeFlashCall{} - _ bin.BareDecoder = &AuthenticationCodeTypeFlashCall{} - - _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeFlashCall{} -) - -func (a *AuthenticationCodeTypeFlashCall) Zero() bool { - if a == nil { - return true - } - if !(a.Pattern == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthenticationCodeTypeFlashCall) String() string { - if a == nil { - return "AuthenticationCodeTypeFlashCall(nil)" - } - type Alias AuthenticationCodeTypeFlashCall - return fmt.Sprintf("AuthenticationCodeTypeFlashCall%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthenticationCodeTypeFlashCall) TypeID() uint32 { - return AuthenticationCodeTypeFlashCallTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthenticationCodeTypeFlashCall) TypeName() string { - return "authenticationCodeTypeFlashCall" -} - -// TypeInfo returns info about TL type. -func (a *AuthenticationCodeTypeFlashCall) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authenticationCodeTypeFlashCall", - ID: AuthenticationCodeTypeFlashCallTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Pattern", - SchemaName: "pattern", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthenticationCodeTypeFlashCall) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFlashCall#533379a2 as nil") - } - b.PutID(AuthenticationCodeTypeFlashCallTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthenticationCodeTypeFlashCall) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFlashCall#533379a2 as nil") - } - b.PutString(a.Pattern) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthenticationCodeTypeFlashCall) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFlashCall#533379a2 to nil") - } - if err := b.ConsumeID(AuthenticationCodeTypeFlashCallTypeID); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFlashCall#533379a2: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthenticationCodeTypeFlashCall) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFlashCall#533379a2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFlashCall#533379a2: field pattern: %w", err) - } - a.Pattern = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthenticationCodeTypeFlashCall) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFlashCall#533379a2 as nil") - } - b.ObjStart() - b.PutID("authenticationCodeTypeFlashCall") - b.Comma() - b.FieldStart("pattern") - b.PutString(a.Pattern) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthenticationCodeTypeFlashCall) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFlashCall#533379a2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authenticationCodeTypeFlashCall"); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFlashCall#533379a2: %w", err) - } - case "pattern": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFlashCall#533379a2: field pattern: %w", err) - } - a.Pattern = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPattern returns value of Pattern field. -func (a *AuthenticationCodeTypeFlashCall) GetPattern() (value string) { - if a == nil { - return - } - return a.Pattern -} - -// AuthenticationCodeTypeMissedCall represents TL type `authenticationCodeTypeMissedCall#29bb0a87`. -type AuthenticationCodeTypeMissedCall struct { - // Prefix of the phone number from which the call will be made - PhoneNumberPrefix string - // Number of digits in the code, excluding the prefix - Length int32 -} - -// AuthenticationCodeTypeMissedCallTypeID is TL type id of AuthenticationCodeTypeMissedCall. -const AuthenticationCodeTypeMissedCallTypeID = 0x29bb0a87 - -// construct implements constructor of AuthenticationCodeTypeClass. -func (a AuthenticationCodeTypeMissedCall) construct() AuthenticationCodeTypeClass { return &a } - -// Ensuring interfaces in compile-time for AuthenticationCodeTypeMissedCall. -var ( - _ bin.Encoder = &AuthenticationCodeTypeMissedCall{} - _ bin.Decoder = &AuthenticationCodeTypeMissedCall{} - _ bin.BareEncoder = &AuthenticationCodeTypeMissedCall{} - _ bin.BareDecoder = &AuthenticationCodeTypeMissedCall{} - - _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeMissedCall{} -) - -func (a *AuthenticationCodeTypeMissedCall) Zero() bool { - if a == nil { - return true - } - if !(a.PhoneNumberPrefix == "") { - return false - } - if !(a.Length == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthenticationCodeTypeMissedCall) String() string { - if a == nil { - return "AuthenticationCodeTypeMissedCall(nil)" - } - type Alias AuthenticationCodeTypeMissedCall - return fmt.Sprintf("AuthenticationCodeTypeMissedCall%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthenticationCodeTypeMissedCall) TypeID() uint32 { - return AuthenticationCodeTypeMissedCallTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthenticationCodeTypeMissedCall) TypeName() string { - return "authenticationCodeTypeMissedCall" -} - -// TypeInfo returns info about TL type. -func (a *AuthenticationCodeTypeMissedCall) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authenticationCodeTypeMissedCall", - ID: AuthenticationCodeTypeMissedCallTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PhoneNumberPrefix", - SchemaName: "phone_number_prefix", - }, - { - Name: "Length", - SchemaName: "length", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthenticationCodeTypeMissedCall) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeMissedCall#29bb0a87 as nil") - } - b.PutID(AuthenticationCodeTypeMissedCallTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthenticationCodeTypeMissedCall) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeMissedCall#29bb0a87 as nil") - } - b.PutString(a.PhoneNumberPrefix) - b.PutInt32(a.Length) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthenticationCodeTypeMissedCall) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeMissedCall#29bb0a87 to nil") - } - if err := b.ConsumeID(AuthenticationCodeTypeMissedCallTypeID); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeMissedCall#29bb0a87: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthenticationCodeTypeMissedCall) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeMissedCall#29bb0a87 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeMissedCall#29bb0a87: field phone_number_prefix: %w", err) - } - a.PhoneNumberPrefix = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeMissedCall#29bb0a87: field length: %w", err) - } - a.Length = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthenticationCodeTypeMissedCall) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeMissedCall#29bb0a87 as nil") - } - b.ObjStart() - b.PutID("authenticationCodeTypeMissedCall") - b.Comma() - b.FieldStart("phone_number_prefix") - b.PutString(a.PhoneNumberPrefix) - b.Comma() - b.FieldStart("length") - b.PutInt32(a.Length) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthenticationCodeTypeMissedCall) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeMissedCall#29bb0a87 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authenticationCodeTypeMissedCall"); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeMissedCall#29bb0a87: %w", err) - } - case "phone_number_prefix": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeMissedCall#29bb0a87: field phone_number_prefix: %w", err) - } - a.PhoneNumberPrefix = value - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeMissedCall#29bb0a87: field length: %w", err) - } - a.Length = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoneNumberPrefix returns value of PhoneNumberPrefix field. -func (a *AuthenticationCodeTypeMissedCall) GetPhoneNumberPrefix() (value string) { - if a == nil { - return - } - return a.PhoneNumberPrefix -} - -// GetLength returns value of Length field. -func (a *AuthenticationCodeTypeMissedCall) GetLength() (value int32) { - if a == nil { - return - } - return a.Length -} - -// AuthenticationCodeTypeFragment represents TL type `authenticationCodeTypeFragment#810f74cd`. -type AuthenticationCodeTypeFragment struct { - // URL to open to receive the code - URL string - // Length of the code - Length int32 -} - -// AuthenticationCodeTypeFragmentTypeID is TL type id of AuthenticationCodeTypeFragment. -const AuthenticationCodeTypeFragmentTypeID = 0x810f74cd - -// construct implements constructor of AuthenticationCodeTypeClass. -func (a AuthenticationCodeTypeFragment) construct() AuthenticationCodeTypeClass { return &a } - -// Ensuring interfaces in compile-time for AuthenticationCodeTypeFragment. -var ( - _ bin.Encoder = &AuthenticationCodeTypeFragment{} - _ bin.Decoder = &AuthenticationCodeTypeFragment{} - _ bin.BareEncoder = &AuthenticationCodeTypeFragment{} - _ bin.BareDecoder = &AuthenticationCodeTypeFragment{} - - _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeFragment{} -) - -func (a *AuthenticationCodeTypeFragment) Zero() bool { - if a == nil { - return true - } - if !(a.URL == "") { - return false - } - if !(a.Length == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthenticationCodeTypeFragment) String() string { - if a == nil { - return "AuthenticationCodeTypeFragment(nil)" - } - type Alias AuthenticationCodeTypeFragment - return fmt.Sprintf("AuthenticationCodeTypeFragment%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthenticationCodeTypeFragment) TypeID() uint32 { - return AuthenticationCodeTypeFragmentTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthenticationCodeTypeFragment) TypeName() string { - return "authenticationCodeTypeFragment" -} - -// TypeInfo returns info about TL type. -func (a *AuthenticationCodeTypeFragment) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authenticationCodeTypeFragment", - ID: AuthenticationCodeTypeFragmentTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Length", - SchemaName: "length", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthenticationCodeTypeFragment) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFragment#810f74cd as nil") - } - b.PutID(AuthenticationCodeTypeFragmentTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthenticationCodeTypeFragment) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFragment#810f74cd as nil") - } - b.PutString(a.URL) - b.PutInt32(a.Length) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthenticationCodeTypeFragment) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFragment#810f74cd to nil") - } - if err := b.ConsumeID(AuthenticationCodeTypeFragmentTypeID); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthenticationCodeTypeFragment) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFragment#810f74cd to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: field url: %w", err) - } - a.URL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: field length: %w", err) - } - a.Length = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthenticationCodeTypeFragment) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFragment#810f74cd as nil") - } - b.ObjStart() - b.PutID("authenticationCodeTypeFragment") - b.Comma() - b.FieldStart("url") - b.PutString(a.URL) - b.Comma() - b.FieldStart("length") - b.PutInt32(a.Length) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthenticationCodeTypeFragment) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFragment#810f74cd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authenticationCodeTypeFragment"); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: field url: %w", err) - } - a.URL = value - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFragment#810f74cd: field length: %w", err) - } - a.Length = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (a *AuthenticationCodeTypeFragment) GetURL() (value string) { - if a == nil { - return - } - return a.URL -} - -// GetLength returns value of Length field. -func (a *AuthenticationCodeTypeFragment) GetLength() (value int32) { - if a == nil { - return - } - return a.Length -} - -// AuthenticationCodeTypeFirebaseAndroid represents TL type `authenticationCodeTypeFirebaseAndroid#6f9bb51e`. -type AuthenticationCodeTypeFirebaseAndroid struct { - // Parameters to be used for device verification - DeviceVerificationParameters FirebaseDeviceVerificationParametersClass - // Length of the code - Length int32 -} - -// AuthenticationCodeTypeFirebaseAndroidTypeID is TL type id of AuthenticationCodeTypeFirebaseAndroid. -const AuthenticationCodeTypeFirebaseAndroidTypeID = 0x6f9bb51e - -// construct implements constructor of AuthenticationCodeTypeClass. -func (a AuthenticationCodeTypeFirebaseAndroid) construct() AuthenticationCodeTypeClass { return &a } - -// Ensuring interfaces in compile-time for AuthenticationCodeTypeFirebaseAndroid. -var ( - _ bin.Encoder = &AuthenticationCodeTypeFirebaseAndroid{} - _ bin.Decoder = &AuthenticationCodeTypeFirebaseAndroid{} - _ bin.BareEncoder = &AuthenticationCodeTypeFirebaseAndroid{} - _ bin.BareDecoder = &AuthenticationCodeTypeFirebaseAndroid{} - - _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeFirebaseAndroid{} -) - -func (a *AuthenticationCodeTypeFirebaseAndroid) Zero() bool { - if a == nil { - return true - } - if !(a.DeviceVerificationParameters == nil) { - return false - } - if !(a.Length == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthenticationCodeTypeFirebaseAndroid) String() string { - if a == nil { - return "AuthenticationCodeTypeFirebaseAndroid(nil)" - } - type Alias AuthenticationCodeTypeFirebaseAndroid - return fmt.Sprintf("AuthenticationCodeTypeFirebaseAndroid%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthenticationCodeTypeFirebaseAndroid) TypeID() uint32 { - return AuthenticationCodeTypeFirebaseAndroidTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthenticationCodeTypeFirebaseAndroid) TypeName() string { - return "authenticationCodeTypeFirebaseAndroid" -} - -// TypeInfo returns info about TL type. -func (a *AuthenticationCodeTypeFirebaseAndroid) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authenticationCodeTypeFirebaseAndroid", - ID: AuthenticationCodeTypeFirebaseAndroidTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DeviceVerificationParameters", - SchemaName: "device_verification_parameters", - }, - { - Name: "Length", - SchemaName: "length", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthenticationCodeTypeFirebaseAndroid) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFirebaseAndroid#6f9bb51e as nil") - } - b.PutID(AuthenticationCodeTypeFirebaseAndroidTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthenticationCodeTypeFirebaseAndroid) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFirebaseAndroid#6f9bb51e as nil") - } - if a.DeviceVerificationParameters == nil { - return fmt.Errorf("unable to encode authenticationCodeTypeFirebaseAndroid#6f9bb51e: field device_verification_parameters is nil") - } - if err := a.DeviceVerificationParameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode authenticationCodeTypeFirebaseAndroid#6f9bb51e: field device_verification_parameters: %w", err) - } - b.PutInt32(a.Length) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthenticationCodeTypeFirebaseAndroid) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFirebaseAndroid#6f9bb51e to nil") - } - if err := b.ConsumeID(AuthenticationCodeTypeFirebaseAndroidTypeID); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseAndroid#6f9bb51e: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthenticationCodeTypeFirebaseAndroid) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFirebaseAndroid#6f9bb51e to nil") - } - { - value, err := DecodeFirebaseDeviceVerificationParameters(b) - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseAndroid#6f9bb51e: field device_verification_parameters: %w", err) - } - a.DeviceVerificationParameters = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseAndroid#6f9bb51e: field length: %w", err) - } - a.Length = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthenticationCodeTypeFirebaseAndroid) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFirebaseAndroid#6f9bb51e as nil") - } - b.ObjStart() - b.PutID("authenticationCodeTypeFirebaseAndroid") - b.Comma() - b.FieldStart("device_verification_parameters") - if a.DeviceVerificationParameters == nil { - return fmt.Errorf("unable to encode authenticationCodeTypeFirebaseAndroid#6f9bb51e: field device_verification_parameters is nil") - } - if err := a.DeviceVerificationParameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode authenticationCodeTypeFirebaseAndroid#6f9bb51e: field device_verification_parameters: %w", err) - } - b.Comma() - b.FieldStart("length") - b.PutInt32(a.Length) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthenticationCodeTypeFirebaseAndroid) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFirebaseAndroid#6f9bb51e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authenticationCodeTypeFirebaseAndroid"); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseAndroid#6f9bb51e: %w", err) - } - case "device_verification_parameters": - value, err := DecodeTDLibJSONFirebaseDeviceVerificationParameters(b) - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseAndroid#6f9bb51e: field device_verification_parameters: %w", err) - } - a.DeviceVerificationParameters = value - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseAndroid#6f9bb51e: field length: %w", err) - } - a.Length = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDeviceVerificationParameters returns value of DeviceVerificationParameters field. -func (a *AuthenticationCodeTypeFirebaseAndroid) GetDeviceVerificationParameters() (value FirebaseDeviceVerificationParametersClass) { - if a == nil { - return - } - return a.DeviceVerificationParameters -} - -// GetLength returns value of Length field. -func (a *AuthenticationCodeTypeFirebaseAndroid) GetLength() (value int32) { - if a == nil { - return - } - return a.Length -} - -// AuthenticationCodeTypeFirebaseIos represents TL type `authenticationCodeTypeFirebaseIos#ff55aa93`. -type AuthenticationCodeTypeFirebaseIos struct { - // Receipt of successful application token validation to compare with receipt from push - // notification - Receipt string - // Time after the next authentication method is expected to be used if verification push - // notification isn't received, in seconds - PushTimeout int32 - // Length of the code - Length int32 -} - -// AuthenticationCodeTypeFirebaseIosTypeID is TL type id of AuthenticationCodeTypeFirebaseIos. -const AuthenticationCodeTypeFirebaseIosTypeID = 0xff55aa93 - -// construct implements constructor of AuthenticationCodeTypeClass. -func (a AuthenticationCodeTypeFirebaseIos) construct() AuthenticationCodeTypeClass { return &a } - -// Ensuring interfaces in compile-time for AuthenticationCodeTypeFirebaseIos. -var ( - _ bin.Encoder = &AuthenticationCodeTypeFirebaseIos{} - _ bin.Decoder = &AuthenticationCodeTypeFirebaseIos{} - _ bin.BareEncoder = &AuthenticationCodeTypeFirebaseIos{} - _ bin.BareDecoder = &AuthenticationCodeTypeFirebaseIos{} - - _ AuthenticationCodeTypeClass = &AuthenticationCodeTypeFirebaseIos{} -) - -func (a *AuthenticationCodeTypeFirebaseIos) Zero() bool { - if a == nil { - return true - } - if !(a.Receipt == "") { - return false - } - if !(a.PushTimeout == 0) { - return false - } - if !(a.Length == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthenticationCodeTypeFirebaseIos) String() string { - if a == nil { - return "AuthenticationCodeTypeFirebaseIos(nil)" - } - type Alias AuthenticationCodeTypeFirebaseIos - return fmt.Sprintf("AuthenticationCodeTypeFirebaseIos%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthenticationCodeTypeFirebaseIos) TypeID() uint32 { - return AuthenticationCodeTypeFirebaseIosTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthenticationCodeTypeFirebaseIos) TypeName() string { - return "authenticationCodeTypeFirebaseIos" -} - -// TypeInfo returns info about TL type. -func (a *AuthenticationCodeTypeFirebaseIos) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authenticationCodeTypeFirebaseIos", - ID: AuthenticationCodeTypeFirebaseIosTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Receipt", - SchemaName: "receipt", - }, - { - Name: "PushTimeout", - SchemaName: "push_timeout", - }, - { - Name: "Length", - SchemaName: "length", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthenticationCodeTypeFirebaseIos) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFirebaseIos#ff55aa93 as nil") - } - b.PutID(AuthenticationCodeTypeFirebaseIosTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthenticationCodeTypeFirebaseIos) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFirebaseIos#ff55aa93 as nil") - } - b.PutString(a.Receipt) - b.PutInt32(a.PushTimeout) - b.PutInt32(a.Length) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthenticationCodeTypeFirebaseIos) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFirebaseIos#ff55aa93 to nil") - } - if err := b.ConsumeID(AuthenticationCodeTypeFirebaseIosTypeID); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseIos#ff55aa93: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthenticationCodeTypeFirebaseIos) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFirebaseIos#ff55aa93 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseIos#ff55aa93: field receipt: %w", err) - } - a.Receipt = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseIos#ff55aa93: field push_timeout: %w", err) - } - a.PushTimeout = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseIos#ff55aa93: field length: %w", err) - } - a.Length = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthenticationCodeTypeFirebaseIos) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authenticationCodeTypeFirebaseIos#ff55aa93 as nil") - } - b.ObjStart() - b.PutID("authenticationCodeTypeFirebaseIos") - b.Comma() - b.FieldStart("receipt") - b.PutString(a.Receipt) - b.Comma() - b.FieldStart("push_timeout") - b.PutInt32(a.PushTimeout) - b.Comma() - b.FieldStart("length") - b.PutInt32(a.Length) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthenticationCodeTypeFirebaseIos) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authenticationCodeTypeFirebaseIos#ff55aa93 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authenticationCodeTypeFirebaseIos"); err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseIos#ff55aa93: %w", err) - } - case "receipt": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseIos#ff55aa93: field receipt: %w", err) - } - a.Receipt = value - case "push_timeout": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseIos#ff55aa93: field push_timeout: %w", err) - } - a.PushTimeout = value - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode authenticationCodeTypeFirebaseIos#ff55aa93: field length: %w", err) - } - a.Length = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReceipt returns value of Receipt field. -func (a *AuthenticationCodeTypeFirebaseIos) GetReceipt() (value string) { - if a == nil { - return - } - return a.Receipt -} - -// GetPushTimeout returns value of PushTimeout field. -func (a *AuthenticationCodeTypeFirebaseIos) GetPushTimeout() (value int32) { - if a == nil { - return - } - return a.PushTimeout -} - -// GetLength returns value of Length field. -func (a *AuthenticationCodeTypeFirebaseIos) GetLength() (value int32) { - if a == nil { - return - } - return a.Length -} - -// AuthenticationCodeTypeClassName is schema name of AuthenticationCodeTypeClass. -const AuthenticationCodeTypeClassName = "AuthenticationCodeType" - -// AuthenticationCodeTypeClass represents AuthenticationCodeType generic type. -// -// Example: -// -// g, err := tdapi.DecodeAuthenticationCodeType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.AuthenticationCodeTypeTelegramMessage: // authenticationCodeTypeTelegramMessage#7bf49b2a -// case *tdapi.AuthenticationCodeTypeSMS: // authenticationCodeTypeSms#3960e288 -// case *tdapi.AuthenticationCodeTypeSMSWord: // authenticationCodeTypeSmsWord#a6063c63 -// case *tdapi.AuthenticationCodeTypeSMSPhrase: // authenticationCodeTypeSmsPhrase#2ebc8cd1 -// case *tdapi.AuthenticationCodeTypeCall: // authenticationCodeTypeCall#61876c67 -// case *tdapi.AuthenticationCodeTypeFlashCall: // authenticationCodeTypeFlashCall#533379a2 -// case *tdapi.AuthenticationCodeTypeMissedCall: // authenticationCodeTypeMissedCall#29bb0a87 -// case *tdapi.AuthenticationCodeTypeFragment: // authenticationCodeTypeFragment#810f74cd -// case *tdapi.AuthenticationCodeTypeFirebaseAndroid: // authenticationCodeTypeFirebaseAndroid#6f9bb51e -// case *tdapi.AuthenticationCodeTypeFirebaseIos: // authenticationCodeTypeFirebaseIos#ff55aa93 -// default: panic(v) -// } -type AuthenticationCodeTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() AuthenticationCodeTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeAuthenticationCodeType implements binary de-serialization for AuthenticationCodeTypeClass. -func DecodeAuthenticationCodeType(buf *bin.Buffer) (AuthenticationCodeTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case AuthenticationCodeTypeTelegramMessageTypeID: - // Decoding authenticationCodeTypeTelegramMessage#7bf49b2a. - v := AuthenticationCodeTypeTelegramMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case AuthenticationCodeTypeSMSTypeID: - // Decoding authenticationCodeTypeSms#3960e288. - v := AuthenticationCodeTypeSMS{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case AuthenticationCodeTypeSMSWordTypeID: - // Decoding authenticationCodeTypeSmsWord#a6063c63. - v := AuthenticationCodeTypeSMSWord{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case AuthenticationCodeTypeSMSPhraseTypeID: - // Decoding authenticationCodeTypeSmsPhrase#2ebc8cd1. - v := AuthenticationCodeTypeSMSPhrase{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case AuthenticationCodeTypeCallTypeID: - // Decoding authenticationCodeTypeCall#61876c67. - v := AuthenticationCodeTypeCall{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case AuthenticationCodeTypeFlashCallTypeID: - // Decoding authenticationCodeTypeFlashCall#533379a2. - v := AuthenticationCodeTypeFlashCall{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case AuthenticationCodeTypeMissedCallTypeID: - // Decoding authenticationCodeTypeMissedCall#29bb0a87. - v := AuthenticationCodeTypeMissedCall{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case AuthenticationCodeTypeFragmentTypeID: - // Decoding authenticationCodeTypeFragment#810f74cd. - v := AuthenticationCodeTypeFragment{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case AuthenticationCodeTypeFirebaseAndroidTypeID: - // Decoding authenticationCodeTypeFirebaseAndroid#6f9bb51e. - v := AuthenticationCodeTypeFirebaseAndroid{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case AuthenticationCodeTypeFirebaseIosTypeID: - // Decoding authenticationCodeTypeFirebaseIos#ff55aa93. - v := AuthenticationCodeTypeFirebaseIos{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONAuthenticationCodeType implements binary de-serialization for AuthenticationCodeTypeClass. -func DecodeTDLibJSONAuthenticationCodeType(buf tdjson.Decoder) (AuthenticationCodeTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "authenticationCodeTypeTelegramMessage": - // Decoding authenticationCodeTypeTelegramMessage#7bf49b2a. - v := AuthenticationCodeTypeTelegramMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case "authenticationCodeTypeSms": - // Decoding authenticationCodeTypeSms#3960e288. - v := AuthenticationCodeTypeSMS{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case "authenticationCodeTypeSmsWord": - // Decoding authenticationCodeTypeSmsWord#a6063c63. - v := AuthenticationCodeTypeSMSWord{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case "authenticationCodeTypeSmsPhrase": - // Decoding authenticationCodeTypeSmsPhrase#2ebc8cd1. - v := AuthenticationCodeTypeSMSPhrase{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case "authenticationCodeTypeCall": - // Decoding authenticationCodeTypeCall#61876c67. - v := AuthenticationCodeTypeCall{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case "authenticationCodeTypeFlashCall": - // Decoding authenticationCodeTypeFlashCall#533379a2. - v := AuthenticationCodeTypeFlashCall{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case "authenticationCodeTypeMissedCall": - // Decoding authenticationCodeTypeMissedCall#29bb0a87. - v := AuthenticationCodeTypeMissedCall{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case "authenticationCodeTypeFragment": - // Decoding authenticationCodeTypeFragment#810f74cd. - v := AuthenticationCodeTypeFragment{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case "authenticationCodeTypeFirebaseAndroid": - // Decoding authenticationCodeTypeFirebaseAndroid#6f9bb51e. - v := AuthenticationCodeTypeFirebaseAndroid{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - case "authenticationCodeTypeFirebaseIos": - // Decoding authenticationCodeTypeFirebaseIos#ff55aa93. - v := AuthenticationCodeTypeFirebaseIos{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode AuthenticationCodeTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// AuthenticationCodeType boxes the AuthenticationCodeTypeClass providing a helper. -type AuthenticationCodeTypeBox struct { - AuthenticationCodeType AuthenticationCodeTypeClass -} - -// Decode implements bin.Decoder for AuthenticationCodeTypeBox. -func (b *AuthenticationCodeTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode AuthenticationCodeTypeBox to nil") - } - v, err := DecodeAuthenticationCodeType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.AuthenticationCodeType = v - return nil -} - -// Encode implements bin.Encode for AuthenticationCodeTypeBox. -func (b *AuthenticationCodeTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.AuthenticationCodeType == nil { - return fmt.Errorf("unable to encode AuthenticationCodeTypeClass as nil") - } - return b.AuthenticationCodeType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for AuthenticationCodeTypeBox. -func (b *AuthenticationCodeTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode AuthenticationCodeTypeBox to nil") - } - v, err := DecodeTDLibJSONAuthenticationCodeType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.AuthenticationCodeType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for AuthenticationCodeTypeBox. -func (b *AuthenticationCodeTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.AuthenticationCodeType == nil { - return fmt.Errorf("unable to encode AuthenticationCodeTypeClass as nil") - } - return b.AuthenticationCodeType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_authorization_state_gen.go b/tdapi/tl_authorization_state_gen.go deleted file mode 100644 index 6201fb198..000000000 --- a/tdapi/tl_authorization_state_gen.go +++ /dev/null @@ -1,2350 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AuthorizationStateWaitTdlibParameters represents TL type `authorizationStateWaitTdlibParameters#35ecf25c`. -type AuthorizationStateWaitTdlibParameters struct { -} - -// AuthorizationStateWaitTdlibParametersTypeID is TL type id of AuthorizationStateWaitTdlibParameters. -const AuthorizationStateWaitTdlibParametersTypeID = 0x35ecf25c - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateWaitTdlibParameters) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateWaitTdlibParameters. -var ( - _ bin.Encoder = &AuthorizationStateWaitTdlibParameters{} - _ bin.Decoder = &AuthorizationStateWaitTdlibParameters{} - _ bin.BareEncoder = &AuthorizationStateWaitTdlibParameters{} - _ bin.BareDecoder = &AuthorizationStateWaitTdlibParameters{} - - _ AuthorizationStateClass = &AuthorizationStateWaitTdlibParameters{} -) - -func (a *AuthorizationStateWaitTdlibParameters) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateWaitTdlibParameters) String() string { - if a == nil { - return "AuthorizationStateWaitTdlibParameters(nil)" - } - type Alias AuthorizationStateWaitTdlibParameters - return fmt.Sprintf("AuthorizationStateWaitTdlibParameters%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateWaitTdlibParameters) TypeID() uint32 { - return AuthorizationStateWaitTdlibParametersTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateWaitTdlibParameters) TypeName() string { - return "authorizationStateWaitTdlibParameters" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateWaitTdlibParameters) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateWaitTdlibParameters", - ID: AuthorizationStateWaitTdlibParametersTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateWaitTdlibParameters) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitTdlibParameters#35ecf25c as nil") - } - b.PutID(AuthorizationStateWaitTdlibParametersTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateWaitTdlibParameters) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitTdlibParameters#35ecf25c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateWaitTdlibParameters) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitTdlibParameters#35ecf25c to nil") - } - if err := b.ConsumeID(AuthorizationStateWaitTdlibParametersTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitTdlibParameters#35ecf25c: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateWaitTdlibParameters) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitTdlibParameters#35ecf25c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateWaitTdlibParameters) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitTdlibParameters#35ecf25c as nil") - } - b.ObjStart() - b.PutID("authorizationStateWaitTdlibParameters") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateWaitTdlibParameters) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitTdlibParameters#35ecf25c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateWaitTdlibParameters"); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitTdlibParameters#35ecf25c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AuthorizationStateWaitPhoneNumber represents TL type `authorizationStateWaitPhoneNumber#124354e3`. -type AuthorizationStateWaitPhoneNumber struct { -} - -// AuthorizationStateWaitPhoneNumberTypeID is TL type id of AuthorizationStateWaitPhoneNumber. -const AuthorizationStateWaitPhoneNumberTypeID = 0x124354e3 - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateWaitPhoneNumber) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateWaitPhoneNumber. -var ( - _ bin.Encoder = &AuthorizationStateWaitPhoneNumber{} - _ bin.Decoder = &AuthorizationStateWaitPhoneNumber{} - _ bin.BareEncoder = &AuthorizationStateWaitPhoneNumber{} - _ bin.BareDecoder = &AuthorizationStateWaitPhoneNumber{} - - _ AuthorizationStateClass = &AuthorizationStateWaitPhoneNumber{} -) - -func (a *AuthorizationStateWaitPhoneNumber) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateWaitPhoneNumber) String() string { - if a == nil { - return "AuthorizationStateWaitPhoneNumber(nil)" - } - type Alias AuthorizationStateWaitPhoneNumber - return fmt.Sprintf("AuthorizationStateWaitPhoneNumber%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateWaitPhoneNumber) TypeID() uint32 { - return AuthorizationStateWaitPhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateWaitPhoneNumber) TypeName() string { - return "authorizationStateWaitPhoneNumber" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateWaitPhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateWaitPhoneNumber", - ID: AuthorizationStateWaitPhoneNumberTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateWaitPhoneNumber) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitPhoneNumber#124354e3 as nil") - } - b.PutID(AuthorizationStateWaitPhoneNumberTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateWaitPhoneNumber) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitPhoneNumber#124354e3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateWaitPhoneNumber) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitPhoneNumber#124354e3 to nil") - } - if err := b.ConsumeID(AuthorizationStateWaitPhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPhoneNumber#124354e3: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateWaitPhoneNumber) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitPhoneNumber#124354e3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateWaitPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitPhoneNumber#124354e3 as nil") - } - b.ObjStart() - b.PutID("authorizationStateWaitPhoneNumber") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateWaitPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitPhoneNumber#124354e3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateWaitPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPhoneNumber#124354e3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AuthorizationStateWaitEmailAddress represents TL type `authorizationStateWaitEmailAddress#3e0471c7`. -type AuthorizationStateWaitEmailAddress struct { - // True, if authorization through Apple ID is allowed - AllowAppleID bool - // True, if authorization through Google ID is allowed - AllowGoogleID bool -} - -// AuthorizationStateWaitEmailAddressTypeID is TL type id of AuthorizationStateWaitEmailAddress. -const AuthorizationStateWaitEmailAddressTypeID = 0x3e0471c7 - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateWaitEmailAddress) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateWaitEmailAddress. -var ( - _ bin.Encoder = &AuthorizationStateWaitEmailAddress{} - _ bin.Decoder = &AuthorizationStateWaitEmailAddress{} - _ bin.BareEncoder = &AuthorizationStateWaitEmailAddress{} - _ bin.BareDecoder = &AuthorizationStateWaitEmailAddress{} - - _ AuthorizationStateClass = &AuthorizationStateWaitEmailAddress{} -) - -func (a *AuthorizationStateWaitEmailAddress) Zero() bool { - if a == nil { - return true - } - if !(a.AllowAppleID == false) { - return false - } - if !(a.AllowGoogleID == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateWaitEmailAddress) String() string { - if a == nil { - return "AuthorizationStateWaitEmailAddress(nil)" - } - type Alias AuthorizationStateWaitEmailAddress - return fmt.Sprintf("AuthorizationStateWaitEmailAddress%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateWaitEmailAddress) TypeID() uint32 { - return AuthorizationStateWaitEmailAddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateWaitEmailAddress) TypeName() string { - return "authorizationStateWaitEmailAddress" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateWaitEmailAddress) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateWaitEmailAddress", - ID: AuthorizationStateWaitEmailAddressTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AllowAppleID", - SchemaName: "allow_apple_id", - }, - { - Name: "AllowGoogleID", - SchemaName: "allow_google_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateWaitEmailAddress) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitEmailAddress#3e0471c7 as nil") - } - b.PutID(AuthorizationStateWaitEmailAddressTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateWaitEmailAddress) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitEmailAddress#3e0471c7 as nil") - } - b.PutBool(a.AllowAppleID) - b.PutBool(a.AllowGoogleID) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateWaitEmailAddress) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitEmailAddress#3e0471c7 to nil") - } - if err := b.ConsumeID(AuthorizationStateWaitEmailAddressTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateWaitEmailAddress) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitEmailAddress#3e0471c7 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: field allow_apple_id: %w", err) - } - a.AllowAppleID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: field allow_google_id: %w", err) - } - a.AllowGoogleID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateWaitEmailAddress) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitEmailAddress#3e0471c7 as nil") - } - b.ObjStart() - b.PutID("authorizationStateWaitEmailAddress") - b.Comma() - b.FieldStart("allow_apple_id") - b.PutBool(a.AllowAppleID) - b.Comma() - b.FieldStart("allow_google_id") - b.PutBool(a.AllowGoogleID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateWaitEmailAddress) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitEmailAddress#3e0471c7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateWaitEmailAddress"); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: %w", err) - } - case "allow_apple_id": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: field allow_apple_id: %w", err) - } - a.AllowAppleID = value - case "allow_google_id": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailAddress#3e0471c7: field allow_google_id: %w", err) - } - a.AllowGoogleID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAllowAppleID returns value of AllowAppleID field. -func (a *AuthorizationStateWaitEmailAddress) GetAllowAppleID() (value bool) { - if a == nil { - return - } - return a.AllowAppleID -} - -// GetAllowGoogleID returns value of AllowGoogleID field. -func (a *AuthorizationStateWaitEmailAddress) GetAllowGoogleID() (value bool) { - if a == nil { - return - } - return a.AllowGoogleID -} - -// AuthorizationStateWaitEmailCode represents TL type `authorizationStateWaitEmailCode#909f025b`. -type AuthorizationStateWaitEmailCode struct { - // True, if authorization through Apple ID is allowed - AllowAppleID bool - // True, if authorization through Google ID is allowed - AllowGoogleID bool - // Information about the sent authentication code - CodeInfo EmailAddressAuthenticationCodeInfo - // Reset state of the email address; may be null if the email address can't be reset - EmailAddressResetState EmailAddressResetStateClass -} - -// AuthorizationStateWaitEmailCodeTypeID is TL type id of AuthorizationStateWaitEmailCode. -const AuthorizationStateWaitEmailCodeTypeID = 0x909f025b - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateWaitEmailCode) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateWaitEmailCode. -var ( - _ bin.Encoder = &AuthorizationStateWaitEmailCode{} - _ bin.Decoder = &AuthorizationStateWaitEmailCode{} - _ bin.BareEncoder = &AuthorizationStateWaitEmailCode{} - _ bin.BareDecoder = &AuthorizationStateWaitEmailCode{} - - _ AuthorizationStateClass = &AuthorizationStateWaitEmailCode{} -) - -func (a *AuthorizationStateWaitEmailCode) Zero() bool { - if a == nil { - return true - } - if !(a.AllowAppleID == false) { - return false - } - if !(a.AllowGoogleID == false) { - return false - } - if !(a.CodeInfo.Zero()) { - return false - } - if !(a.EmailAddressResetState == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateWaitEmailCode) String() string { - if a == nil { - return "AuthorizationStateWaitEmailCode(nil)" - } - type Alias AuthorizationStateWaitEmailCode - return fmt.Sprintf("AuthorizationStateWaitEmailCode%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateWaitEmailCode) TypeID() uint32 { - return AuthorizationStateWaitEmailCodeTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateWaitEmailCode) TypeName() string { - return "authorizationStateWaitEmailCode" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateWaitEmailCode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateWaitEmailCode", - ID: AuthorizationStateWaitEmailCodeTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AllowAppleID", - SchemaName: "allow_apple_id", - }, - { - Name: "AllowGoogleID", - SchemaName: "allow_google_id", - }, - { - Name: "CodeInfo", - SchemaName: "code_info", - }, - { - Name: "EmailAddressResetState", - SchemaName: "email_address_reset_state", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateWaitEmailCode) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitEmailCode#909f025b as nil") - } - b.PutID(AuthorizationStateWaitEmailCodeTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateWaitEmailCode) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitEmailCode#909f025b as nil") - } - b.PutBool(a.AllowAppleID) - b.PutBool(a.AllowGoogleID) - if err := a.CodeInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field code_info: %w", err) - } - if a.EmailAddressResetState == nil { - return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state is nil") - } - if err := a.EmailAddressResetState.Encode(b); err != nil { - return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateWaitEmailCode) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitEmailCode#909f025b to nil") - } - if err := b.ConsumeID(AuthorizationStateWaitEmailCodeTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateWaitEmailCode) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitEmailCode#909f025b to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field allow_apple_id: %w", err) - } - a.AllowAppleID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field allow_google_id: %w", err) - } - a.AllowGoogleID = value - } - { - if err := a.CodeInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field code_info: %w", err) - } - } - { - value, err := DecodeEmailAddressResetState(b) - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state: %w", err) - } - a.EmailAddressResetState = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateWaitEmailCode) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitEmailCode#909f025b as nil") - } - b.ObjStart() - b.PutID("authorizationStateWaitEmailCode") - b.Comma() - b.FieldStart("allow_apple_id") - b.PutBool(a.AllowAppleID) - b.Comma() - b.FieldStart("allow_google_id") - b.PutBool(a.AllowGoogleID) - b.Comma() - b.FieldStart("code_info") - if err := a.CodeInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field code_info: %w", err) - } - b.Comma() - b.FieldStart("email_address_reset_state") - if a.EmailAddressResetState == nil { - return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state is nil") - } - if err := a.EmailAddressResetState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateWaitEmailCode) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitEmailCode#909f025b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateWaitEmailCode"); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: %w", err) - } - case "allow_apple_id": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field allow_apple_id: %w", err) - } - a.AllowAppleID = value - case "allow_google_id": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field allow_google_id: %w", err) - } - a.AllowGoogleID = value - case "code_info": - if err := a.CodeInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field code_info: %w", err) - } - case "email_address_reset_state": - value, err := DecodeTDLibJSONEmailAddressResetState(b) - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitEmailCode#909f025b: field email_address_reset_state: %w", err) - } - a.EmailAddressResetState = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAllowAppleID returns value of AllowAppleID field. -func (a *AuthorizationStateWaitEmailCode) GetAllowAppleID() (value bool) { - if a == nil { - return - } - return a.AllowAppleID -} - -// GetAllowGoogleID returns value of AllowGoogleID field. -func (a *AuthorizationStateWaitEmailCode) GetAllowGoogleID() (value bool) { - if a == nil { - return - } - return a.AllowGoogleID -} - -// GetCodeInfo returns value of CodeInfo field. -func (a *AuthorizationStateWaitEmailCode) GetCodeInfo() (value EmailAddressAuthenticationCodeInfo) { - if a == nil { - return - } - return a.CodeInfo -} - -// GetEmailAddressResetState returns value of EmailAddressResetState field. -func (a *AuthorizationStateWaitEmailCode) GetEmailAddressResetState() (value EmailAddressResetStateClass) { - if a == nil { - return - } - return a.EmailAddressResetState -} - -// AuthorizationStateWaitCode represents TL type `authorizationStateWaitCode#3234501`. -type AuthorizationStateWaitCode struct { - // Information about the authorization code that was sent - CodeInfo AuthenticationCodeInfo -} - -// AuthorizationStateWaitCodeTypeID is TL type id of AuthorizationStateWaitCode. -const AuthorizationStateWaitCodeTypeID = 0x3234501 - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateWaitCode) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateWaitCode. -var ( - _ bin.Encoder = &AuthorizationStateWaitCode{} - _ bin.Decoder = &AuthorizationStateWaitCode{} - _ bin.BareEncoder = &AuthorizationStateWaitCode{} - _ bin.BareDecoder = &AuthorizationStateWaitCode{} - - _ AuthorizationStateClass = &AuthorizationStateWaitCode{} -) - -func (a *AuthorizationStateWaitCode) Zero() bool { - if a == nil { - return true - } - if !(a.CodeInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateWaitCode) String() string { - if a == nil { - return "AuthorizationStateWaitCode(nil)" - } - type Alias AuthorizationStateWaitCode - return fmt.Sprintf("AuthorizationStateWaitCode%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateWaitCode) TypeID() uint32 { - return AuthorizationStateWaitCodeTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateWaitCode) TypeName() string { - return "authorizationStateWaitCode" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateWaitCode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateWaitCode", - ID: AuthorizationStateWaitCodeTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CodeInfo", - SchemaName: "code_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateWaitCode) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitCode#3234501 as nil") - } - b.PutID(AuthorizationStateWaitCodeTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateWaitCode) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitCode#3234501 as nil") - } - if err := a.CodeInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode authorizationStateWaitCode#3234501: field code_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateWaitCode) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitCode#3234501 to nil") - } - if err := b.ConsumeID(AuthorizationStateWaitCodeTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitCode#3234501: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateWaitCode) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitCode#3234501 to nil") - } - { - if err := a.CodeInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitCode#3234501: field code_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateWaitCode) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitCode#3234501 as nil") - } - b.ObjStart() - b.PutID("authorizationStateWaitCode") - b.Comma() - b.FieldStart("code_info") - if err := a.CodeInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode authorizationStateWaitCode#3234501: field code_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateWaitCode) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitCode#3234501 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateWaitCode"); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitCode#3234501: %w", err) - } - case "code_info": - if err := a.CodeInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitCode#3234501: field code_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCodeInfo returns value of CodeInfo field. -func (a *AuthorizationStateWaitCode) GetCodeInfo() (value AuthenticationCodeInfo) { - if a == nil { - return - } - return a.CodeInfo -} - -// AuthorizationStateWaitOtherDeviceConfirmation represents TL type `authorizationStateWaitOtherDeviceConfirmation#334518ea`. -type AuthorizationStateWaitOtherDeviceConfirmation struct { - // A tg:// URL for the QR code. The link will be updated frequently - Link string -} - -// AuthorizationStateWaitOtherDeviceConfirmationTypeID is TL type id of AuthorizationStateWaitOtherDeviceConfirmation. -const AuthorizationStateWaitOtherDeviceConfirmationTypeID = 0x334518ea - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateWaitOtherDeviceConfirmation) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateWaitOtherDeviceConfirmation. -var ( - _ bin.Encoder = &AuthorizationStateWaitOtherDeviceConfirmation{} - _ bin.Decoder = &AuthorizationStateWaitOtherDeviceConfirmation{} - _ bin.BareEncoder = &AuthorizationStateWaitOtherDeviceConfirmation{} - _ bin.BareDecoder = &AuthorizationStateWaitOtherDeviceConfirmation{} - - _ AuthorizationStateClass = &AuthorizationStateWaitOtherDeviceConfirmation{} -) - -func (a *AuthorizationStateWaitOtherDeviceConfirmation) Zero() bool { - if a == nil { - return true - } - if !(a.Link == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateWaitOtherDeviceConfirmation) String() string { - if a == nil { - return "AuthorizationStateWaitOtherDeviceConfirmation(nil)" - } - type Alias AuthorizationStateWaitOtherDeviceConfirmation - return fmt.Sprintf("AuthorizationStateWaitOtherDeviceConfirmation%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateWaitOtherDeviceConfirmation) TypeID() uint32 { - return AuthorizationStateWaitOtherDeviceConfirmationTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateWaitOtherDeviceConfirmation) TypeName() string { - return "authorizationStateWaitOtherDeviceConfirmation" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateWaitOtherDeviceConfirmation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateWaitOtherDeviceConfirmation", - ID: AuthorizationStateWaitOtherDeviceConfirmationTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateWaitOtherDeviceConfirmation) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitOtherDeviceConfirmation#334518ea as nil") - } - b.PutID(AuthorizationStateWaitOtherDeviceConfirmationTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateWaitOtherDeviceConfirmation) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitOtherDeviceConfirmation#334518ea as nil") - } - b.PutString(a.Link) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateWaitOtherDeviceConfirmation) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitOtherDeviceConfirmation#334518ea to nil") - } - if err := b.ConsumeID(AuthorizationStateWaitOtherDeviceConfirmationTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitOtherDeviceConfirmation#334518ea: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateWaitOtherDeviceConfirmation) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitOtherDeviceConfirmation#334518ea to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitOtherDeviceConfirmation#334518ea: field link: %w", err) - } - a.Link = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateWaitOtherDeviceConfirmation) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitOtherDeviceConfirmation#334518ea as nil") - } - b.ObjStart() - b.PutID("authorizationStateWaitOtherDeviceConfirmation") - b.Comma() - b.FieldStart("link") - b.PutString(a.Link) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateWaitOtherDeviceConfirmation) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitOtherDeviceConfirmation#334518ea to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateWaitOtherDeviceConfirmation"); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitOtherDeviceConfirmation#334518ea: %w", err) - } - case "link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitOtherDeviceConfirmation#334518ea: field link: %w", err) - } - a.Link = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (a *AuthorizationStateWaitOtherDeviceConfirmation) GetLink() (value string) { - if a == nil { - return - } - return a.Link -} - -// AuthorizationStateWaitRegistration represents TL type `authorizationStateWaitRegistration#20cdaeaf`. -type AuthorizationStateWaitRegistration struct { - // Telegram terms of service - TermsOfService TermsOfService -} - -// AuthorizationStateWaitRegistrationTypeID is TL type id of AuthorizationStateWaitRegistration. -const AuthorizationStateWaitRegistrationTypeID = 0x20cdaeaf - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateWaitRegistration) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateWaitRegistration. -var ( - _ bin.Encoder = &AuthorizationStateWaitRegistration{} - _ bin.Decoder = &AuthorizationStateWaitRegistration{} - _ bin.BareEncoder = &AuthorizationStateWaitRegistration{} - _ bin.BareDecoder = &AuthorizationStateWaitRegistration{} - - _ AuthorizationStateClass = &AuthorizationStateWaitRegistration{} -) - -func (a *AuthorizationStateWaitRegistration) Zero() bool { - if a == nil { - return true - } - if !(a.TermsOfService.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateWaitRegistration) String() string { - if a == nil { - return "AuthorizationStateWaitRegistration(nil)" - } - type Alias AuthorizationStateWaitRegistration - return fmt.Sprintf("AuthorizationStateWaitRegistration%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateWaitRegistration) TypeID() uint32 { - return AuthorizationStateWaitRegistrationTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateWaitRegistration) TypeName() string { - return "authorizationStateWaitRegistration" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateWaitRegistration) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateWaitRegistration", - ID: AuthorizationStateWaitRegistrationTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TermsOfService", - SchemaName: "terms_of_service", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateWaitRegistration) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitRegistration#20cdaeaf as nil") - } - b.PutID(AuthorizationStateWaitRegistrationTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateWaitRegistration) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitRegistration#20cdaeaf as nil") - } - if err := a.TermsOfService.Encode(b); err != nil { - return fmt.Errorf("unable to encode authorizationStateWaitRegistration#20cdaeaf: field terms_of_service: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateWaitRegistration) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitRegistration#20cdaeaf to nil") - } - if err := b.ConsumeID(AuthorizationStateWaitRegistrationTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitRegistration#20cdaeaf: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateWaitRegistration) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitRegistration#20cdaeaf to nil") - } - { - if err := a.TermsOfService.Decode(b); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitRegistration#20cdaeaf: field terms_of_service: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateWaitRegistration) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitRegistration#20cdaeaf as nil") - } - b.ObjStart() - b.PutID("authorizationStateWaitRegistration") - b.Comma() - b.FieldStart("terms_of_service") - if err := a.TermsOfService.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode authorizationStateWaitRegistration#20cdaeaf: field terms_of_service: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateWaitRegistration) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitRegistration#20cdaeaf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateWaitRegistration"); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitRegistration#20cdaeaf: %w", err) - } - case "terms_of_service": - if err := a.TermsOfService.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitRegistration#20cdaeaf: field terms_of_service: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTermsOfService returns value of TermsOfService field. -func (a *AuthorizationStateWaitRegistration) GetTermsOfService() (value TermsOfService) { - if a == nil { - return - } - return a.TermsOfService -} - -// AuthorizationStateWaitPassword represents TL type `authorizationStateWaitPassword#6b09dce`. -type AuthorizationStateWaitPassword struct { - // Hint for the password; may be empty - PasswordHint string - // True, if a recovery email address has been set up - HasRecoveryEmailAddress bool - // True, if some Telegram Passport elements were saved - HasPassportData bool - // Pattern of the email address to which the recovery email was sent; empty until a - // recovery email has been sent - RecoveryEmailAddressPattern string -} - -// AuthorizationStateWaitPasswordTypeID is TL type id of AuthorizationStateWaitPassword. -const AuthorizationStateWaitPasswordTypeID = 0x6b09dce - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateWaitPassword) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateWaitPassword. -var ( - _ bin.Encoder = &AuthorizationStateWaitPassword{} - _ bin.Decoder = &AuthorizationStateWaitPassword{} - _ bin.BareEncoder = &AuthorizationStateWaitPassword{} - _ bin.BareDecoder = &AuthorizationStateWaitPassword{} - - _ AuthorizationStateClass = &AuthorizationStateWaitPassword{} -) - -func (a *AuthorizationStateWaitPassword) Zero() bool { - if a == nil { - return true - } - if !(a.PasswordHint == "") { - return false - } - if !(a.HasRecoveryEmailAddress == false) { - return false - } - if !(a.HasPassportData == false) { - return false - } - if !(a.RecoveryEmailAddressPattern == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateWaitPassword) String() string { - if a == nil { - return "AuthorizationStateWaitPassword(nil)" - } - type Alias AuthorizationStateWaitPassword - return fmt.Sprintf("AuthorizationStateWaitPassword%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateWaitPassword) TypeID() uint32 { - return AuthorizationStateWaitPasswordTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateWaitPassword) TypeName() string { - return "authorizationStateWaitPassword" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateWaitPassword) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateWaitPassword", - ID: AuthorizationStateWaitPasswordTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PasswordHint", - SchemaName: "password_hint", - }, - { - Name: "HasRecoveryEmailAddress", - SchemaName: "has_recovery_email_address", - }, - { - Name: "HasPassportData", - SchemaName: "has_passport_data", - }, - { - Name: "RecoveryEmailAddressPattern", - SchemaName: "recovery_email_address_pattern", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateWaitPassword) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitPassword#6b09dce as nil") - } - b.PutID(AuthorizationStateWaitPasswordTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateWaitPassword) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitPassword#6b09dce as nil") - } - b.PutString(a.PasswordHint) - b.PutBool(a.HasRecoveryEmailAddress) - b.PutBool(a.HasPassportData) - b.PutString(a.RecoveryEmailAddressPattern) - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateWaitPassword) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitPassword#6b09dce to nil") - } - if err := b.ConsumeID(AuthorizationStateWaitPasswordTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateWaitPassword) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitPassword#6b09dce to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field password_hint: %w", err) - } - a.PasswordHint = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field has_recovery_email_address: %w", err) - } - a.HasRecoveryEmailAddress = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field has_passport_data: %w", err) - } - a.HasPassportData = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field recovery_email_address_pattern: %w", err) - } - a.RecoveryEmailAddressPattern = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateWaitPassword) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateWaitPassword#6b09dce as nil") - } - b.ObjStart() - b.PutID("authorizationStateWaitPassword") - b.Comma() - b.FieldStart("password_hint") - b.PutString(a.PasswordHint) - b.Comma() - b.FieldStart("has_recovery_email_address") - b.PutBool(a.HasRecoveryEmailAddress) - b.Comma() - b.FieldStart("has_passport_data") - b.PutBool(a.HasPassportData) - b.Comma() - b.FieldStart("recovery_email_address_pattern") - b.PutString(a.RecoveryEmailAddressPattern) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateWaitPassword) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateWaitPassword#6b09dce to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateWaitPassword"); err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: %w", err) - } - case "password_hint": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field password_hint: %w", err) - } - a.PasswordHint = value - case "has_recovery_email_address": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field has_recovery_email_address: %w", err) - } - a.HasRecoveryEmailAddress = value - case "has_passport_data": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field has_passport_data: %w", err) - } - a.HasPassportData = value - case "recovery_email_address_pattern": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode authorizationStateWaitPassword#6b09dce: field recovery_email_address_pattern: %w", err) - } - a.RecoveryEmailAddressPattern = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPasswordHint returns value of PasswordHint field. -func (a *AuthorizationStateWaitPassword) GetPasswordHint() (value string) { - if a == nil { - return - } - return a.PasswordHint -} - -// GetHasRecoveryEmailAddress returns value of HasRecoveryEmailAddress field. -func (a *AuthorizationStateWaitPassword) GetHasRecoveryEmailAddress() (value bool) { - if a == nil { - return - } - return a.HasRecoveryEmailAddress -} - -// GetHasPassportData returns value of HasPassportData field. -func (a *AuthorizationStateWaitPassword) GetHasPassportData() (value bool) { - if a == nil { - return - } - return a.HasPassportData -} - -// GetRecoveryEmailAddressPattern returns value of RecoveryEmailAddressPattern field. -func (a *AuthorizationStateWaitPassword) GetRecoveryEmailAddressPattern() (value string) { - if a == nil { - return - } - return a.RecoveryEmailAddressPattern -} - -// AuthorizationStateReady represents TL type `authorizationStateReady#92a21447`. -type AuthorizationStateReady struct { -} - -// AuthorizationStateReadyTypeID is TL type id of AuthorizationStateReady. -const AuthorizationStateReadyTypeID = 0x92a21447 - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateReady) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateReady. -var ( - _ bin.Encoder = &AuthorizationStateReady{} - _ bin.Decoder = &AuthorizationStateReady{} - _ bin.BareEncoder = &AuthorizationStateReady{} - _ bin.BareDecoder = &AuthorizationStateReady{} - - _ AuthorizationStateClass = &AuthorizationStateReady{} -) - -func (a *AuthorizationStateReady) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateReady) String() string { - if a == nil { - return "AuthorizationStateReady(nil)" - } - type Alias AuthorizationStateReady - return fmt.Sprintf("AuthorizationStateReady%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateReady) TypeID() uint32 { - return AuthorizationStateReadyTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateReady) TypeName() string { - return "authorizationStateReady" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateReady) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateReady", - ID: AuthorizationStateReadyTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateReady) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateReady#92a21447 as nil") - } - b.PutID(AuthorizationStateReadyTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateReady) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateReady#92a21447 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateReady) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateReady#92a21447 to nil") - } - if err := b.ConsumeID(AuthorizationStateReadyTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateReady#92a21447: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateReady) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateReady#92a21447 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateReady) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateReady#92a21447 as nil") - } - b.ObjStart() - b.PutID("authorizationStateReady") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateReady) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateReady#92a21447 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateReady"); err != nil { - return fmt.Errorf("unable to decode authorizationStateReady#92a21447: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AuthorizationStateLoggingOut represents TL type `authorizationStateLoggingOut#934b576`. -type AuthorizationStateLoggingOut struct { -} - -// AuthorizationStateLoggingOutTypeID is TL type id of AuthorizationStateLoggingOut. -const AuthorizationStateLoggingOutTypeID = 0x934b576 - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateLoggingOut) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateLoggingOut. -var ( - _ bin.Encoder = &AuthorizationStateLoggingOut{} - _ bin.Decoder = &AuthorizationStateLoggingOut{} - _ bin.BareEncoder = &AuthorizationStateLoggingOut{} - _ bin.BareDecoder = &AuthorizationStateLoggingOut{} - - _ AuthorizationStateClass = &AuthorizationStateLoggingOut{} -) - -func (a *AuthorizationStateLoggingOut) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateLoggingOut) String() string { - if a == nil { - return "AuthorizationStateLoggingOut(nil)" - } - type Alias AuthorizationStateLoggingOut - return fmt.Sprintf("AuthorizationStateLoggingOut%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateLoggingOut) TypeID() uint32 { - return AuthorizationStateLoggingOutTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateLoggingOut) TypeName() string { - return "authorizationStateLoggingOut" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateLoggingOut) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateLoggingOut", - ID: AuthorizationStateLoggingOutTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateLoggingOut) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateLoggingOut#934b576 as nil") - } - b.PutID(AuthorizationStateLoggingOutTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateLoggingOut) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateLoggingOut#934b576 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateLoggingOut) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateLoggingOut#934b576 to nil") - } - if err := b.ConsumeID(AuthorizationStateLoggingOutTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateLoggingOut#934b576: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateLoggingOut) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateLoggingOut#934b576 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateLoggingOut) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateLoggingOut#934b576 as nil") - } - b.ObjStart() - b.PutID("authorizationStateLoggingOut") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateLoggingOut) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateLoggingOut#934b576 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateLoggingOut"); err != nil { - return fmt.Errorf("unable to decode authorizationStateLoggingOut#934b576: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AuthorizationStateClosing represents TL type `authorizationStateClosing#1a93364f`. -type AuthorizationStateClosing struct { -} - -// AuthorizationStateClosingTypeID is TL type id of AuthorizationStateClosing. -const AuthorizationStateClosingTypeID = 0x1a93364f - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateClosing) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateClosing. -var ( - _ bin.Encoder = &AuthorizationStateClosing{} - _ bin.Decoder = &AuthorizationStateClosing{} - _ bin.BareEncoder = &AuthorizationStateClosing{} - _ bin.BareDecoder = &AuthorizationStateClosing{} - - _ AuthorizationStateClass = &AuthorizationStateClosing{} -) - -func (a *AuthorizationStateClosing) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateClosing) String() string { - if a == nil { - return "AuthorizationStateClosing(nil)" - } - type Alias AuthorizationStateClosing - return fmt.Sprintf("AuthorizationStateClosing%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateClosing) TypeID() uint32 { - return AuthorizationStateClosingTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateClosing) TypeName() string { - return "authorizationStateClosing" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateClosing) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateClosing", - ID: AuthorizationStateClosingTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateClosing) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateClosing#1a93364f as nil") - } - b.PutID(AuthorizationStateClosingTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateClosing) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateClosing#1a93364f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateClosing) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateClosing#1a93364f to nil") - } - if err := b.ConsumeID(AuthorizationStateClosingTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateClosing#1a93364f: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateClosing) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateClosing#1a93364f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateClosing) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateClosing#1a93364f as nil") - } - b.ObjStart() - b.PutID("authorizationStateClosing") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateClosing) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateClosing#1a93364f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateClosing"); err != nil { - return fmt.Errorf("unable to decode authorizationStateClosing#1a93364f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AuthorizationStateClosed represents TL type `authorizationStateClosed#5af5a360`. -type AuthorizationStateClosed struct { -} - -// AuthorizationStateClosedTypeID is TL type id of AuthorizationStateClosed. -const AuthorizationStateClosedTypeID = 0x5af5a360 - -// construct implements constructor of AuthorizationStateClass. -func (a AuthorizationStateClosed) construct() AuthorizationStateClass { return &a } - -// Ensuring interfaces in compile-time for AuthorizationStateClosed. -var ( - _ bin.Encoder = &AuthorizationStateClosed{} - _ bin.Decoder = &AuthorizationStateClosed{} - _ bin.BareEncoder = &AuthorizationStateClosed{} - _ bin.BareDecoder = &AuthorizationStateClosed{} - - _ AuthorizationStateClass = &AuthorizationStateClosed{} -) - -func (a *AuthorizationStateClosed) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AuthorizationStateClosed) String() string { - if a == nil { - return "AuthorizationStateClosed(nil)" - } - type Alias AuthorizationStateClosed - return fmt.Sprintf("AuthorizationStateClosed%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AuthorizationStateClosed) TypeID() uint32 { - return AuthorizationStateClosedTypeID -} - -// TypeName returns name of type in TL schema. -func (*AuthorizationStateClosed) TypeName() string { - return "authorizationStateClosed" -} - -// TypeInfo returns info about TL type. -func (a *AuthorizationStateClosed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "authorizationStateClosed", - ID: AuthorizationStateClosedTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AuthorizationStateClosed) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateClosed#5af5a360 as nil") - } - b.PutID(AuthorizationStateClosedTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AuthorizationStateClosed) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateClosed#5af5a360 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AuthorizationStateClosed) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateClosed#5af5a360 to nil") - } - if err := b.ConsumeID(AuthorizationStateClosedTypeID); err != nil { - return fmt.Errorf("unable to decode authorizationStateClosed#5af5a360: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AuthorizationStateClosed) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateClosed#5af5a360 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AuthorizationStateClosed) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode authorizationStateClosed#5af5a360 as nil") - } - b.ObjStart() - b.PutID("authorizationStateClosed") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AuthorizationStateClosed) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode authorizationStateClosed#5af5a360 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("authorizationStateClosed"); err != nil { - return fmt.Errorf("unable to decode authorizationStateClosed#5af5a360: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AuthorizationStateClassName is schema name of AuthorizationStateClass. -const AuthorizationStateClassName = "AuthorizationState" - -// AuthorizationStateClass represents AuthorizationState generic type. -// -// Example: -// -// g, err := tdapi.DecodeAuthorizationState(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.AuthorizationStateWaitTdlibParameters: // authorizationStateWaitTdlibParameters#35ecf25c -// case *tdapi.AuthorizationStateWaitPhoneNumber: // authorizationStateWaitPhoneNumber#124354e3 -// case *tdapi.AuthorizationStateWaitEmailAddress: // authorizationStateWaitEmailAddress#3e0471c7 -// case *tdapi.AuthorizationStateWaitEmailCode: // authorizationStateWaitEmailCode#909f025b -// case *tdapi.AuthorizationStateWaitCode: // authorizationStateWaitCode#3234501 -// case *tdapi.AuthorizationStateWaitOtherDeviceConfirmation: // authorizationStateWaitOtherDeviceConfirmation#334518ea -// case *tdapi.AuthorizationStateWaitRegistration: // authorizationStateWaitRegistration#20cdaeaf -// case *tdapi.AuthorizationStateWaitPassword: // authorizationStateWaitPassword#6b09dce -// case *tdapi.AuthorizationStateReady: // authorizationStateReady#92a21447 -// case *tdapi.AuthorizationStateLoggingOut: // authorizationStateLoggingOut#934b576 -// case *tdapi.AuthorizationStateClosing: // authorizationStateClosing#1a93364f -// case *tdapi.AuthorizationStateClosed: // authorizationStateClosed#5af5a360 -// default: panic(v) -// } -type AuthorizationStateClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() AuthorizationStateClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeAuthorizationState implements binary de-serialization for AuthorizationStateClass. -func DecodeAuthorizationState(buf *bin.Buffer) (AuthorizationStateClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case AuthorizationStateWaitTdlibParametersTypeID: - // Decoding authorizationStateWaitTdlibParameters#35ecf25c. - v := AuthorizationStateWaitTdlibParameters{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case AuthorizationStateWaitPhoneNumberTypeID: - // Decoding authorizationStateWaitPhoneNumber#124354e3. - v := AuthorizationStateWaitPhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case AuthorizationStateWaitEmailAddressTypeID: - // Decoding authorizationStateWaitEmailAddress#3e0471c7. - v := AuthorizationStateWaitEmailAddress{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case AuthorizationStateWaitEmailCodeTypeID: - // Decoding authorizationStateWaitEmailCode#909f025b. - v := AuthorizationStateWaitEmailCode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case AuthorizationStateWaitCodeTypeID: - // Decoding authorizationStateWaitCode#3234501. - v := AuthorizationStateWaitCode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case AuthorizationStateWaitOtherDeviceConfirmationTypeID: - // Decoding authorizationStateWaitOtherDeviceConfirmation#334518ea. - v := AuthorizationStateWaitOtherDeviceConfirmation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case AuthorizationStateWaitRegistrationTypeID: - // Decoding authorizationStateWaitRegistration#20cdaeaf. - v := AuthorizationStateWaitRegistration{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case AuthorizationStateWaitPasswordTypeID: - // Decoding authorizationStateWaitPassword#6b09dce. - v := AuthorizationStateWaitPassword{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case AuthorizationStateReadyTypeID: - // Decoding authorizationStateReady#92a21447. - v := AuthorizationStateReady{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case AuthorizationStateLoggingOutTypeID: - // Decoding authorizationStateLoggingOut#934b576. - v := AuthorizationStateLoggingOut{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case AuthorizationStateClosingTypeID: - // Decoding authorizationStateClosing#1a93364f. - v := AuthorizationStateClosing{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case AuthorizationStateClosedTypeID: - // Decoding authorizationStateClosed#5af5a360. - v := AuthorizationStateClosed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONAuthorizationState implements binary de-serialization for AuthorizationStateClass. -func DecodeTDLibJSONAuthorizationState(buf tdjson.Decoder) (AuthorizationStateClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "authorizationStateWaitTdlibParameters": - // Decoding authorizationStateWaitTdlibParameters#35ecf25c. - v := AuthorizationStateWaitTdlibParameters{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case "authorizationStateWaitPhoneNumber": - // Decoding authorizationStateWaitPhoneNumber#124354e3. - v := AuthorizationStateWaitPhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case "authorizationStateWaitEmailAddress": - // Decoding authorizationStateWaitEmailAddress#3e0471c7. - v := AuthorizationStateWaitEmailAddress{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case "authorizationStateWaitEmailCode": - // Decoding authorizationStateWaitEmailCode#909f025b. - v := AuthorizationStateWaitEmailCode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case "authorizationStateWaitCode": - // Decoding authorizationStateWaitCode#3234501. - v := AuthorizationStateWaitCode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case "authorizationStateWaitOtherDeviceConfirmation": - // Decoding authorizationStateWaitOtherDeviceConfirmation#334518ea. - v := AuthorizationStateWaitOtherDeviceConfirmation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case "authorizationStateWaitRegistration": - // Decoding authorizationStateWaitRegistration#20cdaeaf. - v := AuthorizationStateWaitRegistration{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case "authorizationStateWaitPassword": - // Decoding authorizationStateWaitPassword#6b09dce. - v := AuthorizationStateWaitPassword{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case "authorizationStateReady": - // Decoding authorizationStateReady#92a21447. - v := AuthorizationStateReady{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case "authorizationStateLoggingOut": - // Decoding authorizationStateLoggingOut#934b576. - v := AuthorizationStateLoggingOut{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case "authorizationStateClosing": - // Decoding authorizationStateClosing#1a93364f. - v := AuthorizationStateClosing{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - case "authorizationStateClosed": - // Decoding authorizationStateClosed#5af5a360. - v := AuthorizationStateClosed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode AuthorizationStateClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// AuthorizationState boxes the AuthorizationStateClass providing a helper. -type AuthorizationStateBox struct { - AuthorizationState AuthorizationStateClass -} - -// Decode implements bin.Decoder for AuthorizationStateBox. -func (b *AuthorizationStateBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode AuthorizationStateBox to nil") - } - v, err := DecodeAuthorizationState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.AuthorizationState = v - return nil -} - -// Encode implements bin.Encode for AuthorizationStateBox. -func (b *AuthorizationStateBox) Encode(buf *bin.Buffer) error { - if b == nil || b.AuthorizationState == nil { - return fmt.Errorf("unable to encode AuthorizationStateClass as nil") - } - return b.AuthorizationState.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for AuthorizationStateBox. -func (b *AuthorizationStateBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode AuthorizationStateBox to nil") - } - v, err := DecodeTDLibJSONAuthorizationState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.AuthorizationState = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for AuthorizationStateBox. -func (b *AuthorizationStateBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.AuthorizationState == nil { - return fmt.Errorf("unable to encode AuthorizationStateClass as nil") - } - return b.AuthorizationState.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_auto_download_settings_gen.go b/tdapi/tl_auto_download_settings_gen.go deleted file mode 100644 index eb0e2f718..000000000 --- a/tdapi/tl_auto_download_settings_gen.go +++ /dev/null @@ -1,466 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AutoDownloadSettings represents TL type `autoDownloadSettings#3b1813e0`. -type AutoDownloadSettings struct { - // True, if the auto-download is enabled - IsAutoDownloadEnabled bool - // The maximum size of a photo file to be auto-downloaded, in bytes - MaxPhotoFileSize int32 - // The maximum size of a video file to be auto-downloaded, in bytes - MaxVideoFileSize int64 - // The maximum size of other file types to be auto-downloaded, in bytes - MaxOtherFileSize int64 - // The maximum suggested bitrate for uploaded videos, in kbit/s - VideoUploadBitrate int32 - // True, if the beginning of video files needs to be preloaded for instant playback - PreloadLargeVideos bool - // True, if the next audio track needs to be preloaded while the user is listening to an - // audio file - PreloadNextAudio bool - // True, if stories needs to be preloaded - PreloadStories bool - // True, if "use less data for calls" option needs to be enabled - UseLessDataForCalls bool -} - -// AutoDownloadSettingsTypeID is TL type id of AutoDownloadSettings. -const AutoDownloadSettingsTypeID = 0x3b1813e0 - -// Ensuring interfaces in compile-time for AutoDownloadSettings. -var ( - _ bin.Encoder = &AutoDownloadSettings{} - _ bin.Decoder = &AutoDownloadSettings{} - _ bin.BareEncoder = &AutoDownloadSettings{} - _ bin.BareDecoder = &AutoDownloadSettings{} -) - -func (a *AutoDownloadSettings) Zero() bool { - if a == nil { - return true - } - if !(a.IsAutoDownloadEnabled == false) { - return false - } - if !(a.MaxPhotoFileSize == 0) { - return false - } - if !(a.MaxVideoFileSize == 0) { - return false - } - if !(a.MaxOtherFileSize == 0) { - return false - } - if !(a.VideoUploadBitrate == 0) { - return false - } - if !(a.PreloadLargeVideos == false) { - return false - } - if !(a.PreloadNextAudio == false) { - return false - } - if !(a.PreloadStories == false) { - return false - } - if !(a.UseLessDataForCalls == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AutoDownloadSettings) String() string { - if a == nil { - return "AutoDownloadSettings(nil)" - } - type Alias AutoDownloadSettings - return fmt.Sprintf("AutoDownloadSettings%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AutoDownloadSettings) TypeID() uint32 { - return AutoDownloadSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*AutoDownloadSettings) TypeName() string { - return "autoDownloadSettings" -} - -// TypeInfo returns info about TL type. -func (a *AutoDownloadSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "autoDownloadSettings", - ID: AutoDownloadSettingsTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsAutoDownloadEnabled", - SchemaName: "is_auto_download_enabled", - }, - { - Name: "MaxPhotoFileSize", - SchemaName: "max_photo_file_size", - }, - { - Name: "MaxVideoFileSize", - SchemaName: "max_video_file_size", - }, - { - Name: "MaxOtherFileSize", - SchemaName: "max_other_file_size", - }, - { - Name: "VideoUploadBitrate", - SchemaName: "video_upload_bitrate", - }, - { - Name: "PreloadLargeVideos", - SchemaName: "preload_large_videos", - }, - { - Name: "PreloadNextAudio", - SchemaName: "preload_next_audio", - }, - { - Name: "PreloadStories", - SchemaName: "preload_stories", - }, - { - Name: "UseLessDataForCalls", - SchemaName: "use_less_data_for_calls", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AutoDownloadSettings) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autoDownloadSettings#3b1813e0 as nil") - } - b.PutID(AutoDownloadSettingsTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AutoDownloadSettings) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autoDownloadSettings#3b1813e0 as nil") - } - b.PutBool(a.IsAutoDownloadEnabled) - b.PutInt32(a.MaxPhotoFileSize) - b.PutInt53(a.MaxVideoFileSize) - b.PutInt53(a.MaxOtherFileSize) - b.PutInt32(a.VideoUploadBitrate) - b.PutBool(a.PreloadLargeVideos) - b.PutBool(a.PreloadNextAudio) - b.PutBool(a.PreloadStories) - b.PutBool(a.UseLessDataForCalls) - return nil -} - -// Decode implements bin.Decoder. -func (a *AutoDownloadSettings) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autoDownloadSettings#3b1813e0 to nil") - } - if err := b.ConsumeID(AutoDownloadSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AutoDownloadSettings) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autoDownloadSettings#3b1813e0 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field is_auto_download_enabled: %w", err) - } - a.IsAutoDownloadEnabled = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field max_photo_file_size: %w", err) - } - a.MaxPhotoFileSize = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field max_video_file_size: %w", err) - } - a.MaxVideoFileSize = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field max_other_file_size: %w", err) - } - a.MaxOtherFileSize = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field video_upload_bitrate: %w", err) - } - a.VideoUploadBitrate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field preload_large_videos: %w", err) - } - a.PreloadLargeVideos = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field preload_next_audio: %w", err) - } - a.PreloadNextAudio = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field preload_stories: %w", err) - } - a.PreloadStories = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field use_less_data_for_calls: %w", err) - } - a.UseLessDataForCalls = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AutoDownloadSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode autoDownloadSettings#3b1813e0 as nil") - } - b.ObjStart() - b.PutID("autoDownloadSettings") - b.Comma() - b.FieldStart("is_auto_download_enabled") - b.PutBool(a.IsAutoDownloadEnabled) - b.Comma() - b.FieldStart("max_photo_file_size") - b.PutInt32(a.MaxPhotoFileSize) - b.Comma() - b.FieldStart("max_video_file_size") - b.PutInt53(a.MaxVideoFileSize) - b.Comma() - b.FieldStart("max_other_file_size") - b.PutInt53(a.MaxOtherFileSize) - b.Comma() - b.FieldStart("video_upload_bitrate") - b.PutInt32(a.VideoUploadBitrate) - b.Comma() - b.FieldStart("preload_large_videos") - b.PutBool(a.PreloadLargeVideos) - b.Comma() - b.FieldStart("preload_next_audio") - b.PutBool(a.PreloadNextAudio) - b.Comma() - b.FieldStart("preload_stories") - b.PutBool(a.PreloadStories) - b.Comma() - b.FieldStart("use_less_data_for_calls") - b.PutBool(a.UseLessDataForCalls) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AutoDownloadSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode autoDownloadSettings#3b1813e0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("autoDownloadSettings"); err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: %w", err) - } - case "is_auto_download_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field is_auto_download_enabled: %w", err) - } - a.IsAutoDownloadEnabled = value - case "max_photo_file_size": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field max_photo_file_size: %w", err) - } - a.MaxPhotoFileSize = value - case "max_video_file_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field max_video_file_size: %w", err) - } - a.MaxVideoFileSize = value - case "max_other_file_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field max_other_file_size: %w", err) - } - a.MaxOtherFileSize = value - case "video_upload_bitrate": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field video_upload_bitrate: %w", err) - } - a.VideoUploadBitrate = value - case "preload_large_videos": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field preload_large_videos: %w", err) - } - a.PreloadLargeVideos = value - case "preload_next_audio": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field preload_next_audio: %w", err) - } - a.PreloadNextAudio = value - case "preload_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field preload_stories: %w", err) - } - a.PreloadStories = value - case "use_less_data_for_calls": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode autoDownloadSettings#3b1813e0: field use_less_data_for_calls: %w", err) - } - a.UseLessDataForCalls = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsAutoDownloadEnabled returns value of IsAutoDownloadEnabled field. -func (a *AutoDownloadSettings) GetIsAutoDownloadEnabled() (value bool) { - if a == nil { - return - } - return a.IsAutoDownloadEnabled -} - -// GetMaxPhotoFileSize returns value of MaxPhotoFileSize field. -func (a *AutoDownloadSettings) GetMaxPhotoFileSize() (value int32) { - if a == nil { - return - } - return a.MaxPhotoFileSize -} - -// GetMaxVideoFileSize returns value of MaxVideoFileSize field. -func (a *AutoDownloadSettings) GetMaxVideoFileSize() (value int64) { - if a == nil { - return - } - return a.MaxVideoFileSize -} - -// GetMaxOtherFileSize returns value of MaxOtherFileSize field. -func (a *AutoDownloadSettings) GetMaxOtherFileSize() (value int64) { - if a == nil { - return - } - return a.MaxOtherFileSize -} - -// GetVideoUploadBitrate returns value of VideoUploadBitrate field. -func (a *AutoDownloadSettings) GetVideoUploadBitrate() (value int32) { - if a == nil { - return - } - return a.VideoUploadBitrate -} - -// GetPreloadLargeVideos returns value of PreloadLargeVideos field. -func (a *AutoDownloadSettings) GetPreloadLargeVideos() (value bool) { - if a == nil { - return - } - return a.PreloadLargeVideos -} - -// GetPreloadNextAudio returns value of PreloadNextAudio field. -func (a *AutoDownloadSettings) GetPreloadNextAudio() (value bool) { - if a == nil { - return - } - return a.PreloadNextAudio -} - -// GetPreloadStories returns value of PreloadStories field. -func (a *AutoDownloadSettings) GetPreloadStories() (value bool) { - if a == nil { - return - } - return a.PreloadStories -} - -// GetUseLessDataForCalls returns value of UseLessDataForCalls field. -func (a *AutoDownloadSettings) GetUseLessDataForCalls() (value bool) { - if a == nil { - return - } - return a.UseLessDataForCalls -} diff --git a/tdapi/tl_auto_download_settings_presets_gen.go b/tdapi/tl_auto_download_settings_presets_gen.go deleted file mode 100644 index 7149b492d..000000000 --- a/tdapi/tl_auto_download_settings_presets_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AutoDownloadSettingsPresets represents TL type `autoDownloadSettingsPresets#d1621d22`. -type AutoDownloadSettingsPresets struct { - // Preset with lowest settings; expected to be used by default when roaming - Low AutoDownloadSettings - // Preset with medium settings; expected to be used by default when using mobile data - Medium AutoDownloadSettings - // Preset with highest settings; expected to be used by default when connected on Wi-Fi - High AutoDownloadSettings -} - -// AutoDownloadSettingsPresetsTypeID is TL type id of AutoDownloadSettingsPresets. -const AutoDownloadSettingsPresetsTypeID = 0xd1621d22 - -// Ensuring interfaces in compile-time for AutoDownloadSettingsPresets. -var ( - _ bin.Encoder = &AutoDownloadSettingsPresets{} - _ bin.Decoder = &AutoDownloadSettingsPresets{} - _ bin.BareEncoder = &AutoDownloadSettingsPresets{} - _ bin.BareDecoder = &AutoDownloadSettingsPresets{} -) - -func (a *AutoDownloadSettingsPresets) Zero() bool { - if a == nil { - return true - } - if !(a.Low.Zero()) { - return false - } - if !(a.Medium.Zero()) { - return false - } - if !(a.High.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AutoDownloadSettingsPresets) String() string { - if a == nil { - return "AutoDownloadSettingsPresets(nil)" - } - type Alias AutoDownloadSettingsPresets - return fmt.Sprintf("AutoDownloadSettingsPresets%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AutoDownloadSettingsPresets) TypeID() uint32 { - return AutoDownloadSettingsPresetsTypeID -} - -// TypeName returns name of type in TL schema. -func (*AutoDownloadSettingsPresets) TypeName() string { - return "autoDownloadSettingsPresets" -} - -// TypeInfo returns info about TL type. -func (a *AutoDownloadSettingsPresets) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "autoDownloadSettingsPresets", - ID: AutoDownloadSettingsPresetsTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Low", - SchemaName: "low", - }, - { - Name: "Medium", - SchemaName: "medium", - }, - { - Name: "High", - SchemaName: "high", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AutoDownloadSettingsPresets) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autoDownloadSettingsPresets#d1621d22 as nil") - } - b.PutID(AutoDownloadSettingsPresetsTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AutoDownloadSettingsPresets) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autoDownloadSettingsPresets#d1621d22 as nil") - } - if err := a.Low.Encode(b); err != nil { - return fmt.Errorf("unable to encode autoDownloadSettingsPresets#d1621d22: field low: %w", err) - } - if err := a.Medium.Encode(b); err != nil { - return fmt.Errorf("unable to encode autoDownloadSettingsPresets#d1621d22: field medium: %w", err) - } - if err := a.High.Encode(b); err != nil { - return fmt.Errorf("unable to encode autoDownloadSettingsPresets#d1621d22: field high: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AutoDownloadSettingsPresets) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autoDownloadSettingsPresets#d1621d22 to nil") - } - if err := b.ConsumeID(AutoDownloadSettingsPresetsTypeID); err != nil { - return fmt.Errorf("unable to decode autoDownloadSettingsPresets#d1621d22: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AutoDownloadSettingsPresets) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autoDownloadSettingsPresets#d1621d22 to nil") - } - { - if err := a.Low.Decode(b); err != nil { - return fmt.Errorf("unable to decode autoDownloadSettingsPresets#d1621d22: field low: %w", err) - } - } - { - if err := a.Medium.Decode(b); err != nil { - return fmt.Errorf("unable to decode autoDownloadSettingsPresets#d1621d22: field medium: %w", err) - } - } - { - if err := a.High.Decode(b); err != nil { - return fmt.Errorf("unable to decode autoDownloadSettingsPresets#d1621d22: field high: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AutoDownloadSettingsPresets) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode autoDownloadSettingsPresets#d1621d22 as nil") - } - b.ObjStart() - b.PutID("autoDownloadSettingsPresets") - b.Comma() - b.FieldStart("low") - if err := a.Low.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode autoDownloadSettingsPresets#d1621d22: field low: %w", err) - } - b.Comma() - b.FieldStart("medium") - if err := a.Medium.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode autoDownloadSettingsPresets#d1621d22: field medium: %w", err) - } - b.Comma() - b.FieldStart("high") - if err := a.High.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode autoDownloadSettingsPresets#d1621d22: field high: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AutoDownloadSettingsPresets) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode autoDownloadSettingsPresets#d1621d22 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("autoDownloadSettingsPresets"); err != nil { - return fmt.Errorf("unable to decode autoDownloadSettingsPresets#d1621d22: %w", err) - } - case "low": - if err := a.Low.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode autoDownloadSettingsPresets#d1621d22: field low: %w", err) - } - case "medium": - if err := a.Medium.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode autoDownloadSettingsPresets#d1621d22: field medium: %w", err) - } - case "high": - if err := a.High.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode autoDownloadSettingsPresets#d1621d22: field high: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLow returns value of Low field. -func (a *AutoDownloadSettingsPresets) GetLow() (value AutoDownloadSettings) { - if a == nil { - return - } - return a.Low -} - -// GetMedium returns value of Medium field. -func (a *AutoDownloadSettingsPresets) GetMedium() (value AutoDownloadSettings) { - if a == nil { - return - } - return a.Medium -} - -// GetHigh returns value of High field. -func (a *AutoDownloadSettingsPresets) GetHigh() (value AutoDownloadSettings) { - if a == nil { - return - } - return a.High -} diff --git a/tdapi/tl_autosave_settings_exception_gen.go b/tdapi/tl_autosave_settings_exception_gen.go deleted file mode 100644 index e09b3746c..000000000 --- a/tdapi/tl_autosave_settings_exception_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AutosaveSettingsException represents TL type `autosaveSettingsException#586bf5c8`. -type AutosaveSettingsException struct { - // Chat identifier - ChatID int64 - // Autosave settings for the chat - Settings ScopeAutosaveSettings -} - -// AutosaveSettingsExceptionTypeID is TL type id of AutosaveSettingsException. -const AutosaveSettingsExceptionTypeID = 0x586bf5c8 - -// Ensuring interfaces in compile-time for AutosaveSettingsException. -var ( - _ bin.Encoder = &AutosaveSettingsException{} - _ bin.Decoder = &AutosaveSettingsException{} - _ bin.BareEncoder = &AutosaveSettingsException{} - _ bin.BareDecoder = &AutosaveSettingsException{} -) - -func (a *AutosaveSettingsException) Zero() bool { - if a == nil { - return true - } - if !(a.ChatID == 0) { - return false - } - if !(a.Settings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AutosaveSettingsException) String() string { - if a == nil { - return "AutosaveSettingsException(nil)" - } - type Alias AutosaveSettingsException - return fmt.Sprintf("AutosaveSettingsException%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AutosaveSettingsException) TypeID() uint32 { - return AutosaveSettingsExceptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*AutosaveSettingsException) TypeName() string { - return "autosaveSettingsException" -} - -// TypeInfo returns info about TL type. -func (a *AutosaveSettingsException) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "autosaveSettingsException", - ID: AutosaveSettingsExceptionTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Settings", - SchemaName: "settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AutosaveSettingsException) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsException#586bf5c8 as nil") - } - b.PutID(AutosaveSettingsExceptionTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AutosaveSettingsException) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsException#586bf5c8 as nil") - } - b.PutInt53(a.ChatID) - if err := a.Settings.Encode(b); err != nil { - return fmt.Errorf("unable to encode autosaveSettingsException#586bf5c8: field settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AutosaveSettingsException) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsException#586bf5c8 to nil") - } - if err := b.ConsumeID(AutosaveSettingsExceptionTypeID); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsException#586bf5c8: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AutosaveSettingsException) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsException#586bf5c8 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode autosaveSettingsException#586bf5c8: field chat_id: %w", err) - } - a.ChatID = value - } - { - if err := a.Settings.Decode(b); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsException#586bf5c8: field settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AutosaveSettingsException) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsException#586bf5c8 as nil") - } - b.ObjStart() - b.PutID("autosaveSettingsException") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.FieldStart("settings") - if err := a.Settings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode autosaveSettingsException#586bf5c8: field settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AutosaveSettingsException) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsException#586bf5c8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("autosaveSettingsException"); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsException#586bf5c8: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode autosaveSettingsException#586bf5c8: field chat_id: %w", err) - } - a.ChatID = value - case "settings": - if err := a.Settings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsException#586bf5c8: field settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (a *AutosaveSettingsException) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// GetSettings returns value of Settings field. -func (a *AutosaveSettingsException) GetSettings() (value ScopeAutosaveSettings) { - if a == nil { - return - } - return a.Settings -} diff --git a/tdapi/tl_autosave_settings_gen.go b/tdapi/tl_autosave_settings_gen.go deleted file mode 100644 index 2c336228b..000000000 --- a/tdapi/tl_autosave_settings_gen.go +++ /dev/null @@ -1,323 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AutosaveSettings represents TL type `autosaveSettings#c0d11a28`. -type AutosaveSettings struct { - // Default autosave settings for private chats - PrivateChatSettings ScopeAutosaveSettings - // Default autosave settings for basic group and supergroup chats - GroupSettings ScopeAutosaveSettings - // Default autosave settings for channel chats - ChannelSettings ScopeAutosaveSettings - // Autosave settings for specific chats - Exceptions []AutosaveSettingsException -} - -// AutosaveSettingsTypeID is TL type id of AutosaveSettings. -const AutosaveSettingsTypeID = 0xc0d11a28 - -// Ensuring interfaces in compile-time for AutosaveSettings. -var ( - _ bin.Encoder = &AutosaveSettings{} - _ bin.Decoder = &AutosaveSettings{} - _ bin.BareEncoder = &AutosaveSettings{} - _ bin.BareDecoder = &AutosaveSettings{} -) - -func (a *AutosaveSettings) Zero() bool { - if a == nil { - return true - } - if !(a.PrivateChatSettings.Zero()) { - return false - } - if !(a.GroupSettings.Zero()) { - return false - } - if !(a.ChannelSettings.Zero()) { - return false - } - if !(a.Exceptions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AutosaveSettings) String() string { - if a == nil { - return "AutosaveSettings(nil)" - } - type Alias AutosaveSettings - return fmt.Sprintf("AutosaveSettings%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AutosaveSettings) TypeID() uint32 { - return AutosaveSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*AutosaveSettings) TypeName() string { - return "autosaveSettings" -} - -// TypeInfo returns info about TL type. -func (a *AutosaveSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "autosaveSettings", - ID: AutosaveSettingsTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PrivateChatSettings", - SchemaName: "private_chat_settings", - }, - { - Name: "GroupSettings", - SchemaName: "group_settings", - }, - { - Name: "ChannelSettings", - SchemaName: "channel_settings", - }, - { - Name: "Exceptions", - SchemaName: "exceptions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AutosaveSettings) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettings#c0d11a28 as nil") - } - b.PutID(AutosaveSettingsTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AutosaveSettings) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettings#c0d11a28 as nil") - } - if err := a.PrivateChatSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode autosaveSettings#c0d11a28: field private_chat_settings: %w", err) - } - if err := a.GroupSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode autosaveSettings#c0d11a28: field group_settings: %w", err) - } - if err := a.ChannelSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode autosaveSettings#c0d11a28: field channel_settings: %w", err) - } - b.PutInt(len(a.Exceptions)) - for idx, v := range a.Exceptions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare autosaveSettings#c0d11a28: field exceptions element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AutosaveSettings) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettings#c0d11a28 to nil") - } - if err := b.ConsumeID(AutosaveSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode autosaveSettings#c0d11a28: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AutosaveSettings) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettings#c0d11a28 to nil") - } - { - if err := a.PrivateChatSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode autosaveSettings#c0d11a28: field private_chat_settings: %w", err) - } - } - { - if err := a.GroupSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode autosaveSettings#c0d11a28: field group_settings: %w", err) - } - } - { - if err := a.ChannelSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode autosaveSettings#c0d11a28: field channel_settings: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode autosaveSettings#c0d11a28: field exceptions: %w", err) - } - - if headerLen > 0 { - a.Exceptions = make([]AutosaveSettingsException, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value AutosaveSettingsException - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare autosaveSettings#c0d11a28: field exceptions: %w", err) - } - a.Exceptions = append(a.Exceptions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AutosaveSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettings#c0d11a28 as nil") - } - b.ObjStart() - b.PutID("autosaveSettings") - b.Comma() - b.FieldStart("private_chat_settings") - if err := a.PrivateChatSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode autosaveSettings#c0d11a28: field private_chat_settings: %w", err) - } - b.Comma() - b.FieldStart("group_settings") - if err := a.GroupSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode autosaveSettings#c0d11a28: field group_settings: %w", err) - } - b.Comma() - b.FieldStart("channel_settings") - if err := a.ChannelSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode autosaveSettings#c0d11a28: field channel_settings: %w", err) - } - b.Comma() - b.FieldStart("exceptions") - b.ArrStart() - for idx, v := range a.Exceptions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode autosaveSettings#c0d11a28: field exceptions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AutosaveSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettings#c0d11a28 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("autosaveSettings"); err != nil { - return fmt.Errorf("unable to decode autosaveSettings#c0d11a28: %w", err) - } - case "private_chat_settings": - if err := a.PrivateChatSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode autosaveSettings#c0d11a28: field private_chat_settings: %w", err) - } - case "group_settings": - if err := a.GroupSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode autosaveSettings#c0d11a28: field group_settings: %w", err) - } - case "channel_settings": - if err := a.ChannelSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode autosaveSettings#c0d11a28: field channel_settings: %w", err) - } - case "exceptions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value AutosaveSettingsException - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode autosaveSettings#c0d11a28: field exceptions: %w", err) - } - a.Exceptions = append(a.Exceptions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode autosaveSettings#c0d11a28: field exceptions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPrivateChatSettings returns value of PrivateChatSettings field. -func (a *AutosaveSettings) GetPrivateChatSettings() (value ScopeAutosaveSettings) { - if a == nil { - return - } - return a.PrivateChatSettings -} - -// GetGroupSettings returns value of GroupSettings field. -func (a *AutosaveSettings) GetGroupSettings() (value ScopeAutosaveSettings) { - if a == nil { - return - } - return a.GroupSettings -} - -// GetChannelSettings returns value of ChannelSettings field. -func (a *AutosaveSettings) GetChannelSettings() (value ScopeAutosaveSettings) { - if a == nil { - return - } - return a.ChannelSettings -} - -// GetExceptions returns value of Exceptions field. -func (a *AutosaveSettings) GetExceptions() (value []AutosaveSettingsException) { - if a == nil { - return - } - return a.Exceptions -} diff --git a/tdapi/tl_autosave_settings_scope_gen.go b/tdapi/tl_autosave_settings_scope_gen.go deleted file mode 100644 index 0870ba3fc..000000000 --- a/tdapi/tl_autosave_settings_scope_gen.go +++ /dev/null @@ -1,758 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AutosaveSettingsScopePrivateChats represents TL type `autosaveSettingsScopePrivateChats#5329797f`. -type AutosaveSettingsScopePrivateChats struct { -} - -// AutosaveSettingsScopePrivateChatsTypeID is TL type id of AutosaveSettingsScopePrivateChats. -const AutosaveSettingsScopePrivateChatsTypeID = 0x5329797f - -// construct implements constructor of AutosaveSettingsScopeClass. -func (a AutosaveSettingsScopePrivateChats) construct() AutosaveSettingsScopeClass { return &a } - -// Ensuring interfaces in compile-time for AutosaveSettingsScopePrivateChats. -var ( - _ bin.Encoder = &AutosaveSettingsScopePrivateChats{} - _ bin.Decoder = &AutosaveSettingsScopePrivateChats{} - _ bin.BareEncoder = &AutosaveSettingsScopePrivateChats{} - _ bin.BareDecoder = &AutosaveSettingsScopePrivateChats{} - - _ AutosaveSettingsScopeClass = &AutosaveSettingsScopePrivateChats{} -) - -func (a *AutosaveSettingsScopePrivateChats) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AutosaveSettingsScopePrivateChats) String() string { - if a == nil { - return "AutosaveSettingsScopePrivateChats(nil)" - } - type Alias AutosaveSettingsScopePrivateChats - return fmt.Sprintf("AutosaveSettingsScopePrivateChats%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AutosaveSettingsScopePrivateChats) TypeID() uint32 { - return AutosaveSettingsScopePrivateChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*AutosaveSettingsScopePrivateChats) TypeName() string { - return "autosaveSettingsScopePrivateChats" -} - -// TypeInfo returns info about TL type. -func (a *AutosaveSettingsScopePrivateChats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "autosaveSettingsScopePrivateChats", - ID: AutosaveSettingsScopePrivateChatsTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AutosaveSettingsScopePrivateChats) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopePrivateChats#5329797f as nil") - } - b.PutID(AutosaveSettingsScopePrivateChatsTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AutosaveSettingsScopePrivateChats) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopePrivateChats#5329797f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AutosaveSettingsScopePrivateChats) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopePrivateChats#5329797f to nil") - } - if err := b.ConsumeID(AutosaveSettingsScopePrivateChatsTypeID); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsScopePrivateChats#5329797f: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AutosaveSettingsScopePrivateChats) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopePrivateChats#5329797f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AutosaveSettingsScopePrivateChats) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopePrivateChats#5329797f as nil") - } - b.ObjStart() - b.PutID("autosaveSettingsScopePrivateChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AutosaveSettingsScopePrivateChats) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopePrivateChats#5329797f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("autosaveSettingsScopePrivateChats"); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsScopePrivateChats#5329797f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AutosaveSettingsScopeGroupChats represents TL type `autosaveSettingsScopeGroupChats#32e00e4e`. -type AutosaveSettingsScopeGroupChats struct { -} - -// AutosaveSettingsScopeGroupChatsTypeID is TL type id of AutosaveSettingsScopeGroupChats. -const AutosaveSettingsScopeGroupChatsTypeID = 0x32e00e4e - -// construct implements constructor of AutosaveSettingsScopeClass. -func (a AutosaveSettingsScopeGroupChats) construct() AutosaveSettingsScopeClass { return &a } - -// Ensuring interfaces in compile-time for AutosaveSettingsScopeGroupChats. -var ( - _ bin.Encoder = &AutosaveSettingsScopeGroupChats{} - _ bin.Decoder = &AutosaveSettingsScopeGroupChats{} - _ bin.BareEncoder = &AutosaveSettingsScopeGroupChats{} - _ bin.BareDecoder = &AutosaveSettingsScopeGroupChats{} - - _ AutosaveSettingsScopeClass = &AutosaveSettingsScopeGroupChats{} -) - -func (a *AutosaveSettingsScopeGroupChats) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AutosaveSettingsScopeGroupChats) String() string { - if a == nil { - return "AutosaveSettingsScopeGroupChats(nil)" - } - type Alias AutosaveSettingsScopeGroupChats - return fmt.Sprintf("AutosaveSettingsScopeGroupChats%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AutosaveSettingsScopeGroupChats) TypeID() uint32 { - return AutosaveSettingsScopeGroupChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*AutosaveSettingsScopeGroupChats) TypeName() string { - return "autosaveSettingsScopeGroupChats" -} - -// TypeInfo returns info about TL type. -func (a *AutosaveSettingsScopeGroupChats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "autosaveSettingsScopeGroupChats", - ID: AutosaveSettingsScopeGroupChatsTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AutosaveSettingsScopeGroupChats) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopeGroupChats#32e00e4e as nil") - } - b.PutID(AutosaveSettingsScopeGroupChatsTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AutosaveSettingsScopeGroupChats) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopeGroupChats#32e00e4e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AutosaveSettingsScopeGroupChats) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopeGroupChats#32e00e4e to nil") - } - if err := b.ConsumeID(AutosaveSettingsScopeGroupChatsTypeID); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsScopeGroupChats#32e00e4e: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AutosaveSettingsScopeGroupChats) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopeGroupChats#32e00e4e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AutosaveSettingsScopeGroupChats) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopeGroupChats#32e00e4e as nil") - } - b.ObjStart() - b.PutID("autosaveSettingsScopeGroupChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AutosaveSettingsScopeGroupChats) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopeGroupChats#32e00e4e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("autosaveSettingsScopeGroupChats"); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsScopeGroupChats#32e00e4e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AutosaveSettingsScopeChannelChats represents TL type `autosaveSettingsScopeChannelChats#e2391fd1`. -type AutosaveSettingsScopeChannelChats struct { -} - -// AutosaveSettingsScopeChannelChatsTypeID is TL type id of AutosaveSettingsScopeChannelChats. -const AutosaveSettingsScopeChannelChatsTypeID = 0xe2391fd1 - -// construct implements constructor of AutosaveSettingsScopeClass. -func (a AutosaveSettingsScopeChannelChats) construct() AutosaveSettingsScopeClass { return &a } - -// Ensuring interfaces in compile-time for AutosaveSettingsScopeChannelChats. -var ( - _ bin.Encoder = &AutosaveSettingsScopeChannelChats{} - _ bin.Decoder = &AutosaveSettingsScopeChannelChats{} - _ bin.BareEncoder = &AutosaveSettingsScopeChannelChats{} - _ bin.BareDecoder = &AutosaveSettingsScopeChannelChats{} - - _ AutosaveSettingsScopeClass = &AutosaveSettingsScopeChannelChats{} -) - -func (a *AutosaveSettingsScopeChannelChats) Zero() bool { - if a == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (a *AutosaveSettingsScopeChannelChats) String() string { - if a == nil { - return "AutosaveSettingsScopeChannelChats(nil)" - } - type Alias AutosaveSettingsScopeChannelChats - return fmt.Sprintf("AutosaveSettingsScopeChannelChats%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AutosaveSettingsScopeChannelChats) TypeID() uint32 { - return AutosaveSettingsScopeChannelChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*AutosaveSettingsScopeChannelChats) TypeName() string { - return "autosaveSettingsScopeChannelChats" -} - -// TypeInfo returns info about TL type. -func (a *AutosaveSettingsScopeChannelChats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "autosaveSettingsScopeChannelChats", - ID: AutosaveSettingsScopeChannelChatsTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (a *AutosaveSettingsScopeChannelChats) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopeChannelChats#e2391fd1 as nil") - } - b.PutID(AutosaveSettingsScopeChannelChatsTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AutosaveSettingsScopeChannelChats) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopeChannelChats#e2391fd1 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AutosaveSettingsScopeChannelChats) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopeChannelChats#e2391fd1 to nil") - } - if err := b.ConsumeID(AutosaveSettingsScopeChannelChatsTypeID); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsScopeChannelChats#e2391fd1: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AutosaveSettingsScopeChannelChats) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopeChannelChats#e2391fd1 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AutosaveSettingsScopeChannelChats) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopeChannelChats#e2391fd1 as nil") - } - b.ObjStart() - b.PutID("autosaveSettingsScopeChannelChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AutosaveSettingsScopeChannelChats) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopeChannelChats#e2391fd1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("autosaveSettingsScopeChannelChats"); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsScopeChannelChats#e2391fd1: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// AutosaveSettingsScopeChat represents TL type `autosaveSettingsScopeChat#9eb5c2e9`. -type AutosaveSettingsScopeChat struct { - // Chat identifier - ChatID int64 -} - -// AutosaveSettingsScopeChatTypeID is TL type id of AutosaveSettingsScopeChat. -const AutosaveSettingsScopeChatTypeID = 0x9eb5c2e9 - -// construct implements constructor of AutosaveSettingsScopeClass. -func (a AutosaveSettingsScopeChat) construct() AutosaveSettingsScopeClass { return &a } - -// Ensuring interfaces in compile-time for AutosaveSettingsScopeChat. -var ( - _ bin.Encoder = &AutosaveSettingsScopeChat{} - _ bin.Decoder = &AutosaveSettingsScopeChat{} - _ bin.BareEncoder = &AutosaveSettingsScopeChat{} - _ bin.BareDecoder = &AutosaveSettingsScopeChat{} - - _ AutosaveSettingsScopeClass = &AutosaveSettingsScopeChat{} -) - -func (a *AutosaveSettingsScopeChat) Zero() bool { - if a == nil { - return true - } - if !(a.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AutosaveSettingsScopeChat) String() string { - if a == nil { - return "AutosaveSettingsScopeChat(nil)" - } - type Alias AutosaveSettingsScopeChat - return fmt.Sprintf("AutosaveSettingsScopeChat%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AutosaveSettingsScopeChat) TypeID() uint32 { - return AutosaveSettingsScopeChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*AutosaveSettingsScopeChat) TypeName() string { - return "autosaveSettingsScopeChat" -} - -// TypeInfo returns info about TL type. -func (a *AutosaveSettingsScopeChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "autosaveSettingsScopeChat", - ID: AutosaveSettingsScopeChatTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AutosaveSettingsScopeChat) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopeChat#9eb5c2e9 as nil") - } - b.PutID(AutosaveSettingsScopeChatTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AutosaveSettingsScopeChat) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopeChat#9eb5c2e9 as nil") - } - b.PutInt53(a.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (a *AutosaveSettingsScopeChat) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopeChat#9eb5c2e9 to nil") - } - if err := b.ConsumeID(AutosaveSettingsScopeChatTypeID); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsScopeChat#9eb5c2e9: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AutosaveSettingsScopeChat) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopeChat#9eb5c2e9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode autosaveSettingsScopeChat#9eb5c2e9: field chat_id: %w", err) - } - a.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AutosaveSettingsScopeChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode autosaveSettingsScopeChat#9eb5c2e9 as nil") - } - b.ObjStart() - b.PutID("autosaveSettingsScopeChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(a.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AutosaveSettingsScopeChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode autosaveSettingsScopeChat#9eb5c2e9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("autosaveSettingsScopeChat"); err != nil { - return fmt.Errorf("unable to decode autosaveSettingsScopeChat#9eb5c2e9: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode autosaveSettingsScopeChat#9eb5c2e9: field chat_id: %w", err) - } - a.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (a *AutosaveSettingsScopeChat) GetChatID() (value int64) { - if a == nil { - return - } - return a.ChatID -} - -// AutosaveSettingsScopeClassName is schema name of AutosaveSettingsScopeClass. -const AutosaveSettingsScopeClassName = "AutosaveSettingsScope" - -// AutosaveSettingsScopeClass represents AutosaveSettingsScope generic type. -// -// Example: -// -// g, err := tdapi.DecodeAutosaveSettingsScope(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.AutosaveSettingsScopePrivateChats: // autosaveSettingsScopePrivateChats#5329797f -// case *tdapi.AutosaveSettingsScopeGroupChats: // autosaveSettingsScopeGroupChats#32e00e4e -// case *tdapi.AutosaveSettingsScopeChannelChats: // autosaveSettingsScopeChannelChats#e2391fd1 -// case *tdapi.AutosaveSettingsScopeChat: // autosaveSettingsScopeChat#9eb5c2e9 -// default: panic(v) -// } -type AutosaveSettingsScopeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() AutosaveSettingsScopeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeAutosaveSettingsScope implements binary de-serialization for AutosaveSettingsScopeClass. -func DecodeAutosaveSettingsScope(buf *bin.Buffer) (AutosaveSettingsScopeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case AutosaveSettingsScopePrivateChatsTypeID: - // Decoding autosaveSettingsScopePrivateChats#5329797f. - v := AutosaveSettingsScopePrivateChats{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) - } - return &v, nil - case AutosaveSettingsScopeGroupChatsTypeID: - // Decoding autosaveSettingsScopeGroupChats#32e00e4e. - v := AutosaveSettingsScopeGroupChats{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) - } - return &v, nil - case AutosaveSettingsScopeChannelChatsTypeID: - // Decoding autosaveSettingsScopeChannelChats#e2391fd1. - v := AutosaveSettingsScopeChannelChats{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) - } - return &v, nil - case AutosaveSettingsScopeChatTypeID: - // Decoding autosaveSettingsScopeChat#9eb5c2e9. - v := AutosaveSettingsScopeChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONAutosaveSettingsScope implements binary de-serialization for AutosaveSettingsScopeClass. -func DecodeTDLibJSONAutosaveSettingsScope(buf tdjson.Decoder) (AutosaveSettingsScopeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "autosaveSettingsScopePrivateChats": - // Decoding autosaveSettingsScopePrivateChats#5329797f. - v := AutosaveSettingsScopePrivateChats{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) - } - return &v, nil - case "autosaveSettingsScopeGroupChats": - // Decoding autosaveSettingsScopeGroupChats#32e00e4e. - v := AutosaveSettingsScopeGroupChats{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) - } - return &v, nil - case "autosaveSettingsScopeChannelChats": - // Decoding autosaveSettingsScopeChannelChats#e2391fd1. - v := AutosaveSettingsScopeChannelChats{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) - } - return &v, nil - case "autosaveSettingsScopeChat": - // Decoding autosaveSettingsScopeChat#9eb5c2e9. - v := AutosaveSettingsScopeChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode AutosaveSettingsScopeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// AutosaveSettingsScope boxes the AutosaveSettingsScopeClass providing a helper. -type AutosaveSettingsScopeBox struct { - AutosaveSettingsScope AutosaveSettingsScopeClass -} - -// Decode implements bin.Decoder for AutosaveSettingsScopeBox. -func (b *AutosaveSettingsScopeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode AutosaveSettingsScopeBox to nil") - } - v, err := DecodeAutosaveSettingsScope(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.AutosaveSettingsScope = v - return nil -} - -// Encode implements bin.Encode for AutosaveSettingsScopeBox. -func (b *AutosaveSettingsScopeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.AutosaveSettingsScope == nil { - return fmt.Errorf("unable to encode AutosaveSettingsScopeClass as nil") - } - return b.AutosaveSettingsScope.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for AutosaveSettingsScopeBox. -func (b *AutosaveSettingsScopeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode AutosaveSettingsScopeBox to nil") - } - v, err := DecodeTDLibJSONAutosaveSettingsScope(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.AutosaveSettingsScope = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for AutosaveSettingsScopeBox. -func (b *AutosaveSettingsScopeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.AutosaveSettingsScope == nil { - return fmt.Errorf("unable to encode AutosaveSettingsScopeClass as nil") - } - return b.AutosaveSettingsScope.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_available_reaction_gen.go b/tdapi/tl_available_reaction_gen.go deleted file mode 100644 index 98fdbb579..000000000 --- a/tdapi/tl_available_reaction_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AvailableReaction represents TL type `availableReaction#f9024387`. -type AvailableReaction struct { - // Type of the reaction - Type ReactionTypeClass - // True, if Telegram Premium is needed to send the reaction - NeedsPremium bool -} - -// AvailableReactionTypeID is TL type id of AvailableReaction. -const AvailableReactionTypeID = 0xf9024387 - -// Ensuring interfaces in compile-time for AvailableReaction. -var ( - _ bin.Encoder = &AvailableReaction{} - _ bin.Decoder = &AvailableReaction{} - _ bin.BareEncoder = &AvailableReaction{} - _ bin.BareDecoder = &AvailableReaction{} -) - -func (a *AvailableReaction) Zero() bool { - if a == nil { - return true - } - if !(a.Type == nil) { - return false - } - if !(a.NeedsPremium == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AvailableReaction) String() string { - if a == nil { - return "AvailableReaction(nil)" - } - type Alias AvailableReaction - return fmt.Sprintf("AvailableReaction%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AvailableReaction) TypeID() uint32 { - return AvailableReactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*AvailableReaction) TypeName() string { - return "availableReaction" -} - -// TypeInfo returns info about TL type. -func (a *AvailableReaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "availableReaction", - ID: AvailableReactionTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "NeedsPremium", - SchemaName: "needs_premium", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AvailableReaction) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode availableReaction#f9024387 as nil") - } - b.PutID(AvailableReactionTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AvailableReaction) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode availableReaction#f9024387 as nil") - } - if a.Type == nil { - return fmt.Errorf("unable to encode availableReaction#f9024387: field type is nil") - } - if err := a.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode availableReaction#f9024387: field type: %w", err) - } - b.PutBool(a.NeedsPremium) - return nil -} - -// Decode implements bin.Decoder. -func (a *AvailableReaction) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode availableReaction#f9024387 to nil") - } - if err := b.ConsumeID(AvailableReactionTypeID); err != nil { - return fmt.Errorf("unable to decode availableReaction#f9024387: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AvailableReaction) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode availableReaction#f9024387 to nil") - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode availableReaction#f9024387: field type: %w", err) - } - a.Type = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode availableReaction#f9024387: field needs_premium: %w", err) - } - a.NeedsPremium = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AvailableReaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode availableReaction#f9024387 as nil") - } - b.ObjStart() - b.PutID("availableReaction") - b.Comma() - b.FieldStart("type") - if a.Type == nil { - return fmt.Errorf("unable to encode availableReaction#f9024387: field type is nil") - } - if err := a.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode availableReaction#f9024387: field type: %w", err) - } - b.Comma() - b.FieldStart("needs_premium") - b.PutBool(a.NeedsPremium) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AvailableReaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode availableReaction#f9024387 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("availableReaction"); err != nil { - return fmt.Errorf("unable to decode availableReaction#f9024387: %w", err) - } - case "type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode availableReaction#f9024387: field type: %w", err) - } - a.Type = value - case "needs_premium": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode availableReaction#f9024387: field needs_premium: %w", err) - } - a.NeedsPremium = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (a *AvailableReaction) GetType() (value ReactionTypeClass) { - if a == nil { - return - } - return a.Type -} - -// GetNeedsPremium returns value of NeedsPremium field. -func (a *AvailableReaction) GetNeedsPremium() (value bool) { - if a == nil { - return - } - return a.NeedsPremium -} diff --git a/tdapi/tl_available_reactions_gen.go b/tdapi/tl_available_reactions_gen.go deleted file mode 100644 index fa09e3b63..000000000 --- a/tdapi/tl_available_reactions_gen.go +++ /dev/null @@ -1,458 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// AvailableReactions represents TL type `availableReactions#3596f453`. -type AvailableReactions struct { - // List of reactions to be shown at the top - TopReactions []AvailableReaction - // List of recently used reactions - RecentReactions []AvailableReaction - // List of popular reactions - PopularReactions []AvailableReaction - // True, if any custom emoji reaction can be added by Telegram Premium subscribers - AllowCustomEmoji bool - // True, if the reactions will be tags and the message can be found by them - AreTags bool - // The reason why the current user can't add reactions to the message, despite some other - // users can; may be null if none - UnavailabilityReason ReactionUnavailabilityReasonClass -} - -// AvailableReactionsTypeID is TL type id of AvailableReactions. -const AvailableReactionsTypeID = 0x3596f453 - -// Ensuring interfaces in compile-time for AvailableReactions. -var ( - _ bin.Encoder = &AvailableReactions{} - _ bin.Decoder = &AvailableReactions{} - _ bin.BareEncoder = &AvailableReactions{} - _ bin.BareDecoder = &AvailableReactions{} -) - -func (a *AvailableReactions) Zero() bool { - if a == nil { - return true - } - if !(a.TopReactions == nil) { - return false - } - if !(a.RecentReactions == nil) { - return false - } - if !(a.PopularReactions == nil) { - return false - } - if !(a.AllowCustomEmoji == false) { - return false - } - if !(a.AreTags == false) { - return false - } - if !(a.UnavailabilityReason == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (a *AvailableReactions) String() string { - if a == nil { - return "AvailableReactions(nil)" - } - type Alias AvailableReactions - return fmt.Sprintf("AvailableReactions%+v", Alias(*a)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*AvailableReactions) TypeID() uint32 { - return AvailableReactionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*AvailableReactions) TypeName() string { - return "availableReactions" -} - -// TypeInfo returns info about TL type. -func (a *AvailableReactions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "availableReactions", - ID: AvailableReactionsTypeID, - } - if a == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TopReactions", - SchemaName: "top_reactions", - }, - { - Name: "RecentReactions", - SchemaName: "recent_reactions", - }, - { - Name: "PopularReactions", - SchemaName: "popular_reactions", - }, - { - Name: "AllowCustomEmoji", - SchemaName: "allow_custom_emoji", - }, - { - Name: "AreTags", - SchemaName: "are_tags", - }, - { - Name: "UnavailabilityReason", - SchemaName: "unavailability_reason", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (a *AvailableReactions) Encode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode availableReactions#3596f453 as nil") - } - b.PutID(AvailableReactionsTypeID) - return a.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (a *AvailableReactions) EncodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't encode availableReactions#3596f453 as nil") - } - b.PutInt(len(a.TopReactions)) - for idx, v := range a.TopReactions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare availableReactions#3596f453: field top_reactions element with index %d: %w", idx, err) - } - } - b.PutInt(len(a.RecentReactions)) - for idx, v := range a.RecentReactions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare availableReactions#3596f453: field recent_reactions element with index %d: %w", idx, err) - } - } - b.PutInt(len(a.PopularReactions)) - for idx, v := range a.PopularReactions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare availableReactions#3596f453: field popular_reactions element with index %d: %w", idx, err) - } - } - b.PutBool(a.AllowCustomEmoji) - b.PutBool(a.AreTags) - if a.UnavailabilityReason == nil { - return fmt.Errorf("unable to encode availableReactions#3596f453: field unavailability_reason is nil") - } - if err := a.UnavailabilityReason.Encode(b); err != nil { - return fmt.Errorf("unable to encode availableReactions#3596f453: field unavailability_reason: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (a *AvailableReactions) Decode(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode availableReactions#3596f453 to nil") - } - if err := b.ConsumeID(AvailableReactionsTypeID); err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: %w", err) - } - return a.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (a *AvailableReactions) DecodeBare(b *bin.Buffer) error { - if a == nil { - return fmt.Errorf("can't decode availableReactions#3596f453 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field top_reactions: %w", err) - } - - if headerLen > 0 { - a.TopReactions = make([]AvailableReaction, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value AvailableReaction - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare availableReactions#3596f453: field top_reactions: %w", err) - } - a.TopReactions = append(a.TopReactions, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field recent_reactions: %w", err) - } - - if headerLen > 0 { - a.RecentReactions = make([]AvailableReaction, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value AvailableReaction - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare availableReactions#3596f453: field recent_reactions: %w", err) - } - a.RecentReactions = append(a.RecentReactions, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field popular_reactions: %w", err) - } - - if headerLen > 0 { - a.PopularReactions = make([]AvailableReaction, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value AvailableReaction - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare availableReactions#3596f453: field popular_reactions: %w", err) - } - a.PopularReactions = append(a.PopularReactions, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field allow_custom_emoji: %w", err) - } - a.AllowCustomEmoji = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field are_tags: %w", err) - } - a.AreTags = value - } - { - value, err := DecodeReactionUnavailabilityReason(b) - if err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field unavailability_reason: %w", err) - } - a.UnavailabilityReason = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (a *AvailableReactions) EncodeTDLibJSON(b tdjson.Encoder) error { - if a == nil { - return fmt.Errorf("can't encode availableReactions#3596f453 as nil") - } - b.ObjStart() - b.PutID("availableReactions") - b.Comma() - b.FieldStart("top_reactions") - b.ArrStart() - for idx, v := range a.TopReactions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode availableReactions#3596f453: field top_reactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("recent_reactions") - b.ArrStart() - for idx, v := range a.RecentReactions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode availableReactions#3596f453: field recent_reactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("popular_reactions") - b.ArrStart() - for idx, v := range a.PopularReactions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode availableReactions#3596f453: field popular_reactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("allow_custom_emoji") - b.PutBool(a.AllowCustomEmoji) - b.Comma() - b.FieldStart("are_tags") - b.PutBool(a.AreTags) - b.Comma() - b.FieldStart("unavailability_reason") - if a.UnavailabilityReason == nil { - return fmt.Errorf("unable to encode availableReactions#3596f453: field unavailability_reason is nil") - } - if err := a.UnavailabilityReason.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode availableReactions#3596f453: field unavailability_reason: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (a *AvailableReactions) DecodeTDLibJSON(b tdjson.Decoder) error { - if a == nil { - return fmt.Errorf("can't decode availableReactions#3596f453 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("availableReactions"); err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: %w", err) - } - case "top_reactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value AvailableReaction - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field top_reactions: %w", err) - } - a.TopReactions = append(a.TopReactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field top_reactions: %w", err) - } - case "recent_reactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value AvailableReaction - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field recent_reactions: %w", err) - } - a.RecentReactions = append(a.RecentReactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field recent_reactions: %w", err) - } - case "popular_reactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value AvailableReaction - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field popular_reactions: %w", err) - } - a.PopularReactions = append(a.PopularReactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field popular_reactions: %w", err) - } - case "allow_custom_emoji": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field allow_custom_emoji: %w", err) - } - a.AllowCustomEmoji = value - case "are_tags": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field are_tags: %w", err) - } - a.AreTags = value - case "unavailability_reason": - value, err := DecodeTDLibJSONReactionUnavailabilityReason(b) - if err != nil { - return fmt.Errorf("unable to decode availableReactions#3596f453: field unavailability_reason: %w", err) - } - a.UnavailabilityReason = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTopReactions returns value of TopReactions field. -func (a *AvailableReactions) GetTopReactions() (value []AvailableReaction) { - if a == nil { - return - } - return a.TopReactions -} - -// GetRecentReactions returns value of RecentReactions field. -func (a *AvailableReactions) GetRecentReactions() (value []AvailableReaction) { - if a == nil { - return - } - return a.RecentReactions -} - -// GetPopularReactions returns value of PopularReactions field. -func (a *AvailableReactions) GetPopularReactions() (value []AvailableReaction) { - if a == nil { - return - } - return a.PopularReactions -} - -// GetAllowCustomEmoji returns value of AllowCustomEmoji field. -func (a *AvailableReactions) GetAllowCustomEmoji() (value bool) { - if a == nil { - return - } - return a.AllowCustomEmoji -} - -// GetAreTags returns value of AreTags field. -func (a *AvailableReactions) GetAreTags() (value bool) { - if a == nil { - return - } - return a.AreTags -} - -// GetUnavailabilityReason returns value of UnavailabilityReason field. -func (a *AvailableReactions) GetUnavailabilityReason() (value ReactionUnavailabilityReasonClass) { - if a == nil { - return - } - return a.UnavailabilityReason -} diff --git a/tdapi/tl_background_fill_gen.go b/tdapi/tl_background_fill_gen.go deleted file mode 100644 index e8247ad6e..000000000 --- a/tdapi/tl_background_fill_gen.go +++ /dev/null @@ -1,775 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BackgroundFillSolid represents TL type `backgroundFillSolid#3c3dbc1d`. -type BackgroundFillSolid struct { - // A color of the background in the RGB format - Color int32 -} - -// BackgroundFillSolidTypeID is TL type id of BackgroundFillSolid. -const BackgroundFillSolidTypeID = 0x3c3dbc1d - -// construct implements constructor of BackgroundFillClass. -func (b BackgroundFillSolid) construct() BackgroundFillClass { return &b } - -// Ensuring interfaces in compile-time for BackgroundFillSolid. -var ( - _ bin.Encoder = &BackgroundFillSolid{} - _ bin.Decoder = &BackgroundFillSolid{} - _ bin.BareEncoder = &BackgroundFillSolid{} - _ bin.BareDecoder = &BackgroundFillSolid{} - - _ BackgroundFillClass = &BackgroundFillSolid{} -) - -func (b *BackgroundFillSolid) Zero() bool { - if b == nil { - return true - } - if !(b.Color == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BackgroundFillSolid) String() string { - if b == nil { - return "BackgroundFillSolid(nil)" - } - type Alias BackgroundFillSolid - return fmt.Sprintf("BackgroundFillSolid%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BackgroundFillSolid) TypeID() uint32 { - return BackgroundFillSolidTypeID -} - -// TypeName returns name of type in TL schema. -func (*BackgroundFillSolid) TypeName() string { - return "backgroundFillSolid" -} - -// TypeInfo returns info about TL type. -func (b *BackgroundFillSolid) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "backgroundFillSolid", - ID: BackgroundFillSolidTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Color", - SchemaName: "color", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BackgroundFillSolid) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundFillSolid#3c3dbc1d as nil") - } - buf.PutID(BackgroundFillSolidTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BackgroundFillSolid) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundFillSolid#3c3dbc1d as nil") - } - buf.PutInt32(b.Color) - return nil -} - -// Decode implements bin.Decoder. -func (b *BackgroundFillSolid) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundFillSolid#3c3dbc1d to nil") - } - if err := buf.ConsumeID(BackgroundFillSolidTypeID); err != nil { - return fmt.Errorf("unable to decode backgroundFillSolid#3c3dbc1d: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BackgroundFillSolid) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundFillSolid#3c3dbc1d to nil") - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundFillSolid#3c3dbc1d: field color: %w", err) - } - b.Color = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BackgroundFillSolid) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode backgroundFillSolid#3c3dbc1d as nil") - } - buf.ObjStart() - buf.PutID("backgroundFillSolid") - buf.Comma() - buf.FieldStart("color") - buf.PutInt32(b.Color) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BackgroundFillSolid) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode backgroundFillSolid#3c3dbc1d to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("backgroundFillSolid"); err != nil { - return fmt.Errorf("unable to decode backgroundFillSolid#3c3dbc1d: %w", err) - } - case "color": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundFillSolid#3c3dbc1d: field color: %w", err) - } - b.Color = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetColor returns value of Color field. -func (b *BackgroundFillSolid) GetColor() (value int32) { - if b == nil { - return - } - return b.Color -} - -// BackgroundFillGradient represents TL type `backgroundFillGradient#925ff17f`. -type BackgroundFillGradient struct { - // A top color of the background in the RGB format - TopColor int32 - // A bottom color of the background in the RGB format - BottomColor int32 - // Clockwise rotation angle of the gradient, in degrees; 0-359. Must always be divisible - // by 45 - RotationAngle int32 -} - -// BackgroundFillGradientTypeID is TL type id of BackgroundFillGradient. -const BackgroundFillGradientTypeID = 0x925ff17f - -// construct implements constructor of BackgroundFillClass. -func (b BackgroundFillGradient) construct() BackgroundFillClass { return &b } - -// Ensuring interfaces in compile-time for BackgroundFillGradient. -var ( - _ bin.Encoder = &BackgroundFillGradient{} - _ bin.Decoder = &BackgroundFillGradient{} - _ bin.BareEncoder = &BackgroundFillGradient{} - _ bin.BareDecoder = &BackgroundFillGradient{} - - _ BackgroundFillClass = &BackgroundFillGradient{} -) - -func (b *BackgroundFillGradient) Zero() bool { - if b == nil { - return true - } - if !(b.TopColor == 0) { - return false - } - if !(b.BottomColor == 0) { - return false - } - if !(b.RotationAngle == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BackgroundFillGradient) String() string { - if b == nil { - return "BackgroundFillGradient(nil)" - } - type Alias BackgroundFillGradient - return fmt.Sprintf("BackgroundFillGradient%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BackgroundFillGradient) TypeID() uint32 { - return BackgroundFillGradientTypeID -} - -// TypeName returns name of type in TL schema. -func (*BackgroundFillGradient) TypeName() string { - return "backgroundFillGradient" -} - -// TypeInfo returns info about TL type. -func (b *BackgroundFillGradient) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "backgroundFillGradient", - ID: BackgroundFillGradientTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TopColor", - SchemaName: "top_color", - }, - { - Name: "BottomColor", - SchemaName: "bottom_color", - }, - { - Name: "RotationAngle", - SchemaName: "rotation_angle", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BackgroundFillGradient) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundFillGradient#925ff17f as nil") - } - buf.PutID(BackgroundFillGradientTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BackgroundFillGradient) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundFillGradient#925ff17f as nil") - } - buf.PutInt32(b.TopColor) - buf.PutInt32(b.BottomColor) - buf.PutInt32(b.RotationAngle) - return nil -} - -// Decode implements bin.Decoder. -func (b *BackgroundFillGradient) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundFillGradient#925ff17f to nil") - } - if err := buf.ConsumeID(BackgroundFillGradientTypeID); err != nil { - return fmt.Errorf("unable to decode backgroundFillGradient#925ff17f: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BackgroundFillGradient) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundFillGradient#925ff17f to nil") - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundFillGradient#925ff17f: field top_color: %w", err) - } - b.TopColor = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundFillGradient#925ff17f: field bottom_color: %w", err) - } - b.BottomColor = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundFillGradient#925ff17f: field rotation_angle: %w", err) - } - b.RotationAngle = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BackgroundFillGradient) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode backgroundFillGradient#925ff17f as nil") - } - buf.ObjStart() - buf.PutID("backgroundFillGradient") - buf.Comma() - buf.FieldStart("top_color") - buf.PutInt32(b.TopColor) - buf.Comma() - buf.FieldStart("bottom_color") - buf.PutInt32(b.BottomColor) - buf.Comma() - buf.FieldStart("rotation_angle") - buf.PutInt32(b.RotationAngle) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BackgroundFillGradient) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode backgroundFillGradient#925ff17f to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("backgroundFillGradient"); err != nil { - return fmt.Errorf("unable to decode backgroundFillGradient#925ff17f: %w", err) - } - case "top_color": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundFillGradient#925ff17f: field top_color: %w", err) - } - b.TopColor = value - case "bottom_color": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundFillGradient#925ff17f: field bottom_color: %w", err) - } - b.BottomColor = value - case "rotation_angle": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundFillGradient#925ff17f: field rotation_angle: %w", err) - } - b.RotationAngle = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetTopColor returns value of TopColor field. -func (b *BackgroundFillGradient) GetTopColor() (value int32) { - if b == nil { - return - } - return b.TopColor -} - -// GetBottomColor returns value of BottomColor field. -func (b *BackgroundFillGradient) GetBottomColor() (value int32) { - if b == nil { - return - } - return b.BottomColor -} - -// GetRotationAngle returns value of RotationAngle field. -func (b *BackgroundFillGradient) GetRotationAngle() (value int32) { - if b == nil { - return - } - return b.RotationAngle -} - -// BackgroundFillFreeformGradient represents TL type `backgroundFillFreeformGradient#fa31756a`. -type BackgroundFillFreeformGradient struct { - // A list of 3 or 4 colors of the freeform gradient in the RGB format - Colors []int32 -} - -// BackgroundFillFreeformGradientTypeID is TL type id of BackgroundFillFreeformGradient. -const BackgroundFillFreeformGradientTypeID = 0xfa31756a - -// construct implements constructor of BackgroundFillClass. -func (b BackgroundFillFreeformGradient) construct() BackgroundFillClass { return &b } - -// Ensuring interfaces in compile-time for BackgroundFillFreeformGradient. -var ( - _ bin.Encoder = &BackgroundFillFreeformGradient{} - _ bin.Decoder = &BackgroundFillFreeformGradient{} - _ bin.BareEncoder = &BackgroundFillFreeformGradient{} - _ bin.BareDecoder = &BackgroundFillFreeformGradient{} - - _ BackgroundFillClass = &BackgroundFillFreeformGradient{} -) - -func (b *BackgroundFillFreeformGradient) Zero() bool { - if b == nil { - return true - } - if !(b.Colors == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BackgroundFillFreeformGradient) String() string { - if b == nil { - return "BackgroundFillFreeformGradient(nil)" - } - type Alias BackgroundFillFreeformGradient - return fmt.Sprintf("BackgroundFillFreeformGradient%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BackgroundFillFreeformGradient) TypeID() uint32 { - return BackgroundFillFreeformGradientTypeID -} - -// TypeName returns name of type in TL schema. -func (*BackgroundFillFreeformGradient) TypeName() string { - return "backgroundFillFreeformGradient" -} - -// TypeInfo returns info about TL type. -func (b *BackgroundFillFreeformGradient) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "backgroundFillFreeformGradient", - ID: BackgroundFillFreeformGradientTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Colors", - SchemaName: "colors", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BackgroundFillFreeformGradient) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundFillFreeformGradient#fa31756a as nil") - } - buf.PutID(BackgroundFillFreeformGradientTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BackgroundFillFreeformGradient) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundFillFreeformGradient#fa31756a as nil") - } - buf.PutInt(len(b.Colors)) - for _, v := range b.Colors { - buf.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BackgroundFillFreeformGradient) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundFillFreeformGradient#fa31756a to nil") - } - if err := buf.ConsumeID(BackgroundFillFreeformGradientTypeID); err != nil { - return fmt.Errorf("unable to decode backgroundFillFreeformGradient#fa31756a: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BackgroundFillFreeformGradient) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundFillFreeformGradient#fa31756a to nil") - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode backgroundFillFreeformGradient#fa31756a: field colors: %w", err) - } - - if headerLen > 0 { - b.Colors = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundFillFreeformGradient#fa31756a: field colors: %w", err) - } - b.Colors = append(b.Colors, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BackgroundFillFreeformGradient) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode backgroundFillFreeformGradient#fa31756a as nil") - } - buf.ObjStart() - buf.PutID("backgroundFillFreeformGradient") - buf.Comma() - buf.FieldStart("colors") - buf.ArrStart() - for _, v := range b.Colors { - buf.PutInt32(v) - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BackgroundFillFreeformGradient) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode backgroundFillFreeformGradient#fa31756a to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("backgroundFillFreeformGradient"); err != nil { - return fmt.Errorf("unable to decode backgroundFillFreeformGradient#fa31756a: %w", err) - } - case "colors": - if err := buf.Arr(func(buf tdjson.Decoder) error { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundFillFreeformGradient#fa31756a: field colors: %w", err) - } - b.Colors = append(b.Colors, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode backgroundFillFreeformGradient#fa31756a: field colors: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetColors returns value of Colors field. -func (b *BackgroundFillFreeformGradient) GetColors() (value []int32) { - if b == nil { - return - } - return b.Colors -} - -// BackgroundFillClassName is schema name of BackgroundFillClass. -const BackgroundFillClassName = "BackgroundFill" - -// BackgroundFillClass represents BackgroundFill generic type. -// -// Example: -// -// g, err := tdapi.DecodeBackgroundFill(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.BackgroundFillSolid: // backgroundFillSolid#3c3dbc1d -// case *tdapi.BackgroundFillGradient: // backgroundFillGradient#925ff17f -// case *tdapi.BackgroundFillFreeformGradient: // backgroundFillFreeformGradient#fa31756a -// default: panic(v) -// } -type BackgroundFillClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() BackgroundFillClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeBackgroundFill implements binary de-serialization for BackgroundFillClass. -func DecodeBackgroundFill(buf *bin.Buffer) (BackgroundFillClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case BackgroundFillSolidTypeID: - // Decoding backgroundFillSolid#3c3dbc1d. - v := BackgroundFillSolid{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundFillClass: %w", err) - } - return &v, nil - case BackgroundFillGradientTypeID: - // Decoding backgroundFillGradient#925ff17f. - v := BackgroundFillGradient{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundFillClass: %w", err) - } - return &v, nil - case BackgroundFillFreeformGradientTypeID: - // Decoding backgroundFillFreeformGradient#fa31756a. - v := BackgroundFillFreeformGradient{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundFillClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BackgroundFillClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONBackgroundFill implements binary de-serialization for BackgroundFillClass. -func DecodeTDLibJSONBackgroundFill(buf tdjson.Decoder) (BackgroundFillClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "backgroundFillSolid": - // Decoding backgroundFillSolid#3c3dbc1d. - v := BackgroundFillSolid{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundFillClass: %w", err) - } - return &v, nil - case "backgroundFillGradient": - // Decoding backgroundFillGradient#925ff17f. - v := BackgroundFillGradient{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundFillClass: %w", err) - } - return &v, nil - case "backgroundFillFreeformGradient": - // Decoding backgroundFillFreeformGradient#fa31756a. - v := BackgroundFillFreeformGradient{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundFillClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BackgroundFillClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// BackgroundFill boxes the BackgroundFillClass providing a helper. -type BackgroundFillBox struct { - BackgroundFill BackgroundFillClass -} - -// Decode implements bin.Decoder for BackgroundFillBox. -func (b *BackgroundFillBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode BackgroundFillBox to nil") - } - v, err := DecodeBackgroundFill(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BackgroundFill = v - return nil -} - -// Encode implements bin.Encode for BackgroundFillBox. -func (b *BackgroundFillBox) Encode(buf *bin.Buffer) error { - if b == nil || b.BackgroundFill == nil { - return fmt.Errorf("unable to encode BackgroundFillClass as nil") - } - return b.BackgroundFill.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for BackgroundFillBox. -func (b *BackgroundFillBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode BackgroundFillBox to nil") - } - v, err := DecodeTDLibJSONBackgroundFill(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BackgroundFill = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for BackgroundFillBox. -func (b *BackgroundFillBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.BackgroundFill == nil { - return fmt.Errorf("unable to encode BackgroundFillClass as nil") - } - return b.BackgroundFill.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_background_gen.go b/tdapi/tl_background_gen.go deleted file mode 100644 index fccaefa00..000000000 --- a/tdapi/tl_background_gen.go +++ /dev/null @@ -1,374 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Background represents TL type `background#e65f291c`. -type Background struct { - // Unique background identifier - ID int64 - // True, if this is one of default backgrounds - IsDefault bool - // True, if the background is dark and is recommended to be used with dark theme - IsDark bool - // Unique background name - Name string - // Document with the background; may be null. Null only for filled and chat theme - // backgrounds - Document Document - // Type of the background - Type BackgroundTypeClass -} - -// BackgroundTypeID is TL type id of Background. -const BackgroundTypeID = 0xe65f291c - -// Ensuring interfaces in compile-time for Background. -var ( - _ bin.Encoder = &Background{} - _ bin.Decoder = &Background{} - _ bin.BareEncoder = &Background{} - _ bin.BareDecoder = &Background{} -) - -func (b *Background) Zero() bool { - if b == nil { - return true - } - if !(b.ID == 0) { - return false - } - if !(b.IsDefault == false) { - return false - } - if !(b.IsDark == false) { - return false - } - if !(b.Name == "") { - return false - } - if !(b.Document.Zero()) { - return false - } - if !(b.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *Background) String() string { - if b == nil { - return "Background(nil)" - } - type Alias Background - return fmt.Sprintf("Background%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Background) TypeID() uint32 { - return BackgroundTypeID -} - -// TypeName returns name of type in TL schema. -func (*Background) TypeName() string { - return "background" -} - -// TypeInfo returns info about TL type. -func (b *Background) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "background", - ID: BackgroundTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "IsDefault", - SchemaName: "is_default", - }, - { - Name: "IsDark", - SchemaName: "is_dark", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Document", - SchemaName: "document", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *Background) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode background#e65f291c as nil") - } - buf.PutID(BackgroundTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *Background) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode background#e65f291c as nil") - } - buf.PutLong(b.ID) - buf.PutBool(b.IsDefault) - buf.PutBool(b.IsDark) - buf.PutString(b.Name) - if err := b.Document.Encode(buf); err != nil { - return fmt.Errorf("unable to encode background#e65f291c: field document: %w", err) - } - if b.Type == nil { - return fmt.Errorf("unable to encode background#e65f291c: field type is nil") - } - if err := b.Type.Encode(buf); err != nil { - return fmt.Errorf("unable to encode background#e65f291c: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *Background) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode background#e65f291c to nil") - } - if err := buf.ConsumeID(BackgroundTypeID); err != nil { - return fmt.Errorf("unable to decode background#e65f291c: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *Background) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode background#e65f291c to nil") - } - { - value, err := buf.Long() - if err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field id: %w", err) - } - b.ID = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field is_default: %w", err) - } - b.IsDefault = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field is_dark: %w", err) - } - b.IsDark = value - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field name: %w", err) - } - b.Name = value - } - { - if err := b.Document.Decode(buf); err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field document: %w", err) - } - } - { - value, err := DecodeBackgroundType(buf) - if err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field type: %w", err) - } - b.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *Background) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode background#e65f291c as nil") - } - buf.ObjStart() - buf.PutID("background") - buf.Comma() - buf.FieldStart("id") - buf.PutLong(b.ID) - buf.Comma() - buf.FieldStart("is_default") - buf.PutBool(b.IsDefault) - buf.Comma() - buf.FieldStart("is_dark") - buf.PutBool(b.IsDark) - buf.Comma() - buf.FieldStart("name") - buf.PutString(b.Name) - buf.Comma() - buf.FieldStart("document") - if err := b.Document.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode background#e65f291c: field document: %w", err) - } - buf.Comma() - buf.FieldStart("type") - if b.Type == nil { - return fmt.Errorf("unable to encode background#e65f291c: field type is nil") - } - if err := b.Type.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode background#e65f291c: field type: %w", err) - } - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *Background) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode background#e65f291c to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("background"); err != nil { - return fmt.Errorf("unable to decode background#e65f291c: %w", err) - } - case "id": - value, err := buf.Long() - if err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field id: %w", err) - } - b.ID = value - case "is_default": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field is_default: %w", err) - } - b.IsDefault = value - case "is_dark": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field is_dark: %w", err) - } - b.IsDark = value - case "name": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field name: %w", err) - } - b.Name = value - case "document": - if err := b.Document.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field document: %w", err) - } - case "type": - value, err := DecodeTDLibJSONBackgroundType(buf) - if err != nil { - return fmt.Errorf("unable to decode background#e65f291c: field type: %w", err) - } - b.Type = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (b *Background) GetID() (value int64) { - if b == nil { - return - } - return b.ID -} - -// GetIsDefault returns value of IsDefault field. -func (b *Background) GetIsDefault() (value bool) { - if b == nil { - return - } - return b.IsDefault -} - -// GetIsDark returns value of IsDark field. -func (b *Background) GetIsDark() (value bool) { - if b == nil { - return - } - return b.IsDark -} - -// GetName returns value of Name field. -func (b *Background) GetName() (value string) { - if b == nil { - return - } - return b.Name -} - -// GetDocument returns value of Document field. -func (b *Background) GetDocument() (value Document) { - if b == nil { - return - } - return b.Document -} - -// GetType returns value of Type field. -func (b *Background) GetType() (value BackgroundTypeClass) { - if b == nil { - return - } - return b.Type -} diff --git a/tdapi/tl_background_type_gen.go b/tdapi/tl_background_type_gen.go deleted file mode 100644 index 971d602e1..000000000 --- a/tdapi/tl_background_type_gen.go +++ /dev/null @@ -1,1021 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BackgroundTypeWallpaper represents TL type `backgroundTypeWallpaper#758c4c7b`. -type BackgroundTypeWallpaper struct { - // True, if the wallpaper must be downscaled to fit in 450x450 square and then - // box-blurred with radius 12 - IsBlurred bool - // True, if the background needs to be slightly moved when device is tilted - IsMoving bool -} - -// BackgroundTypeWallpaperTypeID is TL type id of BackgroundTypeWallpaper. -const BackgroundTypeWallpaperTypeID = 0x758c4c7b - -// construct implements constructor of BackgroundTypeClass. -func (b BackgroundTypeWallpaper) construct() BackgroundTypeClass { return &b } - -// Ensuring interfaces in compile-time for BackgroundTypeWallpaper. -var ( - _ bin.Encoder = &BackgroundTypeWallpaper{} - _ bin.Decoder = &BackgroundTypeWallpaper{} - _ bin.BareEncoder = &BackgroundTypeWallpaper{} - _ bin.BareDecoder = &BackgroundTypeWallpaper{} - - _ BackgroundTypeClass = &BackgroundTypeWallpaper{} -) - -func (b *BackgroundTypeWallpaper) Zero() bool { - if b == nil { - return true - } - if !(b.IsBlurred == false) { - return false - } - if !(b.IsMoving == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BackgroundTypeWallpaper) String() string { - if b == nil { - return "BackgroundTypeWallpaper(nil)" - } - type Alias BackgroundTypeWallpaper - return fmt.Sprintf("BackgroundTypeWallpaper%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BackgroundTypeWallpaper) TypeID() uint32 { - return BackgroundTypeWallpaperTypeID -} - -// TypeName returns name of type in TL schema. -func (*BackgroundTypeWallpaper) TypeName() string { - return "backgroundTypeWallpaper" -} - -// TypeInfo returns info about TL type. -func (b *BackgroundTypeWallpaper) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "backgroundTypeWallpaper", - ID: BackgroundTypeWallpaperTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsBlurred", - SchemaName: "is_blurred", - }, - { - Name: "IsMoving", - SchemaName: "is_moving", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BackgroundTypeWallpaper) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypeWallpaper#758c4c7b as nil") - } - buf.PutID(BackgroundTypeWallpaperTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BackgroundTypeWallpaper) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypeWallpaper#758c4c7b as nil") - } - buf.PutBool(b.IsBlurred) - buf.PutBool(b.IsMoving) - return nil -} - -// Decode implements bin.Decoder. -func (b *BackgroundTypeWallpaper) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypeWallpaper#758c4c7b to nil") - } - if err := buf.ConsumeID(BackgroundTypeWallpaperTypeID); err != nil { - return fmt.Errorf("unable to decode backgroundTypeWallpaper#758c4c7b: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BackgroundTypeWallpaper) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypeWallpaper#758c4c7b to nil") - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypeWallpaper#758c4c7b: field is_blurred: %w", err) - } - b.IsBlurred = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypeWallpaper#758c4c7b: field is_moving: %w", err) - } - b.IsMoving = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BackgroundTypeWallpaper) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypeWallpaper#758c4c7b as nil") - } - buf.ObjStart() - buf.PutID("backgroundTypeWallpaper") - buf.Comma() - buf.FieldStart("is_blurred") - buf.PutBool(b.IsBlurred) - buf.Comma() - buf.FieldStart("is_moving") - buf.PutBool(b.IsMoving) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BackgroundTypeWallpaper) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypeWallpaper#758c4c7b to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("backgroundTypeWallpaper"); err != nil { - return fmt.Errorf("unable to decode backgroundTypeWallpaper#758c4c7b: %w", err) - } - case "is_blurred": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypeWallpaper#758c4c7b: field is_blurred: %w", err) - } - b.IsBlurred = value - case "is_moving": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypeWallpaper#758c4c7b: field is_moving: %w", err) - } - b.IsMoving = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetIsBlurred returns value of IsBlurred field. -func (b *BackgroundTypeWallpaper) GetIsBlurred() (value bool) { - if b == nil { - return - } - return b.IsBlurred -} - -// GetIsMoving returns value of IsMoving field. -func (b *BackgroundTypeWallpaper) GetIsMoving() (value bool) { - if b == nil { - return - } - return b.IsMoving -} - -// BackgroundTypePattern represents TL type `backgroundTypePattern#4ce716fd`. -type BackgroundTypePattern struct { - // Fill of the background - Fill BackgroundFillClass - // Intensity of the pattern when it is shown above the filled background; 0-100 - Intensity int32 - // True, if the background fill must be applied only to the pattern itself. All other - // pixels are black in this case. For dark themes only - IsInverted bool - // True, if the background needs to be slightly moved when device is tilted - IsMoving bool -} - -// BackgroundTypePatternTypeID is TL type id of BackgroundTypePattern. -const BackgroundTypePatternTypeID = 0x4ce716fd - -// construct implements constructor of BackgroundTypeClass. -func (b BackgroundTypePattern) construct() BackgroundTypeClass { return &b } - -// Ensuring interfaces in compile-time for BackgroundTypePattern. -var ( - _ bin.Encoder = &BackgroundTypePattern{} - _ bin.Decoder = &BackgroundTypePattern{} - _ bin.BareEncoder = &BackgroundTypePattern{} - _ bin.BareDecoder = &BackgroundTypePattern{} - - _ BackgroundTypeClass = &BackgroundTypePattern{} -) - -func (b *BackgroundTypePattern) Zero() bool { - if b == nil { - return true - } - if !(b.Fill == nil) { - return false - } - if !(b.Intensity == 0) { - return false - } - if !(b.IsInverted == false) { - return false - } - if !(b.IsMoving == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BackgroundTypePattern) String() string { - if b == nil { - return "BackgroundTypePattern(nil)" - } - type Alias BackgroundTypePattern - return fmt.Sprintf("BackgroundTypePattern%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BackgroundTypePattern) TypeID() uint32 { - return BackgroundTypePatternTypeID -} - -// TypeName returns name of type in TL schema. -func (*BackgroundTypePattern) TypeName() string { - return "backgroundTypePattern" -} - -// TypeInfo returns info about TL type. -func (b *BackgroundTypePattern) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "backgroundTypePattern", - ID: BackgroundTypePatternTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Fill", - SchemaName: "fill", - }, - { - Name: "Intensity", - SchemaName: "intensity", - }, - { - Name: "IsInverted", - SchemaName: "is_inverted", - }, - { - Name: "IsMoving", - SchemaName: "is_moving", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BackgroundTypePattern) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypePattern#4ce716fd as nil") - } - buf.PutID(BackgroundTypePatternTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BackgroundTypePattern) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypePattern#4ce716fd as nil") - } - if b.Fill == nil { - return fmt.Errorf("unable to encode backgroundTypePattern#4ce716fd: field fill is nil") - } - if err := b.Fill.Encode(buf); err != nil { - return fmt.Errorf("unable to encode backgroundTypePattern#4ce716fd: field fill: %w", err) - } - buf.PutInt32(b.Intensity) - buf.PutBool(b.IsInverted) - buf.PutBool(b.IsMoving) - return nil -} - -// Decode implements bin.Decoder. -func (b *BackgroundTypePattern) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypePattern#4ce716fd to nil") - } - if err := buf.ConsumeID(BackgroundTypePatternTypeID); err != nil { - return fmt.Errorf("unable to decode backgroundTypePattern#4ce716fd: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BackgroundTypePattern) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypePattern#4ce716fd to nil") - } - { - value, err := DecodeBackgroundFill(buf) - if err != nil { - return fmt.Errorf("unable to decode backgroundTypePattern#4ce716fd: field fill: %w", err) - } - b.Fill = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypePattern#4ce716fd: field intensity: %w", err) - } - b.Intensity = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypePattern#4ce716fd: field is_inverted: %w", err) - } - b.IsInverted = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypePattern#4ce716fd: field is_moving: %w", err) - } - b.IsMoving = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BackgroundTypePattern) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypePattern#4ce716fd as nil") - } - buf.ObjStart() - buf.PutID("backgroundTypePattern") - buf.Comma() - buf.FieldStart("fill") - if b.Fill == nil { - return fmt.Errorf("unable to encode backgroundTypePattern#4ce716fd: field fill is nil") - } - if err := b.Fill.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode backgroundTypePattern#4ce716fd: field fill: %w", err) - } - buf.Comma() - buf.FieldStart("intensity") - buf.PutInt32(b.Intensity) - buf.Comma() - buf.FieldStart("is_inverted") - buf.PutBool(b.IsInverted) - buf.Comma() - buf.FieldStart("is_moving") - buf.PutBool(b.IsMoving) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BackgroundTypePattern) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypePattern#4ce716fd to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("backgroundTypePattern"); err != nil { - return fmt.Errorf("unable to decode backgroundTypePattern#4ce716fd: %w", err) - } - case "fill": - value, err := DecodeTDLibJSONBackgroundFill(buf) - if err != nil { - return fmt.Errorf("unable to decode backgroundTypePattern#4ce716fd: field fill: %w", err) - } - b.Fill = value - case "intensity": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypePattern#4ce716fd: field intensity: %w", err) - } - b.Intensity = value - case "is_inverted": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypePattern#4ce716fd: field is_inverted: %w", err) - } - b.IsInverted = value - case "is_moving": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypePattern#4ce716fd: field is_moving: %w", err) - } - b.IsMoving = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetFill returns value of Fill field. -func (b *BackgroundTypePattern) GetFill() (value BackgroundFillClass) { - if b == nil { - return - } - return b.Fill -} - -// GetIntensity returns value of Intensity field. -func (b *BackgroundTypePattern) GetIntensity() (value int32) { - if b == nil { - return - } - return b.Intensity -} - -// GetIsInverted returns value of IsInverted field. -func (b *BackgroundTypePattern) GetIsInverted() (value bool) { - if b == nil { - return - } - return b.IsInverted -} - -// GetIsMoving returns value of IsMoving field. -func (b *BackgroundTypePattern) GetIsMoving() (value bool) { - if b == nil { - return - } - return b.IsMoving -} - -// BackgroundTypeFill represents TL type `backgroundTypeFill#3b301c2c`. -type BackgroundTypeFill struct { - // The background fill - Fill BackgroundFillClass -} - -// BackgroundTypeFillTypeID is TL type id of BackgroundTypeFill. -const BackgroundTypeFillTypeID = 0x3b301c2c - -// construct implements constructor of BackgroundTypeClass. -func (b BackgroundTypeFill) construct() BackgroundTypeClass { return &b } - -// Ensuring interfaces in compile-time for BackgroundTypeFill. -var ( - _ bin.Encoder = &BackgroundTypeFill{} - _ bin.Decoder = &BackgroundTypeFill{} - _ bin.BareEncoder = &BackgroundTypeFill{} - _ bin.BareDecoder = &BackgroundTypeFill{} - - _ BackgroundTypeClass = &BackgroundTypeFill{} -) - -func (b *BackgroundTypeFill) Zero() bool { - if b == nil { - return true - } - if !(b.Fill == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BackgroundTypeFill) String() string { - if b == nil { - return "BackgroundTypeFill(nil)" - } - type Alias BackgroundTypeFill - return fmt.Sprintf("BackgroundTypeFill%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BackgroundTypeFill) TypeID() uint32 { - return BackgroundTypeFillTypeID -} - -// TypeName returns name of type in TL schema. -func (*BackgroundTypeFill) TypeName() string { - return "backgroundTypeFill" -} - -// TypeInfo returns info about TL type. -func (b *BackgroundTypeFill) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "backgroundTypeFill", - ID: BackgroundTypeFillTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Fill", - SchemaName: "fill", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BackgroundTypeFill) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypeFill#3b301c2c as nil") - } - buf.PutID(BackgroundTypeFillTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BackgroundTypeFill) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypeFill#3b301c2c as nil") - } - if b.Fill == nil { - return fmt.Errorf("unable to encode backgroundTypeFill#3b301c2c: field fill is nil") - } - if err := b.Fill.Encode(buf); err != nil { - return fmt.Errorf("unable to encode backgroundTypeFill#3b301c2c: field fill: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BackgroundTypeFill) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypeFill#3b301c2c to nil") - } - if err := buf.ConsumeID(BackgroundTypeFillTypeID); err != nil { - return fmt.Errorf("unable to decode backgroundTypeFill#3b301c2c: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BackgroundTypeFill) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypeFill#3b301c2c to nil") - } - { - value, err := DecodeBackgroundFill(buf) - if err != nil { - return fmt.Errorf("unable to decode backgroundTypeFill#3b301c2c: field fill: %w", err) - } - b.Fill = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BackgroundTypeFill) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypeFill#3b301c2c as nil") - } - buf.ObjStart() - buf.PutID("backgroundTypeFill") - buf.Comma() - buf.FieldStart("fill") - if b.Fill == nil { - return fmt.Errorf("unable to encode backgroundTypeFill#3b301c2c: field fill is nil") - } - if err := b.Fill.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode backgroundTypeFill#3b301c2c: field fill: %w", err) - } - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BackgroundTypeFill) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypeFill#3b301c2c to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("backgroundTypeFill"); err != nil { - return fmt.Errorf("unable to decode backgroundTypeFill#3b301c2c: %w", err) - } - case "fill": - value, err := DecodeTDLibJSONBackgroundFill(buf) - if err != nil { - return fmt.Errorf("unable to decode backgroundTypeFill#3b301c2c: field fill: %w", err) - } - b.Fill = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetFill returns value of Fill field. -func (b *BackgroundTypeFill) GetFill() (value BackgroundFillClass) { - if b == nil { - return - } - return b.Fill -} - -// BackgroundTypeChatTheme represents TL type `backgroundTypeChatTheme#4d7a9752`. -type BackgroundTypeChatTheme struct { - // Name of the chat theme - ThemeName string -} - -// BackgroundTypeChatThemeTypeID is TL type id of BackgroundTypeChatTheme. -const BackgroundTypeChatThemeTypeID = 0x4d7a9752 - -// construct implements constructor of BackgroundTypeClass. -func (b BackgroundTypeChatTheme) construct() BackgroundTypeClass { return &b } - -// Ensuring interfaces in compile-time for BackgroundTypeChatTheme. -var ( - _ bin.Encoder = &BackgroundTypeChatTheme{} - _ bin.Decoder = &BackgroundTypeChatTheme{} - _ bin.BareEncoder = &BackgroundTypeChatTheme{} - _ bin.BareDecoder = &BackgroundTypeChatTheme{} - - _ BackgroundTypeClass = &BackgroundTypeChatTheme{} -) - -func (b *BackgroundTypeChatTheme) Zero() bool { - if b == nil { - return true - } - if !(b.ThemeName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BackgroundTypeChatTheme) String() string { - if b == nil { - return "BackgroundTypeChatTheme(nil)" - } - type Alias BackgroundTypeChatTheme - return fmt.Sprintf("BackgroundTypeChatTheme%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BackgroundTypeChatTheme) TypeID() uint32 { - return BackgroundTypeChatThemeTypeID -} - -// TypeName returns name of type in TL schema. -func (*BackgroundTypeChatTheme) TypeName() string { - return "backgroundTypeChatTheme" -} - -// TypeInfo returns info about TL type. -func (b *BackgroundTypeChatTheme) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "backgroundTypeChatTheme", - ID: BackgroundTypeChatThemeTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ThemeName", - SchemaName: "theme_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BackgroundTypeChatTheme) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypeChatTheme#4d7a9752 as nil") - } - buf.PutID(BackgroundTypeChatThemeTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BackgroundTypeChatTheme) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypeChatTheme#4d7a9752 as nil") - } - buf.PutString(b.ThemeName) - return nil -} - -// Decode implements bin.Decoder. -func (b *BackgroundTypeChatTheme) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypeChatTheme#4d7a9752 to nil") - } - if err := buf.ConsumeID(BackgroundTypeChatThemeTypeID); err != nil { - return fmt.Errorf("unable to decode backgroundTypeChatTheme#4d7a9752: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BackgroundTypeChatTheme) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypeChatTheme#4d7a9752 to nil") - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypeChatTheme#4d7a9752: field theme_name: %w", err) - } - b.ThemeName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BackgroundTypeChatTheme) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode backgroundTypeChatTheme#4d7a9752 as nil") - } - buf.ObjStart() - buf.PutID("backgroundTypeChatTheme") - buf.Comma() - buf.FieldStart("theme_name") - buf.PutString(b.ThemeName) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BackgroundTypeChatTheme) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode backgroundTypeChatTheme#4d7a9752 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("backgroundTypeChatTheme"); err != nil { - return fmt.Errorf("unable to decode backgroundTypeChatTheme#4d7a9752: %w", err) - } - case "theme_name": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode backgroundTypeChatTheme#4d7a9752: field theme_name: %w", err) - } - b.ThemeName = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetThemeName returns value of ThemeName field. -func (b *BackgroundTypeChatTheme) GetThemeName() (value string) { - if b == nil { - return - } - return b.ThemeName -} - -// BackgroundTypeClassName is schema name of BackgroundTypeClass. -const BackgroundTypeClassName = "BackgroundType" - -// BackgroundTypeClass represents BackgroundType generic type. -// -// Example: -// -// g, err := tdapi.DecodeBackgroundType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.BackgroundTypeWallpaper: // backgroundTypeWallpaper#758c4c7b -// case *tdapi.BackgroundTypePattern: // backgroundTypePattern#4ce716fd -// case *tdapi.BackgroundTypeFill: // backgroundTypeFill#3b301c2c -// case *tdapi.BackgroundTypeChatTheme: // backgroundTypeChatTheme#4d7a9752 -// default: panic(v) -// } -type BackgroundTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() BackgroundTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeBackgroundType implements binary de-serialization for BackgroundTypeClass. -func DecodeBackgroundType(buf *bin.Buffer) (BackgroundTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case BackgroundTypeWallpaperTypeID: - // Decoding backgroundTypeWallpaper#758c4c7b. - v := BackgroundTypeWallpaper{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundTypeClass: %w", err) - } - return &v, nil - case BackgroundTypePatternTypeID: - // Decoding backgroundTypePattern#4ce716fd. - v := BackgroundTypePattern{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundTypeClass: %w", err) - } - return &v, nil - case BackgroundTypeFillTypeID: - // Decoding backgroundTypeFill#3b301c2c. - v := BackgroundTypeFill{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundTypeClass: %w", err) - } - return &v, nil - case BackgroundTypeChatThemeTypeID: - // Decoding backgroundTypeChatTheme#4d7a9752. - v := BackgroundTypeChatTheme{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BackgroundTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONBackgroundType implements binary de-serialization for BackgroundTypeClass. -func DecodeTDLibJSONBackgroundType(buf tdjson.Decoder) (BackgroundTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "backgroundTypeWallpaper": - // Decoding backgroundTypeWallpaper#758c4c7b. - v := BackgroundTypeWallpaper{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundTypeClass: %w", err) - } - return &v, nil - case "backgroundTypePattern": - // Decoding backgroundTypePattern#4ce716fd. - v := BackgroundTypePattern{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundTypeClass: %w", err) - } - return &v, nil - case "backgroundTypeFill": - // Decoding backgroundTypeFill#3b301c2c. - v := BackgroundTypeFill{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundTypeClass: %w", err) - } - return &v, nil - case "backgroundTypeChatTheme": - // Decoding backgroundTypeChatTheme#4d7a9752. - v := BackgroundTypeChatTheme{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BackgroundTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BackgroundTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// BackgroundType boxes the BackgroundTypeClass providing a helper. -type BackgroundTypeBox struct { - BackgroundType BackgroundTypeClass -} - -// Decode implements bin.Decoder for BackgroundTypeBox. -func (b *BackgroundTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode BackgroundTypeBox to nil") - } - v, err := DecodeBackgroundType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BackgroundType = v - return nil -} - -// Encode implements bin.Encode for BackgroundTypeBox. -func (b *BackgroundTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.BackgroundType == nil { - return fmt.Errorf("unable to encode BackgroundTypeClass as nil") - } - return b.BackgroundType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for BackgroundTypeBox. -func (b *BackgroundTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode BackgroundTypeBox to nil") - } - v, err := DecodeTDLibJSONBackgroundType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BackgroundType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for BackgroundTypeBox. -func (b *BackgroundTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.BackgroundType == nil { - return fmt.Errorf("unable to encode BackgroundTypeClass as nil") - } - return b.BackgroundType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_backgrounds_gen.go b/tdapi/tl_backgrounds_gen.go deleted file mode 100644 index 2c17f0277..000000000 --- a/tdapi/tl_backgrounds_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Backgrounds represents TL type `backgrounds#b4671319`. -type Backgrounds struct { - // A list of backgrounds - Backgrounds []Background -} - -// BackgroundsTypeID is TL type id of Backgrounds. -const BackgroundsTypeID = 0xb4671319 - -// Ensuring interfaces in compile-time for Backgrounds. -var ( - _ bin.Encoder = &Backgrounds{} - _ bin.Decoder = &Backgrounds{} - _ bin.BareEncoder = &Backgrounds{} - _ bin.BareDecoder = &Backgrounds{} -) - -func (b *Backgrounds) Zero() bool { - if b == nil { - return true - } - if !(b.Backgrounds == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *Backgrounds) String() string { - if b == nil { - return "Backgrounds(nil)" - } - type Alias Backgrounds - return fmt.Sprintf("Backgrounds%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Backgrounds) TypeID() uint32 { - return BackgroundsTypeID -} - -// TypeName returns name of type in TL schema. -func (*Backgrounds) TypeName() string { - return "backgrounds" -} - -// TypeInfo returns info about TL type. -func (b *Backgrounds) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "backgrounds", - ID: BackgroundsTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Backgrounds", - SchemaName: "backgrounds", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *Backgrounds) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgrounds#b4671319 as nil") - } - buf.PutID(BackgroundsTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *Backgrounds) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode backgrounds#b4671319 as nil") - } - buf.PutInt(len(b.Backgrounds)) - for idx, v := range b.Backgrounds { - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare backgrounds#b4671319: field backgrounds element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (b *Backgrounds) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgrounds#b4671319 to nil") - } - if err := buf.ConsumeID(BackgroundsTypeID); err != nil { - return fmt.Errorf("unable to decode backgrounds#b4671319: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *Backgrounds) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode backgrounds#b4671319 to nil") - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode backgrounds#b4671319: field backgrounds: %w", err) - } - - if headerLen > 0 { - b.Backgrounds = make([]Background, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Background - if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare backgrounds#b4671319: field backgrounds: %w", err) - } - b.Backgrounds = append(b.Backgrounds, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *Backgrounds) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode backgrounds#b4671319 as nil") - } - buf.ObjStart() - buf.PutID("backgrounds") - buf.Comma() - buf.FieldStart("backgrounds") - buf.ArrStart() - for idx, v := range b.Backgrounds { - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode backgrounds#b4671319: field backgrounds element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *Backgrounds) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode backgrounds#b4671319 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("backgrounds"); err != nil { - return fmt.Errorf("unable to decode backgrounds#b4671319: %w", err) - } - case "backgrounds": - if err := buf.Arr(func(buf tdjson.Decoder) error { - var value Background - if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode backgrounds#b4671319: field backgrounds: %w", err) - } - b.Backgrounds = append(b.Backgrounds, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode backgrounds#b4671319: field backgrounds: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetBackgrounds returns value of Backgrounds field. -func (b *Backgrounds) GetBackgrounds() (value []Background) { - if b == nil { - return - } - return b.Backgrounds -} diff --git a/tdapi/tl_ban_chat_member_gen.go b/tdapi/tl_ban_chat_member_gen.go deleted file mode 100644 index 847312389..000000000 --- a/tdapi/tl_ban_chat_member_gen.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BanChatMemberRequest represents TL type `banChatMember#cb107d7c`. -type BanChatMemberRequest struct { - // Chat identifier - ChatID int64 - // Member identifier - MemberID MessageSenderClass - // Point in time (Unix timestamp) when the user will be unbanned; 0 if never. If the user - // is banned for more than 366 days or for less than 30 seconds from the current time, - // the user is considered to be banned forever. Ignored in basic groups and if a chat is - // banned - BannedUntilDate int32 - // Pass true to delete all messages in the chat for the user that is being removed. - // Always true for supergroups and channels - RevokeMessages bool -} - -// BanChatMemberRequestTypeID is TL type id of BanChatMemberRequest. -const BanChatMemberRequestTypeID = 0xcb107d7c - -// Ensuring interfaces in compile-time for BanChatMemberRequest. -var ( - _ bin.Encoder = &BanChatMemberRequest{} - _ bin.Decoder = &BanChatMemberRequest{} - _ bin.BareEncoder = &BanChatMemberRequest{} - _ bin.BareDecoder = &BanChatMemberRequest{} -) - -func (b *BanChatMemberRequest) Zero() bool { - if b == nil { - return true - } - if !(b.ChatID == 0) { - return false - } - if !(b.MemberID == nil) { - return false - } - if !(b.BannedUntilDate == 0) { - return false - } - if !(b.RevokeMessages == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BanChatMemberRequest) String() string { - if b == nil { - return "BanChatMemberRequest(nil)" - } - type Alias BanChatMemberRequest - return fmt.Sprintf("BanChatMemberRequest%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BanChatMemberRequest) TypeID() uint32 { - return BanChatMemberRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*BanChatMemberRequest) TypeName() string { - return "banChatMember" -} - -// TypeInfo returns info about TL type. -func (b *BanChatMemberRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "banChatMember", - ID: BanChatMemberRequestTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MemberID", - SchemaName: "member_id", - }, - { - Name: "BannedUntilDate", - SchemaName: "banned_until_date", - }, - { - Name: "RevokeMessages", - SchemaName: "revoke_messages", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BanChatMemberRequest) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode banChatMember#cb107d7c as nil") - } - buf.PutID(BanChatMemberRequestTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BanChatMemberRequest) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode banChatMember#cb107d7c as nil") - } - buf.PutInt53(b.ChatID) - if b.MemberID == nil { - return fmt.Errorf("unable to encode banChatMember#cb107d7c: field member_id is nil") - } - if err := b.MemberID.Encode(buf); err != nil { - return fmt.Errorf("unable to encode banChatMember#cb107d7c: field member_id: %w", err) - } - buf.PutInt32(b.BannedUntilDate) - buf.PutBool(b.RevokeMessages) - return nil -} - -// Decode implements bin.Decoder. -func (b *BanChatMemberRequest) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode banChatMember#cb107d7c to nil") - } - if err := buf.ConsumeID(BanChatMemberRequestTypeID); err != nil { - return fmt.Errorf("unable to decode banChatMember#cb107d7c: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BanChatMemberRequest) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode banChatMember#cb107d7c to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode banChatMember#cb107d7c: field chat_id: %w", err) - } - b.ChatID = value - } - { - value, err := DecodeMessageSender(buf) - if err != nil { - return fmt.Errorf("unable to decode banChatMember#cb107d7c: field member_id: %w", err) - } - b.MemberID = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode banChatMember#cb107d7c: field banned_until_date: %w", err) - } - b.BannedUntilDate = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode banChatMember#cb107d7c: field revoke_messages: %w", err) - } - b.RevokeMessages = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BanChatMemberRequest) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode banChatMember#cb107d7c as nil") - } - buf.ObjStart() - buf.PutID("banChatMember") - buf.Comma() - buf.FieldStart("chat_id") - buf.PutInt53(b.ChatID) - buf.Comma() - buf.FieldStart("member_id") - if b.MemberID == nil { - return fmt.Errorf("unable to encode banChatMember#cb107d7c: field member_id is nil") - } - if err := b.MemberID.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode banChatMember#cb107d7c: field member_id: %w", err) - } - buf.Comma() - buf.FieldStart("banned_until_date") - buf.PutInt32(b.BannedUntilDate) - buf.Comma() - buf.FieldStart("revoke_messages") - buf.PutBool(b.RevokeMessages) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BanChatMemberRequest) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode banChatMember#cb107d7c to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("banChatMember"); err != nil { - return fmt.Errorf("unable to decode banChatMember#cb107d7c: %w", err) - } - case "chat_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode banChatMember#cb107d7c: field chat_id: %w", err) - } - b.ChatID = value - case "member_id": - value, err := DecodeTDLibJSONMessageSender(buf) - if err != nil { - return fmt.Errorf("unable to decode banChatMember#cb107d7c: field member_id: %w", err) - } - b.MemberID = value - case "banned_until_date": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode banChatMember#cb107d7c: field banned_until_date: %w", err) - } - b.BannedUntilDate = value - case "revoke_messages": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode banChatMember#cb107d7c: field revoke_messages: %w", err) - } - b.RevokeMessages = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (b *BanChatMemberRequest) GetChatID() (value int64) { - if b == nil { - return - } - return b.ChatID -} - -// GetMemberID returns value of MemberID field. -func (b *BanChatMemberRequest) GetMemberID() (value MessageSenderClass) { - if b == nil { - return - } - return b.MemberID -} - -// GetBannedUntilDate returns value of BannedUntilDate field. -func (b *BanChatMemberRequest) GetBannedUntilDate() (value int32) { - if b == nil { - return - } - return b.BannedUntilDate -} - -// GetRevokeMessages returns value of RevokeMessages field. -func (b *BanChatMemberRequest) GetRevokeMessages() (value bool) { - if b == nil { - return - } - return b.RevokeMessages -} - -// BanChatMember invokes method banChatMember#cb107d7c returning error if any. -func (c *Client) BanChatMember(ctx context.Context, request *BanChatMemberRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_bank_card_action_open_url_gen.go b/tdapi/tl_bank_card_action_open_url_gen.go deleted file mode 100644 index 909c3f562..000000000 --- a/tdapi/tl_bank_card_action_open_url_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BankCardActionOpenURL represents TL type `bankCardActionOpenUrl#f44a5885`. -type BankCardActionOpenURL struct { - // Action text - Text string - // The URL to be opened - URL string -} - -// BankCardActionOpenURLTypeID is TL type id of BankCardActionOpenURL. -const BankCardActionOpenURLTypeID = 0xf44a5885 - -// Ensuring interfaces in compile-time for BankCardActionOpenURL. -var ( - _ bin.Encoder = &BankCardActionOpenURL{} - _ bin.Decoder = &BankCardActionOpenURL{} - _ bin.BareEncoder = &BankCardActionOpenURL{} - _ bin.BareDecoder = &BankCardActionOpenURL{} -) - -func (b *BankCardActionOpenURL) Zero() bool { - if b == nil { - return true - } - if !(b.Text == "") { - return false - } - if !(b.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BankCardActionOpenURL) String() string { - if b == nil { - return "BankCardActionOpenURL(nil)" - } - type Alias BankCardActionOpenURL - return fmt.Sprintf("BankCardActionOpenURL%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BankCardActionOpenURL) TypeID() uint32 { - return BankCardActionOpenURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*BankCardActionOpenURL) TypeName() string { - return "bankCardActionOpenUrl" -} - -// TypeInfo returns info about TL type. -func (b *BankCardActionOpenURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "bankCardActionOpenUrl", - ID: BankCardActionOpenURLTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BankCardActionOpenURL) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode bankCardActionOpenUrl#f44a5885 as nil") - } - buf.PutID(BankCardActionOpenURLTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BankCardActionOpenURL) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode bankCardActionOpenUrl#f44a5885 as nil") - } - buf.PutString(b.Text) - buf.PutString(b.URL) - return nil -} - -// Decode implements bin.Decoder. -func (b *BankCardActionOpenURL) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode bankCardActionOpenUrl#f44a5885 to nil") - } - if err := buf.ConsumeID(BankCardActionOpenURLTypeID); err != nil { - return fmt.Errorf("unable to decode bankCardActionOpenUrl#f44a5885: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BankCardActionOpenURL) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode bankCardActionOpenUrl#f44a5885 to nil") - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode bankCardActionOpenUrl#f44a5885: field text: %w", err) - } - b.Text = value - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode bankCardActionOpenUrl#f44a5885: field url: %w", err) - } - b.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BankCardActionOpenURL) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode bankCardActionOpenUrl#f44a5885 as nil") - } - buf.ObjStart() - buf.PutID("bankCardActionOpenUrl") - buf.Comma() - buf.FieldStart("text") - buf.PutString(b.Text) - buf.Comma() - buf.FieldStart("url") - buf.PutString(b.URL) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BankCardActionOpenURL) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode bankCardActionOpenUrl#f44a5885 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("bankCardActionOpenUrl"); err != nil { - return fmt.Errorf("unable to decode bankCardActionOpenUrl#f44a5885: %w", err) - } - case "text": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode bankCardActionOpenUrl#f44a5885: field text: %w", err) - } - b.Text = value - case "url": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode bankCardActionOpenUrl#f44a5885: field url: %w", err) - } - b.URL = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (b *BankCardActionOpenURL) GetText() (value string) { - if b == nil { - return - } - return b.Text -} - -// GetURL returns value of URL field. -func (b *BankCardActionOpenURL) GetURL() (value string) { - if b == nil { - return - } - return b.URL -} diff --git a/tdapi/tl_bank_card_info_gen.go b/tdapi/tl_bank_card_info_gen.go deleted file mode 100644 index 48828e540..000000000 --- a/tdapi/tl_bank_card_info_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BankCardInfo represents TL type `bankCardInfo#2bc7da9f`. -type BankCardInfo struct { - // Title of the bank card description - Title string - // Actions that can be done with the bank card number - Actions []BankCardActionOpenURL -} - -// BankCardInfoTypeID is TL type id of BankCardInfo. -const BankCardInfoTypeID = 0x2bc7da9f - -// Ensuring interfaces in compile-time for BankCardInfo. -var ( - _ bin.Encoder = &BankCardInfo{} - _ bin.Decoder = &BankCardInfo{} - _ bin.BareEncoder = &BankCardInfo{} - _ bin.BareDecoder = &BankCardInfo{} -) - -func (b *BankCardInfo) Zero() bool { - if b == nil { - return true - } - if !(b.Title == "") { - return false - } - if !(b.Actions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BankCardInfo) String() string { - if b == nil { - return "BankCardInfo(nil)" - } - type Alias BankCardInfo - return fmt.Sprintf("BankCardInfo%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BankCardInfo) TypeID() uint32 { - return BankCardInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*BankCardInfo) TypeName() string { - return "bankCardInfo" -} - -// TypeInfo returns info about TL type. -func (b *BankCardInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "bankCardInfo", - ID: BankCardInfoTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Actions", - SchemaName: "actions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BankCardInfo) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode bankCardInfo#2bc7da9f as nil") - } - buf.PutID(BankCardInfoTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BankCardInfo) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode bankCardInfo#2bc7da9f as nil") - } - buf.PutString(b.Title) - buf.PutInt(len(b.Actions)) - for idx, v := range b.Actions { - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare bankCardInfo#2bc7da9f: field actions element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BankCardInfo) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode bankCardInfo#2bc7da9f to nil") - } - if err := buf.ConsumeID(BankCardInfoTypeID); err != nil { - return fmt.Errorf("unable to decode bankCardInfo#2bc7da9f: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BankCardInfo) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode bankCardInfo#2bc7da9f to nil") - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode bankCardInfo#2bc7da9f: field title: %w", err) - } - b.Title = value - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode bankCardInfo#2bc7da9f: field actions: %w", err) - } - - if headerLen > 0 { - b.Actions = make([]BankCardActionOpenURL, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BankCardActionOpenURL - if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare bankCardInfo#2bc7da9f: field actions: %w", err) - } - b.Actions = append(b.Actions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BankCardInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode bankCardInfo#2bc7da9f as nil") - } - buf.ObjStart() - buf.PutID("bankCardInfo") - buf.Comma() - buf.FieldStart("title") - buf.PutString(b.Title) - buf.Comma() - buf.FieldStart("actions") - buf.ArrStart() - for idx, v := range b.Actions { - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode bankCardInfo#2bc7da9f: field actions element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BankCardInfo) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode bankCardInfo#2bc7da9f to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("bankCardInfo"); err != nil { - return fmt.Errorf("unable to decode bankCardInfo#2bc7da9f: %w", err) - } - case "title": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode bankCardInfo#2bc7da9f: field title: %w", err) - } - b.Title = value - case "actions": - if err := buf.Arr(func(buf tdjson.Decoder) error { - var value BankCardActionOpenURL - if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode bankCardInfo#2bc7da9f: field actions: %w", err) - } - b.Actions = append(b.Actions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode bankCardInfo#2bc7da9f: field actions: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (b *BankCardInfo) GetTitle() (value string) { - if b == nil { - return - } - return b.Title -} - -// GetActions returns value of Actions field. -func (b *BankCardInfo) GetActions() (value []BankCardActionOpenURL) { - if b == nil { - return - } - return b.Actions -} diff --git a/tdapi/tl_basic_group_full_info_gen.go b/tdapi/tl_basic_group_full_info_gen.go deleted file mode 100644 index b58994b20..000000000 --- a/tdapi/tl_basic_group_full_info_gen.go +++ /dev/null @@ -1,492 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BasicGroupFullInfo represents TL type `basicGroupFullInfo#d62e521e`. -type BasicGroupFullInfo struct { - // Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as - // in chat.photo - Photo ChatPhoto - // Contains full information about a basic group - Description string - // User identifier of the creator of the group; 0 if unknown - CreatorUserID int64 - // Group members - Members []ChatMember - // True, if non-administrators and non-bots can be hidden in responses to - // getSupergroupMembers and searchChatMembers for non-administrators after upgrading the - // basic group to a supergroup - CanHideMembers bool - // True, if aggressive anti-spam checks can be enabled or disabled in the supergroup - // after upgrading the basic group to a supergroup - CanToggleAggressiveAntiSpam bool - // Primary invite link for this group; may be null. For chat administrators with - // can_invite_users right only. Updated only after the basic group is opened - InviteLink ChatInviteLink - // List of commands of bots in the group - BotCommands []BotCommands -} - -// BasicGroupFullInfoTypeID is TL type id of BasicGroupFullInfo. -const BasicGroupFullInfoTypeID = 0xd62e521e - -// Ensuring interfaces in compile-time for BasicGroupFullInfo. -var ( - _ bin.Encoder = &BasicGroupFullInfo{} - _ bin.Decoder = &BasicGroupFullInfo{} - _ bin.BareEncoder = &BasicGroupFullInfo{} - _ bin.BareDecoder = &BasicGroupFullInfo{} -) - -func (b *BasicGroupFullInfo) Zero() bool { - if b == nil { - return true - } - if !(b.Photo.Zero()) { - return false - } - if !(b.Description == "") { - return false - } - if !(b.CreatorUserID == 0) { - return false - } - if !(b.Members == nil) { - return false - } - if !(b.CanHideMembers == false) { - return false - } - if !(b.CanToggleAggressiveAntiSpam == false) { - return false - } - if !(b.InviteLink.Zero()) { - return false - } - if !(b.BotCommands == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BasicGroupFullInfo) String() string { - if b == nil { - return "BasicGroupFullInfo(nil)" - } - type Alias BasicGroupFullInfo - return fmt.Sprintf("BasicGroupFullInfo%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BasicGroupFullInfo) TypeID() uint32 { - return BasicGroupFullInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*BasicGroupFullInfo) TypeName() string { - return "basicGroupFullInfo" -} - -// TypeInfo returns info about TL type. -func (b *BasicGroupFullInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "basicGroupFullInfo", - ID: BasicGroupFullInfoTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "CreatorUserID", - SchemaName: "creator_user_id", - }, - { - Name: "Members", - SchemaName: "members", - }, - { - Name: "CanHideMembers", - SchemaName: "can_hide_members", - }, - { - Name: "CanToggleAggressiveAntiSpam", - SchemaName: "can_toggle_aggressive_anti_spam", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "BotCommands", - SchemaName: "bot_commands", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BasicGroupFullInfo) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode basicGroupFullInfo#d62e521e as nil") - } - buf.PutID(BasicGroupFullInfoTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BasicGroupFullInfo) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode basicGroupFullInfo#d62e521e as nil") - } - if err := b.Photo.Encode(buf); err != nil { - return fmt.Errorf("unable to encode basicGroupFullInfo#d62e521e: field photo: %w", err) - } - buf.PutString(b.Description) - buf.PutInt53(b.CreatorUserID) - buf.PutInt(len(b.Members)) - for idx, v := range b.Members { - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare basicGroupFullInfo#d62e521e: field members element with index %d: %w", idx, err) - } - } - buf.PutBool(b.CanHideMembers) - buf.PutBool(b.CanToggleAggressiveAntiSpam) - if err := b.InviteLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode basicGroupFullInfo#d62e521e: field invite_link: %w", err) - } - buf.PutInt(len(b.BotCommands)) - for idx, v := range b.BotCommands { - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare basicGroupFullInfo#d62e521e: field bot_commands element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BasicGroupFullInfo) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode basicGroupFullInfo#d62e521e to nil") - } - if err := buf.ConsumeID(BasicGroupFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BasicGroupFullInfo) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode basicGroupFullInfo#d62e521e to nil") - } - { - if err := b.Photo.Decode(buf); err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field photo: %w", err) - } - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field description: %w", err) - } - b.Description = value - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field creator_user_id: %w", err) - } - b.CreatorUserID = value - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field members: %w", err) - } - - if headerLen > 0 { - b.Members = make([]ChatMember, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatMember - if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare basicGroupFullInfo#d62e521e: field members: %w", err) - } - b.Members = append(b.Members, value) - } - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field can_hide_members: %w", err) - } - b.CanHideMembers = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field can_toggle_aggressive_anti_spam: %w", err) - } - b.CanToggleAggressiveAntiSpam = value - } - { - if err := b.InviteLink.Decode(buf); err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field invite_link: %w", err) - } - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field bot_commands: %w", err) - } - - if headerLen > 0 { - b.BotCommands = make([]BotCommands, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BotCommands - if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare basicGroupFullInfo#d62e521e: field bot_commands: %w", err) - } - b.BotCommands = append(b.BotCommands, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BasicGroupFullInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode basicGroupFullInfo#d62e521e as nil") - } - buf.ObjStart() - buf.PutID("basicGroupFullInfo") - buf.Comma() - buf.FieldStart("photo") - if err := b.Photo.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode basicGroupFullInfo#d62e521e: field photo: %w", err) - } - buf.Comma() - buf.FieldStart("description") - buf.PutString(b.Description) - buf.Comma() - buf.FieldStart("creator_user_id") - buf.PutInt53(b.CreatorUserID) - buf.Comma() - buf.FieldStart("members") - buf.ArrStart() - for idx, v := range b.Members { - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode basicGroupFullInfo#d62e521e: field members element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.FieldStart("can_hide_members") - buf.PutBool(b.CanHideMembers) - buf.Comma() - buf.FieldStart("can_toggle_aggressive_anti_spam") - buf.PutBool(b.CanToggleAggressiveAntiSpam) - buf.Comma() - buf.FieldStart("invite_link") - if err := b.InviteLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode basicGroupFullInfo#d62e521e: field invite_link: %w", err) - } - buf.Comma() - buf.FieldStart("bot_commands") - buf.ArrStart() - for idx, v := range b.BotCommands { - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode basicGroupFullInfo#d62e521e: field bot_commands element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BasicGroupFullInfo) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode basicGroupFullInfo#d62e521e to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("basicGroupFullInfo"); err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: %w", err) - } - case "photo": - if err := b.Photo.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field photo: %w", err) - } - case "description": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field description: %w", err) - } - b.Description = value - case "creator_user_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field creator_user_id: %w", err) - } - b.CreatorUserID = value - case "members": - if err := buf.Arr(func(buf tdjson.Decoder) error { - var value ChatMember - if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field members: %w", err) - } - b.Members = append(b.Members, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field members: %w", err) - } - case "can_hide_members": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field can_hide_members: %w", err) - } - b.CanHideMembers = value - case "can_toggle_aggressive_anti_spam": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field can_toggle_aggressive_anti_spam: %w", err) - } - b.CanToggleAggressiveAntiSpam = value - case "invite_link": - if err := b.InviteLink.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field invite_link: %w", err) - } - case "bot_commands": - if err := buf.Arr(func(buf tdjson.Decoder) error { - var value BotCommands - if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field bot_commands: %w", err) - } - b.BotCommands = append(b.BotCommands, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode basicGroupFullInfo#d62e521e: field bot_commands: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (b *BasicGroupFullInfo) GetPhoto() (value ChatPhoto) { - if b == nil { - return - } - return b.Photo -} - -// GetDescription returns value of Description field. -func (b *BasicGroupFullInfo) GetDescription() (value string) { - if b == nil { - return - } - return b.Description -} - -// GetCreatorUserID returns value of CreatorUserID field. -func (b *BasicGroupFullInfo) GetCreatorUserID() (value int64) { - if b == nil { - return - } - return b.CreatorUserID -} - -// GetMembers returns value of Members field. -func (b *BasicGroupFullInfo) GetMembers() (value []ChatMember) { - if b == nil { - return - } - return b.Members -} - -// GetCanHideMembers returns value of CanHideMembers field. -func (b *BasicGroupFullInfo) GetCanHideMembers() (value bool) { - if b == nil { - return - } - return b.CanHideMembers -} - -// GetCanToggleAggressiveAntiSpam returns value of CanToggleAggressiveAntiSpam field. -func (b *BasicGroupFullInfo) GetCanToggleAggressiveAntiSpam() (value bool) { - if b == nil { - return - } - return b.CanToggleAggressiveAntiSpam -} - -// GetInviteLink returns value of InviteLink field. -func (b *BasicGroupFullInfo) GetInviteLink() (value ChatInviteLink) { - if b == nil { - return - } - return b.InviteLink -} - -// GetBotCommands returns value of BotCommands field. -func (b *BasicGroupFullInfo) GetBotCommands() (value []BotCommands) { - if b == nil { - return - } - return b.BotCommands -} diff --git a/tdapi/tl_basic_group_gen.go b/tdapi/tl_basic_group_gen.go deleted file mode 100644 index 70dd50ea4..000000000 --- a/tdapi/tl_basic_group_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BasicGroup represents TL type `basicGroup#f464168f`. -type BasicGroup struct { - // Group identifier - ID int64 - // Number of members in the group - MemberCount int32 - // Status of the current user in the group - Status ChatMemberStatusClass - // True, if the group is active - IsActive bool - // Identifier of the supergroup to which this group was upgraded; 0 if none - UpgradedToSupergroupID int64 -} - -// BasicGroupTypeID is TL type id of BasicGroup. -const BasicGroupTypeID = 0xf464168f - -// Ensuring interfaces in compile-time for BasicGroup. -var ( - _ bin.Encoder = &BasicGroup{} - _ bin.Decoder = &BasicGroup{} - _ bin.BareEncoder = &BasicGroup{} - _ bin.BareDecoder = &BasicGroup{} -) - -func (b *BasicGroup) Zero() bool { - if b == nil { - return true - } - if !(b.ID == 0) { - return false - } - if !(b.MemberCount == 0) { - return false - } - if !(b.Status == nil) { - return false - } - if !(b.IsActive == false) { - return false - } - if !(b.UpgradedToSupergroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BasicGroup) String() string { - if b == nil { - return "BasicGroup(nil)" - } - type Alias BasicGroup - return fmt.Sprintf("BasicGroup%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BasicGroup) TypeID() uint32 { - return BasicGroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*BasicGroup) TypeName() string { - return "basicGroup" -} - -// TypeInfo returns info about TL type. -func (b *BasicGroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "basicGroup", - ID: BasicGroupTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "MemberCount", - SchemaName: "member_count", - }, - { - Name: "Status", - SchemaName: "status", - }, - { - Name: "IsActive", - SchemaName: "is_active", - }, - { - Name: "UpgradedToSupergroupID", - SchemaName: "upgraded_to_supergroup_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BasicGroup) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode basicGroup#f464168f as nil") - } - buf.PutID(BasicGroupTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BasicGroup) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode basicGroup#f464168f as nil") - } - buf.PutInt53(b.ID) - buf.PutInt32(b.MemberCount) - if b.Status == nil { - return fmt.Errorf("unable to encode basicGroup#f464168f: field status is nil") - } - if err := b.Status.Encode(buf); err != nil { - return fmt.Errorf("unable to encode basicGroup#f464168f: field status: %w", err) - } - buf.PutBool(b.IsActive) - buf.PutInt53(b.UpgradedToSupergroupID) - return nil -} - -// Decode implements bin.Decoder. -func (b *BasicGroup) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode basicGroup#f464168f to nil") - } - if err := buf.ConsumeID(BasicGroupTypeID); err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BasicGroup) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode basicGroup#f464168f to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: field id: %w", err) - } - b.ID = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: field member_count: %w", err) - } - b.MemberCount = value - } - { - value, err := DecodeChatMemberStatus(buf) - if err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: field status: %w", err) - } - b.Status = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: field is_active: %w", err) - } - b.IsActive = value - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: field upgraded_to_supergroup_id: %w", err) - } - b.UpgradedToSupergroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BasicGroup) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode basicGroup#f464168f as nil") - } - buf.ObjStart() - buf.PutID("basicGroup") - buf.Comma() - buf.FieldStart("id") - buf.PutInt53(b.ID) - buf.Comma() - buf.FieldStart("member_count") - buf.PutInt32(b.MemberCount) - buf.Comma() - buf.FieldStart("status") - if b.Status == nil { - return fmt.Errorf("unable to encode basicGroup#f464168f: field status is nil") - } - if err := b.Status.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode basicGroup#f464168f: field status: %w", err) - } - buf.Comma() - buf.FieldStart("is_active") - buf.PutBool(b.IsActive) - buf.Comma() - buf.FieldStart("upgraded_to_supergroup_id") - buf.PutInt53(b.UpgradedToSupergroupID) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BasicGroup) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode basicGroup#f464168f to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("basicGroup"); err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: %w", err) - } - case "id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: field id: %w", err) - } - b.ID = value - case "member_count": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: field member_count: %w", err) - } - b.MemberCount = value - case "status": - value, err := DecodeTDLibJSONChatMemberStatus(buf) - if err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: field status: %w", err) - } - b.Status = value - case "is_active": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: field is_active: %w", err) - } - b.IsActive = value - case "upgraded_to_supergroup_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode basicGroup#f464168f: field upgraded_to_supergroup_id: %w", err) - } - b.UpgradedToSupergroupID = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (b *BasicGroup) GetID() (value int64) { - if b == nil { - return - } - return b.ID -} - -// GetMemberCount returns value of MemberCount field. -func (b *BasicGroup) GetMemberCount() (value int32) { - if b == nil { - return - } - return b.MemberCount -} - -// GetStatus returns value of Status field. -func (b *BasicGroup) GetStatus() (value ChatMemberStatusClass) { - if b == nil { - return - } - return b.Status -} - -// GetIsActive returns value of IsActive field. -func (b *BasicGroup) GetIsActive() (value bool) { - if b == nil { - return - } - return b.IsActive -} - -// GetUpgradedToSupergroupID returns value of UpgradedToSupergroupID field. -func (b *BasicGroup) GetUpgradedToSupergroupID() (value int64) { - if b == nil { - return - } - return b.UpgradedToSupergroupID -} diff --git a/tdapi/tl_birthdate_gen.go b/tdapi/tl_birthdate_gen.go deleted file mode 100644 index e87623401..000000000 --- a/tdapi/tl_birthdate_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Birthdate represents TL type `birthdate#61fe6d1e`. -type Birthdate struct { - // Day of the month; 1-31 - Day int32 - // Month of the year; 1-12 - Month int32 - // Birth year; 0 if unknown - Year int32 -} - -// BirthdateTypeID is TL type id of Birthdate. -const BirthdateTypeID = 0x61fe6d1e - -// Ensuring interfaces in compile-time for Birthdate. -var ( - _ bin.Encoder = &Birthdate{} - _ bin.Decoder = &Birthdate{} - _ bin.BareEncoder = &Birthdate{} - _ bin.BareDecoder = &Birthdate{} -) - -func (b *Birthdate) Zero() bool { - if b == nil { - return true - } - if !(b.Day == 0) { - return false - } - if !(b.Month == 0) { - return false - } - if !(b.Year == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *Birthdate) String() string { - if b == nil { - return "Birthdate(nil)" - } - type Alias Birthdate - return fmt.Sprintf("Birthdate%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Birthdate) TypeID() uint32 { - return BirthdateTypeID -} - -// TypeName returns name of type in TL schema. -func (*Birthdate) TypeName() string { - return "birthdate" -} - -// TypeInfo returns info about TL type. -func (b *Birthdate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "birthdate", - ID: BirthdateTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Day", - SchemaName: "day", - }, - { - Name: "Month", - SchemaName: "month", - }, - { - Name: "Year", - SchemaName: "year", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *Birthdate) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode birthdate#61fe6d1e as nil") - } - buf.PutID(BirthdateTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *Birthdate) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode birthdate#61fe6d1e as nil") - } - buf.PutInt32(b.Day) - buf.PutInt32(b.Month) - buf.PutInt32(b.Year) - return nil -} - -// Decode implements bin.Decoder. -func (b *Birthdate) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode birthdate#61fe6d1e to nil") - } - if err := buf.ConsumeID(BirthdateTypeID); err != nil { - return fmt.Errorf("unable to decode birthdate#61fe6d1e: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *Birthdate) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode birthdate#61fe6d1e to nil") - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode birthdate#61fe6d1e: field day: %w", err) - } - b.Day = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode birthdate#61fe6d1e: field month: %w", err) - } - b.Month = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode birthdate#61fe6d1e: field year: %w", err) - } - b.Year = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *Birthdate) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode birthdate#61fe6d1e as nil") - } - buf.ObjStart() - buf.PutID("birthdate") - buf.Comma() - buf.FieldStart("day") - buf.PutInt32(b.Day) - buf.Comma() - buf.FieldStart("month") - buf.PutInt32(b.Month) - buf.Comma() - buf.FieldStart("year") - buf.PutInt32(b.Year) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *Birthdate) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode birthdate#61fe6d1e to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("birthdate"); err != nil { - return fmt.Errorf("unable to decode birthdate#61fe6d1e: %w", err) - } - case "day": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode birthdate#61fe6d1e: field day: %w", err) - } - b.Day = value - case "month": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode birthdate#61fe6d1e: field month: %w", err) - } - b.Month = value - case "year": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode birthdate#61fe6d1e: field year: %w", err) - } - b.Year = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetDay returns value of Day field. -func (b *Birthdate) GetDay() (value int32) { - if b == nil { - return - } - return b.Day -} - -// GetMonth returns value of Month field. -func (b *Birthdate) GetMonth() (value int32) { - if b == nil { - return - } - return b.Month -} - -// GetYear returns value of Year field. -func (b *Birthdate) GetYear() (value int32) { - if b == nil { - return - } - return b.Year -} diff --git a/tdapi/tl_block_list_gen.go b/tdapi/tl_block_list_gen.go deleted file mode 100644 index 808080046..000000000 --- a/tdapi/tl_block_list_gen.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BlockListMain represents TL type `blockListMain#50a4137c`. -type BlockListMain struct { -} - -// BlockListMainTypeID is TL type id of BlockListMain. -const BlockListMainTypeID = 0x50a4137c - -// construct implements constructor of BlockListClass. -func (b BlockListMain) construct() BlockListClass { return &b } - -// Ensuring interfaces in compile-time for BlockListMain. -var ( - _ bin.Encoder = &BlockListMain{} - _ bin.Decoder = &BlockListMain{} - _ bin.BareEncoder = &BlockListMain{} - _ bin.BareDecoder = &BlockListMain{} - - _ BlockListClass = &BlockListMain{} -) - -func (b *BlockListMain) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BlockListMain) String() string { - if b == nil { - return "BlockListMain(nil)" - } - type Alias BlockListMain - return fmt.Sprintf("BlockListMain%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BlockListMain) TypeID() uint32 { - return BlockListMainTypeID -} - -// TypeName returns name of type in TL schema. -func (*BlockListMain) TypeName() string { - return "blockListMain" -} - -// TypeInfo returns info about TL type. -func (b *BlockListMain) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "blockListMain", - ID: BlockListMainTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BlockListMain) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode blockListMain#50a4137c as nil") - } - buf.PutID(BlockListMainTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BlockListMain) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode blockListMain#50a4137c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BlockListMain) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode blockListMain#50a4137c to nil") - } - if err := buf.ConsumeID(BlockListMainTypeID); err != nil { - return fmt.Errorf("unable to decode blockListMain#50a4137c: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BlockListMain) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode blockListMain#50a4137c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BlockListMain) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode blockListMain#50a4137c as nil") - } - buf.ObjStart() - buf.PutID("blockListMain") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BlockListMain) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode blockListMain#50a4137c to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("blockListMain"); err != nil { - return fmt.Errorf("unable to decode blockListMain#50a4137c: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BlockListStories represents TL type `blockListStories#628965c`. -type BlockListStories struct { -} - -// BlockListStoriesTypeID is TL type id of BlockListStories. -const BlockListStoriesTypeID = 0x628965c - -// construct implements constructor of BlockListClass. -func (b BlockListStories) construct() BlockListClass { return &b } - -// Ensuring interfaces in compile-time for BlockListStories. -var ( - _ bin.Encoder = &BlockListStories{} - _ bin.Decoder = &BlockListStories{} - _ bin.BareEncoder = &BlockListStories{} - _ bin.BareDecoder = &BlockListStories{} - - _ BlockListClass = &BlockListStories{} -) - -func (b *BlockListStories) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BlockListStories) String() string { - if b == nil { - return "BlockListStories(nil)" - } - type Alias BlockListStories - return fmt.Sprintf("BlockListStories%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BlockListStories) TypeID() uint32 { - return BlockListStoriesTypeID -} - -// TypeName returns name of type in TL schema. -func (*BlockListStories) TypeName() string { - return "blockListStories" -} - -// TypeInfo returns info about TL type. -func (b *BlockListStories) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "blockListStories", - ID: BlockListStoriesTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BlockListStories) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode blockListStories#628965c as nil") - } - buf.PutID(BlockListStoriesTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BlockListStories) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode blockListStories#628965c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BlockListStories) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode blockListStories#628965c to nil") - } - if err := buf.ConsumeID(BlockListStoriesTypeID); err != nil { - return fmt.Errorf("unable to decode blockListStories#628965c: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BlockListStories) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode blockListStories#628965c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BlockListStories) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode blockListStories#628965c as nil") - } - buf.ObjStart() - buf.PutID("blockListStories") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BlockListStories) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode blockListStories#628965c to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("blockListStories"); err != nil { - return fmt.Errorf("unable to decode blockListStories#628965c: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BlockListClassName is schema name of BlockListClass. -const BlockListClassName = "BlockList" - -// BlockListClass represents BlockList generic type. -// -// Example: -// -// g, err := tdapi.DecodeBlockList(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.BlockListMain: // blockListMain#50a4137c -// case *tdapi.BlockListStories: // blockListStories#628965c -// default: panic(v) -// } -type BlockListClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() BlockListClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeBlockList implements binary de-serialization for BlockListClass. -func DecodeBlockList(buf *bin.Buffer) (BlockListClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case BlockListMainTypeID: - // Decoding blockListMain#50a4137c. - v := BlockListMain{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BlockListClass: %w", err) - } - return &v, nil - case BlockListStoriesTypeID: - // Decoding blockListStories#628965c. - v := BlockListStories{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BlockListClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BlockListClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONBlockList implements binary de-serialization for BlockListClass. -func DecodeTDLibJSONBlockList(buf tdjson.Decoder) (BlockListClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "blockListMain": - // Decoding blockListMain#50a4137c. - v := BlockListMain{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BlockListClass: %w", err) - } - return &v, nil - case "blockListStories": - // Decoding blockListStories#628965c. - v := BlockListStories{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BlockListClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BlockListClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// BlockList boxes the BlockListClass providing a helper. -type BlockListBox struct { - BlockList BlockListClass -} - -// Decode implements bin.Decoder for BlockListBox. -func (b *BlockListBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode BlockListBox to nil") - } - v, err := DecodeBlockList(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BlockList = v - return nil -} - -// Encode implements bin.Encode for BlockListBox. -func (b *BlockListBox) Encode(buf *bin.Buffer) error { - if b == nil || b.BlockList == nil { - return fmt.Errorf("unable to encode BlockListClass as nil") - } - return b.BlockList.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for BlockListBox. -func (b *BlockListBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode BlockListBox to nil") - } - v, err := DecodeTDLibJSONBlockList(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BlockList = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for BlockListBox. -func (b *BlockListBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.BlockList == nil { - return fmt.Errorf("unable to encode BlockListClass as nil") - } - return b.BlockList.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_block_message_sender_from_replies_gen.go b/tdapi/tl_block_message_sender_from_replies_gen.go deleted file mode 100644 index 45d71be4d..000000000 --- a/tdapi/tl_block_message_sender_from_replies_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BlockMessageSenderFromRepliesRequest represents TL type `blockMessageSenderFromReplies#b79df58b`. -type BlockMessageSenderFromRepliesRequest struct { - // The identifier of an incoming message in the Replies chat - MessageID int64 - // Pass true to delete the message - DeleteMessage bool - // Pass true to delete all messages from the same sender - DeleteAllMessages bool - // Pass true to report the sender to the Telegram moderators - ReportSpam bool -} - -// BlockMessageSenderFromRepliesRequestTypeID is TL type id of BlockMessageSenderFromRepliesRequest. -const BlockMessageSenderFromRepliesRequestTypeID = 0xb79df58b - -// Ensuring interfaces in compile-time for BlockMessageSenderFromRepliesRequest. -var ( - _ bin.Encoder = &BlockMessageSenderFromRepliesRequest{} - _ bin.Decoder = &BlockMessageSenderFromRepliesRequest{} - _ bin.BareEncoder = &BlockMessageSenderFromRepliesRequest{} - _ bin.BareDecoder = &BlockMessageSenderFromRepliesRequest{} -) - -func (b *BlockMessageSenderFromRepliesRequest) Zero() bool { - if b == nil { - return true - } - if !(b.MessageID == 0) { - return false - } - if !(b.DeleteMessage == false) { - return false - } - if !(b.DeleteAllMessages == false) { - return false - } - if !(b.ReportSpam == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BlockMessageSenderFromRepliesRequest) String() string { - if b == nil { - return "BlockMessageSenderFromRepliesRequest(nil)" - } - type Alias BlockMessageSenderFromRepliesRequest - return fmt.Sprintf("BlockMessageSenderFromRepliesRequest%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BlockMessageSenderFromRepliesRequest) TypeID() uint32 { - return BlockMessageSenderFromRepliesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*BlockMessageSenderFromRepliesRequest) TypeName() string { - return "blockMessageSenderFromReplies" -} - -// TypeInfo returns info about TL type. -func (b *BlockMessageSenderFromRepliesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "blockMessageSenderFromReplies", - ID: BlockMessageSenderFromRepliesRequestTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "DeleteMessage", - SchemaName: "delete_message", - }, - { - Name: "DeleteAllMessages", - SchemaName: "delete_all_messages", - }, - { - Name: "ReportSpam", - SchemaName: "report_spam", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BlockMessageSenderFromRepliesRequest) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode blockMessageSenderFromReplies#b79df58b as nil") - } - buf.PutID(BlockMessageSenderFromRepliesRequestTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BlockMessageSenderFromRepliesRequest) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode blockMessageSenderFromReplies#b79df58b as nil") - } - buf.PutInt53(b.MessageID) - buf.PutBool(b.DeleteMessage) - buf.PutBool(b.DeleteAllMessages) - buf.PutBool(b.ReportSpam) - return nil -} - -// Decode implements bin.Decoder. -func (b *BlockMessageSenderFromRepliesRequest) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode blockMessageSenderFromReplies#b79df58b to nil") - } - if err := buf.ConsumeID(BlockMessageSenderFromRepliesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode blockMessageSenderFromReplies#b79df58b: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BlockMessageSenderFromRepliesRequest) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode blockMessageSenderFromReplies#b79df58b to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode blockMessageSenderFromReplies#b79df58b: field message_id: %w", err) - } - b.MessageID = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode blockMessageSenderFromReplies#b79df58b: field delete_message: %w", err) - } - b.DeleteMessage = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode blockMessageSenderFromReplies#b79df58b: field delete_all_messages: %w", err) - } - b.DeleteAllMessages = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode blockMessageSenderFromReplies#b79df58b: field report_spam: %w", err) - } - b.ReportSpam = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BlockMessageSenderFromRepliesRequest) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode blockMessageSenderFromReplies#b79df58b as nil") - } - buf.ObjStart() - buf.PutID("blockMessageSenderFromReplies") - buf.Comma() - buf.FieldStart("message_id") - buf.PutInt53(b.MessageID) - buf.Comma() - buf.FieldStart("delete_message") - buf.PutBool(b.DeleteMessage) - buf.Comma() - buf.FieldStart("delete_all_messages") - buf.PutBool(b.DeleteAllMessages) - buf.Comma() - buf.FieldStart("report_spam") - buf.PutBool(b.ReportSpam) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BlockMessageSenderFromRepliesRequest) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode blockMessageSenderFromReplies#b79df58b to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("blockMessageSenderFromReplies"); err != nil { - return fmt.Errorf("unable to decode blockMessageSenderFromReplies#b79df58b: %w", err) - } - case "message_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode blockMessageSenderFromReplies#b79df58b: field message_id: %w", err) - } - b.MessageID = value - case "delete_message": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode blockMessageSenderFromReplies#b79df58b: field delete_message: %w", err) - } - b.DeleteMessage = value - case "delete_all_messages": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode blockMessageSenderFromReplies#b79df58b: field delete_all_messages: %w", err) - } - b.DeleteAllMessages = value - case "report_spam": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode blockMessageSenderFromReplies#b79df58b: field report_spam: %w", err) - } - b.ReportSpam = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetMessageID returns value of MessageID field. -func (b *BlockMessageSenderFromRepliesRequest) GetMessageID() (value int64) { - if b == nil { - return - } - return b.MessageID -} - -// GetDeleteMessage returns value of DeleteMessage field. -func (b *BlockMessageSenderFromRepliesRequest) GetDeleteMessage() (value bool) { - if b == nil { - return - } - return b.DeleteMessage -} - -// GetDeleteAllMessages returns value of DeleteAllMessages field. -func (b *BlockMessageSenderFromRepliesRequest) GetDeleteAllMessages() (value bool) { - if b == nil { - return - } - return b.DeleteAllMessages -} - -// GetReportSpam returns value of ReportSpam field. -func (b *BlockMessageSenderFromRepliesRequest) GetReportSpam() (value bool) { - if b == nil { - return - } - return b.ReportSpam -} - -// BlockMessageSenderFromReplies invokes method blockMessageSenderFromReplies#b79df58b returning error if any. -func (c *Client) BlockMessageSenderFromReplies(ctx context.Context, request *BlockMessageSenderFromRepliesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_bool_gen.go b/tdapi/tl_bool_gen.go deleted file mode 100644 index fbb083ff0..000000000 --- a/tdapi/tl_bool_gen.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BoolFalse represents TL type `boolFalse#bc799737`. -type BoolFalse struct { -} - -// BoolFalseTypeID is TL type id of BoolFalse. -const BoolFalseTypeID = 0xbc799737 - -// construct implements constructor of BoolClass. -func (b BoolFalse) construct() BoolClass { return &b } - -// Ensuring interfaces in compile-time for BoolFalse. -var ( - _ bin.Encoder = &BoolFalse{} - _ bin.Decoder = &BoolFalse{} - _ bin.BareEncoder = &BoolFalse{} - _ bin.BareDecoder = &BoolFalse{} - - _ BoolClass = &BoolFalse{} -) - -func (b *BoolFalse) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BoolFalse) String() string { - if b == nil { - return "BoolFalse(nil)" - } - type Alias BoolFalse - return fmt.Sprintf("BoolFalse%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BoolFalse) TypeID() uint32 { - return BoolFalseTypeID -} - -// TypeName returns name of type in TL schema. -func (*BoolFalse) TypeName() string { - return "boolFalse" -} - -// TypeInfo returns info about TL type. -func (b *BoolFalse) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "boolFalse", - ID: BoolFalseTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BoolFalse) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode boolFalse#bc799737 as nil") - } - buf.PutID(BoolFalseTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BoolFalse) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode boolFalse#bc799737 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BoolFalse) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode boolFalse#bc799737 to nil") - } - if err := buf.ConsumeID(BoolFalseTypeID); err != nil { - return fmt.Errorf("unable to decode boolFalse#bc799737: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BoolFalse) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode boolFalse#bc799737 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BoolFalse) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode boolFalse#bc799737 as nil") - } - buf.ObjStart() - buf.PutID("boolFalse") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BoolFalse) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode boolFalse#bc799737 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("boolFalse"); err != nil { - return fmt.Errorf("unable to decode boolFalse#bc799737: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BoolTrue represents TL type `boolTrue#997275b5`. -type BoolTrue struct { -} - -// BoolTrueTypeID is TL type id of BoolTrue. -const BoolTrueTypeID = 0x997275b5 - -// construct implements constructor of BoolClass. -func (b BoolTrue) construct() BoolClass { return &b } - -// Ensuring interfaces in compile-time for BoolTrue. -var ( - _ bin.Encoder = &BoolTrue{} - _ bin.Decoder = &BoolTrue{} - _ bin.BareEncoder = &BoolTrue{} - _ bin.BareDecoder = &BoolTrue{} - - _ BoolClass = &BoolTrue{} -) - -func (b *BoolTrue) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BoolTrue) String() string { - if b == nil { - return "BoolTrue(nil)" - } - type Alias BoolTrue - return fmt.Sprintf("BoolTrue%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BoolTrue) TypeID() uint32 { - return BoolTrueTypeID -} - -// TypeName returns name of type in TL schema. -func (*BoolTrue) TypeName() string { - return "boolTrue" -} - -// TypeInfo returns info about TL type. -func (b *BoolTrue) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "boolTrue", - ID: BoolTrueTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BoolTrue) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode boolTrue#997275b5 as nil") - } - buf.PutID(BoolTrueTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BoolTrue) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode boolTrue#997275b5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BoolTrue) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode boolTrue#997275b5 to nil") - } - if err := buf.ConsumeID(BoolTrueTypeID); err != nil { - return fmt.Errorf("unable to decode boolTrue#997275b5: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BoolTrue) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode boolTrue#997275b5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BoolTrue) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode boolTrue#997275b5 as nil") - } - buf.ObjStart() - buf.PutID("boolTrue") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BoolTrue) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode boolTrue#997275b5 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("boolTrue"); err != nil { - return fmt.Errorf("unable to decode boolTrue#997275b5: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BoolClassName is schema name of BoolClass. -const BoolClassName = "Bool" - -// BoolClass represents Bool generic type. -// -// Example: -// -// g, err := tdapi.DecodeBool(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.BoolFalse: // boolFalse#bc799737 -// case *tdapi.BoolTrue: // boolTrue#997275b5 -// default: panic(v) -// } -type BoolClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() BoolClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeBool implements binary de-serialization for BoolClass. -func DecodeBool(buf *bin.Buffer) (BoolClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case BoolFalseTypeID: - // Decoding boolFalse#bc799737. - v := BoolFalse{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BoolClass: %w", err) - } - return &v, nil - case BoolTrueTypeID: - // Decoding boolTrue#997275b5. - v := BoolTrue{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BoolClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BoolClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONBool implements binary de-serialization for BoolClass. -func DecodeTDLibJSONBool(buf tdjson.Decoder) (BoolClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "boolFalse": - // Decoding boolFalse#bc799737. - v := BoolFalse{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BoolClass: %w", err) - } - return &v, nil - case "boolTrue": - // Decoding boolTrue#997275b5. - v := BoolTrue{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BoolClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BoolClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// Bool boxes the BoolClass providing a helper. -type BoolBox struct { - Bool BoolClass -} - -// Decode implements bin.Decoder for BoolBox. -func (b *BoolBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode BoolBox to nil") - } - v, err := DecodeBool(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.Bool = v - return nil -} - -// Encode implements bin.Encode for BoolBox. -func (b *BoolBox) Encode(buf *bin.Buffer) error { - if b == nil || b.Bool == nil { - return fmt.Errorf("unable to encode BoolClass as nil") - } - return b.Bool.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for BoolBox. -func (b *BoolBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode BoolBox to nil") - } - v, err := DecodeTDLibJSONBool(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.Bool = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for BoolBox. -func (b *BoolBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.Bool == nil { - return fmt.Errorf("unable to encode BoolClass as nil") - } - return b.Bool.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_boost_chat_gen.go b/tdapi/tl_boost_chat_gen.go deleted file mode 100644 index 9f866a939..000000000 --- a/tdapi/tl_boost_chat_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BoostChatRequest represents TL type `boostChat#890ccd68`. -type BoostChatRequest struct { - // Identifier of the chat - ChatID int64 - // Identifiers of boost slots of the current user from which to apply boosts to the chat - SlotIDs []int32 -} - -// BoostChatRequestTypeID is TL type id of BoostChatRequest. -const BoostChatRequestTypeID = 0x890ccd68 - -// Ensuring interfaces in compile-time for BoostChatRequest. -var ( - _ bin.Encoder = &BoostChatRequest{} - _ bin.Decoder = &BoostChatRequest{} - _ bin.BareEncoder = &BoostChatRequest{} - _ bin.BareDecoder = &BoostChatRequest{} -) - -func (b *BoostChatRequest) Zero() bool { - if b == nil { - return true - } - if !(b.ChatID == 0) { - return false - } - if !(b.SlotIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BoostChatRequest) String() string { - if b == nil { - return "BoostChatRequest(nil)" - } - type Alias BoostChatRequest - return fmt.Sprintf("BoostChatRequest%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BoostChatRequest) TypeID() uint32 { - return BoostChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*BoostChatRequest) TypeName() string { - return "boostChat" -} - -// TypeInfo returns info about TL type. -func (b *BoostChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "boostChat", - ID: BoostChatRequestTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "SlotIDs", - SchemaName: "slot_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BoostChatRequest) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode boostChat#890ccd68 as nil") - } - buf.PutID(BoostChatRequestTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BoostChatRequest) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode boostChat#890ccd68 as nil") - } - buf.PutInt53(b.ChatID) - buf.PutInt(len(b.SlotIDs)) - for _, v := range b.SlotIDs { - buf.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BoostChatRequest) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode boostChat#890ccd68 to nil") - } - if err := buf.ConsumeID(BoostChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode boostChat#890ccd68: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BoostChatRequest) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode boostChat#890ccd68 to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode boostChat#890ccd68: field chat_id: %w", err) - } - b.ChatID = value - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode boostChat#890ccd68: field slot_ids: %w", err) - } - - if headerLen > 0 { - b.SlotIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode boostChat#890ccd68: field slot_ids: %w", err) - } - b.SlotIDs = append(b.SlotIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BoostChatRequest) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode boostChat#890ccd68 as nil") - } - buf.ObjStart() - buf.PutID("boostChat") - buf.Comma() - buf.FieldStart("chat_id") - buf.PutInt53(b.ChatID) - buf.Comma() - buf.FieldStart("slot_ids") - buf.ArrStart() - for _, v := range b.SlotIDs { - buf.PutInt32(v) - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BoostChatRequest) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode boostChat#890ccd68 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("boostChat"); err != nil { - return fmt.Errorf("unable to decode boostChat#890ccd68: %w", err) - } - case "chat_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode boostChat#890ccd68: field chat_id: %w", err) - } - b.ChatID = value - case "slot_ids": - if err := buf.Arr(func(buf tdjson.Decoder) error { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode boostChat#890ccd68: field slot_ids: %w", err) - } - b.SlotIDs = append(b.SlotIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode boostChat#890ccd68: field slot_ids: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (b *BoostChatRequest) GetChatID() (value int64) { - if b == nil { - return - } - return b.ChatID -} - -// GetSlotIDs returns value of SlotIDs field. -func (b *BoostChatRequest) GetSlotIDs() (value []int32) { - if b == nil { - return - } - return b.SlotIDs -} - -// BoostChat invokes method boostChat#890ccd68 returning error if any. -func (c *Client) BoostChat(ctx context.Context, request *BoostChatRequest) (*ChatBoostSlots, error) { - var result ChatBoostSlots - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_bot_command_gen.go b/tdapi/tl_bot_command_gen.go deleted file mode 100644 index 0aa6c2cdc..000000000 --- a/tdapi/tl_bot_command_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BotCommand represents TL type `botCommand#c27ac8c7`. -type BotCommand struct { - // Text of the bot command - Command string - // Represents a command supported by a bot - Description string -} - -// BotCommandTypeID is TL type id of BotCommand. -const BotCommandTypeID = 0xc27ac8c7 - -// Ensuring interfaces in compile-time for BotCommand. -var ( - _ bin.Encoder = &BotCommand{} - _ bin.Decoder = &BotCommand{} - _ bin.BareEncoder = &BotCommand{} - _ bin.BareDecoder = &BotCommand{} -) - -func (b *BotCommand) Zero() bool { - if b == nil { - return true - } - if !(b.Command == "") { - return false - } - if !(b.Description == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotCommand) String() string { - if b == nil { - return "BotCommand(nil)" - } - type Alias BotCommand - return fmt.Sprintf("BotCommand%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotCommand) TypeID() uint32 { - return BotCommandTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotCommand) TypeName() string { - return "botCommand" -} - -// TypeInfo returns info about TL type. -func (b *BotCommand) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botCommand", - ID: BotCommandTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Command", - SchemaName: "command", - }, - { - Name: "Description", - SchemaName: "description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotCommand) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommand#c27ac8c7 as nil") - } - buf.PutID(BotCommandTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotCommand) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommand#c27ac8c7 as nil") - } - buf.PutString(b.Command) - buf.PutString(b.Description) - return nil -} - -// Decode implements bin.Decoder. -func (b *BotCommand) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommand#c27ac8c7 to nil") - } - if err := buf.ConsumeID(BotCommandTypeID); err != nil { - return fmt.Errorf("unable to decode botCommand#c27ac8c7: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotCommand) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommand#c27ac8c7 to nil") - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botCommand#c27ac8c7: field command: %w", err) - } - b.Command = value - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botCommand#c27ac8c7: field description: %w", err) - } - b.Description = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotCommand) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botCommand#c27ac8c7 as nil") - } - buf.ObjStart() - buf.PutID("botCommand") - buf.Comma() - buf.FieldStart("command") - buf.PutString(b.Command) - buf.Comma() - buf.FieldStart("description") - buf.PutString(b.Description) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotCommand) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botCommand#c27ac8c7 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botCommand"); err != nil { - return fmt.Errorf("unable to decode botCommand#c27ac8c7: %w", err) - } - case "command": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botCommand#c27ac8c7: field command: %w", err) - } - b.Command = value - case "description": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botCommand#c27ac8c7: field description: %w", err) - } - b.Description = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetCommand returns value of Command field. -func (b *BotCommand) GetCommand() (value string) { - if b == nil { - return - } - return b.Command -} - -// GetDescription returns value of Description field. -func (b *BotCommand) GetDescription() (value string) { - if b == nil { - return - } - return b.Description -} diff --git a/tdapi/tl_bot_command_scope_gen.go b/tdapi/tl_bot_command_scope_gen.go deleted file mode 100644 index 510744e60..000000000 --- a/tdapi/tl_bot_command_scope_gen.go +++ /dev/null @@ -1,1300 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BotCommandScopeDefault represents TL type `botCommandScopeDefault#2f6cb2ab`. -type BotCommandScopeDefault struct { -} - -// BotCommandScopeDefaultTypeID is TL type id of BotCommandScopeDefault. -const BotCommandScopeDefaultTypeID = 0x2f6cb2ab - -// construct implements constructor of BotCommandScopeClass. -func (b BotCommandScopeDefault) construct() BotCommandScopeClass { return &b } - -// Ensuring interfaces in compile-time for BotCommandScopeDefault. -var ( - _ bin.Encoder = &BotCommandScopeDefault{} - _ bin.Decoder = &BotCommandScopeDefault{} - _ bin.BareEncoder = &BotCommandScopeDefault{} - _ bin.BareDecoder = &BotCommandScopeDefault{} - - _ BotCommandScopeClass = &BotCommandScopeDefault{} -) - -func (b *BotCommandScopeDefault) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotCommandScopeDefault) String() string { - if b == nil { - return "BotCommandScopeDefault(nil)" - } - type Alias BotCommandScopeDefault - return fmt.Sprintf("BotCommandScopeDefault%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotCommandScopeDefault) TypeID() uint32 { - return BotCommandScopeDefaultTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotCommandScopeDefault) TypeName() string { - return "botCommandScopeDefault" -} - -// TypeInfo returns info about TL type. -func (b *BotCommandScopeDefault) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botCommandScopeDefault", - ID: BotCommandScopeDefaultTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BotCommandScopeDefault) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeDefault#2f6cb2ab as nil") - } - buf.PutID(BotCommandScopeDefaultTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotCommandScopeDefault) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeDefault#2f6cb2ab as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotCommandScopeDefault) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeDefault#2f6cb2ab to nil") - } - if err := buf.ConsumeID(BotCommandScopeDefaultTypeID); err != nil { - return fmt.Errorf("unable to decode botCommandScopeDefault#2f6cb2ab: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotCommandScopeDefault) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeDefault#2f6cb2ab to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotCommandScopeDefault) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeDefault#2f6cb2ab as nil") - } - buf.ObjStart() - buf.PutID("botCommandScopeDefault") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotCommandScopeDefault) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeDefault#2f6cb2ab to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botCommandScopeDefault"); err != nil { - return fmt.Errorf("unable to decode botCommandScopeDefault#2f6cb2ab: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BotCommandScopeAllPrivateChats represents TL type `botCommandScopeAllPrivateChats#eb716739`. -type BotCommandScopeAllPrivateChats struct { -} - -// BotCommandScopeAllPrivateChatsTypeID is TL type id of BotCommandScopeAllPrivateChats. -const BotCommandScopeAllPrivateChatsTypeID = 0xeb716739 - -// construct implements constructor of BotCommandScopeClass. -func (b BotCommandScopeAllPrivateChats) construct() BotCommandScopeClass { return &b } - -// Ensuring interfaces in compile-time for BotCommandScopeAllPrivateChats. -var ( - _ bin.Encoder = &BotCommandScopeAllPrivateChats{} - _ bin.Decoder = &BotCommandScopeAllPrivateChats{} - _ bin.BareEncoder = &BotCommandScopeAllPrivateChats{} - _ bin.BareDecoder = &BotCommandScopeAllPrivateChats{} - - _ BotCommandScopeClass = &BotCommandScopeAllPrivateChats{} -) - -func (b *BotCommandScopeAllPrivateChats) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotCommandScopeAllPrivateChats) String() string { - if b == nil { - return "BotCommandScopeAllPrivateChats(nil)" - } - type Alias BotCommandScopeAllPrivateChats - return fmt.Sprintf("BotCommandScopeAllPrivateChats%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotCommandScopeAllPrivateChats) TypeID() uint32 { - return BotCommandScopeAllPrivateChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotCommandScopeAllPrivateChats) TypeName() string { - return "botCommandScopeAllPrivateChats" -} - -// TypeInfo returns info about TL type. -func (b *BotCommandScopeAllPrivateChats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botCommandScopeAllPrivateChats", - ID: BotCommandScopeAllPrivateChatsTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BotCommandScopeAllPrivateChats) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeAllPrivateChats#eb716739 as nil") - } - buf.PutID(BotCommandScopeAllPrivateChatsTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotCommandScopeAllPrivateChats) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeAllPrivateChats#eb716739 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotCommandScopeAllPrivateChats) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeAllPrivateChats#eb716739 to nil") - } - if err := buf.ConsumeID(BotCommandScopeAllPrivateChatsTypeID); err != nil { - return fmt.Errorf("unable to decode botCommandScopeAllPrivateChats#eb716739: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotCommandScopeAllPrivateChats) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeAllPrivateChats#eb716739 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotCommandScopeAllPrivateChats) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeAllPrivateChats#eb716739 as nil") - } - buf.ObjStart() - buf.PutID("botCommandScopeAllPrivateChats") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotCommandScopeAllPrivateChats) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeAllPrivateChats#eb716739 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botCommandScopeAllPrivateChats"); err != nil { - return fmt.Errorf("unable to decode botCommandScopeAllPrivateChats#eb716739: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BotCommandScopeAllGroupChats represents TL type `botCommandScopeAllGroupChats#c585c85e`. -type BotCommandScopeAllGroupChats struct { -} - -// BotCommandScopeAllGroupChatsTypeID is TL type id of BotCommandScopeAllGroupChats. -const BotCommandScopeAllGroupChatsTypeID = 0xc585c85e - -// construct implements constructor of BotCommandScopeClass. -func (b BotCommandScopeAllGroupChats) construct() BotCommandScopeClass { return &b } - -// Ensuring interfaces in compile-time for BotCommandScopeAllGroupChats. -var ( - _ bin.Encoder = &BotCommandScopeAllGroupChats{} - _ bin.Decoder = &BotCommandScopeAllGroupChats{} - _ bin.BareEncoder = &BotCommandScopeAllGroupChats{} - _ bin.BareDecoder = &BotCommandScopeAllGroupChats{} - - _ BotCommandScopeClass = &BotCommandScopeAllGroupChats{} -) - -func (b *BotCommandScopeAllGroupChats) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotCommandScopeAllGroupChats) String() string { - if b == nil { - return "BotCommandScopeAllGroupChats(nil)" - } - type Alias BotCommandScopeAllGroupChats - return fmt.Sprintf("BotCommandScopeAllGroupChats%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotCommandScopeAllGroupChats) TypeID() uint32 { - return BotCommandScopeAllGroupChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotCommandScopeAllGroupChats) TypeName() string { - return "botCommandScopeAllGroupChats" -} - -// TypeInfo returns info about TL type. -func (b *BotCommandScopeAllGroupChats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botCommandScopeAllGroupChats", - ID: BotCommandScopeAllGroupChatsTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BotCommandScopeAllGroupChats) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeAllGroupChats#c585c85e as nil") - } - buf.PutID(BotCommandScopeAllGroupChatsTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotCommandScopeAllGroupChats) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeAllGroupChats#c585c85e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotCommandScopeAllGroupChats) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeAllGroupChats#c585c85e to nil") - } - if err := buf.ConsumeID(BotCommandScopeAllGroupChatsTypeID); err != nil { - return fmt.Errorf("unable to decode botCommandScopeAllGroupChats#c585c85e: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotCommandScopeAllGroupChats) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeAllGroupChats#c585c85e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotCommandScopeAllGroupChats) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeAllGroupChats#c585c85e as nil") - } - buf.ObjStart() - buf.PutID("botCommandScopeAllGroupChats") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotCommandScopeAllGroupChats) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeAllGroupChats#c585c85e to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botCommandScopeAllGroupChats"); err != nil { - return fmt.Errorf("unable to decode botCommandScopeAllGroupChats#c585c85e: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BotCommandScopeAllChatAdministrators represents TL type `botCommandScopeAllChatAdministrators#771c1551`. -type BotCommandScopeAllChatAdministrators struct { -} - -// BotCommandScopeAllChatAdministratorsTypeID is TL type id of BotCommandScopeAllChatAdministrators. -const BotCommandScopeAllChatAdministratorsTypeID = 0x771c1551 - -// construct implements constructor of BotCommandScopeClass. -func (b BotCommandScopeAllChatAdministrators) construct() BotCommandScopeClass { return &b } - -// Ensuring interfaces in compile-time for BotCommandScopeAllChatAdministrators. -var ( - _ bin.Encoder = &BotCommandScopeAllChatAdministrators{} - _ bin.Decoder = &BotCommandScopeAllChatAdministrators{} - _ bin.BareEncoder = &BotCommandScopeAllChatAdministrators{} - _ bin.BareDecoder = &BotCommandScopeAllChatAdministrators{} - - _ BotCommandScopeClass = &BotCommandScopeAllChatAdministrators{} -) - -func (b *BotCommandScopeAllChatAdministrators) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotCommandScopeAllChatAdministrators) String() string { - if b == nil { - return "BotCommandScopeAllChatAdministrators(nil)" - } - type Alias BotCommandScopeAllChatAdministrators - return fmt.Sprintf("BotCommandScopeAllChatAdministrators%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotCommandScopeAllChatAdministrators) TypeID() uint32 { - return BotCommandScopeAllChatAdministratorsTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotCommandScopeAllChatAdministrators) TypeName() string { - return "botCommandScopeAllChatAdministrators" -} - -// TypeInfo returns info about TL type. -func (b *BotCommandScopeAllChatAdministrators) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botCommandScopeAllChatAdministrators", - ID: BotCommandScopeAllChatAdministratorsTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BotCommandScopeAllChatAdministrators) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeAllChatAdministrators#771c1551 as nil") - } - buf.PutID(BotCommandScopeAllChatAdministratorsTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotCommandScopeAllChatAdministrators) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeAllChatAdministrators#771c1551 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotCommandScopeAllChatAdministrators) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeAllChatAdministrators#771c1551 to nil") - } - if err := buf.ConsumeID(BotCommandScopeAllChatAdministratorsTypeID); err != nil { - return fmt.Errorf("unable to decode botCommandScopeAllChatAdministrators#771c1551: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotCommandScopeAllChatAdministrators) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeAllChatAdministrators#771c1551 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotCommandScopeAllChatAdministrators) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeAllChatAdministrators#771c1551 as nil") - } - buf.ObjStart() - buf.PutID("botCommandScopeAllChatAdministrators") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotCommandScopeAllChatAdministrators) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeAllChatAdministrators#771c1551 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botCommandScopeAllChatAdministrators"); err != nil { - return fmt.Errorf("unable to decode botCommandScopeAllChatAdministrators#771c1551: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BotCommandScopeChat represents TL type `botCommandScopeChat#e65b22a5`. -type BotCommandScopeChat struct { - // Chat identifier - ChatID int64 -} - -// BotCommandScopeChatTypeID is TL type id of BotCommandScopeChat. -const BotCommandScopeChatTypeID = 0xe65b22a5 - -// construct implements constructor of BotCommandScopeClass. -func (b BotCommandScopeChat) construct() BotCommandScopeClass { return &b } - -// Ensuring interfaces in compile-time for BotCommandScopeChat. -var ( - _ bin.Encoder = &BotCommandScopeChat{} - _ bin.Decoder = &BotCommandScopeChat{} - _ bin.BareEncoder = &BotCommandScopeChat{} - _ bin.BareDecoder = &BotCommandScopeChat{} - - _ BotCommandScopeClass = &BotCommandScopeChat{} -) - -func (b *BotCommandScopeChat) Zero() bool { - if b == nil { - return true - } - if !(b.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotCommandScopeChat) String() string { - if b == nil { - return "BotCommandScopeChat(nil)" - } - type Alias BotCommandScopeChat - return fmt.Sprintf("BotCommandScopeChat%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotCommandScopeChat) TypeID() uint32 { - return BotCommandScopeChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotCommandScopeChat) TypeName() string { - return "botCommandScopeChat" -} - -// TypeInfo returns info about TL type. -func (b *BotCommandScopeChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botCommandScopeChat", - ID: BotCommandScopeChatTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotCommandScopeChat) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeChat#e65b22a5 as nil") - } - buf.PutID(BotCommandScopeChatTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotCommandScopeChat) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeChat#e65b22a5 as nil") - } - buf.PutInt53(b.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (b *BotCommandScopeChat) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeChat#e65b22a5 to nil") - } - if err := buf.ConsumeID(BotCommandScopeChatTypeID); err != nil { - return fmt.Errorf("unable to decode botCommandScopeChat#e65b22a5: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotCommandScopeChat) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeChat#e65b22a5 to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botCommandScopeChat#e65b22a5: field chat_id: %w", err) - } - b.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotCommandScopeChat) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeChat#e65b22a5 as nil") - } - buf.ObjStart() - buf.PutID("botCommandScopeChat") - buf.Comma() - buf.FieldStart("chat_id") - buf.PutInt53(b.ChatID) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotCommandScopeChat) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeChat#e65b22a5 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botCommandScopeChat"); err != nil { - return fmt.Errorf("unable to decode botCommandScopeChat#e65b22a5: %w", err) - } - case "chat_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botCommandScopeChat#e65b22a5: field chat_id: %w", err) - } - b.ChatID = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (b *BotCommandScopeChat) GetChatID() (value int64) { - if b == nil { - return - } - return b.ChatID -} - -// BotCommandScopeChatAdministrators represents TL type `botCommandScopeChatAdministrators#42bcfe4e`. -type BotCommandScopeChatAdministrators struct { - // Chat identifier - ChatID int64 -} - -// BotCommandScopeChatAdministratorsTypeID is TL type id of BotCommandScopeChatAdministrators. -const BotCommandScopeChatAdministratorsTypeID = 0x42bcfe4e - -// construct implements constructor of BotCommandScopeClass. -func (b BotCommandScopeChatAdministrators) construct() BotCommandScopeClass { return &b } - -// Ensuring interfaces in compile-time for BotCommandScopeChatAdministrators. -var ( - _ bin.Encoder = &BotCommandScopeChatAdministrators{} - _ bin.Decoder = &BotCommandScopeChatAdministrators{} - _ bin.BareEncoder = &BotCommandScopeChatAdministrators{} - _ bin.BareDecoder = &BotCommandScopeChatAdministrators{} - - _ BotCommandScopeClass = &BotCommandScopeChatAdministrators{} -) - -func (b *BotCommandScopeChatAdministrators) Zero() bool { - if b == nil { - return true - } - if !(b.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotCommandScopeChatAdministrators) String() string { - if b == nil { - return "BotCommandScopeChatAdministrators(nil)" - } - type Alias BotCommandScopeChatAdministrators - return fmt.Sprintf("BotCommandScopeChatAdministrators%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotCommandScopeChatAdministrators) TypeID() uint32 { - return BotCommandScopeChatAdministratorsTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotCommandScopeChatAdministrators) TypeName() string { - return "botCommandScopeChatAdministrators" -} - -// TypeInfo returns info about TL type. -func (b *BotCommandScopeChatAdministrators) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botCommandScopeChatAdministrators", - ID: BotCommandScopeChatAdministratorsTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotCommandScopeChatAdministrators) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeChatAdministrators#42bcfe4e as nil") - } - buf.PutID(BotCommandScopeChatAdministratorsTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotCommandScopeChatAdministrators) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeChatAdministrators#42bcfe4e as nil") - } - buf.PutInt53(b.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (b *BotCommandScopeChatAdministrators) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeChatAdministrators#42bcfe4e to nil") - } - if err := buf.ConsumeID(BotCommandScopeChatAdministratorsTypeID); err != nil { - return fmt.Errorf("unable to decode botCommandScopeChatAdministrators#42bcfe4e: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotCommandScopeChatAdministrators) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeChatAdministrators#42bcfe4e to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botCommandScopeChatAdministrators#42bcfe4e: field chat_id: %w", err) - } - b.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotCommandScopeChatAdministrators) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeChatAdministrators#42bcfe4e as nil") - } - buf.ObjStart() - buf.PutID("botCommandScopeChatAdministrators") - buf.Comma() - buf.FieldStart("chat_id") - buf.PutInt53(b.ChatID) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotCommandScopeChatAdministrators) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeChatAdministrators#42bcfe4e to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botCommandScopeChatAdministrators"); err != nil { - return fmt.Errorf("unable to decode botCommandScopeChatAdministrators#42bcfe4e: %w", err) - } - case "chat_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botCommandScopeChatAdministrators#42bcfe4e: field chat_id: %w", err) - } - b.ChatID = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (b *BotCommandScopeChatAdministrators) GetChatID() (value int64) { - if b == nil { - return - } - return b.ChatID -} - -// BotCommandScopeChatMember represents TL type `botCommandScopeChatMember#f36696f2`. -type BotCommandScopeChatMember struct { - // Chat identifier - ChatID int64 - // User identifier - UserID int64 -} - -// BotCommandScopeChatMemberTypeID is TL type id of BotCommandScopeChatMember. -const BotCommandScopeChatMemberTypeID = 0xf36696f2 - -// construct implements constructor of BotCommandScopeClass. -func (b BotCommandScopeChatMember) construct() BotCommandScopeClass { return &b } - -// Ensuring interfaces in compile-time for BotCommandScopeChatMember. -var ( - _ bin.Encoder = &BotCommandScopeChatMember{} - _ bin.Decoder = &BotCommandScopeChatMember{} - _ bin.BareEncoder = &BotCommandScopeChatMember{} - _ bin.BareDecoder = &BotCommandScopeChatMember{} - - _ BotCommandScopeClass = &BotCommandScopeChatMember{} -) - -func (b *BotCommandScopeChatMember) Zero() bool { - if b == nil { - return true - } - if !(b.ChatID == 0) { - return false - } - if !(b.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotCommandScopeChatMember) String() string { - if b == nil { - return "BotCommandScopeChatMember(nil)" - } - type Alias BotCommandScopeChatMember - return fmt.Sprintf("BotCommandScopeChatMember%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotCommandScopeChatMember) TypeID() uint32 { - return BotCommandScopeChatMemberTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotCommandScopeChatMember) TypeName() string { - return "botCommandScopeChatMember" -} - -// TypeInfo returns info about TL type. -func (b *BotCommandScopeChatMember) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botCommandScopeChatMember", - ID: BotCommandScopeChatMemberTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotCommandScopeChatMember) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeChatMember#f36696f2 as nil") - } - buf.PutID(BotCommandScopeChatMemberTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotCommandScopeChatMember) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeChatMember#f36696f2 as nil") - } - buf.PutInt53(b.ChatID) - buf.PutInt53(b.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (b *BotCommandScopeChatMember) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeChatMember#f36696f2 to nil") - } - if err := buf.ConsumeID(BotCommandScopeChatMemberTypeID); err != nil { - return fmt.Errorf("unable to decode botCommandScopeChatMember#f36696f2: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotCommandScopeChatMember) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeChatMember#f36696f2 to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botCommandScopeChatMember#f36696f2: field chat_id: %w", err) - } - b.ChatID = value - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botCommandScopeChatMember#f36696f2: field user_id: %w", err) - } - b.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotCommandScopeChatMember) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botCommandScopeChatMember#f36696f2 as nil") - } - buf.ObjStart() - buf.PutID("botCommandScopeChatMember") - buf.Comma() - buf.FieldStart("chat_id") - buf.PutInt53(b.ChatID) - buf.Comma() - buf.FieldStart("user_id") - buf.PutInt53(b.UserID) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotCommandScopeChatMember) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botCommandScopeChatMember#f36696f2 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botCommandScopeChatMember"); err != nil { - return fmt.Errorf("unable to decode botCommandScopeChatMember#f36696f2: %w", err) - } - case "chat_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botCommandScopeChatMember#f36696f2: field chat_id: %w", err) - } - b.ChatID = value - case "user_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botCommandScopeChatMember#f36696f2: field user_id: %w", err) - } - b.UserID = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (b *BotCommandScopeChatMember) GetChatID() (value int64) { - if b == nil { - return - } - return b.ChatID -} - -// GetUserID returns value of UserID field. -func (b *BotCommandScopeChatMember) GetUserID() (value int64) { - if b == nil { - return - } - return b.UserID -} - -// BotCommandScopeClassName is schema name of BotCommandScopeClass. -const BotCommandScopeClassName = "BotCommandScope" - -// BotCommandScopeClass represents BotCommandScope generic type. -// -// Example: -// -// g, err := tdapi.DecodeBotCommandScope(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.BotCommandScopeDefault: // botCommandScopeDefault#2f6cb2ab -// case *tdapi.BotCommandScopeAllPrivateChats: // botCommandScopeAllPrivateChats#eb716739 -// case *tdapi.BotCommandScopeAllGroupChats: // botCommandScopeAllGroupChats#c585c85e -// case *tdapi.BotCommandScopeAllChatAdministrators: // botCommandScopeAllChatAdministrators#771c1551 -// case *tdapi.BotCommandScopeChat: // botCommandScopeChat#e65b22a5 -// case *tdapi.BotCommandScopeChatAdministrators: // botCommandScopeChatAdministrators#42bcfe4e -// case *tdapi.BotCommandScopeChatMember: // botCommandScopeChatMember#f36696f2 -// default: panic(v) -// } -type BotCommandScopeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() BotCommandScopeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeBotCommandScope implements binary de-serialization for BotCommandScopeClass. -func DecodeBotCommandScope(buf *bin.Buffer) (BotCommandScopeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case BotCommandScopeDefaultTypeID: - // Decoding botCommandScopeDefault#2f6cb2ab. - v := BotCommandScopeDefault{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case BotCommandScopeAllPrivateChatsTypeID: - // Decoding botCommandScopeAllPrivateChats#eb716739. - v := BotCommandScopeAllPrivateChats{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case BotCommandScopeAllGroupChatsTypeID: - // Decoding botCommandScopeAllGroupChats#c585c85e. - v := BotCommandScopeAllGroupChats{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case BotCommandScopeAllChatAdministratorsTypeID: - // Decoding botCommandScopeAllChatAdministrators#771c1551. - v := BotCommandScopeAllChatAdministrators{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case BotCommandScopeChatTypeID: - // Decoding botCommandScopeChat#e65b22a5. - v := BotCommandScopeChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case BotCommandScopeChatAdministratorsTypeID: - // Decoding botCommandScopeChatAdministrators#42bcfe4e. - v := BotCommandScopeChatAdministrators{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case BotCommandScopeChatMemberTypeID: - // Decoding botCommandScopeChatMember#f36696f2. - v := BotCommandScopeChatMember{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONBotCommandScope implements binary de-serialization for BotCommandScopeClass. -func DecodeTDLibJSONBotCommandScope(buf tdjson.Decoder) (BotCommandScopeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "botCommandScopeDefault": - // Decoding botCommandScopeDefault#2f6cb2ab. - v := BotCommandScopeDefault{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case "botCommandScopeAllPrivateChats": - // Decoding botCommandScopeAllPrivateChats#eb716739. - v := BotCommandScopeAllPrivateChats{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case "botCommandScopeAllGroupChats": - // Decoding botCommandScopeAllGroupChats#c585c85e. - v := BotCommandScopeAllGroupChats{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case "botCommandScopeAllChatAdministrators": - // Decoding botCommandScopeAllChatAdministrators#771c1551. - v := BotCommandScopeAllChatAdministrators{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case "botCommandScopeChat": - // Decoding botCommandScopeChat#e65b22a5. - v := BotCommandScopeChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case "botCommandScopeChatAdministrators": - // Decoding botCommandScopeChatAdministrators#42bcfe4e. - v := BotCommandScopeChatAdministrators{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - case "botCommandScopeChatMember": - // Decoding botCommandScopeChatMember#f36696f2. - v := BotCommandScopeChatMember{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BotCommandScopeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// BotCommandScope boxes the BotCommandScopeClass providing a helper. -type BotCommandScopeBox struct { - BotCommandScope BotCommandScopeClass -} - -// Decode implements bin.Decoder for BotCommandScopeBox. -func (b *BotCommandScopeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode BotCommandScopeBox to nil") - } - v, err := DecodeBotCommandScope(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BotCommandScope = v - return nil -} - -// Encode implements bin.Encode for BotCommandScopeBox. -func (b *BotCommandScopeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.BotCommandScope == nil { - return fmt.Errorf("unable to encode BotCommandScopeClass as nil") - } - return b.BotCommandScope.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for BotCommandScopeBox. -func (b *BotCommandScopeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode BotCommandScopeBox to nil") - } - v, err := DecodeTDLibJSONBotCommandScope(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BotCommandScope = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for BotCommandScopeBox. -func (b *BotCommandScopeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.BotCommandScope == nil { - return fmt.Errorf("unable to encode BotCommandScopeClass as nil") - } - return b.BotCommandScope.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_bot_commands_gen.go b/tdapi/tl_bot_commands_gen.go deleted file mode 100644 index c8af7ff4d..000000000 --- a/tdapi/tl_bot_commands_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BotCommands represents TL type `botCommands#4f9aa2c5`. -type BotCommands struct { - // Bot's user identifier - BotUserID int64 - // List of bot commands - Commands []BotCommand -} - -// BotCommandsTypeID is TL type id of BotCommands. -const BotCommandsTypeID = 0x4f9aa2c5 - -// Ensuring interfaces in compile-time for BotCommands. -var ( - _ bin.Encoder = &BotCommands{} - _ bin.Decoder = &BotCommands{} - _ bin.BareEncoder = &BotCommands{} - _ bin.BareDecoder = &BotCommands{} -) - -func (b *BotCommands) Zero() bool { - if b == nil { - return true - } - if !(b.BotUserID == 0) { - return false - } - if !(b.Commands == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotCommands) String() string { - if b == nil { - return "BotCommands(nil)" - } - type Alias BotCommands - return fmt.Sprintf("BotCommands%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotCommands) TypeID() uint32 { - return BotCommandsTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotCommands) TypeName() string { - return "botCommands" -} - -// TypeInfo returns info about TL type. -func (b *BotCommands) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botCommands", - ID: BotCommandsTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Commands", - SchemaName: "commands", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotCommands) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommands#4f9aa2c5 as nil") - } - buf.PutID(BotCommandsTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotCommands) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botCommands#4f9aa2c5 as nil") - } - buf.PutInt53(b.BotUserID) - buf.PutInt(len(b.Commands)) - for idx, v := range b.Commands { - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare botCommands#4f9aa2c5: field commands element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotCommands) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommands#4f9aa2c5 to nil") - } - if err := buf.ConsumeID(BotCommandsTypeID); err != nil { - return fmt.Errorf("unable to decode botCommands#4f9aa2c5: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotCommands) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botCommands#4f9aa2c5 to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botCommands#4f9aa2c5: field bot_user_id: %w", err) - } - b.BotUserID = value - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode botCommands#4f9aa2c5: field commands: %w", err) - } - - if headerLen > 0 { - b.Commands = make([]BotCommand, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BotCommand - if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare botCommands#4f9aa2c5: field commands: %w", err) - } - b.Commands = append(b.Commands, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotCommands) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botCommands#4f9aa2c5 as nil") - } - buf.ObjStart() - buf.PutID("botCommands") - buf.Comma() - buf.FieldStart("bot_user_id") - buf.PutInt53(b.BotUserID) - buf.Comma() - buf.FieldStart("commands") - buf.ArrStart() - for idx, v := range b.Commands { - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botCommands#4f9aa2c5: field commands element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotCommands) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botCommands#4f9aa2c5 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botCommands"); err != nil { - return fmt.Errorf("unable to decode botCommands#4f9aa2c5: %w", err) - } - case "bot_user_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botCommands#4f9aa2c5: field bot_user_id: %w", err) - } - b.BotUserID = value - case "commands": - if err := buf.Arr(func(buf tdjson.Decoder) error { - var value BotCommand - if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botCommands#4f9aa2c5: field commands: %w", err) - } - b.Commands = append(b.Commands, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode botCommands#4f9aa2c5: field commands: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (b *BotCommands) GetBotUserID() (value int64) { - if b == nil { - return - } - return b.BotUserID -} - -// GetCommands returns value of Commands field. -func (b *BotCommands) GetCommands() (value []BotCommand) { - if b == nil { - return - } - return b.Commands -} diff --git a/tdapi/tl_bot_info_gen.go b/tdapi/tl_bot_info_gen.go deleted file mode 100644 index 3404a3ce0..000000000 --- a/tdapi/tl_bot_info_gen.go +++ /dev/null @@ -1,982 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BotInfo represents TL type `botInfo#d16edb85`. -type BotInfo struct { - // The text that is shown on the bot's profile page and is sent together with the link - // when users share the bot - ShortDescription string - // Contains information about a bot - Description string - // Photo shown in the chat with the bot if the chat is empty; may be null - Photo Photo - // Animation shown in the chat with the bot if the chat is empty; may be null - Animation Animation - // Information about a button to show instead of the bot commands menu button; may be - // null if ordinary bot commands menu must be shown - MenuButton BotMenuButton - // List of the bot commands - Commands []BotCommand - // The HTTP link to the privacy policy of the bot. If empty, then /privacy command must - // be used if supported by the bot. If the command isn't supported, then https://telegram - // org/privacy-tpa must be opened - PrivacyPolicyURL string - // Default administrator rights for adding the bot to basic group and supergroup chats; - // may be null - DefaultGroupAdministratorRights ChatAdministratorRights - // Default administrator rights for adding the bot to channels; may be null - DefaultChannelAdministratorRights ChatAdministratorRights - // Information about the affiliate program of the bot; may be null if none - AffiliateProgram AffiliateProgramInfo - // Default light background color for bot Web Apps; -1 if not specified - WebAppBackgroundLightColor int32 - // Default dark background color for bot Web Apps; -1 if not specified - WebAppBackgroundDarkColor int32 - // Default light header color for bot Web Apps; -1 if not specified - WebAppHeaderLightColor int32 - // Default dark header color for bot Web Apps; -1 if not specified - WebAppHeaderDarkColor int32 - // Parameters of the verification that can be provided by the bot; may be null if none or - // the current user isn't the owner of the bot - VerificationParameters BotVerificationParameters - // True, if the bot's revenue statistics are available to the current user - CanGetRevenueStatistics bool - // True, if the bot can manage emoji status of the current user - CanManageEmojiStatus bool - // True, if the bot has media previews - HasMediaPreviews bool - // The internal link, which can be used to edit bot commands; may be null - EditCommandsLink InternalLinkTypeClass - // The internal link, which can be used to edit bot description; may be null - EditDescriptionLink InternalLinkTypeClass - // The internal link, which can be used to edit the photo or animation shown in the chat - // with the bot if the chat is empty; may be null - EditDescriptionMediaLink InternalLinkTypeClass - // The internal link, which can be used to edit bot settings; may be null - EditSettingsLink InternalLinkTypeClass -} - -// BotInfoTypeID is TL type id of BotInfo. -const BotInfoTypeID = 0xd16edb85 - -// Ensuring interfaces in compile-time for BotInfo. -var ( - _ bin.Encoder = &BotInfo{} - _ bin.Decoder = &BotInfo{} - _ bin.BareEncoder = &BotInfo{} - _ bin.BareDecoder = &BotInfo{} -) - -func (b *BotInfo) Zero() bool { - if b == nil { - return true - } - if !(b.ShortDescription == "") { - return false - } - if !(b.Description == "") { - return false - } - if !(b.Photo.Zero()) { - return false - } - if !(b.Animation.Zero()) { - return false - } - if !(b.MenuButton.Zero()) { - return false - } - if !(b.Commands == nil) { - return false - } - if !(b.PrivacyPolicyURL == "") { - return false - } - if !(b.DefaultGroupAdministratorRights.Zero()) { - return false - } - if !(b.DefaultChannelAdministratorRights.Zero()) { - return false - } - if !(b.AffiliateProgram.Zero()) { - return false - } - if !(b.WebAppBackgroundLightColor == 0) { - return false - } - if !(b.WebAppBackgroundDarkColor == 0) { - return false - } - if !(b.WebAppHeaderLightColor == 0) { - return false - } - if !(b.WebAppHeaderDarkColor == 0) { - return false - } - if !(b.VerificationParameters.Zero()) { - return false - } - if !(b.CanGetRevenueStatistics == false) { - return false - } - if !(b.CanManageEmojiStatus == false) { - return false - } - if !(b.HasMediaPreviews == false) { - return false - } - if !(b.EditCommandsLink == nil) { - return false - } - if !(b.EditDescriptionLink == nil) { - return false - } - if !(b.EditDescriptionMediaLink == nil) { - return false - } - if !(b.EditSettingsLink == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotInfo) String() string { - if b == nil { - return "BotInfo(nil)" - } - type Alias BotInfo - return fmt.Sprintf("BotInfo%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotInfo) TypeID() uint32 { - return BotInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotInfo) TypeName() string { - return "botInfo" -} - -// TypeInfo returns info about TL type. -func (b *BotInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botInfo", - ID: BotInfoTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortDescription", - SchemaName: "short_description", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Animation", - SchemaName: "animation", - }, - { - Name: "MenuButton", - SchemaName: "menu_button", - }, - { - Name: "Commands", - SchemaName: "commands", - }, - { - Name: "PrivacyPolicyURL", - SchemaName: "privacy_policy_url", - }, - { - Name: "DefaultGroupAdministratorRights", - SchemaName: "default_group_administrator_rights", - }, - { - Name: "DefaultChannelAdministratorRights", - SchemaName: "default_channel_administrator_rights", - }, - { - Name: "AffiliateProgram", - SchemaName: "affiliate_program", - }, - { - Name: "WebAppBackgroundLightColor", - SchemaName: "web_app_background_light_color", - }, - { - Name: "WebAppBackgroundDarkColor", - SchemaName: "web_app_background_dark_color", - }, - { - Name: "WebAppHeaderLightColor", - SchemaName: "web_app_header_light_color", - }, - { - Name: "WebAppHeaderDarkColor", - SchemaName: "web_app_header_dark_color", - }, - { - Name: "VerificationParameters", - SchemaName: "verification_parameters", - }, - { - Name: "CanGetRevenueStatistics", - SchemaName: "can_get_revenue_statistics", - }, - { - Name: "CanManageEmojiStatus", - SchemaName: "can_manage_emoji_status", - }, - { - Name: "HasMediaPreviews", - SchemaName: "has_media_previews", - }, - { - Name: "EditCommandsLink", - SchemaName: "edit_commands_link", - }, - { - Name: "EditDescriptionLink", - SchemaName: "edit_description_link", - }, - { - Name: "EditDescriptionMediaLink", - SchemaName: "edit_description_media_link", - }, - { - Name: "EditSettingsLink", - SchemaName: "edit_settings_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotInfo) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botInfo#d16edb85 as nil") - } - buf.PutID(BotInfoTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotInfo) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botInfo#d16edb85 as nil") - } - buf.PutString(b.ShortDescription) - buf.PutString(b.Description) - if err := b.Photo.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field photo: %w", err) - } - if err := b.Animation.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field animation: %w", err) - } - if err := b.MenuButton.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field menu_button: %w", err) - } - buf.PutInt(len(b.Commands)) - for idx, v := range b.Commands { - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare botInfo#d16edb85: field commands element with index %d: %w", idx, err) - } - } - buf.PutString(b.PrivacyPolicyURL) - if err := b.DefaultGroupAdministratorRights.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field default_group_administrator_rights: %w", err) - } - if err := b.DefaultChannelAdministratorRights.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field default_channel_administrator_rights: %w", err) - } - if err := b.AffiliateProgram.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field affiliate_program: %w", err) - } - buf.PutInt32(b.WebAppBackgroundLightColor) - buf.PutInt32(b.WebAppBackgroundDarkColor) - buf.PutInt32(b.WebAppHeaderLightColor) - buf.PutInt32(b.WebAppHeaderDarkColor) - if err := b.VerificationParameters.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field verification_parameters: %w", err) - } - buf.PutBool(b.CanGetRevenueStatistics) - buf.PutBool(b.CanManageEmojiStatus) - buf.PutBool(b.HasMediaPreviews) - if b.EditCommandsLink == nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_commands_link is nil") - } - if err := b.EditCommandsLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_commands_link: %w", err) - } - if b.EditDescriptionLink == nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_link is nil") - } - if err := b.EditDescriptionLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_link: %w", err) - } - if b.EditDescriptionMediaLink == nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_media_link is nil") - } - if err := b.EditDescriptionMediaLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_media_link: %w", err) - } - if b.EditSettingsLink == nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_settings_link is nil") - } - if err := b.EditSettingsLink.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_settings_link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotInfo) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botInfo#d16edb85 to nil") - } - if err := buf.ConsumeID(BotInfoTypeID); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotInfo) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botInfo#d16edb85 to nil") - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field short_description: %w", err) - } - b.ShortDescription = value - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field description: %w", err) - } - b.Description = value - } - { - if err := b.Photo.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field photo: %w", err) - } - } - { - if err := b.Animation.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field animation: %w", err) - } - } - { - if err := b.MenuButton.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field menu_button: %w", err) - } - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field commands: %w", err) - } - - if headerLen > 0 { - b.Commands = make([]BotCommand, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BotCommand - if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare botInfo#d16edb85: field commands: %w", err) - } - b.Commands = append(b.Commands, value) - } - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field privacy_policy_url: %w", err) - } - b.PrivacyPolicyURL = value - } - { - if err := b.DefaultGroupAdministratorRights.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field default_group_administrator_rights: %w", err) - } - } - { - if err := b.DefaultChannelAdministratorRights.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field default_channel_administrator_rights: %w", err) - } - } - { - if err := b.AffiliateProgram.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field affiliate_program: %w", err) - } - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_background_light_color: %w", err) - } - b.WebAppBackgroundLightColor = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_background_dark_color: %w", err) - } - b.WebAppBackgroundDarkColor = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_header_light_color: %w", err) - } - b.WebAppHeaderLightColor = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_header_dark_color: %w", err) - } - b.WebAppHeaderDarkColor = value - } - { - if err := b.VerificationParameters.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field verification_parameters: %w", err) - } - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field can_get_revenue_statistics: %w", err) - } - b.CanGetRevenueStatistics = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field can_manage_emoji_status: %w", err) - } - b.CanManageEmojiStatus = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field has_media_previews: %w", err) - } - b.HasMediaPreviews = value - } - { - value, err := DecodeInternalLinkType(buf) - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_commands_link: %w", err) - } - b.EditCommandsLink = value - } - { - value, err := DecodeInternalLinkType(buf) - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_description_link: %w", err) - } - b.EditDescriptionLink = value - } - { - value, err := DecodeInternalLinkType(buf) - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_description_media_link: %w", err) - } - b.EditDescriptionMediaLink = value - } - { - value, err := DecodeInternalLinkType(buf) - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_settings_link: %w", err) - } - b.EditSettingsLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botInfo#d16edb85 as nil") - } - buf.ObjStart() - buf.PutID("botInfo") - buf.Comma() - buf.FieldStart("short_description") - buf.PutString(b.ShortDescription) - buf.Comma() - buf.FieldStart("description") - buf.PutString(b.Description) - buf.Comma() - buf.FieldStart("photo") - if err := b.Photo.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field photo: %w", err) - } - buf.Comma() - buf.FieldStart("animation") - if err := b.Animation.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field animation: %w", err) - } - buf.Comma() - buf.FieldStart("menu_button") - if err := b.MenuButton.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field menu_button: %w", err) - } - buf.Comma() - buf.FieldStart("commands") - buf.ArrStart() - for idx, v := range b.Commands { - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field commands element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.FieldStart("privacy_policy_url") - buf.PutString(b.PrivacyPolicyURL) - buf.Comma() - buf.FieldStart("default_group_administrator_rights") - if err := b.DefaultGroupAdministratorRights.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field default_group_administrator_rights: %w", err) - } - buf.Comma() - buf.FieldStart("default_channel_administrator_rights") - if err := b.DefaultChannelAdministratorRights.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field default_channel_administrator_rights: %w", err) - } - buf.Comma() - buf.FieldStart("affiliate_program") - if err := b.AffiliateProgram.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field affiliate_program: %w", err) - } - buf.Comma() - buf.FieldStart("web_app_background_light_color") - buf.PutInt32(b.WebAppBackgroundLightColor) - buf.Comma() - buf.FieldStart("web_app_background_dark_color") - buf.PutInt32(b.WebAppBackgroundDarkColor) - buf.Comma() - buf.FieldStart("web_app_header_light_color") - buf.PutInt32(b.WebAppHeaderLightColor) - buf.Comma() - buf.FieldStart("web_app_header_dark_color") - buf.PutInt32(b.WebAppHeaderDarkColor) - buf.Comma() - buf.FieldStart("verification_parameters") - if err := b.VerificationParameters.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field verification_parameters: %w", err) - } - buf.Comma() - buf.FieldStart("can_get_revenue_statistics") - buf.PutBool(b.CanGetRevenueStatistics) - buf.Comma() - buf.FieldStart("can_manage_emoji_status") - buf.PutBool(b.CanManageEmojiStatus) - buf.Comma() - buf.FieldStart("has_media_previews") - buf.PutBool(b.HasMediaPreviews) - buf.Comma() - buf.FieldStart("edit_commands_link") - if b.EditCommandsLink == nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_commands_link is nil") - } - if err := b.EditCommandsLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_commands_link: %w", err) - } - buf.Comma() - buf.FieldStart("edit_description_link") - if b.EditDescriptionLink == nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_link is nil") - } - if err := b.EditDescriptionLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_link: %w", err) - } - buf.Comma() - buf.FieldStart("edit_description_media_link") - if b.EditDescriptionMediaLink == nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_media_link is nil") - } - if err := b.EditDescriptionMediaLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_description_media_link: %w", err) - } - buf.Comma() - buf.FieldStart("edit_settings_link") - if b.EditSettingsLink == nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_settings_link is nil") - } - if err := b.EditSettingsLink.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botInfo#d16edb85: field edit_settings_link: %w", err) - } - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotInfo) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botInfo#d16edb85 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botInfo"); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: %w", err) - } - case "short_description": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field short_description: %w", err) - } - b.ShortDescription = value - case "description": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field description: %w", err) - } - b.Description = value - case "photo": - if err := b.Photo.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field photo: %w", err) - } - case "animation": - if err := b.Animation.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field animation: %w", err) - } - case "menu_button": - if err := b.MenuButton.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field menu_button: %w", err) - } - case "commands": - if err := buf.Arr(func(buf tdjson.Decoder) error { - var value BotCommand - if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field commands: %w", err) - } - b.Commands = append(b.Commands, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field commands: %w", err) - } - case "privacy_policy_url": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field privacy_policy_url: %w", err) - } - b.PrivacyPolicyURL = value - case "default_group_administrator_rights": - if err := b.DefaultGroupAdministratorRights.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field default_group_administrator_rights: %w", err) - } - case "default_channel_administrator_rights": - if err := b.DefaultChannelAdministratorRights.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field default_channel_administrator_rights: %w", err) - } - case "affiliate_program": - if err := b.AffiliateProgram.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field affiliate_program: %w", err) - } - case "web_app_background_light_color": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_background_light_color: %w", err) - } - b.WebAppBackgroundLightColor = value - case "web_app_background_dark_color": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_background_dark_color: %w", err) - } - b.WebAppBackgroundDarkColor = value - case "web_app_header_light_color": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_header_light_color: %w", err) - } - b.WebAppHeaderLightColor = value - case "web_app_header_dark_color": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field web_app_header_dark_color: %w", err) - } - b.WebAppHeaderDarkColor = value - case "verification_parameters": - if err := b.VerificationParameters.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field verification_parameters: %w", err) - } - case "can_get_revenue_statistics": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field can_get_revenue_statistics: %w", err) - } - b.CanGetRevenueStatistics = value - case "can_manage_emoji_status": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field can_manage_emoji_status: %w", err) - } - b.CanManageEmojiStatus = value - case "has_media_previews": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field has_media_previews: %w", err) - } - b.HasMediaPreviews = value - case "edit_commands_link": - value, err := DecodeTDLibJSONInternalLinkType(buf) - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_commands_link: %w", err) - } - b.EditCommandsLink = value - case "edit_description_link": - value, err := DecodeTDLibJSONInternalLinkType(buf) - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_description_link: %w", err) - } - b.EditDescriptionLink = value - case "edit_description_media_link": - value, err := DecodeTDLibJSONInternalLinkType(buf) - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_description_media_link: %w", err) - } - b.EditDescriptionMediaLink = value - case "edit_settings_link": - value, err := DecodeTDLibJSONInternalLinkType(buf) - if err != nil { - return fmt.Errorf("unable to decode botInfo#d16edb85: field edit_settings_link: %w", err) - } - b.EditSettingsLink = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetShortDescription returns value of ShortDescription field. -func (b *BotInfo) GetShortDescription() (value string) { - if b == nil { - return - } - return b.ShortDescription -} - -// GetDescription returns value of Description field. -func (b *BotInfo) GetDescription() (value string) { - if b == nil { - return - } - return b.Description -} - -// GetPhoto returns value of Photo field. -func (b *BotInfo) GetPhoto() (value Photo) { - if b == nil { - return - } - return b.Photo -} - -// GetAnimation returns value of Animation field. -func (b *BotInfo) GetAnimation() (value Animation) { - if b == nil { - return - } - return b.Animation -} - -// GetMenuButton returns value of MenuButton field. -func (b *BotInfo) GetMenuButton() (value BotMenuButton) { - if b == nil { - return - } - return b.MenuButton -} - -// GetCommands returns value of Commands field. -func (b *BotInfo) GetCommands() (value []BotCommand) { - if b == nil { - return - } - return b.Commands -} - -// GetPrivacyPolicyURL returns value of PrivacyPolicyURL field. -func (b *BotInfo) GetPrivacyPolicyURL() (value string) { - if b == nil { - return - } - return b.PrivacyPolicyURL -} - -// GetDefaultGroupAdministratorRights returns value of DefaultGroupAdministratorRights field. -func (b *BotInfo) GetDefaultGroupAdministratorRights() (value ChatAdministratorRights) { - if b == nil { - return - } - return b.DefaultGroupAdministratorRights -} - -// GetDefaultChannelAdministratorRights returns value of DefaultChannelAdministratorRights field. -func (b *BotInfo) GetDefaultChannelAdministratorRights() (value ChatAdministratorRights) { - if b == nil { - return - } - return b.DefaultChannelAdministratorRights -} - -// GetAffiliateProgram returns value of AffiliateProgram field. -func (b *BotInfo) GetAffiliateProgram() (value AffiliateProgramInfo) { - if b == nil { - return - } - return b.AffiliateProgram -} - -// GetWebAppBackgroundLightColor returns value of WebAppBackgroundLightColor field. -func (b *BotInfo) GetWebAppBackgroundLightColor() (value int32) { - if b == nil { - return - } - return b.WebAppBackgroundLightColor -} - -// GetWebAppBackgroundDarkColor returns value of WebAppBackgroundDarkColor field. -func (b *BotInfo) GetWebAppBackgroundDarkColor() (value int32) { - if b == nil { - return - } - return b.WebAppBackgroundDarkColor -} - -// GetWebAppHeaderLightColor returns value of WebAppHeaderLightColor field. -func (b *BotInfo) GetWebAppHeaderLightColor() (value int32) { - if b == nil { - return - } - return b.WebAppHeaderLightColor -} - -// GetWebAppHeaderDarkColor returns value of WebAppHeaderDarkColor field. -func (b *BotInfo) GetWebAppHeaderDarkColor() (value int32) { - if b == nil { - return - } - return b.WebAppHeaderDarkColor -} - -// GetVerificationParameters returns value of VerificationParameters field. -func (b *BotInfo) GetVerificationParameters() (value BotVerificationParameters) { - if b == nil { - return - } - return b.VerificationParameters -} - -// GetCanGetRevenueStatistics returns value of CanGetRevenueStatistics field. -func (b *BotInfo) GetCanGetRevenueStatistics() (value bool) { - if b == nil { - return - } - return b.CanGetRevenueStatistics -} - -// GetCanManageEmojiStatus returns value of CanManageEmojiStatus field. -func (b *BotInfo) GetCanManageEmojiStatus() (value bool) { - if b == nil { - return - } - return b.CanManageEmojiStatus -} - -// GetHasMediaPreviews returns value of HasMediaPreviews field. -func (b *BotInfo) GetHasMediaPreviews() (value bool) { - if b == nil { - return - } - return b.HasMediaPreviews -} - -// GetEditCommandsLink returns value of EditCommandsLink field. -func (b *BotInfo) GetEditCommandsLink() (value InternalLinkTypeClass) { - if b == nil { - return - } - return b.EditCommandsLink -} - -// GetEditDescriptionLink returns value of EditDescriptionLink field. -func (b *BotInfo) GetEditDescriptionLink() (value InternalLinkTypeClass) { - if b == nil { - return - } - return b.EditDescriptionLink -} - -// GetEditDescriptionMediaLink returns value of EditDescriptionMediaLink field. -func (b *BotInfo) GetEditDescriptionMediaLink() (value InternalLinkTypeClass) { - if b == nil { - return - } - return b.EditDescriptionMediaLink -} - -// GetEditSettingsLink returns value of EditSettingsLink field. -func (b *BotInfo) GetEditSettingsLink() (value InternalLinkTypeClass) { - if b == nil { - return - } - return b.EditSettingsLink -} diff --git a/tdapi/tl_bot_media_preview_gen.go b/tdapi/tl_bot_media_preview_gen.go deleted file mode 100644 index cff5db6fb..000000000 --- a/tdapi/tl_bot_media_preview_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BotMediaPreview represents TL type `botMediaPreview#9eb59ce8`. -type BotMediaPreview struct { - // Point in time (Unix timestamp) when the preview was added or changed last time - Date int32 - // Content of the preview - Content StoryContentClass -} - -// BotMediaPreviewTypeID is TL type id of BotMediaPreview. -const BotMediaPreviewTypeID = 0x9eb59ce8 - -// Ensuring interfaces in compile-time for BotMediaPreview. -var ( - _ bin.Encoder = &BotMediaPreview{} - _ bin.Decoder = &BotMediaPreview{} - _ bin.BareEncoder = &BotMediaPreview{} - _ bin.BareDecoder = &BotMediaPreview{} -) - -func (b *BotMediaPreview) Zero() bool { - if b == nil { - return true - } - if !(b.Date == 0) { - return false - } - if !(b.Content == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotMediaPreview) String() string { - if b == nil { - return "BotMediaPreview(nil)" - } - type Alias BotMediaPreview - return fmt.Sprintf("BotMediaPreview%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotMediaPreview) TypeID() uint32 { - return BotMediaPreviewTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotMediaPreview) TypeName() string { - return "botMediaPreview" -} - -// TypeInfo returns info about TL type. -func (b *BotMediaPreview) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botMediaPreview", - ID: BotMediaPreviewTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "Content", - SchemaName: "content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotMediaPreview) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botMediaPreview#9eb59ce8 as nil") - } - buf.PutID(BotMediaPreviewTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotMediaPreview) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botMediaPreview#9eb59ce8 as nil") - } - buf.PutInt32(b.Date) - if b.Content == nil { - return fmt.Errorf("unable to encode botMediaPreview#9eb59ce8: field content is nil") - } - if err := b.Content.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botMediaPreview#9eb59ce8: field content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotMediaPreview) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botMediaPreview#9eb59ce8 to nil") - } - if err := buf.ConsumeID(BotMediaPreviewTypeID); err != nil { - return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotMediaPreview) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botMediaPreview#9eb59ce8 to nil") - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: field date: %w", err) - } - b.Date = value - } - { - value, err := DecodeStoryContent(buf) - if err != nil { - return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: field content: %w", err) - } - b.Content = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotMediaPreview) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botMediaPreview#9eb59ce8 as nil") - } - buf.ObjStart() - buf.PutID("botMediaPreview") - buf.Comma() - buf.FieldStart("date") - buf.PutInt32(b.Date) - buf.Comma() - buf.FieldStart("content") - if b.Content == nil { - return fmt.Errorf("unable to encode botMediaPreview#9eb59ce8: field content is nil") - } - if err := b.Content.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botMediaPreview#9eb59ce8: field content: %w", err) - } - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotMediaPreview) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botMediaPreview#9eb59ce8 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botMediaPreview"); err != nil { - return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: %w", err) - } - case "date": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: field date: %w", err) - } - b.Date = value - case "content": - value, err := DecodeTDLibJSONStoryContent(buf) - if err != nil { - return fmt.Errorf("unable to decode botMediaPreview#9eb59ce8: field content: %w", err) - } - b.Content = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetDate returns value of Date field. -func (b *BotMediaPreview) GetDate() (value int32) { - if b == nil { - return - } - return b.Date -} - -// GetContent returns value of Content field. -func (b *BotMediaPreview) GetContent() (value StoryContentClass) { - if b == nil { - return - } - return b.Content -} diff --git a/tdapi/tl_bot_media_preview_info_gen.go b/tdapi/tl_bot_media_preview_info_gen.go deleted file mode 100644 index dd2f83556..000000000 --- a/tdapi/tl_bot_media_preview_info_gen.go +++ /dev/null @@ -1,279 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BotMediaPreviewInfo represents TL type `botMediaPreviewInfo#e49169db`. -type BotMediaPreviewInfo struct { - // List of media previews - Previews []BotMediaPreview - // List of language codes for which the bot has dedicated previews - LanguageCodes []string -} - -// BotMediaPreviewInfoTypeID is TL type id of BotMediaPreviewInfo. -const BotMediaPreviewInfoTypeID = 0xe49169db - -// Ensuring interfaces in compile-time for BotMediaPreviewInfo. -var ( - _ bin.Encoder = &BotMediaPreviewInfo{} - _ bin.Decoder = &BotMediaPreviewInfo{} - _ bin.BareEncoder = &BotMediaPreviewInfo{} - _ bin.BareDecoder = &BotMediaPreviewInfo{} -) - -func (b *BotMediaPreviewInfo) Zero() bool { - if b == nil { - return true - } - if !(b.Previews == nil) { - return false - } - if !(b.LanguageCodes == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotMediaPreviewInfo) String() string { - if b == nil { - return "BotMediaPreviewInfo(nil)" - } - type Alias BotMediaPreviewInfo - return fmt.Sprintf("BotMediaPreviewInfo%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotMediaPreviewInfo) TypeID() uint32 { - return BotMediaPreviewInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotMediaPreviewInfo) TypeName() string { - return "botMediaPreviewInfo" -} - -// TypeInfo returns info about TL type. -func (b *BotMediaPreviewInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botMediaPreviewInfo", - ID: BotMediaPreviewInfoTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Previews", - SchemaName: "previews", - }, - { - Name: "LanguageCodes", - SchemaName: "language_codes", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotMediaPreviewInfo) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botMediaPreviewInfo#e49169db as nil") - } - buf.PutID(BotMediaPreviewInfoTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotMediaPreviewInfo) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botMediaPreviewInfo#e49169db as nil") - } - buf.PutInt(len(b.Previews)) - for idx, v := range b.Previews { - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare botMediaPreviewInfo#e49169db: field previews element with index %d: %w", idx, err) - } - } - buf.PutInt(len(b.LanguageCodes)) - for _, v := range b.LanguageCodes { - buf.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotMediaPreviewInfo) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botMediaPreviewInfo#e49169db to nil") - } - if err := buf.ConsumeID(BotMediaPreviewInfoTypeID); err != nil { - return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotMediaPreviewInfo) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botMediaPreviewInfo#e49169db to nil") - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field previews: %w", err) - } - - if headerLen > 0 { - b.Previews = make([]BotMediaPreview, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BotMediaPreview - if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare botMediaPreviewInfo#e49169db: field previews: %w", err) - } - b.Previews = append(b.Previews, value) - } - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field language_codes: %w", err) - } - - if headerLen > 0 { - b.LanguageCodes = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field language_codes: %w", err) - } - b.LanguageCodes = append(b.LanguageCodes, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotMediaPreviewInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botMediaPreviewInfo#e49169db as nil") - } - buf.ObjStart() - buf.PutID("botMediaPreviewInfo") - buf.Comma() - buf.FieldStart("previews") - buf.ArrStart() - for idx, v := range b.Previews { - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botMediaPreviewInfo#e49169db: field previews element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.FieldStart("language_codes") - buf.ArrStart() - for _, v := range b.LanguageCodes { - buf.PutString(v) - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotMediaPreviewInfo) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botMediaPreviewInfo#e49169db to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botMediaPreviewInfo"); err != nil { - return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: %w", err) - } - case "previews": - if err := buf.Arr(func(buf tdjson.Decoder) error { - var value BotMediaPreview - if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field previews: %w", err) - } - b.Previews = append(b.Previews, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field previews: %w", err) - } - case "language_codes": - if err := buf.Arr(func(buf tdjson.Decoder) error { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field language_codes: %w", err) - } - b.LanguageCodes = append(b.LanguageCodes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode botMediaPreviewInfo#e49169db: field language_codes: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetPreviews returns value of Previews field. -func (b *BotMediaPreviewInfo) GetPreviews() (value []BotMediaPreview) { - if b == nil { - return - } - return b.Previews -} - -// GetLanguageCodes returns value of LanguageCodes field. -func (b *BotMediaPreviewInfo) GetLanguageCodes() (value []string) { - if b == nil { - return - } - return b.LanguageCodes -} diff --git a/tdapi/tl_bot_media_previews_gen.go b/tdapi/tl_bot_media_previews_gen.go deleted file mode 100644 index aee920f4d..000000000 --- a/tdapi/tl_bot_media_previews_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BotMediaPreviews represents TL type `botMediaPreviews#f1b8f27d`. -type BotMediaPreviews struct { - // List of media previews - Previews []BotMediaPreview -} - -// BotMediaPreviewsTypeID is TL type id of BotMediaPreviews. -const BotMediaPreviewsTypeID = 0xf1b8f27d - -// Ensuring interfaces in compile-time for BotMediaPreviews. -var ( - _ bin.Encoder = &BotMediaPreviews{} - _ bin.Decoder = &BotMediaPreviews{} - _ bin.BareEncoder = &BotMediaPreviews{} - _ bin.BareDecoder = &BotMediaPreviews{} -) - -func (b *BotMediaPreviews) Zero() bool { - if b == nil { - return true - } - if !(b.Previews == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotMediaPreviews) String() string { - if b == nil { - return "BotMediaPreviews(nil)" - } - type Alias BotMediaPreviews - return fmt.Sprintf("BotMediaPreviews%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotMediaPreviews) TypeID() uint32 { - return BotMediaPreviewsTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotMediaPreviews) TypeName() string { - return "botMediaPreviews" -} - -// TypeInfo returns info about TL type. -func (b *BotMediaPreviews) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botMediaPreviews", - ID: BotMediaPreviewsTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Previews", - SchemaName: "previews", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotMediaPreviews) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botMediaPreviews#f1b8f27d as nil") - } - buf.PutID(BotMediaPreviewsTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotMediaPreviews) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botMediaPreviews#f1b8f27d as nil") - } - buf.PutInt(len(b.Previews)) - for idx, v := range b.Previews { - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare botMediaPreviews#f1b8f27d: field previews element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotMediaPreviews) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botMediaPreviews#f1b8f27d to nil") - } - if err := buf.ConsumeID(BotMediaPreviewsTypeID); err != nil { - return fmt.Errorf("unable to decode botMediaPreviews#f1b8f27d: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotMediaPreviews) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botMediaPreviews#f1b8f27d to nil") - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode botMediaPreviews#f1b8f27d: field previews: %w", err) - } - - if headerLen > 0 { - b.Previews = make([]BotMediaPreview, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BotMediaPreview - if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare botMediaPreviews#f1b8f27d: field previews: %w", err) - } - b.Previews = append(b.Previews, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotMediaPreviews) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botMediaPreviews#f1b8f27d as nil") - } - buf.ObjStart() - buf.PutID("botMediaPreviews") - buf.Comma() - buf.FieldStart("previews") - buf.ArrStart() - for idx, v := range b.Previews { - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botMediaPreviews#f1b8f27d: field previews element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotMediaPreviews) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botMediaPreviews#f1b8f27d to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botMediaPreviews"); err != nil { - return fmt.Errorf("unable to decode botMediaPreviews#f1b8f27d: %w", err) - } - case "previews": - if err := buf.Arr(func(buf tdjson.Decoder) error { - var value BotMediaPreview - if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botMediaPreviews#f1b8f27d: field previews: %w", err) - } - b.Previews = append(b.Previews, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode botMediaPreviews#f1b8f27d: field previews: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetPreviews returns value of Previews field. -func (b *BotMediaPreviews) GetPreviews() (value []BotMediaPreview) { - if b == nil { - return - } - return b.Previews -} diff --git a/tdapi/tl_bot_menu_button_gen.go b/tdapi/tl_bot_menu_button_gen.go deleted file mode 100644 index 29fb3d1ea..000000000 --- a/tdapi/tl_bot_menu_button_gen.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BotMenuButton represents TL type `botMenuButton#c7b57ce6`. -type BotMenuButton struct { - // Text of the button - Text string - // URL of a Web App to open when the button is pressed. If the link is of the type - // internalLinkTypeWebApp, then it must be processed accordingly. Otherwise, the link - // must be passed to openWebApp - URL string -} - -// BotMenuButtonTypeID is TL type id of BotMenuButton. -const BotMenuButtonTypeID = 0xc7b57ce6 - -// Ensuring interfaces in compile-time for BotMenuButton. -var ( - _ bin.Encoder = &BotMenuButton{} - _ bin.Decoder = &BotMenuButton{} - _ bin.BareEncoder = &BotMenuButton{} - _ bin.BareDecoder = &BotMenuButton{} -) - -func (b *BotMenuButton) Zero() bool { - if b == nil { - return true - } - if !(b.Text == "") { - return false - } - if !(b.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotMenuButton) String() string { - if b == nil { - return "BotMenuButton(nil)" - } - type Alias BotMenuButton - return fmt.Sprintf("BotMenuButton%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotMenuButton) TypeID() uint32 { - return BotMenuButtonTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotMenuButton) TypeName() string { - return "botMenuButton" -} - -// TypeInfo returns info about TL type. -func (b *BotMenuButton) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botMenuButton", - ID: BotMenuButtonTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotMenuButton) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botMenuButton#c7b57ce6 as nil") - } - buf.PutID(BotMenuButtonTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotMenuButton) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botMenuButton#c7b57ce6 as nil") - } - buf.PutString(b.Text) - buf.PutString(b.URL) - return nil -} - -// Decode implements bin.Decoder. -func (b *BotMenuButton) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botMenuButton#c7b57ce6 to nil") - } - if err := buf.ConsumeID(BotMenuButtonTypeID); err != nil { - return fmt.Errorf("unable to decode botMenuButton#c7b57ce6: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotMenuButton) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botMenuButton#c7b57ce6 to nil") - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botMenuButton#c7b57ce6: field text: %w", err) - } - b.Text = value - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botMenuButton#c7b57ce6: field url: %w", err) - } - b.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotMenuButton) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botMenuButton#c7b57ce6 as nil") - } - buf.ObjStart() - buf.PutID("botMenuButton") - buf.Comma() - buf.FieldStart("text") - buf.PutString(b.Text) - buf.Comma() - buf.FieldStart("url") - buf.PutString(b.URL) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotMenuButton) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botMenuButton#c7b57ce6 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botMenuButton"); err != nil { - return fmt.Errorf("unable to decode botMenuButton#c7b57ce6: %w", err) - } - case "text": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botMenuButton#c7b57ce6: field text: %w", err) - } - b.Text = value - case "url": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botMenuButton#c7b57ce6: field url: %w", err) - } - b.URL = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (b *BotMenuButton) GetText() (value string) { - if b == nil { - return - } - return b.Text -} - -// GetURL returns value of URL field. -func (b *BotMenuButton) GetURL() (value string) { - if b == nil { - return - } - return b.URL -} diff --git a/tdapi/tl_bot_verification_gen.go b/tdapi/tl_bot_verification_gen.go deleted file mode 100644 index 9a4f43999..000000000 --- a/tdapi/tl_bot_verification_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BotVerification represents TL type `botVerification#b160b6f2`. -type BotVerification struct { - // Identifier of the bot that provided the verification - BotUserID int64 - // Identifier of the custom emoji that is used as the verification sign - IconCustomEmojiID int64 - // Custom description of verification reason set by the bot - CustomDescription FormattedText -} - -// BotVerificationTypeID is TL type id of BotVerification. -const BotVerificationTypeID = 0xb160b6f2 - -// Ensuring interfaces in compile-time for BotVerification. -var ( - _ bin.Encoder = &BotVerification{} - _ bin.Decoder = &BotVerification{} - _ bin.BareEncoder = &BotVerification{} - _ bin.BareDecoder = &BotVerification{} -) - -func (b *BotVerification) Zero() bool { - if b == nil { - return true - } - if !(b.BotUserID == 0) { - return false - } - if !(b.IconCustomEmojiID == 0) { - return false - } - if !(b.CustomDescription.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotVerification) String() string { - if b == nil { - return "BotVerification(nil)" - } - type Alias BotVerification - return fmt.Sprintf("BotVerification%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotVerification) TypeID() uint32 { - return BotVerificationTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotVerification) TypeName() string { - return "botVerification" -} - -// TypeInfo returns info about TL type. -func (b *BotVerification) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botVerification", - ID: BotVerificationTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "IconCustomEmojiID", - SchemaName: "icon_custom_emoji_id", - }, - { - Name: "CustomDescription", - SchemaName: "custom_description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotVerification) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botVerification#b160b6f2 as nil") - } - buf.PutID(BotVerificationTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotVerification) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botVerification#b160b6f2 as nil") - } - buf.PutInt53(b.BotUserID) - buf.PutLong(b.IconCustomEmojiID) - if err := b.CustomDescription.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botVerification#b160b6f2: field custom_description: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotVerification) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botVerification#b160b6f2 to nil") - } - if err := buf.ConsumeID(BotVerificationTypeID); err != nil { - return fmt.Errorf("unable to decode botVerification#b160b6f2: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotVerification) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botVerification#b160b6f2 to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botVerification#b160b6f2: field bot_user_id: %w", err) - } - b.BotUserID = value - } - { - value, err := buf.Long() - if err != nil { - return fmt.Errorf("unable to decode botVerification#b160b6f2: field icon_custom_emoji_id: %w", err) - } - b.IconCustomEmojiID = value - } - { - if err := b.CustomDescription.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botVerification#b160b6f2: field custom_description: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotVerification) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botVerification#b160b6f2 as nil") - } - buf.ObjStart() - buf.PutID("botVerification") - buf.Comma() - buf.FieldStart("bot_user_id") - buf.PutInt53(b.BotUserID) - buf.Comma() - buf.FieldStart("icon_custom_emoji_id") - buf.PutLong(b.IconCustomEmojiID) - buf.Comma() - buf.FieldStart("custom_description") - if err := b.CustomDescription.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botVerification#b160b6f2: field custom_description: %w", err) - } - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotVerification) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botVerification#b160b6f2 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botVerification"); err != nil { - return fmt.Errorf("unable to decode botVerification#b160b6f2: %w", err) - } - case "bot_user_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode botVerification#b160b6f2: field bot_user_id: %w", err) - } - b.BotUserID = value - case "icon_custom_emoji_id": - value, err := buf.Long() - if err != nil { - return fmt.Errorf("unable to decode botVerification#b160b6f2: field icon_custom_emoji_id: %w", err) - } - b.IconCustomEmojiID = value - case "custom_description": - if err := b.CustomDescription.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botVerification#b160b6f2: field custom_description: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (b *BotVerification) GetBotUserID() (value int64) { - if b == nil { - return - } - return b.BotUserID -} - -// GetIconCustomEmojiID returns value of IconCustomEmojiID field. -func (b *BotVerification) GetIconCustomEmojiID() (value int64) { - if b == nil { - return - } - return b.IconCustomEmojiID -} - -// GetCustomDescription returns value of CustomDescription field. -func (b *BotVerification) GetCustomDescription() (value FormattedText) { - if b == nil { - return - } - return b.CustomDescription -} diff --git a/tdapi/tl_bot_verification_parameters_gen.go b/tdapi/tl_bot_verification_parameters_gen.go deleted file mode 100644 index ecdd9aead..000000000 --- a/tdapi/tl_bot_verification_parameters_gen.go +++ /dev/null @@ -1,296 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BotVerificationParameters represents TL type `botVerificationParameters#d4dca55f`. -type BotVerificationParameters struct { - // Identifier of the custom emoji that is used as the verification sign - IconCustomEmojiID int64 - // Name of the organization that provides verification - OrganizationName string - // Default custom description of verification reason to be used as placeholder in - // setMessageSenderBotVerification; may be null if none - DefaultCustomDescription FormattedText - // True, if the bot is allowed to provide custom description for verified entities - CanSetCustomDescription bool -} - -// BotVerificationParametersTypeID is TL type id of BotVerificationParameters. -const BotVerificationParametersTypeID = 0xd4dca55f - -// Ensuring interfaces in compile-time for BotVerificationParameters. -var ( - _ bin.Encoder = &BotVerificationParameters{} - _ bin.Decoder = &BotVerificationParameters{} - _ bin.BareEncoder = &BotVerificationParameters{} - _ bin.BareDecoder = &BotVerificationParameters{} -) - -func (b *BotVerificationParameters) Zero() bool { - if b == nil { - return true - } - if !(b.IconCustomEmojiID == 0) { - return false - } - if !(b.OrganizationName == "") { - return false - } - if !(b.DefaultCustomDescription.Zero()) { - return false - } - if !(b.CanSetCustomDescription == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotVerificationParameters) String() string { - if b == nil { - return "BotVerificationParameters(nil)" - } - type Alias BotVerificationParameters - return fmt.Sprintf("BotVerificationParameters%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotVerificationParameters) TypeID() uint32 { - return BotVerificationParametersTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotVerificationParameters) TypeName() string { - return "botVerificationParameters" -} - -// TypeInfo returns info about TL type. -func (b *BotVerificationParameters) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botVerificationParameters", - ID: BotVerificationParametersTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IconCustomEmojiID", - SchemaName: "icon_custom_emoji_id", - }, - { - Name: "OrganizationName", - SchemaName: "organization_name", - }, - { - Name: "DefaultCustomDescription", - SchemaName: "default_custom_description", - }, - { - Name: "CanSetCustomDescription", - SchemaName: "can_set_custom_description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotVerificationParameters) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botVerificationParameters#d4dca55f as nil") - } - buf.PutID(BotVerificationParametersTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotVerificationParameters) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botVerificationParameters#d4dca55f as nil") - } - buf.PutLong(b.IconCustomEmojiID) - buf.PutString(b.OrganizationName) - if err := b.DefaultCustomDescription.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botVerificationParameters#d4dca55f: field default_custom_description: %w", err) - } - buf.PutBool(b.CanSetCustomDescription) - return nil -} - -// Decode implements bin.Decoder. -func (b *BotVerificationParameters) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botVerificationParameters#d4dca55f to nil") - } - if err := buf.ConsumeID(BotVerificationParametersTypeID); err != nil { - return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotVerificationParameters) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botVerificationParameters#d4dca55f to nil") - } - { - value, err := buf.Long() - if err != nil { - return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field icon_custom_emoji_id: %w", err) - } - b.IconCustomEmojiID = value - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field organization_name: %w", err) - } - b.OrganizationName = value - } - { - if err := b.DefaultCustomDescription.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field default_custom_description: %w", err) - } - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field can_set_custom_description: %w", err) - } - b.CanSetCustomDescription = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotVerificationParameters) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botVerificationParameters#d4dca55f as nil") - } - buf.ObjStart() - buf.PutID("botVerificationParameters") - buf.Comma() - buf.FieldStart("icon_custom_emoji_id") - buf.PutLong(b.IconCustomEmojiID) - buf.Comma() - buf.FieldStart("organization_name") - buf.PutString(b.OrganizationName) - buf.Comma() - buf.FieldStart("default_custom_description") - if err := b.DefaultCustomDescription.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botVerificationParameters#d4dca55f: field default_custom_description: %w", err) - } - buf.Comma() - buf.FieldStart("can_set_custom_description") - buf.PutBool(b.CanSetCustomDescription) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotVerificationParameters) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botVerificationParameters#d4dca55f to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botVerificationParameters"); err != nil { - return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: %w", err) - } - case "icon_custom_emoji_id": - value, err := buf.Long() - if err != nil { - return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field icon_custom_emoji_id: %w", err) - } - b.IconCustomEmojiID = value - case "organization_name": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field organization_name: %w", err) - } - b.OrganizationName = value - case "default_custom_description": - if err := b.DefaultCustomDescription.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field default_custom_description: %w", err) - } - case "can_set_custom_description": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode botVerificationParameters#d4dca55f: field can_set_custom_description: %w", err) - } - b.CanSetCustomDescription = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetIconCustomEmojiID returns value of IconCustomEmojiID field. -func (b *BotVerificationParameters) GetIconCustomEmojiID() (value int64) { - if b == nil { - return - } - return b.IconCustomEmojiID -} - -// GetOrganizationName returns value of OrganizationName field. -func (b *BotVerificationParameters) GetOrganizationName() (value string) { - if b == nil { - return - } - return b.OrganizationName -} - -// GetDefaultCustomDescription returns value of DefaultCustomDescription field. -func (b *BotVerificationParameters) GetDefaultCustomDescription() (value FormattedText) { - if b == nil { - return - } - return b.DefaultCustomDescription -} - -// GetCanSetCustomDescription returns value of CanSetCustomDescription field. -func (b *BotVerificationParameters) GetCanSetCustomDescription() (value bool) { - if b == nil { - return - } - return b.CanSetCustomDescription -} diff --git a/tdapi/tl_bot_write_access_allow_reason_gen.go b/tdapi/tl_bot_write_access_allow_reason_gen.go deleted file mode 100644 index f9c7e04b1..000000000 --- a/tdapi/tl_bot_write_access_allow_reason_gen.go +++ /dev/null @@ -1,801 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BotWriteAccessAllowReasonConnectedWebsite represents TL type `botWriteAccessAllowReasonConnectedWebsite#782eafe3`. -type BotWriteAccessAllowReasonConnectedWebsite struct { - // Domain name of the connected website - DomainName string -} - -// BotWriteAccessAllowReasonConnectedWebsiteTypeID is TL type id of BotWriteAccessAllowReasonConnectedWebsite. -const BotWriteAccessAllowReasonConnectedWebsiteTypeID = 0x782eafe3 - -// construct implements constructor of BotWriteAccessAllowReasonClass. -func (b BotWriteAccessAllowReasonConnectedWebsite) construct() BotWriteAccessAllowReasonClass { - return &b -} - -// Ensuring interfaces in compile-time for BotWriteAccessAllowReasonConnectedWebsite. -var ( - _ bin.Encoder = &BotWriteAccessAllowReasonConnectedWebsite{} - _ bin.Decoder = &BotWriteAccessAllowReasonConnectedWebsite{} - _ bin.BareEncoder = &BotWriteAccessAllowReasonConnectedWebsite{} - _ bin.BareDecoder = &BotWriteAccessAllowReasonConnectedWebsite{} - - _ BotWriteAccessAllowReasonClass = &BotWriteAccessAllowReasonConnectedWebsite{} -) - -func (b *BotWriteAccessAllowReasonConnectedWebsite) Zero() bool { - if b == nil { - return true - } - if !(b.DomainName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotWriteAccessAllowReasonConnectedWebsite) String() string { - if b == nil { - return "BotWriteAccessAllowReasonConnectedWebsite(nil)" - } - type Alias BotWriteAccessAllowReasonConnectedWebsite - return fmt.Sprintf("BotWriteAccessAllowReasonConnectedWebsite%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotWriteAccessAllowReasonConnectedWebsite) TypeID() uint32 { - return BotWriteAccessAllowReasonConnectedWebsiteTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotWriteAccessAllowReasonConnectedWebsite) TypeName() string { - return "botWriteAccessAllowReasonConnectedWebsite" -} - -// TypeInfo returns info about TL type. -func (b *BotWriteAccessAllowReasonConnectedWebsite) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botWriteAccessAllowReasonConnectedWebsite", - ID: BotWriteAccessAllowReasonConnectedWebsiteTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DomainName", - SchemaName: "domain_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotWriteAccessAllowReasonConnectedWebsite) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonConnectedWebsite#782eafe3 as nil") - } - buf.PutID(BotWriteAccessAllowReasonConnectedWebsiteTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotWriteAccessAllowReasonConnectedWebsite) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonConnectedWebsite#782eafe3 as nil") - } - buf.PutString(b.DomainName) - return nil -} - -// Decode implements bin.Decoder. -func (b *BotWriteAccessAllowReasonConnectedWebsite) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonConnectedWebsite#782eafe3 to nil") - } - if err := buf.ConsumeID(BotWriteAccessAllowReasonConnectedWebsiteTypeID); err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonConnectedWebsite#782eafe3: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotWriteAccessAllowReasonConnectedWebsite) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonConnectedWebsite#782eafe3 to nil") - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonConnectedWebsite#782eafe3: field domain_name: %w", err) - } - b.DomainName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotWriteAccessAllowReasonConnectedWebsite) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonConnectedWebsite#782eafe3 as nil") - } - buf.ObjStart() - buf.PutID("botWriteAccessAllowReasonConnectedWebsite") - buf.Comma() - buf.FieldStart("domain_name") - buf.PutString(b.DomainName) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotWriteAccessAllowReasonConnectedWebsite) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonConnectedWebsite#782eafe3 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botWriteAccessAllowReasonConnectedWebsite"); err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonConnectedWebsite#782eafe3: %w", err) - } - case "domain_name": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonConnectedWebsite#782eafe3: field domain_name: %w", err) - } - b.DomainName = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetDomainName returns value of DomainName field. -func (b *BotWriteAccessAllowReasonConnectedWebsite) GetDomainName() (value string) { - if b == nil { - return - } - return b.DomainName -} - -// BotWriteAccessAllowReasonAddedToAttachmentMenu represents TL type `botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d`. -type BotWriteAccessAllowReasonAddedToAttachmentMenu struct { -} - -// BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID is TL type id of BotWriteAccessAllowReasonAddedToAttachmentMenu. -const BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID = 0x828b5f9d - -// construct implements constructor of BotWriteAccessAllowReasonClass. -func (b BotWriteAccessAllowReasonAddedToAttachmentMenu) construct() BotWriteAccessAllowReasonClass { - return &b -} - -// Ensuring interfaces in compile-time for BotWriteAccessAllowReasonAddedToAttachmentMenu. -var ( - _ bin.Encoder = &BotWriteAccessAllowReasonAddedToAttachmentMenu{} - _ bin.Decoder = &BotWriteAccessAllowReasonAddedToAttachmentMenu{} - _ bin.BareEncoder = &BotWriteAccessAllowReasonAddedToAttachmentMenu{} - _ bin.BareDecoder = &BotWriteAccessAllowReasonAddedToAttachmentMenu{} - - _ BotWriteAccessAllowReasonClass = &BotWriteAccessAllowReasonAddedToAttachmentMenu{} -) - -func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) String() string { - if b == nil { - return "BotWriteAccessAllowReasonAddedToAttachmentMenu(nil)" - } - type Alias BotWriteAccessAllowReasonAddedToAttachmentMenu - return fmt.Sprintf("BotWriteAccessAllowReasonAddedToAttachmentMenu%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotWriteAccessAllowReasonAddedToAttachmentMenu) TypeID() uint32 { - return BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotWriteAccessAllowReasonAddedToAttachmentMenu) TypeName() string { - return "botWriteAccessAllowReasonAddedToAttachmentMenu" -} - -// TypeInfo returns info about TL type. -func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botWriteAccessAllowReasonAddedToAttachmentMenu", - ID: BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d as nil") - } - buf.PutID(BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d to nil") - } - if err := buf.ConsumeID(BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID); err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d as nil") - } - buf.ObjStart() - buf.PutID("botWriteAccessAllowReasonAddedToAttachmentMenu") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotWriteAccessAllowReasonAddedToAttachmentMenu) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botWriteAccessAllowReasonAddedToAttachmentMenu"); err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BotWriteAccessAllowReasonLaunchedWebApp represents TL type `botWriteAccessAllowReasonLaunchedWebApp#f1a504d7`. -type BotWriteAccessAllowReasonLaunchedWebApp struct { - // Information about the Web App - WebApp WebApp -} - -// BotWriteAccessAllowReasonLaunchedWebAppTypeID is TL type id of BotWriteAccessAllowReasonLaunchedWebApp. -const BotWriteAccessAllowReasonLaunchedWebAppTypeID = 0xf1a504d7 - -// construct implements constructor of BotWriteAccessAllowReasonClass. -func (b BotWriteAccessAllowReasonLaunchedWebApp) construct() BotWriteAccessAllowReasonClass { - return &b -} - -// Ensuring interfaces in compile-time for BotWriteAccessAllowReasonLaunchedWebApp. -var ( - _ bin.Encoder = &BotWriteAccessAllowReasonLaunchedWebApp{} - _ bin.Decoder = &BotWriteAccessAllowReasonLaunchedWebApp{} - _ bin.BareEncoder = &BotWriteAccessAllowReasonLaunchedWebApp{} - _ bin.BareDecoder = &BotWriteAccessAllowReasonLaunchedWebApp{} - - _ BotWriteAccessAllowReasonClass = &BotWriteAccessAllowReasonLaunchedWebApp{} -) - -func (b *BotWriteAccessAllowReasonLaunchedWebApp) Zero() bool { - if b == nil { - return true - } - if !(b.WebApp.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotWriteAccessAllowReasonLaunchedWebApp) String() string { - if b == nil { - return "BotWriteAccessAllowReasonLaunchedWebApp(nil)" - } - type Alias BotWriteAccessAllowReasonLaunchedWebApp - return fmt.Sprintf("BotWriteAccessAllowReasonLaunchedWebApp%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotWriteAccessAllowReasonLaunchedWebApp) TypeID() uint32 { - return BotWriteAccessAllowReasonLaunchedWebAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotWriteAccessAllowReasonLaunchedWebApp) TypeName() string { - return "botWriteAccessAllowReasonLaunchedWebApp" -} - -// TypeInfo returns info about TL type. -func (b *BotWriteAccessAllowReasonLaunchedWebApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botWriteAccessAllowReasonLaunchedWebApp", - ID: BotWriteAccessAllowReasonLaunchedWebAppTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WebApp", - SchemaName: "web_app", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BotWriteAccessAllowReasonLaunchedWebApp) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 as nil") - } - buf.PutID(BotWriteAccessAllowReasonLaunchedWebAppTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotWriteAccessAllowReasonLaunchedWebApp) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 as nil") - } - if err := b.WebApp.Encode(buf); err != nil { - return fmt.Errorf("unable to encode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: field web_app: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotWriteAccessAllowReasonLaunchedWebApp) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 to nil") - } - if err := buf.ConsumeID(BotWriteAccessAllowReasonLaunchedWebAppTypeID); err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotWriteAccessAllowReasonLaunchedWebApp) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 to nil") - } - { - if err := b.WebApp.Decode(buf); err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: field web_app: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotWriteAccessAllowReasonLaunchedWebApp) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 as nil") - } - buf.ObjStart() - buf.PutID("botWriteAccessAllowReasonLaunchedWebApp") - buf.Comma() - buf.FieldStart("web_app") - if err := b.WebApp.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: field web_app: %w", err) - } - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotWriteAccessAllowReasonLaunchedWebApp) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botWriteAccessAllowReasonLaunchedWebApp"); err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: %w", err) - } - case "web_app": - if err := b.WebApp.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonLaunchedWebApp#f1a504d7: field web_app: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetWebApp returns value of WebApp field. -func (b *BotWriteAccessAllowReasonLaunchedWebApp) GetWebApp() (value WebApp) { - if b == nil { - return - } - return b.WebApp -} - -// BotWriteAccessAllowReasonAcceptedRequest represents TL type `botWriteAccessAllowReasonAcceptedRequest#89c63bfc`. -type BotWriteAccessAllowReasonAcceptedRequest struct { -} - -// BotWriteAccessAllowReasonAcceptedRequestTypeID is TL type id of BotWriteAccessAllowReasonAcceptedRequest. -const BotWriteAccessAllowReasonAcceptedRequestTypeID = 0x89c63bfc - -// construct implements constructor of BotWriteAccessAllowReasonClass. -func (b BotWriteAccessAllowReasonAcceptedRequest) construct() BotWriteAccessAllowReasonClass { - return &b -} - -// Ensuring interfaces in compile-time for BotWriteAccessAllowReasonAcceptedRequest. -var ( - _ bin.Encoder = &BotWriteAccessAllowReasonAcceptedRequest{} - _ bin.Decoder = &BotWriteAccessAllowReasonAcceptedRequest{} - _ bin.BareEncoder = &BotWriteAccessAllowReasonAcceptedRequest{} - _ bin.BareDecoder = &BotWriteAccessAllowReasonAcceptedRequest{} - - _ BotWriteAccessAllowReasonClass = &BotWriteAccessAllowReasonAcceptedRequest{} -) - -func (b *BotWriteAccessAllowReasonAcceptedRequest) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BotWriteAccessAllowReasonAcceptedRequest) String() string { - if b == nil { - return "BotWriteAccessAllowReasonAcceptedRequest(nil)" - } - type Alias BotWriteAccessAllowReasonAcceptedRequest - return fmt.Sprintf("BotWriteAccessAllowReasonAcceptedRequest%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BotWriteAccessAllowReasonAcceptedRequest) TypeID() uint32 { - return BotWriteAccessAllowReasonAcceptedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*BotWriteAccessAllowReasonAcceptedRequest) TypeName() string { - return "botWriteAccessAllowReasonAcceptedRequest" -} - -// TypeInfo returns info about TL type. -func (b *BotWriteAccessAllowReasonAcceptedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "botWriteAccessAllowReasonAcceptedRequest", - ID: BotWriteAccessAllowReasonAcceptedRequestTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BotWriteAccessAllowReasonAcceptedRequest) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonAcceptedRequest#89c63bfc as nil") - } - buf.PutID(BotWriteAccessAllowReasonAcceptedRequestTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BotWriteAccessAllowReasonAcceptedRequest) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonAcceptedRequest#89c63bfc as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BotWriteAccessAllowReasonAcceptedRequest) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonAcceptedRequest#89c63bfc to nil") - } - if err := buf.ConsumeID(BotWriteAccessAllowReasonAcceptedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonAcceptedRequest#89c63bfc: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BotWriteAccessAllowReasonAcceptedRequest) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonAcceptedRequest#89c63bfc to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BotWriteAccessAllowReasonAcceptedRequest) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode botWriteAccessAllowReasonAcceptedRequest#89c63bfc as nil") - } - buf.ObjStart() - buf.PutID("botWriteAccessAllowReasonAcceptedRequest") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BotWriteAccessAllowReasonAcceptedRequest) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode botWriteAccessAllowReasonAcceptedRequest#89c63bfc to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("botWriteAccessAllowReasonAcceptedRequest"); err != nil { - return fmt.Errorf("unable to decode botWriteAccessAllowReasonAcceptedRequest#89c63bfc: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BotWriteAccessAllowReasonClassName is schema name of BotWriteAccessAllowReasonClass. -const BotWriteAccessAllowReasonClassName = "BotWriteAccessAllowReason" - -// BotWriteAccessAllowReasonClass represents BotWriteAccessAllowReason generic type. -// -// Example: -// -// g, err := tdapi.DecodeBotWriteAccessAllowReason(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.BotWriteAccessAllowReasonConnectedWebsite: // botWriteAccessAllowReasonConnectedWebsite#782eafe3 -// case *tdapi.BotWriteAccessAllowReasonAddedToAttachmentMenu: // botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d -// case *tdapi.BotWriteAccessAllowReasonLaunchedWebApp: // botWriteAccessAllowReasonLaunchedWebApp#f1a504d7 -// case *tdapi.BotWriteAccessAllowReasonAcceptedRequest: // botWriteAccessAllowReasonAcceptedRequest#89c63bfc -// default: panic(v) -// } -type BotWriteAccessAllowReasonClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() BotWriteAccessAllowReasonClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeBotWriteAccessAllowReason implements binary de-serialization for BotWriteAccessAllowReasonClass. -func DecodeBotWriteAccessAllowReason(buf *bin.Buffer) (BotWriteAccessAllowReasonClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case BotWriteAccessAllowReasonConnectedWebsiteTypeID: - // Decoding botWriteAccessAllowReasonConnectedWebsite#782eafe3. - v := BotWriteAccessAllowReasonConnectedWebsite{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) - } - return &v, nil - case BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID: - // Decoding botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d. - v := BotWriteAccessAllowReasonAddedToAttachmentMenu{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) - } - return &v, nil - case BotWriteAccessAllowReasonLaunchedWebAppTypeID: - // Decoding botWriteAccessAllowReasonLaunchedWebApp#f1a504d7. - v := BotWriteAccessAllowReasonLaunchedWebApp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) - } - return &v, nil - case BotWriteAccessAllowReasonAcceptedRequestTypeID: - // Decoding botWriteAccessAllowReasonAcceptedRequest#89c63bfc. - v := BotWriteAccessAllowReasonAcceptedRequest{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONBotWriteAccessAllowReason implements binary de-serialization for BotWriteAccessAllowReasonClass. -func DecodeTDLibJSONBotWriteAccessAllowReason(buf tdjson.Decoder) (BotWriteAccessAllowReasonClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "botWriteAccessAllowReasonConnectedWebsite": - // Decoding botWriteAccessAllowReasonConnectedWebsite#782eafe3. - v := BotWriteAccessAllowReasonConnectedWebsite{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) - } - return &v, nil - case "botWriteAccessAllowReasonAddedToAttachmentMenu": - // Decoding botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d. - v := BotWriteAccessAllowReasonAddedToAttachmentMenu{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) - } - return &v, nil - case "botWriteAccessAllowReasonLaunchedWebApp": - // Decoding botWriteAccessAllowReasonLaunchedWebApp#f1a504d7. - v := BotWriteAccessAllowReasonLaunchedWebApp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) - } - return &v, nil - case "botWriteAccessAllowReasonAcceptedRequest": - // Decoding botWriteAccessAllowReasonAcceptedRequest#89c63bfc. - v := BotWriteAccessAllowReasonAcceptedRequest{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BotWriteAccessAllowReasonClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// BotWriteAccessAllowReason boxes the BotWriteAccessAllowReasonClass providing a helper. -type BotWriteAccessAllowReasonBox struct { - BotWriteAccessAllowReason BotWriteAccessAllowReasonClass -} - -// Decode implements bin.Decoder for BotWriteAccessAllowReasonBox. -func (b *BotWriteAccessAllowReasonBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode BotWriteAccessAllowReasonBox to nil") - } - v, err := DecodeBotWriteAccessAllowReason(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BotWriteAccessAllowReason = v - return nil -} - -// Encode implements bin.Encode for BotWriteAccessAllowReasonBox. -func (b *BotWriteAccessAllowReasonBox) Encode(buf *bin.Buffer) error { - if b == nil || b.BotWriteAccessAllowReason == nil { - return fmt.Errorf("unable to encode BotWriteAccessAllowReasonClass as nil") - } - return b.BotWriteAccessAllowReason.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for BotWriteAccessAllowReasonBox. -func (b *BotWriteAccessAllowReasonBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode BotWriteAccessAllowReasonBox to nil") - } - v, err := DecodeTDLibJSONBotWriteAccessAllowReason(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BotWriteAccessAllowReason = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for BotWriteAccessAllowReasonBox. -func (b *BotWriteAccessAllowReasonBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.BotWriteAccessAllowReason == nil { - return fmt.Errorf("unable to encode BotWriteAccessAllowReasonClass as nil") - } - return b.BotWriteAccessAllowReason.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_business_away_message_schedule_gen.go b/tdapi/tl_business_away_message_schedule_gen.go deleted file mode 100644 index b1b5aa6d8..000000000 --- a/tdapi/tl_business_away_message_schedule_gen.go +++ /dev/null @@ -1,648 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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`. -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 -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessAwayMessageScheduleAlways) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessAwayMessageScheduleAlways#c9b9e2b9 as nil") - } - buf.ObjStart() - buf.PutID("businessAwayMessageScheduleAlways") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessAwayMessageScheduleAlways) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessAwayMessageScheduleAlways#c9b9e2b9 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessAwayMessageScheduleAlways"); err != nil { - return fmt.Errorf("unable to decode businessAwayMessageScheduleAlways#c9b9e2b9: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessAwayMessageScheduleOutsideOfOpeningHours represents TL type `businessAwayMessageScheduleOutsideOfOpeningHours#c643df16`. -type BusinessAwayMessageScheduleOutsideOfOpeningHours struct { -} - -// BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID is TL type id of BusinessAwayMessageScheduleOutsideOfOpeningHours. -const BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID = 0xc643df16 - -// construct implements constructor of BusinessAwayMessageScheduleClass. -func (b BusinessAwayMessageScheduleOutsideOfOpeningHours) construct() BusinessAwayMessageScheduleClass { - return &b -} - -// Ensuring interfaces in compile-time for BusinessAwayMessageScheduleOutsideOfOpeningHours. -var ( - _ bin.Encoder = &BusinessAwayMessageScheduleOutsideOfOpeningHours{} - _ bin.Decoder = &BusinessAwayMessageScheduleOutsideOfOpeningHours{} - _ bin.BareEncoder = &BusinessAwayMessageScheduleOutsideOfOpeningHours{} - _ bin.BareDecoder = &BusinessAwayMessageScheduleOutsideOfOpeningHours{} - - _ BusinessAwayMessageScheduleClass = &BusinessAwayMessageScheduleOutsideOfOpeningHours{} -) - -func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) String() string { - if b == nil { - return "BusinessAwayMessageScheduleOutsideOfOpeningHours(nil)" - } - type Alias BusinessAwayMessageScheduleOutsideOfOpeningHours - return fmt.Sprintf("BusinessAwayMessageScheduleOutsideOfOpeningHours%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessAwayMessageScheduleOutsideOfOpeningHours) TypeID() uint32 { - return BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessAwayMessageScheduleOutsideOfOpeningHours) TypeName() string { - return "businessAwayMessageScheduleOutsideOfOpeningHours" -} - -// TypeInfo returns info about TL type. -func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessAwayMessageScheduleOutsideOfOpeningHours", - ID: BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 as nil") - } - buf.PutID(BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 to nil") - } - if err := buf.ConsumeID(BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID); err != nil { - return fmt.Errorf("unable to decode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 as nil") - } - buf.ObjStart() - buf.PutID("businessAwayMessageScheduleOutsideOfOpeningHours") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessAwayMessageScheduleOutsideOfOpeningHours) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessAwayMessageScheduleOutsideOfOpeningHours"); err != nil { - return fmt.Errorf("unable to decode businessAwayMessageScheduleOutsideOfOpeningHours#c643df16: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessAwayMessageScheduleCustom represents TL type `businessAwayMessageScheduleCustom#8ac04dd2`. -type BusinessAwayMessageScheduleCustom struct { - // Point in time (Unix timestamp) when the away messages will start to be sent - StartDate int32 - // Point in time (Unix timestamp) when the away messages will stop to be sent - EndDate int32 -} - -// BusinessAwayMessageScheduleCustomTypeID is TL type id of BusinessAwayMessageScheduleCustom. -const BusinessAwayMessageScheduleCustomTypeID = 0x8ac04dd2 - -// 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)) -} - -// 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#8ac04dd2 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#8ac04dd2 as nil") - } - buf.PutInt32(b.StartDate) - buf.PutInt32(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#8ac04dd2 to nil") - } - if err := buf.ConsumeID(BusinessAwayMessageScheduleCustomTypeID); err != nil { - return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: %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#8ac04dd2 to nil") - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: field start_date: %w", err) - } - b.StartDate = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: field end_date: %w", err) - } - b.EndDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessAwayMessageScheduleCustom) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessAwayMessageScheduleCustom#8ac04dd2 as nil") - } - buf.ObjStart() - buf.PutID("businessAwayMessageScheduleCustom") - buf.Comma() - buf.FieldStart("start_date") - buf.PutInt32(b.StartDate) - buf.Comma() - buf.FieldStart("end_date") - buf.PutInt32(b.EndDate) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessAwayMessageScheduleCustom) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessAwayMessageScheduleCustom#8ac04dd2 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessAwayMessageScheduleCustom"); err != nil { - return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: %w", err) - } - case "start_date": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: field start_date: %w", err) - } - b.StartDate = value - case "end_date": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessAwayMessageScheduleCustom#8ac04dd2: field end_date: %w", err) - } - b.EndDate = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetStartDate returns value of StartDate field. -func (b *BusinessAwayMessageScheduleCustom) GetStartDate() (value int32) { - if b == nil { - return - } - return b.StartDate -} - -// GetEndDate returns value of EndDate field. -func (b *BusinessAwayMessageScheduleCustom) GetEndDate() (value int32) { - if b == nil { - return - } - return b.EndDate -} - -// BusinessAwayMessageScheduleClassName is schema name of BusinessAwayMessageScheduleClass. -const BusinessAwayMessageScheduleClassName = "BusinessAwayMessageSchedule" - -// BusinessAwayMessageScheduleClass represents BusinessAwayMessageSchedule generic type. -// -// Example: -// -// g, err := tdapi.DecodeBusinessAwayMessageSchedule(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.BusinessAwayMessageScheduleAlways: // businessAwayMessageScheduleAlways#c9b9e2b9 -// case *tdapi.BusinessAwayMessageScheduleOutsideOfOpeningHours: // businessAwayMessageScheduleOutsideOfOpeningHours#c643df16 -// case *tdapi.BusinessAwayMessageScheduleCustom: // businessAwayMessageScheduleCustom#8ac04dd2 -// 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// 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 BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID: - // Decoding businessAwayMessageScheduleOutsideOfOpeningHours#c643df16. - v := BusinessAwayMessageScheduleOutsideOfOpeningHours{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) - } - return &v, nil - case BusinessAwayMessageScheduleCustomTypeID: - // Decoding businessAwayMessageScheduleCustom#8ac04dd2. - 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)) - } -} - -// DecodeTDLibJSONBusinessAwayMessageSchedule implements binary de-serialization for BusinessAwayMessageScheduleClass. -func DecodeTDLibJSONBusinessAwayMessageSchedule(buf tdjson.Decoder) (BusinessAwayMessageScheduleClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "businessAwayMessageScheduleAlways": - // Decoding businessAwayMessageScheduleAlways#c9b9e2b9. - v := BusinessAwayMessageScheduleAlways{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) - } - return &v, nil - case "businessAwayMessageScheduleOutsideOfOpeningHours": - // Decoding businessAwayMessageScheduleOutsideOfOpeningHours#c643df16. - v := BusinessAwayMessageScheduleOutsideOfOpeningHours{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessAwayMessageScheduleClass: %w", err) - } - return &v, nil - case "businessAwayMessageScheduleCustom": - // Decoding businessAwayMessageScheduleCustom#8ac04dd2. - v := BusinessAwayMessageScheduleCustom{} - if err := v.DecodeTDLibJSON(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", tdjson.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) -} - -// DecodeTDLibJSON implements bin.Decoder for BusinessAwayMessageScheduleBox. -func (b *BusinessAwayMessageScheduleBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode BusinessAwayMessageScheduleBox to nil") - } - v, err := DecodeTDLibJSONBusinessAwayMessageSchedule(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BusinessAwayMessageSchedule = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for BusinessAwayMessageScheduleBox. -func (b *BusinessAwayMessageScheduleBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.BusinessAwayMessageSchedule == nil { - return fmt.Errorf("unable to encode BusinessAwayMessageScheduleClass as nil") - } - return b.BusinessAwayMessageSchedule.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_business_away_message_settings_gen.go b/tdapi/tl_business_away_message_settings_gen.go deleted file mode 100644 index 8e78f86e1..000000000 --- a/tdapi/tl_business_away_message_settings_gen.go +++ /dev/null @@ -1,306 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessAwayMessageSettings represents TL type `businessAwayMessageSettings#150ba2e9`. -type BusinessAwayMessageSettings struct { - // Unique quick reply shortcut identifier for the away messages - ShortcutID int32 - // Chosen recipients of the away messages - Recipients BusinessRecipients - // Settings used to check whether the current user is away - Schedule BusinessAwayMessageScheduleClass - // True, if the messages must not be sent if the account was online in the last 10 - // minutes - OfflineOnly bool -} - -// BusinessAwayMessageSettingsTypeID is TL type id of BusinessAwayMessageSettings. -const BusinessAwayMessageSettingsTypeID = 0x150ba2e9 - -// Ensuring interfaces in compile-time for BusinessAwayMessageSettings. -var ( - _ bin.Encoder = &BusinessAwayMessageSettings{} - _ bin.Decoder = &BusinessAwayMessageSettings{} - _ bin.BareEncoder = &BusinessAwayMessageSettings{} - _ bin.BareDecoder = &BusinessAwayMessageSettings{} -) - -func (b *BusinessAwayMessageSettings) Zero() bool { - if b == nil { - return true - } - if !(b.ShortcutID == 0) { - return false - } - if !(b.Recipients.Zero()) { - return false - } - if !(b.Schedule == nil) { - return false - } - if !(b.OfflineOnly == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessAwayMessageSettings) String() string { - if b == nil { - return "BusinessAwayMessageSettings(nil)" - } - type Alias BusinessAwayMessageSettings - return fmt.Sprintf("BusinessAwayMessageSettings%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessAwayMessageSettings) TypeID() uint32 { - return BusinessAwayMessageSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessAwayMessageSettings) TypeName() string { - return "businessAwayMessageSettings" -} - -// TypeInfo returns info about TL type. -func (b *BusinessAwayMessageSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessAwayMessageSettings", - ID: BusinessAwayMessageSettingsTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutID", - SchemaName: "shortcut_id", - }, - { - Name: "Recipients", - SchemaName: "recipients", - }, - { - Name: "Schedule", - SchemaName: "schedule", - }, - { - Name: "OfflineOnly", - SchemaName: "offline_only", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessAwayMessageSettings) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessAwayMessageSettings#150ba2e9 as nil") - } - buf.PutID(BusinessAwayMessageSettingsTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessAwayMessageSettings) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessAwayMessageSettings#150ba2e9 as nil") - } - buf.PutInt32(b.ShortcutID) - if err := b.Recipients.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field recipients: %w", err) - } - if b.Schedule == nil { - return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field schedule is nil") - } - if err := b.Schedule.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field schedule: %w", err) - } - buf.PutBool(b.OfflineOnly) - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessAwayMessageSettings) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessAwayMessageSettings#150ba2e9 to nil") - } - if err := buf.ConsumeID(BusinessAwayMessageSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessAwayMessageSettings) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessAwayMessageSettings#150ba2e9 to nil") - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field shortcut_id: %w", err) - } - b.ShortcutID = value - } - { - if err := b.Recipients.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field recipients: %w", err) - } - } - { - value, err := DecodeBusinessAwayMessageSchedule(buf) - if err != nil { - return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field schedule: %w", err) - } - b.Schedule = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field offline_only: %w", err) - } - b.OfflineOnly = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessAwayMessageSettings) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessAwayMessageSettings#150ba2e9 as nil") - } - buf.ObjStart() - buf.PutID("businessAwayMessageSettings") - buf.Comma() - buf.FieldStart("shortcut_id") - buf.PutInt32(b.ShortcutID) - buf.Comma() - buf.FieldStart("recipients") - if err := b.Recipients.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field recipients: %w", err) - } - buf.Comma() - buf.FieldStart("schedule") - if b.Schedule == nil { - return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field schedule is nil") - } - if err := b.Schedule.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessAwayMessageSettings#150ba2e9: field schedule: %w", err) - } - buf.Comma() - buf.FieldStart("offline_only") - buf.PutBool(b.OfflineOnly) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessAwayMessageSettings) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessAwayMessageSettings#150ba2e9 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessAwayMessageSettings"); err != nil { - return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: %w", err) - } - case "shortcut_id": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field shortcut_id: %w", err) - } - b.ShortcutID = value - case "recipients": - if err := b.Recipients.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field recipients: %w", err) - } - case "schedule": - value, err := DecodeTDLibJSONBusinessAwayMessageSchedule(buf) - if err != nil { - return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field schedule: %w", err) - } - b.Schedule = value - case "offline_only": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessAwayMessageSettings#150ba2e9: field offline_only: %w", err) - } - b.OfflineOnly = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetShortcutID returns value of ShortcutID field. -func (b *BusinessAwayMessageSettings) GetShortcutID() (value int32) { - if b == nil { - return - } - return b.ShortcutID -} - -// GetRecipients returns value of Recipients field. -func (b *BusinessAwayMessageSettings) GetRecipients() (value BusinessRecipients) { - if b == nil { - return - } - return b.Recipients -} - -// GetSchedule returns value of Schedule field. -func (b *BusinessAwayMessageSettings) GetSchedule() (value BusinessAwayMessageScheduleClass) { - if b == nil { - return - } - return b.Schedule -} - -// GetOfflineOnly returns value of OfflineOnly field. -func (b *BusinessAwayMessageSettings) GetOfflineOnly() (value bool) { - if b == nil { - return - } - return b.OfflineOnly -} diff --git a/tdapi/tl_business_bot_manage_bar_gen.go b/tdapi/tl_business_bot_manage_bar_gen.go deleted file mode 100644 index 5483d1b2b..000000000 --- a/tdapi/tl_business_bot_manage_bar_gen.go +++ /dev/null @@ -1,296 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessBotManageBar represents TL type `businessBotManageBar#ed706a82`. -type BusinessBotManageBar struct { - // User identifier of the bot - BotUserID int64 - // URL to be opened to manage the bot - ManageURL string - // True, if the bot is paused. Use toggleBusinessConnectedBotChatIsPaused to change the - // value of the field - IsBotPaused bool - // True, if the bot can reply - CanBotReply bool -} - -// BusinessBotManageBarTypeID is TL type id of BusinessBotManageBar. -const BusinessBotManageBarTypeID = 0xed706a82 - -// Ensuring interfaces in compile-time for BusinessBotManageBar. -var ( - _ bin.Encoder = &BusinessBotManageBar{} - _ bin.Decoder = &BusinessBotManageBar{} - _ bin.BareEncoder = &BusinessBotManageBar{} - _ bin.BareDecoder = &BusinessBotManageBar{} -) - -func (b *BusinessBotManageBar) Zero() bool { - if b == nil { - return true - } - if !(b.BotUserID == 0) { - return false - } - if !(b.ManageURL == "") { - return false - } - if !(b.IsBotPaused == false) { - return false - } - if !(b.CanBotReply == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessBotManageBar) String() string { - if b == nil { - return "BusinessBotManageBar(nil)" - } - type Alias BusinessBotManageBar - return fmt.Sprintf("BusinessBotManageBar%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessBotManageBar) TypeID() uint32 { - return BusinessBotManageBarTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessBotManageBar) TypeName() string { - return "businessBotManageBar" -} - -// TypeInfo returns info about TL type. -func (b *BusinessBotManageBar) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessBotManageBar", - ID: BusinessBotManageBarTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "ManageURL", - SchemaName: "manage_url", - }, - { - Name: "IsBotPaused", - SchemaName: "is_bot_paused", - }, - { - Name: "CanBotReply", - SchemaName: "can_bot_reply", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessBotManageBar) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessBotManageBar#ed706a82 as nil") - } - buf.PutID(BusinessBotManageBarTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessBotManageBar) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessBotManageBar#ed706a82 as nil") - } - buf.PutInt53(b.BotUserID) - buf.PutString(b.ManageURL) - buf.PutBool(b.IsBotPaused) - buf.PutBool(b.CanBotReply) - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessBotManageBar) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessBotManageBar#ed706a82 to nil") - } - if err := buf.ConsumeID(BusinessBotManageBarTypeID); err != nil { - return fmt.Errorf("unable to decode businessBotManageBar#ed706a82: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessBotManageBar) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessBotManageBar#ed706a82 to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessBotManageBar#ed706a82: field bot_user_id: %w", err) - } - b.BotUserID = value - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessBotManageBar#ed706a82: field manage_url: %w", err) - } - b.ManageURL = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessBotManageBar#ed706a82: field is_bot_paused: %w", err) - } - b.IsBotPaused = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessBotManageBar#ed706a82: field can_bot_reply: %w", err) - } - b.CanBotReply = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessBotManageBar) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessBotManageBar#ed706a82 as nil") - } - buf.ObjStart() - buf.PutID("businessBotManageBar") - buf.Comma() - buf.FieldStart("bot_user_id") - buf.PutInt53(b.BotUserID) - buf.Comma() - buf.FieldStart("manage_url") - buf.PutString(b.ManageURL) - buf.Comma() - buf.FieldStart("is_bot_paused") - buf.PutBool(b.IsBotPaused) - buf.Comma() - buf.FieldStart("can_bot_reply") - buf.PutBool(b.CanBotReply) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessBotManageBar) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessBotManageBar#ed706a82 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessBotManageBar"); err != nil { - return fmt.Errorf("unable to decode businessBotManageBar#ed706a82: %w", err) - } - case "bot_user_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessBotManageBar#ed706a82: field bot_user_id: %w", err) - } - b.BotUserID = value - case "manage_url": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessBotManageBar#ed706a82: field manage_url: %w", err) - } - b.ManageURL = value - case "is_bot_paused": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessBotManageBar#ed706a82: field is_bot_paused: %w", err) - } - b.IsBotPaused = value - case "can_bot_reply": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessBotManageBar#ed706a82: field can_bot_reply: %w", err) - } - b.CanBotReply = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (b *BusinessBotManageBar) GetBotUserID() (value int64) { - if b == nil { - return - } - return b.BotUserID -} - -// GetManageURL returns value of ManageURL field. -func (b *BusinessBotManageBar) GetManageURL() (value string) { - if b == nil { - return - } - return b.ManageURL -} - -// GetIsBotPaused returns value of IsBotPaused field. -func (b *BusinessBotManageBar) GetIsBotPaused() (value bool) { - if b == nil { - return - } - return b.IsBotPaused -} - -// GetCanBotReply returns value of CanBotReply field. -func (b *BusinessBotManageBar) GetCanBotReply() (value bool) { - if b == nil { - return - } - return b.CanBotReply -} diff --git a/tdapi/tl_business_chat_link_gen.go b/tdapi/tl_business_chat_link_gen.go deleted file mode 100644 index 73a93dad1..000000000 --- a/tdapi/tl_business_chat_link_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessChatLink represents TL type `businessChatLink#8e998b83`. -type BusinessChatLink struct { - // The HTTPS link - Link string - // Message draft text that will be added to the input field - Text FormattedText - // Link title - Title string - // Number of times the link was used - ViewCount int32 -} - -// BusinessChatLinkTypeID is TL type id of BusinessChatLink. -const BusinessChatLinkTypeID = 0x8e998b83 - -// Ensuring interfaces in compile-time for BusinessChatLink. -var ( - _ bin.Encoder = &BusinessChatLink{} - _ bin.Decoder = &BusinessChatLink{} - _ bin.BareEncoder = &BusinessChatLink{} - _ bin.BareDecoder = &BusinessChatLink{} -) - -func (b *BusinessChatLink) Zero() bool { - if b == nil { - return true - } - if !(b.Link == "") { - return false - } - if !(b.Text.Zero()) { - return false - } - if !(b.Title == "") { - return false - } - if !(b.ViewCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessChatLink) String() string { - if b == nil { - return "BusinessChatLink(nil)" - } - type Alias BusinessChatLink - return fmt.Sprintf("BusinessChatLink%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessChatLink) TypeID() uint32 { - return BusinessChatLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessChatLink) TypeName() string { - return "businessChatLink" -} - -// TypeInfo returns info about TL type. -func (b *BusinessChatLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessChatLink", - ID: BusinessChatLinkTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "ViewCount", - SchemaName: "view_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessChatLink) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessChatLink#8e998b83 as nil") - } - buf.PutID(BusinessChatLinkTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessChatLink) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessChatLink#8e998b83 as nil") - } - buf.PutString(b.Link) - if err := b.Text.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessChatLink#8e998b83: field text: %w", err) - } - buf.PutString(b.Title) - buf.PutInt32(b.ViewCount) - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessChatLink) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessChatLink#8e998b83 to nil") - } - if err := buf.ConsumeID(BusinessChatLinkTypeID); err != nil { - return fmt.Errorf("unable to decode businessChatLink#8e998b83: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessChatLink) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessChatLink#8e998b83 to nil") - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessChatLink#8e998b83: field link: %w", err) - } - b.Link = value - } - { - if err := b.Text.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessChatLink#8e998b83: field text: %w", err) - } - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessChatLink#8e998b83: field title: %w", err) - } - b.Title = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessChatLink#8e998b83: field view_count: %w", err) - } - b.ViewCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessChatLink) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessChatLink#8e998b83 as nil") - } - buf.ObjStart() - buf.PutID("businessChatLink") - buf.Comma() - buf.FieldStart("link") - buf.PutString(b.Link) - buf.Comma() - buf.FieldStart("text") - if err := b.Text.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessChatLink#8e998b83: field text: %w", err) - } - buf.Comma() - buf.FieldStart("title") - buf.PutString(b.Title) - buf.Comma() - buf.FieldStart("view_count") - buf.PutInt32(b.ViewCount) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessChatLink) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessChatLink#8e998b83 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessChatLink"); err != nil { - return fmt.Errorf("unable to decode businessChatLink#8e998b83: %w", err) - } - case "link": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessChatLink#8e998b83: field link: %w", err) - } - b.Link = value - case "text": - if err := b.Text.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessChatLink#8e998b83: field text: %w", err) - } - case "title": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessChatLink#8e998b83: field title: %w", err) - } - b.Title = value - case "view_count": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessChatLink#8e998b83: field view_count: %w", err) - } - b.ViewCount = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (b *BusinessChatLink) GetLink() (value string) { - if b == nil { - return - } - return b.Link -} - -// GetText returns value of Text field. -func (b *BusinessChatLink) GetText() (value FormattedText) { - if b == nil { - return - } - return b.Text -} - -// GetTitle returns value of Title field. -func (b *BusinessChatLink) GetTitle() (value string) { - if b == nil { - return - } - return b.Title -} - -// GetViewCount returns value of ViewCount field. -func (b *BusinessChatLink) GetViewCount() (value int32) { - if b == nil { - return - } - return b.ViewCount -} diff --git a/tdapi/tl_business_chat_link_info_gen.go b/tdapi/tl_business_chat_link_info_gen.go deleted file mode 100644 index ea02d219c..000000000 --- a/tdapi/tl_business_chat_link_info_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessChatLinkInfo represents TL type `businessChatLinkInfo#cc7334af`. -type BusinessChatLinkInfo struct { - // Identifier of the private chat that created the link - ChatID int64 - // Message draft text that must be added to the input field - Text FormattedText -} - -// BusinessChatLinkInfoTypeID is TL type id of BusinessChatLinkInfo. -const BusinessChatLinkInfoTypeID = 0xcc7334af - -// Ensuring interfaces in compile-time for BusinessChatLinkInfo. -var ( - _ bin.Encoder = &BusinessChatLinkInfo{} - _ bin.Decoder = &BusinessChatLinkInfo{} - _ bin.BareEncoder = &BusinessChatLinkInfo{} - _ bin.BareDecoder = &BusinessChatLinkInfo{} -) - -func (b *BusinessChatLinkInfo) Zero() bool { - if b == nil { - return true - } - if !(b.ChatID == 0) { - return false - } - if !(b.Text.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessChatLinkInfo) String() string { - if b == nil { - return "BusinessChatLinkInfo(nil)" - } - type Alias BusinessChatLinkInfo - return fmt.Sprintf("BusinessChatLinkInfo%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessChatLinkInfo) TypeID() uint32 { - return BusinessChatLinkInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessChatLinkInfo) TypeName() string { - return "businessChatLinkInfo" -} - -// TypeInfo returns info about TL type. -func (b *BusinessChatLinkInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessChatLinkInfo", - ID: BusinessChatLinkInfoTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessChatLinkInfo) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessChatLinkInfo#cc7334af as nil") - } - buf.PutID(BusinessChatLinkInfoTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessChatLinkInfo) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessChatLinkInfo#cc7334af as nil") - } - buf.PutInt53(b.ChatID) - if err := b.Text.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessChatLinkInfo#cc7334af: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessChatLinkInfo) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessChatLinkInfo#cc7334af to nil") - } - if err := buf.ConsumeID(BusinessChatLinkInfoTypeID); err != nil { - return fmt.Errorf("unable to decode businessChatLinkInfo#cc7334af: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessChatLinkInfo) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessChatLinkInfo#cc7334af to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessChatLinkInfo#cc7334af: field chat_id: %w", err) - } - b.ChatID = value - } - { - if err := b.Text.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessChatLinkInfo#cc7334af: field text: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessChatLinkInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessChatLinkInfo#cc7334af as nil") - } - buf.ObjStart() - buf.PutID("businessChatLinkInfo") - buf.Comma() - buf.FieldStart("chat_id") - buf.PutInt53(b.ChatID) - buf.Comma() - buf.FieldStart("text") - if err := b.Text.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessChatLinkInfo#cc7334af: field text: %w", err) - } - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessChatLinkInfo) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessChatLinkInfo#cc7334af to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessChatLinkInfo"); err != nil { - return fmt.Errorf("unable to decode businessChatLinkInfo#cc7334af: %w", err) - } - case "chat_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessChatLinkInfo#cc7334af: field chat_id: %w", err) - } - b.ChatID = value - case "text": - if err := b.Text.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessChatLinkInfo#cc7334af: field text: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (b *BusinessChatLinkInfo) GetChatID() (value int64) { - if b == nil { - return - } - return b.ChatID -} - -// GetText returns value of Text field. -func (b *BusinessChatLinkInfo) GetText() (value FormattedText) { - if b == nil { - return - } - return b.Text -} diff --git a/tdapi/tl_business_chat_links_gen.go b/tdapi/tl_business_chat_links_gen.go deleted file mode 100644 index 4a59c7fa7..000000000 --- a/tdapi/tl_business_chat_links_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessChatLinks represents TL type `businessChatLinks#1569924`. -type BusinessChatLinks struct { - // List of links - Links []BusinessChatLink -} - -// BusinessChatLinksTypeID is TL type id of BusinessChatLinks. -const BusinessChatLinksTypeID = 0x1569924 - -// Ensuring interfaces in compile-time for BusinessChatLinks. -var ( - _ bin.Encoder = &BusinessChatLinks{} - _ bin.Decoder = &BusinessChatLinks{} - _ bin.BareEncoder = &BusinessChatLinks{} - _ bin.BareDecoder = &BusinessChatLinks{} -) - -func (b *BusinessChatLinks) Zero() bool { - if b == nil { - return true - } - if !(b.Links == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessChatLinks) String() string { - if b == nil { - return "BusinessChatLinks(nil)" - } - type Alias BusinessChatLinks - return fmt.Sprintf("BusinessChatLinks%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessChatLinks) TypeID() uint32 { - return BusinessChatLinksTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessChatLinks) TypeName() string { - return "businessChatLinks" -} - -// TypeInfo returns info about TL type. -func (b *BusinessChatLinks) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessChatLinks", - ID: BusinessChatLinksTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Links", - SchemaName: "links", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessChatLinks) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessChatLinks#1569924 as nil") - } - buf.PutID(BusinessChatLinksTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessChatLinks) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessChatLinks#1569924 as nil") - } - buf.PutInt(len(b.Links)) - for idx, v := range b.Links { - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare businessChatLinks#1569924: field links element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessChatLinks) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessChatLinks#1569924 to nil") - } - if err := buf.ConsumeID(BusinessChatLinksTypeID); err != nil { - return fmt.Errorf("unable to decode businessChatLinks#1569924: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessChatLinks) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessChatLinks#1569924 to nil") - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode businessChatLinks#1569924: field links: %w", err) - } - - if headerLen > 0 { - b.Links = make([]BusinessChatLink, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BusinessChatLink - if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare businessChatLinks#1569924: field links: %w", err) - } - b.Links = append(b.Links, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessChatLinks) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessChatLinks#1569924 as nil") - } - buf.ObjStart() - buf.PutID("businessChatLinks") - buf.Comma() - buf.FieldStart("links") - buf.ArrStart() - for idx, v := range b.Links { - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessChatLinks#1569924: field links element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessChatLinks) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessChatLinks#1569924 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessChatLinks"); err != nil { - return fmt.Errorf("unable to decode businessChatLinks#1569924: %w", err) - } - case "links": - if err := buf.Arr(func(buf tdjson.Decoder) error { - var value BusinessChatLink - if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessChatLinks#1569924: field links: %w", err) - } - b.Links = append(b.Links, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode businessChatLinks#1569924: field links: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetLinks returns value of Links field. -func (b *BusinessChatLinks) GetLinks() (value []BusinessChatLink) { - if b == nil { - return - } - return b.Links -} diff --git a/tdapi/tl_business_connected_bot_gen.go b/tdapi/tl_business_connected_bot_gen.go deleted file mode 100644 index b0a8721b9..000000000 --- a/tdapi/tl_business_connected_bot_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessConnectedBot represents TL type `businessConnectedBot#ec50ead7`. -type BusinessConnectedBot struct { - // User identifier of the bot - BotUserID int64 - // Private chats that will be accessible to the bot - Recipients BusinessRecipients - // True, if the bot can send messages to the private chats; false otherwise - CanReply bool -} - -// BusinessConnectedBotTypeID is TL type id of BusinessConnectedBot. -const BusinessConnectedBotTypeID = 0xec50ead7 - -// Ensuring interfaces in compile-time for BusinessConnectedBot. -var ( - _ bin.Encoder = &BusinessConnectedBot{} - _ bin.Decoder = &BusinessConnectedBot{} - _ bin.BareEncoder = &BusinessConnectedBot{} - _ bin.BareDecoder = &BusinessConnectedBot{} -) - -func (b *BusinessConnectedBot) Zero() bool { - if b == nil { - return true - } - if !(b.BotUserID == 0) { - return false - } - if !(b.Recipients.Zero()) { - return false - } - if !(b.CanReply == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessConnectedBot) String() string { - if b == nil { - return "BusinessConnectedBot(nil)" - } - type Alias BusinessConnectedBot - return fmt.Sprintf("BusinessConnectedBot%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessConnectedBot) TypeID() uint32 { - return BusinessConnectedBotTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessConnectedBot) TypeName() string { - return "businessConnectedBot" -} - -// TypeInfo returns info about TL type. -func (b *BusinessConnectedBot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessConnectedBot", - ID: BusinessConnectedBotTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Recipients", - SchemaName: "recipients", - }, - { - Name: "CanReply", - SchemaName: "can_reply", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessConnectedBot) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessConnectedBot#ec50ead7 as nil") - } - buf.PutID(BusinessConnectedBotTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessConnectedBot) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessConnectedBot#ec50ead7 as nil") - } - buf.PutInt53(b.BotUserID) - if err := b.Recipients.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessConnectedBot#ec50ead7: field recipients: %w", err) - } - buf.PutBool(b.CanReply) - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessConnectedBot) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessConnectedBot#ec50ead7 to nil") - } - if err := buf.ConsumeID(BusinessConnectedBotTypeID); err != nil { - return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessConnectedBot) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessConnectedBot#ec50ead7 to nil") - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field bot_user_id: %w", err) - } - b.BotUserID = value - } - { - if err := b.Recipients.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field recipients: %w", err) - } - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field can_reply: %w", err) - } - b.CanReply = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessConnectedBot) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessConnectedBot#ec50ead7 as nil") - } - buf.ObjStart() - buf.PutID("businessConnectedBot") - buf.Comma() - buf.FieldStart("bot_user_id") - buf.PutInt53(b.BotUserID) - buf.Comma() - buf.FieldStart("recipients") - if err := b.Recipients.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessConnectedBot#ec50ead7: field recipients: %w", err) - } - buf.Comma() - buf.FieldStart("can_reply") - buf.PutBool(b.CanReply) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessConnectedBot) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessConnectedBot#ec50ead7 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessConnectedBot"); err != nil { - return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: %w", err) - } - case "bot_user_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field bot_user_id: %w", err) - } - b.BotUserID = value - case "recipients": - if err := b.Recipients.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field recipients: %w", err) - } - case "can_reply": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessConnectedBot#ec50ead7: field can_reply: %w", err) - } - b.CanReply = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (b *BusinessConnectedBot) GetBotUserID() (value int64) { - if b == nil { - return - } - return b.BotUserID -} - -// GetRecipients returns value of Recipients field. -func (b *BusinessConnectedBot) GetRecipients() (value BusinessRecipients) { - if b == nil { - return - } - return b.Recipients -} - -// GetCanReply returns value of CanReply field. -func (b *BusinessConnectedBot) GetCanReply() (value bool) { - if b == nil { - return - } - return b.CanReply -} diff --git a/tdapi/tl_business_connection_gen.go b/tdapi/tl_business_connection_gen.go deleted file mode 100644 index 69f3212ac..000000000 --- a/tdapi/tl_business_connection_gen.go +++ /dev/null @@ -1,363 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessConnection represents TL type `businessConnection#4436e234`. -type BusinessConnection struct { - // Unique identifier of the connection - ID string - // Identifier of the business user that created the connection - UserID int64 - // Chat identifier of the private chat with the user - UserChatID int64 - // Point in time (Unix timestamp) when the connection was established - Date int32 - // True, if the bot can send messages to the connected user; false otherwise - CanReply bool - // True, if the connection is enabled; false otherwise - IsEnabled bool -} - -// BusinessConnectionTypeID is TL type id of BusinessConnection. -const BusinessConnectionTypeID = 0x4436e234 - -// Ensuring interfaces in compile-time for BusinessConnection. -var ( - _ bin.Encoder = &BusinessConnection{} - _ bin.Decoder = &BusinessConnection{} - _ bin.BareEncoder = &BusinessConnection{} - _ bin.BareDecoder = &BusinessConnection{} -) - -func (b *BusinessConnection) Zero() bool { - if b == nil { - return true - } - if !(b.ID == "") { - return false - } - if !(b.UserID == 0) { - return false - } - if !(b.UserChatID == 0) { - return false - } - if !(b.Date == 0) { - return false - } - if !(b.CanReply == false) { - return false - } - if !(b.IsEnabled == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessConnection) String() string { - if b == nil { - return "BusinessConnection(nil)" - } - type Alias BusinessConnection - return fmt.Sprintf("BusinessConnection%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessConnection) TypeID() uint32 { - return BusinessConnectionTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessConnection) TypeName() string { - return "businessConnection" -} - -// TypeInfo returns info about TL type. -func (b *BusinessConnection) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessConnection", - ID: BusinessConnectionTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "UserChatID", - SchemaName: "user_chat_id", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "CanReply", - SchemaName: "can_reply", - }, - { - Name: "IsEnabled", - SchemaName: "is_enabled", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessConnection) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessConnection#4436e234 as nil") - } - buf.PutID(BusinessConnectionTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessConnection) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessConnection#4436e234 as nil") - } - buf.PutString(b.ID) - buf.PutInt53(b.UserID) - buf.PutInt53(b.UserChatID) - buf.PutInt32(b.Date) - buf.PutBool(b.CanReply) - buf.PutBool(b.IsEnabled) - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessConnection) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessConnection#4436e234 to nil") - } - if err := buf.ConsumeID(BusinessConnectionTypeID); err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessConnection) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessConnection#4436e234 to nil") - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field id: %w", err) - } - b.ID = value - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field user_id: %w", err) - } - b.UserID = value - } - { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field user_chat_id: %w", err) - } - b.UserChatID = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field date: %w", err) - } - b.Date = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field can_reply: %w", err) - } - b.CanReply = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field is_enabled: %w", err) - } - b.IsEnabled = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessConnection) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessConnection#4436e234 as nil") - } - buf.ObjStart() - buf.PutID("businessConnection") - buf.Comma() - buf.FieldStart("id") - buf.PutString(b.ID) - buf.Comma() - buf.FieldStart("user_id") - buf.PutInt53(b.UserID) - buf.Comma() - buf.FieldStart("user_chat_id") - buf.PutInt53(b.UserChatID) - buf.Comma() - buf.FieldStart("date") - buf.PutInt32(b.Date) - buf.Comma() - buf.FieldStart("can_reply") - buf.PutBool(b.CanReply) - buf.Comma() - buf.FieldStart("is_enabled") - buf.PutBool(b.IsEnabled) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessConnection) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessConnection#4436e234 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessConnection"); err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: %w", err) - } - case "id": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field id: %w", err) - } - b.ID = value - case "user_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field user_id: %w", err) - } - b.UserID = value - case "user_chat_id": - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field user_chat_id: %w", err) - } - b.UserChatID = value - case "date": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field date: %w", err) - } - b.Date = value - case "can_reply": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field can_reply: %w", err) - } - b.CanReply = value - case "is_enabled": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessConnection#4436e234: field is_enabled: %w", err) - } - b.IsEnabled = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (b *BusinessConnection) GetID() (value string) { - if b == nil { - return - } - return b.ID -} - -// GetUserID returns value of UserID field. -func (b *BusinessConnection) GetUserID() (value int64) { - if b == nil { - return - } - return b.UserID -} - -// GetUserChatID returns value of UserChatID field. -func (b *BusinessConnection) GetUserChatID() (value int64) { - if b == nil { - return - } - return b.UserChatID -} - -// GetDate returns value of Date field. -func (b *BusinessConnection) GetDate() (value int32) { - if b == nil { - return - } - return b.Date -} - -// GetCanReply returns value of CanReply field. -func (b *BusinessConnection) GetCanReply() (value bool) { - if b == nil { - return - } - return b.CanReply -} - -// GetIsEnabled returns value of IsEnabled field. -func (b *BusinessConnection) GetIsEnabled() (value bool) { - if b == nil { - return - } - return b.IsEnabled -} diff --git a/tdapi/tl_business_feature_gen.go b/tdapi/tl_business_feature_gen.go deleted file mode 100644 index ebb45e412..000000000 --- a/tdapi/tl_business_feature_gen.go +++ /dev/null @@ -1,1745 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessFeatureLocation represents TL type `businessFeatureLocation#c090027c`. -type BusinessFeatureLocation struct { -} - -// BusinessFeatureLocationTypeID is TL type id of BusinessFeatureLocation. -const BusinessFeatureLocationTypeID = 0xc090027c - -// construct implements constructor of BusinessFeatureClass. -func (b BusinessFeatureLocation) construct() BusinessFeatureClass { return &b } - -// Ensuring interfaces in compile-time for BusinessFeatureLocation. -var ( - _ bin.Encoder = &BusinessFeatureLocation{} - _ bin.Decoder = &BusinessFeatureLocation{} - _ bin.BareEncoder = &BusinessFeatureLocation{} - _ bin.BareDecoder = &BusinessFeatureLocation{} - - _ BusinessFeatureClass = &BusinessFeatureLocation{} -) - -func (b *BusinessFeatureLocation) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatureLocation) String() string { - if b == nil { - return "BusinessFeatureLocation(nil)" - } - type Alias BusinessFeatureLocation - return fmt.Sprintf("BusinessFeatureLocation%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatureLocation) TypeID() uint32 { - return BusinessFeatureLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatureLocation) TypeName() string { - return "businessFeatureLocation" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatureLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatureLocation", - ID: BusinessFeatureLocationTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatureLocation) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureLocation#c090027c as nil") - } - buf.PutID(BusinessFeatureLocationTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatureLocation) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureLocation#c090027c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatureLocation) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureLocation#c090027c to nil") - } - if err := buf.ConsumeID(BusinessFeatureLocationTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatureLocation#c090027c: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatureLocation) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureLocation#c090027c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatureLocation) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureLocation#c090027c as nil") - } - buf.ObjStart() - buf.PutID("businessFeatureLocation") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatureLocation) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureLocation#c090027c to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatureLocation"); err != nil { - return fmt.Errorf("unable to decode businessFeatureLocation#c090027c: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessFeatureOpeningHours represents TL type `businessFeatureOpeningHours#1b7b22ed`. -type BusinessFeatureOpeningHours struct { -} - -// BusinessFeatureOpeningHoursTypeID is TL type id of BusinessFeatureOpeningHours. -const BusinessFeatureOpeningHoursTypeID = 0x1b7b22ed - -// construct implements constructor of BusinessFeatureClass. -func (b BusinessFeatureOpeningHours) construct() BusinessFeatureClass { return &b } - -// Ensuring interfaces in compile-time for BusinessFeatureOpeningHours. -var ( - _ bin.Encoder = &BusinessFeatureOpeningHours{} - _ bin.Decoder = &BusinessFeatureOpeningHours{} - _ bin.BareEncoder = &BusinessFeatureOpeningHours{} - _ bin.BareDecoder = &BusinessFeatureOpeningHours{} - - _ BusinessFeatureClass = &BusinessFeatureOpeningHours{} -) - -func (b *BusinessFeatureOpeningHours) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatureOpeningHours) String() string { - if b == nil { - return "BusinessFeatureOpeningHours(nil)" - } - type Alias BusinessFeatureOpeningHours - return fmt.Sprintf("BusinessFeatureOpeningHours%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatureOpeningHours) TypeID() uint32 { - return BusinessFeatureOpeningHoursTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatureOpeningHours) TypeName() string { - return "businessFeatureOpeningHours" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatureOpeningHours) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatureOpeningHours", - ID: BusinessFeatureOpeningHoursTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatureOpeningHours) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureOpeningHours#1b7b22ed as nil") - } - buf.PutID(BusinessFeatureOpeningHoursTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatureOpeningHours) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureOpeningHours#1b7b22ed as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatureOpeningHours) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureOpeningHours#1b7b22ed to nil") - } - if err := buf.ConsumeID(BusinessFeatureOpeningHoursTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatureOpeningHours#1b7b22ed: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatureOpeningHours) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureOpeningHours#1b7b22ed to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatureOpeningHours) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureOpeningHours#1b7b22ed as nil") - } - buf.ObjStart() - buf.PutID("businessFeatureOpeningHours") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatureOpeningHours) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureOpeningHours#1b7b22ed to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatureOpeningHours"); err != nil { - return fmt.Errorf("unable to decode businessFeatureOpeningHours#1b7b22ed: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessFeatureQuickReplies represents TL type `businessFeatureQuickReplies#9c380a82`. -type BusinessFeatureQuickReplies struct { -} - -// BusinessFeatureQuickRepliesTypeID is TL type id of BusinessFeatureQuickReplies. -const BusinessFeatureQuickRepliesTypeID = 0x9c380a82 - -// construct implements constructor of BusinessFeatureClass. -func (b BusinessFeatureQuickReplies) construct() BusinessFeatureClass { return &b } - -// Ensuring interfaces in compile-time for BusinessFeatureQuickReplies. -var ( - _ bin.Encoder = &BusinessFeatureQuickReplies{} - _ bin.Decoder = &BusinessFeatureQuickReplies{} - _ bin.BareEncoder = &BusinessFeatureQuickReplies{} - _ bin.BareDecoder = &BusinessFeatureQuickReplies{} - - _ BusinessFeatureClass = &BusinessFeatureQuickReplies{} -) - -func (b *BusinessFeatureQuickReplies) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatureQuickReplies) String() string { - if b == nil { - return "BusinessFeatureQuickReplies(nil)" - } - type Alias BusinessFeatureQuickReplies - return fmt.Sprintf("BusinessFeatureQuickReplies%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatureQuickReplies) TypeID() uint32 { - return BusinessFeatureQuickRepliesTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatureQuickReplies) TypeName() string { - return "businessFeatureQuickReplies" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatureQuickReplies) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatureQuickReplies", - ID: BusinessFeatureQuickRepliesTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatureQuickReplies) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureQuickReplies#9c380a82 as nil") - } - buf.PutID(BusinessFeatureQuickRepliesTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatureQuickReplies) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureQuickReplies#9c380a82 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatureQuickReplies) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureQuickReplies#9c380a82 to nil") - } - if err := buf.ConsumeID(BusinessFeatureQuickRepliesTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatureQuickReplies#9c380a82: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatureQuickReplies) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureQuickReplies#9c380a82 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatureQuickReplies) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureQuickReplies#9c380a82 as nil") - } - buf.ObjStart() - buf.PutID("businessFeatureQuickReplies") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatureQuickReplies) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureQuickReplies#9c380a82 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatureQuickReplies"); err != nil { - return fmt.Errorf("unable to decode businessFeatureQuickReplies#9c380a82: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessFeatureGreetingMessage represents TL type `businessFeatureGreetingMessage#6aa87474`. -type BusinessFeatureGreetingMessage struct { -} - -// BusinessFeatureGreetingMessageTypeID is TL type id of BusinessFeatureGreetingMessage. -const BusinessFeatureGreetingMessageTypeID = 0x6aa87474 - -// construct implements constructor of BusinessFeatureClass. -func (b BusinessFeatureGreetingMessage) construct() BusinessFeatureClass { return &b } - -// Ensuring interfaces in compile-time for BusinessFeatureGreetingMessage. -var ( - _ bin.Encoder = &BusinessFeatureGreetingMessage{} - _ bin.Decoder = &BusinessFeatureGreetingMessage{} - _ bin.BareEncoder = &BusinessFeatureGreetingMessage{} - _ bin.BareDecoder = &BusinessFeatureGreetingMessage{} - - _ BusinessFeatureClass = &BusinessFeatureGreetingMessage{} -) - -func (b *BusinessFeatureGreetingMessage) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatureGreetingMessage) String() string { - if b == nil { - return "BusinessFeatureGreetingMessage(nil)" - } - type Alias BusinessFeatureGreetingMessage - return fmt.Sprintf("BusinessFeatureGreetingMessage%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatureGreetingMessage) TypeID() uint32 { - return BusinessFeatureGreetingMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatureGreetingMessage) TypeName() string { - return "businessFeatureGreetingMessage" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatureGreetingMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatureGreetingMessage", - ID: BusinessFeatureGreetingMessageTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatureGreetingMessage) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureGreetingMessage#6aa87474 as nil") - } - buf.PutID(BusinessFeatureGreetingMessageTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatureGreetingMessage) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureGreetingMessage#6aa87474 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatureGreetingMessage) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureGreetingMessage#6aa87474 to nil") - } - if err := buf.ConsumeID(BusinessFeatureGreetingMessageTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatureGreetingMessage#6aa87474: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatureGreetingMessage) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureGreetingMessage#6aa87474 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatureGreetingMessage) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureGreetingMessage#6aa87474 as nil") - } - buf.ObjStart() - buf.PutID("businessFeatureGreetingMessage") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatureGreetingMessage) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureGreetingMessage#6aa87474 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatureGreetingMessage"); err != nil { - return fmt.Errorf("unable to decode businessFeatureGreetingMessage#6aa87474: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessFeatureAwayMessage represents TL type `businessFeatureAwayMessage#40f9e8dd`. -type BusinessFeatureAwayMessage struct { -} - -// BusinessFeatureAwayMessageTypeID is TL type id of BusinessFeatureAwayMessage. -const BusinessFeatureAwayMessageTypeID = 0x40f9e8dd - -// construct implements constructor of BusinessFeatureClass. -func (b BusinessFeatureAwayMessage) construct() BusinessFeatureClass { return &b } - -// Ensuring interfaces in compile-time for BusinessFeatureAwayMessage. -var ( - _ bin.Encoder = &BusinessFeatureAwayMessage{} - _ bin.Decoder = &BusinessFeatureAwayMessage{} - _ bin.BareEncoder = &BusinessFeatureAwayMessage{} - _ bin.BareDecoder = &BusinessFeatureAwayMessage{} - - _ BusinessFeatureClass = &BusinessFeatureAwayMessage{} -) - -func (b *BusinessFeatureAwayMessage) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatureAwayMessage) String() string { - if b == nil { - return "BusinessFeatureAwayMessage(nil)" - } - type Alias BusinessFeatureAwayMessage - return fmt.Sprintf("BusinessFeatureAwayMessage%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatureAwayMessage) TypeID() uint32 { - return BusinessFeatureAwayMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatureAwayMessage) TypeName() string { - return "businessFeatureAwayMessage" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatureAwayMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatureAwayMessage", - ID: BusinessFeatureAwayMessageTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatureAwayMessage) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureAwayMessage#40f9e8dd as nil") - } - buf.PutID(BusinessFeatureAwayMessageTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatureAwayMessage) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureAwayMessage#40f9e8dd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatureAwayMessage) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureAwayMessage#40f9e8dd to nil") - } - if err := buf.ConsumeID(BusinessFeatureAwayMessageTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatureAwayMessage#40f9e8dd: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatureAwayMessage) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureAwayMessage#40f9e8dd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatureAwayMessage) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureAwayMessage#40f9e8dd as nil") - } - buf.ObjStart() - buf.PutID("businessFeatureAwayMessage") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatureAwayMessage) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureAwayMessage#40f9e8dd to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatureAwayMessage"); err != nil { - return fmt.Errorf("unable to decode businessFeatureAwayMessage#40f9e8dd: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessFeatureAccountLinks represents TL type `businessFeatureAccountLinks#6ffa970e`. -type BusinessFeatureAccountLinks struct { -} - -// BusinessFeatureAccountLinksTypeID is TL type id of BusinessFeatureAccountLinks. -const BusinessFeatureAccountLinksTypeID = 0x6ffa970e - -// construct implements constructor of BusinessFeatureClass. -func (b BusinessFeatureAccountLinks) construct() BusinessFeatureClass { return &b } - -// Ensuring interfaces in compile-time for BusinessFeatureAccountLinks. -var ( - _ bin.Encoder = &BusinessFeatureAccountLinks{} - _ bin.Decoder = &BusinessFeatureAccountLinks{} - _ bin.BareEncoder = &BusinessFeatureAccountLinks{} - _ bin.BareDecoder = &BusinessFeatureAccountLinks{} - - _ BusinessFeatureClass = &BusinessFeatureAccountLinks{} -) - -func (b *BusinessFeatureAccountLinks) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatureAccountLinks) String() string { - if b == nil { - return "BusinessFeatureAccountLinks(nil)" - } - type Alias BusinessFeatureAccountLinks - return fmt.Sprintf("BusinessFeatureAccountLinks%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatureAccountLinks) TypeID() uint32 { - return BusinessFeatureAccountLinksTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatureAccountLinks) TypeName() string { - return "businessFeatureAccountLinks" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatureAccountLinks) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatureAccountLinks", - ID: BusinessFeatureAccountLinksTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatureAccountLinks) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureAccountLinks#6ffa970e as nil") - } - buf.PutID(BusinessFeatureAccountLinksTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatureAccountLinks) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureAccountLinks#6ffa970e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatureAccountLinks) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureAccountLinks#6ffa970e to nil") - } - if err := buf.ConsumeID(BusinessFeatureAccountLinksTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatureAccountLinks#6ffa970e: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatureAccountLinks) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureAccountLinks#6ffa970e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatureAccountLinks) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureAccountLinks#6ffa970e as nil") - } - buf.ObjStart() - buf.PutID("businessFeatureAccountLinks") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatureAccountLinks) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureAccountLinks#6ffa970e to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatureAccountLinks"); err != nil { - return fmt.Errorf("unable to decode businessFeatureAccountLinks#6ffa970e: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessFeatureStartPage represents TL type `businessFeatureStartPage#17edf7e1`. -type BusinessFeatureStartPage struct { -} - -// BusinessFeatureStartPageTypeID is TL type id of BusinessFeatureStartPage. -const BusinessFeatureStartPageTypeID = 0x17edf7e1 - -// construct implements constructor of BusinessFeatureClass. -func (b BusinessFeatureStartPage) construct() BusinessFeatureClass { return &b } - -// Ensuring interfaces in compile-time for BusinessFeatureStartPage. -var ( - _ bin.Encoder = &BusinessFeatureStartPage{} - _ bin.Decoder = &BusinessFeatureStartPage{} - _ bin.BareEncoder = &BusinessFeatureStartPage{} - _ bin.BareDecoder = &BusinessFeatureStartPage{} - - _ BusinessFeatureClass = &BusinessFeatureStartPage{} -) - -func (b *BusinessFeatureStartPage) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatureStartPage) String() string { - if b == nil { - return "BusinessFeatureStartPage(nil)" - } - type Alias BusinessFeatureStartPage - return fmt.Sprintf("BusinessFeatureStartPage%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatureStartPage) TypeID() uint32 { - return BusinessFeatureStartPageTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatureStartPage) TypeName() string { - return "businessFeatureStartPage" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatureStartPage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatureStartPage", - ID: BusinessFeatureStartPageTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatureStartPage) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureStartPage#17edf7e1 as nil") - } - buf.PutID(BusinessFeatureStartPageTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatureStartPage) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureStartPage#17edf7e1 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatureStartPage) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureStartPage#17edf7e1 to nil") - } - if err := buf.ConsumeID(BusinessFeatureStartPageTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatureStartPage#17edf7e1: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatureStartPage) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureStartPage#17edf7e1 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatureStartPage) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureStartPage#17edf7e1 as nil") - } - buf.ObjStart() - buf.PutID("businessFeatureStartPage") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatureStartPage) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureStartPage#17edf7e1 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatureStartPage"); err != nil { - return fmt.Errorf("unable to decode businessFeatureStartPage#17edf7e1: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessFeatureBots represents TL type `businessFeatureBots#106575e5`. -type BusinessFeatureBots struct { -} - -// BusinessFeatureBotsTypeID is TL type id of BusinessFeatureBots. -const BusinessFeatureBotsTypeID = 0x106575e5 - -// construct implements constructor of BusinessFeatureClass. -func (b BusinessFeatureBots) construct() BusinessFeatureClass { return &b } - -// Ensuring interfaces in compile-time for BusinessFeatureBots. -var ( - _ bin.Encoder = &BusinessFeatureBots{} - _ bin.Decoder = &BusinessFeatureBots{} - _ bin.BareEncoder = &BusinessFeatureBots{} - _ bin.BareDecoder = &BusinessFeatureBots{} - - _ BusinessFeatureClass = &BusinessFeatureBots{} -) - -func (b *BusinessFeatureBots) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatureBots) String() string { - if b == nil { - return "BusinessFeatureBots(nil)" - } - type Alias BusinessFeatureBots - return fmt.Sprintf("BusinessFeatureBots%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatureBots) TypeID() uint32 { - return BusinessFeatureBotsTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatureBots) TypeName() string { - return "businessFeatureBots" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatureBots) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatureBots", - ID: BusinessFeatureBotsTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatureBots) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureBots#106575e5 as nil") - } - buf.PutID(BusinessFeatureBotsTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatureBots) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureBots#106575e5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatureBots) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureBots#106575e5 to nil") - } - if err := buf.ConsumeID(BusinessFeatureBotsTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatureBots#106575e5: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatureBots) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureBots#106575e5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatureBots) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureBots#106575e5 as nil") - } - buf.ObjStart() - buf.PutID("businessFeatureBots") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatureBots) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureBots#106575e5 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatureBots"); err != nil { - return fmt.Errorf("unable to decode businessFeatureBots#106575e5: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessFeatureEmojiStatus represents TL type `businessFeatureEmojiStatus#cd8ec0e5`. -type BusinessFeatureEmojiStatus struct { -} - -// BusinessFeatureEmojiStatusTypeID is TL type id of BusinessFeatureEmojiStatus. -const BusinessFeatureEmojiStatusTypeID = 0xcd8ec0e5 - -// construct implements constructor of BusinessFeatureClass. -func (b BusinessFeatureEmojiStatus) construct() BusinessFeatureClass { return &b } - -// Ensuring interfaces in compile-time for BusinessFeatureEmojiStatus. -var ( - _ bin.Encoder = &BusinessFeatureEmojiStatus{} - _ bin.Decoder = &BusinessFeatureEmojiStatus{} - _ bin.BareEncoder = &BusinessFeatureEmojiStatus{} - _ bin.BareDecoder = &BusinessFeatureEmojiStatus{} - - _ BusinessFeatureClass = &BusinessFeatureEmojiStatus{} -) - -func (b *BusinessFeatureEmojiStatus) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatureEmojiStatus) String() string { - if b == nil { - return "BusinessFeatureEmojiStatus(nil)" - } - type Alias BusinessFeatureEmojiStatus - return fmt.Sprintf("BusinessFeatureEmojiStatus%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatureEmojiStatus) TypeID() uint32 { - return BusinessFeatureEmojiStatusTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatureEmojiStatus) TypeName() string { - return "businessFeatureEmojiStatus" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatureEmojiStatus) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatureEmojiStatus", - ID: BusinessFeatureEmojiStatusTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatureEmojiStatus) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureEmojiStatus#cd8ec0e5 as nil") - } - buf.PutID(BusinessFeatureEmojiStatusTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatureEmojiStatus) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureEmojiStatus#cd8ec0e5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatureEmojiStatus) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureEmojiStatus#cd8ec0e5 to nil") - } - if err := buf.ConsumeID(BusinessFeatureEmojiStatusTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatureEmojiStatus#cd8ec0e5: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatureEmojiStatus) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureEmojiStatus#cd8ec0e5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatureEmojiStatus) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureEmojiStatus#cd8ec0e5 as nil") - } - buf.ObjStart() - buf.PutID("businessFeatureEmojiStatus") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatureEmojiStatus) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureEmojiStatus#cd8ec0e5 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatureEmojiStatus"); err != nil { - return fmt.Errorf("unable to decode businessFeatureEmojiStatus#cd8ec0e5: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessFeatureChatFolderTags represents TL type `businessFeatureChatFolderTags#df95092a`. -type BusinessFeatureChatFolderTags struct { -} - -// BusinessFeatureChatFolderTagsTypeID is TL type id of BusinessFeatureChatFolderTags. -const BusinessFeatureChatFolderTagsTypeID = 0xdf95092a - -// construct implements constructor of BusinessFeatureClass. -func (b BusinessFeatureChatFolderTags) construct() BusinessFeatureClass { return &b } - -// Ensuring interfaces in compile-time for BusinessFeatureChatFolderTags. -var ( - _ bin.Encoder = &BusinessFeatureChatFolderTags{} - _ bin.Decoder = &BusinessFeatureChatFolderTags{} - _ bin.BareEncoder = &BusinessFeatureChatFolderTags{} - _ bin.BareDecoder = &BusinessFeatureChatFolderTags{} - - _ BusinessFeatureClass = &BusinessFeatureChatFolderTags{} -) - -func (b *BusinessFeatureChatFolderTags) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatureChatFolderTags) String() string { - if b == nil { - return "BusinessFeatureChatFolderTags(nil)" - } - type Alias BusinessFeatureChatFolderTags - return fmt.Sprintf("BusinessFeatureChatFolderTags%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatureChatFolderTags) TypeID() uint32 { - return BusinessFeatureChatFolderTagsTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatureChatFolderTags) TypeName() string { - return "businessFeatureChatFolderTags" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatureChatFolderTags) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatureChatFolderTags", - ID: BusinessFeatureChatFolderTagsTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatureChatFolderTags) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureChatFolderTags#df95092a as nil") - } - buf.PutID(BusinessFeatureChatFolderTagsTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatureChatFolderTags) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureChatFolderTags#df95092a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatureChatFolderTags) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureChatFolderTags#df95092a to nil") - } - if err := buf.ConsumeID(BusinessFeatureChatFolderTagsTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatureChatFolderTags#df95092a: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatureChatFolderTags) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureChatFolderTags#df95092a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatureChatFolderTags) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureChatFolderTags#df95092a as nil") - } - buf.ObjStart() - buf.PutID("businessFeatureChatFolderTags") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatureChatFolderTags) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureChatFolderTags#df95092a to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatureChatFolderTags"); err != nil { - return fmt.Errorf("unable to decode businessFeatureChatFolderTags#df95092a: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessFeatureUpgradedStories represents TL type `businessFeatureUpgradedStories#93fb53d2`. -type BusinessFeatureUpgradedStories struct { -} - -// BusinessFeatureUpgradedStoriesTypeID is TL type id of BusinessFeatureUpgradedStories. -const BusinessFeatureUpgradedStoriesTypeID = 0x93fb53d2 - -// construct implements constructor of BusinessFeatureClass. -func (b BusinessFeatureUpgradedStories) construct() BusinessFeatureClass { return &b } - -// Ensuring interfaces in compile-time for BusinessFeatureUpgradedStories. -var ( - _ bin.Encoder = &BusinessFeatureUpgradedStories{} - _ bin.Decoder = &BusinessFeatureUpgradedStories{} - _ bin.BareEncoder = &BusinessFeatureUpgradedStories{} - _ bin.BareDecoder = &BusinessFeatureUpgradedStories{} - - _ BusinessFeatureClass = &BusinessFeatureUpgradedStories{} -) - -func (b *BusinessFeatureUpgradedStories) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatureUpgradedStories) String() string { - if b == nil { - return "BusinessFeatureUpgradedStories(nil)" - } - type Alias BusinessFeatureUpgradedStories - return fmt.Sprintf("BusinessFeatureUpgradedStories%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatureUpgradedStories) TypeID() uint32 { - return BusinessFeatureUpgradedStoriesTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatureUpgradedStories) TypeName() string { - return "businessFeatureUpgradedStories" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatureUpgradedStories) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatureUpgradedStories", - ID: BusinessFeatureUpgradedStoriesTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatureUpgradedStories) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureUpgradedStories#93fb53d2 as nil") - } - buf.PutID(BusinessFeatureUpgradedStoriesTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatureUpgradedStories) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureUpgradedStories#93fb53d2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatureUpgradedStories) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureUpgradedStories#93fb53d2 to nil") - } - if err := buf.ConsumeID(BusinessFeatureUpgradedStoriesTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatureUpgradedStories#93fb53d2: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatureUpgradedStories) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureUpgradedStories#93fb53d2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatureUpgradedStories) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatureUpgradedStories#93fb53d2 as nil") - } - buf.ObjStart() - buf.PutID("businessFeatureUpgradedStories") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatureUpgradedStories) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatureUpgradedStories#93fb53d2 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatureUpgradedStories"); err != nil { - return fmt.Errorf("unable to decode businessFeatureUpgradedStories#93fb53d2: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// BusinessFeatureClassName is schema name of BusinessFeatureClass. -const BusinessFeatureClassName = "BusinessFeature" - -// BusinessFeatureClass represents BusinessFeature generic type. -// -// Example: -// -// g, err := tdapi.DecodeBusinessFeature(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.BusinessFeatureLocation: // businessFeatureLocation#c090027c -// case *tdapi.BusinessFeatureOpeningHours: // businessFeatureOpeningHours#1b7b22ed -// case *tdapi.BusinessFeatureQuickReplies: // businessFeatureQuickReplies#9c380a82 -// case *tdapi.BusinessFeatureGreetingMessage: // businessFeatureGreetingMessage#6aa87474 -// case *tdapi.BusinessFeatureAwayMessage: // businessFeatureAwayMessage#40f9e8dd -// case *tdapi.BusinessFeatureAccountLinks: // businessFeatureAccountLinks#6ffa970e -// case *tdapi.BusinessFeatureStartPage: // businessFeatureStartPage#17edf7e1 -// case *tdapi.BusinessFeatureBots: // businessFeatureBots#106575e5 -// case *tdapi.BusinessFeatureEmojiStatus: // businessFeatureEmojiStatus#cd8ec0e5 -// case *tdapi.BusinessFeatureChatFolderTags: // businessFeatureChatFolderTags#df95092a -// case *tdapi.BusinessFeatureUpgradedStories: // businessFeatureUpgradedStories#93fb53d2 -// default: panic(v) -// } -type BusinessFeatureClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() BusinessFeatureClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeBusinessFeature implements binary de-serialization for BusinessFeatureClass. -func DecodeBusinessFeature(buf *bin.Buffer) (BusinessFeatureClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case BusinessFeatureLocationTypeID: - // Decoding businessFeatureLocation#c090027c. - v := BusinessFeatureLocation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case BusinessFeatureOpeningHoursTypeID: - // Decoding businessFeatureOpeningHours#1b7b22ed. - v := BusinessFeatureOpeningHours{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case BusinessFeatureQuickRepliesTypeID: - // Decoding businessFeatureQuickReplies#9c380a82. - v := BusinessFeatureQuickReplies{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case BusinessFeatureGreetingMessageTypeID: - // Decoding businessFeatureGreetingMessage#6aa87474. - v := BusinessFeatureGreetingMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case BusinessFeatureAwayMessageTypeID: - // Decoding businessFeatureAwayMessage#40f9e8dd. - v := BusinessFeatureAwayMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case BusinessFeatureAccountLinksTypeID: - // Decoding businessFeatureAccountLinks#6ffa970e. - v := BusinessFeatureAccountLinks{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case BusinessFeatureStartPageTypeID: - // Decoding businessFeatureStartPage#17edf7e1. - v := BusinessFeatureStartPage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case BusinessFeatureBotsTypeID: - // Decoding businessFeatureBots#106575e5. - v := BusinessFeatureBots{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case BusinessFeatureEmojiStatusTypeID: - // Decoding businessFeatureEmojiStatus#cd8ec0e5. - v := BusinessFeatureEmojiStatus{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case BusinessFeatureChatFolderTagsTypeID: - // Decoding businessFeatureChatFolderTags#df95092a. - v := BusinessFeatureChatFolderTags{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case BusinessFeatureUpgradedStoriesTypeID: - // Decoding businessFeatureUpgradedStories#93fb53d2. - v := BusinessFeatureUpgradedStories{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONBusinessFeature implements binary de-serialization for BusinessFeatureClass. -func DecodeTDLibJSONBusinessFeature(buf tdjson.Decoder) (BusinessFeatureClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "businessFeatureLocation": - // Decoding businessFeatureLocation#c090027c. - v := BusinessFeatureLocation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case "businessFeatureOpeningHours": - // Decoding businessFeatureOpeningHours#1b7b22ed. - v := BusinessFeatureOpeningHours{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case "businessFeatureQuickReplies": - // Decoding businessFeatureQuickReplies#9c380a82. - v := BusinessFeatureQuickReplies{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case "businessFeatureGreetingMessage": - // Decoding businessFeatureGreetingMessage#6aa87474. - v := BusinessFeatureGreetingMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case "businessFeatureAwayMessage": - // Decoding businessFeatureAwayMessage#40f9e8dd. - v := BusinessFeatureAwayMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case "businessFeatureAccountLinks": - // Decoding businessFeatureAccountLinks#6ffa970e. - v := BusinessFeatureAccountLinks{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case "businessFeatureStartPage": - // Decoding businessFeatureStartPage#17edf7e1. - v := BusinessFeatureStartPage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case "businessFeatureBots": - // Decoding businessFeatureBots#106575e5. - v := BusinessFeatureBots{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case "businessFeatureEmojiStatus": - // Decoding businessFeatureEmojiStatus#cd8ec0e5. - v := BusinessFeatureEmojiStatus{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case "businessFeatureChatFolderTags": - // Decoding businessFeatureChatFolderTags#df95092a. - v := BusinessFeatureChatFolderTags{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - case "businessFeatureUpgradedStories": - // Decoding businessFeatureUpgradedStories#93fb53d2. - v := BusinessFeatureUpgradedStories{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode BusinessFeatureClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// BusinessFeature boxes the BusinessFeatureClass providing a helper. -type BusinessFeatureBox struct { - BusinessFeature BusinessFeatureClass -} - -// Decode implements bin.Decoder for BusinessFeatureBox. -func (b *BusinessFeatureBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode BusinessFeatureBox to nil") - } - v, err := DecodeBusinessFeature(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BusinessFeature = v - return nil -} - -// Encode implements bin.Encode for BusinessFeatureBox. -func (b *BusinessFeatureBox) Encode(buf *bin.Buffer) error { - if b == nil || b.BusinessFeature == nil { - return fmt.Errorf("unable to encode BusinessFeatureClass as nil") - } - return b.BusinessFeature.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for BusinessFeatureBox. -func (b *BusinessFeatureBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode BusinessFeatureBox to nil") - } - v, err := DecodeTDLibJSONBusinessFeature(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.BusinessFeature = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for BusinessFeatureBox. -func (b *BusinessFeatureBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.BusinessFeature == nil { - return fmt.Errorf("unable to encode BusinessFeatureClass as nil") - } - return b.BusinessFeature.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_business_feature_promotion_animation_gen.go b/tdapi/tl_business_feature_promotion_animation_gen.go deleted file mode 100644 index 30948c554..000000000 --- a/tdapi/tl_business_feature_promotion_animation_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessFeaturePromotionAnimation represents TL type `businessFeaturePromotionAnimation#7a05680a`. -type BusinessFeaturePromotionAnimation struct { - // Business feature - Feature BusinessFeatureClass - // Promotion animation for the feature - Animation Animation -} - -// BusinessFeaturePromotionAnimationTypeID is TL type id of BusinessFeaturePromotionAnimation. -const BusinessFeaturePromotionAnimationTypeID = 0x7a05680a - -// Ensuring interfaces in compile-time for BusinessFeaturePromotionAnimation. -var ( - _ bin.Encoder = &BusinessFeaturePromotionAnimation{} - _ bin.Decoder = &BusinessFeaturePromotionAnimation{} - _ bin.BareEncoder = &BusinessFeaturePromotionAnimation{} - _ bin.BareDecoder = &BusinessFeaturePromotionAnimation{} -) - -func (b *BusinessFeaturePromotionAnimation) Zero() bool { - if b == nil { - return true - } - if !(b.Feature == nil) { - return false - } - if !(b.Animation.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeaturePromotionAnimation) String() string { - if b == nil { - return "BusinessFeaturePromotionAnimation(nil)" - } - type Alias BusinessFeaturePromotionAnimation - return fmt.Sprintf("BusinessFeaturePromotionAnimation%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeaturePromotionAnimation) TypeID() uint32 { - return BusinessFeaturePromotionAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeaturePromotionAnimation) TypeName() string { - return "businessFeaturePromotionAnimation" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeaturePromotionAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeaturePromotionAnimation", - ID: BusinessFeaturePromotionAnimationTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Feature", - SchemaName: "feature", - }, - { - Name: "Animation", - SchemaName: "animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeaturePromotionAnimation) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeaturePromotionAnimation#7a05680a as nil") - } - buf.PutID(BusinessFeaturePromotionAnimationTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeaturePromotionAnimation) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeaturePromotionAnimation#7a05680a as nil") - } - if b.Feature == nil { - return fmt.Errorf("unable to encode businessFeaturePromotionAnimation#7a05680a: field feature is nil") - } - if err := b.Feature.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessFeaturePromotionAnimation#7a05680a: field feature: %w", err) - } - if err := b.Animation.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessFeaturePromotionAnimation#7a05680a: field animation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeaturePromotionAnimation) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeaturePromotionAnimation#7a05680a to nil") - } - if err := buf.ConsumeID(BusinessFeaturePromotionAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeaturePromotionAnimation#7a05680a: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeaturePromotionAnimation) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeaturePromotionAnimation#7a05680a to nil") - } - { - value, err := DecodeBusinessFeature(buf) - if err != nil { - return fmt.Errorf("unable to decode businessFeaturePromotionAnimation#7a05680a: field feature: %w", err) - } - b.Feature = value - } - { - if err := b.Animation.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessFeaturePromotionAnimation#7a05680a: field animation: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeaturePromotionAnimation) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeaturePromotionAnimation#7a05680a as nil") - } - buf.ObjStart() - buf.PutID("businessFeaturePromotionAnimation") - buf.Comma() - buf.FieldStart("feature") - if b.Feature == nil { - return fmt.Errorf("unable to encode businessFeaturePromotionAnimation#7a05680a: field feature is nil") - } - if err := b.Feature.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessFeaturePromotionAnimation#7a05680a: field feature: %w", err) - } - buf.Comma() - buf.FieldStart("animation") - if err := b.Animation.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessFeaturePromotionAnimation#7a05680a: field animation: %w", err) - } - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeaturePromotionAnimation) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeaturePromotionAnimation#7a05680a to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeaturePromotionAnimation"); err != nil { - return fmt.Errorf("unable to decode businessFeaturePromotionAnimation#7a05680a: %w", err) - } - case "feature": - value, err := DecodeTDLibJSONBusinessFeature(buf) - if err != nil { - return fmt.Errorf("unable to decode businessFeaturePromotionAnimation#7a05680a: field feature: %w", err) - } - b.Feature = value - case "animation": - if err := b.Animation.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessFeaturePromotionAnimation#7a05680a: field animation: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetFeature returns value of Feature field. -func (b *BusinessFeaturePromotionAnimation) GetFeature() (value BusinessFeatureClass) { - if b == nil { - return - } - return b.Feature -} - -// GetAnimation returns value of Animation field. -func (b *BusinessFeaturePromotionAnimation) GetAnimation() (value Animation) { - if b == nil { - return - } - return b.Animation -} diff --git a/tdapi/tl_business_features_gen.go b/tdapi/tl_business_features_gen.go deleted file mode 100644 index 9c8483b3c..000000000 --- a/tdapi/tl_business_features_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessFeatures represents TL type `businessFeatures#e1593e48`. -type BusinessFeatures struct { - // The list of available business features - Features []BusinessFeatureClass -} - -// BusinessFeaturesTypeID is TL type id of BusinessFeatures. -const BusinessFeaturesTypeID = 0xe1593e48 - -// Ensuring interfaces in compile-time for BusinessFeatures. -var ( - _ bin.Encoder = &BusinessFeatures{} - _ bin.Decoder = &BusinessFeatures{} - _ bin.BareEncoder = &BusinessFeatures{} - _ bin.BareDecoder = &BusinessFeatures{} -) - -func (b *BusinessFeatures) Zero() bool { - if b == nil { - return true - } - if !(b.Features == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessFeatures) String() string { - if b == nil { - return "BusinessFeatures(nil)" - } - type Alias BusinessFeatures - return fmt.Sprintf("BusinessFeatures%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessFeatures) TypeID() uint32 { - return BusinessFeaturesTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessFeatures) TypeName() string { - return "businessFeatures" -} - -// TypeInfo returns info about TL type. -func (b *BusinessFeatures) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessFeatures", - ID: BusinessFeaturesTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Features", - SchemaName: "features", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessFeatures) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatures#e1593e48 as nil") - } - buf.PutID(BusinessFeaturesTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessFeatures) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatures#e1593e48 as nil") - } - buf.PutInt(len(b.Features)) - for idx, v := range b.Features { - if v == nil { - return fmt.Errorf("unable to encode businessFeatures#e1593e48: field features element with index %d is nil", idx) - } - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare businessFeatures#e1593e48: field features element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessFeatures) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatures#e1593e48 to nil") - } - if err := buf.ConsumeID(BusinessFeaturesTypeID); err != nil { - return fmt.Errorf("unable to decode businessFeatures#e1593e48: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessFeatures) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatures#e1593e48 to nil") - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode businessFeatures#e1593e48: field features: %w", err) - } - - if headerLen > 0 { - b.Features = make([]BusinessFeatureClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeBusinessFeature(buf) - if err != nil { - return fmt.Errorf("unable to decode businessFeatures#e1593e48: field features: %w", err) - } - b.Features = append(b.Features, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessFeatures) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessFeatures#e1593e48 as nil") - } - buf.ObjStart() - buf.PutID("businessFeatures") - buf.Comma() - buf.FieldStart("features") - buf.ArrStart() - for idx, v := range b.Features { - if v == nil { - return fmt.Errorf("unable to encode businessFeatures#e1593e48: field features element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessFeatures#e1593e48: field features element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessFeatures) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessFeatures#e1593e48 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessFeatures"); err != nil { - return fmt.Errorf("unable to decode businessFeatures#e1593e48: %w", err) - } - case "features": - if err := buf.Arr(func(buf tdjson.Decoder) error { - value, err := DecodeTDLibJSONBusinessFeature(buf) - if err != nil { - return fmt.Errorf("unable to decode businessFeatures#e1593e48: field features: %w", err) - } - b.Features = append(b.Features, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode businessFeatures#e1593e48: field features: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetFeatures returns value of Features field. -func (b *BusinessFeatures) GetFeatures() (value []BusinessFeatureClass) { - if b == nil { - return - } - return b.Features -} diff --git a/tdapi/tl_business_greeting_message_settings_gen.go b/tdapi/tl_business_greeting_message_settings_gen.go deleted file mode 100644 index 5dd79860b..000000000 --- a/tdapi/tl_business_greeting_message_settings_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessGreetingMessageSettings represents TL type `businessGreetingMessageSettings#64ae3e12`. -type BusinessGreetingMessageSettings struct { - // Unique quick reply shortcut identifier for the greeting messages - ShortcutID int32 - // Chosen recipients of the greeting messages - Recipients BusinessRecipients - // The number of days after which a chat will be considered as inactive; currently, must - // be on of 7, 14, 21, or 28 - InactivityDays int32 -} - -// BusinessGreetingMessageSettingsTypeID is TL type id of BusinessGreetingMessageSettings. -const BusinessGreetingMessageSettingsTypeID = 0x64ae3e12 - -// Ensuring interfaces in compile-time for BusinessGreetingMessageSettings. -var ( - _ bin.Encoder = &BusinessGreetingMessageSettings{} - _ bin.Decoder = &BusinessGreetingMessageSettings{} - _ bin.BareEncoder = &BusinessGreetingMessageSettings{} - _ bin.BareDecoder = &BusinessGreetingMessageSettings{} -) - -func (b *BusinessGreetingMessageSettings) Zero() bool { - if b == nil { - return true - } - if !(b.ShortcutID == 0) { - return false - } - if !(b.Recipients.Zero()) { - return false - } - if !(b.InactivityDays == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessGreetingMessageSettings) String() string { - if b == nil { - return "BusinessGreetingMessageSettings(nil)" - } - type Alias BusinessGreetingMessageSettings - return fmt.Sprintf("BusinessGreetingMessageSettings%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessGreetingMessageSettings) TypeID() uint32 { - return BusinessGreetingMessageSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessGreetingMessageSettings) TypeName() string { - return "businessGreetingMessageSettings" -} - -// TypeInfo returns info about TL type. -func (b *BusinessGreetingMessageSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessGreetingMessageSettings", - ID: BusinessGreetingMessageSettingsTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutID", - SchemaName: "shortcut_id", - }, - { - Name: "Recipients", - SchemaName: "recipients", - }, - { - Name: "InactivityDays", - SchemaName: "inactivity_days", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessGreetingMessageSettings) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessGreetingMessageSettings#64ae3e12 as nil") - } - buf.PutID(BusinessGreetingMessageSettingsTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessGreetingMessageSettings) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessGreetingMessageSettings#64ae3e12 as nil") - } - buf.PutInt32(b.ShortcutID) - if err := b.Recipients.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessGreetingMessageSettings#64ae3e12: field recipients: %w", err) - } - buf.PutInt32(b.InactivityDays) - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessGreetingMessageSettings) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessGreetingMessageSettings#64ae3e12 to nil") - } - if err := buf.ConsumeID(BusinessGreetingMessageSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessGreetingMessageSettings) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessGreetingMessageSettings#64ae3e12 to nil") - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field shortcut_id: %w", err) - } - b.ShortcutID = value - } - { - if err := b.Recipients.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field recipients: %w", err) - } - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field inactivity_days: %w", err) - } - b.InactivityDays = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessGreetingMessageSettings) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessGreetingMessageSettings#64ae3e12 as nil") - } - buf.ObjStart() - buf.PutID("businessGreetingMessageSettings") - buf.Comma() - buf.FieldStart("shortcut_id") - buf.PutInt32(b.ShortcutID) - buf.Comma() - buf.FieldStart("recipients") - if err := b.Recipients.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessGreetingMessageSettings#64ae3e12: field recipients: %w", err) - } - buf.Comma() - buf.FieldStart("inactivity_days") - buf.PutInt32(b.InactivityDays) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessGreetingMessageSettings) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessGreetingMessageSettings#64ae3e12 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessGreetingMessageSettings"); err != nil { - return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: %w", err) - } - case "shortcut_id": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field shortcut_id: %w", err) - } - b.ShortcutID = value - case "recipients": - if err := b.Recipients.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field recipients: %w", err) - } - case "inactivity_days": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessGreetingMessageSettings#64ae3e12: field inactivity_days: %w", err) - } - b.InactivityDays = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetShortcutID returns value of ShortcutID field. -func (b *BusinessGreetingMessageSettings) GetShortcutID() (value int32) { - if b == nil { - return - } - return b.ShortcutID -} - -// GetRecipients returns value of Recipients field. -func (b *BusinessGreetingMessageSettings) GetRecipients() (value BusinessRecipients) { - if b == nil { - return - } - return b.Recipients -} - -// GetInactivityDays returns value of InactivityDays field. -func (b *BusinessGreetingMessageSettings) GetInactivityDays() (value int32) { - if b == nil { - return - } - return b.InactivityDays -} diff --git a/tdapi/tl_business_info_gen.go b/tdapi/tl_business_info_gen.go deleted file mode 100644 index dfbeb2fd1..000000000 --- a/tdapi/tl_business_info_gen.go +++ /dev/null @@ -1,437 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessInfo represents TL type `businessInfo#5520498e`. -type BusinessInfo struct { - // Location of the business; may be null if none - Location BusinessLocation - // Opening hours of the business; may be null if none. The hours are guaranteed to be - // valid and has already been split by week days - OpeningHours BusinessOpeningHours - // Opening hours of the business in the local time; may be null if none. The hours are - // guaranteed to be valid and has already been split by week days. - LocalOpeningHours BusinessOpeningHours - // Time left before the business will open the next time, in seconds; 0 if unknown. An - // updateUserFullInfo update is not triggered when value of this field changes - NextOpenIn int32 - // Time left before the business will close the next time, in seconds; 0 if unknown. An - // updateUserFullInfo update is not triggered when value of this field changes - NextCloseIn int32 - // The greeting message; may be null if none or the Business account is not of the - // current user - GreetingMessageSettings BusinessGreetingMessageSettings - // The away message; may be null if none or the Business account is not of the current - // user - AwayMessageSettings BusinessAwayMessageSettings - // Information about start page of the account; may be null if none - StartPage BusinessStartPage -} - -// BusinessInfoTypeID is TL type id of BusinessInfo. -const BusinessInfoTypeID = 0x5520498e - -// Ensuring interfaces in compile-time for BusinessInfo. -var ( - _ bin.Encoder = &BusinessInfo{} - _ bin.Decoder = &BusinessInfo{} - _ bin.BareEncoder = &BusinessInfo{} - _ bin.BareDecoder = &BusinessInfo{} -) - -func (b *BusinessInfo) Zero() bool { - if b == nil { - return true - } - if !(b.Location.Zero()) { - return false - } - if !(b.OpeningHours.Zero()) { - return false - } - if !(b.LocalOpeningHours.Zero()) { - return false - } - if !(b.NextOpenIn == 0) { - return false - } - if !(b.NextCloseIn == 0) { - return false - } - if !(b.GreetingMessageSettings.Zero()) { - return false - } - if !(b.AwayMessageSettings.Zero()) { - return false - } - if !(b.StartPage.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessInfo) String() string { - if b == nil { - return "BusinessInfo(nil)" - } - type Alias BusinessInfo - return fmt.Sprintf("BusinessInfo%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessInfo) TypeID() uint32 { - return BusinessInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessInfo) TypeName() string { - return "businessInfo" -} - -// TypeInfo returns info about TL type. -func (b *BusinessInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessInfo", - ID: BusinessInfoTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "OpeningHours", - SchemaName: "opening_hours", - }, - { - Name: "LocalOpeningHours", - SchemaName: "local_opening_hours", - }, - { - Name: "NextOpenIn", - SchemaName: "next_open_in", - }, - { - Name: "NextCloseIn", - SchemaName: "next_close_in", - }, - { - Name: "GreetingMessageSettings", - SchemaName: "greeting_message_settings", - }, - { - Name: "AwayMessageSettings", - SchemaName: "away_message_settings", - }, - { - Name: "StartPage", - SchemaName: "start_page", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessInfo) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessInfo#5520498e as nil") - } - buf.PutID(BusinessInfoTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessInfo) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessInfo#5520498e as nil") - } - if err := b.Location.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field location: %w", err) - } - if err := b.OpeningHours.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field opening_hours: %w", err) - } - if err := b.LocalOpeningHours.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field local_opening_hours: %w", err) - } - buf.PutInt32(b.NextOpenIn) - buf.PutInt32(b.NextCloseIn) - if err := b.GreetingMessageSettings.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field greeting_message_settings: %w", err) - } - if err := b.AwayMessageSettings.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field away_message_settings: %w", err) - } - if err := b.StartPage.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field start_page: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessInfo) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessInfo#5520498e to nil") - } - if err := buf.ConsumeID(BusinessInfoTypeID); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessInfo) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessInfo#5520498e to nil") - } - { - if err := b.Location.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field location: %w", err) - } - } - { - if err := b.OpeningHours.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field opening_hours: %w", err) - } - } - { - if err := b.LocalOpeningHours.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field local_opening_hours: %w", err) - } - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field next_open_in: %w", err) - } - b.NextOpenIn = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field next_close_in: %w", err) - } - b.NextCloseIn = value - } - { - if err := b.GreetingMessageSettings.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field greeting_message_settings: %w", err) - } - } - { - if err := b.AwayMessageSettings.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field away_message_settings: %w", err) - } - } - { - if err := b.StartPage.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field start_page: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessInfo) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessInfo#5520498e as nil") - } - buf.ObjStart() - buf.PutID("businessInfo") - buf.Comma() - buf.FieldStart("location") - if err := b.Location.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field location: %w", err) - } - buf.Comma() - buf.FieldStart("opening_hours") - if err := b.OpeningHours.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field opening_hours: %w", err) - } - buf.Comma() - buf.FieldStart("local_opening_hours") - if err := b.LocalOpeningHours.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field local_opening_hours: %w", err) - } - buf.Comma() - buf.FieldStart("next_open_in") - buf.PutInt32(b.NextOpenIn) - buf.Comma() - buf.FieldStart("next_close_in") - buf.PutInt32(b.NextCloseIn) - buf.Comma() - buf.FieldStart("greeting_message_settings") - if err := b.GreetingMessageSettings.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field greeting_message_settings: %w", err) - } - buf.Comma() - buf.FieldStart("away_message_settings") - if err := b.AwayMessageSettings.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field away_message_settings: %w", err) - } - buf.Comma() - buf.FieldStart("start_page") - if err := b.StartPage.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessInfo#5520498e: field start_page: %w", err) - } - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessInfo) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessInfo#5520498e to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessInfo"); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: %w", err) - } - case "location": - if err := b.Location.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field location: %w", err) - } - case "opening_hours": - if err := b.OpeningHours.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field opening_hours: %w", err) - } - case "local_opening_hours": - if err := b.LocalOpeningHours.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field local_opening_hours: %w", err) - } - case "next_open_in": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field next_open_in: %w", err) - } - b.NextOpenIn = value - case "next_close_in": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field next_close_in: %w", err) - } - b.NextCloseIn = value - case "greeting_message_settings": - if err := b.GreetingMessageSettings.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field greeting_message_settings: %w", err) - } - case "away_message_settings": - if err := b.AwayMessageSettings.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field away_message_settings: %w", err) - } - case "start_page": - if err := b.StartPage.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessInfo#5520498e: field start_page: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (b *BusinessInfo) GetLocation() (value BusinessLocation) { - if b == nil { - return - } - return b.Location -} - -// GetOpeningHours returns value of OpeningHours field. -func (b *BusinessInfo) GetOpeningHours() (value BusinessOpeningHours) { - if b == nil { - return - } - return b.OpeningHours -} - -// GetLocalOpeningHours returns value of LocalOpeningHours field. -func (b *BusinessInfo) GetLocalOpeningHours() (value BusinessOpeningHours) { - if b == nil { - return - } - return b.LocalOpeningHours -} - -// GetNextOpenIn returns value of NextOpenIn field. -func (b *BusinessInfo) GetNextOpenIn() (value int32) { - if b == nil { - return - } - return b.NextOpenIn -} - -// GetNextCloseIn returns value of NextCloseIn field. -func (b *BusinessInfo) GetNextCloseIn() (value int32) { - if b == nil { - return - } - return b.NextCloseIn -} - -// GetGreetingMessageSettings returns value of GreetingMessageSettings field. -func (b *BusinessInfo) GetGreetingMessageSettings() (value BusinessGreetingMessageSettings) { - if b == nil { - return - } - return b.GreetingMessageSettings -} - -// GetAwayMessageSettings returns value of AwayMessageSettings field. -func (b *BusinessInfo) GetAwayMessageSettings() (value BusinessAwayMessageSettings) { - if b == nil { - return - } - return b.AwayMessageSettings -} - -// GetStartPage returns value of StartPage field. -func (b *BusinessInfo) GetStartPage() (value BusinessStartPage) { - if b == nil { - return - } - return b.StartPage -} diff --git a/tdapi/tl_business_location_gen.go b/tdapi/tl_business_location_gen.go deleted file mode 100644 index 0807773e3..000000000 --- a/tdapi/tl_business_location_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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#bf54af5a`. -type BusinessLocation struct { - // The location; may be null if not specified - Location Location - // Location address; 1-96 characters - Address string -} - -// BusinessLocationTypeID is TL type id of BusinessLocation. -const BusinessLocationTypeID = 0xbf54af5a - -// 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.Location.Zero()) { - 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)) -} - -// 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: "Location", - SchemaName: "location", - }, - { - Name: "Address", - SchemaName: "address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessLocation) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessLocation#bf54af5a 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#bf54af5a as nil") - } - if err := b.Location.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessLocation#bf54af5a: field location: %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#bf54af5a to nil") - } - if err := buf.ConsumeID(BusinessLocationTypeID); err != nil { - return fmt.Errorf("unable to decode businessLocation#bf54af5a: %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#bf54af5a to nil") - } - { - if err := b.Location.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessLocation#bf54af5a: field location: %w", err) - } - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessLocation#bf54af5a: field address: %w", err) - } - b.Address = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessLocation) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessLocation#bf54af5a as nil") - } - buf.ObjStart() - buf.PutID("businessLocation") - buf.Comma() - buf.FieldStart("location") - if err := b.Location.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessLocation#bf54af5a: field location: %w", err) - } - buf.Comma() - buf.FieldStart("address") - buf.PutString(b.Address) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessLocation) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessLocation#bf54af5a to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessLocation"); err != nil { - return fmt.Errorf("unable to decode businessLocation#bf54af5a: %w", err) - } - case "location": - if err := b.Location.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessLocation#bf54af5a: field location: %w", err) - } - case "address": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessLocation#bf54af5a: field address: %w", err) - } - b.Address = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (b *BusinessLocation) GetLocation() (value Location) { - if b == nil { - return - } - return b.Location -} - -// GetAddress returns value of Address field. -func (b *BusinessLocation) GetAddress() (value string) { - if b == nil { - return - } - return b.Address -} diff --git a/tdapi/tl_business_message_gen.go b/tdapi/tl_business_message_gen.go deleted file mode 100644 index ed2510bf0..000000000 --- a/tdapi/tl_business_message_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessMessage represents TL type `businessMessage#fa604646`. -type BusinessMessage struct { - // The message - Message Message - // Message that is replied by the message in the same chat; may be null if none - ReplyToMessage Message -} - -// BusinessMessageTypeID is TL type id of BusinessMessage. -const BusinessMessageTypeID = 0xfa604646 - -// Ensuring interfaces in compile-time for BusinessMessage. -var ( - _ bin.Encoder = &BusinessMessage{} - _ bin.Decoder = &BusinessMessage{} - _ bin.BareEncoder = &BusinessMessage{} - _ bin.BareDecoder = &BusinessMessage{} -) - -func (b *BusinessMessage) Zero() bool { - if b == nil { - return true - } - if !(b.Message.Zero()) { - return false - } - if !(b.ReplyToMessage.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessMessage) String() string { - if b == nil { - return "BusinessMessage(nil)" - } - type Alias BusinessMessage - return fmt.Sprintf("BusinessMessage%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessMessage) TypeID() uint32 { - return BusinessMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessMessage) TypeName() string { - return "businessMessage" -} - -// TypeInfo returns info about TL type. -func (b *BusinessMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessMessage", - ID: BusinessMessageTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "ReplyToMessage", - SchemaName: "reply_to_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessMessage) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessMessage#fa604646 as nil") - } - buf.PutID(BusinessMessageTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessMessage) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessMessage#fa604646 as nil") - } - if err := b.Message.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessMessage#fa604646: field message: %w", err) - } - if err := b.ReplyToMessage.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessMessage#fa604646: field reply_to_message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessMessage) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessMessage#fa604646 to nil") - } - if err := buf.ConsumeID(BusinessMessageTypeID); err != nil { - return fmt.Errorf("unable to decode businessMessage#fa604646: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessMessage) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessMessage#fa604646 to nil") - } - { - if err := b.Message.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessMessage#fa604646: field message: %w", err) - } - } - { - if err := b.ReplyToMessage.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessMessage#fa604646: field reply_to_message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessMessage) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessMessage#fa604646 as nil") - } - buf.ObjStart() - buf.PutID("businessMessage") - buf.Comma() - buf.FieldStart("message") - if err := b.Message.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessMessage#fa604646: field message: %w", err) - } - buf.Comma() - buf.FieldStart("reply_to_message") - if err := b.ReplyToMessage.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessMessage#fa604646: field reply_to_message: %w", err) - } - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessMessage) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessMessage#fa604646 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessMessage"); err != nil { - return fmt.Errorf("unable to decode businessMessage#fa604646: %w", err) - } - case "message": - if err := b.Message.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessMessage#fa604646: field message: %w", err) - } - case "reply_to_message": - if err := b.ReplyToMessage.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessMessage#fa604646: field reply_to_message: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (b *BusinessMessage) GetMessage() (value Message) { - if b == nil { - return - } - return b.Message -} - -// GetReplyToMessage returns value of ReplyToMessage field. -func (b *BusinessMessage) GetReplyToMessage() (value Message) { - if b == nil { - return - } - return b.ReplyToMessage -} diff --git a/tdapi/tl_business_messages_gen.go b/tdapi/tl_business_messages_gen.go deleted file mode 100644 index b9767efb6..000000000 --- a/tdapi/tl_business_messages_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessMessages represents TL type `businessMessages#355963fa`. -type BusinessMessages struct { - // List of business messages - Messages []BusinessMessage -} - -// BusinessMessagesTypeID is TL type id of BusinessMessages. -const BusinessMessagesTypeID = 0x355963fa - -// Ensuring interfaces in compile-time for BusinessMessages. -var ( - _ bin.Encoder = &BusinessMessages{} - _ bin.Decoder = &BusinessMessages{} - _ bin.BareEncoder = &BusinessMessages{} - _ bin.BareDecoder = &BusinessMessages{} -) - -func (b *BusinessMessages) Zero() bool { - if b == nil { - return true - } - if !(b.Messages == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessMessages) String() string { - if b == nil { - return "BusinessMessages(nil)" - } - type Alias BusinessMessages - return fmt.Sprintf("BusinessMessages%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessMessages) TypeID() uint32 { - return BusinessMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessMessages) TypeName() string { - return "businessMessages" -} - -// TypeInfo returns info about TL type. -func (b *BusinessMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessMessages", - ID: BusinessMessagesTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Messages", - SchemaName: "messages", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessMessages) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessMessages#355963fa as nil") - } - buf.PutID(BusinessMessagesTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessMessages) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessMessages#355963fa as nil") - } - buf.PutInt(len(b.Messages)) - for idx, v := range b.Messages { - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare businessMessages#355963fa: field messages element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessMessages) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessMessages#355963fa to nil") - } - if err := buf.ConsumeID(BusinessMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode businessMessages#355963fa: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessMessages) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessMessages#355963fa to nil") - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode businessMessages#355963fa: field messages: %w", err) - } - - if headerLen > 0 { - b.Messages = make([]BusinessMessage, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BusinessMessage - if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare businessMessages#355963fa: field messages: %w", err) - } - b.Messages = append(b.Messages, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessMessages) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessMessages#355963fa as nil") - } - buf.ObjStart() - buf.PutID("businessMessages") - buf.Comma() - buf.FieldStart("messages") - buf.ArrStart() - for idx, v := range b.Messages { - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessMessages#355963fa: field messages element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessMessages) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessMessages#355963fa to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessMessages"); err != nil { - return fmt.Errorf("unable to decode businessMessages#355963fa: %w", err) - } - case "messages": - if err := buf.Arr(func(buf tdjson.Decoder) error { - var value BusinessMessage - if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessMessages#355963fa: field messages: %w", err) - } - b.Messages = append(b.Messages, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode businessMessages#355963fa: field messages: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetMessages returns value of Messages field. -func (b *BusinessMessages) GetMessages() (value []BusinessMessage) { - if b == nil { - return - } - return b.Messages -} diff --git a/tdapi/tl_business_opening_hours_gen.go b/tdapi/tl_business_opening_hours_gen.go deleted file mode 100644 index 807adf984..000000000 --- a/tdapi/tl_business_opening_hours_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessOpeningHours represents TL type `businessOpeningHours#a623e64a`. -type BusinessOpeningHours struct { - // Unique time zone identifier - TimeZoneID string - // Intervals of the time when the business is open - OpeningHours []BusinessOpeningHoursInterval -} - -// BusinessOpeningHoursTypeID is TL type id of BusinessOpeningHours. -const BusinessOpeningHoursTypeID = 0xa623e64a - -// Ensuring interfaces in compile-time for BusinessOpeningHours. -var ( - _ bin.Encoder = &BusinessOpeningHours{} - _ bin.Decoder = &BusinessOpeningHours{} - _ bin.BareEncoder = &BusinessOpeningHours{} - _ bin.BareDecoder = &BusinessOpeningHours{} -) - -func (b *BusinessOpeningHours) Zero() bool { - if b == nil { - return true - } - if !(b.TimeZoneID == "") { - return false - } - if !(b.OpeningHours == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessOpeningHours) String() string { - if b == nil { - return "BusinessOpeningHours(nil)" - } - type Alias BusinessOpeningHours - return fmt.Sprintf("BusinessOpeningHours%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessOpeningHours) TypeID() uint32 { - return BusinessOpeningHoursTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessOpeningHours) TypeName() string { - return "businessOpeningHours" -} - -// TypeInfo returns info about TL type. -func (b *BusinessOpeningHours) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessOpeningHours", - ID: BusinessOpeningHoursTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TimeZoneID", - SchemaName: "time_zone_id", - }, - { - Name: "OpeningHours", - SchemaName: "opening_hours", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessOpeningHours) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessOpeningHours#a623e64a as nil") - } - buf.PutID(BusinessOpeningHoursTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessOpeningHours) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessOpeningHours#a623e64a as nil") - } - buf.PutString(b.TimeZoneID) - buf.PutInt(len(b.OpeningHours)) - for idx, v := range b.OpeningHours { - if err := v.EncodeBare(buf); err != nil { - return fmt.Errorf("unable to encode bare businessOpeningHours#a623e64a: field opening_hours element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessOpeningHours) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessOpeningHours#a623e64a to nil") - } - if err := buf.ConsumeID(BusinessOpeningHoursTypeID); err != nil { - return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessOpeningHours) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessOpeningHours#a623e64a to nil") - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: field time_zone_id: %w", err) - } - b.TimeZoneID = value - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: field opening_hours: %w", err) - } - - if headerLen > 0 { - b.OpeningHours = make([]BusinessOpeningHoursInterval, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BusinessOpeningHoursInterval - if err := value.DecodeBare(buf); err != nil { - return fmt.Errorf("unable to decode bare businessOpeningHours#a623e64a: field opening_hours: %w", err) - } - b.OpeningHours = append(b.OpeningHours, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessOpeningHours) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessOpeningHours#a623e64a as nil") - } - buf.ObjStart() - buf.PutID("businessOpeningHours") - buf.Comma() - buf.FieldStart("time_zone_id") - buf.PutString(b.TimeZoneID) - buf.Comma() - buf.FieldStart("opening_hours") - buf.ArrStart() - for idx, v := range b.OpeningHours { - if err := v.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessOpeningHours#a623e64a: field opening_hours element with index %d: %w", idx, err) - } - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessOpeningHours) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessOpeningHours#a623e64a to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessOpeningHours"); err != nil { - return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: %w", err) - } - case "time_zone_id": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: field time_zone_id: %w", err) - } - b.TimeZoneID = value - case "opening_hours": - if err := buf.Arr(func(buf tdjson.Decoder) error { - var value BusinessOpeningHoursInterval - if err := value.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: field opening_hours: %w", err) - } - b.OpeningHours = append(b.OpeningHours, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode businessOpeningHours#a623e64a: field opening_hours: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetTimeZoneID returns value of TimeZoneID field. -func (b *BusinessOpeningHours) GetTimeZoneID() (value string) { - if b == nil { - return - } - return b.TimeZoneID -} - -// GetOpeningHours returns value of OpeningHours field. -func (b *BusinessOpeningHours) GetOpeningHours() (value []BusinessOpeningHoursInterval) { - if b == nil { - return - } - return b.OpeningHours -} diff --git a/tdapi/tl_business_opening_hours_interval_gen.go b/tdapi/tl_business_opening_hours_interval_gen.go deleted file mode 100644 index 8170138a5..000000000 --- a/tdapi/tl_business_opening_hours_interval_gen.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessOpeningHoursInterval represents TL type `businessOpeningHoursInterval#bdf05654`. -type BusinessOpeningHoursInterval struct { - // The minute's sequence number in a week, starting on Monday, marking the start of the - // time interval during which the business is open; 0-7*24*60 - StartMinute int32 - // The minute's sequence number in a week, starting on Monday, marking the end of the - // time interval during which the business is open; 1-8*24*60 - EndMinute int32 -} - -// BusinessOpeningHoursIntervalTypeID is TL type id of BusinessOpeningHoursInterval. -const BusinessOpeningHoursIntervalTypeID = 0xbdf05654 - -// Ensuring interfaces in compile-time for BusinessOpeningHoursInterval. -var ( - _ bin.Encoder = &BusinessOpeningHoursInterval{} - _ bin.Decoder = &BusinessOpeningHoursInterval{} - _ bin.BareEncoder = &BusinessOpeningHoursInterval{} - _ bin.BareDecoder = &BusinessOpeningHoursInterval{} -) - -func (b *BusinessOpeningHoursInterval) 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 *BusinessOpeningHoursInterval) String() string { - if b == nil { - return "BusinessOpeningHoursInterval(nil)" - } - type Alias BusinessOpeningHoursInterval - return fmt.Sprintf("BusinessOpeningHoursInterval%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessOpeningHoursInterval) TypeID() uint32 { - return BusinessOpeningHoursIntervalTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessOpeningHoursInterval) TypeName() string { - return "businessOpeningHoursInterval" -} - -// TypeInfo returns info about TL type. -func (b *BusinessOpeningHoursInterval) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessOpeningHoursInterval", - ID: BusinessOpeningHoursIntervalTypeID, - } - 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 *BusinessOpeningHoursInterval) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessOpeningHoursInterval#bdf05654 as nil") - } - buf.PutID(BusinessOpeningHoursIntervalTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessOpeningHoursInterval) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessOpeningHoursInterval#bdf05654 as nil") - } - buf.PutInt32(b.StartMinute) - buf.PutInt32(b.EndMinute) - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessOpeningHoursInterval) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessOpeningHoursInterval#bdf05654 to nil") - } - if err := buf.ConsumeID(BusinessOpeningHoursIntervalTypeID); err != nil { - return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessOpeningHoursInterval) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessOpeningHoursInterval#bdf05654 to nil") - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: field start_minute: %w", err) - } - b.StartMinute = value - } - { - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: field end_minute: %w", err) - } - b.EndMinute = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessOpeningHoursInterval) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessOpeningHoursInterval#bdf05654 as nil") - } - buf.ObjStart() - buf.PutID("businessOpeningHoursInterval") - buf.Comma() - buf.FieldStart("start_minute") - buf.PutInt32(b.StartMinute) - buf.Comma() - buf.FieldStart("end_minute") - buf.PutInt32(b.EndMinute) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessOpeningHoursInterval) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessOpeningHoursInterval#bdf05654 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessOpeningHoursInterval"); err != nil { - return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: %w", err) - } - case "start_minute": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: field start_minute: %w", err) - } - b.StartMinute = value - case "end_minute": - value, err := buf.Int32() - if err != nil { - return fmt.Errorf("unable to decode businessOpeningHoursInterval#bdf05654: field end_minute: %w", err) - } - b.EndMinute = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetStartMinute returns value of StartMinute field. -func (b *BusinessOpeningHoursInterval) GetStartMinute() (value int32) { - if b == nil { - return - } - return b.StartMinute -} - -// GetEndMinute returns value of EndMinute field. -func (b *BusinessOpeningHoursInterval) GetEndMinute() (value int32) { - if b == nil { - return - } - return b.EndMinute -} diff --git a/tdapi/tl_business_recipients_gen.go b/tdapi/tl_business_recipients_gen.go deleted file mode 100644 index 9d5add3f9..000000000 --- a/tdapi/tl_business_recipients_gen.go +++ /dev/null @@ -1,446 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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#802011e2`. -type BusinessRecipients struct { - // Identifiers of selected private chats - ChatIDs []int64 - // Identifiers of private chats that are always excluded; for businessConnectedBot only - ExcludedChatIDs []int64 - // True, if all existing private chats are selected - SelectExistingChats bool - // True, if all new private chats are selected - SelectNewChats bool - // True, if all private chats with contacts are selected - SelectContacts bool - // True, if all private chats with non-contacts are selected - SelectNonContacts bool - // If true, then all private chats except the selected are chosen. Otherwise, only the - // selected chats are chosen - ExcludeSelected bool -} - -// BusinessRecipientsTypeID is TL type id of BusinessRecipients. -const BusinessRecipientsTypeID = 0x802011e2 - -// 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.ChatIDs == nil) { - return false - } - if !(b.ExcludedChatIDs == nil) { - return false - } - if !(b.SelectExistingChats == false) { - return false - } - if !(b.SelectNewChats == false) { - return false - } - if !(b.SelectContacts == false) { - return false - } - if !(b.SelectNonContacts == false) { - return false - } - if !(b.ExcludeSelected == false) { - 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)) -} - -// 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: "ChatIDs", - SchemaName: "chat_ids", - }, - { - Name: "ExcludedChatIDs", - SchemaName: "excluded_chat_ids", - }, - { - Name: "SelectExistingChats", - SchemaName: "select_existing_chats", - }, - { - Name: "SelectNewChats", - SchemaName: "select_new_chats", - }, - { - Name: "SelectContacts", - SchemaName: "select_contacts", - }, - { - Name: "SelectNonContacts", - SchemaName: "select_non_contacts", - }, - { - Name: "ExcludeSelected", - SchemaName: "exclude_selected", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessRecipients) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessRecipients#802011e2 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#802011e2 as nil") - } - buf.PutInt(len(b.ChatIDs)) - for _, v := range b.ChatIDs { - buf.PutInt53(v) - } - buf.PutInt(len(b.ExcludedChatIDs)) - for _, v := range b.ExcludedChatIDs { - buf.PutInt53(v) - } - buf.PutBool(b.SelectExistingChats) - buf.PutBool(b.SelectNewChats) - buf.PutBool(b.SelectContacts) - buf.PutBool(b.SelectNonContacts) - buf.PutBool(b.ExcludeSelected) - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessRecipients) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessRecipients#802011e2 to nil") - } - if err := buf.ConsumeID(BusinessRecipientsTypeID); err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: %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#802011e2 to nil") - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field chat_ids: %w", err) - } - - if headerLen > 0 { - b.ChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field chat_ids: %w", err) - } - b.ChatIDs = append(b.ChatIDs, value) - } - } - { - headerLen, err := buf.Int() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field excluded_chat_ids: %w", err) - } - - if headerLen > 0 { - b.ExcludedChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field excluded_chat_ids: %w", err) - } - b.ExcludedChatIDs = append(b.ExcludedChatIDs, value) - } - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field select_existing_chats: %w", err) - } - b.SelectExistingChats = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field select_new_chats: %w", err) - } - b.SelectNewChats = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field select_contacts: %w", err) - } - b.SelectContacts = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field select_non_contacts: %w", err) - } - b.SelectNonContacts = value - } - { - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field exclude_selected: %w", err) - } - b.ExcludeSelected = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessRecipients) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessRecipients#802011e2 as nil") - } - buf.ObjStart() - buf.PutID("businessRecipients") - buf.Comma() - buf.FieldStart("chat_ids") - buf.ArrStart() - for _, v := range b.ChatIDs { - buf.PutInt53(v) - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.FieldStart("excluded_chat_ids") - buf.ArrStart() - for _, v := range b.ExcludedChatIDs { - buf.PutInt53(v) - buf.Comma() - } - buf.StripComma() - buf.ArrEnd() - buf.Comma() - buf.FieldStart("select_existing_chats") - buf.PutBool(b.SelectExistingChats) - buf.Comma() - buf.FieldStart("select_new_chats") - buf.PutBool(b.SelectNewChats) - buf.Comma() - buf.FieldStart("select_contacts") - buf.PutBool(b.SelectContacts) - buf.Comma() - buf.FieldStart("select_non_contacts") - buf.PutBool(b.SelectNonContacts) - buf.Comma() - buf.FieldStart("exclude_selected") - buf.PutBool(b.ExcludeSelected) - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessRecipients) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessRecipients#802011e2 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessRecipients"); err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: %w", err) - } - case "chat_ids": - if err := buf.Arr(func(buf tdjson.Decoder) error { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field chat_ids: %w", err) - } - b.ChatIDs = append(b.ChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field chat_ids: %w", err) - } - case "excluded_chat_ids": - if err := buf.Arr(func(buf tdjson.Decoder) error { - value, err := buf.Int53() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field excluded_chat_ids: %w", err) - } - b.ExcludedChatIDs = append(b.ExcludedChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field excluded_chat_ids: %w", err) - } - case "select_existing_chats": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field select_existing_chats: %w", err) - } - b.SelectExistingChats = value - case "select_new_chats": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field select_new_chats: %w", err) - } - b.SelectNewChats = value - case "select_contacts": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field select_contacts: %w", err) - } - b.SelectContacts = value - case "select_non_contacts": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field select_non_contacts: %w", err) - } - b.SelectNonContacts = value - case "exclude_selected": - value, err := buf.Bool() - if err != nil { - return fmt.Errorf("unable to decode businessRecipients#802011e2: field exclude_selected: %w", err) - } - b.ExcludeSelected = value - default: - return buf.Skip() - } - return nil - }) -} - -// GetChatIDs returns value of ChatIDs field. -func (b *BusinessRecipients) GetChatIDs() (value []int64) { - if b == nil { - return - } - return b.ChatIDs -} - -// GetExcludedChatIDs returns value of ExcludedChatIDs field. -func (b *BusinessRecipients) GetExcludedChatIDs() (value []int64) { - if b == nil { - return - } - return b.ExcludedChatIDs -} - -// GetSelectExistingChats returns value of SelectExistingChats field. -func (b *BusinessRecipients) GetSelectExistingChats() (value bool) { - if b == nil { - return - } - return b.SelectExistingChats -} - -// GetSelectNewChats returns value of SelectNewChats field. -func (b *BusinessRecipients) GetSelectNewChats() (value bool) { - if b == nil { - return - } - return b.SelectNewChats -} - -// GetSelectContacts returns value of SelectContacts field. -func (b *BusinessRecipients) GetSelectContacts() (value bool) { - if b == nil { - return - } - return b.SelectContacts -} - -// GetSelectNonContacts returns value of SelectNonContacts field. -func (b *BusinessRecipients) GetSelectNonContacts() (value bool) { - if b == nil { - return - } - return b.SelectNonContacts -} - -// GetExcludeSelected returns value of ExcludeSelected field. -func (b *BusinessRecipients) GetExcludeSelected() (value bool) { - if b == nil { - return - } - return b.ExcludeSelected -} diff --git a/tdapi/tl_business_start_page_gen.go b/tdapi/tl_business_start_page_gen.go deleted file mode 100644 index 058daac79..000000000 --- a/tdapi/tl_business_start_page_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// BusinessStartPage represents TL type `businessStartPage#9fa2f7cf`. -type BusinessStartPage struct { - // Title text of the start page - Title string - // Message text of the start page - Message string - // Greeting sticker of the start page; may be null if none - Sticker Sticker -} - -// BusinessStartPageTypeID is TL type id of BusinessStartPage. -const BusinessStartPageTypeID = 0x9fa2f7cf - -// Ensuring interfaces in compile-time for BusinessStartPage. -var ( - _ bin.Encoder = &BusinessStartPage{} - _ bin.Decoder = &BusinessStartPage{} - _ bin.BareEncoder = &BusinessStartPage{} - _ bin.BareDecoder = &BusinessStartPage{} -) - -func (b *BusinessStartPage) Zero() bool { - if b == nil { - return true - } - if !(b.Title == "") { - return false - } - if !(b.Message == "") { - return false - } - if !(b.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (b *BusinessStartPage) String() string { - if b == nil { - return "BusinessStartPage(nil)" - } - type Alias BusinessStartPage - return fmt.Sprintf("BusinessStartPage%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*BusinessStartPage) TypeID() uint32 { - return BusinessStartPageTypeID -} - -// TypeName returns name of type in TL schema. -func (*BusinessStartPage) TypeName() string { - return "businessStartPage" -} - -// TypeInfo returns info about TL type. -func (b *BusinessStartPage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "businessStartPage", - ID: BusinessStartPageTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (b *BusinessStartPage) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessStartPage#9fa2f7cf as nil") - } - buf.PutID(BusinessStartPageTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *BusinessStartPage) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode businessStartPage#9fa2f7cf as nil") - } - buf.PutString(b.Title) - buf.PutString(b.Message) - if err := b.Sticker.Encode(buf); err != nil { - return fmt.Errorf("unable to encode businessStartPage#9fa2f7cf: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (b *BusinessStartPage) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessStartPage#9fa2f7cf to nil") - } - if err := buf.ConsumeID(BusinessStartPageTypeID); err != nil { - return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *BusinessStartPage) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode businessStartPage#9fa2f7cf to nil") - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field title: %w", err) - } - b.Title = value - } - { - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field message: %w", err) - } - b.Message = value - } - { - if err := b.Sticker.Decode(buf); err != nil { - return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *BusinessStartPage) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode businessStartPage#9fa2f7cf as nil") - } - buf.ObjStart() - buf.PutID("businessStartPage") - buf.Comma() - buf.FieldStart("title") - buf.PutString(b.Title) - buf.Comma() - buf.FieldStart("message") - buf.PutString(b.Message) - buf.Comma() - buf.FieldStart("sticker") - if err := b.Sticker.EncodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to encode businessStartPage#9fa2f7cf: field sticker: %w", err) - } - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *BusinessStartPage) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode businessStartPage#9fa2f7cf to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("businessStartPage"); err != nil { - return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: %w", err) - } - case "title": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field title: %w", err) - } - b.Title = value - case "message": - value, err := buf.String() - if err != nil { - return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field message: %w", err) - } - b.Message = value - case "sticker": - if err := b.Sticker.DecodeTDLibJSON(buf); err != nil { - return fmt.Errorf("unable to decode businessStartPage#9fa2f7cf: field sticker: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (b *BusinessStartPage) GetTitle() (value string) { - if b == nil { - return - } - return b.Title -} - -// GetMessage returns value of Message field. -func (b *BusinessStartPage) GetMessage() (value string) { - if b == nil { - return - } - return b.Message -} - -// GetSticker returns value of Sticker field. -func (b *BusinessStartPage) GetSticker() (value Sticker) { - if b == nil { - return - } - return b.Sticker -} diff --git a/tdapi/tl_bytes_gen.go b/tdapi/tl_bytes_gen.go deleted file mode 100644 index 64a0088db..000000000 --- a/tdapi/tl_bytes_gen.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Bytes represents TL type `bytes#e937bb82`. -type Bytes struct { -} - -// BytesTypeID is TL type id of Bytes. -const BytesTypeID = 0xe937bb82 - -// Ensuring interfaces in compile-time for Bytes. -var ( - _ bin.Encoder = &Bytes{} - _ bin.Decoder = &Bytes{} - _ bin.BareEncoder = &Bytes{} - _ bin.BareDecoder = &Bytes{} -) - -func (b *Bytes) Zero() bool { - if b == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (b *Bytes) String() string { - if b == nil { - return "Bytes(nil)" - } - type Alias Bytes - return fmt.Sprintf("Bytes%+v", Alias(*b)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Bytes) TypeID() uint32 { - return BytesTypeID -} - -// TypeName returns name of type in TL schema. -func (*Bytes) TypeName() string { - return "bytes" -} - -// TypeInfo returns info about TL type. -func (b *Bytes) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "bytes", - ID: BytesTypeID, - } - if b == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (b *Bytes) Encode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode bytes#e937bb82 as nil") - } - buf.PutID(BytesTypeID) - return b.EncodeBare(buf) -} - -// EncodeBare implements bin.BareEncoder. -func (b *Bytes) EncodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't encode bytes#e937bb82 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (b *Bytes) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode bytes#e937bb82 to nil") - } - if err := buf.ConsumeID(BytesTypeID); err != nil { - return fmt.Errorf("unable to decode bytes#e937bb82: %w", err) - } - return b.DecodeBare(buf) -} - -// DecodeBare implements bin.BareDecoder. -func (b *Bytes) DecodeBare(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("can't decode bytes#e937bb82 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (b *Bytes) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil { - return fmt.Errorf("can't encode bytes#e937bb82 as nil") - } - buf.ObjStart() - buf.PutID("bytes") - buf.Comma() - buf.StripComma() - buf.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (b *Bytes) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("can't decode bytes#e937bb82 to nil") - } - - return buf.Obj(func(buf tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := buf.ConsumeID("bytes"); err != nil { - return fmt.Errorf("unable to decode bytes#e937bb82: %w", err) - } - default: - return buf.Skip() - } - return nil - }) -} diff --git a/tdapi/tl_call_discard_reason_gen.go b/tdapi/tl_call_discard_reason_gen.go deleted file mode 100644 index 482feacf4..000000000 --- a/tdapi/tl_call_discard_reason_gen.go +++ /dev/null @@ -1,1050 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CallDiscardReasonEmpty represents TL type `callDiscardReasonEmpty#b4f66fc3`. -type CallDiscardReasonEmpty struct { -} - -// CallDiscardReasonEmptyTypeID is TL type id of CallDiscardReasonEmpty. -const CallDiscardReasonEmptyTypeID = 0xb4f66fc3 - -// construct implements constructor of CallDiscardReasonClass. -func (c CallDiscardReasonEmpty) construct() CallDiscardReasonClass { return &c } - -// Ensuring interfaces in compile-time for CallDiscardReasonEmpty. -var ( - _ bin.Encoder = &CallDiscardReasonEmpty{} - _ bin.Decoder = &CallDiscardReasonEmpty{} - _ bin.BareEncoder = &CallDiscardReasonEmpty{} - _ bin.BareDecoder = &CallDiscardReasonEmpty{} - - _ CallDiscardReasonClass = &CallDiscardReasonEmpty{} -) - -func (c *CallDiscardReasonEmpty) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallDiscardReasonEmpty) String() string { - if c == nil { - return "CallDiscardReasonEmpty(nil)" - } - type Alias CallDiscardReasonEmpty - return fmt.Sprintf("CallDiscardReasonEmpty%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallDiscardReasonEmpty) TypeID() uint32 { - return CallDiscardReasonEmptyTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallDiscardReasonEmpty) TypeName() string { - return "callDiscardReasonEmpty" -} - -// TypeInfo returns info about TL type. -func (c *CallDiscardReasonEmpty) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callDiscardReasonEmpty", - ID: CallDiscardReasonEmptyTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallDiscardReasonEmpty) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonEmpty#b4f66fc3 as nil") - } - b.PutID(CallDiscardReasonEmptyTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallDiscardReasonEmpty) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonEmpty#b4f66fc3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallDiscardReasonEmpty) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonEmpty#b4f66fc3 to nil") - } - if err := b.ConsumeID(CallDiscardReasonEmptyTypeID); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonEmpty#b4f66fc3: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallDiscardReasonEmpty) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonEmpty#b4f66fc3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallDiscardReasonEmpty) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonEmpty#b4f66fc3 as nil") - } - b.ObjStart() - b.PutID("callDiscardReasonEmpty") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallDiscardReasonEmpty) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonEmpty#b4f66fc3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callDiscardReasonEmpty"); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonEmpty#b4f66fc3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallDiscardReasonMissed represents TL type `callDiscardReasonMissed#64283a7c`. -type CallDiscardReasonMissed struct { -} - -// CallDiscardReasonMissedTypeID is TL type id of CallDiscardReasonMissed. -const CallDiscardReasonMissedTypeID = 0x64283a7c - -// construct implements constructor of CallDiscardReasonClass. -func (c CallDiscardReasonMissed) construct() CallDiscardReasonClass { return &c } - -// Ensuring interfaces in compile-time for CallDiscardReasonMissed. -var ( - _ bin.Encoder = &CallDiscardReasonMissed{} - _ bin.Decoder = &CallDiscardReasonMissed{} - _ bin.BareEncoder = &CallDiscardReasonMissed{} - _ bin.BareDecoder = &CallDiscardReasonMissed{} - - _ CallDiscardReasonClass = &CallDiscardReasonMissed{} -) - -func (c *CallDiscardReasonMissed) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallDiscardReasonMissed) String() string { - if c == nil { - return "CallDiscardReasonMissed(nil)" - } - type Alias CallDiscardReasonMissed - return fmt.Sprintf("CallDiscardReasonMissed%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallDiscardReasonMissed) TypeID() uint32 { - return CallDiscardReasonMissedTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallDiscardReasonMissed) TypeName() string { - return "callDiscardReasonMissed" -} - -// TypeInfo returns info about TL type. -func (c *CallDiscardReasonMissed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callDiscardReasonMissed", - ID: CallDiscardReasonMissedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallDiscardReasonMissed) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonMissed#64283a7c as nil") - } - b.PutID(CallDiscardReasonMissedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallDiscardReasonMissed) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonMissed#64283a7c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallDiscardReasonMissed) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonMissed#64283a7c to nil") - } - if err := b.ConsumeID(CallDiscardReasonMissedTypeID); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonMissed#64283a7c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallDiscardReasonMissed) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonMissed#64283a7c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallDiscardReasonMissed) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonMissed#64283a7c as nil") - } - b.ObjStart() - b.PutID("callDiscardReasonMissed") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallDiscardReasonMissed) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonMissed#64283a7c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callDiscardReasonMissed"); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonMissed#64283a7c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallDiscardReasonDeclined represents TL type `callDiscardReasonDeclined#98e36c32`. -type CallDiscardReasonDeclined struct { -} - -// CallDiscardReasonDeclinedTypeID is TL type id of CallDiscardReasonDeclined. -const CallDiscardReasonDeclinedTypeID = 0x98e36c32 - -// construct implements constructor of CallDiscardReasonClass. -func (c CallDiscardReasonDeclined) construct() CallDiscardReasonClass { return &c } - -// Ensuring interfaces in compile-time for CallDiscardReasonDeclined. -var ( - _ bin.Encoder = &CallDiscardReasonDeclined{} - _ bin.Decoder = &CallDiscardReasonDeclined{} - _ bin.BareEncoder = &CallDiscardReasonDeclined{} - _ bin.BareDecoder = &CallDiscardReasonDeclined{} - - _ CallDiscardReasonClass = &CallDiscardReasonDeclined{} -) - -func (c *CallDiscardReasonDeclined) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallDiscardReasonDeclined) String() string { - if c == nil { - return "CallDiscardReasonDeclined(nil)" - } - type Alias CallDiscardReasonDeclined - return fmt.Sprintf("CallDiscardReasonDeclined%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallDiscardReasonDeclined) TypeID() uint32 { - return CallDiscardReasonDeclinedTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallDiscardReasonDeclined) TypeName() string { - return "callDiscardReasonDeclined" -} - -// TypeInfo returns info about TL type. -func (c *CallDiscardReasonDeclined) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callDiscardReasonDeclined", - ID: CallDiscardReasonDeclinedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallDiscardReasonDeclined) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonDeclined#98e36c32 as nil") - } - b.PutID(CallDiscardReasonDeclinedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallDiscardReasonDeclined) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonDeclined#98e36c32 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallDiscardReasonDeclined) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonDeclined#98e36c32 to nil") - } - if err := b.ConsumeID(CallDiscardReasonDeclinedTypeID); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonDeclined#98e36c32: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallDiscardReasonDeclined) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonDeclined#98e36c32 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallDiscardReasonDeclined) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonDeclined#98e36c32 as nil") - } - b.ObjStart() - b.PutID("callDiscardReasonDeclined") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallDiscardReasonDeclined) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonDeclined#98e36c32 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callDiscardReasonDeclined"); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonDeclined#98e36c32: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallDiscardReasonDisconnected represents TL type `callDiscardReasonDisconnected#aff563a2`. -type CallDiscardReasonDisconnected struct { -} - -// CallDiscardReasonDisconnectedTypeID is TL type id of CallDiscardReasonDisconnected. -const CallDiscardReasonDisconnectedTypeID = 0xaff563a2 - -// construct implements constructor of CallDiscardReasonClass. -func (c CallDiscardReasonDisconnected) construct() CallDiscardReasonClass { return &c } - -// Ensuring interfaces in compile-time for CallDiscardReasonDisconnected. -var ( - _ bin.Encoder = &CallDiscardReasonDisconnected{} - _ bin.Decoder = &CallDiscardReasonDisconnected{} - _ bin.BareEncoder = &CallDiscardReasonDisconnected{} - _ bin.BareDecoder = &CallDiscardReasonDisconnected{} - - _ CallDiscardReasonClass = &CallDiscardReasonDisconnected{} -) - -func (c *CallDiscardReasonDisconnected) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallDiscardReasonDisconnected) String() string { - if c == nil { - return "CallDiscardReasonDisconnected(nil)" - } - type Alias CallDiscardReasonDisconnected - return fmt.Sprintf("CallDiscardReasonDisconnected%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallDiscardReasonDisconnected) TypeID() uint32 { - return CallDiscardReasonDisconnectedTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallDiscardReasonDisconnected) TypeName() string { - return "callDiscardReasonDisconnected" -} - -// TypeInfo returns info about TL type. -func (c *CallDiscardReasonDisconnected) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callDiscardReasonDisconnected", - ID: CallDiscardReasonDisconnectedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallDiscardReasonDisconnected) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonDisconnected#aff563a2 as nil") - } - b.PutID(CallDiscardReasonDisconnectedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallDiscardReasonDisconnected) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonDisconnected#aff563a2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallDiscardReasonDisconnected) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonDisconnected#aff563a2 to nil") - } - if err := b.ConsumeID(CallDiscardReasonDisconnectedTypeID); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonDisconnected#aff563a2: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallDiscardReasonDisconnected) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonDisconnected#aff563a2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallDiscardReasonDisconnected) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonDisconnected#aff563a2 as nil") - } - b.ObjStart() - b.PutID("callDiscardReasonDisconnected") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallDiscardReasonDisconnected) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonDisconnected#aff563a2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callDiscardReasonDisconnected"); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonDisconnected#aff563a2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallDiscardReasonHungUp represents TL type `callDiscardReasonHungUp#1a1ea5e6`. -type CallDiscardReasonHungUp struct { -} - -// CallDiscardReasonHungUpTypeID is TL type id of CallDiscardReasonHungUp. -const CallDiscardReasonHungUpTypeID = 0x1a1ea5e6 - -// construct implements constructor of CallDiscardReasonClass. -func (c CallDiscardReasonHungUp) construct() CallDiscardReasonClass { return &c } - -// Ensuring interfaces in compile-time for CallDiscardReasonHungUp. -var ( - _ bin.Encoder = &CallDiscardReasonHungUp{} - _ bin.Decoder = &CallDiscardReasonHungUp{} - _ bin.BareEncoder = &CallDiscardReasonHungUp{} - _ bin.BareDecoder = &CallDiscardReasonHungUp{} - - _ CallDiscardReasonClass = &CallDiscardReasonHungUp{} -) - -func (c *CallDiscardReasonHungUp) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallDiscardReasonHungUp) String() string { - if c == nil { - return "CallDiscardReasonHungUp(nil)" - } - type Alias CallDiscardReasonHungUp - return fmt.Sprintf("CallDiscardReasonHungUp%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallDiscardReasonHungUp) TypeID() uint32 { - return CallDiscardReasonHungUpTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallDiscardReasonHungUp) TypeName() string { - return "callDiscardReasonHungUp" -} - -// TypeInfo returns info about TL type. -func (c *CallDiscardReasonHungUp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callDiscardReasonHungUp", - ID: CallDiscardReasonHungUpTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallDiscardReasonHungUp) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonHungUp#1a1ea5e6 as nil") - } - b.PutID(CallDiscardReasonHungUpTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallDiscardReasonHungUp) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonHungUp#1a1ea5e6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallDiscardReasonHungUp) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonHungUp#1a1ea5e6 to nil") - } - if err := b.ConsumeID(CallDiscardReasonHungUpTypeID); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonHungUp#1a1ea5e6: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallDiscardReasonHungUp) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonHungUp#1a1ea5e6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallDiscardReasonHungUp) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonHungUp#1a1ea5e6 as nil") - } - b.ObjStart() - b.PutID("callDiscardReasonHungUp") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallDiscardReasonHungUp) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonHungUp#1a1ea5e6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callDiscardReasonHungUp"); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonHungUp#1a1ea5e6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallDiscardReasonAllowGroupCall represents TL type `callDiscardReasonAllowGroupCall#af177fd5`. -type CallDiscardReasonAllowGroupCall struct { - // Encrypted using the call private key encryption key for the associated group call - EncryptedGroupCallKey []byte -} - -// CallDiscardReasonAllowGroupCallTypeID is TL type id of CallDiscardReasonAllowGroupCall. -const CallDiscardReasonAllowGroupCallTypeID = 0xaf177fd5 - -// construct implements constructor of CallDiscardReasonClass. -func (c CallDiscardReasonAllowGroupCall) construct() CallDiscardReasonClass { return &c } - -// Ensuring interfaces in compile-time for CallDiscardReasonAllowGroupCall. -var ( - _ bin.Encoder = &CallDiscardReasonAllowGroupCall{} - _ bin.Decoder = &CallDiscardReasonAllowGroupCall{} - _ bin.BareEncoder = &CallDiscardReasonAllowGroupCall{} - _ bin.BareDecoder = &CallDiscardReasonAllowGroupCall{} - - _ CallDiscardReasonClass = &CallDiscardReasonAllowGroupCall{} -) - -func (c *CallDiscardReasonAllowGroupCall) Zero() bool { - if c == nil { - return true - } - if !(c.EncryptedGroupCallKey == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallDiscardReasonAllowGroupCall) String() string { - if c == nil { - return "CallDiscardReasonAllowGroupCall(nil)" - } - type Alias CallDiscardReasonAllowGroupCall - return fmt.Sprintf("CallDiscardReasonAllowGroupCall%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallDiscardReasonAllowGroupCall) TypeID() uint32 { - return CallDiscardReasonAllowGroupCallTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallDiscardReasonAllowGroupCall) TypeName() string { - return "callDiscardReasonAllowGroupCall" -} - -// TypeInfo returns info about TL type. -func (c *CallDiscardReasonAllowGroupCall) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callDiscardReasonAllowGroupCall", - ID: CallDiscardReasonAllowGroupCallTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "EncryptedGroupCallKey", - SchemaName: "encrypted_group_call_key", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallDiscardReasonAllowGroupCall) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonAllowGroupCall#af177fd5 as nil") - } - b.PutID(CallDiscardReasonAllowGroupCallTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallDiscardReasonAllowGroupCall) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonAllowGroupCall#af177fd5 as nil") - } - b.PutBytes(c.EncryptedGroupCallKey) - return nil -} - -// Decode implements bin.Decoder. -func (c *CallDiscardReasonAllowGroupCall) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonAllowGroupCall#af177fd5 to nil") - } - if err := b.ConsumeID(CallDiscardReasonAllowGroupCallTypeID); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonAllowGroupCall#af177fd5: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallDiscardReasonAllowGroupCall) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonAllowGroupCall#af177fd5 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode callDiscardReasonAllowGroupCall#af177fd5: field encrypted_group_call_key: %w", err) - } - c.EncryptedGroupCallKey = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallDiscardReasonAllowGroupCall) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callDiscardReasonAllowGroupCall#af177fd5 as nil") - } - b.ObjStart() - b.PutID("callDiscardReasonAllowGroupCall") - b.Comma() - b.FieldStart("encrypted_group_call_key") - b.PutBytes(c.EncryptedGroupCallKey) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallDiscardReasonAllowGroupCall) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callDiscardReasonAllowGroupCall#af177fd5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callDiscardReasonAllowGroupCall"); err != nil { - return fmt.Errorf("unable to decode callDiscardReasonAllowGroupCall#af177fd5: %w", err) - } - case "encrypted_group_call_key": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode callDiscardReasonAllowGroupCall#af177fd5: field encrypted_group_call_key: %w", err) - } - c.EncryptedGroupCallKey = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEncryptedGroupCallKey returns value of EncryptedGroupCallKey field. -func (c *CallDiscardReasonAllowGroupCall) GetEncryptedGroupCallKey() (value []byte) { - if c == nil { - return - } - return c.EncryptedGroupCallKey -} - -// CallDiscardReasonClassName is schema name of CallDiscardReasonClass. -const CallDiscardReasonClassName = "CallDiscardReason" - -// CallDiscardReasonClass represents CallDiscardReason generic type. -// -// Example: -// -// g, err := tdapi.DecodeCallDiscardReason(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.CallDiscardReasonEmpty: // callDiscardReasonEmpty#b4f66fc3 -// case *tdapi.CallDiscardReasonMissed: // callDiscardReasonMissed#64283a7c -// case *tdapi.CallDiscardReasonDeclined: // callDiscardReasonDeclined#98e36c32 -// case *tdapi.CallDiscardReasonDisconnected: // callDiscardReasonDisconnected#aff563a2 -// case *tdapi.CallDiscardReasonHungUp: // callDiscardReasonHungUp#1a1ea5e6 -// case *tdapi.CallDiscardReasonAllowGroupCall: // callDiscardReasonAllowGroupCall#af177fd5 -// default: panic(v) -// } -type CallDiscardReasonClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() CallDiscardReasonClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeCallDiscardReason implements binary de-serialization for CallDiscardReasonClass. -func DecodeCallDiscardReason(buf *bin.Buffer) (CallDiscardReasonClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case CallDiscardReasonEmptyTypeID: - // Decoding callDiscardReasonEmpty#b4f66fc3. - v := CallDiscardReasonEmpty{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - case CallDiscardReasonMissedTypeID: - // Decoding callDiscardReasonMissed#64283a7c. - v := CallDiscardReasonMissed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - case CallDiscardReasonDeclinedTypeID: - // Decoding callDiscardReasonDeclined#98e36c32. - v := CallDiscardReasonDeclined{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - case CallDiscardReasonDisconnectedTypeID: - // Decoding callDiscardReasonDisconnected#aff563a2. - v := CallDiscardReasonDisconnected{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - case CallDiscardReasonHungUpTypeID: - // Decoding callDiscardReasonHungUp#1a1ea5e6. - v := CallDiscardReasonHungUp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - case CallDiscardReasonAllowGroupCallTypeID: - // Decoding callDiscardReasonAllowGroupCall#af177fd5. - v := CallDiscardReasonAllowGroupCall{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONCallDiscardReason implements binary de-serialization for CallDiscardReasonClass. -func DecodeTDLibJSONCallDiscardReason(buf tdjson.Decoder) (CallDiscardReasonClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "callDiscardReasonEmpty": - // Decoding callDiscardReasonEmpty#b4f66fc3. - v := CallDiscardReasonEmpty{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - case "callDiscardReasonMissed": - // Decoding callDiscardReasonMissed#64283a7c. - v := CallDiscardReasonMissed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - case "callDiscardReasonDeclined": - // Decoding callDiscardReasonDeclined#98e36c32. - v := CallDiscardReasonDeclined{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - case "callDiscardReasonDisconnected": - // Decoding callDiscardReasonDisconnected#aff563a2. - v := CallDiscardReasonDisconnected{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - case "callDiscardReasonHungUp": - // Decoding callDiscardReasonHungUp#1a1ea5e6. - v := CallDiscardReasonHungUp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - case "callDiscardReasonAllowGroupCall": - // Decoding callDiscardReasonAllowGroupCall#af177fd5. - v := CallDiscardReasonAllowGroupCall{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CallDiscardReasonClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// CallDiscardReason boxes the CallDiscardReasonClass providing a helper. -type CallDiscardReasonBox struct { - CallDiscardReason CallDiscardReasonClass -} - -// Decode implements bin.Decoder for CallDiscardReasonBox. -func (b *CallDiscardReasonBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode CallDiscardReasonBox to nil") - } - v, err := DecodeCallDiscardReason(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CallDiscardReason = v - return nil -} - -// Encode implements bin.Encode for CallDiscardReasonBox. -func (b *CallDiscardReasonBox) Encode(buf *bin.Buffer) error { - if b == nil || b.CallDiscardReason == nil { - return fmt.Errorf("unable to encode CallDiscardReasonClass as nil") - } - return b.CallDiscardReason.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for CallDiscardReasonBox. -func (b *CallDiscardReasonBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode CallDiscardReasonBox to nil") - } - v, err := DecodeTDLibJSONCallDiscardReason(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CallDiscardReason = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for CallDiscardReasonBox. -func (b *CallDiscardReasonBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.CallDiscardReason == nil { - return fmt.Errorf("unable to encode CallDiscardReasonClass as nil") - } - return b.CallDiscardReason.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_call_gen.go b/tdapi/tl_call_gen.go deleted file mode 100644 index 76e23e923..000000000 --- a/tdapi/tl_call_gen.go +++ /dev/null @@ -1,374 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Call represents TL type `call#9e0dd8aa`. -type Call struct { - // Call identifier, not persistent - ID int32 - // User identifier of the other call participant - UserID int64 - // True, if the call is outgoing - IsOutgoing bool - // True, if the call is a video call - IsVideo bool - // Call state - State CallStateClass - // Identifier of the group call associated with the call; 0 if the group call isn't - // created yet. The group call can be received through the method getGroupCall - GroupCallID int32 -} - -// CallTypeID is TL type id of Call. -const CallTypeID = 0x9e0dd8aa - -// Ensuring interfaces in compile-time for Call. -var ( - _ bin.Encoder = &Call{} - _ bin.Decoder = &Call{} - _ bin.BareEncoder = &Call{} - _ bin.BareDecoder = &Call{} -) - -func (c *Call) Zero() bool { - if c == nil { - return true - } - if !(c.ID == 0) { - return false - } - if !(c.UserID == 0) { - return false - } - if !(c.IsOutgoing == false) { - return false - } - if !(c.IsVideo == false) { - return false - } - if !(c.State == nil) { - return false - } - if !(c.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *Call) String() string { - if c == nil { - return "Call(nil)" - } - type Alias Call - return fmt.Sprintf("Call%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Call) TypeID() uint32 { - return CallTypeID -} - -// TypeName returns name of type in TL schema. -func (*Call) TypeName() string { - return "call" -} - -// TypeInfo returns info about TL type. -func (c *Call) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "call", - ID: CallTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "IsOutgoing", - SchemaName: "is_outgoing", - }, - { - Name: "IsVideo", - SchemaName: "is_video", - }, - { - Name: "State", - SchemaName: "state", - }, - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *Call) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode call#9e0dd8aa as nil") - } - b.PutID(CallTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *Call) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode call#9e0dd8aa as nil") - } - b.PutInt32(c.ID) - b.PutInt53(c.UserID) - b.PutBool(c.IsOutgoing) - b.PutBool(c.IsVideo) - if c.State == nil { - return fmt.Errorf("unable to encode call#9e0dd8aa: field state is nil") - } - if err := c.State.Encode(b); err != nil { - return fmt.Errorf("unable to encode call#9e0dd8aa: field state: %w", err) - } - b.PutInt32(c.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (c *Call) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode call#9e0dd8aa to nil") - } - if err := b.ConsumeID(CallTypeID); err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *Call) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode call#9e0dd8aa to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field id: %w", err) - } - c.ID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field is_outgoing: %w", err) - } - c.IsOutgoing = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field is_video: %w", err) - } - c.IsVideo = value - } - { - value, err := DecodeCallState(b) - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field state: %w", err) - } - c.State = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field group_call_id: %w", err) - } - c.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *Call) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode call#9e0dd8aa as nil") - } - b.ObjStart() - b.PutID("call") - b.Comma() - b.FieldStart("id") - b.PutInt32(c.ID) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("is_outgoing") - b.PutBool(c.IsOutgoing) - b.Comma() - b.FieldStart("is_video") - b.PutBool(c.IsVideo) - b.Comma() - b.FieldStart("state") - if c.State == nil { - return fmt.Errorf("unable to encode call#9e0dd8aa: field state is nil") - } - if err := c.State.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode call#9e0dd8aa: field state: %w", err) - } - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(c.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *Call) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode call#9e0dd8aa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("call"); err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field id: %w", err) - } - c.ID = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field user_id: %w", err) - } - c.UserID = value - case "is_outgoing": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field is_outgoing: %w", err) - } - c.IsOutgoing = value - case "is_video": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field is_video: %w", err) - } - c.IsVideo = value - case "state": - value, err := DecodeTDLibJSONCallState(b) - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field state: %w", err) - } - c.State = value - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode call#9e0dd8aa: field group_call_id: %w", err) - } - c.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (c *Call) GetID() (value int32) { - if c == nil { - return - } - return c.ID -} - -// GetUserID returns value of UserID field. -func (c *Call) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetIsOutgoing returns value of IsOutgoing field. -func (c *Call) GetIsOutgoing() (value bool) { - if c == nil { - return - } - return c.IsOutgoing -} - -// GetIsVideo returns value of IsVideo field. -func (c *Call) GetIsVideo() (value bool) { - if c == nil { - return - } - return c.IsVideo -} - -// GetState returns value of State field. -func (c *Call) GetState() (value CallStateClass) { - if c == nil { - return - } - return c.State -} - -// GetGroupCallID returns value of GroupCallID field. -func (c *Call) GetGroupCallID() (value int32) { - if c == nil { - return - } - return c.GroupCallID -} diff --git a/tdapi/tl_call_id_gen.go b/tdapi/tl_call_id_gen.go deleted file mode 100644 index b524224ba..000000000 --- a/tdapi/tl_call_id_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CallID represents TL type `callId#3eac609`. -type CallID struct { - // Call identifier - ID int32 -} - -// CallIDTypeID is TL type id of CallID. -const CallIDTypeID = 0x3eac609 - -// Ensuring interfaces in compile-time for CallID. -var ( - _ bin.Encoder = &CallID{} - _ bin.Decoder = &CallID{} - _ bin.BareEncoder = &CallID{} - _ bin.BareDecoder = &CallID{} -) - -func (c *CallID) Zero() bool { - if c == nil { - return true - } - if !(c.ID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallID) String() string { - if c == nil { - return "CallID(nil)" - } - type Alias CallID - return fmt.Sprintf("CallID%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallID) TypeID() uint32 { - return CallIDTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallID) TypeName() string { - return "callId" -} - -// TypeInfo returns info about TL type. -func (c *CallID) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callId", - ID: CallIDTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallID) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callId#3eac609 as nil") - } - b.PutID(CallIDTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallID) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callId#3eac609 as nil") - } - b.PutInt32(c.ID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CallID) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callId#3eac609 to nil") - } - if err := b.ConsumeID(CallIDTypeID); err != nil { - return fmt.Errorf("unable to decode callId#3eac609: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallID) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callId#3eac609 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode callId#3eac609: field id: %w", err) - } - c.ID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallID) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callId#3eac609 as nil") - } - b.ObjStart() - b.PutID("callId") - b.Comma() - b.FieldStart("id") - b.PutInt32(c.ID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallID) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callId#3eac609 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callId"); err != nil { - return fmt.Errorf("unable to decode callId#3eac609: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode callId#3eac609: field id: %w", err) - } - c.ID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (c *CallID) GetID() (value int32) { - if c == nil { - return - } - return c.ID -} diff --git a/tdapi/tl_call_problem_gen.go b/tdapi/tl_call_problem_gen.go deleted file mode 100644 index 1a8a0ec3c..000000000 --- a/tdapi/tl_call_problem_gen.go +++ /dev/null @@ -1,1453 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CallProblemEcho represents TL type `callProblemEcho#2fc01184`. -type CallProblemEcho struct { -} - -// CallProblemEchoTypeID is TL type id of CallProblemEcho. -const CallProblemEchoTypeID = 0x2fc01184 - -// construct implements constructor of CallProblemClass. -func (c CallProblemEcho) construct() CallProblemClass { return &c } - -// Ensuring interfaces in compile-time for CallProblemEcho. -var ( - _ bin.Encoder = &CallProblemEcho{} - _ bin.Decoder = &CallProblemEcho{} - _ bin.BareEncoder = &CallProblemEcho{} - _ bin.BareDecoder = &CallProblemEcho{} - - _ CallProblemClass = &CallProblemEcho{} -) - -func (c *CallProblemEcho) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallProblemEcho) String() string { - if c == nil { - return "CallProblemEcho(nil)" - } - type Alias CallProblemEcho - return fmt.Sprintf("CallProblemEcho%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallProblemEcho) TypeID() uint32 { - return CallProblemEchoTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallProblemEcho) TypeName() string { - return "callProblemEcho" -} - -// TypeInfo returns info about TL type. -func (c *CallProblemEcho) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callProblemEcho", - ID: CallProblemEchoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallProblemEcho) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemEcho#2fc01184 as nil") - } - b.PutID(CallProblemEchoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallProblemEcho) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemEcho#2fc01184 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallProblemEcho) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemEcho#2fc01184 to nil") - } - if err := b.ConsumeID(CallProblemEchoTypeID); err != nil { - return fmt.Errorf("unable to decode callProblemEcho#2fc01184: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallProblemEcho) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemEcho#2fc01184 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallProblemEcho) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callProblemEcho#2fc01184 as nil") - } - b.ObjStart() - b.PutID("callProblemEcho") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallProblemEcho) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callProblemEcho#2fc01184 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callProblemEcho"); err != nil { - return fmt.Errorf("unable to decode callProblemEcho#2fc01184: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallProblemNoise represents TL type `callProblemNoise#3ec4808f`. -type CallProblemNoise struct { -} - -// CallProblemNoiseTypeID is TL type id of CallProblemNoise. -const CallProblemNoiseTypeID = 0x3ec4808f - -// construct implements constructor of CallProblemClass. -func (c CallProblemNoise) construct() CallProblemClass { return &c } - -// Ensuring interfaces in compile-time for CallProblemNoise. -var ( - _ bin.Encoder = &CallProblemNoise{} - _ bin.Decoder = &CallProblemNoise{} - _ bin.BareEncoder = &CallProblemNoise{} - _ bin.BareDecoder = &CallProblemNoise{} - - _ CallProblemClass = &CallProblemNoise{} -) - -func (c *CallProblemNoise) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallProblemNoise) String() string { - if c == nil { - return "CallProblemNoise(nil)" - } - type Alias CallProblemNoise - return fmt.Sprintf("CallProblemNoise%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallProblemNoise) TypeID() uint32 { - return CallProblemNoiseTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallProblemNoise) TypeName() string { - return "callProblemNoise" -} - -// TypeInfo returns info about TL type. -func (c *CallProblemNoise) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callProblemNoise", - ID: CallProblemNoiseTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallProblemNoise) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemNoise#3ec4808f as nil") - } - b.PutID(CallProblemNoiseTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallProblemNoise) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemNoise#3ec4808f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallProblemNoise) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemNoise#3ec4808f to nil") - } - if err := b.ConsumeID(CallProblemNoiseTypeID); err != nil { - return fmt.Errorf("unable to decode callProblemNoise#3ec4808f: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallProblemNoise) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemNoise#3ec4808f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallProblemNoise) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callProblemNoise#3ec4808f as nil") - } - b.ObjStart() - b.PutID("callProblemNoise") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallProblemNoise) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callProblemNoise#3ec4808f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callProblemNoise"); err != nil { - return fmt.Errorf("unable to decode callProblemNoise#3ec4808f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallProblemInterruptions represents TL type `callProblemInterruptions#42ba1c62`. -type CallProblemInterruptions struct { -} - -// CallProblemInterruptionsTypeID is TL type id of CallProblemInterruptions. -const CallProblemInterruptionsTypeID = 0x42ba1c62 - -// construct implements constructor of CallProblemClass. -func (c CallProblemInterruptions) construct() CallProblemClass { return &c } - -// Ensuring interfaces in compile-time for CallProblemInterruptions. -var ( - _ bin.Encoder = &CallProblemInterruptions{} - _ bin.Decoder = &CallProblemInterruptions{} - _ bin.BareEncoder = &CallProblemInterruptions{} - _ bin.BareDecoder = &CallProblemInterruptions{} - - _ CallProblemClass = &CallProblemInterruptions{} -) - -func (c *CallProblemInterruptions) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallProblemInterruptions) String() string { - if c == nil { - return "CallProblemInterruptions(nil)" - } - type Alias CallProblemInterruptions - return fmt.Sprintf("CallProblemInterruptions%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallProblemInterruptions) TypeID() uint32 { - return CallProblemInterruptionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallProblemInterruptions) TypeName() string { - return "callProblemInterruptions" -} - -// TypeInfo returns info about TL type. -func (c *CallProblemInterruptions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callProblemInterruptions", - ID: CallProblemInterruptionsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallProblemInterruptions) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemInterruptions#42ba1c62 as nil") - } - b.PutID(CallProblemInterruptionsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallProblemInterruptions) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemInterruptions#42ba1c62 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallProblemInterruptions) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemInterruptions#42ba1c62 to nil") - } - if err := b.ConsumeID(CallProblemInterruptionsTypeID); err != nil { - return fmt.Errorf("unable to decode callProblemInterruptions#42ba1c62: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallProblemInterruptions) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemInterruptions#42ba1c62 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallProblemInterruptions) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callProblemInterruptions#42ba1c62 as nil") - } - b.ObjStart() - b.PutID("callProblemInterruptions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallProblemInterruptions) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callProblemInterruptions#42ba1c62 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callProblemInterruptions"); err != nil { - return fmt.Errorf("unable to decode callProblemInterruptions#42ba1c62: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallProblemDistortedSpeech represents TL type `callProblemDistortedSpeech#16a5bd05`. -type CallProblemDistortedSpeech struct { -} - -// CallProblemDistortedSpeechTypeID is TL type id of CallProblemDistortedSpeech. -const CallProblemDistortedSpeechTypeID = 0x16a5bd05 - -// construct implements constructor of CallProblemClass. -func (c CallProblemDistortedSpeech) construct() CallProblemClass { return &c } - -// Ensuring interfaces in compile-time for CallProblemDistortedSpeech. -var ( - _ bin.Encoder = &CallProblemDistortedSpeech{} - _ bin.Decoder = &CallProblemDistortedSpeech{} - _ bin.BareEncoder = &CallProblemDistortedSpeech{} - _ bin.BareDecoder = &CallProblemDistortedSpeech{} - - _ CallProblemClass = &CallProblemDistortedSpeech{} -) - -func (c *CallProblemDistortedSpeech) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallProblemDistortedSpeech) String() string { - if c == nil { - return "CallProblemDistortedSpeech(nil)" - } - type Alias CallProblemDistortedSpeech - return fmt.Sprintf("CallProblemDistortedSpeech%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallProblemDistortedSpeech) TypeID() uint32 { - return CallProblemDistortedSpeechTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallProblemDistortedSpeech) TypeName() string { - return "callProblemDistortedSpeech" -} - -// TypeInfo returns info about TL type. -func (c *CallProblemDistortedSpeech) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callProblemDistortedSpeech", - ID: CallProblemDistortedSpeechTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallProblemDistortedSpeech) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemDistortedSpeech#16a5bd05 as nil") - } - b.PutID(CallProblemDistortedSpeechTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallProblemDistortedSpeech) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemDistortedSpeech#16a5bd05 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallProblemDistortedSpeech) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemDistortedSpeech#16a5bd05 to nil") - } - if err := b.ConsumeID(CallProblemDistortedSpeechTypeID); err != nil { - return fmt.Errorf("unable to decode callProblemDistortedSpeech#16a5bd05: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallProblemDistortedSpeech) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemDistortedSpeech#16a5bd05 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallProblemDistortedSpeech) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callProblemDistortedSpeech#16a5bd05 as nil") - } - b.ObjStart() - b.PutID("callProblemDistortedSpeech") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallProblemDistortedSpeech) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callProblemDistortedSpeech#16a5bd05 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callProblemDistortedSpeech"); err != nil { - return fmt.Errorf("unable to decode callProblemDistortedSpeech#16a5bd05: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallProblemSilentLocal represents TL type `callProblemSilentLocal#f1e6f36`. -type CallProblemSilentLocal struct { -} - -// CallProblemSilentLocalTypeID is TL type id of CallProblemSilentLocal. -const CallProblemSilentLocalTypeID = 0xf1e6f36 - -// construct implements constructor of CallProblemClass. -func (c CallProblemSilentLocal) construct() CallProblemClass { return &c } - -// Ensuring interfaces in compile-time for CallProblemSilentLocal. -var ( - _ bin.Encoder = &CallProblemSilentLocal{} - _ bin.Decoder = &CallProblemSilentLocal{} - _ bin.BareEncoder = &CallProblemSilentLocal{} - _ bin.BareDecoder = &CallProblemSilentLocal{} - - _ CallProblemClass = &CallProblemSilentLocal{} -) - -func (c *CallProblemSilentLocal) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallProblemSilentLocal) String() string { - if c == nil { - return "CallProblemSilentLocal(nil)" - } - type Alias CallProblemSilentLocal - return fmt.Sprintf("CallProblemSilentLocal%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallProblemSilentLocal) TypeID() uint32 { - return CallProblemSilentLocalTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallProblemSilentLocal) TypeName() string { - return "callProblemSilentLocal" -} - -// TypeInfo returns info about TL type. -func (c *CallProblemSilentLocal) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callProblemSilentLocal", - ID: CallProblemSilentLocalTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallProblemSilentLocal) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemSilentLocal#f1e6f36 as nil") - } - b.PutID(CallProblemSilentLocalTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallProblemSilentLocal) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemSilentLocal#f1e6f36 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallProblemSilentLocal) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemSilentLocal#f1e6f36 to nil") - } - if err := b.ConsumeID(CallProblemSilentLocalTypeID); err != nil { - return fmt.Errorf("unable to decode callProblemSilentLocal#f1e6f36: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallProblemSilentLocal) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemSilentLocal#f1e6f36 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallProblemSilentLocal) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callProblemSilentLocal#f1e6f36 as nil") - } - b.ObjStart() - b.PutID("callProblemSilentLocal") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallProblemSilentLocal) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callProblemSilentLocal#f1e6f36 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callProblemSilentLocal"); err != nil { - return fmt.Errorf("unable to decode callProblemSilentLocal#f1e6f36: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallProblemSilentRemote represents TL type `callProblemSilentRemote#2230f89a`. -type CallProblemSilentRemote struct { -} - -// CallProblemSilentRemoteTypeID is TL type id of CallProblemSilentRemote. -const CallProblemSilentRemoteTypeID = 0x2230f89a - -// construct implements constructor of CallProblemClass. -func (c CallProblemSilentRemote) construct() CallProblemClass { return &c } - -// Ensuring interfaces in compile-time for CallProblemSilentRemote. -var ( - _ bin.Encoder = &CallProblemSilentRemote{} - _ bin.Decoder = &CallProblemSilentRemote{} - _ bin.BareEncoder = &CallProblemSilentRemote{} - _ bin.BareDecoder = &CallProblemSilentRemote{} - - _ CallProblemClass = &CallProblemSilentRemote{} -) - -func (c *CallProblemSilentRemote) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallProblemSilentRemote) String() string { - if c == nil { - return "CallProblemSilentRemote(nil)" - } - type Alias CallProblemSilentRemote - return fmt.Sprintf("CallProblemSilentRemote%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallProblemSilentRemote) TypeID() uint32 { - return CallProblemSilentRemoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallProblemSilentRemote) TypeName() string { - return "callProblemSilentRemote" -} - -// TypeInfo returns info about TL type. -func (c *CallProblemSilentRemote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callProblemSilentRemote", - ID: CallProblemSilentRemoteTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallProblemSilentRemote) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemSilentRemote#2230f89a as nil") - } - b.PutID(CallProblemSilentRemoteTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallProblemSilentRemote) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemSilentRemote#2230f89a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallProblemSilentRemote) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemSilentRemote#2230f89a to nil") - } - if err := b.ConsumeID(CallProblemSilentRemoteTypeID); err != nil { - return fmt.Errorf("unable to decode callProblemSilentRemote#2230f89a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallProblemSilentRemote) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemSilentRemote#2230f89a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallProblemSilentRemote) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callProblemSilentRemote#2230f89a as nil") - } - b.ObjStart() - b.PutID("callProblemSilentRemote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallProblemSilentRemote) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callProblemSilentRemote#2230f89a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callProblemSilentRemote"); err != nil { - return fmt.Errorf("unable to decode callProblemSilentRemote#2230f89a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallProblemDropped represents TL type `callProblemDropped#b809e381`. -type CallProblemDropped struct { -} - -// CallProblemDroppedTypeID is TL type id of CallProblemDropped. -const CallProblemDroppedTypeID = 0xb809e381 - -// construct implements constructor of CallProblemClass. -func (c CallProblemDropped) construct() CallProblemClass { return &c } - -// Ensuring interfaces in compile-time for CallProblemDropped. -var ( - _ bin.Encoder = &CallProblemDropped{} - _ bin.Decoder = &CallProblemDropped{} - _ bin.BareEncoder = &CallProblemDropped{} - _ bin.BareDecoder = &CallProblemDropped{} - - _ CallProblemClass = &CallProblemDropped{} -) - -func (c *CallProblemDropped) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallProblemDropped) String() string { - if c == nil { - return "CallProblemDropped(nil)" - } - type Alias CallProblemDropped - return fmt.Sprintf("CallProblemDropped%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallProblemDropped) TypeID() uint32 { - return CallProblemDroppedTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallProblemDropped) TypeName() string { - return "callProblemDropped" -} - -// TypeInfo returns info about TL type. -func (c *CallProblemDropped) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callProblemDropped", - ID: CallProblemDroppedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallProblemDropped) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemDropped#b809e381 as nil") - } - b.PutID(CallProblemDroppedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallProblemDropped) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemDropped#b809e381 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallProblemDropped) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemDropped#b809e381 to nil") - } - if err := b.ConsumeID(CallProblemDroppedTypeID); err != nil { - return fmt.Errorf("unable to decode callProblemDropped#b809e381: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallProblemDropped) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemDropped#b809e381 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallProblemDropped) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callProblemDropped#b809e381 as nil") - } - b.ObjStart() - b.PutID("callProblemDropped") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallProblemDropped) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callProblemDropped#b809e381 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callProblemDropped"); err != nil { - return fmt.Errorf("unable to decode callProblemDropped#b809e381: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallProblemDistortedVideo represents TL type `callProblemDistortedVideo#16f6620a`. -type CallProblemDistortedVideo struct { -} - -// CallProblemDistortedVideoTypeID is TL type id of CallProblemDistortedVideo. -const CallProblemDistortedVideoTypeID = 0x16f6620a - -// construct implements constructor of CallProblemClass. -func (c CallProblemDistortedVideo) construct() CallProblemClass { return &c } - -// Ensuring interfaces in compile-time for CallProblemDistortedVideo. -var ( - _ bin.Encoder = &CallProblemDistortedVideo{} - _ bin.Decoder = &CallProblemDistortedVideo{} - _ bin.BareEncoder = &CallProblemDistortedVideo{} - _ bin.BareDecoder = &CallProblemDistortedVideo{} - - _ CallProblemClass = &CallProblemDistortedVideo{} -) - -func (c *CallProblemDistortedVideo) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallProblemDistortedVideo) String() string { - if c == nil { - return "CallProblemDistortedVideo(nil)" - } - type Alias CallProblemDistortedVideo - return fmt.Sprintf("CallProblemDistortedVideo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallProblemDistortedVideo) TypeID() uint32 { - return CallProblemDistortedVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallProblemDistortedVideo) TypeName() string { - return "callProblemDistortedVideo" -} - -// TypeInfo returns info about TL type. -func (c *CallProblemDistortedVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callProblemDistortedVideo", - ID: CallProblemDistortedVideoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallProblemDistortedVideo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemDistortedVideo#16f6620a as nil") - } - b.PutID(CallProblemDistortedVideoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallProblemDistortedVideo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemDistortedVideo#16f6620a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallProblemDistortedVideo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemDistortedVideo#16f6620a to nil") - } - if err := b.ConsumeID(CallProblemDistortedVideoTypeID); err != nil { - return fmt.Errorf("unable to decode callProblemDistortedVideo#16f6620a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallProblemDistortedVideo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemDistortedVideo#16f6620a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallProblemDistortedVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callProblemDistortedVideo#16f6620a as nil") - } - b.ObjStart() - b.PutID("callProblemDistortedVideo") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallProblemDistortedVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callProblemDistortedVideo#16f6620a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callProblemDistortedVideo"); err != nil { - return fmt.Errorf("unable to decode callProblemDistortedVideo#16f6620a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallProblemPixelatedVideo represents TL type `callProblemPixelatedVideo#7e1526d3`. -type CallProblemPixelatedVideo struct { -} - -// CallProblemPixelatedVideoTypeID is TL type id of CallProblemPixelatedVideo. -const CallProblemPixelatedVideoTypeID = 0x7e1526d3 - -// construct implements constructor of CallProblemClass. -func (c CallProblemPixelatedVideo) construct() CallProblemClass { return &c } - -// Ensuring interfaces in compile-time for CallProblemPixelatedVideo. -var ( - _ bin.Encoder = &CallProblemPixelatedVideo{} - _ bin.Decoder = &CallProblemPixelatedVideo{} - _ bin.BareEncoder = &CallProblemPixelatedVideo{} - _ bin.BareDecoder = &CallProblemPixelatedVideo{} - - _ CallProblemClass = &CallProblemPixelatedVideo{} -) - -func (c *CallProblemPixelatedVideo) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallProblemPixelatedVideo) String() string { - if c == nil { - return "CallProblemPixelatedVideo(nil)" - } - type Alias CallProblemPixelatedVideo - return fmt.Sprintf("CallProblemPixelatedVideo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallProblemPixelatedVideo) TypeID() uint32 { - return CallProblemPixelatedVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallProblemPixelatedVideo) TypeName() string { - return "callProblemPixelatedVideo" -} - -// TypeInfo returns info about TL type. -func (c *CallProblemPixelatedVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callProblemPixelatedVideo", - ID: CallProblemPixelatedVideoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallProblemPixelatedVideo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemPixelatedVideo#7e1526d3 as nil") - } - b.PutID(CallProblemPixelatedVideoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallProblemPixelatedVideo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProblemPixelatedVideo#7e1526d3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallProblemPixelatedVideo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemPixelatedVideo#7e1526d3 to nil") - } - if err := b.ConsumeID(CallProblemPixelatedVideoTypeID); err != nil { - return fmt.Errorf("unable to decode callProblemPixelatedVideo#7e1526d3: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallProblemPixelatedVideo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProblemPixelatedVideo#7e1526d3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallProblemPixelatedVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callProblemPixelatedVideo#7e1526d3 as nil") - } - b.ObjStart() - b.PutID("callProblemPixelatedVideo") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallProblemPixelatedVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callProblemPixelatedVideo#7e1526d3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callProblemPixelatedVideo"); err != nil { - return fmt.Errorf("unable to decode callProblemPixelatedVideo#7e1526d3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallProblemClassName is schema name of CallProblemClass. -const CallProblemClassName = "CallProblem" - -// CallProblemClass represents CallProblem generic type. -// -// Example: -// -// g, err := tdapi.DecodeCallProblem(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.CallProblemEcho: // callProblemEcho#2fc01184 -// case *tdapi.CallProblemNoise: // callProblemNoise#3ec4808f -// case *tdapi.CallProblemInterruptions: // callProblemInterruptions#42ba1c62 -// case *tdapi.CallProblemDistortedSpeech: // callProblemDistortedSpeech#16a5bd05 -// case *tdapi.CallProblemSilentLocal: // callProblemSilentLocal#f1e6f36 -// case *tdapi.CallProblemSilentRemote: // callProblemSilentRemote#2230f89a -// case *tdapi.CallProblemDropped: // callProblemDropped#b809e381 -// case *tdapi.CallProblemDistortedVideo: // callProblemDistortedVideo#16f6620a -// case *tdapi.CallProblemPixelatedVideo: // callProblemPixelatedVideo#7e1526d3 -// default: panic(v) -// } -type CallProblemClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() CallProblemClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeCallProblem implements binary de-serialization for CallProblemClass. -func DecodeCallProblem(buf *bin.Buffer) (CallProblemClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case CallProblemEchoTypeID: - // Decoding callProblemEcho#2fc01184. - v := CallProblemEcho{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case CallProblemNoiseTypeID: - // Decoding callProblemNoise#3ec4808f. - v := CallProblemNoise{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case CallProblemInterruptionsTypeID: - // Decoding callProblemInterruptions#42ba1c62. - v := CallProblemInterruptions{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case CallProblemDistortedSpeechTypeID: - // Decoding callProblemDistortedSpeech#16a5bd05. - v := CallProblemDistortedSpeech{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case CallProblemSilentLocalTypeID: - // Decoding callProblemSilentLocal#f1e6f36. - v := CallProblemSilentLocal{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case CallProblemSilentRemoteTypeID: - // Decoding callProblemSilentRemote#2230f89a. - v := CallProblemSilentRemote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case CallProblemDroppedTypeID: - // Decoding callProblemDropped#b809e381. - v := CallProblemDropped{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case CallProblemDistortedVideoTypeID: - // Decoding callProblemDistortedVideo#16f6620a. - v := CallProblemDistortedVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case CallProblemPixelatedVideoTypeID: - // Decoding callProblemPixelatedVideo#7e1526d3. - v := CallProblemPixelatedVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONCallProblem implements binary de-serialization for CallProblemClass. -func DecodeTDLibJSONCallProblem(buf tdjson.Decoder) (CallProblemClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "callProblemEcho": - // Decoding callProblemEcho#2fc01184. - v := CallProblemEcho{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case "callProblemNoise": - // Decoding callProblemNoise#3ec4808f. - v := CallProblemNoise{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case "callProblemInterruptions": - // Decoding callProblemInterruptions#42ba1c62. - v := CallProblemInterruptions{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case "callProblemDistortedSpeech": - // Decoding callProblemDistortedSpeech#16a5bd05. - v := CallProblemDistortedSpeech{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case "callProblemSilentLocal": - // Decoding callProblemSilentLocal#f1e6f36. - v := CallProblemSilentLocal{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case "callProblemSilentRemote": - // Decoding callProblemSilentRemote#2230f89a. - v := CallProblemSilentRemote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case "callProblemDropped": - // Decoding callProblemDropped#b809e381. - v := CallProblemDropped{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case "callProblemDistortedVideo": - // Decoding callProblemDistortedVideo#16f6620a. - v := CallProblemDistortedVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - case "callProblemPixelatedVideo": - // Decoding callProblemPixelatedVideo#7e1526d3. - v := CallProblemPixelatedVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CallProblemClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// CallProblem boxes the CallProblemClass providing a helper. -type CallProblemBox struct { - CallProblem CallProblemClass -} - -// Decode implements bin.Decoder for CallProblemBox. -func (b *CallProblemBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode CallProblemBox to nil") - } - v, err := DecodeCallProblem(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CallProblem = v - return nil -} - -// Encode implements bin.Encode for CallProblemBox. -func (b *CallProblemBox) Encode(buf *bin.Buffer) error { - if b == nil || b.CallProblem == nil { - return fmt.Errorf("unable to encode CallProblemClass as nil") - } - return b.CallProblem.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for CallProblemBox. -func (b *CallProblemBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode CallProblemBox to nil") - } - v, err := DecodeTDLibJSONCallProblem(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CallProblem = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for CallProblemBox. -func (b *CallProblemBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.CallProblem == nil { - return fmt.Errorf("unable to encode CallProblemClass as nil") - } - return b.CallProblem.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_call_protocol_gen.go b/tdapi/tl_call_protocol_gen.go deleted file mode 100644 index 4ab08f9d2..000000000 --- a/tdapi/tl_call_protocol_gen.go +++ /dev/null @@ -1,353 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CallProtocol represents TL type `callProtocol#a9a037e`. -type CallProtocol struct { - // True, if UDP peer-to-peer connections are supported - UDPP2P bool - // True, if connection through UDP reflectors is supported - UDPReflector bool - // The minimum supported API layer; use 65 - MinLayer int32 - // The maximum supported API layer; use 92 - MaxLayer int32 - // List of supported tgcalls versions - LibraryVersions []string -} - -// CallProtocolTypeID is TL type id of CallProtocol. -const CallProtocolTypeID = 0xa9a037e - -// Ensuring interfaces in compile-time for CallProtocol. -var ( - _ bin.Encoder = &CallProtocol{} - _ bin.Decoder = &CallProtocol{} - _ bin.BareEncoder = &CallProtocol{} - _ bin.BareDecoder = &CallProtocol{} -) - -func (c *CallProtocol) Zero() bool { - if c == nil { - return true - } - if !(c.UDPP2P == false) { - return false - } - if !(c.UDPReflector == false) { - return false - } - if !(c.MinLayer == 0) { - return false - } - if !(c.MaxLayer == 0) { - return false - } - if !(c.LibraryVersions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallProtocol) String() string { - if c == nil { - return "CallProtocol(nil)" - } - type Alias CallProtocol - return fmt.Sprintf("CallProtocol%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallProtocol) TypeID() uint32 { - return CallProtocolTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallProtocol) TypeName() string { - return "callProtocol" -} - -// TypeInfo returns info about TL type. -func (c *CallProtocol) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callProtocol", - ID: CallProtocolTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UDPP2P", - SchemaName: "udp_p2p", - }, - { - Name: "UDPReflector", - SchemaName: "udp_reflector", - }, - { - Name: "MinLayer", - SchemaName: "min_layer", - }, - { - Name: "MaxLayer", - SchemaName: "max_layer", - }, - { - Name: "LibraryVersions", - SchemaName: "library_versions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallProtocol) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProtocol#a9a037e as nil") - } - b.PutID(CallProtocolTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallProtocol) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callProtocol#a9a037e as nil") - } - b.PutBool(c.UDPP2P) - b.PutBool(c.UDPReflector) - b.PutInt32(c.MinLayer) - b.PutInt32(c.MaxLayer) - b.PutInt(len(c.LibraryVersions)) - for _, v := range c.LibraryVersions { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallProtocol) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProtocol#a9a037e to nil") - } - if err := b.ConsumeID(CallProtocolTypeID); err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallProtocol) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callProtocol#a9a037e to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field udp_p2p: %w", err) - } - c.UDPP2P = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field udp_reflector: %w", err) - } - c.UDPReflector = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field min_layer: %w", err) - } - c.MinLayer = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field max_layer: %w", err) - } - c.MaxLayer = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field library_versions: %w", err) - } - - if headerLen > 0 { - c.LibraryVersions = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field library_versions: %w", err) - } - c.LibraryVersions = append(c.LibraryVersions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallProtocol) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callProtocol#a9a037e as nil") - } - b.ObjStart() - b.PutID("callProtocol") - b.Comma() - b.FieldStart("udp_p2p") - b.PutBool(c.UDPP2P) - b.Comma() - b.FieldStart("udp_reflector") - b.PutBool(c.UDPReflector) - b.Comma() - b.FieldStart("min_layer") - b.PutInt32(c.MinLayer) - b.Comma() - b.FieldStart("max_layer") - b.PutInt32(c.MaxLayer) - b.Comma() - b.FieldStart("library_versions") - b.ArrStart() - for _, v := range c.LibraryVersions { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallProtocol) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callProtocol#a9a037e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callProtocol"); err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: %w", err) - } - case "udp_p2p": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field udp_p2p: %w", err) - } - c.UDPP2P = value - case "udp_reflector": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field udp_reflector: %w", err) - } - c.UDPReflector = value - case "min_layer": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field min_layer: %w", err) - } - c.MinLayer = value - case "max_layer": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field max_layer: %w", err) - } - c.MaxLayer = value - case "library_versions": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field library_versions: %w", err) - } - c.LibraryVersions = append(c.LibraryVersions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode callProtocol#a9a037e: field library_versions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUDPP2P returns value of UDPP2P field. -func (c *CallProtocol) GetUDPP2P() (value bool) { - if c == nil { - return - } - return c.UDPP2P -} - -// GetUDPReflector returns value of UDPReflector field. -func (c *CallProtocol) GetUDPReflector() (value bool) { - if c == nil { - return - } - return c.UDPReflector -} - -// GetMinLayer returns value of MinLayer field. -func (c *CallProtocol) GetMinLayer() (value int32) { - if c == nil { - return - } - return c.MinLayer -} - -// GetMaxLayer returns value of MaxLayer field. -func (c *CallProtocol) GetMaxLayer() (value int32) { - if c == nil { - return - } - return c.MaxLayer -} - -// GetLibraryVersions returns value of LibraryVersions field. -func (c *CallProtocol) GetLibraryVersions() (value []string) { - if c == nil { - return - } - return c.LibraryVersions -} diff --git a/tdapi/tl_call_server_gen.go b/tdapi/tl_call_server_gen.go deleted file mode 100644 index 848e20fc1..000000000 --- a/tdapi/tl_call_server_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CallServer represents TL type `callServer#6f37df97`. -type CallServer struct { - // Server identifier - ID int64 - // Server IPv4 address - IPAddress string - // Server IPv6 address - Ipv6Address string - // Server port number - Port int32 - // Server type - Type CallServerTypeClass -} - -// CallServerTypeID is TL type id of CallServer. -const CallServerTypeID = 0x6f37df97 - -// Ensuring interfaces in compile-time for CallServer. -var ( - _ bin.Encoder = &CallServer{} - _ bin.Decoder = &CallServer{} - _ bin.BareEncoder = &CallServer{} - _ bin.BareDecoder = &CallServer{} -) - -func (c *CallServer) Zero() bool { - if c == nil { - return true - } - if !(c.ID == 0) { - return false - } - if !(c.IPAddress == "") { - return false - } - if !(c.Ipv6Address == "") { - return false - } - if !(c.Port == 0) { - return false - } - if !(c.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallServer) String() string { - if c == nil { - return "CallServer(nil)" - } - type Alias CallServer - return fmt.Sprintf("CallServer%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallServer) TypeID() uint32 { - return CallServerTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallServer) TypeName() string { - return "callServer" -} - -// TypeInfo returns info about TL type. -func (c *CallServer) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callServer", - ID: CallServerTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "IPAddress", - SchemaName: "ip_address", - }, - { - Name: "Ipv6Address", - SchemaName: "ipv6_address", - }, - { - Name: "Port", - SchemaName: "port", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallServer) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callServer#6f37df97 as nil") - } - b.PutID(CallServerTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallServer) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callServer#6f37df97 as nil") - } - b.PutLong(c.ID) - b.PutString(c.IPAddress) - b.PutString(c.Ipv6Address) - b.PutInt32(c.Port) - if c.Type == nil { - return fmt.Errorf("unable to encode callServer#6f37df97: field type is nil") - } - if err := c.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode callServer#6f37df97: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallServer) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callServer#6f37df97 to nil") - } - if err := b.ConsumeID(CallServerTypeID); err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallServer) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callServer#6f37df97 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: field id: %w", err) - } - c.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: field ip_address: %w", err) - } - c.IPAddress = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: field ipv6_address: %w", err) - } - c.Ipv6Address = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: field port: %w", err) - } - c.Port = value - } - { - value, err := DecodeCallServerType(b) - if err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: field type: %w", err) - } - c.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallServer) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callServer#6f37df97 as nil") - } - b.ObjStart() - b.PutID("callServer") - b.Comma() - b.FieldStart("id") - b.PutLong(c.ID) - b.Comma() - b.FieldStart("ip_address") - b.PutString(c.IPAddress) - b.Comma() - b.FieldStart("ipv6_address") - b.PutString(c.Ipv6Address) - b.Comma() - b.FieldStart("port") - b.PutInt32(c.Port) - b.Comma() - b.FieldStart("type") - if c.Type == nil { - return fmt.Errorf("unable to encode callServer#6f37df97: field type is nil") - } - if err := c.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode callServer#6f37df97: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallServer) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callServer#6f37df97 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callServer"); err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: field id: %w", err) - } - c.ID = value - case "ip_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: field ip_address: %w", err) - } - c.IPAddress = value - case "ipv6_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: field ipv6_address: %w", err) - } - c.Ipv6Address = value - case "port": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: field port: %w", err) - } - c.Port = value - case "type": - value, err := DecodeTDLibJSONCallServerType(b) - if err != nil { - return fmt.Errorf("unable to decode callServer#6f37df97: field type: %w", err) - } - c.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (c *CallServer) GetID() (value int64) { - if c == nil { - return - } - return c.ID -} - -// GetIPAddress returns value of IPAddress field. -func (c *CallServer) GetIPAddress() (value string) { - if c == nil { - return - } - return c.IPAddress -} - -// GetIpv6Address returns value of Ipv6Address field. -func (c *CallServer) GetIpv6Address() (value string) { - if c == nil { - return - } - return c.Ipv6Address -} - -// GetPort returns value of Port field. -func (c *CallServer) GetPort() (value int32) { - if c == nil { - return - } - return c.Port -} - -// GetType returns value of Type field. -func (c *CallServer) GetType() (value CallServerTypeClass) { - if c == nil { - return - } - return c.Type -} diff --git a/tdapi/tl_call_server_type_gen.go b/tdapi/tl_call_server_type_gen.go deleted file mode 100644 index d576a9206..000000000 --- a/tdapi/tl_call_server_type_gen.go +++ /dev/null @@ -1,637 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CallServerTypeTelegramReflector represents TL type `callServerTypeTelegramReflector#32af3515`. -type CallServerTypeTelegramReflector struct { - // A peer tag to be used with the reflector - PeerTag []byte - // True, if the server uses TCP instead of UDP - IsTCP bool -} - -// CallServerTypeTelegramReflectorTypeID is TL type id of CallServerTypeTelegramReflector. -const CallServerTypeTelegramReflectorTypeID = 0x32af3515 - -// construct implements constructor of CallServerTypeClass. -func (c CallServerTypeTelegramReflector) construct() CallServerTypeClass { return &c } - -// Ensuring interfaces in compile-time for CallServerTypeTelegramReflector. -var ( - _ bin.Encoder = &CallServerTypeTelegramReflector{} - _ bin.Decoder = &CallServerTypeTelegramReflector{} - _ bin.BareEncoder = &CallServerTypeTelegramReflector{} - _ bin.BareDecoder = &CallServerTypeTelegramReflector{} - - _ CallServerTypeClass = &CallServerTypeTelegramReflector{} -) - -func (c *CallServerTypeTelegramReflector) Zero() bool { - if c == nil { - return true - } - if !(c.PeerTag == nil) { - return false - } - if !(c.IsTCP == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallServerTypeTelegramReflector) String() string { - if c == nil { - return "CallServerTypeTelegramReflector(nil)" - } - type Alias CallServerTypeTelegramReflector - return fmt.Sprintf("CallServerTypeTelegramReflector%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallServerTypeTelegramReflector) TypeID() uint32 { - return CallServerTypeTelegramReflectorTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallServerTypeTelegramReflector) TypeName() string { - return "callServerTypeTelegramReflector" -} - -// TypeInfo returns info about TL type. -func (c *CallServerTypeTelegramReflector) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callServerTypeTelegramReflector", - ID: CallServerTypeTelegramReflectorTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PeerTag", - SchemaName: "peer_tag", - }, - { - Name: "IsTCP", - SchemaName: "is_tcp", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallServerTypeTelegramReflector) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callServerTypeTelegramReflector#32af3515 as nil") - } - b.PutID(CallServerTypeTelegramReflectorTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallServerTypeTelegramReflector) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callServerTypeTelegramReflector#32af3515 as nil") - } - b.PutBytes(c.PeerTag) - b.PutBool(c.IsTCP) - return nil -} - -// Decode implements bin.Decoder. -func (c *CallServerTypeTelegramReflector) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callServerTypeTelegramReflector#32af3515 to nil") - } - if err := b.ConsumeID(CallServerTypeTelegramReflectorTypeID); err != nil { - return fmt.Errorf("unable to decode callServerTypeTelegramReflector#32af3515: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallServerTypeTelegramReflector) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callServerTypeTelegramReflector#32af3515 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeTelegramReflector#32af3515: field peer_tag: %w", err) - } - c.PeerTag = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeTelegramReflector#32af3515: field is_tcp: %w", err) - } - c.IsTCP = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallServerTypeTelegramReflector) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callServerTypeTelegramReflector#32af3515 as nil") - } - b.ObjStart() - b.PutID("callServerTypeTelegramReflector") - b.Comma() - b.FieldStart("peer_tag") - b.PutBytes(c.PeerTag) - b.Comma() - b.FieldStart("is_tcp") - b.PutBool(c.IsTCP) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallServerTypeTelegramReflector) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callServerTypeTelegramReflector#32af3515 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callServerTypeTelegramReflector"); err != nil { - return fmt.Errorf("unable to decode callServerTypeTelegramReflector#32af3515: %w", err) - } - case "peer_tag": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeTelegramReflector#32af3515: field peer_tag: %w", err) - } - c.PeerTag = value - case "is_tcp": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeTelegramReflector#32af3515: field is_tcp: %w", err) - } - c.IsTCP = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPeerTag returns value of PeerTag field. -func (c *CallServerTypeTelegramReflector) GetPeerTag() (value []byte) { - if c == nil { - return - } - return c.PeerTag -} - -// GetIsTCP returns value of IsTCP field. -func (c *CallServerTypeTelegramReflector) GetIsTCP() (value bool) { - if c == nil { - return - } - return c.IsTCP -} - -// CallServerTypeWebrtc represents TL type `callServerTypeWebrtc#4a8afd65`. -type CallServerTypeWebrtc struct { - // Username to be used for authentication - Username string - // Authentication password - Password string - // True, if the server supports TURN - SupportsTurn bool - // True, if the server supports STUN - SupportsStun bool -} - -// CallServerTypeWebrtcTypeID is TL type id of CallServerTypeWebrtc. -const CallServerTypeWebrtcTypeID = 0x4a8afd65 - -// construct implements constructor of CallServerTypeClass. -func (c CallServerTypeWebrtc) construct() CallServerTypeClass { return &c } - -// Ensuring interfaces in compile-time for CallServerTypeWebrtc. -var ( - _ bin.Encoder = &CallServerTypeWebrtc{} - _ bin.Decoder = &CallServerTypeWebrtc{} - _ bin.BareEncoder = &CallServerTypeWebrtc{} - _ bin.BareDecoder = &CallServerTypeWebrtc{} - - _ CallServerTypeClass = &CallServerTypeWebrtc{} -) - -func (c *CallServerTypeWebrtc) Zero() bool { - if c == nil { - return true - } - if !(c.Username == "") { - return false - } - if !(c.Password == "") { - return false - } - if !(c.SupportsTurn == false) { - return false - } - if !(c.SupportsStun == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallServerTypeWebrtc) String() string { - if c == nil { - return "CallServerTypeWebrtc(nil)" - } - type Alias CallServerTypeWebrtc - return fmt.Sprintf("CallServerTypeWebrtc%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallServerTypeWebrtc) TypeID() uint32 { - return CallServerTypeWebrtcTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallServerTypeWebrtc) TypeName() string { - return "callServerTypeWebrtc" -} - -// TypeInfo returns info about TL type. -func (c *CallServerTypeWebrtc) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callServerTypeWebrtc", - ID: CallServerTypeWebrtcTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Username", - SchemaName: "username", - }, - { - Name: "Password", - SchemaName: "password", - }, - { - Name: "SupportsTurn", - SchemaName: "supports_turn", - }, - { - Name: "SupportsStun", - SchemaName: "supports_stun", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallServerTypeWebrtc) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callServerTypeWebrtc#4a8afd65 as nil") - } - b.PutID(CallServerTypeWebrtcTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallServerTypeWebrtc) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callServerTypeWebrtc#4a8afd65 as nil") - } - b.PutString(c.Username) - b.PutString(c.Password) - b.PutBool(c.SupportsTurn) - b.PutBool(c.SupportsStun) - return nil -} - -// Decode implements bin.Decoder. -func (c *CallServerTypeWebrtc) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callServerTypeWebrtc#4a8afd65 to nil") - } - if err := b.ConsumeID(CallServerTypeWebrtcTypeID); err != nil { - return fmt.Errorf("unable to decode callServerTypeWebrtc#4a8afd65: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallServerTypeWebrtc) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callServerTypeWebrtc#4a8afd65 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeWebrtc#4a8afd65: field username: %w", err) - } - c.Username = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeWebrtc#4a8afd65: field password: %w", err) - } - c.Password = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeWebrtc#4a8afd65: field supports_turn: %w", err) - } - c.SupportsTurn = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeWebrtc#4a8afd65: field supports_stun: %w", err) - } - c.SupportsStun = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallServerTypeWebrtc) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callServerTypeWebrtc#4a8afd65 as nil") - } - b.ObjStart() - b.PutID("callServerTypeWebrtc") - b.Comma() - b.FieldStart("username") - b.PutString(c.Username) - b.Comma() - b.FieldStart("password") - b.PutString(c.Password) - b.Comma() - b.FieldStart("supports_turn") - b.PutBool(c.SupportsTurn) - b.Comma() - b.FieldStart("supports_stun") - b.PutBool(c.SupportsStun) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallServerTypeWebrtc) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callServerTypeWebrtc#4a8afd65 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callServerTypeWebrtc"); err != nil { - return fmt.Errorf("unable to decode callServerTypeWebrtc#4a8afd65: %w", err) - } - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeWebrtc#4a8afd65: field username: %w", err) - } - c.Username = value - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeWebrtc#4a8afd65: field password: %w", err) - } - c.Password = value - case "supports_turn": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeWebrtc#4a8afd65: field supports_turn: %w", err) - } - c.SupportsTurn = value - case "supports_stun": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callServerTypeWebrtc#4a8afd65: field supports_stun: %w", err) - } - c.SupportsStun = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUsername returns value of Username field. -func (c *CallServerTypeWebrtc) GetUsername() (value string) { - if c == nil { - return - } - return c.Username -} - -// GetPassword returns value of Password field. -func (c *CallServerTypeWebrtc) GetPassword() (value string) { - if c == nil { - return - } - return c.Password -} - -// GetSupportsTurn returns value of SupportsTurn field. -func (c *CallServerTypeWebrtc) GetSupportsTurn() (value bool) { - if c == nil { - return - } - return c.SupportsTurn -} - -// GetSupportsStun returns value of SupportsStun field. -func (c *CallServerTypeWebrtc) GetSupportsStun() (value bool) { - if c == nil { - return - } - return c.SupportsStun -} - -// CallServerTypeClassName is schema name of CallServerTypeClass. -const CallServerTypeClassName = "CallServerType" - -// CallServerTypeClass represents CallServerType generic type. -// -// Example: -// -// g, err := tdapi.DecodeCallServerType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.CallServerTypeTelegramReflector: // callServerTypeTelegramReflector#32af3515 -// case *tdapi.CallServerTypeWebrtc: // callServerTypeWebrtc#4a8afd65 -// default: panic(v) -// } -type CallServerTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() CallServerTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeCallServerType implements binary de-serialization for CallServerTypeClass. -func DecodeCallServerType(buf *bin.Buffer) (CallServerTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case CallServerTypeTelegramReflectorTypeID: - // Decoding callServerTypeTelegramReflector#32af3515. - v := CallServerTypeTelegramReflector{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallServerTypeClass: %w", err) - } - return &v, nil - case CallServerTypeWebrtcTypeID: - // Decoding callServerTypeWebrtc#4a8afd65. - v := CallServerTypeWebrtc{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallServerTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CallServerTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONCallServerType implements binary de-serialization for CallServerTypeClass. -func DecodeTDLibJSONCallServerType(buf tdjson.Decoder) (CallServerTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "callServerTypeTelegramReflector": - // Decoding callServerTypeTelegramReflector#32af3515. - v := CallServerTypeTelegramReflector{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallServerTypeClass: %w", err) - } - return &v, nil - case "callServerTypeWebrtc": - // Decoding callServerTypeWebrtc#4a8afd65. - v := CallServerTypeWebrtc{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallServerTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CallServerTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// CallServerType boxes the CallServerTypeClass providing a helper. -type CallServerTypeBox struct { - CallServerType CallServerTypeClass -} - -// Decode implements bin.Decoder for CallServerTypeBox. -func (b *CallServerTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode CallServerTypeBox to nil") - } - v, err := DecodeCallServerType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CallServerType = v - return nil -} - -// Encode implements bin.Encode for CallServerTypeBox. -func (b *CallServerTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.CallServerType == nil { - return fmt.Errorf("unable to encode CallServerTypeClass as nil") - } - return b.CallServerType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for CallServerTypeBox. -func (b *CallServerTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode CallServerTypeBox to nil") - } - v, err := DecodeTDLibJSONCallServerType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CallServerType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for CallServerTypeBox. -func (b *CallServerTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.CallServerType == nil { - return fmt.Errorf("unable to encode CallServerTypeClass as nil") - } - return b.CallServerType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_call_state_gen.go b/tdapi/tl_call_state_gen.go deleted file mode 100644 index 14303a35d..000000000 --- a/tdapi/tl_call_state_gen.go +++ /dev/null @@ -1,1558 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CallStatePending represents TL type `callStatePending#3ff56c2c`. -type CallStatePending struct { - // True, if the call has already been created by the server - IsCreated bool - // True, if the call has already been received by the other party - IsReceived bool -} - -// CallStatePendingTypeID is TL type id of CallStatePending. -const CallStatePendingTypeID = 0x3ff56c2c - -// construct implements constructor of CallStateClass. -func (c CallStatePending) construct() CallStateClass { return &c } - -// Ensuring interfaces in compile-time for CallStatePending. -var ( - _ bin.Encoder = &CallStatePending{} - _ bin.Decoder = &CallStatePending{} - _ bin.BareEncoder = &CallStatePending{} - _ bin.BareDecoder = &CallStatePending{} - - _ CallStateClass = &CallStatePending{} -) - -func (c *CallStatePending) Zero() bool { - if c == nil { - return true - } - if !(c.IsCreated == false) { - return false - } - if !(c.IsReceived == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallStatePending) String() string { - if c == nil { - return "CallStatePending(nil)" - } - type Alias CallStatePending - return fmt.Sprintf("CallStatePending%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallStatePending) TypeID() uint32 { - return CallStatePendingTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallStatePending) TypeName() string { - return "callStatePending" -} - -// TypeInfo returns info about TL type. -func (c *CallStatePending) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callStatePending", - ID: CallStatePendingTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsCreated", - SchemaName: "is_created", - }, - { - Name: "IsReceived", - SchemaName: "is_received", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallStatePending) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStatePending#3ff56c2c as nil") - } - b.PutID(CallStatePendingTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallStatePending) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStatePending#3ff56c2c as nil") - } - b.PutBool(c.IsCreated) - b.PutBool(c.IsReceived) - return nil -} - -// Decode implements bin.Decoder. -func (c *CallStatePending) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStatePending#3ff56c2c to nil") - } - if err := b.ConsumeID(CallStatePendingTypeID); err != nil { - return fmt.Errorf("unable to decode callStatePending#3ff56c2c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallStatePending) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStatePending#3ff56c2c to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStatePending#3ff56c2c: field is_created: %w", err) - } - c.IsCreated = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStatePending#3ff56c2c: field is_received: %w", err) - } - c.IsReceived = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallStatePending) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callStatePending#3ff56c2c as nil") - } - b.ObjStart() - b.PutID("callStatePending") - b.Comma() - b.FieldStart("is_created") - b.PutBool(c.IsCreated) - b.Comma() - b.FieldStart("is_received") - b.PutBool(c.IsReceived) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallStatePending) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callStatePending#3ff56c2c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callStatePending"); err != nil { - return fmt.Errorf("unable to decode callStatePending#3ff56c2c: %w", err) - } - case "is_created": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStatePending#3ff56c2c: field is_created: %w", err) - } - c.IsCreated = value - case "is_received": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStatePending#3ff56c2c: field is_received: %w", err) - } - c.IsReceived = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsCreated returns value of IsCreated field. -func (c *CallStatePending) GetIsCreated() (value bool) { - if c == nil { - return - } - return c.IsCreated -} - -// GetIsReceived returns value of IsReceived field. -func (c *CallStatePending) GetIsReceived() (value bool) { - if c == nil { - return - } - return c.IsReceived -} - -// CallStateExchangingKeys represents TL type `callStateExchangingKeys#91d77a65`. -type CallStateExchangingKeys struct { -} - -// CallStateExchangingKeysTypeID is TL type id of CallStateExchangingKeys. -const CallStateExchangingKeysTypeID = 0x91d77a65 - -// construct implements constructor of CallStateClass. -func (c CallStateExchangingKeys) construct() CallStateClass { return &c } - -// Ensuring interfaces in compile-time for CallStateExchangingKeys. -var ( - _ bin.Encoder = &CallStateExchangingKeys{} - _ bin.Decoder = &CallStateExchangingKeys{} - _ bin.BareEncoder = &CallStateExchangingKeys{} - _ bin.BareDecoder = &CallStateExchangingKeys{} - - _ CallStateClass = &CallStateExchangingKeys{} -) - -func (c *CallStateExchangingKeys) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallStateExchangingKeys) String() string { - if c == nil { - return "CallStateExchangingKeys(nil)" - } - type Alias CallStateExchangingKeys - return fmt.Sprintf("CallStateExchangingKeys%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallStateExchangingKeys) TypeID() uint32 { - return CallStateExchangingKeysTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallStateExchangingKeys) TypeName() string { - return "callStateExchangingKeys" -} - -// TypeInfo returns info about TL type. -func (c *CallStateExchangingKeys) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callStateExchangingKeys", - ID: CallStateExchangingKeysTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallStateExchangingKeys) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStateExchangingKeys#91d77a65 as nil") - } - b.PutID(CallStateExchangingKeysTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallStateExchangingKeys) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStateExchangingKeys#91d77a65 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallStateExchangingKeys) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStateExchangingKeys#91d77a65 to nil") - } - if err := b.ConsumeID(CallStateExchangingKeysTypeID); err != nil { - return fmt.Errorf("unable to decode callStateExchangingKeys#91d77a65: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallStateExchangingKeys) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStateExchangingKeys#91d77a65 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallStateExchangingKeys) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callStateExchangingKeys#91d77a65 as nil") - } - b.ObjStart() - b.PutID("callStateExchangingKeys") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallStateExchangingKeys) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callStateExchangingKeys#91d77a65 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callStateExchangingKeys"); err != nil { - return fmt.Errorf("unable to decode callStateExchangingKeys#91d77a65: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallStateReady represents TL type `callStateReady#17038381`. -type CallStateReady struct { - // Call protocols supported by the other call participant - Protocol CallProtocol - // List of available call servers - Servers []CallServer - // A JSON-encoded call config - Config string - // Call encryption key - EncryptionKey []byte - // Encryption key fingerprint represented as 4 emoji - Emojis []string - // True, if peer-to-peer connection is allowed by users privacy settings - AllowP2P bool - // Custom JSON-encoded call parameters to be passed to tgcalls - CustomParameters string -} - -// CallStateReadyTypeID is TL type id of CallStateReady. -const CallStateReadyTypeID = 0x17038381 - -// construct implements constructor of CallStateClass. -func (c CallStateReady) construct() CallStateClass { return &c } - -// Ensuring interfaces in compile-time for CallStateReady. -var ( - _ bin.Encoder = &CallStateReady{} - _ bin.Decoder = &CallStateReady{} - _ bin.BareEncoder = &CallStateReady{} - _ bin.BareDecoder = &CallStateReady{} - - _ CallStateClass = &CallStateReady{} -) - -func (c *CallStateReady) Zero() bool { - if c == nil { - return true - } - if !(c.Protocol.Zero()) { - return false - } - if !(c.Servers == nil) { - return false - } - if !(c.Config == "") { - return false - } - if !(c.EncryptionKey == nil) { - return false - } - if !(c.Emojis == nil) { - return false - } - if !(c.AllowP2P == false) { - return false - } - if !(c.CustomParameters == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallStateReady) String() string { - if c == nil { - return "CallStateReady(nil)" - } - type Alias CallStateReady - return fmt.Sprintf("CallStateReady%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallStateReady) TypeID() uint32 { - return CallStateReadyTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallStateReady) TypeName() string { - return "callStateReady" -} - -// TypeInfo returns info about TL type. -func (c *CallStateReady) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callStateReady", - ID: CallStateReadyTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Protocol", - SchemaName: "protocol", - }, - { - Name: "Servers", - SchemaName: "servers", - }, - { - Name: "Config", - SchemaName: "config", - }, - { - Name: "EncryptionKey", - SchemaName: "encryption_key", - }, - { - Name: "Emojis", - SchemaName: "emojis", - }, - { - Name: "AllowP2P", - SchemaName: "allow_p2p", - }, - { - Name: "CustomParameters", - SchemaName: "custom_parameters", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallStateReady) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStateReady#17038381 as nil") - } - b.PutID(CallStateReadyTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallStateReady) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStateReady#17038381 as nil") - } - if err := c.Protocol.Encode(b); err != nil { - return fmt.Errorf("unable to encode callStateReady#17038381: field protocol: %w", err) - } - b.PutInt(len(c.Servers)) - for idx, v := range c.Servers { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare callStateReady#17038381: field servers element with index %d: %w", idx, err) - } - } - b.PutString(c.Config) - b.PutBytes(c.EncryptionKey) - b.PutInt(len(c.Emojis)) - for _, v := range c.Emojis { - b.PutString(v) - } - b.PutBool(c.AllowP2P) - b.PutString(c.CustomParameters) - return nil -} - -// Decode implements bin.Decoder. -func (c *CallStateReady) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStateReady#17038381 to nil") - } - if err := b.ConsumeID(CallStateReadyTypeID); err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallStateReady) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStateReady#17038381 to nil") - } - { - if err := c.Protocol.Decode(b); err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field protocol: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field servers: %w", err) - } - - if headerLen > 0 { - c.Servers = make([]CallServer, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value CallServer - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare callStateReady#17038381: field servers: %w", err) - } - c.Servers = append(c.Servers, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field config: %w", err) - } - c.Config = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field encryption_key: %w", err) - } - c.EncryptionKey = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field emojis: %w", err) - } - - if headerLen > 0 { - c.Emojis = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field emojis: %w", err) - } - c.Emojis = append(c.Emojis, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field allow_p2p: %w", err) - } - c.AllowP2P = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field custom_parameters: %w", err) - } - c.CustomParameters = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallStateReady) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callStateReady#17038381 as nil") - } - b.ObjStart() - b.PutID("callStateReady") - b.Comma() - b.FieldStart("protocol") - if err := c.Protocol.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode callStateReady#17038381: field protocol: %w", err) - } - b.Comma() - b.FieldStart("servers") - b.ArrStart() - for idx, v := range c.Servers { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode callStateReady#17038381: field servers element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("config") - b.PutString(c.Config) - b.Comma() - b.FieldStart("encryption_key") - b.PutBytes(c.EncryptionKey) - b.Comma() - b.FieldStart("emojis") - b.ArrStart() - for _, v := range c.Emojis { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("allow_p2p") - b.PutBool(c.AllowP2P) - b.Comma() - b.FieldStart("custom_parameters") - b.PutString(c.CustomParameters) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallStateReady) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callStateReady#17038381 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callStateReady"); err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: %w", err) - } - case "protocol": - if err := c.Protocol.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field protocol: %w", err) - } - case "servers": - if err := b.Arr(func(b tdjson.Decoder) error { - var value CallServer - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field servers: %w", err) - } - c.Servers = append(c.Servers, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field servers: %w", err) - } - case "config": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field config: %w", err) - } - c.Config = value - case "encryption_key": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field encryption_key: %w", err) - } - c.EncryptionKey = value - case "emojis": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field emojis: %w", err) - } - c.Emojis = append(c.Emojis, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field emojis: %w", err) - } - case "allow_p2p": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field allow_p2p: %w", err) - } - c.AllowP2P = value - case "custom_parameters": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callStateReady#17038381: field custom_parameters: %w", err) - } - c.CustomParameters = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProtocol returns value of Protocol field. -func (c *CallStateReady) GetProtocol() (value CallProtocol) { - if c == nil { - return - } - return c.Protocol -} - -// GetServers returns value of Servers field. -func (c *CallStateReady) GetServers() (value []CallServer) { - if c == nil { - return - } - return c.Servers -} - -// GetConfig returns value of Config field. -func (c *CallStateReady) GetConfig() (value string) { - if c == nil { - return - } - return c.Config -} - -// GetEncryptionKey returns value of EncryptionKey field. -func (c *CallStateReady) GetEncryptionKey() (value []byte) { - if c == nil { - return - } - return c.EncryptionKey -} - -// GetEmojis returns value of Emojis field. -func (c *CallStateReady) GetEmojis() (value []string) { - if c == nil { - return - } - return c.Emojis -} - -// GetAllowP2P returns value of AllowP2P field. -func (c *CallStateReady) GetAllowP2P() (value bool) { - if c == nil { - return - } - return c.AllowP2P -} - -// GetCustomParameters returns value of CustomParameters field. -func (c *CallStateReady) GetCustomParameters() (value string) { - if c == nil { - return - } - return c.CustomParameters -} - -// CallStateHangingUp represents TL type `callStateHangingUp#80d0f2aa`. -type CallStateHangingUp struct { -} - -// CallStateHangingUpTypeID is TL type id of CallStateHangingUp. -const CallStateHangingUpTypeID = 0x80d0f2aa - -// construct implements constructor of CallStateClass. -func (c CallStateHangingUp) construct() CallStateClass { return &c } - -// Ensuring interfaces in compile-time for CallStateHangingUp. -var ( - _ bin.Encoder = &CallStateHangingUp{} - _ bin.Decoder = &CallStateHangingUp{} - _ bin.BareEncoder = &CallStateHangingUp{} - _ bin.BareDecoder = &CallStateHangingUp{} - - _ CallStateClass = &CallStateHangingUp{} -) - -func (c *CallStateHangingUp) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallStateHangingUp) String() string { - if c == nil { - return "CallStateHangingUp(nil)" - } - type Alias CallStateHangingUp - return fmt.Sprintf("CallStateHangingUp%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallStateHangingUp) TypeID() uint32 { - return CallStateHangingUpTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallStateHangingUp) TypeName() string { - return "callStateHangingUp" -} - -// TypeInfo returns info about TL type. -func (c *CallStateHangingUp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callStateHangingUp", - ID: CallStateHangingUpTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CallStateHangingUp) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStateHangingUp#80d0f2aa as nil") - } - b.PutID(CallStateHangingUpTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallStateHangingUp) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStateHangingUp#80d0f2aa as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallStateHangingUp) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStateHangingUp#80d0f2aa to nil") - } - if err := b.ConsumeID(CallStateHangingUpTypeID); err != nil { - return fmt.Errorf("unable to decode callStateHangingUp#80d0f2aa: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallStateHangingUp) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStateHangingUp#80d0f2aa to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallStateHangingUp) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callStateHangingUp#80d0f2aa as nil") - } - b.ObjStart() - b.PutID("callStateHangingUp") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallStateHangingUp) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callStateHangingUp#80d0f2aa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callStateHangingUp"); err != nil { - return fmt.Errorf("unable to decode callStateHangingUp#80d0f2aa: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CallStateDiscarded represents TL type `callStateDiscarded#531b7c45`. -type CallStateDiscarded struct { - // The reason why the call has ended - Reason CallDiscardReasonClass - // True, if the call rating must be sent to the server - NeedRating bool - // True, if the call debug information must be sent to the server - NeedDebugInformation bool - // True, if the call log must be sent to the server - NeedLog bool -} - -// CallStateDiscardedTypeID is TL type id of CallStateDiscarded. -const CallStateDiscardedTypeID = 0x531b7c45 - -// construct implements constructor of CallStateClass. -func (c CallStateDiscarded) construct() CallStateClass { return &c } - -// Ensuring interfaces in compile-time for CallStateDiscarded. -var ( - _ bin.Encoder = &CallStateDiscarded{} - _ bin.Decoder = &CallStateDiscarded{} - _ bin.BareEncoder = &CallStateDiscarded{} - _ bin.BareDecoder = &CallStateDiscarded{} - - _ CallStateClass = &CallStateDiscarded{} -) - -func (c *CallStateDiscarded) Zero() bool { - if c == nil { - return true - } - if !(c.Reason == nil) { - return false - } - if !(c.NeedRating == false) { - return false - } - if !(c.NeedDebugInformation == false) { - return false - } - if !(c.NeedLog == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallStateDiscarded) String() string { - if c == nil { - return "CallStateDiscarded(nil)" - } - type Alias CallStateDiscarded - return fmt.Sprintf("CallStateDiscarded%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallStateDiscarded) TypeID() uint32 { - return CallStateDiscardedTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallStateDiscarded) TypeName() string { - return "callStateDiscarded" -} - -// TypeInfo returns info about TL type. -func (c *CallStateDiscarded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callStateDiscarded", - ID: CallStateDiscardedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Reason", - SchemaName: "reason", - }, - { - Name: "NeedRating", - SchemaName: "need_rating", - }, - { - Name: "NeedDebugInformation", - SchemaName: "need_debug_information", - }, - { - Name: "NeedLog", - SchemaName: "need_log", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallStateDiscarded) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStateDiscarded#531b7c45 as nil") - } - b.PutID(CallStateDiscardedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallStateDiscarded) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStateDiscarded#531b7c45 as nil") - } - if c.Reason == nil { - return fmt.Errorf("unable to encode callStateDiscarded#531b7c45: field reason is nil") - } - if err := c.Reason.Encode(b); err != nil { - return fmt.Errorf("unable to encode callStateDiscarded#531b7c45: field reason: %w", err) - } - b.PutBool(c.NeedRating) - b.PutBool(c.NeedDebugInformation) - b.PutBool(c.NeedLog) - return nil -} - -// Decode implements bin.Decoder. -func (c *CallStateDiscarded) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStateDiscarded#531b7c45 to nil") - } - if err := b.ConsumeID(CallStateDiscardedTypeID); err != nil { - return fmt.Errorf("unable to decode callStateDiscarded#531b7c45: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallStateDiscarded) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStateDiscarded#531b7c45 to nil") - } - { - value, err := DecodeCallDiscardReason(b) - if err != nil { - return fmt.Errorf("unable to decode callStateDiscarded#531b7c45: field reason: %w", err) - } - c.Reason = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStateDiscarded#531b7c45: field need_rating: %w", err) - } - c.NeedRating = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStateDiscarded#531b7c45: field need_debug_information: %w", err) - } - c.NeedDebugInformation = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStateDiscarded#531b7c45: field need_log: %w", err) - } - c.NeedLog = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallStateDiscarded) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callStateDiscarded#531b7c45 as nil") - } - b.ObjStart() - b.PutID("callStateDiscarded") - b.Comma() - b.FieldStart("reason") - if c.Reason == nil { - return fmt.Errorf("unable to encode callStateDiscarded#531b7c45: field reason is nil") - } - if err := c.Reason.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode callStateDiscarded#531b7c45: field reason: %w", err) - } - b.Comma() - b.FieldStart("need_rating") - b.PutBool(c.NeedRating) - b.Comma() - b.FieldStart("need_debug_information") - b.PutBool(c.NeedDebugInformation) - b.Comma() - b.FieldStart("need_log") - b.PutBool(c.NeedLog) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallStateDiscarded) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callStateDiscarded#531b7c45 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callStateDiscarded"); err != nil { - return fmt.Errorf("unable to decode callStateDiscarded#531b7c45: %w", err) - } - case "reason": - value, err := DecodeTDLibJSONCallDiscardReason(b) - if err != nil { - return fmt.Errorf("unable to decode callStateDiscarded#531b7c45: field reason: %w", err) - } - c.Reason = value - case "need_rating": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStateDiscarded#531b7c45: field need_rating: %w", err) - } - c.NeedRating = value - case "need_debug_information": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStateDiscarded#531b7c45: field need_debug_information: %w", err) - } - c.NeedDebugInformation = value - case "need_log": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callStateDiscarded#531b7c45: field need_log: %w", err) - } - c.NeedLog = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReason returns value of Reason field. -func (c *CallStateDiscarded) GetReason() (value CallDiscardReasonClass) { - if c == nil { - return - } - return c.Reason -} - -// GetNeedRating returns value of NeedRating field. -func (c *CallStateDiscarded) GetNeedRating() (value bool) { - if c == nil { - return - } - return c.NeedRating -} - -// GetNeedDebugInformation returns value of NeedDebugInformation field. -func (c *CallStateDiscarded) GetNeedDebugInformation() (value bool) { - if c == nil { - return - } - return c.NeedDebugInformation -} - -// GetNeedLog returns value of NeedLog field. -func (c *CallStateDiscarded) GetNeedLog() (value bool) { - if c == nil { - return - } - return c.NeedLog -} - -// CallStateError represents TL type `callStateError#c5df6495`. -type CallStateError struct { - // Error. An error with the code 4005000 will be returned if an outgoing call is missed - // because of an expired timeout - Error Error -} - -// CallStateErrorTypeID is TL type id of CallStateError. -const CallStateErrorTypeID = 0xc5df6495 - -// construct implements constructor of CallStateClass. -func (c CallStateError) construct() CallStateClass { return &c } - -// Ensuring interfaces in compile-time for CallStateError. -var ( - _ bin.Encoder = &CallStateError{} - _ bin.Decoder = &CallStateError{} - _ bin.BareEncoder = &CallStateError{} - _ bin.BareDecoder = &CallStateError{} - - _ CallStateClass = &CallStateError{} -) - -func (c *CallStateError) Zero() bool { - if c == nil { - return true - } - if !(c.Error.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallStateError) String() string { - if c == nil { - return "CallStateError(nil)" - } - type Alias CallStateError - return fmt.Sprintf("CallStateError%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallStateError) TypeID() uint32 { - return CallStateErrorTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallStateError) TypeName() string { - return "callStateError" -} - -// TypeInfo returns info about TL type. -func (c *CallStateError) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callStateError", - ID: CallStateErrorTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Error", - SchemaName: "error", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallStateError) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStateError#c5df6495 as nil") - } - b.PutID(CallStateErrorTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallStateError) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callStateError#c5df6495 as nil") - } - if err := c.Error.Encode(b); err != nil { - return fmt.Errorf("unable to encode callStateError#c5df6495: field error: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CallStateError) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStateError#c5df6495 to nil") - } - if err := b.ConsumeID(CallStateErrorTypeID); err != nil { - return fmt.Errorf("unable to decode callStateError#c5df6495: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallStateError) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callStateError#c5df6495 to nil") - } - { - if err := c.Error.Decode(b); err != nil { - return fmt.Errorf("unable to decode callStateError#c5df6495: field error: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallStateError) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callStateError#c5df6495 as nil") - } - b.ObjStart() - b.PutID("callStateError") - b.Comma() - b.FieldStart("error") - if err := c.Error.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode callStateError#c5df6495: field error: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallStateError) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callStateError#c5df6495 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callStateError"); err != nil { - return fmt.Errorf("unable to decode callStateError#c5df6495: %w", err) - } - case "error": - if err := c.Error.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode callStateError#c5df6495: field error: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetError returns value of Error field. -func (c *CallStateError) GetError() (value Error) { - if c == nil { - return - } - return c.Error -} - -// CallStateClassName is schema name of CallStateClass. -const CallStateClassName = "CallState" - -// CallStateClass represents CallState generic type. -// -// Example: -// -// g, err := tdapi.DecodeCallState(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.CallStatePending: // callStatePending#3ff56c2c -// case *tdapi.CallStateExchangingKeys: // callStateExchangingKeys#91d77a65 -// case *tdapi.CallStateReady: // callStateReady#17038381 -// case *tdapi.CallStateHangingUp: // callStateHangingUp#80d0f2aa -// case *tdapi.CallStateDiscarded: // callStateDiscarded#531b7c45 -// case *tdapi.CallStateError: // callStateError#c5df6495 -// default: panic(v) -// } -type CallStateClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() CallStateClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeCallState implements binary de-serialization for CallStateClass. -func DecodeCallState(buf *bin.Buffer) (CallStateClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case CallStatePendingTypeID: - // Decoding callStatePending#3ff56c2c. - v := CallStatePending{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - case CallStateExchangingKeysTypeID: - // Decoding callStateExchangingKeys#91d77a65. - v := CallStateExchangingKeys{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - case CallStateReadyTypeID: - // Decoding callStateReady#17038381. - v := CallStateReady{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - case CallStateHangingUpTypeID: - // Decoding callStateHangingUp#80d0f2aa. - v := CallStateHangingUp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - case CallStateDiscardedTypeID: - // Decoding callStateDiscarded#531b7c45. - v := CallStateDiscarded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - case CallStateErrorTypeID: - // Decoding callStateError#c5df6495. - v := CallStateError{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CallStateClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONCallState implements binary de-serialization for CallStateClass. -func DecodeTDLibJSONCallState(buf tdjson.Decoder) (CallStateClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "callStatePending": - // Decoding callStatePending#3ff56c2c. - v := CallStatePending{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - case "callStateExchangingKeys": - // Decoding callStateExchangingKeys#91d77a65. - v := CallStateExchangingKeys{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - case "callStateReady": - // Decoding callStateReady#17038381. - v := CallStateReady{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - case "callStateHangingUp": - // Decoding callStateHangingUp#80d0f2aa. - v := CallStateHangingUp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - case "callStateDiscarded": - // Decoding callStateDiscarded#531b7c45. - v := CallStateDiscarded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - case "callStateError": - // Decoding callStateError#c5df6495. - v := CallStateError{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CallStateClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// CallState boxes the CallStateClass providing a helper. -type CallStateBox struct { - CallState CallStateClass -} - -// Decode implements bin.Decoder for CallStateBox. -func (b *CallStateBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode CallStateBox to nil") - } - v, err := DecodeCallState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CallState = v - return nil -} - -// Encode implements bin.Encode for CallStateBox. -func (b *CallStateBox) Encode(buf *bin.Buffer) error { - if b == nil || b.CallState == nil { - return fmt.Errorf("unable to encode CallStateClass as nil") - } - return b.CallState.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for CallStateBox. -func (b *CallStateBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode CallStateBox to nil") - } - v, err := DecodeTDLibJSONCallState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CallState = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for CallStateBox. -func (b *CallStateBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.CallState == nil { - return fmt.Errorf("unable to encode CallStateClass as nil") - } - return b.CallState.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_callback_query_answer_gen.go b/tdapi/tl_callback_query_answer_gen.go deleted file mode 100644 index fb4a5339b..000000000 --- a/tdapi/tl_callback_query_answer_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CallbackQueryAnswer represents TL type `callbackQueryAnswer#1582685d`. -type CallbackQueryAnswer struct { - // Text of the answer - Text string - // True, if an alert must be shown to the user instead of a toast notification - ShowAlert bool - // URL to be opened - URL string -} - -// CallbackQueryAnswerTypeID is TL type id of CallbackQueryAnswer. -const CallbackQueryAnswerTypeID = 0x1582685d - -// Ensuring interfaces in compile-time for CallbackQueryAnswer. -var ( - _ bin.Encoder = &CallbackQueryAnswer{} - _ bin.Decoder = &CallbackQueryAnswer{} - _ bin.BareEncoder = &CallbackQueryAnswer{} - _ bin.BareDecoder = &CallbackQueryAnswer{} -) - -func (c *CallbackQueryAnswer) Zero() bool { - if c == nil { - return true - } - if !(c.Text == "") { - return false - } - if !(c.ShowAlert == false) { - return false - } - if !(c.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallbackQueryAnswer) String() string { - if c == nil { - return "CallbackQueryAnswer(nil)" - } - type Alias CallbackQueryAnswer - return fmt.Sprintf("CallbackQueryAnswer%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallbackQueryAnswer) TypeID() uint32 { - return CallbackQueryAnswerTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallbackQueryAnswer) TypeName() string { - return "callbackQueryAnswer" -} - -// TypeInfo returns info about TL type. -func (c *CallbackQueryAnswer) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callbackQueryAnswer", - ID: CallbackQueryAnswerTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "ShowAlert", - SchemaName: "show_alert", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallbackQueryAnswer) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryAnswer#1582685d as nil") - } - b.PutID(CallbackQueryAnswerTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallbackQueryAnswer) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryAnswer#1582685d as nil") - } - b.PutString(c.Text) - b.PutBool(c.ShowAlert) - b.PutString(c.URL) - return nil -} - -// Decode implements bin.Decoder. -func (c *CallbackQueryAnswer) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryAnswer#1582685d to nil") - } - if err := b.ConsumeID(CallbackQueryAnswerTypeID); err != nil { - return fmt.Errorf("unable to decode callbackQueryAnswer#1582685d: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallbackQueryAnswer) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryAnswer#1582685d to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryAnswer#1582685d: field text: %w", err) - } - c.Text = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryAnswer#1582685d: field show_alert: %w", err) - } - c.ShowAlert = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryAnswer#1582685d: field url: %w", err) - } - c.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallbackQueryAnswer) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryAnswer#1582685d as nil") - } - b.ObjStart() - b.PutID("callbackQueryAnswer") - b.Comma() - b.FieldStart("text") - b.PutString(c.Text) - b.Comma() - b.FieldStart("show_alert") - b.PutBool(c.ShowAlert) - b.Comma() - b.FieldStart("url") - b.PutString(c.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallbackQueryAnswer) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryAnswer#1582685d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callbackQueryAnswer"); err != nil { - return fmt.Errorf("unable to decode callbackQueryAnswer#1582685d: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryAnswer#1582685d: field text: %w", err) - } - c.Text = value - case "show_alert": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryAnswer#1582685d: field show_alert: %w", err) - } - c.ShowAlert = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryAnswer#1582685d: field url: %w", err) - } - c.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (c *CallbackQueryAnswer) GetText() (value string) { - if c == nil { - return - } - return c.Text -} - -// GetShowAlert returns value of ShowAlert field. -func (c *CallbackQueryAnswer) GetShowAlert() (value bool) { - if c == nil { - return - } - return c.ShowAlert -} - -// GetURL returns value of URL field. -func (c *CallbackQueryAnswer) GetURL() (value string) { - if c == nil { - return - } - return c.URL -} diff --git a/tdapi/tl_callback_query_payload_gen.go b/tdapi/tl_callback_query_payload_gen.go deleted file mode 100644 index 81b2b79cc..000000000 --- a/tdapi/tl_callback_query_payload_gen.go +++ /dev/null @@ -1,716 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CallbackQueryPayloadData represents TL type `callbackQueryPayloadData#8a1e3c66`. -type CallbackQueryPayloadData struct { - // Data that was attached to the callback button - Data []byte -} - -// CallbackQueryPayloadDataTypeID is TL type id of CallbackQueryPayloadData. -const CallbackQueryPayloadDataTypeID = 0x8a1e3c66 - -// construct implements constructor of CallbackQueryPayloadClass. -func (c CallbackQueryPayloadData) construct() CallbackQueryPayloadClass { return &c } - -// Ensuring interfaces in compile-time for CallbackQueryPayloadData. -var ( - _ bin.Encoder = &CallbackQueryPayloadData{} - _ bin.Decoder = &CallbackQueryPayloadData{} - _ bin.BareEncoder = &CallbackQueryPayloadData{} - _ bin.BareDecoder = &CallbackQueryPayloadData{} - - _ CallbackQueryPayloadClass = &CallbackQueryPayloadData{} -) - -func (c *CallbackQueryPayloadData) Zero() bool { - if c == nil { - return true - } - if !(c.Data == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallbackQueryPayloadData) String() string { - if c == nil { - return "CallbackQueryPayloadData(nil)" - } - type Alias CallbackQueryPayloadData - return fmt.Sprintf("CallbackQueryPayloadData%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallbackQueryPayloadData) TypeID() uint32 { - return CallbackQueryPayloadDataTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallbackQueryPayloadData) TypeName() string { - return "callbackQueryPayloadData" -} - -// TypeInfo returns info about TL type. -func (c *CallbackQueryPayloadData) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callbackQueryPayloadData", - ID: CallbackQueryPayloadDataTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallbackQueryPayloadData) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryPayloadData#8a1e3c66 as nil") - } - b.PutID(CallbackQueryPayloadDataTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallbackQueryPayloadData) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryPayloadData#8a1e3c66 as nil") - } - b.PutBytes(c.Data) - return nil -} - -// Decode implements bin.Decoder. -func (c *CallbackQueryPayloadData) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryPayloadData#8a1e3c66 to nil") - } - if err := b.ConsumeID(CallbackQueryPayloadDataTypeID); err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadData#8a1e3c66: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallbackQueryPayloadData) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryPayloadData#8a1e3c66 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadData#8a1e3c66: field data: %w", err) - } - c.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallbackQueryPayloadData) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryPayloadData#8a1e3c66 as nil") - } - b.ObjStart() - b.PutID("callbackQueryPayloadData") - b.Comma() - b.FieldStart("data") - b.PutBytes(c.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallbackQueryPayloadData) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryPayloadData#8a1e3c66 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callbackQueryPayloadData"); err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadData#8a1e3c66: %w", err) - } - case "data": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadData#8a1e3c66: field data: %w", err) - } - c.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetData returns value of Data field. -func (c *CallbackQueryPayloadData) GetData() (value []byte) { - if c == nil { - return - } - return c.Data -} - -// CallbackQueryPayloadDataWithPassword represents TL type `callbackQueryPayloadDataWithPassword#4fe2d8f2`. -type CallbackQueryPayloadDataWithPassword struct { - // The 2-step verification password for the current user - Password string - // Data that was attached to the callback button - Data []byte -} - -// CallbackQueryPayloadDataWithPasswordTypeID is TL type id of CallbackQueryPayloadDataWithPassword. -const CallbackQueryPayloadDataWithPasswordTypeID = 0x4fe2d8f2 - -// construct implements constructor of CallbackQueryPayloadClass. -func (c CallbackQueryPayloadDataWithPassword) construct() CallbackQueryPayloadClass { return &c } - -// Ensuring interfaces in compile-time for CallbackQueryPayloadDataWithPassword. -var ( - _ bin.Encoder = &CallbackQueryPayloadDataWithPassword{} - _ bin.Decoder = &CallbackQueryPayloadDataWithPassword{} - _ bin.BareEncoder = &CallbackQueryPayloadDataWithPassword{} - _ bin.BareDecoder = &CallbackQueryPayloadDataWithPassword{} - - _ CallbackQueryPayloadClass = &CallbackQueryPayloadDataWithPassword{} -) - -func (c *CallbackQueryPayloadDataWithPassword) Zero() bool { - if c == nil { - return true - } - if !(c.Password == "") { - return false - } - if !(c.Data == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallbackQueryPayloadDataWithPassword) String() string { - if c == nil { - return "CallbackQueryPayloadDataWithPassword(nil)" - } - type Alias CallbackQueryPayloadDataWithPassword - return fmt.Sprintf("CallbackQueryPayloadDataWithPassword%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallbackQueryPayloadDataWithPassword) TypeID() uint32 { - return CallbackQueryPayloadDataWithPasswordTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallbackQueryPayloadDataWithPassword) TypeName() string { - return "callbackQueryPayloadDataWithPassword" -} - -// TypeInfo returns info about TL type. -func (c *CallbackQueryPayloadDataWithPassword) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callbackQueryPayloadDataWithPassword", - ID: CallbackQueryPayloadDataWithPasswordTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Password", - SchemaName: "password", - }, - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallbackQueryPayloadDataWithPassword) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryPayloadDataWithPassword#4fe2d8f2 as nil") - } - b.PutID(CallbackQueryPayloadDataWithPasswordTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallbackQueryPayloadDataWithPassword) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryPayloadDataWithPassword#4fe2d8f2 as nil") - } - b.PutString(c.Password) - b.PutBytes(c.Data) - return nil -} - -// Decode implements bin.Decoder. -func (c *CallbackQueryPayloadDataWithPassword) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryPayloadDataWithPassword#4fe2d8f2 to nil") - } - if err := b.ConsumeID(CallbackQueryPayloadDataWithPasswordTypeID); err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadDataWithPassword#4fe2d8f2: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallbackQueryPayloadDataWithPassword) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryPayloadDataWithPassword#4fe2d8f2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadDataWithPassword#4fe2d8f2: field password: %w", err) - } - c.Password = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadDataWithPassword#4fe2d8f2: field data: %w", err) - } - c.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallbackQueryPayloadDataWithPassword) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryPayloadDataWithPassword#4fe2d8f2 as nil") - } - b.ObjStart() - b.PutID("callbackQueryPayloadDataWithPassword") - b.Comma() - b.FieldStart("password") - b.PutString(c.Password) - b.Comma() - b.FieldStart("data") - b.PutBytes(c.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallbackQueryPayloadDataWithPassword) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryPayloadDataWithPassword#4fe2d8f2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callbackQueryPayloadDataWithPassword"); err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadDataWithPassword#4fe2d8f2: %w", err) - } - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadDataWithPassword#4fe2d8f2: field password: %w", err) - } - c.Password = value - case "data": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadDataWithPassword#4fe2d8f2: field data: %w", err) - } - c.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPassword returns value of Password field. -func (c *CallbackQueryPayloadDataWithPassword) GetPassword() (value string) { - if c == nil { - return - } - return c.Password -} - -// GetData returns value of Data field. -func (c *CallbackQueryPayloadDataWithPassword) GetData() (value []byte) { - if c == nil { - return - } - return c.Data -} - -// CallbackQueryPayloadGame represents TL type `callbackQueryPayloadGame#4db2ec38`. -type CallbackQueryPayloadGame struct { - // A short name of the game that was attached to the callback button - GameShortName string -} - -// CallbackQueryPayloadGameTypeID is TL type id of CallbackQueryPayloadGame. -const CallbackQueryPayloadGameTypeID = 0x4db2ec38 - -// construct implements constructor of CallbackQueryPayloadClass. -func (c CallbackQueryPayloadGame) construct() CallbackQueryPayloadClass { return &c } - -// Ensuring interfaces in compile-time for CallbackQueryPayloadGame. -var ( - _ bin.Encoder = &CallbackQueryPayloadGame{} - _ bin.Decoder = &CallbackQueryPayloadGame{} - _ bin.BareEncoder = &CallbackQueryPayloadGame{} - _ bin.BareDecoder = &CallbackQueryPayloadGame{} - - _ CallbackQueryPayloadClass = &CallbackQueryPayloadGame{} -) - -func (c *CallbackQueryPayloadGame) Zero() bool { - if c == nil { - return true - } - if !(c.GameShortName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CallbackQueryPayloadGame) String() string { - if c == nil { - return "CallbackQueryPayloadGame(nil)" - } - type Alias CallbackQueryPayloadGame - return fmt.Sprintf("CallbackQueryPayloadGame%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CallbackQueryPayloadGame) TypeID() uint32 { - return CallbackQueryPayloadGameTypeID -} - -// TypeName returns name of type in TL schema. -func (*CallbackQueryPayloadGame) TypeName() string { - return "callbackQueryPayloadGame" -} - -// TypeInfo returns info about TL type. -func (c *CallbackQueryPayloadGame) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "callbackQueryPayloadGame", - ID: CallbackQueryPayloadGameTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GameShortName", - SchemaName: "game_short_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CallbackQueryPayloadGame) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryPayloadGame#4db2ec38 as nil") - } - b.PutID(CallbackQueryPayloadGameTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CallbackQueryPayloadGame) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryPayloadGame#4db2ec38 as nil") - } - b.PutString(c.GameShortName) - return nil -} - -// Decode implements bin.Decoder. -func (c *CallbackQueryPayloadGame) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryPayloadGame#4db2ec38 to nil") - } - if err := b.ConsumeID(CallbackQueryPayloadGameTypeID); err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadGame#4db2ec38: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CallbackQueryPayloadGame) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryPayloadGame#4db2ec38 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadGame#4db2ec38: field game_short_name: %w", err) - } - c.GameShortName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CallbackQueryPayloadGame) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode callbackQueryPayloadGame#4db2ec38 as nil") - } - b.ObjStart() - b.PutID("callbackQueryPayloadGame") - b.Comma() - b.FieldStart("game_short_name") - b.PutString(c.GameShortName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CallbackQueryPayloadGame) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode callbackQueryPayloadGame#4db2ec38 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("callbackQueryPayloadGame"); err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadGame#4db2ec38: %w", err) - } - case "game_short_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode callbackQueryPayloadGame#4db2ec38: field game_short_name: %w", err) - } - c.GameShortName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGameShortName returns value of GameShortName field. -func (c *CallbackQueryPayloadGame) GetGameShortName() (value string) { - if c == nil { - return - } - return c.GameShortName -} - -// CallbackQueryPayloadClassName is schema name of CallbackQueryPayloadClass. -const CallbackQueryPayloadClassName = "CallbackQueryPayload" - -// CallbackQueryPayloadClass represents CallbackQueryPayload generic type. -// -// Example: -// -// g, err := tdapi.DecodeCallbackQueryPayload(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.CallbackQueryPayloadData: // callbackQueryPayloadData#8a1e3c66 -// case *tdapi.CallbackQueryPayloadDataWithPassword: // callbackQueryPayloadDataWithPassword#4fe2d8f2 -// case *tdapi.CallbackQueryPayloadGame: // callbackQueryPayloadGame#4db2ec38 -// default: panic(v) -// } -type CallbackQueryPayloadClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() CallbackQueryPayloadClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeCallbackQueryPayload implements binary de-serialization for CallbackQueryPayloadClass. -func DecodeCallbackQueryPayload(buf *bin.Buffer) (CallbackQueryPayloadClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case CallbackQueryPayloadDataTypeID: - // Decoding callbackQueryPayloadData#8a1e3c66. - v := CallbackQueryPayloadData{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallbackQueryPayloadClass: %w", err) - } - return &v, nil - case CallbackQueryPayloadDataWithPasswordTypeID: - // Decoding callbackQueryPayloadDataWithPassword#4fe2d8f2. - v := CallbackQueryPayloadDataWithPassword{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallbackQueryPayloadClass: %w", err) - } - return &v, nil - case CallbackQueryPayloadGameTypeID: - // Decoding callbackQueryPayloadGame#4db2ec38. - v := CallbackQueryPayloadGame{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallbackQueryPayloadClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CallbackQueryPayloadClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONCallbackQueryPayload implements binary de-serialization for CallbackQueryPayloadClass. -func DecodeTDLibJSONCallbackQueryPayload(buf tdjson.Decoder) (CallbackQueryPayloadClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "callbackQueryPayloadData": - // Decoding callbackQueryPayloadData#8a1e3c66. - v := CallbackQueryPayloadData{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallbackQueryPayloadClass: %w", err) - } - return &v, nil - case "callbackQueryPayloadDataWithPassword": - // Decoding callbackQueryPayloadDataWithPassword#4fe2d8f2. - v := CallbackQueryPayloadDataWithPassword{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallbackQueryPayloadClass: %w", err) - } - return &v, nil - case "callbackQueryPayloadGame": - // Decoding callbackQueryPayloadGame#4db2ec38. - v := CallbackQueryPayloadGame{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CallbackQueryPayloadClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CallbackQueryPayloadClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// CallbackQueryPayload boxes the CallbackQueryPayloadClass providing a helper. -type CallbackQueryPayloadBox struct { - CallbackQueryPayload CallbackQueryPayloadClass -} - -// Decode implements bin.Decoder for CallbackQueryPayloadBox. -func (b *CallbackQueryPayloadBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode CallbackQueryPayloadBox to nil") - } - v, err := DecodeCallbackQueryPayload(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CallbackQueryPayload = v - return nil -} - -// Encode implements bin.Encode for CallbackQueryPayloadBox. -func (b *CallbackQueryPayloadBox) Encode(buf *bin.Buffer) error { - if b == nil || b.CallbackQueryPayload == nil { - return fmt.Errorf("unable to encode CallbackQueryPayloadClass as nil") - } - return b.CallbackQueryPayload.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for CallbackQueryPayloadBox. -func (b *CallbackQueryPayloadBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode CallbackQueryPayloadBox to nil") - } - v, err := DecodeTDLibJSONCallbackQueryPayload(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CallbackQueryPayload = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for CallbackQueryPayloadBox. -func (b *CallbackQueryPayloadBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.CallbackQueryPayload == nil { - return fmt.Errorf("unable to encode CallbackQueryPayloadClass as nil") - } - return b.CallbackQueryPayload.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_can_bot_send_messages_gen.go b/tdapi/tl_can_bot_send_messages_gen.go deleted file mode 100644 index 2ab66584c..000000000 --- a/tdapi/tl_can_bot_send_messages_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CanBotSendMessagesRequest represents TL type `canBotSendMessages#206d948c`. -type CanBotSendMessagesRequest struct { - // Identifier of the target bot - BotUserID int64 -} - -// CanBotSendMessagesRequestTypeID is TL type id of CanBotSendMessagesRequest. -const CanBotSendMessagesRequestTypeID = 0x206d948c - -// Ensuring interfaces in compile-time for CanBotSendMessagesRequest. -var ( - _ bin.Encoder = &CanBotSendMessagesRequest{} - _ bin.Decoder = &CanBotSendMessagesRequest{} - _ bin.BareEncoder = &CanBotSendMessagesRequest{} - _ bin.BareDecoder = &CanBotSendMessagesRequest{} -) - -func (c *CanBotSendMessagesRequest) Zero() bool { - if c == nil { - return true - } - if !(c.BotUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanBotSendMessagesRequest) String() string { - if c == nil { - return "CanBotSendMessagesRequest(nil)" - } - type Alias CanBotSendMessagesRequest - return fmt.Sprintf("CanBotSendMessagesRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanBotSendMessagesRequest) TypeID() uint32 { - return CanBotSendMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanBotSendMessagesRequest) TypeName() string { - return "canBotSendMessages" -} - -// TypeInfo returns info about TL type. -func (c *CanBotSendMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canBotSendMessages", - ID: CanBotSendMessagesRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CanBotSendMessagesRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canBotSendMessages#206d948c as nil") - } - b.PutID(CanBotSendMessagesRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanBotSendMessagesRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canBotSendMessages#206d948c as nil") - } - b.PutInt53(c.BotUserID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CanBotSendMessagesRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canBotSendMessages#206d948c to nil") - } - if err := b.ConsumeID(CanBotSendMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode canBotSendMessages#206d948c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanBotSendMessagesRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canBotSendMessages#206d948c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode canBotSendMessages#206d948c: field bot_user_id: %w", err) - } - c.BotUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanBotSendMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canBotSendMessages#206d948c as nil") - } - b.ObjStart() - b.PutID("canBotSendMessages") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(c.BotUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanBotSendMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canBotSendMessages#206d948c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canBotSendMessages"); err != nil { - return fmt.Errorf("unable to decode canBotSendMessages#206d948c: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode canBotSendMessages#206d948c: field bot_user_id: %w", err) - } - c.BotUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (c *CanBotSendMessagesRequest) GetBotUserID() (value int64) { - if c == nil { - return - } - return c.BotUserID -} - -// CanBotSendMessages invokes method canBotSendMessages#206d948c returning error if any. -func (c *Client) CanBotSendMessages(ctx context.Context, botuserid int64) error { - var ok Ok - - request := &CanBotSendMessagesRequest{ - BotUserID: botuserid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_can_purchase_from_store_gen.go b/tdapi/tl_can_purchase_from_store_gen.go deleted file mode 100644 index 74791e83f..000000000 --- a/tdapi/tl_can_purchase_from_store_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CanPurchaseFromStoreRequest represents TL type `canPurchaseFromStore#3caa9368`. -type CanPurchaseFromStoreRequest struct { - // Transaction purpose - Purpose StorePaymentPurposeClass -} - -// CanPurchaseFromStoreRequestTypeID is TL type id of CanPurchaseFromStoreRequest. -const CanPurchaseFromStoreRequestTypeID = 0x3caa9368 - -// Ensuring interfaces in compile-time for CanPurchaseFromStoreRequest. -var ( - _ bin.Encoder = &CanPurchaseFromStoreRequest{} - _ bin.Decoder = &CanPurchaseFromStoreRequest{} - _ bin.BareEncoder = &CanPurchaseFromStoreRequest{} - _ bin.BareDecoder = &CanPurchaseFromStoreRequest{} -) - -func (c *CanPurchaseFromStoreRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Purpose == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanPurchaseFromStoreRequest) String() string { - if c == nil { - return "CanPurchaseFromStoreRequest(nil)" - } - type Alias CanPurchaseFromStoreRequest - return fmt.Sprintf("CanPurchaseFromStoreRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanPurchaseFromStoreRequest) TypeID() uint32 { - return CanPurchaseFromStoreRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanPurchaseFromStoreRequest) TypeName() string { - return "canPurchaseFromStore" -} - -// TypeInfo returns info about TL type. -func (c *CanPurchaseFromStoreRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canPurchaseFromStore", - ID: CanPurchaseFromStoreRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Purpose", - SchemaName: "purpose", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CanPurchaseFromStoreRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canPurchaseFromStore#3caa9368 as nil") - } - b.PutID(CanPurchaseFromStoreRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanPurchaseFromStoreRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canPurchaseFromStore#3caa9368 as nil") - } - if c.Purpose == nil { - return fmt.Errorf("unable to encode canPurchaseFromStore#3caa9368: field purpose is nil") - } - if err := c.Purpose.Encode(b); err != nil { - return fmt.Errorf("unable to encode canPurchaseFromStore#3caa9368: field purpose: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CanPurchaseFromStoreRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canPurchaseFromStore#3caa9368 to nil") - } - if err := b.ConsumeID(CanPurchaseFromStoreRequestTypeID); err != nil { - return fmt.Errorf("unable to decode canPurchaseFromStore#3caa9368: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanPurchaseFromStoreRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canPurchaseFromStore#3caa9368 to nil") - } - { - value, err := DecodeStorePaymentPurpose(b) - if err != nil { - return fmt.Errorf("unable to decode canPurchaseFromStore#3caa9368: field purpose: %w", err) - } - c.Purpose = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanPurchaseFromStoreRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canPurchaseFromStore#3caa9368 as nil") - } - b.ObjStart() - b.PutID("canPurchaseFromStore") - b.Comma() - b.FieldStart("purpose") - if c.Purpose == nil { - return fmt.Errorf("unable to encode canPurchaseFromStore#3caa9368: field purpose is nil") - } - if err := c.Purpose.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode canPurchaseFromStore#3caa9368: field purpose: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanPurchaseFromStoreRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canPurchaseFromStore#3caa9368 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canPurchaseFromStore"); err != nil { - return fmt.Errorf("unable to decode canPurchaseFromStore#3caa9368: %w", err) - } - case "purpose": - value, err := DecodeTDLibJSONStorePaymentPurpose(b) - if err != nil { - return fmt.Errorf("unable to decode canPurchaseFromStore#3caa9368: field purpose: %w", err) - } - c.Purpose = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPurpose returns value of Purpose field. -func (c *CanPurchaseFromStoreRequest) GetPurpose() (value StorePaymentPurposeClass) { - if c == nil { - return - } - return c.Purpose -} - -// CanPurchaseFromStore invokes method canPurchaseFromStore#3caa9368 returning error if any. -func (c *Client) CanPurchaseFromStore(ctx context.Context, purpose StorePaymentPurposeClass) error { - var ok Ok - - request := &CanPurchaseFromStoreRequest{ - Purpose: purpose, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_can_send_message_to_user_gen.go b/tdapi/tl_can_send_message_to_user_gen.go deleted file mode 100644 index 57f49ef66..000000000 --- a/tdapi/tl_can_send_message_to_user_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CanSendMessageToUserRequest represents TL type `canSendMessageToUser#5b2a2836`. -type CanSendMessageToUserRequest struct { - // Identifier of the other user - UserID int64 - // Pass true to get only locally available information without sending network requests - OnlyLocal bool -} - -// CanSendMessageToUserRequestTypeID is TL type id of CanSendMessageToUserRequest. -const CanSendMessageToUserRequestTypeID = 0x5b2a2836 - -// Ensuring interfaces in compile-time for CanSendMessageToUserRequest. -var ( - _ bin.Encoder = &CanSendMessageToUserRequest{} - _ bin.Decoder = &CanSendMessageToUserRequest{} - _ bin.BareEncoder = &CanSendMessageToUserRequest{} - _ bin.BareDecoder = &CanSendMessageToUserRequest{} -) - -func (c *CanSendMessageToUserRequest) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.OnlyLocal == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanSendMessageToUserRequest) String() string { - if c == nil { - return "CanSendMessageToUserRequest(nil)" - } - type Alias CanSendMessageToUserRequest - return fmt.Sprintf("CanSendMessageToUserRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanSendMessageToUserRequest) TypeID() uint32 { - return CanSendMessageToUserRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanSendMessageToUserRequest) TypeName() string { - return "canSendMessageToUser" -} - -// TypeInfo returns info about TL type. -func (c *CanSendMessageToUserRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canSendMessageToUser", - ID: CanSendMessageToUserRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "OnlyLocal", - SchemaName: "only_local", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CanSendMessageToUserRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUser#5b2a2836 as nil") - } - b.PutID(CanSendMessageToUserRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanSendMessageToUserRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUser#5b2a2836 as nil") - } - b.PutInt53(c.UserID) - b.PutBool(c.OnlyLocal) - return nil -} - -// Decode implements bin.Decoder. -func (c *CanSendMessageToUserRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUser#5b2a2836 to nil") - } - if err := b.ConsumeID(CanSendMessageToUserRequestTypeID); err != nil { - return fmt.Errorf("unable to decode canSendMessageToUser#5b2a2836: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanSendMessageToUserRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUser#5b2a2836 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode canSendMessageToUser#5b2a2836: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode canSendMessageToUser#5b2a2836: field only_local: %w", err) - } - c.OnlyLocal = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanSendMessageToUserRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUser#5b2a2836 as nil") - } - b.ObjStart() - b.PutID("canSendMessageToUser") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("only_local") - b.PutBool(c.OnlyLocal) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanSendMessageToUserRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUser#5b2a2836 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canSendMessageToUser"); err != nil { - return fmt.Errorf("unable to decode canSendMessageToUser#5b2a2836: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode canSendMessageToUser#5b2a2836: field user_id: %w", err) - } - c.UserID = value - case "only_local": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode canSendMessageToUser#5b2a2836: field only_local: %w", err) - } - c.OnlyLocal = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *CanSendMessageToUserRequest) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetOnlyLocal returns value of OnlyLocal field. -func (c *CanSendMessageToUserRequest) GetOnlyLocal() (value bool) { - if c == nil { - return - } - return c.OnlyLocal -} - -// CanSendMessageToUser invokes method canSendMessageToUser#5b2a2836 returning error if any. -func (c *Client) CanSendMessageToUser(ctx context.Context, request *CanSendMessageToUserRequest) (CanSendMessageToUserResultClass, error) { - var result CanSendMessageToUserResultBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.CanSendMessageToUserResult, nil -} diff --git a/tdapi/tl_can_send_message_to_user_result_gen.go b/tdapi/tl_can_send_message_to_user_result_gen.go deleted file mode 100644 index 4db39c3d8..000000000 --- a/tdapi/tl_can_send_message_to_user_result_gen.go +++ /dev/null @@ -1,581 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CanSendMessageToUserResultOk represents TL type `canSendMessageToUserResultOk#5b3ad802`. -type CanSendMessageToUserResultOk struct { -} - -// CanSendMessageToUserResultOkTypeID is TL type id of CanSendMessageToUserResultOk. -const CanSendMessageToUserResultOkTypeID = 0x5b3ad802 - -// construct implements constructor of CanSendMessageToUserResultClass. -func (c CanSendMessageToUserResultOk) construct() CanSendMessageToUserResultClass { return &c } - -// Ensuring interfaces in compile-time for CanSendMessageToUserResultOk. -var ( - _ bin.Encoder = &CanSendMessageToUserResultOk{} - _ bin.Decoder = &CanSendMessageToUserResultOk{} - _ bin.BareEncoder = &CanSendMessageToUserResultOk{} - _ bin.BareDecoder = &CanSendMessageToUserResultOk{} - - _ CanSendMessageToUserResultClass = &CanSendMessageToUserResultOk{} -) - -func (c *CanSendMessageToUserResultOk) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanSendMessageToUserResultOk) String() string { - if c == nil { - return "CanSendMessageToUserResultOk(nil)" - } - type Alias CanSendMessageToUserResultOk - return fmt.Sprintf("CanSendMessageToUserResultOk%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanSendMessageToUserResultOk) TypeID() uint32 { - return CanSendMessageToUserResultOkTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanSendMessageToUserResultOk) TypeName() string { - return "canSendMessageToUserResultOk" -} - -// TypeInfo returns info about TL type. -func (c *CanSendMessageToUserResultOk) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canSendMessageToUserResultOk", - ID: CanSendMessageToUserResultOkTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CanSendMessageToUserResultOk) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUserResultOk#5b3ad802 as nil") - } - b.PutID(CanSendMessageToUserResultOkTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanSendMessageToUserResultOk) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUserResultOk#5b3ad802 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CanSendMessageToUserResultOk) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUserResultOk#5b3ad802 to nil") - } - if err := b.ConsumeID(CanSendMessageToUserResultOkTypeID); err != nil { - return fmt.Errorf("unable to decode canSendMessageToUserResultOk#5b3ad802: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanSendMessageToUserResultOk) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUserResultOk#5b3ad802 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanSendMessageToUserResultOk) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUserResultOk#5b3ad802 as nil") - } - b.ObjStart() - b.PutID("canSendMessageToUserResultOk") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanSendMessageToUserResultOk) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUserResultOk#5b3ad802 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canSendMessageToUserResultOk"); err != nil { - return fmt.Errorf("unable to decode canSendMessageToUserResultOk#5b3ad802: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CanSendMessageToUserResultUserIsDeleted represents TL type `canSendMessageToUserResultUserIsDeleted#8c172661`. -type CanSendMessageToUserResultUserIsDeleted struct { -} - -// CanSendMessageToUserResultUserIsDeletedTypeID is TL type id of CanSendMessageToUserResultUserIsDeleted. -const CanSendMessageToUserResultUserIsDeletedTypeID = 0x8c172661 - -// construct implements constructor of CanSendMessageToUserResultClass. -func (c CanSendMessageToUserResultUserIsDeleted) construct() CanSendMessageToUserResultClass { - return &c -} - -// Ensuring interfaces in compile-time for CanSendMessageToUserResultUserIsDeleted. -var ( - _ bin.Encoder = &CanSendMessageToUserResultUserIsDeleted{} - _ bin.Decoder = &CanSendMessageToUserResultUserIsDeleted{} - _ bin.BareEncoder = &CanSendMessageToUserResultUserIsDeleted{} - _ bin.BareDecoder = &CanSendMessageToUserResultUserIsDeleted{} - - _ CanSendMessageToUserResultClass = &CanSendMessageToUserResultUserIsDeleted{} -) - -func (c *CanSendMessageToUserResultUserIsDeleted) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanSendMessageToUserResultUserIsDeleted) String() string { - if c == nil { - return "CanSendMessageToUserResultUserIsDeleted(nil)" - } - type Alias CanSendMessageToUserResultUserIsDeleted - return fmt.Sprintf("CanSendMessageToUserResultUserIsDeleted%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanSendMessageToUserResultUserIsDeleted) TypeID() uint32 { - return CanSendMessageToUserResultUserIsDeletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanSendMessageToUserResultUserIsDeleted) TypeName() string { - return "canSendMessageToUserResultUserIsDeleted" -} - -// TypeInfo returns info about TL type. -func (c *CanSendMessageToUserResultUserIsDeleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canSendMessageToUserResultUserIsDeleted", - ID: CanSendMessageToUserResultUserIsDeletedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CanSendMessageToUserResultUserIsDeleted) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUserResultUserIsDeleted#8c172661 as nil") - } - b.PutID(CanSendMessageToUserResultUserIsDeletedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanSendMessageToUserResultUserIsDeleted) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUserResultUserIsDeleted#8c172661 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CanSendMessageToUserResultUserIsDeleted) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUserResultUserIsDeleted#8c172661 to nil") - } - if err := b.ConsumeID(CanSendMessageToUserResultUserIsDeletedTypeID); err != nil { - return fmt.Errorf("unable to decode canSendMessageToUserResultUserIsDeleted#8c172661: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanSendMessageToUserResultUserIsDeleted) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUserResultUserIsDeleted#8c172661 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanSendMessageToUserResultUserIsDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUserResultUserIsDeleted#8c172661 as nil") - } - b.ObjStart() - b.PutID("canSendMessageToUserResultUserIsDeleted") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanSendMessageToUserResultUserIsDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUserResultUserIsDeleted#8c172661 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canSendMessageToUserResultUserIsDeleted"); err != nil { - return fmt.Errorf("unable to decode canSendMessageToUserResultUserIsDeleted#8c172661: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CanSendMessageToUserResultUserRestrictsNewChats represents TL type `canSendMessageToUserResultUserRestrictsNewChats#7304e1d5`. -type CanSendMessageToUserResultUserRestrictsNewChats struct { -} - -// CanSendMessageToUserResultUserRestrictsNewChatsTypeID is TL type id of CanSendMessageToUserResultUserRestrictsNewChats. -const CanSendMessageToUserResultUserRestrictsNewChatsTypeID = 0x7304e1d5 - -// construct implements constructor of CanSendMessageToUserResultClass. -func (c CanSendMessageToUserResultUserRestrictsNewChats) construct() CanSendMessageToUserResultClass { - return &c -} - -// Ensuring interfaces in compile-time for CanSendMessageToUserResultUserRestrictsNewChats. -var ( - _ bin.Encoder = &CanSendMessageToUserResultUserRestrictsNewChats{} - _ bin.Decoder = &CanSendMessageToUserResultUserRestrictsNewChats{} - _ bin.BareEncoder = &CanSendMessageToUserResultUserRestrictsNewChats{} - _ bin.BareDecoder = &CanSendMessageToUserResultUserRestrictsNewChats{} - - _ CanSendMessageToUserResultClass = &CanSendMessageToUserResultUserRestrictsNewChats{} -) - -func (c *CanSendMessageToUserResultUserRestrictsNewChats) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanSendMessageToUserResultUserRestrictsNewChats) String() string { - if c == nil { - return "CanSendMessageToUserResultUserRestrictsNewChats(nil)" - } - type Alias CanSendMessageToUserResultUserRestrictsNewChats - return fmt.Sprintf("CanSendMessageToUserResultUserRestrictsNewChats%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanSendMessageToUserResultUserRestrictsNewChats) TypeID() uint32 { - return CanSendMessageToUserResultUserRestrictsNewChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanSendMessageToUserResultUserRestrictsNewChats) TypeName() string { - return "canSendMessageToUserResultUserRestrictsNewChats" -} - -// TypeInfo returns info about TL type. -func (c *CanSendMessageToUserResultUserRestrictsNewChats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canSendMessageToUserResultUserRestrictsNewChats", - ID: CanSendMessageToUserResultUserRestrictsNewChatsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CanSendMessageToUserResultUserRestrictsNewChats) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUserResultUserRestrictsNewChats#7304e1d5 as nil") - } - b.PutID(CanSendMessageToUserResultUserRestrictsNewChatsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanSendMessageToUserResultUserRestrictsNewChats) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUserResultUserRestrictsNewChats#7304e1d5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CanSendMessageToUserResultUserRestrictsNewChats) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUserResultUserRestrictsNewChats#7304e1d5 to nil") - } - if err := b.ConsumeID(CanSendMessageToUserResultUserRestrictsNewChatsTypeID); err != nil { - return fmt.Errorf("unable to decode canSendMessageToUserResultUserRestrictsNewChats#7304e1d5: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanSendMessageToUserResultUserRestrictsNewChats) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUserResultUserRestrictsNewChats#7304e1d5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanSendMessageToUserResultUserRestrictsNewChats) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canSendMessageToUserResultUserRestrictsNewChats#7304e1d5 as nil") - } - b.ObjStart() - b.PutID("canSendMessageToUserResultUserRestrictsNewChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanSendMessageToUserResultUserRestrictsNewChats) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canSendMessageToUserResultUserRestrictsNewChats#7304e1d5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canSendMessageToUserResultUserRestrictsNewChats"); err != nil { - return fmt.Errorf("unable to decode canSendMessageToUserResultUserRestrictsNewChats#7304e1d5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CanSendMessageToUserResultClassName is schema name of CanSendMessageToUserResultClass. -const CanSendMessageToUserResultClassName = "CanSendMessageToUserResult" - -// CanSendMessageToUserResultClass represents CanSendMessageToUserResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeCanSendMessageToUserResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.CanSendMessageToUserResultOk: // canSendMessageToUserResultOk#5b3ad802 -// case *tdapi.CanSendMessageToUserResultUserIsDeleted: // canSendMessageToUserResultUserIsDeleted#8c172661 -// case *tdapi.CanSendMessageToUserResultUserRestrictsNewChats: // canSendMessageToUserResultUserRestrictsNewChats#7304e1d5 -// default: panic(v) -// } -type CanSendMessageToUserResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() CanSendMessageToUserResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeCanSendMessageToUserResult implements binary de-serialization for CanSendMessageToUserResultClass. -func DecodeCanSendMessageToUserResult(buf *bin.Buffer) (CanSendMessageToUserResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case CanSendMessageToUserResultOkTypeID: - // Decoding canSendMessageToUserResultOk#5b3ad802. - v := CanSendMessageToUserResultOk{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendMessageToUserResultClass: %w", err) - } - return &v, nil - case CanSendMessageToUserResultUserIsDeletedTypeID: - // Decoding canSendMessageToUserResultUserIsDeleted#8c172661. - v := CanSendMessageToUserResultUserIsDeleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendMessageToUserResultClass: %w", err) - } - return &v, nil - case CanSendMessageToUserResultUserRestrictsNewChatsTypeID: - // Decoding canSendMessageToUserResultUserRestrictsNewChats#7304e1d5. - v := CanSendMessageToUserResultUserRestrictsNewChats{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendMessageToUserResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CanSendMessageToUserResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONCanSendMessageToUserResult implements binary de-serialization for CanSendMessageToUserResultClass. -func DecodeTDLibJSONCanSendMessageToUserResult(buf tdjson.Decoder) (CanSendMessageToUserResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "canSendMessageToUserResultOk": - // Decoding canSendMessageToUserResultOk#5b3ad802. - v := CanSendMessageToUserResultOk{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendMessageToUserResultClass: %w", err) - } - return &v, nil - case "canSendMessageToUserResultUserIsDeleted": - // Decoding canSendMessageToUserResultUserIsDeleted#8c172661. - v := CanSendMessageToUserResultUserIsDeleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendMessageToUserResultClass: %w", err) - } - return &v, nil - case "canSendMessageToUserResultUserRestrictsNewChats": - // Decoding canSendMessageToUserResultUserRestrictsNewChats#7304e1d5. - v := CanSendMessageToUserResultUserRestrictsNewChats{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendMessageToUserResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CanSendMessageToUserResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// CanSendMessageToUserResult boxes the CanSendMessageToUserResultClass providing a helper. -type CanSendMessageToUserResultBox struct { - CanSendMessageToUserResult CanSendMessageToUserResultClass -} - -// Decode implements bin.Decoder for CanSendMessageToUserResultBox. -func (b *CanSendMessageToUserResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode CanSendMessageToUserResultBox to nil") - } - v, err := DecodeCanSendMessageToUserResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CanSendMessageToUserResult = v - return nil -} - -// Encode implements bin.Encode for CanSendMessageToUserResultBox. -func (b *CanSendMessageToUserResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.CanSendMessageToUserResult == nil { - return fmt.Errorf("unable to encode CanSendMessageToUserResultClass as nil") - } - return b.CanSendMessageToUserResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for CanSendMessageToUserResultBox. -func (b *CanSendMessageToUserResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode CanSendMessageToUserResultBox to nil") - } - v, err := DecodeTDLibJSONCanSendMessageToUserResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CanSendMessageToUserResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for CanSendMessageToUserResultBox. -func (b *CanSendMessageToUserResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.CanSendMessageToUserResult == nil { - return fmt.Errorf("unable to encode CanSendMessageToUserResultClass as nil") - } - return b.CanSendMessageToUserResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_can_send_story_gen.go b/tdapi/tl_can_send_story_gen.go deleted file mode 100644 index 8b779beee..000000000 --- a/tdapi/tl_can_send_story_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CanSendStoryRequest represents TL type `canSendStory#b6e0216b`. -type CanSendStoryRequest struct { - // Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of - // the current user - ChatID int64 -} - -// CanSendStoryRequestTypeID is TL type id of CanSendStoryRequest. -const CanSendStoryRequestTypeID = 0xb6e0216b - -// Ensuring interfaces in compile-time for CanSendStoryRequest. -var ( - _ bin.Encoder = &CanSendStoryRequest{} - _ bin.Decoder = &CanSendStoryRequest{} - _ bin.BareEncoder = &CanSendStoryRequest{} - _ bin.BareDecoder = &CanSendStoryRequest{} -) - -func (c *CanSendStoryRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanSendStoryRequest) String() string { - if c == nil { - return "CanSendStoryRequest(nil)" - } - type Alias CanSendStoryRequest - return fmt.Sprintf("CanSendStoryRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanSendStoryRequest) TypeID() uint32 { - return CanSendStoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanSendStoryRequest) TypeName() string { - return "canSendStory" -} - -// TypeInfo returns info about TL type. -func (c *CanSendStoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canSendStory", - ID: CanSendStoryRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CanSendStoryRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStory#b6e0216b as nil") - } - b.PutID(CanSendStoryRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanSendStoryRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStory#b6e0216b as nil") - } - b.PutInt53(c.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CanSendStoryRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStory#b6e0216b to nil") - } - if err := b.ConsumeID(CanSendStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode canSendStory#b6e0216b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanSendStoryRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStory#b6e0216b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode canSendStory#b6e0216b: field chat_id: %w", err) - } - c.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanSendStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canSendStory#b6e0216b as nil") - } - b.ObjStart() - b.PutID("canSendStory") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanSendStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canSendStory#b6e0216b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canSendStory"); err != nil { - return fmt.Errorf("unable to decode canSendStory#b6e0216b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode canSendStory#b6e0216b: field chat_id: %w", err) - } - c.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *CanSendStoryRequest) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// CanSendStory invokes method canSendStory#b6e0216b returning error if any. -func (c *Client) CanSendStory(ctx context.Context, chatid int64) (CanSendStoryResultClass, error) { - var result CanSendStoryResultBox - - request := &CanSendStoryRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.CanSendStoryResult, nil -} diff --git a/tdapi/tl_can_send_story_result_gen.go b/tdapi/tl_can_send_story_result_gen.go deleted file mode 100644 index 8b0204bfa..000000000 --- a/tdapi/tl_can_send_story_result_gen.go +++ /dev/null @@ -1,1085 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CanSendStoryResultOk represents TL type `canSendStoryResultOk#503cf0fd`. -type CanSendStoryResultOk struct { -} - -// CanSendStoryResultOkTypeID is TL type id of CanSendStoryResultOk. -const CanSendStoryResultOkTypeID = 0x503cf0fd - -// construct implements constructor of CanSendStoryResultClass. -func (c CanSendStoryResultOk) construct() CanSendStoryResultClass { return &c } - -// Ensuring interfaces in compile-time for CanSendStoryResultOk. -var ( - _ bin.Encoder = &CanSendStoryResultOk{} - _ bin.Decoder = &CanSendStoryResultOk{} - _ bin.BareEncoder = &CanSendStoryResultOk{} - _ bin.BareDecoder = &CanSendStoryResultOk{} - - _ CanSendStoryResultClass = &CanSendStoryResultOk{} -) - -func (c *CanSendStoryResultOk) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanSendStoryResultOk) String() string { - if c == nil { - return "CanSendStoryResultOk(nil)" - } - type Alias CanSendStoryResultOk - return fmt.Sprintf("CanSendStoryResultOk%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanSendStoryResultOk) TypeID() uint32 { - return CanSendStoryResultOkTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanSendStoryResultOk) TypeName() string { - return "canSendStoryResultOk" -} - -// TypeInfo returns info about TL type. -func (c *CanSendStoryResultOk) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canSendStoryResultOk", - ID: CanSendStoryResultOkTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CanSendStoryResultOk) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultOk#503cf0fd as nil") - } - b.PutID(CanSendStoryResultOkTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanSendStoryResultOk) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultOk#503cf0fd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CanSendStoryResultOk) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultOk#503cf0fd to nil") - } - if err := b.ConsumeID(CanSendStoryResultOkTypeID); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultOk#503cf0fd: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanSendStoryResultOk) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultOk#503cf0fd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanSendStoryResultOk) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultOk#503cf0fd as nil") - } - b.ObjStart() - b.PutID("canSendStoryResultOk") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanSendStoryResultOk) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultOk#503cf0fd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canSendStoryResultOk"); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultOk#503cf0fd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CanSendStoryResultPremiumNeeded represents TL type `canSendStoryResultPremiumNeeded#567fde69`. -type CanSendStoryResultPremiumNeeded struct { -} - -// CanSendStoryResultPremiumNeededTypeID is TL type id of CanSendStoryResultPremiumNeeded. -const CanSendStoryResultPremiumNeededTypeID = 0x567fde69 - -// construct implements constructor of CanSendStoryResultClass. -func (c CanSendStoryResultPremiumNeeded) construct() CanSendStoryResultClass { return &c } - -// Ensuring interfaces in compile-time for CanSendStoryResultPremiumNeeded. -var ( - _ bin.Encoder = &CanSendStoryResultPremiumNeeded{} - _ bin.Decoder = &CanSendStoryResultPremiumNeeded{} - _ bin.BareEncoder = &CanSendStoryResultPremiumNeeded{} - _ bin.BareDecoder = &CanSendStoryResultPremiumNeeded{} - - _ CanSendStoryResultClass = &CanSendStoryResultPremiumNeeded{} -) - -func (c *CanSendStoryResultPremiumNeeded) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanSendStoryResultPremiumNeeded) String() string { - if c == nil { - return "CanSendStoryResultPremiumNeeded(nil)" - } - type Alias CanSendStoryResultPremiumNeeded - return fmt.Sprintf("CanSendStoryResultPremiumNeeded%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanSendStoryResultPremiumNeeded) TypeID() uint32 { - return CanSendStoryResultPremiumNeededTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanSendStoryResultPremiumNeeded) TypeName() string { - return "canSendStoryResultPremiumNeeded" -} - -// TypeInfo returns info about TL type. -func (c *CanSendStoryResultPremiumNeeded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canSendStoryResultPremiumNeeded", - ID: CanSendStoryResultPremiumNeededTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CanSendStoryResultPremiumNeeded) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultPremiumNeeded#567fde69 as nil") - } - b.PutID(CanSendStoryResultPremiumNeededTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanSendStoryResultPremiumNeeded) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultPremiumNeeded#567fde69 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CanSendStoryResultPremiumNeeded) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultPremiumNeeded#567fde69 to nil") - } - if err := b.ConsumeID(CanSendStoryResultPremiumNeededTypeID); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultPremiumNeeded#567fde69: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanSendStoryResultPremiumNeeded) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultPremiumNeeded#567fde69 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanSendStoryResultPremiumNeeded) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultPremiumNeeded#567fde69 as nil") - } - b.ObjStart() - b.PutID("canSendStoryResultPremiumNeeded") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanSendStoryResultPremiumNeeded) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultPremiumNeeded#567fde69 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canSendStoryResultPremiumNeeded"); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultPremiumNeeded#567fde69: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CanSendStoryResultBoostNeeded represents TL type `canSendStoryResultBoostNeeded#9e60e92f`. -type CanSendStoryResultBoostNeeded struct { -} - -// CanSendStoryResultBoostNeededTypeID is TL type id of CanSendStoryResultBoostNeeded. -const CanSendStoryResultBoostNeededTypeID = 0x9e60e92f - -// construct implements constructor of CanSendStoryResultClass. -func (c CanSendStoryResultBoostNeeded) construct() CanSendStoryResultClass { return &c } - -// Ensuring interfaces in compile-time for CanSendStoryResultBoostNeeded. -var ( - _ bin.Encoder = &CanSendStoryResultBoostNeeded{} - _ bin.Decoder = &CanSendStoryResultBoostNeeded{} - _ bin.BareEncoder = &CanSendStoryResultBoostNeeded{} - _ bin.BareDecoder = &CanSendStoryResultBoostNeeded{} - - _ CanSendStoryResultClass = &CanSendStoryResultBoostNeeded{} -) - -func (c *CanSendStoryResultBoostNeeded) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanSendStoryResultBoostNeeded) String() string { - if c == nil { - return "CanSendStoryResultBoostNeeded(nil)" - } - type Alias CanSendStoryResultBoostNeeded - return fmt.Sprintf("CanSendStoryResultBoostNeeded%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanSendStoryResultBoostNeeded) TypeID() uint32 { - return CanSendStoryResultBoostNeededTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanSendStoryResultBoostNeeded) TypeName() string { - return "canSendStoryResultBoostNeeded" -} - -// TypeInfo returns info about TL type. -func (c *CanSendStoryResultBoostNeeded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canSendStoryResultBoostNeeded", - ID: CanSendStoryResultBoostNeededTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CanSendStoryResultBoostNeeded) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultBoostNeeded#9e60e92f as nil") - } - b.PutID(CanSendStoryResultBoostNeededTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanSendStoryResultBoostNeeded) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultBoostNeeded#9e60e92f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CanSendStoryResultBoostNeeded) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultBoostNeeded#9e60e92f to nil") - } - if err := b.ConsumeID(CanSendStoryResultBoostNeededTypeID); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultBoostNeeded#9e60e92f: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanSendStoryResultBoostNeeded) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultBoostNeeded#9e60e92f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanSendStoryResultBoostNeeded) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultBoostNeeded#9e60e92f as nil") - } - b.ObjStart() - b.PutID("canSendStoryResultBoostNeeded") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanSendStoryResultBoostNeeded) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultBoostNeeded#9e60e92f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canSendStoryResultBoostNeeded"); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultBoostNeeded#9e60e92f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CanSendStoryResultActiveStoryLimitExceeded represents TL type `canSendStoryResultActiveStoryLimitExceeded#afd9aad6`. -type CanSendStoryResultActiveStoryLimitExceeded struct { -} - -// CanSendStoryResultActiveStoryLimitExceededTypeID is TL type id of CanSendStoryResultActiveStoryLimitExceeded. -const CanSendStoryResultActiveStoryLimitExceededTypeID = 0xafd9aad6 - -// construct implements constructor of CanSendStoryResultClass. -func (c CanSendStoryResultActiveStoryLimitExceeded) construct() CanSendStoryResultClass { return &c } - -// Ensuring interfaces in compile-time for CanSendStoryResultActiveStoryLimitExceeded. -var ( - _ bin.Encoder = &CanSendStoryResultActiveStoryLimitExceeded{} - _ bin.Decoder = &CanSendStoryResultActiveStoryLimitExceeded{} - _ bin.BareEncoder = &CanSendStoryResultActiveStoryLimitExceeded{} - _ bin.BareDecoder = &CanSendStoryResultActiveStoryLimitExceeded{} - - _ CanSendStoryResultClass = &CanSendStoryResultActiveStoryLimitExceeded{} -) - -func (c *CanSendStoryResultActiveStoryLimitExceeded) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanSendStoryResultActiveStoryLimitExceeded) String() string { - if c == nil { - return "CanSendStoryResultActiveStoryLimitExceeded(nil)" - } - type Alias CanSendStoryResultActiveStoryLimitExceeded - return fmt.Sprintf("CanSendStoryResultActiveStoryLimitExceeded%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanSendStoryResultActiveStoryLimitExceeded) TypeID() uint32 { - return CanSendStoryResultActiveStoryLimitExceededTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanSendStoryResultActiveStoryLimitExceeded) TypeName() string { - return "canSendStoryResultActiveStoryLimitExceeded" -} - -// TypeInfo returns info about TL type. -func (c *CanSendStoryResultActiveStoryLimitExceeded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canSendStoryResultActiveStoryLimitExceeded", - ID: CanSendStoryResultActiveStoryLimitExceededTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CanSendStoryResultActiveStoryLimitExceeded) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultActiveStoryLimitExceeded#afd9aad6 as nil") - } - b.PutID(CanSendStoryResultActiveStoryLimitExceededTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanSendStoryResultActiveStoryLimitExceeded) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultActiveStoryLimitExceeded#afd9aad6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CanSendStoryResultActiveStoryLimitExceeded) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultActiveStoryLimitExceeded#afd9aad6 to nil") - } - if err := b.ConsumeID(CanSendStoryResultActiveStoryLimitExceededTypeID); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultActiveStoryLimitExceeded#afd9aad6: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanSendStoryResultActiveStoryLimitExceeded) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultActiveStoryLimitExceeded#afd9aad6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanSendStoryResultActiveStoryLimitExceeded) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultActiveStoryLimitExceeded#afd9aad6 as nil") - } - b.ObjStart() - b.PutID("canSendStoryResultActiveStoryLimitExceeded") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanSendStoryResultActiveStoryLimitExceeded) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultActiveStoryLimitExceeded#afd9aad6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canSendStoryResultActiveStoryLimitExceeded"); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultActiveStoryLimitExceeded#afd9aad6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CanSendStoryResultWeeklyLimitExceeded represents TL type `canSendStoryResultWeeklyLimitExceeded#1341a0b8`. -type CanSendStoryResultWeeklyLimitExceeded struct { - // Time left before the user can send the next story - RetryAfter int32 -} - -// CanSendStoryResultWeeklyLimitExceededTypeID is TL type id of CanSendStoryResultWeeklyLimitExceeded. -const CanSendStoryResultWeeklyLimitExceededTypeID = 0x1341a0b8 - -// construct implements constructor of CanSendStoryResultClass. -func (c CanSendStoryResultWeeklyLimitExceeded) construct() CanSendStoryResultClass { return &c } - -// Ensuring interfaces in compile-time for CanSendStoryResultWeeklyLimitExceeded. -var ( - _ bin.Encoder = &CanSendStoryResultWeeklyLimitExceeded{} - _ bin.Decoder = &CanSendStoryResultWeeklyLimitExceeded{} - _ bin.BareEncoder = &CanSendStoryResultWeeklyLimitExceeded{} - _ bin.BareDecoder = &CanSendStoryResultWeeklyLimitExceeded{} - - _ CanSendStoryResultClass = &CanSendStoryResultWeeklyLimitExceeded{} -) - -func (c *CanSendStoryResultWeeklyLimitExceeded) Zero() bool { - if c == nil { - return true - } - if !(c.RetryAfter == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanSendStoryResultWeeklyLimitExceeded) String() string { - if c == nil { - return "CanSendStoryResultWeeklyLimitExceeded(nil)" - } - type Alias CanSendStoryResultWeeklyLimitExceeded - return fmt.Sprintf("CanSendStoryResultWeeklyLimitExceeded%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanSendStoryResultWeeklyLimitExceeded) TypeID() uint32 { - return CanSendStoryResultWeeklyLimitExceededTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanSendStoryResultWeeklyLimitExceeded) TypeName() string { - return "canSendStoryResultWeeklyLimitExceeded" -} - -// TypeInfo returns info about TL type. -func (c *CanSendStoryResultWeeklyLimitExceeded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canSendStoryResultWeeklyLimitExceeded", - ID: CanSendStoryResultWeeklyLimitExceededTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RetryAfter", - SchemaName: "retry_after", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CanSendStoryResultWeeklyLimitExceeded) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultWeeklyLimitExceeded#1341a0b8 as nil") - } - b.PutID(CanSendStoryResultWeeklyLimitExceededTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanSendStoryResultWeeklyLimitExceeded) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultWeeklyLimitExceeded#1341a0b8 as nil") - } - b.PutInt32(c.RetryAfter) - return nil -} - -// Decode implements bin.Decoder. -func (c *CanSendStoryResultWeeklyLimitExceeded) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultWeeklyLimitExceeded#1341a0b8 to nil") - } - if err := b.ConsumeID(CanSendStoryResultWeeklyLimitExceededTypeID); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultWeeklyLimitExceeded#1341a0b8: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanSendStoryResultWeeklyLimitExceeded) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultWeeklyLimitExceeded#1341a0b8 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode canSendStoryResultWeeklyLimitExceeded#1341a0b8: field retry_after: %w", err) - } - c.RetryAfter = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanSendStoryResultWeeklyLimitExceeded) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultWeeklyLimitExceeded#1341a0b8 as nil") - } - b.ObjStart() - b.PutID("canSendStoryResultWeeklyLimitExceeded") - b.Comma() - b.FieldStart("retry_after") - b.PutInt32(c.RetryAfter) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanSendStoryResultWeeklyLimitExceeded) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultWeeklyLimitExceeded#1341a0b8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canSendStoryResultWeeklyLimitExceeded"); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultWeeklyLimitExceeded#1341a0b8: %w", err) - } - case "retry_after": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode canSendStoryResultWeeklyLimitExceeded#1341a0b8: field retry_after: %w", err) - } - c.RetryAfter = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRetryAfter returns value of RetryAfter field. -func (c *CanSendStoryResultWeeklyLimitExceeded) GetRetryAfter() (value int32) { - if c == nil { - return - } - return c.RetryAfter -} - -// CanSendStoryResultMonthlyLimitExceeded represents TL type `canSendStoryResultMonthlyLimitExceeded#dd8242d5`. -type CanSendStoryResultMonthlyLimitExceeded struct { - // Time left before the user can send the next story - RetryAfter int32 -} - -// CanSendStoryResultMonthlyLimitExceededTypeID is TL type id of CanSendStoryResultMonthlyLimitExceeded. -const CanSendStoryResultMonthlyLimitExceededTypeID = 0xdd8242d5 - -// construct implements constructor of CanSendStoryResultClass. -func (c CanSendStoryResultMonthlyLimitExceeded) construct() CanSendStoryResultClass { return &c } - -// Ensuring interfaces in compile-time for CanSendStoryResultMonthlyLimitExceeded. -var ( - _ bin.Encoder = &CanSendStoryResultMonthlyLimitExceeded{} - _ bin.Decoder = &CanSendStoryResultMonthlyLimitExceeded{} - _ bin.BareEncoder = &CanSendStoryResultMonthlyLimitExceeded{} - _ bin.BareDecoder = &CanSendStoryResultMonthlyLimitExceeded{} - - _ CanSendStoryResultClass = &CanSendStoryResultMonthlyLimitExceeded{} -) - -func (c *CanSendStoryResultMonthlyLimitExceeded) Zero() bool { - if c == nil { - return true - } - if !(c.RetryAfter == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanSendStoryResultMonthlyLimitExceeded) String() string { - if c == nil { - return "CanSendStoryResultMonthlyLimitExceeded(nil)" - } - type Alias CanSendStoryResultMonthlyLimitExceeded - return fmt.Sprintf("CanSendStoryResultMonthlyLimitExceeded%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanSendStoryResultMonthlyLimitExceeded) TypeID() uint32 { - return CanSendStoryResultMonthlyLimitExceededTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanSendStoryResultMonthlyLimitExceeded) TypeName() string { - return "canSendStoryResultMonthlyLimitExceeded" -} - -// TypeInfo returns info about TL type. -func (c *CanSendStoryResultMonthlyLimitExceeded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canSendStoryResultMonthlyLimitExceeded", - ID: CanSendStoryResultMonthlyLimitExceededTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RetryAfter", - SchemaName: "retry_after", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CanSendStoryResultMonthlyLimitExceeded) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultMonthlyLimitExceeded#dd8242d5 as nil") - } - b.PutID(CanSendStoryResultMonthlyLimitExceededTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanSendStoryResultMonthlyLimitExceeded) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultMonthlyLimitExceeded#dd8242d5 as nil") - } - b.PutInt32(c.RetryAfter) - return nil -} - -// Decode implements bin.Decoder. -func (c *CanSendStoryResultMonthlyLimitExceeded) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultMonthlyLimitExceeded#dd8242d5 to nil") - } - if err := b.ConsumeID(CanSendStoryResultMonthlyLimitExceededTypeID); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultMonthlyLimitExceeded#dd8242d5: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanSendStoryResultMonthlyLimitExceeded) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultMonthlyLimitExceeded#dd8242d5 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode canSendStoryResultMonthlyLimitExceeded#dd8242d5: field retry_after: %w", err) - } - c.RetryAfter = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanSendStoryResultMonthlyLimitExceeded) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canSendStoryResultMonthlyLimitExceeded#dd8242d5 as nil") - } - b.ObjStart() - b.PutID("canSendStoryResultMonthlyLimitExceeded") - b.Comma() - b.FieldStart("retry_after") - b.PutInt32(c.RetryAfter) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanSendStoryResultMonthlyLimitExceeded) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canSendStoryResultMonthlyLimitExceeded#dd8242d5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canSendStoryResultMonthlyLimitExceeded"); err != nil { - return fmt.Errorf("unable to decode canSendStoryResultMonthlyLimitExceeded#dd8242d5: %w", err) - } - case "retry_after": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode canSendStoryResultMonthlyLimitExceeded#dd8242d5: field retry_after: %w", err) - } - c.RetryAfter = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRetryAfter returns value of RetryAfter field. -func (c *CanSendStoryResultMonthlyLimitExceeded) GetRetryAfter() (value int32) { - if c == nil { - return - } - return c.RetryAfter -} - -// CanSendStoryResultClassName is schema name of CanSendStoryResultClass. -const CanSendStoryResultClassName = "CanSendStoryResult" - -// CanSendStoryResultClass represents CanSendStoryResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeCanSendStoryResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.CanSendStoryResultOk: // canSendStoryResultOk#503cf0fd -// case *tdapi.CanSendStoryResultPremiumNeeded: // canSendStoryResultPremiumNeeded#567fde69 -// case *tdapi.CanSendStoryResultBoostNeeded: // canSendStoryResultBoostNeeded#9e60e92f -// case *tdapi.CanSendStoryResultActiveStoryLimitExceeded: // canSendStoryResultActiveStoryLimitExceeded#afd9aad6 -// case *tdapi.CanSendStoryResultWeeklyLimitExceeded: // canSendStoryResultWeeklyLimitExceeded#1341a0b8 -// case *tdapi.CanSendStoryResultMonthlyLimitExceeded: // canSendStoryResultMonthlyLimitExceeded#dd8242d5 -// default: panic(v) -// } -type CanSendStoryResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() CanSendStoryResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeCanSendStoryResult implements binary de-serialization for CanSendStoryResultClass. -func DecodeCanSendStoryResult(buf *bin.Buffer) (CanSendStoryResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case CanSendStoryResultOkTypeID: - // Decoding canSendStoryResultOk#503cf0fd. - v := CanSendStoryResultOk{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - case CanSendStoryResultPremiumNeededTypeID: - // Decoding canSendStoryResultPremiumNeeded#567fde69. - v := CanSendStoryResultPremiumNeeded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - case CanSendStoryResultBoostNeededTypeID: - // Decoding canSendStoryResultBoostNeeded#9e60e92f. - v := CanSendStoryResultBoostNeeded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - case CanSendStoryResultActiveStoryLimitExceededTypeID: - // Decoding canSendStoryResultActiveStoryLimitExceeded#afd9aad6. - v := CanSendStoryResultActiveStoryLimitExceeded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - case CanSendStoryResultWeeklyLimitExceededTypeID: - // Decoding canSendStoryResultWeeklyLimitExceeded#1341a0b8. - v := CanSendStoryResultWeeklyLimitExceeded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - case CanSendStoryResultMonthlyLimitExceededTypeID: - // Decoding canSendStoryResultMonthlyLimitExceeded#dd8242d5. - v := CanSendStoryResultMonthlyLimitExceeded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONCanSendStoryResult implements binary de-serialization for CanSendStoryResultClass. -func DecodeTDLibJSONCanSendStoryResult(buf tdjson.Decoder) (CanSendStoryResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "canSendStoryResultOk": - // Decoding canSendStoryResultOk#503cf0fd. - v := CanSendStoryResultOk{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - case "canSendStoryResultPremiumNeeded": - // Decoding canSendStoryResultPremiumNeeded#567fde69. - v := CanSendStoryResultPremiumNeeded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - case "canSendStoryResultBoostNeeded": - // Decoding canSendStoryResultBoostNeeded#9e60e92f. - v := CanSendStoryResultBoostNeeded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - case "canSendStoryResultActiveStoryLimitExceeded": - // Decoding canSendStoryResultActiveStoryLimitExceeded#afd9aad6. - v := CanSendStoryResultActiveStoryLimitExceeded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - case "canSendStoryResultWeeklyLimitExceeded": - // Decoding canSendStoryResultWeeklyLimitExceeded#1341a0b8. - v := CanSendStoryResultWeeklyLimitExceeded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - case "canSendStoryResultMonthlyLimitExceeded": - // Decoding canSendStoryResultMonthlyLimitExceeded#dd8242d5. - v := CanSendStoryResultMonthlyLimitExceeded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CanSendStoryResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// CanSendStoryResult boxes the CanSendStoryResultClass providing a helper. -type CanSendStoryResultBox struct { - CanSendStoryResult CanSendStoryResultClass -} - -// Decode implements bin.Decoder for CanSendStoryResultBox. -func (b *CanSendStoryResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode CanSendStoryResultBox to nil") - } - v, err := DecodeCanSendStoryResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CanSendStoryResult = v - return nil -} - -// Encode implements bin.Encode for CanSendStoryResultBox. -func (b *CanSendStoryResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.CanSendStoryResult == nil { - return fmt.Errorf("unable to encode CanSendStoryResultClass as nil") - } - return b.CanSendStoryResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for CanSendStoryResultBox. -func (b *CanSendStoryResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode CanSendStoryResultBox to nil") - } - v, err := DecodeTDLibJSONCanSendStoryResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CanSendStoryResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for CanSendStoryResultBox. -func (b *CanSendStoryResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.CanSendStoryResult == nil { - return fmt.Errorf("unable to encode CanSendStoryResultClass as nil") - } - return b.CanSendStoryResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_can_transfer_ownership_gen.go b/tdapi/tl_can_transfer_ownership_gen.go deleted file mode 100644 index c0e48f9f3..000000000 --- a/tdapi/tl_can_transfer_ownership_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CanTransferOwnershipRequest represents TL type `canTransferOwnership#25d3440c`. -type CanTransferOwnershipRequest struct { -} - -// CanTransferOwnershipRequestTypeID is TL type id of CanTransferOwnershipRequest. -const CanTransferOwnershipRequestTypeID = 0x25d3440c - -// Ensuring interfaces in compile-time for CanTransferOwnershipRequest. -var ( - _ bin.Encoder = &CanTransferOwnershipRequest{} - _ bin.Decoder = &CanTransferOwnershipRequest{} - _ bin.BareEncoder = &CanTransferOwnershipRequest{} - _ bin.BareDecoder = &CanTransferOwnershipRequest{} -) - -func (c *CanTransferOwnershipRequest) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanTransferOwnershipRequest) String() string { - if c == nil { - return "CanTransferOwnershipRequest(nil)" - } - type Alias CanTransferOwnershipRequest - return fmt.Sprintf("CanTransferOwnershipRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanTransferOwnershipRequest) TypeID() uint32 { - return CanTransferOwnershipRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanTransferOwnershipRequest) TypeName() string { - return "canTransferOwnership" -} - -// TypeInfo returns info about TL type. -func (c *CanTransferOwnershipRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canTransferOwnership", - ID: CanTransferOwnershipRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CanTransferOwnershipRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnership#25d3440c as nil") - } - b.PutID(CanTransferOwnershipRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanTransferOwnershipRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnership#25d3440c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CanTransferOwnershipRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnership#25d3440c to nil") - } - if err := b.ConsumeID(CanTransferOwnershipRequestTypeID); err != nil { - return fmt.Errorf("unable to decode canTransferOwnership#25d3440c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanTransferOwnershipRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnership#25d3440c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanTransferOwnershipRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnership#25d3440c as nil") - } - b.ObjStart() - b.PutID("canTransferOwnership") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanTransferOwnershipRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnership#25d3440c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canTransferOwnership"); err != nil { - return fmt.Errorf("unable to decode canTransferOwnership#25d3440c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CanTransferOwnership invokes method canTransferOwnership#25d3440c returning error if any. -func (c *Client) CanTransferOwnership(ctx context.Context) (CanTransferOwnershipResultClass, error) { - var result CanTransferOwnershipResultBox - - request := &CanTransferOwnershipRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.CanTransferOwnershipResult, nil -} diff --git a/tdapi/tl_can_transfer_ownership_result_gen.go b/tdapi/tl_can_transfer_ownership_result_gen.go deleted file mode 100644 index 868c5adbf..000000000 --- a/tdapi/tl_can_transfer_ownership_result_gen.go +++ /dev/null @@ -1,799 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CanTransferOwnershipResultOk represents TL type `canTransferOwnershipResultOk#faa48643`. -type CanTransferOwnershipResultOk struct { -} - -// CanTransferOwnershipResultOkTypeID is TL type id of CanTransferOwnershipResultOk. -const CanTransferOwnershipResultOkTypeID = 0xfaa48643 - -// construct implements constructor of CanTransferOwnershipResultClass. -func (c CanTransferOwnershipResultOk) construct() CanTransferOwnershipResultClass { return &c } - -// Ensuring interfaces in compile-time for CanTransferOwnershipResultOk. -var ( - _ bin.Encoder = &CanTransferOwnershipResultOk{} - _ bin.Decoder = &CanTransferOwnershipResultOk{} - _ bin.BareEncoder = &CanTransferOwnershipResultOk{} - _ bin.BareDecoder = &CanTransferOwnershipResultOk{} - - _ CanTransferOwnershipResultClass = &CanTransferOwnershipResultOk{} -) - -func (c *CanTransferOwnershipResultOk) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanTransferOwnershipResultOk) String() string { - if c == nil { - return "CanTransferOwnershipResultOk(nil)" - } - type Alias CanTransferOwnershipResultOk - return fmt.Sprintf("CanTransferOwnershipResultOk%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanTransferOwnershipResultOk) TypeID() uint32 { - return CanTransferOwnershipResultOkTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanTransferOwnershipResultOk) TypeName() string { - return "canTransferOwnershipResultOk" -} - -// TypeInfo returns info about TL type. -func (c *CanTransferOwnershipResultOk) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canTransferOwnershipResultOk", - ID: CanTransferOwnershipResultOkTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CanTransferOwnershipResultOk) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultOk#faa48643 as nil") - } - b.PutID(CanTransferOwnershipResultOkTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanTransferOwnershipResultOk) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultOk#faa48643 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CanTransferOwnershipResultOk) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultOk#faa48643 to nil") - } - if err := b.ConsumeID(CanTransferOwnershipResultOkTypeID); err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultOk#faa48643: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanTransferOwnershipResultOk) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultOk#faa48643 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanTransferOwnershipResultOk) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultOk#faa48643 as nil") - } - b.ObjStart() - b.PutID("canTransferOwnershipResultOk") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanTransferOwnershipResultOk) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultOk#faa48643 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canTransferOwnershipResultOk"); err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultOk#faa48643: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CanTransferOwnershipResultPasswordNeeded represents TL type `canTransferOwnershipResultPasswordNeeded#5c4a4adf`. -type CanTransferOwnershipResultPasswordNeeded struct { -} - -// CanTransferOwnershipResultPasswordNeededTypeID is TL type id of CanTransferOwnershipResultPasswordNeeded. -const CanTransferOwnershipResultPasswordNeededTypeID = 0x5c4a4adf - -// construct implements constructor of CanTransferOwnershipResultClass. -func (c CanTransferOwnershipResultPasswordNeeded) construct() CanTransferOwnershipResultClass { - return &c -} - -// Ensuring interfaces in compile-time for CanTransferOwnershipResultPasswordNeeded. -var ( - _ bin.Encoder = &CanTransferOwnershipResultPasswordNeeded{} - _ bin.Decoder = &CanTransferOwnershipResultPasswordNeeded{} - _ bin.BareEncoder = &CanTransferOwnershipResultPasswordNeeded{} - _ bin.BareDecoder = &CanTransferOwnershipResultPasswordNeeded{} - - _ CanTransferOwnershipResultClass = &CanTransferOwnershipResultPasswordNeeded{} -) - -func (c *CanTransferOwnershipResultPasswordNeeded) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanTransferOwnershipResultPasswordNeeded) String() string { - if c == nil { - return "CanTransferOwnershipResultPasswordNeeded(nil)" - } - type Alias CanTransferOwnershipResultPasswordNeeded - return fmt.Sprintf("CanTransferOwnershipResultPasswordNeeded%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanTransferOwnershipResultPasswordNeeded) TypeID() uint32 { - return CanTransferOwnershipResultPasswordNeededTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanTransferOwnershipResultPasswordNeeded) TypeName() string { - return "canTransferOwnershipResultPasswordNeeded" -} - -// TypeInfo returns info about TL type. -func (c *CanTransferOwnershipResultPasswordNeeded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canTransferOwnershipResultPasswordNeeded", - ID: CanTransferOwnershipResultPasswordNeededTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CanTransferOwnershipResultPasswordNeeded) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultPasswordNeeded#5c4a4adf as nil") - } - b.PutID(CanTransferOwnershipResultPasswordNeededTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanTransferOwnershipResultPasswordNeeded) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultPasswordNeeded#5c4a4adf as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CanTransferOwnershipResultPasswordNeeded) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultPasswordNeeded#5c4a4adf to nil") - } - if err := b.ConsumeID(CanTransferOwnershipResultPasswordNeededTypeID); err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultPasswordNeeded#5c4a4adf: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanTransferOwnershipResultPasswordNeeded) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultPasswordNeeded#5c4a4adf to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanTransferOwnershipResultPasswordNeeded) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultPasswordNeeded#5c4a4adf as nil") - } - b.ObjStart() - b.PutID("canTransferOwnershipResultPasswordNeeded") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanTransferOwnershipResultPasswordNeeded) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultPasswordNeeded#5c4a4adf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canTransferOwnershipResultPasswordNeeded"); err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultPasswordNeeded#5c4a4adf: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CanTransferOwnershipResultPasswordTooFresh represents TL type `canTransferOwnershipResultPasswordTooFresh#305d9b11`. -type CanTransferOwnershipResultPasswordTooFresh struct { - // Time left before the session can be used to transfer ownership of a chat, in seconds - RetryAfter int32 -} - -// CanTransferOwnershipResultPasswordTooFreshTypeID is TL type id of CanTransferOwnershipResultPasswordTooFresh. -const CanTransferOwnershipResultPasswordTooFreshTypeID = 0x305d9b11 - -// construct implements constructor of CanTransferOwnershipResultClass. -func (c CanTransferOwnershipResultPasswordTooFresh) construct() CanTransferOwnershipResultClass { - return &c -} - -// Ensuring interfaces in compile-time for CanTransferOwnershipResultPasswordTooFresh. -var ( - _ bin.Encoder = &CanTransferOwnershipResultPasswordTooFresh{} - _ bin.Decoder = &CanTransferOwnershipResultPasswordTooFresh{} - _ bin.BareEncoder = &CanTransferOwnershipResultPasswordTooFresh{} - _ bin.BareDecoder = &CanTransferOwnershipResultPasswordTooFresh{} - - _ CanTransferOwnershipResultClass = &CanTransferOwnershipResultPasswordTooFresh{} -) - -func (c *CanTransferOwnershipResultPasswordTooFresh) Zero() bool { - if c == nil { - return true - } - if !(c.RetryAfter == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanTransferOwnershipResultPasswordTooFresh) String() string { - if c == nil { - return "CanTransferOwnershipResultPasswordTooFresh(nil)" - } - type Alias CanTransferOwnershipResultPasswordTooFresh - return fmt.Sprintf("CanTransferOwnershipResultPasswordTooFresh%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanTransferOwnershipResultPasswordTooFresh) TypeID() uint32 { - return CanTransferOwnershipResultPasswordTooFreshTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanTransferOwnershipResultPasswordTooFresh) TypeName() string { - return "canTransferOwnershipResultPasswordTooFresh" -} - -// TypeInfo returns info about TL type. -func (c *CanTransferOwnershipResultPasswordTooFresh) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canTransferOwnershipResultPasswordTooFresh", - ID: CanTransferOwnershipResultPasswordTooFreshTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RetryAfter", - SchemaName: "retry_after", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CanTransferOwnershipResultPasswordTooFresh) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultPasswordTooFresh#305d9b11 as nil") - } - b.PutID(CanTransferOwnershipResultPasswordTooFreshTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanTransferOwnershipResultPasswordTooFresh) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultPasswordTooFresh#305d9b11 as nil") - } - b.PutInt32(c.RetryAfter) - return nil -} - -// Decode implements bin.Decoder. -func (c *CanTransferOwnershipResultPasswordTooFresh) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultPasswordTooFresh#305d9b11 to nil") - } - if err := b.ConsumeID(CanTransferOwnershipResultPasswordTooFreshTypeID); err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultPasswordTooFresh#305d9b11: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanTransferOwnershipResultPasswordTooFresh) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultPasswordTooFresh#305d9b11 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultPasswordTooFresh#305d9b11: field retry_after: %w", err) - } - c.RetryAfter = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanTransferOwnershipResultPasswordTooFresh) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultPasswordTooFresh#305d9b11 as nil") - } - b.ObjStart() - b.PutID("canTransferOwnershipResultPasswordTooFresh") - b.Comma() - b.FieldStart("retry_after") - b.PutInt32(c.RetryAfter) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanTransferOwnershipResultPasswordTooFresh) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultPasswordTooFresh#305d9b11 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canTransferOwnershipResultPasswordTooFresh"); err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultPasswordTooFresh#305d9b11: %w", err) - } - case "retry_after": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultPasswordTooFresh#305d9b11: field retry_after: %w", err) - } - c.RetryAfter = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRetryAfter returns value of RetryAfter field. -func (c *CanTransferOwnershipResultPasswordTooFresh) GetRetryAfter() (value int32) { - if c == nil { - return - } - return c.RetryAfter -} - -// CanTransferOwnershipResultSessionTooFresh represents TL type `canTransferOwnershipResultSessionTooFresh#3ab0c8e1`. -type CanTransferOwnershipResultSessionTooFresh struct { - // Time left before the session can be used to transfer ownership of a chat, in seconds - RetryAfter int32 -} - -// CanTransferOwnershipResultSessionTooFreshTypeID is TL type id of CanTransferOwnershipResultSessionTooFresh. -const CanTransferOwnershipResultSessionTooFreshTypeID = 0x3ab0c8e1 - -// construct implements constructor of CanTransferOwnershipResultClass. -func (c CanTransferOwnershipResultSessionTooFresh) construct() CanTransferOwnershipResultClass { - return &c -} - -// Ensuring interfaces in compile-time for CanTransferOwnershipResultSessionTooFresh. -var ( - _ bin.Encoder = &CanTransferOwnershipResultSessionTooFresh{} - _ bin.Decoder = &CanTransferOwnershipResultSessionTooFresh{} - _ bin.BareEncoder = &CanTransferOwnershipResultSessionTooFresh{} - _ bin.BareDecoder = &CanTransferOwnershipResultSessionTooFresh{} - - _ CanTransferOwnershipResultClass = &CanTransferOwnershipResultSessionTooFresh{} -) - -func (c *CanTransferOwnershipResultSessionTooFresh) Zero() bool { - if c == nil { - return true - } - if !(c.RetryAfter == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CanTransferOwnershipResultSessionTooFresh) String() string { - if c == nil { - return "CanTransferOwnershipResultSessionTooFresh(nil)" - } - type Alias CanTransferOwnershipResultSessionTooFresh - return fmt.Sprintf("CanTransferOwnershipResultSessionTooFresh%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CanTransferOwnershipResultSessionTooFresh) TypeID() uint32 { - return CanTransferOwnershipResultSessionTooFreshTypeID -} - -// TypeName returns name of type in TL schema. -func (*CanTransferOwnershipResultSessionTooFresh) TypeName() string { - return "canTransferOwnershipResultSessionTooFresh" -} - -// TypeInfo returns info about TL type. -func (c *CanTransferOwnershipResultSessionTooFresh) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "canTransferOwnershipResultSessionTooFresh", - ID: CanTransferOwnershipResultSessionTooFreshTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RetryAfter", - SchemaName: "retry_after", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CanTransferOwnershipResultSessionTooFresh) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultSessionTooFresh#3ab0c8e1 as nil") - } - b.PutID(CanTransferOwnershipResultSessionTooFreshTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CanTransferOwnershipResultSessionTooFresh) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultSessionTooFresh#3ab0c8e1 as nil") - } - b.PutInt32(c.RetryAfter) - return nil -} - -// Decode implements bin.Decoder. -func (c *CanTransferOwnershipResultSessionTooFresh) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultSessionTooFresh#3ab0c8e1 to nil") - } - if err := b.ConsumeID(CanTransferOwnershipResultSessionTooFreshTypeID); err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultSessionTooFresh#3ab0c8e1: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CanTransferOwnershipResultSessionTooFresh) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultSessionTooFresh#3ab0c8e1 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultSessionTooFresh#3ab0c8e1: field retry_after: %w", err) - } - c.RetryAfter = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CanTransferOwnershipResultSessionTooFresh) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode canTransferOwnershipResultSessionTooFresh#3ab0c8e1 as nil") - } - b.ObjStart() - b.PutID("canTransferOwnershipResultSessionTooFresh") - b.Comma() - b.FieldStart("retry_after") - b.PutInt32(c.RetryAfter) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CanTransferOwnershipResultSessionTooFresh) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode canTransferOwnershipResultSessionTooFresh#3ab0c8e1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("canTransferOwnershipResultSessionTooFresh"); err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultSessionTooFresh#3ab0c8e1: %w", err) - } - case "retry_after": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode canTransferOwnershipResultSessionTooFresh#3ab0c8e1: field retry_after: %w", err) - } - c.RetryAfter = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRetryAfter returns value of RetryAfter field. -func (c *CanTransferOwnershipResultSessionTooFresh) GetRetryAfter() (value int32) { - if c == nil { - return - } - return c.RetryAfter -} - -// CanTransferOwnershipResultClassName is schema name of CanTransferOwnershipResultClass. -const CanTransferOwnershipResultClassName = "CanTransferOwnershipResult" - -// CanTransferOwnershipResultClass represents CanTransferOwnershipResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeCanTransferOwnershipResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.CanTransferOwnershipResultOk: // canTransferOwnershipResultOk#faa48643 -// case *tdapi.CanTransferOwnershipResultPasswordNeeded: // canTransferOwnershipResultPasswordNeeded#5c4a4adf -// case *tdapi.CanTransferOwnershipResultPasswordTooFresh: // canTransferOwnershipResultPasswordTooFresh#305d9b11 -// case *tdapi.CanTransferOwnershipResultSessionTooFresh: // canTransferOwnershipResultSessionTooFresh#3ab0c8e1 -// default: panic(v) -// } -type CanTransferOwnershipResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() CanTransferOwnershipResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeCanTransferOwnershipResult implements binary de-serialization for CanTransferOwnershipResultClass. -func DecodeCanTransferOwnershipResult(buf *bin.Buffer) (CanTransferOwnershipResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case CanTransferOwnershipResultOkTypeID: - // Decoding canTransferOwnershipResultOk#faa48643. - v := CanTransferOwnershipResultOk{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanTransferOwnershipResultClass: %w", err) - } - return &v, nil - case CanTransferOwnershipResultPasswordNeededTypeID: - // Decoding canTransferOwnershipResultPasswordNeeded#5c4a4adf. - v := CanTransferOwnershipResultPasswordNeeded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanTransferOwnershipResultClass: %w", err) - } - return &v, nil - case CanTransferOwnershipResultPasswordTooFreshTypeID: - // Decoding canTransferOwnershipResultPasswordTooFresh#305d9b11. - v := CanTransferOwnershipResultPasswordTooFresh{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanTransferOwnershipResultClass: %w", err) - } - return &v, nil - case CanTransferOwnershipResultSessionTooFreshTypeID: - // Decoding canTransferOwnershipResultSessionTooFresh#3ab0c8e1. - v := CanTransferOwnershipResultSessionTooFresh{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanTransferOwnershipResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CanTransferOwnershipResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONCanTransferOwnershipResult implements binary de-serialization for CanTransferOwnershipResultClass. -func DecodeTDLibJSONCanTransferOwnershipResult(buf tdjson.Decoder) (CanTransferOwnershipResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "canTransferOwnershipResultOk": - // Decoding canTransferOwnershipResultOk#faa48643. - v := CanTransferOwnershipResultOk{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanTransferOwnershipResultClass: %w", err) - } - return &v, nil - case "canTransferOwnershipResultPasswordNeeded": - // Decoding canTransferOwnershipResultPasswordNeeded#5c4a4adf. - v := CanTransferOwnershipResultPasswordNeeded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanTransferOwnershipResultClass: %w", err) - } - return &v, nil - case "canTransferOwnershipResultPasswordTooFresh": - // Decoding canTransferOwnershipResultPasswordTooFresh#305d9b11. - v := CanTransferOwnershipResultPasswordTooFresh{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanTransferOwnershipResultClass: %w", err) - } - return &v, nil - case "canTransferOwnershipResultSessionTooFresh": - // Decoding canTransferOwnershipResultSessionTooFresh#3ab0c8e1. - v := CanTransferOwnershipResultSessionTooFresh{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CanTransferOwnershipResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CanTransferOwnershipResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// CanTransferOwnershipResult boxes the CanTransferOwnershipResultClass providing a helper. -type CanTransferOwnershipResultBox struct { - CanTransferOwnershipResult CanTransferOwnershipResultClass -} - -// Decode implements bin.Decoder for CanTransferOwnershipResultBox. -func (b *CanTransferOwnershipResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode CanTransferOwnershipResultBox to nil") - } - v, err := DecodeCanTransferOwnershipResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CanTransferOwnershipResult = v - return nil -} - -// Encode implements bin.Encode for CanTransferOwnershipResultBox. -func (b *CanTransferOwnershipResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.CanTransferOwnershipResult == nil { - return fmt.Errorf("unable to encode CanTransferOwnershipResultClass as nil") - } - return b.CanTransferOwnershipResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for CanTransferOwnershipResultBox. -func (b *CanTransferOwnershipResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode CanTransferOwnershipResultBox to nil") - } - v, err := DecodeTDLibJSONCanTransferOwnershipResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CanTransferOwnershipResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for CanTransferOwnershipResultBox. -func (b *CanTransferOwnershipResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.CanTransferOwnershipResult == nil { - return fmt.Errorf("unable to encode CanTransferOwnershipResultClass as nil") - } - return b.CanTransferOwnershipResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_cancel_download_file_gen.go b/tdapi/tl_cancel_download_file_gen.go deleted file mode 100644 index e90accfa8..000000000 --- a/tdapi/tl_cancel_download_file_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CancelDownloadFileRequest represents TL type `cancelDownloadFile#8b8052de`. -type CancelDownloadFileRequest struct { - // Identifier of a file to stop downloading - FileID int32 - // Pass true to stop downloading only if it hasn't been started, i.e. request hasn't been - // sent to server - OnlyIfPending bool -} - -// CancelDownloadFileRequestTypeID is TL type id of CancelDownloadFileRequest. -const CancelDownloadFileRequestTypeID = 0x8b8052de - -// Ensuring interfaces in compile-time for CancelDownloadFileRequest. -var ( - _ bin.Encoder = &CancelDownloadFileRequest{} - _ bin.Decoder = &CancelDownloadFileRequest{} - _ bin.BareEncoder = &CancelDownloadFileRequest{} - _ bin.BareDecoder = &CancelDownloadFileRequest{} -) - -func (c *CancelDownloadFileRequest) Zero() bool { - if c == nil { - return true - } - if !(c.FileID == 0) { - return false - } - if !(c.OnlyIfPending == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CancelDownloadFileRequest) String() string { - if c == nil { - return "CancelDownloadFileRequest(nil)" - } - type Alias CancelDownloadFileRequest - return fmt.Sprintf("CancelDownloadFileRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CancelDownloadFileRequest) TypeID() uint32 { - return CancelDownloadFileRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CancelDownloadFileRequest) TypeName() string { - return "cancelDownloadFile" -} - -// TypeInfo returns info about TL type. -func (c *CancelDownloadFileRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "cancelDownloadFile", - ID: CancelDownloadFileRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "OnlyIfPending", - SchemaName: "only_if_pending", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CancelDownloadFileRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode cancelDownloadFile#8b8052de as nil") - } - b.PutID(CancelDownloadFileRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CancelDownloadFileRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode cancelDownloadFile#8b8052de as nil") - } - b.PutInt32(c.FileID) - b.PutBool(c.OnlyIfPending) - return nil -} - -// Decode implements bin.Decoder. -func (c *CancelDownloadFileRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode cancelDownloadFile#8b8052de to nil") - } - if err := b.ConsumeID(CancelDownloadFileRequestTypeID); err != nil { - return fmt.Errorf("unable to decode cancelDownloadFile#8b8052de: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CancelDownloadFileRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode cancelDownloadFile#8b8052de to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode cancelDownloadFile#8b8052de: field file_id: %w", err) - } - c.FileID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode cancelDownloadFile#8b8052de: field only_if_pending: %w", err) - } - c.OnlyIfPending = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CancelDownloadFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode cancelDownloadFile#8b8052de as nil") - } - b.ObjStart() - b.PutID("cancelDownloadFile") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(c.FileID) - b.Comma() - b.FieldStart("only_if_pending") - b.PutBool(c.OnlyIfPending) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CancelDownloadFileRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode cancelDownloadFile#8b8052de to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("cancelDownloadFile"); err != nil { - return fmt.Errorf("unable to decode cancelDownloadFile#8b8052de: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode cancelDownloadFile#8b8052de: field file_id: %w", err) - } - c.FileID = value - case "only_if_pending": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode cancelDownloadFile#8b8052de: field only_if_pending: %w", err) - } - c.OnlyIfPending = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (c *CancelDownloadFileRequest) GetFileID() (value int32) { - if c == nil { - return - } - return c.FileID -} - -// GetOnlyIfPending returns value of OnlyIfPending field. -func (c *CancelDownloadFileRequest) GetOnlyIfPending() (value bool) { - if c == nil { - return - } - return c.OnlyIfPending -} - -// CancelDownloadFile invokes method cancelDownloadFile#8b8052de returning error if any. -func (c *Client) CancelDownloadFile(ctx context.Context, request *CancelDownloadFileRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_cancel_password_reset_gen.go b/tdapi/tl_cancel_password_reset_gen.go deleted file mode 100644 index 38b0ecb6d..000000000 --- a/tdapi/tl_cancel_password_reset_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CancelPasswordResetRequest represents TL type `cancelPasswordReset#38127462`. -type CancelPasswordResetRequest struct { -} - -// CancelPasswordResetRequestTypeID is TL type id of CancelPasswordResetRequest. -const CancelPasswordResetRequestTypeID = 0x38127462 - -// Ensuring interfaces in compile-time for CancelPasswordResetRequest. -var ( - _ bin.Encoder = &CancelPasswordResetRequest{} - _ bin.Decoder = &CancelPasswordResetRequest{} - _ bin.BareEncoder = &CancelPasswordResetRequest{} - _ bin.BareDecoder = &CancelPasswordResetRequest{} -) - -func (c *CancelPasswordResetRequest) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CancelPasswordResetRequest) String() string { - if c == nil { - return "CancelPasswordResetRequest(nil)" - } - type Alias CancelPasswordResetRequest - return fmt.Sprintf("CancelPasswordResetRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CancelPasswordResetRequest) TypeID() uint32 { - return CancelPasswordResetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CancelPasswordResetRequest) TypeName() string { - return "cancelPasswordReset" -} - -// TypeInfo returns info about TL type. -func (c *CancelPasswordResetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "cancelPasswordReset", - ID: CancelPasswordResetRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CancelPasswordResetRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode cancelPasswordReset#38127462 as nil") - } - b.PutID(CancelPasswordResetRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CancelPasswordResetRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode cancelPasswordReset#38127462 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CancelPasswordResetRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode cancelPasswordReset#38127462 to nil") - } - if err := b.ConsumeID(CancelPasswordResetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode cancelPasswordReset#38127462: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CancelPasswordResetRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode cancelPasswordReset#38127462 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CancelPasswordResetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode cancelPasswordReset#38127462 as nil") - } - b.ObjStart() - b.PutID("cancelPasswordReset") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CancelPasswordResetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode cancelPasswordReset#38127462 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("cancelPasswordReset"); err != nil { - return fmt.Errorf("unable to decode cancelPasswordReset#38127462: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CancelPasswordReset invokes method cancelPasswordReset#38127462 returning error if any. -func (c *Client) CancelPasswordReset(ctx context.Context) error { - var ok Ok - - request := &CancelPasswordResetRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_cancel_preliminary_upload_file_gen.go b/tdapi/tl_cancel_preliminary_upload_file_gen.go deleted file mode 100644 index db436a9bc..000000000 --- a/tdapi/tl_cancel_preliminary_upload_file_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CancelPreliminaryUploadFileRequest represents TL type `cancelPreliminaryUploadFile#311446be`. -type CancelPreliminaryUploadFileRequest struct { - // Identifier of the file to stop uploading - FileID int32 -} - -// CancelPreliminaryUploadFileRequestTypeID is TL type id of CancelPreliminaryUploadFileRequest. -const CancelPreliminaryUploadFileRequestTypeID = 0x311446be - -// Ensuring interfaces in compile-time for CancelPreliminaryUploadFileRequest. -var ( - _ bin.Encoder = &CancelPreliminaryUploadFileRequest{} - _ bin.Decoder = &CancelPreliminaryUploadFileRequest{} - _ bin.BareEncoder = &CancelPreliminaryUploadFileRequest{} - _ bin.BareDecoder = &CancelPreliminaryUploadFileRequest{} -) - -func (c *CancelPreliminaryUploadFileRequest) Zero() bool { - if c == nil { - return true - } - if !(c.FileID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CancelPreliminaryUploadFileRequest) String() string { - if c == nil { - return "CancelPreliminaryUploadFileRequest(nil)" - } - type Alias CancelPreliminaryUploadFileRequest - return fmt.Sprintf("CancelPreliminaryUploadFileRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CancelPreliminaryUploadFileRequest) TypeID() uint32 { - return CancelPreliminaryUploadFileRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CancelPreliminaryUploadFileRequest) TypeName() string { - return "cancelPreliminaryUploadFile" -} - -// TypeInfo returns info about TL type. -func (c *CancelPreliminaryUploadFileRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "cancelPreliminaryUploadFile", - ID: CancelPreliminaryUploadFileRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CancelPreliminaryUploadFileRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode cancelPreliminaryUploadFile#311446be as nil") - } - b.PutID(CancelPreliminaryUploadFileRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CancelPreliminaryUploadFileRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode cancelPreliminaryUploadFile#311446be as nil") - } - b.PutInt32(c.FileID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CancelPreliminaryUploadFileRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode cancelPreliminaryUploadFile#311446be to nil") - } - if err := b.ConsumeID(CancelPreliminaryUploadFileRequestTypeID); err != nil { - return fmt.Errorf("unable to decode cancelPreliminaryUploadFile#311446be: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CancelPreliminaryUploadFileRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode cancelPreliminaryUploadFile#311446be to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode cancelPreliminaryUploadFile#311446be: field file_id: %w", err) - } - c.FileID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CancelPreliminaryUploadFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode cancelPreliminaryUploadFile#311446be as nil") - } - b.ObjStart() - b.PutID("cancelPreliminaryUploadFile") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(c.FileID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CancelPreliminaryUploadFileRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode cancelPreliminaryUploadFile#311446be to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("cancelPreliminaryUploadFile"); err != nil { - return fmt.Errorf("unable to decode cancelPreliminaryUploadFile#311446be: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode cancelPreliminaryUploadFile#311446be: field file_id: %w", err) - } - c.FileID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (c *CancelPreliminaryUploadFileRequest) GetFileID() (value int32) { - if c == nil { - return - } - return c.FileID -} - -// CancelPreliminaryUploadFile invokes method cancelPreliminaryUploadFile#311446be returning error if any. -func (c *Client) CancelPreliminaryUploadFile(ctx context.Context, fileid int32) error { - var ok Ok - - request := &CancelPreliminaryUploadFileRequest{ - FileID: fileid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_cancel_recovery_email_address_verification_gen.go b/tdapi/tl_cancel_recovery_email_address_verification_gen.go deleted file mode 100644 index a173f6d10..000000000 --- a/tdapi/tl_cancel_recovery_email_address_verification_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CancelRecoveryEmailAddressVerificationRequest represents TL type `cancelRecoveryEmailAddressVerification#a5988e8d`. -type CancelRecoveryEmailAddressVerificationRequest struct { -} - -// CancelRecoveryEmailAddressVerificationRequestTypeID is TL type id of CancelRecoveryEmailAddressVerificationRequest. -const CancelRecoveryEmailAddressVerificationRequestTypeID = 0xa5988e8d - -// Ensuring interfaces in compile-time for CancelRecoveryEmailAddressVerificationRequest. -var ( - _ bin.Encoder = &CancelRecoveryEmailAddressVerificationRequest{} - _ bin.Decoder = &CancelRecoveryEmailAddressVerificationRequest{} - _ bin.BareEncoder = &CancelRecoveryEmailAddressVerificationRequest{} - _ bin.BareDecoder = &CancelRecoveryEmailAddressVerificationRequest{} -) - -func (c *CancelRecoveryEmailAddressVerificationRequest) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CancelRecoveryEmailAddressVerificationRequest) String() string { - if c == nil { - return "CancelRecoveryEmailAddressVerificationRequest(nil)" - } - type Alias CancelRecoveryEmailAddressVerificationRequest - return fmt.Sprintf("CancelRecoveryEmailAddressVerificationRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CancelRecoveryEmailAddressVerificationRequest) TypeID() uint32 { - return CancelRecoveryEmailAddressVerificationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CancelRecoveryEmailAddressVerificationRequest) TypeName() string { - return "cancelRecoveryEmailAddressVerification" -} - -// TypeInfo returns info about TL type. -func (c *CancelRecoveryEmailAddressVerificationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "cancelRecoveryEmailAddressVerification", - ID: CancelRecoveryEmailAddressVerificationRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CancelRecoveryEmailAddressVerificationRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode cancelRecoveryEmailAddressVerification#a5988e8d as nil") - } - b.PutID(CancelRecoveryEmailAddressVerificationRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CancelRecoveryEmailAddressVerificationRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode cancelRecoveryEmailAddressVerification#a5988e8d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CancelRecoveryEmailAddressVerificationRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode cancelRecoveryEmailAddressVerification#a5988e8d to nil") - } - if err := b.ConsumeID(CancelRecoveryEmailAddressVerificationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode cancelRecoveryEmailAddressVerification#a5988e8d: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CancelRecoveryEmailAddressVerificationRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode cancelRecoveryEmailAddressVerification#a5988e8d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CancelRecoveryEmailAddressVerificationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode cancelRecoveryEmailAddressVerification#a5988e8d as nil") - } - b.ObjStart() - b.PutID("cancelRecoveryEmailAddressVerification") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CancelRecoveryEmailAddressVerificationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode cancelRecoveryEmailAddressVerification#a5988e8d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("cancelRecoveryEmailAddressVerification"); err != nil { - return fmt.Errorf("unable to decode cancelRecoveryEmailAddressVerification#a5988e8d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CancelRecoveryEmailAddressVerification invokes method cancelRecoveryEmailAddressVerification#a5988e8d returning error if any. -func (c *Client) CancelRecoveryEmailAddressVerification(ctx context.Context) (*PasswordState, error) { - var result PasswordState - - request := &CancelRecoveryEmailAddressVerificationRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_change_imported_contacts_gen.go b/tdapi/tl_change_imported_contacts_gen.go deleted file mode 100644 index ae0fabbdc..000000000 --- a/tdapi/tl_change_imported_contacts_gen.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChangeImportedContactsRequest represents TL type `changeImportedContacts#24885905`. -type ChangeImportedContactsRequest struct { - // The new list of contacts, contact's vCard are ignored and are not imported - Contacts []Contact -} - -// ChangeImportedContactsRequestTypeID is TL type id of ChangeImportedContactsRequest. -const ChangeImportedContactsRequestTypeID = 0x24885905 - -// Ensuring interfaces in compile-time for ChangeImportedContactsRequest. -var ( - _ bin.Encoder = &ChangeImportedContactsRequest{} - _ bin.Decoder = &ChangeImportedContactsRequest{} - _ bin.BareEncoder = &ChangeImportedContactsRequest{} - _ bin.BareDecoder = &ChangeImportedContactsRequest{} -) - -func (c *ChangeImportedContactsRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Contacts == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChangeImportedContactsRequest) String() string { - if c == nil { - return "ChangeImportedContactsRequest(nil)" - } - type Alias ChangeImportedContactsRequest - return fmt.Sprintf("ChangeImportedContactsRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChangeImportedContactsRequest) TypeID() uint32 { - return ChangeImportedContactsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChangeImportedContactsRequest) TypeName() string { - return "changeImportedContacts" -} - -// TypeInfo returns info about TL type. -func (c *ChangeImportedContactsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "changeImportedContacts", - ID: ChangeImportedContactsRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Contacts", - SchemaName: "contacts", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChangeImportedContactsRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode changeImportedContacts#24885905 as nil") - } - b.PutID(ChangeImportedContactsRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChangeImportedContactsRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode changeImportedContacts#24885905 as nil") - } - b.PutInt(len(c.Contacts)) - for idx, v := range c.Contacts { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare changeImportedContacts#24885905: field contacts element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChangeImportedContactsRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode changeImportedContacts#24885905 to nil") - } - if err := b.ConsumeID(ChangeImportedContactsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode changeImportedContacts#24885905: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChangeImportedContactsRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode changeImportedContacts#24885905 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode changeImportedContacts#24885905: field contacts: %w", err) - } - - if headerLen > 0 { - c.Contacts = make([]Contact, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Contact - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare changeImportedContacts#24885905: field contacts: %w", err) - } - c.Contacts = append(c.Contacts, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChangeImportedContactsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode changeImportedContacts#24885905 as nil") - } - b.ObjStart() - b.PutID("changeImportedContacts") - b.Comma() - b.FieldStart("contacts") - b.ArrStart() - for idx, v := range c.Contacts { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode changeImportedContacts#24885905: field contacts element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChangeImportedContactsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode changeImportedContacts#24885905 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("changeImportedContacts"); err != nil { - return fmt.Errorf("unable to decode changeImportedContacts#24885905: %w", err) - } - case "contacts": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Contact - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode changeImportedContacts#24885905: field contacts: %w", err) - } - c.Contacts = append(c.Contacts, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode changeImportedContacts#24885905: field contacts: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetContacts returns value of Contacts field. -func (c *ChangeImportedContactsRequest) GetContacts() (value []Contact) { - if c == nil { - return - } - return c.Contacts -} - -// ChangeImportedContacts invokes method changeImportedContacts#24885905 returning error if any. -func (c *Client) ChangeImportedContacts(ctx context.Context, contacts []Contact) (*ImportedContacts, error) { - var result ImportedContacts - - request := &ChangeImportedContactsRequest{ - Contacts: contacts, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_change_sticker_set_gen.go b/tdapi/tl_change_sticker_set_gen.go deleted file mode 100644 index f98a26bd3..000000000 --- a/tdapi/tl_change_sticker_set_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChangeStickerSetRequest represents TL type `changeStickerSet#1ac8a5ed`. -type ChangeStickerSetRequest struct { - // Identifier of the sticker set - SetID int64 - // The new value of is_installed - IsInstalled bool - // The new value of is_archived. A sticker set can't be installed and archived - // simultaneously - IsArchived bool -} - -// ChangeStickerSetRequestTypeID is TL type id of ChangeStickerSetRequest. -const ChangeStickerSetRequestTypeID = 0x1ac8a5ed - -// Ensuring interfaces in compile-time for ChangeStickerSetRequest. -var ( - _ bin.Encoder = &ChangeStickerSetRequest{} - _ bin.Decoder = &ChangeStickerSetRequest{} - _ bin.BareEncoder = &ChangeStickerSetRequest{} - _ bin.BareDecoder = &ChangeStickerSetRequest{} -) - -func (c *ChangeStickerSetRequest) Zero() bool { - if c == nil { - return true - } - if !(c.SetID == 0) { - return false - } - if !(c.IsInstalled == false) { - return false - } - if !(c.IsArchived == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChangeStickerSetRequest) String() string { - if c == nil { - return "ChangeStickerSetRequest(nil)" - } - type Alias ChangeStickerSetRequest - return fmt.Sprintf("ChangeStickerSetRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChangeStickerSetRequest) TypeID() uint32 { - return ChangeStickerSetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChangeStickerSetRequest) TypeName() string { - return "changeStickerSet" -} - -// TypeInfo returns info about TL type. -func (c *ChangeStickerSetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "changeStickerSet", - ID: ChangeStickerSetRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SetID", - SchemaName: "set_id", - }, - { - Name: "IsInstalled", - SchemaName: "is_installed", - }, - { - Name: "IsArchived", - SchemaName: "is_archived", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChangeStickerSetRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode changeStickerSet#1ac8a5ed as nil") - } - b.PutID(ChangeStickerSetRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChangeStickerSetRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode changeStickerSet#1ac8a5ed as nil") - } - b.PutLong(c.SetID) - b.PutBool(c.IsInstalled) - b.PutBool(c.IsArchived) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChangeStickerSetRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode changeStickerSet#1ac8a5ed to nil") - } - if err := b.ConsumeID(ChangeStickerSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode changeStickerSet#1ac8a5ed: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChangeStickerSetRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode changeStickerSet#1ac8a5ed to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode changeStickerSet#1ac8a5ed: field set_id: %w", err) - } - c.SetID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode changeStickerSet#1ac8a5ed: field is_installed: %w", err) - } - c.IsInstalled = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode changeStickerSet#1ac8a5ed: field is_archived: %w", err) - } - c.IsArchived = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChangeStickerSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode changeStickerSet#1ac8a5ed as nil") - } - b.ObjStart() - b.PutID("changeStickerSet") - b.Comma() - b.FieldStart("set_id") - b.PutLong(c.SetID) - b.Comma() - b.FieldStart("is_installed") - b.PutBool(c.IsInstalled) - b.Comma() - b.FieldStart("is_archived") - b.PutBool(c.IsArchived) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChangeStickerSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode changeStickerSet#1ac8a5ed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("changeStickerSet"); err != nil { - return fmt.Errorf("unable to decode changeStickerSet#1ac8a5ed: %w", err) - } - case "set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode changeStickerSet#1ac8a5ed: field set_id: %w", err) - } - c.SetID = value - case "is_installed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode changeStickerSet#1ac8a5ed: field is_installed: %w", err) - } - c.IsInstalled = value - case "is_archived": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode changeStickerSet#1ac8a5ed: field is_archived: %w", err) - } - c.IsArchived = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSetID returns value of SetID field. -func (c *ChangeStickerSetRequest) GetSetID() (value int64) { - if c == nil { - return - } - return c.SetID -} - -// GetIsInstalled returns value of IsInstalled field. -func (c *ChangeStickerSetRequest) GetIsInstalled() (value bool) { - if c == nil { - return - } - return c.IsInstalled -} - -// GetIsArchived returns value of IsArchived field. -func (c *ChangeStickerSetRequest) GetIsArchived() (value bool) { - if c == nil { - return - } - return c.IsArchived -} - -// ChangeStickerSet invokes method changeStickerSet#1ac8a5ed returning error if any. -func (c *Client) ChangeStickerSet(ctx context.Context, request *ChangeStickerSetRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_chat_action_bar_gen.go b/tdapi/tl_chat_action_bar_gen.go deleted file mode 100644 index f7b52e6a8..000000000 --- a/tdapi/tl_chat_action_bar_gen.go +++ /dev/null @@ -1,1192 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatActionBarReportSpam represents TL type `chatActionBarReportSpam#b1c0e61a`. -type ChatActionBarReportSpam struct { - // If true, the chat was automatically archived and can be moved back to the main chat - // list using addChatToList simultaneously with setting chat notification settings to - // default using setChatNotificationSettings - CanUnarchive bool -} - -// ChatActionBarReportSpamTypeID is TL type id of ChatActionBarReportSpam. -const ChatActionBarReportSpamTypeID = 0xb1c0e61a - -// construct implements constructor of ChatActionBarClass. -func (c ChatActionBarReportSpam) construct() ChatActionBarClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionBarReportSpam. -var ( - _ bin.Encoder = &ChatActionBarReportSpam{} - _ bin.Decoder = &ChatActionBarReportSpam{} - _ bin.BareEncoder = &ChatActionBarReportSpam{} - _ bin.BareDecoder = &ChatActionBarReportSpam{} - - _ ChatActionBarClass = &ChatActionBarReportSpam{} -) - -func (c *ChatActionBarReportSpam) Zero() bool { - if c == nil { - return true - } - if !(c.CanUnarchive == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionBarReportSpam) String() string { - if c == nil { - return "ChatActionBarReportSpam(nil)" - } - type Alias ChatActionBarReportSpam - return fmt.Sprintf("ChatActionBarReportSpam%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionBarReportSpam) TypeID() uint32 { - return ChatActionBarReportSpamTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionBarReportSpam) TypeName() string { - return "chatActionBarReportSpam" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionBarReportSpam) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionBarReportSpam", - ID: ChatActionBarReportSpamTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CanUnarchive", - SchemaName: "can_unarchive", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionBarReportSpam) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarReportSpam#b1c0e61a as nil") - } - b.PutID(ChatActionBarReportSpamTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionBarReportSpam) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarReportSpam#b1c0e61a as nil") - } - b.PutBool(c.CanUnarchive) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionBarReportSpam) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarReportSpam#b1c0e61a to nil") - } - if err := b.ConsumeID(ChatActionBarReportSpamTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionBarReportSpam#b1c0e61a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionBarReportSpam) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarReportSpam#b1c0e61a to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatActionBarReportSpam#b1c0e61a: field can_unarchive: %w", err) - } - c.CanUnarchive = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionBarReportSpam) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarReportSpam#b1c0e61a as nil") - } - b.ObjStart() - b.PutID("chatActionBarReportSpam") - b.Comma() - b.FieldStart("can_unarchive") - b.PutBool(c.CanUnarchive) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionBarReportSpam) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarReportSpam#b1c0e61a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionBarReportSpam"); err != nil { - return fmt.Errorf("unable to decode chatActionBarReportSpam#b1c0e61a: %w", err) - } - case "can_unarchive": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatActionBarReportSpam#b1c0e61a: field can_unarchive: %w", err) - } - c.CanUnarchive = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCanUnarchive returns value of CanUnarchive field. -func (c *ChatActionBarReportSpam) GetCanUnarchive() (value bool) { - if c == nil { - return - } - return c.CanUnarchive -} - -// ChatActionBarInviteMembers represents TL type `chatActionBarInviteMembers#76557c70`. -type ChatActionBarInviteMembers struct { -} - -// ChatActionBarInviteMembersTypeID is TL type id of ChatActionBarInviteMembers. -const ChatActionBarInviteMembersTypeID = 0x76557c70 - -// construct implements constructor of ChatActionBarClass. -func (c ChatActionBarInviteMembers) construct() ChatActionBarClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionBarInviteMembers. -var ( - _ bin.Encoder = &ChatActionBarInviteMembers{} - _ bin.Decoder = &ChatActionBarInviteMembers{} - _ bin.BareEncoder = &ChatActionBarInviteMembers{} - _ bin.BareDecoder = &ChatActionBarInviteMembers{} - - _ ChatActionBarClass = &ChatActionBarInviteMembers{} -) - -func (c *ChatActionBarInviteMembers) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionBarInviteMembers) String() string { - if c == nil { - return "ChatActionBarInviteMembers(nil)" - } - type Alias ChatActionBarInviteMembers - return fmt.Sprintf("ChatActionBarInviteMembers%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionBarInviteMembers) TypeID() uint32 { - return ChatActionBarInviteMembersTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionBarInviteMembers) TypeName() string { - return "chatActionBarInviteMembers" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionBarInviteMembers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionBarInviteMembers", - ID: ChatActionBarInviteMembersTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionBarInviteMembers) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarInviteMembers#76557c70 as nil") - } - b.PutID(ChatActionBarInviteMembersTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionBarInviteMembers) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarInviteMembers#76557c70 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionBarInviteMembers) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarInviteMembers#76557c70 to nil") - } - if err := b.ConsumeID(ChatActionBarInviteMembersTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionBarInviteMembers#76557c70: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionBarInviteMembers) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarInviteMembers#76557c70 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionBarInviteMembers) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarInviteMembers#76557c70 as nil") - } - b.ObjStart() - b.PutID("chatActionBarInviteMembers") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionBarInviteMembers) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarInviteMembers#76557c70 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionBarInviteMembers"); err != nil { - return fmt.Errorf("unable to decode chatActionBarInviteMembers#76557c70: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionBarReportAddBlock represents TL type `chatActionBarReportAddBlock#a9748a2a`. -type ChatActionBarReportAddBlock struct { - // If true, the chat was automatically archived and can be moved back to the main chat - // list using addChatToList simultaneously with setting chat notification settings to - // default using setChatNotificationSettings - CanUnarchive bool -} - -// ChatActionBarReportAddBlockTypeID is TL type id of ChatActionBarReportAddBlock. -const ChatActionBarReportAddBlockTypeID = 0xa9748a2a - -// construct implements constructor of ChatActionBarClass. -func (c ChatActionBarReportAddBlock) construct() ChatActionBarClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionBarReportAddBlock. -var ( - _ bin.Encoder = &ChatActionBarReportAddBlock{} - _ bin.Decoder = &ChatActionBarReportAddBlock{} - _ bin.BareEncoder = &ChatActionBarReportAddBlock{} - _ bin.BareDecoder = &ChatActionBarReportAddBlock{} - - _ ChatActionBarClass = &ChatActionBarReportAddBlock{} -) - -func (c *ChatActionBarReportAddBlock) Zero() bool { - if c == nil { - return true - } - if !(c.CanUnarchive == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionBarReportAddBlock) String() string { - if c == nil { - return "ChatActionBarReportAddBlock(nil)" - } - type Alias ChatActionBarReportAddBlock - return fmt.Sprintf("ChatActionBarReportAddBlock%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionBarReportAddBlock) TypeID() uint32 { - return ChatActionBarReportAddBlockTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionBarReportAddBlock) TypeName() string { - return "chatActionBarReportAddBlock" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionBarReportAddBlock) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionBarReportAddBlock", - ID: ChatActionBarReportAddBlockTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CanUnarchive", - SchemaName: "can_unarchive", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionBarReportAddBlock) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarReportAddBlock#a9748a2a as nil") - } - b.PutID(ChatActionBarReportAddBlockTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionBarReportAddBlock) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarReportAddBlock#a9748a2a as nil") - } - b.PutBool(c.CanUnarchive) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionBarReportAddBlock) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarReportAddBlock#a9748a2a to nil") - } - if err := b.ConsumeID(ChatActionBarReportAddBlockTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionBarReportAddBlock#a9748a2a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionBarReportAddBlock) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarReportAddBlock#a9748a2a to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatActionBarReportAddBlock#a9748a2a: field can_unarchive: %w", err) - } - c.CanUnarchive = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionBarReportAddBlock) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarReportAddBlock#a9748a2a as nil") - } - b.ObjStart() - b.PutID("chatActionBarReportAddBlock") - b.Comma() - b.FieldStart("can_unarchive") - b.PutBool(c.CanUnarchive) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionBarReportAddBlock) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarReportAddBlock#a9748a2a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionBarReportAddBlock"); err != nil { - return fmt.Errorf("unable to decode chatActionBarReportAddBlock#a9748a2a: %w", err) - } - case "can_unarchive": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatActionBarReportAddBlock#a9748a2a: field can_unarchive: %w", err) - } - c.CanUnarchive = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCanUnarchive returns value of CanUnarchive field. -func (c *ChatActionBarReportAddBlock) GetCanUnarchive() (value bool) { - if c == nil { - return - } - return c.CanUnarchive -} - -// ChatActionBarAddContact represents TL type `chatActionBarAddContact#d44a5811`. -type ChatActionBarAddContact struct { -} - -// ChatActionBarAddContactTypeID is TL type id of ChatActionBarAddContact. -const ChatActionBarAddContactTypeID = 0xd44a5811 - -// construct implements constructor of ChatActionBarClass. -func (c ChatActionBarAddContact) construct() ChatActionBarClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionBarAddContact. -var ( - _ bin.Encoder = &ChatActionBarAddContact{} - _ bin.Decoder = &ChatActionBarAddContact{} - _ bin.BareEncoder = &ChatActionBarAddContact{} - _ bin.BareDecoder = &ChatActionBarAddContact{} - - _ ChatActionBarClass = &ChatActionBarAddContact{} -) - -func (c *ChatActionBarAddContact) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionBarAddContact) String() string { - if c == nil { - return "ChatActionBarAddContact(nil)" - } - type Alias ChatActionBarAddContact - return fmt.Sprintf("ChatActionBarAddContact%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionBarAddContact) TypeID() uint32 { - return ChatActionBarAddContactTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionBarAddContact) TypeName() string { - return "chatActionBarAddContact" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionBarAddContact) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionBarAddContact", - ID: ChatActionBarAddContactTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionBarAddContact) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarAddContact#d44a5811 as nil") - } - b.PutID(ChatActionBarAddContactTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionBarAddContact) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarAddContact#d44a5811 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionBarAddContact) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarAddContact#d44a5811 to nil") - } - if err := b.ConsumeID(ChatActionBarAddContactTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionBarAddContact#d44a5811: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionBarAddContact) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarAddContact#d44a5811 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionBarAddContact) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarAddContact#d44a5811 as nil") - } - b.ObjStart() - b.PutID("chatActionBarAddContact") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionBarAddContact) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarAddContact#d44a5811 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionBarAddContact"); err != nil { - return fmt.Errorf("unable to decode chatActionBarAddContact#d44a5811: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionBarSharePhoneNumber represents TL type `chatActionBarSharePhoneNumber#218efd9`. -type ChatActionBarSharePhoneNumber struct { -} - -// ChatActionBarSharePhoneNumberTypeID is TL type id of ChatActionBarSharePhoneNumber. -const ChatActionBarSharePhoneNumberTypeID = 0x218efd9 - -// construct implements constructor of ChatActionBarClass. -func (c ChatActionBarSharePhoneNumber) construct() ChatActionBarClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionBarSharePhoneNumber. -var ( - _ bin.Encoder = &ChatActionBarSharePhoneNumber{} - _ bin.Decoder = &ChatActionBarSharePhoneNumber{} - _ bin.BareEncoder = &ChatActionBarSharePhoneNumber{} - _ bin.BareDecoder = &ChatActionBarSharePhoneNumber{} - - _ ChatActionBarClass = &ChatActionBarSharePhoneNumber{} -) - -func (c *ChatActionBarSharePhoneNumber) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionBarSharePhoneNumber) String() string { - if c == nil { - return "ChatActionBarSharePhoneNumber(nil)" - } - type Alias ChatActionBarSharePhoneNumber - return fmt.Sprintf("ChatActionBarSharePhoneNumber%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionBarSharePhoneNumber) TypeID() uint32 { - return ChatActionBarSharePhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionBarSharePhoneNumber) TypeName() string { - return "chatActionBarSharePhoneNumber" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionBarSharePhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionBarSharePhoneNumber", - ID: ChatActionBarSharePhoneNumberTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionBarSharePhoneNumber) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarSharePhoneNumber#218efd9 as nil") - } - b.PutID(ChatActionBarSharePhoneNumberTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionBarSharePhoneNumber) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarSharePhoneNumber#218efd9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionBarSharePhoneNumber) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarSharePhoneNumber#218efd9 to nil") - } - if err := b.ConsumeID(ChatActionBarSharePhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionBarSharePhoneNumber#218efd9: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionBarSharePhoneNumber) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarSharePhoneNumber#218efd9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionBarSharePhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarSharePhoneNumber#218efd9 as nil") - } - b.ObjStart() - b.PutID("chatActionBarSharePhoneNumber") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionBarSharePhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarSharePhoneNumber#218efd9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionBarSharePhoneNumber"); err != nil { - return fmt.Errorf("unable to decode chatActionBarSharePhoneNumber#218efd9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionBarJoinRequest represents TL type `chatActionBarJoinRequest#3dd18308`. -type ChatActionBarJoinRequest struct { - // Title of the chat to which the join request was sent - Title string - // True, if the join request was sent to a channel chat - IsChannel bool - // Point in time (Unix timestamp) when the join request was sent - RequestDate int32 -} - -// ChatActionBarJoinRequestTypeID is TL type id of ChatActionBarJoinRequest. -const ChatActionBarJoinRequestTypeID = 0x3dd18308 - -// construct implements constructor of ChatActionBarClass. -func (c ChatActionBarJoinRequest) construct() ChatActionBarClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionBarJoinRequest. -var ( - _ bin.Encoder = &ChatActionBarJoinRequest{} - _ bin.Decoder = &ChatActionBarJoinRequest{} - _ bin.BareEncoder = &ChatActionBarJoinRequest{} - _ bin.BareDecoder = &ChatActionBarJoinRequest{} - - _ ChatActionBarClass = &ChatActionBarJoinRequest{} -) - -func (c *ChatActionBarJoinRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Title == "") { - return false - } - if !(c.IsChannel == false) { - return false - } - if !(c.RequestDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionBarJoinRequest) String() string { - if c == nil { - return "ChatActionBarJoinRequest(nil)" - } - type Alias ChatActionBarJoinRequest - return fmt.Sprintf("ChatActionBarJoinRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionBarJoinRequest) TypeID() uint32 { - return ChatActionBarJoinRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionBarJoinRequest) TypeName() string { - return "chatActionBarJoinRequest" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionBarJoinRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionBarJoinRequest", - ID: ChatActionBarJoinRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "IsChannel", - SchemaName: "is_channel", - }, - { - Name: "RequestDate", - SchemaName: "request_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionBarJoinRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarJoinRequest#3dd18308 as nil") - } - b.PutID(ChatActionBarJoinRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionBarJoinRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarJoinRequest#3dd18308 as nil") - } - b.PutString(c.Title) - b.PutBool(c.IsChannel) - b.PutInt32(c.RequestDate) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionBarJoinRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarJoinRequest#3dd18308 to nil") - } - if err := b.ConsumeID(ChatActionBarJoinRequestTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionBarJoinRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarJoinRequest#3dd18308 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field title: %w", err) - } - c.Title = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field is_channel: %w", err) - } - c.IsChannel = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field request_date: %w", err) - } - c.RequestDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionBarJoinRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionBarJoinRequest#3dd18308 as nil") - } - b.ObjStart() - b.PutID("chatActionBarJoinRequest") - b.Comma() - b.FieldStart("title") - b.PutString(c.Title) - b.Comma() - b.FieldStart("is_channel") - b.PutBool(c.IsChannel) - b.Comma() - b.FieldStart("request_date") - b.PutInt32(c.RequestDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionBarJoinRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionBarJoinRequest#3dd18308 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionBarJoinRequest"); err != nil { - return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field title: %w", err) - } - c.Title = value - case "is_channel": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field is_channel: %w", err) - } - c.IsChannel = value - case "request_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionBarJoinRequest#3dd18308: field request_date: %w", err) - } - c.RequestDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (c *ChatActionBarJoinRequest) GetTitle() (value string) { - if c == nil { - return - } - return c.Title -} - -// GetIsChannel returns value of IsChannel field. -func (c *ChatActionBarJoinRequest) GetIsChannel() (value bool) { - if c == nil { - return - } - return c.IsChannel -} - -// GetRequestDate returns value of RequestDate field. -func (c *ChatActionBarJoinRequest) GetRequestDate() (value int32) { - if c == nil { - return - } - return c.RequestDate -} - -// ChatActionBarClassName is schema name of ChatActionBarClass. -const ChatActionBarClassName = "ChatActionBar" - -// ChatActionBarClass represents ChatActionBar generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatActionBar(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatActionBarReportSpam: // chatActionBarReportSpam#b1c0e61a -// case *tdapi.ChatActionBarInviteMembers: // chatActionBarInviteMembers#76557c70 -// case *tdapi.ChatActionBarReportAddBlock: // chatActionBarReportAddBlock#a9748a2a -// case *tdapi.ChatActionBarAddContact: // chatActionBarAddContact#d44a5811 -// case *tdapi.ChatActionBarSharePhoneNumber: // chatActionBarSharePhoneNumber#218efd9 -// case *tdapi.ChatActionBarJoinRequest: // chatActionBarJoinRequest#3dd18308 -// default: panic(v) -// } -type ChatActionBarClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatActionBarClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeChatActionBar implements binary de-serialization for ChatActionBarClass. -func DecodeChatActionBar(buf *bin.Buffer) (ChatActionBarClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatActionBarReportSpamTypeID: - // Decoding chatActionBarReportSpam#b1c0e61a. - v := ChatActionBarReportSpam{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - case ChatActionBarInviteMembersTypeID: - // Decoding chatActionBarInviteMembers#76557c70. - v := ChatActionBarInviteMembers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - case ChatActionBarReportAddBlockTypeID: - // Decoding chatActionBarReportAddBlock#a9748a2a. - v := ChatActionBarReportAddBlock{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - case ChatActionBarAddContactTypeID: - // Decoding chatActionBarAddContact#d44a5811. - v := ChatActionBarAddContact{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - case ChatActionBarSharePhoneNumberTypeID: - // Decoding chatActionBarSharePhoneNumber#218efd9. - v := ChatActionBarSharePhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - case ChatActionBarJoinRequestTypeID: - // Decoding chatActionBarJoinRequest#3dd18308. - v := ChatActionBarJoinRequest{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatActionBar implements binary de-serialization for ChatActionBarClass. -func DecodeTDLibJSONChatActionBar(buf tdjson.Decoder) (ChatActionBarClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatActionBarReportSpam": - // Decoding chatActionBarReportSpam#b1c0e61a. - v := ChatActionBarReportSpam{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - case "chatActionBarInviteMembers": - // Decoding chatActionBarInviteMembers#76557c70. - v := ChatActionBarInviteMembers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - case "chatActionBarReportAddBlock": - // Decoding chatActionBarReportAddBlock#a9748a2a. - v := ChatActionBarReportAddBlock{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - case "chatActionBarAddContact": - // Decoding chatActionBarAddContact#d44a5811. - v := ChatActionBarAddContact{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - case "chatActionBarSharePhoneNumber": - // Decoding chatActionBarSharePhoneNumber#218efd9. - v := ChatActionBarSharePhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - case "chatActionBarJoinRequest": - // Decoding chatActionBarJoinRequest#3dd18308. - v := ChatActionBarJoinRequest{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatActionBarClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatActionBar boxes the ChatActionBarClass providing a helper. -type ChatActionBarBox struct { - ChatActionBar ChatActionBarClass -} - -// Decode implements bin.Decoder for ChatActionBarBox. -func (b *ChatActionBarBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatActionBarBox to nil") - } - v, err := DecodeChatActionBar(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatActionBar = v - return nil -} - -// Encode implements bin.Encode for ChatActionBarBox. -func (b *ChatActionBarBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatActionBar == nil { - return fmt.Errorf("unable to encode ChatActionBarClass as nil") - } - return b.ChatActionBar.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatActionBarBox. -func (b *ChatActionBarBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatActionBarBox to nil") - } - v, err := DecodeTDLibJSONChatActionBar(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatActionBar = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatActionBarBox. -func (b *ChatActionBarBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatActionBar == nil { - return fmt.Errorf("unable to encode ChatActionBarClass as nil") - } - return b.ChatActionBar.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_action_gen.go b/tdapi/tl_chat_action_gen.go deleted file mode 100644 index 9014e1830..000000000 --- a/tdapi/tl_chat_action_gen.go +++ /dev/null @@ -1,2539 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatActionTyping represents TL type `chatActionTyping#16a83437`. -type ChatActionTyping struct { -} - -// ChatActionTypingTypeID is TL type id of ChatActionTyping. -const ChatActionTypingTypeID = 0x16a83437 - -// construct implements constructor of ChatActionClass. -func (c ChatActionTyping) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionTyping. -var ( - _ bin.Encoder = &ChatActionTyping{} - _ bin.Decoder = &ChatActionTyping{} - _ bin.BareEncoder = &ChatActionTyping{} - _ bin.BareDecoder = &ChatActionTyping{} - - _ ChatActionClass = &ChatActionTyping{} -) - -func (c *ChatActionTyping) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionTyping) String() string { - if c == nil { - return "ChatActionTyping(nil)" - } - type Alias ChatActionTyping - return fmt.Sprintf("ChatActionTyping%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionTyping) TypeID() uint32 { - return ChatActionTypingTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionTyping) TypeName() string { - return "chatActionTyping" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionTyping) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionTyping", - ID: ChatActionTypingTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionTyping) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionTyping#16a83437 as nil") - } - b.PutID(ChatActionTypingTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionTyping) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionTyping#16a83437 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionTyping) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionTyping#16a83437 to nil") - } - if err := b.ConsumeID(ChatActionTypingTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionTyping#16a83437: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionTyping) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionTyping#16a83437 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionTyping) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionTyping#16a83437 as nil") - } - b.ObjStart() - b.PutID("chatActionTyping") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionTyping) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionTyping#16a83437 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionTyping"); err != nil { - return fmt.Errorf("unable to decode chatActionTyping#16a83437: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionRecordingVideo represents TL type `chatActionRecordingVideo#ce85792`. -type ChatActionRecordingVideo struct { -} - -// ChatActionRecordingVideoTypeID is TL type id of ChatActionRecordingVideo. -const ChatActionRecordingVideoTypeID = 0xce85792 - -// construct implements constructor of ChatActionClass. -func (c ChatActionRecordingVideo) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionRecordingVideo. -var ( - _ bin.Encoder = &ChatActionRecordingVideo{} - _ bin.Decoder = &ChatActionRecordingVideo{} - _ bin.BareEncoder = &ChatActionRecordingVideo{} - _ bin.BareDecoder = &ChatActionRecordingVideo{} - - _ ChatActionClass = &ChatActionRecordingVideo{} -) - -func (c *ChatActionRecordingVideo) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionRecordingVideo) String() string { - if c == nil { - return "ChatActionRecordingVideo(nil)" - } - type Alias ChatActionRecordingVideo - return fmt.Sprintf("ChatActionRecordingVideo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionRecordingVideo) TypeID() uint32 { - return ChatActionRecordingVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionRecordingVideo) TypeName() string { - return "chatActionRecordingVideo" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionRecordingVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionRecordingVideo", - ID: ChatActionRecordingVideoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionRecordingVideo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionRecordingVideo#ce85792 as nil") - } - b.PutID(ChatActionRecordingVideoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionRecordingVideo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionRecordingVideo#ce85792 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionRecordingVideo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionRecordingVideo#ce85792 to nil") - } - if err := b.ConsumeID(ChatActionRecordingVideoTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionRecordingVideo#ce85792: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionRecordingVideo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionRecordingVideo#ce85792 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionRecordingVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionRecordingVideo#ce85792 as nil") - } - b.ObjStart() - b.PutID("chatActionRecordingVideo") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionRecordingVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionRecordingVideo#ce85792 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionRecordingVideo"); err != nil { - return fmt.Errorf("unable to decode chatActionRecordingVideo#ce85792: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionUploadingVideo represents TL type `chatActionUploadingVideo#49902c36`. -type ChatActionUploadingVideo struct { - // Upload progress, as a percentage - Progress int32 -} - -// ChatActionUploadingVideoTypeID is TL type id of ChatActionUploadingVideo. -const ChatActionUploadingVideoTypeID = 0x49902c36 - -// construct implements constructor of ChatActionClass. -func (c ChatActionUploadingVideo) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionUploadingVideo. -var ( - _ bin.Encoder = &ChatActionUploadingVideo{} - _ bin.Decoder = &ChatActionUploadingVideo{} - _ bin.BareEncoder = &ChatActionUploadingVideo{} - _ bin.BareDecoder = &ChatActionUploadingVideo{} - - _ ChatActionClass = &ChatActionUploadingVideo{} -) - -func (c *ChatActionUploadingVideo) Zero() bool { - if c == nil { - return true - } - if !(c.Progress == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionUploadingVideo) String() string { - if c == nil { - return "ChatActionUploadingVideo(nil)" - } - type Alias ChatActionUploadingVideo - return fmt.Sprintf("ChatActionUploadingVideo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionUploadingVideo) TypeID() uint32 { - return ChatActionUploadingVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionUploadingVideo) TypeName() string { - return "chatActionUploadingVideo" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionUploadingVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionUploadingVideo", - ID: ChatActionUploadingVideoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Progress", - SchemaName: "progress", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionUploadingVideo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingVideo#49902c36 as nil") - } - b.PutID(ChatActionUploadingVideoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionUploadingVideo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingVideo#49902c36 as nil") - } - b.PutInt32(c.Progress) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionUploadingVideo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingVideo#49902c36 to nil") - } - if err := b.ConsumeID(ChatActionUploadingVideoTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVideo#49902c36: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionUploadingVideo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingVideo#49902c36 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVideo#49902c36: field progress: %w", err) - } - c.Progress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionUploadingVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingVideo#49902c36 as nil") - } - b.ObjStart() - b.PutID("chatActionUploadingVideo") - b.Comma() - b.FieldStart("progress") - b.PutInt32(c.Progress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionUploadingVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingVideo#49902c36 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionUploadingVideo"); err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVideo#49902c36: %w", err) - } - case "progress": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVideo#49902c36: field progress: %w", err) - } - c.Progress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProgress returns value of Progress field. -func (c *ChatActionUploadingVideo) GetProgress() (value int32) { - if c == nil { - return - } - return c.Progress -} - -// ChatActionRecordingVoiceNote represents TL type `chatActionRecordingVoiceNote#cfc9ed76`. -type ChatActionRecordingVoiceNote struct { -} - -// ChatActionRecordingVoiceNoteTypeID is TL type id of ChatActionRecordingVoiceNote. -const ChatActionRecordingVoiceNoteTypeID = 0xcfc9ed76 - -// construct implements constructor of ChatActionClass. -func (c ChatActionRecordingVoiceNote) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionRecordingVoiceNote. -var ( - _ bin.Encoder = &ChatActionRecordingVoiceNote{} - _ bin.Decoder = &ChatActionRecordingVoiceNote{} - _ bin.BareEncoder = &ChatActionRecordingVoiceNote{} - _ bin.BareDecoder = &ChatActionRecordingVoiceNote{} - - _ ChatActionClass = &ChatActionRecordingVoiceNote{} -) - -func (c *ChatActionRecordingVoiceNote) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionRecordingVoiceNote) String() string { - if c == nil { - return "ChatActionRecordingVoiceNote(nil)" - } - type Alias ChatActionRecordingVoiceNote - return fmt.Sprintf("ChatActionRecordingVoiceNote%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionRecordingVoiceNote) TypeID() uint32 { - return ChatActionRecordingVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionRecordingVoiceNote) TypeName() string { - return "chatActionRecordingVoiceNote" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionRecordingVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionRecordingVoiceNote", - ID: ChatActionRecordingVoiceNoteTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionRecordingVoiceNote) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionRecordingVoiceNote#cfc9ed76 as nil") - } - b.PutID(ChatActionRecordingVoiceNoteTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionRecordingVoiceNote) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionRecordingVoiceNote#cfc9ed76 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionRecordingVoiceNote) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionRecordingVoiceNote#cfc9ed76 to nil") - } - if err := b.ConsumeID(ChatActionRecordingVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionRecordingVoiceNote#cfc9ed76: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionRecordingVoiceNote) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionRecordingVoiceNote#cfc9ed76 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionRecordingVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionRecordingVoiceNote#cfc9ed76 as nil") - } - b.ObjStart() - b.PutID("chatActionRecordingVoiceNote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionRecordingVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionRecordingVoiceNote#cfc9ed76 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionRecordingVoiceNote"); err != nil { - return fmt.Errorf("unable to decode chatActionRecordingVoiceNote#cfc9ed76: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionUploadingVoiceNote represents TL type `chatActionUploadingVoiceNote#db6c8a6e`. -type ChatActionUploadingVoiceNote struct { - // Upload progress, as a percentage - Progress int32 -} - -// ChatActionUploadingVoiceNoteTypeID is TL type id of ChatActionUploadingVoiceNote. -const ChatActionUploadingVoiceNoteTypeID = 0xdb6c8a6e - -// construct implements constructor of ChatActionClass. -func (c ChatActionUploadingVoiceNote) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionUploadingVoiceNote. -var ( - _ bin.Encoder = &ChatActionUploadingVoiceNote{} - _ bin.Decoder = &ChatActionUploadingVoiceNote{} - _ bin.BareEncoder = &ChatActionUploadingVoiceNote{} - _ bin.BareDecoder = &ChatActionUploadingVoiceNote{} - - _ ChatActionClass = &ChatActionUploadingVoiceNote{} -) - -func (c *ChatActionUploadingVoiceNote) Zero() bool { - if c == nil { - return true - } - if !(c.Progress == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionUploadingVoiceNote) String() string { - if c == nil { - return "ChatActionUploadingVoiceNote(nil)" - } - type Alias ChatActionUploadingVoiceNote - return fmt.Sprintf("ChatActionUploadingVoiceNote%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionUploadingVoiceNote) TypeID() uint32 { - return ChatActionUploadingVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionUploadingVoiceNote) TypeName() string { - return "chatActionUploadingVoiceNote" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionUploadingVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionUploadingVoiceNote", - ID: ChatActionUploadingVoiceNoteTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Progress", - SchemaName: "progress", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionUploadingVoiceNote) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingVoiceNote#db6c8a6e as nil") - } - b.PutID(ChatActionUploadingVoiceNoteTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionUploadingVoiceNote) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingVoiceNote#db6c8a6e as nil") - } - b.PutInt32(c.Progress) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionUploadingVoiceNote) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingVoiceNote#db6c8a6e to nil") - } - if err := b.ConsumeID(ChatActionUploadingVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVoiceNote#db6c8a6e: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionUploadingVoiceNote) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingVoiceNote#db6c8a6e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVoiceNote#db6c8a6e: field progress: %w", err) - } - c.Progress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionUploadingVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingVoiceNote#db6c8a6e as nil") - } - b.ObjStart() - b.PutID("chatActionUploadingVoiceNote") - b.Comma() - b.FieldStart("progress") - b.PutInt32(c.Progress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionUploadingVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingVoiceNote#db6c8a6e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionUploadingVoiceNote"); err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVoiceNote#db6c8a6e: %w", err) - } - case "progress": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVoiceNote#db6c8a6e: field progress: %w", err) - } - c.Progress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProgress returns value of Progress field. -func (c *ChatActionUploadingVoiceNote) GetProgress() (value int32) { - if c == nil { - return - } - return c.Progress -} - -// ChatActionUploadingPhoto represents TL type `chatActionUploadingPhoto#26feeb47`. -type ChatActionUploadingPhoto struct { - // Upload progress, as a percentage - Progress int32 -} - -// ChatActionUploadingPhotoTypeID is TL type id of ChatActionUploadingPhoto. -const ChatActionUploadingPhotoTypeID = 0x26feeb47 - -// construct implements constructor of ChatActionClass. -func (c ChatActionUploadingPhoto) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionUploadingPhoto. -var ( - _ bin.Encoder = &ChatActionUploadingPhoto{} - _ bin.Decoder = &ChatActionUploadingPhoto{} - _ bin.BareEncoder = &ChatActionUploadingPhoto{} - _ bin.BareDecoder = &ChatActionUploadingPhoto{} - - _ ChatActionClass = &ChatActionUploadingPhoto{} -) - -func (c *ChatActionUploadingPhoto) Zero() bool { - if c == nil { - return true - } - if !(c.Progress == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionUploadingPhoto) String() string { - if c == nil { - return "ChatActionUploadingPhoto(nil)" - } - type Alias ChatActionUploadingPhoto - return fmt.Sprintf("ChatActionUploadingPhoto%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionUploadingPhoto) TypeID() uint32 { - return ChatActionUploadingPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionUploadingPhoto) TypeName() string { - return "chatActionUploadingPhoto" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionUploadingPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionUploadingPhoto", - ID: ChatActionUploadingPhotoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Progress", - SchemaName: "progress", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionUploadingPhoto) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingPhoto#26feeb47 as nil") - } - b.PutID(ChatActionUploadingPhotoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionUploadingPhoto) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingPhoto#26feeb47 as nil") - } - b.PutInt32(c.Progress) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionUploadingPhoto) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingPhoto#26feeb47 to nil") - } - if err := b.ConsumeID(ChatActionUploadingPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionUploadingPhoto#26feeb47: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionUploadingPhoto) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingPhoto#26feeb47 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionUploadingPhoto#26feeb47: field progress: %w", err) - } - c.Progress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionUploadingPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingPhoto#26feeb47 as nil") - } - b.ObjStart() - b.PutID("chatActionUploadingPhoto") - b.Comma() - b.FieldStart("progress") - b.PutInt32(c.Progress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionUploadingPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingPhoto#26feeb47 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionUploadingPhoto"); err != nil { - return fmt.Errorf("unable to decode chatActionUploadingPhoto#26feeb47: %w", err) - } - case "progress": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionUploadingPhoto#26feeb47: field progress: %w", err) - } - c.Progress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProgress returns value of Progress field. -func (c *ChatActionUploadingPhoto) GetProgress() (value int32) { - if c == nil { - return - } - return c.Progress -} - -// ChatActionUploadingDocument represents TL type `chatActionUploadingDocument#a01b64a`. -type ChatActionUploadingDocument struct { - // Upload progress, as a percentage - Progress int32 -} - -// ChatActionUploadingDocumentTypeID is TL type id of ChatActionUploadingDocument. -const ChatActionUploadingDocumentTypeID = 0xa01b64a - -// construct implements constructor of ChatActionClass. -func (c ChatActionUploadingDocument) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionUploadingDocument. -var ( - _ bin.Encoder = &ChatActionUploadingDocument{} - _ bin.Decoder = &ChatActionUploadingDocument{} - _ bin.BareEncoder = &ChatActionUploadingDocument{} - _ bin.BareDecoder = &ChatActionUploadingDocument{} - - _ ChatActionClass = &ChatActionUploadingDocument{} -) - -func (c *ChatActionUploadingDocument) Zero() bool { - if c == nil { - return true - } - if !(c.Progress == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionUploadingDocument) String() string { - if c == nil { - return "ChatActionUploadingDocument(nil)" - } - type Alias ChatActionUploadingDocument - return fmt.Sprintf("ChatActionUploadingDocument%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionUploadingDocument) TypeID() uint32 { - return ChatActionUploadingDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionUploadingDocument) TypeName() string { - return "chatActionUploadingDocument" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionUploadingDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionUploadingDocument", - ID: ChatActionUploadingDocumentTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Progress", - SchemaName: "progress", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionUploadingDocument) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingDocument#a01b64a as nil") - } - b.PutID(ChatActionUploadingDocumentTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionUploadingDocument) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingDocument#a01b64a as nil") - } - b.PutInt32(c.Progress) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionUploadingDocument) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingDocument#a01b64a to nil") - } - if err := b.ConsumeID(ChatActionUploadingDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionUploadingDocument#a01b64a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionUploadingDocument) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingDocument#a01b64a to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionUploadingDocument#a01b64a: field progress: %w", err) - } - c.Progress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionUploadingDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingDocument#a01b64a as nil") - } - b.ObjStart() - b.PutID("chatActionUploadingDocument") - b.Comma() - b.FieldStart("progress") - b.PutInt32(c.Progress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionUploadingDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingDocument#a01b64a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionUploadingDocument"); err != nil { - return fmt.Errorf("unable to decode chatActionUploadingDocument#a01b64a: %w", err) - } - case "progress": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionUploadingDocument#a01b64a: field progress: %w", err) - } - c.Progress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProgress returns value of Progress field. -func (c *ChatActionUploadingDocument) GetProgress() (value int32) { - if c == nil { - return - } - return c.Progress -} - -// ChatActionChoosingSticker represents TL type `chatActionChoosingSticker#1637c521`. -type ChatActionChoosingSticker struct { -} - -// ChatActionChoosingStickerTypeID is TL type id of ChatActionChoosingSticker. -const ChatActionChoosingStickerTypeID = 0x1637c521 - -// construct implements constructor of ChatActionClass. -func (c ChatActionChoosingSticker) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionChoosingSticker. -var ( - _ bin.Encoder = &ChatActionChoosingSticker{} - _ bin.Decoder = &ChatActionChoosingSticker{} - _ bin.BareEncoder = &ChatActionChoosingSticker{} - _ bin.BareDecoder = &ChatActionChoosingSticker{} - - _ ChatActionClass = &ChatActionChoosingSticker{} -) - -func (c *ChatActionChoosingSticker) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionChoosingSticker) String() string { - if c == nil { - return "ChatActionChoosingSticker(nil)" - } - type Alias ChatActionChoosingSticker - return fmt.Sprintf("ChatActionChoosingSticker%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionChoosingSticker) TypeID() uint32 { - return ChatActionChoosingStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionChoosingSticker) TypeName() string { - return "chatActionChoosingSticker" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionChoosingSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionChoosingSticker", - ID: ChatActionChoosingStickerTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionChoosingSticker) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionChoosingSticker#1637c521 as nil") - } - b.PutID(ChatActionChoosingStickerTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionChoosingSticker) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionChoosingSticker#1637c521 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionChoosingSticker) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionChoosingSticker#1637c521 to nil") - } - if err := b.ConsumeID(ChatActionChoosingStickerTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionChoosingSticker#1637c521: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionChoosingSticker) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionChoosingSticker#1637c521 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionChoosingSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionChoosingSticker#1637c521 as nil") - } - b.ObjStart() - b.PutID("chatActionChoosingSticker") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionChoosingSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionChoosingSticker#1637c521 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionChoosingSticker"); err != nil { - return fmt.Errorf("unable to decode chatActionChoosingSticker#1637c521: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionChoosingLocation represents TL type `chatActionChoosingLocation#87b96324`. -type ChatActionChoosingLocation struct { -} - -// ChatActionChoosingLocationTypeID is TL type id of ChatActionChoosingLocation. -const ChatActionChoosingLocationTypeID = 0x87b96324 - -// construct implements constructor of ChatActionClass. -func (c ChatActionChoosingLocation) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionChoosingLocation. -var ( - _ bin.Encoder = &ChatActionChoosingLocation{} - _ bin.Decoder = &ChatActionChoosingLocation{} - _ bin.BareEncoder = &ChatActionChoosingLocation{} - _ bin.BareDecoder = &ChatActionChoosingLocation{} - - _ ChatActionClass = &ChatActionChoosingLocation{} -) - -func (c *ChatActionChoosingLocation) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionChoosingLocation) String() string { - if c == nil { - return "ChatActionChoosingLocation(nil)" - } - type Alias ChatActionChoosingLocation - return fmt.Sprintf("ChatActionChoosingLocation%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionChoosingLocation) TypeID() uint32 { - return ChatActionChoosingLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionChoosingLocation) TypeName() string { - return "chatActionChoosingLocation" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionChoosingLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionChoosingLocation", - ID: ChatActionChoosingLocationTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionChoosingLocation) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionChoosingLocation#87b96324 as nil") - } - b.PutID(ChatActionChoosingLocationTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionChoosingLocation) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionChoosingLocation#87b96324 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionChoosingLocation) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionChoosingLocation#87b96324 to nil") - } - if err := b.ConsumeID(ChatActionChoosingLocationTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionChoosingLocation#87b96324: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionChoosingLocation) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionChoosingLocation#87b96324 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionChoosingLocation) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionChoosingLocation#87b96324 as nil") - } - b.ObjStart() - b.PutID("chatActionChoosingLocation") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionChoosingLocation) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionChoosingLocation#87b96324 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionChoosingLocation"); err != nil { - return fmt.Errorf("unable to decode chatActionChoosingLocation#87b96324: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionChoosingContact represents TL type `chatActionChoosingContact#b7220418`. -type ChatActionChoosingContact struct { -} - -// ChatActionChoosingContactTypeID is TL type id of ChatActionChoosingContact. -const ChatActionChoosingContactTypeID = 0xb7220418 - -// construct implements constructor of ChatActionClass. -func (c ChatActionChoosingContact) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionChoosingContact. -var ( - _ bin.Encoder = &ChatActionChoosingContact{} - _ bin.Decoder = &ChatActionChoosingContact{} - _ bin.BareEncoder = &ChatActionChoosingContact{} - _ bin.BareDecoder = &ChatActionChoosingContact{} - - _ ChatActionClass = &ChatActionChoosingContact{} -) - -func (c *ChatActionChoosingContact) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionChoosingContact) String() string { - if c == nil { - return "ChatActionChoosingContact(nil)" - } - type Alias ChatActionChoosingContact - return fmt.Sprintf("ChatActionChoosingContact%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionChoosingContact) TypeID() uint32 { - return ChatActionChoosingContactTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionChoosingContact) TypeName() string { - return "chatActionChoosingContact" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionChoosingContact) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionChoosingContact", - ID: ChatActionChoosingContactTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionChoosingContact) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionChoosingContact#b7220418 as nil") - } - b.PutID(ChatActionChoosingContactTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionChoosingContact) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionChoosingContact#b7220418 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionChoosingContact) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionChoosingContact#b7220418 to nil") - } - if err := b.ConsumeID(ChatActionChoosingContactTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionChoosingContact#b7220418: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionChoosingContact) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionChoosingContact#b7220418 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionChoosingContact) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionChoosingContact#b7220418 as nil") - } - b.ObjStart() - b.PutID("chatActionChoosingContact") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionChoosingContact) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionChoosingContact#b7220418 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionChoosingContact"); err != nil { - return fmt.Errorf("unable to decode chatActionChoosingContact#b7220418: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionStartPlayingGame represents TL type `chatActionStartPlayingGame#cc63a7fc`. -type ChatActionStartPlayingGame struct { -} - -// ChatActionStartPlayingGameTypeID is TL type id of ChatActionStartPlayingGame. -const ChatActionStartPlayingGameTypeID = 0xcc63a7fc - -// construct implements constructor of ChatActionClass. -func (c ChatActionStartPlayingGame) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionStartPlayingGame. -var ( - _ bin.Encoder = &ChatActionStartPlayingGame{} - _ bin.Decoder = &ChatActionStartPlayingGame{} - _ bin.BareEncoder = &ChatActionStartPlayingGame{} - _ bin.BareDecoder = &ChatActionStartPlayingGame{} - - _ ChatActionClass = &ChatActionStartPlayingGame{} -) - -func (c *ChatActionStartPlayingGame) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionStartPlayingGame) String() string { - if c == nil { - return "ChatActionStartPlayingGame(nil)" - } - type Alias ChatActionStartPlayingGame - return fmt.Sprintf("ChatActionStartPlayingGame%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionStartPlayingGame) TypeID() uint32 { - return ChatActionStartPlayingGameTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionStartPlayingGame) TypeName() string { - return "chatActionStartPlayingGame" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionStartPlayingGame) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionStartPlayingGame", - ID: ChatActionStartPlayingGameTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionStartPlayingGame) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionStartPlayingGame#cc63a7fc as nil") - } - b.PutID(ChatActionStartPlayingGameTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionStartPlayingGame) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionStartPlayingGame#cc63a7fc as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionStartPlayingGame) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionStartPlayingGame#cc63a7fc to nil") - } - if err := b.ConsumeID(ChatActionStartPlayingGameTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionStartPlayingGame#cc63a7fc: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionStartPlayingGame) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionStartPlayingGame#cc63a7fc to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionStartPlayingGame) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionStartPlayingGame#cc63a7fc as nil") - } - b.ObjStart() - b.PutID("chatActionStartPlayingGame") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionStartPlayingGame) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionStartPlayingGame#cc63a7fc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionStartPlayingGame"); err != nil { - return fmt.Errorf("unable to decode chatActionStartPlayingGame#cc63a7fc: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionRecordingVideoNote represents TL type `chatActionRecordingVideoNote#fc2081`. -type ChatActionRecordingVideoNote struct { -} - -// ChatActionRecordingVideoNoteTypeID is TL type id of ChatActionRecordingVideoNote. -const ChatActionRecordingVideoNoteTypeID = 0xfc2081 - -// construct implements constructor of ChatActionClass. -func (c ChatActionRecordingVideoNote) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionRecordingVideoNote. -var ( - _ bin.Encoder = &ChatActionRecordingVideoNote{} - _ bin.Decoder = &ChatActionRecordingVideoNote{} - _ bin.BareEncoder = &ChatActionRecordingVideoNote{} - _ bin.BareDecoder = &ChatActionRecordingVideoNote{} - - _ ChatActionClass = &ChatActionRecordingVideoNote{} -) - -func (c *ChatActionRecordingVideoNote) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionRecordingVideoNote) String() string { - if c == nil { - return "ChatActionRecordingVideoNote(nil)" - } - type Alias ChatActionRecordingVideoNote - return fmt.Sprintf("ChatActionRecordingVideoNote%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionRecordingVideoNote) TypeID() uint32 { - return ChatActionRecordingVideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionRecordingVideoNote) TypeName() string { - return "chatActionRecordingVideoNote" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionRecordingVideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionRecordingVideoNote", - ID: ChatActionRecordingVideoNoteTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionRecordingVideoNote) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionRecordingVideoNote#fc2081 as nil") - } - b.PutID(ChatActionRecordingVideoNoteTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionRecordingVideoNote) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionRecordingVideoNote#fc2081 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionRecordingVideoNote) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionRecordingVideoNote#fc2081 to nil") - } - if err := b.ConsumeID(ChatActionRecordingVideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionRecordingVideoNote#fc2081: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionRecordingVideoNote) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionRecordingVideoNote#fc2081 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionRecordingVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionRecordingVideoNote#fc2081 as nil") - } - b.ObjStart() - b.PutID("chatActionRecordingVideoNote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionRecordingVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionRecordingVideoNote#fc2081 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionRecordingVideoNote"); err != nil { - return fmt.Errorf("unable to decode chatActionRecordingVideoNote#fc2081: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionUploadingVideoNote represents TL type `chatActionUploadingVideoNote#45e0de76`. -type ChatActionUploadingVideoNote struct { - // Upload progress, as a percentage - Progress int32 -} - -// ChatActionUploadingVideoNoteTypeID is TL type id of ChatActionUploadingVideoNote. -const ChatActionUploadingVideoNoteTypeID = 0x45e0de76 - -// construct implements constructor of ChatActionClass. -func (c ChatActionUploadingVideoNote) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionUploadingVideoNote. -var ( - _ bin.Encoder = &ChatActionUploadingVideoNote{} - _ bin.Decoder = &ChatActionUploadingVideoNote{} - _ bin.BareEncoder = &ChatActionUploadingVideoNote{} - _ bin.BareDecoder = &ChatActionUploadingVideoNote{} - - _ ChatActionClass = &ChatActionUploadingVideoNote{} -) - -func (c *ChatActionUploadingVideoNote) Zero() bool { - if c == nil { - return true - } - if !(c.Progress == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionUploadingVideoNote) String() string { - if c == nil { - return "ChatActionUploadingVideoNote(nil)" - } - type Alias ChatActionUploadingVideoNote - return fmt.Sprintf("ChatActionUploadingVideoNote%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionUploadingVideoNote) TypeID() uint32 { - return ChatActionUploadingVideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionUploadingVideoNote) TypeName() string { - return "chatActionUploadingVideoNote" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionUploadingVideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionUploadingVideoNote", - ID: ChatActionUploadingVideoNoteTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Progress", - SchemaName: "progress", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionUploadingVideoNote) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingVideoNote#45e0de76 as nil") - } - b.PutID(ChatActionUploadingVideoNoteTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionUploadingVideoNote) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingVideoNote#45e0de76 as nil") - } - b.PutInt32(c.Progress) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionUploadingVideoNote) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingVideoNote#45e0de76 to nil") - } - if err := b.ConsumeID(ChatActionUploadingVideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVideoNote#45e0de76: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionUploadingVideoNote) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingVideoNote#45e0de76 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVideoNote#45e0de76: field progress: %w", err) - } - c.Progress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionUploadingVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionUploadingVideoNote#45e0de76 as nil") - } - b.ObjStart() - b.PutID("chatActionUploadingVideoNote") - b.Comma() - b.FieldStart("progress") - b.PutInt32(c.Progress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionUploadingVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionUploadingVideoNote#45e0de76 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionUploadingVideoNote"); err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVideoNote#45e0de76: %w", err) - } - case "progress": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActionUploadingVideoNote#45e0de76: field progress: %w", err) - } - c.Progress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProgress returns value of Progress field. -func (c *ChatActionUploadingVideoNote) GetProgress() (value int32) { - if c == nil { - return - } - return c.Progress -} - -// ChatActionWatchingAnimations represents TL type `chatActionWatchingAnimations#7a5e26b1`. -type ChatActionWatchingAnimations struct { - // The animated emoji - Emoji string -} - -// ChatActionWatchingAnimationsTypeID is TL type id of ChatActionWatchingAnimations. -const ChatActionWatchingAnimationsTypeID = 0x7a5e26b1 - -// construct implements constructor of ChatActionClass. -func (c ChatActionWatchingAnimations) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionWatchingAnimations. -var ( - _ bin.Encoder = &ChatActionWatchingAnimations{} - _ bin.Decoder = &ChatActionWatchingAnimations{} - _ bin.BareEncoder = &ChatActionWatchingAnimations{} - _ bin.BareDecoder = &ChatActionWatchingAnimations{} - - _ ChatActionClass = &ChatActionWatchingAnimations{} -) - -func (c *ChatActionWatchingAnimations) Zero() bool { - if c == nil { - return true - } - if !(c.Emoji == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionWatchingAnimations) String() string { - if c == nil { - return "ChatActionWatchingAnimations(nil)" - } - type Alias ChatActionWatchingAnimations - return fmt.Sprintf("ChatActionWatchingAnimations%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionWatchingAnimations) TypeID() uint32 { - return ChatActionWatchingAnimationsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionWatchingAnimations) TypeName() string { - return "chatActionWatchingAnimations" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionWatchingAnimations) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionWatchingAnimations", - ID: ChatActionWatchingAnimationsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Emoji", - SchemaName: "emoji", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionWatchingAnimations) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionWatchingAnimations#7a5e26b1 as nil") - } - b.PutID(ChatActionWatchingAnimationsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionWatchingAnimations) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionWatchingAnimations#7a5e26b1 as nil") - } - b.PutString(c.Emoji) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionWatchingAnimations) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionWatchingAnimations#7a5e26b1 to nil") - } - if err := b.ConsumeID(ChatActionWatchingAnimationsTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionWatchingAnimations#7a5e26b1: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionWatchingAnimations) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionWatchingAnimations#7a5e26b1 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatActionWatchingAnimations#7a5e26b1: field emoji: %w", err) - } - c.Emoji = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionWatchingAnimations) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionWatchingAnimations#7a5e26b1 as nil") - } - b.ObjStart() - b.PutID("chatActionWatchingAnimations") - b.Comma() - b.FieldStart("emoji") - b.PutString(c.Emoji) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionWatchingAnimations) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionWatchingAnimations#7a5e26b1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionWatchingAnimations"); err != nil { - return fmt.Errorf("unable to decode chatActionWatchingAnimations#7a5e26b1: %w", err) - } - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatActionWatchingAnimations#7a5e26b1: field emoji: %w", err) - } - c.Emoji = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEmoji returns value of Emoji field. -func (c *ChatActionWatchingAnimations) GetEmoji() (value string) { - if c == nil { - return - } - return c.Emoji -} - -// ChatActionCancel represents TL type `chatActionCancel#452c30b6`. -type ChatActionCancel struct { -} - -// ChatActionCancelTypeID is TL type id of ChatActionCancel. -const ChatActionCancelTypeID = 0x452c30b6 - -// construct implements constructor of ChatActionClass. -func (c ChatActionCancel) construct() ChatActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatActionCancel. -var ( - _ bin.Encoder = &ChatActionCancel{} - _ bin.Decoder = &ChatActionCancel{} - _ bin.BareEncoder = &ChatActionCancel{} - _ bin.BareDecoder = &ChatActionCancel{} - - _ ChatActionClass = &ChatActionCancel{} -) - -func (c *ChatActionCancel) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActionCancel) String() string { - if c == nil { - return "ChatActionCancel(nil)" - } - type Alias ChatActionCancel - return fmt.Sprintf("ChatActionCancel%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActionCancel) TypeID() uint32 { - return ChatActionCancelTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActionCancel) TypeName() string { - return "chatActionCancel" -} - -// TypeInfo returns info about TL type. -func (c *ChatActionCancel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActionCancel", - ID: ChatActionCancelTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActionCancel) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionCancel#452c30b6 as nil") - } - b.PutID(ChatActionCancelTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActionCancel) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActionCancel#452c30b6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActionCancel) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionCancel#452c30b6 to nil") - } - if err := b.ConsumeID(ChatActionCancelTypeID); err != nil { - return fmt.Errorf("unable to decode chatActionCancel#452c30b6: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActionCancel) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActionCancel#452c30b6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActionCancel) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActionCancel#452c30b6 as nil") - } - b.ObjStart() - b.PutID("chatActionCancel") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActionCancel) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActionCancel#452c30b6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActionCancel"); err != nil { - return fmt.Errorf("unable to decode chatActionCancel#452c30b6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatActionClassName is schema name of ChatActionClass. -const ChatActionClassName = "ChatAction" - -// ChatActionClass represents ChatAction generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatAction(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatActionTyping: // chatActionTyping#16a83437 -// case *tdapi.ChatActionRecordingVideo: // chatActionRecordingVideo#ce85792 -// case *tdapi.ChatActionUploadingVideo: // chatActionUploadingVideo#49902c36 -// case *tdapi.ChatActionRecordingVoiceNote: // chatActionRecordingVoiceNote#cfc9ed76 -// case *tdapi.ChatActionUploadingVoiceNote: // chatActionUploadingVoiceNote#db6c8a6e -// case *tdapi.ChatActionUploadingPhoto: // chatActionUploadingPhoto#26feeb47 -// case *tdapi.ChatActionUploadingDocument: // chatActionUploadingDocument#a01b64a -// case *tdapi.ChatActionChoosingSticker: // chatActionChoosingSticker#1637c521 -// case *tdapi.ChatActionChoosingLocation: // chatActionChoosingLocation#87b96324 -// case *tdapi.ChatActionChoosingContact: // chatActionChoosingContact#b7220418 -// case *tdapi.ChatActionStartPlayingGame: // chatActionStartPlayingGame#cc63a7fc -// case *tdapi.ChatActionRecordingVideoNote: // chatActionRecordingVideoNote#fc2081 -// case *tdapi.ChatActionUploadingVideoNote: // chatActionUploadingVideoNote#45e0de76 -// case *tdapi.ChatActionWatchingAnimations: // chatActionWatchingAnimations#7a5e26b1 -// case *tdapi.ChatActionCancel: // chatActionCancel#452c30b6 -// default: panic(v) -// } -type ChatActionClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatActionClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeChatAction implements binary de-serialization for ChatActionClass. -func DecodeChatAction(buf *bin.Buffer) (ChatActionClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatActionTypingTypeID: - // Decoding chatActionTyping#16a83437. - v := ChatActionTyping{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionRecordingVideoTypeID: - // Decoding chatActionRecordingVideo#ce85792. - v := ChatActionRecordingVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionUploadingVideoTypeID: - // Decoding chatActionUploadingVideo#49902c36. - v := ChatActionUploadingVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionRecordingVoiceNoteTypeID: - // Decoding chatActionRecordingVoiceNote#cfc9ed76. - v := ChatActionRecordingVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionUploadingVoiceNoteTypeID: - // Decoding chatActionUploadingVoiceNote#db6c8a6e. - v := ChatActionUploadingVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionUploadingPhotoTypeID: - // Decoding chatActionUploadingPhoto#26feeb47. - v := ChatActionUploadingPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionUploadingDocumentTypeID: - // Decoding chatActionUploadingDocument#a01b64a. - v := ChatActionUploadingDocument{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionChoosingStickerTypeID: - // Decoding chatActionChoosingSticker#1637c521. - v := ChatActionChoosingSticker{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionChoosingLocationTypeID: - // Decoding chatActionChoosingLocation#87b96324. - v := ChatActionChoosingLocation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionChoosingContactTypeID: - // Decoding chatActionChoosingContact#b7220418. - v := ChatActionChoosingContact{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionStartPlayingGameTypeID: - // Decoding chatActionStartPlayingGame#cc63a7fc. - v := ChatActionStartPlayingGame{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionRecordingVideoNoteTypeID: - // Decoding chatActionRecordingVideoNote#fc2081. - v := ChatActionRecordingVideoNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionUploadingVideoNoteTypeID: - // Decoding chatActionUploadingVideoNote#45e0de76. - v := ChatActionUploadingVideoNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionWatchingAnimationsTypeID: - // Decoding chatActionWatchingAnimations#7a5e26b1. - v := ChatActionWatchingAnimations{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case ChatActionCancelTypeID: - // Decoding chatActionCancel#452c30b6. - v := ChatActionCancel{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatAction implements binary de-serialization for ChatActionClass. -func DecodeTDLibJSONChatAction(buf tdjson.Decoder) (ChatActionClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatActionTyping": - // Decoding chatActionTyping#16a83437. - v := ChatActionTyping{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionRecordingVideo": - // Decoding chatActionRecordingVideo#ce85792. - v := ChatActionRecordingVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionUploadingVideo": - // Decoding chatActionUploadingVideo#49902c36. - v := ChatActionUploadingVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionRecordingVoiceNote": - // Decoding chatActionRecordingVoiceNote#cfc9ed76. - v := ChatActionRecordingVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionUploadingVoiceNote": - // Decoding chatActionUploadingVoiceNote#db6c8a6e. - v := ChatActionUploadingVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionUploadingPhoto": - // Decoding chatActionUploadingPhoto#26feeb47. - v := ChatActionUploadingPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionUploadingDocument": - // Decoding chatActionUploadingDocument#a01b64a. - v := ChatActionUploadingDocument{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionChoosingSticker": - // Decoding chatActionChoosingSticker#1637c521. - v := ChatActionChoosingSticker{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionChoosingLocation": - // Decoding chatActionChoosingLocation#87b96324. - v := ChatActionChoosingLocation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionChoosingContact": - // Decoding chatActionChoosingContact#b7220418. - v := ChatActionChoosingContact{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionStartPlayingGame": - // Decoding chatActionStartPlayingGame#cc63a7fc. - v := ChatActionStartPlayingGame{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionRecordingVideoNote": - // Decoding chatActionRecordingVideoNote#fc2081. - v := ChatActionRecordingVideoNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionUploadingVideoNote": - // Decoding chatActionUploadingVideoNote#45e0de76. - v := ChatActionUploadingVideoNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionWatchingAnimations": - // Decoding chatActionWatchingAnimations#7a5e26b1. - v := ChatActionWatchingAnimations{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - case "chatActionCancel": - // Decoding chatActionCancel#452c30b6. - v := ChatActionCancel{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatActionClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatAction boxes the ChatActionClass providing a helper. -type ChatActionBox struct { - ChatAction ChatActionClass -} - -// Decode implements bin.Decoder for ChatActionBox. -func (b *ChatActionBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatActionBox to nil") - } - v, err := DecodeChatAction(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatAction = v - return nil -} - -// Encode implements bin.Encode for ChatActionBox. -func (b *ChatActionBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatAction == nil { - return fmt.Errorf("unable to encode ChatActionClass as nil") - } - return b.ChatAction.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatActionBox. -func (b *ChatActionBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatActionBox to nil") - } - v, err := DecodeTDLibJSONChatAction(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatAction = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatActionBox. -func (b *ChatActionBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatAction == nil { - return fmt.Errorf("unable to encode ChatActionClass as nil") - } - return b.ChatAction.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_active_stories_gen.go b/tdapi/tl_chat_active_stories_gen.go deleted file mode 100644 index 53c41cfa3..000000000 --- a/tdapi/tl_chat_active_stories_gen.go +++ /dev/null @@ -1,372 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatActiveStories represents TL type `chatActiveStories#d923d773`. -type ChatActiveStories struct { - // Identifier of the chat that posted the stories - ChatID int64 - // Identifier of the story list in which the stories are shown; may be null if the - // stories aren't shown in a story list - List StoryListClass - // A parameter used to determine order of the stories in the story list; 0 if the stories - // doesn't need to be shown in the story list. Stories must be sorted by the pair (order, - // story_sender_chat_id) in descending order - Order int64 - // Identifier of the last read active story - MaxReadStoryID int32 - // Basic information about the stories; use getStory to get full information about the - // stories. The stories are in chronological order (i.e., in order of increasing story - // identifiers) - Stories []StoryInfo -} - -// ChatActiveStoriesTypeID is TL type id of ChatActiveStories. -const ChatActiveStoriesTypeID = 0xd923d773 - -// Ensuring interfaces in compile-time for ChatActiveStories. -var ( - _ bin.Encoder = &ChatActiveStories{} - _ bin.Decoder = &ChatActiveStories{} - _ bin.BareEncoder = &ChatActiveStories{} - _ bin.BareDecoder = &ChatActiveStories{} -) - -func (c *ChatActiveStories) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.List == nil) { - return false - } - if !(c.Order == 0) { - return false - } - if !(c.MaxReadStoryID == 0) { - return false - } - if !(c.Stories == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatActiveStories) String() string { - if c == nil { - return "ChatActiveStories(nil)" - } - type Alias ChatActiveStories - return fmt.Sprintf("ChatActiveStories%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatActiveStories) TypeID() uint32 { - return ChatActiveStoriesTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatActiveStories) TypeName() string { - return "chatActiveStories" -} - -// TypeInfo returns info about TL type. -func (c *ChatActiveStories) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatActiveStories", - ID: ChatActiveStoriesTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "List", - SchemaName: "list", - }, - { - Name: "Order", - SchemaName: "order", - }, - { - Name: "MaxReadStoryID", - SchemaName: "max_read_story_id", - }, - { - Name: "Stories", - SchemaName: "stories", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatActiveStories) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActiveStories#d923d773 as nil") - } - b.PutID(ChatActiveStoriesTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatActiveStories) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatActiveStories#d923d773 as nil") - } - b.PutInt53(c.ChatID) - if c.List == nil { - return fmt.Errorf("unable to encode chatActiveStories#d923d773: field list is nil") - } - if err := c.List.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatActiveStories#d923d773: field list: %w", err) - } - b.PutInt53(c.Order) - b.PutInt32(c.MaxReadStoryID) - b.PutInt(len(c.Stories)) - for idx, v := range c.Stories { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatActiveStories#d923d773: field stories element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatActiveStories) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActiveStories#d923d773 to nil") - } - if err := b.ConsumeID(ChatActiveStoriesTypeID); err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatActiveStories) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatActiveStories#d923d773 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: field chat_id: %w", err) - } - c.ChatID = value - } - { - value, err := DecodeStoryList(b) - if err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: field list: %w", err) - } - c.List = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: field order: %w", err) - } - c.Order = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: field max_read_story_id: %w", err) - } - c.MaxReadStoryID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: field stories: %w", err) - } - - if headerLen > 0 { - c.Stories = make([]StoryInfo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StoryInfo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatActiveStories#d923d773: field stories: %w", err) - } - c.Stories = append(c.Stories, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatActiveStories) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatActiveStories#d923d773 as nil") - } - b.ObjStart() - b.PutID("chatActiveStories") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("list") - if c.List == nil { - return fmt.Errorf("unable to encode chatActiveStories#d923d773: field list is nil") - } - if err := c.List.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatActiveStories#d923d773: field list: %w", err) - } - b.Comma() - b.FieldStart("order") - b.PutInt53(c.Order) - b.Comma() - b.FieldStart("max_read_story_id") - b.PutInt32(c.MaxReadStoryID) - b.Comma() - b.FieldStart("stories") - b.ArrStart() - for idx, v := range c.Stories { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatActiveStories#d923d773: field stories element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatActiveStories) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatActiveStories#d923d773 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatActiveStories"); err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: field chat_id: %w", err) - } - c.ChatID = value - case "list": - value, err := DecodeTDLibJSONStoryList(b) - if err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: field list: %w", err) - } - c.List = value - case "order": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: field order: %w", err) - } - c.Order = value - case "max_read_story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: field max_read_story_id: %w", err) - } - c.MaxReadStoryID = value - case "stories": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StoryInfo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: field stories: %w", err) - } - c.Stories = append(c.Stories, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatActiveStories#d923d773: field stories: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *ChatActiveStories) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetList returns value of List field. -func (c *ChatActiveStories) GetList() (value StoryListClass) { - if c == nil { - return - } - return c.List -} - -// GetOrder returns value of Order field. -func (c *ChatActiveStories) GetOrder() (value int64) { - if c == nil { - return - } - return c.Order -} - -// GetMaxReadStoryID returns value of MaxReadStoryID field. -func (c *ChatActiveStories) GetMaxReadStoryID() (value int32) { - if c == nil { - return - } - return c.MaxReadStoryID -} - -// GetStories returns value of Stories field. -func (c *ChatActiveStories) GetStories() (value []StoryInfo) { - if c == nil { - return - } - return c.Stories -} diff --git a/tdapi/tl_chat_administrator_gen.go b/tdapi/tl_chat_administrator_gen.go deleted file mode 100644 index 864992a49..000000000 --- a/tdapi/tl_chat_administrator_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatAdministrator represents TL type `chatAdministrator#7277bd2c`. -type ChatAdministrator struct { - // User identifier of the administrator - UserID int64 - // Custom title of the administrator - CustomTitle string - // True, if the user is the owner of the chat - IsOwner bool -} - -// ChatAdministratorTypeID is TL type id of ChatAdministrator. -const ChatAdministratorTypeID = 0x7277bd2c - -// Ensuring interfaces in compile-time for ChatAdministrator. -var ( - _ bin.Encoder = &ChatAdministrator{} - _ bin.Decoder = &ChatAdministrator{} - _ bin.BareEncoder = &ChatAdministrator{} - _ bin.BareDecoder = &ChatAdministrator{} -) - -func (c *ChatAdministrator) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.CustomTitle == "") { - return false - } - if !(c.IsOwner == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatAdministrator) String() string { - if c == nil { - return "ChatAdministrator(nil)" - } - type Alias ChatAdministrator - return fmt.Sprintf("ChatAdministrator%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatAdministrator) TypeID() uint32 { - return ChatAdministratorTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatAdministrator) TypeName() string { - return "chatAdministrator" -} - -// TypeInfo returns info about TL type. -func (c *ChatAdministrator) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatAdministrator", - ID: ChatAdministratorTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "CustomTitle", - SchemaName: "custom_title", - }, - { - Name: "IsOwner", - SchemaName: "is_owner", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatAdministrator) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAdministrator#7277bd2c as nil") - } - b.PutID(ChatAdministratorTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatAdministrator) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAdministrator#7277bd2c as nil") - } - b.PutInt53(c.UserID) - b.PutString(c.CustomTitle) - b.PutBool(c.IsOwner) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatAdministrator) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAdministrator#7277bd2c to nil") - } - if err := b.ConsumeID(ChatAdministratorTypeID); err != nil { - return fmt.Errorf("unable to decode chatAdministrator#7277bd2c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatAdministrator) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAdministrator#7277bd2c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatAdministrator#7277bd2c: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatAdministrator#7277bd2c: field custom_title: %w", err) - } - c.CustomTitle = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministrator#7277bd2c: field is_owner: %w", err) - } - c.IsOwner = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatAdministrator) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatAdministrator#7277bd2c as nil") - } - b.ObjStart() - b.PutID("chatAdministrator") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("custom_title") - b.PutString(c.CustomTitle) - b.Comma() - b.FieldStart("is_owner") - b.PutBool(c.IsOwner) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatAdministrator) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatAdministrator#7277bd2c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatAdministrator"); err != nil { - return fmt.Errorf("unable to decode chatAdministrator#7277bd2c: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatAdministrator#7277bd2c: field user_id: %w", err) - } - c.UserID = value - case "custom_title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatAdministrator#7277bd2c: field custom_title: %w", err) - } - c.CustomTitle = value - case "is_owner": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministrator#7277bd2c: field is_owner: %w", err) - } - c.IsOwner = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatAdministrator) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetCustomTitle returns value of CustomTitle field. -func (c *ChatAdministrator) GetCustomTitle() (value string) { - if c == nil { - return - } - return c.CustomTitle -} - -// GetIsOwner returns value of IsOwner field. -func (c *ChatAdministrator) GetIsOwner() (value bool) { - if c == nil { - return - } - return c.IsOwner -} diff --git a/tdapi/tl_chat_administrator_rights_gen.go b/tdapi/tl_chat_administrator_rights_gen.go deleted file mode 100644 index d95960eed..000000000 --- a/tdapi/tl_chat_administrator_rights_gen.go +++ /dev/null @@ -1,682 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatAdministratorRights represents TL type `chatAdministratorRights#5f4f9044`. -type ChatAdministratorRights struct { - // True, if the administrator can access the chat event log, get boost list, see hidden - // supergroup and channel members, report supergroup spam messages and ignore slow mode. - // Implied by any other privilege; applicable to supergroups and channels only - CanManageChat bool - // True, if the administrator can change the chat title, photo, and other settings - CanChangeInfo bool - // True, if the administrator can create channel posts or view channel statistics; - // applicable to channels only - CanPostMessages bool - // True, if the administrator can edit messages of other users and pin messages; - // applicable to channels only - CanEditMessages bool - // True, if the administrator can delete messages of other users - CanDeleteMessages bool - // True, if the administrator can invite new users to the chat - CanInviteUsers bool - // True, if the administrator can restrict, ban, or unban chat members or view supergroup - // statistics; always true for channels - CanRestrictMembers bool - // True, if the administrator can pin messages; applicable to basic groups and - // supergroups only - CanPinMessages bool - // True, if the administrator can create, rename, close, reopen, hide, and unhide forum - // topics; applicable to forum supergroups only - CanManageTopics bool - // True, if the administrator can add new administrators with a subset of their own - // privileges or demote administrators that were directly or indirectly promoted by them - CanPromoteMembers bool - // True, if the administrator can manage video chats - CanManageVideoChats bool - // True, if the administrator can create new chat stories, or edit and delete posted - // stories; applicable to supergroups and channels only - CanPostStories bool - // True, if the administrator can edit stories posted by other users, post stories to the - // chat page, pin chat stories, and access story archive; applicable to supergroups and - // channels only - CanEditStories bool - // True, if the administrator can delete stories posted by other users; applicable to - // supergroups and channels only - CanDeleteStories bool - // True, if the administrator isn't shown in the chat member list and sends messages - // anonymously; applicable to supergroups only - IsAnonymous bool -} - -// ChatAdministratorRightsTypeID is TL type id of ChatAdministratorRights. -const ChatAdministratorRightsTypeID = 0x5f4f9044 - -// Ensuring interfaces in compile-time for ChatAdministratorRights. -var ( - _ bin.Encoder = &ChatAdministratorRights{} - _ bin.Decoder = &ChatAdministratorRights{} - _ bin.BareEncoder = &ChatAdministratorRights{} - _ bin.BareDecoder = &ChatAdministratorRights{} -) - -func (c *ChatAdministratorRights) Zero() bool { - if c == nil { - return true - } - if !(c.CanManageChat == false) { - return false - } - if !(c.CanChangeInfo == false) { - return false - } - if !(c.CanPostMessages == false) { - return false - } - if !(c.CanEditMessages == false) { - return false - } - if !(c.CanDeleteMessages == false) { - return false - } - if !(c.CanInviteUsers == false) { - return false - } - if !(c.CanRestrictMembers == false) { - return false - } - if !(c.CanPinMessages == false) { - return false - } - if !(c.CanManageTopics == false) { - return false - } - if !(c.CanPromoteMembers == false) { - return false - } - if !(c.CanManageVideoChats == false) { - return false - } - if !(c.CanPostStories == false) { - return false - } - if !(c.CanEditStories == false) { - return false - } - if !(c.CanDeleteStories == false) { - return false - } - if !(c.IsAnonymous == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatAdministratorRights) String() string { - if c == nil { - return "ChatAdministratorRights(nil)" - } - type Alias ChatAdministratorRights - return fmt.Sprintf("ChatAdministratorRights%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatAdministratorRights) TypeID() uint32 { - return ChatAdministratorRightsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatAdministratorRights) TypeName() string { - return "chatAdministratorRights" -} - -// TypeInfo returns info about TL type. -func (c *ChatAdministratorRights) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatAdministratorRights", - ID: ChatAdministratorRightsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CanManageChat", - SchemaName: "can_manage_chat", - }, - { - Name: "CanChangeInfo", - SchemaName: "can_change_info", - }, - { - Name: "CanPostMessages", - SchemaName: "can_post_messages", - }, - { - Name: "CanEditMessages", - SchemaName: "can_edit_messages", - }, - { - Name: "CanDeleteMessages", - SchemaName: "can_delete_messages", - }, - { - Name: "CanInviteUsers", - SchemaName: "can_invite_users", - }, - { - Name: "CanRestrictMembers", - SchemaName: "can_restrict_members", - }, - { - Name: "CanPinMessages", - SchemaName: "can_pin_messages", - }, - { - Name: "CanManageTopics", - SchemaName: "can_manage_topics", - }, - { - Name: "CanPromoteMembers", - SchemaName: "can_promote_members", - }, - { - Name: "CanManageVideoChats", - SchemaName: "can_manage_video_chats", - }, - { - Name: "CanPostStories", - SchemaName: "can_post_stories", - }, - { - Name: "CanEditStories", - SchemaName: "can_edit_stories", - }, - { - Name: "CanDeleteStories", - SchemaName: "can_delete_stories", - }, - { - Name: "IsAnonymous", - SchemaName: "is_anonymous", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatAdministratorRights) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAdministratorRights#5f4f9044 as nil") - } - b.PutID(ChatAdministratorRightsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatAdministratorRights) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAdministratorRights#5f4f9044 as nil") - } - b.PutBool(c.CanManageChat) - b.PutBool(c.CanChangeInfo) - b.PutBool(c.CanPostMessages) - b.PutBool(c.CanEditMessages) - b.PutBool(c.CanDeleteMessages) - b.PutBool(c.CanInviteUsers) - b.PutBool(c.CanRestrictMembers) - b.PutBool(c.CanPinMessages) - b.PutBool(c.CanManageTopics) - b.PutBool(c.CanPromoteMembers) - b.PutBool(c.CanManageVideoChats) - b.PutBool(c.CanPostStories) - b.PutBool(c.CanEditStories) - b.PutBool(c.CanDeleteStories) - b.PutBool(c.IsAnonymous) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatAdministratorRights) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAdministratorRights#5f4f9044 to nil") - } - if err := b.ConsumeID(ChatAdministratorRightsTypeID); err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatAdministratorRights) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAdministratorRights#5f4f9044 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_chat: %w", err) - } - c.CanManageChat = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_change_info: %w", err) - } - c.CanChangeInfo = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_post_messages: %w", err) - } - c.CanPostMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_edit_messages: %w", err) - } - c.CanEditMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_delete_messages: %w", err) - } - c.CanDeleteMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_invite_users: %w", err) - } - c.CanInviteUsers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_restrict_members: %w", err) - } - c.CanRestrictMembers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_pin_messages: %w", err) - } - c.CanPinMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_topics: %w", err) - } - c.CanManageTopics = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_promote_members: %w", err) - } - c.CanPromoteMembers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_video_chats: %w", err) - } - c.CanManageVideoChats = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_post_stories: %w", err) - } - c.CanPostStories = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_edit_stories: %w", err) - } - c.CanEditStories = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_delete_stories: %w", err) - } - c.CanDeleteStories = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field is_anonymous: %w", err) - } - c.IsAnonymous = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatAdministratorRights) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatAdministratorRights#5f4f9044 as nil") - } - b.ObjStart() - b.PutID("chatAdministratorRights") - b.Comma() - b.FieldStart("can_manage_chat") - b.PutBool(c.CanManageChat) - b.Comma() - b.FieldStart("can_change_info") - b.PutBool(c.CanChangeInfo) - b.Comma() - b.FieldStart("can_post_messages") - b.PutBool(c.CanPostMessages) - b.Comma() - b.FieldStart("can_edit_messages") - b.PutBool(c.CanEditMessages) - b.Comma() - b.FieldStart("can_delete_messages") - b.PutBool(c.CanDeleteMessages) - b.Comma() - b.FieldStart("can_invite_users") - b.PutBool(c.CanInviteUsers) - b.Comma() - b.FieldStart("can_restrict_members") - b.PutBool(c.CanRestrictMembers) - b.Comma() - b.FieldStart("can_pin_messages") - b.PutBool(c.CanPinMessages) - b.Comma() - b.FieldStart("can_manage_topics") - b.PutBool(c.CanManageTopics) - b.Comma() - b.FieldStart("can_promote_members") - b.PutBool(c.CanPromoteMembers) - b.Comma() - b.FieldStart("can_manage_video_chats") - b.PutBool(c.CanManageVideoChats) - b.Comma() - b.FieldStart("can_post_stories") - b.PutBool(c.CanPostStories) - b.Comma() - b.FieldStart("can_edit_stories") - b.PutBool(c.CanEditStories) - b.Comma() - b.FieldStart("can_delete_stories") - b.PutBool(c.CanDeleteStories) - b.Comma() - b.FieldStart("is_anonymous") - b.PutBool(c.IsAnonymous) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatAdministratorRights) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatAdministratorRights#5f4f9044 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatAdministratorRights"); err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: %w", err) - } - case "can_manage_chat": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_chat: %w", err) - } - c.CanManageChat = value - case "can_change_info": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_change_info: %w", err) - } - c.CanChangeInfo = value - case "can_post_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_post_messages: %w", err) - } - c.CanPostMessages = value - case "can_edit_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_edit_messages: %w", err) - } - c.CanEditMessages = value - case "can_delete_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_delete_messages: %w", err) - } - c.CanDeleteMessages = value - case "can_invite_users": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_invite_users: %w", err) - } - c.CanInviteUsers = value - case "can_restrict_members": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_restrict_members: %w", err) - } - c.CanRestrictMembers = value - case "can_pin_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_pin_messages: %w", err) - } - c.CanPinMessages = value - case "can_manage_topics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_topics: %w", err) - } - c.CanManageTopics = value - case "can_promote_members": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_promote_members: %w", err) - } - c.CanPromoteMembers = value - case "can_manage_video_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_manage_video_chats: %w", err) - } - c.CanManageVideoChats = value - case "can_post_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_post_stories: %w", err) - } - c.CanPostStories = value - case "can_edit_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_edit_stories: %w", err) - } - c.CanEditStories = value - case "can_delete_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field can_delete_stories: %w", err) - } - c.CanDeleteStories = value - case "is_anonymous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatAdministratorRights#5f4f9044: field is_anonymous: %w", err) - } - c.IsAnonymous = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCanManageChat returns value of CanManageChat field. -func (c *ChatAdministratorRights) GetCanManageChat() (value bool) { - if c == nil { - return - } - return c.CanManageChat -} - -// GetCanChangeInfo returns value of CanChangeInfo field. -func (c *ChatAdministratorRights) GetCanChangeInfo() (value bool) { - if c == nil { - return - } - return c.CanChangeInfo -} - -// GetCanPostMessages returns value of CanPostMessages field. -func (c *ChatAdministratorRights) GetCanPostMessages() (value bool) { - if c == nil { - return - } - return c.CanPostMessages -} - -// GetCanEditMessages returns value of CanEditMessages field. -func (c *ChatAdministratorRights) GetCanEditMessages() (value bool) { - if c == nil { - return - } - return c.CanEditMessages -} - -// GetCanDeleteMessages returns value of CanDeleteMessages field. -func (c *ChatAdministratorRights) GetCanDeleteMessages() (value bool) { - if c == nil { - return - } - return c.CanDeleteMessages -} - -// GetCanInviteUsers returns value of CanInviteUsers field. -func (c *ChatAdministratorRights) GetCanInviteUsers() (value bool) { - if c == nil { - return - } - return c.CanInviteUsers -} - -// GetCanRestrictMembers returns value of CanRestrictMembers field. -func (c *ChatAdministratorRights) GetCanRestrictMembers() (value bool) { - if c == nil { - return - } - return c.CanRestrictMembers -} - -// GetCanPinMessages returns value of CanPinMessages field. -func (c *ChatAdministratorRights) GetCanPinMessages() (value bool) { - if c == nil { - return - } - return c.CanPinMessages -} - -// GetCanManageTopics returns value of CanManageTopics field. -func (c *ChatAdministratorRights) GetCanManageTopics() (value bool) { - if c == nil { - return - } - return c.CanManageTopics -} - -// GetCanPromoteMembers returns value of CanPromoteMembers field. -func (c *ChatAdministratorRights) GetCanPromoteMembers() (value bool) { - if c == nil { - return - } - return c.CanPromoteMembers -} - -// GetCanManageVideoChats returns value of CanManageVideoChats field. -func (c *ChatAdministratorRights) GetCanManageVideoChats() (value bool) { - if c == nil { - return - } - return c.CanManageVideoChats -} - -// GetCanPostStories returns value of CanPostStories field. -func (c *ChatAdministratorRights) GetCanPostStories() (value bool) { - if c == nil { - return - } - return c.CanPostStories -} - -// GetCanEditStories returns value of CanEditStories field. -func (c *ChatAdministratorRights) GetCanEditStories() (value bool) { - if c == nil { - return - } - return c.CanEditStories -} - -// GetCanDeleteStories returns value of CanDeleteStories field. -func (c *ChatAdministratorRights) GetCanDeleteStories() (value bool) { - if c == nil { - return - } - return c.CanDeleteStories -} - -// GetIsAnonymous returns value of IsAnonymous field. -func (c *ChatAdministratorRights) GetIsAnonymous() (value bool) { - if c == nil { - return - } - return c.IsAnonymous -} diff --git a/tdapi/tl_chat_administrators_gen.go b/tdapi/tl_chat_administrators_gen.go deleted file mode 100644 index f220bc162..000000000 --- a/tdapi/tl_chat_administrators_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatAdministrators represents TL type `chatAdministrators#5141ca21`. -type ChatAdministrators struct { - // A list of chat administrators - Administrators []ChatAdministrator -} - -// ChatAdministratorsTypeID is TL type id of ChatAdministrators. -const ChatAdministratorsTypeID = 0x5141ca21 - -// Ensuring interfaces in compile-time for ChatAdministrators. -var ( - _ bin.Encoder = &ChatAdministrators{} - _ bin.Decoder = &ChatAdministrators{} - _ bin.BareEncoder = &ChatAdministrators{} - _ bin.BareDecoder = &ChatAdministrators{} -) - -func (c *ChatAdministrators) Zero() bool { - if c == nil { - return true - } - if !(c.Administrators == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatAdministrators) String() string { - if c == nil { - return "ChatAdministrators(nil)" - } - type Alias ChatAdministrators - return fmt.Sprintf("ChatAdministrators%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatAdministrators) TypeID() uint32 { - return ChatAdministratorsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatAdministrators) TypeName() string { - return "chatAdministrators" -} - -// TypeInfo returns info about TL type. -func (c *ChatAdministrators) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatAdministrators", - ID: ChatAdministratorsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Administrators", - SchemaName: "administrators", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatAdministrators) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAdministrators#5141ca21 as nil") - } - b.PutID(ChatAdministratorsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatAdministrators) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAdministrators#5141ca21 as nil") - } - b.PutInt(len(c.Administrators)) - for idx, v := range c.Administrators { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatAdministrators#5141ca21: field administrators element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatAdministrators) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAdministrators#5141ca21 to nil") - } - if err := b.ConsumeID(ChatAdministratorsTypeID); err != nil { - return fmt.Errorf("unable to decode chatAdministrators#5141ca21: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatAdministrators) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAdministrators#5141ca21 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatAdministrators#5141ca21: field administrators: %w", err) - } - - if headerLen > 0 { - c.Administrators = make([]ChatAdministrator, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatAdministrator - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatAdministrators#5141ca21: field administrators: %w", err) - } - c.Administrators = append(c.Administrators, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatAdministrators) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatAdministrators#5141ca21 as nil") - } - b.ObjStart() - b.PutID("chatAdministrators") - b.Comma() - b.FieldStart("administrators") - b.ArrStart() - for idx, v := range c.Administrators { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatAdministrators#5141ca21: field administrators element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatAdministrators) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatAdministrators#5141ca21 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatAdministrators"); err != nil { - return fmt.Errorf("unable to decode chatAdministrators#5141ca21: %w", err) - } - case "administrators": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatAdministrator - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatAdministrators#5141ca21: field administrators: %w", err) - } - c.Administrators = append(c.Administrators, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatAdministrators#5141ca21: field administrators: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAdministrators returns value of Administrators field. -func (c *ChatAdministrators) GetAdministrators() (value []ChatAdministrator) { - if c == nil { - return - } - return c.Administrators -} diff --git a/tdapi/tl_chat_available_reactions_gen.go b/tdapi/tl_chat_available_reactions_gen.go deleted file mode 100644 index 86e6b4edb..000000000 --- a/tdapi/tl_chat_available_reactions_gen.go +++ /dev/null @@ -1,572 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatAvailableReactionsAll represents TL type `chatAvailableReactionsAll#29600b97`. -type ChatAvailableReactionsAll struct { - // The maximum allowed number of reactions per message; 1-11 - MaxReactionCount int32 -} - -// ChatAvailableReactionsAllTypeID is TL type id of ChatAvailableReactionsAll. -const ChatAvailableReactionsAllTypeID = 0x29600b97 - -// construct implements constructor of ChatAvailableReactionsClass. -func (c ChatAvailableReactionsAll) construct() ChatAvailableReactionsClass { return &c } - -// Ensuring interfaces in compile-time for ChatAvailableReactionsAll. -var ( - _ bin.Encoder = &ChatAvailableReactionsAll{} - _ bin.Decoder = &ChatAvailableReactionsAll{} - _ bin.BareEncoder = &ChatAvailableReactionsAll{} - _ bin.BareDecoder = &ChatAvailableReactionsAll{} - - _ ChatAvailableReactionsClass = &ChatAvailableReactionsAll{} -) - -func (c *ChatAvailableReactionsAll) Zero() bool { - if c == nil { - return true - } - if !(c.MaxReactionCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatAvailableReactionsAll) String() string { - if c == nil { - return "ChatAvailableReactionsAll(nil)" - } - type Alias ChatAvailableReactionsAll - return fmt.Sprintf("ChatAvailableReactionsAll%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatAvailableReactionsAll) TypeID() uint32 { - return ChatAvailableReactionsAllTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatAvailableReactionsAll) TypeName() string { - return "chatAvailableReactionsAll" -} - -// TypeInfo returns info about TL type. -func (c *ChatAvailableReactionsAll) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatAvailableReactionsAll", - ID: ChatAvailableReactionsAllTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MaxReactionCount", - SchemaName: "max_reaction_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatAvailableReactionsAll) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsAll#29600b97 as nil") - } - b.PutID(ChatAvailableReactionsAllTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatAvailableReactionsAll) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsAll#29600b97 as nil") - } - b.PutInt32(c.MaxReactionCount) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatAvailableReactionsAll) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsAll#29600b97 to nil") - } - if err := b.ConsumeID(ChatAvailableReactionsAllTypeID); err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsAll#29600b97: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatAvailableReactionsAll) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsAll#29600b97 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsAll#29600b97: field max_reaction_count: %w", err) - } - c.MaxReactionCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatAvailableReactionsAll) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsAll#29600b97 as nil") - } - b.ObjStart() - b.PutID("chatAvailableReactionsAll") - b.Comma() - b.FieldStart("max_reaction_count") - b.PutInt32(c.MaxReactionCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatAvailableReactionsAll) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsAll#29600b97 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatAvailableReactionsAll"); err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsAll#29600b97: %w", err) - } - case "max_reaction_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsAll#29600b97: field max_reaction_count: %w", err) - } - c.MaxReactionCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMaxReactionCount returns value of MaxReactionCount field. -func (c *ChatAvailableReactionsAll) GetMaxReactionCount() (value int32) { - if c == nil { - return - } - return c.MaxReactionCount -} - -// ChatAvailableReactionsSome represents TL type `chatAvailableReactionsSome#36b46b7d`. -type ChatAvailableReactionsSome struct { - // The list of reactions - Reactions []ReactionTypeClass - // The maximum allowed number of reactions per message; 1-11 - MaxReactionCount int32 -} - -// ChatAvailableReactionsSomeTypeID is TL type id of ChatAvailableReactionsSome. -const ChatAvailableReactionsSomeTypeID = 0x36b46b7d - -// construct implements constructor of ChatAvailableReactionsClass. -func (c ChatAvailableReactionsSome) construct() ChatAvailableReactionsClass { return &c } - -// Ensuring interfaces in compile-time for ChatAvailableReactionsSome. -var ( - _ bin.Encoder = &ChatAvailableReactionsSome{} - _ bin.Decoder = &ChatAvailableReactionsSome{} - _ bin.BareEncoder = &ChatAvailableReactionsSome{} - _ bin.BareDecoder = &ChatAvailableReactionsSome{} - - _ ChatAvailableReactionsClass = &ChatAvailableReactionsSome{} -) - -func (c *ChatAvailableReactionsSome) Zero() bool { - if c == nil { - return true - } - if !(c.Reactions == nil) { - return false - } - if !(c.MaxReactionCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatAvailableReactionsSome) String() string { - if c == nil { - return "ChatAvailableReactionsSome(nil)" - } - type Alias ChatAvailableReactionsSome - return fmt.Sprintf("ChatAvailableReactionsSome%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatAvailableReactionsSome) TypeID() uint32 { - return ChatAvailableReactionsSomeTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatAvailableReactionsSome) TypeName() string { - return "chatAvailableReactionsSome" -} - -// TypeInfo returns info about TL type. -func (c *ChatAvailableReactionsSome) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatAvailableReactionsSome", - ID: ChatAvailableReactionsSomeTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Reactions", - SchemaName: "reactions", - }, - { - Name: "MaxReactionCount", - SchemaName: "max_reaction_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatAvailableReactionsSome) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsSome#36b46b7d as nil") - } - b.PutID(ChatAvailableReactionsSomeTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatAvailableReactionsSome) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsSome#36b46b7d as nil") - } - b.PutInt(len(c.Reactions)) - for idx, v := range c.Reactions { - if v == nil { - return fmt.Errorf("unable to encode chatAvailableReactionsSome#36b46b7d: field reactions element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatAvailableReactionsSome#36b46b7d: field reactions element with index %d: %w", idx, err) - } - } - b.PutInt32(c.MaxReactionCount) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatAvailableReactionsSome) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsSome#36b46b7d to nil") - } - if err := b.ConsumeID(ChatAvailableReactionsSomeTypeID); err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatAvailableReactionsSome) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsSome#36b46b7d to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field reactions: %w", err) - } - - if headerLen > 0 { - c.Reactions = make([]ReactionTypeClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field reactions: %w", err) - } - c.Reactions = append(c.Reactions, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field max_reaction_count: %w", err) - } - c.MaxReactionCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatAvailableReactionsSome) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatAvailableReactionsSome#36b46b7d as nil") - } - b.ObjStart() - b.PutID("chatAvailableReactionsSome") - b.Comma() - b.FieldStart("reactions") - b.ArrStart() - for idx, v := range c.Reactions { - if v == nil { - return fmt.Errorf("unable to encode chatAvailableReactionsSome#36b46b7d: field reactions element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatAvailableReactionsSome#36b46b7d: field reactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("max_reaction_count") - b.PutInt32(c.MaxReactionCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatAvailableReactionsSome) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatAvailableReactionsSome#36b46b7d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatAvailableReactionsSome"); err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: %w", err) - } - case "reactions": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field reactions: %w", err) - } - c.Reactions = append(c.Reactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field reactions: %w", err) - } - case "max_reaction_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatAvailableReactionsSome#36b46b7d: field max_reaction_count: %w", err) - } - c.MaxReactionCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReactions returns value of Reactions field. -func (c *ChatAvailableReactionsSome) GetReactions() (value []ReactionTypeClass) { - if c == nil { - return - } - return c.Reactions -} - -// GetMaxReactionCount returns value of MaxReactionCount field. -func (c *ChatAvailableReactionsSome) GetMaxReactionCount() (value int32) { - if c == nil { - return - } - return c.MaxReactionCount -} - -// ChatAvailableReactionsClassName is schema name of ChatAvailableReactionsClass. -const ChatAvailableReactionsClassName = "ChatAvailableReactions" - -// ChatAvailableReactionsClass represents ChatAvailableReactions generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatAvailableReactions(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatAvailableReactionsAll: // chatAvailableReactionsAll#29600b97 -// case *tdapi.ChatAvailableReactionsSome: // chatAvailableReactionsSome#36b46b7d -// default: panic(v) -// } -type ChatAvailableReactionsClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatAvailableReactionsClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error - - // The maximum allowed number of reactions per message; 1-11 - GetMaxReactionCount() (value int32) -} - -// DecodeChatAvailableReactions implements binary de-serialization for ChatAvailableReactionsClass. -func DecodeChatAvailableReactions(buf *bin.Buffer) (ChatAvailableReactionsClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatAvailableReactionsAllTypeID: - // Decoding chatAvailableReactionsAll#29600b97. - v := ChatAvailableReactionsAll{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatAvailableReactionsClass: %w", err) - } - return &v, nil - case ChatAvailableReactionsSomeTypeID: - // Decoding chatAvailableReactionsSome#36b46b7d. - v := ChatAvailableReactionsSome{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatAvailableReactionsClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatAvailableReactionsClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatAvailableReactions implements binary de-serialization for ChatAvailableReactionsClass. -func DecodeTDLibJSONChatAvailableReactions(buf tdjson.Decoder) (ChatAvailableReactionsClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatAvailableReactionsAll": - // Decoding chatAvailableReactionsAll#29600b97. - v := ChatAvailableReactionsAll{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatAvailableReactionsClass: %w", err) - } - return &v, nil - case "chatAvailableReactionsSome": - // Decoding chatAvailableReactionsSome#36b46b7d. - v := ChatAvailableReactionsSome{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatAvailableReactionsClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatAvailableReactionsClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatAvailableReactions boxes the ChatAvailableReactionsClass providing a helper. -type ChatAvailableReactionsBox struct { - ChatAvailableReactions ChatAvailableReactionsClass -} - -// Decode implements bin.Decoder for ChatAvailableReactionsBox. -func (b *ChatAvailableReactionsBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatAvailableReactionsBox to nil") - } - v, err := DecodeChatAvailableReactions(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatAvailableReactions = v - return nil -} - -// Encode implements bin.Encode for ChatAvailableReactionsBox. -func (b *ChatAvailableReactionsBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatAvailableReactions == nil { - return fmt.Errorf("unable to encode ChatAvailableReactionsClass as nil") - } - return b.ChatAvailableReactions.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatAvailableReactionsBox. -func (b *ChatAvailableReactionsBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatAvailableReactionsBox to nil") - } - v, err := DecodeTDLibJSONChatAvailableReactions(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatAvailableReactions = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatAvailableReactionsBox. -func (b *ChatAvailableReactionsBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatAvailableReactions == nil { - return fmt.Errorf("unable to encode ChatAvailableReactionsClass as nil") - } - return b.ChatAvailableReactions.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_background_gen.go b/tdapi/tl_chat_background_gen.go deleted file mode 100644 index 455ff9baa..000000000 --- a/tdapi/tl_chat_background_gen.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatBackground represents TL type `chatBackground#62891968`. -type ChatBackground struct { - // The background - Background Background - // Dimming of the background in dark themes, as a percentage; 0-100. Applied only to - // Wallpaper and Fill types of background - DarkThemeDimming int32 -} - -// ChatBackgroundTypeID is TL type id of ChatBackground. -const ChatBackgroundTypeID = 0x62891968 - -// Ensuring interfaces in compile-time for ChatBackground. -var ( - _ bin.Encoder = &ChatBackground{} - _ bin.Decoder = &ChatBackground{} - _ bin.BareEncoder = &ChatBackground{} - _ bin.BareDecoder = &ChatBackground{} -) - -func (c *ChatBackground) Zero() bool { - if c == nil { - return true - } - if !(c.Background.Zero()) { - return false - } - if !(c.DarkThemeDimming == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBackground) String() string { - if c == nil { - return "ChatBackground(nil)" - } - type Alias ChatBackground - return fmt.Sprintf("ChatBackground%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBackground) TypeID() uint32 { - return ChatBackgroundTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBackground) TypeName() string { - return "chatBackground" -} - -// TypeInfo returns info about TL type. -func (c *ChatBackground) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBackground", - ID: ChatBackgroundTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Background", - SchemaName: "background", - }, - { - Name: "DarkThemeDimming", - SchemaName: "dark_theme_dimming", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBackground) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBackground#62891968 as nil") - } - b.PutID(ChatBackgroundTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBackground) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBackground#62891968 as nil") - } - if err := c.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatBackground#62891968: field background: %w", err) - } - b.PutInt32(c.DarkThemeDimming) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBackground) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBackground#62891968 to nil") - } - if err := b.ConsumeID(ChatBackgroundTypeID); err != nil { - return fmt.Errorf("unable to decode chatBackground#62891968: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBackground) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBackground#62891968 to nil") - } - { - if err := c.Background.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatBackground#62891968: field background: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBackground#62891968: field dark_theme_dimming: %w", err) - } - c.DarkThemeDimming = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBackground) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBackground#62891968 as nil") - } - b.ObjStart() - b.PutID("chatBackground") - b.Comma() - b.FieldStart("background") - if err := c.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatBackground#62891968: field background: %w", err) - } - b.Comma() - b.FieldStart("dark_theme_dimming") - b.PutInt32(c.DarkThemeDimming) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBackground) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBackground#62891968 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBackground"); err != nil { - return fmt.Errorf("unable to decode chatBackground#62891968: %w", err) - } - case "background": - if err := c.Background.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatBackground#62891968: field background: %w", err) - } - case "dark_theme_dimming": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBackground#62891968: field dark_theme_dimming: %w", err) - } - c.DarkThemeDimming = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBackground returns value of Background field. -func (c *ChatBackground) GetBackground() (value Background) { - if c == nil { - return - } - return c.Background -} - -// GetDarkThemeDimming returns value of DarkThemeDimming field. -func (c *ChatBackground) GetDarkThemeDimming() (value int32) { - if c == nil { - return - } - return c.DarkThemeDimming -} diff --git a/tdapi/tl_chat_boost_features_gen.go b/tdapi/tl_chat_boost_features_gen.go deleted file mode 100644 index 11885b9f5..000000000 --- a/tdapi/tl_chat_boost_features_gen.go +++ /dev/null @@ -1,497 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatBoostFeatures represents TL type `chatBoostFeatures#803214be`. -type ChatBoostFeatures struct { - // The list of features - Features []ChatBoostLevelFeatures - // The minimum boost level required to set custom emoji for profile background - MinProfileBackgroundCustomEmojiBoostLevel int32 - // The minimum boost level required to set custom emoji for reply header and link preview - // background; for channel chats only - MinBackgroundCustomEmojiBoostLevel int32 - // The minimum boost level required to set emoji status - MinEmojiStatusBoostLevel int32 - // The minimum boost level required to set a chat theme background as chat background - MinChatThemeBackgroundBoostLevel int32 - // The minimum boost level required to set custom chat background - MinCustomBackgroundBoostLevel int32 - // The minimum boost level required to set custom emoji sticker set for the chat; for - // supergroup chats only - MinCustomEmojiStickerSetBoostLevel int32 - // The minimum boost level allowing to recognize speech in video note and voice note - // messages for non-Premium users; for supergroup chats only - MinSpeechRecognitionBoostLevel int32 - // The minimum boost level allowing to disable sponsored messages in the chat; for - // channel chats only - MinSponsoredMessageDisableBoostLevel int32 -} - -// ChatBoostFeaturesTypeID is TL type id of ChatBoostFeatures. -const ChatBoostFeaturesTypeID = 0x803214be - -// Ensuring interfaces in compile-time for ChatBoostFeatures. -var ( - _ bin.Encoder = &ChatBoostFeatures{} - _ bin.Decoder = &ChatBoostFeatures{} - _ bin.BareEncoder = &ChatBoostFeatures{} - _ bin.BareDecoder = &ChatBoostFeatures{} -) - -func (c *ChatBoostFeatures) Zero() bool { - if c == nil { - return true - } - if !(c.Features == nil) { - return false - } - if !(c.MinProfileBackgroundCustomEmojiBoostLevel == 0) { - return false - } - if !(c.MinBackgroundCustomEmojiBoostLevel == 0) { - return false - } - if !(c.MinEmojiStatusBoostLevel == 0) { - return false - } - if !(c.MinChatThemeBackgroundBoostLevel == 0) { - return false - } - if !(c.MinCustomBackgroundBoostLevel == 0) { - return false - } - if !(c.MinCustomEmojiStickerSetBoostLevel == 0) { - return false - } - if !(c.MinSpeechRecognitionBoostLevel == 0) { - return false - } - if !(c.MinSponsoredMessageDisableBoostLevel == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBoostFeatures) String() string { - if c == nil { - return "ChatBoostFeatures(nil)" - } - type Alias ChatBoostFeatures - return fmt.Sprintf("ChatBoostFeatures%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBoostFeatures) TypeID() uint32 { - return ChatBoostFeaturesTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBoostFeatures) TypeName() string { - return "chatBoostFeatures" -} - -// TypeInfo returns info about TL type. -func (c *ChatBoostFeatures) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBoostFeatures", - ID: ChatBoostFeaturesTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Features", - SchemaName: "features", - }, - { - Name: "MinProfileBackgroundCustomEmojiBoostLevel", - SchemaName: "min_profile_background_custom_emoji_boost_level", - }, - { - Name: "MinBackgroundCustomEmojiBoostLevel", - SchemaName: "min_background_custom_emoji_boost_level", - }, - { - Name: "MinEmojiStatusBoostLevel", - SchemaName: "min_emoji_status_boost_level", - }, - { - Name: "MinChatThemeBackgroundBoostLevel", - SchemaName: "min_chat_theme_background_boost_level", - }, - { - Name: "MinCustomBackgroundBoostLevel", - SchemaName: "min_custom_background_boost_level", - }, - { - Name: "MinCustomEmojiStickerSetBoostLevel", - SchemaName: "min_custom_emoji_sticker_set_boost_level", - }, - { - Name: "MinSpeechRecognitionBoostLevel", - SchemaName: "min_speech_recognition_boost_level", - }, - { - Name: "MinSponsoredMessageDisableBoostLevel", - SchemaName: "min_sponsored_message_disable_boost_level", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBoostFeatures) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostFeatures#803214be as nil") - } - b.PutID(ChatBoostFeaturesTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBoostFeatures) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostFeatures#803214be as nil") - } - b.PutInt(len(c.Features)) - for idx, v := range c.Features { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatBoostFeatures#803214be: field features element with index %d: %w", idx, err) - } - } - b.PutInt32(c.MinProfileBackgroundCustomEmojiBoostLevel) - b.PutInt32(c.MinBackgroundCustomEmojiBoostLevel) - b.PutInt32(c.MinEmojiStatusBoostLevel) - b.PutInt32(c.MinChatThemeBackgroundBoostLevel) - b.PutInt32(c.MinCustomBackgroundBoostLevel) - b.PutInt32(c.MinCustomEmojiStickerSetBoostLevel) - b.PutInt32(c.MinSpeechRecognitionBoostLevel) - b.PutInt32(c.MinSponsoredMessageDisableBoostLevel) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBoostFeatures) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostFeatures#803214be to nil") - } - if err := b.ConsumeID(ChatBoostFeaturesTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBoostFeatures) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostFeatures#803214be to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field features: %w", err) - } - - if headerLen > 0 { - c.Features = make([]ChatBoostLevelFeatures, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatBoostLevelFeatures - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatBoostFeatures#803214be: field features: %w", err) - } - c.Features = append(c.Features, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_profile_background_custom_emoji_boost_level: %w", err) - } - c.MinProfileBackgroundCustomEmojiBoostLevel = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_background_custom_emoji_boost_level: %w", err) - } - c.MinBackgroundCustomEmojiBoostLevel = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_emoji_status_boost_level: %w", err) - } - c.MinEmojiStatusBoostLevel = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_chat_theme_background_boost_level: %w", err) - } - c.MinChatThemeBackgroundBoostLevel = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_custom_background_boost_level: %w", err) - } - c.MinCustomBackgroundBoostLevel = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_custom_emoji_sticker_set_boost_level: %w", err) - } - c.MinCustomEmojiStickerSetBoostLevel = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_speech_recognition_boost_level: %w", err) - } - c.MinSpeechRecognitionBoostLevel = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_sponsored_message_disable_boost_level: %w", err) - } - c.MinSponsoredMessageDisableBoostLevel = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBoostFeatures) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostFeatures#803214be as nil") - } - b.ObjStart() - b.PutID("chatBoostFeatures") - b.Comma() - b.FieldStart("features") - b.ArrStart() - for idx, v := range c.Features { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatBoostFeatures#803214be: field features element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("min_profile_background_custom_emoji_boost_level") - b.PutInt32(c.MinProfileBackgroundCustomEmojiBoostLevel) - b.Comma() - b.FieldStart("min_background_custom_emoji_boost_level") - b.PutInt32(c.MinBackgroundCustomEmojiBoostLevel) - b.Comma() - b.FieldStart("min_emoji_status_boost_level") - b.PutInt32(c.MinEmojiStatusBoostLevel) - b.Comma() - b.FieldStart("min_chat_theme_background_boost_level") - b.PutInt32(c.MinChatThemeBackgroundBoostLevel) - b.Comma() - b.FieldStart("min_custom_background_boost_level") - b.PutInt32(c.MinCustomBackgroundBoostLevel) - b.Comma() - b.FieldStart("min_custom_emoji_sticker_set_boost_level") - b.PutInt32(c.MinCustomEmojiStickerSetBoostLevel) - b.Comma() - b.FieldStart("min_speech_recognition_boost_level") - b.PutInt32(c.MinSpeechRecognitionBoostLevel) - b.Comma() - b.FieldStart("min_sponsored_message_disable_boost_level") - b.PutInt32(c.MinSponsoredMessageDisableBoostLevel) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBoostFeatures) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostFeatures#803214be to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBoostFeatures"); err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: %w", err) - } - case "features": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatBoostLevelFeatures - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field features: %w", err) - } - c.Features = append(c.Features, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field features: %w", err) - } - case "min_profile_background_custom_emoji_boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_profile_background_custom_emoji_boost_level: %w", err) - } - c.MinProfileBackgroundCustomEmojiBoostLevel = value - case "min_background_custom_emoji_boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_background_custom_emoji_boost_level: %w", err) - } - c.MinBackgroundCustomEmojiBoostLevel = value - case "min_emoji_status_boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_emoji_status_boost_level: %w", err) - } - c.MinEmojiStatusBoostLevel = value - case "min_chat_theme_background_boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_chat_theme_background_boost_level: %w", err) - } - c.MinChatThemeBackgroundBoostLevel = value - case "min_custom_background_boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_custom_background_boost_level: %w", err) - } - c.MinCustomBackgroundBoostLevel = value - case "min_custom_emoji_sticker_set_boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_custom_emoji_sticker_set_boost_level: %w", err) - } - c.MinCustomEmojiStickerSetBoostLevel = value - case "min_speech_recognition_boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_speech_recognition_boost_level: %w", err) - } - c.MinSpeechRecognitionBoostLevel = value - case "min_sponsored_message_disable_boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostFeatures#803214be: field min_sponsored_message_disable_boost_level: %w", err) - } - c.MinSponsoredMessageDisableBoostLevel = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFeatures returns value of Features field. -func (c *ChatBoostFeatures) GetFeatures() (value []ChatBoostLevelFeatures) { - if c == nil { - return - } - return c.Features -} - -// GetMinProfileBackgroundCustomEmojiBoostLevel returns value of MinProfileBackgroundCustomEmojiBoostLevel field. -func (c *ChatBoostFeatures) GetMinProfileBackgroundCustomEmojiBoostLevel() (value int32) { - if c == nil { - return - } - return c.MinProfileBackgroundCustomEmojiBoostLevel -} - -// GetMinBackgroundCustomEmojiBoostLevel returns value of MinBackgroundCustomEmojiBoostLevel field. -func (c *ChatBoostFeatures) GetMinBackgroundCustomEmojiBoostLevel() (value int32) { - if c == nil { - return - } - return c.MinBackgroundCustomEmojiBoostLevel -} - -// GetMinEmojiStatusBoostLevel returns value of MinEmojiStatusBoostLevel field. -func (c *ChatBoostFeatures) GetMinEmojiStatusBoostLevel() (value int32) { - if c == nil { - return - } - return c.MinEmojiStatusBoostLevel -} - -// GetMinChatThemeBackgroundBoostLevel returns value of MinChatThemeBackgroundBoostLevel field. -func (c *ChatBoostFeatures) GetMinChatThemeBackgroundBoostLevel() (value int32) { - if c == nil { - return - } - return c.MinChatThemeBackgroundBoostLevel -} - -// GetMinCustomBackgroundBoostLevel returns value of MinCustomBackgroundBoostLevel field. -func (c *ChatBoostFeatures) GetMinCustomBackgroundBoostLevel() (value int32) { - if c == nil { - return - } - return c.MinCustomBackgroundBoostLevel -} - -// GetMinCustomEmojiStickerSetBoostLevel returns value of MinCustomEmojiStickerSetBoostLevel field. -func (c *ChatBoostFeatures) GetMinCustomEmojiStickerSetBoostLevel() (value int32) { - if c == nil { - return - } - return c.MinCustomEmojiStickerSetBoostLevel -} - -// GetMinSpeechRecognitionBoostLevel returns value of MinSpeechRecognitionBoostLevel field. -func (c *ChatBoostFeatures) GetMinSpeechRecognitionBoostLevel() (value int32) { - if c == nil { - return - } - return c.MinSpeechRecognitionBoostLevel -} - -// GetMinSponsoredMessageDisableBoostLevel returns value of MinSponsoredMessageDisableBoostLevel field. -func (c *ChatBoostFeatures) GetMinSponsoredMessageDisableBoostLevel() (value int32) { - if c == nil { - return - } - return c.MinSponsoredMessageDisableBoostLevel -} diff --git a/tdapi/tl_chat_boost_gen.go b/tdapi/tl_chat_boost_gen.go deleted file mode 100644 index fe72ea254..000000000 --- a/tdapi/tl_chat_boost_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatBoost represents TL type `chatBoost#96bfccb2`. -type ChatBoost struct { - // Unique identifier of the boost - ID string - // The number of identical boosts applied - Count int32 - // Source of the boost - Source ChatBoostSourceClass - // Point in time (Unix timestamp) when the chat was boosted - StartDate int32 - // Point in time (Unix timestamp) when the boost will expire - ExpirationDate int32 -} - -// ChatBoostTypeID is TL type id of ChatBoost. -const ChatBoostTypeID = 0x96bfccb2 - -// Ensuring interfaces in compile-time for ChatBoost. -var ( - _ bin.Encoder = &ChatBoost{} - _ bin.Decoder = &ChatBoost{} - _ bin.BareEncoder = &ChatBoost{} - _ bin.BareDecoder = &ChatBoost{} -) - -func (c *ChatBoost) Zero() bool { - if c == nil { - return true - } - if !(c.ID == "") { - return false - } - if !(c.Count == 0) { - return false - } - if !(c.Source == nil) { - return false - } - if !(c.StartDate == 0) { - return false - } - if !(c.ExpirationDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBoost) String() string { - if c == nil { - return "ChatBoost(nil)" - } - type Alias ChatBoost - return fmt.Sprintf("ChatBoost%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBoost) TypeID() uint32 { - return ChatBoostTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBoost) TypeName() string { - return "chatBoost" -} - -// TypeInfo returns info about TL type. -func (c *ChatBoost) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBoost", - ID: ChatBoostTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Count", - SchemaName: "count", - }, - { - Name: "Source", - SchemaName: "source", - }, - { - Name: "StartDate", - SchemaName: "start_date", - }, - { - Name: "ExpirationDate", - SchemaName: "expiration_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBoost) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoost#96bfccb2 as nil") - } - b.PutID(ChatBoostTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBoost) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoost#96bfccb2 as nil") - } - b.PutString(c.ID) - b.PutInt32(c.Count) - if c.Source == nil { - return fmt.Errorf("unable to encode chatBoost#96bfccb2: field source is nil") - } - if err := c.Source.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatBoost#96bfccb2: field source: %w", err) - } - b.PutInt32(c.StartDate) - b.PutInt32(c.ExpirationDate) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBoost) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoost#96bfccb2 to nil") - } - if err := b.ConsumeID(ChatBoostTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBoost) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoost#96bfccb2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: field id: %w", err) - } - c.ID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: field count: %w", err) - } - c.Count = value - } - { - value, err := DecodeChatBoostSource(b) - if err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: field source: %w", err) - } - c.Source = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: field start_date: %w", err) - } - c.StartDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: field expiration_date: %w", err) - } - c.ExpirationDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBoost) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBoost#96bfccb2 as nil") - } - b.ObjStart() - b.PutID("chatBoost") - b.Comma() - b.FieldStart("id") - b.PutString(c.ID) - b.Comma() - b.FieldStart("count") - b.PutInt32(c.Count) - b.Comma() - b.FieldStart("source") - if c.Source == nil { - return fmt.Errorf("unable to encode chatBoost#96bfccb2: field source is nil") - } - if err := c.Source.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatBoost#96bfccb2: field source: %w", err) - } - b.Comma() - b.FieldStart("start_date") - b.PutInt32(c.StartDate) - b.Comma() - b.FieldStart("expiration_date") - b.PutInt32(c.ExpirationDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBoost) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBoost#96bfccb2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBoost"); err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: field id: %w", err) - } - c.ID = value - case "count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: field count: %w", err) - } - c.Count = value - case "source": - value, err := DecodeTDLibJSONChatBoostSource(b) - if err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: field source: %w", err) - } - c.Source = value - case "start_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: field start_date: %w", err) - } - c.StartDate = value - case "expiration_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoost#96bfccb2: field expiration_date: %w", err) - } - c.ExpirationDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (c *ChatBoost) GetID() (value string) { - if c == nil { - return - } - return c.ID -} - -// GetCount returns value of Count field. -func (c *ChatBoost) GetCount() (value int32) { - if c == nil { - return - } - return c.Count -} - -// GetSource returns value of Source field. -func (c *ChatBoost) GetSource() (value ChatBoostSourceClass) { - if c == nil { - return - } - return c.Source -} - -// GetStartDate returns value of StartDate field. -func (c *ChatBoost) GetStartDate() (value int32) { - if c == nil { - return - } - return c.StartDate -} - -// GetExpirationDate returns value of ExpirationDate field. -func (c *ChatBoost) GetExpirationDate() (value int32) { - if c == nil { - return - } - return c.ExpirationDate -} diff --git a/tdapi/tl_chat_boost_level_features_gen.go b/tdapi/tl_chat_boost_level_features_gen.go deleted file mode 100644 index 264d947b1..000000000 --- a/tdapi/tl_chat_boost_level_features_gen.go +++ /dev/null @@ -1,637 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatBoostLevelFeatures represents TL type `chatBoostLevelFeatures#f4b51914`. -type ChatBoostLevelFeatures struct { - // Target chat boost level - Level int32 - // Number of stories that the chat can publish daily - StoryPerDayCount int32 - // Number of custom emoji reactions that can be added to the list of available reactions - CustomEmojiReactionCount int32 - // Number of custom colors for chat title - TitleColorCount int32 - // Number of custom colors for profile photo background - ProfileAccentColorCount int32 - // True, if custom emoji for profile background can be set - CanSetProfileBackgroundCustomEmoji bool - // Number of custom colors for background of empty chat photo, replies to messages and - // link previews - AccentColorCount int32 - // True, if custom emoji for reply header and link preview background can be set - CanSetBackgroundCustomEmoji bool - // True, if emoji status can be set - CanSetEmojiStatus bool - // Number of chat theme backgrounds that can be set as chat background - ChatThemeBackgroundCount int32 - // True, if custom background can be set in the chat for all users - CanSetCustomBackground bool - // True, if custom emoji sticker set can be set for the chat - CanSetCustomEmojiStickerSet bool - // True, if speech recognition can be used for video note and voice note messages by all - // users - CanRecognizeSpeech bool - // True, if sponsored messages can be disabled in the chat - CanDisableSponsoredMessages bool -} - -// ChatBoostLevelFeaturesTypeID is TL type id of ChatBoostLevelFeatures. -const ChatBoostLevelFeaturesTypeID = 0xf4b51914 - -// Ensuring interfaces in compile-time for ChatBoostLevelFeatures. -var ( - _ bin.Encoder = &ChatBoostLevelFeatures{} - _ bin.Decoder = &ChatBoostLevelFeatures{} - _ bin.BareEncoder = &ChatBoostLevelFeatures{} - _ bin.BareDecoder = &ChatBoostLevelFeatures{} -) - -func (c *ChatBoostLevelFeatures) Zero() bool { - if c == nil { - return true - } - if !(c.Level == 0) { - return false - } - if !(c.StoryPerDayCount == 0) { - return false - } - if !(c.CustomEmojiReactionCount == 0) { - return false - } - if !(c.TitleColorCount == 0) { - return false - } - if !(c.ProfileAccentColorCount == 0) { - return false - } - if !(c.CanSetProfileBackgroundCustomEmoji == false) { - return false - } - if !(c.AccentColorCount == 0) { - return false - } - if !(c.CanSetBackgroundCustomEmoji == false) { - return false - } - if !(c.CanSetEmojiStatus == false) { - return false - } - if !(c.ChatThemeBackgroundCount == 0) { - return false - } - if !(c.CanSetCustomBackground == false) { - return false - } - if !(c.CanSetCustomEmojiStickerSet == false) { - return false - } - if !(c.CanRecognizeSpeech == false) { - return false - } - if !(c.CanDisableSponsoredMessages == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBoostLevelFeatures) String() string { - if c == nil { - return "ChatBoostLevelFeatures(nil)" - } - type Alias ChatBoostLevelFeatures - return fmt.Sprintf("ChatBoostLevelFeatures%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBoostLevelFeatures) TypeID() uint32 { - return ChatBoostLevelFeaturesTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBoostLevelFeatures) TypeName() string { - return "chatBoostLevelFeatures" -} - -// TypeInfo returns info about TL type. -func (c *ChatBoostLevelFeatures) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBoostLevelFeatures", - ID: ChatBoostLevelFeaturesTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Level", - SchemaName: "level", - }, - { - Name: "StoryPerDayCount", - SchemaName: "story_per_day_count", - }, - { - Name: "CustomEmojiReactionCount", - SchemaName: "custom_emoji_reaction_count", - }, - { - Name: "TitleColorCount", - SchemaName: "title_color_count", - }, - { - Name: "ProfileAccentColorCount", - SchemaName: "profile_accent_color_count", - }, - { - Name: "CanSetProfileBackgroundCustomEmoji", - SchemaName: "can_set_profile_background_custom_emoji", - }, - { - Name: "AccentColorCount", - SchemaName: "accent_color_count", - }, - { - Name: "CanSetBackgroundCustomEmoji", - SchemaName: "can_set_background_custom_emoji", - }, - { - Name: "CanSetEmojiStatus", - SchemaName: "can_set_emoji_status", - }, - { - Name: "ChatThemeBackgroundCount", - SchemaName: "chat_theme_background_count", - }, - { - Name: "CanSetCustomBackground", - SchemaName: "can_set_custom_background", - }, - { - Name: "CanSetCustomEmojiStickerSet", - SchemaName: "can_set_custom_emoji_sticker_set", - }, - { - Name: "CanRecognizeSpeech", - SchemaName: "can_recognize_speech", - }, - { - Name: "CanDisableSponsoredMessages", - SchemaName: "can_disable_sponsored_messages", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBoostLevelFeatures) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostLevelFeatures#f4b51914 as nil") - } - b.PutID(ChatBoostLevelFeaturesTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBoostLevelFeatures) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostLevelFeatures#f4b51914 as nil") - } - b.PutInt32(c.Level) - b.PutInt32(c.StoryPerDayCount) - b.PutInt32(c.CustomEmojiReactionCount) - b.PutInt32(c.TitleColorCount) - b.PutInt32(c.ProfileAccentColorCount) - b.PutBool(c.CanSetProfileBackgroundCustomEmoji) - b.PutInt32(c.AccentColorCount) - b.PutBool(c.CanSetBackgroundCustomEmoji) - b.PutBool(c.CanSetEmojiStatus) - b.PutInt32(c.ChatThemeBackgroundCount) - b.PutBool(c.CanSetCustomBackground) - b.PutBool(c.CanSetCustomEmojiStickerSet) - b.PutBool(c.CanRecognizeSpeech) - b.PutBool(c.CanDisableSponsoredMessages) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBoostLevelFeatures) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostLevelFeatures#f4b51914 to nil") - } - if err := b.ConsumeID(ChatBoostLevelFeaturesTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBoostLevelFeatures) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostLevelFeatures#f4b51914 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field level: %w", err) - } - c.Level = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field story_per_day_count: %w", err) - } - c.StoryPerDayCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field custom_emoji_reaction_count: %w", err) - } - c.CustomEmojiReactionCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field title_color_count: %w", err) - } - c.TitleColorCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field profile_accent_color_count: %w", err) - } - c.ProfileAccentColorCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_set_profile_background_custom_emoji: %w", err) - } - c.CanSetProfileBackgroundCustomEmoji = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field accent_color_count: %w", err) - } - c.AccentColorCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_set_background_custom_emoji: %w", err) - } - c.CanSetBackgroundCustomEmoji = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_set_emoji_status: %w", err) - } - c.CanSetEmojiStatus = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field chat_theme_background_count: %w", err) - } - c.ChatThemeBackgroundCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_set_custom_background: %w", err) - } - c.CanSetCustomBackground = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_set_custom_emoji_sticker_set: %w", err) - } - c.CanSetCustomEmojiStickerSet = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_recognize_speech: %w", err) - } - c.CanRecognizeSpeech = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_disable_sponsored_messages: %w", err) - } - c.CanDisableSponsoredMessages = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBoostLevelFeatures) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostLevelFeatures#f4b51914 as nil") - } - b.ObjStart() - b.PutID("chatBoostLevelFeatures") - b.Comma() - b.FieldStart("level") - b.PutInt32(c.Level) - b.Comma() - b.FieldStart("story_per_day_count") - b.PutInt32(c.StoryPerDayCount) - b.Comma() - b.FieldStart("custom_emoji_reaction_count") - b.PutInt32(c.CustomEmojiReactionCount) - b.Comma() - b.FieldStart("title_color_count") - b.PutInt32(c.TitleColorCount) - b.Comma() - b.FieldStart("profile_accent_color_count") - b.PutInt32(c.ProfileAccentColorCount) - b.Comma() - b.FieldStart("can_set_profile_background_custom_emoji") - b.PutBool(c.CanSetProfileBackgroundCustomEmoji) - b.Comma() - b.FieldStart("accent_color_count") - b.PutInt32(c.AccentColorCount) - b.Comma() - b.FieldStart("can_set_background_custom_emoji") - b.PutBool(c.CanSetBackgroundCustomEmoji) - b.Comma() - b.FieldStart("can_set_emoji_status") - b.PutBool(c.CanSetEmojiStatus) - b.Comma() - b.FieldStart("chat_theme_background_count") - b.PutInt32(c.ChatThemeBackgroundCount) - b.Comma() - b.FieldStart("can_set_custom_background") - b.PutBool(c.CanSetCustomBackground) - b.Comma() - b.FieldStart("can_set_custom_emoji_sticker_set") - b.PutBool(c.CanSetCustomEmojiStickerSet) - b.Comma() - b.FieldStart("can_recognize_speech") - b.PutBool(c.CanRecognizeSpeech) - b.Comma() - b.FieldStart("can_disable_sponsored_messages") - b.PutBool(c.CanDisableSponsoredMessages) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBoostLevelFeatures) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostLevelFeatures#f4b51914 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBoostLevelFeatures"); err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: %w", err) - } - case "level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field level: %w", err) - } - c.Level = value - case "story_per_day_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field story_per_day_count: %w", err) - } - c.StoryPerDayCount = value - case "custom_emoji_reaction_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field custom_emoji_reaction_count: %w", err) - } - c.CustomEmojiReactionCount = value - case "title_color_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field title_color_count: %w", err) - } - c.TitleColorCount = value - case "profile_accent_color_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field profile_accent_color_count: %w", err) - } - c.ProfileAccentColorCount = value - case "can_set_profile_background_custom_emoji": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_set_profile_background_custom_emoji: %w", err) - } - c.CanSetProfileBackgroundCustomEmoji = value - case "accent_color_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field accent_color_count: %w", err) - } - c.AccentColorCount = value - case "can_set_background_custom_emoji": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_set_background_custom_emoji: %w", err) - } - c.CanSetBackgroundCustomEmoji = value - case "can_set_emoji_status": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_set_emoji_status: %w", err) - } - c.CanSetEmojiStatus = value - case "chat_theme_background_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field chat_theme_background_count: %w", err) - } - c.ChatThemeBackgroundCount = value - case "can_set_custom_background": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_set_custom_background: %w", err) - } - c.CanSetCustomBackground = value - case "can_set_custom_emoji_sticker_set": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_set_custom_emoji_sticker_set: %w", err) - } - c.CanSetCustomEmojiStickerSet = value - case "can_recognize_speech": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_recognize_speech: %w", err) - } - c.CanRecognizeSpeech = value - case "can_disable_sponsored_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLevelFeatures#f4b51914: field can_disable_sponsored_messages: %w", err) - } - c.CanDisableSponsoredMessages = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLevel returns value of Level field. -func (c *ChatBoostLevelFeatures) GetLevel() (value int32) { - if c == nil { - return - } - return c.Level -} - -// GetStoryPerDayCount returns value of StoryPerDayCount field. -func (c *ChatBoostLevelFeatures) GetStoryPerDayCount() (value int32) { - if c == nil { - return - } - return c.StoryPerDayCount -} - -// GetCustomEmojiReactionCount returns value of CustomEmojiReactionCount field. -func (c *ChatBoostLevelFeatures) GetCustomEmojiReactionCount() (value int32) { - if c == nil { - return - } - return c.CustomEmojiReactionCount -} - -// GetTitleColorCount returns value of TitleColorCount field. -func (c *ChatBoostLevelFeatures) GetTitleColorCount() (value int32) { - if c == nil { - return - } - return c.TitleColorCount -} - -// GetProfileAccentColorCount returns value of ProfileAccentColorCount field. -func (c *ChatBoostLevelFeatures) GetProfileAccentColorCount() (value int32) { - if c == nil { - return - } - return c.ProfileAccentColorCount -} - -// GetCanSetProfileBackgroundCustomEmoji returns value of CanSetProfileBackgroundCustomEmoji field. -func (c *ChatBoostLevelFeatures) GetCanSetProfileBackgroundCustomEmoji() (value bool) { - if c == nil { - return - } - return c.CanSetProfileBackgroundCustomEmoji -} - -// GetAccentColorCount returns value of AccentColorCount field. -func (c *ChatBoostLevelFeatures) GetAccentColorCount() (value int32) { - if c == nil { - return - } - return c.AccentColorCount -} - -// GetCanSetBackgroundCustomEmoji returns value of CanSetBackgroundCustomEmoji field. -func (c *ChatBoostLevelFeatures) GetCanSetBackgroundCustomEmoji() (value bool) { - if c == nil { - return - } - return c.CanSetBackgroundCustomEmoji -} - -// GetCanSetEmojiStatus returns value of CanSetEmojiStatus field. -func (c *ChatBoostLevelFeatures) GetCanSetEmojiStatus() (value bool) { - if c == nil { - return - } - return c.CanSetEmojiStatus -} - -// GetChatThemeBackgroundCount returns value of ChatThemeBackgroundCount field. -func (c *ChatBoostLevelFeatures) GetChatThemeBackgroundCount() (value int32) { - if c == nil { - return - } - return c.ChatThemeBackgroundCount -} - -// GetCanSetCustomBackground returns value of CanSetCustomBackground field. -func (c *ChatBoostLevelFeatures) GetCanSetCustomBackground() (value bool) { - if c == nil { - return - } - return c.CanSetCustomBackground -} - -// GetCanSetCustomEmojiStickerSet returns value of CanSetCustomEmojiStickerSet field. -func (c *ChatBoostLevelFeatures) GetCanSetCustomEmojiStickerSet() (value bool) { - if c == nil { - return - } - return c.CanSetCustomEmojiStickerSet -} - -// GetCanRecognizeSpeech returns value of CanRecognizeSpeech field. -func (c *ChatBoostLevelFeatures) GetCanRecognizeSpeech() (value bool) { - if c == nil { - return - } - return c.CanRecognizeSpeech -} - -// GetCanDisableSponsoredMessages returns value of CanDisableSponsoredMessages field. -func (c *ChatBoostLevelFeatures) GetCanDisableSponsoredMessages() (value bool) { - if c == nil { - return - } - return c.CanDisableSponsoredMessages -} diff --git a/tdapi/tl_chat_boost_link_gen.go b/tdapi/tl_chat_boost_link_gen.go deleted file mode 100644 index b0ef559f9..000000000 --- a/tdapi/tl_chat_boost_link_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatBoostLink represents TL type `chatBoostLink#b5417c71`. -type ChatBoostLink struct { - // The link - Link string - // True, if the link will work for non-members of the chat - IsPublic bool -} - -// ChatBoostLinkTypeID is TL type id of ChatBoostLink. -const ChatBoostLinkTypeID = 0xb5417c71 - -// Ensuring interfaces in compile-time for ChatBoostLink. -var ( - _ bin.Encoder = &ChatBoostLink{} - _ bin.Decoder = &ChatBoostLink{} - _ bin.BareEncoder = &ChatBoostLink{} - _ bin.BareDecoder = &ChatBoostLink{} -) - -func (c *ChatBoostLink) Zero() bool { - if c == nil { - return true - } - if !(c.Link == "") { - return false - } - if !(c.IsPublic == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBoostLink) String() string { - if c == nil { - return "ChatBoostLink(nil)" - } - type Alias ChatBoostLink - return fmt.Sprintf("ChatBoostLink%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBoostLink) TypeID() uint32 { - return ChatBoostLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBoostLink) TypeName() string { - return "chatBoostLink" -} - -// TypeInfo returns info about TL type. -func (c *ChatBoostLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBoostLink", - ID: ChatBoostLinkTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - { - Name: "IsPublic", - SchemaName: "is_public", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBoostLink) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostLink#b5417c71 as nil") - } - b.PutID(ChatBoostLinkTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBoostLink) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostLink#b5417c71 as nil") - } - b.PutString(c.Link) - b.PutBool(c.IsPublic) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBoostLink) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostLink#b5417c71 to nil") - } - if err := b.ConsumeID(ChatBoostLinkTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostLink#b5417c71: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBoostLink) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostLink#b5417c71 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLink#b5417c71: field link: %w", err) - } - c.Link = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLink#b5417c71: field is_public: %w", err) - } - c.IsPublic = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBoostLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostLink#b5417c71 as nil") - } - b.ObjStart() - b.PutID("chatBoostLink") - b.Comma() - b.FieldStart("link") - b.PutString(c.Link) - b.Comma() - b.FieldStart("is_public") - b.PutBool(c.IsPublic) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBoostLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostLink#b5417c71 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBoostLink"); err != nil { - return fmt.Errorf("unable to decode chatBoostLink#b5417c71: %w", err) - } - case "link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLink#b5417c71: field link: %w", err) - } - c.Link = value - case "is_public": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLink#b5417c71: field is_public: %w", err) - } - c.IsPublic = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (c *ChatBoostLink) GetLink() (value string) { - if c == nil { - return - } - return c.Link -} - -// GetIsPublic returns value of IsPublic field. -func (c *ChatBoostLink) GetIsPublic() (value bool) { - if c == nil { - return - } - return c.IsPublic -} diff --git a/tdapi/tl_chat_boost_link_info_gen.go b/tdapi/tl_chat_boost_link_info_gen.go deleted file mode 100644 index 57259b8ba..000000000 --- a/tdapi/tl_chat_boost_link_info_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatBoostLinkInfo represents TL type `chatBoostLinkInfo#dc123884`. -type ChatBoostLinkInfo struct { - // True, if the link will work for non-members of the chat - IsPublic bool - // Identifier of the chat to which the link points; 0 if the chat isn't found - ChatID int64 -} - -// ChatBoostLinkInfoTypeID is TL type id of ChatBoostLinkInfo. -const ChatBoostLinkInfoTypeID = 0xdc123884 - -// Ensuring interfaces in compile-time for ChatBoostLinkInfo. -var ( - _ bin.Encoder = &ChatBoostLinkInfo{} - _ bin.Decoder = &ChatBoostLinkInfo{} - _ bin.BareEncoder = &ChatBoostLinkInfo{} - _ bin.BareDecoder = &ChatBoostLinkInfo{} -) - -func (c *ChatBoostLinkInfo) Zero() bool { - if c == nil { - return true - } - if !(c.IsPublic == false) { - return false - } - if !(c.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBoostLinkInfo) String() string { - if c == nil { - return "ChatBoostLinkInfo(nil)" - } - type Alias ChatBoostLinkInfo - return fmt.Sprintf("ChatBoostLinkInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBoostLinkInfo) TypeID() uint32 { - return ChatBoostLinkInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBoostLinkInfo) TypeName() string { - return "chatBoostLinkInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatBoostLinkInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBoostLinkInfo", - ID: ChatBoostLinkInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsPublic", - SchemaName: "is_public", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBoostLinkInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostLinkInfo#dc123884 as nil") - } - b.PutID(ChatBoostLinkInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBoostLinkInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostLinkInfo#dc123884 as nil") - } - b.PutBool(c.IsPublic) - b.PutInt53(c.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBoostLinkInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostLinkInfo#dc123884 to nil") - } - if err := b.ConsumeID(ChatBoostLinkInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBoostLinkInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostLinkInfo#dc123884 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: field is_public: %w", err) - } - c.IsPublic = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: field chat_id: %w", err) - } - c.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBoostLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostLinkInfo#dc123884 as nil") - } - b.ObjStart() - b.PutID("chatBoostLinkInfo") - b.Comma() - b.FieldStart("is_public") - b.PutBool(c.IsPublic) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBoostLinkInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostLinkInfo#dc123884 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBoostLinkInfo"); err != nil { - return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: %w", err) - } - case "is_public": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: field is_public: %w", err) - } - c.IsPublic = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostLinkInfo#dc123884: field chat_id: %w", err) - } - c.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsPublic returns value of IsPublic field. -func (c *ChatBoostLinkInfo) GetIsPublic() (value bool) { - if c == nil { - return - } - return c.IsPublic -} - -// GetChatID returns value of ChatID field. -func (c *ChatBoostLinkInfo) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} diff --git a/tdapi/tl_chat_boost_slot_gen.go b/tdapi/tl_chat_boost_slot_gen.go deleted file mode 100644 index 67a2b2c50..000000000 --- a/tdapi/tl_chat_boost_slot_gen.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatBoostSlot represents TL type `chatBoostSlot#757fac7`. -type ChatBoostSlot struct { - // Unique identifier of the slot - SlotID int32 - // Identifier of the currently boosted chat; 0 if none - CurrentlyBoostedChatID int64 - // Point in time (Unix timestamp) when the chat was boosted; 0 if none - StartDate int32 - // Point in time (Unix timestamp) when the boost will expire - ExpirationDate int32 - // Point in time (Unix timestamp) after which the boost can be used for another chat - CooldownUntilDate int32 -} - -// ChatBoostSlotTypeID is TL type id of ChatBoostSlot. -const ChatBoostSlotTypeID = 0x757fac7 - -// Ensuring interfaces in compile-time for ChatBoostSlot. -var ( - _ bin.Encoder = &ChatBoostSlot{} - _ bin.Decoder = &ChatBoostSlot{} - _ bin.BareEncoder = &ChatBoostSlot{} - _ bin.BareDecoder = &ChatBoostSlot{} -) - -func (c *ChatBoostSlot) Zero() bool { - if c == nil { - return true - } - if !(c.SlotID == 0) { - return false - } - if !(c.CurrentlyBoostedChatID == 0) { - return false - } - if !(c.StartDate == 0) { - return false - } - if !(c.ExpirationDate == 0) { - return false - } - if !(c.CooldownUntilDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBoostSlot) String() string { - if c == nil { - return "ChatBoostSlot(nil)" - } - type Alias ChatBoostSlot - return fmt.Sprintf("ChatBoostSlot%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBoostSlot) TypeID() uint32 { - return ChatBoostSlotTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBoostSlot) TypeName() string { - return "chatBoostSlot" -} - -// TypeInfo returns info about TL type. -func (c *ChatBoostSlot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBoostSlot", - ID: ChatBoostSlotTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SlotID", - SchemaName: "slot_id", - }, - { - Name: "CurrentlyBoostedChatID", - SchemaName: "currently_boosted_chat_id", - }, - { - Name: "StartDate", - SchemaName: "start_date", - }, - { - Name: "ExpirationDate", - SchemaName: "expiration_date", - }, - { - Name: "CooldownUntilDate", - SchemaName: "cooldown_until_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBoostSlot) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSlot#757fac7 as nil") - } - b.PutID(ChatBoostSlotTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBoostSlot) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSlot#757fac7 as nil") - } - b.PutInt32(c.SlotID) - b.PutInt53(c.CurrentlyBoostedChatID) - b.PutInt32(c.StartDate) - b.PutInt32(c.ExpirationDate) - b.PutInt32(c.CooldownUntilDate) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBoostSlot) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSlot#757fac7 to nil") - } - if err := b.ConsumeID(ChatBoostSlotTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBoostSlot) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSlot#757fac7 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: field slot_id: %w", err) - } - c.SlotID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: field currently_boosted_chat_id: %w", err) - } - c.CurrentlyBoostedChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: field start_date: %w", err) - } - c.StartDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: field expiration_date: %w", err) - } - c.ExpirationDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: field cooldown_until_date: %w", err) - } - c.CooldownUntilDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBoostSlot) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSlot#757fac7 as nil") - } - b.ObjStart() - b.PutID("chatBoostSlot") - b.Comma() - b.FieldStart("slot_id") - b.PutInt32(c.SlotID) - b.Comma() - b.FieldStart("currently_boosted_chat_id") - b.PutInt53(c.CurrentlyBoostedChatID) - b.Comma() - b.FieldStart("start_date") - b.PutInt32(c.StartDate) - b.Comma() - b.FieldStart("expiration_date") - b.PutInt32(c.ExpirationDate) - b.Comma() - b.FieldStart("cooldown_until_date") - b.PutInt32(c.CooldownUntilDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBoostSlot) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSlot#757fac7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBoostSlot"); err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: %w", err) - } - case "slot_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: field slot_id: %w", err) - } - c.SlotID = value - case "currently_boosted_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: field currently_boosted_chat_id: %w", err) - } - c.CurrentlyBoostedChatID = value - case "start_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: field start_date: %w", err) - } - c.StartDate = value - case "expiration_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: field expiration_date: %w", err) - } - c.ExpirationDate = value - case "cooldown_until_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSlot#757fac7: field cooldown_until_date: %w", err) - } - c.CooldownUntilDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSlotID returns value of SlotID field. -func (c *ChatBoostSlot) GetSlotID() (value int32) { - if c == nil { - return - } - return c.SlotID -} - -// GetCurrentlyBoostedChatID returns value of CurrentlyBoostedChatID field. -func (c *ChatBoostSlot) GetCurrentlyBoostedChatID() (value int64) { - if c == nil { - return - } - return c.CurrentlyBoostedChatID -} - -// GetStartDate returns value of StartDate field. -func (c *ChatBoostSlot) GetStartDate() (value int32) { - if c == nil { - return - } - return c.StartDate -} - -// GetExpirationDate returns value of ExpirationDate field. -func (c *ChatBoostSlot) GetExpirationDate() (value int32) { - if c == nil { - return - } - return c.ExpirationDate -} - -// GetCooldownUntilDate returns value of CooldownUntilDate field. -func (c *ChatBoostSlot) GetCooldownUntilDate() (value int32) { - if c == nil { - return - } - return c.CooldownUntilDate -} diff --git a/tdapi/tl_chat_boost_slots_gen.go b/tdapi/tl_chat_boost_slots_gen.go deleted file mode 100644 index 295160308..000000000 --- a/tdapi/tl_chat_boost_slots_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatBoostSlots represents TL type `chatBoostSlots#6859c79`. -type ChatBoostSlots struct { - // List of boost slots - Slots []ChatBoostSlot -} - -// ChatBoostSlotsTypeID is TL type id of ChatBoostSlots. -const ChatBoostSlotsTypeID = 0x6859c79 - -// Ensuring interfaces in compile-time for ChatBoostSlots. -var ( - _ bin.Encoder = &ChatBoostSlots{} - _ bin.Decoder = &ChatBoostSlots{} - _ bin.BareEncoder = &ChatBoostSlots{} - _ bin.BareDecoder = &ChatBoostSlots{} -) - -func (c *ChatBoostSlots) Zero() bool { - if c == nil { - return true - } - if !(c.Slots == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBoostSlots) String() string { - if c == nil { - return "ChatBoostSlots(nil)" - } - type Alias ChatBoostSlots - return fmt.Sprintf("ChatBoostSlots%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBoostSlots) TypeID() uint32 { - return ChatBoostSlotsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBoostSlots) TypeName() string { - return "chatBoostSlots" -} - -// TypeInfo returns info about TL type. -func (c *ChatBoostSlots) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBoostSlots", - ID: ChatBoostSlotsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Slots", - SchemaName: "slots", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBoostSlots) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSlots#6859c79 as nil") - } - b.PutID(ChatBoostSlotsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBoostSlots) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSlots#6859c79 as nil") - } - b.PutInt(len(c.Slots)) - for idx, v := range c.Slots { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatBoostSlots#6859c79: field slots element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBoostSlots) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSlots#6859c79 to nil") - } - if err := b.ConsumeID(ChatBoostSlotsTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostSlots#6859c79: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBoostSlots) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSlots#6859c79 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSlots#6859c79: field slots: %w", err) - } - - if headerLen > 0 { - c.Slots = make([]ChatBoostSlot, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatBoostSlot - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatBoostSlots#6859c79: field slots: %w", err) - } - c.Slots = append(c.Slots, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBoostSlots) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSlots#6859c79 as nil") - } - b.ObjStart() - b.PutID("chatBoostSlots") - b.Comma() - b.FieldStart("slots") - b.ArrStart() - for idx, v := range c.Slots { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatBoostSlots#6859c79: field slots element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBoostSlots) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSlots#6859c79 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBoostSlots"); err != nil { - return fmt.Errorf("unable to decode chatBoostSlots#6859c79: %w", err) - } - case "slots": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatBoostSlot - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatBoostSlots#6859c79: field slots: %w", err) - } - c.Slots = append(c.Slots, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatBoostSlots#6859c79: field slots: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSlots returns value of Slots field. -func (c *ChatBoostSlots) GetSlots() (value []ChatBoostSlot) { - if c == nil { - return - } - return c.Slots -} diff --git a/tdapi/tl_chat_boost_source_gen.go b/tdapi/tl_chat_boost_source_gen.go deleted file mode 100644 index f217962b6..000000000 --- a/tdapi/tl_chat_boost_source_gen.go +++ /dev/null @@ -1,859 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatBoostSourceGiftCode represents TL type `chatBoostSourceGiftCode#fa2412ba`. -type ChatBoostSourceGiftCode struct { - // Identifier of a user, for which the gift code was created - UserID int64 - // The created Telegram Premium gift code, which is known only if this is a gift code for - // the current user, or it has already been claimed - GiftCode string -} - -// ChatBoostSourceGiftCodeTypeID is TL type id of ChatBoostSourceGiftCode. -const ChatBoostSourceGiftCodeTypeID = 0xfa2412ba - -// construct implements constructor of ChatBoostSourceClass. -func (c ChatBoostSourceGiftCode) construct() ChatBoostSourceClass { return &c } - -// Ensuring interfaces in compile-time for ChatBoostSourceGiftCode. -var ( - _ bin.Encoder = &ChatBoostSourceGiftCode{} - _ bin.Decoder = &ChatBoostSourceGiftCode{} - _ bin.BareEncoder = &ChatBoostSourceGiftCode{} - _ bin.BareDecoder = &ChatBoostSourceGiftCode{} - - _ ChatBoostSourceClass = &ChatBoostSourceGiftCode{} -) - -func (c *ChatBoostSourceGiftCode) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.GiftCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBoostSourceGiftCode) String() string { - if c == nil { - return "ChatBoostSourceGiftCode(nil)" - } - type Alias ChatBoostSourceGiftCode - return fmt.Sprintf("ChatBoostSourceGiftCode%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBoostSourceGiftCode) TypeID() uint32 { - return ChatBoostSourceGiftCodeTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBoostSourceGiftCode) TypeName() string { - return "chatBoostSourceGiftCode" -} - -// TypeInfo returns info about TL type. -func (c *ChatBoostSourceGiftCode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBoostSourceGiftCode", - ID: ChatBoostSourceGiftCodeTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "GiftCode", - SchemaName: "gift_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBoostSourceGiftCode) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSourceGiftCode#fa2412ba as nil") - } - b.PutID(ChatBoostSourceGiftCodeTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBoostSourceGiftCode) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSourceGiftCode#fa2412ba as nil") - } - b.PutInt53(c.UserID) - b.PutString(c.GiftCode) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBoostSourceGiftCode) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSourceGiftCode#fa2412ba to nil") - } - if err := b.ConsumeID(ChatBoostSourceGiftCodeTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiftCode#fa2412ba: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBoostSourceGiftCode) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSourceGiftCode#fa2412ba to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiftCode#fa2412ba: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiftCode#fa2412ba: field gift_code: %w", err) - } - c.GiftCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBoostSourceGiftCode) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSourceGiftCode#fa2412ba as nil") - } - b.ObjStart() - b.PutID("chatBoostSourceGiftCode") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("gift_code") - b.PutString(c.GiftCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBoostSourceGiftCode) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSourceGiftCode#fa2412ba to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBoostSourceGiftCode"); err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiftCode#fa2412ba: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiftCode#fa2412ba: field user_id: %w", err) - } - c.UserID = value - case "gift_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiftCode#fa2412ba: field gift_code: %w", err) - } - c.GiftCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatBoostSourceGiftCode) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetGiftCode returns value of GiftCode field. -func (c *ChatBoostSourceGiftCode) GetGiftCode() (value string) { - if c == nil { - return - } - return c.GiftCode -} - -// ChatBoostSourceGiveaway represents TL type `chatBoostSourceGiveaway#7254949a`. -type ChatBoostSourceGiveaway struct { - // Identifier of a user that won in the giveaway; 0 if none - UserID int64 - // The created Telegram Premium gift code if it was used by the user or can be claimed by - // the current user; an empty string otherwise; for Telegram Premium giveways only - GiftCode string - // Number of Telegram Stars distributed among winners of the giveaway - StarCount int64 - // Identifier of the corresponding giveaway message; can be an identifier of a deleted - // message - GiveawayMessageID int64 - // True, if the winner for the corresponding giveaway prize wasn't chosen, because there - // were not enough participants - IsUnclaimed bool -} - -// ChatBoostSourceGiveawayTypeID is TL type id of ChatBoostSourceGiveaway. -const ChatBoostSourceGiveawayTypeID = 0x7254949a - -// construct implements constructor of ChatBoostSourceClass. -func (c ChatBoostSourceGiveaway) construct() ChatBoostSourceClass { return &c } - -// Ensuring interfaces in compile-time for ChatBoostSourceGiveaway. -var ( - _ bin.Encoder = &ChatBoostSourceGiveaway{} - _ bin.Decoder = &ChatBoostSourceGiveaway{} - _ bin.BareEncoder = &ChatBoostSourceGiveaway{} - _ bin.BareDecoder = &ChatBoostSourceGiveaway{} - - _ ChatBoostSourceClass = &ChatBoostSourceGiveaway{} -) - -func (c *ChatBoostSourceGiveaway) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.GiftCode == "") { - return false - } - if !(c.StarCount == 0) { - return false - } - if !(c.GiveawayMessageID == 0) { - return false - } - if !(c.IsUnclaimed == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBoostSourceGiveaway) String() string { - if c == nil { - return "ChatBoostSourceGiveaway(nil)" - } - type Alias ChatBoostSourceGiveaway - return fmt.Sprintf("ChatBoostSourceGiveaway%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBoostSourceGiveaway) TypeID() uint32 { - return ChatBoostSourceGiveawayTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBoostSourceGiveaway) TypeName() string { - return "chatBoostSourceGiveaway" -} - -// TypeInfo returns info about TL type. -func (c *ChatBoostSourceGiveaway) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBoostSourceGiveaway", - ID: ChatBoostSourceGiveawayTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "GiftCode", - SchemaName: "gift_code", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "GiveawayMessageID", - SchemaName: "giveaway_message_id", - }, - { - Name: "IsUnclaimed", - SchemaName: "is_unclaimed", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBoostSourceGiveaway) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSourceGiveaway#7254949a as nil") - } - b.PutID(ChatBoostSourceGiveawayTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBoostSourceGiveaway) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSourceGiveaway#7254949a as nil") - } - b.PutInt53(c.UserID) - b.PutString(c.GiftCode) - b.PutInt53(c.StarCount) - b.PutInt53(c.GiveawayMessageID) - b.PutBool(c.IsUnclaimed) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBoostSourceGiveaway) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSourceGiveaway#7254949a to nil") - } - if err := b.ConsumeID(ChatBoostSourceGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBoostSourceGiveaway) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSourceGiveaway#7254949a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field gift_code: %w", err) - } - c.GiftCode = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field star_count: %w", err) - } - c.StarCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field giveaway_message_id: %w", err) - } - c.GiveawayMessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field is_unclaimed: %w", err) - } - c.IsUnclaimed = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBoostSourceGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSourceGiveaway#7254949a as nil") - } - b.ObjStart() - b.PutID("chatBoostSourceGiveaway") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("gift_code") - b.PutString(c.GiftCode) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(c.StarCount) - b.Comma() - b.FieldStart("giveaway_message_id") - b.PutInt53(c.GiveawayMessageID) - b.Comma() - b.FieldStart("is_unclaimed") - b.PutBool(c.IsUnclaimed) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBoostSourceGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSourceGiveaway#7254949a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBoostSourceGiveaway"); err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field user_id: %w", err) - } - c.UserID = value - case "gift_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field gift_code: %w", err) - } - c.GiftCode = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field star_count: %w", err) - } - c.StarCount = value - case "giveaway_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field giveaway_message_id: %w", err) - } - c.GiveawayMessageID = value - case "is_unclaimed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourceGiveaway#7254949a: field is_unclaimed: %w", err) - } - c.IsUnclaimed = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatBoostSourceGiveaway) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetGiftCode returns value of GiftCode field. -func (c *ChatBoostSourceGiveaway) GetGiftCode() (value string) { - if c == nil { - return - } - return c.GiftCode -} - -// GetStarCount returns value of StarCount field. -func (c *ChatBoostSourceGiveaway) GetStarCount() (value int64) { - if c == nil { - return - } - return c.StarCount -} - -// GetGiveawayMessageID returns value of GiveawayMessageID field. -func (c *ChatBoostSourceGiveaway) GetGiveawayMessageID() (value int64) { - if c == nil { - return - } - return c.GiveawayMessageID -} - -// GetIsUnclaimed returns value of IsUnclaimed field. -func (c *ChatBoostSourceGiveaway) GetIsUnclaimed() (value bool) { - if c == nil { - return - } - return c.IsUnclaimed -} - -// ChatBoostSourcePremium represents TL type `chatBoostSourcePremium#ed4eb`. -type ChatBoostSourcePremium struct { - // Identifier of the user - UserID int64 -} - -// ChatBoostSourcePremiumTypeID is TL type id of ChatBoostSourcePremium. -const ChatBoostSourcePremiumTypeID = 0xed4eb - -// construct implements constructor of ChatBoostSourceClass. -func (c ChatBoostSourcePremium) construct() ChatBoostSourceClass { return &c } - -// Ensuring interfaces in compile-time for ChatBoostSourcePremium. -var ( - _ bin.Encoder = &ChatBoostSourcePremium{} - _ bin.Decoder = &ChatBoostSourcePremium{} - _ bin.BareEncoder = &ChatBoostSourcePremium{} - _ bin.BareDecoder = &ChatBoostSourcePremium{} - - _ ChatBoostSourceClass = &ChatBoostSourcePremium{} -) - -func (c *ChatBoostSourcePremium) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBoostSourcePremium) String() string { - if c == nil { - return "ChatBoostSourcePremium(nil)" - } - type Alias ChatBoostSourcePremium - return fmt.Sprintf("ChatBoostSourcePremium%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBoostSourcePremium) TypeID() uint32 { - return ChatBoostSourcePremiumTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBoostSourcePremium) TypeName() string { - return "chatBoostSourcePremium" -} - -// TypeInfo returns info about TL type. -func (c *ChatBoostSourcePremium) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBoostSourcePremium", - ID: ChatBoostSourcePremiumTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBoostSourcePremium) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSourcePremium#ed4eb as nil") - } - b.PutID(ChatBoostSourcePremiumTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBoostSourcePremium) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSourcePremium#ed4eb as nil") - } - b.PutInt53(c.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBoostSourcePremium) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSourcePremium#ed4eb to nil") - } - if err := b.ConsumeID(ChatBoostSourcePremiumTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostSourcePremium#ed4eb: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBoostSourcePremium) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSourcePremium#ed4eb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourcePremium#ed4eb: field user_id: %w", err) - } - c.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBoostSourcePremium) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostSourcePremium#ed4eb as nil") - } - b.ObjStart() - b.PutID("chatBoostSourcePremium") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBoostSourcePremium) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostSourcePremium#ed4eb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBoostSourcePremium"); err != nil { - return fmt.Errorf("unable to decode chatBoostSourcePremium#ed4eb: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatBoostSourcePremium#ed4eb: field user_id: %w", err) - } - c.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatBoostSourcePremium) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// ChatBoostSourceClassName is schema name of ChatBoostSourceClass. -const ChatBoostSourceClassName = "ChatBoostSource" - -// ChatBoostSourceClass represents ChatBoostSource generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatBoostSource(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatBoostSourceGiftCode: // chatBoostSourceGiftCode#fa2412ba -// case *tdapi.ChatBoostSourceGiveaway: // chatBoostSourceGiveaway#7254949a -// case *tdapi.ChatBoostSourcePremium: // chatBoostSourcePremium#ed4eb -// default: panic(v) -// } -type ChatBoostSourceClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatBoostSourceClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error - - // Identifier of a user, for which the gift code was created - GetUserID() (value int64) -} - -// DecodeChatBoostSource implements binary de-serialization for ChatBoostSourceClass. -func DecodeChatBoostSource(buf *bin.Buffer) (ChatBoostSourceClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatBoostSourceGiftCodeTypeID: - // Decoding chatBoostSourceGiftCode#fa2412ba. - v := ChatBoostSourceGiftCode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatBoostSourceClass: %w", err) - } - return &v, nil - case ChatBoostSourceGiveawayTypeID: - // Decoding chatBoostSourceGiveaway#7254949a. - v := ChatBoostSourceGiveaway{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatBoostSourceClass: %w", err) - } - return &v, nil - case ChatBoostSourcePremiumTypeID: - // Decoding chatBoostSourcePremium#ed4eb. - v := ChatBoostSourcePremium{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatBoostSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatBoostSourceClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatBoostSource implements binary de-serialization for ChatBoostSourceClass. -func DecodeTDLibJSONChatBoostSource(buf tdjson.Decoder) (ChatBoostSourceClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatBoostSourceGiftCode": - // Decoding chatBoostSourceGiftCode#fa2412ba. - v := ChatBoostSourceGiftCode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatBoostSourceClass: %w", err) - } - return &v, nil - case "chatBoostSourceGiveaway": - // Decoding chatBoostSourceGiveaway#7254949a. - v := ChatBoostSourceGiveaway{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatBoostSourceClass: %w", err) - } - return &v, nil - case "chatBoostSourcePremium": - // Decoding chatBoostSourcePremium#ed4eb. - v := ChatBoostSourcePremium{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatBoostSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatBoostSourceClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatBoostSource boxes the ChatBoostSourceClass providing a helper. -type ChatBoostSourceBox struct { - ChatBoostSource ChatBoostSourceClass -} - -// Decode implements bin.Decoder for ChatBoostSourceBox. -func (b *ChatBoostSourceBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatBoostSourceBox to nil") - } - v, err := DecodeChatBoostSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatBoostSource = v - return nil -} - -// Encode implements bin.Encode for ChatBoostSourceBox. -func (b *ChatBoostSourceBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatBoostSource == nil { - return fmt.Errorf("unable to encode ChatBoostSourceClass as nil") - } - return b.ChatBoostSource.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatBoostSourceBox. -func (b *ChatBoostSourceBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatBoostSourceBox to nil") - } - v, err := DecodeTDLibJSONChatBoostSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatBoostSource = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatBoostSourceBox. -func (b *ChatBoostSourceBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatBoostSource == nil { - return fmt.Errorf("unable to encode ChatBoostSourceClass as nil") - } - return b.ChatBoostSource.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_boost_status_gen.go b/tdapi/tl_chat_boost_status_gen.go deleted file mode 100644 index cd3cc703b..000000000 --- a/tdapi/tl_chat_boost_status_gen.go +++ /dev/null @@ -1,555 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatBoostStatus represents TL type `chatBoostStatus#401e753c`. -type ChatBoostStatus struct { - // An HTTP URL, which can be used to boost the chat - BoostURL string - // Identifiers of boost slots of the current user applied to the chat - AppliedSlotIDs []int32 - // Current boost level of the chat - Level int32 - // The number of boosts received by the chat from created Telegram Premium gift codes and - // giveaways; always 0 if the current user isn't an administrator in the chat - GiftCodeBoostCount int32 - // The number of boosts received by the chat - BoostCount int32 - // The number of boosts added to reach the current level - CurrentLevelBoostCount int32 - // The number of boosts needed to reach the next level; 0 if the next level isn't - // available - NextLevelBoostCount int32 - // Approximate number of Telegram Premium subscribers joined the chat; always 0 if the - // current user isn't an administrator in the chat - PremiumMemberCount int32 - // A percentage of Telegram Premium subscribers joined the chat; always 0 if the current - // user isn't an administrator in the chat - PremiumMemberPercentage float64 - // The list of prepaid giveaways available for the chat; only for chat administrators - PrepaidGiveaways []PrepaidGiveaway -} - -// ChatBoostStatusTypeID is TL type id of ChatBoostStatus. -const ChatBoostStatusTypeID = 0x401e753c - -// Ensuring interfaces in compile-time for ChatBoostStatus. -var ( - _ bin.Encoder = &ChatBoostStatus{} - _ bin.Decoder = &ChatBoostStatus{} - _ bin.BareEncoder = &ChatBoostStatus{} - _ bin.BareDecoder = &ChatBoostStatus{} -) - -func (c *ChatBoostStatus) Zero() bool { - if c == nil { - return true - } - if !(c.BoostURL == "") { - return false - } - if !(c.AppliedSlotIDs == nil) { - return false - } - if !(c.Level == 0) { - return false - } - if !(c.GiftCodeBoostCount == 0) { - return false - } - if !(c.BoostCount == 0) { - return false - } - if !(c.CurrentLevelBoostCount == 0) { - return false - } - if !(c.NextLevelBoostCount == 0) { - return false - } - if !(c.PremiumMemberCount == 0) { - return false - } - if !(c.PremiumMemberPercentage == 0) { - return false - } - if !(c.PrepaidGiveaways == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatBoostStatus) String() string { - if c == nil { - return "ChatBoostStatus(nil)" - } - type Alias ChatBoostStatus - return fmt.Sprintf("ChatBoostStatus%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatBoostStatus) TypeID() uint32 { - return ChatBoostStatusTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatBoostStatus) TypeName() string { - return "chatBoostStatus" -} - -// TypeInfo returns info about TL type. -func (c *ChatBoostStatus) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatBoostStatus", - ID: ChatBoostStatusTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BoostURL", - SchemaName: "boost_url", - }, - { - Name: "AppliedSlotIDs", - SchemaName: "applied_slot_ids", - }, - { - Name: "Level", - SchemaName: "level", - }, - { - Name: "GiftCodeBoostCount", - SchemaName: "gift_code_boost_count", - }, - { - Name: "BoostCount", - SchemaName: "boost_count", - }, - { - Name: "CurrentLevelBoostCount", - SchemaName: "current_level_boost_count", - }, - { - Name: "NextLevelBoostCount", - SchemaName: "next_level_boost_count", - }, - { - Name: "PremiumMemberCount", - SchemaName: "premium_member_count", - }, - { - Name: "PremiumMemberPercentage", - SchemaName: "premium_member_percentage", - }, - { - Name: "PrepaidGiveaways", - SchemaName: "prepaid_giveaways", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatBoostStatus) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostStatus#401e753c as nil") - } - b.PutID(ChatBoostStatusTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatBoostStatus) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostStatus#401e753c as nil") - } - b.PutString(c.BoostURL) - b.PutInt(len(c.AppliedSlotIDs)) - for _, v := range c.AppliedSlotIDs { - b.PutInt32(v) - } - b.PutInt32(c.Level) - b.PutInt32(c.GiftCodeBoostCount) - b.PutInt32(c.BoostCount) - b.PutInt32(c.CurrentLevelBoostCount) - b.PutInt32(c.NextLevelBoostCount) - b.PutInt32(c.PremiumMemberCount) - b.PutDouble(c.PremiumMemberPercentage) - b.PutInt(len(c.PrepaidGiveaways)) - for idx, v := range c.PrepaidGiveaways { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatBoostStatus#401e753c: field prepaid_giveaways element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatBoostStatus) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostStatus#401e753c to nil") - } - if err := b.ConsumeID(ChatBoostStatusTypeID); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatBoostStatus) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostStatus#401e753c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field boost_url: %w", err) - } - c.BoostURL = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field applied_slot_ids: %w", err) - } - - if headerLen > 0 { - c.AppliedSlotIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field applied_slot_ids: %w", err) - } - c.AppliedSlotIDs = append(c.AppliedSlotIDs, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field level: %w", err) - } - c.Level = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field gift_code_boost_count: %w", err) - } - c.GiftCodeBoostCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field boost_count: %w", err) - } - c.BoostCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field current_level_boost_count: %w", err) - } - c.CurrentLevelBoostCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field next_level_boost_count: %w", err) - } - c.NextLevelBoostCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field premium_member_count: %w", err) - } - c.PremiumMemberCount = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field premium_member_percentage: %w", err) - } - c.PremiumMemberPercentage = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field prepaid_giveaways: %w", err) - } - - if headerLen > 0 { - c.PrepaidGiveaways = make([]PrepaidGiveaway, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PrepaidGiveaway - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatBoostStatus#401e753c: field prepaid_giveaways: %w", err) - } - c.PrepaidGiveaways = append(c.PrepaidGiveaways, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatBoostStatus) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatBoostStatus#401e753c as nil") - } - b.ObjStart() - b.PutID("chatBoostStatus") - b.Comma() - b.FieldStart("boost_url") - b.PutString(c.BoostURL) - b.Comma() - b.FieldStart("applied_slot_ids") - b.ArrStart() - for _, v := range c.AppliedSlotIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("level") - b.PutInt32(c.Level) - b.Comma() - b.FieldStart("gift_code_boost_count") - b.PutInt32(c.GiftCodeBoostCount) - b.Comma() - b.FieldStart("boost_count") - b.PutInt32(c.BoostCount) - b.Comma() - b.FieldStart("current_level_boost_count") - b.PutInt32(c.CurrentLevelBoostCount) - b.Comma() - b.FieldStart("next_level_boost_count") - b.PutInt32(c.NextLevelBoostCount) - b.Comma() - b.FieldStart("premium_member_count") - b.PutInt32(c.PremiumMemberCount) - b.Comma() - b.FieldStart("premium_member_percentage") - b.PutDouble(c.PremiumMemberPercentage) - b.Comma() - b.FieldStart("prepaid_giveaways") - b.ArrStart() - for idx, v := range c.PrepaidGiveaways { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatBoostStatus#401e753c: field prepaid_giveaways element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatBoostStatus) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatBoostStatus#401e753c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatBoostStatus"); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: %w", err) - } - case "boost_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field boost_url: %w", err) - } - c.BoostURL = value - case "applied_slot_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field applied_slot_ids: %w", err) - } - c.AppliedSlotIDs = append(c.AppliedSlotIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field applied_slot_ids: %w", err) - } - case "level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field level: %w", err) - } - c.Level = value - case "gift_code_boost_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field gift_code_boost_count: %w", err) - } - c.GiftCodeBoostCount = value - case "boost_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field boost_count: %w", err) - } - c.BoostCount = value - case "current_level_boost_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field current_level_boost_count: %w", err) - } - c.CurrentLevelBoostCount = value - case "next_level_boost_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field next_level_boost_count: %w", err) - } - c.NextLevelBoostCount = value - case "premium_member_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field premium_member_count: %w", err) - } - c.PremiumMemberCount = value - case "premium_member_percentage": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field premium_member_percentage: %w", err) - } - c.PremiumMemberPercentage = value - case "prepaid_giveaways": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PrepaidGiveaway - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field prepaid_giveaways: %w", err) - } - c.PrepaidGiveaways = append(c.PrepaidGiveaways, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatBoostStatus#401e753c: field prepaid_giveaways: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBoostURL returns value of BoostURL field. -func (c *ChatBoostStatus) GetBoostURL() (value string) { - if c == nil { - return - } - return c.BoostURL -} - -// GetAppliedSlotIDs returns value of AppliedSlotIDs field. -func (c *ChatBoostStatus) GetAppliedSlotIDs() (value []int32) { - if c == nil { - return - } - return c.AppliedSlotIDs -} - -// GetLevel returns value of Level field. -func (c *ChatBoostStatus) GetLevel() (value int32) { - if c == nil { - return - } - return c.Level -} - -// GetGiftCodeBoostCount returns value of GiftCodeBoostCount field. -func (c *ChatBoostStatus) GetGiftCodeBoostCount() (value int32) { - if c == nil { - return - } - return c.GiftCodeBoostCount -} - -// GetBoostCount returns value of BoostCount field. -func (c *ChatBoostStatus) GetBoostCount() (value int32) { - if c == nil { - return - } - return c.BoostCount -} - -// GetCurrentLevelBoostCount returns value of CurrentLevelBoostCount field. -func (c *ChatBoostStatus) GetCurrentLevelBoostCount() (value int32) { - if c == nil { - return - } - return c.CurrentLevelBoostCount -} - -// GetNextLevelBoostCount returns value of NextLevelBoostCount field. -func (c *ChatBoostStatus) GetNextLevelBoostCount() (value int32) { - if c == nil { - return - } - return c.NextLevelBoostCount -} - -// GetPremiumMemberCount returns value of PremiumMemberCount field. -func (c *ChatBoostStatus) GetPremiumMemberCount() (value int32) { - if c == nil { - return - } - return c.PremiumMemberCount -} - -// GetPremiumMemberPercentage returns value of PremiumMemberPercentage field. -func (c *ChatBoostStatus) GetPremiumMemberPercentage() (value float64) { - if c == nil { - return - } - return c.PremiumMemberPercentage -} - -// GetPrepaidGiveaways returns value of PrepaidGiveaways field. -func (c *ChatBoostStatus) GetPrepaidGiveaways() (value []PrepaidGiveaway) { - if c == nil { - return - } - return c.PrepaidGiveaways -} diff --git a/tdapi/tl_chat_event_action_gen.go b/tdapi/tl_chat_event_action_gen.go deleted file mode 100644 index 06f5bbca2..000000000 --- a/tdapi/tl_chat_event_action_gen.go +++ /dev/null @@ -1,10729 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatEventMessageEdited represents TL type `chatEventMessageEdited#e64ff5f8`. -type ChatEventMessageEdited struct { - // The original message before the edit - OldMessage Message - // The message after it was edited - NewMessage Message -} - -// ChatEventMessageEditedTypeID is TL type id of ChatEventMessageEdited. -const ChatEventMessageEditedTypeID = 0xe64ff5f8 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMessageEdited) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMessageEdited. -var ( - _ bin.Encoder = &ChatEventMessageEdited{} - _ bin.Decoder = &ChatEventMessageEdited{} - _ bin.BareEncoder = &ChatEventMessageEdited{} - _ bin.BareDecoder = &ChatEventMessageEdited{} - - _ ChatEventActionClass = &ChatEventMessageEdited{} -) - -func (c *ChatEventMessageEdited) Zero() bool { - if c == nil { - return true - } - if !(c.OldMessage.Zero()) { - return false - } - if !(c.NewMessage.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMessageEdited) String() string { - if c == nil { - return "ChatEventMessageEdited(nil)" - } - type Alias ChatEventMessageEdited - return fmt.Sprintf("ChatEventMessageEdited%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMessageEdited) TypeID() uint32 { - return ChatEventMessageEditedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMessageEdited) TypeName() string { - return "chatEventMessageEdited" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMessageEdited) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMessageEdited", - ID: ChatEventMessageEditedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldMessage", - SchemaName: "old_message", - }, - { - Name: "NewMessage", - SchemaName: "new_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMessageEdited) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageEdited#e64ff5f8 as nil") - } - b.PutID(ChatEventMessageEditedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMessageEdited) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageEdited#e64ff5f8 as nil") - } - if err := c.OldMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessageEdited#e64ff5f8: field old_message: %w", err) - } - if err := c.NewMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessageEdited#e64ff5f8: field new_message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMessageEdited) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageEdited#e64ff5f8 to nil") - } - if err := b.ConsumeID(ChatEventMessageEditedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMessageEdited) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageEdited#e64ff5f8 to nil") - } - { - if err := c.OldMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: field old_message: %w", err) - } - } - { - if err := c.NewMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: field new_message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMessageEdited) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageEdited#e64ff5f8 as nil") - } - b.ObjStart() - b.PutID("chatEventMessageEdited") - b.Comma() - b.FieldStart("old_message") - if err := c.OldMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessageEdited#e64ff5f8: field old_message: %w", err) - } - b.Comma() - b.FieldStart("new_message") - if err := c.NewMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessageEdited#e64ff5f8: field new_message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMessageEdited) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageEdited#e64ff5f8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMessageEdited"); err != nil { - return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: %w", err) - } - case "old_message": - if err := c.OldMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: field old_message: %w", err) - } - case "new_message": - if err := c.NewMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessageEdited#e64ff5f8: field new_message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOldMessage returns value of OldMessage field. -func (c *ChatEventMessageEdited) GetOldMessage() (value Message) { - if c == nil { - return - } - return c.OldMessage -} - -// GetNewMessage returns value of NewMessage field. -func (c *ChatEventMessageEdited) GetNewMessage() (value Message) { - if c == nil { - return - } - return c.NewMessage -} - -// ChatEventMessageDeleted represents TL type `chatEventMessageDeleted#37bfcd73`. -type ChatEventMessageDeleted struct { - // Deleted message - Message Message - // True, if the message deletion can be reported via - // reportSupergroupAntiSpamFalsePositive - CanReportAntiSpamFalsePositive bool -} - -// ChatEventMessageDeletedTypeID is TL type id of ChatEventMessageDeleted. -const ChatEventMessageDeletedTypeID = 0x37bfcd73 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMessageDeleted) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMessageDeleted. -var ( - _ bin.Encoder = &ChatEventMessageDeleted{} - _ bin.Decoder = &ChatEventMessageDeleted{} - _ bin.BareEncoder = &ChatEventMessageDeleted{} - _ bin.BareDecoder = &ChatEventMessageDeleted{} - - _ ChatEventActionClass = &ChatEventMessageDeleted{} -) - -func (c *ChatEventMessageDeleted) Zero() bool { - if c == nil { - return true - } - if !(c.Message.Zero()) { - return false - } - if !(c.CanReportAntiSpamFalsePositive == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMessageDeleted) String() string { - if c == nil { - return "ChatEventMessageDeleted(nil)" - } - type Alias ChatEventMessageDeleted - return fmt.Sprintf("ChatEventMessageDeleted%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMessageDeleted) TypeID() uint32 { - return ChatEventMessageDeletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMessageDeleted) TypeName() string { - return "chatEventMessageDeleted" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMessageDeleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMessageDeleted", - ID: ChatEventMessageDeletedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "CanReportAntiSpamFalsePositive", - SchemaName: "can_report_anti_spam_false_positive", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMessageDeleted) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageDeleted#37bfcd73 as nil") - } - b.PutID(ChatEventMessageDeletedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMessageDeleted) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageDeleted#37bfcd73 as nil") - } - if err := c.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessageDeleted#37bfcd73: field message: %w", err) - } - b.PutBool(c.CanReportAntiSpamFalsePositive) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMessageDeleted) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageDeleted#37bfcd73 to nil") - } - if err := b.ConsumeID(ChatEventMessageDeletedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMessageDeleted) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageDeleted#37bfcd73 to nil") - } - { - if err := c.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field message: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field can_report_anti_spam_false_positive: %w", err) - } - c.CanReportAntiSpamFalsePositive = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMessageDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageDeleted#37bfcd73 as nil") - } - b.ObjStart() - b.PutID("chatEventMessageDeleted") - b.Comma() - b.FieldStart("message") - if err := c.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessageDeleted#37bfcd73: field message: %w", err) - } - b.Comma() - b.FieldStart("can_report_anti_spam_false_positive") - b.PutBool(c.CanReportAntiSpamFalsePositive) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMessageDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageDeleted#37bfcd73 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMessageDeleted"); err != nil { - return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: %w", err) - } - case "message": - if err := c.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field message: %w", err) - } - case "can_report_anti_spam_false_positive": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventMessageDeleted#37bfcd73: field can_report_anti_spam_false_positive: %w", err) - } - c.CanReportAntiSpamFalsePositive = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (c *ChatEventMessageDeleted) GetMessage() (value Message) { - if c == nil { - return - } - return c.Message -} - -// GetCanReportAntiSpamFalsePositive returns value of CanReportAntiSpamFalsePositive field. -func (c *ChatEventMessageDeleted) GetCanReportAntiSpamFalsePositive() (value bool) { - if c == nil { - return - } - return c.CanReportAntiSpamFalsePositive -} - -// ChatEventMessagePinned represents TL type `chatEventMessagePinned#1a26ad1a`. -type ChatEventMessagePinned struct { - // Pinned message - Message Message -} - -// ChatEventMessagePinnedTypeID is TL type id of ChatEventMessagePinned. -const ChatEventMessagePinnedTypeID = 0x1a26ad1a - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMessagePinned) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMessagePinned. -var ( - _ bin.Encoder = &ChatEventMessagePinned{} - _ bin.Decoder = &ChatEventMessagePinned{} - _ bin.BareEncoder = &ChatEventMessagePinned{} - _ bin.BareDecoder = &ChatEventMessagePinned{} - - _ ChatEventActionClass = &ChatEventMessagePinned{} -) - -func (c *ChatEventMessagePinned) Zero() bool { - if c == nil { - return true - } - if !(c.Message.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMessagePinned) String() string { - if c == nil { - return "ChatEventMessagePinned(nil)" - } - type Alias ChatEventMessagePinned - return fmt.Sprintf("ChatEventMessagePinned%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMessagePinned) TypeID() uint32 { - return ChatEventMessagePinnedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMessagePinned) TypeName() string { - return "chatEventMessagePinned" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMessagePinned) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMessagePinned", - ID: ChatEventMessagePinnedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMessagePinned) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessagePinned#1a26ad1a as nil") - } - b.PutID(ChatEventMessagePinnedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMessagePinned) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessagePinned#1a26ad1a as nil") - } - if err := c.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessagePinned#1a26ad1a: field message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMessagePinned) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessagePinned#1a26ad1a to nil") - } - if err := b.ConsumeID(ChatEventMessagePinnedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMessagePinned#1a26ad1a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMessagePinned) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessagePinned#1a26ad1a to nil") - } - { - if err := c.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessagePinned#1a26ad1a: field message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMessagePinned) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessagePinned#1a26ad1a as nil") - } - b.ObjStart() - b.PutID("chatEventMessagePinned") - b.Comma() - b.FieldStart("message") - if err := c.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessagePinned#1a26ad1a: field message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMessagePinned) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessagePinned#1a26ad1a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMessagePinned"); err != nil { - return fmt.Errorf("unable to decode chatEventMessagePinned#1a26ad1a: %w", err) - } - case "message": - if err := c.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessagePinned#1a26ad1a: field message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (c *ChatEventMessagePinned) GetMessage() (value Message) { - if c == nil { - return - } - return c.Message -} - -// ChatEventMessageUnpinned represents TL type `chatEventMessageUnpinned#e9943b17`. -type ChatEventMessageUnpinned struct { - // Unpinned message - Message Message -} - -// ChatEventMessageUnpinnedTypeID is TL type id of ChatEventMessageUnpinned. -const ChatEventMessageUnpinnedTypeID = 0xe9943b17 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMessageUnpinned) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMessageUnpinned. -var ( - _ bin.Encoder = &ChatEventMessageUnpinned{} - _ bin.Decoder = &ChatEventMessageUnpinned{} - _ bin.BareEncoder = &ChatEventMessageUnpinned{} - _ bin.BareDecoder = &ChatEventMessageUnpinned{} - - _ ChatEventActionClass = &ChatEventMessageUnpinned{} -) - -func (c *ChatEventMessageUnpinned) Zero() bool { - if c == nil { - return true - } - if !(c.Message.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMessageUnpinned) String() string { - if c == nil { - return "ChatEventMessageUnpinned(nil)" - } - type Alias ChatEventMessageUnpinned - return fmt.Sprintf("ChatEventMessageUnpinned%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMessageUnpinned) TypeID() uint32 { - return ChatEventMessageUnpinnedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMessageUnpinned) TypeName() string { - return "chatEventMessageUnpinned" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMessageUnpinned) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMessageUnpinned", - ID: ChatEventMessageUnpinnedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMessageUnpinned) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageUnpinned#e9943b17 as nil") - } - b.PutID(ChatEventMessageUnpinnedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMessageUnpinned) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageUnpinned#e9943b17 as nil") - } - if err := c.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessageUnpinned#e9943b17: field message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMessageUnpinned) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageUnpinned#e9943b17 to nil") - } - if err := b.ConsumeID(ChatEventMessageUnpinnedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMessageUnpinned#e9943b17: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMessageUnpinned) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageUnpinned#e9943b17 to nil") - } - { - if err := c.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessageUnpinned#e9943b17: field message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMessageUnpinned) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageUnpinned#e9943b17 as nil") - } - b.ObjStart() - b.PutID("chatEventMessageUnpinned") - b.Comma() - b.FieldStart("message") - if err := c.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMessageUnpinned#e9943b17: field message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMessageUnpinned) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageUnpinned#e9943b17 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMessageUnpinned"); err != nil { - return fmt.Errorf("unable to decode chatEventMessageUnpinned#e9943b17: %w", err) - } - case "message": - if err := c.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventMessageUnpinned#e9943b17: field message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (c *ChatEventMessageUnpinned) GetMessage() (value Message) { - if c == nil { - return - } - return c.Message -} - -// ChatEventPollStopped represents TL type `chatEventPollStopped#77cc8be5`. -type ChatEventPollStopped struct { - // The message with the poll - Message Message -} - -// ChatEventPollStoppedTypeID is TL type id of ChatEventPollStopped. -const ChatEventPollStoppedTypeID = 0x77cc8be5 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventPollStopped) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventPollStopped. -var ( - _ bin.Encoder = &ChatEventPollStopped{} - _ bin.Decoder = &ChatEventPollStopped{} - _ bin.BareEncoder = &ChatEventPollStopped{} - _ bin.BareDecoder = &ChatEventPollStopped{} - - _ ChatEventActionClass = &ChatEventPollStopped{} -) - -func (c *ChatEventPollStopped) Zero() bool { - if c == nil { - return true - } - if !(c.Message.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventPollStopped) String() string { - if c == nil { - return "ChatEventPollStopped(nil)" - } - type Alias ChatEventPollStopped - return fmt.Sprintf("ChatEventPollStopped%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventPollStopped) TypeID() uint32 { - return ChatEventPollStoppedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventPollStopped) TypeName() string { - return "chatEventPollStopped" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventPollStopped) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventPollStopped", - ID: ChatEventPollStoppedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventPollStopped) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil") - } - b.PutID(ChatEventPollStoppedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventPollStopped) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil") - } - if err := c.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventPollStopped#77cc8be5: field message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventPollStopped) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil") - } - if err := b.ConsumeID(ChatEventPollStoppedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventPollStopped) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil") - } - { - if err := c.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: field message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventPollStopped) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPollStopped#77cc8be5 as nil") - } - b.ObjStart() - b.PutID("chatEventPollStopped") - b.Comma() - b.FieldStart("message") - if err := c.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventPollStopped#77cc8be5: field message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventPollStopped) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPollStopped#77cc8be5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventPollStopped"); err != nil { - return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: %w", err) - } - case "message": - if err := c.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventPollStopped#77cc8be5: field message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (c *ChatEventPollStopped) GetMessage() (value Message) { - if c == nil { - return - } - return c.Message -} - -// ChatEventMemberJoined represents TL type `chatEventMemberJoined#f1f70924`. -type ChatEventMemberJoined struct { -} - -// ChatEventMemberJoinedTypeID is TL type id of ChatEventMemberJoined. -const ChatEventMemberJoinedTypeID = 0xf1f70924 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMemberJoined) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMemberJoined. -var ( - _ bin.Encoder = &ChatEventMemberJoined{} - _ bin.Decoder = &ChatEventMemberJoined{} - _ bin.BareEncoder = &ChatEventMemberJoined{} - _ bin.BareDecoder = &ChatEventMemberJoined{} - - _ ChatEventActionClass = &ChatEventMemberJoined{} -) - -func (c *ChatEventMemberJoined) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMemberJoined) String() string { - if c == nil { - return "ChatEventMemberJoined(nil)" - } - type Alias ChatEventMemberJoined - return fmt.Sprintf("ChatEventMemberJoined%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMemberJoined) TypeID() uint32 { - return ChatEventMemberJoinedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMemberJoined) TypeName() string { - return "chatEventMemberJoined" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMemberJoined) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMemberJoined", - ID: ChatEventMemberJoinedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMemberJoined) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberJoined#f1f70924 as nil") - } - b.PutID(ChatEventMemberJoinedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMemberJoined) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberJoined#f1f70924 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMemberJoined) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberJoined#f1f70924 to nil") - } - if err := b.ConsumeID(ChatEventMemberJoinedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoined#f1f70924: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMemberJoined) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberJoined#f1f70924 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMemberJoined) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberJoined#f1f70924 as nil") - } - b.ObjStart() - b.PutID("chatEventMemberJoined") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMemberJoined) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberJoined#f1f70924 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMemberJoined"); err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoined#f1f70924: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatEventMemberJoinedByInviteLink represents TL type `chatEventMemberJoinedByInviteLink#a9d6dd7a`. -type ChatEventMemberJoinedByInviteLink struct { - // Invite link used to join the chat - InviteLink ChatInviteLink - // True, if the user has joined the chat using an invite link for a chat folder - ViaChatFolderInviteLink bool -} - -// ChatEventMemberJoinedByInviteLinkTypeID is TL type id of ChatEventMemberJoinedByInviteLink. -const ChatEventMemberJoinedByInviteLinkTypeID = 0xa9d6dd7a - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMemberJoinedByInviteLink) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMemberJoinedByInviteLink. -var ( - _ bin.Encoder = &ChatEventMemberJoinedByInviteLink{} - _ bin.Decoder = &ChatEventMemberJoinedByInviteLink{} - _ bin.BareEncoder = &ChatEventMemberJoinedByInviteLink{} - _ bin.BareDecoder = &ChatEventMemberJoinedByInviteLink{} - - _ ChatEventActionClass = &ChatEventMemberJoinedByInviteLink{} -) - -func (c *ChatEventMemberJoinedByInviteLink) Zero() bool { - if c == nil { - return true - } - if !(c.InviteLink.Zero()) { - return false - } - if !(c.ViaChatFolderInviteLink == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMemberJoinedByInviteLink) String() string { - if c == nil { - return "ChatEventMemberJoinedByInviteLink(nil)" - } - type Alias ChatEventMemberJoinedByInviteLink - return fmt.Sprintf("ChatEventMemberJoinedByInviteLink%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMemberJoinedByInviteLink) TypeID() uint32 { - return ChatEventMemberJoinedByInviteLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMemberJoinedByInviteLink) TypeName() string { - return "chatEventMemberJoinedByInviteLink" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMemberJoinedByInviteLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMemberJoinedByInviteLink", - ID: ChatEventMemberJoinedByInviteLinkTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "ViaChatFolderInviteLink", - SchemaName: "via_chat_folder_invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMemberJoinedByInviteLink) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberJoinedByInviteLink#a9d6dd7a as nil") - } - b.PutID(ChatEventMemberJoinedByInviteLinkTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMemberJoinedByInviteLink) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberJoinedByInviteLink#a9d6dd7a as nil") - } - if err := c.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberJoinedByInviteLink#a9d6dd7a: field invite_link: %w", err) - } - b.PutBool(c.ViaChatFolderInviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMemberJoinedByInviteLink) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberJoinedByInviteLink#a9d6dd7a to nil") - } - if err := b.ConsumeID(ChatEventMemberJoinedByInviteLinkTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMemberJoinedByInviteLink) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberJoinedByInviteLink#a9d6dd7a to nil") - } - { - if err := c.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: field invite_link: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: field via_chat_folder_invite_link: %w", err) - } - c.ViaChatFolderInviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMemberJoinedByInviteLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberJoinedByInviteLink#a9d6dd7a as nil") - } - b.ObjStart() - b.PutID("chatEventMemberJoinedByInviteLink") - b.Comma() - b.FieldStart("invite_link") - if err := c.InviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberJoinedByInviteLink#a9d6dd7a: field invite_link: %w", err) - } - b.Comma() - b.FieldStart("via_chat_folder_invite_link") - b.PutBool(c.ViaChatFolderInviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMemberJoinedByInviteLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberJoinedByInviteLink#a9d6dd7a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMemberJoinedByInviteLink"); err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: %w", err) - } - case "invite_link": - if err := c.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: field invite_link: %w", err) - } - case "via_chat_folder_invite_link": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByInviteLink#a9d6dd7a: field via_chat_folder_invite_link: %w", err) - } - c.ViaChatFolderInviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (c *ChatEventMemberJoinedByInviteLink) GetInviteLink() (value ChatInviteLink) { - if c == nil { - return - } - return c.InviteLink -} - -// GetViaChatFolderInviteLink returns value of ViaChatFolderInviteLink field. -func (c *ChatEventMemberJoinedByInviteLink) GetViaChatFolderInviteLink() (value bool) { - if c == nil { - return - } - return c.ViaChatFolderInviteLink -} - -// ChatEventMemberJoinedByRequest represents TL type `chatEventMemberJoinedByRequest#9dc87e3f`. -type ChatEventMemberJoinedByRequest struct { - // User identifier of the chat administrator, approved user join request - ApproverUserID int64 - // Invite link used to join the chat; may be null - InviteLink ChatInviteLink -} - -// ChatEventMemberJoinedByRequestTypeID is TL type id of ChatEventMemberJoinedByRequest. -const ChatEventMemberJoinedByRequestTypeID = 0x9dc87e3f - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMemberJoinedByRequest) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMemberJoinedByRequest. -var ( - _ bin.Encoder = &ChatEventMemberJoinedByRequest{} - _ bin.Decoder = &ChatEventMemberJoinedByRequest{} - _ bin.BareEncoder = &ChatEventMemberJoinedByRequest{} - _ bin.BareDecoder = &ChatEventMemberJoinedByRequest{} - - _ ChatEventActionClass = &ChatEventMemberJoinedByRequest{} -) - -func (c *ChatEventMemberJoinedByRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ApproverUserID == 0) { - return false - } - if !(c.InviteLink.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMemberJoinedByRequest) String() string { - if c == nil { - return "ChatEventMemberJoinedByRequest(nil)" - } - type Alias ChatEventMemberJoinedByRequest - return fmt.Sprintf("ChatEventMemberJoinedByRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMemberJoinedByRequest) TypeID() uint32 { - return ChatEventMemberJoinedByRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMemberJoinedByRequest) TypeName() string { - return "chatEventMemberJoinedByRequest" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMemberJoinedByRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMemberJoinedByRequest", - ID: ChatEventMemberJoinedByRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ApproverUserID", - SchemaName: "approver_user_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMemberJoinedByRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberJoinedByRequest#9dc87e3f as nil") - } - b.PutID(ChatEventMemberJoinedByRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMemberJoinedByRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberJoinedByRequest#9dc87e3f as nil") - } - b.PutInt53(c.ApproverUserID) - if err := c.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberJoinedByRequest#9dc87e3f: field invite_link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMemberJoinedByRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberJoinedByRequest#9dc87e3f to nil") - } - if err := b.ConsumeID(ChatEventMemberJoinedByRequestTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMemberJoinedByRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberJoinedByRequest#9dc87e3f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: field approver_user_id: %w", err) - } - c.ApproverUserID = value - } - { - if err := c.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: field invite_link: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMemberJoinedByRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberJoinedByRequest#9dc87e3f as nil") - } - b.ObjStart() - b.PutID("chatEventMemberJoinedByRequest") - b.Comma() - b.FieldStart("approver_user_id") - b.PutInt53(c.ApproverUserID) - b.Comma() - b.FieldStart("invite_link") - if err := c.InviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberJoinedByRequest#9dc87e3f: field invite_link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMemberJoinedByRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberJoinedByRequest#9dc87e3f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMemberJoinedByRequest"); err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: %w", err) - } - case "approver_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: field approver_user_id: %w", err) - } - c.ApproverUserID = value - case "invite_link": - if err := c.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventMemberJoinedByRequest#9dc87e3f: field invite_link: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetApproverUserID returns value of ApproverUserID field. -func (c *ChatEventMemberJoinedByRequest) GetApproverUserID() (value int64) { - if c == nil { - return - } - return c.ApproverUserID -} - -// GetInviteLink returns value of InviteLink field. -func (c *ChatEventMemberJoinedByRequest) GetInviteLink() (value ChatInviteLink) { - if c == nil { - return - } - return c.InviteLink -} - -// ChatEventMemberInvited represents TL type `chatEventMemberInvited#38d7bfc9`. -type ChatEventMemberInvited struct { - // New member user identifier - UserID int64 - // New member status - Status ChatMemberStatusClass -} - -// ChatEventMemberInvitedTypeID is TL type id of ChatEventMemberInvited. -const ChatEventMemberInvitedTypeID = 0x38d7bfc9 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMemberInvited) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMemberInvited. -var ( - _ bin.Encoder = &ChatEventMemberInvited{} - _ bin.Decoder = &ChatEventMemberInvited{} - _ bin.BareEncoder = &ChatEventMemberInvited{} - _ bin.BareDecoder = &ChatEventMemberInvited{} - - _ ChatEventActionClass = &ChatEventMemberInvited{} -) - -func (c *ChatEventMemberInvited) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.Status == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMemberInvited) String() string { - if c == nil { - return "ChatEventMemberInvited(nil)" - } - type Alias ChatEventMemberInvited - return fmt.Sprintf("ChatEventMemberInvited%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMemberInvited) TypeID() uint32 { - return ChatEventMemberInvitedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMemberInvited) TypeName() string { - return "chatEventMemberInvited" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMemberInvited) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMemberInvited", - ID: ChatEventMemberInvitedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Status", - SchemaName: "status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMemberInvited) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil") - } - b.PutID(ChatEventMemberInvitedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMemberInvited) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil") - } - b.PutInt53(c.UserID) - if c.Status == nil { - return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status is nil") - } - if err := c.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMemberInvited) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil") - } - if err := b.ConsumeID(ChatEventMemberInvitedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMemberInvited) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := DecodeChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field status: %w", err) - } - c.Status = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMemberInvited) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberInvited#38d7bfc9 as nil") - } - b.ObjStart() - b.PutID("chatEventMemberInvited") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("status") - if c.Status == nil { - return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status is nil") - } - if err := c.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberInvited#38d7bfc9: field status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMemberInvited) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberInvited#38d7bfc9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMemberInvited"); err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field user_id: %w", err) - } - c.UserID = value - case "status": - value, err := DecodeTDLibJSONChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberInvited#38d7bfc9: field status: %w", err) - } - c.Status = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatEventMemberInvited) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetStatus returns value of Status field. -func (c *ChatEventMemberInvited) GetStatus() (value ChatMemberStatusClass) { - if c == nil { - return - } - return c.Status -} - -// ChatEventMemberLeft represents TL type `chatEventMemberLeft#c778400f`. -type ChatEventMemberLeft struct { -} - -// ChatEventMemberLeftTypeID is TL type id of ChatEventMemberLeft. -const ChatEventMemberLeftTypeID = 0xc778400f - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMemberLeft) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMemberLeft. -var ( - _ bin.Encoder = &ChatEventMemberLeft{} - _ bin.Decoder = &ChatEventMemberLeft{} - _ bin.BareEncoder = &ChatEventMemberLeft{} - _ bin.BareDecoder = &ChatEventMemberLeft{} - - _ ChatEventActionClass = &ChatEventMemberLeft{} -) - -func (c *ChatEventMemberLeft) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMemberLeft) String() string { - if c == nil { - return "ChatEventMemberLeft(nil)" - } - type Alias ChatEventMemberLeft - return fmt.Sprintf("ChatEventMemberLeft%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMemberLeft) TypeID() uint32 { - return ChatEventMemberLeftTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMemberLeft) TypeName() string { - return "chatEventMemberLeft" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMemberLeft) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMemberLeft", - ID: ChatEventMemberLeftTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMemberLeft) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil") - } - b.PutID(ChatEventMemberLeftTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMemberLeft) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMemberLeft) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil") - } - if err := b.ConsumeID(ChatEventMemberLeftTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMemberLeft#c778400f: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMemberLeft) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMemberLeft) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberLeft#c778400f as nil") - } - b.ObjStart() - b.PutID("chatEventMemberLeft") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMemberLeft) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberLeft#c778400f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMemberLeft"); err != nil { - return fmt.Errorf("unable to decode chatEventMemberLeft#c778400f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatEventMemberPromoted represents TL type `chatEventMemberPromoted#1f4f6861`. -type ChatEventMemberPromoted struct { - // Affected chat member user identifier - UserID int64 - // Previous status of the chat member - OldStatus ChatMemberStatusClass - // New status of the chat member - NewStatus ChatMemberStatusClass -} - -// ChatEventMemberPromotedTypeID is TL type id of ChatEventMemberPromoted. -const ChatEventMemberPromotedTypeID = 0x1f4f6861 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMemberPromoted) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMemberPromoted. -var ( - _ bin.Encoder = &ChatEventMemberPromoted{} - _ bin.Decoder = &ChatEventMemberPromoted{} - _ bin.BareEncoder = &ChatEventMemberPromoted{} - _ bin.BareDecoder = &ChatEventMemberPromoted{} - - _ ChatEventActionClass = &ChatEventMemberPromoted{} -) - -func (c *ChatEventMemberPromoted) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.OldStatus == nil) { - return false - } - if !(c.NewStatus == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMemberPromoted) String() string { - if c == nil { - return "ChatEventMemberPromoted(nil)" - } - type Alias ChatEventMemberPromoted - return fmt.Sprintf("ChatEventMemberPromoted%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMemberPromoted) TypeID() uint32 { - return ChatEventMemberPromotedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMemberPromoted) TypeName() string { - return "chatEventMemberPromoted" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMemberPromoted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMemberPromoted", - ID: ChatEventMemberPromotedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "OldStatus", - SchemaName: "old_status", - }, - { - Name: "NewStatus", - SchemaName: "new_status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMemberPromoted) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberPromoted#1f4f6861 as nil") - } - b.PutID(ChatEventMemberPromotedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMemberPromoted) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberPromoted#1f4f6861 as nil") - } - b.PutInt53(c.UserID) - if c.OldStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field old_status is nil") - } - if err := c.OldStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field old_status: %w", err) - } - if c.NewStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field new_status is nil") - } - if err := c.NewStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field new_status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMemberPromoted) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberPromoted#1f4f6861 to nil") - } - if err := b.ConsumeID(ChatEventMemberPromotedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMemberPromoted) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberPromoted#1f4f6861 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := DecodeChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field old_status: %w", err) - } - c.OldStatus = value - } - { - value, err := DecodeChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field new_status: %w", err) - } - c.NewStatus = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMemberPromoted) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberPromoted#1f4f6861 as nil") - } - b.ObjStart() - b.PutID("chatEventMemberPromoted") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("old_status") - if c.OldStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field old_status is nil") - } - if err := c.OldStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field old_status: %w", err) - } - b.Comma() - b.FieldStart("new_status") - if c.NewStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field new_status is nil") - } - if err := c.NewStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberPromoted#1f4f6861: field new_status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMemberPromoted) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberPromoted#1f4f6861 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMemberPromoted"); err != nil { - return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field user_id: %w", err) - } - c.UserID = value - case "old_status": - value, err := DecodeTDLibJSONChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field old_status: %w", err) - } - c.OldStatus = value - case "new_status": - value, err := DecodeTDLibJSONChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberPromoted#1f4f6861: field new_status: %w", err) - } - c.NewStatus = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatEventMemberPromoted) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetOldStatus returns value of OldStatus field. -func (c *ChatEventMemberPromoted) GetOldStatus() (value ChatMemberStatusClass) { - if c == nil { - return - } - return c.OldStatus -} - -// GetNewStatus returns value of NewStatus field. -func (c *ChatEventMemberPromoted) GetNewStatus() (value ChatMemberStatusClass) { - if c == nil { - return - } - return c.NewStatus -} - -// ChatEventMemberRestricted represents TL type `chatEventMemberRestricted#5f951e05`. -type ChatEventMemberRestricted struct { - // Affected chat member identifier - MemberID MessageSenderClass - // Previous status of the chat member - OldStatus ChatMemberStatusClass - // New status of the chat member - NewStatus ChatMemberStatusClass -} - -// ChatEventMemberRestrictedTypeID is TL type id of ChatEventMemberRestricted. -const ChatEventMemberRestrictedTypeID = 0x5f951e05 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMemberRestricted) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMemberRestricted. -var ( - _ bin.Encoder = &ChatEventMemberRestricted{} - _ bin.Decoder = &ChatEventMemberRestricted{} - _ bin.BareEncoder = &ChatEventMemberRestricted{} - _ bin.BareDecoder = &ChatEventMemberRestricted{} - - _ ChatEventActionClass = &ChatEventMemberRestricted{} -) - -func (c *ChatEventMemberRestricted) Zero() bool { - if c == nil { - return true - } - if !(c.MemberID == nil) { - return false - } - if !(c.OldStatus == nil) { - return false - } - if !(c.NewStatus == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMemberRestricted) String() string { - if c == nil { - return "ChatEventMemberRestricted(nil)" - } - type Alias ChatEventMemberRestricted - return fmt.Sprintf("ChatEventMemberRestricted%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMemberRestricted) TypeID() uint32 { - return ChatEventMemberRestrictedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMemberRestricted) TypeName() string { - return "chatEventMemberRestricted" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMemberRestricted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMemberRestricted", - ID: ChatEventMemberRestrictedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MemberID", - SchemaName: "member_id", - }, - { - Name: "OldStatus", - SchemaName: "old_status", - }, - { - Name: "NewStatus", - SchemaName: "new_status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMemberRestricted) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberRestricted#5f951e05 as nil") - } - b.PutID(ChatEventMemberRestrictedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMemberRestricted) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberRestricted#5f951e05 as nil") - } - if c.MemberID == nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field member_id is nil") - } - if err := c.MemberID.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field member_id: %w", err) - } - if c.OldStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field old_status is nil") - } - if err := c.OldStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field old_status: %w", err) - } - if c.NewStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field new_status is nil") - } - if err := c.NewStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field new_status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMemberRestricted) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberRestricted#5f951e05 to nil") - } - if err := b.ConsumeID(ChatEventMemberRestrictedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMemberRestricted) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberRestricted#5f951e05 to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field member_id: %w", err) - } - c.MemberID = value - } - { - value, err := DecodeChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field old_status: %w", err) - } - c.OldStatus = value - } - { - value, err := DecodeChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field new_status: %w", err) - } - c.NewStatus = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMemberRestricted) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberRestricted#5f951e05 as nil") - } - b.ObjStart() - b.PutID("chatEventMemberRestricted") - b.Comma() - b.FieldStart("member_id") - if c.MemberID == nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field member_id is nil") - } - if err := c.MemberID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field member_id: %w", err) - } - b.Comma() - b.FieldStart("old_status") - if c.OldStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field old_status is nil") - } - if err := c.OldStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field old_status: %w", err) - } - b.Comma() - b.FieldStart("new_status") - if c.NewStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field new_status is nil") - } - if err := c.NewStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberRestricted#5f951e05: field new_status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMemberRestricted) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberRestricted#5f951e05 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMemberRestricted"); err != nil { - return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: %w", err) - } - case "member_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field member_id: %w", err) - } - c.MemberID = value - case "old_status": - value, err := DecodeTDLibJSONChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field old_status: %w", err) - } - c.OldStatus = value - case "new_status": - value, err := DecodeTDLibJSONChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberRestricted#5f951e05: field new_status: %w", err) - } - c.NewStatus = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMemberID returns value of MemberID field. -func (c *ChatEventMemberRestricted) GetMemberID() (value MessageSenderClass) { - if c == nil { - return - } - return c.MemberID -} - -// GetOldStatus returns value of OldStatus field. -func (c *ChatEventMemberRestricted) GetOldStatus() (value ChatMemberStatusClass) { - if c == nil { - return - } - return c.OldStatus -} - -// GetNewStatus returns value of NewStatus field. -func (c *ChatEventMemberRestricted) GetNewStatus() (value ChatMemberStatusClass) { - if c == nil { - return - } - return c.NewStatus -} - -// ChatEventMemberSubscriptionExtended represents TL type `chatEventMemberSubscriptionExtended#bbfab002`. -type ChatEventMemberSubscriptionExtended struct { - // Affected chat member user identifier - UserID int64 - // Previous status of the chat member - OldStatus ChatMemberStatusClass - // New status of the chat member - NewStatus ChatMemberStatusClass -} - -// ChatEventMemberSubscriptionExtendedTypeID is TL type id of ChatEventMemberSubscriptionExtended. -const ChatEventMemberSubscriptionExtendedTypeID = 0xbbfab002 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMemberSubscriptionExtended) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMemberSubscriptionExtended. -var ( - _ bin.Encoder = &ChatEventMemberSubscriptionExtended{} - _ bin.Decoder = &ChatEventMemberSubscriptionExtended{} - _ bin.BareEncoder = &ChatEventMemberSubscriptionExtended{} - _ bin.BareDecoder = &ChatEventMemberSubscriptionExtended{} - - _ ChatEventActionClass = &ChatEventMemberSubscriptionExtended{} -) - -func (c *ChatEventMemberSubscriptionExtended) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.OldStatus == nil) { - return false - } - if !(c.NewStatus == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMemberSubscriptionExtended) String() string { - if c == nil { - return "ChatEventMemberSubscriptionExtended(nil)" - } - type Alias ChatEventMemberSubscriptionExtended - return fmt.Sprintf("ChatEventMemberSubscriptionExtended%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMemberSubscriptionExtended) TypeID() uint32 { - return ChatEventMemberSubscriptionExtendedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMemberSubscriptionExtended) TypeName() string { - return "chatEventMemberSubscriptionExtended" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMemberSubscriptionExtended) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMemberSubscriptionExtended", - ID: ChatEventMemberSubscriptionExtendedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "OldStatus", - SchemaName: "old_status", - }, - { - Name: "NewStatus", - SchemaName: "new_status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMemberSubscriptionExtended) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberSubscriptionExtended#bbfab002 as nil") - } - b.PutID(ChatEventMemberSubscriptionExtendedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMemberSubscriptionExtended) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberSubscriptionExtended#bbfab002 as nil") - } - b.PutInt53(c.UserID) - if c.OldStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status is nil") - } - if err := c.OldStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err) - } - if c.NewStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status is nil") - } - if err := c.NewStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMemberSubscriptionExtended) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberSubscriptionExtended#bbfab002 to nil") - } - if err := b.ConsumeID(ChatEventMemberSubscriptionExtendedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMemberSubscriptionExtended) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberSubscriptionExtended#bbfab002 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := DecodeChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err) - } - c.OldStatus = value - } - { - value, err := DecodeChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err) - } - c.NewStatus = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMemberSubscriptionExtended) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMemberSubscriptionExtended#bbfab002 as nil") - } - b.ObjStart() - b.PutID("chatEventMemberSubscriptionExtended") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("old_status") - if c.OldStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status is nil") - } - if err := c.OldStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err) - } - b.Comma() - b.FieldStart("new_status") - if c.NewStatus == nil { - return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status is nil") - } - if err := c.NewStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMemberSubscriptionExtended) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMemberSubscriptionExtended#bbfab002 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMemberSubscriptionExtended"); err != nil { - return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field user_id: %w", err) - } - c.UserID = value - case "old_status": - value, err := DecodeTDLibJSONChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field old_status: %w", err) - } - c.OldStatus = value - case "new_status": - value, err := DecodeTDLibJSONChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventMemberSubscriptionExtended#bbfab002: field new_status: %w", err) - } - c.NewStatus = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatEventMemberSubscriptionExtended) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetOldStatus returns value of OldStatus field. -func (c *ChatEventMemberSubscriptionExtended) GetOldStatus() (value ChatMemberStatusClass) { - if c == nil { - return - } - return c.OldStatus -} - -// GetNewStatus returns value of NewStatus field. -func (c *ChatEventMemberSubscriptionExtended) GetNewStatus() (value ChatMemberStatusClass) { - if c == nil { - return - } - return c.NewStatus -} - -// ChatEventAvailableReactionsChanged represents TL type `chatEventAvailableReactionsChanged#97b8e0bf`. -type ChatEventAvailableReactionsChanged struct { - // Previous chat available reactions - OldAvailableReactions ChatAvailableReactionsClass - // New chat available reactions - NewAvailableReactions ChatAvailableReactionsClass -} - -// ChatEventAvailableReactionsChangedTypeID is TL type id of ChatEventAvailableReactionsChanged. -const ChatEventAvailableReactionsChangedTypeID = 0x97b8e0bf - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventAvailableReactionsChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventAvailableReactionsChanged. -var ( - _ bin.Encoder = &ChatEventAvailableReactionsChanged{} - _ bin.Decoder = &ChatEventAvailableReactionsChanged{} - _ bin.BareEncoder = &ChatEventAvailableReactionsChanged{} - _ bin.BareDecoder = &ChatEventAvailableReactionsChanged{} - - _ ChatEventActionClass = &ChatEventAvailableReactionsChanged{} -) - -func (c *ChatEventAvailableReactionsChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldAvailableReactions == nil) { - return false - } - if !(c.NewAvailableReactions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventAvailableReactionsChanged) String() string { - if c == nil { - return "ChatEventAvailableReactionsChanged(nil)" - } - type Alias ChatEventAvailableReactionsChanged - return fmt.Sprintf("ChatEventAvailableReactionsChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventAvailableReactionsChanged) TypeID() uint32 { - return ChatEventAvailableReactionsChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventAvailableReactionsChanged) TypeName() string { - return "chatEventAvailableReactionsChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventAvailableReactionsChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventAvailableReactionsChanged", - ID: ChatEventAvailableReactionsChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldAvailableReactions", - SchemaName: "old_available_reactions", - }, - { - Name: "NewAvailableReactions", - SchemaName: "new_available_reactions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventAvailableReactionsChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventAvailableReactionsChanged#97b8e0bf as nil") - } - b.PutID(ChatEventAvailableReactionsChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventAvailableReactionsChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventAvailableReactionsChanged#97b8e0bf as nil") - } - if c.OldAvailableReactions == nil { - return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions is nil") - } - if err := c.OldAvailableReactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions: %w", err) - } - if c.NewAvailableReactions == nil { - return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions is nil") - } - if err := c.NewAvailableReactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventAvailableReactionsChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventAvailableReactionsChanged#97b8e0bf to nil") - } - if err := b.ConsumeID(ChatEventAvailableReactionsChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventAvailableReactionsChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventAvailableReactionsChanged#97b8e0bf to nil") - } - { - value, err := DecodeChatAvailableReactions(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions: %w", err) - } - c.OldAvailableReactions = value - } - { - value, err := DecodeChatAvailableReactions(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions: %w", err) - } - c.NewAvailableReactions = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventAvailableReactionsChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventAvailableReactionsChanged#97b8e0bf as nil") - } - b.ObjStart() - b.PutID("chatEventAvailableReactionsChanged") - b.Comma() - b.FieldStart("old_available_reactions") - if c.OldAvailableReactions == nil { - return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions is nil") - } - if err := c.OldAvailableReactions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions: %w", err) - } - b.Comma() - b.FieldStart("new_available_reactions") - if c.NewAvailableReactions == nil { - return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions is nil") - } - if err := c.NewAvailableReactions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventAvailableReactionsChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventAvailableReactionsChanged#97b8e0bf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventAvailableReactionsChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: %w", err) - } - case "old_available_reactions": - value, err := DecodeTDLibJSONChatAvailableReactions(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: field old_available_reactions: %w", err) - } - c.OldAvailableReactions = value - case "new_available_reactions": - value, err := DecodeTDLibJSONChatAvailableReactions(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventAvailableReactionsChanged#97b8e0bf: field new_available_reactions: %w", err) - } - c.NewAvailableReactions = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldAvailableReactions returns value of OldAvailableReactions field. -func (c *ChatEventAvailableReactionsChanged) GetOldAvailableReactions() (value ChatAvailableReactionsClass) { - if c == nil { - return - } - return c.OldAvailableReactions -} - -// GetNewAvailableReactions returns value of NewAvailableReactions field. -func (c *ChatEventAvailableReactionsChanged) GetNewAvailableReactions() (value ChatAvailableReactionsClass) { - if c == nil { - return - } - return c.NewAvailableReactions -} - -// ChatEventBackgroundChanged represents TL type `chatEventBackgroundChanged#b6ed6d38`. -type ChatEventBackgroundChanged struct { - // Previous background; may be null if none - OldBackground ChatBackground - // New background; may be null if none - NewBackground ChatBackground -} - -// ChatEventBackgroundChangedTypeID is TL type id of ChatEventBackgroundChanged. -const ChatEventBackgroundChangedTypeID = 0xb6ed6d38 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventBackgroundChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventBackgroundChanged. -var ( - _ bin.Encoder = &ChatEventBackgroundChanged{} - _ bin.Decoder = &ChatEventBackgroundChanged{} - _ bin.BareEncoder = &ChatEventBackgroundChanged{} - _ bin.BareDecoder = &ChatEventBackgroundChanged{} - - _ ChatEventActionClass = &ChatEventBackgroundChanged{} -) - -func (c *ChatEventBackgroundChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldBackground.Zero()) { - return false - } - if !(c.NewBackground.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventBackgroundChanged) String() string { - if c == nil { - return "ChatEventBackgroundChanged(nil)" - } - type Alias ChatEventBackgroundChanged - return fmt.Sprintf("ChatEventBackgroundChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventBackgroundChanged) TypeID() uint32 { - return ChatEventBackgroundChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventBackgroundChanged) TypeName() string { - return "chatEventBackgroundChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventBackgroundChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventBackgroundChanged", - ID: ChatEventBackgroundChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldBackground", - SchemaName: "old_background", - }, - { - Name: "NewBackground", - SchemaName: "new_background", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventBackgroundChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventBackgroundChanged#b6ed6d38 as nil") - } - b.PutID(ChatEventBackgroundChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventBackgroundChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventBackgroundChanged#b6ed6d38 as nil") - } - if err := c.OldBackground.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventBackgroundChanged#b6ed6d38: field old_background: %w", err) - } - if err := c.NewBackground.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventBackgroundChanged#b6ed6d38: field new_background: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventBackgroundChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventBackgroundChanged#b6ed6d38 to nil") - } - if err := b.ConsumeID(ChatEventBackgroundChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventBackgroundChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventBackgroundChanged#b6ed6d38 to nil") - } - { - if err := c.OldBackground.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: field old_background: %w", err) - } - } - { - if err := c.NewBackground.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: field new_background: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventBackgroundChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventBackgroundChanged#b6ed6d38 as nil") - } - b.ObjStart() - b.PutID("chatEventBackgroundChanged") - b.Comma() - b.FieldStart("old_background") - if err := c.OldBackground.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventBackgroundChanged#b6ed6d38: field old_background: %w", err) - } - b.Comma() - b.FieldStart("new_background") - if err := c.NewBackground.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventBackgroundChanged#b6ed6d38: field new_background: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventBackgroundChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventBackgroundChanged#b6ed6d38 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventBackgroundChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: %w", err) - } - case "old_background": - if err := c.OldBackground.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: field old_background: %w", err) - } - case "new_background": - if err := c.NewBackground.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventBackgroundChanged#b6ed6d38: field new_background: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOldBackground returns value of OldBackground field. -func (c *ChatEventBackgroundChanged) GetOldBackground() (value ChatBackground) { - if c == nil { - return - } - return c.OldBackground -} - -// GetNewBackground returns value of NewBackground field. -func (c *ChatEventBackgroundChanged) GetNewBackground() (value ChatBackground) { - if c == nil { - return - } - return c.NewBackground -} - -// ChatEventDescriptionChanged represents TL type `chatEventDescriptionChanged#254cf1e`. -type ChatEventDescriptionChanged struct { - // Previous chat description - OldDescription string - // New chat description - NewDescription string -} - -// ChatEventDescriptionChangedTypeID is TL type id of ChatEventDescriptionChanged. -const ChatEventDescriptionChangedTypeID = 0x254cf1e - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventDescriptionChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventDescriptionChanged. -var ( - _ bin.Encoder = &ChatEventDescriptionChanged{} - _ bin.Decoder = &ChatEventDescriptionChanged{} - _ bin.BareEncoder = &ChatEventDescriptionChanged{} - _ bin.BareDecoder = &ChatEventDescriptionChanged{} - - _ ChatEventActionClass = &ChatEventDescriptionChanged{} -) - -func (c *ChatEventDescriptionChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldDescription == "") { - return false - } - if !(c.NewDescription == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventDescriptionChanged) String() string { - if c == nil { - return "ChatEventDescriptionChanged(nil)" - } - type Alias ChatEventDescriptionChanged - return fmt.Sprintf("ChatEventDescriptionChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventDescriptionChanged) TypeID() uint32 { - return ChatEventDescriptionChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventDescriptionChanged) TypeName() string { - return "chatEventDescriptionChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventDescriptionChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventDescriptionChanged", - ID: ChatEventDescriptionChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldDescription", - SchemaName: "old_description", - }, - { - Name: "NewDescription", - SchemaName: "new_description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventDescriptionChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil") - } - b.PutID(ChatEventDescriptionChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventDescriptionChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil") - } - b.PutString(c.OldDescription) - b.PutString(c.NewDescription) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventDescriptionChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil") - } - if err := b.ConsumeID(ChatEventDescriptionChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventDescriptionChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field old_description: %w", err) - } - c.OldDescription = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field new_description: %w", err) - } - c.NewDescription = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventDescriptionChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventDescriptionChanged#254cf1e as nil") - } - b.ObjStart() - b.PutID("chatEventDescriptionChanged") - b.Comma() - b.FieldStart("old_description") - b.PutString(c.OldDescription) - b.Comma() - b.FieldStart("new_description") - b.PutString(c.NewDescription) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventDescriptionChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventDescriptionChanged#254cf1e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventDescriptionChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: %w", err) - } - case "old_description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field old_description: %w", err) - } - c.OldDescription = value - case "new_description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventDescriptionChanged#254cf1e: field new_description: %w", err) - } - c.NewDescription = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldDescription returns value of OldDescription field. -func (c *ChatEventDescriptionChanged) GetOldDescription() (value string) { - if c == nil { - return - } - return c.OldDescription -} - -// GetNewDescription returns value of NewDescription field. -func (c *ChatEventDescriptionChanged) GetNewDescription() (value string) { - if c == nil { - return - } - return c.NewDescription -} - -// ChatEventEmojiStatusChanged represents TL type `chatEventEmojiStatusChanged#83e97b1e`. -type ChatEventEmojiStatusChanged struct { - // Previous emoji status; may be null if none - OldEmojiStatus EmojiStatus - // New emoji status; may be null if none - NewEmojiStatus EmojiStatus -} - -// ChatEventEmojiStatusChangedTypeID is TL type id of ChatEventEmojiStatusChanged. -const ChatEventEmojiStatusChangedTypeID = 0x83e97b1e - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventEmojiStatusChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventEmojiStatusChanged. -var ( - _ bin.Encoder = &ChatEventEmojiStatusChanged{} - _ bin.Decoder = &ChatEventEmojiStatusChanged{} - _ bin.BareEncoder = &ChatEventEmojiStatusChanged{} - _ bin.BareDecoder = &ChatEventEmojiStatusChanged{} - - _ ChatEventActionClass = &ChatEventEmojiStatusChanged{} -) - -func (c *ChatEventEmojiStatusChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldEmojiStatus.Zero()) { - return false - } - if !(c.NewEmojiStatus.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventEmojiStatusChanged) String() string { - if c == nil { - return "ChatEventEmojiStatusChanged(nil)" - } - type Alias ChatEventEmojiStatusChanged - return fmt.Sprintf("ChatEventEmojiStatusChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventEmojiStatusChanged) TypeID() uint32 { - return ChatEventEmojiStatusChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventEmojiStatusChanged) TypeName() string { - return "chatEventEmojiStatusChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventEmojiStatusChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventEmojiStatusChanged", - ID: ChatEventEmojiStatusChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldEmojiStatus", - SchemaName: "old_emoji_status", - }, - { - Name: "NewEmojiStatus", - SchemaName: "new_emoji_status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventEmojiStatusChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventEmojiStatusChanged#83e97b1e as nil") - } - b.PutID(ChatEventEmojiStatusChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventEmojiStatusChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventEmojiStatusChanged#83e97b1e as nil") - } - if err := c.OldEmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventEmojiStatusChanged#83e97b1e: field old_emoji_status: %w", err) - } - if err := c.NewEmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventEmojiStatusChanged#83e97b1e: field new_emoji_status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventEmojiStatusChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventEmojiStatusChanged#83e97b1e to nil") - } - if err := b.ConsumeID(ChatEventEmojiStatusChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventEmojiStatusChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventEmojiStatusChanged#83e97b1e to nil") - } - { - if err := c.OldEmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: field old_emoji_status: %w", err) - } - } - { - if err := c.NewEmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: field new_emoji_status: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventEmojiStatusChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventEmojiStatusChanged#83e97b1e as nil") - } - b.ObjStart() - b.PutID("chatEventEmojiStatusChanged") - b.Comma() - b.FieldStart("old_emoji_status") - if err := c.OldEmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventEmojiStatusChanged#83e97b1e: field old_emoji_status: %w", err) - } - b.Comma() - b.FieldStart("new_emoji_status") - if err := c.NewEmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventEmojiStatusChanged#83e97b1e: field new_emoji_status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventEmojiStatusChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventEmojiStatusChanged#83e97b1e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventEmojiStatusChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: %w", err) - } - case "old_emoji_status": - if err := c.OldEmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: field old_emoji_status: %w", err) - } - case "new_emoji_status": - if err := c.NewEmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventEmojiStatusChanged#83e97b1e: field new_emoji_status: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOldEmojiStatus returns value of OldEmojiStatus field. -func (c *ChatEventEmojiStatusChanged) GetOldEmojiStatus() (value EmojiStatus) { - if c == nil { - return - } - return c.OldEmojiStatus -} - -// GetNewEmojiStatus returns value of NewEmojiStatus field. -func (c *ChatEventEmojiStatusChanged) GetNewEmojiStatus() (value EmojiStatus) { - if c == nil { - return - } - return c.NewEmojiStatus -} - -// ChatEventLinkedChatChanged represents TL type `chatEventLinkedChatChanged#6b2271af`. -type ChatEventLinkedChatChanged struct { - // Previous supergroup linked chat identifier - OldLinkedChatID int64 - // New supergroup linked chat identifier - NewLinkedChatID int64 -} - -// ChatEventLinkedChatChangedTypeID is TL type id of ChatEventLinkedChatChanged. -const ChatEventLinkedChatChangedTypeID = 0x6b2271af - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventLinkedChatChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventLinkedChatChanged. -var ( - _ bin.Encoder = &ChatEventLinkedChatChanged{} - _ bin.Decoder = &ChatEventLinkedChatChanged{} - _ bin.BareEncoder = &ChatEventLinkedChatChanged{} - _ bin.BareDecoder = &ChatEventLinkedChatChanged{} - - _ ChatEventActionClass = &ChatEventLinkedChatChanged{} -) - -func (c *ChatEventLinkedChatChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldLinkedChatID == 0) { - return false - } - if !(c.NewLinkedChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventLinkedChatChanged) String() string { - if c == nil { - return "ChatEventLinkedChatChanged(nil)" - } - type Alias ChatEventLinkedChatChanged - return fmt.Sprintf("ChatEventLinkedChatChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventLinkedChatChanged) TypeID() uint32 { - return ChatEventLinkedChatChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventLinkedChatChanged) TypeName() string { - return "chatEventLinkedChatChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventLinkedChatChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventLinkedChatChanged", - ID: ChatEventLinkedChatChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldLinkedChatID", - SchemaName: "old_linked_chat_id", - }, - { - Name: "NewLinkedChatID", - SchemaName: "new_linked_chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventLinkedChatChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil") - } - b.PutID(ChatEventLinkedChatChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventLinkedChatChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil") - } - b.PutInt53(c.OldLinkedChatID) - b.PutInt53(c.NewLinkedChatID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventLinkedChatChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil") - } - if err := b.ConsumeID(ChatEventLinkedChatChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventLinkedChatChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field old_linked_chat_id: %w", err) - } - c.OldLinkedChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field new_linked_chat_id: %w", err) - } - c.NewLinkedChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventLinkedChatChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventLinkedChatChanged#6b2271af as nil") - } - b.ObjStart() - b.PutID("chatEventLinkedChatChanged") - b.Comma() - b.FieldStart("old_linked_chat_id") - b.PutInt53(c.OldLinkedChatID) - b.Comma() - b.FieldStart("new_linked_chat_id") - b.PutInt53(c.NewLinkedChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventLinkedChatChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventLinkedChatChanged#6b2271af to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventLinkedChatChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: %w", err) - } - case "old_linked_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field old_linked_chat_id: %w", err) - } - c.OldLinkedChatID = value - case "new_linked_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatEventLinkedChatChanged#6b2271af: field new_linked_chat_id: %w", err) - } - c.NewLinkedChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldLinkedChatID returns value of OldLinkedChatID field. -func (c *ChatEventLinkedChatChanged) GetOldLinkedChatID() (value int64) { - if c == nil { - return - } - return c.OldLinkedChatID -} - -// GetNewLinkedChatID returns value of NewLinkedChatID field. -func (c *ChatEventLinkedChatChanged) GetNewLinkedChatID() (value int64) { - if c == nil { - return - } - return c.NewLinkedChatID -} - -// ChatEventLocationChanged represents TL type `chatEventLocationChanged#e7cdfd4e`. -type ChatEventLocationChanged struct { - // Previous location; may be null - OldLocation ChatLocation - // New location; may be null - NewLocation ChatLocation -} - -// ChatEventLocationChangedTypeID is TL type id of ChatEventLocationChanged. -const ChatEventLocationChangedTypeID = 0xe7cdfd4e - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventLocationChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventLocationChanged. -var ( - _ bin.Encoder = &ChatEventLocationChanged{} - _ bin.Decoder = &ChatEventLocationChanged{} - _ bin.BareEncoder = &ChatEventLocationChanged{} - _ bin.BareDecoder = &ChatEventLocationChanged{} - - _ ChatEventActionClass = &ChatEventLocationChanged{} -) - -func (c *ChatEventLocationChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldLocation.Zero()) { - return false - } - if !(c.NewLocation.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventLocationChanged) String() string { - if c == nil { - return "ChatEventLocationChanged(nil)" - } - type Alias ChatEventLocationChanged - return fmt.Sprintf("ChatEventLocationChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventLocationChanged) TypeID() uint32 { - return ChatEventLocationChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventLocationChanged) TypeName() string { - return "chatEventLocationChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventLocationChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventLocationChanged", - ID: ChatEventLocationChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldLocation", - SchemaName: "old_location", - }, - { - Name: "NewLocation", - SchemaName: "new_location", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventLocationChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil") - } - b.PutID(ChatEventLocationChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventLocationChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil") - } - if err := c.OldLocation.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) - } - if err := c.NewLocation.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventLocationChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil") - } - if err := b.ConsumeID(ChatEventLocationChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventLocationChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil") - } - { - if err := c.OldLocation.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) - } - } - { - if err := c.NewLocation.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventLocationChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventLocationChanged#e7cdfd4e as nil") - } - b.ObjStart() - b.PutID("chatEventLocationChanged") - b.Comma() - b.FieldStart("old_location") - if err := c.OldLocation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) - } - b.Comma() - b.FieldStart("new_location") - if err := c.NewLocation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventLocationChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventLocationChanged#e7cdfd4e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventLocationChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: %w", err) - } - case "old_location": - if err := c.OldLocation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field old_location: %w", err) - } - case "new_location": - if err := c.NewLocation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventLocationChanged#e7cdfd4e: field new_location: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOldLocation returns value of OldLocation field. -func (c *ChatEventLocationChanged) GetOldLocation() (value ChatLocation) { - if c == nil { - return - } - return c.OldLocation -} - -// GetNewLocation returns value of NewLocation field. -func (c *ChatEventLocationChanged) GetNewLocation() (value ChatLocation) { - if c == nil { - return - } - return c.NewLocation -} - -// ChatEventMessageAutoDeleteTimeChanged represents TL type `chatEventMessageAutoDeleteTimeChanged#1083f24`. -type ChatEventMessageAutoDeleteTimeChanged struct { - // Previous value of message_auto_delete_time - OldMessageAutoDeleteTime int32 - // New value of message_auto_delete_time - NewMessageAutoDeleteTime int32 -} - -// ChatEventMessageAutoDeleteTimeChangedTypeID is TL type id of ChatEventMessageAutoDeleteTimeChanged. -const ChatEventMessageAutoDeleteTimeChangedTypeID = 0x1083f24 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventMessageAutoDeleteTimeChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventMessageAutoDeleteTimeChanged. -var ( - _ bin.Encoder = &ChatEventMessageAutoDeleteTimeChanged{} - _ bin.Decoder = &ChatEventMessageAutoDeleteTimeChanged{} - _ bin.BareEncoder = &ChatEventMessageAutoDeleteTimeChanged{} - _ bin.BareDecoder = &ChatEventMessageAutoDeleteTimeChanged{} - - _ ChatEventActionClass = &ChatEventMessageAutoDeleteTimeChanged{} -) - -func (c *ChatEventMessageAutoDeleteTimeChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldMessageAutoDeleteTime == 0) { - return false - } - if !(c.NewMessageAutoDeleteTime == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventMessageAutoDeleteTimeChanged) String() string { - if c == nil { - return "ChatEventMessageAutoDeleteTimeChanged(nil)" - } - type Alias ChatEventMessageAutoDeleteTimeChanged - return fmt.Sprintf("ChatEventMessageAutoDeleteTimeChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventMessageAutoDeleteTimeChanged) TypeID() uint32 { - return ChatEventMessageAutoDeleteTimeChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventMessageAutoDeleteTimeChanged) TypeName() string { - return "chatEventMessageAutoDeleteTimeChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventMessageAutoDeleteTimeChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventMessageAutoDeleteTimeChanged", - ID: ChatEventMessageAutoDeleteTimeChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldMessageAutoDeleteTime", - SchemaName: "old_message_auto_delete_time", - }, - { - Name: "NewMessageAutoDeleteTime", - SchemaName: "new_message_auto_delete_time", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventMessageAutoDeleteTimeChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageAutoDeleteTimeChanged#1083f24 as nil") - } - b.PutID(ChatEventMessageAutoDeleteTimeChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventMessageAutoDeleteTimeChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageAutoDeleteTimeChanged#1083f24 as nil") - } - b.PutInt32(c.OldMessageAutoDeleteTime) - b.PutInt32(c.NewMessageAutoDeleteTime) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventMessageAutoDeleteTimeChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageAutoDeleteTimeChanged#1083f24 to nil") - } - if err := b.ConsumeID(ChatEventMessageAutoDeleteTimeChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventMessageAutoDeleteTimeChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageAutoDeleteTimeChanged#1083f24 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: field old_message_auto_delete_time: %w", err) - } - c.OldMessageAutoDeleteTime = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: field new_message_auto_delete_time: %w", err) - } - c.NewMessageAutoDeleteTime = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventMessageAutoDeleteTimeChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventMessageAutoDeleteTimeChanged#1083f24 as nil") - } - b.ObjStart() - b.PutID("chatEventMessageAutoDeleteTimeChanged") - b.Comma() - b.FieldStart("old_message_auto_delete_time") - b.PutInt32(c.OldMessageAutoDeleteTime) - b.Comma() - b.FieldStart("new_message_auto_delete_time") - b.PutInt32(c.NewMessageAutoDeleteTime) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventMessageAutoDeleteTimeChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventMessageAutoDeleteTimeChanged#1083f24 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventMessageAutoDeleteTimeChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: %w", err) - } - case "old_message_auto_delete_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: field old_message_auto_delete_time: %w", err) - } - c.OldMessageAutoDeleteTime = value - case "new_message_auto_delete_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventMessageAutoDeleteTimeChanged#1083f24: field new_message_auto_delete_time: %w", err) - } - c.NewMessageAutoDeleteTime = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldMessageAutoDeleteTime returns value of OldMessageAutoDeleteTime field. -func (c *ChatEventMessageAutoDeleteTimeChanged) GetOldMessageAutoDeleteTime() (value int32) { - if c == nil { - return - } - return c.OldMessageAutoDeleteTime -} - -// GetNewMessageAutoDeleteTime returns value of NewMessageAutoDeleteTime field. -func (c *ChatEventMessageAutoDeleteTimeChanged) GetNewMessageAutoDeleteTime() (value int32) { - if c == nil { - return - } - return c.NewMessageAutoDeleteTime -} - -// ChatEventPermissionsChanged represents TL type `chatEventPermissionsChanged#b1d337a8`. -type ChatEventPermissionsChanged struct { - // Previous chat permissions - OldPermissions ChatPermissions - // New chat permissions - NewPermissions ChatPermissions -} - -// ChatEventPermissionsChangedTypeID is TL type id of ChatEventPermissionsChanged. -const ChatEventPermissionsChangedTypeID = 0xb1d337a8 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventPermissionsChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventPermissionsChanged. -var ( - _ bin.Encoder = &ChatEventPermissionsChanged{} - _ bin.Decoder = &ChatEventPermissionsChanged{} - _ bin.BareEncoder = &ChatEventPermissionsChanged{} - _ bin.BareDecoder = &ChatEventPermissionsChanged{} - - _ ChatEventActionClass = &ChatEventPermissionsChanged{} -) - -func (c *ChatEventPermissionsChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldPermissions.Zero()) { - return false - } - if !(c.NewPermissions.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventPermissionsChanged) String() string { - if c == nil { - return "ChatEventPermissionsChanged(nil)" - } - type Alias ChatEventPermissionsChanged - return fmt.Sprintf("ChatEventPermissionsChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventPermissionsChanged) TypeID() uint32 { - return ChatEventPermissionsChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventPermissionsChanged) TypeName() string { - return "chatEventPermissionsChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventPermissionsChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventPermissionsChanged", - ID: ChatEventPermissionsChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldPermissions", - SchemaName: "old_permissions", - }, - { - Name: "NewPermissions", - SchemaName: "new_permissions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventPermissionsChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil") - } - b.PutID(ChatEventPermissionsChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventPermissionsChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil") - } - if err := c.OldPermissions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) - } - if err := c.NewPermissions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventPermissionsChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil") - } - if err := b.ConsumeID(ChatEventPermissionsChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventPermissionsChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil") - } - { - if err := c.OldPermissions.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) - } - } - { - if err := c.NewPermissions.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventPermissionsChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPermissionsChanged#b1d337a8 as nil") - } - b.ObjStart() - b.PutID("chatEventPermissionsChanged") - b.Comma() - b.FieldStart("old_permissions") - if err := c.OldPermissions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) - } - b.Comma() - b.FieldStart("new_permissions") - if err := c.NewPermissions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventPermissionsChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPermissionsChanged#b1d337a8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventPermissionsChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: %w", err) - } - case "old_permissions": - if err := c.OldPermissions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field old_permissions: %w", err) - } - case "new_permissions": - if err := c.NewPermissions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventPermissionsChanged#b1d337a8: field new_permissions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOldPermissions returns value of OldPermissions field. -func (c *ChatEventPermissionsChanged) GetOldPermissions() (value ChatPermissions) { - if c == nil { - return - } - return c.OldPermissions -} - -// GetNewPermissions returns value of NewPermissions field. -func (c *ChatEventPermissionsChanged) GetNewPermissions() (value ChatPermissions) { - if c == nil { - return - } - return c.NewPermissions -} - -// ChatEventPhotoChanged represents TL type `chatEventPhotoChanged#cfa062c3`. -type ChatEventPhotoChanged struct { - // Previous chat photo value; may be null - OldPhoto ChatPhoto - // New chat photo value; may be null - NewPhoto ChatPhoto -} - -// ChatEventPhotoChangedTypeID is TL type id of ChatEventPhotoChanged. -const ChatEventPhotoChangedTypeID = 0xcfa062c3 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventPhotoChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventPhotoChanged. -var ( - _ bin.Encoder = &ChatEventPhotoChanged{} - _ bin.Decoder = &ChatEventPhotoChanged{} - _ bin.BareEncoder = &ChatEventPhotoChanged{} - _ bin.BareDecoder = &ChatEventPhotoChanged{} - - _ ChatEventActionClass = &ChatEventPhotoChanged{} -) - -func (c *ChatEventPhotoChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldPhoto.Zero()) { - return false - } - if !(c.NewPhoto.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventPhotoChanged) String() string { - if c == nil { - return "ChatEventPhotoChanged(nil)" - } - type Alias ChatEventPhotoChanged - return fmt.Sprintf("ChatEventPhotoChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventPhotoChanged) TypeID() uint32 { - return ChatEventPhotoChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventPhotoChanged) TypeName() string { - return "chatEventPhotoChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventPhotoChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventPhotoChanged", - ID: ChatEventPhotoChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldPhoto", - SchemaName: "old_photo", - }, - { - Name: "NewPhoto", - SchemaName: "new_photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventPhotoChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil") - } - b.PutID(ChatEventPhotoChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventPhotoChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil") - } - if err := c.OldPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) - } - if err := c.NewPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventPhotoChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil") - } - if err := b.ConsumeID(ChatEventPhotoChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventPhotoChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil") - } - { - if err := c.OldPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) - } - } - { - if err := c.NewPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventPhotoChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventPhotoChanged#cfa062c3 as nil") - } - b.ObjStart() - b.PutID("chatEventPhotoChanged") - b.Comma() - b.FieldStart("old_photo") - if err := c.OldPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) - } - b.Comma() - b.FieldStart("new_photo") - if err := c.NewPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventPhotoChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventPhotoChanged#cfa062c3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventPhotoChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: %w", err) - } - case "old_photo": - if err := c.OldPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field old_photo: %w", err) - } - case "new_photo": - if err := c.NewPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventPhotoChanged#cfa062c3: field new_photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOldPhoto returns value of OldPhoto field. -func (c *ChatEventPhotoChanged) GetOldPhoto() (value ChatPhoto) { - if c == nil { - return - } - return c.OldPhoto -} - -// GetNewPhoto returns value of NewPhoto field. -func (c *ChatEventPhotoChanged) GetNewPhoto() (value ChatPhoto) { - if c == nil { - return - } - return c.NewPhoto -} - -// ChatEventSlowModeDelayChanged represents TL type `chatEventSlowModeDelayChanged#9d763c0b`. -type ChatEventSlowModeDelayChanged struct { - // Previous value of slow_mode_delay, in seconds - OldSlowModeDelay int32 - // New value of slow_mode_delay, in seconds - NewSlowModeDelay int32 -} - -// ChatEventSlowModeDelayChangedTypeID is TL type id of ChatEventSlowModeDelayChanged. -const ChatEventSlowModeDelayChangedTypeID = 0x9d763c0b - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventSlowModeDelayChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventSlowModeDelayChanged. -var ( - _ bin.Encoder = &ChatEventSlowModeDelayChanged{} - _ bin.Decoder = &ChatEventSlowModeDelayChanged{} - _ bin.BareEncoder = &ChatEventSlowModeDelayChanged{} - _ bin.BareDecoder = &ChatEventSlowModeDelayChanged{} - - _ ChatEventActionClass = &ChatEventSlowModeDelayChanged{} -) - -func (c *ChatEventSlowModeDelayChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldSlowModeDelay == 0) { - return false - } - if !(c.NewSlowModeDelay == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventSlowModeDelayChanged) String() string { - if c == nil { - return "ChatEventSlowModeDelayChanged(nil)" - } - type Alias ChatEventSlowModeDelayChanged - return fmt.Sprintf("ChatEventSlowModeDelayChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventSlowModeDelayChanged) TypeID() uint32 { - return ChatEventSlowModeDelayChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventSlowModeDelayChanged) TypeName() string { - return "chatEventSlowModeDelayChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventSlowModeDelayChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventSlowModeDelayChanged", - ID: ChatEventSlowModeDelayChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldSlowModeDelay", - SchemaName: "old_slow_mode_delay", - }, - { - Name: "NewSlowModeDelay", - SchemaName: "new_slow_mode_delay", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventSlowModeDelayChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventSlowModeDelayChanged#9d763c0b as nil") - } - b.PutID(ChatEventSlowModeDelayChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventSlowModeDelayChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventSlowModeDelayChanged#9d763c0b as nil") - } - b.PutInt32(c.OldSlowModeDelay) - b.PutInt32(c.NewSlowModeDelay) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventSlowModeDelayChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventSlowModeDelayChanged#9d763c0b to nil") - } - if err := b.ConsumeID(ChatEventSlowModeDelayChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventSlowModeDelayChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventSlowModeDelayChanged#9d763c0b to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: field old_slow_mode_delay: %w", err) - } - c.OldSlowModeDelay = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: field new_slow_mode_delay: %w", err) - } - c.NewSlowModeDelay = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventSlowModeDelayChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventSlowModeDelayChanged#9d763c0b as nil") - } - b.ObjStart() - b.PutID("chatEventSlowModeDelayChanged") - b.Comma() - b.FieldStart("old_slow_mode_delay") - b.PutInt32(c.OldSlowModeDelay) - b.Comma() - b.FieldStart("new_slow_mode_delay") - b.PutInt32(c.NewSlowModeDelay) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventSlowModeDelayChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventSlowModeDelayChanged#9d763c0b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventSlowModeDelayChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: %w", err) - } - case "old_slow_mode_delay": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: field old_slow_mode_delay: %w", err) - } - c.OldSlowModeDelay = value - case "new_slow_mode_delay": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventSlowModeDelayChanged#9d763c0b: field new_slow_mode_delay: %w", err) - } - c.NewSlowModeDelay = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldSlowModeDelay returns value of OldSlowModeDelay field. -func (c *ChatEventSlowModeDelayChanged) GetOldSlowModeDelay() (value int32) { - if c == nil { - return - } - return c.OldSlowModeDelay -} - -// GetNewSlowModeDelay returns value of NewSlowModeDelay field. -func (c *ChatEventSlowModeDelayChanged) GetNewSlowModeDelay() (value int32) { - if c == nil { - return - } - return c.NewSlowModeDelay -} - -// ChatEventStickerSetChanged represents TL type `chatEventStickerSetChanged#b5e7558f`. -type ChatEventStickerSetChanged struct { - // Previous identifier of the chat sticker set; 0 if none - OldStickerSetID int64 - // New identifier of the chat sticker set; 0 if none - NewStickerSetID int64 -} - -// ChatEventStickerSetChangedTypeID is TL type id of ChatEventStickerSetChanged. -const ChatEventStickerSetChangedTypeID = 0xb5e7558f - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventStickerSetChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventStickerSetChanged. -var ( - _ bin.Encoder = &ChatEventStickerSetChanged{} - _ bin.Decoder = &ChatEventStickerSetChanged{} - _ bin.BareEncoder = &ChatEventStickerSetChanged{} - _ bin.BareDecoder = &ChatEventStickerSetChanged{} - - _ ChatEventActionClass = &ChatEventStickerSetChanged{} -) - -func (c *ChatEventStickerSetChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldStickerSetID == 0) { - return false - } - if !(c.NewStickerSetID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventStickerSetChanged) String() string { - if c == nil { - return "ChatEventStickerSetChanged(nil)" - } - type Alias ChatEventStickerSetChanged - return fmt.Sprintf("ChatEventStickerSetChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventStickerSetChanged) TypeID() uint32 { - return ChatEventStickerSetChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventStickerSetChanged) TypeName() string { - return "chatEventStickerSetChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventStickerSetChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventStickerSetChanged", - ID: ChatEventStickerSetChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldStickerSetID", - SchemaName: "old_sticker_set_id", - }, - { - Name: "NewStickerSetID", - SchemaName: "new_sticker_set_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventStickerSetChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil") - } - b.PutID(ChatEventStickerSetChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventStickerSetChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil") - } - b.PutLong(c.OldStickerSetID) - b.PutLong(c.NewStickerSetID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventStickerSetChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil") - } - if err := b.ConsumeID(ChatEventStickerSetChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventStickerSetChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field old_sticker_set_id: %w", err) - } - c.OldStickerSetID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field new_sticker_set_id: %w", err) - } - c.NewStickerSetID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventStickerSetChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventStickerSetChanged#b5e7558f as nil") - } - b.ObjStart() - b.PutID("chatEventStickerSetChanged") - b.Comma() - b.FieldStart("old_sticker_set_id") - b.PutLong(c.OldStickerSetID) - b.Comma() - b.FieldStart("new_sticker_set_id") - b.PutLong(c.NewStickerSetID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventStickerSetChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventStickerSetChanged#b5e7558f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventStickerSetChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: %w", err) - } - case "old_sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field old_sticker_set_id: %w", err) - } - c.OldStickerSetID = value - case "new_sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventStickerSetChanged#b5e7558f: field new_sticker_set_id: %w", err) - } - c.NewStickerSetID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldStickerSetID returns value of OldStickerSetID field. -func (c *ChatEventStickerSetChanged) GetOldStickerSetID() (value int64) { - if c == nil { - return - } - return c.OldStickerSetID -} - -// GetNewStickerSetID returns value of NewStickerSetID field. -func (c *ChatEventStickerSetChanged) GetNewStickerSetID() (value int64) { - if c == nil { - return - } - return c.NewStickerSetID -} - -// ChatEventCustomEmojiStickerSetChanged represents TL type `chatEventCustomEmojiStickerSetChanged#70c431b`. -type ChatEventCustomEmojiStickerSetChanged struct { - // Previous identifier of the chat sticker set; 0 if none - OldStickerSetID int64 - // New identifier of the chat sticker set; 0 if none - NewStickerSetID int64 -} - -// ChatEventCustomEmojiStickerSetChangedTypeID is TL type id of ChatEventCustomEmojiStickerSetChanged. -const ChatEventCustomEmojiStickerSetChangedTypeID = 0x70c431b - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventCustomEmojiStickerSetChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventCustomEmojiStickerSetChanged. -var ( - _ bin.Encoder = &ChatEventCustomEmojiStickerSetChanged{} - _ bin.Decoder = &ChatEventCustomEmojiStickerSetChanged{} - _ bin.BareEncoder = &ChatEventCustomEmojiStickerSetChanged{} - _ bin.BareDecoder = &ChatEventCustomEmojiStickerSetChanged{} - - _ ChatEventActionClass = &ChatEventCustomEmojiStickerSetChanged{} -) - -func (c *ChatEventCustomEmojiStickerSetChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldStickerSetID == 0) { - return false - } - if !(c.NewStickerSetID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventCustomEmojiStickerSetChanged) String() string { - if c == nil { - return "ChatEventCustomEmojiStickerSetChanged(nil)" - } - type Alias ChatEventCustomEmojiStickerSetChanged - return fmt.Sprintf("ChatEventCustomEmojiStickerSetChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventCustomEmojiStickerSetChanged) TypeID() uint32 { - return ChatEventCustomEmojiStickerSetChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventCustomEmojiStickerSetChanged) TypeName() string { - return "chatEventCustomEmojiStickerSetChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventCustomEmojiStickerSetChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventCustomEmojiStickerSetChanged", - ID: ChatEventCustomEmojiStickerSetChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldStickerSetID", - SchemaName: "old_sticker_set_id", - }, - { - Name: "NewStickerSetID", - SchemaName: "new_sticker_set_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventCustomEmojiStickerSetChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventCustomEmojiStickerSetChanged#70c431b as nil") - } - b.PutID(ChatEventCustomEmojiStickerSetChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventCustomEmojiStickerSetChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventCustomEmojiStickerSetChanged#70c431b as nil") - } - b.PutLong(c.OldStickerSetID) - b.PutLong(c.NewStickerSetID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventCustomEmojiStickerSetChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventCustomEmojiStickerSetChanged#70c431b to nil") - } - if err := b.ConsumeID(ChatEventCustomEmojiStickerSetChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventCustomEmojiStickerSetChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventCustomEmojiStickerSetChanged#70c431b to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field old_sticker_set_id: %w", err) - } - c.OldStickerSetID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field new_sticker_set_id: %w", err) - } - c.NewStickerSetID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventCustomEmojiStickerSetChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventCustomEmojiStickerSetChanged#70c431b as nil") - } - b.ObjStart() - b.PutID("chatEventCustomEmojiStickerSetChanged") - b.Comma() - b.FieldStart("old_sticker_set_id") - b.PutLong(c.OldStickerSetID) - b.Comma() - b.FieldStart("new_sticker_set_id") - b.PutLong(c.NewStickerSetID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventCustomEmojiStickerSetChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventCustomEmojiStickerSetChanged#70c431b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventCustomEmojiStickerSetChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: %w", err) - } - case "old_sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field old_sticker_set_id: %w", err) - } - c.OldStickerSetID = value - case "new_sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventCustomEmojiStickerSetChanged#70c431b: field new_sticker_set_id: %w", err) - } - c.NewStickerSetID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldStickerSetID returns value of OldStickerSetID field. -func (c *ChatEventCustomEmojiStickerSetChanged) GetOldStickerSetID() (value int64) { - if c == nil { - return - } - return c.OldStickerSetID -} - -// GetNewStickerSetID returns value of NewStickerSetID field. -func (c *ChatEventCustomEmojiStickerSetChanged) GetNewStickerSetID() (value int64) { - if c == nil { - return - } - return c.NewStickerSetID -} - -// ChatEventTitleChanged represents TL type `chatEventTitleChanged#43990ad2`. -type ChatEventTitleChanged struct { - // Previous chat title - OldTitle string - // New chat title - NewTitle string -} - -// ChatEventTitleChangedTypeID is TL type id of ChatEventTitleChanged. -const ChatEventTitleChangedTypeID = 0x43990ad2 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventTitleChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventTitleChanged. -var ( - _ bin.Encoder = &ChatEventTitleChanged{} - _ bin.Decoder = &ChatEventTitleChanged{} - _ bin.BareEncoder = &ChatEventTitleChanged{} - _ bin.BareDecoder = &ChatEventTitleChanged{} - - _ ChatEventActionClass = &ChatEventTitleChanged{} -) - -func (c *ChatEventTitleChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldTitle == "") { - return false - } - if !(c.NewTitle == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventTitleChanged) String() string { - if c == nil { - return "ChatEventTitleChanged(nil)" - } - type Alias ChatEventTitleChanged - return fmt.Sprintf("ChatEventTitleChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventTitleChanged) TypeID() uint32 { - return ChatEventTitleChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventTitleChanged) TypeName() string { - return "chatEventTitleChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventTitleChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventTitleChanged", - ID: ChatEventTitleChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldTitle", - SchemaName: "old_title", - }, - { - Name: "NewTitle", - SchemaName: "new_title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventTitleChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil") - } - b.PutID(ChatEventTitleChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventTitleChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil") - } - b.PutString(c.OldTitle) - b.PutString(c.NewTitle) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventTitleChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil") - } - if err := b.ConsumeID(ChatEventTitleChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventTitleChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field old_title: %w", err) - } - c.OldTitle = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field new_title: %w", err) - } - c.NewTitle = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventTitleChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventTitleChanged#43990ad2 as nil") - } - b.ObjStart() - b.PutID("chatEventTitleChanged") - b.Comma() - b.FieldStart("old_title") - b.PutString(c.OldTitle) - b.Comma() - b.FieldStart("new_title") - b.PutString(c.NewTitle) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventTitleChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventTitleChanged#43990ad2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventTitleChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: %w", err) - } - case "old_title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field old_title: %w", err) - } - c.OldTitle = value - case "new_title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventTitleChanged#43990ad2: field new_title: %w", err) - } - c.NewTitle = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldTitle returns value of OldTitle field. -func (c *ChatEventTitleChanged) GetOldTitle() (value string) { - if c == nil { - return - } - return c.OldTitle -} - -// GetNewTitle returns value of NewTitle field. -func (c *ChatEventTitleChanged) GetNewTitle() (value string) { - if c == nil { - return - } - return c.NewTitle -} - -// ChatEventUsernameChanged represents TL type `chatEventUsernameChanged#6707b56b`. -type ChatEventUsernameChanged struct { - // Previous chat username - OldUsername string - // New chat username - NewUsername string -} - -// ChatEventUsernameChangedTypeID is TL type id of ChatEventUsernameChanged. -const ChatEventUsernameChangedTypeID = 0x6707b56b - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventUsernameChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventUsernameChanged. -var ( - _ bin.Encoder = &ChatEventUsernameChanged{} - _ bin.Decoder = &ChatEventUsernameChanged{} - _ bin.BareEncoder = &ChatEventUsernameChanged{} - _ bin.BareDecoder = &ChatEventUsernameChanged{} - - _ ChatEventActionClass = &ChatEventUsernameChanged{} -) - -func (c *ChatEventUsernameChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldUsername == "") { - return false - } - if !(c.NewUsername == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventUsernameChanged) String() string { - if c == nil { - return "ChatEventUsernameChanged(nil)" - } - type Alias ChatEventUsernameChanged - return fmt.Sprintf("ChatEventUsernameChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventUsernameChanged) TypeID() uint32 { - return ChatEventUsernameChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventUsernameChanged) TypeName() string { - return "chatEventUsernameChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventUsernameChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventUsernameChanged", - ID: ChatEventUsernameChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldUsername", - SchemaName: "old_username", - }, - { - Name: "NewUsername", - SchemaName: "new_username", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventUsernameChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil") - } - b.PutID(ChatEventUsernameChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventUsernameChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil") - } - b.PutString(c.OldUsername) - b.PutString(c.NewUsername) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventUsernameChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil") - } - if err := b.ConsumeID(ChatEventUsernameChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventUsernameChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field old_username: %w", err) - } - c.OldUsername = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field new_username: %w", err) - } - c.NewUsername = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventUsernameChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventUsernameChanged#6707b56b as nil") - } - b.ObjStart() - b.PutID("chatEventUsernameChanged") - b.Comma() - b.FieldStart("old_username") - b.PutString(c.OldUsername) - b.Comma() - b.FieldStart("new_username") - b.PutString(c.NewUsername) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventUsernameChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventUsernameChanged#6707b56b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventUsernameChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: %w", err) - } - case "old_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field old_username: %w", err) - } - c.OldUsername = value - case "new_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventUsernameChanged#6707b56b: field new_username: %w", err) - } - c.NewUsername = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldUsername returns value of OldUsername field. -func (c *ChatEventUsernameChanged) GetOldUsername() (value string) { - if c == nil { - return - } - return c.OldUsername -} - -// GetNewUsername returns value of NewUsername field. -func (c *ChatEventUsernameChanged) GetNewUsername() (value string) { - if c == nil { - return - } - return c.NewUsername -} - -// ChatEventActiveUsernamesChanged represents TL type `chatEventActiveUsernamesChanged#95e54656`. -type ChatEventActiveUsernamesChanged struct { - // Previous list of active usernames - OldUsernames []string - // New list of active usernames - NewUsernames []string -} - -// ChatEventActiveUsernamesChangedTypeID is TL type id of ChatEventActiveUsernamesChanged. -const ChatEventActiveUsernamesChangedTypeID = 0x95e54656 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventActiveUsernamesChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventActiveUsernamesChanged. -var ( - _ bin.Encoder = &ChatEventActiveUsernamesChanged{} - _ bin.Decoder = &ChatEventActiveUsernamesChanged{} - _ bin.BareEncoder = &ChatEventActiveUsernamesChanged{} - _ bin.BareDecoder = &ChatEventActiveUsernamesChanged{} - - _ ChatEventActionClass = &ChatEventActiveUsernamesChanged{} -) - -func (c *ChatEventActiveUsernamesChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldUsernames == nil) { - return false - } - if !(c.NewUsernames == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventActiveUsernamesChanged) String() string { - if c == nil { - return "ChatEventActiveUsernamesChanged(nil)" - } - type Alias ChatEventActiveUsernamesChanged - return fmt.Sprintf("ChatEventActiveUsernamesChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventActiveUsernamesChanged) TypeID() uint32 { - return ChatEventActiveUsernamesChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventActiveUsernamesChanged) TypeName() string { - return "chatEventActiveUsernamesChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventActiveUsernamesChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventActiveUsernamesChanged", - ID: ChatEventActiveUsernamesChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldUsernames", - SchemaName: "old_usernames", - }, - { - Name: "NewUsernames", - SchemaName: "new_usernames", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventActiveUsernamesChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventActiveUsernamesChanged#95e54656 as nil") - } - b.PutID(ChatEventActiveUsernamesChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventActiveUsernamesChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventActiveUsernamesChanged#95e54656 as nil") - } - b.PutInt(len(c.OldUsernames)) - for _, v := range c.OldUsernames { - b.PutString(v) - } - b.PutInt(len(c.NewUsernames)) - for _, v := range c.NewUsernames { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventActiveUsernamesChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventActiveUsernamesChanged#95e54656 to nil") - } - if err := b.ConsumeID(ChatEventActiveUsernamesChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventActiveUsernamesChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventActiveUsernamesChanged#95e54656 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field old_usernames: %w", err) - } - - if headerLen > 0 { - c.OldUsernames = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field old_usernames: %w", err) - } - c.OldUsernames = append(c.OldUsernames, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field new_usernames: %w", err) - } - - if headerLen > 0 { - c.NewUsernames = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field new_usernames: %w", err) - } - c.NewUsernames = append(c.NewUsernames, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventActiveUsernamesChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventActiveUsernamesChanged#95e54656 as nil") - } - b.ObjStart() - b.PutID("chatEventActiveUsernamesChanged") - b.Comma() - b.FieldStart("old_usernames") - b.ArrStart() - for _, v := range c.OldUsernames { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("new_usernames") - b.ArrStart() - for _, v := range c.NewUsernames { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventActiveUsernamesChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventActiveUsernamesChanged#95e54656 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventActiveUsernamesChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: %w", err) - } - case "old_usernames": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field old_usernames: %w", err) - } - c.OldUsernames = append(c.OldUsernames, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field old_usernames: %w", err) - } - case "new_usernames": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field new_usernames: %w", err) - } - c.NewUsernames = append(c.NewUsernames, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatEventActiveUsernamesChanged#95e54656: field new_usernames: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOldUsernames returns value of OldUsernames field. -func (c *ChatEventActiveUsernamesChanged) GetOldUsernames() (value []string) { - if c == nil { - return - } - return c.OldUsernames -} - -// GetNewUsernames returns value of NewUsernames field. -func (c *ChatEventActiveUsernamesChanged) GetNewUsernames() (value []string) { - if c == nil { - return - } - return c.NewUsernames -} - -// ChatEventAccentColorChanged represents TL type `chatEventAccentColorChanged#e6837733`. -type ChatEventAccentColorChanged struct { - // Previous identifier of chat accent color - OldAccentColorID int32 - // Previous identifier of the custom emoji; 0 if none - OldBackgroundCustomEmojiID int64 - // New identifier of chat accent color - NewAccentColorID int32 - // New identifier of the custom emoji; 0 if none - NewBackgroundCustomEmojiID int64 -} - -// ChatEventAccentColorChangedTypeID is TL type id of ChatEventAccentColorChanged. -const ChatEventAccentColorChangedTypeID = 0xe6837733 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventAccentColorChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventAccentColorChanged. -var ( - _ bin.Encoder = &ChatEventAccentColorChanged{} - _ bin.Decoder = &ChatEventAccentColorChanged{} - _ bin.BareEncoder = &ChatEventAccentColorChanged{} - _ bin.BareDecoder = &ChatEventAccentColorChanged{} - - _ ChatEventActionClass = &ChatEventAccentColorChanged{} -) - -func (c *ChatEventAccentColorChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldAccentColorID == 0) { - return false - } - if !(c.OldBackgroundCustomEmojiID == 0) { - return false - } - if !(c.NewAccentColorID == 0) { - return false - } - if !(c.NewBackgroundCustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventAccentColorChanged) String() string { - if c == nil { - return "ChatEventAccentColorChanged(nil)" - } - type Alias ChatEventAccentColorChanged - return fmt.Sprintf("ChatEventAccentColorChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventAccentColorChanged) TypeID() uint32 { - return ChatEventAccentColorChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventAccentColorChanged) TypeName() string { - return "chatEventAccentColorChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventAccentColorChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventAccentColorChanged", - ID: ChatEventAccentColorChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldAccentColorID", - SchemaName: "old_accent_color_id", - }, - { - Name: "OldBackgroundCustomEmojiID", - SchemaName: "old_background_custom_emoji_id", - }, - { - Name: "NewAccentColorID", - SchemaName: "new_accent_color_id", - }, - { - Name: "NewBackgroundCustomEmojiID", - SchemaName: "new_background_custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventAccentColorChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventAccentColorChanged#e6837733 as nil") - } - b.PutID(ChatEventAccentColorChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventAccentColorChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventAccentColorChanged#e6837733 as nil") - } - b.PutInt32(c.OldAccentColorID) - b.PutLong(c.OldBackgroundCustomEmojiID) - b.PutInt32(c.NewAccentColorID) - b.PutLong(c.NewBackgroundCustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventAccentColorChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventAccentColorChanged#e6837733 to nil") - } - if err := b.ConsumeID(ChatEventAccentColorChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventAccentColorChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventAccentColorChanged#e6837733 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field old_accent_color_id: %w", err) - } - c.OldAccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field old_background_custom_emoji_id: %w", err) - } - c.OldBackgroundCustomEmojiID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field new_accent_color_id: %w", err) - } - c.NewAccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field new_background_custom_emoji_id: %w", err) - } - c.NewBackgroundCustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventAccentColorChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventAccentColorChanged#e6837733 as nil") - } - b.ObjStart() - b.PutID("chatEventAccentColorChanged") - b.Comma() - b.FieldStart("old_accent_color_id") - b.PutInt32(c.OldAccentColorID) - b.Comma() - b.FieldStart("old_background_custom_emoji_id") - b.PutLong(c.OldBackgroundCustomEmojiID) - b.Comma() - b.FieldStart("new_accent_color_id") - b.PutInt32(c.NewAccentColorID) - b.Comma() - b.FieldStart("new_background_custom_emoji_id") - b.PutLong(c.NewBackgroundCustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventAccentColorChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventAccentColorChanged#e6837733 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventAccentColorChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: %w", err) - } - case "old_accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field old_accent_color_id: %w", err) - } - c.OldAccentColorID = value - case "old_background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field old_background_custom_emoji_id: %w", err) - } - c.OldBackgroundCustomEmojiID = value - case "new_accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field new_accent_color_id: %w", err) - } - c.NewAccentColorID = value - case "new_background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventAccentColorChanged#e6837733: field new_background_custom_emoji_id: %w", err) - } - c.NewBackgroundCustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldAccentColorID returns value of OldAccentColorID field. -func (c *ChatEventAccentColorChanged) GetOldAccentColorID() (value int32) { - if c == nil { - return - } - return c.OldAccentColorID -} - -// GetOldBackgroundCustomEmojiID returns value of OldBackgroundCustomEmojiID field. -func (c *ChatEventAccentColorChanged) GetOldBackgroundCustomEmojiID() (value int64) { - if c == nil { - return - } - return c.OldBackgroundCustomEmojiID -} - -// GetNewAccentColorID returns value of NewAccentColorID field. -func (c *ChatEventAccentColorChanged) GetNewAccentColorID() (value int32) { - if c == nil { - return - } - return c.NewAccentColorID -} - -// GetNewBackgroundCustomEmojiID returns value of NewBackgroundCustomEmojiID field. -func (c *ChatEventAccentColorChanged) GetNewBackgroundCustomEmojiID() (value int64) { - if c == nil { - return - } - return c.NewBackgroundCustomEmojiID -} - -// ChatEventProfileAccentColorChanged represents TL type `chatEventProfileAccentColorChanged#a5b8da64`. -type ChatEventProfileAccentColorChanged struct { - // Previous identifier of chat's profile accent color; -1 if none - OldProfileAccentColorID int32 - // Previous identifier of the custom emoji; 0 if none - OldProfileBackgroundCustomEmojiID int64 - // New identifier of chat's profile accent color; -1 if none - NewProfileAccentColorID int32 - // New identifier of the custom emoji; 0 if none - NewProfileBackgroundCustomEmojiID int64 -} - -// ChatEventProfileAccentColorChangedTypeID is TL type id of ChatEventProfileAccentColorChanged. -const ChatEventProfileAccentColorChangedTypeID = 0xa5b8da64 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventProfileAccentColorChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventProfileAccentColorChanged. -var ( - _ bin.Encoder = &ChatEventProfileAccentColorChanged{} - _ bin.Decoder = &ChatEventProfileAccentColorChanged{} - _ bin.BareEncoder = &ChatEventProfileAccentColorChanged{} - _ bin.BareDecoder = &ChatEventProfileAccentColorChanged{} - - _ ChatEventActionClass = &ChatEventProfileAccentColorChanged{} -) - -func (c *ChatEventProfileAccentColorChanged) Zero() bool { - if c == nil { - return true - } - if !(c.OldProfileAccentColorID == 0) { - return false - } - if !(c.OldProfileBackgroundCustomEmojiID == 0) { - return false - } - if !(c.NewProfileAccentColorID == 0) { - return false - } - if !(c.NewProfileBackgroundCustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventProfileAccentColorChanged) String() string { - if c == nil { - return "ChatEventProfileAccentColorChanged(nil)" - } - type Alias ChatEventProfileAccentColorChanged - return fmt.Sprintf("ChatEventProfileAccentColorChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventProfileAccentColorChanged) TypeID() uint32 { - return ChatEventProfileAccentColorChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventProfileAccentColorChanged) TypeName() string { - return "chatEventProfileAccentColorChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventProfileAccentColorChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventProfileAccentColorChanged", - ID: ChatEventProfileAccentColorChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldProfileAccentColorID", - SchemaName: "old_profile_accent_color_id", - }, - { - Name: "OldProfileBackgroundCustomEmojiID", - SchemaName: "old_profile_background_custom_emoji_id", - }, - { - Name: "NewProfileAccentColorID", - SchemaName: "new_profile_accent_color_id", - }, - { - Name: "NewProfileBackgroundCustomEmojiID", - SchemaName: "new_profile_background_custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventProfileAccentColorChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventProfileAccentColorChanged#a5b8da64 as nil") - } - b.PutID(ChatEventProfileAccentColorChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventProfileAccentColorChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventProfileAccentColorChanged#a5b8da64 as nil") - } - b.PutInt32(c.OldProfileAccentColorID) - b.PutLong(c.OldProfileBackgroundCustomEmojiID) - b.PutInt32(c.NewProfileAccentColorID) - b.PutLong(c.NewProfileBackgroundCustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventProfileAccentColorChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventProfileAccentColorChanged#a5b8da64 to nil") - } - if err := b.ConsumeID(ChatEventProfileAccentColorChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventProfileAccentColorChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventProfileAccentColorChanged#a5b8da64 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field old_profile_accent_color_id: %w", err) - } - c.OldProfileAccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field old_profile_background_custom_emoji_id: %w", err) - } - c.OldProfileBackgroundCustomEmojiID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field new_profile_accent_color_id: %w", err) - } - c.NewProfileAccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field new_profile_background_custom_emoji_id: %w", err) - } - c.NewProfileBackgroundCustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventProfileAccentColorChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventProfileAccentColorChanged#a5b8da64 as nil") - } - b.ObjStart() - b.PutID("chatEventProfileAccentColorChanged") - b.Comma() - b.FieldStart("old_profile_accent_color_id") - b.PutInt32(c.OldProfileAccentColorID) - b.Comma() - b.FieldStart("old_profile_background_custom_emoji_id") - b.PutLong(c.OldProfileBackgroundCustomEmojiID) - b.Comma() - b.FieldStart("new_profile_accent_color_id") - b.PutInt32(c.NewProfileAccentColorID) - b.Comma() - b.FieldStart("new_profile_background_custom_emoji_id") - b.PutLong(c.NewProfileBackgroundCustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventProfileAccentColorChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventProfileAccentColorChanged#a5b8da64 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventProfileAccentColorChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: %w", err) - } - case "old_profile_accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field old_profile_accent_color_id: %w", err) - } - c.OldProfileAccentColorID = value - case "old_profile_background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field old_profile_background_custom_emoji_id: %w", err) - } - c.OldProfileBackgroundCustomEmojiID = value - case "new_profile_accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field new_profile_accent_color_id: %w", err) - } - c.NewProfileAccentColorID = value - case "new_profile_background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEventProfileAccentColorChanged#a5b8da64: field new_profile_background_custom_emoji_id: %w", err) - } - c.NewProfileBackgroundCustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldProfileAccentColorID returns value of OldProfileAccentColorID field. -func (c *ChatEventProfileAccentColorChanged) GetOldProfileAccentColorID() (value int32) { - if c == nil { - return - } - return c.OldProfileAccentColorID -} - -// GetOldProfileBackgroundCustomEmojiID returns value of OldProfileBackgroundCustomEmojiID field. -func (c *ChatEventProfileAccentColorChanged) GetOldProfileBackgroundCustomEmojiID() (value int64) { - if c == nil { - return - } - return c.OldProfileBackgroundCustomEmojiID -} - -// GetNewProfileAccentColorID returns value of NewProfileAccentColorID field. -func (c *ChatEventProfileAccentColorChanged) GetNewProfileAccentColorID() (value int32) { - if c == nil { - return - } - return c.NewProfileAccentColorID -} - -// GetNewProfileBackgroundCustomEmojiID returns value of NewProfileBackgroundCustomEmojiID field. -func (c *ChatEventProfileAccentColorChanged) GetNewProfileBackgroundCustomEmojiID() (value int64) { - if c == nil { - return - } - return c.NewProfileBackgroundCustomEmojiID -} - -// ChatEventHasProtectedContentToggled represents TL type `chatEventHasProtectedContentToggled#f5044201`. -type ChatEventHasProtectedContentToggled struct { - // New value of has_protected_content - HasProtectedContent bool -} - -// ChatEventHasProtectedContentToggledTypeID is TL type id of ChatEventHasProtectedContentToggled. -const ChatEventHasProtectedContentToggledTypeID = 0xf5044201 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventHasProtectedContentToggled) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventHasProtectedContentToggled. -var ( - _ bin.Encoder = &ChatEventHasProtectedContentToggled{} - _ bin.Decoder = &ChatEventHasProtectedContentToggled{} - _ bin.BareEncoder = &ChatEventHasProtectedContentToggled{} - _ bin.BareDecoder = &ChatEventHasProtectedContentToggled{} - - _ ChatEventActionClass = &ChatEventHasProtectedContentToggled{} -) - -func (c *ChatEventHasProtectedContentToggled) Zero() bool { - if c == nil { - return true - } - if !(c.HasProtectedContent == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventHasProtectedContentToggled) String() string { - if c == nil { - return "ChatEventHasProtectedContentToggled(nil)" - } - type Alias ChatEventHasProtectedContentToggled - return fmt.Sprintf("ChatEventHasProtectedContentToggled%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventHasProtectedContentToggled) TypeID() uint32 { - return ChatEventHasProtectedContentToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventHasProtectedContentToggled) TypeName() string { - return "chatEventHasProtectedContentToggled" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventHasProtectedContentToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventHasProtectedContentToggled", - ID: ChatEventHasProtectedContentToggledTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "HasProtectedContent", - SchemaName: "has_protected_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventHasProtectedContentToggled) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil") - } - b.PutID(ChatEventHasProtectedContentToggledTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventHasProtectedContentToggled) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil") - } - b.PutBool(c.HasProtectedContent) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventHasProtectedContentToggled) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil") - } - if err := b.ConsumeID(ChatEventHasProtectedContentToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventHasProtectedContentToggled) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: field has_protected_content: %w", err) - } - c.HasProtectedContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventHasProtectedContentToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventHasProtectedContentToggled#f5044201 as nil") - } - b.ObjStart() - b.PutID("chatEventHasProtectedContentToggled") - b.Comma() - b.FieldStart("has_protected_content") - b.PutBool(c.HasProtectedContent) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventHasProtectedContentToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventHasProtectedContentToggled#f5044201 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventHasProtectedContentToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: %w", err) - } - case "has_protected_content": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventHasProtectedContentToggled#f5044201: field has_protected_content: %w", err) - } - c.HasProtectedContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetHasProtectedContent returns value of HasProtectedContent field. -func (c *ChatEventHasProtectedContentToggled) GetHasProtectedContent() (value bool) { - if c == nil { - return - } - return c.HasProtectedContent -} - -// ChatEventInvitesToggled represents TL type `chatEventInvitesToggled#fc45966b`. -type ChatEventInvitesToggled struct { - // New value of can_invite_users permission - CanInviteUsers bool -} - -// ChatEventInvitesToggledTypeID is TL type id of ChatEventInvitesToggled. -const ChatEventInvitesToggledTypeID = 0xfc45966b - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventInvitesToggled) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventInvitesToggled. -var ( - _ bin.Encoder = &ChatEventInvitesToggled{} - _ bin.Decoder = &ChatEventInvitesToggled{} - _ bin.BareEncoder = &ChatEventInvitesToggled{} - _ bin.BareDecoder = &ChatEventInvitesToggled{} - - _ ChatEventActionClass = &ChatEventInvitesToggled{} -) - -func (c *ChatEventInvitesToggled) Zero() bool { - if c == nil { - return true - } - if !(c.CanInviteUsers == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventInvitesToggled) String() string { - if c == nil { - return "ChatEventInvitesToggled(nil)" - } - type Alias ChatEventInvitesToggled - return fmt.Sprintf("ChatEventInvitesToggled%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventInvitesToggled) TypeID() uint32 { - return ChatEventInvitesToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventInvitesToggled) TypeName() string { - return "chatEventInvitesToggled" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventInvitesToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventInvitesToggled", - ID: ChatEventInvitesToggledTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CanInviteUsers", - SchemaName: "can_invite_users", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventInvitesToggled) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil") - } - b.PutID(ChatEventInvitesToggledTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventInvitesToggled) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil") - } - b.PutBool(c.CanInviteUsers) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventInvitesToggled) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil") - } - if err := b.ConsumeID(ChatEventInvitesToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventInvitesToggled) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: field can_invite_users: %w", err) - } - c.CanInviteUsers = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventInvitesToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInvitesToggled#fc45966b as nil") - } - b.ObjStart() - b.PutID("chatEventInvitesToggled") - b.Comma() - b.FieldStart("can_invite_users") - b.PutBool(c.CanInviteUsers) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventInvitesToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInvitesToggled#fc45966b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventInvitesToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: %w", err) - } - case "can_invite_users": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventInvitesToggled#fc45966b: field can_invite_users: %w", err) - } - c.CanInviteUsers = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCanInviteUsers returns value of CanInviteUsers field. -func (c *ChatEventInvitesToggled) GetCanInviteUsers() (value bool) { - if c == nil { - return - } - return c.CanInviteUsers -} - -// ChatEventIsAllHistoryAvailableToggled represents TL type `chatEventIsAllHistoryAvailableToggled#a0b03c15`. -type ChatEventIsAllHistoryAvailableToggled struct { - // New value of is_all_history_available - IsAllHistoryAvailable bool -} - -// ChatEventIsAllHistoryAvailableToggledTypeID is TL type id of ChatEventIsAllHistoryAvailableToggled. -const ChatEventIsAllHistoryAvailableToggledTypeID = 0xa0b03c15 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventIsAllHistoryAvailableToggled) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventIsAllHistoryAvailableToggled. -var ( - _ bin.Encoder = &ChatEventIsAllHistoryAvailableToggled{} - _ bin.Decoder = &ChatEventIsAllHistoryAvailableToggled{} - _ bin.BareEncoder = &ChatEventIsAllHistoryAvailableToggled{} - _ bin.BareDecoder = &ChatEventIsAllHistoryAvailableToggled{} - - _ ChatEventActionClass = &ChatEventIsAllHistoryAvailableToggled{} -) - -func (c *ChatEventIsAllHistoryAvailableToggled) Zero() bool { - if c == nil { - return true - } - if !(c.IsAllHistoryAvailable == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventIsAllHistoryAvailableToggled) String() string { - if c == nil { - return "ChatEventIsAllHistoryAvailableToggled(nil)" - } - type Alias ChatEventIsAllHistoryAvailableToggled - return fmt.Sprintf("ChatEventIsAllHistoryAvailableToggled%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventIsAllHistoryAvailableToggled) TypeID() uint32 { - return ChatEventIsAllHistoryAvailableToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventIsAllHistoryAvailableToggled) TypeName() string { - return "chatEventIsAllHistoryAvailableToggled" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventIsAllHistoryAvailableToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventIsAllHistoryAvailableToggled", - ID: ChatEventIsAllHistoryAvailableToggledTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsAllHistoryAvailable", - SchemaName: "is_all_history_available", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventIsAllHistoryAvailableToggled) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil") - } - b.PutID(ChatEventIsAllHistoryAvailableToggledTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventIsAllHistoryAvailableToggled) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil") - } - b.PutBool(c.IsAllHistoryAvailable) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventIsAllHistoryAvailableToggled) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil") - } - if err := b.ConsumeID(ChatEventIsAllHistoryAvailableToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventIsAllHistoryAvailableToggled) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: field is_all_history_available: %w", err) - } - c.IsAllHistoryAvailable = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventIsAllHistoryAvailableToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventIsAllHistoryAvailableToggled#a0b03c15 as nil") - } - b.ObjStart() - b.PutID("chatEventIsAllHistoryAvailableToggled") - b.Comma() - b.FieldStart("is_all_history_available") - b.PutBool(c.IsAllHistoryAvailable) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventIsAllHistoryAvailableToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventIsAllHistoryAvailableToggled#a0b03c15 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventIsAllHistoryAvailableToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: %w", err) - } - case "is_all_history_available": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventIsAllHistoryAvailableToggled#a0b03c15: field is_all_history_available: %w", err) - } - c.IsAllHistoryAvailable = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsAllHistoryAvailable returns value of IsAllHistoryAvailable field. -func (c *ChatEventIsAllHistoryAvailableToggled) GetIsAllHistoryAvailable() (value bool) { - if c == nil { - return - } - return c.IsAllHistoryAvailable -} - -// ChatEventHasAggressiveAntiSpamEnabledToggled represents TL type `chatEventHasAggressiveAntiSpamEnabledToggled#f8875702`. -type ChatEventHasAggressiveAntiSpamEnabledToggled struct { - // New value of has_aggressive_anti_spam_enabled - HasAggressiveAntiSpamEnabled bool -} - -// ChatEventHasAggressiveAntiSpamEnabledToggledTypeID is TL type id of ChatEventHasAggressiveAntiSpamEnabledToggled. -const ChatEventHasAggressiveAntiSpamEnabledToggledTypeID = 0xf8875702 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventHasAggressiveAntiSpamEnabledToggled) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventHasAggressiveAntiSpamEnabledToggled. -var ( - _ bin.Encoder = &ChatEventHasAggressiveAntiSpamEnabledToggled{} - _ bin.Decoder = &ChatEventHasAggressiveAntiSpamEnabledToggled{} - _ bin.BareEncoder = &ChatEventHasAggressiveAntiSpamEnabledToggled{} - _ bin.BareDecoder = &ChatEventHasAggressiveAntiSpamEnabledToggled{} - - _ ChatEventActionClass = &ChatEventHasAggressiveAntiSpamEnabledToggled{} -) - -func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) Zero() bool { - if c == nil { - return true - } - if !(c.HasAggressiveAntiSpamEnabled == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) String() string { - if c == nil { - return "ChatEventHasAggressiveAntiSpamEnabledToggled(nil)" - } - type Alias ChatEventHasAggressiveAntiSpamEnabledToggled - return fmt.Sprintf("ChatEventHasAggressiveAntiSpamEnabledToggled%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventHasAggressiveAntiSpamEnabledToggled) TypeID() uint32 { - return ChatEventHasAggressiveAntiSpamEnabledToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventHasAggressiveAntiSpamEnabledToggled) TypeName() string { - return "chatEventHasAggressiveAntiSpamEnabledToggled" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventHasAggressiveAntiSpamEnabledToggled", - ID: ChatEventHasAggressiveAntiSpamEnabledToggledTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "HasAggressiveAntiSpamEnabled", - SchemaName: "has_aggressive_anti_spam_enabled", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 as nil") - } - b.PutID(ChatEventHasAggressiveAntiSpamEnabledToggledTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 as nil") - } - b.PutBool(c.HasAggressiveAntiSpamEnabled) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 to nil") - } - if err := b.ConsumeID(ChatEventHasAggressiveAntiSpamEnabledToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702: field has_aggressive_anti_spam_enabled: %w", err) - } - c.HasAggressiveAntiSpamEnabled = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 as nil") - } - b.ObjStart() - b.PutID("chatEventHasAggressiveAntiSpamEnabledToggled") - b.Comma() - b.FieldStart("has_aggressive_anti_spam_enabled") - b.PutBool(c.HasAggressiveAntiSpamEnabled) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventHasAggressiveAntiSpamEnabledToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702: %w", err) - } - case "has_aggressive_anti_spam_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventHasAggressiveAntiSpamEnabledToggled#f8875702: field has_aggressive_anti_spam_enabled: %w", err) - } - c.HasAggressiveAntiSpamEnabled = value - default: - return b.Skip() - } - return nil - }) -} - -// GetHasAggressiveAntiSpamEnabled returns value of HasAggressiveAntiSpamEnabled field. -func (c *ChatEventHasAggressiveAntiSpamEnabledToggled) GetHasAggressiveAntiSpamEnabled() (value bool) { - if c == nil { - return - } - return c.HasAggressiveAntiSpamEnabled -} - -// ChatEventSignMessagesToggled represents TL type `chatEventSignMessagesToggled#b1b9281e`. -type ChatEventSignMessagesToggled struct { - // New value of sign_messages - SignMessages bool -} - -// ChatEventSignMessagesToggledTypeID is TL type id of ChatEventSignMessagesToggled. -const ChatEventSignMessagesToggledTypeID = 0xb1b9281e - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventSignMessagesToggled) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventSignMessagesToggled. -var ( - _ bin.Encoder = &ChatEventSignMessagesToggled{} - _ bin.Decoder = &ChatEventSignMessagesToggled{} - _ bin.BareEncoder = &ChatEventSignMessagesToggled{} - _ bin.BareDecoder = &ChatEventSignMessagesToggled{} - - _ ChatEventActionClass = &ChatEventSignMessagesToggled{} -) - -func (c *ChatEventSignMessagesToggled) Zero() bool { - if c == nil { - return true - } - if !(c.SignMessages == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventSignMessagesToggled) String() string { - if c == nil { - return "ChatEventSignMessagesToggled(nil)" - } - type Alias ChatEventSignMessagesToggled - return fmt.Sprintf("ChatEventSignMessagesToggled%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventSignMessagesToggled) TypeID() uint32 { - return ChatEventSignMessagesToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventSignMessagesToggled) TypeName() string { - return "chatEventSignMessagesToggled" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventSignMessagesToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventSignMessagesToggled", - ID: ChatEventSignMessagesToggledTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SignMessages", - SchemaName: "sign_messages", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventSignMessagesToggled) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil") - } - b.PutID(ChatEventSignMessagesToggledTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventSignMessagesToggled) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil") - } - b.PutBool(c.SignMessages) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventSignMessagesToggled) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil") - } - if err := b.ConsumeID(ChatEventSignMessagesToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventSignMessagesToggled) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: field sign_messages: %w", err) - } - c.SignMessages = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventSignMessagesToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventSignMessagesToggled#b1b9281e as nil") - } - b.ObjStart() - b.PutID("chatEventSignMessagesToggled") - b.Comma() - b.FieldStart("sign_messages") - b.PutBool(c.SignMessages) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventSignMessagesToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventSignMessagesToggled#b1b9281e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventSignMessagesToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: %w", err) - } - case "sign_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventSignMessagesToggled#b1b9281e: field sign_messages: %w", err) - } - c.SignMessages = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSignMessages returns value of SignMessages field. -func (c *ChatEventSignMessagesToggled) GetSignMessages() (value bool) { - if c == nil { - return - } - return c.SignMessages -} - -// ChatEventShowMessageSenderToggled represents TL type `chatEventShowMessageSenderToggled#d0a747e3`. -type ChatEventShowMessageSenderToggled struct { - // New value of show_message_sender - ShowMessageSender bool -} - -// ChatEventShowMessageSenderToggledTypeID is TL type id of ChatEventShowMessageSenderToggled. -const ChatEventShowMessageSenderToggledTypeID = 0xd0a747e3 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventShowMessageSenderToggled) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventShowMessageSenderToggled. -var ( - _ bin.Encoder = &ChatEventShowMessageSenderToggled{} - _ bin.Decoder = &ChatEventShowMessageSenderToggled{} - _ bin.BareEncoder = &ChatEventShowMessageSenderToggled{} - _ bin.BareDecoder = &ChatEventShowMessageSenderToggled{} - - _ ChatEventActionClass = &ChatEventShowMessageSenderToggled{} -) - -func (c *ChatEventShowMessageSenderToggled) Zero() bool { - if c == nil { - return true - } - if !(c.ShowMessageSender == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventShowMessageSenderToggled) String() string { - if c == nil { - return "ChatEventShowMessageSenderToggled(nil)" - } - type Alias ChatEventShowMessageSenderToggled - return fmt.Sprintf("ChatEventShowMessageSenderToggled%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventShowMessageSenderToggled) TypeID() uint32 { - return ChatEventShowMessageSenderToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventShowMessageSenderToggled) TypeName() string { - return "chatEventShowMessageSenderToggled" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventShowMessageSenderToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventShowMessageSenderToggled", - ID: ChatEventShowMessageSenderToggledTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShowMessageSender", - SchemaName: "show_message_sender", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventShowMessageSenderToggled) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventShowMessageSenderToggled#d0a747e3 as nil") - } - b.PutID(ChatEventShowMessageSenderToggledTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventShowMessageSenderToggled) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventShowMessageSenderToggled#d0a747e3 as nil") - } - b.PutBool(c.ShowMessageSender) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventShowMessageSenderToggled) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventShowMessageSenderToggled#d0a747e3 to nil") - } - if err := b.ConsumeID(ChatEventShowMessageSenderToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventShowMessageSenderToggled#d0a747e3: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventShowMessageSenderToggled) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventShowMessageSenderToggled#d0a747e3 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventShowMessageSenderToggled#d0a747e3: field show_message_sender: %w", err) - } - c.ShowMessageSender = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventShowMessageSenderToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventShowMessageSenderToggled#d0a747e3 as nil") - } - b.ObjStart() - b.PutID("chatEventShowMessageSenderToggled") - b.Comma() - b.FieldStart("show_message_sender") - b.PutBool(c.ShowMessageSender) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventShowMessageSenderToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventShowMessageSenderToggled#d0a747e3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventShowMessageSenderToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventShowMessageSenderToggled#d0a747e3: %w", err) - } - case "show_message_sender": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventShowMessageSenderToggled#d0a747e3: field show_message_sender: %w", err) - } - c.ShowMessageSender = value - default: - return b.Skip() - } - return nil - }) -} - -// GetShowMessageSender returns value of ShowMessageSender field. -func (c *ChatEventShowMessageSenderToggled) GetShowMessageSender() (value bool) { - if c == nil { - return - } - return c.ShowMessageSender -} - -// ChatEventInviteLinkEdited represents TL type `chatEventInviteLinkEdited#e4920d62`. -type ChatEventInviteLinkEdited struct { - // Previous information about the invite link - OldInviteLink ChatInviteLink - // New information about the invite link - NewInviteLink ChatInviteLink -} - -// ChatEventInviteLinkEditedTypeID is TL type id of ChatEventInviteLinkEdited. -const ChatEventInviteLinkEditedTypeID = 0xe4920d62 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventInviteLinkEdited) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventInviteLinkEdited. -var ( - _ bin.Encoder = &ChatEventInviteLinkEdited{} - _ bin.Decoder = &ChatEventInviteLinkEdited{} - _ bin.BareEncoder = &ChatEventInviteLinkEdited{} - _ bin.BareDecoder = &ChatEventInviteLinkEdited{} - - _ ChatEventActionClass = &ChatEventInviteLinkEdited{} -) - -func (c *ChatEventInviteLinkEdited) Zero() bool { - if c == nil { - return true - } - if !(c.OldInviteLink.Zero()) { - return false - } - if !(c.NewInviteLink.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventInviteLinkEdited) String() string { - if c == nil { - return "ChatEventInviteLinkEdited(nil)" - } - type Alias ChatEventInviteLinkEdited - return fmt.Sprintf("ChatEventInviteLinkEdited%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventInviteLinkEdited) TypeID() uint32 { - return ChatEventInviteLinkEditedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventInviteLinkEdited) TypeName() string { - return "chatEventInviteLinkEdited" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventInviteLinkEdited) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventInviteLinkEdited", - ID: ChatEventInviteLinkEditedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldInviteLink", - SchemaName: "old_invite_link", - }, - { - Name: "NewInviteLink", - SchemaName: "new_invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventInviteLinkEdited) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInviteLinkEdited#e4920d62 as nil") - } - b.PutID(ChatEventInviteLinkEditedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventInviteLinkEdited) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInviteLinkEdited#e4920d62 as nil") - } - if err := c.OldInviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventInviteLinkEdited#e4920d62: field old_invite_link: %w", err) - } - if err := c.NewInviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventInviteLinkEdited#e4920d62: field new_invite_link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventInviteLinkEdited) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInviteLinkEdited#e4920d62 to nil") - } - if err := b.ConsumeID(ChatEventInviteLinkEditedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventInviteLinkEdited) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInviteLinkEdited#e4920d62 to nil") - } - { - if err := c.OldInviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: field old_invite_link: %w", err) - } - } - { - if err := c.NewInviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: field new_invite_link: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventInviteLinkEdited) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInviteLinkEdited#e4920d62 as nil") - } - b.ObjStart() - b.PutID("chatEventInviteLinkEdited") - b.Comma() - b.FieldStart("old_invite_link") - if err := c.OldInviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventInviteLinkEdited#e4920d62: field old_invite_link: %w", err) - } - b.Comma() - b.FieldStart("new_invite_link") - if err := c.NewInviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventInviteLinkEdited#e4920d62: field new_invite_link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventInviteLinkEdited) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInviteLinkEdited#e4920d62 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventInviteLinkEdited"); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: %w", err) - } - case "old_invite_link": - if err := c.OldInviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: field old_invite_link: %w", err) - } - case "new_invite_link": - if err := c.NewInviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkEdited#e4920d62: field new_invite_link: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOldInviteLink returns value of OldInviteLink field. -func (c *ChatEventInviteLinkEdited) GetOldInviteLink() (value ChatInviteLink) { - if c == nil { - return - } - return c.OldInviteLink -} - -// GetNewInviteLink returns value of NewInviteLink field. -func (c *ChatEventInviteLinkEdited) GetNewInviteLink() (value ChatInviteLink) { - if c == nil { - return - } - return c.NewInviteLink -} - -// ChatEventInviteLinkRevoked represents TL type `chatEventInviteLinkRevoked#a1dbffe3`. -type ChatEventInviteLinkRevoked struct { - // The invite link - InviteLink ChatInviteLink -} - -// ChatEventInviteLinkRevokedTypeID is TL type id of ChatEventInviteLinkRevoked. -const ChatEventInviteLinkRevokedTypeID = 0xa1dbffe3 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventInviteLinkRevoked) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventInviteLinkRevoked. -var ( - _ bin.Encoder = &ChatEventInviteLinkRevoked{} - _ bin.Decoder = &ChatEventInviteLinkRevoked{} - _ bin.BareEncoder = &ChatEventInviteLinkRevoked{} - _ bin.BareDecoder = &ChatEventInviteLinkRevoked{} - - _ ChatEventActionClass = &ChatEventInviteLinkRevoked{} -) - -func (c *ChatEventInviteLinkRevoked) Zero() bool { - if c == nil { - return true - } - if !(c.InviteLink.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventInviteLinkRevoked) String() string { - if c == nil { - return "ChatEventInviteLinkRevoked(nil)" - } - type Alias ChatEventInviteLinkRevoked - return fmt.Sprintf("ChatEventInviteLinkRevoked%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventInviteLinkRevoked) TypeID() uint32 { - return ChatEventInviteLinkRevokedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventInviteLinkRevoked) TypeName() string { - return "chatEventInviteLinkRevoked" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventInviteLinkRevoked) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventInviteLinkRevoked", - ID: ChatEventInviteLinkRevokedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventInviteLinkRevoked) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInviteLinkRevoked#a1dbffe3 as nil") - } - b.PutID(ChatEventInviteLinkRevokedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventInviteLinkRevoked) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInviteLinkRevoked#a1dbffe3 as nil") - } - if err := c.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventInviteLinkRevoked#a1dbffe3: field invite_link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventInviteLinkRevoked) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInviteLinkRevoked#a1dbffe3 to nil") - } - if err := b.ConsumeID(ChatEventInviteLinkRevokedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkRevoked#a1dbffe3: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventInviteLinkRevoked) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInviteLinkRevoked#a1dbffe3 to nil") - } - { - if err := c.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkRevoked#a1dbffe3: field invite_link: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventInviteLinkRevoked) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInviteLinkRevoked#a1dbffe3 as nil") - } - b.ObjStart() - b.PutID("chatEventInviteLinkRevoked") - b.Comma() - b.FieldStart("invite_link") - if err := c.InviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventInviteLinkRevoked#a1dbffe3: field invite_link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventInviteLinkRevoked) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInviteLinkRevoked#a1dbffe3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventInviteLinkRevoked"); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkRevoked#a1dbffe3: %w", err) - } - case "invite_link": - if err := c.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkRevoked#a1dbffe3: field invite_link: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (c *ChatEventInviteLinkRevoked) GetInviteLink() (value ChatInviteLink) { - if c == nil { - return - } - return c.InviteLink -} - -// ChatEventInviteLinkDeleted represents TL type `chatEventInviteLinkDeleted#acda6167`. -type ChatEventInviteLinkDeleted struct { - // The invite link - InviteLink ChatInviteLink -} - -// ChatEventInviteLinkDeletedTypeID is TL type id of ChatEventInviteLinkDeleted. -const ChatEventInviteLinkDeletedTypeID = 0xacda6167 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventInviteLinkDeleted) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventInviteLinkDeleted. -var ( - _ bin.Encoder = &ChatEventInviteLinkDeleted{} - _ bin.Decoder = &ChatEventInviteLinkDeleted{} - _ bin.BareEncoder = &ChatEventInviteLinkDeleted{} - _ bin.BareDecoder = &ChatEventInviteLinkDeleted{} - - _ ChatEventActionClass = &ChatEventInviteLinkDeleted{} -) - -func (c *ChatEventInviteLinkDeleted) Zero() bool { - if c == nil { - return true - } - if !(c.InviteLink.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventInviteLinkDeleted) String() string { - if c == nil { - return "ChatEventInviteLinkDeleted(nil)" - } - type Alias ChatEventInviteLinkDeleted - return fmt.Sprintf("ChatEventInviteLinkDeleted%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventInviteLinkDeleted) TypeID() uint32 { - return ChatEventInviteLinkDeletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventInviteLinkDeleted) TypeName() string { - return "chatEventInviteLinkDeleted" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventInviteLinkDeleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventInviteLinkDeleted", - ID: ChatEventInviteLinkDeletedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventInviteLinkDeleted) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInviteLinkDeleted#acda6167 as nil") - } - b.PutID(ChatEventInviteLinkDeletedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventInviteLinkDeleted) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInviteLinkDeleted#acda6167 as nil") - } - if err := c.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventInviteLinkDeleted#acda6167: field invite_link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventInviteLinkDeleted) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInviteLinkDeleted#acda6167 to nil") - } - if err := b.ConsumeID(ChatEventInviteLinkDeletedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkDeleted#acda6167: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventInviteLinkDeleted) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInviteLinkDeleted#acda6167 to nil") - } - { - if err := c.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkDeleted#acda6167: field invite_link: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventInviteLinkDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventInviteLinkDeleted#acda6167 as nil") - } - b.ObjStart() - b.PutID("chatEventInviteLinkDeleted") - b.Comma() - b.FieldStart("invite_link") - if err := c.InviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventInviteLinkDeleted#acda6167: field invite_link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventInviteLinkDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventInviteLinkDeleted#acda6167 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventInviteLinkDeleted"); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkDeleted#acda6167: %w", err) - } - case "invite_link": - if err := c.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventInviteLinkDeleted#acda6167: field invite_link: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (c *ChatEventInviteLinkDeleted) GetInviteLink() (value ChatInviteLink) { - if c == nil { - return - } - return c.InviteLink -} - -// ChatEventVideoChatCreated represents TL type `chatEventVideoChatCreated#6ca68a7b`. -type ChatEventVideoChatCreated struct { - // Identifier of the video chat. The video chat can be received through the method - // getGroupCall - GroupCallID int32 -} - -// ChatEventVideoChatCreatedTypeID is TL type id of ChatEventVideoChatCreated. -const ChatEventVideoChatCreatedTypeID = 0x6ca68a7b - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventVideoChatCreated) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventVideoChatCreated. -var ( - _ bin.Encoder = &ChatEventVideoChatCreated{} - _ bin.Decoder = &ChatEventVideoChatCreated{} - _ bin.BareEncoder = &ChatEventVideoChatCreated{} - _ bin.BareDecoder = &ChatEventVideoChatCreated{} - - _ ChatEventActionClass = &ChatEventVideoChatCreated{} -) - -func (c *ChatEventVideoChatCreated) Zero() bool { - if c == nil { - return true - } - if !(c.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventVideoChatCreated) String() string { - if c == nil { - return "ChatEventVideoChatCreated(nil)" - } - type Alias ChatEventVideoChatCreated - return fmt.Sprintf("ChatEventVideoChatCreated%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventVideoChatCreated) TypeID() uint32 { - return ChatEventVideoChatCreatedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventVideoChatCreated) TypeName() string { - return "chatEventVideoChatCreated" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventVideoChatCreated) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventVideoChatCreated", - ID: ChatEventVideoChatCreatedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventVideoChatCreated) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatCreated#6ca68a7b as nil") - } - b.PutID(ChatEventVideoChatCreatedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventVideoChatCreated) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatCreated#6ca68a7b as nil") - } - b.PutInt32(c.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventVideoChatCreated) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatCreated#6ca68a7b to nil") - } - if err := b.ConsumeID(ChatEventVideoChatCreatedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatCreated#6ca68a7b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventVideoChatCreated) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatCreated#6ca68a7b to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatCreated#6ca68a7b: field group_call_id: %w", err) - } - c.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventVideoChatCreated) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatCreated#6ca68a7b as nil") - } - b.ObjStart() - b.PutID("chatEventVideoChatCreated") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(c.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventVideoChatCreated) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatCreated#6ca68a7b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventVideoChatCreated"); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatCreated#6ca68a7b: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatCreated#6ca68a7b: field group_call_id: %w", err) - } - c.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (c *ChatEventVideoChatCreated) GetGroupCallID() (value int32) { - if c == nil { - return - } - return c.GroupCallID -} - -// ChatEventVideoChatEnded represents TL type `chatEventVideoChatEnded#61286c48`. -type ChatEventVideoChatEnded struct { - // Identifier of the video chat. The video chat can be received through the method - // getGroupCall - GroupCallID int32 -} - -// ChatEventVideoChatEndedTypeID is TL type id of ChatEventVideoChatEnded. -const ChatEventVideoChatEndedTypeID = 0x61286c48 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventVideoChatEnded) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventVideoChatEnded. -var ( - _ bin.Encoder = &ChatEventVideoChatEnded{} - _ bin.Decoder = &ChatEventVideoChatEnded{} - _ bin.BareEncoder = &ChatEventVideoChatEnded{} - _ bin.BareDecoder = &ChatEventVideoChatEnded{} - - _ ChatEventActionClass = &ChatEventVideoChatEnded{} -) - -func (c *ChatEventVideoChatEnded) Zero() bool { - if c == nil { - return true - } - if !(c.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventVideoChatEnded) String() string { - if c == nil { - return "ChatEventVideoChatEnded(nil)" - } - type Alias ChatEventVideoChatEnded - return fmt.Sprintf("ChatEventVideoChatEnded%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventVideoChatEnded) TypeID() uint32 { - return ChatEventVideoChatEndedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventVideoChatEnded) TypeName() string { - return "chatEventVideoChatEnded" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventVideoChatEnded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventVideoChatEnded", - ID: ChatEventVideoChatEndedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventVideoChatEnded) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil") - } - b.PutID(ChatEventVideoChatEndedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventVideoChatEnded) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil") - } - b.PutInt32(c.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventVideoChatEnded) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil") - } - if err := b.ConsumeID(ChatEventVideoChatEndedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventVideoChatEnded) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: field group_call_id: %w", err) - } - c.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventVideoChatEnded) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatEnded#61286c48 as nil") - } - b.ObjStart() - b.PutID("chatEventVideoChatEnded") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(c.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventVideoChatEnded) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatEnded#61286c48 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventVideoChatEnded"); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatEnded#61286c48: field group_call_id: %w", err) - } - c.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (c *ChatEventVideoChatEnded) GetGroupCallID() (value int32) { - if c == nil { - return - } - return c.GroupCallID -} - -// ChatEventVideoChatMuteNewParticipantsToggled represents TL type `chatEventVideoChatMuteNewParticipantsToggled#f87507fe`. -type ChatEventVideoChatMuteNewParticipantsToggled struct { - // New value of the mute_new_participants setting - MuteNewParticipants bool -} - -// ChatEventVideoChatMuteNewParticipantsToggledTypeID is TL type id of ChatEventVideoChatMuteNewParticipantsToggled. -const ChatEventVideoChatMuteNewParticipantsToggledTypeID = 0xf87507fe - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventVideoChatMuteNewParticipantsToggled) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventVideoChatMuteNewParticipantsToggled. -var ( - _ bin.Encoder = &ChatEventVideoChatMuteNewParticipantsToggled{} - _ bin.Decoder = &ChatEventVideoChatMuteNewParticipantsToggled{} - _ bin.BareEncoder = &ChatEventVideoChatMuteNewParticipantsToggled{} - _ bin.BareDecoder = &ChatEventVideoChatMuteNewParticipantsToggled{} - - _ ChatEventActionClass = &ChatEventVideoChatMuteNewParticipantsToggled{} -) - -func (c *ChatEventVideoChatMuteNewParticipantsToggled) Zero() bool { - if c == nil { - return true - } - if !(c.MuteNewParticipants == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) String() string { - if c == nil { - return "ChatEventVideoChatMuteNewParticipantsToggled(nil)" - } - type Alias ChatEventVideoChatMuteNewParticipantsToggled - return fmt.Sprintf("ChatEventVideoChatMuteNewParticipantsToggled%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventVideoChatMuteNewParticipantsToggled) TypeID() uint32 { - return ChatEventVideoChatMuteNewParticipantsToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventVideoChatMuteNewParticipantsToggled) TypeName() string { - return "chatEventVideoChatMuteNewParticipantsToggled" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventVideoChatMuteNewParticipantsToggled", - ID: ChatEventVideoChatMuteNewParticipantsToggledTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MuteNewParticipants", - SchemaName: "mute_new_participants", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil") - } - b.PutID(ChatEventVideoChatMuteNewParticipantsToggledTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil") - } - b.PutBool(c.MuteNewParticipants) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil") - } - if err := b.ConsumeID(ChatEventVideoChatMuteNewParticipantsToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: field mute_new_participants: %w", err) - } - c.MuteNewParticipants = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatMuteNewParticipantsToggled#f87507fe as nil") - } - b.ObjStart() - b.PutID("chatEventVideoChatMuteNewParticipantsToggled") - b.Comma() - b.FieldStart("mute_new_participants") - b.PutBool(c.MuteNewParticipants) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventVideoChatMuteNewParticipantsToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: %w", err) - } - case "mute_new_participants": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatMuteNewParticipantsToggled#f87507fe: field mute_new_participants: %w", err) - } - c.MuteNewParticipants = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMuteNewParticipants returns value of MuteNewParticipants field. -func (c *ChatEventVideoChatMuteNewParticipantsToggled) GetMuteNewParticipants() (value bool) { - if c == nil { - return - } - return c.MuteNewParticipants -} - -// ChatEventVideoChatParticipantIsMutedToggled represents TL type `chatEventVideoChatParticipantIsMutedToggled#1f1058f7`. -type ChatEventVideoChatParticipantIsMutedToggled struct { - // Identifier of the affected group call participant - ParticipantID MessageSenderClass - // New value of is_muted - IsMuted bool -} - -// ChatEventVideoChatParticipantIsMutedToggledTypeID is TL type id of ChatEventVideoChatParticipantIsMutedToggled. -const ChatEventVideoChatParticipantIsMutedToggledTypeID = 0x1f1058f7 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventVideoChatParticipantIsMutedToggled) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventVideoChatParticipantIsMutedToggled. -var ( - _ bin.Encoder = &ChatEventVideoChatParticipantIsMutedToggled{} - _ bin.Decoder = &ChatEventVideoChatParticipantIsMutedToggled{} - _ bin.BareEncoder = &ChatEventVideoChatParticipantIsMutedToggled{} - _ bin.BareDecoder = &ChatEventVideoChatParticipantIsMutedToggled{} - - _ ChatEventActionClass = &ChatEventVideoChatParticipantIsMutedToggled{} -) - -func (c *ChatEventVideoChatParticipantIsMutedToggled) Zero() bool { - if c == nil { - return true - } - if !(c.ParticipantID == nil) { - return false - } - if !(c.IsMuted == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventVideoChatParticipantIsMutedToggled) String() string { - if c == nil { - return "ChatEventVideoChatParticipantIsMutedToggled(nil)" - } - type Alias ChatEventVideoChatParticipantIsMutedToggled - return fmt.Sprintf("ChatEventVideoChatParticipantIsMutedToggled%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventVideoChatParticipantIsMutedToggled) TypeID() uint32 { - return ChatEventVideoChatParticipantIsMutedToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventVideoChatParticipantIsMutedToggled) TypeName() string { - return "chatEventVideoChatParticipantIsMutedToggled" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventVideoChatParticipantIsMutedToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventVideoChatParticipantIsMutedToggled", - ID: ChatEventVideoChatParticipantIsMutedToggledTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ParticipantID", - SchemaName: "participant_id", - }, - { - Name: "IsMuted", - SchemaName: "is_muted", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventVideoChatParticipantIsMutedToggled) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 as nil") - } - b.PutID(ChatEventVideoChatParticipantIsMutedToggledTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventVideoChatParticipantIsMutedToggled) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 as nil") - } - if c.ParticipantID == nil { - return fmt.Errorf("unable to encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id is nil") - } - if err := c.ParticipantID.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id: %w", err) - } - b.PutBool(c.IsMuted) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventVideoChatParticipantIsMutedToggled) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 to nil") - } - if err := b.ConsumeID(ChatEventVideoChatParticipantIsMutedToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventVideoChatParticipantIsMutedToggled) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id: %w", err) - } - c.ParticipantID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field is_muted: %w", err) - } - c.IsMuted = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventVideoChatParticipantIsMutedToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 as nil") - } - b.ObjStart() - b.PutID("chatEventVideoChatParticipantIsMutedToggled") - b.Comma() - b.FieldStart("participant_id") - if c.ParticipantID == nil { - return fmt.Errorf("unable to encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id is nil") - } - if err := c.ParticipantID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id: %w", err) - } - b.Comma() - b.FieldStart("is_muted") - b.PutBool(c.IsMuted) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventVideoChatParticipantIsMutedToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventVideoChatParticipantIsMutedToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: %w", err) - } - case "participant_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field participant_id: %w", err) - } - c.ParticipantID = value - case "is_muted": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantIsMutedToggled#1f1058f7: field is_muted: %w", err) - } - c.IsMuted = value - default: - return b.Skip() - } - return nil - }) -} - -// GetParticipantID returns value of ParticipantID field. -func (c *ChatEventVideoChatParticipantIsMutedToggled) GetParticipantID() (value MessageSenderClass) { - if c == nil { - return - } - return c.ParticipantID -} - -// GetIsMuted returns value of IsMuted field. -func (c *ChatEventVideoChatParticipantIsMutedToggled) GetIsMuted() (value bool) { - if c == nil { - return - } - return c.IsMuted -} - -// ChatEventVideoChatParticipantVolumeLevelChanged represents TL type `chatEventVideoChatParticipantVolumeLevelChanged#436f92be`. -type ChatEventVideoChatParticipantVolumeLevelChanged struct { - // Identifier of the affected group call participant - ParticipantID MessageSenderClass - // New value of volume_level; 1-20000 in hundreds of percents - VolumeLevel int32 -} - -// ChatEventVideoChatParticipantVolumeLevelChangedTypeID is TL type id of ChatEventVideoChatParticipantVolumeLevelChanged. -const ChatEventVideoChatParticipantVolumeLevelChangedTypeID = 0x436f92be - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventVideoChatParticipantVolumeLevelChanged) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventVideoChatParticipantVolumeLevelChanged. -var ( - _ bin.Encoder = &ChatEventVideoChatParticipantVolumeLevelChanged{} - _ bin.Decoder = &ChatEventVideoChatParticipantVolumeLevelChanged{} - _ bin.BareEncoder = &ChatEventVideoChatParticipantVolumeLevelChanged{} - _ bin.BareDecoder = &ChatEventVideoChatParticipantVolumeLevelChanged{} - - _ ChatEventActionClass = &ChatEventVideoChatParticipantVolumeLevelChanged{} -) - -func (c *ChatEventVideoChatParticipantVolumeLevelChanged) Zero() bool { - if c == nil { - return true - } - if !(c.ParticipantID == nil) { - return false - } - if !(c.VolumeLevel == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventVideoChatParticipantVolumeLevelChanged) String() string { - if c == nil { - return "ChatEventVideoChatParticipantVolumeLevelChanged(nil)" - } - type Alias ChatEventVideoChatParticipantVolumeLevelChanged - return fmt.Sprintf("ChatEventVideoChatParticipantVolumeLevelChanged%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventVideoChatParticipantVolumeLevelChanged) TypeID() uint32 { - return ChatEventVideoChatParticipantVolumeLevelChangedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventVideoChatParticipantVolumeLevelChanged) TypeName() string { - return "chatEventVideoChatParticipantVolumeLevelChanged" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventVideoChatParticipantVolumeLevelChanged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventVideoChatParticipantVolumeLevelChanged", - ID: ChatEventVideoChatParticipantVolumeLevelChangedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ParticipantID", - SchemaName: "participant_id", - }, - { - Name: "VolumeLevel", - SchemaName: "volume_level", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventVideoChatParticipantVolumeLevelChanged) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be as nil") - } - b.PutID(ChatEventVideoChatParticipantVolumeLevelChangedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventVideoChatParticipantVolumeLevelChanged) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be as nil") - } - if c.ParticipantID == nil { - return fmt.Errorf("unable to encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id is nil") - } - if err := c.ParticipantID.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id: %w", err) - } - b.PutInt32(c.VolumeLevel) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventVideoChatParticipantVolumeLevelChanged) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be to nil") - } - if err := b.ConsumeID(ChatEventVideoChatParticipantVolumeLevelChangedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventVideoChatParticipantVolumeLevelChanged) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id: %w", err) - } - c.ParticipantID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field volume_level: %w", err) - } - c.VolumeLevel = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventVideoChatParticipantVolumeLevelChanged) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be as nil") - } - b.ObjStart() - b.PutID("chatEventVideoChatParticipantVolumeLevelChanged") - b.Comma() - b.FieldStart("participant_id") - if c.ParticipantID == nil { - return fmt.Errorf("unable to encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id is nil") - } - if err := c.ParticipantID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id: %w", err) - } - b.Comma() - b.FieldStart("volume_level") - b.PutInt32(c.VolumeLevel) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventVideoChatParticipantVolumeLevelChanged) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventVideoChatParticipantVolumeLevelChanged"); err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: %w", err) - } - case "participant_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field participant_id: %w", err) - } - c.ParticipantID = value - case "volume_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEventVideoChatParticipantVolumeLevelChanged#436f92be: field volume_level: %w", err) - } - c.VolumeLevel = value - default: - return b.Skip() - } - return nil - }) -} - -// GetParticipantID returns value of ParticipantID field. -func (c *ChatEventVideoChatParticipantVolumeLevelChanged) GetParticipantID() (value MessageSenderClass) { - if c == nil { - return - } - return c.ParticipantID -} - -// GetVolumeLevel returns value of VolumeLevel field. -func (c *ChatEventVideoChatParticipantVolumeLevelChanged) GetVolumeLevel() (value int32) { - if c == nil { - return - } - return c.VolumeLevel -} - -// ChatEventIsForumToggled represents TL type `chatEventIsForumToggled#5a63d119`. -type ChatEventIsForumToggled struct { - // New value of is_forum - IsForum bool -} - -// ChatEventIsForumToggledTypeID is TL type id of ChatEventIsForumToggled. -const ChatEventIsForumToggledTypeID = 0x5a63d119 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventIsForumToggled) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventIsForumToggled. -var ( - _ bin.Encoder = &ChatEventIsForumToggled{} - _ bin.Decoder = &ChatEventIsForumToggled{} - _ bin.BareEncoder = &ChatEventIsForumToggled{} - _ bin.BareDecoder = &ChatEventIsForumToggled{} - - _ ChatEventActionClass = &ChatEventIsForumToggled{} -) - -func (c *ChatEventIsForumToggled) Zero() bool { - if c == nil { - return true - } - if !(c.IsForum == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventIsForumToggled) String() string { - if c == nil { - return "ChatEventIsForumToggled(nil)" - } - type Alias ChatEventIsForumToggled - return fmt.Sprintf("ChatEventIsForumToggled%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventIsForumToggled) TypeID() uint32 { - return ChatEventIsForumToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventIsForumToggled) TypeName() string { - return "chatEventIsForumToggled" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventIsForumToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventIsForumToggled", - ID: ChatEventIsForumToggledTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsForum", - SchemaName: "is_forum", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventIsForumToggled) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventIsForumToggled#5a63d119 as nil") - } - b.PutID(ChatEventIsForumToggledTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventIsForumToggled) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventIsForumToggled#5a63d119 as nil") - } - b.PutBool(c.IsForum) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventIsForumToggled) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventIsForumToggled#5a63d119 to nil") - } - if err := b.ConsumeID(ChatEventIsForumToggledTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventIsForumToggled#5a63d119: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventIsForumToggled) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventIsForumToggled#5a63d119 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventIsForumToggled#5a63d119: field is_forum: %w", err) - } - c.IsForum = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventIsForumToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventIsForumToggled#5a63d119 as nil") - } - b.ObjStart() - b.PutID("chatEventIsForumToggled") - b.Comma() - b.FieldStart("is_forum") - b.PutBool(c.IsForum) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventIsForumToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventIsForumToggled#5a63d119 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventIsForumToggled"); err != nil { - return fmt.Errorf("unable to decode chatEventIsForumToggled#5a63d119: %w", err) - } - case "is_forum": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventIsForumToggled#5a63d119: field is_forum: %w", err) - } - c.IsForum = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsForum returns value of IsForum field. -func (c *ChatEventIsForumToggled) GetIsForum() (value bool) { - if c == nil { - return - } - return c.IsForum -} - -// ChatEventForumTopicCreated represents TL type `chatEventForumTopicCreated#7785fb42`. -type ChatEventForumTopicCreated struct { - // Information about the topic - TopicInfo ForumTopicInfo -} - -// ChatEventForumTopicCreatedTypeID is TL type id of ChatEventForumTopicCreated. -const ChatEventForumTopicCreatedTypeID = 0x7785fb42 - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventForumTopicCreated) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventForumTopicCreated. -var ( - _ bin.Encoder = &ChatEventForumTopicCreated{} - _ bin.Decoder = &ChatEventForumTopicCreated{} - _ bin.BareEncoder = &ChatEventForumTopicCreated{} - _ bin.BareDecoder = &ChatEventForumTopicCreated{} - - _ ChatEventActionClass = &ChatEventForumTopicCreated{} -) - -func (c *ChatEventForumTopicCreated) Zero() bool { - if c == nil { - return true - } - if !(c.TopicInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventForumTopicCreated) String() string { - if c == nil { - return "ChatEventForumTopicCreated(nil)" - } - type Alias ChatEventForumTopicCreated - return fmt.Sprintf("ChatEventForumTopicCreated%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventForumTopicCreated) TypeID() uint32 { - return ChatEventForumTopicCreatedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventForumTopicCreated) TypeName() string { - return "chatEventForumTopicCreated" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventForumTopicCreated) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventForumTopicCreated", - ID: ChatEventForumTopicCreatedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TopicInfo", - SchemaName: "topic_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventForumTopicCreated) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicCreated#7785fb42 as nil") - } - b.PutID(ChatEventForumTopicCreatedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventForumTopicCreated) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicCreated#7785fb42 as nil") - } - if err := c.TopicInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicCreated#7785fb42: field topic_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventForumTopicCreated) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicCreated#7785fb42 to nil") - } - if err := b.ConsumeID(ChatEventForumTopicCreatedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicCreated#7785fb42: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventForumTopicCreated) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicCreated#7785fb42 to nil") - } - { - if err := c.TopicInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicCreated#7785fb42: field topic_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventForumTopicCreated) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicCreated#7785fb42 as nil") - } - b.ObjStart() - b.PutID("chatEventForumTopicCreated") - b.Comma() - b.FieldStart("topic_info") - if err := c.TopicInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicCreated#7785fb42: field topic_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventForumTopicCreated) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicCreated#7785fb42 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventForumTopicCreated"); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicCreated#7785fb42: %w", err) - } - case "topic_info": - if err := c.TopicInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicCreated#7785fb42: field topic_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTopicInfo returns value of TopicInfo field. -func (c *ChatEventForumTopicCreated) GetTopicInfo() (value ForumTopicInfo) { - if c == nil { - return - } - return c.TopicInfo -} - -// ChatEventForumTopicEdited represents TL type `chatEventForumTopicEdited#60da2c0c`. -type ChatEventForumTopicEdited struct { - // Old information about the topic - OldTopicInfo ForumTopicInfo - // New information about the topic - NewTopicInfo ForumTopicInfo -} - -// ChatEventForumTopicEditedTypeID is TL type id of ChatEventForumTopicEdited. -const ChatEventForumTopicEditedTypeID = 0x60da2c0c - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventForumTopicEdited) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventForumTopicEdited. -var ( - _ bin.Encoder = &ChatEventForumTopicEdited{} - _ bin.Decoder = &ChatEventForumTopicEdited{} - _ bin.BareEncoder = &ChatEventForumTopicEdited{} - _ bin.BareDecoder = &ChatEventForumTopicEdited{} - - _ ChatEventActionClass = &ChatEventForumTopicEdited{} -) - -func (c *ChatEventForumTopicEdited) Zero() bool { - if c == nil { - return true - } - if !(c.OldTopicInfo.Zero()) { - return false - } - if !(c.NewTopicInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventForumTopicEdited) String() string { - if c == nil { - return "ChatEventForumTopicEdited(nil)" - } - type Alias ChatEventForumTopicEdited - return fmt.Sprintf("ChatEventForumTopicEdited%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventForumTopicEdited) TypeID() uint32 { - return ChatEventForumTopicEditedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventForumTopicEdited) TypeName() string { - return "chatEventForumTopicEdited" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventForumTopicEdited) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventForumTopicEdited", - ID: ChatEventForumTopicEditedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldTopicInfo", - SchemaName: "old_topic_info", - }, - { - Name: "NewTopicInfo", - SchemaName: "new_topic_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventForumTopicEdited) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicEdited#60da2c0c as nil") - } - b.PutID(ChatEventForumTopicEditedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventForumTopicEdited) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicEdited#60da2c0c as nil") - } - if err := c.OldTopicInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicEdited#60da2c0c: field old_topic_info: %w", err) - } - if err := c.NewTopicInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicEdited#60da2c0c: field new_topic_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventForumTopicEdited) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicEdited#60da2c0c to nil") - } - if err := b.ConsumeID(ChatEventForumTopicEditedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventForumTopicEdited) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicEdited#60da2c0c to nil") - } - { - if err := c.OldTopicInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: field old_topic_info: %w", err) - } - } - { - if err := c.NewTopicInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: field new_topic_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventForumTopicEdited) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicEdited#60da2c0c as nil") - } - b.ObjStart() - b.PutID("chatEventForumTopicEdited") - b.Comma() - b.FieldStart("old_topic_info") - if err := c.OldTopicInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicEdited#60da2c0c: field old_topic_info: %w", err) - } - b.Comma() - b.FieldStart("new_topic_info") - if err := c.NewTopicInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicEdited#60da2c0c: field new_topic_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventForumTopicEdited) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicEdited#60da2c0c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventForumTopicEdited"); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: %w", err) - } - case "old_topic_info": - if err := c.OldTopicInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: field old_topic_info: %w", err) - } - case "new_topic_info": - if err := c.NewTopicInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicEdited#60da2c0c: field new_topic_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOldTopicInfo returns value of OldTopicInfo field. -func (c *ChatEventForumTopicEdited) GetOldTopicInfo() (value ForumTopicInfo) { - if c == nil { - return - } - return c.OldTopicInfo -} - -// GetNewTopicInfo returns value of NewTopicInfo field. -func (c *ChatEventForumTopicEdited) GetNewTopicInfo() (value ForumTopicInfo) { - if c == nil { - return - } - return c.NewTopicInfo -} - -// ChatEventForumTopicToggleIsClosed represents TL type `chatEventForumTopicToggleIsClosed#c69e4d3a`. -type ChatEventForumTopicToggleIsClosed struct { - // New information about the topic - TopicInfo ForumTopicInfo -} - -// ChatEventForumTopicToggleIsClosedTypeID is TL type id of ChatEventForumTopicToggleIsClosed. -const ChatEventForumTopicToggleIsClosedTypeID = 0xc69e4d3a - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventForumTopicToggleIsClosed) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventForumTopicToggleIsClosed. -var ( - _ bin.Encoder = &ChatEventForumTopicToggleIsClosed{} - _ bin.Decoder = &ChatEventForumTopicToggleIsClosed{} - _ bin.BareEncoder = &ChatEventForumTopicToggleIsClosed{} - _ bin.BareDecoder = &ChatEventForumTopicToggleIsClosed{} - - _ ChatEventActionClass = &ChatEventForumTopicToggleIsClosed{} -) - -func (c *ChatEventForumTopicToggleIsClosed) Zero() bool { - if c == nil { - return true - } - if !(c.TopicInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventForumTopicToggleIsClosed) String() string { - if c == nil { - return "ChatEventForumTopicToggleIsClosed(nil)" - } - type Alias ChatEventForumTopicToggleIsClosed - return fmt.Sprintf("ChatEventForumTopicToggleIsClosed%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventForumTopicToggleIsClosed) TypeID() uint32 { - return ChatEventForumTopicToggleIsClosedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventForumTopicToggleIsClosed) TypeName() string { - return "chatEventForumTopicToggleIsClosed" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventForumTopicToggleIsClosed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventForumTopicToggleIsClosed", - ID: ChatEventForumTopicToggleIsClosedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TopicInfo", - SchemaName: "topic_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventForumTopicToggleIsClosed) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicToggleIsClosed#c69e4d3a as nil") - } - b.PutID(ChatEventForumTopicToggleIsClosedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventForumTopicToggleIsClosed) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicToggleIsClosed#c69e4d3a as nil") - } - if err := c.TopicInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicToggleIsClosed#c69e4d3a: field topic_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventForumTopicToggleIsClosed) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicToggleIsClosed#c69e4d3a to nil") - } - if err := b.ConsumeID(ChatEventForumTopicToggleIsClosedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicToggleIsClosed#c69e4d3a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventForumTopicToggleIsClosed) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicToggleIsClosed#c69e4d3a to nil") - } - { - if err := c.TopicInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicToggleIsClosed#c69e4d3a: field topic_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventForumTopicToggleIsClosed) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicToggleIsClosed#c69e4d3a as nil") - } - b.ObjStart() - b.PutID("chatEventForumTopicToggleIsClosed") - b.Comma() - b.FieldStart("topic_info") - if err := c.TopicInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicToggleIsClosed#c69e4d3a: field topic_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventForumTopicToggleIsClosed) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicToggleIsClosed#c69e4d3a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventForumTopicToggleIsClosed"); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicToggleIsClosed#c69e4d3a: %w", err) - } - case "topic_info": - if err := c.TopicInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicToggleIsClosed#c69e4d3a: field topic_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTopicInfo returns value of TopicInfo field. -func (c *ChatEventForumTopicToggleIsClosed) GetTopicInfo() (value ForumTopicInfo) { - if c == nil { - return - } - return c.TopicInfo -} - -// ChatEventForumTopicToggleIsHidden represents TL type `chatEventForumTopicToggleIsHidden#a015ef2e`. -type ChatEventForumTopicToggleIsHidden struct { - // New information about the topic - TopicInfo ForumTopicInfo -} - -// ChatEventForumTopicToggleIsHiddenTypeID is TL type id of ChatEventForumTopicToggleIsHidden. -const ChatEventForumTopicToggleIsHiddenTypeID = 0xa015ef2e - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventForumTopicToggleIsHidden) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventForumTopicToggleIsHidden. -var ( - _ bin.Encoder = &ChatEventForumTopicToggleIsHidden{} - _ bin.Decoder = &ChatEventForumTopicToggleIsHidden{} - _ bin.BareEncoder = &ChatEventForumTopicToggleIsHidden{} - _ bin.BareDecoder = &ChatEventForumTopicToggleIsHidden{} - - _ ChatEventActionClass = &ChatEventForumTopicToggleIsHidden{} -) - -func (c *ChatEventForumTopicToggleIsHidden) Zero() bool { - if c == nil { - return true - } - if !(c.TopicInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventForumTopicToggleIsHidden) String() string { - if c == nil { - return "ChatEventForumTopicToggleIsHidden(nil)" - } - type Alias ChatEventForumTopicToggleIsHidden - return fmt.Sprintf("ChatEventForumTopicToggleIsHidden%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventForumTopicToggleIsHidden) TypeID() uint32 { - return ChatEventForumTopicToggleIsHiddenTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventForumTopicToggleIsHidden) TypeName() string { - return "chatEventForumTopicToggleIsHidden" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventForumTopicToggleIsHidden) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventForumTopicToggleIsHidden", - ID: ChatEventForumTopicToggleIsHiddenTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TopicInfo", - SchemaName: "topic_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventForumTopicToggleIsHidden) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicToggleIsHidden#a015ef2e as nil") - } - b.PutID(ChatEventForumTopicToggleIsHiddenTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventForumTopicToggleIsHidden) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicToggleIsHidden#a015ef2e as nil") - } - if err := c.TopicInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventForumTopicToggleIsHidden) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicToggleIsHidden#a015ef2e to nil") - } - if err := b.ConsumeID(ChatEventForumTopicToggleIsHiddenTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventForumTopicToggleIsHidden) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicToggleIsHidden#a015ef2e to nil") - } - { - if err := c.TopicInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventForumTopicToggleIsHidden) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicToggleIsHidden#a015ef2e as nil") - } - b.ObjStart() - b.PutID("chatEventForumTopicToggleIsHidden") - b.Comma() - b.FieldStart("topic_info") - if err := c.TopicInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventForumTopicToggleIsHidden) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicToggleIsHidden#a015ef2e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventForumTopicToggleIsHidden"); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: %w", err) - } - case "topic_info": - if err := c.TopicInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicToggleIsHidden#a015ef2e: field topic_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTopicInfo returns value of TopicInfo field. -func (c *ChatEventForumTopicToggleIsHidden) GetTopicInfo() (value ForumTopicInfo) { - if c == nil { - return - } - return c.TopicInfo -} - -// ChatEventForumTopicDeleted represents TL type `chatEventForumTopicDeleted#b08f290d`. -type ChatEventForumTopicDeleted struct { - // Information about the topic - TopicInfo ForumTopicInfo -} - -// ChatEventForumTopicDeletedTypeID is TL type id of ChatEventForumTopicDeleted. -const ChatEventForumTopicDeletedTypeID = 0xb08f290d - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventForumTopicDeleted) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventForumTopicDeleted. -var ( - _ bin.Encoder = &ChatEventForumTopicDeleted{} - _ bin.Decoder = &ChatEventForumTopicDeleted{} - _ bin.BareEncoder = &ChatEventForumTopicDeleted{} - _ bin.BareDecoder = &ChatEventForumTopicDeleted{} - - _ ChatEventActionClass = &ChatEventForumTopicDeleted{} -) - -func (c *ChatEventForumTopicDeleted) Zero() bool { - if c == nil { - return true - } - if !(c.TopicInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventForumTopicDeleted) String() string { - if c == nil { - return "ChatEventForumTopicDeleted(nil)" - } - type Alias ChatEventForumTopicDeleted - return fmt.Sprintf("ChatEventForumTopicDeleted%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventForumTopicDeleted) TypeID() uint32 { - return ChatEventForumTopicDeletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventForumTopicDeleted) TypeName() string { - return "chatEventForumTopicDeleted" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventForumTopicDeleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventForumTopicDeleted", - ID: ChatEventForumTopicDeletedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TopicInfo", - SchemaName: "topic_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventForumTopicDeleted) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicDeleted#b08f290d as nil") - } - b.PutID(ChatEventForumTopicDeletedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventForumTopicDeleted) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicDeleted#b08f290d as nil") - } - if err := c.TopicInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicDeleted#b08f290d: field topic_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventForumTopicDeleted) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicDeleted#b08f290d to nil") - } - if err := b.ConsumeID(ChatEventForumTopicDeletedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicDeleted#b08f290d: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventForumTopicDeleted) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicDeleted#b08f290d to nil") - } - { - if err := c.TopicInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicDeleted#b08f290d: field topic_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventForumTopicDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicDeleted#b08f290d as nil") - } - b.ObjStart() - b.PutID("chatEventForumTopicDeleted") - b.Comma() - b.FieldStart("topic_info") - if err := c.TopicInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicDeleted#b08f290d: field topic_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventForumTopicDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicDeleted#b08f290d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventForumTopicDeleted"); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicDeleted#b08f290d: %w", err) - } - case "topic_info": - if err := c.TopicInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicDeleted#b08f290d: field topic_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTopicInfo returns value of TopicInfo field. -func (c *ChatEventForumTopicDeleted) GetTopicInfo() (value ForumTopicInfo) { - if c == nil { - return - } - return c.TopicInfo -} - -// ChatEventForumTopicPinned represents TL type `chatEventForumTopicPinned#7fc523ee`. -type ChatEventForumTopicPinned struct { - // Information about the old pinned topic; may be null - OldTopicInfo ForumTopicInfo - // Information about the new pinned topic; may be null - NewTopicInfo ForumTopicInfo -} - -// ChatEventForumTopicPinnedTypeID is TL type id of ChatEventForumTopicPinned. -const ChatEventForumTopicPinnedTypeID = 0x7fc523ee - -// construct implements constructor of ChatEventActionClass. -func (c ChatEventForumTopicPinned) construct() ChatEventActionClass { return &c } - -// Ensuring interfaces in compile-time for ChatEventForumTopicPinned. -var ( - _ bin.Encoder = &ChatEventForumTopicPinned{} - _ bin.Decoder = &ChatEventForumTopicPinned{} - _ bin.BareEncoder = &ChatEventForumTopicPinned{} - _ bin.BareDecoder = &ChatEventForumTopicPinned{} - - _ ChatEventActionClass = &ChatEventForumTopicPinned{} -) - -func (c *ChatEventForumTopicPinned) Zero() bool { - if c == nil { - return true - } - if !(c.OldTopicInfo.Zero()) { - return false - } - if !(c.NewTopicInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventForumTopicPinned) String() string { - if c == nil { - return "ChatEventForumTopicPinned(nil)" - } - type Alias ChatEventForumTopicPinned - return fmt.Sprintf("ChatEventForumTopicPinned%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventForumTopicPinned) TypeID() uint32 { - return ChatEventForumTopicPinnedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventForumTopicPinned) TypeName() string { - return "chatEventForumTopicPinned" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventForumTopicPinned) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventForumTopicPinned", - ID: ChatEventForumTopicPinnedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldTopicInfo", - SchemaName: "old_topic_info", - }, - { - Name: "NewTopicInfo", - SchemaName: "new_topic_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventForumTopicPinned) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicPinned#7fc523ee as nil") - } - b.PutID(ChatEventForumTopicPinnedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventForumTopicPinned) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicPinned#7fc523ee as nil") - } - if err := c.OldTopicInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicPinned#7fc523ee: field old_topic_info: %w", err) - } - if err := c.NewTopicInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicPinned#7fc523ee: field new_topic_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventForumTopicPinned) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicPinned#7fc523ee to nil") - } - if err := b.ConsumeID(ChatEventForumTopicPinnedTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventForumTopicPinned) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicPinned#7fc523ee to nil") - } - { - if err := c.OldTopicInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: field old_topic_info: %w", err) - } - } - { - if err := c.NewTopicInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: field new_topic_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventForumTopicPinned) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventForumTopicPinned#7fc523ee as nil") - } - b.ObjStart() - b.PutID("chatEventForumTopicPinned") - b.Comma() - b.FieldStart("old_topic_info") - if err := c.OldTopicInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicPinned#7fc523ee: field old_topic_info: %w", err) - } - b.Comma() - b.FieldStart("new_topic_info") - if err := c.NewTopicInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEventForumTopicPinned#7fc523ee: field new_topic_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventForumTopicPinned) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventForumTopicPinned#7fc523ee to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventForumTopicPinned"); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: %w", err) - } - case "old_topic_info": - if err := c.OldTopicInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: field old_topic_info: %w", err) - } - case "new_topic_info": - if err := c.NewTopicInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEventForumTopicPinned#7fc523ee: field new_topic_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOldTopicInfo returns value of OldTopicInfo field. -func (c *ChatEventForumTopicPinned) GetOldTopicInfo() (value ForumTopicInfo) { - if c == nil { - return - } - return c.OldTopicInfo -} - -// GetNewTopicInfo returns value of NewTopicInfo field. -func (c *ChatEventForumTopicPinned) GetNewTopicInfo() (value ForumTopicInfo) { - if c == nil { - return - } - return c.NewTopicInfo -} - -// ChatEventActionClassName is schema name of ChatEventActionClass. -const ChatEventActionClassName = "ChatEventAction" - -// ChatEventActionClass represents ChatEventAction generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatEventAction(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatEventMessageEdited: // chatEventMessageEdited#e64ff5f8 -// case *tdapi.ChatEventMessageDeleted: // chatEventMessageDeleted#37bfcd73 -// case *tdapi.ChatEventMessagePinned: // chatEventMessagePinned#1a26ad1a -// case *tdapi.ChatEventMessageUnpinned: // chatEventMessageUnpinned#e9943b17 -// case *tdapi.ChatEventPollStopped: // chatEventPollStopped#77cc8be5 -// case *tdapi.ChatEventMemberJoined: // chatEventMemberJoined#f1f70924 -// case *tdapi.ChatEventMemberJoinedByInviteLink: // chatEventMemberJoinedByInviteLink#a9d6dd7a -// case *tdapi.ChatEventMemberJoinedByRequest: // chatEventMemberJoinedByRequest#9dc87e3f -// case *tdapi.ChatEventMemberInvited: // chatEventMemberInvited#38d7bfc9 -// case *tdapi.ChatEventMemberLeft: // chatEventMemberLeft#c778400f -// case *tdapi.ChatEventMemberPromoted: // chatEventMemberPromoted#1f4f6861 -// case *tdapi.ChatEventMemberRestricted: // chatEventMemberRestricted#5f951e05 -// case *tdapi.ChatEventMemberSubscriptionExtended: // chatEventMemberSubscriptionExtended#bbfab002 -// case *tdapi.ChatEventAvailableReactionsChanged: // chatEventAvailableReactionsChanged#97b8e0bf -// case *tdapi.ChatEventBackgroundChanged: // chatEventBackgroundChanged#b6ed6d38 -// case *tdapi.ChatEventDescriptionChanged: // chatEventDescriptionChanged#254cf1e -// case *tdapi.ChatEventEmojiStatusChanged: // chatEventEmojiStatusChanged#83e97b1e -// case *tdapi.ChatEventLinkedChatChanged: // chatEventLinkedChatChanged#6b2271af -// case *tdapi.ChatEventLocationChanged: // chatEventLocationChanged#e7cdfd4e -// case *tdapi.ChatEventMessageAutoDeleteTimeChanged: // chatEventMessageAutoDeleteTimeChanged#1083f24 -// case *tdapi.ChatEventPermissionsChanged: // chatEventPermissionsChanged#b1d337a8 -// case *tdapi.ChatEventPhotoChanged: // chatEventPhotoChanged#cfa062c3 -// case *tdapi.ChatEventSlowModeDelayChanged: // chatEventSlowModeDelayChanged#9d763c0b -// case *tdapi.ChatEventStickerSetChanged: // chatEventStickerSetChanged#b5e7558f -// case *tdapi.ChatEventCustomEmojiStickerSetChanged: // chatEventCustomEmojiStickerSetChanged#70c431b -// case *tdapi.ChatEventTitleChanged: // chatEventTitleChanged#43990ad2 -// case *tdapi.ChatEventUsernameChanged: // chatEventUsernameChanged#6707b56b -// case *tdapi.ChatEventActiveUsernamesChanged: // chatEventActiveUsernamesChanged#95e54656 -// case *tdapi.ChatEventAccentColorChanged: // chatEventAccentColorChanged#e6837733 -// case *tdapi.ChatEventProfileAccentColorChanged: // chatEventProfileAccentColorChanged#a5b8da64 -// case *tdapi.ChatEventHasProtectedContentToggled: // chatEventHasProtectedContentToggled#f5044201 -// case *tdapi.ChatEventInvitesToggled: // chatEventInvitesToggled#fc45966b -// case *tdapi.ChatEventIsAllHistoryAvailableToggled: // chatEventIsAllHistoryAvailableToggled#a0b03c15 -// case *tdapi.ChatEventHasAggressiveAntiSpamEnabledToggled: // chatEventHasAggressiveAntiSpamEnabledToggled#f8875702 -// case *tdapi.ChatEventSignMessagesToggled: // chatEventSignMessagesToggled#b1b9281e -// case *tdapi.ChatEventShowMessageSenderToggled: // chatEventShowMessageSenderToggled#d0a747e3 -// case *tdapi.ChatEventInviteLinkEdited: // chatEventInviteLinkEdited#e4920d62 -// case *tdapi.ChatEventInviteLinkRevoked: // chatEventInviteLinkRevoked#a1dbffe3 -// case *tdapi.ChatEventInviteLinkDeleted: // chatEventInviteLinkDeleted#acda6167 -// case *tdapi.ChatEventVideoChatCreated: // chatEventVideoChatCreated#6ca68a7b -// case *tdapi.ChatEventVideoChatEnded: // chatEventVideoChatEnded#61286c48 -// case *tdapi.ChatEventVideoChatMuteNewParticipantsToggled: // chatEventVideoChatMuteNewParticipantsToggled#f87507fe -// case *tdapi.ChatEventVideoChatParticipantIsMutedToggled: // chatEventVideoChatParticipantIsMutedToggled#1f1058f7 -// case *tdapi.ChatEventVideoChatParticipantVolumeLevelChanged: // chatEventVideoChatParticipantVolumeLevelChanged#436f92be -// case *tdapi.ChatEventIsForumToggled: // chatEventIsForumToggled#5a63d119 -// case *tdapi.ChatEventForumTopicCreated: // chatEventForumTopicCreated#7785fb42 -// case *tdapi.ChatEventForumTopicEdited: // chatEventForumTopicEdited#60da2c0c -// case *tdapi.ChatEventForumTopicToggleIsClosed: // chatEventForumTopicToggleIsClosed#c69e4d3a -// case *tdapi.ChatEventForumTopicToggleIsHidden: // chatEventForumTopicToggleIsHidden#a015ef2e -// case *tdapi.ChatEventForumTopicDeleted: // chatEventForumTopicDeleted#b08f290d -// case *tdapi.ChatEventForumTopicPinned: // chatEventForumTopicPinned#7fc523ee -// default: panic(v) -// } -type ChatEventActionClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatEventActionClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeChatEventAction implements binary de-serialization for ChatEventActionClass. -func DecodeChatEventAction(buf *bin.Buffer) (ChatEventActionClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatEventMessageEditedTypeID: - // Decoding chatEventMessageEdited#e64ff5f8. - v := ChatEventMessageEdited{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMessageDeletedTypeID: - // Decoding chatEventMessageDeleted#37bfcd73. - v := ChatEventMessageDeleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMessagePinnedTypeID: - // Decoding chatEventMessagePinned#1a26ad1a. - v := ChatEventMessagePinned{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMessageUnpinnedTypeID: - // Decoding chatEventMessageUnpinned#e9943b17. - v := ChatEventMessageUnpinned{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventPollStoppedTypeID: - // Decoding chatEventPollStopped#77cc8be5. - v := ChatEventPollStopped{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMemberJoinedTypeID: - // Decoding chatEventMemberJoined#f1f70924. - v := ChatEventMemberJoined{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMemberJoinedByInviteLinkTypeID: - // Decoding chatEventMemberJoinedByInviteLink#a9d6dd7a. - v := ChatEventMemberJoinedByInviteLink{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMemberJoinedByRequestTypeID: - // Decoding chatEventMemberJoinedByRequest#9dc87e3f. - v := ChatEventMemberJoinedByRequest{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMemberInvitedTypeID: - // Decoding chatEventMemberInvited#38d7bfc9. - v := ChatEventMemberInvited{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMemberLeftTypeID: - // Decoding chatEventMemberLeft#c778400f. - v := ChatEventMemberLeft{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMemberPromotedTypeID: - // Decoding chatEventMemberPromoted#1f4f6861. - v := ChatEventMemberPromoted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMemberRestrictedTypeID: - // Decoding chatEventMemberRestricted#5f951e05. - v := ChatEventMemberRestricted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMemberSubscriptionExtendedTypeID: - // Decoding chatEventMemberSubscriptionExtended#bbfab002. - v := ChatEventMemberSubscriptionExtended{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventAvailableReactionsChangedTypeID: - // Decoding chatEventAvailableReactionsChanged#97b8e0bf. - v := ChatEventAvailableReactionsChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventBackgroundChangedTypeID: - // Decoding chatEventBackgroundChanged#b6ed6d38. - v := ChatEventBackgroundChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventDescriptionChangedTypeID: - // Decoding chatEventDescriptionChanged#254cf1e. - v := ChatEventDescriptionChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventEmojiStatusChangedTypeID: - // Decoding chatEventEmojiStatusChanged#83e97b1e. - v := ChatEventEmojiStatusChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventLinkedChatChangedTypeID: - // Decoding chatEventLinkedChatChanged#6b2271af. - v := ChatEventLinkedChatChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventLocationChangedTypeID: - // Decoding chatEventLocationChanged#e7cdfd4e. - v := ChatEventLocationChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventMessageAutoDeleteTimeChangedTypeID: - // Decoding chatEventMessageAutoDeleteTimeChanged#1083f24. - v := ChatEventMessageAutoDeleteTimeChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventPermissionsChangedTypeID: - // Decoding chatEventPermissionsChanged#b1d337a8. - v := ChatEventPermissionsChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventPhotoChangedTypeID: - // Decoding chatEventPhotoChanged#cfa062c3. - v := ChatEventPhotoChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventSlowModeDelayChangedTypeID: - // Decoding chatEventSlowModeDelayChanged#9d763c0b. - v := ChatEventSlowModeDelayChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventStickerSetChangedTypeID: - // Decoding chatEventStickerSetChanged#b5e7558f. - v := ChatEventStickerSetChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventCustomEmojiStickerSetChangedTypeID: - // Decoding chatEventCustomEmojiStickerSetChanged#70c431b. - v := ChatEventCustomEmojiStickerSetChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventTitleChangedTypeID: - // Decoding chatEventTitleChanged#43990ad2. - v := ChatEventTitleChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventUsernameChangedTypeID: - // Decoding chatEventUsernameChanged#6707b56b. - v := ChatEventUsernameChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventActiveUsernamesChangedTypeID: - // Decoding chatEventActiveUsernamesChanged#95e54656. - v := ChatEventActiveUsernamesChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventAccentColorChangedTypeID: - // Decoding chatEventAccentColorChanged#e6837733. - v := ChatEventAccentColorChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventProfileAccentColorChangedTypeID: - // Decoding chatEventProfileAccentColorChanged#a5b8da64. - v := ChatEventProfileAccentColorChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventHasProtectedContentToggledTypeID: - // Decoding chatEventHasProtectedContentToggled#f5044201. - v := ChatEventHasProtectedContentToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventInvitesToggledTypeID: - // Decoding chatEventInvitesToggled#fc45966b. - v := ChatEventInvitesToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventIsAllHistoryAvailableToggledTypeID: - // Decoding chatEventIsAllHistoryAvailableToggled#a0b03c15. - v := ChatEventIsAllHistoryAvailableToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventHasAggressiveAntiSpamEnabledToggledTypeID: - // Decoding chatEventHasAggressiveAntiSpamEnabledToggled#f8875702. - v := ChatEventHasAggressiveAntiSpamEnabledToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventSignMessagesToggledTypeID: - // Decoding chatEventSignMessagesToggled#b1b9281e. - v := ChatEventSignMessagesToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventShowMessageSenderToggledTypeID: - // Decoding chatEventShowMessageSenderToggled#d0a747e3. - v := ChatEventShowMessageSenderToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventInviteLinkEditedTypeID: - // Decoding chatEventInviteLinkEdited#e4920d62. - v := ChatEventInviteLinkEdited{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventInviteLinkRevokedTypeID: - // Decoding chatEventInviteLinkRevoked#a1dbffe3. - v := ChatEventInviteLinkRevoked{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventInviteLinkDeletedTypeID: - // Decoding chatEventInviteLinkDeleted#acda6167. - v := ChatEventInviteLinkDeleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventVideoChatCreatedTypeID: - // Decoding chatEventVideoChatCreated#6ca68a7b. - v := ChatEventVideoChatCreated{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventVideoChatEndedTypeID: - // Decoding chatEventVideoChatEnded#61286c48. - v := ChatEventVideoChatEnded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventVideoChatMuteNewParticipantsToggledTypeID: - // Decoding chatEventVideoChatMuteNewParticipantsToggled#f87507fe. - v := ChatEventVideoChatMuteNewParticipantsToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventVideoChatParticipantIsMutedToggledTypeID: - // Decoding chatEventVideoChatParticipantIsMutedToggled#1f1058f7. - v := ChatEventVideoChatParticipantIsMutedToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventVideoChatParticipantVolumeLevelChangedTypeID: - // Decoding chatEventVideoChatParticipantVolumeLevelChanged#436f92be. - v := ChatEventVideoChatParticipantVolumeLevelChanged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventIsForumToggledTypeID: - // Decoding chatEventIsForumToggled#5a63d119. - v := ChatEventIsForumToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventForumTopicCreatedTypeID: - // Decoding chatEventForumTopicCreated#7785fb42. - v := ChatEventForumTopicCreated{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventForumTopicEditedTypeID: - // Decoding chatEventForumTopicEdited#60da2c0c. - v := ChatEventForumTopicEdited{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventForumTopicToggleIsClosedTypeID: - // Decoding chatEventForumTopicToggleIsClosed#c69e4d3a. - v := ChatEventForumTopicToggleIsClosed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventForumTopicToggleIsHiddenTypeID: - // Decoding chatEventForumTopicToggleIsHidden#a015ef2e. - v := ChatEventForumTopicToggleIsHidden{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventForumTopicDeletedTypeID: - // Decoding chatEventForumTopicDeleted#b08f290d. - v := ChatEventForumTopicDeleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case ChatEventForumTopicPinnedTypeID: - // Decoding chatEventForumTopicPinned#7fc523ee. - v := ChatEventForumTopicPinned{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatEventAction implements binary de-serialization for ChatEventActionClass. -func DecodeTDLibJSONChatEventAction(buf tdjson.Decoder) (ChatEventActionClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatEventMessageEdited": - // Decoding chatEventMessageEdited#e64ff5f8. - v := ChatEventMessageEdited{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMessageDeleted": - // Decoding chatEventMessageDeleted#37bfcd73. - v := ChatEventMessageDeleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMessagePinned": - // Decoding chatEventMessagePinned#1a26ad1a. - v := ChatEventMessagePinned{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMessageUnpinned": - // Decoding chatEventMessageUnpinned#e9943b17. - v := ChatEventMessageUnpinned{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventPollStopped": - // Decoding chatEventPollStopped#77cc8be5. - v := ChatEventPollStopped{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMemberJoined": - // Decoding chatEventMemberJoined#f1f70924. - v := ChatEventMemberJoined{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMemberJoinedByInviteLink": - // Decoding chatEventMemberJoinedByInviteLink#a9d6dd7a. - v := ChatEventMemberJoinedByInviteLink{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMemberJoinedByRequest": - // Decoding chatEventMemberJoinedByRequest#9dc87e3f. - v := ChatEventMemberJoinedByRequest{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMemberInvited": - // Decoding chatEventMemberInvited#38d7bfc9. - v := ChatEventMemberInvited{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMemberLeft": - // Decoding chatEventMemberLeft#c778400f. - v := ChatEventMemberLeft{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMemberPromoted": - // Decoding chatEventMemberPromoted#1f4f6861. - v := ChatEventMemberPromoted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMemberRestricted": - // Decoding chatEventMemberRestricted#5f951e05. - v := ChatEventMemberRestricted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMemberSubscriptionExtended": - // Decoding chatEventMemberSubscriptionExtended#bbfab002. - v := ChatEventMemberSubscriptionExtended{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventAvailableReactionsChanged": - // Decoding chatEventAvailableReactionsChanged#97b8e0bf. - v := ChatEventAvailableReactionsChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventBackgroundChanged": - // Decoding chatEventBackgroundChanged#b6ed6d38. - v := ChatEventBackgroundChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventDescriptionChanged": - // Decoding chatEventDescriptionChanged#254cf1e. - v := ChatEventDescriptionChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventEmojiStatusChanged": - // Decoding chatEventEmojiStatusChanged#83e97b1e. - v := ChatEventEmojiStatusChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventLinkedChatChanged": - // Decoding chatEventLinkedChatChanged#6b2271af. - v := ChatEventLinkedChatChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventLocationChanged": - // Decoding chatEventLocationChanged#e7cdfd4e. - v := ChatEventLocationChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventMessageAutoDeleteTimeChanged": - // Decoding chatEventMessageAutoDeleteTimeChanged#1083f24. - v := ChatEventMessageAutoDeleteTimeChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventPermissionsChanged": - // Decoding chatEventPermissionsChanged#b1d337a8. - v := ChatEventPermissionsChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventPhotoChanged": - // Decoding chatEventPhotoChanged#cfa062c3. - v := ChatEventPhotoChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventSlowModeDelayChanged": - // Decoding chatEventSlowModeDelayChanged#9d763c0b. - v := ChatEventSlowModeDelayChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventStickerSetChanged": - // Decoding chatEventStickerSetChanged#b5e7558f. - v := ChatEventStickerSetChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventCustomEmojiStickerSetChanged": - // Decoding chatEventCustomEmojiStickerSetChanged#70c431b. - v := ChatEventCustomEmojiStickerSetChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventTitleChanged": - // Decoding chatEventTitleChanged#43990ad2. - v := ChatEventTitleChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventUsernameChanged": - // Decoding chatEventUsernameChanged#6707b56b. - v := ChatEventUsernameChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventActiveUsernamesChanged": - // Decoding chatEventActiveUsernamesChanged#95e54656. - v := ChatEventActiveUsernamesChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventAccentColorChanged": - // Decoding chatEventAccentColorChanged#e6837733. - v := ChatEventAccentColorChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventProfileAccentColorChanged": - // Decoding chatEventProfileAccentColorChanged#a5b8da64. - v := ChatEventProfileAccentColorChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventHasProtectedContentToggled": - // Decoding chatEventHasProtectedContentToggled#f5044201. - v := ChatEventHasProtectedContentToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventInvitesToggled": - // Decoding chatEventInvitesToggled#fc45966b. - v := ChatEventInvitesToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventIsAllHistoryAvailableToggled": - // Decoding chatEventIsAllHistoryAvailableToggled#a0b03c15. - v := ChatEventIsAllHistoryAvailableToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventHasAggressiveAntiSpamEnabledToggled": - // Decoding chatEventHasAggressiveAntiSpamEnabledToggled#f8875702. - v := ChatEventHasAggressiveAntiSpamEnabledToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventSignMessagesToggled": - // Decoding chatEventSignMessagesToggled#b1b9281e. - v := ChatEventSignMessagesToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventShowMessageSenderToggled": - // Decoding chatEventShowMessageSenderToggled#d0a747e3. - v := ChatEventShowMessageSenderToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventInviteLinkEdited": - // Decoding chatEventInviteLinkEdited#e4920d62. - v := ChatEventInviteLinkEdited{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventInviteLinkRevoked": - // Decoding chatEventInviteLinkRevoked#a1dbffe3. - v := ChatEventInviteLinkRevoked{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventInviteLinkDeleted": - // Decoding chatEventInviteLinkDeleted#acda6167. - v := ChatEventInviteLinkDeleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventVideoChatCreated": - // Decoding chatEventVideoChatCreated#6ca68a7b. - v := ChatEventVideoChatCreated{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventVideoChatEnded": - // Decoding chatEventVideoChatEnded#61286c48. - v := ChatEventVideoChatEnded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventVideoChatMuteNewParticipantsToggled": - // Decoding chatEventVideoChatMuteNewParticipantsToggled#f87507fe. - v := ChatEventVideoChatMuteNewParticipantsToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventVideoChatParticipantIsMutedToggled": - // Decoding chatEventVideoChatParticipantIsMutedToggled#1f1058f7. - v := ChatEventVideoChatParticipantIsMutedToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventVideoChatParticipantVolumeLevelChanged": - // Decoding chatEventVideoChatParticipantVolumeLevelChanged#436f92be. - v := ChatEventVideoChatParticipantVolumeLevelChanged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventIsForumToggled": - // Decoding chatEventIsForumToggled#5a63d119. - v := ChatEventIsForumToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventForumTopicCreated": - // Decoding chatEventForumTopicCreated#7785fb42. - v := ChatEventForumTopicCreated{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventForumTopicEdited": - // Decoding chatEventForumTopicEdited#60da2c0c. - v := ChatEventForumTopicEdited{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventForumTopicToggleIsClosed": - // Decoding chatEventForumTopicToggleIsClosed#c69e4d3a. - v := ChatEventForumTopicToggleIsClosed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventForumTopicToggleIsHidden": - // Decoding chatEventForumTopicToggleIsHidden#a015ef2e. - v := ChatEventForumTopicToggleIsHidden{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventForumTopicDeleted": - // Decoding chatEventForumTopicDeleted#b08f290d. - v := ChatEventForumTopicDeleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - case "chatEventForumTopicPinned": - // Decoding chatEventForumTopicPinned#7fc523ee. - v := ChatEventForumTopicPinned{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatEventActionClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatEventAction boxes the ChatEventActionClass providing a helper. -type ChatEventActionBox struct { - ChatEventAction ChatEventActionClass -} - -// Decode implements bin.Decoder for ChatEventActionBox. -func (b *ChatEventActionBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatEventActionBox to nil") - } - v, err := DecodeChatEventAction(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatEventAction = v - return nil -} - -// Encode implements bin.Encode for ChatEventActionBox. -func (b *ChatEventActionBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatEventAction == nil { - return fmt.Errorf("unable to encode ChatEventActionClass as nil") - } - return b.ChatEventAction.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatEventActionBox. -func (b *ChatEventActionBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatEventActionBox to nil") - } - v, err := DecodeTDLibJSONChatEventAction(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatEventAction = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatEventActionBox. -func (b *ChatEventActionBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatEventAction == nil { - return fmt.Errorf("unable to encode ChatEventActionClass as nil") - } - return b.ChatEventAction.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_event_gen.go b/tdapi/tl_chat_event_gen.go deleted file mode 100644 index a1d80b233..000000000 --- a/tdapi/tl_chat_event_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatEvent represents TL type `chatEvent#d921b3d0`. -type ChatEvent struct { - // Chat event identifier - ID int64 - // Point in time (Unix timestamp) when the event happened - Date int32 - // Identifier of the user or chat who performed the action - MemberID MessageSenderClass - // The action - Action ChatEventActionClass -} - -// ChatEventTypeID is TL type id of ChatEvent. -const ChatEventTypeID = 0xd921b3d0 - -// Ensuring interfaces in compile-time for ChatEvent. -var ( - _ bin.Encoder = &ChatEvent{} - _ bin.Decoder = &ChatEvent{} - _ bin.BareEncoder = &ChatEvent{} - _ bin.BareDecoder = &ChatEvent{} -) - -func (c *ChatEvent) Zero() bool { - if c == nil { - return true - } - if !(c.ID == 0) { - return false - } - if !(c.Date == 0) { - return false - } - if !(c.MemberID == nil) { - return false - } - if !(c.Action == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEvent) String() string { - if c == nil { - return "ChatEvent(nil)" - } - type Alias ChatEvent - return fmt.Sprintf("ChatEvent%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEvent) TypeID() uint32 { - return ChatEventTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEvent) TypeName() string { - return "chatEvent" -} - -// TypeInfo returns info about TL type. -func (c *ChatEvent) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEvent", - ID: ChatEventTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "MemberID", - SchemaName: "member_id", - }, - { - Name: "Action", - SchemaName: "action", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEvent) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEvent#d921b3d0 as nil") - } - b.PutID(ChatEventTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEvent) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEvent#d921b3d0 as nil") - } - b.PutLong(c.ID) - b.PutInt32(c.Date) - if c.MemberID == nil { - return fmt.Errorf("unable to encode chatEvent#d921b3d0: field member_id is nil") - } - if err := c.MemberID.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEvent#d921b3d0: field member_id: %w", err) - } - if c.Action == nil { - return fmt.Errorf("unable to encode chatEvent#d921b3d0: field action is nil") - } - if err := c.Action.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatEvent#d921b3d0: field action: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEvent) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEvent#d921b3d0 to nil") - } - if err := b.ConsumeID(ChatEventTypeID); err != nil { - return fmt.Errorf("unable to decode chatEvent#d921b3d0: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEvent) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEvent#d921b3d0 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEvent#d921b3d0: field id: %w", err) - } - c.ID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEvent#d921b3d0: field date: %w", err) - } - c.Date = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatEvent#d921b3d0: field member_id: %w", err) - } - c.MemberID = value - } - { - value, err := DecodeChatEventAction(b) - if err != nil { - return fmt.Errorf("unable to decode chatEvent#d921b3d0: field action: %w", err) - } - c.Action = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEvent) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEvent#d921b3d0 as nil") - } - b.ObjStart() - b.PutID("chatEvent") - b.Comma() - b.FieldStart("id") - b.PutLong(c.ID) - b.Comma() - b.FieldStart("date") - b.PutInt32(c.Date) - b.Comma() - b.FieldStart("member_id") - if c.MemberID == nil { - return fmt.Errorf("unable to encode chatEvent#d921b3d0: field member_id is nil") - } - if err := c.MemberID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEvent#d921b3d0: field member_id: %w", err) - } - b.Comma() - b.FieldStart("action") - if c.Action == nil { - return fmt.Errorf("unable to encode chatEvent#d921b3d0: field action is nil") - } - if err := c.Action.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEvent#d921b3d0: field action: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEvent) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEvent#d921b3d0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEvent"); err != nil { - return fmt.Errorf("unable to decode chatEvent#d921b3d0: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatEvent#d921b3d0: field id: %w", err) - } - c.ID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatEvent#d921b3d0: field date: %w", err) - } - c.Date = value - case "member_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatEvent#d921b3d0: field member_id: %w", err) - } - c.MemberID = value - case "action": - value, err := DecodeTDLibJSONChatEventAction(b) - if err != nil { - return fmt.Errorf("unable to decode chatEvent#d921b3d0: field action: %w", err) - } - c.Action = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (c *ChatEvent) GetID() (value int64) { - if c == nil { - return - } - return c.ID -} - -// GetDate returns value of Date field. -func (c *ChatEvent) GetDate() (value int32) { - if c == nil { - return - } - return c.Date -} - -// GetMemberID returns value of MemberID field. -func (c *ChatEvent) GetMemberID() (value MessageSenderClass) { - if c == nil { - return - } - return c.MemberID -} - -// GetAction returns value of Action field. -func (c *ChatEvent) GetAction() (value ChatEventActionClass) { - if c == nil { - return - } - return c.Action -} diff --git a/tdapi/tl_chat_event_log_filters_gen.go b/tdapi/tl_chat_event_log_filters_gen.go deleted file mode 100644 index 71be6a38d..000000000 --- a/tdapi/tl_chat_event_log_filters_gen.go +++ /dev/null @@ -1,635 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatEventLogFilters represents TL type `chatEventLogFilters#c26e31b1`. -type ChatEventLogFilters struct { - // True, if message edits need to be returned - MessageEdits bool - // True, if message deletions need to be returned - MessageDeletions bool - // True, if pin/unpin events need to be returned - MessagePins bool - // True, if members joining events need to be returned - MemberJoins bool - // True, if members leaving events need to be returned - MemberLeaves bool - // True, if invited member events need to be returned - MemberInvites bool - // True, if member promotion/demotion events need to be returned - MemberPromotions bool - // True, if member restricted/unrestricted/banned/unbanned events need to be returned - MemberRestrictions bool - // True, if changes in chat information need to be returned - InfoChanges bool - // True, if changes in chat settings need to be returned - SettingChanges bool - // True, if changes to invite links need to be returned - InviteLinkChanges bool - // True, if video chat actions need to be returned - VideoChatChanges bool - // True, if forum-related actions need to be returned - ForumChanges bool - // True, if subscription extensions need to be returned - SubscriptionExtensions bool -} - -// ChatEventLogFiltersTypeID is TL type id of ChatEventLogFilters. -const ChatEventLogFiltersTypeID = 0xc26e31b1 - -// Ensuring interfaces in compile-time for ChatEventLogFilters. -var ( - _ bin.Encoder = &ChatEventLogFilters{} - _ bin.Decoder = &ChatEventLogFilters{} - _ bin.BareEncoder = &ChatEventLogFilters{} - _ bin.BareDecoder = &ChatEventLogFilters{} -) - -func (c *ChatEventLogFilters) Zero() bool { - if c == nil { - return true - } - if !(c.MessageEdits == false) { - return false - } - if !(c.MessageDeletions == false) { - return false - } - if !(c.MessagePins == false) { - return false - } - if !(c.MemberJoins == false) { - return false - } - if !(c.MemberLeaves == false) { - return false - } - if !(c.MemberInvites == false) { - return false - } - if !(c.MemberPromotions == false) { - return false - } - if !(c.MemberRestrictions == false) { - return false - } - if !(c.InfoChanges == false) { - return false - } - if !(c.SettingChanges == false) { - return false - } - if !(c.InviteLinkChanges == false) { - return false - } - if !(c.VideoChatChanges == false) { - return false - } - if !(c.ForumChanges == false) { - return false - } - if !(c.SubscriptionExtensions == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEventLogFilters) String() string { - if c == nil { - return "ChatEventLogFilters(nil)" - } - type Alias ChatEventLogFilters - return fmt.Sprintf("ChatEventLogFilters%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEventLogFilters) TypeID() uint32 { - return ChatEventLogFiltersTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEventLogFilters) TypeName() string { - return "chatEventLogFilters" -} - -// TypeInfo returns info about TL type. -func (c *ChatEventLogFilters) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEventLogFilters", - ID: ChatEventLogFiltersTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageEdits", - SchemaName: "message_edits", - }, - { - Name: "MessageDeletions", - SchemaName: "message_deletions", - }, - { - Name: "MessagePins", - SchemaName: "message_pins", - }, - { - Name: "MemberJoins", - SchemaName: "member_joins", - }, - { - Name: "MemberLeaves", - SchemaName: "member_leaves", - }, - { - Name: "MemberInvites", - SchemaName: "member_invites", - }, - { - Name: "MemberPromotions", - SchemaName: "member_promotions", - }, - { - Name: "MemberRestrictions", - SchemaName: "member_restrictions", - }, - { - Name: "InfoChanges", - SchemaName: "info_changes", - }, - { - Name: "SettingChanges", - SchemaName: "setting_changes", - }, - { - Name: "InviteLinkChanges", - SchemaName: "invite_link_changes", - }, - { - Name: "VideoChatChanges", - SchemaName: "video_chat_changes", - }, - { - Name: "ForumChanges", - SchemaName: "forum_changes", - }, - { - Name: "SubscriptionExtensions", - SchemaName: "subscription_extensions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEventLogFilters) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventLogFilters#c26e31b1 as nil") - } - b.PutID(ChatEventLogFiltersTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEventLogFilters) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEventLogFilters#c26e31b1 as nil") - } - b.PutBool(c.MessageEdits) - b.PutBool(c.MessageDeletions) - b.PutBool(c.MessagePins) - b.PutBool(c.MemberJoins) - b.PutBool(c.MemberLeaves) - b.PutBool(c.MemberInvites) - b.PutBool(c.MemberPromotions) - b.PutBool(c.MemberRestrictions) - b.PutBool(c.InfoChanges) - b.PutBool(c.SettingChanges) - b.PutBool(c.InviteLinkChanges) - b.PutBool(c.VideoChatChanges) - b.PutBool(c.ForumChanges) - b.PutBool(c.SubscriptionExtensions) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEventLogFilters) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventLogFilters#c26e31b1 to nil") - } - if err := b.ConsumeID(ChatEventLogFiltersTypeID); err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEventLogFilters) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEventLogFilters#c26e31b1 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_edits: %w", err) - } - c.MessageEdits = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_deletions: %w", err) - } - c.MessageDeletions = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_pins: %w", err) - } - c.MessagePins = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_joins: %w", err) - } - c.MemberJoins = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_leaves: %w", err) - } - c.MemberLeaves = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_invites: %w", err) - } - c.MemberInvites = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_promotions: %w", err) - } - c.MemberPromotions = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_restrictions: %w", err) - } - c.MemberRestrictions = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field info_changes: %w", err) - } - c.InfoChanges = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field setting_changes: %w", err) - } - c.SettingChanges = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field invite_link_changes: %w", err) - } - c.InviteLinkChanges = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field video_chat_changes: %w", err) - } - c.VideoChatChanges = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field forum_changes: %w", err) - } - c.ForumChanges = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field subscription_extensions: %w", err) - } - c.SubscriptionExtensions = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEventLogFilters) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEventLogFilters#c26e31b1 as nil") - } - b.ObjStart() - b.PutID("chatEventLogFilters") - b.Comma() - b.FieldStart("message_edits") - b.PutBool(c.MessageEdits) - b.Comma() - b.FieldStart("message_deletions") - b.PutBool(c.MessageDeletions) - b.Comma() - b.FieldStart("message_pins") - b.PutBool(c.MessagePins) - b.Comma() - b.FieldStart("member_joins") - b.PutBool(c.MemberJoins) - b.Comma() - b.FieldStart("member_leaves") - b.PutBool(c.MemberLeaves) - b.Comma() - b.FieldStart("member_invites") - b.PutBool(c.MemberInvites) - b.Comma() - b.FieldStart("member_promotions") - b.PutBool(c.MemberPromotions) - b.Comma() - b.FieldStart("member_restrictions") - b.PutBool(c.MemberRestrictions) - b.Comma() - b.FieldStart("info_changes") - b.PutBool(c.InfoChanges) - b.Comma() - b.FieldStart("setting_changes") - b.PutBool(c.SettingChanges) - b.Comma() - b.FieldStart("invite_link_changes") - b.PutBool(c.InviteLinkChanges) - b.Comma() - b.FieldStart("video_chat_changes") - b.PutBool(c.VideoChatChanges) - b.Comma() - b.FieldStart("forum_changes") - b.PutBool(c.ForumChanges) - b.Comma() - b.FieldStart("subscription_extensions") - b.PutBool(c.SubscriptionExtensions) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEventLogFilters) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEventLogFilters#c26e31b1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEventLogFilters"); err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: %w", err) - } - case "message_edits": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_edits: %w", err) - } - c.MessageEdits = value - case "message_deletions": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_deletions: %w", err) - } - c.MessageDeletions = value - case "message_pins": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field message_pins: %w", err) - } - c.MessagePins = value - case "member_joins": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_joins: %w", err) - } - c.MemberJoins = value - case "member_leaves": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_leaves: %w", err) - } - c.MemberLeaves = value - case "member_invites": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_invites: %w", err) - } - c.MemberInvites = value - case "member_promotions": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_promotions: %w", err) - } - c.MemberPromotions = value - case "member_restrictions": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field member_restrictions: %w", err) - } - c.MemberRestrictions = value - case "info_changes": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field info_changes: %w", err) - } - c.InfoChanges = value - case "setting_changes": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field setting_changes: %w", err) - } - c.SettingChanges = value - case "invite_link_changes": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field invite_link_changes: %w", err) - } - c.InviteLinkChanges = value - case "video_chat_changes": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field video_chat_changes: %w", err) - } - c.VideoChatChanges = value - case "forum_changes": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field forum_changes: %w", err) - } - c.ForumChanges = value - case "subscription_extensions": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatEventLogFilters#c26e31b1: field subscription_extensions: %w", err) - } - c.SubscriptionExtensions = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageEdits returns value of MessageEdits field. -func (c *ChatEventLogFilters) GetMessageEdits() (value bool) { - if c == nil { - return - } - return c.MessageEdits -} - -// GetMessageDeletions returns value of MessageDeletions field. -func (c *ChatEventLogFilters) GetMessageDeletions() (value bool) { - if c == nil { - return - } - return c.MessageDeletions -} - -// GetMessagePins returns value of MessagePins field. -func (c *ChatEventLogFilters) GetMessagePins() (value bool) { - if c == nil { - return - } - return c.MessagePins -} - -// GetMemberJoins returns value of MemberJoins field. -func (c *ChatEventLogFilters) GetMemberJoins() (value bool) { - if c == nil { - return - } - return c.MemberJoins -} - -// GetMemberLeaves returns value of MemberLeaves field. -func (c *ChatEventLogFilters) GetMemberLeaves() (value bool) { - if c == nil { - return - } - return c.MemberLeaves -} - -// GetMemberInvites returns value of MemberInvites field. -func (c *ChatEventLogFilters) GetMemberInvites() (value bool) { - if c == nil { - return - } - return c.MemberInvites -} - -// GetMemberPromotions returns value of MemberPromotions field. -func (c *ChatEventLogFilters) GetMemberPromotions() (value bool) { - if c == nil { - return - } - return c.MemberPromotions -} - -// GetMemberRestrictions returns value of MemberRestrictions field. -func (c *ChatEventLogFilters) GetMemberRestrictions() (value bool) { - if c == nil { - return - } - return c.MemberRestrictions -} - -// GetInfoChanges returns value of InfoChanges field. -func (c *ChatEventLogFilters) GetInfoChanges() (value bool) { - if c == nil { - return - } - return c.InfoChanges -} - -// GetSettingChanges returns value of SettingChanges field. -func (c *ChatEventLogFilters) GetSettingChanges() (value bool) { - if c == nil { - return - } - return c.SettingChanges -} - -// GetInviteLinkChanges returns value of InviteLinkChanges field. -func (c *ChatEventLogFilters) GetInviteLinkChanges() (value bool) { - if c == nil { - return - } - return c.InviteLinkChanges -} - -// GetVideoChatChanges returns value of VideoChatChanges field. -func (c *ChatEventLogFilters) GetVideoChatChanges() (value bool) { - if c == nil { - return - } - return c.VideoChatChanges -} - -// GetForumChanges returns value of ForumChanges field. -func (c *ChatEventLogFilters) GetForumChanges() (value bool) { - if c == nil { - return - } - return c.ForumChanges -} - -// GetSubscriptionExtensions returns value of SubscriptionExtensions field. -func (c *ChatEventLogFilters) GetSubscriptionExtensions() (value bool) { - if c == nil { - return - } - return c.SubscriptionExtensions -} diff --git a/tdapi/tl_chat_events_gen.go b/tdapi/tl_chat_events_gen.go deleted file mode 100644 index 5b30fe3ee..000000000 --- a/tdapi/tl_chat_events_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatEvents represents TL type `chatEvents#d73ecdc4`. -type ChatEvents struct { - // List of events - Events []ChatEvent -} - -// ChatEventsTypeID is TL type id of ChatEvents. -const ChatEventsTypeID = 0xd73ecdc4 - -// Ensuring interfaces in compile-time for ChatEvents. -var ( - _ bin.Encoder = &ChatEvents{} - _ bin.Decoder = &ChatEvents{} - _ bin.BareEncoder = &ChatEvents{} - _ bin.BareDecoder = &ChatEvents{} -) - -func (c *ChatEvents) Zero() bool { - if c == nil { - return true - } - if !(c.Events == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatEvents) String() string { - if c == nil { - return "ChatEvents(nil)" - } - type Alias ChatEvents - return fmt.Sprintf("ChatEvents%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatEvents) TypeID() uint32 { - return ChatEventsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatEvents) TypeName() string { - return "chatEvents" -} - -// TypeInfo returns info about TL type. -func (c *ChatEvents) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatEvents", - ID: ChatEventsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Events", - SchemaName: "events", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatEvents) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEvents#d73ecdc4 as nil") - } - b.PutID(ChatEventsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatEvents) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatEvents#d73ecdc4 as nil") - } - b.PutInt(len(c.Events)) - for idx, v := range c.Events { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatEvents#d73ecdc4: field events element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatEvents) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEvents#d73ecdc4 to nil") - } - if err := b.ConsumeID(ChatEventsTypeID); err != nil { - return fmt.Errorf("unable to decode chatEvents#d73ecdc4: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatEvents) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatEvents#d73ecdc4 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatEvents#d73ecdc4: field events: %w", err) - } - - if headerLen > 0 { - c.Events = make([]ChatEvent, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatEvent - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatEvents#d73ecdc4: field events: %w", err) - } - c.Events = append(c.Events, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatEvents) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatEvents#d73ecdc4 as nil") - } - b.ObjStart() - b.PutID("chatEvents") - b.Comma() - b.FieldStart("events") - b.ArrStart() - for idx, v := range c.Events { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatEvents#d73ecdc4: field events element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatEvents) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatEvents#d73ecdc4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatEvents"); err != nil { - return fmt.Errorf("unable to decode chatEvents#d73ecdc4: %w", err) - } - case "events": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatEvent - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatEvents#d73ecdc4: field events: %w", err) - } - c.Events = append(c.Events, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatEvents#d73ecdc4: field events: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetEvents returns value of Events field. -func (c *ChatEvents) GetEvents() (value []ChatEvent) { - if c == nil { - return - } - return c.Events -} diff --git a/tdapi/tl_chat_folder_gen.go b/tdapi/tl_chat_folder_gen.go deleted file mode 100644 index dc481bab0..000000000 --- a/tdapi/tl_chat_folder_gen.go +++ /dev/null @@ -1,752 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatFolder represents TL type `chatFolder#a2e17d38`. -type ChatFolder struct { - // The name of the folder - Name ChatFolderName - // The chosen icon for the chat folder; may be null. If null, use - // getChatFolderDefaultIconName to get default icon name for the folder - Icon ChatFolderIcon - // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then - // color is disabled. Can't be changed if folder tags are disabled or the current user - // doesn't have Telegram Premium subscription - ColorID int32 - // True, if at least one link has been created for the folder - IsShareable bool - // The chat identifiers of pinned chats in the folder. There can be up to - // getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret - // chats and the same number of secret chats, but the limit can be increased with - // Telegram Premium - PinnedChatIDs []int64 - // The chat identifiers of always included chats in the folder. There can be up to - // getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret - // chats and the same number of secret chats, but the limit can be increased with - // Telegram Premium - IncludedChatIDs []int64 - // The chat identifiers of always excluded chats in the folder. There can be up to - // getOption("chat_folder_chosen_chat_count_max") always excluded non-secret chats and - // the same number of secret chats, but the limit can be increased with Telegram Premium - ExcludedChatIDs []int64 - // True, if muted chats need to be excluded - ExcludeMuted bool - // True, if read chats need to be excluded - ExcludeRead bool - // True, if archived chats need to be excluded - ExcludeArchived bool - // True, if contacts need to be included - IncludeContacts bool - // True, if non-contact users need to be included - IncludeNonContacts bool - // True, if bots need to be included - IncludeBots bool - // True, if basic groups and supergroups need to be included - IncludeGroups bool - // True, if channels need to be included - IncludeChannels bool -} - -// ChatFolderTypeID is TL type id of ChatFolder. -const ChatFolderTypeID = 0xa2e17d38 - -// Ensuring interfaces in compile-time for ChatFolder. -var ( - _ bin.Encoder = &ChatFolder{} - _ bin.Decoder = &ChatFolder{} - _ bin.BareEncoder = &ChatFolder{} - _ bin.BareDecoder = &ChatFolder{} -) - -func (c *ChatFolder) Zero() bool { - if c == nil { - return true - } - if !(c.Name.Zero()) { - return false - } - if !(c.Icon.Zero()) { - return false - } - if !(c.ColorID == 0) { - return false - } - if !(c.IsShareable == false) { - return false - } - if !(c.PinnedChatIDs == nil) { - return false - } - if !(c.IncludedChatIDs == nil) { - return false - } - if !(c.ExcludedChatIDs == nil) { - return false - } - if !(c.ExcludeMuted == false) { - return false - } - if !(c.ExcludeRead == false) { - return false - } - if !(c.ExcludeArchived == false) { - return false - } - if !(c.IncludeContacts == false) { - return false - } - if !(c.IncludeNonContacts == false) { - return false - } - if !(c.IncludeBots == false) { - return false - } - if !(c.IncludeGroups == false) { - return false - } - if !(c.IncludeChannels == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatFolder) String() string { - if c == nil { - return "ChatFolder(nil)" - } - type Alias ChatFolder - return fmt.Sprintf("ChatFolder%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatFolder) TypeID() uint32 { - return ChatFolderTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatFolder) TypeName() string { - return "chatFolder" -} - -// TypeInfo returns info about TL type. -func (c *ChatFolder) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatFolder", - ID: ChatFolderTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Icon", - SchemaName: "icon", - }, - { - Name: "ColorID", - SchemaName: "color_id", - }, - { - Name: "IsShareable", - SchemaName: "is_shareable", - }, - { - Name: "PinnedChatIDs", - SchemaName: "pinned_chat_ids", - }, - { - Name: "IncludedChatIDs", - SchemaName: "included_chat_ids", - }, - { - Name: "ExcludedChatIDs", - SchemaName: "excluded_chat_ids", - }, - { - Name: "ExcludeMuted", - SchemaName: "exclude_muted", - }, - { - Name: "ExcludeRead", - SchemaName: "exclude_read", - }, - { - Name: "ExcludeArchived", - SchemaName: "exclude_archived", - }, - { - Name: "IncludeContacts", - SchemaName: "include_contacts", - }, - { - Name: "IncludeNonContacts", - SchemaName: "include_non_contacts", - }, - { - Name: "IncludeBots", - SchemaName: "include_bots", - }, - { - Name: "IncludeGroups", - SchemaName: "include_groups", - }, - { - Name: "IncludeChannels", - SchemaName: "include_channels", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatFolder) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolder#a2e17d38 as nil") - } - b.PutID(ChatFolderTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatFolder) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolder#a2e17d38 as nil") - } - if err := c.Name.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFolder#a2e17d38: field name: %w", err) - } - if err := c.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFolder#a2e17d38: field icon: %w", err) - } - b.PutInt32(c.ColorID) - b.PutBool(c.IsShareable) - b.PutInt(len(c.PinnedChatIDs)) - for _, v := range c.PinnedChatIDs { - b.PutInt53(v) - } - b.PutInt(len(c.IncludedChatIDs)) - for _, v := range c.IncludedChatIDs { - b.PutInt53(v) - } - b.PutInt(len(c.ExcludedChatIDs)) - for _, v := range c.ExcludedChatIDs { - b.PutInt53(v) - } - b.PutBool(c.ExcludeMuted) - b.PutBool(c.ExcludeRead) - b.PutBool(c.ExcludeArchived) - b.PutBool(c.IncludeContacts) - b.PutBool(c.IncludeNonContacts) - b.PutBool(c.IncludeBots) - b.PutBool(c.IncludeGroups) - b.PutBool(c.IncludeChannels) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatFolder) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolder#a2e17d38 to nil") - } - if err := b.ConsumeID(ChatFolderTypeID); err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatFolder) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolder#a2e17d38 to nil") - } - { - if err := c.Name.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field name: %w", err) - } - } - { - if err := c.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field icon: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field color_id: %w", err) - } - c.ColorID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field is_shareable: %w", err) - } - c.IsShareable = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field pinned_chat_ids: %w", err) - } - - if headerLen > 0 { - c.PinnedChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field pinned_chat_ids: %w", err) - } - c.PinnedChatIDs = append(c.PinnedChatIDs, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field included_chat_ids: %w", err) - } - - if headerLen > 0 { - c.IncludedChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field included_chat_ids: %w", err) - } - c.IncludedChatIDs = append(c.IncludedChatIDs, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field excluded_chat_ids: %w", err) - } - - if headerLen > 0 { - c.ExcludedChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field excluded_chat_ids: %w", err) - } - c.ExcludedChatIDs = append(c.ExcludedChatIDs, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_muted: %w", err) - } - c.ExcludeMuted = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_read: %w", err) - } - c.ExcludeRead = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_archived: %w", err) - } - c.ExcludeArchived = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_contacts: %w", err) - } - c.IncludeContacts = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_non_contacts: %w", err) - } - c.IncludeNonContacts = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_bots: %w", err) - } - c.IncludeBots = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_groups: %w", err) - } - c.IncludeGroups = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_channels: %w", err) - } - c.IncludeChannels = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatFolder) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatFolder#a2e17d38 as nil") - } - b.ObjStart() - b.PutID("chatFolder") - b.Comma() - b.FieldStart("name") - if err := c.Name.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatFolder#a2e17d38: field name: %w", err) - } - b.Comma() - b.FieldStart("icon") - if err := c.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatFolder#a2e17d38: field icon: %w", err) - } - b.Comma() - b.FieldStart("color_id") - b.PutInt32(c.ColorID) - b.Comma() - b.FieldStart("is_shareable") - b.PutBool(c.IsShareable) - b.Comma() - b.FieldStart("pinned_chat_ids") - b.ArrStart() - for _, v := range c.PinnedChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("included_chat_ids") - b.ArrStart() - for _, v := range c.IncludedChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("excluded_chat_ids") - b.ArrStart() - for _, v := range c.ExcludedChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("exclude_muted") - b.PutBool(c.ExcludeMuted) - b.Comma() - b.FieldStart("exclude_read") - b.PutBool(c.ExcludeRead) - b.Comma() - b.FieldStart("exclude_archived") - b.PutBool(c.ExcludeArchived) - b.Comma() - b.FieldStart("include_contacts") - b.PutBool(c.IncludeContacts) - b.Comma() - b.FieldStart("include_non_contacts") - b.PutBool(c.IncludeNonContacts) - b.Comma() - b.FieldStart("include_bots") - b.PutBool(c.IncludeBots) - b.Comma() - b.FieldStart("include_groups") - b.PutBool(c.IncludeGroups) - b.Comma() - b.FieldStart("include_channels") - b.PutBool(c.IncludeChannels) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatFolder) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatFolder#a2e17d38 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatFolder"); err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: %w", err) - } - case "name": - if err := c.Name.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field name: %w", err) - } - case "icon": - if err := c.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field icon: %w", err) - } - case "color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field color_id: %w", err) - } - c.ColorID = value - case "is_shareable": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field is_shareable: %w", err) - } - c.IsShareable = value - case "pinned_chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field pinned_chat_ids: %w", err) - } - c.PinnedChatIDs = append(c.PinnedChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field pinned_chat_ids: %w", err) - } - case "included_chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field included_chat_ids: %w", err) - } - c.IncludedChatIDs = append(c.IncludedChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field included_chat_ids: %w", err) - } - case "excluded_chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field excluded_chat_ids: %w", err) - } - c.ExcludedChatIDs = append(c.ExcludedChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field excluded_chat_ids: %w", err) - } - case "exclude_muted": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_muted: %w", err) - } - c.ExcludeMuted = value - case "exclude_read": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_read: %w", err) - } - c.ExcludeRead = value - case "exclude_archived": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field exclude_archived: %w", err) - } - c.ExcludeArchived = value - case "include_contacts": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_contacts: %w", err) - } - c.IncludeContacts = value - case "include_non_contacts": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_non_contacts: %w", err) - } - c.IncludeNonContacts = value - case "include_bots": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_bots: %w", err) - } - c.IncludeBots = value - case "include_groups": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_groups: %w", err) - } - c.IncludeGroups = value - case "include_channels": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolder#a2e17d38: field include_channels: %w", err) - } - c.IncludeChannels = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (c *ChatFolder) GetName() (value ChatFolderName) { - if c == nil { - return - } - return c.Name -} - -// GetIcon returns value of Icon field. -func (c *ChatFolder) GetIcon() (value ChatFolderIcon) { - if c == nil { - return - } - return c.Icon -} - -// GetColorID returns value of ColorID field. -func (c *ChatFolder) GetColorID() (value int32) { - if c == nil { - return - } - return c.ColorID -} - -// GetIsShareable returns value of IsShareable field. -func (c *ChatFolder) GetIsShareable() (value bool) { - if c == nil { - return - } - return c.IsShareable -} - -// GetPinnedChatIDs returns value of PinnedChatIDs field. -func (c *ChatFolder) GetPinnedChatIDs() (value []int64) { - if c == nil { - return - } - return c.PinnedChatIDs -} - -// GetIncludedChatIDs returns value of IncludedChatIDs field. -func (c *ChatFolder) GetIncludedChatIDs() (value []int64) { - if c == nil { - return - } - return c.IncludedChatIDs -} - -// GetExcludedChatIDs returns value of ExcludedChatIDs field. -func (c *ChatFolder) GetExcludedChatIDs() (value []int64) { - if c == nil { - return - } - return c.ExcludedChatIDs -} - -// GetExcludeMuted returns value of ExcludeMuted field. -func (c *ChatFolder) GetExcludeMuted() (value bool) { - if c == nil { - return - } - return c.ExcludeMuted -} - -// GetExcludeRead returns value of ExcludeRead field. -func (c *ChatFolder) GetExcludeRead() (value bool) { - if c == nil { - return - } - return c.ExcludeRead -} - -// GetExcludeArchived returns value of ExcludeArchived field. -func (c *ChatFolder) GetExcludeArchived() (value bool) { - if c == nil { - return - } - return c.ExcludeArchived -} - -// GetIncludeContacts returns value of IncludeContacts field. -func (c *ChatFolder) GetIncludeContacts() (value bool) { - if c == nil { - return - } - return c.IncludeContacts -} - -// GetIncludeNonContacts returns value of IncludeNonContacts field. -func (c *ChatFolder) GetIncludeNonContacts() (value bool) { - if c == nil { - return - } - return c.IncludeNonContacts -} - -// GetIncludeBots returns value of IncludeBots field. -func (c *ChatFolder) GetIncludeBots() (value bool) { - if c == nil { - return - } - return c.IncludeBots -} - -// GetIncludeGroups returns value of IncludeGroups field. -func (c *ChatFolder) GetIncludeGroups() (value bool) { - if c == nil { - return - } - return c.IncludeGroups -} - -// GetIncludeChannels returns value of IncludeChannels field. -func (c *ChatFolder) GetIncludeChannels() (value bool) { - if c == nil { - return - } - return c.IncludeChannels -} diff --git a/tdapi/tl_chat_folder_icon_gen.go b/tdapi/tl_chat_folder_icon_gen.go deleted file mode 100644 index eb4de6321..000000000 --- a/tdapi/tl_chat_folder_icon_gen.go +++ /dev/null @@ -1,194 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatFolderIcon represents TL type `chatFolderIcon#f74aa0e6`. -type ChatFolderIcon struct { - // The chosen icon name for short folder representation; one of "All", "Unread", - // "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", - Name string -} - -// ChatFolderIconTypeID is TL type id of ChatFolderIcon. -const ChatFolderIconTypeID = 0xf74aa0e6 - -// Ensuring interfaces in compile-time for ChatFolderIcon. -var ( - _ bin.Encoder = &ChatFolderIcon{} - _ bin.Decoder = &ChatFolderIcon{} - _ bin.BareEncoder = &ChatFolderIcon{} - _ bin.BareDecoder = &ChatFolderIcon{} -) - -func (c *ChatFolderIcon) Zero() bool { - if c == nil { - return true - } - if !(c.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatFolderIcon) String() string { - if c == nil { - return "ChatFolderIcon(nil)" - } - type Alias ChatFolderIcon - return fmt.Sprintf("ChatFolderIcon%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatFolderIcon) TypeID() uint32 { - return ChatFolderIconTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatFolderIcon) TypeName() string { - return "chatFolderIcon" -} - -// TypeInfo returns info about TL type. -func (c *ChatFolderIcon) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatFolderIcon", - ID: ChatFolderIconTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatFolderIcon) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderIcon#f74aa0e6 as nil") - } - b.PutID(ChatFolderIconTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatFolderIcon) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderIcon#f74aa0e6 as nil") - } - b.PutString(c.Name) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatFolderIcon) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderIcon#f74aa0e6 to nil") - } - if err := b.ConsumeID(ChatFolderIconTypeID); err != nil { - return fmt.Errorf("unable to decode chatFolderIcon#f74aa0e6: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatFolderIcon) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderIcon#f74aa0e6 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatFolderIcon#f74aa0e6: field name: %w", err) - } - c.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatFolderIcon) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderIcon#f74aa0e6 as nil") - } - b.ObjStart() - b.PutID("chatFolderIcon") - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatFolderIcon) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderIcon#f74aa0e6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatFolderIcon"); err != nil { - return fmt.Errorf("unable to decode chatFolderIcon#f74aa0e6: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatFolderIcon#f74aa0e6: field name: %w", err) - } - c.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (c *ChatFolderIcon) GetName() (value string) { - if c == nil { - return - } - return c.Name -} diff --git a/tdapi/tl_chat_folder_info_gen.go b/tdapi/tl_chat_folder_info_gen.go deleted file mode 100644 index 33690ecc6..000000000 --- a/tdapi/tl_chat_folder_info_gen.go +++ /dev/null @@ -1,364 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatFolderInfo represents TL type `chatFolderInfo#309c140d`. -type ChatFolderInfo struct { - // Unique chat folder identifier - ID int32 - // The name of the folder - Name ChatFolderName - // The chosen or default icon for the chat folder - Icon ChatFolderIcon - // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then - // color is disabled - ColorID int32 - // True, if at least one link has been created for the folder - IsShareable bool - // True, if the chat folder has invite links created by the current user - HasMyInviteLinks bool -} - -// ChatFolderInfoTypeID is TL type id of ChatFolderInfo. -const ChatFolderInfoTypeID = 0x309c140d - -// Ensuring interfaces in compile-time for ChatFolderInfo. -var ( - _ bin.Encoder = &ChatFolderInfo{} - _ bin.Decoder = &ChatFolderInfo{} - _ bin.BareEncoder = &ChatFolderInfo{} - _ bin.BareDecoder = &ChatFolderInfo{} -) - -func (c *ChatFolderInfo) Zero() bool { - if c == nil { - return true - } - if !(c.ID == 0) { - return false - } - if !(c.Name.Zero()) { - return false - } - if !(c.Icon.Zero()) { - return false - } - if !(c.ColorID == 0) { - return false - } - if !(c.IsShareable == false) { - return false - } - if !(c.HasMyInviteLinks == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatFolderInfo) String() string { - if c == nil { - return "ChatFolderInfo(nil)" - } - type Alias ChatFolderInfo - return fmt.Sprintf("ChatFolderInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatFolderInfo) TypeID() uint32 { - return ChatFolderInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatFolderInfo) TypeName() string { - return "chatFolderInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatFolderInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatFolderInfo", - ID: ChatFolderInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Icon", - SchemaName: "icon", - }, - { - Name: "ColorID", - SchemaName: "color_id", - }, - { - Name: "IsShareable", - SchemaName: "is_shareable", - }, - { - Name: "HasMyInviteLinks", - SchemaName: "has_my_invite_links", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatFolderInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInfo#309c140d as nil") - } - b.PutID(ChatFolderInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatFolderInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInfo#309c140d as nil") - } - b.PutInt32(c.ID) - if err := c.Name.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFolderInfo#309c140d: field name: %w", err) - } - if err := c.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFolderInfo#309c140d: field icon: %w", err) - } - b.PutInt32(c.ColorID) - b.PutBool(c.IsShareable) - b.PutBool(c.HasMyInviteLinks) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatFolderInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInfo#309c140d to nil") - } - if err := b.ConsumeID(ChatFolderInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatFolderInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInfo#309c140d to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field id: %w", err) - } - c.ID = value - } - { - if err := c.Name.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field name: %w", err) - } - } - { - if err := c.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field icon: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field color_id: %w", err) - } - c.ColorID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field is_shareable: %w", err) - } - c.IsShareable = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field has_my_invite_links: %w", err) - } - c.HasMyInviteLinks = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatFolderInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInfo#309c140d as nil") - } - b.ObjStart() - b.PutID("chatFolderInfo") - b.Comma() - b.FieldStart("id") - b.PutInt32(c.ID) - b.Comma() - b.FieldStart("name") - if err := c.Name.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatFolderInfo#309c140d: field name: %w", err) - } - b.Comma() - b.FieldStart("icon") - if err := c.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatFolderInfo#309c140d: field icon: %w", err) - } - b.Comma() - b.FieldStart("color_id") - b.PutInt32(c.ColorID) - b.Comma() - b.FieldStart("is_shareable") - b.PutBool(c.IsShareable) - b.Comma() - b.FieldStart("has_my_invite_links") - b.PutBool(c.HasMyInviteLinks) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatFolderInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInfo#309c140d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatFolderInfo"); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field id: %w", err) - } - c.ID = value - case "name": - if err := c.Name.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field name: %w", err) - } - case "icon": - if err := c.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field icon: %w", err) - } - case "color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field color_id: %w", err) - } - c.ColorID = value - case "is_shareable": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field is_shareable: %w", err) - } - c.IsShareable = value - case "has_my_invite_links": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInfo#309c140d: field has_my_invite_links: %w", err) - } - c.HasMyInviteLinks = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (c *ChatFolderInfo) GetID() (value int32) { - if c == nil { - return - } - return c.ID -} - -// GetName returns value of Name field. -func (c *ChatFolderInfo) GetName() (value ChatFolderName) { - if c == nil { - return - } - return c.Name -} - -// GetIcon returns value of Icon field. -func (c *ChatFolderInfo) GetIcon() (value ChatFolderIcon) { - if c == nil { - return - } - return c.Icon -} - -// GetColorID returns value of ColorID field. -func (c *ChatFolderInfo) GetColorID() (value int32) { - if c == nil { - return - } - return c.ColorID -} - -// GetIsShareable returns value of IsShareable field. -func (c *ChatFolderInfo) GetIsShareable() (value bool) { - if c == nil { - return - } - return c.IsShareable -} - -// GetHasMyInviteLinks returns value of HasMyInviteLinks field. -func (c *ChatFolderInfo) GetHasMyInviteLinks() (value bool) { - if c == nil { - return - } - return c.HasMyInviteLinks -} diff --git a/tdapi/tl_chat_folder_invite_link_gen.go b/tdapi/tl_chat_folder_invite_link_gen.go deleted file mode 100644 index 4c53889a9..000000000 --- a/tdapi/tl_chat_folder_invite_link_gen.go +++ /dev/null @@ -1,285 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatFolderInviteLink represents TL type `chatFolderInviteLink#d33caf97`. -type ChatFolderInviteLink struct { - // The chat folder invite link - InviteLink string - // Name of the link - Name string - // Identifiers of chats, included in the link - ChatIDs []int64 -} - -// ChatFolderInviteLinkTypeID is TL type id of ChatFolderInviteLink. -const ChatFolderInviteLinkTypeID = 0xd33caf97 - -// Ensuring interfaces in compile-time for ChatFolderInviteLink. -var ( - _ bin.Encoder = &ChatFolderInviteLink{} - _ bin.Decoder = &ChatFolderInviteLink{} - _ bin.BareEncoder = &ChatFolderInviteLink{} - _ bin.BareDecoder = &ChatFolderInviteLink{} -) - -func (c *ChatFolderInviteLink) Zero() bool { - if c == nil { - return true - } - if !(c.InviteLink == "") { - return false - } - if !(c.Name == "") { - return false - } - if !(c.ChatIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatFolderInviteLink) String() string { - if c == nil { - return "ChatFolderInviteLink(nil)" - } - type Alias ChatFolderInviteLink - return fmt.Sprintf("ChatFolderInviteLink%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatFolderInviteLink) TypeID() uint32 { - return ChatFolderInviteLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatFolderInviteLink) TypeName() string { - return "chatFolderInviteLink" -} - -// TypeInfo returns info about TL type. -func (c *ChatFolderInviteLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatFolderInviteLink", - ID: ChatFolderInviteLinkTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "ChatIDs", - SchemaName: "chat_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatFolderInviteLink) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInviteLink#d33caf97 as nil") - } - b.PutID(ChatFolderInviteLinkTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatFolderInviteLink) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInviteLink#d33caf97 as nil") - } - b.PutString(c.InviteLink) - b.PutString(c.Name) - b.PutInt(len(c.ChatIDs)) - for _, v := range c.ChatIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatFolderInviteLink) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInviteLink#d33caf97 to nil") - } - if err := b.ConsumeID(ChatFolderInviteLinkTypeID); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLink#d33caf97: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatFolderInviteLink) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInviteLink#d33caf97 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLink#d33caf97: field invite_link: %w", err) - } - c.InviteLink = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLink#d33caf97: field name: %w", err) - } - c.Name = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLink#d33caf97: field chat_ids: %w", err) - } - - if headerLen > 0 { - c.ChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLink#d33caf97: field chat_ids: %w", err) - } - c.ChatIDs = append(c.ChatIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatFolderInviteLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInviteLink#d33caf97 as nil") - } - b.ObjStart() - b.PutID("chatFolderInviteLink") - b.Comma() - b.FieldStart("invite_link") - b.PutString(c.InviteLink) - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.FieldStart("chat_ids") - b.ArrStart() - for _, v := range c.ChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatFolderInviteLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInviteLink#d33caf97 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatFolderInviteLink"); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLink#d33caf97: %w", err) - } - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLink#d33caf97: field invite_link: %w", err) - } - c.InviteLink = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLink#d33caf97: field name: %w", err) - } - c.Name = value - case "chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLink#d33caf97: field chat_ids: %w", err) - } - c.ChatIDs = append(c.ChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLink#d33caf97: field chat_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (c *ChatFolderInviteLink) GetInviteLink() (value string) { - if c == nil { - return - } - return c.InviteLink -} - -// GetName returns value of Name field. -func (c *ChatFolderInviteLink) GetName() (value string) { - if c == nil { - return - } - return c.Name -} - -// GetChatIDs returns value of ChatIDs field. -func (c *ChatFolderInviteLink) GetChatIDs() (value []int64) { - if c == nil { - return - } - return c.ChatIDs -} diff --git a/tdapi/tl_chat_folder_invite_link_info_gen.go b/tdapi/tl_chat_folder_invite_link_info_gen.go deleted file mode 100644 index 0cb376d47..000000000 --- a/tdapi/tl_chat_folder_invite_link_info_gen.go +++ /dev/null @@ -1,310 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatFolderInviteLinkInfo represents TL type `chatFolderInviteLinkInfo#776fe405`. -type ChatFolderInviteLinkInfo struct { - // Basic information about the chat folder; chat folder identifier will be 0 if the user - // didn't have the chat folder yet - ChatFolderInfo ChatFolderInfo - // Identifiers of the chats from the link, which aren't added to the folder yet - MissingChatIDs []int64 - // Identifiers of the chats from the link, which are added to the folder already - AddedChatIDs []int64 -} - -// ChatFolderInviteLinkInfoTypeID is TL type id of ChatFolderInviteLinkInfo. -const ChatFolderInviteLinkInfoTypeID = 0x776fe405 - -// Ensuring interfaces in compile-time for ChatFolderInviteLinkInfo. -var ( - _ bin.Encoder = &ChatFolderInviteLinkInfo{} - _ bin.Decoder = &ChatFolderInviteLinkInfo{} - _ bin.BareEncoder = &ChatFolderInviteLinkInfo{} - _ bin.BareDecoder = &ChatFolderInviteLinkInfo{} -) - -func (c *ChatFolderInviteLinkInfo) Zero() bool { - if c == nil { - return true - } - if !(c.ChatFolderInfo.Zero()) { - return false - } - if !(c.MissingChatIDs == nil) { - return false - } - if !(c.AddedChatIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatFolderInviteLinkInfo) String() string { - if c == nil { - return "ChatFolderInviteLinkInfo(nil)" - } - type Alias ChatFolderInviteLinkInfo - return fmt.Sprintf("ChatFolderInviteLinkInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatFolderInviteLinkInfo) TypeID() uint32 { - return ChatFolderInviteLinkInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatFolderInviteLinkInfo) TypeName() string { - return "chatFolderInviteLinkInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatFolderInviteLinkInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatFolderInviteLinkInfo", - ID: ChatFolderInviteLinkInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderInfo", - SchemaName: "chat_folder_info", - }, - { - Name: "MissingChatIDs", - SchemaName: "missing_chat_ids", - }, - { - Name: "AddedChatIDs", - SchemaName: "added_chat_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatFolderInviteLinkInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInviteLinkInfo#776fe405 as nil") - } - b.PutID(ChatFolderInviteLinkInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatFolderInviteLinkInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInviteLinkInfo#776fe405 as nil") - } - if err := c.ChatFolderInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFolderInviteLinkInfo#776fe405: field chat_folder_info: %w", err) - } - b.PutInt(len(c.MissingChatIDs)) - for _, v := range c.MissingChatIDs { - b.PutInt53(v) - } - b.PutInt(len(c.AddedChatIDs)) - for _, v := range c.AddedChatIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatFolderInviteLinkInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInviteLinkInfo#776fe405 to nil") - } - if err := b.ConsumeID(ChatFolderInviteLinkInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatFolderInviteLinkInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInviteLinkInfo#776fe405 to nil") - } - { - if err := c.ChatFolderInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: field chat_folder_info: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: field missing_chat_ids: %w", err) - } - - if headerLen > 0 { - c.MissingChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: field missing_chat_ids: %w", err) - } - c.MissingChatIDs = append(c.MissingChatIDs, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: field added_chat_ids: %w", err) - } - - if headerLen > 0 { - c.AddedChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: field added_chat_ids: %w", err) - } - c.AddedChatIDs = append(c.AddedChatIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatFolderInviteLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInviteLinkInfo#776fe405 as nil") - } - b.ObjStart() - b.PutID("chatFolderInviteLinkInfo") - b.Comma() - b.FieldStart("chat_folder_info") - if err := c.ChatFolderInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatFolderInviteLinkInfo#776fe405: field chat_folder_info: %w", err) - } - b.Comma() - b.FieldStart("missing_chat_ids") - b.ArrStart() - for _, v := range c.MissingChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("added_chat_ids") - b.ArrStart() - for _, v := range c.AddedChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatFolderInviteLinkInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInviteLinkInfo#776fe405 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatFolderInviteLinkInfo"); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: %w", err) - } - case "chat_folder_info": - if err := c.ChatFolderInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: field chat_folder_info: %w", err) - } - case "missing_chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: field missing_chat_ids: %w", err) - } - c.MissingChatIDs = append(c.MissingChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: field missing_chat_ids: %w", err) - } - case "added_chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: field added_chat_ids: %w", err) - } - c.AddedChatIDs = append(c.AddedChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinkInfo#776fe405: field added_chat_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderInfo returns value of ChatFolderInfo field. -func (c *ChatFolderInviteLinkInfo) GetChatFolderInfo() (value ChatFolderInfo) { - if c == nil { - return - } - return c.ChatFolderInfo -} - -// GetMissingChatIDs returns value of MissingChatIDs field. -func (c *ChatFolderInviteLinkInfo) GetMissingChatIDs() (value []int64) { - if c == nil { - return - } - return c.MissingChatIDs -} - -// GetAddedChatIDs returns value of AddedChatIDs field. -func (c *ChatFolderInviteLinkInfo) GetAddedChatIDs() (value []int64) { - if c == nil { - return - } - return c.AddedChatIDs -} diff --git a/tdapi/tl_chat_folder_invite_links_gen.go b/tdapi/tl_chat_folder_invite_links_gen.go deleted file mode 100644 index ebb775c65..000000000 --- a/tdapi/tl_chat_folder_invite_links_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatFolderInviteLinks represents TL type `chatFolderInviteLinks#6c135313`. -type ChatFolderInviteLinks struct { - // List of the invite links - InviteLinks []ChatFolderInviteLink -} - -// ChatFolderInviteLinksTypeID is TL type id of ChatFolderInviteLinks. -const ChatFolderInviteLinksTypeID = 0x6c135313 - -// Ensuring interfaces in compile-time for ChatFolderInviteLinks. -var ( - _ bin.Encoder = &ChatFolderInviteLinks{} - _ bin.Decoder = &ChatFolderInviteLinks{} - _ bin.BareEncoder = &ChatFolderInviteLinks{} - _ bin.BareDecoder = &ChatFolderInviteLinks{} -) - -func (c *ChatFolderInviteLinks) Zero() bool { - if c == nil { - return true - } - if !(c.InviteLinks == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatFolderInviteLinks) String() string { - if c == nil { - return "ChatFolderInviteLinks(nil)" - } - type Alias ChatFolderInviteLinks - return fmt.Sprintf("ChatFolderInviteLinks%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatFolderInviteLinks) TypeID() uint32 { - return ChatFolderInviteLinksTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatFolderInviteLinks) TypeName() string { - return "chatFolderInviteLinks" -} - -// TypeInfo returns info about TL type. -func (c *ChatFolderInviteLinks) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatFolderInviteLinks", - ID: ChatFolderInviteLinksTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLinks", - SchemaName: "invite_links", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatFolderInviteLinks) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInviteLinks#6c135313 as nil") - } - b.PutID(ChatFolderInviteLinksTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatFolderInviteLinks) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInviteLinks#6c135313 as nil") - } - b.PutInt(len(c.InviteLinks)) - for idx, v := range c.InviteLinks { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatFolderInviteLinks#6c135313: field invite_links element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatFolderInviteLinks) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInviteLinks#6c135313 to nil") - } - if err := b.ConsumeID(ChatFolderInviteLinksTypeID); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinks#6c135313: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatFolderInviteLinks) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInviteLinks#6c135313 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinks#6c135313: field invite_links: %w", err) - } - - if headerLen > 0 { - c.InviteLinks = make([]ChatFolderInviteLink, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatFolderInviteLink - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatFolderInviteLinks#6c135313: field invite_links: %w", err) - } - c.InviteLinks = append(c.InviteLinks, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatFolderInviteLinks) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderInviteLinks#6c135313 as nil") - } - b.ObjStart() - b.PutID("chatFolderInviteLinks") - b.Comma() - b.FieldStart("invite_links") - b.ArrStart() - for idx, v := range c.InviteLinks { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatFolderInviteLinks#6c135313: field invite_links element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatFolderInviteLinks) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderInviteLinks#6c135313 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatFolderInviteLinks"); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinks#6c135313: %w", err) - } - case "invite_links": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatFolderInviteLink - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinks#6c135313: field invite_links: %w", err) - } - c.InviteLinks = append(c.InviteLinks, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatFolderInviteLinks#6c135313: field invite_links: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLinks returns value of InviteLinks field. -func (c *ChatFolderInviteLinks) GetInviteLinks() (value []ChatFolderInviteLink) { - if c == nil { - return - } - return c.InviteLinks -} diff --git a/tdapi/tl_chat_folder_name_gen.go b/tdapi/tl_chat_folder_name_gen.go deleted file mode 100644 index a07827bbf..000000000 --- a/tdapi/tl_chat_folder_name_gen.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatFolderName represents TL type `chatFolderName#ec4d3d9e`. -type ChatFolderName struct { - // The text of the chat folder name; 1-12 characters without line feeds. May contain only - // CustomEmoji entities - Text FormattedText - // True, if custom emoji in the name must be animated - AnimateCustomEmoji bool -} - -// ChatFolderNameTypeID is TL type id of ChatFolderName. -const ChatFolderNameTypeID = 0xec4d3d9e - -// Ensuring interfaces in compile-time for ChatFolderName. -var ( - _ bin.Encoder = &ChatFolderName{} - _ bin.Decoder = &ChatFolderName{} - _ bin.BareEncoder = &ChatFolderName{} - _ bin.BareDecoder = &ChatFolderName{} -) - -func (c *ChatFolderName) Zero() bool { - if c == nil { - return true - } - if !(c.Text.Zero()) { - return false - } - if !(c.AnimateCustomEmoji == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatFolderName) String() string { - if c == nil { - return "ChatFolderName(nil)" - } - type Alias ChatFolderName - return fmt.Sprintf("ChatFolderName%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatFolderName) TypeID() uint32 { - return ChatFolderNameTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatFolderName) TypeName() string { - return "chatFolderName" -} - -// TypeInfo returns info about TL type. -func (c *ChatFolderName) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatFolderName", - ID: ChatFolderNameTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "AnimateCustomEmoji", - SchemaName: "animate_custom_emoji", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatFolderName) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderName#ec4d3d9e as nil") - } - b.PutID(ChatFolderNameTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatFolderName) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderName#ec4d3d9e as nil") - } - if err := c.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatFolderName#ec4d3d9e: field text: %w", err) - } - b.PutBool(c.AnimateCustomEmoji) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatFolderName) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderName#ec4d3d9e to nil") - } - if err := b.ConsumeID(ChatFolderNameTypeID); err != nil { - return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatFolderName) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderName#ec4d3d9e to nil") - } - { - if err := c.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: field text: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: field animate_custom_emoji: %w", err) - } - c.AnimateCustomEmoji = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatFolderName) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatFolderName#ec4d3d9e as nil") - } - b.ObjStart() - b.PutID("chatFolderName") - b.Comma() - b.FieldStart("text") - if err := c.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatFolderName#ec4d3d9e: field text: %w", err) - } - b.Comma() - b.FieldStart("animate_custom_emoji") - b.PutBool(c.AnimateCustomEmoji) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatFolderName) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatFolderName#ec4d3d9e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatFolderName"); err != nil { - return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: %w", err) - } - case "text": - if err := c.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: field text: %w", err) - } - case "animate_custom_emoji": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatFolderName#ec4d3d9e: field animate_custom_emoji: %w", err) - } - c.AnimateCustomEmoji = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (c *ChatFolderName) GetText() (value FormattedText) { - if c == nil { - return - } - return c.Text -} - -// GetAnimateCustomEmoji returns value of AnimateCustomEmoji field. -func (c *ChatFolderName) GetAnimateCustomEmoji() (value bool) { - if c == nil { - return - } - return c.AnimateCustomEmoji -} diff --git a/tdapi/tl_chat_gen.go b/tdapi/tl_chat_gen.go deleted file mode 100644 index d7ea66eef..000000000 --- a/tdapi/tl_chat_gen.go +++ /dev/null @@ -1,1681 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Chat represents TL type `chat#e5bae2e4`. -type Chat struct { - // Chat unique identifier - ID int64 - // Type of the chat - Type ChatTypeClass - // Chat title - Title string - // Chat photo; may be null - Photo ChatPhotoInfo - // Identifier of the accent color for message sender name, and backgrounds of chat photo, - // reply header, and link preview - AccentColorID int32 - // Identifier of a custom emoji to be shown on the reply header and link preview - // background for messages sent by the chat; 0 if none - BackgroundCustomEmojiID int64 - // Identifier of the profile accent color for the chat's profile; -1 if none - ProfileAccentColorID int32 - // Identifier of a custom emoji to be shown on the background of the chat's profile; 0 if - // none - ProfileBackgroundCustomEmojiID int64 - // Actions that non-administrator chat members are allowed to take in the chat - Permissions ChatPermissions - // Last message in the chat; may be null if none or unknown - LastMessage Message - // Positions of the chat in chat lists - Positions []ChatPosition - // Chat lists to which the chat belongs. A chat can have a non-zero position in a chat - // list even it doesn't belong to the chat list and have no position in a chat list even - // it belongs to the chat list - ChatLists []ChatListClass - // Identifier of a user or chat that is selected to send messages in the chat; may be - // null if the user can't change message sender - MessageSenderID MessageSenderClass - // Block list to which the chat is added; may be null if none - BlockList BlockListClass - // True, if chat content can't be saved locally, forwarded, or copied - HasProtectedContent bool - // True, if translation of all messages in the chat must be suggested to the user - IsTranslatable bool - // True, if the chat is marked as unread - IsMarkedAsUnread bool - // True, if the chat is a forum supergroup that must be shown in the "View as topics" - // mode, or Saved Messages chat that must be shown in the "View as chats" - ViewAsTopics bool - // True, if the chat has scheduled messages - HasScheduledMessages bool - // True, if the chat messages can be deleted only for the current user while other users - // will continue to see the messages - CanBeDeletedOnlyForSelf bool - // True, if the chat messages can be deleted for all users - CanBeDeletedForAllUsers bool - // True, if the chat can be reported to Telegram moderators through reportChat or - // reportChatPhoto - CanBeReported bool - // Default value of the disable_notification parameter, used when a message is sent to - // the chat - DefaultDisableNotification bool - // Number of unread messages in the chat - UnreadCount int32 - // Identifier of the last read incoming message - LastReadInboxMessageID int64 - // Identifier of the last read outgoing message - LastReadOutboxMessageID int64 - // Number of unread messages with a mention/reply in the chat - UnreadMentionCount int32 - // Number of messages with unread reactions in the chat - UnreadReactionCount int32 - // Notification settings for the chat - NotificationSettings ChatNotificationSettings - // Types of reaction, available in the chat - AvailableReactions ChatAvailableReactionsClass - // Current message auto-delete or self-destruct timer setting for the chat, in seconds; 0 - // if disabled. Self-destruct timer in secret chats starts after the message or its - // content is viewed. Auto-delete timer in other chats starts from the send date - MessageAutoDeleteTime int32 - // Emoji status to be shown along with chat title; may be null - EmojiStatus EmojiStatus - // Background set for the chat; may be null if none - Background ChatBackground - // If non-empty, name of a theme, set for the chat - ThemeName string - // Information about actions which must be possible to do through the chat action bar; - // may be null if none - ActionBar ChatActionBarClass - // Information about bar for managing a business bot in the chat; may be null if none - BusinessBotManageBar BusinessBotManageBar - // Information about video chat of the chat - VideoChat VideoChat - // Information about pending join requests; may be null if none - PendingJoinRequests ChatJoinRequestsInfo - // Identifier of the message from which reply markup needs to be used; 0 if there is no - // default custom reply markup in the chat - ReplyMarkupMessageID int64 - // A draft of a message in the chat; may be null if none - DraftMessage DraftMessage - // Application-specific data associated with the chat. (For example, the chat scroll - // position or local chat notification settings can be stored here.) Persistent if the - // message database is used - ClientData string -} - -// ChatTypeID is TL type id of Chat. -const ChatTypeID = 0xe5bae2e4 - -// Ensuring interfaces in compile-time for Chat. -var ( - _ bin.Encoder = &Chat{} - _ bin.Decoder = &Chat{} - _ bin.BareEncoder = &Chat{} - _ bin.BareDecoder = &Chat{} -) - -func (c *Chat) Zero() bool { - if c == nil { - return true - } - if !(c.ID == 0) { - return false - } - if !(c.Type == nil) { - return false - } - if !(c.Title == "") { - return false - } - if !(c.Photo.Zero()) { - return false - } - if !(c.AccentColorID == 0) { - return false - } - if !(c.BackgroundCustomEmojiID == 0) { - return false - } - if !(c.ProfileAccentColorID == 0) { - return false - } - if !(c.ProfileBackgroundCustomEmojiID == 0) { - return false - } - if !(c.Permissions.Zero()) { - return false - } - if !(c.LastMessage.Zero()) { - return false - } - if !(c.Positions == nil) { - return false - } - if !(c.ChatLists == nil) { - return false - } - if !(c.MessageSenderID == nil) { - return false - } - if !(c.BlockList == nil) { - return false - } - if !(c.HasProtectedContent == false) { - return false - } - if !(c.IsTranslatable == false) { - return false - } - if !(c.IsMarkedAsUnread == false) { - return false - } - if !(c.ViewAsTopics == false) { - return false - } - if !(c.HasScheduledMessages == false) { - return false - } - if !(c.CanBeDeletedOnlyForSelf == false) { - return false - } - if !(c.CanBeDeletedForAllUsers == false) { - return false - } - if !(c.CanBeReported == false) { - return false - } - if !(c.DefaultDisableNotification == false) { - return false - } - if !(c.UnreadCount == 0) { - return false - } - if !(c.LastReadInboxMessageID == 0) { - return false - } - if !(c.LastReadOutboxMessageID == 0) { - return false - } - if !(c.UnreadMentionCount == 0) { - return false - } - if !(c.UnreadReactionCount == 0) { - return false - } - if !(c.NotificationSettings.Zero()) { - return false - } - if !(c.AvailableReactions == nil) { - return false - } - if !(c.MessageAutoDeleteTime == 0) { - return false - } - if !(c.EmojiStatus.Zero()) { - return false - } - if !(c.Background.Zero()) { - return false - } - if !(c.ThemeName == "") { - return false - } - if !(c.ActionBar == nil) { - return false - } - if !(c.BusinessBotManageBar.Zero()) { - return false - } - if !(c.VideoChat.Zero()) { - return false - } - if !(c.PendingJoinRequests.Zero()) { - return false - } - if !(c.ReplyMarkupMessageID == 0) { - return false - } - if !(c.DraftMessage.Zero()) { - return false - } - if !(c.ClientData == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *Chat) String() string { - if c == nil { - return "Chat(nil)" - } - type Alias Chat - return fmt.Sprintf("Chat%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Chat) TypeID() uint32 { - return ChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*Chat) TypeName() string { - return "chat" -} - -// TypeInfo returns info about TL type. -func (c *Chat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chat", - ID: ChatTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "AccentColorID", - SchemaName: "accent_color_id", - }, - { - Name: "BackgroundCustomEmojiID", - SchemaName: "background_custom_emoji_id", - }, - { - Name: "ProfileAccentColorID", - SchemaName: "profile_accent_color_id", - }, - { - Name: "ProfileBackgroundCustomEmojiID", - SchemaName: "profile_background_custom_emoji_id", - }, - { - Name: "Permissions", - SchemaName: "permissions", - }, - { - Name: "LastMessage", - SchemaName: "last_message", - }, - { - Name: "Positions", - SchemaName: "positions", - }, - { - Name: "ChatLists", - SchemaName: "chat_lists", - }, - { - Name: "MessageSenderID", - SchemaName: "message_sender_id", - }, - { - Name: "BlockList", - SchemaName: "block_list", - }, - { - Name: "HasProtectedContent", - SchemaName: "has_protected_content", - }, - { - Name: "IsTranslatable", - SchemaName: "is_translatable", - }, - { - Name: "IsMarkedAsUnread", - SchemaName: "is_marked_as_unread", - }, - { - Name: "ViewAsTopics", - SchemaName: "view_as_topics", - }, - { - Name: "HasScheduledMessages", - SchemaName: "has_scheduled_messages", - }, - { - Name: "CanBeDeletedOnlyForSelf", - SchemaName: "can_be_deleted_only_for_self", - }, - { - Name: "CanBeDeletedForAllUsers", - SchemaName: "can_be_deleted_for_all_users", - }, - { - Name: "CanBeReported", - SchemaName: "can_be_reported", - }, - { - Name: "DefaultDisableNotification", - SchemaName: "default_disable_notification", - }, - { - Name: "UnreadCount", - SchemaName: "unread_count", - }, - { - Name: "LastReadInboxMessageID", - SchemaName: "last_read_inbox_message_id", - }, - { - Name: "LastReadOutboxMessageID", - SchemaName: "last_read_outbox_message_id", - }, - { - Name: "UnreadMentionCount", - SchemaName: "unread_mention_count", - }, - { - Name: "UnreadReactionCount", - SchemaName: "unread_reaction_count", - }, - { - Name: "NotificationSettings", - SchemaName: "notification_settings", - }, - { - Name: "AvailableReactions", - SchemaName: "available_reactions", - }, - { - Name: "MessageAutoDeleteTime", - SchemaName: "message_auto_delete_time", - }, - { - Name: "EmojiStatus", - SchemaName: "emoji_status", - }, - { - Name: "Background", - SchemaName: "background", - }, - { - Name: "ThemeName", - SchemaName: "theme_name", - }, - { - Name: "ActionBar", - SchemaName: "action_bar", - }, - { - Name: "BusinessBotManageBar", - SchemaName: "business_bot_manage_bar", - }, - { - Name: "VideoChat", - SchemaName: "video_chat", - }, - { - Name: "PendingJoinRequests", - SchemaName: "pending_join_requests", - }, - { - Name: "ReplyMarkupMessageID", - SchemaName: "reply_markup_message_id", - }, - { - Name: "DraftMessage", - SchemaName: "draft_message", - }, - { - Name: "ClientData", - SchemaName: "client_data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *Chat) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chat#e5bae2e4 as nil") - } - b.PutID(ChatTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *Chat) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chat#e5bae2e4 as nil") - } - b.PutInt53(c.ID) - if c.Type == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field type is nil") - } - if err := c.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field type: %w", err) - } - b.PutString(c.Title) - if err := c.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field photo: %w", err) - } - b.PutInt32(c.AccentColorID) - b.PutLong(c.BackgroundCustomEmojiID) - b.PutInt32(c.ProfileAccentColorID) - b.PutLong(c.ProfileBackgroundCustomEmojiID) - if err := c.Permissions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field permissions: %w", err) - } - if err := c.LastMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field last_message: %w", err) - } - b.PutInt(len(c.Positions)) - for idx, v := range c.Positions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chat#e5bae2e4: field positions element with index %d: %w", idx, err) - } - } - b.PutInt(len(c.ChatLists)) - for idx, v := range c.ChatLists { - if v == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field chat_lists element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chat#e5bae2e4: field chat_lists element with index %d: %w", idx, err) - } - } - if c.MessageSenderID == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field message_sender_id is nil") - } - if err := c.MessageSenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field message_sender_id: %w", err) - } - if c.BlockList == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field block_list is nil") - } - if err := c.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field block_list: %w", err) - } - b.PutBool(c.HasProtectedContent) - b.PutBool(c.IsTranslatable) - b.PutBool(c.IsMarkedAsUnread) - b.PutBool(c.ViewAsTopics) - b.PutBool(c.HasScheduledMessages) - b.PutBool(c.CanBeDeletedOnlyForSelf) - b.PutBool(c.CanBeDeletedForAllUsers) - b.PutBool(c.CanBeReported) - b.PutBool(c.DefaultDisableNotification) - b.PutInt32(c.UnreadCount) - b.PutInt53(c.LastReadInboxMessageID) - b.PutInt53(c.LastReadOutboxMessageID) - b.PutInt32(c.UnreadMentionCount) - b.PutInt32(c.UnreadReactionCount) - if err := c.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field notification_settings: %w", err) - } - if c.AvailableReactions == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field available_reactions is nil") - } - if err := c.AvailableReactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field available_reactions: %w", err) - } - b.PutInt32(c.MessageAutoDeleteTime) - if err := c.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field emoji_status: %w", err) - } - if err := c.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field background: %w", err) - } - b.PutString(c.ThemeName) - if c.ActionBar == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field action_bar is nil") - } - if err := c.ActionBar.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field action_bar: %w", err) - } - if err := c.BusinessBotManageBar.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field business_bot_manage_bar: %w", err) - } - if err := c.VideoChat.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field video_chat: %w", err) - } - if err := c.PendingJoinRequests.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field pending_join_requests: %w", err) - } - b.PutInt53(c.ReplyMarkupMessageID) - if err := c.DraftMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field draft_message: %w", err) - } - b.PutString(c.ClientData) - return nil -} - -// Decode implements bin.Decoder. -func (c *Chat) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chat#e5bae2e4 to nil") - } - if err := b.ConsumeID(ChatTypeID); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *Chat) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chat#e5bae2e4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field id: %w", err) - } - c.ID = value - } - { - value, err := DecodeChatType(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field type: %w", err) - } - c.Type = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field title: %w", err) - } - c.Title = value - } - { - if err := c.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field photo: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field accent_color_id: %w", err) - } - c.AccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field background_custom_emoji_id: %w", err) - } - c.BackgroundCustomEmojiID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field profile_accent_color_id: %w", err) - } - c.ProfileAccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field profile_background_custom_emoji_id: %w", err) - } - c.ProfileBackgroundCustomEmojiID = value - } - { - if err := c.Permissions.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field permissions: %w", err) - } - } - { - if err := c.LastMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field last_message: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field positions: %w", err) - } - - if headerLen > 0 { - c.Positions = make([]ChatPosition, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatPosition - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chat#e5bae2e4: field positions: %w", err) - } - c.Positions = append(c.Positions, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field chat_lists: %w", err) - } - - if headerLen > 0 { - c.ChatLists = make([]ChatListClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field chat_lists: %w", err) - } - c.ChatLists = append(c.ChatLists, value) - } - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field message_sender_id: %w", err) - } - c.MessageSenderID = value - } - { - value, err := DecodeBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field block_list: %w", err) - } - c.BlockList = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field has_protected_content: %w", err) - } - c.HasProtectedContent = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field is_translatable: %w", err) - } - c.IsTranslatable = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field is_marked_as_unread: %w", err) - } - c.IsMarkedAsUnread = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field view_as_topics: %w", err) - } - c.ViewAsTopics = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field has_scheduled_messages: %w", err) - } - c.HasScheduledMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_deleted_only_for_self: %w", err) - } - c.CanBeDeletedOnlyForSelf = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_deleted_for_all_users: %w", err) - } - c.CanBeDeletedForAllUsers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_reported: %w", err) - } - c.CanBeReported = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field default_disable_notification: %w", err) - } - c.DefaultDisableNotification = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_count: %w", err) - } - c.UnreadCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field last_read_inbox_message_id: %w", err) - } - c.LastReadInboxMessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field last_read_outbox_message_id: %w", err) - } - c.LastReadOutboxMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_mention_count: %w", err) - } - c.UnreadMentionCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_reaction_count: %w", err) - } - c.UnreadReactionCount = value - } - { - if err := c.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field notification_settings: %w", err) - } - } - { - value, err := DecodeChatAvailableReactions(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field available_reactions: %w", err) - } - c.AvailableReactions = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field message_auto_delete_time: %w", err) - } - c.MessageAutoDeleteTime = value - } - { - if err := c.EmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field emoji_status: %w", err) - } - } - { - if err := c.Background.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field background: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field theme_name: %w", err) - } - c.ThemeName = value - } - { - value, err := DecodeChatActionBar(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field action_bar: %w", err) - } - c.ActionBar = value - } - { - if err := c.BusinessBotManageBar.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field business_bot_manage_bar: %w", err) - } - } - { - if err := c.VideoChat.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field video_chat: %w", err) - } - } - { - if err := c.PendingJoinRequests.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field pending_join_requests: %w", err) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field reply_markup_message_id: %w", err) - } - c.ReplyMarkupMessageID = value - } - { - if err := c.DraftMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field draft_message: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field client_data: %w", err) - } - c.ClientData = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *Chat) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chat#e5bae2e4 as nil") - } - b.ObjStart() - b.PutID("chat") - b.Comma() - b.FieldStart("id") - b.PutInt53(c.ID) - b.Comma() - b.FieldStart("type") - if c.Type == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field type is nil") - } - if err := c.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field type: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(c.Title) - b.Comma() - b.FieldStart("photo") - if err := c.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field photo: %w", err) - } - b.Comma() - b.FieldStart("accent_color_id") - b.PutInt32(c.AccentColorID) - b.Comma() - b.FieldStart("background_custom_emoji_id") - b.PutLong(c.BackgroundCustomEmojiID) - b.Comma() - b.FieldStart("profile_accent_color_id") - b.PutInt32(c.ProfileAccentColorID) - b.Comma() - b.FieldStart("profile_background_custom_emoji_id") - b.PutLong(c.ProfileBackgroundCustomEmojiID) - b.Comma() - b.FieldStart("permissions") - if err := c.Permissions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field permissions: %w", err) - } - b.Comma() - b.FieldStart("last_message") - if err := c.LastMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field last_message: %w", err) - } - b.Comma() - b.FieldStart("positions") - b.ArrStart() - for idx, v := range c.Positions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field positions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("chat_lists") - b.ArrStart() - for idx, v := range c.ChatLists { - if v == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field chat_lists element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field chat_lists element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("message_sender_id") - if c.MessageSenderID == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field message_sender_id is nil") - } - if err := c.MessageSenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field message_sender_id: %w", err) - } - b.Comma() - b.FieldStart("block_list") - if c.BlockList == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field block_list is nil") - } - if err := c.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field block_list: %w", err) - } - b.Comma() - b.FieldStart("has_protected_content") - b.PutBool(c.HasProtectedContent) - b.Comma() - b.FieldStart("is_translatable") - b.PutBool(c.IsTranslatable) - b.Comma() - b.FieldStart("is_marked_as_unread") - b.PutBool(c.IsMarkedAsUnread) - b.Comma() - b.FieldStart("view_as_topics") - b.PutBool(c.ViewAsTopics) - b.Comma() - b.FieldStart("has_scheduled_messages") - b.PutBool(c.HasScheduledMessages) - b.Comma() - b.FieldStart("can_be_deleted_only_for_self") - b.PutBool(c.CanBeDeletedOnlyForSelf) - b.Comma() - b.FieldStart("can_be_deleted_for_all_users") - b.PutBool(c.CanBeDeletedForAllUsers) - b.Comma() - b.FieldStart("can_be_reported") - b.PutBool(c.CanBeReported) - b.Comma() - b.FieldStart("default_disable_notification") - b.PutBool(c.DefaultDisableNotification) - b.Comma() - b.FieldStart("unread_count") - b.PutInt32(c.UnreadCount) - b.Comma() - b.FieldStart("last_read_inbox_message_id") - b.PutInt53(c.LastReadInboxMessageID) - b.Comma() - b.FieldStart("last_read_outbox_message_id") - b.PutInt53(c.LastReadOutboxMessageID) - b.Comma() - b.FieldStart("unread_mention_count") - b.PutInt32(c.UnreadMentionCount) - b.Comma() - b.FieldStart("unread_reaction_count") - b.PutInt32(c.UnreadReactionCount) - b.Comma() - b.FieldStart("notification_settings") - if err := c.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field notification_settings: %w", err) - } - b.Comma() - b.FieldStart("available_reactions") - if c.AvailableReactions == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field available_reactions is nil") - } - if err := c.AvailableReactions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field available_reactions: %w", err) - } - b.Comma() - b.FieldStart("message_auto_delete_time") - b.PutInt32(c.MessageAutoDeleteTime) - b.Comma() - b.FieldStart("emoji_status") - if err := c.EmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field emoji_status: %w", err) - } - b.Comma() - b.FieldStart("background") - if err := c.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field background: %w", err) - } - b.Comma() - b.FieldStart("theme_name") - b.PutString(c.ThemeName) - b.Comma() - b.FieldStart("action_bar") - if c.ActionBar == nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field action_bar is nil") - } - if err := c.ActionBar.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field action_bar: %w", err) - } - b.Comma() - b.FieldStart("business_bot_manage_bar") - if err := c.BusinessBotManageBar.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field business_bot_manage_bar: %w", err) - } - b.Comma() - b.FieldStart("video_chat") - if err := c.VideoChat.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field video_chat: %w", err) - } - b.Comma() - b.FieldStart("pending_join_requests") - if err := c.PendingJoinRequests.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field pending_join_requests: %w", err) - } - b.Comma() - b.FieldStart("reply_markup_message_id") - b.PutInt53(c.ReplyMarkupMessageID) - b.Comma() - b.FieldStart("draft_message") - if err := c.DraftMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chat#e5bae2e4: field draft_message: %w", err) - } - b.Comma() - b.FieldStart("client_data") - b.PutString(c.ClientData) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *Chat) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chat#e5bae2e4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chat"); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: %w", err) - } - case "id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field id: %w", err) - } - c.ID = value - case "type": - value, err := DecodeTDLibJSONChatType(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field type: %w", err) - } - c.Type = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field title: %w", err) - } - c.Title = value - case "photo": - if err := c.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field photo: %w", err) - } - case "accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field accent_color_id: %w", err) - } - c.AccentColorID = value - case "background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field background_custom_emoji_id: %w", err) - } - c.BackgroundCustomEmojiID = value - case "profile_accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field profile_accent_color_id: %w", err) - } - c.ProfileAccentColorID = value - case "profile_background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field profile_background_custom_emoji_id: %w", err) - } - c.ProfileBackgroundCustomEmojiID = value - case "permissions": - if err := c.Permissions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field permissions: %w", err) - } - case "last_message": - if err := c.LastMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field last_message: %w", err) - } - case "positions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatPosition - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field positions: %w", err) - } - c.Positions = append(c.Positions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field positions: %w", err) - } - case "chat_lists": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field chat_lists: %w", err) - } - c.ChatLists = append(c.ChatLists, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field chat_lists: %w", err) - } - case "message_sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field message_sender_id: %w", err) - } - c.MessageSenderID = value - case "block_list": - value, err := DecodeTDLibJSONBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field block_list: %w", err) - } - c.BlockList = value - case "has_protected_content": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field has_protected_content: %w", err) - } - c.HasProtectedContent = value - case "is_translatable": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field is_translatable: %w", err) - } - c.IsTranslatable = value - case "is_marked_as_unread": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field is_marked_as_unread: %w", err) - } - c.IsMarkedAsUnread = value - case "view_as_topics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field view_as_topics: %w", err) - } - c.ViewAsTopics = value - case "has_scheduled_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field has_scheduled_messages: %w", err) - } - c.HasScheduledMessages = value - case "can_be_deleted_only_for_self": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_deleted_only_for_self: %w", err) - } - c.CanBeDeletedOnlyForSelf = value - case "can_be_deleted_for_all_users": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_deleted_for_all_users: %w", err) - } - c.CanBeDeletedForAllUsers = value - case "can_be_reported": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field can_be_reported: %w", err) - } - c.CanBeReported = value - case "default_disable_notification": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field default_disable_notification: %w", err) - } - c.DefaultDisableNotification = value - case "unread_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_count: %w", err) - } - c.UnreadCount = value - case "last_read_inbox_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field last_read_inbox_message_id: %w", err) - } - c.LastReadInboxMessageID = value - case "last_read_outbox_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field last_read_outbox_message_id: %w", err) - } - c.LastReadOutboxMessageID = value - case "unread_mention_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_mention_count: %w", err) - } - c.UnreadMentionCount = value - case "unread_reaction_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field unread_reaction_count: %w", err) - } - c.UnreadReactionCount = value - case "notification_settings": - if err := c.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field notification_settings: %w", err) - } - case "available_reactions": - value, err := DecodeTDLibJSONChatAvailableReactions(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field available_reactions: %w", err) - } - c.AvailableReactions = value - case "message_auto_delete_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field message_auto_delete_time: %w", err) - } - c.MessageAutoDeleteTime = value - case "emoji_status": - if err := c.EmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field emoji_status: %w", err) - } - case "background": - if err := c.Background.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field background: %w", err) - } - case "theme_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field theme_name: %w", err) - } - c.ThemeName = value - case "action_bar": - value, err := DecodeTDLibJSONChatActionBar(b) - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field action_bar: %w", err) - } - c.ActionBar = value - case "business_bot_manage_bar": - if err := c.BusinessBotManageBar.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field business_bot_manage_bar: %w", err) - } - case "video_chat": - if err := c.VideoChat.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field video_chat: %w", err) - } - case "pending_join_requests": - if err := c.PendingJoinRequests.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field pending_join_requests: %w", err) - } - case "reply_markup_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field reply_markup_message_id: %w", err) - } - c.ReplyMarkupMessageID = value - case "draft_message": - if err := c.DraftMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field draft_message: %w", err) - } - case "client_data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chat#e5bae2e4: field client_data: %w", err) - } - c.ClientData = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (c *Chat) GetID() (value int64) { - if c == nil { - return - } - return c.ID -} - -// GetType returns value of Type field. -func (c *Chat) GetType() (value ChatTypeClass) { - if c == nil { - return - } - return c.Type -} - -// GetTitle returns value of Title field. -func (c *Chat) GetTitle() (value string) { - if c == nil { - return - } - return c.Title -} - -// GetPhoto returns value of Photo field. -func (c *Chat) GetPhoto() (value ChatPhotoInfo) { - if c == nil { - return - } - return c.Photo -} - -// GetAccentColorID returns value of AccentColorID field. -func (c *Chat) GetAccentColorID() (value int32) { - if c == nil { - return - } - return c.AccentColorID -} - -// GetBackgroundCustomEmojiID returns value of BackgroundCustomEmojiID field. -func (c *Chat) GetBackgroundCustomEmojiID() (value int64) { - if c == nil { - return - } - return c.BackgroundCustomEmojiID -} - -// GetProfileAccentColorID returns value of ProfileAccentColorID field. -func (c *Chat) GetProfileAccentColorID() (value int32) { - if c == nil { - return - } - return c.ProfileAccentColorID -} - -// GetProfileBackgroundCustomEmojiID returns value of ProfileBackgroundCustomEmojiID field. -func (c *Chat) GetProfileBackgroundCustomEmojiID() (value int64) { - if c == nil { - return - } - return c.ProfileBackgroundCustomEmojiID -} - -// GetPermissions returns value of Permissions field. -func (c *Chat) GetPermissions() (value ChatPermissions) { - if c == nil { - return - } - return c.Permissions -} - -// GetLastMessage returns value of LastMessage field. -func (c *Chat) GetLastMessage() (value Message) { - if c == nil { - return - } - return c.LastMessage -} - -// GetPositions returns value of Positions field. -func (c *Chat) GetPositions() (value []ChatPosition) { - if c == nil { - return - } - return c.Positions -} - -// GetChatLists returns value of ChatLists field. -func (c *Chat) GetChatLists() (value []ChatListClass) { - if c == nil { - return - } - return c.ChatLists -} - -// GetMessageSenderID returns value of MessageSenderID field. -func (c *Chat) GetMessageSenderID() (value MessageSenderClass) { - if c == nil { - return - } - return c.MessageSenderID -} - -// GetBlockList returns value of BlockList field. -func (c *Chat) GetBlockList() (value BlockListClass) { - if c == nil { - return - } - return c.BlockList -} - -// GetHasProtectedContent returns value of HasProtectedContent field. -func (c *Chat) GetHasProtectedContent() (value bool) { - if c == nil { - return - } - return c.HasProtectedContent -} - -// GetIsTranslatable returns value of IsTranslatable field. -func (c *Chat) GetIsTranslatable() (value bool) { - if c == nil { - return - } - return c.IsTranslatable -} - -// GetIsMarkedAsUnread returns value of IsMarkedAsUnread field. -func (c *Chat) GetIsMarkedAsUnread() (value bool) { - if c == nil { - return - } - return c.IsMarkedAsUnread -} - -// GetViewAsTopics returns value of ViewAsTopics field. -func (c *Chat) GetViewAsTopics() (value bool) { - if c == nil { - return - } - return c.ViewAsTopics -} - -// GetHasScheduledMessages returns value of HasScheduledMessages field. -func (c *Chat) GetHasScheduledMessages() (value bool) { - if c == nil { - return - } - return c.HasScheduledMessages -} - -// GetCanBeDeletedOnlyForSelf returns value of CanBeDeletedOnlyForSelf field. -func (c *Chat) GetCanBeDeletedOnlyForSelf() (value bool) { - if c == nil { - return - } - return c.CanBeDeletedOnlyForSelf -} - -// GetCanBeDeletedForAllUsers returns value of CanBeDeletedForAllUsers field. -func (c *Chat) GetCanBeDeletedForAllUsers() (value bool) { - if c == nil { - return - } - return c.CanBeDeletedForAllUsers -} - -// GetCanBeReported returns value of CanBeReported field. -func (c *Chat) GetCanBeReported() (value bool) { - if c == nil { - return - } - return c.CanBeReported -} - -// GetDefaultDisableNotification returns value of DefaultDisableNotification field. -func (c *Chat) GetDefaultDisableNotification() (value bool) { - if c == nil { - return - } - return c.DefaultDisableNotification -} - -// GetUnreadCount returns value of UnreadCount field. -func (c *Chat) GetUnreadCount() (value int32) { - if c == nil { - return - } - return c.UnreadCount -} - -// GetLastReadInboxMessageID returns value of LastReadInboxMessageID field. -func (c *Chat) GetLastReadInboxMessageID() (value int64) { - if c == nil { - return - } - return c.LastReadInboxMessageID -} - -// GetLastReadOutboxMessageID returns value of LastReadOutboxMessageID field. -func (c *Chat) GetLastReadOutboxMessageID() (value int64) { - if c == nil { - return - } - return c.LastReadOutboxMessageID -} - -// GetUnreadMentionCount returns value of UnreadMentionCount field. -func (c *Chat) GetUnreadMentionCount() (value int32) { - if c == nil { - return - } - return c.UnreadMentionCount -} - -// GetUnreadReactionCount returns value of UnreadReactionCount field. -func (c *Chat) GetUnreadReactionCount() (value int32) { - if c == nil { - return - } - return c.UnreadReactionCount -} - -// GetNotificationSettings returns value of NotificationSettings field. -func (c *Chat) GetNotificationSettings() (value ChatNotificationSettings) { - if c == nil { - return - } - return c.NotificationSettings -} - -// GetAvailableReactions returns value of AvailableReactions field. -func (c *Chat) GetAvailableReactions() (value ChatAvailableReactionsClass) { - if c == nil { - return - } - return c.AvailableReactions -} - -// GetMessageAutoDeleteTime returns value of MessageAutoDeleteTime field. -func (c *Chat) GetMessageAutoDeleteTime() (value int32) { - if c == nil { - return - } - return c.MessageAutoDeleteTime -} - -// GetEmojiStatus returns value of EmojiStatus field. -func (c *Chat) GetEmojiStatus() (value EmojiStatus) { - if c == nil { - return - } - return c.EmojiStatus -} - -// GetBackground returns value of Background field. -func (c *Chat) GetBackground() (value ChatBackground) { - if c == nil { - return - } - return c.Background -} - -// GetThemeName returns value of ThemeName field. -func (c *Chat) GetThemeName() (value string) { - if c == nil { - return - } - return c.ThemeName -} - -// GetActionBar returns value of ActionBar field. -func (c *Chat) GetActionBar() (value ChatActionBarClass) { - if c == nil { - return - } - return c.ActionBar -} - -// GetBusinessBotManageBar returns value of BusinessBotManageBar field. -func (c *Chat) GetBusinessBotManageBar() (value BusinessBotManageBar) { - if c == nil { - return - } - return c.BusinessBotManageBar -} - -// GetVideoChat returns value of VideoChat field. -func (c *Chat) GetVideoChat() (value VideoChat) { - if c == nil { - return - } - return c.VideoChat -} - -// GetPendingJoinRequests returns value of PendingJoinRequests field. -func (c *Chat) GetPendingJoinRequests() (value ChatJoinRequestsInfo) { - if c == nil { - return - } - return c.PendingJoinRequests -} - -// GetReplyMarkupMessageID returns value of ReplyMarkupMessageID field. -func (c *Chat) GetReplyMarkupMessageID() (value int64) { - if c == nil { - return - } - return c.ReplyMarkupMessageID -} - -// GetDraftMessage returns value of DraftMessage field. -func (c *Chat) GetDraftMessage() (value DraftMessage) { - if c == nil { - return - } - return c.DraftMessage -} - -// GetClientData returns value of ClientData field. -func (c *Chat) GetClientData() (value string) { - if c == nil { - return - } - return c.ClientData -} diff --git a/tdapi/tl_chat_invite_link_count_gen.go b/tdapi/tl_chat_invite_link_count_gen.go deleted file mode 100644 index 1de8c313f..000000000 --- a/tdapi/tl_chat_invite_link_count_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatInviteLinkCount represents TL type `chatInviteLinkCount#c3158796`. -type ChatInviteLinkCount struct { - // Administrator's user identifier - UserID int64 - // Number of active invite links - InviteLinkCount int32 - // Number of revoked invite links - RevokedInviteLinkCount int32 -} - -// ChatInviteLinkCountTypeID is TL type id of ChatInviteLinkCount. -const ChatInviteLinkCountTypeID = 0xc3158796 - -// Ensuring interfaces in compile-time for ChatInviteLinkCount. -var ( - _ bin.Encoder = &ChatInviteLinkCount{} - _ bin.Decoder = &ChatInviteLinkCount{} - _ bin.BareEncoder = &ChatInviteLinkCount{} - _ bin.BareDecoder = &ChatInviteLinkCount{} -) - -func (c *ChatInviteLinkCount) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.InviteLinkCount == 0) { - return false - } - if !(c.RevokedInviteLinkCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatInviteLinkCount) String() string { - if c == nil { - return "ChatInviteLinkCount(nil)" - } - type Alias ChatInviteLinkCount - return fmt.Sprintf("ChatInviteLinkCount%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatInviteLinkCount) TypeID() uint32 { - return ChatInviteLinkCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatInviteLinkCount) TypeName() string { - return "chatInviteLinkCount" -} - -// TypeInfo returns info about TL type. -func (c *ChatInviteLinkCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatInviteLinkCount", - ID: ChatInviteLinkCountTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "InviteLinkCount", - SchemaName: "invite_link_count", - }, - { - Name: "RevokedInviteLinkCount", - SchemaName: "revoked_invite_link_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatInviteLinkCount) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkCount#c3158796 as nil") - } - b.PutID(ChatInviteLinkCountTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatInviteLinkCount) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkCount#c3158796 as nil") - } - b.PutInt53(c.UserID) - b.PutInt32(c.InviteLinkCount) - b.PutInt32(c.RevokedInviteLinkCount) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatInviteLinkCount) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkCount#c3158796 to nil") - } - if err := b.ConsumeID(ChatInviteLinkCountTypeID); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCount#c3158796: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatInviteLinkCount) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkCount#c3158796 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCount#c3158796: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCount#c3158796: field invite_link_count: %w", err) - } - c.InviteLinkCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCount#c3158796: field revoked_invite_link_count: %w", err) - } - c.RevokedInviteLinkCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatInviteLinkCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkCount#c3158796 as nil") - } - b.ObjStart() - b.PutID("chatInviteLinkCount") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("invite_link_count") - b.PutInt32(c.InviteLinkCount) - b.Comma() - b.FieldStart("revoked_invite_link_count") - b.PutInt32(c.RevokedInviteLinkCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatInviteLinkCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkCount#c3158796 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatInviteLinkCount"); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCount#c3158796: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCount#c3158796: field user_id: %w", err) - } - c.UserID = value - case "invite_link_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCount#c3158796: field invite_link_count: %w", err) - } - c.InviteLinkCount = value - case "revoked_invite_link_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCount#c3158796: field revoked_invite_link_count: %w", err) - } - c.RevokedInviteLinkCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatInviteLinkCount) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetInviteLinkCount returns value of InviteLinkCount field. -func (c *ChatInviteLinkCount) GetInviteLinkCount() (value int32) { - if c == nil { - return - } - return c.InviteLinkCount -} - -// GetRevokedInviteLinkCount returns value of RevokedInviteLinkCount field. -func (c *ChatInviteLinkCount) GetRevokedInviteLinkCount() (value int32) { - if c == nil { - return - } - return c.RevokedInviteLinkCount -} diff --git a/tdapi/tl_chat_invite_link_counts_gen.go b/tdapi/tl_chat_invite_link_counts_gen.go deleted file mode 100644 index b69a8ac69..000000000 --- a/tdapi/tl_chat_invite_link_counts_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatInviteLinkCounts represents TL type `chatInviteLinkCounts#c953d7f8`. -type ChatInviteLinkCounts struct { - // List of invite link counts - InviteLinkCounts []ChatInviteLinkCount -} - -// ChatInviteLinkCountsTypeID is TL type id of ChatInviteLinkCounts. -const ChatInviteLinkCountsTypeID = 0xc953d7f8 - -// Ensuring interfaces in compile-time for ChatInviteLinkCounts. -var ( - _ bin.Encoder = &ChatInviteLinkCounts{} - _ bin.Decoder = &ChatInviteLinkCounts{} - _ bin.BareEncoder = &ChatInviteLinkCounts{} - _ bin.BareDecoder = &ChatInviteLinkCounts{} -) - -func (c *ChatInviteLinkCounts) Zero() bool { - if c == nil { - return true - } - if !(c.InviteLinkCounts == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatInviteLinkCounts) String() string { - if c == nil { - return "ChatInviteLinkCounts(nil)" - } - type Alias ChatInviteLinkCounts - return fmt.Sprintf("ChatInviteLinkCounts%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatInviteLinkCounts) TypeID() uint32 { - return ChatInviteLinkCountsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatInviteLinkCounts) TypeName() string { - return "chatInviteLinkCounts" -} - -// TypeInfo returns info about TL type. -func (c *ChatInviteLinkCounts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatInviteLinkCounts", - ID: ChatInviteLinkCountsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLinkCounts", - SchemaName: "invite_link_counts", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatInviteLinkCounts) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkCounts#c953d7f8 as nil") - } - b.PutID(ChatInviteLinkCountsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatInviteLinkCounts) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkCounts#c953d7f8 as nil") - } - b.PutInt(len(c.InviteLinkCounts)) - for idx, v := range c.InviteLinkCounts { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatInviteLinkCounts#c953d7f8: field invite_link_counts element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatInviteLinkCounts) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkCounts#c953d7f8 to nil") - } - if err := b.ConsumeID(ChatInviteLinkCountsTypeID); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCounts#c953d7f8: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatInviteLinkCounts) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkCounts#c953d7f8 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCounts#c953d7f8: field invite_link_counts: %w", err) - } - - if headerLen > 0 { - c.InviteLinkCounts = make([]ChatInviteLinkCount, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatInviteLinkCount - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatInviteLinkCounts#c953d7f8: field invite_link_counts: %w", err) - } - c.InviteLinkCounts = append(c.InviteLinkCounts, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatInviteLinkCounts) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkCounts#c953d7f8 as nil") - } - b.ObjStart() - b.PutID("chatInviteLinkCounts") - b.Comma() - b.FieldStart("invite_link_counts") - b.ArrStart() - for idx, v := range c.InviteLinkCounts { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkCounts#c953d7f8: field invite_link_counts element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatInviteLinkCounts) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkCounts#c953d7f8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatInviteLinkCounts"); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCounts#c953d7f8: %w", err) - } - case "invite_link_counts": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatInviteLinkCount - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCounts#c953d7f8: field invite_link_counts: %w", err) - } - c.InviteLinkCounts = append(c.InviteLinkCounts, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkCounts#c953d7f8: field invite_link_counts: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLinkCounts returns value of InviteLinkCounts field. -func (c *ChatInviteLinkCounts) GetInviteLinkCounts() (value []ChatInviteLinkCount) { - if c == nil { - return - } - return c.InviteLinkCounts -} diff --git a/tdapi/tl_chat_invite_link_gen.go b/tdapi/tl_chat_invite_link_gen.go deleted file mode 100644 index 41de06247..000000000 --- a/tdapi/tl_chat_invite_link_gen.go +++ /dev/null @@ -1,641 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatInviteLink represents TL type `chatInviteLink#c6eb6530`. -type ChatInviteLink struct { - // Chat invite link - InviteLink string - // Name of the link - Name string - // User identifier of an administrator created the link - CreatorUserID int64 - // Point in time (Unix timestamp) when the link was created - Date int32 - // Point in time (Unix timestamp) when the link was last edited; 0 if never or unknown - EditDate int32 - // Point in time (Unix timestamp) when the link will expire; 0 if never - ExpirationDate int32 - // Information about subscription plan that is applied to the users joining the chat by - // the link; may be null if the link doesn't require subscription - SubscriptionPricing StarSubscriptionPricing - // The maximum number of members, which can join the chat using the link simultaneously; - // 0 if not limited. Always 0 if the link requires approval - MemberLimit int32 - // Number of chat members, which joined the chat using the link - MemberCount int32 - // Number of chat members, which joined the chat using the link, but have already left - // because of expired subscription; for subscription links only - ExpiredMemberCount int32 - // Number of pending join requests created using this link - PendingJoinRequestCount int32 - // True, if the link only creates join request. If true, total number of joining members - // will be unlimited - CreatesJoinRequest bool - // True, if the link is primary. Primary invite link can't have name, expiration date, or - // usage limit. There is exactly one primary invite link for each administrator with - // can_invite_users right at a given time - IsPrimary bool - // True, if the link was revoked - IsRevoked bool -} - -// ChatInviteLinkTypeID is TL type id of ChatInviteLink. -const ChatInviteLinkTypeID = 0xc6eb6530 - -// Ensuring interfaces in compile-time for ChatInviteLink. -var ( - _ bin.Encoder = &ChatInviteLink{} - _ bin.Decoder = &ChatInviteLink{} - _ bin.BareEncoder = &ChatInviteLink{} - _ bin.BareDecoder = &ChatInviteLink{} -) - -func (c *ChatInviteLink) Zero() bool { - if c == nil { - return true - } - if !(c.InviteLink == "") { - return false - } - if !(c.Name == "") { - return false - } - if !(c.CreatorUserID == 0) { - return false - } - if !(c.Date == 0) { - return false - } - if !(c.EditDate == 0) { - return false - } - if !(c.ExpirationDate == 0) { - return false - } - if !(c.SubscriptionPricing.Zero()) { - return false - } - if !(c.MemberLimit == 0) { - return false - } - if !(c.MemberCount == 0) { - return false - } - if !(c.ExpiredMemberCount == 0) { - return false - } - if !(c.PendingJoinRequestCount == 0) { - return false - } - if !(c.CreatesJoinRequest == false) { - return false - } - if !(c.IsPrimary == false) { - return false - } - if !(c.IsRevoked == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatInviteLink) String() string { - if c == nil { - return "ChatInviteLink(nil)" - } - type Alias ChatInviteLink - return fmt.Sprintf("ChatInviteLink%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatInviteLink) TypeID() uint32 { - return ChatInviteLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatInviteLink) TypeName() string { - return "chatInviteLink" -} - -// TypeInfo returns info about TL type. -func (c *ChatInviteLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatInviteLink", - ID: ChatInviteLinkTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "CreatorUserID", - SchemaName: "creator_user_id", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "EditDate", - SchemaName: "edit_date", - }, - { - Name: "ExpirationDate", - SchemaName: "expiration_date", - }, - { - Name: "SubscriptionPricing", - SchemaName: "subscription_pricing", - }, - { - Name: "MemberLimit", - SchemaName: "member_limit", - }, - { - Name: "MemberCount", - SchemaName: "member_count", - }, - { - Name: "ExpiredMemberCount", - SchemaName: "expired_member_count", - }, - { - Name: "PendingJoinRequestCount", - SchemaName: "pending_join_request_count", - }, - { - Name: "CreatesJoinRequest", - SchemaName: "creates_join_request", - }, - { - Name: "IsPrimary", - SchemaName: "is_primary", - }, - { - Name: "IsRevoked", - SchemaName: "is_revoked", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatInviteLink) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLink#c6eb6530 as nil") - } - b.PutID(ChatInviteLinkTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatInviteLink) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLink#c6eb6530 as nil") - } - b.PutString(c.InviteLink) - b.PutString(c.Name) - b.PutInt53(c.CreatorUserID) - b.PutInt32(c.Date) - b.PutInt32(c.EditDate) - b.PutInt32(c.ExpirationDate) - if err := c.SubscriptionPricing.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLink#c6eb6530: field subscription_pricing: %w", err) - } - b.PutInt32(c.MemberLimit) - b.PutInt32(c.MemberCount) - b.PutInt32(c.ExpiredMemberCount) - b.PutInt32(c.PendingJoinRequestCount) - b.PutBool(c.CreatesJoinRequest) - b.PutBool(c.IsPrimary) - b.PutBool(c.IsRevoked) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatInviteLink) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLink#c6eb6530 to nil") - } - if err := b.ConsumeID(ChatInviteLinkTypeID); err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatInviteLink) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLink#c6eb6530 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field invite_link: %w", err) - } - c.InviteLink = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field name: %w", err) - } - c.Name = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field creator_user_id: %w", err) - } - c.CreatorUserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field date: %w", err) - } - c.Date = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field edit_date: %w", err) - } - c.EditDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field expiration_date: %w", err) - } - c.ExpirationDate = value - } - { - if err := c.SubscriptionPricing.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field subscription_pricing: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field member_limit: %w", err) - } - c.MemberLimit = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field member_count: %w", err) - } - c.MemberCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field expired_member_count: %w", err) - } - c.ExpiredMemberCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field pending_join_request_count: %w", err) - } - c.PendingJoinRequestCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field creates_join_request: %w", err) - } - c.CreatesJoinRequest = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field is_primary: %w", err) - } - c.IsPrimary = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field is_revoked: %w", err) - } - c.IsRevoked = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatInviteLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLink#c6eb6530 as nil") - } - b.ObjStart() - b.PutID("chatInviteLink") - b.Comma() - b.FieldStart("invite_link") - b.PutString(c.InviteLink) - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.FieldStart("creator_user_id") - b.PutInt53(c.CreatorUserID) - b.Comma() - b.FieldStart("date") - b.PutInt32(c.Date) - b.Comma() - b.FieldStart("edit_date") - b.PutInt32(c.EditDate) - b.Comma() - b.FieldStart("expiration_date") - b.PutInt32(c.ExpirationDate) - b.Comma() - b.FieldStart("subscription_pricing") - if err := c.SubscriptionPricing.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLink#c6eb6530: field subscription_pricing: %w", err) - } - b.Comma() - b.FieldStart("member_limit") - b.PutInt32(c.MemberLimit) - b.Comma() - b.FieldStart("member_count") - b.PutInt32(c.MemberCount) - b.Comma() - b.FieldStart("expired_member_count") - b.PutInt32(c.ExpiredMemberCount) - b.Comma() - b.FieldStart("pending_join_request_count") - b.PutInt32(c.PendingJoinRequestCount) - b.Comma() - b.FieldStart("creates_join_request") - b.PutBool(c.CreatesJoinRequest) - b.Comma() - b.FieldStart("is_primary") - b.PutBool(c.IsPrimary) - b.Comma() - b.FieldStart("is_revoked") - b.PutBool(c.IsRevoked) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatInviteLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLink#c6eb6530 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatInviteLink"); err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: %w", err) - } - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field invite_link: %w", err) - } - c.InviteLink = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field name: %w", err) - } - c.Name = value - case "creator_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field creator_user_id: %w", err) - } - c.CreatorUserID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field date: %w", err) - } - c.Date = value - case "edit_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field edit_date: %w", err) - } - c.EditDate = value - case "expiration_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field expiration_date: %w", err) - } - c.ExpirationDate = value - case "subscription_pricing": - if err := c.SubscriptionPricing.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field subscription_pricing: %w", err) - } - case "member_limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field member_limit: %w", err) - } - c.MemberLimit = value - case "member_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field member_count: %w", err) - } - c.MemberCount = value - case "expired_member_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field expired_member_count: %w", err) - } - c.ExpiredMemberCount = value - case "pending_join_request_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field pending_join_request_count: %w", err) - } - c.PendingJoinRequestCount = value - case "creates_join_request": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field creates_join_request: %w", err) - } - c.CreatesJoinRequest = value - case "is_primary": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field is_primary: %w", err) - } - c.IsPrimary = value - case "is_revoked": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLink#c6eb6530: field is_revoked: %w", err) - } - c.IsRevoked = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (c *ChatInviteLink) GetInviteLink() (value string) { - if c == nil { - return - } - return c.InviteLink -} - -// GetName returns value of Name field. -func (c *ChatInviteLink) GetName() (value string) { - if c == nil { - return - } - return c.Name -} - -// GetCreatorUserID returns value of CreatorUserID field. -func (c *ChatInviteLink) GetCreatorUserID() (value int64) { - if c == nil { - return - } - return c.CreatorUserID -} - -// GetDate returns value of Date field. -func (c *ChatInviteLink) GetDate() (value int32) { - if c == nil { - return - } - return c.Date -} - -// GetEditDate returns value of EditDate field. -func (c *ChatInviteLink) GetEditDate() (value int32) { - if c == nil { - return - } - return c.EditDate -} - -// GetExpirationDate returns value of ExpirationDate field. -func (c *ChatInviteLink) GetExpirationDate() (value int32) { - if c == nil { - return - } - return c.ExpirationDate -} - -// GetSubscriptionPricing returns value of SubscriptionPricing field. -func (c *ChatInviteLink) GetSubscriptionPricing() (value StarSubscriptionPricing) { - if c == nil { - return - } - return c.SubscriptionPricing -} - -// GetMemberLimit returns value of MemberLimit field. -func (c *ChatInviteLink) GetMemberLimit() (value int32) { - if c == nil { - return - } - return c.MemberLimit -} - -// GetMemberCount returns value of MemberCount field. -func (c *ChatInviteLink) GetMemberCount() (value int32) { - if c == nil { - return - } - return c.MemberCount -} - -// GetExpiredMemberCount returns value of ExpiredMemberCount field. -func (c *ChatInviteLink) GetExpiredMemberCount() (value int32) { - if c == nil { - return - } - return c.ExpiredMemberCount -} - -// GetPendingJoinRequestCount returns value of PendingJoinRequestCount field. -func (c *ChatInviteLink) GetPendingJoinRequestCount() (value int32) { - if c == nil { - return - } - return c.PendingJoinRequestCount -} - -// GetCreatesJoinRequest returns value of CreatesJoinRequest field. -func (c *ChatInviteLink) GetCreatesJoinRequest() (value bool) { - if c == nil { - return - } - return c.CreatesJoinRequest -} - -// GetIsPrimary returns value of IsPrimary field. -func (c *ChatInviteLink) GetIsPrimary() (value bool) { - if c == nil { - return - } - return c.IsPrimary -} - -// GetIsRevoked returns value of IsRevoked field. -func (c *ChatInviteLink) GetIsRevoked() (value bool) { - if c == nil { - return - } - return c.IsRevoked -} diff --git a/tdapi/tl_chat_invite_link_info_gen.go b/tdapi/tl_chat_invite_link_info_gen.go deleted file mode 100644 index ddace04f6..000000000 --- a/tdapi/tl_chat_invite_link_info_gen.go +++ /dev/null @@ -1,639 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatInviteLinkInfo represents TL type `chatInviteLinkInfo#c3fe73a`. -type ChatInviteLinkInfo struct { - // Chat identifier of the invite link; 0 if the user has no access to the chat before - // joining - ChatID int64 - // If non-zero, the amount of time for which read access to the chat will remain - // available, in seconds - AccessibleFor int32 - // Type of the chat - Type InviteLinkChatTypeClass - // Title of the chat - Title string - // Chat photo; may be null - Photo ChatPhotoInfo - // Identifier of the accent color for chat title and background of chat photo - AccentColorID int32 - // Contains information about a chat invite link - Description string - // Number of members in the chat - MemberCount int32 - // User identifiers of some chat members that may be known to the current user - MemberUserIDs []int64 - // Information about subscription plan that must be paid by the user to use the link; may - // be null if the link doesn't require subscription - SubscriptionInfo ChatInviteLinkSubscriptionInfo - // True, if the link only creates join request - CreatesJoinRequest bool - // True, if the chat is a public supergroup or channel, i.e. it has a username or it is a - // location-based supergroup - IsPublic bool - // Information about verification status of the chat; may be null if none - VerificationStatus VerificationStatus -} - -// ChatInviteLinkInfoTypeID is TL type id of ChatInviteLinkInfo. -const ChatInviteLinkInfoTypeID = 0xc3fe73a - -// Ensuring interfaces in compile-time for ChatInviteLinkInfo. -var ( - _ bin.Encoder = &ChatInviteLinkInfo{} - _ bin.Decoder = &ChatInviteLinkInfo{} - _ bin.BareEncoder = &ChatInviteLinkInfo{} - _ bin.BareDecoder = &ChatInviteLinkInfo{} -) - -func (c *ChatInviteLinkInfo) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.AccessibleFor == 0) { - return false - } - if !(c.Type == nil) { - return false - } - if !(c.Title == "") { - return false - } - if !(c.Photo.Zero()) { - return false - } - if !(c.AccentColorID == 0) { - return false - } - if !(c.Description == "") { - return false - } - if !(c.MemberCount == 0) { - return false - } - if !(c.MemberUserIDs == nil) { - return false - } - if !(c.SubscriptionInfo.Zero()) { - return false - } - if !(c.CreatesJoinRequest == false) { - return false - } - if !(c.IsPublic == false) { - return false - } - if !(c.VerificationStatus.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatInviteLinkInfo) String() string { - if c == nil { - return "ChatInviteLinkInfo(nil)" - } - type Alias ChatInviteLinkInfo - return fmt.Sprintf("ChatInviteLinkInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatInviteLinkInfo) TypeID() uint32 { - return ChatInviteLinkInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatInviteLinkInfo) TypeName() string { - return "chatInviteLinkInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatInviteLinkInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatInviteLinkInfo", - ID: ChatInviteLinkInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "AccessibleFor", - SchemaName: "accessible_for", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "AccentColorID", - SchemaName: "accent_color_id", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "MemberCount", - SchemaName: "member_count", - }, - { - Name: "MemberUserIDs", - SchemaName: "member_user_ids", - }, - { - Name: "SubscriptionInfo", - SchemaName: "subscription_info", - }, - { - Name: "CreatesJoinRequest", - SchemaName: "creates_join_request", - }, - { - Name: "IsPublic", - SchemaName: "is_public", - }, - { - Name: "VerificationStatus", - SchemaName: "verification_status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatInviteLinkInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkInfo#c3fe73a as nil") - } - b.PutID(ChatInviteLinkInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatInviteLinkInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkInfo#c3fe73a as nil") - } - b.PutInt53(c.ChatID) - b.PutInt32(c.AccessibleFor) - if c.Type == nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field type is nil") - } - if err := c.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field type: %w", err) - } - b.PutString(c.Title) - if err := c.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field photo: %w", err) - } - b.PutInt32(c.AccentColorID) - b.PutString(c.Description) - b.PutInt32(c.MemberCount) - b.PutInt(len(c.MemberUserIDs)) - for _, v := range c.MemberUserIDs { - b.PutInt53(v) - } - if err := c.SubscriptionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field subscription_info: %w", err) - } - b.PutBool(c.CreatesJoinRequest) - b.PutBool(c.IsPublic) - if err := c.VerificationStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field verification_status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatInviteLinkInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkInfo#c3fe73a to nil") - } - if err := b.ConsumeID(ChatInviteLinkInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatInviteLinkInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkInfo#c3fe73a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field chat_id: %w", err) - } - c.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field accessible_for: %w", err) - } - c.AccessibleFor = value - } - { - value, err := DecodeInviteLinkChatType(b) - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field type: %w", err) - } - c.Type = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field title: %w", err) - } - c.Title = value - } - { - if err := c.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field photo: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field accent_color_id: %w", err) - } - c.AccentColorID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field description: %w", err) - } - c.Description = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_count: %w", err) - } - c.MemberCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_user_ids: %w", err) - } - - if headerLen > 0 { - c.MemberUserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_user_ids: %w", err) - } - c.MemberUserIDs = append(c.MemberUserIDs, value) - } - } - { - if err := c.SubscriptionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field subscription_info: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field creates_join_request: %w", err) - } - c.CreatesJoinRequest = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field is_public: %w", err) - } - c.IsPublic = value - } - { - if err := c.VerificationStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field verification_status: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatInviteLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkInfo#c3fe73a as nil") - } - b.ObjStart() - b.PutID("chatInviteLinkInfo") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("accessible_for") - b.PutInt32(c.AccessibleFor) - b.Comma() - b.FieldStart("type") - if c.Type == nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field type is nil") - } - if err := c.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field type: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(c.Title) - b.Comma() - b.FieldStart("photo") - if err := c.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field photo: %w", err) - } - b.Comma() - b.FieldStart("accent_color_id") - b.PutInt32(c.AccentColorID) - b.Comma() - b.FieldStart("description") - b.PutString(c.Description) - b.Comma() - b.FieldStart("member_count") - b.PutInt32(c.MemberCount) - b.Comma() - b.FieldStart("member_user_ids") - b.ArrStart() - for _, v := range c.MemberUserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("subscription_info") - if err := c.SubscriptionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field subscription_info: %w", err) - } - b.Comma() - b.FieldStart("creates_join_request") - b.PutBool(c.CreatesJoinRequest) - b.Comma() - b.FieldStart("is_public") - b.PutBool(c.IsPublic) - b.Comma() - b.FieldStart("verification_status") - if err := c.VerificationStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkInfo#c3fe73a: field verification_status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatInviteLinkInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkInfo#c3fe73a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatInviteLinkInfo"); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field chat_id: %w", err) - } - c.ChatID = value - case "accessible_for": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field accessible_for: %w", err) - } - c.AccessibleFor = value - case "type": - value, err := DecodeTDLibJSONInviteLinkChatType(b) - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field type: %w", err) - } - c.Type = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field title: %w", err) - } - c.Title = value - case "photo": - if err := c.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field photo: %w", err) - } - case "accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field accent_color_id: %w", err) - } - c.AccentColorID = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field description: %w", err) - } - c.Description = value - case "member_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_count: %w", err) - } - c.MemberCount = value - case "member_user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_user_ids: %w", err) - } - c.MemberUserIDs = append(c.MemberUserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field member_user_ids: %w", err) - } - case "subscription_info": - if err := c.SubscriptionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field subscription_info: %w", err) - } - case "creates_join_request": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field creates_join_request: %w", err) - } - c.CreatesJoinRequest = value - case "is_public": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field is_public: %w", err) - } - c.IsPublic = value - case "verification_status": - if err := c.VerificationStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkInfo#c3fe73a: field verification_status: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *ChatInviteLinkInfo) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetAccessibleFor returns value of AccessibleFor field. -func (c *ChatInviteLinkInfo) GetAccessibleFor() (value int32) { - if c == nil { - return - } - return c.AccessibleFor -} - -// GetType returns value of Type field. -func (c *ChatInviteLinkInfo) GetType() (value InviteLinkChatTypeClass) { - if c == nil { - return - } - return c.Type -} - -// GetTitle returns value of Title field. -func (c *ChatInviteLinkInfo) GetTitle() (value string) { - if c == nil { - return - } - return c.Title -} - -// GetPhoto returns value of Photo field. -func (c *ChatInviteLinkInfo) GetPhoto() (value ChatPhotoInfo) { - if c == nil { - return - } - return c.Photo -} - -// GetAccentColorID returns value of AccentColorID field. -func (c *ChatInviteLinkInfo) GetAccentColorID() (value int32) { - if c == nil { - return - } - return c.AccentColorID -} - -// GetDescription returns value of Description field. -func (c *ChatInviteLinkInfo) GetDescription() (value string) { - if c == nil { - return - } - return c.Description -} - -// GetMemberCount returns value of MemberCount field. -func (c *ChatInviteLinkInfo) GetMemberCount() (value int32) { - if c == nil { - return - } - return c.MemberCount -} - -// GetMemberUserIDs returns value of MemberUserIDs field. -func (c *ChatInviteLinkInfo) GetMemberUserIDs() (value []int64) { - if c == nil { - return - } - return c.MemberUserIDs -} - -// GetSubscriptionInfo returns value of SubscriptionInfo field. -func (c *ChatInviteLinkInfo) GetSubscriptionInfo() (value ChatInviteLinkSubscriptionInfo) { - if c == nil { - return - } - return c.SubscriptionInfo -} - -// GetCreatesJoinRequest returns value of CreatesJoinRequest field. -func (c *ChatInviteLinkInfo) GetCreatesJoinRequest() (value bool) { - if c == nil { - return - } - return c.CreatesJoinRequest -} - -// GetIsPublic returns value of IsPublic field. -func (c *ChatInviteLinkInfo) GetIsPublic() (value bool) { - if c == nil { - return - } - return c.IsPublic -} - -// GetVerificationStatus returns value of VerificationStatus field. -func (c *ChatInviteLinkInfo) GetVerificationStatus() (value VerificationStatus) { - if c == nil { - return - } - return c.VerificationStatus -} diff --git a/tdapi/tl_chat_invite_link_member_gen.go b/tdapi/tl_chat_invite_link_member_gen.go deleted file mode 100644 index e7775baf5..000000000 --- a/tdapi/tl_chat_invite_link_member_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatInviteLinkMember represents TL type `chatInviteLinkMember#1bce5bb`. -type ChatInviteLinkMember struct { - // User identifier - UserID int64 - // Point in time (Unix timestamp) when the user joined the chat - JoinedChatDate int32 - // True, if the user has joined the chat using an invite link for a chat folder - ViaChatFolderInviteLink bool - // User identifier of the chat administrator, approved user join request - ApproverUserID int64 -} - -// ChatInviteLinkMemberTypeID is TL type id of ChatInviteLinkMember. -const ChatInviteLinkMemberTypeID = 0x1bce5bb - -// Ensuring interfaces in compile-time for ChatInviteLinkMember. -var ( - _ bin.Encoder = &ChatInviteLinkMember{} - _ bin.Decoder = &ChatInviteLinkMember{} - _ bin.BareEncoder = &ChatInviteLinkMember{} - _ bin.BareDecoder = &ChatInviteLinkMember{} -) - -func (c *ChatInviteLinkMember) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.JoinedChatDate == 0) { - return false - } - if !(c.ViaChatFolderInviteLink == false) { - return false - } - if !(c.ApproverUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatInviteLinkMember) String() string { - if c == nil { - return "ChatInviteLinkMember(nil)" - } - type Alias ChatInviteLinkMember - return fmt.Sprintf("ChatInviteLinkMember%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatInviteLinkMember) TypeID() uint32 { - return ChatInviteLinkMemberTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatInviteLinkMember) TypeName() string { - return "chatInviteLinkMember" -} - -// TypeInfo returns info about TL type. -func (c *ChatInviteLinkMember) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatInviteLinkMember", - ID: ChatInviteLinkMemberTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "JoinedChatDate", - SchemaName: "joined_chat_date", - }, - { - Name: "ViaChatFolderInviteLink", - SchemaName: "via_chat_folder_invite_link", - }, - { - Name: "ApproverUserID", - SchemaName: "approver_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatInviteLinkMember) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkMember#1bce5bb as nil") - } - b.PutID(ChatInviteLinkMemberTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatInviteLinkMember) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkMember#1bce5bb as nil") - } - b.PutInt53(c.UserID) - b.PutInt32(c.JoinedChatDate) - b.PutBool(c.ViaChatFolderInviteLink) - b.PutInt53(c.ApproverUserID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatInviteLinkMember) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkMember#1bce5bb to nil") - } - if err := b.ConsumeID(ChatInviteLinkMemberTypeID); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMember#1bce5bb: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatInviteLinkMember) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkMember#1bce5bb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMember#1bce5bb: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMember#1bce5bb: field joined_chat_date: %w", err) - } - c.JoinedChatDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMember#1bce5bb: field via_chat_folder_invite_link: %w", err) - } - c.ViaChatFolderInviteLink = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMember#1bce5bb: field approver_user_id: %w", err) - } - c.ApproverUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatInviteLinkMember) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkMember#1bce5bb as nil") - } - b.ObjStart() - b.PutID("chatInviteLinkMember") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("joined_chat_date") - b.PutInt32(c.JoinedChatDate) - b.Comma() - b.FieldStart("via_chat_folder_invite_link") - b.PutBool(c.ViaChatFolderInviteLink) - b.Comma() - b.FieldStart("approver_user_id") - b.PutInt53(c.ApproverUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatInviteLinkMember) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkMember#1bce5bb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatInviteLinkMember"); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMember#1bce5bb: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMember#1bce5bb: field user_id: %w", err) - } - c.UserID = value - case "joined_chat_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMember#1bce5bb: field joined_chat_date: %w", err) - } - c.JoinedChatDate = value - case "via_chat_folder_invite_link": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMember#1bce5bb: field via_chat_folder_invite_link: %w", err) - } - c.ViaChatFolderInviteLink = value - case "approver_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMember#1bce5bb: field approver_user_id: %w", err) - } - c.ApproverUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatInviteLinkMember) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetJoinedChatDate returns value of JoinedChatDate field. -func (c *ChatInviteLinkMember) GetJoinedChatDate() (value int32) { - if c == nil { - return - } - return c.JoinedChatDate -} - -// GetViaChatFolderInviteLink returns value of ViaChatFolderInviteLink field. -func (c *ChatInviteLinkMember) GetViaChatFolderInviteLink() (value bool) { - if c == nil { - return - } - return c.ViaChatFolderInviteLink -} - -// GetApproverUserID returns value of ApproverUserID field. -func (c *ChatInviteLinkMember) GetApproverUserID() (value int64) { - if c == nil { - return - } - return c.ApproverUserID -} diff --git a/tdapi/tl_chat_invite_link_members_gen.go b/tdapi/tl_chat_invite_link_members_gen.go deleted file mode 100644 index a03ed4f3c..000000000 --- a/tdapi/tl_chat_invite_link_members_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatInviteLinkMembers represents TL type `chatInviteLinkMembers#c2ca3a61`. -type ChatInviteLinkMembers struct { - // Approximate total number of chat members found - TotalCount int32 - // List of chat members, joined a chat via an invite link - Members []ChatInviteLinkMember -} - -// ChatInviteLinkMembersTypeID is TL type id of ChatInviteLinkMembers. -const ChatInviteLinkMembersTypeID = 0xc2ca3a61 - -// Ensuring interfaces in compile-time for ChatInviteLinkMembers. -var ( - _ bin.Encoder = &ChatInviteLinkMembers{} - _ bin.Decoder = &ChatInviteLinkMembers{} - _ bin.BareEncoder = &ChatInviteLinkMembers{} - _ bin.BareDecoder = &ChatInviteLinkMembers{} -) - -func (c *ChatInviteLinkMembers) Zero() bool { - if c == nil { - return true - } - if !(c.TotalCount == 0) { - return false - } - if !(c.Members == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatInviteLinkMembers) String() string { - if c == nil { - return "ChatInviteLinkMembers(nil)" - } - type Alias ChatInviteLinkMembers - return fmt.Sprintf("ChatInviteLinkMembers%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatInviteLinkMembers) TypeID() uint32 { - return ChatInviteLinkMembersTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatInviteLinkMembers) TypeName() string { - return "chatInviteLinkMembers" -} - -// TypeInfo returns info about TL type. -func (c *ChatInviteLinkMembers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatInviteLinkMembers", - ID: ChatInviteLinkMembersTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Members", - SchemaName: "members", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatInviteLinkMembers) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkMembers#c2ca3a61 as nil") - } - b.PutID(ChatInviteLinkMembersTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatInviteLinkMembers) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkMembers#c2ca3a61 as nil") - } - b.PutInt32(c.TotalCount) - b.PutInt(len(c.Members)) - for idx, v := range c.Members { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatInviteLinkMembers#c2ca3a61: field members element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatInviteLinkMembers) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkMembers#c2ca3a61 to nil") - } - if err := b.ConsumeID(ChatInviteLinkMembersTypeID); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMembers#c2ca3a61: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatInviteLinkMembers) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkMembers#c2ca3a61 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMembers#c2ca3a61: field total_count: %w", err) - } - c.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMembers#c2ca3a61: field members: %w", err) - } - - if headerLen > 0 { - c.Members = make([]ChatInviteLinkMember, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatInviteLinkMember - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatInviteLinkMembers#c2ca3a61: field members: %w", err) - } - c.Members = append(c.Members, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatInviteLinkMembers) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkMembers#c2ca3a61 as nil") - } - b.ObjStart() - b.PutID("chatInviteLinkMembers") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(c.TotalCount) - b.Comma() - b.FieldStart("members") - b.ArrStart() - for idx, v := range c.Members { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkMembers#c2ca3a61: field members element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatInviteLinkMembers) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkMembers#c2ca3a61 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatInviteLinkMembers"); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMembers#c2ca3a61: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMembers#c2ca3a61: field total_count: %w", err) - } - c.TotalCount = value - case "members": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatInviteLinkMember - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMembers#c2ca3a61: field members: %w", err) - } - c.Members = append(c.Members, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkMembers#c2ca3a61: field members: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (c *ChatInviteLinkMembers) GetTotalCount() (value int32) { - if c == nil { - return - } - return c.TotalCount -} - -// GetMembers returns value of Members field. -func (c *ChatInviteLinkMembers) GetMembers() (value []ChatInviteLinkMember) { - if c == nil { - return - } - return c.Members -} diff --git a/tdapi/tl_chat_invite_link_subscription_info_gen.go b/tdapi/tl_chat_invite_link_subscription_info_gen.go deleted file mode 100644 index 2e9d928cc..000000000 --- a/tdapi/tl_chat_invite_link_subscription_info_gen.go +++ /dev/null @@ -1,263 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatInviteLinkSubscriptionInfo represents TL type `chatInviteLinkSubscriptionInfo#38cf7368`. -type ChatInviteLinkSubscriptionInfo struct { - // Information about subscription plan that must be paid by the user to use the link - Pricing StarSubscriptionPricing - // True, if the user has already paid for the subscription and can use - // joinChatByInviteLink to join the subscribed chat again - CanReuse bool - // Identifier of the payment form to use for subscription payment; 0 if the subscription - // can't be paid - FormID int64 -} - -// ChatInviteLinkSubscriptionInfoTypeID is TL type id of ChatInviteLinkSubscriptionInfo. -const ChatInviteLinkSubscriptionInfoTypeID = 0x38cf7368 - -// Ensuring interfaces in compile-time for ChatInviteLinkSubscriptionInfo. -var ( - _ bin.Encoder = &ChatInviteLinkSubscriptionInfo{} - _ bin.Decoder = &ChatInviteLinkSubscriptionInfo{} - _ bin.BareEncoder = &ChatInviteLinkSubscriptionInfo{} - _ bin.BareDecoder = &ChatInviteLinkSubscriptionInfo{} -) - -func (c *ChatInviteLinkSubscriptionInfo) Zero() bool { - if c == nil { - return true - } - if !(c.Pricing.Zero()) { - return false - } - if !(c.CanReuse == false) { - return false - } - if !(c.FormID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatInviteLinkSubscriptionInfo) String() string { - if c == nil { - return "ChatInviteLinkSubscriptionInfo(nil)" - } - type Alias ChatInviteLinkSubscriptionInfo - return fmt.Sprintf("ChatInviteLinkSubscriptionInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatInviteLinkSubscriptionInfo) TypeID() uint32 { - return ChatInviteLinkSubscriptionInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatInviteLinkSubscriptionInfo) TypeName() string { - return "chatInviteLinkSubscriptionInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatInviteLinkSubscriptionInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatInviteLinkSubscriptionInfo", - ID: ChatInviteLinkSubscriptionInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Pricing", - SchemaName: "pricing", - }, - { - Name: "CanReuse", - SchemaName: "can_reuse", - }, - { - Name: "FormID", - SchemaName: "form_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatInviteLinkSubscriptionInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkSubscriptionInfo#38cf7368 as nil") - } - b.PutID(ChatInviteLinkSubscriptionInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatInviteLinkSubscriptionInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkSubscriptionInfo#38cf7368 as nil") - } - if err := c.Pricing.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkSubscriptionInfo#38cf7368: field pricing: %w", err) - } - b.PutBool(c.CanReuse) - b.PutLong(c.FormID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatInviteLinkSubscriptionInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkSubscriptionInfo#38cf7368 to nil") - } - if err := b.ConsumeID(ChatInviteLinkSubscriptionInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkSubscriptionInfo#38cf7368: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatInviteLinkSubscriptionInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkSubscriptionInfo#38cf7368 to nil") - } - { - if err := c.Pricing.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkSubscriptionInfo#38cf7368: field pricing: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkSubscriptionInfo#38cf7368: field can_reuse: %w", err) - } - c.CanReuse = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkSubscriptionInfo#38cf7368: field form_id: %w", err) - } - c.FormID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatInviteLinkSubscriptionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinkSubscriptionInfo#38cf7368 as nil") - } - b.ObjStart() - b.PutID("chatInviteLinkSubscriptionInfo") - b.Comma() - b.FieldStart("pricing") - if err := c.Pricing.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinkSubscriptionInfo#38cf7368: field pricing: %w", err) - } - b.Comma() - b.FieldStart("can_reuse") - b.PutBool(c.CanReuse) - b.Comma() - b.FieldStart("form_id") - b.PutLong(c.FormID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatInviteLinkSubscriptionInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinkSubscriptionInfo#38cf7368 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatInviteLinkSubscriptionInfo"); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkSubscriptionInfo#38cf7368: %w", err) - } - case "pricing": - if err := c.Pricing.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinkSubscriptionInfo#38cf7368: field pricing: %w", err) - } - case "can_reuse": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkSubscriptionInfo#38cf7368: field can_reuse: %w", err) - } - c.CanReuse = value - case "form_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinkSubscriptionInfo#38cf7368: field form_id: %w", err) - } - c.FormID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPricing returns value of Pricing field. -func (c *ChatInviteLinkSubscriptionInfo) GetPricing() (value StarSubscriptionPricing) { - if c == nil { - return - } - return c.Pricing -} - -// GetCanReuse returns value of CanReuse field. -func (c *ChatInviteLinkSubscriptionInfo) GetCanReuse() (value bool) { - if c == nil { - return - } - return c.CanReuse -} - -// GetFormID returns value of FormID field. -func (c *ChatInviteLinkSubscriptionInfo) GetFormID() (value int64) { - if c == nil { - return - } - return c.FormID -} diff --git a/tdapi/tl_chat_invite_links_gen.go b/tdapi/tl_chat_invite_links_gen.go deleted file mode 100644 index fb5ce76ac..000000000 --- a/tdapi/tl_chat_invite_links_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatInviteLinks represents TL type `chatInviteLinks#9b1eddfa`. -type ChatInviteLinks struct { - // Approximate total number of chat invite links found - TotalCount int32 - // List of invite links - InviteLinks []ChatInviteLink -} - -// ChatInviteLinksTypeID is TL type id of ChatInviteLinks. -const ChatInviteLinksTypeID = 0x9b1eddfa - -// Ensuring interfaces in compile-time for ChatInviteLinks. -var ( - _ bin.Encoder = &ChatInviteLinks{} - _ bin.Decoder = &ChatInviteLinks{} - _ bin.BareEncoder = &ChatInviteLinks{} - _ bin.BareDecoder = &ChatInviteLinks{} -) - -func (c *ChatInviteLinks) Zero() bool { - if c == nil { - return true - } - if !(c.TotalCount == 0) { - return false - } - if !(c.InviteLinks == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatInviteLinks) String() string { - if c == nil { - return "ChatInviteLinks(nil)" - } - type Alias ChatInviteLinks - return fmt.Sprintf("ChatInviteLinks%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatInviteLinks) TypeID() uint32 { - return ChatInviteLinksTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatInviteLinks) TypeName() string { - return "chatInviteLinks" -} - -// TypeInfo returns info about TL type. -func (c *ChatInviteLinks) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatInviteLinks", - ID: ChatInviteLinksTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "InviteLinks", - SchemaName: "invite_links", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatInviteLinks) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinks#9b1eddfa as nil") - } - b.PutID(ChatInviteLinksTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatInviteLinks) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinks#9b1eddfa as nil") - } - b.PutInt32(c.TotalCount) - b.PutInt(len(c.InviteLinks)) - for idx, v := range c.InviteLinks { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatInviteLinks#9b1eddfa: field invite_links element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatInviteLinks) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinks#9b1eddfa to nil") - } - if err := b.ConsumeID(ChatInviteLinksTypeID); err != nil { - return fmt.Errorf("unable to decode chatInviteLinks#9b1eddfa: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatInviteLinks) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinks#9b1eddfa to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinks#9b1eddfa: field total_count: %w", err) - } - c.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinks#9b1eddfa: field invite_links: %w", err) - } - - if headerLen > 0 { - c.InviteLinks = make([]ChatInviteLink, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatInviteLink - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatInviteLinks#9b1eddfa: field invite_links: %w", err) - } - c.InviteLinks = append(c.InviteLinks, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatInviteLinks) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatInviteLinks#9b1eddfa as nil") - } - b.ObjStart() - b.PutID("chatInviteLinks") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(c.TotalCount) - b.Comma() - b.FieldStart("invite_links") - b.ArrStart() - for idx, v := range c.InviteLinks { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatInviteLinks#9b1eddfa: field invite_links element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatInviteLinks) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatInviteLinks#9b1eddfa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatInviteLinks"); err != nil { - return fmt.Errorf("unable to decode chatInviteLinks#9b1eddfa: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatInviteLinks#9b1eddfa: field total_count: %w", err) - } - c.TotalCount = value - case "invite_links": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatInviteLink - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatInviteLinks#9b1eddfa: field invite_links: %w", err) - } - c.InviteLinks = append(c.InviteLinks, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatInviteLinks#9b1eddfa: field invite_links: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (c *ChatInviteLinks) GetTotalCount() (value int32) { - if c == nil { - return - } - return c.TotalCount -} - -// GetInviteLinks returns value of InviteLinks field. -func (c *ChatInviteLinks) GetInviteLinks() (value []ChatInviteLink) { - if c == nil { - return - } - return c.InviteLinks -} diff --git a/tdapi/tl_chat_join_request_gen.go b/tdapi/tl_chat_join_request_gen.go deleted file mode 100644 index 9374a687c..000000000 --- a/tdapi/tl_chat_join_request_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatJoinRequest represents TL type `chatJoinRequest#3897a68`. -type ChatJoinRequest struct { - // User identifier - UserID int64 - // Point in time (Unix timestamp) when the user sent the join request - Date int32 - // A short bio of the user - Bio string -} - -// ChatJoinRequestTypeID is TL type id of ChatJoinRequest. -const ChatJoinRequestTypeID = 0x3897a68 - -// Ensuring interfaces in compile-time for ChatJoinRequest. -var ( - _ bin.Encoder = &ChatJoinRequest{} - _ bin.Decoder = &ChatJoinRequest{} - _ bin.BareEncoder = &ChatJoinRequest{} - _ bin.BareDecoder = &ChatJoinRequest{} -) - -func (c *ChatJoinRequest) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.Date == 0) { - return false - } - if !(c.Bio == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatJoinRequest) String() string { - if c == nil { - return "ChatJoinRequest(nil)" - } - type Alias ChatJoinRequest - return fmt.Sprintf("ChatJoinRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatJoinRequest) TypeID() uint32 { - return ChatJoinRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatJoinRequest) TypeName() string { - return "chatJoinRequest" -} - -// TypeInfo returns info about TL type. -func (c *ChatJoinRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatJoinRequest", - ID: ChatJoinRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "Bio", - SchemaName: "bio", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatJoinRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatJoinRequest#3897a68 as nil") - } - b.PutID(ChatJoinRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatJoinRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatJoinRequest#3897a68 as nil") - } - b.PutInt53(c.UserID) - b.PutInt32(c.Date) - b.PutString(c.Bio) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatJoinRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatJoinRequest#3897a68 to nil") - } - if err := b.ConsumeID(ChatJoinRequestTypeID); err != nil { - return fmt.Errorf("unable to decode chatJoinRequest#3897a68: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatJoinRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatJoinRequest#3897a68 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequest#3897a68: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequest#3897a68: field date: %w", err) - } - c.Date = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequest#3897a68: field bio: %w", err) - } - c.Bio = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatJoinRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatJoinRequest#3897a68 as nil") - } - b.ObjStart() - b.PutID("chatJoinRequest") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("date") - b.PutInt32(c.Date) - b.Comma() - b.FieldStart("bio") - b.PutString(c.Bio) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatJoinRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatJoinRequest#3897a68 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatJoinRequest"); err != nil { - return fmt.Errorf("unable to decode chatJoinRequest#3897a68: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequest#3897a68: field user_id: %w", err) - } - c.UserID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequest#3897a68: field date: %w", err) - } - c.Date = value - case "bio": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequest#3897a68: field bio: %w", err) - } - c.Bio = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatJoinRequest) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetDate returns value of Date field. -func (c *ChatJoinRequest) GetDate() (value int32) { - if c == nil { - return - } - return c.Date -} - -// GetBio returns value of Bio field. -func (c *ChatJoinRequest) GetBio() (value string) { - if c == nil { - return - } - return c.Bio -} diff --git a/tdapi/tl_chat_join_requests_gen.go b/tdapi/tl_chat_join_requests_gen.go deleted file mode 100644 index 95f4b175c..000000000 --- a/tdapi/tl_chat_join_requests_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatJoinRequests represents TL type `chatJoinRequests#b2c5fd31`. -type ChatJoinRequests struct { - // Approximate total number of requests found - TotalCount int32 - // List of the requests - Requests []ChatJoinRequest -} - -// ChatJoinRequestsTypeID is TL type id of ChatJoinRequests. -const ChatJoinRequestsTypeID = 0xb2c5fd31 - -// Ensuring interfaces in compile-time for ChatJoinRequests. -var ( - _ bin.Encoder = &ChatJoinRequests{} - _ bin.Decoder = &ChatJoinRequests{} - _ bin.BareEncoder = &ChatJoinRequests{} - _ bin.BareDecoder = &ChatJoinRequests{} -) - -func (c *ChatJoinRequests) Zero() bool { - if c == nil { - return true - } - if !(c.TotalCount == 0) { - return false - } - if !(c.Requests == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatJoinRequests) String() string { - if c == nil { - return "ChatJoinRequests(nil)" - } - type Alias ChatJoinRequests - return fmt.Sprintf("ChatJoinRequests%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatJoinRequests) TypeID() uint32 { - return ChatJoinRequestsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatJoinRequests) TypeName() string { - return "chatJoinRequests" -} - -// TypeInfo returns info about TL type. -func (c *ChatJoinRequests) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatJoinRequests", - ID: ChatJoinRequestsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Requests", - SchemaName: "requests", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatJoinRequests) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatJoinRequests#b2c5fd31 as nil") - } - b.PutID(ChatJoinRequestsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatJoinRequests) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatJoinRequests#b2c5fd31 as nil") - } - b.PutInt32(c.TotalCount) - b.PutInt(len(c.Requests)) - for idx, v := range c.Requests { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatJoinRequests#b2c5fd31: field requests element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatJoinRequests) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatJoinRequests#b2c5fd31 to nil") - } - if err := b.ConsumeID(ChatJoinRequestsTypeID); err != nil { - return fmt.Errorf("unable to decode chatJoinRequests#b2c5fd31: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatJoinRequests) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatJoinRequests#b2c5fd31 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequests#b2c5fd31: field total_count: %w", err) - } - c.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequests#b2c5fd31: field requests: %w", err) - } - - if headerLen > 0 { - c.Requests = make([]ChatJoinRequest, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatJoinRequest - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatJoinRequests#b2c5fd31: field requests: %w", err) - } - c.Requests = append(c.Requests, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatJoinRequests) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatJoinRequests#b2c5fd31 as nil") - } - b.ObjStart() - b.PutID("chatJoinRequests") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(c.TotalCount) - b.Comma() - b.FieldStart("requests") - b.ArrStart() - for idx, v := range c.Requests { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatJoinRequests#b2c5fd31: field requests element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatJoinRequests) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatJoinRequests#b2c5fd31 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatJoinRequests"); err != nil { - return fmt.Errorf("unable to decode chatJoinRequests#b2c5fd31: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequests#b2c5fd31: field total_count: %w", err) - } - c.TotalCount = value - case "requests": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatJoinRequest - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatJoinRequests#b2c5fd31: field requests: %w", err) - } - c.Requests = append(c.Requests, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatJoinRequests#b2c5fd31: field requests: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (c *ChatJoinRequests) GetTotalCount() (value int32) { - if c == nil { - return - } - return c.TotalCount -} - -// GetRequests returns value of Requests field. -func (c *ChatJoinRequests) GetRequests() (value []ChatJoinRequest) { - if c == nil { - return - } - return c.Requests -} diff --git a/tdapi/tl_chat_join_requests_info_gen.go b/tdapi/tl_chat_join_requests_info_gen.go deleted file mode 100644 index f81e6a77b..000000000 --- a/tdapi/tl_chat_join_requests_info_gen.go +++ /dev/null @@ -1,251 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatJoinRequestsInfo represents TL type `chatJoinRequestsInfo#6aff5df5`. -type ChatJoinRequestsInfo struct { - // Total number of pending join requests - TotalCount int32 - // Identifiers of at most 3 users sent the newest pending join requests - UserIDs []int64 -} - -// ChatJoinRequestsInfoTypeID is TL type id of ChatJoinRequestsInfo. -const ChatJoinRequestsInfoTypeID = 0x6aff5df5 - -// Ensuring interfaces in compile-time for ChatJoinRequestsInfo. -var ( - _ bin.Encoder = &ChatJoinRequestsInfo{} - _ bin.Decoder = &ChatJoinRequestsInfo{} - _ bin.BareEncoder = &ChatJoinRequestsInfo{} - _ bin.BareDecoder = &ChatJoinRequestsInfo{} -) - -func (c *ChatJoinRequestsInfo) Zero() bool { - if c == nil { - return true - } - if !(c.TotalCount == 0) { - return false - } - if !(c.UserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatJoinRequestsInfo) String() string { - if c == nil { - return "ChatJoinRequestsInfo(nil)" - } - type Alias ChatJoinRequestsInfo - return fmt.Sprintf("ChatJoinRequestsInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatJoinRequestsInfo) TypeID() uint32 { - return ChatJoinRequestsInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatJoinRequestsInfo) TypeName() string { - return "chatJoinRequestsInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatJoinRequestsInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatJoinRequestsInfo", - ID: ChatJoinRequestsInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatJoinRequestsInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatJoinRequestsInfo#6aff5df5 as nil") - } - b.PutID(ChatJoinRequestsInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatJoinRequestsInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatJoinRequestsInfo#6aff5df5 as nil") - } - b.PutInt32(c.TotalCount) - b.PutInt(len(c.UserIDs)) - for _, v := range c.UserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatJoinRequestsInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatJoinRequestsInfo#6aff5df5 to nil") - } - if err := b.ConsumeID(ChatJoinRequestsInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatJoinRequestsInfo#6aff5df5: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatJoinRequestsInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatJoinRequestsInfo#6aff5df5 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequestsInfo#6aff5df5: field total_count: %w", err) - } - c.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequestsInfo#6aff5df5: field user_ids: %w", err) - } - - if headerLen > 0 { - c.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequestsInfo#6aff5df5: field user_ids: %w", err) - } - c.UserIDs = append(c.UserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatJoinRequestsInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatJoinRequestsInfo#6aff5df5 as nil") - } - b.ObjStart() - b.PutID("chatJoinRequestsInfo") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(c.TotalCount) - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range c.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatJoinRequestsInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatJoinRequestsInfo#6aff5df5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatJoinRequestsInfo"); err != nil { - return fmt.Errorf("unable to decode chatJoinRequestsInfo#6aff5df5: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequestsInfo#6aff5df5: field total_count: %w", err) - } - c.TotalCount = value - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatJoinRequestsInfo#6aff5df5: field user_ids: %w", err) - } - c.UserIDs = append(c.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatJoinRequestsInfo#6aff5df5: field user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (c *ChatJoinRequestsInfo) GetTotalCount() (value int32) { - if c == nil { - return - } - return c.TotalCount -} - -// GetUserIDs returns value of UserIDs field. -func (c *ChatJoinRequestsInfo) GetUserIDs() (value []int64) { - if c == nil { - return - } - return c.UserIDs -} diff --git a/tdapi/tl_chat_list_gen.go b/tdapi/tl_chat_list_gen.go deleted file mode 100644 index 3999390a2..000000000 --- a/tdapi/tl_chat_list_gen.go +++ /dev/null @@ -1,612 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatListMain represents TL type `chatListMain#e8195bac`. -type ChatListMain struct { -} - -// ChatListMainTypeID is TL type id of ChatListMain. -const ChatListMainTypeID = 0xe8195bac - -// construct implements constructor of ChatListClass. -func (c ChatListMain) construct() ChatListClass { return &c } - -// Ensuring interfaces in compile-time for ChatListMain. -var ( - _ bin.Encoder = &ChatListMain{} - _ bin.Decoder = &ChatListMain{} - _ bin.BareEncoder = &ChatListMain{} - _ bin.BareDecoder = &ChatListMain{} - - _ ChatListClass = &ChatListMain{} -) - -func (c *ChatListMain) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatListMain) String() string { - if c == nil { - return "ChatListMain(nil)" - } - type Alias ChatListMain - return fmt.Sprintf("ChatListMain%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatListMain) TypeID() uint32 { - return ChatListMainTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatListMain) TypeName() string { - return "chatListMain" -} - -// TypeInfo returns info about TL type. -func (c *ChatListMain) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatListMain", - ID: ChatListMainTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatListMain) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatListMain#e8195bac as nil") - } - b.PutID(ChatListMainTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatListMain) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatListMain#e8195bac as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatListMain) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatListMain#e8195bac to nil") - } - if err := b.ConsumeID(ChatListMainTypeID); err != nil { - return fmt.Errorf("unable to decode chatListMain#e8195bac: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatListMain) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatListMain#e8195bac to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatListMain) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatListMain#e8195bac as nil") - } - b.ObjStart() - b.PutID("chatListMain") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatListMain) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatListMain#e8195bac to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatListMain"); err != nil { - return fmt.Errorf("unable to decode chatListMain#e8195bac: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatListArchive represents TL type `chatListArchive#159f6ec3`. -type ChatListArchive struct { -} - -// ChatListArchiveTypeID is TL type id of ChatListArchive. -const ChatListArchiveTypeID = 0x159f6ec3 - -// construct implements constructor of ChatListClass. -func (c ChatListArchive) construct() ChatListClass { return &c } - -// Ensuring interfaces in compile-time for ChatListArchive. -var ( - _ bin.Encoder = &ChatListArchive{} - _ bin.Decoder = &ChatListArchive{} - _ bin.BareEncoder = &ChatListArchive{} - _ bin.BareDecoder = &ChatListArchive{} - - _ ChatListClass = &ChatListArchive{} -) - -func (c *ChatListArchive) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatListArchive) String() string { - if c == nil { - return "ChatListArchive(nil)" - } - type Alias ChatListArchive - return fmt.Sprintf("ChatListArchive%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatListArchive) TypeID() uint32 { - return ChatListArchiveTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatListArchive) TypeName() string { - return "chatListArchive" -} - -// TypeInfo returns info about TL type. -func (c *ChatListArchive) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatListArchive", - ID: ChatListArchiveTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatListArchive) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatListArchive#159f6ec3 as nil") - } - b.PutID(ChatListArchiveTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatListArchive) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatListArchive#159f6ec3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatListArchive) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatListArchive#159f6ec3 to nil") - } - if err := b.ConsumeID(ChatListArchiveTypeID); err != nil { - return fmt.Errorf("unable to decode chatListArchive#159f6ec3: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatListArchive) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatListArchive#159f6ec3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatListArchive) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatListArchive#159f6ec3 as nil") - } - b.ObjStart() - b.PutID("chatListArchive") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatListArchive) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatListArchive#159f6ec3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatListArchive"); err != nil { - return fmt.Errorf("unable to decode chatListArchive#159f6ec3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatListFolder represents TL type `chatListFolder#16fe3e58`. -type ChatListFolder struct { - // Chat folder identifier - ChatFolderID int32 -} - -// ChatListFolderTypeID is TL type id of ChatListFolder. -const ChatListFolderTypeID = 0x16fe3e58 - -// construct implements constructor of ChatListClass. -func (c ChatListFolder) construct() ChatListClass { return &c } - -// Ensuring interfaces in compile-time for ChatListFolder. -var ( - _ bin.Encoder = &ChatListFolder{} - _ bin.Decoder = &ChatListFolder{} - _ bin.BareEncoder = &ChatListFolder{} - _ bin.BareDecoder = &ChatListFolder{} - - _ ChatListClass = &ChatListFolder{} -) - -func (c *ChatListFolder) Zero() bool { - if c == nil { - return true - } - if !(c.ChatFolderID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatListFolder) String() string { - if c == nil { - return "ChatListFolder(nil)" - } - type Alias ChatListFolder - return fmt.Sprintf("ChatListFolder%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatListFolder) TypeID() uint32 { - return ChatListFolderTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatListFolder) TypeName() string { - return "chatListFolder" -} - -// TypeInfo returns info about TL type. -func (c *ChatListFolder) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatListFolder", - ID: ChatListFolderTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatListFolder) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatListFolder#16fe3e58 as nil") - } - b.PutID(ChatListFolderTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatListFolder) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatListFolder#16fe3e58 as nil") - } - b.PutInt32(c.ChatFolderID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatListFolder) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatListFolder#16fe3e58 to nil") - } - if err := b.ConsumeID(ChatListFolderTypeID); err != nil { - return fmt.Errorf("unable to decode chatListFolder#16fe3e58: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatListFolder) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatListFolder#16fe3e58 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatListFolder#16fe3e58: field chat_folder_id: %w", err) - } - c.ChatFolderID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatListFolder) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatListFolder#16fe3e58 as nil") - } - b.ObjStart() - b.PutID("chatListFolder") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(c.ChatFolderID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatListFolder) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatListFolder#16fe3e58 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatListFolder"); err != nil { - return fmt.Errorf("unable to decode chatListFolder#16fe3e58: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatListFolder#16fe3e58: field chat_folder_id: %w", err) - } - c.ChatFolderID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (c *ChatListFolder) GetChatFolderID() (value int32) { - if c == nil { - return - } - return c.ChatFolderID -} - -// ChatListClassName is schema name of ChatListClass. -const ChatListClassName = "ChatList" - -// ChatListClass represents ChatList generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatList(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatListMain: // chatListMain#e8195bac -// case *tdapi.ChatListArchive: // chatListArchive#159f6ec3 -// case *tdapi.ChatListFolder: // chatListFolder#16fe3e58 -// default: panic(v) -// } -type ChatListClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatListClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeChatList implements binary de-serialization for ChatListClass. -func DecodeChatList(buf *bin.Buffer) (ChatListClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatListMainTypeID: - // Decoding chatListMain#e8195bac. - v := ChatListMain{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatListClass: %w", err) - } - return &v, nil - case ChatListArchiveTypeID: - // Decoding chatListArchive#159f6ec3. - v := ChatListArchive{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatListClass: %w", err) - } - return &v, nil - case ChatListFolderTypeID: - // Decoding chatListFolder#16fe3e58. - v := ChatListFolder{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatListClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatListClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatList implements binary de-serialization for ChatListClass. -func DecodeTDLibJSONChatList(buf tdjson.Decoder) (ChatListClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatListMain": - // Decoding chatListMain#e8195bac. - v := ChatListMain{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatListClass: %w", err) - } - return &v, nil - case "chatListArchive": - // Decoding chatListArchive#159f6ec3. - v := ChatListArchive{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatListClass: %w", err) - } - return &v, nil - case "chatListFolder": - // Decoding chatListFolder#16fe3e58. - v := ChatListFolder{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatListClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatListClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatList boxes the ChatListClass providing a helper. -type ChatListBox struct { - ChatList ChatListClass -} - -// Decode implements bin.Decoder for ChatListBox. -func (b *ChatListBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatListBox to nil") - } - v, err := DecodeChatList(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatList = v - return nil -} - -// Encode implements bin.Encode for ChatListBox. -func (b *ChatListBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatList == nil { - return fmt.Errorf("unable to encode ChatListClass as nil") - } - return b.ChatList.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatListBox. -func (b *ChatListBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatListBox to nil") - } - v, err := DecodeTDLibJSONChatList(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatList = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatListBox. -func (b *ChatListBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatList == nil { - return fmt.Errorf("unable to encode ChatListClass as nil") - } - return b.ChatList.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_lists_gen.go b/tdapi/tl_chat_lists_gen.go deleted file mode 100644 index 17291548e..000000000 --- a/tdapi/tl_chat_lists_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatLists represents TL type `chatLists#92c2d216`. -type ChatLists struct { - // List of chat lists - ChatLists []ChatListClass -} - -// ChatListsTypeID is TL type id of ChatLists. -const ChatListsTypeID = 0x92c2d216 - -// Ensuring interfaces in compile-time for ChatLists. -var ( - _ bin.Encoder = &ChatLists{} - _ bin.Decoder = &ChatLists{} - _ bin.BareEncoder = &ChatLists{} - _ bin.BareDecoder = &ChatLists{} -) - -func (c *ChatLists) Zero() bool { - if c == nil { - return true - } - if !(c.ChatLists == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatLists) String() string { - if c == nil { - return "ChatLists(nil)" - } - type Alias ChatLists - return fmt.Sprintf("ChatLists%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatLists) TypeID() uint32 { - return ChatListsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatLists) TypeName() string { - return "chatLists" -} - -// TypeInfo returns info about TL type. -func (c *ChatLists) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatLists", - ID: ChatListsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatLists", - SchemaName: "chat_lists", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatLists) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatLists#92c2d216 as nil") - } - b.PutID(ChatListsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatLists) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatLists#92c2d216 as nil") - } - b.PutInt(len(c.ChatLists)) - for idx, v := range c.ChatLists { - if v == nil { - return fmt.Errorf("unable to encode chatLists#92c2d216: field chat_lists element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatLists#92c2d216: field chat_lists element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatLists) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatLists#92c2d216 to nil") - } - if err := b.ConsumeID(ChatListsTypeID); err != nil { - return fmt.Errorf("unable to decode chatLists#92c2d216: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatLists) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatLists#92c2d216 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatLists#92c2d216: field chat_lists: %w", err) - } - - if headerLen > 0 { - c.ChatLists = make([]ChatListClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode chatLists#92c2d216: field chat_lists: %w", err) - } - c.ChatLists = append(c.ChatLists, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatLists) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatLists#92c2d216 as nil") - } - b.ObjStart() - b.PutID("chatLists") - b.Comma() - b.FieldStart("chat_lists") - b.ArrStart() - for idx, v := range c.ChatLists { - if v == nil { - return fmt.Errorf("unable to encode chatLists#92c2d216: field chat_lists element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatLists#92c2d216: field chat_lists element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatLists) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatLists#92c2d216 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatLists"); err != nil { - return fmt.Errorf("unable to decode chatLists#92c2d216: %w", err) - } - case "chat_lists": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode chatLists#92c2d216: field chat_lists: %w", err) - } - c.ChatLists = append(c.ChatLists, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatLists#92c2d216: field chat_lists: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatLists returns value of ChatLists field. -func (c *ChatLists) GetChatLists() (value []ChatListClass) { - if c == nil { - return - } - return c.ChatLists -} diff --git a/tdapi/tl_chat_location_gen.go b/tdapi/tl_chat_location_gen.go deleted file mode 100644 index de12b51da..000000000 --- a/tdapi/tl_chat_location_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatLocation represents TL type `chatLocation#a29b8f21`. -type ChatLocation struct { - // The location - Location Location - // Location address; 1-64 characters, as defined by the chat owner - Address string -} - -// ChatLocationTypeID is TL type id of ChatLocation. -const ChatLocationTypeID = 0xa29b8f21 - -// Ensuring interfaces in compile-time for ChatLocation. -var ( - _ bin.Encoder = &ChatLocation{} - _ bin.Decoder = &ChatLocation{} - _ bin.BareEncoder = &ChatLocation{} - _ bin.BareDecoder = &ChatLocation{} -) - -func (c *ChatLocation) Zero() bool { - if c == nil { - return true - } - if !(c.Location.Zero()) { - return false - } - if !(c.Address == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatLocation) String() string { - if c == nil { - return "ChatLocation(nil)" - } - type Alias ChatLocation - return fmt.Sprintf("ChatLocation%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatLocation) TypeID() uint32 { - return ChatLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatLocation) TypeName() string { - return "chatLocation" -} - -// TypeInfo returns info about TL type. -func (c *ChatLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatLocation", - ID: ChatLocationTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "Address", - SchemaName: "address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatLocation) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatLocation#a29b8f21 as nil") - } - b.PutID(ChatLocationTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatLocation) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatLocation#a29b8f21 as nil") - } - if err := c.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatLocation#a29b8f21: field location: %w", err) - } - b.PutString(c.Address) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatLocation) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatLocation#a29b8f21 to nil") - } - if err := b.ConsumeID(ChatLocationTypeID); err != nil { - return fmt.Errorf("unable to decode chatLocation#a29b8f21: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatLocation) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatLocation#a29b8f21 to nil") - } - { - if err := c.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatLocation#a29b8f21: field location: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatLocation#a29b8f21: field address: %w", err) - } - c.Address = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatLocation) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatLocation#a29b8f21 as nil") - } - b.ObjStart() - b.PutID("chatLocation") - b.Comma() - b.FieldStart("location") - if err := c.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatLocation#a29b8f21: field location: %w", err) - } - b.Comma() - b.FieldStart("address") - b.PutString(c.Address) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatLocation) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatLocation#a29b8f21 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatLocation"); err != nil { - return fmt.Errorf("unable to decode chatLocation#a29b8f21: %w", err) - } - case "location": - if err := c.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatLocation#a29b8f21: field location: %w", err) - } - case "address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatLocation#a29b8f21: field address: %w", err) - } - c.Address = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (c *ChatLocation) GetLocation() (value Location) { - if c == nil { - return - } - return c.Location -} - -// GetAddress returns value of Address field. -func (c *ChatLocation) GetAddress() (value string) { - if c == nil { - return - } - return c.Address -} diff --git a/tdapi/tl_chat_member_gen.go b/tdapi/tl_chat_member_gen.go deleted file mode 100644 index 8aa27eee5..000000000 --- a/tdapi/tl_chat_member_gen.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatMember represents TL type `chatMember#6d12e175`. -type ChatMember struct { - // Identifier of the chat member. Currently, other chats can be only Left or Banned. Only - // supergroups and channels can have other chats as Left or Banned members and these - // chats must be supergroups or channels - MemberID MessageSenderClass - // Identifier of a user that invited/promoted/banned this member in the chat; 0 if - // unknown - InviterUserID int64 - // Point in time (Unix timestamp) when the user joined/was promoted/was banned in the - // chat - JoinedChatDate int32 - // Status of the member in the chat - Status ChatMemberStatusClass -} - -// ChatMemberTypeID is TL type id of ChatMember. -const ChatMemberTypeID = 0x6d12e175 - -// Ensuring interfaces in compile-time for ChatMember. -var ( - _ bin.Encoder = &ChatMember{} - _ bin.Decoder = &ChatMember{} - _ bin.BareEncoder = &ChatMember{} - _ bin.BareDecoder = &ChatMember{} -) - -func (c *ChatMember) Zero() bool { - if c == nil { - return true - } - if !(c.MemberID == nil) { - return false - } - if !(c.InviterUserID == 0) { - return false - } - if !(c.JoinedChatDate == 0) { - return false - } - if !(c.Status == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMember) String() string { - if c == nil { - return "ChatMember(nil)" - } - type Alias ChatMember - return fmt.Sprintf("ChatMember%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMember) TypeID() uint32 { - return ChatMemberTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMember) TypeName() string { - return "chatMember" -} - -// TypeInfo returns info about TL type. -func (c *ChatMember) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMember", - ID: ChatMemberTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MemberID", - SchemaName: "member_id", - }, - { - Name: "InviterUserID", - SchemaName: "inviter_user_id", - }, - { - Name: "JoinedChatDate", - SchemaName: "joined_chat_date", - }, - { - Name: "Status", - SchemaName: "status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMember) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMember#6d12e175 as nil") - } - b.PutID(ChatMemberTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMember) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMember#6d12e175 as nil") - } - if c.MemberID == nil { - return fmt.Errorf("unable to encode chatMember#6d12e175: field member_id is nil") - } - if err := c.MemberID.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatMember#6d12e175: field member_id: %w", err) - } - b.PutInt53(c.InviterUserID) - b.PutInt32(c.JoinedChatDate) - if c.Status == nil { - return fmt.Errorf("unable to encode chatMember#6d12e175: field status is nil") - } - if err := c.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatMember#6d12e175: field status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMember) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMember#6d12e175 to nil") - } - if err := b.ConsumeID(ChatMemberTypeID); err != nil { - return fmt.Errorf("unable to decode chatMember#6d12e175: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMember) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMember#6d12e175 to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatMember#6d12e175: field member_id: %w", err) - } - c.MemberID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatMember#6d12e175: field inviter_user_id: %w", err) - } - c.InviterUserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatMember#6d12e175: field joined_chat_date: %w", err) - } - c.JoinedChatDate = value - } - { - value, err := DecodeChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatMember#6d12e175: field status: %w", err) - } - c.Status = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMember) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMember#6d12e175 as nil") - } - b.ObjStart() - b.PutID("chatMember") - b.Comma() - b.FieldStart("member_id") - if c.MemberID == nil { - return fmt.Errorf("unable to encode chatMember#6d12e175: field member_id is nil") - } - if err := c.MemberID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatMember#6d12e175: field member_id: %w", err) - } - b.Comma() - b.FieldStart("inviter_user_id") - b.PutInt53(c.InviterUserID) - b.Comma() - b.FieldStart("joined_chat_date") - b.PutInt32(c.JoinedChatDate) - b.Comma() - b.FieldStart("status") - if c.Status == nil { - return fmt.Errorf("unable to encode chatMember#6d12e175: field status is nil") - } - if err := c.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatMember#6d12e175: field status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMember) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMember#6d12e175 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMember"); err != nil { - return fmt.Errorf("unable to decode chatMember#6d12e175: %w", err) - } - case "member_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatMember#6d12e175: field member_id: %w", err) - } - c.MemberID = value - case "inviter_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatMember#6d12e175: field inviter_user_id: %w", err) - } - c.InviterUserID = value - case "joined_chat_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatMember#6d12e175: field joined_chat_date: %w", err) - } - c.JoinedChatDate = value - case "status": - value, err := DecodeTDLibJSONChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode chatMember#6d12e175: field status: %w", err) - } - c.Status = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMemberID returns value of MemberID field. -func (c *ChatMember) GetMemberID() (value MessageSenderClass) { - if c == nil { - return - } - return c.MemberID -} - -// GetInviterUserID returns value of InviterUserID field. -func (c *ChatMember) GetInviterUserID() (value int64) { - if c == nil { - return - } - return c.InviterUserID -} - -// GetJoinedChatDate returns value of JoinedChatDate field. -func (c *ChatMember) GetJoinedChatDate() (value int32) { - if c == nil { - return - } - return c.JoinedChatDate -} - -// GetStatus returns value of Status field. -func (c *ChatMember) GetStatus() (value ChatMemberStatusClass) { - if c == nil { - return - } - return c.Status -} diff --git a/tdapi/tl_chat_member_status_gen.go b/tdapi/tl_chat_member_status_gen.go deleted file mode 100644 index e084b9265..000000000 --- a/tdapi/tl_chat_member_status_gen.go +++ /dev/null @@ -1,1402 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatMemberStatusCreator represents TL type `chatMemberStatusCreator#f6764afe`. -type ChatMemberStatusCreator struct { - // A custom title of the owner; 0-16 characters without emoji; applicable to supergroups - // only - CustomTitle string - // True, if the creator isn't shown in the chat member list and sends messages - // anonymously; applicable to supergroups only - IsAnonymous bool - // True, if the user is a member of the chat - IsMember bool -} - -// ChatMemberStatusCreatorTypeID is TL type id of ChatMemberStatusCreator. -const ChatMemberStatusCreatorTypeID = 0xf6764afe - -// construct implements constructor of ChatMemberStatusClass. -func (c ChatMemberStatusCreator) construct() ChatMemberStatusClass { return &c } - -// Ensuring interfaces in compile-time for ChatMemberStatusCreator. -var ( - _ bin.Encoder = &ChatMemberStatusCreator{} - _ bin.Decoder = &ChatMemberStatusCreator{} - _ bin.BareEncoder = &ChatMemberStatusCreator{} - _ bin.BareDecoder = &ChatMemberStatusCreator{} - - _ ChatMemberStatusClass = &ChatMemberStatusCreator{} -) - -func (c *ChatMemberStatusCreator) Zero() bool { - if c == nil { - return true - } - if !(c.CustomTitle == "") { - return false - } - if !(c.IsAnonymous == false) { - return false - } - if !(c.IsMember == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMemberStatusCreator) String() string { - if c == nil { - return "ChatMemberStatusCreator(nil)" - } - type Alias ChatMemberStatusCreator - return fmt.Sprintf("ChatMemberStatusCreator%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMemberStatusCreator) TypeID() uint32 { - return ChatMemberStatusCreatorTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMemberStatusCreator) TypeName() string { - return "chatMemberStatusCreator" -} - -// TypeInfo returns info about TL type. -func (c *ChatMemberStatusCreator) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMemberStatusCreator", - ID: ChatMemberStatusCreatorTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CustomTitle", - SchemaName: "custom_title", - }, - { - Name: "IsAnonymous", - SchemaName: "is_anonymous", - }, - { - Name: "IsMember", - SchemaName: "is_member", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMemberStatusCreator) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusCreator#f6764afe as nil") - } - b.PutID(ChatMemberStatusCreatorTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMemberStatusCreator) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusCreator#f6764afe as nil") - } - b.PutString(c.CustomTitle) - b.PutBool(c.IsAnonymous) - b.PutBool(c.IsMember) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMemberStatusCreator) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusCreator#f6764afe to nil") - } - if err := b.ConsumeID(ChatMemberStatusCreatorTypeID); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusCreator#f6764afe: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMemberStatusCreator) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusCreator#f6764afe to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusCreator#f6764afe: field custom_title: %w", err) - } - c.CustomTitle = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusCreator#f6764afe: field is_anonymous: %w", err) - } - c.IsAnonymous = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusCreator#f6764afe: field is_member: %w", err) - } - c.IsMember = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMemberStatusCreator) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusCreator#f6764afe as nil") - } - b.ObjStart() - b.PutID("chatMemberStatusCreator") - b.Comma() - b.FieldStart("custom_title") - b.PutString(c.CustomTitle) - b.Comma() - b.FieldStart("is_anonymous") - b.PutBool(c.IsAnonymous) - b.Comma() - b.FieldStart("is_member") - b.PutBool(c.IsMember) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMemberStatusCreator) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusCreator#f6764afe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMemberStatusCreator"); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusCreator#f6764afe: %w", err) - } - case "custom_title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusCreator#f6764afe: field custom_title: %w", err) - } - c.CustomTitle = value - case "is_anonymous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusCreator#f6764afe: field is_anonymous: %w", err) - } - c.IsAnonymous = value - case "is_member": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusCreator#f6764afe: field is_member: %w", err) - } - c.IsMember = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCustomTitle returns value of CustomTitle field. -func (c *ChatMemberStatusCreator) GetCustomTitle() (value string) { - if c == nil { - return - } - return c.CustomTitle -} - -// GetIsAnonymous returns value of IsAnonymous field. -func (c *ChatMemberStatusCreator) GetIsAnonymous() (value bool) { - if c == nil { - return - } - return c.IsAnonymous -} - -// GetIsMember returns value of IsMember field. -func (c *ChatMemberStatusCreator) GetIsMember() (value bool) { - if c == nil { - return - } - return c.IsMember -} - -// ChatMemberStatusAdministrator represents TL type `chatMemberStatusAdministrator#fbd3841d`. -type ChatMemberStatusAdministrator struct { - // A custom title of the administrator; 0-16 characters without emoji; applicable to - // supergroups only - CustomTitle string - // True, if the current user can edit the administrator privileges for the called user - CanBeEdited bool - // Rights of the administrator - Rights ChatAdministratorRights -} - -// ChatMemberStatusAdministratorTypeID is TL type id of ChatMemberStatusAdministrator. -const ChatMemberStatusAdministratorTypeID = 0xfbd3841d - -// construct implements constructor of ChatMemberStatusClass. -func (c ChatMemberStatusAdministrator) construct() ChatMemberStatusClass { return &c } - -// Ensuring interfaces in compile-time for ChatMemberStatusAdministrator. -var ( - _ bin.Encoder = &ChatMemberStatusAdministrator{} - _ bin.Decoder = &ChatMemberStatusAdministrator{} - _ bin.BareEncoder = &ChatMemberStatusAdministrator{} - _ bin.BareDecoder = &ChatMemberStatusAdministrator{} - - _ ChatMemberStatusClass = &ChatMemberStatusAdministrator{} -) - -func (c *ChatMemberStatusAdministrator) Zero() bool { - if c == nil { - return true - } - if !(c.CustomTitle == "") { - return false - } - if !(c.CanBeEdited == false) { - return false - } - if !(c.Rights.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMemberStatusAdministrator) String() string { - if c == nil { - return "ChatMemberStatusAdministrator(nil)" - } - type Alias ChatMemberStatusAdministrator - return fmt.Sprintf("ChatMemberStatusAdministrator%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMemberStatusAdministrator) TypeID() uint32 { - return ChatMemberStatusAdministratorTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMemberStatusAdministrator) TypeName() string { - return "chatMemberStatusAdministrator" -} - -// TypeInfo returns info about TL type. -func (c *ChatMemberStatusAdministrator) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMemberStatusAdministrator", - ID: ChatMemberStatusAdministratorTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CustomTitle", - SchemaName: "custom_title", - }, - { - Name: "CanBeEdited", - SchemaName: "can_be_edited", - }, - { - Name: "Rights", - SchemaName: "rights", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMemberStatusAdministrator) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusAdministrator#fbd3841d as nil") - } - b.PutID(ChatMemberStatusAdministratorTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMemberStatusAdministrator) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusAdministrator#fbd3841d as nil") - } - b.PutString(c.CustomTitle) - b.PutBool(c.CanBeEdited) - if err := c.Rights.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatMemberStatusAdministrator#fbd3841d: field rights: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMemberStatusAdministrator) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusAdministrator#fbd3841d to nil") - } - if err := b.ConsumeID(ChatMemberStatusAdministratorTypeID); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusAdministrator#fbd3841d: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMemberStatusAdministrator) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusAdministrator#fbd3841d to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusAdministrator#fbd3841d: field custom_title: %w", err) - } - c.CustomTitle = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusAdministrator#fbd3841d: field can_be_edited: %w", err) - } - c.CanBeEdited = value - } - { - if err := c.Rights.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusAdministrator#fbd3841d: field rights: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMemberStatusAdministrator) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusAdministrator#fbd3841d as nil") - } - b.ObjStart() - b.PutID("chatMemberStatusAdministrator") - b.Comma() - b.FieldStart("custom_title") - b.PutString(c.CustomTitle) - b.Comma() - b.FieldStart("can_be_edited") - b.PutBool(c.CanBeEdited) - b.Comma() - b.FieldStart("rights") - if err := c.Rights.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatMemberStatusAdministrator#fbd3841d: field rights: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMemberStatusAdministrator) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusAdministrator#fbd3841d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMemberStatusAdministrator"); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusAdministrator#fbd3841d: %w", err) - } - case "custom_title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusAdministrator#fbd3841d: field custom_title: %w", err) - } - c.CustomTitle = value - case "can_be_edited": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusAdministrator#fbd3841d: field can_be_edited: %w", err) - } - c.CanBeEdited = value - case "rights": - if err := c.Rights.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusAdministrator#fbd3841d: field rights: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCustomTitle returns value of CustomTitle field. -func (c *ChatMemberStatusAdministrator) GetCustomTitle() (value string) { - if c == nil { - return - } - return c.CustomTitle -} - -// GetCanBeEdited returns value of CanBeEdited field. -func (c *ChatMemberStatusAdministrator) GetCanBeEdited() (value bool) { - if c == nil { - return - } - return c.CanBeEdited -} - -// GetRights returns value of Rights field. -func (c *ChatMemberStatusAdministrator) GetRights() (value ChatAdministratorRights) { - if c == nil { - return - } - return c.Rights -} - -// ChatMemberStatusMember represents TL type `chatMemberStatusMember#fe0cec16`. -type ChatMemberStatusMember struct { - // Point in time (Unix timestamp) when the user will be removed from the chat because of - // the expired subscription; 0 if never. Ignored in setChatMemberStatus - MemberUntilDate int32 -} - -// ChatMemberStatusMemberTypeID is TL type id of ChatMemberStatusMember. -const ChatMemberStatusMemberTypeID = 0xfe0cec16 - -// construct implements constructor of ChatMemberStatusClass. -func (c ChatMemberStatusMember) construct() ChatMemberStatusClass { return &c } - -// Ensuring interfaces in compile-time for ChatMemberStatusMember. -var ( - _ bin.Encoder = &ChatMemberStatusMember{} - _ bin.Decoder = &ChatMemberStatusMember{} - _ bin.BareEncoder = &ChatMemberStatusMember{} - _ bin.BareDecoder = &ChatMemberStatusMember{} - - _ ChatMemberStatusClass = &ChatMemberStatusMember{} -) - -func (c *ChatMemberStatusMember) Zero() bool { - if c == nil { - return true - } - if !(c.MemberUntilDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMemberStatusMember) String() string { - if c == nil { - return "ChatMemberStatusMember(nil)" - } - type Alias ChatMemberStatusMember - return fmt.Sprintf("ChatMemberStatusMember%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMemberStatusMember) TypeID() uint32 { - return ChatMemberStatusMemberTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMemberStatusMember) TypeName() string { - return "chatMemberStatusMember" -} - -// TypeInfo returns info about TL type. -func (c *ChatMemberStatusMember) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMemberStatusMember", - ID: ChatMemberStatusMemberTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MemberUntilDate", - SchemaName: "member_until_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMemberStatusMember) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusMember#fe0cec16 as nil") - } - b.PutID(ChatMemberStatusMemberTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMemberStatusMember) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusMember#fe0cec16 as nil") - } - b.PutInt32(c.MemberUntilDate) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMemberStatusMember) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusMember#fe0cec16 to nil") - } - if err := b.ConsumeID(ChatMemberStatusMemberTypeID); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusMember#fe0cec16: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMemberStatusMember) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusMember#fe0cec16 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusMember#fe0cec16: field member_until_date: %w", err) - } - c.MemberUntilDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMemberStatusMember) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusMember#fe0cec16 as nil") - } - b.ObjStart() - b.PutID("chatMemberStatusMember") - b.Comma() - b.FieldStart("member_until_date") - b.PutInt32(c.MemberUntilDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMemberStatusMember) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusMember#fe0cec16 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMemberStatusMember"); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusMember#fe0cec16: %w", err) - } - case "member_until_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusMember#fe0cec16: field member_until_date: %w", err) - } - c.MemberUntilDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMemberUntilDate returns value of MemberUntilDate field. -func (c *ChatMemberStatusMember) GetMemberUntilDate() (value int32) { - if c == nil { - return - } - return c.MemberUntilDate -} - -// ChatMemberStatusRestricted represents TL type `chatMemberStatusRestricted#630774a6`. -type ChatMemberStatusRestricted struct { - // True, if the user is a member of the chat - IsMember bool - // Point in time (Unix timestamp) when restrictions will be lifted from the user; 0 if - // never. If the user is restricted for more than 366 days or for less than 30 seconds - // from the current time, the user is considered to be restricted forever - RestrictedUntilDate int32 - // User permissions in the chat - Permissions ChatPermissions -} - -// ChatMemberStatusRestrictedTypeID is TL type id of ChatMemberStatusRestricted. -const ChatMemberStatusRestrictedTypeID = 0x630774a6 - -// construct implements constructor of ChatMemberStatusClass. -func (c ChatMemberStatusRestricted) construct() ChatMemberStatusClass { return &c } - -// Ensuring interfaces in compile-time for ChatMemberStatusRestricted. -var ( - _ bin.Encoder = &ChatMemberStatusRestricted{} - _ bin.Decoder = &ChatMemberStatusRestricted{} - _ bin.BareEncoder = &ChatMemberStatusRestricted{} - _ bin.BareDecoder = &ChatMemberStatusRestricted{} - - _ ChatMemberStatusClass = &ChatMemberStatusRestricted{} -) - -func (c *ChatMemberStatusRestricted) Zero() bool { - if c == nil { - return true - } - if !(c.IsMember == false) { - return false - } - if !(c.RestrictedUntilDate == 0) { - return false - } - if !(c.Permissions.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMemberStatusRestricted) String() string { - if c == nil { - return "ChatMemberStatusRestricted(nil)" - } - type Alias ChatMemberStatusRestricted - return fmt.Sprintf("ChatMemberStatusRestricted%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMemberStatusRestricted) TypeID() uint32 { - return ChatMemberStatusRestrictedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMemberStatusRestricted) TypeName() string { - return "chatMemberStatusRestricted" -} - -// TypeInfo returns info about TL type. -func (c *ChatMemberStatusRestricted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMemberStatusRestricted", - ID: ChatMemberStatusRestrictedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsMember", - SchemaName: "is_member", - }, - { - Name: "RestrictedUntilDate", - SchemaName: "restricted_until_date", - }, - { - Name: "Permissions", - SchemaName: "permissions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMemberStatusRestricted) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusRestricted#630774a6 as nil") - } - b.PutID(ChatMemberStatusRestrictedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMemberStatusRestricted) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusRestricted#630774a6 as nil") - } - b.PutBool(c.IsMember) - b.PutInt32(c.RestrictedUntilDate) - if err := c.Permissions.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatMemberStatusRestricted#630774a6: field permissions: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMemberStatusRestricted) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusRestricted#630774a6 to nil") - } - if err := b.ConsumeID(ChatMemberStatusRestrictedTypeID); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusRestricted#630774a6: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMemberStatusRestricted) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusRestricted#630774a6 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusRestricted#630774a6: field is_member: %w", err) - } - c.IsMember = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusRestricted#630774a6: field restricted_until_date: %w", err) - } - c.RestrictedUntilDate = value - } - { - if err := c.Permissions.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusRestricted#630774a6: field permissions: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMemberStatusRestricted) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusRestricted#630774a6 as nil") - } - b.ObjStart() - b.PutID("chatMemberStatusRestricted") - b.Comma() - b.FieldStart("is_member") - b.PutBool(c.IsMember) - b.Comma() - b.FieldStart("restricted_until_date") - b.PutInt32(c.RestrictedUntilDate) - b.Comma() - b.FieldStart("permissions") - if err := c.Permissions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatMemberStatusRestricted#630774a6: field permissions: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMemberStatusRestricted) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusRestricted#630774a6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMemberStatusRestricted"); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusRestricted#630774a6: %w", err) - } - case "is_member": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusRestricted#630774a6: field is_member: %w", err) - } - c.IsMember = value - case "restricted_until_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusRestricted#630774a6: field restricted_until_date: %w", err) - } - c.RestrictedUntilDate = value - case "permissions": - if err := c.Permissions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusRestricted#630774a6: field permissions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetIsMember returns value of IsMember field. -func (c *ChatMemberStatusRestricted) GetIsMember() (value bool) { - if c == nil { - return - } - return c.IsMember -} - -// GetRestrictedUntilDate returns value of RestrictedUntilDate field. -func (c *ChatMemberStatusRestricted) GetRestrictedUntilDate() (value int32) { - if c == nil { - return - } - return c.RestrictedUntilDate -} - -// GetPermissions returns value of Permissions field. -func (c *ChatMemberStatusRestricted) GetPermissions() (value ChatPermissions) { - if c == nil { - return - } - return c.Permissions -} - -// ChatMemberStatusLeft represents TL type `chatMemberStatusLeft#ffa74425`. -type ChatMemberStatusLeft struct { -} - -// ChatMemberStatusLeftTypeID is TL type id of ChatMemberStatusLeft. -const ChatMemberStatusLeftTypeID = 0xffa74425 - -// construct implements constructor of ChatMemberStatusClass. -func (c ChatMemberStatusLeft) construct() ChatMemberStatusClass { return &c } - -// Ensuring interfaces in compile-time for ChatMemberStatusLeft. -var ( - _ bin.Encoder = &ChatMemberStatusLeft{} - _ bin.Decoder = &ChatMemberStatusLeft{} - _ bin.BareEncoder = &ChatMemberStatusLeft{} - _ bin.BareDecoder = &ChatMemberStatusLeft{} - - _ ChatMemberStatusClass = &ChatMemberStatusLeft{} -) - -func (c *ChatMemberStatusLeft) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMemberStatusLeft) String() string { - if c == nil { - return "ChatMemberStatusLeft(nil)" - } - type Alias ChatMemberStatusLeft - return fmt.Sprintf("ChatMemberStatusLeft%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMemberStatusLeft) TypeID() uint32 { - return ChatMemberStatusLeftTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMemberStatusLeft) TypeName() string { - return "chatMemberStatusLeft" -} - -// TypeInfo returns info about TL type. -func (c *ChatMemberStatusLeft) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMemberStatusLeft", - ID: ChatMemberStatusLeftTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMemberStatusLeft) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusLeft#ffa74425 as nil") - } - b.PutID(ChatMemberStatusLeftTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMemberStatusLeft) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusLeft#ffa74425 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMemberStatusLeft) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusLeft#ffa74425 to nil") - } - if err := b.ConsumeID(ChatMemberStatusLeftTypeID); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusLeft#ffa74425: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMemberStatusLeft) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusLeft#ffa74425 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMemberStatusLeft) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusLeft#ffa74425 as nil") - } - b.ObjStart() - b.PutID("chatMemberStatusLeft") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMemberStatusLeft) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusLeft#ffa74425 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMemberStatusLeft"); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusLeft#ffa74425: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatMemberStatusBanned represents TL type `chatMemberStatusBanned#9d714eb6`. -type ChatMemberStatusBanned struct { - // Point in time (Unix timestamp) when the user will be unbanned; 0 if never. If the user - // is banned for more than 366 days or for less than 30 seconds from the current time, - // the user is considered to be banned forever. Always 0 in basic groups - BannedUntilDate int32 -} - -// ChatMemberStatusBannedTypeID is TL type id of ChatMemberStatusBanned. -const ChatMemberStatusBannedTypeID = 0x9d714eb6 - -// construct implements constructor of ChatMemberStatusClass. -func (c ChatMemberStatusBanned) construct() ChatMemberStatusClass { return &c } - -// Ensuring interfaces in compile-time for ChatMemberStatusBanned. -var ( - _ bin.Encoder = &ChatMemberStatusBanned{} - _ bin.Decoder = &ChatMemberStatusBanned{} - _ bin.BareEncoder = &ChatMemberStatusBanned{} - _ bin.BareDecoder = &ChatMemberStatusBanned{} - - _ ChatMemberStatusClass = &ChatMemberStatusBanned{} -) - -func (c *ChatMemberStatusBanned) Zero() bool { - if c == nil { - return true - } - if !(c.BannedUntilDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMemberStatusBanned) String() string { - if c == nil { - return "ChatMemberStatusBanned(nil)" - } - type Alias ChatMemberStatusBanned - return fmt.Sprintf("ChatMemberStatusBanned%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMemberStatusBanned) TypeID() uint32 { - return ChatMemberStatusBannedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMemberStatusBanned) TypeName() string { - return "chatMemberStatusBanned" -} - -// TypeInfo returns info about TL type. -func (c *ChatMemberStatusBanned) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMemberStatusBanned", - ID: ChatMemberStatusBannedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BannedUntilDate", - SchemaName: "banned_until_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMemberStatusBanned) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusBanned#9d714eb6 as nil") - } - b.PutID(ChatMemberStatusBannedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMemberStatusBanned) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusBanned#9d714eb6 as nil") - } - b.PutInt32(c.BannedUntilDate) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMemberStatusBanned) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusBanned#9d714eb6 to nil") - } - if err := b.ConsumeID(ChatMemberStatusBannedTypeID); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusBanned#9d714eb6: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMemberStatusBanned) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusBanned#9d714eb6 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusBanned#9d714eb6: field banned_until_date: %w", err) - } - c.BannedUntilDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMemberStatusBanned) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMemberStatusBanned#9d714eb6 as nil") - } - b.ObjStart() - b.PutID("chatMemberStatusBanned") - b.Comma() - b.FieldStart("banned_until_date") - b.PutInt32(c.BannedUntilDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMemberStatusBanned) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMemberStatusBanned#9d714eb6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMemberStatusBanned"); err != nil { - return fmt.Errorf("unable to decode chatMemberStatusBanned#9d714eb6: %w", err) - } - case "banned_until_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatMemberStatusBanned#9d714eb6: field banned_until_date: %w", err) - } - c.BannedUntilDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBannedUntilDate returns value of BannedUntilDate field. -func (c *ChatMemberStatusBanned) GetBannedUntilDate() (value int32) { - if c == nil { - return - } - return c.BannedUntilDate -} - -// ChatMemberStatusClassName is schema name of ChatMemberStatusClass. -const ChatMemberStatusClassName = "ChatMemberStatus" - -// ChatMemberStatusClass represents ChatMemberStatus generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatMemberStatus(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatMemberStatusCreator: // chatMemberStatusCreator#f6764afe -// case *tdapi.ChatMemberStatusAdministrator: // chatMemberStatusAdministrator#fbd3841d -// case *tdapi.ChatMemberStatusMember: // chatMemberStatusMember#fe0cec16 -// case *tdapi.ChatMemberStatusRestricted: // chatMemberStatusRestricted#630774a6 -// case *tdapi.ChatMemberStatusLeft: // chatMemberStatusLeft#ffa74425 -// case *tdapi.ChatMemberStatusBanned: // chatMemberStatusBanned#9d714eb6 -// default: panic(v) -// } -type ChatMemberStatusClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatMemberStatusClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeChatMemberStatus implements binary de-serialization for ChatMemberStatusClass. -func DecodeChatMemberStatus(buf *bin.Buffer) (ChatMemberStatusClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatMemberStatusCreatorTypeID: - // Decoding chatMemberStatusCreator#f6764afe. - v := ChatMemberStatusCreator{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - case ChatMemberStatusAdministratorTypeID: - // Decoding chatMemberStatusAdministrator#fbd3841d. - v := ChatMemberStatusAdministrator{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - case ChatMemberStatusMemberTypeID: - // Decoding chatMemberStatusMember#fe0cec16. - v := ChatMemberStatusMember{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - case ChatMemberStatusRestrictedTypeID: - // Decoding chatMemberStatusRestricted#630774a6. - v := ChatMemberStatusRestricted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - case ChatMemberStatusLeftTypeID: - // Decoding chatMemberStatusLeft#ffa74425. - v := ChatMemberStatusLeft{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - case ChatMemberStatusBannedTypeID: - // Decoding chatMemberStatusBanned#9d714eb6. - v := ChatMemberStatusBanned{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatMemberStatus implements binary de-serialization for ChatMemberStatusClass. -func DecodeTDLibJSONChatMemberStatus(buf tdjson.Decoder) (ChatMemberStatusClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatMemberStatusCreator": - // Decoding chatMemberStatusCreator#f6764afe. - v := ChatMemberStatusCreator{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - case "chatMemberStatusAdministrator": - // Decoding chatMemberStatusAdministrator#fbd3841d. - v := ChatMemberStatusAdministrator{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - case "chatMemberStatusMember": - // Decoding chatMemberStatusMember#fe0cec16. - v := ChatMemberStatusMember{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - case "chatMemberStatusRestricted": - // Decoding chatMemberStatusRestricted#630774a6. - v := ChatMemberStatusRestricted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - case "chatMemberStatusLeft": - // Decoding chatMemberStatusLeft#ffa74425. - v := ChatMemberStatusLeft{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - case "chatMemberStatusBanned": - // Decoding chatMemberStatusBanned#9d714eb6. - v := ChatMemberStatusBanned{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatMemberStatusClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatMemberStatus boxes the ChatMemberStatusClass providing a helper. -type ChatMemberStatusBox struct { - ChatMemberStatus ChatMemberStatusClass -} - -// Decode implements bin.Decoder for ChatMemberStatusBox. -func (b *ChatMemberStatusBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatMemberStatusBox to nil") - } - v, err := DecodeChatMemberStatus(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatMemberStatus = v - return nil -} - -// Encode implements bin.Encode for ChatMemberStatusBox. -func (b *ChatMemberStatusBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatMemberStatus == nil { - return fmt.Errorf("unable to encode ChatMemberStatusClass as nil") - } - return b.ChatMemberStatus.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatMemberStatusBox. -func (b *ChatMemberStatusBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatMemberStatusBox to nil") - } - v, err := DecodeTDLibJSONChatMemberStatus(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatMemberStatus = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatMemberStatusBox. -func (b *ChatMemberStatusBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatMemberStatus == nil { - return fmt.Errorf("unable to encode ChatMemberStatusClass as nil") - } - return b.ChatMemberStatus.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_members_filter_gen.go b/tdapi/tl_chat_members_filter_gen.go deleted file mode 100644 index 5ae9bc648..000000000 --- a/tdapi/tl_chat_members_filter_gen.go +++ /dev/null @@ -1,1196 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatMembersFilterContacts represents TL type `chatMembersFilterContacts#69c480a7`. -type ChatMembersFilterContacts struct { -} - -// ChatMembersFilterContactsTypeID is TL type id of ChatMembersFilterContacts. -const ChatMembersFilterContactsTypeID = 0x69c480a7 - -// construct implements constructor of ChatMembersFilterClass. -func (c ChatMembersFilterContacts) construct() ChatMembersFilterClass { return &c } - -// Ensuring interfaces in compile-time for ChatMembersFilterContacts. -var ( - _ bin.Encoder = &ChatMembersFilterContacts{} - _ bin.Decoder = &ChatMembersFilterContacts{} - _ bin.BareEncoder = &ChatMembersFilterContacts{} - _ bin.BareDecoder = &ChatMembersFilterContacts{} - - _ ChatMembersFilterClass = &ChatMembersFilterContacts{} -) - -func (c *ChatMembersFilterContacts) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMembersFilterContacts) String() string { - if c == nil { - return "ChatMembersFilterContacts(nil)" - } - type Alias ChatMembersFilterContacts - return fmt.Sprintf("ChatMembersFilterContacts%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMembersFilterContacts) TypeID() uint32 { - return ChatMembersFilterContactsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMembersFilterContacts) TypeName() string { - return "chatMembersFilterContacts" -} - -// TypeInfo returns info about TL type. -func (c *ChatMembersFilterContacts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMembersFilterContacts", - ID: ChatMembersFilterContactsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMembersFilterContacts) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterContacts#69c480a7 as nil") - } - b.PutID(ChatMembersFilterContactsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMembersFilterContacts) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterContacts#69c480a7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMembersFilterContacts) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterContacts#69c480a7 to nil") - } - if err := b.ConsumeID(ChatMembersFilterContactsTypeID); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterContacts#69c480a7: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMembersFilterContacts) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterContacts#69c480a7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMembersFilterContacts) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterContacts#69c480a7 as nil") - } - b.ObjStart() - b.PutID("chatMembersFilterContacts") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMembersFilterContacts) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterContacts#69c480a7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMembersFilterContacts"); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterContacts#69c480a7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatMembersFilterAdministrators represents TL type `chatMembersFilterAdministrators#b47cbc1c`. -type ChatMembersFilterAdministrators struct { -} - -// ChatMembersFilterAdministratorsTypeID is TL type id of ChatMembersFilterAdministrators. -const ChatMembersFilterAdministratorsTypeID = 0xb47cbc1c - -// construct implements constructor of ChatMembersFilterClass. -func (c ChatMembersFilterAdministrators) construct() ChatMembersFilterClass { return &c } - -// Ensuring interfaces in compile-time for ChatMembersFilterAdministrators. -var ( - _ bin.Encoder = &ChatMembersFilterAdministrators{} - _ bin.Decoder = &ChatMembersFilterAdministrators{} - _ bin.BareEncoder = &ChatMembersFilterAdministrators{} - _ bin.BareDecoder = &ChatMembersFilterAdministrators{} - - _ ChatMembersFilterClass = &ChatMembersFilterAdministrators{} -) - -func (c *ChatMembersFilterAdministrators) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMembersFilterAdministrators) String() string { - if c == nil { - return "ChatMembersFilterAdministrators(nil)" - } - type Alias ChatMembersFilterAdministrators - return fmt.Sprintf("ChatMembersFilterAdministrators%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMembersFilterAdministrators) TypeID() uint32 { - return ChatMembersFilterAdministratorsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMembersFilterAdministrators) TypeName() string { - return "chatMembersFilterAdministrators" -} - -// TypeInfo returns info about TL type. -func (c *ChatMembersFilterAdministrators) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMembersFilterAdministrators", - ID: ChatMembersFilterAdministratorsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMembersFilterAdministrators) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterAdministrators#b47cbc1c as nil") - } - b.PutID(ChatMembersFilterAdministratorsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMembersFilterAdministrators) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterAdministrators#b47cbc1c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMembersFilterAdministrators) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterAdministrators#b47cbc1c to nil") - } - if err := b.ConsumeID(ChatMembersFilterAdministratorsTypeID); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterAdministrators#b47cbc1c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMembersFilterAdministrators) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterAdministrators#b47cbc1c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMembersFilterAdministrators) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterAdministrators#b47cbc1c as nil") - } - b.ObjStart() - b.PutID("chatMembersFilterAdministrators") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMembersFilterAdministrators) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterAdministrators#b47cbc1c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMembersFilterAdministrators"); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterAdministrators#b47cbc1c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatMembersFilterMembers represents TL type `chatMembersFilterMembers#27f71596`. -type ChatMembersFilterMembers struct { -} - -// ChatMembersFilterMembersTypeID is TL type id of ChatMembersFilterMembers. -const ChatMembersFilterMembersTypeID = 0x27f71596 - -// construct implements constructor of ChatMembersFilterClass. -func (c ChatMembersFilterMembers) construct() ChatMembersFilterClass { return &c } - -// Ensuring interfaces in compile-time for ChatMembersFilterMembers. -var ( - _ bin.Encoder = &ChatMembersFilterMembers{} - _ bin.Decoder = &ChatMembersFilterMembers{} - _ bin.BareEncoder = &ChatMembersFilterMembers{} - _ bin.BareDecoder = &ChatMembersFilterMembers{} - - _ ChatMembersFilterClass = &ChatMembersFilterMembers{} -) - -func (c *ChatMembersFilterMembers) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMembersFilterMembers) String() string { - if c == nil { - return "ChatMembersFilterMembers(nil)" - } - type Alias ChatMembersFilterMembers - return fmt.Sprintf("ChatMembersFilterMembers%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMembersFilterMembers) TypeID() uint32 { - return ChatMembersFilterMembersTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMembersFilterMembers) TypeName() string { - return "chatMembersFilterMembers" -} - -// TypeInfo returns info about TL type. -func (c *ChatMembersFilterMembers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMembersFilterMembers", - ID: ChatMembersFilterMembersTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMembersFilterMembers) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterMembers#27f71596 as nil") - } - b.PutID(ChatMembersFilterMembersTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMembersFilterMembers) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterMembers#27f71596 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMembersFilterMembers) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterMembers#27f71596 to nil") - } - if err := b.ConsumeID(ChatMembersFilterMembersTypeID); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterMembers#27f71596: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMembersFilterMembers) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterMembers#27f71596 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMembersFilterMembers) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterMembers#27f71596 as nil") - } - b.ObjStart() - b.PutID("chatMembersFilterMembers") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMembersFilterMembers) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterMembers#27f71596 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMembersFilterMembers"); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterMembers#27f71596: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatMembersFilterMention represents TL type `chatMembersFilterMention#330bedf7`. -type ChatMembersFilterMention struct { - // If non-zero, the identifier of the current message thread - MessageThreadID int64 -} - -// ChatMembersFilterMentionTypeID is TL type id of ChatMembersFilterMention. -const ChatMembersFilterMentionTypeID = 0x330bedf7 - -// construct implements constructor of ChatMembersFilterClass. -func (c ChatMembersFilterMention) construct() ChatMembersFilterClass { return &c } - -// Ensuring interfaces in compile-time for ChatMembersFilterMention. -var ( - _ bin.Encoder = &ChatMembersFilterMention{} - _ bin.Decoder = &ChatMembersFilterMention{} - _ bin.BareEncoder = &ChatMembersFilterMention{} - _ bin.BareDecoder = &ChatMembersFilterMention{} - - _ ChatMembersFilterClass = &ChatMembersFilterMention{} -) - -func (c *ChatMembersFilterMention) Zero() bool { - if c == nil { - return true - } - if !(c.MessageThreadID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMembersFilterMention) String() string { - if c == nil { - return "ChatMembersFilterMention(nil)" - } - type Alias ChatMembersFilterMention - return fmt.Sprintf("ChatMembersFilterMention%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMembersFilterMention) TypeID() uint32 { - return ChatMembersFilterMentionTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMembersFilterMention) TypeName() string { - return "chatMembersFilterMention" -} - -// TypeInfo returns info about TL type. -func (c *ChatMembersFilterMention) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMembersFilterMention", - ID: ChatMembersFilterMentionTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMembersFilterMention) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterMention#330bedf7 as nil") - } - b.PutID(ChatMembersFilterMentionTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMembersFilterMention) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterMention#330bedf7 as nil") - } - b.PutInt53(c.MessageThreadID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMembersFilterMention) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterMention#330bedf7 to nil") - } - if err := b.ConsumeID(ChatMembersFilterMentionTypeID); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterMention#330bedf7: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMembersFilterMention) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterMention#330bedf7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatMembersFilterMention#330bedf7: field message_thread_id: %w", err) - } - c.MessageThreadID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMembersFilterMention) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterMention#330bedf7 as nil") - } - b.ObjStart() - b.PutID("chatMembersFilterMention") - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(c.MessageThreadID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMembersFilterMention) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterMention#330bedf7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMembersFilterMention"); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterMention#330bedf7: %w", err) - } - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatMembersFilterMention#330bedf7: field message_thread_id: %w", err) - } - c.MessageThreadID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (c *ChatMembersFilterMention) GetMessageThreadID() (value int64) { - if c == nil { - return - } - return c.MessageThreadID -} - -// ChatMembersFilterRestricted represents TL type `chatMembersFilterRestricted#4ae15abd`. -type ChatMembersFilterRestricted struct { -} - -// ChatMembersFilterRestrictedTypeID is TL type id of ChatMembersFilterRestricted. -const ChatMembersFilterRestrictedTypeID = 0x4ae15abd - -// construct implements constructor of ChatMembersFilterClass. -func (c ChatMembersFilterRestricted) construct() ChatMembersFilterClass { return &c } - -// Ensuring interfaces in compile-time for ChatMembersFilterRestricted. -var ( - _ bin.Encoder = &ChatMembersFilterRestricted{} - _ bin.Decoder = &ChatMembersFilterRestricted{} - _ bin.BareEncoder = &ChatMembersFilterRestricted{} - _ bin.BareDecoder = &ChatMembersFilterRestricted{} - - _ ChatMembersFilterClass = &ChatMembersFilterRestricted{} -) - -func (c *ChatMembersFilterRestricted) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMembersFilterRestricted) String() string { - if c == nil { - return "ChatMembersFilterRestricted(nil)" - } - type Alias ChatMembersFilterRestricted - return fmt.Sprintf("ChatMembersFilterRestricted%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMembersFilterRestricted) TypeID() uint32 { - return ChatMembersFilterRestrictedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMembersFilterRestricted) TypeName() string { - return "chatMembersFilterRestricted" -} - -// TypeInfo returns info about TL type. -func (c *ChatMembersFilterRestricted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMembersFilterRestricted", - ID: ChatMembersFilterRestrictedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMembersFilterRestricted) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterRestricted#4ae15abd as nil") - } - b.PutID(ChatMembersFilterRestrictedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMembersFilterRestricted) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterRestricted#4ae15abd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMembersFilterRestricted) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterRestricted#4ae15abd to nil") - } - if err := b.ConsumeID(ChatMembersFilterRestrictedTypeID); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterRestricted#4ae15abd: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMembersFilterRestricted) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterRestricted#4ae15abd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMembersFilterRestricted) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterRestricted#4ae15abd as nil") - } - b.ObjStart() - b.PutID("chatMembersFilterRestricted") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMembersFilterRestricted) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterRestricted#4ae15abd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMembersFilterRestricted"); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterRestricted#4ae15abd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatMembersFilterBanned represents TL type `chatMembersFilterBanned#90f34f48`. -type ChatMembersFilterBanned struct { -} - -// ChatMembersFilterBannedTypeID is TL type id of ChatMembersFilterBanned. -const ChatMembersFilterBannedTypeID = 0x90f34f48 - -// construct implements constructor of ChatMembersFilterClass. -func (c ChatMembersFilterBanned) construct() ChatMembersFilterClass { return &c } - -// Ensuring interfaces in compile-time for ChatMembersFilterBanned. -var ( - _ bin.Encoder = &ChatMembersFilterBanned{} - _ bin.Decoder = &ChatMembersFilterBanned{} - _ bin.BareEncoder = &ChatMembersFilterBanned{} - _ bin.BareDecoder = &ChatMembersFilterBanned{} - - _ ChatMembersFilterClass = &ChatMembersFilterBanned{} -) - -func (c *ChatMembersFilterBanned) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMembersFilterBanned) String() string { - if c == nil { - return "ChatMembersFilterBanned(nil)" - } - type Alias ChatMembersFilterBanned - return fmt.Sprintf("ChatMembersFilterBanned%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMembersFilterBanned) TypeID() uint32 { - return ChatMembersFilterBannedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMembersFilterBanned) TypeName() string { - return "chatMembersFilterBanned" -} - -// TypeInfo returns info about TL type. -func (c *ChatMembersFilterBanned) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMembersFilterBanned", - ID: ChatMembersFilterBannedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMembersFilterBanned) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterBanned#90f34f48 as nil") - } - b.PutID(ChatMembersFilterBannedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMembersFilterBanned) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterBanned#90f34f48 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMembersFilterBanned) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterBanned#90f34f48 to nil") - } - if err := b.ConsumeID(ChatMembersFilterBannedTypeID); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterBanned#90f34f48: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMembersFilterBanned) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterBanned#90f34f48 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMembersFilterBanned) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterBanned#90f34f48 as nil") - } - b.ObjStart() - b.PutID("chatMembersFilterBanned") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMembersFilterBanned) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterBanned#90f34f48 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMembersFilterBanned"); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterBanned#90f34f48: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatMembersFilterBots represents TL type `chatMembersFilterBots#ab355888`. -type ChatMembersFilterBots struct { -} - -// ChatMembersFilterBotsTypeID is TL type id of ChatMembersFilterBots. -const ChatMembersFilterBotsTypeID = 0xab355888 - -// construct implements constructor of ChatMembersFilterClass. -func (c ChatMembersFilterBots) construct() ChatMembersFilterClass { return &c } - -// Ensuring interfaces in compile-time for ChatMembersFilterBots. -var ( - _ bin.Encoder = &ChatMembersFilterBots{} - _ bin.Decoder = &ChatMembersFilterBots{} - _ bin.BareEncoder = &ChatMembersFilterBots{} - _ bin.BareDecoder = &ChatMembersFilterBots{} - - _ ChatMembersFilterClass = &ChatMembersFilterBots{} -) - -func (c *ChatMembersFilterBots) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMembersFilterBots) String() string { - if c == nil { - return "ChatMembersFilterBots(nil)" - } - type Alias ChatMembersFilterBots - return fmt.Sprintf("ChatMembersFilterBots%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMembersFilterBots) TypeID() uint32 { - return ChatMembersFilterBotsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMembersFilterBots) TypeName() string { - return "chatMembersFilterBots" -} - -// TypeInfo returns info about TL type. -func (c *ChatMembersFilterBots) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMembersFilterBots", - ID: ChatMembersFilterBotsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMembersFilterBots) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterBots#ab355888 as nil") - } - b.PutID(ChatMembersFilterBotsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMembersFilterBots) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterBots#ab355888 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMembersFilterBots) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterBots#ab355888 to nil") - } - if err := b.ConsumeID(ChatMembersFilterBotsTypeID); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterBots#ab355888: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMembersFilterBots) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterBots#ab355888 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMembersFilterBots) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMembersFilterBots#ab355888 as nil") - } - b.ObjStart() - b.PutID("chatMembersFilterBots") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMembersFilterBots) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMembersFilterBots#ab355888 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMembersFilterBots"); err != nil { - return fmt.Errorf("unable to decode chatMembersFilterBots#ab355888: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatMembersFilterClassName is schema name of ChatMembersFilterClass. -const ChatMembersFilterClassName = "ChatMembersFilter" - -// ChatMembersFilterClass represents ChatMembersFilter generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatMembersFilter(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatMembersFilterContacts: // chatMembersFilterContacts#69c480a7 -// case *tdapi.ChatMembersFilterAdministrators: // chatMembersFilterAdministrators#b47cbc1c -// case *tdapi.ChatMembersFilterMembers: // chatMembersFilterMembers#27f71596 -// case *tdapi.ChatMembersFilterMention: // chatMembersFilterMention#330bedf7 -// case *tdapi.ChatMembersFilterRestricted: // chatMembersFilterRestricted#4ae15abd -// case *tdapi.ChatMembersFilterBanned: // chatMembersFilterBanned#90f34f48 -// case *tdapi.ChatMembersFilterBots: // chatMembersFilterBots#ab355888 -// default: panic(v) -// } -type ChatMembersFilterClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatMembersFilterClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeChatMembersFilter implements binary de-serialization for ChatMembersFilterClass. -func DecodeChatMembersFilter(buf *bin.Buffer) (ChatMembersFilterClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatMembersFilterContactsTypeID: - // Decoding chatMembersFilterContacts#69c480a7. - v := ChatMembersFilterContacts{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case ChatMembersFilterAdministratorsTypeID: - // Decoding chatMembersFilterAdministrators#b47cbc1c. - v := ChatMembersFilterAdministrators{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case ChatMembersFilterMembersTypeID: - // Decoding chatMembersFilterMembers#27f71596. - v := ChatMembersFilterMembers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case ChatMembersFilterMentionTypeID: - // Decoding chatMembersFilterMention#330bedf7. - v := ChatMembersFilterMention{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case ChatMembersFilterRestrictedTypeID: - // Decoding chatMembersFilterRestricted#4ae15abd. - v := ChatMembersFilterRestricted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case ChatMembersFilterBannedTypeID: - // Decoding chatMembersFilterBanned#90f34f48. - v := ChatMembersFilterBanned{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case ChatMembersFilterBotsTypeID: - // Decoding chatMembersFilterBots#ab355888. - v := ChatMembersFilterBots{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatMembersFilter implements binary de-serialization for ChatMembersFilterClass. -func DecodeTDLibJSONChatMembersFilter(buf tdjson.Decoder) (ChatMembersFilterClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatMembersFilterContacts": - // Decoding chatMembersFilterContacts#69c480a7. - v := ChatMembersFilterContacts{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case "chatMembersFilterAdministrators": - // Decoding chatMembersFilterAdministrators#b47cbc1c. - v := ChatMembersFilterAdministrators{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case "chatMembersFilterMembers": - // Decoding chatMembersFilterMembers#27f71596. - v := ChatMembersFilterMembers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case "chatMembersFilterMention": - // Decoding chatMembersFilterMention#330bedf7. - v := ChatMembersFilterMention{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case "chatMembersFilterRestricted": - // Decoding chatMembersFilterRestricted#4ae15abd. - v := ChatMembersFilterRestricted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case "chatMembersFilterBanned": - // Decoding chatMembersFilterBanned#90f34f48. - v := ChatMembersFilterBanned{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - case "chatMembersFilterBots": - // Decoding chatMembersFilterBots#ab355888. - v := ChatMembersFilterBots{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatMembersFilterClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatMembersFilter boxes the ChatMembersFilterClass providing a helper. -type ChatMembersFilterBox struct { - ChatMembersFilter ChatMembersFilterClass -} - -// Decode implements bin.Decoder for ChatMembersFilterBox. -func (b *ChatMembersFilterBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatMembersFilterBox to nil") - } - v, err := DecodeChatMembersFilter(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatMembersFilter = v - return nil -} - -// Encode implements bin.Encode for ChatMembersFilterBox. -func (b *ChatMembersFilterBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatMembersFilter == nil { - return fmt.Errorf("unable to encode ChatMembersFilterClass as nil") - } - return b.ChatMembersFilter.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatMembersFilterBox. -func (b *ChatMembersFilterBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatMembersFilterBox to nil") - } - v, err := DecodeTDLibJSONChatMembersFilter(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatMembersFilter = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatMembersFilterBox. -func (b *ChatMembersFilterBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatMembersFilter == nil { - return fmt.Errorf("unable to encode ChatMembersFilterClass as nil") - } - return b.ChatMembersFilter.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_members_gen.go b/tdapi/tl_chat_members_gen.go deleted file mode 100644 index 736bd443b..000000000 --- a/tdapi/tl_chat_members_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatMembers represents TL type `chatMembers#8ecbb24`. -type ChatMembers struct { - // Approximate total number of chat members found - TotalCount int32 - // A list of chat members - Members []ChatMember -} - -// ChatMembersTypeID is TL type id of ChatMembers. -const ChatMembersTypeID = 0x8ecbb24 - -// Ensuring interfaces in compile-time for ChatMembers. -var ( - _ bin.Encoder = &ChatMembers{} - _ bin.Decoder = &ChatMembers{} - _ bin.BareEncoder = &ChatMembers{} - _ bin.BareDecoder = &ChatMembers{} -) - -func (c *ChatMembers) Zero() bool { - if c == nil { - return true - } - if !(c.TotalCount == 0) { - return false - } - if !(c.Members == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMembers) String() string { - if c == nil { - return "ChatMembers(nil)" - } - type Alias ChatMembers - return fmt.Sprintf("ChatMembers%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMembers) TypeID() uint32 { - return ChatMembersTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMembers) TypeName() string { - return "chatMembers" -} - -// TypeInfo returns info about TL type. -func (c *ChatMembers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMembers", - ID: ChatMembersTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Members", - SchemaName: "members", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMembers) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembers#8ecbb24 as nil") - } - b.PutID(ChatMembersTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMembers) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMembers#8ecbb24 as nil") - } - b.PutInt32(c.TotalCount) - b.PutInt(len(c.Members)) - for idx, v := range c.Members { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatMembers#8ecbb24: field members element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMembers) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembers#8ecbb24 to nil") - } - if err := b.ConsumeID(ChatMembersTypeID); err != nil { - return fmt.Errorf("unable to decode chatMembers#8ecbb24: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMembers) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMembers#8ecbb24 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatMembers#8ecbb24: field total_count: %w", err) - } - c.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatMembers#8ecbb24: field members: %w", err) - } - - if headerLen > 0 { - c.Members = make([]ChatMember, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatMember - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatMembers#8ecbb24: field members: %w", err) - } - c.Members = append(c.Members, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMembers) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMembers#8ecbb24 as nil") - } - b.ObjStart() - b.PutID("chatMembers") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(c.TotalCount) - b.Comma() - b.FieldStart("members") - b.ArrStart() - for idx, v := range c.Members { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatMembers#8ecbb24: field members element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMembers) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMembers#8ecbb24 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMembers"); err != nil { - return fmt.Errorf("unable to decode chatMembers#8ecbb24: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatMembers#8ecbb24: field total_count: %w", err) - } - c.TotalCount = value - case "members": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatMember - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatMembers#8ecbb24: field members: %w", err) - } - c.Members = append(c.Members, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatMembers#8ecbb24: field members: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (c *ChatMembers) GetTotalCount() (value int32) { - if c == nil { - return - } - return c.TotalCount -} - -// GetMembers returns value of Members field. -func (c *ChatMembers) GetMembers() (value []ChatMember) { - if c == nil { - return - } - return c.Members -} diff --git a/tdapi/tl_chat_message_sender_gen.go b/tdapi/tl_chat_message_sender_gen.go deleted file mode 100644 index 666700916..000000000 --- a/tdapi/tl_chat_message_sender_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatMessageSender represents TL type `chatMessageSender#2d55aeba`. -type ChatMessageSender struct { - // The message sender - Sender MessageSenderClass - // True, if Telegram Premium is needed to use the message sender - NeedsPremium bool -} - -// ChatMessageSenderTypeID is TL type id of ChatMessageSender. -const ChatMessageSenderTypeID = 0x2d55aeba - -// Ensuring interfaces in compile-time for ChatMessageSender. -var ( - _ bin.Encoder = &ChatMessageSender{} - _ bin.Decoder = &ChatMessageSender{} - _ bin.BareEncoder = &ChatMessageSender{} - _ bin.BareDecoder = &ChatMessageSender{} -) - -func (c *ChatMessageSender) Zero() bool { - if c == nil { - return true - } - if !(c.Sender == nil) { - return false - } - if !(c.NeedsPremium == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMessageSender) String() string { - if c == nil { - return "ChatMessageSender(nil)" - } - type Alias ChatMessageSender - return fmt.Sprintf("ChatMessageSender%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMessageSender) TypeID() uint32 { - return ChatMessageSenderTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMessageSender) TypeName() string { - return "chatMessageSender" -} - -// TypeInfo returns info about TL type. -func (c *ChatMessageSender) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMessageSender", - ID: ChatMessageSenderTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sender", - SchemaName: "sender", - }, - { - Name: "NeedsPremium", - SchemaName: "needs_premium", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMessageSender) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMessageSender#2d55aeba as nil") - } - b.PutID(ChatMessageSenderTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMessageSender) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMessageSender#2d55aeba as nil") - } - if c.Sender == nil { - return fmt.Errorf("unable to encode chatMessageSender#2d55aeba: field sender is nil") - } - if err := c.Sender.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatMessageSender#2d55aeba: field sender: %w", err) - } - b.PutBool(c.NeedsPremium) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMessageSender) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMessageSender#2d55aeba to nil") - } - if err := b.ConsumeID(ChatMessageSenderTypeID); err != nil { - return fmt.Errorf("unable to decode chatMessageSender#2d55aeba: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMessageSender) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMessageSender#2d55aeba to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatMessageSender#2d55aeba: field sender: %w", err) - } - c.Sender = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatMessageSender#2d55aeba: field needs_premium: %w", err) - } - c.NeedsPremium = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMessageSender) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMessageSender#2d55aeba as nil") - } - b.ObjStart() - b.PutID("chatMessageSender") - b.Comma() - b.FieldStart("sender") - if c.Sender == nil { - return fmt.Errorf("unable to encode chatMessageSender#2d55aeba: field sender is nil") - } - if err := c.Sender.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatMessageSender#2d55aeba: field sender: %w", err) - } - b.Comma() - b.FieldStart("needs_premium") - b.PutBool(c.NeedsPremium) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMessageSender) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMessageSender#2d55aeba to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMessageSender"); err != nil { - return fmt.Errorf("unable to decode chatMessageSender#2d55aeba: %w", err) - } - case "sender": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode chatMessageSender#2d55aeba: field sender: %w", err) - } - c.Sender = value - case "needs_premium": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatMessageSender#2d55aeba: field needs_premium: %w", err) - } - c.NeedsPremium = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSender returns value of Sender field. -func (c *ChatMessageSender) GetSender() (value MessageSenderClass) { - if c == nil { - return - } - return c.Sender -} - -// GetNeedsPremium returns value of NeedsPremium field. -func (c *ChatMessageSender) GetNeedsPremium() (value bool) { - if c == nil { - return - } - return c.NeedsPremium -} diff --git a/tdapi/tl_chat_message_senders_gen.go b/tdapi/tl_chat_message_senders_gen.go deleted file mode 100644 index 518360094..000000000 --- a/tdapi/tl_chat_message_senders_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatMessageSenders represents TL type `chatMessageSenders#d80d336`. -type ChatMessageSenders struct { - // List of available message senders - Senders []ChatMessageSender -} - -// ChatMessageSendersTypeID is TL type id of ChatMessageSenders. -const ChatMessageSendersTypeID = 0xd80d336 - -// Ensuring interfaces in compile-time for ChatMessageSenders. -var ( - _ bin.Encoder = &ChatMessageSenders{} - _ bin.Decoder = &ChatMessageSenders{} - _ bin.BareEncoder = &ChatMessageSenders{} - _ bin.BareDecoder = &ChatMessageSenders{} -) - -func (c *ChatMessageSenders) Zero() bool { - if c == nil { - return true - } - if !(c.Senders == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatMessageSenders) String() string { - if c == nil { - return "ChatMessageSenders(nil)" - } - type Alias ChatMessageSenders - return fmt.Sprintf("ChatMessageSenders%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatMessageSenders) TypeID() uint32 { - return ChatMessageSendersTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatMessageSenders) TypeName() string { - return "chatMessageSenders" -} - -// TypeInfo returns info about TL type. -func (c *ChatMessageSenders) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatMessageSenders", - ID: ChatMessageSendersTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Senders", - SchemaName: "senders", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatMessageSenders) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMessageSenders#d80d336 as nil") - } - b.PutID(ChatMessageSendersTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatMessageSenders) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatMessageSenders#d80d336 as nil") - } - b.PutInt(len(c.Senders)) - for idx, v := range c.Senders { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatMessageSenders#d80d336: field senders element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatMessageSenders) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMessageSenders#d80d336 to nil") - } - if err := b.ConsumeID(ChatMessageSendersTypeID); err != nil { - return fmt.Errorf("unable to decode chatMessageSenders#d80d336: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatMessageSenders) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatMessageSenders#d80d336 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatMessageSenders#d80d336: field senders: %w", err) - } - - if headerLen > 0 { - c.Senders = make([]ChatMessageSender, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatMessageSender - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatMessageSenders#d80d336: field senders: %w", err) - } - c.Senders = append(c.Senders, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatMessageSenders) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatMessageSenders#d80d336 as nil") - } - b.ObjStart() - b.PutID("chatMessageSenders") - b.Comma() - b.FieldStart("senders") - b.ArrStart() - for idx, v := range c.Senders { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatMessageSenders#d80d336: field senders element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatMessageSenders) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatMessageSenders#d80d336 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatMessageSenders"); err != nil { - return fmt.Errorf("unable to decode chatMessageSenders#d80d336: %w", err) - } - case "senders": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatMessageSender - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatMessageSenders#d80d336: field senders: %w", err) - } - c.Senders = append(c.Senders, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatMessageSenders#d80d336: field senders: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSenders returns value of Senders field. -func (c *ChatMessageSenders) GetSenders() (value []ChatMessageSender) { - if c == nil { - return - } - return c.Senders -} diff --git a/tdapi/tl_chat_notification_settings_gen.go b/tdapi/tl_chat_notification_settings_gen.go deleted file mode 100644 index e80a7e6c0..000000000 --- a/tdapi/tl_chat_notification_settings_gen.go +++ /dev/null @@ -1,710 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatNotificationSettings represents TL type `chatNotificationSettings#dddc12cf`. -type ChatNotificationSettings struct { - // If true, the value for the relevant type of chat or the forum chat is used instead of - // mute_for - UseDefaultMuteFor bool - // Time left before notifications will be unmuted, in seconds - MuteFor int32 - // If true, the value for the relevant type of chat or the forum chat is used instead of - // sound_id - UseDefaultSound bool - // Identifier of the notification sound to be played for messages; 0 if sound is disabled - SoundID int64 - // If true, the value for the relevant type of chat or the forum chat is used instead of - // show_preview - UseDefaultShowPreview bool - // True, if message content must be displayed in notifications - ShowPreview bool - // If true, the value for the relevant type of chat is used instead of mute_stories - UseDefaultMuteStories bool - // True, if story notifications are disabled for the chat - MuteStories bool - // If true, the value for the relevant type of chat is used instead of story_sound_id - UseDefaultStorySound bool - // Identifier of the notification sound to be played for stories; 0 if sound is disabled - StorySoundID int64 - // If true, the value for the relevant type of chat is used instead of show_story_sender - UseDefaultShowStorySender bool - // True, if the sender of stories must be displayed in notifications - ShowStorySender bool - // If true, the value for the relevant type of chat or the forum chat is used instead of - // disable_pinned_message_notifications - UseDefaultDisablePinnedMessageNotifications bool - // If true, notifications for incoming pinned messages will be created as for an ordinary - // unread message - DisablePinnedMessageNotifications bool - // If true, the value for the relevant type of chat or the forum chat is used instead of - // disable_mention_notifications - UseDefaultDisableMentionNotifications bool - // If true, notifications for messages with mentions will be created as for an ordinary - // unread message - DisableMentionNotifications bool -} - -// ChatNotificationSettingsTypeID is TL type id of ChatNotificationSettings. -const ChatNotificationSettingsTypeID = 0xdddc12cf - -// Ensuring interfaces in compile-time for ChatNotificationSettings. -var ( - _ bin.Encoder = &ChatNotificationSettings{} - _ bin.Decoder = &ChatNotificationSettings{} - _ bin.BareEncoder = &ChatNotificationSettings{} - _ bin.BareDecoder = &ChatNotificationSettings{} -) - -func (c *ChatNotificationSettings) Zero() bool { - if c == nil { - return true - } - if !(c.UseDefaultMuteFor == false) { - return false - } - if !(c.MuteFor == 0) { - return false - } - if !(c.UseDefaultSound == false) { - return false - } - if !(c.SoundID == 0) { - return false - } - if !(c.UseDefaultShowPreview == false) { - return false - } - if !(c.ShowPreview == false) { - return false - } - if !(c.UseDefaultMuteStories == false) { - return false - } - if !(c.MuteStories == false) { - return false - } - if !(c.UseDefaultStorySound == false) { - return false - } - if !(c.StorySoundID == 0) { - return false - } - if !(c.UseDefaultShowStorySender == false) { - return false - } - if !(c.ShowStorySender == false) { - return false - } - if !(c.UseDefaultDisablePinnedMessageNotifications == false) { - return false - } - if !(c.DisablePinnedMessageNotifications == false) { - return false - } - if !(c.UseDefaultDisableMentionNotifications == false) { - return false - } - if !(c.DisableMentionNotifications == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatNotificationSettings) String() string { - if c == nil { - return "ChatNotificationSettings(nil)" - } - type Alias ChatNotificationSettings - return fmt.Sprintf("ChatNotificationSettings%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatNotificationSettings) TypeID() uint32 { - return ChatNotificationSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatNotificationSettings) TypeName() string { - return "chatNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (c *ChatNotificationSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatNotificationSettings", - ID: ChatNotificationSettingsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UseDefaultMuteFor", - SchemaName: "use_default_mute_for", - }, - { - Name: "MuteFor", - SchemaName: "mute_for", - }, - { - Name: "UseDefaultSound", - SchemaName: "use_default_sound", - }, - { - Name: "SoundID", - SchemaName: "sound_id", - }, - { - Name: "UseDefaultShowPreview", - SchemaName: "use_default_show_preview", - }, - { - Name: "ShowPreview", - SchemaName: "show_preview", - }, - { - Name: "UseDefaultMuteStories", - SchemaName: "use_default_mute_stories", - }, - { - Name: "MuteStories", - SchemaName: "mute_stories", - }, - { - Name: "UseDefaultStorySound", - SchemaName: "use_default_story_sound", - }, - { - Name: "StorySoundID", - SchemaName: "story_sound_id", - }, - { - Name: "UseDefaultShowStorySender", - SchemaName: "use_default_show_story_sender", - }, - { - Name: "ShowStorySender", - SchemaName: "show_story_sender", - }, - { - Name: "UseDefaultDisablePinnedMessageNotifications", - SchemaName: "use_default_disable_pinned_message_notifications", - }, - { - Name: "DisablePinnedMessageNotifications", - SchemaName: "disable_pinned_message_notifications", - }, - { - Name: "UseDefaultDisableMentionNotifications", - SchemaName: "use_default_disable_mention_notifications", - }, - { - Name: "DisableMentionNotifications", - SchemaName: "disable_mention_notifications", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatNotificationSettings) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatNotificationSettings#dddc12cf as nil") - } - b.PutID(ChatNotificationSettingsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatNotificationSettings) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatNotificationSettings#dddc12cf as nil") - } - b.PutBool(c.UseDefaultMuteFor) - b.PutInt32(c.MuteFor) - b.PutBool(c.UseDefaultSound) - b.PutLong(c.SoundID) - b.PutBool(c.UseDefaultShowPreview) - b.PutBool(c.ShowPreview) - b.PutBool(c.UseDefaultMuteStories) - b.PutBool(c.MuteStories) - b.PutBool(c.UseDefaultStorySound) - b.PutLong(c.StorySoundID) - b.PutBool(c.UseDefaultShowStorySender) - b.PutBool(c.ShowStorySender) - b.PutBool(c.UseDefaultDisablePinnedMessageNotifications) - b.PutBool(c.DisablePinnedMessageNotifications) - b.PutBool(c.UseDefaultDisableMentionNotifications) - b.PutBool(c.DisableMentionNotifications) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatNotificationSettings) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatNotificationSettings#dddc12cf to nil") - } - if err := b.ConsumeID(ChatNotificationSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatNotificationSettings) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatNotificationSettings#dddc12cf to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_mute_for: %w", err) - } - c.UseDefaultMuteFor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field mute_for: %w", err) - } - c.MuteFor = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_sound: %w", err) - } - c.UseDefaultSound = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field sound_id: %w", err) - } - c.SoundID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_show_preview: %w", err) - } - c.UseDefaultShowPreview = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field show_preview: %w", err) - } - c.ShowPreview = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_mute_stories: %w", err) - } - c.UseDefaultMuteStories = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field mute_stories: %w", err) - } - c.MuteStories = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_story_sound: %w", err) - } - c.UseDefaultStorySound = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field story_sound_id: %w", err) - } - c.StorySoundID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_show_story_sender: %w", err) - } - c.UseDefaultShowStorySender = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field show_story_sender: %w", err) - } - c.ShowStorySender = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_disable_pinned_message_notifications: %w", err) - } - c.UseDefaultDisablePinnedMessageNotifications = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field disable_pinned_message_notifications: %w", err) - } - c.DisablePinnedMessageNotifications = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_disable_mention_notifications: %w", err) - } - c.UseDefaultDisableMentionNotifications = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field disable_mention_notifications: %w", err) - } - c.DisableMentionNotifications = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatNotificationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatNotificationSettings#dddc12cf as nil") - } - b.ObjStart() - b.PutID("chatNotificationSettings") - b.Comma() - b.FieldStart("use_default_mute_for") - b.PutBool(c.UseDefaultMuteFor) - b.Comma() - b.FieldStart("mute_for") - b.PutInt32(c.MuteFor) - b.Comma() - b.FieldStart("use_default_sound") - b.PutBool(c.UseDefaultSound) - b.Comma() - b.FieldStart("sound_id") - b.PutLong(c.SoundID) - b.Comma() - b.FieldStart("use_default_show_preview") - b.PutBool(c.UseDefaultShowPreview) - b.Comma() - b.FieldStart("show_preview") - b.PutBool(c.ShowPreview) - b.Comma() - b.FieldStart("use_default_mute_stories") - b.PutBool(c.UseDefaultMuteStories) - b.Comma() - b.FieldStart("mute_stories") - b.PutBool(c.MuteStories) - b.Comma() - b.FieldStart("use_default_story_sound") - b.PutBool(c.UseDefaultStorySound) - b.Comma() - b.FieldStart("story_sound_id") - b.PutLong(c.StorySoundID) - b.Comma() - b.FieldStart("use_default_show_story_sender") - b.PutBool(c.UseDefaultShowStorySender) - b.Comma() - b.FieldStart("show_story_sender") - b.PutBool(c.ShowStorySender) - b.Comma() - b.FieldStart("use_default_disable_pinned_message_notifications") - b.PutBool(c.UseDefaultDisablePinnedMessageNotifications) - b.Comma() - b.FieldStart("disable_pinned_message_notifications") - b.PutBool(c.DisablePinnedMessageNotifications) - b.Comma() - b.FieldStart("use_default_disable_mention_notifications") - b.PutBool(c.UseDefaultDisableMentionNotifications) - b.Comma() - b.FieldStart("disable_mention_notifications") - b.PutBool(c.DisableMentionNotifications) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatNotificationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatNotificationSettings#dddc12cf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: %w", err) - } - case "use_default_mute_for": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_mute_for: %w", err) - } - c.UseDefaultMuteFor = value - case "mute_for": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field mute_for: %w", err) - } - c.MuteFor = value - case "use_default_sound": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_sound: %w", err) - } - c.UseDefaultSound = value - case "sound_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field sound_id: %w", err) - } - c.SoundID = value - case "use_default_show_preview": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_show_preview: %w", err) - } - c.UseDefaultShowPreview = value - case "show_preview": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field show_preview: %w", err) - } - c.ShowPreview = value - case "use_default_mute_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_mute_stories: %w", err) - } - c.UseDefaultMuteStories = value - case "mute_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field mute_stories: %w", err) - } - c.MuteStories = value - case "use_default_story_sound": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_story_sound: %w", err) - } - c.UseDefaultStorySound = value - case "story_sound_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field story_sound_id: %w", err) - } - c.StorySoundID = value - case "use_default_show_story_sender": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_show_story_sender: %w", err) - } - c.UseDefaultShowStorySender = value - case "show_story_sender": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field show_story_sender: %w", err) - } - c.ShowStorySender = value - case "use_default_disable_pinned_message_notifications": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_disable_pinned_message_notifications: %w", err) - } - c.UseDefaultDisablePinnedMessageNotifications = value - case "disable_pinned_message_notifications": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field disable_pinned_message_notifications: %w", err) - } - c.DisablePinnedMessageNotifications = value - case "use_default_disable_mention_notifications": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field use_default_disable_mention_notifications: %w", err) - } - c.UseDefaultDisableMentionNotifications = value - case "disable_mention_notifications": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatNotificationSettings#dddc12cf: field disable_mention_notifications: %w", err) - } - c.DisableMentionNotifications = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUseDefaultMuteFor returns value of UseDefaultMuteFor field. -func (c *ChatNotificationSettings) GetUseDefaultMuteFor() (value bool) { - if c == nil { - return - } - return c.UseDefaultMuteFor -} - -// GetMuteFor returns value of MuteFor field. -func (c *ChatNotificationSettings) GetMuteFor() (value int32) { - if c == nil { - return - } - return c.MuteFor -} - -// GetUseDefaultSound returns value of UseDefaultSound field. -func (c *ChatNotificationSettings) GetUseDefaultSound() (value bool) { - if c == nil { - return - } - return c.UseDefaultSound -} - -// GetSoundID returns value of SoundID field. -func (c *ChatNotificationSettings) GetSoundID() (value int64) { - if c == nil { - return - } - return c.SoundID -} - -// GetUseDefaultShowPreview returns value of UseDefaultShowPreview field. -func (c *ChatNotificationSettings) GetUseDefaultShowPreview() (value bool) { - if c == nil { - return - } - return c.UseDefaultShowPreview -} - -// GetShowPreview returns value of ShowPreview field. -func (c *ChatNotificationSettings) GetShowPreview() (value bool) { - if c == nil { - return - } - return c.ShowPreview -} - -// GetUseDefaultMuteStories returns value of UseDefaultMuteStories field. -func (c *ChatNotificationSettings) GetUseDefaultMuteStories() (value bool) { - if c == nil { - return - } - return c.UseDefaultMuteStories -} - -// GetMuteStories returns value of MuteStories field. -func (c *ChatNotificationSettings) GetMuteStories() (value bool) { - if c == nil { - return - } - return c.MuteStories -} - -// GetUseDefaultStorySound returns value of UseDefaultStorySound field. -func (c *ChatNotificationSettings) GetUseDefaultStorySound() (value bool) { - if c == nil { - return - } - return c.UseDefaultStorySound -} - -// GetStorySoundID returns value of StorySoundID field. -func (c *ChatNotificationSettings) GetStorySoundID() (value int64) { - if c == nil { - return - } - return c.StorySoundID -} - -// GetUseDefaultShowStorySender returns value of UseDefaultShowStorySender field. -func (c *ChatNotificationSettings) GetUseDefaultShowStorySender() (value bool) { - if c == nil { - return - } - return c.UseDefaultShowStorySender -} - -// GetShowStorySender returns value of ShowStorySender field. -func (c *ChatNotificationSettings) GetShowStorySender() (value bool) { - if c == nil { - return - } - return c.ShowStorySender -} - -// GetUseDefaultDisablePinnedMessageNotifications returns value of UseDefaultDisablePinnedMessageNotifications field. -func (c *ChatNotificationSettings) GetUseDefaultDisablePinnedMessageNotifications() (value bool) { - if c == nil { - return - } - return c.UseDefaultDisablePinnedMessageNotifications -} - -// GetDisablePinnedMessageNotifications returns value of DisablePinnedMessageNotifications field. -func (c *ChatNotificationSettings) GetDisablePinnedMessageNotifications() (value bool) { - if c == nil { - return - } - return c.DisablePinnedMessageNotifications -} - -// GetUseDefaultDisableMentionNotifications returns value of UseDefaultDisableMentionNotifications field. -func (c *ChatNotificationSettings) GetUseDefaultDisableMentionNotifications() (value bool) { - if c == nil { - return - } - return c.UseDefaultDisableMentionNotifications -} - -// GetDisableMentionNotifications returns value of DisableMentionNotifications field. -func (c *ChatNotificationSettings) GetDisableMentionNotifications() (value bool) { - if c == nil { - return - } - return c.DisableMentionNotifications -} diff --git a/tdapi/tl_chat_permissions_gen.go b/tdapi/tl_chat_permissions_gen.go deleted file mode 100644 index fd2c6e8cf..000000000 --- a/tdapi/tl_chat_permissions_gen.go +++ /dev/null @@ -1,636 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatPermissions represents TL type `chatPermissions#f8f25a79`. -type ChatPermissions struct { - // True, if the user can send text messages, contacts, giveaways, giveaway winners, - // invoices, locations, and venues - CanSendBasicMessages bool - // True, if the user can send music files - CanSendAudios bool - // True, if the user can send documents - CanSendDocuments bool - // True, if the user can send photos - CanSendPhotos bool - // True, if the user can send videos - CanSendVideos bool - // True, if the user can send video notes - CanSendVideoNotes bool - // True, if the user can send voice notes - CanSendVoiceNotes bool - // True, if the user can send polls - CanSendPolls bool - // True, if the user can send animations, games, stickers, and dice and use inline bots - CanSendOtherMessages bool - // True, if the user may add a link preview to their messages - CanAddLinkPreviews bool - // True, if the user can change the chat title, photo, and other settings - CanChangeInfo bool - // True, if the user can invite new users to the chat - CanInviteUsers bool - // True, if the user can pin messages - CanPinMessages bool - // True, if the user can create topics - CanCreateTopics bool -} - -// ChatPermissionsTypeID is TL type id of ChatPermissions. -const ChatPermissionsTypeID = 0xf8f25a79 - -// Ensuring interfaces in compile-time for ChatPermissions. -var ( - _ bin.Encoder = &ChatPermissions{} - _ bin.Decoder = &ChatPermissions{} - _ bin.BareEncoder = &ChatPermissions{} - _ bin.BareDecoder = &ChatPermissions{} -) - -func (c *ChatPermissions) Zero() bool { - if c == nil { - return true - } - if !(c.CanSendBasicMessages == false) { - return false - } - if !(c.CanSendAudios == false) { - return false - } - if !(c.CanSendDocuments == false) { - return false - } - if !(c.CanSendPhotos == false) { - return false - } - if !(c.CanSendVideos == false) { - return false - } - if !(c.CanSendVideoNotes == false) { - return false - } - if !(c.CanSendVoiceNotes == false) { - return false - } - if !(c.CanSendPolls == false) { - return false - } - if !(c.CanSendOtherMessages == false) { - return false - } - if !(c.CanAddLinkPreviews == false) { - return false - } - if !(c.CanChangeInfo == false) { - return false - } - if !(c.CanInviteUsers == false) { - return false - } - if !(c.CanPinMessages == false) { - return false - } - if !(c.CanCreateTopics == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatPermissions) String() string { - if c == nil { - return "ChatPermissions(nil)" - } - type Alias ChatPermissions - return fmt.Sprintf("ChatPermissions%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatPermissions) TypeID() uint32 { - return ChatPermissionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatPermissions) TypeName() string { - return "chatPermissions" -} - -// TypeInfo returns info about TL type. -func (c *ChatPermissions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatPermissions", - ID: ChatPermissionsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CanSendBasicMessages", - SchemaName: "can_send_basic_messages", - }, - { - Name: "CanSendAudios", - SchemaName: "can_send_audios", - }, - { - Name: "CanSendDocuments", - SchemaName: "can_send_documents", - }, - { - Name: "CanSendPhotos", - SchemaName: "can_send_photos", - }, - { - Name: "CanSendVideos", - SchemaName: "can_send_videos", - }, - { - Name: "CanSendVideoNotes", - SchemaName: "can_send_video_notes", - }, - { - Name: "CanSendVoiceNotes", - SchemaName: "can_send_voice_notes", - }, - { - Name: "CanSendPolls", - SchemaName: "can_send_polls", - }, - { - Name: "CanSendOtherMessages", - SchemaName: "can_send_other_messages", - }, - { - Name: "CanAddLinkPreviews", - SchemaName: "can_add_link_previews", - }, - { - Name: "CanChangeInfo", - SchemaName: "can_change_info", - }, - { - Name: "CanInviteUsers", - SchemaName: "can_invite_users", - }, - { - Name: "CanPinMessages", - SchemaName: "can_pin_messages", - }, - { - Name: "CanCreateTopics", - SchemaName: "can_create_topics", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatPermissions) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPermissions#f8f25a79 as nil") - } - b.PutID(ChatPermissionsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatPermissions) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPermissions#f8f25a79 as nil") - } - b.PutBool(c.CanSendBasicMessages) - b.PutBool(c.CanSendAudios) - b.PutBool(c.CanSendDocuments) - b.PutBool(c.CanSendPhotos) - b.PutBool(c.CanSendVideos) - b.PutBool(c.CanSendVideoNotes) - b.PutBool(c.CanSendVoiceNotes) - b.PutBool(c.CanSendPolls) - b.PutBool(c.CanSendOtherMessages) - b.PutBool(c.CanAddLinkPreviews) - b.PutBool(c.CanChangeInfo) - b.PutBool(c.CanInviteUsers) - b.PutBool(c.CanPinMessages) - b.PutBool(c.CanCreateTopics) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatPermissions) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPermissions#f8f25a79 to nil") - } - if err := b.ConsumeID(ChatPermissionsTypeID); err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatPermissions) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPermissions#f8f25a79 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_basic_messages: %w", err) - } - c.CanSendBasicMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_audios: %w", err) - } - c.CanSendAudios = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_documents: %w", err) - } - c.CanSendDocuments = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_photos: %w", err) - } - c.CanSendPhotos = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_videos: %w", err) - } - c.CanSendVideos = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_video_notes: %w", err) - } - c.CanSendVideoNotes = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_voice_notes: %w", err) - } - c.CanSendVoiceNotes = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_polls: %w", err) - } - c.CanSendPolls = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_other_messages: %w", err) - } - c.CanSendOtherMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_add_link_previews: %w", err) - } - c.CanAddLinkPreviews = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_change_info: %w", err) - } - c.CanChangeInfo = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_invite_users: %w", err) - } - c.CanInviteUsers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_pin_messages: %w", err) - } - c.CanPinMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_create_topics: %w", err) - } - c.CanCreateTopics = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatPermissions) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatPermissions#f8f25a79 as nil") - } - b.ObjStart() - b.PutID("chatPermissions") - b.Comma() - b.FieldStart("can_send_basic_messages") - b.PutBool(c.CanSendBasicMessages) - b.Comma() - b.FieldStart("can_send_audios") - b.PutBool(c.CanSendAudios) - b.Comma() - b.FieldStart("can_send_documents") - b.PutBool(c.CanSendDocuments) - b.Comma() - b.FieldStart("can_send_photos") - b.PutBool(c.CanSendPhotos) - b.Comma() - b.FieldStart("can_send_videos") - b.PutBool(c.CanSendVideos) - b.Comma() - b.FieldStart("can_send_video_notes") - b.PutBool(c.CanSendVideoNotes) - b.Comma() - b.FieldStart("can_send_voice_notes") - b.PutBool(c.CanSendVoiceNotes) - b.Comma() - b.FieldStart("can_send_polls") - b.PutBool(c.CanSendPolls) - b.Comma() - b.FieldStart("can_send_other_messages") - b.PutBool(c.CanSendOtherMessages) - b.Comma() - b.FieldStart("can_add_link_previews") - b.PutBool(c.CanAddLinkPreviews) - b.Comma() - b.FieldStart("can_change_info") - b.PutBool(c.CanChangeInfo) - b.Comma() - b.FieldStart("can_invite_users") - b.PutBool(c.CanInviteUsers) - b.Comma() - b.FieldStart("can_pin_messages") - b.PutBool(c.CanPinMessages) - b.Comma() - b.FieldStart("can_create_topics") - b.PutBool(c.CanCreateTopics) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatPermissions) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatPermissions#f8f25a79 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatPermissions"); err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: %w", err) - } - case "can_send_basic_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_basic_messages: %w", err) - } - c.CanSendBasicMessages = value - case "can_send_audios": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_audios: %w", err) - } - c.CanSendAudios = value - case "can_send_documents": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_documents: %w", err) - } - c.CanSendDocuments = value - case "can_send_photos": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_photos: %w", err) - } - c.CanSendPhotos = value - case "can_send_videos": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_videos: %w", err) - } - c.CanSendVideos = value - case "can_send_video_notes": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_video_notes: %w", err) - } - c.CanSendVideoNotes = value - case "can_send_voice_notes": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_voice_notes: %w", err) - } - c.CanSendVoiceNotes = value - case "can_send_polls": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_polls: %w", err) - } - c.CanSendPolls = value - case "can_send_other_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_send_other_messages: %w", err) - } - c.CanSendOtherMessages = value - case "can_add_link_previews": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_add_link_previews: %w", err) - } - c.CanAddLinkPreviews = value - case "can_change_info": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_change_info: %w", err) - } - c.CanChangeInfo = value - case "can_invite_users": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_invite_users: %w", err) - } - c.CanInviteUsers = value - case "can_pin_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_pin_messages: %w", err) - } - c.CanPinMessages = value - case "can_create_topics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPermissions#f8f25a79: field can_create_topics: %w", err) - } - c.CanCreateTopics = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCanSendBasicMessages returns value of CanSendBasicMessages field. -func (c *ChatPermissions) GetCanSendBasicMessages() (value bool) { - if c == nil { - return - } - return c.CanSendBasicMessages -} - -// GetCanSendAudios returns value of CanSendAudios field. -func (c *ChatPermissions) GetCanSendAudios() (value bool) { - if c == nil { - return - } - return c.CanSendAudios -} - -// GetCanSendDocuments returns value of CanSendDocuments field. -func (c *ChatPermissions) GetCanSendDocuments() (value bool) { - if c == nil { - return - } - return c.CanSendDocuments -} - -// GetCanSendPhotos returns value of CanSendPhotos field. -func (c *ChatPermissions) GetCanSendPhotos() (value bool) { - if c == nil { - return - } - return c.CanSendPhotos -} - -// GetCanSendVideos returns value of CanSendVideos field. -func (c *ChatPermissions) GetCanSendVideos() (value bool) { - if c == nil { - return - } - return c.CanSendVideos -} - -// GetCanSendVideoNotes returns value of CanSendVideoNotes field. -func (c *ChatPermissions) GetCanSendVideoNotes() (value bool) { - if c == nil { - return - } - return c.CanSendVideoNotes -} - -// GetCanSendVoiceNotes returns value of CanSendVoiceNotes field. -func (c *ChatPermissions) GetCanSendVoiceNotes() (value bool) { - if c == nil { - return - } - return c.CanSendVoiceNotes -} - -// GetCanSendPolls returns value of CanSendPolls field. -func (c *ChatPermissions) GetCanSendPolls() (value bool) { - if c == nil { - return - } - return c.CanSendPolls -} - -// GetCanSendOtherMessages returns value of CanSendOtherMessages field. -func (c *ChatPermissions) GetCanSendOtherMessages() (value bool) { - if c == nil { - return - } - return c.CanSendOtherMessages -} - -// GetCanAddLinkPreviews returns value of CanAddLinkPreviews field. -func (c *ChatPermissions) GetCanAddLinkPreviews() (value bool) { - if c == nil { - return - } - return c.CanAddLinkPreviews -} - -// GetCanChangeInfo returns value of CanChangeInfo field. -func (c *ChatPermissions) GetCanChangeInfo() (value bool) { - if c == nil { - return - } - return c.CanChangeInfo -} - -// GetCanInviteUsers returns value of CanInviteUsers field. -func (c *ChatPermissions) GetCanInviteUsers() (value bool) { - if c == nil { - return - } - return c.CanInviteUsers -} - -// GetCanPinMessages returns value of CanPinMessages field. -func (c *ChatPermissions) GetCanPinMessages() (value bool) { - if c == nil { - return - } - return c.CanPinMessages -} - -// GetCanCreateTopics returns value of CanCreateTopics field. -func (c *ChatPermissions) GetCanCreateTopics() (value bool) { - if c == nil { - return - } - return c.CanCreateTopics -} diff --git a/tdapi/tl_chat_photo_gen.go b/tdapi/tl_chat_photo_gen.go deleted file mode 100644 index 185388e7d..000000000 --- a/tdapi/tl_chat_photo_gen.go +++ /dev/null @@ -1,426 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatPhoto represents TL type `chatPhoto#96e90714`. -type ChatPhoto struct { - // Unique photo identifier - ID int64 - // Point in time (Unix timestamp) when the photo has been added - AddedDate int32 - // Photo minithumbnail; may be null - Minithumbnail Minithumbnail - // Available variants of the photo in JPEG format, in different size - Sizes []PhotoSize - // A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null - Animation AnimatedChatPhoto - // A small (160x160) animated variant of the photo in MPEG4 format; may be null even the - // big animation is available - SmallAnimation AnimatedChatPhoto - // Sticker-based version of the chat photo; may be null - Sticker ChatPhotoSticker -} - -// ChatPhotoTypeID is TL type id of ChatPhoto. -const ChatPhotoTypeID = 0x96e90714 - -// Ensuring interfaces in compile-time for ChatPhoto. -var ( - _ bin.Encoder = &ChatPhoto{} - _ bin.Decoder = &ChatPhoto{} - _ bin.BareEncoder = &ChatPhoto{} - _ bin.BareDecoder = &ChatPhoto{} -) - -func (c *ChatPhoto) Zero() bool { - if c == nil { - return true - } - if !(c.ID == 0) { - return false - } - if !(c.AddedDate == 0) { - return false - } - if !(c.Minithumbnail.Zero()) { - return false - } - if !(c.Sizes == nil) { - return false - } - if !(c.Animation.Zero()) { - return false - } - if !(c.SmallAnimation.Zero()) { - return false - } - if !(c.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatPhoto) String() string { - if c == nil { - return "ChatPhoto(nil)" - } - type Alias ChatPhoto - return fmt.Sprintf("ChatPhoto%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatPhoto) TypeID() uint32 { - return ChatPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatPhoto) TypeName() string { - return "chatPhoto" -} - -// TypeInfo returns info about TL type. -func (c *ChatPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatPhoto", - ID: ChatPhotoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "AddedDate", - SchemaName: "added_date", - }, - { - Name: "Minithumbnail", - SchemaName: "minithumbnail", - }, - { - Name: "Sizes", - SchemaName: "sizes", - }, - { - Name: "Animation", - SchemaName: "animation", - }, - { - Name: "SmallAnimation", - SchemaName: "small_animation", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatPhoto) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhoto#96e90714 as nil") - } - b.PutID(ChatPhotoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatPhoto) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhoto#96e90714 as nil") - } - b.PutLong(c.ID) - b.PutInt32(c.AddedDate) - if err := c.Minithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatPhoto#96e90714: field minithumbnail: %w", err) - } - b.PutInt(len(c.Sizes)) - for idx, v := range c.Sizes { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatPhoto#96e90714: field sizes element with index %d: %w", idx, err) - } - } - if err := c.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatPhoto#96e90714: field animation: %w", err) - } - if err := c.SmallAnimation.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatPhoto#96e90714: field small_animation: %w", err) - } - if err := c.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatPhoto#96e90714: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatPhoto) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhoto#96e90714 to nil") - } - if err := b.ConsumeID(ChatPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatPhoto) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhoto#96e90714 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field id: %w", err) - } - c.ID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field added_date: %w", err) - } - c.AddedDate = value - } - { - if err := c.Minithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field minithumbnail: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field sizes: %w", err) - } - - if headerLen > 0 { - c.Sizes = make([]PhotoSize, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PhotoSize - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatPhoto#96e90714: field sizes: %w", err) - } - c.Sizes = append(c.Sizes, value) - } - } - { - if err := c.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field animation: %w", err) - } - } - { - if err := c.SmallAnimation.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field small_animation: %w", err) - } - } - { - if err := c.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatPhoto#96e90714 as nil") - } - b.ObjStart() - b.PutID("chatPhoto") - b.Comma() - b.FieldStart("id") - b.PutLong(c.ID) - b.Comma() - b.FieldStart("added_date") - b.PutInt32(c.AddedDate) - b.Comma() - b.FieldStart("minithumbnail") - if err := c.Minithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPhoto#96e90714: field minithumbnail: %w", err) - } - b.Comma() - b.FieldStart("sizes") - b.ArrStart() - for idx, v := range c.Sizes { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPhoto#96e90714: field sizes element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("animation") - if err := c.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPhoto#96e90714: field animation: %w", err) - } - b.Comma() - b.FieldStart("small_animation") - if err := c.SmallAnimation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPhoto#96e90714: field small_animation: %w", err) - } - b.Comma() - b.FieldStart("sticker") - if err := c.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPhoto#96e90714: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatPhoto#96e90714 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatPhoto"); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field id: %w", err) - } - c.ID = value - case "added_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field added_date: %w", err) - } - c.AddedDate = value - case "minithumbnail": - if err := c.Minithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field minithumbnail: %w", err) - } - case "sizes": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PhotoSize - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field sizes: %w", err) - } - c.Sizes = append(c.Sizes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field sizes: %w", err) - } - case "animation": - if err := c.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field animation: %w", err) - } - case "small_animation": - if err := c.SmallAnimation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field small_animation: %w", err) - } - case "sticker": - if err := c.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatPhoto#96e90714: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (c *ChatPhoto) GetID() (value int64) { - if c == nil { - return - } - return c.ID -} - -// GetAddedDate returns value of AddedDate field. -func (c *ChatPhoto) GetAddedDate() (value int32) { - if c == nil { - return - } - return c.AddedDate -} - -// GetMinithumbnail returns value of Minithumbnail field. -func (c *ChatPhoto) GetMinithumbnail() (value Minithumbnail) { - if c == nil { - return - } - return c.Minithumbnail -} - -// GetSizes returns value of Sizes field. -func (c *ChatPhoto) GetSizes() (value []PhotoSize) { - if c == nil { - return - } - return c.Sizes -} - -// GetAnimation returns value of Animation field. -func (c *ChatPhoto) GetAnimation() (value AnimatedChatPhoto) { - if c == nil { - return - } - return c.Animation -} - -// GetSmallAnimation returns value of SmallAnimation field. -func (c *ChatPhoto) GetSmallAnimation() (value AnimatedChatPhoto) { - if c == nil { - return - } - return c.SmallAnimation -} - -// GetSticker returns value of Sticker field. -func (c *ChatPhoto) GetSticker() (value ChatPhotoSticker) { - if c == nil { - return - } - return c.Sticker -} diff --git a/tdapi/tl_chat_photo_info_gen.go b/tdapi/tl_chat_photo_info_gen.go deleted file mode 100644 index 904815710..000000000 --- a/tdapi/tl_chat_photo_info_gen.go +++ /dev/null @@ -1,331 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatPhotoInfo represents TL type `chatPhotoInfo#10c2b4a6`. -type ChatPhotoInfo struct { - // A small (160x160) chat photo variant in JPEG format. The file can be downloaded only - // before the photo is changed - Small File - // A big (640x640) chat photo variant in JPEG format. The file can be downloaded only - // before the photo is changed - Big File - // Chat photo minithumbnail; may be null - Minithumbnail Minithumbnail - // True, if the photo has animated variant - HasAnimation bool - // True, if the photo is visible only for the current user - IsPersonal bool -} - -// ChatPhotoInfoTypeID is TL type id of ChatPhotoInfo. -const ChatPhotoInfoTypeID = 0x10c2b4a6 - -// Ensuring interfaces in compile-time for ChatPhotoInfo. -var ( - _ bin.Encoder = &ChatPhotoInfo{} - _ bin.Decoder = &ChatPhotoInfo{} - _ bin.BareEncoder = &ChatPhotoInfo{} - _ bin.BareDecoder = &ChatPhotoInfo{} -) - -func (c *ChatPhotoInfo) Zero() bool { - if c == nil { - return true - } - if !(c.Small.Zero()) { - return false - } - if !(c.Big.Zero()) { - return false - } - if !(c.Minithumbnail.Zero()) { - return false - } - if !(c.HasAnimation == false) { - return false - } - if !(c.IsPersonal == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatPhotoInfo) String() string { - if c == nil { - return "ChatPhotoInfo(nil)" - } - type Alias ChatPhotoInfo - return fmt.Sprintf("ChatPhotoInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatPhotoInfo) TypeID() uint32 { - return ChatPhotoInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatPhotoInfo) TypeName() string { - return "chatPhotoInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatPhotoInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatPhotoInfo", - ID: ChatPhotoInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Small", - SchemaName: "small", - }, - { - Name: "Big", - SchemaName: "big", - }, - { - Name: "Minithumbnail", - SchemaName: "minithumbnail", - }, - { - Name: "HasAnimation", - SchemaName: "has_animation", - }, - { - Name: "IsPersonal", - SchemaName: "is_personal", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatPhotoInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoInfo#10c2b4a6 as nil") - } - b.PutID(ChatPhotoInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatPhotoInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoInfo#10c2b4a6 as nil") - } - if err := c.Small.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatPhotoInfo#10c2b4a6: field small: %w", err) - } - if err := c.Big.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatPhotoInfo#10c2b4a6: field big: %w", err) - } - if err := c.Minithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatPhotoInfo#10c2b4a6: field minithumbnail: %w", err) - } - b.PutBool(c.HasAnimation) - b.PutBool(c.IsPersonal) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatPhotoInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoInfo#10c2b4a6 to nil") - } - if err := b.ConsumeID(ChatPhotoInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatPhotoInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoInfo#10c2b4a6 to nil") - } - { - if err := c.Small.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: field small: %w", err) - } - } - { - if err := c.Big.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: field big: %w", err) - } - } - { - if err := c.Minithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: field minithumbnail: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: field has_animation: %w", err) - } - c.HasAnimation = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: field is_personal: %w", err) - } - c.IsPersonal = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatPhotoInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoInfo#10c2b4a6 as nil") - } - b.ObjStart() - b.PutID("chatPhotoInfo") - b.Comma() - b.FieldStart("small") - if err := c.Small.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPhotoInfo#10c2b4a6: field small: %w", err) - } - b.Comma() - b.FieldStart("big") - if err := c.Big.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPhotoInfo#10c2b4a6: field big: %w", err) - } - b.Comma() - b.FieldStart("minithumbnail") - if err := c.Minithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPhotoInfo#10c2b4a6: field minithumbnail: %w", err) - } - b.Comma() - b.FieldStart("has_animation") - b.PutBool(c.HasAnimation) - b.Comma() - b.FieldStart("is_personal") - b.PutBool(c.IsPersonal) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatPhotoInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoInfo#10c2b4a6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatPhotoInfo"); err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: %w", err) - } - case "small": - if err := c.Small.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: field small: %w", err) - } - case "big": - if err := c.Big.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: field big: %w", err) - } - case "minithumbnail": - if err := c.Minithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: field minithumbnail: %w", err) - } - case "has_animation": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: field has_animation: %w", err) - } - c.HasAnimation = value - case "is_personal": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPhotoInfo#10c2b4a6: field is_personal: %w", err) - } - c.IsPersonal = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSmall returns value of Small field. -func (c *ChatPhotoInfo) GetSmall() (value File) { - if c == nil { - return - } - return c.Small -} - -// GetBig returns value of Big field. -func (c *ChatPhotoInfo) GetBig() (value File) { - if c == nil { - return - } - return c.Big -} - -// GetMinithumbnail returns value of Minithumbnail field. -func (c *ChatPhotoInfo) GetMinithumbnail() (value Minithumbnail) { - if c == nil { - return - } - return c.Minithumbnail -} - -// GetHasAnimation returns value of HasAnimation field. -func (c *ChatPhotoInfo) GetHasAnimation() (value bool) { - if c == nil { - return - } - return c.HasAnimation -} - -// GetIsPersonal returns value of IsPersonal field. -func (c *ChatPhotoInfo) GetIsPersonal() (value bool) { - if c == nil { - return - } - return c.IsPersonal -} diff --git a/tdapi/tl_chat_photo_sticker_gen.go b/tdapi/tl_chat_photo_sticker_gen.go deleted file mode 100644 index 2ef539fba..000000000 --- a/tdapi/tl_chat_photo_sticker_gen.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatPhotoSticker represents TL type `chatPhotoSticker#a90383a3`. -type ChatPhotoSticker struct { - // Type of the sticker - Type ChatPhotoStickerTypeClass - // The fill to be used as background for the sticker; rotation angle in - // backgroundFillGradient isn't supported - BackgroundFill BackgroundFillClass -} - -// ChatPhotoStickerTypeID is TL type id of ChatPhotoSticker. -const ChatPhotoStickerTypeID = 0xa90383a3 - -// Ensuring interfaces in compile-time for ChatPhotoSticker. -var ( - _ bin.Encoder = &ChatPhotoSticker{} - _ bin.Decoder = &ChatPhotoSticker{} - _ bin.BareEncoder = &ChatPhotoSticker{} - _ bin.BareDecoder = &ChatPhotoSticker{} -) - -func (c *ChatPhotoSticker) Zero() bool { - if c == nil { - return true - } - if !(c.Type == nil) { - return false - } - if !(c.BackgroundFill == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatPhotoSticker) String() string { - if c == nil { - return "ChatPhotoSticker(nil)" - } - type Alias ChatPhotoSticker - return fmt.Sprintf("ChatPhotoSticker%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatPhotoSticker) TypeID() uint32 { - return ChatPhotoStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatPhotoSticker) TypeName() string { - return "chatPhotoSticker" -} - -// TypeInfo returns info about TL type. -func (c *ChatPhotoSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatPhotoSticker", - ID: ChatPhotoStickerTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "BackgroundFill", - SchemaName: "background_fill", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatPhotoSticker) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoSticker#a90383a3 as nil") - } - b.PutID(ChatPhotoStickerTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatPhotoSticker) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoSticker#a90383a3 as nil") - } - if c.Type == nil { - return fmt.Errorf("unable to encode chatPhotoSticker#a90383a3: field type is nil") - } - if err := c.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatPhotoSticker#a90383a3: field type: %w", err) - } - if c.BackgroundFill == nil { - return fmt.Errorf("unable to encode chatPhotoSticker#a90383a3: field background_fill is nil") - } - if err := c.BackgroundFill.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatPhotoSticker#a90383a3: field background_fill: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatPhotoSticker) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoSticker#a90383a3 to nil") - } - if err := b.ConsumeID(ChatPhotoStickerTypeID); err != nil { - return fmt.Errorf("unable to decode chatPhotoSticker#a90383a3: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatPhotoSticker) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoSticker#a90383a3 to nil") - } - { - value, err := DecodeChatPhotoStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode chatPhotoSticker#a90383a3: field type: %w", err) - } - c.Type = value - } - { - value, err := DecodeBackgroundFill(b) - if err != nil { - return fmt.Errorf("unable to decode chatPhotoSticker#a90383a3: field background_fill: %w", err) - } - c.BackgroundFill = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatPhotoSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoSticker#a90383a3 as nil") - } - b.ObjStart() - b.PutID("chatPhotoSticker") - b.Comma() - b.FieldStart("type") - if c.Type == nil { - return fmt.Errorf("unable to encode chatPhotoSticker#a90383a3: field type is nil") - } - if err := c.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPhotoSticker#a90383a3: field type: %w", err) - } - b.Comma() - b.FieldStart("background_fill") - if c.BackgroundFill == nil { - return fmt.Errorf("unable to encode chatPhotoSticker#a90383a3: field background_fill is nil") - } - if err := c.BackgroundFill.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPhotoSticker#a90383a3: field background_fill: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatPhotoSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoSticker#a90383a3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatPhotoSticker"); err != nil { - return fmt.Errorf("unable to decode chatPhotoSticker#a90383a3: %w", err) - } - case "type": - value, err := DecodeTDLibJSONChatPhotoStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode chatPhotoSticker#a90383a3: field type: %w", err) - } - c.Type = value - case "background_fill": - value, err := DecodeTDLibJSONBackgroundFill(b) - if err != nil { - return fmt.Errorf("unable to decode chatPhotoSticker#a90383a3: field background_fill: %w", err) - } - c.BackgroundFill = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (c *ChatPhotoSticker) GetType() (value ChatPhotoStickerTypeClass) { - if c == nil { - return - } - return c.Type -} - -// GetBackgroundFill returns value of BackgroundFill field. -func (c *ChatPhotoSticker) GetBackgroundFill() (value BackgroundFillClass) { - if c == nil { - return - } - return c.BackgroundFill -} diff --git a/tdapi/tl_chat_photo_sticker_type_gen.go b/tdapi/tl_chat_photo_sticker_type_gen.go deleted file mode 100644 index 294f9898b..000000000 --- a/tdapi/tl_chat_photo_sticker_type_gen.go +++ /dev/null @@ -1,535 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatPhotoStickerTypeRegularOrMask represents TL type `chatPhotoStickerTypeRegularOrMask#e741599c`. -type ChatPhotoStickerTypeRegularOrMask struct { - // Sticker set identifier - StickerSetID int64 - // Identifier of the sticker in the set - StickerID int64 -} - -// ChatPhotoStickerTypeRegularOrMaskTypeID is TL type id of ChatPhotoStickerTypeRegularOrMask. -const ChatPhotoStickerTypeRegularOrMaskTypeID = 0xe741599c - -// construct implements constructor of ChatPhotoStickerTypeClass. -func (c ChatPhotoStickerTypeRegularOrMask) construct() ChatPhotoStickerTypeClass { return &c } - -// Ensuring interfaces in compile-time for ChatPhotoStickerTypeRegularOrMask. -var ( - _ bin.Encoder = &ChatPhotoStickerTypeRegularOrMask{} - _ bin.Decoder = &ChatPhotoStickerTypeRegularOrMask{} - _ bin.BareEncoder = &ChatPhotoStickerTypeRegularOrMask{} - _ bin.BareDecoder = &ChatPhotoStickerTypeRegularOrMask{} - - _ ChatPhotoStickerTypeClass = &ChatPhotoStickerTypeRegularOrMask{} -) - -func (c *ChatPhotoStickerTypeRegularOrMask) Zero() bool { - if c == nil { - return true - } - if !(c.StickerSetID == 0) { - return false - } - if !(c.StickerID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatPhotoStickerTypeRegularOrMask) String() string { - if c == nil { - return "ChatPhotoStickerTypeRegularOrMask(nil)" - } - type Alias ChatPhotoStickerTypeRegularOrMask - return fmt.Sprintf("ChatPhotoStickerTypeRegularOrMask%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatPhotoStickerTypeRegularOrMask) TypeID() uint32 { - return ChatPhotoStickerTypeRegularOrMaskTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatPhotoStickerTypeRegularOrMask) TypeName() string { - return "chatPhotoStickerTypeRegularOrMask" -} - -// TypeInfo returns info about TL type. -func (c *ChatPhotoStickerTypeRegularOrMask) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatPhotoStickerTypeRegularOrMask", - ID: ChatPhotoStickerTypeRegularOrMaskTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerSetID", - SchemaName: "sticker_set_id", - }, - { - Name: "StickerID", - SchemaName: "sticker_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatPhotoStickerTypeRegularOrMask) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoStickerTypeRegularOrMask#e741599c as nil") - } - b.PutID(ChatPhotoStickerTypeRegularOrMaskTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatPhotoStickerTypeRegularOrMask) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoStickerTypeRegularOrMask#e741599c as nil") - } - b.PutLong(c.StickerSetID) - b.PutLong(c.StickerID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatPhotoStickerTypeRegularOrMask) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoStickerTypeRegularOrMask#e741599c to nil") - } - if err := b.ConsumeID(ChatPhotoStickerTypeRegularOrMaskTypeID); err != nil { - return fmt.Errorf("unable to decode chatPhotoStickerTypeRegularOrMask#e741599c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatPhotoStickerTypeRegularOrMask) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoStickerTypeRegularOrMask#e741599c to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatPhotoStickerTypeRegularOrMask#e741599c: field sticker_set_id: %w", err) - } - c.StickerSetID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatPhotoStickerTypeRegularOrMask#e741599c: field sticker_id: %w", err) - } - c.StickerID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatPhotoStickerTypeRegularOrMask) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoStickerTypeRegularOrMask#e741599c as nil") - } - b.ObjStart() - b.PutID("chatPhotoStickerTypeRegularOrMask") - b.Comma() - b.FieldStart("sticker_set_id") - b.PutLong(c.StickerSetID) - b.Comma() - b.FieldStart("sticker_id") - b.PutLong(c.StickerID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatPhotoStickerTypeRegularOrMask) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoStickerTypeRegularOrMask#e741599c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatPhotoStickerTypeRegularOrMask"); err != nil { - return fmt.Errorf("unable to decode chatPhotoStickerTypeRegularOrMask#e741599c: %w", err) - } - case "sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatPhotoStickerTypeRegularOrMask#e741599c: field sticker_set_id: %w", err) - } - c.StickerSetID = value - case "sticker_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatPhotoStickerTypeRegularOrMask#e741599c: field sticker_id: %w", err) - } - c.StickerID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerSetID returns value of StickerSetID field. -func (c *ChatPhotoStickerTypeRegularOrMask) GetStickerSetID() (value int64) { - if c == nil { - return - } - return c.StickerSetID -} - -// GetStickerID returns value of StickerID field. -func (c *ChatPhotoStickerTypeRegularOrMask) GetStickerID() (value int64) { - if c == nil { - return - } - return c.StickerID -} - -// ChatPhotoStickerTypeCustomEmoji represents TL type `chatPhotoStickerTypeCustomEmoji#f021bad1`. -type ChatPhotoStickerTypeCustomEmoji struct { - // Identifier of the custom emoji - CustomEmojiID int64 -} - -// ChatPhotoStickerTypeCustomEmojiTypeID is TL type id of ChatPhotoStickerTypeCustomEmoji. -const ChatPhotoStickerTypeCustomEmojiTypeID = 0xf021bad1 - -// construct implements constructor of ChatPhotoStickerTypeClass. -func (c ChatPhotoStickerTypeCustomEmoji) construct() ChatPhotoStickerTypeClass { return &c } - -// Ensuring interfaces in compile-time for ChatPhotoStickerTypeCustomEmoji. -var ( - _ bin.Encoder = &ChatPhotoStickerTypeCustomEmoji{} - _ bin.Decoder = &ChatPhotoStickerTypeCustomEmoji{} - _ bin.BareEncoder = &ChatPhotoStickerTypeCustomEmoji{} - _ bin.BareDecoder = &ChatPhotoStickerTypeCustomEmoji{} - - _ ChatPhotoStickerTypeClass = &ChatPhotoStickerTypeCustomEmoji{} -) - -func (c *ChatPhotoStickerTypeCustomEmoji) Zero() bool { - if c == nil { - return true - } - if !(c.CustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatPhotoStickerTypeCustomEmoji) String() string { - if c == nil { - return "ChatPhotoStickerTypeCustomEmoji(nil)" - } - type Alias ChatPhotoStickerTypeCustomEmoji - return fmt.Sprintf("ChatPhotoStickerTypeCustomEmoji%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatPhotoStickerTypeCustomEmoji) TypeID() uint32 { - return ChatPhotoStickerTypeCustomEmojiTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatPhotoStickerTypeCustomEmoji) TypeName() string { - return "chatPhotoStickerTypeCustomEmoji" -} - -// TypeInfo returns info about TL type. -func (c *ChatPhotoStickerTypeCustomEmoji) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatPhotoStickerTypeCustomEmoji", - ID: ChatPhotoStickerTypeCustomEmojiTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CustomEmojiID", - SchemaName: "custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatPhotoStickerTypeCustomEmoji) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoStickerTypeCustomEmoji#f021bad1 as nil") - } - b.PutID(ChatPhotoStickerTypeCustomEmojiTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatPhotoStickerTypeCustomEmoji) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoStickerTypeCustomEmoji#f021bad1 as nil") - } - b.PutLong(c.CustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatPhotoStickerTypeCustomEmoji) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoStickerTypeCustomEmoji#f021bad1 to nil") - } - if err := b.ConsumeID(ChatPhotoStickerTypeCustomEmojiTypeID); err != nil { - return fmt.Errorf("unable to decode chatPhotoStickerTypeCustomEmoji#f021bad1: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatPhotoStickerTypeCustomEmoji) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoStickerTypeCustomEmoji#f021bad1 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatPhotoStickerTypeCustomEmoji#f021bad1: field custom_emoji_id: %w", err) - } - c.CustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatPhotoStickerTypeCustomEmoji) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotoStickerTypeCustomEmoji#f021bad1 as nil") - } - b.ObjStart() - b.PutID("chatPhotoStickerTypeCustomEmoji") - b.Comma() - b.FieldStart("custom_emoji_id") - b.PutLong(c.CustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatPhotoStickerTypeCustomEmoji) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotoStickerTypeCustomEmoji#f021bad1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatPhotoStickerTypeCustomEmoji"); err != nil { - return fmt.Errorf("unable to decode chatPhotoStickerTypeCustomEmoji#f021bad1: %w", err) - } - case "custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatPhotoStickerTypeCustomEmoji#f021bad1: field custom_emoji_id: %w", err) - } - c.CustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCustomEmojiID returns value of CustomEmojiID field. -func (c *ChatPhotoStickerTypeCustomEmoji) GetCustomEmojiID() (value int64) { - if c == nil { - return - } - return c.CustomEmojiID -} - -// ChatPhotoStickerTypeClassName is schema name of ChatPhotoStickerTypeClass. -const ChatPhotoStickerTypeClassName = "ChatPhotoStickerType" - -// ChatPhotoStickerTypeClass represents ChatPhotoStickerType generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatPhotoStickerType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatPhotoStickerTypeRegularOrMask: // chatPhotoStickerTypeRegularOrMask#e741599c -// case *tdapi.ChatPhotoStickerTypeCustomEmoji: // chatPhotoStickerTypeCustomEmoji#f021bad1 -// default: panic(v) -// } -type ChatPhotoStickerTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatPhotoStickerTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeChatPhotoStickerType implements binary de-serialization for ChatPhotoStickerTypeClass. -func DecodeChatPhotoStickerType(buf *bin.Buffer) (ChatPhotoStickerTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatPhotoStickerTypeRegularOrMaskTypeID: - // Decoding chatPhotoStickerTypeRegularOrMask#e741599c. - v := ChatPhotoStickerTypeRegularOrMask{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatPhotoStickerTypeClass: %w", err) - } - return &v, nil - case ChatPhotoStickerTypeCustomEmojiTypeID: - // Decoding chatPhotoStickerTypeCustomEmoji#f021bad1. - v := ChatPhotoStickerTypeCustomEmoji{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatPhotoStickerTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatPhotoStickerTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatPhotoStickerType implements binary de-serialization for ChatPhotoStickerTypeClass. -func DecodeTDLibJSONChatPhotoStickerType(buf tdjson.Decoder) (ChatPhotoStickerTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatPhotoStickerTypeRegularOrMask": - // Decoding chatPhotoStickerTypeRegularOrMask#e741599c. - v := ChatPhotoStickerTypeRegularOrMask{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatPhotoStickerTypeClass: %w", err) - } - return &v, nil - case "chatPhotoStickerTypeCustomEmoji": - // Decoding chatPhotoStickerTypeCustomEmoji#f021bad1. - v := ChatPhotoStickerTypeCustomEmoji{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatPhotoStickerTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatPhotoStickerTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatPhotoStickerType boxes the ChatPhotoStickerTypeClass providing a helper. -type ChatPhotoStickerTypeBox struct { - ChatPhotoStickerType ChatPhotoStickerTypeClass -} - -// Decode implements bin.Decoder for ChatPhotoStickerTypeBox. -func (b *ChatPhotoStickerTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatPhotoStickerTypeBox to nil") - } - v, err := DecodeChatPhotoStickerType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatPhotoStickerType = v - return nil -} - -// Encode implements bin.Encode for ChatPhotoStickerTypeBox. -func (b *ChatPhotoStickerTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatPhotoStickerType == nil { - return fmt.Errorf("unable to encode ChatPhotoStickerTypeClass as nil") - } - return b.ChatPhotoStickerType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatPhotoStickerTypeBox. -func (b *ChatPhotoStickerTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatPhotoStickerTypeBox to nil") - } - v, err := DecodeTDLibJSONChatPhotoStickerType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatPhotoStickerType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatPhotoStickerTypeBox. -func (b *ChatPhotoStickerTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatPhotoStickerType == nil { - return fmt.Errorf("unable to encode ChatPhotoStickerTypeClass as nil") - } - return b.ChatPhotoStickerType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_photos_gen.go b/tdapi/tl_chat_photos_gen.go deleted file mode 100644 index e1418a7d6..000000000 --- a/tdapi/tl_chat_photos_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatPhotos represents TL type `chatPhotos#89ec34e8`. -type ChatPhotos struct { - // Total number of photos - TotalCount int32 - // List of photos - Photos []ChatPhoto -} - -// ChatPhotosTypeID is TL type id of ChatPhotos. -const ChatPhotosTypeID = 0x89ec34e8 - -// Ensuring interfaces in compile-time for ChatPhotos. -var ( - _ bin.Encoder = &ChatPhotos{} - _ bin.Decoder = &ChatPhotos{} - _ bin.BareEncoder = &ChatPhotos{} - _ bin.BareDecoder = &ChatPhotos{} -) - -func (c *ChatPhotos) Zero() bool { - if c == nil { - return true - } - if !(c.TotalCount == 0) { - return false - } - if !(c.Photos == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatPhotos) String() string { - if c == nil { - return "ChatPhotos(nil)" - } - type Alias ChatPhotos - return fmt.Sprintf("ChatPhotos%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatPhotos) TypeID() uint32 { - return ChatPhotosTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatPhotos) TypeName() string { - return "chatPhotos" -} - -// TypeInfo returns info about TL type. -func (c *ChatPhotos) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatPhotos", - ID: ChatPhotosTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Photos", - SchemaName: "photos", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatPhotos) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotos#89ec34e8 as nil") - } - b.PutID(ChatPhotosTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatPhotos) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotos#89ec34e8 as nil") - } - b.PutInt32(c.TotalCount) - b.PutInt(len(c.Photos)) - for idx, v := range c.Photos { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatPhotos#89ec34e8: field photos element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatPhotos) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotos#89ec34e8 to nil") - } - if err := b.ConsumeID(ChatPhotosTypeID); err != nil { - return fmt.Errorf("unable to decode chatPhotos#89ec34e8: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatPhotos) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotos#89ec34e8 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatPhotos#89ec34e8: field total_count: %w", err) - } - c.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatPhotos#89ec34e8: field photos: %w", err) - } - - if headerLen > 0 { - c.Photos = make([]ChatPhoto, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatPhoto - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatPhotos#89ec34e8: field photos: %w", err) - } - c.Photos = append(c.Photos, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatPhotos) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatPhotos#89ec34e8 as nil") - } - b.ObjStart() - b.PutID("chatPhotos") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(c.TotalCount) - b.Comma() - b.FieldStart("photos") - b.ArrStart() - for idx, v := range c.Photos { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPhotos#89ec34e8: field photos element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatPhotos) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatPhotos#89ec34e8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatPhotos"); err != nil { - return fmt.Errorf("unable to decode chatPhotos#89ec34e8: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatPhotos#89ec34e8: field total_count: %w", err) - } - c.TotalCount = value - case "photos": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatPhoto - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatPhotos#89ec34e8: field photos: %w", err) - } - c.Photos = append(c.Photos, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatPhotos#89ec34e8: field photos: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (c *ChatPhotos) GetTotalCount() (value int32) { - if c == nil { - return - } - return c.TotalCount -} - -// GetPhotos returns value of Photos field. -func (c *ChatPhotos) GetPhotos() (value []ChatPhoto) { - if c == nil { - return - } - return c.Photos -} diff --git a/tdapi/tl_chat_position_gen.go b/tdapi/tl_chat_position_gen.go deleted file mode 100644 index 16e1418b6..000000000 --- a/tdapi/tl_chat_position_gen.go +++ /dev/null @@ -1,316 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatPosition represents TL type `chatPosition#dae48755`. -type ChatPosition struct { - // The chat list - List ChatListClass - // A parameter used to determine order of the chat in the chat list. Chats must be sorted - // by the pair (order, chat.id) in descending order - Order int64 - // True, if the chat is pinned in the chat list - IsPinned bool - // Source of the chat in the chat list; may be null - Source ChatSourceClass -} - -// ChatPositionTypeID is TL type id of ChatPosition. -const ChatPositionTypeID = 0xdae48755 - -// Ensuring interfaces in compile-time for ChatPosition. -var ( - _ bin.Encoder = &ChatPosition{} - _ bin.Decoder = &ChatPosition{} - _ bin.BareEncoder = &ChatPosition{} - _ bin.BareDecoder = &ChatPosition{} -) - -func (c *ChatPosition) Zero() bool { - if c == nil { - return true - } - if !(c.List == nil) { - return false - } - if !(c.Order == 0) { - return false - } - if !(c.IsPinned == false) { - return false - } - if !(c.Source == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatPosition) String() string { - if c == nil { - return "ChatPosition(nil)" - } - type Alias ChatPosition - return fmt.Sprintf("ChatPosition%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatPosition) TypeID() uint32 { - return ChatPositionTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatPosition) TypeName() string { - return "chatPosition" -} - -// TypeInfo returns info about TL type. -func (c *ChatPosition) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatPosition", - ID: ChatPositionTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "List", - SchemaName: "list", - }, - { - Name: "Order", - SchemaName: "order", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - { - Name: "Source", - SchemaName: "source", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatPosition) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPosition#dae48755 as nil") - } - b.PutID(ChatPositionTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatPosition) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatPosition#dae48755 as nil") - } - if c.List == nil { - return fmt.Errorf("unable to encode chatPosition#dae48755: field list is nil") - } - if err := c.List.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatPosition#dae48755: field list: %w", err) - } - b.PutLong(c.Order) - b.PutBool(c.IsPinned) - if c.Source == nil { - return fmt.Errorf("unable to encode chatPosition#dae48755: field source is nil") - } - if err := c.Source.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatPosition#dae48755: field source: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatPosition) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPosition#dae48755 to nil") - } - if err := b.ConsumeID(ChatPositionTypeID); err != nil { - return fmt.Errorf("unable to decode chatPosition#dae48755: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatPosition) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatPosition#dae48755 to nil") - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode chatPosition#dae48755: field list: %w", err) - } - c.List = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatPosition#dae48755: field order: %w", err) - } - c.Order = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPosition#dae48755: field is_pinned: %w", err) - } - c.IsPinned = value - } - { - value, err := DecodeChatSource(b) - if err != nil { - return fmt.Errorf("unable to decode chatPosition#dae48755: field source: %w", err) - } - c.Source = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatPosition) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatPosition#dae48755 as nil") - } - b.ObjStart() - b.PutID("chatPosition") - b.Comma() - b.FieldStart("list") - if c.List == nil { - return fmt.Errorf("unable to encode chatPosition#dae48755: field list is nil") - } - if err := c.List.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPosition#dae48755: field list: %w", err) - } - b.Comma() - b.FieldStart("order") - b.PutLong(c.Order) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(c.IsPinned) - b.Comma() - b.FieldStart("source") - if c.Source == nil { - return fmt.Errorf("unable to encode chatPosition#dae48755: field source is nil") - } - if err := c.Source.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatPosition#dae48755: field source: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatPosition) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatPosition#dae48755 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatPosition"); err != nil { - return fmt.Errorf("unable to decode chatPosition#dae48755: %w", err) - } - case "list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode chatPosition#dae48755: field list: %w", err) - } - c.List = value - case "order": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatPosition#dae48755: field order: %w", err) - } - c.Order = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatPosition#dae48755: field is_pinned: %w", err) - } - c.IsPinned = value - case "source": - value, err := DecodeTDLibJSONChatSource(b) - if err != nil { - return fmt.Errorf("unable to decode chatPosition#dae48755: field source: %w", err) - } - c.Source = value - default: - return b.Skip() - } - return nil - }) -} - -// GetList returns value of List field. -func (c *ChatPosition) GetList() (value ChatListClass) { - if c == nil { - return - } - return c.List -} - -// GetOrder returns value of Order field. -func (c *ChatPosition) GetOrder() (value int64) { - if c == nil { - return - } - return c.Order -} - -// GetIsPinned returns value of IsPinned field. -func (c *ChatPosition) GetIsPinned() (value bool) { - if c == nil { - return - } - return c.IsPinned -} - -// GetSource returns value of Source field. -func (c *ChatPosition) GetSource() (value ChatSourceClass) { - if c == nil { - return - } - return c.Source -} diff --git a/tdapi/tl_chat_revenue_amount_gen.go b/tdapi/tl_chat_revenue_amount_gen.go deleted file mode 100644 index ea91f9296..000000000 --- a/tdapi/tl_chat_revenue_amount_gen.go +++ /dev/null @@ -1,331 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatRevenueAmount represents TL type `chatRevenueAmount#a648ce58`. -type ChatRevenueAmount struct { - // Cryptocurrency in which revenue is calculated - Cryptocurrency string - // Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency - TotalAmount int64 - // Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the - // cryptocurrency - BalanceAmount int64 - // Amount of the cryptocurrency available for withdrawal, in the smallest units of the - // cryptocurrency - AvailableAmount int64 - // True, if Telegram Stars can be withdrawn now or later - WithdrawalEnabled bool -} - -// ChatRevenueAmountTypeID is TL type id of ChatRevenueAmount. -const ChatRevenueAmountTypeID = 0xa648ce58 - -// Ensuring interfaces in compile-time for ChatRevenueAmount. -var ( - _ bin.Encoder = &ChatRevenueAmount{} - _ bin.Decoder = &ChatRevenueAmount{} - _ bin.BareEncoder = &ChatRevenueAmount{} - _ bin.BareDecoder = &ChatRevenueAmount{} -) - -func (c *ChatRevenueAmount) Zero() bool { - if c == nil { - return true - } - if !(c.Cryptocurrency == "") { - return false - } - if !(c.TotalAmount == 0) { - return false - } - if !(c.BalanceAmount == 0) { - return false - } - if !(c.AvailableAmount == 0) { - return false - } - if !(c.WithdrawalEnabled == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatRevenueAmount) String() string { - if c == nil { - return "ChatRevenueAmount(nil)" - } - type Alias ChatRevenueAmount - return fmt.Sprintf("ChatRevenueAmount%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatRevenueAmount) TypeID() uint32 { - return ChatRevenueAmountTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatRevenueAmount) TypeName() string { - return "chatRevenueAmount" -} - -// TypeInfo returns info about TL type. -func (c *ChatRevenueAmount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatRevenueAmount", - ID: ChatRevenueAmountTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Cryptocurrency", - SchemaName: "cryptocurrency", - }, - { - Name: "TotalAmount", - SchemaName: "total_amount", - }, - { - Name: "BalanceAmount", - SchemaName: "balance_amount", - }, - { - Name: "AvailableAmount", - SchemaName: "available_amount", - }, - { - Name: "WithdrawalEnabled", - SchemaName: "withdrawal_enabled", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatRevenueAmount) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueAmount#a648ce58 as nil") - } - b.PutID(ChatRevenueAmountTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatRevenueAmount) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueAmount#a648ce58 as nil") - } - b.PutString(c.Cryptocurrency) - b.PutLong(c.TotalAmount) - b.PutLong(c.BalanceAmount) - b.PutLong(c.AvailableAmount) - b.PutBool(c.WithdrawalEnabled) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatRevenueAmount) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueAmount#a648ce58 to nil") - } - if err := b.ConsumeID(ChatRevenueAmountTypeID); err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatRevenueAmount) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueAmount#a648ce58 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field cryptocurrency: %w", err) - } - c.Cryptocurrency = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field total_amount: %w", err) - } - c.TotalAmount = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field balance_amount: %w", err) - } - c.BalanceAmount = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field available_amount: %w", err) - } - c.AvailableAmount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field withdrawal_enabled: %w", err) - } - c.WithdrawalEnabled = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatRevenueAmount) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueAmount#a648ce58 as nil") - } - b.ObjStart() - b.PutID("chatRevenueAmount") - b.Comma() - b.FieldStart("cryptocurrency") - b.PutString(c.Cryptocurrency) - b.Comma() - b.FieldStart("total_amount") - b.PutLong(c.TotalAmount) - b.Comma() - b.FieldStart("balance_amount") - b.PutLong(c.BalanceAmount) - b.Comma() - b.FieldStart("available_amount") - b.PutLong(c.AvailableAmount) - b.Comma() - b.FieldStart("withdrawal_enabled") - b.PutBool(c.WithdrawalEnabled) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatRevenueAmount) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueAmount#a648ce58 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatRevenueAmount"); err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: %w", err) - } - case "cryptocurrency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field cryptocurrency: %w", err) - } - c.Cryptocurrency = value - case "total_amount": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field total_amount: %w", err) - } - c.TotalAmount = value - case "balance_amount": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field balance_amount: %w", err) - } - c.BalanceAmount = value - case "available_amount": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field available_amount: %w", err) - } - c.AvailableAmount = value - case "withdrawal_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueAmount#a648ce58: field withdrawal_enabled: %w", err) - } - c.WithdrawalEnabled = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCryptocurrency returns value of Cryptocurrency field. -func (c *ChatRevenueAmount) GetCryptocurrency() (value string) { - if c == nil { - return - } - return c.Cryptocurrency -} - -// GetTotalAmount returns value of TotalAmount field. -func (c *ChatRevenueAmount) GetTotalAmount() (value int64) { - if c == nil { - return - } - return c.TotalAmount -} - -// GetBalanceAmount returns value of BalanceAmount field. -func (c *ChatRevenueAmount) GetBalanceAmount() (value int64) { - if c == nil { - return - } - return c.BalanceAmount -} - -// GetAvailableAmount returns value of AvailableAmount field. -func (c *ChatRevenueAmount) GetAvailableAmount() (value int64) { - if c == nil { - return - } - return c.AvailableAmount -} - -// GetWithdrawalEnabled returns value of WithdrawalEnabled field. -func (c *ChatRevenueAmount) GetWithdrawalEnabled() (value bool) { - if c == nil { - return - } - return c.WithdrawalEnabled -} diff --git a/tdapi/tl_chat_revenue_statistics_gen.go b/tdapi/tl_chat_revenue_statistics_gen.go deleted file mode 100644 index c49480301..000000000 --- a/tdapi/tl_chat_revenue_statistics_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatRevenueStatistics represents TL type `chatRevenueStatistics#636318bb`. -type ChatRevenueStatistics struct { - // A graph containing amount of revenue in a given hour - RevenueByHourGraph StatisticalGraphClass - // A graph containing amount of revenue - RevenueGraph StatisticalGraphClass - // Amount of earned revenue - RevenueAmount ChatRevenueAmount - // Current conversion rate of the cryptocurrency in which revenue is calculated to USD - UsdRate float64 -} - -// ChatRevenueStatisticsTypeID is TL type id of ChatRevenueStatistics. -const ChatRevenueStatisticsTypeID = 0x636318bb - -// Ensuring interfaces in compile-time for ChatRevenueStatistics. -var ( - _ bin.Encoder = &ChatRevenueStatistics{} - _ bin.Decoder = &ChatRevenueStatistics{} - _ bin.BareEncoder = &ChatRevenueStatistics{} - _ bin.BareDecoder = &ChatRevenueStatistics{} -) - -func (c *ChatRevenueStatistics) Zero() bool { - if c == nil { - return true - } - if !(c.RevenueByHourGraph == nil) { - return false - } - if !(c.RevenueGraph == nil) { - return false - } - if !(c.RevenueAmount.Zero()) { - return false - } - if !(c.UsdRate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatRevenueStatistics) String() string { - if c == nil { - return "ChatRevenueStatistics(nil)" - } - type Alias ChatRevenueStatistics - return fmt.Sprintf("ChatRevenueStatistics%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatRevenueStatistics) TypeID() uint32 { - return ChatRevenueStatisticsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatRevenueStatistics) TypeName() string { - return "chatRevenueStatistics" -} - -// TypeInfo returns info about TL type. -func (c *ChatRevenueStatistics) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatRevenueStatistics", - ID: ChatRevenueStatisticsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RevenueByHourGraph", - SchemaName: "revenue_by_hour_graph", - }, - { - Name: "RevenueGraph", - SchemaName: "revenue_graph", - }, - { - Name: "RevenueAmount", - SchemaName: "revenue_amount", - }, - { - Name: "UsdRate", - SchemaName: "usd_rate", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatRevenueStatistics) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueStatistics#636318bb as nil") - } - b.PutID(ChatRevenueStatisticsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatRevenueStatistics) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueStatistics#636318bb as nil") - } - if c.RevenueByHourGraph == nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_by_hour_graph is nil") - } - if err := c.RevenueByHourGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_by_hour_graph: %w", err) - } - if c.RevenueGraph == nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_graph is nil") - } - if err := c.RevenueGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_graph: %w", err) - } - if err := c.RevenueAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_amount: %w", err) - } - b.PutDouble(c.UsdRate) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatRevenueStatistics) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueStatistics#636318bb to nil") - } - if err := b.ConsumeID(ChatRevenueStatisticsTypeID); err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatRevenueStatistics) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueStatistics#636318bb to nil") - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_by_hour_graph: %w", err) - } - c.RevenueByHourGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_graph: %w", err) - } - c.RevenueGraph = value - } - { - if err := c.RevenueAmount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_amount: %w", err) - } - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field usd_rate: %w", err) - } - c.UsdRate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatRevenueStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueStatistics#636318bb as nil") - } - b.ObjStart() - b.PutID("chatRevenueStatistics") - b.Comma() - b.FieldStart("revenue_by_hour_graph") - if c.RevenueByHourGraph == nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_by_hour_graph is nil") - } - if err := c.RevenueByHourGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_by_hour_graph: %w", err) - } - b.Comma() - b.FieldStart("revenue_graph") - if c.RevenueGraph == nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_graph is nil") - } - if err := c.RevenueGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_graph: %w", err) - } - b.Comma() - b.FieldStart("revenue_amount") - if err := c.RevenueAmount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueStatistics#636318bb: field revenue_amount: %w", err) - } - b.Comma() - b.FieldStart("usd_rate") - b.PutDouble(c.UsdRate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatRevenueStatistics) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueStatistics#636318bb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatRevenueStatistics"); err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: %w", err) - } - case "revenue_by_hour_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_by_hour_graph: %w", err) - } - c.RevenueByHourGraph = value - case "revenue_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_graph: %w", err) - } - c.RevenueGraph = value - case "revenue_amount": - if err := c.RevenueAmount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field revenue_amount: %w", err) - } - case "usd_rate": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueStatistics#636318bb: field usd_rate: %w", err) - } - c.UsdRate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRevenueByHourGraph returns value of RevenueByHourGraph field. -func (c *ChatRevenueStatistics) GetRevenueByHourGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.RevenueByHourGraph -} - -// GetRevenueGraph returns value of RevenueGraph field. -func (c *ChatRevenueStatistics) GetRevenueGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.RevenueGraph -} - -// GetRevenueAmount returns value of RevenueAmount field. -func (c *ChatRevenueStatistics) GetRevenueAmount() (value ChatRevenueAmount) { - if c == nil { - return - } - return c.RevenueAmount -} - -// GetUsdRate returns value of UsdRate field. -func (c *ChatRevenueStatistics) GetUsdRate() (value float64) { - if c == nil { - return - } - return c.UsdRate -} diff --git a/tdapi/tl_chat_revenue_transaction_gen.go b/tdapi/tl_chat_revenue_transaction_gen.go deleted file mode 100644 index 0da9c3b30..000000000 --- a/tdapi/tl_chat_revenue_transaction_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatRevenueTransaction represents TL type `chatRevenueTransaction#4c7a4ff`. -type ChatRevenueTransaction struct { - // Cryptocurrency in which revenue is calculated - Cryptocurrency string - // The withdrawn amount, in the smallest units of the cryptocurrency - CryptocurrencyAmount int64 - // Type of the transaction - Type ChatRevenueTransactionTypeClass -} - -// ChatRevenueTransactionTypeID is TL type id of ChatRevenueTransaction. -const ChatRevenueTransactionTypeID = 0x4c7a4ff - -// Ensuring interfaces in compile-time for ChatRevenueTransaction. -var ( - _ bin.Encoder = &ChatRevenueTransaction{} - _ bin.Decoder = &ChatRevenueTransaction{} - _ bin.BareEncoder = &ChatRevenueTransaction{} - _ bin.BareDecoder = &ChatRevenueTransaction{} -) - -func (c *ChatRevenueTransaction) Zero() bool { - if c == nil { - return true - } - if !(c.Cryptocurrency == "") { - return false - } - if !(c.CryptocurrencyAmount == 0) { - return false - } - if !(c.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatRevenueTransaction) String() string { - if c == nil { - return "ChatRevenueTransaction(nil)" - } - type Alias ChatRevenueTransaction - return fmt.Sprintf("ChatRevenueTransaction%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatRevenueTransaction) TypeID() uint32 { - return ChatRevenueTransactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatRevenueTransaction) TypeName() string { - return "chatRevenueTransaction" -} - -// TypeInfo returns info about TL type. -func (c *ChatRevenueTransaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatRevenueTransaction", - ID: ChatRevenueTransactionTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Cryptocurrency", - SchemaName: "cryptocurrency", - }, - { - Name: "CryptocurrencyAmount", - SchemaName: "cryptocurrency_amount", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatRevenueTransaction) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransaction#4c7a4ff as nil") - } - b.PutID(ChatRevenueTransactionTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatRevenueTransaction) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransaction#4c7a4ff as nil") - } - b.PutString(c.Cryptocurrency) - b.PutLong(c.CryptocurrencyAmount) - if c.Type == nil { - return fmt.Errorf("unable to encode chatRevenueTransaction#4c7a4ff: field type is nil") - } - if err := c.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueTransaction#4c7a4ff: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatRevenueTransaction) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransaction#4c7a4ff to nil") - } - if err := b.ConsumeID(ChatRevenueTransactionTypeID); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransaction#4c7a4ff: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatRevenueTransaction) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransaction#4c7a4ff to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransaction#4c7a4ff: field cryptocurrency: %w", err) - } - c.Cryptocurrency = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransaction#4c7a4ff: field cryptocurrency_amount: %w", err) - } - c.CryptocurrencyAmount = value - } - { - value, err := DecodeChatRevenueTransactionType(b) - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransaction#4c7a4ff: field type: %w", err) - } - c.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatRevenueTransaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransaction#4c7a4ff as nil") - } - b.ObjStart() - b.PutID("chatRevenueTransaction") - b.Comma() - b.FieldStart("cryptocurrency") - b.PutString(c.Cryptocurrency) - b.Comma() - b.FieldStart("cryptocurrency_amount") - b.PutLong(c.CryptocurrencyAmount) - b.Comma() - b.FieldStart("type") - if c.Type == nil { - return fmt.Errorf("unable to encode chatRevenueTransaction#4c7a4ff: field type is nil") - } - if err := c.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueTransaction#4c7a4ff: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatRevenueTransaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransaction#4c7a4ff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatRevenueTransaction"); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransaction#4c7a4ff: %w", err) - } - case "cryptocurrency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransaction#4c7a4ff: field cryptocurrency: %w", err) - } - c.Cryptocurrency = value - case "cryptocurrency_amount": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransaction#4c7a4ff: field cryptocurrency_amount: %w", err) - } - c.CryptocurrencyAmount = value - case "type": - value, err := DecodeTDLibJSONChatRevenueTransactionType(b) - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransaction#4c7a4ff: field type: %w", err) - } - c.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCryptocurrency returns value of Cryptocurrency field. -func (c *ChatRevenueTransaction) GetCryptocurrency() (value string) { - if c == nil { - return - } - return c.Cryptocurrency -} - -// GetCryptocurrencyAmount returns value of CryptocurrencyAmount field. -func (c *ChatRevenueTransaction) GetCryptocurrencyAmount() (value int64) { - if c == nil { - return - } - return c.CryptocurrencyAmount -} - -// GetType returns value of Type field. -func (c *ChatRevenueTransaction) GetType() (value ChatRevenueTransactionTypeClass) { - if c == nil { - return - } - return c.Type -} diff --git a/tdapi/tl_chat_revenue_transaction_type_gen.go b/tdapi/tl_chat_revenue_transaction_type_gen.go deleted file mode 100644 index f7b3277b7..000000000 --- a/tdapi/tl_chat_revenue_transaction_type_gen.go +++ /dev/null @@ -1,828 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatRevenueTransactionTypeEarnings represents TL type `chatRevenueTransactionTypeEarnings#e81ca488`. -type ChatRevenueTransactionTypeEarnings struct { - // Point in time (Unix timestamp) when the earnings started - StartDate int32 - // Point in time (Unix timestamp) when the earnings ended - EndDate int32 -} - -// ChatRevenueTransactionTypeEarningsTypeID is TL type id of ChatRevenueTransactionTypeEarnings. -const ChatRevenueTransactionTypeEarningsTypeID = 0xe81ca488 - -// construct implements constructor of ChatRevenueTransactionTypeClass. -func (c ChatRevenueTransactionTypeEarnings) construct() ChatRevenueTransactionTypeClass { return &c } - -// Ensuring interfaces in compile-time for ChatRevenueTransactionTypeEarnings. -var ( - _ bin.Encoder = &ChatRevenueTransactionTypeEarnings{} - _ bin.Decoder = &ChatRevenueTransactionTypeEarnings{} - _ bin.BareEncoder = &ChatRevenueTransactionTypeEarnings{} - _ bin.BareDecoder = &ChatRevenueTransactionTypeEarnings{} - - _ ChatRevenueTransactionTypeClass = &ChatRevenueTransactionTypeEarnings{} -) - -func (c *ChatRevenueTransactionTypeEarnings) Zero() bool { - if c == nil { - return true - } - if !(c.StartDate == 0) { - return false - } - if !(c.EndDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatRevenueTransactionTypeEarnings) String() string { - if c == nil { - return "ChatRevenueTransactionTypeEarnings(nil)" - } - type Alias ChatRevenueTransactionTypeEarnings - return fmt.Sprintf("ChatRevenueTransactionTypeEarnings%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatRevenueTransactionTypeEarnings) TypeID() uint32 { - return ChatRevenueTransactionTypeEarningsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatRevenueTransactionTypeEarnings) TypeName() string { - return "chatRevenueTransactionTypeEarnings" -} - -// TypeInfo returns info about TL type. -func (c *ChatRevenueTransactionTypeEarnings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatRevenueTransactionTypeEarnings", - ID: ChatRevenueTransactionTypeEarningsTypeID, - } - if c == 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 (c *ChatRevenueTransactionTypeEarnings) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactionTypeEarnings#e81ca488 as nil") - } - b.PutID(ChatRevenueTransactionTypeEarningsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatRevenueTransactionTypeEarnings) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactionTypeEarnings#e81ca488 as nil") - } - b.PutInt32(c.StartDate) - b.PutInt32(c.EndDate) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatRevenueTransactionTypeEarnings) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactionTypeEarnings#e81ca488 to nil") - } - if err := b.ConsumeID(ChatRevenueTransactionTypeEarningsTypeID); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeEarnings#e81ca488: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatRevenueTransactionTypeEarnings) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactionTypeEarnings#e81ca488 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeEarnings#e81ca488: field start_date: %w", err) - } - c.StartDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeEarnings#e81ca488: field end_date: %w", err) - } - c.EndDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatRevenueTransactionTypeEarnings) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactionTypeEarnings#e81ca488 as nil") - } - b.ObjStart() - b.PutID("chatRevenueTransactionTypeEarnings") - b.Comma() - b.FieldStart("start_date") - b.PutInt32(c.StartDate) - b.Comma() - b.FieldStart("end_date") - b.PutInt32(c.EndDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatRevenueTransactionTypeEarnings) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactionTypeEarnings#e81ca488 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatRevenueTransactionTypeEarnings"); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeEarnings#e81ca488: %w", err) - } - case "start_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeEarnings#e81ca488: field start_date: %w", err) - } - c.StartDate = value - case "end_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeEarnings#e81ca488: field end_date: %w", err) - } - c.EndDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStartDate returns value of StartDate field. -func (c *ChatRevenueTransactionTypeEarnings) GetStartDate() (value int32) { - if c == nil { - return - } - return c.StartDate -} - -// GetEndDate returns value of EndDate field. -func (c *ChatRevenueTransactionTypeEarnings) GetEndDate() (value int32) { - if c == nil { - return - } - return c.EndDate -} - -// ChatRevenueTransactionTypeWithdrawal represents TL type `chatRevenueTransactionTypeWithdrawal#f138deb`. -type ChatRevenueTransactionTypeWithdrawal struct { - // Point in time (Unix timestamp) when the earnings withdrawal started - WithdrawalDate int32 - // Name of the payment provider - Provider string - // State of the withdrawal - State RevenueWithdrawalStateClass -} - -// ChatRevenueTransactionTypeWithdrawalTypeID is TL type id of ChatRevenueTransactionTypeWithdrawal. -const ChatRevenueTransactionTypeWithdrawalTypeID = 0xf138deb - -// construct implements constructor of ChatRevenueTransactionTypeClass. -func (c ChatRevenueTransactionTypeWithdrawal) construct() ChatRevenueTransactionTypeClass { return &c } - -// Ensuring interfaces in compile-time for ChatRevenueTransactionTypeWithdrawal. -var ( - _ bin.Encoder = &ChatRevenueTransactionTypeWithdrawal{} - _ bin.Decoder = &ChatRevenueTransactionTypeWithdrawal{} - _ bin.BareEncoder = &ChatRevenueTransactionTypeWithdrawal{} - _ bin.BareDecoder = &ChatRevenueTransactionTypeWithdrawal{} - - _ ChatRevenueTransactionTypeClass = &ChatRevenueTransactionTypeWithdrawal{} -) - -func (c *ChatRevenueTransactionTypeWithdrawal) Zero() bool { - if c == nil { - return true - } - if !(c.WithdrawalDate == 0) { - return false - } - if !(c.Provider == "") { - return false - } - if !(c.State == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatRevenueTransactionTypeWithdrawal) String() string { - if c == nil { - return "ChatRevenueTransactionTypeWithdrawal(nil)" - } - type Alias ChatRevenueTransactionTypeWithdrawal - return fmt.Sprintf("ChatRevenueTransactionTypeWithdrawal%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatRevenueTransactionTypeWithdrawal) TypeID() uint32 { - return ChatRevenueTransactionTypeWithdrawalTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatRevenueTransactionTypeWithdrawal) TypeName() string { - return "chatRevenueTransactionTypeWithdrawal" -} - -// TypeInfo returns info about TL type. -func (c *ChatRevenueTransactionTypeWithdrawal) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatRevenueTransactionTypeWithdrawal", - ID: ChatRevenueTransactionTypeWithdrawalTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WithdrawalDate", - SchemaName: "withdrawal_date", - }, - { - Name: "Provider", - SchemaName: "provider", - }, - { - Name: "State", - SchemaName: "state", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatRevenueTransactionTypeWithdrawal) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactionTypeWithdrawal#f138deb as nil") - } - b.PutID(ChatRevenueTransactionTypeWithdrawalTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatRevenueTransactionTypeWithdrawal) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactionTypeWithdrawal#f138deb as nil") - } - b.PutInt32(c.WithdrawalDate) - b.PutString(c.Provider) - if c.State == nil { - return fmt.Errorf("unable to encode chatRevenueTransactionTypeWithdrawal#f138deb: field state is nil") - } - if err := c.State.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueTransactionTypeWithdrawal#f138deb: field state: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatRevenueTransactionTypeWithdrawal) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactionTypeWithdrawal#f138deb to nil") - } - if err := b.ConsumeID(ChatRevenueTransactionTypeWithdrawalTypeID); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeWithdrawal#f138deb: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatRevenueTransactionTypeWithdrawal) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactionTypeWithdrawal#f138deb to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeWithdrawal#f138deb: field withdrawal_date: %w", err) - } - c.WithdrawalDate = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeWithdrawal#f138deb: field provider: %w", err) - } - c.Provider = value - } - { - value, err := DecodeRevenueWithdrawalState(b) - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeWithdrawal#f138deb: field state: %w", err) - } - c.State = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatRevenueTransactionTypeWithdrawal) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactionTypeWithdrawal#f138deb as nil") - } - b.ObjStart() - b.PutID("chatRevenueTransactionTypeWithdrawal") - b.Comma() - b.FieldStart("withdrawal_date") - b.PutInt32(c.WithdrawalDate) - b.Comma() - b.FieldStart("provider") - b.PutString(c.Provider) - b.Comma() - b.FieldStart("state") - if c.State == nil { - return fmt.Errorf("unable to encode chatRevenueTransactionTypeWithdrawal#f138deb: field state is nil") - } - if err := c.State.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueTransactionTypeWithdrawal#f138deb: field state: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatRevenueTransactionTypeWithdrawal) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactionTypeWithdrawal#f138deb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatRevenueTransactionTypeWithdrawal"); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeWithdrawal#f138deb: %w", err) - } - case "withdrawal_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeWithdrawal#f138deb: field withdrawal_date: %w", err) - } - c.WithdrawalDate = value - case "provider": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeWithdrawal#f138deb: field provider: %w", err) - } - c.Provider = value - case "state": - value, err := DecodeTDLibJSONRevenueWithdrawalState(b) - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeWithdrawal#f138deb: field state: %w", err) - } - c.State = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWithdrawalDate returns value of WithdrawalDate field. -func (c *ChatRevenueTransactionTypeWithdrawal) GetWithdrawalDate() (value int32) { - if c == nil { - return - } - return c.WithdrawalDate -} - -// GetProvider returns value of Provider field. -func (c *ChatRevenueTransactionTypeWithdrawal) GetProvider() (value string) { - if c == nil { - return - } - return c.Provider -} - -// GetState returns value of State field. -func (c *ChatRevenueTransactionTypeWithdrawal) GetState() (value RevenueWithdrawalStateClass) { - if c == nil { - return - } - return c.State -} - -// ChatRevenueTransactionTypeRefund represents TL type `chatRevenueTransactionTypeRefund#1206b847`. -type ChatRevenueTransactionTypeRefund struct { - // Point in time (Unix timestamp) when the transaction was refunded - RefundDate int32 - // Name of the payment provider - Provider string -} - -// ChatRevenueTransactionTypeRefundTypeID is TL type id of ChatRevenueTransactionTypeRefund. -const ChatRevenueTransactionTypeRefundTypeID = 0x1206b847 - -// construct implements constructor of ChatRevenueTransactionTypeClass. -func (c ChatRevenueTransactionTypeRefund) construct() ChatRevenueTransactionTypeClass { return &c } - -// Ensuring interfaces in compile-time for ChatRevenueTransactionTypeRefund. -var ( - _ bin.Encoder = &ChatRevenueTransactionTypeRefund{} - _ bin.Decoder = &ChatRevenueTransactionTypeRefund{} - _ bin.BareEncoder = &ChatRevenueTransactionTypeRefund{} - _ bin.BareDecoder = &ChatRevenueTransactionTypeRefund{} - - _ ChatRevenueTransactionTypeClass = &ChatRevenueTransactionTypeRefund{} -) - -func (c *ChatRevenueTransactionTypeRefund) Zero() bool { - if c == nil { - return true - } - if !(c.RefundDate == 0) { - return false - } - if !(c.Provider == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatRevenueTransactionTypeRefund) String() string { - if c == nil { - return "ChatRevenueTransactionTypeRefund(nil)" - } - type Alias ChatRevenueTransactionTypeRefund - return fmt.Sprintf("ChatRevenueTransactionTypeRefund%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatRevenueTransactionTypeRefund) TypeID() uint32 { - return ChatRevenueTransactionTypeRefundTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatRevenueTransactionTypeRefund) TypeName() string { - return "chatRevenueTransactionTypeRefund" -} - -// TypeInfo returns info about TL type. -func (c *ChatRevenueTransactionTypeRefund) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatRevenueTransactionTypeRefund", - ID: ChatRevenueTransactionTypeRefundTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RefundDate", - SchemaName: "refund_date", - }, - { - Name: "Provider", - SchemaName: "provider", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatRevenueTransactionTypeRefund) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactionTypeRefund#1206b847 as nil") - } - b.PutID(ChatRevenueTransactionTypeRefundTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatRevenueTransactionTypeRefund) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactionTypeRefund#1206b847 as nil") - } - b.PutInt32(c.RefundDate) - b.PutString(c.Provider) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatRevenueTransactionTypeRefund) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactionTypeRefund#1206b847 to nil") - } - if err := b.ConsumeID(ChatRevenueTransactionTypeRefundTypeID); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeRefund#1206b847: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatRevenueTransactionTypeRefund) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactionTypeRefund#1206b847 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeRefund#1206b847: field refund_date: %w", err) - } - c.RefundDate = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeRefund#1206b847: field provider: %w", err) - } - c.Provider = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatRevenueTransactionTypeRefund) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactionTypeRefund#1206b847 as nil") - } - b.ObjStart() - b.PutID("chatRevenueTransactionTypeRefund") - b.Comma() - b.FieldStart("refund_date") - b.PutInt32(c.RefundDate) - b.Comma() - b.FieldStart("provider") - b.PutString(c.Provider) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatRevenueTransactionTypeRefund) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactionTypeRefund#1206b847 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatRevenueTransactionTypeRefund"); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeRefund#1206b847: %w", err) - } - case "refund_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeRefund#1206b847: field refund_date: %w", err) - } - c.RefundDate = value - case "provider": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactionTypeRefund#1206b847: field provider: %w", err) - } - c.Provider = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRefundDate returns value of RefundDate field. -func (c *ChatRevenueTransactionTypeRefund) GetRefundDate() (value int32) { - if c == nil { - return - } - return c.RefundDate -} - -// GetProvider returns value of Provider field. -func (c *ChatRevenueTransactionTypeRefund) GetProvider() (value string) { - if c == nil { - return - } - return c.Provider -} - -// ChatRevenueTransactionTypeClassName is schema name of ChatRevenueTransactionTypeClass. -const ChatRevenueTransactionTypeClassName = "ChatRevenueTransactionType" - -// ChatRevenueTransactionTypeClass represents ChatRevenueTransactionType generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatRevenueTransactionType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatRevenueTransactionTypeEarnings: // chatRevenueTransactionTypeEarnings#e81ca488 -// case *tdapi.ChatRevenueTransactionTypeWithdrawal: // chatRevenueTransactionTypeWithdrawal#f138deb -// case *tdapi.ChatRevenueTransactionTypeRefund: // chatRevenueTransactionTypeRefund#1206b847 -// default: panic(v) -// } -type ChatRevenueTransactionTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatRevenueTransactionTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeChatRevenueTransactionType implements binary de-serialization for ChatRevenueTransactionTypeClass. -func DecodeChatRevenueTransactionType(buf *bin.Buffer) (ChatRevenueTransactionTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatRevenueTransactionTypeEarningsTypeID: - // Decoding chatRevenueTransactionTypeEarnings#e81ca488. - v := ChatRevenueTransactionTypeEarnings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatRevenueTransactionTypeClass: %w", err) - } - return &v, nil - case ChatRevenueTransactionTypeWithdrawalTypeID: - // Decoding chatRevenueTransactionTypeWithdrawal#f138deb. - v := ChatRevenueTransactionTypeWithdrawal{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatRevenueTransactionTypeClass: %w", err) - } - return &v, nil - case ChatRevenueTransactionTypeRefundTypeID: - // Decoding chatRevenueTransactionTypeRefund#1206b847. - v := ChatRevenueTransactionTypeRefund{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatRevenueTransactionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatRevenueTransactionTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatRevenueTransactionType implements binary de-serialization for ChatRevenueTransactionTypeClass. -func DecodeTDLibJSONChatRevenueTransactionType(buf tdjson.Decoder) (ChatRevenueTransactionTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatRevenueTransactionTypeEarnings": - // Decoding chatRevenueTransactionTypeEarnings#e81ca488. - v := ChatRevenueTransactionTypeEarnings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatRevenueTransactionTypeClass: %w", err) - } - return &v, nil - case "chatRevenueTransactionTypeWithdrawal": - // Decoding chatRevenueTransactionTypeWithdrawal#f138deb. - v := ChatRevenueTransactionTypeWithdrawal{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatRevenueTransactionTypeClass: %w", err) - } - return &v, nil - case "chatRevenueTransactionTypeRefund": - // Decoding chatRevenueTransactionTypeRefund#1206b847. - v := ChatRevenueTransactionTypeRefund{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatRevenueTransactionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatRevenueTransactionTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatRevenueTransactionType boxes the ChatRevenueTransactionTypeClass providing a helper. -type ChatRevenueTransactionTypeBox struct { - ChatRevenueTransactionType ChatRevenueTransactionTypeClass -} - -// Decode implements bin.Decoder for ChatRevenueTransactionTypeBox. -func (b *ChatRevenueTransactionTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatRevenueTransactionTypeBox to nil") - } - v, err := DecodeChatRevenueTransactionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatRevenueTransactionType = v - return nil -} - -// Encode implements bin.Encode for ChatRevenueTransactionTypeBox. -func (b *ChatRevenueTransactionTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatRevenueTransactionType == nil { - return fmt.Errorf("unable to encode ChatRevenueTransactionTypeClass as nil") - } - return b.ChatRevenueTransactionType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatRevenueTransactionTypeBox. -func (b *ChatRevenueTransactionTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatRevenueTransactionTypeBox to nil") - } - v, err := DecodeTDLibJSONChatRevenueTransactionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatRevenueTransactionType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatRevenueTransactionTypeBox. -func (b *ChatRevenueTransactionTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatRevenueTransactionType == nil { - return fmt.Errorf("unable to encode ChatRevenueTransactionTypeClass as nil") - } - return b.ChatRevenueTransactionType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_revenue_transactions_gen.go b/tdapi/tl_chat_revenue_transactions_gen.go deleted file mode 100644 index 90a1446e5..000000000 --- a/tdapi/tl_chat_revenue_transactions_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatRevenueTransactions represents TL type `chatRevenueTransactions#95e61144`. -type ChatRevenueTransactions struct { - // Total number of transactions - TotalCount int32 - // List of transactions - Transactions []ChatRevenueTransaction -} - -// ChatRevenueTransactionsTypeID is TL type id of ChatRevenueTransactions. -const ChatRevenueTransactionsTypeID = 0x95e61144 - -// Ensuring interfaces in compile-time for ChatRevenueTransactions. -var ( - _ bin.Encoder = &ChatRevenueTransactions{} - _ bin.Decoder = &ChatRevenueTransactions{} - _ bin.BareEncoder = &ChatRevenueTransactions{} - _ bin.BareDecoder = &ChatRevenueTransactions{} -) - -func (c *ChatRevenueTransactions) Zero() bool { - if c == nil { - return true - } - if !(c.TotalCount == 0) { - return false - } - if !(c.Transactions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatRevenueTransactions) String() string { - if c == nil { - return "ChatRevenueTransactions(nil)" - } - type Alias ChatRevenueTransactions - return fmt.Sprintf("ChatRevenueTransactions%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatRevenueTransactions) TypeID() uint32 { - return ChatRevenueTransactionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatRevenueTransactions) TypeName() string { - return "chatRevenueTransactions" -} - -// TypeInfo returns info about TL type. -func (c *ChatRevenueTransactions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatRevenueTransactions", - ID: ChatRevenueTransactionsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Transactions", - SchemaName: "transactions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatRevenueTransactions) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactions#95e61144 as nil") - } - b.PutID(ChatRevenueTransactionsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatRevenueTransactions) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactions#95e61144 as nil") - } - b.PutInt32(c.TotalCount) - b.PutInt(len(c.Transactions)) - for idx, v := range c.Transactions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatRevenueTransactions#95e61144: field transactions element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatRevenueTransactions) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactions#95e61144 to nil") - } - if err := b.ConsumeID(ChatRevenueTransactionsTypeID); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactions#95e61144: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatRevenueTransactions) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactions#95e61144 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactions#95e61144: field total_count: %w", err) - } - c.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactions#95e61144: field transactions: %w", err) - } - - if headerLen > 0 { - c.Transactions = make([]ChatRevenueTransaction, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatRevenueTransaction - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatRevenueTransactions#95e61144: field transactions: %w", err) - } - c.Transactions = append(c.Transactions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatRevenueTransactions) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatRevenueTransactions#95e61144 as nil") - } - b.ObjStart() - b.PutID("chatRevenueTransactions") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(c.TotalCount) - b.Comma() - b.FieldStart("transactions") - b.ArrStart() - for idx, v := range c.Transactions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatRevenueTransactions#95e61144: field transactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatRevenueTransactions) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatRevenueTransactions#95e61144 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatRevenueTransactions"); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactions#95e61144: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactions#95e61144: field total_count: %w", err) - } - c.TotalCount = value - case "transactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatRevenueTransaction - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactions#95e61144: field transactions: %w", err) - } - c.Transactions = append(c.Transactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatRevenueTransactions#95e61144: field transactions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (c *ChatRevenueTransactions) GetTotalCount() (value int32) { - if c == nil { - return - } - return c.TotalCount -} - -// GetTransactions returns value of Transactions field. -func (c *ChatRevenueTransactions) GetTransactions() (value []ChatRevenueTransaction) { - if c == nil { - return - } - return c.Transactions -} diff --git a/tdapi/tl_chat_source_gen.go b/tdapi/tl_chat_source_gen.go deleted file mode 100644 index 4a74735cd..000000000 --- a/tdapi/tl_chat_source_gen.go +++ /dev/null @@ -1,500 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatSourceMtprotoProxy represents TL type `chatSourceMtprotoProxy#177d1803`. -type ChatSourceMtprotoProxy struct { -} - -// ChatSourceMtprotoProxyTypeID is TL type id of ChatSourceMtprotoProxy. -const ChatSourceMtprotoProxyTypeID = 0x177d1803 - -// construct implements constructor of ChatSourceClass. -func (c ChatSourceMtprotoProxy) construct() ChatSourceClass { return &c } - -// Ensuring interfaces in compile-time for ChatSourceMtprotoProxy. -var ( - _ bin.Encoder = &ChatSourceMtprotoProxy{} - _ bin.Decoder = &ChatSourceMtprotoProxy{} - _ bin.BareEncoder = &ChatSourceMtprotoProxy{} - _ bin.BareDecoder = &ChatSourceMtprotoProxy{} - - _ ChatSourceClass = &ChatSourceMtprotoProxy{} -) - -func (c *ChatSourceMtprotoProxy) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatSourceMtprotoProxy) String() string { - if c == nil { - return "ChatSourceMtprotoProxy(nil)" - } - type Alias ChatSourceMtprotoProxy - return fmt.Sprintf("ChatSourceMtprotoProxy%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatSourceMtprotoProxy) TypeID() uint32 { - return ChatSourceMtprotoProxyTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatSourceMtprotoProxy) TypeName() string { - return "chatSourceMtprotoProxy" -} - -// TypeInfo returns info about TL type. -func (c *ChatSourceMtprotoProxy) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatSourceMtprotoProxy", - ID: ChatSourceMtprotoProxyTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatSourceMtprotoProxy) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatSourceMtprotoProxy#177d1803 as nil") - } - b.PutID(ChatSourceMtprotoProxyTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatSourceMtprotoProxy) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatSourceMtprotoProxy#177d1803 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatSourceMtprotoProxy) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatSourceMtprotoProxy#177d1803 to nil") - } - if err := b.ConsumeID(ChatSourceMtprotoProxyTypeID); err != nil { - return fmt.Errorf("unable to decode chatSourceMtprotoProxy#177d1803: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatSourceMtprotoProxy) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatSourceMtprotoProxy#177d1803 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatSourceMtprotoProxy) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatSourceMtprotoProxy#177d1803 as nil") - } - b.ObjStart() - b.PutID("chatSourceMtprotoProxy") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatSourceMtprotoProxy) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatSourceMtprotoProxy#177d1803 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatSourceMtprotoProxy"); err != nil { - return fmt.Errorf("unable to decode chatSourceMtprotoProxy#177d1803: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ChatSourcePublicServiceAnnouncement represents TL type `chatSourcePublicServiceAnnouncement#ec6a6694`. -type ChatSourcePublicServiceAnnouncement struct { - // The type of the announcement - Type string - // The text of the announcement - Text string -} - -// ChatSourcePublicServiceAnnouncementTypeID is TL type id of ChatSourcePublicServiceAnnouncement. -const ChatSourcePublicServiceAnnouncementTypeID = 0xec6a6694 - -// construct implements constructor of ChatSourceClass. -func (c ChatSourcePublicServiceAnnouncement) construct() ChatSourceClass { return &c } - -// Ensuring interfaces in compile-time for ChatSourcePublicServiceAnnouncement. -var ( - _ bin.Encoder = &ChatSourcePublicServiceAnnouncement{} - _ bin.Decoder = &ChatSourcePublicServiceAnnouncement{} - _ bin.BareEncoder = &ChatSourcePublicServiceAnnouncement{} - _ bin.BareDecoder = &ChatSourcePublicServiceAnnouncement{} - - _ ChatSourceClass = &ChatSourcePublicServiceAnnouncement{} -) - -func (c *ChatSourcePublicServiceAnnouncement) Zero() bool { - if c == nil { - return true - } - if !(c.Type == "") { - return false - } - if !(c.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatSourcePublicServiceAnnouncement) String() string { - if c == nil { - return "ChatSourcePublicServiceAnnouncement(nil)" - } - type Alias ChatSourcePublicServiceAnnouncement - return fmt.Sprintf("ChatSourcePublicServiceAnnouncement%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatSourcePublicServiceAnnouncement) TypeID() uint32 { - return ChatSourcePublicServiceAnnouncementTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatSourcePublicServiceAnnouncement) TypeName() string { - return "chatSourcePublicServiceAnnouncement" -} - -// TypeInfo returns info about TL type. -func (c *ChatSourcePublicServiceAnnouncement) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatSourcePublicServiceAnnouncement", - ID: ChatSourcePublicServiceAnnouncementTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatSourcePublicServiceAnnouncement) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatSourcePublicServiceAnnouncement#ec6a6694 as nil") - } - b.PutID(ChatSourcePublicServiceAnnouncementTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatSourcePublicServiceAnnouncement) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatSourcePublicServiceAnnouncement#ec6a6694 as nil") - } - b.PutString(c.Type) - b.PutString(c.Text) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatSourcePublicServiceAnnouncement) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatSourcePublicServiceAnnouncement#ec6a6694 to nil") - } - if err := b.ConsumeID(ChatSourcePublicServiceAnnouncementTypeID); err != nil { - return fmt.Errorf("unable to decode chatSourcePublicServiceAnnouncement#ec6a6694: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatSourcePublicServiceAnnouncement) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatSourcePublicServiceAnnouncement#ec6a6694 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatSourcePublicServiceAnnouncement#ec6a6694: field type: %w", err) - } - c.Type = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatSourcePublicServiceAnnouncement#ec6a6694: field text: %w", err) - } - c.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatSourcePublicServiceAnnouncement) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatSourcePublicServiceAnnouncement#ec6a6694 as nil") - } - b.ObjStart() - b.PutID("chatSourcePublicServiceAnnouncement") - b.Comma() - b.FieldStart("type") - b.PutString(c.Type) - b.Comma() - b.FieldStart("text") - b.PutString(c.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatSourcePublicServiceAnnouncement) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatSourcePublicServiceAnnouncement#ec6a6694 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatSourcePublicServiceAnnouncement"); err != nil { - return fmt.Errorf("unable to decode chatSourcePublicServiceAnnouncement#ec6a6694: %w", err) - } - case "type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatSourcePublicServiceAnnouncement#ec6a6694: field type: %w", err) - } - c.Type = value - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatSourcePublicServiceAnnouncement#ec6a6694: field text: %w", err) - } - c.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (c *ChatSourcePublicServiceAnnouncement) GetType() (value string) { - if c == nil { - return - } - return c.Type -} - -// GetText returns value of Text field. -func (c *ChatSourcePublicServiceAnnouncement) GetText() (value string) { - if c == nil { - return - } - return c.Text -} - -// ChatSourceClassName is schema name of ChatSourceClass. -const ChatSourceClassName = "ChatSource" - -// ChatSourceClass represents ChatSource generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatSource(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatSourceMtprotoProxy: // chatSourceMtprotoProxy#177d1803 -// case *tdapi.ChatSourcePublicServiceAnnouncement: // chatSourcePublicServiceAnnouncement#ec6a6694 -// default: panic(v) -// } -type ChatSourceClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatSourceClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeChatSource implements binary de-serialization for ChatSourceClass. -func DecodeChatSource(buf *bin.Buffer) (ChatSourceClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatSourceMtprotoProxyTypeID: - // Decoding chatSourceMtprotoProxy#177d1803. - v := ChatSourceMtprotoProxy{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatSourceClass: %w", err) - } - return &v, nil - case ChatSourcePublicServiceAnnouncementTypeID: - // Decoding chatSourcePublicServiceAnnouncement#ec6a6694. - v := ChatSourcePublicServiceAnnouncement{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatSourceClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatSource implements binary de-serialization for ChatSourceClass. -func DecodeTDLibJSONChatSource(buf tdjson.Decoder) (ChatSourceClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatSourceMtprotoProxy": - // Decoding chatSourceMtprotoProxy#177d1803. - v := ChatSourceMtprotoProxy{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatSourceClass: %w", err) - } - return &v, nil - case "chatSourcePublicServiceAnnouncement": - // Decoding chatSourcePublicServiceAnnouncement#ec6a6694. - v := ChatSourcePublicServiceAnnouncement{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatSourceClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatSource boxes the ChatSourceClass providing a helper. -type ChatSourceBox struct { - ChatSource ChatSourceClass -} - -// Decode implements bin.Decoder for ChatSourceBox. -func (b *ChatSourceBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatSourceBox to nil") - } - v, err := DecodeChatSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatSource = v - return nil -} - -// Encode implements bin.Encode for ChatSourceBox. -func (b *ChatSourceBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatSource == nil { - return fmt.Errorf("unable to encode ChatSourceClass as nil") - } - return b.ChatSource.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatSourceBox. -func (b *ChatSourceBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatSourceBox to nil") - } - v, err := DecodeTDLibJSONChatSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatSource = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatSourceBox. -func (b *ChatSourceBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatSource == nil { - return fmt.Errorf("unable to encode ChatSourceClass as nil") - } - return b.ChatSource.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_statistics_administrator_actions_info_gen.go b/tdapi/tl_chat_statistics_administrator_actions_info_gen.go deleted file mode 100644 index a3a81f897..000000000 --- a/tdapi/tl_chat_statistics_administrator_actions_info_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatStatisticsAdministratorActionsInfo represents TL type `chatStatisticsAdministratorActionsInfo#e7c5cd7e`. -type ChatStatisticsAdministratorActionsInfo struct { - // Administrator user identifier - UserID int64 - // Number of messages deleted by the administrator - DeletedMessageCount int32 - // Number of users banned by the administrator - BannedUserCount int32 - // Number of users restricted by the administrator - RestrictedUserCount int32 -} - -// ChatStatisticsAdministratorActionsInfoTypeID is TL type id of ChatStatisticsAdministratorActionsInfo. -const ChatStatisticsAdministratorActionsInfoTypeID = 0xe7c5cd7e - -// Ensuring interfaces in compile-time for ChatStatisticsAdministratorActionsInfo. -var ( - _ bin.Encoder = &ChatStatisticsAdministratorActionsInfo{} - _ bin.Decoder = &ChatStatisticsAdministratorActionsInfo{} - _ bin.BareEncoder = &ChatStatisticsAdministratorActionsInfo{} - _ bin.BareDecoder = &ChatStatisticsAdministratorActionsInfo{} -) - -func (c *ChatStatisticsAdministratorActionsInfo) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.DeletedMessageCount == 0) { - return false - } - if !(c.BannedUserCount == 0) { - return false - } - if !(c.RestrictedUserCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatStatisticsAdministratorActionsInfo) String() string { - if c == nil { - return "ChatStatisticsAdministratorActionsInfo(nil)" - } - type Alias ChatStatisticsAdministratorActionsInfo - return fmt.Sprintf("ChatStatisticsAdministratorActionsInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatStatisticsAdministratorActionsInfo) TypeID() uint32 { - return ChatStatisticsAdministratorActionsInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatStatisticsAdministratorActionsInfo) TypeName() string { - return "chatStatisticsAdministratorActionsInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatStatisticsAdministratorActionsInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatStatisticsAdministratorActionsInfo", - ID: ChatStatisticsAdministratorActionsInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "DeletedMessageCount", - SchemaName: "deleted_message_count", - }, - { - Name: "BannedUserCount", - SchemaName: "banned_user_count", - }, - { - Name: "RestrictedUserCount", - SchemaName: "restricted_user_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatStatisticsAdministratorActionsInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsAdministratorActionsInfo#e7c5cd7e as nil") - } - b.PutID(ChatStatisticsAdministratorActionsInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatStatisticsAdministratorActionsInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsAdministratorActionsInfo#e7c5cd7e as nil") - } - b.PutInt53(c.UserID) - b.PutInt32(c.DeletedMessageCount) - b.PutInt32(c.BannedUserCount) - b.PutInt32(c.RestrictedUserCount) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatStatisticsAdministratorActionsInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsAdministratorActionsInfo#e7c5cd7e to nil") - } - if err := b.ConsumeID(ChatStatisticsAdministratorActionsInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatStatisticsAdministratorActionsInfo#e7c5cd7e: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatStatisticsAdministratorActionsInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsAdministratorActionsInfo#e7c5cd7e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsAdministratorActionsInfo#e7c5cd7e: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsAdministratorActionsInfo#e7c5cd7e: field deleted_message_count: %w", err) - } - c.DeletedMessageCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsAdministratorActionsInfo#e7c5cd7e: field banned_user_count: %w", err) - } - c.BannedUserCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsAdministratorActionsInfo#e7c5cd7e: field restricted_user_count: %w", err) - } - c.RestrictedUserCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatStatisticsAdministratorActionsInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsAdministratorActionsInfo#e7c5cd7e as nil") - } - b.ObjStart() - b.PutID("chatStatisticsAdministratorActionsInfo") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("deleted_message_count") - b.PutInt32(c.DeletedMessageCount) - b.Comma() - b.FieldStart("banned_user_count") - b.PutInt32(c.BannedUserCount) - b.Comma() - b.FieldStart("restricted_user_count") - b.PutInt32(c.RestrictedUserCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatStatisticsAdministratorActionsInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsAdministratorActionsInfo#e7c5cd7e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatStatisticsAdministratorActionsInfo"); err != nil { - return fmt.Errorf("unable to decode chatStatisticsAdministratorActionsInfo#e7c5cd7e: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsAdministratorActionsInfo#e7c5cd7e: field user_id: %w", err) - } - c.UserID = value - case "deleted_message_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsAdministratorActionsInfo#e7c5cd7e: field deleted_message_count: %w", err) - } - c.DeletedMessageCount = value - case "banned_user_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsAdministratorActionsInfo#e7c5cd7e: field banned_user_count: %w", err) - } - c.BannedUserCount = value - case "restricted_user_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsAdministratorActionsInfo#e7c5cd7e: field restricted_user_count: %w", err) - } - c.RestrictedUserCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatStatisticsAdministratorActionsInfo) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetDeletedMessageCount returns value of DeletedMessageCount field. -func (c *ChatStatisticsAdministratorActionsInfo) GetDeletedMessageCount() (value int32) { - if c == nil { - return - } - return c.DeletedMessageCount -} - -// GetBannedUserCount returns value of BannedUserCount field. -func (c *ChatStatisticsAdministratorActionsInfo) GetBannedUserCount() (value int32) { - if c == nil { - return - } - return c.BannedUserCount -} - -// GetRestrictedUserCount returns value of RestrictedUserCount field. -func (c *ChatStatisticsAdministratorActionsInfo) GetRestrictedUserCount() (value int32) { - if c == nil { - return - } - return c.RestrictedUserCount -} diff --git a/tdapi/tl_chat_statistics_gen.go b/tdapi/tl_chat_statistics_gen.go deleted file mode 100644 index a6f6c6442..000000000 --- a/tdapi/tl_chat_statistics_gen.go +++ /dev/null @@ -1,2051 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatStatisticsSupergroup represents TL type `chatStatisticsSupergroup#c67549ef`. -type ChatStatisticsSupergroup struct { - // A period to which the statistics applies - Period DateRange - // Number of members in the chat - MemberCount StatisticalValue - // Number of messages sent to the chat - MessageCount StatisticalValue - // Number of users who viewed messages in the chat - ViewerCount StatisticalValue - // Number of users who sent messages to the chat - SenderCount StatisticalValue - // A graph containing number of members in the chat - MemberCountGraph StatisticalGraphClass - // A graph containing number of members joined and left the chat - JoinGraph StatisticalGraphClass - // A graph containing number of new member joins per source - JoinBySourceGraph StatisticalGraphClass - // A graph containing distribution of active users per language - LanguageGraph StatisticalGraphClass - // A graph containing distribution of sent messages by content type - MessageContentGraph StatisticalGraphClass - // A graph containing number of different actions in the chat - ActionGraph StatisticalGraphClass - // A graph containing distribution of message views per hour - DayGraph StatisticalGraphClass - // A graph containing distribution of message views per day of week - WeekGraph StatisticalGraphClass - // List of users sent most messages in the last week - TopSenders []ChatStatisticsMessageSenderInfo - // List of most active administrators in the last week - TopAdministrators []ChatStatisticsAdministratorActionsInfo - // List of most active inviters of new members in the last week - TopInviters []ChatStatisticsInviterInfo -} - -// ChatStatisticsSupergroupTypeID is TL type id of ChatStatisticsSupergroup. -const ChatStatisticsSupergroupTypeID = 0xc67549ef - -// construct implements constructor of ChatStatisticsClass. -func (c ChatStatisticsSupergroup) construct() ChatStatisticsClass { return &c } - -// Ensuring interfaces in compile-time for ChatStatisticsSupergroup. -var ( - _ bin.Encoder = &ChatStatisticsSupergroup{} - _ bin.Decoder = &ChatStatisticsSupergroup{} - _ bin.BareEncoder = &ChatStatisticsSupergroup{} - _ bin.BareDecoder = &ChatStatisticsSupergroup{} - - _ ChatStatisticsClass = &ChatStatisticsSupergroup{} -) - -func (c *ChatStatisticsSupergroup) Zero() bool { - if c == nil { - return true - } - if !(c.Period.Zero()) { - return false - } - if !(c.MemberCount.Zero()) { - return false - } - if !(c.MessageCount.Zero()) { - return false - } - if !(c.ViewerCount.Zero()) { - return false - } - if !(c.SenderCount.Zero()) { - return false - } - if !(c.MemberCountGraph == nil) { - return false - } - if !(c.JoinGraph == nil) { - return false - } - if !(c.JoinBySourceGraph == nil) { - return false - } - if !(c.LanguageGraph == nil) { - return false - } - if !(c.MessageContentGraph == nil) { - return false - } - if !(c.ActionGraph == nil) { - return false - } - if !(c.DayGraph == nil) { - return false - } - if !(c.WeekGraph == nil) { - return false - } - if !(c.TopSenders == nil) { - return false - } - if !(c.TopAdministrators == nil) { - return false - } - if !(c.TopInviters == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatStatisticsSupergroup) String() string { - if c == nil { - return "ChatStatisticsSupergroup(nil)" - } - type Alias ChatStatisticsSupergroup - return fmt.Sprintf("ChatStatisticsSupergroup%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatStatisticsSupergroup) TypeID() uint32 { - return ChatStatisticsSupergroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatStatisticsSupergroup) TypeName() string { - return "chatStatisticsSupergroup" -} - -// TypeInfo returns info about TL type. -func (c *ChatStatisticsSupergroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatStatisticsSupergroup", - ID: ChatStatisticsSupergroupTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Period", - SchemaName: "period", - }, - { - Name: "MemberCount", - SchemaName: "member_count", - }, - { - Name: "MessageCount", - SchemaName: "message_count", - }, - { - Name: "ViewerCount", - SchemaName: "viewer_count", - }, - { - Name: "SenderCount", - SchemaName: "sender_count", - }, - { - Name: "MemberCountGraph", - SchemaName: "member_count_graph", - }, - { - Name: "JoinGraph", - SchemaName: "join_graph", - }, - { - Name: "JoinBySourceGraph", - SchemaName: "join_by_source_graph", - }, - { - Name: "LanguageGraph", - SchemaName: "language_graph", - }, - { - Name: "MessageContentGraph", - SchemaName: "message_content_graph", - }, - { - Name: "ActionGraph", - SchemaName: "action_graph", - }, - { - Name: "DayGraph", - SchemaName: "day_graph", - }, - { - Name: "WeekGraph", - SchemaName: "week_graph", - }, - { - Name: "TopSenders", - SchemaName: "top_senders", - }, - { - Name: "TopAdministrators", - SchemaName: "top_administrators", - }, - { - Name: "TopInviters", - SchemaName: "top_inviters", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatStatisticsSupergroup) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsSupergroup#c67549ef as nil") - } - b.PutID(ChatStatisticsSupergroupTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatStatisticsSupergroup) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsSupergroup#c67549ef as nil") - } - if err := c.Period.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field period: %w", err) - } - if err := c.MemberCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field member_count: %w", err) - } - if err := c.MessageCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field message_count: %w", err) - } - if err := c.ViewerCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field viewer_count: %w", err) - } - if err := c.SenderCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field sender_count: %w", err) - } - if c.MemberCountGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field member_count_graph is nil") - } - if err := c.MemberCountGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field member_count_graph: %w", err) - } - if c.JoinGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field join_graph is nil") - } - if err := c.JoinGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field join_graph: %w", err) - } - if c.JoinBySourceGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field join_by_source_graph is nil") - } - if err := c.JoinBySourceGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field join_by_source_graph: %w", err) - } - if c.LanguageGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field language_graph is nil") - } - if err := c.LanguageGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field language_graph: %w", err) - } - if c.MessageContentGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field message_content_graph is nil") - } - if err := c.MessageContentGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field message_content_graph: %w", err) - } - if c.ActionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field action_graph is nil") - } - if err := c.ActionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field action_graph: %w", err) - } - if c.DayGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field day_graph is nil") - } - if err := c.DayGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field day_graph: %w", err) - } - if c.WeekGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field week_graph is nil") - } - if err := c.WeekGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field week_graph: %w", err) - } - b.PutInt(len(c.TopSenders)) - for idx, v := range c.TopSenders { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatStatisticsSupergroup#c67549ef: field top_senders element with index %d: %w", idx, err) - } - } - b.PutInt(len(c.TopAdministrators)) - for idx, v := range c.TopAdministrators { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatStatisticsSupergroup#c67549ef: field top_administrators element with index %d: %w", idx, err) - } - } - b.PutInt(len(c.TopInviters)) - for idx, v := range c.TopInviters { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatStatisticsSupergroup#c67549ef: field top_inviters element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatStatisticsSupergroup) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsSupergroup#c67549ef to nil") - } - if err := b.ConsumeID(ChatStatisticsSupergroupTypeID); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatStatisticsSupergroup) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsSupergroup#c67549ef to nil") - } - { - if err := c.Period.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field period: %w", err) - } - } - { - if err := c.MemberCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field member_count: %w", err) - } - } - { - if err := c.MessageCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field message_count: %w", err) - } - } - { - if err := c.ViewerCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field viewer_count: %w", err) - } - } - { - if err := c.SenderCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field sender_count: %w", err) - } - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field member_count_graph: %w", err) - } - c.MemberCountGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field join_graph: %w", err) - } - c.JoinGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field join_by_source_graph: %w", err) - } - c.JoinBySourceGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field language_graph: %w", err) - } - c.LanguageGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field message_content_graph: %w", err) - } - c.MessageContentGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field action_graph: %w", err) - } - c.ActionGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field day_graph: %w", err) - } - c.DayGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field week_graph: %w", err) - } - c.WeekGraph = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field top_senders: %w", err) - } - - if headerLen > 0 { - c.TopSenders = make([]ChatStatisticsMessageSenderInfo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatStatisticsMessageSenderInfo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatStatisticsSupergroup#c67549ef: field top_senders: %w", err) - } - c.TopSenders = append(c.TopSenders, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field top_administrators: %w", err) - } - - if headerLen > 0 { - c.TopAdministrators = make([]ChatStatisticsAdministratorActionsInfo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatStatisticsAdministratorActionsInfo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatStatisticsSupergroup#c67549ef: field top_administrators: %w", err) - } - c.TopAdministrators = append(c.TopAdministrators, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field top_inviters: %w", err) - } - - if headerLen > 0 { - c.TopInviters = make([]ChatStatisticsInviterInfo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatStatisticsInviterInfo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatStatisticsSupergroup#c67549ef: field top_inviters: %w", err) - } - c.TopInviters = append(c.TopInviters, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatStatisticsSupergroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsSupergroup#c67549ef as nil") - } - b.ObjStart() - b.PutID("chatStatisticsSupergroup") - b.Comma() - b.FieldStart("period") - if err := c.Period.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field period: %w", err) - } - b.Comma() - b.FieldStart("member_count") - if err := c.MemberCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field member_count: %w", err) - } - b.Comma() - b.FieldStart("message_count") - if err := c.MessageCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field message_count: %w", err) - } - b.Comma() - b.FieldStart("viewer_count") - if err := c.ViewerCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field viewer_count: %w", err) - } - b.Comma() - b.FieldStart("sender_count") - if err := c.SenderCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field sender_count: %w", err) - } - b.Comma() - b.FieldStart("member_count_graph") - if c.MemberCountGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field member_count_graph is nil") - } - if err := c.MemberCountGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field member_count_graph: %w", err) - } - b.Comma() - b.FieldStart("join_graph") - if c.JoinGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field join_graph is nil") - } - if err := c.JoinGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field join_graph: %w", err) - } - b.Comma() - b.FieldStart("join_by_source_graph") - if c.JoinBySourceGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field join_by_source_graph is nil") - } - if err := c.JoinBySourceGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field join_by_source_graph: %w", err) - } - b.Comma() - b.FieldStart("language_graph") - if c.LanguageGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field language_graph is nil") - } - if err := c.LanguageGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field language_graph: %w", err) - } - b.Comma() - b.FieldStart("message_content_graph") - if c.MessageContentGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field message_content_graph is nil") - } - if err := c.MessageContentGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field message_content_graph: %w", err) - } - b.Comma() - b.FieldStart("action_graph") - if c.ActionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field action_graph is nil") - } - if err := c.ActionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field action_graph: %w", err) - } - b.Comma() - b.FieldStart("day_graph") - if c.DayGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field day_graph is nil") - } - if err := c.DayGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field day_graph: %w", err) - } - b.Comma() - b.FieldStart("week_graph") - if c.WeekGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field week_graph is nil") - } - if err := c.WeekGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field week_graph: %w", err) - } - b.Comma() - b.FieldStart("top_senders") - b.ArrStart() - for idx, v := range c.TopSenders { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field top_senders element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("top_administrators") - b.ArrStart() - for idx, v := range c.TopAdministrators { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field top_administrators element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("top_inviters") - b.ArrStart() - for idx, v := range c.TopInviters { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsSupergroup#c67549ef: field top_inviters element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatStatisticsSupergroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsSupergroup#c67549ef to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatStatisticsSupergroup"); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: %w", err) - } - case "period": - if err := c.Period.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field period: %w", err) - } - case "member_count": - if err := c.MemberCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field member_count: %w", err) - } - case "message_count": - if err := c.MessageCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field message_count: %w", err) - } - case "viewer_count": - if err := c.ViewerCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field viewer_count: %w", err) - } - case "sender_count": - if err := c.SenderCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field sender_count: %w", err) - } - case "member_count_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field member_count_graph: %w", err) - } - c.MemberCountGraph = value - case "join_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field join_graph: %w", err) - } - c.JoinGraph = value - case "join_by_source_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field join_by_source_graph: %w", err) - } - c.JoinBySourceGraph = value - case "language_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field language_graph: %w", err) - } - c.LanguageGraph = value - case "message_content_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field message_content_graph: %w", err) - } - c.MessageContentGraph = value - case "action_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field action_graph: %w", err) - } - c.ActionGraph = value - case "day_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field day_graph: %w", err) - } - c.DayGraph = value - case "week_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field week_graph: %w", err) - } - c.WeekGraph = value - case "top_senders": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatStatisticsMessageSenderInfo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field top_senders: %w", err) - } - c.TopSenders = append(c.TopSenders, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field top_senders: %w", err) - } - case "top_administrators": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatStatisticsAdministratorActionsInfo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field top_administrators: %w", err) - } - c.TopAdministrators = append(c.TopAdministrators, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field top_administrators: %w", err) - } - case "top_inviters": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatStatisticsInviterInfo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field top_inviters: %w", err) - } - c.TopInviters = append(c.TopInviters, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatStatisticsSupergroup#c67549ef: field top_inviters: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPeriod returns value of Period field. -func (c *ChatStatisticsSupergroup) GetPeriod() (value DateRange) { - if c == nil { - return - } - return c.Period -} - -// GetMemberCount returns value of MemberCount field. -func (c *ChatStatisticsSupergroup) GetMemberCount() (value StatisticalValue) { - if c == nil { - return - } - return c.MemberCount -} - -// GetMessageCount returns value of MessageCount field. -func (c *ChatStatisticsSupergroup) GetMessageCount() (value StatisticalValue) { - if c == nil { - return - } - return c.MessageCount -} - -// GetViewerCount returns value of ViewerCount field. -func (c *ChatStatisticsSupergroup) GetViewerCount() (value StatisticalValue) { - if c == nil { - return - } - return c.ViewerCount -} - -// GetSenderCount returns value of SenderCount field. -func (c *ChatStatisticsSupergroup) GetSenderCount() (value StatisticalValue) { - if c == nil { - return - } - return c.SenderCount -} - -// GetMemberCountGraph returns value of MemberCountGraph field. -func (c *ChatStatisticsSupergroup) GetMemberCountGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.MemberCountGraph -} - -// GetJoinGraph returns value of JoinGraph field. -func (c *ChatStatisticsSupergroup) GetJoinGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.JoinGraph -} - -// GetJoinBySourceGraph returns value of JoinBySourceGraph field. -func (c *ChatStatisticsSupergroup) GetJoinBySourceGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.JoinBySourceGraph -} - -// GetLanguageGraph returns value of LanguageGraph field. -func (c *ChatStatisticsSupergroup) GetLanguageGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.LanguageGraph -} - -// GetMessageContentGraph returns value of MessageContentGraph field. -func (c *ChatStatisticsSupergroup) GetMessageContentGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.MessageContentGraph -} - -// GetActionGraph returns value of ActionGraph field. -func (c *ChatStatisticsSupergroup) GetActionGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.ActionGraph -} - -// GetDayGraph returns value of DayGraph field. -func (c *ChatStatisticsSupergroup) GetDayGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.DayGraph -} - -// GetWeekGraph returns value of WeekGraph field. -func (c *ChatStatisticsSupergroup) GetWeekGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.WeekGraph -} - -// GetTopSenders returns value of TopSenders field. -func (c *ChatStatisticsSupergroup) GetTopSenders() (value []ChatStatisticsMessageSenderInfo) { - if c == nil { - return - } - return c.TopSenders -} - -// GetTopAdministrators returns value of TopAdministrators field. -func (c *ChatStatisticsSupergroup) GetTopAdministrators() (value []ChatStatisticsAdministratorActionsInfo) { - if c == nil { - return - } - return c.TopAdministrators -} - -// GetTopInviters returns value of TopInviters field. -func (c *ChatStatisticsSupergroup) GetTopInviters() (value []ChatStatisticsInviterInfo) { - if c == nil { - return - } - return c.TopInviters -} - -// ChatStatisticsChannel represents TL type `chatStatisticsChannel#b8e95b4`. -type ChatStatisticsChannel struct { - // A period to which the statistics applies - Period DateRange - // Number of members in the chat - MemberCount StatisticalValue - // Mean number of times the recently sent messages were viewed - MeanMessageViewCount StatisticalValue - // Mean number of times the recently sent messages were shared - MeanMessageShareCount StatisticalValue - // Mean number of times reactions were added to the recently sent messages - MeanMessageReactionCount StatisticalValue - // Mean number of times the recently sent stories were viewed - MeanStoryViewCount StatisticalValue - // Mean number of times the recently sent stories were shared - MeanStoryShareCount StatisticalValue - // Mean number of times reactions were added to the recently sent stories - MeanStoryReactionCount StatisticalValue - // A percentage of users with enabled notifications for the chat; 0-100 - EnabledNotificationsPercentage float64 - // A graph containing number of members in the chat - MemberCountGraph StatisticalGraphClass - // A graph containing number of members joined and left the chat - JoinGraph StatisticalGraphClass - // A graph containing number of members muted and unmuted the chat - MuteGraph StatisticalGraphClass - // A graph containing number of message views in a given hour in the last two weeks - ViewCountByHourGraph StatisticalGraphClass - // A graph containing number of message views per source - ViewCountBySourceGraph StatisticalGraphClass - // A graph containing number of new member joins per source - JoinBySourceGraph StatisticalGraphClass - // A graph containing number of users viewed chat messages per language - LanguageGraph StatisticalGraphClass - // A graph containing number of chat message views and shares - MessageInteractionGraph StatisticalGraphClass - // A graph containing number of reactions on messages - MessageReactionGraph StatisticalGraphClass - // A graph containing number of story views and shares - StoryInteractionGraph StatisticalGraphClass - // A graph containing number of reactions on stories - StoryReactionGraph StatisticalGraphClass - // A graph containing number of views of associated with the chat instant views - InstantViewInteractionGraph StatisticalGraphClass - // Detailed statistics about number of views and shares of recently sent messages and - // stories - RecentInteractions []ChatStatisticsInteractionInfo -} - -// ChatStatisticsChannelTypeID is TL type id of ChatStatisticsChannel. -const ChatStatisticsChannelTypeID = 0xb8e95b4 - -// construct implements constructor of ChatStatisticsClass. -func (c ChatStatisticsChannel) construct() ChatStatisticsClass { return &c } - -// Ensuring interfaces in compile-time for ChatStatisticsChannel. -var ( - _ bin.Encoder = &ChatStatisticsChannel{} - _ bin.Decoder = &ChatStatisticsChannel{} - _ bin.BareEncoder = &ChatStatisticsChannel{} - _ bin.BareDecoder = &ChatStatisticsChannel{} - - _ ChatStatisticsClass = &ChatStatisticsChannel{} -) - -func (c *ChatStatisticsChannel) Zero() bool { - if c == nil { - return true - } - if !(c.Period.Zero()) { - return false - } - if !(c.MemberCount.Zero()) { - return false - } - if !(c.MeanMessageViewCount.Zero()) { - return false - } - if !(c.MeanMessageShareCount.Zero()) { - return false - } - if !(c.MeanMessageReactionCount.Zero()) { - return false - } - if !(c.MeanStoryViewCount.Zero()) { - return false - } - if !(c.MeanStoryShareCount.Zero()) { - return false - } - if !(c.MeanStoryReactionCount.Zero()) { - return false - } - if !(c.EnabledNotificationsPercentage == 0) { - return false - } - if !(c.MemberCountGraph == nil) { - return false - } - if !(c.JoinGraph == nil) { - return false - } - if !(c.MuteGraph == nil) { - return false - } - if !(c.ViewCountByHourGraph == nil) { - return false - } - if !(c.ViewCountBySourceGraph == nil) { - return false - } - if !(c.JoinBySourceGraph == nil) { - return false - } - if !(c.LanguageGraph == nil) { - return false - } - if !(c.MessageInteractionGraph == nil) { - return false - } - if !(c.MessageReactionGraph == nil) { - return false - } - if !(c.StoryInteractionGraph == nil) { - return false - } - if !(c.StoryReactionGraph == nil) { - return false - } - if !(c.InstantViewInteractionGraph == nil) { - return false - } - if !(c.RecentInteractions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatStatisticsChannel) String() string { - if c == nil { - return "ChatStatisticsChannel(nil)" - } - type Alias ChatStatisticsChannel - return fmt.Sprintf("ChatStatisticsChannel%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatStatisticsChannel) TypeID() uint32 { - return ChatStatisticsChannelTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatStatisticsChannel) TypeName() string { - return "chatStatisticsChannel" -} - -// TypeInfo returns info about TL type. -func (c *ChatStatisticsChannel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatStatisticsChannel", - ID: ChatStatisticsChannelTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Period", - SchemaName: "period", - }, - { - Name: "MemberCount", - SchemaName: "member_count", - }, - { - Name: "MeanMessageViewCount", - SchemaName: "mean_message_view_count", - }, - { - Name: "MeanMessageShareCount", - SchemaName: "mean_message_share_count", - }, - { - Name: "MeanMessageReactionCount", - SchemaName: "mean_message_reaction_count", - }, - { - Name: "MeanStoryViewCount", - SchemaName: "mean_story_view_count", - }, - { - Name: "MeanStoryShareCount", - SchemaName: "mean_story_share_count", - }, - { - Name: "MeanStoryReactionCount", - SchemaName: "mean_story_reaction_count", - }, - { - Name: "EnabledNotificationsPercentage", - SchemaName: "enabled_notifications_percentage", - }, - { - Name: "MemberCountGraph", - SchemaName: "member_count_graph", - }, - { - Name: "JoinGraph", - SchemaName: "join_graph", - }, - { - Name: "MuteGraph", - SchemaName: "mute_graph", - }, - { - Name: "ViewCountByHourGraph", - SchemaName: "view_count_by_hour_graph", - }, - { - Name: "ViewCountBySourceGraph", - SchemaName: "view_count_by_source_graph", - }, - { - Name: "JoinBySourceGraph", - SchemaName: "join_by_source_graph", - }, - { - Name: "LanguageGraph", - SchemaName: "language_graph", - }, - { - Name: "MessageInteractionGraph", - SchemaName: "message_interaction_graph", - }, - { - Name: "MessageReactionGraph", - SchemaName: "message_reaction_graph", - }, - { - Name: "StoryInteractionGraph", - SchemaName: "story_interaction_graph", - }, - { - Name: "StoryReactionGraph", - SchemaName: "story_reaction_graph", - }, - { - Name: "InstantViewInteractionGraph", - SchemaName: "instant_view_interaction_graph", - }, - { - Name: "RecentInteractions", - SchemaName: "recent_interactions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatStatisticsChannel) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsChannel#b8e95b4 as nil") - } - b.PutID(ChatStatisticsChannelTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatStatisticsChannel) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsChannel#b8e95b4 as nil") - } - if err := c.Period.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field period: %w", err) - } - if err := c.MemberCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count: %w", err) - } - if err := c.MeanMessageViewCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_view_count: %w", err) - } - if err := c.MeanMessageShareCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_share_count: %w", err) - } - if err := c.MeanMessageReactionCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_reaction_count: %w", err) - } - if err := c.MeanStoryViewCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_view_count: %w", err) - } - if err := c.MeanStoryShareCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_share_count: %w", err) - } - if err := c.MeanStoryReactionCount.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_reaction_count: %w", err) - } - b.PutDouble(c.EnabledNotificationsPercentage) - if c.MemberCountGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count_graph is nil") - } - if err := c.MemberCountGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count_graph: %w", err) - } - if c.JoinGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_graph is nil") - } - if err := c.JoinGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_graph: %w", err) - } - if c.MuteGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mute_graph is nil") - } - if err := c.MuteGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mute_graph: %w", err) - } - if c.ViewCountByHourGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph is nil") - } - if err := c.ViewCountByHourGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph: %w", err) - } - if c.ViewCountBySourceGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph is nil") - } - if err := c.ViewCountBySourceGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph: %w", err) - } - if c.JoinBySourceGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_by_source_graph is nil") - } - if err := c.JoinBySourceGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_by_source_graph: %w", err) - } - if c.LanguageGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field language_graph is nil") - } - if err := c.LanguageGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field language_graph: %w", err) - } - if c.MessageInteractionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_interaction_graph is nil") - } - if err := c.MessageInteractionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_interaction_graph: %w", err) - } - if c.MessageReactionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_reaction_graph is nil") - } - if err := c.MessageReactionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_reaction_graph: %w", err) - } - if c.StoryInteractionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_interaction_graph is nil") - } - if err := c.StoryInteractionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_interaction_graph: %w", err) - } - if c.StoryReactionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_reaction_graph is nil") - } - if err := c.StoryReactionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_reaction_graph: %w", err) - } - if c.InstantViewInteractionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph is nil") - } - if err := c.InstantViewInteractionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph: %w", err) - } - b.PutInt(len(c.RecentInteractions)) - for idx, v := range c.RecentInteractions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare chatStatisticsChannel#b8e95b4: field recent_interactions element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatStatisticsChannel) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsChannel#b8e95b4 to nil") - } - if err := b.ConsumeID(ChatStatisticsChannelTypeID); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatStatisticsChannel) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsChannel#b8e95b4 to nil") - } - { - if err := c.Period.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field period: %w", err) - } - } - { - if err := c.MemberCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field member_count: %w", err) - } - } - { - if err := c.MeanMessageViewCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_view_count: %w", err) - } - } - { - if err := c.MeanMessageShareCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_share_count: %w", err) - } - } - { - if err := c.MeanMessageReactionCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_reaction_count: %w", err) - } - } - { - if err := c.MeanStoryViewCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_view_count: %w", err) - } - } - { - if err := c.MeanStoryShareCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_share_count: %w", err) - } - } - { - if err := c.MeanStoryReactionCount.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_reaction_count: %w", err) - } - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field enabled_notifications_percentage: %w", err) - } - c.EnabledNotificationsPercentage = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field member_count_graph: %w", err) - } - c.MemberCountGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field join_graph: %w", err) - } - c.JoinGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mute_graph: %w", err) - } - c.MuteGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph: %w", err) - } - c.ViewCountByHourGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph: %w", err) - } - c.ViewCountBySourceGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field join_by_source_graph: %w", err) - } - c.JoinBySourceGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field language_graph: %w", err) - } - c.LanguageGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field message_interaction_graph: %w", err) - } - c.MessageInteractionGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field message_reaction_graph: %w", err) - } - c.MessageReactionGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field story_interaction_graph: %w", err) - } - c.StoryInteractionGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field story_reaction_graph: %w", err) - } - c.StoryReactionGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph: %w", err) - } - c.InstantViewInteractionGraph = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field recent_interactions: %w", err) - } - - if headerLen > 0 { - c.RecentInteractions = make([]ChatStatisticsInteractionInfo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatStatisticsInteractionInfo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare chatStatisticsChannel#b8e95b4: field recent_interactions: %w", err) - } - c.RecentInteractions = append(c.RecentInteractions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatStatisticsChannel) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsChannel#b8e95b4 as nil") - } - b.ObjStart() - b.PutID("chatStatisticsChannel") - b.Comma() - b.FieldStart("period") - if err := c.Period.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field period: %w", err) - } - b.Comma() - b.FieldStart("member_count") - if err := c.MemberCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count: %w", err) - } - b.Comma() - b.FieldStart("mean_message_view_count") - if err := c.MeanMessageViewCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_view_count: %w", err) - } - b.Comma() - b.FieldStart("mean_message_share_count") - if err := c.MeanMessageShareCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_share_count: %w", err) - } - b.Comma() - b.FieldStart("mean_message_reaction_count") - if err := c.MeanMessageReactionCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_message_reaction_count: %w", err) - } - b.Comma() - b.FieldStart("mean_story_view_count") - if err := c.MeanStoryViewCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_view_count: %w", err) - } - b.Comma() - b.FieldStart("mean_story_share_count") - if err := c.MeanStoryShareCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_share_count: %w", err) - } - b.Comma() - b.FieldStart("mean_story_reaction_count") - if err := c.MeanStoryReactionCount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mean_story_reaction_count: %w", err) - } - b.Comma() - b.FieldStart("enabled_notifications_percentage") - b.PutDouble(c.EnabledNotificationsPercentage) - b.Comma() - b.FieldStart("member_count_graph") - if c.MemberCountGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count_graph is nil") - } - if err := c.MemberCountGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field member_count_graph: %w", err) - } - b.Comma() - b.FieldStart("join_graph") - if c.JoinGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_graph is nil") - } - if err := c.JoinGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_graph: %w", err) - } - b.Comma() - b.FieldStart("mute_graph") - if c.MuteGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mute_graph is nil") - } - if err := c.MuteGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field mute_graph: %w", err) - } - b.Comma() - b.FieldStart("view_count_by_hour_graph") - if c.ViewCountByHourGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph is nil") - } - if err := c.ViewCountByHourGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph: %w", err) - } - b.Comma() - b.FieldStart("view_count_by_source_graph") - if c.ViewCountBySourceGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph is nil") - } - if err := c.ViewCountBySourceGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph: %w", err) - } - b.Comma() - b.FieldStart("join_by_source_graph") - if c.JoinBySourceGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_by_source_graph is nil") - } - if err := c.JoinBySourceGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field join_by_source_graph: %w", err) - } - b.Comma() - b.FieldStart("language_graph") - if c.LanguageGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field language_graph is nil") - } - if err := c.LanguageGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field language_graph: %w", err) - } - b.Comma() - b.FieldStart("message_interaction_graph") - if c.MessageInteractionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_interaction_graph is nil") - } - if err := c.MessageInteractionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_interaction_graph: %w", err) - } - b.Comma() - b.FieldStart("message_reaction_graph") - if c.MessageReactionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_reaction_graph is nil") - } - if err := c.MessageReactionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field message_reaction_graph: %w", err) - } - b.Comma() - b.FieldStart("story_interaction_graph") - if c.StoryInteractionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_interaction_graph is nil") - } - if err := c.StoryInteractionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_interaction_graph: %w", err) - } - b.Comma() - b.FieldStart("story_reaction_graph") - if c.StoryReactionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_reaction_graph is nil") - } - if err := c.StoryReactionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field story_reaction_graph: %w", err) - } - b.Comma() - b.FieldStart("instant_view_interaction_graph") - if c.InstantViewInteractionGraph == nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph is nil") - } - if err := c.InstantViewInteractionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph: %w", err) - } - b.Comma() - b.FieldStart("recent_interactions") - b.ArrStart() - for idx, v := range c.RecentInteractions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsChannel#b8e95b4: field recent_interactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatStatisticsChannel) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsChannel#b8e95b4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatStatisticsChannel"); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: %w", err) - } - case "period": - if err := c.Period.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field period: %w", err) - } - case "member_count": - if err := c.MemberCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field member_count: %w", err) - } - case "mean_message_view_count": - if err := c.MeanMessageViewCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_view_count: %w", err) - } - case "mean_message_share_count": - if err := c.MeanMessageShareCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_share_count: %w", err) - } - case "mean_message_reaction_count": - if err := c.MeanMessageReactionCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_message_reaction_count: %w", err) - } - case "mean_story_view_count": - if err := c.MeanStoryViewCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_view_count: %w", err) - } - case "mean_story_share_count": - if err := c.MeanStoryShareCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_share_count: %w", err) - } - case "mean_story_reaction_count": - if err := c.MeanStoryReactionCount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mean_story_reaction_count: %w", err) - } - case "enabled_notifications_percentage": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field enabled_notifications_percentage: %w", err) - } - c.EnabledNotificationsPercentage = value - case "member_count_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field member_count_graph: %w", err) - } - c.MemberCountGraph = value - case "join_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field join_graph: %w", err) - } - c.JoinGraph = value - case "mute_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field mute_graph: %w", err) - } - c.MuteGraph = value - case "view_count_by_hour_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field view_count_by_hour_graph: %w", err) - } - c.ViewCountByHourGraph = value - case "view_count_by_source_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field view_count_by_source_graph: %w", err) - } - c.ViewCountBySourceGraph = value - case "join_by_source_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field join_by_source_graph: %w", err) - } - c.JoinBySourceGraph = value - case "language_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field language_graph: %w", err) - } - c.LanguageGraph = value - case "message_interaction_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field message_interaction_graph: %w", err) - } - c.MessageInteractionGraph = value - case "message_reaction_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field message_reaction_graph: %w", err) - } - c.MessageReactionGraph = value - case "story_interaction_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field story_interaction_graph: %w", err) - } - c.StoryInteractionGraph = value - case "story_reaction_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field story_reaction_graph: %w", err) - } - c.StoryReactionGraph = value - case "instant_view_interaction_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field instant_view_interaction_graph: %w", err) - } - c.InstantViewInteractionGraph = value - case "recent_interactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatStatisticsInteractionInfo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field recent_interactions: %w", err) - } - c.RecentInteractions = append(c.RecentInteractions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chatStatisticsChannel#b8e95b4: field recent_interactions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPeriod returns value of Period field. -func (c *ChatStatisticsChannel) GetPeriod() (value DateRange) { - if c == nil { - return - } - return c.Period -} - -// GetMemberCount returns value of MemberCount field. -func (c *ChatStatisticsChannel) GetMemberCount() (value StatisticalValue) { - if c == nil { - return - } - return c.MemberCount -} - -// GetMeanMessageViewCount returns value of MeanMessageViewCount field. -func (c *ChatStatisticsChannel) GetMeanMessageViewCount() (value StatisticalValue) { - if c == nil { - return - } - return c.MeanMessageViewCount -} - -// GetMeanMessageShareCount returns value of MeanMessageShareCount field. -func (c *ChatStatisticsChannel) GetMeanMessageShareCount() (value StatisticalValue) { - if c == nil { - return - } - return c.MeanMessageShareCount -} - -// GetMeanMessageReactionCount returns value of MeanMessageReactionCount field. -func (c *ChatStatisticsChannel) GetMeanMessageReactionCount() (value StatisticalValue) { - if c == nil { - return - } - return c.MeanMessageReactionCount -} - -// GetMeanStoryViewCount returns value of MeanStoryViewCount field. -func (c *ChatStatisticsChannel) GetMeanStoryViewCount() (value StatisticalValue) { - if c == nil { - return - } - return c.MeanStoryViewCount -} - -// GetMeanStoryShareCount returns value of MeanStoryShareCount field. -func (c *ChatStatisticsChannel) GetMeanStoryShareCount() (value StatisticalValue) { - if c == nil { - return - } - return c.MeanStoryShareCount -} - -// GetMeanStoryReactionCount returns value of MeanStoryReactionCount field. -func (c *ChatStatisticsChannel) GetMeanStoryReactionCount() (value StatisticalValue) { - if c == nil { - return - } - return c.MeanStoryReactionCount -} - -// GetEnabledNotificationsPercentage returns value of EnabledNotificationsPercentage field. -func (c *ChatStatisticsChannel) GetEnabledNotificationsPercentage() (value float64) { - if c == nil { - return - } - return c.EnabledNotificationsPercentage -} - -// GetMemberCountGraph returns value of MemberCountGraph field. -func (c *ChatStatisticsChannel) GetMemberCountGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.MemberCountGraph -} - -// GetJoinGraph returns value of JoinGraph field. -func (c *ChatStatisticsChannel) GetJoinGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.JoinGraph -} - -// GetMuteGraph returns value of MuteGraph field. -func (c *ChatStatisticsChannel) GetMuteGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.MuteGraph -} - -// GetViewCountByHourGraph returns value of ViewCountByHourGraph field. -func (c *ChatStatisticsChannel) GetViewCountByHourGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.ViewCountByHourGraph -} - -// GetViewCountBySourceGraph returns value of ViewCountBySourceGraph field. -func (c *ChatStatisticsChannel) GetViewCountBySourceGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.ViewCountBySourceGraph -} - -// GetJoinBySourceGraph returns value of JoinBySourceGraph field. -func (c *ChatStatisticsChannel) GetJoinBySourceGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.JoinBySourceGraph -} - -// GetLanguageGraph returns value of LanguageGraph field. -func (c *ChatStatisticsChannel) GetLanguageGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.LanguageGraph -} - -// GetMessageInteractionGraph returns value of MessageInteractionGraph field. -func (c *ChatStatisticsChannel) GetMessageInteractionGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.MessageInteractionGraph -} - -// GetMessageReactionGraph returns value of MessageReactionGraph field. -func (c *ChatStatisticsChannel) GetMessageReactionGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.MessageReactionGraph -} - -// GetStoryInteractionGraph returns value of StoryInteractionGraph field. -func (c *ChatStatisticsChannel) GetStoryInteractionGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.StoryInteractionGraph -} - -// GetStoryReactionGraph returns value of StoryReactionGraph field. -func (c *ChatStatisticsChannel) GetStoryReactionGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.StoryReactionGraph -} - -// GetInstantViewInteractionGraph returns value of InstantViewInteractionGraph field. -func (c *ChatStatisticsChannel) GetInstantViewInteractionGraph() (value StatisticalGraphClass) { - if c == nil { - return - } - return c.InstantViewInteractionGraph -} - -// GetRecentInteractions returns value of RecentInteractions field. -func (c *ChatStatisticsChannel) GetRecentInteractions() (value []ChatStatisticsInteractionInfo) { - if c == nil { - return - } - return c.RecentInteractions -} - -// ChatStatisticsClassName is schema name of ChatStatisticsClass. -const ChatStatisticsClassName = "ChatStatistics" - -// ChatStatisticsClass represents ChatStatistics generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatStatistics(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatStatisticsSupergroup: // chatStatisticsSupergroup#c67549ef -// case *tdapi.ChatStatisticsChannel: // chatStatisticsChannel#b8e95b4 -// default: panic(v) -// } -type ChatStatisticsClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatStatisticsClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error - - // A period to which the statistics applies - GetPeriod() (value DateRange) - // Number of members in the chat - GetMemberCount() (value StatisticalValue) - // A graph containing number of members in the chat - GetMemberCountGraph() (value StatisticalGraphClass) - // A graph containing number of members joined and left the chat - GetJoinGraph() (value StatisticalGraphClass) - // A graph containing number of new member joins per source - GetJoinBySourceGraph() (value StatisticalGraphClass) - // A graph containing distribution of active users per language - GetLanguageGraph() (value StatisticalGraphClass) -} - -// DecodeChatStatistics implements binary de-serialization for ChatStatisticsClass. -func DecodeChatStatistics(buf *bin.Buffer) (ChatStatisticsClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatStatisticsSupergroupTypeID: - // Decoding chatStatisticsSupergroup#c67549ef. - v := ChatStatisticsSupergroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatStatisticsClass: %w", err) - } - return &v, nil - case ChatStatisticsChannelTypeID: - // Decoding chatStatisticsChannel#b8e95b4. - v := ChatStatisticsChannel{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatStatisticsClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatStatisticsClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatStatistics implements binary de-serialization for ChatStatisticsClass. -func DecodeTDLibJSONChatStatistics(buf tdjson.Decoder) (ChatStatisticsClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatStatisticsSupergroup": - // Decoding chatStatisticsSupergroup#c67549ef. - v := ChatStatisticsSupergroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatStatisticsClass: %w", err) - } - return &v, nil - case "chatStatisticsChannel": - // Decoding chatStatisticsChannel#b8e95b4. - v := ChatStatisticsChannel{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatStatisticsClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatStatisticsClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatStatistics boxes the ChatStatisticsClass providing a helper. -type ChatStatisticsBox struct { - ChatStatistics ChatStatisticsClass -} - -// Decode implements bin.Decoder for ChatStatisticsBox. -func (b *ChatStatisticsBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatStatisticsBox to nil") - } - v, err := DecodeChatStatistics(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatStatistics = v - return nil -} - -// Encode implements bin.Encode for ChatStatisticsBox. -func (b *ChatStatisticsBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatStatistics == nil { - return fmt.Errorf("unable to encode ChatStatisticsClass as nil") - } - return b.ChatStatistics.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatStatisticsBox. -func (b *ChatStatisticsBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatStatisticsBox to nil") - } - v, err := DecodeTDLibJSONChatStatistics(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatStatistics = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatStatisticsBox. -func (b *ChatStatisticsBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatStatistics == nil { - return fmt.Errorf("unable to encode ChatStatisticsClass as nil") - } - return b.ChatStatistics.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_statistics_interaction_info_gen.go b/tdapi/tl_chat_statistics_interaction_info_gen.go deleted file mode 100644 index 59e423e52..000000000 --- a/tdapi/tl_chat_statistics_interaction_info_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatStatisticsInteractionInfo represents TL type `chatStatisticsInteractionInfo#694a9a8d`. -type ChatStatisticsInteractionInfo struct { - // Type of the object - ObjectType ChatStatisticsObjectTypeClass - // Number of times the object was viewed - ViewCount int32 - // Number of times the object was forwarded - ForwardCount int32 - // Number of times reactions were added to the object - ReactionCount int32 -} - -// ChatStatisticsInteractionInfoTypeID is TL type id of ChatStatisticsInteractionInfo. -const ChatStatisticsInteractionInfoTypeID = 0x694a9a8d - -// Ensuring interfaces in compile-time for ChatStatisticsInteractionInfo. -var ( - _ bin.Encoder = &ChatStatisticsInteractionInfo{} - _ bin.Decoder = &ChatStatisticsInteractionInfo{} - _ bin.BareEncoder = &ChatStatisticsInteractionInfo{} - _ bin.BareDecoder = &ChatStatisticsInteractionInfo{} -) - -func (c *ChatStatisticsInteractionInfo) Zero() bool { - if c == nil { - return true - } - if !(c.ObjectType == nil) { - return false - } - if !(c.ViewCount == 0) { - return false - } - if !(c.ForwardCount == 0) { - return false - } - if !(c.ReactionCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatStatisticsInteractionInfo) String() string { - if c == nil { - return "ChatStatisticsInteractionInfo(nil)" - } - type Alias ChatStatisticsInteractionInfo - return fmt.Sprintf("ChatStatisticsInteractionInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatStatisticsInteractionInfo) TypeID() uint32 { - return ChatStatisticsInteractionInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatStatisticsInteractionInfo) TypeName() string { - return "chatStatisticsInteractionInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatStatisticsInteractionInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatStatisticsInteractionInfo", - ID: ChatStatisticsInteractionInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ObjectType", - SchemaName: "object_type", - }, - { - Name: "ViewCount", - SchemaName: "view_count", - }, - { - Name: "ForwardCount", - SchemaName: "forward_count", - }, - { - Name: "ReactionCount", - SchemaName: "reaction_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatStatisticsInteractionInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsInteractionInfo#694a9a8d as nil") - } - b.PutID(ChatStatisticsInteractionInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatStatisticsInteractionInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsInteractionInfo#694a9a8d as nil") - } - if c.ObjectType == nil { - return fmt.Errorf("unable to encode chatStatisticsInteractionInfo#694a9a8d: field object_type is nil") - } - if err := c.ObjectType.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsInteractionInfo#694a9a8d: field object_type: %w", err) - } - b.PutInt32(c.ViewCount) - b.PutInt32(c.ForwardCount) - b.PutInt32(c.ReactionCount) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatStatisticsInteractionInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsInteractionInfo#694a9a8d to nil") - } - if err := b.ConsumeID(ChatStatisticsInteractionInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatStatisticsInteractionInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsInteractionInfo#694a9a8d to nil") - } - { - value, err := DecodeChatStatisticsObjectType(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field object_type: %w", err) - } - c.ObjectType = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field view_count: %w", err) - } - c.ViewCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field forward_count: %w", err) - } - c.ForwardCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field reaction_count: %w", err) - } - c.ReactionCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatStatisticsInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsInteractionInfo#694a9a8d as nil") - } - b.ObjStart() - b.PutID("chatStatisticsInteractionInfo") - b.Comma() - b.FieldStart("object_type") - if c.ObjectType == nil { - return fmt.Errorf("unable to encode chatStatisticsInteractionInfo#694a9a8d: field object_type is nil") - } - if err := c.ObjectType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatStatisticsInteractionInfo#694a9a8d: field object_type: %w", err) - } - b.Comma() - b.FieldStart("view_count") - b.PutInt32(c.ViewCount) - b.Comma() - b.FieldStart("forward_count") - b.PutInt32(c.ForwardCount) - b.Comma() - b.FieldStart("reaction_count") - b.PutInt32(c.ReactionCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatStatisticsInteractionInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsInteractionInfo#694a9a8d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatStatisticsInteractionInfo"); err != nil { - return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: %w", err) - } - case "object_type": - value, err := DecodeTDLibJSONChatStatisticsObjectType(b) - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field object_type: %w", err) - } - c.ObjectType = value - case "view_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field view_count: %w", err) - } - c.ViewCount = value - case "forward_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field forward_count: %w", err) - } - c.ForwardCount = value - case "reaction_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInteractionInfo#694a9a8d: field reaction_count: %w", err) - } - c.ReactionCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetObjectType returns value of ObjectType field. -func (c *ChatStatisticsInteractionInfo) GetObjectType() (value ChatStatisticsObjectTypeClass) { - if c == nil { - return - } - return c.ObjectType -} - -// GetViewCount returns value of ViewCount field. -func (c *ChatStatisticsInteractionInfo) GetViewCount() (value int32) { - if c == nil { - return - } - return c.ViewCount -} - -// GetForwardCount returns value of ForwardCount field. -func (c *ChatStatisticsInteractionInfo) GetForwardCount() (value int32) { - if c == nil { - return - } - return c.ForwardCount -} - -// GetReactionCount returns value of ReactionCount field. -func (c *ChatStatisticsInteractionInfo) GetReactionCount() (value int32) { - if c == nil { - return - } - return c.ReactionCount -} diff --git a/tdapi/tl_chat_statistics_inviter_info_gen.go b/tdapi/tl_chat_statistics_inviter_info_gen.go deleted file mode 100644 index 13cc4ee22..000000000 --- a/tdapi/tl_chat_statistics_inviter_info_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatStatisticsInviterInfo represents TL type `chatStatisticsInviterInfo#2583d48b`. -type ChatStatisticsInviterInfo struct { - // User identifier - UserID int64 - // Number of new members invited by the user - AddedMemberCount int32 -} - -// ChatStatisticsInviterInfoTypeID is TL type id of ChatStatisticsInviterInfo. -const ChatStatisticsInviterInfoTypeID = 0x2583d48b - -// Ensuring interfaces in compile-time for ChatStatisticsInviterInfo. -var ( - _ bin.Encoder = &ChatStatisticsInviterInfo{} - _ bin.Decoder = &ChatStatisticsInviterInfo{} - _ bin.BareEncoder = &ChatStatisticsInviterInfo{} - _ bin.BareDecoder = &ChatStatisticsInviterInfo{} -) - -func (c *ChatStatisticsInviterInfo) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.AddedMemberCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatStatisticsInviterInfo) String() string { - if c == nil { - return "ChatStatisticsInviterInfo(nil)" - } - type Alias ChatStatisticsInviterInfo - return fmt.Sprintf("ChatStatisticsInviterInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatStatisticsInviterInfo) TypeID() uint32 { - return ChatStatisticsInviterInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatStatisticsInviterInfo) TypeName() string { - return "chatStatisticsInviterInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatStatisticsInviterInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatStatisticsInviterInfo", - ID: ChatStatisticsInviterInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "AddedMemberCount", - SchemaName: "added_member_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatStatisticsInviterInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsInviterInfo#2583d48b as nil") - } - b.PutID(ChatStatisticsInviterInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatStatisticsInviterInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsInviterInfo#2583d48b as nil") - } - b.PutInt53(c.UserID) - b.PutInt32(c.AddedMemberCount) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatStatisticsInviterInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsInviterInfo#2583d48b to nil") - } - if err := b.ConsumeID(ChatStatisticsInviterInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatStatisticsInviterInfo#2583d48b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatStatisticsInviterInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsInviterInfo#2583d48b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInviterInfo#2583d48b: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInviterInfo#2583d48b: field added_member_count: %w", err) - } - c.AddedMemberCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatStatisticsInviterInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsInviterInfo#2583d48b as nil") - } - b.ObjStart() - b.PutID("chatStatisticsInviterInfo") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("added_member_count") - b.PutInt32(c.AddedMemberCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatStatisticsInviterInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsInviterInfo#2583d48b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatStatisticsInviterInfo"); err != nil { - return fmt.Errorf("unable to decode chatStatisticsInviterInfo#2583d48b: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInviterInfo#2583d48b: field user_id: %w", err) - } - c.UserID = value - case "added_member_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsInviterInfo#2583d48b: field added_member_count: %w", err) - } - c.AddedMemberCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatStatisticsInviterInfo) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetAddedMemberCount returns value of AddedMemberCount field. -func (c *ChatStatisticsInviterInfo) GetAddedMemberCount() (value int32) { - if c == nil { - return - } - return c.AddedMemberCount -} diff --git a/tdapi/tl_chat_statistics_message_sender_info_gen.go b/tdapi/tl_chat_statistics_message_sender_info_gen.go deleted file mode 100644 index d92f1e1e9..000000000 --- a/tdapi/tl_chat_statistics_message_sender_info_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatStatisticsMessageSenderInfo represents TL type `chatStatisticsMessageSenderInfo#690a7e4b`. -type ChatStatisticsMessageSenderInfo struct { - // User identifier - UserID int64 - // Number of sent messages - SentMessageCount int32 - // Average number of characters in sent messages; 0 if unknown - AverageCharacterCount int32 -} - -// ChatStatisticsMessageSenderInfoTypeID is TL type id of ChatStatisticsMessageSenderInfo. -const ChatStatisticsMessageSenderInfoTypeID = 0x690a7e4b - -// Ensuring interfaces in compile-time for ChatStatisticsMessageSenderInfo. -var ( - _ bin.Encoder = &ChatStatisticsMessageSenderInfo{} - _ bin.Decoder = &ChatStatisticsMessageSenderInfo{} - _ bin.BareEncoder = &ChatStatisticsMessageSenderInfo{} - _ bin.BareDecoder = &ChatStatisticsMessageSenderInfo{} -) - -func (c *ChatStatisticsMessageSenderInfo) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.SentMessageCount == 0) { - return false - } - if !(c.AverageCharacterCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatStatisticsMessageSenderInfo) String() string { - if c == nil { - return "ChatStatisticsMessageSenderInfo(nil)" - } - type Alias ChatStatisticsMessageSenderInfo - return fmt.Sprintf("ChatStatisticsMessageSenderInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatStatisticsMessageSenderInfo) TypeID() uint32 { - return ChatStatisticsMessageSenderInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatStatisticsMessageSenderInfo) TypeName() string { - return "chatStatisticsMessageSenderInfo" -} - -// TypeInfo returns info about TL type. -func (c *ChatStatisticsMessageSenderInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatStatisticsMessageSenderInfo", - ID: ChatStatisticsMessageSenderInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "SentMessageCount", - SchemaName: "sent_message_count", - }, - { - Name: "AverageCharacterCount", - SchemaName: "average_character_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatStatisticsMessageSenderInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsMessageSenderInfo#690a7e4b as nil") - } - b.PutID(ChatStatisticsMessageSenderInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatStatisticsMessageSenderInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsMessageSenderInfo#690a7e4b as nil") - } - b.PutInt53(c.UserID) - b.PutInt32(c.SentMessageCount) - b.PutInt32(c.AverageCharacterCount) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatStatisticsMessageSenderInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsMessageSenderInfo#690a7e4b to nil") - } - if err := b.ConsumeID(ChatStatisticsMessageSenderInfoTypeID); err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageSenderInfo#690a7e4b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatStatisticsMessageSenderInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsMessageSenderInfo#690a7e4b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageSenderInfo#690a7e4b: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageSenderInfo#690a7e4b: field sent_message_count: %w", err) - } - c.SentMessageCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageSenderInfo#690a7e4b: field average_character_count: %w", err) - } - c.AverageCharacterCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatStatisticsMessageSenderInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsMessageSenderInfo#690a7e4b as nil") - } - b.ObjStart() - b.PutID("chatStatisticsMessageSenderInfo") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("sent_message_count") - b.PutInt32(c.SentMessageCount) - b.Comma() - b.FieldStart("average_character_count") - b.PutInt32(c.AverageCharacterCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatStatisticsMessageSenderInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsMessageSenderInfo#690a7e4b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatStatisticsMessageSenderInfo"); err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageSenderInfo#690a7e4b: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageSenderInfo#690a7e4b: field user_id: %w", err) - } - c.UserID = value - case "sent_message_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageSenderInfo#690a7e4b: field sent_message_count: %w", err) - } - c.SentMessageCount = value - case "average_character_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsMessageSenderInfo#690a7e4b: field average_character_count: %w", err) - } - c.AverageCharacterCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatStatisticsMessageSenderInfo) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetSentMessageCount returns value of SentMessageCount field. -func (c *ChatStatisticsMessageSenderInfo) GetSentMessageCount() (value int32) { - if c == nil { - return - } - return c.SentMessageCount -} - -// GetAverageCharacterCount returns value of AverageCharacterCount field. -func (c *ChatStatisticsMessageSenderInfo) GetAverageCharacterCount() (value int32) { - if c == nil { - return - } - return c.AverageCharacterCount -} diff --git a/tdapi/tl_chat_statistics_object_type_gen.go b/tdapi/tl_chat_statistics_object_type_gen.go deleted file mode 100644 index e8342dc14..000000000 --- a/tdapi/tl_chat_statistics_object_type_gen.go +++ /dev/null @@ -1,501 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatStatisticsObjectTypeMessage represents TL type `chatStatisticsObjectTypeMessage#6f9f24f6`. -type ChatStatisticsObjectTypeMessage struct { - // Message identifier - MessageID int64 -} - -// ChatStatisticsObjectTypeMessageTypeID is TL type id of ChatStatisticsObjectTypeMessage. -const ChatStatisticsObjectTypeMessageTypeID = 0x6f9f24f6 - -// construct implements constructor of ChatStatisticsObjectTypeClass. -func (c ChatStatisticsObjectTypeMessage) construct() ChatStatisticsObjectTypeClass { return &c } - -// Ensuring interfaces in compile-time for ChatStatisticsObjectTypeMessage. -var ( - _ bin.Encoder = &ChatStatisticsObjectTypeMessage{} - _ bin.Decoder = &ChatStatisticsObjectTypeMessage{} - _ bin.BareEncoder = &ChatStatisticsObjectTypeMessage{} - _ bin.BareDecoder = &ChatStatisticsObjectTypeMessage{} - - _ ChatStatisticsObjectTypeClass = &ChatStatisticsObjectTypeMessage{} -) - -func (c *ChatStatisticsObjectTypeMessage) Zero() bool { - if c == nil { - return true - } - if !(c.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatStatisticsObjectTypeMessage) String() string { - if c == nil { - return "ChatStatisticsObjectTypeMessage(nil)" - } - type Alias ChatStatisticsObjectTypeMessage - return fmt.Sprintf("ChatStatisticsObjectTypeMessage%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatStatisticsObjectTypeMessage) TypeID() uint32 { - return ChatStatisticsObjectTypeMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatStatisticsObjectTypeMessage) TypeName() string { - return "chatStatisticsObjectTypeMessage" -} - -// TypeInfo returns info about TL type. -func (c *ChatStatisticsObjectTypeMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatStatisticsObjectTypeMessage", - ID: ChatStatisticsObjectTypeMessageTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatStatisticsObjectTypeMessage) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsObjectTypeMessage#6f9f24f6 as nil") - } - b.PutID(ChatStatisticsObjectTypeMessageTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatStatisticsObjectTypeMessage) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsObjectTypeMessage#6f9f24f6 as nil") - } - b.PutInt53(c.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatStatisticsObjectTypeMessage) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsObjectTypeMessage#6f9f24f6 to nil") - } - if err := b.ConsumeID(ChatStatisticsObjectTypeMessageTypeID); err != nil { - return fmt.Errorf("unable to decode chatStatisticsObjectTypeMessage#6f9f24f6: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatStatisticsObjectTypeMessage) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsObjectTypeMessage#6f9f24f6 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsObjectTypeMessage#6f9f24f6: field message_id: %w", err) - } - c.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatStatisticsObjectTypeMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsObjectTypeMessage#6f9f24f6 as nil") - } - b.ObjStart() - b.PutID("chatStatisticsObjectTypeMessage") - b.Comma() - b.FieldStart("message_id") - b.PutInt53(c.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatStatisticsObjectTypeMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsObjectTypeMessage#6f9f24f6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatStatisticsObjectTypeMessage"); err != nil { - return fmt.Errorf("unable to decode chatStatisticsObjectTypeMessage#6f9f24f6: %w", err) - } - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsObjectTypeMessage#6f9f24f6: field message_id: %w", err) - } - c.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageID returns value of MessageID field. -func (c *ChatStatisticsObjectTypeMessage) GetMessageID() (value int64) { - if c == nil { - return - } - return c.MessageID -} - -// ChatStatisticsObjectTypeStory represents TL type `chatStatisticsObjectTypeStory#15baf9b0`. -type ChatStatisticsObjectTypeStory struct { - // Story identifier - StoryID int32 -} - -// ChatStatisticsObjectTypeStoryTypeID is TL type id of ChatStatisticsObjectTypeStory. -const ChatStatisticsObjectTypeStoryTypeID = 0x15baf9b0 - -// construct implements constructor of ChatStatisticsObjectTypeClass. -func (c ChatStatisticsObjectTypeStory) construct() ChatStatisticsObjectTypeClass { return &c } - -// Ensuring interfaces in compile-time for ChatStatisticsObjectTypeStory. -var ( - _ bin.Encoder = &ChatStatisticsObjectTypeStory{} - _ bin.Decoder = &ChatStatisticsObjectTypeStory{} - _ bin.BareEncoder = &ChatStatisticsObjectTypeStory{} - _ bin.BareDecoder = &ChatStatisticsObjectTypeStory{} - - _ ChatStatisticsObjectTypeClass = &ChatStatisticsObjectTypeStory{} -) - -func (c *ChatStatisticsObjectTypeStory) Zero() bool { - if c == nil { - return true - } - if !(c.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatStatisticsObjectTypeStory) String() string { - if c == nil { - return "ChatStatisticsObjectTypeStory(nil)" - } - type Alias ChatStatisticsObjectTypeStory - return fmt.Sprintf("ChatStatisticsObjectTypeStory%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatStatisticsObjectTypeStory) TypeID() uint32 { - return ChatStatisticsObjectTypeStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatStatisticsObjectTypeStory) TypeName() string { - return "chatStatisticsObjectTypeStory" -} - -// TypeInfo returns info about TL type. -func (c *ChatStatisticsObjectTypeStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatStatisticsObjectTypeStory", - ID: ChatStatisticsObjectTypeStoryTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatStatisticsObjectTypeStory) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsObjectTypeStory#15baf9b0 as nil") - } - b.PutID(ChatStatisticsObjectTypeStoryTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatStatisticsObjectTypeStory) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsObjectTypeStory#15baf9b0 as nil") - } - b.PutInt32(c.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatStatisticsObjectTypeStory) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsObjectTypeStory#15baf9b0 to nil") - } - if err := b.ConsumeID(ChatStatisticsObjectTypeStoryTypeID); err != nil { - return fmt.Errorf("unable to decode chatStatisticsObjectTypeStory#15baf9b0: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatStatisticsObjectTypeStory) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsObjectTypeStory#15baf9b0 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsObjectTypeStory#15baf9b0: field story_id: %w", err) - } - c.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatStatisticsObjectTypeStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatStatisticsObjectTypeStory#15baf9b0 as nil") - } - b.ObjStart() - b.PutID("chatStatisticsObjectTypeStory") - b.Comma() - b.FieldStart("story_id") - b.PutInt32(c.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatStatisticsObjectTypeStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatStatisticsObjectTypeStory#15baf9b0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatStatisticsObjectTypeStory"); err != nil { - return fmt.Errorf("unable to decode chatStatisticsObjectTypeStory#15baf9b0: %w", err) - } - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatStatisticsObjectTypeStory#15baf9b0: field story_id: %w", err) - } - c.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStoryID returns value of StoryID field. -func (c *ChatStatisticsObjectTypeStory) GetStoryID() (value int32) { - if c == nil { - return - } - return c.StoryID -} - -// ChatStatisticsObjectTypeClassName is schema name of ChatStatisticsObjectTypeClass. -const ChatStatisticsObjectTypeClassName = "ChatStatisticsObjectType" - -// ChatStatisticsObjectTypeClass represents ChatStatisticsObjectType generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatStatisticsObjectType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatStatisticsObjectTypeMessage: // chatStatisticsObjectTypeMessage#6f9f24f6 -// case *tdapi.ChatStatisticsObjectTypeStory: // chatStatisticsObjectTypeStory#15baf9b0 -// default: panic(v) -// } -type ChatStatisticsObjectTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatStatisticsObjectTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeChatStatisticsObjectType implements binary de-serialization for ChatStatisticsObjectTypeClass. -func DecodeChatStatisticsObjectType(buf *bin.Buffer) (ChatStatisticsObjectTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatStatisticsObjectTypeMessageTypeID: - // Decoding chatStatisticsObjectTypeMessage#6f9f24f6. - v := ChatStatisticsObjectTypeMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", err) - } - return &v, nil - case ChatStatisticsObjectTypeStoryTypeID: - // Decoding chatStatisticsObjectTypeStory#15baf9b0. - v := ChatStatisticsObjectTypeStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatStatisticsObjectType implements binary de-serialization for ChatStatisticsObjectTypeClass. -func DecodeTDLibJSONChatStatisticsObjectType(buf tdjson.Decoder) (ChatStatisticsObjectTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatStatisticsObjectTypeMessage": - // Decoding chatStatisticsObjectTypeMessage#6f9f24f6. - v := ChatStatisticsObjectTypeMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", err) - } - return &v, nil - case "chatStatisticsObjectTypeStory": - // Decoding chatStatisticsObjectTypeStory#15baf9b0. - v := ChatStatisticsObjectTypeStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatStatisticsObjectTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatStatisticsObjectType boxes the ChatStatisticsObjectTypeClass providing a helper. -type ChatStatisticsObjectTypeBox struct { - ChatStatisticsObjectType ChatStatisticsObjectTypeClass -} - -// Decode implements bin.Decoder for ChatStatisticsObjectTypeBox. -func (b *ChatStatisticsObjectTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatStatisticsObjectTypeBox to nil") - } - v, err := DecodeChatStatisticsObjectType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatStatisticsObjectType = v - return nil -} - -// Encode implements bin.Encode for ChatStatisticsObjectTypeBox. -func (b *ChatStatisticsObjectTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatStatisticsObjectType == nil { - return fmt.Errorf("unable to encode ChatStatisticsObjectTypeClass as nil") - } - return b.ChatStatisticsObjectType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatStatisticsObjectTypeBox. -func (b *ChatStatisticsObjectTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatStatisticsObjectTypeBox to nil") - } - v, err := DecodeTDLibJSONChatStatisticsObjectType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatStatisticsObjectType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatStatisticsObjectTypeBox. -func (b *ChatStatisticsObjectTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatStatisticsObjectType == nil { - return fmt.Errorf("unable to encode ChatStatisticsObjectTypeClass as nil") - } - return b.ChatStatisticsObjectType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chat_theme_gen.go b/tdapi/tl_chat_theme_gen.go deleted file mode 100644 index 1c11b48a6..000000000 --- a/tdapi/tl_chat_theme_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatTheme represents TL type `chatTheme#f9406c39`. -type ChatTheme struct { - // Theme name - Name string - // Theme settings for a light chat theme - LightSettings ThemeSettings - // Theme settings for a dark chat theme - DarkSettings ThemeSettings -} - -// ChatThemeTypeID is TL type id of ChatTheme. -const ChatThemeTypeID = 0xf9406c39 - -// Ensuring interfaces in compile-time for ChatTheme. -var ( - _ bin.Encoder = &ChatTheme{} - _ bin.Decoder = &ChatTheme{} - _ bin.BareEncoder = &ChatTheme{} - _ bin.BareDecoder = &ChatTheme{} -) - -func (c *ChatTheme) Zero() bool { - if c == nil { - return true - } - if !(c.Name == "") { - return false - } - if !(c.LightSettings.Zero()) { - return false - } - if !(c.DarkSettings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatTheme) String() string { - if c == nil { - return "ChatTheme(nil)" - } - type Alias ChatTheme - return fmt.Sprintf("ChatTheme%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatTheme) TypeID() uint32 { - return ChatThemeTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatTheme) TypeName() string { - return "chatTheme" -} - -// TypeInfo returns info about TL type. -func (c *ChatTheme) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatTheme", - ID: ChatThemeTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "LightSettings", - SchemaName: "light_settings", - }, - { - Name: "DarkSettings", - SchemaName: "dark_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatTheme) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatTheme#f9406c39 as nil") - } - b.PutID(ChatThemeTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatTheme) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatTheme#f9406c39 as nil") - } - b.PutString(c.Name) - if err := c.LightSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatTheme#f9406c39: field light_settings: %w", err) - } - if err := c.DarkSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode chatTheme#f9406c39: field dark_settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatTheme) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatTheme#f9406c39 to nil") - } - if err := b.ConsumeID(ChatThemeTypeID); err != nil { - return fmt.Errorf("unable to decode chatTheme#f9406c39: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatTheme) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatTheme#f9406c39 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatTheme#f9406c39: field name: %w", err) - } - c.Name = value - } - { - if err := c.LightSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatTheme#f9406c39: field light_settings: %w", err) - } - } - { - if err := c.DarkSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode chatTheme#f9406c39: field dark_settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatTheme) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatTheme#f9406c39 as nil") - } - b.ObjStart() - b.PutID("chatTheme") - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.FieldStart("light_settings") - if err := c.LightSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatTheme#f9406c39: field light_settings: %w", err) - } - b.Comma() - b.FieldStart("dark_settings") - if err := c.DarkSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode chatTheme#f9406c39: field dark_settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatTheme) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatTheme#f9406c39 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatTheme"); err != nil { - return fmt.Errorf("unable to decode chatTheme#f9406c39: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode chatTheme#f9406c39: field name: %w", err) - } - c.Name = value - case "light_settings": - if err := c.LightSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatTheme#f9406c39: field light_settings: %w", err) - } - case "dark_settings": - if err := c.DarkSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode chatTheme#f9406c39: field dark_settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (c *ChatTheme) GetName() (value string) { - if c == nil { - return - } - return c.Name -} - -// GetLightSettings returns value of LightSettings field. -func (c *ChatTheme) GetLightSettings() (value ThemeSettings) { - if c == nil { - return - } - return c.LightSettings -} - -// GetDarkSettings returns value of DarkSettings field. -func (c *ChatTheme) GetDarkSettings() (value ThemeSettings) { - if c == nil { - return - } - return c.DarkSettings -} diff --git a/tdapi/tl_chat_type_gen.go b/tdapi/tl_chat_type_gen.go deleted file mode 100644 index 1d0bee6b7..000000000 --- a/tdapi/tl_chat_type_gen.go +++ /dev/null @@ -1,931 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ChatTypePrivate represents TL type `chatTypePrivate#5e1e6374`. -type ChatTypePrivate struct { - // User identifier - UserID int64 -} - -// ChatTypePrivateTypeID is TL type id of ChatTypePrivate. -const ChatTypePrivateTypeID = 0x5e1e6374 - -// construct implements constructor of ChatTypeClass. -func (c ChatTypePrivate) construct() ChatTypeClass { return &c } - -// Ensuring interfaces in compile-time for ChatTypePrivate. -var ( - _ bin.Encoder = &ChatTypePrivate{} - _ bin.Decoder = &ChatTypePrivate{} - _ bin.BareEncoder = &ChatTypePrivate{} - _ bin.BareDecoder = &ChatTypePrivate{} - - _ ChatTypeClass = &ChatTypePrivate{} -) - -func (c *ChatTypePrivate) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatTypePrivate) String() string { - if c == nil { - return "ChatTypePrivate(nil)" - } - type Alias ChatTypePrivate - return fmt.Sprintf("ChatTypePrivate%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatTypePrivate) TypeID() uint32 { - return ChatTypePrivateTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatTypePrivate) TypeName() string { - return "chatTypePrivate" -} - -// TypeInfo returns info about TL type. -func (c *ChatTypePrivate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatTypePrivate", - ID: ChatTypePrivateTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatTypePrivate) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatTypePrivate#5e1e6374 as nil") - } - b.PutID(ChatTypePrivateTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatTypePrivate) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatTypePrivate#5e1e6374 as nil") - } - b.PutInt53(c.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatTypePrivate) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatTypePrivate#5e1e6374 to nil") - } - if err := b.ConsumeID(ChatTypePrivateTypeID); err != nil { - return fmt.Errorf("unable to decode chatTypePrivate#5e1e6374: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatTypePrivate) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatTypePrivate#5e1e6374 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatTypePrivate#5e1e6374: field user_id: %w", err) - } - c.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatTypePrivate) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatTypePrivate#5e1e6374 as nil") - } - b.ObjStart() - b.PutID("chatTypePrivate") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatTypePrivate) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatTypePrivate#5e1e6374 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatTypePrivate"); err != nil { - return fmt.Errorf("unable to decode chatTypePrivate#5e1e6374: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatTypePrivate#5e1e6374: field user_id: %w", err) - } - c.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *ChatTypePrivate) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// ChatTypeBasicGroup represents TL type `chatTypeBasicGroup#3a0c4c5c`. -type ChatTypeBasicGroup struct { - // Basic group identifier - BasicGroupID int64 -} - -// ChatTypeBasicGroupTypeID is TL type id of ChatTypeBasicGroup. -const ChatTypeBasicGroupTypeID = 0x3a0c4c5c - -// construct implements constructor of ChatTypeClass. -func (c ChatTypeBasicGroup) construct() ChatTypeClass { return &c } - -// Ensuring interfaces in compile-time for ChatTypeBasicGroup. -var ( - _ bin.Encoder = &ChatTypeBasicGroup{} - _ bin.Decoder = &ChatTypeBasicGroup{} - _ bin.BareEncoder = &ChatTypeBasicGroup{} - _ bin.BareDecoder = &ChatTypeBasicGroup{} - - _ ChatTypeClass = &ChatTypeBasicGroup{} -) - -func (c *ChatTypeBasicGroup) Zero() bool { - if c == nil { - return true - } - if !(c.BasicGroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatTypeBasicGroup) String() string { - if c == nil { - return "ChatTypeBasicGroup(nil)" - } - type Alias ChatTypeBasicGroup - return fmt.Sprintf("ChatTypeBasicGroup%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatTypeBasicGroup) TypeID() uint32 { - return ChatTypeBasicGroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatTypeBasicGroup) TypeName() string { - return "chatTypeBasicGroup" -} - -// TypeInfo returns info about TL type. -func (c *ChatTypeBasicGroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatTypeBasicGroup", - ID: ChatTypeBasicGroupTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BasicGroupID", - SchemaName: "basic_group_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatTypeBasicGroup) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatTypeBasicGroup#3a0c4c5c as nil") - } - b.PutID(ChatTypeBasicGroupTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatTypeBasicGroup) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatTypeBasicGroup#3a0c4c5c as nil") - } - b.PutInt53(c.BasicGroupID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatTypeBasicGroup) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatTypeBasicGroup#3a0c4c5c to nil") - } - if err := b.ConsumeID(ChatTypeBasicGroupTypeID); err != nil { - return fmt.Errorf("unable to decode chatTypeBasicGroup#3a0c4c5c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatTypeBasicGroup) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatTypeBasicGroup#3a0c4c5c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatTypeBasicGroup#3a0c4c5c: field basic_group_id: %w", err) - } - c.BasicGroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatTypeBasicGroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatTypeBasicGroup#3a0c4c5c as nil") - } - b.ObjStart() - b.PutID("chatTypeBasicGroup") - b.Comma() - b.FieldStart("basic_group_id") - b.PutInt53(c.BasicGroupID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatTypeBasicGroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatTypeBasicGroup#3a0c4c5c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatTypeBasicGroup"); err != nil { - return fmt.Errorf("unable to decode chatTypeBasicGroup#3a0c4c5c: %w", err) - } - case "basic_group_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatTypeBasicGroup#3a0c4c5c: field basic_group_id: %w", err) - } - c.BasicGroupID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBasicGroupID returns value of BasicGroupID field. -func (c *ChatTypeBasicGroup) GetBasicGroupID() (value int64) { - if c == nil { - return - } - return c.BasicGroupID -} - -// ChatTypeSupergroup represents TL type `chatTypeSupergroup#a83a5a6a`. -type ChatTypeSupergroup struct { - // Supergroup or channel identifier - SupergroupID int64 - // True, if the supergroup is a channel - IsChannel bool -} - -// ChatTypeSupergroupTypeID is TL type id of ChatTypeSupergroup. -const ChatTypeSupergroupTypeID = 0xa83a5a6a - -// construct implements constructor of ChatTypeClass. -func (c ChatTypeSupergroup) construct() ChatTypeClass { return &c } - -// Ensuring interfaces in compile-time for ChatTypeSupergroup. -var ( - _ bin.Encoder = &ChatTypeSupergroup{} - _ bin.Decoder = &ChatTypeSupergroup{} - _ bin.BareEncoder = &ChatTypeSupergroup{} - _ bin.BareDecoder = &ChatTypeSupergroup{} - - _ ChatTypeClass = &ChatTypeSupergroup{} -) - -func (c *ChatTypeSupergroup) Zero() bool { - if c == nil { - return true - } - if !(c.SupergroupID == 0) { - return false - } - if !(c.IsChannel == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatTypeSupergroup) String() string { - if c == nil { - return "ChatTypeSupergroup(nil)" - } - type Alias ChatTypeSupergroup - return fmt.Sprintf("ChatTypeSupergroup%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatTypeSupergroup) TypeID() uint32 { - return ChatTypeSupergroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatTypeSupergroup) TypeName() string { - return "chatTypeSupergroup" -} - -// TypeInfo returns info about TL type. -func (c *ChatTypeSupergroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatTypeSupergroup", - ID: ChatTypeSupergroupTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "IsChannel", - SchemaName: "is_channel", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatTypeSupergroup) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatTypeSupergroup#a83a5a6a as nil") - } - b.PutID(ChatTypeSupergroupTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatTypeSupergroup) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatTypeSupergroup#a83a5a6a as nil") - } - b.PutInt53(c.SupergroupID) - b.PutBool(c.IsChannel) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatTypeSupergroup) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatTypeSupergroup#a83a5a6a to nil") - } - if err := b.ConsumeID(ChatTypeSupergroupTypeID); err != nil { - return fmt.Errorf("unable to decode chatTypeSupergroup#a83a5a6a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatTypeSupergroup) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatTypeSupergroup#a83a5a6a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatTypeSupergroup#a83a5a6a: field supergroup_id: %w", err) - } - c.SupergroupID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatTypeSupergroup#a83a5a6a: field is_channel: %w", err) - } - c.IsChannel = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatTypeSupergroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatTypeSupergroup#a83a5a6a as nil") - } - b.ObjStart() - b.PutID("chatTypeSupergroup") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(c.SupergroupID) - b.Comma() - b.FieldStart("is_channel") - b.PutBool(c.IsChannel) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatTypeSupergroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatTypeSupergroup#a83a5a6a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatTypeSupergroup"); err != nil { - return fmt.Errorf("unable to decode chatTypeSupergroup#a83a5a6a: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatTypeSupergroup#a83a5a6a: field supergroup_id: %w", err) - } - c.SupergroupID = value - case "is_channel": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode chatTypeSupergroup#a83a5a6a: field is_channel: %w", err) - } - c.IsChannel = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (c *ChatTypeSupergroup) GetSupergroupID() (value int64) { - if c == nil { - return - } - return c.SupergroupID -} - -// GetIsChannel returns value of IsChannel field. -func (c *ChatTypeSupergroup) GetIsChannel() (value bool) { - if c == nil { - return - } - return c.IsChannel -} - -// ChatTypeSecret represents TL type `chatTypeSecret#3366ab31`. -type ChatTypeSecret struct { - // Secret chat identifier - SecretChatID int32 - // User identifier of the other user in the secret chat - UserID int64 -} - -// ChatTypeSecretTypeID is TL type id of ChatTypeSecret. -const ChatTypeSecretTypeID = 0x3366ab31 - -// construct implements constructor of ChatTypeClass. -func (c ChatTypeSecret) construct() ChatTypeClass { return &c } - -// Ensuring interfaces in compile-time for ChatTypeSecret. -var ( - _ bin.Encoder = &ChatTypeSecret{} - _ bin.Decoder = &ChatTypeSecret{} - _ bin.BareEncoder = &ChatTypeSecret{} - _ bin.BareDecoder = &ChatTypeSecret{} - - _ ChatTypeClass = &ChatTypeSecret{} -) - -func (c *ChatTypeSecret) Zero() bool { - if c == nil { - return true - } - if !(c.SecretChatID == 0) { - return false - } - if !(c.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ChatTypeSecret) String() string { - if c == nil { - return "ChatTypeSecret(nil)" - } - type Alias ChatTypeSecret - return fmt.Sprintf("ChatTypeSecret%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ChatTypeSecret) TypeID() uint32 { - return ChatTypeSecretTypeID -} - -// TypeName returns name of type in TL schema. -func (*ChatTypeSecret) TypeName() string { - return "chatTypeSecret" -} - -// TypeInfo returns info about TL type. -func (c *ChatTypeSecret) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chatTypeSecret", - ID: ChatTypeSecretTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SecretChatID", - SchemaName: "secret_chat_id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ChatTypeSecret) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatTypeSecret#3366ab31 as nil") - } - b.PutID(ChatTypeSecretTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ChatTypeSecret) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chatTypeSecret#3366ab31 as nil") - } - b.PutInt32(c.SecretChatID) - b.PutInt53(c.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ChatTypeSecret) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatTypeSecret#3366ab31 to nil") - } - if err := b.ConsumeID(ChatTypeSecretTypeID); err != nil { - return fmt.Errorf("unable to decode chatTypeSecret#3366ab31: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ChatTypeSecret) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chatTypeSecret#3366ab31 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatTypeSecret#3366ab31: field secret_chat_id: %w", err) - } - c.SecretChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatTypeSecret#3366ab31: field user_id: %w", err) - } - c.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ChatTypeSecret) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chatTypeSecret#3366ab31 as nil") - } - b.ObjStart() - b.PutID("chatTypeSecret") - b.Comma() - b.FieldStart("secret_chat_id") - b.PutInt32(c.SecretChatID) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ChatTypeSecret) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chatTypeSecret#3366ab31 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chatTypeSecret"); err != nil { - return fmt.Errorf("unable to decode chatTypeSecret#3366ab31: %w", err) - } - case "secret_chat_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chatTypeSecret#3366ab31: field secret_chat_id: %w", err) - } - c.SecretChatID = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chatTypeSecret#3366ab31: field user_id: %w", err) - } - c.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSecretChatID returns value of SecretChatID field. -func (c *ChatTypeSecret) GetSecretChatID() (value int32) { - if c == nil { - return - } - return c.SecretChatID -} - -// GetUserID returns value of UserID field. -func (c *ChatTypeSecret) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// ChatTypeClassName is schema name of ChatTypeClass. -const ChatTypeClassName = "ChatType" - -// ChatTypeClass represents ChatType generic type. -// -// Example: -// -// g, err := tdapi.DecodeChatType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ChatTypePrivate: // chatTypePrivate#5e1e6374 -// case *tdapi.ChatTypeBasicGroup: // chatTypeBasicGroup#3a0c4c5c -// case *tdapi.ChatTypeSupergroup: // chatTypeSupergroup#a83a5a6a -// case *tdapi.ChatTypeSecret: // chatTypeSecret#3366ab31 -// default: panic(v) -// } -type ChatTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ChatTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeChatType implements binary de-serialization for ChatTypeClass. -func DecodeChatType(buf *bin.Buffer) (ChatTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ChatTypePrivateTypeID: - // Decoding chatTypePrivate#5e1e6374. - v := ChatTypePrivate{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatTypeClass: %w", err) - } - return &v, nil - case ChatTypeBasicGroupTypeID: - // Decoding chatTypeBasicGroup#3a0c4c5c. - v := ChatTypeBasicGroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatTypeClass: %w", err) - } - return &v, nil - case ChatTypeSupergroupTypeID: - // Decoding chatTypeSupergroup#a83a5a6a. - v := ChatTypeSupergroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatTypeClass: %w", err) - } - return &v, nil - case ChatTypeSecretTypeID: - // Decoding chatTypeSecret#3366ab31. - v := ChatTypeSecret{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONChatType implements binary de-serialization for ChatTypeClass. -func DecodeTDLibJSONChatType(buf tdjson.Decoder) (ChatTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "chatTypePrivate": - // Decoding chatTypePrivate#5e1e6374. - v := ChatTypePrivate{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatTypeClass: %w", err) - } - return &v, nil - case "chatTypeBasicGroup": - // Decoding chatTypeBasicGroup#3a0c4c5c. - v := ChatTypeBasicGroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatTypeClass: %w", err) - } - return &v, nil - case "chatTypeSupergroup": - // Decoding chatTypeSupergroup#a83a5a6a. - v := ChatTypeSupergroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatTypeClass: %w", err) - } - return &v, nil - case "chatTypeSecret": - // Decoding chatTypeSecret#3366ab31. - v := ChatTypeSecret{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ChatTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ChatTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ChatType boxes the ChatTypeClass providing a helper. -type ChatTypeBox struct { - ChatType ChatTypeClass -} - -// Decode implements bin.Decoder for ChatTypeBox. -func (b *ChatTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ChatTypeBox to nil") - } - v, err := DecodeChatType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatType = v - return nil -} - -// Encode implements bin.Encode for ChatTypeBox. -func (b *ChatTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ChatType == nil { - return fmt.Errorf("unable to encode ChatTypeClass as nil") - } - return b.ChatType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ChatTypeBox. -func (b *ChatTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ChatTypeBox to nil") - } - v, err := DecodeTDLibJSONChatType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ChatType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ChatTypeBox. -func (b *ChatTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ChatType == nil { - return fmt.Errorf("unable to encode ChatTypeClass as nil") - } - return b.ChatType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_chats_gen.go b/tdapi/tl_chats_gen.go deleted file mode 100644 index 58ae16c05..000000000 --- a/tdapi/tl_chats_gen.go +++ /dev/null @@ -1,251 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Chats represents TL type `chats#9b93e3eb`. -type Chats struct { - // Approximate total number of chats found - TotalCount int32 - // List of chat identifiers - ChatIDs []int64 -} - -// ChatsTypeID is TL type id of Chats. -const ChatsTypeID = 0x9b93e3eb - -// Ensuring interfaces in compile-time for Chats. -var ( - _ bin.Encoder = &Chats{} - _ bin.Decoder = &Chats{} - _ bin.BareEncoder = &Chats{} - _ bin.BareDecoder = &Chats{} -) - -func (c *Chats) Zero() bool { - if c == nil { - return true - } - if !(c.TotalCount == 0) { - return false - } - if !(c.ChatIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *Chats) String() string { - if c == nil { - return "Chats(nil)" - } - type Alias Chats - return fmt.Sprintf("Chats%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Chats) TypeID() uint32 { - return ChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*Chats) TypeName() string { - return "chats" -} - -// TypeInfo returns info about TL type. -func (c *Chats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "chats", - ID: ChatsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "ChatIDs", - SchemaName: "chat_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *Chats) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chats#9b93e3eb as nil") - } - b.PutID(ChatsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *Chats) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode chats#9b93e3eb as nil") - } - b.PutInt32(c.TotalCount) - b.PutInt(len(c.ChatIDs)) - for _, v := range c.ChatIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *Chats) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chats#9b93e3eb to nil") - } - if err := b.ConsumeID(ChatsTypeID); err != nil { - return fmt.Errorf("unable to decode chats#9b93e3eb: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *Chats) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode chats#9b93e3eb to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chats#9b93e3eb: field total_count: %w", err) - } - c.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode chats#9b93e3eb: field chat_ids: %w", err) - } - - if headerLen > 0 { - c.ChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chats#9b93e3eb: field chat_ids: %w", err) - } - c.ChatIDs = append(c.ChatIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *Chats) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode chats#9b93e3eb as nil") - } - b.ObjStart() - b.PutID("chats") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(c.TotalCount) - b.Comma() - b.FieldStart("chat_ids") - b.ArrStart() - for _, v := range c.ChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *Chats) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode chats#9b93e3eb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("chats"); err != nil { - return fmt.Errorf("unable to decode chats#9b93e3eb: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode chats#9b93e3eb: field total_count: %w", err) - } - c.TotalCount = value - case "chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode chats#9b93e3eb: field chat_ids: %w", err) - } - c.ChatIDs = append(c.ChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode chats#9b93e3eb: field chat_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (c *Chats) GetTotalCount() (value int32) { - if c == nil { - return - } - return c.TotalCount -} - -// GetChatIDs returns value of ChatIDs field. -func (c *Chats) GetChatIDs() (value []int64) { - if c == nil { - return - } - return c.ChatIDs -} diff --git a/tdapi/tl_check_authentication_bot_token_gen.go b/tdapi/tl_check_authentication_bot_token_gen.go deleted file mode 100644 index 1a718b3bb..000000000 --- a/tdapi/tl_check_authentication_bot_token_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckAuthenticationBotTokenRequest represents TL type `checkAuthenticationBotToken#261b4476`. -type CheckAuthenticationBotTokenRequest struct { - // The bot token - Token string -} - -// CheckAuthenticationBotTokenRequestTypeID is TL type id of CheckAuthenticationBotTokenRequest. -const CheckAuthenticationBotTokenRequestTypeID = 0x261b4476 - -// Ensuring interfaces in compile-time for CheckAuthenticationBotTokenRequest. -var ( - _ bin.Encoder = &CheckAuthenticationBotTokenRequest{} - _ bin.Decoder = &CheckAuthenticationBotTokenRequest{} - _ bin.BareEncoder = &CheckAuthenticationBotTokenRequest{} - _ bin.BareDecoder = &CheckAuthenticationBotTokenRequest{} -) - -func (c *CheckAuthenticationBotTokenRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Token == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckAuthenticationBotTokenRequest) String() string { - if c == nil { - return "CheckAuthenticationBotTokenRequest(nil)" - } - type Alias CheckAuthenticationBotTokenRequest - return fmt.Sprintf("CheckAuthenticationBotTokenRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckAuthenticationBotTokenRequest) TypeID() uint32 { - return CheckAuthenticationBotTokenRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckAuthenticationBotTokenRequest) TypeName() string { - return "checkAuthenticationBotToken" -} - -// TypeInfo returns info about TL type. -func (c *CheckAuthenticationBotTokenRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkAuthenticationBotToken", - ID: CheckAuthenticationBotTokenRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckAuthenticationBotTokenRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationBotToken#261b4476 as nil") - } - b.PutID(CheckAuthenticationBotTokenRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckAuthenticationBotTokenRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationBotToken#261b4476 as nil") - } - b.PutString(c.Token) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckAuthenticationBotTokenRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationBotToken#261b4476 to nil") - } - if err := b.ConsumeID(CheckAuthenticationBotTokenRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkAuthenticationBotToken#261b4476: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckAuthenticationBotTokenRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationBotToken#261b4476 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkAuthenticationBotToken#261b4476: field token: %w", err) - } - c.Token = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckAuthenticationBotTokenRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationBotToken#261b4476 as nil") - } - b.ObjStart() - b.PutID("checkAuthenticationBotToken") - b.Comma() - b.FieldStart("token") - b.PutString(c.Token) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckAuthenticationBotTokenRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationBotToken#261b4476 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkAuthenticationBotToken"); err != nil { - return fmt.Errorf("unable to decode checkAuthenticationBotToken#261b4476: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkAuthenticationBotToken#261b4476: field token: %w", err) - } - c.Token = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (c *CheckAuthenticationBotTokenRequest) GetToken() (value string) { - if c == nil { - return - } - return c.Token -} - -// CheckAuthenticationBotToken invokes method checkAuthenticationBotToken#261b4476 returning error if any. -func (c *Client) CheckAuthenticationBotToken(ctx context.Context, token string) error { - var ok Ok - - request := &CheckAuthenticationBotTokenRequest{ - Token: token, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_check_authentication_code_gen.go b/tdapi/tl_check_authentication_code_gen.go deleted file mode 100644 index a66fc189b..000000000 --- a/tdapi/tl_check_authentication_code_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckAuthenticationCodeRequest represents TL type `checkAuthenticationCode#edfe44aa`. -type CheckAuthenticationCodeRequest struct { - // Authentication code to check - Code string -} - -// CheckAuthenticationCodeRequestTypeID is TL type id of CheckAuthenticationCodeRequest. -const CheckAuthenticationCodeRequestTypeID = 0xedfe44aa - -// Ensuring interfaces in compile-time for CheckAuthenticationCodeRequest. -var ( - _ bin.Encoder = &CheckAuthenticationCodeRequest{} - _ bin.Decoder = &CheckAuthenticationCodeRequest{} - _ bin.BareEncoder = &CheckAuthenticationCodeRequest{} - _ bin.BareDecoder = &CheckAuthenticationCodeRequest{} -) - -func (c *CheckAuthenticationCodeRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Code == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckAuthenticationCodeRequest) String() string { - if c == nil { - return "CheckAuthenticationCodeRequest(nil)" - } - type Alias CheckAuthenticationCodeRequest - return fmt.Sprintf("CheckAuthenticationCodeRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckAuthenticationCodeRequest) TypeID() uint32 { - return CheckAuthenticationCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckAuthenticationCodeRequest) TypeName() string { - return "checkAuthenticationCode" -} - -// TypeInfo returns info about TL type. -func (c *CheckAuthenticationCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkAuthenticationCode", - ID: CheckAuthenticationCodeRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckAuthenticationCodeRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationCode#edfe44aa as nil") - } - b.PutID(CheckAuthenticationCodeRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckAuthenticationCodeRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationCode#edfe44aa as nil") - } - b.PutString(c.Code) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckAuthenticationCodeRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationCode#edfe44aa to nil") - } - if err := b.ConsumeID(CheckAuthenticationCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkAuthenticationCode#edfe44aa: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckAuthenticationCodeRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationCode#edfe44aa to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkAuthenticationCode#edfe44aa: field code: %w", err) - } - c.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckAuthenticationCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationCode#edfe44aa as nil") - } - b.ObjStart() - b.PutID("checkAuthenticationCode") - b.Comma() - b.FieldStart("code") - b.PutString(c.Code) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckAuthenticationCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationCode#edfe44aa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkAuthenticationCode"); err != nil { - return fmt.Errorf("unable to decode checkAuthenticationCode#edfe44aa: %w", err) - } - case "code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkAuthenticationCode#edfe44aa: field code: %w", err) - } - c.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (c *CheckAuthenticationCodeRequest) GetCode() (value string) { - if c == nil { - return - } - return c.Code -} - -// CheckAuthenticationCode invokes method checkAuthenticationCode#edfe44aa returning error if any. -func (c *Client) CheckAuthenticationCode(ctx context.Context, code string) error { - var ok Ok - - request := &CheckAuthenticationCodeRequest{ - Code: code, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_check_authentication_email_code_gen.go b/tdapi/tl_check_authentication_email_code_gen.go deleted file mode 100644 index 7b4b454e2..000000000 --- a/tdapi/tl_check_authentication_email_code_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckAuthenticationEmailCodeRequest represents TL type `checkAuthenticationEmailCode#dd42c29f`. -type CheckAuthenticationEmailCodeRequest struct { - // Email address authentication to check - Code EmailAddressAuthenticationClass -} - -// CheckAuthenticationEmailCodeRequestTypeID is TL type id of CheckAuthenticationEmailCodeRequest. -const CheckAuthenticationEmailCodeRequestTypeID = 0xdd42c29f - -// Ensuring interfaces in compile-time for CheckAuthenticationEmailCodeRequest. -var ( - _ bin.Encoder = &CheckAuthenticationEmailCodeRequest{} - _ bin.Decoder = &CheckAuthenticationEmailCodeRequest{} - _ bin.BareEncoder = &CheckAuthenticationEmailCodeRequest{} - _ bin.BareDecoder = &CheckAuthenticationEmailCodeRequest{} -) - -func (c *CheckAuthenticationEmailCodeRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Code == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckAuthenticationEmailCodeRequest) String() string { - if c == nil { - return "CheckAuthenticationEmailCodeRequest(nil)" - } - type Alias CheckAuthenticationEmailCodeRequest - return fmt.Sprintf("CheckAuthenticationEmailCodeRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckAuthenticationEmailCodeRequest) TypeID() uint32 { - return CheckAuthenticationEmailCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckAuthenticationEmailCodeRequest) TypeName() string { - return "checkAuthenticationEmailCode" -} - -// TypeInfo returns info about TL type. -func (c *CheckAuthenticationEmailCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkAuthenticationEmailCode", - ID: CheckAuthenticationEmailCodeRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckAuthenticationEmailCodeRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationEmailCode#dd42c29f as nil") - } - b.PutID(CheckAuthenticationEmailCodeRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckAuthenticationEmailCodeRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationEmailCode#dd42c29f as nil") - } - if c.Code == nil { - return fmt.Errorf("unable to encode checkAuthenticationEmailCode#dd42c29f: field code is nil") - } - if err := c.Code.Encode(b); err != nil { - return fmt.Errorf("unable to encode checkAuthenticationEmailCode#dd42c29f: field code: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckAuthenticationEmailCodeRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationEmailCode#dd42c29f to nil") - } - if err := b.ConsumeID(CheckAuthenticationEmailCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkAuthenticationEmailCode#dd42c29f: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckAuthenticationEmailCodeRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationEmailCode#dd42c29f to nil") - } - { - value, err := DecodeEmailAddressAuthentication(b) - if err != nil { - return fmt.Errorf("unable to decode checkAuthenticationEmailCode#dd42c29f: field code: %w", err) - } - c.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckAuthenticationEmailCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationEmailCode#dd42c29f as nil") - } - b.ObjStart() - b.PutID("checkAuthenticationEmailCode") - b.Comma() - b.FieldStart("code") - if c.Code == nil { - return fmt.Errorf("unable to encode checkAuthenticationEmailCode#dd42c29f: field code is nil") - } - if err := c.Code.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode checkAuthenticationEmailCode#dd42c29f: field code: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckAuthenticationEmailCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationEmailCode#dd42c29f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkAuthenticationEmailCode"); err != nil { - return fmt.Errorf("unable to decode checkAuthenticationEmailCode#dd42c29f: %w", err) - } - case "code": - value, err := DecodeTDLibJSONEmailAddressAuthentication(b) - if err != nil { - return fmt.Errorf("unable to decode checkAuthenticationEmailCode#dd42c29f: field code: %w", err) - } - c.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (c *CheckAuthenticationEmailCodeRequest) GetCode() (value EmailAddressAuthenticationClass) { - if c == nil { - return - } - return c.Code -} - -// CheckAuthenticationEmailCode invokes method checkAuthenticationEmailCode#dd42c29f returning error if any. -func (c *Client) CheckAuthenticationEmailCode(ctx context.Context, code EmailAddressAuthenticationClass) error { - var ok Ok - - request := &CheckAuthenticationEmailCodeRequest{ - Code: code, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_check_authentication_password_gen.go b/tdapi/tl_check_authentication_password_gen.go deleted file mode 100644 index 6c3fa5ae2..000000000 --- a/tdapi/tl_check_authentication_password_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckAuthenticationPasswordRequest represents TL type `checkAuthenticationPassword#87424ba0`. -type CheckAuthenticationPasswordRequest struct { - // The 2-step verification password to check - Password string -} - -// CheckAuthenticationPasswordRequestTypeID is TL type id of CheckAuthenticationPasswordRequest. -const CheckAuthenticationPasswordRequestTypeID = 0x87424ba0 - -// Ensuring interfaces in compile-time for CheckAuthenticationPasswordRequest. -var ( - _ bin.Encoder = &CheckAuthenticationPasswordRequest{} - _ bin.Decoder = &CheckAuthenticationPasswordRequest{} - _ bin.BareEncoder = &CheckAuthenticationPasswordRequest{} - _ bin.BareDecoder = &CheckAuthenticationPasswordRequest{} -) - -func (c *CheckAuthenticationPasswordRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Password == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckAuthenticationPasswordRequest) String() string { - if c == nil { - return "CheckAuthenticationPasswordRequest(nil)" - } - type Alias CheckAuthenticationPasswordRequest - return fmt.Sprintf("CheckAuthenticationPasswordRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckAuthenticationPasswordRequest) TypeID() uint32 { - return CheckAuthenticationPasswordRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckAuthenticationPasswordRequest) TypeName() string { - return "checkAuthenticationPassword" -} - -// TypeInfo returns info about TL type. -func (c *CheckAuthenticationPasswordRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkAuthenticationPassword", - ID: CheckAuthenticationPasswordRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckAuthenticationPasswordRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationPassword#87424ba0 as nil") - } - b.PutID(CheckAuthenticationPasswordRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckAuthenticationPasswordRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationPassword#87424ba0 as nil") - } - b.PutString(c.Password) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckAuthenticationPasswordRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationPassword#87424ba0 to nil") - } - if err := b.ConsumeID(CheckAuthenticationPasswordRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkAuthenticationPassword#87424ba0: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckAuthenticationPasswordRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationPassword#87424ba0 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkAuthenticationPassword#87424ba0: field password: %w", err) - } - c.Password = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckAuthenticationPasswordRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationPassword#87424ba0 as nil") - } - b.ObjStart() - b.PutID("checkAuthenticationPassword") - b.Comma() - b.FieldStart("password") - b.PutString(c.Password) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckAuthenticationPasswordRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationPassword#87424ba0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkAuthenticationPassword"); err != nil { - return fmt.Errorf("unable to decode checkAuthenticationPassword#87424ba0: %w", err) - } - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkAuthenticationPassword#87424ba0: field password: %w", err) - } - c.Password = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPassword returns value of Password field. -func (c *CheckAuthenticationPasswordRequest) GetPassword() (value string) { - if c == nil { - return - } - return c.Password -} - -// CheckAuthenticationPassword invokes method checkAuthenticationPassword#87424ba0 returning error if any. -func (c *Client) CheckAuthenticationPassword(ctx context.Context, password string) error { - var ok Ok - - request := &CheckAuthenticationPasswordRequest{ - Password: password, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_check_authentication_password_recovery_code_gen.go b/tdapi/tl_check_authentication_password_recovery_code_gen.go deleted file mode 100644 index 2e9af21e8..000000000 --- a/tdapi/tl_check_authentication_password_recovery_code_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckAuthenticationPasswordRecoveryCodeRequest represents TL type `checkAuthenticationPasswordRecoveryCode#dc0a3be5`. -type CheckAuthenticationPasswordRecoveryCodeRequest struct { - // Recovery code to check - RecoveryCode string -} - -// CheckAuthenticationPasswordRecoveryCodeRequestTypeID is TL type id of CheckAuthenticationPasswordRecoveryCodeRequest. -const CheckAuthenticationPasswordRecoveryCodeRequestTypeID = 0xdc0a3be5 - -// Ensuring interfaces in compile-time for CheckAuthenticationPasswordRecoveryCodeRequest. -var ( - _ bin.Encoder = &CheckAuthenticationPasswordRecoveryCodeRequest{} - _ bin.Decoder = &CheckAuthenticationPasswordRecoveryCodeRequest{} - _ bin.BareEncoder = &CheckAuthenticationPasswordRecoveryCodeRequest{} - _ bin.BareDecoder = &CheckAuthenticationPasswordRecoveryCodeRequest{} -) - -func (c *CheckAuthenticationPasswordRecoveryCodeRequest) Zero() bool { - if c == nil { - return true - } - if !(c.RecoveryCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckAuthenticationPasswordRecoveryCodeRequest) String() string { - if c == nil { - return "CheckAuthenticationPasswordRecoveryCodeRequest(nil)" - } - type Alias CheckAuthenticationPasswordRecoveryCodeRequest - return fmt.Sprintf("CheckAuthenticationPasswordRecoveryCodeRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckAuthenticationPasswordRecoveryCodeRequest) TypeID() uint32 { - return CheckAuthenticationPasswordRecoveryCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckAuthenticationPasswordRecoveryCodeRequest) TypeName() string { - return "checkAuthenticationPasswordRecoveryCode" -} - -// TypeInfo returns info about TL type. -func (c *CheckAuthenticationPasswordRecoveryCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkAuthenticationPasswordRecoveryCode", - ID: CheckAuthenticationPasswordRecoveryCodeRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RecoveryCode", - SchemaName: "recovery_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckAuthenticationPasswordRecoveryCodeRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationPasswordRecoveryCode#dc0a3be5 as nil") - } - b.PutID(CheckAuthenticationPasswordRecoveryCodeRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckAuthenticationPasswordRecoveryCodeRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationPasswordRecoveryCode#dc0a3be5 as nil") - } - b.PutString(c.RecoveryCode) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckAuthenticationPasswordRecoveryCodeRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationPasswordRecoveryCode#dc0a3be5 to nil") - } - if err := b.ConsumeID(CheckAuthenticationPasswordRecoveryCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkAuthenticationPasswordRecoveryCode#dc0a3be5: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckAuthenticationPasswordRecoveryCodeRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationPasswordRecoveryCode#dc0a3be5 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkAuthenticationPasswordRecoveryCode#dc0a3be5: field recovery_code: %w", err) - } - c.RecoveryCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckAuthenticationPasswordRecoveryCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkAuthenticationPasswordRecoveryCode#dc0a3be5 as nil") - } - b.ObjStart() - b.PutID("checkAuthenticationPasswordRecoveryCode") - b.Comma() - b.FieldStart("recovery_code") - b.PutString(c.RecoveryCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckAuthenticationPasswordRecoveryCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkAuthenticationPasswordRecoveryCode#dc0a3be5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkAuthenticationPasswordRecoveryCode"); err != nil { - return fmt.Errorf("unable to decode checkAuthenticationPasswordRecoveryCode#dc0a3be5: %w", err) - } - case "recovery_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkAuthenticationPasswordRecoveryCode#dc0a3be5: field recovery_code: %w", err) - } - c.RecoveryCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRecoveryCode returns value of RecoveryCode field. -func (c *CheckAuthenticationPasswordRecoveryCodeRequest) GetRecoveryCode() (value string) { - if c == nil { - return - } - return c.RecoveryCode -} - -// CheckAuthenticationPasswordRecoveryCode invokes method checkAuthenticationPasswordRecoveryCode#dc0a3be5 returning error if any. -func (c *Client) CheckAuthenticationPasswordRecoveryCode(ctx context.Context, recoverycode string) error { - var ok Ok - - request := &CheckAuthenticationPasswordRecoveryCodeRequest{ - RecoveryCode: recoverycode, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_check_chat_folder_invite_link_gen.go b/tdapi/tl_check_chat_folder_invite_link_gen.go deleted file mode 100644 index 2dcb759d7..000000000 --- a/tdapi/tl_check_chat_folder_invite_link_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckChatFolderInviteLinkRequest represents TL type `checkChatFolderInviteLink#1f25999b`. -type CheckChatFolderInviteLinkRequest struct { - // Invite link to be checked - InviteLink string -} - -// CheckChatFolderInviteLinkRequestTypeID is TL type id of CheckChatFolderInviteLinkRequest. -const CheckChatFolderInviteLinkRequestTypeID = 0x1f25999b - -// Ensuring interfaces in compile-time for CheckChatFolderInviteLinkRequest. -var ( - _ bin.Encoder = &CheckChatFolderInviteLinkRequest{} - _ bin.Decoder = &CheckChatFolderInviteLinkRequest{} - _ bin.BareEncoder = &CheckChatFolderInviteLinkRequest{} - _ bin.BareDecoder = &CheckChatFolderInviteLinkRequest{} -) - -func (c *CheckChatFolderInviteLinkRequest) Zero() bool { - if c == nil { - return true - } - if !(c.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckChatFolderInviteLinkRequest) String() string { - if c == nil { - return "CheckChatFolderInviteLinkRequest(nil)" - } - type Alias CheckChatFolderInviteLinkRequest - return fmt.Sprintf("CheckChatFolderInviteLinkRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckChatFolderInviteLinkRequest) TypeID() uint32 { - return CheckChatFolderInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckChatFolderInviteLinkRequest) TypeName() string { - return "checkChatFolderInviteLink" -} - -// TypeInfo returns info about TL type. -func (c *CheckChatFolderInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkChatFolderInviteLink", - ID: CheckChatFolderInviteLinkRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckChatFolderInviteLinkRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatFolderInviteLink#1f25999b as nil") - } - b.PutID(CheckChatFolderInviteLinkRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckChatFolderInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatFolderInviteLink#1f25999b as nil") - } - b.PutString(c.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckChatFolderInviteLinkRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatFolderInviteLink#1f25999b to nil") - } - if err := b.ConsumeID(CheckChatFolderInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkChatFolderInviteLink#1f25999b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckChatFolderInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatFolderInviteLink#1f25999b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkChatFolderInviteLink#1f25999b: field invite_link: %w", err) - } - c.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckChatFolderInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkChatFolderInviteLink#1f25999b as nil") - } - b.ObjStart() - b.PutID("checkChatFolderInviteLink") - b.Comma() - b.FieldStart("invite_link") - b.PutString(c.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckChatFolderInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkChatFolderInviteLink#1f25999b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkChatFolderInviteLink"); err != nil { - return fmt.Errorf("unable to decode checkChatFolderInviteLink#1f25999b: %w", err) - } - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkChatFolderInviteLink#1f25999b: field invite_link: %w", err) - } - c.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (c *CheckChatFolderInviteLinkRequest) GetInviteLink() (value string) { - if c == nil { - return - } - return c.InviteLink -} - -// CheckChatFolderInviteLink invokes method checkChatFolderInviteLink#1f25999b returning error if any. -func (c *Client) CheckChatFolderInviteLink(ctx context.Context, invitelink string) (*ChatFolderInviteLinkInfo, error) { - var result ChatFolderInviteLinkInfo - - request := &CheckChatFolderInviteLinkRequest{ - InviteLink: invitelink, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_check_chat_invite_link_gen.go b/tdapi/tl_check_chat_invite_link_gen.go deleted file mode 100644 index 308e4c397..000000000 --- a/tdapi/tl_check_chat_invite_link_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckChatInviteLinkRequest represents TL type `checkChatInviteLink#e261483b`. -type CheckChatInviteLinkRequest struct { - // Invite link to be checked - InviteLink string -} - -// CheckChatInviteLinkRequestTypeID is TL type id of CheckChatInviteLinkRequest. -const CheckChatInviteLinkRequestTypeID = 0xe261483b - -// Ensuring interfaces in compile-time for CheckChatInviteLinkRequest. -var ( - _ bin.Encoder = &CheckChatInviteLinkRequest{} - _ bin.Decoder = &CheckChatInviteLinkRequest{} - _ bin.BareEncoder = &CheckChatInviteLinkRequest{} - _ bin.BareDecoder = &CheckChatInviteLinkRequest{} -) - -func (c *CheckChatInviteLinkRequest) Zero() bool { - if c == nil { - return true - } - if !(c.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckChatInviteLinkRequest) String() string { - if c == nil { - return "CheckChatInviteLinkRequest(nil)" - } - type Alias CheckChatInviteLinkRequest - return fmt.Sprintf("CheckChatInviteLinkRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckChatInviteLinkRequest) TypeID() uint32 { - return CheckChatInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckChatInviteLinkRequest) TypeName() string { - return "checkChatInviteLink" -} - -// TypeInfo returns info about TL type. -func (c *CheckChatInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkChatInviteLink", - ID: CheckChatInviteLinkRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckChatInviteLinkRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatInviteLink#e261483b as nil") - } - b.PutID(CheckChatInviteLinkRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckChatInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatInviteLink#e261483b as nil") - } - b.PutString(c.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckChatInviteLinkRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatInviteLink#e261483b to nil") - } - if err := b.ConsumeID(CheckChatInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkChatInviteLink#e261483b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckChatInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatInviteLink#e261483b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkChatInviteLink#e261483b: field invite_link: %w", err) - } - c.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckChatInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkChatInviteLink#e261483b as nil") - } - b.ObjStart() - b.PutID("checkChatInviteLink") - b.Comma() - b.FieldStart("invite_link") - b.PutString(c.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckChatInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkChatInviteLink#e261483b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkChatInviteLink"); err != nil { - return fmt.Errorf("unable to decode checkChatInviteLink#e261483b: %w", err) - } - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkChatInviteLink#e261483b: field invite_link: %w", err) - } - c.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (c *CheckChatInviteLinkRequest) GetInviteLink() (value string) { - if c == nil { - return - } - return c.InviteLink -} - -// CheckChatInviteLink invokes method checkChatInviteLink#e261483b returning error if any. -func (c *Client) CheckChatInviteLink(ctx context.Context, invitelink string) (*ChatInviteLinkInfo, error) { - var result ChatInviteLinkInfo - - request := &CheckChatInviteLinkRequest{ - InviteLink: invitelink, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_check_chat_username_gen.go b/tdapi/tl_check_chat_username_gen.go deleted file mode 100644 index 5f89eb7b2..000000000 --- a/tdapi/tl_check_chat_username_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckChatUsernameRequest represents TL type `checkChatUsername#f8e66210`. -type CheckChatUsernameRequest struct { - // Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a - // private chat with self, or 0 if the chat is being created - ChatID int64 - // Username to be checked - Username string -} - -// CheckChatUsernameRequestTypeID is TL type id of CheckChatUsernameRequest. -const CheckChatUsernameRequestTypeID = 0xf8e66210 - -// Ensuring interfaces in compile-time for CheckChatUsernameRequest. -var ( - _ bin.Encoder = &CheckChatUsernameRequest{} - _ bin.Decoder = &CheckChatUsernameRequest{} - _ bin.BareEncoder = &CheckChatUsernameRequest{} - _ bin.BareDecoder = &CheckChatUsernameRequest{} -) - -func (c *CheckChatUsernameRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.Username == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckChatUsernameRequest) String() string { - if c == nil { - return "CheckChatUsernameRequest(nil)" - } - type Alias CheckChatUsernameRequest - return fmt.Sprintf("CheckChatUsernameRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckChatUsernameRequest) TypeID() uint32 { - return CheckChatUsernameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckChatUsernameRequest) TypeName() string { - return "checkChatUsername" -} - -// TypeInfo returns info about TL type. -func (c *CheckChatUsernameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkChatUsername", - ID: CheckChatUsernameRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Username", - SchemaName: "username", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckChatUsernameRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsername#f8e66210 as nil") - } - b.PutID(CheckChatUsernameRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckChatUsernameRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsername#f8e66210 as nil") - } - b.PutInt53(c.ChatID) - b.PutString(c.Username) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckChatUsernameRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsername#f8e66210 to nil") - } - if err := b.ConsumeID(CheckChatUsernameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkChatUsername#f8e66210: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckChatUsernameRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsername#f8e66210 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode checkChatUsername#f8e66210: field chat_id: %w", err) - } - c.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkChatUsername#f8e66210: field username: %w", err) - } - c.Username = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckChatUsernameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsername#f8e66210 as nil") - } - b.ObjStart() - b.PutID("checkChatUsername") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("username") - b.PutString(c.Username) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckChatUsernameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsername#f8e66210 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkChatUsername"); err != nil { - return fmt.Errorf("unable to decode checkChatUsername#f8e66210: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode checkChatUsername#f8e66210: field chat_id: %w", err) - } - c.ChatID = value - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkChatUsername#f8e66210: field username: %w", err) - } - c.Username = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *CheckChatUsernameRequest) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetUsername returns value of Username field. -func (c *CheckChatUsernameRequest) GetUsername() (value string) { - if c == nil { - return - } - return c.Username -} - -// CheckChatUsername invokes method checkChatUsername#f8e66210 returning error if any. -func (c *Client) CheckChatUsername(ctx context.Context, request *CheckChatUsernameRequest) (CheckChatUsernameResultClass, error) { - var result CheckChatUsernameResultBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.CheckChatUsernameResult, nil -} diff --git a/tdapi/tl_check_chat_username_result_gen.go b/tdapi/tl_check_chat_username_result_gen.go deleted file mode 100644 index c753dedf0..000000000 --- a/tdapi/tl_check_chat_username_result_gen.go +++ /dev/null @@ -1,1021 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckChatUsernameResultOk represents TL type `checkChatUsernameResultOk#a6a7bb5c`. -type CheckChatUsernameResultOk struct { -} - -// CheckChatUsernameResultOkTypeID is TL type id of CheckChatUsernameResultOk. -const CheckChatUsernameResultOkTypeID = 0xa6a7bb5c - -// construct implements constructor of CheckChatUsernameResultClass. -func (c CheckChatUsernameResultOk) construct() CheckChatUsernameResultClass { return &c } - -// Ensuring interfaces in compile-time for CheckChatUsernameResultOk. -var ( - _ bin.Encoder = &CheckChatUsernameResultOk{} - _ bin.Decoder = &CheckChatUsernameResultOk{} - _ bin.BareEncoder = &CheckChatUsernameResultOk{} - _ bin.BareDecoder = &CheckChatUsernameResultOk{} - - _ CheckChatUsernameResultClass = &CheckChatUsernameResultOk{} -) - -func (c *CheckChatUsernameResultOk) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckChatUsernameResultOk) String() string { - if c == nil { - return "CheckChatUsernameResultOk(nil)" - } - type Alias CheckChatUsernameResultOk - return fmt.Sprintf("CheckChatUsernameResultOk%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckChatUsernameResultOk) TypeID() uint32 { - return CheckChatUsernameResultOkTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckChatUsernameResultOk) TypeName() string { - return "checkChatUsernameResultOk" -} - -// TypeInfo returns info about TL type. -func (c *CheckChatUsernameResultOk) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkChatUsernameResultOk", - ID: CheckChatUsernameResultOkTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckChatUsernameResultOk) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultOk#a6a7bb5c as nil") - } - b.PutID(CheckChatUsernameResultOkTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckChatUsernameResultOk) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultOk#a6a7bb5c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckChatUsernameResultOk) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultOk#a6a7bb5c to nil") - } - if err := b.ConsumeID(CheckChatUsernameResultOkTypeID); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultOk#a6a7bb5c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckChatUsernameResultOk) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultOk#a6a7bb5c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckChatUsernameResultOk) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultOk#a6a7bb5c as nil") - } - b.ObjStart() - b.PutID("checkChatUsernameResultOk") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckChatUsernameResultOk) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultOk#a6a7bb5c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkChatUsernameResultOk"); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultOk#a6a7bb5c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CheckChatUsernameResultUsernameInvalid represents TL type `checkChatUsernameResultUsernameInvalid#da087756`. -type CheckChatUsernameResultUsernameInvalid struct { -} - -// CheckChatUsernameResultUsernameInvalidTypeID is TL type id of CheckChatUsernameResultUsernameInvalid. -const CheckChatUsernameResultUsernameInvalidTypeID = 0xda087756 - -// construct implements constructor of CheckChatUsernameResultClass. -func (c CheckChatUsernameResultUsernameInvalid) construct() CheckChatUsernameResultClass { return &c } - -// Ensuring interfaces in compile-time for CheckChatUsernameResultUsernameInvalid. -var ( - _ bin.Encoder = &CheckChatUsernameResultUsernameInvalid{} - _ bin.Decoder = &CheckChatUsernameResultUsernameInvalid{} - _ bin.BareEncoder = &CheckChatUsernameResultUsernameInvalid{} - _ bin.BareDecoder = &CheckChatUsernameResultUsernameInvalid{} - - _ CheckChatUsernameResultClass = &CheckChatUsernameResultUsernameInvalid{} -) - -func (c *CheckChatUsernameResultUsernameInvalid) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckChatUsernameResultUsernameInvalid) String() string { - if c == nil { - return "CheckChatUsernameResultUsernameInvalid(nil)" - } - type Alias CheckChatUsernameResultUsernameInvalid - return fmt.Sprintf("CheckChatUsernameResultUsernameInvalid%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckChatUsernameResultUsernameInvalid) TypeID() uint32 { - return CheckChatUsernameResultUsernameInvalidTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckChatUsernameResultUsernameInvalid) TypeName() string { - return "checkChatUsernameResultUsernameInvalid" -} - -// TypeInfo returns info about TL type. -func (c *CheckChatUsernameResultUsernameInvalid) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkChatUsernameResultUsernameInvalid", - ID: CheckChatUsernameResultUsernameInvalidTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckChatUsernameResultUsernameInvalid) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultUsernameInvalid#da087756 as nil") - } - b.PutID(CheckChatUsernameResultUsernameInvalidTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckChatUsernameResultUsernameInvalid) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultUsernameInvalid#da087756 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckChatUsernameResultUsernameInvalid) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultUsernameInvalid#da087756 to nil") - } - if err := b.ConsumeID(CheckChatUsernameResultUsernameInvalidTypeID); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultUsernameInvalid#da087756: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckChatUsernameResultUsernameInvalid) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultUsernameInvalid#da087756 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckChatUsernameResultUsernameInvalid) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultUsernameInvalid#da087756 as nil") - } - b.ObjStart() - b.PutID("checkChatUsernameResultUsernameInvalid") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckChatUsernameResultUsernameInvalid) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultUsernameInvalid#da087756 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkChatUsernameResultUsernameInvalid"); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultUsernameInvalid#da087756: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CheckChatUsernameResultUsernameOccupied represents TL type `checkChatUsernameResultUsernameOccupied#4ebb3729`. -type CheckChatUsernameResultUsernameOccupied struct { -} - -// CheckChatUsernameResultUsernameOccupiedTypeID is TL type id of CheckChatUsernameResultUsernameOccupied. -const CheckChatUsernameResultUsernameOccupiedTypeID = 0x4ebb3729 - -// construct implements constructor of CheckChatUsernameResultClass. -func (c CheckChatUsernameResultUsernameOccupied) construct() CheckChatUsernameResultClass { return &c } - -// Ensuring interfaces in compile-time for CheckChatUsernameResultUsernameOccupied. -var ( - _ bin.Encoder = &CheckChatUsernameResultUsernameOccupied{} - _ bin.Decoder = &CheckChatUsernameResultUsernameOccupied{} - _ bin.BareEncoder = &CheckChatUsernameResultUsernameOccupied{} - _ bin.BareDecoder = &CheckChatUsernameResultUsernameOccupied{} - - _ CheckChatUsernameResultClass = &CheckChatUsernameResultUsernameOccupied{} -) - -func (c *CheckChatUsernameResultUsernameOccupied) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckChatUsernameResultUsernameOccupied) String() string { - if c == nil { - return "CheckChatUsernameResultUsernameOccupied(nil)" - } - type Alias CheckChatUsernameResultUsernameOccupied - return fmt.Sprintf("CheckChatUsernameResultUsernameOccupied%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckChatUsernameResultUsernameOccupied) TypeID() uint32 { - return CheckChatUsernameResultUsernameOccupiedTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckChatUsernameResultUsernameOccupied) TypeName() string { - return "checkChatUsernameResultUsernameOccupied" -} - -// TypeInfo returns info about TL type. -func (c *CheckChatUsernameResultUsernameOccupied) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkChatUsernameResultUsernameOccupied", - ID: CheckChatUsernameResultUsernameOccupiedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckChatUsernameResultUsernameOccupied) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultUsernameOccupied#4ebb3729 as nil") - } - b.PutID(CheckChatUsernameResultUsernameOccupiedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckChatUsernameResultUsernameOccupied) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultUsernameOccupied#4ebb3729 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckChatUsernameResultUsernameOccupied) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultUsernameOccupied#4ebb3729 to nil") - } - if err := b.ConsumeID(CheckChatUsernameResultUsernameOccupiedTypeID); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultUsernameOccupied#4ebb3729: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckChatUsernameResultUsernameOccupied) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultUsernameOccupied#4ebb3729 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckChatUsernameResultUsernameOccupied) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultUsernameOccupied#4ebb3729 as nil") - } - b.ObjStart() - b.PutID("checkChatUsernameResultUsernameOccupied") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckChatUsernameResultUsernameOccupied) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultUsernameOccupied#4ebb3729 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkChatUsernameResultUsernameOccupied"); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultUsernameOccupied#4ebb3729: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CheckChatUsernameResultUsernamePurchasable represents TL type `checkChatUsernameResultUsernamePurchasable#59ce59`. -type CheckChatUsernameResultUsernamePurchasable struct { -} - -// CheckChatUsernameResultUsernamePurchasableTypeID is TL type id of CheckChatUsernameResultUsernamePurchasable. -const CheckChatUsernameResultUsernamePurchasableTypeID = 0x59ce59 - -// construct implements constructor of CheckChatUsernameResultClass. -func (c CheckChatUsernameResultUsernamePurchasable) construct() CheckChatUsernameResultClass { - return &c -} - -// Ensuring interfaces in compile-time for CheckChatUsernameResultUsernamePurchasable. -var ( - _ bin.Encoder = &CheckChatUsernameResultUsernamePurchasable{} - _ bin.Decoder = &CheckChatUsernameResultUsernamePurchasable{} - _ bin.BareEncoder = &CheckChatUsernameResultUsernamePurchasable{} - _ bin.BareDecoder = &CheckChatUsernameResultUsernamePurchasable{} - - _ CheckChatUsernameResultClass = &CheckChatUsernameResultUsernamePurchasable{} -) - -func (c *CheckChatUsernameResultUsernamePurchasable) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckChatUsernameResultUsernamePurchasable) String() string { - if c == nil { - return "CheckChatUsernameResultUsernamePurchasable(nil)" - } - type Alias CheckChatUsernameResultUsernamePurchasable - return fmt.Sprintf("CheckChatUsernameResultUsernamePurchasable%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckChatUsernameResultUsernamePurchasable) TypeID() uint32 { - return CheckChatUsernameResultUsernamePurchasableTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckChatUsernameResultUsernamePurchasable) TypeName() string { - return "checkChatUsernameResultUsernamePurchasable" -} - -// TypeInfo returns info about TL type. -func (c *CheckChatUsernameResultUsernamePurchasable) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkChatUsernameResultUsernamePurchasable", - ID: CheckChatUsernameResultUsernamePurchasableTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckChatUsernameResultUsernamePurchasable) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultUsernamePurchasable#59ce59 as nil") - } - b.PutID(CheckChatUsernameResultUsernamePurchasableTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckChatUsernameResultUsernamePurchasable) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultUsernamePurchasable#59ce59 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckChatUsernameResultUsernamePurchasable) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultUsernamePurchasable#59ce59 to nil") - } - if err := b.ConsumeID(CheckChatUsernameResultUsernamePurchasableTypeID); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultUsernamePurchasable#59ce59: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckChatUsernameResultUsernamePurchasable) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultUsernamePurchasable#59ce59 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckChatUsernameResultUsernamePurchasable) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultUsernamePurchasable#59ce59 as nil") - } - b.ObjStart() - b.PutID("checkChatUsernameResultUsernamePurchasable") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckChatUsernameResultUsernamePurchasable) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultUsernamePurchasable#59ce59 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkChatUsernameResultUsernamePurchasable"); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultUsernamePurchasable#59ce59: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CheckChatUsernameResultPublicChatsTooMany represents TL type `checkChatUsernameResultPublicChatsTooMany#d8b46c7c`. -type CheckChatUsernameResultPublicChatsTooMany struct { -} - -// CheckChatUsernameResultPublicChatsTooManyTypeID is TL type id of CheckChatUsernameResultPublicChatsTooMany. -const CheckChatUsernameResultPublicChatsTooManyTypeID = 0xd8b46c7c - -// construct implements constructor of CheckChatUsernameResultClass. -func (c CheckChatUsernameResultPublicChatsTooMany) construct() CheckChatUsernameResultClass { - return &c -} - -// Ensuring interfaces in compile-time for CheckChatUsernameResultPublicChatsTooMany. -var ( - _ bin.Encoder = &CheckChatUsernameResultPublicChatsTooMany{} - _ bin.Decoder = &CheckChatUsernameResultPublicChatsTooMany{} - _ bin.BareEncoder = &CheckChatUsernameResultPublicChatsTooMany{} - _ bin.BareDecoder = &CheckChatUsernameResultPublicChatsTooMany{} - - _ CheckChatUsernameResultClass = &CheckChatUsernameResultPublicChatsTooMany{} -) - -func (c *CheckChatUsernameResultPublicChatsTooMany) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckChatUsernameResultPublicChatsTooMany) String() string { - if c == nil { - return "CheckChatUsernameResultPublicChatsTooMany(nil)" - } - type Alias CheckChatUsernameResultPublicChatsTooMany - return fmt.Sprintf("CheckChatUsernameResultPublicChatsTooMany%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckChatUsernameResultPublicChatsTooMany) TypeID() uint32 { - return CheckChatUsernameResultPublicChatsTooManyTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckChatUsernameResultPublicChatsTooMany) TypeName() string { - return "checkChatUsernameResultPublicChatsTooMany" -} - -// TypeInfo returns info about TL type. -func (c *CheckChatUsernameResultPublicChatsTooMany) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkChatUsernameResultPublicChatsTooMany", - ID: CheckChatUsernameResultPublicChatsTooManyTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckChatUsernameResultPublicChatsTooMany) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultPublicChatsTooMany#d8b46c7c as nil") - } - b.PutID(CheckChatUsernameResultPublicChatsTooManyTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckChatUsernameResultPublicChatsTooMany) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultPublicChatsTooMany#d8b46c7c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckChatUsernameResultPublicChatsTooMany) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultPublicChatsTooMany#d8b46c7c to nil") - } - if err := b.ConsumeID(CheckChatUsernameResultPublicChatsTooManyTypeID); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultPublicChatsTooMany#d8b46c7c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckChatUsernameResultPublicChatsTooMany) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultPublicChatsTooMany#d8b46c7c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckChatUsernameResultPublicChatsTooMany) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultPublicChatsTooMany#d8b46c7c as nil") - } - b.ObjStart() - b.PutID("checkChatUsernameResultPublicChatsTooMany") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckChatUsernameResultPublicChatsTooMany) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultPublicChatsTooMany#d8b46c7c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkChatUsernameResultPublicChatsTooMany"); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultPublicChatsTooMany#d8b46c7c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CheckChatUsernameResultPublicGroupsUnavailable represents TL type `checkChatUsernameResultPublicGroupsUnavailable#fce914d7`. -type CheckChatUsernameResultPublicGroupsUnavailable struct { -} - -// CheckChatUsernameResultPublicGroupsUnavailableTypeID is TL type id of CheckChatUsernameResultPublicGroupsUnavailable. -const CheckChatUsernameResultPublicGroupsUnavailableTypeID = 0xfce914d7 - -// construct implements constructor of CheckChatUsernameResultClass. -func (c CheckChatUsernameResultPublicGroupsUnavailable) construct() CheckChatUsernameResultClass { - return &c -} - -// Ensuring interfaces in compile-time for CheckChatUsernameResultPublicGroupsUnavailable. -var ( - _ bin.Encoder = &CheckChatUsernameResultPublicGroupsUnavailable{} - _ bin.Decoder = &CheckChatUsernameResultPublicGroupsUnavailable{} - _ bin.BareEncoder = &CheckChatUsernameResultPublicGroupsUnavailable{} - _ bin.BareDecoder = &CheckChatUsernameResultPublicGroupsUnavailable{} - - _ CheckChatUsernameResultClass = &CheckChatUsernameResultPublicGroupsUnavailable{} -) - -func (c *CheckChatUsernameResultPublicGroupsUnavailable) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckChatUsernameResultPublicGroupsUnavailable) String() string { - if c == nil { - return "CheckChatUsernameResultPublicGroupsUnavailable(nil)" - } - type Alias CheckChatUsernameResultPublicGroupsUnavailable - return fmt.Sprintf("CheckChatUsernameResultPublicGroupsUnavailable%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckChatUsernameResultPublicGroupsUnavailable) TypeID() uint32 { - return CheckChatUsernameResultPublicGroupsUnavailableTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckChatUsernameResultPublicGroupsUnavailable) TypeName() string { - return "checkChatUsernameResultPublicGroupsUnavailable" -} - -// TypeInfo returns info about TL type. -func (c *CheckChatUsernameResultPublicGroupsUnavailable) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkChatUsernameResultPublicGroupsUnavailable", - ID: CheckChatUsernameResultPublicGroupsUnavailableTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckChatUsernameResultPublicGroupsUnavailable) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultPublicGroupsUnavailable#fce914d7 as nil") - } - b.PutID(CheckChatUsernameResultPublicGroupsUnavailableTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckChatUsernameResultPublicGroupsUnavailable) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultPublicGroupsUnavailable#fce914d7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckChatUsernameResultPublicGroupsUnavailable) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultPublicGroupsUnavailable#fce914d7 to nil") - } - if err := b.ConsumeID(CheckChatUsernameResultPublicGroupsUnavailableTypeID); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultPublicGroupsUnavailable#fce914d7: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckChatUsernameResultPublicGroupsUnavailable) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultPublicGroupsUnavailable#fce914d7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckChatUsernameResultPublicGroupsUnavailable) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkChatUsernameResultPublicGroupsUnavailable#fce914d7 as nil") - } - b.ObjStart() - b.PutID("checkChatUsernameResultPublicGroupsUnavailable") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckChatUsernameResultPublicGroupsUnavailable) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkChatUsernameResultPublicGroupsUnavailable#fce914d7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkChatUsernameResultPublicGroupsUnavailable"); err != nil { - return fmt.Errorf("unable to decode checkChatUsernameResultPublicGroupsUnavailable#fce914d7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CheckChatUsernameResultClassName is schema name of CheckChatUsernameResultClass. -const CheckChatUsernameResultClassName = "CheckChatUsernameResult" - -// CheckChatUsernameResultClass represents CheckChatUsernameResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeCheckChatUsernameResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.CheckChatUsernameResultOk: // checkChatUsernameResultOk#a6a7bb5c -// case *tdapi.CheckChatUsernameResultUsernameInvalid: // checkChatUsernameResultUsernameInvalid#da087756 -// case *tdapi.CheckChatUsernameResultUsernameOccupied: // checkChatUsernameResultUsernameOccupied#4ebb3729 -// case *tdapi.CheckChatUsernameResultUsernamePurchasable: // checkChatUsernameResultUsernamePurchasable#59ce59 -// case *tdapi.CheckChatUsernameResultPublicChatsTooMany: // checkChatUsernameResultPublicChatsTooMany#d8b46c7c -// case *tdapi.CheckChatUsernameResultPublicGroupsUnavailable: // checkChatUsernameResultPublicGroupsUnavailable#fce914d7 -// default: panic(v) -// } -type CheckChatUsernameResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() CheckChatUsernameResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeCheckChatUsernameResult implements binary de-serialization for CheckChatUsernameResultClass. -func DecodeCheckChatUsernameResult(buf *bin.Buffer) (CheckChatUsernameResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case CheckChatUsernameResultOkTypeID: - // Decoding checkChatUsernameResultOk#a6a7bb5c. - v := CheckChatUsernameResultOk{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - case CheckChatUsernameResultUsernameInvalidTypeID: - // Decoding checkChatUsernameResultUsernameInvalid#da087756. - v := CheckChatUsernameResultUsernameInvalid{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - case CheckChatUsernameResultUsernameOccupiedTypeID: - // Decoding checkChatUsernameResultUsernameOccupied#4ebb3729. - v := CheckChatUsernameResultUsernameOccupied{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - case CheckChatUsernameResultUsernamePurchasableTypeID: - // Decoding checkChatUsernameResultUsernamePurchasable#59ce59. - v := CheckChatUsernameResultUsernamePurchasable{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - case CheckChatUsernameResultPublicChatsTooManyTypeID: - // Decoding checkChatUsernameResultPublicChatsTooMany#d8b46c7c. - v := CheckChatUsernameResultPublicChatsTooMany{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - case CheckChatUsernameResultPublicGroupsUnavailableTypeID: - // Decoding checkChatUsernameResultPublicGroupsUnavailable#fce914d7. - v := CheckChatUsernameResultPublicGroupsUnavailable{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONCheckChatUsernameResult implements binary de-serialization for CheckChatUsernameResultClass. -func DecodeTDLibJSONCheckChatUsernameResult(buf tdjson.Decoder) (CheckChatUsernameResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "checkChatUsernameResultOk": - // Decoding checkChatUsernameResultOk#a6a7bb5c. - v := CheckChatUsernameResultOk{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - case "checkChatUsernameResultUsernameInvalid": - // Decoding checkChatUsernameResultUsernameInvalid#da087756. - v := CheckChatUsernameResultUsernameInvalid{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - case "checkChatUsernameResultUsernameOccupied": - // Decoding checkChatUsernameResultUsernameOccupied#4ebb3729. - v := CheckChatUsernameResultUsernameOccupied{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - case "checkChatUsernameResultUsernamePurchasable": - // Decoding checkChatUsernameResultUsernamePurchasable#59ce59. - v := CheckChatUsernameResultUsernamePurchasable{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - case "checkChatUsernameResultPublicChatsTooMany": - // Decoding checkChatUsernameResultPublicChatsTooMany#d8b46c7c. - v := CheckChatUsernameResultPublicChatsTooMany{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - case "checkChatUsernameResultPublicGroupsUnavailable": - // Decoding checkChatUsernameResultPublicGroupsUnavailable#fce914d7. - v := CheckChatUsernameResultPublicGroupsUnavailable{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CheckChatUsernameResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// CheckChatUsernameResult boxes the CheckChatUsernameResultClass providing a helper. -type CheckChatUsernameResultBox struct { - CheckChatUsernameResult CheckChatUsernameResultClass -} - -// Decode implements bin.Decoder for CheckChatUsernameResultBox. -func (b *CheckChatUsernameResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode CheckChatUsernameResultBox to nil") - } - v, err := DecodeCheckChatUsernameResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CheckChatUsernameResult = v - return nil -} - -// Encode implements bin.Encode for CheckChatUsernameResultBox. -func (b *CheckChatUsernameResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.CheckChatUsernameResult == nil { - return fmt.Errorf("unable to encode CheckChatUsernameResultClass as nil") - } - return b.CheckChatUsernameResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for CheckChatUsernameResultBox. -func (b *CheckChatUsernameResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode CheckChatUsernameResultBox to nil") - } - v, err := DecodeTDLibJSONCheckChatUsernameResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CheckChatUsernameResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for CheckChatUsernameResultBox. -func (b *CheckChatUsernameResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.CheckChatUsernameResult == nil { - return fmt.Errorf("unable to encode CheckChatUsernameResultClass as nil") - } - return b.CheckChatUsernameResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_check_created_public_chats_limit_gen.go b/tdapi/tl_check_created_public_chats_limit_gen.go deleted file mode 100644 index 522091c80..000000000 --- a/tdapi/tl_check_created_public_chats_limit_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckCreatedPublicChatsLimitRequest represents TL type `checkCreatedPublicChatsLimit#e5717fa1`. -type CheckCreatedPublicChatsLimitRequest struct { - // Type of the public chats, for which to check the limit - Type PublicChatTypeClass -} - -// CheckCreatedPublicChatsLimitRequestTypeID is TL type id of CheckCreatedPublicChatsLimitRequest. -const CheckCreatedPublicChatsLimitRequestTypeID = 0xe5717fa1 - -// Ensuring interfaces in compile-time for CheckCreatedPublicChatsLimitRequest. -var ( - _ bin.Encoder = &CheckCreatedPublicChatsLimitRequest{} - _ bin.Decoder = &CheckCreatedPublicChatsLimitRequest{} - _ bin.BareEncoder = &CheckCreatedPublicChatsLimitRequest{} - _ bin.BareDecoder = &CheckCreatedPublicChatsLimitRequest{} -) - -func (c *CheckCreatedPublicChatsLimitRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckCreatedPublicChatsLimitRequest) String() string { - if c == nil { - return "CheckCreatedPublicChatsLimitRequest(nil)" - } - type Alias CheckCreatedPublicChatsLimitRequest - return fmt.Sprintf("CheckCreatedPublicChatsLimitRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckCreatedPublicChatsLimitRequest) TypeID() uint32 { - return CheckCreatedPublicChatsLimitRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckCreatedPublicChatsLimitRequest) TypeName() string { - return "checkCreatedPublicChatsLimit" -} - -// TypeInfo returns info about TL type. -func (c *CheckCreatedPublicChatsLimitRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkCreatedPublicChatsLimit", - ID: CheckCreatedPublicChatsLimitRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckCreatedPublicChatsLimitRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkCreatedPublicChatsLimit#e5717fa1 as nil") - } - b.PutID(CheckCreatedPublicChatsLimitRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckCreatedPublicChatsLimitRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkCreatedPublicChatsLimit#e5717fa1 as nil") - } - if c.Type == nil { - return fmt.Errorf("unable to encode checkCreatedPublicChatsLimit#e5717fa1: field type is nil") - } - if err := c.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode checkCreatedPublicChatsLimit#e5717fa1: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckCreatedPublicChatsLimitRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkCreatedPublicChatsLimit#e5717fa1 to nil") - } - if err := b.ConsumeID(CheckCreatedPublicChatsLimitRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkCreatedPublicChatsLimit#e5717fa1: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckCreatedPublicChatsLimitRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkCreatedPublicChatsLimit#e5717fa1 to nil") - } - { - value, err := DecodePublicChatType(b) - if err != nil { - return fmt.Errorf("unable to decode checkCreatedPublicChatsLimit#e5717fa1: field type: %w", err) - } - c.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckCreatedPublicChatsLimitRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkCreatedPublicChatsLimit#e5717fa1 as nil") - } - b.ObjStart() - b.PutID("checkCreatedPublicChatsLimit") - b.Comma() - b.FieldStart("type") - if c.Type == nil { - return fmt.Errorf("unable to encode checkCreatedPublicChatsLimit#e5717fa1: field type is nil") - } - if err := c.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode checkCreatedPublicChatsLimit#e5717fa1: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckCreatedPublicChatsLimitRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkCreatedPublicChatsLimit#e5717fa1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkCreatedPublicChatsLimit"); err != nil { - return fmt.Errorf("unable to decode checkCreatedPublicChatsLimit#e5717fa1: %w", err) - } - case "type": - value, err := DecodeTDLibJSONPublicChatType(b) - if err != nil { - return fmt.Errorf("unable to decode checkCreatedPublicChatsLimit#e5717fa1: field type: %w", err) - } - c.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (c *CheckCreatedPublicChatsLimitRequest) GetType() (value PublicChatTypeClass) { - if c == nil { - return - } - return c.Type -} - -// CheckCreatedPublicChatsLimit invokes method checkCreatedPublicChatsLimit#e5717fa1 returning error if any. -func (c *Client) CheckCreatedPublicChatsLimit(ctx context.Context, type_ PublicChatTypeClass) error { - var ok Ok - - request := &CheckCreatedPublicChatsLimitRequest{ - Type: type_, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_check_email_address_verification_code_gen.go b/tdapi/tl_check_email_address_verification_code_gen.go deleted file mode 100644 index 38bbcda74..000000000 --- a/tdapi/tl_check_email_address_verification_code_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckEmailAddressVerificationCodeRequest represents TL type `checkEmailAddressVerificationCode#e695db03`. -type CheckEmailAddressVerificationCodeRequest struct { - // Verification code to check - Code string -} - -// CheckEmailAddressVerificationCodeRequestTypeID is TL type id of CheckEmailAddressVerificationCodeRequest. -const CheckEmailAddressVerificationCodeRequestTypeID = 0xe695db03 - -// Ensuring interfaces in compile-time for CheckEmailAddressVerificationCodeRequest. -var ( - _ bin.Encoder = &CheckEmailAddressVerificationCodeRequest{} - _ bin.Decoder = &CheckEmailAddressVerificationCodeRequest{} - _ bin.BareEncoder = &CheckEmailAddressVerificationCodeRequest{} - _ bin.BareDecoder = &CheckEmailAddressVerificationCodeRequest{} -) - -func (c *CheckEmailAddressVerificationCodeRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Code == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckEmailAddressVerificationCodeRequest) String() string { - if c == nil { - return "CheckEmailAddressVerificationCodeRequest(nil)" - } - type Alias CheckEmailAddressVerificationCodeRequest - return fmt.Sprintf("CheckEmailAddressVerificationCodeRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckEmailAddressVerificationCodeRequest) TypeID() uint32 { - return CheckEmailAddressVerificationCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckEmailAddressVerificationCodeRequest) TypeName() string { - return "checkEmailAddressVerificationCode" -} - -// TypeInfo returns info about TL type. -func (c *CheckEmailAddressVerificationCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkEmailAddressVerificationCode", - ID: CheckEmailAddressVerificationCodeRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckEmailAddressVerificationCodeRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkEmailAddressVerificationCode#e695db03 as nil") - } - b.PutID(CheckEmailAddressVerificationCodeRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckEmailAddressVerificationCodeRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkEmailAddressVerificationCode#e695db03 as nil") - } - b.PutString(c.Code) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckEmailAddressVerificationCodeRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkEmailAddressVerificationCode#e695db03 to nil") - } - if err := b.ConsumeID(CheckEmailAddressVerificationCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkEmailAddressVerificationCode#e695db03: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckEmailAddressVerificationCodeRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkEmailAddressVerificationCode#e695db03 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkEmailAddressVerificationCode#e695db03: field code: %w", err) - } - c.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckEmailAddressVerificationCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkEmailAddressVerificationCode#e695db03 as nil") - } - b.ObjStart() - b.PutID("checkEmailAddressVerificationCode") - b.Comma() - b.FieldStart("code") - b.PutString(c.Code) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckEmailAddressVerificationCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkEmailAddressVerificationCode#e695db03 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkEmailAddressVerificationCode"); err != nil { - return fmt.Errorf("unable to decode checkEmailAddressVerificationCode#e695db03: %w", err) - } - case "code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkEmailAddressVerificationCode#e695db03: field code: %w", err) - } - c.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (c *CheckEmailAddressVerificationCodeRequest) GetCode() (value string) { - if c == nil { - return - } - return c.Code -} - -// CheckEmailAddressVerificationCode invokes method checkEmailAddressVerificationCode#e695db03 returning error if any. -func (c *Client) CheckEmailAddressVerificationCode(ctx context.Context, code string) error { - var ok Ok - - request := &CheckEmailAddressVerificationCodeRequest{ - Code: code, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_check_login_email_address_code_gen.go b/tdapi/tl_check_login_email_address_code_gen.go deleted file mode 100644 index e7861c72f..000000000 --- a/tdapi/tl_check_login_email_address_code_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckLoginEmailAddressCodeRequest represents TL type `checkLoginEmailAddressCode#a951fc62`. -type CheckLoginEmailAddressCodeRequest struct { - // Email address authentication to check - Code EmailAddressAuthenticationClass -} - -// CheckLoginEmailAddressCodeRequestTypeID is TL type id of CheckLoginEmailAddressCodeRequest. -const CheckLoginEmailAddressCodeRequestTypeID = 0xa951fc62 - -// Ensuring interfaces in compile-time for CheckLoginEmailAddressCodeRequest. -var ( - _ bin.Encoder = &CheckLoginEmailAddressCodeRequest{} - _ bin.Decoder = &CheckLoginEmailAddressCodeRequest{} - _ bin.BareEncoder = &CheckLoginEmailAddressCodeRequest{} - _ bin.BareDecoder = &CheckLoginEmailAddressCodeRequest{} -) - -func (c *CheckLoginEmailAddressCodeRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Code == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckLoginEmailAddressCodeRequest) String() string { - if c == nil { - return "CheckLoginEmailAddressCodeRequest(nil)" - } - type Alias CheckLoginEmailAddressCodeRequest - return fmt.Sprintf("CheckLoginEmailAddressCodeRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckLoginEmailAddressCodeRequest) TypeID() uint32 { - return CheckLoginEmailAddressCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckLoginEmailAddressCodeRequest) TypeName() string { - return "checkLoginEmailAddressCode" -} - -// TypeInfo returns info about TL type. -func (c *CheckLoginEmailAddressCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkLoginEmailAddressCode", - ID: CheckLoginEmailAddressCodeRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckLoginEmailAddressCodeRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkLoginEmailAddressCode#a951fc62 as nil") - } - b.PutID(CheckLoginEmailAddressCodeRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckLoginEmailAddressCodeRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkLoginEmailAddressCode#a951fc62 as nil") - } - if c.Code == nil { - return fmt.Errorf("unable to encode checkLoginEmailAddressCode#a951fc62: field code is nil") - } - if err := c.Code.Encode(b); err != nil { - return fmt.Errorf("unable to encode checkLoginEmailAddressCode#a951fc62: field code: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckLoginEmailAddressCodeRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkLoginEmailAddressCode#a951fc62 to nil") - } - if err := b.ConsumeID(CheckLoginEmailAddressCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkLoginEmailAddressCode#a951fc62: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckLoginEmailAddressCodeRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkLoginEmailAddressCode#a951fc62 to nil") - } - { - value, err := DecodeEmailAddressAuthentication(b) - if err != nil { - return fmt.Errorf("unable to decode checkLoginEmailAddressCode#a951fc62: field code: %w", err) - } - c.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckLoginEmailAddressCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkLoginEmailAddressCode#a951fc62 as nil") - } - b.ObjStart() - b.PutID("checkLoginEmailAddressCode") - b.Comma() - b.FieldStart("code") - if c.Code == nil { - return fmt.Errorf("unable to encode checkLoginEmailAddressCode#a951fc62: field code is nil") - } - if err := c.Code.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode checkLoginEmailAddressCode#a951fc62: field code: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckLoginEmailAddressCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkLoginEmailAddressCode#a951fc62 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkLoginEmailAddressCode"); err != nil { - return fmt.Errorf("unable to decode checkLoginEmailAddressCode#a951fc62: %w", err) - } - case "code": - value, err := DecodeTDLibJSONEmailAddressAuthentication(b) - if err != nil { - return fmt.Errorf("unable to decode checkLoginEmailAddressCode#a951fc62: field code: %w", err) - } - c.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (c *CheckLoginEmailAddressCodeRequest) GetCode() (value EmailAddressAuthenticationClass) { - if c == nil { - return - } - return c.Code -} - -// CheckLoginEmailAddressCode invokes method checkLoginEmailAddressCode#a951fc62 returning error if any. -func (c *Client) CheckLoginEmailAddressCode(ctx context.Context, code EmailAddressAuthenticationClass) error { - var ok Ok - - request := &CheckLoginEmailAddressCodeRequest{ - Code: code, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_check_password_recovery_code_gen.go b/tdapi/tl_check_password_recovery_code_gen.go deleted file mode 100644 index d65ffa0af..000000000 --- a/tdapi/tl_check_password_recovery_code_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckPasswordRecoveryCodeRequest represents TL type `checkPasswordRecoveryCode#f4081e18`. -type CheckPasswordRecoveryCodeRequest struct { - // Recovery code to check - RecoveryCode string -} - -// CheckPasswordRecoveryCodeRequestTypeID is TL type id of CheckPasswordRecoveryCodeRequest. -const CheckPasswordRecoveryCodeRequestTypeID = 0xf4081e18 - -// Ensuring interfaces in compile-time for CheckPasswordRecoveryCodeRequest. -var ( - _ bin.Encoder = &CheckPasswordRecoveryCodeRequest{} - _ bin.Decoder = &CheckPasswordRecoveryCodeRequest{} - _ bin.BareEncoder = &CheckPasswordRecoveryCodeRequest{} - _ bin.BareDecoder = &CheckPasswordRecoveryCodeRequest{} -) - -func (c *CheckPasswordRecoveryCodeRequest) Zero() bool { - if c == nil { - return true - } - if !(c.RecoveryCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckPasswordRecoveryCodeRequest) String() string { - if c == nil { - return "CheckPasswordRecoveryCodeRequest(nil)" - } - type Alias CheckPasswordRecoveryCodeRequest - return fmt.Sprintf("CheckPasswordRecoveryCodeRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckPasswordRecoveryCodeRequest) TypeID() uint32 { - return CheckPasswordRecoveryCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckPasswordRecoveryCodeRequest) TypeName() string { - return "checkPasswordRecoveryCode" -} - -// TypeInfo returns info about TL type. -func (c *CheckPasswordRecoveryCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkPasswordRecoveryCode", - ID: CheckPasswordRecoveryCodeRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RecoveryCode", - SchemaName: "recovery_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckPasswordRecoveryCodeRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkPasswordRecoveryCode#f4081e18 as nil") - } - b.PutID(CheckPasswordRecoveryCodeRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckPasswordRecoveryCodeRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkPasswordRecoveryCode#f4081e18 as nil") - } - b.PutString(c.RecoveryCode) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckPasswordRecoveryCodeRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkPasswordRecoveryCode#f4081e18 to nil") - } - if err := b.ConsumeID(CheckPasswordRecoveryCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkPasswordRecoveryCode#f4081e18: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckPasswordRecoveryCodeRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkPasswordRecoveryCode#f4081e18 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkPasswordRecoveryCode#f4081e18: field recovery_code: %w", err) - } - c.RecoveryCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckPasswordRecoveryCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkPasswordRecoveryCode#f4081e18 as nil") - } - b.ObjStart() - b.PutID("checkPasswordRecoveryCode") - b.Comma() - b.FieldStart("recovery_code") - b.PutString(c.RecoveryCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckPasswordRecoveryCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkPasswordRecoveryCode#f4081e18 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkPasswordRecoveryCode"); err != nil { - return fmt.Errorf("unable to decode checkPasswordRecoveryCode#f4081e18: %w", err) - } - case "recovery_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkPasswordRecoveryCode#f4081e18: field recovery_code: %w", err) - } - c.RecoveryCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRecoveryCode returns value of RecoveryCode field. -func (c *CheckPasswordRecoveryCodeRequest) GetRecoveryCode() (value string) { - if c == nil { - return - } - return c.RecoveryCode -} - -// CheckPasswordRecoveryCode invokes method checkPasswordRecoveryCode#f4081e18 returning error if any. -func (c *Client) CheckPasswordRecoveryCode(ctx context.Context, recoverycode string) error { - var ok Ok - - request := &CheckPasswordRecoveryCodeRequest{ - RecoveryCode: recoverycode, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_check_phone_number_code_gen.go b/tdapi/tl_check_phone_number_code_gen.go deleted file mode 100644 index 5d575c34d..000000000 --- a/tdapi/tl_check_phone_number_code_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckPhoneNumberCodeRequest represents TL type `checkPhoneNumberCode#dc0565a1`. -type CheckPhoneNumberCodeRequest struct { - // Authentication code to check - Code string -} - -// CheckPhoneNumberCodeRequestTypeID is TL type id of CheckPhoneNumberCodeRequest. -const CheckPhoneNumberCodeRequestTypeID = 0xdc0565a1 - -// Ensuring interfaces in compile-time for CheckPhoneNumberCodeRequest. -var ( - _ bin.Encoder = &CheckPhoneNumberCodeRequest{} - _ bin.Decoder = &CheckPhoneNumberCodeRequest{} - _ bin.BareEncoder = &CheckPhoneNumberCodeRequest{} - _ bin.BareDecoder = &CheckPhoneNumberCodeRequest{} -) - -func (c *CheckPhoneNumberCodeRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Code == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckPhoneNumberCodeRequest) String() string { - if c == nil { - return "CheckPhoneNumberCodeRequest(nil)" - } - type Alias CheckPhoneNumberCodeRequest - return fmt.Sprintf("CheckPhoneNumberCodeRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckPhoneNumberCodeRequest) TypeID() uint32 { - return CheckPhoneNumberCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckPhoneNumberCodeRequest) TypeName() string { - return "checkPhoneNumberCode" -} - -// TypeInfo returns info about TL type. -func (c *CheckPhoneNumberCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkPhoneNumberCode", - ID: CheckPhoneNumberCodeRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckPhoneNumberCodeRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkPhoneNumberCode#dc0565a1 as nil") - } - b.PutID(CheckPhoneNumberCodeRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckPhoneNumberCodeRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkPhoneNumberCode#dc0565a1 as nil") - } - b.PutString(c.Code) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckPhoneNumberCodeRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkPhoneNumberCode#dc0565a1 to nil") - } - if err := b.ConsumeID(CheckPhoneNumberCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkPhoneNumberCode#dc0565a1: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckPhoneNumberCodeRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkPhoneNumberCode#dc0565a1 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkPhoneNumberCode#dc0565a1: field code: %w", err) - } - c.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckPhoneNumberCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkPhoneNumberCode#dc0565a1 as nil") - } - b.ObjStart() - b.PutID("checkPhoneNumberCode") - b.Comma() - b.FieldStart("code") - b.PutString(c.Code) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckPhoneNumberCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkPhoneNumberCode#dc0565a1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkPhoneNumberCode"); err != nil { - return fmt.Errorf("unable to decode checkPhoneNumberCode#dc0565a1: %w", err) - } - case "code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkPhoneNumberCode#dc0565a1: field code: %w", err) - } - c.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (c *CheckPhoneNumberCodeRequest) GetCode() (value string) { - if c == nil { - return - } - return c.Code -} - -// CheckPhoneNumberCode invokes method checkPhoneNumberCode#dc0565a1 returning error if any. -func (c *Client) CheckPhoneNumberCode(ctx context.Context, code string) error { - var ok Ok - - request := &CheckPhoneNumberCodeRequest{ - Code: code, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_check_premium_gift_code_gen.go b/tdapi/tl_check_premium_gift_code_gen.go deleted file mode 100644 index c11bf3cb5..000000000 --- a/tdapi/tl_check_premium_gift_code_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckPremiumGiftCodeRequest represents TL type `checkPremiumGiftCode#958ad664`. -type CheckPremiumGiftCodeRequest struct { - // The code to check - Code string -} - -// CheckPremiumGiftCodeRequestTypeID is TL type id of CheckPremiumGiftCodeRequest. -const CheckPremiumGiftCodeRequestTypeID = 0x958ad664 - -// Ensuring interfaces in compile-time for CheckPremiumGiftCodeRequest. -var ( - _ bin.Encoder = &CheckPremiumGiftCodeRequest{} - _ bin.Decoder = &CheckPremiumGiftCodeRequest{} - _ bin.BareEncoder = &CheckPremiumGiftCodeRequest{} - _ bin.BareDecoder = &CheckPremiumGiftCodeRequest{} -) - -func (c *CheckPremiumGiftCodeRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Code == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckPremiumGiftCodeRequest) String() string { - if c == nil { - return "CheckPremiumGiftCodeRequest(nil)" - } - type Alias CheckPremiumGiftCodeRequest - return fmt.Sprintf("CheckPremiumGiftCodeRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckPremiumGiftCodeRequest) TypeID() uint32 { - return CheckPremiumGiftCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckPremiumGiftCodeRequest) TypeName() string { - return "checkPremiumGiftCode" -} - -// TypeInfo returns info about TL type. -func (c *CheckPremiumGiftCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkPremiumGiftCode", - ID: CheckPremiumGiftCodeRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckPremiumGiftCodeRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkPremiumGiftCode#958ad664 as nil") - } - b.PutID(CheckPremiumGiftCodeRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckPremiumGiftCodeRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkPremiumGiftCode#958ad664 as nil") - } - b.PutString(c.Code) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckPremiumGiftCodeRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkPremiumGiftCode#958ad664 to nil") - } - if err := b.ConsumeID(CheckPremiumGiftCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkPremiumGiftCode#958ad664: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckPremiumGiftCodeRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkPremiumGiftCode#958ad664 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkPremiumGiftCode#958ad664: field code: %w", err) - } - c.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckPremiumGiftCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkPremiumGiftCode#958ad664 as nil") - } - b.ObjStart() - b.PutID("checkPremiumGiftCode") - b.Comma() - b.FieldStart("code") - b.PutString(c.Code) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckPremiumGiftCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkPremiumGiftCode#958ad664 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkPremiumGiftCode"); err != nil { - return fmt.Errorf("unable to decode checkPremiumGiftCode#958ad664: %w", err) - } - case "code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkPremiumGiftCode#958ad664: field code: %w", err) - } - c.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (c *CheckPremiumGiftCodeRequest) GetCode() (value string) { - if c == nil { - return - } - return c.Code -} - -// CheckPremiumGiftCode invokes method checkPremiumGiftCode#958ad664 returning error if any. -func (c *Client) CheckPremiumGiftCode(ctx context.Context, code string) (*PremiumGiftCodeInfo, error) { - var result PremiumGiftCodeInfo - - request := &CheckPremiumGiftCodeRequest{ - Code: code, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_check_quick_reply_shortcut_name_gen.go b/tdapi/tl_check_quick_reply_shortcut_name_gen.go deleted file mode 100644 index 9a4c2923a..000000000 --- a/tdapi/tl_check_quick_reply_shortcut_name_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckQuickReplyShortcutNameRequest represents TL type `checkQuickReplyShortcutName#7d3dd129`. -type CheckQuickReplyShortcutNameRequest struct { - // The name of the shortcut; 1-32 characters - Name string -} - -// CheckQuickReplyShortcutNameRequestTypeID is TL type id of CheckQuickReplyShortcutNameRequest. -const CheckQuickReplyShortcutNameRequestTypeID = 0x7d3dd129 - -// Ensuring interfaces in compile-time for CheckQuickReplyShortcutNameRequest. -var ( - _ bin.Encoder = &CheckQuickReplyShortcutNameRequest{} - _ bin.Decoder = &CheckQuickReplyShortcutNameRequest{} - _ bin.BareEncoder = &CheckQuickReplyShortcutNameRequest{} - _ bin.BareDecoder = &CheckQuickReplyShortcutNameRequest{} -) - -func (c *CheckQuickReplyShortcutNameRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckQuickReplyShortcutNameRequest) String() string { - if c == nil { - return "CheckQuickReplyShortcutNameRequest(nil)" - } - type Alias CheckQuickReplyShortcutNameRequest - return fmt.Sprintf("CheckQuickReplyShortcutNameRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckQuickReplyShortcutNameRequest) TypeID() uint32 { - return CheckQuickReplyShortcutNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckQuickReplyShortcutNameRequest) TypeName() string { - return "checkQuickReplyShortcutName" -} - -// TypeInfo returns info about TL type. -func (c *CheckQuickReplyShortcutNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkQuickReplyShortcutName", - ID: CheckQuickReplyShortcutNameRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckQuickReplyShortcutNameRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkQuickReplyShortcutName#7d3dd129 as nil") - } - b.PutID(CheckQuickReplyShortcutNameRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckQuickReplyShortcutNameRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkQuickReplyShortcutName#7d3dd129 as nil") - } - b.PutString(c.Name) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckQuickReplyShortcutNameRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkQuickReplyShortcutName#7d3dd129 to nil") - } - if err := b.ConsumeID(CheckQuickReplyShortcutNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkQuickReplyShortcutName#7d3dd129: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckQuickReplyShortcutNameRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkQuickReplyShortcutName#7d3dd129 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkQuickReplyShortcutName#7d3dd129: field name: %w", err) - } - c.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckQuickReplyShortcutNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkQuickReplyShortcutName#7d3dd129 as nil") - } - b.ObjStart() - b.PutID("checkQuickReplyShortcutName") - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckQuickReplyShortcutNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkQuickReplyShortcutName#7d3dd129 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkQuickReplyShortcutName"); err != nil { - return fmt.Errorf("unable to decode checkQuickReplyShortcutName#7d3dd129: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkQuickReplyShortcutName#7d3dd129: field name: %w", err) - } - c.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (c *CheckQuickReplyShortcutNameRequest) GetName() (value string) { - if c == nil { - return - } - return c.Name -} - -// CheckQuickReplyShortcutName invokes method checkQuickReplyShortcutName#7d3dd129 returning error if any. -func (c *Client) CheckQuickReplyShortcutName(ctx context.Context, name string) error { - var ok Ok - - request := &CheckQuickReplyShortcutNameRequest{ - Name: name, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_check_recovery_email_address_code_gen.go b/tdapi/tl_check_recovery_email_address_code_gen.go deleted file mode 100644 index a86c6603c..000000000 --- a/tdapi/tl_check_recovery_email_address_code_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckRecoveryEmailAddressCodeRequest represents TL type `checkRecoveryEmailAddressCode#88f7981b`. -type CheckRecoveryEmailAddressCodeRequest struct { - // Verification code to check - Code string -} - -// CheckRecoveryEmailAddressCodeRequestTypeID is TL type id of CheckRecoveryEmailAddressCodeRequest. -const CheckRecoveryEmailAddressCodeRequestTypeID = 0x88f7981b - -// Ensuring interfaces in compile-time for CheckRecoveryEmailAddressCodeRequest. -var ( - _ bin.Encoder = &CheckRecoveryEmailAddressCodeRequest{} - _ bin.Decoder = &CheckRecoveryEmailAddressCodeRequest{} - _ bin.BareEncoder = &CheckRecoveryEmailAddressCodeRequest{} - _ bin.BareDecoder = &CheckRecoveryEmailAddressCodeRequest{} -) - -func (c *CheckRecoveryEmailAddressCodeRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Code == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckRecoveryEmailAddressCodeRequest) String() string { - if c == nil { - return "CheckRecoveryEmailAddressCodeRequest(nil)" - } - type Alias CheckRecoveryEmailAddressCodeRequest - return fmt.Sprintf("CheckRecoveryEmailAddressCodeRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckRecoveryEmailAddressCodeRequest) TypeID() uint32 { - return CheckRecoveryEmailAddressCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckRecoveryEmailAddressCodeRequest) TypeName() string { - return "checkRecoveryEmailAddressCode" -} - -// TypeInfo returns info about TL type. -func (c *CheckRecoveryEmailAddressCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkRecoveryEmailAddressCode", - ID: CheckRecoveryEmailAddressCodeRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckRecoveryEmailAddressCodeRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkRecoveryEmailAddressCode#88f7981b as nil") - } - b.PutID(CheckRecoveryEmailAddressCodeRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckRecoveryEmailAddressCodeRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkRecoveryEmailAddressCode#88f7981b as nil") - } - b.PutString(c.Code) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckRecoveryEmailAddressCodeRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkRecoveryEmailAddressCode#88f7981b to nil") - } - if err := b.ConsumeID(CheckRecoveryEmailAddressCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkRecoveryEmailAddressCode#88f7981b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckRecoveryEmailAddressCodeRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkRecoveryEmailAddressCode#88f7981b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkRecoveryEmailAddressCode#88f7981b: field code: %w", err) - } - c.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckRecoveryEmailAddressCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkRecoveryEmailAddressCode#88f7981b as nil") - } - b.ObjStart() - b.PutID("checkRecoveryEmailAddressCode") - b.Comma() - b.FieldStart("code") - b.PutString(c.Code) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckRecoveryEmailAddressCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkRecoveryEmailAddressCode#88f7981b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkRecoveryEmailAddressCode"); err != nil { - return fmt.Errorf("unable to decode checkRecoveryEmailAddressCode#88f7981b: %w", err) - } - case "code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkRecoveryEmailAddressCode#88f7981b: field code: %w", err) - } - c.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (c *CheckRecoveryEmailAddressCodeRequest) GetCode() (value string) { - if c == nil { - return - } - return c.Code -} - -// CheckRecoveryEmailAddressCode invokes method checkRecoveryEmailAddressCode#88f7981b returning error if any. -func (c *Client) CheckRecoveryEmailAddressCode(ctx context.Context, code string) (*PasswordState, error) { - var result PasswordState - - request := &CheckRecoveryEmailAddressCodeRequest{ - Code: code, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_check_sticker_set_name_gen.go b/tdapi/tl_check_sticker_set_name_gen.go deleted file mode 100644 index 77f302183..000000000 --- a/tdapi/tl_check_sticker_set_name_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckStickerSetNameRequest represents TL type `checkStickerSetName#955808fe`. -type CheckStickerSetNameRequest struct { - // Name to be checked - Name string -} - -// CheckStickerSetNameRequestTypeID is TL type id of CheckStickerSetNameRequest. -const CheckStickerSetNameRequestTypeID = 0x955808fe - -// Ensuring interfaces in compile-time for CheckStickerSetNameRequest. -var ( - _ bin.Encoder = &CheckStickerSetNameRequest{} - _ bin.Decoder = &CheckStickerSetNameRequest{} - _ bin.BareEncoder = &CheckStickerSetNameRequest{} - _ bin.BareDecoder = &CheckStickerSetNameRequest{} -) - -func (c *CheckStickerSetNameRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckStickerSetNameRequest) String() string { - if c == nil { - return "CheckStickerSetNameRequest(nil)" - } - type Alias CheckStickerSetNameRequest - return fmt.Sprintf("CheckStickerSetNameRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckStickerSetNameRequest) TypeID() uint32 { - return CheckStickerSetNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckStickerSetNameRequest) TypeName() string { - return "checkStickerSetName" -} - -// TypeInfo returns info about TL type. -func (c *CheckStickerSetNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkStickerSetName", - ID: CheckStickerSetNameRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckStickerSetNameRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetName#955808fe as nil") - } - b.PutID(CheckStickerSetNameRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckStickerSetNameRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetName#955808fe as nil") - } - b.PutString(c.Name) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckStickerSetNameRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetName#955808fe to nil") - } - if err := b.ConsumeID(CheckStickerSetNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkStickerSetName#955808fe: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckStickerSetNameRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetName#955808fe to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkStickerSetName#955808fe: field name: %w", err) - } - c.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckStickerSetNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetName#955808fe as nil") - } - b.ObjStart() - b.PutID("checkStickerSetName") - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckStickerSetNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetName#955808fe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkStickerSetName"); err != nil { - return fmt.Errorf("unable to decode checkStickerSetName#955808fe: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkStickerSetName#955808fe: field name: %w", err) - } - c.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (c *CheckStickerSetNameRequest) GetName() (value string) { - if c == nil { - return - } - return c.Name -} - -// CheckStickerSetName invokes method checkStickerSetName#955808fe returning error if any. -func (c *Client) CheckStickerSetName(ctx context.Context, name string) (CheckStickerSetNameResultClass, error) { - var result CheckStickerSetNameResultBox - - request := &CheckStickerSetNameRequest{ - Name: name, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.CheckStickerSetNameResult, nil -} diff --git a/tdapi/tl_check_sticker_set_name_result_gen.go b/tdapi/tl_check_sticker_set_name_result_gen.go deleted file mode 100644 index 4656d54ff..000000000 --- a/tdapi/tl_check_sticker_set_name_result_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckStickerSetNameResultOk represents TL type `checkStickerSetNameResultOk#ac4bf258`. -type CheckStickerSetNameResultOk struct { -} - -// CheckStickerSetNameResultOkTypeID is TL type id of CheckStickerSetNameResultOk. -const CheckStickerSetNameResultOkTypeID = 0xac4bf258 - -// construct implements constructor of CheckStickerSetNameResultClass. -func (c CheckStickerSetNameResultOk) construct() CheckStickerSetNameResultClass { return &c } - -// Ensuring interfaces in compile-time for CheckStickerSetNameResultOk. -var ( - _ bin.Encoder = &CheckStickerSetNameResultOk{} - _ bin.Decoder = &CheckStickerSetNameResultOk{} - _ bin.BareEncoder = &CheckStickerSetNameResultOk{} - _ bin.BareDecoder = &CheckStickerSetNameResultOk{} - - _ CheckStickerSetNameResultClass = &CheckStickerSetNameResultOk{} -) - -func (c *CheckStickerSetNameResultOk) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckStickerSetNameResultOk) String() string { - if c == nil { - return "CheckStickerSetNameResultOk(nil)" - } - type Alias CheckStickerSetNameResultOk - return fmt.Sprintf("CheckStickerSetNameResultOk%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckStickerSetNameResultOk) TypeID() uint32 { - return CheckStickerSetNameResultOkTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckStickerSetNameResultOk) TypeName() string { - return "checkStickerSetNameResultOk" -} - -// TypeInfo returns info about TL type. -func (c *CheckStickerSetNameResultOk) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkStickerSetNameResultOk", - ID: CheckStickerSetNameResultOkTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckStickerSetNameResultOk) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetNameResultOk#ac4bf258 as nil") - } - b.PutID(CheckStickerSetNameResultOkTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckStickerSetNameResultOk) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetNameResultOk#ac4bf258 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckStickerSetNameResultOk) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetNameResultOk#ac4bf258 to nil") - } - if err := b.ConsumeID(CheckStickerSetNameResultOkTypeID); err != nil { - return fmt.Errorf("unable to decode checkStickerSetNameResultOk#ac4bf258: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckStickerSetNameResultOk) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetNameResultOk#ac4bf258 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckStickerSetNameResultOk) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetNameResultOk#ac4bf258 as nil") - } - b.ObjStart() - b.PutID("checkStickerSetNameResultOk") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckStickerSetNameResultOk) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetNameResultOk#ac4bf258 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkStickerSetNameResultOk"); err != nil { - return fmt.Errorf("unable to decode checkStickerSetNameResultOk#ac4bf258: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CheckStickerSetNameResultNameInvalid represents TL type `checkStickerSetNameResultNameInvalid#a9bf234`. -type CheckStickerSetNameResultNameInvalid struct { -} - -// CheckStickerSetNameResultNameInvalidTypeID is TL type id of CheckStickerSetNameResultNameInvalid. -const CheckStickerSetNameResultNameInvalidTypeID = 0xa9bf234 - -// construct implements constructor of CheckStickerSetNameResultClass. -func (c CheckStickerSetNameResultNameInvalid) construct() CheckStickerSetNameResultClass { return &c } - -// Ensuring interfaces in compile-time for CheckStickerSetNameResultNameInvalid. -var ( - _ bin.Encoder = &CheckStickerSetNameResultNameInvalid{} - _ bin.Decoder = &CheckStickerSetNameResultNameInvalid{} - _ bin.BareEncoder = &CheckStickerSetNameResultNameInvalid{} - _ bin.BareDecoder = &CheckStickerSetNameResultNameInvalid{} - - _ CheckStickerSetNameResultClass = &CheckStickerSetNameResultNameInvalid{} -) - -func (c *CheckStickerSetNameResultNameInvalid) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckStickerSetNameResultNameInvalid) String() string { - if c == nil { - return "CheckStickerSetNameResultNameInvalid(nil)" - } - type Alias CheckStickerSetNameResultNameInvalid - return fmt.Sprintf("CheckStickerSetNameResultNameInvalid%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckStickerSetNameResultNameInvalid) TypeID() uint32 { - return CheckStickerSetNameResultNameInvalidTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckStickerSetNameResultNameInvalid) TypeName() string { - return "checkStickerSetNameResultNameInvalid" -} - -// TypeInfo returns info about TL type. -func (c *CheckStickerSetNameResultNameInvalid) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkStickerSetNameResultNameInvalid", - ID: CheckStickerSetNameResultNameInvalidTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckStickerSetNameResultNameInvalid) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetNameResultNameInvalid#a9bf234 as nil") - } - b.PutID(CheckStickerSetNameResultNameInvalidTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckStickerSetNameResultNameInvalid) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetNameResultNameInvalid#a9bf234 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckStickerSetNameResultNameInvalid) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetNameResultNameInvalid#a9bf234 to nil") - } - if err := b.ConsumeID(CheckStickerSetNameResultNameInvalidTypeID); err != nil { - return fmt.Errorf("unable to decode checkStickerSetNameResultNameInvalid#a9bf234: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckStickerSetNameResultNameInvalid) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetNameResultNameInvalid#a9bf234 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckStickerSetNameResultNameInvalid) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetNameResultNameInvalid#a9bf234 as nil") - } - b.ObjStart() - b.PutID("checkStickerSetNameResultNameInvalid") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckStickerSetNameResultNameInvalid) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetNameResultNameInvalid#a9bf234 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkStickerSetNameResultNameInvalid"); err != nil { - return fmt.Errorf("unable to decode checkStickerSetNameResultNameInvalid#a9bf234: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CheckStickerSetNameResultNameOccupied represents TL type `checkStickerSetNameResultNameOccupied#3c60dc88`. -type CheckStickerSetNameResultNameOccupied struct { -} - -// CheckStickerSetNameResultNameOccupiedTypeID is TL type id of CheckStickerSetNameResultNameOccupied. -const CheckStickerSetNameResultNameOccupiedTypeID = 0x3c60dc88 - -// construct implements constructor of CheckStickerSetNameResultClass. -func (c CheckStickerSetNameResultNameOccupied) construct() CheckStickerSetNameResultClass { return &c } - -// Ensuring interfaces in compile-time for CheckStickerSetNameResultNameOccupied. -var ( - _ bin.Encoder = &CheckStickerSetNameResultNameOccupied{} - _ bin.Decoder = &CheckStickerSetNameResultNameOccupied{} - _ bin.BareEncoder = &CheckStickerSetNameResultNameOccupied{} - _ bin.BareDecoder = &CheckStickerSetNameResultNameOccupied{} - - _ CheckStickerSetNameResultClass = &CheckStickerSetNameResultNameOccupied{} -) - -func (c *CheckStickerSetNameResultNameOccupied) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckStickerSetNameResultNameOccupied) String() string { - if c == nil { - return "CheckStickerSetNameResultNameOccupied(nil)" - } - type Alias CheckStickerSetNameResultNameOccupied - return fmt.Sprintf("CheckStickerSetNameResultNameOccupied%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckStickerSetNameResultNameOccupied) TypeID() uint32 { - return CheckStickerSetNameResultNameOccupiedTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckStickerSetNameResultNameOccupied) TypeName() string { - return "checkStickerSetNameResultNameOccupied" -} - -// TypeInfo returns info about TL type. -func (c *CheckStickerSetNameResultNameOccupied) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkStickerSetNameResultNameOccupied", - ID: CheckStickerSetNameResultNameOccupiedTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckStickerSetNameResultNameOccupied) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetNameResultNameOccupied#3c60dc88 as nil") - } - b.PutID(CheckStickerSetNameResultNameOccupiedTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckStickerSetNameResultNameOccupied) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetNameResultNameOccupied#3c60dc88 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckStickerSetNameResultNameOccupied) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetNameResultNameOccupied#3c60dc88 to nil") - } - if err := b.ConsumeID(CheckStickerSetNameResultNameOccupiedTypeID); err != nil { - return fmt.Errorf("unable to decode checkStickerSetNameResultNameOccupied#3c60dc88: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckStickerSetNameResultNameOccupied) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetNameResultNameOccupied#3c60dc88 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckStickerSetNameResultNameOccupied) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkStickerSetNameResultNameOccupied#3c60dc88 as nil") - } - b.ObjStart() - b.PutID("checkStickerSetNameResultNameOccupied") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckStickerSetNameResultNameOccupied) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkStickerSetNameResultNameOccupied#3c60dc88 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkStickerSetNameResultNameOccupied"); err != nil { - return fmt.Errorf("unable to decode checkStickerSetNameResultNameOccupied#3c60dc88: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// CheckStickerSetNameResultClassName is schema name of CheckStickerSetNameResultClass. -const CheckStickerSetNameResultClassName = "CheckStickerSetNameResult" - -// CheckStickerSetNameResultClass represents CheckStickerSetNameResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeCheckStickerSetNameResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.CheckStickerSetNameResultOk: // checkStickerSetNameResultOk#ac4bf258 -// case *tdapi.CheckStickerSetNameResultNameInvalid: // checkStickerSetNameResultNameInvalid#a9bf234 -// case *tdapi.CheckStickerSetNameResultNameOccupied: // checkStickerSetNameResultNameOccupied#3c60dc88 -// default: panic(v) -// } -type CheckStickerSetNameResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() CheckStickerSetNameResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeCheckStickerSetNameResult implements binary de-serialization for CheckStickerSetNameResultClass. -func DecodeCheckStickerSetNameResult(buf *bin.Buffer) (CheckStickerSetNameResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case CheckStickerSetNameResultOkTypeID: - // Decoding checkStickerSetNameResultOk#ac4bf258. - v := CheckStickerSetNameResultOk{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckStickerSetNameResultClass: %w", err) - } - return &v, nil - case CheckStickerSetNameResultNameInvalidTypeID: - // Decoding checkStickerSetNameResultNameInvalid#a9bf234. - v := CheckStickerSetNameResultNameInvalid{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckStickerSetNameResultClass: %w", err) - } - return &v, nil - case CheckStickerSetNameResultNameOccupiedTypeID: - // Decoding checkStickerSetNameResultNameOccupied#3c60dc88. - v := CheckStickerSetNameResultNameOccupied{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckStickerSetNameResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CheckStickerSetNameResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONCheckStickerSetNameResult implements binary de-serialization for CheckStickerSetNameResultClass. -func DecodeTDLibJSONCheckStickerSetNameResult(buf tdjson.Decoder) (CheckStickerSetNameResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "checkStickerSetNameResultOk": - // Decoding checkStickerSetNameResultOk#ac4bf258. - v := CheckStickerSetNameResultOk{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckStickerSetNameResultClass: %w", err) - } - return &v, nil - case "checkStickerSetNameResultNameInvalid": - // Decoding checkStickerSetNameResultNameInvalid#a9bf234. - v := CheckStickerSetNameResultNameInvalid{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckStickerSetNameResultClass: %w", err) - } - return &v, nil - case "checkStickerSetNameResultNameOccupied": - // Decoding checkStickerSetNameResultNameOccupied#3c60dc88. - v := CheckStickerSetNameResultNameOccupied{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CheckStickerSetNameResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CheckStickerSetNameResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// CheckStickerSetNameResult boxes the CheckStickerSetNameResultClass providing a helper. -type CheckStickerSetNameResultBox struct { - CheckStickerSetNameResult CheckStickerSetNameResultClass -} - -// Decode implements bin.Decoder for CheckStickerSetNameResultBox. -func (b *CheckStickerSetNameResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode CheckStickerSetNameResultBox to nil") - } - v, err := DecodeCheckStickerSetNameResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CheckStickerSetNameResult = v - return nil -} - -// Encode implements bin.Encode for CheckStickerSetNameResultBox. -func (b *CheckStickerSetNameResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.CheckStickerSetNameResult == nil { - return fmt.Errorf("unable to encode CheckStickerSetNameResultClass as nil") - } - return b.CheckStickerSetNameResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for CheckStickerSetNameResultBox. -func (b *CheckStickerSetNameResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode CheckStickerSetNameResultBox to nil") - } - v, err := DecodeTDLibJSONCheckStickerSetNameResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CheckStickerSetNameResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for CheckStickerSetNameResultBox. -func (b *CheckStickerSetNameResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.CheckStickerSetNameResult == nil { - return fmt.Errorf("unable to encode CheckStickerSetNameResultClass as nil") - } - return b.CheckStickerSetNameResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_check_web_app_file_download_gen.go b/tdapi/tl_check_web_app_file_download_gen.go deleted file mode 100644 index a85366561..000000000 --- a/tdapi/tl_check_web_app_file_download_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CheckWebAppFileDownloadRequest represents TL type `checkWebAppFileDownload#e8ca44e2`. -type CheckWebAppFileDownloadRequest struct { - // Identifier of the bot, providing the Web App - BotUserID int64 - // Name of the file - FileName string - // URL of the file - URL string -} - -// CheckWebAppFileDownloadRequestTypeID is TL type id of CheckWebAppFileDownloadRequest. -const CheckWebAppFileDownloadRequestTypeID = 0xe8ca44e2 - -// Ensuring interfaces in compile-time for CheckWebAppFileDownloadRequest. -var ( - _ bin.Encoder = &CheckWebAppFileDownloadRequest{} - _ bin.Decoder = &CheckWebAppFileDownloadRequest{} - _ bin.BareEncoder = &CheckWebAppFileDownloadRequest{} - _ bin.BareDecoder = &CheckWebAppFileDownloadRequest{} -) - -func (c *CheckWebAppFileDownloadRequest) Zero() bool { - if c == nil { - return true - } - if !(c.BotUserID == 0) { - return false - } - if !(c.FileName == "") { - return false - } - if !(c.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CheckWebAppFileDownloadRequest) String() string { - if c == nil { - return "CheckWebAppFileDownloadRequest(nil)" - } - type Alias CheckWebAppFileDownloadRequest - return fmt.Sprintf("CheckWebAppFileDownloadRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CheckWebAppFileDownloadRequest) TypeID() uint32 { - return CheckWebAppFileDownloadRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CheckWebAppFileDownloadRequest) TypeName() string { - return "checkWebAppFileDownload" -} - -// TypeInfo returns info about TL type. -func (c *CheckWebAppFileDownloadRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "checkWebAppFileDownload", - ID: CheckWebAppFileDownloadRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "FileName", - SchemaName: "file_name", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CheckWebAppFileDownloadRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkWebAppFileDownload#e8ca44e2 as nil") - } - b.PutID(CheckWebAppFileDownloadRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CheckWebAppFileDownloadRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode checkWebAppFileDownload#e8ca44e2 as nil") - } - b.PutInt53(c.BotUserID) - b.PutString(c.FileName) - b.PutString(c.URL) - return nil -} - -// Decode implements bin.Decoder. -func (c *CheckWebAppFileDownloadRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkWebAppFileDownload#e8ca44e2 to nil") - } - if err := b.ConsumeID(CheckWebAppFileDownloadRequestTypeID); err != nil { - return fmt.Errorf("unable to decode checkWebAppFileDownload#e8ca44e2: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CheckWebAppFileDownloadRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode checkWebAppFileDownload#e8ca44e2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode checkWebAppFileDownload#e8ca44e2: field bot_user_id: %w", err) - } - c.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkWebAppFileDownload#e8ca44e2: field file_name: %w", err) - } - c.FileName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkWebAppFileDownload#e8ca44e2: field url: %w", err) - } - c.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CheckWebAppFileDownloadRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode checkWebAppFileDownload#e8ca44e2 as nil") - } - b.ObjStart() - b.PutID("checkWebAppFileDownload") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(c.BotUserID) - b.Comma() - b.FieldStart("file_name") - b.PutString(c.FileName) - b.Comma() - b.FieldStart("url") - b.PutString(c.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CheckWebAppFileDownloadRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode checkWebAppFileDownload#e8ca44e2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("checkWebAppFileDownload"); err != nil { - return fmt.Errorf("unable to decode checkWebAppFileDownload#e8ca44e2: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode checkWebAppFileDownload#e8ca44e2: field bot_user_id: %w", err) - } - c.BotUserID = value - case "file_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkWebAppFileDownload#e8ca44e2: field file_name: %w", err) - } - c.FileName = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode checkWebAppFileDownload#e8ca44e2: field url: %w", err) - } - c.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (c *CheckWebAppFileDownloadRequest) GetBotUserID() (value int64) { - if c == nil { - return - } - return c.BotUserID -} - -// GetFileName returns value of FileName field. -func (c *CheckWebAppFileDownloadRequest) GetFileName() (value string) { - if c == nil { - return - } - return c.FileName -} - -// GetURL returns value of URL field. -func (c *CheckWebAppFileDownloadRequest) GetURL() (value string) { - if c == nil { - return - } - return c.URL -} - -// CheckWebAppFileDownload invokes method checkWebAppFileDownload#e8ca44e2 returning error if any. -func (c *Client) CheckWebAppFileDownload(ctx context.Context, request *CheckWebAppFileDownloadRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_clean_file_name_gen.go b/tdapi/tl_clean_file_name_gen.go deleted file mode 100644 index bc2a303da..000000000 --- a/tdapi/tl_clean_file_name_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CleanFileNameRequest represents TL type `cleanFileName#39b1f7fb`. -type CleanFileNameRequest struct { - // File name or path to the file - FileName string -} - -// CleanFileNameRequestTypeID is TL type id of CleanFileNameRequest. -const CleanFileNameRequestTypeID = 0x39b1f7fb - -// Ensuring interfaces in compile-time for CleanFileNameRequest. -var ( - _ bin.Encoder = &CleanFileNameRequest{} - _ bin.Decoder = &CleanFileNameRequest{} - _ bin.BareEncoder = &CleanFileNameRequest{} - _ bin.BareDecoder = &CleanFileNameRequest{} -) - -func (c *CleanFileNameRequest) Zero() bool { - if c == nil { - return true - } - if !(c.FileName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CleanFileNameRequest) String() string { - if c == nil { - return "CleanFileNameRequest(nil)" - } - type Alias CleanFileNameRequest - return fmt.Sprintf("CleanFileNameRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CleanFileNameRequest) TypeID() uint32 { - return CleanFileNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CleanFileNameRequest) TypeName() string { - return "cleanFileName" -} - -// TypeInfo returns info about TL type. -func (c *CleanFileNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "cleanFileName", - ID: CleanFileNameRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileName", - SchemaName: "file_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CleanFileNameRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode cleanFileName#39b1f7fb as nil") - } - b.PutID(CleanFileNameRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CleanFileNameRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode cleanFileName#39b1f7fb as nil") - } - b.PutString(c.FileName) - return nil -} - -// Decode implements bin.Decoder. -func (c *CleanFileNameRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode cleanFileName#39b1f7fb to nil") - } - if err := b.ConsumeID(CleanFileNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode cleanFileName#39b1f7fb: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CleanFileNameRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode cleanFileName#39b1f7fb to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode cleanFileName#39b1f7fb: field file_name: %w", err) - } - c.FileName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CleanFileNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode cleanFileName#39b1f7fb as nil") - } - b.ObjStart() - b.PutID("cleanFileName") - b.Comma() - b.FieldStart("file_name") - b.PutString(c.FileName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CleanFileNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode cleanFileName#39b1f7fb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("cleanFileName"); err != nil { - return fmt.Errorf("unable to decode cleanFileName#39b1f7fb: %w", err) - } - case "file_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode cleanFileName#39b1f7fb: field file_name: %w", err) - } - c.FileName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileName returns value of FileName field. -func (c *CleanFileNameRequest) GetFileName() (value string) { - if c == nil { - return - } - return c.FileName -} - -// CleanFileName invokes method cleanFileName#39b1f7fb returning error if any. -func (c *Client) CleanFileName(ctx context.Context, filename string) (*Text, error) { - var result Text - - request := &CleanFileNameRequest{ - FileName: filename, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_clear_all_draft_messages_gen.go b/tdapi/tl_clear_all_draft_messages_gen.go deleted file mode 100644 index b1b2fef05..000000000 --- a/tdapi/tl_clear_all_draft_messages_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClearAllDraftMessagesRequest represents TL type `clearAllDraftMessages#fd3c74db`. -type ClearAllDraftMessagesRequest struct { - // Pass true to keep local message drafts in secret chats - ExcludeSecretChats bool -} - -// ClearAllDraftMessagesRequestTypeID is TL type id of ClearAllDraftMessagesRequest. -const ClearAllDraftMessagesRequestTypeID = 0xfd3c74db - -// Ensuring interfaces in compile-time for ClearAllDraftMessagesRequest. -var ( - _ bin.Encoder = &ClearAllDraftMessagesRequest{} - _ bin.Decoder = &ClearAllDraftMessagesRequest{} - _ bin.BareEncoder = &ClearAllDraftMessagesRequest{} - _ bin.BareDecoder = &ClearAllDraftMessagesRequest{} -) - -func (c *ClearAllDraftMessagesRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ExcludeSecretChats == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClearAllDraftMessagesRequest) String() string { - if c == nil { - return "ClearAllDraftMessagesRequest(nil)" - } - type Alias ClearAllDraftMessagesRequest - return fmt.Sprintf("ClearAllDraftMessagesRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClearAllDraftMessagesRequest) TypeID() uint32 { - return ClearAllDraftMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClearAllDraftMessagesRequest) TypeName() string { - return "clearAllDraftMessages" -} - -// TypeInfo returns info about TL type. -func (c *ClearAllDraftMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "clearAllDraftMessages", - ID: ClearAllDraftMessagesRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ExcludeSecretChats", - SchemaName: "exclude_secret_chats", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ClearAllDraftMessagesRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearAllDraftMessages#fd3c74db as nil") - } - b.PutID(ClearAllDraftMessagesRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClearAllDraftMessagesRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearAllDraftMessages#fd3c74db as nil") - } - b.PutBool(c.ExcludeSecretChats) - return nil -} - -// Decode implements bin.Decoder. -func (c *ClearAllDraftMessagesRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearAllDraftMessages#fd3c74db to nil") - } - if err := b.ConsumeID(ClearAllDraftMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode clearAllDraftMessages#fd3c74db: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClearAllDraftMessagesRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearAllDraftMessages#fd3c74db to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode clearAllDraftMessages#fd3c74db: field exclude_secret_chats: %w", err) - } - c.ExcludeSecretChats = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClearAllDraftMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode clearAllDraftMessages#fd3c74db as nil") - } - b.ObjStart() - b.PutID("clearAllDraftMessages") - b.Comma() - b.FieldStart("exclude_secret_chats") - b.PutBool(c.ExcludeSecretChats) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClearAllDraftMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode clearAllDraftMessages#fd3c74db to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("clearAllDraftMessages"); err != nil { - return fmt.Errorf("unable to decode clearAllDraftMessages#fd3c74db: %w", err) - } - case "exclude_secret_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode clearAllDraftMessages#fd3c74db: field exclude_secret_chats: %w", err) - } - c.ExcludeSecretChats = value - default: - return b.Skip() - } - return nil - }) -} - -// GetExcludeSecretChats returns value of ExcludeSecretChats field. -func (c *ClearAllDraftMessagesRequest) GetExcludeSecretChats() (value bool) { - if c == nil { - return - } - return c.ExcludeSecretChats -} - -// ClearAllDraftMessages invokes method clearAllDraftMessages#fd3c74db returning error if any. -func (c *Client) ClearAllDraftMessages(ctx context.Context, excludesecretchats bool) error { - var ok Ok - - request := &ClearAllDraftMessagesRequest{ - ExcludeSecretChats: excludesecretchats, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_clear_autosave_settings_exceptions_gen.go b/tdapi/tl_clear_autosave_settings_exceptions_gen.go deleted file mode 100644 index 68a2aa3f6..000000000 --- a/tdapi/tl_clear_autosave_settings_exceptions_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClearAutosaveSettingsExceptionsRequest represents TL type `clearAutosaveSettingsExceptions#57ec63f2`. -type ClearAutosaveSettingsExceptionsRequest struct { -} - -// ClearAutosaveSettingsExceptionsRequestTypeID is TL type id of ClearAutosaveSettingsExceptionsRequest. -const ClearAutosaveSettingsExceptionsRequestTypeID = 0x57ec63f2 - -// Ensuring interfaces in compile-time for ClearAutosaveSettingsExceptionsRequest. -var ( - _ bin.Encoder = &ClearAutosaveSettingsExceptionsRequest{} - _ bin.Decoder = &ClearAutosaveSettingsExceptionsRequest{} - _ bin.BareEncoder = &ClearAutosaveSettingsExceptionsRequest{} - _ bin.BareDecoder = &ClearAutosaveSettingsExceptionsRequest{} -) - -func (c *ClearAutosaveSettingsExceptionsRequest) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClearAutosaveSettingsExceptionsRequest) String() string { - if c == nil { - return "ClearAutosaveSettingsExceptionsRequest(nil)" - } - type Alias ClearAutosaveSettingsExceptionsRequest - return fmt.Sprintf("ClearAutosaveSettingsExceptionsRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClearAutosaveSettingsExceptionsRequest) TypeID() uint32 { - return ClearAutosaveSettingsExceptionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClearAutosaveSettingsExceptionsRequest) TypeName() string { - return "clearAutosaveSettingsExceptions" -} - -// TypeInfo returns info about TL type. -func (c *ClearAutosaveSettingsExceptionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "clearAutosaveSettingsExceptions", - ID: ClearAutosaveSettingsExceptionsRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ClearAutosaveSettingsExceptionsRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearAutosaveSettingsExceptions#57ec63f2 as nil") - } - b.PutID(ClearAutosaveSettingsExceptionsRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClearAutosaveSettingsExceptionsRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearAutosaveSettingsExceptions#57ec63f2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ClearAutosaveSettingsExceptionsRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearAutosaveSettingsExceptions#57ec63f2 to nil") - } - if err := b.ConsumeID(ClearAutosaveSettingsExceptionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode clearAutosaveSettingsExceptions#57ec63f2: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClearAutosaveSettingsExceptionsRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearAutosaveSettingsExceptions#57ec63f2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClearAutosaveSettingsExceptionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode clearAutosaveSettingsExceptions#57ec63f2 as nil") - } - b.ObjStart() - b.PutID("clearAutosaveSettingsExceptions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClearAutosaveSettingsExceptionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode clearAutosaveSettingsExceptions#57ec63f2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("clearAutosaveSettingsExceptions"); err != nil { - return fmt.Errorf("unable to decode clearAutosaveSettingsExceptions#57ec63f2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ClearAutosaveSettingsExceptions invokes method clearAutosaveSettingsExceptions#57ec63f2 returning error if any. -func (c *Client) ClearAutosaveSettingsExceptions(ctx context.Context) error { - var ok Ok - - request := &ClearAutosaveSettingsExceptionsRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_clear_imported_contacts_gen.go b/tdapi/tl_clear_imported_contacts_gen.go deleted file mode 100644 index c8a25cd95..000000000 --- a/tdapi/tl_clear_imported_contacts_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClearImportedContactsRequest represents TL type `clearImportedContacts#33d39142`. -type ClearImportedContactsRequest struct { -} - -// ClearImportedContactsRequestTypeID is TL type id of ClearImportedContactsRequest. -const ClearImportedContactsRequestTypeID = 0x33d39142 - -// Ensuring interfaces in compile-time for ClearImportedContactsRequest. -var ( - _ bin.Encoder = &ClearImportedContactsRequest{} - _ bin.Decoder = &ClearImportedContactsRequest{} - _ bin.BareEncoder = &ClearImportedContactsRequest{} - _ bin.BareDecoder = &ClearImportedContactsRequest{} -) - -func (c *ClearImportedContactsRequest) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClearImportedContactsRequest) String() string { - if c == nil { - return "ClearImportedContactsRequest(nil)" - } - type Alias ClearImportedContactsRequest - return fmt.Sprintf("ClearImportedContactsRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClearImportedContactsRequest) TypeID() uint32 { - return ClearImportedContactsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClearImportedContactsRequest) TypeName() string { - return "clearImportedContacts" -} - -// TypeInfo returns info about TL type. -func (c *ClearImportedContactsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "clearImportedContacts", - ID: ClearImportedContactsRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ClearImportedContactsRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearImportedContacts#33d39142 as nil") - } - b.PutID(ClearImportedContactsRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClearImportedContactsRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearImportedContacts#33d39142 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ClearImportedContactsRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearImportedContacts#33d39142 to nil") - } - if err := b.ConsumeID(ClearImportedContactsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode clearImportedContacts#33d39142: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClearImportedContactsRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearImportedContacts#33d39142 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClearImportedContactsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode clearImportedContacts#33d39142 as nil") - } - b.ObjStart() - b.PutID("clearImportedContacts") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClearImportedContactsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode clearImportedContacts#33d39142 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("clearImportedContacts"); err != nil { - return fmt.Errorf("unable to decode clearImportedContacts#33d39142: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ClearImportedContacts invokes method clearImportedContacts#33d39142 returning error if any. -func (c *Client) ClearImportedContacts(ctx context.Context) error { - var ok Ok - - request := &ClearImportedContactsRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_clear_recent_emoji_statuses_gen.go b/tdapi/tl_clear_recent_emoji_statuses_gen.go deleted file mode 100644 index a67939e88..000000000 --- a/tdapi/tl_clear_recent_emoji_statuses_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClearRecentEmojiStatusesRequest represents TL type `clearRecentEmojiStatuses#e671cb5e`. -type ClearRecentEmojiStatusesRequest struct { -} - -// ClearRecentEmojiStatusesRequestTypeID is TL type id of ClearRecentEmojiStatusesRequest. -const ClearRecentEmojiStatusesRequestTypeID = 0xe671cb5e - -// Ensuring interfaces in compile-time for ClearRecentEmojiStatusesRequest. -var ( - _ bin.Encoder = &ClearRecentEmojiStatusesRequest{} - _ bin.Decoder = &ClearRecentEmojiStatusesRequest{} - _ bin.BareEncoder = &ClearRecentEmojiStatusesRequest{} - _ bin.BareDecoder = &ClearRecentEmojiStatusesRequest{} -) - -func (c *ClearRecentEmojiStatusesRequest) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClearRecentEmojiStatusesRequest) String() string { - if c == nil { - return "ClearRecentEmojiStatusesRequest(nil)" - } - type Alias ClearRecentEmojiStatusesRequest - return fmt.Sprintf("ClearRecentEmojiStatusesRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClearRecentEmojiStatusesRequest) TypeID() uint32 { - return ClearRecentEmojiStatusesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClearRecentEmojiStatusesRequest) TypeName() string { - return "clearRecentEmojiStatuses" -} - -// TypeInfo returns info about TL type. -func (c *ClearRecentEmojiStatusesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "clearRecentEmojiStatuses", - ID: ClearRecentEmojiStatusesRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ClearRecentEmojiStatusesRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentEmojiStatuses#e671cb5e as nil") - } - b.PutID(ClearRecentEmojiStatusesRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClearRecentEmojiStatusesRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentEmojiStatuses#e671cb5e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ClearRecentEmojiStatusesRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentEmojiStatuses#e671cb5e to nil") - } - if err := b.ConsumeID(ClearRecentEmojiStatusesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode clearRecentEmojiStatuses#e671cb5e: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClearRecentEmojiStatusesRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentEmojiStatuses#e671cb5e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClearRecentEmojiStatusesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentEmojiStatuses#e671cb5e as nil") - } - b.ObjStart() - b.PutID("clearRecentEmojiStatuses") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClearRecentEmojiStatusesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentEmojiStatuses#e671cb5e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("clearRecentEmojiStatuses"); err != nil { - return fmt.Errorf("unable to decode clearRecentEmojiStatuses#e671cb5e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ClearRecentEmojiStatuses invokes method clearRecentEmojiStatuses#e671cb5e returning error if any. -func (c *Client) ClearRecentEmojiStatuses(ctx context.Context) error { - var ok Ok - - request := &ClearRecentEmojiStatusesRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_clear_recent_reactions_gen.go b/tdapi/tl_clear_recent_reactions_gen.go deleted file mode 100644 index e1afb57d6..000000000 --- a/tdapi/tl_clear_recent_reactions_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClearRecentReactionsRequest represents TL type `clearRecentReactions#4d61c752`. -type ClearRecentReactionsRequest struct { -} - -// ClearRecentReactionsRequestTypeID is TL type id of ClearRecentReactionsRequest. -const ClearRecentReactionsRequestTypeID = 0x4d61c752 - -// Ensuring interfaces in compile-time for ClearRecentReactionsRequest. -var ( - _ bin.Encoder = &ClearRecentReactionsRequest{} - _ bin.Decoder = &ClearRecentReactionsRequest{} - _ bin.BareEncoder = &ClearRecentReactionsRequest{} - _ bin.BareDecoder = &ClearRecentReactionsRequest{} -) - -func (c *ClearRecentReactionsRequest) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClearRecentReactionsRequest) String() string { - if c == nil { - return "ClearRecentReactionsRequest(nil)" - } - type Alias ClearRecentReactionsRequest - return fmt.Sprintf("ClearRecentReactionsRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClearRecentReactionsRequest) TypeID() uint32 { - return ClearRecentReactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClearRecentReactionsRequest) TypeName() string { - return "clearRecentReactions" -} - -// TypeInfo returns info about TL type. -func (c *ClearRecentReactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "clearRecentReactions", - ID: ClearRecentReactionsRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ClearRecentReactionsRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentReactions#4d61c752 as nil") - } - b.PutID(ClearRecentReactionsRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClearRecentReactionsRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentReactions#4d61c752 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ClearRecentReactionsRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentReactions#4d61c752 to nil") - } - if err := b.ConsumeID(ClearRecentReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode clearRecentReactions#4d61c752: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClearRecentReactionsRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentReactions#4d61c752 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClearRecentReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentReactions#4d61c752 as nil") - } - b.ObjStart() - b.PutID("clearRecentReactions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClearRecentReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentReactions#4d61c752 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("clearRecentReactions"); err != nil { - return fmt.Errorf("unable to decode clearRecentReactions#4d61c752: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ClearRecentReactions invokes method clearRecentReactions#4d61c752 returning error if any. -func (c *Client) ClearRecentReactions(ctx context.Context) error { - var ok Ok - - request := &ClearRecentReactionsRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_clear_recent_stickers_gen.go b/tdapi/tl_clear_recent_stickers_gen.go deleted file mode 100644 index 319b46981..000000000 --- a/tdapi/tl_clear_recent_stickers_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClearRecentStickersRequest represents TL type `clearRecentStickers#ecda39c4`. -type ClearRecentStickersRequest struct { - // Pass true to clear the list of stickers recently attached to photo or video files; - // pass false to clear the list of recently sent stickers - IsAttached bool -} - -// ClearRecentStickersRequestTypeID is TL type id of ClearRecentStickersRequest. -const ClearRecentStickersRequestTypeID = 0xecda39c4 - -// Ensuring interfaces in compile-time for ClearRecentStickersRequest. -var ( - _ bin.Encoder = &ClearRecentStickersRequest{} - _ bin.Decoder = &ClearRecentStickersRequest{} - _ bin.BareEncoder = &ClearRecentStickersRequest{} - _ bin.BareDecoder = &ClearRecentStickersRequest{} -) - -func (c *ClearRecentStickersRequest) Zero() bool { - if c == nil { - return true - } - if !(c.IsAttached == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClearRecentStickersRequest) String() string { - if c == nil { - return "ClearRecentStickersRequest(nil)" - } - type Alias ClearRecentStickersRequest - return fmt.Sprintf("ClearRecentStickersRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClearRecentStickersRequest) TypeID() uint32 { - return ClearRecentStickersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClearRecentStickersRequest) TypeName() string { - return "clearRecentStickers" -} - -// TypeInfo returns info about TL type. -func (c *ClearRecentStickersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "clearRecentStickers", - ID: ClearRecentStickersRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsAttached", - SchemaName: "is_attached", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ClearRecentStickersRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentStickers#ecda39c4 as nil") - } - b.PutID(ClearRecentStickersRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClearRecentStickersRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentStickers#ecda39c4 as nil") - } - b.PutBool(c.IsAttached) - return nil -} - -// Decode implements bin.Decoder. -func (c *ClearRecentStickersRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentStickers#ecda39c4 to nil") - } - if err := b.ConsumeID(ClearRecentStickersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode clearRecentStickers#ecda39c4: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClearRecentStickersRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentStickers#ecda39c4 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode clearRecentStickers#ecda39c4: field is_attached: %w", err) - } - c.IsAttached = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClearRecentStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentStickers#ecda39c4 as nil") - } - b.ObjStart() - b.PutID("clearRecentStickers") - b.Comma() - b.FieldStart("is_attached") - b.PutBool(c.IsAttached) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClearRecentStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentStickers#ecda39c4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("clearRecentStickers"); err != nil { - return fmt.Errorf("unable to decode clearRecentStickers#ecda39c4: %w", err) - } - case "is_attached": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode clearRecentStickers#ecda39c4: field is_attached: %w", err) - } - c.IsAttached = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsAttached returns value of IsAttached field. -func (c *ClearRecentStickersRequest) GetIsAttached() (value bool) { - if c == nil { - return - } - return c.IsAttached -} - -// ClearRecentStickers invokes method clearRecentStickers#ecda39c4 returning error if any. -func (c *Client) ClearRecentStickers(ctx context.Context, isattached bool) error { - var ok Ok - - request := &ClearRecentStickersRequest{ - IsAttached: isattached, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_clear_recently_found_chats_gen.go b/tdapi/tl_clear_recently_found_chats_gen.go deleted file mode 100644 index cf58d7248..000000000 --- a/tdapi/tl_clear_recently_found_chats_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClearRecentlyFoundChatsRequest represents TL type `clearRecentlyFoundChats#eefa5b32`. -type ClearRecentlyFoundChatsRequest struct { -} - -// ClearRecentlyFoundChatsRequestTypeID is TL type id of ClearRecentlyFoundChatsRequest. -const ClearRecentlyFoundChatsRequestTypeID = 0xeefa5b32 - -// Ensuring interfaces in compile-time for ClearRecentlyFoundChatsRequest. -var ( - _ bin.Encoder = &ClearRecentlyFoundChatsRequest{} - _ bin.Decoder = &ClearRecentlyFoundChatsRequest{} - _ bin.BareEncoder = &ClearRecentlyFoundChatsRequest{} - _ bin.BareDecoder = &ClearRecentlyFoundChatsRequest{} -) - -func (c *ClearRecentlyFoundChatsRequest) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClearRecentlyFoundChatsRequest) String() string { - if c == nil { - return "ClearRecentlyFoundChatsRequest(nil)" - } - type Alias ClearRecentlyFoundChatsRequest - return fmt.Sprintf("ClearRecentlyFoundChatsRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClearRecentlyFoundChatsRequest) TypeID() uint32 { - return ClearRecentlyFoundChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClearRecentlyFoundChatsRequest) TypeName() string { - return "clearRecentlyFoundChats" -} - -// TypeInfo returns info about TL type. -func (c *ClearRecentlyFoundChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "clearRecentlyFoundChats", - ID: ClearRecentlyFoundChatsRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ClearRecentlyFoundChatsRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentlyFoundChats#eefa5b32 as nil") - } - b.PutID(ClearRecentlyFoundChatsRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClearRecentlyFoundChatsRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentlyFoundChats#eefa5b32 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ClearRecentlyFoundChatsRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentlyFoundChats#eefa5b32 to nil") - } - if err := b.ConsumeID(ClearRecentlyFoundChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode clearRecentlyFoundChats#eefa5b32: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClearRecentlyFoundChatsRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentlyFoundChats#eefa5b32 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClearRecentlyFoundChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode clearRecentlyFoundChats#eefa5b32 as nil") - } - b.ObjStart() - b.PutID("clearRecentlyFoundChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClearRecentlyFoundChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode clearRecentlyFoundChats#eefa5b32 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("clearRecentlyFoundChats"); err != nil { - return fmt.Errorf("unable to decode clearRecentlyFoundChats#eefa5b32: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ClearRecentlyFoundChats invokes method clearRecentlyFoundChats#eefa5b32 returning error if any. -func (c *Client) ClearRecentlyFoundChats(ctx context.Context) error { - var ok Ok - - request := &ClearRecentlyFoundChatsRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_clear_searched_for_tags_gen.go b/tdapi/tl_clear_searched_for_tags_gen.go deleted file mode 100644 index d8be447bd..000000000 --- a/tdapi/tl_clear_searched_for_tags_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClearSearchedForTagsRequest represents TL type `clearSearchedForTags#1e84c356`. -type ClearSearchedForTagsRequest struct { - // Pass true to clear the list of recently searched for cashtags; otherwise, the list of - // recently searched for hashtags will be cleared - ClearCashtags bool -} - -// ClearSearchedForTagsRequestTypeID is TL type id of ClearSearchedForTagsRequest. -const ClearSearchedForTagsRequestTypeID = 0x1e84c356 - -// Ensuring interfaces in compile-time for ClearSearchedForTagsRequest. -var ( - _ bin.Encoder = &ClearSearchedForTagsRequest{} - _ bin.Decoder = &ClearSearchedForTagsRequest{} - _ bin.BareEncoder = &ClearSearchedForTagsRequest{} - _ bin.BareDecoder = &ClearSearchedForTagsRequest{} -) - -func (c *ClearSearchedForTagsRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ClearCashtags == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClearSearchedForTagsRequest) String() string { - if c == nil { - return "ClearSearchedForTagsRequest(nil)" - } - type Alias ClearSearchedForTagsRequest - return fmt.Sprintf("ClearSearchedForTagsRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClearSearchedForTagsRequest) TypeID() uint32 { - return ClearSearchedForTagsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClearSearchedForTagsRequest) TypeName() string { - return "clearSearchedForTags" -} - -// TypeInfo returns info about TL type. -func (c *ClearSearchedForTagsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "clearSearchedForTags", - ID: ClearSearchedForTagsRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ClearCashtags", - SchemaName: "clear_cashtags", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ClearSearchedForTagsRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearSearchedForTags#1e84c356 as nil") - } - b.PutID(ClearSearchedForTagsRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClearSearchedForTagsRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clearSearchedForTags#1e84c356 as nil") - } - b.PutBool(c.ClearCashtags) - return nil -} - -// Decode implements bin.Decoder. -func (c *ClearSearchedForTagsRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearSearchedForTags#1e84c356 to nil") - } - if err := b.ConsumeID(ClearSearchedForTagsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode clearSearchedForTags#1e84c356: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClearSearchedForTagsRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clearSearchedForTags#1e84c356 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode clearSearchedForTags#1e84c356: field clear_cashtags: %w", err) - } - c.ClearCashtags = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClearSearchedForTagsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode clearSearchedForTags#1e84c356 as nil") - } - b.ObjStart() - b.PutID("clearSearchedForTags") - b.Comma() - b.FieldStart("clear_cashtags") - b.PutBool(c.ClearCashtags) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClearSearchedForTagsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode clearSearchedForTags#1e84c356 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("clearSearchedForTags"); err != nil { - return fmt.Errorf("unable to decode clearSearchedForTags#1e84c356: %w", err) - } - case "clear_cashtags": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode clearSearchedForTags#1e84c356: field clear_cashtags: %w", err) - } - c.ClearCashtags = value - default: - return b.Skip() - } - return nil - }) -} - -// GetClearCashtags returns value of ClearCashtags field. -func (c *ClearSearchedForTagsRequest) GetClearCashtags() (value bool) { - if c == nil { - return - } - return c.ClearCashtags -} - -// ClearSearchedForTags invokes method clearSearchedForTags#1e84c356 returning error if any. -func (c *Client) ClearSearchedForTags(ctx context.Context, clearcashtags bool) error { - var ok Ok - - request := &ClearSearchedForTagsRequest{ - ClearCashtags: clearcashtags, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_click_animated_emoji_message_gen.go b/tdapi/tl_click_animated_emoji_message_gen.go deleted file mode 100644 index 35c12949a..000000000 --- a/tdapi/tl_click_animated_emoji_message_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClickAnimatedEmojiMessageRequest represents TL type `clickAnimatedEmojiMessage#bb17662`. -type ClickAnimatedEmojiMessageRequest struct { - // Chat identifier of the message - ChatID int64 - // Identifier of the clicked message - MessageID int64 -} - -// ClickAnimatedEmojiMessageRequestTypeID is TL type id of ClickAnimatedEmojiMessageRequest. -const ClickAnimatedEmojiMessageRequestTypeID = 0xbb17662 - -// Ensuring interfaces in compile-time for ClickAnimatedEmojiMessageRequest. -var ( - _ bin.Encoder = &ClickAnimatedEmojiMessageRequest{} - _ bin.Decoder = &ClickAnimatedEmojiMessageRequest{} - _ bin.BareEncoder = &ClickAnimatedEmojiMessageRequest{} - _ bin.BareDecoder = &ClickAnimatedEmojiMessageRequest{} -) - -func (c *ClickAnimatedEmojiMessageRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClickAnimatedEmojiMessageRequest) String() string { - if c == nil { - return "ClickAnimatedEmojiMessageRequest(nil)" - } - type Alias ClickAnimatedEmojiMessageRequest - return fmt.Sprintf("ClickAnimatedEmojiMessageRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClickAnimatedEmojiMessageRequest) TypeID() uint32 { - return ClickAnimatedEmojiMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClickAnimatedEmojiMessageRequest) TypeName() string { - return "clickAnimatedEmojiMessage" -} - -// TypeInfo returns info about TL type. -func (c *ClickAnimatedEmojiMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "clickAnimatedEmojiMessage", - ID: ClickAnimatedEmojiMessageRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ClickAnimatedEmojiMessageRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clickAnimatedEmojiMessage#bb17662 as nil") - } - b.PutID(ClickAnimatedEmojiMessageRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClickAnimatedEmojiMessageRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clickAnimatedEmojiMessage#bb17662 as nil") - } - b.PutInt53(c.ChatID) - b.PutInt53(c.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ClickAnimatedEmojiMessageRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clickAnimatedEmojiMessage#bb17662 to nil") - } - if err := b.ConsumeID(ClickAnimatedEmojiMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode clickAnimatedEmojiMessage#bb17662: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClickAnimatedEmojiMessageRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clickAnimatedEmojiMessage#bb17662 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode clickAnimatedEmojiMessage#bb17662: field chat_id: %w", err) - } - c.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode clickAnimatedEmojiMessage#bb17662: field message_id: %w", err) - } - c.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClickAnimatedEmojiMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode clickAnimatedEmojiMessage#bb17662 as nil") - } - b.ObjStart() - b.PutID("clickAnimatedEmojiMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(c.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClickAnimatedEmojiMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode clickAnimatedEmojiMessage#bb17662 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("clickAnimatedEmojiMessage"); err != nil { - return fmt.Errorf("unable to decode clickAnimatedEmojiMessage#bb17662: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode clickAnimatedEmojiMessage#bb17662: field chat_id: %w", err) - } - c.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode clickAnimatedEmojiMessage#bb17662: field message_id: %w", err) - } - c.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *ClickAnimatedEmojiMessageRequest) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetMessageID returns value of MessageID field. -func (c *ClickAnimatedEmojiMessageRequest) GetMessageID() (value int64) { - if c == nil { - return - } - return c.MessageID -} - -// ClickAnimatedEmojiMessage invokes method clickAnimatedEmojiMessage#bb17662 returning error if any. -func (c *Client) ClickAnimatedEmojiMessage(ctx context.Context, request *ClickAnimatedEmojiMessageRequest) (*Sticker, error) { - var result Sticker - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_click_chat_sponsored_message_gen.go b/tdapi/tl_click_chat_sponsored_message_gen.go deleted file mode 100644 index 649f75df6..000000000 --- a/tdapi/tl_click_chat_sponsored_message_gen.go +++ /dev/null @@ -1,306 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClickChatSponsoredMessageRequest represents TL type `clickChatSponsoredMessage#39ef7a17`. -type ClickChatSponsoredMessageRequest struct { - // Chat identifier of the sponsored message - ChatID int64 - // Identifier of the sponsored message - MessageID int64 - // Pass true if the media was clicked in the sponsored message - IsMediaClick bool - // Pass true if the user expanded the video from the sponsored message fullscreen before - // the click - FromFullscreen bool -} - -// ClickChatSponsoredMessageRequestTypeID is TL type id of ClickChatSponsoredMessageRequest. -const ClickChatSponsoredMessageRequestTypeID = 0x39ef7a17 - -// Ensuring interfaces in compile-time for ClickChatSponsoredMessageRequest. -var ( - _ bin.Encoder = &ClickChatSponsoredMessageRequest{} - _ bin.Decoder = &ClickChatSponsoredMessageRequest{} - _ bin.BareEncoder = &ClickChatSponsoredMessageRequest{} - _ bin.BareDecoder = &ClickChatSponsoredMessageRequest{} -) - -func (c *ClickChatSponsoredMessageRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.MessageID == 0) { - return false - } - if !(c.IsMediaClick == false) { - return false - } - if !(c.FromFullscreen == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClickChatSponsoredMessageRequest) String() string { - if c == nil { - return "ClickChatSponsoredMessageRequest(nil)" - } - type Alias ClickChatSponsoredMessageRequest - return fmt.Sprintf("ClickChatSponsoredMessageRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClickChatSponsoredMessageRequest) TypeID() uint32 { - return ClickChatSponsoredMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClickChatSponsoredMessageRequest) TypeName() string { - return "clickChatSponsoredMessage" -} - -// TypeInfo returns info about TL type. -func (c *ClickChatSponsoredMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "clickChatSponsoredMessage", - ID: ClickChatSponsoredMessageRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "IsMediaClick", - SchemaName: "is_media_click", - }, - { - Name: "FromFullscreen", - SchemaName: "from_fullscreen", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ClickChatSponsoredMessageRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clickChatSponsoredMessage#39ef7a17 as nil") - } - b.PutID(ClickChatSponsoredMessageRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClickChatSponsoredMessageRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clickChatSponsoredMessage#39ef7a17 as nil") - } - b.PutInt53(c.ChatID) - b.PutInt53(c.MessageID) - b.PutBool(c.IsMediaClick) - b.PutBool(c.FromFullscreen) - return nil -} - -// Decode implements bin.Decoder. -func (c *ClickChatSponsoredMessageRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clickChatSponsoredMessage#39ef7a17 to nil") - } - if err := b.ConsumeID(ClickChatSponsoredMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode clickChatSponsoredMessage#39ef7a17: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClickChatSponsoredMessageRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clickChatSponsoredMessage#39ef7a17 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode clickChatSponsoredMessage#39ef7a17: field chat_id: %w", err) - } - c.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode clickChatSponsoredMessage#39ef7a17: field message_id: %w", err) - } - c.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode clickChatSponsoredMessage#39ef7a17: field is_media_click: %w", err) - } - c.IsMediaClick = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode clickChatSponsoredMessage#39ef7a17: field from_fullscreen: %w", err) - } - c.FromFullscreen = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClickChatSponsoredMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode clickChatSponsoredMessage#39ef7a17 as nil") - } - b.ObjStart() - b.PutID("clickChatSponsoredMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(c.MessageID) - b.Comma() - b.FieldStart("is_media_click") - b.PutBool(c.IsMediaClick) - b.Comma() - b.FieldStart("from_fullscreen") - b.PutBool(c.FromFullscreen) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClickChatSponsoredMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode clickChatSponsoredMessage#39ef7a17 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("clickChatSponsoredMessage"); err != nil { - return fmt.Errorf("unable to decode clickChatSponsoredMessage#39ef7a17: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode clickChatSponsoredMessage#39ef7a17: field chat_id: %w", err) - } - c.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode clickChatSponsoredMessage#39ef7a17: field message_id: %w", err) - } - c.MessageID = value - case "is_media_click": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode clickChatSponsoredMessage#39ef7a17: field is_media_click: %w", err) - } - c.IsMediaClick = value - case "from_fullscreen": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode clickChatSponsoredMessage#39ef7a17: field from_fullscreen: %w", err) - } - c.FromFullscreen = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *ClickChatSponsoredMessageRequest) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetMessageID returns value of MessageID field. -func (c *ClickChatSponsoredMessageRequest) GetMessageID() (value int64) { - if c == nil { - return - } - return c.MessageID -} - -// GetIsMediaClick returns value of IsMediaClick field. -func (c *ClickChatSponsoredMessageRequest) GetIsMediaClick() (value bool) { - if c == nil { - return - } - return c.IsMediaClick -} - -// GetFromFullscreen returns value of FromFullscreen field. -func (c *ClickChatSponsoredMessageRequest) GetFromFullscreen() (value bool) { - if c == nil { - return - } - return c.FromFullscreen -} - -// ClickChatSponsoredMessage invokes method clickChatSponsoredMessage#39ef7a17 returning error if any. -func (c *Client) ClickChatSponsoredMessage(ctx context.Context, request *ClickChatSponsoredMessageRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_click_premium_subscription_button_gen.go b/tdapi/tl_click_premium_subscription_button_gen.go deleted file mode 100644 index e251dfe2c..000000000 --- a/tdapi/tl_click_premium_subscription_button_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClickPremiumSubscriptionButtonRequest represents TL type `clickPremiumSubscriptionButton#e9fca306`. -type ClickPremiumSubscriptionButtonRequest struct { -} - -// ClickPremiumSubscriptionButtonRequestTypeID is TL type id of ClickPremiumSubscriptionButtonRequest. -const ClickPremiumSubscriptionButtonRequestTypeID = 0xe9fca306 - -// Ensuring interfaces in compile-time for ClickPremiumSubscriptionButtonRequest. -var ( - _ bin.Encoder = &ClickPremiumSubscriptionButtonRequest{} - _ bin.Decoder = &ClickPremiumSubscriptionButtonRequest{} - _ bin.BareEncoder = &ClickPremiumSubscriptionButtonRequest{} - _ bin.BareDecoder = &ClickPremiumSubscriptionButtonRequest{} -) - -func (c *ClickPremiumSubscriptionButtonRequest) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClickPremiumSubscriptionButtonRequest) String() string { - if c == nil { - return "ClickPremiumSubscriptionButtonRequest(nil)" - } - type Alias ClickPremiumSubscriptionButtonRequest - return fmt.Sprintf("ClickPremiumSubscriptionButtonRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClickPremiumSubscriptionButtonRequest) TypeID() uint32 { - return ClickPremiumSubscriptionButtonRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClickPremiumSubscriptionButtonRequest) TypeName() string { - return "clickPremiumSubscriptionButton" -} - -// TypeInfo returns info about TL type. -func (c *ClickPremiumSubscriptionButtonRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "clickPremiumSubscriptionButton", - ID: ClickPremiumSubscriptionButtonRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ClickPremiumSubscriptionButtonRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clickPremiumSubscriptionButton#e9fca306 as nil") - } - b.PutID(ClickPremiumSubscriptionButtonRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClickPremiumSubscriptionButtonRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode clickPremiumSubscriptionButton#e9fca306 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ClickPremiumSubscriptionButtonRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clickPremiumSubscriptionButton#e9fca306 to nil") - } - if err := b.ConsumeID(ClickPremiumSubscriptionButtonRequestTypeID); err != nil { - return fmt.Errorf("unable to decode clickPremiumSubscriptionButton#e9fca306: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClickPremiumSubscriptionButtonRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode clickPremiumSubscriptionButton#e9fca306 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClickPremiumSubscriptionButtonRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode clickPremiumSubscriptionButton#e9fca306 as nil") - } - b.ObjStart() - b.PutID("clickPremiumSubscriptionButton") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClickPremiumSubscriptionButtonRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode clickPremiumSubscriptionButton#e9fca306 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("clickPremiumSubscriptionButton"); err != nil { - return fmt.Errorf("unable to decode clickPremiumSubscriptionButton#e9fca306: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ClickPremiumSubscriptionButton invokes method clickPremiumSubscriptionButton#e9fca306 returning error if any. -func (c *Client) ClickPremiumSubscriptionButton(ctx context.Context) error { - var ok Ok - - request := &ClickPremiumSubscriptionButtonRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_client_gen.go b/tdapi/tl_client_gen.go deleted file mode 100644 index 655b86ae2..000000000 --- a/tdapi/tl_client_gen.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Invoker can invoke raw MTProto rpc calls. -type Invoker interface { - Invoke(ctx context.Context, input bin.Encoder, output bin.Decoder) error -} - -// Client implement methods for calling functions from TL schema via Invoker. -type Client struct { - rpc Invoker -} - -// Invoker returns Invoker used by this client. -func (c *Client) Invoker() Invoker { - return c.rpc -} - -// NewClient creates new Client. -func NewClient(invoker Invoker) *Client { - return &Client{ - rpc: invoker, - } -} diff --git a/tdapi/tl_close_birthday_user_gen.go b/tdapi/tl_close_birthday_user_gen.go deleted file mode 100644 index c536166bb..000000000 --- a/tdapi/tl_close_birthday_user_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CloseBirthdayUser represents TL type `closeBirthdayUser#800659ee`. -type CloseBirthdayUser struct { - // User identifier - UserID int64 - // Birthdate of the user - Birthdate Birthdate -} - -// CloseBirthdayUserTypeID is TL type id of CloseBirthdayUser. -const CloseBirthdayUserTypeID = 0x800659ee - -// Ensuring interfaces in compile-time for CloseBirthdayUser. -var ( - _ bin.Encoder = &CloseBirthdayUser{} - _ bin.Decoder = &CloseBirthdayUser{} - _ bin.BareEncoder = &CloseBirthdayUser{} - _ bin.BareDecoder = &CloseBirthdayUser{} -) - -func (c *CloseBirthdayUser) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.Birthdate.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CloseBirthdayUser) String() string { - if c == nil { - return "CloseBirthdayUser(nil)" - } - type Alias CloseBirthdayUser - return fmt.Sprintf("CloseBirthdayUser%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CloseBirthdayUser) TypeID() uint32 { - return CloseBirthdayUserTypeID -} - -// TypeName returns name of type in TL schema. -func (*CloseBirthdayUser) TypeName() string { - return "closeBirthdayUser" -} - -// TypeInfo returns info about TL type. -func (c *CloseBirthdayUser) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "closeBirthdayUser", - ID: CloseBirthdayUserTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Birthdate", - SchemaName: "birthdate", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CloseBirthdayUser) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closeBirthdayUser#800659ee as nil") - } - b.PutID(CloseBirthdayUserTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CloseBirthdayUser) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closeBirthdayUser#800659ee as nil") - } - b.PutInt53(c.UserID) - if err := c.Birthdate.Encode(b); err != nil { - return fmt.Errorf("unable to encode closeBirthdayUser#800659ee: field birthdate: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CloseBirthdayUser) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closeBirthdayUser#800659ee to nil") - } - if err := b.ConsumeID(CloseBirthdayUserTypeID); err != nil { - return fmt.Errorf("unable to decode closeBirthdayUser#800659ee: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CloseBirthdayUser) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closeBirthdayUser#800659ee to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode closeBirthdayUser#800659ee: field user_id: %w", err) - } - c.UserID = value - } - { - if err := c.Birthdate.Decode(b); err != nil { - return fmt.Errorf("unable to decode closeBirthdayUser#800659ee: field birthdate: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CloseBirthdayUser) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode closeBirthdayUser#800659ee as nil") - } - b.ObjStart() - b.PutID("closeBirthdayUser") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("birthdate") - if err := c.Birthdate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode closeBirthdayUser#800659ee: field birthdate: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CloseBirthdayUser) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode closeBirthdayUser#800659ee to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("closeBirthdayUser"); err != nil { - return fmt.Errorf("unable to decode closeBirthdayUser#800659ee: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode closeBirthdayUser#800659ee: field user_id: %w", err) - } - c.UserID = value - case "birthdate": - if err := c.Birthdate.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode closeBirthdayUser#800659ee: field birthdate: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *CloseBirthdayUser) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetBirthdate returns value of Birthdate field. -func (c *CloseBirthdayUser) GetBirthdate() (value Birthdate) { - if c == nil { - return - } - return c.Birthdate -} diff --git a/tdapi/tl_close_chat_gen.go b/tdapi/tl_close_chat_gen.go deleted file mode 100644 index 4ac2289be..000000000 --- a/tdapi/tl_close_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CloseChatRequest represents TL type `closeChat#25e86e9`. -type CloseChatRequest struct { - // Chat identifier - ChatID int64 -} - -// CloseChatRequestTypeID is TL type id of CloseChatRequest. -const CloseChatRequestTypeID = 0x25e86e9 - -// Ensuring interfaces in compile-time for CloseChatRequest. -var ( - _ bin.Encoder = &CloseChatRequest{} - _ bin.Decoder = &CloseChatRequest{} - _ bin.BareEncoder = &CloseChatRequest{} - _ bin.BareDecoder = &CloseChatRequest{} -) - -func (c *CloseChatRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CloseChatRequest) String() string { - if c == nil { - return "CloseChatRequest(nil)" - } - type Alias CloseChatRequest - return fmt.Sprintf("CloseChatRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CloseChatRequest) TypeID() uint32 { - return CloseChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CloseChatRequest) TypeName() string { - return "closeChat" -} - -// TypeInfo returns info about TL type. -func (c *CloseChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "closeChat", - ID: CloseChatRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CloseChatRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closeChat#25e86e9 as nil") - } - b.PutID(CloseChatRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CloseChatRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closeChat#25e86e9 as nil") - } - b.PutInt53(c.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CloseChatRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closeChat#25e86e9 to nil") - } - if err := b.ConsumeID(CloseChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode closeChat#25e86e9: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CloseChatRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closeChat#25e86e9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode closeChat#25e86e9: field chat_id: %w", err) - } - c.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CloseChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode closeChat#25e86e9 as nil") - } - b.ObjStart() - b.PutID("closeChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CloseChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode closeChat#25e86e9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("closeChat"); err != nil { - return fmt.Errorf("unable to decode closeChat#25e86e9: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode closeChat#25e86e9: field chat_id: %w", err) - } - c.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *CloseChatRequest) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// CloseChat invokes method closeChat#25e86e9 returning error if any. -func (c *Client) CloseChat(ctx context.Context, chatid int64) error { - var ok Ok - - request := &CloseChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_close_gen.go b/tdapi/tl_close_gen.go deleted file mode 100644 index f80759aeb..000000000 --- a/tdapi/tl_close_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CloseRequest represents TL type `close#b933e17f`. -type CloseRequest struct { -} - -// CloseRequestTypeID is TL type id of CloseRequest. -const CloseRequestTypeID = 0xb933e17f - -// Ensuring interfaces in compile-time for CloseRequest. -var ( - _ bin.Encoder = &CloseRequest{} - _ bin.Decoder = &CloseRequest{} - _ bin.BareEncoder = &CloseRequest{} - _ bin.BareDecoder = &CloseRequest{} -) - -func (c *CloseRequest) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *CloseRequest) String() string { - if c == nil { - return "CloseRequest(nil)" - } - type Alias CloseRequest - return fmt.Sprintf("CloseRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CloseRequest) TypeID() uint32 { - return CloseRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CloseRequest) TypeName() string { - return "close" -} - -// TypeInfo returns info about TL type. -func (c *CloseRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "close", - ID: CloseRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *CloseRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode close#b933e17f as nil") - } - b.PutID(CloseRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CloseRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode close#b933e17f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CloseRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode close#b933e17f to nil") - } - if err := b.ConsumeID(CloseRequestTypeID); err != nil { - return fmt.Errorf("unable to decode close#b933e17f: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CloseRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode close#b933e17f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CloseRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode close#b933e17f as nil") - } - b.ObjStart() - b.PutID("close") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CloseRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode close#b933e17f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("close"); err != nil { - return fmt.Errorf("unable to decode close#b933e17f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// Close invokes method close#b933e17f returning error if any. -func (c *Client) Close(ctx context.Context) error { - var ok Ok - - request := &CloseRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_close_secret_chat_gen.go b/tdapi/tl_close_secret_chat_gen.go deleted file mode 100644 index 9a12b018c..000000000 --- a/tdapi/tl_close_secret_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CloseSecretChatRequest represents TL type `closeSecretChat#e3ed044b`. -type CloseSecretChatRequest struct { - // Secret chat identifier - SecretChatID int32 -} - -// CloseSecretChatRequestTypeID is TL type id of CloseSecretChatRequest. -const CloseSecretChatRequestTypeID = 0xe3ed044b - -// Ensuring interfaces in compile-time for CloseSecretChatRequest. -var ( - _ bin.Encoder = &CloseSecretChatRequest{} - _ bin.Decoder = &CloseSecretChatRequest{} - _ bin.BareEncoder = &CloseSecretChatRequest{} - _ bin.BareDecoder = &CloseSecretChatRequest{} -) - -func (c *CloseSecretChatRequest) Zero() bool { - if c == nil { - return true - } - if !(c.SecretChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CloseSecretChatRequest) String() string { - if c == nil { - return "CloseSecretChatRequest(nil)" - } - type Alias CloseSecretChatRequest - return fmt.Sprintf("CloseSecretChatRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CloseSecretChatRequest) TypeID() uint32 { - return CloseSecretChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CloseSecretChatRequest) TypeName() string { - return "closeSecretChat" -} - -// TypeInfo returns info about TL type. -func (c *CloseSecretChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "closeSecretChat", - ID: CloseSecretChatRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SecretChatID", - SchemaName: "secret_chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CloseSecretChatRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closeSecretChat#e3ed044b as nil") - } - b.PutID(CloseSecretChatRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CloseSecretChatRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closeSecretChat#e3ed044b as nil") - } - b.PutInt32(c.SecretChatID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CloseSecretChatRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closeSecretChat#e3ed044b to nil") - } - if err := b.ConsumeID(CloseSecretChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode closeSecretChat#e3ed044b: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CloseSecretChatRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closeSecretChat#e3ed044b to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode closeSecretChat#e3ed044b: field secret_chat_id: %w", err) - } - c.SecretChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CloseSecretChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode closeSecretChat#e3ed044b as nil") - } - b.ObjStart() - b.PutID("closeSecretChat") - b.Comma() - b.FieldStart("secret_chat_id") - b.PutInt32(c.SecretChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CloseSecretChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode closeSecretChat#e3ed044b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("closeSecretChat"); err != nil { - return fmt.Errorf("unable to decode closeSecretChat#e3ed044b: %w", err) - } - case "secret_chat_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode closeSecretChat#e3ed044b: field secret_chat_id: %w", err) - } - c.SecretChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSecretChatID returns value of SecretChatID field. -func (c *CloseSecretChatRequest) GetSecretChatID() (value int32) { - if c == nil { - return - } - return c.SecretChatID -} - -// CloseSecretChat invokes method closeSecretChat#e3ed044b returning error if any. -func (c *Client) CloseSecretChat(ctx context.Context, secretchatid int32) error { - var ok Ok - - request := &CloseSecretChatRequest{ - SecretChatID: secretchatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_close_story_gen.go b/tdapi/tl_close_story_gen.go deleted file mode 100644 index a383ed061..000000000 --- a/tdapi/tl_close_story_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CloseStoryRequest represents TL type `closeStory#443d0f55`. -type CloseStoryRequest struct { - // The identifier of the sender of the story to close - StorySenderChatID int64 - // The identifier of the story - StoryID int32 -} - -// CloseStoryRequestTypeID is TL type id of CloseStoryRequest. -const CloseStoryRequestTypeID = 0x443d0f55 - -// Ensuring interfaces in compile-time for CloseStoryRequest. -var ( - _ bin.Encoder = &CloseStoryRequest{} - _ bin.Decoder = &CloseStoryRequest{} - _ bin.BareEncoder = &CloseStoryRequest{} - _ bin.BareDecoder = &CloseStoryRequest{} -) - -func (c *CloseStoryRequest) Zero() bool { - if c == nil { - return true - } - if !(c.StorySenderChatID == 0) { - return false - } - if !(c.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CloseStoryRequest) String() string { - if c == nil { - return "CloseStoryRequest(nil)" - } - type Alias CloseStoryRequest - return fmt.Sprintf("CloseStoryRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CloseStoryRequest) TypeID() uint32 { - return CloseStoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CloseStoryRequest) TypeName() string { - return "closeStory" -} - -// TypeInfo returns info about TL type. -func (c *CloseStoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "closeStory", - ID: CloseStoryRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CloseStoryRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closeStory#443d0f55 as nil") - } - b.PutID(CloseStoryRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CloseStoryRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closeStory#443d0f55 as nil") - } - b.PutInt53(c.StorySenderChatID) - b.PutInt32(c.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CloseStoryRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closeStory#443d0f55 to nil") - } - if err := b.ConsumeID(CloseStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode closeStory#443d0f55: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CloseStoryRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closeStory#443d0f55 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode closeStory#443d0f55: field story_sender_chat_id: %w", err) - } - c.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode closeStory#443d0f55: field story_id: %w", err) - } - c.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CloseStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode closeStory#443d0f55 as nil") - } - b.ObjStart() - b.PutID("closeStory") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(c.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(c.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CloseStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode closeStory#443d0f55 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("closeStory"); err != nil { - return fmt.Errorf("unable to decode closeStory#443d0f55: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode closeStory#443d0f55: field story_sender_chat_id: %w", err) - } - c.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode closeStory#443d0f55: field story_id: %w", err) - } - c.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (c *CloseStoryRequest) GetStorySenderChatID() (value int64) { - if c == nil { - return - } - return c.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (c *CloseStoryRequest) GetStoryID() (value int32) { - if c == nil { - return - } - return c.StoryID -} - -// CloseStory invokes method closeStory#443d0f55 returning error if any. -func (c *Client) CloseStory(ctx context.Context, request *CloseStoryRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_close_web_app_gen.go b/tdapi/tl_close_web_app_gen.go deleted file mode 100644 index 518299674..000000000 --- a/tdapi/tl_close_web_app_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CloseWebAppRequest represents TL type `closeWebApp#68a124c6`. -type CloseWebAppRequest struct { - // Identifier of Web App launch, received from openWebApp - WebAppLaunchID int64 -} - -// CloseWebAppRequestTypeID is TL type id of CloseWebAppRequest. -const CloseWebAppRequestTypeID = 0x68a124c6 - -// Ensuring interfaces in compile-time for CloseWebAppRequest. -var ( - _ bin.Encoder = &CloseWebAppRequest{} - _ bin.Decoder = &CloseWebAppRequest{} - _ bin.BareEncoder = &CloseWebAppRequest{} - _ bin.BareDecoder = &CloseWebAppRequest{} -) - -func (c *CloseWebAppRequest) Zero() bool { - if c == nil { - return true - } - if !(c.WebAppLaunchID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CloseWebAppRequest) String() string { - if c == nil { - return "CloseWebAppRequest(nil)" - } - type Alias CloseWebAppRequest - return fmt.Sprintf("CloseWebAppRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CloseWebAppRequest) TypeID() uint32 { - return CloseWebAppRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CloseWebAppRequest) TypeName() string { - return "closeWebApp" -} - -// TypeInfo returns info about TL type. -func (c *CloseWebAppRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "closeWebApp", - ID: CloseWebAppRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WebAppLaunchID", - SchemaName: "web_app_launch_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CloseWebAppRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closeWebApp#68a124c6 as nil") - } - b.PutID(CloseWebAppRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CloseWebAppRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closeWebApp#68a124c6 as nil") - } - b.PutLong(c.WebAppLaunchID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CloseWebAppRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closeWebApp#68a124c6 to nil") - } - if err := b.ConsumeID(CloseWebAppRequestTypeID); err != nil { - return fmt.Errorf("unable to decode closeWebApp#68a124c6: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CloseWebAppRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closeWebApp#68a124c6 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode closeWebApp#68a124c6: field web_app_launch_id: %w", err) - } - c.WebAppLaunchID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CloseWebAppRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode closeWebApp#68a124c6 as nil") - } - b.ObjStart() - b.PutID("closeWebApp") - b.Comma() - b.FieldStart("web_app_launch_id") - b.PutLong(c.WebAppLaunchID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CloseWebAppRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode closeWebApp#68a124c6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("closeWebApp"); err != nil { - return fmt.Errorf("unable to decode closeWebApp#68a124c6: %w", err) - } - case "web_app_launch_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode closeWebApp#68a124c6: field web_app_launch_id: %w", err) - } - c.WebAppLaunchID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWebAppLaunchID returns value of WebAppLaunchID field. -func (c *CloseWebAppRequest) GetWebAppLaunchID() (value int64) { - if c == nil { - return - } - return c.WebAppLaunchID -} - -// CloseWebApp invokes method closeWebApp#68a124c6 returning error if any. -func (c *Client) CloseWebApp(ctx context.Context, webapplaunchid int64) error { - var ok Ok - - request := &CloseWebAppRequest{ - WebAppLaunchID: webapplaunchid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_closed_vector_path_gen.go b/tdapi/tl_closed_vector_path_gen.go deleted file mode 100644 index e31730bf2..000000000 --- a/tdapi/tl_closed_vector_path_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ClosedVectorPath represents TL type `closedVectorPath#2f9276b9`. -type ClosedVectorPath struct { - // List of vector path commands - Commands []VectorPathCommandClass -} - -// ClosedVectorPathTypeID is TL type id of ClosedVectorPath. -const ClosedVectorPathTypeID = 0x2f9276b9 - -// Ensuring interfaces in compile-time for ClosedVectorPath. -var ( - _ bin.Encoder = &ClosedVectorPath{} - _ bin.Decoder = &ClosedVectorPath{} - _ bin.BareEncoder = &ClosedVectorPath{} - _ bin.BareDecoder = &ClosedVectorPath{} -) - -func (c *ClosedVectorPath) Zero() bool { - if c == nil { - return true - } - if !(c.Commands == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ClosedVectorPath) String() string { - if c == nil { - return "ClosedVectorPath(nil)" - } - type Alias ClosedVectorPath - return fmt.Sprintf("ClosedVectorPath%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ClosedVectorPath) TypeID() uint32 { - return ClosedVectorPathTypeID -} - -// TypeName returns name of type in TL schema. -func (*ClosedVectorPath) TypeName() string { - return "closedVectorPath" -} - -// TypeInfo returns info about TL type. -func (c *ClosedVectorPath) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "closedVectorPath", - ID: ClosedVectorPathTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Commands", - SchemaName: "commands", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ClosedVectorPath) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closedVectorPath#2f9276b9 as nil") - } - b.PutID(ClosedVectorPathTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ClosedVectorPath) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode closedVectorPath#2f9276b9 as nil") - } - b.PutInt(len(c.Commands)) - for idx, v := range c.Commands { - if v == nil { - return fmt.Errorf("unable to encode closedVectorPath#2f9276b9: field commands element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare closedVectorPath#2f9276b9: field commands element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ClosedVectorPath) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closedVectorPath#2f9276b9 to nil") - } - if err := b.ConsumeID(ClosedVectorPathTypeID); err != nil { - return fmt.Errorf("unable to decode closedVectorPath#2f9276b9: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ClosedVectorPath) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode closedVectorPath#2f9276b9 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode closedVectorPath#2f9276b9: field commands: %w", err) - } - - if headerLen > 0 { - c.Commands = make([]VectorPathCommandClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeVectorPathCommand(b) - if err != nil { - return fmt.Errorf("unable to decode closedVectorPath#2f9276b9: field commands: %w", err) - } - c.Commands = append(c.Commands, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ClosedVectorPath) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode closedVectorPath#2f9276b9 as nil") - } - b.ObjStart() - b.PutID("closedVectorPath") - b.Comma() - b.FieldStart("commands") - b.ArrStart() - for idx, v := range c.Commands { - if v == nil { - return fmt.Errorf("unable to encode closedVectorPath#2f9276b9: field commands element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode closedVectorPath#2f9276b9: field commands element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ClosedVectorPath) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode closedVectorPath#2f9276b9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("closedVectorPath"); err != nil { - return fmt.Errorf("unable to decode closedVectorPath#2f9276b9: %w", err) - } - case "commands": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONVectorPathCommand(b) - if err != nil { - return fmt.Errorf("unable to decode closedVectorPath#2f9276b9: field commands: %w", err) - } - c.Commands = append(c.Commands, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode closedVectorPath#2f9276b9: field commands: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCommands returns value of Commands field. -func (c *ClosedVectorPath) GetCommands() (value []VectorPathCommandClass) { - if c == nil { - return - } - return c.Commands -} diff --git a/tdapi/tl_collectible_item_info_gen.go b/tdapi/tl_collectible_item_info_gen.go deleted file mode 100644 index 6b1a186db..000000000 --- a/tdapi/tl_collectible_item_info_gen.go +++ /dev/null @@ -1,363 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CollectibleItemInfo represents TL type `collectibleItemInfo#570f9bcd`. -type CollectibleItemInfo struct { - // Point in time (Unix timestamp) when the item was purchased - PurchaseDate int32 - // Currency for the paid amount - Currency string - // The paid amount, in the smallest units of the currency - Amount int64 - // Cryptocurrency used to pay for the item - Cryptocurrency string - // The paid amount, in the smallest units of the cryptocurrency - CryptocurrencyAmount int64 - // Individual URL for the item on https://fragment.com - URL string -} - -// CollectibleItemInfoTypeID is TL type id of CollectibleItemInfo. -const CollectibleItemInfoTypeID = 0x570f9bcd - -// Ensuring interfaces in compile-time for CollectibleItemInfo. -var ( - _ bin.Encoder = &CollectibleItemInfo{} - _ bin.Decoder = &CollectibleItemInfo{} - _ bin.BareEncoder = &CollectibleItemInfo{} - _ bin.BareDecoder = &CollectibleItemInfo{} -) - -func (c *CollectibleItemInfo) Zero() bool { - if c == nil { - return true - } - if !(c.PurchaseDate == 0) { - return false - } - if !(c.Currency == "") { - return false - } - if !(c.Amount == 0) { - return false - } - if !(c.Cryptocurrency == "") { - return false - } - if !(c.CryptocurrencyAmount == 0) { - return false - } - if !(c.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CollectibleItemInfo) String() string { - if c == nil { - return "CollectibleItemInfo(nil)" - } - type Alias CollectibleItemInfo - return fmt.Sprintf("CollectibleItemInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CollectibleItemInfo) TypeID() uint32 { - return CollectibleItemInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*CollectibleItemInfo) TypeName() string { - return "collectibleItemInfo" -} - -// TypeInfo returns info about TL type. -func (c *CollectibleItemInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "collectibleItemInfo", - ID: CollectibleItemInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PurchaseDate", - SchemaName: "purchase_date", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "Cryptocurrency", - SchemaName: "cryptocurrency", - }, - { - Name: "CryptocurrencyAmount", - SchemaName: "cryptocurrency_amount", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CollectibleItemInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode collectibleItemInfo#570f9bcd as nil") - } - b.PutID(CollectibleItemInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CollectibleItemInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode collectibleItemInfo#570f9bcd as nil") - } - b.PutInt32(c.PurchaseDate) - b.PutString(c.Currency) - b.PutInt53(c.Amount) - b.PutString(c.Cryptocurrency) - b.PutLong(c.CryptocurrencyAmount) - b.PutString(c.URL) - return nil -} - -// Decode implements bin.Decoder. -func (c *CollectibleItemInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode collectibleItemInfo#570f9bcd to nil") - } - if err := b.ConsumeID(CollectibleItemInfoTypeID); err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CollectibleItemInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode collectibleItemInfo#570f9bcd to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field purchase_date: %w", err) - } - c.PurchaseDate = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field currency: %w", err) - } - c.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field amount: %w", err) - } - c.Amount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field cryptocurrency: %w", err) - } - c.Cryptocurrency = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field cryptocurrency_amount: %w", err) - } - c.CryptocurrencyAmount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field url: %w", err) - } - c.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CollectibleItemInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode collectibleItemInfo#570f9bcd as nil") - } - b.ObjStart() - b.PutID("collectibleItemInfo") - b.Comma() - b.FieldStart("purchase_date") - b.PutInt32(c.PurchaseDate) - b.Comma() - b.FieldStart("currency") - b.PutString(c.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(c.Amount) - b.Comma() - b.FieldStart("cryptocurrency") - b.PutString(c.Cryptocurrency) - b.Comma() - b.FieldStart("cryptocurrency_amount") - b.PutLong(c.CryptocurrencyAmount) - b.Comma() - b.FieldStart("url") - b.PutString(c.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CollectibleItemInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode collectibleItemInfo#570f9bcd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("collectibleItemInfo"); err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: %w", err) - } - case "purchase_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field purchase_date: %w", err) - } - c.PurchaseDate = value - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field currency: %w", err) - } - c.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field amount: %w", err) - } - c.Amount = value - case "cryptocurrency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field cryptocurrency: %w", err) - } - c.Cryptocurrency = value - case "cryptocurrency_amount": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field cryptocurrency_amount: %w", err) - } - c.CryptocurrencyAmount = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemInfo#570f9bcd: field url: %w", err) - } - c.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPurchaseDate returns value of PurchaseDate field. -func (c *CollectibleItemInfo) GetPurchaseDate() (value int32) { - if c == nil { - return - } - return c.PurchaseDate -} - -// GetCurrency returns value of Currency field. -func (c *CollectibleItemInfo) GetCurrency() (value string) { - if c == nil { - return - } - return c.Currency -} - -// GetAmount returns value of Amount field. -func (c *CollectibleItemInfo) GetAmount() (value int64) { - if c == nil { - return - } - return c.Amount -} - -// GetCryptocurrency returns value of Cryptocurrency field. -func (c *CollectibleItemInfo) GetCryptocurrency() (value string) { - if c == nil { - return - } - return c.Cryptocurrency -} - -// GetCryptocurrencyAmount returns value of CryptocurrencyAmount field. -func (c *CollectibleItemInfo) GetCryptocurrencyAmount() (value int64) { - if c == nil { - return - } - return c.CryptocurrencyAmount -} - -// GetURL returns value of URL field. -func (c *CollectibleItemInfo) GetURL() (value string) { - if c == nil { - return - } - return c.URL -} diff --git a/tdapi/tl_collectible_item_type_gen.go b/tdapi/tl_collectible_item_type_gen.go deleted file mode 100644 index 0c6e84ca5..000000000 --- a/tdapi/tl_collectible_item_type_gen.go +++ /dev/null @@ -1,501 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CollectibleItemTypeUsername represents TL type `collectibleItemTypeUsername#1b56e7d1`. -type CollectibleItemTypeUsername struct { - // The username - Username string -} - -// CollectibleItemTypeUsernameTypeID is TL type id of CollectibleItemTypeUsername. -const CollectibleItemTypeUsernameTypeID = 0x1b56e7d1 - -// construct implements constructor of CollectibleItemTypeClass. -func (c CollectibleItemTypeUsername) construct() CollectibleItemTypeClass { return &c } - -// Ensuring interfaces in compile-time for CollectibleItemTypeUsername. -var ( - _ bin.Encoder = &CollectibleItemTypeUsername{} - _ bin.Decoder = &CollectibleItemTypeUsername{} - _ bin.BareEncoder = &CollectibleItemTypeUsername{} - _ bin.BareDecoder = &CollectibleItemTypeUsername{} - - _ CollectibleItemTypeClass = &CollectibleItemTypeUsername{} -) - -func (c *CollectibleItemTypeUsername) Zero() bool { - if c == nil { - return true - } - if !(c.Username == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CollectibleItemTypeUsername) String() string { - if c == nil { - return "CollectibleItemTypeUsername(nil)" - } - type Alias CollectibleItemTypeUsername - return fmt.Sprintf("CollectibleItemTypeUsername%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CollectibleItemTypeUsername) TypeID() uint32 { - return CollectibleItemTypeUsernameTypeID -} - -// TypeName returns name of type in TL schema. -func (*CollectibleItemTypeUsername) TypeName() string { - return "collectibleItemTypeUsername" -} - -// TypeInfo returns info about TL type. -func (c *CollectibleItemTypeUsername) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "collectibleItemTypeUsername", - ID: CollectibleItemTypeUsernameTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Username", - SchemaName: "username", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CollectibleItemTypeUsername) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode collectibleItemTypeUsername#1b56e7d1 as nil") - } - b.PutID(CollectibleItemTypeUsernameTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CollectibleItemTypeUsername) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode collectibleItemTypeUsername#1b56e7d1 as nil") - } - b.PutString(c.Username) - return nil -} - -// Decode implements bin.Decoder. -func (c *CollectibleItemTypeUsername) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode collectibleItemTypeUsername#1b56e7d1 to nil") - } - if err := b.ConsumeID(CollectibleItemTypeUsernameTypeID); err != nil { - return fmt.Errorf("unable to decode collectibleItemTypeUsername#1b56e7d1: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CollectibleItemTypeUsername) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode collectibleItemTypeUsername#1b56e7d1 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemTypeUsername#1b56e7d1: field username: %w", err) - } - c.Username = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CollectibleItemTypeUsername) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode collectibleItemTypeUsername#1b56e7d1 as nil") - } - b.ObjStart() - b.PutID("collectibleItemTypeUsername") - b.Comma() - b.FieldStart("username") - b.PutString(c.Username) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CollectibleItemTypeUsername) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode collectibleItemTypeUsername#1b56e7d1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("collectibleItemTypeUsername"); err != nil { - return fmt.Errorf("unable to decode collectibleItemTypeUsername#1b56e7d1: %w", err) - } - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemTypeUsername#1b56e7d1: field username: %w", err) - } - c.Username = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUsername returns value of Username field. -func (c *CollectibleItemTypeUsername) GetUsername() (value string) { - if c == nil { - return - } - return c.Username -} - -// CollectibleItemTypePhoneNumber represents TL type `collectibleItemTypePhoneNumber#4ae0e142`. -type CollectibleItemTypePhoneNumber struct { - // The phone number - PhoneNumber string -} - -// CollectibleItemTypePhoneNumberTypeID is TL type id of CollectibleItemTypePhoneNumber. -const CollectibleItemTypePhoneNumberTypeID = 0x4ae0e142 - -// construct implements constructor of CollectibleItemTypeClass. -func (c CollectibleItemTypePhoneNumber) construct() CollectibleItemTypeClass { return &c } - -// Ensuring interfaces in compile-time for CollectibleItemTypePhoneNumber. -var ( - _ bin.Encoder = &CollectibleItemTypePhoneNumber{} - _ bin.Decoder = &CollectibleItemTypePhoneNumber{} - _ bin.BareEncoder = &CollectibleItemTypePhoneNumber{} - _ bin.BareDecoder = &CollectibleItemTypePhoneNumber{} - - _ CollectibleItemTypeClass = &CollectibleItemTypePhoneNumber{} -) - -func (c *CollectibleItemTypePhoneNumber) Zero() bool { - if c == nil { - return true - } - if !(c.PhoneNumber == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CollectibleItemTypePhoneNumber) String() string { - if c == nil { - return "CollectibleItemTypePhoneNumber(nil)" - } - type Alias CollectibleItemTypePhoneNumber - return fmt.Sprintf("CollectibleItemTypePhoneNumber%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CollectibleItemTypePhoneNumber) TypeID() uint32 { - return CollectibleItemTypePhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*CollectibleItemTypePhoneNumber) TypeName() string { - return "collectibleItemTypePhoneNumber" -} - -// TypeInfo returns info about TL type. -func (c *CollectibleItemTypePhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "collectibleItemTypePhoneNumber", - ID: CollectibleItemTypePhoneNumberTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CollectibleItemTypePhoneNumber) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode collectibleItemTypePhoneNumber#4ae0e142 as nil") - } - b.PutID(CollectibleItemTypePhoneNumberTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CollectibleItemTypePhoneNumber) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode collectibleItemTypePhoneNumber#4ae0e142 as nil") - } - b.PutString(c.PhoneNumber) - return nil -} - -// Decode implements bin.Decoder. -func (c *CollectibleItemTypePhoneNumber) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode collectibleItemTypePhoneNumber#4ae0e142 to nil") - } - if err := b.ConsumeID(CollectibleItemTypePhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode collectibleItemTypePhoneNumber#4ae0e142: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CollectibleItemTypePhoneNumber) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode collectibleItemTypePhoneNumber#4ae0e142 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemTypePhoneNumber#4ae0e142: field phone_number: %w", err) - } - c.PhoneNumber = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CollectibleItemTypePhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode collectibleItemTypePhoneNumber#4ae0e142 as nil") - } - b.ObjStart() - b.PutID("collectibleItemTypePhoneNumber") - b.Comma() - b.FieldStart("phone_number") - b.PutString(c.PhoneNumber) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CollectibleItemTypePhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode collectibleItemTypePhoneNumber#4ae0e142 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("collectibleItemTypePhoneNumber"); err != nil { - return fmt.Errorf("unable to decode collectibleItemTypePhoneNumber#4ae0e142: %w", err) - } - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode collectibleItemTypePhoneNumber#4ae0e142: field phone_number: %w", err) - } - c.PhoneNumber = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (c *CollectibleItemTypePhoneNumber) GetPhoneNumber() (value string) { - if c == nil { - return - } - return c.PhoneNumber -} - -// CollectibleItemTypeClassName is schema name of CollectibleItemTypeClass. -const CollectibleItemTypeClassName = "CollectibleItemType" - -// CollectibleItemTypeClass represents CollectibleItemType generic type. -// -// Example: -// -// g, err := tdapi.DecodeCollectibleItemType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.CollectibleItemTypeUsername: // collectibleItemTypeUsername#1b56e7d1 -// case *tdapi.CollectibleItemTypePhoneNumber: // collectibleItemTypePhoneNumber#4ae0e142 -// default: panic(v) -// } -type CollectibleItemTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() CollectibleItemTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeCollectibleItemType implements binary de-serialization for CollectibleItemTypeClass. -func DecodeCollectibleItemType(buf *bin.Buffer) (CollectibleItemTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case CollectibleItemTypeUsernameTypeID: - // Decoding collectibleItemTypeUsername#1b56e7d1. - v := CollectibleItemTypeUsername{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CollectibleItemTypeClass: %w", err) - } - return &v, nil - case CollectibleItemTypePhoneNumberTypeID: - // Decoding collectibleItemTypePhoneNumber#4ae0e142. - v := CollectibleItemTypePhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode CollectibleItemTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CollectibleItemTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONCollectibleItemType implements binary de-serialization for CollectibleItemTypeClass. -func DecodeTDLibJSONCollectibleItemType(buf tdjson.Decoder) (CollectibleItemTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "collectibleItemTypeUsername": - // Decoding collectibleItemTypeUsername#1b56e7d1. - v := CollectibleItemTypeUsername{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CollectibleItemTypeClass: %w", err) - } - return &v, nil - case "collectibleItemTypePhoneNumber": - // Decoding collectibleItemTypePhoneNumber#4ae0e142. - v := CollectibleItemTypePhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode CollectibleItemTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode CollectibleItemTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// CollectibleItemType boxes the CollectibleItemTypeClass providing a helper. -type CollectibleItemTypeBox struct { - CollectibleItemType CollectibleItemTypeClass -} - -// Decode implements bin.Decoder for CollectibleItemTypeBox. -func (b *CollectibleItemTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode CollectibleItemTypeBox to nil") - } - v, err := DecodeCollectibleItemType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CollectibleItemType = v - return nil -} - -// Encode implements bin.Encode for CollectibleItemTypeBox. -func (b *CollectibleItemTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.CollectibleItemType == nil { - return fmt.Errorf("unable to encode CollectibleItemTypeClass as nil") - } - return b.CollectibleItemType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for CollectibleItemTypeBox. -func (b *CollectibleItemTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode CollectibleItemTypeBox to nil") - } - v, err := DecodeTDLibJSONCollectibleItemType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.CollectibleItemType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for CollectibleItemTypeBox. -func (b *CollectibleItemTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.CollectibleItemType == nil { - return fmt.Errorf("unable to encode CollectibleItemTypeClass as nil") - } - return b.CollectibleItemType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_commit_pending_paid_message_reactions_gen.go b/tdapi/tl_commit_pending_paid_message_reactions_gen.go deleted file mode 100644 index fc7b040a7..000000000 --- a/tdapi/tl_commit_pending_paid_message_reactions_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CommitPendingPaidMessageReactionsRequest represents TL type `commitPendingPaidMessageReactions#f5c95606`. -type CommitPendingPaidMessageReactionsRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 -} - -// CommitPendingPaidMessageReactionsRequestTypeID is TL type id of CommitPendingPaidMessageReactionsRequest. -const CommitPendingPaidMessageReactionsRequestTypeID = 0xf5c95606 - -// Ensuring interfaces in compile-time for CommitPendingPaidMessageReactionsRequest. -var ( - _ bin.Encoder = &CommitPendingPaidMessageReactionsRequest{} - _ bin.Decoder = &CommitPendingPaidMessageReactionsRequest{} - _ bin.BareEncoder = &CommitPendingPaidMessageReactionsRequest{} - _ bin.BareDecoder = &CommitPendingPaidMessageReactionsRequest{} -) - -func (c *CommitPendingPaidMessageReactionsRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CommitPendingPaidMessageReactionsRequest) String() string { - if c == nil { - return "CommitPendingPaidMessageReactionsRequest(nil)" - } - type Alias CommitPendingPaidMessageReactionsRequest - return fmt.Sprintf("CommitPendingPaidMessageReactionsRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CommitPendingPaidMessageReactionsRequest) TypeID() uint32 { - return CommitPendingPaidMessageReactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CommitPendingPaidMessageReactionsRequest) TypeName() string { - return "commitPendingPaidMessageReactions" -} - -// TypeInfo returns info about TL type. -func (c *CommitPendingPaidMessageReactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "commitPendingPaidMessageReactions", - ID: CommitPendingPaidMessageReactionsRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CommitPendingPaidMessageReactionsRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode commitPendingPaidMessageReactions#f5c95606 as nil") - } - b.PutID(CommitPendingPaidMessageReactionsRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CommitPendingPaidMessageReactionsRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode commitPendingPaidMessageReactions#f5c95606 as nil") - } - b.PutInt53(c.ChatID) - b.PutInt53(c.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CommitPendingPaidMessageReactionsRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode commitPendingPaidMessageReactions#f5c95606 to nil") - } - if err := b.ConsumeID(CommitPendingPaidMessageReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CommitPendingPaidMessageReactionsRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode commitPendingPaidMessageReactions#f5c95606 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: field chat_id: %w", err) - } - c.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: field message_id: %w", err) - } - c.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CommitPendingPaidMessageReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode commitPendingPaidMessageReactions#f5c95606 as nil") - } - b.ObjStart() - b.PutID("commitPendingPaidMessageReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(c.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CommitPendingPaidMessageReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode commitPendingPaidMessageReactions#f5c95606 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("commitPendingPaidMessageReactions"); err != nil { - return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: field chat_id: %w", err) - } - c.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode commitPendingPaidMessageReactions#f5c95606: field message_id: %w", err) - } - c.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *CommitPendingPaidMessageReactionsRequest) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetMessageID returns value of MessageID field. -func (c *CommitPendingPaidMessageReactionsRequest) GetMessageID() (value int64) { - if c == nil { - return - } - return c.MessageID -} - -// CommitPendingPaidMessageReactions invokes method commitPendingPaidMessageReactions#f5c95606 returning error if any. -func (c *Client) CommitPendingPaidMessageReactions(ctx context.Context, request *CommitPendingPaidMessageReactionsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_confirm_qr_code_authentication_gen.go b/tdapi/tl_confirm_qr_code_authentication_gen.go deleted file mode 100644 index 6eb534482..000000000 --- a/tdapi/tl_confirm_qr_code_authentication_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ConfirmQrCodeAuthenticationRequest represents TL type `confirmQrCodeAuthentication#e993a72d`. -type ConfirmQrCodeAuthenticationRequest struct { - // A link from a QR code. The link must be scanned by the in-app camera - Link string -} - -// ConfirmQrCodeAuthenticationRequestTypeID is TL type id of ConfirmQrCodeAuthenticationRequest. -const ConfirmQrCodeAuthenticationRequestTypeID = 0xe993a72d - -// Ensuring interfaces in compile-time for ConfirmQrCodeAuthenticationRequest. -var ( - _ bin.Encoder = &ConfirmQrCodeAuthenticationRequest{} - _ bin.Decoder = &ConfirmQrCodeAuthenticationRequest{} - _ bin.BareEncoder = &ConfirmQrCodeAuthenticationRequest{} - _ bin.BareDecoder = &ConfirmQrCodeAuthenticationRequest{} -) - -func (c *ConfirmQrCodeAuthenticationRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Link == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConfirmQrCodeAuthenticationRequest) String() string { - if c == nil { - return "ConfirmQrCodeAuthenticationRequest(nil)" - } - type Alias ConfirmQrCodeAuthenticationRequest - return fmt.Sprintf("ConfirmQrCodeAuthenticationRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConfirmQrCodeAuthenticationRequest) TypeID() uint32 { - return ConfirmQrCodeAuthenticationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConfirmQrCodeAuthenticationRequest) TypeName() string { - return "confirmQrCodeAuthentication" -} - -// TypeInfo returns info about TL type. -func (c *ConfirmQrCodeAuthenticationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "confirmQrCodeAuthentication", - ID: ConfirmQrCodeAuthenticationRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ConfirmQrCodeAuthenticationRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode confirmQrCodeAuthentication#e993a72d as nil") - } - b.PutID(ConfirmQrCodeAuthenticationRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConfirmQrCodeAuthenticationRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode confirmQrCodeAuthentication#e993a72d as nil") - } - b.PutString(c.Link) - return nil -} - -// Decode implements bin.Decoder. -func (c *ConfirmQrCodeAuthenticationRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode confirmQrCodeAuthentication#e993a72d to nil") - } - if err := b.ConsumeID(ConfirmQrCodeAuthenticationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode confirmQrCodeAuthentication#e993a72d: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConfirmQrCodeAuthenticationRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode confirmQrCodeAuthentication#e993a72d to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode confirmQrCodeAuthentication#e993a72d: field link: %w", err) - } - c.Link = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConfirmQrCodeAuthenticationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode confirmQrCodeAuthentication#e993a72d as nil") - } - b.ObjStart() - b.PutID("confirmQrCodeAuthentication") - b.Comma() - b.FieldStart("link") - b.PutString(c.Link) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConfirmQrCodeAuthenticationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode confirmQrCodeAuthentication#e993a72d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("confirmQrCodeAuthentication"); err != nil { - return fmt.Errorf("unable to decode confirmQrCodeAuthentication#e993a72d: %w", err) - } - case "link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode confirmQrCodeAuthentication#e993a72d: field link: %w", err) - } - c.Link = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (c *ConfirmQrCodeAuthenticationRequest) GetLink() (value string) { - if c == nil { - return - } - return c.Link -} - -// ConfirmQrCodeAuthentication invokes method confirmQrCodeAuthentication#e993a72d returning error if any. -func (c *Client) ConfirmQrCodeAuthentication(ctx context.Context, link string) (*Session, error) { - var result Session - - request := &ConfirmQrCodeAuthenticationRequest{ - Link: link, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_confirm_session_gen.go b/tdapi/tl_confirm_session_gen.go deleted file mode 100644 index 85c06d49f..000000000 --- a/tdapi/tl_confirm_session_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ConfirmSessionRequest represents TL type `confirmSession#d7c9b41f`. -type ConfirmSessionRequest struct { - // Session identifier - SessionID int64 -} - -// ConfirmSessionRequestTypeID is TL type id of ConfirmSessionRequest. -const ConfirmSessionRequestTypeID = 0xd7c9b41f - -// Ensuring interfaces in compile-time for ConfirmSessionRequest. -var ( - _ bin.Encoder = &ConfirmSessionRequest{} - _ bin.Decoder = &ConfirmSessionRequest{} - _ bin.BareEncoder = &ConfirmSessionRequest{} - _ bin.BareDecoder = &ConfirmSessionRequest{} -) - -func (c *ConfirmSessionRequest) Zero() bool { - if c == nil { - return true - } - if !(c.SessionID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConfirmSessionRequest) String() string { - if c == nil { - return "ConfirmSessionRequest(nil)" - } - type Alias ConfirmSessionRequest - return fmt.Sprintf("ConfirmSessionRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConfirmSessionRequest) TypeID() uint32 { - return ConfirmSessionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConfirmSessionRequest) TypeName() string { - return "confirmSession" -} - -// TypeInfo returns info about TL type. -func (c *ConfirmSessionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "confirmSession", - ID: ConfirmSessionRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SessionID", - SchemaName: "session_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ConfirmSessionRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode confirmSession#d7c9b41f as nil") - } - b.PutID(ConfirmSessionRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConfirmSessionRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode confirmSession#d7c9b41f as nil") - } - b.PutLong(c.SessionID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ConfirmSessionRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode confirmSession#d7c9b41f to nil") - } - if err := b.ConsumeID(ConfirmSessionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode confirmSession#d7c9b41f: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConfirmSessionRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode confirmSession#d7c9b41f to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode confirmSession#d7c9b41f: field session_id: %w", err) - } - c.SessionID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConfirmSessionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode confirmSession#d7c9b41f as nil") - } - b.ObjStart() - b.PutID("confirmSession") - b.Comma() - b.FieldStart("session_id") - b.PutLong(c.SessionID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConfirmSessionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode confirmSession#d7c9b41f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("confirmSession"); err != nil { - return fmt.Errorf("unable to decode confirmSession#d7c9b41f: %w", err) - } - case "session_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode confirmSession#d7c9b41f: field session_id: %w", err) - } - c.SessionID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSessionID returns value of SessionID field. -func (c *ConfirmSessionRequest) GetSessionID() (value int64) { - if c == nil { - return - } - return c.SessionID -} - -// ConfirmSession invokes method confirmSession#d7c9b41f returning error if any. -func (c *Client) ConfirmSession(ctx context.Context, sessionid int64) error { - var ok Ok - - request := &ConfirmSessionRequest{ - SessionID: sessionid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_connect_affiliate_program_gen.go b/tdapi/tl_connect_affiliate_program_gen.go deleted file mode 100644 index 672580244..000000000 --- a/tdapi/tl_connect_affiliate_program_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ConnectAffiliateProgramRequest represents TL type `connectAffiliateProgram#6306d72c`. -type ConnectAffiliateProgramRequest struct { - // The affiliate to which the affiliate program will be connected - Affiliate AffiliateTypeClass - // Identifier of the bot, which affiliate program is connected - BotUserID int64 -} - -// ConnectAffiliateProgramRequestTypeID is TL type id of ConnectAffiliateProgramRequest. -const ConnectAffiliateProgramRequestTypeID = 0x6306d72c - -// Ensuring interfaces in compile-time for ConnectAffiliateProgramRequest. -var ( - _ bin.Encoder = &ConnectAffiliateProgramRequest{} - _ bin.Decoder = &ConnectAffiliateProgramRequest{} - _ bin.BareEncoder = &ConnectAffiliateProgramRequest{} - _ bin.BareDecoder = &ConnectAffiliateProgramRequest{} -) - -func (c *ConnectAffiliateProgramRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Affiliate == nil) { - return false - } - if !(c.BotUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConnectAffiliateProgramRequest) String() string { - if c == nil { - return "ConnectAffiliateProgramRequest(nil)" - } - type Alias ConnectAffiliateProgramRequest - return fmt.Sprintf("ConnectAffiliateProgramRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConnectAffiliateProgramRequest) TypeID() uint32 { - return ConnectAffiliateProgramRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConnectAffiliateProgramRequest) TypeName() string { - return "connectAffiliateProgram" -} - -// TypeInfo returns info about TL type. -func (c *ConnectAffiliateProgramRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "connectAffiliateProgram", - ID: ConnectAffiliateProgramRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Affiliate", - SchemaName: "affiliate", - }, - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ConnectAffiliateProgramRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectAffiliateProgram#6306d72c as nil") - } - b.PutID(ConnectAffiliateProgramRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConnectAffiliateProgramRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectAffiliateProgram#6306d72c as nil") - } - if c.Affiliate == nil { - return fmt.Errorf("unable to encode connectAffiliateProgram#6306d72c: field affiliate is nil") - } - if err := c.Affiliate.Encode(b); err != nil { - return fmt.Errorf("unable to encode connectAffiliateProgram#6306d72c: field affiliate: %w", err) - } - b.PutInt53(c.BotUserID) - return nil -} - -// Decode implements bin.Decoder. -func (c *ConnectAffiliateProgramRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectAffiliateProgram#6306d72c to nil") - } - if err := b.ConsumeID(ConnectAffiliateProgramRequestTypeID); err != nil { - return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConnectAffiliateProgramRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectAffiliateProgram#6306d72c to nil") - } - { - value, err := DecodeAffiliateType(b) - if err != nil { - return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: field affiliate: %w", err) - } - c.Affiliate = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: field bot_user_id: %w", err) - } - c.BotUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConnectAffiliateProgramRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode connectAffiliateProgram#6306d72c as nil") - } - b.ObjStart() - b.PutID("connectAffiliateProgram") - b.Comma() - b.FieldStart("affiliate") - if c.Affiliate == nil { - return fmt.Errorf("unable to encode connectAffiliateProgram#6306d72c: field affiliate is nil") - } - if err := c.Affiliate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode connectAffiliateProgram#6306d72c: field affiliate: %w", err) - } - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(c.BotUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConnectAffiliateProgramRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode connectAffiliateProgram#6306d72c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("connectAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: %w", err) - } - case "affiliate": - value, err := DecodeTDLibJSONAffiliateType(b) - if err != nil { - return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: field affiliate: %w", err) - } - c.Affiliate = value - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode connectAffiliateProgram#6306d72c: field bot_user_id: %w", err) - } - c.BotUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAffiliate returns value of Affiliate field. -func (c *ConnectAffiliateProgramRequest) GetAffiliate() (value AffiliateTypeClass) { - if c == nil { - return - } - return c.Affiliate -} - -// GetBotUserID returns value of BotUserID field. -func (c *ConnectAffiliateProgramRequest) GetBotUserID() (value int64) { - if c == nil { - return - } - return c.BotUserID -} - -// ConnectAffiliateProgram invokes method connectAffiliateProgram#6306d72c returning error if any. -func (c *Client) ConnectAffiliateProgram(ctx context.Context, request *ConnectAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { - var result ConnectedAffiliateProgram - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_connected_affiliate_program_gen.go b/tdapi/tl_connected_affiliate_program_gen.go deleted file mode 100644 index 8006fcec6..000000000 --- a/tdapi/tl_connected_affiliate_program_gen.go +++ /dev/null @@ -1,398 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ConnectedAffiliateProgram represents TL type `connectedAffiliateProgram#58bf7415`. -type ConnectedAffiliateProgram struct { - // The link that can be used to refer users if the program is still active - URL string - // User identifier of the bot created the program - BotUserID int64 - // The parameters of the affiliate program - Parameters AffiliateProgramParameters - // Point in time (Unix timestamp) when the affiliate program was connected - ConnectionDate int32 - // True, if the program was canceled by the bot, or disconnected by the chat owner and - // isn't available anymore - IsDisconnected bool - // The number of users that used the affiliate program - UserCount int64 - // The number of Telegram Stars that were earned by the affiliate program - RevenueStarCount int64 -} - -// ConnectedAffiliateProgramTypeID is TL type id of ConnectedAffiliateProgram. -const ConnectedAffiliateProgramTypeID = 0x58bf7415 - -// Ensuring interfaces in compile-time for ConnectedAffiliateProgram. -var ( - _ bin.Encoder = &ConnectedAffiliateProgram{} - _ bin.Decoder = &ConnectedAffiliateProgram{} - _ bin.BareEncoder = &ConnectedAffiliateProgram{} - _ bin.BareDecoder = &ConnectedAffiliateProgram{} -) - -func (c *ConnectedAffiliateProgram) Zero() bool { - if c == nil { - return true - } - if !(c.URL == "") { - return false - } - if !(c.BotUserID == 0) { - return false - } - if !(c.Parameters.Zero()) { - return false - } - if !(c.ConnectionDate == 0) { - return false - } - if !(c.IsDisconnected == false) { - return false - } - if !(c.UserCount == 0) { - return false - } - if !(c.RevenueStarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConnectedAffiliateProgram) String() string { - if c == nil { - return "ConnectedAffiliateProgram(nil)" - } - type Alias ConnectedAffiliateProgram - return fmt.Sprintf("ConnectedAffiliateProgram%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConnectedAffiliateProgram) TypeID() uint32 { - return ConnectedAffiliateProgramTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConnectedAffiliateProgram) TypeName() string { - return "connectedAffiliateProgram" -} - -// TypeInfo returns info about TL type. -func (c *ConnectedAffiliateProgram) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "connectedAffiliateProgram", - ID: ConnectedAffiliateProgramTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Parameters", - SchemaName: "parameters", - }, - { - Name: "ConnectionDate", - SchemaName: "connection_date", - }, - { - Name: "IsDisconnected", - SchemaName: "is_disconnected", - }, - { - Name: "UserCount", - SchemaName: "user_count", - }, - { - Name: "RevenueStarCount", - SchemaName: "revenue_star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ConnectedAffiliateProgram) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectedAffiliateProgram#58bf7415 as nil") - } - b.PutID(ConnectedAffiliateProgramTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConnectedAffiliateProgram) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectedAffiliateProgram#58bf7415 as nil") - } - b.PutString(c.URL) - b.PutInt53(c.BotUserID) - if err := c.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode connectedAffiliateProgram#58bf7415: field parameters: %w", err) - } - b.PutInt32(c.ConnectionDate) - b.PutBool(c.IsDisconnected) - b.PutLong(c.UserCount) - b.PutLong(c.RevenueStarCount) - return nil -} - -// Decode implements bin.Decoder. -func (c *ConnectedAffiliateProgram) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectedAffiliateProgram#58bf7415 to nil") - } - if err := b.ConsumeID(ConnectedAffiliateProgramTypeID); err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConnectedAffiliateProgram) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectedAffiliateProgram#58bf7415 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field url: %w", err) - } - c.URL = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field bot_user_id: %w", err) - } - c.BotUserID = value - } - { - if err := c.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field parameters: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field connection_date: %w", err) - } - c.ConnectionDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field is_disconnected: %w", err) - } - c.IsDisconnected = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field user_count: %w", err) - } - c.UserCount = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field revenue_star_count: %w", err) - } - c.RevenueStarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConnectedAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode connectedAffiliateProgram#58bf7415 as nil") - } - b.ObjStart() - b.PutID("connectedAffiliateProgram") - b.Comma() - b.FieldStart("url") - b.PutString(c.URL) - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(c.BotUserID) - b.Comma() - b.FieldStart("parameters") - if err := c.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode connectedAffiliateProgram#58bf7415: field parameters: %w", err) - } - b.Comma() - b.FieldStart("connection_date") - b.PutInt32(c.ConnectionDate) - b.Comma() - b.FieldStart("is_disconnected") - b.PutBool(c.IsDisconnected) - b.Comma() - b.FieldStart("user_count") - b.PutLong(c.UserCount) - b.Comma() - b.FieldStart("revenue_star_count") - b.PutLong(c.RevenueStarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConnectedAffiliateProgram) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode connectedAffiliateProgram#58bf7415 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("connectedAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field url: %w", err) - } - c.URL = value - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field bot_user_id: %w", err) - } - c.BotUserID = value - case "parameters": - if err := c.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field parameters: %w", err) - } - case "connection_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field connection_date: %w", err) - } - c.ConnectionDate = value - case "is_disconnected": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field is_disconnected: %w", err) - } - c.IsDisconnected = value - case "user_count": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field user_count: %w", err) - } - c.UserCount = value - case "revenue_star_count": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliateProgram#58bf7415: field revenue_star_count: %w", err) - } - c.RevenueStarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (c *ConnectedAffiliateProgram) GetURL() (value string) { - if c == nil { - return - } - return c.URL -} - -// GetBotUserID returns value of BotUserID field. -func (c *ConnectedAffiliateProgram) GetBotUserID() (value int64) { - if c == nil { - return - } - return c.BotUserID -} - -// GetParameters returns value of Parameters field. -func (c *ConnectedAffiliateProgram) GetParameters() (value AffiliateProgramParameters) { - if c == nil { - return - } - return c.Parameters -} - -// GetConnectionDate returns value of ConnectionDate field. -func (c *ConnectedAffiliateProgram) GetConnectionDate() (value int32) { - if c == nil { - return - } - return c.ConnectionDate -} - -// GetIsDisconnected returns value of IsDisconnected field. -func (c *ConnectedAffiliateProgram) GetIsDisconnected() (value bool) { - if c == nil { - return - } - return c.IsDisconnected -} - -// GetUserCount returns value of UserCount field. -func (c *ConnectedAffiliateProgram) GetUserCount() (value int64) { - if c == nil { - return - } - return c.UserCount -} - -// GetRevenueStarCount returns value of RevenueStarCount field. -func (c *ConnectedAffiliateProgram) GetRevenueStarCount() (value int64) { - if c == nil { - return - } - return c.RevenueStarCount -} diff --git a/tdapi/tl_connected_affiliate_programs_gen.go b/tdapi/tl_connected_affiliate_programs_gen.go deleted file mode 100644 index 6570b016c..000000000 --- a/tdapi/tl_connected_affiliate_programs_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ConnectedAffiliatePrograms represents TL type `connectedAffiliatePrograms#59231e33`. -type ConnectedAffiliatePrograms struct { - // The total number of affiliate programs that were connected to the affiliate - TotalCount int32 - // The list of connected affiliate programs - Programs []ConnectedAffiliateProgram - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// ConnectedAffiliateProgramsTypeID is TL type id of ConnectedAffiliatePrograms. -const ConnectedAffiliateProgramsTypeID = 0x59231e33 - -// Ensuring interfaces in compile-time for ConnectedAffiliatePrograms. -var ( - _ bin.Encoder = &ConnectedAffiliatePrograms{} - _ bin.Decoder = &ConnectedAffiliatePrograms{} - _ bin.BareEncoder = &ConnectedAffiliatePrograms{} - _ bin.BareDecoder = &ConnectedAffiliatePrograms{} -) - -func (c *ConnectedAffiliatePrograms) Zero() bool { - if c == nil { - return true - } - if !(c.TotalCount == 0) { - return false - } - if !(c.Programs == nil) { - return false - } - if !(c.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConnectedAffiliatePrograms) String() string { - if c == nil { - return "ConnectedAffiliatePrograms(nil)" - } - type Alias ConnectedAffiliatePrograms - return fmt.Sprintf("ConnectedAffiliatePrograms%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConnectedAffiliatePrograms) TypeID() uint32 { - return ConnectedAffiliateProgramsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConnectedAffiliatePrograms) TypeName() string { - return "connectedAffiliatePrograms" -} - -// TypeInfo returns info about TL type. -func (c *ConnectedAffiliatePrograms) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "connectedAffiliatePrograms", - ID: ConnectedAffiliateProgramsTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Programs", - SchemaName: "programs", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ConnectedAffiliatePrograms) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectedAffiliatePrograms#59231e33 as nil") - } - b.PutID(ConnectedAffiliateProgramsTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConnectedAffiliatePrograms) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectedAffiliatePrograms#59231e33 as nil") - } - b.PutInt32(c.TotalCount) - b.PutInt(len(c.Programs)) - for idx, v := range c.Programs { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare connectedAffiliatePrograms#59231e33: field programs element with index %d: %w", idx, err) - } - } - b.PutString(c.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (c *ConnectedAffiliatePrograms) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectedAffiliatePrograms#59231e33 to nil") - } - if err := b.ConsumeID(ConnectedAffiliateProgramsTypeID); err != nil { - return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConnectedAffiliatePrograms) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectedAffiliatePrograms#59231e33 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field total_count: %w", err) - } - c.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field programs: %w", err) - } - - if headerLen > 0 { - c.Programs = make([]ConnectedAffiliateProgram, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ConnectedAffiliateProgram - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare connectedAffiliatePrograms#59231e33: field programs: %w", err) - } - c.Programs = append(c.Programs, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field next_offset: %w", err) - } - c.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConnectedAffiliatePrograms) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode connectedAffiliatePrograms#59231e33 as nil") - } - b.ObjStart() - b.PutID("connectedAffiliatePrograms") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(c.TotalCount) - b.Comma() - b.FieldStart("programs") - b.ArrStart() - for idx, v := range c.Programs { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode connectedAffiliatePrograms#59231e33: field programs element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(c.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConnectedAffiliatePrograms) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode connectedAffiliatePrograms#59231e33 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("connectedAffiliatePrograms"); err != nil { - return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field total_count: %w", err) - } - c.TotalCount = value - case "programs": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ConnectedAffiliateProgram - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field programs: %w", err) - } - c.Programs = append(c.Programs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field programs: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedAffiliatePrograms#59231e33: field next_offset: %w", err) - } - c.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (c *ConnectedAffiliatePrograms) GetTotalCount() (value int32) { - if c == nil { - return - } - return c.TotalCount -} - -// GetPrograms returns value of Programs field. -func (c *ConnectedAffiliatePrograms) GetPrograms() (value []ConnectedAffiliateProgram) { - if c == nil { - return - } - return c.Programs -} - -// GetNextOffset returns value of NextOffset field. -func (c *ConnectedAffiliatePrograms) GetNextOffset() (value string) { - if c == nil { - return - } - return c.NextOffset -} diff --git a/tdapi/tl_connected_website_gen.go b/tdapi/tl_connected_website_gen.go deleted file mode 100644 index 5f8207c40..000000000 --- a/tdapi/tl_connected_website_gen.go +++ /dev/null @@ -1,466 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ConnectedWebsite represents TL type `connectedWebsite#75e7a78a`. -type ConnectedWebsite struct { - // Website identifier - ID int64 - // The domain name of the website - DomainName string - // User identifier of a bot linked with the website - BotUserID int64 - // The version of a browser used to log in - Browser string - // Operating system the browser is running on - Platform string - // Point in time (Unix timestamp) when the user was logged in - LogInDate int32 - // Point in time (Unix timestamp) when obtained authorization was last used - LastActiveDate int32 - // IP address from which the user was logged in, in human-readable format - IPAddress string - // Human-readable description of a country and a region from which the user was logged in - // based on the IP address - Location string -} - -// ConnectedWebsiteTypeID is TL type id of ConnectedWebsite. -const ConnectedWebsiteTypeID = 0x75e7a78a - -// Ensuring interfaces in compile-time for ConnectedWebsite. -var ( - _ bin.Encoder = &ConnectedWebsite{} - _ bin.Decoder = &ConnectedWebsite{} - _ bin.BareEncoder = &ConnectedWebsite{} - _ bin.BareDecoder = &ConnectedWebsite{} -) - -func (c *ConnectedWebsite) Zero() bool { - if c == nil { - return true - } - if !(c.ID == 0) { - return false - } - if !(c.DomainName == "") { - return false - } - if !(c.BotUserID == 0) { - return false - } - if !(c.Browser == "") { - return false - } - if !(c.Platform == "") { - return false - } - if !(c.LogInDate == 0) { - return false - } - if !(c.LastActiveDate == 0) { - return false - } - if !(c.IPAddress == "") { - return false - } - if !(c.Location == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConnectedWebsite) String() string { - if c == nil { - return "ConnectedWebsite(nil)" - } - type Alias ConnectedWebsite - return fmt.Sprintf("ConnectedWebsite%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConnectedWebsite) TypeID() uint32 { - return ConnectedWebsiteTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConnectedWebsite) TypeName() string { - return "connectedWebsite" -} - -// TypeInfo returns info about TL type. -func (c *ConnectedWebsite) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "connectedWebsite", - ID: ConnectedWebsiteTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "DomainName", - SchemaName: "domain_name", - }, - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Browser", - SchemaName: "browser", - }, - { - Name: "Platform", - SchemaName: "platform", - }, - { - Name: "LogInDate", - SchemaName: "log_in_date", - }, - { - Name: "LastActiveDate", - SchemaName: "last_active_date", - }, - { - Name: "IPAddress", - SchemaName: "ip_address", - }, - { - Name: "Location", - SchemaName: "location", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ConnectedWebsite) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectedWebsite#75e7a78a as nil") - } - b.PutID(ConnectedWebsiteTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConnectedWebsite) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectedWebsite#75e7a78a as nil") - } - b.PutLong(c.ID) - b.PutString(c.DomainName) - b.PutInt53(c.BotUserID) - b.PutString(c.Browser) - b.PutString(c.Platform) - b.PutInt32(c.LogInDate) - b.PutInt32(c.LastActiveDate) - b.PutString(c.IPAddress) - b.PutString(c.Location) - return nil -} - -// Decode implements bin.Decoder. -func (c *ConnectedWebsite) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectedWebsite#75e7a78a to nil") - } - if err := b.ConsumeID(ConnectedWebsiteTypeID); err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConnectedWebsite) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectedWebsite#75e7a78a to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field id: %w", err) - } - c.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field domain_name: %w", err) - } - c.DomainName = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field bot_user_id: %w", err) - } - c.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field browser: %w", err) - } - c.Browser = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field platform: %w", err) - } - c.Platform = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field log_in_date: %w", err) - } - c.LogInDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field last_active_date: %w", err) - } - c.LastActiveDate = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field ip_address: %w", err) - } - c.IPAddress = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field location: %w", err) - } - c.Location = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConnectedWebsite) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode connectedWebsite#75e7a78a as nil") - } - b.ObjStart() - b.PutID("connectedWebsite") - b.Comma() - b.FieldStart("id") - b.PutLong(c.ID) - b.Comma() - b.FieldStart("domain_name") - b.PutString(c.DomainName) - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(c.BotUserID) - b.Comma() - b.FieldStart("browser") - b.PutString(c.Browser) - b.Comma() - b.FieldStart("platform") - b.PutString(c.Platform) - b.Comma() - b.FieldStart("log_in_date") - b.PutInt32(c.LogInDate) - b.Comma() - b.FieldStart("last_active_date") - b.PutInt32(c.LastActiveDate) - b.Comma() - b.FieldStart("ip_address") - b.PutString(c.IPAddress) - b.Comma() - b.FieldStart("location") - b.PutString(c.Location) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConnectedWebsite) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode connectedWebsite#75e7a78a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("connectedWebsite"); err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field id: %w", err) - } - c.ID = value - case "domain_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field domain_name: %w", err) - } - c.DomainName = value - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field bot_user_id: %w", err) - } - c.BotUserID = value - case "browser": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field browser: %w", err) - } - c.Browser = value - case "platform": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field platform: %w", err) - } - c.Platform = value - case "log_in_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field log_in_date: %w", err) - } - c.LogInDate = value - case "last_active_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field last_active_date: %w", err) - } - c.LastActiveDate = value - case "ip_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field ip_address: %w", err) - } - c.IPAddress = value - case "location": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsite#75e7a78a: field location: %w", err) - } - c.Location = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (c *ConnectedWebsite) GetID() (value int64) { - if c == nil { - return - } - return c.ID -} - -// GetDomainName returns value of DomainName field. -func (c *ConnectedWebsite) GetDomainName() (value string) { - if c == nil { - return - } - return c.DomainName -} - -// GetBotUserID returns value of BotUserID field. -func (c *ConnectedWebsite) GetBotUserID() (value int64) { - if c == nil { - return - } - return c.BotUserID -} - -// GetBrowser returns value of Browser field. -func (c *ConnectedWebsite) GetBrowser() (value string) { - if c == nil { - return - } - return c.Browser -} - -// GetPlatform returns value of Platform field. -func (c *ConnectedWebsite) GetPlatform() (value string) { - if c == nil { - return - } - return c.Platform -} - -// GetLogInDate returns value of LogInDate field. -func (c *ConnectedWebsite) GetLogInDate() (value int32) { - if c == nil { - return - } - return c.LogInDate -} - -// GetLastActiveDate returns value of LastActiveDate field. -func (c *ConnectedWebsite) GetLastActiveDate() (value int32) { - if c == nil { - return - } - return c.LastActiveDate -} - -// GetIPAddress returns value of IPAddress field. -func (c *ConnectedWebsite) GetIPAddress() (value string) { - if c == nil { - return - } - return c.IPAddress -} - -// GetLocation returns value of Location field. -func (c *ConnectedWebsite) GetLocation() (value string) { - if c == nil { - return - } - return c.Location -} diff --git a/tdapi/tl_connected_websites_gen.go b/tdapi/tl_connected_websites_gen.go deleted file mode 100644 index 5f8cb298b..000000000 --- a/tdapi/tl_connected_websites_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ConnectedWebsites represents TL type `connectedWebsites#f0c8b5ea`. -type ConnectedWebsites struct { - // List of connected websites - Websites []ConnectedWebsite -} - -// ConnectedWebsitesTypeID is TL type id of ConnectedWebsites. -const ConnectedWebsitesTypeID = 0xf0c8b5ea - -// Ensuring interfaces in compile-time for ConnectedWebsites. -var ( - _ bin.Encoder = &ConnectedWebsites{} - _ bin.Decoder = &ConnectedWebsites{} - _ bin.BareEncoder = &ConnectedWebsites{} - _ bin.BareDecoder = &ConnectedWebsites{} -) - -func (c *ConnectedWebsites) Zero() bool { - if c == nil { - return true - } - if !(c.Websites == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConnectedWebsites) String() string { - if c == nil { - return "ConnectedWebsites(nil)" - } - type Alias ConnectedWebsites - return fmt.Sprintf("ConnectedWebsites%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConnectedWebsites) TypeID() uint32 { - return ConnectedWebsitesTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConnectedWebsites) TypeName() string { - return "connectedWebsites" -} - -// TypeInfo returns info about TL type. -func (c *ConnectedWebsites) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "connectedWebsites", - ID: ConnectedWebsitesTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Websites", - SchemaName: "websites", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *ConnectedWebsites) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectedWebsites#f0c8b5ea as nil") - } - b.PutID(ConnectedWebsitesTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConnectedWebsites) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectedWebsites#f0c8b5ea as nil") - } - b.PutInt(len(c.Websites)) - for idx, v := range c.Websites { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare connectedWebsites#f0c8b5ea: field websites element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ConnectedWebsites) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectedWebsites#f0c8b5ea to nil") - } - if err := b.ConsumeID(ConnectedWebsitesTypeID); err != nil { - return fmt.Errorf("unable to decode connectedWebsites#f0c8b5ea: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConnectedWebsites) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectedWebsites#f0c8b5ea to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode connectedWebsites#f0c8b5ea: field websites: %w", err) - } - - if headerLen > 0 { - c.Websites = make([]ConnectedWebsite, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ConnectedWebsite - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare connectedWebsites#f0c8b5ea: field websites: %w", err) - } - c.Websites = append(c.Websites, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConnectedWebsites) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode connectedWebsites#f0c8b5ea as nil") - } - b.ObjStart() - b.PutID("connectedWebsites") - b.Comma() - b.FieldStart("websites") - b.ArrStart() - for idx, v := range c.Websites { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode connectedWebsites#f0c8b5ea: field websites element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConnectedWebsites) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode connectedWebsites#f0c8b5ea to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("connectedWebsites"); err != nil { - return fmt.Errorf("unable to decode connectedWebsites#f0c8b5ea: %w", err) - } - case "websites": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ConnectedWebsite - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode connectedWebsites#f0c8b5ea: field websites: %w", err) - } - c.Websites = append(c.Websites, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode connectedWebsites#f0c8b5ea: field websites: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetWebsites returns value of Websites field. -func (c *ConnectedWebsites) GetWebsites() (value []ConnectedWebsite) { - if c == nil { - return - } - return c.Websites -} diff --git a/tdapi/tl_connection_state_gen.go b/tdapi/tl_connection_state_gen.go deleted file mode 100644 index 7bd41794c..000000000 --- a/tdapi/tl_connection_state_gen.go +++ /dev/null @@ -1,869 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ConnectionStateWaitingForNetwork represents TL type `connectionStateWaitingForNetwork#650dd758`. -type ConnectionStateWaitingForNetwork struct { -} - -// ConnectionStateWaitingForNetworkTypeID is TL type id of ConnectionStateWaitingForNetwork. -const ConnectionStateWaitingForNetworkTypeID = 0x650dd758 - -// construct implements constructor of ConnectionStateClass. -func (c ConnectionStateWaitingForNetwork) construct() ConnectionStateClass { return &c } - -// Ensuring interfaces in compile-time for ConnectionStateWaitingForNetwork. -var ( - _ bin.Encoder = &ConnectionStateWaitingForNetwork{} - _ bin.Decoder = &ConnectionStateWaitingForNetwork{} - _ bin.BareEncoder = &ConnectionStateWaitingForNetwork{} - _ bin.BareDecoder = &ConnectionStateWaitingForNetwork{} - - _ ConnectionStateClass = &ConnectionStateWaitingForNetwork{} -) - -func (c *ConnectionStateWaitingForNetwork) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConnectionStateWaitingForNetwork) String() string { - if c == nil { - return "ConnectionStateWaitingForNetwork(nil)" - } - type Alias ConnectionStateWaitingForNetwork - return fmt.Sprintf("ConnectionStateWaitingForNetwork%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConnectionStateWaitingForNetwork) TypeID() uint32 { - return ConnectionStateWaitingForNetworkTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConnectionStateWaitingForNetwork) TypeName() string { - return "connectionStateWaitingForNetwork" -} - -// TypeInfo returns info about TL type. -func (c *ConnectionStateWaitingForNetwork) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "connectionStateWaitingForNetwork", - ID: ConnectionStateWaitingForNetworkTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ConnectionStateWaitingForNetwork) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateWaitingForNetwork#650dd758 as nil") - } - b.PutID(ConnectionStateWaitingForNetworkTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConnectionStateWaitingForNetwork) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateWaitingForNetwork#650dd758 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ConnectionStateWaitingForNetwork) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateWaitingForNetwork#650dd758 to nil") - } - if err := b.ConsumeID(ConnectionStateWaitingForNetworkTypeID); err != nil { - return fmt.Errorf("unable to decode connectionStateWaitingForNetwork#650dd758: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConnectionStateWaitingForNetwork) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateWaitingForNetwork#650dd758 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConnectionStateWaitingForNetwork) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateWaitingForNetwork#650dd758 as nil") - } - b.ObjStart() - b.PutID("connectionStateWaitingForNetwork") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConnectionStateWaitingForNetwork) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateWaitingForNetwork#650dd758 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("connectionStateWaitingForNetwork"); err != nil { - return fmt.Errorf("unable to decode connectionStateWaitingForNetwork#650dd758: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ConnectionStateConnectingToProxy represents TL type `connectionStateConnectingToProxy#fa721359`. -type ConnectionStateConnectingToProxy struct { -} - -// ConnectionStateConnectingToProxyTypeID is TL type id of ConnectionStateConnectingToProxy. -const ConnectionStateConnectingToProxyTypeID = 0xfa721359 - -// construct implements constructor of ConnectionStateClass. -func (c ConnectionStateConnectingToProxy) construct() ConnectionStateClass { return &c } - -// Ensuring interfaces in compile-time for ConnectionStateConnectingToProxy. -var ( - _ bin.Encoder = &ConnectionStateConnectingToProxy{} - _ bin.Decoder = &ConnectionStateConnectingToProxy{} - _ bin.BareEncoder = &ConnectionStateConnectingToProxy{} - _ bin.BareDecoder = &ConnectionStateConnectingToProxy{} - - _ ConnectionStateClass = &ConnectionStateConnectingToProxy{} -) - -func (c *ConnectionStateConnectingToProxy) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConnectionStateConnectingToProxy) String() string { - if c == nil { - return "ConnectionStateConnectingToProxy(nil)" - } - type Alias ConnectionStateConnectingToProxy - return fmt.Sprintf("ConnectionStateConnectingToProxy%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConnectionStateConnectingToProxy) TypeID() uint32 { - return ConnectionStateConnectingToProxyTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConnectionStateConnectingToProxy) TypeName() string { - return "connectionStateConnectingToProxy" -} - -// TypeInfo returns info about TL type. -func (c *ConnectionStateConnectingToProxy) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "connectionStateConnectingToProxy", - ID: ConnectionStateConnectingToProxyTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ConnectionStateConnectingToProxy) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateConnectingToProxy#fa721359 as nil") - } - b.PutID(ConnectionStateConnectingToProxyTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConnectionStateConnectingToProxy) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateConnectingToProxy#fa721359 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ConnectionStateConnectingToProxy) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateConnectingToProxy#fa721359 to nil") - } - if err := b.ConsumeID(ConnectionStateConnectingToProxyTypeID); err != nil { - return fmt.Errorf("unable to decode connectionStateConnectingToProxy#fa721359: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConnectionStateConnectingToProxy) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateConnectingToProxy#fa721359 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConnectionStateConnectingToProxy) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateConnectingToProxy#fa721359 as nil") - } - b.ObjStart() - b.PutID("connectionStateConnectingToProxy") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConnectionStateConnectingToProxy) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateConnectingToProxy#fa721359 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("connectionStateConnectingToProxy"); err != nil { - return fmt.Errorf("unable to decode connectionStateConnectingToProxy#fa721359: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ConnectionStateConnecting represents TL type `connectionStateConnecting#b29bfa62`. -type ConnectionStateConnecting struct { -} - -// ConnectionStateConnectingTypeID is TL type id of ConnectionStateConnecting. -const ConnectionStateConnectingTypeID = 0xb29bfa62 - -// construct implements constructor of ConnectionStateClass. -func (c ConnectionStateConnecting) construct() ConnectionStateClass { return &c } - -// Ensuring interfaces in compile-time for ConnectionStateConnecting. -var ( - _ bin.Encoder = &ConnectionStateConnecting{} - _ bin.Decoder = &ConnectionStateConnecting{} - _ bin.BareEncoder = &ConnectionStateConnecting{} - _ bin.BareDecoder = &ConnectionStateConnecting{} - - _ ConnectionStateClass = &ConnectionStateConnecting{} -) - -func (c *ConnectionStateConnecting) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConnectionStateConnecting) String() string { - if c == nil { - return "ConnectionStateConnecting(nil)" - } - type Alias ConnectionStateConnecting - return fmt.Sprintf("ConnectionStateConnecting%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConnectionStateConnecting) TypeID() uint32 { - return ConnectionStateConnectingTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConnectionStateConnecting) TypeName() string { - return "connectionStateConnecting" -} - -// TypeInfo returns info about TL type. -func (c *ConnectionStateConnecting) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "connectionStateConnecting", - ID: ConnectionStateConnectingTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ConnectionStateConnecting) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateConnecting#b29bfa62 as nil") - } - b.PutID(ConnectionStateConnectingTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConnectionStateConnecting) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateConnecting#b29bfa62 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ConnectionStateConnecting) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateConnecting#b29bfa62 to nil") - } - if err := b.ConsumeID(ConnectionStateConnectingTypeID); err != nil { - return fmt.Errorf("unable to decode connectionStateConnecting#b29bfa62: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConnectionStateConnecting) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateConnecting#b29bfa62 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConnectionStateConnecting) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateConnecting#b29bfa62 as nil") - } - b.ObjStart() - b.PutID("connectionStateConnecting") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConnectionStateConnecting) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateConnecting#b29bfa62 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("connectionStateConnecting"); err != nil { - return fmt.Errorf("unable to decode connectionStateConnecting#b29bfa62: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ConnectionStateUpdating represents TL type `connectionStateUpdating#f4c9c2b7`. -type ConnectionStateUpdating struct { -} - -// ConnectionStateUpdatingTypeID is TL type id of ConnectionStateUpdating. -const ConnectionStateUpdatingTypeID = 0xf4c9c2b7 - -// construct implements constructor of ConnectionStateClass. -func (c ConnectionStateUpdating) construct() ConnectionStateClass { return &c } - -// Ensuring interfaces in compile-time for ConnectionStateUpdating. -var ( - _ bin.Encoder = &ConnectionStateUpdating{} - _ bin.Decoder = &ConnectionStateUpdating{} - _ bin.BareEncoder = &ConnectionStateUpdating{} - _ bin.BareDecoder = &ConnectionStateUpdating{} - - _ ConnectionStateClass = &ConnectionStateUpdating{} -) - -func (c *ConnectionStateUpdating) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConnectionStateUpdating) String() string { - if c == nil { - return "ConnectionStateUpdating(nil)" - } - type Alias ConnectionStateUpdating - return fmt.Sprintf("ConnectionStateUpdating%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConnectionStateUpdating) TypeID() uint32 { - return ConnectionStateUpdatingTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConnectionStateUpdating) TypeName() string { - return "connectionStateUpdating" -} - -// TypeInfo returns info about TL type. -func (c *ConnectionStateUpdating) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "connectionStateUpdating", - ID: ConnectionStateUpdatingTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ConnectionStateUpdating) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateUpdating#f4c9c2b7 as nil") - } - b.PutID(ConnectionStateUpdatingTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConnectionStateUpdating) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateUpdating#f4c9c2b7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ConnectionStateUpdating) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateUpdating#f4c9c2b7 to nil") - } - if err := b.ConsumeID(ConnectionStateUpdatingTypeID); err != nil { - return fmt.Errorf("unable to decode connectionStateUpdating#f4c9c2b7: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConnectionStateUpdating) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateUpdating#f4c9c2b7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConnectionStateUpdating) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateUpdating#f4c9c2b7 as nil") - } - b.ObjStart() - b.PutID("connectionStateUpdating") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConnectionStateUpdating) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateUpdating#f4c9c2b7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("connectionStateUpdating"); err != nil { - return fmt.Errorf("unable to decode connectionStateUpdating#f4c9c2b7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ConnectionStateReady represents TL type `connectionStateReady#2e5b4ec`. -type ConnectionStateReady struct { -} - -// ConnectionStateReadyTypeID is TL type id of ConnectionStateReady. -const ConnectionStateReadyTypeID = 0x2e5b4ec - -// construct implements constructor of ConnectionStateClass. -func (c ConnectionStateReady) construct() ConnectionStateClass { return &c } - -// Ensuring interfaces in compile-time for ConnectionStateReady. -var ( - _ bin.Encoder = &ConnectionStateReady{} - _ bin.Decoder = &ConnectionStateReady{} - _ bin.BareEncoder = &ConnectionStateReady{} - _ bin.BareDecoder = &ConnectionStateReady{} - - _ ConnectionStateClass = &ConnectionStateReady{} -) - -func (c *ConnectionStateReady) Zero() bool { - if c == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (c *ConnectionStateReady) String() string { - if c == nil { - return "ConnectionStateReady(nil)" - } - type Alias ConnectionStateReady - return fmt.Sprintf("ConnectionStateReady%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ConnectionStateReady) TypeID() uint32 { - return ConnectionStateReadyTypeID -} - -// TypeName returns name of type in TL schema. -func (*ConnectionStateReady) TypeName() string { - return "connectionStateReady" -} - -// TypeInfo returns info about TL type. -func (c *ConnectionStateReady) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "connectionStateReady", - ID: ConnectionStateReadyTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (c *ConnectionStateReady) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateReady#2e5b4ec as nil") - } - b.PutID(ConnectionStateReadyTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *ConnectionStateReady) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateReady#2e5b4ec as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (c *ConnectionStateReady) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateReady#2e5b4ec to nil") - } - if err := b.ConsumeID(ConnectionStateReadyTypeID); err != nil { - return fmt.Errorf("unable to decode connectionStateReady#2e5b4ec: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *ConnectionStateReady) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateReady#2e5b4ec to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *ConnectionStateReady) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode connectionStateReady#2e5b4ec as nil") - } - b.ObjStart() - b.PutID("connectionStateReady") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *ConnectionStateReady) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode connectionStateReady#2e5b4ec to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("connectionStateReady"); err != nil { - return fmt.Errorf("unable to decode connectionStateReady#2e5b4ec: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ConnectionStateClassName is schema name of ConnectionStateClass. -const ConnectionStateClassName = "ConnectionState" - -// ConnectionStateClass represents ConnectionState generic type. -// -// Example: -// -// g, err := tdapi.DecodeConnectionState(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ConnectionStateWaitingForNetwork: // connectionStateWaitingForNetwork#650dd758 -// case *tdapi.ConnectionStateConnectingToProxy: // connectionStateConnectingToProxy#fa721359 -// case *tdapi.ConnectionStateConnecting: // connectionStateConnecting#b29bfa62 -// case *tdapi.ConnectionStateUpdating: // connectionStateUpdating#f4c9c2b7 -// case *tdapi.ConnectionStateReady: // connectionStateReady#2e5b4ec -// default: panic(v) -// } -type ConnectionStateClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ConnectionStateClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeConnectionState implements binary de-serialization for ConnectionStateClass. -func DecodeConnectionState(buf *bin.Buffer) (ConnectionStateClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ConnectionStateWaitingForNetworkTypeID: - // Decoding connectionStateWaitingForNetwork#650dd758. - v := ConnectionStateWaitingForNetwork{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", err) - } - return &v, nil - case ConnectionStateConnectingToProxyTypeID: - // Decoding connectionStateConnectingToProxy#fa721359. - v := ConnectionStateConnectingToProxy{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", err) - } - return &v, nil - case ConnectionStateConnectingTypeID: - // Decoding connectionStateConnecting#b29bfa62. - v := ConnectionStateConnecting{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", err) - } - return &v, nil - case ConnectionStateUpdatingTypeID: - // Decoding connectionStateUpdating#f4c9c2b7. - v := ConnectionStateUpdating{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", err) - } - return &v, nil - case ConnectionStateReadyTypeID: - // Decoding connectionStateReady#2e5b4ec. - v := ConnectionStateReady{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONConnectionState implements binary de-serialization for ConnectionStateClass. -func DecodeTDLibJSONConnectionState(buf tdjson.Decoder) (ConnectionStateClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "connectionStateWaitingForNetwork": - // Decoding connectionStateWaitingForNetwork#650dd758. - v := ConnectionStateWaitingForNetwork{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", err) - } - return &v, nil - case "connectionStateConnectingToProxy": - // Decoding connectionStateConnectingToProxy#fa721359. - v := ConnectionStateConnectingToProxy{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", err) - } - return &v, nil - case "connectionStateConnecting": - // Decoding connectionStateConnecting#b29bfa62. - v := ConnectionStateConnecting{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", err) - } - return &v, nil - case "connectionStateUpdating": - // Decoding connectionStateUpdating#f4c9c2b7. - v := ConnectionStateUpdating{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", err) - } - return &v, nil - case "connectionStateReady": - // Decoding connectionStateReady#2e5b4ec. - v := ConnectionStateReady{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ConnectionStateClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ConnectionState boxes the ConnectionStateClass providing a helper. -type ConnectionStateBox struct { - ConnectionState ConnectionStateClass -} - -// Decode implements bin.Decoder for ConnectionStateBox. -func (b *ConnectionStateBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ConnectionStateBox to nil") - } - v, err := DecodeConnectionState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ConnectionState = v - return nil -} - -// Encode implements bin.Encode for ConnectionStateBox. -func (b *ConnectionStateBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ConnectionState == nil { - return fmt.Errorf("unable to encode ConnectionStateClass as nil") - } - return b.ConnectionState.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ConnectionStateBox. -func (b *ConnectionStateBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ConnectionStateBox to nil") - } - v, err := DecodeTDLibJSONConnectionState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ConnectionState = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ConnectionStateBox. -func (b *ConnectionStateBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ConnectionState == nil { - return fmt.Errorf("unable to encode ConnectionStateClass as nil") - } - return b.ConnectionState.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_contact_gen.go b/tdapi/tl_contact_gen.go deleted file mode 100644 index 7f3230244..000000000 --- a/tdapi/tl_contact_gen.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Contact represents TL type `contact#89285774`. -type Contact struct { - // Phone number of the user - PhoneNumber string - // First name of the user; 1-255 characters in length - FirstName string - // Last name of the user - LastName string - // Additional data about the user in a form of vCard; 0-2048 bytes in length - Vcard string - // Identifier of the user, if known; 0 otherwise - UserID int64 -} - -// ContactTypeID is TL type id of Contact. -const ContactTypeID = 0x89285774 - -// Ensuring interfaces in compile-time for Contact. -var ( - _ bin.Encoder = &Contact{} - _ bin.Decoder = &Contact{} - _ bin.BareEncoder = &Contact{} - _ bin.BareDecoder = &Contact{} -) - -func (c *Contact) Zero() bool { - if c == nil { - return true - } - if !(c.PhoneNumber == "") { - return false - } - if !(c.FirstName == "") { - return false - } - if !(c.LastName == "") { - return false - } - if !(c.Vcard == "") { - return false - } - if !(c.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *Contact) String() string { - if c == nil { - return "Contact(nil)" - } - type Alias Contact - return fmt.Sprintf("Contact%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Contact) TypeID() uint32 { - return ContactTypeID -} - -// TypeName returns name of type in TL schema. -func (*Contact) TypeName() string { - return "contact" -} - -// TypeInfo returns info about TL type. -func (c *Contact) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "contact", - ID: ContactTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - { - Name: "FirstName", - SchemaName: "first_name", - }, - { - Name: "LastName", - SchemaName: "last_name", - }, - { - Name: "Vcard", - SchemaName: "vcard", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *Contact) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode contact#89285774 as nil") - } - b.PutID(ContactTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *Contact) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode contact#89285774 as nil") - } - b.PutString(c.PhoneNumber) - b.PutString(c.FirstName) - b.PutString(c.LastName) - b.PutString(c.Vcard) - b.PutInt53(c.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (c *Contact) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode contact#89285774 to nil") - } - if err := b.ConsumeID(ContactTypeID); err != nil { - return fmt.Errorf("unable to decode contact#89285774: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *Contact) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode contact#89285774 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode contact#89285774: field phone_number: %w", err) - } - c.PhoneNumber = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode contact#89285774: field first_name: %w", err) - } - c.FirstName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode contact#89285774: field last_name: %w", err) - } - c.LastName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode contact#89285774: field vcard: %w", err) - } - c.Vcard = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode contact#89285774: field user_id: %w", err) - } - c.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *Contact) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode contact#89285774 as nil") - } - b.ObjStart() - b.PutID("contact") - b.Comma() - b.FieldStart("phone_number") - b.PutString(c.PhoneNumber) - b.Comma() - b.FieldStart("first_name") - b.PutString(c.FirstName) - b.Comma() - b.FieldStart("last_name") - b.PutString(c.LastName) - b.Comma() - b.FieldStart("vcard") - b.PutString(c.Vcard) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *Contact) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode contact#89285774 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("contact"); err != nil { - return fmt.Errorf("unable to decode contact#89285774: %w", err) - } - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode contact#89285774: field phone_number: %w", err) - } - c.PhoneNumber = value - case "first_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode contact#89285774: field first_name: %w", err) - } - c.FirstName = value - case "last_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode contact#89285774: field last_name: %w", err) - } - c.LastName = value - case "vcard": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode contact#89285774: field vcard: %w", err) - } - c.Vcard = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode contact#89285774: field user_id: %w", err) - } - c.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (c *Contact) GetPhoneNumber() (value string) { - if c == nil { - return - } - return c.PhoneNumber -} - -// GetFirstName returns value of FirstName field. -func (c *Contact) GetFirstName() (value string) { - if c == nil { - return - } - return c.FirstName -} - -// GetLastName returns value of LastName field. -func (c *Contact) GetLastName() (value string) { - if c == nil { - return - } - return c.LastName -} - -// GetVcard returns value of Vcard field. -func (c *Contact) GetVcard() (value string) { - if c == nil { - return - } - return c.Vcard -} - -// GetUserID returns value of UserID field. -func (c *Contact) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} diff --git a/tdapi/tl_count_gen.go b/tdapi/tl_count_gen.go deleted file mode 100644 index 018c0421e..000000000 --- a/tdapi/tl_count_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Count represents TL type `count#4d38f104`. -type Count struct { - // Count - Count int32 -} - -// CountTypeID is TL type id of Count. -const CountTypeID = 0x4d38f104 - -// Ensuring interfaces in compile-time for Count. -var ( - _ bin.Encoder = &Count{} - _ bin.Decoder = &Count{} - _ bin.BareEncoder = &Count{} - _ bin.BareDecoder = &Count{} -) - -func (c *Count) Zero() bool { - if c == nil { - return true - } - if !(c.Count == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *Count) String() string { - if c == nil { - return "Count(nil)" - } - type Alias Count - return fmt.Sprintf("Count%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Count) TypeID() uint32 { - return CountTypeID -} - -// TypeName returns name of type in TL schema. -func (*Count) TypeName() string { - return "count" -} - -// TypeInfo returns info about TL type. -func (c *Count) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "count", - ID: CountTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Count", - SchemaName: "count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *Count) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode count#4d38f104 as nil") - } - b.PutID(CountTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *Count) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode count#4d38f104 as nil") - } - b.PutInt32(c.Count) - return nil -} - -// Decode implements bin.Decoder. -func (c *Count) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode count#4d38f104 to nil") - } - if err := b.ConsumeID(CountTypeID); err != nil { - return fmt.Errorf("unable to decode count#4d38f104: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *Count) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode count#4d38f104 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode count#4d38f104: field count: %w", err) - } - c.Count = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *Count) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode count#4d38f104 as nil") - } - b.ObjStart() - b.PutID("count") - b.Comma() - b.FieldStart("count") - b.PutInt32(c.Count) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *Count) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode count#4d38f104 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("count"); err != nil { - return fmt.Errorf("unable to decode count#4d38f104: %w", err) - } - case "count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode count#4d38f104: field count: %w", err) - } - c.Count = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCount returns value of Count field. -func (c *Count) GetCount() (value int32) { - if c == nil { - return - } - return c.Count -} diff --git a/tdapi/tl_countries_gen.go b/tdapi/tl_countries_gen.go deleted file mode 100644 index 25b718578..000000000 --- a/tdapi/tl_countries_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Countries represents TL type `countries#94b50e0f`. -type Countries struct { - // The list of countries - Countries []CountryInfo -} - -// CountriesTypeID is TL type id of Countries. -const CountriesTypeID = 0x94b50e0f - -// Ensuring interfaces in compile-time for Countries. -var ( - _ bin.Encoder = &Countries{} - _ bin.Decoder = &Countries{} - _ bin.BareEncoder = &Countries{} - _ bin.BareDecoder = &Countries{} -) - -func (c *Countries) Zero() bool { - if c == nil { - return true - } - if !(c.Countries == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *Countries) String() string { - if c == nil { - return "Countries(nil)" - } - type Alias Countries - return fmt.Sprintf("Countries%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Countries) TypeID() uint32 { - return CountriesTypeID -} - -// TypeName returns name of type in TL schema. -func (*Countries) TypeName() string { - return "countries" -} - -// TypeInfo returns info about TL type. -func (c *Countries) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "countries", - ID: CountriesTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Countries", - SchemaName: "countries", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *Countries) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode countries#94b50e0f as nil") - } - b.PutID(CountriesTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *Countries) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode countries#94b50e0f as nil") - } - b.PutInt(len(c.Countries)) - for idx, v := range c.Countries { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare countries#94b50e0f: field countries element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (c *Countries) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode countries#94b50e0f to nil") - } - if err := b.ConsumeID(CountriesTypeID); err != nil { - return fmt.Errorf("unable to decode countries#94b50e0f: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *Countries) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode countries#94b50e0f to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode countries#94b50e0f: field countries: %w", err) - } - - if headerLen > 0 { - c.Countries = make([]CountryInfo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value CountryInfo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare countries#94b50e0f: field countries: %w", err) - } - c.Countries = append(c.Countries, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *Countries) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode countries#94b50e0f as nil") - } - b.ObjStart() - b.PutID("countries") - b.Comma() - b.FieldStart("countries") - b.ArrStart() - for idx, v := range c.Countries { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode countries#94b50e0f: field countries element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *Countries) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode countries#94b50e0f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("countries"); err != nil { - return fmt.Errorf("unable to decode countries#94b50e0f: %w", err) - } - case "countries": - if err := b.Arr(func(b tdjson.Decoder) error { - var value CountryInfo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode countries#94b50e0f: field countries: %w", err) - } - c.Countries = append(c.Countries, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode countries#94b50e0f: field countries: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCountries returns value of Countries field. -func (c *Countries) GetCountries() (value []CountryInfo) { - if c == nil { - return - } - return c.Countries -} diff --git a/tdapi/tl_country_info_gen.go b/tdapi/tl_country_info_gen.go deleted file mode 100644 index 55c5b5b9b..000000000 --- a/tdapi/tl_country_info_gen.go +++ /dev/null @@ -1,353 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CountryInfo represents TL type `countryInfo#d9936dff`. -type CountryInfo struct { - // A two-letter ISO 3166-1 alpha-2 country code - CountryCode string - // Native name of the country - Name string - // English name of the country - EnglishName string - // True, if the country must be hidden from the list of all countries - IsHidden bool - // List of country calling codes - CallingCodes []string -} - -// CountryInfoTypeID is TL type id of CountryInfo. -const CountryInfoTypeID = 0xd9936dff - -// Ensuring interfaces in compile-time for CountryInfo. -var ( - _ bin.Encoder = &CountryInfo{} - _ bin.Decoder = &CountryInfo{} - _ bin.BareEncoder = &CountryInfo{} - _ bin.BareDecoder = &CountryInfo{} -) - -func (c *CountryInfo) Zero() bool { - if c == nil { - return true - } - if !(c.CountryCode == "") { - return false - } - if !(c.Name == "") { - return false - } - if !(c.EnglishName == "") { - return false - } - if !(c.IsHidden == false) { - return false - } - if !(c.CallingCodes == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CountryInfo) String() string { - if c == nil { - return "CountryInfo(nil)" - } - type Alias CountryInfo - return fmt.Sprintf("CountryInfo%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CountryInfo) TypeID() uint32 { - return CountryInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*CountryInfo) TypeName() string { - return "countryInfo" -} - -// TypeInfo returns info about TL type. -func (c *CountryInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "countryInfo", - ID: CountryInfoTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CountryCode", - SchemaName: "country_code", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "EnglishName", - SchemaName: "english_name", - }, - { - Name: "IsHidden", - SchemaName: "is_hidden", - }, - { - Name: "CallingCodes", - SchemaName: "calling_codes", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CountryInfo) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode countryInfo#d9936dff as nil") - } - b.PutID(CountryInfoTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CountryInfo) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode countryInfo#d9936dff as nil") - } - b.PutString(c.CountryCode) - b.PutString(c.Name) - b.PutString(c.EnglishName) - b.PutBool(c.IsHidden) - b.PutInt(len(c.CallingCodes)) - for _, v := range c.CallingCodes { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CountryInfo) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode countryInfo#d9936dff to nil") - } - if err := b.ConsumeID(CountryInfoTypeID); err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CountryInfo) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode countryInfo#d9936dff to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field country_code: %w", err) - } - c.CountryCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field name: %w", err) - } - c.Name = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field english_name: %w", err) - } - c.EnglishName = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field is_hidden: %w", err) - } - c.IsHidden = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field calling_codes: %w", err) - } - - if headerLen > 0 { - c.CallingCodes = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field calling_codes: %w", err) - } - c.CallingCodes = append(c.CallingCodes, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CountryInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode countryInfo#d9936dff as nil") - } - b.ObjStart() - b.PutID("countryInfo") - b.Comma() - b.FieldStart("country_code") - b.PutString(c.CountryCode) - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.FieldStart("english_name") - b.PutString(c.EnglishName) - b.Comma() - b.FieldStart("is_hidden") - b.PutBool(c.IsHidden) - b.Comma() - b.FieldStart("calling_codes") - b.ArrStart() - for _, v := range c.CallingCodes { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CountryInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode countryInfo#d9936dff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("countryInfo"); err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: %w", err) - } - case "country_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field country_code: %w", err) - } - c.CountryCode = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field name: %w", err) - } - c.Name = value - case "english_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field english_name: %w", err) - } - c.EnglishName = value - case "is_hidden": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field is_hidden: %w", err) - } - c.IsHidden = value - case "calling_codes": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field calling_codes: %w", err) - } - c.CallingCodes = append(c.CallingCodes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode countryInfo#d9936dff: field calling_codes: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCountryCode returns value of CountryCode field. -func (c *CountryInfo) GetCountryCode() (value string) { - if c == nil { - return - } - return c.CountryCode -} - -// GetName returns value of Name field. -func (c *CountryInfo) GetName() (value string) { - if c == nil { - return - } - return c.Name -} - -// GetEnglishName returns value of EnglishName field. -func (c *CountryInfo) GetEnglishName() (value string) { - if c == nil { - return - } - return c.EnglishName -} - -// GetIsHidden returns value of IsHidden field. -func (c *CountryInfo) GetIsHidden() (value bool) { - if c == nil { - return - } - return c.IsHidden -} - -// GetCallingCodes returns value of CallingCodes field. -func (c *CountryInfo) GetCallingCodes() (value []string) { - if c == nil { - return - } - return c.CallingCodes -} diff --git a/tdapi/tl_create_basic_group_chat_gen.go b/tdapi/tl_create_basic_group_chat_gen.go deleted file mode 100644 index baea73600..000000000 --- a/tdapi/tl_create_basic_group_chat_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateBasicGroupChatRequest represents TL type `createBasicGroupChat#758ab4e4`. -type CreateBasicGroupChatRequest struct { - // Basic group identifier - BasicGroupID int64 - // Pass true to create the chat without a network request. In this case all information - // about the chat except its type, title and photo can be incorrect - Force bool -} - -// CreateBasicGroupChatRequestTypeID is TL type id of CreateBasicGroupChatRequest. -const CreateBasicGroupChatRequestTypeID = 0x758ab4e4 - -// Ensuring interfaces in compile-time for CreateBasicGroupChatRequest. -var ( - _ bin.Encoder = &CreateBasicGroupChatRequest{} - _ bin.Decoder = &CreateBasicGroupChatRequest{} - _ bin.BareEncoder = &CreateBasicGroupChatRequest{} - _ bin.BareDecoder = &CreateBasicGroupChatRequest{} -) - -func (c *CreateBasicGroupChatRequest) Zero() bool { - if c == nil { - return true - } - if !(c.BasicGroupID == 0) { - return false - } - if !(c.Force == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateBasicGroupChatRequest) String() string { - if c == nil { - return "CreateBasicGroupChatRequest(nil)" - } - type Alias CreateBasicGroupChatRequest - return fmt.Sprintf("CreateBasicGroupChatRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateBasicGroupChatRequest) TypeID() uint32 { - return CreateBasicGroupChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateBasicGroupChatRequest) TypeName() string { - return "createBasicGroupChat" -} - -// TypeInfo returns info about TL type. -func (c *CreateBasicGroupChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createBasicGroupChat", - ID: CreateBasicGroupChatRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BasicGroupID", - SchemaName: "basic_group_id", - }, - { - Name: "Force", - SchemaName: "force", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateBasicGroupChatRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createBasicGroupChat#758ab4e4 as nil") - } - b.PutID(CreateBasicGroupChatRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateBasicGroupChatRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createBasicGroupChat#758ab4e4 as nil") - } - b.PutInt53(c.BasicGroupID) - b.PutBool(c.Force) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateBasicGroupChatRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createBasicGroupChat#758ab4e4 to nil") - } - if err := b.ConsumeID(CreateBasicGroupChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateBasicGroupChatRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createBasicGroupChat#758ab4e4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: field basic_group_id: %w", err) - } - c.BasicGroupID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: field force: %w", err) - } - c.Force = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateBasicGroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createBasicGroupChat#758ab4e4 as nil") - } - b.ObjStart() - b.PutID("createBasicGroupChat") - b.Comma() - b.FieldStart("basic_group_id") - b.PutInt53(c.BasicGroupID) - b.Comma() - b.FieldStart("force") - b.PutBool(c.Force) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateBasicGroupChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createBasicGroupChat#758ab4e4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createBasicGroupChat"); err != nil { - return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: %w", err) - } - case "basic_group_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: field basic_group_id: %w", err) - } - c.BasicGroupID = value - case "force": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createBasicGroupChat#758ab4e4: field force: %w", err) - } - c.Force = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBasicGroupID returns value of BasicGroupID field. -func (c *CreateBasicGroupChatRequest) GetBasicGroupID() (value int64) { - if c == nil { - return - } - return c.BasicGroupID -} - -// GetForce returns value of Force field. -func (c *CreateBasicGroupChatRequest) GetForce() (value bool) { - if c == nil { - return - } - return c.Force -} - -// CreateBasicGroupChat invokes method createBasicGroupChat#758ab4e4 returning error if any. -func (c *Client) CreateBasicGroupChat(ctx context.Context, request *CreateBasicGroupChatRequest) (*Chat, error) { - var result Chat - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_business_chat_link_gen.go b/tdapi/tl_create_business_chat_link_gen.go deleted file mode 100644 index cea779e67..000000000 --- a/tdapi/tl_create_business_chat_link_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateBusinessChatLinkRequest represents TL type `createBusinessChatLink#91131d40`. -type CreateBusinessChatLinkRequest struct { - // Information about the link to create - LinkInfo InputBusinessChatLink -} - -// CreateBusinessChatLinkRequestTypeID is TL type id of CreateBusinessChatLinkRequest. -const CreateBusinessChatLinkRequestTypeID = 0x91131d40 - -// Ensuring interfaces in compile-time for CreateBusinessChatLinkRequest. -var ( - _ bin.Encoder = &CreateBusinessChatLinkRequest{} - _ bin.Decoder = &CreateBusinessChatLinkRequest{} - _ bin.BareEncoder = &CreateBusinessChatLinkRequest{} - _ bin.BareDecoder = &CreateBusinessChatLinkRequest{} -) - -func (c *CreateBusinessChatLinkRequest) Zero() bool { - if c == nil { - return true - } - if !(c.LinkInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateBusinessChatLinkRequest) String() string { - if c == nil { - return "CreateBusinessChatLinkRequest(nil)" - } - type Alias CreateBusinessChatLinkRequest - return fmt.Sprintf("CreateBusinessChatLinkRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateBusinessChatLinkRequest) TypeID() uint32 { - return CreateBusinessChatLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateBusinessChatLinkRequest) TypeName() string { - return "createBusinessChatLink" -} - -// TypeInfo returns info about TL type. -func (c *CreateBusinessChatLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createBusinessChatLink", - ID: CreateBusinessChatLinkRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LinkInfo", - SchemaName: "link_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateBusinessChatLinkRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createBusinessChatLink#91131d40 as nil") - } - b.PutID(CreateBusinessChatLinkRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateBusinessChatLinkRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createBusinessChatLink#91131d40 as nil") - } - if err := c.LinkInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode createBusinessChatLink#91131d40: field link_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateBusinessChatLinkRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createBusinessChatLink#91131d40 to nil") - } - if err := b.ConsumeID(CreateBusinessChatLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createBusinessChatLink#91131d40: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateBusinessChatLinkRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createBusinessChatLink#91131d40 to nil") - } - { - if err := c.LinkInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode createBusinessChatLink#91131d40: field link_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateBusinessChatLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createBusinessChatLink#91131d40 as nil") - } - b.ObjStart() - b.PutID("createBusinessChatLink") - b.Comma() - b.FieldStart("link_info") - if err := c.LinkInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createBusinessChatLink#91131d40: field link_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateBusinessChatLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createBusinessChatLink#91131d40 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createBusinessChatLink"); err != nil { - return fmt.Errorf("unable to decode createBusinessChatLink#91131d40: %w", err) - } - case "link_info": - if err := c.LinkInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode createBusinessChatLink#91131d40: field link_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLinkInfo returns value of LinkInfo field. -func (c *CreateBusinessChatLinkRequest) GetLinkInfo() (value InputBusinessChatLink) { - if c == nil { - return - } - return c.LinkInfo -} - -// CreateBusinessChatLink invokes method createBusinessChatLink#91131d40 returning error if any. -func (c *Client) CreateBusinessChatLink(ctx context.Context, linkinfo InputBusinessChatLink) (*BusinessChatLink, error) { - var result BusinessChatLink - - request := &CreateBusinessChatLinkRequest{ - LinkInfo: linkinfo, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_call_gen.go b/tdapi/tl_create_call_gen.go deleted file mode 100644 index 69776b21b..000000000 --- a/tdapi/tl_create_call_gen.go +++ /dev/null @@ -1,306 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateCallRequest represents TL type `createCall#b4410c99`. -type CreateCallRequest struct { - // Identifier of the user to be called - UserID int64 - // The call protocols supported by the application - Protocol CallProtocol - // Pass true to create a video call - IsVideo bool - // Identifier of the group call to which the user will be added after exchanging private - // key via the call; pass 0 if none; currently, ignored - GroupCallID int32 -} - -// CreateCallRequestTypeID is TL type id of CreateCallRequest. -const CreateCallRequestTypeID = 0xb4410c99 - -// Ensuring interfaces in compile-time for CreateCallRequest. -var ( - _ bin.Encoder = &CreateCallRequest{} - _ bin.Decoder = &CreateCallRequest{} - _ bin.BareEncoder = &CreateCallRequest{} - _ bin.BareDecoder = &CreateCallRequest{} -) - -func (c *CreateCallRequest) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.Protocol.Zero()) { - return false - } - if !(c.IsVideo == false) { - return false - } - if !(c.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateCallRequest) String() string { - if c == nil { - return "CreateCallRequest(nil)" - } - type Alias CreateCallRequest - return fmt.Sprintf("CreateCallRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateCallRequest) TypeID() uint32 { - return CreateCallRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateCallRequest) TypeName() string { - return "createCall" -} - -// TypeInfo returns info about TL type. -func (c *CreateCallRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createCall", - ID: CreateCallRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Protocol", - SchemaName: "protocol", - }, - { - Name: "IsVideo", - SchemaName: "is_video", - }, - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateCallRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createCall#b4410c99 as nil") - } - b.PutID(CreateCallRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateCallRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createCall#b4410c99 as nil") - } - b.PutInt53(c.UserID) - if err := c.Protocol.Encode(b); err != nil { - return fmt.Errorf("unable to encode createCall#b4410c99: field protocol: %w", err) - } - b.PutBool(c.IsVideo) - b.PutInt32(c.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateCallRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createCall#b4410c99 to nil") - } - if err := b.ConsumeID(CreateCallRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createCall#b4410c99: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateCallRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createCall#b4410c99 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createCall#b4410c99: field user_id: %w", err) - } - c.UserID = value - } - { - if err := c.Protocol.Decode(b); err != nil { - return fmt.Errorf("unable to decode createCall#b4410c99: field protocol: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createCall#b4410c99: field is_video: %w", err) - } - c.IsVideo = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createCall#b4410c99: field group_call_id: %w", err) - } - c.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createCall#b4410c99 as nil") - } - b.ObjStart() - b.PutID("createCall") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("protocol") - if err := c.Protocol.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createCall#b4410c99: field protocol: %w", err) - } - b.Comma() - b.FieldStart("is_video") - b.PutBool(c.IsVideo) - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(c.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createCall#b4410c99 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createCall"); err != nil { - return fmt.Errorf("unable to decode createCall#b4410c99: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createCall#b4410c99: field user_id: %w", err) - } - c.UserID = value - case "protocol": - if err := c.Protocol.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode createCall#b4410c99: field protocol: %w", err) - } - case "is_video": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createCall#b4410c99: field is_video: %w", err) - } - c.IsVideo = value - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createCall#b4410c99: field group_call_id: %w", err) - } - c.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *CreateCallRequest) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetProtocol returns value of Protocol field. -func (c *CreateCallRequest) GetProtocol() (value CallProtocol) { - if c == nil { - return - } - return c.Protocol -} - -// GetIsVideo returns value of IsVideo field. -func (c *CreateCallRequest) GetIsVideo() (value bool) { - if c == nil { - return - } - return c.IsVideo -} - -// GetGroupCallID returns value of GroupCallID field. -func (c *CreateCallRequest) GetGroupCallID() (value int32) { - if c == nil { - return - } - return c.GroupCallID -} - -// CreateCall invokes method createCall#b4410c99 returning error if any. -func (c *Client) CreateCall(ctx context.Context, request *CreateCallRequest) (*CallID, error) { - var result CallID - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_chat_folder_gen.go b/tdapi/tl_create_chat_folder_gen.go deleted file mode 100644 index df99242c7..000000000 --- a/tdapi/tl_create_chat_folder_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateChatFolderRequest represents TL type `createChatFolder#3c85c500`. -type CreateChatFolderRequest struct { - // The new chat folder - Folder ChatFolder -} - -// CreateChatFolderRequestTypeID is TL type id of CreateChatFolderRequest. -const CreateChatFolderRequestTypeID = 0x3c85c500 - -// Ensuring interfaces in compile-time for CreateChatFolderRequest. -var ( - _ bin.Encoder = &CreateChatFolderRequest{} - _ bin.Decoder = &CreateChatFolderRequest{} - _ bin.BareEncoder = &CreateChatFolderRequest{} - _ bin.BareDecoder = &CreateChatFolderRequest{} -) - -func (c *CreateChatFolderRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Folder.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateChatFolderRequest) String() string { - if c == nil { - return "CreateChatFolderRequest(nil)" - } - type Alias CreateChatFolderRequest - return fmt.Sprintf("CreateChatFolderRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateChatFolderRequest) TypeID() uint32 { - return CreateChatFolderRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateChatFolderRequest) TypeName() string { - return "createChatFolder" -} - -// TypeInfo returns info about TL type. -func (c *CreateChatFolderRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createChatFolder", - ID: CreateChatFolderRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Folder", - SchemaName: "folder", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateChatFolderRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createChatFolder#3c85c500 as nil") - } - b.PutID(CreateChatFolderRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateChatFolderRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createChatFolder#3c85c500 as nil") - } - if err := c.Folder.Encode(b); err != nil { - return fmt.Errorf("unable to encode createChatFolder#3c85c500: field folder: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateChatFolderRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createChatFolder#3c85c500 to nil") - } - if err := b.ConsumeID(CreateChatFolderRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createChatFolder#3c85c500: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateChatFolderRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createChatFolder#3c85c500 to nil") - } - { - if err := c.Folder.Decode(b); err != nil { - return fmt.Errorf("unable to decode createChatFolder#3c85c500: field folder: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateChatFolderRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createChatFolder#3c85c500 as nil") - } - b.ObjStart() - b.PutID("createChatFolder") - b.Comma() - b.FieldStart("folder") - if err := c.Folder.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createChatFolder#3c85c500: field folder: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateChatFolderRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createChatFolder#3c85c500 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createChatFolder"); err != nil { - return fmt.Errorf("unable to decode createChatFolder#3c85c500: %w", err) - } - case "folder": - if err := c.Folder.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode createChatFolder#3c85c500: field folder: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFolder returns value of Folder field. -func (c *CreateChatFolderRequest) GetFolder() (value ChatFolder) { - if c == nil { - return - } - return c.Folder -} - -// CreateChatFolder invokes method createChatFolder#3c85c500 returning error if any. -func (c *Client) CreateChatFolder(ctx context.Context, folder ChatFolder) (*ChatFolderInfo, error) { - var result ChatFolderInfo - - request := &CreateChatFolderRequest{ - Folder: folder, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_chat_folder_invite_link_gen.go b/tdapi/tl_create_chat_folder_invite_link_gen.go deleted file mode 100644 index 5c9a93719..000000000 --- a/tdapi/tl_create_chat_folder_invite_link_gen.go +++ /dev/null @@ -1,297 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateChatFolderInviteLinkRequest represents TL type `createChatFolderInviteLink#fba5e198`. -type CreateChatFolderInviteLinkRequest struct { - // Chat folder identifier - ChatFolderID int32 - // Name of the link; 0-32 characters - Name string - // Identifiers of chats to be accessible by the invite link. Use - // getChatsForChatFolderInviteLink to get suitable chats. Basic groups will be - // automatically converted to supergroups before link creation - ChatIDs []int64 -} - -// CreateChatFolderInviteLinkRequestTypeID is TL type id of CreateChatFolderInviteLinkRequest. -const CreateChatFolderInviteLinkRequestTypeID = 0xfba5e198 - -// Ensuring interfaces in compile-time for CreateChatFolderInviteLinkRequest. -var ( - _ bin.Encoder = &CreateChatFolderInviteLinkRequest{} - _ bin.Decoder = &CreateChatFolderInviteLinkRequest{} - _ bin.BareEncoder = &CreateChatFolderInviteLinkRequest{} - _ bin.BareDecoder = &CreateChatFolderInviteLinkRequest{} -) - -func (c *CreateChatFolderInviteLinkRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatFolderID == 0) { - return false - } - if !(c.Name == "") { - return false - } - if !(c.ChatIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateChatFolderInviteLinkRequest) String() string { - if c == nil { - return "CreateChatFolderInviteLinkRequest(nil)" - } - type Alias CreateChatFolderInviteLinkRequest - return fmt.Sprintf("CreateChatFolderInviteLinkRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateChatFolderInviteLinkRequest) TypeID() uint32 { - return CreateChatFolderInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateChatFolderInviteLinkRequest) TypeName() string { - return "createChatFolderInviteLink" -} - -// TypeInfo returns info about TL type. -func (c *CreateChatFolderInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createChatFolderInviteLink", - ID: CreateChatFolderInviteLinkRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "ChatIDs", - SchemaName: "chat_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateChatFolderInviteLinkRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createChatFolderInviteLink#fba5e198 as nil") - } - b.PutID(CreateChatFolderInviteLinkRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateChatFolderInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createChatFolderInviteLink#fba5e198 as nil") - } - b.PutInt32(c.ChatFolderID) - b.PutString(c.Name) - b.PutInt(len(c.ChatIDs)) - for _, v := range c.ChatIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateChatFolderInviteLinkRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createChatFolderInviteLink#fba5e198 to nil") - } - if err := b.ConsumeID(CreateChatFolderInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createChatFolderInviteLink#fba5e198: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateChatFolderInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createChatFolderInviteLink#fba5e198 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createChatFolderInviteLink#fba5e198: field chat_folder_id: %w", err) - } - c.ChatFolderID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createChatFolderInviteLink#fba5e198: field name: %w", err) - } - c.Name = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode createChatFolderInviteLink#fba5e198: field chat_ids: %w", err) - } - - if headerLen > 0 { - c.ChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createChatFolderInviteLink#fba5e198: field chat_ids: %w", err) - } - c.ChatIDs = append(c.ChatIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateChatFolderInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createChatFolderInviteLink#fba5e198 as nil") - } - b.ObjStart() - b.PutID("createChatFolderInviteLink") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(c.ChatFolderID) - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.FieldStart("chat_ids") - b.ArrStart() - for _, v := range c.ChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateChatFolderInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createChatFolderInviteLink#fba5e198 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createChatFolderInviteLink"); err != nil { - return fmt.Errorf("unable to decode createChatFolderInviteLink#fba5e198: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createChatFolderInviteLink#fba5e198: field chat_folder_id: %w", err) - } - c.ChatFolderID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createChatFolderInviteLink#fba5e198: field name: %w", err) - } - c.Name = value - case "chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createChatFolderInviteLink#fba5e198: field chat_ids: %w", err) - } - c.ChatIDs = append(c.ChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode createChatFolderInviteLink#fba5e198: field chat_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (c *CreateChatFolderInviteLinkRequest) GetChatFolderID() (value int32) { - if c == nil { - return - } - return c.ChatFolderID -} - -// GetName returns value of Name field. -func (c *CreateChatFolderInviteLinkRequest) GetName() (value string) { - if c == nil { - return - } - return c.Name -} - -// GetChatIDs returns value of ChatIDs field. -func (c *CreateChatFolderInviteLinkRequest) GetChatIDs() (value []int64) { - if c == nil { - return - } - return c.ChatIDs -} - -// CreateChatFolderInviteLink invokes method createChatFolderInviteLink#fba5e198 returning error if any. -func (c *Client) CreateChatFolderInviteLink(ctx context.Context, request *CreateChatFolderInviteLinkRequest) (*ChatFolderInviteLink, error) { - var result ChatFolderInviteLink - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_chat_invite_link_gen.go b/tdapi/tl_create_chat_invite_link_gen.go deleted file mode 100644 index 91ff25e2e..000000000 --- a/tdapi/tl_create_chat_invite_link_gen.go +++ /dev/null @@ -1,341 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateChatInviteLinkRequest represents TL type `createChatInviteLink#1126a341`. -type CreateChatInviteLinkRequest struct { - // Chat identifier - ChatID int64 - // Invite link name; 0-32 characters - Name string - // Point in time (Unix timestamp) when the link will expire; pass 0 if never - ExpirationDate int32 - // The maximum number of chat members that can join the chat via the link simultaneously; - // 0-99999; pass 0 if not limited - MemberLimit int32 - // Pass true if users joining the chat via the link need to be approved by chat - // administrators. In this case, member_limit must be 0 - CreatesJoinRequest bool -} - -// CreateChatInviteLinkRequestTypeID is TL type id of CreateChatInviteLinkRequest. -const CreateChatInviteLinkRequestTypeID = 0x1126a341 - -// Ensuring interfaces in compile-time for CreateChatInviteLinkRequest. -var ( - _ bin.Encoder = &CreateChatInviteLinkRequest{} - _ bin.Decoder = &CreateChatInviteLinkRequest{} - _ bin.BareEncoder = &CreateChatInviteLinkRequest{} - _ bin.BareDecoder = &CreateChatInviteLinkRequest{} -) - -func (c *CreateChatInviteLinkRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.Name == "") { - return false - } - if !(c.ExpirationDate == 0) { - return false - } - if !(c.MemberLimit == 0) { - return false - } - if !(c.CreatesJoinRequest == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateChatInviteLinkRequest) String() string { - if c == nil { - return "CreateChatInviteLinkRequest(nil)" - } - type Alias CreateChatInviteLinkRequest - return fmt.Sprintf("CreateChatInviteLinkRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateChatInviteLinkRequest) TypeID() uint32 { - return CreateChatInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateChatInviteLinkRequest) TypeName() string { - return "createChatInviteLink" -} - -// TypeInfo returns info about TL type. -func (c *CreateChatInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createChatInviteLink", - ID: CreateChatInviteLinkRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "ExpirationDate", - SchemaName: "expiration_date", - }, - { - Name: "MemberLimit", - SchemaName: "member_limit", - }, - { - Name: "CreatesJoinRequest", - SchemaName: "creates_join_request", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateChatInviteLinkRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createChatInviteLink#1126a341 as nil") - } - b.PutID(CreateChatInviteLinkRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateChatInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createChatInviteLink#1126a341 as nil") - } - b.PutInt53(c.ChatID) - b.PutString(c.Name) - b.PutInt32(c.ExpirationDate) - b.PutInt32(c.MemberLimit) - b.PutBool(c.CreatesJoinRequest) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateChatInviteLinkRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createChatInviteLink#1126a341 to nil") - } - if err := b.ConsumeID(CreateChatInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateChatInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createChatInviteLink#1126a341 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: field chat_id: %w", err) - } - c.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: field name: %w", err) - } - c.Name = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: field expiration_date: %w", err) - } - c.ExpirationDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: field member_limit: %w", err) - } - c.MemberLimit = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: field creates_join_request: %w", err) - } - c.CreatesJoinRequest = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateChatInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createChatInviteLink#1126a341 as nil") - } - b.ObjStart() - b.PutID("createChatInviteLink") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.FieldStart("expiration_date") - b.PutInt32(c.ExpirationDate) - b.Comma() - b.FieldStart("member_limit") - b.PutInt32(c.MemberLimit) - b.Comma() - b.FieldStart("creates_join_request") - b.PutBool(c.CreatesJoinRequest) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateChatInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createChatInviteLink#1126a341 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createChatInviteLink"); err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: field chat_id: %w", err) - } - c.ChatID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: field name: %w", err) - } - c.Name = value - case "expiration_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: field expiration_date: %w", err) - } - c.ExpirationDate = value - case "member_limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: field member_limit: %w", err) - } - c.MemberLimit = value - case "creates_join_request": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createChatInviteLink#1126a341: field creates_join_request: %w", err) - } - c.CreatesJoinRequest = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *CreateChatInviteLinkRequest) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetName returns value of Name field. -func (c *CreateChatInviteLinkRequest) GetName() (value string) { - if c == nil { - return - } - return c.Name -} - -// GetExpirationDate returns value of ExpirationDate field. -func (c *CreateChatInviteLinkRequest) GetExpirationDate() (value int32) { - if c == nil { - return - } - return c.ExpirationDate -} - -// GetMemberLimit returns value of MemberLimit field. -func (c *CreateChatInviteLinkRequest) GetMemberLimit() (value int32) { - if c == nil { - return - } - return c.MemberLimit -} - -// GetCreatesJoinRequest returns value of CreatesJoinRequest field. -func (c *CreateChatInviteLinkRequest) GetCreatesJoinRequest() (value bool) { - if c == nil { - return - } - return c.CreatesJoinRequest -} - -// CreateChatInviteLink invokes method createChatInviteLink#1126a341 returning error if any. -func (c *Client) CreateChatInviteLink(ctx context.Context, request *CreateChatInviteLinkRequest) (*ChatInviteLink, error) { - var result ChatInviteLink - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_chat_subscription_invite_link_gen.go b/tdapi/tl_create_chat_subscription_invite_link_gen.go deleted file mode 100644 index 0ef2081a5..000000000 --- a/tdapi/tl_create_chat_subscription_invite_link_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateChatSubscriptionInviteLinkRequest represents TL type `createChatSubscriptionInviteLink#226b65`. -type CreateChatSubscriptionInviteLinkRequest struct { - // Chat identifier - ChatID int64 - // Invite link name; 0-32 characters - Name string - // Information about subscription plan that will be applied to the users joining the chat - // via the link. - SubscriptionPricing StarSubscriptionPricing -} - -// CreateChatSubscriptionInviteLinkRequestTypeID is TL type id of CreateChatSubscriptionInviteLinkRequest. -const CreateChatSubscriptionInviteLinkRequestTypeID = 0x226b65 - -// Ensuring interfaces in compile-time for CreateChatSubscriptionInviteLinkRequest. -var ( - _ bin.Encoder = &CreateChatSubscriptionInviteLinkRequest{} - _ bin.Decoder = &CreateChatSubscriptionInviteLinkRequest{} - _ bin.BareEncoder = &CreateChatSubscriptionInviteLinkRequest{} - _ bin.BareDecoder = &CreateChatSubscriptionInviteLinkRequest{} -) - -func (c *CreateChatSubscriptionInviteLinkRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.Name == "") { - return false - } - if !(c.SubscriptionPricing.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateChatSubscriptionInviteLinkRequest) String() string { - if c == nil { - return "CreateChatSubscriptionInviteLinkRequest(nil)" - } - type Alias CreateChatSubscriptionInviteLinkRequest - return fmt.Sprintf("CreateChatSubscriptionInviteLinkRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateChatSubscriptionInviteLinkRequest) TypeID() uint32 { - return CreateChatSubscriptionInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateChatSubscriptionInviteLinkRequest) TypeName() string { - return "createChatSubscriptionInviteLink" -} - -// TypeInfo returns info about TL type. -func (c *CreateChatSubscriptionInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createChatSubscriptionInviteLink", - ID: CreateChatSubscriptionInviteLinkRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "SubscriptionPricing", - SchemaName: "subscription_pricing", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateChatSubscriptionInviteLinkRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createChatSubscriptionInviteLink#226b65 as nil") - } - b.PutID(CreateChatSubscriptionInviteLinkRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateChatSubscriptionInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createChatSubscriptionInviteLink#226b65 as nil") - } - b.PutInt53(c.ChatID) - b.PutString(c.Name) - if err := c.SubscriptionPricing.Encode(b); err != nil { - return fmt.Errorf("unable to encode createChatSubscriptionInviteLink#226b65: field subscription_pricing: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateChatSubscriptionInviteLinkRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createChatSubscriptionInviteLink#226b65 to nil") - } - if err := b.ConsumeID(CreateChatSubscriptionInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createChatSubscriptionInviteLink#226b65: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateChatSubscriptionInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createChatSubscriptionInviteLink#226b65 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createChatSubscriptionInviteLink#226b65: field chat_id: %w", err) - } - c.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createChatSubscriptionInviteLink#226b65: field name: %w", err) - } - c.Name = value - } - { - if err := c.SubscriptionPricing.Decode(b); err != nil { - return fmt.Errorf("unable to decode createChatSubscriptionInviteLink#226b65: field subscription_pricing: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateChatSubscriptionInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createChatSubscriptionInviteLink#226b65 as nil") - } - b.ObjStart() - b.PutID("createChatSubscriptionInviteLink") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.FieldStart("subscription_pricing") - if err := c.SubscriptionPricing.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createChatSubscriptionInviteLink#226b65: field subscription_pricing: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateChatSubscriptionInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createChatSubscriptionInviteLink#226b65 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createChatSubscriptionInviteLink"); err != nil { - return fmt.Errorf("unable to decode createChatSubscriptionInviteLink#226b65: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createChatSubscriptionInviteLink#226b65: field chat_id: %w", err) - } - c.ChatID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createChatSubscriptionInviteLink#226b65: field name: %w", err) - } - c.Name = value - case "subscription_pricing": - if err := c.SubscriptionPricing.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode createChatSubscriptionInviteLink#226b65: field subscription_pricing: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *CreateChatSubscriptionInviteLinkRequest) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetName returns value of Name field. -func (c *CreateChatSubscriptionInviteLinkRequest) GetName() (value string) { - if c == nil { - return - } - return c.Name -} - -// GetSubscriptionPricing returns value of SubscriptionPricing field. -func (c *CreateChatSubscriptionInviteLinkRequest) GetSubscriptionPricing() (value StarSubscriptionPricing) { - if c == nil { - return - } - return c.SubscriptionPricing -} - -// CreateChatSubscriptionInviteLink invokes method createChatSubscriptionInviteLink#226b65 returning error if any. -func (c *Client) CreateChatSubscriptionInviteLink(ctx context.Context, request *CreateChatSubscriptionInviteLinkRequest) (*ChatInviteLink, error) { - var result ChatInviteLink - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_forum_topic_gen.go b/tdapi/tl_create_forum_topic_gen.go deleted file mode 100644 index 19026fe6e..000000000 --- a/tdapi/tl_create_forum_topic_gen.go +++ /dev/null @@ -1,273 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateForumTopicRequest represents TL type `createForumTopic#c1fa28e4`. -type CreateForumTopicRequest struct { - // Identifier of the chat - ChatID int64 - // Name of the topic; 1-128 characters - Name string - // Icon of the topic. Icon color must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, - // 0xFF93B2, or 0xFB6F5F. Telegram Premium users can use any custom emoji as topic icon, - // other users can use only a custom emoji returned by getForumTopicDefaultIcons - Icon ForumTopicIcon -} - -// CreateForumTopicRequestTypeID is TL type id of CreateForumTopicRequest. -const CreateForumTopicRequestTypeID = 0xc1fa28e4 - -// Ensuring interfaces in compile-time for CreateForumTopicRequest. -var ( - _ bin.Encoder = &CreateForumTopicRequest{} - _ bin.Decoder = &CreateForumTopicRequest{} - _ bin.BareEncoder = &CreateForumTopicRequest{} - _ bin.BareDecoder = &CreateForumTopicRequest{} -) - -func (c *CreateForumTopicRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.Name == "") { - return false - } - if !(c.Icon.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateForumTopicRequest) String() string { - if c == nil { - return "CreateForumTopicRequest(nil)" - } - type Alias CreateForumTopicRequest - return fmt.Sprintf("CreateForumTopicRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateForumTopicRequest) TypeID() uint32 { - return CreateForumTopicRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateForumTopicRequest) TypeName() string { - return "createForumTopic" -} - -// TypeInfo returns info about TL type. -func (c *CreateForumTopicRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createForumTopic", - ID: CreateForumTopicRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Icon", - SchemaName: "icon", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateForumTopicRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createForumTopic#c1fa28e4 as nil") - } - b.PutID(CreateForumTopicRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateForumTopicRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createForumTopic#c1fa28e4 as nil") - } - b.PutInt53(c.ChatID) - b.PutString(c.Name) - if err := c.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode createForumTopic#c1fa28e4: field icon: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateForumTopicRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createForumTopic#c1fa28e4 to nil") - } - if err := b.ConsumeID(CreateForumTopicRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createForumTopic#c1fa28e4: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateForumTopicRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createForumTopic#c1fa28e4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createForumTopic#c1fa28e4: field chat_id: %w", err) - } - c.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createForumTopic#c1fa28e4: field name: %w", err) - } - c.Name = value - } - { - if err := c.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode createForumTopic#c1fa28e4: field icon: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateForumTopicRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createForumTopic#c1fa28e4 as nil") - } - b.ObjStart() - b.PutID("createForumTopic") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.FieldStart("icon") - if err := c.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createForumTopic#c1fa28e4: field icon: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateForumTopicRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createForumTopic#c1fa28e4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createForumTopic"); err != nil { - return fmt.Errorf("unable to decode createForumTopic#c1fa28e4: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createForumTopic#c1fa28e4: field chat_id: %w", err) - } - c.ChatID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createForumTopic#c1fa28e4: field name: %w", err) - } - c.Name = value - case "icon": - if err := c.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode createForumTopic#c1fa28e4: field icon: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *CreateForumTopicRequest) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetName returns value of Name field. -func (c *CreateForumTopicRequest) GetName() (value string) { - if c == nil { - return - } - return c.Name -} - -// GetIcon returns value of Icon field. -func (c *CreateForumTopicRequest) GetIcon() (value ForumTopicIcon) { - if c == nil { - return - } - return c.Icon -} - -// CreateForumTopic invokes method createForumTopic#c1fa28e4 returning error if any. -func (c *Client) CreateForumTopic(ctx context.Context, request *CreateForumTopicRequest) (*ForumTopicInfo, error) { - var result ForumTopicInfo - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_group_call_gen.go b/tdapi/tl_create_group_call_gen.go deleted file mode 100644 index 37df5067d..000000000 --- a/tdapi/tl_create_group_call_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateGroupCallRequest represents TL type `createGroupCall#87b855fb`. -type CreateGroupCallRequest struct { - // Call identifier - CallID int32 -} - -// CreateGroupCallRequestTypeID is TL type id of CreateGroupCallRequest. -const CreateGroupCallRequestTypeID = 0x87b855fb - -// Ensuring interfaces in compile-time for CreateGroupCallRequest. -var ( - _ bin.Encoder = &CreateGroupCallRequest{} - _ bin.Decoder = &CreateGroupCallRequest{} - _ bin.BareEncoder = &CreateGroupCallRequest{} - _ bin.BareDecoder = &CreateGroupCallRequest{} -) - -func (c *CreateGroupCallRequest) Zero() bool { - if c == nil { - return true - } - if !(c.CallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateGroupCallRequest) String() string { - if c == nil { - return "CreateGroupCallRequest(nil)" - } - type Alias CreateGroupCallRequest - return fmt.Sprintf("CreateGroupCallRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateGroupCallRequest) TypeID() uint32 { - return CreateGroupCallRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateGroupCallRequest) TypeName() string { - return "createGroupCall" -} - -// TypeInfo returns info about TL type. -func (c *CreateGroupCallRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createGroupCall", - ID: CreateGroupCallRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CallID", - SchemaName: "call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateGroupCallRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createGroupCall#87b855fb as nil") - } - b.PutID(CreateGroupCallRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateGroupCallRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createGroupCall#87b855fb as nil") - } - b.PutInt32(c.CallID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateGroupCallRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createGroupCall#87b855fb to nil") - } - if err := b.ConsumeID(CreateGroupCallRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createGroupCall#87b855fb: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateGroupCallRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createGroupCall#87b855fb to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createGroupCall#87b855fb: field call_id: %w", err) - } - c.CallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateGroupCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createGroupCall#87b855fb as nil") - } - b.ObjStart() - b.PutID("createGroupCall") - b.Comma() - b.FieldStart("call_id") - b.PutInt32(c.CallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateGroupCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createGroupCall#87b855fb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createGroupCall"); err != nil { - return fmt.Errorf("unable to decode createGroupCall#87b855fb: %w", err) - } - case "call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createGroupCall#87b855fb: field call_id: %w", err) - } - c.CallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCallID returns value of CallID field. -func (c *CreateGroupCallRequest) GetCallID() (value int32) { - if c == nil { - return - } - return c.CallID -} - -// CreateGroupCall invokes method createGroupCall#87b855fb returning error if any. -func (c *Client) CreateGroupCall(ctx context.Context, callid int32) error { - var ok Ok - - request := &CreateGroupCallRequest{ - CallID: callid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_create_invoice_link_gen.go b/tdapi/tl_create_invoice_link_gen.go deleted file mode 100644 index ae6fab4c4..000000000 --- a/tdapi/tl_create_invoice_link_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateInvoiceLinkRequest represents TL type `createInvoiceLink#cf70c867`. -type CreateInvoiceLinkRequest struct { - // Unique identifier of business connection on behalf of which to send the request - BusinessConnectionID string - // Information about the invoice of the type inputMessageInvoice - Invoice InputMessageContentClass -} - -// CreateInvoiceLinkRequestTypeID is TL type id of CreateInvoiceLinkRequest. -const CreateInvoiceLinkRequestTypeID = 0xcf70c867 - -// Ensuring interfaces in compile-time for CreateInvoiceLinkRequest. -var ( - _ bin.Encoder = &CreateInvoiceLinkRequest{} - _ bin.Decoder = &CreateInvoiceLinkRequest{} - _ bin.BareEncoder = &CreateInvoiceLinkRequest{} - _ bin.BareDecoder = &CreateInvoiceLinkRequest{} -) - -func (c *CreateInvoiceLinkRequest) Zero() bool { - if c == nil { - return true - } - if !(c.BusinessConnectionID == "") { - return false - } - if !(c.Invoice == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateInvoiceLinkRequest) String() string { - if c == nil { - return "CreateInvoiceLinkRequest(nil)" - } - type Alias CreateInvoiceLinkRequest - return fmt.Sprintf("CreateInvoiceLinkRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateInvoiceLinkRequest) TypeID() uint32 { - return CreateInvoiceLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateInvoiceLinkRequest) TypeName() string { - return "createInvoiceLink" -} - -// TypeInfo returns info about TL type. -func (c *CreateInvoiceLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createInvoiceLink", - ID: CreateInvoiceLinkRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BusinessConnectionID", - SchemaName: "business_connection_id", - }, - { - Name: "Invoice", - SchemaName: "invoice", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateInvoiceLinkRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createInvoiceLink#cf70c867 as nil") - } - b.PutID(CreateInvoiceLinkRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateInvoiceLinkRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createInvoiceLink#cf70c867 as nil") - } - b.PutString(c.BusinessConnectionID) - if c.Invoice == nil { - return fmt.Errorf("unable to encode createInvoiceLink#cf70c867: field invoice is nil") - } - if err := c.Invoice.Encode(b); err != nil { - return fmt.Errorf("unable to encode createInvoiceLink#cf70c867: field invoice: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateInvoiceLinkRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createInvoiceLink#cf70c867 to nil") - } - if err := b.ConsumeID(CreateInvoiceLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createInvoiceLink#cf70c867: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateInvoiceLinkRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createInvoiceLink#cf70c867 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createInvoiceLink#cf70c867: field business_connection_id: %w", err) - } - c.BusinessConnectionID = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode createInvoiceLink#cf70c867: field invoice: %w", err) - } - c.Invoice = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateInvoiceLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createInvoiceLink#cf70c867 as nil") - } - b.ObjStart() - b.PutID("createInvoiceLink") - b.Comma() - b.FieldStart("business_connection_id") - b.PutString(c.BusinessConnectionID) - b.Comma() - b.FieldStart("invoice") - if c.Invoice == nil { - return fmt.Errorf("unable to encode createInvoiceLink#cf70c867: field invoice is nil") - } - if err := c.Invoice.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createInvoiceLink#cf70c867: field invoice: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateInvoiceLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createInvoiceLink#cf70c867 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createInvoiceLink"); err != nil { - return fmt.Errorf("unable to decode createInvoiceLink#cf70c867: %w", err) - } - case "business_connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createInvoiceLink#cf70c867: field business_connection_id: %w", err) - } - c.BusinessConnectionID = value - case "invoice": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode createInvoiceLink#cf70c867: field invoice: %w", err) - } - c.Invoice = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessConnectionID returns value of BusinessConnectionID field. -func (c *CreateInvoiceLinkRequest) GetBusinessConnectionID() (value string) { - if c == nil { - return - } - return c.BusinessConnectionID -} - -// GetInvoice returns value of Invoice field. -func (c *CreateInvoiceLinkRequest) GetInvoice() (value InputMessageContentClass) { - if c == nil { - return - } - return c.Invoice -} - -// CreateInvoiceLink invokes method createInvoiceLink#cf70c867 returning error if any. -func (c *Client) CreateInvoiceLink(ctx context.Context, request *CreateInvoiceLinkRequest) (*HTTPURL, error) { - var result HTTPURL - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_new_basic_group_chat_gen.go b/tdapi/tl_create_new_basic_group_chat_gen.go deleted file mode 100644 index 00f53f8ed..000000000 --- a/tdapi/tl_create_new_basic_group_chat_gen.go +++ /dev/null @@ -1,297 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateNewBasicGroupChatRequest represents TL type `createNewBasicGroupChat#8b9517af`. -type CreateNewBasicGroupChatRequest struct { - // Identifiers of users to be added to the basic group; may be empty to create a basic - // group without other members - UserIDs []int64 - // Title of the new basic group; 1-128 characters - Title string - // Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be - // divisible by 86400. If 0, then messages aren't deleted automatically - MessageAutoDeleteTime int32 -} - -// CreateNewBasicGroupChatRequestTypeID is TL type id of CreateNewBasicGroupChatRequest. -const CreateNewBasicGroupChatRequestTypeID = 0x8b9517af - -// Ensuring interfaces in compile-time for CreateNewBasicGroupChatRequest. -var ( - _ bin.Encoder = &CreateNewBasicGroupChatRequest{} - _ bin.Decoder = &CreateNewBasicGroupChatRequest{} - _ bin.BareEncoder = &CreateNewBasicGroupChatRequest{} - _ bin.BareDecoder = &CreateNewBasicGroupChatRequest{} -) - -func (c *CreateNewBasicGroupChatRequest) Zero() bool { - if c == nil { - return true - } - if !(c.UserIDs == nil) { - return false - } - if !(c.Title == "") { - return false - } - if !(c.MessageAutoDeleteTime == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateNewBasicGroupChatRequest) String() string { - if c == nil { - return "CreateNewBasicGroupChatRequest(nil)" - } - type Alias CreateNewBasicGroupChatRequest - return fmt.Sprintf("CreateNewBasicGroupChatRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateNewBasicGroupChatRequest) TypeID() uint32 { - return CreateNewBasicGroupChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateNewBasicGroupChatRequest) TypeName() string { - return "createNewBasicGroupChat" -} - -// TypeInfo returns info about TL type. -func (c *CreateNewBasicGroupChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createNewBasicGroupChat", - ID: CreateNewBasicGroupChatRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "MessageAutoDeleteTime", - SchemaName: "message_auto_delete_time", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateNewBasicGroupChatRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createNewBasicGroupChat#8b9517af as nil") - } - b.PutID(CreateNewBasicGroupChatRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateNewBasicGroupChatRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createNewBasicGroupChat#8b9517af as nil") - } - b.PutInt(len(c.UserIDs)) - for _, v := range c.UserIDs { - b.PutInt53(v) - } - b.PutString(c.Title) - b.PutInt32(c.MessageAutoDeleteTime) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateNewBasicGroupChatRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createNewBasicGroupChat#8b9517af to nil") - } - if err := b.ConsumeID(CreateNewBasicGroupChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#8b9517af: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateNewBasicGroupChatRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createNewBasicGroupChat#8b9517af to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#8b9517af: field user_ids: %w", err) - } - - if headerLen > 0 { - c.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#8b9517af: field user_ids: %w", err) - } - c.UserIDs = append(c.UserIDs, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#8b9517af: field title: %w", err) - } - c.Title = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#8b9517af: field message_auto_delete_time: %w", err) - } - c.MessageAutoDeleteTime = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateNewBasicGroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createNewBasicGroupChat#8b9517af as nil") - } - b.ObjStart() - b.PutID("createNewBasicGroupChat") - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range c.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("title") - b.PutString(c.Title) - b.Comma() - b.FieldStart("message_auto_delete_time") - b.PutInt32(c.MessageAutoDeleteTime) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateNewBasicGroupChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createNewBasicGroupChat#8b9517af to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createNewBasicGroupChat"); err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#8b9517af: %w", err) - } - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#8b9517af: field user_ids: %w", err) - } - c.UserIDs = append(c.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#8b9517af: field user_ids: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#8b9517af: field title: %w", err) - } - c.Title = value - case "message_auto_delete_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createNewBasicGroupChat#8b9517af: field message_auto_delete_time: %w", err) - } - c.MessageAutoDeleteTime = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserIDs returns value of UserIDs field. -func (c *CreateNewBasicGroupChatRequest) GetUserIDs() (value []int64) { - if c == nil { - return - } - return c.UserIDs -} - -// GetTitle returns value of Title field. -func (c *CreateNewBasicGroupChatRequest) GetTitle() (value string) { - if c == nil { - return - } - return c.Title -} - -// GetMessageAutoDeleteTime returns value of MessageAutoDeleteTime field. -func (c *CreateNewBasicGroupChatRequest) GetMessageAutoDeleteTime() (value int32) { - if c == nil { - return - } - return c.MessageAutoDeleteTime -} - -// CreateNewBasicGroupChat invokes method createNewBasicGroupChat#8b9517af returning error if any. -func (c *Client) CreateNewBasicGroupChat(ctx context.Context, request *CreateNewBasicGroupChatRequest) (*CreatedBasicGroupChat, error) { - var result CreatedBasicGroupChat - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_new_secret_chat_gen.go b/tdapi/tl_create_new_secret_chat_gen.go deleted file mode 100644 index 20288eb2e..000000000 --- a/tdapi/tl_create_new_secret_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateNewSecretChatRequest represents TL type `createNewSecretChat#db012265`. -type CreateNewSecretChatRequest struct { - // Identifier of the target user - UserID int64 -} - -// CreateNewSecretChatRequestTypeID is TL type id of CreateNewSecretChatRequest. -const CreateNewSecretChatRequestTypeID = 0xdb012265 - -// Ensuring interfaces in compile-time for CreateNewSecretChatRequest. -var ( - _ bin.Encoder = &CreateNewSecretChatRequest{} - _ bin.Decoder = &CreateNewSecretChatRequest{} - _ bin.BareEncoder = &CreateNewSecretChatRequest{} - _ bin.BareDecoder = &CreateNewSecretChatRequest{} -) - -func (c *CreateNewSecretChatRequest) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateNewSecretChatRequest) String() string { - if c == nil { - return "CreateNewSecretChatRequest(nil)" - } - type Alias CreateNewSecretChatRequest - return fmt.Sprintf("CreateNewSecretChatRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateNewSecretChatRequest) TypeID() uint32 { - return CreateNewSecretChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateNewSecretChatRequest) TypeName() string { - return "createNewSecretChat" -} - -// TypeInfo returns info about TL type. -func (c *CreateNewSecretChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createNewSecretChat", - ID: CreateNewSecretChatRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateNewSecretChatRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createNewSecretChat#db012265 as nil") - } - b.PutID(CreateNewSecretChatRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateNewSecretChatRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createNewSecretChat#db012265 as nil") - } - b.PutInt53(c.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateNewSecretChatRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createNewSecretChat#db012265 to nil") - } - if err := b.ConsumeID(CreateNewSecretChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createNewSecretChat#db012265: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateNewSecretChatRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createNewSecretChat#db012265 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createNewSecretChat#db012265: field user_id: %w", err) - } - c.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateNewSecretChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createNewSecretChat#db012265 as nil") - } - b.ObjStart() - b.PutID("createNewSecretChat") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateNewSecretChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createNewSecretChat#db012265 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createNewSecretChat"); err != nil { - return fmt.Errorf("unable to decode createNewSecretChat#db012265: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createNewSecretChat#db012265: field user_id: %w", err) - } - c.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *CreateNewSecretChatRequest) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// CreateNewSecretChat invokes method createNewSecretChat#db012265 returning error if any. -func (c *Client) CreateNewSecretChat(ctx context.Context, userid int64) (*Chat, error) { - var result Chat - - request := &CreateNewSecretChatRequest{ - UserID: userid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_new_sticker_set_gen.go b/tdapi/tl_create_new_sticker_set_gen.go deleted file mode 100644 index ff5551574..000000000 --- a/tdapi/tl_create_new_sticker_set_gen.go +++ /dev/null @@ -1,450 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateNewStickerSetRequest represents TL type `createNewStickerSet#87fd8611`. -type CreateNewStickerSetRequest struct { - // Sticker set owner; ignored for regular users - UserID int64 - // Sticker set title; 1-64 characters - Title string - // Sticker set name. Can contain only English letters, digits and underscores. Must end - // with *"_by_"* (** is case insensitive) for bots; 0-64 - // characters. - Name string - // Type of the stickers in the set - StickerType StickerTypeClass - // Pass true if stickers in the sticker set must be repainted; for custom emoji sticker - // sets only - NeedsRepainting bool - // List of stickers to be added to the set; 1-200 stickers for custom emoji sticker sets, - // and 1-120 stickers otherwise. For TGS stickers, uploadStickerFile must be used before - // the sticker is shown - Stickers []InputSticker - // Source of the sticker set; may be empty if unknown - Source string -} - -// CreateNewStickerSetRequestTypeID is TL type id of CreateNewStickerSetRequest. -const CreateNewStickerSetRequestTypeID = 0x87fd8611 - -// Ensuring interfaces in compile-time for CreateNewStickerSetRequest. -var ( - _ bin.Encoder = &CreateNewStickerSetRequest{} - _ bin.Decoder = &CreateNewStickerSetRequest{} - _ bin.BareEncoder = &CreateNewStickerSetRequest{} - _ bin.BareDecoder = &CreateNewStickerSetRequest{} -) - -func (c *CreateNewStickerSetRequest) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.Title == "") { - return false - } - if !(c.Name == "") { - return false - } - if !(c.StickerType == nil) { - return false - } - if !(c.NeedsRepainting == false) { - return false - } - if !(c.Stickers == nil) { - return false - } - if !(c.Source == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateNewStickerSetRequest) String() string { - if c == nil { - return "CreateNewStickerSetRequest(nil)" - } - type Alias CreateNewStickerSetRequest - return fmt.Sprintf("CreateNewStickerSetRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateNewStickerSetRequest) TypeID() uint32 { - return CreateNewStickerSetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateNewStickerSetRequest) TypeName() string { - return "createNewStickerSet" -} - -// TypeInfo returns info about TL type. -func (c *CreateNewStickerSetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createNewStickerSet", - ID: CreateNewStickerSetRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "NeedsRepainting", - SchemaName: "needs_repainting", - }, - { - Name: "Stickers", - SchemaName: "stickers", - }, - { - Name: "Source", - SchemaName: "source", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateNewStickerSetRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createNewStickerSet#87fd8611 as nil") - } - b.PutID(CreateNewStickerSetRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateNewStickerSetRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createNewStickerSet#87fd8611 as nil") - } - b.PutInt53(c.UserID) - b.PutString(c.Title) - b.PutString(c.Name) - if c.StickerType == nil { - return fmt.Errorf("unable to encode createNewStickerSet#87fd8611: field sticker_type is nil") - } - if err := c.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode createNewStickerSet#87fd8611: field sticker_type: %w", err) - } - b.PutBool(c.NeedsRepainting) - b.PutInt(len(c.Stickers)) - for idx, v := range c.Stickers { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare createNewStickerSet#87fd8611: field stickers element with index %d: %w", idx, err) - } - } - b.PutString(c.Source) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateNewStickerSetRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createNewStickerSet#87fd8611 to nil") - } - if err := b.ConsumeID(CreateNewStickerSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateNewStickerSetRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createNewStickerSet#87fd8611 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field title: %w", err) - } - c.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field name: %w", err) - } - c.Name = value - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field sticker_type: %w", err) - } - c.StickerType = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field needs_repainting: %w", err) - } - c.NeedsRepainting = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field stickers: %w", err) - } - - if headerLen > 0 { - c.Stickers = make([]InputSticker, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value InputSticker - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare createNewStickerSet#87fd8611: field stickers: %w", err) - } - c.Stickers = append(c.Stickers, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field source: %w", err) - } - c.Source = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateNewStickerSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createNewStickerSet#87fd8611 as nil") - } - b.ObjStart() - b.PutID("createNewStickerSet") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("title") - b.PutString(c.Title) - b.Comma() - b.FieldStart("name") - b.PutString(c.Name) - b.Comma() - b.FieldStart("sticker_type") - if c.StickerType == nil { - return fmt.Errorf("unable to encode createNewStickerSet#87fd8611: field sticker_type is nil") - } - if err := c.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createNewStickerSet#87fd8611: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("needs_repainting") - b.PutBool(c.NeedsRepainting) - b.Comma() - b.FieldStart("stickers") - b.ArrStart() - for idx, v := range c.Stickers { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createNewStickerSet#87fd8611: field stickers element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("source") - b.PutString(c.Source) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateNewStickerSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createNewStickerSet#87fd8611 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createNewStickerSet"); err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field user_id: %w", err) - } - c.UserID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field title: %w", err) - } - c.Title = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field name: %w", err) - } - c.Name = value - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field sticker_type: %w", err) - } - c.StickerType = value - case "needs_repainting": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field needs_repainting: %w", err) - } - c.NeedsRepainting = value - case "stickers": - if err := b.Arr(func(b tdjson.Decoder) error { - var value InputSticker - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field stickers: %w", err) - } - c.Stickers = append(c.Stickers, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field stickers: %w", err) - } - case "source": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewStickerSet#87fd8611: field source: %w", err) - } - c.Source = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *CreateNewStickerSetRequest) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetTitle returns value of Title field. -func (c *CreateNewStickerSetRequest) GetTitle() (value string) { - if c == nil { - return - } - return c.Title -} - -// GetName returns value of Name field. -func (c *CreateNewStickerSetRequest) GetName() (value string) { - if c == nil { - return - } - return c.Name -} - -// GetStickerType returns value of StickerType field. -func (c *CreateNewStickerSetRequest) GetStickerType() (value StickerTypeClass) { - if c == nil { - return - } - return c.StickerType -} - -// GetNeedsRepainting returns value of NeedsRepainting field. -func (c *CreateNewStickerSetRequest) GetNeedsRepainting() (value bool) { - if c == nil { - return - } - return c.NeedsRepainting -} - -// GetStickers returns value of Stickers field. -func (c *CreateNewStickerSetRequest) GetStickers() (value []InputSticker) { - if c == nil { - return - } - return c.Stickers -} - -// GetSource returns value of Source field. -func (c *CreateNewStickerSetRequest) GetSource() (value string) { - if c == nil { - return - } - return c.Source -} - -// CreateNewStickerSet invokes method createNewStickerSet#87fd8611 returning error if any. -func (c *Client) CreateNewStickerSet(ctx context.Context, request *CreateNewStickerSetRequest) (*StickerSet, error) { - var result StickerSet - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_new_supergroup_chat_gen.go b/tdapi/tl_create_new_supergroup_chat_gen.go deleted file mode 100644 index 274d45862..000000000 --- a/tdapi/tl_create_new_supergroup_chat_gen.go +++ /dev/null @@ -1,410 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateNewSupergroupChatRequest represents TL type `createNewSupergroupChat#2fecf6c6`. -type CreateNewSupergroupChatRequest struct { - // Title of the new chat; 1-128 characters - Title string - // Pass true to create a forum supergroup chat - IsForum bool - // Pass true to create a channel chat; ignored if a forum is created - IsChannel bool - // Creates a new supergroup or channel and sends a corresponding - // messageSupergroupChatCreate. Returns the newly created chat - Description string - // Chat location if a location-based supergroup is being created; pass null to create an - // ordinary supergroup chat - Location ChatLocation - // Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be - // divisible by 86400. If 0, then messages aren't deleted automatically - MessageAutoDeleteTime int32 - // Pass true to create a supergroup for importing messages using importMessages - ForImport bool -} - -// CreateNewSupergroupChatRequestTypeID is TL type id of CreateNewSupergroupChatRequest. -const CreateNewSupergroupChatRequestTypeID = 0x2fecf6c6 - -// Ensuring interfaces in compile-time for CreateNewSupergroupChatRequest. -var ( - _ bin.Encoder = &CreateNewSupergroupChatRequest{} - _ bin.Decoder = &CreateNewSupergroupChatRequest{} - _ bin.BareEncoder = &CreateNewSupergroupChatRequest{} - _ bin.BareDecoder = &CreateNewSupergroupChatRequest{} -) - -func (c *CreateNewSupergroupChatRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Title == "") { - return false - } - if !(c.IsForum == false) { - return false - } - if !(c.IsChannel == false) { - return false - } - if !(c.Description == "") { - return false - } - if !(c.Location.Zero()) { - return false - } - if !(c.MessageAutoDeleteTime == 0) { - return false - } - if !(c.ForImport == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateNewSupergroupChatRequest) String() string { - if c == nil { - return "CreateNewSupergroupChatRequest(nil)" - } - type Alias CreateNewSupergroupChatRequest - return fmt.Sprintf("CreateNewSupergroupChatRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateNewSupergroupChatRequest) TypeID() uint32 { - return CreateNewSupergroupChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateNewSupergroupChatRequest) TypeName() string { - return "createNewSupergroupChat" -} - -// TypeInfo returns info about TL type. -func (c *CreateNewSupergroupChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createNewSupergroupChat", - ID: CreateNewSupergroupChatRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "IsForum", - SchemaName: "is_forum", - }, - { - Name: "IsChannel", - SchemaName: "is_channel", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "MessageAutoDeleteTime", - SchemaName: "message_auto_delete_time", - }, - { - Name: "ForImport", - SchemaName: "for_import", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateNewSupergroupChatRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createNewSupergroupChat#2fecf6c6 as nil") - } - b.PutID(CreateNewSupergroupChatRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateNewSupergroupChatRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createNewSupergroupChat#2fecf6c6 as nil") - } - b.PutString(c.Title) - b.PutBool(c.IsForum) - b.PutBool(c.IsChannel) - b.PutString(c.Description) - if err := c.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode createNewSupergroupChat#2fecf6c6: field location: %w", err) - } - b.PutInt32(c.MessageAutoDeleteTime) - b.PutBool(c.ForImport) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateNewSupergroupChatRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createNewSupergroupChat#2fecf6c6 to nil") - } - if err := b.ConsumeID(CreateNewSupergroupChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateNewSupergroupChatRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createNewSupergroupChat#2fecf6c6 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field title: %w", err) - } - c.Title = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field is_forum: %w", err) - } - c.IsForum = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field is_channel: %w", err) - } - c.IsChannel = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field description: %w", err) - } - c.Description = value - } - { - if err := c.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field location: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field message_auto_delete_time: %w", err) - } - c.MessageAutoDeleteTime = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field for_import: %w", err) - } - c.ForImport = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateNewSupergroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createNewSupergroupChat#2fecf6c6 as nil") - } - b.ObjStart() - b.PutID("createNewSupergroupChat") - b.Comma() - b.FieldStart("title") - b.PutString(c.Title) - b.Comma() - b.FieldStart("is_forum") - b.PutBool(c.IsForum) - b.Comma() - b.FieldStart("is_channel") - b.PutBool(c.IsChannel) - b.Comma() - b.FieldStart("description") - b.PutString(c.Description) - b.Comma() - b.FieldStart("location") - if err := c.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createNewSupergroupChat#2fecf6c6: field location: %w", err) - } - b.Comma() - b.FieldStart("message_auto_delete_time") - b.PutInt32(c.MessageAutoDeleteTime) - b.Comma() - b.FieldStart("for_import") - b.PutBool(c.ForImport) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateNewSupergroupChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createNewSupergroupChat#2fecf6c6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createNewSupergroupChat"); err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field title: %w", err) - } - c.Title = value - case "is_forum": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field is_forum: %w", err) - } - c.IsForum = value - case "is_channel": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field is_channel: %w", err) - } - c.IsChannel = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field description: %w", err) - } - c.Description = value - case "location": - if err := c.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field location: %w", err) - } - case "message_auto_delete_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field message_auto_delete_time: %w", err) - } - c.MessageAutoDeleteTime = value - case "for_import": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createNewSupergroupChat#2fecf6c6: field for_import: %w", err) - } - c.ForImport = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (c *CreateNewSupergroupChatRequest) GetTitle() (value string) { - if c == nil { - return - } - return c.Title -} - -// GetIsForum returns value of IsForum field. -func (c *CreateNewSupergroupChatRequest) GetIsForum() (value bool) { - if c == nil { - return - } - return c.IsForum -} - -// GetIsChannel returns value of IsChannel field. -func (c *CreateNewSupergroupChatRequest) GetIsChannel() (value bool) { - if c == nil { - return - } - return c.IsChannel -} - -// GetDescription returns value of Description field. -func (c *CreateNewSupergroupChatRequest) GetDescription() (value string) { - if c == nil { - return - } - return c.Description -} - -// GetLocation returns value of Location field. -func (c *CreateNewSupergroupChatRequest) GetLocation() (value ChatLocation) { - if c == nil { - return - } - return c.Location -} - -// GetMessageAutoDeleteTime returns value of MessageAutoDeleteTime field. -func (c *CreateNewSupergroupChatRequest) GetMessageAutoDeleteTime() (value int32) { - if c == nil { - return - } - return c.MessageAutoDeleteTime -} - -// GetForImport returns value of ForImport field. -func (c *CreateNewSupergroupChatRequest) GetForImport() (value bool) { - if c == nil { - return - } - return c.ForImport -} - -// CreateNewSupergroupChat invokes method createNewSupergroupChat#2fecf6c6 returning error if any. -func (c *Client) CreateNewSupergroupChat(ctx context.Context, request *CreateNewSupergroupChatRequest) (*Chat, error) { - var result Chat - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_private_chat_gen.go b/tdapi/tl_create_private_chat_gen.go deleted file mode 100644 index 7d1934e80..000000000 --- a/tdapi/tl_create_private_chat_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreatePrivateChatRequest represents TL type `createPrivateChat#c7825b09`. -type CreatePrivateChatRequest struct { - // User identifier - UserID int64 - // Pass true to create the chat without a network request. In this case all information - // about the chat except its type, title and photo can be incorrect - Force bool -} - -// CreatePrivateChatRequestTypeID is TL type id of CreatePrivateChatRequest. -const CreatePrivateChatRequestTypeID = 0xc7825b09 - -// Ensuring interfaces in compile-time for CreatePrivateChatRequest. -var ( - _ bin.Encoder = &CreatePrivateChatRequest{} - _ bin.Decoder = &CreatePrivateChatRequest{} - _ bin.BareEncoder = &CreatePrivateChatRequest{} - _ bin.BareDecoder = &CreatePrivateChatRequest{} -) - -func (c *CreatePrivateChatRequest) Zero() bool { - if c == nil { - return true - } - if !(c.UserID == 0) { - return false - } - if !(c.Force == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreatePrivateChatRequest) String() string { - if c == nil { - return "CreatePrivateChatRequest(nil)" - } - type Alias CreatePrivateChatRequest - return fmt.Sprintf("CreatePrivateChatRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreatePrivateChatRequest) TypeID() uint32 { - return CreatePrivateChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreatePrivateChatRequest) TypeName() string { - return "createPrivateChat" -} - -// TypeInfo returns info about TL type. -func (c *CreatePrivateChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createPrivateChat", - ID: CreatePrivateChatRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Force", - SchemaName: "force", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreatePrivateChatRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createPrivateChat#c7825b09 as nil") - } - b.PutID(CreatePrivateChatRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreatePrivateChatRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createPrivateChat#c7825b09 as nil") - } - b.PutInt53(c.UserID) - b.PutBool(c.Force) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreatePrivateChatRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createPrivateChat#c7825b09 to nil") - } - if err := b.ConsumeID(CreatePrivateChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createPrivateChat#c7825b09: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreatePrivateChatRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createPrivateChat#c7825b09 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createPrivateChat#c7825b09: field user_id: %w", err) - } - c.UserID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createPrivateChat#c7825b09: field force: %w", err) - } - c.Force = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreatePrivateChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createPrivateChat#c7825b09 as nil") - } - b.ObjStart() - b.PutID("createPrivateChat") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(c.UserID) - b.Comma() - b.FieldStart("force") - b.PutBool(c.Force) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreatePrivateChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createPrivateChat#c7825b09 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createPrivateChat"); err != nil { - return fmt.Errorf("unable to decode createPrivateChat#c7825b09: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createPrivateChat#c7825b09: field user_id: %w", err) - } - c.UserID = value - case "force": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createPrivateChat#c7825b09: field force: %w", err) - } - c.Force = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (c *CreatePrivateChatRequest) GetUserID() (value int64) { - if c == nil { - return - } - return c.UserID -} - -// GetForce returns value of Force field. -func (c *CreatePrivateChatRequest) GetForce() (value bool) { - if c == nil { - return - } - return c.Force -} - -// CreatePrivateChat invokes method createPrivateChat#c7825b09 returning error if any. -func (c *Client) CreatePrivateChat(ctx context.Context, request *CreatePrivateChatRequest) (*Chat, error) { - var result Chat - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_secret_chat_gen.go b/tdapi/tl_create_secret_chat_gen.go deleted file mode 100644 index 5b0ec6180..000000000 --- a/tdapi/tl_create_secret_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateSecretChatRequest represents TL type `createSecretChat#730dd22f`. -type CreateSecretChatRequest struct { - // Secret chat identifier - SecretChatID int32 -} - -// CreateSecretChatRequestTypeID is TL type id of CreateSecretChatRequest. -const CreateSecretChatRequestTypeID = 0x730dd22f - -// Ensuring interfaces in compile-time for CreateSecretChatRequest. -var ( - _ bin.Encoder = &CreateSecretChatRequest{} - _ bin.Decoder = &CreateSecretChatRequest{} - _ bin.BareEncoder = &CreateSecretChatRequest{} - _ bin.BareDecoder = &CreateSecretChatRequest{} -) - -func (c *CreateSecretChatRequest) Zero() bool { - if c == nil { - return true - } - if !(c.SecretChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateSecretChatRequest) String() string { - if c == nil { - return "CreateSecretChatRequest(nil)" - } - type Alias CreateSecretChatRequest - return fmt.Sprintf("CreateSecretChatRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateSecretChatRequest) TypeID() uint32 { - return CreateSecretChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateSecretChatRequest) TypeName() string { - return "createSecretChat" -} - -// TypeInfo returns info about TL type. -func (c *CreateSecretChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createSecretChat", - ID: CreateSecretChatRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SecretChatID", - SchemaName: "secret_chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateSecretChatRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createSecretChat#730dd22f as nil") - } - b.PutID(CreateSecretChatRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateSecretChatRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createSecretChat#730dd22f as nil") - } - b.PutInt32(c.SecretChatID) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateSecretChatRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createSecretChat#730dd22f to nil") - } - if err := b.ConsumeID(CreateSecretChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createSecretChat#730dd22f: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateSecretChatRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createSecretChat#730dd22f to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createSecretChat#730dd22f: field secret_chat_id: %w", err) - } - c.SecretChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateSecretChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createSecretChat#730dd22f as nil") - } - b.ObjStart() - b.PutID("createSecretChat") - b.Comma() - b.FieldStart("secret_chat_id") - b.PutInt32(c.SecretChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateSecretChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createSecretChat#730dd22f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createSecretChat"); err != nil { - return fmt.Errorf("unable to decode createSecretChat#730dd22f: %w", err) - } - case "secret_chat_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createSecretChat#730dd22f: field secret_chat_id: %w", err) - } - c.SecretChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSecretChatID returns value of SecretChatID field. -func (c *CreateSecretChatRequest) GetSecretChatID() (value int32) { - if c == nil { - return - } - return c.SecretChatID -} - -// CreateSecretChat invokes method createSecretChat#730dd22f returning error if any. -func (c *Client) CreateSecretChat(ctx context.Context, secretchatid int32) (*Chat, error) { - var result Chat - - request := &CreateSecretChatRequest{ - SecretChatID: secretchatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_supergroup_chat_gen.go b/tdapi/tl_create_supergroup_chat_gen.go deleted file mode 100644 index 2971541ba..000000000 --- a/tdapi/tl_create_supergroup_chat_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateSupergroupChatRequest represents TL type `createSupergroupChat#46c770eb`. -type CreateSupergroupChatRequest struct { - // Supergroup or channel identifier - SupergroupID int64 - // Pass true to create the chat without a network request. In this case all information - // about the chat except its type, title and photo can be incorrect - Force bool -} - -// CreateSupergroupChatRequestTypeID is TL type id of CreateSupergroupChatRequest. -const CreateSupergroupChatRequestTypeID = 0x46c770eb - -// Ensuring interfaces in compile-time for CreateSupergroupChatRequest. -var ( - _ bin.Encoder = &CreateSupergroupChatRequest{} - _ bin.Decoder = &CreateSupergroupChatRequest{} - _ bin.BareEncoder = &CreateSupergroupChatRequest{} - _ bin.BareDecoder = &CreateSupergroupChatRequest{} -) - -func (c *CreateSupergroupChatRequest) Zero() bool { - if c == nil { - return true - } - if !(c.SupergroupID == 0) { - return false - } - if !(c.Force == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateSupergroupChatRequest) String() string { - if c == nil { - return "CreateSupergroupChatRequest(nil)" - } - type Alias CreateSupergroupChatRequest - return fmt.Sprintf("CreateSupergroupChatRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateSupergroupChatRequest) TypeID() uint32 { - return CreateSupergroupChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateSupergroupChatRequest) TypeName() string { - return "createSupergroupChat" -} - -// TypeInfo returns info about TL type. -func (c *CreateSupergroupChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createSupergroupChat", - ID: CreateSupergroupChatRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "Force", - SchemaName: "force", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateSupergroupChatRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createSupergroupChat#46c770eb as nil") - } - b.PutID(CreateSupergroupChatRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateSupergroupChatRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createSupergroupChat#46c770eb as nil") - } - b.PutInt53(c.SupergroupID) - b.PutBool(c.Force) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateSupergroupChatRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createSupergroupChat#46c770eb to nil") - } - if err := b.ConsumeID(CreateSupergroupChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createSupergroupChat#46c770eb: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateSupergroupChatRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createSupergroupChat#46c770eb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createSupergroupChat#46c770eb: field supergroup_id: %w", err) - } - c.SupergroupID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createSupergroupChat#46c770eb: field force: %w", err) - } - c.Force = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateSupergroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createSupergroupChat#46c770eb as nil") - } - b.ObjStart() - b.PutID("createSupergroupChat") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(c.SupergroupID) - b.Comma() - b.FieldStart("force") - b.PutBool(c.Force) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateSupergroupChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createSupergroupChat#46c770eb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createSupergroupChat"); err != nil { - return fmt.Errorf("unable to decode createSupergroupChat#46c770eb: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createSupergroupChat#46c770eb: field supergroup_id: %w", err) - } - c.SupergroupID = value - case "force": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createSupergroupChat#46c770eb: field force: %w", err) - } - c.Force = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (c *CreateSupergroupChatRequest) GetSupergroupID() (value int64) { - if c == nil { - return - } - return c.SupergroupID -} - -// GetForce returns value of Force field. -func (c *CreateSupergroupChatRequest) GetForce() (value bool) { - if c == nil { - return - } - return c.Force -} - -// CreateSupergroupChat invokes method createSupergroupChat#46c770eb returning error if any. -func (c *Client) CreateSupergroupChat(ctx context.Context, request *CreateSupergroupChatRequest) (*Chat, error) { - var result Chat - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_temporary_password_gen.go b/tdapi/tl_create_temporary_password_gen.go deleted file mode 100644 index 98bd0e6af..000000000 --- a/tdapi/tl_create_temporary_password_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateTemporaryPasswordRequest represents TL type `createTemporaryPassword#9f0d6f86`. -type CreateTemporaryPasswordRequest struct { - // The 2-step verification password of the current user - Password string - // Time during which the temporary password will be valid, in seconds; must be between 60 - // and 86400 - ValidFor int32 -} - -// CreateTemporaryPasswordRequestTypeID is TL type id of CreateTemporaryPasswordRequest. -const CreateTemporaryPasswordRequestTypeID = 0x9f0d6f86 - -// Ensuring interfaces in compile-time for CreateTemporaryPasswordRequest. -var ( - _ bin.Encoder = &CreateTemporaryPasswordRequest{} - _ bin.Decoder = &CreateTemporaryPasswordRequest{} - _ bin.BareEncoder = &CreateTemporaryPasswordRequest{} - _ bin.BareDecoder = &CreateTemporaryPasswordRequest{} -) - -func (c *CreateTemporaryPasswordRequest) Zero() bool { - if c == nil { - return true - } - if !(c.Password == "") { - return false - } - if !(c.ValidFor == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateTemporaryPasswordRequest) String() string { - if c == nil { - return "CreateTemporaryPasswordRequest(nil)" - } - type Alias CreateTemporaryPasswordRequest - return fmt.Sprintf("CreateTemporaryPasswordRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateTemporaryPasswordRequest) TypeID() uint32 { - return CreateTemporaryPasswordRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateTemporaryPasswordRequest) TypeName() string { - return "createTemporaryPassword" -} - -// TypeInfo returns info about TL type. -func (c *CreateTemporaryPasswordRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createTemporaryPassword", - ID: CreateTemporaryPasswordRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Password", - SchemaName: "password", - }, - { - Name: "ValidFor", - SchemaName: "valid_for", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateTemporaryPasswordRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createTemporaryPassword#9f0d6f86 as nil") - } - b.PutID(CreateTemporaryPasswordRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateTemporaryPasswordRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createTemporaryPassword#9f0d6f86 as nil") - } - b.PutString(c.Password) - b.PutInt32(c.ValidFor) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateTemporaryPasswordRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createTemporaryPassword#9f0d6f86 to nil") - } - if err := b.ConsumeID(CreateTemporaryPasswordRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createTemporaryPassword#9f0d6f86: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateTemporaryPasswordRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createTemporaryPassword#9f0d6f86 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createTemporaryPassword#9f0d6f86: field password: %w", err) - } - c.Password = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createTemporaryPassword#9f0d6f86: field valid_for: %w", err) - } - c.ValidFor = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateTemporaryPasswordRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createTemporaryPassword#9f0d6f86 as nil") - } - b.ObjStart() - b.PutID("createTemporaryPassword") - b.Comma() - b.FieldStart("password") - b.PutString(c.Password) - b.Comma() - b.FieldStart("valid_for") - b.PutInt32(c.ValidFor) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateTemporaryPasswordRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createTemporaryPassword#9f0d6f86 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createTemporaryPassword"); err != nil { - return fmt.Errorf("unable to decode createTemporaryPassword#9f0d6f86: %w", err) - } - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createTemporaryPassword#9f0d6f86: field password: %w", err) - } - c.Password = value - case "valid_for": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createTemporaryPassword#9f0d6f86: field valid_for: %w", err) - } - c.ValidFor = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPassword returns value of Password field. -func (c *CreateTemporaryPasswordRequest) GetPassword() (value string) { - if c == nil { - return - } - return c.Password -} - -// GetValidFor returns value of ValidFor field. -func (c *CreateTemporaryPasswordRequest) GetValidFor() (value int32) { - if c == nil { - return - } - return c.ValidFor -} - -// CreateTemporaryPassword invokes method createTemporaryPassword#9f0d6f86 returning error if any. -func (c *Client) CreateTemporaryPassword(ctx context.Context, request *CreateTemporaryPasswordRequest) (*TemporaryPasswordState, error) { - var result TemporaryPasswordState - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_create_video_chat_gen.go b/tdapi/tl_create_video_chat_gen.go deleted file mode 100644 index 8c7dcd4da..000000000 --- a/tdapi/tl_create_video_chat_gen.go +++ /dev/null @@ -1,307 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreateVideoChatRequest represents TL type `createVideoChat#7ea4958d`. -type CreateVideoChatRequest struct { - // Identifier of a chat in which the video chat will be created - ChatID int64 - // Group call title; if empty, chat title will be used - Title string - // Point in time (Unix timestamp) when the group call is expected to be started by an - // administrator; 0 to start the video chat immediately. The date must be at least 10 - // seconds and at most 8 days in the future - StartDate int32 - // Pass true to create an RTMP stream instead of an ordinary video chat - IsRtmpStream bool -} - -// CreateVideoChatRequestTypeID is TL type id of CreateVideoChatRequest. -const CreateVideoChatRequestTypeID = 0x7ea4958d - -// Ensuring interfaces in compile-time for CreateVideoChatRequest. -var ( - _ bin.Encoder = &CreateVideoChatRequest{} - _ bin.Decoder = &CreateVideoChatRequest{} - _ bin.BareEncoder = &CreateVideoChatRequest{} - _ bin.BareDecoder = &CreateVideoChatRequest{} -) - -func (c *CreateVideoChatRequest) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.Title == "") { - return false - } - if !(c.StartDate == 0) { - return false - } - if !(c.IsRtmpStream == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreateVideoChatRequest) String() string { - if c == nil { - return "CreateVideoChatRequest(nil)" - } - type Alias CreateVideoChatRequest - return fmt.Sprintf("CreateVideoChatRequest%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreateVideoChatRequest) TypeID() uint32 { - return CreateVideoChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreateVideoChatRequest) TypeName() string { - return "createVideoChat" -} - -// TypeInfo returns info about TL type. -func (c *CreateVideoChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createVideoChat", - ID: CreateVideoChatRequestTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "StartDate", - SchemaName: "start_date", - }, - { - Name: "IsRtmpStream", - SchemaName: "is_rtmp_stream", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreateVideoChatRequest) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createVideoChat#7ea4958d as nil") - } - b.PutID(CreateVideoChatRequestTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreateVideoChatRequest) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createVideoChat#7ea4958d as nil") - } - b.PutInt53(c.ChatID) - b.PutString(c.Title) - b.PutInt32(c.StartDate) - b.PutBool(c.IsRtmpStream) - return nil -} - -// Decode implements bin.Decoder. -func (c *CreateVideoChatRequest) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createVideoChat#7ea4958d to nil") - } - if err := b.ConsumeID(CreateVideoChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode createVideoChat#7ea4958d: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreateVideoChatRequest) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createVideoChat#7ea4958d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field chat_id: %w", err) - } - c.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field title: %w", err) - } - c.Title = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field start_date: %w", err) - } - c.StartDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field is_rtmp_stream: %w", err) - } - c.IsRtmpStream = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreateVideoChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createVideoChat#7ea4958d as nil") - } - b.ObjStart() - b.PutID("createVideoChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("title") - b.PutString(c.Title) - b.Comma() - b.FieldStart("start_date") - b.PutInt32(c.StartDate) - b.Comma() - b.FieldStart("is_rtmp_stream") - b.PutBool(c.IsRtmpStream) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreateVideoChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createVideoChat#7ea4958d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createVideoChat"); err != nil { - return fmt.Errorf("unable to decode createVideoChat#7ea4958d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field chat_id: %w", err) - } - c.ChatID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field title: %w", err) - } - c.Title = value - case "start_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field start_date: %w", err) - } - c.StartDate = value - case "is_rtmp_stream": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode createVideoChat#7ea4958d: field is_rtmp_stream: %w", err) - } - c.IsRtmpStream = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *CreateVideoChatRequest) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetTitle returns value of Title field. -func (c *CreateVideoChatRequest) GetTitle() (value string) { - if c == nil { - return - } - return c.Title -} - -// GetStartDate returns value of StartDate field. -func (c *CreateVideoChatRequest) GetStartDate() (value int32) { - if c == nil { - return - } - return c.StartDate -} - -// GetIsRtmpStream returns value of IsRtmpStream field. -func (c *CreateVideoChatRequest) GetIsRtmpStream() (value bool) { - if c == nil { - return - } - return c.IsRtmpStream -} - -// CreateVideoChat invokes method createVideoChat#7ea4958d returning error if any. -func (c *Client) CreateVideoChat(ctx context.Context, request *CreateVideoChatRequest) (*GroupCallID, error) { - var result GroupCallID - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_created_basic_group_chat_gen.go b/tdapi/tl_created_basic_group_chat_gen.go deleted file mode 100644 index acce6d620..000000000 --- a/tdapi/tl_created_basic_group_chat_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CreatedBasicGroupChat represents TL type `createdBasicGroupChat#fec875d4`. -type CreatedBasicGroupChat struct { - // Chat identifier - ChatID int64 - // Information about failed to add members - FailedToAddMembers FailedToAddMembers -} - -// CreatedBasicGroupChatTypeID is TL type id of CreatedBasicGroupChat. -const CreatedBasicGroupChatTypeID = 0xfec875d4 - -// Ensuring interfaces in compile-time for CreatedBasicGroupChat. -var ( - _ bin.Encoder = &CreatedBasicGroupChat{} - _ bin.Decoder = &CreatedBasicGroupChat{} - _ bin.BareEncoder = &CreatedBasicGroupChat{} - _ bin.BareDecoder = &CreatedBasicGroupChat{} -) - -func (c *CreatedBasicGroupChat) Zero() bool { - if c == nil { - return true - } - if !(c.ChatID == 0) { - return false - } - if !(c.FailedToAddMembers.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CreatedBasicGroupChat) String() string { - if c == nil { - return "CreatedBasicGroupChat(nil)" - } - type Alias CreatedBasicGroupChat - return fmt.Sprintf("CreatedBasicGroupChat%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CreatedBasicGroupChat) TypeID() uint32 { - return CreatedBasicGroupChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*CreatedBasicGroupChat) TypeName() string { - return "createdBasicGroupChat" -} - -// TypeInfo returns info about TL type. -func (c *CreatedBasicGroupChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "createdBasicGroupChat", - ID: CreatedBasicGroupChatTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "FailedToAddMembers", - SchemaName: "failed_to_add_members", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CreatedBasicGroupChat) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createdBasicGroupChat#fec875d4 as nil") - } - b.PutID(CreatedBasicGroupChatTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CreatedBasicGroupChat) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode createdBasicGroupChat#fec875d4 as nil") - } - b.PutInt53(c.ChatID) - if err := c.FailedToAddMembers.Encode(b); err != nil { - return fmt.Errorf("unable to encode createdBasicGroupChat#fec875d4: field failed_to_add_members: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (c *CreatedBasicGroupChat) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createdBasicGroupChat#fec875d4 to nil") - } - if err := b.ConsumeID(CreatedBasicGroupChatTypeID); err != nil { - return fmt.Errorf("unable to decode createdBasicGroupChat#fec875d4: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CreatedBasicGroupChat) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode createdBasicGroupChat#fec875d4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createdBasicGroupChat#fec875d4: field chat_id: %w", err) - } - c.ChatID = value - } - { - if err := c.FailedToAddMembers.Decode(b); err != nil { - return fmt.Errorf("unable to decode createdBasicGroupChat#fec875d4: field failed_to_add_members: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CreatedBasicGroupChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode createdBasicGroupChat#fec875d4 as nil") - } - b.ObjStart() - b.PutID("createdBasicGroupChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(c.ChatID) - b.Comma() - b.FieldStart("failed_to_add_members") - if err := c.FailedToAddMembers.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode createdBasicGroupChat#fec875d4: field failed_to_add_members: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CreatedBasicGroupChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode createdBasicGroupChat#fec875d4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("createdBasicGroupChat"); err != nil { - return fmt.Errorf("unable to decode createdBasicGroupChat#fec875d4: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode createdBasicGroupChat#fec875d4: field chat_id: %w", err) - } - c.ChatID = value - case "failed_to_add_members": - if err := c.FailedToAddMembers.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode createdBasicGroupChat#fec875d4: field failed_to_add_members: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (c *CreatedBasicGroupChat) GetChatID() (value int64) { - if c == nil { - return - } - return c.ChatID -} - -// GetFailedToAddMembers returns value of FailedToAddMembers field. -func (c *CreatedBasicGroupChat) GetFailedToAddMembers() (value FailedToAddMembers) { - if c == nil { - return - } - return c.FailedToAddMembers -} diff --git a/tdapi/tl_current_weather_gen.go b/tdapi/tl_current_weather_gen.go deleted file mode 100644 index 78cfa1592..000000000 --- a/tdapi/tl_current_weather_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CurrentWeather represents TL type `currentWeather#eacea8c0`. -type CurrentWeather struct { - // Temperature, in degree Celsius - Temperature float64 - // Emoji representing the weather - Emoji string -} - -// CurrentWeatherTypeID is TL type id of CurrentWeather. -const CurrentWeatherTypeID = 0xeacea8c0 - -// Ensuring interfaces in compile-time for CurrentWeather. -var ( - _ bin.Encoder = &CurrentWeather{} - _ bin.Decoder = &CurrentWeather{} - _ bin.BareEncoder = &CurrentWeather{} - _ bin.BareDecoder = &CurrentWeather{} -) - -func (c *CurrentWeather) Zero() bool { - if c == nil { - return true - } - if !(c.Temperature == 0) { - return false - } - if !(c.Emoji == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CurrentWeather) String() string { - if c == nil { - return "CurrentWeather(nil)" - } - type Alias CurrentWeather - return fmt.Sprintf("CurrentWeather%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CurrentWeather) TypeID() uint32 { - return CurrentWeatherTypeID -} - -// TypeName returns name of type in TL schema. -func (*CurrentWeather) TypeName() string { - return "currentWeather" -} - -// TypeInfo returns info about TL type. -func (c *CurrentWeather) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "currentWeather", - ID: CurrentWeatherTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Temperature", - SchemaName: "temperature", - }, - { - Name: "Emoji", - SchemaName: "emoji", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CurrentWeather) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode currentWeather#eacea8c0 as nil") - } - b.PutID(CurrentWeatherTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CurrentWeather) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode currentWeather#eacea8c0 as nil") - } - b.PutDouble(c.Temperature) - b.PutString(c.Emoji) - return nil -} - -// Decode implements bin.Decoder. -func (c *CurrentWeather) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode currentWeather#eacea8c0 to nil") - } - if err := b.ConsumeID(CurrentWeatherTypeID); err != nil { - return fmt.Errorf("unable to decode currentWeather#eacea8c0: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CurrentWeather) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode currentWeather#eacea8c0 to nil") - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode currentWeather#eacea8c0: field temperature: %w", err) - } - c.Temperature = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode currentWeather#eacea8c0: field emoji: %w", err) - } - c.Emoji = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CurrentWeather) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode currentWeather#eacea8c0 as nil") - } - b.ObjStart() - b.PutID("currentWeather") - b.Comma() - b.FieldStart("temperature") - b.PutDouble(c.Temperature) - b.Comma() - b.FieldStart("emoji") - b.PutString(c.Emoji) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CurrentWeather) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode currentWeather#eacea8c0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("currentWeather"); err != nil { - return fmt.Errorf("unable to decode currentWeather#eacea8c0: %w", err) - } - case "temperature": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode currentWeather#eacea8c0: field temperature: %w", err) - } - c.Temperature = value - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode currentWeather#eacea8c0: field emoji: %w", err) - } - c.Emoji = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTemperature returns value of Temperature field. -func (c *CurrentWeather) GetTemperature() (value float64) { - if c == nil { - return - } - return c.Temperature -} - -// GetEmoji returns value of Emoji field. -func (c *CurrentWeather) GetEmoji() (value string) { - if c == nil { - return - } - return c.Emoji -} diff --git a/tdapi/tl_custom_request_result_gen.go b/tdapi/tl_custom_request_result_gen.go deleted file mode 100644 index b8fa83ed7..000000000 --- a/tdapi/tl_custom_request_result_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// CustomRequestResult represents TL type `customRequestResult#88326ffc`. -type CustomRequestResult struct { - // A JSON-serialized result - Result string -} - -// CustomRequestResultTypeID is TL type id of CustomRequestResult. -const CustomRequestResultTypeID = 0x88326ffc - -// Ensuring interfaces in compile-time for CustomRequestResult. -var ( - _ bin.Encoder = &CustomRequestResult{} - _ bin.Decoder = &CustomRequestResult{} - _ bin.BareEncoder = &CustomRequestResult{} - _ bin.BareDecoder = &CustomRequestResult{} -) - -func (c *CustomRequestResult) Zero() bool { - if c == nil { - return true - } - if !(c.Result == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (c *CustomRequestResult) String() string { - if c == nil { - return "CustomRequestResult(nil)" - } - type Alias CustomRequestResult - return fmt.Sprintf("CustomRequestResult%+v", Alias(*c)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*CustomRequestResult) TypeID() uint32 { - return CustomRequestResultTypeID -} - -// TypeName returns name of type in TL schema. -func (*CustomRequestResult) TypeName() string { - return "customRequestResult" -} - -// TypeInfo returns info about TL type. -func (c *CustomRequestResult) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "customRequestResult", - ID: CustomRequestResultTypeID, - } - if c == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Result", - SchemaName: "result", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (c *CustomRequestResult) Encode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode customRequestResult#88326ffc as nil") - } - b.PutID(CustomRequestResultTypeID) - return c.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (c *CustomRequestResult) EncodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't encode customRequestResult#88326ffc as nil") - } - b.PutString(c.Result) - return nil -} - -// Decode implements bin.Decoder. -func (c *CustomRequestResult) Decode(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode customRequestResult#88326ffc to nil") - } - if err := b.ConsumeID(CustomRequestResultTypeID); err != nil { - return fmt.Errorf("unable to decode customRequestResult#88326ffc: %w", err) - } - return c.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (c *CustomRequestResult) DecodeBare(b *bin.Buffer) error { - if c == nil { - return fmt.Errorf("can't decode customRequestResult#88326ffc to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode customRequestResult#88326ffc: field result: %w", err) - } - c.Result = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (c *CustomRequestResult) EncodeTDLibJSON(b tdjson.Encoder) error { - if c == nil { - return fmt.Errorf("can't encode customRequestResult#88326ffc as nil") - } - b.ObjStart() - b.PutID("customRequestResult") - b.Comma() - b.FieldStart("result") - b.PutString(c.Result) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (c *CustomRequestResult) DecodeTDLibJSON(b tdjson.Decoder) error { - if c == nil { - return fmt.Errorf("can't decode customRequestResult#88326ffc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("customRequestResult"); err != nil { - return fmt.Errorf("unable to decode customRequestResult#88326ffc: %w", err) - } - case "result": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode customRequestResult#88326ffc: field result: %w", err) - } - c.Result = value - default: - return b.Skip() - } - return nil - }) -} - -// GetResult returns value of Result field. -func (c *CustomRequestResult) GetResult() (value string) { - if c == nil { - return - } - return c.Result -} diff --git a/tdapi/tl_database_statistics_gen.go b/tdapi/tl_database_statistics_gen.go deleted file mode 100644 index aa69c33a9..000000000 --- a/tdapi/tl_database_statistics_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DatabaseStatistics represents TL type `databaseStatistics#bd027350`. -type DatabaseStatistics struct { - // Database statistics in an unspecified human-readable format - Statistics string -} - -// DatabaseStatisticsTypeID is TL type id of DatabaseStatistics. -const DatabaseStatisticsTypeID = 0xbd027350 - -// Ensuring interfaces in compile-time for DatabaseStatistics. -var ( - _ bin.Encoder = &DatabaseStatistics{} - _ bin.Decoder = &DatabaseStatistics{} - _ bin.BareEncoder = &DatabaseStatistics{} - _ bin.BareDecoder = &DatabaseStatistics{} -) - -func (d *DatabaseStatistics) Zero() bool { - if d == nil { - return true - } - if !(d.Statistics == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DatabaseStatistics) String() string { - if d == nil { - return "DatabaseStatistics(nil)" - } - type Alias DatabaseStatistics - return fmt.Sprintf("DatabaseStatistics%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DatabaseStatistics) TypeID() uint32 { - return DatabaseStatisticsTypeID -} - -// TypeName returns name of type in TL schema. -func (*DatabaseStatistics) TypeName() string { - return "databaseStatistics" -} - -// TypeInfo returns info about TL type. -func (d *DatabaseStatistics) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "databaseStatistics", - ID: DatabaseStatisticsTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Statistics", - SchemaName: "statistics", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DatabaseStatistics) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode databaseStatistics#bd027350 as nil") - } - b.PutID(DatabaseStatisticsTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DatabaseStatistics) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode databaseStatistics#bd027350 as nil") - } - b.PutString(d.Statistics) - return nil -} - -// Decode implements bin.Decoder. -func (d *DatabaseStatistics) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode databaseStatistics#bd027350 to nil") - } - if err := b.ConsumeID(DatabaseStatisticsTypeID); err != nil { - return fmt.Errorf("unable to decode databaseStatistics#bd027350: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DatabaseStatistics) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode databaseStatistics#bd027350 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode databaseStatistics#bd027350: field statistics: %w", err) - } - d.Statistics = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DatabaseStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode databaseStatistics#bd027350 as nil") - } - b.ObjStart() - b.PutID("databaseStatistics") - b.Comma() - b.FieldStart("statistics") - b.PutString(d.Statistics) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DatabaseStatistics) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode databaseStatistics#bd027350 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("databaseStatistics"); err != nil { - return fmt.Errorf("unable to decode databaseStatistics#bd027350: %w", err) - } - case "statistics": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode databaseStatistics#bd027350: field statistics: %w", err) - } - d.Statistics = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStatistics returns value of Statistics field. -func (d *DatabaseStatistics) GetStatistics() (value string) { - if d == nil { - return - } - return d.Statistics -} diff --git a/tdapi/tl_date_gen.go b/tdapi/tl_date_gen.go deleted file mode 100644 index f17354962..000000000 --- a/tdapi/tl_date_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Date represents TL type `date#ef6eb6a0`. -type Date struct { - // Day of the month; 1-31 - Day int32 - // Month; 1-12 - Month int32 - // Year; 1-9999 - Year int32 -} - -// DateTypeID is TL type id of Date. -const DateTypeID = 0xef6eb6a0 - -// Ensuring interfaces in compile-time for Date. -var ( - _ bin.Encoder = &Date{} - _ bin.Decoder = &Date{} - _ bin.BareEncoder = &Date{} - _ bin.BareDecoder = &Date{} -) - -func (d *Date) Zero() bool { - if d == nil { - return true - } - if !(d.Day == 0) { - return false - } - if !(d.Month == 0) { - return false - } - if !(d.Year == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *Date) String() string { - if d == nil { - return "Date(nil)" - } - type Alias Date - return fmt.Sprintf("Date%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Date) TypeID() uint32 { - return DateTypeID -} - -// TypeName returns name of type in TL schema. -func (*Date) TypeName() string { - return "date" -} - -// TypeInfo returns info about TL type. -func (d *Date) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "date", - ID: DateTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Day", - SchemaName: "day", - }, - { - Name: "Month", - SchemaName: "month", - }, - { - Name: "Year", - SchemaName: "year", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *Date) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode date#ef6eb6a0 as nil") - } - b.PutID(DateTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *Date) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode date#ef6eb6a0 as nil") - } - b.PutInt32(d.Day) - b.PutInt32(d.Month) - b.PutInt32(d.Year) - return nil -} - -// Decode implements bin.Decoder. -func (d *Date) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode date#ef6eb6a0 to nil") - } - if err := b.ConsumeID(DateTypeID); err != nil { - return fmt.Errorf("unable to decode date#ef6eb6a0: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *Date) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode date#ef6eb6a0 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode date#ef6eb6a0: field day: %w", err) - } - d.Day = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode date#ef6eb6a0: field month: %w", err) - } - d.Month = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode date#ef6eb6a0: field year: %w", err) - } - d.Year = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *Date) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode date#ef6eb6a0 as nil") - } - b.ObjStart() - b.PutID("date") - b.Comma() - b.FieldStart("day") - b.PutInt32(d.Day) - b.Comma() - b.FieldStart("month") - b.PutInt32(d.Month) - b.Comma() - b.FieldStart("year") - b.PutInt32(d.Year) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *Date) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode date#ef6eb6a0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("date"); err != nil { - return fmt.Errorf("unable to decode date#ef6eb6a0: %w", err) - } - case "day": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode date#ef6eb6a0: field day: %w", err) - } - d.Day = value - case "month": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode date#ef6eb6a0: field month: %w", err) - } - d.Month = value - case "year": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode date#ef6eb6a0: field year: %w", err) - } - d.Year = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDay returns value of Day field. -func (d *Date) GetDay() (value int32) { - if d == nil { - return - } - return d.Day -} - -// GetMonth returns value of Month field. -func (d *Date) GetMonth() (value int32) { - if d == nil { - return - } - return d.Month -} - -// GetYear returns value of Year field. -func (d *Date) GetYear() (value int32) { - if d == nil { - return - } - return d.Year -} diff --git a/tdapi/tl_date_range_gen.go b/tdapi/tl_date_range_gen.go deleted file mode 100644 index 4c4b0bf6e..000000000 --- a/tdapi/tl_date_range_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DateRange represents TL type `dateRange#51150c66`. -type DateRange struct { - // Point in time (Unix timestamp) at which the date range begins - StartDate int32 - // Point in time (Unix timestamp) at which the date range ends - EndDate int32 -} - -// DateRangeTypeID is TL type id of DateRange. -const DateRangeTypeID = 0x51150c66 - -// Ensuring interfaces in compile-time for DateRange. -var ( - _ bin.Encoder = &DateRange{} - _ bin.Decoder = &DateRange{} - _ bin.BareEncoder = &DateRange{} - _ bin.BareDecoder = &DateRange{} -) - -func (d *DateRange) Zero() bool { - if d == nil { - return true - } - if !(d.StartDate == 0) { - return false - } - if !(d.EndDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DateRange) String() string { - if d == nil { - return "DateRange(nil)" - } - type Alias DateRange - return fmt.Sprintf("DateRange%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DateRange) TypeID() uint32 { - return DateRangeTypeID -} - -// TypeName returns name of type in TL schema. -func (*DateRange) TypeName() string { - return "dateRange" -} - -// TypeInfo returns info about TL type. -func (d *DateRange) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "dateRange", - ID: DateRangeTypeID, - } - if d == 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 (d *DateRange) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode dateRange#51150c66 as nil") - } - b.PutID(DateRangeTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DateRange) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode dateRange#51150c66 as nil") - } - b.PutInt32(d.StartDate) - b.PutInt32(d.EndDate) - return nil -} - -// Decode implements bin.Decoder. -func (d *DateRange) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode dateRange#51150c66 to nil") - } - if err := b.ConsumeID(DateRangeTypeID); err != nil { - return fmt.Errorf("unable to decode dateRange#51150c66: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DateRange) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode dateRange#51150c66 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode dateRange#51150c66: field start_date: %w", err) - } - d.StartDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode dateRange#51150c66: field end_date: %w", err) - } - d.EndDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DateRange) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode dateRange#51150c66 as nil") - } - b.ObjStart() - b.PutID("dateRange") - b.Comma() - b.FieldStart("start_date") - b.PutInt32(d.StartDate) - b.Comma() - b.FieldStart("end_date") - b.PutInt32(d.EndDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DateRange) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode dateRange#51150c66 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("dateRange"); err != nil { - return fmt.Errorf("unable to decode dateRange#51150c66: %w", err) - } - case "start_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode dateRange#51150c66: field start_date: %w", err) - } - d.StartDate = value - case "end_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode dateRange#51150c66: field end_date: %w", err) - } - d.EndDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStartDate returns value of StartDate field. -func (d *DateRange) GetStartDate() (value int32) { - if d == nil { - return - } - return d.StartDate -} - -// GetEndDate returns value of EndDate field. -func (d *DateRange) GetEndDate() (value int32) { - if d == nil { - return - } - return d.EndDate -} diff --git a/tdapi/tl_dated_file_gen.go b/tdapi/tl_dated_file_gen.go deleted file mode 100644 index e5254b535..000000000 --- a/tdapi/tl_dated_file_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DatedFile represents TL type `datedFile#9247b09d`. -type DatedFile struct { - // The file - File File - // Point in time (Unix timestamp) when the file was uploaded - Date int32 -} - -// DatedFileTypeID is TL type id of DatedFile. -const DatedFileTypeID = 0x9247b09d - -// Ensuring interfaces in compile-time for DatedFile. -var ( - _ bin.Encoder = &DatedFile{} - _ bin.Decoder = &DatedFile{} - _ bin.BareEncoder = &DatedFile{} - _ bin.BareDecoder = &DatedFile{} -) - -func (d *DatedFile) Zero() bool { - if d == nil { - return true - } - if !(d.File.Zero()) { - return false - } - if !(d.Date == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DatedFile) String() string { - if d == nil { - return "DatedFile(nil)" - } - type Alias DatedFile - return fmt.Sprintf("DatedFile%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DatedFile) TypeID() uint32 { - return DatedFileTypeID -} - -// TypeName returns name of type in TL schema. -func (*DatedFile) TypeName() string { - return "datedFile" -} - -// TypeInfo returns info about TL type. -func (d *DatedFile) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "datedFile", - ID: DatedFileTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "File", - SchemaName: "file", - }, - { - Name: "Date", - SchemaName: "date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DatedFile) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode datedFile#9247b09d as nil") - } - b.PutID(DatedFileTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DatedFile) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode datedFile#9247b09d as nil") - } - if err := d.File.Encode(b); err != nil { - return fmt.Errorf("unable to encode datedFile#9247b09d: field file: %w", err) - } - b.PutInt32(d.Date) - return nil -} - -// Decode implements bin.Decoder. -func (d *DatedFile) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode datedFile#9247b09d to nil") - } - if err := b.ConsumeID(DatedFileTypeID); err != nil { - return fmt.Errorf("unable to decode datedFile#9247b09d: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DatedFile) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode datedFile#9247b09d to nil") - } - { - if err := d.File.Decode(b); err != nil { - return fmt.Errorf("unable to decode datedFile#9247b09d: field file: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode datedFile#9247b09d: field date: %w", err) - } - d.Date = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DatedFile) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode datedFile#9247b09d as nil") - } - b.ObjStart() - b.PutID("datedFile") - b.Comma() - b.FieldStart("file") - if err := d.File.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode datedFile#9247b09d: field file: %w", err) - } - b.Comma() - b.FieldStart("date") - b.PutInt32(d.Date) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DatedFile) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode datedFile#9247b09d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("datedFile"); err != nil { - return fmt.Errorf("unable to decode datedFile#9247b09d: %w", err) - } - case "file": - if err := d.File.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode datedFile#9247b09d: field file: %w", err) - } - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode datedFile#9247b09d: field date: %w", err) - } - d.Date = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFile returns value of File field. -func (d *DatedFile) GetFile() (value File) { - if d == nil { - return - } - return d.File -} - -// GetDate returns value of Date field. -func (d *DatedFile) GetDate() (value int32) { - if d == nil { - return - } - return d.Date -} diff --git a/tdapi/tl_deep_link_info_gen.go b/tdapi/tl_deep_link_info_gen.go deleted file mode 100644 index cfb600bad..000000000 --- a/tdapi/tl_deep_link_info_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeepLinkInfo represents TL type `deepLinkInfo#6f1ba0fe`. -type DeepLinkInfo struct { - // Text to be shown to the user - Text FormattedText - // True, if the user must be asked to update the application - NeedUpdateApplication bool -} - -// DeepLinkInfoTypeID is TL type id of DeepLinkInfo. -const DeepLinkInfoTypeID = 0x6f1ba0fe - -// Ensuring interfaces in compile-time for DeepLinkInfo. -var ( - _ bin.Encoder = &DeepLinkInfo{} - _ bin.Decoder = &DeepLinkInfo{} - _ bin.BareEncoder = &DeepLinkInfo{} - _ bin.BareDecoder = &DeepLinkInfo{} -) - -func (d *DeepLinkInfo) Zero() bool { - if d == nil { - return true - } - if !(d.Text.Zero()) { - return false - } - if !(d.NeedUpdateApplication == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeepLinkInfo) String() string { - if d == nil { - return "DeepLinkInfo(nil)" - } - type Alias DeepLinkInfo - return fmt.Sprintf("DeepLinkInfo%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeepLinkInfo) TypeID() uint32 { - return DeepLinkInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeepLinkInfo) TypeName() string { - return "deepLinkInfo" -} - -// TypeInfo returns info about TL type. -func (d *DeepLinkInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deepLinkInfo", - ID: DeepLinkInfoTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "NeedUpdateApplication", - SchemaName: "need_update_application", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeepLinkInfo) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deepLinkInfo#6f1ba0fe as nil") - } - b.PutID(DeepLinkInfoTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeepLinkInfo) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deepLinkInfo#6f1ba0fe as nil") - } - if err := d.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode deepLinkInfo#6f1ba0fe: field text: %w", err) - } - b.PutBool(d.NeedUpdateApplication) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeepLinkInfo) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deepLinkInfo#6f1ba0fe to nil") - } - if err := b.ConsumeID(DeepLinkInfoTypeID); err != nil { - return fmt.Errorf("unable to decode deepLinkInfo#6f1ba0fe: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeepLinkInfo) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deepLinkInfo#6f1ba0fe to nil") - } - { - if err := d.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode deepLinkInfo#6f1ba0fe: field text: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deepLinkInfo#6f1ba0fe: field need_update_application: %w", err) - } - d.NeedUpdateApplication = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeepLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deepLinkInfo#6f1ba0fe as nil") - } - b.ObjStart() - b.PutID("deepLinkInfo") - b.Comma() - b.FieldStart("text") - if err := d.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode deepLinkInfo#6f1ba0fe: field text: %w", err) - } - b.Comma() - b.FieldStart("need_update_application") - b.PutBool(d.NeedUpdateApplication) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeepLinkInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deepLinkInfo#6f1ba0fe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deepLinkInfo"); err != nil { - return fmt.Errorf("unable to decode deepLinkInfo#6f1ba0fe: %w", err) - } - case "text": - if err := d.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode deepLinkInfo#6f1ba0fe: field text: %w", err) - } - case "need_update_application": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deepLinkInfo#6f1ba0fe: field need_update_application: %w", err) - } - d.NeedUpdateApplication = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (d *DeepLinkInfo) GetText() (value FormattedText) { - if d == nil { - return - } - return d.Text -} - -// GetNeedUpdateApplication returns value of NeedUpdateApplication field. -func (d *DeepLinkInfo) GetNeedUpdateApplication() (value bool) { - if d == nil { - return - } - return d.NeedUpdateApplication -} diff --git a/tdapi/tl_delete_account_gen.go b/tdapi/tl_delete_account_gen.go deleted file mode 100644 index 485d35403..000000000 --- a/tdapi/tl_delete_account_gen.go +++ /dev/null @@ -1,239 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteAccountRequest represents TL type `deleteAccount#533276c6`. -type DeleteAccountRequest struct { - // The reason why the account was deleted; optional - Reason string - // The 2-step verification password of the current user. If the current user isn't - // authorized, then an empty string can be passed and account deletion can be canceled - // within one week - Password string -} - -// DeleteAccountRequestTypeID is TL type id of DeleteAccountRequest. -const DeleteAccountRequestTypeID = 0x533276c6 - -// Ensuring interfaces in compile-time for DeleteAccountRequest. -var ( - _ bin.Encoder = &DeleteAccountRequest{} - _ bin.Decoder = &DeleteAccountRequest{} - _ bin.BareEncoder = &DeleteAccountRequest{} - _ bin.BareDecoder = &DeleteAccountRequest{} -) - -func (d *DeleteAccountRequest) Zero() bool { - if d == nil { - return true - } - if !(d.Reason == "") { - return false - } - if !(d.Password == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteAccountRequest) String() string { - if d == nil { - return "DeleteAccountRequest(nil)" - } - type Alias DeleteAccountRequest - return fmt.Sprintf("DeleteAccountRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteAccountRequest) TypeID() uint32 { - return DeleteAccountRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteAccountRequest) TypeName() string { - return "deleteAccount" -} - -// TypeInfo returns info about TL type. -func (d *DeleteAccountRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteAccount", - ID: DeleteAccountRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Reason", - SchemaName: "reason", - }, - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteAccountRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteAccount#533276c6 as nil") - } - b.PutID(DeleteAccountRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteAccountRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteAccount#533276c6 as nil") - } - b.PutString(d.Reason) - b.PutString(d.Password) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteAccountRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteAccount#533276c6 to nil") - } - if err := b.ConsumeID(DeleteAccountRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteAccount#533276c6: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteAccountRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteAccount#533276c6 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteAccount#533276c6: field reason: %w", err) - } - d.Reason = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteAccount#533276c6: field password: %w", err) - } - d.Password = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteAccountRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteAccount#533276c6 as nil") - } - b.ObjStart() - b.PutID("deleteAccount") - b.Comma() - b.FieldStart("reason") - b.PutString(d.Reason) - b.Comma() - b.FieldStart("password") - b.PutString(d.Password) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteAccountRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteAccount#533276c6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteAccount"); err != nil { - return fmt.Errorf("unable to decode deleteAccount#533276c6: %w", err) - } - case "reason": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteAccount#533276c6: field reason: %w", err) - } - d.Reason = value - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteAccount#533276c6: field password: %w", err) - } - d.Password = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReason returns value of Reason field. -func (d *DeleteAccountRequest) GetReason() (value string) { - if d == nil { - return - } - return d.Reason -} - -// GetPassword returns value of Password field. -func (d *DeleteAccountRequest) GetPassword() (value string) { - if d == nil { - return - } - return d.Password -} - -// DeleteAccount invokes method deleteAccount#533276c6 returning error if any. -func (c *Client) DeleteAccount(ctx context.Context, request *DeleteAccountRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_all_call_messages_gen.go b/tdapi/tl_delete_all_call_messages_gen.go deleted file mode 100644 index b790f22a0..000000000 --- a/tdapi/tl_delete_all_call_messages_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteAllCallMessagesRequest represents TL type `deleteAllCallMessages#a897d1f3`. -type DeleteAllCallMessagesRequest struct { - // Pass true to delete the messages for all users - Revoke bool -} - -// DeleteAllCallMessagesRequestTypeID is TL type id of DeleteAllCallMessagesRequest. -const DeleteAllCallMessagesRequestTypeID = 0xa897d1f3 - -// Ensuring interfaces in compile-time for DeleteAllCallMessagesRequest. -var ( - _ bin.Encoder = &DeleteAllCallMessagesRequest{} - _ bin.Decoder = &DeleteAllCallMessagesRequest{} - _ bin.BareEncoder = &DeleteAllCallMessagesRequest{} - _ bin.BareDecoder = &DeleteAllCallMessagesRequest{} -) - -func (d *DeleteAllCallMessagesRequest) Zero() bool { - if d == nil { - return true - } - if !(d.Revoke == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteAllCallMessagesRequest) String() string { - if d == nil { - return "DeleteAllCallMessagesRequest(nil)" - } - type Alias DeleteAllCallMessagesRequest - return fmt.Sprintf("DeleteAllCallMessagesRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteAllCallMessagesRequest) TypeID() uint32 { - return DeleteAllCallMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteAllCallMessagesRequest) TypeName() string { - return "deleteAllCallMessages" -} - -// TypeInfo returns info about TL type. -func (d *DeleteAllCallMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteAllCallMessages", - ID: DeleteAllCallMessagesRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Revoke", - SchemaName: "revoke", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteAllCallMessagesRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteAllCallMessages#a897d1f3 as nil") - } - b.PutID(DeleteAllCallMessagesRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteAllCallMessagesRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteAllCallMessages#a897d1f3 as nil") - } - b.PutBool(d.Revoke) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteAllCallMessagesRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteAllCallMessages#a897d1f3 to nil") - } - if err := b.ConsumeID(DeleteAllCallMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteAllCallMessages#a897d1f3: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteAllCallMessagesRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteAllCallMessages#a897d1f3 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteAllCallMessages#a897d1f3: field revoke: %w", err) - } - d.Revoke = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteAllCallMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteAllCallMessages#a897d1f3 as nil") - } - b.ObjStart() - b.PutID("deleteAllCallMessages") - b.Comma() - b.FieldStart("revoke") - b.PutBool(d.Revoke) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteAllCallMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteAllCallMessages#a897d1f3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteAllCallMessages"); err != nil { - return fmt.Errorf("unable to decode deleteAllCallMessages#a897d1f3: %w", err) - } - case "revoke": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteAllCallMessages#a897d1f3: field revoke: %w", err) - } - d.Revoke = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRevoke returns value of Revoke field. -func (d *DeleteAllCallMessagesRequest) GetRevoke() (value bool) { - if d == nil { - return - } - return d.Revoke -} - -// DeleteAllCallMessages invokes method deleteAllCallMessages#a897d1f3 returning error if any. -func (c *Client) DeleteAllCallMessages(ctx context.Context, revoke bool) error { - var ok Ok - - request := &DeleteAllCallMessagesRequest{ - Revoke: revoke, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_all_revoked_chat_invite_links_gen.go b/tdapi/tl_delete_all_revoked_chat_invite_links_gen.go deleted file mode 100644 index 5c5905577..000000000 --- a/tdapi/tl_delete_all_revoked_chat_invite_links_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteAllRevokedChatInviteLinksRequest represents TL type `deleteAllRevokedChatInviteLinks#424816da`. -type DeleteAllRevokedChatInviteLinksRequest struct { - // Chat identifier - ChatID int64 - // User identifier of a chat administrator, which links will be deleted. Must be an - // identifier of the current user for non-owner - CreatorUserID int64 -} - -// DeleteAllRevokedChatInviteLinksRequestTypeID is TL type id of DeleteAllRevokedChatInviteLinksRequest. -const DeleteAllRevokedChatInviteLinksRequestTypeID = 0x424816da - -// Ensuring interfaces in compile-time for DeleteAllRevokedChatInviteLinksRequest. -var ( - _ bin.Encoder = &DeleteAllRevokedChatInviteLinksRequest{} - _ bin.Decoder = &DeleteAllRevokedChatInviteLinksRequest{} - _ bin.BareEncoder = &DeleteAllRevokedChatInviteLinksRequest{} - _ bin.BareDecoder = &DeleteAllRevokedChatInviteLinksRequest{} -) - -func (d *DeleteAllRevokedChatInviteLinksRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatID == 0) { - return false - } - if !(d.CreatorUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteAllRevokedChatInviteLinksRequest) String() string { - if d == nil { - return "DeleteAllRevokedChatInviteLinksRequest(nil)" - } - type Alias DeleteAllRevokedChatInviteLinksRequest - return fmt.Sprintf("DeleteAllRevokedChatInviteLinksRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteAllRevokedChatInviteLinksRequest) TypeID() uint32 { - return DeleteAllRevokedChatInviteLinksRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteAllRevokedChatInviteLinksRequest) TypeName() string { - return "deleteAllRevokedChatInviteLinks" -} - -// TypeInfo returns info about TL type. -func (d *DeleteAllRevokedChatInviteLinksRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteAllRevokedChatInviteLinks", - ID: DeleteAllRevokedChatInviteLinksRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "CreatorUserID", - SchemaName: "creator_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteAllRevokedChatInviteLinksRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteAllRevokedChatInviteLinks#424816da as nil") - } - b.PutID(DeleteAllRevokedChatInviteLinksRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteAllRevokedChatInviteLinksRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteAllRevokedChatInviteLinks#424816da as nil") - } - b.PutInt53(d.ChatID) - b.PutInt53(d.CreatorUserID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteAllRevokedChatInviteLinksRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteAllRevokedChatInviteLinks#424816da to nil") - } - if err := b.ConsumeID(DeleteAllRevokedChatInviteLinksRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteAllRevokedChatInviteLinks#424816da: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteAllRevokedChatInviteLinksRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteAllRevokedChatInviteLinks#424816da to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteAllRevokedChatInviteLinks#424816da: field chat_id: %w", err) - } - d.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteAllRevokedChatInviteLinks#424816da: field creator_user_id: %w", err) - } - d.CreatorUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteAllRevokedChatInviteLinksRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteAllRevokedChatInviteLinks#424816da as nil") - } - b.ObjStart() - b.PutID("deleteAllRevokedChatInviteLinks") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(d.ChatID) - b.Comma() - b.FieldStart("creator_user_id") - b.PutInt53(d.CreatorUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteAllRevokedChatInviteLinksRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteAllRevokedChatInviteLinks#424816da to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteAllRevokedChatInviteLinks"); err != nil { - return fmt.Errorf("unable to decode deleteAllRevokedChatInviteLinks#424816da: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteAllRevokedChatInviteLinks#424816da: field chat_id: %w", err) - } - d.ChatID = value - case "creator_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteAllRevokedChatInviteLinks#424816da: field creator_user_id: %w", err) - } - d.CreatorUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (d *DeleteAllRevokedChatInviteLinksRequest) GetChatID() (value int64) { - if d == nil { - return - } - return d.ChatID -} - -// GetCreatorUserID returns value of CreatorUserID field. -func (d *DeleteAllRevokedChatInviteLinksRequest) GetCreatorUserID() (value int64) { - if d == nil { - return - } - return d.CreatorUserID -} - -// DeleteAllRevokedChatInviteLinks invokes method deleteAllRevokedChatInviteLinks#424816da returning error if any. -func (c *Client) DeleteAllRevokedChatInviteLinks(ctx context.Context, request *DeleteAllRevokedChatInviteLinksRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_bot_media_previews_gen.go b/tdapi/tl_delete_bot_media_previews_gen.go deleted file mode 100644 index 3743a9ded..000000000 --- a/tdapi/tl_delete_bot_media_previews_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteBotMediaPreviewsRequest represents TL type `deleteBotMediaPreviews#f7d259db`. -type DeleteBotMediaPreviewsRequest struct { - // Identifier of the target bot. The bot must be owned and must have the main Web App - BotUserID int64 - // Language code of the media previews to delete - LanguageCode string - // File identifiers of the media to delete - FileIDs []int32 -} - -// DeleteBotMediaPreviewsRequestTypeID is TL type id of DeleteBotMediaPreviewsRequest. -const DeleteBotMediaPreviewsRequestTypeID = 0xf7d259db - -// Ensuring interfaces in compile-time for DeleteBotMediaPreviewsRequest. -var ( - _ bin.Encoder = &DeleteBotMediaPreviewsRequest{} - _ bin.Decoder = &DeleteBotMediaPreviewsRequest{} - _ bin.BareEncoder = &DeleteBotMediaPreviewsRequest{} - _ bin.BareDecoder = &DeleteBotMediaPreviewsRequest{} -) - -func (d *DeleteBotMediaPreviewsRequest) Zero() bool { - if d == nil { - return true - } - if !(d.BotUserID == 0) { - return false - } - if !(d.LanguageCode == "") { - return false - } - if !(d.FileIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteBotMediaPreviewsRequest) String() string { - if d == nil { - return "DeleteBotMediaPreviewsRequest(nil)" - } - type Alias DeleteBotMediaPreviewsRequest - return fmt.Sprintf("DeleteBotMediaPreviewsRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteBotMediaPreviewsRequest) TypeID() uint32 { - return DeleteBotMediaPreviewsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteBotMediaPreviewsRequest) TypeName() string { - return "deleteBotMediaPreviews" -} - -// TypeInfo returns info about TL type. -func (d *DeleteBotMediaPreviewsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteBotMediaPreviews", - ID: DeleteBotMediaPreviewsRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - { - Name: "FileIDs", - SchemaName: "file_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteBotMediaPreviewsRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteBotMediaPreviews#f7d259db as nil") - } - b.PutID(DeleteBotMediaPreviewsRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteBotMediaPreviewsRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteBotMediaPreviews#f7d259db as nil") - } - b.PutInt53(d.BotUserID) - b.PutString(d.LanguageCode) - b.PutInt(len(d.FileIDs)) - for _, v := range d.FileIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteBotMediaPreviewsRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteBotMediaPreviews#f7d259db to nil") - } - if err := b.ConsumeID(DeleteBotMediaPreviewsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteBotMediaPreviewsRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteBotMediaPreviews#f7d259db to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field bot_user_id: %w", err) - } - d.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field language_code: %w", err) - } - d.LanguageCode = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field file_ids: %w", err) - } - - if headerLen > 0 { - d.FileIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field file_ids: %w", err) - } - d.FileIDs = append(d.FileIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteBotMediaPreviewsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteBotMediaPreviews#f7d259db as nil") - } - b.ObjStart() - b.PutID("deleteBotMediaPreviews") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(d.BotUserID) - b.Comma() - b.FieldStart("language_code") - b.PutString(d.LanguageCode) - b.Comma() - b.FieldStart("file_ids") - b.ArrStart() - for _, v := range d.FileIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteBotMediaPreviewsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteBotMediaPreviews#f7d259db to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteBotMediaPreviews"); err != nil { - return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field bot_user_id: %w", err) - } - d.BotUserID = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field language_code: %w", err) - } - d.LanguageCode = value - case "file_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field file_ids: %w", err) - } - d.FileIDs = append(d.FileIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode deleteBotMediaPreviews#f7d259db: field file_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (d *DeleteBotMediaPreviewsRequest) GetBotUserID() (value int64) { - if d == nil { - return - } - return d.BotUserID -} - -// GetLanguageCode returns value of LanguageCode field. -func (d *DeleteBotMediaPreviewsRequest) GetLanguageCode() (value string) { - if d == nil { - return - } - return d.LanguageCode -} - -// GetFileIDs returns value of FileIDs field. -func (d *DeleteBotMediaPreviewsRequest) GetFileIDs() (value []int32) { - if d == nil { - return - } - return d.FileIDs -} - -// DeleteBotMediaPreviews invokes method deleteBotMediaPreviews#f7d259db returning error if any. -func (c *Client) DeleteBotMediaPreviews(ctx context.Context, request *DeleteBotMediaPreviewsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_business_chat_link_gen.go b/tdapi/tl_delete_business_chat_link_gen.go deleted file mode 100644 index 5cd5d3a1a..000000000 --- a/tdapi/tl_delete_business_chat_link_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteBusinessChatLinkRequest represents TL type `deleteBusinessChatLink#be526747`. -type DeleteBusinessChatLinkRequest struct { - // The link to delete - Link string -} - -// DeleteBusinessChatLinkRequestTypeID is TL type id of DeleteBusinessChatLinkRequest. -const DeleteBusinessChatLinkRequestTypeID = 0xbe526747 - -// Ensuring interfaces in compile-time for DeleteBusinessChatLinkRequest. -var ( - _ bin.Encoder = &DeleteBusinessChatLinkRequest{} - _ bin.Decoder = &DeleteBusinessChatLinkRequest{} - _ bin.BareEncoder = &DeleteBusinessChatLinkRequest{} - _ bin.BareDecoder = &DeleteBusinessChatLinkRequest{} -) - -func (d *DeleteBusinessChatLinkRequest) Zero() bool { - if d == nil { - return true - } - if !(d.Link == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteBusinessChatLinkRequest) String() string { - if d == nil { - return "DeleteBusinessChatLinkRequest(nil)" - } - type Alias DeleteBusinessChatLinkRequest - return fmt.Sprintf("DeleteBusinessChatLinkRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteBusinessChatLinkRequest) TypeID() uint32 { - return DeleteBusinessChatLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteBusinessChatLinkRequest) TypeName() string { - return "deleteBusinessChatLink" -} - -// TypeInfo returns info about TL type. -func (d *DeleteBusinessChatLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteBusinessChatLink", - ID: DeleteBusinessChatLinkRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteBusinessChatLinkRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteBusinessChatLink#be526747 as nil") - } - b.PutID(DeleteBusinessChatLinkRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteBusinessChatLinkRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteBusinessChatLink#be526747 as nil") - } - b.PutString(d.Link) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteBusinessChatLinkRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteBusinessChatLink#be526747 to nil") - } - if err := b.ConsumeID(DeleteBusinessChatLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteBusinessChatLink#be526747: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteBusinessChatLinkRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteBusinessChatLink#be526747 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteBusinessChatLink#be526747: field link: %w", err) - } - d.Link = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteBusinessChatLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteBusinessChatLink#be526747 as nil") - } - b.ObjStart() - b.PutID("deleteBusinessChatLink") - b.Comma() - b.FieldStart("link") - b.PutString(d.Link) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteBusinessChatLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteBusinessChatLink#be526747 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteBusinessChatLink"); err != nil { - return fmt.Errorf("unable to decode deleteBusinessChatLink#be526747: %w", err) - } - case "link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteBusinessChatLink#be526747: field link: %w", err) - } - d.Link = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (d *DeleteBusinessChatLinkRequest) GetLink() (value string) { - if d == nil { - return - } - return d.Link -} - -// DeleteBusinessChatLink invokes method deleteBusinessChatLink#be526747 returning error if any. -func (c *Client) DeleteBusinessChatLink(ctx context.Context, link string) error { - var ok Ok - - request := &DeleteBusinessChatLinkRequest{ - Link: link, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_business_connected_bot_gen.go b/tdapi/tl_delete_business_connected_bot_gen.go deleted file mode 100644 index 3bdde5af1..000000000 --- a/tdapi/tl_delete_business_connected_bot_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteBusinessConnectedBotRequest represents TL type `deleteBusinessConnectedBot#9e9b7e55`. -type DeleteBusinessConnectedBotRequest struct { - // Unique user identifier for the bot - BotUserID int64 -} - -// DeleteBusinessConnectedBotRequestTypeID is TL type id of DeleteBusinessConnectedBotRequest. -const DeleteBusinessConnectedBotRequestTypeID = 0x9e9b7e55 - -// Ensuring interfaces in compile-time for DeleteBusinessConnectedBotRequest. -var ( - _ bin.Encoder = &DeleteBusinessConnectedBotRequest{} - _ bin.Decoder = &DeleteBusinessConnectedBotRequest{} - _ bin.BareEncoder = &DeleteBusinessConnectedBotRequest{} - _ bin.BareDecoder = &DeleteBusinessConnectedBotRequest{} -) - -func (d *DeleteBusinessConnectedBotRequest) Zero() bool { - if d == nil { - return true - } - if !(d.BotUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteBusinessConnectedBotRequest) String() string { - if d == nil { - return "DeleteBusinessConnectedBotRequest(nil)" - } - type Alias DeleteBusinessConnectedBotRequest - return fmt.Sprintf("DeleteBusinessConnectedBotRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteBusinessConnectedBotRequest) TypeID() uint32 { - return DeleteBusinessConnectedBotRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteBusinessConnectedBotRequest) TypeName() string { - return "deleteBusinessConnectedBot" -} - -// TypeInfo returns info about TL type. -func (d *DeleteBusinessConnectedBotRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteBusinessConnectedBot", - ID: DeleteBusinessConnectedBotRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteBusinessConnectedBotRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteBusinessConnectedBot#9e9b7e55 as nil") - } - b.PutID(DeleteBusinessConnectedBotRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteBusinessConnectedBotRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteBusinessConnectedBot#9e9b7e55 as nil") - } - b.PutInt53(d.BotUserID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteBusinessConnectedBotRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteBusinessConnectedBot#9e9b7e55 to nil") - } - if err := b.ConsumeID(DeleteBusinessConnectedBotRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteBusinessConnectedBotRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteBusinessConnectedBot#9e9b7e55 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: field bot_user_id: %w", err) - } - d.BotUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteBusinessConnectedBotRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteBusinessConnectedBot#9e9b7e55 as nil") - } - b.ObjStart() - b.PutID("deleteBusinessConnectedBot") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(d.BotUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteBusinessConnectedBotRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteBusinessConnectedBot#9e9b7e55 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteBusinessConnectedBot"); err != nil { - return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteBusinessConnectedBot#9e9b7e55: field bot_user_id: %w", err) - } - d.BotUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (d *DeleteBusinessConnectedBotRequest) GetBotUserID() (value int64) { - if d == nil { - return - } - return d.BotUserID -} - -// DeleteBusinessConnectedBot invokes method deleteBusinessConnectedBot#9e9b7e55 returning error if any. -func (c *Client) DeleteBusinessConnectedBot(ctx context.Context, botuserid int64) error { - var ok Ok - - request := &DeleteBusinessConnectedBotRequest{ - BotUserID: botuserid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_chat_background_gen.go b/tdapi/tl_delete_chat_background_gen.go deleted file mode 100644 index 316bf6ca3..000000000 --- a/tdapi/tl_delete_chat_background_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteChatBackgroundRequest represents TL type `deleteChatBackground#1316e678`. -type DeleteChatBackgroundRequest struct { - // Chat identifier - ChatID int64 - // Pass true to restore previously set background. Can be used only in private and secret - // chats with non-deleted users if userFullInfo.set_chat_background == true. - RestorePrevious bool -} - -// DeleteChatBackgroundRequestTypeID is TL type id of DeleteChatBackgroundRequest. -const DeleteChatBackgroundRequestTypeID = 0x1316e678 - -// Ensuring interfaces in compile-time for DeleteChatBackgroundRequest. -var ( - _ bin.Encoder = &DeleteChatBackgroundRequest{} - _ bin.Decoder = &DeleteChatBackgroundRequest{} - _ bin.BareEncoder = &DeleteChatBackgroundRequest{} - _ bin.BareDecoder = &DeleteChatBackgroundRequest{} -) - -func (d *DeleteChatBackgroundRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatID == 0) { - return false - } - if !(d.RestorePrevious == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteChatBackgroundRequest) String() string { - if d == nil { - return "DeleteChatBackgroundRequest(nil)" - } - type Alias DeleteChatBackgroundRequest - return fmt.Sprintf("DeleteChatBackgroundRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteChatBackgroundRequest) TypeID() uint32 { - return DeleteChatBackgroundRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteChatBackgroundRequest) TypeName() string { - return "deleteChatBackground" -} - -// TypeInfo returns info about TL type. -func (d *DeleteChatBackgroundRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteChatBackground", - ID: DeleteChatBackgroundRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "RestorePrevious", - SchemaName: "restore_previous", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteChatBackgroundRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatBackground#1316e678 as nil") - } - b.PutID(DeleteChatBackgroundRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteChatBackgroundRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatBackground#1316e678 as nil") - } - b.PutInt53(d.ChatID) - b.PutBool(d.RestorePrevious) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteChatBackgroundRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatBackground#1316e678 to nil") - } - if err := b.ConsumeID(DeleteChatBackgroundRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteChatBackground#1316e678: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteChatBackgroundRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatBackground#1316e678 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatBackground#1316e678: field chat_id: %w", err) - } - d.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteChatBackground#1316e678: field restore_previous: %w", err) - } - d.RestorePrevious = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteChatBackgroundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatBackground#1316e678 as nil") - } - b.ObjStart() - b.PutID("deleteChatBackground") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(d.ChatID) - b.Comma() - b.FieldStart("restore_previous") - b.PutBool(d.RestorePrevious) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteChatBackgroundRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatBackground#1316e678 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteChatBackground"); err != nil { - return fmt.Errorf("unable to decode deleteChatBackground#1316e678: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatBackground#1316e678: field chat_id: %w", err) - } - d.ChatID = value - case "restore_previous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteChatBackground#1316e678: field restore_previous: %w", err) - } - d.RestorePrevious = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (d *DeleteChatBackgroundRequest) GetChatID() (value int64) { - if d == nil { - return - } - return d.ChatID -} - -// GetRestorePrevious returns value of RestorePrevious field. -func (d *DeleteChatBackgroundRequest) GetRestorePrevious() (value bool) { - if d == nil { - return - } - return d.RestorePrevious -} - -// DeleteChatBackground invokes method deleteChatBackground#1316e678 returning error if any. -func (c *Client) DeleteChatBackground(ctx context.Context, request *DeleteChatBackgroundRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_chat_folder_gen.go b/tdapi/tl_delete_chat_folder_gen.go deleted file mode 100644 index a4fe29657..000000000 --- a/tdapi/tl_delete_chat_folder_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteChatFolderRequest represents TL type `deleteChatFolder#74260b87`. -type DeleteChatFolderRequest struct { - // Chat folder identifier - ChatFolderID int32 - // Identifiers of the chats to leave. The chats must be pinned or always included in the - // folder - LeaveChatIDs []int64 -} - -// DeleteChatFolderRequestTypeID is TL type id of DeleteChatFolderRequest. -const DeleteChatFolderRequestTypeID = 0x74260b87 - -// Ensuring interfaces in compile-time for DeleteChatFolderRequest. -var ( - _ bin.Encoder = &DeleteChatFolderRequest{} - _ bin.Decoder = &DeleteChatFolderRequest{} - _ bin.BareEncoder = &DeleteChatFolderRequest{} - _ bin.BareDecoder = &DeleteChatFolderRequest{} -) - -func (d *DeleteChatFolderRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatFolderID == 0) { - return false - } - if !(d.LeaveChatIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteChatFolderRequest) String() string { - if d == nil { - return "DeleteChatFolderRequest(nil)" - } - type Alias DeleteChatFolderRequest - return fmt.Sprintf("DeleteChatFolderRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteChatFolderRequest) TypeID() uint32 { - return DeleteChatFolderRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteChatFolderRequest) TypeName() string { - return "deleteChatFolder" -} - -// TypeInfo returns info about TL type. -func (d *DeleteChatFolderRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteChatFolder", - ID: DeleteChatFolderRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - { - Name: "LeaveChatIDs", - SchemaName: "leave_chat_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteChatFolderRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatFolder#74260b87 as nil") - } - b.PutID(DeleteChatFolderRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteChatFolderRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatFolder#74260b87 as nil") - } - b.PutInt32(d.ChatFolderID) - b.PutInt(len(d.LeaveChatIDs)) - for _, v := range d.LeaveChatIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteChatFolderRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatFolder#74260b87 to nil") - } - if err := b.ConsumeID(DeleteChatFolderRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteChatFolder#74260b87: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteChatFolderRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatFolder#74260b87 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteChatFolder#74260b87: field chat_folder_id: %w", err) - } - d.ChatFolderID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode deleteChatFolder#74260b87: field leave_chat_ids: %w", err) - } - - if headerLen > 0 { - d.LeaveChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatFolder#74260b87: field leave_chat_ids: %w", err) - } - d.LeaveChatIDs = append(d.LeaveChatIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteChatFolderRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatFolder#74260b87 as nil") - } - b.ObjStart() - b.PutID("deleteChatFolder") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(d.ChatFolderID) - b.Comma() - b.FieldStart("leave_chat_ids") - b.ArrStart() - for _, v := range d.LeaveChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteChatFolderRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatFolder#74260b87 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteChatFolder"); err != nil { - return fmt.Errorf("unable to decode deleteChatFolder#74260b87: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteChatFolder#74260b87: field chat_folder_id: %w", err) - } - d.ChatFolderID = value - case "leave_chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatFolder#74260b87: field leave_chat_ids: %w", err) - } - d.LeaveChatIDs = append(d.LeaveChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode deleteChatFolder#74260b87: field leave_chat_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (d *DeleteChatFolderRequest) GetChatFolderID() (value int32) { - if d == nil { - return - } - return d.ChatFolderID -} - -// GetLeaveChatIDs returns value of LeaveChatIDs field. -func (d *DeleteChatFolderRequest) GetLeaveChatIDs() (value []int64) { - if d == nil { - return - } - return d.LeaveChatIDs -} - -// DeleteChatFolder invokes method deleteChatFolder#74260b87 returning error if any. -func (c *Client) DeleteChatFolder(ctx context.Context, request *DeleteChatFolderRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_chat_folder_invite_link_gen.go b/tdapi/tl_delete_chat_folder_invite_link_gen.go deleted file mode 100644 index 39bda333d..000000000 --- a/tdapi/tl_delete_chat_folder_invite_link_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteChatFolderInviteLinkRequest represents TL type `deleteChatFolderInviteLink#c890717e`. -type DeleteChatFolderInviteLinkRequest struct { - // Chat folder identifier - ChatFolderID int32 - // Invite link to be deleted - InviteLink string -} - -// DeleteChatFolderInviteLinkRequestTypeID is TL type id of DeleteChatFolderInviteLinkRequest. -const DeleteChatFolderInviteLinkRequestTypeID = 0xc890717e - -// Ensuring interfaces in compile-time for DeleteChatFolderInviteLinkRequest. -var ( - _ bin.Encoder = &DeleteChatFolderInviteLinkRequest{} - _ bin.Decoder = &DeleteChatFolderInviteLinkRequest{} - _ bin.BareEncoder = &DeleteChatFolderInviteLinkRequest{} - _ bin.BareDecoder = &DeleteChatFolderInviteLinkRequest{} -) - -func (d *DeleteChatFolderInviteLinkRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatFolderID == 0) { - return false - } - if !(d.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteChatFolderInviteLinkRequest) String() string { - if d == nil { - return "DeleteChatFolderInviteLinkRequest(nil)" - } - type Alias DeleteChatFolderInviteLinkRequest - return fmt.Sprintf("DeleteChatFolderInviteLinkRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteChatFolderInviteLinkRequest) TypeID() uint32 { - return DeleteChatFolderInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteChatFolderInviteLinkRequest) TypeName() string { - return "deleteChatFolderInviteLink" -} - -// TypeInfo returns info about TL type. -func (d *DeleteChatFolderInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteChatFolderInviteLink", - ID: DeleteChatFolderInviteLinkRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteChatFolderInviteLinkRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatFolderInviteLink#c890717e as nil") - } - b.PutID(DeleteChatFolderInviteLinkRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteChatFolderInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatFolderInviteLink#c890717e as nil") - } - b.PutInt32(d.ChatFolderID) - b.PutString(d.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteChatFolderInviteLinkRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatFolderInviteLink#c890717e to nil") - } - if err := b.ConsumeID(DeleteChatFolderInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteChatFolderInviteLink#c890717e: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteChatFolderInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatFolderInviteLink#c890717e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteChatFolderInviteLink#c890717e: field chat_folder_id: %w", err) - } - d.ChatFolderID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteChatFolderInviteLink#c890717e: field invite_link: %w", err) - } - d.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteChatFolderInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatFolderInviteLink#c890717e as nil") - } - b.ObjStart() - b.PutID("deleteChatFolderInviteLink") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(d.ChatFolderID) - b.Comma() - b.FieldStart("invite_link") - b.PutString(d.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteChatFolderInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatFolderInviteLink#c890717e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteChatFolderInviteLink"); err != nil { - return fmt.Errorf("unable to decode deleteChatFolderInviteLink#c890717e: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteChatFolderInviteLink#c890717e: field chat_folder_id: %w", err) - } - d.ChatFolderID = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteChatFolderInviteLink#c890717e: field invite_link: %w", err) - } - d.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (d *DeleteChatFolderInviteLinkRequest) GetChatFolderID() (value int32) { - if d == nil { - return - } - return d.ChatFolderID -} - -// GetInviteLink returns value of InviteLink field. -func (d *DeleteChatFolderInviteLinkRequest) GetInviteLink() (value string) { - if d == nil { - return - } - return d.InviteLink -} - -// DeleteChatFolderInviteLink invokes method deleteChatFolderInviteLink#c890717e returning error if any. -func (c *Client) DeleteChatFolderInviteLink(ctx context.Context, request *DeleteChatFolderInviteLinkRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_chat_gen.go b/tdapi/tl_delete_chat_gen.go deleted file mode 100644 index 9ffe88215..000000000 --- a/tdapi/tl_delete_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteChatRequest represents TL type `deleteChat#f5cae05e`. -type DeleteChatRequest struct { - // Chat identifier - ChatID int64 -} - -// DeleteChatRequestTypeID is TL type id of DeleteChatRequest. -const DeleteChatRequestTypeID = 0xf5cae05e - -// Ensuring interfaces in compile-time for DeleteChatRequest. -var ( - _ bin.Encoder = &DeleteChatRequest{} - _ bin.Decoder = &DeleteChatRequest{} - _ bin.BareEncoder = &DeleteChatRequest{} - _ bin.BareDecoder = &DeleteChatRequest{} -) - -func (d *DeleteChatRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteChatRequest) String() string { - if d == nil { - return "DeleteChatRequest(nil)" - } - type Alias DeleteChatRequest - return fmt.Sprintf("DeleteChatRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteChatRequest) TypeID() uint32 { - return DeleteChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteChatRequest) TypeName() string { - return "deleteChat" -} - -// TypeInfo returns info about TL type. -func (d *DeleteChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteChat", - ID: DeleteChatRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteChatRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChat#f5cae05e as nil") - } - b.PutID(DeleteChatRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteChatRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChat#f5cae05e as nil") - } - b.PutInt53(d.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteChatRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChat#f5cae05e to nil") - } - if err := b.ConsumeID(DeleteChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteChat#f5cae05e: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteChatRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChat#f5cae05e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChat#f5cae05e: field chat_id: %w", err) - } - d.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteChat#f5cae05e as nil") - } - b.ObjStart() - b.PutID("deleteChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(d.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteChat#f5cae05e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteChat"); err != nil { - return fmt.Errorf("unable to decode deleteChat#f5cae05e: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChat#f5cae05e: field chat_id: %w", err) - } - d.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (d *DeleteChatRequest) GetChatID() (value int64) { - if d == nil { - return - } - return d.ChatID -} - -// DeleteChat invokes method deleteChat#f5cae05e returning error if any. -func (c *Client) DeleteChat(ctx context.Context, chatid int64) error { - var ok Ok - - request := &DeleteChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_chat_history_gen.go b/tdapi/tl_delete_chat_history_gen.go deleted file mode 100644 index 817e6160e..000000000 --- a/tdapi/tl_delete_chat_history_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteChatHistoryRequest represents TL type `deleteChatHistory#a841d09f`. -type DeleteChatHistoryRequest struct { - // Chat identifier - ChatID int64 - // Pass true to remove the chat from all chat lists - RemoveFromChatList bool - // Pass true to delete chat history for all users - Revoke bool -} - -// DeleteChatHistoryRequestTypeID is TL type id of DeleteChatHistoryRequest. -const DeleteChatHistoryRequestTypeID = 0xa841d09f - -// Ensuring interfaces in compile-time for DeleteChatHistoryRequest. -var ( - _ bin.Encoder = &DeleteChatHistoryRequest{} - _ bin.Decoder = &DeleteChatHistoryRequest{} - _ bin.BareEncoder = &DeleteChatHistoryRequest{} - _ bin.BareDecoder = &DeleteChatHistoryRequest{} -) - -func (d *DeleteChatHistoryRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatID == 0) { - return false - } - if !(d.RemoveFromChatList == false) { - return false - } - if !(d.Revoke == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteChatHistoryRequest) String() string { - if d == nil { - return "DeleteChatHistoryRequest(nil)" - } - type Alias DeleteChatHistoryRequest - return fmt.Sprintf("DeleteChatHistoryRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteChatHistoryRequest) TypeID() uint32 { - return DeleteChatHistoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteChatHistoryRequest) TypeName() string { - return "deleteChatHistory" -} - -// TypeInfo returns info about TL type. -func (d *DeleteChatHistoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteChatHistory", - ID: DeleteChatHistoryRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "RemoveFromChatList", - SchemaName: "remove_from_chat_list", - }, - { - Name: "Revoke", - SchemaName: "revoke", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteChatHistoryRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatHistory#a841d09f as nil") - } - b.PutID(DeleteChatHistoryRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteChatHistoryRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatHistory#a841d09f as nil") - } - b.PutInt53(d.ChatID) - b.PutBool(d.RemoveFromChatList) - b.PutBool(d.Revoke) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteChatHistoryRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatHistory#a841d09f to nil") - } - if err := b.ConsumeID(DeleteChatHistoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteChatHistory#a841d09f: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteChatHistoryRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatHistory#a841d09f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatHistory#a841d09f: field chat_id: %w", err) - } - d.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteChatHistory#a841d09f: field remove_from_chat_list: %w", err) - } - d.RemoveFromChatList = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteChatHistory#a841d09f: field revoke: %w", err) - } - d.Revoke = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteChatHistoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatHistory#a841d09f as nil") - } - b.ObjStart() - b.PutID("deleteChatHistory") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(d.ChatID) - b.Comma() - b.FieldStart("remove_from_chat_list") - b.PutBool(d.RemoveFromChatList) - b.Comma() - b.FieldStart("revoke") - b.PutBool(d.Revoke) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteChatHistoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatHistory#a841d09f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteChatHistory"); err != nil { - return fmt.Errorf("unable to decode deleteChatHistory#a841d09f: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatHistory#a841d09f: field chat_id: %w", err) - } - d.ChatID = value - case "remove_from_chat_list": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteChatHistory#a841d09f: field remove_from_chat_list: %w", err) - } - d.RemoveFromChatList = value - case "revoke": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteChatHistory#a841d09f: field revoke: %w", err) - } - d.Revoke = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (d *DeleteChatHistoryRequest) GetChatID() (value int64) { - if d == nil { - return - } - return d.ChatID -} - -// GetRemoveFromChatList returns value of RemoveFromChatList field. -func (d *DeleteChatHistoryRequest) GetRemoveFromChatList() (value bool) { - if d == nil { - return - } - return d.RemoveFromChatList -} - -// GetRevoke returns value of Revoke field. -func (d *DeleteChatHistoryRequest) GetRevoke() (value bool) { - if d == nil { - return - } - return d.Revoke -} - -// DeleteChatHistory invokes method deleteChatHistory#a841d09f returning error if any. -func (c *Client) DeleteChatHistory(ctx context.Context, request *DeleteChatHistoryRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_chat_messages_by_date_gen.go b/tdapi/tl_delete_chat_messages_by_date_gen.go deleted file mode 100644 index dfc990120..000000000 --- a/tdapi/tl_delete_chat_messages_by_date_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteChatMessagesByDateRequest represents TL type `deleteChatMessagesByDate#9e44e0bf`. -type DeleteChatMessagesByDateRequest struct { - // Chat identifier - ChatID int64 - // The minimum date of the messages to delete - MinDate int32 - // The maximum date of the messages to delete - MaxDate int32 - // Pass true to delete chat messages for all users; private chats only - Revoke bool -} - -// DeleteChatMessagesByDateRequestTypeID is TL type id of DeleteChatMessagesByDateRequest. -const DeleteChatMessagesByDateRequestTypeID = 0x9e44e0bf - -// Ensuring interfaces in compile-time for DeleteChatMessagesByDateRequest. -var ( - _ bin.Encoder = &DeleteChatMessagesByDateRequest{} - _ bin.Decoder = &DeleteChatMessagesByDateRequest{} - _ bin.BareEncoder = &DeleteChatMessagesByDateRequest{} - _ bin.BareDecoder = &DeleteChatMessagesByDateRequest{} -) - -func (d *DeleteChatMessagesByDateRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatID == 0) { - return false - } - if !(d.MinDate == 0) { - return false - } - if !(d.MaxDate == 0) { - return false - } - if !(d.Revoke == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteChatMessagesByDateRequest) String() string { - if d == nil { - return "DeleteChatMessagesByDateRequest(nil)" - } - type Alias DeleteChatMessagesByDateRequest - return fmt.Sprintf("DeleteChatMessagesByDateRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteChatMessagesByDateRequest) TypeID() uint32 { - return DeleteChatMessagesByDateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteChatMessagesByDateRequest) TypeName() string { - return "deleteChatMessagesByDate" -} - -// TypeInfo returns info about TL type. -func (d *DeleteChatMessagesByDateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteChatMessagesByDate", - ID: DeleteChatMessagesByDateRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MinDate", - SchemaName: "min_date", - }, - { - Name: "MaxDate", - SchemaName: "max_date", - }, - { - Name: "Revoke", - SchemaName: "revoke", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteChatMessagesByDateRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatMessagesByDate#9e44e0bf as nil") - } - b.PutID(DeleteChatMessagesByDateRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteChatMessagesByDateRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatMessagesByDate#9e44e0bf as nil") - } - b.PutInt53(d.ChatID) - b.PutInt32(d.MinDate) - b.PutInt32(d.MaxDate) - b.PutBool(d.Revoke) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteChatMessagesByDateRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatMessagesByDate#9e44e0bf to nil") - } - if err := b.ConsumeID(DeleteChatMessagesByDateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesByDate#9e44e0bf: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteChatMessagesByDateRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatMessagesByDate#9e44e0bf to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesByDate#9e44e0bf: field chat_id: %w", err) - } - d.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesByDate#9e44e0bf: field min_date: %w", err) - } - d.MinDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesByDate#9e44e0bf: field max_date: %w", err) - } - d.MaxDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesByDate#9e44e0bf: field revoke: %w", err) - } - d.Revoke = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteChatMessagesByDateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatMessagesByDate#9e44e0bf as nil") - } - b.ObjStart() - b.PutID("deleteChatMessagesByDate") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(d.ChatID) - b.Comma() - b.FieldStart("min_date") - b.PutInt32(d.MinDate) - b.Comma() - b.FieldStart("max_date") - b.PutInt32(d.MaxDate) - b.Comma() - b.FieldStart("revoke") - b.PutBool(d.Revoke) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteChatMessagesByDateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatMessagesByDate#9e44e0bf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteChatMessagesByDate"); err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesByDate#9e44e0bf: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesByDate#9e44e0bf: field chat_id: %w", err) - } - d.ChatID = value - case "min_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesByDate#9e44e0bf: field min_date: %w", err) - } - d.MinDate = value - case "max_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesByDate#9e44e0bf: field max_date: %w", err) - } - d.MaxDate = value - case "revoke": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesByDate#9e44e0bf: field revoke: %w", err) - } - d.Revoke = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (d *DeleteChatMessagesByDateRequest) GetChatID() (value int64) { - if d == nil { - return - } - return d.ChatID -} - -// GetMinDate returns value of MinDate field. -func (d *DeleteChatMessagesByDateRequest) GetMinDate() (value int32) { - if d == nil { - return - } - return d.MinDate -} - -// GetMaxDate returns value of MaxDate field. -func (d *DeleteChatMessagesByDateRequest) GetMaxDate() (value int32) { - if d == nil { - return - } - return d.MaxDate -} - -// GetRevoke returns value of Revoke field. -func (d *DeleteChatMessagesByDateRequest) GetRevoke() (value bool) { - if d == nil { - return - } - return d.Revoke -} - -// DeleteChatMessagesByDate invokes method deleteChatMessagesByDate#9e44e0bf returning error if any. -func (c *Client) DeleteChatMessagesByDate(ctx context.Context, request *DeleteChatMessagesByDateRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_chat_messages_by_sender_gen.go b/tdapi/tl_delete_chat_messages_by_sender_gen.go deleted file mode 100644 index f6edff3f0..000000000 --- a/tdapi/tl_delete_chat_messages_by_sender_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteChatMessagesBySenderRequest represents TL type `deleteChatMessagesBySender#ba9b2e67`. -type DeleteChatMessagesBySenderRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the sender of messages to delete - SenderID MessageSenderClass -} - -// DeleteChatMessagesBySenderRequestTypeID is TL type id of DeleteChatMessagesBySenderRequest. -const DeleteChatMessagesBySenderRequestTypeID = 0xba9b2e67 - -// Ensuring interfaces in compile-time for DeleteChatMessagesBySenderRequest. -var ( - _ bin.Encoder = &DeleteChatMessagesBySenderRequest{} - _ bin.Decoder = &DeleteChatMessagesBySenderRequest{} - _ bin.BareEncoder = &DeleteChatMessagesBySenderRequest{} - _ bin.BareDecoder = &DeleteChatMessagesBySenderRequest{} -) - -func (d *DeleteChatMessagesBySenderRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatID == 0) { - return false - } - if !(d.SenderID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteChatMessagesBySenderRequest) String() string { - if d == nil { - return "DeleteChatMessagesBySenderRequest(nil)" - } - type Alias DeleteChatMessagesBySenderRequest - return fmt.Sprintf("DeleteChatMessagesBySenderRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteChatMessagesBySenderRequest) TypeID() uint32 { - return DeleteChatMessagesBySenderRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteChatMessagesBySenderRequest) TypeName() string { - return "deleteChatMessagesBySender" -} - -// TypeInfo returns info about TL type. -func (d *DeleteChatMessagesBySenderRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteChatMessagesBySender", - ID: DeleteChatMessagesBySenderRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "SenderID", - SchemaName: "sender_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteChatMessagesBySenderRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatMessagesBySender#ba9b2e67 as nil") - } - b.PutID(DeleteChatMessagesBySenderRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteChatMessagesBySenderRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatMessagesBySender#ba9b2e67 as nil") - } - b.PutInt53(d.ChatID) - if d.SenderID == nil { - return fmt.Errorf("unable to encode deleteChatMessagesBySender#ba9b2e67: field sender_id is nil") - } - if err := d.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode deleteChatMessagesBySender#ba9b2e67: field sender_id: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteChatMessagesBySenderRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatMessagesBySender#ba9b2e67 to nil") - } - if err := b.ConsumeID(DeleteChatMessagesBySenderRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesBySender#ba9b2e67: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteChatMessagesBySenderRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatMessagesBySender#ba9b2e67 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesBySender#ba9b2e67: field chat_id: %w", err) - } - d.ChatID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesBySender#ba9b2e67: field sender_id: %w", err) - } - d.SenderID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteChatMessagesBySenderRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatMessagesBySender#ba9b2e67 as nil") - } - b.ObjStart() - b.PutID("deleteChatMessagesBySender") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(d.ChatID) - b.Comma() - b.FieldStart("sender_id") - if d.SenderID == nil { - return fmt.Errorf("unable to encode deleteChatMessagesBySender#ba9b2e67: field sender_id is nil") - } - if err := d.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode deleteChatMessagesBySender#ba9b2e67: field sender_id: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteChatMessagesBySenderRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatMessagesBySender#ba9b2e67 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteChatMessagesBySender"); err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesBySender#ba9b2e67: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesBySender#ba9b2e67: field chat_id: %w", err) - } - d.ChatID = value - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode deleteChatMessagesBySender#ba9b2e67: field sender_id: %w", err) - } - d.SenderID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (d *DeleteChatMessagesBySenderRequest) GetChatID() (value int64) { - if d == nil { - return - } - return d.ChatID -} - -// GetSenderID returns value of SenderID field. -func (d *DeleteChatMessagesBySenderRequest) GetSenderID() (value MessageSenderClass) { - if d == nil { - return - } - return d.SenderID -} - -// DeleteChatMessagesBySender invokes method deleteChatMessagesBySender#ba9b2e67 returning error if any. -func (c *Client) DeleteChatMessagesBySender(ctx context.Context, request *DeleteChatMessagesBySenderRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_chat_reply_markup_gen.go b/tdapi/tl_delete_chat_reply_markup_gen.go deleted file mode 100644 index be3f97e8b..000000000 --- a/tdapi/tl_delete_chat_reply_markup_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteChatReplyMarkupRequest represents TL type `deleteChatReplyMarkup#5ff9b5b`. -type DeleteChatReplyMarkupRequest struct { - // Chat identifier - ChatID int64 - // The message identifier of the used keyboard - MessageID int64 -} - -// DeleteChatReplyMarkupRequestTypeID is TL type id of DeleteChatReplyMarkupRequest. -const DeleteChatReplyMarkupRequestTypeID = 0x5ff9b5b - -// Ensuring interfaces in compile-time for DeleteChatReplyMarkupRequest. -var ( - _ bin.Encoder = &DeleteChatReplyMarkupRequest{} - _ bin.Decoder = &DeleteChatReplyMarkupRequest{} - _ bin.BareEncoder = &DeleteChatReplyMarkupRequest{} - _ bin.BareDecoder = &DeleteChatReplyMarkupRequest{} -) - -func (d *DeleteChatReplyMarkupRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatID == 0) { - return false - } - if !(d.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteChatReplyMarkupRequest) String() string { - if d == nil { - return "DeleteChatReplyMarkupRequest(nil)" - } - type Alias DeleteChatReplyMarkupRequest - return fmt.Sprintf("DeleteChatReplyMarkupRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteChatReplyMarkupRequest) TypeID() uint32 { - return DeleteChatReplyMarkupRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteChatReplyMarkupRequest) TypeName() string { - return "deleteChatReplyMarkup" -} - -// TypeInfo returns info about TL type. -func (d *DeleteChatReplyMarkupRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteChatReplyMarkup", - ID: DeleteChatReplyMarkupRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteChatReplyMarkupRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatReplyMarkup#5ff9b5b as nil") - } - b.PutID(DeleteChatReplyMarkupRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteChatReplyMarkupRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatReplyMarkup#5ff9b5b as nil") - } - b.PutInt53(d.ChatID) - b.PutInt53(d.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteChatReplyMarkupRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatReplyMarkup#5ff9b5b to nil") - } - if err := b.ConsumeID(DeleteChatReplyMarkupRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteChatReplyMarkup#5ff9b5b: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteChatReplyMarkupRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatReplyMarkup#5ff9b5b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatReplyMarkup#5ff9b5b: field chat_id: %w", err) - } - d.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatReplyMarkup#5ff9b5b: field message_id: %w", err) - } - d.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteChatReplyMarkupRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteChatReplyMarkup#5ff9b5b as nil") - } - b.ObjStart() - b.PutID("deleteChatReplyMarkup") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(d.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(d.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteChatReplyMarkupRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteChatReplyMarkup#5ff9b5b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteChatReplyMarkup"); err != nil { - return fmt.Errorf("unable to decode deleteChatReplyMarkup#5ff9b5b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatReplyMarkup#5ff9b5b: field chat_id: %w", err) - } - d.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteChatReplyMarkup#5ff9b5b: field message_id: %w", err) - } - d.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (d *DeleteChatReplyMarkupRequest) GetChatID() (value int64) { - if d == nil { - return - } - return d.ChatID -} - -// GetMessageID returns value of MessageID field. -func (d *DeleteChatReplyMarkupRequest) GetMessageID() (value int64) { - if d == nil { - return - } - return d.MessageID -} - -// DeleteChatReplyMarkup invokes method deleteChatReplyMarkup#5ff9b5b returning error if any. -func (c *Client) DeleteChatReplyMarkup(ctx context.Context, request *DeleteChatReplyMarkupRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_commands_gen.go b/tdapi/tl_delete_commands_gen.go deleted file mode 100644 index d3b3b91fb..000000000 --- a/tdapi/tl_delete_commands_gen.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteCommandsRequest represents TL type `deleteCommands#3bc47c2a`. -type DeleteCommandsRequest struct { - // The scope to which the commands are relevant; pass null to delete commands in the - // default bot command scope - Scope BotCommandScopeClass - // A two-letter ISO 639-1 language code or an empty string - LanguageCode string -} - -// DeleteCommandsRequestTypeID is TL type id of DeleteCommandsRequest. -const DeleteCommandsRequestTypeID = 0x3bc47c2a - -// Ensuring interfaces in compile-time for DeleteCommandsRequest. -var ( - _ bin.Encoder = &DeleteCommandsRequest{} - _ bin.Decoder = &DeleteCommandsRequest{} - _ bin.BareEncoder = &DeleteCommandsRequest{} - _ bin.BareDecoder = &DeleteCommandsRequest{} -) - -func (d *DeleteCommandsRequest) Zero() bool { - if d == nil { - return true - } - if !(d.Scope == nil) { - return false - } - if !(d.LanguageCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteCommandsRequest) String() string { - if d == nil { - return "DeleteCommandsRequest(nil)" - } - type Alias DeleteCommandsRequest - return fmt.Sprintf("DeleteCommandsRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteCommandsRequest) TypeID() uint32 { - return DeleteCommandsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteCommandsRequest) TypeName() string { - return "deleteCommands" -} - -// TypeInfo returns info about TL type. -func (d *DeleteCommandsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteCommands", - ID: DeleteCommandsRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Scope", - SchemaName: "scope", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteCommandsRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteCommands#3bc47c2a as nil") - } - b.PutID(DeleteCommandsRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteCommandsRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteCommands#3bc47c2a as nil") - } - if d.Scope == nil { - return fmt.Errorf("unable to encode deleteCommands#3bc47c2a: field scope is nil") - } - if err := d.Scope.Encode(b); err != nil { - return fmt.Errorf("unable to encode deleteCommands#3bc47c2a: field scope: %w", err) - } - b.PutString(d.LanguageCode) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteCommandsRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteCommands#3bc47c2a to nil") - } - if err := b.ConsumeID(DeleteCommandsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteCommands#3bc47c2a: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteCommandsRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteCommands#3bc47c2a to nil") - } - { - value, err := DecodeBotCommandScope(b) - if err != nil { - return fmt.Errorf("unable to decode deleteCommands#3bc47c2a: field scope: %w", err) - } - d.Scope = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteCommands#3bc47c2a: field language_code: %w", err) - } - d.LanguageCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteCommandsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteCommands#3bc47c2a as nil") - } - b.ObjStart() - b.PutID("deleteCommands") - b.Comma() - b.FieldStart("scope") - if d.Scope == nil { - return fmt.Errorf("unable to encode deleteCommands#3bc47c2a: field scope is nil") - } - if err := d.Scope.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode deleteCommands#3bc47c2a: field scope: %w", err) - } - b.Comma() - b.FieldStart("language_code") - b.PutString(d.LanguageCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteCommandsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteCommands#3bc47c2a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteCommands"); err != nil { - return fmt.Errorf("unable to decode deleteCommands#3bc47c2a: %w", err) - } - case "scope": - value, err := DecodeTDLibJSONBotCommandScope(b) - if err != nil { - return fmt.Errorf("unable to decode deleteCommands#3bc47c2a: field scope: %w", err) - } - d.Scope = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteCommands#3bc47c2a: field language_code: %w", err) - } - d.LanguageCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetScope returns value of Scope field. -func (d *DeleteCommandsRequest) GetScope() (value BotCommandScopeClass) { - if d == nil { - return - } - return d.Scope -} - -// GetLanguageCode returns value of LanguageCode field. -func (d *DeleteCommandsRequest) GetLanguageCode() (value string) { - if d == nil { - return - } - return d.LanguageCode -} - -// DeleteCommands invokes method deleteCommands#3bc47c2a returning error if any. -func (c *Client) DeleteCommands(ctx context.Context, request *DeleteCommandsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_default_background_gen.go b/tdapi/tl_delete_default_background_gen.go deleted file mode 100644 index 63c26b154..000000000 --- a/tdapi/tl_delete_default_background_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteDefaultBackgroundRequest represents TL type `deleteDefaultBackground#b2a4ed3e`. -type DeleteDefaultBackgroundRequest struct { - // Pass true if the background is deleted for a dark theme - ForDarkTheme bool -} - -// DeleteDefaultBackgroundRequestTypeID is TL type id of DeleteDefaultBackgroundRequest. -const DeleteDefaultBackgroundRequestTypeID = 0xb2a4ed3e - -// Ensuring interfaces in compile-time for DeleteDefaultBackgroundRequest. -var ( - _ bin.Encoder = &DeleteDefaultBackgroundRequest{} - _ bin.Decoder = &DeleteDefaultBackgroundRequest{} - _ bin.BareEncoder = &DeleteDefaultBackgroundRequest{} - _ bin.BareDecoder = &DeleteDefaultBackgroundRequest{} -) - -func (d *DeleteDefaultBackgroundRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ForDarkTheme == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteDefaultBackgroundRequest) String() string { - if d == nil { - return "DeleteDefaultBackgroundRequest(nil)" - } - type Alias DeleteDefaultBackgroundRequest - return fmt.Sprintf("DeleteDefaultBackgroundRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteDefaultBackgroundRequest) TypeID() uint32 { - return DeleteDefaultBackgroundRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteDefaultBackgroundRequest) TypeName() string { - return "deleteDefaultBackground" -} - -// TypeInfo returns info about TL type. -func (d *DeleteDefaultBackgroundRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteDefaultBackground", - ID: DeleteDefaultBackgroundRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ForDarkTheme", - SchemaName: "for_dark_theme", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteDefaultBackgroundRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteDefaultBackground#b2a4ed3e as nil") - } - b.PutID(DeleteDefaultBackgroundRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteDefaultBackgroundRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteDefaultBackground#b2a4ed3e as nil") - } - b.PutBool(d.ForDarkTheme) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteDefaultBackgroundRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteDefaultBackground#b2a4ed3e to nil") - } - if err := b.ConsumeID(DeleteDefaultBackgroundRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteDefaultBackground#b2a4ed3e: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteDefaultBackgroundRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteDefaultBackground#b2a4ed3e to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteDefaultBackground#b2a4ed3e: field for_dark_theme: %w", err) - } - d.ForDarkTheme = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteDefaultBackgroundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteDefaultBackground#b2a4ed3e as nil") - } - b.ObjStart() - b.PutID("deleteDefaultBackground") - b.Comma() - b.FieldStart("for_dark_theme") - b.PutBool(d.ForDarkTheme) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteDefaultBackgroundRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteDefaultBackground#b2a4ed3e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteDefaultBackground"); err != nil { - return fmt.Errorf("unable to decode deleteDefaultBackground#b2a4ed3e: %w", err) - } - case "for_dark_theme": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteDefaultBackground#b2a4ed3e: field for_dark_theme: %w", err) - } - d.ForDarkTheme = value - default: - return b.Skip() - } - return nil - }) -} - -// GetForDarkTheme returns value of ForDarkTheme field. -func (d *DeleteDefaultBackgroundRequest) GetForDarkTheme() (value bool) { - if d == nil { - return - } - return d.ForDarkTheme -} - -// DeleteDefaultBackground invokes method deleteDefaultBackground#b2a4ed3e returning error if any. -func (c *Client) DeleteDefaultBackground(ctx context.Context, fordarktheme bool) error { - var ok Ok - - request := &DeleteDefaultBackgroundRequest{ - ForDarkTheme: fordarktheme, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_file_gen.go b/tdapi/tl_delete_file_gen.go deleted file mode 100644 index 0bebaceb7..000000000 --- a/tdapi/tl_delete_file_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteFileRequest represents TL type `deleteFile#6bbe9b2c`. -type DeleteFileRequest struct { - // Identifier of the file to delete - FileID int32 -} - -// DeleteFileRequestTypeID is TL type id of DeleteFileRequest. -const DeleteFileRequestTypeID = 0x6bbe9b2c - -// Ensuring interfaces in compile-time for DeleteFileRequest. -var ( - _ bin.Encoder = &DeleteFileRequest{} - _ bin.Decoder = &DeleteFileRequest{} - _ bin.BareEncoder = &DeleteFileRequest{} - _ bin.BareDecoder = &DeleteFileRequest{} -) - -func (d *DeleteFileRequest) Zero() bool { - if d == nil { - return true - } - if !(d.FileID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteFileRequest) String() string { - if d == nil { - return "DeleteFileRequest(nil)" - } - type Alias DeleteFileRequest - return fmt.Sprintf("DeleteFileRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteFileRequest) TypeID() uint32 { - return DeleteFileRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteFileRequest) TypeName() string { - return "deleteFile" -} - -// TypeInfo returns info about TL type. -func (d *DeleteFileRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteFile", - ID: DeleteFileRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteFileRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteFile#6bbe9b2c as nil") - } - b.PutID(DeleteFileRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteFileRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteFile#6bbe9b2c as nil") - } - b.PutInt32(d.FileID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteFileRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteFile#6bbe9b2c to nil") - } - if err := b.ConsumeID(DeleteFileRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteFile#6bbe9b2c: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteFileRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteFile#6bbe9b2c to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteFile#6bbe9b2c: field file_id: %w", err) - } - d.FileID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteFile#6bbe9b2c as nil") - } - b.ObjStart() - b.PutID("deleteFile") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(d.FileID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteFileRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteFile#6bbe9b2c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteFile"); err != nil { - return fmt.Errorf("unable to decode deleteFile#6bbe9b2c: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteFile#6bbe9b2c: field file_id: %w", err) - } - d.FileID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (d *DeleteFileRequest) GetFileID() (value int32) { - if d == nil { - return - } - return d.FileID -} - -// DeleteFile invokes method deleteFile#6bbe9b2c returning error if any. -func (c *Client) DeleteFile(ctx context.Context, fileid int32) error { - var ok Ok - - request := &DeleteFileRequest{ - FileID: fileid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_forum_topic_gen.go b/tdapi/tl_delete_forum_topic_gen.go deleted file mode 100644 index 5ba9e6c12..000000000 --- a/tdapi/tl_delete_forum_topic_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteForumTopicRequest represents TL type `deleteForumTopic#6f285cb8`. -type DeleteForumTopicRequest struct { - // Identifier of the chat - ChatID int64 - // Message thread identifier of the forum topic - MessageThreadID int64 -} - -// DeleteForumTopicRequestTypeID is TL type id of DeleteForumTopicRequest. -const DeleteForumTopicRequestTypeID = 0x6f285cb8 - -// Ensuring interfaces in compile-time for DeleteForumTopicRequest. -var ( - _ bin.Encoder = &DeleteForumTopicRequest{} - _ bin.Decoder = &DeleteForumTopicRequest{} - _ bin.BareEncoder = &DeleteForumTopicRequest{} - _ bin.BareDecoder = &DeleteForumTopicRequest{} -) - -func (d *DeleteForumTopicRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatID == 0) { - return false - } - if !(d.MessageThreadID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteForumTopicRequest) String() string { - if d == nil { - return "DeleteForumTopicRequest(nil)" - } - type Alias DeleteForumTopicRequest - return fmt.Sprintf("DeleteForumTopicRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteForumTopicRequest) TypeID() uint32 { - return DeleteForumTopicRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteForumTopicRequest) TypeName() string { - return "deleteForumTopic" -} - -// TypeInfo returns info about TL type. -func (d *DeleteForumTopicRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteForumTopic", - ID: DeleteForumTopicRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteForumTopicRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteForumTopic#6f285cb8 as nil") - } - b.PutID(DeleteForumTopicRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteForumTopicRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteForumTopic#6f285cb8 as nil") - } - b.PutInt53(d.ChatID) - b.PutInt53(d.MessageThreadID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteForumTopicRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteForumTopic#6f285cb8 to nil") - } - if err := b.ConsumeID(DeleteForumTopicRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteForumTopic#6f285cb8: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteForumTopicRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteForumTopic#6f285cb8 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteForumTopic#6f285cb8: field chat_id: %w", err) - } - d.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteForumTopic#6f285cb8: field message_thread_id: %w", err) - } - d.MessageThreadID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteForumTopicRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteForumTopic#6f285cb8 as nil") - } - b.ObjStart() - b.PutID("deleteForumTopic") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(d.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(d.MessageThreadID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteForumTopicRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteForumTopic#6f285cb8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteForumTopic"); err != nil { - return fmt.Errorf("unable to decode deleteForumTopic#6f285cb8: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteForumTopic#6f285cb8: field chat_id: %w", err) - } - d.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteForumTopic#6f285cb8: field message_thread_id: %w", err) - } - d.MessageThreadID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (d *DeleteForumTopicRequest) GetChatID() (value int64) { - if d == nil { - return - } - return d.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (d *DeleteForumTopicRequest) GetMessageThreadID() (value int64) { - if d == nil { - return - } - return d.MessageThreadID -} - -// DeleteForumTopic invokes method deleteForumTopic#6f285cb8 returning error if any. -func (c *Client) DeleteForumTopic(ctx context.Context, request *DeleteForumTopicRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_language_pack_gen.go b/tdapi/tl_delete_language_pack_gen.go deleted file mode 100644 index f2a139101..000000000 --- a/tdapi/tl_delete_language_pack_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteLanguagePackRequest represents TL type `deleteLanguagePack#824edc3e`. -type DeleteLanguagePackRequest struct { - // Identifier of the language pack to delete - LanguagePackID string -} - -// DeleteLanguagePackRequestTypeID is TL type id of DeleteLanguagePackRequest. -const DeleteLanguagePackRequestTypeID = 0x824edc3e - -// Ensuring interfaces in compile-time for DeleteLanguagePackRequest. -var ( - _ bin.Encoder = &DeleteLanguagePackRequest{} - _ bin.Decoder = &DeleteLanguagePackRequest{} - _ bin.BareEncoder = &DeleteLanguagePackRequest{} - _ bin.BareDecoder = &DeleteLanguagePackRequest{} -) - -func (d *DeleteLanguagePackRequest) Zero() bool { - if d == nil { - return true - } - if !(d.LanguagePackID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteLanguagePackRequest) String() string { - if d == nil { - return "DeleteLanguagePackRequest(nil)" - } - type Alias DeleteLanguagePackRequest - return fmt.Sprintf("DeleteLanguagePackRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteLanguagePackRequest) TypeID() uint32 { - return DeleteLanguagePackRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteLanguagePackRequest) TypeName() string { - return "deleteLanguagePack" -} - -// TypeInfo returns info about TL type. -func (d *DeleteLanguagePackRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteLanguagePack", - ID: DeleteLanguagePackRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LanguagePackID", - SchemaName: "language_pack_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteLanguagePackRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteLanguagePack#824edc3e as nil") - } - b.PutID(DeleteLanguagePackRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteLanguagePackRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteLanguagePack#824edc3e as nil") - } - b.PutString(d.LanguagePackID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteLanguagePackRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteLanguagePack#824edc3e to nil") - } - if err := b.ConsumeID(DeleteLanguagePackRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteLanguagePack#824edc3e: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteLanguagePackRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteLanguagePack#824edc3e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteLanguagePack#824edc3e: field language_pack_id: %w", err) - } - d.LanguagePackID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteLanguagePackRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteLanguagePack#824edc3e as nil") - } - b.ObjStart() - b.PutID("deleteLanguagePack") - b.Comma() - b.FieldStart("language_pack_id") - b.PutString(d.LanguagePackID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteLanguagePackRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteLanguagePack#824edc3e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteLanguagePack"); err != nil { - return fmt.Errorf("unable to decode deleteLanguagePack#824edc3e: %w", err) - } - case "language_pack_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteLanguagePack#824edc3e: field language_pack_id: %w", err) - } - d.LanguagePackID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguagePackID returns value of LanguagePackID field. -func (d *DeleteLanguagePackRequest) GetLanguagePackID() (value string) { - if d == nil { - return - } - return d.LanguagePackID -} - -// DeleteLanguagePack invokes method deleteLanguagePack#824edc3e returning error if any. -func (c *Client) DeleteLanguagePack(ctx context.Context, languagepackid string) error { - var ok Ok - - request := &DeleteLanguagePackRequest{ - LanguagePackID: languagepackid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_messages_gen.go b/tdapi/tl_delete_messages_gen.go deleted file mode 100644 index 64e099ddd..000000000 --- a/tdapi/tl_delete_messages_gen.go +++ /dev/null @@ -1,298 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteMessagesRequest represents TL type `deleteMessages#c3ed9de2`. -type DeleteMessagesRequest struct { - // Chat identifier - ChatID int64 - // Identifiers of the messages to be deleted. Use messageProperties - // can_be_deleted_only_for_self and messageProperties.can_be_deleted_for_all_users to get - // suitable messages - MessageIDs []int64 - // Pass true to delete messages for all chat members. Always true for supergroups, - // channels and secret chats - Revoke bool -} - -// DeleteMessagesRequestTypeID is TL type id of DeleteMessagesRequest. -const DeleteMessagesRequestTypeID = 0xc3ed9de2 - -// Ensuring interfaces in compile-time for DeleteMessagesRequest. -var ( - _ bin.Encoder = &DeleteMessagesRequest{} - _ bin.Decoder = &DeleteMessagesRequest{} - _ bin.BareEncoder = &DeleteMessagesRequest{} - _ bin.BareDecoder = &DeleteMessagesRequest{} -) - -func (d *DeleteMessagesRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatID == 0) { - return false - } - if !(d.MessageIDs == nil) { - return false - } - if !(d.Revoke == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteMessagesRequest) String() string { - if d == nil { - return "DeleteMessagesRequest(nil)" - } - type Alias DeleteMessagesRequest - return fmt.Sprintf("DeleteMessagesRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteMessagesRequest) TypeID() uint32 { - return DeleteMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteMessagesRequest) TypeName() string { - return "deleteMessages" -} - -// TypeInfo returns info about TL type. -func (d *DeleteMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteMessages", - ID: DeleteMessagesRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageIDs", - SchemaName: "message_ids", - }, - { - Name: "Revoke", - SchemaName: "revoke", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteMessagesRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteMessages#c3ed9de2 as nil") - } - b.PutID(DeleteMessagesRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteMessagesRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteMessages#c3ed9de2 as nil") - } - b.PutInt53(d.ChatID) - b.PutInt(len(d.MessageIDs)) - for _, v := range d.MessageIDs { - b.PutInt53(v) - } - b.PutBool(d.Revoke) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteMessagesRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteMessages#c3ed9de2 to nil") - } - if err := b.ConsumeID(DeleteMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteMessages#c3ed9de2: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteMessagesRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteMessages#c3ed9de2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteMessages#c3ed9de2: field chat_id: %w", err) - } - d.ChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode deleteMessages#c3ed9de2: field message_ids: %w", err) - } - - if headerLen > 0 { - d.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteMessages#c3ed9de2: field message_ids: %w", err) - } - d.MessageIDs = append(d.MessageIDs, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteMessages#c3ed9de2: field revoke: %w", err) - } - d.Revoke = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteMessages#c3ed9de2 as nil") - } - b.ObjStart() - b.PutID("deleteMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(d.ChatID) - b.Comma() - b.FieldStart("message_ids") - b.ArrStart() - for _, v := range d.MessageIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("revoke") - b.PutBool(d.Revoke) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteMessages#c3ed9de2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteMessages"); err != nil { - return fmt.Errorf("unable to decode deleteMessages#c3ed9de2: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteMessages#c3ed9de2: field chat_id: %w", err) - } - d.ChatID = value - case "message_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteMessages#c3ed9de2: field message_ids: %w", err) - } - d.MessageIDs = append(d.MessageIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode deleteMessages#c3ed9de2: field message_ids: %w", err) - } - case "revoke": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deleteMessages#c3ed9de2: field revoke: %w", err) - } - d.Revoke = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (d *DeleteMessagesRequest) GetChatID() (value int64) { - if d == nil { - return - } - return d.ChatID -} - -// GetMessageIDs returns value of MessageIDs field. -func (d *DeleteMessagesRequest) GetMessageIDs() (value []int64) { - if d == nil { - return - } - return d.MessageIDs -} - -// GetRevoke returns value of Revoke field. -func (d *DeleteMessagesRequest) GetRevoke() (value bool) { - if d == nil { - return - } - return d.Revoke -} - -// DeleteMessages invokes method deleteMessages#c3ed9de2 returning error if any. -func (c *Client) DeleteMessages(ctx context.Context, request *DeleteMessagesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_passport_element_gen.go b/tdapi/tl_delete_passport_element_gen.go deleted file mode 100644 index d07a8367d..000000000 --- a/tdapi/tl_delete_passport_element_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeletePassportElementRequest represents TL type `deletePassportElement#9981aa74`. -type DeletePassportElementRequest struct { - // Element type - Type PassportElementTypeClass -} - -// DeletePassportElementRequestTypeID is TL type id of DeletePassportElementRequest. -const DeletePassportElementRequestTypeID = 0x9981aa74 - -// Ensuring interfaces in compile-time for DeletePassportElementRequest. -var ( - _ bin.Encoder = &DeletePassportElementRequest{} - _ bin.Decoder = &DeletePassportElementRequest{} - _ bin.BareEncoder = &DeletePassportElementRequest{} - _ bin.BareDecoder = &DeletePassportElementRequest{} -) - -func (d *DeletePassportElementRequest) Zero() bool { - if d == nil { - return true - } - if !(d.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeletePassportElementRequest) String() string { - if d == nil { - return "DeletePassportElementRequest(nil)" - } - type Alias DeletePassportElementRequest - return fmt.Sprintf("DeletePassportElementRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeletePassportElementRequest) TypeID() uint32 { - return DeletePassportElementRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeletePassportElementRequest) TypeName() string { - return "deletePassportElement" -} - -// TypeInfo returns info about TL type. -func (d *DeletePassportElementRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deletePassportElement", - ID: DeletePassportElementRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeletePassportElementRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deletePassportElement#9981aa74 as nil") - } - b.PutID(DeletePassportElementRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeletePassportElementRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deletePassportElement#9981aa74 as nil") - } - if d.Type == nil { - return fmt.Errorf("unable to encode deletePassportElement#9981aa74: field type is nil") - } - if err := d.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode deletePassportElement#9981aa74: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DeletePassportElementRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deletePassportElement#9981aa74 to nil") - } - if err := b.ConsumeID(DeletePassportElementRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deletePassportElement#9981aa74: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeletePassportElementRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deletePassportElement#9981aa74 to nil") - } - { - value, err := DecodePassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode deletePassportElement#9981aa74: field type: %w", err) - } - d.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeletePassportElementRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deletePassportElement#9981aa74 as nil") - } - b.ObjStart() - b.PutID("deletePassportElement") - b.Comma() - b.FieldStart("type") - if d.Type == nil { - return fmt.Errorf("unable to encode deletePassportElement#9981aa74: field type is nil") - } - if err := d.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode deletePassportElement#9981aa74: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeletePassportElementRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deletePassportElement#9981aa74 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deletePassportElement"); err != nil { - return fmt.Errorf("unable to decode deletePassportElement#9981aa74: %w", err) - } - case "type": - value, err := DecodeTDLibJSONPassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode deletePassportElement#9981aa74: field type: %w", err) - } - d.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (d *DeletePassportElementRequest) GetType() (value PassportElementTypeClass) { - if d == nil { - return - } - return d.Type -} - -// DeletePassportElement invokes method deletePassportElement#9981aa74 returning error if any. -func (c *Client) DeletePassportElement(ctx context.Context, type_ PassportElementTypeClass) error { - var ok Ok - - request := &DeletePassportElementRequest{ - Type: type_, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_profile_photo_gen.go b/tdapi/tl_delete_profile_photo_gen.go deleted file mode 100644 index d7cbcf898..000000000 --- a/tdapi/tl_delete_profile_photo_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteProfilePhotoRequest represents TL type `deleteProfilePhoto#4eaa77c1`. -type DeleteProfilePhotoRequest struct { - // Identifier of the profile photo to delete - ProfilePhotoID int64 -} - -// DeleteProfilePhotoRequestTypeID is TL type id of DeleteProfilePhotoRequest. -const DeleteProfilePhotoRequestTypeID = 0x4eaa77c1 - -// Ensuring interfaces in compile-time for DeleteProfilePhotoRequest. -var ( - _ bin.Encoder = &DeleteProfilePhotoRequest{} - _ bin.Decoder = &DeleteProfilePhotoRequest{} - _ bin.BareEncoder = &DeleteProfilePhotoRequest{} - _ bin.BareDecoder = &DeleteProfilePhotoRequest{} -) - -func (d *DeleteProfilePhotoRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ProfilePhotoID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteProfilePhotoRequest) String() string { - if d == nil { - return "DeleteProfilePhotoRequest(nil)" - } - type Alias DeleteProfilePhotoRequest - return fmt.Sprintf("DeleteProfilePhotoRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteProfilePhotoRequest) TypeID() uint32 { - return DeleteProfilePhotoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteProfilePhotoRequest) TypeName() string { - return "deleteProfilePhoto" -} - -// TypeInfo returns info about TL type. -func (d *DeleteProfilePhotoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteProfilePhoto", - ID: DeleteProfilePhotoRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ProfilePhotoID", - SchemaName: "profile_photo_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteProfilePhotoRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteProfilePhoto#4eaa77c1 as nil") - } - b.PutID(DeleteProfilePhotoRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteProfilePhotoRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteProfilePhoto#4eaa77c1 as nil") - } - b.PutLong(d.ProfilePhotoID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteProfilePhotoRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteProfilePhoto#4eaa77c1 to nil") - } - if err := b.ConsumeID(DeleteProfilePhotoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteProfilePhoto#4eaa77c1: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteProfilePhotoRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteProfilePhoto#4eaa77c1 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode deleteProfilePhoto#4eaa77c1: field profile_photo_id: %w", err) - } - d.ProfilePhotoID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteProfilePhotoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteProfilePhoto#4eaa77c1 as nil") - } - b.ObjStart() - b.PutID("deleteProfilePhoto") - b.Comma() - b.FieldStart("profile_photo_id") - b.PutLong(d.ProfilePhotoID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteProfilePhotoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteProfilePhoto#4eaa77c1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteProfilePhoto"); err != nil { - return fmt.Errorf("unable to decode deleteProfilePhoto#4eaa77c1: %w", err) - } - case "profile_photo_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode deleteProfilePhoto#4eaa77c1: field profile_photo_id: %w", err) - } - d.ProfilePhotoID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProfilePhotoID returns value of ProfilePhotoID field. -func (d *DeleteProfilePhotoRequest) GetProfilePhotoID() (value int64) { - if d == nil { - return - } - return d.ProfilePhotoID -} - -// DeleteProfilePhoto invokes method deleteProfilePhoto#4eaa77c1 returning error if any. -func (c *Client) DeleteProfilePhoto(ctx context.Context, profilephotoid int64) error { - var ok Ok - - request := &DeleteProfilePhotoRequest{ - ProfilePhotoID: profilephotoid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_quick_reply_shortcut_gen.go b/tdapi/tl_delete_quick_reply_shortcut_gen.go deleted file mode 100644 index 60752c220..000000000 --- a/tdapi/tl_delete_quick_reply_shortcut_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteQuickReplyShortcutRequest represents TL type `deleteQuickReplyShortcut#f1486c16`. -type DeleteQuickReplyShortcutRequest struct { - // Unique identifier of the quick reply shortcut - ShortcutID int32 -} - -// DeleteQuickReplyShortcutRequestTypeID is TL type id of DeleteQuickReplyShortcutRequest. -const DeleteQuickReplyShortcutRequestTypeID = 0xf1486c16 - -// Ensuring interfaces in compile-time for DeleteQuickReplyShortcutRequest. -var ( - _ bin.Encoder = &DeleteQuickReplyShortcutRequest{} - _ bin.Decoder = &DeleteQuickReplyShortcutRequest{} - _ bin.BareEncoder = &DeleteQuickReplyShortcutRequest{} - _ bin.BareDecoder = &DeleteQuickReplyShortcutRequest{} -) - -func (d *DeleteQuickReplyShortcutRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ShortcutID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteQuickReplyShortcutRequest) String() string { - if d == nil { - return "DeleteQuickReplyShortcutRequest(nil)" - } - type Alias DeleteQuickReplyShortcutRequest - return fmt.Sprintf("DeleteQuickReplyShortcutRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteQuickReplyShortcutRequest) TypeID() uint32 { - return DeleteQuickReplyShortcutRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteQuickReplyShortcutRequest) TypeName() string { - return "deleteQuickReplyShortcut" -} - -// TypeInfo returns info about TL type. -func (d *DeleteQuickReplyShortcutRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteQuickReplyShortcut", - ID: DeleteQuickReplyShortcutRequestTypeID, - } - 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 *DeleteQuickReplyShortcutRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteQuickReplyShortcut#f1486c16 as nil") - } - b.PutID(DeleteQuickReplyShortcutRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteQuickReplyShortcutRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteQuickReplyShortcut#f1486c16 as nil") - } - b.PutInt32(d.ShortcutID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteQuickReplyShortcutRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteQuickReplyShortcut#f1486c16 to nil") - } - if err := b.ConsumeID(DeleteQuickReplyShortcutRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcut#f1486c16: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteQuickReplyShortcutRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteQuickReplyShortcut#f1486c16 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcut#f1486c16: field shortcut_id: %w", err) - } - d.ShortcutID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteQuickReplyShortcutRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteQuickReplyShortcut#f1486c16 as nil") - } - b.ObjStart() - b.PutID("deleteQuickReplyShortcut") - b.Comma() - b.FieldStart("shortcut_id") - b.PutInt32(d.ShortcutID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteQuickReplyShortcutRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteQuickReplyShortcut#f1486c16 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteQuickReplyShortcut"); err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcut#f1486c16: %w", err) - } - case "shortcut_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcut#f1486c16: field shortcut_id: %w", err) - } - d.ShortcutID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutID returns value of ShortcutID field. -func (d *DeleteQuickReplyShortcutRequest) GetShortcutID() (value int32) { - if d == nil { - return - } - return d.ShortcutID -} - -// DeleteQuickReplyShortcut invokes method deleteQuickReplyShortcut#f1486c16 returning error if any. -func (c *Client) DeleteQuickReplyShortcut(ctx context.Context, shortcutid int32) error { - var ok Ok - - request := &DeleteQuickReplyShortcutRequest{ - ShortcutID: shortcutid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_quick_reply_shortcut_messages_gen.go b/tdapi/tl_delete_quick_reply_shortcut_messages_gen.go deleted file mode 100644 index f858b698e..000000000 --- a/tdapi/tl_delete_quick_reply_shortcut_messages_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteQuickReplyShortcutMessagesRequest represents TL type `deleteQuickReplyShortcutMessages#e859fcbb`. -type DeleteQuickReplyShortcutMessagesRequest struct { - // Unique identifier of the quick reply shortcut to which the messages belong - ShortcutID int32 - // Unique identifiers of the messages - MessageIDs []int64 -} - -// DeleteQuickReplyShortcutMessagesRequestTypeID is TL type id of DeleteQuickReplyShortcutMessagesRequest. -const DeleteQuickReplyShortcutMessagesRequestTypeID = 0xe859fcbb - -// Ensuring interfaces in compile-time for DeleteQuickReplyShortcutMessagesRequest. -var ( - _ bin.Encoder = &DeleteQuickReplyShortcutMessagesRequest{} - _ bin.Decoder = &DeleteQuickReplyShortcutMessagesRequest{} - _ bin.BareEncoder = &DeleteQuickReplyShortcutMessagesRequest{} - _ bin.BareDecoder = &DeleteQuickReplyShortcutMessagesRequest{} -) - -func (d *DeleteQuickReplyShortcutMessagesRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ShortcutID == 0) { - return false - } - if !(d.MessageIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteQuickReplyShortcutMessagesRequest) String() string { - if d == nil { - return "DeleteQuickReplyShortcutMessagesRequest(nil)" - } - type Alias DeleteQuickReplyShortcutMessagesRequest - return fmt.Sprintf("DeleteQuickReplyShortcutMessagesRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteQuickReplyShortcutMessagesRequest) TypeID() uint32 { - return DeleteQuickReplyShortcutMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteQuickReplyShortcutMessagesRequest) TypeName() string { - return "deleteQuickReplyShortcutMessages" -} - -// TypeInfo returns info about TL type. -func (d *DeleteQuickReplyShortcutMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteQuickReplyShortcutMessages", - ID: DeleteQuickReplyShortcutMessagesRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutID", - SchemaName: "shortcut_id", - }, - { - Name: "MessageIDs", - SchemaName: "message_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteQuickReplyShortcutMessagesRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteQuickReplyShortcutMessages#e859fcbb as nil") - } - b.PutID(DeleteQuickReplyShortcutMessagesRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteQuickReplyShortcutMessagesRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteQuickReplyShortcutMessages#e859fcbb as nil") - } - b.PutInt32(d.ShortcutID) - b.PutInt(len(d.MessageIDs)) - for _, v := range d.MessageIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteQuickReplyShortcutMessagesRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteQuickReplyShortcutMessages#e859fcbb to nil") - } - if err := b.ConsumeID(DeleteQuickReplyShortcutMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteQuickReplyShortcutMessagesRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteQuickReplyShortcutMessages#e859fcbb to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: field shortcut_id: %w", err) - } - d.ShortcutID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: field message_ids: %w", err) - } - - if headerLen > 0 { - d.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: field message_ids: %w", err) - } - d.MessageIDs = append(d.MessageIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteQuickReplyShortcutMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteQuickReplyShortcutMessages#e859fcbb as nil") - } - b.ObjStart() - b.PutID("deleteQuickReplyShortcutMessages") - b.Comma() - b.FieldStart("shortcut_id") - b.PutInt32(d.ShortcutID) - b.Comma() - b.FieldStart("message_ids") - b.ArrStart() - for _, v := range d.MessageIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteQuickReplyShortcutMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteQuickReplyShortcutMessages#e859fcbb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteQuickReplyShortcutMessages"); err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: %w", err) - } - case "shortcut_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: field shortcut_id: %w", err) - } - d.ShortcutID = value - case "message_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: field message_ids: %w", err) - } - d.MessageIDs = append(d.MessageIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode deleteQuickReplyShortcutMessages#e859fcbb: field message_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutID returns value of ShortcutID field. -func (d *DeleteQuickReplyShortcutMessagesRequest) GetShortcutID() (value int32) { - if d == nil { - return - } - return d.ShortcutID -} - -// GetMessageIDs returns value of MessageIDs field. -func (d *DeleteQuickReplyShortcutMessagesRequest) GetMessageIDs() (value []int64) { - if d == nil { - return - } - return d.MessageIDs -} - -// DeleteQuickReplyShortcutMessages invokes method deleteQuickReplyShortcutMessages#e859fcbb returning error if any. -func (c *Client) DeleteQuickReplyShortcutMessages(ctx context.Context, request *DeleteQuickReplyShortcutMessagesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_revoked_chat_invite_link_gen.go b/tdapi/tl_delete_revoked_chat_invite_link_gen.go deleted file mode 100644 index 8bfad0db5..000000000 --- a/tdapi/tl_delete_revoked_chat_invite_link_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteRevokedChatInviteLinkRequest represents TL type `deleteRevokedChatInviteLink#91270c7f`. -type DeleteRevokedChatInviteLinkRequest struct { - // Chat identifier - ChatID int64 - // Invite link to revoke - InviteLink string -} - -// DeleteRevokedChatInviteLinkRequestTypeID is TL type id of DeleteRevokedChatInviteLinkRequest. -const DeleteRevokedChatInviteLinkRequestTypeID = 0x91270c7f - -// Ensuring interfaces in compile-time for DeleteRevokedChatInviteLinkRequest. -var ( - _ bin.Encoder = &DeleteRevokedChatInviteLinkRequest{} - _ bin.Decoder = &DeleteRevokedChatInviteLinkRequest{} - _ bin.BareEncoder = &DeleteRevokedChatInviteLinkRequest{} - _ bin.BareDecoder = &DeleteRevokedChatInviteLinkRequest{} -) - -func (d *DeleteRevokedChatInviteLinkRequest) Zero() bool { - if d == nil { - return true - } - if !(d.ChatID == 0) { - return false - } - if !(d.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteRevokedChatInviteLinkRequest) String() string { - if d == nil { - return "DeleteRevokedChatInviteLinkRequest(nil)" - } - type Alias DeleteRevokedChatInviteLinkRequest - return fmt.Sprintf("DeleteRevokedChatInviteLinkRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteRevokedChatInviteLinkRequest) TypeID() uint32 { - return DeleteRevokedChatInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteRevokedChatInviteLinkRequest) TypeName() string { - return "deleteRevokedChatInviteLink" -} - -// TypeInfo returns info about TL type. -func (d *DeleteRevokedChatInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteRevokedChatInviteLink", - ID: DeleteRevokedChatInviteLinkRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteRevokedChatInviteLinkRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteRevokedChatInviteLink#91270c7f as nil") - } - b.PutID(DeleteRevokedChatInviteLinkRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteRevokedChatInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteRevokedChatInviteLink#91270c7f as nil") - } - b.PutInt53(d.ChatID) - b.PutString(d.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteRevokedChatInviteLinkRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteRevokedChatInviteLink#91270c7f to nil") - } - if err := b.ConsumeID(DeleteRevokedChatInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteRevokedChatInviteLink#91270c7f: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteRevokedChatInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteRevokedChatInviteLink#91270c7f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteRevokedChatInviteLink#91270c7f: field chat_id: %w", err) - } - d.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteRevokedChatInviteLink#91270c7f: field invite_link: %w", err) - } - d.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteRevokedChatInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteRevokedChatInviteLink#91270c7f as nil") - } - b.ObjStart() - b.PutID("deleteRevokedChatInviteLink") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(d.ChatID) - b.Comma() - b.FieldStart("invite_link") - b.PutString(d.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteRevokedChatInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteRevokedChatInviteLink#91270c7f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteRevokedChatInviteLink"); err != nil { - return fmt.Errorf("unable to decode deleteRevokedChatInviteLink#91270c7f: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteRevokedChatInviteLink#91270c7f: field chat_id: %w", err) - } - d.ChatID = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteRevokedChatInviteLink#91270c7f: field invite_link: %w", err) - } - d.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (d *DeleteRevokedChatInviteLinkRequest) GetChatID() (value int64) { - if d == nil { - return - } - return d.ChatID -} - -// GetInviteLink returns value of InviteLink field. -func (d *DeleteRevokedChatInviteLinkRequest) GetInviteLink() (value string) { - if d == nil { - return - } - return d.InviteLink -} - -// DeleteRevokedChatInviteLink invokes method deleteRevokedChatInviteLink#91270c7f returning error if any. -func (c *Client) DeleteRevokedChatInviteLink(ctx context.Context, request *DeleteRevokedChatInviteLinkRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_saved_credentials_gen.go b/tdapi/tl_delete_saved_credentials_gen.go deleted file mode 100644 index 8908fb7a7..000000000 --- a/tdapi/tl_delete_saved_credentials_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteSavedCredentialsRequest represents TL type `deleteSavedCredentials#314056d2`. -type DeleteSavedCredentialsRequest struct { -} - -// DeleteSavedCredentialsRequestTypeID is TL type id of DeleteSavedCredentialsRequest. -const DeleteSavedCredentialsRequestTypeID = 0x314056d2 - -// Ensuring interfaces in compile-time for DeleteSavedCredentialsRequest. -var ( - _ bin.Encoder = &DeleteSavedCredentialsRequest{} - _ bin.Decoder = &DeleteSavedCredentialsRequest{} - _ bin.BareEncoder = &DeleteSavedCredentialsRequest{} - _ bin.BareDecoder = &DeleteSavedCredentialsRequest{} -) - -func (d *DeleteSavedCredentialsRequest) Zero() bool { - if d == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteSavedCredentialsRequest) String() string { - if d == nil { - return "DeleteSavedCredentialsRequest(nil)" - } - type Alias DeleteSavedCredentialsRequest - return fmt.Sprintf("DeleteSavedCredentialsRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteSavedCredentialsRequest) TypeID() uint32 { - return DeleteSavedCredentialsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteSavedCredentialsRequest) TypeName() string { - return "deleteSavedCredentials" -} - -// TypeInfo returns info about TL type. -func (d *DeleteSavedCredentialsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteSavedCredentials", - ID: DeleteSavedCredentialsRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteSavedCredentialsRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedCredentials#314056d2 as nil") - } - b.PutID(DeleteSavedCredentialsRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteSavedCredentialsRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedCredentials#314056d2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteSavedCredentialsRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedCredentials#314056d2 to nil") - } - if err := b.ConsumeID(DeleteSavedCredentialsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteSavedCredentials#314056d2: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteSavedCredentialsRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedCredentials#314056d2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteSavedCredentialsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedCredentials#314056d2 as nil") - } - b.ObjStart() - b.PutID("deleteSavedCredentials") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteSavedCredentialsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedCredentials#314056d2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteSavedCredentials"); err != nil { - return fmt.Errorf("unable to decode deleteSavedCredentials#314056d2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// DeleteSavedCredentials invokes method deleteSavedCredentials#314056d2 returning error if any. -func (c *Client) DeleteSavedCredentials(ctx context.Context) error { - var ok Ok - - request := &DeleteSavedCredentialsRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_saved_messages_topic_history_gen.go b/tdapi/tl_delete_saved_messages_topic_history_gen.go deleted file mode 100644 index fcd409f93..000000000 --- a/tdapi/tl_delete_saved_messages_topic_history_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteSavedMessagesTopicHistoryRequest represents TL type `deleteSavedMessagesTopicHistory#69df3d6a`. -type DeleteSavedMessagesTopicHistoryRequest struct { - // Identifier of Saved Messages topic which messages will be deleted - SavedMessagesTopicID int64 -} - -// DeleteSavedMessagesTopicHistoryRequestTypeID is TL type id of DeleteSavedMessagesTopicHistoryRequest. -const DeleteSavedMessagesTopicHistoryRequestTypeID = 0x69df3d6a - -// Ensuring interfaces in compile-time for DeleteSavedMessagesTopicHistoryRequest. -var ( - _ bin.Encoder = &DeleteSavedMessagesTopicHistoryRequest{} - _ bin.Decoder = &DeleteSavedMessagesTopicHistoryRequest{} - _ bin.BareEncoder = &DeleteSavedMessagesTopicHistoryRequest{} - _ bin.BareDecoder = &DeleteSavedMessagesTopicHistoryRequest{} -) - -func (d *DeleteSavedMessagesTopicHistoryRequest) Zero() bool { - if d == nil { - return true - } - if !(d.SavedMessagesTopicID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteSavedMessagesTopicHistoryRequest) String() string { - if d == nil { - return "DeleteSavedMessagesTopicHistoryRequest(nil)" - } - type Alias DeleteSavedMessagesTopicHistoryRequest - return fmt.Sprintf("DeleteSavedMessagesTopicHistoryRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteSavedMessagesTopicHistoryRequest) TypeID() uint32 { - return DeleteSavedMessagesTopicHistoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteSavedMessagesTopicHistoryRequest) TypeName() string { - return "deleteSavedMessagesTopicHistory" -} - -// TypeInfo returns info about TL type. -func (d *DeleteSavedMessagesTopicHistoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteSavedMessagesTopicHistory", - ID: DeleteSavedMessagesTopicHistoryRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteSavedMessagesTopicHistoryRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicHistory#69df3d6a as nil") - } - b.PutID(DeleteSavedMessagesTopicHistoryRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteSavedMessagesTopicHistoryRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicHistory#69df3d6a as nil") - } - b.PutInt53(d.SavedMessagesTopicID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteSavedMessagesTopicHistoryRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicHistory#69df3d6a to nil") - } - if err := b.ConsumeID(DeleteSavedMessagesTopicHistoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#69df3d6a: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteSavedMessagesTopicHistoryRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicHistory#69df3d6a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#69df3d6a: field saved_messages_topic_id: %w", err) - } - d.SavedMessagesTopicID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteSavedMessagesTopicHistoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicHistory#69df3d6a as nil") - } - b.ObjStart() - b.PutID("deleteSavedMessagesTopicHistory") - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(d.SavedMessagesTopicID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteSavedMessagesTopicHistoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicHistory#69df3d6a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteSavedMessagesTopicHistory"); err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#69df3d6a: %w", err) - } - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicHistory#69df3d6a: field saved_messages_topic_id: %w", err) - } - d.SavedMessagesTopicID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (d *DeleteSavedMessagesTopicHistoryRequest) GetSavedMessagesTopicID() (value int64) { - if d == nil { - return - } - return d.SavedMessagesTopicID -} - -// DeleteSavedMessagesTopicHistory invokes method deleteSavedMessagesTopicHistory#69df3d6a returning error if any. -func (c *Client) DeleteSavedMessagesTopicHistory(ctx context.Context, savedmessagestopicid int64) error { - var ok Ok - - request := &DeleteSavedMessagesTopicHistoryRequest{ - SavedMessagesTopicID: savedmessagestopicid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_saved_messages_topic_messages_by_date_gen.go b/tdapi/tl_delete_saved_messages_topic_messages_by_date_gen.go deleted file mode 100644 index c08cf7922..000000000 --- a/tdapi/tl_delete_saved_messages_topic_messages_by_date_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteSavedMessagesTopicMessagesByDateRequest represents TL type `deleteSavedMessagesTopicMessagesByDate#160a25`. -type DeleteSavedMessagesTopicMessagesByDateRequest struct { - // Identifier of Saved Messages topic which messages will be deleted - SavedMessagesTopicID int64 - // The minimum date of the messages to delete - MinDate int32 - // The maximum date of the messages to delete - MaxDate int32 -} - -// DeleteSavedMessagesTopicMessagesByDateRequestTypeID is TL type id of DeleteSavedMessagesTopicMessagesByDateRequest. -const DeleteSavedMessagesTopicMessagesByDateRequestTypeID = 0x160a25 - -// Ensuring interfaces in compile-time for DeleteSavedMessagesTopicMessagesByDateRequest. -var ( - _ bin.Encoder = &DeleteSavedMessagesTopicMessagesByDateRequest{} - _ bin.Decoder = &DeleteSavedMessagesTopicMessagesByDateRequest{} - _ bin.BareEncoder = &DeleteSavedMessagesTopicMessagesByDateRequest{} - _ bin.BareDecoder = &DeleteSavedMessagesTopicMessagesByDateRequest{} -) - -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) Zero() bool { - if d == nil { - return true - } - if !(d.SavedMessagesTopicID == 0) { - return false - } - if !(d.MinDate == 0) { - return false - } - if !(d.MaxDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) String() string { - if d == nil { - return "DeleteSavedMessagesTopicMessagesByDateRequest(nil)" - } - type Alias DeleteSavedMessagesTopicMessagesByDateRequest - return fmt.Sprintf("DeleteSavedMessagesTopicMessagesByDateRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteSavedMessagesTopicMessagesByDateRequest) TypeID() uint32 { - return DeleteSavedMessagesTopicMessagesByDateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteSavedMessagesTopicMessagesByDateRequest) TypeName() string { - return "deleteSavedMessagesTopicMessagesByDate" -} - -// TypeInfo returns info about TL type. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteSavedMessagesTopicMessagesByDate", - ID: DeleteSavedMessagesTopicMessagesByDateRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - { - Name: "MinDate", - SchemaName: "min_date", - }, - { - Name: "MaxDate", - SchemaName: "max_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicMessagesByDate#160a25 as nil") - } - b.PutID(DeleteSavedMessagesTopicMessagesByDateRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicMessagesByDate#160a25 as nil") - } - b.PutInt53(d.SavedMessagesTopicID) - b.PutInt32(d.MinDate) - b.PutInt32(d.MaxDate) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicMessagesByDate#160a25 to nil") - } - if err := b.ConsumeID(DeleteSavedMessagesTopicMessagesByDateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicMessagesByDate#160a25 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field saved_messages_topic_id: %w", err) - } - d.SavedMessagesTopicID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field min_date: %w", err) - } - d.MinDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field max_date: %w", err) - } - d.MaxDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedMessagesTopicMessagesByDate#160a25 as nil") - } - b.ObjStart() - b.PutID("deleteSavedMessagesTopicMessagesByDate") - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(d.SavedMessagesTopicID) - b.Comma() - b.FieldStart("min_date") - b.PutInt32(d.MinDate) - b.Comma() - b.FieldStart("max_date") - b.PutInt32(d.MaxDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedMessagesTopicMessagesByDate#160a25 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteSavedMessagesTopicMessagesByDate"); err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: %w", err) - } - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field saved_messages_topic_id: %w", err) - } - d.SavedMessagesTopicID = value - case "min_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field min_date: %w", err) - } - d.MinDate = value - case "max_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteSavedMessagesTopicMessagesByDate#160a25: field max_date: %w", err) - } - d.MaxDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) GetSavedMessagesTopicID() (value int64) { - if d == nil { - return - } - return d.SavedMessagesTopicID -} - -// GetMinDate returns value of MinDate field. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) GetMinDate() (value int32) { - if d == nil { - return - } - return d.MinDate -} - -// GetMaxDate returns value of MaxDate field. -func (d *DeleteSavedMessagesTopicMessagesByDateRequest) GetMaxDate() (value int32) { - if d == nil { - return - } - return d.MaxDate -} - -// DeleteSavedMessagesTopicMessagesByDate invokes method deleteSavedMessagesTopicMessagesByDate#160a25 returning error if any. -func (c *Client) DeleteSavedMessagesTopicMessagesByDate(ctx context.Context, request *DeleteSavedMessagesTopicMessagesByDateRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_saved_order_info_gen.go b/tdapi/tl_delete_saved_order_info_gen.go deleted file mode 100644 index 5f53462b3..000000000 --- a/tdapi/tl_delete_saved_order_info_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteSavedOrderInfoRequest represents TL type `deleteSavedOrderInfo#61197474`. -type DeleteSavedOrderInfoRequest struct { -} - -// DeleteSavedOrderInfoRequestTypeID is TL type id of DeleteSavedOrderInfoRequest. -const DeleteSavedOrderInfoRequestTypeID = 0x61197474 - -// Ensuring interfaces in compile-time for DeleteSavedOrderInfoRequest. -var ( - _ bin.Encoder = &DeleteSavedOrderInfoRequest{} - _ bin.Decoder = &DeleteSavedOrderInfoRequest{} - _ bin.BareEncoder = &DeleteSavedOrderInfoRequest{} - _ bin.BareDecoder = &DeleteSavedOrderInfoRequest{} -) - -func (d *DeleteSavedOrderInfoRequest) Zero() bool { - if d == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteSavedOrderInfoRequest) String() string { - if d == nil { - return "DeleteSavedOrderInfoRequest(nil)" - } - type Alias DeleteSavedOrderInfoRequest - return fmt.Sprintf("DeleteSavedOrderInfoRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteSavedOrderInfoRequest) TypeID() uint32 { - return DeleteSavedOrderInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteSavedOrderInfoRequest) TypeName() string { - return "deleteSavedOrderInfo" -} - -// TypeInfo returns info about TL type. -func (d *DeleteSavedOrderInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteSavedOrderInfo", - ID: DeleteSavedOrderInfoRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteSavedOrderInfoRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedOrderInfo#61197474 as nil") - } - b.PutID(DeleteSavedOrderInfoRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteSavedOrderInfoRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedOrderInfo#61197474 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteSavedOrderInfoRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedOrderInfo#61197474 to nil") - } - if err := b.ConsumeID(DeleteSavedOrderInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteSavedOrderInfo#61197474: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteSavedOrderInfoRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedOrderInfo#61197474 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteSavedOrderInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteSavedOrderInfo#61197474 as nil") - } - b.ObjStart() - b.PutID("deleteSavedOrderInfo") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteSavedOrderInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteSavedOrderInfo#61197474 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteSavedOrderInfo"); err != nil { - return fmt.Errorf("unable to decode deleteSavedOrderInfo#61197474: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// DeleteSavedOrderInfo invokes method deleteSavedOrderInfo#61197474 returning error if any. -func (c *Client) DeleteSavedOrderInfo(ctx context.Context) error { - var ok Ok - - request := &DeleteSavedOrderInfoRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_sticker_set_gen.go b/tdapi/tl_delete_sticker_set_gen.go deleted file mode 100644 index 7d2654fad..000000000 --- a/tdapi/tl_delete_sticker_set_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteStickerSetRequest represents TL type `deleteStickerSet#5e0a7bad`. -type DeleteStickerSetRequest struct { - // Sticker set name. The sticker set must be owned by the current user - Name string -} - -// DeleteStickerSetRequestTypeID is TL type id of DeleteStickerSetRequest. -const DeleteStickerSetRequestTypeID = 0x5e0a7bad - -// Ensuring interfaces in compile-time for DeleteStickerSetRequest. -var ( - _ bin.Encoder = &DeleteStickerSetRequest{} - _ bin.Decoder = &DeleteStickerSetRequest{} - _ bin.BareEncoder = &DeleteStickerSetRequest{} - _ bin.BareDecoder = &DeleteStickerSetRequest{} -) - -func (d *DeleteStickerSetRequest) Zero() bool { - if d == nil { - return true - } - if !(d.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteStickerSetRequest) String() string { - if d == nil { - return "DeleteStickerSetRequest(nil)" - } - type Alias DeleteStickerSetRequest - return fmt.Sprintf("DeleteStickerSetRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteStickerSetRequest) TypeID() uint32 { - return DeleteStickerSetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteStickerSetRequest) TypeName() string { - return "deleteStickerSet" -} - -// TypeInfo returns info about TL type. -func (d *DeleteStickerSetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteStickerSet", - ID: DeleteStickerSetRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteStickerSetRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteStickerSet#5e0a7bad as nil") - } - b.PutID(DeleteStickerSetRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteStickerSetRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteStickerSet#5e0a7bad as nil") - } - b.PutString(d.Name) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteStickerSetRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteStickerSet#5e0a7bad to nil") - } - if err := b.ConsumeID(DeleteStickerSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteStickerSet#5e0a7bad: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteStickerSetRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteStickerSet#5e0a7bad to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteStickerSet#5e0a7bad: field name: %w", err) - } - d.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteStickerSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteStickerSet#5e0a7bad as nil") - } - b.ObjStart() - b.PutID("deleteStickerSet") - b.Comma() - b.FieldStart("name") - b.PutString(d.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteStickerSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteStickerSet#5e0a7bad to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteStickerSet"); err != nil { - return fmt.Errorf("unable to decode deleteStickerSet#5e0a7bad: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deleteStickerSet#5e0a7bad: field name: %w", err) - } - d.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (d *DeleteStickerSetRequest) GetName() (value string) { - if d == nil { - return - } - return d.Name -} - -// DeleteStickerSet invokes method deleteStickerSet#5e0a7bad returning error if any. -func (c *Client) DeleteStickerSet(ctx context.Context, name string) error { - var ok Ok - - request := &DeleteStickerSetRequest{ - Name: name, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_delete_story_gen.go b/tdapi/tl_delete_story_gen.go deleted file mode 100644 index 00efc5eec..000000000 --- a/tdapi/tl_delete_story_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeleteStoryRequest represents TL type `deleteStory#9f35af16`. -type DeleteStoryRequest struct { - // Identifier of the chat that posted the story - StorySenderChatID int64 - // Identifier of the story to delete - StoryID int32 -} - -// DeleteStoryRequestTypeID is TL type id of DeleteStoryRequest. -const DeleteStoryRequestTypeID = 0x9f35af16 - -// Ensuring interfaces in compile-time for DeleteStoryRequest. -var ( - _ bin.Encoder = &DeleteStoryRequest{} - _ bin.Decoder = &DeleteStoryRequest{} - _ bin.BareEncoder = &DeleteStoryRequest{} - _ bin.BareDecoder = &DeleteStoryRequest{} -) - -func (d *DeleteStoryRequest) Zero() bool { - if d == nil { - return true - } - if !(d.StorySenderChatID == 0) { - return false - } - if !(d.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeleteStoryRequest) String() string { - if d == nil { - return "DeleteStoryRequest(nil)" - } - type Alias DeleteStoryRequest - return fmt.Sprintf("DeleteStoryRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeleteStoryRequest) TypeID() uint32 { - return DeleteStoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeleteStoryRequest) TypeName() string { - return "deleteStory" -} - -// TypeInfo returns info about TL type. -func (d *DeleteStoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deleteStory", - ID: DeleteStoryRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeleteStoryRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteStory#9f35af16 as nil") - } - b.PutID(DeleteStoryRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeleteStoryRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deleteStory#9f35af16 as nil") - } - b.PutInt53(d.StorySenderChatID) - b.PutInt32(d.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeleteStoryRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteStory#9f35af16 to nil") - } - if err := b.ConsumeID(DeleteStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode deleteStory#9f35af16: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeleteStoryRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deleteStory#9f35af16 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteStory#9f35af16: field story_sender_chat_id: %w", err) - } - d.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteStory#9f35af16: field story_id: %w", err) - } - d.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeleteStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deleteStory#9f35af16 as nil") - } - b.ObjStart() - b.PutID("deleteStory") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(d.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(d.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeleteStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deleteStory#9f35af16 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deleteStory"); err != nil { - return fmt.Errorf("unable to decode deleteStory#9f35af16: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode deleteStory#9f35af16: field story_sender_chat_id: %w", err) - } - d.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode deleteStory#9f35af16: field story_id: %w", err) - } - d.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (d *DeleteStoryRequest) GetStorySenderChatID() (value int64) { - if d == nil { - return - } - return d.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (d *DeleteStoryRequest) GetStoryID() (value int32) { - if d == nil { - return - } - return d.StoryID -} - -// DeleteStory invokes method deleteStory#9f35af16 returning error if any. -func (c *Client) DeleteStory(ctx context.Context, request *DeleteStoryRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_destroy_gen.go b/tdapi/tl_destroy_gen.go deleted file mode 100644 index fe7da2d76..000000000 --- a/tdapi/tl_destroy_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DestroyRequest represents TL type `destroy#28d9534a`. -type DestroyRequest struct { -} - -// DestroyRequestTypeID is TL type id of DestroyRequest. -const DestroyRequestTypeID = 0x28d9534a - -// Ensuring interfaces in compile-time for DestroyRequest. -var ( - _ bin.Encoder = &DestroyRequest{} - _ bin.Decoder = &DestroyRequest{} - _ bin.BareEncoder = &DestroyRequest{} - _ bin.BareDecoder = &DestroyRequest{} -) - -func (d *DestroyRequest) Zero() bool { - if d == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (d *DestroyRequest) String() string { - if d == nil { - return "DestroyRequest(nil)" - } - type Alias DestroyRequest - return fmt.Sprintf("DestroyRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DestroyRequest) TypeID() uint32 { - return DestroyRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DestroyRequest) TypeName() string { - return "destroy" -} - -// TypeInfo returns info about TL type. -func (d *DestroyRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "destroy", - ID: DestroyRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (d *DestroyRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode destroy#28d9534a as nil") - } - b.PutID(DestroyRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DestroyRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode destroy#28d9534a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DestroyRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode destroy#28d9534a to nil") - } - if err := b.ConsumeID(DestroyRequestTypeID); err != nil { - return fmt.Errorf("unable to decode destroy#28d9534a: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DestroyRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode destroy#28d9534a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DestroyRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode destroy#28d9534a as nil") - } - b.ObjStart() - b.PutID("destroy") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DestroyRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode destroy#28d9534a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("destroy"); err != nil { - return fmt.Errorf("unable to decode destroy#28d9534a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// Destroy invokes method destroy#28d9534a returning error if any. -func (c *Client) Destroy(ctx context.Context) error { - var ok Ok - - request := &DestroyRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_device_token_gen.go b/tdapi/tl_device_token_gen.go deleted file mode 100644 index ea877d961..000000000 --- a/tdapi/tl_device_token_gen.go +++ /dev/null @@ -1,2552 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DeviceTokenFirebaseCloudMessaging represents TL type `deviceTokenFirebaseCloudMessaging#d0714a07`. -type DeviceTokenFirebaseCloudMessaging struct { - // Device registration token; may be empty to deregister a device - Token string - // True, if push notifications must be additionally encrypted - Encrypt bool -} - -// DeviceTokenFirebaseCloudMessagingTypeID is TL type id of DeviceTokenFirebaseCloudMessaging. -const DeviceTokenFirebaseCloudMessagingTypeID = 0xd0714a07 - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenFirebaseCloudMessaging) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenFirebaseCloudMessaging. -var ( - _ bin.Encoder = &DeviceTokenFirebaseCloudMessaging{} - _ bin.Decoder = &DeviceTokenFirebaseCloudMessaging{} - _ bin.BareEncoder = &DeviceTokenFirebaseCloudMessaging{} - _ bin.BareDecoder = &DeviceTokenFirebaseCloudMessaging{} - - _ DeviceTokenClass = &DeviceTokenFirebaseCloudMessaging{} -) - -func (d *DeviceTokenFirebaseCloudMessaging) Zero() bool { - if d == nil { - return true - } - if !(d.Token == "") { - return false - } - if !(d.Encrypt == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenFirebaseCloudMessaging) String() string { - if d == nil { - return "DeviceTokenFirebaseCloudMessaging(nil)" - } - type Alias DeviceTokenFirebaseCloudMessaging - return fmt.Sprintf("DeviceTokenFirebaseCloudMessaging%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenFirebaseCloudMessaging) TypeID() uint32 { - return DeviceTokenFirebaseCloudMessagingTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenFirebaseCloudMessaging) TypeName() string { - return "deviceTokenFirebaseCloudMessaging" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenFirebaseCloudMessaging) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenFirebaseCloudMessaging", - ID: DeviceTokenFirebaseCloudMessagingTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - { - Name: "Encrypt", - SchemaName: "encrypt", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenFirebaseCloudMessaging) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenFirebaseCloudMessaging#d0714a07 as nil") - } - b.PutID(DeviceTokenFirebaseCloudMessagingTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenFirebaseCloudMessaging) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenFirebaseCloudMessaging#d0714a07 as nil") - } - b.PutString(d.Token) - b.PutBool(d.Encrypt) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenFirebaseCloudMessaging) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenFirebaseCloudMessaging#d0714a07 to nil") - } - if err := b.ConsumeID(DeviceTokenFirebaseCloudMessagingTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenFirebaseCloudMessaging#d0714a07: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenFirebaseCloudMessaging) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenFirebaseCloudMessaging#d0714a07 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenFirebaseCloudMessaging#d0714a07: field token: %w", err) - } - d.Token = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenFirebaseCloudMessaging#d0714a07: field encrypt: %w", err) - } - d.Encrypt = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenFirebaseCloudMessaging) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenFirebaseCloudMessaging#d0714a07 as nil") - } - b.ObjStart() - b.PutID("deviceTokenFirebaseCloudMessaging") - b.Comma() - b.FieldStart("token") - b.PutString(d.Token) - b.Comma() - b.FieldStart("encrypt") - b.PutBool(d.Encrypt) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenFirebaseCloudMessaging) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenFirebaseCloudMessaging#d0714a07 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenFirebaseCloudMessaging"); err != nil { - return fmt.Errorf("unable to decode deviceTokenFirebaseCloudMessaging#d0714a07: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenFirebaseCloudMessaging#d0714a07: field token: %w", err) - } - d.Token = value - case "encrypt": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenFirebaseCloudMessaging#d0714a07: field encrypt: %w", err) - } - d.Encrypt = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (d *DeviceTokenFirebaseCloudMessaging) GetToken() (value string) { - if d == nil { - return - } - return d.Token -} - -// GetEncrypt returns value of Encrypt field. -func (d *DeviceTokenFirebaseCloudMessaging) GetEncrypt() (value bool) { - if d == nil { - return - } - return d.Encrypt -} - -// DeviceTokenApplePush represents TL type `deviceTokenApplePush#17196bc3`. -type DeviceTokenApplePush struct { - // Device token; may be empty to deregister a device - DeviceToken string - // True, if App Sandbox is enabled - IsAppSandbox bool -} - -// DeviceTokenApplePushTypeID is TL type id of DeviceTokenApplePush. -const DeviceTokenApplePushTypeID = 0x17196bc3 - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenApplePush) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenApplePush. -var ( - _ bin.Encoder = &DeviceTokenApplePush{} - _ bin.Decoder = &DeviceTokenApplePush{} - _ bin.BareEncoder = &DeviceTokenApplePush{} - _ bin.BareDecoder = &DeviceTokenApplePush{} - - _ DeviceTokenClass = &DeviceTokenApplePush{} -) - -func (d *DeviceTokenApplePush) Zero() bool { - if d == nil { - return true - } - if !(d.DeviceToken == "") { - return false - } - if !(d.IsAppSandbox == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenApplePush) String() string { - if d == nil { - return "DeviceTokenApplePush(nil)" - } - type Alias DeviceTokenApplePush - return fmt.Sprintf("DeviceTokenApplePush%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenApplePush) TypeID() uint32 { - return DeviceTokenApplePushTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenApplePush) TypeName() string { - return "deviceTokenApplePush" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenApplePush) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenApplePush", - ID: DeviceTokenApplePushTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DeviceToken", - SchemaName: "device_token", - }, - { - Name: "IsAppSandbox", - SchemaName: "is_app_sandbox", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenApplePush) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenApplePush#17196bc3 as nil") - } - b.PutID(DeviceTokenApplePushTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenApplePush) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenApplePush#17196bc3 as nil") - } - b.PutString(d.DeviceToken) - b.PutBool(d.IsAppSandbox) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenApplePush) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenApplePush#17196bc3 to nil") - } - if err := b.ConsumeID(DeviceTokenApplePushTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePush#17196bc3: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenApplePush) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenApplePush#17196bc3 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePush#17196bc3: field device_token: %w", err) - } - d.DeviceToken = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePush#17196bc3: field is_app_sandbox: %w", err) - } - d.IsAppSandbox = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenApplePush) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenApplePush#17196bc3 as nil") - } - b.ObjStart() - b.PutID("deviceTokenApplePush") - b.Comma() - b.FieldStart("device_token") - b.PutString(d.DeviceToken) - b.Comma() - b.FieldStart("is_app_sandbox") - b.PutBool(d.IsAppSandbox) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenApplePush) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenApplePush#17196bc3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenApplePush"); err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePush#17196bc3: %w", err) - } - case "device_token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePush#17196bc3: field device_token: %w", err) - } - d.DeviceToken = value - case "is_app_sandbox": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePush#17196bc3: field is_app_sandbox: %w", err) - } - d.IsAppSandbox = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDeviceToken returns value of DeviceToken field. -func (d *DeviceTokenApplePush) GetDeviceToken() (value string) { - if d == nil { - return - } - return d.DeviceToken -} - -// GetIsAppSandbox returns value of IsAppSandbox field. -func (d *DeviceTokenApplePush) GetIsAppSandbox() (value bool) { - if d == nil { - return - } - return d.IsAppSandbox -} - -// DeviceTokenApplePushVoIP represents TL type `deviceTokenApplePushVoIP#2ff045e9`. -type DeviceTokenApplePushVoIP struct { - // Device token; may be empty to deregister a device - DeviceToken string - // True, if App Sandbox is enabled - IsAppSandbox bool - // True, if push notifications must be additionally encrypted - Encrypt bool -} - -// DeviceTokenApplePushVoIPTypeID is TL type id of DeviceTokenApplePushVoIP. -const DeviceTokenApplePushVoIPTypeID = 0x2ff045e9 - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenApplePushVoIP) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenApplePushVoIP. -var ( - _ bin.Encoder = &DeviceTokenApplePushVoIP{} - _ bin.Decoder = &DeviceTokenApplePushVoIP{} - _ bin.BareEncoder = &DeviceTokenApplePushVoIP{} - _ bin.BareDecoder = &DeviceTokenApplePushVoIP{} - - _ DeviceTokenClass = &DeviceTokenApplePushVoIP{} -) - -func (d *DeviceTokenApplePushVoIP) Zero() bool { - if d == nil { - return true - } - if !(d.DeviceToken == "") { - return false - } - if !(d.IsAppSandbox == false) { - return false - } - if !(d.Encrypt == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenApplePushVoIP) String() string { - if d == nil { - return "DeviceTokenApplePushVoIP(nil)" - } - type Alias DeviceTokenApplePushVoIP - return fmt.Sprintf("DeviceTokenApplePushVoIP%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenApplePushVoIP) TypeID() uint32 { - return DeviceTokenApplePushVoIPTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenApplePushVoIP) TypeName() string { - return "deviceTokenApplePushVoIP" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenApplePushVoIP) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenApplePushVoIP", - ID: DeviceTokenApplePushVoIPTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DeviceToken", - SchemaName: "device_token", - }, - { - Name: "IsAppSandbox", - SchemaName: "is_app_sandbox", - }, - { - Name: "Encrypt", - SchemaName: "encrypt", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenApplePushVoIP) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenApplePushVoIP#2ff045e9 as nil") - } - b.PutID(DeviceTokenApplePushVoIPTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenApplePushVoIP) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenApplePushVoIP#2ff045e9 as nil") - } - b.PutString(d.DeviceToken) - b.PutBool(d.IsAppSandbox) - b.PutBool(d.Encrypt) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenApplePushVoIP) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenApplePushVoIP#2ff045e9 to nil") - } - if err := b.ConsumeID(DeviceTokenApplePushVoIPTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePushVoIP#2ff045e9: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenApplePushVoIP) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenApplePushVoIP#2ff045e9 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePushVoIP#2ff045e9: field device_token: %w", err) - } - d.DeviceToken = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePushVoIP#2ff045e9: field is_app_sandbox: %w", err) - } - d.IsAppSandbox = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePushVoIP#2ff045e9: field encrypt: %w", err) - } - d.Encrypt = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenApplePushVoIP) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenApplePushVoIP#2ff045e9 as nil") - } - b.ObjStart() - b.PutID("deviceTokenApplePushVoIP") - b.Comma() - b.FieldStart("device_token") - b.PutString(d.DeviceToken) - b.Comma() - b.FieldStart("is_app_sandbox") - b.PutBool(d.IsAppSandbox) - b.Comma() - b.FieldStart("encrypt") - b.PutBool(d.Encrypt) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenApplePushVoIP) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenApplePushVoIP#2ff045e9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenApplePushVoIP"); err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePushVoIP#2ff045e9: %w", err) - } - case "device_token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePushVoIP#2ff045e9: field device_token: %w", err) - } - d.DeviceToken = value - case "is_app_sandbox": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePushVoIP#2ff045e9: field is_app_sandbox: %w", err) - } - d.IsAppSandbox = value - case "encrypt": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenApplePushVoIP#2ff045e9: field encrypt: %w", err) - } - d.Encrypt = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDeviceToken returns value of DeviceToken field. -func (d *DeviceTokenApplePushVoIP) GetDeviceToken() (value string) { - if d == nil { - return - } - return d.DeviceToken -} - -// GetIsAppSandbox returns value of IsAppSandbox field. -func (d *DeviceTokenApplePushVoIP) GetIsAppSandbox() (value bool) { - if d == nil { - return - } - return d.IsAppSandbox -} - -// GetEncrypt returns value of Encrypt field. -func (d *DeviceTokenApplePushVoIP) GetEncrypt() (value bool) { - if d == nil { - return - } - return d.Encrypt -} - -// DeviceTokenWindowsPush represents TL type `deviceTokenWindowsPush#abed428f`. -type DeviceTokenWindowsPush struct { - // The access token that will be used to send notifications; may be empty to deregister a - // device - AccessToken string -} - -// DeviceTokenWindowsPushTypeID is TL type id of DeviceTokenWindowsPush. -const DeviceTokenWindowsPushTypeID = 0xabed428f - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenWindowsPush) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenWindowsPush. -var ( - _ bin.Encoder = &DeviceTokenWindowsPush{} - _ bin.Decoder = &DeviceTokenWindowsPush{} - _ bin.BareEncoder = &DeviceTokenWindowsPush{} - _ bin.BareDecoder = &DeviceTokenWindowsPush{} - - _ DeviceTokenClass = &DeviceTokenWindowsPush{} -) - -func (d *DeviceTokenWindowsPush) Zero() bool { - if d == nil { - return true - } - if !(d.AccessToken == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenWindowsPush) String() string { - if d == nil { - return "DeviceTokenWindowsPush(nil)" - } - type Alias DeviceTokenWindowsPush - return fmt.Sprintf("DeviceTokenWindowsPush%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenWindowsPush) TypeID() uint32 { - return DeviceTokenWindowsPushTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenWindowsPush) TypeName() string { - return "deviceTokenWindowsPush" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenWindowsPush) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenWindowsPush", - ID: DeviceTokenWindowsPushTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AccessToken", - SchemaName: "access_token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenWindowsPush) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenWindowsPush#abed428f as nil") - } - b.PutID(DeviceTokenWindowsPushTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenWindowsPush) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenWindowsPush#abed428f as nil") - } - b.PutString(d.AccessToken) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenWindowsPush) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenWindowsPush#abed428f to nil") - } - if err := b.ConsumeID(DeviceTokenWindowsPushTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenWindowsPush#abed428f: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenWindowsPush) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenWindowsPush#abed428f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenWindowsPush#abed428f: field access_token: %w", err) - } - d.AccessToken = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenWindowsPush) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenWindowsPush#abed428f as nil") - } - b.ObjStart() - b.PutID("deviceTokenWindowsPush") - b.Comma() - b.FieldStart("access_token") - b.PutString(d.AccessToken) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenWindowsPush) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenWindowsPush#abed428f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenWindowsPush"); err != nil { - return fmt.Errorf("unable to decode deviceTokenWindowsPush#abed428f: %w", err) - } - case "access_token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenWindowsPush#abed428f: field access_token: %w", err) - } - d.AccessToken = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAccessToken returns value of AccessToken field. -func (d *DeviceTokenWindowsPush) GetAccessToken() (value string) { - if d == nil { - return - } - return d.AccessToken -} - -// DeviceTokenMicrosoftPush represents TL type `deviceTokenMicrosoftPush#48f8e04c`. -type DeviceTokenMicrosoftPush struct { - // Push notification channel URI; may be empty to deregister a device - ChannelURI string -} - -// DeviceTokenMicrosoftPushTypeID is TL type id of DeviceTokenMicrosoftPush. -const DeviceTokenMicrosoftPushTypeID = 0x48f8e04c - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenMicrosoftPush) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenMicrosoftPush. -var ( - _ bin.Encoder = &DeviceTokenMicrosoftPush{} - _ bin.Decoder = &DeviceTokenMicrosoftPush{} - _ bin.BareEncoder = &DeviceTokenMicrosoftPush{} - _ bin.BareDecoder = &DeviceTokenMicrosoftPush{} - - _ DeviceTokenClass = &DeviceTokenMicrosoftPush{} -) - -func (d *DeviceTokenMicrosoftPush) Zero() bool { - if d == nil { - return true - } - if !(d.ChannelURI == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenMicrosoftPush) String() string { - if d == nil { - return "DeviceTokenMicrosoftPush(nil)" - } - type Alias DeviceTokenMicrosoftPush - return fmt.Sprintf("DeviceTokenMicrosoftPush%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenMicrosoftPush) TypeID() uint32 { - return DeviceTokenMicrosoftPushTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenMicrosoftPush) TypeName() string { - return "deviceTokenMicrosoftPush" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenMicrosoftPush) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenMicrosoftPush", - ID: DeviceTokenMicrosoftPushTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChannelURI", - SchemaName: "channel_uri", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenMicrosoftPush) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenMicrosoftPush#48f8e04c as nil") - } - b.PutID(DeviceTokenMicrosoftPushTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenMicrosoftPush) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenMicrosoftPush#48f8e04c as nil") - } - b.PutString(d.ChannelURI) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenMicrosoftPush) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenMicrosoftPush#48f8e04c to nil") - } - if err := b.ConsumeID(DeviceTokenMicrosoftPushTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenMicrosoftPush#48f8e04c: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenMicrosoftPush) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenMicrosoftPush#48f8e04c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenMicrosoftPush#48f8e04c: field channel_uri: %w", err) - } - d.ChannelURI = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenMicrosoftPush) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenMicrosoftPush#48f8e04c as nil") - } - b.ObjStart() - b.PutID("deviceTokenMicrosoftPush") - b.Comma() - b.FieldStart("channel_uri") - b.PutString(d.ChannelURI) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenMicrosoftPush) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenMicrosoftPush#48f8e04c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenMicrosoftPush"); err != nil { - return fmt.Errorf("unable to decode deviceTokenMicrosoftPush#48f8e04c: %w", err) - } - case "channel_uri": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenMicrosoftPush#48f8e04c: field channel_uri: %w", err) - } - d.ChannelURI = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChannelURI returns value of ChannelURI field. -func (d *DeviceTokenMicrosoftPush) GetChannelURI() (value string) { - if d == nil { - return - } - return d.ChannelURI -} - -// DeviceTokenMicrosoftPushVoIP represents TL type `deviceTokenMicrosoftPushVoIP#d12ca351`. -type DeviceTokenMicrosoftPushVoIP struct { - // Push notification channel URI; may be empty to deregister a device - ChannelURI string -} - -// DeviceTokenMicrosoftPushVoIPTypeID is TL type id of DeviceTokenMicrosoftPushVoIP. -const DeviceTokenMicrosoftPushVoIPTypeID = 0xd12ca351 - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenMicrosoftPushVoIP) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenMicrosoftPushVoIP. -var ( - _ bin.Encoder = &DeviceTokenMicrosoftPushVoIP{} - _ bin.Decoder = &DeviceTokenMicrosoftPushVoIP{} - _ bin.BareEncoder = &DeviceTokenMicrosoftPushVoIP{} - _ bin.BareDecoder = &DeviceTokenMicrosoftPushVoIP{} - - _ DeviceTokenClass = &DeviceTokenMicrosoftPushVoIP{} -) - -func (d *DeviceTokenMicrosoftPushVoIP) Zero() bool { - if d == nil { - return true - } - if !(d.ChannelURI == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenMicrosoftPushVoIP) String() string { - if d == nil { - return "DeviceTokenMicrosoftPushVoIP(nil)" - } - type Alias DeviceTokenMicrosoftPushVoIP - return fmt.Sprintf("DeviceTokenMicrosoftPushVoIP%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenMicrosoftPushVoIP) TypeID() uint32 { - return DeviceTokenMicrosoftPushVoIPTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenMicrosoftPushVoIP) TypeName() string { - return "deviceTokenMicrosoftPushVoIP" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenMicrosoftPushVoIP) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenMicrosoftPushVoIP", - ID: DeviceTokenMicrosoftPushVoIPTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChannelURI", - SchemaName: "channel_uri", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenMicrosoftPushVoIP) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenMicrosoftPushVoIP#d12ca351 as nil") - } - b.PutID(DeviceTokenMicrosoftPushVoIPTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenMicrosoftPushVoIP) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenMicrosoftPushVoIP#d12ca351 as nil") - } - b.PutString(d.ChannelURI) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenMicrosoftPushVoIP) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenMicrosoftPushVoIP#d12ca351 to nil") - } - if err := b.ConsumeID(DeviceTokenMicrosoftPushVoIPTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenMicrosoftPushVoIP#d12ca351: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenMicrosoftPushVoIP) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenMicrosoftPushVoIP#d12ca351 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenMicrosoftPushVoIP#d12ca351: field channel_uri: %w", err) - } - d.ChannelURI = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenMicrosoftPushVoIP) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenMicrosoftPushVoIP#d12ca351 as nil") - } - b.ObjStart() - b.PutID("deviceTokenMicrosoftPushVoIP") - b.Comma() - b.FieldStart("channel_uri") - b.PutString(d.ChannelURI) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenMicrosoftPushVoIP) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenMicrosoftPushVoIP#d12ca351 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenMicrosoftPushVoIP"); err != nil { - return fmt.Errorf("unable to decode deviceTokenMicrosoftPushVoIP#d12ca351: %w", err) - } - case "channel_uri": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenMicrosoftPushVoIP#d12ca351: field channel_uri: %w", err) - } - d.ChannelURI = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChannelURI returns value of ChannelURI field. -func (d *DeviceTokenMicrosoftPushVoIP) GetChannelURI() (value string) { - if d == nil { - return - } - return d.ChannelURI -} - -// DeviceTokenWebPush represents TL type `deviceTokenWebPush#9affdef7`. -type DeviceTokenWebPush struct { - // Absolute URL exposed by the push service where the application server can send push - // messages; may be empty to deregister a device - Endpoint string - // Base64url-encoded P-256 elliptic curve Diffie-Hellman public key - P256dhBase64url string - // Base64url-encoded authentication secret - AuthBase64url string -} - -// DeviceTokenWebPushTypeID is TL type id of DeviceTokenWebPush. -const DeviceTokenWebPushTypeID = 0x9affdef7 - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenWebPush) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenWebPush. -var ( - _ bin.Encoder = &DeviceTokenWebPush{} - _ bin.Decoder = &DeviceTokenWebPush{} - _ bin.BareEncoder = &DeviceTokenWebPush{} - _ bin.BareDecoder = &DeviceTokenWebPush{} - - _ DeviceTokenClass = &DeviceTokenWebPush{} -) - -func (d *DeviceTokenWebPush) Zero() bool { - if d == nil { - return true - } - if !(d.Endpoint == "") { - return false - } - if !(d.P256dhBase64url == "") { - return false - } - if !(d.AuthBase64url == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenWebPush) String() string { - if d == nil { - return "DeviceTokenWebPush(nil)" - } - type Alias DeviceTokenWebPush - return fmt.Sprintf("DeviceTokenWebPush%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenWebPush) TypeID() uint32 { - return DeviceTokenWebPushTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenWebPush) TypeName() string { - return "deviceTokenWebPush" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenWebPush) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenWebPush", - ID: DeviceTokenWebPushTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Endpoint", - SchemaName: "endpoint", - }, - { - Name: "P256dhBase64url", - SchemaName: "p256dh_base64url", - }, - { - Name: "AuthBase64url", - SchemaName: "auth_base64url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenWebPush) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenWebPush#9affdef7 as nil") - } - b.PutID(DeviceTokenWebPushTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenWebPush) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenWebPush#9affdef7 as nil") - } - b.PutString(d.Endpoint) - b.PutString(d.P256dhBase64url) - b.PutString(d.AuthBase64url) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenWebPush) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenWebPush#9affdef7 to nil") - } - if err := b.ConsumeID(DeviceTokenWebPushTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenWebPush#9affdef7: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenWebPush) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenWebPush#9affdef7 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenWebPush#9affdef7: field endpoint: %w", err) - } - d.Endpoint = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenWebPush#9affdef7: field p256dh_base64url: %w", err) - } - d.P256dhBase64url = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenWebPush#9affdef7: field auth_base64url: %w", err) - } - d.AuthBase64url = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenWebPush) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenWebPush#9affdef7 as nil") - } - b.ObjStart() - b.PutID("deviceTokenWebPush") - b.Comma() - b.FieldStart("endpoint") - b.PutString(d.Endpoint) - b.Comma() - b.FieldStart("p256dh_base64url") - b.PutString(d.P256dhBase64url) - b.Comma() - b.FieldStart("auth_base64url") - b.PutString(d.AuthBase64url) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenWebPush) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenWebPush#9affdef7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenWebPush"); err != nil { - return fmt.Errorf("unable to decode deviceTokenWebPush#9affdef7: %w", err) - } - case "endpoint": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenWebPush#9affdef7: field endpoint: %w", err) - } - d.Endpoint = value - case "p256dh_base64url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenWebPush#9affdef7: field p256dh_base64url: %w", err) - } - d.P256dhBase64url = value - case "auth_base64url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenWebPush#9affdef7: field auth_base64url: %w", err) - } - d.AuthBase64url = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEndpoint returns value of Endpoint field. -func (d *DeviceTokenWebPush) GetEndpoint() (value string) { - if d == nil { - return - } - return d.Endpoint -} - -// GetP256dhBase64url returns value of P256dhBase64url field. -func (d *DeviceTokenWebPush) GetP256dhBase64url() (value string) { - if d == nil { - return - } - return d.P256dhBase64url -} - -// GetAuthBase64url returns value of AuthBase64url field. -func (d *DeviceTokenWebPush) GetAuthBase64url() (value string) { - if d == nil { - return - } - return d.AuthBase64url -} - -// DeviceTokenSimplePush represents TL type `deviceTokenSimplePush#2f49a60`. -type DeviceTokenSimplePush struct { - // Absolute URL exposed by the push service where the application server can send push - // messages; may be empty to deregister a device - Endpoint string -} - -// DeviceTokenSimplePushTypeID is TL type id of DeviceTokenSimplePush. -const DeviceTokenSimplePushTypeID = 0x2f49a60 - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenSimplePush) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenSimplePush. -var ( - _ bin.Encoder = &DeviceTokenSimplePush{} - _ bin.Decoder = &DeviceTokenSimplePush{} - _ bin.BareEncoder = &DeviceTokenSimplePush{} - _ bin.BareDecoder = &DeviceTokenSimplePush{} - - _ DeviceTokenClass = &DeviceTokenSimplePush{} -) - -func (d *DeviceTokenSimplePush) Zero() bool { - if d == nil { - return true - } - if !(d.Endpoint == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenSimplePush) String() string { - if d == nil { - return "DeviceTokenSimplePush(nil)" - } - type Alias DeviceTokenSimplePush - return fmt.Sprintf("DeviceTokenSimplePush%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenSimplePush) TypeID() uint32 { - return DeviceTokenSimplePushTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenSimplePush) TypeName() string { - return "deviceTokenSimplePush" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenSimplePush) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenSimplePush", - ID: DeviceTokenSimplePushTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Endpoint", - SchemaName: "endpoint", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenSimplePush) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenSimplePush#2f49a60 as nil") - } - b.PutID(DeviceTokenSimplePushTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenSimplePush) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenSimplePush#2f49a60 as nil") - } - b.PutString(d.Endpoint) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenSimplePush) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenSimplePush#2f49a60 to nil") - } - if err := b.ConsumeID(DeviceTokenSimplePushTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenSimplePush#2f49a60: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenSimplePush) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenSimplePush#2f49a60 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenSimplePush#2f49a60: field endpoint: %w", err) - } - d.Endpoint = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenSimplePush) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenSimplePush#2f49a60 as nil") - } - b.ObjStart() - b.PutID("deviceTokenSimplePush") - b.Comma() - b.FieldStart("endpoint") - b.PutString(d.Endpoint) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenSimplePush) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenSimplePush#2f49a60 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenSimplePush"); err != nil { - return fmt.Errorf("unable to decode deviceTokenSimplePush#2f49a60: %w", err) - } - case "endpoint": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenSimplePush#2f49a60: field endpoint: %w", err) - } - d.Endpoint = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEndpoint returns value of Endpoint field. -func (d *DeviceTokenSimplePush) GetEndpoint() (value string) { - if d == nil { - return - } - return d.Endpoint -} - -// DeviceTokenUbuntuPush represents TL type `deviceTokenUbuntuPush#6a3c0d26`. -type DeviceTokenUbuntuPush struct { - // Token; may be empty to deregister a device - Token string -} - -// DeviceTokenUbuntuPushTypeID is TL type id of DeviceTokenUbuntuPush. -const DeviceTokenUbuntuPushTypeID = 0x6a3c0d26 - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenUbuntuPush) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenUbuntuPush. -var ( - _ bin.Encoder = &DeviceTokenUbuntuPush{} - _ bin.Decoder = &DeviceTokenUbuntuPush{} - _ bin.BareEncoder = &DeviceTokenUbuntuPush{} - _ bin.BareDecoder = &DeviceTokenUbuntuPush{} - - _ DeviceTokenClass = &DeviceTokenUbuntuPush{} -) - -func (d *DeviceTokenUbuntuPush) Zero() bool { - if d == nil { - return true - } - if !(d.Token == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenUbuntuPush) String() string { - if d == nil { - return "DeviceTokenUbuntuPush(nil)" - } - type Alias DeviceTokenUbuntuPush - return fmt.Sprintf("DeviceTokenUbuntuPush%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenUbuntuPush) TypeID() uint32 { - return DeviceTokenUbuntuPushTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenUbuntuPush) TypeName() string { - return "deviceTokenUbuntuPush" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenUbuntuPush) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenUbuntuPush", - ID: DeviceTokenUbuntuPushTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenUbuntuPush) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenUbuntuPush#6a3c0d26 as nil") - } - b.PutID(DeviceTokenUbuntuPushTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenUbuntuPush) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenUbuntuPush#6a3c0d26 as nil") - } - b.PutString(d.Token) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenUbuntuPush) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenUbuntuPush#6a3c0d26 to nil") - } - if err := b.ConsumeID(DeviceTokenUbuntuPushTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenUbuntuPush#6a3c0d26: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenUbuntuPush) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenUbuntuPush#6a3c0d26 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenUbuntuPush#6a3c0d26: field token: %w", err) - } - d.Token = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenUbuntuPush) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenUbuntuPush#6a3c0d26 as nil") - } - b.ObjStart() - b.PutID("deviceTokenUbuntuPush") - b.Comma() - b.FieldStart("token") - b.PutString(d.Token) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenUbuntuPush) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenUbuntuPush#6a3c0d26 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenUbuntuPush"); err != nil { - return fmt.Errorf("unable to decode deviceTokenUbuntuPush#6a3c0d26: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenUbuntuPush#6a3c0d26: field token: %w", err) - } - d.Token = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (d *DeviceTokenUbuntuPush) GetToken() (value string) { - if d == nil { - return - } - return d.Token -} - -// DeviceTokenBlackBerryPush represents TL type `deviceTokenBlackBerryPush#5cef0102`. -type DeviceTokenBlackBerryPush struct { - // Token; may be empty to deregister a device - Token string -} - -// DeviceTokenBlackBerryPushTypeID is TL type id of DeviceTokenBlackBerryPush. -const DeviceTokenBlackBerryPushTypeID = 0x5cef0102 - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenBlackBerryPush) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenBlackBerryPush. -var ( - _ bin.Encoder = &DeviceTokenBlackBerryPush{} - _ bin.Decoder = &DeviceTokenBlackBerryPush{} - _ bin.BareEncoder = &DeviceTokenBlackBerryPush{} - _ bin.BareDecoder = &DeviceTokenBlackBerryPush{} - - _ DeviceTokenClass = &DeviceTokenBlackBerryPush{} -) - -func (d *DeviceTokenBlackBerryPush) Zero() bool { - if d == nil { - return true - } - if !(d.Token == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenBlackBerryPush) String() string { - if d == nil { - return "DeviceTokenBlackBerryPush(nil)" - } - type Alias DeviceTokenBlackBerryPush - return fmt.Sprintf("DeviceTokenBlackBerryPush%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenBlackBerryPush) TypeID() uint32 { - return DeviceTokenBlackBerryPushTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenBlackBerryPush) TypeName() string { - return "deviceTokenBlackBerryPush" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenBlackBerryPush) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenBlackBerryPush", - ID: DeviceTokenBlackBerryPushTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenBlackBerryPush) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenBlackBerryPush#5cef0102 as nil") - } - b.PutID(DeviceTokenBlackBerryPushTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenBlackBerryPush) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenBlackBerryPush#5cef0102 as nil") - } - b.PutString(d.Token) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenBlackBerryPush) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenBlackBerryPush#5cef0102 to nil") - } - if err := b.ConsumeID(DeviceTokenBlackBerryPushTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenBlackBerryPush#5cef0102: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenBlackBerryPush) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenBlackBerryPush#5cef0102 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenBlackBerryPush#5cef0102: field token: %w", err) - } - d.Token = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenBlackBerryPush) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenBlackBerryPush#5cef0102 as nil") - } - b.ObjStart() - b.PutID("deviceTokenBlackBerryPush") - b.Comma() - b.FieldStart("token") - b.PutString(d.Token) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenBlackBerryPush) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenBlackBerryPush#5cef0102 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenBlackBerryPush"); err != nil { - return fmt.Errorf("unable to decode deviceTokenBlackBerryPush#5cef0102: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenBlackBerryPush#5cef0102: field token: %w", err) - } - d.Token = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (d *DeviceTokenBlackBerryPush) GetToken() (value string) { - if d == nil { - return - } - return d.Token -} - -// DeviceTokenTizenPush represents TL type `deviceTokenTizenPush#aef0da33`. -type DeviceTokenTizenPush struct { - // Push service registration identifier; may be empty to deregister a device - RegID string -} - -// DeviceTokenTizenPushTypeID is TL type id of DeviceTokenTizenPush. -const DeviceTokenTizenPushTypeID = 0xaef0da33 - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenTizenPush) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenTizenPush. -var ( - _ bin.Encoder = &DeviceTokenTizenPush{} - _ bin.Decoder = &DeviceTokenTizenPush{} - _ bin.BareEncoder = &DeviceTokenTizenPush{} - _ bin.BareDecoder = &DeviceTokenTizenPush{} - - _ DeviceTokenClass = &DeviceTokenTizenPush{} -) - -func (d *DeviceTokenTizenPush) Zero() bool { - if d == nil { - return true - } - if !(d.RegID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenTizenPush) String() string { - if d == nil { - return "DeviceTokenTizenPush(nil)" - } - type Alias DeviceTokenTizenPush - return fmt.Sprintf("DeviceTokenTizenPush%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenTizenPush) TypeID() uint32 { - return DeviceTokenTizenPushTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenTizenPush) TypeName() string { - return "deviceTokenTizenPush" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenTizenPush) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenTizenPush", - ID: DeviceTokenTizenPushTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RegID", - SchemaName: "reg_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenTizenPush) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenTizenPush#aef0da33 as nil") - } - b.PutID(DeviceTokenTizenPushTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenTizenPush) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenTizenPush#aef0da33 as nil") - } - b.PutString(d.RegID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenTizenPush) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenTizenPush#aef0da33 to nil") - } - if err := b.ConsumeID(DeviceTokenTizenPushTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenTizenPush#aef0da33: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenTizenPush) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenTizenPush#aef0da33 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenTizenPush#aef0da33: field reg_id: %w", err) - } - d.RegID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenTizenPush) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenTizenPush#aef0da33 as nil") - } - b.ObjStart() - b.PutID("deviceTokenTizenPush") - b.Comma() - b.FieldStart("reg_id") - b.PutString(d.RegID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenTizenPush) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenTizenPush#aef0da33 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenTizenPush"); err != nil { - return fmt.Errorf("unable to decode deviceTokenTizenPush#aef0da33: %w", err) - } - case "reg_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenTizenPush#aef0da33: field reg_id: %w", err) - } - d.RegID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRegID returns value of RegID field. -func (d *DeviceTokenTizenPush) GetRegID() (value string) { - if d == nil { - return - } - return d.RegID -} - -// DeviceTokenHuaweiPush represents TL type `deviceTokenHuaweiPush#768f4e26`. -type DeviceTokenHuaweiPush struct { - // Device registration token; may be empty to deregister a device - Token string - // True, if push notifications must be additionally encrypted - Encrypt bool -} - -// DeviceTokenHuaweiPushTypeID is TL type id of DeviceTokenHuaweiPush. -const DeviceTokenHuaweiPushTypeID = 0x768f4e26 - -// construct implements constructor of DeviceTokenClass. -func (d DeviceTokenHuaweiPush) construct() DeviceTokenClass { return &d } - -// Ensuring interfaces in compile-time for DeviceTokenHuaweiPush. -var ( - _ bin.Encoder = &DeviceTokenHuaweiPush{} - _ bin.Decoder = &DeviceTokenHuaweiPush{} - _ bin.BareEncoder = &DeviceTokenHuaweiPush{} - _ bin.BareDecoder = &DeviceTokenHuaweiPush{} - - _ DeviceTokenClass = &DeviceTokenHuaweiPush{} -) - -func (d *DeviceTokenHuaweiPush) Zero() bool { - if d == nil { - return true - } - if !(d.Token == "") { - return false - } - if !(d.Encrypt == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DeviceTokenHuaweiPush) String() string { - if d == nil { - return "DeviceTokenHuaweiPush(nil)" - } - type Alias DeviceTokenHuaweiPush - return fmt.Sprintf("DeviceTokenHuaweiPush%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DeviceTokenHuaweiPush) TypeID() uint32 { - return DeviceTokenHuaweiPushTypeID -} - -// TypeName returns name of type in TL schema. -func (*DeviceTokenHuaweiPush) TypeName() string { - return "deviceTokenHuaweiPush" -} - -// TypeInfo returns info about TL type. -func (d *DeviceTokenHuaweiPush) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "deviceTokenHuaweiPush", - ID: DeviceTokenHuaweiPushTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - { - Name: "Encrypt", - SchemaName: "encrypt", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DeviceTokenHuaweiPush) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenHuaweiPush#768f4e26 as nil") - } - b.PutID(DeviceTokenHuaweiPushTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DeviceTokenHuaweiPush) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenHuaweiPush#768f4e26 as nil") - } - b.PutString(d.Token) - b.PutBool(d.Encrypt) - return nil -} - -// Decode implements bin.Decoder. -func (d *DeviceTokenHuaweiPush) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenHuaweiPush#768f4e26 to nil") - } - if err := b.ConsumeID(DeviceTokenHuaweiPushTypeID); err != nil { - return fmt.Errorf("unable to decode deviceTokenHuaweiPush#768f4e26: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DeviceTokenHuaweiPush) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenHuaweiPush#768f4e26 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenHuaweiPush#768f4e26: field token: %w", err) - } - d.Token = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenHuaweiPush#768f4e26: field encrypt: %w", err) - } - d.Encrypt = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DeviceTokenHuaweiPush) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode deviceTokenHuaweiPush#768f4e26 as nil") - } - b.ObjStart() - b.PutID("deviceTokenHuaweiPush") - b.Comma() - b.FieldStart("token") - b.PutString(d.Token) - b.Comma() - b.FieldStart("encrypt") - b.PutBool(d.Encrypt) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DeviceTokenHuaweiPush) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode deviceTokenHuaweiPush#768f4e26 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("deviceTokenHuaweiPush"); err != nil { - return fmt.Errorf("unable to decode deviceTokenHuaweiPush#768f4e26: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenHuaweiPush#768f4e26: field token: %w", err) - } - d.Token = value - case "encrypt": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode deviceTokenHuaweiPush#768f4e26: field encrypt: %w", err) - } - d.Encrypt = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (d *DeviceTokenHuaweiPush) GetToken() (value string) { - if d == nil { - return - } - return d.Token -} - -// GetEncrypt returns value of Encrypt field. -func (d *DeviceTokenHuaweiPush) GetEncrypt() (value bool) { - if d == nil { - return - } - return d.Encrypt -} - -// DeviceTokenClassName is schema name of DeviceTokenClass. -const DeviceTokenClassName = "DeviceToken" - -// DeviceTokenClass represents DeviceToken generic type. -// -// Example: -// -// g, err := tdapi.DecodeDeviceToken(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.DeviceTokenFirebaseCloudMessaging: // deviceTokenFirebaseCloudMessaging#d0714a07 -// case *tdapi.DeviceTokenApplePush: // deviceTokenApplePush#17196bc3 -// case *tdapi.DeviceTokenApplePushVoIP: // deviceTokenApplePushVoIP#2ff045e9 -// case *tdapi.DeviceTokenWindowsPush: // deviceTokenWindowsPush#abed428f -// case *tdapi.DeviceTokenMicrosoftPush: // deviceTokenMicrosoftPush#48f8e04c -// case *tdapi.DeviceTokenMicrosoftPushVoIP: // deviceTokenMicrosoftPushVoIP#d12ca351 -// case *tdapi.DeviceTokenWebPush: // deviceTokenWebPush#9affdef7 -// case *tdapi.DeviceTokenSimplePush: // deviceTokenSimplePush#2f49a60 -// case *tdapi.DeviceTokenUbuntuPush: // deviceTokenUbuntuPush#6a3c0d26 -// case *tdapi.DeviceTokenBlackBerryPush: // deviceTokenBlackBerryPush#5cef0102 -// case *tdapi.DeviceTokenTizenPush: // deviceTokenTizenPush#aef0da33 -// case *tdapi.DeviceTokenHuaweiPush: // deviceTokenHuaweiPush#768f4e26 -// default: panic(v) -// } -type DeviceTokenClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() DeviceTokenClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeDeviceToken implements binary de-serialization for DeviceTokenClass. -func DecodeDeviceToken(buf *bin.Buffer) (DeviceTokenClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case DeviceTokenFirebaseCloudMessagingTypeID: - // Decoding deviceTokenFirebaseCloudMessaging#d0714a07. - v := DeviceTokenFirebaseCloudMessaging{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case DeviceTokenApplePushTypeID: - // Decoding deviceTokenApplePush#17196bc3. - v := DeviceTokenApplePush{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case DeviceTokenApplePushVoIPTypeID: - // Decoding deviceTokenApplePushVoIP#2ff045e9. - v := DeviceTokenApplePushVoIP{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case DeviceTokenWindowsPushTypeID: - // Decoding deviceTokenWindowsPush#abed428f. - v := DeviceTokenWindowsPush{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case DeviceTokenMicrosoftPushTypeID: - // Decoding deviceTokenMicrosoftPush#48f8e04c. - v := DeviceTokenMicrosoftPush{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case DeviceTokenMicrosoftPushVoIPTypeID: - // Decoding deviceTokenMicrosoftPushVoIP#d12ca351. - v := DeviceTokenMicrosoftPushVoIP{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case DeviceTokenWebPushTypeID: - // Decoding deviceTokenWebPush#9affdef7. - v := DeviceTokenWebPush{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case DeviceTokenSimplePushTypeID: - // Decoding deviceTokenSimplePush#2f49a60. - v := DeviceTokenSimplePush{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case DeviceTokenUbuntuPushTypeID: - // Decoding deviceTokenUbuntuPush#6a3c0d26. - v := DeviceTokenUbuntuPush{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case DeviceTokenBlackBerryPushTypeID: - // Decoding deviceTokenBlackBerryPush#5cef0102. - v := DeviceTokenBlackBerryPush{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case DeviceTokenTizenPushTypeID: - // Decoding deviceTokenTizenPush#aef0da33. - v := DeviceTokenTizenPush{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case DeviceTokenHuaweiPushTypeID: - // Decoding deviceTokenHuaweiPush#768f4e26. - v := DeviceTokenHuaweiPush{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONDeviceToken implements binary de-serialization for DeviceTokenClass. -func DecodeTDLibJSONDeviceToken(buf tdjson.Decoder) (DeviceTokenClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "deviceTokenFirebaseCloudMessaging": - // Decoding deviceTokenFirebaseCloudMessaging#d0714a07. - v := DeviceTokenFirebaseCloudMessaging{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case "deviceTokenApplePush": - // Decoding deviceTokenApplePush#17196bc3. - v := DeviceTokenApplePush{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case "deviceTokenApplePushVoIP": - // Decoding deviceTokenApplePushVoIP#2ff045e9. - v := DeviceTokenApplePushVoIP{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case "deviceTokenWindowsPush": - // Decoding deviceTokenWindowsPush#abed428f. - v := DeviceTokenWindowsPush{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case "deviceTokenMicrosoftPush": - // Decoding deviceTokenMicrosoftPush#48f8e04c. - v := DeviceTokenMicrosoftPush{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case "deviceTokenMicrosoftPushVoIP": - // Decoding deviceTokenMicrosoftPushVoIP#d12ca351. - v := DeviceTokenMicrosoftPushVoIP{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case "deviceTokenWebPush": - // Decoding deviceTokenWebPush#9affdef7. - v := DeviceTokenWebPush{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case "deviceTokenSimplePush": - // Decoding deviceTokenSimplePush#2f49a60. - v := DeviceTokenSimplePush{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case "deviceTokenUbuntuPush": - // Decoding deviceTokenUbuntuPush#6a3c0d26. - v := DeviceTokenUbuntuPush{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case "deviceTokenBlackBerryPush": - // Decoding deviceTokenBlackBerryPush#5cef0102. - v := DeviceTokenBlackBerryPush{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case "deviceTokenTizenPush": - // Decoding deviceTokenTizenPush#aef0da33. - v := DeviceTokenTizenPush{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - case "deviceTokenHuaweiPush": - // Decoding deviceTokenHuaweiPush#768f4e26. - v := DeviceTokenHuaweiPush{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode DeviceTokenClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// DeviceToken boxes the DeviceTokenClass providing a helper. -type DeviceTokenBox struct { - DeviceToken DeviceTokenClass -} - -// Decode implements bin.Decoder for DeviceTokenBox. -func (b *DeviceTokenBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode DeviceTokenBox to nil") - } - v, err := DecodeDeviceToken(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.DeviceToken = v - return nil -} - -// Encode implements bin.Encode for DeviceTokenBox. -func (b *DeviceTokenBox) Encode(buf *bin.Buffer) error { - if b == nil || b.DeviceToken == nil { - return fmt.Errorf("unable to encode DeviceTokenClass as nil") - } - return b.DeviceToken.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for DeviceTokenBox. -func (b *DeviceTokenBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode DeviceTokenBox to nil") - } - v, err := DecodeTDLibJSONDeviceToken(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.DeviceToken = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for DeviceTokenBox. -func (b *DeviceTokenBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.DeviceToken == nil { - return fmt.Errorf("unable to encode DeviceTokenClass as nil") - } - return b.DeviceToken.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_dice_stickers_gen.go b/tdapi/tl_dice_stickers_gen.go deleted file mode 100644 index de82feaa6..000000000 --- a/tdapi/tl_dice_stickers_gen.go +++ /dev/null @@ -1,639 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DiceStickersRegular represents TL type `diceStickersRegular#d3dfecce`. -type DiceStickersRegular struct { - // The animated sticker with the dice animation - Sticker Sticker -} - -// DiceStickersRegularTypeID is TL type id of DiceStickersRegular. -const DiceStickersRegularTypeID = 0xd3dfecce - -// construct implements constructor of DiceStickersClass. -func (d DiceStickersRegular) construct() DiceStickersClass { return &d } - -// Ensuring interfaces in compile-time for DiceStickersRegular. -var ( - _ bin.Encoder = &DiceStickersRegular{} - _ bin.Decoder = &DiceStickersRegular{} - _ bin.BareEncoder = &DiceStickersRegular{} - _ bin.BareDecoder = &DiceStickersRegular{} - - _ DiceStickersClass = &DiceStickersRegular{} -) - -func (d *DiceStickersRegular) Zero() bool { - if d == nil { - return true - } - if !(d.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DiceStickersRegular) String() string { - if d == nil { - return "DiceStickersRegular(nil)" - } - type Alias DiceStickersRegular - return fmt.Sprintf("DiceStickersRegular%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DiceStickersRegular) TypeID() uint32 { - return DiceStickersRegularTypeID -} - -// TypeName returns name of type in TL schema. -func (*DiceStickersRegular) TypeName() string { - return "diceStickersRegular" -} - -// TypeInfo returns info about TL type. -func (d *DiceStickersRegular) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "diceStickersRegular", - ID: DiceStickersRegularTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DiceStickersRegular) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode diceStickersRegular#d3dfecce as nil") - } - b.PutID(DiceStickersRegularTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DiceStickersRegular) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode diceStickersRegular#d3dfecce as nil") - } - if err := d.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode diceStickersRegular#d3dfecce: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DiceStickersRegular) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode diceStickersRegular#d3dfecce to nil") - } - if err := b.ConsumeID(DiceStickersRegularTypeID); err != nil { - return fmt.Errorf("unable to decode diceStickersRegular#d3dfecce: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DiceStickersRegular) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode diceStickersRegular#d3dfecce to nil") - } - { - if err := d.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode diceStickersRegular#d3dfecce: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DiceStickersRegular) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode diceStickersRegular#d3dfecce as nil") - } - b.ObjStart() - b.PutID("diceStickersRegular") - b.Comma() - b.FieldStart("sticker") - if err := d.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode diceStickersRegular#d3dfecce: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DiceStickersRegular) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode diceStickersRegular#d3dfecce to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("diceStickersRegular"); err != nil { - return fmt.Errorf("unable to decode diceStickersRegular#d3dfecce: %w", err) - } - case "sticker": - if err := d.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode diceStickersRegular#d3dfecce: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (d *DiceStickersRegular) GetSticker() (value Sticker) { - if d == nil { - return - } - return d.Sticker -} - -// DiceStickersSlotMachine represents TL type `diceStickersSlotMachine#e9a28cac`. -type DiceStickersSlotMachine struct { - // The animated sticker with the slot machine background. The background animation must - // start playing after all reel animations finish - Background Sticker - // The animated sticker with the lever animation. The lever animation must play once in - // the initial dice state - Lever Sticker - // The animated sticker with the left reel - LeftReel Sticker - // The animated sticker with the center reel - CenterReel Sticker - // The animated sticker with the right reel - RightReel Sticker -} - -// DiceStickersSlotMachineTypeID is TL type id of DiceStickersSlotMachine. -const DiceStickersSlotMachineTypeID = 0xe9a28cac - -// construct implements constructor of DiceStickersClass. -func (d DiceStickersSlotMachine) construct() DiceStickersClass { return &d } - -// Ensuring interfaces in compile-time for DiceStickersSlotMachine. -var ( - _ bin.Encoder = &DiceStickersSlotMachine{} - _ bin.Decoder = &DiceStickersSlotMachine{} - _ bin.BareEncoder = &DiceStickersSlotMachine{} - _ bin.BareDecoder = &DiceStickersSlotMachine{} - - _ DiceStickersClass = &DiceStickersSlotMachine{} -) - -func (d *DiceStickersSlotMachine) Zero() bool { - if d == nil { - return true - } - if !(d.Background.Zero()) { - return false - } - if !(d.Lever.Zero()) { - return false - } - if !(d.LeftReel.Zero()) { - return false - } - if !(d.CenterReel.Zero()) { - return false - } - if !(d.RightReel.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DiceStickersSlotMachine) String() string { - if d == nil { - return "DiceStickersSlotMachine(nil)" - } - type Alias DiceStickersSlotMachine - return fmt.Sprintf("DiceStickersSlotMachine%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DiceStickersSlotMachine) TypeID() uint32 { - return DiceStickersSlotMachineTypeID -} - -// TypeName returns name of type in TL schema. -func (*DiceStickersSlotMachine) TypeName() string { - return "diceStickersSlotMachine" -} - -// TypeInfo returns info about TL type. -func (d *DiceStickersSlotMachine) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "diceStickersSlotMachine", - ID: DiceStickersSlotMachineTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Background", - SchemaName: "background", - }, - { - Name: "Lever", - SchemaName: "lever", - }, - { - Name: "LeftReel", - SchemaName: "left_reel", - }, - { - Name: "CenterReel", - SchemaName: "center_reel", - }, - { - Name: "RightReel", - SchemaName: "right_reel", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DiceStickersSlotMachine) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode diceStickersSlotMachine#e9a28cac as nil") - } - b.PutID(DiceStickersSlotMachineTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DiceStickersSlotMachine) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode diceStickersSlotMachine#e9a28cac as nil") - } - if err := d.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode diceStickersSlotMachine#e9a28cac: field background: %w", err) - } - if err := d.Lever.Encode(b); err != nil { - return fmt.Errorf("unable to encode diceStickersSlotMachine#e9a28cac: field lever: %w", err) - } - if err := d.LeftReel.Encode(b); err != nil { - return fmt.Errorf("unable to encode diceStickersSlotMachine#e9a28cac: field left_reel: %w", err) - } - if err := d.CenterReel.Encode(b); err != nil { - return fmt.Errorf("unable to encode diceStickersSlotMachine#e9a28cac: field center_reel: %w", err) - } - if err := d.RightReel.Encode(b); err != nil { - return fmt.Errorf("unable to encode diceStickersSlotMachine#e9a28cac: field right_reel: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DiceStickersSlotMachine) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode diceStickersSlotMachine#e9a28cac to nil") - } - if err := b.ConsumeID(DiceStickersSlotMachineTypeID); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DiceStickersSlotMachine) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode diceStickersSlotMachine#e9a28cac to nil") - } - { - if err := d.Background.Decode(b); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: field background: %w", err) - } - } - { - if err := d.Lever.Decode(b); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: field lever: %w", err) - } - } - { - if err := d.LeftReel.Decode(b); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: field left_reel: %w", err) - } - } - { - if err := d.CenterReel.Decode(b); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: field center_reel: %w", err) - } - } - { - if err := d.RightReel.Decode(b); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: field right_reel: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DiceStickersSlotMachine) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode diceStickersSlotMachine#e9a28cac as nil") - } - b.ObjStart() - b.PutID("diceStickersSlotMachine") - b.Comma() - b.FieldStart("background") - if err := d.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode diceStickersSlotMachine#e9a28cac: field background: %w", err) - } - b.Comma() - b.FieldStart("lever") - if err := d.Lever.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode diceStickersSlotMachine#e9a28cac: field lever: %w", err) - } - b.Comma() - b.FieldStart("left_reel") - if err := d.LeftReel.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode diceStickersSlotMachine#e9a28cac: field left_reel: %w", err) - } - b.Comma() - b.FieldStart("center_reel") - if err := d.CenterReel.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode diceStickersSlotMachine#e9a28cac: field center_reel: %w", err) - } - b.Comma() - b.FieldStart("right_reel") - if err := d.RightReel.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode diceStickersSlotMachine#e9a28cac: field right_reel: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DiceStickersSlotMachine) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode diceStickersSlotMachine#e9a28cac to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("diceStickersSlotMachine"); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: %w", err) - } - case "background": - if err := d.Background.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: field background: %w", err) - } - case "lever": - if err := d.Lever.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: field lever: %w", err) - } - case "left_reel": - if err := d.LeftReel.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: field left_reel: %w", err) - } - case "center_reel": - if err := d.CenterReel.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: field center_reel: %w", err) - } - case "right_reel": - if err := d.RightReel.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode diceStickersSlotMachine#e9a28cac: field right_reel: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBackground returns value of Background field. -func (d *DiceStickersSlotMachine) GetBackground() (value Sticker) { - if d == nil { - return - } - return d.Background -} - -// GetLever returns value of Lever field. -func (d *DiceStickersSlotMachine) GetLever() (value Sticker) { - if d == nil { - return - } - return d.Lever -} - -// GetLeftReel returns value of LeftReel field. -func (d *DiceStickersSlotMachine) GetLeftReel() (value Sticker) { - if d == nil { - return - } - return d.LeftReel -} - -// GetCenterReel returns value of CenterReel field. -func (d *DiceStickersSlotMachine) GetCenterReel() (value Sticker) { - if d == nil { - return - } - return d.CenterReel -} - -// GetRightReel returns value of RightReel field. -func (d *DiceStickersSlotMachine) GetRightReel() (value Sticker) { - if d == nil { - return - } - return d.RightReel -} - -// DiceStickersClassName is schema name of DiceStickersClass. -const DiceStickersClassName = "DiceStickers" - -// DiceStickersClass represents DiceStickers generic type. -// -// Example: -// -// g, err := tdapi.DecodeDiceStickers(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.DiceStickersRegular: // diceStickersRegular#d3dfecce -// case *tdapi.DiceStickersSlotMachine: // diceStickersSlotMachine#e9a28cac -// default: panic(v) -// } -type DiceStickersClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() DiceStickersClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeDiceStickers implements binary de-serialization for DiceStickersClass. -func DecodeDiceStickers(buf *bin.Buffer) (DiceStickersClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case DiceStickersRegularTypeID: - // Decoding diceStickersRegular#d3dfecce. - v := DiceStickersRegular{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DiceStickersClass: %w", err) - } - return &v, nil - case DiceStickersSlotMachineTypeID: - // Decoding diceStickersSlotMachine#e9a28cac. - v := DiceStickersSlotMachine{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode DiceStickersClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode DiceStickersClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONDiceStickers implements binary de-serialization for DiceStickersClass. -func DecodeTDLibJSONDiceStickers(buf tdjson.Decoder) (DiceStickersClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "diceStickersRegular": - // Decoding diceStickersRegular#d3dfecce. - v := DiceStickersRegular{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DiceStickersClass: %w", err) - } - return &v, nil - case "diceStickersSlotMachine": - // Decoding diceStickersSlotMachine#e9a28cac. - v := DiceStickersSlotMachine{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode DiceStickersClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode DiceStickersClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// DiceStickers boxes the DiceStickersClass providing a helper. -type DiceStickersBox struct { - DiceStickers DiceStickersClass -} - -// Decode implements bin.Decoder for DiceStickersBox. -func (b *DiceStickersBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode DiceStickersBox to nil") - } - v, err := DecodeDiceStickers(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.DiceStickers = v - return nil -} - -// Encode implements bin.Encode for DiceStickersBox. -func (b *DiceStickersBox) Encode(buf *bin.Buffer) error { - if b == nil || b.DiceStickers == nil { - return fmt.Errorf("unable to encode DiceStickersClass as nil") - } - return b.DiceStickers.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for DiceStickersBox. -func (b *DiceStickersBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode DiceStickersBox to nil") - } - v, err := DecodeTDLibJSONDiceStickers(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.DiceStickers = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for DiceStickersBox. -func (b *DiceStickersBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.DiceStickers == nil { - return fmt.Errorf("unable to encode DiceStickersClass as nil") - } - return b.DiceStickers.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_disable_all_supergroup_usernames_gen.go b/tdapi/tl_disable_all_supergroup_usernames_gen.go deleted file mode 100644 index f009e6787..000000000 --- a/tdapi/tl_disable_all_supergroup_usernames_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DisableAllSupergroupUsernamesRequest represents TL type `disableAllSupergroupUsernames#3246f5b0`. -type DisableAllSupergroupUsernamesRequest struct { - // Identifier of the supergroup or channel - SupergroupID int64 -} - -// DisableAllSupergroupUsernamesRequestTypeID is TL type id of DisableAllSupergroupUsernamesRequest. -const DisableAllSupergroupUsernamesRequestTypeID = 0x3246f5b0 - -// Ensuring interfaces in compile-time for DisableAllSupergroupUsernamesRequest. -var ( - _ bin.Encoder = &DisableAllSupergroupUsernamesRequest{} - _ bin.Decoder = &DisableAllSupergroupUsernamesRequest{} - _ bin.BareEncoder = &DisableAllSupergroupUsernamesRequest{} - _ bin.BareDecoder = &DisableAllSupergroupUsernamesRequest{} -) - -func (d *DisableAllSupergroupUsernamesRequest) Zero() bool { - if d == nil { - return true - } - if !(d.SupergroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DisableAllSupergroupUsernamesRequest) String() string { - if d == nil { - return "DisableAllSupergroupUsernamesRequest(nil)" - } - type Alias DisableAllSupergroupUsernamesRequest - return fmt.Sprintf("DisableAllSupergroupUsernamesRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DisableAllSupergroupUsernamesRequest) TypeID() uint32 { - return DisableAllSupergroupUsernamesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DisableAllSupergroupUsernamesRequest) TypeName() string { - return "disableAllSupergroupUsernames" -} - -// TypeInfo returns info about TL type. -func (d *DisableAllSupergroupUsernamesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "disableAllSupergroupUsernames", - ID: DisableAllSupergroupUsernamesRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DisableAllSupergroupUsernamesRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disableAllSupergroupUsernames#3246f5b0 as nil") - } - b.PutID(DisableAllSupergroupUsernamesRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DisableAllSupergroupUsernamesRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disableAllSupergroupUsernames#3246f5b0 as nil") - } - b.PutInt53(d.SupergroupID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DisableAllSupergroupUsernamesRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disableAllSupergroupUsernames#3246f5b0 to nil") - } - if err := b.ConsumeID(DisableAllSupergroupUsernamesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode disableAllSupergroupUsernames#3246f5b0: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DisableAllSupergroupUsernamesRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disableAllSupergroupUsernames#3246f5b0 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode disableAllSupergroupUsernames#3246f5b0: field supergroup_id: %w", err) - } - d.SupergroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DisableAllSupergroupUsernamesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode disableAllSupergroupUsernames#3246f5b0 as nil") - } - b.ObjStart() - b.PutID("disableAllSupergroupUsernames") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(d.SupergroupID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DisableAllSupergroupUsernamesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode disableAllSupergroupUsernames#3246f5b0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("disableAllSupergroupUsernames"); err != nil { - return fmt.Errorf("unable to decode disableAllSupergroupUsernames#3246f5b0: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode disableAllSupergroupUsernames#3246f5b0: field supergroup_id: %w", err) - } - d.SupergroupID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (d *DisableAllSupergroupUsernamesRequest) GetSupergroupID() (value int64) { - if d == nil { - return - } - return d.SupergroupID -} - -// DisableAllSupergroupUsernames invokes method disableAllSupergroupUsernames#3246f5b0 returning error if any. -func (c *Client) DisableAllSupergroupUsernames(ctx context.Context, supergroupid int64) error { - var ok Ok - - request := &DisableAllSupergroupUsernamesRequest{ - SupergroupID: supergroupid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_disable_proxy_gen.go b/tdapi/tl_disable_proxy_gen.go deleted file mode 100644 index a8559a3f2..000000000 --- a/tdapi/tl_disable_proxy_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DisableProxyRequest represents TL type `disableProxy#82d31782`. -type DisableProxyRequest struct { -} - -// DisableProxyRequestTypeID is TL type id of DisableProxyRequest. -const DisableProxyRequestTypeID = 0x82d31782 - -// Ensuring interfaces in compile-time for DisableProxyRequest. -var ( - _ bin.Encoder = &DisableProxyRequest{} - _ bin.Decoder = &DisableProxyRequest{} - _ bin.BareEncoder = &DisableProxyRequest{} - _ bin.BareDecoder = &DisableProxyRequest{} -) - -func (d *DisableProxyRequest) Zero() bool { - if d == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (d *DisableProxyRequest) String() string { - if d == nil { - return "DisableProxyRequest(nil)" - } - type Alias DisableProxyRequest - return fmt.Sprintf("DisableProxyRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DisableProxyRequest) TypeID() uint32 { - return DisableProxyRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DisableProxyRequest) TypeName() string { - return "disableProxy" -} - -// TypeInfo returns info about TL type. -func (d *DisableProxyRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "disableProxy", - ID: DisableProxyRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (d *DisableProxyRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disableProxy#82d31782 as nil") - } - b.PutID(DisableProxyRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DisableProxyRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disableProxy#82d31782 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DisableProxyRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disableProxy#82d31782 to nil") - } - if err := b.ConsumeID(DisableProxyRequestTypeID); err != nil { - return fmt.Errorf("unable to decode disableProxy#82d31782: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DisableProxyRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disableProxy#82d31782 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DisableProxyRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode disableProxy#82d31782 as nil") - } - b.ObjStart() - b.PutID("disableProxy") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DisableProxyRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode disableProxy#82d31782 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("disableProxy"); err != nil { - return fmt.Errorf("unable to decode disableProxy#82d31782: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// DisableProxy invokes method disableProxy#82d31782 returning error if any. -func (c *Client) DisableProxy(ctx context.Context) error { - var ok Ok - - request := &DisableProxyRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_discard_call_gen.go b/tdapi/tl_discard_call_gen.go deleted file mode 100644 index c42f77afb..000000000 --- a/tdapi/tl_discard_call_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DiscardCallRequest represents TL type `discardCall#95a9a57e`. -type DiscardCallRequest struct { - // Call identifier - CallID int32 - // Pass true if the user was disconnected - IsDisconnected bool - // The call duration, in seconds - Duration int32 - // Pass true if the call was a video call - IsVideo bool - // Identifier of the connection used during the call - ConnectionID int64 -} - -// DiscardCallRequestTypeID is TL type id of DiscardCallRequest. -const DiscardCallRequestTypeID = 0x95a9a57e - -// Ensuring interfaces in compile-time for DiscardCallRequest. -var ( - _ bin.Encoder = &DiscardCallRequest{} - _ bin.Decoder = &DiscardCallRequest{} - _ bin.BareEncoder = &DiscardCallRequest{} - _ bin.BareDecoder = &DiscardCallRequest{} -) - -func (d *DiscardCallRequest) Zero() bool { - if d == nil { - return true - } - if !(d.CallID == 0) { - return false - } - if !(d.IsDisconnected == false) { - return false - } - if !(d.Duration == 0) { - return false - } - if !(d.IsVideo == false) { - return false - } - if !(d.ConnectionID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DiscardCallRequest) String() string { - if d == nil { - return "DiscardCallRequest(nil)" - } - type Alias DiscardCallRequest - return fmt.Sprintf("DiscardCallRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DiscardCallRequest) TypeID() uint32 { - return DiscardCallRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DiscardCallRequest) TypeName() string { - return "discardCall" -} - -// TypeInfo returns info about TL type. -func (d *DiscardCallRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "discardCall", - ID: DiscardCallRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CallID", - SchemaName: "call_id", - }, - { - Name: "IsDisconnected", - SchemaName: "is_disconnected", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "IsVideo", - SchemaName: "is_video", - }, - { - Name: "ConnectionID", - SchemaName: "connection_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DiscardCallRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode discardCall#95a9a57e as nil") - } - b.PutID(DiscardCallRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DiscardCallRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode discardCall#95a9a57e as nil") - } - b.PutInt32(d.CallID) - b.PutBool(d.IsDisconnected) - b.PutInt32(d.Duration) - b.PutBool(d.IsVideo) - b.PutLong(d.ConnectionID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DiscardCallRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode discardCall#95a9a57e to nil") - } - if err := b.ConsumeID(DiscardCallRequestTypeID); err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DiscardCallRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode discardCall#95a9a57e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: field call_id: %w", err) - } - d.CallID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: field is_disconnected: %w", err) - } - d.IsDisconnected = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: field duration: %w", err) - } - d.Duration = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: field is_video: %w", err) - } - d.IsVideo = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: field connection_id: %w", err) - } - d.ConnectionID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DiscardCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode discardCall#95a9a57e as nil") - } - b.ObjStart() - b.PutID("discardCall") - b.Comma() - b.FieldStart("call_id") - b.PutInt32(d.CallID) - b.Comma() - b.FieldStart("is_disconnected") - b.PutBool(d.IsDisconnected) - b.Comma() - b.FieldStart("duration") - b.PutInt32(d.Duration) - b.Comma() - b.FieldStart("is_video") - b.PutBool(d.IsVideo) - b.Comma() - b.FieldStart("connection_id") - b.PutLong(d.ConnectionID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DiscardCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode discardCall#95a9a57e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("discardCall"); err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: %w", err) - } - case "call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: field call_id: %w", err) - } - d.CallID = value - case "is_disconnected": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: field is_disconnected: %w", err) - } - d.IsDisconnected = value - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: field duration: %w", err) - } - d.Duration = value - case "is_video": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: field is_video: %w", err) - } - d.IsVideo = value - case "connection_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode discardCall#95a9a57e: field connection_id: %w", err) - } - d.ConnectionID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCallID returns value of CallID field. -func (d *DiscardCallRequest) GetCallID() (value int32) { - if d == nil { - return - } - return d.CallID -} - -// GetIsDisconnected returns value of IsDisconnected field. -func (d *DiscardCallRequest) GetIsDisconnected() (value bool) { - if d == nil { - return - } - return d.IsDisconnected -} - -// GetDuration returns value of Duration field. -func (d *DiscardCallRequest) GetDuration() (value int32) { - if d == nil { - return - } - return d.Duration -} - -// GetIsVideo returns value of IsVideo field. -func (d *DiscardCallRequest) GetIsVideo() (value bool) { - if d == nil { - return - } - return d.IsVideo -} - -// GetConnectionID returns value of ConnectionID field. -func (d *DiscardCallRequest) GetConnectionID() (value int64) { - if d == nil { - return - } - return d.ConnectionID -} - -// DiscardCall invokes method discardCall#95a9a57e returning error if any. -func (c *Client) DiscardCall(ctx context.Context, request *DiscardCallRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_disconnect_affiliate_program_gen.go b/tdapi/tl_disconnect_affiliate_program_gen.go deleted file mode 100644 index e67376419..000000000 --- a/tdapi/tl_disconnect_affiliate_program_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DisconnectAffiliateProgramRequest represents TL type `disconnectAffiliateProgram#f9b124fc`. -type DisconnectAffiliateProgramRequest struct { - // The affiliate to which the affiliate program is connected - Affiliate AffiliateTypeClass - // The referral link of the affiliate program - URL string -} - -// DisconnectAffiliateProgramRequestTypeID is TL type id of DisconnectAffiliateProgramRequest. -const DisconnectAffiliateProgramRequestTypeID = 0xf9b124fc - -// Ensuring interfaces in compile-time for DisconnectAffiliateProgramRequest. -var ( - _ bin.Encoder = &DisconnectAffiliateProgramRequest{} - _ bin.Decoder = &DisconnectAffiliateProgramRequest{} - _ bin.BareEncoder = &DisconnectAffiliateProgramRequest{} - _ bin.BareDecoder = &DisconnectAffiliateProgramRequest{} -) - -func (d *DisconnectAffiliateProgramRequest) Zero() bool { - if d == nil { - return true - } - if !(d.Affiliate == nil) { - return false - } - if !(d.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DisconnectAffiliateProgramRequest) String() string { - if d == nil { - return "DisconnectAffiliateProgramRequest(nil)" - } - type Alias DisconnectAffiliateProgramRequest - return fmt.Sprintf("DisconnectAffiliateProgramRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DisconnectAffiliateProgramRequest) TypeID() uint32 { - return DisconnectAffiliateProgramRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DisconnectAffiliateProgramRequest) TypeName() string { - return "disconnectAffiliateProgram" -} - -// TypeInfo returns info about TL type. -func (d *DisconnectAffiliateProgramRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "disconnectAffiliateProgram", - ID: DisconnectAffiliateProgramRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Affiliate", - SchemaName: "affiliate", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DisconnectAffiliateProgramRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disconnectAffiliateProgram#f9b124fc as nil") - } - b.PutID(DisconnectAffiliateProgramRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DisconnectAffiliateProgramRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disconnectAffiliateProgram#f9b124fc as nil") - } - if d.Affiliate == nil { - return fmt.Errorf("unable to encode disconnectAffiliateProgram#f9b124fc: field affiliate is nil") - } - if err := d.Affiliate.Encode(b); err != nil { - return fmt.Errorf("unable to encode disconnectAffiliateProgram#f9b124fc: field affiliate: %w", err) - } - b.PutString(d.URL) - return nil -} - -// Decode implements bin.Decoder. -func (d *DisconnectAffiliateProgramRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disconnectAffiliateProgram#f9b124fc to nil") - } - if err := b.ConsumeID(DisconnectAffiliateProgramRequestTypeID); err != nil { - return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DisconnectAffiliateProgramRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disconnectAffiliateProgram#f9b124fc to nil") - } - { - value, err := DecodeAffiliateType(b) - if err != nil { - return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: field affiliate: %w", err) - } - d.Affiliate = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: field url: %w", err) - } - d.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DisconnectAffiliateProgramRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode disconnectAffiliateProgram#f9b124fc as nil") - } - b.ObjStart() - b.PutID("disconnectAffiliateProgram") - b.Comma() - b.FieldStart("affiliate") - if d.Affiliate == nil { - return fmt.Errorf("unable to encode disconnectAffiliateProgram#f9b124fc: field affiliate is nil") - } - if err := d.Affiliate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode disconnectAffiliateProgram#f9b124fc: field affiliate: %w", err) - } - b.Comma() - b.FieldStart("url") - b.PutString(d.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DisconnectAffiliateProgramRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode disconnectAffiliateProgram#f9b124fc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("disconnectAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: %w", err) - } - case "affiliate": - value, err := DecodeTDLibJSONAffiliateType(b) - if err != nil { - return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: field affiliate: %w", err) - } - d.Affiliate = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode disconnectAffiliateProgram#f9b124fc: field url: %w", err) - } - d.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAffiliate returns value of Affiliate field. -func (d *DisconnectAffiliateProgramRequest) GetAffiliate() (value AffiliateTypeClass) { - if d == nil { - return - } - return d.Affiliate -} - -// GetURL returns value of URL field. -func (d *DisconnectAffiliateProgramRequest) GetURL() (value string) { - if d == nil { - return - } - return d.URL -} - -// DisconnectAffiliateProgram invokes method disconnectAffiliateProgram#f9b124fc returning error if any. -func (c *Client) DisconnectAffiliateProgram(ctx context.Context, request *DisconnectAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { - var result ConnectedAffiliateProgram - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_disconnect_all_websites_gen.go b/tdapi/tl_disconnect_all_websites_gen.go deleted file mode 100644 index e277137b0..000000000 --- a/tdapi/tl_disconnect_all_websites_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DisconnectAllWebsitesRequest represents TL type `disconnectAllWebsites#bf72f203`. -type DisconnectAllWebsitesRequest struct { -} - -// DisconnectAllWebsitesRequestTypeID is TL type id of DisconnectAllWebsitesRequest. -const DisconnectAllWebsitesRequestTypeID = 0xbf72f203 - -// Ensuring interfaces in compile-time for DisconnectAllWebsitesRequest. -var ( - _ bin.Encoder = &DisconnectAllWebsitesRequest{} - _ bin.Decoder = &DisconnectAllWebsitesRequest{} - _ bin.BareEncoder = &DisconnectAllWebsitesRequest{} - _ bin.BareDecoder = &DisconnectAllWebsitesRequest{} -) - -func (d *DisconnectAllWebsitesRequest) Zero() bool { - if d == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (d *DisconnectAllWebsitesRequest) String() string { - if d == nil { - return "DisconnectAllWebsitesRequest(nil)" - } - type Alias DisconnectAllWebsitesRequest - return fmt.Sprintf("DisconnectAllWebsitesRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DisconnectAllWebsitesRequest) TypeID() uint32 { - return DisconnectAllWebsitesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DisconnectAllWebsitesRequest) TypeName() string { - return "disconnectAllWebsites" -} - -// TypeInfo returns info about TL type. -func (d *DisconnectAllWebsitesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "disconnectAllWebsites", - ID: DisconnectAllWebsitesRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (d *DisconnectAllWebsitesRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disconnectAllWebsites#bf72f203 as nil") - } - b.PutID(DisconnectAllWebsitesRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DisconnectAllWebsitesRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disconnectAllWebsites#bf72f203 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (d *DisconnectAllWebsitesRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disconnectAllWebsites#bf72f203 to nil") - } - if err := b.ConsumeID(DisconnectAllWebsitesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode disconnectAllWebsites#bf72f203: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DisconnectAllWebsitesRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disconnectAllWebsites#bf72f203 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DisconnectAllWebsitesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode disconnectAllWebsites#bf72f203 as nil") - } - b.ObjStart() - b.PutID("disconnectAllWebsites") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DisconnectAllWebsitesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode disconnectAllWebsites#bf72f203 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("disconnectAllWebsites"); err != nil { - return fmt.Errorf("unable to decode disconnectAllWebsites#bf72f203: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// DisconnectAllWebsites invokes method disconnectAllWebsites#bf72f203 returning error if any. -func (c *Client) DisconnectAllWebsites(ctx context.Context) error { - var ok Ok - - request := &DisconnectAllWebsitesRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_disconnect_website_gen.go b/tdapi/tl_disconnect_website_gen.go deleted file mode 100644 index 2dc223c7e..000000000 --- a/tdapi/tl_disconnect_website_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DisconnectWebsiteRequest represents TL type `disconnectWebsite#d194f3dd`. -type DisconnectWebsiteRequest struct { - // Website identifier - WebsiteID int64 -} - -// DisconnectWebsiteRequestTypeID is TL type id of DisconnectWebsiteRequest. -const DisconnectWebsiteRequestTypeID = 0xd194f3dd - -// Ensuring interfaces in compile-time for DisconnectWebsiteRequest. -var ( - _ bin.Encoder = &DisconnectWebsiteRequest{} - _ bin.Decoder = &DisconnectWebsiteRequest{} - _ bin.BareEncoder = &DisconnectWebsiteRequest{} - _ bin.BareDecoder = &DisconnectWebsiteRequest{} -) - -func (d *DisconnectWebsiteRequest) Zero() bool { - if d == nil { - return true - } - if !(d.WebsiteID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DisconnectWebsiteRequest) String() string { - if d == nil { - return "DisconnectWebsiteRequest(nil)" - } - type Alias DisconnectWebsiteRequest - return fmt.Sprintf("DisconnectWebsiteRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DisconnectWebsiteRequest) TypeID() uint32 { - return DisconnectWebsiteRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DisconnectWebsiteRequest) TypeName() string { - return "disconnectWebsite" -} - -// TypeInfo returns info about TL type. -func (d *DisconnectWebsiteRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "disconnectWebsite", - ID: DisconnectWebsiteRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WebsiteID", - SchemaName: "website_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DisconnectWebsiteRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disconnectWebsite#d194f3dd as nil") - } - b.PutID(DisconnectWebsiteRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DisconnectWebsiteRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode disconnectWebsite#d194f3dd as nil") - } - b.PutLong(d.WebsiteID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DisconnectWebsiteRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disconnectWebsite#d194f3dd to nil") - } - if err := b.ConsumeID(DisconnectWebsiteRequestTypeID); err != nil { - return fmt.Errorf("unable to decode disconnectWebsite#d194f3dd: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DisconnectWebsiteRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode disconnectWebsite#d194f3dd to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode disconnectWebsite#d194f3dd: field website_id: %w", err) - } - d.WebsiteID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DisconnectWebsiteRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode disconnectWebsite#d194f3dd as nil") - } - b.ObjStart() - b.PutID("disconnectWebsite") - b.Comma() - b.FieldStart("website_id") - b.PutLong(d.WebsiteID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DisconnectWebsiteRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode disconnectWebsite#d194f3dd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("disconnectWebsite"); err != nil { - return fmt.Errorf("unable to decode disconnectWebsite#d194f3dd: %w", err) - } - case "website_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode disconnectWebsite#d194f3dd: field website_id: %w", err) - } - d.WebsiteID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWebsiteID returns value of WebsiteID field. -func (d *DisconnectWebsiteRequest) GetWebsiteID() (value int64) { - if d == nil { - return - } - return d.WebsiteID -} - -// DisconnectWebsite invokes method disconnectWebsite#d194f3dd returning error if any. -func (c *Client) DisconnectWebsite(ctx context.Context, websiteid int64) error { - var ok Ok - - request := &DisconnectWebsiteRequest{ - WebsiteID: websiteid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_document_gen.go b/tdapi/tl_document_gen.go deleted file mode 100644 index cd4763740..000000000 --- a/tdapi/tl_document_gen.go +++ /dev/null @@ -1,330 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Document represents TL type `document#af19afd8`. -type Document struct { - // Original name of the file; as defined by the sender - FileName string - // MIME type of the file; as defined by the sender - MimeType string - // Document minithumbnail; may be null - Minithumbnail Minithumbnail - // Document thumbnail in JPEG or PNG format (PNG will be used only for background - // patterns); as defined by the sender; may be null - Thumbnail Thumbnail - // File containing the document - Document File -} - -// DocumentTypeID is TL type id of Document. -const DocumentTypeID = 0xaf19afd8 - -// Ensuring interfaces in compile-time for Document. -var ( - _ bin.Encoder = &Document{} - _ bin.Decoder = &Document{} - _ bin.BareEncoder = &Document{} - _ bin.BareDecoder = &Document{} -) - -func (d *Document) Zero() bool { - if d == nil { - return true - } - if !(d.FileName == "") { - return false - } - if !(d.MimeType == "") { - return false - } - if !(d.Minithumbnail.Zero()) { - return false - } - if !(d.Thumbnail.Zero()) { - return false - } - if !(d.Document.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *Document) String() string { - if d == nil { - return "Document(nil)" - } - type Alias Document - return fmt.Sprintf("Document%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Document) TypeID() uint32 { - return DocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*Document) TypeName() string { - return "document" -} - -// TypeInfo returns info about TL type. -func (d *Document) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "document", - ID: DocumentTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileName", - SchemaName: "file_name", - }, - { - Name: "MimeType", - SchemaName: "mime_type", - }, - { - Name: "Minithumbnail", - SchemaName: "minithumbnail", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "Document", - SchemaName: "document", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *Document) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode document#af19afd8 as nil") - } - b.PutID(DocumentTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *Document) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode document#af19afd8 as nil") - } - b.PutString(d.FileName) - b.PutString(d.MimeType) - if err := d.Minithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode document#af19afd8: field minithumbnail: %w", err) - } - if err := d.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode document#af19afd8: field thumbnail: %w", err) - } - if err := d.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode document#af19afd8: field document: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (d *Document) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode document#af19afd8 to nil") - } - if err := b.ConsumeID(DocumentTypeID); err != nil { - return fmt.Errorf("unable to decode document#af19afd8: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *Document) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode document#af19afd8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode document#af19afd8: field file_name: %w", err) - } - d.FileName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode document#af19afd8: field mime_type: %w", err) - } - d.MimeType = value - } - { - if err := d.Minithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode document#af19afd8: field minithumbnail: %w", err) - } - } - { - if err := d.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode document#af19afd8: field thumbnail: %w", err) - } - } - { - if err := d.Document.Decode(b); err != nil { - return fmt.Errorf("unable to decode document#af19afd8: field document: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *Document) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode document#af19afd8 as nil") - } - b.ObjStart() - b.PutID("document") - b.Comma() - b.FieldStart("file_name") - b.PutString(d.FileName) - b.Comma() - b.FieldStart("mime_type") - b.PutString(d.MimeType) - b.Comma() - b.FieldStart("minithumbnail") - if err := d.Minithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode document#af19afd8: field minithumbnail: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := d.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode document#af19afd8: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("document") - if err := d.Document.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode document#af19afd8: field document: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *Document) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode document#af19afd8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("document"); err != nil { - return fmt.Errorf("unable to decode document#af19afd8: %w", err) - } - case "file_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode document#af19afd8: field file_name: %w", err) - } - d.FileName = value - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode document#af19afd8: field mime_type: %w", err) - } - d.MimeType = value - case "minithumbnail": - if err := d.Minithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode document#af19afd8: field minithumbnail: %w", err) - } - case "thumbnail": - if err := d.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode document#af19afd8: field thumbnail: %w", err) - } - case "document": - if err := d.Document.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode document#af19afd8: field document: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFileName returns value of FileName field. -func (d *Document) GetFileName() (value string) { - if d == nil { - return - } - return d.FileName -} - -// GetMimeType returns value of MimeType field. -func (d *Document) GetMimeType() (value string) { - if d == nil { - return - } - return d.MimeType -} - -// GetMinithumbnail returns value of Minithumbnail field. -func (d *Document) GetMinithumbnail() (value Minithumbnail) { - if d == nil { - return - } - return d.Minithumbnail -} - -// GetThumbnail returns value of Thumbnail field. -func (d *Document) GetThumbnail() (value Thumbnail) { - if d == nil { - return - } - return d.Thumbnail -} - -// GetDocument returns value of Document field. -func (d *Document) GetDocument() (value File) { - if d == nil { - return - } - return d.Document -} diff --git a/tdapi/tl_double_gen.go b/tdapi/tl_double_gen.go deleted file mode 100644 index 1f65992e1..000000000 --- a/tdapi/tl_double_gen.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Double represents TL type `double#2210c154`. -type Double struct { -} - -// DoubleTypeID is TL type id of Double. -const DoubleTypeID = 0x2210c154 - -// Ensuring interfaces in compile-time for Double. -var ( - _ bin.Encoder = &Double{} - _ bin.Decoder = &Double{} - _ bin.BareEncoder = &Double{} - _ bin.BareDecoder = &Double{} -) - -func (d *Double) Zero() bool { - if d == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (d *Double) String() string { - if d == nil { - return "Double(nil)" - } - type Alias Double - return fmt.Sprintf("Double%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Double) TypeID() uint32 { - return DoubleTypeID -} - -// TypeName returns name of type in TL schema. -func (*Double) TypeName() string { - return "double" -} - -// TypeInfo returns info about TL type. -func (d *Double) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "double", - ID: DoubleTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (d *Double) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode double#2210c154 as nil") - } - b.PutID(DoubleTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *Double) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode double#2210c154 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (d *Double) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode double#2210c154 to nil") - } - if err := b.ConsumeID(DoubleTypeID); err != nil { - return fmt.Errorf("unable to decode double#2210c154: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *Double) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode double#2210c154 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *Double) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode double#2210c154 as nil") - } - b.ObjStart() - b.PutID("double") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *Double) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode double#2210c154 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("double"); err != nil { - return fmt.Errorf("unable to decode double#2210c154: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} diff --git a/tdapi/tl_download_file_gen.go b/tdapi/tl_download_file_gen.go deleted file mode 100644 index 992c5ecf0..000000000 --- a/tdapi/tl_download_file_gen.go +++ /dev/null @@ -1,345 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DownloadFileRequest represents TL type `downloadFile#3f253234`. -type DownloadFileRequest struct { - // Identifier of the file to download - FileID int32 - // Priority of the download (1-32). The higher the priority, the earlier the file will be - // downloaded. If the priorities of two files are equal, then the last one for which - // downloadFile/addFileToDownloads was called will be downloaded first - Priority int32 - // The starting position from which the file needs to be downloaded - Offset int64 - // Number of bytes which need to be downloaded starting from the "offset" position before - // the download will automatically be canceled; use 0 to download without a limit - Limit int64 - // Pass true to return response only after the file download has succeeded, has failed, - // has been canceled, or a new downloadFile request with different offset/limit - // parameters was sent; pass false to return file state immediately, just after the - // download has been started - Synchronous bool -} - -// DownloadFileRequestTypeID is TL type id of DownloadFileRequest. -const DownloadFileRequestTypeID = 0x3f253234 - -// Ensuring interfaces in compile-time for DownloadFileRequest. -var ( - _ bin.Encoder = &DownloadFileRequest{} - _ bin.Decoder = &DownloadFileRequest{} - _ bin.BareEncoder = &DownloadFileRequest{} - _ bin.BareDecoder = &DownloadFileRequest{} -) - -func (d *DownloadFileRequest) Zero() bool { - if d == nil { - return true - } - if !(d.FileID == 0) { - return false - } - if !(d.Priority == 0) { - return false - } - if !(d.Offset == 0) { - return false - } - if !(d.Limit == 0) { - return false - } - if !(d.Synchronous == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DownloadFileRequest) String() string { - if d == nil { - return "DownloadFileRequest(nil)" - } - type Alias DownloadFileRequest - return fmt.Sprintf("DownloadFileRequest%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DownloadFileRequest) TypeID() uint32 { - return DownloadFileRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*DownloadFileRequest) TypeName() string { - return "downloadFile" -} - -// TypeInfo returns info about TL type. -func (d *DownloadFileRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "downloadFile", - ID: DownloadFileRequestTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "Priority", - SchemaName: "priority", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - { - Name: "Synchronous", - SchemaName: "synchronous", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DownloadFileRequest) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode downloadFile#3f253234 as nil") - } - b.PutID(DownloadFileRequestTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DownloadFileRequest) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode downloadFile#3f253234 as nil") - } - b.PutInt32(d.FileID) - b.PutInt32(d.Priority) - b.PutInt53(d.Offset) - b.PutInt53(d.Limit) - b.PutBool(d.Synchronous) - return nil -} - -// Decode implements bin.Decoder. -func (d *DownloadFileRequest) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode downloadFile#3f253234 to nil") - } - if err := b.ConsumeID(DownloadFileRequestTypeID); err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DownloadFileRequest) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode downloadFile#3f253234 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: field file_id: %w", err) - } - d.FileID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: field priority: %w", err) - } - d.Priority = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: field offset: %w", err) - } - d.Offset = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: field limit: %w", err) - } - d.Limit = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: field synchronous: %w", err) - } - d.Synchronous = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DownloadFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode downloadFile#3f253234 as nil") - } - b.ObjStart() - b.PutID("downloadFile") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(d.FileID) - b.Comma() - b.FieldStart("priority") - b.PutInt32(d.Priority) - b.Comma() - b.FieldStart("offset") - b.PutInt53(d.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt53(d.Limit) - b.Comma() - b.FieldStart("synchronous") - b.PutBool(d.Synchronous) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DownloadFileRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode downloadFile#3f253234 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("downloadFile"); err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: field file_id: %w", err) - } - d.FileID = value - case "priority": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: field priority: %w", err) - } - d.Priority = value - case "offset": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: field offset: %w", err) - } - d.Offset = value - case "limit": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: field limit: %w", err) - } - d.Limit = value - case "synchronous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode downloadFile#3f253234: field synchronous: %w", err) - } - d.Synchronous = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (d *DownloadFileRequest) GetFileID() (value int32) { - if d == nil { - return - } - return d.FileID -} - -// GetPriority returns value of Priority field. -func (d *DownloadFileRequest) GetPriority() (value int32) { - if d == nil { - return - } - return d.Priority -} - -// GetOffset returns value of Offset field. -func (d *DownloadFileRequest) GetOffset() (value int64) { - if d == nil { - return - } - return d.Offset -} - -// GetLimit returns value of Limit field. -func (d *DownloadFileRequest) GetLimit() (value int64) { - if d == nil { - return - } - return d.Limit -} - -// GetSynchronous returns value of Synchronous field. -func (d *DownloadFileRequest) GetSynchronous() (value bool) { - if d == nil { - return - } - return d.Synchronous -} - -// DownloadFile invokes method downloadFile#3f253234 returning error if any. -func (c *Client) DownloadFile(ctx context.Context, request *DownloadFileRequest) (*File, error) { - var result File - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_downloaded_file_counts_gen.go b/tdapi/tl_downloaded_file_counts_gen.go deleted file mode 100644 index 314769577..000000000 --- a/tdapi/tl_downloaded_file_counts_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DownloadedFileCounts represents TL type `downloadedFileCounts#8a572842`. -type DownloadedFileCounts struct { - // Number of active file downloads found, including paused - ActiveCount int32 - // Number of paused file downloads found - PausedCount int32 - // Number of completed file downloads found - CompletedCount int32 -} - -// DownloadedFileCountsTypeID is TL type id of DownloadedFileCounts. -const DownloadedFileCountsTypeID = 0x8a572842 - -// Ensuring interfaces in compile-time for DownloadedFileCounts. -var ( - _ bin.Encoder = &DownloadedFileCounts{} - _ bin.Decoder = &DownloadedFileCounts{} - _ bin.BareEncoder = &DownloadedFileCounts{} - _ bin.BareDecoder = &DownloadedFileCounts{} -) - -func (d *DownloadedFileCounts) Zero() bool { - if d == nil { - return true - } - if !(d.ActiveCount == 0) { - return false - } - if !(d.PausedCount == 0) { - return false - } - if !(d.CompletedCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DownloadedFileCounts) String() string { - if d == nil { - return "DownloadedFileCounts(nil)" - } - type Alias DownloadedFileCounts - return fmt.Sprintf("DownloadedFileCounts%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DownloadedFileCounts) TypeID() uint32 { - return DownloadedFileCountsTypeID -} - -// TypeName returns name of type in TL schema. -func (*DownloadedFileCounts) TypeName() string { - return "downloadedFileCounts" -} - -// TypeInfo returns info about TL type. -func (d *DownloadedFileCounts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "downloadedFileCounts", - ID: DownloadedFileCountsTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ActiveCount", - SchemaName: "active_count", - }, - { - Name: "PausedCount", - SchemaName: "paused_count", - }, - { - Name: "CompletedCount", - SchemaName: "completed_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DownloadedFileCounts) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode downloadedFileCounts#8a572842 as nil") - } - b.PutID(DownloadedFileCountsTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DownloadedFileCounts) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode downloadedFileCounts#8a572842 as nil") - } - b.PutInt32(d.ActiveCount) - b.PutInt32(d.PausedCount) - b.PutInt32(d.CompletedCount) - return nil -} - -// Decode implements bin.Decoder. -func (d *DownloadedFileCounts) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode downloadedFileCounts#8a572842 to nil") - } - if err := b.ConsumeID(DownloadedFileCountsTypeID); err != nil { - return fmt.Errorf("unable to decode downloadedFileCounts#8a572842: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DownloadedFileCounts) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode downloadedFileCounts#8a572842 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode downloadedFileCounts#8a572842: field active_count: %w", err) - } - d.ActiveCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode downloadedFileCounts#8a572842: field paused_count: %w", err) - } - d.PausedCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode downloadedFileCounts#8a572842: field completed_count: %w", err) - } - d.CompletedCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DownloadedFileCounts) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode downloadedFileCounts#8a572842 as nil") - } - b.ObjStart() - b.PutID("downloadedFileCounts") - b.Comma() - b.FieldStart("active_count") - b.PutInt32(d.ActiveCount) - b.Comma() - b.FieldStart("paused_count") - b.PutInt32(d.PausedCount) - b.Comma() - b.FieldStart("completed_count") - b.PutInt32(d.CompletedCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DownloadedFileCounts) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode downloadedFileCounts#8a572842 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("downloadedFileCounts"); err != nil { - return fmt.Errorf("unable to decode downloadedFileCounts#8a572842: %w", err) - } - case "active_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode downloadedFileCounts#8a572842: field active_count: %w", err) - } - d.ActiveCount = value - case "paused_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode downloadedFileCounts#8a572842: field paused_count: %w", err) - } - d.PausedCount = value - case "completed_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode downloadedFileCounts#8a572842: field completed_count: %w", err) - } - d.CompletedCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetActiveCount returns value of ActiveCount field. -func (d *DownloadedFileCounts) GetActiveCount() (value int32) { - if d == nil { - return - } - return d.ActiveCount -} - -// GetPausedCount returns value of PausedCount field. -func (d *DownloadedFileCounts) GetPausedCount() (value int32) { - if d == nil { - return - } - return d.PausedCount -} - -// GetCompletedCount returns value of CompletedCount field. -func (d *DownloadedFileCounts) GetCompletedCount() (value int32) { - if d == nil { - return - } - return d.CompletedCount -} diff --git a/tdapi/tl_draft_message_gen.go b/tdapi/tl_draft_message_gen.go deleted file mode 100644 index f9ddfb24f..000000000 --- a/tdapi/tl_draft_message_gen.go +++ /dev/null @@ -1,317 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// DraftMessage represents TL type `draftMessage#4313276d`. -type DraftMessage struct { - // Information about the message to be replied; must be of the type - // inputMessageReplyToMessage; may be null if none - ReplyTo InputMessageReplyToClass - // Point in time (Unix timestamp) when the draft was created - Date int32 - // Content of the message draft; must be of the type inputMessageText, - // inputMessageVideoNote, or inputMessageVoiceNote - InputMessageText InputMessageContentClass - // Identifier of the effect to apply to the message when it is sent; 0 if none - EffectID int64 -} - -// DraftMessageTypeID is TL type id of DraftMessage. -const DraftMessageTypeID = 0x4313276d - -// Ensuring interfaces in compile-time for DraftMessage. -var ( - _ bin.Encoder = &DraftMessage{} - _ bin.Decoder = &DraftMessage{} - _ bin.BareEncoder = &DraftMessage{} - _ bin.BareDecoder = &DraftMessage{} -) - -func (d *DraftMessage) Zero() bool { - if d == nil { - return true - } - if !(d.ReplyTo == nil) { - return false - } - if !(d.Date == 0) { - return false - } - if !(d.InputMessageText == nil) { - return false - } - if !(d.EffectID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (d *DraftMessage) String() string { - if d == nil { - return "DraftMessage(nil)" - } - type Alias DraftMessage - return fmt.Sprintf("DraftMessage%+v", Alias(*d)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*DraftMessage) TypeID() uint32 { - return DraftMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*DraftMessage) TypeName() string { - return "draftMessage" -} - -// TypeInfo returns info about TL type. -func (d *DraftMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "draftMessage", - ID: DraftMessageTypeID, - } - if d == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ReplyTo", - SchemaName: "reply_to", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "InputMessageText", - SchemaName: "input_message_text", - }, - { - Name: "EffectID", - SchemaName: "effect_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (d *DraftMessage) Encode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode draftMessage#4313276d as nil") - } - b.PutID(DraftMessageTypeID) - return d.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (d *DraftMessage) EncodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't encode draftMessage#4313276d as nil") - } - if d.ReplyTo == nil { - return fmt.Errorf("unable to encode draftMessage#4313276d: field reply_to is nil") - } - if err := d.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode draftMessage#4313276d: field reply_to: %w", err) - } - b.PutInt32(d.Date) - if d.InputMessageText == nil { - return fmt.Errorf("unable to encode draftMessage#4313276d: field input_message_text is nil") - } - if err := d.InputMessageText.Encode(b); err != nil { - return fmt.Errorf("unable to encode draftMessage#4313276d: field input_message_text: %w", err) - } - b.PutLong(d.EffectID) - return nil -} - -// Decode implements bin.Decoder. -func (d *DraftMessage) Decode(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode draftMessage#4313276d to nil") - } - if err := b.ConsumeID(DraftMessageTypeID); err != nil { - return fmt.Errorf("unable to decode draftMessage#4313276d: %w", err) - } - return d.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (d *DraftMessage) DecodeBare(b *bin.Buffer) error { - if d == nil { - return fmt.Errorf("can't decode draftMessage#4313276d to nil") - } - { - value, err := DecodeInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode draftMessage#4313276d: field reply_to: %w", err) - } - d.ReplyTo = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode draftMessage#4313276d: field date: %w", err) - } - d.Date = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode draftMessage#4313276d: field input_message_text: %w", err) - } - d.InputMessageText = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode draftMessage#4313276d: field effect_id: %w", err) - } - d.EffectID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (d *DraftMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if d == nil { - return fmt.Errorf("can't encode draftMessage#4313276d as nil") - } - b.ObjStart() - b.PutID("draftMessage") - b.Comma() - b.FieldStart("reply_to") - if d.ReplyTo == nil { - return fmt.Errorf("unable to encode draftMessage#4313276d: field reply_to is nil") - } - if err := d.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode draftMessage#4313276d: field reply_to: %w", err) - } - b.Comma() - b.FieldStart("date") - b.PutInt32(d.Date) - b.Comma() - b.FieldStart("input_message_text") - if d.InputMessageText == nil { - return fmt.Errorf("unable to encode draftMessage#4313276d: field input_message_text is nil") - } - if err := d.InputMessageText.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode draftMessage#4313276d: field input_message_text: %w", err) - } - b.Comma() - b.FieldStart("effect_id") - b.PutLong(d.EffectID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (d *DraftMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if d == nil { - return fmt.Errorf("can't decode draftMessage#4313276d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("draftMessage"); err != nil { - return fmt.Errorf("unable to decode draftMessage#4313276d: %w", err) - } - case "reply_to": - value, err := DecodeTDLibJSONInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode draftMessage#4313276d: field reply_to: %w", err) - } - d.ReplyTo = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode draftMessage#4313276d: field date: %w", err) - } - d.Date = value - case "input_message_text": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode draftMessage#4313276d: field input_message_text: %w", err) - } - d.InputMessageText = value - case "effect_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode draftMessage#4313276d: field effect_id: %w", err) - } - d.EffectID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReplyTo returns value of ReplyTo field. -func (d *DraftMessage) GetReplyTo() (value InputMessageReplyToClass) { - if d == nil { - return - } - return d.ReplyTo -} - -// GetDate returns value of Date field. -func (d *DraftMessage) GetDate() (value int32) { - if d == nil { - return - } - return d.Date -} - -// GetInputMessageText returns value of InputMessageText field. -func (d *DraftMessage) GetInputMessageText() (value InputMessageContentClass) { - if d == nil { - return - } - return d.InputMessageText -} - -// GetEffectID returns value of EffectID field. -func (d *DraftMessage) GetEffectID() (value int64) { - if d == nil { - return - } - return d.EffectID -} diff --git a/tdapi/tl_edit_bot_media_preview_gen.go b/tdapi/tl_edit_bot_media_preview_gen.go deleted file mode 100644 index 7ea8cbe0c..000000000 --- a/tdapi/tl_edit_bot_media_preview_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditBotMediaPreviewRequest represents TL type `editBotMediaPreview#86955d62`. -type EditBotMediaPreviewRequest struct { - // Identifier of the target bot. The bot must be owned and must have the main Web App - BotUserID int64 - // Language code of the media preview to edit - LanguageCode string - // File identifier of the media to replace - FileID int32 - // Content of the new preview - Content InputStoryContentClass -} - -// EditBotMediaPreviewRequestTypeID is TL type id of EditBotMediaPreviewRequest. -const EditBotMediaPreviewRequestTypeID = 0x86955d62 - -// Ensuring interfaces in compile-time for EditBotMediaPreviewRequest. -var ( - _ bin.Encoder = &EditBotMediaPreviewRequest{} - _ bin.Decoder = &EditBotMediaPreviewRequest{} - _ bin.BareEncoder = &EditBotMediaPreviewRequest{} - _ bin.BareDecoder = &EditBotMediaPreviewRequest{} -) - -func (e *EditBotMediaPreviewRequest) Zero() bool { - if e == nil { - return true - } - if !(e.BotUserID == 0) { - return false - } - if !(e.LanguageCode == "") { - return false - } - if !(e.FileID == 0) { - return false - } - if !(e.Content == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditBotMediaPreviewRequest) String() string { - if e == nil { - return "EditBotMediaPreviewRequest(nil)" - } - type Alias EditBotMediaPreviewRequest - return fmt.Sprintf("EditBotMediaPreviewRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditBotMediaPreviewRequest) TypeID() uint32 { - return EditBotMediaPreviewRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditBotMediaPreviewRequest) TypeName() string { - return "editBotMediaPreview" -} - -// TypeInfo returns info about TL type. -func (e *EditBotMediaPreviewRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editBotMediaPreview", - ID: EditBotMediaPreviewRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "Content", - SchemaName: "content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditBotMediaPreviewRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBotMediaPreview#86955d62 as nil") - } - b.PutID(EditBotMediaPreviewRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditBotMediaPreviewRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBotMediaPreview#86955d62 as nil") - } - b.PutInt53(e.BotUserID) - b.PutString(e.LanguageCode) - b.PutInt32(e.FileID) - if e.Content == nil { - return fmt.Errorf("unable to encode editBotMediaPreview#86955d62: field content is nil") - } - if err := e.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode editBotMediaPreview#86955d62: field content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditBotMediaPreviewRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBotMediaPreview#86955d62 to nil") - } - if err := b.ConsumeID(EditBotMediaPreviewRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditBotMediaPreviewRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBotMediaPreview#86955d62 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field bot_user_id: %w", err) - } - e.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field language_code: %w", err) - } - e.LanguageCode = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field file_id: %w", err) - } - e.FileID = value - } - { - value, err := DecodeInputStoryContent(b) - if err != nil { - return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field content: %w", err) - } - e.Content = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditBotMediaPreviewRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editBotMediaPreview#86955d62 as nil") - } - b.ObjStart() - b.PutID("editBotMediaPreview") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(e.BotUserID) - b.Comma() - b.FieldStart("language_code") - b.PutString(e.LanguageCode) - b.Comma() - b.FieldStart("file_id") - b.PutInt32(e.FileID) - b.Comma() - b.FieldStart("content") - if e.Content == nil { - return fmt.Errorf("unable to encode editBotMediaPreview#86955d62: field content is nil") - } - if err := e.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editBotMediaPreview#86955d62: field content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditBotMediaPreviewRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editBotMediaPreview#86955d62 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editBotMediaPreview"); err != nil { - return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field bot_user_id: %w", err) - } - e.BotUserID = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field language_code: %w", err) - } - e.LanguageCode = value - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field file_id: %w", err) - } - e.FileID = value - case "content": - value, err := DecodeTDLibJSONInputStoryContent(b) - if err != nil { - return fmt.Errorf("unable to decode editBotMediaPreview#86955d62: field content: %w", err) - } - e.Content = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (e *EditBotMediaPreviewRequest) GetBotUserID() (value int64) { - if e == nil { - return - } - return e.BotUserID -} - -// GetLanguageCode returns value of LanguageCode field. -func (e *EditBotMediaPreviewRequest) GetLanguageCode() (value string) { - if e == nil { - return - } - return e.LanguageCode -} - -// GetFileID returns value of FileID field. -func (e *EditBotMediaPreviewRequest) GetFileID() (value int32) { - if e == nil { - return - } - return e.FileID -} - -// GetContent returns value of Content field. -func (e *EditBotMediaPreviewRequest) GetContent() (value InputStoryContentClass) { - if e == nil { - return - } - return e.Content -} - -// EditBotMediaPreview invokes method editBotMediaPreview#86955d62 returning error if any. -func (c *Client) EditBotMediaPreview(ctx context.Context, request *EditBotMediaPreviewRequest) (*BotMediaPreview, error) { - var result BotMediaPreview - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_business_chat_link_gen.go b/tdapi/tl_edit_business_chat_link_gen.go deleted file mode 100644 index 1b417843f..000000000 --- a/tdapi/tl_edit_business_chat_link_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditBusinessChatLinkRequest represents TL type `editBusinessChatLink#5f10f626`. -type EditBusinessChatLinkRequest struct { - // The link to edit - Link string - // New description of the link - LinkInfo InputBusinessChatLink -} - -// EditBusinessChatLinkRequestTypeID is TL type id of EditBusinessChatLinkRequest. -const EditBusinessChatLinkRequestTypeID = 0x5f10f626 - -// Ensuring interfaces in compile-time for EditBusinessChatLinkRequest. -var ( - _ bin.Encoder = &EditBusinessChatLinkRequest{} - _ bin.Decoder = &EditBusinessChatLinkRequest{} - _ bin.BareEncoder = &EditBusinessChatLinkRequest{} - _ bin.BareDecoder = &EditBusinessChatLinkRequest{} -) - -func (e *EditBusinessChatLinkRequest) Zero() bool { - if e == nil { - return true - } - if !(e.Link == "") { - return false - } - if !(e.LinkInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditBusinessChatLinkRequest) String() string { - if e == nil { - return "EditBusinessChatLinkRequest(nil)" - } - type Alias EditBusinessChatLinkRequest - return fmt.Sprintf("EditBusinessChatLinkRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditBusinessChatLinkRequest) TypeID() uint32 { - return EditBusinessChatLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditBusinessChatLinkRequest) TypeName() string { - return "editBusinessChatLink" -} - -// TypeInfo returns info about TL type. -func (e *EditBusinessChatLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editBusinessChatLink", - ID: EditBusinessChatLinkRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - { - Name: "LinkInfo", - SchemaName: "link_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditBusinessChatLinkRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessChatLink#5f10f626 as nil") - } - b.PutID(EditBusinessChatLinkRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditBusinessChatLinkRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessChatLink#5f10f626 as nil") - } - b.PutString(e.Link) - if err := e.LinkInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode editBusinessChatLink#5f10f626: field link_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditBusinessChatLinkRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessChatLink#5f10f626 to nil") - } - if err := b.ConsumeID(EditBusinessChatLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editBusinessChatLink#5f10f626: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditBusinessChatLinkRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessChatLink#5f10f626 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessChatLink#5f10f626: field link: %w", err) - } - e.Link = value - } - { - if err := e.LinkInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode editBusinessChatLink#5f10f626: field link_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditBusinessChatLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessChatLink#5f10f626 as nil") - } - b.ObjStart() - b.PutID("editBusinessChatLink") - b.Comma() - b.FieldStart("link") - b.PutString(e.Link) - b.Comma() - b.FieldStart("link_info") - if err := e.LinkInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editBusinessChatLink#5f10f626: field link_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditBusinessChatLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessChatLink#5f10f626 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editBusinessChatLink"); err != nil { - return fmt.Errorf("unable to decode editBusinessChatLink#5f10f626: %w", err) - } - case "link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessChatLink#5f10f626: field link: %w", err) - } - e.Link = value - case "link_info": - if err := e.LinkInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editBusinessChatLink#5f10f626: field link_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (e *EditBusinessChatLinkRequest) GetLink() (value string) { - if e == nil { - return - } - return e.Link -} - -// GetLinkInfo returns value of LinkInfo field. -func (e *EditBusinessChatLinkRequest) GetLinkInfo() (value InputBusinessChatLink) { - if e == nil { - return - } - return e.LinkInfo -} - -// EditBusinessChatLink invokes method editBusinessChatLink#5f10f626 returning error if any. -func (c *Client) EditBusinessChatLink(ctx context.Context, request *EditBusinessChatLinkRequest) (*BusinessChatLink, error) { - var result BusinessChatLink - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_business_message_caption_gen.go b/tdapi/tl_edit_business_message_caption_gen.go deleted file mode 100644 index 90ebafe84..000000000 --- a/tdapi/tl_edit_business_message_caption_gen.go +++ /dev/null @@ -1,385 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditBusinessMessageCaptionRequest represents TL type `editBusinessMessageCaption#c02142c3`. -type EditBusinessMessageCaptionRequest struct { - // Unique identifier of business connection on behalf of which the message was sent - BusinessConnectionID string - // The chat the message belongs to - ChatID int64 - // Identifier of the message - MessageID int64 - // The new message reply markup; pass null if none - ReplyMarkup ReplyMarkupClass - // New message content caption; pass null to remove caption; - // 0-getOption("message_caption_length_max") characters - Caption FormattedText - // Pass true to show the caption above the media; otherwise, the caption will be shown - // below the media. May be true only for animation, photo, and video messages - ShowCaptionAboveMedia bool -} - -// EditBusinessMessageCaptionRequestTypeID is TL type id of EditBusinessMessageCaptionRequest. -const EditBusinessMessageCaptionRequestTypeID = 0xc02142c3 - -// Ensuring interfaces in compile-time for EditBusinessMessageCaptionRequest. -var ( - _ bin.Encoder = &EditBusinessMessageCaptionRequest{} - _ bin.Decoder = &EditBusinessMessageCaptionRequest{} - _ bin.BareEncoder = &EditBusinessMessageCaptionRequest{} - _ bin.BareDecoder = &EditBusinessMessageCaptionRequest{} -) - -func (e *EditBusinessMessageCaptionRequest) Zero() bool { - if e == nil { - return true - } - if !(e.BusinessConnectionID == "") { - return false - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.Caption.Zero()) { - return false - } - if !(e.ShowCaptionAboveMedia == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditBusinessMessageCaptionRequest) String() string { - if e == nil { - return "EditBusinessMessageCaptionRequest(nil)" - } - type Alias EditBusinessMessageCaptionRequest - return fmt.Sprintf("EditBusinessMessageCaptionRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditBusinessMessageCaptionRequest) TypeID() uint32 { - return EditBusinessMessageCaptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditBusinessMessageCaptionRequest) TypeName() string { - return "editBusinessMessageCaption" -} - -// TypeInfo returns info about TL type. -func (e *EditBusinessMessageCaptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editBusinessMessageCaption", - ID: EditBusinessMessageCaptionRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BusinessConnectionID", - SchemaName: "business_connection_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "ShowCaptionAboveMedia", - SchemaName: "show_caption_above_media", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditBusinessMessageCaptionRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageCaption#c02142c3 as nil") - } - b.PutID(EditBusinessMessageCaptionRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditBusinessMessageCaptionRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageCaption#c02142c3 as nil") - } - b.PutString(e.BusinessConnectionID) - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editBusinessMessageCaption#c02142c3: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageCaption#c02142c3: field reply_markup: %w", err) - } - if err := e.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageCaption#c02142c3: field caption: %w", err) - } - b.PutBool(e.ShowCaptionAboveMedia) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditBusinessMessageCaptionRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageCaption#c02142c3 to nil") - } - if err := b.ConsumeID(EditBusinessMessageCaptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditBusinessMessageCaptionRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageCaption#c02142c3 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field business_connection_id: %w", err) - } - e.BusinessConnectionID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - if err := e.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field show_caption_above_media: %w", err) - } - e.ShowCaptionAboveMedia = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditBusinessMessageCaptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageCaption#c02142c3 as nil") - } - b.ObjStart() - b.PutID("editBusinessMessageCaption") - b.Comma() - b.FieldStart("business_connection_id") - b.PutString(e.BusinessConnectionID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editBusinessMessageCaption#c02142c3: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageCaption#c02142c3: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := e.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageCaption#c02142c3: field caption: %w", err) - } - b.Comma() - b.FieldStart("show_caption_above_media") - b.PutBool(e.ShowCaptionAboveMedia) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditBusinessMessageCaptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageCaption#c02142c3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editBusinessMessageCaption"); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: %w", err) - } - case "business_connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field business_connection_id: %w", err) - } - e.BusinessConnectionID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field chat_id: %w", err) - } - e.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field message_id: %w", err) - } - e.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "caption": - if err := e.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field caption: %w", err) - } - case "show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageCaption#c02142c3: field show_caption_above_media: %w", err) - } - e.ShowCaptionAboveMedia = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessConnectionID returns value of BusinessConnectionID field. -func (e *EditBusinessMessageCaptionRequest) GetBusinessConnectionID() (value string) { - if e == nil { - return - } - return e.BusinessConnectionID -} - -// GetChatID returns value of ChatID field. -func (e *EditBusinessMessageCaptionRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageID returns value of MessageID field. -func (e *EditBusinessMessageCaptionRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditBusinessMessageCaptionRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetCaption returns value of Caption field. -func (e *EditBusinessMessageCaptionRequest) GetCaption() (value FormattedText) { - if e == nil { - return - } - return e.Caption -} - -// GetShowCaptionAboveMedia returns value of ShowCaptionAboveMedia field. -func (e *EditBusinessMessageCaptionRequest) GetShowCaptionAboveMedia() (value bool) { - if e == nil { - return - } - return e.ShowCaptionAboveMedia -} - -// EditBusinessMessageCaption invokes method editBusinessMessageCaption#c02142c3 returning error if any. -func (c *Client) EditBusinessMessageCaption(ctx context.Context, request *EditBusinessMessageCaptionRequest) (*BusinessMessage, error) { - var result BusinessMessage - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_business_message_live_location_gen.go b/tdapi/tl_edit_business_message_live_location_gen.go deleted file mode 100644 index 6799c358d..000000000 --- a/tdapi/tl_edit_business_message_live_location_gen.go +++ /dev/null @@ -1,453 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditBusinessMessageLiveLocationRequest represents TL type `editBusinessMessageLiveLocation#1d80ae1f`. -type EditBusinessMessageLiveLocationRequest struct { - // Unique identifier of business connection on behalf of which the message was sent - BusinessConnectionID string - // The chat the message belongs to - ChatID int64 - // Identifier of the message - MessageID int64 - // The new message reply markup; pass null if none - ReplyMarkup ReplyMarkupClass - // New location content of the message; pass null to stop sharing the live location - Location Location - // New time relative to the message send date, for which the location can be updated, in - // seconds. If 0x7FFFFFFF specified, then the location can be updated forever. - LivePeriod int32 - // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown - Heading int32 - // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the - // notification is disabled - ProximityAlertRadius int32 -} - -// EditBusinessMessageLiveLocationRequestTypeID is TL type id of EditBusinessMessageLiveLocationRequest. -const EditBusinessMessageLiveLocationRequestTypeID = 0x1d80ae1f - -// Ensuring interfaces in compile-time for EditBusinessMessageLiveLocationRequest. -var ( - _ bin.Encoder = &EditBusinessMessageLiveLocationRequest{} - _ bin.Decoder = &EditBusinessMessageLiveLocationRequest{} - _ bin.BareEncoder = &EditBusinessMessageLiveLocationRequest{} - _ bin.BareDecoder = &EditBusinessMessageLiveLocationRequest{} -) - -func (e *EditBusinessMessageLiveLocationRequest) Zero() bool { - if e == nil { - return true - } - if !(e.BusinessConnectionID == "") { - return false - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.Location.Zero()) { - return false - } - if !(e.LivePeriod == 0) { - return false - } - if !(e.Heading == 0) { - return false - } - if !(e.ProximityAlertRadius == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditBusinessMessageLiveLocationRequest) String() string { - if e == nil { - return "EditBusinessMessageLiveLocationRequest(nil)" - } - type Alias EditBusinessMessageLiveLocationRequest - return fmt.Sprintf("EditBusinessMessageLiveLocationRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditBusinessMessageLiveLocationRequest) TypeID() uint32 { - return EditBusinessMessageLiveLocationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditBusinessMessageLiveLocationRequest) TypeName() string { - return "editBusinessMessageLiveLocation" -} - -// TypeInfo returns info about TL type. -func (e *EditBusinessMessageLiveLocationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editBusinessMessageLiveLocation", - ID: EditBusinessMessageLiveLocationRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BusinessConnectionID", - SchemaName: "business_connection_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "LivePeriod", - SchemaName: "live_period", - }, - { - Name: "Heading", - SchemaName: "heading", - }, - { - Name: "ProximityAlertRadius", - SchemaName: "proximity_alert_radius", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditBusinessMessageLiveLocationRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageLiveLocation#1d80ae1f as nil") - } - b.PutID(EditBusinessMessageLiveLocationRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditBusinessMessageLiveLocationRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageLiveLocation#1d80ae1f as nil") - } - b.PutString(e.BusinessConnectionID) - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editBusinessMessageLiveLocation#1d80ae1f: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageLiveLocation#1d80ae1f: field reply_markup: %w", err) - } - if err := e.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageLiveLocation#1d80ae1f: field location: %w", err) - } - b.PutInt32(e.LivePeriod) - b.PutInt32(e.Heading) - b.PutInt32(e.ProximityAlertRadius) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditBusinessMessageLiveLocationRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageLiveLocation#1d80ae1f to nil") - } - if err := b.ConsumeID(EditBusinessMessageLiveLocationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditBusinessMessageLiveLocationRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageLiveLocation#1d80ae1f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field business_connection_id: %w", err) - } - e.BusinessConnectionID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - if err := e.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field location: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field live_period: %w", err) - } - e.LivePeriod = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field heading: %w", err) - } - e.Heading = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field proximity_alert_radius: %w", err) - } - e.ProximityAlertRadius = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditBusinessMessageLiveLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageLiveLocation#1d80ae1f as nil") - } - b.ObjStart() - b.PutID("editBusinessMessageLiveLocation") - b.Comma() - b.FieldStart("business_connection_id") - b.PutString(e.BusinessConnectionID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editBusinessMessageLiveLocation#1d80ae1f: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageLiveLocation#1d80ae1f: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("location") - if err := e.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageLiveLocation#1d80ae1f: field location: %w", err) - } - b.Comma() - b.FieldStart("live_period") - b.PutInt32(e.LivePeriod) - b.Comma() - b.FieldStart("heading") - b.PutInt32(e.Heading) - b.Comma() - b.FieldStart("proximity_alert_radius") - b.PutInt32(e.ProximityAlertRadius) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditBusinessMessageLiveLocationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageLiveLocation#1d80ae1f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editBusinessMessageLiveLocation"); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: %w", err) - } - case "business_connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field business_connection_id: %w", err) - } - e.BusinessConnectionID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field chat_id: %w", err) - } - e.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field message_id: %w", err) - } - e.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "location": - if err := e.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field location: %w", err) - } - case "live_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field live_period: %w", err) - } - e.LivePeriod = value - case "heading": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field heading: %w", err) - } - e.Heading = value - case "proximity_alert_radius": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageLiveLocation#1d80ae1f: field proximity_alert_radius: %w", err) - } - e.ProximityAlertRadius = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessConnectionID returns value of BusinessConnectionID field. -func (e *EditBusinessMessageLiveLocationRequest) GetBusinessConnectionID() (value string) { - if e == nil { - return - } - return e.BusinessConnectionID -} - -// GetChatID returns value of ChatID field. -func (e *EditBusinessMessageLiveLocationRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageID returns value of MessageID field. -func (e *EditBusinessMessageLiveLocationRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditBusinessMessageLiveLocationRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetLocation returns value of Location field. -func (e *EditBusinessMessageLiveLocationRequest) GetLocation() (value Location) { - if e == nil { - return - } - return e.Location -} - -// GetLivePeriod returns value of LivePeriod field. -func (e *EditBusinessMessageLiveLocationRequest) GetLivePeriod() (value int32) { - if e == nil { - return - } - return e.LivePeriod -} - -// GetHeading returns value of Heading field. -func (e *EditBusinessMessageLiveLocationRequest) GetHeading() (value int32) { - if e == nil { - return - } - return e.Heading -} - -// GetProximityAlertRadius returns value of ProximityAlertRadius field. -func (e *EditBusinessMessageLiveLocationRequest) GetProximityAlertRadius() (value int32) { - if e == nil { - return - } - return e.ProximityAlertRadius -} - -// EditBusinessMessageLiveLocation invokes method editBusinessMessageLiveLocation#1d80ae1f returning error if any. -func (c *Client) EditBusinessMessageLiveLocation(ctx context.Context, request *EditBusinessMessageLiveLocationRequest) (*BusinessMessage, error) { - var result BusinessMessage - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_business_message_media_gen.go b/tdapi/tl_edit_business_message_media_gen.go deleted file mode 100644 index 5075e8a53..000000000 --- a/tdapi/tl_edit_business_message_media_gen.go +++ /dev/null @@ -1,360 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditBusinessMessageMediaRequest represents TL type `editBusinessMessageMedia#fc614778`. -type EditBusinessMessageMediaRequest struct { - // Unique identifier of business connection on behalf of which the message was sent - BusinessConnectionID string - // The chat the message belongs to - ChatID int64 - // Identifier of the message - MessageID int64 - // The new message reply markup; pass null if none; for bots only - ReplyMarkup ReplyMarkupClass - // New content of the message. Must be one of the following types: inputMessageAnimation, - // inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo - InputMessageContent InputMessageContentClass -} - -// EditBusinessMessageMediaRequestTypeID is TL type id of EditBusinessMessageMediaRequest. -const EditBusinessMessageMediaRequestTypeID = 0xfc614778 - -// Ensuring interfaces in compile-time for EditBusinessMessageMediaRequest. -var ( - _ bin.Encoder = &EditBusinessMessageMediaRequest{} - _ bin.Decoder = &EditBusinessMessageMediaRequest{} - _ bin.BareEncoder = &EditBusinessMessageMediaRequest{} - _ bin.BareDecoder = &EditBusinessMessageMediaRequest{} -) - -func (e *EditBusinessMessageMediaRequest) Zero() bool { - if e == nil { - return true - } - if !(e.BusinessConnectionID == "") { - return false - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditBusinessMessageMediaRequest) String() string { - if e == nil { - return "EditBusinessMessageMediaRequest(nil)" - } - type Alias EditBusinessMessageMediaRequest - return fmt.Sprintf("EditBusinessMessageMediaRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditBusinessMessageMediaRequest) TypeID() uint32 { - return EditBusinessMessageMediaRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditBusinessMessageMediaRequest) TypeName() string { - return "editBusinessMessageMedia" -} - -// TypeInfo returns info about TL type. -func (e *EditBusinessMessageMediaRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editBusinessMessageMedia", - ID: EditBusinessMessageMediaRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BusinessConnectionID", - SchemaName: "business_connection_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditBusinessMessageMediaRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageMedia#fc614778 as nil") - } - b.PutID(EditBusinessMessageMediaRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditBusinessMessageMediaRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageMedia#fc614778 as nil") - } - b.PutString(e.BusinessConnectionID) - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editBusinessMessageMedia#fc614778: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageMedia#fc614778: field reply_markup: %w", err) - } - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editBusinessMessageMedia#fc614778: field input_message_content is nil") - } - if err := e.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageMedia#fc614778: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditBusinessMessageMediaRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageMedia#fc614778 to nil") - } - if err := b.ConsumeID(EditBusinessMessageMediaRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditBusinessMessageMediaRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageMedia#fc614778 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: field business_connection_id: %w", err) - } - e.BusinessConnectionID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: field input_message_content: %w", err) - } - e.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditBusinessMessageMediaRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageMedia#fc614778 as nil") - } - b.ObjStart() - b.PutID("editBusinessMessageMedia") - b.Comma() - b.FieldStart("business_connection_id") - b.PutString(e.BusinessConnectionID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editBusinessMessageMedia#fc614778: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageMedia#fc614778: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editBusinessMessageMedia#fc614778: field input_message_content is nil") - } - if err := e.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageMedia#fc614778: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditBusinessMessageMediaRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageMedia#fc614778 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editBusinessMessageMedia"); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: %w", err) - } - case "business_connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: field business_connection_id: %w", err) - } - e.BusinessConnectionID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: field chat_id: %w", err) - } - e.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: field message_id: %w", err) - } - e.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageMedia#fc614778: field input_message_content: %w", err) - } - e.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessConnectionID returns value of BusinessConnectionID field. -func (e *EditBusinessMessageMediaRequest) GetBusinessConnectionID() (value string) { - if e == nil { - return - } - return e.BusinessConnectionID -} - -// GetChatID returns value of ChatID field. -func (e *EditBusinessMessageMediaRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageID returns value of MessageID field. -func (e *EditBusinessMessageMediaRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditBusinessMessageMediaRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (e *EditBusinessMessageMediaRequest) GetInputMessageContent() (value InputMessageContentClass) { - if e == nil { - return - } - return e.InputMessageContent -} - -// EditBusinessMessageMedia invokes method editBusinessMessageMedia#fc614778 returning error if any. -func (c *Client) EditBusinessMessageMedia(ctx context.Context, request *EditBusinessMessageMediaRequest) (*BusinessMessage, error) { - var result BusinessMessage - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_business_message_reply_markup_gen.go b/tdapi/tl_edit_business_message_reply_markup_gen.go deleted file mode 100644 index 7dd5112a9..000000000 --- a/tdapi/tl_edit_business_message_reply_markup_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditBusinessMessageReplyMarkupRequest represents TL type `editBusinessMessageReplyMarkup#29d46c17`. -type EditBusinessMessageReplyMarkupRequest struct { - // Unique identifier of business connection on behalf of which the message was sent - BusinessConnectionID string - // The chat the message belongs to - ChatID int64 - // Identifier of the message - MessageID int64 - // The new message reply markup; pass null if none - ReplyMarkup ReplyMarkupClass -} - -// EditBusinessMessageReplyMarkupRequestTypeID is TL type id of EditBusinessMessageReplyMarkupRequest. -const EditBusinessMessageReplyMarkupRequestTypeID = 0x29d46c17 - -// Ensuring interfaces in compile-time for EditBusinessMessageReplyMarkupRequest. -var ( - _ bin.Encoder = &EditBusinessMessageReplyMarkupRequest{} - _ bin.Decoder = &EditBusinessMessageReplyMarkupRequest{} - _ bin.BareEncoder = &EditBusinessMessageReplyMarkupRequest{} - _ bin.BareDecoder = &EditBusinessMessageReplyMarkupRequest{} -) - -func (e *EditBusinessMessageReplyMarkupRequest) Zero() bool { - if e == nil { - return true - } - if !(e.BusinessConnectionID == "") { - return false - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditBusinessMessageReplyMarkupRequest) String() string { - if e == nil { - return "EditBusinessMessageReplyMarkupRequest(nil)" - } - type Alias EditBusinessMessageReplyMarkupRequest - return fmt.Sprintf("EditBusinessMessageReplyMarkupRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditBusinessMessageReplyMarkupRequest) TypeID() uint32 { - return EditBusinessMessageReplyMarkupRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditBusinessMessageReplyMarkupRequest) TypeName() string { - return "editBusinessMessageReplyMarkup" -} - -// TypeInfo returns info about TL type. -func (e *EditBusinessMessageReplyMarkupRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editBusinessMessageReplyMarkup", - ID: EditBusinessMessageReplyMarkupRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BusinessConnectionID", - SchemaName: "business_connection_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditBusinessMessageReplyMarkupRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageReplyMarkup#29d46c17 as nil") - } - b.PutID(EditBusinessMessageReplyMarkupRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditBusinessMessageReplyMarkupRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageReplyMarkup#29d46c17 as nil") - } - b.PutString(e.BusinessConnectionID) - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editBusinessMessageReplyMarkup#29d46c17: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageReplyMarkup#29d46c17: field reply_markup: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditBusinessMessageReplyMarkupRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageReplyMarkup#29d46c17 to nil") - } - if err := b.ConsumeID(EditBusinessMessageReplyMarkupRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageReplyMarkup#29d46c17: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditBusinessMessageReplyMarkupRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageReplyMarkup#29d46c17 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageReplyMarkup#29d46c17: field business_connection_id: %w", err) - } - e.BusinessConnectionID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageReplyMarkup#29d46c17: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageReplyMarkup#29d46c17: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageReplyMarkup#29d46c17: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditBusinessMessageReplyMarkupRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageReplyMarkup#29d46c17 as nil") - } - b.ObjStart() - b.PutID("editBusinessMessageReplyMarkup") - b.Comma() - b.FieldStart("business_connection_id") - b.PutString(e.BusinessConnectionID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editBusinessMessageReplyMarkup#29d46c17: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageReplyMarkup#29d46c17: field reply_markup: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditBusinessMessageReplyMarkupRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageReplyMarkup#29d46c17 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editBusinessMessageReplyMarkup"); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageReplyMarkup#29d46c17: %w", err) - } - case "business_connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageReplyMarkup#29d46c17: field business_connection_id: %w", err) - } - e.BusinessConnectionID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageReplyMarkup#29d46c17: field chat_id: %w", err) - } - e.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageReplyMarkup#29d46c17: field message_id: %w", err) - } - e.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageReplyMarkup#29d46c17: field reply_markup: %w", err) - } - e.ReplyMarkup = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessConnectionID returns value of BusinessConnectionID field. -func (e *EditBusinessMessageReplyMarkupRequest) GetBusinessConnectionID() (value string) { - if e == nil { - return - } - return e.BusinessConnectionID -} - -// GetChatID returns value of ChatID field. -func (e *EditBusinessMessageReplyMarkupRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageID returns value of MessageID field. -func (e *EditBusinessMessageReplyMarkupRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditBusinessMessageReplyMarkupRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// EditBusinessMessageReplyMarkup invokes method editBusinessMessageReplyMarkup#29d46c17 returning error if any. -func (c *Client) EditBusinessMessageReplyMarkup(ctx context.Context, request *EditBusinessMessageReplyMarkupRequest) (*BusinessMessage, error) { - var result BusinessMessage - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_business_message_text_gen.go b/tdapi/tl_edit_business_message_text_gen.go deleted file mode 100644 index 7931db0cf..000000000 --- a/tdapi/tl_edit_business_message_text_gen.go +++ /dev/null @@ -1,359 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditBusinessMessageTextRequest represents TL type `editBusinessMessageText#bb81119c`. -type EditBusinessMessageTextRequest struct { - // Unique identifier of business connection on behalf of which the message was sent - BusinessConnectionID string - // The chat the message belongs to - ChatID int64 - // Identifier of the message - MessageID int64 - // The new message reply markup; pass null if none - ReplyMarkup ReplyMarkupClass - // New text content of the message. Must be of type inputMessageText - InputMessageContent InputMessageContentClass -} - -// EditBusinessMessageTextRequestTypeID is TL type id of EditBusinessMessageTextRequest. -const EditBusinessMessageTextRequestTypeID = 0xbb81119c - -// Ensuring interfaces in compile-time for EditBusinessMessageTextRequest. -var ( - _ bin.Encoder = &EditBusinessMessageTextRequest{} - _ bin.Decoder = &EditBusinessMessageTextRequest{} - _ bin.BareEncoder = &EditBusinessMessageTextRequest{} - _ bin.BareDecoder = &EditBusinessMessageTextRequest{} -) - -func (e *EditBusinessMessageTextRequest) Zero() bool { - if e == nil { - return true - } - if !(e.BusinessConnectionID == "") { - return false - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditBusinessMessageTextRequest) String() string { - if e == nil { - return "EditBusinessMessageTextRequest(nil)" - } - type Alias EditBusinessMessageTextRequest - return fmt.Sprintf("EditBusinessMessageTextRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditBusinessMessageTextRequest) TypeID() uint32 { - return EditBusinessMessageTextRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditBusinessMessageTextRequest) TypeName() string { - return "editBusinessMessageText" -} - -// TypeInfo returns info about TL type. -func (e *EditBusinessMessageTextRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editBusinessMessageText", - ID: EditBusinessMessageTextRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BusinessConnectionID", - SchemaName: "business_connection_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditBusinessMessageTextRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageText#bb81119c as nil") - } - b.PutID(EditBusinessMessageTextRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditBusinessMessageTextRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageText#bb81119c as nil") - } - b.PutString(e.BusinessConnectionID) - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editBusinessMessageText#bb81119c: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageText#bb81119c: field reply_markup: %w", err) - } - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editBusinessMessageText#bb81119c: field input_message_content is nil") - } - if err := e.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageText#bb81119c: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditBusinessMessageTextRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageText#bb81119c to nil") - } - if err := b.ConsumeID(EditBusinessMessageTextRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditBusinessMessageTextRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageText#bb81119c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: field business_connection_id: %w", err) - } - e.BusinessConnectionID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: field input_message_content: %w", err) - } - e.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditBusinessMessageTextRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editBusinessMessageText#bb81119c as nil") - } - b.ObjStart() - b.PutID("editBusinessMessageText") - b.Comma() - b.FieldStart("business_connection_id") - b.PutString(e.BusinessConnectionID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editBusinessMessageText#bb81119c: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageText#bb81119c: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editBusinessMessageText#bb81119c: field input_message_content is nil") - } - if err := e.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editBusinessMessageText#bb81119c: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditBusinessMessageTextRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editBusinessMessageText#bb81119c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editBusinessMessageText"); err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: %w", err) - } - case "business_connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: field business_connection_id: %w", err) - } - e.BusinessConnectionID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: field chat_id: %w", err) - } - e.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: field message_id: %w", err) - } - e.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editBusinessMessageText#bb81119c: field input_message_content: %w", err) - } - e.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessConnectionID returns value of BusinessConnectionID field. -func (e *EditBusinessMessageTextRequest) GetBusinessConnectionID() (value string) { - if e == nil { - return - } - return e.BusinessConnectionID -} - -// GetChatID returns value of ChatID field. -func (e *EditBusinessMessageTextRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageID returns value of MessageID field. -func (e *EditBusinessMessageTextRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditBusinessMessageTextRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (e *EditBusinessMessageTextRequest) GetInputMessageContent() (value InputMessageContentClass) { - if e == nil { - return - } - return e.InputMessageContent -} - -// EditBusinessMessageText invokes method editBusinessMessageText#bb81119c returning error if any. -func (c *Client) EditBusinessMessageText(ctx context.Context, request *EditBusinessMessageTextRequest) (*BusinessMessage, error) { - var result BusinessMessage - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_chat_folder_gen.go b/tdapi/tl_edit_chat_folder_gen.go deleted file mode 100644 index d01266f28..000000000 --- a/tdapi/tl_edit_chat_folder_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditChatFolderRequest represents TL type `editChatFolder#332fb32`. -type EditChatFolderRequest struct { - // Chat folder identifier - ChatFolderID int32 - // The edited chat folder - Folder ChatFolder -} - -// EditChatFolderRequestTypeID is TL type id of EditChatFolderRequest. -const EditChatFolderRequestTypeID = 0x332fb32 - -// Ensuring interfaces in compile-time for EditChatFolderRequest. -var ( - _ bin.Encoder = &EditChatFolderRequest{} - _ bin.Decoder = &EditChatFolderRequest{} - _ bin.BareEncoder = &EditChatFolderRequest{} - _ bin.BareDecoder = &EditChatFolderRequest{} -) - -func (e *EditChatFolderRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ChatFolderID == 0) { - return false - } - if !(e.Folder.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditChatFolderRequest) String() string { - if e == nil { - return "EditChatFolderRequest(nil)" - } - type Alias EditChatFolderRequest - return fmt.Sprintf("EditChatFolderRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditChatFolderRequest) TypeID() uint32 { - return EditChatFolderRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditChatFolderRequest) TypeName() string { - return "editChatFolder" -} - -// TypeInfo returns info about TL type. -func (e *EditChatFolderRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editChatFolder", - ID: EditChatFolderRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - { - Name: "Folder", - SchemaName: "folder", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditChatFolderRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editChatFolder#332fb32 as nil") - } - b.PutID(EditChatFolderRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditChatFolderRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editChatFolder#332fb32 as nil") - } - b.PutInt32(e.ChatFolderID) - if err := e.Folder.Encode(b); err != nil { - return fmt.Errorf("unable to encode editChatFolder#332fb32: field folder: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditChatFolderRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editChatFolder#332fb32 to nil") - } - if err := b.ConsumeID(EditChatFolderRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editChatFolder#332fb32: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditChatFolderRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editChatFolder#332fb32 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editChatFolder#332fb32: field chat_folder_id: %w", err) - } - e.ChatFolderID = value - } - { - if err := e.Folder.Decode(b); err != nil { - return fmt.Errorf("unable to decode editChatFolder#332fb32: field folder: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditChatFolderRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editChatFolder#332fb32 as nil") - } - b.ObjStart() - b.PutID("editChatFolder") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(e.ChatFolderID) - b.Comma() - b.FieldStart("folder") - if err := e.Folder.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editChatFolder#332fb32: field folder: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditChatFolderRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editChatFolder#332fb32 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editChatFolder"); err != nil { - return fmt.Errorf("unable to decode editChatFolder#332fb32: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editChatFolder#332fb32: field chat_folder_id: %w", err) - } - e.ChatFolderID = value - case "folder": - if err := e.Folder.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editChatFolder#332fb32: field folder: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (e *EditChatFolderRequest) GetChatFolderID() (value int32) { - if e == nil { - return - } - return e.ChatFolderID -} - -// GetFolder returns value of Folder field. -func (e *EditChatFolderRequest) GetFolder() (value ChatFolder) { - if e == nil { - return - } - return e.Folder -} - -// EditChatFolder invokes method editChatFolder#332fb32 returning error if any. -func (c *Client) EditChatFolder(ctx context.Context, request *EditChatFolderRequest) (*ChatFolderInfo, error) { - var result ChatFolderInfo - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_chat_folder_invite_link_gen.go b/tdapi/tl_edit_chat_folder_invite_link_gen.go deleted file mode 100644 index df57bc8f9..000000000 --- a/tdapi/tl_edit_chat_folder_invite_link_gen.go +++ /dev/null @@ -1,331 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditChatFolderInviteLinkRequest represents TL type `editChatFolderInviteLink#5cc415a8`. -type EditChatFolderInviteLinkRequest struct { - // Chat folder identifier - ChatFolderID int32 - // Invite link to be edited - InviteLink string - // New name of the link; 0-32 characters - Name string - // New identifiers of chats to be accessible by the invite link. Use - // getChatsForChatFolderInviteLink to get suitable chats. Basic groups will be - // automatically converted to supergroups before link editing - ChatIDs []int64 -} - -// EditChatFolderInviteLinkRequestTypeID is TL type id of EditChatFolderInviteLinkRequest. -const EditChatFolderInviteLinkRequestTypeID = 0x5cc415a8 - -// Ensuring interfaces in compile-time for EditChatFolderInviteLinkRequest. -var ( - _ bin.Encoder = &EditChatFolderInviteLinkRequest{} - _ bin.Decoder = &EditChatFolderInviteLinkRequest{} - _ bin.BareEncoder = &EditChatFolderInviteLinkRequest{} - _ bin.BareDecoder = &EditChatFolderInviteLinkRequest{} -) - -func (e *EditChatFolderInviteLinkRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ChatFolderID == 0) { - return false - } - if !(e.InviteLink == "") { - return false - } - if !(e.Name == "") { - return false - } - if !(e.ChatIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditChatFolderInviteLinkRequest) String() string { - if e == nil { - return "EditChatFolderInviteLinkRequest(nil)" - } - type Alias EditChatFolderInviteLinkRequest - return fmt.Sprintf("EditChatFolderInviteLinkRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditChatFolderInviteLinkRequest) TypeID() uint32 { - return EditChatFolderInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditChatFolderInviteLinkRequest) TypeName() string { - return "editChatFolderInviteLink" -} - -// TypeInfo returns info about TL type. -func (e *EditChatFolderInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editChatFolderInviteLink", - ID: EditChatFolderInviteLinkRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "ChatIDs", - SchemaName: "chat_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditChatFolderInviteLinkRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editChatFolderInviteLink#5cc415a8 as nil") - } - b.PutID(EditChatFolderInviteLinkRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditChatFolderInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editChatFolderInviteLink#5cc415a8 as nil") - } - b.PutInt32(e.ChatFolderID) - b.PutString(e.InviteLink) - b.PutString(e.Name) - b.PutInt(len(e.ChatIDs)) - for _, v := range e.ChatIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditChatFolderInviteLinkRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editChatFolderInviteLink#5cc415a8 to nil") - } - if err := b.ConsumeID(EditChatFolderInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditChatFolderInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editChatFolderInviteLink#5cc415a8 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: field chat_folder_id: %w", err) - } - e.ChatFolderID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: field invite_link: %w", err) - } - e.InviteLink = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: field name: %w", err) - } - e.Name = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: field chat_ids: %w", err) - } - - if headerLen > 0 { - e.ChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: field chat_ids: %w", err) - } - e.ChatIDs = append(e.ChatIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditChatFolderInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editChatFolderInviteLink#5cc415a8 as nil") - } - b.ObjStart() - b.PutID("editChatFolderInviteLink") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(e.ChatFolderID) - b.Comma() - b.FieldStart("invite_link") - b.PutString(e.InviteLink) - b.Comma() - b.FieldStart("name") - b.PutString(e.Name) - b.Comma() - b.FieldStart("chat_ids") - b.ArrStart() - for _, v := range e.ChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditChatFolderInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editChatFolderInviteLink#5cc415a8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editChatFolderInviteLink"); err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: field chat_folder_id: %w", err) - } - e.ChatFolderID = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: field invite_link: %w", err) - } - e.InviteLink = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: field name: %w", err) - } - e.Name = value - case "chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: field chat_ids: %w", err) - } - e.ChatIDs = append(e.ChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode editChatFolderInviteLink#5cc415a8: field chat_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (e *EditChatFolderInviteLinkRequest) GetChatFolderID() (value int32) { - if e == nil { - return - } - return e.ChatFolderID -} - -// GetInviteLink returns value of InviteLink field. -func (e *EditChatFolderInviteLinkRequest) GetInviteLink() (value string) { - if e == nil { - return - } - return e.InviteLink -} - -// GetName returns value of Name field. -func (e *EditChatFolderInviteLinkRequest) GetName() (value string) { - if e == nil { - return - } - return e.Name -} - -// GetChatIDs returns value of ChatIDs field. -func (e *EditChatFolderInviteLinkRequest) GetChatIDs() (value []int64) { - if e == nil { - return - } - return e.ChatIDs -} - -// EditChatFolderInviteLink invokes method editChatFolderInviteLink#5cc415a8 returning error if any. -func (c *Client) EditChatFolderInviteLink(ctx context.Context, request *EditChatFolderInviteLinkRequest) (*ChatFolderInviteLink, error) { - var result ChatFolderInviteLink - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_chat_invite_link_gen.go b/tdapi/tl_edit_chat_invite_link_gen.go deleted file mode 100644 index 5ac648df2..000000000 --- a/tdapi/tl_edit_chat_invite_link_gen.go +++ /dev/null @@ -1,375 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditChatInviteLinkRequest represents TL type `editChatInviteLink#4eb23d7c`. -type EditChatInviteLinkRequest struct { - // Chat identifier - ChatID int64 - // Invite link to be edited - InviteLink string - // Invite link name; 0-32 characters - Name string - // Point in time (Unix timestamp) when the link will expire; pass 0 if never - ExpirationDate int32 - // The maximum number of chat members that can join the chat via the link simultaneously; - // 0-99999; pass 0 if not limited - MemberLimit int32 - // Pass true if users joining the chat via the link need to be approved by chat - // administrators. In this case, member_limit must be 0 - CreatesJoinRequest bool -} - -// EditChatInviteLinkRequestTypeID is TL type id of EditChatInviteLinkRequest. -const EditChatInviteLinkRequestTypeID = 0x4eb23d7c - -// Ensuring interfaces in compile-time for EditChatInviteLinkRequest. -var ( - _ bin.Encoder = &EditChatInviteLinkRequest{} - _ bin.Decoder = &EditChatInviteLinkRequest{} - _ bin.BareEncoder = &EditChatInviteLinkRequest{} - _ bin.BareDecoder = &EditChatInviteLinkRequest{} -) - -func (e *EditChatInviteLinkRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ChatID == 0) { - return false - } - if !(e.InviteLink == "") { - return false - } - if !(e.Name == "") { - return false - } - if !(e.ExpirationDate == 0) { - return false - } - if !(e.MemberLimit == 0) { - return false - } - if !(e.CreatesJoinRequest == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditChatInviteLinkRequest) String() string { - if e == nil { - return "EditChatInviteLinkRequest(nil)" - } - type Alias EditChatInviteLinkRequest - return fmt.Sprintf("EditChatInviteLinkRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditChatInviteLinkRequest) TypeID() uint32 { - return EditChatInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditChatInviteLinkRequest) TypeName() string { - return "editChatInviteLink" -} - -// TypeInfo returns info about TL type. -func (e *EditChatInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editChatInviteLink", - ID: EditChatInviteLinkRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "ExpirationDate", - SchemaName: "expiration_date", - }, - { - Name: "MemberLimit", - SchemaName: "member_limit", - }, - { - Name: "CreatesJoinRequest", - SchemaName: "creates_join_request", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditChatInviteLinkRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editChatInviteLink#4eb23d7c as nil") - } - b.PutID(EditChatInviteLinkRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditChatInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editChatInviteLink#4eb23d7c as nil") - } - b.PutInt53(e.ChatID) - b.PutString(e.InviteLink) - b.PutString(e.Name) - b.PutInt32(e.ExpirationDate) - b.PutInt32(e.MemberLimit) - b.PutBool(e.CreatesJoinRequest) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditChatInviteLinkRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editChatInviteLink#4eb23d7c to nil") - } - if err := b.ConsumeID(EditChatInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditChatInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editChatInviteLink#4eb23d7c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field invite_link: %w", err) - } - e.InviteLink = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field name: %w", err) - } - e.Name = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field expiration_date: %w", err) - } - e.ExpirationDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field member_limit: %w", err) - } - e.MemberLimit = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field creates_join_request: %w", err) - } - e.CreatesJoinRequest = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditChatInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editChatInviteLink#4eb23d7c as nil") - } - b.ObjStart() - b.PutID("editChatInviteLink") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("invite_link") - b.PutString(e.InviteLink) - b.Comma() - b.FieldStart("name") - b.PutString(e.Name) - b.Comma() - b.FieldStart("expiration_date") - b.PutInt32(e.ExpirationDate) - b.Comma() - b.FieldStart("member_limit") - b.PutInt32(e.MemberLimit) - b.Comma() - b.FieldStart("creates_join_request") - b.PutBool(e.CreatesJoinRequest) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditChatInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editChatInviteLink#4eb23d7c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editChatInviteLink"); err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field chat_id: %w", err) - } - e.ChatID = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field invite_link: %w", err) - } - e.InviteLink = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field name: %w", err) - } - e.Name = value - case "expiration_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field expiration_date: %w", err) - } - e.ExpirationDate = value - case "member_limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field member_limit: %w", err) - } - e.MemberLimit = value - case "creates_join_request": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editChatInviteLink#4eb23d7c: field creates_join_request: %w", err) - } - e.CreatesJoinRequest = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (e *EditChatInviteLinkRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetInviteLink returns value of InviteLink field. -func (e *EditChatInviteLinkRequest) GetInviteLink() (value string) { - if e == nil { - return - } - return e.InviteLink -} - -// GetName returns value of Name field. -func (e *EditChatInviteLinkRequest) GetName() (value string) { - if e == nil { - return - } - return e.Name -} - -// GetExpirationDate returns value of ExpirationDate field. -func (e *EditChatInviteLinkRequest) GetExpirationDate() (value int32) { - if e == nil { - return - } - return e.ExpirationDate -} - -// GetMemberLimit returns value of MemberLimit field. -func (e *EditChatInviteLinkRequest) GetMemberLimit() (value int32) { - if e == nil { - return - } - return e.MemberLimit -} - -// GetCreatesJoinRequest returns value of CreatesJoinRequest field. -func (e *EditChatInviteLinkRequest) GetCreatesJoinRequest() (value bool) { - if e == nil { - return - } - return e.CreatesJoinRequest -} - -// EditChatInviteLink invokes method editChatInviteLink#4eb23d7c returning error if any. -func (c *Client) EditChatInviteLink(ctx context.Context, request *EditChatInviteLinkRequest) (*ChatInviteLink, error) { - var result ChatInviteLink - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_chat_subscription_invite_link_gen.go b/tdapi/tl_edit_chat_subscription_invite_link_gen.go deleted file mode 100644 index 8fd15aee4..000000000 --- a/tdapi/tl_edit_chat_subscription_invite_link_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditChatSubscriptionInviteLinkRequest represents TL type `editChatSubscriptionInviteLink#c74445d3`. -type EditChatSubscriptionInviteLinkRequest struct { - // Chat identifier - ChatID int64 - // Invite link to be edited - InviteLink string - // Invite link name; 0-32 characters - Name string -} - -// EditChatSubscriptionInviteLinkRequestTypeID is TL type id of EditChatSubscriptionInviteLinkRequest. -const EditChatSubscriptionInviteLinkRequestTypeID = 0xc74445d3 - -// Ensuring interfaces in compile-time for EditChatSubscriptionInviteLinkRequest. -var ( - _ bin.Encoder = &EditChatSubscriptionInviteLinkRequest{} - _ bin.Decoder = &EditChatSubscriptionInviteLinkRequest{} - _ bin.BareEncoder = &EditChatSubscriptionInviteLinkRequest{} - _ bin.BareDecoder = &EditChatSubscriptionInviteLinkRequest{} -) - -func (e *EditChatSubscriptionInviteLinkRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ChatID == 0) { - return false - } - if !(e.InviteLink == "") { - return false - } - if !(e.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditChatSubscriptionInviteLinkRequest) String() string { - if e == nil { - return "EditChatSubscriptionInviteLinkRequest(nil)" - } - type Alias EditChatSubscriptionInviteLinkRequest - return fmt.Sprintf("EditChatSubscriptionInviteLinkRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditChatSubscriptionInviteLinkRequest) TypeID() uint32 { - return EditChatSubscriptionInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditChatSubscriptionInviteLinkRequest) TypeName() string { - return "editChatSubscriptionInviteLink" -} - -// TypeInfo returns info about TL type. -func (e *EditChatSubscriptionInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editChatSubscriptionInviteLink", - ID: EditChatSubscriptionInviteLinkRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditChatSubscriptionInviteLinkRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editChatSubscriptionInviteLink#c74445d3 as nil") - } - b.PutID(EditChatSubscriptionInviteLinkRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditChatSubscriptionInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editChatSubscriptionInviteLink#c74445d3 as nil") - } - b.PutInt53(e.ChatID) - b.PutString(e.InviteLink) - b.PutString(e.Name) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditChatSubscriptionInviteLinkRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editChatSubscriptionInviteLink#c74445d3 to nil") - } - if err := b.ConsumeID(EditChatSubscriptionInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editChatSubscriptionInviteLink#c74445d3: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditChatSubscriptionInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editChatSubscriptionInviteLink#c74445d3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editChatSubscriptionInviteLink#c74445d3: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatSubscriptionInviteLink#c74445d3: field invite_link: %w", err) - } - e.InviteLink = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatSubscriptionInviteLink#c74445d3: field name: %w", err) - } - e.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditChatSubscriptionInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editChatSubscriptionInviteLink#c74445d3 as nil") - } - b.ObjStart() - b.PutID("editChatSubscriptionInviteLink") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("invite_link") - b.PutString(e.InviteLink) - b.Comma() - b.FieldStart("name") - b.PutString(e.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditChatSubscriptionInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editChatSubscriptionInviteLink#c74445d3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editChatSubscriptionInviteLink"); err != nil { - return fmt.Errorf("unable to decode editChatSubscriptionInviteLink#c74445d3: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editChatSubscriptionInviteLink#c74445d3: field chat_id: %w", err) - } - e.ChatID = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatSubscriptionInviteLink#c74445d3: field invite_link: %w", err) - } - e.InviteLink = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editChatSubscriptionInviteLink#c74445d3: field name: %w", err) - } - e.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (e *EditChatSubscriptionInviteLinkRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetInviteLink returns value of InviteLink field. -func (e *EditChatSubscriptionInviteLinkRequest) GetInviteLink() (value string) { - if e == nil { - return - } - return e.InviteLink -} - -// GetName returns value of Name field. -func (e *EditChatSubscriptionInviteLinkRequest) GetName() (value string) { - if e == nil { - return - } - return e.Name -} - -// EditChatSubscriptionInviteLink invokes method editChatSubscriptionInviteLink#c74445d3 returning error if any. -func (c *Client) EditChatSubscriptionInviteLink(ctx context.Context, request *EditChatSubscriptionInviteLinkRequest) (*ChatInviteLink, error) { - var result ChatInviteLink - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_custom_language_pack_info_gen.go b/tdapi/tl_edit_custom_language_pack_info_gen.go deleted file mode 100644 index 81b794acd..000000000 --- a/tdapi/tl_edit_custom_language_pack_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditCustomLanguagePackInfoRequest represents TL type `editCustomLanguagePackInfo#4eb91099`. -type EditCustomLanguagePackInfoRequest struct { - // New information about the custom local language pack - Info LanguagePackInfo -} - -// EditCustomLanguagePackInfoRequestTypeID is TL type id of EditCustomLanguagePackInfoRequest. -const EditCustomLanguagePackInfoRequestTypeID = 0x4eb91099 - -// Ensuring interfaces in compile-time for EditCustomLanguagePackInfoRequest. -var ( - _ bin.Encoder = &EditCustomLanguagePackInfoRequest{} - _ bin.Decoder = &EditCustomLanguagePackInfoRequest{} - _ bin.BareEncoder = &EditCustomLanguagePackInfoRequest{} - _ bin.BareDecoder = &EditCustomLanguagePackInfoRequest{} -) - -func (e *EditCustomLanguagePackInfoRequest) Zero() bool { - if e == nil { - return true - } - if !(e.Info.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditCustomLanguagePackInfoRequest) String() string { - if e == nil { - return "EditCustomLanguagePackInfoRequest(nil)" - } - type Alias EditCustomLanguagePackInfoRequest - return fmt.Sprintf("EditCustomLanguagePackInfoRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditCustomLanguagePackInfoRequest) TypeID() uint32 { - return EditCustomLanguagePackInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditCustomLanguagePackInfoRequest) TypeName() string { - return "editCustomLanguagePackInfo" -} - -// TypeInfo returns info about TL type. -func (e *EditCustomLanguagePackInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editCustomLanguagePackInfo", - ID: EditCustomLanguagePackInfoRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Info", - SchemaName: "info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditCustomLanguagePackInfoRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editCustomLanguagePackInfo#4eb91099 as nil") - } - b.PutID(EditCustomLanguagePackInfoRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditCustomLanguagePackInfoRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editCustomLanguagePackInfo#4eb91099 as nil") - } - if err := e.Info.Encode(b); err != nil { - return fmt.Errorf("unable to encode editCustomLanguagePackInfo#4eb91099: field info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditCustomLanguagePackInfoRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editCustomLanguagePackInfo#4eb91099 to nil") - } - if err := b.ConsumeID(EditCustomLanguagePackInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editCustomLanguagePackInfo#4eb91099: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditCustomLanguagePackInfoRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editCustomLanguagePackInfo#4eb91099 to nil") - } - { - if err := e.Info.Decode(b); err != nil { - return fmt.Errorf("unable to decode editCustomLanguagePackInfo#4eb91099: field info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditCustomLanguagePackInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editCustomLanguagePackInfo#4eb91099 as nil") - } - b.ObjStart() - b.PutID("editCustomLanguagePackInfo") - b.Comma() - b.FieldStart("info") - if err := e.Info.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editCustomLanguagePackInfo#4eb91099: field info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditCustomLanguagePackInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editCustomLanguagePackInfo#4eb91099 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editCustomLanguagePackInfo"); err != nil { - return fmt.Errorf("unable to decode editCustomLanguagePackInfo#4eb91099: %w", err) - } - case "info": - if err := e.Info.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editCustomLanguagePackInfo#4eb91099: field info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInfo returns value of Info field. -func (e *EditCustomLanguagePackInfoRequest) GetInfo() (value LanguagePackInfo) { - if e == nil { - return - } - return e.Info -} - -// EditCustomLanguagePackInfo invokes method editCustomLanguagePackInfo#4eb91099 returning error if any. -func (c *Client) EditCustomLanguagePackInfo(ctx context.Context, info LanguagePackInfo) error { - var ok Ok - - request := &EditCustomLanguagePackInfoRequest{ - Info: info, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_forum_topic_gen.go b/tdapi/tl_edit_forum_topic_gen.go deleted file mode 100644 index de3b9b1ad..000000000 --- a/tdapi/tl_edit_forum_topic_gen.go +++ /dev/null @@ -1,341 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditForumTopicRequest represents TL type `editForumTopic#a7769060`. -type EditForumTopicRequest struct { - // Identifier of the chat - ChatID int64 - // Message thread identifier of the forum topic - MessageThreadID int64 - // New name of the topic; 0-128 characters. If empty, the previous topic name is kept - Name string - // Pass true to edit the icon of the topic. Icon of the General topic can't be edited - EditIconCustomEmoji bool - // Identifier of the new custom emoji for topic icon; pass 0 to remove the custom emoji. - // Ignored if edit_icon_custom_emoji is false. Telegram Premium users can use any custom - // emoji, other users can use only a custom emoji returned by getForumTopicDefaultIcons - IconCustomEmojiID int64 -} - -// EditForumTopicRequestTypeID is TL type id of EditForumTopicRequest. -const EditForumTopicRequestTypeID = 0xa7769060 - -// Ensuring interfaces in compile-time for EditForumTopicRequest. -var ( - _ bin.Encoder = &EditForumTopicRequest{} - _ bin.Decoder = &EditForumTopicRequest{} - _ bin.BareEncoder = &EditForumTopicRequest{} - _ bin.BareDecoder = &EditForumTopicRequest{} -) - -func (e *EditForumTopicRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageThreadID == 0) { - return false - } - if !(e.Name == "") { - return false - } - if !(e.EditIconCustomEmoji == false) { - return false - } - if !(e.IconCustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditForumTopicRequest) String() string { - if e == nil { - return "EditForumTopicRequest(nil)" - } - type Alias EditForumTopicRequest - return fmt.Sprintf("EditForumTopicRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditForumTopicRequest) TypeID() uint32 { - return EditForumTopicRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditForumTopicRequest) TypeName() string { - return "editForumTopic" -} - -// TypeInfo returns info about TL type. -func (e *EditForumTopicRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editForumTopic", - ID: EditForumTopicRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "EditIconCustomEmoji", - SchemaName: "edit_icon_custom_emoji", - }, - { - Name: "IconCustomEmojiID", - SchemaName: "icon_custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditForumTopicRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editForumTopic#a7769060 as nil") - } - b.PutID(EditForumTopicRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditForumTopicRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editForumTopic#a7769060 as nil") - } - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageThreadID) - b.PutString(e.Name) - b.PutBool(e.EditIconCustomEmoji) - b.PutLong(e.IconCustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditForumTopicRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editForumTopic#a7769060 to nil") - } - if err := b.ConsumeID(EditForumTopicRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditForumTopicRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editForumTopic#a7769060 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: field message_thread_id: %w", err) - } - e.MessageThreadID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: field name: %w", err) - } - e.Name = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: field edit_icon_custom_emoji: %w", err) - } - e.EditIconCustomEmoji = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: field icon_custom_emoji_id: %w", err) - } - e.IconCustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditForumTopicRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editForumTopic#a7769060 as nil") - } - b.ObjStart() - b.PutID("editForumTopic") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(e.MessageThreadID) - b.Comma() - b.FieldStart("name") - b.PutString(e.Name) - b.Comma() - b.FieldStart("edit_icon_custom_emoji") - b.PutBool(e.EditIconCustomEmoji) - b.Comma() - b.FieldStart("icon_custom_emoji_id") - b.PutLong(e.IconCustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditForumTopicRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editForumTopic#a7769060 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editForumTopic"); err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: field chat_id: %w", err) - } - e.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: field message_thread_id: %w", err) - } - e.MessageThreadID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: field name: %w", err) - } - e.Name = value - case "edit_icon_custom_emoji": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: field edit_icon_custom_emoji: %w", err) - } - e.EditIconCustomEmoji = value - case "icon_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode editForumTopic#a7769060: field icon_custom_emoji_id: %w", err) - } - e.IconCustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (e *EditForumTopicRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (e *EditForumTopicRequest) GetMessageThreadID() (value int64) { - if e == nil { - return - } - return e.MessageThreadID -} - -// GetName returns value of Name field. -func (e *EditForumTopicRequest) GetName() (value string) { - if e == nil { - return - } - return e.Name -} - -// GetEditIconCustomEmoji returns value of EditIconCustomEmoji field. -func (e *EditForumTopicRequest) GetEditIconCustomEmoji() (value bool) { - if e == nil { - return - } - return e.EditIconCustomEmoji -} - -// GetIconCustomEmojiID returns value of IconCustomEmojiID field. -func (e *EditForumTopicRequest) GetIconCustomEmojiID() (value int64) { - if e == nil { - return - } - return e.IconCustomEmojiID -} - -// EditForumTopic invokes method editForumTopic#a7769060 returning error if any. -func (c *Client) EditForumTopic(ctx context.Context, request *EditForumTopicRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_inline_message_caption_gen.go b/tdapi/tl_edit_inline_message_caption_gen.go deleted file mode 100644 index 793a412f6..000000000 --- a/tdapi/tl_edit_inline_message_caption_gen.go +++ /dev/null @@ -1,317 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditInlineMessageCaptionRequest represents TL type `editInlineMessageCaption#540744f8`. -type EditInlineMessageCaptionRequest struct { - // Inline message identifier - InlineMessageID string - // The new message reply markup; pass null if none - ReplyMarkup ReplyMarkupClass - // New message content caption; pass null to remove caption; - // 0-getOption("message_caption_length_max") characters - Caption FormattedText - // Pass true to show the caption above the media; otherwise, the caption will be shown - // below the media. May be true only for animation, photo, and video messages - ShowCaptionAboveMedia bool -} - -// EditInlineMessageCaptionRequestTypeID is TL type id of EditInlineMessageCaptionRequest. -const EditInlineMessageCaptionRequestTypeID = 0x540744f8 - -// Ensuring interfaces in compile-time for EditInlineMessageCaptionRequest. -var ( - _ bin.Encoder = &EditInlineMessageCaptionRequest{} - _ bin.Decoder = &EditInlineMessageCaptionRequest{} - _ bin.BareEncoder = &EditInlineMessageCaptionRequest{} - _ bin.BareDecoder = &EditInlineMessageCaptionRequest{} -) - -func (e *EditInlineMessageCaptionRequest) Zero() bool { - if e == nil { - return true - } - if !(e.InlineMessageID == "") { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.Caption.Zero()) { - return false - } - if !(e.ShowCaptionAboveMedia == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditInlineMessageCaptionRequest) String() string { - if e == nil { - return "EditInlineMessageCaptionRequest(nil)" - } - type Alias EditInlineMessageCaptionRequest - return fmt.Sprintf("EditInlineMessageCaptionRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditInlineMessageCaptionRequest) TypeID() uint32 { - return EditInlineMessageCaptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditInlineMessageCaptionRequest) TypeName() string { - return "editInlineMessageCaption" -} - -// TypeInfo returns info about TL type. -func (e *EditInlineMessageCaptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editInlineMessageCaption", - ID: EditInlineMessageCaptionRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InlineMessageID", - SchemaName: "inline_message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "ShowCaptionAboveMedia", - SchemaName: "show_caption_above_media", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditInlineMessageCaptionRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageCaption#540744f8 as nil") - } - b.PutID(EditInlineMessageCaptionRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditInlineMessageCaptionRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageCaption#540744f8 as nil") - } - b.PutString(e.InlineMessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageCaption#540744f8: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageCaption#540744f8: field reply_markup: %w", err) - } - if err := e.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageCaption#540744f8: field caption: %w", err) - } - b.PutBool(e.ShowCaptionAboveMedia) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditInlineMessageCaptionRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageCaption#540744f8 to nil") - } - if err := b.ConsumeID(EditInlineMessageCaptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editInlineMessageCaption#540744f8: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditInlineMessageCaptionRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageCaption#540744f8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageCaption#540744f8: field inline_message_id: %w", err) - } - e.InlineMessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageCaption#540744f8: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - if err := e.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode editInlineMessageCaption#540744f8: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageCaption#540744f8: field show_caption_above_media: %w", err) - } - e.ShowCaptionAboveMedia = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditInlineMessageCaptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageCaption#540744f8 as nil") - } - b.ObjStart() - b.PutID("editInlineMessageCaption") - b.Comma() - b.FieldStart("inline_message_id") - b.PutString(e.InlineMessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageCaption#540744f8: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageCaption#540744f8: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := e.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageCaption#540744f8: field caption: %w", err) - } - b.Comma() - b.FieldStart("show_caption_above_media") - b.PutBool(e.ShowCaptionAboveMedia) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditInlineMessageCaptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageCaption#540744f8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editInlineMessageCaption"); err != nil { - return fmt.Errorf("unable to decode editInlineMessageCaption#540744f8: %w", err) - } - case "inline_message_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageCaption#540744f8: field inline_message_id: %w", err) - } - e.InlineMessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageCaption#540744f8: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "caption": - if err := e.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editInlineMessageCaption#540744f8: field caption: %w", err) - } - case "show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageCaption#540744f8: field show_caption_above_media: %w", err) - } - e.ShowCaptionAboveMedia = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInlineMessageID returns value of InlineMessageID field. -func (e *EditInlineMessageCaptionRequest) GetInlineMessageID() (value string) { - if e == nil { - return - } - return e.InlineMessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditInlineMessageCaptionRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetCaption returns value of Caption field. -func (e *EditInlineMessageCaptionRequest) GetCaption() (value FormattedText) { - if e == nil { - return - } - return e.Caption -} - -// GetShowCaptionAboveMedia returns value of ShowCaptionAboveMedia field. -func (e *EditInlineMessageCaptionRequest) GetShowCaptionAboveMedia() (value bool) { - if e == nil { - return - } - return e.ShowCaptionAboveMedia -} - -// EditInlineMessageCaption invokes method editInlineMessageCaption#540744f8 returning error if any. -func (c *Client) EditInlineMessageCaption(ctx context.Context, request *EditInlineMessageCaptionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_inline_message_live_location_gen.go b/tdapi/tl_edit_inline_message_live_location_gen.go deleted file mode 100644 index e2344cd8e..000000000 --- a/tdapi/tl_edit_inline_message_live_location_gen.go +++ /dev/null @@ -1,385 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditInlineMessageLiveLocationRequest represents TL type `editInlineMessageLiveLocation#7f37a0ac`. -type EditInlineMessageLiveLocationRequest struct { - // Inline message identifier - InlineMessageID string - // The new message reply markup; pass null if none - ReplyMarkup ReplyMarkupClass - // New location content of the message; pass null to stop sharing the live location - Location Location - // New time relative to the message send date, for which the location can be updated, in - // seconds. If 0x7FFFFFFF specified, then the location can be updated forever. - LivePeriod int32 - // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown - Heading int32 - // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the - // notification is disabled - ProximityAlertRadius int32 -} - -// EditInlineMessageLiveLocationRequestTypeID is TL type id of EditInlineMessageLiveLocationRequest. -const EditInlineMessageLiveLocationRequestTypeID = 0x7f37a0ac - -// Ensuring interfaces in compile-time for EditInlineMessageLiveLocationRequest. -var ( - _ bin.Encoder = &EditInlineMessageLiveLocationRequest{} - _ bin.Decoder = &EditInlineMessageLiveLocationRequest{} - _ bin.BareEncoder = &EditInlineMessageLiveLocationRequest{} - _ bin.BareDecoder = &EditInlineMessageLiveLocationRequest{} -) - -func (e *EditInlineMessageLiveLocationRequest) Zero() bool { - if e == nil { - return true - } - if !(e.InlineMessageID == "") { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.Location.Zero()) { - return false - } - if !(e.LivePeriod == 0) { - return false - } - if !(e.Heading == 0) { - return false - } - if !(e.ProximityAlertRadius == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditInlineMessageLiveLocationRequest) String() string { - if e == nil { - return "EditInlineMessageLiveLocationRequest(nil)" - } - type Alias EditInlineMessageLiveLocationRequest - return fmt.Sprintf("EditInlineMessageLiveLocationRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditInlineMessageLiveLocationRequest) TypeID() uint32 { - return EditInlineMessageLiveLocationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditInlineMessageLiveLocationRequest) TypeName() string { - return "editInlineMessageLiveLocation" -} - -// TypeInfo returns info about TL type. -func (e *EditInlineMessageLiveLocationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editInlineMessageLiveLocation", - ID: EditInlineMessageLiveLocationRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InlineMessageID", - SchemaName: "inline_message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "LivePeriod", - SchemaName: "live_period", - }, - { - Name: "Heading", - SchemaName: "heading", - }, - { - Name: "ProximityAlertRadius", - SchemaName: "proximity_alert_radius", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditInlineMessageLiveLocationRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageLiveLocation#7f37a0ac as nil") - } - b.PutID(EditInlineMessageLiveLocationRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditInlineMessageLiveLocationRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageLiveLocation#7f37a0ac as nil") - } - b.PutString(e.InlineMessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field reply_markup: %w", err) - } - if err := e.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field location: %w", err) - } - b.PutInt32(e.LivePeriod) - b.PutInt32(e.Heading) - b.PutInt32(e.ProximityAlertRadius) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditInlineMessageLiveLocationRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageLiveLocation#7f37a0ac to nil") - } - if err := b.ConsumeID(EditInlineMessageLiveLocationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditInlineMessageLiveLocationRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageLiveLocation#7f37a0ac to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field inline_message_id: %w", err) - } - e.InlineMessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - if err := e.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field location: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field live_period: %w", err) - } - e.LivePeriod = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field heading: %w", err) - } - e.Heading = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field proximity_alert_radius: %w", err) - } - e.ProximityAlertRadius = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditInlineMessageLiveLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageLiveLocation#7f37a0ac as nil") - } - b.ObjStart() - b.PutID("editInlineMessageLiveLocation") - b.Comma() - b.FieldStart("inline_message_id") - b.PutString(e.InlineMessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("location") - if err := e.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageLiveLocation#7f37a0ac: field location: %w", err) - } - b.Comma() - b.FieldStart("live_period") - b.PutInt32(e.LivePeriod) - b.Comma() - b.FieldStart("heading") - b.PutInt32(e.Heading) - b.Comma() - b.FieldStart("proximity_alert_radius") - b.PutInt32(e.ProximityAlertRadius) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditInlineMessageLiveLocationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageLiveLocation#7f37a0ac to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editInlineMessageLiveLocation"); err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: %w", err) - } - case "inline_message_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field inline_message_id: %w", err) - } - e.InlineMessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "location": - if err := e.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field location: %w", err) - } - case "live_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field live_period: %w", err) - } - e.LivePeriod = value - case "heading": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field heading: %w", err) - } - e.Heading = value - case "proximity_alert_radius": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageLiveLocation#7f37a0ac: field proximity_alert_radius: %w", err) - } - e.ProximityAlertRadius = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInlineMessageID returns value of InlineMessageID field. -func (e *EditInlineMessageLiveLocationRequest) GetInlineMessageID() (value string) { - if e == nil { - return - } - return e.InlineMessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditInlineMessageLiveLocationRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetLocation returns value of Location field. -func (e *EditInlineMessageLiveLocationRequest) GetLocation() (value Location) { - if e == nil { - return - } - return e.Location -} - -// GetLivePeriod returns value of LivePeriod field. -func (e *EditInlineMessageLiveLocationRequest) GetLivePeriod() (value int32) { - if e == nil { - return - } - return e.LivePeriod -} - -// GetHeading returns value of Heading field. -func (e *EditInlineMessageLiveLocationRequest) GetHeading() (value int32) { - if e == nil { - return - } - return e.Heading -} - -// GetProximityAlertRadius returns value of ProximityAlertRadius field. -func (e *EditInlineMessageLiveLocationRequest) GetProximityAlertRadius() (value int32) { - if e == nil { - return - } - return e.ProximityAlertRadius -} - -// EditInlineMessageLiveLocation invokes method editInlineMessageLiveLocation#7f37a0ac returning error if any. -func (c *Client) EditInlineMessageLiveLocation(ctx context.Context, request *EditInlineMessageLiveLocationRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_inline_message_media_gen.go b/tdapi/tl_edit_inline_message_media_gen.go deleted file mode 100644 index e69b7bfab..000000000 --- a/tdapi/tl_edit_inline_message_media_gen.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditInlineMessageMediaRequest represents TL type `editInlineMessageMedia#1676781`. -type EditInlineMessageMediaRequest struct { - // Inline message identifier - InlineMessageID string - // The new message reply markup; pass null if none; for bots only - ReplyMarkup ReplyMarkupClass - // New content of the message. Must be one of the following types: inputMessageAnimation, - // inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo - InputMessageContent InputMessageContentClass -} - -// EditInlineMessageMediaRequestTypeID is TL type id of EditInlineMessageMediaRequest. -const EditInlineMessageMediaRequestTypeID = 0x1676781 - -// Ensuring interfaces in compile-time for EditInlineMessageMediaRequest. -var ( - _ bin.Encoder = &EditInlineMessageMediaRequest{} - _ bin.Decoder = &EditInlineMessageMediaRequest{} - _ bin.BareEncoder = &EditInlineMessageMediaRequest{} - _ bin.BareDecoder = &EditInlineMessageMediaRequest{} -) - -func (e *EditInlineMessageMediaRequest) Zero() bool { - if e == nil { - return true - } - if !(e.InlineMessageID == "") { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditInlineMessageMediaRequest) String() string { - if e == nil { - return "EditInlineMessageMediaRequest(nil)" - } - type Alias EditInlineMessageMediaRequest - return fmt.Sprintf("EditInlineMessageMediaRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditInlineMessageMediaRequest) TypeID() uint32 { - return EditInlineMessageMediaRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditInlineMessageMediaRequest) TypeName() string { - return "editInlineMessageMedia" -} - -// TypeInfo returns info about TL type. -func (e *EditInlineMessageMediaRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editInlineMessageMedia", - ID: EditInlineMessageMediaRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InlineMessageID", - SchemaName: "inline_message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditInlineMessageMediaRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageMedia#1676781 as nil") - } - b.PutID(EditInlineMessageMediaRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditInlineMessageMediaRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageMedia#1676781 as nil") - } - b.PutString(e.InlineMessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageMedia#1676781: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageMedia#1676781: field reply_markup: %w", err) - } - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editInlineMessageMedia#1676781: field input_message_content is nil") - } - if err := e.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageMedia#1676781: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditInlineMessageMediaRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageMedia#1676781 to nil") - } - if err := b.ConsumeID(EditInlineMessageMediaRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editInlineMessageMedia#1676781: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditInlineMessageMediaRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageMedia#1676781 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageMedia#1676781: field inline_message_id: %w", err) - } - e.InlineMessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageMedia#1676781: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageMedia#1676781: field input_message_content: %w", err) - } - e.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditInlineMessageMediaRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageMedia#1676781 as nil") - } - b.ObjStart() - b.PutID("editInlineMessageMedia") - b.Comma() - b.FieldStart("inline_message_id") - b.PutString(e.InlineMessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageMedia#1676781: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageMedia#1676781: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editInlineMessageMedia#1676781: field input_message_content is nil") - } - if err := e.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageMedia#1676781: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditInlineMessageMediaRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageMedia#1676781 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editInlineMessageMedia"); err != nil { - return fmt.Errorf("unable to decode editInlineMessageMedia#1676781: %w", err) - } - case "inline_message_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageMedia#1676781: field inline_message_id: %w", err) - } - e.InlineMessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageMedia#1676781: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageMedia#1676781: field input_message_content: %w", err) - } - e.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInlineMessageID returns value of InlineMessageID field. -func (e *EditInlineMessageMediaRequest) GetInlineMessageID() (value string) { - if e == nil { - return - } - return e.InlineMessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditInlineMessageMediaRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (e *EditInlineMessageMediaRequest) GetInputMessageContent() (value InputMessageContentClass) { - if e == nil { - return - } - return e.InputMessageContent -} - -// EditInlineMessageMedia invokes method editInlineMessageMedia#1676781 returning error if any. -func (c *Client) EditInlineMessageMedia(ctx context.Context, request *EditInlineMessageMediaRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_inline_message_reply_markup_gen.go b/tdapi/tl_edit_inline_message_reply_markup_gen.go deleted file mode 100644 index 94962bbb2..000000000 --- a/tdapi/tl_edit_inline_message_reply_markup_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditInlineMessageReplyMarkupRequest represents TL type `editInlineMessageReplyMarkup#fbf906de`. -type EditInlineMessageReplyMarkupRequest struct { - // Inline message identifier - InlineMessageID string - // The new message reply markup; pass null if none - ReplyMarkup ReplyMarkupClass -} - -// EditInlineMessageReplyMarkupRequestTypeID is TL type id of EditInlineMessageReplyMarkupRequest. -const EditInlineMessageReplyMarkupRequestTypeID = 0xfbf906de - -// Ensuring interfaces in compile-time for EditInlineMessageReplyMarkupRequest. -var ( - _ bin.Encoder = &EditInlineMessageReplyMarkupRequest{} - _ bin.Decoder = &EditInlineMessageReplyMarkupRequest{} - _ bin.BareEncoder = &EditInlineMessageReplyMarkupRequest{} - _ bin.BareDecoder = &EditInlineMessageReplyMarkupRequest{} -) - -func (e *EditInlineMessageReplyMarkupRequest) Zero() bool { - if e == nil { - return true - } - if !(e.InlineMessageID == "") { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditInlineMessageReplyMarkupRequest) String() string { - if e == nil { - return "EditInlineMessageReplyMarkupRequest(nil)" - } - type Alias EditInlineMessageReplyMarkupRequest - return fmt.Sprintf("EditInlineMessageReplyMarkupRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditInlineMessageReplyMarkupRequest) TypeID() uint32 { - return EditInlineMessageReplyMarkupRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditInlineMessageReplyMarkupRequest) TypeName() string { - return "editInlineMessageReplyMarkup" -} - -// TypeInfo returns info about TL type. -func (e *EditInlineMessageReplyMarkupRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editInlineMessageReplyMarkup", - ID: EditInlineMessageReplyMarkupRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InlineMessageID", - SchemaName: "inline_message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditInlineMessageReplyMarkupRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageReplyMarkup#fbf906de as nil") - } - b.PutID(EditInlineMessageReplyMarkupRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditInlineMessageReplyMarkupRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageReplyMarkup#fbf906de as nil") - } - b.PutString(e.InlineMessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageReplyMarkup#fbf906de: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageReplyMarkup#fbf906de: field reply_markup: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditInlineMessageReplyMarkupRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageReplyMarkup#fbf906de to nil") - } - if err := b.ConsumeID(EditInlineMessageReplyMarkupRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editInlineMessageReplyMarkup#fbf906de: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditInlineMessageReplyMarkupRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageReplyMarkup#fbf906de to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageReplyMarkup#fbf906de: field inline_message_id: %w", err) - } - e.InlineMessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageReplyMarkup#fbf906de: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditInlineMessageReplyMarkupRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageReplyMarkup#fbf906de as nil") - } - b.ObjStart() - b.PutID("editInlineMessageReplyMarkup") - b.Comma() - b.FieldStart("inline_message_id") - b.PutString(e.InlineMessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageReplyMarkup#fbf906de: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageReplyMarkup#fbf906de: field reply_markup: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditInlineMessageReplyMarkupRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageReplyMarkup#fbf906de to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editInlineMessageReplyMarkup"); err != nil { - return fmt.Errorf("unable to decode editInlineMessageReplyMarkup#fbf906de: %w", err) - } - case "inline_message_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageReplyMarkup#fbf906de: field inline_message_id: %w", err) - } - e.InlineMessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageReplyMarkup#fbf906de: field reply_markup: %w", err) - } - e.ReplyMarkup = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInlineMessageID returns value of InlineMessageID field. -func (e *EditInlineMessageReplyMarkupRequest) GetInlineMessageID() (value string) { - if e == nil { - return - } - return e.InlineMessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditInlineMessageReplyMarkupRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// EditInlineMessageReplyMarkup invokes method editInlineMessageReplyMarkup#fbf906de returning error if any. -func (c *Client) EditInlineMessageReplyMarkup(ctx context.Context, request *EditInlineMessageReplyMarkupRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_inline_message_text_gen.go b/tdapi/tl_edit_inline_message_text_gen.go deleted file mode 100644 index 19e4095cb..000000000 --- a/tdapi/tl_edit_inline_message_text_gen.go +++ /dev/null @@ -1,291 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditInlineMessageTextRequest represents TL type `editInlineMessageText#cd02c1e5`. -type EditInlineMessageTextRequest struct { - // Inline message identifier - InlineMessageID string - // The new message reply markup; pass null if none - ReplyMarkup ReplyMarkupClass - // New text content of the message. Must be of type inputMessageText - InputMessageContent InputMessageContentClass -} - -// EditInlineMessageTextRequestTypeID is TL type id of EditInlineMessageTextRequest. -const EditInlineMessageTextRequestTypeID = 0xcd02c1e5 - -// Ensuring interfaces in compile-time for EditInlineMessageTextRequest. -var ( - _ bin.Encoder = &EditInlineMessageTextRequest{} - _ bin.Decoder = &EditInlineMessageTextRequest{} - _ bin.BareEncoder = &EditInlineMessageTextRequest{} - _ bin.BareDecoder = &EditInlineMessageTextRequest{} -) - -func (e *EditInlineMessageTextRequest) Zero() bool { - if e == nil { - return true - } - if !(e.InlineMessageID == "") { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditInlineMessageTextRequest) String() string { - if e == nil { - return "EditInlineMessageTextRequest(nil)" - } - type Alias EditInlineMessageTextRequest - return fmt.Sprintf("EditInlineMessageTextRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditInlineMessageTextRequest) TypeID() uint32 { - return EditInlineMessageTextRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditInlineMessageTextRequest) TypeName() string { - return "editInlineMessageText" -} - -// TypeInfo returns info about TL type. -func (e *EditInlineMessageTextRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editInlineMessageText", - ID: EditInlineMessageTextRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InlineMessageID", - SchemaName: "inline_message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditInlineMessageTextRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageText#cd02c1e5 as nil") - } - b.PutID(EditInlineMessageTextRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditInlineMessageTextRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageText#cd02c1e5 as nil") - } - b.PutString(e.InlineMessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageText#cd02c1e5: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageText#cd02c1e5: field reply_markup: %w", err) - } - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editInlineMessageText#cd02c1e5: field input_message_content is nil") - } - if err := e.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageText#cd02c1e5: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditInlineMessageTextRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageText#cd02c1e5 to nil") - } - if err := b.ConsumeID(EditInlineMessageTextRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editInlineMessageText#cd02c1e5: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditInlineMessageTextRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageText#cd02c1e5 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageText#cd02c1e5: field inline_message_id: %w", err) - } - e.InlineMessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageText#cd02c1e5: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageText#cd02c1e5: field input_message_content: %w", err) - } - e.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditInlineMessageTextRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editInlineMessageText#cd02c1e5 as nil") - } - b.ObjStart() - b.PutID("editInlineMessageText") - b.Comma() - b.FieldStart("inline_message_id") - b.PutString(e.InlineMessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editInlineMessageText#cd02c1e5: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageText#cd02c1e5: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editInlineMessageText#cd02c1e5: field input_message_content is nil") - } - if err := e.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editInlineMessageText#cd02c1e5: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditInlineMessageTextRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editInlineMessageText#cd02c1e5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editInlineMessageText"); err != nil { - return fmt.Errorf("unable to decode editInlineMessageText#cd02c1e5: %w", err) - } - case "inline_message_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageText#cd02c1e5: field inline_message_id: %w", err) - } - e.InlineMessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageText#cd02c1e5: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editInlineMessageText#cd02c1e5: field input_message_content: %w", err) - } - e.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInlineMessageID returns value of InlineMessageID field. -func (e *EditInlineMessageTextRequest) GetInlineMessageID() (value string) { - if e == nil { - return - } - return e.InlineMessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditInlineMessageTextRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (e *EditInlineMessageTextRequest) GetInputMessageContent() (value InputMessageContentClass) { - if e == nil { - return - } - return e.InputMessageContent -} - -// EditInlineMessageText invokes method editInlineMessageText#cd02c1e5 returning error if any. -func (c *Client) EditInlineMessageText(ctx context.Context, request *EditInlineMessageTextRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_message_caption_gen.go b/tdapi/tl_edit_message_caption_gen.go deleted file mode 100644 index dba48cc48..000000000 --- a/tdapi/tl_edit_message_caption_gen.go +++ /dev/null @@ -1,352 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditMessageCaptionRequest represents TL type `editMessageCaption#87977241`. -type EditMessageCaptionRequest struct { - // The chat the message belongs to - ChatID int64 - // Identifier of the message. Use messageProperties.can_be_edited to check whether the - // message can be edited - MessageID int64 - // The new message reply markup; pass null if none; for bots only - ReplyMarkup ReplyMarkupClass - // New message content caption; 0-getOption("message_caption_length_max") characters; - // pass null to remove caption - Caption FormattedText - // Pass true to show the caption above the media; otherwise, the caption will be shown - // below the media. May be true only for animation, photo, and video messages - ShowCaptionAboveMedia bool -} - -// EditMessageCaptionRequestTypeID is TL type id of EditMessageCaptionRequest. -const EditMessageCaptionRequestTypeID = 0x87977241 - -// Ensuring interfaces in compile-time for EditMessageCaptionRequest. -var ( - _ bin.Encoder = &EditMessageCaptionRequest{} - _ bin.Decoder = &EditMessageCaptionRequest{} - _ bin.BareEncoder = &EditMessageCaptionRequest{} - _ bin.BareDecoder = &EditMessageCaptionRequest{} -) - -func (e *EditMessageCaptionRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.Caption.Zero()) { - return false - } - if !(e.ShowCaptionAboveMedia == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditMessageCaptionRequest) String() string { - if e == nil { - return "EditMessageCaptionRequest(nil)" - } - type Alias EditMessageCaptionRequest - return fmt.Sprintf("EditMessageCaptionRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditMessageCaptionRequest) TypeID() uint32 { - return EditMessageCaptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditMessageCaptionRequest) TypeName() string { - return "editMessageCaption" -} - -// TypeInfo returns info about TL type. -func (e *EditMessageCaptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editMessageCaption", - ID: EditMessageCaptionRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "ShowCaptionAboveMedia", - SchemaName: "show_caption_above_media", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditMessageCaptionRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageCaption#87977241 as nil") - } - b.PutID(EditMessageCaptionRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditMessageCaptionRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageCaption#87977241 as nil") - } - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageCaption#87977241: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageCaption#87977241: field reply_markup: %w", err) - } - if err := e.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageCaption#87977241: field caption: %w", err) - } - b.PutBool(e.ShowCaptionAboveMedia) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditMessageCaptionRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageCaption#87977241 to nil") - } - if err := b.ConsumeID(EditMessageCaptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditMessageCaptionRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageCaption#87977241 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - if err := e.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: field show_caption_above_media: %w", err) - } - e.ShowCaptionAboveMedia = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditMessageCaptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editMessageCaption#87977241 as nil") - } - b.ObjStart() - b.PutID("editMessageCaption") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageCaption#87977241: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageCaption#87977241: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := e.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageCaption#87977241: field caption: %w", err) - } - b.Comma() - b.FieldStart("show_caption_above_media") - b.PutBool(e.ShowCaptionAboveMedia) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditMessageCaptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editMessageCaption#87977241 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editMessageCaption"); err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: field chat_id: %w", err) - } - e.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: field message_id: %w", err) - } - e.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "caption": - if err := e.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: field caption: %w", err) - } - case "show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editMessageCaption#87977241: field show_caption_above_media: %w", err) - } - e.ShowCaptionAboveMedia = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (e *EditMessageCaptionRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageID returns value of MessageID field. -func (e *EditMessageCaptionRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditMessageCaptionRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetCaption returns value of Caption field. -func (e *EditMessageCaptionRequest) GetCaption() (value FormattedText) { - if e == nil { - return - } - return e.Caption -} - -// GetShowCaptionAboveMedia returns value of ShowCaptionAboveMedia field. -func (e *EditMessageCaptionRequest) GetShowCaptionAboveMedia() (value bool) { - if e == nil { - return - } - return e.ShowCaptionAboveMedia -} - -// EditMessageCaption invokes method editMessageCaption#87977241 returning error if any. -func (c *Client) EditMessageCaption(ctx context.Context, request *EditMessageCaptionRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_message_live_location_gen.go b/tdapi/tl_edit_message_live_location_gen.go deleted file mode 100644 index c6bdc248a..000000000 --- a/tdapi/tl_edit_message_live_location_gen.go +++ /dev/null @@ -1,420 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditMessageLiveLocationRequest represents TL type `editMessageLiveLocation#8f511394`. -type EditMessageLiveLocationRequest struct { - // The chat the message belongs to - ChatID int64 - // Identifier of the message. Use messageProperties.can_be_edited to check whether the - // message can be edited - MessageID int64 - // The new message reply markup; pass null if none; for bots only - ReplyMarkup ReplyMarkupClass - // New location content of the message; pass null to stop sharing the live location - Location Location - // New time relative to the message send date, for which the location can be updated, in - // seconds. If 0x7FFFFFFF specified, then the location can be updated forever. - LivePeriod int32 - // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown - Heading int32 - // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the - // notification is disabled - ProximityAlertRadius int32 -} - -// EditMessageLiveLocationRequestTypeID is TL type id of EditMessageLiveLocationRequest. -const EditMessageLiveLocationRequestTypeID = 0x8f511394 - -// Ensuring interfaces in compile-time for EditMessageLiveLocationRequest. -var ( - _ bin.Encoder = &EditMessageLiveLocationRequest{} - _ bin.Decoder = &EditMessageLiveLocationRequest{} - _ bin.BareEncoder = &EditMessageLiveLocationRequest{} - _ bin.BareDecoder = &EditMessageLiveLocationRequest{} -) - -func (e *EditMessageLiveLocationRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.Location.Zero()) { - return false - } - if !(e.LivePeriod == 0) { - return false - } - if !(e.Heading == 0) { - return false - } - if !(e.ProximityAlertRadius == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditMessageLiveLocationRequest) String() string { - if e == nil { - return "EditMessageLiveLocationRequest(nil)" - } - type Alias EditMessageLiveLocationRequest - return fmt.Sprintf("EditMessageLiveLocationRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditMessageLiveLocationRequest) TypeID() uint32 { - return EditMessageLiveLocationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditMessageLiveLocationRequest) TypeName() string { - return "editMessageLiveLocation" -} - -// TypeInfo returns info about TL type. -func (e *EditMessageLiveLocationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editMessageLiveLocation", - ID: EditMessageLiveLocationRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "LivePeriod", - SchemaName: "live_period", - }, - { - Name: "Heading", - SchemaName: "heading", - }, - { - Name: "ProximityAlertRadius", - SchemaName: "proximity_alert_radius", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditMessageLiveLocationRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageLiveLocation#8f511394 as nil") - } - b.PutID(EditMessageLiveLocationRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditMessageLiveLocationRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageLiveLocation#8f511394 as nil") - } - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field reply_markup: %w", err) - } - if err := e.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field location: %w", err) - } - b.PutInt32(e.LivePeriod) - b.PutInt32(e.Heading) - b.PutInt32(e.ProximityAlertRadius) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditMessageLiveLocationRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageLiveLocation#8f511394 to nil") - } - if err := b.ConsumeID(EditMessageLiveLocationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditMessageLiveLocationRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageLiveLocation#8f511394 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - if err := e.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field location: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field live_period: %w", err) - } - e.LivePeriod = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field heading: %w", err) - } - e.Heading = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field proximity_alert_radius: %w", err) - } - e.ProximityAlertRadius = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditMessageLiveLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editMessageLiveLocation#8f511394 as nil") - } - b.ObjStart() - b.PutID("editMessageLiveLocation") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("location") - if err := e.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageLiveLocation#8f511394: field location: %w", err) - } - b.Comma() - b.FieldStart("live_period") - b.PutInt32(e.LivePeriod) - b.Comma() - b.FieldStart("heading") - b.PutInt32(e.Heading) - b.Comma() - b.FieldStart("proximity_alert_radius") - b.PutInt32(e.ProximityAlertRadius) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditMessageLiveLocationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editMessageLiveLocation#8f511394 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editMessageLiveLocation"); err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field chat_id: %w", err) - } - e.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field message_id: %w", err) - } - e.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "location": - if err := e.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field location: %w", err) - } - case "live_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field live_period: %w", err) - } - e.LivePeriod = value - case "heading": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field heading: %w", err) - } - e.Heading = value - case "proximity_alert_radius": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editMessageLiveLocation#8f511394: field proximity_alert_radius: %w", err) - } - e.ProximityAlertRadius = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (e *EditMessageLiveLocationRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageID returns value of MessageID field. -func (e *EditMessageLiveLocationRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditMessageLiveLocationRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetLocation returns value of Location field. -func (e *EditMessageLiveLocationRequest) GetLocation() (value Location) { - if e == nil { - return - } - return e.Location -} - -// GetLivePeriod returns value of LivePeriod field. -func (e *EditMessageLiveLocationRequest) GetLivePeriod() (value int32) { - if e == nil { - return - } - return e.LivePeriod -} - -// GetHeading returns value of Heading field. -func (e *EditMessageLiveLocationRequest) GetHeading() (value int32) { - if e == nil { - return - } - return e.Heading -} - -// GetProximityAlertRadius returns value of ProximityAlertRadius field. -func (e *EditMessageLiveLocationRequest) GetProximityAlertRadius() (value int32) { - if e == nil { - return - } - return e.ProximityAlertRadius -} - -// EditMessageLiveLocation invokes method editMessageLiveLocation#8f511394 returning error if any. -func (c *Client) EditMessageLiveLocation(ctx context.Context, request *EditMessageLiveLocationRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_message_media_gen.go b/tdapi/tl_edit_message_media_gen.go deleted file mode 100644 index 8230c73a2..000000000 --- a/tdapi/tl_edit_message_media_gen.go +++ /dev/null @@ -1,327 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditMessageMediaRequest represents TL type `editMessageMedia#bb4b8713`. -type EditMessageMediaRequest struct { - // The chat the message belongs to - ChatID int64 - // Identifier of the message. Use messageProperties.can_edit_media to check whether the - // message can be edited - MessageID int64 - // The new message reply markup; pass null if none; for bots only - ReplyMarkup ReplyMarkupClass - // New content of the message. Must be one of the following types: inputMessageAnimation, - // inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo - InputMessageContent InputMessageContentClass -} - -// EditMessageMediaRequestTypeID is TL type id of EditMessageMediaRequest. -const EditMessageMediaRequestTypeID = 0xbb4b8713 - -// Ensuring interfaces in compile-time for EditMessageMediaRequest. -var ( - _ bin.Encoder = &EditMessageMediaRequest{} - _ bin.Decoder = &EditMessageMediaRequest{} - _ bin.BareEncoder = &EditMessageMediaRequest{} - _ bin.BareDecoder = &EditMessageMediaRequest{} -) - -func (e *EditMessageMediaRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditMessageMediaRequest) String() string { - if e == nil { - return "EditMessageMediaRequest(nil)" - } - type Alias EditMessageMediaRequest - return fmt.Sprintf("EditMessageMediaRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditMessageMediaRequest) TypeID() uint32 { - return EditMessageMediaRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditMessageMediaRequest) TypeName() string { - return "editMessageMedia" -} - -// TypeInfo returns info about TL type. -func (e *EditMessageMediaRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editMessageMedia", - ID: EditMessageMediaRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditMessageMediaRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageMedia#bb4b8713 as nil") - } - b.PutID(EditMessageMediaRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditMessageMediaRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageMedia#bb4b8713 as nil") - } - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageMedia#bb4b8713: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageMedia#bb4b8713: field reply_markup: %w", err) - } - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editMessageMedia#bb4b8713: field input_message_content is nil") - } - if err := e.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageMedia#bb4b8713: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditMessageMediaRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageMedia#bb4b8713 to nil") - } - if err := b.ConsumeID(EditMessageMediaRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editMessageMedia#bb4b8713: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditMessageMediaRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageMedia#bb4b8713 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageMedia#bb4b8713: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageMedia#bb4b8713: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageMedia#bb4b8713: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageMedia#bb4b8713: field input_message_content: %w", err) - } - e.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditMessageMediaRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editMessageMedia#bb4b8713 as nil") - } - b.ObjStart() - b.PutID("editMessageMedia") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageMedia#bb4b8713: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageMedia#bb4b8713: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editMessageMedia#bb4b8713: field input_message_content is nil") - } - if err := e.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageMedia#bb4b8713: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditMessageMediaRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editMessageMedia#bb4b8713 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editMessageMedia"); err != nil { - return fmt.Errorf("unable to decode editMessageMedia#bb4b8713: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageMedia#bb4b8713: field chat_id: %w", err) - } - e.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageMedia#bb4b8713: field message_id: %w", err) - } - e.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageMedia#bb4b8713: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageMedia#bb4b8713: field input_message_content: %w", err) - } - e.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (e *EditMessageMediaRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageID returns value of MessageID field. -func (e *EditMessageMediaRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditMessageMediaRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (e *EditMessageMediaRequest) GetInputMessageContent() (value InputMessageContentClass) { - if e == nil { - return - } - return e.InputMessageContent -} - -// EditMessageMedia invokes method editMessageMedia#bb4b8713 returning error if any. -func (c *Client) EditMessageMedia(ctx context.Context, request *EditMessageMediaRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_message_reply_markup_gen.go b/tdapi/tl_edit_message_reply_markup_gen.go deleted file mode 100644 index 519b18082..000000000 --- a/tdapi/tl_edit_message_reply_markup_gen.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditMessageReplyMarkupRequest represents TL type `editMessageReplyMarkup#13cbde89`. -type EditMessageReplyMarkupRequest struct { - // The chat the message belongs to - ChatID int64 - // Identifier of the message. Use messageProperties.can_be_edited to check whether the - // message can be edited - MessageID int64 - // The new message reply markup; pass null if none - ReplyMarkup ReplyMarkupClass -} - -// EditMessageReplyMarkupRequestTypeID is TL type id of EditMessageReplyMarkupRequest. -const EditMessageReplyMarkupRequestTypeID = 0x13cbde89 - -// Ensuring interfaces in compile-time for EditMessageReplyMarkupRequest. -var ( - _ bin.Encoder = &EditMessageReplyMarkupRequest{} - _ bin.Decoder = &EditMessageReplyMarkupRequest{} - _ bin.BareEncoder = &EditMessageReplyMarkupRequest{} - _ bin.BareDecoder = &EditMessageReplyMarkupRequest{} -) - -func (e *EditMessageReplyMarkupRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditMessageReplyMarkupRequest) String() string { - if e == nil { - return "EditMessageReplyMarkupRequest(nil)" - } - type Alias EditMessageReplyMarkupRequest - return fmt.Sprintf("EditMessageReplyMarkupRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditMessageReplyMarkupRequest) TypeID() uint32 { - return EditMessageReplyMarkupRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditMessageReplyMarkupRequest) TypeName() string { - return "editMessageReplyMarkup" -} - -// TypeInfo returns info about TL type. -func (e *EditMessageReplyMarkupRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editMessageReplyMarkup", - ID: EditMessageReplyMarkupRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditMessageReplyMarkupRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageReplyMarkup#13cbde89 as nil") - } - b.PutID(EditMessageReplyMarkupRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditMessageReplyMarkupRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageReplyMarkup#13cbde89 as nil") - } - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageReplyMarkup#13cbde89: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageReplyMarkup#13cbde89: field reply_markup: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditMessageReplyMarkupRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageReplyMarkup#13cbde89 to nil") - } - if err := b.ConsumeID(EditMessageReplyMarkupRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editMessageReplyMarkup#13cbde89: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditMessageReplyMarkupRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageReplyMarkup#13cbde89 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageReplyMarkup#13cbde89: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageReplyMarkup#13cbde89: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageReplyMarkup#13cbde89: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditMessageReplyMarkupRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editMessageReplyMarkup#13cbde89 as nil") - } - b.ObjStart() - b.PutID("editMessageReplyMarkup") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageReplyMarkup#13cbde89: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageReplyMarkup#13cbde89: field reply_markup: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditMessageReplyMarkupRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editMessageReplyMarkup#13cbde89 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editMessageReplyMarkup"); err != nil { - return fmt.Errorf("unable to decode editMessageReplyMarkup#13cbde89: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageReplyMarkup#13cbde89: field chat_id: %w", err) - } - e.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageReplyMarkup#13cbde89: field message_id: %w", err) - } - e.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageReplyMarkup#13cbde89: field reply_markup: %w", err) - } - e.ReplyMarkup = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (e *EditMessageReplyMarkupRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageID returns value of MessageID field. -func (e *EditMessageReplyMarkupRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditMessageReplyMarkupRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// EditMessageReplyMarkup invokes method editMessageReplyMarkup#13cbde89 returning error if any. -func (c *Client) EditMessageReplyMarkup(ctx context.Context, request *EditMessageReplyMarkupRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_message_scheduling_state_gen.go b/tdapi/tl_edit_message_scheduling_state_gen.go deleted file mode 100644 index 409753634..000000000 --- a/tdapi/tl_edit_message_scheduling_state_gen.go +++ /dev/null @@ -1,283 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditMessageSchedulingStateRequest represents TL type `editMessageSchedulingState#ae2a0bc0`. -type EditMessageSchedulingStateRequest struct { - // The chat the message belongs to - ChatID int64 - // Identifier of the message. Use messageProperties.can_edit_scheduling_state to check - // whether the message is suitable - MessageID int64 - // The new message scheduling state; pass null to send the message immediately. Must be - // null for messages in the state messageSchedulingStateSendWhenVideoProcessed - SchedulingState MessageSchedulingStateClass -} - -// EditMessageSchedulingStateRequestTypeID is TL type id of EditMessageSchedulingStateRequest. -const EditMessageSchedulingStateRequestTypeID = 0xae2a0bc0 - -// Ensuring interfaces in compile-time for EditMessageSchedulingStateRequest. -var ( - _ bin.Encoder = &EditMessageSchedulingStateRequest{} - _ bin.Decoder = &EditMessageSchedulingStateRequest{} - _ bin.BareEncoder = &EditMessageSchedulingStateRequest{} - _ bin.BareDecoder = &EditMessageSchedulingStateRequest{} -) - -func (e *EditMessageSchedulingStateRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.SchedulingState == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditMessageSchedulingStateRequest) String() string { - if e == nil { - return "EditMessageSchedulingStateRequest(nil)" - } - type Alias EditMessageSchedulingStateRequest - return fmt.Sprintf("EditMessageSchedulingStateRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditMessageSchedulingStateRequest) TypeID() uint32 { - return EditMessageSchedulingStateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditMessageSchedulingStateRequest) TypeName() string { - return "editMessageSchedulingState" -} - -// TypeInfo returns info about TL type. -func (e *EditMessageSchedulingStateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editMessageSchedulingState", - ID: EditMessageSchedulingStateRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "SchedulingState", - SchemaName: "scheduling_state", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditMessageSchedulingStateRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageSchedulingState#ae2a0bc0 as nil") - } - b.PutID(EditMessageSchedulingStateRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditMessageSchedulingStateRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageSchedulingState#ae2a0bc0 as nil") - } - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageID) - if e.SchedulingState == nil { - return fmt.Errorf("unable to encode editMessageSchedulingState#ae2a0bc0: field scheduling_state is nil") - } - if err := e.SchedulingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageSchedulingState#ae2a0bc0: field scheduling_state: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditMessageSchedulingStateRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageSchedulingState#ae2a0bc0 to nil") - } - if err := b.ConsumeID(EditMessageSchedulingStateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editMessageSchedulingState#ae2a0bc0: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditMessageSchedulingStateRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageSchedulingState#ae2a0bc0 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageSchedulingState#ae2a0bc0: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageSchedulingState#ae2a0bc0: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeMessageSchedulingState(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageSchedulingState#ae2a0bc0: field scheduling_state: %w", err) - } - e.SchedulingState = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditMessageSchedulingStateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editMessageSchedulingState#ae2a0bc0 as nil") - } - b.ObjStart() - b.PutID("editMessageSchedulingState") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("scheduling_state") - if e.SchedulingState == nil { - return fmt.Errorf("unable to encode editMessageSchedulingState#ae2a0bc0: field scheduling_state is nil") - } - if err := e.SchedulingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageSchedulingState#ae2a0bc0: field scheduling_state: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditMessageSchedulingStateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editMessageSchedulingState#ae2a0bc0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editMessageSchedulingState"); err != nil { - return fmt.Errorf("unable to decode editMessageSchedulingState#ae2a0bc0: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageSchedulingState#ae2a0bc0: field chat_id: %w", err) - } - e.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageSchedulingState#ae2a0bc0: field message_id: %w", err) - } - e.MessageID = value - case "scheduling_state": - value, err := DecodeTDLibJSONMessageSchedulingState(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageSchedulingState#ae2a0bc0: field scheduling_state: %w", err) - } - e.SchedulingState = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (e *EditMessageSchedulingStateRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageID returns value of MessageID field. -func (e *EditMessageSchedulingStateRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetSchedulingState returns value of SchedulingState field. -func (e *EditMessageSchedulingStateRequest) GetSchedulingState() (value MessageSchedulingStateClass) { - if e == nil { - return - } - return e.SchedulingState -} - -// EditMessageSchedulingState invokes method editMessageSchedulingState#ae2a0bc0 returning error if any. -func (c *Client) EditMessageSchedulingState(ctx context.Context, request *EditMessageSchedulingStateRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_message_text_gen.go b/tdapi/tl_edit_message_text_gen.go deleted file mode 100644 index c1849d3a4..000000000 --- a/tdapi/tl_edit_message_text_gen.go +++ /dev/null @@ -1,326 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditMessageTextRequest represents TL type `editMessageText#bb2e1b7`. -type EditMessageTextRequest struct { - // The chat the message belongs to - ChatID int64 - // Identifier of the message. Use messageProperties.can_be_edited to check whether the - // message can be edited - MessageID int64 - // The new message reply markup; pass null if none; for bots only - ReplyMarkup ReplyMarkupClass - // New text content of the message. Must be of type inputMessageText - InputMessageContent InputMessageContentClass -} - -// EditMessageTextRequestTypeID is TL type id of EditMessageTextRequest. -const EditMessageTextRequestTypeID = 0xbb2e1b7 - -// Ensuring interfaces in compile-time for EditMessageTextRequest. -var ( - _ bin.Encoder = &EditMessageTextRequest{} - _ bin.Decoder = &EditMessageTextRequest{} - _ bin.BareEncoder = &EditMessageTextRequest{} - _ bin.BareDecoder = &EditMessageTextRequest{} -) - -func (e *EditMessageTextRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ChatID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.ReplyMarkup == nil) { - return false - } - if !(e.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditMessageTextRequest) String() string { - if e == nil { - return "EditMessageTextRequest(nil)" - } - type Alias EditMessageTextRequest - return fmt.Sprintf("EditMessageTextRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditMessageTextRequest) TypeID() uint32 { - return EditMessageTextRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditMessageTextRequest) TypeName() string { - return "editMessageText" -} - -// TypeInfo returns info about TL type. -func (e *EditMessageTextRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editMessageText", - ID: EditMessageTextRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditMessageTextRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageText#bb2e1b7 as nil") - } - b.PutID(EditMessageTextRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditMessageTextRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editMessageText#bb2e1b7 as nil") - } - b.PutInt53(e.ChatID) - b.PutInt53(e.MessageID) - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageText#bb2e1b7: field reply_markup is nil") - } - if err := e.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageText#bb2e1b7: field reply_markup: %w", err) - } - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editMessageText#bb2e1b7: field input_message_content is nil") - } - if err := e.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode editMessageText#bb2e1b7: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditMessageTextRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageText#bb2e1b7 to nil") - } - if err := b.ConsumeID(EditMessageTextRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editMessageText#bb2e1b7: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditMessageTextRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editMessageText#bb2e1b7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageText#bb2e1b7: field chat_id: %w", err) - } - e.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageText#bb2e1b7: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageText#bb2e1b7: field reply_markup: %w", err) - } - e.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageText#bb2e1b7: field input_message_content: %w", err) - } - e.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditMessageTextRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editMessageText#bb2e1b7 as nil") - } - b.ObjStart() - b.PutID("editMessageText") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(e.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if e.ReplyMarkup == nil { - return fmt.Errorf("unable to encode editMessageText#bb2e1b7: field reply_markup is nil") - } - if err := e.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageText#bb2e1b7: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editMessageText#bb2e1b7: field input_message_content is nil") - } - if err := e.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editMessageText#bb2e1b7: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditMessageTextRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editMessageText#bb2e1b7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editMessageText"); err != nil { - return fmt.Errorf("unable to decode editMessageText#bb2e1b7: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageText#bb2e1b7: field chat_id: %w", err) - } - e.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editMessageText#bb2e1b7: field message_id: %w", err) - } - e.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageText#bb2e1b7: field reply_markup: %w", err) - } - e.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editMessageText#bb2e1b7: field input_message_content: %w", err) - } - e.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (e *EditMessageTextRequest) GetChatID() (value int64) { - if e == nil { - return - } - return e.ChatID -} - -// GetMessageID returns value of MessageID field. -func (e *EditMessageTextRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (e *EditMessageTextRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if e == nil { - return - } - return e.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (e *EditMessageTextRequest) GetInputMessageContent() (value InputMessageContentClass) { - if e == nil { - return - } - return e.InputMessageContent -} - -// EditMessageText invokes method editMessageText#bb2e1b7 returning error if any. -func (c *Client) EditMessageText(ctx context.Context, request *EditMessageTextRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_proxy_gen.go b/tdapi/tl_edit_proxy_gen.go deleted file mode 100644 index 7624536d5..000000000 --- a/tdapi/tl_edit_proxy_gen.go +++ /dev/null @@ -1,349 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditProxyRequest represents TL type `editProxy#a0482853`. -type EditProxyRequest struct { - // Proxy identifier - ProxyID int32 - // Proxy server domain or IP address - Server string - // Proxy server port - Port int32 - // Pass true to immediately enable the proxy - Enable bool - // Proxy type - Type ProxyTypeClass -} - -// EditProxyRequestTypeID is TL type id of EditProxyRequest. -const EditProxyRequestTypeID = 0xa0482853 - -// Ensuring interfaces in compile-time for EditProxyRequest. -var ( - _ bin.Encoder = &EditProxyRequest{} - _ bin.Decoder = &EditProxyRequest{} - _ bin.BareEncoder = &EditProxyRequest{} - _ bin.BareDecoder = &EditProxyRequest{} -) - -func (e *EditProxyRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ProxyID == 0) { - return false - } - if !(e.Server == "") { - return false - } - if !(e.Port == 0) { - return false - } - if !(e.Enable == false) { - return false - } - if !(e.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditProxyRequest) String() string { - if e == nil { - return "EditProxyRequest(nil)" - } - type Alias EditProxyRequest - return fmt.Sprintf("EditProxyRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditProxyRequest) TypeID() uint32 { - return EditProxyRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditProxyRequest) TypeName() string { - return "editProxy" -} - -// TypeInfo returns info about TL type. -func (e *EditProxyRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editProxy", - ID: EditProxyRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ProxyID", - SchemaName: "proxy_id", - }, - { - Name: "Server", - SchemaName: "server", - }, - { - Name: "Port", - SchemaName: "port", - }, - { - Name: "Enable", - SchemaName: "enable", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditProxyRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editProxy#a0482853 as nil") - } - b.PutID(EditProxyRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditProxyRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editProxy#a0482853 as nil") - } - b.PutInt32(e.ProxyID) - b.PutString(e.Server) - b.PutInt32(e.Port) - b.PutBool(e.Enable) - if e.Type == nil { - return fmt.Errorf("unable to encode editProxy#a0482853: field type is nil") - } - if err := e.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode editProxy#a0482853: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditProxyRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editProxy#a0482853 to nil") - } - if err := b.ConsumeID(EditProxyRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditProxyRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editProxy#a0482853 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: field proxy_id: %w", err) - } - e.ProxyID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: field server: %w", err) - } - e.Server = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: field port: %w", err) - } - e.Port = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: field enable: %w", err) - } - e.Enable = value - } - { - value, err := DecodeProxyType(b) - if err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: field type: %w", err) - } - e.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditProxyRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editProxy#a0482853 as nil") - } - b.ObjStart() - b.PutID("editProxy") - b.Comma() - b.FieldStart("proxy_id") - b.PutInt32(e.ProxyID) - b.Comma() - b.FieldStart("server") - b.PutString(e.Server) - b.Comma() - b.FieldStart("port") - b.PutInt32(e.Port) - b.Comma() - b.FieldStart("enable") - b.PutBool(e.Enable) - b.Comma() - b.FieldStart("type") - if e.Type == nil { - return fmt.Errorf("unable to encode editProxy#a0482853: field type is nil") - } - if err := e.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editProxy#a0482853: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditProxyRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editProxy#a0482853 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editProxy"); err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: %w", err) - } - case "proxy_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: field proxy_id: %w", err) - } - e.ProxyID = value - case "server": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: field server: %w", err) - } - e.Server = value - case "port": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: field port: %w", err) - } - e.Port = value - case "enable": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: field enable: %w", err) - } - e.Enable = value - case "type": - value, err := DecodeTDLibJSONProxyType(b) - if err != nil { - return fmt.Errorf("unable to decode editProxy#a0482853: field type: %w", err) - } - e.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProxyID returns value of ProxyID field. -func (e *EditProxyRequest) GetProxyID() (value int32) { - if e == nil { - return - } - return e.ProxyID -} - -// GetServer returns value of Server field. -func (e *EditProxyRequest) GetServer() (value string) { - if e == nil { - return - } - return e.Server -} - -// GetPort returns value of Port field. -func (e *EditProxyRequest) GetPort() (value int32) { - if e == nil { - return - } - return e.Port -} - -// GetEnable returns value of Enable field. -func (e *EditProxyRequest) GetEnable() (value bool) { - if e == nil { - return - } - return e.Enable -} - -// GetType returns value of Type field. -func (e *EditProxyRequest) GetType() (value ProxyTypeClass) { - if e == nil { - return - } - return e.Type -} - -// EditProxy invokes method editProxy#a0482853 returning error if any. -func (c *Client) EditProxy(ctx context.Context, request *EditProxyRequest) (*Proxy, error) { - var result Proxy - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_edit_quick_reply_message_gen.go b/tdapi/tl_edit_quick_reply_message_gen.go deleted file mode 100644 index 964940c3f..000000000 --- a/tdapi/tl_edit_quick_reply_message_gen.go +++ /dev/null @@ -1,283 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditQuickReplyMessageRequest represents TL type `editQuickReplyMessage#4cc978e`. -type EditQuickReplyMessageRequest struct { - // Unique identifier of the quick reply shortcut with the message - ShortcutID int32 - // Identifier of the message - MessageID int64 - // New content of the message. Must be one of the following types: inputMessageText, - // inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or - // inputMessageVideo - InputMessageContent InputMessageContentClass -} - -// EditQuickReplyMessageRequestTypeID is TL type id of EditQuickReplyMessageRequest. -const EditQuickReplyMessageRequestTypeID = 0x4cc978e - -// Ensuring interfaces in compile-time for EditQuickReplyMessageRequest. -var ( - _ bin.Encoder = &EditQuickReplyMessageRequest{} - _ bin.Decoder = &EditQuickReplyMessageRequest{} - _ bin.BareEncoder = &EditQuickReplyMessageRequest{} - _ bin.BareDecoder = &EditQuickReplyMessageRequest{} -) - -func (e *EditQuickReplyMessageRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ShortcutID == 0) { - return false - } - if !(e.MessageID == 0) { - return false - } - if !(e.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditQuickReplyMessageRequest) String() string { - if e == nil { - return "EditQuickReplyMessageRequest(nil)" - } - type Alias EditQuickReplyMessageRequest - return fmt.Sprintf("EditQuickReplyMessageRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditQuickReplyMessageRequest) TypeID() uint32 { - return EditQuickReplyMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditQuickReplyMessageRequest) TypeName() string { - return "editQuickReplyMessage" -} - -// TypeInfo returns info about TL type. -func (e *EditQuickReplyMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editQuickReplyMessage", - ID: EditQuickReplyMessageRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutID", - SchemaName: "shortcut_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditQuickReplyMessageRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editQuickReplyMessage#4cc978e as nil") - } - b.PutID(EditQuickReplyMessageRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditQuickReplyMessageRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editQuickReplyMessage#4cc978e as nil") - } - b.PutInt32(e.ShortcutID) - b.PutInt53(e.MessageID) - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editQuickReplyMessage#4cc978e: field input_message_content is nil") - } - if err := e.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode editQuickReplyMessage#4cc978e: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditQuickReplyMessageRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editQuickReplyMessage#4cc978e to nil") - } - if err := b.ConsumeID(EditQuickReplyMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditQuickReplyMessageRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editQuickReplyMessage#4cc978e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field shortcut_id: %w", err) - } - e.ShortcutID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field message_id: %w", err) - } - e.MessageID = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field input_message_content: %w", err) - } - e.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditQuickReplyMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editQuickReplyMessage#4cc978e as nil") - } - b.ObjStart() - b.PutID("editQuickReplyMessage") - b.Comma() - b.FieldStart("shortcut_id") - b.PutInt32(e.ShortcutID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(e.MessageID) - b.Comma() - b.FieldStart("input_message_content") - if e.InputMessageContent == nil { - return fmt.Errorf("unable to encode editQuickReplyMessage#4cc978e: field input_message_content is nil") - } - if err := e.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editQuickReplyMessage#4cc978e: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditQuickReplyMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editQuickReplyMessage#4cc978e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editQuickReplyMessage"); err != nil { - return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: %w", err) - } - case "shortcut_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field shortcut_id: %w", err) - } - e.ShortcutID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field message_id: %w", err) - } - e.MessageID = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode editQuickReplyMessage#4cc978e: field input_message_content: %w", err) - } - e.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutID returns value of ShortcutID field. -func (e *EditQuickReplyMessageRequest) GetShortcutID() (value int32) { - if e == nil { - return - } - return e.ShortcutID -} - -// GetMessageID returns value of MessageID field. -func (e *EditQuickReplyMessageRequest) GetMessageID() (value int64) { - if e == nil { - return - } - return e.MessageID -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (e *EditQuickReplyMessageRequest) GetInputMessageContent() (value InputMessageContentClass) { - if e == nil { - return - } - return e.InputMessageContent -} - -// EditQuickReplyMessage invokes method editQuickReplyMessage#4cc978e returning error if any. -func (c *Client) EditQuickReplyMessage(ctx context.Context, request *EditQuickReplyMessageRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_star_subscription_gen.go b/tdapi/tl_edit_star_subscription_gen.go deleted file mode 100644 index 00ba8dee0..000000000 --- a/tdapi/tl_edit_star_subscription_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditStarSubscriptionRequest represents TL type `editStarSubscription#7a1a3918`. -type EditStarSubscriptionRequest struct { - // Identifier of the subscription to change - SubscriptionID string - // New value of is_canceled - IsCanceled bool -} - -// EditStarSubscriptionRequestTypeID is TL type id of EditStarSubscriptionRequest. -const EditStarSubscriptionRequestTypeID = 0x7a1a3918 - -// Ensuring interfaces in compile-time for EditStarSubscriptionRequest. -var ( - _ bin.Encoder = &EditStarSubscriptionRequest{} - _ bin.Decoder = &EditStarSubscriptionRequest{} - _ bin.BareEncoder = &EditStarSubscriptionRequest{} - _ bin.BareDecoder = &EditStarSubscriptionRequest{} -) - -func (e *EditStarSubscriptionRequest) Zero() bool { - if e == nil { - return true - } - if !(e.SubscriptionID == "") { - return false - } - if !(e.IsCanceled == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditStarSubscriptionRequest) String() string { - if e == nil { - return "EditStarSubscriptionRequest(nil)" - } - type Alias EditStarSubscriptionRequest - return fmt.Sprintf("EditStarSubscriptionRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditStarSubscriptionRequest) TypeID() uint32 { - return EditStarSubscriptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditStarSubscriptionRequest) TypeName() string { - return "editStarSubscription" -} - -// TypeInfo returns info about TL type. -func (e *EditStarSubscriptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editStarSubscription", - ID: EditStarSubscriptionRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SubscriptionID", - SchemaName: "subscription_id", - }, - { - Name: "IsCanceled", - SchemaName: "is_canceled", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditStarSubscriptionRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editStarSubscription#7a1a3918 as nil") - } - b.PutID(EditStarSubscriptionRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditStarSubscriptionRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editStarSubscription#7a1a3918 as nil") - } - b.PutString(e.SubscriptionID) - b.PutBool(e.IsCanceled) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditStarSubscriptionRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editStarSubscription#7a1a3918 to nil") - } - if err := b.ConsumeID(EditStarSubscriptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editStarSubscription#7a1a3918: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditStarSubscriptionRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editStarSubscription#7a1a3918 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editStarSubscription#7a1a3918: field subscription_id: %w", err) - } - e.SubscriptionID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editStarSubscription#7a1a3918: field is_canceled: %w", err) - } - e.IsCanceled = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditStarSubscriptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editStarSubscription#7a1a3918 as nil") - } - b.ObjStart() - b.PutID("editStarSubscription") - b.Comma() - b.FieldStart("subscription_id") - b.PutString(e.SubscriptionID) - b.Comma() - b.FieldStart("is_canceled") - b.PutBool(e.IsCanceled) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditStarSubscriptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editStarSubscription#7a1a3918 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editStarSubscription"); err != nil { - return fmt.Errorf("unable to decode editStarSubscription#7a1a3918: %w", err) - } - case "subscription_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editStarSubscription#7a1a3918: field subscription_id: %w", err) - } - e.SubscriptionID = value - case "is_canceled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editStarSubscription#7a1a3918: field is_canceled: %w", err) - } - e.IsCanceled = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSubscriptionID returns value of SubscriptionID field. -func (e *EditStarSubscriptionRequest) GetSubscriptionID() (value string) { - if e == nil { - return - } - return e.SubscriptionID -} - -// GetIsCanceled returns value of IsCanceled field. -func (e *EditStarSubscriptionRequest) GetIsCanceled() (value bool) { - if e == nil { - return - } - return e.IsCanceled -} - -// EditStarSubscription invokes method editStarSubscription#7a1a3918 returning error if any. -func (c *Client) EditStarSubscription(ctx context.Context, request *EditStarSubscriptionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_story_cover_gen.go b/tdapi/tl_edit_story_cover_gen.go deleted file mode 100644 index c20278403..000000000 --- a/tdapi/tl_edit_story_cover_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditStoryCoverRequest represents TL type `editStoryCover#ab2a0c4b`. -type EditStoryCoverRequest struct { - // Identifier of the chat that posted the story - StorySenderChatID int64 - // Identifier of the story to edit - StoryID int32 - // New timestamp of the frame, which will be used as video thumbnail - CoverFrameTimestamp float64 -} - -// EditStoryCoverRequestTypeID is TL type id of EditStoryCoverRequest. -const EditStoryCoverRequestTypeID = 0xab2a0c4b - -// Ensuring interfaces in compile-time for EditStoryCoverRequest. -var ( - _ bin.Encoder = &EditStoryCoverRequest{} - _ bin.Decoder = &EditStoryCoverRequest{} - _ bin.BareEncoder = &EditStoryCoverRequest{} - _ bin.BareDecoder = &EditStoryCoverRequest{} -) - -func (e *EditStoryCoverRequest) Zero() bool { - if e == nil { - return true - } - if !(e.StorySenderChatID == 0) { - return false - } - if !(e.StoryID == 0) { - return false - } - if !(e.CoverFrameTimestamp == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditStoryCoverRequest) String() string { - if e == nil { - return "EditStoryCoverRequest(nil)" - } - type Alias EditStoryCoverRequest - return fmt.Sprintf("EditStoryCoverRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditStoryCoverRequest) TypeID() uint32 { - return EditStoryCoverRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditStoryCoverRequest) TypeName() string { - return "editStoryCover" -} - -// TypeInfo returns info about TL type. -func (e *EditStoryCoverRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editStoryCover", - ID: EditStoryCoverRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "CoverFrameTimestamp", - SchemaName: "cover_frame_timestamp", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditStoryCoverRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editStoryCover#ab2a0c4b as nil") - } - b.PutID(EditStoryCoverRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditStoryCoverRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editStoryCover#ab2a0c4b as nil") - } - b.PutInt53(e.StorySenderChatID) - b.PutInt32(e.StoryID) - b.PutDouble(e.CoverFrameTimestamp) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditStoryCoverRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editStoryCover#ab2a0c4b to nil") - } - if err := b.ConsumeID(EditStoryCoverRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditStoryCoverRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editStoryCover#ab2a0c4b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field story_sender_chat_id: %w", err) - } - e.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field story_id: %w", err) - } - e.StoryID = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field cover_frame_timestamp: %w", err) - } - e.CoverFrameTimestamp = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditStoryCoverRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editStoryCover#ab2a0c4b as nil") - } - b.ObjStart() - b.PutID("editStoryCover") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(e.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(e.StoryID) - b.Comma() - b.FieldStart("cover_frame_timestamp") - b.PutDouble(e.CoverFrameTimestamp) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditStoryCoverRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editStoryCover#ab2a0c4b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editStoryCover"); err != nil { - return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field story_sender_chat_id: %w", err) - } - e.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field story_id: %w", err) - } - e.StoryID = value - case "cover_frame_timestamp": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode editStoryCover#ab2a0c4b: field cover_frame_timestamp: %w", err) - } - e.CoverFrameTimestamp = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (e *EditStoryCoverRequest) GetStorySenderChatID() (value int64) { - if e == nil { - return - } - return e.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (e *EditStoryCoverRequest) GetStoryID() (value int32) { - if e == nil { - return - } - return e.StoryID -} - -// GetCoverFrameTimestamp returns value of CoverFrameTimestamp field. -func (e *EditStoryCoverRequest) GetCoverFrameTimestamp() (value float64) { - if e == nil { - return - } - return e.CoverFrameTimestamp -} - -// EditStoryCover invokes method editStoryCover#ab2a0c4b returning error if any. -func (c *Client) EditStoryCover(ctx context.Context, request *EditStoryCoverRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_story_gen.go b/tdapi/tl_edit_story_gen.go deleted file mode 100644 index 79bc3a4df..000000000 --- a/tdapi/tl_edit_story_gen.go +++ /dev/null @@ -1,350 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditStoryRequest represents TL type `editStory#5e6a21b1`. -type EditStoryRequest struct { - // Identifier of the chat that posted the story - StorySenderChatID int64 - // Identifier of the story to edit - StoryID int32 - // New content of the story; pass null to keep the current content - Content InputStoryContentClass - // New clickable rectangle areas to be shown on the story media; pass null to keep the - // current areas. Areas can't be edited if story content isn't changed - Areas InputStoryAreas - // New story caption; pass null to keep the current caption - Caption FormattedText -} - -// EditStoryRequestTypeID is TL type id of EditStoryRequest. -const EditStoryRequestTypeID = 0x5e6a21b1 - -// Ensuring interfaces in compile-time for EditStoryRequest. -var ( - _ bin.Encoder = &EditStoryRequest{} - _ bin.Decoder = &EditStoryRequest{} - _ bin.BareEncoder = &EditStoryRequest{} - _ bin.BareDecoder = &EditStoryRequest{} -) - -func (e *EditStoryRequest) Zero() bool { - if e == nil { - return true - } - if !(e.StorySenderChatID == 0) { - return false - } - if !(e.StoryID == 0) { - return false - } - if !(e.Content == nil) { - return false - } - if !(e.Areas.Zero()) { - return false - } - if !(e.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditStoryRequest) String() string { - if e == nil { - return "EditStoryRequest(nil)" - } - type Alias EditStoryRequest - return fmt.Sprintf("EditStoryRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditStoryRequest) TypeID() uint32 { - return EditStoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditStoryRequest) TypeName() string { - return "editStory" -} - -// TypeInfo returns info about TL type. -func (e *EditStoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editStory", - ID: EditStoryRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "Content", - SchemaName: "content", - }, - { - Name: "Areas", - SchemaName: "areas", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditStoryRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editStory#5e6a21b1 as nil") - } - b.PutID(EditStoryRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditStoryRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editStory#5e6a21b1 as nil") - } - b.PutInt53(e.StorySenderChatID) - b.PutInt32(e.StoryID) - if e.Content == nil { - return fmt.Errorf("unable to encode editStory#5e6a21b1: field content is nil") - } - if err := e.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode editStory#5e6a21b1: field content: %w", err) - } - if err := e.Areas.Encode(b); err != nil { - return fmt.Errorf("unable to encode editStory#5e6a21b1: field areas: %w", err) - } - if err := e.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode editStory#5e6a21b1: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EditStoryRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editStory#5e6a21b1 to nil") - } - if err := b.ConsumeID(EditStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditStoryRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editStory#5e6a21b1 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: field story_sender_chat_id: %w", err) - } - e.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: field story_id: %w", err) - } - e.StoryID = value - } - { - value, err := DecodeInputStoryContent(b) - if err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: field content: %w", err) - } - e.Content = value - } - { - if err := e.Areas.Decode(b); err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: field areas: %w", err) - } - } - { - if err := e.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editStory#5e6a21b1 as nil") - } - b.ObjStart() - b.PutID("editStory") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(e.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(e.StoryID) - b.Comma() - b.FieldStart("content") - if e.Content == nil { - return fmt.Errorf("unable to encode editStory#5e6a21b1: field content is nil") - } - if err := e.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editStory#5e6a21b1: field content: %w", err) - } - b.Comma() - b.FieldStart("areas") - if err := e.Areas.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editStory#5e6a21b1: field areas: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := e.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode editStory#5e6a21b1: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editStory#5e6a21b1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editStory"); err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: field story_sender_chat_id: %w", err) - } - e.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: field story_id: %w", err) - } - e.StoryID = value - case "content": - value, err := DecodeTDLibJSONInputStoryContent(b) - if err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: field content: %w", err) - } - e.Content = value - case "areas": - if err := e.Areas.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: field areas: %w", err) - } - case "caption": - if err := e.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode editStory#5e6a21b1: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (e *EditStoryRequest) GetStorySenderChatID() (value int64) { - if e == nil { - return - } - return e.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (e *EditStoryRequest) GetStoryID() (value int32) { - if e == nil { - return - } - return e.StoryID -} - -// GetContent returns value of Content field. -func (e *EditStoryRequest) GetContent() (value InputStoryContentClass) { - if e == nil { - return - } - return e.Content -} - -// GetAreas returns value of Areas field. -func (e *EditStoryRequest) GetAreas() (value InputStoryAreas) { - if e == nil { - return - } - return e.Areas -} - -// GetCaption returns value of Caption field. -func (e *EditStoryRequest) GetCaption() (value FormattedText) { - if e == nil { - return - } - return e.Caption -} - -// EditStory invokes method editStory#5e6a21b1 returning error if any. -func (c *Client) EditStory(ctx context.Context, request *EditStoryRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_edit_user_star_subscription_gen.go b/tdapi/tl_edit_user_star_subscription_gen.go deleted file mode 100644 index c4b2eb143..000000000 --- a/tdapi/tl_edit_user_star_subscription_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EditUserStarSubscriptionRequest represents TL type `editUserStarSubscription#51b16e89`. -type EditUserStarSubscriptionRequest struct { - // User identifier - UserID int64 - // Telegram payment identifier of the subscription - TelegramPaymentChargeID string - // Pass true to cancel the subscription; pass false to allow the user to enable it - IsCanceled bool -} - -// EditUserStarSubscriptionRequestTypeID is TL type id of EditUserStarSubscriptionRequest. -const EditUserStarSubscriptionRequestTypeID = 0x51b16e89 - -// Ensuring interfaces in compile-time for EditUserStarSubscriptionRequest. -var ( - _ bin.Encoder = &EditUserStarSubscriptionRequest{} - _ bin.Decoder = &EditUserStarSubscriptionRequest{} - _ bin.BareEncoder = &EditUserStarSubscriptionRequest{} - _ bin.BareDecoder = &EditUserStarSubscriptionRequest{} -) - -func (e *EditUserStarSubscriptionRequest) Zero() bool { - if e == nil { - return true - } - if !(e.UserID == 0) { - return false - } - if !(e.TelegramPaymentChargeID == "") { - return false - } - if !(e.IsCanceled == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EditUserStarSubscriptionRequest) String() string { - if e == nil { - return "EditUserStarSubscriptionRequest(nil)" - } - type Alias EditUserStarSubscriptionRequest - return fmt.Sprintf("EditUserStarSubscriptionRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EditUserStarSubscriptionRequest) TypeID() uint32 { - return EditUserStarSubscriptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EditUserStarSubscriptionRequest) TypeName() string { - return "editUserStarSubscription" -} - -// TypeInfo returns info about TL type. -func (e *EditUserStarSubscriptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "editUserStarSubscription", - ID: EditUserStarSubscriptionRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "TelegramPaymentChargeID", - SchemaName: "telegram_payment_charge_id", - }, - { - Name: "IsCanceled", - SchemaName: "is_canceled", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EditUserStarSubscriptionRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editUserStarSubscription#51b16e89 as nil") - } - b.PutID(EditUserStarSubscriptionRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EditUserStarSubscriptionRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode editUserStarSubscription#51b16e89 as nil") - } - b.PutInt53(e.UserID) - b.PutString(e.TelegramPaymentChargeID) - b.PutBool(e.IsCanceled) - return nil -} - -// Decode implements bin.Decoder. -func (e *EditUserStarSubscriptionRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editUserStarSubscription#51b16e89 to nil") - } - if err := b.ConsumeID(EditUserStarSubscriptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode editUserStarSubscription#51b16e89: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EditUserStarSubscriptionRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode editUserStarSubscription#51b16e89 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editUserStarSubscription#51b16e89: field user_id: %w", err) - } - e.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editUserStarSubscription#51b16e89: field telegram_payment_charge_id: %w", err) - } - e.TelegramPaymentChargeID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editUserStarSubscription#51b16e89: field is_canceled: %w", err) - } - e.IsCanceled = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EditUserStarSubscriptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode editUserStarSubscription#51b16e89 as nil") - } - b.ObjStart() - b.PutID("editUserStarSubscription") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(e.UserID) - b.Comma() - b.FieldStart("telegram_payment_charge_id") - b.PutString(e.TelegramPaymentChargeID) - b.Comma() - b.FieldStart("is_canceled") - b.PutBool(e.IsCanceled) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EditUserStarSubscriptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode editUserStarSubscription#51b16e89 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("editUserStarSubscription"); err != nil { - return fmt.Errorf("unable to decode editUserStarSubscription#51b16e89: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode editUserStarSubscription#51b16e89: field user_id: %w", err) - } - e.UserID = value - case "telegram_payment_charge_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode editUserStarSubscription#51b16e89: field telegram_payment_charge_id: %w", err) - } - e.TelegramPaymentChargeID = value - case "is_canceled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode editUserStarSubscription#51b16e89: field is_canceled: %w", err) - } - e.IsCanceled = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (e *EditUserStarSubscriptionRequest) GetUserID() (value int64) { - if e == nil { - return - } - return e.UserID -} - -// GetTelegramPaymentChargeID returns value of TelegramPaymentChargeID field. -func (e *EditUserStarSubscriptionRequest) GetTelegramPaymentChargeID() (value string) { - if e == nil { - return - } - return e.TelegramPaymentChargeID -} - -// GetIsCanceled returns value of IsCanceled field. -func (e *EditUserStarSubscriptionRequest) GetIsCanceled() (value bool) { - if e == nil { - return - } - return e.IsCanceled -} - -// EditUserStarSubscription invokes method editUserStarSubscription#51b16e89 returning error if any. -func (c *Client) EditUserStarSubscription(ctx context.Context, request *EditUserStarSubscriptionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_email_address_authentication_code_info_gen.go b/tdapi/tl_email_address_authentication_code_info_gen.go deleted file mode 100644 index 4147f9eb3..000000000 --- a/tdapi/tl_email_address_authentication_code_info_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmailAddressAuthenticationCodeInfo represents TL type `emailAddressAuthenticationCodeInfo#449be223`. -type EmailAddressAuthenticationCodeInfo struct { - // Pattern of the email address to which an authentication code was sent - EmailAddressPattern string - // Length of the code; 0 if unknown - Length int32 -} - -// EmailAddressAuthenticationCodeInfoTypeID is TL type id of EmailAddressAuthenticationCodeInfo. -const EmailAddressAuthenticationCodeInfoTypeID = 0x449be223 - -// Ensuring interfaces in compile-time for EmailAddressAuthenticationCodeInfo. -var ( - _ bin.Encoder = &EmailAddressAuthenticationCodeInfo{} - _ bin.Decoder = &EmailAddressAuthenticationCodeInfo{} - _ bin.BareEncoder = &EmailAddressAuthenticationCodeInfo{} - _ bin.BareDecoder = &EmailAddressAuthenticationCodeInfo{} -) - -func (e *EmailAddressAuthenticationCodeInfo) Zero() bool { - if e == nil { - return true - } - if !(e.EmailAddressPattern == "") { - return false - } - if !(e.Length == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmailAddressAuthenticationCodeInfo) String() string { - if e == nil { - return "EmailAddressAuthenticationCodeInfo(nil)" - } - type Alias EmailAddressAuthenticationCodeInfo - return fmt.Sprintf("EmailAddressAuthenticationCodeInfo%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmailAddressAuthenticationCodeInfo) TypeID() uint32 { - return EmailAddressAuthenticationCodeInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmailAddressAuthenticationCodeInfo) TypeName() string { - return "emailAddressAuthenticationCodeInfo" -} - -// TypeInfo returns info about TL type. -func (e *EmailAddressAuthenticationCodeInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emailAddressAuthenticationCodeInfo", - ID: EmailAddressAuthenticationCodeInfoTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "EmailAddressPattern", - SchemaName: "email_address_pattern", - }, - { - Name: "Length", - SchemaName: "length", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmailAddressAuthenticationCodeInfo) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationCodeInfo#449be223 as nil") - } - b.PutID(EmailAddressAuthenticationCodeInfoTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmailAddressAuthenticationCodeInfo) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationCodeInfo#449be223 as nil") - } - b.PutString(e.EmailAddressPattern) - b.PutInt32(e.Length) - return nil -} - -// Decode implements bin.Decoder. -func (e *EmailAddressAuthenticationCodeInfo) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationCodeInfo#449be223 to nil") - } - if err := b.ConsumeID(EmailAddressAuthenticationCodeInfoTypeID); err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationCodeInfo#449be223: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmailAddressAuthenticationCodeInfo) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationCodeInfo#449be223 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationCodeInfo#449be223: field email_address_pattern: %w", err) - } - e.EmailAddressPattern = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationCodeInfo#449be223: field length: %w", err) - } - e.Length = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmailAddressAuthenticationCodeInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationCodeInfo#449be223 as nil") - } - b.ObjStart() - b.PutID("emailAddressAuthenticationCodeInfo") - b.Comma() - b.FieldStart("email_address_pattern") - b.PutString(e.EmailAddressPattern) - b.Comma() - b.FieldStart("length") - b.PutInt32(e.Length) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmailAddressAuthenticationCodeInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationCodeInfo#449be223 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emailAddressAuthenticationCodeInfo"); err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationCodeInfo#449be223: %w", err) - } - case "email_address_pattern": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationCodeInfo#449be223: field email_address_pattern: %w", err) - } - e.EmailAddressPattern = value - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationCodeInfo#449be223: field length: %w", err) - } - e.Length = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEmailAddressPattern returns value of EmailAddressPattern field. -func (e *EmailAddressAuthenticationCodeInfo) GetEmailAddressPattern() (value string) { - if e == nil { - return - } - return e.EmailAddressPattern -} - -// GetLength returns value of Length field. -func (e *EmailAddressAuthenticationCodeInfo) GetLength() (value int32) { - if e == nil { - return - } - return e.Length -} diff --git a/tdapi/tl_email_address_authentication_gen.go b/tdapi/tl_email_address_authentication_gen.go deleted file mode 100644 index 343f2a8d9..000000000 --- a/tdapi/tl_email_address_authentication_gen.go +++ /dev/null @@ -1,682 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmailAddressAuthenticationCode represents TL type `emailAddressAuthenticationCode#c4cc19c2`. -type EmailAddressAuthenticationCode struct { - // The code - Code string -} - -// EmailAddressAuthenticationCodeTypeID is TL type id of EmailAddressAuthenticationCode. -const EmailAddressAuthenticationCodeTypeID = 0xc4cc19c2 - -// construct implements constructor of EmailAddressAuthenticationClass. -func (e EmailAddressAuthenticationCode) construct() EmailAddressAuthenticationClass { return &e } - -// Ensuring interfaces in compile-time for EmailAddressAuthenticationCode. -var ( - _ bin.Encoder = &EmailAddressAuthenticationCode{} - _ bin.Decoder = &EmailAddressAuthenticationCode{} - _ bin.BareEncoder = &EmailAddressAuthenticationCode{} - _ bin.BareDecoder = &EmailAddressAuthenticationCode{} - - _ EmailAddressAuthenticationClass = &EmailAddressAuthenticationCode{} -) - -func (e *EmailAddressAuthenticationCode) Zero() bool { - if e == nil { - return true - } - if !(e.Code == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmailAddressAuthenticationCode) String() string { - if e == nil { - return "EmailAddressAuthenticationCode(nil)" - } - type Alias EmailAddressAuthenticationCode - return fmt.Sprintf("EmailAddressAuthenticationCode%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmailAddressAuthenticationCode) TypeID() uint32 { - return EmailAddressAuthenticationCodeTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmailAddressAuthenticationCode) TypeName() string { - return "emailAddressAuthenticationCode" -} - -// TypeInfo returns info about TL type. -func (e *EmailAddressAuthenticationCode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emailAddressAuthenticationCode", - ID: EmailAddressAuthenticationCodeTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmailAddressAuthenticationCode) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationCode#c4cc19c2 as nil") - } - b.PutID(EmailAddressAuthenticationCodeTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmailAddressAuthenticationCode) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationCode#c4cc19c2 as nil") - } - b.PutString(e.Code) - return nil -} - -// Decode implements bin.Decoder. -func (e *EmailAddressAuthenticationCode) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationCode#c4cc19c2 to nil") - } - if err := b.ConsumeID(EmailAddressAuthenticationCodeTypeID); err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationCode#c4cc19c2: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmailAddressAuthenticationCode) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationCode#c4cc19c2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationCode#c4cc19c2: field code: %w", err) - } - e.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmailAddressAuthenticationCode) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationCode#c4cc19c2 as nil") - } - b.ObjStart() - b.PutID("emailAddressAuthenticationCode") - b.Comma() - b.FieldStart("code") - b.PutString(e.Code) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmailAddressAuthenticationCode) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationCode#c4cc19c2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emailAddressAuthenticationCode"); err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationCode#c4cc19c2: %w", err) - } - case "code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationCode#c4cc19c2: field code: %w", err) - } - e.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (e *EmailAddressAuthenticationCode) GetCode() (value string) { - if e == nil { - return - } - return e.Code -} - -// EmailAddressAuthenticationAppleID represents TL type `emailAddressAuthenticationAppleId#25c94869`. -type EmailAddressAuthenticationAppleID struct { - // The token - Token string -} - -// EmailAddressAuthenticationAppleIDTypeID is TL type id of EmailAddressAuthenticationAppleID. -const EmailAddressAuthenticationAppleIDTypeID = 0x25c94869 - -// construct implements constructor of EmailAddressAuthenticationClass. -func (e EmailAddressAuthenticationAppleID) construct() EmailAddressAuthenticationClass { return &e } - -// Ensuring interfaces in compile-time for EmailAddressAuthenticationAppleID. -var ( - _ bin.Encoder = &EmailAddressAuthenticationAppleID{} - _ bin.Decoder = &EmailAddressAuthenticationAppleID{} - _ bin.BareEncoder = &EmailAddressAuthenticationAppleID{} - _ bin.BareDecoder = &EmailAddressAuthenticationAppleID{} - - _ EmailAddressAuthenticationClass = &EmailAddressAuthenticationAppleID{} -) - -func (e *EmailAddressAuthenticationAppleID) Zero() bool { - if e == nil { - return true - } - if !(e.Token == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmailAddressAuthenticationAppleID) String() string { - if e == nil { - return "EmailAddressAuthenticationAppleID(nil)" - } - type Alias EmailAddressAuthenticationAppleID - return fmt.Sprintf("EmailAddressAuthenticationAppleID%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmailAddressAuthenticationAppleID) TypeID() uint32 { - return EmailAddressAuthenticationAppleIDTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmailAddressAuthenticationAppleID) TypeName() string { - return "emailAddressAuthenticationAppleId" -} - -// TypeInfo returns info about TL type. -func (e *EmailAddressAuthenticationAppleID) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emailAddressAuthenticationAppleId", - ID: EmailAddressAuthenticationAppleIDTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmailAddressAuthenticationAppleID) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationAppleId#25c94869 as nil") - } - b.PutID(EmailAddressAuthenticationAppleIDTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmailAddressAuthenticationAppleID) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationAppleId#25c94869 as nil") - } - b.PutString(e.Token) - return nil -} - -// Decode implements bin.Decoder. -func (e *EmailAddressAuthenticationAppleID) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationAppleId#25c94869 to nil") - } - if err := b.ConsumeID(EmailAddressAuthenticationAppleIDTypeID); err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationAppleId#25c94869: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmailAddressAuthenticationAppleID) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationAppleId#25c94869 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationAppleId#25c94869: field token: %w", err) - } - e.Token = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmailAddressAuthenticationAppleID) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationAppleId#25c94869 as nil") - } - b.ObjStart() - b.PutID("emailAddressAuthenticationAppleId") - b.Comma() - b.FieldStart("token") - b.PutString(e.Token) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmailAddressAuthenticationAppleID) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationAppleId#25c94869 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emailAddressAuthenticationAppleId"); err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationAppleId#25c94869: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationAppleId#25c94869: field token: %w", err) - } - e.Token = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (e *EmailAddressAuthenticationAppleID) GetToken() (value string) { - if e == nil { - return - } - return e.Token -} - -// EmailAddressAuthenticationGoogleID represents TL type `emailAddressAuthenticationGoogleId#fedbe742`. -type EmailAddressAuthenticationGoogleID struct { - // The token - Token string -} - -// EmailAddressAuthenticationGoogleIDTypeID is TL type id of EmailAddressAuthenticationGoogleID. -const EmailAddressAuthenticationGoogleIDTypeID = 0xfedbe742 - -// construct implements constructor of EmailAddressAuthenticationClass. -func (e EmailAddressAuthenticationGoogleID) construct() EmailAddressAuthenticationClass { return &e } - -// Ensuring interfaces in compile-time for EmailAddressAuthenticationGoogleID. -var ( - _ bin.Encoder = &EmailAddressAuthenticationGoogleID{} - _ bin.Decoder = &EmailAddressAuthenticationGoogleID{} - _ bin.BareEncoder = &EmailAddressAuthenticationGoogleID{} - _ bin.BareDecoder = &EmailAddressAuthenticationGoogleID{} - - _ EmailAddressAuthenticationClass = &EmailAddressAuthenticationGoogleID{} -) - -func (e *EmailAddressAuthenticationGoogleID) Zero() bool { - if e == nil { - return true - } - if !(e.Token == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmailAddressAuthenticationGoogleID) String() string { - if e == nil { - return "EmailAddressAuthenticationGoogleID(nil)" - } - type Alias EmailAddressAuthenticationGoogleID - return fmt.Sprintf("EmailAddressAuthenticationGoogleID%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmailAddressAuthenticationGoogleID) TypeID() uint32 { - return EmailAddressAuthenticationGoogleIDTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmailAddressAuthenticationGoogleID) TypeName() string { - return "emailAddressAuthenticationGoogleId" -} - -// TypeInfo returns info about TL type. -func (e *EmailAddressAuthenticationGoogleID) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emailAddressAuthenticationGoogleId", - ID: EmailAddressAuthenticationGoogleIDTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmailAddressAuthenticationGoogleID) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationGoogleId#fedbe742 as nil") - } - b.PutID(EmailAddressAuthenticationGoogleIDTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmailAddressAuthenticationGoogleID) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationGoogleId#fedbe742 as nil") - } - b.PutString(e.Token) - return nil -} - -// Decode implements bin.Decoder. -func (e *EmailAddressAuthenticationGoogleID) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationGoogleId#fedbe742 to nil") - } - if err := b.ConsumeID(EmailAddressAuthenticationGoogleIDTypeID); err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationGoogleId#fedbe742: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmailAddressAuthenticationGoogleID) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationGoogleId#fedbe742 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationGoogleId#fedbe742: field token: %w", err) - } - e.Token = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmailAddressAuthenticationGoogleID) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressAuthenticationGoogleId#fedbe742 as nil") - } - b.ObjStart() - b.PutID("emailAddressAuthenticationGoogleId") - b.Comma() - b.FieldStart("token") - b.PutString(e.Token) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmailAddressAuthenticationGoogleID) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressAuthenticationGoogleId#fedbe742 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emailAddressAuthenticationGoogleId"); err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationGoogleId#fedbe742: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emailAddressAuthenticationGoogleId#fedbe742: field token: %w", err) - } - e.Token = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (e *EmailAddressAuthenticationGoogleID) GetToken() (value string) { - if e == nil { - return - } - return e.Token -} - -// EmailAddressAuthenticationClassName is schema name of EmailAddressAuthenticationClass. -const EmailAddressAuthenticationClassName = "EmailAddressAuthentication" - -// EmailAddressAuthenticationClass represents EmailAddressAuthentication generic type. -// -// Example: -// -// g, err := tdapi.DecodeEmailAddressAuthentication(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.EmailAddressAuthenticationCode: // emailAddressAuthenticationCode#c4cc19c2 -// case *tdapi.EmailAddressAuthenticationAppleID: // emailAddressAuthenticationAppleId#25c94869 -// case *tdapi.EmailAddressAuthenticationGoogleID: // emailAddressAuthenticationGoogleId#fedbe742 -// default: panic(v) -// } -type EmailAddressAuthenticationClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() EmailAddressAuthenticationClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeEmailAddressAuthentication implements binary de-serialization for EmailAddressAuthenticationClass. -func DecodeEmailAddressAuthentication(buf *bin.Buffer) (EmailAddressAuthenticationClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case EmailAddressAuthenticationCodeTypeID: - // Decoding emailAddressAuthenticationCode#c4cc19c2. - v := EmailAddressAuthenticationCode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmailAddressAuthenticationClass: %w", err) - } - return &v, nil - case EmailAddressAuthenticationAppleIDTypeID: - // Decoding emailAddressAuthenticationAppleId#25c94869. - v := EmailAddressAuthenticationAppleID{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmailAddressAuthenticationClass: %w", err) - } - return &v, nil - case EmailAddressAuthenticationGoogleIDTypeID: - // Decoding emailAddressAuthenticationGoogleId#fedbe742. - v := EmailAddressAuthenticationGoogleID{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmailAddressAuthenticationClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode EmailAddressAuthenticationClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONEmailAddressAuthentication implements binary de-serialization for EmailAddressAuthenticationClass. -func DecodeTDLibJSONEmailAddressAuthentication(buf tdjson.Decoder) (EmailAddressAuthenticationClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "emailAddressAuthenticationCode": - // Decoding emailAddressAuthenticationCode#c4cc19c2. - v := EmailAddressAuthenticationCode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmailAddressAuthenticationClass: %w", err) - } - return &v, nil - case "emailAddressAuthenticationAppleId": - // Decoding emailAddressAuthenticationAppleId#25c94869. - v := EmailAddressAuthenticationAppleID{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmailAddressAuthenticationClass: %w", err) - } - return &v, nil - case "emailAddressAuthenticationGoogleId": - // Decoding emailAddressAuthenticationGoogleId#fedbe742. - v := EmailAddressAuthenticationGoogleID{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmailAddressAuthenticationClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode EmailAddressAuthenticationClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// EmailAddressAuthentication boxes the EmailAddressAuthenticationClass providing a helper. -type EmailAddressAuthenticationBox struct { - EmailAddressAuthentication EmailAddressAuthenticationClass -} - -// Decode implements bin.Decoder for EmailAddressAuthenticationBox. -func (b *EmailAddressAuthenticationBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode EmailAddressAuthenticationBox to nil") - } - v, err := DecodeEmailAddressAuthentication(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.EmailAddressAuthentication = v - return nil -} - -// Encode implements bin.Encode for EmailAddressAuthenticationBox. -func (b *EmailAddressAuthenticationBox) Encode(buf *bin.Buffer) error { - if b == nil || b.EmailAddressAuthentication == nil { - return fmt.Errorf("unable to encode EmailAddressAuthenticationClass as nil") - } - return b.EmailAddressAuthentication.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for EmailAddressAuthenticationBox. -func (b *EmailAddressAuthenticationBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode EmailAddressAuthenticationBox to nil") - } - v, err := DecodeTDLibJSONEmailAddressAuthentication(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.EmailAddressAuthentication = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for EmailAddressAuthenticationBox. -func (b *EmailAddressAuthenticationBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.EmailAddressAuthentication == nil { - return fmt.Errorf("unable to encode EmailAddressAuthenticationClass as nil") - } - return b.EmailAddressAuthentication.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_email_address_reset_state_gen.go b/tdapi/tl_email_address_reset_state_gen.go deleted file mode 100644 index 530875b09..000000000 --- a/tdapi/tl_email_address_reset_state_gen.go +++ /dev/null @@ -1,503 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmailAddressResetStateAvailable represents TL type `emailAddressResetStateAvailable#8dba3100`. -type EmailAddressResetStateAvailable struct { - // Time required to wait before the email address can be reset; 0 if the user is - // subscribed to Telegram Premium - WaitPeriod int32 -} - -// EmailAddressResetStateAvailableTypeID is TL type id of EmailAddressResetStateAvailable. -const EmailAddressResetStateAvailableTypeID = 0x8dba3100 - -// construct implements constructor of EmailAddressResetStateClass. -func (e EmailAddressResetStateAvailable) construct() EmailAddressResetStateClass { return &e } - -// Ensuring interfaces in compile-time for EmailAddressResetStateAvailable. -var ( - _ bin.Encoder = &EmailAddressResetStateAvailable{} - _ bin.Decoder = &EmailAddressResetStateAvailable{} - _ bin.BareEncoder = &EmailAddressResetStateAvailable{} - _ bin.BareDecoder = &EmailAddressResetStateAvailable{} - - _ EmailAddressResetStateClass = &EmailAddressResetStateAvailable{} -) - -func (e *EmailAddressResetStateAvailable) Zero() bool { - if e == nil { - return true - } - if !(e.WaitPeriod == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmailAddressResetStateAvailable) String() string { - if e == nil { - return "EmailAddressResetStateAvailable(nil)" - } - type Alias EmailAddressResetStateAvailable - return fmt.Sprintf("EmailAddressResetStateAvailable%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmailAddressResetStateAvailable) TypeID() uint32 { - return EmailAddressResetStateAvailableTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmailAddressResetStateAvailable) TypeName() string { - return "emailAddressResetStateAvailable" -} - -// TypeInfo returns info about TL type. -func (e *EmailAddressResetStateAvailable) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emailAddressResetStateAvailable", - ID: EmailAddressResetStateAvailableTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WaitPeriod", - SchemaName: "wait_period", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmailAddressResetStateAvailable) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressResetStateAvailable#8dba3100 as nil") - } - b.PutID(EmailAddressResetStateAvailableTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmailAddressResetStateAvailable) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressResetStateAvailable#8dba3100 as nil") - } - b.PutInt32(e.WaitPeriod) - return nil -} - -// Decode implements bin.Decoder. -func (e *EmailAddressResetStateAvailable) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressResetStateAvailable#8dba3100 to nil") - } - if err := b.ConsumeID(EmailAddressResetStateAvailableTypeID); err != nil { - return fmt.Errorf("unable to decode emailAddressResetStateAvailable#8dba3100: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmailAddressResetStateAvailable) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressResetStateAvailable#8dba3100 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode emailAddressResetStateAvailable#8dba3100: field wait_period: %w", err) - } - e.WaitPeriod = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmailAddressResetStateAvailable) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressResetStateAvailable#8dba3100 as nil") - } - b.ObjStart() - b.PutID("emailAddressResetStateAvailable") - b.Comma() - b.FieldStart("wait_period") - b.PutInt32(e.WaitPeriod) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmailAddressResetStateAvailable) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressResetStateAvailable#8dba3100 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emailAddressResetStateAvailable"); err != nil { - return fmt.Errorf("unable to decode emailAddressResetStateAvailable#8dba3100: %w", err) - } - case "wait_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode emailAddressResetStateAvailable#8dba3100: field wait_period: %w", err) - } - e.WaitPeriod = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWaitPeriod returns value of WaitPeriod field. -func (e *EmailAddressResetStateAvailable) GetWaitPeriod() (value int32) { - if e == nil { - return - } - return e.WaitPeriod -} - -// EmailAddressResetStatePending represents TL type `emailAddressResetStatePending#8f966e2b`. -type EmailAddressResetStatePending struct { - // Left time before the email address will be reset, in seconds. updateAuthorizationState - // is not sent when this field changes - ResetIn int32 -} - -// EmailAddressResetStatePendingTypeID is TL type id of EmailAddressResetStatePending. -const EmailAddressResetStatePendingTypeID = 0x8f966e2b - -// construct implements constructor of EmailAddressResetStateClass. -func (e EmailAddressResetStatePending) construct() EmailAddressResetStateClass { return &e } - -// Ensuring interfaces in compile-time for EmailAddressResetStatePending. -var ( - _ bin.Encoder = &EmailAddressResetStatePending{} - _ bin.Decoder = &EmailAddressResetStatePending{} - _ bin.BareEncoder = &EmailAddressResetStatePending{} - _ bin.BareDecoder = &EmailAddressResetStatePending{} - - _ EmailAddressResetStateClass = &EmailAddressResetStatePending{} -) - -func (e *EmailAddressResetStatePending) Zero() bool { - if e == nil { - return true - } - if !(e.ResetIn == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmailAddressResetStatePending) String() string { - if e == nil { - return "EmailAddressResetStatePending(nil)" - } - type Alias EmailAddressResetStatePending - return fmt.Sprintf("EmailAddressResetStatePending%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmailAddressResetStatePending) TypeID() uint32 { - return EmailAddressResetStatePendingTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmailAddressResetStatePending) TypeName() string { - return "emailAddressResetStatePending" -} - -// TypeInfo returns info about TL type. -func (e *EmailAddressResetStatePending) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emailAddressResetStatePending", - ID: EmailAddressResetStatePendingTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ResetIn", - SchemaName: "reset_in", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmailAddressResetStatePending) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressResetStatePending#8f966e2b as nil") - } - b.PutID(EmailAddressResetStatePendingTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmailAddressResetStatePending) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressResetStatePending#8f966e2b as nil") - } - b.PutInt32(e.ResetIn) - return nil -} - -// Decode implements bin.Decoder. -func (e *EmailAddressResetStatePending) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressResetStatePending#8f966e2b to nil") - } - if err := b.ConsumeID(EmailAddressResetStatePendingTypeID); err != nil { - return fmt.Errorf("unable to decode emailAddressResetStatePending#8f966e2b: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmailAddressResetStatePending) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressResetStatePending#8f966e2b to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode emailAddressResetStatePending#8f966e2b: field reset_in: %w", err) - } - e.ResetIn = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmailAddressResetStatePending) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emailAddressResetStatePending#8f966e2b as nil") - } - b.ObjStart() - b.PutID("emailAddressResetStatePending") - b.Comma() - b.FieldStart("reset_in") - b.PutInt32(e.ResetIn) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmailAddressResetStatePending) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emailAddressResetStatePending#8f966e2b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emailAddressResetStatePending"); err != nil { - return fmt.Errorf("unable to decode emailAddressResetStatePending#8f966e2b: %w", err) - } - case "reset_in": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode emailAddressResetStatePending#8f966e2b: field reset_in: %w", err) - } - e.ResetIn = value - default: - return b.Skip() - } - return nil - }) -} - -// GetResetIn returns value of ResetIn field. -func (e *EmailAddressResetStatePending) GetResetIn() (value int32) { - if e == nil { - return - } - return e.ResetIn -} - -// EmailAddressResetStateClassName is schema name of EmailAddressResetStateClass. -const EmailAddressResetStateClassName = "EmailAddressResetState" - -// EmailAddressResetStateClass represents EmailAddressResetState generic type. -// -// Example: -// -// g, err := tdapi.DecodeEmailAddressResetState(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.EmailAddressResetStateAvailable: // emailAddressResetStateAvailable#8dba3100 -// case *tdapi.EmailAddressResetStatePending: // emailAddressResetStatePending#8f966e2b -// default: panic(v) -// } -type EmailAddressResetStateClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() EmailAddressResetStateClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeEmailAddressResetState implements binary de-serialization for EmailAddressResetStateClass. -func DecodeEmailAddressResetState(buf *bin.Buffer) (EmailAddressResetStateClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case EmailAddressResetStateAvailableTypeID: - // Decoding emailAddressResetStateAvailable#8dba3100. - v := EmailAddressResetStateAvailable{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmailAddressResetStateClass: %w", err) - } - return &v, nil - case EmailAddressResetStatePendingTypeID: - // Decoding emailAddressResetStatePending#8f966e2b. - v := EmailAddressResetStatePending{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmailAddressResetStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode EmailAddressResetStateClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONEmailAddressResetState implements binary de-serialization for EmailAddressResetStateClass. -func DecodeTDLibJSONEmailAddressResetState(buf tdjson.Decoder) (EmailAddressResetStateClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "emailAddressResetStateAvailable": - // Decoding emailAddressResetStateAvailable#8dba3100. - v := EmailAddressResetStateAvailable{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmailAddressResetStateClass: %w", err) - } - return &v, nil - case "emailAddressResetStatePending": - // Decoding emailAddressResetStatePending#8f966e2b. - v := EmailAddressResetStatePending{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmailAddressResetStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode EmailAddressResetStateClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// EmailAddressResetState boxes the EmailAddressResetStateClass providing a helper. -type EmailAddressResetStateBox struct { - EmailAddressResetState EmailAddressResetStateClass -} - -// Decode implements bin.Decoder for EmailAddressResetStateBox. -func (b *EmailAddressResetStateBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode EmailAddressResetStateBox to nil") - } - v, err := DecodeEmailAddressResetState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.EmailAddressResetState = v - return nil -} - -// Encode implements bin.Encode for EmailAddressResetStateBox. -func (b *EmailAddressResetStateBox) Encode(buf *bin.Buffer) error { - if b == nil || b.EmailAddressResetState == nil { - return fmt.Errorf("unable to encode EmailAddressResetStateClass as nil") - } - return b.EmailAddressResetState.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for EmailAddressResetStateBox. -func (b *EmailAddressResetStateBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode EmailAddressResetStateBox to nil") - } - v, err := DecodeTDLibJSONEmailAddressResetState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.EmailAddressResetState = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for EmailAddressResetStateBox. -func (b *EmailAddressResetStateBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.EmailAddressResetState == nil { - return fmt.Errorf("unable to encode EmailAddressResetStateClass as nil") - } - return b.EmailAddressResetState.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_emoji_categories_gen.go b/tdapi/tl_emoji_categories_gen.go deleted file mode 100644 index b9e4b301d..000000000 --- a/tdapi/tl_emoji_categories_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmojiCategories represents TL type `emojiCategories#c680f27a`. -type EmojiCategories struct { - // List of categories - Categories []EmojiCategory -} - -// EmojiCategoriesTypeID is TL type id of EmojiCategories. -const EmojiCategoriesTypeID = 0xc680f27a - -// Ensuring interfaces in compile-time for EmojiCategories. -var ( - _ bin.Encoder = &EmojiCategories{} - _ bin.Decoder = &EmojiCategories{} - _ bin.BareEncoder = &EmojiCategories{} - _ bin.BareDecoder = &EmojiCategories{} -) - -func (e *EmojiCategories) Zero() bool { - if e == nil { - return true - } - if !(e.Categories == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiCategories) String() string { - if e == nil { - return "EmojiCategories(nil)" - } - type Alias EmojiCategories - return fmt.Sprintf("EmojiCategories%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiCategories) TypeID() uint32 { - return EmojiCategoriesTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiCategories) TypeName() string { - return "emojiCategories" -} - -// TypeInfo returns info about TL type. -func (e *EmojiCategories) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiCategories", - ID: EmojiCategoriesTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Categories", - SchemaName: "categories", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiCategories) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategories#c680f27a as nil") - } - b.PutID(EmojiCategoriesTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiCategories) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategories#c680f27a as nil") - } - b.PutInt(len(e.Categories)) - for idx, v := range e.Categories { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare emojiCategories#c680f27a: field categories element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiCategories) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategories#c680f27a to nil") - } - if err := b.ConsumeID(EmojiCategoriesTypeID); err != nil { - return fmt.Errorf("unable to decode emojiCategories#c680f27a: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiCategories) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategories#c680f27a to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode emojiCategories#c680f27a: field categories: %w", err) - } - - if headerLen > 0 { - e.Categories = make([]EmojiCategory, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value EmojiCategory - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare emojiCategories#c680f27a: field categories: %w", err) - } - e.Categories = append(e.Categories, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiCategories) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategories#c680f27a as nil") - } - b.ObjStart() - b.PutID("emojiCategories") - b.Comma() - b.FieldStart("categories") - b.ArrStart() - for idx, v := range e.Categories { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiCategories#c680f27a: field categories element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiCategories) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategories#c680f27a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiCategories"); err != nil { - return fmt.Errorf("unable to decode emojiCategories#c680f27a: %w", err) - } - case "categories": - if err := b.Arr(func(b tdjson.Decoder) error { - var value EmojiCategory - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode emojiCategories#c680f27a: field categories: %w", err) - } - e.Categories = append(e.Categories, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode emojiCategories#c680f27a: field categories: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCategories returns value of Categories field. -func (e *EmojiCategories) GetCategories() (value []EmojiCategory) { - if e == nil { - return - } - return e.Categories -} diff --git a/tdapi/tl_emoji_category_gen.go b/tdapi/tl_emoji_category_gen.go deleted file mode 100644 index 1ecdd3bbd..000000000 --- a/tdapi/tl_emoji_category_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmojiCategory represents TL type `emojiCategory#220de4ef`. -type EmojiCategory struct { - // Name of the category - Name string - // Custom emoji sticker, which represents icon of the category - Icon Sticker - // Source of stickers for the emoji category - Source EmojiCategorySourceClass - // True, if the category must be shown first when choosing a sticker for the start page - IsGreeting bool -} - -// EmojiCategoryTypeID is TL type id of EmojiCategory. -const EmojiCategoryTypeID = 0x220de4ef - -// Ensuring interfaces in compile-time for EmojiCategory. -var ( - _ bin.Encoder = &EmojiCategory{} - _ bin.Decoder = &EmojiCategory{} - _ bin.BareEncoder = &EmojiCategory{} - _ bin.BareDecoder = &EmojiCategory{} -) - -func (e *EmojiCategory) Zero() bool { - if e == nil { - return true - } - if !(e.Name == "") { - return false - } - if !(e.Icon.Zero()) { - return false - } - if !(e.Source == nil) { - return false - } - if !(e.IsGreeting == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiCategory) String() string { - if e == nil { - return "EmojiCategory(nil)" - } - type Alias EmojiCategory - return fmt.Sprintf("EmojiCategory%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiCategory) TypeID() uint32 { - return EmojiCategoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiCategory) TypeName() string { - return "emojiCategory" -} - -// TypeInfo returns info about TL type. -func (e *EmojiCategory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiCategory", - ID: EmojiCategoryTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Icon", - SchemaName: "icon", - }, - { - Name: "Source", - SchemaName: "source", - }, - { - Name: "IsGreeting", - SchemaName: "is_greeting", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiCategory) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategory#220de4ef as nil") - } - b.PutID(EmojiCategoryTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiCategory) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategory#220de4ef as nil") - } - b.PutString(e.Name) - if err := e.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode emojiCategory#220de4ef: field icon: %w", err) - } - if e.Source == nil { - return fmt.Errorf("unable to encode emojiCategory#220de4ef: field source is nil") - } - if err := e.Source.Encode(b); err != nil { - return fmt.Errorf("unable to encode emojiCategory#220de4ef: field source: %w", err) - } - b.PutBool(e.IsGreeting) - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiCategory) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategory#220de4ef to nil") - } - if err := b.ConsumeID(EmojiCategoryTypeID); err != nil { - return fmt.Errorf("unable to decode emojiCategory#220de4ef: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiCategory) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategory#220de4ef to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiCategory#220de4ef: field name: %w", err) - } - e.Name = value - } - { - if err := e.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode emojiCategory#220de4ef: field icon: %w", err) - } - } - { - value, err := DecodeEmojiCategorySource(b) - if err != nil { - return fmt.Errorf("unable to decode emojiCategory#220de4ef: field source: %w", err) - } - e.Source = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode emojiCategory#220de4ef: field is_greeting: %w", err) - } - e.IsGreeting = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiCategory) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategory#220de4ef as nil") - } - b.ObjStart() - b.PutID("emojiCategory") - b.Comma() - b.FieldStart("name") - b.PutString(e.Name) - b.Comma() - b.FieldStart("icon") - if err := e.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiCategory#220de4ef: field icon: %w", err) - } - b.Comma() - b.FieldStart("source") - if e.Source == nil { - return fmt.Errorf("unable to encode emojiCategory#220de4ef: field source is nil") - } - if err := e.Source.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiCategory#220de4ef: field source: %w", err) - } - b.Comma() - b.FieldStart("is_greeting") - b.PutBool(e.IsGreeting) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiCategory) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategory#220de4ef to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiCategory"); err != nil { - return fmt.Errorf("unable to decode emojiCategory#220de4ef: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiCategory#220de4ef: field name: %w", err) - } - e.Name = value - case "icon": - if err := e.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode emojiCategory#220de4ef: field icon: %w", err) - } - case "source": - value, err := DecodeTDLibJSONEmojiCategorySource(b) - if err != nil { - return fmt.Errorf("unable to decode emojiCategory#220de4ef: field source: %w", err) - } - e.Source = value - case "is_greeting": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode emojiCategory#220de4ef: field is_greeting: %w", err) - } - e.IsGreeting = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (e *EmojiCategory) GetName() (value string) { - if e == nil { - return - } - return e.Name -} - -// GetIcon returns value of Icon field. -func (e *EmojiCategory) GetIcon() (value Sticker) { - if e == nil { - return - } - return e.Icon -} - -// GetSource returns value of Source field. -func (e *EmojiCategory) GetSource() (value EmojiCategorySourceClass) { - if e == nil { - return - } - return e.Source -} - -// GetIsGreeting returns value of IsGreeting field. -func (e *EmojiCategory) GetIsGreeting() (value bool) { - if e == nil { - return - } - return e.IsGreeting -} diff --git a/tdapi/tl_emoji_category_source_gen.go b/tdapi/tl_emoji_category_source_gen.go deleted file mode 100644 index 23dcc5271..000000000 --- a/tdapi/tl_emoji_category_source_gen.go +++ /dev/null @@ -1,490 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmojiCategorySourceSearch represents TL type `emojiCategorySourceSearch#5e126d32`. -type EmojiCategorySourceSearch struct { - // List of emojis to search for - Emojis []string -} - -// EmojiCategorySourceSearchTypeID is TL type id of EmojiCategorySourceSearch. -const EmojiCategorySourceSearchTypeID = 0x5e126d32 - -// construct implements constructor of EmojiCategorySourceClass. -func (e EmojiCategorySourceSearch) construct() EmojiCategorySourceClass { return &e } - -// Ensuring interfaces in compile-time for EmojiCategorySourceSearch. -var ( - _ bin.Encoder = &EmojiCategorySourceSearch{} - _ bin.Decoder = &EmojiCategorySourceSearch{} - _ bin.BareEncoder = &EmojiCategorySourceSearch{} - _ bin.BareDecoder = &EmojiCategorySourceSearch{} - - _ EmojiCategorySourceClass = &EmojiCategorySourceSearch{} -) - -func (e *EmojiCategorySourceSearch) Zero() bool { - if e == nil { - return true - } - if !(e.Emojis == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiCategorySourceSearch) String() string { - if e == nil { - return "EmojiCategorySourceSearch(nil)" - } - type Alias EmojiCategorySourceSearch - return fmt.Sprintf("EmojiCategorySourceSearch%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiCategorySourceSearch) TypeID() uint32 { - return EmojiCategorySourceSearchTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiCategorySourceSearch) TypeName() string { - return "emojiCategorySourceSearch" -} - -// TypeInfo returns info about TL type. -func (e *EmojiCategorySourceSearch) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiCategorySourceSearch", - ID: EmojiCategorySourceSearchTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Emojis", - SchemaName: "emojis", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiCategorySourceSearch) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategorySourceSearch#5e126d32 as nil") - } - b.PutID(EmojiCategorySourceSearchTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiCategorySourceSearch) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategorySourceSearch#5e126d32 as nil") - } - b.PutInt(len(e.Emojis)) - for _, v := range e.Emojis { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiCategorySourceSearch) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategorySourceSearch#5e126d32 to nil") - } - if err := b.ConsumeID(EmojiCategorySourceSearchTypeID); err != nil { - return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiCategorySourceSearch) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategorySourceSearch#5e126d32 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: field emojis: %w", err) - } - - if headerLen > 0 { - e.Emojis = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: field emojis: %w", err) - } - e.Emojis = append(e.Emojis, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiCategorySourceSearch) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategorySourceSearch#5e126d32 as nil") - } - b.ObjStart() - b.PutID("emojiCategorySourceSearch") - b.Comma() - b.FieldStart("emojis") - b.ArrStart() - for _, v := range e.Emojis { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiCategorySourceSearch) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategorySourceSearch#5e126d32 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiCategorySourceSearch"); err != nil { - return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: %w", err) - } - case "emojis": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: field emojis: %w", err) - } - e.Emojis = append(e.Emojis, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode emojiCategorySourceSearch#5e126d32: field emojis: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetEmojis returns value of Emojis field. -func (e *EmojiCategorySourceSearch) GetEmojis() (value []string) { - if e == nil { - return - } - return e.Emojis -} - -// EmojiCategorySourcePremium represents TL type `emojiCategorySourcePremium#8cd28d0c`. -type EmojiCategorySourcePremium struct { -} - -// EmojiCategorySourcePremiumTypeID is TL type id of EmojiCategorySourcePremium. -const EmojiCategorySourcePremiumTypeID = 0x8cd28d0c - -// construct implements constructor of EmojiCategorySourceClass. -func (e EmojiCategorySourcePremium) construct() EmojiCategorySourceClass { return &e } - -// Ensuring interfaces in compile-time for EmojiCategorySourcePremium. -var ( - _ bin.Encoder = &EmojiCategorySourcePremium{} - _ bin.Decoder = &EmojiCategorySourcePremium{} - _ bin.BareEncoder = &EmojiCategorySourcePremium{} - _ bin.BareDecoder = &EmojiCategorySourcePremium{} - - _ EmojiCategorySourceClass = &EmojiCategorySourcePremium{} -) - -func (e *EmojiCategorySourcePremium) Zero() bool { - if e == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiCategorySourcePremium) String() string { - if e == nil { - return "EmojiCategorySourcePremium(nil)" - } - type Alias EmojiCategorySourcePremium - return fmt.Sprintf("EmojiCategorySourcePremium%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiCategorySourcePremium) TypeID() uint32 { - return EmojiCategorySourcePremiumTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiCategorySourcePremium) TypeName() string { - return "emojiCategorySourcePremium" -} - -// TypeInfo returns info about TL type. -func (e *EmojiCategorySourcePremium) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiCategorySourcePremium", - ID: EmojiCategorySourcePremiumTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiCategorySourcePremium) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategorySourcePremium#8cd28d0c as nil") - } - b.PutID(EmojiCategorySourcePremiumTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiCategorySourcePremium) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategorySourcePremium#8cd28d0c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiCategorySourcePremium) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategorySourcePremium#8cd28d0c to nil") - } - if err := b.ConsumeID(EmojiCategorySourcePremiumTypeID); err != nil { - return fmt.Errorf("unable to decode emojiCategorySourcePremium#8cd28d0c: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiCategorySourcePremium) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategorySourcePremium#8cd28d0c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiCategorySourcePremium) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategorySourcePremium#8cd28d0c as nil") - } - b.ObjStart() - b.PutID("emojiCategorySourcePremium") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiCategorySourcePremium) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategorySourcePremium#8cd28d0c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiCategorySourcePremium"); err != nil { - return fmt.Errorf("unable to decode emojiCategorySourcePremium#8cd28d0c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// EmojiCategorySourceClassName is schema name of EmojiCategorySourceClass. -const EmojiCategorySourceClassName = "EmojiCategorySource" - -// EmojiCategorySourceClass represents EmojiCategorySource generic type. -// -// Example: -// -// g, err := tdapi.DecodeEmojiCategorySource(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.EmojiCategorySourceSearch: // emojiCategorySourceSearch#5e126d32 -// case *tdapi.EmojiCategorySourcePremium: // emojiCategorySourcePremium#8cd28d0c -// default: panic(v) -// } -type EmojiCategorySourceClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() EmojiCategorySourceClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeEmojiCategorySource implements binary de-serialization for EmojiCategorySourceClass. -func DecodeEmojiCategorySource(buf *bin.Buffer) (EmojiCategorySourceClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case EmojiCategorySourceSearchTypeID: - // Decoding emojiCategorySourceSearch#5e126d32. - v := EmojiCategorySourceSearch{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", err) - } - return &v, nil - case EmojiCategorySourcePremiumTypeID: - // Decoding emojiCategorySourcePremium#8cd28d0c. - v := EmojiCategorySourcePremium{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONEmojiCategorySource implements binary de-serialization for EmojiCategorySourceClass. -func DecodeTDLibJSONEmojiCategorySource(buf tdjson.Decoder) (EmojiCategorySourceClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "emojiCategorySourceSearch": - // Decoding emojiCategorySourceSearch#5e126d32. - v := EmojiCategorySourceSearch{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", err) - } - return &v, nil - case "emojiCategorySourcePremium": - // Decoding emojiCategorySourcePremium#8cd28d0c. - v := EmojiCategorySourcePremium{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode EmojiCategorySourceClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// EmojiCategorySource boxes the EmojiCategorySourceClass providing a helper. -type EmojiCategorySourceBox struct { - EmojiCategorySource EmojiCategorySourceClass -} - -// Decode implements bin.Decoder for EmojiCategorySourceBox. -func (b *EmojiCategorySourceBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode EmojiCategorySourceBox to nil") - } - v, err := DecodeEmojiCategorySource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.EmojiCategorySource = v - return nil -} - -// Encode implements bin.Encode for EmojiCategorySourceBox. -func (b *EmojiCategorySourceBox) Encode(buf *bin.Buffer) error { - if b == nil || b.EmojiCategorySource == nil { - return fmt.Errorf("unable to encode EmojiCategorySourceClass as nil") - } - return b.EmojiCategorySource.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for EmojiCategorySourceBox. -func (b *EmojiCategorySourceBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode EmojiCategorySourceBox to nil") - } - v, err := DecodeTDLibJSONEmojiCategorySource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.EmojiCategorySource = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for EmojiCategorySourceBox. -func (b *EmojiCategorySourceBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.EmojiCategorySource == nil { - return fmt.Errorf("unable to encode EmojiCategorySourceClass as nil") - } - return b.EmojiCategorySource.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_emoji_category_type_gen.go b/tdapi/tl_emoji_category_type_gen.go deleted file mode 100644 index 2510c6ce8..000000000 --- a/tdapi/tl_emoji_category_type_gen.go +++ /dev/null @@ -1,723 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmojiCategoryTypeDefault represents TL type `emojiCategoryTypeDefault#46db626b`. -type EmojiCategoryTypeDefault struct { -} - -// EmojiCategoryTypeDefaultTypeID is TL type id of EmojiCategoryTypeDefault. -const EmojiCategoryTypeDefaultTypeID = 0x46db626b - -// construct implements constructor of EmojiCategoryTypeClass. -func (e EmojiCategoryTypeDefault) construct() EmojiCategoryTypeClass { return &e } - -// Ensuring interfaces in compile-time for EmojiCategoryTypeDefault. -var ( - _ bin.Encoder = &EmojiCategoryTypeDefault{} - _ bin.Decoder = &EmojiCategoryTypeDefault{} - _ bin.BareEncoder = &EmojiCategoryTypeDefault{} - _ bin.BareDecoder = &EmojiCategoryTypeDefault{} - - _ EmojiCategoryTypeClass = &EmojiCategoryTypeDefault{} -) - -func (e *EmojiCategoryTypeDefault) Zero() bool { - if e == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiCategoryTypeDefault) String() string { - if e == nil { - return "EmojiCategoryTypeDefault(nil)" - } - type Alias EmojiCategoryTypeDefault - return fmt.Sprintf("EmojiCategoryTypeDefault%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiCategoryTypeDefault) TypeID() uint32 { - return EmojiCategoryTypeDefaultTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiCategoryTypeDefault) TypeName() string { - return "emojiCategoryTypeDefault" -} - -// TypeInfo returns info about TL type. -func (e *EmojiCategoryTypeDefault) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiCategoryTypeDefault", - ID: EmojiCategoryTypeDefaultTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiCategoryTypeDefault) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeDefault#46db626b as nil") - } - b.PutID(EmojiCategoryTypeDefaultTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiCategoryTypeDefault) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeDefault#46db626b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiCategoryTypeDefault) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeDefault#46db626b to nil") - } - if err := b.ConsumeID(EmojiCategoryTypeDefaultTypeID); err != nil { - return fmt.Errorf("unable to decode emojiCategoryTypeDefault#46db626b: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiCategoryTypeDefault) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeDefault#46db626b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiCategoryTypeDefault) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeDefault#46db626b as nil") - } - b.ObjStart() - b.PutID("emojiCategoryTypeDefault") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiCategoryTypeDefault) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeDefault#46db626b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiCategoryTypeDefault"); err != nil { - return fmt.Errorf("unable to decode emojiCategoryTypeDefault#46db626b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// EmojiCategoryTypeRegularStickers represents TL type `emojiCategoryTypeRegularStickers#b04799d2`. -type EmojiCategoryTypeRegularStickers struct { -} - -// EmojiCategoryTypeRegularStickersTypeID is TL type id of EmojiCategoryTypeRegularStickers. -const EmojiCategoryTypeRegularStickersTypeID = 0xb04799d2 - -// construct implements constructor of EmojiCategoryTypeClass. -func (e EmojiCategoryTypeRegularStickers) construct() EmojiCategoryTypeClass { return &e } - -// Ensuring interfaces in compile-time for EmojiCategoryTypeRegularStickers. -var ( - _ bin.Encoder = &EmojiCategoryTypeRegularStickers{} - _ bin.Decoder = &EmojiCategoryTypeRegularStickers{} - _ bin.BareEncoder = &EmojiCategoryTypeRegularStickers{} - _ bin.BareDecoder = &EmojiCategoryTypeRegularStickers{} - - _ EmojiCategoryTypeClass = &EmojiCategoryTypeRegularStickers{} -) - -func (e *EmojiCategoryTypeRegularStickers) Zero() bool { - if e == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiCategoryTypeRegularStickers) String() string { - if e == nil { - return "EmojiCategoryTypeRegularStickers(nil)" - } - type Alias EmojiCategoryTypeRegularStickers - return fmt.Sprintf("EmojiCategoryTypeRegularStickers%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiCategoryTypeRegularStickers) TypeID() uint32 { - return EmojiCategoryTypeRegularStickersTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiCategoryTypeRegularStickers) TypeName() string { - return "emojiCategoryTypeRegularStickers" -} - -// TypeInfo returns info about TL type. -func (e *EmojiCategoryTypeRegularStickers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiCategoryTypeRegularStickers", - ID: EmojiCategoryTypeRegularStickersTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiCategoryTypeRegularStickers) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeRegularStickers#b04799d2 as nil") - } - b.PutID(EmojiCategoryTypeRegularStickersTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiCategoryTypeRegularStickers) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeRegularStickers#b04799d2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiCategoryTypeRegularStickers) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeRegularStickers#b04799d2 to nil") - } - if err := b.ConsumeID(EmojiCategoryTypeRegularStickersTypeID); err != nil { - return fmt.Errorf("unable to decode emojiCategoryTypeRegularStickers#b04799d2: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiCategoryTypeRegularStickers) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeRegularStickers#b04799d2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiCategoryTypeRegularStickers) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeRegularStickers#b04799d2 as nil") - } - b.ObjStart() - b.PutID("emojiCategoryTypeRegularStickers") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiCategoryTypeRegularStickers) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeRegularStickers#b04799d2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiCategoryTypeRegularStickers"); err != nil { - return fmt.Errorf("unable to decode emojiCategoryTypeRegularStickers#b04799d2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// EmojiCategoryTypeEmojiStatus represents TL type `emojiCategoryTypeEmojiStatus#5254b347`. -type EmojiCategoryTypeEmojiStatus struct { -} - -// EmojiCategoryTypeEmojiStatusTypeID is TL type id of EmojiCategoryTypeEmojiStatus. -const EmojiCategoryTypeEmojiStatusTypeID = 0x5254b347 - -// construct implements constructor of EmojiCategoryTypeClass. -func (e EmojiCategoryTypeEmojiStatus) construct() EmojiCategoryTypeClass { return &e } - -// Ensuring interfaces in compile-time for EmojiCategoryTypeEmojiStatus. -var ( - _ bin.Encoder = &EmojiCategoryTypeEmojiStatus{} - _ bin.Decoder = &EmojiCategoryTypeEmojiStatus{} - _ bin.BareEncoder = &EmojiCategoryTypeEmojiStatus{} - _ bin.BareDecoder = &EmojiCategoryTypeEmojiStatus{} - - _ EmojiCategoryTypeClass = &EmojiCategoryTypeEmojiStatus{} -) - -func (e *EmojiCategoryTypeEmojiStatus) Zero() bool { - if e == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiCategoryTypeEmojiStatus) String() string { - if e == nil { - return "EmojiCategoryTypeEmojiStatus(nil)" - } - type Alias EmojiCategoryTypeEmojiStatus - return fmt.Sprintf("EmojiCategoryTypeEmojiStatus%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiCategoryTypeEmojiStatus) TypeID() uint32 { - return EmojiCategoryTypeEmojiStatusTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiCategoryTypeEmojiStatus) TypeName() string { - return "emojiCategoryTypeEmojiStatus" -} - -// TypeInfo returns info about TL type. -func (e *EmojiCategoryTypeEmojiStatus) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiCategoryTypeEmojiStatus", - ID: EmojiCategoryTypeEmojiStatusTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiCategoryTypeEmojiStatus) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeEmojiStatus#5254b347 as nil") - } - b.PutID(EmojiCategoryTypeEmojiStatusTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiCategoryTypeEmojiStatus) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeEmojiStatus#5254b347 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiCategoryTypeEmojiStatus) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeEmojiStatus#5254b347 to nil") - } - if err := b.ConsumeID(EmojiCategoryTypeEmojiStatusTypeID); err != nil { - return fmt.Errorf("unable to decode emojiCategoryTypeEmojiStatus#5254b347: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiCategoryTypeEmojiStatus) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeEmojiStatus#5254b347 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiCategoryTypeEmojiStatus) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeEmojiStatus#5254b347 as nil") - } - b.ObjStart() - b.PutID("emojiCategoryTypeEmojiStatus") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiCategoryTypeEmojiStatus) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeEmojiStatus#5254b347 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiCategoryTypeEmojiStatus"); err != nil { - return fmt.Errorf("unable to decode emojiCategoryTypeEmojiStatus#5254b347: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// EmojiCategoryTypeChatPhoto represents TL type `emojiCategoryTypeChatPhoto#3f200529`. -type EmojiCategoryTypeChatPhoto struct { -} - -// EmojiCategoryTypeChatPhotoTypeID is TL type id of EmojiCategoryTypeChatPhoto. -const EmojiCategoryTypeChatPhotoTypeID = 0x3f200529 - -// construct implements constructor of EmojiCategoryTypeClass. -func (e EmojiCategoryTypeChatPhoto) construct() EmojiCategoryTypeClass { return &e } - -// Ensuring interfaces in compile-time for EmojiCategoryTypeChatPhoto. -var ( - _ bin.Encoder = &EmojiCategoryTypeChatPhoto{} - _ bin.Decoder = &EmojiCategoryTypeChatPhoto{} - _ bin.BareEncoder = &EmojiCategoryTypeChatPhoto{} - _ bin.BareDecoder = &EmojiCategoryTypeChatPhoto{} - - _ EmojiCategoryTypeClass = &EmojiCategoryTypeChatPhoto{} -) - -func (e *EmojiCategoryTypeChatPhoto) Zero() bool { - if e == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiCategoryTypeChatPhoto) String() string { - if e == nil { - return "EmojiCategoryTypeChatPhoto(nil)" - } - type Alias EmojiCategoryTypeChatPhoto - return fmt.Sprintf("EmojiCategoryTypeChatPhoto%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiCategoryTypeChatPhoto) TypeID() uint32 { - return EmojiCategoryTypeChatPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiCategoryTypeChatPhoto) TypeName() string { - return "emojiCategoryTypeChatPhoto" -} - -// TypeInfo returns info about TL type. -func (e *EmojiCategoryTypeChatPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiCategoryTypeChatPhoto", - ID: EmojiCategoryTypeChatPhotoTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiCategoryTypeChatPhoto) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeChatPhoto#3f200529 as nil") - } - b.PutID(EmojiCategoryTypeChatPhotoTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiCategoryTypeChatPhoto) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeChatPhoto#3f200529 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiCategoryTypeChatPhoto) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeChatPhoto#3f200529 to nil") - } - if err := b.ConsumeID(EmojiCategoryTypeChatPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode emojiCategoryTypeChatPhoto#3f200529: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiCategoryTypeChatPhoto) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeChatPhoto#3f200529 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiCategoryTypeChatPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiCategoryTypeChatPhoto#3f200529 as nil") - } - b.ObjStart() - b.PutID("emojiCategoryTypeChatPhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiCategoryTypeChatPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiCategoryTypeChatPhoto#3f200529 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiCategoryTypeChatPhoto"); err != nil { - return fmt.Errorf("unable to decode emojiCategoryTypeChatPhoto#3f200529: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// EmojiCategoryTypeClassName is schema name of EmojiCategoryTypeClass. -const EmojiCategoryTypeClassName = "EmojiCategoryType" - -// EmojiCategoryTypeClass represents EmojiCategoryType generic type. -// -// Example: -// -// g, err := tdapi.DecodeEmojiCategoryType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.EmojiCategoryTypeDefault: // emojiCategoryTypeDefault#46db626b -// case *tdapi.EmojiCategoryTypeRegularStickers: // emojiCategoryTypeRegularStickers#b04799d2 -// case *tdapi.EmojiCategoryTypeEmojiStatus: // emojiCategoryTypeEmojiStatus#5254b347 -// case *tdapi.EmojiCategoryTypeChatPhoto: // emojiCategoryTypeChatPhoto#3f200529 -// default: panic(v) -// } -type EmojiCategoryTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() EmojiCategoryTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeEmojiCategoryType implements binary de-serialization for EmojiCategoryTypeClass. -func DecodeEmojiCategoryType(buf *bin.Buffer) (EmojiCategoryTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case EmojiCategoryTypeDefaultTypeID: - // Decoding emojiCategoryTypeDefault#46db626b. - v := EmojiCategoryTypeDefault{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) - } - return &v, nil - case EmojiCategoryTypeRegularStickersTypeID: - // Decoding emojiCategoryTypeRegularStickers#b04799d2. - v := EmojiCategoryTypeRegularStickers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) - } - return &v, nil - case EmojiCategoryTypeEmojiStatusTypeID: - // Decoding emojiCategoryTypeEmojiStatus#5254b347. - v := EmojiCategoryTypeEmojiStatus{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) - } - return &v, nil - case EmojiCategoryTypeChatPhotoTypeID: - // Decoding emojiCategoryTypeChatPhoto#3f200529. - v := EmojiCategoryTypeChatPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONEmojiCategoryType implements binary de-serialization for EmojiCategoryTypeClass. -func DecodeTDLibJSONEmojiCategoryType(buf tdjson.Decoder) (EmojiCategoryTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "emojiCategoryTypeDefault": - // Decoding emojiCategoryTypeDefault#46db626b. - v := EmojiCategoryTypeDefault{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) - } - return &v, nil - case "emojiCategoryTypeRegularStickers": - // Decoding emojiCategoryTypeRegularStickers#b04799d2. - v := EmojiCategoryTypeRegularStickers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) - } - return &v, nil - case "emojiCategoryTypeEmojiStatus": - // Decoding emojiCategoryTypeEmojiStatus#5254b347. - v := EmojiCategoryTypeEmojiStatus{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) - } - return &v, nil - case "emojiCategoryTypeChatPhoto": - // Decoding emojiCategoryTypeChatPhoto#3f200529. - v := EmojiCategoryTypeChatPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode EmojiCategoryTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// EmojiCategoryType boxes the EmojiCategoryTypeClass providing a helper. -type EmojiCategoryTypeBox struct { - EmojiCategoryType EmojiCategoryTypeClass -} - -// Decode implements bin.Decoder for EmojiCategoryTypeBox. -func (b *EmojiCategoryTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode EmojiCategoryTypeBox to nil") - } - v, err := DecodeEmojiCategoryType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.EmojiCategoryType = v - return nil -} - -// Encode implements bin.Encode for EmojiCategoryTypeBox. -func (b *EmojiCategoryTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.EmojiCategoryType == nil { - return fmt.Errorf("unable to encode EmojiCategoryTypeClass as nil") - } - return b.EmojiCategoryType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for EmojiCategoryTypeBox. -func (b *EmojiCategoryTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode EmojiCategoryTypeBox to nil") - } - v, err := DecodeTDLibJSONEmojiCategoryType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.EmojiCategoryType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for EmojiCategoryTypeBox. -func (b *EmojiCategoryTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.EmojiCategoryType == nil { - return fmt.Errorf("unable to encode EmojiCategoryTypeClass as nil") - } - return b.EmojiCategoryType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_emoji_keyword_gen.go b/tdapi/tl_emoji_keyword_gen.go deleted file mode 100644 index 2f3cbcc5f..000000000 --- a/tdapi/tl_emoji_keyword_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmojiKeyword represents TL type `emojiKeyword#821912df`. -type EmojiKeyword struct { - // The emoji - Emoji string - // The keyword - Keyword string -} - -// EmojiKeywordTypeID is TL type id of EmojiKeyword. -const EmojiKeywordTypeID = 0x821912df - -// Ensuring interfaces in compile-time for EmojiKeyword. -var ( - _ bin.Encoder = &EmojiKeyword{} - _ bin.Decoder = &EmojiKeyword{} - _ bin.BareEncoder = &EmojiKeyword{} - _ bin.BareDecoder = &EmojiKeyword{} -) - -func (e *EmojiKeyword) Zero() bool { - if e == nil { - return true - } - if !(e.Emoji == "") { - return false - } - if !(e.Keyword == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiKeyword) String() string { - if e == nil { - return "EmojiKeyword(nil)" - } - type Alias EmojiKeyword - return fmt.Sprintf("EmojiKeyword%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiKeyword) TypeID() uint32 { - return EmojiKeywordTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiKeyword) TypeName() string { - return "emojiKeyword" -} - -// TypeInfo returns info about TL type. -func (e *EmojiKeyword) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiKeyword", - ID: EmojiKeywordTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Emoji", - SchemaName: "emoji", - }, - { - Name: "Keyword", - SchemaName: "keyword", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiKeyword) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiKeyword#821912df as nil") - } - b.PutID(EmojiKeywordTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiKeyword) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiKeyword#821912df as nil") - } - b.PutString(e.Emoji) - b.PutString(e.Keyword) - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiKeyword) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiKeyword#821912df to nil") - } - if err := b.ConsumeID(EmojiKeywordTypeID); err != nil { - return fmt.Errorf("unable to decode emojiKeyword#821912df: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiKeyword) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiKeyword#821912df to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiKeyword#821912df: field emoji: %w", err) - } - e.Emoji = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiKeyword#821912df: field keyword: %w", err) - } - e.Keyword = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiKeyword) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiKeyword#821912df as nil") - } - b.ObjStart() - b.PutID("emojiKeyword") - b.Comma() - b.FieldStart("emoji") - b.PutString(e.Emoji) - b.Comma() - b.FieldStart("keyword") - b.PutString(e.Keyword) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiKeyword) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiKeyword#821912df to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiKeyword"); err != nil { - return fmt.Errorf("unable to decode emojiKeyword#821912df: %w", err) - } - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiKeyword#821912df: field emoji: %w", err) - } - e.Emoji = value - case "keyword": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiKeyword#821912df: field keyword: %w", err) - } - e.Keyword = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEmoji returns value of Emoji field. -func (e *EmojiKeyword) GetEmoji() (value string) { - if e == nil { - return - } - return e.Emoji -} - -// GetKeyword returns value of Keyword field. -func (e *EmojiKeyword) GetKeyword() (value string) { - if e == nil { - return - } - return e.Keyword -} diff --git a/tdapi/tl_emoji_keywords_gen.go b/tdapi/tl_emoji_keywords_gen.go deleted file mode 100644 index 28547a057..000000000 --- a/tdapi/tl_emoji_keywords_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmojiKeywords represents TL type `emojiKeywords#de023f4`. -type EmojiKeywords struct { - // List of emojis with their keywords - EmojiKeywords []EmojiKeyword -} - -// EmojiKeywordsTypeID is TL type id of EmojiKeywords. -const EmojiKeywordsTypeID = 0xde023f4 - -// Ensuring interfaces in compile-time for EmojiKeywords. -var ( - _ bin.Encoder = &EmojiKeywords{} - _ bin.Decoder = &EmojiKeywords{} - _ bin.BareEncoder = &EmojiKeywords{} - _ bin.BareDecoder = &EmojiKeywords{} -) - -func (e *EmojiKeywords) Zero() bool { - if e == nil { - return true - } - if !(e.EmojiKeywords == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiKeywords) String() string { - if e == nil { - return "EmojiKeywords(nil)" - } - type Alias EmojiKeywords - return fmt.Sprintf("EmojiKeywords%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiKeywords) TypeID() uint32 { - return EmojiKeywordsTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiKeywords) TypeName() string { - return "emojiKeywords" -} - -// TypeInfo returns info about TL type. -func (e *EmojiKeywords) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiKeywords", - ID: EmojiKeywordsTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "EmojiKeywords", - SchemaName: "emoji_keywords", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiKeywords) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiKeywords#de023f4 as nil") - } - b.PutID(EmojiKeywordsTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiKeywords) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiKeywords#de023f4 as nil") - } - b.PutInt(len(e.EmojiKeywords)) - for idx, v := range e.EmojiKeywords { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare emojiKeywords#de023f4: field emoji_keywords element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiKeywords) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiKeywords#de023f4 to nil") - } - if err := b.ConsumeID(EmojiKeywordsTypeID); err != nil { - return fmt.Errorf("unable to decode emojiKeywords#de023f4: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiKeywords) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiKeywords#de023f4 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode emojiKeywords#de023f4: field emoji_keywords: %w", err) - } - - if headerLen > 0 { - e.EmojiKeywords = make([]EmojiKeyword, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value EmojiKeyword - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare emojiKeywords#de023f4: field emoji_keywords: %w", err) - } - e.EmojiKeywords = append(e.EmojiKeywords, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiKeywords) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiKeywords#de023f4 as nil") - } - b.ObjStart() - b.PutID("emojiKeywords") - b.Comma() - b.FieldStart("emoji_keywords") - b.ArrStart() - for idx, v := range e.EmojiKeywords { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiKeywords#de023f4: field emoji_keywords element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiKeywords) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiKeywords#de023f4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiKeywords"); err != nil { - return fmt.Errorf("unable to decode emojiKeywords#de023f4: %w", err) - } - case "emoji_keywords": - if err := b.Arr(func(b tdjson.Decoder) error { - var value EmojiKeyword - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode emojiKeywords#de023f4: field emoji_keywords: %w", err) - } - e.EmojiKeywords = append(e.EmojiKeywords, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode emojiKeywords#de023f4: field emoji_keywords: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetEmojiKeywords returns value of EmojiKeywords field. -func (e *EmojiKeywords) GetEmojiKeywords() (value []EmojiKeyword) { - if e == nil { - return - } - return e.EmojiKeywords -} diff --git a/tdapi/tl_emoji_reaction_gen.go b/tdapi/tl_emoji_reaction_gen.go deleted file mode 100644 index cf3368239..000000000 --- a/tdapi/tl_emoji_reaction_gen.go +++ /dev/null @@ -1,499 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmojiReaction represents TL type `emojiReaction#60532c5f`. -type EmojiReaction struct { - // Text representation of the reaction - Emoji string - // Reaction title - Title string - // True, if the reaction can be added to new messages and enabled in chats - IsActive bool - // Static icon for the reaction - StaticIcon Sticker - // Appear animation for the reaction - AppearAnimation Sticker - // Select animation for the reaction - SelectAnimation Sticker - // Activate animation for the reaction - ActivateAnimation Sticker - // Effect animation for the reaction - EffectAnimation Sticker - // Around animation for the reaction; may be null - AroundAnimation Sticker - // Center animation for the reaction; may be null - CenterAnimation Sticker -} - -// EmojiReactionTypeID is TL type id of EmojiReaction. -const EmojiReactionTypeID = 0x60532c5f - -// Ensuring interfaces in compile-time for EmojiReaction. -var ( - _ bin.Encoder = &EmojiReaction{} - _ bin.Decoder = &EmojiReaction{} - _ bin.BareEncoder = &EmojiReaction{} - _ bin.BareDecoder = &EmojiReaction{} -) - -func (e *EmojiReaction) Zero() bool { - if e == nil { - return true - } - if !(e.Emoji == "") { - return false - } - if !(e.Title == "") { - return false - } - if !(e.IsActive == false) { - return false - } - if !(e.StaticIcon.Zero()) { - return false - } - if !(e.AppearAnimation.Zero()) { - return false - } - if !(e.SelectAnimation.Zero()) { - return false - } - if !(e.ActivateAnimation.Zero()) { - return false - } - if !(e.EffectAnimation.Zero()) { - return false - } - if !(e.AroundAnimation.Zero()) { - return false - } - if !(e.CenterAnimation.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiReaction) String() string { - if e == nil { - return "EmojiReaction(nil)" - } - type Alias EmojiReaction - return fmt.Sprintf("EmojiReaction%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiReaction) TypeID() uint32 { - return EmojiReactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiReaction) TypeName() string { - return "emojiReaction" -} - -// TypeInfo returns info about TL type. -func (e *EmojiReaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiReaction", - ID: EmojiReactionTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Emoji", - SchemaName: "emoji", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "IsActive", - SchemaName: "is_active", - }, - { - Name: "StaticIcon", - SchemaName: "static_icon", - }, - { - Name: "AppearAnimation", - SchemaName: "appear_animation", - }, - { - Name: "SelectAnimation", - SchemaName: "select_animation", - }, - { - Name: "ActivateAnimation", - SchemaName: "activate_animation", - }, - { - Name: "EffectAnimation", - SchemaName: "effect_animation", - }, - { - Name: "AroundAnimation", - SchemaName: "around_animation", - }, - { - Name: "CenterAnimation", - SchemaName: "center_animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiReaction) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiReaction#60532c5f as nil") - } - b.PutID(EmojiReactionTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiReaction) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiReaction#60532c5f as nil") - } - b.PutString(e.Emoji) - b.PutString(e.Title) - b.PutBool(e.IsActive) - if err := e.StaticIcon.Encode(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field static_icon: %w", err) - } - if err := e.AppearAnimation.Encode(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field appear_animation: %w", err) - } - if err := e.SelectAnimation.Encode(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field select_animation: %w", err) - } - if err := e.ActivateAnimation.Encode(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field activate_animation: %w", err) - } - if err := e.EffectAnimation.Encode(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field effect_animation: %w", err) - } - if err := e.AroundAnimation.Encode(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field around_animation: %w", err) - } - if err := e.CenterAnimation.Encode(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field center_animation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiReaction) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiReaction#60532c5f to nil") - } - if err := b.ConsumeID(EmojiReactionTypeID); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiReaction) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiReaction#60532c5f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field emoji: %w", err) - } - e.Emoji = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field title: %w", err) - } - e.Title = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field is_active: %w", err) - } - e.IsActive = value - } - { - if err := e.StaticIcon.Decode(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field static_icon: %w", err) - } - } - { - if err := e.AppearAnimation.Decode(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field appear_animation: %w", err) - } - } - { - if err := e.SelectAnimation.Decode(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field select_animation: %w", err) - } - } - { - if err := e.ActivateAnimation.Decode(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field activate_animation: %w", err) - } - } - { - if err := e.EffectAnimation.Decode(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field effect_animation: %w", err) - } - } - { - if err := e.AroundAnimation.Decode(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field around_animation: %w", err) - } - } - { - if err := e.CenterAnimation.Decode(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field center_animation: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiReaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiReaction#60532c5f as nil") - } - b.ObjStart() - b.PutID("emojiReaction") - b.Comma() - b.FieldStart("emoji") - b.PutString(e.Emoji) - b.Comma() - b.FieldStart("title") - b.PutString(e.Title) - b.Comma() - b.FieldStart("is_active") - b.PutBool(e.IsActive) - b.Comma() - b.FieldStart("static_icon") - if err := e.StaticIcon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field static_icon: %w", err) - } - b.Comma() - b.FieldStart("appear_animation") - if err := e.AppearAnimation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field appear_animation: %w", err) - } - b.Comma() - b.FieldStart("select_animation") - if err := e.SelectAnimation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field select_animation: %w", err) - } - b.Comma() - b.FieldStart("activate_animation") - if err := e.ActivateAnimation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field activate_animation: %w", err) - } - b.Comma() - b.FieldStart("effect_animation") - if err := e.EffectAnimation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field effect_animation: %w", err) - } - b.Comma() - b.FieldStart("around_animation") - if err := e.AroundAnimation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field around_animation: %w", err) - } - b.Comma() - b.FieldStart("center_animation") - if err := e.CenterAnimation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode emojiReaction#60532c5f: field center_animation: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiReaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiReaction#60532c5f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiReaction"); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: %w", err) - } - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field emoji: %w", err) - } - e.Emoji = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field title: %w", err) - } - e.Title = value - case "is_active": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field is_active: %w", err) - } - e.IsActive = value - case "static_icon": - if err := e.StaticIcon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field static_icon: %w", err) - } - case "appear_animation": - if err := e.AppearAnimation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field appear_animation: %w", err) - } - case "select_animation": - if err := e.SelectAnimation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field select_animation: %w", err) - } - case "activate_animation": - if err := e.ActivateAnimation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field activate_animation: %w", err) - } - case "effect_animation": - if err := e.EffectAnimation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field effect_animation: %w", err) - } - case "around_animation": - if err := e.AroundAnimation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field around_animation: %w", err) - } - case "center_animation": - if err := e.CenterAnimation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode emojiReaction#60532c5f: field center_animation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetEmoji returns value of Emoji field. -func (e *EmojiReaction) GetEmoji() (value string) { - if e == nil { - return - } - return e.Emoji -} - -// GetTitle returns value of Title field. -func (e *EmojiReaction) GetTitle() (value string) { - if e == nil { - return - } - return e.Title -} - -// GetIsActive returns value of IsActive field. -func (e *EmojiReaction) GetIsActive() (value bool) { - if e == nil { - return - } - return e.IsActive -} - -// GetStaticIcon returns value of StaticIcon field. -func (e *EmojiReaction) GetStaticIcon() (value Sticker) { - if e == nil { - return - } - return e.StaticIcon -} - -// GetAppearAnimation returns value of AppearAnimation field. -func (e *EmojiReaction) GetAppearAnimation() (value Sticker) { - if e == nil { - return - } - return e.AppearAnimation -} - -// GetSelectAnimation returns value of SelectAnimation field. -func (e *EmojiReaction) GetSelectAnimation() (value Sticker) { - if e == nil { - return - } - return e.SelectAnimation -} - -// GetActivateAnimation returns value of ActivateAnimation field. -func (e *EmojiReaction) GetActivateAnimation() (value Sticker) { - if e == nil { - return - } - return e.ActivateAnimation -} - -// GetEffectAnimation returns value of EffectAnimation field. -func (e *EmojiReaction) GetEffectAnimation() (value Sticker) { - if e == nil { - return - } - return e.EffectAnimation -} - -// GetAroundAnimation returns value of AroundAnimation field. -func (e *EmojiReaction) GetAroundAnimation() (value Sticker) { - if e == nil { - return - } - return e.AroundAnimation -} - -// GetCenterAnimation returns value of CenterAnimation field. -func (e *EmojiReaction) GetCenterAnimation() (value Sticker) { - if e == nil { - return - } - return e.CenterAnimation -} diff --git a/tdapi/tl_emoji_status_gen.go b/tdapi/tl_emoji_status_gen.go deleted file mode 100644 index cf6e9fcb9..000000000 --- a/tdapi/tl_emoji_status_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmojiStatus represents TL type `emojiStatus#dbd91636`. -type EmojiStatus struct { - // Identifier of the custom emoji in stickerFormatTgs format - CustomEmojiID int64 - // Point in time (Unix timestamp) when the status will expire; 0 if never - ExpirationDate int32 -} - -// EmojiStatusTypeID is TL type id of EmojiStatus. -const EmojiStatusTypeID = 0xdbd91636 - -// Ensuring interfaces in compile-time for EmojiStatus. -var ( - _ bin.Encoder = &EmojiStatus{} - _ bin.Decoder = &EmojiStatus{} - _ bin.BareEncoder = &EmojiStatus{} - _ bin.BareDecoder = &EmojiStatus{} -) - -func (e *EmojiStatus) Zero() bool { - if e == nil { - return true - } - if !(e.CustomEmojiID == 0) { - return false - } - if !(e.ExpirationDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiStatus) String() string { - if e == nil { - return "EmojiStatus(nil)" - } - type Alias EmojiStatus - return fmt.Sprintf("EmojiStatus%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiStatus) TypeID() uint32 { - return EmojiStatusTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiStatus) TypeName() string { - return "emojiStatus" -} - -// TypeInfo returns info about TL type. -func (e *EmojiStatus) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiStatus", - ID: EmojiStatusTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CustomEmojiID", - SchemaName: "custom_emoji_id", - }, - { - Name: "ExpirationDate", - SchemaName: "expiration_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiStatus) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiStatus#dbd91636 as nil") - } - b.PutID(EmojiStatusTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiStatus) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiStatus#dbd91636 as nil") - } - b.PutLong(e.CustomEmojiID) - b.PutInt32(e.ExpirationDate) - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiStatus) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiStatus#dbd91636 to nil") - } - if err := b.ConsumeID(EmojiStatusTypeID); err != nil { - return fmt.Errorf("unable to decode emojiStatus#dbd91636: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiStatus) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiStatus#dbd91636 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode emojiStatus#dbd91636: field custom_emoji_id: %w", err) - } - e.CustomEmojiID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode emojiStatus#dbd91636: field expiration_date: %w", err) - } - e.ExpirationDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiStatus) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiStatus#dbd91636 as nil") - } - b.ObjStart() - b.PutID("emojiStatus") - b.Comma() - b.FieldStart("custom_emoji_id") - b.PutLong(e.CustomEmojiID) - b.Comma() - b.FieldStart("expiration_date") - b.PutInt32(e.ExpirationDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiStatus) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiStatus#dbd91636 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiStatus"); err != nil { - return fmt.Errorf("unable to decode emojiStatus#dbd91636: %w", err) - } - case "custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode emojiStatus#dbd91636: field custom_emoji_id: %w", err) - } - e.CustomEmojiID = value - case "expiration_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode emojiStatus#dbd91636: field expiration_date: %w", err) - } - e.ExpirationDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCustomEmojiID returns value of CustomEmojiID field. -func (e *EmojiStatus) GetCustomEmojiID() (value int64) { - if e == nil { - return - } - return e.CustomEmojiID -} - -// GetExpirationDate returns value of ExpirationDate field. -func (e *EmojiStatus) GetExpirationDate() (value int32) { - if e == nil { - return - } - return e.ExpirationDate -} diff --git a/tdapi/tl_emoji_statuses_gen.go b/tdapi/tl_emoji_statuses_gen.go deleted file mode 100644 index 6730d51ec..000000000 --- a/tdapi/tl_emoji_statuses_gen.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EmojiStatuses represents TL type `emojiStatuses#eaeb9bdc`. -type EmojiStatuses struct { - // The list of custom emoji identifiers - CustomEmojiIDs []int64 -} - -// EmojiStatusesTypeID is TL type id of EmojiStatuses. -const EmojiStatusesTypeID = 0xeaeb9bdc - -// Ensuring interfaces in compile-time for EmojiStatuses. -var ( - _ bin.Encoder = &EmojiStatuses{} - _ bin.Decoder = &EmojiStatuses{} - _ bin.BareEncoder = &EmojiStatuses{} - _ bin.BareDecoder = &EmojiStatuses{} -) - -func (e *EmojiStatuses) Zero() bool { - if e == nil { - return true - } - if !(e.CustomEmojiIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EmojiStatuses) String() string { - if e == nil { - return "EmojiStatuses(nil)" - } - type Alias EmojiStatuses - return fmt.Sprintf("EmojiStatuses%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EmojiStatuses) TypeID() uint32 { - return EmojiStatusesTypeID -} - -// TypeName returns name of type in TL schema. -func (*EmojiStatuses) TypeName() string { - return "emojiStatuses" -} - -// TypeInfo returns info about TL type. -func (e *EmojiStatuses) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojiStatuses", - ID: EmojiStatusesTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CustomEmojiIDs", - SchemaName: "custom_emoji_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EmojiStatuses) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiStatuses#eaeb9bdc as nil") - } - b.PutID(EmojiStatusesTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EmojiStatuses) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojiStatuses#eaeb9bdc as nil") - } - b.PutInt(len(e.CustomEmojiIDs)) - for _, v := range e.CustomEmojiIDs { - b.PutLong(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *EmojiStatuses) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiStatuses#eaeb9bdc to nil") - } - if err := b.ConsumeID(EmojiStatusesTypeID); err != nil { - return fmt.Errorf("unable to decode emojiStatuses#eaeb9bdc: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EmojiStatuses) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojiStatuses#eaeb9bdc to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode emojiStatuses#eaeb9bdc: field custom_emoji_ids: %w", err) - } - - if headerLen > 0 { - e.CustomEmojiIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode emojiStatuses#eaeb9bdc: field custom_emoji_ids: %w", err) - } - e.CustomEmojiIDs = append(e.CustomEmojiIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EmojiStatuses) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojiStatuses#eaeb9bdc as nil") - } - b.ObjStart() - b.PutID("emojiStatuses") - b.Comma() - b.FieldStart("custom_emoji_ids") - b.ArrStart() - for _, v := range e.CustomEmojiIDs { - b.PutLong(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EmojiStatuses) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojiStatuses#eaeb9bdc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojiStatuses"); err != nil { - return fmt.Errorf("unable to decode emojiStatuses#eaeb9bdc: %w", err) - } - case "custom_emoji_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode emojiStatuses#eaeb9bdc: field custom_emoji_ids: %w", err) - } - e.CustomEmojiIDs = append(e.CustomEmojiIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode emojiStatuses#eaeb9bdc: field custom_emoji_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCustomEmojiIDs returns value of CustomEmojiIDs field. -func (e *EmojiStatuses) GetCustomEmojiIDs() (value []int64) { - if e == nil { - return - } - return e.CustomEmojiIDs -} diff --git a/tdapi/tl_emojis_gen.go b/tdapi/tl_emojis_gen.go deleted file mode 100644 index 558519d05..000000000 --- a/tdapi/tl_emojis_gen.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Emojis represents TL type `emojis#77274a16`. -type Emojis struct { - // List of emojis - Emojis []string -} - -// EmojisTypeID is TL type id of Emojis. -const EmojisTypeID = 0x77274a16 - -// Ensuring interfaces in compile-time for Emojis. -var ( - _ bin.Encoder = &Emojis{} - _ bin.Decoder = &Emojis{} - _ bin.BareEncoder = &Emojis{} - _ bin.BareDecoder = &Emojis{} -) - -func (e *Emojis) Zero() bool { - if e == nil { - return true - } - if !(e.Emojis == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *Emojis) String() string { - if e == nil { - return "Emojis(nil)" - } - type Alias Emojis - return fmt.Sprintf("Emojis%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Emojis) TypeID() uint32 { - return EmojisTypeID -} - -// TypeName returns name of type in TL schema. -func (*Emojis) TypeName() string { - return "emojis" -} - -// TypeInfo returns info about TL type. -func (e *Emojis) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "emojis", - ID: EmojisTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Emojis", - SchemaName: "emojis", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *Emojis) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojis#77274a16 as nil") - } - b.PutID(EmojisTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *Emojis) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode emojis#77274a16 as nil") - } - b.PutInt(len(e.Emojis)) - for _, v := range e.Emojis { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (e *Emojis) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojis#77274a16 to nil") - } - if err := b.ConsumeID(EmojisTypeID); err != nil { - return fmt.Errorf("unable to decode emojis#77274a16: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *Emojis) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode emojis#77274a16 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode emojis#77274a16: field emojis: %w", err) - } - - if headerLen > 0 { - e.Emojis = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojis#77274a16: field emojis: %w", err) - } - e.Emojis = append(e.Emojis, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *Emojis) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode emojis#77274a16 as nil") - } - b.ObjStart() - b.PutID("emojis") - b.Comma() - b.FieldStart("emojis") - b.ArrStart() - for _, v := range e.Emojis { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *Emojis) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode emojis#77274a16 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("emojis"); err != nil { - return fmt.Errorf("unable to decode emojis#77274a16: %w", err) - } - case "emojis": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode emojis#77274a16: field emojis: %w", err) - } - e.Emojis = append(e.Emojis, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode emojis#77274a16: field emojis: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetEmojis returns value of Emojis field. -func (e *Emojis) GetEmojis() (value []string) { - if e == nil { - return - } - return e.Emojis -} diff --git a/tdapi/tl_enable_proxy_gen.go b/tdapi/tl_enable_proxy_gen.go deleted file mode 100644 index 4ff7e1870..000000000 --- a/tdapi/tl_enable_proxy_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EnableProxyRequest represents TL type `enableProxy#59138296`. -type EnableProxyRequest struct { - // Proxy identifier - ProxyID int32 -} - -// EnableProxyRequestTypeID is TL type id of EnableProxyRequest. -const EnableProxyRequestTypeID = 0x59138296 - -// Ensuring interfaces in compile-time for EnableProxyRequest. -var ( - _ bin.Encoder = &EnableProxyRequest{} - _ bin.Decoder = &EnableProxyRequest{} - _ bin.BareEncoder = &EnableProxyRequest{} - _ bin.BareDecoder = &EnableProxyRequest{} -) - -func (e *EnableProxyRequest) Zero() bool { - if e == nil { - return true - } - if !(e.ProxyID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EnableProxyRequest) String() string { - if e == nil { - return "EnableProxyRequest(nil)" - } - type Alias EnableProxyRequest - return fmt.Sprintf("EnableProxyRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EnableProxyRequest) TypeID() uint32 { - return EnableProxyRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EnableProxyRequest) TypeName() string { - return "enableProxy" -} - -// TypeInfo returns info about TL type. -func (e *EnableProxyRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "enableProxy", - ID: EnableProxyRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ProxyID", - SchemaName: "proxy_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EnableProxyRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode enableProxy#59138296 as nil") - } - b.PutID(EnableProxyRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EnableProxyRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode enableProxy#59138296 as nil") - } - b.PutInt32(e.ProxyID) - return nil -} - -// Decode implements bin.Decoder. -func (e *EnableProxyRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode enableProxy#59138296 to nil") - } - if err := b.ConsumeID(EnableProxyRequestTypeID); err != nil { - return fmt.Errorf("unable to decode enableProxy#59138296: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EnableProxyRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode enableProxy#59138296 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode enableProxy#59138296: field proxy_id: %w", err) - } - e.ProxyID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EnableProxyRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode enableProxy#59138296 as nil") - } - b.ObjStart() - b.PutID("enableProxy") - b.Comma() - b.FieldStart("proxy_id") - b.PutInt32(e.ProxyID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EnableProxyRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode enableProxy#59138296 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("enableProxy"); err != nil { - return fmt.Errorf("unable to decode enableProxy#59138296: %w", err) - } - case "proxy_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode enableProxy#59138296: field proxy_id: %w", err) - } - e.ProxyID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProxyID returns value of ProxyID field. -func (e *EnableProxyRequest) GetProxyID() (value int32) { - if e == nil { - return - } - return e.ProxyID -} - -// EnableProxy invokes method enableProxy#59138296 returning error if any. -func (c *Client) EnableProxy(ctx context.Context, proxyid int32) error { - var ok Ok - - request := &EnableProxyRequest{ - ProxyID: proxyid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_encrypted_credentials_gen.go b/tdapi/tl_encrypted_credentials_gen.go deleted file mode 100644 index eb450140c..000000000 --- a/tdapi/tl_encrypted_credentials_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EncryptedCredentials represents TL type `encryptedCredentials#4f5713ce`. -type EncryptedCredentials struct { - // The encrypted credentials - Data []byte - // The decrypted data hash - Hash []byte - // Secret for data decryption, encrypted with the service's public key - Secret []byte -} - -// EncryptedCredentialsTypeID is TL type id of EncryptedCredentials. -const EncryptedCredentialsTypeID = 0x4f5713ce - -// Ensuring interfaces in compile-time for EncryptedCredentials. -var ( - _ bin.Encoder = &EncryptedCredentials{} - _ bin.Decoder = &EncryptedCredentials{} - _ bin.BareEncoder = &EncryptedCredentials{} - _ bin.BareDecoder = &EncryptedCredentials{} -) - -func (e *EncryptedCredentials) Zero() bool { - if e == nil { - return true - } - if !(e.Data == nil) { - return false - } - if !(e.Hash == nil) { - return false - } - if !(e.Secret == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EncryptedCredentials) String() string { - if e == nil { - return "EncryptedCredentials(nil)" - } - type Alias EncryptedCredentials - return fmt.Sprintf("EncryptedCredentials%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EncryptedCredentials) TypeID() uint32 { - return EncryptedCredentialsTypeID -} - -// TypeName returns name of type in TL schema. -func (*EncryptedCredentials) TypeName() string { - return "encryptedCredentials" -} - -// TypeInfo returns info about TL type. -func (e *EncryptedCredentials) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "encryptedCredentials", - ID: EncryptedCredentialsTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Data", - SchemaName: "data", - }, - { - Name: "Hash", - SchemaName: "hash", - }, - { - Name: "Secret", - SchemaName: "secret", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EncryptedCredentials) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode encryptedCredentials#4f5713ce as nil") - } - b.PutID(EncryptedCredentialsTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EncryptedCredentials) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode encryptedCredentials#4f5713ce as nil") - } - b.PutBytes(e.Data) - b.PutBytes(e.Hash) - b.PutBytes(e.Secret) - return nil -} - -// Decode implements bin.Decoder. -func (e *EncryptedCredentials) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode encryptedCredentials#4f5713ce to nil") - } - if err := b.ConsumeID(EncryptedCredentialsTypeID); err != nil { - return fmt.Errorf("unable to decode encryptedCredentials#4f5713ce: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EncryptedCredentials) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode encryptedCredentials#4f5713ce to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode encryptedCredentials#4f5713ce: field data: %w", err) - } - e.Data = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode encryptedCredentials#4f5713ce: field hash: %w", err) - } - e.Hash = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode encryptedCredentials#4f5713ce: field secret: %w", err) - } - e.Secret = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EncryptedCredentials) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode encryptedCredentials#4f5713ce as nil") - } - b.ObjStart() - b.PutID("encryptedCredentials") - b.Comma() - b.FieldStart("data") - b.PutBytes(e.Data) - b.Comma() - b.FieldStart("hash") - b.PutBytes(e.Hash) - b.Comma() - b.FieldStart("secret") - b.PutBytes(e.Secret) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EncryptedCredentials) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode encryptedCredentials#4f5713ce to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("encryptedCredentials"); err != nil { - return fmt.Errorf("unable to decode encryptedCredentials#4f5713ce: %w", err) - } - case "data": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode encryptedCredentials#4f5713ce: field data: %w", err) - } - e.Data = value - case "hash": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode encryptedCredentials#4f5713ce: field hash: %w", err) - } - e.Hash = value - case "secret": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode encryptedCredentials#4f5713ce: field secret: %w", err) - } - e.Secret = value - default: - return b.Skip() - } - return nil - }) -} - -// GetData returns value of Data field. -func (e *EncryptedCredentials) GetData() (value []byte) { - if e == nil { - return - } - return e.Data -} - -// GetHash returns value of Hash field. -func (e *EncryptedCredentials) GetHash() (value []byte) { - if e == nil { - return - } - return e.Hash -} - -// GetSecret returns value of Secret field. -func (e *EncryptedCredentials) GetSecret() (value []byte) { - if e == nil { - return - } - return e.Secret -} diff --git a/tdapi/tl_encrypted_passport_element_gen.go b/tdapi/tl_encrypted_passport_element_gen.go deleted file mode 100644 index 848bdd499..000000000 --- a/tdapi/tl_encrypted_passport_element_gen.go +++ /dev/null @@ -1,531 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EncryptedPassportElement represents TL type `encryptedPassportElement#262d248`. -type EncryptedPassportElement struct { - // Type of Telegram Passport element - Type PassportElementTypeClass - // Encrypted JSON-encoded data about the user - Data []byte - // The front side of an identity document - FrontSide DatedFile - // The reverse side of an identity document; may be null - ReverseSide DatedFile - // Selfie with the document; may be null - Selfie DatedFile - // List of files containing a certified English translation of the document - Translation []DatedFile - // List of attached files - Files []DatedFile - // Unencrypted data, phone number or email address - Value string - // Hash of the entire element - Hash string -} - -// EncryptedPassportElementTypeID is TL type id of EncryptedPassportElement. -const EncryptedPassportElementTypeID = 0x262d248 - -// Ensuring interfaces in compile-time for EncryptedPassportElement. -var ( - _ bin.Encoder = &EncryptedPassportElement{} - _ bin.Decoder = &EncryptedPassportElement{} - _ bin.BareEncoder = &EncryptedPassportElement{} - _ bin.BareDecoder = &EncryptedPassportElement{} -) - -func (e *EncryptedPassportElement) Zero() bool { - if e == nil { - return true - } - if !(e.Type == nil) { - return false - } - if !(e.Data == nil) { - return false - } - if !(e.FrontSide.Zero()) { - return false - } - if !(e.ReverseSide.Zero()) { - return false - } - if !(e.Selfie.Zero()) { - return false - } - if !(e.Translation == nil) { - return false - } - if !(e.Files == nil) { - return false - } - if !(e.Value == "") { - return false - } - if !(e.Hash == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EncryptedPassportElement) String() string { - if e == nil { - return "EncryptedPassportElement(nil)" - } - type Alias EncryptedPassportElement - return fmt.Sprintf("EncryptedPassportElement%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EncryptedPassportElement) TypeID() uint32 { - return EncryptedPassportElementTypeID -} - -// TypeName returns name of type in TL schema. -func (*EncryptedPassportElement) TypeName() string { - return "encryptedPassportElement" -} - -// TypeInfo returns info about TL type. -func (e *EncryptedPassportElement) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "encryptedPassportElement", - ID: EncryptedPassportElementTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "Data", - SchemaName: "data", - }, - { - Name: "FrontSide", - SchemaName: "front_side", - }, - { - Name: "ReverseSide", - SchemaName: "reverse_side", - }, - { - Name: "Selfie", - SchemaName: "selfie", - }, - { - Name: "Translation", - SchemaName: "translation", - }, - { - Name: "Files", - SchemaName: "files", - }, - { - Name: "Value", - SchemaName: "value", - }, - { - Name: "Hash", - SchemaName: "hash", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EncryptedPassportElement) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode encryptedPassportElement#262d248 as nil") - } - b.PutID(EncryptedPassportElementTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EncryptedPassportElement) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode encryptedPassportElement#262d248 as nil") - } - if e.Type == nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field type is nil") - } - if err := e.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field type: %w", err) - } - b.PutBytes(e.Data) - if err := e.FrontSide.Encode(b); err != nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field front_side: %w", err) - } - if err := e.ReverseSide.Encode(b); err != nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field reverse_side: %w", err) - } - if err := e.Selfie.Encode(b); err != nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field selfie: %w", err) - } - b.PutInt(len(e.Translation)) - for idx, v := range e.Translation { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare encryptedPassportElement#262d248: field translation element with index %d: %w", idx, err) - } - } - b.PutInt(len(e.Files)) - for idx, v := range e.Files { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare encryptedPassportElement#262d248: field files element with index %d: %w", idx, err) - } - } - b.PutString(e.Value) - b.PutString(e.Hash) - return nil -} - -// Decode implements bin.Decoder. -func (e *EncryptedPassportElement) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode encryptedPassportElement#262d248 to nil") - } - if err := b.ConsumeID(EncryptedPassportElementTypeID); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EncryptedPassportElement) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode encryptedPassportElement#262d248 to nil") - } - { - value, err := DecodePassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field type: %w", err) - } - e.Type = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field data: %w", err) - } - e.Data = value - } - { - if err := e.FrontSide.Decode(b); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field front_side: %w", err) - } - } - { - if err := e.ReverseSide.Decode(b); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field reverse_side: %w", err) - } - } - { - if err := e.Selfie.Decode(b); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field selfie: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field translation: %w", err) - } - - if headerLen > 0 { - e.Translation = make([]DatedFile, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value DatedFile - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare encryptedPassportElement#262d248: field translation: %w", err) - } - e.Translation = append(e.Translation, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field files: %w", err) - } - - if headerLen > 0 { - e.Files = make([]DatedFile, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value DatedFile - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare encryptedPassportElement#262d248: field files: %w", err) - } - e.Files = append(e.Files, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field value: %w", err) - } - e.Value = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field hash: %w", err) - } - e.Hash = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EncryptedPassportElement) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode encryptedPassportElement#262d248 as nil") - } - b.ObjStart() - b.PutID("encryptedPassportElement") - b.Comma() - b.FieldStart("type") - if e.Type == nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field type is nil") - } - if err := e.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field type: %w", err) - } - b.Comma() - b.FieldStart("data") - b.PutBytes(e.Data) - b.Comma() - b.FieldStart("front_side") - if err := e.FrontSide.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field front_side: %w", err) - } - b.Comma() - b.FieldStart("reverse_side") - if err := e.ReverseSide.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field reverse_side: %w", err) - } - b.Comma() - b.FieldStart("selfie") - if err := e.Selfie.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field selfie: %w", err) - } - b.Comma() - b.FieldStart("translation") - b.ArrStart() - for idx, v := range e.Translation { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field translation element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("files") - b.ArrStart() - for idx, v := range e.Files { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode encryptedPassportElement#262d248: field files element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("value") - b.PutString(e.Value) - b.Comma() - b.FieldStart("hash") - b.PutString(e.Hash) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EncryptedPassportElement) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode encryptedPassportElement#262d248 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("encryptedPassportElement"); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: %w", err) - } - case "type": - value, err := DecodeTDLibJSONPassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field type: %w", err) - } - e.Type = value - case "data": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field data: %w", err) - } - e.Data = value - case "front_side": - if err := e.FrontSide.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field front_side: %w", err) - } - case "reverse_side": - if err := e.ReverseSide.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field reverse_side: %w", err) - } - case "selfie": - if err := e.Selfie.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field selfie: %w", err) - } - case "translation": - if err := b.Arr(func(b tdjson.Decoder) error { - var value DatedFile - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field translation: %w", err) - } - e.Translation = append(e.Translation, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field translation: %w", err) - } - case "files": - if err := b.Arr(func(b tdjson.Decoder) error { - var value DatedFile - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field files: %w", err) - } - e.Files = append(e.Files, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field files: %w", err) - } - case "value": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field value: %w", err) - } - e.Value = value - case "hash": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode encryptedPassportElement#262d248: field hash: %w", err) - } - e.Hash = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (e *EncryptedPassportElement) GetType() (value PassportElementTypeClass) { - if e == nil { - return - } - return e.Type -} - -// GetData returns value of Data field. -func (e *EncryptedPassportElement) GetData() (value []byte) { - if e == nil { - return - } - return e.Data -} - -// GetFrontSide returns value of FrontSide field. -func (e *EncryptedPassportElement) GetFrontSide() (value DatedFile) { - if e == nil { - return - } - return e.FrontSide -} - -// GetReverseSide returns value of ReverseSide field. -func (e *EncryptedPassportElement) GetReverseSide() (value DatedFile) { - if e == nil { - return - } - return e.ReverseSide -} - -// GetSelfie returns value of Selfie field. -func (e *EncryptedPassportElement) GetSelfie() (value DatedFile) { - if e == nil { - return - } - return e.Selfie -} - -// GetTranslation returns value of Translation field. -func (e *EncryptedPassportElement) GetTranslation() (value []DatedFile) { - if e == nil { - return - } - return e.Translation -} - -// GetFiles returns value of Files field. -func (e *EncryptedPassportElement) GetFiles() (value []DatedFile) { - if e == nil { - return - } - return e.Files -} - -// GetValue returns value of Value field. -func (e *EncryptedPassportElement) GetValue() (value string) { - if e == nil { - return - } - return e.Value -} - -// GetHash returns value of Hash field. -func (e *EncryptedPassportElement) GetHash() (value string) { - if e == nil { - return - } - return e.Hash -} diff --git a/tdapi/tl_end_group_call_gen.go b/tdapi/tl_end_group_call_gen.go deleted file mode 100644 index 12a577df5..000000000 --- a/tdapi/tl_end_group_call_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EndGroupCallRequest represents TL type `endGroupCall#22294cb7`. -type EndGroupCallRequest struct { - // Group call identifier - GroupCallID int32 -} - -// EndGroupCallRequestTypeID is TL type id of EndGroupCallRequest. -const EndGroupCallRequestTypeID = 0x22294cb7 - -// Ensuring interfaces in compile-time for EndGroupCallRequest. -var ( - _ bin.Encoder = &EndGroupCallRequest{} - _ bin.Decoder = &EndGroupCallRequest{} - _ bin.BareEncoder = &EndGroupCallRequest{} - _ bin.BareDecoder = &EndGroupCallRequest{} -) - -func (e *EndGroupCallRequest) Zero() bool { - if e == nil { - return true - } - if !(e.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EndGroupCallRequest) String() string { - if e == nil { - return "EndGroupCallRequest(nil)" - } - type Alias EndGroupCallRequest - return fmt.Sprintf("EndGroupCallRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EndGroupCallRequest) TypeID() uint32 { - return EndGroupCallRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EndGroupCallRequest) TypeName() string { - return "endGroupCall" -} - -// TypeInfo returns info about TL type. -func (e *EndGroupCallRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "endGroupCall", - ID: EndGroupCallRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EndGroupCallRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode endGroupCall#22294cb7 as nil") - } - b.PutID(EndGroupCallRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EndGroupCallRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode endGroupCall#22294cb7 as nil") - } - b.PutInt32(e.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (e *EndGroupCallRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode endGroupCall#22294cb7 to nil") - } - if err := b.ConsumeID(EndGroupCallRequestTypeID); err != nil { - return fmt.Errorf("unable to decode endGroupCall#22294cb7: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EndGroupCallRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode endGroupCall#22294cb7 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode endGroupCall#22294cb7: field group_call_id: %w", err) - } - e.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EndGroupCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode endGroupCall#22294cb7 as nil") - } - b.ObjStart() - b.PutID("endGroupCall") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(e.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EndGroupCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode endGroupCall#22294cb7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("endGroupCall"); err != nil { - return fmt.Errorf("unable to decode endGroupCall#22294cb7: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode endGroupCall#22294cb7: field group_call_id: %w", err) - } - e.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (e *EndGroupCallRequest) GetGroupCallID() (value int32) { - if e == nil { - return - } - return e.GroupCallID -} - -// EndGroupCall invokes method endGroupCall#22294cb7 returning error if any. -func (c *Client) EndGroupCall(ctx context.Context, groupcallid int32) error { - var ok Ok - - request := &EndGroupCallRequest{ - GroupCallID: groupcallid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_end_group_call_recording_gen.go b/tdapi/tl_end_group_call_recording_gen.go deleted file mode 100644 index e09157e5c..000000000 --- a/tdapi/tl_end_group_call_recording_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EndGroupCallRecordingRequest represents TL type `endGroupCallRecording#fb7b6289`. -type EndGroupCallRecordingRequest struct { - // Group call identifier - GroupCallID int32 -} - -// EndGroupCallRecordingRequestTypeID is TL type id of EndGroupCallRecordingRequest. -const EndGroupCallRecordingRequestTypeID = 0xfb7b6289 - -// Ensuring interfaces in compile-time for EndGroupCallRecordingRequest. -var ( - _ bin.Encoder = &EndGroupCallRecordingRequest{} - _ bin.Decoder = &EndGroupCallRecordingRequest{} - _ bin.BareEncoder = &EndGroupCallRecordingRequest{} - _ bin.BareDecoder = &EndGroupCallRecordingRequest{} -) - -func (e *EndGroupCallRecordingRequest) Zero() bool { - if e == nil { - return true - } - if !(e.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EndGroupCallRecordingRequest) String() string { - if e == nil { - return "EndGroupCallRecordingRequest(nil)" - } - type Alias EndGroupCallRecordingRequest - return fmt.Sprintf("EndGroupCallRecordingRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EndGroupCallRecordingRequest) TypeID() uint32 { - return EndGroupCallRecordingRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EndGroupCallRecordingRequest) TypeName() string { - return "endGroupCallRecording" -} - -// TypeInfo returns info about TL type. -func (e *EndGroupCallRecordingRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "endGroupCallRecording", - ID: EndGroupCallRecordingRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EndGroupCallRecordingRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode endGroupCallRecording#fb7b6289 as nil") - } - b.PutID(EndGroupCallRecordingRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EndGroupCallRecordingRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode endGroupCallRecording#fb7b6289 as nil") - } - b.PutInt32(e.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (e *EndGroupCallRecordingRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode endGroupCallRecording#fb7b6289 to nil") - } - if err := b.ConsumeID(EndGroupCallRecordingRequestTypeID); err != nil { - return fmt.Errorf("unable to decode endGroupCallRecording#fb7b6289: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EndGroupCallRecordingRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode endGroupCallRecording#fb7b6289 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode endGroupCallRecording#fb7b6289: field group_call_id: %w", err) - } - e.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EndGroupCallRecordingRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode endGroupCallRecording#fb7b6289 as nil") - } - b.ObjStart() - b.PutID("endGroupCallRecording") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(e.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EndGroupCallRecordingRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode endGroupCallRecording#fb7b6289 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("endGroupCallRecording"); err != nil { - return fmt.Errorf("unable to decode endGroupCallRecording#fb7b6289: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode endGroupCallRecording#fb7b6289: field group_call_id: %w", err) - } - e.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (e *EndGroupCallRecordingRequest) GetGroupCallID() (value int32) { - if e == nil { - return - } - return e.GroupCallID -} - -// EndGroupCallRecording invokes method endGroupCallRecording#fb7b6289 returning error if any. -func (c *Client) EndGroupCallRecording(ctx context.Context, groupcallid int32) error { - var ok Ok - - request := &EndGroupCallRecordingRequest{ - GroupCallID: groupcallid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_end_group_call_screen_sharing_gen.go b/tdapi/tl_end_group_call_screen_sharing_gen.go deleted file mode 100644 index a01787074..000000000 --- a/tdapi/tl_end_group_call_screen_sharing_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// EndGroupCallScreenSharingRequest represents TL type `endGroupCallScreenSharing#85f41c4c`. -type EndGroupCallScreenSharingRequest struct { - // Group call identifier - GroupCallID int32 -} - -// EndGroupCallScreenSharingRequestTypeID is TL type id of EndGroupCallScreenSharingRequest. -const EndGroupCallScreenSharingRequestTypeID = 0x85f41c4c - -// Ensuring interfaces in compile-time for EndGroupCallScreenSharingRequest. -var ( - _ bin.Encoder = &EndGroupCallScreenSharingRequest{} - _ bin.Decoder = &EndGroupCallScreenSharingRequest{} - _ bin.BareEncoder = &EndGroupCallScreenSharingRequest{} - _ bin.BareDecoder = &EndGroupCallScreenSharingRequest{} -) - -func (e *EndGroupCallScreenSharingRequest) Zero() bool { - if e == nil { - return true - } - if !(e.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *EndGroupCallScreenSharingRequest) String() string { - if e == nil { - return "EndGroupCallScreenSharingRequest(nil)" - } - type Alias EndGroupCallScreenSharingRequest - return fmt.Sprintf("EndGroupCallScreenSharingRequest%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*EndGroupCallScreenSharingRequest) TypeID() uint32 { - return EndGroupCallScreenSharingRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*EndGroupCallScreenSharingRequest) TypeName() string { - return "endGroupCallScreenSharing" -} - -// TypeInfo returns info about TL type. -func (e *EndGroupCallScreenSharingRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "endGroupCallScreenSharing", - ID: EndGroupCallScreenSharingRequestTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *EndGroupCallScreenSharingRequest) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode endGroupCallScreenSharing#85f41c4c as nil") - } - b.PutID(EndGroupCallScreenSharingRequestTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *EndGroupCallScreenSharingRequest) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode endGroupCallScreenSharing#85f41c4c as nil") - } - b.PutInt32(e.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (e *EndGroupCallScreenSharingRequest) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode endGroupCallScreenSharing#85f41c4c to nil") - } - if err := b.ConsumeID(EndGroupCallScreenSharingRequestTypeID); err != nil { - return fmt.Errorf("unable to decode endGroupCallScreenSharing#85f41c4c: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *EndGroupCallScreenSharingRequest) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode endGroupCallScreenSharing#85f41c4c to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode endGroupCallScreenSharing#85f41c4c: field group_call_id: %w", err) - } - e.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *EndGroupCallScreenSharingRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode endGroupCallScreenSharing#85f41c4c as nil") - } - b.ObjStart() - b.PutID("endGroupCallScreenSharing") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(e.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *EndGroupCallScreenSharingRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode endGroupCallScreenSharing#85f41c4c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("endGroupCallScreenSharing"); err != nil { - return fmt.Errorf("unable to decode endGroupCallScreenSharing#85f41c4c: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode endGroupCallScreenSharing#85f41c4c: field group_call_id: %w", err) - } - e.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (e *EndGroupCallScreenSharingRequest) GetGroupCallID() (value int32) { - if e == nil { - return - } - return e.GroupCallID -} - -// EndGroupCallScreenSharing invokes method endGroupCallScreenSharing#85f41c4c returning error if any. -func (c *Client) EndGroupCallScreenSharing(ctx context.Context, groupcallid int32) error { - var ok Ok - - request := &EndGroupCallScreenSharingRequest{ - GroupCallID: groupcallid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_error_gen.go b/tdapi/tl_error_gen.go deleted file mode 100644 index a68fcf692..000000000 --- a/tdapi/tl_error_gen.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Error represents TL type `error#9bdd8f1a`. -type Error struct { - // Error code; subject to future changes. If the error code is 406, the error message - // must not be processed in any way and must not be displayed to the user - Code int32 - // Error message; subject to future changes - Message string -} - -// ErrorTypeID is TL type id of Error. -const ErrorTypeID = 0x9bdd8f1a - -// Ensuring interfaces in compile-time for Error. -var ( - _ bin.Encoder = &Error{} - _ bin.Decoder = &Error{} - _ bin.BareEncoder = &Error{} - _ bin.BareDecoder = &Error{} -) - -func (e *Error) Zero() bool { - if e == nil { - return true - } - if !(e.Code == 0) { - return false - } - if !(e.Message == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (e *Error) String() string { - if e == nil { - return "Error(nil)" - } - type Alias Error - return fmt.Sprintf("Error%+v", Alias(*e)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Error) TypeID() uint32 { - return ErrorTypeID -} - -// TypeName returns name of type in TL schema. -func (*Error) TypeName() string { - return "error" -} - -// TypeInfo returns info about TL type. -func (e *Error) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "error", - ID: ErrorTypeID, - } - if e == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (e *Error) Encode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode error#9bdd8f1a as nil") - } - b.PutID(ErrorTypeID) - return e.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (e *Error) EncodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't encode error#9bdd8f1a as nil") - } - b.PutInt32(e.Code) - b.PutString(e.Message) - return nil -} - -// Decode implements bin.Decoder. -func (e *Error) Decode(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode error#9bdd8f1a to nil") - } - if err := b.ConsumeID(ErrorTypeID); err != nil { - return fmt.Errorf("unable to decode error#9bdd8f1a: %w", err) - } - return e.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (e *Error) DecodeBare(b *bin.Buffer) error { - if e == nil { - return fmt.Errorf("can't decode error#9bdd8f1a to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode error#9bdd8f1a: field code: %w", err) - } - e.Code = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode error#9bdd8f1a: field message: %w", err) - } - e.Message = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (e *Error) EncodeTDLibJSON(b tdjson.Encoder) error { - if e == nil { - return fmt.Errorf("can't encode error#9bdd8f1a as nil") - } - b.ObjStart() - b.PutID("error") - b.Comma() - b.FieldStart("code") - b.PutInt32(e.Code) - b.Comma() - b.FieldStart("message") - b.PutString(e.Message) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (e *Error) DecodeTDLibJSON(b tdjson.Decoder) error { - if e == nil { - return fmt.Errorf("can't decode error#9bdd8f1a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("error"); err != nil { - return fmt.Errorf("unable to decode error#9bdd8f1a: %w", err) - } - case "code": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode error#9bdd8f1a: field code: %w", err) - } - e.Code = value - case "message": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode error#9bdd8f1a: field message: %w", err) - } - e.Message = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (e *Error) GetCode() (value int32) { - if e == nil { - return - } - return e.Code -} - -// GetMessage returns value of Message field. -func (e *Error) GetMessage() (value string) { - if e == nil { - return - } - return e.Message -} diff --git a/tdapi/tl_fact_check_gen.go b/tdapi/tl_fact_check_gen.go deleted file mode 100644 index 27846efd3..000000000 --- a/tdapi/tl_fact_check_gen.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FactCheck represents TL type `factCheck#c185f918`. -type FactCheck struct { - // Text of the fact-check - Text FormattedText - // A two-letter ISO 3166-1 alpha-2 country code of the country for which the fact-check - // is shown - CountryCode string -} - -// FactCheckTypeID is TL type id of FactCheck. -const FactCheckTypeID = 0xc185f918 - -// Ensuring interfaces in compile-time for FactCheck. -var ( - _ bin.Encoder = &FactCheck{} - _ bin.Decoder = &FactCheck{} - _ bin.BareEncoder = &FactCheck{} - _ bin.BareDecoder = &FactCheck{} -) - -func (f *FactCheck) Zero() bool { - if f == nil { - return true - } - if !(f.Text.Zero()) { - return false - } - if !(f.CountryCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FactCheck) String() string { - if f == nil { - return "FactCheck(nil)" - } - type Alias FactCheck - return fmt.Sprintf("FactCheck%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FactCheck) TypeID() uint32 { - return FactCheckTypeID -} - -// TypeName returns name of type in TL schema. -func (*FactCheck) TypeName() string { - return "factCheck" -} - -// TypeInfo returns info about TL type. -func (f *FactCheck) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "factCheck", - ID: FactCheckTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "CountryCode", - SchemaName: "country_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FactCheck) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode factCheck#c185f918 as nil") - } - b.PutID(FactCheckTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FactCheck) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode factCheck#c185f918 as nil") - } - if err := f.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode factCheck#c185f918: field text: %w", err) - } - b.PutString(f.CountryCode) - return nil -} - -// Decode implements bin.Decoder. -func (f *FactCheck) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode factCheck#c185f918 to nil") - } - if err := b.ConsumeID(FactCheckTypeID); err != nil { - return fmt.Errorf("unable to decode factCheck#c185f918: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FactCheck) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode factCheck#c185f918 to nil") - } - { - if err := f.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode factCheck#c185f918: field text: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode factCheck#c185f918: field country_code: %w", err) - } - f.CountryCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FactCheck) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode factCheck#c185f918 as nil") - } - b.ObjStart() - b.PutID("factCheck") - b.Comma() - b.FieldStart("text") - if err := f.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode factCheck#c185f918: field text: %w", err) - } - b.Comma() - b.FieldStart("country_code") - b.PutString(f.CountryCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FactCheck) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode factCheck#c185f918 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("factCheck"); err != nil { - return fmt.Errorf("unable to decode factCheck#c185f918: %w", err) - } - case "text": - if err := f.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode factCheck#c185f918: field text: %w", err) - } - case "country_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode factCheck#c185f918: field country_code: %w", err) - } - f.CountryCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (f *FactCheck) GetText() (value FormattedText) { - if f == nil { - return - } - return f.Text -} - -// GetCountryCode returns value of CountryCode field. -func (f *FactCheck) GetCountryCode() (value string) { - if f == nil { - return - } - return f.CountryCode -} diff --git a/tdapi/tl_failed_to_add_member_gen.go b/tdapi/tl_failed_to_add_member_gen.go deleted file mode 100644 index fcc007978..000000000 --- a/tdapi/tl_failed_to_add_member_gen.go +++ /dev/null @@ -1,263 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FailedToAddMember represents TL type `failedToAddMember#ef236cc2`. -type FailedToAddMember struct { - // User identifier - UserID int64 - // True, if subscription to Telegram Premium would have allowed to add the user to the - // chat - PremiumWouldAllowInvite bool - // True, if subscription to Telegram Premium is required to send the user chat invite - // link - PremiumRequiredToSendMessages bool -} - -// FailedToAddMemberTypeID is TL type id of FailedToAddMember. -const FailedToAddMemberTypeID = 0xef236cc2 - -// Ensuring interfaces in compile-time for FailedToAddMember. -var ( - _ bin.Encoder = &FailedToAddMember{} - _ bin.Decoder = &FailedToAddMember{} - _ bin.BareEncoder = &FailedToAddMember{} - _ bin.BareDecoder = &FailedToAddMember{} -) - -func (f *FailedToAddMember) Zero() bool { - if f == nil { - return true - } - if !(f.UserID == 0) { - return false - } - if !(f.PremiumWouldAllowInvite == false) { - return false - } - if !(f.PremiumRequiredToSendMessages == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FailedToAddMember) String() string { - if f == nil { - return "FailedToAddMember(nil)" - } - type Alias FailedToAddMember - return fmt.Sprintf("FailedToAddMember%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FailedToAddMember) TypeID() uint32 { - return FailedToAddMemberTypeID -} - -// TypeName returns name of type in TL schema. -func (*FailedToAddMember) TypeName() string { - return "failedToAddMember" -} - -// TypeInfo returns info about TL type. -func (f *FailedToAddMember) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "failedToAddMember", - ID: FailedToAddMemberTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "PremiumWouldAllowInvite", - SchemaName: "premium_would_allow_invite", - }, - { - Name: "PremiumRequiredToSendMessages", - SchemaName: "premium_required_to_send_messages", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FailedToAddMember) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode failedToAddMember#ef236cc2 as nil") - } - b.PutID(FailedToAddMemberTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FailedToAddMember) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode failedToAddMember#ef236cc2 as nil") - } - b.PutInt53(f.UserID) - b.PutBool(f.PremiumWouldAllowInvite) - b.PutBool(f.PremiumRequiredToSendMessages) - return nil -} - -// Decode implements bin.Decoder. -func (f *FailedToAddMember) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode failedToAddMember#ef236cc2 to nil") - } - if err := b.ConsumeID(FailedToAddMemberTypeID); err != nil { - return fmt.Errorf("unable to decode failedToAddMember#ef236cc2: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FailedToAddMember) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode failedToAddMember#ef236cc2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode failedToAddMember#ef236cc2: field user_id: %w", err) - } - f.UserID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode failedToAddMember#ef236cc2: field premium_would_allow_invite: %w", err) - } - f.PremiumWouldAllowInvite = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode failedToAddMember#ef236cc2: field premium_required_to_send_messages: %w", err) - } - f.PremiumRequiredToSendMessages = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FailedToAddMember) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode failedToAddMember#ef236cc2 as nil") - } - b.ObjStart() - b.PutID("failedToAddMember") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(f.UserID) - b.Comma() - b.FieldStart("premium_would_allow_invite") - b.PutBool(f.PremiumWouldAllowInvite) - b.Comma() - b.FieldStart("premium_required_to_send_messages") - b.PutBool(f.PremiumRequiredToSendMessages) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FailedToAddMember) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode failedToAddMember#ef236cc2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("failedToAddMember"); err != nil { - return fmt.Errorf("unable to decode failedToAddMember#ef236cc2: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode failedToAddMember#ef236cc2: field user_id: %w", err) - } - f.UserID = value - case "premium_would_allow_invite": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode failedToAddMember#ef236cc2: field premium_would_allow_invite: %w", err) - } - f.PremiumWouldAllowInvite = value - case "premium_required_to_send_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode failedToAddMember#ef236cc2: field premium_required_to_send_messages: %w", err) - } - f.PremiumRequiredToSendMessages = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (f *FailedToAddMember) GetUserID() (value int64) { - if f == nil { - return - } - return f.UserID -} - -// GetPremiumWouldAllowInvite returns value of PremiumWouldAllowInvite field. -func (f *FailedToAddMember) GetPremiumWouldAllowInvite() (value bool) { - if f == nil { - return - } - return f.PremiumWouldAllowInvite -} - -// GetPremiumRequiredToSendMessages returns value of PremiumRequiredToSendMessages field. -func (f *FailedToAddMember) GetPremiumRequiredToSendMessages() (value bool) { - if f == nil { - return - } - return f.PremiumRequiredToSendMessages -} diff --git a/tdapi/tl_failed_to_add_members_gen.go b/tdapi/tl_failed_to_add_members_gen.go deleted file mode 100644 index 31d379dad..000000000 --- a/tdapi/tl_failed_to_add_members_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FailedToAddMembers represents TL type `failedToAddMembers#98b4b04`. -type FailedToAddMembers struct { - // Information about users that weren't added to the chat - FailedToAddMembers []FailedToAddMember -} - -// FailedToAddMembersTypeID is TL type id of FailedToAddMembers. -const FailedToAddMembersTypeID = 0x98b4b04 - -// Ensuring interfaces in compile-time for FailedToAddMembers. -var ( - _ bin.Encoder = &FailedToAddMembers{} - _ bin.Decoder = &FailedToAddMembers{} - _ bin.BareEncoder = &FailedToAddMembers{} - _ bin.BareDecoder = &FailedToAddMembers{} -) - -func (f *FailedToAddMembers) Zero() bool { - if f == nil { - return true - } - if !(f.FailedToAddMembers == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FailedToAddMembers) String() string { - if f == nil { - return "FailedToAddMembers(nil)" - } - type Alias FailedToAddMembers - return fmt.Sprintf("FailedToAddMembers%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FailedToAddMembers) TypeID() uint32 { - return FailedToAddMembersTypeID -} - -// TypeName returns name of type in TL schema. -func (*FailedToAddMembers) TypeName() string { - return "failedToAddMembers" -} - -// TypeInfo returns info about TL type. -func (f *FailedToAddMembers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "failedToAddMembers", - ID: FailedToAddMembersTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FailedToAddMembers", - SchemaName: "failed_to_add_members", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FailedToAddMembers) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode failedToAddMembers#98b4b04 as nil") - } - b.PutID(FailedToAddMembersTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FailedToAddMembers) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode failedToAddMembers#98b4b04 as nil") - } - b.PutInt(len(f.FailedToAddMembers)) - for idx, v := range f.FailedToAddMembers { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare failedToAddMembers#98b4b04: field failed_to_add_members element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FailedToAddMembers) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode failedToAddMembers#98b4b04 to nil") - } - if err := b.ConsumeID(FailedToAddMembersTypeID); err != nil { - return fmt.Errorf("unable to decode failedToAddMembers#98b4b04: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FailedToAddMembers) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode failedToAddMembers#98b4b04 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode failedToAddMembers#98b4b04: field failed_to_add_members: %w", err) - } - - if headerLen > 0 { - f.FailedToAddMembers = make([]FailedToAddMember, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value FailedToAddMember - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare failedToAddMembers#98b4b04: field failed_to_add_members: %w", err) - } - f.FailedToAddMembers = append(f.FailedToAddMembers, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FailedToAddMembers) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode failedToAddMembers#98b4b04 as nil") - } - b.ObjStart() - b.PutID("failedToAddMembers") - b.Comma() - b.FieldStart("failed_to_add_members") - b.ArrStart() - for idx, v := range f.FailedToAddMembers { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode failedToAddMembers#98b4b04: field failed_to_add_members element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FailedToAddMembers) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode failedToAddMembers#98b4b04 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("failedToAddMembers"); err != nil { - return fmt.Errorf("unable to decode failedToAddMembers#98b4b04: %w", err) - } - case "failed_to_add_members": - if err := b.Arr(func(b tdjson.Decoder) error { - var value FailedToAddMember - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode failedToAddMembers#98b4b04: field failed_to_add_members: %w", err) - } - f.FailedToAddMembers = append(f.FailedToAddMembers, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode failedToAddMembers#98b4b04: field failed_to_add_members: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFailedToAddMembers returns value of FailedToAddMembers field. -func (f *FailedToAddMembers) GetFailedToAddMembers() (value []FailedToAddMember) { - if f == nil { - return - } - return f.FailedToAddMembers -} diff --git a/tdapi/tl_file_download_gen.go b/tdapi/tl_file_download_gen.go deleted file mode 100644 index c73deb091..000000000 --- a/tdapi/tl_file_download_gen.go +++ /dev/null @@ -1,330 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FileDownload represents TL type `fileDownload#834d1354`. -type FileDownload struct { - // File identifier - FileID int32 - // The message with the file - Message Message - // Point in time (Unix timestamp) when the file was added to the download list - AddDate int32 - // Point in time (Unix timestamp) when the file downloading was completed; 0 if the file - // downloading isn't completed - CompleteDate int32 - // True, if downloading of the file is paused - IsPaused bool -} - -// FileDownloadTypeID is TL type id of FileDownload. -const FileDownloadTypeID = 0x834d1354 - -// Ensuring interfaces in compile-time for FileDownload. -var ( - _ bin.Encoder = &FileDownload{} - _ bin.Decoder = &FileDownload{} - _ bin.BareEncoder = &FileDownload{} - _ bin.BareDecoder = &FileDownload{} -) - -func (f *FileDownload) Zero() bool { - if f == nil { - return true - } - if !(f.FileID == 0) { - return false - } - if !(f.Message.Zero()) { - return false - } - if !(f.AddDate == 0) { - return false - } - if !(f.CompleteDate == 0) { - return false - } - if !(f.IsPaused == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileDownload) String() string { - if f == nil { - return "FileDownload(nil)" - } - type Alias FileDownload - return fmt.Sprintf("FileDownload%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileDownload) TypeID() uint32 { - return FileDownloadTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileDownload) TypeName() string { - return "fileDownload" -} - -// TypeInfo returns info about TL type. -func (f *FileDownload) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileDownload", - ID: FileDownloadTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "AddDate", - SchemaName: "add_date", - }, - { - Name: "CompleteDate", - SchemaName: "complete_date", - }, - { - Name: "IsPaused", - SchemaName: "is_paused", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FileDownload) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileDownload#834d1354 as nil") - } - b.PutID(FileDownloadTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileDownload) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileDownload#834d1354 as nil") - } - b.PutInt32(f.FileID) - if err := f.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode fileDownload#834d1354: field message: %w", err) - } - b.PutInt32(f.AddDate) - b.PutInt32(f.CompleteDate) - b.PutBool(f.IsPaused) - return nil -} - -// Decode implements bin.Decoder. -func (f *FileDownload) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileDownload#834d1354 to nil") - } - if err := b.ConsumeID(FileDownloadTypeID); err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileDownload) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileDownload#834d1354 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: field file_id: %w", err) - } - f.FileID = value - } - { - if err := f.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: field message: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: field add_date: %w", err) - } - f.AddDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: field complete_date: %w", err) - } - f.CompleteDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: field is_paused: %w", err) - } - f.IsPaused = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileDownload) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileDownload#834d1354 as nil") - } - b.ObjStart() - b.PutID("fileDownload") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(f.FileID) - b.Comma() - b.FieldStart("message") - if err := f.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode fileDownload#834d1354: field message: %w", err) - } - b.Comma() - b.FieldStart("add_date") - b.PutInt32(f.AddDate) - b.Comma() - b.FieldStart("complete_date") - b.PutInt32(f.CompleteDate) - b.Comma() - b.FieldStart("is_paused") - b.PutBool(f.IsPaused) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileDownload) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileDownload#834d1354 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileDownload"); err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: field file_id: %w", err) - } - f.FileID = value - case "message": - if err := f.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: field message: %w", err) - } - case "add_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: field add_date: %w", err) - } - f.AddDate = value - case "complete_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: field complete_date: %w", err) - } - f.CompleteDate = value - case "is_paused": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode fileDownload#834d1354: field is_paused: %w", err) - } - f.IsPaused = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (f *FileDownload) GetFileID() (value int32) { - if f == nil { - return - } - return f.FileID -} - -// GetMessage returns value of Message field. -func (f *FileDownload) GetMessage() (value Message) { - if f == nil { - return - } - return f.Message -} - -// GetAddDate returns value of AddDate field. -func (f *FileDownload) GetAddDate() (value int32) { - if f == nil { - return - } - return f.AddDate -} - -// GetCompleteDate returns value of CompleteDate field. -func (f *FileDownload) GetCompleteDate() (value int32) { - if f == nil { - return - } - return f.CompleteDate -} - -// GetIsPaused returns value of IsPaused field. -func (f *FileDownload) GetIsPaused() (value bool) { - if f == nil { - return - } - return f.IsPaused -} diff --git a/tdapi/tl_file_downloaded_prefix_size_gen.go b/tdapi/tl_file_downloaded_prefix_size_gen.go deleted file mode 100644 index 1d86d3811..000000000 --- a/tdapi/tl_file_downloaded_prefix_size_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FileDownloadedPrefixSize represents TL type `fileDownloadedPrefixSize#87e267fb`. -type FileDownloadedPrefixSize struct { - // The prefix size, in bytes - Size int64 -} - -// FileDownloadedPrefixSizeTypeID is TL type id of FileDownloadedPrefixSize. -const FileDownloadedPrefixSizeTypeID = 0x87e267fb - -// Ensuring interfaces in compile-time for FileDownloadedPrefixSize. -var ( - _ bin.Encoder = &FileDownloadedPrefixSize{} - _ bin.Decoder = &FileDownloadedPrefixSize{} - _ bin.BareEncoder = &FileDownloadedPrefixSize{} - _ bin.BareDecoder = &FileDownloadedPrefixSize{} -) - -func (f *FileDownloadedPrefixSize) Zero() bool { - if f == nil { - return true - } - if !(f.Size == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileDownloadedPrefixSize) String() string { - if f == nil { - return "FileDownloadedPrefixSize(nil)" - } - type Alias FileDownloadedPrefixSize - return fmt.Sprintf("FileDownloadedPrefixSize%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileDownloadedPrefixSize) TypeID() uint32 { - return FileDownloadedPrefixSizeTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileDownloadedPrefixSize) TypeName() string { - return "fileDownloadedPrefixSize" -} - -// TypeInfo returns info about TL type. -func (f *FileDownloadedPrefixSize) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileDownloadedPrefixSize", - ID: FileDownloadedPrefixSizeTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Size", - SchemaName: "size", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FileDownloadedPrefixSize) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileDownloadedPrefixSize#87e267fb as nil") - } - b.PutID(FileDownloadedPrefixSizeTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileDownloadedPrefixSize) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileDownloadedPrefixSize#87e267fb as nil") - } - b.PutInt53(f.Size) - return nil -} - -// Decode implements bin.Decoder. -func (f *FileDownloadedPrefixSize) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileDownloadedPrefixSize#87e267fb to nil") - } - if err := b.ConsumeID(FileDownloadedPrefixSizeTypeID); err != nil { - return fmt.Errorf("unable to decode fileDownloadedPrefixSize#87e267fb: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileDownloadedPrefixSize) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileDownloadedPrefixSize#87e267fb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode fileDownloadedPrefixSize#87e267fb: field size: %w", err) - } - f.Size = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileDownloadedPrefixSize) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileDownloadedPrefixSize#87e267fb as nil") - } - b.ObjStart() - b.PutID("fileDownloadedPrefixSize") - b.Comma() - b.FieldStart("size") - b.PutInt53(f.Size) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileDownloadedPrefixSize) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileDownloadedPrefixSize#87e267fb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileDownloadedPrefixSize"); err != nil { - return fmt.Errorf("unable to decode fileDownloadedPrefixSize#87e267fb: %w", err) - } - case "size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode fileDownloadedPrefixSize#87e267fb: field size: %w", err) - } - f.Size = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSize returns value of Size field. -func (f *FileDownloadedPrefixSize) GetSize() (value int64) { - if f == nil { - return - } - return f.Size -} diff --git a/tdapi/tl_file_gen.go b/tdapi/tl_file_gen.go deleted file mode 100644 index 7212d48a6..000000000 --- a/tdapi/tl_file_gen.go +++ /dev/null @@ -1,330 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// File represents TL type `file#4b4c4e34`. -type File struct { - // Unique file identifier - ID int32 - // File size, in bytes; 0 if unknown - Size int64 - // Approximate file size in bytes in case the exact file size is unknown. Can be used to - // show download/upload progress - ExpectedSize int64 - // Information about the local copy of the file - Local LocalFile - // Information about the remote copy of the file - Remote RemoteFile -} - -// FileTypeID is TL type id of File. -const FileTypeID = 0x4b4c4e34 - -// Ensuring interfaces in compile-time for File. -var ( - _ bin.Encoder = &File{} - _ bin.Decoder = &File{} - _ bin.BareEncoder = &File{} - _ bin.BareDecoder = &File{} -) - -func (f *File) Zero() bool { - if f == nil { - return true - } - if !(f.ID == 0) { - return false - } - if !(f.Size == 0) { - return false - } - if !(f.ExpectedSize == 0) { - return false - } - if !(f.Local.Zero()) { - return false - } - if !(f.Remote.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *File) String() string { - if f == nil { - return "File(nil)" - } - type Alias File - return fmt.Sprintf("File%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*File) TypeID() uint32 { - return FileTypeID -} - -// TypeName returns name of type in TL schema. -func (*File) TypeName() string { - return "file" -} - -// TypeInfo returns info about TL type. -func (f *File) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "file", - ID: FileTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Size", - SchemaName: "size", - }, - { - Name: "ExpectedSize", - SchemaName: "expected_size", - }, - { - Name: "Local", - SchemaName: "local", - }, - { - Name: "Remote", - SchemaName: "remote", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *File) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode file#4b4c4e34 as nil") - } - b.PutID(FileTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *File) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode file#4b4c4e34 as nil") - } - b.PutInt32(f.ID) - b.PutInt53(f.Size) - b.PutInt53(f.ExpectedSize) - if err := f.Local.Encode(b); err != nil { - return fmt.Errorf("unable to encode file#4b4c4e34: field local: %w", err) - } - if err := f.Remote.Encode(b); err != nil { - return fmt.Errorf("unable to encode file#4b4c4e34: field remote: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (f *File) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode file#4b4c4e34 to nil") - } - if err := b.ConsumeID(FileTypeID); err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *File) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode file#4b4c4e34 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: field id: %w", err) - } - f.ID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: field size: %w", err) - } - f.Size = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: field expected_size: %w", err) - } - f.ExpectedSize = value - } - { - if err := f.Local.Decode(b); err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: field local: %w", err) - } - } - { - if err := f.Remote.Decode(b); err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: field remote: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *File) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode file#4b4c4e34 as nil") - } - b.ObjStart() - b.PutID("file") - b.Comma() - b.FieldStart("id") - b.PutInt32(f.ID) - b.Comma() - b.FieldStart("size") - b.PutInt53(f.Size) - b.Comma() - b.FieldStart("expected_size") - b.PutInt53(f.ExpectedSize) - b.Comma() - b.FieldStart("local") - if err := f.Local.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode file#4b4c4e34: field local: %w", err) - } - b.Comma() - b.FieldStart("remote") - if err := f.Remote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode file#4b4c4e34: field remote: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *File) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode file#4b4c4e34 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("file"); err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: field id: %w", err) - } - f.ID = value - case "size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: field size: %w", err) - } - f.Size = value - case "expected_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: field expected_size: %w", err) - } - f.ExpectedSize = value - case "local": - if err := f.Local.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: field local: %w", err) - } - case "remote": - if err := f.Remote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode file#4b4c4e34: field remote: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (f *File) GetID() (value int32) { - if f == nil { - return - } - return f.ID -} - -// GetSize returns value of Size field. -func (f *File) GetSize() (value int64) { - if f == nil { - return - } - return f.Size -} - -// GetExpectedSize returns value of ExpectedSize field. -func (f *File) GetExpectedSize() (value int64) { - if f == nil { - return - } - return f.ExpectedSize -} - -// GetLocal returns value of Local field. -func (f *File) GetLocal() (value LocalFile) { - if f == nil { - return - } - return f.Local -} - -// GetRemote returns value of Remote field. -func (f *File) GetRemote() (value RemoteFile) { - if f == nil { - return - } - return f.Remote -} diff --git a/tdapi/tl_file_part_gen.go b/tdapi/tl_file_part_gen.go deleted file mode 100644 index 27d44e552..000000000 --- a/tdapi/tl_file_part_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FilePart represents TL type `filePart#36594c36`. -type FilePart struct { - // File bytes - Data []byte -} - -// FilePartTypeID is TL type id of FilePart. -const FilePartTypeID = 0x36594c36 - -// Ensuring interfaces in compile-time for FilePart. -var ( - _ bin.Encoder = &FilePart{} - _ bin.Decoder = &FilePart{} - _ bin.BareEncoder = &FilePart{} - _ bin.BareDecoder = &FilePart{} -) - -func (f *FilePart) Zero() bool { - if f == nil { - return true - } - if !(f.Data == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FilePart) String() string { - if f == nil { - return "FilePart(nil)" - } - type Alias FilePart - return fmt.Sprintf("FilePart%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FilePart) TypeID() uint32 { - return FilePartTypeID -} - -// TypeName returns name of type in TL schema. -func (*FilePart) TypeName() string { - return "filePart" -} - -// TypeInfo returns info about TL type. -func (f *FilePart) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "filePart", - ID: FilePartTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FilePart) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode filePart#36594c36 as nil") - } - b.PutID(FilePartTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FilePart) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode filePart#36594c36 as nil") - } - b.PutBytes(f.Data) - return nil -} - -// Decode implements bin.Decoder. -func (f *FilePart) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode filePart#36594c36 to nil") - } - if err := b.ConsumeID(FilePartTypeID); err != nil { - return fmt.Errorf("unable to decode filePart#36594c36: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FilePart) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode filePart#36594c36 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode filePart#36594c36: field data: %w", err) - } - f.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FilePart) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode filePart#36594c36 as nil") - } - b.ObjStart() - b.PutID("filePart") - b.Comma() - b.FieldStart("data") - b.PutBytes(f.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FilePart) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode filePart#36594c36 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("filePart"); err != nil { - return fmt.Errorf("unable to decode filePart#36594c36: %w", err) - } - case "data": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode filePart#36594c36: field data: %w", err) - } - f.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetData returns value of Data field. -func (f *FilePart) GetData() (value []byte) { - if f == nil { - return - } - return f.Data -} diff --git a/tdapi/tl_file_type_gen.go b/tdapi/tl_file_type_gen.go deleted file mode 100644 index 0402253c9..000000000 --- a/tdapi/tl_file_type_gen.go +++ /dev/null @@ -1,3497 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FileTypeNone represents TL type `fileTypeNone#77637ea5`. -type FileTypeNone struct { -} - -// FileTypeNoneTypeID is TL type id of FileTypeNone. -const FileTypeNoneTypeID = 0x77637ea5 - -// construct implements constructor of FileTypeClass. -func (f FileTypeNone) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeNone. -var ( - _ bin.Encoder = &FileTypeNone{} - _ bin.Decoder = &FileTypeNone{} - _ bin.BareEncoder = &FileTypeNone{} - _ bin.BareDecoder = &FileTypeNone{} - - _ FileTypeClass = &FileTypeNone{} -) - -func (f *FileTypeNone) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeNone) String() string { - if f == nil { - return "FileTypeNone(nil)" - } - type Alias FileTypeNone - return fmt.Sprintf("FileTypeNone%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeNone) TypeID() uint32 { - return FileTypeNoneTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeNone) TypeName() string { - return "fileTypeNone" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeNone) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeNone", - ID: FileTypeNoneTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeNone) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeNone#77637ea5 as nil") - } - b.PutID(FileTypeNoneTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeNone) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeNone#77637ea5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeNone) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeNone#77637ea5 to nil") - } - if err := b.ConsumeID(FileTypeNoneTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeNone#77637ea5: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeNone) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeNone#77637ea5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeNone) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeNone#77637ea5 as nil") - } - b.ObjStart() - b.PutID("fileTypeNone") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeNone) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeNone#77637ea5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeNone"); err != nil { - return fmt.Errorf("unable to decode fileTypeNone#77637ea5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeAnimation represents TL type `fileTypeAnimation#eeaa7dba`. -type FileTypeAnimation struct { -} - -// FileTypeAnimationTypeID is TL type id of FileTypeAnimation. -const FileTypeAnimationTypeID = 0xeeaa7dba - -// construct implements constructor of FileTypeClass. -func (f FileTypeAnimation) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeAnimation. -var ( - _ bin.Encoder = &FileTypeAnimation{} - _ bin.Decoder = &FileTypeAnimation{} - _ bin.BareEncoder = &FileTypeAnimation{} - _ bin.BareDecoder = &FileTypeAnimation{} - - _ FileTypeClass = &FileTypeAnimation{} -) - -func (f *FileTypeAnimation) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeAnimation) String() string { - if f == nil { - return "FileTypeAnimation(nil)" - } - type Alias FileTypeAnimation - return fmt.Sprintf("FileTypeAnimation%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeAnimation) TypeID() uint32 { - return FileTypeAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeAnimation) TypeName() string { - return "fileTypeAnimation" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeAnimation", - ID: FileTypeAnimationTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeAnimation) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeAnimation#eeaa7dba as nil") - } - b.PutID(FileTypeAnimationTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeAnimation) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeAnimation#eeaa7dba as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeAnimation) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeAnimation#eeaa7dba to nil") - } - if err := b.ConsumeID(FileTypeAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeAnimation#eeaa7dba: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeAnimation) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeAnimation#eeaa7dba to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeAnimation#eeaa7dba as nil") - } - b.ObjStart() - b.PutID("fileTypeAnimation") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeAnimation#eeaa7dba to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeAnimation"); err != nil { - return fmt.Errorf("unable to decode fileTypeAnimation#eeaa7dba: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeAudio represents TL type `fileTypeAudio#d5bbcea0`. -type FileTypeAudio struct { -} - -// FileTypeAudioTypeID is TL type id of FileTypeAudio. -const FileTypeAudioTypeID = 0xd5bbcea0 - -// construct implements constructor of FileTypeClass. -func (f FileTypeAudio) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeAudio. -var ( - _ bin.Encoder = &FileTypeAudio{} - _ bin.Decoder = &FileTypeAudio{} - _ bin.BareEncoder = &FileTypeAudio{} - _ bin.BareDecoder = &FileTypeAudio{} - - _ FileTypeClass = &FileTypeAudio{} -) - -func (f *FileTypeAudio) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeAudio) String() string { - if f == nil { - return "FileTypeAudio(nil)" - } - type Alias FileTypeAudio - return fmt.Sprintf("FileTypeAudio%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeAudio) TypeID() uint32 { - return FileTypeAudioTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeAudio) TypeName() string { - return "fileTypeAudio" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeAudio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeAudio", - ID: FileTypeAudioTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeAudio) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeAudio#d5bbcea0 as nil") - } - b.PutID(FileTypeAudioTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeAudio) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeAudio#d5bbcea0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeAudio) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeAudio#d5bbcea0 to nil") - } - if err := b.ConsumeID(FileTypeAudioTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeAudio#d5bbcea0: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeAudio) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeAudio#d5bbcea0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeAudio) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeAudio#d5bbcea0 as nil") - } - b.ObjStart() - b.PutID("fileTypeAudio") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeAudio) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeAudio#d5bbcea0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeAudio"); err != nil { - return fmt.Errorf("unable to decode fileTypeAudio#d5bbcea0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeDocument represents TL type `fileTypeDocument#de57030f`. -type FileTypeDocument struct { -} - -// FileTypeDocumentTypeID is TL type id of FileTypeDocument. -const FileTypeDocumentTypeID = 0xde57030f - -// construct implements constructor of FileTypeClass. -func (f FileTypeDocument) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeDocument. -var ( - _ bin.Encoder = &FileTypeDocument{} - _ bin.Decoder = &FileTypeDocument{} - _ bin.BareEncoder = &FileTypeDocument{} - _ bin.BareDecoder = &FileTypeDocument{} - - _ FileTypeClass = &FileTypeDocument{} -) - -func (f *FileTypeDocument) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeDocument) String() string { - if f == nil { - return "FileTypeDocument(nil)" - } - type Alias FileTypeDocument - return fmt.Sprintf("FileTypeDocument%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeDocument) TypeID() uint32 { - return FileTypeDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeDocument) TypeName() string { - return "fileTypeDocument" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeDocument", - ID: FileTypeDocumentTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeDocument) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeDocument#de57030f as nil") - } - b.PutID(FileTypeDocumentTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeDocument) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeDocument#de57030f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeDocument) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeDocument#de57030f to nil") - } - if err := b.ConsumeID(FileTypeDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeDocument#de57030f: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeDocument) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeDocument#de57030f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeDocument#de57030f as nil") - } - b.ObjStart() - b.PutID("fileTypeDocument") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeDocument#de57030f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeDocument"); err != nil { - return fmt.Errorf("unable to decode fileTypeDocument#de57030f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeNotificationSound represents TL type `fileTypeNotificationSound#c32f9f09`. -type FileTypeNotificationSound struct { -} - -// FileTypeNotificationSoundTypeID is TL type id of FileTypeNotificationSound. -const FileTypeNotificationSoundTypeID = 0xc32f9f09 - -// construct implements constructor of FileTypeClass. -func (f FileTypeNotificationSound) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeNotificationSound. -var ( - _ bin.Encoder = &FileTypeNotificationSound{} - _ bin.Decoder = &FileTypeNotificationSound{} - _ bin.BareEncoder = &FileTypeNotificationSound{} - _ bin.BareDecoder = &FileTypeNotificationSound{} - - _ FileTypeClass = &FileTypeNotificationSound{} -) - -func (f *FileTypeNotificationSound) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeNotificationSound) String() string { - if f == nil { - return "FileTypeNotificationSound(nil)" - } - type Alias FileTypeNotificationSound - return fmt.Sprintf("FileTypeNotificationSound%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeNotificationSound) TypeID() uint32 { - return FileTypeNotificationSoundTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeNotificationSound) TypeName() string { - return "fileTypeNotificationSound" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeNotificationSound) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeNotificationSound", - ID: FileTypeNotificationSoundTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeNotificationSound) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeNotificationSound#c32f9f09 as nil") - } - b.PutID(FileTypeNotificationSoundTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeNotificationSound) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeNotificationSound#c32f9f09 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeNotificationSound) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeNotificationSound#c32f9f09 to nil") - } - if err := b.ConsumeID(FileTypeNotificationSoundTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeNotificationSound#c32f9f09: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeNotificationSound) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeNotificationSound#c32f9f09 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeNotificationSound) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeNotificationSound#c32f9f09 as nil") - } - b.ObjStart() - b.PutID("fileTypeNotificationSound") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeNotificationSound) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeNotificationSound#c32f9f09 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeNotificationSound"); err != nil { - return fmt.Errorf("unable to decode fileTypeNotificationSound#c32f9f09: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypePhoto represents TL type `fileTypePhoto#998b71a5`. -type FileTypePhoto struct { -} - -// FileTypePhotoTypeID is TL type id of FileTypePhoto. -const FileTypePhotoTypeID = 0x998b71a5 - -// construct implements constructor of FileTypeClass. -func (f FileTypePhoto) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypePhoto. -var ( - _ bin.Encoder = &FileTypePhoto{} - _ bin.Decoder = &FileTypePhoto{} - _ bin.BareEncoder = &FileTypePhoto{} - _ bin.BareDecoder = &FileTypePhoto{} - - _ FileTypeClass = &FileTypePhoto{} -) - -func (f *FileTypePhoto) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypePhoto) String() string { - if f == nil { - return "FileTypePhoto(nil)" - } - type Alias FileTypePhoto - return fmt.Sprintf("FileTypePhoto%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypePhoto) TypeID() uint32 { - return FileTypePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypePhoto) TypeName() string { - return "fileTypePhoto" -} - -// TypeInfo returns info about TL type. -func (f *FileTypePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypePhoto", - ID: FileTypePhotoTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypePhoto) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypePhoto#998b71a5 as nil") - } - b.PutID(FileTypePhotoTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypePhoto) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypePhoto#998b71a5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypePhoto) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypePhoto#998b71a5 to nil") - } - if err := b.ConsumeID(FileTypePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypePhoto#998b71a5: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypePhoto) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypePhoto#998b71a5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypePhoto#998b71a5 as nil") - } - b.ObjStart() - b.PutID("fileTypePhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypePhoto#998b71a5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypePhoto"); err != nil { - return fmt.Errorf("unable to decode fileTypePhoto#998b71a5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypePhotoStory represents TL type `fileTypePhotoStory#78576ef4`. -type FileTypePhotoStory struct { -} - -// FileTypePhotoStoryTypeID is TL type id of FileTypePhotoStory. -const FileTypePhotoStoryTypeID = 0x78576ef4 - -// construct implements constructor of FileTypeClass. -func (f FileTypePhotoStory) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypePhotoStory. -var ( - _ bin.Encoder = &FileTypePhotoStory{} - _ bin.Decoder = &FileTypePhotoStory{} - _ bin.BareEncoder = &FileTypePhotoStory{} - _ bin.BareDecoder = &FileTypePhotoStory{} - - _ FileTypeClass = &FileTypePhotoStory{} -) - -func (f *FileTypePhotoStory) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypePhotoStory) String() string { - if f == nil { - return "FileTypePhotoStory(nil)" - } - type Alias FileTypePhotoStory - return fmt.Sprintf("FileTypePhotoStory%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypePhotoStory) TypeID() uint32 { - return FileTypePhotoStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypePhotoStory) TypeName() string { - return "fileTypePhotoStory" -} - -// TypeInfo returns info about TL type. -func (f *FileTypePhotoStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypePhotoStory", - ID: FileTypePhotoStoryTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypePhotoStory) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypePhotoStory#78576ef4 as nil") - } - b.PutID(FileTypePhotoStoryTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypePhotoStory) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypePhotoStory#78576ef4 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypePhotoStory) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypePhotoStory#78576ef4 to nil") - } - if err := b.ConsumeID(FileTypePhotoStoryTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypePhotoStory#78576ef4: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypePhotoStory) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypePhotoStory#78576ef4 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypePhotoStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypePhotoStory#78576ef4 as nil") - } - b.ObjStart() - b.PutID("fileTypePhotoStory") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypePhotoStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypePhotoStory#78576ef4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypePhotoStory"); err != nil { - return fmt.Errorf("unable to decode fileTypePhotoStory#78576ef4: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeProfilePhoto represents TL type `fileTypeProfilePhoto#6afee3a3`. -type FileTypeProfilePhoto struct { -} - -// FileTypeProfilePhotoTypeID is TL type id of FileTypeProfilePhoto. -const FileTypeProfilePhotoTypeID = 0x6afee3a3 - -// construct implements constructor of FileTypeClass. -func (f FileTypeProfilePhoto) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeProfilePhoto. -var ( - _ bin.Encoder = &FileTypeProfilePhoto{} - _ bin.Decoder = &FileTypeProfilePhoto{} - _ bin.BareEncoder = &FileTypeProfilePhoto{} - _ bin.BareDecoder = &FileTypeProfilePhoto{} - - _ FileTypeClass = &FileTypeProfilePhoto{} -) - -func (f *FileTypeProfilePhoto) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeProfilePhoto) String() string { - if f == nil { - return "FileTypeProfilePhoto(nil)" - } - type Alias FileTypeProfilePhoto - return fmt.Sprintf("FileTypeProfilePhoto%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeProfilePhoto) TypeID() uint32 { - return FileTypeProfilePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeProfilePhoto) TypeName() string { - return "fileTypeProfilePhoto" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeProfilePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeProfilePhoto", - ID: FileTypeProfilePhotoTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeProfilePhoto) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeProfilePhoto#6afee3a3 as nil") - } - b.PutID(FileTypeProfilePhotoTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeProfilePhoto) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeProfilePhoto#6afee3a3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeProfilePhoto) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeProfilePhoto#6afee3a3 to nil") - } - if err := b.ConsumeID(FileTypeProfilePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeProfilePhoto#6afee3a3: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeProfilePhoto) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeProfilePhoto#6afee3a3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeProfilePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeProfilePhoto#6afee3a3 as nil") - } - b.ObjStart() - b.PutID("fileTypeProfilePhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeProfilePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeProfilePhoto#6afee3a3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeProfilePhoto"); err != nil { - return fmt.Errorf("unable to decode fileTypeProfilePhoto#6afee3a3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeSecret represents TL type `fileTypeSecret#906d14f7`. -type FileTypeSecret struct { -} - -// FileTypeSecretTypeID is TL type id of FileTypeSecret. -const FileTypeSecretTypeID = 0x906d14f7 - -// construct implements constructor of FileTypeClass. -func (f FileTypeSecret) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeSecret. -var ( - _ bin.Encoder = &FileTypeSecret{} - _ bin.Decoder = &FileTypeSecret{} - _ bin.BareEncoder = &FileTypeSecret{} - _ bin.BareDecoder = &FileTypeSecret{} - - _ FileTypeClass = &FileTypeSecret{} -) - -func (f *FileTypeSecret) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeSecret) String() string { - if f == nil { - return "FileTypeSecret(nil)" - } - type Alias FileTypeSecret - return fmt.Sprintf("FileTypeSecret%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeSecret) TypeID() uint32 { - return FileTypeSecretTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeSecret) TypeName() string { - return "fileTypeSecret" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeSecret) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeSecret", - ID: FileTypeSecretTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeSecret) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSecret#906d14f7 as nil") - } - b.PutID(FileTypeSecretTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeSecret) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSecret#906d14f7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeSecret) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSecret#906d14f7 to nil") - } - if err := b.ConsumeID(FileTypeSecretTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeSecret#906d14f7: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeSecret) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSecret#906d14f7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeSecret) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSecret#906d14f7 as nil") - } - b.ObjStart() - b.PutID("fileTypeSecret") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeSecret) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSecret#906d14f7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeSecret"); err != nil { - return fmt.Errorf("unable to decode fileTypeSecret#906d14f7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeSecretThumbnail represents TL type `fileTypeSecretThumbnail#ac797636`. -type FileTypeSecretThumbnail struct { -} - -// FileTypeSecretThumbnailTypeID is TL type id of FileTypeSecretThumbnail. -const FileTypeSecretThumbnailTypeID = 0xac797636 - -// construct implements constructor of FileTypeClass. -func (f FileTypeSecretThumbnail) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeSecretThumbnail. -var ( - _ bin.Encoder = &FileTypeSecretThumbnail{} - _ bin.Decoder = &FileTypeSecretThumbnail{} - _ bin.BareEncoder = &FileTypeSecretThumbnail{} - _ bin.BareDecoder = &FileTypeSecretThumbnail{} - - _ FileTypeClass = &FileTypeSecretThumbnail{} -) - -func (f *FileTypeSecretThumbnail) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeSecretThumbnail) String() string { - if f == nil { - return "FileTypeSecretThumbnail(nil)" - } - type Alias FileTypeSecretThumbnail - return fmt.Sprintf("FileTypeSecretThumbnail%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeSecretThumbnail) TypeID() uint32 { - return FileTypeSecretThumbnailTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeSecretThumbnail) TypeName() string { - return "fileTypeSecretThumbnail" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeSecretThumbnail) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeSecretThumbnail", - ID: FileTypeSecretThumbnailTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeSecretThumbnail) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSecretThumbnail#ac797636 as nil") - } - b.PutID(FileTypeSecretThumbnailTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeSecretThumbnail) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSecretThumbnail#ac797636 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeSecretThumbnail) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSecretThumbnail#ac797636 to nil") - } - if err := b.ConsumeID(FileTypeSecretThumbnailTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeSecretThumbnail#ac797636: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeSecretThumbnail) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSecretThumbnail#ac797636 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeSecretThumbnail) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSecretThumbnail#ac797636 as nil") - } - b.ObjStart() - b.PutID("fileTypeSecretThumbnail") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeSecretThumbnail) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSecretThumbnail#ac797636 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeSecretThumbnail"); err != nil { - return fmt.Errorf("unable to decode fileTypeSecretThumbnail#ac797636: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeSecure represents TL type `fileTypeSecure#ab69bf26`. -type FileTypeSecure struct { -} - -// FileTypeSecureTypeID is TL type id of FileTypeSecure. -const FileTypeSecureTypeID = 0xab69bf26 - -// construct implements constructor of FileTypeClass. -func (f FileTypeSecure) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeSecure. -var ( - _ bin.Encoder = &FileTypeSecure{} - _ bin.Decoder = &FileTypeSecure{} - _ bin.BareEncoder = &FileTypeSecure{} - _ bin.BareDecoder = &FileTypeSecure{} - - _ FileTypeClass = &FileTypeSecure{} -) - -func (f *FileTypeSecure) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeSecure) String() string { - if f == nil { - return "FileTypeSecure(nil)" - } - type Alias FileTypeSecure - return fmt.Sprintf("FileTypeSecure%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeSecure) TypeID() uint32 { - return FileTypeSecureTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeSecure) TypeName() string { - return "fileTypeSecure" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeSecure) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeSecure", - ID: FileTypeSecureTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeSecure) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSecure#ab69bf26 as nil") - } - b.PutID(FileTypeSecureTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeSecure) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSecure#ab69bf26 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeSecure) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSecure#ab69bf26 to nil") - } - if err := b.ConsumeID(FileTypeSecureTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeSecure#ab69bf26: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeSecure) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSecure#ab69bf26 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeSecure) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSecure#ab69bf26 as nil") - } - b.ObjStart() - b.PutID("fileTypeSecure") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeSecure) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSecure#ab69bf26 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeSecure"); err != nil { - return fmt.Errorf("unable to decode fileTypeSecure#ab69bf26: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeSelfDestructingPhoto represents TL type `fileTypeSelfDestructingPhoto#7bcf329b`. -type FileTypeSelfDestructingPhoto struct { -} - -// FileTypeSelfDestructingPhotoTypeID is TL type id of FileTypeSelfDestructingPhoto. -const FileTypeSelfDestructingPhotoTypeID = 0x7bcf329b - -// construct implements constructor of FileTypeClass. -func (f FileTypeSelfDestructingPhoto) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeSelfDestructingPhoto. -var ( - _ bin.Encoder = &FileTypeSelfDestructingPhoto{} - _ bin.Decoder = &FileTypeSelfDestructingPhoto{} - _ bin.BareEncoder = &FileTypeSelfDestructingPhoto{} - _ bin.BareDecoder = &FileTypeSelfDestructingPhoto{} - - _ FileTypeClass = &FileTypeSelfDestructingPhoto{} -) - -func (f *FileTypeSelfDestructingPhoto) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeSelfDestructingPhoto) String() string { - if f == nil { - return "FileTypeSelfDestructingPhoto(nil)" - } - type Alias FileTypeSelfDestructingPhoto - return fmt.Sprintf("FileTypeSelfDestructingPhoto%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeSelfDestructingPhoto) TypeID() uint32 { - return FileTypeSelfDestructingPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeSelfDestructingPhoto) TypeName() string { - return "fileTypeSelfDestructingPhoto" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeSelfDestructingPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeSelfDestructingPhoto", - ID: FileTypeSelfDestructingPhotoTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeSelfDestructingPhoto) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingPhoto#7bcf329b as nil") - } - b.PutID(FileTypeSelfDestructingPhotoTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeSelfDestructingPhoto) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingPhoto#7bcf329b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeSelfDestructingPhoto) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingPhoto#7bcf329b to nil") - } - if err := b.ConsumeID(FileTypeSelfDestructingPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeSelfDestructingPhoto#7bcf329b: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeSelfDestructingPhoto) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingPhoto#7bcf329b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeSelfDestructingPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingPhoto#7bcf329b as nil") - } - b.ObjStart() - b.PutID("fileTypeSelfDestructingPhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeSelfDestructingPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingPhoto#7bcf329b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeSelfDestructingPhoto"); err != nil { - return fmt.Errorf("unable to decode fileTypeSelfDestructingPhoto#7bcf329b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeSelfDestructingVideo represents TL type `fileTypeSelfDestructingVideo#b70cc425`. -type FileTypeSelfDestructingVideo struct { -} - -// FileTypeSelfDestructingVideoTypeID is TL type id of FileTypeSelfDestructingVideo. -const FileTypeSelfDestructingVideoTypeID = 0xb70cc425 - -// construct implements constructor of FileTypeClass. -func (f FileTypeSelfDestructingVideo) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeSelfDestructingVideo. -var ( - _ bin.Encoder = &FileTypeSelfDestructingVideo{} - _ bin.Decoder = &FileTypeSelfDestructingVideo{} - _ bin.BareEncoder = &FileTypeSelfDestructingVideo{} - _ bin.BareDecoder = &FileTypeSelfDestructingVideo{} - - _ FileTypeClass = &FileTypeSelfDestructingVideo{} -) - -func (f *FileTypeSelfDestructingVideo) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeSelfDestructingVideo) String() string { - if f == nil { - return "FileTypeSelfDestructingVideo(nil)" - } - type Alias FileTypeSelfDestructingVideo - return fmt.Sprintf("FileTypeSelfDestructingVideo%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeSelfDestructingVideo) TypeID() uint32 { - return FileTypeSelfDestructingVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeSelfDestructingVideo) TypeName() string { - return "fileTypeSelfDestructingVideo" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeSelfDestructingVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeSelfDestructingVideo", - ID: FileTypeSelfDestructingVideoTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeSelfDestructingVideo) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingVideo#b70cc425 as nil") - } - b.PutID(FileTypeSelfDestructingVideoTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeSelfDestructingVideo) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingVideo#b70cc425 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeSelfDestructingVideo) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingVideo#b70cc425 to nil") - } - if err := b.ConsumeID(FileTypeSelfDestructingVideoTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeSelfDestructingVideo#b70cc425: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeSelfDestructingVideo) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingVideo#b70cc425 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeSelfDestructingVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingVideo#b70cc425 as nil") - } - b.ObjStart() - b.PutID("fileTypeSelfDestructingVideo") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeSelfDestructingVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingVideo#b70cc425 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeSelfDestructingVideo"); err != nil { - return fmt.Errorf("unable to decode fileTypeSelfDestructingVideo#b70cc425: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeSelfDestructingVideoNote represents TL type `fileTypeSelfDestructingVideoNote#592012c1`. -type FileTypeSelfDestructingVideoNote struct { -} - -// FileTypeSelfDestructingVideoNoteTypeID is TL type id of FileTypeSelfDestructingVideoNote. -const FileTypeSelfDestructingVideoNoteTypeID = 0x592012c1 - -// construct implements constructor of FileTypeClass. -func (f FileTypeSelfDestructingVideoNote) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeSelfDestructingVideoNote. -var ( - _ bin.Encoder = &FileTypeSelfDestructingVideoNote{} - _ bin.Decoder = &FileTypeSelfDestructingVideoNote{} - _ bin.BareEncoder = &FileTypeSelfDestructingVideoNote{} - _ bin.BareDecoder = &FileTypeSelfDestructingVideoNote{} - - _ FileTypeClass = &FileTypeSelfDestructingVideoNote{} -) - -func (f *FileTypeSelfDestructingVideoNote) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeSelfDestructingVideoNote) String() string { - if f == nil { - return "FileTypeSelfDestructingVideoNote(nil)" - } - type Alias FileTypeSelfDestructingVideoNote - return fmt.Sprintf("FileTypeSelfDestructingVideoNote%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeSelfDestructingVideoNote) TypeID() uint32 { - return FileTypeSelfDestructingVideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeSelfDestructingVideoNote) TypeName() string { - return "fileTypeSelfDestructingVideoNote" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeSelfDestructingVideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeSelfDestructingVideoNote", - ID: FileTypeSelfDestructingVideoNoteTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeSelfDestructingVideoNote) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingVideoNote#592012c1 as nil") - } - b.PutID(FileTypeSelfDestructingVideoNoteTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeSelfDestructingVideoNote) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingVideoNote#592012c1 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeSelfDestructingVideoNote) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingVideoNote#592012c1 to nil") - } - if err := b.ConsumeID(FileTypeSelfDestructingVideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeSelfDestructingVideoNote#592012c1: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeSelfDestructingVideoNote) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingVideoNote#592012c1 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeSelfDestructingVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingVideoNote#592012c1 as nil") - } - b.ObjStart() - b.PutID("fileTypeSelfDestructingVideoNote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeSelfDestructingVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingVideoNote#592012c1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeSelfDestructingVideoNote"); err != nil { - return fmt.Errorf("unable to decode fileTypeSelfDestructingVideoNote#592012c1: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeSelfDestructingVoiceNote represents TL type `fileTypeSelfDestructingVoiceNote#64d0db1d`. -type FileTypeSelfDestructingVoiceNote struct { -} - -// FileTypeSelfDestructingVoiceNoteTypeID is TL type id of FileTypeSelfDestructingVoiceNote. -const FileTypeSelfDestructingVoiceNoteTypeID = 0x64d0db1d - -// construct implements constructor of FileTypeClass. -func (f FileTypeSelfDestructingVoiceNote) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeSelfDestructingVoiceNote. -var ( - _ bin.Encoder = &FileTypeSelfDestructingVoiceNote{} - _ bin.Decoder = &FileTypeSelfDestructingVoiceNote{} - _ bin.BareEncoder = &FileTypeSelfDestructingVoiceNote{} - _ bin.BareDecoder = &FileTypeSelfDestructingVoiceNote{} - - _ FileTypeClass = &FileTypeSelfDestructingVoiceNote{} -) - -func (f *FileTypeSelfDestructingVoiceNote) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeSelfDestructingVoiceNote) String() string { - if f == nil { - return "FileTypeSelfDestructingVoiceNote(nil)" - } - type Alias FileTypeSelfDestructingVoiceNote - return fmt.Sprintf("FileTypeSelfDestructingVoiceNote%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeSelfDestructingVoiceNote) TypeID() uint32 { - return FileTypeSelfDestructingVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeSelfDestructingVoiceNote) TypeName() string { - return "fileTypeSelfDestructingVoiceNote" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeSelfDestructingVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeSelfDestructingVoiceNote", - ID: FileTypeSelfDestructingVoiceNoteTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeSelfDestructingVoiceNote) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingVoiceNote#64d0db1d as nil") - } - b.PutID(FileTypeSelfDestructingVoiceNoteTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeSelfDestructingVoiceNote) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingVoiceNote#64d0db1d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeSelfDestructingVoiceNote) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingVoiceNote#64d0db1d to nil") - } - if err := b.ConsumeID(FileTypeSelfDestructingVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeSelfDestructingVoiceNote#64d0db1d: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeSelfDestructingVoiceNote) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingVoiceNote#64d0db1d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeSelfDestructingVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSelfDestructingVoiceNote#64d0db1d as nil") - } - b.ObjStart() - b.PutID("fileTypeSelfDestructingVoiceNote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeSelfDestructingVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSelfDestructingVoiceNote#64d0db1d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeSelfDestructingVoiceNote"); err != nil { - return fmt.Errorf("unable to decode fileTypeSelfDestructingVoiceNote#64d0db1d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeSticker represents TL type `fileTypeSticker#1c537c69`. -type FileTypeSticker struct { -} - -// FileTypeStickerTypeID is TL type id of FileTypeSticker. -const FileTypeStickerTypeID = 0x1c537c69 - -// construct implements constructor of FileTypeClass. -func (f FileTypeSticker) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeSticker. -var ( - _ bin.Encoder = &FileTypeSticker{} - _ bin.Decoder = &FileTypeSticker{} - _ bin.BareEncoder = &FileTypeSticker{} - _ bin.BareDecoder = &FileTypeSticker{} - - _ FileTypeClass = &FileTypeSticker{} -) - -func (f *FileTypeSticker) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeSticker) String() string { - if f == nil { - return "FileTypeSticker(nil)" - } - type Alias FileTypeSticker - return fmt.Sprintf("FileTypeSticker%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeSticker) TypeID() uint32 { - return FileTypeStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeSticker) TypeName() string { - return "fileTypeSticker" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeSticker", - ID: FileTypeStickerTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeSticker) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSticker#1c537c69 as nil") - } - b.PutID(FileTypeStickerTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeSticker) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSticker#1c537c69 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeSticker) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSticker#1c537c69 to nil") - } - if err := b.ConsumeID(FileTypeStickerTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeSticker#1c537c69: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeSticker) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSticker#1c537c69 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeSticker#1c537c69 as nil") - } - b.ObjStart() - b.PutID("fileTypeSticker") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeSticker#1c537c69 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeSticker"); err != nil { - return fmt.Errorf("unable to decode fileTypeSticker#1c537c69: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeThumbnail represents TL type `fileTypeThumbnail#ff42215e`. -type FileTypeThumbnail struct { -} - -// FileTypeThumbnailTypeID is TL type id of FileTypeThumbnail. -const FileTypeThumbnailTypeID = 0xff42215e - -// construct implements constructor of FileTypeClass. -func (f FileTypeThumbnail) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeThumbnail. -var ( - _ bin.Encoder = &FileTypeThumbnail{} - _ bin.Decoder = &FileTypeThumbnail{} - _ bin.BareEncoder = &FileTypeThumbnail{} - _ bin.BareDecoder = &FileTypeThumbnail{} - - _ FileTypeClass = &FileTypeThumbnail{} -) - -func (f *FileTypeThumbnail) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeThumbnail) String() string { - if f == nil { - return "FileTypeThumbnail(nil)" - } - type Alias FileTypeThumbnail - return fmt.Sprintf("FileTypeThumbnail%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeThumbnail) TypeID() uint32 { - return FileTypeThumbnailTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeThumbnail) TypeName() string { - return "fileTypeThumbnail" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeThumbnail) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeThumbnail", - ID: FileTypeThumbnailTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeThumbnail) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeThumbnail#ff42215e as nil") - } - b.PutID(FileTypeThumbnailTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeThumbnail) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeThumbnail#ff42215e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeThumbnail) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeThumbnail#ff42215e to nil") - } - if err := b.ConsumeID(FileTypeThumbnailTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeThumbnail#ff42215e: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeThumbnail) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeThumbnail#ff42215e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeThumbnail) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeThumbnail#ff42215e as nil") - } - b.ObjStart() - b.PutID("fileTypeThumbnail") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeThumbnail) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeThumbnail#ff42215e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeThumbnail"); err != nil { - return fmt.Errorf("unable to decode fileTypeThumbnail#ff42215e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeUnknown represents TL type `fileTypeUnknown#8819ed50`. -type FileTypeUnknown struct { -} - -// FileTypeUnknownTypeID is TL type id of FileTypeUnknown. -const FileTypeUnknownTypeID = 0x8819ed50 - -// construct implements constructor of FileTypeClass. -func (f FileTypeUnknown) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeUnknown. -var ( - _ bin.Encoder = &FileTypeUnknown{} - _ bin.Decoder = &FileTypeUnknown{} - _ bin.BareEncoder = &FileTypeUnknown{} - _ bin.BareDecoder = &FileTypeUnknown{} - - _ FileTypeClass = &FileTypeUnknown{} -) - -func (f *FileTypeUnknown) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeUnknown) String() string { - if f == nil { - return "FileTypeUnknown(nil)" - } - type Alias FileTypeUnknown - return fmt.Sprintf("FileTypeUnknown%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeUnknown) TypeID() uint32 { - return FileTypeUnknownTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeUnknown) TypeName() string { - return "fileTypeUnknown" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeUnknown) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeUnknown", - ID: FileTypeUnknownTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeUnknown) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeUnknown#8819ed50 as nil") - } - b.PutID(FileTypeUnknownTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeUnknown) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeUnknown#8819ed50 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeUnknown) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeUnknown#8819ed50 to nil") - } - if err := b.ConsumeID(FileTypeUnknownTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeUnknown#8819ed50: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeUnknown) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeUnknown#8819ed50 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeUnknown) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeUnknown#8819ed50 as nil") - } - b.ObjStart() - b.PutID("fileTypeUnknown") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeUnknown) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeUnknown#8819ed50 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeUnknown"); err != nil { - return fmt.Errorf("unable to decode fileTypeUnknown#8819ed50: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeVideo represents TL type `fileTypeVideo#5548871b`. -type FileTypeVideo struct { -} - -// FileTypeVideoTypeID is TL type id of FileTypeVideo. -const FileTypeVideoTypeID = 0x5548871b - -// construct implements constructor of FileTypeClass. -func (f FileTypeVideo) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeVideo. -var ( - _ bin.Encoder = &FileTypeVideo{} - _ bin.Decoder = &FileTypeVideo{} - _ bin.BareEncoder = &FileTypeVideo{} - _ bin.BareDecoder = &FileTypeVideo{} - - _ FileTypeClass = &FileTypeVideo{} -) - -func (f *FileTypeVideo) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeVideo) String() string { - if f == nil { - return "FileTypeVideo(nil)" - } - type Alias FileTypeVideo - return fmt.Sprintf("FileTypeVideo%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeVideo) TypeID() uint32 { - return FileTypeVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeVideo) TypeName() string { - return "fileTypeVideo" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeVideo", - ID: FileTypeVideoTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeVideo) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVideo#5548871b as nil") - } - b.PutID(FileTypeVideoTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeVideo) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVideo#5548871b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeVideo) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVideo#5548871b to nil") - } - if err := b.ConsumeID(FileTypeVideoTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeVideo#5548871b: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeVideo) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVideo#5548871b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVideo#5548871b as nil") - } - b.ObjStart() - b.PutID("fileTypeVideo") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVideo#5548871b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeVideo"); err != nil { - return fmt.Errorf("unable to decode fileTypeVideo#5548871b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeVideoNote represents TL type `fileTypeVideoNote#e119a79f`. -type FileTypeVideoNote struct { -} - -// FileTypeVideoNoteTypeID is TL type id of FileTypeVideoNote. -const FileTypeVideoNoteTypeID = 0xe119a79f - -// construct implements constructor of FileTypeClass. -func (f FileTypeVideoNote) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeVideoNote. -var ( - _ bin.Encoder = &FileTypeVideoNote{} - _ bin.Decoder = &FileTypeVideoNote{} - _ bin.BareEncoder = &FileTypeVideoNote{} - _ bin.BareDecoder = &FileTypeVideoNote{} - - _ FileTypeClass = &FileTypeVideoNote{} -) - -func (f *FileTypeVideoNote) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeVideoNote) String() string { - if f == nil { - return "FileTypeVideoNote(nil)" - } - type Alias FileTypeVideoNote - return fmt.Sprintf("FileTypeVideoNote%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeVideoNote) TypeID() uint32 { - return FileTypeVideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeVideoNote) TypeName() string { - return "fileTypeVideoNote" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeVideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeVideoNote", - ID: FileTypeVideoNoteTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeVideoNote) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVideoNote#e119a79f as nil") - } - b.PutID(FileTypeVideoNoteTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeVideoNote) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVideoNote#e119a79f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeVideoNote) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVideoNote#e119a79f to nil") - } - if err := b.ConsumeID(FileTypeVideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeVideoNote#e119a79f: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeVideoNote) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVideoNote#e119a79f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVideoNote#e119a79f as nil") - } - b.ObjStart() - b.PutID("fileTypeVideoNote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVideoNote#e119a79f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeVideoNote"); err != nil { - return fmt.Errorf("unable to decode fileTypeVideoNote#e119a79f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeVideoStory represents TL type `fileTypeVideoStory#800b21a1`. -type FileTypeVideoStory struct { -} - -// FileTypeVideoStoryTypeID is TL type id of FileTypeVideoStory. -const FileTypeVideoStoryTypeID = 0x800b21a1 - -// construct implements constructor of FileTypeClass. -func (f FileTypeVideoStory) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeVideoStory. -var ( - _ bin.Encoder = &FileTypeVideoStory{} - _ bin.Decoder = &FileTypeVideoStory{} - _ bin.BareEncoder = &FileTypeVideoStory{} - _ bin.BareDecoder = &FileTypeVideoStory{} - - _ FileTypeClass = &FileTypeVideoStory{} -) - -func (f *FileTypeVideoStory) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeVideoStory) String() string { - if f == nil { - return "FileTypeVideoStory(nil)" - } - type Alias FileTypeVideoStory - return fmt.Sprintf("FileTypeVideoStory%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeVideoStory) TypeID() uint32 { - return FileTypeVideoStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeVideoStory) TypeName() string { - return "fileTypeVideoStory" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeVideoStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeVideoStory", - ID: FileTypeVideoStoryTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeVideoStory) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVideoStory#800b21a1 as nil") - } - b.PutID(FileTypeVideoStoryTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeVideoStory) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVideoStory#800b21a1 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeVideoStory) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVideoStory#800b21a1 to nil") - } - if err := b.ConsumeID(FileTypeVideoStoryTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeVideoStory#800b21a1: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeVideoStory) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVideoStory#800b21a1 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeVideoStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVideoStory#800b21a1 as nil") - } - b.ObjStart() - b.PutID("fileTypeVideoStory") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeVideoStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVideoStory#800b21a1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeVideoStory"); err != nil { - return fmt.Errorf("unable to decode fileTypeVideoStory#800b21a1: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeVoiceNote represents TL type `fileTypeVoiceNote#dce96e43`. -type FileTypeVoiceNote struct { -} - -// FileTypeVoiceNoteTypeID is TL type id of FileTypeVoiceNote. -const FileTypeVoiceNoteTypeID = 0xdce96e43 - -// construct implements constructor of FileTypeClass. -func (f FileTypeVoiceNote) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeVoiceNote. -var ( - _ bin.Encoder = &FileTypeVoiceNote{} - _ bin.Decoder = &FileTypeVoiceNote{} - _ bin.BareEncoder = &FileTypeVoiceNote{} - _ bin.BareDecoder = &FileTypeVoiceNote{} - - _ FileTypeClass = &FileTypeVoiceNote{} -) - -func (f *FileTypeVoiceNote) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeVoiceNote) String() string { - if f == nil { - return "FileTypeVoiceNote(nil)" - } - type Alias FileTypeVoiceNote - return fmt.Sprintf("FileTypeVoiceNote%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeVoiceNote) TypeID() uint32 { - return FileTypeVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeVoiceNote) TypeName() string { - return "fileTypeVoiceNote" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeVoiceNote", - ID: FileTypeVoiceNoteTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeVoiceNote) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVoiceNote#dce96e43 as nil") - } - b.PutID(FileTypeVoiceNoteTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeVoiceNote) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVoiceNote#dce96e43 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeVoiceNote) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVoiceNote#dce96e43 to nil") - } - if err := b.ConsumeID(FileTypeVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeVoiceNote#dce96e43: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeVoiceNote) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVoiceNote#dce96e43 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeVoiceNote#dce96e43 as nil") - } - b.ObjStart() - b.PutID("fileTypeVoiceNote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeVoiceNote#dce96e43 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeVoiceNote"); err != nil { - return fmt.Errorf("unable to decode fileTypeVoiceNote#dce96e43: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeWallpaper represents TL type `fileTypeWallpaper#6e8ffc9c`. -type FileTypeWallpaper struct { -} - -// FileTypeWallpaperTypeID is TL type id of FileTypeWallpaper. -const FileTypeWallpaperTypeID = 0x6e8ffc9c - -// construct implements constructor of FileTypeClass. -func (f FileTypeWallpaper) construct() FileTypeClass { return &f } - -// Ensuring interfaces in compile-time for FileTypeWallpaper. -var ( - _ bin.Encoder = &FileTypeWallpaper{} - _ bin.Decoder = &FileTypeWallpaper{} - _ bin.BareEncoder = &FileTypeWallpaper{} - _ bin.BareDecoder = &FileTypeWallpaper{} - - _ FileTypeClass = &FileTypeWallpaper{} -) - -func (f *FileTypeWallpaper) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FileTypeWallpaper) String() string { - if f == nil { - return "FileTypeWallpaper(nil)" - } - type Alias FileTypeWallpaper - return fmt.Sprintf("FileTypeWallpaper%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FileTypeWallpaper) TypeID() uint32 { - return FileTypeWallpaperTypeID -} - -// TypeName returns name of type in TL schema. -func (*FileTypeWallpaper) TypeName() string { - return "fileTypeWallpaper" -} - -// TypeInfo returns info about TL type. -func (f *FileTypeWallpaper) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "fileTypeWallpaper", - ID: FileTypeWallpaperTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FileTypeWallpaper) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeWallpaper#6e8ffc9c as nil") - } - b.PutID(FileTypeWallpaperTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FileTypeWallpaper) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeWallpaper#6e8ffc9c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FileTypeWallpaper) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeWallpaper#6e8ffc9c to nil") - } - if err := b.ConsumeID(FileTypeWallpaperTypeID); err != nil { - return fmt.Errorf("unable to decode fileTypeWallpaper#6e8ffc9c: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FileTypeWallpaper) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeWallpaper#6e8ffc9c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FileTypeWallpaper) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode fileTypeWallpaper#6e8ffc9c as nil") - } - b.ObjStart() - b.PutID("fileTypeWallpaper") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FileTypeWallpaper) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode fileTypeWallpaper#6e8ffc9c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("fileTypeWallpaper"); err != nil { - return fmt.Errorf("unable to decode fileTypeWallpaper#6e8ffc9c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FileTypeClassName is schema name of FileTypeClass. -const FileTypeClassName = "FileType" - -// FileTypeClass represents FileType generic type. -// -// Example: -// -// g, err := tdapi.DecodeFileType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.FileTypeNone: // fileTypeNone#77637ea5 -// case *tdapi.FileTypeAnimation: // fileTypeAnimation#eeaa7dba -// case *tdapi.FileTypeAudio: // fileTypeAudio#d5bbcea0 -// case *tdapi.FileTypeDocument: // fileTypeDocument#de57030f -// case *tdapi.FileTypeNotificationSound: // fileTypeNotificationSound#c32f9f09 -// case *tdapi.FileTypePhoto: // fileTypePhoto#998b71a5 -// case *tdapi.FileTypePhotoStory: // fileTypePhotoStory#78576ef4 -// case *tdapi.FileTypeProfilePhoto: // fileTypeProfilePhoto#6afee3a3 -// case *tdapi.FileTypeSecret: // fileTypeSecret#906d14f7 -// case *tdapi.FileTypeSecretThumbnail: // fileTypeSecretThumbnail#ac797636 -// case *tdapi.FileTypeSecure: // fileTypeSecure#ab69bf26 -// case *tdapi.FileTypeSelfDestructingPhoto: // fileTypeSelfDestructingPhoto#7bcf329b -// case *tdapi.FileTypeSelfDestructingVideo: // fileTypeSelfDestructingVideo#b70cc425 -// case *tdapi.FileTypeSelfDestructingVideoNote: // fileTypeSelfDestructingVideoNote#592012c1 -// case *tdapi.FileTypeSelfDestructingVoiceNote: // fileTypeSelfDestructingVoiceNote#64d0db1d -// case *tdapi.FileTypeSticker: // fileTypeSticker#1c537c69 -// case *tdapi.FileTypeThumbnail: // fileTypeThumbnail#ff42215e -// case *tdapi.FileTypeUnknown: // fileTypeUnknown#8819ed50 -// case *tdapi.FileTypeVideo: // fileTypeVideo#5548871b -// case *tdapi.FileTypeVideoNote: // fileTypeVideoNote#e119a79f -// case *tdapi.FileTypeVideoStory: // fileTypeVideoStory#800b21a1 -// case *tdapi.FileTypeVoiceNote: // fileTypeVoiceNote#dce96e43 -// case *tdapi.FileTypeWallpaper: // fileTypeWallpaper#6e8ffc9c -// default: panic(v) -// } -type FileTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() FileTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeFileType implements binary de-serialization for FileTypeClass. -func DecodeFileType(buf *bin.Buffer) (FileTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case FileTypeNoneTypeID: - // Decoding fileTypeNone#77637ea5. - v := FileTypeNone{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeAnimationTypeID: - // Decoding fileTypeAnimation#eeaa7dba. - v := FileTypeAnimation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeAudioTypeID: - // Decoding fileTypeAudio#d5bbcea0. - v := FileTypeAudio{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeDocumentTypeID: - // Decoding fileTypeDocument#de57030f. - v := FileTypeDocument{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeNotificationSoundTypeID: - // Decoding fileTypeNotificationSound#c32f9f09. - v := FileTypeNotificationSound{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypePhotoTypeID: - // Decoding fileTypePhoto#998b71a5. - v := FileTypePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypePhotoStoryTypeID: - // Decoding fileTypePhotoStory#78576ef4. - v := FileTypePhotoStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeProfilePhotoTypeID: - // Decoding fileTypeProfilePhoto#6afee3a3. - v := FileTypeProfilePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeSecretTypeID: - // Decoding fileTypeSecret#906d14f7. - v := FileTypeSecret{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeSecretThumbnailTypeID: - // Decoding fileTypeSecretThumbnail#ac797636. - v := FileTypeSecretThumbnail{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeSecureTypeID: - // Decoding fileTypeSecure#ab69bf26. - v := FileTypeSecure{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeSelfDestructingPhotoTypeID: - // Decoding fileTypeSelfDestructingPhoto#7bcf329b. - v := FileTypeSelfDestructingPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeSelfDestructingVideoTypeID: - // Decoding fileTypeSelfDestructingVideo#b70cc425. - v := FileTypeSelfDestructingVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeSelfDestructingVideoNoteTypeID: - // Decoding fileTypeSelfDestructingVideoNote#592012c1. - v := FileTypeSelfDestructingVideoNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeSelfDestructingVoiceNoteTypeID: - // Decoding fileTypeSelfDestructingVoiceNote#64d0db1d. - v := FileTypeSelfDestructingVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeStickerTypeID: - // Decoding fileTypeSticker#1c537c69. - v := FileTypeSticker{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeThumbnailTypeID: - // Decoding fileTypeThumbnail#ff42215e. - v := FileTypeThumbnail{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeUnknownTypeID: - // Decoding fileTypeUnknown#8819ed50. - v := FileTypeUnknown{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeVideoTypeID: - // Decoding fileTypeVideo#5548871b. - v := FileTypeVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeVideoNoteTypeID: - // Decoding fileTypeVideoNote#e119a79f. - v := FileTypeVideoNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeVideoStoryTypeID: - // Decoding fileTypeVideoStory#800b21a1. - v := FileTypeVideoStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeVoiceNoteTypeID: - // Decoding fileTypeVoiceNote#dce96e43. - v := FileTypeVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case FileTypeWallpaperTypeID: - // Decoding fileTypeWallpaper#6e8ffc9c. - v := FileTypeWallpaper{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONFileType implements binary de-serialization for FileTypeClass. -func DecodeTDLibJSONFileType(buf tdjson.Decoder) (FileTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "fileTypeNone": - // Decoding fileTypeNone#77637ea5. - v := FileTypeNone{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeAnimation": - // Decoding fileTypeAnimation#eeaa7dba. - v := FileTypeAnimation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeAudio": - // Decoding fileTypeAudio#d5bbcea0. - v := FileTypeAudio{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeDocument": - // Decoding fileTypeDocument#de57030f. - v := FileTypeDocument{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeNotificationSound": - // Decoding fileTypeNotificationSound#c32f9f09. - v := FileTypeNotificationSound{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypePhoto": - // Decoding fileTypePhoto#998b71a5. - v := FileTypePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypePhotoStory": - // Decoding fileTypePhotoStory#78576ef4. - v := FileTypePhotoStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeProfilePhoto": - // Decoding fileTypeProfilePhoto#6afee3a3. - v := FileTypeProfilePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeSecret": - // Decoding fileTypeSecret#906d14f7. - v := FileTypeSecret{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeSecretThumbnail": - // Decoding fileTypeSecretThumbnail#ac797636. - v := FileTypeSecretThumbnail{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeSecure": - // Decoding fileTypeSecure#ab69bf26. - v := FileTypeSecure{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeSelfDestructingPhoto": - // Decoding fileTypeSelfDestructingPhoto#7bcf329b. - v := FileTypeSelfDestructingPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeSelfDestructingVideo": - // Decoding fileTypeSelfDestructingVideo#b70cc425. - v := FileTypeSelfDestructingVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeSelfDestructingVideoNote": - // Decoding fileTypeSelfDestructingVideoNote#592012c1. - v := FileTypeSelfDestructingVideoNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeSelfDestructingVoiceNote": - // Decoding fileTypeSelfDestructingVoiceNote#64d0db1d. - v := FileTypeSelfDestructingVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeSticker": - // Decoding fileTypeSticker#1c537c69. - v := FileTypeSticker{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeThumbnail": - // Decoding fileTypeThumbnail#ff42215e. - v := FileTypeThumbnail{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeUnknown": - // Decoding fileTypeUnknown#8819ed50. - v := FileTypeUnknown{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeVideo": - // Decoding fileTypeVideo#5548871b. - v := FileTypeVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeVideoNote": - // Decoding fileTypeVideoNote#e119a79f. - v := FileTypeVideoNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeVideoStory": - // Decoding fileTypeVideoStory#800b21a1. - v := FileTypeVideoStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeVoiceNote": - // Decoding fileTypeVoiceNote#dce96e43. - v := FileTypeVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - case "fileTypeWallpaper": - // Decoding fileTypeWallpaper#6e8ffc9c. - v := FileTypeWallpaper{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode FileTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// FileType boxes the FileTypeClass providing a helper. -type FileTypeBox struct { - FileType FileTypeClass -} - -// Decode implements bin.Decoder for FileTypeBox. -func (b *FileTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode FileTypeBox to nil") - } - v, err := DecodeFileType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.FileType = v - return nil -} - -// Encode implements bin.Encode for FileTypeBox. -func (b *FileTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.FileType == nil { - return fmt.Errorf("unable to encode FileTypeClass as nil") - } - return b.FileType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for FileTypeBox. -func (b *FileTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode FileTypeBox to nil") - } - v, err := DecodeTDLibJSONFileType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.FileType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for FileTypeBox. -func (b *FileTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.FileType == nil { - return fmt.Errorf("unable to encode FileTypeClass as nil") - } - return b.FileType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_finish_file_generation_gen.go b/tdapi/tl_finish_file_generation_gen.go deleted file mode 100644 index acb10fbe2..000000000 --- a/tdapi/tl_finish_file_generation_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FinishFileGenerationRequest represents TL type `finishFileGeneration#c11d0c9d`. -type FinishFileGenerationRequest struct { - // The identifier of the generation process - GenerationID int64 - // If passed, the file generation has failed and must be terminated; pass null if the - // file generation succeeded - Error Error -} - -// FinishFileGenerationRequestTypeID is TL type id of FinishFileGenerationRequest. -const FinishFileGenerationRequestTypeID = 0xc11d0c9d - -// Ensuring interfaces in compile-time for FinishFileGenerationRequest. -var ( - _ bin.Encoder = &FinishFileGenerationRequest{} - _ bin.Decoder = &FinishFileGenerationRequest{} - _ bin.BareEncoder = &FinishFileGenerationRequest{} - _ bin.BareDecoder = &FinishFileGenerationRequest{} -) - -func (f *FinishFileGenerationRequest) Zero() bool { - if f == nil { - return true - } - if !(f.GenerationID == 0) { - return false - } - if !(f.Error.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FinishFileGenerationRequest) String() string { - if f == nil { - return "FinishFileGenerationRequest(nil)" - } - type Alias FinishFileGenerationRequest - return fmt.Sprintf("FinishFileGenerationRequest%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FinishFileGenerationRequest) TypeID() uint32 { - return FinishFileGenerationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*FinishFileGenerationRequest) TypeName() string { - return "finishFileGeneration" -} - -// TypeInfo returns info about TL type. -func (f *FinishFileGenerationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "finishFileGeneration", - ID: FinishFileGenerationRequestTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GenerationID", - SchemaName: "generation_id", - }, - { - Name: "Error", - SchemaName: "error", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FinishFileGenerationRequest) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode finishFileGeneration#c11d0c9d as nil") - } - b.PutID(FinishFileGenerationRequestTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FinishFileGenerationRequest) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode finishFileGeneration#c11d0c9d as nil") - } - b.PutLong(f.GenerationID) - if err := f.Error.Encode(b); err != nil { - return fmt.Errorf("unable to encode finishFileGeneration#c11d0c9d: field error: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FinishFileGenerationRequest) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode finishFileGeneration#c11d0c9d to nil") - } - if err := b.ConsumeID(FinishFileGenerationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode finishFileGeneration#c11d0c9d: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FinishFileGenerationRequest) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode finishFileGeneration#c11d0c9d to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode finishFileGeneration#c11d0c9d: field generation_id: %w", err) - } - f.GenerationID = value - } - { - if err := f.Error.Decode(b); err != nil { - return fmt.Errorf("unable to decode finishFileGeneration#c11d0c9d: field error: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FinishFileGenerationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode finishFileGeneration#c11d0c9d as nil") - } - b.ObjStart() - b.PutID("finishFileGeneration") - b.Comma() - b.FieldStart("generation_id") - b.PutLong(f.GenerationID) - b.Comma() - b.FieldStart("error") - if err := f.Error.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode finishFileGeneration#c11d0c9d: field error: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FinishFileGenerationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode finishFileGeneration#c11d0c9d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("finishFileGeneration"); err != nil { - return fmt.Errorf("unable to decode finishFileGeneration#c11d0c9d: %w", err) - } - case "generation_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode finishFileGeneration#c11d0c9d: field generation_id: %w", err) - } - f.GenerationID = value - case "error": - if err := f.Error.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode finishFileGeneration#c11d0c9d: field error: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGenerationID returns value of GenerationID field. -func (f *FinishFileGenerationRequest) GetGenerationID() (value int64) { - if f == nil { - return - } - return f.GenerationID -} - -// GetError returns value of Error field. -func (f *FinishFileGenerationRequest) GetError() (value Error) { - if f == nil { - return - } - return f.Error -} - -// FinishFileGeneration invokes method finishFileGeneration#c11d0c9d returning error if any. -func (c *Client) FinishFileGeneration(ctx context.Context, request *FinishFileGenerationRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_firebase_authentication_settings_gen.go b/tdapi/tl_firebase_authentication_settings_gen.go deleted file mode 100644 index 774c85eb3..000000000 --- a/tdapi/tl_firebase_authentication_settings_gen.go +++ /dev/null @@ -1,502 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FirebaseAuthenticationSettingsAndroid represents TL type `firebaseAuthenticationSettingsAndroid#966ef61c`. -type FirebaseAuthenticationSettingsAndroid struct { -} - -// FirebaseAuthenticationSettingsAndroidTypeID is TL type id of FirebaseAuthenticationSettingsAndroid. -const FirebaseAuthenticationSettingsAndroidTypeID = 0x966ef61c - -// construct implements constructor of FirebaseAuthenticationSettingsClass. -func (f FirebaseAuthenticationSettingsAndroid) construct() FirebaseAuthenticationSettingsClass { - return &f -} - -// Ensuring interfaces in compile-time for FirebaseAuthenticationSettingsAndroid. -var ( - _ bin.Encoder = &FirebaseAuthenticationSettingsAndroid{} - _ bin.Decoder = &FirebaseAuthenticationSettingsAndroid{} - _ bin.BareEncoder = &FirebaseAuthenticationSettingsAndroid{} - _ bin.BareDecoder = &FirebaseAuthenticationSettingsAndroid{} - - _ FirebaseAuthenticationSettingsClass = &FirebaseAuthenticationSettingsAndroid{} -) - -func (f *FirebaseAuthenticationSettingsAndroid) Zero() bool { - if f == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (f *FirebaseAuthenticationSettingsAndroid) String() string { - if f == nil { - return "FirebaseAuthenticationSettingsAndroid(nil)" - } - type Alias FirebaseAuthenticationSettingsAndroid - return fmt.Sprintf("FirebaseAuthenticationSettingsAndroid%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FirebaseAuthenticationSettingsAndroid) TypeID() uint32 { - return FirebaseAuthenticationSettingsAndroidTypeID -} - -// TypeName returns name of type in TL schema. -func (*FirebaseAuthenticationSettingsAndroid) TypeName() string { - return "firebaseAuthenticationSettingsAndroid" -} - -// TypeInfo returns info about TL type. -func (f *FirebaseAuthenticationSettingsAndroid) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "firebaseAuthenticationSettingsAndroid", - ID: FirebaseAuthenticationSettingsAndroidTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (f *FirebaseAuthenticationSettingsAndroid) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode firebaseAuthenticationSettingsAndroid#966ef61c as nil") - } - b.PutID(FirebaseAuthenticationSettingsAndroidTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FirebaseAuthenticationSettingsAndroid) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode firebaseAuthenticationSettingsAndroid#966ef61c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FirebaseAuthenticationSettingsAndroid) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode firebaseAuthenticationSettingsAndroid#966ef61c to nil") - } - if err := b.ConsumeID(FirebaseAuthenticationSettingsAndroidTypeID); err != nil { - return fmt.Errorf("unable to decode firebaseAuthenticationSettingsAndroid#966ef61c: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FirebaseAuthenticationSettingsAndroid) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode firebaseAuthenticationSettingsAndroid#966ef61c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FirebaseAuthenticationSettingsAndroid) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode firebaseAuthenticationSettingsAndroid#966ef61c as nil") - } - b.ObjStart() - b.PutID("firebaseAuthenticationSettingsAndroid") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FirebaseAuthenticationSettingsAndroid) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode firebaseAuthenticationSettingsAndroid#966ef61c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("firebaseAuthenticationSettingsAndroid"); err != nil { - return fmt.Errorf("unable to decode firebaseAuthenticationSettingsAndroid#966ef61c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// FirebaseAuthenticationSettingsIos represents TL type `firebaseAuthenticationSettingsIos#d49a4c4`. -type FirebaseAuthenticationSettingsIos struct { - // Device token from Apple Push Notification service - DeviceToken string - // True, if App Sandbox is enabled - IsAppSandbox bool -} - -// FirebaseAuthenticationSettingsIosTypeID is TL type id of FirebaseAuthenticationSettingsIos. -const FirebaseAuthenticationSettingsIosTypeID = 0xd49a4c4 - -// construct implements constructor of FirebaseAuthenticationSettingsClass. -func (f FirebaseAuthenticationSettingsIos) construct() FirebaseAuthenticationSettingsClass { return &f } - -// Ensuring interfaces in compile-time for FirebaseAuthenticationSettingsIos. -var ( - _ bin.Encoder = &FirebaseAuthenticationSettingsIos{} - _ bin.Decoder = &FirebaseAuthenticationSettingsIos{} - _ bin.BareEncoder = &FirebaseAuthenticationSettingsIos{} - _ bin.BareDecoder = &FirebaseAuthenticationSettingsIos{} - - _ FirebaseAuthenticationSettingsClass = &FirebaseAuthenticationSettingsIos{} -) - -func (f *FirebaseAuthenticationSettingsIos) Zero() bool { - if f == nil { - return true - } - if !(f.DeviceToken == "") { - return false - } - if !(f.IsAppSandbox == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FirebaseAuthenticationSettingsIos) String() string { - if f == nil { - return "FirebaseAuthenticationSettingsIos(nil)" - } - type Alias FirebaseAuthenticationSettingsIos - return fmt.Sprintf("FirebaseAuthenticationSettingsIos%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FirebaseAuthenticationSettingsIos) TypeID() uint32 { - return FirebaseAuthenticationSettingsIosTypeID -} - -// TypeName returns name of type in TL schema. -func (*FirebaseAuthenticationSettingsIos) TypeName() string { - return "firebaseAuthenticationSettingsIos" -} - -// TypeInfo returns info about TL type. -func (f *FirebaseAuthenticationSettingsIos) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "firebaseAuthenticationSettingsIos", - ID: FirebaseAuthenticationSettingsIosTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DeviceToken", - SchemaName: "device_token", - }, - { - Name: "IsAppSandbox", - SchemaName: "is_app_sandbox", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FirebaseAuthenticationSettingsIos) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode firebaseAuthenticationSettingsIos#d49a4c4 as nil") - } - b.PutID(FirebaseAuthenticationSettingsIosTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FirebaseAuthenticationSettingsIos) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode firebaseAuthenticationSettingsIos#d49a4c4 as nil") - } - b.PutString(f.DeviceToken) - b.PutBool(f.IsAppSandbox) - return nil -} - -// Decode implements bin.Decoder. -func (f *FirebaseAuthenticationSettingsIos) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode firebaseAuthenticationSettingsIos#d49a4c4 to nil") - } - if err := b.ConsumeID(FirebaseAuthenticationSettingsIosTypeID); err != nil { - return fmt.Errorf("unable to decode firebaseAuthenticationSettingsIos#d49a4c4: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FirebaseAuthenticationSettingsIos) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode firebaseAuthenticationSettingsIos#d49a4c4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode firebaseAuthenticationSettingsIos#d49a4c4: field device_token: %w", err) - } - f.DeviceToken = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode firebaseAuthenticationSettingsIos#d49a4c4: field is_app_sandbox: %w", err) - } - f.IsAppSandbox = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FirebaseAuthenticationSettingsIos) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode firebaseAuthenticationSettingsIos#d49a4c4 as nil") - } - b.ObjStart() - b.PutID("firebaseAuthenticationSettingsIos") - b.Comma() - b.FieldStart("device_token") - b.PutString(f.DeviceToken) - b.Comma() - b.FieldStart("is_app_sandbox") - b.PutBool(f.IsAppSandbox) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FirebaseAuthenticationSettingsIos) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode firebaseAuthenticationSettingsIos#d49a4c4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("firebaseAuthenticationSettingsIos"); err != nil { - return fmt.Errorf("unable to decode firebaseAuthenticationSettingsIos#d49a4c4: %w", err) - } - case "device_token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode firebaseAuthenticationSettingsIos#d49a4c4: field device_token: %w", err) - } - f.DeviceToken = value - case "is_app_sandbox": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode firebaseAuthenticationSettingsIos#d49a4c4: field is_app_sandbox: %w", err) - } - f.IsAppSandbox = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDeviceToken returns value of DeviceToken field. -func (f *FirebaseAuthenticationSettingsIos) GetDeviceToken() (value string) { - if f == nil { - return - } - return f.DeviceToken -} - -// GetIsAppSandbox returns value of IsAppSandbox field. -func (f *FirebaseAuthenticationSettingsIos) GetIsAppSandbox() (value bool) { - if f == nil { - return - } - return f.IsAppSandbox -} - -// FirebaseAuthenticationSettingsClassName is schema name of FirebaseAuthenticationSettingsClass. -const FirebaseAuthenticationSettingsClassName = "FirebaseAuthenticationSettings" - -// FirebaseAuthenticationSettingsClass represents FirebaseAuthenticationSettings generic type. -// -// Example: -// -// g, err := tdapi.DecodeFirebaseAuthenticationSettings(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.FirebaseAuthenticationSettingsAndroid: // firebaseAuthenticationSettingsAndroid#966ef61c -// case *tdapi.FirebaseAuthenticationSettingsIos: // firebaseAuthenticationSettingsIos#d49a4c4 -// default: panic(v) -// } -type FirebaseAuthenticationSettingsClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() FirebaseAuthenticationSettingsClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeFirebaseAuthenticationSettings implements binary de-serialization for FirebaseAuthenticationSettingsClass. -func DecodeFirebaseAuthenticationSettings(buf *bin.Buffer) (FirebaseAuthenticationSettingsClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case FirebaseAuthenticationSettingsAndroidTypeID: - // Decoding firebaseAuthenticationSettingsAndroid#966ef61c. - v := FirebaseAuthenticationSettingsAndroid{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FirebaseAuthenticationSettingsClass: %w", err) - } - return &v, nil - case FirebaseAuthenticationSettingsIosTypeID: - // Decoding firebaseAuthenticationSettingsIos#d49a4c4. - v := FirebaseAuthenticationSettingsIos{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FirebaseAuthenticationSettingsClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode FirebaseAuthenticationSettingsClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONFirebaseAuthenticationSettings implements binary de-serialization for FirebaseAuthenticationSettingsClass. -func DecodeTDLibJSONFirebaseAuthenticationSettings(buf tdjson.Decoder) (FirebaseAuthenticationSettingsClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "firebaseAuthenticationSettingsAndroid": - // Decoding firebaseAuthenticationSettingsAndroid#966ef61c. - v := FirebaseAuthenticationSettingsAndroid{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FirebaseAuthenticationSettingsClass: %w", err) - } - return &v, nil - case "firebaseAuthenticationSettingsIos": - // Decoding firebaseAuthenticationSettingsIos#d49a4c4. - v := FirebaseAuthenticationSettingsIos{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FirebaseAuthenticationSettingsClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode FirebaseAuthenticationSettingsClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// FirebaseAuthenticationSettings boxes the FirebaseAuthenticationSettingsClass providing a helper. -type FirebaseAuthenticationSettingsBox struct { - FirebaseAuthenticationSettings FirebaseAuthenticationSettingsClass -} - -// Decode implements bin.Decoder for FirebaseAuthenticationSettingsBox. -func (b *FirebaseAuthenticationSettingsBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode FirebaseAuthenticationSettingsBox to nil") - } - v, err := DecodeFirebaseAuthenticationSettings(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.FirebaseAuthenticationSettings = v - return nil -} - -// Encode implements bin.Encode for FirebaseAuthenticationSettingsBox. -func (b *FirebaseAuthenticationSettingsBox) Encode(buf *bin.Buffer) error { - if b == nil || b.FirebaseAuthenticationSettings == nil { - return fmt.Errorf("unable to encode FirebaseAuthenticationSettingsClass as nil") - } - return b.FirebaseAuthenticationSettings.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for FirebaseAuthenticationSettingsBox. -func (b *FirebaseAuthenticationSettingsBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode FirebaseAuthenticationSettingsBox to nil") - } - v, err := DecodeTDLibJSONFirebaseAuthenticationSettings(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.FirebaseAuthenticationSettings = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for FirebaseAuthenticationSettingsBox. -func (b *FirebaseAuthenticationSettingsBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.FirebaseAuthenticationSettings == nil { - return fmt.Errorf("unable to encode FirebaseAuthenticationSettingsClass as nil") - } - return b.FirebaseAuthenticationSettings.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_firebase_device_verification_parameters_gen.go b/tdapi/tl_firebase_device_verification_parameters_gen.go deleted file mode 100644 index a95d070b9..000000000 --- a/tdapi/tl_firebase_device_verification_parameters_gen.go +++ /dev/null @@ -1,539 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FirebaseDeviceVerificationParametersSafetyNet represents TL type `firebaseDeviceVerificationParametersSafetyNet#2b96b2f1`. -type FirebaseDeviceVerificationParametersSafetyNet struct { - // Nonce to pass to the SafetyNet Attestation API - Nonce []byte -} - -// FirebaseDeviceVerificationParametersSafetyNetTypeID is TL type id of FirebaseDeviceVerificationParametersSafetyNet. -const FirebaseDeviceVerificationParametersSafetyNetTypeID = 0x2b96b2f1 - -// construct implements constructor of FirebaseDeviceVerificationParametersClass. -func (f FirebaseDeviceVerificationParametersSafetyNet) construct() FirebaseDeviceVerificationParametersClass { - return &f -} - -// Ensuring interfaces in compile-time for FirebaseDeviceVerificationParametersSafetyNet. -var ( - _ bin.Encoder = &FirebaseDeviceVerificationParametersSafetyNet{} - _ bin.Decoder = &FirebaseDeviceVerificationParametersSafetyNet{} - _ bin.BareEncoder = &FirebaseDeviceVerificationParametersSafetyNet{} - _ bin.BareDecoder = &FirebaseDeviceVerificationParametersSafetyNet{} - - _ FirebaseDeviceVerificationParametersClass = &FirebaseDeviceVerificationParametersSafetyNet{} -) - -func (f *FirebaseDeviceVerificationParametersSafetyNet) Zero() bool { - if f == nil { - return true - } - if !(f.Nonce == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FirebaseDeviceVerificationParametersSafetyNet) String() string { - if f == nil { - return "FirebaseDeviceVerificationParametersSafetyNet(nil)" - } - type Alias FirebaseDeviceVerificationParametersSafetyNet - return fmt.Sprintf("FirebaseDeviceVerificationParametersSafetyNet%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FirebaseDeviceVerificationParametersSafetyNet) TypeID() uint32 { - return FirebaseDeviceVerificationParametersSafetyNetTypeID -} - -// TypeName returns name of type in TL schema. -func (*FirebaseDeviceVerificationParametersSafetyNet) TypeName() string { - return "firebaseDeviceVerificationParametersSafetyNet" -} - -// TypeInfo returns info about TL type. -func (f *FirebaseDeviceVerificationParametersSafetyNet) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "firebaseDeviceVerificationParametersSafetyNet", - ID: FirebaseDeviceVerificationParametersSafetyNetTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Nonce", - SchemaName: "nonce", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FirebaseDeviceVerificationParametersSafetyNet) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode firebaseDeviceVerificationParametersSafetyNet#2b96b2f1 as nil") - } - b.PutID(FirebaseDeviceVerificationParametersSafetyNetTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FirebaseDeviceVerificationParametersSafetyNet) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode firebaseDeviceVerificationParametersSafetyNet#2b96b2f1 as nil") - } - b.PutBytes(f.Nonce) - return nil -} - -// Decode implements bin.Decoder. -func (f *FirebaseDeviceVerificationParametersSafetyNet) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode firebaseDeviceVerificationParametersSafetyNet#2b96b2f1 to nil") - } - if err := b.ConsumeID(FirebaseDeviceVerificationParametersSafetyNetTypeID); err != nil { - return fmt.Errorf("unable to decode firebaseDeviceVerificationParametersSafetyNet#2b96b2f1: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FirebaseDeviceVerificationParametersSafetyNet) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode firebaseDeviceVerificationParametersSafetyNet#2b96b2f1 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode firebaseDeviceVerificationParametersSafetyNet#2b96b2f1: field nonce: %w", err) - } - f.Nonce = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FirebaseDeviceVerificationParametersSafetyNet) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode firebaseDeviceVerificationParametersSafetyNet#2b96b2f1 as nil") - } - b.ObjStart() - b.PutID("firebaseDeviceVerificationParametersSafetyNet") - b.Comma() - b.FieldStart("nonce") - b.PutBytes(f.Nonce) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FirebaseDeviceVerificationParametersSafetyNet) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode firebaseDeviceVerificationParametersSafetyNet#2b96b2f1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("firebaseDeviceVerificationParametersSafetyNet"); err != nil { - return fmt.Errorf("unable to decode firebaseDeviceVerificationParametersSafetyNet#2b96b2f1: %w", err) - } - case "nonce": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode firebaseDeviceVerificationParametersSafetyNet#2b96b2f1: field nonce: %w", err) - } - f.Nonce = value - default: - return b.Skip() - } - return nil - }) -} - -// GetNonce returns value of Nonce field. -func (f *FirebaseDeviceVerificationParametersSafetyNet) GetNonce() (value []byte) { - if f == nil { - return - } - return f.Nonce -} - -// FirebaseDeviceVerificationParametersPlayIntegrity represents TL type `firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a`. -type FirebaseDeviceVerificationParametersPlayIntegrity struct { - // Base64url-encoded nonce to pass to the Play Integrity API - Nonce string - // Cloud project number to pass to the Play Integrity API - CloudProjectNumber int64 -} - -// FirebaseDeviceVerificationParametersPlayIntegrityTypeID is TL type id of FirebaseDeviceVerificationParametersPlayIntegrity. -const FirebaseDeviceVerificationParametersPlayIntegrityTypeID = 0xcaf4a58a - -// construct implements constructor of FirebaseDeviceVerificationParametersClass. -func (f FirebaseDeviceVerificationParametersPlayIntegrity) construct() FirebaseDeviceVerificationParametersClass { - return &f -} - -// Ensuring interfaces in compile-time for FirebaseDeviceVerificationParametersPlayIntegrity. -var ( - _ bin.Encoder = &FirebaseDeviceVerificationParametersPlayIntegrity{} - _ bin.Decoder = &FirebaseDeviceVerificationParametersPlayIntegrity{} - _ bin.BareEncoder = &FirebaseDeviceVerificationParametersPlayIntegrity{} - _ bin.BareDecoder = &FirebaseDeviceVerificationParametersPlayIntegrity{} - - _ FirebaseDeviceVerificationParametersClass = &FirebaseDeviceVerificationParametersPlayIntegrity{} -) - -func (f *FirebaseDeviceVerificationParametersPlayIntegrity) Zero() bool { - if f == nil { - return true - } - if !(f.Nonce == "") { - return false - } - if !(f.CloudProjectNumber == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FirebaseDeviceVerificationParametersPlayIntegrity) String() string { - if f == nil { - return "FirebaseDeviceVerificationParametersPlayIntegrity(nil)" - } - type Alias FirebaseDeviceVerificationParametersPlayIntegrity - return fmt.Sprintf("FirebaseDeviceVerificationParametersPlayIntegrity%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FirebaseDeviceVerificationParametersPlayIntegrity) TypeID() uint32 { - return FirebaseDeviceVerificationParametersPlayIntegrityTypeID -} - -// TypeName returns name of type in TL schema. -func (*FirebaseDeviceVerificationParametersPlayIntegrity) TypeName() string { - return "firebaseDeviceVerificationParametersPlayIntegrity" -} - -// TypeInfo returns info about TL type. -func (f *FirebaseDeviceVerificationParametersPlayIntegrity) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "firebaseDeviceVerificationParametersPlayIntegrity", - ID: FirebaseDeviceVerificationParametersPlayIntegrityTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Nonce", - SchemaName: "nonce", - }, - { - Name: "CloudProjectNumber", - SchemaName: "cloud_project_number", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FirebaseDeviceVerificationParametersPlayIntegrity) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a as nil") - } - b.PutID(FirebaseDeviceVerificationParametersPlayIntegrityTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FirebaseDeviceVerificationParametersPlayIntegrity) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a as nil") - } - b.PutString(f.Nonce) - b.PutLong(f.CloudProjectNumber) - return nil -} - -// Decode implements bin.Decoder. -func (f *FirebaseDeviceVerificationParametersPlayIntegrity) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a to nil") - } - if err := b.ConsumeID(FirebaseDeviceVerificationParametersPlayIntegrityTypeID); err != nil { - return fmt.Errorf("unable to decode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FirebaseDeviceVerificationParametersPlayIntegrity) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a: field nonce: %w", err) - } - f.Nonce = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a: field cloud_project_number: %w", err) - } - f.CloudProjectNumber = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FirebaseDeviceVerificationParametersPlayIntegrity) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a as nil") - } - b.ObjStart() - b.PutID("firebaseDeviceVerificationParametersPlayIntegrity") - b.Comma() - b.FieldStart("nonce") - b.PutString(f.Nonce) - b.Comma() - b.FieldStart("cloud_project_number") - b.PutLong(f.CloudProjectNumber) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FirebaseDeviceVerificationParametersPlayIntegrity) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("firebaseDeviceVerificationParametersPlayIntegrity"); err != nil { - return fmt.Errorf("unable to decode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a: %w", err) - } - case "nonce": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a: field nonce: %w", err) - } - f.Nonce = value - case "cloud_project_number": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a: field cloud_project_number: %w", err) - } - f.CloudProjectNumber = value - default: - return b.Skip() - } - return nil - }) -} - -// GetNonce returns value of Nonce field. -func (f *FirebaseDeviceVerificationParametersPlayIntegrity) GetNonce() (value string) { - if f == nil { - return - } - return f.Nonce -} - -// GetCloudProjectNumber returns value of CloudProjectNumber field. -func (f *FirebaseDeviceVerificationParametersPlayIntegrity) GetCloudProjectNumber() (value int64) { - if f == nil { - return - } - return f.CloudProjectNumber -} - -// FirebaseDeviceVerificationParametersClassName is schema name of FirebaseDeviceVerificationParametersClass. -const FirebaseDeviceVerificationParametersClassName = "FirebaseDeviceVerificationParameters" - -// FirebaseDeviceVerificationParametersClass represents FirebaseDeviceVerificationParameters generic type. -// -// Example: -// -// g, err := tdapi.DecodeFirebaseDeviceVerificationParameters(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.FirebaseDeviceVerificationParametersSafetyNet: // firebaseDeviceVerificationParametersSafetyNet#2b96b2f1 -// case *tdapi.FirebaseDeviceVerificationParametersPlayIntegrity: // firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a -// default: panic(v) -// } -type FirebaseDeviceVerificationParametersClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() FirebaseDeviceVerificationParametersClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeFirebaseDeviceVerificationParameters implements binary de-serialization for FirebaseDeviceVerificationParametersClass. -func DecodeFirebaseDeviceVerificationParameters(buf *bin.Buffer) (FirebaseDeviceVerificationParametersClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case FirebaseDeviceVerificationParametersSafetyNetTypeID: - // Decoding firebaseDeviceVerificationParametersSafetyNet#2b96b2f1. - v := FirebaseDeviceVerificationParametersSafetyNet{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FirebaseDeviceVerificationParametersClass: %w", err) - } - return &v, nil - case FirebaseDeviceVerificationParametersPlayIntegrityTypeID: - // Decoding firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a. - v := FirebaseDeviceVerificationParametersPlayIntegrity{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode FirebaseDeviceVerificationParametersClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode FirebaseDeviceVerificationParametersClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONFirebaseDeviceVerificationParameters implements binary de-serialization for FirebaseDeviceVerificationParametersClass. -func DecodeTDLibJSONFirebaseDeviceVerificationParameters(buf tdjson.Decoder) (FirebaseDeviceVerificationParametersClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "firebaseDeviceVerificationParametersSafetyNet": - // Decoding firebaseDeviceVerificationParametersSafetyNet#2b96b2f1. - v := FirebaseDeviceVerificationParametersSafetyNet{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FirebaseDeviceVerificationParametersClass: %w", err) - } - return &v, nil - case "firebaseDeviceVerificationParametersPlayIntegrity": - // Decoding firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a. - v := FirebaseDeviceVerificationParametersPlayIntegrity{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode FirebaseDeviceVerificationParametersClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode FirebaseDeviceVerificationParametersClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// FirebaseDeviceVerificationParameters boxes the FirebaseDeviceVerificationParametersClass providing a helper. -type FirebaseDeviceVerificationParametersBox struct { - FirebaseDeviceVerificationParameters FirebaseDeviceVerificationParametersClass -} - -// Decode implements bin.Decoder for FirebaseDeviceVerificationParametersBox. -func (b *FirebaseDeviceVerificationParametersBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode FirebaseDeviceVerificationParametersBox to nil") - } - v, err := DecodeFirebaseDeviceVerificationParameters(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.FirebaseDeviceVerificationParameters = v - return nil -} - -// Encode implements bin.Encode for FirebaseDeviceVerificationParametersBox. -func (b *FirebaseDeviceVerificationParametersBox) Encode(buf *bin.Buffer) error { - if b == nil || b.FirebaseDeviceVerificationParameters == nil { - return fmt.Errorf("unable to encode FirebaseDeviceVerificationParametersClass as nil") - } - return b.FirebaseDeviceVerificationParameters.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for FirebaseDeviceVerificationParametersBox. -func (b *FirebaseDeviceVerificationParametersBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode FirebaseDeviceVerificationParametersBox to nil") - } - v, err := DecodeTDLibJSONFirebaseDeviceVerificationParameters(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.FirebaseDeviceVerificationParameters = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for FirebaseDeviceVerificationParametersBox. -func (b *FirebaseDeviceVerificationParametersBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.FirebaseDeviceVerificationParameters == nil { - return fmt.Errorf("unable to encode FirebaseDeviceVerificationParametersClass as nil") - } - return b.FirebaseDeviceVerificationParameters.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_formatted_text_gen.go b/tdapi/tl_formatted_text_gen.go deleted file mode 100644 index 5d438f84a..000000000 --- a/tdapi/tl_formatted_text_gen.go +++ /dev/null @@ -1,256 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FormattedText represents TL type `formattedText#a38d39ee`. -type FormattedText struct { - // The text - Text string - // Entities contained in the text. Entities can be nested, but must not mutually - // intersect with each other. - Entities []TextEntity -} - -// FormattedTextTypeID is TL type id of FormattedText. -const FormattedTextTypeID = 0xa38d39ee - -// Ensuring interfaces in compile-time for FormattedText. -var ( - _ bin.Encoder = &FormattedText{} - _ bin.Decoder = &FormattedText{} - _ bin.BareEncoder = &FormattedText{} - _ bin.BareDecoder = &FormattedText{} -) - -func (f *FormattedText) Zero() bool { - if f == nil { - return true - } - if !(f.Text == "") { - return false - } - if !(f.Entities == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FormattedText) String() string { - if f == nil { - return "FormattedText(nil)" - } - type Alias FormattedText - return fmt.Sprintf("FormattedText%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FormattedText) TypeID() uint32 { - return FormattedTextTypeID -} - -// TypeName returns name of type in TL schema. -func (*FormattedText) TypeName() string { - return "formattedText" -} - -// TypeInfo returns info about TL type. -func (f *FormattedText) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "formattedText", - ID: FormattedTextTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Entities", - SchemaName: "entities", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FormattedText) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode formattedText#a38d39ee as nil") - } - b.PutID(FormattedTextTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FormattedText) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode formattedText#a38d39ee as nil") - } - b.PutString(f.Text) - b.PutInt(len(f.Entities)) - for idx, v := range f.Entities { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare formattedText#a38d39ee: field entities element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FormattedText) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode formattedText#a38d39ee to nil") - } - if err := b.ConsumeID(FormattedTextTypeID); err != nil { - return fmt.Errorf("unable to decode formattedText#a38d39ee: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FormattedText) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode formattedText#a38d39ee to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode formattedText#a38d39ee: field text: %w", err) - } - f.Text = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode formattedText#a38d39ee: field entities: %w", err) - } - - if headerLen > 0 { - f.Entities = make([]TextEntity, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value TextEntity - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare formattedText#a38d39ee: field entities: %w", err) - } - f.Entities = append(f.Entities, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FormattedText) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode formattedText#a38d39ee as nil") - } - b.ObjStart() - b.PutID("formattedText") - b.Comma() - b.FieldStart("text") - b.PutString(f.Text) - b.Comma() - b.FieldStart("entities") - b.ArrStart() - for idx, v := range f.Entities { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode formattedText#a38d39ee: field entities element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FormattedText) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode formattedText#a38d39ee to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("formattedText"); err != nil { - return fmt.Errorf("unable to decode formattedText#a38d39ee: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode formattedText#a38d39ee: field text: %w", err) - } - f.Text = value - case "entities": - if err := b.Arr(func(b tdjson.Decoder) error { - var value TextEntity - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode formattedText#a38d39ee: field entities: %w", err) - } - f.Entities = append(f.Entities, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode formattedText#a38d39ee: field entities: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (f *FormattedText) GetText() (value string) { - if f == nil { - return - } - return f.Text -} - -// GetEntities returns value of Entities field. -func (f *FormattedText) GetEntities() (value []TextEntity) { - if f == nil { - return - } - return f.Entities -} diff --git a/tdapi/tl_forum_topic_gen.go b/tdapi/tl_forum_topic_gen.go deleted file mode 100644 index 5fdae59bf..000000000 --- a/tdapi/tl_forum_topic_gen.go +++ /dev/null @@ -1,499 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ForumTopic represents TL type `forumTopic#1213ace6`. -type ForumTopic struct { - // Basic information about the topic - Info ForumTopicInfo - // Last message in the topic; may be null if unknown - LastMessage Message - // True, if the topic is pinned in the topic list - IsPinned bool - // Number of unread messages in the topic - UnreadCount int32 - // Identifier of the last read incoming message - LastReadInboxMessageID int64 - // Identifier of the last read outgoing message - LastReadOutboxMessageID int64 - // Number of unread messages with a mention/reply in the topic - UnreadMentionCount int32 - // Number of messages with unread reactions in the topic - UnreadReactionCount int32 - // Notification settings for the topic - NotificationSettings ChatNotificationSettings - // A draft of a message in the topic; may be null if none - DraftMessage DraftMessage -} - -// ForumTopicTypeID is TL type id of ForumTopic. -const ForumTopicTypeID = 0x1213ace6 - -// Ensuring interfaces in compile-time for ForumTopic. -var ( - _ bin.Encoder = &ForumTopic{} - _ bin.Decoder = &ForumTopic{} - _ bin.BareEncoder = &ForumTopic{} - _ bin.BareDecoder = &ForumTopic{} -) - -func (f *ForumTopic) Zero() bool { - if f == nil { - return true - } - if !(f.Info.Zero()) { - return false - } - if !(f.LastMessage.Zero()) { - return false - } - if !(f.IsPinned == false) { - return false - } - if !(f.UnreadCount == 0) { - return false - } - if !(f.LastReadInboxMessageID == 0) { - return false - } - if !(f.LastReadOutboxMessageID == 0) { - return false - } - if !(f.UnreadMentionCount == 0) { - return false - } - if !(f.UnreadReactionCount == 0) { - return false - } - if !(f.NotificationSettings.Zero()) { - return false - } - if !(f.DraftMessage.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *ForumTopic) String() string { - if f == nil { - return "ForumTopic(nil)" - } - type Alias ForumTopic - return fmt.Sprintf("ForumTopic%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ForumTopic) TypeID() uint32 { - return ForumTopicTypeID -} - -// TypeName returns name of type in TL schema. -func (*ForumTopic) TypeName() string { - return "forumTopic" -} - -// TypeInfo returns info about TL type. -func (f *ForumTopic) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "forumTopic", - ID: ForumTopicTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Info", - SchemaName: "info", - }, - { - Name: "LastMessage", - SchemaName: "last_message", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - { - Name: "UnreadCount", - SchemaName: "unread_count", - }, - { - Name: "LastReadInboxMessageID", - SchemaName: "last_read_inbox_message_id", - }, - { - Name: "LastReadOutboxMessageID", - SchemaName: "last_read_outbox_message_id", - }, - { - Name: "UnreadMentionCount", - SchemaName: "unread_mention_count", - }, - { - Name: "UnreadReactionCount", - SchemaName: "unread_reaction_count", - }, - { - Name: "NotificationSettings", - SchemaName: "notification_settings", - }, - { - Name: "DraftMessage", - SchemaName: "draft_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *ForumTopic) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forumTopic#1213ace6 as nil") - } - b.PutID(ForumTopicTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *ForumTopic) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forumTopic#1213ace6 as nil") - } - if err := f.Info.Encode(b); err != nil { - return fmt.Errorf("unable to encode forumTopic#1213ace6: field info: %w", err) - } - if err := f.LastMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode forumTopic#1213ace6: field last_message: %w", err) - } - b.PutBool(f.IsPinned) - b.PutInt32(f.UnreadCount) - b.PutInt53(f.LastReadInboxMessageID) - b.PutInt53(f.LastReadOutboxMessageID) - b.PutInt32(f.UnreadMentionCount) - b.PutInt32(f.UnreadReactionCount) - if err := f.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode forumTopic#1213ace6: field notification_settings: %w", err) - } - if err := f.DraftMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode forumTopic#1213ace6: field draft_message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (f *ForumTopic) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forumTopic#1213ace6 to nil") - } - if err := b.ConsumeID(ForumTopicTypeID); err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *ForumTopic) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forumTopic#1213ace6 to nil") - } - { - if err := f.Info.Decode(b); err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field info: %w", err) - } - } - { - if err := f.LastMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field last_message: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field is_pinned: %w", err) - } - f.IsPinned = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field unread_count: %w", err) - } - f.UnreadCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field last_read_inbox_message_id: %w", err) - } - f.LastReadInboxMessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field last_read_outbox_message_id: %w", err) - } - f.LastReadOutboxMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field unread_mention_count: %w", err) - } - f.UnreadMentionCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field unread_reaction_count: %w", err) - } - f.UnreadReactionCount = value - } - { - if err := f.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field notification_settings: %w", err) - } - } - { - if err := f.DraftMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field draft_message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *ForumTopic) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode forumTopic#1213ace6 as nil") - } - b.ObjStart() - b.PutID("forumTopic") - b.Comma() - b.FieldStart("info") - if err := f.Info.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode forumTopic#1213ace6: field info: %w", err) - } - b.Comma() - b.FieldStart("last_message") - if err := f.LastMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode forumTopic#1213ace6: field last_message: %w", err) - } - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(f.IsPinned) - b.Comma() - b.FieldStart("unread_count") - b.PutInt32(f.UnreadCount) - b.Comma() - b.FieldStart("last_read_inbox_message_id") - b.PutInt53(f.LastReadInboxMessageID) - b.Comma() - b.FieldStart("last_read_outbox_message_id") - b.PutInt53(f.LastReadOutboxMessageID) - b.Comma() - b.FieldStart("unread_mention_count") - b.PutInt32(f.UnreadMentionCount) - b.Comma() - b.FieldStart("unread_reaction_count") - b.PutInt32(f.UnreadReactionCount) - b.Comma() - b.FieldStart("notification_settings") - if err := f.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode forumTopic#1213ace6: field notification_settings: %w", err) - } - b.Comma() - b.FieldStart("draft_message") - if err := f.DraftMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode forumTopic#1213ace6: field draft_message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *ForumTopic) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode forumTopic#1213ace6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("forumTopic"); err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: %w", err) - } - case "info": - if err := f.Info.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field info: %w", err) - } - case "last_message": - if err := f.LastMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field last_message: %w", err) - } - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field is_pinned: %w", err) - } - f.IsPinned = value - case "unread_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field unread_count: %w", err) - } - f.UnreadCount = value - case "last_read_inbox_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field last_read_inbox_message_id: %w", err) - } - f.LastReadInboxMessageID = value - case "last_read_outbox_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field last_read_outbox_message_id: %w", err) - } - f.LastReadOutboxMessageID = value - case "unread_mention_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field unread_mention_count: %w", err) - } - f.UnreadMentionCount = value - case "unread_reaction_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field unread_reaction_count: %w", err) - } - f.UnreadReactionCount = value - case "notification_settings": - if err := f.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field notification_settings: %w", err) - } - case "draft_message": - if err := f.DraftMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode forumTopic#1213ace6: field draft_message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInfo returns value of Info field. -func (f *ForumTopic) GetInfo() (value ForumTopicInfo) { - if f == nil { - return - } - return f.Info -} - -// GetLastMessage returns value of LastMessage field. -func (f *ForumTopic) GetLastMessage() (value Message) { - if f == nil { - return - } - return f.LastMessage -} - -// GetIsPinned returns value of IsPinned field. -func (f *ForumTopic) GetIsPinned() (value bool) { - if f == nil { - return - } - return f.IsPinned -} - -// GetUnreadCount returns value of UnreadCount field. -func (f *ForumTopic) GetUnreadCount() (value int32) { - if f == nil { - return - } - return f.UnreadCount -} - -// GetLastReadInboxMessageID returns value of LastReadInboxMessageID field. -func (f *ForumTopic) GetLastReadInboxMessageID() (value int64) { - if f == nil { - return - } - return f.LastReadInboxMessageID -} - -// GetLastReadOutboxMessageID returns value of LastReadOutboxMessageID field. -func (f *ForumTopic) GetLastReadOutboxMessageID() (value int64) { - if f == nil { - return - } - return f.LastReadOutboxMessageID -} - -// GetUnreadMentionCount returns value of UnreadMentionCount field. -func (f *ForumTopic) GetUnreadMentionCount() (value int32) { - if f == nil { - return - } - return f.UnreadMentionCount -} - -// GetUnreadReactionCount returns value of UnreadReactionCount field. -func (f *ForumTopic) GetUnreadReactionCount() (value int32) { - if f == nil { - return - } - return f.UnreadReactionCount -} - -// GetNotificationSettings returns value of NotificationSettings field. -func (f *ForumTopic) GetNotificationSettings() (value ChatNotificationSettings) { - if f == nil { - return - } - return f.NotificationSettings -} - -// GetDraftMessage returns value of DraftMessage field. -func (f *ForumTopic) GetDraftMessage() (value DraftMessage) { - if f == nil { - return - } - return f.DraftMessage -} diff --git a/tdapi/tl_forum_topic_icon_gen.go b/tdapi/tl_forum_topic_icon_gen.go deleted file mode 100644 index a0e6238bb..000000000 --- a/tdapi/tl_forum_topic_icon_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ForumTopicIcon represents TL type `forumTopicIcon#cf32a193`. -type ForumTopicIcon struct { - // Color of the topic icon in RGB format - Color int32 - // Unique identifier of the custom emoji shown on the topic icon; 0 if none - CustomEmojiID int64 -} - -// ForumTopicIconTypeID is TL type id of ForumTopicIcon. -const ForumTopicIconTypeID = 0xcf32a193 - -// Ensuring interfaces in compile-time for ForumTopicIcon. -var ( - _ bin.Encoder = &ForumTopicIcon{} - _ bin.Decoder = &ForumTopicIcon{} - _ bin.BareEncoder = &ForumTopicIcon{} - _ bin.BareDecoder = &ForumTopicIcon{} -) - -func (f *ForumTopicIcon) Zero() bool { - if f == nil { - return true - } - if !(f.Color == 0) { - return false - } - if !(f.CustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *ForumTopicIcon) String() string { - if f == nil { - return "ForumTopicIcon(nil)" - } - type Alias ForumTopicIcon - return fmt.Sprintf("ForumTopicIcon%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ForumTopicIcon) TypeID() uint32 { - return ForumTopicIconTypeID -} - -// TypeName returns name of type in TL schema. -func (*ForumTopicIcon) TypeName() string { - return "forumTopicIcon" -} - -// TypeInfo returns info about TL type. -func (f *ForumTopicIcon) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "forumTopicIcon", - ID: ForumTopicIconTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Color", - SchemaName: "color", - }, - { - Name: "CustomEmojiID", - SchemaName: "custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *ForumTopicIcon) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forumTopicIcon#cf32a193 as nil") - } - b.PutID(ForumTopicIconTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *ForumTopicIcon) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forumTopicIcon#cf32a193 as nil") - } - b.PutInt32(f.Color) - b.PutLong(f.CustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (f *ForumTopicIcon) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forumTopicIcon#cf32a193 to nil") - } - if err := b.ConsumeID(ForumTopicIconTypeID); err != nil { - return fmt.Errorf("unable to decode forumTopicIcon#cf32a193: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *ForumTopicIcon) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forumTopicIcon#cf32a193 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopicIcon#cf32a193: field color: %w", err) - } - f.Color = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode forumTopicIcon#cf32a193: field custom_emoji_id: %w", err) - } - f.CustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *ForumTopicIcon) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode forumTopicIcon#cf32a193 as nil") - } - b.ObjStart() - b.PutID("forumTopicIcon") - b.Comma() - b.FieldStart("color") - b.PutInt32(f.Color) - b.Comma() - b.FieldStart("custom_emoji_id") - b.PutLong(f.CustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *ForumTopicIcon) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode forumTopicIcon#cf32a193 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("forumTopicIcon"); err != nil { - return fmt.Errorf("unable to decode forumTopicIcon#cf32a193: %w", err) - } - case "color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopicIcon#cf32a193: field color: %w", err) - } - f.Color = value - case "custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode forumTopicIcon#cf32a193: field custom_emoji_id: %w", err) - } - f.CustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetColor returns value of Color field. -func (f *ForumTopicIcon) GetColor() (value int32) { - if f == nil { - return - } - return f.Color -} - -// GetCustomEmojiID returns value of CustomEmojiID field. -func (f *ForumTopicIcon) GetCustomEmojiID() (value int64) { - if f == nil { - return - } - return f.CustomEmojiID -} diff --git a/tdapi/tl_forum_topic_info_gen.go b/tdapi/tl_forum_topic_info_gen.go deleted file mode 100644 index 6b09c380f..000000000 --- a/tdapi/tl_forum_topic_info_gen.go +++ /dev/null @@ -1,475 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ForumTopicInfo represents TL type `forumTopicInfo#8ff3df9e`. -type ForumTopicInfo struct { - // Message thread identifier of the topic - MessageThreadID int64 - // Name of the topic - Name string - // Icon of the topic - Icon ForumTopicIcon - // Point in time (Unix timestamp) when the topic was created - CreationDate int32 - // Identifier of the creator of the topic - CreatorID MessageSenderClass - // True, if the topic is the General topic list - IsGeneral bool - // True, if the topic was created by the current user - IsOutgoing bool - // True, if the topic is closed - IsClosed bool - // True, if the topic is hidden above the topic list and closed; for General topic only - IsHidden bool -} - -// ForumTopicInfoTypeID is TL type id of ForumTopicInfo. -const ForumTopicInfoTypeID = 0x8ff3df9e - -// Ensuring interfaces in compile-time for ForumTopicInfo. -var ( - _ bin.Encoder = &ForumTopicInfo{} - _ bin.Decoder = &ForumTopicInfo{} - _ bin.BareEncoder = &ForumTopicInfo{} - _ bin.BareDecoder = &ForumTopicInfo{} -) - -func (f *ForumTopicInfo) Zero() bool { - if f == nil { - return true - } - if !(f.MessageThreadID == 0) { - return false - } - if !(f.Name == "") { - return false - } - if !(f.Icon.Zero()) { - return false - } - if !(f.CreationDate == 0) { - return false - } - if !(f.CreatorID == nil) { - return false - } - if !(f.IsGeneral == false) { - return false - } - if !(f.IsOutgoing == false) { - return false - } - if !(f.IsClosed == false) { - return false - } - if !(f.IsHidden == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *ForumTopicInfo) String() string { - if f == nil { - return "ForumTopicInfo(nil)" - } - type Alias ForumTopicInfo - return fmt.Sprintf("ForumTopicInfo%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ForumTopicInfo) TypeID() uint32 { - return ForumTopicInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ForumTopicInfo) TypeName() string { - return "forumTopicInfo" -} - -// TypeInfo returns info about TL type. -func (f *ForumTopicInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "forumTopicInfo", - ID: ForumTopicInfoTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Icon", - SchemaName: "icon", - }, - { - Name: "CreationDate", - SchemaName: "creation_date", - }, - { - Name: "CreatorID", - SchemaName: "creator_id", - }, - { - Name: "IsGeneral", - SchemaName: "is_general", - }, - { - Name: "IsOutgoing", - SchemaName: "is_outgoing", - }, - { - Name: "IsClosed", - SchemaName: "is_closed", - }, - { - Name: "IsHidden", - SchemaName: "is_hidden", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *ForumTopicInfo) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forumTopicInfo#8ff3df9e as nil") - } - b.PutID(ForumTopicInfoTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *ForumTopicInfo) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forumTopicInfo#8ff3df9e as nil") - } - b.PutInt53(f.MessageThreadID) - b.PutString(f.Name) - if err := f.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field icon: %w", err) - } - b.PutInt32(f.CreationDate) - if f.CreatorID == nil { - return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field creator_id is nil") - } - if err := f.CreatorID.Encode(b); err != nil { - return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field creator_id: %w", err) - } - b.PutBool(f.IsGeneral) - b.PutBool(f.IsOutgoing) - b.PutBool(f.IsClosed) - b.PutBool(f.IsHidden) - return nil -} - -// Decode implements bin.Decoder. -func (f *ForumTopicInfo) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forumTopicInfo#8ff3df9e to nil") - } - if err := b.ConsumeID(ForumTopicInfoTypeID); err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *ForumTopicInfo) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forumTopicInfo#8ff3df9e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field message_thread_id: %w", err) - } - f.MessageThreadID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field name: %w", err) - } - f.Name = value - } - { - if err := f.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field icon: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field creation_date: %w", err) - } - f.CreationDate = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field creator_id: %w", err) - } - f.CreatorID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_general: %w", err) - } - f.IsGeneral = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_outgoing: %w", err) - } - f.IsOutgoing = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_closed: %w", err) - } - f.IsClosed = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_hidden: %w", err) - } - f.IsHidden = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *ForumTopicInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode forumTopicInfo#8ff3df9e as nil") - } - b.ObjStart() - b.PutID("forumTopicInfo") - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(f.MessageThreadID) - b.Comma() - b.FieldStart("name") - b.PutString(f.Name) - b.Comma() - b.FieldStart("icon") - if err := f.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field icon: %w", err) - } - b.Comma() - b.FieldStart("creation_date") - b.PutInt32(f.CreationDate) - b.Comma() - b.FieldStart("creator_id") - if f.CreatorID == nil { - return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field creator_id is nil") - } - if err := f.CreatorID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode forumTopicInfo#8ff3df9e: field creator_id: %w", err) - } - b.Comma() - b.FieldStart("is_general") - b.PutBool(f.IsGeneral) - b.Comma() - b.FieldStart("is_outgoing") - b.PutBool(f.IsOutgoing) - b.Comma() - b.FieldStart("is_closed") - b.PutBool(f.IsClosed) - b.Comma() - b.FieldStart("is_hidden") - b.PutBool(f.IsHidden) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *ForumTopicInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode forumTopicInfo#8ff3df9e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("forumTopicInfo"); err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: %w", err) - } - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field message_thread_id: %w", err) - } - f.MessageThreadID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field name: %w", err) - } - f.Name = value - case "icon": - if err := f.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field icon: %w", err) - } - case "creation_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field creation_date: %w", err) - } - f.CreationDate = value - case "creator_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field creator_id: %w", err) - } - f.CreatorID = value - case "is_general": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_general: %w", err) - } - f.IsGeneral = value - case "is_outgoing": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_outgoing: %w", err) - } - f.IsOutgoing = value - case "is_closed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_closed: %w", err) - } - f.IsClosed = value - case "is_hidden": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forumTopicInfo#8ff3df9e: field is_hidden: %w", err) - } - f.IsHidden = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (f *ForumTopicInfo) GetMessageThreadID() (value int64) { - if f == nil { - return - } - return f.MessageThreadID -} - -// GetName returns value of Name field. -func (f *ForumTopicInfo) GetName() (value string) { - if f == nil { - return - } - return f.Name -} - -// GetIcon returns value of Icon field. -func (f *ForumTopicInfo) GetIcon() (value ForumTopicIcon) { - if f == nil { - return - } - return f.Icon -} - -// GetCreationDate returns value of CreationDate field. -func (f *ForumTopicInfo) GetCreationDate() (value int32) { - if f == nil { - return - } - return f.CreationDate -} - -// GetCreatorID returns value of CreatorID field. -func (f *ForumTopicInfo) GetCreatorID() (value MessageSenderClass) { - if f == nil { - return - } - return f.CreatorID -} - -// GetIsGeneral returns value of IsGeneral field. -func (f *ForumTopicInfo) GetIsGeneral() (value bool) { - if f == nil { - return - } - return f.IsGeneral -} - -// GetIsOutgoing returns value of IsOutgoing field. -func (f *ForumTopicInfo) GetIsOutgoing() (value bool) { - if f == nil { - return - } - return f.IsOutgoing -} - -// GetIsClosed returns value of IsClosed field. -func (f *ForumTopicInfo) GetIsClosed() (value bool) { - if f == nil { - return - } - return f.IsClosed -} - -// GetIsHidden returns value of IsHidden field. -func (f *ForumTopicInfo) GetIsHidden() (value bool) { - if f == nil { - return - } - return f.IsHidden -} diff --git a/tdapi/tl_forum_topics_gen.go b/tdapi/tl_forum_topics_gen.go deleted file mode 100644 index 31fe1075f..000000000 --- a/tdapi/tl_forum_topics_gen.go +++ /dev/null @@ -1,357 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ForumTopics represents TL type `forumTopics#2d99b4ae`. -type ForumTopics struct { - // Approximate total number of forum topics found - TotalCount int32 - // List of forum topics - Topics []ForumTopic - // Offset date for the next getForumTopics request - NextOffsetDate int32 - // Offset message identifier for the next getForumTopics request - NextOffsetMessageID int64 - // Offset message thread identifier for the next getForumTopics request - NextOffsetMessageThreadID int64 -} - -// ForumTopicsTypeID is TL type id of ForumTopics. -const ForumTopicsTypeID = 0x2d99b4ae - -// Ensuring interfaces in compile-time for ForumTopics. -var ( - _ bin.Encoder = &ForumTopics{} - _ bin.Decoder = &ForumTopics{} - _ bin.BareEncoder = &ForumTopics{} - _ bin.BareDecoder = &ForumTopics{} -) - -func (f *ForumTopics) Zero() bool { - if f == nil { - return true - } - if !(f.TotalCount == 0) { - return false - } - if !(f.Topics == nil) { - return false - } - if !(f.NextOffsetDate == 0) { - return false - } - if !(f.NextOffsetMessageID == 0) { - return false - } - if !(f.NextOffsetMessageThreadID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *ForumTopics) String() string { - if f == nil { - return "ForumTopics(nil)" - } - type Alias ForumTopics - return fmt.Sprintf("ForumTopics%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ForumTopics) TypeID() uint32 { - return ForumTopicsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ForumTopics) TypeName() string { - return "forumTopics" -} - -// TypeInfo returns info about TL type. -func (f *ForumTopics) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "forumTopics", - ID: ForumTopicsTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Topics", - SchemaName: "topics", - }, - { - Name: "NextOffsetDate", - SchemaName: "next_offset_date", - }, - { - Name: "NextOffsetMessageID", - SchemaName: "next_offset_message_id", - }, - { - Name: "NextOffsetMessageThreadID", - SchemaName: "next_offset_message_thread_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *ForumTopics) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forumTopics#2d99b4ae as nil") - } - b.PutID(ForumTopicsTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *ForumTopics) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forumTopics#2d99b4ae as nil") - } - b.PutInt32(f.TotalCount) - b.PutInt(len(f.Topics)) - for idx, v := range f.Topics { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare forumTopics#2d99b4ae: field topics element with index %d: %w", idx, err) - } - } - b.PutInt32(f.NextOffsetDate) - b.PutInt53(f.NextOffsetMessageID) - b.PutInt53(f.NextOffsetMessageThreadID) - return nil -} - -// Decode implements bin.Decoder. -func (f *ForumTopics) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forumTopics#2d99b4ae to nil") - } - if err := b.ConsumeID(ForumTopicsTypeID); err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *ForumTopics) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forumTopics#2d99b4ae to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field total_count: %w", err) - } - f.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field topics: %w", err) - } - - if headerLen > 0 { - f.Topics = make([]ForumTopic, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ForumTopic - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare forumTopics#2d99b4ae: field topics: %w", err) - } - f.Topics = append(f.Topics, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_date: %w", err) - } - f.NextOffsetDate = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_message_id: %w", err) - } - f.NextOffsetMessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_message_thread_id: %w", err) - } - f.NextOffsetMessageThreadID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *ForumTopics) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode forumTopics#2d99b4ae as nil") - } - b.ObjStart() - b.PutID("forumTopics") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(f.TotalCount) - b.Comma() - b.FieldStart("topics") - b.ArrStart() - for idx, v := range f.Topics { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode forumTopics#2d99b4ae: field topics element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset_date") - b.PutInt32(f.NextOffsetDate) - b.Comma() - b.FieldStart("next_offset_message_id") - b.PutInt53(f.NextOffsetMessageID) - b.Comma() - b.FieldStart("next_offset_message_thread_id") - b.PutInt53(f.NextOffsetMessageThreadID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *ForumTopics) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode forumTopics#2d99b4ae to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("forumTopics"); err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field total_count: %w", err) - } - f.TotalCount = value - case "topics": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ForumTopic - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field topics: %w", err) - } - f.Topics = append(f.Topics, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field topics: %w", err) - } - case "next_offset_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_date: %w", err) - } - f.NextOffsetDate = value - case "next_offset_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_message_id: %w", err) - } - f.NextOffsetMessageID = value - case "next_offset_message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forumTopics#2d99b4ae: field next_offset_message_thread_id: %w", err) - } - f.NextOffsetMessageThreadID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (f *ForumTopics) GetTotalCount() (value int32) { - if f == nil { - return - } - return f.TotalCount -} - -// GetTopics returns value of Topics field. -func (f *ForumTopics) GetTopics() (value []ForumTopic) { - if f == nil { - return - } - return f.Topics -} - -// GetNextOffsetDate returns value of NextOffsetDate field. -func (f *ForumTopics) GetNextOffsetDate() (value int32) { - if f == nil { - return - } - return f.NextOffsetDate -} - -// GetNextOffsetMessageID returns value of NextOffsetMessageID field. -func (f *ForumTopics) GetNextOffsetMessageID() (value int64) { - if f == nil { - return - } - return f.NextOffsetMessageID -} - -// GetNextOffsetMessageThreadID returns value of NextOffsetMessageThreadID field. -func (f *ForumTopics) GetNextOffsetMessageThreadID() (value int64) { - if f == nil { - return - } - return f.NextOffsetMessageThreadID -} diff --git a/tdapi/tl_forward_messages_gen.go b/tdapi/tl_forward_messages_gen.go deleted file mode 100644 index 5382ff595..000000000 --- a/tdapi/tl_forward_messages_gen.go +++ /dev/null @@ -1,435 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ForwardMessagesRequest represents TL type `forwardMessages#34de5b20`. -type ForwardMessagesRequest struct { - // Identifier of the chat to which to forward messages - ChatID int64 - // If not 0, the message thread identifier in which the message will be sent; for forum - // threads only - MessageThreadID int64 - // Identifier of the chat from which to forward messages - FromChatID int64 - // Identifiers of the messages to forward. Message identifiers must be in a strictly - // increasing order. At most 100 messages can be forwarded simultaneously. A message can - // be forwarded only if messageProperties.can_be_forwarded - MessageIDs []int64 - // Options to be used to send the messages; pass null to use default options - Options MessageSendOptions - // Pass true to copy content of the messages without reference to the original sender. - // Always true if the messages are forwarded to a secret chat or are local. - SendCopy bool - // Pass true to remove media captions of message copies. Ignored if send_copy is false - RemoveCaption bool -} - -// ForwardMessagesRequestTypeID is TL type id of ForwardMessagesRequest. -const ForwardMessagesRequestTypeID = 0x34de5b20 - -// Ensuring interfaces in compile-time for ForwardMessagesRequest. -var ( - _ bin.Encoder = &ForwardMessagesRequest{} - _ bin.Decoder = &ForwardMessagesRequest{} - _ bin.BareEncoder = &ForwardMessagesRequest{} - _ bin.BareDecoder = &ForwardMessagesRequest{} -) - -func (f *ForwardMessagesRequest) Zero() bool { - if f == nil { - return true - } - if !(f.ChatID == 0) { - return false - } - if !(f.MessageThreadID == 0) { - return false - } - if !(f.FromChatID == 0) { - return false - } - if !(f.MessageIDs == nil) { - return false - } - if !(f.Options.Zero()) { - return false - } - if !(f.SendCopy == false) { - return false - } - if !(f.RemoveCaption == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *ForwardMessagesRequest) String() string { - if f == nil { - return "ForwardMessagesRequest(nil)" - } - type Alias ForwardMessagesRequest - return fmt.Sprintf("ForwardMessagesRequest%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ForwardMessagesRequest) TypeID() uint32 { - return ForwardMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ForwardMessagesRequest) TypeName() string { - return "forwardMessages" -} - -// TypeInfo returns info about TL type. -func (f *ForwardMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "forwardMessages", - ID: ForwardMessagesRequestTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "FromChatID", - SchemaName: "from_chat_id", - }, - { - Name: "MessageIDs", - SchemaName: "message_ids", - }, - { - Name: "Options", - SchemaName: "options", - }, - { - Name: "SendCopy", - SchemaName: "send_copy", - }, - { - Name: "RemoveCaption", - SchemaName: "remove_caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *ForwardMessagesRequest) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forwardMessages#34de5b20 as nil") - } - b.PutID(ForwardMessagesRequestTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *ForwardMessagesRequest) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forwardMessages#34de5b20 as nil") - } - b.PutInt53(f.ChatID) - b.PutInt53(f.MessageThreadID) - b.PutInt53(f.FromChatID) - b.PutInt(len(f.MessageIDs)) - for _, v := range f.MessageIDs { - b.PutInt53(v) - } - if err := f.Options.Encode(b); err != nil { - return fmt.Errorf("unable to encode forwardMessages#34de5b20: field options: %w", err) - } - b.PutBool(f.SendCopy) - b.PutBool(f.RemoveCaption) - return nil -} - -// Decode implements bin.Decoder. -func (f *ForwardMessagesRequest) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forwardMessages#34de5b20 to nil") - } - if err := b.ConsumeID(ForwardMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *ForwardMessagesRequest) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forwardMessages#34de5b20 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field chat_id: %w", err) - } - f.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field message_thread_id: %w", err) - } - f.MessageThreadID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field from_chat_id: %w", err) - } - f.FromChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field message_ids: %w", err) - } - - if headerLen > 0 { - f.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field message_ids: %w", err) - } - f.MessageIDs = append(f.MessageIDs, value) - } - } - { - if err := f.Options.Decode(b); err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field options: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field send_copy: %w", err) - } - f.SendCopy = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field remove_caption: %w", err) - } - f.RemoveCaption = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *ForwardMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode forwardMessages#34de5b20 as nil") - } - b.ObjStart() - b.PutID("forwardMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(f.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(f.MessageThreadID) - b.Comma() - b.FieldStart("from_chat_id") - b.PutInt53(f.FromChatID) - b.Comma() - b.FieldStart("message_ids") - b.ArrStart() - for _, v := range f.MessageIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("options") - if err := f.Options.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode forwardMessages#34de5b20: field options: %w", err) - } - b.Comma() - b.FieldStart("send_copy") - b.PutBool(f.SendCopy) - b.Comma() - b.FieldStart("remove_caption") - b.PutBool(f.RemoveCaption) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *ForwardMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode forwardMessages#34de5b20 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("forwardMessages"); err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field chat_id: %w", err) - } - f.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field message_thread_id: %w", err) - } - f.MessageThreadID = value - case "from_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field from_chat_id: %w", err) - } - f.FromChatID = value - case "message_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field message_ids: %w", err) - } - f.MessageIDs = append(f.MessageIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field message_ids: %w", err) - } - case "options": - if err := f.Options.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field options: %w", err) - } - case "send_copy": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field send_copy: %w", err) - } - f.SendCopy = value - case "remove_caption": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forwardMessages#34de5b20: field remove_caption: %w", err) - } - f.RemoveCaption = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (f *ForwardMessagesRequest) GetChatID() (value int64) { - if f == nil { - return - } - return f.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (f *ForwardMessagesRequest) GetMessageThreadID() (value int64) { - if f == nil { - return - } - return f.MessageThreadID -} - -// GetFromChatID returns value of FromChatID field. -func (f *ForwardMessagesRequest) GetFromChatID() (value int64) { - if f == nil { - return - } - return f.FromChatID -} - -// GetMessageIDs returns value of MessageIDs field. -func (f *ForwardMessagesRequest) GetMessageIDs() (value []int64) { - if f == nil { - return - } - return f.MessageIDs -} - -// GetOptions returns value of Options field. -func (f *ForwardMessagesRequest) GetOptions() (value MessageSendOptions) { - if f == nil { - return - } - return f.Options -} - -// GetSendCopy returns value of SendCopy field. -func (f *ForwardMessagesRequest) GetSendCopy() (value bool) { - if f == nil { - return - } - return f.SendCopy -} - -// GetRemoveCaption returns value of RemoveCaption field. -func (f *ForwardMessagesRequest) GetRemoveCaption() (value bool) { - if f == nil { - return - } - return f.RemoveCaption -} - -// ForwardMessages invokes method forwardMessages#34de5b20 returning error if any. -func (c *Client) ForwardMessages(ctx context.Context, request *ForwardMessagesRequest) (*Messages, error) { - var result Messages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_forward_source_gen.go b/tdapi/tl_forward_source_gen.go deleted file mode 100644 index 463c6fb50..000000000 --- a/tdapi/tl_forward_source_gen.go +++ /dev/null @@ -1,375 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ForwardSource represents TL type `forwardSource#6b02aec9`. -type ForwardSource struct { - // Identifier of the chat to which the message that was forwarded belonged; may be 0 if - // unknown - ChatID int64 - // Identifier of the message; may be 0 if unknown - MessageID int64 - // Identifier of the sender of the message; may be null if unknown or the new message was - // forwarded not to Saved Messages - SenderID MessageSenderClass - // Name of the sender of the message if the sender is hidden by their privacy settings - SenderName string - // Point in time (Unix timestamp) when the message is sent; 0 if unknown - Date int32 - // True, if the message that was forwarded is outgoing; always false if sender is unknown - IsOutgoing bool -} - -// ForwardSourceTypeID is TL type id of ForwardSource. -const ForwardSourceTypeID = 0x6b02aec9 - -// Ensuring interfaces in compile-time for ForwardSource. -var ( - _ bin.Encoder = &ForwardSource{} - _ bin.Decoder = &ForwardSource{} - _ bin.BareEncoder = &ForwardSource{} - _ bin.BareDecoder = &ForwardSource{} -) - -func (f *ForwardSource) Zero() bool { - if f == nil { - return true - } - if !(f.ChatID == 0) { - return false - } - if !(f.MessageID == 0) { - return false - } - if !(f.SenderID == nil) { - return false - } - if !(f.SenderName == "") { - return false - } - if !(f.Date == 0) { - return false - } - if !(f.IsOutgoing == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *ForwardSource) String() string { - if f == nil { - return "ForwardSource(nil)" - } - type Alias ForwardSource - return fmt.Sprintf("ForwardSource%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ForwardSource) TypeID() uint32 { - return ForwardSourceTypeID -} - -// TypeName returns name of type in TL schema. -func (*ForwardSource) TypeName() string { - return "forwardSource" -} - -// TypeInfo returns info about TL type. -func (f *ForwardSource) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "forwardSource", - ID: ForwardSourceTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "SenderID", - SchemaName: "sender_id", - }, - { - Name: "SenderName", - SchemaName: "sender_name", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "IsOutgoing", - SchemaName: "is_outgoing", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *ForwardSource) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forwardSource#6b02aec9 as nil") - } - b.PutID(ForwardSourceTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *ForwardSource) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode forwardSource#6b02aec9 as nil") - } - b.PutInt53(f.ChatID) - b.PutInt53(f.MessageID) - if f.SenderID == nil { - return fmt.Errorf("unable to encode forwardSource#6b02aec9: field sender_id is nil") - } - if err := f.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode forwardSource#6b02aec9: field sender_id: %w", err) - } - b.PutString(f.SenderName) - b.PutInt32(f.Date) - b.PutBool(f.IsOutgoing) - return nil -} - -// Decode implements bin.Decoder. -func (f *ForwardSource) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forwardSource#6b02aec9 to nil") - } - if err := b.ConsumeID(ForwardSourceTypeID); err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *ForwardSource) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode forwardSource#6b02aec9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field chat_id: %w", err) - } - f.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field message_id: %w", err) - } - f.MessageID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field sender_id: %w", err) - } - f.SenderID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field sender_name: %w", err) - } - f.SenderName = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field date: %w", err) - } - f.Date = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field is_outgoing: %w", err) - } - f.IsOutgoing = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *ForwardSource) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode forwardSource#6b02aec9 as nil") - } - b.ObjStart() - b.PutID("forwardSource") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(f.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(f.MessageID) - b.Comma() - b.FieldStart("sender_id") - if f.SenderID == nil { - return fmt.Errorf("unable to encode forwardSource#6b02aec9: field sender_id is nil") - } - if err := f.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode forwardSource#6b02aec9: field sender_id: %w", err) - } - b.Comma() - b.FieldStart("sender_name") - b.PutString(f.SenderName) - b.Comma() - b.FieldStart("date") - b.PutInt32(f.Date) - b.Comma() - b.FieldStart("is_outgoing") - b.PutBool(f.IsOutgoing) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *ForwardSource) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode forwardSource#6b02aec9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("forwardSource"); err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field chat_id: %w", err) - } - f.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field message_id: %w", err) - } - f.MessageID = value - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field sender_id: %w", err) - } - f.SenderID = value - case "sender_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field sender_name: %w", err) - } - f.SenderName = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field date: %w", err) - } - f.Date = value - case "is_outgoing": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode forwardSource#6b02aec9: field is_outgoing: %w", err) - } - f.IsOutgoing = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (f *ForwardSource) GetChatID() (value int64) { - if f == nil { - return - } - return f.ChatID -} - -// GetMessageID returns value of MessageID field. -func (f *ForwardSource) GetMessageID() (value int64) { - if f == nil { - return - } - return f.MessageID -} - -// GetSenderID returns value of SenderID field. -func (f *ForwardSource) GetSenderID() (value MessageSenderClass) { - if f == nil { - return - } - return f.SenderID -} - -// GetSenderName returns value of SenderName field. -func (f *ForwardSource) GetSenderName() (value string) { - if f == nil { - return - } - return f.SenderName -} - -// GetDate returns value of Date field. -func (f *ForwardSource) GetDate() (value int32) { - if f == nil { - return - } - return f.Date -} - -// GetIsOutgoing returns value of IsOutgoing field. -func (f *ForwardSource) GetIsOutgoing() (value bool) { - if f == nil { - return - } - return f.IsOutgoing -} diff --git a/tdapi/tl_found_affiliate_program_gen.go b/tdapi/tl_found_affiliate_program_gen.go deleted file mode 100644 index 7df4aec22..000000000 --- a/tdapi/tl_found_affiliate_program_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FoundAffiliateProgram represents TL type `foundAffiliateProgram#c6636286`. -type FoundAffiliateProgram struct { - // User identifier of the bot created the program - BotUserID int64 - // Information about the affiliate program - Info AffiliateProgramInfo -} - -// FoundAffiliateProgramTypeID is TL type id of FoundAffiliateProgram. -const FoundAffiliateProgramTypeID = 0xc6636286 - -// Ensuring interfaces in compile-time for FoundAffiliateProgram. -var ( - _ bin.Encoder = &FoundAffiliateProgram{} - _ bin.Decoder = &FoundAffiliateProgram{} - _ bin.BareEncoder = &FoundAffiliateProgram{} - _ bin.BareDecoder = &FoundAffiliateProgram{} -) - -func (f *FoundAffiliateProgram) Zero() bool { - if f == nil { - return true - } - if !(f.BotUserID == 0) { - return false - } - if !(f.Info.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundAffiliateProgram) String() string { - if f == nil { - return "FoundAffiliateProgram(nil)" - } - type Alias FoundAffiliateProgram - return fmt.Sprintf("FoundAffiliateProgram%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundAffiliateProgram) TypeID() uint32 { - return FoundAffiliateProgramTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundAffiliateProgram) TypeName() string { - return "foundAffiliateProgram" -} - -// TypeInfo returns info about TL type. -func (f *FoundAffiliateProgram) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundAffiliateProgram", - ID: FoundAffiliateProgramTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Info", - SchemaName: "info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundAffiliateProgram) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundAffiliateProgram#c6636286 as nil") - } - b.PutID(FoundAffiliateProgramTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundAffiliateProgram) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundAffiliateProgram#c6636286 as nil") - } - b.PutInt53(f.BotUserID) - if err := f.Info.Encode(b); err != nil { - return fmt.Errorf("unable to encode foundAffiliateProgram#c6636286: field info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundAffiliateProgram) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundAffiliateProgram#c6636286 to nil") - } - if err := b.ConsumeID(FoundAffiliateProgramTypeID); err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundAffiliateProgram) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundAffiliateProgram#c6636286 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field bot_user_id: %w", err) - } - f.BotUserID = value - } - { - if err := f.Info.Decode(b); err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundAffiliateProgram#c6636286 as nil") - } - b.ObjStart() - b.PutID("foundAffiliateProgram") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(f.BotUserID) - b.Comma() - b.FieldStart("info") - if err := f.Info.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundAffiliateProgram#c6636286: field info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundAffiliateProgram) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundAffiliateProgram#c6636286 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field bot_user_id: %w", err) - } - f.BotUserID = value - case "info": - if err := f.Info.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundAffiliateProgram#c6636286: field info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (f *FoundAffiliateProgram) GetBotUserID() (value int64) { - if f == nil { - return - } - return f.BotUserID -} - -// GetInfo returns value of Info field. -func (f *FoundAffiliateProgram) GetInfo() (value AffiliateProgramInfo) { - if f == nil { - return - } - return f.Info -} diff --git a/tdapi/tl_found_affiliate_programs_gen.go b/tdapi/tl_found_affiliate_programs_gen.go deleted file mode 100644 index b25ceb677..000000000 --- a/tdapi/tl_found_affiliate_programs_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FoundAffiliatePrograms represents TL type `foundAffiliatePrograms#b6228108`. -type FoundAffiliatePrograms struct { - // The total number of found affiliate programs - TotalCount int32 - // The list of affiliate programs - Programs []FoundAffiliateProgram - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// FoundAffiliateProgramsTypeID is TL type id of FoundAffiliatePrograms. -const FoundAffiliateProgramsTypeID = 0xb6228108 - -// Ensuring interfaces in compile-time for FoundAffiliatePrograms. -var ( - _ bin.Encoder = &FoundAffiliatePrograms{} - _ bin.Decoder = &FoundAffiliatePrograms{} - _ bin.BareEncoder = &FoundAffiliatePrograms{} - _ bin.BareDecoder = &FoundAffiliatePrograms{} -) - -func (f *FoundAffiliatePrograms) Zero() bool { - if f == nil { - return true - } - if !(f.TotalCount == 0) { - return false - } - if !(f.Programs == nil) { - return false - } - if !(f.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundAffiliatePrograms) String() string { - if f == nil { - return "FoundAffiliatePrograms(nil)" - } - type Alias FoundAffiliatePrograms - return fmt.Sprintf("FoundAffiliatePrograms%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundAffiliatePrograms) TypeID() uint32 { - return FoundAffiliateProgramsTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundAffiliatePrograms) TypeName() string { - return "foundAffiliatePrograms" -} - -// TypeInfo returns info about TL type. -func (f *FoundAffiliatePrograms) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundAffiliatePrograms", - ID: FoundAffiliateProgramsTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Programs", - SchemaName: "programs", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundAffiliatePrograms) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundAffiliatePrograms#b6228108 as nil") - } - b.PutID(FoundAffiliateProgramsTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundAffiliatePrograms) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundAffiliatePrograms#b6228108 as nil") - } - b.PutInt32(f.TotalCount) - b.PutInt(len(f.Programs)) - for idx, v := range f.Programs { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare foundAffiliatePrograms#b6228108: field programs element with index %d: %w", idx, err) - } - } - b.PutString(f.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundAffiliatePrograms) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundAffiliatePrograms#b6228108 to nil") - } - if err := b.ConsumeID(FoundAffiliateProgramsTypeID); err != nil { - return fmt.Errorf("unable to decode foundAffiliatePrograms#b6228108: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundAffiliatePrograms) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundAffiliatePrograms#b6228108 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundAffiliatePrograms#b6228108: field total_count: %w", err) - } - f.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode foundAffiliatePrograms#b6228108: field programs: %w", err) - } - - if headerLen > 0 { - f.Programs = make([]FoundAffiliateProgram, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value FoundAffiliateProgram - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare foundAffiliatePrograms#b6228108: field programs: %w", err) - } - f.Programs = append(f.Programs, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundAffiliatePrograms#b6228108: field next_offset: %w", err) - } - f.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundAffiliatePrograms) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundAffiliatePrograms#b6228108 as nil") - } - b.ObjStart() - b.PutID("foundAffiliatePrograms") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(f.TotalCount) - b.Comma() - b.FieldStart("programs") - b.ArrStart() - for idx, v := range f.Programs { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundAffiliatePrograms#b6228108: field programs element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(f.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundAffiliatePrograms) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundAffiliatePrograms#b6228108 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundAffiliatePrograms"); err != nil { - return fmt.Errorf("unable to decode foundAffiliatePrograms#b6228108: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundAffiliatePrograms#b6228108: field total_count: %w", err) - } - f.TotalCount = value - case "programs": - if err := b.Arr(func(b tdjson.Decoder) error { - var value FoundAffiliateProgram - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundAffiliatePrograms#b6228108: field programs: %w", err) - } - f.Programs = append(f.Programs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode foundAffiliatePrograms#b6228108: field programs: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundAffiliatePrograms#b6228108: field next_offset: %w", err) - } - f.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (f *FoundAffiliatePrograms) GetTotalCount() (value int32) { - if f == nil { - return - } - return f.TotalCount -} - -// GetPrograms returns value of Programs field. -func (f *FoundAffiliatePrograms) GetPrograms() (value []FoundAffiliateProgram) { - if f == nil { - return - } - return f.Programs -} - -// GetNextOffset returns value of NextOffset field. -func (f *FoundAffiliatePrograms) GetNextOffset() (value string) { - if f == nil { - return - } - return f.NextOffset -} diff --git a/tdapi/tl_found_chat_boosts_gen.go b/tdapi/tl_found_chat_boosts_gen.go deleted file mode 100644 index aaf479004..000000000 --- a/tdapi/tl_found_chat_boosts_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FoundChatBoosts represents TL type `foundChatBoosts#dc80d52e`. -type FoundChatBoosts struct { - // Total number of boosts applied to the chat - TotalCount int32 - // List of boosts - Boosts []ChatBoost - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// FoundChatBoostsTypeID is TL type id of FoundChatBoosts. -const FoundChatBoostsTypeID = 0xdc80d52e - -// Ensuring interfaces in compile-time for FoundChatBoosts. -var ( - _ bin.Encoder = &FoundChatBoosts{} - _ bin.Decoder = &FoundChatBoosts{} - _ bin.BareEncoder = &FoundChatBoosts{} - _ bin.BareDecoder = &FoundChatBoosts{} -) - -func (f *FoundChatBoosts) Zero() bool { - if f == nil { - return true - } - if !(f.TotalCount == 0) { - return false - } - if !(f.Boosts == nil) { - return false - } - if !(f.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundChatBoosts) String() string { - if f == nil { - return "FoundChatBoosts(nil)" - } - type Alias FoundChatBoosts - return fmt.Sprintf("FoundChatBoosts%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundChatBoosts) TypeID() uint32 { - return FoundChatBoostsTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundChatBoosts) TypeName() string { - return "foundChatBoosts" -} - -// TypeInfo returns info about TL type. -func (f *FoundChatBoosts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundChatBoosts", - ID: FoundChatBoostsTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Boosts", - SchemaName: "boosts", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundChatBoosts) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundChatBoosts#dc80d52e as nil") - } - b.PutID(FoundChatBoostsTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundChatBoosts) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundChatBoosts#dc80d52e as nil") - } - b.PutInt32(f.TotalCount) - b.PutInt(len(f.Boosts)) - for idx, v := range f.Boosts { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare foundChatBoosts#dc80d52e: field boosts element with index %d: %w", idx, err) - } - } - b.PutString(f.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundChatBoosts) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundChatBoosts#dc80d52e to nil") - } - if err := b.ConsumeID(FoundChatBoostsTypeID); err != nil { - return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundChatBoosts) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundChatBoosts#dc80d52e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field total_count: %w", err) - } - f.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field boosts: %w", err) - } - - if headerLen > 0 { - f.Boosts = make([]ChatBoost, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatBoost - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare foundChatBoosts#dc80d52e: field boosts: %w", err) - } - f.Boosts = append(f.Boosts, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field next_offset: %w", err) - } - f.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundChatBoosts) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundChatBoosts#dc80d52e as nil") - } - b.ObjStart() - b.PutID("foundChatBoosts") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(f.TotalCount) - b.Comma() - b.FieldStart("boosts") - b.ArrStart() - for idx, v := range f.Boosts { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundChatBoosts#dc80d52e: field boosts element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(f.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundChatBoosts) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundChatBoosts#dc80d52e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundChatBoosts"); err != nil { - return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field total_count: %w", err) - } - f.TotalCount = value - case "boosts": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatBoost - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field boosts: %w", err) - } - f.Boosts = append(f.Boosts, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field boosts: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundChatBoosts#dc80d52e: field next_offset: %w", err) - } - f.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (f *FoundChatBoosts) GetTotalCount() (value int32) { - if f == nil { - return - } - return f.TotalCount -} - -// GetBoosts returns value of Boosts field. -func (f *FoundChatBoosts) GetBoosts() (value []ChatBoost) { - if f == nil { - return - } - return f.Boosts -} - -// GetNextOffset returns value of NextOffset field. -func (f *FoundChatBoosts) GetNextOffset() (value string) { - if f == nil { - return - } - return f.NextOffset -} diff --git a/tdapi/tl_found_chat_messages_gen.go b/tdapi/tl_found_chat_messages_gen.go deleted file mode 100644 index 1eb935ad9..000000000 --- a/tdapi/tl_found_chat_messages_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FoundChatMessages represents TL type `foundChatMessages#4a25270c`. -type FoundChatMessages struct { - // Approximate total number of messages found; -1 if unknown - TotalCount int32 - // List of messages - Messages []Message - // The offset for the next request. If 0, there are no more results - NextFromMessageID int64 -} - -// FoundChatMessagesTypeID is TL type id of FoundChatMessages. -const FoundChatMessagesTypeID = 0x4a25270c - -// Ensuring interfaces in compile-time for FoundChatMessages. -var ( - _ bin.Encoder = &FoundChatMessages{} - _ bin.Decoder = &FoundChatMessages{} - _ bin.BareEncoder = &FoundChatMessages{} - _ bin.BareDecoder = &FoundChatMessages{} -) - -func (f *FoundChatMessages) Zero() bool { - if f == nil { - return true - } - if !(f.TotalCount == 0) { - return false - } - if !(f.Messages == nil) { - return false - } - if !(f.NextFromMessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundChatMessages) String() string { - if f == nil { - return "FoundChatMessages(nil)" - } - type Alias FoundChatMessages - return fmt.Sprintf("FoundChatMessages%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundChatMessages) TypeID() uint32 { - return FoundChatMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundChatMessages) TypeName() string { - return "foundChatMessages" -} - -// TypeInfo returns info about TL type. -func (f *FoundChatMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundChatMessages", - ID: FoundChatMessagesTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Messages", - SchemaName: "messages", - }, - { - Name: "NextFromMessageID", - SchemaName: "next_from_message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundChatMessages) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundChatMessages#4a25270c as nil") - } - b.PutID(FoundChatMessagesTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundChatMessages) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundChatMessages#4a25270c as nil") - } - b.PutInt32(f.TotalCount) - b.PutInt(len(f.Messages)) - for idx, v := range f.Messages { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare foundChatMessages#4a25270c: field messages element with index %d: %w", idx, err) - } - } - b.PutInt53(f.NextFromMessageID) - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundChatMessages) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundChatMessages#4a25270c to nil") - } - if err := b.ConsumeID(FoundChatMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode foundChatMessages#4a25270c: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundChatMessages) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundChatMessages#4a25270c to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundChatMessages#4a25270c: field total_count: %w", err) - } - f.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode foundChatMessages#4a25270c: field messages: %w", err) - } - - if headerLen > 0 { - f.Messages = make([]Message, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Message - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare foundChatMessages#4a25270c: field messages: %w", err) - } - f.Messages = append(f.Messages, value) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode foundChatMessages#4a25270c: field next_from_message_id: %w", err) - } - f.NextFromMessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundChatMessages) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundChatMessages#4a25270c as nil") - } - b.ObjStart() - b.PutID("foundChatMessages") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(f.TotalCount) - b.Comma() - b.FieldStart("messages") - b.ArrStart() - for idx, v := range f.Messages { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundChatMessages#4a25270c: field messages element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_from_message_id") - b.PutInt53(f.NextFromMessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundChatMessages) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundChatMessages#4a25270c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundChatMessages"); err != nil { - return fmt.Errorf("unable to decode foundChatMessages#4a25270c: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundChatMessages#4a25270c: field total_count: %w", err) - } - f.TotalCount = value - case "messages": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Message - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundChatMessages#4a25270c: field messages: %w", err) - } - f.Messages = append(f.Messages, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode foundChatMessages#4a25270c: field messages: %w", err) - } - case "next_from_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode foundChatMessages#4a25270c: field next_from_message_id: %w", err) - } - f.NextFromMessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (f *FoundChatMessages) GetTotalCount() (value int32) { - if f == nil { - return - } - return f.TotalCount -} - -// GetMessages returns value of Messages field. -func (f *FoundChatMessages) GetMessages() (value []Message) { - if f == nil { - return - } - return f.Messages -} - -// GetNextFromMessageID returns value of NextFromMessageID field. -func (f *FoundChatMessages) GetNextFromMessageID() (value int64) { - if f == nil { - return - } - return f.NextFromMessageID -} diff --git a/tdapi/tl_found_file_downloads_gen.go b/tdapi/tl_found_file_downloads_gen.go deleted file mode 100644 index cd3855f4c..000000000 --- a/tdapi/tl_found_file_downloads_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FoundFileDownloads represents TL type `foundFileDownloads#c7db4128`. -type FoundFileDownloads struct { - // Total number of suitable files, ignoring offset - TotalCounts DownloadedFileCounts - // The list of files - Files []FileDownload - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// FoundFileDownloadsTypeID is TL type id of FoundFileDownloads. -const FoundFileDownloadsTypeID = 0xc7db4128 - -// Ensuring interfaces in compile-time for FoundFileDownloads. -var ( - _ bin.Encoder = &FoundFileDownloads{} - _ bin.Decoder = &FoundFileDownloads{} - _ bin.BareEncoder = &FoundFileDownloads{} - _ bin.BareDecoder = &FoundFileDownloads{} -) - -func (f *FoundFileDownloads) Zero() bool { - if f == nil { - return true - } - if !(f.TotalCounts.Zero()) { - return false - } - if !(f.Files == nil) { - return false - } - if !(f.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundFileDownloads) String() string { - if f == nil { - return "FoundFileDownloads(nil)" - } - type Alias FoundFileDownloads - return fmt.Sprintf("FoundFileDownloads%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundFileDownloads) TypeID() uint32 { - return FoundFileDownloadsTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundFileDownloads) TypeName() string { - return "foundFileDownloads" -} - -// TypeInfo returns info about TL type. -func (f *FoundFileDownloads) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundFileDownloads", - ID: FoundFileDownloadsTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCounts", - SchemaName: "total_counts", - }, - { - Name: "Files", - SchemaName: "files", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundFileDownloads) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundFileDownloads#c7db4128 as nil") - } - b.PutID(FoundFileDownloadsTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundFileDownloads) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundFileDownloads#c7db4128 as nil") - } - if err := f.TotalCounts.Encode(b); err != nil { - return fmt.Errorf("unable to encode foundFileDownloads#c7db4128: field total_counts: %w", err) - } - b.PutInt(len(f.Files)) - for idx, v := range f.Files { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare foundFileDownloads#c7db4128: field files element with index %d: %w", idx, err) - } - } - b.PutString(f.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundFileDownloads) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundFileDownloads#c7db4128 to nil") - } - if err := b.ConsumeID(FoundFileDownloadsTypeID); err != nil { - return fmt.Errorf("unable to decode foundFileDownloads#c7db4128: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundFileDownloads) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundFileDownloads#c7db4128 to nil") - } - { - if err := f.TotalCounts.Decode(b); err != nil { - return fmt.Errorf("unable to decode foundFileDownloads#c7db4128: field total_counts: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode foundFileDownloads#c7db4128: field files: %w", err) - } - - if headerLen > 0 { - f.Files = make([]FileDownload, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value FileDownload - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare foundFileDownloads#c7db4128: field files: %w", err) - } - f.Files = append(f.Files, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundFileDownloads#c7db4128: field next_offset: %w", err) - } - f.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundFileDownloads) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundFileDownloads#c7db4128 as nil") - } - b.ObjStart() - b.PutID("foundFileDownloads") - b.Comma() - b.FieldStart("total_counts") - if err := f.TotalCounts.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundFileDownloads#c7db4128: field total_counts: %w", err) - } - b.Comma() - b.FieldStart("files") - b.ArrStart() - for idx, v := range f.Files { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundFileDownloads#c7db4128: field files element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(f.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundFileDownloads) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundFileDownloads#c7db4128 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundFileDownloads"); err != nil { - return fmt.Errorf("unable to decode foundFileDownloads#c7db4128: %w", err) - } - case "total_counts": - if err := f.TotalCounts.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundFileDownloads#c7db4128: field total_counts: %w", err) - } - case "files": - if err := b.Arr(func(b tdjson.Decoder) error { - var value FileDownload - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundFileDownloads#c7db4128: field files: %w", err) - } - f.Files = append(f.Files, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode foundFileDownloads#c7db4128: field files: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundFileDownloads#c7db4128: field next_offset: %w", err) - } - f.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCounts returns value of TotalCounts field. -func (f *FoundFileDownloads) GetTotalCounts() (value DownloadedFileCounts) { - if f == nil { - return - } - return f.TotalCounts -} - -// GetFiles returns value of Files field. -func (f *FoundFileDownloads) GetFiles() (value []FileDownload) { - if f == nil { - return - } - return f.Files -} - -// GetNextOffset returns value of NextOffset field. -func (f *FoundFileDownloads) GetNextOffset() (value string) { - if f == nil { - return - } - return f.NextOffset -} diff --git a/tdapi/tl_found_messages_gen.go b/tdapi/tl_found_messages_gen.go deleted file mode 100644 index 239f820b1..000000000 --- a/tdapi/tl_found_messages_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FoundMessages represents TL type `foundMessages#2515f708`. -type FoundMessages struct { - // Approximate total number of messages found; -1 if unknown - TotalCount int32 - // List of messages - Messages []Message - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// FoundMessagesTypeID is TL type id of FoundMessages. -const FoundMessagesTypeID = 0x2515f708 - -// Ensuring interfaces in compile-time for FoundMessages. -var ( - _ bin.Encoder = &FoundMessages{} - _ bin.Decoder = &FoundMessages{} - _ bin.BareEncoder = &FoundMessages{} - _ bin.BareDecoder = &FoundMessages{} -) - -func (f *FoundMessages) Zero() bool { - if f == nil { - return true - } - if !(f.TotalCount == 0) { - return false - } - if !(f.Messages == nil) { - return false - } - if !(f.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundMessages) String() string { - if f == nil { - return "FoundMessages(nil)" - } - type Alias FoundMessages - return fmt.Sprintf("FoundMessages%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundMessages) TypeID() uint32 { - return FoundMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundMessages) TypeName() string { - return "foundMessages" -} - -// TypeInfo returns info about TL type. -func (f *FoundMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundMessages", - ID: FoundMessagesTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Messages", - SchemaName: "messages", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundMessages) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundMessages#2515f708 as nil") - } - b.PutID(FoundMessagesTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundMessages) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundMessages#2515f708 as nil") - } - b.PutInt32(f.TotalCount) - b.PutInt(len(f.Messages)) - for idx, v := range f.Messages { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare foundMessages#2515f708: field messages element with index %d: %w", idx, err) - } - } - b.PutString(f.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundMessages) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundMessages#2515f708 to nil") - } - if err := b.ConsumeID(FoundMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode foundMessages#2515f708: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundMessages) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundMessages#2515f708 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundMessages#2515f708: field total_count: %w", err) - } - f.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode foundMessages#2515f708: field messages: %w", err) - } - - if headerLen > 0 { - f.Messages = make([]Message, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Message - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare foundMessages#2515f708: field messages: %w", err) - } - f.Messages = append(f.Messages, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundMessages#2515f708: field next_offset: %w", err) - } - f.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundMessages) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundMessages#2515f708 as nil") - } - b.ObjStart() - b.PutID("foundMessages") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(f.TotalCount) - b.Comma() - b.FieldStart("messages") - b.ArrStart() - for idx, v := range f.Messages { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundMessages#2515f708: field messages element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(f.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundMessages) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundMessages#2515f708 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundMessages"); err != nil { - return fmt.Errorf("unable to decode foundMessages#2515f708: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundMessages#2515f708: field total_count: %w", err) - } - f.TotalCount = value - case "messages": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Message - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundMessages#2515f708: field messages: %w", err) - } - f.Messages = append(f.Messages, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode foundMessages#2515f708: field messages: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundMessages#2515f708: field next_offset: %w", err) - } - f.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (f *FoundMessages) GetTotalCount() (value int32) { - if f == nil { - return - } - return f.TotalCount -} - -// GetMessages returns value of Messages field. -func (f *FoundMessages) GetMessages() (value []Message) { - if f == nil { - return - } - return f.Messages -} - -// GetNextOffset returns value of NextOffset field. -func (f *FoundMessages) GetNextOffset() (value string) { - if f == nil { - return - } - return f.NextOffset -} diff --git a/tdapi/tl_found_position_gen.go b/tdapi/tl_found_position_gen.go deleted file mode 100644 index e03f30551..000000000 --- a/tdapi/tl_found_position_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FoundPosition represents TL type `foundPosition#8f8adf88`. -type FoundPosition struct { - // The position of the match - Position int32 -} - -// FoundPositionTypeID is TL type id of FoundPosition. -const FoundPositionTypeID = 0x8f8adf88 - -// Ensuring interfaces in compile-time for FoundPosition. -var ( - _ bin.Encoder = &FoundPosition{} - _ bin.Decoder = &FoundPosition{} - _ bin.BareEncoder = &FoundPosition{} - _ bin.BareDecoder = &FoundPosition{} -) - -func (f *FoundPosition) Zero() bool { - if f == nil { - return true - } - if !(f.Position == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundPosition) String() string { - if f == nil { - return "FoundPosition(nil)" - } - type Alias FoundPosition - return fmt.Sprintf("FoundPosition%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundPosition) TypeID() uint32 { - return FoundPositionTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundPosition) TypeName() string { - return "foundPosition" -} - -// TypeInfo returns info about TL type. -func (f *FoundPosition) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundPosition", - ID: FoundPositionTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Position", - SchemaName: "position", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundPosition) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundPosition#8f8adf88 as nil") - } - b.PutID(FoundPositionTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundPosition) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundPosition#8f8adf88 as nil") - } - b.PutInt32(f.Position) - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundPosition) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundPosition#8f8adf88 to nil") - } - if err := b.ConsumeID(FoundPositionTypeID); err != nil { - return fmt.Errorf("unable to decode foundPosition#8f8adf88: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundPosition) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundPosition#8f8adf88 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundPosition#8f8adf88: field position: %w", err) - } - f.Position = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundPosition) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundPosition#8f8adf88 as nil") - } - b.ObjStart() - b.PutID("foundPosition") - b.Comma() - b.FieldStart("position") - b.PutInt32(f.Position) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundPosition) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundPosition#8f8adf88 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundPosition"); err != nil { - return fmt.Errorf("unable to decode foundPosition#8f8adf88: %w", err) - } - case "position": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundPosition#8f8adf88: field position: %w", err) - } - f.Position = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPosition returns value of Position field. -func (f *FoundPosition) GetPosition() (value int32) { - if f == nil { - return - } - return f.Position -} diff --git a/tdapi/tl_found_positions_gen.go b/tdapi/tl_found_positions_gen.go deleted file mode 100644 index 7c205493c..000000000 --- a/tdapi/tl_found_positions_gen.go +++ /dev/null @@ -1,251 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FoundPositions represents TL type `foundPositions#afab1f62`. -type FoundPositions struct { - // Total number of matched objects - TotalCount int32 - // The positions of the matched objects - Positions []int32 -} - -// FoundPositionsTypeID is TL type id of FoundPositions. -const FoundPositionsTypeID = 0xafab1f62 - -// Ensuring interfaces in compile-time for FoundPositions. -var ( - _ bin.Encoder = &FoundPositions{} - _ bin.Decoder = &FoundPositions{} - _ bin.BareEncoder = &FoundPositions{} - _ bin.BareDecoder = &FoundPositions{} -) - -func (f *FoundPositions) Zero() bool { - if f == nil { - return true - } - if !(f.TotalCount == 0) { - return false - } - if !(f.Positions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundPositions) String() string { - if f == nil { - return "FoundPositions(nil)" - } - type Alias FoundPositions - return fmt.Sprintf("FoundPositions%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundPositions) TypeID() uint32 { - return FoundPositionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundPositions) TypeName() string { - return "foundPositions" -} - -// TypeInfo returns info about TL type. -func (f *FoundPositions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundPositions", - ID: FoundPositionsTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Positions", - SchemaName: "positions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundPositions) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundPositions#afab1f62 as nil") - } - b.PutID(FoundPositionsTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundPositions) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundPositions#afab1f62 as nil") - } - b.PutInt32(f.TotalCount) - b.PutInt(len(f.Positions)) - for _, v := range f.Positions { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundPositions) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundPositions#afab1f62 to nil") - } - if err := b.ConsumeID(FoundPositionsTypeID); err != nil { - return fmt.Errorf("unable to decode foundPositions#afab1f62: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundPositions) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundPositions#afab1f62 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundPositions#afab1f62: field total_count: %w", err) - } - f.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode foundPositions#afab1f62: field positions: %w", err) - } - - if headerLen > 0 { - f.Positions = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundPositions#afab1f62: field positions: %w", err) - } - f.Positions = append(f.Positions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundPositions) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundPositions#afab1f62 as nil") - } - b.ObjStart() - b.PutID("foundPositions") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(f.TotalCount) - b.Comma() - b.FieldStart("positions") - b.ArrStart() - for _, v := range f.Positions { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundPositions) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundPositions#afab1f62 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundPositions"); err != nil { - return fmt.Errorf("unable to decode foundPositions#afab1f62: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundPositions#afab1f62: field total_count: %w", err) - } - f.TotalCount = value - case "positions": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundPositions#afab1f62: field positions: %w", err) - } - f.Positions = append(f.Positions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode foundPositions#afab1f62: field positions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (f *FoundPositions) GetTotalCount() (value int32) { - if f == nil { - return - } - return f.TotalCount -} - -// GetPositions returns value of Positions field. -func (f *FoundPositions) GetPositions() (value []int32) { - if f == nil { - return - } - return f.Positions -} diff --git a/tdapi/tl_found_stories_gen.go b/tdapi/tl_found_stories_gen.go deleted file mode 100644 index da256bc5d..000000000 --- a/tdapi/tl_found_stories_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FoundStories represents TL type `foundStories#854b067c`. -type FoundStories struct { - // Approximate total number of stories found - TotalCount int32 - // List of stories - Stories []Story - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// FoundStoriesTypeID is TL type id of FoundStories. -const FoundStoriesTypeID = 0x854b067c - -// Ensuring interfaces in compile-time for FoundStories. -var ( - _ bin.Encoder = &FoundStories{} - _ bin.Decoder = &FoundStories{} - _ bin.BareEncoder = &FoundStories{} - _ bin.BareDecoder = &FoundStories{} -) - -func (f *FoundStories) Zero() bool { - if f == nil { - return true - } - if !(f.TotalCount == 0) { - return false - } - if !(f.Stories == nil) { - return false - } - if !(f.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundStories) String() string { - if f == nil { - return "FoundStories(nil)" - } - type Alias FoundStories - return fmt.Sprintf("FoundStories%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundStories) TypeID() uint32 { - return FoundStoriesTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundStories) TypeName() string { - return "foundStories" -} - -// TypeInfo returns info about TL type. -func (f *FoundStories) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundStories", - ID: FoundStoriesTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Stories", - SchemaName: "stories", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundStories) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundStories#854b067c as nil") - } - b.PutID(FoundStoriesTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundStories) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundStories#854b067c as nil") - } - b.PutInt32(f.TotalCount) - b.PutInt(len(f.Stories)) - for idx, v := range f.Stories { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare foundStories#854b067c: field stories element with index %d: %w", idx, err) - } - } - b.PutString(f.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundStories) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundStories#854b067c to nil") - } - if err := b.ConsumeID(FoundStoriesTypeID); err != nil { - return fmt.Errorf("unable to decode foundStories#854b067c: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundStories) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundStories#854b067c to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundStories#854b067c: field total_count: %w", err) - } - f.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode foundStories#854b067c: field stories: %w", err) - } - - if headerLen > 0 { - f.Stories = make([]Story, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Story - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare foundStories#854b067c: field stories: %w", err) - } - f.Stories = append(f.Stories, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundStories#854b067c: field next_offset: %w", err) - } - f.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundStories) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundStories#854b067c as nil") - } - b.ObjStart() - b.PutID("foundStories") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(f.TotalCount) - b.Comma() - b.FieldStart("stories") - b.ArrStart() - for idx, v := range f.Stories { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundStories#854b067c: field stories element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(f.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundStories) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundStories#854b067c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundStories"); err != nil { - return fmt.Errorf("unable to decode foundStories#854b067c: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode foundStories#854b067c: field total_count: %w", err) - } - f.TotalCount = value - case "stories": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Story - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundStories#854b067c: field stories: %w", err) - } - f.Stories = append(f.Stories, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode foundStories#854b067c: field stories: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundStories#854b067c: field next_offset: %w", err) - } - f.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (f *FoundStories) GetTotalCount() (value int32) { - if f == nil { - return - } - return f.TotalCount -} - -// GetStories returns value of Stories field. -func (f *FoundStories) GetStories() (value []Story) { - if f == nil { - return - } - return f.Stories -} - -// GetNextOffset returns value of NextOffset field. -func (f *FoundStories) GetNextOffset() (value string) { - if f == nil { - return - } - return f.NextOffset -} diff --git a/tdapi/tl_found_users_gen.go b/tdapi/tl_found_users_gen.go deleted file mode 100644 index a8a4544c2..000000000 --- a/tdapi/tl_found_users_gen.go +++ /dev/null @@ -1,251 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FoundUsers represents TL type `foundUsers#c531e854`. -type FoundUsers struct { - // Identifiers of the found users - UserIDs []int64 - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// FoundUsersTypeID is TL type id of FoundUsers. -const FoundUsersTypeID = 0xc531e854 - -// Ensuring interfaces in compile-time for FoundUsers. -var ( - _ bin.Encoder = &FoundUsers{} - _ bin.Decoder = &FoundUsers{} - _ bin.BareEncoder = &FoundUsers{} - _ bin.BareDecoder = &FoundUsers{} -) - -func (f *FoundUsers) Zero() bool { - if f == nil { - return true - } - if !(f.UserIDs == nil) { - return false - } - if !(f.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundUsers) String() string { - if f == nil { - return "FoundUsers(nil)" - } - type Alias FoundUsers - return fmt.Sprintf("FoundUsers%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundUsers) TypeID() uint32 { - return FoundUsersTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundUsers) TypeName() string { - return "foundUsers" -} - -// TypeInfo returns info about TL type. -func (f *FoundUsers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundUsers", - ID: FoundUsersTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundUsers) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundUsers#c531e854 as nil") - } - b.PutID(FoundUsersTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundUsers) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundUsers#c531e854 as nil") - } - b.PutInt(len(f.UserIDs)) - for _, v := range f.UserIDs { - b.PutInt53(v) - } - b.PutString(f.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundUsers) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundUsers#c531e854 to nil") - } - if err := b.ConsumeID(FoundUsersTypeID); err != nil { - return fmt.Errorf("unable to decode foundUsers#c531e854: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundUsers) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundUsers#c531e854 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode foundUsers#c531e854: field user_ids: %w", err) - } - - if headerLen > 0 { - f.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode foundUsers#c531e854: field user_ids: %w", err) - } - f.UserIDs = append(f.UserIDs, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundUsers#c531e854: field next_offset: %w", err) - } - f.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundUsers) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundUsers#c531e854 as nil") - } - b.ObjStart() - b.PutID("foundUsers") - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range f.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(f.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundUsers) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundUsers#c531e854 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundUsers"); err != nil { - return fmt.Errorf("unable to decode foundUsers#c531e854: %w", err) - } - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode foundUsers#c531e854: field user_ids: %w", err) - } - f.UserIDs = append(f.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode foundUsers#c531e854: field user_ids: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode foundUsers#c531e854: field next_offset: %w", err) - } - f.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserIDs returns value of UserIDs field. -func (f *FoundUsers) GetUserIDs() (value []int64) { - if f == nil { - return - } - return f.UserIDs -} - -// GetNextOffset returns value of NextOffset field. -func (f *FoundUsers) GetNextOffset() (value string) { - if f == nil { - return - } - return f.NextOffset -} diff --git a/tdapi/tl_found_web_app_gen.go b/tdapi/tl_found_web_app_gen.go deleted file mode 100644 index e2e5f8dd4..000000000 --- a/tdapi/tl_found_web_app_gen.go +++ /dev/null @@ -1,263 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// FoundWebApp represents TL type `foundWebApp#eea8d01e`. -type FoundWebApp struct { - // The Web App - WebApp WebApp - // True, if the user must be asked for the permission to the bot to send them messages - RequestWriteAccess bool - // True, if there is no need to show an ordinary open URL confirmation before opening the - // Web App. The field must be ignored and confirmation must be shown anyway if the Web - // App link was hidden - SkipConfirmation bool -} - -// FoundWebAppTypeID is TL type id of FoundWebApp. -const FoundWebAppTypeID = 0xeea8d01e - -// Ensuring interfaces in compile-time for FoundWebApp. -var ( - _ bin.Encoder = &FoundWebApp{} - _ bin.Decoder = &FoundWebApp{} - _ bin.BareEncoder = &FoundWebApp{} - _ bin.BareDecoder = &FoundWebApp{} -) - -func (f *FoundWebApp) Zero() bool { - if f == nil { - return true - } - if !(f.WebApp.Zero()) { - return false - } - if !(f.RequestWriteAccess == false) { - return false - } - if !(f.SkipConfirmation == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (f *FoundWebApp) String() string { - if f == nil { - return "FoundWebApp(nil)" - } - type Alias FoundWebApp - return fmt.Sprintf("FoundWebApp%+v", Alias(*f)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*FoundWebApp) TypeID() uint32 { - return FoundWebAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*FoundWebApp) TypeName() string { - return "foundWebApp" -} - -// TypeInfo returns info about TL type. -func (f *FoundWebApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "foundWebApp", - ID: FoundWebAppTypeID, - } - if f == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WebApp", - SchemaName: "web_app", - }, - { - Name: "RequestWriteAccess", - SchemaName: "request_write_access", - }, - { - Name: "SkipConfirmation", - SchemaName: "skip_confirmation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (f *FoundWebApp) Encode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundWebApp#eea8d01e as nil") - } - b.PutID(FoundWebAppTypeID) - return f.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (f *FoundWebApp) EncodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't encode foundWebApp#eea8d01e as nil") - } - if err := f.WebApp.Encode(b); err != nil { - return fmt.Errorf("unable to encode foundWebApp#eea8d01e: field web_app: %w", err) - } - b.PutBool(f.RequestWriteAccess) - b.PutBool(f.SkipConfirmation) - return nil -} - -// Decode implements bin.Decoder. -func (f *FoundWebApp) Decode(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundWebApp#eea8d01e to nil") - } - if err := b.ConsumeID(FoundWebAppTypeID); err != nil { - return fmt.Errorf("unable to decode foundWebApp#eea8d01e: %w", err) - } - return f.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (f *FoundWebApp) DecodeBare(b *bin.Buffer) error { - if f == nil { - return fmt.Errorf("can't decode foundWebApp#eea8d01e to nil") - } - { - if err := f.WebApp.Decode(b); err != nil { - return fmt.Errorf("unable to decode foundWebApp#eea8d01e: field web_app: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode foundWebApp#eea8d01e: field request_write_access: %w", err) - } - f.RequestWriteAccess = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode foundWebApp#eea8d01e: field skip_confirmation: %w", err) - } - f.SkipConfirmation = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (f *FoundWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { - if f == nil { - return fmt.Errorf("can't encode foundWebApp#eea8d01e as nil") - } - b.ObjStart() - b.PutID("foundWebApp") - b.Comma() - b.FieldStart("web_app") - if err := f.WebApp.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode foundWebApp#eea8d01e: field web_app: %w", err) - } - b.Comma() - b.FieldStart("request_write_access") - b.PutBool(f.RequestWriteAccess) - b.Comma() - b.FieldStart("skip_confirmation") - b.PutBool(f.SkipConfirmation) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (f *FoundWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { - if f == nil { - return fmt.Errorf("can't decode foundWebApp#eea8d01e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("foundWebApp"); err != nil { - return fmt.Errorf("unable to decode foundWebApp#eea8d01e: %w", err) - } - case "web_app": - if err := f.WebApp.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode foundWebApp#eea8d01e: field web_app: %w", err) - } - case "request_write_access": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode foundWebApp#eea8d01e: field request_write_access: %w", err) - } - f.RequestWriteAccess = value - case "skip_confirmation": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode foundWebApp#eea8d01e: field skip_confirmation: %w", err) - } - f.SkipConfirmation = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWebApp returns value of WebApp field. -func (f *FoundWebApp) GetWebApp() (value WebApp) { - if f == nil { - return - } - return f.WebApp -} - -// GetRequestWriteAccess returns value of RequestWriteAccess field. -func (f *FoundWebApp) GetRequestWriteAccess() (value bool) { - if f == nil { - return - } - return f.RequestWriteAccess -} - -// GetSkipConfirmation returns value of SkipConfirmation field. -func (f *FoundWebApp) GetSkipConfirmation() (value bool) { - if f == nil { - return - } - return f.SkipConfirmation -} diff --git a/tdapi/tl_game_gen.go b/tdapi/tl_game_gen.go deleted file mode 100644 index 9c362e6b9..000000000 --- a/tdapi/tl_game_gen.go +++ /dev/null @@ -1,397 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Game represents TL type `game#a2aedfc8`. -type Game struct { - // Unique game identifier - ID int64 - // Game short name - ShortName string - // Game title - Title string - // Game text, usually containing scoreboards for a game - Text FormattedText - // Describes a game. Use getInternalLink with internalLinkTypeGame to share the game - Description string - // Game photo - Photo Photo - // Game animation; may be null - Animation Animation -} - -// GameTypeID is TL type id of Game. -const GameTypeID = 0xa2aedfc8 - -// Ensuring interfaces in compile-time for Game. -var ( - _ bin.Encoder = &Game{} - _ bin.Decoder = &Game{} - _ bin.BareEncoder = &Game{} - _ bin.BareDecoder = &Game{} -) - -func (g *Game) Zero() bool { - if g == nil { - return true - } - if !(g.ID == 0) { - return false - } - if !(g.ShortName == "") { - return false - } - if !(g.Title == "") { - return false - } - if !(g.Text.Zero()) { - return false - } - if !(g.Description == "") { - return false - } - if !(g.Photo.Zero()) { - return false - } - if !(g.Animation.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *Game) String() string { - if g == nil { - return "Game(nil)" - } - type Alias Game - return fmt.Sprintf("Game%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Game) TypeID() uint32 { - return GameTypeID -} - -// TypeName returns name of type in TL schema. -func (*Game) TypeName() string { - return "game" -} - -// TypeInfo returns info about TL type. -func (g *Game) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "game", - ID: GameTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "ShortName", - SchemaName: "short_name", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Animation", - SchemaName: "animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *Game) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode game#a2aedfc8 as nil") - } - b.PutID(GameTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *Game) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode game#a2aedfc8 as nil") - } - b.PutLong(g.ID) - b.PutString(g.ShortName) - b.PutString(g.Title) - if err := g.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode game#a2aedfc8: field text: %w", err) - } - b.PutString(g.Description) - if err := g.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode game#a2aedfc8: field photo: %w", err) - } - if err := g.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode game#a2aedfc8: field animation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *Game) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode game#a2aedfc8 to nil") - } - if err := b.ConsumeID(GameTypeID); err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *Game) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode game#a2aedfc8 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field id: %w", err) - } - g.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field short_name: %w", err) - } - g.ShortName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field title: %w", err) - } - g.Title = value - } - { - if err := g.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field text: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field description: %w", err) - } - g.Description = value - } - { - if err := g.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field photo: %w", err) - } - } - { - if err := g.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field animation: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *Game) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode game#a2aedfc8 as nil") - } - b.ObjStart() - b.PutID("game") - b.Comma() - b.FieldStart("id") - b.PutLong(g.ID) - b.Comma() - b.FieldStart("short_name") - b.PutString(g.ShortName) - b.Comma() - b.FieldStart("title") - b.PutString(g.Title) - b.Comma() - b.FieldStart("text") - if err := g.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode game#a2aedfc8: field text: %w", err) - } - b.Comma() - b.FieldStart("description") - b.PutString(g.Description) - b.Comma() - b.FieldStart("photo") - if err := g.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode game#a2aedfc8: field photo: %w", err) - } - b.Comma() - b.FieldStart("animation") - if err := g.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode game#a2aedfc8: field animation: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *Game) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode game#a2aedfc8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("game"); err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field id: %w", err) - } - g.ID = value - case "short_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field short_name: %w", err) - } - g.ShortName = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field title: %w", err) - } - g.Title = value - case "text": - if err := g.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field text: %w", err) - } - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field description: %w", err) - } - g.Description = value - case "photo": - if err := g.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field photo: %w", err) - } - case "animation": - if err := g.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode game#a2aedfc8: field animation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (g *Game) GetID() (value int64) { - if g == nil { - return - } - return g.ID -} - -// GetShortName returns value of ShortName field. -func (g *Game) GetShortName() (value string) { - if g == nil { - return - } - return g.ShortName -} - -// GetTitle returns value of Title field. -func (g *Game) GetTitle() (value string) { - if g == nil { - return - } - return g.Title -} - -// GetText returns value of Text field. -func (g *Game) GetText() (value FormattedText) { - if g == nil { - return - } - return g.Text -} - -// GetDescription returns value of Description field. -func (g *Game) GetDescription() (value string) { - if g == nil { - return - } - return g.Description -} - -// GetPhoto returns value of Photo field. -func (g *Game) GetPhoto() (value Photo) { - if g == nil { - return - } - return g.Photo -} - -// GetAnimation returns value of Animation field. -func (g *Game) GetAnimation() (value Animation) { - if g == nil { - return - } - return g.Animation -} diff --git a/tdapi/tl_game_high_score_gen.go b/tdapi/tl_game_high_score_gen.go deleted file mode 100644 index 45321e8fe..000000000 --- a/tdapi/tl_game_high_score_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GameHighScore represents TL type `gameHighScore#146fcf1e`. -type GameHighScore struct { - // Position in the high score table - Position int32 - // User identifier - UserID int64 - // User score - Score int32 -} - -// GameHighScoreTypeID is TL type id of GameHighScore. -const GameHighScoreTypeID = 0x146fcf1e - -// Ensuring interfaces in compile-time for GameHighScore. -var ( - _ bin.Encoder = &GameHighScore{} - _ bin.Decoder = &GameHighScore{} - _ bin.BareEncoder = &GameHighScore{} - _ bin.BareDecoder = &GameHighScore{} -) - -func (g *GameHighScore) Zero() bool { - if g == nil { - return true - } - if !(g.Position == 0) { - return false - } - if !(g.UserID == 0) { - return false - } - if !(g.Score == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GameHighScore) String() string { - if g == nil { - return "GameHighScore(nil)" - } - type Alias GameHighScore - return fmt.Sprintf("GameHighScore%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GameHighScore) TypeID() uint32 { - return GameHighScoreTypeID -} - -// TypeName returns name of type in TL schema. -func (*GameHighScore) TypeName() string { - return "gameHighScore" -} - -// TypeInfo returns info about TL type. -func (g *GameHighScore) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "gameHighScore", - ID: GameHighScoreTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Position", - SchemaName: "position", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Score", - SchemaName: "score", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GameHighScore) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode gameHighScore#146fcf1e as nil") - } - b.PutID(GameHighScoreTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GameHighScore) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode gameHighScore#146fcf1e as nil") - } - b.PutInt32(g.Position) - b.PutInt53(g.UserID) - b.PutInt32(g.Score) - return nil -} - -// Decode implements bin.Decoder. -func (g *GameHighScore) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode gameHighScore#146fcf1e to nil") - } - if err := b.ConsumeID(GameHighScoreTypeID); err != nil { - return fmt.Errorf("unable to decode gameHighScore#146fcf1e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GameHighScore) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode gameHighScore#146fcf1e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gameHighScore#146fcf1e: field position: %w", err) - } - g.Position = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode gameHighScore#146fcf1e: field user_id: %w", err) - } - g.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gameHighScore#146fcf1e: field score: %w", err) - } - g.Score = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GameHighScore) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode gameHighScore#146fcf1e as nil") - } - b.ObjStart() - b.PutID("gameHighScore") - b.Comma() - b.FieldStart("position") - b.PutInt32(g.Position) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.FieldStart("score") - b.PutInt32(g.Score) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GameHighScore) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode gameHighScore#146fcf1e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("gameHighScore"); err != nil { - return fmt.Errorf("unable to decode gameHighScore#146fcf1e: %w", err) - } - case "position": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gameHighScore#146fcf1e: field position: %w", err) - } - g.Position = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode gameHighScore#146fcf1e: field user_id: %w", err) - } - g.UserID = value - case "score": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gameHighScore#146fcf1e: field score: %w", err) - } - g.Score = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPosition returns value of Position field. -func (g *GameHighScore) GetPosition() (value int32) { - if g == nil { - return - } - return g.Position -} - -// GetUserID returns value of UserID field. -func (g *GameHighScore) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetScore returns value of Score field. -func (g *GameHighScore) GetScore() (value int32) { - if g == nil { - return - } - return g.Score -} diff --git a/tdapi/tl_game_high_scores_gen.go b/tdapi/tl_game_high_scores_gen.go deleted file mode 100644 index 433b2d44b..000000000 --- a/tdapi/tl_game_high_scores_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GameHighScores represents TL type `gameHighScores#6d4cd30d`. -type GameHighScores struct { - // A list of game high scores - Scores []GameHighScore -} - -// GameHighScoresTypeID is TL type id of GameHighScores. -const GameHighScoresTypeID = 0x6d4cd30d - -// Ensuring interfaces in compile-time for GameHighScores. -var ( - _ bin.Encoder = &GameHighScores{} - _ bin.Decoder = &GameHighScores{} - _ bin.BareEncoder = &GameHighScores{} - _ bin.BareDecoder = &GameHighScores{} -) - -func (g *GameHighScores) Zero() bool { - if g == nil { - return true - } - if !(g.Scores == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GameHighScores) String() string { - if g == nil { - return "GameHighScores(nil)" - } - type Alias GameHighScores - return fmt.Sprintf("GameHighScores%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GameHighScores) TypeID() uint32 { - return GameHighScoresTypeID -} - -// TypeName returns name of type in TL schema. -func (*GameHighScores) TypeName() string { - return "gameHighScores" -} - -// TypeInfo returns info about TL type. -func (g *GameHighScores) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "gameHighScores", - ID: GameHighScoresTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Scores", - SchemaName: "scores", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GameHighScores) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode gameHighScores#6d4cd30d as nil") - } - b.PutID(GameHighScoresTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GameHighScores) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode gameHighScores#6d4cd30d as nil") - } - b.PutInt(len(g.Scores)) - for idx, v := range g.Scores { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare gameHighScores#6d4cd30d: field scores element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GameHighScores) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode gameHighScores#6d4cd30d to nil") - } - if err := b.ConsumeID(GameHighScoresTypeID); err != nil { - return fmt.Errorf("unable to decode gameHighScores#6d4cd30d: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GameHighScores) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode gameHighScores#6d4cd30d to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode gameHighScores#6d4cd30d: field scores: %w", err) - } - - if headerLen > 0 { - g.Scores = make([]GameHighScore, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value GameHighScore - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare gameHighScores#6d4cd30d: field scores: %w", err) - } - g.Scores = append(g.Scores, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GameHighScores) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode gameHighScores#6d4cd30d as nil") - } - b.ObjStart() - b.PutID("gameHighScores") - b.Comma() - b.FieldStart("scores") - b.ArrStart() - for idx, v := range g.Scores { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode gameHighScores#6d4cd30d: field scores element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GameHighScores) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode gameHighScores#6d4cd30d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("gameHighScores"); err != nil { - return fmt.Errorf("unable to decode gameHighScores#6d4cd30d: %w", err) - } - case "scores": - if err := b.Arr(func(b tdjson.Decoder) error { - var value GameHighScore - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode gameHighScores#6d4cd30d: field scores: %w", err) - } - g.Scores = append(g.Scores, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode gameHighScores#6d4cd30d: field scores: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetScores returns value of Scores field. -func (g *GameHighScores) GetScores() (value []GameHighScore) { - if g == nil { - return - } - return g.Scores -} diff --git a/tdapi/tl_get_account_ttl_gen.go b/tdapi/tl_get_account_ttl_gen.go deleted file mode 100644 index 2f8a1ccd0..000000000 --- a/tdapi/tl_get_account_ttl_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetAccountTTLRequest represents TL type `getAccountTtl#e58a8b77`. -type GetAccountTTLRequest struct { -} - -// GetAccountTTLRequestTypeID is TL type id of GetAccountTTLRequest. -const GetAccountTTLRequestTypeID = 0xe58a8b77 - -// Ensuring interfaces in compile-time for GetAccountTTLRequest. -var ( - _ bin.Encoder = &GetAccountTTLRequest{} - _ bin.Decoder = &GetAccountTTLRequest{} - _ bin.BareEncoder = &GetAccountTTLRequest{} - _ bin.BareDecoder = &GetAccountTTLRequest{} -) - -func (g *GetAccountTTLRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetAccountTTLRequest) String() string { - if g == nil { - return "GetAccountTTLRequest(nil)" - } - type Alias GetAccountTTLRequest - return fmt.Sprintf("GetAccountTTLRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetAccountTTLRequest) TypeID() uint32 { - return GetAccountTTLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetAccountTTLRequest) TypeName() string { - return "getAccountTtl" -} - -// TypeInfo returns info about TL type. -func (g *GetAccountTTLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getAccountTtl", - ID: GetAccountTTLRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetAccountTTLRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAccountTtl#e58a8b77 as nil") - } - b.PutID(GetAccountTTLRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetAccountTTLRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAccountTtl#e58a8b77 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetAccountTTLRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAccountTtl#e58a8b77 to nil") - } - if err := b.ConsumeID(GetAccountTTLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getAccountTtl#e58a8b77: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetAccountTTLRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAccountTtl#e58a8b77 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetAccountTTLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getAccountTtl#e58a8b77 as nil") - } - b.ObjStart() - b.PutID("getAccountTtl") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetAccountTTLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getAccountTtl#e58a8b77 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getAccountTtl"); err != nil { - return fmt.Errorf("unable to decode getAccountTtl#e58a8b77: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAccountTTL invokes method getAccountTtl#e58a8b77 returning error if any. -func (c *Client) GetAccountTTL(ctx context.Context) (*AccountTTL, error) { - var result AccountTTL - - request := &GetAccountTTLRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_active_sessions_gen.go b/tdapi/tl_get_active_sessions_gen.go deleted file mode 100644 index 26eaecc30..000000000 --- a/tdapi/tl_get_active_sessions_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetActiveSessionsRequest represents TL type `getActiveSessions#42bd6d3e`. -type GetActiveSessionsRequest struct { -} - -// GetActiveSessionsRequestTypeID is TL type id of GetActiveSessionsRequest. -const GetActiveSessionsRequestTypeID = 0x42bd6d3e - -// Ensuring interfaces in compile-time for GetActiveSessionsRequest. -var ( - _ bin.Encoder = &GetActiveSessionsRequest{} - _ bin.Decoder = &GetActiveSessionsRequest{} - _ bin.BareEncoder = &GetActiveSessionsRequest{} - _ bin.BareDecoder = &GetActiveSessionsRequest{} -) - -func (g *GetActiveSessionsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetActiveSessionsRequest) String() string { - if g == nil { - return "GetActiveSessionsRequest(nil)" - } - type Alias GetActiveSessionsRequest - return fmt.Sprintf("GetActiveSessionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetActiveSessionsRequest) TypeID() uint32 { - return GetActiveSessionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetActiveSessionsRequest) TypeName() string { - return "getActiveSessions" -} - -// TypeInfo returns info about TL type. -func (g *GetActiveSessionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getActiveSessions", - ID: GetActiveSessionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetActiveSessionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getActiveSessions#42bd6d3e as nil") - } - b.PutID(GetActiveSessionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetActiveSessionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getActiveSessions#42bd6d3e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetActiveSessionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getActiveSessions#42bd6d3e to nil") - } - if err := b.ConsumeID(GetActiveSessionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getActiveSessions#42bd6d3e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetActiveSessionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getActiveSessions#42bd6d3e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetActiveSessionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getActiveSessions#42bd6d3e as nil") - } - b.ObjStart() - b.PutID("getActiveSessions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetActiveSessionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getActiveSessions#42bd6d3e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getActiveSessions"); err != nil { - return fmt.Errorf("unable to decode getActiveSessions#42bd6d3e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetActiveSessions invokes method getActiveSessions#42bd6d3e returning error if any. -func (c *Client) GetActiveSessions(ctx context.Context) (*Sessions, error) { - var result Sessions - - request := &GetActiveSessionsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_all_passport_elements_gen.go b/tdapi/tl_get_all_passport_elements_gen.go deleted file mode 100644 index 83d1530f3..000000000 --- a/tdapi/tl_get_all_passport_elements_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetAllPassportElementsRequest represents TL type `getAllPassportElements#86782aeb`. -type GetAllPassportElementsRequest struct { - // The 2-step verification password of the current user - Password string -} - -// GetAllPassportElementsRequestTypeID is TL type id of GetAllPassportElementsRequest. -const GetAllPassportElementsRequestTypeID = 0x86782aeb - -// Ensuring interfaces in compile-time for GetAllPassportElementsRequest. -var ( - _ bin.Encoder = &GetAllPassportElementsRequest{} - _ bin.Decoder = &GetAllPassportElementsRequest{} - _ bin.BareEncoder = &GetAllPassportElementsRequest{} - _ bin.BareDecoder = &GetAllPassportElementsRequest{} -) - -func (g *GetAllPassportElementsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Password == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetAllPassportElementsRequest) String() string { - if g == nil { - return "GetAllPassportElementsRequest(nil)" - } - type Alias GetAllPassportElementsRequest - return fmt.Sprintf("GetAllPassportElementsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetAllPassportElementsRequest) TypeID() uint32 { - return GetAllPassportElementsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetAllPassportElementsRequest) TypeName() string { - return "getAllPassportElements" -} - -// TypeInfo returns info about TL type. -func (g *GetAllPassportElementsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getAllPassportElements", - ID: GetAllPassportElementsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetAllPassportElementsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAllPassportElements#86782aeb as nil") - } - b.PutID(GetAllPassportElementsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetAllPassportElementsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAllPassportElements#86782aeb as nil") - } - b.PutString(g.Password) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetAllPassportElementsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAllPassportElements#86782aeb to nil") - } - if err := b.ConsumeID(GetAllPassportElementsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getAllPassportElements#86782aeb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetAllPassportElementsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAllPassportElements#86782aeb to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getAllPassportElements#86782aeb: field password: %w", err) - } - g.Password = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetAllPassportElementsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getAllPassportElements#86782aeb as nil") - } - b.ObjStart() - b.PutID("getAllPassportElements") - b.Comma() - b.FieldStart("password") - b.PutString(g.Password) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetAllPassportElementsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getAllPassportElements#86782aeb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getAllPassportElements"); err != nil { - return fmt.Errorf("unable to decode getAllPassportElements#86782aeb: %w", err) - } - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getAllPassportElements#86782aeb: field password: %w", err) - } - g.Password = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPassword returns value of Password field. -func (g *GetAllPassportElementsRequest) GetPassword() (value string) { - if g == nil { - return - } - return g.Password -} - -// GetAllPassportElements invokes method getAllPassportElements#86782aeb returning error if any. -func (c *Client) GetAllPassportElements(ctx context.Context, password string) (*PassportElements, error) { - var result PassportElements - - request := &GetAllPassportElementsRequest{ - Password: password, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_all_sticker_emojis_gen.go b/tdapi/tl_get_all_sticker_emojis_gen.go deleted file mode 100644 index daf28f622..000000000 --- a/tdapi/tl_get_all_sticker_emojis_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetAllStickerEmojisRequest represents TL type `getAllStickerEmojis#11ad2e30`. -type GetAllStickerEmojisRequest struct { - // Type of the stickers to search for - StickerType StickerTypeClass - // Search query - Query string - // Chat identifier for which to find stickers - ChatID int64 - // Pass true if only main emoji for each found sticker must be included in the result - ReturnOnlyMainEmoji bool -} - -// GetAllStickerEmojisRequestTypeID is TL type id of GetAllStickerEmojisRequest. -const GetAllStickerEmojisRequestTypeID = 0x11ad2e30 - -// Ensuring interfaces in compile-time for GetAllStickerEmojisRequest. -var ( - _ bin.Encoder = &GetAllStickerEmojisRequest{} - _ bin.Decoder = &GetAllStickerEmojisRequest{} - _ bin.BareEncoder = &GetAllStickerEmojisRequest{} - _ bin.BareDecoder = &GetAllStickerEmojisRequest{} -) - -func (g *GetAllStickerEmojisRequest) Zero() bool { - if g == nil { - return true - } - if !(g.StickerType == nil) { - return false - } - if !(g.Query == "") { - return false - } - if !(g.ChatID == 0) { - return false - } - if !(g.ReturnOnlyMainEmoji == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetAllStickerEmojisRequest) String() string { - if g == nil { - return "GetAllStickerEmojisRequest(nil)" - } - type Alias GetAllStickerEmojisRequest - return fmt.Sprintf("GetAllStickerEmojisRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetAllStickerEmojisRequest) TypeID() uint32 { - return GetAllStickerEmojisRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetAllStickerEmojisRequest) TypeName() string { - return "getAllStickerEmojis" -} - -// TypeInfo returns info about TL type. -func (g *GetAllStickerEmojisRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getAllStickerEmojis", - ID: GetAllStickerEmojisRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ReturnOnlyMainEmoji", - SchemaName: "return_only_main_emoji", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetAllStickerEmojisRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAllStickerEmojis#11ad2e30 as nil") - } - b.PutID(GetAllStickerEmojisRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetAllStickerEmojisRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAllStickerEmojis#11ad2e30 as nil") - } - if g.StickerType == nil { - return fmt.Errorf("unable to encode getAllStickerEmojis#11ad2e30: field sticker_type is nil") - } - if err := g.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode getAllStickerEmojis#11ad2e30: field sticker_type: %w", err) - } - b.PutString(g.Query) - b.PutInt53(g.ChatID) - b.PutBool(g.ReturnOnlyMainEmoji) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetAllStickerEmojisRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAllStickerEmojis#11ad2e30 to nil") - } - if err := b.ConsumeID(GetAllStickerEmojisRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getAllStickerEmojis#11ad2e30: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetAllStickerEmojisRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAllStickerEmojis#11ad2e30 to nil") - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode getAllStickerEmojis#11ad2e30: field sticker_type: %w", err) - } - g.StickerType = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getAllStickerEmojis#11ad2e30: field query: %w", err) - } - g.Query = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getAllStickerEmojis#11ad2e30: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getAllStickerEmojis#11ad2e30: field return_only_main_emoji: %w", err) - } - g.ReturnOnlyMainEmoji = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetAllStickerEmojisRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getAllStickerEmojis#11ad2e30 as nil") - } - b.ObjStart() - b.PutID("getAllStickerEmojis") - b.Comma() - b.FieldStart("sticker_type") - if g.StickerType == nil { - return fmt.Errorf("unable to encode getAllStickerEmojis#11ad2e30: field sticker_type is nil") - } - if err := g.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getAllStickerEmojis#11ad2e30: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("query") - b.PutString(g.Query) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("return_only_main_emoji") - b.PutBool(g.ReturnOnlyMainEmoji) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetAllStickerEmojisRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getAllStickerEmojis#11ad2e30 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getAllStickerEmojis"); err != nil { - return fmt.Errorf("unable to decode getAllStickerEmojis#11ad2e30: %w", err) - } - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode getAllStickerEmojis#11ad2e30: field sticker_type: %w", err) - } - g.StickerType = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getAllStickerEmojis#11ad2e30: field query: %w", err) - } - g.Query = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getAllStickerEmojis#11ad2e30: field chat_id: %w", err) - } - g.ChatID = value - case "return_only_main_emoji": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getAllStickerEmojis#11ad2e30: field return_only_main_emoji: %w", err) - } - g.ReturnOnlyMainEmoji = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerType returns value of StickerType field. -func (g *GetAllStickerEmojisRequest) GetStickerType() (value StickerTypeClass) { - if g == nil { - return - } - return g.StickerType -} - -// GetQuery returns value of Query field. -func (g *GetAllStickerEmojisRequest) GetQuery() (value string) { - if g == nil { - return - } - return g.Query -} - -// GetChatID returns value of ChatID field. -func (g *GetAllStickerEmojisRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetReturnOnlyMainEmoji returns value of ReturnOnlyMainEmoji field. -func (g *GetAllStickerEmojisRequest) GetReturnOnlyMainEmoji() (value bool) { - if g == nil { - return - } - return g.ReturnOnlyMainEmoji -} - -// GetAllStickerEmojis invokes method getAllStickerEmojis#11ad2e30 returning error if any. -func (c *Client) GetAllStickerEmojis(ctx context.Context, request *GetAllStickerEmojisRequest) (*Emojis, error) { - var result Emojis - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_animated_emoji_gen.go b/tdapi/tl_get_animated_emoji_gen.go deleted file mode 100644 index 00672582e..000000000 --- a/tdapi/tl_get_animated_emoji_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetAnimatedEmojiRequest represents TL type `getAnimatedEmoji#3f844f76`. -type GetAnimatedEmojiRequest struct { - // The emoji - Emoji string -} - -// GetAnimatedEmojiRequestTypeID is TL type id of GetAnimatedEmojiRequest. -const GetAnimatedEmojiRequestTypeID = 0x3f844f76 - -// Ensuring interfaces in compile-time for GetAnimatedEmojiRequest. -var ( - _ bin.Encoder = &GetAnimatedEmojiRequest{} - _ bin.Decoder = &GetAnimatedEmojiRequest{} - _ bin.BareEncoder = &GetAnimatedEmojiRequest{} - _ bin.BareDecoder = &GetAnimatedEmojiRequest{} -) - -func (g *GetAnimatedEmojiRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Emoji == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetAnimatedEmojiRequest) String() string { - if g == nil { - return "GetAnimatedEmojiRequest(nil)" - } - type Alias GetAnimatedEmojiRequest - return fmt.Sprintf("GetAnimatedEmojiRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetAnimatedEmojiRequest) TypeID() uint32 { - return GetAnimatedEmojiRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetAnimatedEmojiRequest) TypeName() string { - return "getAnimatedEmoji" -} - -// TypeInfo returns info about TL type. -func (g *GetAnimatedEmojiRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getAnimatedEmoji", - ID: GetAnimatedEmojiRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Emoji", - SchemaName: "emoji", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetAnimatedEmojiRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAnimatedEmoji#3f844f76 as nil") - } - b.PutID(GetAnimatedEmojiRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetAnimatedEmojiRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAnimatedEmoji#3f844f76 as nil") - } - b.PutString(g.Emoji) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetAnimatedEmojiRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAnimatedEmoji#3f844f76 to nil") - } - if err := b.ConsumeID(GetAnimatedEmojiRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getAnimatedEmoji#3f844f76: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetAnimatedEmojiRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAnimatedEmoji#3f844f76 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getAnimatedEmoji#3f844f76: field emoji: %w", err) - } - g.Emoji = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetAnimatedEmojiRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getAnimatedEmoji#3f844f76 as nil") - } - b.ObjStart() - b.PutID("getAnimatedEmoji") - b.Comma() - b.FieldStart("emoji") - b.PutString(g.Emoji) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetAnimatedEmojiRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getAnimatedEmoji#3f844f76 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getAnimatedEmoji"); err != nil { - return fmt.Errorf("unable to decode getAnimatedEmoji#3f844f76: %w", err) - } - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getAnimatedEmoji#3f844f76: field emoji: %w", err) - } - g.Emoji = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEmoji returns value of Emoji field. -func (g *GetAnimatedEmojiRequest) GetEmoji() (value string) { - if g == nil { - return - } - return g.Emoji -} - -// GetAnimatedEmoji invokes method getAnimatedEmoji#3f844f76 returning error if any. -func (c *Client) GetAnimatedEmoji(ctx context.Context, emoji string) (*AnimatedEmoji, error) { - var result AnimatedEmoji - - request := &GetAnimatedEmojiRequest{ - Emoji: emoji, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_application_config_gen.go b/tdapi/tl_get_application_config_gen.go deleted file mode 100644 index bb119da06..000000000 --- a/tdapi/tl_get_application_config_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetApplicationConfigRequest represents TL type `getApplicationConfig#93550682`. -type GetApplicationConfigRequest struct { -} - -// GetApplicationConfigRequestTypeID is TL type id of GetApplicationConfigRequest. -const GetApplicationConfigRequestTypeID = 0x93550682 - -// Ensuring interfaces in compile-time for GetApplicationConfigRequest. -var ( - _ bin.Encoder = &GetApplicationConfigRequest{} - _ bin.Decoder = &GetApplicationConfigRequest{} - _ bin.BareEncoder = &GetApplicationConfigRequest{} - _ bin.BareDecoder = &GetApplicationConfigRequest{} -) - -func (g *GetApplicationConfigRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetApplicationConfigRequest) String() string { - if g == nil { - return "GetApplicationConfigRequest(nil)" - } - type Alias GetApplicationConfigRequest - return fmt.Sprintf("GetApplicationConfigRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetApplicationConfigRequest) TypeID() uint32 { - return GetApplicationConfigRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetApplicationConfigRequest) TypeName() string { - return "getApplicationConfig" -} - -// TypeInfo returns info about TL type. -func (g *GetApplicationConfigRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getApplicationConfig", - ID: GetApplicationConfigRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetApplicationConfigRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getApplicationConfig#93550682 as nil") - } - b.PutID(GetApplicationConfigRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetApplicationConfigRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getApplicationConfig#93550682 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetApplicationConfigRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getApplicationConfig#93550682 to nil") - } - if err := b.ConsumeID(GetApplicationConfigRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getApplicationConfig#93550682: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetApplicationConfigRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getApplicationConfig#93550682 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetApplicationConfigRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getApplicationConfig#93550682 as nil") - } - b.ObjStart() - b.PutID("getApplicationConfig") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetApplicationConfigRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getApplicationConfig#93550682 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getApplicationConfig"); err != nil { - return fmt.Errorf("unable to decode getApplicationConfig#93550682: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetApplicationConfig invokes method getApplicationConfig#93550682 returning error if any. -func (c *Client) GetApplicationConfig(ctx context.Context) (JSONValueClass, error) { - var result JSONValueBox - - request := &GetApplicationConfigRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.JsonValue, nil -} diff --git a/tdapi/tl_get_application_download_link_gen.go b/tdapi/tl_get_application_download_link_gen.go deleted file mode 100644 index 7808c8c24..000000000 --- a/tdapi/tl_get_application_download_link_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetApplicationDownloadLinkRequest represents TL type `getApplicationDownloadLink#6ad2fc4`. -type GetApplicationDownloadLinkRequest struct { -} - -// GetApplicationDownloadLinkRequestTypeID is TL type id of GetApplicationDownloadLinkRequest. -const GetApplicationDownloadLinkRequestTypeID = 0x6ad2fc4 - -// Ensuring interfaces in compile-time for GetApplicationDownloadLinkRequest. -var ( - _ bin.Encoder = &GetApplicationDownloadLinkRequest{} - _ bin.Decoder = &GetApplicationDownloadLinkRequest{} - _ bin.BareEncoder = &GetApplicationDownloadLinkRequest{} - _ bin.BareDecoder = &GetApplicationDownloadLinkRequest{} -) - -func (g *GetApplicationDownloadLinkRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetApplicationDownloadLinkRequest) String() string { - if g == nil { - return "GetApplicationDownloadLinkRequest(nil)" - } - type Alias GetApplicationDownloadLinkRequest - return fmt.Sprintf("GetApplicationDownloadLinkRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetApplicationDownloadLinkRequest) TypeID() uint32 { - return GetApplicationDownloadLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetApplicationDownloadLinkRequest) TypeName() string { - return "getApplicationDownloadLink" -} - -// TypeInfo returns info about TL type. -func (g *GetApplicationDownloadLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getApplicationDownloadLink", - ID: GetApplicationDownloadLinkRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetApplicationDownloadLinkRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getApplicationDownloadLink#6ad2fc4 as nil") - } - b.PutID(GetApplicationDownloadLinkRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetApplicationDownloadLinkRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getApplicationDownloadLink#6ad2fc4 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetApplicationDownloadLinkRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getApplicationDownloadLink#6ad2fc4 to nil") - } - if err := b.ConsumeID(GetApplicationDownloadLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getApplicationDownloadLink#6ad2fc4: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetApplicationDownloadLinkRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getApplicationDownloadLink#6ad2fc4 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetApplicationDownloadLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getApplicationDownloadLink#6ad2fc4 as nil") - } - b.ObjStart() - b.PutID("getApplicationDownloadLink") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetApplicationDownloadLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getApplicationDownloadLink#6ad2fc4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getApplicationDownloadLink"); err != nil { - return fmt.Errorf("unable to decode getApplicationDownloadLink#6ad2fc4: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetApplicationDownloadLink invokes method getApplicationDownloadLink#6ad2fc4 returning error if any. -func (c *Client) GetApplicationDownloadLink(ctx context.Context) (*HTTPURL, error) { - var result HTTPURL - - request := &GetApplicationDownloadLinkRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_archive_chat_list_settings_gen.go b/tdapi/tl_get_archive_chat_list_settings_gen.go deleted file mode 100644 index f769496c9..000000000 --- a/tdapi/tl_get_archive_chat_list_settings_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetArchiveChatListSettingsRequest represents TL type `getArchiveChatListSettings#838d8e60`. -type GetArchiveChatListSettingsRequest struct { -} - -// GetArchiveChatListSettingsRequestTypeID is TL type id of GetArchiveChatListSettingsRequest. -const GetArchiveChatListSettingsRequestTypeID = 0x838d8e60 - -// Ensuring interfaces in compile-time for GetArchiveChatListSettingsRequest. -var ( - _ bin.Encoder = &GetArchiveChatListSettingsRequest{} - _ bin.Decoder = &GetArchiveChatListSettingsRequest{} - _ bin.BareEncoder = &GetArchiveChatListSettingsRequest{} - _ bin.BareDecoder = &GetArchiveChatListSettingsRequest{} -) - -func (g *GetArchiveChatListSettingsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetArchiveChatListSettingsRequest) String() string { - if g == nil { - return "GetArchiveChatListSettingsRequest(nil)" - } - type Alias GetArchiveChatListSettingsRequest - return fmt.Sprintf("GetArchiveChatListSettingsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetArchiveChatListSettingsRequest) TypeID() uint32 { - return GetArchiveChatListSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetArchiveChatListSettingsRequest) TypeName() string { - return "getArchiveChatListSettings" -} - -// TypeInfo returns info about TL type. -func (g *GetArchiveChatListSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getArchiveChatListSettings", - ID: GetArchiveChatListSettingsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetArchiveChatListSettingsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getArchiveChatListSettings#838d8e60 as nil") - } - b.PutID(GetArchiveChatListSettingsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetArchiveChatListSettingsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getArchiveChatListSettings#838d8e60 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetArchiveChatListSettingsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getArchiveChatListSettings#838d8e60 to nil") - } - if err := b.ConsumeID(GetArchiveChatListSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getArchiveChatListSettings#838d8e60: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetArchiveChatListSettingsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getArchiveChatListSettings#838d8e60 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetArchiveChatListSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getArchiveChatListSettings#838d8e60 as nil") - } - b.ObjStart() - b.PutID("getArchiveChatListSettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetArchiveChatListSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getArchiveChatListSettings#838d8e60 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getArchiveChatListSettings"); err != nil { - return fmt.Errorf("unable to decode getArchiveChatListSettings#838d8e60: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetArchiveChatListSettings invokes method getArchiveChatListSettings#838d8e60 returning error if any. -func (c *Client) GetArchiveChatListSettings(ctx context.Context) (*ArchiveChatListSettings, error) { - var result ArchiveChatListSettings - - request := &GetArchiveChatListSettingsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_archived_sticker_sets_gen.go b/tdapi/tl_get_archived_sticker_sets_gen.go deleted file mode 100644 index d2a28d884..000000000 --- a/tdapi/tl_get_archived_sticker_sets_gen.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetArchivedStickerSetsRequest represents TL type `getArchivedStickerSets#3bb8424d`. -type GetArchivedStickerSetsRequest struct { - // Type of the sticker sets to return - StickerType StickerTypeClass - // Identifier of the sticker set from which to return the result; use 0 to get results - // from the beginning - OffsetStickerSetID int64 - // The maximum number of sticker sets to return; up to 100 - Limit int32 -} - -// GetArchivedStickerSetsRequestTypeID is TL type id of GetArchivedStickerSetsRequest. -const GetArchivedStickerSetsRequestTypeID = 0x3bb8424d - -// Ensuring interfaces in compile-time for GetArchivedStickerSetsRequest. -var ( - _ bin.Encoder = &GetArchivedStickerSetsRequest{} - _ bin.Decoder = &GetArchivedStickerSetsRequest{} - _ bin.BareEncoder = &GetArchivedStickerSetsRequest{} - _ bin.BareDecoder = &GetArchivedStickerSetsRequest{} -) - -func (g *GetArchivedStickerSetsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.StickerType == nil) { - return false - } - if !(g.OffsetStickerSetID == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetArchivedStickerSetsRequest) String() string { - if g == nil { - return "GetArchivedStickerSetsRequest(nil)" - } - type Alias GetArchivedStickerSetsRequest - return fmt.Sprintf("GetArchivedStickerSetsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetArchivedStickerSetsRequest) TypeID() uint32 { - return GetArchivedStickerSetsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetArchivedStickerSetsRequest) TypeName() string { - return "getArchivedStickerSets" -} - -// TypeInfo returns info about TL type. -func (g *GetArchivedStickerSetsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getArchivedStickerSets", - ID: GetArchivedStickerSetsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "OffsetStickerSetID", - SchemaName: "offset_sticker_set_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetArchivedStickerSetsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getArchivedStickerSets#3bb8424d as nil") - } - b.PutID(GetArchivedStickerSetsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetArchivedStickerSetsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getArchivedStickerSets#3bb8424d as nil") - } - if g.StickerType == nil { - return fmt.Errorf("unable to encode getArchivedStickerSets#3bb8424d: field sticker_type is nil") - } - if err := g.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode getArchivedStickerSets#3bb8424d: field sticker_type: %w", err) - } - b.PutLong(g.OffsetStickerSetID) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetArchivedStickerSetsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getArchivedStickerSets#3bb8424d to nil") - } - if err := b.ConsumeID(GetArchivedStickerSetsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetArchivedStickerSetsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getArchivedStickerSets#3bb8424d to nil") - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field sticker_type: %w", err) - } - g.StickerType = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field offset_sticker_set_id: %w", err) - } - g.OffsetStickerSetID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetArchivedStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getArchivedStickerSets#3bb8424d as nil") - } - b.ObjStart() - b.PutID("getArchivedStickerSets") - b.Comma() - b.FieldStart("sticker_type") - if g.StickerType == nil { - return fmt.Errorf("unable to encode getArchivedStickerSets#3bb8424d: field sticker_type is nil") - } - if err := g.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getArchivedStickerSets#3bb8424d: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("offset_sticker_set_id") - b.PutLong(g.OffsetStickerSetID) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetArchivedStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getArchivedStickerSets#3bb8424d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getArchivedStickerSets"); err != nil { - return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: %w", err) - } - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field sticker_type: %w", err) - } - g.StickerType = value - case "offset_sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field offset_sticker_set_id: %w", err) - } - g.OffsetStickerSetID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getArchivedStickerSets#3bb8424d: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerType returns value of StickerType field. -func (g *GetArchivedStickerSetsRequest) GetStickerType() (value StickerTypeClass) { - if g == nil { - return - } - return g.StickerType -} - -// GetOffsetStickerSetID returns value of OffsetStickerSetID field. -func (g *GetArchivedStickerSetsRequest) GetOffsetStickerSetID() (value int64) { - if g == nil { - return - } - return g.OffsetStickerSetID -} - -// GetLimit returns value of Limit field. -func (g *GetArchivedStickerSetsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetArchivedStickerSets invokes method getArchivedStickerSets#3bb8424d returning error if any. -func (c *Client) GetArchivedStickerSets(ctx context.Context, request *GetArchivedStickerSetsRequest) (*StickerSets, error) { - var result StickerSets - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_attached_sticker_sets_gen.go b/tdapi/tl_get_attached_sticker_sets_gen.go deleted file mode 100644 index 0f46daf53..000000000 --- a/tdapi/tl_get_attached_sticker_sets_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetAttachedStickerSetsRequest represents TL type `getAttachedStickerSets#4d9d930d`. -type GetAttachedStickerSetsRequest struct { - // File identifier - FileID int32 -} - -// GetAttachedStickerSetsRequestTypeID is TL type id of GetAttachedStickerSetsRequest. -const GetAttachedStickerSetsRequestTypeID = 0x4d9d930d - -// Ensuring interfaces in compile-time for GetAttachedStickerSetsRequest. -var ( - _ bin.Encoder = &GetAttachedStickerSetsRequest{} - _ bin.Decoder = &GetAttachedStickerSetsRequest{} - _ bin.BareEncoder = &GetAttachedStickerSetsRequest{} - _ bin.BareDecoder = &GetAttachedStickerSetsRequest{} -) - -func (g *GetAttachedStickerSetsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.FileID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetAttachedStickerSetsRequest) String() string { - if g == nil { - return "GetAttachedStickerSetsRequest(nil)" - } - type Alias GetAttachedStickerSetsRequest - return fmt.Sprintf("GetAttachedStickerSetsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetAttachedStickerSetsRequest) TypeID() uint32 { - return GetAttachedStickerSetsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetAttachedStickerSetsRequest) TypeName() string { - return "getAttachedStickerSets" -} - -// TypeInfo returns info about TL type. -func (g *GetAttachedStickerSetsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getAttachedStickerSets", - ID: GetAttachedStickerSetsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetAttachedStickerSetsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAttachedStickerSets#4d9d930d as nil") - } - b.PutID(GetAttachedStickerSetsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetAttachedStickerSetsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAttachedStickerSets#4d9d930d as nil") - } - b.PutInt32(g.FileID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetAttachedStickerSetsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAttachedStickerSets#4d9d930d to nil") - } - if err := b.ConsumeID(GetAttachedStickerSetsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getAttachedStickerSets#4d9d930d: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetAttachedStickerSetsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAttachedStickerSets#4d9d930d to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getAttachedStickerSets#4d9d930d: field file_id: %w", err) - } - g.FileID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetAttachedStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getAttachedStickerSets#4d9d930d as nil") - } - b.ObjStart() - b.PutID("getAttachedStickerSets") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(g.FileID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetAttachedStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getAttachedStickerSets#4d9d930d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getAttachedStickerSets"); err != nil { - return fmt.Errorf("unable to decode getAttachedStickerSets#4d9d930d: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getAttachedStickerSets#4d9d930d: field file_id: %w", err) - } - g.FileID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (g *GetAttachedStickerSetsRequest) GetFileID() (value int32) { - if g == nil { - return - } - return g.FileID -} - -// GetAttachedStickerSets invokes method getAttachedStickerSets#4d9d930d returning error if any. -func (c *Client) GetAttachedStickerSets(ctx context.Context, fileid int32) (*StickerSets, error) { - var result StickerSets - - request := &GetAttachedStickerSetsRequest{ - FileID: fileid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_attachment_menu_bot_gen.go b/tdapi/tl_get_attachment_menu_bot_gen.go deleted file mode 100644 index aa0f2828e..000000000 --- a/tdapi/tl_get_attachment_menu_bot_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetAttachmentMenuBotRequest represents TL type `getAttachmentMenuBot#3da561fb`. -type GetAttachmentMenuBotRequest struct { - // Bot's user identifier - BotUserID int64 -} - -// GetAttachmentMenuBotRequestTypeID is TL type id of GetAttachmentMenuBotRequest. -const GetAttachmentMenuBotRequestTypeID = 0x3da561fb - -// Ensuring interfaces in compile-time for GetAttachmentMenuBotRequest. -var ( - _ bin.Encoder = &GetAttachmentMenuBotRequest{} - _ bin.Decoder = &GetAttachmentMenuBotRequest{} - _ bin.BareEncoder = &GetAttachmentMenuBotRequest{} - _ bin.BareDecoder = &GetAttachmentMenuBotRequest{} -) - -func (g *GetAttachmentMenuBotRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BotUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetAttachmentMenuBotRequest) String() string { - if g == nil { - return "GetAttachmentMenuBotRequest(nil)" - } - type Alias GetAttachmentMenuBotRequest - return fmt.Sprintf("GetAttachmentMenuBotRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetAttachmentMenuBotRequest) TypeID() uint32 { - return GetAttachmentMenuBotRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetAttachmentMenuBotRequest) TypeName() string { - return "getAttachmentMenuBot" -} - -// TypeInfo returns info about TL type. -func (g *GetAttachmentMenuBotRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getAttachmentMenuBot", - ID: GetAttachmentMenuBotRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetAttachmentMenuBotRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAttachmentMenuBot#3da561fb as nil") - } - b.PutID(GetAttachmentMenuBotRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetAttachmentMenuBotRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAttachmentMenuBot#3da561fb as nil") - } - b.PutInt53(g.BotUserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetAttachmentMenuBotRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAttachmentMenuBot#3da561fb to nil") - } - if err := b.ConsumeID(GetAttachmentMenuBotRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getAttachmentMenuBot#3da561fb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetAttachmentMenuBotRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAttachmentMenuBot#3da561fb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getAttachmentMenuBot#3da561fb: field bot_user_id: %w", err) - } - g.BotUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetAttachmentMenuBotRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getAttachmentMenuBot#3da561fb as nil") - } - b.ObjStart() - b.PutID("getAttachmentMenuBot") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetAttachmentMenuBotRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getAttachmentMenuBot#3da561fb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getAttachmentMenuBot"); err != nil { - return fmt.Errorf("unable to decode getAttachmentMenuBot#3da561fb: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getAttachmentMenuBot#3da561fb: field bot_user_id: %w", err) - } - g.BotUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetAttachmentMenuBotRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetAttachmentMenuBot invokes method getAttachmentMenuBot#3da561fb returning error if any. -func (c *Client) GetAttachmentMenuBot(ctx context.Context, botuserid int64) (*AttachmentMenuBot, error) { - var result AttachmentMenuBot - - request := &GetAttachmentMenuBotRequest{ - BotUserID: botuserid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_authorization_state_gen.go b/tdapi/tl_get_authorization_state_gen.go deleted file mode 100644 index 2ad0a7013..000000000 --- a/tdapi/tl_get_authorization_state_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetAuthorizationStateRequest represents TL type `getAuthorizationState#742dbe3d`. -type GetAuthorizationStateRequest struct { -} - -// GetAuthorizationStateRequestTypeID is TL type id of GetAuthorizationStateRequest. -const GetAuthorizationStateRequestTypeID = 0x742dbe3d - -// Ensuring interfaces in compile-time for GetAuthorizationStateRequest. -var ( - _ bin.Encoder = &GetAuthorizationStateRequest{} - _ bin.Decoder = &GetAuthorizationStateRequest{} - _ bin.BareEncoder = &GetAuthorizationStateRequest{} - _ bin.BareDecoder = &GetAuthorizationStateRequest{} -) - -func (g *GetAuthorizationStateRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetAuthorizationStateRequest) String() string { - if g == nil { - return "GetAuthorizationStateRequest(nil)" - } - type Alias GetAuthorizationStateRequest - return fmt.Sprintf("GetAuthorizationStateRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetAuthorizationStateRequest) TypeID() uint32 { - return GetAuthorizationStateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetAuthorizationStateRequest) TypeName() string { - return "getAuthorizationState" -} - -// TypeInfo returns info about TL type. -func (g *GetAuthorizationStateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getAuthorizationState", - ID: GetAuthorizationStateRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetAuthorizationStateRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAuthorizationState#742dbe3d as nil") - } - b.PutID(GetAuthorizationStateRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetAuthorizationStateRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAuthorizationState#742dbe3d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetAuthorizationStateRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAuthorizationState#742dbe3d to nil") - } - if err := b.ConsumeID(GetAuthorizationStateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getAuthorizationState#742dbe3d: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetAuthorizationStateRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAuthorizationState#742dbe3d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetAuthorizationStateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getAuthorizationState#742dbe3d as nil") - } - b.ObjStart() - b.PutID("getAuthorizationState") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetAuthorizationStateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getAuthorizationState#742dbe3d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getAuthorizationState"); err != nil { - return fmt.Errorf("unable to decode getAuthorizationState#742dbe3d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAuthorizationState invokes method getAuthorizationState#742dbe3d returning error if any. -func (c *Client) GetAuthorizationState(ctx context.Context) (AuthorizationStateClass, error) { - var result AuthorizationStateBox - - request := &GetAuthorizationStateRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.AuthorizationState, nil -} diff --git a/tdapi/tl_get_auto_download_settings_presets_gen.go b/tdapi/tl_get_auto_download_settings_presets_gen.go deleted file mode 100644 index 41caf659b..000000000 --- a/tdapi/tl_get_auto_download_settings_presets_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetAutoDownloadSettingsPresetsRequest represents TL type `getAutoDownloadSettingsPresets#996a4737`. -type GetAutoDownloadSettingsPresetsRequest struct { -} - -// GetAutoDownloadSettingsPresetsRequestTypeID is TL type id of GetAutoDownloadSettingsPresetsRequest. -const GetAutoDownloadSettingsPresetsRequestTypeID = 0x996a4737 - -// Ensuring interfaces in compile-time for GetAutoDownloadSettingsPresetsRequest. -var ( - _ bin.Encoder = &GetAutoDownloadSettingsPresetsRequest{} - _ bin.Decoder = &GetAutoDownloadSettingsPresetsRequest{} - _ bin.BareEncoder = &GetAutoDownloadSettingsPresetsRequest{} - _ bin.BareDecoder = &GetAutoDownloadSettingsPresetsRequest{} -) - -func (g *GetAutoDownloadSettingsPresetsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetAutoDownloadSettingsPresetsRequest) String() string { - if g == nil { - return "GetAutoDownloadSettingsPresetsRequest(nil)" - } - type Alias GetAutoDownloadSettingsPresetsRequest - return fmt.Sprintf("GetAutoDownloadSettingsPresetsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetAutoDownloadSettingsPresetsRequest) TypeID() uint32 { - return GetAutoDownloadSettingsPresetsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetAutoDownloadSettingsPresetsRequest) TypeName() string { - return "getAutoDownloadSettingsPresets" -} - -// TypeInfo returns info about TL type. -func (g *GetAutoDownloadSettingsPresetsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getAutoDownloadSettingsPresets", - ID: GetAutoDownloadSettingsPresetsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetAutoDownloadSettingsPresetsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAutoDownloadSettingsPresets#996a4737 as nil") - } - b.PutID(GetAutoDownloadSettingsPresetsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetAutoDownloadSettingsPresetsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAutoDownloadSettingsPresets#996a4737 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetAutoDownloadSettingsPresetsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAutoDownloadSettingsPresets#996a4737 to nil") - } - if err := b.ConsumeID(GetAutoDownloadSettingsPresetsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getAutoDownloadSettingsPresets#996a4737: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetAutoDownloadSettingsPresetsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAutoDownloadSettingsPresets#996a4737 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetAutoDownloadSettingsPresetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getAutoDownloadSettingsPresets#996a4737 as nil") - } - b.ObjStart() - b.PutID("getAutoDownloadSettingsPresets") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetAutoDownloadSettingsPresetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getAutoDownloadSettingsPresets#996a4737 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getAutoDownloadSettingsPresets"); err != nil { - return fmt.Errorf("unable to decode getAutoDownloadSettingsPresets#996a4737: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAutoDownloadSettingsPresets invokes method getAutoDownloadSettingsPresets#996a4737 returning error if any. -func (c *Client) GetAutoDownloadSettingsPresets(ctx context.Context) (*AutoDownloadSettingsPresets, error) { - var result AutoDownloadSettingsPresets - - request := &GetAutoDownloadSettingsPresetsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_autosave_settings_gen.go b/tdapi/tl_get_autosave_settings_gen.go deleted file mode 100644 index f7b0a3b1a..000000000 --- a/tdapi/tl_get_autosave_settings_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetAutosaveSettingsRequest represents TL type `getAutosaveSettings#7f53f22a`. -type GetAutosaveSettingsRequest struct { -} - -// GetAutosaveSettingsRequestTypeID is TL type id of GetAutosaveSettingsRequest. -const GetAutosaveSettingsRequestTypeID = 0x7f53f22a - -// Ensuring interfaces in compile-time for GetAutosaveSettingsRequest. -var ( - _ bin.Encoder = &GetAutosaveSettingsRequest{} - _ bin.Decoder = &GetAutosaveSettingsRequest{} - _ bin.BareEncoder = &GetAutosaveSettingsRequest{} - _ bin.BareDecoder = &GetAutosaveSettingsRequest{} -) - -func (g *GetAutosaveSettingsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetAutosaveSettingsRequest) String() string { - if g == nil { - return "GetAutosaveSettingsRequest(nil)" - } - type Alias GetAutosaveSettingsRequest - return fmt.Sprintf("GetAutosaveSettingsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetAutosaveSettingsRequest) TypeID() uint32 { - return GetAutosaveSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetAutosaveSettingsRequest) TypeName() string { - return "getAutosaveSettings" -} - -// TypeInfo returns info about TL type. -func (g *GetAutosaveSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getAutosaveSettings", - ID: GetAutosaveSettingsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetAutosaveSettingsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAutosaveSettings#7f53f22a as nil") - } - b.PutID(GetAutosaveSettingsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetAutosaveSettingsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAutosaveSettings#7f53f22a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetAutosaveSettingsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAutosaveSettings#7f53f22a to nil") - } - if err := b.ConsumeID(GetAutosaveSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getAutosaveSettings#7f53f22a: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetAutosaveSettingsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAutosaveSettings#7f53f22a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetAutosaveSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getAutosaveSettings#7f53f22a as nil") - } - b.ObjStart() - b.PutID("getAutosaveSettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetAutosaveSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getAutosaveSettings#7f53f22a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getAutosaveSettings"); err != nil { - return fmt.Errorf("unable to decode getAutosaveSettings#7f53f22a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAutosaveSettings invokes method getAutosaveSettings#7f53f22a returning error if any. -func (c *Client) GetAutosaveSettings(ctx context.Context) (*AutosaveSettings, error) { - var result AutosaveSettings - - request := &GetAutosaveSettingsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_available_chat_boost_slots_gen.go b/tdapi/tl_get_available_chat_boost_slots_gen.go deleted file mode 100644 index e54fd5b9a..000000000 --- a/tdapi/tl_get_available_chat_boost_slots_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetAvailableChatBoostSlotsRequest represents TL type `getAvailableChatBoostSlots#7307ebd5`. -type GetAvailableChatBoostSlotsRequest struct { -} - -// GetAvailableChatBoostSlotsRequestTypeID is TL type id of GetAvailableChatBoostSlotsRequest. -const GetAvailableChatBoostSlotsRequestTypeID = 0x7307ebd5 - -// Ensuring interfaces in compile-time for GetAvailableChatBoostSlotsRequest. -var ( - _ bin.Encoder = &GetAvailableChatBoostSlotsRequest{} - _ bin.Decoder = &GetAvailableChatBoostSlotsRequest{} - _ bin.BareEncoder = &GetAvailableChatBoostSlotsRequest{} - _ bin.BareDecoder = &GetAvailableChatBoostSlotsRequest{} -) - -func (g *GetAvailableChatBoostSlotsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetAvailableChatBoostSlotsRequest) String() string { - if g == nil { - return "GetAvailableChatBoostSlotsRequest(nil)" - } - type Alias GetAvailableChatBoostSlotsRequest - return fmt.Sprintf("GetAvailableChatBoostSlotsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetAvailableChatBoostSlotsRequest) TypeID() uint32 { - return GetAvailableChatBoostSlotsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetAvailableChatBoostSlotsRequest) TypeName() string { - return "getAvailableChatBoostSlots" -} - -// TypeInfo returns info about TL type. -func (g *GetAvailableChatBoostSlotsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getAvailableChatBoostSlots", - ID: GetAvailableChatBoostSlotsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetAvailableChatBoostSlotsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAvailableChatBoostSlots#7307ebd5 as nil") - } - b.PutID(GetAvailableChatBoostSlotsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetAvailableChatBoostSlotsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAvailableChatBoostSlots#7307ebd5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetAvailableChatBoostSlotsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAvailableChatBoostSlots#7307ebd5 to nil") - } - if err := b.ConsumeID(GetAvailableChatBoostSlotsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getAvailableChatBoostSlots#7307ebd5: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetAvailableChatBoostSlotsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAvailableChatBoostSlots#7307ebd5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetAvailableChatBoostSlotsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getAvailableChatBoostSlots#7307ebd5 as nil") - } - b.ObjStart() - b.PutID("getAvailableChatBoostSlots") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetAvailableChatBoostSlotsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getAvailableChatBoostSlots#7307ebd5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getAvailableChatBoostSlots"); err != nil { - return fmt.Errorf("unable to decode getAvailableChatBoostSlots#7307ebd5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAvailableChatBoostSlots invokes method getAvailableChatBoostSlots#7307ebd5 returning error if any. -func (c *Client) GetAvailableChatBoostSlots(ctx context.Context) (*ChatBoostSlots, error) { - var result ChatBoostSlots - - request := &GetAvailableChatBoostSlotsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_available_gifts_gen.go b/tdapi/tl_get_available_gifts_gen.go deleted file mode 100644 index 7f3cb7422..000000000 --- a/tdapi/tl_get_available_gifts_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetAvailableGiftsRequest represents TL type `getAvailableGifts#f6d565eb`. -type GetAvailableGiftsRequest struct { -} - -// GetAvailableGiftsRequestTypeID is TL type id of GetAvailableGiftsRequest. -const GetAvailableGiftsRequestTypeID = 0xf6d565eb - -// Ensuring interfaces in compile-time for GetAvailableGiftsRequest. -var ( - _ bin.Encoder = &GetAvailableGiftsRequest{} - _ bin.Decoder = &GetAvailableGiftsRequest{} - _ bin.BareEncoder = &GetAvailableGiftsRequest{} - _ bin.BareDecoder = &GetAvailableGiftsRequest{} -) - -func (g *GetAvailableGiftsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetAvailableGiftsRequest) String() string { - if g == nil { - return "GetAvailableGiftsRequest(nil)" - } - type Alias GetAvailableGiftsRequest - return fmt.Sprintf("GetAvailableGiftsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetAvailableGiftsRequest) TypeID() uint32 { - return GetAvailableGiftsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetAvailableGiftsRequest) TypeName() string { - return "getAvailableGifts" -} - -// TypeInfo returns info about TL type. -func (g *GetAvailableGiftsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getAvailableGifts", - ID: GetAvailableGiftsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetAvailableGiftsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAvailableGifts#f6d565eb as nil") - } - b.PutID(GetAvailableGiftsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetAvailableGiftsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getAvailableGifts#f6d565eb as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetAvailableGiftsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAvailableGifts#f6d565eb to nil") - } - if err := b.ConsumeID(GetAvailableGiftsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getAvailableGifts#f6d565eb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetAvailableGiftsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getAvailableGifts#f6d565eb to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetAvailableGiftsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getAvailableGifts#f6d565eb as nil") - } - b.ObjStart() - b.PutID("getAvailableGifts") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetAvailableGiftsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getAvailableGifts#f6d565eb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getAvailableGifts"); err != nil { - return fmt.Errorf("unable to decode getAvailableGifts#f6d565eb: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAvailableGifts invokes method getAvailableGifts#f6d565eb returning error if any. -func (c *Client) GetAvailableGifts(ctx context.Context) (*Gifts, error) { - var result Gifts - - request := &GetAvailableGiftsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_background_url_gen.go b/tdapi/tl_get_background_url_gen.go deleted file mode 100644 index f74cdb53e..000000000 --- a/tdapi/tl_get_background_url_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBackgroundURLRequest represents TL type `getBackgroundUrl#2bbc6fd2`. -type GetBackgroundURLRequest struct { - // Background name - Name string - // Background type; backgroundTypeChatTheme isn't supported - Type BackgroundTypeClass -} - -// GetBackgroundURLRequestTypeID is TL type id of GetBackgroundURLRequest. -const GetBackgroundURLRequestTypeID = 0x2bbc6fd2 - -// Ensuring interfaces in compile-time for GetBackgroundURLRequest. -var ( - _ bin.Encoder = &GetBackgroundURLRequest{} - _ bin.Decoder = &GetBackgroundURLRequest{} - _ bin.BareEncoder = &GetBackgroundURLRequest{} - _ bin.BareDecoder = &GetBackgroundURLRequest{} -) - -func (g *GetBackgroundURLRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Name == "") { - return false - } - if !(g.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBackgroundURLRequest) String() string { - if g == nil { - return "GetBackgroundURLRequest(nil)" - } - type Alias GetBackgroundURLRequest - return fmt.Sprintf("GetBackgroundURLRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBackgroundURLRequest) TypeID() uint32 { - return GetBackgroundURLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBackgroundURLRequest) TypeName() string { - return "getBackgroundUrl" -} - -// TypeInfo returns info about TL type. -func (g *GetBackgroundURLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBackgroundUrl", - ID: GetBackgroundURLRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBackgroundURLRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBackgroundUrl#2bbc6fd2 as nil") - } - b.PutID(GetBackgroundURLRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBackgroundURLRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBackgroundUrl#2bbc6fd2 as nil") - } - b.PutString(g.Name) - if g.Type == nil { - return fmt.Errorf("unable to encode getBackgroundUrl#2bbc6fd2: field type is nil") - } - if err := g.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode getBackgroundUrl#2bbc6fd2: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBackgroundURLRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBackgroundUrl#2bbc6fd2 to nil") - } - if err := b.ConsumeID(GetBackgroundURLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBackgroundUrl#2bbc6fd2: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBackgroundURLRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBackgroundUrl#2bbc6fd2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBackgroundUrl#2bbc6fd2: field name: %w", err) - } - g.Name = value - } - { - value, err := DecodeBackgroundType(b) - if err != nil { - return fmt.Errorf("unable to decode getBackgroundUrl#2bbc6fd2: field type: %w", err) - } - g.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBackgroundURLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBackgroundUrl#2bbc6fd2 as nil") - } - b.ObjStart() - b.PutID("getBackgroundUrl") - b.Comma() - b.FieldStart("name") - b.PutString(g.Name) - b.Comma() - b.FieldStart("type") - if g.Type == nil { - return fmt.Errorf("unable to encode getBackgroundUrl#2bbc6fd2: field type is nil") - } - if err := g.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getBackgroundUrl#2bbc6fd2: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBackgroundURLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBackgroundUrl#2bbc6fd2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBackgroundUrl"); err != nil { - return fmt.Errorf("unable to decode getBackgroundUrl#2bbc6fd2: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBackgroundUrl#2bbc6fd2: field name: %w", err) - } - g.Name = value - case "type": - value, err := DecodeTDLibJSONBackgroundType(b) - if err != nil { - return fmt.Errorf("unable to decode getBackgroundUrl#2bbc6fd2: field type: %w", err) - } - g.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (g *GetBackgroundURLRequest) GetName() (value string) { - if g == nil { - return - } - return g.Name -} - -// GetType returns value of Type field. -func (g *GetBackgroundURLRequest) GetType() (value BackgroundTypeClass) { - if g == nil { - return - } - return g.Type -} - -// GetBackgroundURL invokes method getBackgroundUrl#2bbc6fd2 returning error if any. -func (c *Client) GetBackgroundURL(ctx context.Context, request *GetBackgroundURLRequest) (*HTTPURL, error) { - var result HTTPURL - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_bank_card_info_gen.go b/tdapi/tl_get_bank_card_info_gen.go deleted file mode 100644 index c18dfd25b..000000000 --- a/tdapi/tl_get_bank_card_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBankCardInfoRequest represents TL type `getBankCardInfo#b1e31db0`. -type GetBankCardInfoRequest struct { - // The bank card number - BankCardNumber string -} - -// GetBankCardInfoRequestTypeID is TL type id of GetBankCardInfoRequest. -const GetBankCardInfoRequestTypeID = 0xb1e31db0 - -// Ensuring interfaces in compile-time for GetBankCardInfoRequest. -var ( - _ bin.Encoder = &GetBankCardInfoRequest{} - _ bin.Decoder = &GetBankCardInfoRequest{} - _ bin.BareEncoder = &GetBankCardInfoRequest{} - _ bin.BareDecoder = &GetBankCardInfoRequest{} -) - -func (g *GetBankCardInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BankCardNumber == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBankCardInfoRequest) String() string { - if g == nil { - return "GetBankCardInfoRequest(nil)" - } - type Alias GetBankCardInfoRequest - return fmt.Sprintf("GetBankCardInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBankCardInfoRequest) TypeID() uint32 { - return GetBankCardInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBankCardInfoRequest) TypeName() string { - return "getBankCardInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetBankCardInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBankCardInfo", - ID: GetBankCardInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BankCardNumber", - SchemaName: "bank_card_number", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBankCardInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBankCardInfo#b1e31db0 as nil") - } - b.PutID(GetBankCardInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBankCardInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBankCardInfo#b1e31db0 as nil") - } - b.PutString(g.BankCardNumber) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBankCardInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBankCardInfo#b1e31db0 to nil") - } - if err := b.ConsumeID(GetBankCardInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBankCardInfo#b1e31db0: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBankCardInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBankCardInfo#b1e31db0 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBankCardInfo#b1e31db0: field bank_card_number: %w", err) - } - g.BankCardNumber = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBankCardInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBankCardInfo#b1e31db0 as nil") - } - b.ObjStart() - b.PutID("getBankCardInfo") - b.Comma() - b.FieldStart("bank_card_number") - b.PutString(g.BankCardNumber) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBankCardInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBankCardInfo#b1e31db0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBankCardInfo"); err != nil { - return fmt.Errorf("unable to decode getBankCardInfo#b1e31db0: %w", err) - } - case "bank_card_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBankCardInfo#b1e31db0: field bank_card_number: %w", err) - } - g.BankCardNumber = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBankCardNumber returns value of BankCardNumber field. -func (g *GetBankCardInfoRequest) GetBankCardNumber() (value string) { - if g == nil { - return - } - return g.BankCardNumber -} - -// GetBankCardInfo invokes method getBankCardInfo#b1e31db0 returning error if any. -func (c *Client) GetBankCardInfo(ctx context.Context, bankcardnumber string) (*BankCardInfo, error) { - var result BankCardInfo - - request := &GetBankCardInfoRequest{ - BankCardNumber: bankcardnumber, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_basic_group_full_info_gen.go b/tdapi/tl_get_basic_group_full_info_gen.go deleted file mode 100644 index 141b7cf16..000000000 --- a/tdapi/tl_get_basic_group_full_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBasicGroupFullInfoRequest represents TL type `getBasicGroupFullInfo#9365e32b`. -type GetBasicGroupFullInfoRequest struct { - // Basic group identifier - BasicGroupID int64 -} - -// GetBasicGroupFullInfoRequestTypeID is TL type id of GetBasicGroupFullInfoRequest. -const GetBasicGroupFullInfoRequestTypeID = 0x9365e32b - -// Ensuring interfaces in compile-time for GetBasicGroupFullInfoRequest. -var ( - _ bin.Encoder = &GetBasicGroupFullInfoRequest{} - _ bin.Decoder = &GetBasicGroupFullInfoRequest{} - _ bin.BareEncoder = &GetBasicGroupFullInfoRequest{} - _ bin.BareDecoder = &GetBasicGroupFullInfoRequest{} -) - -func (g *GetBasicGroupFullInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BasicGroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBasicGroupFullInfoRequest) String() string { - if g == nil { - return "GetBasicGroupFullInfoRequest(nil)" - } - type Alias GetBasicGroupFullInfoRequest - return fmt.Sprintf("GetBasicGroupFullInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBasicGroupFullInfoRequest) TypeID() uint32 { - return GetBasicGroupFullInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBasicGroupFullInfoRequest) TypeName() string { - return "getBasicGroupFullInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetBasicGroupFullInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBasicGroupFullInfo", - ID: GetBasicGroupFullInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BasicGroupID", - SchemaName: "basic_group_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBasicGroupFullInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBasicGroupFullInfo#9365e32b as nil") - } - b.PutID(GetBasicGroupFullInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBasicGroupFullInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBasicGroupFullInfo#9365e32b as nil") - } - b.PutInt53(g.BasicGroupID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBasicGroupFullInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBasicGroupFullInfo#9365e32b to nil") - } - if err := b.ConsumeID(GetBasicGroupFullInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBasicGroupFullInfo#9365e32b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBasicGroupFullInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBasicGroupFullInfo#9365e32b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBasicGroupFullInfo#9365e32b: field basic_group_id: %w", err) - } - g.BasicGroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBasicGroupFullInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBasicGroupFullInfo#9365e32b as nil") - } - b.ObjStart() - b.PutID("getBasicGroupFullInfo") - b.Comma() - b.FieldStart("basic_group_id") - b.PutInt53(g.BasicGroupID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBasicGroupFullInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBasicGroupFullInfo#9365e32b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBasicGroupFullInfo"); err != nil { - return fmt.Errorf("unable to decode getBasicGroupFullInfo#9365e32b: %w", err) - } - case "basic_group_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBasicGroupFullInfo#9365e32b: field basic_group_id: %w", err) - } - g.BasicGroupID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBasicGroupID returns value of BasicGroupID field. -func (g *GetBasicGroupFullInfoRequest) GetBasicGroupID() (value int64) { - if g == nil { - return - } - return g.BasicGroupID -} - -// GetBasicGroupFullInfo invokes method getBasicGroupFullInfo#9365e32b returning error if any. -func (c *Client) GetBasicGroupFullInfo(ctx context.Context, basicgroupid int64) (*BasicGroupFullInfo, error) { - var result BasicGroupFullInfo - - request := &GetBasicGroupFullInfoRequest{ - BasicGroupID: basicgroupid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_basic_group_gen.go b/tdapi/tl_get_basic_group_gen.go deleted file mode 100644 index d8b4a73ac..000000000 --- a/tdapi/tl_get_basic_group_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBasicGroupRequest represents TL type `getBasicGroup#9e893654`. -type GetBasicGroupRequest struct { - // Basic group identifier - BasicGroupID int64 -} - -// GetBasicGroupRequestTypeID is TL type id of GetBasicGroupRequest. -const GetBasicGroupRequestTypeID = 0x9e893654 - -// Ensuring interfaces in compile-time for GetBasicGroupRequest. -var ( - _ bin.Encoder = &GetBasicGroupRequest{} - _ bin.Decoder = &GetBasicGroupRequest{} - _ bin.BareEncoder = &GetBasicGroupRequest{} - _ bin.BareDecoder = &GetBasicGroupRequest{} -) - -func (g *GetBasicGroupRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BasicGroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBasicGroupRequest) String() string { - if g == nil { - return "GetBasicGroupRequest(nil)" - } - type Alias GetBasicGroupRequest - return fmt.Sprintf("GetBasicGroupRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBasicGroupRequest) TypeID() uint32 { - return GetBasicGroupRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBasicGroupRequest) TypeName() string { - return "getBasicGroup" -} - -// TypeInfo returns info about TL type. -func (g *GetBasicGroupRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBasicGroup", - ID: GetBasicGroupRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BasicGroupID", - SchemaName: "basic_group_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBasicGroupRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBasicGroup#9e893654 as nil") - } - b.PutID(GetBasicGroupRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBasicGroupRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBasicGroup#9e893654 as nil") - } - b.PutInt53(g.BasicGroupID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBasicGroupRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBasicGroup#9e893654 to nil") - } - if err := b.ConsumeID(GetBasicGroupRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBasicGroup#9e893654: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBasicGroupRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBasicGroup#9e893654 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBasicGroup#9e893654: field basic_group_id: %w", err) - } - g.BasicGroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBasicGroupRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBasicGroup#9e893654 as nil") - } - b.ObjStart() - b.PutID("getBasicGroup") - b.Comma() - b.FieldStart("basic_group_id") - b.PutInt53(g.BasicGroupID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBasicGroupRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBasicGroup#9e893654 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBasicGroup"); err != nil { - return fmt.Errorf("unable to decode getBasicGroup#9e893654: %w", err) - } - case "basic_group_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBasicGroup#9e893654: field basic_group_id: %w", err) - } - g.BasicGroupID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBasicGroupID returns value of BasicGroupID field. -func (g *GetBasicGroupRequest) GetBasicGroupID() (value int64) { - if g == nil { - return - } - return g.BasicGroupID -} - -// GetBasicGroup invokes method getBasicGroup#9e893654 returning error if any. -func (c *Client) GetBasicGroup(ctx context.Context, basicgroupid int64) (*BasicGroup, error) { - var result BasicGroup - - request := &GetBasicGroupRequest{ - BasicGroupID: basicgroupid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_blocked_message_senders_gen.go b/tdapi/tl_get_blocked_message_senders_gen.go deleted file mode 100644 index df7908e3f..000000000 --- a/tdapi/tl_get_blocked_message_senders_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBlockedMessageSendersRequest represents TL type `getBlockedMessageSenders#8ce52f16`. -type GetBlockedMessageSendersRequest struct { - // Block list from which to return users - BlockList BlockListClass - // Number of users and chats to skip in the result; must be non-negative - Offset int32 - // The maximum number of users and chats to return; up to 100 - Limit int32 -} - -// GetBlockedMessageSendersRequestTypeID is TL type id of GetBlockedMessageSendersRequest. -const GetBlockedMessageSendersRequestTypeID = 0x8ce52f16 - -// Ensuring interfaces in compile-time for GetBlockedMessageSendersRequest. -var ( - _ bin.Encoder = &GetBlockedMessageSendersRequest{} - _ bin.Decoder = &GetBlockedMessageSendersRequest{} - _ bin.BareEncoder = &GetBlockedMessageSendersRequest{} - _ bin.BareDecoder = &GetBlockedMessageSendersRequest{} -) - -func (g *GetBlockedMessageSendersRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BlockList == nil) { - return false - } - if !(g.Offset == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBlockedMessageSendersRequest) String() string { - if g == nil { - return "GetBlockedMessageSendersRequest(nil)" - } - type Alias GetBlockedMessageSendersRequest - return fmt.Sprintf("GetBlockedMessageSendersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBlockedMessageSendersRequest) TypeID() uint32 { - return GetBlockedMessageSendersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBlockedMessageSendersRequest) TypeName() string { - return "getBlockedMessageSenders" -} - -// TypeInfo returns info about TL type. -func (g *GetBlockedMessageSendersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBlockedMessageSenders", - ID: GetBlockedMessageSendersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BlockList", - SchemaName: "block_list", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBlockedMessageSendersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBlockedMessageSenders#8ce52f16 as nil") - } - b.PutID(GetBlockedMessageSendersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBlockedMessageSendersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBlockedMessageSenders#8ce52f16 as nil") - } - if g.BlockList == nil { - return fmt.Errorf("unable to encode getBlockedMessageSenders#8ce52f16: field block_list is nil") - } - if err := g.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode getBlockedMessageSenders#8ce52f16: field block_list: %w", err) - } - b.PutInt32(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBlockedMessageSendersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBlockedMessageSenders#8ce52f16 to nil") - } - if err := b.ConsumeID(GetBlockedMessageSendersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBlockedMessageSenders#8ce52f16: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBlockedMessageSendersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBlockedMessageSenders#8ce52f16 to nil") - } - { - value, err := DecodeBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode getBlockedMessageSenders#8ce52f16: field block_list: %w", err) - } - g.BlockList = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getBlockedMessageSenders#8ce52f16: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getBlockedMessageSenders#8ce52f16: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBlockedMessageSendersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBlockedMessageSenders#8ce52f16 as nil") - } - b.ObjStart() - b.PutID("getBlockedMessageSenders") - b.Comma() - b.FieldStart("block_list") - if g.BlockList == nil { - return fmt.Errorf("unable to encode getBlockedMessageSenders#8ce52f16: field block_list is nil") - } - if err := g.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getBlockedMessageSenders#8ce52f16: field block_list: %w", err) - } - b.Comma() - b.FieldStart("offset") - b.PutInt32(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBlockedMessageSendersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBlockedMessageSenders#8ce52f16 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBlockedMessageSenders"); err != nil { - return fmt.Errorf("unable to decode getBlockedMessageSenders#8ce52f16: %w", err) - } - case "block_list": - value, err := DecodeTDLibJSONBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode getBlockedMessageSenders#8ce52f16: field block_list: %w", err) - } - g.BlockList = value - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getBlockedMessageSenders#8ce52f16: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getBlockedMessageSenders#8ce52f16: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBlockList returns value of BlockList field. -func (g *GetBlockedMessageSendersRequest) GetBlockList() (value BlockListClass) { - if g == nil { - return - } - return g.BlockList -} - -// GetOffset returns value of Offset field. -func (g *GetBlockedMessageSendersRequest) GetOffset() (value int32) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetBlockedMessageSendersRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetBlockedMessageSenders invokes method getBlockedMessageSenders#8ce52f16 returning error if any. -func (c *Client) GetBlockedMessageSenders(ctx context.Context, request *GetBlockedMessageSendersRequest) (*MessageSenders, error) { - var result MessageSenders - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_bot_info_description_gen.go b/tdapi/tl_get_bot_info_description_gen.go deleted file mode 100644 index 5c5a97658..000000000 --- a/tdapi/tl_get_bot_info_description_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBotInfoDescriptionRequest represents TL type `getBotInfoDescription#d287f835`. -type GetBotInfoDescriptionRequest struct { - // Identifier of the target bot - BotUserID int64 - // A two-letter ISO 639-1 language code or an empty string - LanguageCode string -} - -// GetBotInfoDescriptionRequestTypeID is TL type id of GetBotInfoDescriptionRequest. -const GetBotInfoDescriptionRequestTypeID = 0xd287f835 - -// Ensuring interfaces in compile-time for GetBotInfoDescriptionRequest. -var ( - _ bin.Encoder = &GetBotInfoDescriptionRequest{} - _ bin.Decoder = &GetBotInfoDescriptionRequest{} - _ bin.BareEncoder = &GetBotInfoDescriptionRequest{} - _ bin.BareDecoder = &GetBotInfoDescriptionRequest{} -) - -func (g *GetBotInfoDescriptionRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BotUserID == 0) { - return false - } - if !(g.LanguageCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBotInfoDescriptionRequest) String() string { - if g == nil { - return "GetBotInfoDescriptionRequest(nil)" - } - type Alias GetBotInfoDescriptionRequest - return fmt.Sprintf("GetBotInfoDescriptionRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBotInfoDescriptionRequest) TypeID() uint32 { - return GetBotInfoDescriptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBotInfoDescriptionRequest) TypeName() string { - return "getBotInfoDescription" -} - -// TypeInfo returns info about TL type. -func (g *GetBotInfoDescriptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBotInfoDescription", - ID: GetBotInfoDescriptionRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBotInfoDescriptionRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBotInfoDescription#d287f835 as nil") - } - b.PutID(GetBotInfoDescriptionRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBotInfoDescriptionRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBotInfoDescription#d287f835 as nil") - } - b.PutInt53(g.BotUserID) - b.PutString(g.LanguageCode) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBotInfoDescriptionRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBotInfoDescription#d287f835 to nil") - } - if err := b.ConsumeID(GetBotInfoDescriptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBotInfoDescription#d287f835: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBotInfoDescriptionRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBotInfoDescription#d287f835 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBotInfoDescription#d287f835: field bot_user_id: %w", err) - } - g.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBotInfoDescription#d287f835: field language_code: %w", err) - } - g.LanguageCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBotInfoDescriptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBotInfoDescription#d287f835 as nil") - } - b.ObjStart() - b.PutID("getBotInfoDescription") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.FieldStart("language_code") - b.PutString(g.LanguageCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBotInfoDescriptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBotInfoDescription#d287f835 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBotInfoDescription"); err != nil { - return fmt.Errorf("unable to decode getBotInfoDescription#d287f835: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBotInfoDescription#d287f835: field bot_user_id: %w", err) - } - g.BotUserID = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBotInfoDescription#d287f835: field language_code: %w", err) - } - g.LanguageCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetBotInfoDescriptionRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetLanguageCode returns value of LanguageCode field. -func (g *GetBotInfoDescriptionRequest) GetLanguageCode() (value string) { - if g == nil { - return - } - return g.LanguageCode -} - -// GetBotInfoDescription invokes method getBotInfoDescription#d287f835 returning error if any. -func (c *Client) GetBotInfoDescription(ctx context.Context, request *GetBotInfoDescriptionRequest) (*Text, error) { - var result Text - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_bot_info_short_description_gen.go b/tdapi/tl_get_bot_info_short_description_gen.go deleted file mode 100644 index e3d4bedda..000000000 --- a/tdapi/tl_get_bot_info_short_description_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBotInfoShortDescriptionRequest represents TL type `getBotInfoShortDescription#4a1c2614`. -type GetBotInfoShortDescriptionRequest struct { - // Identifier of the target bot - BotUserID int64 - // A two-letter ISO 639-1 language code or an empty string - LanguageCode string -} - -// GetBotInfoShortDescriptionRequestTypeID is TL type id of GetBotInfoShortDescriptionRequest. -const GetBotInfoShortDescriptionRequestTypeID = 0x4a1c2614 - -// Ensuring interfaces in compile-time for GetBotInfoShortDescriptionRequest. -var ( - _ bin.Encoder = &GetBotInfoShortDescriptionRequest{} - _ bin.Decoder = &GetBotInfoShortDescriptionRequest{} - _ bin.BareEncoder = &GetBotInfoShortDescriptionRequest{} - _ bin.BareDecoder = &GetBotInfoShortDescriptionRequest{} -) - -func (g *GetBotInfoShortDescriptionRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BotUserID == 0) { - return false - } - if !(g.LanguageCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBotInfoShortDescriptionRequest) String() string { - if g == nil { - return "GetBotInfoShortDescriptionRequest(nil)" - } - type Alias GetBotInfoShortDescriptionRequest - return fmt.Sprintf("GetBotInfoShortDescriptionRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBotInfoShortDescriptionRequest) TypeID() uint32 { - return GetBotInfoShortDescriptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBotInfoShortDescriptionRequest) TypeName() string { - return "getBotInfoShortDescription" -} - -// TypeInfo returns info about TL type. -func (g *GetBotInfoShortDescriptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBotInfoShortDescription", - ID: GetBotInfoShortDescriptionRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBotInfoShortDescriptionRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBotInfoShortDescription#4a1c2614 as nil") - } - b.PutID(GetBotInfoShortDescriptionRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBotInfoShortDescriptionRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBotInfoShortDescription#4a1c2614 as nil") - } - b.PutInt53(g.BotUserID) - b.PutString(g.LanguageCode) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBotInfoShortDescriptionRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBotInfoShortDescription#4a1c2614 to nil") - } - if err := b.ConsumeID(GetBotInfoShortDescriptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBotInfoShortDescription#4a1c2614: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBotInfoShortDescriptionRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBotInfoShortDescription#4a1c2614 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBotInfoShortDescription#4a1c2614: field bot_user_id: %w", err) - } - g.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBotInfoShortDescription#4a1c2614: field language_code: %w", err) - } - g.LanguageCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBotInfoShortDescriptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBotInfoShortDescription#4a1c2614 as nil") - } - b.ObjStart() - b.PutID("getBotInfoShortDescription") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.FieldStart("language_code") - b.PutString(g.LanguageCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBotInfoShortDescriptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBotInfoShortDescription#4a1c2614 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBotInfoShortDescription"); err != nil { - return fmt.Errorf("unable to decode getBotInfoShortDescription#4a1c2614: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBotInfoShortDescription#4a1c2614: field bot_user_id: %w", err) - } - g.BotUserID = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBotInfoShortDescription#4a1c2614: field language_code: %w", err) - } - g.LanguageCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetBotInfoShortDescriptionRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetLanguageCode returns value of LanguageCode field. -func (g *GetBotInfoShortDescriptionRequest) GetLanguageCode() (value string) { - if g == nil { - return - } - return g.LanguageCode -} - -// GetBotInfoShortDescription invokes method getBotInfoShortDescription#4a1c2614 returning error if any. -func (c *Client) GetBotInfoShortDescription(ctx context.Context, request *GetBotInfoShortDescriptionRequest) (*Text, error) { - var result Text - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_bot_media_preview_info_gen.go b/tdapi/tl_get_bot_media_preview_info_gen.go deleted file mode 100644 index 390b4904b..000000000 --- a/tdapi/tl_get_bot_media_preview_info_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBotMediaPreviewInfoRequest represents TL type `getBotMediaPreviewInfo#50f60136`. -type GetBotMediaPreviewInfoRequest struct { - // Identifier of the target bot. The bot must be owned and must have the main Web App - BotUserID int64 - // A two-letter ISO 639-1 language code for which to get previews. If empty, then default - // previews are returned - LanguageCode string -} - -// GetBotMediaPreviewInfoRequestTypeID is TL type id of GetBotMediaPreviewInfoRequest. -const GetBotMediaPreviewInfoRequestTypeID = 0x50f60136 - -// Ensuring interfaces in compile-time for GetBotMediaPreviewInfoRequest. -var ( - _ bin.Encoder = &GetBotMediaPreviewInfoRequest{} - _ bin.Decoder = &GetBotMediaPreviewInfoRequest{} - _ bin.BareEncoder = &GetBotMediaPreviewInfoRequest{} - _ bin.BareDecoder = &GetBotMediaPreviewInfoRequest{} -) - -func (g *GetBotMediaPreviewInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BotUserID == 0) { - return false - } - if !(g.LanguageCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBotMediaPreviewInfoRequest) String() string { - if g == nil { - return "GetBotMediaPreviewInfoRequest(nil)" - } - type Alias GetBotMediaPreviewInfoRequest - return fmt.Sprintf("GetBotMediaPreviewInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBotMediaPreviewInfoRequest) TypeID() uint32 { - return GetBotMediaPreviewInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBotMediaPreviewInfoRequest) TypeName() string { - return "getBotMediaPreviewInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetBotMediaPreviewInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBotMediaPreviewInfo", - ID: GetBotMediaPreviewInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBotMediaPreviewInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBotMediaPreviewInfo#50f60136 as nil") - } - b.PutID(GetBotMediaPreviewInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBotMediaPreviewInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBotMediaPreviewInfo#50f60136 as nil") - } - b.PutInt53(g.BotUserID) - b.PutString(g.LanguageCode) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBotMediaPreviewInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBotMediaPreviewInfo#50f60136 to nil") - } - if err := b.ConsumeID(GetBotMediaPreviewInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBotMediaPreviewInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBotMediaPreviewInfo#50f60136 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: field bot_user_id: %w", err) - } - g.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: field language_code: %w", err) - } - g.LanguageCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBotMediaPreviewInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBotMediaPreviewInfo#50f60136 as nil") - } - b.ObjStart() - b.PutID("getBotMediaPreviewInfo") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.FieldStart("language_code") - b.PutString(g.LanguageCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBotMediaPreviewInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBotMediaPreviewInfo#50f60136 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBotMediaPreviewInfo"); err != nil { - return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: field bot_user_id: %w", err) - } - g.BotUserID = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBotMediaPreviewInfo#50f60136: field language_code: %w", err) - } - g.LanguageCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetBotMediaPreviewInfoRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetLanguageCode returns value of LanguageCode field. -func (g *GetBotMediaPreviewInfoRequest) GetLanguageCode() (value string) { - if g == nil { - return - } - return g.LanguageCode -} - -// GetBotMediaPreviewInfo invokes method getBotMediaPreviewInfo#50f60136 returning error if any. -func (c *Client) GetBotMediaPreviewInfo(ctx context.Context, request *GetBotMediaPreviewInfoRequest) (*BotMediaPreviewInfo, error) { - var result BotMediaPreviewInfo - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_bot_media_previews_gen.go b/tdapi/tl_get_bot_media_previews_gen.go deleted file mode 100644 index 509afb388..000000000 --- a/tdapi/tl_get_bot_media_previews_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBotMediaPreviewsRequest represents TL type `getBotMediaPreviews#22665458`. -type GetBotMediaPreviewsRequest struct { - // Identifier of the target bot. The bot must have the main Web App - BotUserID int64 -} - -// GetBotMediaPreviewsRequestTypeID is TL type id of GetBotMediaPreviewsRequest. -const GetBotMediaPreviewsRequestTypeID = 0x22665458 - -// Ensuring interfaces in compile-time for GetBotMediaPreviewsRequest. -var ( - _ bin.Encoder = &GetBotMediaPreviewsRequest{} - _ bin.Decoder = &GetBotMediaPreviewsRequest{} - _ bin.BareEncoder = &GetBotMediaPreviewsRequest{} - _ bin.BareDecoder = &GetBotMediaPreviewsRequest{} -) - -func (g *GetBotMediaPreviewsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BotUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBotMediaPreviewsRequest) String() string { - if g == nil { - return "GetBotMediaPreviewsRequest(nil)" - } - type Alias GetBotMediaPreviewsRequest - return fmt.Sprintf("GetBotMediaPreviewsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBotMediaPreviewsRequest) TypeID() uint32 { - return GetBotMediaPreviewsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBotMediaPreviewsRequest) TypeName() string { - return "getBotMediaPreviews" -} - -// TypeInfo returns info about TL type. -func (g *GetBotMediaPreviewsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBotMediaPreviews", - ID: GetBotMediaPreviewsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBotMediaPreviewsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBotMediaPreviews#22665458 as nil") - } - b.PutID(GetBotMediaPreviewsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBotMediaPreviewsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBotMediaPreviews#22665458 as nil") - } - b.PutInt53(g.BotUserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBotMediaPreviewsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBotMediaPreviews#22665458 to nil") - } - if err := b.ConsumeID(GetBotMediaPreviewsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBotMediaPreviews#22665458: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBotMediaPreviewsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBotMediaPreviews#22665458 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBotMediaPreviews#22665458: field bot_user_id: %w", err) - } - g.BotUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBotMediaPreviewsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBotMediaPreviews#22665458 as nil") - } - b.ObjStart() - b.PutID("getBotMediaPreviews") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBotMediaPreviewsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBotMediaPreviews#22665458 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBotMediaPreviews"); err != nil { - return fmt.Errorf("unable to decode getBotMediaPreviews#22665458: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBotMediaPreviews#22665458: field bot_user_id: %w", err) - } - g.BotUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetBotMediaPreviewsRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetBotMediaPreviews invokes method getBotMediaPreviews#22665458 returning error if any. -func (c *Client) GetBotMediaPreviews(ctx context.Context, botuserid int64) (*BotMediaPreviews, error) { - var result BotMediaPreviews - - request := &GetBotMediaPreviewsRequest{ - BotUserID: botuserid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_bot_name_gen.go b/tdapi/tl_get_bot_name_gen.go deleted file mode 100644 index 78c503367..000000000 --- a/tdapi/tl_get_bot_name_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBotNameRequest represents TL type `getBotName#9a3f722c`. -type GetBotNameRequest struct { - // Identifier of the target bot - BotUserID int64 - // A two-letter ISO 639-1 language code or an empty string - LanguageCode string -} - -// GetBotNameRequestTypeID is TL type id of GetBotNameRequest. -const GetBotNameRequestTypeID = 0x9a3f722c - -// Ensuring interfaces in compile-time for GetBotNameRequest. -var ( - _ bin.Encoder = &GetBotNameRequest{} - _ bin.Decoder = &GetBotNameRequest{} - _ bin.BareEncoder = &GetBotNameRequest{} - _ bin.BareDecoder = &GetBotNameRequest{} -) - -func (g *GetBotNameRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BotUserID == 0) { - return false - } - if !(g.LanguageCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBotNameRequest) String() string { - if g == nil { - return "GetBotNameRequest(nil)" - } - type Alias GetBotNameRequest - return fmt.Sprintf("GetBotNameRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBotNameRequest) TypeID() uint32 { - return GetBotNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBotNameRequest) TypeName() string { - return "getBotName" -} - -// TypeInfo returns info about TL type. -func (g *GetBotNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBotName", - ID: GetBotNameRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBotNameRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBotName#9a3f722c as nil") - } - b.PutID(GetBotNameRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBotNameRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBotName#9a3f722c as nil") - } - b.PutInt53(g.BotUserID) - b.PutString(g.LanguageCode) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBotNameRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBotName#9a3f722c to nil") - } - if err := b.ConsumeID(GetBotNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBotName#9a3f722c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBotNameRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBotName#9a3f722c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBotName#9a3f722c: field bot_user_id: %w", err) - } - g.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBotName#9a3f722c: field language_code: %w", err) - } - g.LanguageCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBotNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBotName#9a3f722c as nil") - } - b.ObjStart() - b.PutID("getBotName") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.FieldStart("language_code") - b.PutString(g.LanguageCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBotNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBotName#9a3f722c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBotName"); err != nil { - return fmt.Errorf("unable to decode getBotName#9a3f722c: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getBotName#9a3f722c: field bot_user_id: %w", err) - } - g.BotUserID = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBotName#9a3f722c: field language_code: %w", err) - } - g.LanguageCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetBotNameRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetLanguageCode returns value of LanguageCode field. -func (g *GetBotNameRequest) GetLanguageCode() (value string) { - if g == nil { - return - } - return g.LanguageCode -} - -// GetBotName invokes method getBotName#9a3f722c returning error if any. -func (c *Client) GetBotName(ctx context.Context, request *GetBotNameRequest) (*Text, error) { - var result Text - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_business_chat_link_info_gen.go b/tdapi/tl_get_business_chat_link_info_gen.go deleted file mode 100644 index 86495e02d..000000000 --- a/tdapi/tl_get_business_chat_link_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBusinessChatLinkInfoRequest represents TL type `getBusinessChatLinkInfo#2f8b7e4a`. -type GetBusinessChatLinkInfoRequest struct { - // Name of the link - LinkName string -} - -// GetBusinessChatLinkInfoRequestTypeID is TL type id of GetBusinessChatLinkInfoRequest. -const GetBusinessChatLinkInfoRequestTypeID = 0x2f8b7e4a - -// Ensuring interfaces in compile-time for GetBusinessChatLinkInfoRequest. -var ( - _ bin.Encoder = &GetBusinessChatLinkInfoRequest{} - _ bin.Decoder = &GetBusinessChatLinkInfoRequest{} - _ bin.BareEncoder = &GetBusinessChatLinkInfoRequest{} - _ bin.BareDecoder = &GetBusinessChatLinkInfoRequest{} -) - -func (g *GetBusinessChatLinkInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.LinkName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBusinessChatLinkInfoRequest) String() string { - if g == nil { - return "GetBusinessChatLinkInfoRequest(nil)" - } - type Alias GetBusinessChatLinkInfoRequest - return fmt.Sprintf("GetBusinessChatLinkInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBusinessChatLinkInfoRequest) TypeID() uint32 { - return GetBusinessChatLinkInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBusinessChatLinkInfoRequest) TypeName() string { - return "getBusinessChatLinkInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetBusinessChatLinkInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBusinessChatLinkInfo", - ID: GetBusinessChatLinkInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LinkName", - SchemaName: "link_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBusinessChatLinkInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessChatLinkInfo#2f8b7e4a as nil") - } - b.PutID(GetBusinessChatLinkInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBusinessChatLinkInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessChatLinkInfo#2f8b7e4a as nil") - } - b.PutString(g.LinkName) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBusinessChatLinkInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessChatLinkInfo#2f8b7e4a to nil") - } - if err := b.ConsumeID(GetBusinessChatLinkInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBusinessChatLinkInfo#2f8b7e4a: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBusinessChatLinkInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessChatLinkInfo#2f8b7e4a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBusinessChatLinkInfo#2f8b7e4a: field link_name: %w", err) - } - g.LinkName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBusinessChatLinkInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessChatLinkInfo#2f8b7e4a as nil") - } - b.ObjStart() - b.PutID("getBusinessChatLinkInfo") - b.Comma() - b.FieldStart("link_name") - b.PutString(g.LinkName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBusinessChatLinkInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessChatLinkInfo#2f8b7e4a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBusinessChatLinkInfo"); err != nil { - return fmt.Errorf("unable to decode getBusinessChatLinkInfo#2f8b7e4a: %w", err) - } - case "link_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBusinessChatLinkInfo#2f8b7e4a: field link_name: %w", err) - } - g.LinkName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLinkName returns value of LinkName field. -func (g *GetBusinessChatLinkInfoRequest) GetLinkName() (value string) { - if g == nil { - return - } - return g.LinkName -} - -// GetBusinessChatLinkInfo invokes method getBusinessChatLinkInfo#2f8b7e4a returning error if any. -func (c *Client) GetBusinessChatLinkInfo(ctx context.Context, linkname string) (*BusinessChatLinkInfo, error) { - var result BusinessChatLinkInfo - - request := &GetBusinessChatLinkInfoRequest{ - LinkName: linkname, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_business_chat_links_gen.go b/tdapi/tl_get_business_chat_links_gen.go deleted file mode 100644 index 8cca57091..000000000 --- a/tdapi/tl_get_business_chat_links_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBusinessChatLinksRequest represents TL type `getBusinessChatLinks#2a562157`. -type GetBusinessChatLinksRequest struct { -} - -// GetBusinessChatLinksRequestTypeID is TL type id of GetBusinessChatLinksRequest. -const GetBusinessChatLinksRequestTypeID = 0x2a562157 - -// Ensuring interfaces in compile-time for GetBusinessChatLinksRequest. -var ( - _ bin.Encoder = &GetBusinessChatLinksRequest{} - _ bin.Decoder = &GetBusinessChatLinksRequest{} - _ bin.BareEncoder = &GetBusinessChatLinksRequest{} - _ bin.BareDecoder = &GetBusinessChatLinksRequest{} -) - -func (g *GetBusinessChatLinksRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBusinessChatLinksRequest) String() string { - if g == nil { - return "GetBusinessChatLinksRequest(nil)" - } - type Alias GetBusinessChatLinksRequest - return fmt.Sprintf("GetBusinessChatLinksRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBusinessChatLinksRequest) TypeID() uint32 { - return GetBusinessChatLinksRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBusinessChatLinksRequest) TypeName() string { - return "getBusinessChatLinks" -} - -// TypeInfo returns info about TL type. -func (g *GetBusinessChatLinksRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBusinessChatLinks", - ID: GetBusinessChatLinksRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBusinessChatLinksRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessChatLinks#2a562157 as nil") - } - b.PutID(GetBusinessChatLinksRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBusinessChatLinksRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessChatLinks#2a562157 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBusinessChatLinksRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessChatLinks#2a562157 to nil") - } - if err := b.ConsumeID(GetBusinessChatLinksRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBusinessChatLinks#2a562157: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBusinessChatLinksRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessChatLinks#2a562157 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBusinessChatLinksRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessChatLinks#2a562157 as nil") - } - b.ObjStart() - b.PutID("getBusinessChatLinks") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBusinessChatLinksRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessChatLinks#2a562157 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBusinessChatLinks"); err != nil { - return fmt.Errorf("unable to decode getBusinessChatLinks#2a562157: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessChatLinks invokes method getBusinessChatLinks#2a562157 returning error if any. -func (c *Client) GetBusinessChatLinks(ctx context.Context) (*BusinessChatLinks, error) { - var result BusinessChatLinks - - request := &GetBusinessChatLinksRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_business_connected_bot_gen.go b/tdapi/tl_get_business_connected_bot_gen.go deleted file mode 100644 index f219c9842..000000000 --- a/tdapi/tl_get_business_connected_bot_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBusinessConnectedBotRequest represents TL type `getBusinessConnectedBot#364da7c3`. -type GetBusinessConnectedBotRequest struct { -} - -// GetBusinessConnectedBotRequestTypeID is TL type id of GetBusinessConnectedBotRequest. -const GetBusinessConnectedBotRequestTypeID = 0x364da7c3 - -// Ensuring interfaces in compile-time for GetBusinessConnectedBotRequest. -var ( - _ bin.Encoder = &GetBusinessConnectedBotRequest{} - _ bin.Decoder = &GetBusinessConnectedBotRequest{} - _ bin.BareEncoder = &GetBusinessConnectedBotRequest{} - _ bin.BareDecoder = &GetBusinessConnectedBotRequest{} -) - -func (g *GetBusinessConnectedBotRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBusinessConnectedBotRequest) String() string { - if g == nil { - return "GetBusinessConnectedBotRequest(nil)" - } - type Alias GetBusinessConnectedBotRequest - return fmt.Sprintf("GetBusinessConnectedBotRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBusinessConnectedBotRequest) TypeID() uint32 { - return GetBusinessConnectedBotRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBusinessConnectedBotRequest) TypeName() string { - return "getBusinessConnectedBot" -} - -// TypeInfo returns info about TL type. -func (g *GetBusinessConnectedBotRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBusinessConnectedBot", - ID: GetBusinessConnectedBotRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBusinessConnectedBotRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessConnectedBot#364da7c3 as nil") - } - b.PutID(GetBusinessConnectedBotRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBusinessConnectedBotRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessConnectedBot#364da7c3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBusinessConnectedBotRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessConnectedBot#364da7c3 to nil") - } - if err := b.ConsumeID(GetBusinessConnectedBotRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBusinessConnectedBot#364da7c3: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBusinessConnectedBotRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessConnectedBot#364da7c3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBusinessConnectedBotRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessConnectedBot#364da7c3 as nil") - } - b.ObjStart() - b.PutID("getBusinessConnectedBot") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBusinessConnectedBotRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessConnectedBot#364da7c3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBusinessConnectedBot"); err != nil { - return fmt.Errorf("unable to decode getBusinessConnectedBot#364da7c3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessConnectedBot invokes method getBusinessConnectedBot#364da7c3 returning error if any. -func (c *Client) GetBusinessConnectedBot(ctx context.Context) (*BusinessConnectedBot, error) { - var result BusinessConnectedBot - - request := &GetBusinessConnectedBotRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_business_connection_gen.go b/tdapi/tl_get_business_connection_gen.go deleted file mode 100644 index 514982c3c..000000000 --- a/tdapi/tl_get_business_connection_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBusinessConnectionRequest represents TL type `getBusinessConnection#81f42420`. -type GetBusinessConnectionRequest struct { - // Identifier of the business connection to return - ConnectionID string -} - -// GetBusinessConnectionRequestTypeID is TL type id of GetBusinessConnectionRequest. -const GetBusinessConnectionRequestTypeID = 0x81f42420 - -// Ensuring interfaces in compile-time for GetBusinessConnectionRequest. -var ( - _ bin.Encoder = &GetBusinessConnectionRequest{} - _ bin.Decoder = &GetBusinessConnectionRequest{} - _ bin.BareEncoder = &GetBusinessConnectionRequest{} - _ bin.BareDecoder = &GetBusinessConnectionRequest{} -) - -func (g *GetBusinessConnectionRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ConnectionID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBusinessConnectionRequest) String() string { - if g == nil { - return "GetBusinessConnectionRequest(nil)" - } - type Alias GetBusinessConnectionRequest - return fmt.Sprintf("GetBusinessConnectionRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBusinessConnectionRequest) TypeID() uint32 { - return GetBusinessConnectionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBusinessConnectionRequest) TypeName() string { - return "getBusinessConnection" -} - -// TypeInfo returns info about TL type. -func (g *GetBusinessConnectionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBusinessConnection", - ID: GetBusinessConnectionRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ConnectionID", - SchemaName: "connection_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBusinessConnectionRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessConnection#81f42420 as nil") - } - b.PutID(GetBusinessConnectionRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBusinessConnectionRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessConnection#81f42420 as nil") - } - b.PutString(g.ConnectionID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBusinessConnectionRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessConnection#81f42420 to nil") - } - if err := b.ConsumeID(GetBusinessConnectionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBusinessConnection#81f42420: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBusinessConnectionRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessConnection#81f42420 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBusinessConnection#81f42420: field connection_id: %w", err) - } - g.ConnectionID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBusinessConnectionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessConnection#81f42420 as nil") - } - b.ObjStart() - b.PutID("getBusinessConnection") - b.Comma() - b.FieldStart("connection_id") - b.PutString(g.ConnectionID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBusinessConnectionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessConnection#81f42420 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBusinessConnection"); err != nil { - return fmt.Errorf("unable to decode getBusinessConnection#81f42420: %w", err) - } - case "connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getBusinessConnection#81f42420: field connection_id: %w", err) - } - g.ConnectionID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetConnectionID returns value of ConnectionID field. -func (g *GetBusinessConnectionRequest) GetConnectionID() (value string) { - if g == nil { - return - } - return g.ConnectionID -} - -// GetBusinessConnection invokes method getBusinessConnection#81f42420 returning error if any. -func (c *Client) GetBusinessConnection(ctx context.Context, connectionid string) (*BusinessConnection, error) { - var result BusinessConnection - - request := &GetBusinessConnectionRequest{ - ConnectionID: connectionid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_business_features_gen.go b/tdapi/tl_get_business_features_gen.go deleted file mode 100644 index 493fc7b1a..000000000 --- a/tdapi/tl_get_business_features_gen.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetBusinessFeaturesRequest represents TL type `getBusinessFeatures#c4906001`. -type GetBusinessFeaturesRequest struct { - // Source of the request; pass null if the method is called from settings or some - // non-standard source - Source BusinessFeatureClass -} - -// GetBusinessFeaturesRequestTypeID is TL type id of GetBusinessFeaturesRequest. -const GetBusinessFeaturesRequestTypeID = 0xc4906001 - -// Ensuring interfaces in compile-time for GetBusinessFeaturesRequest. -var ( - _ bin.Encoder = &GetBusinessFeaturesRequest{} - _ bin.Decoder = &GetBusinessFeaturesRequest{} - _ bin.BareEncoder = &GetBusinessFeaturesRequest{} - _ bin.BareDecoder = &GetBusinessFeaturesRequest{} -) - -func (g *GetBusinessFeaturesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Source == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetBusinessFeaturesRequest) String() string { - if g == nil { - return "GetBusinessFeaturesRequest(nil)" - } - type Alias GetBusinessFeaturesRequest - return fmt.Sprintf("GetBusinessFeaturesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetBusinessFeaturesRequest) TypeID() uint32 { - return GetBusinessFeaturesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetBusinessFeaturesRequest) TypeName() string { - return "getBusinessFeatures" -} - -// TypeInfo returns info about TL type. -func (g *GetBusinessFeaturesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getBusinessFeatures", - ID: GetBusinessFeaturesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Source", - SchemaName: "source", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetBusinessFeaturesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessFeatures#c4906001 as nil") - } - b.PutID(GetBusinessFeaturesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetBusinessFeaturesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessFeatures#c4906001 as nil") - } - if g.Source == nil { - return fmt.Errorf("unable to encode getBusinessFeatures#c4906001: field source is nil") - } - if err := g.Source.Encode(b); err != nil { - return fmt.Errorf("unable to encode getBusinessFeatures#c4906001: field source: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetBusinessFeaturesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessFeatures#c4906001 to nil") - } - if err := b.ConsumeID(GetBusinessFeaturesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getBusinessFeatures#c4906001: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetBusinessFeaturesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessFeatures#c4906001 to nil") - } - { - value, err := DecodeBusinessFeature(b) - if err != nil { - return fmt.Errorf("unable to decode getBusinessFeatures#c4906001: field source: %w", err) - } - g.Source = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetBusinessFeaturesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getBusinessFeatures#c4906001 as nil") - } - b.ObjStart() - b.PutID("getBusinessFeatures") - b.Comma() - b.FieldStart("source") - if g.Source == nil { - return fmt.Errorf("unable to encode getBusinessFeatures#c4906001: field source is nil") - } - if err := g.Source.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getBusinessFeatures#c4906001: field source: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetBusinessFeaturesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getBusinessFeatures#c4906001 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getBusinessFeatures"); err != nil { - return fmt.Errorf("unable to decode getBusinessFeatures#c4906001: %w", err) - } - case "source": - value, err := DecodeTDLibJSONBusinessFeature(b) - if err != nil { - return fmt.Errorf("unable to decode getBusinessFeatures#c4906001: field source: %w", err) - } - g.Source = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSource returns value of Source field. -func (g *GetBusinessFeaturesRequest) GetSource() (value BusinessFeatureClass) { - if g == nil { - return - } - return g.Source -} - -// GetBusinessFeatures invokes method getBusinessFeatures#c4906001 returning error if any. -func (c *Client) GetBusinessFeatures(ctx context.Context, source BusinessFeatureClass) (*BusinessFeatures, error) { - var result BusinessFeatures - - request := &GetBusinessFeaturesRequest{ - Source: source, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_callback_query_answer_gen.go b/tdapi/tl_get_callback_query_answer_gen.go deleted file mode 100644 index d8ce784ba..000000000 --- a/tdapi/tl_get_callback_query_answer_gen.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCallbackQueryAnswerRequest represents TL type `getCallbackQueryAnswer#6ef7a5f`. -type GetCallbackQueryAnswerRequest struct { - // Identifier of the chat with the message - ChatID int64 - // Identifier of the message from which the query originated. The message must not be - // scheduled - MessageID int64 - // Query payload - Payload CallbackQueryPayloadClass -} - -// GetCallbackQueryAnswerRequestTypeID is TL type id of GetCallbackQueryAnswerRequest. -const GetCallbackQueryAnswerRequestTypeID = 0x6ef7a5f - -// Ensuring interfaces in compile-time for GetCallbackQueryAnswerRequest. -var ( - _ bin.Encoder = &GetCallbackQueryAnswerRequest{} - _ bin.Decoder = &GetCallbackQueryAnswerRequest{} - _ bin.BareEncoder = &GetCallbackQueryAnswerRequest{} - _ bin.BareDecoder = &GetCallbackQueryAnswerRequest{} -) - -func (g *GetCallbackQueryAnswerRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.Payload == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCallbackQueryAnswerRequest) String() string { - if g == nil { - return "GetCallbackQueryAnswerRequest(nil)" - } - type Alias GetCallbackQueryAnswerRequest - return fmt.Sprintf("GetCallbackQueryAnswerRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCallbackQueryAnswerRequest) TypeID() uint32 { - return GetCallbackQueryAnswerRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCallbackQueryAnswerRequest) TypeName() string { - return "getCallbackQueryAnswer" -} - -// TypeInfo returns info about TL type. -func (g *GetCallbackQueryAnswerRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCallbackQueryAnswer", - ID: GetCallbackQueryAnswerRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Payload", - SchemaName: "payload", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCallbackQueryAnswerRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCallbackQueryAnswer#6ef7a5f as nil") - } - b.PutID(GetCallbackQueryAnswerRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCallbackQueryAnswerRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCallbackQueryAnswer#6ef7a5f as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - if g.Payload == nil { - return fmt.Errorf("unable to encode getCallbackQueryAnswer#6ef7a5f: field payload is nil") - } - if err := g.Payload.Encode(b); err != nil { - return fmt.Errorf("unable to encode getCallbackQueryAnswer#6ef7a5f: field payload: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCallbackQueryAnswerRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCallbackQueryAnswer#6ef7a5f to nil") - } - if err := b.ConsumeID(GetCallbackQueryAnswerRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCallbackQueryAnswer#6ef7a5f: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCallbackQueryAnswerRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCallbackQueryAnswer#6ef7a5f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryAnswer#6ef7a5f: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryAnswer#6ef7a5f: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := DecodeCallbackQueryPayload(b) - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryAnswer#6ef7a5f: field payload: %w", err) - } - g.Payload = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCallbackQueryAnswerRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCallbackQueryAnswer#6ef7a5f as nil") - } - b.ObjStart() - b.PutID("getCallbackQueryAnswer") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("payload") - if g.Payload == nil { - return fmt.Errorf("unable to encode getCallbackQueryAnswer#6ef7a5f: field payload is nil") - } - if err := g.Payload.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getCallbackQueryAnswer#6ef7a5f: field payload: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCallbackQueryAnswerRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCallbackQueryAnswer#6ef7a5f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCallbackQueryAnswer"); err != nil { - return fmt.Errorf("unable to decode getCallbackQueryAnswer#6ef7a5f: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryAnswer#6ef7a5f: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryAnswer#6ef7a5f: field message_id: %w", err) - } - g.MessageID = value - case "payload": - value, err := DecodeTDLibJSONCallbackQueryPayload(b) - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryAnswer#6ef7a5f: field payload: %w", err) - } - g.Payload = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetCallbackQueryAnswerRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetCallbackQueryAnswerRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetPayload returns value of Payload field. -func (g *GetCallbackQueryAnswerRequest) GetPayload() (value CallbackQueryPayloadClass) { - if g == nil { - return - } - return g.Payload -} - -// GetCallbackQueryAnswer invokes method getCallbackQueryAnswer#6ef7a5f returning error if any. -func (c *Client) GetCallbackQueryAnswer(ctx context.Context, request *GetCallbackQueryAnswerRequest) (*CallbackQueryAnswer, error) { - var result CallbackQueryAnswer - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_callback_query_message_gen.go b/tdapi/tl_get_callback_query_message_gen.go deleted file mode 100644 index e545fcd4a..000000000 --- a/tdapi/tl_get_callback_query_message_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCallbackQueryMessageRequest represents TL type `getCallbackQueryMessage#bd209172`. -type GetCallbackQueryMessageRequest struct { - // Identifier of the chat the message belongs to - ChatID int64 - // Message identifier - MessageID int64 - // Identifier of the callback query - CallbackQueryID int64 -} - -// GetCallbackQueryMessageRequestTypeID is TL type id of GetCallbackQueryMessageRequest. -const GetCallbackQueryMessageRequestTypeID = 0xbd209172 - -// Ensuring interfaces in compile-time for GetCallbackQueryMessageRequest. -var ( - _ bin.Encoder = &GetCallbackQueryMessageRequest{} - _ bin.Decoder = &GetCallbackQueryMessageRequest{} - _ bin.BareEncoder = &GetCallbackQueryMessageRequest{} - _ bin.BareDecoder = &GetCallbackQueryMessageRequest{} -) - -func (g *GetCallbackQueryMessageRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.CallbackQueryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCallbackQueryMessageRequest) String() string { - if g == nil { - return "GetCallbackQueryMessageRequest(nil)" - } - type Alias GetCallbackQueryMessageRequest - return fmt.Sprintf("GetCallbackQueryMessageRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCallbackQueryMessageRequest) TypeID() uint32 { - return GetCallbackQueryMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCallbackQueryMessageRequest) TypeName() string { - return "getCallbackQueryMessage" -} - -// TypeInfo returns info about TL type. -func (g *GetCallbackQueryMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCallbackQueryMessage", - ID: GetCallbackQueryMessageRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "CallbackQueryID", - SchemaName: "callback_query_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCallbackQueryMessageRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCallbackQueryMessage#bd209172 as nil") - } - b.PutID(GetCallbackQueryMessageRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCallbackQueryMessageRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCallbackQueryMessage#bd209172 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - b.PutLong(g.CallbackQueryID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCallbackQueryMessageRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCallbackQueryMessage#bd209172 to nil") - } - if err := b.ConsumeID(GetCallbackQueryMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCallbackQueryMessage#bd209172: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCallbackQueryMessageRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCallbackQueryMessage#bd209172 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryMessage#bd209172: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryMessage#bd209172: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryMessage#bd209172: field callback_query_id: %w", err) - } - g.CallbackQueryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCallbackQueryMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCallbackQueryMessage#bd209172 as nil") - } - b.ObjStart() - b.PutID("getCallbackQueryMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("callback_query_id") - b.PutLong(g.CallbackQueryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCallbackQueryMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCallbackQueryMessage#bd209172 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCallbackQueryMessage"); err != nil { - return fmt.Errorf("unable to decode getCallbackQueryMessage#bd209172: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryMessage#bd209172: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryMessage#bd209172: field message_id: %w", err) - } - g.MessageID = value - case "callback_query_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getCallbackQueryMessage#bd209172: field callback_query_id: %w", err) - } - g.CallbackQueryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetCallbackQueryMessageRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetCallbackQueryMessageRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetCallbackQueryID returns value of CallbackQueryID field. -func (g *GetCallbackQueryMessageRequest) GetCallbackQueryID() (value int64) { - if g == nil { - return - } - return g.CallbackQueryID -} - -// GetCallbackQueryMessage invokes method getCallbackQueryMessage#bd209172 returning error if any. -func (c *Client) GetCallbackQueryMessage(ctx context.Context, request *GetCallbackQueryMessageRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_active_stories_gen.go b/tdapi/tl_get_chat_active_stories_gen.go deleted file mode 100644 index 24312b397..000000000 --- a/tdapi/tl_get_chat_active_stories_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatActiveStoriesRequest represents TL type `getChatActiveStories#2e4ffbf5`. -type GetChatActiveStoriesRequest struct { - // Chat identifier - ChatID int64 -} - -// GetChatActiveStoriesRequestTypeID is TL type id of GetChatActiveStoriesRequest. -const GetChatActiveStoriesRequestTypeID = 0x2e4ffbf5 - -// Ensuring interfaces in compile-time for GetChatActiveStoriesRequest. -var ( - _ bin.Encoder = &GetChatActiveStoriesRequest{} - _ bin.Decoder = &GetChatActiveStoriesRequest{} - _ bin.BareEncoder = &GetChatActiveStoriesRequest{} - _ bin.BareDecoder = &GetChatActiveStoriesRequest{} -) - -func (g *GetChatActiveStoriesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatActiveStoriesRequest) String() string { - if g == nil { - return "GetChatActiveStoriesRequest(nil)" - } - type Alias GetChatActiveStoriesRequest - return fmt.Sprintf("GetChatActiveStoriesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatActiveStoriesRequest) TypeID() uint32 { - return GetChatActiveStoriesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatActiveStoriesRequest) TypeName() string { - return "getChatActiveStories" -} - -// TypeInfo returns info about TL type. -func (g *GetChatActiveStoriesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatActiveStories", - ID: GetChatActiveStoriesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatActiveStoriesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatActiveStories#2e4ffbf5 as nil") - } - b.PutID(GetChatActiveStoriesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatActiveStoriesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatActiveStories#2e4ffbf5 as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatActiveStoriesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatActiveStories#2e4ffbf5 to nil") - } - if err := b.ConsumeID(GetChatActiveStoriesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatActiveStories#2e4ffbf5: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatActiveStoriesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatActiveStories#2e4ffbf5 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatActiveStories#2e4ffbf5: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatActiveStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatActiveStories#2e4ffbf5 as nil") - } - b.ObjStart() - b.PutID("getChatActiveStories") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatActiveStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatActiveStories#2e4ffbf5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatActiveStories"); err != nil { - return fmt.Errorf("unable to decode getChatActiveStories#2e4ffbf5: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatActiveStories#2e4ffbf5: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatActiveStoriesRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChatActiveStories invokes method getChatActiveStories#2e4ffbf5 returning error if any. -func (c *Client) GetChatActiveStories(ctx context.Context, chatid int64) (*ChatActiveStories, error) { - var result ChatActiveStories - - request := &GetChatActiveStoriesRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_administrators_gen.go b/tdapi/tl_get_chat_administrators_gen.go deleted file mode 100644 index 681d3eaa7..000000000 --- a/tdapi/tl_get_chat_administrators_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatAdministratorsRequest represents TL type `getChatAdministrators#5c0eb6bb`. -type GetChatAdministratorsRequest struct { - // Chat identifier - ChatID int64 -} - -// GetChatAdministratorsRequestTypeID is TL type id of GetChatAdministratorsRequest. -const GetChatAdministratorsRequestTypeID = 0x5c0eb6bb - -// Ensuring interfaces in compile-time for GetChatAdministratorsRequest. -var ( - _ bin.Encoder = &GetChatAdministratorsRequest{} - _ bin.Decoder = &GetChatAdministratorsRequest{} - _ bin.BareEncoder = &GetChatAdministratorsRequest{} - _ bin.BareDecoder = &GetChatAdministratorsRequest{} -) - -func (g *GetChatAdministratorsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatAdministratorsRequest) String() string { - if g == nil { - return "GetChatAdministratorsRequest(nil)" - } - type Alias GetChatAdministratorsRequest - return fmt.Sprintf("GetChatAdministratorsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatAdministratorsRequest) TypeID() uint32 { - return GetChatAdministratorsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatAdministratorsRequest) TypeName() string { - return "getChatAdministrators" -} - -// TypeInfo returns info about TL type. -func (g *GetChatAdministratorsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatAdministrators", - ID: GetChatAdministratorsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatAdministratorsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatAdministrators#5c0eb6bb as nil") - } - b.PutID(GetChatAdministratorsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatAdministratorsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatAdministrators#5c0eb6bb as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatAdministratorsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatAdministrators#5c0eb6bb to nil") - } - if err := b.ConsumeID(GetChatAdministratorsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatAdministrators#5c0eb6bb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatAdministratorsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatAdministrators#5c0eb6bb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatAdministrators#5c0eb6bb: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatAdministratorsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatAdministrators#5c0eb6bb as nil") - } - b.ObjStart() - b.PutID("getChatAdministrators") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatAdministratorsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatAdministrators#5c0eb6bb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatAdministrators"); err != nil { - return fmt.Errorf("unable to decode getChatAdministrators#5c0eb6bb: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatAdministrators#5c0eb6bb: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatAdministratorsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChatAdministrators invokes method getChatAdministrators#5c0eb6bb returning error if any. -func (c *Client) GetChatAdministrators(ctx context.Context, chatid int64) (*ChatAdministrators, error) { - var result ChatAdministrators - - request := &GetChatAdministratorsRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_archived_stories_gen.go b/tdapi/tl_get_chat_archived_stories_gen.go deleted file mode 100644 index e28a533b3..000000000 --- a/tdapi/tl_get_chat_archived_stories_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatArchivedStoriesRequest represents TL type `getChatArchivedStories#af1e9488`. -type GetChatArchivedStoriesRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the story starting from which stories must be returned; use 0 to get - // results from the last story - FromStoryID int32 - // The maximum number of stories to be returned. - Limit int32 -} - -// GetChatArchivedStoriesRequestTypeID is TL type id of GetChatArchivedStoriesRequest. -const GetChatArchivedStoriesRequestTypeID = 0xaf1e9488 - -// Ensuring interfaces in compile-time for GetChatArchivedStoriesRequest. -var ( - _ bin.Encoder = &GetChatArchivedStoriesRequest{} - _ bin.Decoder = &GetChatArchivedStoriesRequest{} - _ bin.BareEncoder = &GetChatArchivedStoriesRequest{} - _ bin.BareDecoder = &GetChatArchivedStoriesRequest{} -) - -func (g *GetChatArchivedStoriesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.FromStoryID == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatArchivedStoriesRequest) String() string { - if g == nil { - return "GetChatArchivedStoriesRequest(nil)" - } - type Alias GetChatArchivedStoriesRequest - return fmt.Sprintf("GetChatArchivedStoriesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatArchivedStoriesRequest) TypeID() uint32 { - return GetChatArchivedStoriesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatArchivedStoriesRequest) TypeName() string { - return "getChatArchivedStories" -} - -// TypeInfo returns info about TL type. -func (g *GetChatArchivedStoriesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatArchivedStories", - ID: GetChatArchivedStoriesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "FromStoryID", - SchemaName: "from_story_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatArchivedStoriesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatArchivedStories#af1e9488 as nil") - } - b.PutID(GetChatArchivedStoriesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatArchivedStoriesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatArchivedStories#af1e9488 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt32(g.FromStoryID) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatArchivedStoriesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatArchivedStories#af1e9488 to nil") - } - if err := b.ConsumeID(GetChatArchivedStoriesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatArchivedStoriesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatArchivedStories#af1e9488 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: field from_story_id: %w", err) - } - g.FromStoryID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatArchivedStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatArchivedStories#af1e9488 as nil") - } - b.ObjStart() - b.PutID("getChatArchivedStories") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("from_story_id") - b.PutInt32(g.FromStoryID) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatArchivedStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatArchivedStories#af1e9488 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatArchivedStories"); err != nil { - return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: field chat_id: %w", err) - } - g.ChatID = value - case "from_story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: field from_story_id: %w", err) - } - g.FromStoryID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatArchivedStories#af1e9488: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatArchivedStoriesRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetFromStoryID returns value of FromStoryID field. -func (g *GetChatArchivedStoriesRequest) GetFromStoryID() (value int32) { - if g == nil { - return - } - return g.FromStoryID -} - -// GetLimit returns value of Limit field. -func (g *GetChatArchivedStoriesRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChatArchivedStories invokes method getChatArchivedStories#af1e9488 returning error if any. -func (c *Client) GetChatArchivedStories(ctx context.Context, request *GetChatArchivedStoriesRequest) (*Stories, error) { - var result Stories - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_available_message_senders_gen.go b/tdapi/tl_get_chat_available_message_senders_gen.go deleted file mode 100644 index f82c4d220..000000000 --- a/tdapi/tl_get_chat_available_message_senders_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatAvailableMessageSendersRequest represents TL type `getChatAvailableMessageSenders#450fe92b`. -type GetChatAvailableMessageSendersRequest struct { - // Chat identifier - ChatID int64 -} - -// GetChatAvailableMessageSendersRequestTypeID is TL type id of GetChatAvailableMessageSendersRequest. -const GetChatAvailableMessageSendersRequestTypeID = 0x450fe92b - -// Ensuring interfaces in compile-time for GetChatAvailableMessageSendersRequest. -var ( - _ bin.Encoder = &GetChatAvailableMessageSendersRequest{} - _ bin.Decoder = &GetChatAvailableMessageSendersRequest{} - _ bin.BareEncoder = &GetChatAvailableMessageSendersRequest{} - _ bin.BareDecoder = &GetChatAvailableMessageSendersRequest{} -) - -func (g *GetChatAvailableMessageSendersRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatAvailableMessageSendersRequest) String() string { - if g == nil { - return "GetChatAvailableMessageSendersRequest(nil)" - } - type Alias GetChatAvailableMessageSendersRequest - return fmt.Sprintf("GetChatAvailableMessageSendersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatAvailableMessageSendersRequest) TypeID() uint32 { - return GetChatAvailableMessageSendersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatAvailableMessageSendersRequest) TypeName() string { - return "getChatAvailableMessageSenders" -} - -// TypeInfo returns info about TL type. -func (g *GetChatAvailableMessageSendersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatAvailableMessageSenders", - ID: GetChatAvailableMessageSendersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatAvailableMessageSendersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatAvailableMessageSenders#450fe92b as nil") - } - b.PutID(GetChatAvailableMessageSendersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatAvailableMessageSendersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatAvailableMessageSenders#450fe92b as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatAvailableMessageSendersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatAvailableMessageSenders#450fe92b to nil") - } - if err := b.ConsumeID(GetChatAvailableMessageSendersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatAvailableMessageSenders#450fe92b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatAvailableMessageSendersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatAvailableMessageSenders#450fe92b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatAvailableMessageSenders#450fe92b: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatAvailableMessageSendersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatAvailableMessageSenders#450fe92b as nil") - } - b.ObjStart() - b.PutID("getChatAvailableMessageSenders") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatAvailableMessageSendersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatAvailableMessageSenders#450fe92b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatAvailableMessageSenders"); err != nil { - return fmt.Errorf("unable to decode getChatAvailableMessageSenders#450fe92b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatAvailableMessageSenders#450fe92b: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatAvailableMessageSendersRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChatAvailableMessageSenders invokes method getChatAvailableMessageSenders#450fe92b returning error if any. -func (c *Client) GetChatAvailableMessageSenders(ctx context.Context, chatid int64) (*ChatMessageSenders, error) { - var result ChatMessageSenders - - request := &GetChatAvailableMessageSendersRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_boost_features_gen.go b/tdapi/tl_get_chat_boost_features_gen.go deleted file mode 100644 index 29f4e83b4..000000000 --- a/tdapi/tl_get_chat_boost_features_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatBoostFeaturesRequest represents TL type `getChatBoostFeatures#e8c128a0`. -type GetChatBoostFeaturesRequest struct { - // Pass true to get the list of features for channels; pass false to get the list of - // features for supergroups - IsChannel bool -} - -// GetChatBoostFeaturesRequestTypeID is TL type id of GetChatBoostFeaturesRequest. -const GetChatBoostFeaturesRequestTypeID = 0xe8c128a0 - -// Ensuring interfaces in compile-time for GetChatBoostFeaturesRequest. -var ( - _ bin.Encoder = &GetChatBoostFeaturesRequest{} - _ bin.Decoder = &GetChatBoostFeaturesRequest{} - _ bin.BareEncoder = &GetChatBoostFeaturesRequest{} - _ bin.BareDecoder = &GetChatBoostFeaturesRequest{} -) - -func (g *GetChatBoostFeaturesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.IsChannel == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatBoostFeaturesRequest) String() string { - if g == nil { - return "GetChatBoostFeaturesRequest(nil)" - } - type Alias GetChatBoostFeaturesRequest - return fmt.Sprintf("GetChatBoostFeaturesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatBoostFeaturesRequest) TypeID() uint32 { - return GetChatBoostFeaturesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatBoostFeaturesRequest) TypeName() string { - return "getChatBoostFeatures" -} - -// TypeInfo returns info about TL type. -func (g *GetChatBoostFeaturesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatBoostFeatures", - ID: GetChatBoostFeaturesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsChannel", - SchemaName: "is_channel", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatBoostFeaturesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostFeatures#e8c128a0 as nil") - } - b.PutID(GetChatBoostFeaturesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatBoostFeaturesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostFeatures#e8c128a0 as nil") - } - b.PutBool(g.IsChannel) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatBoostFeaturesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostFeatures#e8c128a0 to nil") - } - if err := b.ConsumeID(GetChatBoostFeaturesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatBoostFeatures#e8c128a0: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatBoostFeaturesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostFeatures#e8c128a0 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostFeatures#e8c128a0: field is_channel: %w", err) - } - g.IsChannel = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatBoostFeaturesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostFeatures#e8c128a0 as nil") - } - b.ObjStart() - b.PutID("getChatBoostFeatures") - b.Comma() - b.FieldStart("is_channel") - b.PutBool(g.IsChannel) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatBoostFeaturesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostFeatures#e8c128a0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatBoostFeatures"); err != nil { - return fmt.Errorf("unable to decode getChatBoostFeatures#e8c128a0: %w", err) - } - case "is_channel": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostFeatures#e8c128a0: field is_channel: %w", err) - } - g.IsChannel = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsChannel returns value of IsChannel field. -func (g *GetChatBoostFeaturesRequest) GetIsChannel() (value bool) { - if g == nil { - return - } - return g.IsChannel -} - -// GetChatBoostFeatures invokes method getChatBoostFeatures#e8c128a0 returning error if any. -func (c *Client) GetChatBoostFeatures(ctx context.Context, ischannel bool) (*ChatBoostFeatures, error) { - var result ChatBoostFeatures - - request := &GetChatBoostFeaturesRequest{ - IsChannel: ischannel, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_boost_level_features_gen.go b/tdapi/tl_get_chat_boost_level_features_gen.go deleted file mode 100644 index 4854624f2..000000000 --- a/tdapi/tl_get_chat_boost_level_features_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatBoostLevelFeaturesRequest represents TL type `getChatBoostLevelFeatures#45e63e8b`. -type GetChatBoostLevelFeaturesRequest struct { - // Pass true to get the list of features for channels; pass false to get the list of - // features for supergroups - IsChannel bool - // Chat boost level - Level int32 -} - -// GetChatBoostLevelFeaturesRequestTypeID is TL type id of GetChatBoostLevelFeaturesRequest. -const GetChatBoostLevelFeaturesRequestTypeID = 0x45e63e8b - -// Ensuring interfaces in compile-time for GetChatBoostLevelFeaturesRequest. -var ( - _ bin.Encoder = &GetChatBoostLevelFeaturesRequest{} - _ bin.Decoder = &GetChatBoostLevelFeaturesRequest{} - _ bin.BareEncoder = &GetChatBoostLevelFeaturesRequest{} - _ bin.BareDecoder = &GetChatBoostLevelFeaturesRequest{} -) - -func (g *GetChatBoostLevelFeaturesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.IsChannel == false) { - return false - } - if !(g.Level == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatBoostLevelFeaturesRequest) String() string { - if g == nil { - return "GetChatBoostLevelFeaturesRequest(nil)" - } - type Alias GetChatBoostLevelFeaturesRequest - return fmt.Sprintf("GetChatBoostLevelFeaturesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatBoostLevelFeaturesRequest) TypeID() uint32 { - return GetChatBoostLevelFeaturesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatBoostLevelFeaturesRequest) TypeName() string { - return "getChatBoostLevelFeatures" -} - -// TypeInfo returns info about TL type. -func (g *GetChatBoostLevelFeaturesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatBoostLevelFeatures", - ID: GetChatBoostLevelFeaturesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsChannel", - SchemaName: "is_channel", - }, - { - Name: "Level", - SchemaName: "level", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatBoostLevelFeaturesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostLevelFeatures#45e63e8b as nil") - } - b.PutID(GetChatBoostLevelFeaturesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatBoostLevelFeaturesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostLevelFeatures#45e63e8b as nil") - } - b.PutBool(g.IsChannel) - b.PutInt32(g.Level) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatBoostLevelFeaturesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostLevelFeatures#45e63e8b to nil") - } - if err := b.ConsumeID(GetChatBoostLevelFeaturesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatBoostLevelFeaturesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostLevelFeatures#45e63e8b to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: field is_channel: %w", err) - } - g.IsChannel = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: field level: %w", err) - } - g.Level = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatBoostLevelFeaturesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostLevelFeatures#45e63e8b as nil") - } - b.ObjStart() - b.PutID("getChatBoostLevelFeatures") - b.Comma() - b.FieldStart("is_channel") - b.PutBool(g.IsChannel) - b.Comma() - b.FieldStart("level") - b.PutInt32(g.Level) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatBoostLevelFeaturesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostLevelFeatures#45e63e8b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatBoostLevelFeatures"); err != nil { - return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: %w", err) - } - case "is_channel": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: field is_channel: %w", err) - } - g.IsChannel = value - case "level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostLevelFeatures#45e63e8b: field level: %w", err) - } - g.Level = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsChannel returns value of IsChannel field. -func (g *GetChatBoostLevelFeaturesRequest) GetIsChannel() (value bool) { - if g == nil { - return - } - return g.IsChannel -} - -// GetLevel returns value of Level field. -func (g *GetChatBoostLevelFeaturesRequest) GetLevel() (value int32) { - if g == nil { - return - } - return g.Level -} - -// GetChatBoostLevelFeatures invokes method getChatBoostLevelFeatures#45e63e8b returning error if any. -func (c *Client) GetChatBoostLevelFeatures(ctx context.Context, request *GetChatBoostLevelFeaturesRequest) (*ChatBoostLevelFeatures, error) { - var result ChatBoostLevelFeatures - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_boost_link_gen.go b/tdapi/tl_get_chat_boost_link_gen.go deleted file mode 100644 index 67c5d6b5f..000000000 --- a/tdapi/tl_get_chat_boost_link_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatBoostLinkRequest represents TL type `getChatBoostLink#56f16c85`. -type GetChatBoostLinkRequest struct { - // Identifier of the chat - ChatID int64 -} - -// GetChatBoostLinkRequestTypeID is TL type id of GetChatBoostLinkRequest. -const GetChatBoostLinkRequestTypeID = 0x56f16c85 - -// Ensuring interfaces in compile-time for GetChatBoostLinkRequest. -var ( - _ bin.Encoder = &GetChatBoostLinkRequest{} - _ bin.Decoder = &GetChatBoostLinkRequest{} - _ bin.BareEncoder = &GetChatBoostLinkRequest{} - _ bin.BareDecoder = &GetChatBoostLinkRequest{} -) - -func (g *GetChatBoostLinkRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatBoostLinkRequest) String() string { - if g == nil { - return "GetChatBoostLinkRequest(nil)" - } - type Alias GetChatBoostLinkRequest - return fmt.Sprintf("GetChatBoostLinkRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatBoostLinkRequest) TypeID() uint32 { - return GetChatBoostLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatBoostLinkRequest) TypeName() string { - return "getChatBoostLink" -} - -// TypeInfo returns info about TL type. -func (g *GetChatBoostLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatBoostLink", - ID: GetChatBoostLinkRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatBoostLinkRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostLink#56f16c85 as nil") - } - b.PutID(GetChatBoostLinkRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatBoostLinkRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostLink#56f16c85 as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatBoostLinkRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostLink#56f16c85 to nil") - } - if err := b.ConsumeID(GetChatBoostLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatBoostLink#56f16c85: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatBoostLinkRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostLink#56f16c85 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostLink#56f16c85: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatBoostLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostLink#56f16c85 as nil") - } - b.ObjStart() - b.PutID("getChatBoostLink") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatBoostLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostLink#56f16c85 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatBoostLink"); err != nil { - return fmt.Errorf("unable to decode getChatBoostLink#56f16c85: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostLink#56f16c85: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatBoostLinkRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChatBoostLink invokes method getChatBoostLink#56f16c85 returning error if any. -func (c *Client) GetChatBoostLink(ctx context.Context, chatid int64) (*ChatBoostLink, error) { - var result ChatBoostLink - - request := &GetChatBoostLinkRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_boost_link_info_gen.go b/tdapi/tl_get_chat_boost_link_info_gen.go deleted file mode 100644 index c326f2443..000000000 --- a/tdapi/tl_get_chat_boost_link_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatBoostLinkInfoRequest represents TL type `getChatBoostLinkInfo#26fc4b5c`. -type GetChatBoostLinkInfoRequest struct { - // The link to boost a chat - URL string -} - -// GetChatBoostLinkInfoRequestTypeID is TL type id of GetChatBoostLinkInfoRequest. -const GetChatBoostLinkInfoRequestTypeID = 0x26fc4b5c - -// Ensuring interfaces in compile-time for GetChatBoostLinkInfoRequest. -var ( - _ bin.Encoder = &GetChatBoostLinkInfoRequest{} - _ bin.Decoder = &GetChatBoostLinkInfoRequest{} - _ bin.BareEncoder = &GetChatBoostLinkInfoRequest{} - _ bin.BareDecoder = &GetChatBoostLinkInfoRequest{} -) - -func (g *GetChatBoostLinkInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatBoostLinkInfoRequest) String() string { - if g == nil { - return "GetChatBoostLinkInfoRequest(nil)" - } - type Alias GetChatBoostLinkInfoRequest - return fmt.Sprintf("GetChatBoostLinkInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatBoostLinkInfoRequest) TypeID() uint32 { - return GetChatBoostLinkInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatBoostLinkInfoRequest) TypeName() string { - return "getChatBoostLinkInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetChatBoostLinkInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatBoostLinkInfo", - ID: GetChatBoostLinkInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatBoostLinkInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostLinkInfo#26fc4b5c as nil") - } - b.PutID(GetChatBoostLinkInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatBoostLinkInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostLinkInfo#26fc4b5c as nil") - } - b.PutString(g.URL) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatBoostLinkInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostLinkInfo#26fc4b5c to nil") - } - if err := b.ConsumeID(GetChatBoostLinkInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatBoostLinkInfo#26fc4b5c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatBoostLinkInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostLinkInfo#26fc4b5c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostLinkInfo#26fc4b5c: field url: %w", err) - } - g.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatBoostLinkInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostLinkInfo#26fc4b5c as nil") - } - b.ObjStart() - b.PutID("getChatBoostLinkInfo") - b.Comma() - b.FieldStart("url") - b.PutString(g.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatBoostLinkInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostLinkInfo#26fc4b5c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatBoostLinkInfo"); err != nil { - return fmt.Errorf("unable to decode getChatBoostLinkInfo#26fc4b5c: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostLinkInfo#26fc4b5c: field url: %w", err) - } - g.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (g *GetChatBoostLinkInfoRequest) GetURL() (value string) { - if g == nil { - return - } - return g.URL -} - -// GetChatBoostLinkInfo invokes method getChatBoostLinkInfo#26fc4b5c returning error if any. -func (c *Client) GetChatBoostLinkInfo(ctx context.Context, url string) (*ChatBoostLinkInfo, error) { - var result ChatBoostLinkInfo - - request := &GetChatBoostLinkInfoRequest{ - URL: url, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_boost_status_gen.go b/tdapi/tl_get_chat_boost_status_gen.go deleted file mode 100644 index db0e4037e..000000000 --- a/tdapi/tl_get_chat_boost_status_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatBoostStatusRequest represents TL type `getChatBoostStatus#cfac8acf`. -type GetChatBoostStatusRequest struct { - // Identifier of the chat - ChatID int64 -} - -// GetChatBoostStatusRequestTypeID is TL type id of GetChatBoostStatusRequest. -const GetChatBoostStatusRequestTypeID = 0xcfac8acf - -// Ensuring interfaces in compile-time for GetChatBoostStatusRequest. -var ( - _ bin.Encoder = &GetChatBoostStatusRequest{} - _ bin.Decoder = &GetChatBoostStatusRequest{} - _ bin.BareEncoder = &GetChatBoostStatusRequest{} - _ bin.BareDecoder = &GetChatBoostStatusRequest{} -) - -func (g *GetChatBoostStatusRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatBoostStatusRequest) String() string { - if g == nil { - return "GetChatBoostStatusRequest(nil)" - } - type Alias GetChatBoostStatusRequest - return fmt.Sprintf("GetChatBoostStatusRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatBoostStatusRequest) TypeID() uint32 { - return GetChatBoostStatusRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatBoostStatusRequest) TypeName() string { - return "getChatBoostStatus" -} - -// TypeInfo returns info about TL type. -func (g *GetChatBoostStatusRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatBoostStatus", - ID: GetChatBoostStatusRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatBoostStatusRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostStatus#cfac8acf as nil") - } - b.PutID(GetChatBoostStatusRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatBoostStatusRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostStatus#cfac8acf as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatBoostStatusRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostStatus#cfac8acf to nil") - } - if err := b.ConsumeID(GetChatBoostStatusRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatBoostStatus#cfac8acf: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatBoostStatusRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostStatus#cfac8acf to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostStatus#cfac8acf: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatBoostStatusRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoostStatus#cfac8acf as nil") - } - b.ObjStart() - b.PutID("getChatBoostStatus") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatBoostStatusRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoostStatus#cfac8acf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatBoostStatus"); err != nil { - return fmt.Errorf("unable to decode getChatBoostStatus#cfac8acf: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatBoostStatus#cfac8acf: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatBoostStatusRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChatBoostStatus invokes method getChatBoostStatus#cfac8acf returning error if any. -func (c *Client) GetChatBoostStatus(ctx context.Context, chatid int64) (*ChatBoostStatus, error) { - var result ChatBoostStatus - - request := &GetChatBoostStatusRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_boosts_gen.go b/tdapi/tl_get_chat_boosts_gen.go deleted file mode 100644 index 58c781e2c..000000000 --- a/tdapi/tl_get_chat_boosts_gen.go +++ /dev/null @@ -1,308 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatBoostsRequest represents TL type `getChatBoosts#ab5eaa38`. -type GetChatBoostsRequest struct { - // Identifier of the chat - ChatID int64 - // Pass true to receive only boosts received from gift codes and giveaways created by the - // chat - OnlyGiftCodes bool - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of boosts to be returned; up to 100. For optimal performance, the - // number of returned boosts can be smaller than the specified limit - Limit int32 -} - -// GetChatBoostsRequestTypeID is TL type id of GetChatBoostsRequest. -const GetChatBoostsRequestTypeID = 0xab5eaa38 - -// Ensuring interfaces in compile-time for GetChatBoostsRequest. -var ( - _ bin.Encoder = &GetChatBoostsRequest{} - _ bin.Decoder = &GetChatBoostsRequest{} - _ bin.BareEncoder = &GetChatBoostsRequest{} - _ bin.BareDecoder = &GetChatBoostsRequest{} -) - -func (g *GetChatBoostsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.OnlyGiftCodes == false) { - return false - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatBoostsRequest) String() string { - if g == nil { - return "GetChatBoostsRequest(nil)" - } - type Alias GetChatBoostsRequest - return fmt.Sprintf("GetChatBoostsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatBoostsRequest) TypeID() uint32 { - return GetChatBoostsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatBoostsRequest) TypeName() string { - return "getChatBoosts" -} - -// TypeInfo returns info about TL type. -func (g *GetChatBoostsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatBoosts", - ID: GetChatBoostsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "OnlyGiftCodes", - SchemaName: "only_gift_codes", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatBoostsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoosts#ab5eaa38 as nil") - } - b.PutID(GetChatBoostsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatBoostsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoosts#ab5eaa38 as nil") - } - b.PutInt53(g.ChatID) - b.PutBool(g.OnlyGiftCodes) - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatBoostsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoosts#ab5eaa38 to nil") - } - if err := b.ConsumeID(GetChatBoostsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatBoosts#ab5eaa38: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatBoostsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoosts#ab5eaa38 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatBoosts#ab5eaa38: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatBoosts#ab5eaa38: field only_gift_codes: %w", err) - } - g.OnlyGiftCodes = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatBoosts#ab5eaa38: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatBoosts#ab5eaa38: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatBoostsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatBoosts#ab5eaa38 as nil") - } - b.ObjStart() - b.PutID("getChatBoosts") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("only_gift_codes") - b.PutBool(g.OnlyGiftCodes) - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatBoostsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatBoosts#ab5eaa38 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatBoosts"); err != nil { - return fmt.Errorf("unable to decode getChatBoosts#ab5eaa38: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatBoosts#ab5eaa38: field chat_id: %w", err) - } - g.ChatID = value - case "only_gift_codes": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatBoosts#ab5eaa38: field only_gift_codes: %w", err) - } - g.OnlyGiftCodes = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatBoosts#ab5eaa38: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatBoosts#ab5eaa38: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatBoostsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetOnlyGiftCodes returns value of OnlyGiftCodes field. -func (g *GetChatBoostsRequest) GetOnlyGiftCodes() (value bool) { - if g == nil { - return - } - return g.OnlyGiftCodes -} - -// GetOffset returns value of Offset field. -func (g *GetChatBoostsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetChatBoostsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChatBoosts invokes method getChatBoosts#ab5eaa38 returning error if any. -func (c *Client) GetChatBoosts(ctx context.Context, request *GetChatBoostsRequest) (*FoundChatBoosts, error) { - var result FoundChatBoosts - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_event_log_gen.go b/tdapi/tl_get_chat_event_log_gen.go deleted file mode 100644 index b536a5035..000000000 --- a/tdapi/tl_get_chat_event_log_gen.go +++ /dev/null @@ -1,399 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatEventLogRequest represents TL type `getChatEventLog#f47b0a9b`. -type GetChatEventLogRequest struct { - // Chat identifier - ChatID int64 - // Search query by which to filter events - Query string - // Identifier of an event from which to return results. Use 0 to get results from the - // latest events - FromEventID int64 - // The maximum number of events to return; up to 100 - Limit int32 - // The types of events to return; pass null to get chat events of all types - Filters ChatEventLogFilters - // User identifiers by which to filter events. By default, events relating to all users - // will be returned - UserIDs []int64 -} - -// GetChatEventLogRequestTypeID is TL type id of GetChatEventLogRequest. -const GetChatEventLogRequestTypeID = 0xf47b0a9b - -// Ensuring interfaces in compile-time for GetChatEventLogRequest. -var ( - _ bin.Encoder = &GetChatEventLogRequest{} - _ bin.Decoder = &GetChatEventLogRequest{} - _ bin.BareEncoder = &GetChatEventLogRequest{} - _ bin.BareDecoder = &GetChatEventLogRequest{} -) - -func (g *GetChatEventLogRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.Query == "") { - return false - } - if !(g.FromEventID == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - if !(g.Filters.Zero()) { - return false - } - if !(g.UserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatEventLogRequest) String() string { - if g == nil { - return "GetChatEventLogRequest(nil)" - } - type Alias GetChatEventLogRequest - return fmt.Sprintf("GetChatEventLogRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatEventLogRequest) TypeID() uint32 { - return GetChatEventLogRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatEventLogRequest) TypeName() string { - return "getChatEventLog" -} - -// TypeInfo returns info about TL type. -func (g *GetChatEventLogRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatEventLog", - ID: GetChatEventLogRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "FromEventID", - SchemaName: "from_event_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - { - Name: "Filters", - SchemaName: "filters", - }, - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatEventLogRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatEventLog#f47b0a9b as nil") - } - b.PutID(GetChatEventLogRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatEventLogRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatEventLog#f47b0a9b as nil") - } - b.PutInt53(g.ChatID) - b.PutString(g.Query) - b.PutLong(g.FromEventID) - b.PutInt32(g.Limit) - if err := g.Filters.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatEventLog#f47b0a9b: field filters: %w", err) - } - b.PutInt(len(g.UserIDs)) - for _, v := range g.UserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatEventLogRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatEventLog#f47b0a9b to nil") - } - if err := b.ConsumeID(GetChatEventLogRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatEventLogRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatEventLog#f47b0a9b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field query: %w", err) - } - g.Query = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field from_event_id: %w", err) - } - g.FromEventID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field limit: %w", err) - } - g.Limit = value - } - { - if err := g.Filters.Decode(b); err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field filters: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field user_ids: %w", err) - } - - if headerLen > 0 { - g.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field user_ids: %w", err) - } - g.UserIDs = append(g.UserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatEventLogRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatEventLog#f47b0a9b as nil") - } - b.ObjStart() - b.PutID("getChatEventLog") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("query") - b.PutString(g.Query) - b.Comma() - b.FieldStart("from_event_id") - b.PutLong(g.FromEventID) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.FieldStart("filters") - if err := g.Filters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatEventLog#f47b0a9b: field filters: %w", err) - } - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range g.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatEventLogRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatEventLog#f47b0a9b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatEventLog"); err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field chat_id: %w", err) - } - g.ChatID = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field query: %w", err) - } - g.Query = value - case "from_event_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field from_event_id: %w", err) - } - g.FromEventID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field limit: %w", err) - } - g.Limit = value - case "filters": - if err := g.Filters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field filters: %w", err) - } - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field user_ids: %w", err) - } - g.UserIDs = append(g.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode getChatEventLog#f47b0a9b: field user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatEventLogRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetQuery returns value of Query field. -func (g *GetChatEventLogRequest) GetQuery() (value string) { - if g == nil { - return - } - return g.Query -} - -// GetFromEventID returns value of FromEventID field. -func (g *GetChatEventLogRequest) GetFromEventID() (value int64) { - if g == nil { - return - } - return g.FromEventID -} - -// GetLimit returns value of Limit field. -func (g *GetChatEventLogRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetFilters returns value of Filters field. -func (g *GetChatEventLogRequest) GetFilters() (value ChatEventLogFilters) { - if g == nil { - return - } - return g.Filters -} - -// GetUserIDs returns value of UserIDs field. -func (g *GetChatEventLogRequest) GetUserIDs() (value []int64) { - if g == nil { - return - } - return g.UserIDs -} - -// GetChatEventLog invokes method getChatEventLog#f47b0a9b returning error if any. -func (c *Client) GetChatEventLog(ctx context.Context, request *GetChatEventLogRequest) (*ChatEvents, error) { - var result ChatEvents - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_folder_chat_count_gen.go b/tdapi/tl_get_chat_folder_chat_count_gen.go deleted file mode 100644 index ae4f8808d..000000000 --- a/tdapi/tl_get_chat_folder_chat_count_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatFolderChatCountRequest represents TL type `getChatFolderChatCount#7dd4cbbe`. -type GetChatFolderChatCountRequest struct { - // The new chat folder - Folder ChatFolder -} - -// GetChatFolderChatCountRequestTypeID is TL type id of GetChatFolderChatCountRequest. -const GetChatFolderChatCountRequestTypeID = 0x7dd4cbbe - -// Ensuring interfaces in compile-time for GetChatFolderChatCountRequest. -var ( - _ bin.Encoder = &GetChatFolderChatCountRequest{} - _ bin.Decoder = &GetChatFolderChatCountRequest{} - _ bin.BareEncoder = &GetChatFolderChatCountRequest{} - _ bin.BareDecoder = &GetChatFolderChatCountRequest{} -) - -func (g *GetChatFolderChatCountRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Folder.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatFolderChatCountRequest) String() string { - if g == nil { - return "GetChatFolderChatCountRequest(nil)" - } - type Alias GetChatFolderChatCountRequest - return fmt.Sprintf("GetChatFolderChatCountRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatFolderChatCountRequest) TypeID() uint32 { - return GetChatFolderChatCountRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatFolderChatCountRequest) TypeName() string { - return "getChatFolderChatCount" -} - -// TypeInfo returns info about TL type. -func (g *GetChatFolderChatCountRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatFolderChatCount", - ID: GetChatFolderChatCountRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Folder", - SchemaName: "folder", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatFolderChatCountRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderChatCount#7dd4cbbe as nil") - } - b.PutID(GetChatFolderChatCountRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatFolderChatCountRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderChatCount#7dd4cbbe as nil") - } - if err := g.Folder.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatFolderChatCount#7dd4cbbe: field folder: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatFolderChatCountRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderChatCount#7dd4cbbe to nil") - } - if err := b.ConsumeID(GetChatFolderChatCountRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatFolderChatCount#7dd4cbbe: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatFolderChatCountRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderChatCount#7dd4cbbe to nil") - } - { - if err := g.Folder.Decode(b); err != nil { - return fmt.Errorf("unable to decode getChatFolderChatCount#7dd4cbbe: field folder: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatFolderChatCountRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderChatCount#7dd4cbbe as nil") - } - b.ObjStart() - b.PutID("getChatFolderChatCount") - b.Comma() - b.FieldStart("folder") - if err := g.Folder.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatFolderChatCount#7dd4cbbe: field folder: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatFolderChatCountRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderChatCount#7dd4cbbe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatFolderChatCount"); err != nil { - return fmt.Errorf("unable to decode getChatFolderChatCount#7dd4cbbe: %w", err) - } - case "folder": - if err := g.Folder.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getChatFolderChatCount#7dd4cbbe: field folder: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFolder returns value of Folder field. -func (g *GetChatFolderChatCountRequest) GetFolder() (value ChatFolder) { - if g == nil { - return - } - return g.Folder -} - -// GetChatFolderChatCount invokes method getChatFolderChatCount#7dd4cbbe returning error if any. -func (c *Client) GetChatFolderChatCount(ctx context.Context, folder ChatFolder) (*Count, error) { - var result Count - - request := &GetChatFolderChatCountRequest{ - Folder: folder, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_folder_chats_to_leave_gen.go b/tdapi/tl_get_chat_folder_chats_to_leave_gen.go deleted file mode 100644 index 103a11e03..000000000 --- a/tdapi/tl_get_chat_folder_chats_to_leave_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatFolderChatsToLeaveRequest represents TL type `getChatFolderChatsToLeave#8dc1e6af`. -type GetChatFolderChatsToLeaveRequest struct { - // Chat folder identifier - ChatFolderID int32 -} - -// GetChatFolderChatsToLeaveRequestTypeID is TL type id of GetChatFolderChatsToLeaveRequest. -const GetChatFolderChatsToLeaveRequestTypeID = 0x8dc1e6af - -// Ensuring interfaces in compile-time for GetChatFolderChatsToLeaveRequest. -var ( - _ bin.Encoder = &GetChatFolderChatsToLeaveRequest{} - _ bin.Decoder = &GetChatFolderChatsToLeaveRequest{} - _ bin.BareEncoder = &GetChatFolderChatsToLeaveRequest{} - _ bin.BareDecoder = &GetChatFolderChatsToLeaveRequest{} -) - -func (g *GetChatFolderChatsToLeaveRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatFolderID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatFolderChatsToLeaveRequest) String() string { - if g == nil { - return "GetChatFolderChatsToLeaveRequest(nil)" - } - type Alias GetChatFolderChatsToLeaveRequest - return fmt.Sprintf("GetChatFolderChatsToLeaveRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatFolderChatsToLeaveRequest) TypeID() uint32 { - return GetChatFolderChatsToLeaveRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatFolderChatsToLeaveRequest) TypeName() string { - return "getChatFolderChatsToLeave" -} - -// TypeInfo returns info about TL type. -func (g *GetChatFolderChatsToLeaveRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatFolderChatsToLeave", - ID: GetChatFolderChatsToLeaveRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatFolderChatsToLeaveRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderChatsToLeave#8dc1e6af as nil") - } - b.PutID(GetChatFolderChatsToLeaveRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatFolderChatsToLeaveRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderChatsToLeave#8dc1e6af as nil") - } - b.PutInt32(g.ChatFolderID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatFolderChatsToLeaveRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderChatsToLeave#8dc1e6af to nil") - } - if err := b.ConsumeID(GetChatFolderChatsToLeaveRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatFolderChatsToLeave#8dc1e6af: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatFolderChatsToLeaveRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderChatsToLeave#8dc1e6af to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatFolderChatsToLeave#8dc1e6af: field chat_folder_id: %w", err) - } - g.ChatFolderID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatFolderChatsToLeaveRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderChatsToLeave#8dc1e6af as nil") - } - b.ObjStart() - b.PutID("getChatFolderChatsToLeave") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(g.ChatFolderID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatFolderChatsToLeaveRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderChatsToLeave#8dc1e6af to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatFolderChatsToLeave"); err != nil { - return fmt.Errorf("unable to decode getChatFolderChatsToLeave#8dc1e6af: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatFolderChatsToLeave#8dc1e6af: field chat_folder_id: %w", err) - } - g.ChatFolderID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (g *GetChatFolderChatsToLeaveRequest) GetChatFolderID() (value int32) { - if g == nil { - return - } - return g.ChatFolderID -} - -// GetChatFolderChatsToLeave invokes method getChatFolderChatsToLeave#8dc1e6af returning error if any. -func (c *Client) GetChatFolderChatsToLeave(ctx context.Context, chatfolderid int32) (*Chats, error) { - var result Chats - - request := &GetChatFolderChatsToLeaveRequest{ - ChatFolderID: chatfolderid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_folder_default_icon_name_gen.go b/tdapi/tl_get_chat_folder_default_icon_name_gen.go deleted file mode 100644 index 4ab540382..000000000 --- a/tdapi/tl_get_chat_folder_default_icon_name_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatFolderDefaultIconNameRequest represents TL type `getChatFolderDefaultIconName#2cf7a067`. -type GetChatFolderDefaultIconNameRequest struct { - // Chat folder - Folder ChatFolder -} - -// GetChatFolderDefaultIconNameRequestTypeID is TL type id of GetChatFolderDefaultIconNameRequest. -const GetChatFolderDefaultIconNameRequestTypeID = 0x2cf7a067 - -// Ensuring interfaces in compile-time for GetChatFolderDefaultIconNameRequest. -var ( - _ bin.Encoder = &GetChatFolderDefaultIconNameRequest{} - _ bin.Decoder = &GetChatFolderDefaultIconNameRequest{} - _ bin.BareEncoder = &GetChatFolderDefaultIconNameRequest{} - _ bin.BareDecoder = &GetChatFolderDefaultIconNameRequest{} -) - -func (g *GetChatFolderDefaultIconNameRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Folder.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatFolderDefaultIconNameRequest) String() string { - if g == nil { - return "GetChatFolderDefaultIconNameRequest(nil)" - } - type Alias GetChatFolderDefaultIconNameRequest - return fmt.Sprintf("GetChatFolderDefaultIconNameRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatFolderDefaultIconNameRequest) TypeID() uint32 { - return GetChatFolderDefaultIconNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatFolderDefaultIconNameRequest) TypeName() string { - return "getChatFolderDefaultIconName" -} - -// TypeInfo returns info about TL type. -func (g *GetChatFolderDefaultIconNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatFolderDefaultIconName", - ID: GetChatFolderDefaultIconNameRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Folder", - SchemaName: "folder", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatFolderDefaultIconNameRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderDefaultIconName#2cf7a067 as nil") - } - b.PutID(GetChatFolderDefaultIconNameRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatFolderDefaultIconNameRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderDefaultIconName#2cf7a067 as nil") - } - if err := g.Folder.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatFolderDefaultIconName#2cf7a067: field folder: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatFolderDefaultIconNameRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderDefaultIconName#2cf7a067 to nil") - } - if err := b.ConsumeID(GetChatFolderDefaultIconNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatFolderDefaultIconName#2cf7a067: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatFolderDefaultIconNameRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderDefaultIconName#2cf7a067 to nil") - } - { - if err := g.Folder.Decode(b); err != nil { - return fmt.Errorf("unable to decode getChatFolderDefaultIconName#2cf7a067: field folder: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatFolderDefaultIconNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderDefaultIconName#2cf7a067 as nil") - } - b.ObjStart() - b.PutID("getChatFolderDefaultIconName") - b.Comma() - b.FieldStart("folder") - if err := g.Folder.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatFolderDefaultIconName#2cf7a067: field folder: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatFolderDefaultIconNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderDefaultIconName#2cf7a067 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatFolderDefaultIconName"); err != nil { - return fmt.Errorf("unable to decode getChatFolderDefaultIconName#2cf7a067: %w", err) - } - case "folder": - if err := g.Folder.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getChatFolderDefaultIconName#2cf7a067: field folder: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFolder returns value of Folder field. -func (g *GetChatFolderDefaultIconNameRequest) GetFolder() (value ChatFolder) { - if g == nil { - return - } - return g.Folder -} - -// GetChatFolderDefaultIconName invokes method getChatFolderDefaultIconName#2cf7a067 returning error if any. -func (c *Client) GetChatFolderDefaultIconName(ctx context.Context, folder ChatFolder) (*ChatFolderIcon, error) { - var result ChatFolderIcon - - request := &GetChatFolderDefaultIconNameRequest{ - Folder: folder, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_folder_gen.go b/tdapi/tl_get_chat_folder_gen.go deleted file mode 100644 index a1d97e963..000000000 --- a/tdapi/tl_get_chat_folder_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatFolderRequest represents TL type `getChatFolder#5882a98`. -type GetChatFolderRequest struct { - // Chat folder identifier - ChatFolderID int32 -} - -// GetChatFolderRequestTypeID is TL type id of GetChatFolderRequest. -const GetChatFolderRequestTypeID = 0x5882a98 - -// Ensuring interfaces in compile-time for GetChatFolderRequest. -var ( - _ bin.Encoder = &GetChatFolderRequest{} - _ bin.Decoder = &GetChatFolderRequest{} - _ bin.BareEncoder = &GetChatFolderRequest{} - _ bin.BareDecoder = &GetChatFolderRequest{} -) - -func (g *GetChatFolderRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatFolderID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatFolderRequest) String() string { - if g == nil { - return "GetChatFolderRequest(nil)" - } - type Alias GetChatFolderRequest - return fmt.Sprintf("GetChatFolderRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatFolderRequest) TypeID() uint32 { - return GetChatFolderRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatFolderRequest) TypeName() string { - return "getChatFolder" -} - -// TypeInfo returns info about TL type. -func (g *GetChatFolderRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatFolder", - ID: GetChatFolderRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatFolderRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolder#5882a98 as nil") - } - b.PutID(GetChatFolderRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatFolderRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolder#5882a98 as nil") - } - b.PutInt32(g.ChatFolderID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatFolderRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolder#5882a98 to nil") - } - if err := b.ConsumeID(GetChatFolderRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatFolder#5882a98: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatFolderRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolder#5882a98 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatFolder#5882a98: field chat_folder_id: %w", err) - } - g.ChatFolderID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatFolderRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolder#5882a98 as nil") - } - b.ObjStart() - b.PutID("getChatFolder") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(g.ChatFolderID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatFolderRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolder#5882a98 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatFolder"); err != nil { - return fmt.Errorf("unable to decode getChatFolder#5882a98: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatFolder#5882a98: field chat_folder_id: %w", err) - } - g.ChatFolderID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (g *GetChatFolderRequest) GetChatFolderID() (value int32) { - if g == nil { - return - } - return g.ChatFolderID -} - -// GetChatFolder invokes method getChatFolder#5882a98 returning error if any. -func (c *Client) GetChatFolder(ctx context.Context, chatfolderid int32) (*ChatFolder, error) { - var result ChatFolder - - request := &GetChatFolderRequest{ - ChatFolderID: chatfolderid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_folder_invite_links_gen.go b/tdapi/tl_get_chat_folder_invite_links_gen.go deleted file mode 100644 index fbdc5f985..000000000 --- a/tdapi/tl_get_chat_folder_invite_links_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatFolderInviteLinksRequest represents TL type `getChatFolderInviteLinks#139d5be0`. -type GetChatFolderInviteLinksRequest struct { - // Chat folder identifier - ChatFolderID int32 -} - -// GetChatFolderInviteLinksRequestTypeID is TL type id of GetChatFolderInviteLinksRequest. -const GetChatFolderInviteLinksRequestTypeID = 0x139d5be0 - -// Ensuring interfaces in compile-time for GetChatFolderInviteLinksRequest. -var ( - _ bin.Encoder = &GetChatFolderInviteLinksRequest{} - _ bin.Decoder = &GetChatFolderInviteLinksRequest{} - _ bin.BareEncoder = &GetChatFolderInviteLinksRequest{} - _ bin.BareDecoder = &GetChatFolderInviteLinksRequest{} -) - -func (g *GetChatFolderInviteLinksRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatFolderID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatFolderInviteLinksRequest) String() string { - if g == nil { - return "GetChatFolderInviteLinksRequest(nil)" - } - type Alias GetChatFolderInviteLinksRequest - return fmt.Sprintf("GetChatFolderInviteLinksRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatFolderInviteLinksRequest) TypeID() uint32 { - return GetChatFolderInviteLinksRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatFolderInviteLinksRequest) TypeName() string { - return "getChatFolderInviteLinks" -} - -// TypeInfo returns info about TL type. -func (g *GetChatFolderInviteLinksRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatFolderInviteLinks", - ID: GetChatFolderInviteLinksRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatFolderInviteLinksRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderInviteLinks#139d5be0 as nil") - } - b.PutID(GetChatFolderInviteLinksRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatFolderInviteLinksRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderInviteLinks#139d5be0 as nil") - } - b.PutInt32(g.ChatFolderID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatFolderInviteLinksRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderInviteLinks#139d5be0 to nil") - } - if err := b.ConsumeID(GetChatFolderInviteLinksRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatFolderInviteLinks#139d5be0: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatFolderInviteLinksRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderInviteLinks#139d5be0 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatFolderInviteLinks#139d5be0: field chat_folder_id: %w", err) - } - g.ChatFolderID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatFolderInviteLinksRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderInviteLinks#139d5be0 as nil") - } - b.ObjStart() - b.PutID("getChatFolderInviteLinks") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(g.ChatFolderID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatFolderInviteLinksRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderInviteLinks#139d5be0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatFolderInviteLinks"); err != nil { - return fmt.Errorf("unable to decode getChatFolderInviteLinks#139d5be0: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatFolderInviteLinks#139d5be0: field chat_folder_id: %w", err) - } - g.ChatFolderID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (g *GetChatFolderInviteLinksRequest) GetChatFolderID() (value int32) { - if g == nil { - return - } - return g.ChatFolderID -} - -// GetChatFolderInviteLinks invokes method getChatFolderInviteLinks#139d5be0 returning error if any. -func (c *Client) GetChatFolderInviteLinks(ctx context.Context, chatfolderid int32) (*ChatFolderInviteLinks, error) { - var result ChatFolderInviteLinks - - request := &GetChatFolderInviteLinksRequest{ - ChatFolderID: chatfolderid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_folder_new_chats_gen.go b/tdapi/tl_get_chat_folder_new_chats_gen.go deleted file mode 100644 index 35abf6b4e..000000000 --- a/tdapi/tl_get_chat_folder_new_chats_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatFolderNewChatsRequest represents TL type `getChatFolderNewChats#7e8d2ccc`. -type GetChatFolderNewChatsRequest struct { - // Chat folder identifier - ChatFolderID int32 -} - -// GetChatFolderNewChatsRequestTypeID is TL type id of GetChatFolderNewChatsRequest. -const GetChatFolderNewChatsRequestTypeID = 0x7e8d2ccc - -// Ensuring interfaces in compile-time for GetChatFolderNewChatsRequest. -var ( - _ bin.Encoder = &GetChatFolderNewChatsRequest{} - _ bin.Decoder = &GetChatFolderNewChatsRequest{} - _ bin.BareEncoder = &GetChatFolderNewChatsRequest{} - _ bin.BareDecoder = &GetChatFolderNewChatsRequest{} -) - -func (g *GetChatFolderNewChatsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatFolderID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatFolderNewChatsRequest) String() string { - if g == nil { - return "GetChatFolderNewChatsRequest(nil)" - } - type Alias GetChatFolderNewChatsRequest - return fmt.Sprintf("GetChatFolderNewChatsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatFolderNewChatsRequest) TypeID() uint32 { - return GetChatFolderNewChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatFolderNewChatsRequest) TypeName() string { - return "getChatFolderNewChats" -} - -// TypeInfo returns info about TL type. -func (g *GetChatFolderNewChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatFolderNewChats", - ID: GetChatFolderNewChatsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatFolderNewChatsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderNewChats#7e8d2ccc as nil") - } - b.PutID(GetChatFolderNewChatsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatFolderNewChatsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderNewChats#7e8d2ccc as nil") - } - b.PutInt32(g.ChatFolderID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatFolderNewChatsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderNewChats#7e8d2ccc to nil") - } - if err := b.ConsumeID(GetChatFolderNewChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatFolderNewChats#7e8d2ccc: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatFolderNewChatsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderNewChats#7e8d2ccc to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatFolderNewChats#7e8d2ccc: field chat_folder_id: %w", err) - } - g.ChatFolderID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatFolderNewChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatFolderNewChats#7e8d2ccc as nil") - } - b.ObjStart() - b.PutID("getChatFolderNewChats") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(g.ChatFolderID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatFolderNewChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatFolderNewChats#7e8d2ccc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatFolderNewChats"); err != nil { - return fmt.Errorf("unable to decode getChatFolderNewChats#7e8d2ccc: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatFolderNewChats#7e8d2ccc: field chat_folder_id: %w", err) - } - g.ChatFolderID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (g *GetChatFolderNewChatsRequest) GetChatFolderID() (value int32) { - if g == nil { - return - } - return g.ChatFolderID -} - -// GetChatFolderNewChats invokes method getChatFolderNewChats#7e8d2ccc returning error if any. -func (c *Client) GetChatFolderNewChats(ctx context.Context, chatfolderid int32) (*Chats, error) { - var result Chats - - request := &GetChatFolderNewChatsRequest{ - ChatFolderID: chatfolderid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_gen.go b/tdapi/tl_get_chat_gen.go deleted file mode 100644 index 747668709..000000000 --- a/tdapi/tl_get_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatRequest represents TL type `getChat#6f421440`. -type GetChatRequest struct { - // Chat identifier - ChatID int64 -} - -// GetChatRequestTypeID is TL type id of GetChatRequest. -const GetChatRequestTypeID = 0x6f421440 - -// Ensuring interfaces in compile-time for GetChatRequest. -var ( - _ bin.Encoder = &GetChatRequest{} - _ bin.Decoder = &GetChatRequest{} - _ bin.BareEncoder = &GetChatRequest{} - _ bin.BareDecoder = &GetChatRequest{} -) - -func (g *GetChatRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatRequest) String() string { - if g == nil { - return "GetChatRequest(nil)" - } - type Alias GetChatRequest - return fmt.Sprintf("GetChatRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatRequest) TypeID() uint32 { - return GetChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatRequest) TypeName() string { - return "getChat" -} - -// TypeInfo returns info about TL type. -func (g *GetChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChat", - ID: GetChatRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChat#6f421440 as nil") - } - b.PutID(GetChatRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChat#6f421440 as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChat#6f421440 to nil") - } - if err := b.ConsumeID(GetChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChat#6f421440: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChat#6f421440 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChat#6f421440: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChat#6f421440 as nil") - } - b.ObjStart() - b.PutID("getChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChat#6f421440 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChat"); err != nil { - return fmt.Errorf("unable to decode getChat#6f421440: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChat#6f421440: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChat invokes method getChat#6f421440 returning error if any. -func (c *Client) GetChat(ctx context.Context, chatid int64) (*Chat, error) { - var result Chat - - request := &GetChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_history_gen.go b/tdapi/tl_get_chat_history_gen.go deleted file mode 100644 index 4a7c6ecd5..000000000 --- a/tdapi/tl_get_chat_history_gen.go +++ /dev/null @@ -1,343 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatHistoryRequest represents TL type `getChatHistory#d051927d`. -type GetChatHistoryRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the message starting from which history must be fetched; use 0 to get - // results from the last message - FromMessageID int64 - // Specify 0 to get results from exactly the message from_message_id or a negative offset - // up to 99 to get additionally some newer messages - Offset int32 - // The maximum number of messages to be returned; must be positive and can't be greater - // than 100. If the offset is negative, the limit must be greater than or equal to - // -offset. - Limit int32 - // Pass true to get only messages that are available without sending network requests - OnlyLocal bool -} - -// GetChatHistoryRequestTypeID is TL type id of GetChatHistoryRequest. -const GetChatHistoryRequestTypeID = 0xd051927d - -// Ensuring interfaces in compile-time for GetChatHistoryRequest. -var ( - _ bin.Encoder = &GetChatHistoryRequest{} - _ bin.Decoder = &GetChatHistoryRequest{} - _ bin.BareEncoder = &GetChatHistoryRequest{} - _ bin.BareDecoder = &GetChatHistoryRequest{} -) - -func (g *GetChatHistoryRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.FromMessageID == 0) { - return false - } - if !(g.Offset == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - if !(g.OnlyLocal == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatHistoryRequest) String() string { - if g == nil { - return "GetChatHistoryRequest(nil)" - } - type Alias GetChatHistoryRequest - return fmt.Sprintf("GetChatHistoryRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatHistoryRequest) TypeID() uint32 { - return GetChatHistoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatHistoryRequest) TypeName() string { - return "getChatHistory" -} - -// TypeInfo returns info about TL type. -func (g *GetChatHistoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatHistory", - ID: GetChatHistoryRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "FromMessageID", - SchemaName: "from_message_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - { - Name: "OnlyLocal", - SchemaName: "only_local", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatHistoryRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatHistory#d051927d as nil") - } - b.PutID(GetChatHistoryRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatHistoryRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatHistory#d051927d as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.FromMessageID) - b.PutInt32(g.Offset) - b.PutInt32(g.Limit) - b.PutBool(g.OnlyLocal) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatHistoryRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatHistory#d051927d to nil") - } - if err := b.ConsumeID(GetChatHistoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatHistoryRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatHistory#d051927d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: field from_message_id: %w", err) - } - g.FromMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: field limit: %w", err) - } - g.Limit = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: field only_local: %w", err) - } - g.OnlyLocal = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatHistoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatHistory#d051927d as nil") - } - b.ObjStart() - b.PutID("getChatHistory") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("from_message_id") - b.PutInt53(g.FromMessageID) - b.Comma() - b.FieldStart("offset") - b.PutInt32(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.FieldStart("only_local") - b.PutBool(g.OnlyLocal) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatHistoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatHistory#d051927d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatHistory"); err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: field chat_id: %w", err) - } - g.ChatID = value - case "from_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: field from_message_id: %w", err) - } - g.FromMessageID = value - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: field limit: %w", err) - } - g.Limit = value - case "only_local": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatHistory#d051927d: field only_local: %w", err) - } - g.OnlyLocal = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatHistoryRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetFromMessageID returns value of FromMessageID field. -func (g *GetChatHistoryRequest) GetFromMessageID() (value int64) { - if g == nil { - return - } - return g.FromMessageID -} - -// GetOffset returns value of Offset field. -func (g *GetChatHistoryRequest) GetOffset() (value int32) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetChatHistoryRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetOnlyLocal returns value of OnlyLocal field. -func (g *GetChatHistoryRequest) GetOnlyLocal() (value bool) { - if g == nil { - return - } - return g.OnlyLocal -} - -// GetChatHistory invokes method getChatHistory#d051927d returning error if any. -func (c *Client) GetChatHistory(ctx context.Context, request *GetChatHistoryRequest) (*Messages, error) { - var result Messages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_invite_link_counts_gen.go b/tdapi/tl_get_chat_invite_link_counts_gen.go deleted file mode 100644 index fc87c13b2..000000000 --- a/tdapi/tl_get_chat_invite_link_counts_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatInviteLinkCountsRequest represents TL type `getChatInviteLinkCounts#3510e291`. -type GetChatInviteLinkCountsRequest struct { - // Chat identifier - ChatID int64 -} - -// GetChatInviteLinkCountsRequestTypeID is TL type id of GetChatInviteLinkCountsRequest. -const GetChatInviteLinkCountsRequestTypeID = 0x3510e291 - -// Ensuring interfaces in compile-time for GetChatInviteLinkCountsRequest. -var ( - _ bin.Encoder = &GetChatInviteLinkCountsRequest{} - _ bin.Decoder = &GetChatInviteLinkCountsRequest{} - _ bin.BareEncoder = &GetChatInviteLinkCountsRequest{} - _ bin.BareDecoder = &GetChatInviteLinkCountsRequest{} -) - -func (g *GetChatInviteLinkCountsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatInviteLinkCountsRequest) String() string { - if g == nil { - return "GetChatInviteLinkCountsRequest(nil)" - } - type Alias GetChatInviteLinkCountsRequest - return fmt.Sprintf("GetChatInviteLinkCountsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatInviteLinkCountsRequest) TypeID() uint32 { - return GetChatInviteLinkCountsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatInviteLinkCountsRequest) TypeName() string { - return "getChatInviteLinkCounts" -} - -// TypeInfo returns info about TL type. -func (g *GetChatInviteLinkCountsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatInviteLinkCounts", - ID: GetChatInviteLinkCountsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatInviteLinkCountsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLinkCounts#3510e291 as nil") - } - b.PutID(GetChatInviteLinkCountsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatInviteLinkCountsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLinkCounts#3510e291 as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatInviteLinkCountsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLinkCounts#3510e291 to nil") - } - if err := b.ConsumeID(GetChatInviteLinkCountsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkCounts#3510e291: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatInviteLinkCountsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLinkCounts#3510e291 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkCounts#3510e291: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatInviteLinkCountsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLinkCounts#3510e291 as nil") - } - b.ObjStart() - b.PutID("getChatInviteLinkCounts") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatInviteLinkCountsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLinkCounts#3510e291 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatInviteLinkCounts"); err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkCounts#3510e291: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkCounts#3510e291: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatInviteLinkCountsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChatInviteLinkCounts invokes method getChatInviteLinkCounts#3510e291 returning error if any. -func (c *Client) GetChatInviteLinkCounts(ctx context.Context, chatid int64) (*ChatInviteLinkCounts, error) { - var result ChatInviteLinkCounts - - request := &GetChatInviteLinkCountsRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_invite_link_gen.go b/tdapi/tl_get_chat_invite_link_gen.go deleted file mode 100644 index cd94c08b1..000000000 --- a/tdapi/tl_get_chat_invite_link_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatInviteLinkRequest represents TL type `getChatInviteLink#e36a41fd`. -type GetChatInviteLinkRequest struct { - // Chat identifier - ChatID int64 - // Invite link to get - InviteLink string -} - -// GetChatInviteLinkRequestTypeID is TL type id of GetChatInviteLinkRequest. -const GetChatInviteLinkRequestTypeID = 0xe36a41fd - -// Ensuring interfaces in compile-time for GetChatInviteLinkRequest. -var ( - _ bin.Encoder = &GetChatInviteLinkRequest{} - _ bin.Decoder = &GetChatInviteLinkRequest{} - _ bin.BareEncoder = &GetChatInviteLinkRequest{} - _ bin.BareDecoder = &GetChatInviteLinkRequest{} -) - -func (g *GetChatInviteLinkRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatInviteLinkRequest) String() string { - if g == nil { - return "GetChatInviteLinkRequest(nil)" - } - type Alias GetChatInviteLinkRequest - return fmt.Sprintf("GetChatInviteLinkRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatInviteLinkRequest) TypeID() uint32 { - return GetChatInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatInviteLinkRequest) TypeName() string { - return "getChatInviteLink" -} - -// TypeInfo returns info about TL type. -func (g *GetChatInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatInviteLink", - ID: GetChatInviteLinkRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatInviteLinkRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLink#e36a41fd as nil") - } - b.PutID(GetChatInviteLinkRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLink#e36a41fd as nil") - } - b.PutInt53(g.ChatID) - b.PutString(g.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatInviteLinkRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLink#e36a41fd to nil") - } - if err := b.ConsumeID(GetChatInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatInviteLink#e36a41fd: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLink#e36a41fd to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLink#e36a41fd: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLink#e36a41fd: field invite_link: %w", err) - } - g.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLink#e36a41fd as nil") - } - b.ObjStart() - b.PutID("getChatInviteLink") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("invite_link") - b.PutString(g.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLink#e36a41fd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatInviteLink"); err != nil { - return fmt.Errorf("unable to decode getChatInviteLink#e36a41fd: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLink#e36a41fd: field chat_id: %w", err) - } - g.ChatID = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLink#e36a41fd: field invite_link: %w", err) - } - g.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatInviteLinkRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetInviteLink returns value of InviteLink field. -func (g *GetChatInviteLinkRequest) GetInviteLink() (value string) { - if g == nil { - return - } - return g.InviteLink -} - -// GetChatInviteLink invokes method getChatInviteLink#e36a41fd returning error if any. -func (c *Client) GetChatInviteLink(ctx context.Context, request *GetChatInviteLinkRequest) (*ChatInviteLink, error) { - var result ChatInviteLink - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_invite_link_members_gen.go b/tdapi/tl_get_chat_invite_link_members_gen.go deleted file mode 100644 index 4ee2ac6c4..000000000 --- a/tdapi/tl_get_chat_invite_link_members_gen.go +++ /dev/null @@ -1,341 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatInviteLinkMembersRequest represents TL type `getChatInviteLinkMembers#6704ed3c`. -type GetChatInviteLinkMembersRequest struct { - // Chat identifier - ChatID int64 - // Invite link for which to return chat members - InviteLink string - // Pass true if the link is a subscription link and only members with expired - // subscription must be returned - OnlyWithExpiredSubscription bool - // A chat member from which to return next chat members; pass null to get results from - // the beginning - OffsetMember ChatInviteLinkMember - // The maximum number of chat members to return; up to 100 - Limit int32 -} - -// GetChatInviteLinkMembersRequestTypeID is TL type id of GetChatInviteLinkMembersRequest. -const GetChatInviteLinkMembersRequestTypeID = 0x6704ed3c - -// Ensuring interfaces in compile-time for GetChatInviteLinkMembersRequest. -var ( - _ bin.Encoder = &GetChatInviteLinkMembersRequest{} - _ bin.Decoder = &GetChatInviteLinkMembersRequest{} - _ bin.BareEncoder = &GetChatInviteLinkMembersRequest{} - _ bin.BareDecoder = &GetChatInviteLinkMembersRequest{} -) - -func (g *GetChatInviteLinkMembersRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.InviteLink == "") { - return false - } - if !(g.OnlyWithExpiredSubscription == false) { - return false - } - if !(g.OffsetMember.Zero()) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatInviteLinkMembersRequest) String() string { - if g == nil { - return "GetChatInviteLinkMembersRequest(nil)" - } - type Alias GetChatInviteLinkMembersRequest - return fmt.Sprintf("GetChatInviteLinkMembersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatInviteLinkMembersRequest) TypeID() uint32 { - return GetChatInviteLinkMembersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatInviteLinkMembersRequest) TypeName() string { - return "getChatInviteLinkMembers" -} - -// TypeInfo returns info about TL type. -func (g *GetChatInviteLinkMembersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatInviteLinkMembers", - ID: GetChatInviteLinkMembersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "OnlyWithExpiredSubscription", - SchemaName: "only_with_expired_subscription", - }, - { - Name: "OffsetMember", - SchemaName: "offset_member", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatInviteLinkMembersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLinkMembers#6704ed3c as nil") - } - b.PutID(GetChatInviteLinkMembersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatInviteLinkMembersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLinkMembers#6704ed3c as nil") - } - b.PutInt53(g.ChatID) - b.PutString(g.InviteLink) - b.PutBool(g.OnlyWithExpiredSubscription) - if err := g.OffsetMember.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatInviteLinkMembers#6704ed3c: field offset_member: %w", err) - } - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatInviteLinkMembersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLinkMembers#6704ed3c to nil") - } - if err := b.ConsumeID(GetChatInviteLinkMembersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatInviteLinkMembersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLinkMembers#6704ed3c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: field invite_link: %w", err) - } - g.InviteLink = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: field only_with_expired_subscription: %w", err) - } - g.OnlyWithExpiredSubscription = value - } - { - if err := g.OffsetMember.Decode(b); err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: field offset_member: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatInviteLinkMembersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLinkMembers#6704ed3c as nil") - } - b.ObjStart() - b.PutID("getChatInviteLinkMembers") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("invite_link") - b.PutString(g.InviteLink) - b.Comma() - b.FieldStart("only_with_expired_subscription") - b.PutBool(g.OnlyWithExpiredSubscription) - b.Comma() - b.FieldStart("offset_member") - if err := g.OffsetMember.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatInviteLinkMembers#6704ed3c: field offset_member: %w", err) - } - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatInviteLinkMembersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLinkMembers#6704ed3c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatInviteLinkMembers"); err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: field chat_id: %w", err) - } - g.ChatID = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: field invite_link: %w", err) - } - g.InviteLink = value - case "only_with_expired_subscription": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: field only_with_expired_subscription: %w", err) - } - g.OnlyWithExpiredSubscription = value - case "offset_member": - if err := g.OffsetMember.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: field offset_member: %w", err) - } - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinkMembers#6704ed3c: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatInviteLinkMembersRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetInviteLink returns value of InviteLink field. -func (g *GetChatInviteLinkMembersRequest) GetInviteLink() (value string) { - if g == nil { - return - } - return g.InviteLink -} - -// GetOnlyWithExpiredSubscription returns value of OnlyWithExpiredSubscription field. -func (g *GetChatInviteLinkMembersRequest) GetOnlyWithExpiredSubscription() (value bool) { - if g == nil { - return - } - return g.OnlyWithExpiredSubscription -} - -// GetOffsetMember returns value of OffsetMember field. -func (g *GetChatInviteLinkMembersRequest) GetOffsetMember() (value ChatInviteLinkMember) { - if g == nil { - return - } - return g.OffsetMember -} - -// GetLimit returns value of Limit field. -func (g *GetChatInviteLinkMembersRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChatInviteLinkMembers invokes method getChatInviteLinkMembers#6704ed3c returning error if any. -func (c *Client) GetChatInviteLinkMembers(ctx context.Context, request *GetChatInviteLinkMembersRequest) (*ChatInviteLinkMembers, error) { - var result ChatInviteLinkMembers - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_invite_links_gen.go b/tdapi/tl_get_chat_invite_links_gen.go deleted file mode 100644 index c111870ae..000000000 --- a/tdapi/tl_get_chat_invite_links_gen.go +++ /dev/null @@ -1,376 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatInviteLinksRequest represents TL type `getChatInviteLinks#34a55cac`. -type GetChatInviteLinksRequest struct { - // Chat identifier - ChatID int64 - // User identifier of a chat administrator. Must be an identifier of the current user for - // non-owner - CreatorUserID int64 - // Pass true if revoked links needs to be returned instead of active or expired - IsRevoked bool - // Creation date of an invite link starting after which to return invite links; use 0 to - // get results from the beginning - OffsetDate int32 - // Invite link starting after which to return invite links; use empty string to get - // results from the beginning - OffsetInviteLink string - // The maximum number of invite links to return; up to 100 - Limit int32 -} - -// GetChatInviteLinksRequestTypeID is TL type id of GetChatInviteLinksRequest. -const GetChatInviteLinksRequestTypeID = 0x34a55cac - -// Ensuring interfaces in compile-time for GetChatInviteLinksRequest. -var ( - _ bin.Encoder = &GetChatInviteLinksRequest{} - _ bin.Decoder = &GetChatInviteLinksRequest{} - _ bin.BareEncoder = &GetChatInviteLinksRequest{} - _ bin.BareDecoder = &GetChatInviteLinksRequest{} -) - -func (g *GetChatInviteLinksRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.CreatorUserID == 0) { - return false - } - if !(g.IsRevoked == false) { - return false - } - if !(g.OffsetDate == 0) { - return false - } - if !(g.OffsetInviteLink == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatInviteLinksRequest) String() string { - if g == nil { - return "GetChatInviteLinksRequest(nil)" - } - type Alias GetChatInviteLinksRequest - return fmt.Sprintf("GetChatInviteLinksRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatInviteLinksRequest) TypeID() uint32 { - return GetChatInviteLinksRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatInviteLinksRequest) TypeName() string { - return "getChatInviteLinks" -} - -// TypeInfo returns info about TL type. -func (g *GetChatInviteLinksRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatInviteLinks", - ID: GetChatInviteLinksRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "CreatorUserID", - SchemaName: "creator_user_id", - }, - { - Name: "IsRevoked", - SchemaName: "is_revoked", - }, - { - Name: "OffsetDate", - SchemaName: "offset_date", - }, - { - Name: "OffsetInviteLink", - SchemaName: "offset_invite_link", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatInviteLinksRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLinks#34a55cac as nil") - } - b.PutID(GetChatInviteLinksRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatInviteLinksRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLinks#34a55cac as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.CreatorUserID) - b.PutBool(g.IsRevoked) - b.PutInt32(g.OffsetDate) - b.PutString(g.OffsetInviteLink) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatInviteLinksRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLinks#34a55cac to nil") - } - if err := b.ConsumeID(GetChatInviteLinksRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatInviteLinksRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLinks#34a55cac to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field creator_user_id: %w", err) - } - g.CreatorUserID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field is_revoked: %w", err) - } - g.IsRevoked = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field offset_date: %w", err) - } - g.OffsetDate = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field offset_invite_link: %w", err) - } - g.OffsetInviteLink = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatInviteLinksRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatInviteLinks#34a55cac as nil") - } - b.ObjStart() - b.PutID("getChatInviteLinks") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("creator_user_id") - b.PutInt53(g.CreatorUserID) - b.Comma() - b.FieldStart("is_revoked") - b.PutBool(g.IsRevoked) - b.Comma() - b.FieldStart("offset_date") - b.PutInt32(g.OffsetDate) - b.Comma() - b.FieldStart("offset_invite_link") - b.PutString(g.OffsetInviteLink) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatInviteLinksRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatInviteLinks#34a55cac to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatInviteLinks"); err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field chat_id: %w", err) - } - g.ChatID = value - case "creator_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field creator_user_id: %w", err) - } - g.CreatorUserID = value - case "is_revoked": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field is_revoked: %w", err) - } - g.IsRevoked = value - case "offset_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field offset_date: %w", err) - } - g.OffsetDate = value - case "offset_invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field offset_invite_link: %w", err) - } - g.OffsetInviteLink = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatInviteLinks#34a55cac: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatInviteLinksRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetCreatorUserID returns value of CreatorUserID field. -func (g *GetChatInviteLinksRequest) GetCreatorUserID() (value int64) { - if g == nil { - return - } - return g.CreatorUserID -} - -// GetIsRevoked returns value of IsRevoked field. -func (g *GetChatInviteLinksRequest) GetIsRevoked() (value bool) { - if g == nil { - return - } - return g.IsRevoked -} - -// GetOffsetDate returns value of OffsetDate field. -func (g *GetChatInviteLinksRequest) GetOffsetDate() (value int32) { - if g == nil { - return - } - return g.OffsetDate -} - -// GetOffsetInviteLink returns value of OffsetInviteLink field. -func (g *GetChatInviteLinksRequest) GetOffsetInviteLink() (value string) { - if g == nil { - return - } - return g.OffsetInviteLink -} - -// GetLimit returns value of Limit field. -func (g *GetChatInviteLinksRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChatInviteLinks invokes method getChatInviteLinks#34a55cac returning error if any. -func (c *Client) GetChatInviteLinks(ctx context.Context, request *GetChatInviteLinksRequest) (*ChatInviteLinks, error) { - var result ChatInviteLinks - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_join_requests_gen.go b/tdapi/tl_get_chat_join_requests_gen.go deleted file mode 100644 index da2206454..000000000 --- a/tdapi/tl_get_chat_join_requests_gen.go +++ /dev/null @@ -1,343 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatJoinRequestsRequest represents TL type `getChatJoinRequests#e8d90ea2`. -type GetChatJoinRequestsRequest struct { - // Chat identifier - ChatID int64 - // Invite link for which to return join requests. If empty, all join requests will be - // returned. Requires administrator privileges and can_invite_users right in the chat for - // own links and owner privileges for other links - InviteLink string - // A query to search for in the first names, last names and usernames of the users to - // return - Query string - // A chat join request from which to return next requests; pass null to get results from - // the beginning - OffsetRequest ChatJoinRequest - // The maximum number of requests to join the chat to return - Limit int32 -} - -// GetChatJoinRequestsRequestTypeID is TL type id of GetChatJoinRequestsRequest. -const GetChatJoinRequestsRequestTypeID = 0xe8d90ea2 - -// Ensuring interfaces in compile-time for GetChatJoinRequestsRequest. -var ( - _ bin.Encoder = &GetChatJoinRequestsRequest{} - _ bin.Decoder = &GetChatJoinRequestsRequest{} - _ bin.BareEncoder = &GetChatJoinRequestsRequest{} - _ bin.BareDecoder = &GetChatJoinRequestsRequest{} -) - -func (g *GetChatJoinRequestsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.InviteLink == "") { - return false - } - if !(g.Query == "") { - return false - } - if !(g.OffsetRequest.Zero()) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatJoinRequestsRequest) String() string { - if g == nil { - return "GetChatJoinRequestsRequest(nil)" - } - type Alias GetChatJoinRequestsRequest - return fmt.Sprintf("GetChatJoinRequestsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatJoinRequestsRequest) TypeID() uint32 { - return GetChatJoinRequestsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatJoinRequestsRequest) TypeName() string { - return "getChatJoinRequests" -} - -// TypeInfo returns info about TL type. -func (g *GetChatJoinRequestsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatJoinRequests", - ID: GetChatJoinRequestsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "OffsetRequest", - SchemaName: "offset_request", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatJoinRequestsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatJoinRequests#e8d90ea2 as nil") - } - b.PutID(GetChatJoinRequestsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatJoinRequestsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatJoinRequests#e8d90ea2 as nil") - } - b.PutInt53(g.ChatID) - b.PutString(g.InviteLink) - b.PutString(g.Query) - if err := g.OffsetRequest.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatJoinRequests#e8d90ea2: field offset_request: %w", err) - } - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatJoinRequestsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatJoinRequests#e8d90ea2 to nil") - } - if err := b.ConsumeID(GetChatJoinRequestsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatJoinRequestsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatJoinRequests#e8d90ea2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: field invite_link: %w", err) - } - g.InviteLink = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: field query: %w", err) - } - g.Query = value - } - { - if err := g.OffsetRequest.Decode(b); err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: field offset_request: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatJoinRequestsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatJoinRequests#e8d90ea2 as nil") - } - b.ObjStart() - b.PutID("getChatJoinRequests") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("invite_link") - b.PutString(g.InviteLink) - b.Comma() - b.FieldStart("query") - b.PutString(g.Query) - b.Comma() - b.FieldStart("offset_request") - if err := g.OffsetRequest.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatJoinRequests#e8d90ea2: field offset_request: %w", err) - } - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatJoinRequestsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatJoinRequests#e8d90ea2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatJoinRequests"); err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: field chat_id: %w", err) - } - g.ChatID = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: field invite_link: %w", err) - } - g.InviteLink = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: field query: %w", err) - } - g.Query = value - case "offset_request": - if err := g.OffsetRequest.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: field offset_request: %w", err) - } - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatJoinRequests#e8d90ea2: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatJoinRequestsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetInviteLink returns value of InviteLink field. -func (g *GetChatJoinRequestsRequest) GetInviteLink() (value string) { - if g == nil { - return - } - return g.InviteLink -} - -// GetQuery returns value of Query field. -func (g *GetChatJoinRequestsRequest) GetQuery() (value string) { - if g == nil { - return - } - return g.Query -} - -// GetOffsetRequest returns value of OffsetRequest field. -func (g *GetChatJoinRequestsRequest) GetOffsetRequest() (value ChatJoinRequest) { - if g == nil { - return - } - return g.OffsetRequest -} - -// GetLimit returns value of Limit field. -func (g *GetChatJoinRequestsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChatJoinRequests invokes method getChatJoinRequests#e8d90ea2 returning error if any. -func (c *Client) GetChatJoinRequests(ctx context.Context, request *GetChatJoinRequestsRequest) (*ChatJoinRequests, error) { - var result ChatJoinRequests - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_lists_to_add_chat_gen.go b/tdapi/tl_get_chat_lists_to_add_chat_gen.go deleted file mode 100644 index d0046ad9f..000000000 --- a/tdapi/tl_get_chat_lists_to_add_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatListsToAddChatRequest represents TL type `getChatListsToAddChat#2709d6a1`. -type GetChatListsToAddChatRequest struct { - // Chat identifier - ChatID int64 -} - -// GetChatListsToAddChatRequestTypeID is TL type id of GetChatListsToAddChatRequest. -const GetChatListsToAddChatRequestTypeID = 0x2709d6a1 - -// Ensuring interfaces in compile-time for GetChatListsToAddChatRequest. -var ( - _ bin.Encoder = &GetChatListsToAddChatRequest{} - _ bin.Decoder = &GetChatListsToAddChatRequest{} - _ bin.BareEncoder = &GetChatListsToAddChatRequest{} - _ bin.BareDecoder = &GetChatListsToAddChatRequest{} -) - -func (g *GetChatListsToAddChatRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatListsToAddChatRequest) String() string { - if g == nil { - return "GetChatListsToAddChatRequest(nil)" - } - type Alias GetChatListsToAddChatRequest - return fmt.Sprintf("GetChatListsToAddChatRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatListsToAddChatRequest) TypeID() uint32 { - return GetChatListsToAddChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatListsToAddChatRequest) TypeName() string { - return "getChatListsToAddChat" -} - -// TypeInfo returns info about TL type. -func (g *GetChatListsToAddChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatListsToAddChat", - ID: GetChatListsToAddChatRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatListsToAddChatRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatListsToAddChat#2709d6a1 as nil") - } - b.PutID(GetChatListsToAddChatRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatListsToAddChatRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatListsToAddChat#2709d6a1 as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatListsToAddChatRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatListsToAddChat#2709d6a1 to nil") - } - if err := b.ConsumeID(GetChatListsToAddChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatListsToAddChat#2709d6a1: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatListsToAddChatRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatListsToAddChat#2709d6a1 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatListsToAddChat#2709d6a1: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatListsToAddChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatListsToAddChat#2709d6a1 as nil") - } - b.ObjStart() - b.PutID("getChatListsToAddChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatListsToAddChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatListsToAddChat#2709d6a1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatListsToAddChat"); err != nil { - return fmt.Errorf("unable to decode getChatListsToAddChat#2709d6a1: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatListsToAddChat#2709d6a1: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatListsToAddChatRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChatListsToAddChat invokes method getChatListsToAddChat#2709d6a1 returning error if any. -func (c *Client) GetChatListsToAddChat(ctx context.Context, chatid int64) (*ChatLists, error) { - var result ChatLists - - request := &GetChatListsToAddChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_member_gen.go b/tdapi/tl_get_chat_member_gen.go deleted file mode 100644 index 91d9ca7e1..000000000 --- a/tdapi/tl_get_chat_member_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatMemberRequest represents TL type `getChatMember#d0c15272`. -type GetChatMemberRequest struct { - // Chat identifier - ChatID int64 - // Member identifier - MemberID MessageSenderClass -} - -// GetChatMemberRequestTypeID is TL type id of GetChatMemberRequest. -const GetChatMemberRequestTypeID = 0xd0c15272 - -// Ensuring interfaces in compile-time for GetChatMemberRequest. -var ( - _ bin.Encoder = &GetChatMemberRequest{} - _ bin.Decoder = &GetChatMemberRequest{} - _ bin.BareEncoder = &GetChatMemberRequest{} - _ bin.BareDecoder = &GetChatMemberRequest{} -) - -func (g *GetChatMemberRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MemberID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatMemberRequest) String() string { - if g == nil { - return "GetChatMemberRequest(nil)" - } - type Alias GetChatMemberRequest - return fmt.Sprintf("GetChatMemberRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatMemberRequest) TypeID() uint32 { - return GetChatMemberRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatMemberRequest) TypeName() string { - return "getChatMember" -} - -// TypeInfo returns info about TL type. -func (g *GetChatMemberRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatMember", - ID: GetChatMemberRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MemberID", - SchemaName: "member_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatMemberRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatMember#d0c15272 as nil") - } - b.PutID(GetChatMemberRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatMemberRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatMember#d0c15272 as nil") - } - b.PutInt53(g.ChatID) - if g.MemberID == nil { - return fmt.Errorf("unable to encode getChatMember#d0c15272: field member_id is nil") - } - if err := g.MemberID.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatMember#d0c15272: field member_id: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatMemberRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatMember#d0c15272 to nil") - } - if err := b.ConsumeID(GetChatMemberRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatMember#d0c15272: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatMemberRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatMember#d0c15272 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMember#d0c15272: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode getChatMember#d0c15272: field member_id: %w", err) - } - g.MemberID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatMemberRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatMember#d0c15272 as nil") - } - b.ObjStart() - b.PutID("getChatMember") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("member_id") - if g.MemberID == nil { - return fmt.Errorf("unable to encode getChatMember#d0c15272: field member_id is nil") - } - if err := g.MemberID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatMember#d0c15272: field member_id: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatMemberRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatMember#d0c15272 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatMember"); err != nil { - return fmt.Errorf("unable to decode getChatMember#d0c15272: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMember#d0c15272: field chat_id: %w", err) - } - g.ChatID = value - case "member_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode getChatMember#d0c15272: field member_id: %w", err) - } - g.MemberID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatMemberRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMemberID returns value of MemberID field. -func (g *GetChatMemberRequest) GetMemberID() (value MessageSenderClass) { - if g == nil { - return - } - return g.MemberID -} - -// GetChatMember invokes method getChatMember#d0c15272 returning error if any. -func (c *Client) GetChatMember(ctx context.Context, request *GetChatMemberRequest) (*ChatMember, error) { - var result ChatMember - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_message_by_date_gen.go b/tdapi/tl_get_chat_message_by_date_gen.go deleted file mode 100644 index 6de7d380a..000000000 --- a/tdapi/tl_get_chat_message_by_date_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatMessageByDateRequest represents TL type `getChatMessageByDate#3f557136`. -type GetChatMessageByDateRequest struct { - // Chat identifier - ChatID int64 - // Point in time (Unix timestamp) relative to which to search for messages - Date int32 -} - -// GetChatMessageByDateRequestTypeID is TL type id of GetChatMessageByDateRequest. -const GetChatMessageByDateRequestTypeID = 0x3f557136 - -// Ensuring interfaces in compile-time for GetChatMessageByDateRequest. -var ( - _ bin.Encoder = &GetChatMessageByDateRequest{} - _ bin.Decoder = &GetChatMessageByDateRequest{} - _ bin.BareEncoder = &GetChatMessageByDateRequest{} - _ bin.BareDecoder = &GetChatMessageByDateRequest{} -) - -func (g *GetChatMessageByDateRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.Date == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatMessageByDateRequest) String() string { - if g == nil { - return "GetChatMessageByDateRequest(nil)" - } - type Alias GetChatMessageByDateRequest - return fmt.Sprintf("GetChatMessageByDateRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatMessageByDateRequest) TypeID() uint32 { - return GetChatMessageByDateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatMessageByDateRequest) TypeName() string { - return "getChatMessageByDate" -} - -// TypeInfo returns info about TL type. -func (g *GetChatMessageByDateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatMessageByDate", - ID: GetChatMessageByDateRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Date", - SchemaName: "date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatMessageByDateRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessageByDate#3f557136 as nil") - } - b.PutID(GetChatMessageByDateRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatMessageByDateRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessageByDate#3f557136 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt32(g.Date) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatMessageByDateRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessageByDate#3f557136 to nil") - } - if err := b.ConsumeID(GetChatMessageByDateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatMessageByDate#3f557136: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatMessageByDateRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessageByDate#3f557136 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageByDate#3f557136: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageByDate#3f557136: field date: %w", err) - } - g.Date = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatMessageByDateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessageByDate#3f557136 as nil") - } - b.ObjStart() - b.PutID("getChatMessageByDate") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("date") - b.PutInt32(g.Date) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatMessageByDateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessageByDate#3f557136 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatMessageByDate"); err != nil { - return fmt.Errorf("unable to decode getChatMessageByDate#3f557136: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageByDate#3f557136: field chat_id: %w", err) - } - g.ChatID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageByDate#3f557136: field date: %w", err) - } - g.Date = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatMessageByDateRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetDate returns value of Date field. -func (g *GetChatMessageByDateRequest) GetDate() (value int32) { - if g == nil { - return - } - return g.Date -} - -// GetChatMessageByDate invokes method getChatMessageByDate#3f557136 returning error if any. -func (c *Client) GetChatMessageByDate(ctx context.Context, request *GetChatMessageByDateRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_message_calendar_gen.go b/tdapi/tl_get_chat_message_calendar_gen.go deleted file mode 100644 index f79cbdedd..000000000 --- a/tdapi/tl_get_chat_message_calendar_gen.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatMessageCalendarRequest represents TL type `getChatMessageCalendar#81af2db7`. -type GetChatMessageCalendarRequest struct { - // Identifier of the chat in which to return information about messages - ChatID int64 - // Filter for message content. Filters searchMessagesFilterEmpty, - // searchMessagesFilterMention, searchMessagesFilterUnreadMention, and - // searchMessagesFilterUnreadReaction are unsupported in this function - Filter SearchMessagesFilterClass - // The message identifier from which to return information about messages; use 0 to get - // results from the last message - FromMessageID int64 - // If not0, only messages in the specified Saved Messages topic will be considered; pass - // 0 to consider all messages, or for chats other than Saved Messages - SavedMessagesTopicID int64 -} - -// GetChatMessageCalendarRequestTypeID is TL type id of GetChatMessageCalendarRequest. -const GetChatMessageCalendarRequestTypeID = 0x81af2db7 - -// Ensuring interfaces in compile-time for GetChatMessageCalendarRequest. -var ( - _ bin.Encoder = &GetChatMessageCalendarRequest{} - _ bin.Decoder = &GetChatMessageCalendarRequest{} - _ bin.BareEncoder = &GetChatMessageCalendarRequest{} - _ bin.BareDecoder = &GetChatMessageCalendarRequest{} -) - -func (g *GetChatMessageCalendarRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.Filter == nil) { - return false - } - if !(g.FromMessageID == 0) { - return false - } - if !(g.SavedMessagesTopicID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatMessageCalendarRequest) String() string { - if g == nil { - return "GetChatMessageCalendarRequest(nil)" - } - type Alias GetChatMessageCalendarRequest - return fmt.Sprintf("GetChatMessageCalendarRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatMessageCalendarRequest) TypeID() uint32 { - return GetChatMessageCalendarRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatMessageCalendarRequest) TypeName() string { - return "getChatMessageCalendar" -} - -// TypeInfo returns info about TL type. -func (g *GetChatMessageCalendarRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatMessageCalendar", - ID: GetChatMessageCalendarRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Filter", - SchemaName: "filter", - }, - { - Name: "FromMessageID", - SchemaName: "from_message_id", - }, - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatMessageCalendarRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessageCalendar#81af2db7 as nil") - } - b.PutID(GetChatMessageCalendarRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatMessageCalendarRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessageCalendar#81af2db7 as nil") - } - b.PutInt53(g.ChatID) - if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#81af2db7: field filter is nil") - } - if err := g.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#81af2db7: field filter: %w", err) - } - b.PutInt53(g.FromMessageID) - b.PutInt53(g.SavedMessagesTopicID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatMessageCalendarRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessageCalendar#81af2db7 to nil") - } - if err := b.ConsumeID(GetChatMessageCalendarRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatMessageCalendarRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessageCalendar#81af2db7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := DecodeSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field filter: %w", err) - } - g.Filter = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field from_message_id: %w", err) - } - g.FromMessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatMessageCalendarRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessageCalendar#81af2db7 as nil") - } - b.ObjStart() - b.PutID("getChatMessageCalendar") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("filter") - if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#81af2db7: field filter is nil") - } - if err := g.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCalendar#81af2db7: field filter: %w", err) - } - b.Comma() - b.FieldStart("from_message_id") - b.PutInt53(g.FromMessageID) - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(g.SavedMessagesTopicID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatMessageCalendarRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessageCalendar#81af2db7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatMessageCalendar"); err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field chat_id: %w", err) - } - g.ChatID = value - case "filter": - value, err := DecodeTDLibJSONSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field filter: %w", err) - } - g.Filter = value - case "from_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field from_message_id: %w", err) - } - g.FromMessageID = value - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCalendar#81af2db7: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatMessageCalendarRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetFilter returns value of Filter field. -func (g *GetChatMessageCalendarRequest) GetFilter() (value SearchMessagesFilterClass) { - if g == nil { - return - } - return g.Filter -} - -// GetFromMessageID returns value of FromMessageID field. -func (g *GetChatMessageCalendarRequest) GetFromMessageID() (value int64) { - if g == nil { - return - } - return g.FromMessageID -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (g *GetChatMessageCalendarRequest) GetSavedMessagesTopicID() (value int64) { - if g == nil { - return - } - return g.SavedMessagesTopicID -} - -// GetChatMessageCalendar invokes method getChatMessageCalendar#81af2db7 returning error if any. -func (c *Client) GetChatMessageCalendar(ctx context.Context, request *GetChatMessageCalendarRequest) (*MessageCalendar, error) { - var result MessageCalendar - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_message_count_gen.go b/tdapi/tl_get_chat_message_count_gen.go deleted file mode 100644 index 95cfdf2b5..000000000 --- a/tdapi/tl_get_chat_message_count_gen.go +++ /dev/null @@ -1,317 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatMessageCountRequest represents TL type `getChatMessageCount#38f78909`. -type GetChatMessageCountRequest struct { - // Identifier of the chat in which to count messages - ChatID int64 - // Filter for message content; searchMessagesFilterEmpty is unsupported in this function - Filter SearchMessagesFilterClass - // If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 - // to count all messages, or for chats other than Saved Messages - SavedMessagesTopicID int64 - // Pass true to get the number of messages without sending network requests, or -1 if the - // number of messages is unknown locally - ReturnLocal bool -} - -// GetChatMessageCountRequestTypeID is TL type id of GetChatMessageCountRequest. -const GetChatMessageCountRequestTypeID = 0x38f78909 - -// Ensuring interfaces in compile-time for GetChatMessageCountRequest. -var ( - _ bin.Encoder = &GetChatMessageCountRequest{} - _ bin.Decoder = &GetChatMessageCountRequest{} - _ bin.BareEncoder = &GetChatMessageCountRequest{} - _ bin.BareDecoder = &GetChatMessageCountRequest{} -) - -func (g *GetChatMessageCountRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.Filter == nil) { - return false - } - if !(g.SavedMessagesTopicID == 0) { - return false - } - if !(g.ReturnLocal == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatMessageCountRequest) String() string { - if g == nil { - return "GetChatMessageCountRequest(nil)" - } - type Alias GetChatMessageCountRequest - return fmt.Sprintf("GetChatMessageCountRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatMessageCountRequest) TypeID() uint32 { - return GetChatMessageCountRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatMessageCountRequest) TypeName() string { - return "getChatMessageCount" -} - -// TypeInfo returns info about TL type. -func (g *GetChatMessageCountRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatMessageCount", - ID: GetChatMessageCountRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Filter", - SchemaName: "filter", - }, - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - { - Name: "ReturnLocal", - SchemaName: "return_local", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatMessageCountRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessageCount#38f78909 as nil") - } - b.PutID(GetChatMessageCountRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatMessageCountRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessageCount#38f78909 as nil") - } - b.PutInt53(g.ChatID) - if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessageCount#38f78909: field filter is nil") - } - if err := g.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCount#38f78909: field filter: %w", err) - } - b.PutInt53(g.SavedMessagesTopicID) - b.PutBool(g.ReturnLocal) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatMessageCountRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessageCount#38f78909 to nil") - } - if err := b.ConsumeID(GetChatMessageCountRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#38f78909: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatMessageCountRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessageCount#38f78909 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := DecodeSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field filter: %w", err) - } - g.Filter = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field return_local: %w", err) - } - g.ReturnLocal = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatMessageCountRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessageCount#38f78909 as nil") - } - b.ObjStart() - b.PutID("getChatMessageCount") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("filter") - if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessageCount#38f78909: field filter is nil") - } - if err := g.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatMessageCount#38f78909: field filter: %w", err) - } - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(g.SavedMessagesTopicID) - b.Comma() - b.FieldStart("return_local") - b.PutBool(g.ReturnLocal) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatMessageCountRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessageCount#38f78909 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatMessageCount"); err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#38f78909: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field chat_id: %w", err) - } - g.ChatID = value - case "filter": - value, err := DecodeTDLibJSONSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field filter: %w", err) - } - g.Filter = value - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - case "return_local": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatMessageCount#38f78909: field return_local: %w", err) - } - g.ReturnLocal = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatMessageCountRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetFilter returns value of Filter field. -func (g *GetChatMessageCountRequest) GetFilter() (value SearchMessagesFilterClass) { - if g == nil { - return - } - return g.Filter -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (g *GetChatMessageCountRequest) GetSavedMessagesTopicID() (value int64) { - if g == nil { - return - } - return g.SavedMessagesTopicID -} - -// GetReturnLocal returns value of ReturnLocal field. -func (g *GetChatMessageCountRequest) GetReturnLocal() (value bool) { - if g == nil { - return - } - return g.ReturnLocal -} - -// GetChatMessageCount invokes method getChatMessageCount#38f78909 returning error if any. -func (c *Client) GetChatMessageCount(ctx context.Context, request *GetChatMessageCountRequest) (*Count, error) { - var result Count - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_message_position_gen.go b/tdapi/tl_get_chat_message_position_gen.go deleted file mode 100644 index f7cc1f946..000000000 --- a/tdapi/tl_get_chat_message_position_gen.go +++ /dev/null @@ -1,352 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatMessagePositionRequest represents TL type `getChatMessagePosition#81bfcc7`. -type GetChatMessagePositionRequest struct { - // Identifier of the chat in which to find message position - ChatID int64 - // Message identifier - MessageID int64 - // Filter for message content; searchMessagesFilterEmpty, - // searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and - // searchMessagesFilterFailedToSend are unsupported in this function - Filter SearchMessagesFilterClass - // If not 0, only messages in the specified thread will be considered; supergroups only - MessageThreadID int64 - // If not 0, only messages in the specified Saved Messages topic will be considered; pass - // 0 to consider all relevant messages, or for chats other than Saved Messages - SavedMessagesTopicID int64 -} - -// GetChatMessagePositionRequestTypeID is TL type id of GetChatMessagePositionRequest. -const GetChatMessagePositionRequestTypeID = 0x81bfcc7 - -// Ensuring interfaces in compile-time for GetChatMessagePositionRequest. -var ( - _ bin.Encoder = &GetChatMessagePositionRequest{} - _ bin.Decoder = &GetChatMessagePositionRequest{} - _ bin.BareEncoder = &GetChatMessagePositionRequest{} - _ bin.BareDecoder = &GetChatMessagePositionRequest{} -) - -func (g *GetChatMessagePositionRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.Filter == nil) { - return false - } - if !(g.MessageThreadID == 0) { - return false - } - if !(g.SavedMessagesTopicID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatMessagePositionRequest) String() string { - if g == nil { - return "GetChatMessagePositionRequest(nil)" - } - type Alias GetChatMessagePositionRequest - return fmt.Sprintf("GetChatMessagePositionRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatMessagePositionRequest) TypeID() uint32 { - return GetChatMessagePositionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatMessagePositionRequest) TypeName() string { - return "getChatMessagePosition" -} - -// TypeInfo returns info about TL type. -func (g *GetChatMessagePositionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatMessagePosition", - ID: GetChatMessagePositionRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Filter", - SchemaName: "filter", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatMessagePositionRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessagePosition#81bfcc7 as nil") - } - b.PutID(GetChatMessagePositionRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatMessagePositionRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessagePosition#81bfcc7 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessagePosition#81bfcc7: field filter is nil") - } - if err := g.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatMessagePosition#81bfcc7: field filter: %w", err) - } - b.PutInt53(g.MessageThreadID) - b.PutInt53(g.SavedMessagesTopicID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatMessagePositionRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessagePosition#81bfcc7 to nil") - } - if err := b.ConsumeID(GetChatMessagePositionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatMessagePositionRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessagePosition#81bfcc7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := DecodeSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field filter: %w", err) - } - g.Filter = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field message_thread_id: %w", err) - } - g.MessageThreadID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatMessagePositionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatMessagePosition#81bfcc7 as nil") - } - b.ObjStart() - b.PutID("getChatMessagePosition") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("filter") - if g.Filter == nil { - return fmt.Errorf("unable to encode getChatMessagePosition#81bfcc7: field filter is nil") - } - if err := g.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatMessagePosition#81bfcc7: field filter: %w", err) - } - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(g.MessageThreadID) - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(g.SavedMessagesTopicID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatMessagePositionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatMessagePosition#81bfcc7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatMessagePosition"); err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field message_id: %w", err) - } - g.MessageID = value - case "filter": - value, err := DecodeTDLibJSONSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field filter: %w", err) - } - g.Filter = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field message_thread_id: %w", err) - } - g.MessageThreadID = value - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatMessagePosition#81bfcc7: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatMessagePositionRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetChatMessagePositionRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetFilter returns value of Filter field. -func (g *GetChatMessagePositionRequest) GetFilter() (value SearchMessagesFilterClass) { - if g == nil { - return - } - return g.Filter -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (g *GetChatMessagePositionRequest) GetMessageThreadID() (value int64) { - if g == nil { - return - } - return g.MessageThreadID -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (g *GetChatMessagePositionRequest) GetSavedMessagesTopicID() (value int64) { - if g == nil { - return - } - return g.SavedMessagesTopicID -} - -// GetChatMessagePosition invokes method getChatMessagePosition#81bfcc7 returning error if any. -func (c *Client) GetChatMessagePosition(ctx context.Context, request *GetChatMessagePositionRequest) (*Count, error) { - var result Count - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_notification_settings_exceptions_gen.go b/tdapi/tl_get_chat_notification_settings_exceptions_gen.go deleted file mode 100644 index dc2e1269a..000000000 --- a/tdapi/tl_get_chat_notification_settings_exceptions_gen.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatNotificationSettingsExceptionsRequest represents TL type `getChatNotificationSettingsExceptions#bfe0e11`. -type GetChatNotificationSettingsExceptionsRequest struct { - // If specified, only chats from the scope will be returned; pass null to return chats - // from all scopes - Scope NotificationSettingsScopeClass - // Pass true to include in the response chats with only non-default sound - CompareSound bool -} - -// GetChatNotificationSettingsExceptionsRequestTypeID is TL type id of GetChatNotificationSettingsExceptionsRequest. -const GetChatNotificationSettingsExceptionsRequestTypeID = 0xbfe0e11 - -// Ensuring interfaces in compile-time for GetChatNotificationSettingsExceptionsRequest. -var ( - _ bin.Encoder = &GetChatNotificationSettingsExceptionsRequest{} - _ bin.Decoder = &GetChatNotificationSettingsExceptionsRequest{} - _ bin.BareEncoder = &GetChatNotificationSettingsExceptionsRequest{} - _ bin.BareDecoder = &GetChatNotificationSettingsExceptionsRequest{} -) - -func (g *GetChatNotificationSettingsExceptionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Scope == nil) { - return false - } - if !(g.CompareSound == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatNotificationSettingsExceptionsRequest) String() string { - if g == nil { - return "GetChatNotificationSettingsExceptionsRequest(nil)" - } - type Alias GetChatNotificationSettingsExceptionsRequest - return fmt.Sprintf("GetChatNotificationSettingsExceptionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatNotificationSettingsExceptionsRequest) TypeID() uint32 { - return GetChatNotificationSettingsExceptionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatNotificationSettingsExceptionsRequest) TypeName() string { - return "getChatNotificationSettingsExceptions" -} - -// TypeInfo returns info about TL type. -func (g *GetChatNotificationSettingsExceptionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatNotificationSettingsExceptions", - ID: GetChatNotificationSettingsExceptionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Scope", - SchemaName: "scope", - }, - { - Name: "CompareSound", - SchemaName: "compare_sound", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatNotificationSettingsExceptionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatNotificationSettingsExceptions#bfe0e11 as nil") - } - b.PutID(GetChatNotificationSettingsExceptionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatNotificationSettingsExceptionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatNotificationSettingsExceptions#bfe0e11 as nil") - } - if g.Scope == nil { - return fmt.Errorf("unable to encode getChatNotificationSettingsExceptions#bfe0e11: field scope is nil") - } - if err := g.Scope.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatNotificationSettingsExceptions#bfe0e11: field scope: %w", err) - } - b.PutBool(g.CompareSound) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatNotificationSettingsExceptionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatNotificationSettingsExceptions#bfe0e11 to nil") - } - if err := b.ConsumeID(GetChatNotificationSettingsExceptionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatNotificationSettingsExceptions#bfe0e11: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatNotificationSettingsExceptionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatNotificationSettingsExceptions#bfe0e11 to nil") - } - { - value, err := DecodeNotificationSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode getChatNotificationSettingsExceptions#bfe0e11: field scope: %w", err) - } - g.Scope = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatNotificationSettingsExceptions#bfe0e11: field compare_sound: %w", err) - } - g.CompareSound = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatNotificationSettingsExceptionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatNotificationSettingsExceptions#bfe0e11 as nil") - } - b.ObjStart() - b.PutID("getChatNotificationSettingsExceptions") - b.Comma() - b.FieldStart("scope") - if g.Scope == nil { - return fmt.Errorf("unable to encode getChatNotificationSettingsExceptions#bfe0e11: field scope is nil") - } - if err := g.Scope.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatNotificationSettingsExceptions#bfe0e11: field scope: %w", err) - } - b.Comma() - b.FieldStart("compare_sound") - b.PutBool(g.CompareSound) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatNotificationSettingsExceptionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatNotificationSettingsExceptions#bfe0e11 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatNotificationSettingsExceptions"); err != nil { - return fmt.Errorf("unable to decode getChatNotificationSettingsExceptions#bfe0e11: %w", err) - } - case "scope": - value, err := DecodeTDLibJSONNotificationSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode getChatNotificationSettingsExceptions#bfe0e11: field scope: %w", err) - } - g.Scope = value - case "compare_sound": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatNotificationSettingsExceptions#bfe0e11: field compare_sound: %w", err) - } - g.CompareSound = value - default: - return b.Skip() - } - return nil - }) -} - -// GetScope returns value of Scope field. -func (g *GetChatNotificationSettingsExceptionsRequest) GetScope() (value NotificationSettingsScopeClass) { - if g == nil { - return - } - return g.Scope -} - -// GetCompareSound returns value of CompareSound field. -func (g *GetChatNotificationSettingsExceptionsRequest) GetCompareSound() (value bool) { - if g == nil { - return - } - return g.CompareSound -} - -// GetChatNotificationSettingsExceptions invokes method getChatNotificationSettingsExceptions#bfe0e11 returning error if any. -func (c *Client) GetChatNotificationSettingsExceptions(ctx context.Context, request *GetChatNotificationSettingsExceptionsRequest) (*Chats, error) { - var result Chats - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_pinned_message_gen.go b/tdapi/tl_get_chat_pinned_message_gen.go deleted file mode 100644 index 026b51774..000000000 --- a/tdapi/tl_get_chat_pinned_message_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatPinnedMessageRequest represents TL type `getChatPinnedMessage#15731ab0`. -type GetChatPinnedMessageRequest struct { - // Identifier of the chat the message belongs to - ChatID int64 -} - -// GetChatPinnedMessageRequestTypeID is TL type id of GetChatPinnedMessageRequest. -const GetChatPinnedMessageRequestTypeID = 0x15731ab0 - -// Ensuring interfaces in compile-time for GetChatPinnedMessageRequest. -var ( - _ bin.Encoder = &GetChatPinnedMessageRequest{} - _ bin.Decoder = &GetChatPinnedMessageRequest{} - _ bin.BareEncoder = &GetChatPinnedMessageRequest{} - _ bin.BareDecoder = &GetChatPinnedMessageRequest{} -) - -func (g *GetChatPinnedMessageRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatPinnedMessageRequest) String() string { - if g == nil { - return "GetChatPinnedMessageRequest(nil)" - } - type Alias GetChatPinnedMessageRequest - return fmt.Sprintf("GetChatPinnedMessageRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatPinnedMessageRequest) TypeID() uint32 { - return GetChatPinnedMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatPinnedMessageRequest) TypeName() string { - return "getChatPinnedMessage" -} - -// TypeInfo returns info about TL type. -func (g *GetChatPinnedMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatPinnedMessage", - ID: GetChatPinnedMessageRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatPinnedMessageRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatPinnedMessage#15731ab0 as nil") - } - b.PutID(GetChatPinnedMessageRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatPinnedMessageRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatPinnedMessage#15731ab0 as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatPinnedMessageRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatPinnedMessage#15731ab0 to nil") - } - if err := b.ConsumeID(GetChatPinnedMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatPinnedMessage#15731ab0: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatPinnedMessageRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatPinnedMessage#15731ab0 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatPinnedMessage#15731ab0: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatPinnedMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatPinnedMessage#15731ab0 as nil") - } - b.ObjStart() - b.PutID("getChatPinnedMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatPinnedMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatPinnedMessage#15731ab0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatPinnedMessage"); err != nil { - return fmt.Errorf("unable to decode getChatPinnedMessage#15731ab0: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatPinnedMessage#15731ab0: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatPinnedMessageRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChatPinnedMessage invokes method getChatPinnedMessage#15731ab0 returning error if any. -func (c *Client) GetChatPinnedMessage(ctx context.Context, chatid int64) (*Message, error) { - var result Message - - request := &GetChatPinnedMessageRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_posted_to_chat_page_stories_gen.go b/tdapi/tl_get_chat_posted_to_chat_page_stories_gen.go deleted file mode 100644 index bbef5ad3a..000000000 --- a/tdapi/tl_get_chat_posted_to_chat_page_stories_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatPostedToChatPageStoriesRequest represents TL type `getChatPostedToChatPageStories#fd3bc72b`. -type GetChatPostedToChatPageStoriesRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the story starting from which stories must be returned; use 0 to get - // results from pinned and the newest story - FromStoryID int32 - // The maximum number of stories to be returned. - Limit int32 -} - -// GetChatPostedToChatPageStoriesRequestTypeID is TL type id of GetChatPostedToChatPageStoriesRequest. -const GetChatPostedToChatPageStoriesRequestTypeID = 0xfd3bc72b - -// Ensuring interfaces in compile-time for GetChatPostedToChatPageStoriesRequest. -var ( - _ bin.Encoder = &GetChatPostedToChatPageStoriesRequest{} - _ bin.Decoder = &GetChatPostedToChatPageStoriesRequest{} - _ bin.BareEncoder = &GetChatPostedToChatPageStoriesRequest{} - _ bin.BareDecoder = &GetChatPostedToChatPageStoriesRequest{} -) - -func (g *GetChatPostedToChatPageStoriesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.FromStoryID == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatPostedToChatPageStoriesRequest) String() string { - if g == nil { - return "GetChatPostedToChatPageStoriesRequest(nil)" - } - type Alias GetChatPostedToChatPageStoriesRequest - return fmt.Sprintf("GetChatPostedToChatPageStoriesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatPostedToChatPageStoriesRequest) TypeID() uint32 { - return GetChatPostedToChatPageStoriesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatPostedToChatPageStoriesRequest) TypeName() string { - return "getChatPostedToChatPageStories" -} - -// TypeInfo returns info about TL type. -func (g *GetChatPostedToChatPageStoriesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatPostedToChatPageStories", - ID: GetChatPostedToChatPageStoriesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "FromStoryID", - SchemaName: "from_story_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatPostedToChatPageStoriesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatPostedToChatPageStories#fd3bc72b as nil") - } - b.PutID(GetChatPostedToChatPageStoriesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatPostedToChatPageStoriesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatPostedToChatPageStories#fd3bc72b as nil") - } - b.PutInt53(g.ChatID) - b.PutInt32(g.FromStoryID) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatPostedToChatPageStoriesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatPostedToChatPageStories#fd3bc72b to nil") - } - if err := b.ConsumeID(GetChatPostedToChatPageStoriesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatPostedToChatPageStoriesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatPostedToChatPageStories#fd3bc72b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field from_story_id: %w", err) - } - g.FromStoryID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatPostedToChatPageStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatPostedToChatPageStories#fd3bc72b as nil") - } - b.ObjStart() - b.PutID("getChatPostedToChatPageStories") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("from_story_id") - b.PutInt32(g.FromStoryID) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatPostedToChatPageStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatPostedToChatPageStories#fd3bc72b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatPostedToChatPageStories"); err != nil { - return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field chat_id: %w", err) - } - g.ChatID = value - case "from_story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field from_story_id: %w", err) - } - g.FromStoryID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatPostedToChatPageStories#fd3bc72b: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatPostedToChatPageStoriesRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetFromStoryID returns value of FromStoryID field. -func (g *GetChatPostedToChatPageStoriesRequest) GetFromStoryID() (value int32) { - if g == nil { - return - } - return g.FromStoryID -} - -// GetLimit returns value of Limit field. -func (g *GetChatPostedToChatPageStoriesRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChatPostedToChatPageStories invokes method getChatPostedToChatPageStories#fd3bc72b returning error if any. -func (c *Client) GetChatPostedToChatPageStories(ctx context.Context, request *GetChatPostedToChatPageStoriesRequest) (*Stories, error) { - var result Stories - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_revenue_statistics_gen.go b/tdapi/tl_get_chat_revenue_statistics_gen.go deleted file mode 100644 index 286d28704..000000000 --- a/tdapi/tl_get_chat_revenue_statistics_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatRevenueStatisticsRequest represents TL type `getChatRevenueStatistics#29d79b3c`. -type GetChatRevenueStatisticsRequest struct { - // Chat identifier - ChatID int64 - // Pass true if a dark theme is used by the application - IsDark bool -} - -// GetChatRevenueStatisticsRequestTypeID is TL type id of GetChatRevenueStatisticsRequest. -const GetChatRevenueStatisticsRequestTypeID = 0x29d79b3c - -// Ensuring interfaces in compile-time for GetChatRevenueStatisticsRequest. -var ( - _ bin.Encoder = &GetChatRevenueStatisticsRequest{} - _ bin.Decoder = &GetChatRevenueStatisticsRequest{} - _ bin.BareEncoder = &GetChatRevenueStatisticsRequest{} - _ bin.BareDecoder = &GetChatRevenueStatisticsRequest{} -) - -func (g *GetChatRevenueStatisticsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.IsDark == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatRevenueStatisticsRequest) String() string { - if g == nil { - return "GetChatRevenueStatisticsRequest(nil)" - } - type Alias GetChatRevenueStatisticsRequest - return fmt.Sprintf("GetChatRevenueStatisticsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatRevenueStatisticsRequest) TypeID() uint32 { - return GetChatRevenueStatisticsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatRevenueStatisticsRequest) TypeName() string { - return "getChatRevenueStatistics" -} - -// TypeInfo returns info about TL type. -func (g *GetChatRevenueStatisticsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatRevenueStatistics", - ID: GetChatRevenueStatisticsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "IsDark", - SchemaName: "is_dark", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatRevenueStatisticsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatRevenueStatistics#29d79b3c as nil") - } - b.PutID(GetChatRevenueStatisticsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatRevenueStatisticsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatRevenueStatistics#29d79b3c as nil") - } - b.PutInt53(g.ChatID) - b.PutBool(g.IsDark) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatRevenueStatisticsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatRevenueStatistics#29d79b3c to nil") - } - if err := b.ConsumeID(GetChatRevenueStatisticsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatRevenueStatistics#29d79b3c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatRevenueStatisticsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatRevenueStatistics#29d79b3c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueStatistics#29d79b3c: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueStatistics#29d79b3c: field is_dark: %w", err) - } - g.IsDark = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatRevenueStatisticsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatRevenueStatistics#29d79b3c as nil") - } - b.ObjStart() - b.PutID("getChatRevenueStatistics") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("is_dark") - b.PutBool(g.IsDark) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatRevenueStatisticsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatRevenueStatistics#29d79b3c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatRevenueStatistics"); err != nil { - return fmt.Errorf("unable to decode getChatRevenueStatistics#29d79b3c: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueStatistics#29d79b3c: field chat_id: %w", err) - } - g.ChatID = value - case "is_dark": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueStatistics#29d79b3c: field is_dark: %w", err) - } - g.IsDark = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatRevenueStatisticsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetIsDark returns value of IsDark field. -func (g *GetChatRevenueStatisticsRequest) GetIsDark() (value bool) { - if g == nil { - return - } - return g.IsDark -} - -// GetChatRevenueStatistics invokes method getChatRevenueStatistics#29d79b3c returning error if any. -func (c *Client) GetChatRevenueStatistics(ctx context.Context, request *GetChatRevenueStatisticsRequest) (*ChatRevenueStatistics, error) { - var result ChatRevenueStatistics - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_revenue_transactions_gen.go b/tdapi/tl_get_chat_revenue_transactions_gen.go deleted file mode 100644 index a5a5f7485..000000000 --- a/tdapi/tl_get_chat_revenue_transactions_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatRevenueTransactionsRequest represents TL type `getChatRevenueTransactions#472f0715`. -type GetChatRevenueTransactionsRequest struct { - // Chat identifier - ChatID int64 - // Number of transactions to skip - Offset int32 - // The maximum number of transactions to be returned; up to 200 - Limit int32 -} - -// GetChatRevenueTransactionsRequestTypeID is TL type id of GetChatRevenueTransactionsRequest. -const GetChatRevenueTransactionsRequestTypeID = 0x472f0715 - -// Ensuring interfaces in compile-time for GetChatRevenueTransactionsRequest. -var ( - _ bin.Encoder = &GetChatRevenueTransactionsRequest{} - _ bin.Decoder = &GetChatRevenueTransactionsRequest{} - _ bin.BareEncoder = &GetChatRevenueTransactionsRequest{} - _ bin.BareDecoder = &GetChatRevenueTransactionsRequest{} -) - -func (g *GetChatRevenueTransactionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.Offset == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatRevenueTransactionsRequest) String() string { - if g == nil { - return "GetChatRevenueTransactionsRequest(nil)" - } - type Alias GetChatRevenueTransactionsRequest - return fmt.Sprintf("GetChatRevenueTransactionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatRevenueTransactionsRequest) TypeID() uint32 { - return GetChatRevenueTransactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatRevenueTransactionsRequest) TypeName() string { - return "getChatRevenueTransactions" -} - -// TypeInfo returns info about TL type. -func (g *GetChatRevenueTransactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatRevenueTransactions", - ID: GetChatRevenueTransactionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatRevenueTransactionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatRevenueTransactions#472f0715 as nil") - } - b.PutID(GetChatRevenueTransactionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatRevenueTransactionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatRevenueTransactions#472f0715 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt32(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatRevenueTransactionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatRevenueTransactions#472f0715 to nil") - } - if err := b.ConsumeID(GetChatRevenueTransactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatRevenueTransactions#472f0715: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatRevenueTransactionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatRevenueTransactions#472f0715 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueTransactions#472f0715: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueTransactions#472f0715: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueTransactions#472f0715: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatRevenueTransactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatRevenueTransactions#472f0715 as nil") - } - b.ObjStart() - b.PutID("getChatRevenueTransactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("offset") - b.PutInt32(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatRevenueTransactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatRevenueTransactions#472f0715 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatRevenueTransactions"); err != nil { - return fmt.Errorf("unable to decode getChatRevenueTransactions#472f0715: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueTransactions#472f0715: field chat_id: %w", err) - } - g.ChatID = value - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueTransactions#472f0715: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueTransactions#472f0715: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatRevenueTransactionsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetOffset returns value of Offset field. -func (g *GetChatRevenueTransactionsRequest) GetOffset() (value int32) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetChatRevenueTransactionsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChatRevenueTransactions invokes method getChatRevenueTransactions#472f0715 returning error if any. -func (c *Client) GetChatRevenueTransactions(ctx context.Context, request *GetChatRevenueTransactionsRequest) (*ChatRevenueTransactions, error) { - var result ChatRevenueTransactions - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_revenue_withdrawal_url_gen.go b/tdapi/tl_get_chat_revenue_withdrawal_url_gen.go deleted file mode 100644 index dd8a2fbbc..000000000 --- a/tdapi/tl_get_chat_revenue_withdrawal_url_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatRevenueWithdrawalURLRequest represents TL type `getChatRevenueWithdrawalUrl#1e320720`. -type GetChatRevenueWithdrawalURLRequest struct { - // Chat identifier - ChatID int64 - // The 2-step verification password of the current user - Password string -} - -// GetChatRevenueWithdrawalURLRequestTypeID is TL type id of GetChatRevenueWithdrawalURLRequest. -const GetChatRevenueWithdrawalURLRequestTypeID = 0x1e320720 - -// Ensuring interfaces in compile-time for GetChatRevenueWithdrawalURLRequest. -var ( - _ bin.Encoder = &GetChatRevenueWithdrawalURLRequest{} - _ bin.Decoder = &GetChatRevenueWithdrawalURLRequest{} - _ bin.BareEncoder = &GetChatRevenueWithdrawalURLRequest{} - _ bin.BareDecoder = &GetChatRevenueWithdrawalURLRequest{} -) - -func (g *GetChatRevenueWithdrawalURLRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.Password == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatRevenueWithdrawalURLRequest) String() string { - if g == nil { - return "GetChatRevenueWithdrawalURLRequest(nil)" - } - type Alias GetChatRevenueWithdrawalURLRequest - return fmt.Sprintf("GetChatRevenueWithdrawalURLRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatRevenueWithdrawalURLRequest) TypeID() uint32 { - return GetChatRevenueWithdrawalURLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatRevenueWithdrawalURLRequest) TypeName() string { - return "getChatRevenueWithdrawalUrl" -} - -// TypeInfo returns info about TL type. -func (g *GetChatRevenueWithdrawalURLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatRevenueWithdrawalUrl", - ID: GetChatRevenueWithdrawalURLRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatRevenueWithdrawalURLRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatRevenueWithdrawalUrl#1e320720 as nil") - } - b.PutID(GetChatRevenueWithdrawalURLRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatRevenueWithdrawalURLRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatRevenueWithdrawalUrl#1e320720 as nil") - } - b.PutInt53(g.ChatID) - b.PutString(g.Password) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatRevenueWithdrawalURLRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatRevenueWithdrawalUrl#1e320720 to nil") - } - if err := b.ConsumeID(GetChatRevenueWithdrawalURLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatRevenueWithdrawalUrl#1e320720: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatRevenueWithdrawalURLRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatRevenueWithdrawalUrl#1e320720 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueWithdrawalUrl#1e320720: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueWithdrawalUrl#1e320720: field password: %w", err) - } - g.Password = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatRevenueWithdrawalURLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatRevenueWithdrawalUrl#1e320720 as nil") - } - b.ObjStart() - b.PutID("getChatRevenueWithdrawalUrl") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("password") - b.PutString(g.Password) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatRevenueWithdrawalURLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatRevenueWithdrawalUrl#1e320720 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatRevenueWithdrawalUrl"); err != nil { - return fmt.Errorf("unable to decode getChatRevenueWithdrawalUrl#1e320720: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueWithdrawalUrl#1e320720: field chat_id: %w", err) - } - g.ChatID = value - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatRevenueWithdrawalUrl#1e320720: field password: %w", err) - } - g.Password = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatRevenueWithdrawalURLRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetPassword returns value of Password field. -func (g *GetChatRevenueWithdrawalURLRequest) GetPassword() (value string) { - if g == nil { - return - } - return g.Password -} - -// GetChatRevenueWithdrawalURL invokes method getChatRevenueWithdrawalUrl#1e320720 returning error if any. -func (c *Client) GetChatRevenueWithdrawalURL(ctx context.Context, request *GetChatRevenueWithdrawalURLRequest) (*HTTPURL, error) { - var result HTTPURL - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_scheduled_messages_gen.go b/tdapi/tl_get_chat_scheduled_messages_gen.go deleted file mode 100644 index 4c82d8b9b..000000000 --- a/tdapi/tl_get_chat_scheduled_messages_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatScheduledMessagesRequest represents TL type `getChatScheduledMessages#df3d2ffb`. -type GetChatScheduledMessagesRequest struct { - // Chat identifier - ChatID int64 -} - -// GetChatScheduledMessagesRequestTypeID is TL type id of GetChatScheduledMessagesRequest. -const GetChatScheduledMessagesRequestTypeID = 0xdf3d2ffb - -// Ensuring interfaces in compile-time for GetChatScheduledMessagesRequest. -var ( - _ bin.Encoder = &GetChatScheduledMessagesRequest{} - _ bin.Decoder = &GetChatScheduledMessagesRequest{} - _ bin.BareEncoder = &GetChatScheduledMessagesRequest{} - _ bin.BareDecoder = &GetChatScheduledMessagesRequest{} -) - -func (g *GetChatScheduledMessagesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatScheduledMessagesRequest) String() string { - if g == nil { - return "GetChatScheduledMessagesRequest(nil)" - } - type Alias GetChatScheduledMessagesRequest - return fmt.Sprintf("GetChatScheduledMessagesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatScheduledMessagesRequest) TypeID() uint32 { - return GetChatScheduledMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatScheduledMessagesRequest) TypeName() string { - return "getChatScheduledMessages" -} - -// TypeInfo returns info about TL type. -func (g *GetChatScheduledMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatScheduledMessages", - ID: GetChatScheduledMessagesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatScheduledMessagesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatScheduledMessages#df3d2ffb as nil") - } - b.PutID(GetChatScheduledMessagesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatScheduledMessagesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatScheduledMessages#df3d2ffb as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatScheduledMessagesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatScheduledMessages#df3d2ffb to nil") - } - if err := b.ConsumeID(GetChatScheduledMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatScheduledMessages#df3d2ffb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatScheduledMessagesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatScheduledMessages#df3d2ffb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatScheduledMessages#df3d2ffb: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatScheduledMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatScheduledMessages#df3d2ffb as nil") - } - b.ObjStart() - b.PutID("getChatScheduledMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatScheduledMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatScheduledMessages#df3d2ffb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatScheduledMessages"); err != nil { - return fmt.Errorf("unable to decode getChatScheduledMessages#df3d2ffb: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatScheduledMessages#df3d2ffb: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatScheduledMessagesRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChatScheduledMessages invokes method getChatScheduledMessages#df3d2ffb returning error if any. -func (c *Client) GetChatScheduledMessages(ctx context.Context, chatid int64) (*Messages, error) { - var result Messages - - request := &GetChatScheduledMessagesRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_similar_chat_count_gen.go b/tdapi/tl_get_chat_similar_chat_count_gen.go deleted file mode 100644 index 18156fd0a..000000000 --- a/tdapi/tl_get_chat_similar_chat_count_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatSimilarChatCountRequest represents TL type `getChatSimilarChatCount#463e968e`. -type GetChatSimilarChatCountRequest struct { - // Identifier of the target chat; must be an identifier of a channel chat - ChatID int64 - // Pass true to get the number of chats without sending network requests, or -1 if the - // number of chats is unknown locally - ReturnLocal bool -} - -// GetChatSimilarChatCountRequestTypeID is TL type id of GetChatSimilarChatCountRequest. -const GetChatSimilarChatCountRequestTypeID = 0x463e968e - -// Ensuring interfaces in compile-time for GetChatSimilarChatCountRequest. -var ( - _ bin.Encoder = &GetChatSimilarChatCountRequest{} - _ bin.Decoder = &GetChatSimilarChatCountRequest{} - _ bin.BareEncoder = &GetChatSimilarChatCountRequest{} - _ bin.BareDecoder = &GetChatSimilarChatCountRequest{} -) - -func (g *GetChatSimilarChatCountRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.ReturnLocal == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatSimilarChatCountRequest) String() string { - if g == nil { - return "GetChatSimilarChatCountRequest(nil)" - } - type Alias GetChatSimilarChatCountRequest - return fmt.Sprintf("GetChatSimilarChatCountRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatSimilarChatCountRequest) TypeID() uint32 { - return GetChatSimilarChatCountRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatSimilarChatCountRequest) TypeName() string { - return "getChatSimilarChatCount" -} - -// TypeInfo returns info about TL type. -func (g *GetChatSimilarChatCountRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatSimilarChatCount", - ID: GetChatSimilarChatCountRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ReturnLocal", - SchemaName: "return_local", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatSimilarChatCountRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatSimilarChatCount#463e968e as nil") - } - b.PutID(GetChatSimilarChatCountRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatSimilarChatCountRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatSimilarChatCount#463e968e as nil") - } - b.PutInt53(g.ChatID) - b.PutBool(g.ReturnLocal) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatSimilarChatCountRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatSimilarChatCount#463e968e to nil") - } - if err := b.ConsumeID(GetChatSimilarChatCountRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatSimilarChatCountRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatSimilarChatCount#463e968e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: field return_local: %w", err) - } - g.ReturnLocal = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatSimilarChatCountRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatSimilarChatCount#463e968e as nil") - } - b.ObjStart() - b.PutID("getChatSimilarChatCount") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("return_local") - b.PutBool(g.ReturnLocal) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatSimilarChatCountRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatSimilarChatCount#463e968e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatSimilarChatCount"); err != nil { - return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: field chat_id: %w", err) - } - g.ChatID = value - case "return_local": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatSimilarChatCount#463e968e: field return_local: %w", err) - } - g.ReturnLocal = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatSimilarChatCountRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetReturnLocal returns value of ReturnLocal field. -func (g *GetChatSimilarChatCountRequest) GetReturnLocal() (value bool) { - if g == nil { - return - } - return g.ReturnLocal -} - -// GetChatSimilarChatCount invokes method getChatSimilarChatCount#463e968e returning error if any. -func (c *Client) GetChatSimilarChatCount(ctx context.Context, request *GetChatSimilarChatCountRequest) (*Count, error) { - var result Count - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_similar_chats_gen.go b/tdapi/tl_get_chat_similar_chats_gen.go deleted file mode 100644 index 3b1aaa72e..000000000 --- a/tdapi/tl_get_chat_similar_chats_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatSimilarChatsRequest represents TL type `getChatSimilarChats#bb508f83`. -type GetChatSimilarChatsRequest struct { - // Identifier of the target chat; must be an identifier of a channel chat - ChatID int64 -} - -// GetChatSimilarChatsRequestTypeID is TL type id of GetChatSimilarChatsRequest. -const GetChatSimilarChatsRequestTypeID = 0xbb508f83 - -// Ensuring interfaces in compile-time for GetChatSimilarChatsRequest. -var ( - _ bin.Encoder = &GetChatSimilarChatsRequest{} - _ bin.Decoder = &GetChatSimilarChatsRequest{} - _ bin.BareEncoder = &GetChatSimilarChatsRequest{} - _ bin.BareDecoder = &GetChatSimilarChatsRequest{} -) - -func (g *GetChatSimilarChatsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatSimilarChatsRequest) String() string { - if g == nil { - return "GetChatSimilarChatsRequest(nil)" - } - type Alias GetChatSimilarChatsRequest - return fmt.Sprintf("GetChatSimilarChatsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatSimilarChatsRequest) TypeID() uint32 { - return GetChatSimilarChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatSimilarChatsRequest) TypeName() string { - return "getChatSimilarChats" -} - -// TypeInfo returns info about TL type. -func (g *GetChatSimilarChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatSimilarChats", - ID: GetChatSimilarChatsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatSimilarChatsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatSimilarChats#bb508f83 as nil") - } - b.PutID(GetChatSimilarChatsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatSimilarChatsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatSimilarChats#bb508f83 as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatSimilarChatsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatSimilarChats#bb508f83 to nil") - } - if err := b.ConsumeID(GetChatSimilarChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatSimilarChats#bb508f83: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatSimilarChatsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatSimilarChats#bb508f83 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSimilarChats#bb508f83: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatSimilarChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatSimilarChats#bb508f83 as nil") - } - b.ObjStart() - b.PutID("getChatSimilarChats") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatSimilarChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatSimilarChats#bb508f83 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatSimilarChats"); err != nil { - return fmt.Errorf("unable to decode getChatSimilarChats#bb508f83: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSimilarChats#bb508f83: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatSimilarChatsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChatSimilarChats invokes method getChatSimilarChats#bb508f83 returning error if any. -func (c *Client) GetChatSimilarChats(ctx context.Context, chatid int64) (*Chats, error) { - var result Chats - - request := &GetChatSimilarChatsRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_sparse_message_positions_gen.go b/tdapi/tl_get_chat_sparse_message_positions_gen.go deleted file mode 100644 index 2747c6d91..000000000 --- a/tdapi/tl_get_chat_sparse_message_positions_gen.go +++ /dev/null @@ -1,353 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatSparseMessagePositionsRequest represents TL type `getChatSparseMessagePositions#3b452efd`. -type GetChatSparseMessagePositionsRequest struct { - // Identifier of the chat in which to return information about message positions - ChatID int64 - // Filter for message content. Filters searchMessagesFilterEmpty, - // searchMessagesFilterMention, searchMessagesFilterUnreadMention, and - // searchMessagesFilterUnreadReaction are unsupported in this function - Filter SearchMessagesFilterClass - // The message identifier from which to return information about message positions - FromMessageID int64 - // The expected number of message positions to be returned; 50-2000. A smaller number of - // positions can be returned, if there are not enough appropriate messages - Limit int32 - // If not 0, only messages in the specified Saved Messages topic will be considered; pass - // 0 to consider all messages, or for chats other than Saved Messages - SavedMessagesTopicID int64 -} - -// GetChatSparseMessagePositionsRequestTypeID is TL type id of GetChatSparseMessagePositionsRequest. -const GetChatSparseMessagePositionsRequestTypeID = 0x3b452efd - -// Ensuring interfaces in compile-time for GetChatSparseMessagePositionsRequest. -var ( - _ bin.Encoder = &GetChatSparseMessagePositionsRequest{} - _ bin.Decoder = &GetChatSparseMessagePositionsRequest{} - _ bin.BareEncoder = &GetChatSparseMessagePositionsRequest{} - _ bin.BareDecoder = &GetChatSparseMessagePositionsRequest{} -) - -func (g *GetChatSparseMessagePositionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.Filter == nil) { - return false - } - if !(g.FromMessageID == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - if !(g.SavedMessagesTopicID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatSparseMessagePositionsRequest) String() string { - if g == nil { - return "GetChatSparseMessagePositionsRequest(nil)" - } - type Alias GetChatSparseMessagePositionsRequest - return fmt.Sprintf("GetChatSparseMessagePositionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatSparseMessagePositionsRequest) TypeID() uint32 { - return GetChatSparseMessagePositionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatSparseMessagePositionsRequest) TypeName() string { - return "getChatSparseMessagePositions" -} - -// TypeInfo returns info about TL type. -func (g *GetChatSparseMessagePositionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatSparseMessagePositions", - ID: GetChatSparseMessagePositionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Filter", - SchemaName: "filter", - }, - { - Name: "FromMessageID", - SchemaName: "from_message_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatSparseMessagePositionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatSparseMessagePositions#3b452efd as nil") - } - b.PutID(GetChatSparseMessagePositionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatSparseMessagePositionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatSparseMessagePositions#3b452efd as nil") - } - b.PutInt53(g.ChatID) - if g.Filter == nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#3b452efd: field filter is nil") - } - if err := g.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#3b452efd: field filter: %w", err) - } - b.PutInt53(g.FromMessageID) - b.PutInt32(g.Limit) - b.PutInt53(g.SavedMessagesTopicID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatSparseMessagePositionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatSparseMessagePositions#3b452efd to nil") - } - if err := b.ConsumeID(GetChatSparseMessagePositionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatSparseMessagePositionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatSparseMessagePositions#3b452efd to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := DecodeSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field filter: %w", err) - } - g.Filter = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field from_message_id: %w", err) - } - g.FromMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field limit: %w", err) - } - g.Limit = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatSparseMessagePositionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatSparseMessagePositions#3b452efd as nil") - } - b.ObjStart() - b.PutID("getChatSparseMessagePositions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("filter") - if g.Filter == nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#3b452efd: field filter is nil") - } - if err := g.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatSparseMessagePositions#3b452efd: field filter: %w", err) - } - b.Comma() - b.FieldStart("from_message_id") - b.PutInt53(g.FromMessageID) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(g.SavedMessagesTopicID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatSparseMessagePositionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatSparseMessagePositions#3b452efd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatSparseMessagePositions"); err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field chat_id: %w", err) - } - g.ChatID = value - case "filter": - value, err := DecodeTDLibJSONSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field filter: %w", err) - } - g.Filter = value - case "from_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field from_message_id: %w", err) - } - g.FromMessageID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field limit: %w", err) - } - g.Limit = value - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSparseMessagePositions#3b452efd: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatSparseMessagePositionsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetFilter returns value of Filter field. -func (g *GetChatSparseMessagePositionsRequest) GetFilter() (value SearchMessagesFilterClass) { - if g == nil { - return - } - return g.Filter -} - -// GetFromMessageID returns value of FromMessageID field. -func (g *GetChatSparseMessagePositionsRequest) GetFromMessageID() (value int64) { - if g == nil { - return - } - return g.FromMessageID -} - -// GetLimit returns value of Limit field. -func (g *GetChatSparseMessagePositionsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (g *GetChatSparseMessagePositionsRequest) GetSavedMessagesTopicID() (value int64) { - if g == nil { - return - } - return g.SavedMessagesTopicID -} - -// GetChatSparseMessagePositions invokes method getChatSparseMessagePositions#3b452efd returning error if any. -func (c *Client) GetChatSparseMessagePositions(ctx context.Context, request *GetChatSparseMessagePositionsRequest) (*MessagePositions, error) { - var result MessagePositions - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_sponsored_messages_gen.go b/tdapi/tl_get_chat_sponsored_messages_gen.go deleted file mode 100644 index 471fd28a4..000000000 --- a/tdapi/tl_get_chat_sponsored_messages_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatSponsoredMessagesRequest represents TL type `getChatSponsoredMessages#50a84098`. -type GetChatSponsoredMessagesRequest struct { - // Identifier of the chat - ChatID int64 -} - -// GetChatSponsoredMessagesRequestTypeID is TL type id of GetChatSponsoredMessagesRequest. -const GetChatSponsoredMessagesRequestTypeID = 0x50a84098 - -// Ensuring interfaces in compile-time for GetChatSponsoredMessagesRequest. -var ( - _ bin.Encoder = &GetChatSponsoredMessagesRequest{} - _ bin.Decoder = &GetChatSponsoredMessagesRequest{} - _ bin.BareEncoder = &GetChatSponsoredMessagesRequest{} - _ bin.BareDecoder = &GetChatSponsoredMessagesRequest{} -) - -func (g *GetChatSponsoredMessagesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatSponsoredMessagesRequest) String() string { - if g == nil { - return "GetChatSponsoredMessagesRequest(nil)" - } - type Alias GetChatSponsoredMessagesRequest - return fmt.Sprintf("GetChatSponsoredMessagesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatSponsoredMessagesRequest) TypeID() uint32 { - return GetChatSponsoredMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatSponsoredMessagesRequest) TypeName() string { - return "getChatSponsoredMessages" -} - -// TypeInfo returns info about TL type. -func (g *GetChatSponsoredMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatSponsoredMessages", - ID: GetChatSponsoredMessagesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatSponsoredMessagesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatSponsoredMessages#50a84098 as nil") - } - b.PutID(GetChatSponsoredMessagesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatSponsoredMessagesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatSponsoredMessages#50a84098 as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatSponsoredMessagesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatSponsoredMessages#50a84098 to nil") - } - if err := b.ConsumeID(GetChatSponsoredMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatSponsoredMessages#50a84098: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatSponsoredMessagesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatSponsoredMessages#50a84098 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSponsoredMessages#50a84098: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatSponsoredMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatSponsoredMessages#50a84098 as nil") - } - b.ObjStart() - b.PutID("getChatSponsoredMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatSponsoredMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatSponsoredMessages#50a84098 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatSponsoredMessages"); err != nil { - return fmt.Errorf("unable to decode getChatSponsoredMessages#50a84098: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatSponsoredMessages#50a84098: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatSponsoredMessagesRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetChatSponsoredMessages invokes method getChatSponsoredMessages#50a84098 returning error if any. -func (c *Client) GetChatSponsoredMessages(ctx context.Context, chatid int64) (*SponsoredMessages, error) { - var result SponsoredMessages - - request := &GetChatSponsoredMessagesRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chat_statistics_gen.go b/tdapi/tl_get_chat_statistics_gen.go deleted file mode 100644 index 96305dbd3..000000000 --- a/tdapi/tl_get_chat_statistics_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatStatisticsRequest represents TL type `getChatStatistics#137e8198`. -type GetChatStatisticsRequest struct { - // Chat identifier - ChatID int64 - // Pass true if a dark theme is used by the application - IsDark bool -} - -// GetChatStatisticsRequestTypeID is TL type id of GetChatStatisticsRequest. -const GetChatStatisticsRequestTypeID = 0x137e8198 - -// Ensuring interfaces in compile-time for GetChatStatisticsRequest. -var ( - _ bin.Encoder = &GetChatStatisticsRequest{} - _ bin.Decoder = &GetChatStatisticsRequest{} - _ bin.BareEncoder = &GetChatStatisticsRequest{} - _ bin.BareDecoder = &GetChatStatisticsRequest{} -) - -func (g *GetChatStatisticsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.IsDark == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatStatisticsRequest) String() string { - if g == nil { - return "GetChatStatisticsRequest(nil)" - } - type Alias GetChatStatisticsRequest - return fmt.Sprintf("GetChatStatisticsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatStatisticsRequest) TypeID() uint32 { - return GetChatStatisticsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatStatisticsRequest) TypeName() string { - return "getChatStatistics" -} - -// TypeInfo returns info about TL type. -func (g *GetChatStatisticsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatStatistics", - ID: GetChatStatisticsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "IsDark", - SchemaName: "is_dark", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatStatisticsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatStatistics#137e8198 as nil") - } - b.PutID(GetChatStatisticsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatStatisticsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatStatistics#137e8198 as nil") - } - b.PutInt53(g.ChatID) - b.PutBool(g.IsDark) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatStatisticsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatStatistics#137e8198 to nil") - } - if err := b.ConsumeID(GetChatStatisticsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatStatistics#137e8198: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatStatisticsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatStatistics#137e8198 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatStatistics#137e8198: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatStatistics#137e8198: field is_dark: %w", err) - } - g.IsDark = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatStatisticsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatStatistics#137e8198 as nil") - } - b.ObjStart() - b.PutID("getChatStatistics") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("is_dark") - b.PutBool(g.IsDark) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatStatisticsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatStatistics#137e8198 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatStatistics"); err != nil { - return fmt.Errorf("unable to decode getChatStatistics#137e8198: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatStatistics#137e8198: field chat_id: %w", err) - } - g.ChatID = value - case "is_dark": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatStatistics#137e8198: field is_dark: %w", err) - } - g.IsDark = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetChatStatisticsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetIsDark returns value of IsDark field. -func (g *GetChatStatisticsRequest) GetIsDark() (value bool) { - if g == nil { - return - } - return g.IsDark -} - -// GetChatStatistics invokes method getChatStatistics#137e8198 returning error if any. -func (c *Client) GetChatStatistics(ctx context.Context, request *GetChatStatisticsRequest) (ChatStatisticsClass, error) { - var result ChatStatisticsBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.ChatStatistics, nil -} diff --git a/tdapi/tl_get_chat_story_interactions_gen.go b/tdapi/tl_get_chat_story_interactions_gen.go deleted file mode 100644 index 060c0efed..000000000 --- a/tdapi/tl_get_chat_story_interactions_gen.go +++ /dev/null @@ -1,387 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatStoryInteractionsRequest represents TL type `getChatStoryInteractions#c5ec7376`. -type GetChatStoryInteractionsRequest struct { - // The identifier of the sender of the story - StorySenderChatID int64 - // Story identifier - StoryID int32 - // Pass the default heart reaction or a suggested reaction type to receive only - // interactions with the specified reaction type; pass null to receive all interactions; - // reactionTypePaid isn't supported - ReactionType ReactionTypeClass - // Pass true to get forwards and reposts first, then reactions, then other views; pass - // false to get interactions sorted just by interaction date - PreferForwards bool - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of story interactions to return - Limit int32 -} - -// GetChatStoryInteractionsRequestTypeID is TL type id of GetChatStoryInteractionsRequest. -const GetChatStoryInteractionsRequestTypeID = 0xc5ec7376 - -// Ensuring interfaces in compile-time for GetChatStoryInteractionsRequest. -var ( - _ bin.Encoder = &GetChatStoryInteractionsRequest{} - _ bin.Decoder = &GetChatStoryInteractionsRequest{} - _ bin.BareEncoder = &GetChatStoryInteractionsRequest{} - _ bin.BareDecoder = &GetChatStoryInteractionsRequest{} -) - -func (g *GetChatStoryInteractionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.StorySenderChatID == 0) { - return false - } - if !(g.StoryID == 0) { - return false - } - if !(g.ReactionType == nil) { - return false - } - if !(g.PreferForwards == false) { - return false - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatStoryInteractionsRequest) String() string { - if g == nil { - return "GetChatStoryInteractionsRequest(nil)" - } - type Alias GetChatStoryInteractionsRequest - return fmt.Sprintf("GetChatStoryInteractionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatStoryInteractionsRequest) TypeID() uint32 { - return GetChatStoryInteractionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatStoryInteractionsRequest) TypeName() string { - return "getChatStoryInteractions" -} - -// TypeInfo returns info about TL type. -func (g *GetChatStoryInteractionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatStoryInteractions", - ID: GetChatStoryInteractionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "ReactionType", - SchemaName: "reaction_type", - }, - { - Name: "PreferForwards", - SchemaName: "prefer_forwards", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatStoryInteractionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatStoryInteractions#c5ec7376 as nil") - } - b.PutID(GetChatStoryInteractionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatStoryInteractionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatStoryInteractions#c5ec7376 as nil") - } - b.PutInt53(g.StorySenderChatID) - b.PutInt32(g.StoryID) - if g.ReactionType == nil { - return fmt.Errorf("unable to encode getChatStoryInteractions#c5ec7376: field reaction_type is nil") - } - if err := g.ReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChatStoryInteractions#c5ec7376: field reaction_type: %w", err) - } - b.PutBool(g.PreferForwards) - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatStoryInteractionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatStoryInteractions#c5ec7376 to nil") - } - if err := b.ConsumeID(GetChatStoryInteractionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatStoryInteractionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatStoryInteractions#c5ec7376 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field story_sender_chat_id: %w", err) - } - g.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field story_id: %w", err) - } - g.StoryID = value - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field reaction_type: %w", err) - } - g.ReactionType = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field prefer_forwards: %w", err) - } - g.PreferForwards = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatStoryInteractionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatStoryInteractions#c5ec7376 as nil") - } - b.ObjStart() - b.PutID("getChatStoryInteractions") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(g.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(g.StoryID) - b.Comma() - b.FieldStart("reaction_type") - if g.ReactionType == nil { - return fmt.Errorf("unable to encode getChatStoryInteractions#c5ec7376: field reaction_type is nil") - } - if err := g.ReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChatStoryInteractions#c5ec7376: field reaction_type: %w", err) - } - b.Comma() - b.FieldStart("prefer_forwards") - b.PutBool(g.PreferForwards) - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatStoryInteractionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatStoryInteractions#c5ec7376 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatStoryInteractions"); err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field story_sender_chat_id: %w", err) - } - g.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field story_id: %w", err) - } - g.StoryID = value - case "reaction_type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field reaction_type: %w", err) - } - g.ReactionType = value - case "prefer_forwards": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field prefer_forwards: %w", err) - } - g.PreferForwards = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatStoryInteractions#c5ec7376: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (g *GetChatStoryInteractionsRequest) GetStorySenderChatID() (value int64) { - if g == nil { - return - } - return g.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (g *GetChatStoryInteractionsRequest) GetStoryID() (value int32) { - if g == nil { - return - } - return g.StoryID -} - -// GetReactionType returns value of ReactionType field. -func (g *GetChatStoryInteractionsRequest) GetReactionType() (value ReactionTypeClass) { - if g == nil { - return - } - return g.ReactionType -} - -// GetPreferForwards returns value of PreferForwards field. -func (g *GetChatStoryInteractionsRequest) GetPreferForwards() (value bool) { - if g == nil { - return - } - return g.PreferForwards -} - -// GetOffset returns value of Offset field. -func (g *GetChatStoryInteractionsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetChatStoryInteractionsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChatStoryInteractions invokes method getChatStoryInteractions#c5ec7376 returning error if any. -func (c *Client) GetChatStoryInteractions(ctx context.Context, request *GetChatStoryInteractionsRequest) (*StoryInteractions, error) { - var result StoryInteractions - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chats_for_chat_folder_invite_link_gen.go b/tdapi/tl_get_chats_for_chat_folder_invite_link_gen.go deleted file mode 100644 index 6a4cd66ec..000000000 --- a/tdapi/tl_get_chats_for_chat_folder_invite_link_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatsForChatFolderInviteLinkRequest represents TL type `getChatsForChatFolderInviteLink#6fac4949`. -type GetChatsForChatFolderInviteLinkRequest struct { - // Chat folder identifier - ChatFolderID int32 -} - -// GetChatsForChatFolderInviteLinkRequestTypeID is TL type id of GetChatsForChatFolderInviteLinkRequest. -const GetChatsForChatFolderInviteLinkRequestTypeID = 0x6fac4949 - -// Ensuring interfaces in compile-time for GetChatsForChatFolderInviteLinkRequest. -var ( - _ bin.Encoder = &GetChatsForChatFolderInviteLinkRequest{} - _ bin.Decoder = &GetChatsForChatFolderInviteLinkRequest{} - _ bin.BareEncoder = &GetChatsForChatFolderInviteLinkRequest{} - _ bin.BareDecoder = &GetChatsForChatFolderInviteLinkRequest{} -) - -func (g *GetChatsForChatFolderInviteLinkRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatFolderID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatsForChatFolderInviteLinkRequest) String() string { - if g == nil { - return "GetChatsForChatFolderInviteLinkRequest(nil)" - } - type Alias GetChatsForChatFolderInviteLinkRequest - return fmt.Sprintf("GetChatsForChatFolderInviteLinkRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatsForChatFolderInviteLinkRequest) TypeID() uint32 { - return GetChatsForChatFolderInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatsForChatFolderInviteLinkRequest) TypeName() string { - return "getChatsForChatFolderInviteLink" -} - -// TypeInfo returns info about TL type. -func (g *GetChatsForChatFolderInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatsForChatFolderInviteLink", - ID: GetChatsForChatFolderInviteLinkRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatsForChatFolderInviteLinkRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatsForChatFolderInviteLink#6fac4949 as nil") - } - b.PutID(GetChatsForChatFolderInviteLinkRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatsForChatFolderInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatsForChatFolderInviteLink#6fac4949 as nil") - } - b.PutInt32(g.ChatFolderID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatsForChatFolderInviteLinkRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatsForChatFolderInviteLink#6fac4949 to nil") - } - if err := b.ConsumeID(GetChatsForChatFolderInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatsForChatFolderInviteLink#6fac4949: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatsForChatFolderInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatsForChatFolderInviteLink#6fac4949 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatsForChatFolderInviteLink#6fac4949: field chat_folder_id: %w", err) - } - g.ChatFolderID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatsForChatFolderInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatsForChatFolderInviteLink#6fac4949 as nil") - } - b.ObjStart() - b.PutID("getChatsForChatFolderInviteLink") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(g.ChatFolderID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatsForChatFolderInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatsForChatFolderInviteLink#6fac4949 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatsForChatFolderInviteLink"); err != nil { - return fmt.Errorf("unable to decode getChatsForChatFolderInviteLink#6fac4949: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChatsForChatFolderInviteLink#6fac4949: field chat_folder_id: %w", err) - } - g.ChatFolderID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (g *GetChatsForChatFolderInviteLinkRequest) GetChatFolderID() (value int32) { - if g == nil { - return - } - return g.ChatFolderID -} - -// GetChatsForChatFolderInviteLink invokes method getChatsForChatFolderInviteLink#6fac4949 returning error if any. -func (c *Client) GetChatsForChatFolderInviteLink(ctx context.Context, chatfolderid int32) (*Chats, error) { - var result Chats - - request := &GetChatsForChatFolderInviteLinkRequest{ - ChatFolderID: chatfolderid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chats_gen.go b/tdapi/tl_get_chats_gen.go deleted file mode 100644 index 59302ae3b..000000000 --- a/tdapi/tl_get_chats_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatsRequest represents TL type `getChats#c604bac2`. -type GetChatsRequest struct { - // The chat list in which to return chats; pass null to get chats from the main chat list - ChatList ChatListClass - // The maximum number of chats to be returned - Limit int32 -} - -// GetChatsRequestTypeID is TL type id of GetChatsRequest. -const GetChatsRequestTypeID = 0xc604bac2 - -// Ensuring interfaces in compile-time for GetChatsRequest. -var ( - _ bin.Encoder = &GetChatsRequest{} - _ bin.Decoder = &GetChatsRequest{} - _ bin.BareEncoder = &GetChatsRequest{} - _ bin.BareDecoder = &GetChatsRequest{} -) - -func (g *GetChatsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatList == nil) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatsRequest) String() string { - if g == nil { - return "GetChatsRequest(nil)" - } - type Alias GetChatsRequest - return fmt.Sprintf("GetChatsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatsRequest) TypeID() uint32 { - return GetChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatsRequest) TypeName() string { - return "getChats" -} - -// TypeInfo returns info about TL type. -func (g *GetChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChats", - ID: GetChatsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatList", - SchemaName: "chat_list", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChats#c604bac2 as nil") - } - b.PutID(GetChatsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChats#c604bac2 as nil") - } - if g.ChatList == nil { - return fmt.Errorf("unable to encode getChats#c604bac2: field chat_list is nil") - } - if err := g.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode getChats#c604bac2: field chat_list: %w", err) - } - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChats#c604bac2 to nil") - } - if err := b.ConsumeID(GetChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChats#c604bac2: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChats#c604bac2 to nil") - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode getChats#c604bac2: field chat_list: %w", err) - } - g.ChatList = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChats#c604bac2: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChats#c604bac2 as nil") - } - b.ObjStart() - b.PutID("getChats") - b.Comma() - b.FieldStart("chat_list") - if g.ChatList == nil { - return fmt.Errorf("unable to encode getChats#c604bac2: field chat_list is nil") - } - if err := g.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getChats#c604bac2: field chat_list: %w", err) - } - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChats#c604bac2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChats"); err != nil { - return fmt.Errorf("unable to decode getChats#c604bac2: %w", err) - } - case "chat_list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode getChats#c604bac2: field chat_list: %w", err) - } - g.ChatList = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getChats#c604bac2: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatList returns value of ChatList field. -func (g *GetChatsRequest) GetChatList() (value ChatListClass) { - if g == nil { - return - } - return g.ChatList -} - -// GetLimit returns value of Limit field. -func (g *GetChatsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChats invokes method getChats#c604bac2 returning error if any. -func (c *Client) GetChats(ctx context.Context, request *GetChatsRequest) (*Chats, error) { - var result Chats - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_chats_to_send_stories_gen.go b/tdapi/tl_get_chats_to_send_stories_gen.go deleted file mode 100644 index 2f91f9b99..000000000 --- a/tdapi/tl_get_chats_to_send_stories_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetChatsToSendStoriesRequest represents TL type `getChatsToSendStories#22f9e3a4`. -type GetChatsToSendStoriesRequest struct { -} - -// GetChatsToSendStoriesRequestTypeID is TL type id of GetChatsToSendStoriesRequest. -const GetChatsToSendStoriesRequestTypeID = 0x22f9e3a4 - -// Ensuring interfaces in compile-time for GetChatsToSendStoriesRequest. -var ( - _ bin.Encoder = &GetChatsToSendStoriesRequest{} - _ bin.Decoder = &GetChatsToSendStoriesRequest{} - _ bin.BareEncoder = &GetChatsToSendStoriesRequest{} - _ bin.BareDecoder = &GetChatsToSendStoriesRequest{} -) - -func (g *GetChatsToSendStoriesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetChatsToSendStoriesRequest) String() string { - if g == nil { - return "GetChatsToSendStoriesRequest(nil)" - } - type Alias GetChatsToSendStoriesRequest - return fmt.Sprintf("GetChatsToSendStoriesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetChatsToSendStoriesRequest) TypeID() uint32 { - return GetChatsToSendStoriesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetChatsToSendStoriesRequest) TypeName() string { - return "getChatsToSendStories" -} - -// TypeInfo returns info about TL type. -func (g *GetChatsToSendStoriesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getChatsToSendStories", - ID: GetChatsToSendStoriesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetChatsToSendStoriesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatsToSendStories#22f9e3a4 as nil") - } - b.PutID(GetChatsToSendStoriesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetChatsToSendStoriesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getChatsToSendStories#22f9e3a4 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetChatsToSendStoriesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatsToSendStories#22f9e3a4 to nil") - } - if err := b.ConsumeID(GetChatsToSendStoriesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getChatsToSendStories#22f9e3a4: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetChatsToSendStoriesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getChatsToSendStories#22f9e3a4 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetChatsToSendStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getChatsToSendStories#22f9e3a4 as nil") - } - b.ObjStart() - b.PutID("getChatsToSendStories") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetChatsToSendStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getChatsToSendStories#22f9e3a4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getChatsToSendStories"); err != nil { - return fmt.Errorf("unable to decode getChatsToSendStories#22f9e3a4: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatsToSendStories invokes method getChatsToSendStories#22f9e3a4 returning error if any. -func (c *Client) GetChatsToSendStories(ctx context.Context) (*Chats, error) { - var result Chats - - request := &GetChatsToSendStoriesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_close_friends_gen.go b/tdapi/tl_get_close_friends_gen.go deleted file mode 100644 index 7c52d7132..000000000 --- a/tdapi/tl_get_close_friends_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCloseFriendsRequest represents TL type `getCloseFriends#a9d574ce`. -type GetCloseFriendsRequest struct { -} - -// GetCloseFriendsRequestTypeID is TL type id of GetCloseFriendsRequest. -const GetCloseFriendsRequestTypeID = 0xa9d574ce - -// Ensuring interfaces in compile-time for GetCloseFriendsRequest. -var ( - _ bin.Encoder = &GetCloseFriendsRequest{} - _ bin.Decoder = &GetCloseFriendsRequest{} - _ bin.BareEncoder = &GetCloseFriendsRequest{} - _ bin.BareDecoder = &GetCloseFriendsRequest{} -) - -func (g *GetCloseFriendsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCloseFriendsRequest) String() string { - if g == nil { - return "GetCloseFriendsRequest(nil)" - } - type Alias GetCloseFriendsRequest - return fmt.Sprintf("GetCloseFriendsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCloseFriendsRequest) TypeID() uint32 { - return GetCloseFriendsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCloseFriendsRequest) TypeName() string { - return "getCloseFriends" -} - -// TypeInfo returns info about TL type. -func (g *GetCloseFriendsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCloseFriends", - ID: GetCloseFriendsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCloseFriendsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCloseFriends#a9d574ce as nil") - } - b.PutID(GetCloseFriendsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCloseFriendsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCloseFriends#a9d574ce as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCloseFriendsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCloseFriends#a9d574ce to nil") - } - if err := b.ConsumeID(GetCloseFriendsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCloseFriends#a9d574ce: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCloseFriendsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCloseFriends#a9d574ce to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCloseFriendsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCloseFriends#a9d574ce as nil") - } - b.ObjStart() - b.PutID("getCloseFriends") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCloseFriendsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCloseFriends#a9d574ce to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCloseFriends"); err != nil { - return fmt.Errorf("unable to decode getCloseFriends#a9d574ce: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCloseFriends invokes method getCloseFriends#a9d574ce returning error if any. -func (c *Client) GetCloseFriends(ctx context.Context) (*Users, error) { - var result Users - - request := &GetCloseFriendsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_collectible_item_info_gen.go b/tdapi/tl_get_collectible_item_info_gen.go deleted file mode 100644 index 57db4b7c7..000000000 --- a/tdapi/tl_get_collectible_item_info_gen.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCollectibleItemInfoRequest represents TL type `getCollectibleItemInfo#f304ad8a`. -type GetCollectibleItemInfoRequest struct { - // Type of the collectible item. The item must be used by a user and must be visible to - // the current user - Type CollectibleItemTypeClass -} - -// GetCollectibleItemInfoRequestTypeID is TL type id of GetCollectibleItemInfoRequest. -const GetCollectibleItemInfoRequestTypeID = 0xf304ad8a - -// Ensuring interfaces in compile-time for GetCollectibleItemInfoRequest. -var ( - _ bin.Encoder = &GetCollectibleItemInfoRequest{} - _ bin.Decoder = &GetCollectibleItemInfoRequest{} - _ bin.BareEncoder = &GetCollectibleItemInfoRequest{} - _ bin.BareDecoder = &GetCollectibleItemInfoRequest{} -) - -func (g *GetCollectibleItemInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCollectibleItemInfoRequest) String() string { - if g == nil { - return "GetCollectibleItemInfoRequest(nil)" - } - type Alias GetCollectibleItemInfoRequest - return fmt.Sprintf("GetCollectibleItemInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCollectibleItemInfoRequest) TypeID() uint32 { - return GetCollectibleItemInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCollectibleItemInfoRequest) TypeName() string { - return "getCollectibleItemInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetCollectibleItemInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCollectibleItemInfo", - ID: GetCollectibleItemInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCollectibleItemInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCollectibleItemInfo#f304ad8a as nil") - } - b.PutID(GetCollectibleItemInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCollectibleItemInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCollectibleItemInfo#f304ad8a as nil") - } - if g.Type == nil { - return fmt.Errorf("unable to encode getCollectibleItemInfo#f304ad8a: field type is nil") - } - if err := g.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode getCollectibleItemInfo#f304ad8a: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCollectibleItemInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCollectibleItemInfo#f304ad8a to nil") - } - if err := b.ConsumeID(GetCollectibleItemInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCollectibleItemInfo#f304ad8a: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCollectibleItemInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCollectibleItemInfo#f304ad8a to nil") - } - { - value, err := DecodeCollectibleItemType(b) - if err != nil { - return fmt.Errorf("unable to decode getCollectibleItemInfo#f304ad8a: field type: %w", err) - } - g.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCollectibleItemInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCollectibleItemInfo#f304ad8a as nil") - } - b.ObjStart() - b.PutID("getCollectibleItemInfo") - b.Comma() - b.FieldStart("type") - if g.Type == nil { - return fmt.Errorf("unable to encode getCollectibleItemInfo#f304ad8a: field type is nil") - } - if err := g.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getCollectibleItemInfo#f304ad8a: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCollectibleItemInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCollectibleItemInfo#f304ad8a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCollectibleItemInfo"); err != nil { - return fmt.Errorf("unable to decode getCollectibleItemInfo#f304ad8a: %w", err) - } - case "type": - value, err := DecodeTDLibJSONCollectibleItemType(b) - if err != nil { - return fmt.Errorf("unable to decode getCollectibleItemInfo#f304ad8a: field type: %w", err) - } - g.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (g *GetCollectibleItemInfoRequest) GetType() (value CollectibleItemTypeClass) { - if g == nil { - return - } - return g.Type -} - -// GetCollectibleItemInfo invokes method getCollectibleItemInfo#f304ad8a returning error if any. -func (c *Client) GetCollectibleItemInfo(ctx context.Context, type_ CollectibleItemTypeClass) (*CollectibleItemInfo, error) { - var result CollectibleItemInfo - - request := &GetCollectibleItemInfoRequest{ - Type: type_, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_commands_gen.go b/tdapi/tl_get_commands_gen.go deleted file mode 100644 index d6ee34664..000000000 --- a/tdapi/tl_get_commands_gen.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCommandsRequest represents TL type `getCommands#58ba8ff7`. -type GetCommandsRequest struct { - // The scope to which the commands are relevant; pass null to get commands in the default - // bot command scope - Scope BotCommandScopeClass - // A two-letter ISO 639-1 language code or an empty string - LanguageCode string -} - -// GetCommandsRequestTypeID is TL type id of GetCommandsRequest. -const GetCommandsRequestTypeID = 0x58ba8ff7 - -// Ensuring interfaces in compile-time for GetCommandsRequest. -var ( - _ bin.Encoder = &GetCommandsRequest{} - _ bin.Decoder = &GetCommandsRequest{} - _ bin.BareEncoder = &GetCommandsRequest{} - _ bin.BareDecoder = &GetCommandsRequest{} -) - -func (g *GetCommandsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Scope == nil) { - return false - } - if !(g.LanguageCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCommandsRequest) String() string { - if g == nil { - return "GetCommandsRequest(nil)" - } - type Alias GetCommandsRequest - return fmt.Sprintf("GetCommandsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCommandsRequest) TypeID() uint32 { - return GetCommandsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCommandsRequest) TypeName() string { - return "getCommands" -} - -// TypeInfo returns info about TL type. -func (g *GetCommandsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCommands", - ID: GetCommandsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Scope", - SchemaName: "scope", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCommandsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCommands#58ba8ff7 as nil") - } - b.PutID(GetCommandsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCommandsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCommands#58ba8ff7 as nil") - } - if g.Scope == nil { - return fmt.Errorf("unable to encode getCommands#58ba8ff7: field scope is nil") - } - if err := g.Scope.Encode(b); err != nil { - return fmt.Errorf("unable to encode getCommands#58ba8ff7: field scope: %w", err) - } - b.PutString(g.LanguageCode) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCommandsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCommands#58ba8ff7 to nil") - } - if err := b.ConsumeID(GetCommandsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCommands#58ba8ff7: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCommandsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCommands#58ba8ff7 to nil") - } - { - value, err := DecodeBotCommandScope(b) - if err != nil { - return fmt.Errorf("unable to decode getCommands#58ba8ff7: field scope: %w", err) - } - g.Scope = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getCommands#58ba8ff7: field language_code: %w", err) - } - g.LanguageCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCommandsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCommands#58ba8ff7 as nil") - } - b.ObjStart() - b.PutID("getCommands") - b.Comma() - b.FieldStart("scope") - if g.Scope == nil { - return fmt.Errorf("unable to encode getCommands#58ba8ff7: field scope is nil") - } - if err := g.Scope.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getCommands#58ba8ff7: field scope: %w", err) - } - b.Comma() - b.FieldStart("language_code") - b.PutString(g.LanguageCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCommandsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCommands#58ba8ff7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCommands"); err != nil { - return fmt.Errorf("unable to decode getCommands#58ba8ff7: %w", err) - } - case "scope": - value, err := DecodeTDLibJSONBotCommandScope(b) - if err != nil { - return fmt.Errorf("unable to decode getCommands#58ba8ff7: field scope: %w", err) - } - g.Scope = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getCommands#58ba8ff7: field language_code: %w", err) - } - g.LanguageCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetScope returns value of Scope field. -func (g *GetCommandsRequest) GetScope() (value BotCommandScopeClass) { - if g == nil { - return - } - return g.Scope -} - -// GetLanguageCode returns value of LanguageCode field. -func (g *GetCommandsRequest) GetLanguageCode() (value string) { - if g == nil { - return - } - return g.LanguageCode -} - -// GetCommands invokes method getCommands#58ba8ff7 returning error if any. -func (c *Client) GetCommands(ctx context.Context, request *GetCommandsRequest) (*BotCommands, error) { - var result BotCommands - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_connected_affiliate_program_gen.go b/tdapi/tl_get_connected_affiliate_program_gen.go deleted file mode 100644 index 413c2b136..000000000 --- a/tdapi/tl_get_connected_affiliate_program_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetConnectedAffiliateProgramRequest represents TL type `getConnectedAffiliateProgram#9761e770`. -type GetConnectedAffiliateProgramRequest struct { - // The affiliate to which the affiliate program will be connected - Affiliate AffiliateTypeClass - // Identifier of the bot that created the program - BotUserID int64 -} - -// GetConnectedAffiliateProgramRequestTypeID is TL type id of GetConnectedAffiliateProgramRequest. -const GetConnectedAffiliateProgramRequestTypeID = 0x9761e770 - -// Ensuring interfaces in compile-time for GetConnectedAffiliateProgramRequest. -var ( - _ bin.Encoder = &GetConnectedAffiliateProgramRequest{} - _ bin.Decoder = &GetConnectedAffiliateProgramRequest{} - _ bin.BareEncoder = &GetConnectedAffiliateProgramRequest{} - _ bin.BareDecoder = &GetConnectedAffiliateProgramRequest{} -) - -func (g *GetConnectedAffiliateProgramRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Affiliate == nil) { - return false - } - if !(g.BotUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetConnectedAffiliateProgramRequest) String() string { - if g == nil { - return "GetConnectedAffiliateProgramRequest(nil)" - } - type Alias GetConnectedAffiliateProgramRequest - return fmt.Sprintf("GetConnectedAffiliateProgramRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetConnectedAffiliateProgramRequest) TypeID() uint32 { - return GetConnectedAffiliateProgramRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetConnectedAffiliateProgramRequest) TypeName() string { - return "getConnectedAffiliateProgram" -} - -// TypeInfo returns info about TL type. -func (g *GetConnectedAffiliateProgramRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getConnectedAffiliateProgram", - ID: GetConnectedAffiliateProgramRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Affiliate", - SchemaName: "affiliate", - }, - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetConnectedAffiliateProgramRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getConnectedAffiliateProgram#9761e770 as nil") - } - b.PutID(GetConnectedAffiliateProgramRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetConnectedAffiliateProgramRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getConnectedAffiliateProgram#9761e770 as nil") - } - if g.Affiliate == nil { - return fmt.Errorf("unable to encode getConnectedAffiliateProgram#9761e770: field affiliate is nil") - } - if err := g.Affiliate.Encode(b); err != nil { - return fmt.Errorf("unable to encode getConnectedAffiliateProgram#9761e770: field affiliate: %w", err) - } - b.PutInt53(g.BotUserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetConnectedAffiliateProgramRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getConnectedAffiliateProgram#9761e770 to nil") - } - if err := b.ConsumeID(GetConnectedAffiliateProgramRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetConnectedAffiliateProgramRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getConnectedAffiliateProgram#9761e770 to nil") - } - { - value, err := DecodeAffiliateType(b) - if err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: field affiliate: %w", err) - } - g.Affiliate = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: field bot_user_id: %w", err) - } - g.BotUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetConnectedAffiliateProgramRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getConnectedAffiliateProgram#9761e770 as nil") - } - b.ObjStart() - b.PutID("getConnectedAffiliateProgram") - b.Comma() - b.FieldStart("affiliate") - if g.Affiliate == nil { - return fmt.Errorf("unable to encode getConnectedAffiliateProgram#9761e770: field affiliate is nil") - } - if err := g.Affiliate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getConnectedAffiliateProgram#9761e770: field affiliate: %w", err) - } - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetConnectedAffiliateProgramRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getConnectedAffiliateProgram#9761e770 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getConnectedAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: %w", err) - } - case "affiliate": - value, err := DecodeTDLibJSONAffiliateType(b) - if err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: field affiliate: %w", err) - } - g.Affiliate = value - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliateProgram#9761e770: field bot_user_id: %w", err) - } - g.BotUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAffiliate returns value of Affiliate field. -func (g *GetConnectedAffiliateProgramRequest) GetAffiliate() (value AffiliateTypeClass) { - if g == nil { - return - } - return g.Affiliate -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetConnectedAffiliateProgramRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetConnectedAffiliateProgram invokes method getConnectedAffiliateProgram#9761e770 returning error if any. -func (c *Client) GetConnectedAffiliateProgram(ctx context.Context, request *GetConnectedAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { - var result ConnectedAffiliateProgram - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_connected_affiliate_programs_gen.go b/tdapi/tl_get_connected_affiliate_programs_gen.go deleted file mode 100644 index efd2fc82a..000000000 --- a/tdapi/tl_get_connected_affiliate_programs_gen.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetConnectedAffiliateProgramsRequest represents TL type `getConnectedAffiliatePrograms#8b2c5272`. -type GetConnectedAffiliateProgramsRequest struct { - // The affiliate to which the affiliate program were connected - Affiliate AffiliateTypeClass - // Offset of the first affiliate program to return as received from the previous request; - // use empty string to get the first chunk of results - Offset string - // The maximum number of affiliate programs to return - Limit int32 -} - -// GetConnectedAffiliateProgramsRequestTypeID is TL type id of GetConnectedAffiliateProgramsRequest. -const GetConnectedAffiliateProgramsRequestTypeID = 0x8b2c5272 - -// Ensuring interfaces in compile-time for GetConnectedAffiliateProgramsRequest. -var ( - _ bin.Encoder = &GetConnectedAffiliateProgramsRequest{} - _ bin.Decoder = &GetConnectedAffiliateProgramsRequest{} - _ bin.BareEncoder = &GetConnectedAffiliateProgramsRequest{} - _ bin.BareDecoder = &GetConnectedAffiliateProgramsRequest{} -) - -func (g *GetConnectedAffiliateProgramsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Affiliate == nil) { - return false - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetConnectedAffiliateProgramsRequest) String() string { - if g == nil { - return "GetConnectedAffiliateProgramsRequest(nil)" - } - type Alias GetConnectedAffiliateProgramsRequest - return fmt.Sprintf("GetConnectedAffiliateProgramsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetConnectedAffiliateProgramsRequest) TypeID() uint32 { - return GetConnectedAffiliateProgramsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetConnectedAffiliateProgramsRequest) TypeName() string { - return "getConnectedAffiliatePrograms" -} - -// TypeInfo returns info about TL type. -func (g *GetConnectedAffiliateProgramsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getConnectedAffiliatePrograms", - ID: GetConnectedAffiliateProgramsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Affiliate", - SchemaName: "affiliate", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetConnectedAffiliateProgramsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getConnectedAffiliatePrograms#8b2c5272 as nil") - } - b.PutID(GetConnectedAffiliateProgramsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetConnectedAffiliateProgramsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getConnectedAffiliatePrograms#8b2c5272 as nil") - } - if g.Affiliate == nil { - return fmt.Errorf("unable to encode getConnectedAffiliatePrograms#8b2c5272: field affiliate is nil") - } - if err := g.Affiliate.Encode(b); err != nil { - return fmt.Errorf("unable to encode getConnectedAffiliatePrograms#8b2c5272: field affiliate: %w", err) - } - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetConnectedAffiliateProgramsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getConnectedAffiliatePrograms#8b2c5272 to nil") - } - if err := b.ConsumeID(GetConnectedAffiliateProgramsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetConnectedAffiliateProgramsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getConnectedAffiliatePrograms#8b2c5272 to nil") - } - { - value, err := DecodeAffiliateType(b) - if err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field affiliate: %w", err) - } - g.Affiliate = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetConnectedAffiliateProgramsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getConnectedAffiliatePrograms#8b2c5272 as nil") - } - b.ObjStart() - b.PutID("getConnectedAffiliatePrograms") - b.Comma() - b.FieldStart("affiliate") - if g.Affiliate == nil { - return fmt.Errorf("unable to encode getConnectedAffiliatePrograms#8b2c5272: field affiliate is nil") - } - if err := g.Affiliate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getConnectedAffiliatePrograms#8b2c5272: field affiliate: %w", err) - } - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetConnectedAffiliateProgramsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getConnectedAffiliatePrograms#8b2c5272 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getConnectedAffiliatePrograms"); err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: %w", err) - } - case "affiliate": - value, err := DecodeTDLibJSONAffiliateType(b) - if err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field affiliate: %w", err) - } - g.Affiliate = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getConnectedAffiliatePrograms#8b2c5272: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAffiliate returns value of Affiliate field. -func (g *GetConnectedAffiliateProgramsRequest) GetAffiliate() (value AffiliateTypeClass) { - if g == nil { - return - } - return g.Affiliate -} - -// GetOffset returns value of Offset field. -func (g *GetConnectedAffiliateProgramsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetConnectedAffiliateProgramsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetConnectedAffiliatePrograms invokes method getConnectedAffiliatePrograms#8b2c5272 returning error if any. -func (c *Client) GetConnectedAffiliatePrograms(ctx context.Context, request *GetConnectedAffiliateProgramsRequest) (*ConnectedAffiliatePrograms, error) { - var result ConnectedAffiliatePrograms - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_connected_websites_gen.go b/tdapi/tl_get_connected_websites_gen.go deleted file mode 100644 index 6abecb162..000000000 --- a/tdapi/tl_get_connected_websites_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetConnectedWebsitesRequest represents TL type `getConnectedWebsites#f5d5d352`. -type GetConnectedWebsitesRequest struct { -} - -// GetConnectedWebsitesRequestTypeID is TL type id of GetConnectedWebsitesRequest. -const GetConnectedWebsitesRequestTypeID = 0xf5d5d352 - -// Ensuring interfaces in compile-time for GetConnectedWebsitesRequest. -var ( - _ bin.Encoder = &GetConnectedWebsitesRequest{} - _ bin.Decoder = &GetConnectedWebsitesRequest{} - _ bin.BareEncoder = &GetConnectedWebsitesRequest{} - _ bin.BareDecoder = &GetConnectedWebsitesRequest{} -) - -func (g *GetConnectedWebsitesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetConnectedWebsitesRequest) String() string { - if g == nil { - return "GetConnectedWebsitesRequest(nil)" - } - type Alias GetConnectedWebsitesRequest - return fmt.Sprintf("GetConnectedWebsitesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetConnectedWebsitesRequest) TypeID() uint32 { - return GetConnectedWebsitesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetConnectedWebsitesRequest) TypeName() string { - return "getConnectedWebsites" -} - -// TypeInfo returns info about TL type. -func (g *GetConnectedWebsitesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getConnectedWebsites", - ID: GetConnectedWebsitesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetConnectedWebsitesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getConnectedWebsites#f5d5d352 as nil") - } - b.PutID(GetConnectedWebsitesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetConnectedWebsitesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getConnectedWebsites#f5d5d352 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetConnectedWebsitesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getConnectedWebsites#f5d5d352 to nil") - } - if err := b.ConsumeID(GetConnectedWebsitesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getConnectedWebsites#f5d5d352: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetConnectedWebsitesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getConnectedWebsites#f5d5d352 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetConnectedWebsitesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getConnectedWebsites#f5d5d352 as nil") - } - b.ObjStart() - b.PutID("getConnectedWebsites") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetConnectedWebsitesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getConnectedWebsites#f5d5d352 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getConnectedWebsites"); err != nil { - return fmt.Errorf("unable to decode getConnectedWebsites#f5d5d352: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetConnectedWebsites invokes method getConnectedWebsites#f5d5d352 returning error if any. -func (c *Client) GetConnectedWebsites(ctx context.Context) (*ConnectedWebsites, error) { - var result ConnectedWebsites - - request := &GetConnectedWebsitesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_contacts_gen.go b/tdapi/tl_get_contacts_gen.go deleted file mode 100644 index b9f0cc4ff..000000000 --- a/tdapi/tl_get_contacts_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetContactsRequest represents TL type `getContacts#ab7f4470`. -type GetContactsRequest struct { -} - -// GetContactsRequestTypeID is TL type id of GetContactsRequest. -const GetContactsRequestTypeID = 0xab7f4470 - -// Ensuring interfaces in compile-time for GetContactsRequest. -var ( - _ bin.Encoder = &GetContactsRequest{} - _ bin.Decoder = &GetContactsRequest{} - _ bin.BareEncoder = &GetContactsRequest{} - _ bin.BareDecoder = &GetContactsRequest{} -) - -func (g *GetContactsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetContactsRequest) String() string { - if g == nil { - return "GetContactsRequest(nil)" - } - type Alias GetContactsRequest - return fmt.Sprintf("GetContactsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetContactsRequest) TypeID() uint32 { - return GetContactsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetContactsRequest) TypeName() string { - return "getContacts" -} - -// TypeInfo returns info about TL type. -func (g *GetContactsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getContacts", - ID: GetContactsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetContactsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getContacts#ab7f4470 as nil") - } - b.PutID(GetContactsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetContactsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getContacts#ab7f4470 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetContactsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getContacts#ab7f4470 to nil") - } - if err := b.ConsumeID(GetContactsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getContacts#ab7f4470: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetContactsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getContacts#ab7f4470 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetContactsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getContacts#ab7f4470 as nil") - } - b.ObjStart() - b.PutID("getContacts") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetContactsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getContacts#ab7f4470 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getContacts"); err != nil { - return fmt.Errorf("unable to decode getContacts#ab7f4470: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetContacts invokes method getContacts#ab7f4470 returning error if any. -func (c *Client) GetContacts(ctx context.Context) (*Users, error) { - var result Users - - request := &GetContactsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_countries_gen.go b/tdapi/tl_get_countries_gen.go deleted file mode 100644 index 80776ef7e..000000000 --- a/tdapi/tl_get_countries_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCountriesRequest represents TL type `getCountries#fce8099e`. -type GetCountriesRequest struct { -} - -// GetCountriesRequestTypeID is TL type id of GetCountriesRequest. -const GetCountriesRequestTypeID = 0xfce8099e - -// Ensuring interfaces in compile-time for GetCountriesRequest. -var ( - _ bin.Encoder = &GetCountriesRequest{} - _ bin.Decoder = &GetCountriesRequest{} - _ bin.BareEncoder = &GetCountriesRequest{} - _ bin.BareDecoder = &GetCountriesRequest{} -) - -func (g *GetCountriesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCountriesRequest) String() string { - if g == nil { - return "GetCountriesRequest(nil)" - } - type Alias GetCountriesRequest - return fmt.Sprintf("GetCountriesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCountriesRequest) TypeID() uint32 { - return GetCountriesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCountriesRequest) TypeName() string { - return "getCountries" -} - -// TypeInfo returns info about TL type. -func (g *GetCountriesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCountries", - ID: GetCountriesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCountriesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCountries#fce8099e as nil") - } - b.PutID(GetCountriesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCountriesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCountries#fce8099e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCountriesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCountries#fce8099e to nil") - } - if err := b.ConsumeID(GetCountriesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCountries#fce8099e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCountriesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCountries#fce8099e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCountriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCountries#fce8099e as nil") - } - b.ObjStart() - b.PutID("getCountries") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCountriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCountries#fce8099e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCountries"); err != nil { - return fmt.Errorf("unable to decode getCountries#fce8099e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCountries invokes method getCountries#fce8099e returning error if any. -func (c *Client) GetCountries(ctx context.Context) (*Countries, error) { - var result Countries - - request := &GetCountriesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_country_code_gen.go b/tdapi/tl_get_country_code_gen.go deleted file mode 100644 index 1fd3ca4c0..000000000 --- a/tdapi/tl_get_country_code_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCountryCodeRequest represents TL type `getCountryCode#5bd398f2`. -type GetCountryCodeRequest struct { -} - -// GetCountryCodeRequestTypeID is TL type id of GetCountryCodeRequest. -const GetCountryCodeRequestTypeID = 0x5bd398f2 - -// Ensuring interfaces in compile-time for GetCountryCodeRequest. -var ( - _ bin.Encoder = &GetCountryCodeRequest{} - _ bin.Decoder = &GetCountryCodeRequest{} - _ bin.BareEncoder = &GetCountryCodeRequest{} - _ bin.BareDecoder = &GetCountryCodeRequest{} -) - -func (g *GetCountryCodeRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCountryCodeRequest) String() string { - if g == nil { - return "GetCountryCodeRequest(nil)" - } - type Alias GetCountryCodeRequest - return fmt.Sprintf("GetCountryCodeRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCountryCodeRequest) TypeID() uint32 { - return GetCountryCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCountryCodeRequest) TypeName() string { - return "getCountryCode" -} - -// TypeInfo returns info about TL type. -func (g *GetCountryCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCountryCode", - ID: GetCountryCodeRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCountryCodeRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCountryCode#5bd398f2 as nil") - } - b.PutID(GetCountryCodeRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCountryCodeRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCountryCode#5bd398f2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCountryCodeRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCountryCode#5bd398f2 to nil") - } - if err := b.ConsumeID(GetCountryCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCountryCode#5bd398f2: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCountryCodeRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCountryCode#5bd398f2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCountryCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCountryCode#5bd398f2 as nil") - } - b.ObjStart() - b.PutID("getCountryCode") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCountryCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCountryCode#5bd398f2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCountryCode"); err != nil { - return fmt.Errorf("unable to decode getCountryCode#5bd398f2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCountryCode invokes method getCountryCode#5bd398f2 returning error if any. -func (c *Client) GetCountryCode(ctx context.Context) (*Text, error) { - var result Text - - request := &GetCountryCodeRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_country_flag_emoji_gen.go b/tdapi/tl_get_country_flag_emoji_gen.go deleted file mode 100644 index edab3fb02..000000000 --- a/tdapi/tl_get_country_flag_emoji_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCountryFlagEmojiRequest represents TL type `getCountryFlagEmoji#3a8629fa`. -type GetCountryFlagEmojiRequest struct { - // A two-letter ISO 3166-1 alpha-2 country code as received from getCountries - CountryCode string -} - -// GetCountryFlagEmojiRequestTypeID is TL type id of GetCountryFlagEmojiRequest. -const GetCountryFlagEmojiRequestTypeID = 0x3a8629fa - -// Ensuring interfaces in compile-time for GetCountryFlagEmojiRequest. -var ( - _ bin.Encoder = &GetCountryFlagEmojiRequest{} - _ bin.Decoder = &GetCountryFlagEmojiRequest{} - _ bin.BareEncoder = &GetCountryFlagEmojiRequest{} - _ bin.BareDecoder = &GetCountryFlagEmojiRequest{} -) - -func (g *GetCountryFlagEmojiRequest) Zero() bool { - if g == nil { - return true - } - if !(g.CountryCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCountryFlagEmojiRequest) String() string { - if g == nil { - return "GetCountryFlagEmojiRequest(nil)" - } - type Alias GetCountryFlagEmojiRequest - return fmt.Sprintf("GetCountryFlagEmojiRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCountryFlagEmojiRequest) TypeID() uint32 { - return GetCountryFlagEmojiRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCountryFlagEmojiRequest) TypeName() string { - return "getCountryFlagEmoji" -} - -// TypeInfo returns info about TL type. -func (g *GetCountryFlagEmojiRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCountryFlagEmoji", - ID: GetCountryFlagEmojiRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CountryCode", - SchemaName: "country_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCountryFlagEmojiRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCountryFlagEmoji#3a8629fa as nil") - } - b.PutID(GetCountryFlagEmojiRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCountryFlagEmojiRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCountryFlagEmoji#3a8629fa as nil") - } - b.PutString(g.CountryCode) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCountryFlagEmojiRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCountryFlagEmoji#3a8629fa to nil") - } - if err := b.ConsumeID(GetCountryFlagEmojiRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCountryFlagEmoji#3a8629fa: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCountryFlagEmojiRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCountryFlagEmoji#3a8629fa to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getCountryFlagEmoji#3a8629fa: field country_code: %w", err) - } - g.CountryCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCountryFlagEmojiRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCountryFlagEmoji#3a8629fa as nil") - } - b.ObjStart() - b.PutID("getCountryFlagEmoji") - b.Comma() - b.FieldStart("country_code") - b.PutString(g.CountryCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCountryFlagEmojiRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCountryFlagEmoji#3a8629fa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCountryFlagEmoji"); err != nil { - return fmt.Errorf("unable to decode getCountryFlagEmoji#3a8629fa: %w", err) - } - case "country_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getCountryFlagEmoji#3a8629fa: field country_code: %w", err) - } - g.CountryCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCountryCode returns value of CountryCode field. -func (g *GetCountryFlagEmojiRequest) GetCountryCode() (value string) { - if g == nil { - return - } - return g.CountryCode -} - -// GetCountryFlagEmoji invokes method getCountryFlagEmoji#3a8629fa returning error if any. -func (c *Client) GetCountryFlagEmoji(ctx context.Context, countrycode string) (*Text, error) { - var result Text - - request := &GetCountryFlagEmojiRequest{ - CountryCode: countrycode, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_created_public_chats_gen.go b/tdapi/tl_get_created_public_chats_gen.go deleted file mode 100644 index ac8ae8078..000000000 --- a/tdapi/tl_get_created_public_chats_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCreatedPublicChatsRequest represents TL type `getCreatedPublicChats#2a5725ef`. -type GetCreatedPublicChatsRequest struct { - // Type of the public chats to return - Type PublicChatTypeClass -} - -// GetCreatedPublicChatsRequestTypeID is TL type id of GetCreatedPublicChatsRequest. -const GetCreatedPublicChatsRequestTypeID = 0x2a5725ef - -// Ensuring interfaces in compile-time for GetCreatedPublicChatsRequest. -var ( - _ bin.Encoder = &GetCreatedPublicChatsRequest{} - _ bin.Decoder = &GetCreatedPublicChatsRequest{} - _ bin.BareEncoder = &GetCreatedPublicChatsRequest{} - _ bin.BareDecoder = &GetCreatedPublicChatsRequest{} -) - -func (g *GetCreatedPublicChatsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCreatedPublicChatsRequest) String() string { - if g == nil { - return "GetCreatedPublicChatsRequest(nil)" - } - type Alias GetCreatedPublicChatsRequest - return fmt.Sprintf("GetCreatedPublicChatsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCreatedPublicChatsRequest) TypeID() uint32 { - return GetCreatedPublicChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCreatedPublicChatsRequest) TypeName() string { - return "getCreatedPublicChats" -} - -// TypeInfo returns info about TL type. -func (g *GetCreatedPublicChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCreatedPublicChats", - ID: GetCreatedPublicChatsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCreatedPublicChatsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCreatedPublicChats#2a5725ef as nil") - } - b.PutID(GetCreatedPublicChatsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCreatedPublicChatsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCreatedPublicChats#2a5725ef as nil") - } - if g.Type == nil { - return fmt.Errorf("unable to encode getCreatedPublicChats#2a5725ef: field type is nil") - } - if err := g.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode getCreatedPublicChats#2a5725ef: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCreatedPublicChatsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCreatedPublicChats#2a5725ef to nil") - } - if err := b.ConsumeID(GetCreatedPublicChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCreatedPublicChats#2a5725ef: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCreatedPublicChatsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCreatedPublicChats#2a5725ef to nil") - } - { - value, err := DecodePublicChatType(b) - if err != nil { - return fmt.Errorf("unable to decode getCreatedPublicChats#2a5725ef: field type: %w", err) - } - g.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCreatedPublicChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCreatedPublicChats#2a5725ef as nil") - } - b.ObjStart() - b.PutID("getCreatedPublicChats") - b.Comma() - b.FieldStart("type") - if g.Type == nil { - return fmt.Errorf("unable to encode getCreatedPublicChats#2a5725ef: field type is nil") - } - if err := g.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getCreatedPublicChats#2a5725ef: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCreatedPublicChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCreatedPublicChats#2a5725ef to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCreatedPublicChats"); err != nil { - return fmt.Errorf("unable to decode getCreatedPublicChats#2a5725ef: %w", err) - } - case "type": - value, err := DecodeTDLibJSONPublicChatType(b) - if err != nil { - return fmt.Errorf("unable to decode getCreatedPublicChats#2a5725ef: field type: %w", err) - } - g.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (g *GetCreatedPublicChatsRequest) GetType() (value PublicChatTypeClass) { - if g == nil { - return - } - return g.Type -} - -// GetCreatedPublicChats invokes method getCreatedPublicChats#2a5725ef returning error if any. -func (c *Client) GetCreatedPublicChats(ctx context.Context, type_ PublicChatTypeClass) (*Chats, error) { - var result Chats - - request := &GetCreatedPublicChatsRequest{ - Type: type_, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_current_state_gen.go b/tdapi/tl_get_current_state_gen.go deleted file mode 100644 index 9c10ae7b6..000000000 --- a/tdapi/tl_get_current_state_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCurrentStateRequest represents TL type `getCurrentState#b8fc6889`. -type GetCurrentStateRequest struct { -} - -// GetCurrentStateRequestTypeID is TL type id of GetCurrentStateRequest. -const GetCurrentStateRequestTypeID = 0xb8fc6889 - -// Ensuring interfaces in compile-time for GetCurrentStateRequest. -var ( - _ bin.Encoder = &GetCurrentStateRequest{} - _ bin.Decoder = &GetCurrentStateRequest{} - _ bin.BareEncoder = &GetCurrentStateRequest{} - _ bin.BareDecoder = &GetCurrentStateRequest{} -) - -func (g *GetCurrentStateRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCurrentStateRequest) String() string { - if g == nil { - return "GetCurrentStateRequest(nil)" - } - type Alias GetCurrentStateRequest - return fmt.Sprintf("GetCurrentStateRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCurrentStateRequest) TypeID() uint32 { - return GetCurrentStateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCurrentStateRequest) TypeName() string { - return "getCurrentState" -} - -// TypeInfo returns info about TL type. -func (g *GetCurrentStateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCurrentState", - ID: GetCurrentStateRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCurrentStateRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCurrentState#b8fc6889 as nil") - } - b.PutID(GetCurrentStateRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCurrentStateRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCurrentState#b8fc6889 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCurrentStateRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCurrentState#b8fc6889 to nil") - } - if err := b.ConsumeID(GetCurrentStateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCurrentState#b8fc6889: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCurrentStateRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCurrentState#b8fc6889 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCurrentStateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCurrentState#b8fc6889 as nil") - } - b.ObjStart() - b.PutID("getCurrentState") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCurrentStateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCurrentState#b8fc6889 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCurrentState"); err != nil { - return fmt.Errorf("unable to decode getCurrentState#b8fc6889: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCurrentState invokes method getCurrentState#b8fc6889 returning error if any. -func (c *Client) GetCurrentState(ctx context.Context) (*Updates, error) { - var result Updates - - request := &GetCurrentStateRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_current_weather_gen.go b/tdapi/tl_get_current_weather_gen.go deleted file mode 100644 index 47eef973b..000000000 --- a/tdapi/tl_get_current_weather_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCurrentWeatherRequest represents TL type `getCurrentWeather#8ada9bc9`. -type GetCurrentWeatherRequest struct { - // The location - Location Location -} - -// GetCurrentWeatherRequestTypeID is TL type id of GetCurrentWeatherRequest. -const GetCurrentWeatherRequestTypeID = 0x8ada9bc9 - -// Ensuring interfaces in compile-time for GetCurrentWeatherRequest. -var ( - _ bin.Encoder = &GetCurrentWeatherRequest{} - _ bin.Decoder = &GetCurrentWeatherRequest{} - _ bin.BareEncoder = &GetCurrentWeatherRequest{} - _ bin.BareDecoder = &GetCurrentWeatherRequest{} -) - -func (g *GetCurrentWeatherRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Location.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCurrentWeatherRequest) String() string { - if g == nil { - return "GetCurrentWeatherRequest(nil)" - } - type Alias GetCurrentWeatherRequest - return fmt.Sprintf("GetCurrentWeatherRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCurrentWeatherRequest) TypeID() uint32 { - return GetCurrentWeatherRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCurrentWeatherRequest) TypeName() string { - return "getCurrentWeather" -} - -// TypeInfo returns info about TL type. -func (g *GetCurrentWeatherRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCurrentWeather", - ID: GetCurrentWeatherRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Location", - SchemaName: "location", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCurrentWeatherRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCurrentWeather#8ada9bc9 as nil") - } - b.PutID(GetCurrentWeatherRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCurrentWeatherRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCurrentWeather#8ada9bc9 as nil") - } - if err := g.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode getCurrentWeather#8ada9bc9: field location: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCurrentWeatherRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCurrentWeather#8ada9bc9 to nil") - } - if err := b.ConsumeID(GetCurrentWeatherRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCurrentWeather#8ada9bc9: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCurrentWeatherRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCurrentWeather#8ada9bc9 to nil") - } - { - if err := g.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode getCurrentWeather#8ada9bc9: field location: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCurrentWeatherRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCurrentWeather#8ada9bc9 as nil") - } - b.ObjStart() - b.PutID("getCurrentWeather") - b.Comma() - b.FieldStart("location") - if err := g.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getCurrentWeather#8ada9bc9: field location: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCurrentWeatherRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCurrentWeather#8ada9bc9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCurrentWeather"); err != nil { - return fmt.Errorf("unable to decode getCurrentWeather#8ada9bc9: %w", err) - } - case "location": - if err := g.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getCurrentWeather#8ada9bc9: field location: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (g *GetCurrentWeatherRequest) GetLocation() (value Location) { - if g == nil { - return - } - return g.Location -} - -// GetCurrentWeather invokes method getCurrentWeather#8ada9bc9 returning error if any. -func (c *Client) GetCurrentWeather(ctx context.Context, location Location) (*CurrentWeather, error) { - var result CurrentWeather - - request := &GetCurrentWeatherRequest{ - Location: location, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_custom_emoji_reaction_animations_gen.go b/tdapi/tl_get_custom_emoji_reaction_animations_gen.go deleted file mode 100644 index 0e480ba60..000000000 --- a/tdapi/tl_get_custom_emoji_reaction_animations_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCustomEmojiReactionAnimationsRequest represents TL type `getCustomEmojiReactionAnimations#49748dd2`. -type GetCustomEmojiReactionAnimationsRequest struct { -} - -// GetCustomEmojiReactionAnimationsRequestTypeID is TL type id of GetCustomEmojiReactionAnimationsRequest. -const GetCustomEmojiReactionAnimationsRequestTypeID = 0x49748dd2 - -// Ensuring interfaces in compile-time for GetCustomEmojiReactionAnimationsRequest. -var ( - _ bin.Encoder = &GetCustomEmojiReactionAnimationsRequest{} - _ bin.Decoder = &GetCustomEmojiReactionAnimationsRequest{} - _ bin.BareEncoder = &GetCustomEmojiReactionAnimationsRequest{} - _ bin.BareDecoder = &GetCustomEmojiReactionAnimationsRequest{} -) - -func (g *GetCustomEmojiReactionAnimationsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCustomEmojiReactionAnimationsRequest) String() string { - if g == nil { - return "GetCustomEmojiReactionAnimationsRequest(nil)" - } - type Alias GetCustomEmojiReactionAnimationsRequest - return fmt.Sprintf("GetCustomEmojiReactionAnimationsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCustomEmojiReactionAnimationsRequest) TypeID() uint32 { - return GetCustomEmojiReactionAnimationsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCustomEmojiReactionAnimationsRequest) TypeName() string { - return "getCustomEmojiReactionAnimations" -} - -// TypeInfo returns info about TL type. -func (g *GetCustomEmojiReactionAnimationsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCustomEmojiReactionAnimations", - ID: GetCustomEmojiReactionAnimationsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCustomEmojiReactionAnimationsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCustomEmojiReactionAnimations#49748dd2 as nil") - } - b.PutID(GetCustomEmojiReactionAnimationsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCustomEmojiReactionAnimationsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCustomEmojiReactionAnimations#49748dd2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCustomEmojiReactionAnimationsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCustomEmojiReactionAnimations#49748dd2 to nil") - } - if err := b.ConsumeID(GetCustomEmojiReactionAnimationsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCustomEmojiReactionAnimations#49748dd2: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCustomEmojiReactionAnimationsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCustomEmojiReactionAnimations#49748dd2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCustomEmojiReactionAnimationsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCustomEmojiReactionAnimations#49748dd2 as nil") - } - b.ObjStart() - b.PutID("getCustomEmojiReactionAnimations") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCustomEmojiReactionAnimationsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCustomEmojiReactionAnimations#49748dd2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCustomEmojiReactionAnimations"); err != nil { - return fmt.Errorf("unable to decode getCustomEmojiReactionAnimations#49748dd2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCustomEmojiReactionAnimations invokes method getCustomEmojiReactionAnimations#49748dd2 returning error if any. -func (c *Client) GetCustomEmojiReactionAnimations(ctx context.Context) (*Stickers, error) { - var result Stickers - - request := &GetCustomEmojiReactionAnimationsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_custom_emoji_stickers_gen.go b/tdapi/tl_get_custom_emoji_stickers_gen.go deleted file mode 100644 index 017996b84..000000000 --- a/tdapi/tl_get_custom_emoji_stickers_gen.go +++ /dev/null @@ -1,231 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetCustomEmojiStickersRequest represents TL type `getCustomEmojiStickers#a5156885`. -type GetCustomEmojiStickersRequest struct { - // Identifiers of custom emoji stickers. At most 200 custom emoji stickers can be - // received simultaneously - CustomEmojiIDs []int64 -} - -// GetCustomEmojiStickersRequestTypeID is TL type id of GetCustomEmojiStickersRequest. -const GetCustomEmojiStickersRequestTypeID = 0xa5156885 - -// Ensuring interfaces in compile-time for GetCustomEmojiStickersRequest. -var ( - _ bin.Encoder = &GetCustomEmojiStickersRequest{} - _ bin.Decoder = &GetCustomEmojiStickersRequest{} - _ bin.BareEncoder = &GetCustomEmojiStickersRequest{} - _ bin.BareDecoder = &GetCustomEmojiStickersRequest{} -) - -func (g *GetCustomEmojiStickersRequest) Zero() bool { - if g == nil { - return true - } - if !(g.CustomEmojiIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetCustomEmojiStickersRequest) String() string { - if g == nil { - return "GetCustomEmojiStickersRequest(nil)" - } - type Alias GetCustomEmojiStickersRequest - return fmt.Sprintf("GetCustomEmojiStickersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetCustomEmojiStickersRequest) TypeID() uint32 { - return GetCustomEmojiStickersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetCustomEmojiStickersRequest) TypeName() string { - return "getCustomEmojiStickers" -} - -// TypeInfo returns info about TL type. -func (g *GetCustomEmojiStickersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getCustomEmojiStickers", - ID: GetCustomEmojiStickersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CustomEmojiIDs", - SchemaName: "custom_emoji_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetCustomEmojiStickersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCustomEmojiStickers#a5156885 as nil") - } - b.PutID(GetCustomEmojiStickersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetCustomEmojiStickersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getCustomEmojiStickers#a5156885 as nil") - } - b.PutInt(len(g.CustomEmojiIDs)) - for _, v := range g.CustomEmojiIDs { - b.PutLong(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetCustomEmojiStickersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCustomEmojiStickers#a5156885 to nil") - } - if err := b.ConsumeID(GetCustomEmojiStickersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getCustomEmojiStickers#a5156885: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetCustomEmojiStickersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getCustomEmojiStickers#a5156885 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode getCustomEmojiStickers#a5156885: field custom_emoji_ids: %w", err) - } - - if headerLen > 0 { - g.CustomEmojiIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getCustomEmojiStickers#a5156885: field custom_emoji_ids: %w", err) - } - g.CustomEmojiIDs = append(g.CustomEmojiIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetCustomEmojiStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getCustomEmojiStickers#a5156885 as nil") - } - b.ObjStart() - b.PutID("getCustomEmojiStickers") - b.Comma() - b.FieldStart("custom_emoji_ids") - b.ArrStart() - for _, v := range g.CustomEmojiIDs { - b.PutLong(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetCustomEmojiStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getCustomEmojiStickers#a5156885 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getCustomEmojiStickers"); err != nil { - return fmt.Errorf("unable to decode getCustomEmojiStickers#a5156885: %w", err) - } - case "custom_emoji_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getCustomEmojiStickers#a5156885: field custom_emoji_ids: %w", err) - } - g.CustomEmojiIDs = append(g.CustomEmojiIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode getCustomEmojiStickers#a5156885: field custom_emoji_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCustomEmojiIDs returns value of CustomEmojiIDs field. -func (g *GetCustomEmojiStickersRequest) GetCustomEmojiIDs() (value []int64) { - if g == nil { - return - } - return g.CustomEmojiIDs -} - -// GetCustomEmojiStickers invokes method getCustomEmojiStickers#a5156885 returning error if any. -func (c *Client) GetCustomEmojiStickers(ctx context.Context, customemojiids []int64) (*Stickers, error) { - var result Stickers - - request := &GetCustomEmojiStickersRequest{ - CustomEmojiIDs: customemojiids, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_database_statistics_gen.go b/tdapi/tl_get_database_statistics_gen.go deleted file mode 100644 index 4ecab7a4f..000000000 --- a/tdapi/tl_get_database_statistics_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetDatabaseStatisticsRequest represents TL type `getDatabaseStatistics#8c33d4b9`. -type GetDatabaseStatisticsRequest struct { -} - -// GetDatabaseStatisticsRequestTypeID is TL type id of GetDatabaseStatisticsRequest. -const GetDatabaseStatisticsRequestTypeID = 0x8c33d4b9 - -// Ensuring interfaces in compile-time for GetDatabaseStatisticsRequest. -var ( - _ bin.Encoder = &GetDatabaseStatisticsRequest{} - _ bin.Decoder = &GetDatabaseStatisticsRequest{} - _ bin.BareEncoder = &GetDatabaseStatisticsRequest{} - _ bin.BareDecoder = &GetDatabaseStatisticsRequest{} -) - -func (g *GetDatabaseStatisticsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetDatabaseStatisticsRequest) String() string { - if g == nil { - return "GetDatabaseStatisticsRequest(nil)" - } - type Alias GetDatabaseStatisticsRequest - return fmt.Sprintf("GetDatabaseStatisticsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetDatabaseStatisticsRequest) TypeID() uint32 { - return GetDatabaseStatisticsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetDatabaseStatisticsRequest) TypeName() string { - return "getDatabaseStatistics" -} - -// TypeInfo returns info about TL type. -func (g *GetDatabaseStatisticsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getDatabaseStatistics", - ID: GetDatabaseStatisticsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetDatabaseStatisticsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDatabaseStatistics#8c33d4b9 as nil") - } - b.PutID(GetDatabaseStatisticsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetDatabaseStatisticsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDatabaseStatistics#8c33d4b9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetDatabaseStatisticsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDatabaseStatistics#8c33d4b9 to nil") - } - if err := b.ConsumeID(GetDatabaseStatisticsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getDatabaseStatistics#8c33d4b9: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetDatabaseStatisticsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDatabaseStatistics#8c33d4b9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetDatabaseStatisticsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getDatabaseStatistics#8c33d4b9 as nil") - } - b.ObjStart() - b.PutID("getDatabaseStatistics") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetDatabaseStatisticsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getDatabaseStatistics#8c33d4b9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getDatabaseStatistics"); err != nil { - return fmt.Errorf("unable to decode getDatabaseStatistics#8c33d4b9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDatabaseStatistics invokes method getDatabaseStatistics#8c33d4b9 returning error if any. -func (c *Client) GetDatabaseStatistics(ctx context.Context) (*DatabaseStatistics, error) { - var result DatabaseStatistics - - request := &GetDatabaseStatisticsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_deep_link_info_gen.go b/tdapi/tl_get_deep_link_info_gen.go deleted file mode 100644 index f71a126df..000000000 --- a/tdapi/tl_get_deep_link_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetDeepLinkInfoRequest represents TL type `getDeepLinkInfo#28923f7e`. -type GetDeepLinkInfoRequest struct { - // The link - Link string -} - -// GetDeepLinkInfoRequestTypeID is TL type id of GetDeepLinkInfoRequest. -const GetDeepLinkInfoRequestTypeID = 0x28923f7e - -// Ensuring interfaces in compile-time for GetDeepLinkInfoRequest. -var ( - _ bin.Encoder = &GetDeepLinkInfoRequest{} - _ bin.Decoder = &GetDeepLinkInfoRequest{} - _ bin.BareEncoder = &GetDeepLinkInfoRequest{} - _ bin.BareDecoder = &GetDeepLinkInfoRequest{} -) - -func (g *GetDeepLinkInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Link == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetDeepLinkInfoRequest) String() string { - if g == nil { - return "GetDeepLinkInfoRequest(nil)" - } - type Alias GetDeepLinkInfoRequest - return fmt.Sprintf("GetDeepLinkInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetDeepLinkInfoRequest) TypeID() uint32 { - return GetDeepLinkInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetDeepLinkInfoRequest) TypeName() string { - return "getDeepLinkInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetDeepLinkInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getDeepLinkInfo", - ID: GetDeepLinkInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetDeepLinkInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDeepLinkInfo#28923f7e as nil") - } - b.PutID(GetDeepLinkInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetDeepLinkInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDeepLinkInfo#28923f7e as nil") - } - b.PutString(g.Link) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetDeepLinkInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDeepLinkInfo#28923f7e to nil") - } - if err := b.ConsumeID(GetDeepLinkInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getDeepLinkInfo#28923f7e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetDeepLinkInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDeepLinkInfo#28923f7e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getDeepLinkInfo#28923f7e: field link: %w", err) - } - g.Link = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetDeepLinkInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getDeepLinkInfo#28923f7e as nil") - } - b.ObjStart() - b.PutID("getDeepLinkInfo") - b.Comma() - b.FieldStart("link") - b.PutString(g.Link) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetDeepLinkInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getDeepLinkInfo#28923f7e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getDeepLinkInfo"); err != nil { - return fmt.Errorf("unable to decode getDeepLinkInfo#28923f7e: %w", err) - } - case "link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getDeepLinkInfo#28923f7e: field link: %w", err) - } - g.Link = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (g *GetDeepLinkInfoRequest) GetLink() (value string) { - if g == nil { - return - } - return g.Link -} - -// GetDeepLinkInfo invokes method getDeepLinkInfo#28923f7e returning error if any. -func (c *Client) GetDeepLinkInfo(ctx context.Context, link string) (*DeepLinkInfo, error) { - var result DeepLinkInfo - - request := &GetDeepLinkInfoRequest{ - Link: link, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_default_background_custom_emoji_stickers_gen.go b/tdapi/tl_get_default_background_custom_emoji_stickers_gen.go deleted file mode 100644 index 42c4324b6..000000000 --- a/tdapi/tl_get_default_background_custom_emoji_stickers_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetDefaultBackgroundCustomEmojiStickersRequest represents TL type `getDefaultBackgroundCustomEmojiStickers#1cf6680e`. -type GetDefaultBackgroundCustomEmojiStickersRequest struct { -} - -// GetDefaultBackgroundCustomEmojiStickersRequestTypeID is TL type id of GetDefaultBackgroundCustomEmojiStickersRequest. -const GetDefaultBackgroundCustomEmojiStickersRequestTypeID = 0x1cf6680e - -// Ensuring interfaces in compile-time for GetDefaultBackgroundCustomEmojiStickersRequest. -var ( - _ bin.Encoder = &GetDefaultBackgroundCustomEmojiStickersRequest{} - _ bin.Decoder = &GetDefaultBackgroundCustomEmojiStickersRequest{} - _ bin.BareEncoder = &GetDefaultBackgroundCustomEmojiStickersRequest{} - _ bin.BareDecoder = &GetDefaultBackgroundCustomEmojiStickersRequest{} -) - -func (g *GetDefaultBackgroundCustomEmojiStickersRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetDefaultBackgroundCustomEmojiStickersRequest) String() string { - if g == nil { - return "GetDefaultBackgroundCustomEmojiStickersRequest(nil)" - } - type Alias GetDefaultBackgroundCustomEmojiStickersRequest - return fmt.Sprintf("GetDefaultBackgroundCustomEmojiStickersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetDefaultBackgroundCustomEmojiStickersRequest) TypeID() uint32 { - return GetDefaultBackgroundCustomEmojiStickersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetDefaultBackgroundCustomEmojiStickersRequest) TypeName() string { - return "getDefaultBackgroundCustomEmojiStickers" -} - -// TypeInfo returns info about TL type. -func (g *GetDefaultBackgroundCustomEmojiStickersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getDefaultBackgroundCustomEmojiStickers", - ID: GetDefaultBackgroundCustomEmojiStickersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetDefaultBackgroundCustomEmojiStickersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultBackgroundCustomEmojiStickers#1cf6680e as nil") - } - b.PutID(GetDefaultBackgroundCustomEmojiStickersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetDefaultBackgroundCustomEmojiStickersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultBackgroundCustomEmojiStickers#1cf6680e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetDefaultBackgroundCustomEmojiStickersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultBackgroundCustomEmojiStickers#1cf6680e to nil") - } - if err := b.ConsumeID(GetDefaultBackgroundCustomEmojiStickersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getDefaultBackgroundCustomEmojiStickers#1cf6680e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetDefaultBackgroundCustomEmojiStickersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultBackgroundCustomEmojiStickers#1cf6680e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetDefaultBackgroundCustomEmojiStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultBackgroundCustomEmojiStickers#1cf6680e as nil") - } - b.ObjStart() - b.PutID("getDefaultBackgroundCustomEmojiStickers") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetDefaultBackgroundCustomEmojiStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultBackgroundCustomEmojiStickers#1cf6680e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getDefaultBackgroundCustomEmojiStickers"); err != nil { - return fmt.Errorf("unable to decode getDefaultBackgroundCustomEmojiStickers#1cf6680e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDefaultBackgroundCustomEmojiStickers invokes method getDefaultBackgroundCustomEmojiStickers#1cf6680e returning error if any. -func (c *Client) GetDefaultBackgroundCustomEmojiStickers(ctx context.Context) (*Stickers, error) { - var result Stickers - - request := &GetDefaultBackgroundCustomEmojiStickersRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_default_chat_emoji_statuses_gen.go b/tdapi/tl_get_default_chat_emoji_statuses_gen.go deleted file mode 100644 index 57c31df19..000000000 --- a/tdapi/tl_get_default_chat_emoji_statuses_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetDefaultChatEmojiStatusesRequest represents TL type `getDefaultChatEmojiStatuses#a7aa86e6`. -type GetDefaultChatEmojiStatusesRequest struct { -} - -// GetDefaultChatEmojiStatusesRequestTypeID is TL type id of GetDefaultChatEmojiStatusesRequest. -const GetDefaultChatEmojiStatusesRequestTypeID = 0xa7aa86e6 - -// Ensuring interfaces in compile-time for GetDefaultChatEmojiStatusesRequest. -var ( - _ bin.Encoder = &GetDefaultChatEmojiStatusesRequest{} - _ bin.Decoder = &GetDefaultChatEmojiStatusesRequest{} - _ bin.BareEncoder = &GetDefaultChatEmojiStatusesRequest{} - _ bin.BareDecoder = &GetDefaultChatEmojiStatusesRequest{} -) - -func (g *GetDefaultChatEmojiStatusesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetDefaultChatEmojiStatusesRequest) String() string { - if g == nil { - return "GetDefaultChatEmojiStatusesRequest(nil)" - } - type Alias GetDefaultChatEmojiStatusesRequest - return fmt.Sprintf("GetDefaultChatEmojiStatusesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetDefaultChatEmojiStatusesRequest) TypeID() uint32 { - return GetDefaultChatEmojiStatusesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetDefaultChatEmojiStatusesRequest) TypeName() string { - return "getDefaultChatEmojiStatuses" -} - -// TypeInfo returns info about TL type. -func (g *GetDefaultChatEmojiStatusesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getDefaultChatEmojiStatuses", - ID: GetDefaultChatEmojiStatusesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetDefaultChatEmojiStatusesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultChatEmojiStatuses#a7aa86e6 as nil") - } - b.PutID(GetDefaultChatEmojiStatusesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetDefaultChatEmojiStatusesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultChatEmojiStatuses#a7aa86e6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetDefaultChatEmojiStatusesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultChatEmojiStatuses#a7aa86e6 to nil") - } - if err := b.ConsumeID(GetDefaultChatEmojiStatusesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getDefaultChatEmojiStatuses#a7aa86e6: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetDefaultChatEmojiStatusesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultChatEmojiStatuses#a7aa86e6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetDefaultChatEmojiStatusesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultChatEmojiStatuses#a7aa86e6 as nil") - } - b.ObjStart() - b.PutID("getDefaultChatEmojiStatuses") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetDefaultChatEmojiStatusesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultChatEmojiStatuses#a7aa86e6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getDefaultChatEmojiStatuses"); err != nil { - return fmt.Errorf("unable to decode getDefaultChatEmojiStatuses#a7aa86e6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDefaultChatEmojiStatuses invokes method getDefaultChatEmojiStatuses#a7aa86e6 returning error if any. -func (c *Client) GetDefaultChatEmojiStatuses(ctx context.Context) (*EmojiStatuses, error) { - var result EmojiStatuses - - request := &GetDefaultChatEmojiStatusesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_default_chat_photo_custom_emoji_stickers_gen.go b/tdapi/tl_get_default_chat_photo_custom_emoji_stickers_gen.go deleted file mode 100644 index eadbff83c..000000000 --- a/tdapi/tl_get_default_chat_photo_custom_emoji_stickers_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetDefaultChatPhotoCustomEmojiStickersRequest represents TL type `getDefaultChatPhotoCustomEmojiStickers#e9917765`. -type GetDefaultChatPhotoCustomEmojiStickersRequest struct { -} - -// GetDefaultChatPhotoCustomEmojiStickersRequestTypeID is TL type id of GetDefaultChatPhotoCustomEmojiStickersRequest. -const GetDefaultChatPhotoCustomEmojiStickersRequestTypeID = 0xe9917765 - -// Ensuring interfaces in compile-time for GetDefaultChatPhotoCustomEmojiStickersRequest. -var ( - _ bin.Encoder = &GetDefaultChatPhotoCustomEmojiStickersRequest{} - _ bin.Decoder = &GetDefaultChatPhotoCustomEmojiStickersRequest{} - _ bin.BareEncoder = &GetDefaultChatPhotoCustomEmojiStickersRequest{} - _ bin.BareDecoder = &GetDefaultChatPhotoCustomEmojiStickersRequest{} -) - -func (g *GetDefaultChatPhotoCustomEmojiStickersRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetDefaultChatPhotoCustomEmojiStickersRequest) String() string { - if g == nil { - return "GetDefaultChatPhotoCustomEmojiStickersRequest(nil)" - } - type Alias GetDefaultChatPhotoCustomEmojiStickersRequest - return fmt.Sprintf("GetDefaultChatPhotoCustomEmojiStickersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetDefaultChatPhotoCustomEmojiStickersRequest) TypeID() uint32 { - return GetDefaultChatPhotoCustomEmojiStickersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetDefaultChatPhotoCustomEmojiStickersRequest) TypeName() string { - return "getDefaultChatPhotoCustomEmojiStickers" -} - -// TypeInfo returns info about TL type. -func (g *GetDefaultChatPhotoCustomEmojiStickersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getDefaultChatPhotoCustomEmojiStickers", - ID: GetDefaultChatPhotoCustomEmojiStickersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetDefaultChatPhotoCustomEmojiStickersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultChatPhotoCustomEmojiStickers#e9917765 as nil") - } - b.PutID(GetDefaultChatPhotoCustomEmojiStickersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetDefaultChatPhotoCustomEmojiStickersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultChatPhotoCustomEmojiStickers#e9917765 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetDefaultChatPhotoCustomEmojiStickersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultChatPhotoCustomEmojiStickers#e9917765 to nil") - } - if err := b.ConsumeID(GetDefaultChatPhotoCustomEmojiStickersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getDefaultChatPhotoCustomEmojiStickers#e9917765: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetDefaultChatPhotoCustomEmojiStickersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultChatPhotoCustomEmojiStickers#e9917765 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetDefaultChatPhotoCustomEmojiStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultChatPhotoCustomEmojiStickers#e9917765 as nil") - } - b.ObjStart() - b.PutID("getDefaultChatPhotoCustomEmojiStickers") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetDefaultChatPhotoCustomEmojiStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultChatPhotoCustomEmojiStickers#e9917765 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getDefaultChatPhotoCustomEmojiStickers"); err != nil { - return fmt.Errorf("unable to decode getDefaultChatPhotoCustomEmojiStickers#e9917765: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDefaultChatPhotoCustomEmojiStickers invokes method getDefaultChatPhotoCustomEmojiStickers#e9917765 returning error if any. -func (c *Client) GetDefaultChatPhotoCustomEmojiStickers(ctx context.Context) (*Stickers, error) { - var result Stickers - - request := &GetDefaultChatPhotoCustomEmojiStickersRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_default_emoji_statuses_gen.go b/tdapi/tl_get_default_emoji_statuses_gen.go deleted file mode 100644 index e04699ff4..000000000 --- a/tdapi/tl_get_default_emoji_statuses_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetDefaultEmojiStatusesRequest represents TL type `getDefaultEmojiStatuses#24e45ec3`. -type GetDefaultEmojiStatusesRequest struct { -} - -// GetDefaultEmojiStatusesRequestTypeID is TL type id of GetDefaultEmojiStatusesRequest. -const GetDefaultEmojiStatusesRequestTypeID = 0x24e45ec3 - -// Ensuring interfaces in compile-time for GetDefaultEmojiStatusesRequest. -var ( - _ bin.Encoder = &GetDefaultEmojiStatusesRequest{} - _ bin.Decoder = &GetDefaultEmojiStatusesRequest{} - _ bin.BareEncoder = &GetDefaultEmojiStatusesRequest{} - _ bin.BareDecoder = &GetDefaultEmojiStatusesRequest{} -) - -func (g *GetDefaultEmojiStatusesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetDefaultEmojiStatusesRequest) String() string { - if g == nil { - return "GetDefaultEmojiStatusesRequest(nil)" - } - type Alias GetDefaultEmojiStatusesRequest - return fmt.Sprintf("GetDefaultEmojiStatusesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetDefaultEmojiStatusesRequest) TypeID() uint32 { - return GetDefaultEmojiStatusesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetDefaultEmojiStatusesRequest) TypeName() string { - return "getDefaultEmojiStatuses" -} - -// TypeInfo returns info about TL type. -func (g *GetDefaultEmojiStatusesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getDefaultEmojiStatuses", - ID: GetDefaultEmojiStatusesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetDefaultEmojiStatusesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultEmojiStatuses#24e45ec3 as nil") - } - b.PutID(GetDefaultEmojiStatusesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetDefaultEmojiStatusesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultEmojiStatuses#24e45ec3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetDefaultEmojiStatusesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultEmojiStatuses#24e45ec3 to nil") - } - if err := b.ConsumeID(GetDefaultEmojiStatusesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getDefaultEmojiStatuses#24e45ec3: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetDefaultEmojiStatusesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultEmojiStatuses#24e45ec3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetDefaultEmojiStatusesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultEmojiStatuses#24e45ec3 as nil") - } - b.ObjStart() - b.PutID("getDefaultEmojiStatuses") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetDefaultEmojiStatusesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultEmojiStatuses#24e45ec3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getDefaultEmojiStatuses"); err != nil { - return fmt.Errorf("unable to decode getDefaultEmojiStatuses#24e45ec3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDefaultEmojiStatuses invokes method getDefaultEmojiStatuses#24e45ec3 returning error if any. -func (c *Client) GetDefaultEmojiStatuses(ctx context.Context) (*EmojiStatuses, error) { - var result EmojiStatuses - - request := &GetDefaultEmojiStatusesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_default_message_auto_delete_time_gen.go b/tdapi/tl_get_default_message_auto_delete_time_gen.go deleted file mode 100644 index 044f3ab62..000000000 --- a/tdapi/tl_get_default_message_auto_delete_time_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetDefaultMessageAutoDeleteTimeRequest represents TL type `getDefaultMessageAutoDeleteTime#e520759a`. -type GetDefaultMessageAutoDeleteTimeRequest struct { -} - -// GetDefaultMessageAutoDeleteTimeRequestTypeID is TL type id of GetDefaultMessageAutoDeleteTimeRequest. -const GetDefaultMessageAutoDeleteTimeRequestTypeID = 0xe520759a - -// Ensuring interfaces in compile-time for GetDefaultMessageAutoDeleteTimeRequest. -var ( - _ bin.Encoder = &GetDefaultMessageAutoDeleteTimeRequest{} - _ bin.Decoder = &GetDefaultMessageAutoDeleteTimeRequest{} - _ bin.BareEncoder = &GetDefaultMessageAutoDeleteTimeRequest{} - _ bin.BareDecoder = &GetDefaultMessageAutoDeleteTimeRequest{} -) - -func (g *GetDefaultMessageAutoDeleteTimeRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetDefaultMessageAutoDeleteTimeRequest) String() string { - if g == nil { - return "GetDefaultMessageAutoDeleteTimeRequest(nil)" - } - type Alias GetDefaultMessageAutoDeleteTimeRequest - return fmt.Sprintf("GetDefaultMessageAutoDeleteTimeRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetDefaultMessageAutoDeleteTimeRequest) TypeID() uint32 { - return GetDefaultMessageAutoDeleteTimeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetDefaultMessageAutoDeleteTimeRequest) TypeName() string { - return "getDefaultMessageAutoDeleteTime" -} - -// TypeInfo returns info about TL type. -func (g *GetDefaultMessageAutoDeleteTimeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getDefaultMessageAutoDeleteTime", - ID: GetDefaultMessageAutoDeleteTimeRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetDefaultMessageAutoDeleteTimeRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultMessageAutoDeleteTime#e520759a as nil") - } - b.PutID(GetDefaultMessageAutoDeleteTimeRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetDefaultMessageAutoDeleteTimeRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultMessageAutoDeleteTime#e520759a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetDefaultMessageAutoDeleteTimeRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultMessageAutoDeleteTime#e520759a to nil") - } - if err := b.ConsumeID(GetDefaultMessageAutoDeleteTimeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getDefaultMessageAutoDeleteTime#e520759a: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetDefaultMessageAutoDeleteTimeRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultMessageAutoDeleteTime#e520759a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetDefaultMessageAutoDeleteTimeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultMessageAutoDeleteTime#e520759a as nil") - } - b.ObjStart() - b.PutID("getDefaultMessageAutoDeleteTime") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetDefaultMessageAutoDeleteTimeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultMessageAutoDeleteTime#e520759a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getDefaultMessageAutoDeleteTime"); err != nil { - return fmt.Errorf("unable to decode getDefaultMessageAutoDeleteTime#e520759a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDefaultMessageAutoDeleteTime invokes method getDefaultMessageAutoDeleteTime#e520759a returning error if any. -func (c *Client) GetDefaultMessageAutoDeleteTime(ctx context.Context) (*MessageAutoDeleteTime, error) { - var result MessageAutoDeleteTime - - request := &GetDefaultMessageAutoDeleteTimeRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_default_profile_photo_custom_emoji_stickers_gen.go b/tdapi/tl_get_default_profile_photo_custom_emoji_stickers_gen.go deleted file mode 100644 index 1e5c174a9..000000000 --- a/tdapi/tl_get_default_profile_photo_custom_emoji_stickers_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetDefaultProfilePhotoCustomEmojiStickersRequest represents TL type `getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7`. -type GetDefaultProfilePhotoCustomEmojiStickersRequest struct { -} - -// GetDefaultProfilePhotoCustomEmojiStickersRequestTypeID is TL type id of GetDefaultProfilePhotoCustomEmojiStickersRequest. -const GetDefaultProfilePhotoCustomEmojiStickersRequestTypeID = 0x4c4be2b7 - -// Ensuring interfaces in compile-time for GetDefaultProfilePhotoCustomEmojiStickersRequest. -var ( - _ bin.Encoder = &GetDefaultProfilePhotoCustomEmojiStickersRequest{} - _ bin.Decoder = &GetDefaultProfilePhotoCustomEmojiStickersRequest{} - _ bin.BareEncoder = &GetDefaultProfilePhotoCustomEmojiStickersRequest{} - _ bin.BareDecoder = &GetDefaultProfilePhotoCustomEmojiStickersRequest{} -) - -func (g *GetDefaultProfilePhotoCustomEmojiStickersRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetDefaultProfilePhotoCustomEmojiStickersRequest) String() string { - if g == nil { - return "GetDefaultProfilePhotoCustomEmojiStickersRequest(nil)" - } - type Alias GetDefaultProfilePhotoCustomEmojiStickersRequest - return fmt.Sprintf("GetDefaultProfilePhotoCustomEmojiStickersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetDefaultProfilePhotoCustomEmojiStickersRequest) TypeID() uint32 { - return GetDefaultProfilePhotoCustomEmojiStickersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetDefaultProfilePhotoCustomEmojiStickersRequest) TypeName() string { - return "getDefaultProfilePhotoCustomEmojiStickers" -} - -// TypeInfo returns info about TL type. -func (g *GetDefaultProfilePhotoCustomEmojiStickersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getDefaultProfilePhotoCustomEmojiStickers", - ID: GetDefaultProfilePhotoCustomEmojiStickersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetDefaultProfilePhotoCustomEmojiStickersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7 as nil") - } - b.PutID(GetDefaultProfilePhotoCustomEmojiStickersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetDefaultProfilePhotoCustomEmojiStickersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetDefaultProfilePhotoCustomEmojiStickersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7 to nil") - } - if err := b.ConsumeID(GetDefaultProfilePhotoCustomEmojiStickersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetDefaultProfilePhotoCustomEmojiStickersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetDefaultProfilePhotoCustomEmojiStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7 as nil") - } - b.ObjStart() - b.PutID("getDefaultProfilePhotoCustomEmojiStickers") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetDefaultProfilePhotoCustomEmojiStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getDefaultProfilePhotoCustomEmojiStickers"); err != nil { - return fmt.Errorf("unable to decode getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDefaultProfilePhotoCustomEmojiStickers invokes method getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7 returning error if any. -func (c *Client) GetDefaultProfilePhotoCustomEmojiStickers(ctx context.Context) (*Stickers, error) { - var result Stickers - - request := &GetDefaultProfilePhotoCustomEmojiStickersRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_disallowed_chat_emoji_statuses_gen.go b/tdapi/tl_get_disallowed_chat_emoji_statuses_gen.go deleted file mode 100644 index 1c289da2a..000000000 --- a/tdapi/tl_get_disallowed_chat_emoji_statuses_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetDisallowedChatEmojiStatusesRequest represents TL type `getDisallowedChatEmojiStatuses#d2144da0`. -type GetDisallowedChatEmojiStatusesRequest struct { -} - -// GetDisallowedChatEmojiStatusesRequestTypeID is TL type id of GetDisallowedChatEmojiStatusesRequest. -const GetDisallowedChatEmojiStatusesRequestTypeID = 0xd2144da0 - -// Ensuring interfaces in compile-time for GetDisallowedChatEmojiStatusesRequest. -var ( - _ bin.Encoder = &GetDisallowedChatEmojiStatusesRequest{} - _ bin.Decoder = &GetDisallowedChatEmojiStatusesRequest{} - _ bin.BareEncoder = &GetDisallowedChatEmojiStatusesRequest{} - _ bin.BareDecoder = &GetDisallowedChatEmojiStatusesRequest{} -) - -func (g *GetDisallowedChatEmojiStatusesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetDisallowedChatEmojiStatusesRequest) String() string { - if g == nil { - return "GetDisallowedChatEmojiStatusesRequest(nil)" - } - type Alias GetDisallowedChatEmojiStatusesRequest - return fmt.Sprintf("GetDisallowedChatEmojiStatusesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetDisallowedChatEmojiStatusesRequest) TypeID() uint32 { - return GetDisallowedChatEmojiStatusesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetDisallowedChatEmojiStatusesRequest) TypeName() string { - return "getDisallowedChatEmojiStatuses" -} - -// TypeInfo returns info about TL type. -func (g *GetDisallowedChatEmojiStatusesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getDisallowedChatEmojiStatuses", - ID: GetDisallowedChatEmojiStatusesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetDisallowedChatEmojiStatusesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDisallowedChatEmojiStatuses#d2144da0 as nil") - } - b.PutID(GetDisallowedChatEmojiStatusesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetDisallowedChatEmojiStatusesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getDisallowedChatEmojiStatuses#d2144da0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetDisallowedChatEmojiStatusesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDisallowedChatEmojiStatuses#d2144da0 to nil") - } - if err := b.ConsumeID(GetDisallowedChatEmojiStatusesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getDisallowedChatEmojiStatuses#d2144da0: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetDisallowedChatEmojiStatusesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getDisallowedChatEmojiStatuses#d2144da0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetDisallowedChatEmojiStatusesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getDisallowedChatEmojiStatuses#d2144da0 as nil") - } - b.ObjStart() - b.PutID("getDisallowedChatEmojiStatuses") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetDisallowedChatEmojiStatusesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getDisallowedChatEmojiStatuses#d2144da0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getDisallowedChatEmojiStatuses"); err != nil { - return fmt.Errorf("unable to decode getDisallowedChatEmojiStatuses#d2144da0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDisallowedChatEmojiStatuses invokes method getDisallowedChatEmojiStatuses#d2144da0 returning error if any. -func (c *Client) GetDisallowedChatEmojiStatuses(ctx context.Context) (*EmojiStatuses, error) { - var result EmojiStatuses - - request := &GetDisallowedChatEmojiStatusesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_emoji_categories_gen.go b/tdapi/tl_get_emoji_categories_gen.go deleted file mode 100644 index 0ea442a6d..000000000 --- a/tdapi/tl_get_emoji_categories_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetEmojiCategoriesRequest represents TL type `getEmojiCategories#7f86c16e`. -type GetEmojiCategoriesRequest struct { - // Type of emoji categories to return; pass null to get default emoji categories - Type EmojiCategoryTypeClass -} - -// GetEmojiCategoriesRequestTypeID is TL type id of GetEmojiCategoriesRequest. -const GetEmojiCategoriesRequestTypeID = 0x7f86c16e - -// Ensuring interfaces in compile-time for GetEmojiCategoriesRequest. -var ( - _ bin.Encoder = &GetEmojiCategoriesRequest{} - _ bin.Decoder = &GetEmojiCategoriesRequest{} - _ bin.BareEncoder = &GetEmojiCategoriesRequest{} - _ bin.BareDecoder = &GetEmojiCategoriesRequest{} -) - -func (g *GetEmojiCategoriesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetEmojiCategoriesRequest) String() string { - if g == nil { - return "GetEmojiCategoriesRequest(nil)" - } - type Alias GetEmojiCategoriesRequest - return fmt.Sprintf("GetEmojiCategoriesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetEmojiCategoriesRequest) TypeID() uint32 { - return GetEmojiCategoriesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetEmojiCategoriesRequest) TypeName() string { - return "getEmojiCategories" -} - -// TypeInfo returns info about TL type. -func (g *GetEmojiCategoriesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getEmojiCategories", - ID: GetEmojiCategoriesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetEmojiCategoriesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getEmojiCategories#7f86c16e as nil") - } - b.PutID(GetEmojiCategoriesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetEmojiCategoriesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getEmojiCategories#7f86c16e as nil") - } - if g.Type == nil { - return fmt.Errorf("unable to encode getEmojiCategories#7f86c16e: field type is nil") - } - if err := g.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode getEmojiCategories#7f86c16e: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetEmojiCategoriesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getEmojiCategories#7f86c16e to nil") - } - if err := b.ConsumeID(GetEmojiCategoriesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getEmojiCategories#7f86c16e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetEmojiCategoriesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getEmojiCategories#7f86c16e to nil") - } - { - value, err := DecodeEmojiCategoryType(b) - if err != nil { - return fmt.Errorf("unable to decode getEmojiCategories#7f86c16e: field type: %w", err) - } - g.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetEmojiCategoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getEmojiCategories#7f86c16e as nil") - } - b.ObjStart() - b.PutID("getEmojiCategories") - b.Comma() - b.FieldStart("type") - if g.Type == nil { - return fmt.Errorf("unable to encode getEmojiCategories#7f86c16e: field type is nil") - } - if err := g.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getEmojiCategories#7f86c16e: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetEmojiCategoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getEmojiCategories#7f86c16e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getEmojiCategories"); err != nil { - return fmt.Errorf("unable to decode getEmojiCategories#7f86c16e: %w", err) - } - case "type": - value, err := DecodeTDLibJSONEmojiCategoryType(b) - if err != nil { - return fmt.Errorf("unable to decode getEmojiCategories#7f86c16e: field type: %w", err) - } - g.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (g *GetEmojiCategoriesRequest) GetType() (value EmojiCategoryTypeClass) { - if g == nil { - return - } - return g.Type -} - -// GetEmojiCategories invokes method getEmojiCategories#7f86c16e returning error if any. -func (c *Client) GetEmojiCategories(ctx context.Context, type_ EmojiCategoryTypeClass) (*EmojiCategories, error) { - var result EmojiCategories - - request := &GetEmojiCategoriesRequest{ - Type: type_, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_emoji_reaction_gen.go b/tdapi/tl_get_emoji_reaction_gen.go deleted file mode 100644 index 47706b83e..000000000 --- a/tdapi/tl_get_emoji_reaction_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetEmojiReactionRequest represents TL type `getEmojiReaction#e53411dc`. -type GetEmojiReactionRequest struct { - // Text representation of the reaction - Emoji string -} - -// GetEmojiReactionRequestTypeID is TL type id of GetEmojiReactionRequest. -const GetEmojiReactionRequestTypeID = 0xe53411dc - -// Ensuring interfaces in compile-time for GetEmojiReactionRequest. -var ( - _ bin.Encoder = &GetEmojiReactionRequest{} - _ bin.Decoder = &GetEmojiReactionRequest{} - _ bin.BareEncoder = &GetEmojiReactionRequest{} - _ bin.BareDecoder = &GetEmojiReactionRequest{} -) - -func (g *GetEmojiReactionRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Emoji == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetEmojiReactionRequest) String() string { - if g == nil { - return "GetEmojiReactionRequest(nil)" - } - type Alias GetEmojiReactionRequest - return fmt.Sprintf("GetEmojiReactionRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetEmojiReactionRequest) TypeID() uint32 { - return GetEmojiReactionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetEmojiReactionRequest) TypeName() string { - return "getEmojiReaction" -} - -// TypeInfo returns info about TL type. -func (g *GetEmojiReactionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getEmojiReaction", - ID: GetEmojiReactionRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Emoji", - SchemaName: "emoji", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetEmojiReactionRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getEmojiReaction#e53411dc as nil") - } - b.PutID(GetEmojiReactionRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetEmojiReactionRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getEmojiReaction#e53411dc as nil") - } - b.PutString(g.Emoji) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetEmojiReactionRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getEmojiReaction#e53411dc to nil") - } - if err := b.ConsumeID(GetEmojiReactionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getEmojiReaction#e53411dc: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetEmojiReactionRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getEmojiReaction#e53411dc to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getEmojiReaction#e53411dc: field emoji: %w", err) - } - g.Emoji = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetEmojiReactionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getEmojiReaction#e53411dc as nil") - } - b.ObjStart() - b.PutID("getEmojiReaction") - b.Comma() - b.FieldStart("emoji") - b.PutString(g.Emoji) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetEmojiReactionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getEmojiReaction#e53411dc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getEmojiReaction"); err != nil { - return fmt.Errorf("unable to decode getEmojiReaction#e53411dc: %w", err) - } - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getEmojiReaction#e53411dc: field emoji: %w", err) - } - g.Emoji = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEmoji returns value of Emoji field. -func (g *GetEmojiReactionRequest) GetEmoji() (value string) { - if g == nil { - return - } - return g.Emoji -} - -// GetEmojiReaction invokes method getEmojiReaction#e53411dc returning error if any. -func (c *Client) GetEmojiReaction(ctx context.Context, emoji string) (*EmojiReaction, error) { - var result EmojiReaction - - request := &GetEmojiReactionRequest{ - Emoji: emoji, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_emoji_suggestions_url_gen.go b/tdapi/tl_get_emoji_suggestions_url_gen.go deleted file mode 100644 index bcc5cab18..000000000 --- a/tdapi/tl_get_emoji_suggestions_url_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetEmojiSuggestionsURLRequest represents TL type `getEmojiSuggestionsUrl#ac4f1b2f`. -type GetEmojiSuggestionsURLRequest struct { - // Language code for which the emoji replacements will be suggested - LanguageCode string -} - -// GetEmojiSuggestionsURLRequestTypeID is TL type id of GetEmojiSuggestionsURLRequest. -const GetEmojiSuggestionsURLRequestTypeID = 0xac4f1b2f - -// Ensuring interfaces in compile-time for GetEmojiSuggestionsURLRequest. -var ( - _ bin.Encoder = &GetEmojiSuggestionsURLRequest{} - _ bin.Decoder = &GetEmojiSuggestionsURLRequest{} - _ bin.BareEncoder = &GetEmojiSuggestionsURLRequest{} - _ bin.BareDecoder = &GetEmojiSuggestionsURLRequest{} -) - -func (g *GetEmojiSuggestionsURLRequest) Zero() bool { - if g == nil { - return true - } - if !(g.LanguageCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetEmojiSuggestionsURLRequest) String() string { - if g == nil { - return "GetEmojiSuggestionsURLRequest(nil)" - } - type Alias GetEmojiSuggestionsURLRequest - return fmt.Sprintf("GetEmojiSuggestionsURLRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetEmojiSuggestionsURLRequest) TypeID() uint32 { - return GetEmojiSuggestionsURLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetEmojiSuggestionsURLRequest) TypeName() string { - return "getEmojiSuggestionsUrl" -} - -// TypeInfo returns info about TL type. -func (g *GetEmojiSuggestionsURLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getEmojiSuggestionsUrl", - ID: GetEmojiSuggestionsURLRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetEmojiSuggestionsURLRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getEmojiSuggestionsUrl#ac4f1b2f as nil") - } - b.PutID(GetEmojiSuggestionsURLRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetEmojiSuggestionsURLRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getEmojiSuggestionsUrl#ac4f1b2f as nil") - } - b.PutString(g.LanguageCode) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetEmojiSuggestionsURLRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getEmojiSuggestionsUrl#ac4f1b2f to nil") - } - if err := b.ConsumeID(GetEmojiSuggestionsURLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getEmojiSuggestionsUrl#ac4f1b2f: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetEmojiSuggestionsURLRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getEmojiSuggestionsUrl#ac4f1b2f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getEmojiSuggestionsUrl#ac4f1b2f: field language_code: %w", err) - } - g.LanguageCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetEmojiSuggestionsURLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getEmojiSuggestionsUrl#ac4f1b2f as nil") - } - b.ObjStart() - b.PutID("getEmojiSuggestionsUrl") - b.Comma() - b.FieldStart("language_code") - b.PutString(g.LanguageCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetEmojiSuggestionsURLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getEmojiSuggestionsUrl#ac4f1b2f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getEmojiSuggestionsUrl"); err != nil { - return fmt.Errorf("unable to decode getEmojiSuggestionsUrl#ac4f1b2f: %w", err) - } - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getEmojiSuggestionsUrl#ac4f1b2f: field language_code: %w", err) - } - g.LanguageCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguageCode returns value of LanguageCode field. -func (g *GetEmojiSuggestionsURLRequest) GetLanguageCode() (value string) { - if g == nil { - return - } - return g.LanguageCode -} - -// GetEmojiSuggestionsURL invokes method getEmojiSuggestionsUrl#ac4f1b2f returning error if any. -func (c *Client) GetEmojiSuggestionsURL(ctx context.Context, languagecode string) (*HTTPURL, error) { - var result HTTPURL - - request := &GetEmojiSuggestionsURLRequest{ - LanguageCode: languagecode, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_external_link_gen.go b/tdapi/tl_get_external_link_gen.go deleted file mode 100644 index 51b30a03e..000000000 --- a/tdapi/tl_get_external_link_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetExternalLinkRequest represents TL type `getExternalLink#5e92f0eb`. -type GetExternalLinkRequest struct { - // The HTTP link - Link string - // Pass true if the current user allowed the bot, returned in getExternalLinkInfo, to - // send them messages - AllowWriteAccess bool -} - -// GetExternalLinkRequestTypeID is TL type id of GetExternalLinkRequest. -const GetExternalLinkRequestTypeID = 0x5e92f0eb - -// Ensuring interfaces in compile-time for GetExternalLinkRequest. -var ( - _ bin.Encoder = &GetExternalLinkRequest{} - _ bin.Decoder = &GetExternalLinkRequest{} - _ bin.BareEncoder = &GetExternalLinkRequest{} - _ bin.BareDecoder = &GetExternalLinkRequest{} -) - -func (g *GetExternalLinkRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Link == "") { - return false - } - if !(g.AllowWriteAccess == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetExternalLinkRequest) String() string { - if g == nil { - return "GetExternalLinkRequest(nil)" - } - type Alias GetExternalLinkRequest - return fmt.Sprintf("GetExternalLinkRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetExternalLinkRequest) TypeID() uint32 { - return GetExternalLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetExternalLinkRequest) TypeName() string { - return "getExternalLink" -} - -// TypeInfo returns info about TL type. -func (g *GetExternalLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getExternalLink", - ID: GetExternalLinkRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - { - Name: "AllowWriteAccess", - SchemaName: "allow_write_access", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetExternalLinkRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getExternalLink#5e92f0eb as nil") - } - b.PutID(GetExternalLinkRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetExternalLinkRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getExternalLink#5e92f0eb as nil") - } - b.PutString(g.Link) - b.PutBool(g.AllowWriteAccess) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetExternalLinkRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getExternalLink#5e92f0eb to nil") - } - if err := b.ConsumeID(GetExternalLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getExternalLink#5e92f0eb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetExternalLinkRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getExternalLink#5e92f0eb to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getExternalLink#5e92f0eb: field link: %w", err) - } - g.Link = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getExternalLink#5e92f0eb: field allow_write_access: %w", err) - } - g.AllowWriteAccess = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetExternalLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getExternalLink#5e92f0eb as nil") - } - b.ObjStart() - b.PutID("getExternalLink") - b.Comma() - b.FieldStart("link") - b.PutString(g.Link) - b.Comma() - b.FieldStart("allow_write_access") - b.PutBool(g.AllowWriteAccess) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetExternalLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getExternalLink#5e92f0eb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getExternalLink"); err != nil { - return fmt.Errorf("unable to decode getExternalLink#5e92f0eb: %w", err) - } - case "link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getExternalLink#5e92f0eb: field link: %w", err) - } - g.Link = value - case "allow_write_access": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getExternalLink#5e92f0eb: field allow_write_access: %w", err) - } - g.AllowWriteAccess = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (g *GetExternalLinkRequest) GetLink() (value string) { - if g == nil { - return - } - return g.Link -} - -// GetAllowWriteAccess returns value of AllowWriteAccess field. -func (g *GetExternalLinkRequest) GetAllowWriteAccess() (value bool) { - if g == nil { - return - } - return g.AllowWriteAccess -} - -// GetExternalLink invokes method getExternalLink#5e92f0eb returning error if any. -func (c *Client) GetExternalLink(ctx context.Context, request *GetExternalLinkRequest) (*HTTPURL, error) { - var result HTTPURL - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_external_link_info_gen.go b/tdapi/tl_get_external_link_info_gen.go deleted file mode 100644 index ff4b7cf20..000000000 --- a/tdapi/tl_get_external_link_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetExternalLinkInfoRequest represents TL type `getExternalLinkInfo#460d7a3f`. -type GetExternalLinkInfoRequest struct { - // The link - Link string -} - -// GetExternalLinkInfoRequestTypeID is TL type id of GetExternalLinkInfoRequest. -const GetExternalLinkInfoRequestTypeID = 0x460d7a3f - -// Ensuring interfaces in compile-time for GetExternalLinkInfoRequest. -var ( - _ bin.Encoder = &GetExternalLinkInfoRequest{} - _ bin.Decoder = &GetExternalLinkInfoRequest{} - _ bin.BareEncoder = &GetExternalLinkInfoRequest{} - _ bin.BareDecoder = &GetExternalLinkInfoRequest{} -) - -func (g *GetExternalLinkInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Link == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetExternalLinkInfoRequest) String() string { - if g == nil { - return "GetExternalLinkInfoRequest(nil)" - } - type Alias GetExternalLinkInfoRequest - return fmt.Sprintf("GetExternalLinkInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetExternalLinkInfoRequest) TypeID() uint32 { - return GetExternalLinkInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetExternalLinkInfoRequest) TypeName() string { - return "getExternalLinkInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetExternalLinkInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getExternalLinkInfo", - ID: GetExternalLinkInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetExternalLinkInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getExternalLinkInfo#460d7a3f as nil") - } - b.PutID(GetExternalLinkInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetExternalLinkInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getExternalLinkInfo#460d7a3f as nil") - } - b.PutString(g.Link) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetExternalLinkInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getExternalLinkInfo#460d7a3f to nil") - } - if err := b.ConsumeID(GetExternalLinkInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getExternalLinkInfo#460d7a3f: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetExternalLinkInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getExternalLinkInfo#460d7a3f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getExternalLinkInfo#460d7a3f: field link: %w", err) - } - g.Link = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetExternalLinkInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getExternalLinkInfo#460d7a3f as nil") - } - b.ObjStart() - b.PutID("getExternalLinkInfo") - b.Comma() - b.FieldStart("link") - b.PutString(g.Link) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetExternalLinkInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getExternalLinkInfo#460d7a3f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getExternalLinkInfo"); err != nil { - return fmt.Errorf("unable to decode getExternalLinkInfo#460d7a3f: %w", err) - } - case "link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getExternalLinkInfo#460d7a3f: field link: %w", err) - } - g.Link = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (g *GetExternalLinkInfoRequest) GetLink() (value string) { - if g == nil { - return - } - return g.Link -} - -// GetExternalLinkInfo invokes method getExternalLinkInfo#460d7a3f returning error if any. -func (c *Client) GetExternalLinkInfo(ctx context.Context, link string) (LoginURLInfoClass, error) { - var result LoginURLInfoBox - - request := &GetExternalLinkInfoRequest{ - Link: link, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.LoginUrlInfo, nil -} diff --git a/tdapi/tl_get_favorite_stickers_gen.go b/tdapi/tl_get_favorite_stickers_gen.go deleted file mode 100644 index dc1e93915..000000000 --- a/tdapi/tl_get_favorite_stickers_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetFavoriteStickersRequest represents TL type `getFavoriteStickers#ebcbcf40`. -type GetFavoriteStickersRequest struct { -} - -// GetFavoriteStickersRequestTypeID is TL type id of GetFavoriteStickersRequest. -const GetFavoriteStickersRequestTypeID = 0xebcbcf40 - -// Ensuring interfaces in compile-time for GetFavoriteStickersRequest. -var ( - _ bin.Encoder = &GetFavoriteStickersRequest{} - _ bin.Decoder = &GetFavoriteStickersRequest{} - _ bin.BareEncoder = &GetFavoriteStickersRequest{} - _ bin.BareDecoder = &GetFavoriteStickersRequest{} -) - -func (g *GetFavoriteStickersRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetFavoriteStickersRequest) String() string { - if g == nil { - return "GetFavoriteStickersRequest(nil)" - } - type Alias GetFavoriteStickersRequest - return fmt.Sprintf("GetFavoriteStickersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetFavoriteStickersRequest) TypeID() uint32 { - return GetFavoriteStickersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetFavoriteStickersRequest) TypeName() string { - return "getFavoriteStickers" -} - -// TypeInfo returns info about TL type. -func (g *GetFavoriteStickersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getFavoriteStickers", - ID: GetFavoriteStickersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetFavoriteStickersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getFavoriteStickers#ebcbcf40 as nil") - } - b.PutID(GetFavoriteStickersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetFavoriteStickersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getFavoriteStickers#ebcbcf40 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetFavoriteStickersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getFavoriteStickers#ebcbcf40 to nil") - } - if err := b.ConsumeID(GetFavoriteStickersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getFavoriteStickers#ebcbcf40: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetFavoriteStickersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getFavoriteStickers#ebcbcf40 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetFavoriteStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getFavoriteStickers#ebcbcf40 as nil") - } - b.ObjStart() - b.PutID("getFavoriteStickers") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetFavoriteStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getFavoriteStickers#ebcbcf40 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getFavoriteStickers"); err != nil { - return fmt.Errorf("unable to decode getFavoriteStickers#ebcbcf40: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFavoriteStickers invokes method getFavoriteStickers#ebcbcf40 returning error if any. -func (c *Client) GetFavoriteStickers(ctx context.Context) (*Stickers, error) { - var result Stickers - - request := &GetFavoriteStickersRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_file_downloaded_prefix_size_gen.go b/tdapi/tl_get_file_downloaded_prefix_size_gen.go deleted file mode 100644 index 5c24fe20f..000000000 --- a/tdapi/tl_get_file_downloaded_prefix_size_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetFileDownloadedPrefixSizeRequest represents TL type `getFileDownloadedPrefixSize#3304bd2d`. -type GetFileDownloadedPrefixSizeRequest struct { - // Identifier of the file - FileID int32 - // Offset from which downloaded prefix size needs to be calculated - Offset int64 -} - -// GetFileDownloadedPrefixSizeRequestTypeID is TL type id of GetFileDownloadedPrefixSizeRequest. -const GetFileDownloadedPrefixSizeRequestTypeID = 0x3304bd2d - -// Ensuring interfaces in compile-time for GetFileDownloadedPrefixSizeRequest. -var ( - _ bin.Encoder = &GetFileDownloadedPrefixSizeRequest{} - _ bin.Decoder = &GetFileDownloadedPrefixSizeRequest{} - _ bin.BareEncoder = &GetFileDownloadedPrefixSizeRequest{} - _ bin.BareDecoder = &GetFileDownloadedPrefixSizeRequest{} -) - -func (g *GetFileDownloadedPrefixSizeRequest) Zero() bool { - if g == nil { - return true - } - if !(g.FileID == 0) { - return false - } - if !(g.Offset == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetFileDownloadedPrefixSizeRequest) String() string { - if g == nil { - return "GetFileDownloadedPrefixSizeRequest(nil)" - } - type Alias GetFileDownloadedPrefixSizeRequest - return fmt.Sprintf("GetFileDownloadedPrefixSizeRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetFileDownloadedPrefixSizeRequest) TypeID() uint32 { - return GetFileDownloadedPrefixSizeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetFileDownloadedPrefixSizeRequest) TypeName() string { - return "getFileDownloadedPrefixSize" -} - -// TypeInfo returns info about TL type. -func (g *GetFileDownloadedPrefixSizeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getFileDownloadedPrefixSize", - ID: GetFileDownloadedPrefixSizeRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetFileDownloadedPrefixSizeRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getFileDownloadedPrefixSize#3304bd2d as nil") - } - b.PutID(GetFileDownloadedPrefixSizeRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetFileDownloadedPrefixSizeRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getFileDownloadedPrefixSize#3304bd2d as nil") - } - b.PutInt32(g.FileID) - b.PutInt53(g.Offset) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetFileDownloadedPrefixSizeRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getFileDownloadedPrefixSize#3304bd2d to nil") - } - if err := b.ConsumeID(GetFileDownloadedPrefixSizeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getFileDownloadedPrefixSize#3304bd2d: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetFileDownloadedPrefixSizeRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getFileDownloadedPrefixSize#3304bd2d to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getFileDownloadedPrefixSize#3304bd2d: field file_id: %w", err) - } - g.FileID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getFileDownloadedPrefixSize#3304bd2d: field offset: %w", err) - } - g.Offset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetFileDownloadedPrefixSizeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getFileDownloadedPrefixSize#3304bd2d as nil") - } - b.ObjStart() - b.PutID("getFileDownloadedPrefixSize") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(g.FileID) - b.Comma() - b.FieldStart("offset") - b.PutInt53(g.Offset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetFileDownloadedPrefixSizeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getFileDownloadedPrefixSize#3304bd2d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getFileDownloadedPrefixSize"); err != nil { - return fmt.Errorf("unable to decode getFileDownloadedPrefixSize#3304bd2d: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getFileDownloadedPrefixSize#3304bd2d: field file_id: %w", err) - } - g.FileID = value - case "offset": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getFileDownloadedPrefixSize#3304bd2d: field offset: %w", err) - } - g.Offset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (g *GetFileDownloadedPrefixSizeRequest) GetFileID() (value int32) { - if g == nil { - return - } - return g.FileID -} - -// GetOffset returns value of Offset field. -func (g *GetFileDownloadedPrefixSizeRequest) GetOffset() (value int64) { - if g == nil { - return - } - return g.Offset -} - -// GetFileDownloadedPrefixSize invokes method getFileDownloadedPrefixSize#3304bd2d returning error if any. -func (c *Client) GetFileDownloadedPrefixSize(ctx context.Context, request *GetFileDownloadedPrefixSizeRequest) (*FileDownloadedPrefixSize, error) { - var result FileDownloadedPrefixSize - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_file_extension_gen.go b/tdapi/tl_get_file_extension_gen.go deleted file mode 100644 index 9a0817353..000000000 --- a/tdapi/tl_get_file_extension_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetFileExtensionRequest represents TL type `getFileExtension#f9adb934`. -type GetFileExtensionRequest struct { - // The MIME type of the file - MimeType string -} - -// GetFileExtensionRequestTypeID is TL type id of GetFileExtensionRequest. -const GetFileExtensionRequestTypeID = 0xf9adb934 - -// Ensuring interfaces in compile-time for GetFileExtensionRequest. -var ( - _ bin.Encoder = &GetFileExtensionRequest{} - _ bin.Decoder = &GetFileExtensionRequest{} - _ bin.BareEncoder = &GetFileExtensionRequest{} - _ bin.BareDecoder = &GetFileExtensionRequest{} -) - -func (g *GetFileExtensionRequest) Zero() bool { - if g == nil { - return true - } - if !(g.MimeType == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetFileExtensionRequest) String() string { - if g == nil { - return "GetFileExtensionRequest(nil)" - } - type Alias GetFileExtensionRequest - return fmt.Sprintf("GetFileExtensionRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetFileExtensionRequest) TypeID() uint32 { - return GetFileExtensionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetFileExtensionRequest) TypeName() string { - return "getFileExtension" -} - -// TypeInfo returns info about TL type. -func (g *GetFileExtensionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getFileExtension", - ID: GetFileExtensionRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MimeType", - SchemaName: "mime_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetFileExtensionRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getFileExtension#f9adb934 as nil") - } - b.PutID(GetFileExtensionRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetFileExtensionRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getFileExtension#f9adb934 as nil") - } - b.PutString(g.MimeType) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetFileExtensionRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getFileExtension#f9adb934 to nil") - } - if err := b.ConsumeID(GetFileExtensionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getFileExtension#f9adb934: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetFileExtensionRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getFileExtension#f9adb934 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getFileExtension#f9adb934: field mime_type: %w", err) - } - g.MimeType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetFileExtensionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getFileExtension#f9adb934 as nil") - } - b.ObjStart() - b.PutID("getFileExtension") - b.Comma() - b.FieldStart("mime_type") - b.PutString(g.MimeType) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetFileExtensionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getFileExtension#f9adb934 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getFileExtension"); err != nil { - return fmt.Errorf("unable to decode getFileExtension#f9adb934: %w", err) - } - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getFileExtension#f9adb934: field mime_type: %w", err) - } - g.MimeType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMimeType returns value of MimeType field. -func (g *GetFileExtensionRequest) GetMimeType() (value string) { - if g == nil { - return - } - return g.MimeType -} - -// GetFileExtension invokes method getFileExtension#f9adb934 returning error if any. -func (c *Client) GetFileExtension(ctx context.Context, mimetype string) (*Text, error) { - var result Text - - request := &GetFileExtensionRequest{ - MimeType: mimetype, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_file_gen.go b/tdapi/tl_get_file_gen.go deleted file mode 100644 index a7c5a2b87..000000000 --- a/tdapi/tl_get_file_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetFileRequest represents TL type `getFile#5c9efd4e`. -type GetFileRequest struct { - // Identifier of the file to get - FileID int32 -} - -// GetFileRequestTypeID is TL type id of GetFileRequest. -const GetFileRequestTypeID = 0x5c9efd4e - -// Ensuring interfaces in compile-time for GetFileRequest. -var ( - _ bin.Encoder = &GetFileRequest{} - _ bin.Decoder = &GetFileRequest{} - _ bin.BareEncoder = &GetFileRequest{} - _ bin.BareDecoder = &GetFileRequest{} -) - -func (g *GetFileRequest) Zero() bool { - if g == nil { - return true - } - if !(g.FileID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetFileRequest) String() string { - if g == nil { - return "GetFileRequest(nil)" - } - type Alias GetFileRequest - return fmt.Sprintf("GetFileRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetFileRequest) TypeID() uint32 { - return GetFileRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetFileRequest) TypeName() string { - return "getFile" -} - -// TypeInfo returns info about TL type. -func (g *GetFileRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getFile", - ID: GetFileRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetFileRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getFile#5c9efd4e as nil") - } - b.PutID(GetFileRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetFileRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getFile#5c9efd4e as nil") - } - b.PutInt32(g.FileID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetFileRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getFile#5c9efd4e to nil") - } - if err := b.ConsumeID(GetFileRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getFile#5c9efd4e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetFileRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getFile#5c9efd4e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getFile#5c9efd4e: field file_id: %w", err) - } - g.FileID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getFile#5c9efd4e as nil") - } - b.ObjStart() - b.PutID("getFile") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(g.FileID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetFileRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getFile#5c9efd4e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getFile"); err != nil { - return fmt.Errorf("unable to decode getFile#5c9efd4e: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getFile#5c9efd4e: field file_id: %w", err) - } - g.FileID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (g *GetFileRequest) GetFileID() (value int32) { - if g == nil { - return - } - return g.FileID -} - -// GetFile invokes method getFile#5c9efd4e returning error if any. -func (c *Client) GetFile(ctx context.Context, fileid int32) (*File, error) { - var result File - - request := &GetFileRequest{ - FileID: fileid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_file_mime_type_gen.go b/tdapi/tl_get_file_mime_type_gen.go deleted file mode 100644 index aebb88248..000000000 --- a/tdapi/tl_get_file_mime_type_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetFileMimeTypeRequest represents TL type `getFileMimeType#84631b89`. -type GetFileMimeTypeRequest struct { - // The name of the file or path to the file - FileName string -} - -// GetFileMimeTypeRequestTypeID is TL type id of GetFileMimeTypeRequest. -const GetFileMimeTypeRequestTypeID = 0x84631b89 - -// Ensuring interfaces in compile-time for GetFileMimeTypeRequest. -var ( - _ bin.Encoder = &GetFileMimeTypeRequest{} - _ bin.Decoder = &GetFileMimeTypeRequest{} - _ bin.BareEncoder = &GetFileMimeTypeRequest{} - _ bin.BareDecoder = &GetFileMimeTypeRequest{} -) - -func (g *GetFileMimeTypeRequest) Zero() bool { - if g == nil { - return true - } - if !(g.FileName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetFileMimeTypeRequest) String() string { - if g == nil { - return "GetFileMimeTypeRequest(nil)" - } - type Alias GetFileMimeTypeRequest - return fmt.Sprintf("GetFileMimeTypeRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetFileMimeTypeRequest) TypeID() uint32 { - return GetFileMimeTypeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetFileMimeTypeRequest) TypeName() string { - return "getFileMimeType" -} - -// TypeInfo returns info about TL type. -func (g *GetFileMimeTypeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getFileMimeType", - ID: GetFileMimeTypeRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileName", - SchemaName: "file_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetFileMimeTypeRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getFileMimeType#84631b89 as nil") - } - b.PutID(GetFileMimeTypeRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetFileMimeTypeRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getFileMimeType#84631b89 as nil") - } - b.PutString(g.FileName) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetFileMimeTypeRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getFileMimeType#84631b89 to nil") - } - if err := b.ConsumeID(GetFileMimeTypeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getFileMimeType#84631b89: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetFileMimeTypeRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getFileMimeType#84631b89 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getFileMimeType#84631b89: field file_name: %w", err) - } - g.FileName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetFileMimeTypeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getFileMimeType#84631b89 as nil") - } - b.ObjStart() - b.PutID("getFileMimeType") - b.Comma() - b.FieldStart("file_name") - b.PutString(g.FileName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetFileMimeTypeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getFileMimeType#84631b89 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getFileMimeType"); err != nil { - return fmt.Errorf("unable to decode getFileMimeType#84631b89: %w", err) - } - case "file_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getFileMimeType#84631b89: field file_name: %w", err) - } - g.FileName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileName returns value of FileName field. -func (g *GetFileMimeTypeRequest) GetFileName() (value string) { - if g == nil { - return - } - return g.FileName -} - -// GetFileMimeType invokes method getFileMimeType#84631b89 returning error if any. -func (c *Client) GetFileMimeType(ctx context.Context, filename string) (*Text, error) { - var result Text - - request := &GetFileMimeTypeRequest{ - FileName: filename, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_forum_topic_default_icons_gen.go b/tdapi/tl_get_forum_topic_default_icons_gen.go deleted file mode 100644 index f0b736cae..000000000 --- a/tdapi/tl_get_forum_topic_default_icons_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetForumTopicDefaultIconsRequest represents TL type `getForumTopicDefaultIcons#583574dc`. -type GetForumTopicDefaultIconsRequest struct { -} - -// GetForumTopicDefaultIconsRequestTypeID is TL type id of GetForumTopicDefaultIconsRequest. -const GetForumTopicDefaultIconsRequestTypeID = 0x583574dc - -// Ensuring interfaces in compile-time for GetForumTopicDefaultIconsRequest. -var ( - _ bin.Encoder = &GetForumTopicDefaultIconsRequest{} - _ bin.Decoder = &GetForumTopicDefaultIconsRequest{} - _ bin.BareEncoder = &GetForumTopicDefaultIconsRequest{} - _ bin.BareDecoder = &GetForumTopicDefaultIconsRequest{} -) - -func (g *GetForumTopicDefaultIconsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetForumTopicDefaultIconsRequest) String() string { - if g == nil { - return "GetForumTopicDefaultIconsRequest(nil)" - } - type Alias GetForumTopicDefaultIconsRequest - return fmt.Sprintf("GetForumTopicDefaultIconsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetForumTopicDefaultIconsRequest) TypeID() uint32 { - return GetForumTopicDefaultIconsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetForumTopicDefaultIconsRequest) TypeName() string { - return "getForumTopicDefaultIcons" -} - -// TypeInfo returns info about TL type. -func (g *GetForumTopicDefaultIconsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getForumTopicDefaultIcons", - ID: GetForumTopicDefaultIconsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetForumTopicDefaultIconsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopicDefaultIcons#583574dc as nil") - } - b.PutID(GetForumTopicDefaultIconsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetForumTopicDefaultIconsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopicDefaultIcons#583574dc as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetForumTopicDefaultIconsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopicDefaultIcons#583574dc to nil") - } - if err := b.ConsumeID(GetForumTopicDefaultIconsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getForumTopicDefaultIcons#583574dc: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetForumTopicDefaultIconsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopicDefaultIcons#583574dc to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetForumTopicDefaultIconsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopicDefaultIcons#583574dc as nil") - } - b.ObjStart() - b.PutID("getForumTopicDefaultIcons") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetForumTopicDefaultIconsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopicDefaultIcons#583574dc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getForumTopicDefaultIcons"); err != nil { - return fmt.Errorf("unable to decode getForumTopicDefaultIcons#583574dc: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetForumTopicDefaultIcons invokes method getForumTopicDefaultIcons#583574dc returning error if any. -func (c *Client) GetForumTopicDefaultIcons(ctx context.Context) (*Stickers, error) { - var result Stickers - - request := &GetForumTopicDefaultIconsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_forum_topic_gen.go b/tdapi/tl_get_forum_topic_gen.go deleted file mode 100644 index b2eabe669..000000000 --- a/tdapi/tl_get_forum_topic_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetForumTopicRequest represents TL type `getForumTopic#e59bfe41`. -type GetForumTopicRequest struct { - // Identifier of the chat - ChatID int64 - // Message thread identifier of the forum topic - MessageThreadID int64 -} - -// GetForumTopicRequestTypeID is TL type id of GetForumTopicRequest. -const GetForumTopicRequestTypeID = 0xe59bfe41 - -// Ensuring interfaces in compile-time for GetForumTopicRequest. -var ( - _ bin.Encoder = &GetForumTopicRequest{} - _ bin.Decoder = &GetForumTopicRequest{} - _ bin.BareEncoder = &GetForumTopicRequest{} - _ bin.BareDecoder = &GetForumTopicRequest{} -) - -func (g *GetForumTopicRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageThreadID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetForumTopicRequest) String() string { - if g == nil { - return "GetForumTopicRequest(nil)" - } - type Alias GetForumTopicRequest - return fmt.Sprintf("GetForumTopicRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetForumTopicRequest) TypeID() uint32 { - return GetForumTopicRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetForumTopicRequest) TypeName() string { - return "getForumTopic" -} - -// TypeInfo returns info about TL type. -func (g *GetForumTopicRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getForumTopic", - ID: GetForumTopicRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetForumTopicRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopic#e59bfe41 as nil") - } - b.PutID(GetForumTopicRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetForumTopicRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopic#e59bfe41 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageThreadID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetForumTopicRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopic#e59bfe41 to nil") - } - if err := b.ConsumeID(GetForumTopicRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getForumTopic#e59bfe41: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetForumTopicRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopic#e59bfe41 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopic#e59bfe41: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopic#e59bfe41: field message_thread_id: %w", err) - } - g.MessageThreadID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetForumTopicRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopic#e59bfe41 as nil") - } - b.ObjStart() - b.PutID("getForumTopic") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(g.MessageThreadID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetForumTopicRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopic#e59bfe41 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getForumTopic"); err != nil { - return fmt.Errorf("unable to decode getForumTopic#e59bfe41: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopic#e59bfe41: field chat_id: %w", err) - } - g.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopic#e59bfe41: field message_thread_id: %w", err) - } - g.MessageThreadID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetForumTopicRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (g *GetForumTopicRequest) GetMessageThreadID() (value int64) { - if g == nil { - return - } - return g.MessageThreadID -} - -// GetForumTopic invokes method getForumTopic#e59bfe41 returning error if any. -func (c *Client) GetForumTopic(ctx context.Context, request *GetForumTopicRequest) (*ForumTopic, error) { - var result ForumTopic - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_forum_topic_link_gen.go b/tdapi/tl_get_forum_topic_link_gen.go deleted file mode 100644 index fe26f0190..000000000 --- a/tdapi/tl_get_forum_topic_link_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetForumTopicLinkRequest represents TL type `getForumTopicLink#c97b88cb`. -type GetForumTopicLinkRequest struct { - // Identifier of the chat - ChatID int64 - // Message thread identifier of the forum topic - MessageThreadID int64 -} - -// GetForumTopicLinkRequestTypeID is TL type id of GetForumTopicLinkRequest. -const GetForumTopicLinkRequestTypeID = 0xc97b88cb - -// Ensuring interfaces in compile-time for GetForumTopicLinkRequest. -var ( - _ bin.Encoder = &GetForumTopicLinkRequest{} - _ bin.Decoder = &GetForumTopicLinkRequest{} - _ bin.BareEncoder = &GetForumTopicLinkRequest{} - _ bin.BareDecoder = &GetForumTopicLinkRequest{} -) - -func (g *GetForumTopicLinkRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageThreadID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetForumTopicLinkRequest) String() string { - if g == nil { - return "GetForumTopicLinkRequest(nil)" - } - type Alias GetForumTopicLinkRequest - return fmt.Sprintf("GetForumTopicLinkRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetForumTopicLinkRequest) TypeID() uint32 { - return GetForumTopicLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetForumTopicLinkRequest) TypeName() string { - return "getForumTopicLink" -} - -// TypeInfo returns info about TL type. -func (g *GetForumTopicLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getForumTopicLink", - ID: GetForumTopicLinkRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetForumTopicLinkRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopicLink#c97b88cb as nil") - } - b.PutID(GetForumTopicLinkRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetForumTopicLinkRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopicLink#c97b88cb as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageThreadID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetForumTopicLinkRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopicLink#c97b88cb to nil") - } - if err := b.ConsumeID(GetForumTopicLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getForumTopicLink#c97b88cb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetForumTopicLinkRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopicLink#c97b88cb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopicLink#c97b88cb: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopicLink#c97b88cb: field message_thread_id: %w", err) - } - g.MessageThreadID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetForumTopicLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopicLink#c97b88cb as nil") - } - b.ObjStart() - b.PutID("getForumTopicLink") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(g.MessageThreadID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetForumTopicLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopicLink#c97b88cb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getForumTopicLink"); err != nil { - return fmt.Errorf("unable to decode getForumTopicLink#c97b88cb: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopicLink#c97b88cb: field chat_id: %w", err) - } - g.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopicLink#c97b88cb: field message_thread_id: %w", err) - } - g.MessageThreadID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetForumTopicLinkRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (g *GetForumTopicLinkRequest) GetMessageThreadID() (value int64) { - if g == nil { - return - } - return g.MessageThreadID -} - -// GetForumTopicLink invokes method getForumTopicLink#c97b88cb returning error if any. -func (c *Client) GetForumTopicLink(ctx context.Context, request *GetForumTopicLinkRequest) (*MessageLink, error) { - var result MessageLink - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_forum_topics_gen.go b/tdapi/tl_get_forum_topics_gen.go deleted file mode 100644 index 88fd5fcd4..000000000 --- a/tdapi/tl_get_forum_topics_gen.go +++ /dev/null @@ -1,377 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetForumTopicsRequest represents TL type `getForumTopics#fbab7d5a`. -type GetForumTopicsRequest struct { - // Identifier of the forum chat - ChatID int64 - // Query to search for in the forum topic's name - Query string - // The date starting from which the results need to be fetched. Use 0 or any date in the - // future to get results from the last topic - OffsetDate int32 - // The message identifier of the last message in the last found topic, or 0 for the first - // request - OffsetMessageID int64 - // The message thread identifier of the last found topic, or 0 for the first request - OffsetMessageThreadID int64 - // The maximum number of forum topics to be returned; up to 100. For optimal performance, - // the number of returned forum topics is chosen by TDLib and can be smaller than the - // specified limit - Limit int32 -} - -// GetForumTopicsRequestTypeID is TL type id of GetForumTopicsRequest. -const GetForumTopicsRequestTypeID = 0xfbab7d5a - -// Ensuring interfaces in compile-time for GetForumTopicsRequest. -var ( - _ bin.Encoder = &GetForumTopicsRequest{} - _ bin.Decoder = &GetForumTopicsRequest{} - _ bin.BareEncoder = &GetForumTopicsRequest{} - _ bin.BareDecoder = &GetForumTopicsRequest{} -) - -func (g *GetForumTopicsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.Query == "") { - return false - } - if !(g.OffsetDate == 0) { - return false - } - if !(g.OffsetMessageID == 0) { - return false - } - if !(g.OffsetMessageThreadID == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetForumTopicsRequest) String() string { - if g == nil { - return "GetForumTopicsRequest(nil)" - } - type Alias GetForumTopicsRequest - return fmt.Sprintf("GetForumTopicsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetForumTopicsRequest) TypeID() uint32 { - return GetForumTopicsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetForumTopicsRequest) TypeName() string { - return "getForumTopics" -} - -// TypeInfo returns info about TL type. -func (g *GetForumTopicsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getForumTopics", - ID: GetForumTopicsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "OffsetDate", - SchemaName: "offset_date", - }, - { - Name: "OffsetMessageID", - SchemaName: "offset_message_id", - }, - { - Name: "OffsetMessageThreadID", - SchemaName: "offset_message_thread_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetForumTopicsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopics#fbab7d5a as nil") - } - b.PutID(GetForumTopicsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetForumTopicsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopics#fbab7d5a as nil") - } - b.PutInt53(g.ChatID) - b.PutString(g.Query) - b.PutInt32(g.OffsetDate) - b.PutInt53(g.OffsetMessageID) - b.PutInt53(g.OffsetMessageThreadID) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetForumTopicsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopics#fbab7d5a to nil") - } - if err := b.ConsumeID(GetForumTopicsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetForumTopicsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopics#fbab7d5a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field query: %w", err) - } - g.Query = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_date: %w", err) - } - g.OffsetDate = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_message_id: %w", err) - } - g.OffsetMessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_message_thread_id: %w", err) - } - g.OffsetMessageThreadID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetForumTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getForumTopics#fbab7d5a as nil") - } - b.ObjStart() - b.PutID("getForumTopics") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("query") - b.PutString(g.Query) - b.Comma() - b.FieldStart("offset_date") - b.PutInt32(g.OffsetDate) - b.Comma() - b.FieldStart("offset_message_id") - b.PutInt53(g.OffsetMessageID) - b.Comma() - b.FieldStart("offset_message_thread_id") - b.PutInt53(g.OffsetMessageThreadID) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetForumTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getForumTopics#fbab7d5a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getForumTopics"); err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field chat_id: %w", err) - } - g.ChatID = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field query: %w", err) - } - g.Query = value - case "offset_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_date: %w", err) - } - g.OffsetDate = value - case "offset_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_message_id: %w", err) - } - g.OffsetMessageID = value - case "offset_message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field offset_message_thread_id: %w", err) - } - g.OffsetMessageThreadID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getForumTopics#fbab7d5a: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetForumTopicsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetQuery returns value of Query field. -func (g *GetForumTopicsRequest) GetQuery() (value string) { - if g == nil { - return - } - return g.Query -} - -// GetOffsetDate returns value of OffsetDate field. -func (g *GetForumTopicsRequest) GetOffsetDate() (value int32) { - if g == nil { - return - } - return g.OffsetDate -} - -// GetOffsetMessageID returns value of OffsetMessageID field. -func (g *GetForumTopicsRequest) GetOffsetMessageID() (value int64) { - if g == nil { - return - } - return g.OffsetMessageID -} - -// GetOffsetMessageThreadID returns value of OffsetMessageThreadID field. -func (g *GetForumTopicsRequest) GetOffsetMessageThreadID() (value int64) { - if g == nil { - return - } - return g.OffsetMessageThreadID -} - -// GetLimit returns value of Limit field. -func (g *GetForumTopicsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetForumTopics invokes method getForumTopics#fbab7d5a returning error if any. -func (c *Client) GetForumTopics(ctx context.Context, request *GetForumTopicsRequest) (*ForumTopics, error) { - var result ForumTopics - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_game_high_scores_gen.go b/tdapi/tl_get_game_high_scores_gen.go deleted file mode 100644 index 964371022..000000000 --- a/tdapi/tl_get_game_high_scores_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetGameHighScoresRequest represents TL type `getGameHighScores#f0459b`. -type GetGameHighScoresRequest struct { - // The chat that contains the message with the game - ChatID int64 - // Identifier of the message - MessageID int64 - // User identifier - UserID int64 -} - -// GetGameHighScoresRequestTypeID is TL type id of GetGameHighScoresRequest. -const GetGameHighScoresRequestTypeID = 0xf0459b - -// Ensuring interfaces in compile-time for GetGameHighScoresRequest. -var ( - _ bin.Encoder = &GetGameHighScoresRequest{} - _ bin.Decoder = &GetGameHighScoresRequest{} - _ bin.BareEncoder = &GetGameHighScoresRequest{} - _ bin.BareDecoder = &GetGameHighScoresRequest{} -) - -func (g *GetGameHighScoresRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetGameHighScoresRequest) String() string { - if g == nil { - return "GetGameHighScoresRequest(nil)" - } - type Alias GetGameHighScoresRequest - return fmt.Sprintf("GetGameHighScoresRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetGameHighScoresRequest) TypeID() uint32 { - return GetGameHighScoresRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetGameHighScoresRequest) TypeName() string { - return "getGameHighScores" -} - -// TypeInfo returns info about TL type. -func (g *GetGameHighScoresRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getGameHighScores", - ID: GetGameHighScoresRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetGameHighScoresRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGameHighScores#f0459b as nil") - } - b.PutID(GetGameHighScoresRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetGameHighScoresRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGameHighScores#f0459b as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - b.PutInt53(g.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetGameHighScoresRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGameHighScores#f0459b to nil") - } - if err := b.ConsumeID(GetGameHighScoresRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getGameHighScores#f0459b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetGameHighScoresRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGameHighScores#f0459b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGameHighScores#f0459b: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGameHighScores#f0459b: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGameHighScores#f0459b: field user_id: %w", err) - } - g.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetGameHighScoresRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getGameHighScores#f0459b as nil") - } - b.ObjStart() - b.PutID("getGameHighScores") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetGameHighScoresRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getGameHighScores#f0459b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getGameHighScores"); err != nil { - return fmt.Errorf("unable to decode getGameHighScores#f0459b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGameHighScores#f0459b: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGameHighScores#f0459b: field message_id: %w", err) - } - g.MessageID = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGameHighScores#f0459b: field user_id: %w", err) - } - g.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetGameHighScoresRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetGameHighScoresRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetUserID returns value of UserID field. -func (g *GetGameHighScoresRequest) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetGameHighScores invokes method getGameHighScores#f0459b returning error if any. -func (c *Client) GetGameHighScores(ctx context.Context, request *GetGameHighScoresRequest) (*GameHighScores, error) { - var result GameHighScores - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_gift_upgrade_preview_gen.go b/tdapi/tl_get_gift_upgrade_preview_gen.go deleted file mode 100644 index 3c5f6ad2e..000000000 --- a/tdapi/tl_get_gift_upgrade_preview_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetGiftUpgradePreviewRequest represents TL type `getGiftUpgradePreview#bdcbc25d`. -type GetGiftUpgradePreviewRequest struct { - // Identifier of the gift - GiftID int64 -} - -// GetGiftUpgradePreviewRequestTypeID is TL type id of GetGiftUpgradePreviewRequest. -const GetGiftUpgradePreviewRequestTypeID = 0xbdcbc25d - -// Ensuring interfaces in compile-time for GetGiftUpgradePreviewRequest. -var ( - _ bin.Encoder = &GetGiftUpgradePreviewRequest{} - _ bin.Decoder = &GetGiftUpgradePreviewRequest{} - _ bin.BareEncoder = &GetGiftUpgradePreviewRequest{} - _ bin.BareDecoder = &GetGiftUpgradePreviewRequest{} -) - -func (g *GetGiftUpgradePreviewRequest) Zero() bool { - if g == nil { - return true - } - if !(g.GiftID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetGiftUpgradePreviewRequest) String() string { - if g == nil { - return "GetGiftUpgradePreviewRequest(nil)" - } - type Alias GetGiftUpgradePreviewRequest - return fmt.Sprintf("GetGiftUpgradePreviewRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetGiftUpgradePreviewRequest) TypeID() uint32 { - return GetGiftUpgradePreviewRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetGiftUpgradePreviewRequest) TypeName() string { - return "getGiftUpgradePreview" -} - -// TypeInfo returns info about TL type. -func (g *GetGiftUpgradePreviewRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getGiftUpgradePreview", - ID: GetGiftUpgradePreviewRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GiftID", - SchemaName: "gift_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetGiftUpgradePreviewRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGiftUpgradePreview#bdcbc25d as nil") - } - b.PutID(GetGiftUpgradePreviewRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetGiftUpgradePreviewRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGiftUpgradePreview#bdcbc25d as nil") - } - b.PutLong(g.GiftID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetGiftUpgradePreviewRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGiftUpgradePreview#bdcbc25d to nil") - } - if err := b.ConsumeID(GetGiftUpgradePreviewRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getGiftUpgradePreview#bdcbc25d: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetGiftUpgradePreviewRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGiftUpgradePreview#bdcbc25d to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getGiftUpgradePreview#bdcbc25d: field gift_id: %w", err) - } - g.GiftID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetGiftUpgradePreviewRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getGiftUpgradePreview#bdcbc25d as nil") - } - b.ObjStart() - b.PutID("getGiftUpgradePreview") - b.Comma() - b.FieldStart("gift_id") - b.PutLong(g.GiftID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetGiftUpgradePreviewRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getGiftUpgradePreview#bdcbc25d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getGiftUpgradePreview"); err != nil { - return fmt.Errorf("unable to decode getGiftUpgradePreview#bdcbc25d: %w", err) - } - case "gift_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getGiftUpgradePreview#bdcbc25d: field gift_id: %w", err) - } - g.GiftID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGiftID returns value of GiftID field. -func (g *GetGiftUpgradePreviewRequest) GetGiftID() (value int64) { - if g == nil { - return - } - return g.GiftID -} - -// GetGiftUpgradePreview invokes method getGiftUpgradePreview#bdcbc25d returning error if any. -func (c *Client) GetGiftUpgradePreview(ctx context.Context, giftid int64) (*GiftUpgradePreview, error) { - var result GiftUpgradePreview - - request := &GetGiftUpgradePreviewRequest{ - GiftID: giftid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_giveaway_info_gen.go b/tdapi/tl_get_giveaway_info_gen.go deleted file mode 100644 index 7963b2475..000000000 --- a/tdapi/tl_get_giveaway_info_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetGiveawayInfoRequest represents TL type `getGiveawayInfo#b78790bb`. -type GetGiveawayInfoRequest struct { - // Identifier of the channel chat which started the giveaway - ChatID int64 - // Identifier of the giveaway or a giveaway winners message in the chat - MessageID int64 -} - -// GetGiveawayInfoRequestTypeID is TL type id of GetGiveawayInfoRequest. -const GetGiveawayInfoRequestTypeID = 0xb78790bb - -// Ensuring interfaces in compile-time for GetGiveawayInfoRequest. -var ( - _ bin.Encoder = &GetGiveawayInfoRequest{} - _ bin.Decoder = &GetGiveawayInfoRequest{} - _ bin.BareEncoder = &GetGiveawayInfoRequest{} - _ bin.BareDecoder = &GetGiveawayInfoRequest{} -) - -func (g *GetGiveawayInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetGiveawayInfoRequest) String() string { - if g == nil { - return "GetGiveawayInfoRequest(nil)" - } - type Alias GetGiveawayInfoRequest - return fmt.Sprintf("GetGiveawayInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetGiveawayInfoRequest) TypeID() uint32 { - return GetGiveawayInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetGiveawayInfoRequest) TypeName() string { - return "getGiveawayInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetGiveawayInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getGiveawayInfo", - ID: GetGiveawayInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetGiveawayInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGiveawayInfo#b78790bb as nil") - } - b.PutID(GetGiveawayInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetGiveawayInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGiveawayInfo#b78790bb as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetGiveawayInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGiveawayInfo#b78790bb to nil") - } - if err := b.ConsumeID(GetGiveawayInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetGiveawayInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGiveawayInfo#b78790bb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: field message_id: %w", err) - } - g.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetGiveawayInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getGiveawayInfo#b78790bb as nil") - } - b.ObjStart() - b.PutID("getGiveawayInfo") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetGiveawayInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getGiveawayInfo#b78790bb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getGiveawayInfo"); err != nil { - return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGiveawayInfo#b78790bb: field message_id: %w", err) - } - g.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetGiveawayInfoRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetGiveawayInfoRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetGiveawayInfo invokes method getGiveawayInfo#b78790bb returning error if any. -func (c *Client) GetGiveawayInfo(ctx context.Context, request *GetGiveawayInfoRequest) (GiveawayInfoClass, error) { - var result GiveawayInfoBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.GiveawayInfo, nil -} diff --git a/tdapi/tl_get_greeting_stickers_gen.go b/tdapi/tl_get_greeting_stickers_gen.go deleted file mode 100644 index fac773d5e..000000000 --- a/tdapi/tl_get_greeting_stickers_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetGreetingStickersRequest represents TL type `getGreetingStickers#16581d1c`. -type GetGreetingStickersRequest struct { -} - -// GetGreetingStickersRequestTypeID is TL type id of GetGreetingStickersRequest. -const GetGreetingStickersRequestTypeID = 0x16581d1c - -// Ensuring interfaces in compile-time for GetGreetingStickersRequest. -var ( - _ bin.Encoder = &GetGreetingStickersRequest{} - _ bin.Decoder = &GetGreetingStickersRequest{} - _ bin.BareEncoder = &GetGreetingStickersRequest{} - _ bin.BareDecoder = &GetGreetingStickersRequest{} -) - -func (g *GetGreetingStickersRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetGreetingStickersRequest) String() string { - if g == nil { - return "GetGreetingStickersRequest(nil)" - } - type Alias GetGreetingStickersRequest - return fmt.Sprintf("GetGreetingStickersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetGreetingStickersRequest) TypeID() uint32 { - return GetGreetingStickersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetGreetingStickersRequest) TypeName() string { - return "getGreetingStickers" -} - -// TypeInfo returns info about TL type. -func (g *GetGreetingStickersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getGreetingStickers", - ID: GetGreetingStickersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetGreetingStickersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGreetingStickers#16581d1c as nil") - } - b.PutID(GetGreetingStickersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetGreetingStickersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGreetingStickers#16581d1c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetGreetingStickersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGreetingStickers#16581d1c to nil") - } - if err := b.ConsumeID(GetGreetingStickersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getGreetingStickers#16581d1c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetGreetingStickersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGreetingStickers#16581d1c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetGreetingStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getGreetingStickers#16581d1c as nil") - } - b.ObjStart() - b.PutID("getGreetingStickers") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetGreetingStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getGreetingStickers#16581d1c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getGreetingStickers"); err != nil { - return fmt.Errorf("unable to decode getGreetingStickers#16581d1c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGreetingStickers invokes method getGreetingStickers#16581d1c returning error if any. -func (c *Client) GetGreetingStickers(ctx context.Context) (*Stickers, error) { - var result Stickers - - request := &GetGreetingStickersRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_grossing_web_app_bots_gen.go b/tdapi/tl_get_grossing_web_app_bots_gen.go deleted file mode 100644 index aec144d87..000000000 --- a/tdapi/tl_get_grossing_web_app_bots_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetGrossingWebAppBotsRequest represents TL type `getGrossingWebAppBots#6522ce1a`. -type GetGrossingWebAppBotsRequest struct { - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of bots to be returned; up to 100 - Limit int32 -} - -// GetGrossingWebAppBotsRequestTypeID is TL type id of GetGrossingWebAppBotsRequest. -const GetGrossingWebAppBotsRequestTypeID = 0x6522ce1a - -// Ensuring interfaces in compile-time for GetGrossingWebAppBotsRequest. -var ( - _ bin.Encoder = &GetGrossingWebAppBotsRequest{} - _ bin.Decoder = &GetGrossingWebAppBotsRequest{} - _ bin.BareEncoder = &GetGrossingWebAppBotsRequest{} - _ bin.BareDecoder = &GetGrossingWebAppBotsRequest{} -) - -func (g *GetGrossingWebAppBotsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetGrossingWebAppBotsRequest) String() string { - if g == nil { - return "GetGrossingWebAppBotsRequest(nil)" - } - type Alias GetGrossingWebAppBotsRequest - return fmt.Sprintf("GetGrossingWebAppBotsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetGrossingWebAppBotsRequest) TypeID() uint32 { - return GetGrossingWebAppBotsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetGrossingWebAppBotsRequest) TypeName() string { - return "getGrossingWebAppBots" -} - -// TypeInfo returns info about TL type. -func (g *GetGrossingWebAppBotsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getGrossingWebAppBots", - ID: GetGrossingWebAppBotsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetGrossingWebAppBotsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGrossingWebAppBots#6522ce1a as nil") - } - b.PutID(GetGrossingWebAppBotsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetGrossingWebAppBotsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGrossingWebAppBots#6522ce1a as nil") - } - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetGrossingWebAppBotsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGrossingWebAppBots#6522ce1a to nil") - } - if err := b.ConsumeID(GetGrossingWebAppBotsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetGrossingWebAppBotsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGrossingWebAppBots#6522ce1a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetGrossingWebAppBotsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getGrossingWebAppBots#6522ce1a as nil") - } - b.ObjStart() - b.PutID("getGrossingWebAppBots") - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetGrossingWebAppBotsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getGrossingWebAppBots#6522ce1a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getGrossingWebAppBots"); err != nil { - return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: %w", err) - } - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGrossingWebAppBots#6522ce1a: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOffset returns value of Offset field. -func (g *GetGrossingWebAppBotsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetGrossingWebAppBotsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetGrossingWebAppBots invokes method getGrossingWebAppBots#6522ce1a returning error if any. -func (c *Client) GetGrossingWebAppBots(ctx context.Context, request *GetGrossingWebAppBotsRequest) (*FoundUsers, error) { - var result FoundUsers - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_group_call_gen.go b/tdapi/tl_get_group_call_gen.go deleted file mode 100644 index a55c8ec5d..000000000 --- a/tdapi/tl_get_group_call_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetGroupCallRequest represents TL type `getGroupCall#5787668e`. -type GetGroupCallRequest struct { - // Group call identifier - GroupCallID int32 -} - -// GetGroupCallRequestTypeID is TL type id of GetGroupCallRequest. -const GetGroupCallRequestTypeID = 0x5787668e - -// Ensuring interfaces in compile-time for GetGroupCallRequest. -var ( - _ bin.Encoder = &GetGroupCallRequest{} - _ bin.Decoder = &GetGroupCallRequest{} - _ bin.BareEncoder = &GetGroupCallRequest{} - _ bin.BareDecoder = &GetGroupCallRequest{} -) - -func (g *GetGroupCallRequest) Zero() bool { - if g == nil { - return true - } - if !(g.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetGroupCallRequest) String() string { - if g == nil { - return "GetGroupCallRequest(nil)" - } - type Alias GetGroupCallRequest - return fmt.Sprintf("GetGroupCallRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetGroupCallRequest) TypeID() uint32 { - return GetGroupCallRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetGroupCallRequest) TypeName() string { - return "getGroupCall" -} - -// TypeInfo returns info about TL type. -func (g *GetGroupCallRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getGroupCall", - ID: GetGroupCallRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetGroupCallRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCall#5787668e as nil") - } - b.PutID(GetGroupCallRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetGroupCallRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCall#5787668e as nil") - } - b.PutInt32(g.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetGroupCallRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCall#5787668e to nil") - } - if err := b.ConsumeID(GetGroupCallRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getGroupCall#5787668e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetGroupCallRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCall#5787668e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCall#5787668e: field group_call_id: %w", err) - } - g.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetGroupCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCall#5787668e as nil") - } - b.ObjStart() - b.PutID("getGroupCall") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(g.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetGroupCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCall#5787668e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getGroupCall"); err != nil { - return fmt.Errorf("unable to decode getGroupCall#5787668e: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCall#5787668e: field group_call_id: %w", err) - } - g.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (g *GetGroupCallRequest) GetGroupCallID() (value int32) { - if g == nil { - return - } - return g.GroupCallID -} - -// GetGroupCall invokes method getGroupCall#5787668e returning error if any. -func (c *Client) GetGroupCall(ctx context.Context, groupcallid int32) (*GroupCall, error) { - var result GroupCall - - request := &GetGroupCallRequest{ - GroupCallID: groupcallid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_group_call_invite_link_gen.go b/tdapi/tl_get_group_call_invite_link_gen.go deleted file mode 100644 index bd96f380c..000000000 --- a/tdapi/tl_get_group_call_invite_link_gen.go +++ /dev/null @@ -1,239 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetGroupCallInviteLinkRequest represents TL type `getGroupCallInviteLink#2ae14924`. -type GetGroupCallInviteLinkRequest struct { - // Group call identifier - GroupCallID int32 - // Pass true if the invite link needs to contain an invite hash, passing which to - // joinGroupCall would allow the invited user to unmute themselves. Requires groupCall - // can_be_managed group call flag - CanSelfUnmute bool -} - -// GetGroupCallInviteLinkRequestTypeID is TL type id of GetGroupCallInviteLinkRequest. -const GetGroupCallInviteLinkRequestTypeID = 0x2ae14924 - -// Ensuring interfaces in compile-time for GetGroupCallInviteLinkRequest. -var ( - _ bin.Encoder = &GetGroupCallInviteLinkRequest{} - _ bin.Decoder = &GetGroupCallInviteLinkRequest{} - _ bin.BareEncoder = &GetGroupCallInviteLinkRequest{} - _ bin.BareDecoder = &GetGroupCallInviteLinkRequest{} -) - -func (g *GetGroupCallInviteLinkRequest) Zero() bool { - if g == nil { - return true - } - if !(g.GroupCallID == 0) { - return false - } - if !(g.CanSelfUnmute == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetGroupCallInviteLinkRequest) String() string { - if g == nil { - return "GetGroupCallInviteLinkRequest(nil)" - } - type Alias GetGroupCallInviteLinkRequest - return fmt.Sprintf("GetGroupCallInviteLinkRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetGroupCallInviteLinkRequest) TypeID() uint32 { - return GetGroupCallInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetGroupCallInviteLinkRequest) TypeName() string { - return "getGroupCallInviteLink" -} - -// TypeInfo returns info about TL type. -func (g *GetGroupCallInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getGroupCallInviteLink", - ID: GetGroupCallInviteLinkRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "CanSelfUnmute", - SchemaName: "can_self_unmute", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetGroupCallInviteLinkRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCallInviteLink#2ae14924 as nil") - } - b.PutID(GetGroupCallInviteLinkRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetGroupCallInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCallInviteLink#2ae14924 as nil") - } - b.PutInt32(g.GroupCallID) - b.PutBool(g.CanSelfUnmute) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetGroupCallInviteLinkRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCallInviteLink#2ae14924 to nil") - } - if err := b.ConsumeID(GetGroupCallInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getGroupCallInviteLink#2ae14924: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetGroupCallInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCallInviteLink#2ae14924 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallInviteLink#2ae14924: field group_call_id: %w", err) - } - g.GroupCallID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallInviteLink#2ae14924: field can_self_unmute: %w", err) - } - g.CanSelfUnmute = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetGroupCallInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCallInviteLink#2ae14924 as nil") - } - b.ObjStart() - b.PutID("getGroupCallInviteLink") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(g.GroupCallID) - b.Comma() - b.FieldStart("can_self_unmute") - b.PutBool(g.CanSelfUnmute) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetGroupCallInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCallInviteLink#2ae14924 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getGroupCallInviteLink"); err != nil { - return fmt.Errorf("unable to decode getGroupCallInviteLink#2ae14924: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallInviteLink#2ae14924: field group_call_id: %w", err) - } - g.GroupCallID = value - case "can_self_unmute": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallInviteLink#2ae14924: field can_self_unmute: %w", err) - } - g.CanSelfUnmute = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (g *GetGroupCallInviteLinkRequest) GetGroupCallID() (value int32) { - if g == nil { - return - } - return g.GroupCallID -} - -// GetCanSelfUnmute returns value of CanSelfUnmute field. -func (g *GetGroupCallInviteLinkRequest) GetCanSelfUnmute() (value bool) { - if g == nil { - return - } - return g.CanSelfUnmute -} - -// GetGroupCallInviteLink invokes method getGroupCallInviteLink#2ae14924 returning error if any. -func (c *Client) GetGroupCallInviteLink(ctx context.Context, request *GetGroupCallInviteLinkRequest) (*HTTPURL, error) { - var result HTTPURL - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_group_call_stream_segment_gen.go b/tdapi/tl_get_group_call_stream_segment_gen.go deleted file mode 100644 index b0462695b..000000000 --- a/tdapi/tl_get_group_call_stream_segment_gen.go +++ /dev/null @@ -1,349 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetGroupCallStreamSegmentRequest represents TL type `getGroupCallStreamSegment#8424daa5`. -type GetGroupCallStreamSegmentRequest struct { - // Group call identifier - GroupCallID int32 - // Point in time when the stream segment begins; Unix timestamp in milliseconds - TimeOffset int64 - // Segment duration scale; 0-1. Segment's duration is 1000/(2**scale) milliseconds - Scale int32 - // Identifier of an audio/video channel to get as received from tgcalls - ChannelID int32 - // Video quality as received from tgcalls; pass null to get the worst available quality - VideoQuality GroupCallVideoQualityClass -} - -// GetGroupCallStreamSegmentRequestTypeID is TL type id of GetGroupCallStreamSegmentRequest. -const GetGroupCallStreamSegmentRequestTypeID = 0x8424daa5 - -// Ensuring interfaces in compile-time for GetGroupCallStreamSegmentRequest. -var ( - _ bin.Encoder = &GetGroupCallStreamSegmentRequest{} - _ bin.Decoder = &GetGroupCallStreamSegmentRequest{} - _ bin.BareEncoder = &GetGroupCallStreamSegmentRequest{} - _ bin.BareDecoder = &GetGroupCallStreamSegmentRequest{} -) - -func (g *GetGroupCallStreamSegmentRequest) Zero() bool { - if g == nil { - return true - } - if !(g.GroupCallID == 0) { - return false - } - if !(g.TimeOffset == 0) { - return false - } - if !(g.Scale == 0) { - return false - } - if !(g.ChannelID == 0) { - return false - } - if !(g.VideoQuality == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetGroupCallStreamSegmentRequest) String() string { - if g == nil { - return "GetGroupCallStreamSegmentRequest(nil)" - } - type Alias GetGroupCallStreamSegmentRequest - return fmt.Sprintf("GetGroupCallStreamSegmentRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetGroupCallStreamSegmentRequest) TypeID() uint32 { - return GetGroupCallStreamSegmentRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetGroupCallStreamSegmentRequest) TypeName() string { - return "getGroupCallStreamSegment" -} - -// TypeInfo returns info about TL type. -func (g *GetGroupCallStreamSegmentRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getGroupCallStreamSegment", - ID: GetGroupCallStreamSegmentRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "TimeOffset", - SchemaName: "time_offset", - }, - { - Name: "Scale", - SchemaName: "scale", - }, - { - Name: "ChannelID", - SchemaName: "channel_id", - }, - { - Name: "VideoQuality", - SchemaName: "video_quality", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetGroupCallStreamSegmentRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCallStreamSegment#8424daa5 as nil") - } - b.PutID(GetGroupCallStreamSegmentRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetGroupCallStreamSegmentRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCallStreamSegment#8424daa5 as nil") - } - b.PutInt32(g.GroupCallID) - b.PutInt53(g.TimeOffset) - b.PutInt32(g.Scale) - b.PutInt32(g.ChannelID) - if g.VideoQuality == nil { - return fmt.Errorf("unable to encode getGroupCallStreamSegment#8424daa5: field video_quality is nil") - } - if err := g.VideoQuality.Encode(b); err != nil { - return fmt.Errorf("unable to encode getGroupCallStreamSegment#8424daa5: field video_quality: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetGroupCallStreamSegmentRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCallStreamSegment#8424daa5 to nil") - } - if err := b.ConsumeID(GetGroupCallStreamSegmentRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetGroupCallStreamSegmentRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCallStreamSegment#8424daa5 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: field group_call_id: %w", err) - } - g.GroupCallID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: field time_offset: %w", err) - } - g.TimeOffset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: field scale: %w", err) - } - g.Scale = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: field channel_id: %w", err) - } - g.ChannelID = value - } - { - value, err := DecodeGroupCallVideoQuality(b) - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: field video_quality: %w", err) - } - g.VideoQuality = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetGroupCallStreamSegmentRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCallStreamSegment#8424daa5 as nil") - } - b.ObjStart() - b.PutID("getGroupCallStreamSegment") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(g.GroupCallID) - b.Comma() - b.FieldStart("time_offset") - b.PutInt53(g.TimeOffset) - b.Comma() - b.FieldStart("scale") - b.PutInt32(g.Scale) - b.Comma() - b.FieldStart("channel_id") - b.PutInt32(g.ChannelID) - b.Comma() - b.FieldStart("video_quality") - if g.VideoQuality == nil { - return fmt.Errorf("unable to encode getGroupCallStreamSegment#8424daa5: field video_quality is nil") - } - if err := g.VideoQuality.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getGroupCallStreamSegment#8424daa5: field video_quality: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetGroupCallStreamSegmentRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCallStreamSegment#8424daa5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getGroupCallStreamSegment"); err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: field group_call_id: %w", err) - } - g.GroupCallID = value - case "time_offset": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: field time_offset: %w", err) - } - g.TimeOffset = value - case "scale": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: field scale: %w", err) - } - g.Scale = value - case "channel_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: field channel_id: %w", err) - } - g.ChannelID = value - case "video_quality": - value, err := DecodeTDLibJSONGroupCallVideoQuality(b) - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreamSegment#8424daa5: field video_quality: %w", err) - } - g.VideoQuality = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (g *GetGroupCallStreamSegmentRequest) GetGroupCallID() (value int32) { - if g == nil { - return - } - return g.GroupCallID -} - -// GetTimeOffset returns value of TimeOffset field. -func (g *GetGroupCallStreamSegmentRequest) GetTimeOffset() (value int64) { - if g == nil { - return - } - return g.TimeOffset -} - -// GetScale returns value of Scale field. -func (g *GetGroupCallStreamSegmentRequest) GetScale() (value int32) { - if g == nil { - return - } - return g.Scale -} - -// GetChannelID returns value of ChannelID field. -func (g *GetGroupCallStreamSegmentRequest) GetChannelID() (value int32) { - if g == nil { - return - } - return g.ChannelID -} - -// GetVideoQuality returns value of VideoQuality field. -func (g *GetGroupCallStreamSegmentRequest) GetVideoQuality() (value GroupCallVideoQualityClass) { - if g == nil { - return - } - return g.VideoQuality -} - -// GetGroupCallStreamSegment invokes method getGroupCallStreamSegment#8424daa5 returning error if any. -func (c *Client) GetGroupCallStreamSegment(ctx context.Context, request *GetGroupCallStreamSegmentRequest) (*FilePart, error) { - var result FilePart - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_group_call_streams_gen.go b/tdapi/tl_get_group_call_streams_gen.go deleted file mode 100644 index ffc2665ea..000000000 --- a/tdapi/tl_get_group_call_streams_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetGroupCallStreamsRequest represents TL type `getGroupCallStreams#9f7c9164`. -type GetGroupCallStreamsRequest struct { - // Group call identifier - GroupCallID int32 -} - -// GetGroupCallStreamsRequestTypeID is TL type id of GetGroupCallStreamsRequest. -const GetGroupCallStreamsRequestTypeID = 0x9f7c9164 - -// Ensuring interfaces in compile-time for GetGroupCallStreamsRequest. -var ( - _ bin.Encoder = &GetGroupCallStreamsRequest{} - _ bin.Decoder = &GetGroupCallStreamsRequest{} - _ bin.BareEncoder = &GetGroupCallStreamsRequest{} - _ bin.BareDecoder = &GetGroupCallStreamsRequest{} -) - -func (g *GetGroupCallStreamsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetGroupCallStreamsRequest) String() string { - if g == nil { - return "GetGroupCallStreamsRequest(nil)" - } - type Alias GetGroupCallStreamsRequest - return fmt.Sprintf("GetGroupCallStreamsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetGroupCallStreamsRequest) TypeID() uint32 { - return GetGroupCallStreamsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetGroupCallStreamsRequest) TypeName() string { - return "getGroupCallStreams" -} - -// TypeInfo returns info about TL type. -func (g *GetGroupCallStreamsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getGroupCallStreams", - ID: GetGroupCallStreamsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetGroupCallStreamsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCallStreams#9f7c9164 as nil") - } - b.PutID(GetGroupCallStreamsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetGroupCallStreamsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCallStreams#9f7c9164 as nil") - } - b.PutInt32(g.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetGroupCallStreamsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCallStreams#9f7c9164 to nil") - } - if err := b.ConsumeID(GetGroupCallStreamsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getGroupCallStreams#9f7c9164: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetGroupCallStreamsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCallStreams#9f7c9164 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreams#9f7c9164: field group_call_id: %w", err) - } - g.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetGroupCallStreamsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getGroupCallStreams#9f7c9164 as nil") - } - b.ObjStart() - b.PutID("getGroupCallStreams") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(g.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetGroupCallStreamsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getGroupCallStreams#9f7c9164 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getGroupCallStreams"); err != nil { - return fmt.Errorf("unable to decode getGroupCallStreams#9f7c9164: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupCallStreams#9f7c9164: field group_call_id: %w", err) - } - g.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (g *GetGroupCallStreamsRequest) GetGroupCallID() (value int32) { - if g == nil { - return - } - return g.GroupCallID -} - -// GetGroupCallStreams invokes method getGroupCallStreams#9f7c9164 returning error if any. -func (c *Client) GetGroupCallStreams(ctx context.Context, groupcallid int32) (*GroupCallStreams, error) { - var result GroupCallStreams - - request := &GetGroupCallStreamsRequest{ - GroupCallID: groupcallid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_groups_in_common_gen.go b/tdapi/tl_get_groups_in_common_gen.go deleted file mode 100644 index 12a942f83..000000000 --- a/tdapi/tl_get_groups_in_common_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetGroupsInCommonRequest represents TL type `getGroupsInCommon#16bdd36a`. -type GetGroupsInCommonRequest struct { - // User identifier - UserID int64 - // Chat identifier starting from which to return chats; use 0 for the first request - OffsetChatID int64 - // The maximum number of chats to be returned; up to 100 - Limit int32 -} - -// GetGroupsInCommonRequestTypeID is TL type id of GetGroupsInCommonRequest. -const GetGroupsInCommonRequestTypeID = 0x16bdd36a - -// Ensuring interfaces in compile-time for GetGroupsInCommonRequest. -var ( - _ bin.Encoder = &GetGroupsInCommonRequest{} - _ bin.Decoder = &GetGroupsInCommonRequest{} - _ bin.BareEncoder = &GetGroupsInCommonRequest{} - _ bin.BareDecoder = &GetGroupsInCommonRequest{} -) - -func (g *GetGroupsInCommonRequest) Zero() bool { - if g == nil { - return true - } - if !(g.UserID == 0) { - return false - } - if !(g.OffsetChatID == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetGroupsInCommonRequest) String() string { - if g == nil { - return "GetGroupsInCommonRequest(nil)" - } - type Alias GetGroupsInCommonRequest - return fmt.Sprintf("GetGroupsInCommonRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetGroupsInCommonRequest) TypeID() uint32 { - return GetGroupsInCommonRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetGroupsInCommonRequest) TypeName() string { - return "getGroupsInCommon" -} - -// TypeInfo returns info about TL type. -func (g *GetGroupsInCommonRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getGroupsInCommon", - ID: GetGroupsInCommonRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "OffsetChatID", - SchemaName: "offset_chat_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetGroupsInCommonRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGroupsInCommon#16bdd36a as nil") - } - b.PutID(GetGroupsInCommonRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetGroupsInCommonRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getGroupsInCommon#16bdd36a as nil") - } - b.PutInt53(g.UserID) - b.PutInt53(g.OffsetChatID) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetGroupsInCommonRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGroupsInCommon#16bdd36a to nil") - } - if err := b.ConsumeID(GetGroupsInCommonRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getGroupsInCommon#16bdd36a: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetGroupsInCommonRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getGroupsInCommon#16bdd36a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGroupsInCommon#16bdd36a: field user_id: %w", err) - } - g.UserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGroupsInCommon#16bdd36a: field offset_chat_id: %w", err) - } - g.OffsetChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupsInCommon#16bdd36a: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetGroupsInCommonRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getGroupsInCommon#16bdd36a as nil") - } - b.ObjStart() - b.PutID("getGroupsInCommon") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.FieldStart("offset_chat_id") - b.PutInt53(g.OffsetChatID) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetGroupsInCommonRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getGroupsInCommon#16bdd36a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getGroupsInCommon"); err != nil { - return fmt.Errorf("unable to decode getGroupsInCommon#16bdd36a: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGroupsInCommon#16bdd36a: field user_id: %w", err) - } - g.UserID = value - case "offset_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getGroupsInCommon#16bdd36a: field offset_chat_id: %w", err) - } - g.OffsetChatID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getGroupsInCommon#16bdd36a: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (g *GetGroupsInCommonRequest) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetOffsetChatID returns value of OffsetChatID field. -func (g *GetGroupsInCommonRequest) GetOffsetChatID() (value int64) { - if g == nil { - return - } - return g.OffsetChatID -} - -// GetLimit returns value of Limit field. -func (g *GetGroupsInCommonRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetGroupsInCommon invokes method getGroupsInCommon#16bdd36a returning error if any. -func (c *Client) GetGroupsInCommon(ctx context.Context, request *GetGroupsInCommonRequest) (*Chats, error) { - var result Chats - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_imported_contact_count_gen.go b/tdapi/tl_get_imported_contact_count_gen.go deleted file mode 100644 index c1d93832d..000000000 --- a/tdapi/tl_get_imported_contact_count_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetImportedContactCountRequest represents TL type `getImportedContactCount#d8e11a26`. -type GetImportedContactCountRequest struct { -} - -// GetImportedContactCountRequestTypeID is TL type id of GetImportedContactCountRequest. -const GetImportedContactCountRequestTypeID = 0xd8e11a26 - -// Ensuring interfaces in compile-time for GetImportedContactCountRequest. -var ( - _ bin.Encoder = &GetImportedContactCountRequest{} - _ bin.Decoder = &GetImportedContactCountRequest{} - _ bin.BareEncoder = &GetImportedContactCountRequest{} - _ bin.BareDecoder = &GetImportedContactCountRequest{} -) - -func (g *GetImportedContactCountRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetImportedContactCountRequest) String() string { - if g == nil { - return "GetImportedContactCountRequest(nil)" - } - type Alias GetImportedContactCountRequest - return fmt.Sprintf("GetImportedContactCountRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetImportedContactCountRequest) TypeID() uint32 { - return GetImportedContactCountRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetImportedContactCountRequest) TypeName() string { - return "getImportedContactCount" -} - -// TypeInfo returns info about TL type. -func (g *GetImportedContactCountRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getImportedContactCount", - ID: GetImportedContactCountRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetImportedContactCountRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getImportedContactCount#d8e11a26 as nil") - } - b.PutID(GetImportedContactCountRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetImportedContactCountRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getImportedContactCount#d8e11a26 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetImportedContactCountRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getImportedContactCount#d8e11a26 to nil") - } - if err := b.ConsumeID(GetImportedContactCountRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getImportedContactCount#d8e11a26: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetImportedContactCountRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getImportedContactCount#d8e11a26 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetImportedContactCountRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getImportedContactCount#d8e11a26 as nil") - } - b.ObjStart() - b.PutID("getImportedContactCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetImportedContactCountRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getImportedContactCount#d8e11a26 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getImportedContactCount"); err != nil { - return fmt.Errorf("unable to decode getImportedContactCount#d8e11a26: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetImportedContactCount invokes method getImportedContactCount#d8e11a26 returning error if any. -func (c *Client) GetImportedContactCount(ctx context.Context) (*Count, error) { - var result Count - - request := &GetImportedContactCountRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_inactive_supergroup_chats_gen.go b/tdapi/tl_get_inactive_supergroup_chats_gen.go deleted file mode 100644 index 7216abb57..000000000 --- a/tdapi/tl_get_inactive_supergroup_chats_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetInactiveSupergroupChatsRequest represents TL type `getInactiveSupergroupChats#d8cbf9b5`. -type GetInactiveSupergroupChatsRequest struct { -} - -// GetInactiveSupergroupChatsRequestTypeID is TL type id of GetInactiveSupergroupChatsRequest. -const GetInactiveSupergroupChatsRequestTypeID = 0xd8cbf9b5 - -// Ensuring interfaces in compile-time for GetInactiveSupergroupChatsRequest. -var ( - _ bin.Encoder = &GetInactiveSupergroupChatsRequest{} - _ bin.Decoder = &GetInactiveSupergroupChatsRequest{} - _ bin.BareEncoder = &GetInactiveSupergroupChatsRequest{} - _ bin.BareDecoder = &GetInactiveSupergroupChatsRequest{} -) - -func (g *GetInactiveSupergroupChatsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetInactiveSupergroupChatsRequest) String() string { - if g == nil { - return "GetInactiveSupergroupChatsRequest(nil)" - } - type Alias GetInactiveSupergroupChatsRequest - return fmt.Sprintf("GetInactiveSupergroupChatsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetInactiveSupergroupChatsRequest) TypeID() uint32 { - return GetInactiveSupergroupChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetInactiveSupergroupChatsRequest) TypeName() string { - return "getInactiveSupergroupChats" -} - -// TypeInfo returns info about TL type. -func (g *GetInactiveSupergroupChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getInactiveSupergroupChats", - ID: GetInactiveSupergroupChatsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetInactiveSupergroupChatsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInactiveSupergroupChats#d8cbf9b5 as nil") - } - b.PutID(GetInactiveSupergroupChatsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetInactiveSupergroupChatsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInactiveSupergroupChats#d8cbf9b5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetInactiveSupergroupChatsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInactiveSupergroupChats#d8cbf9b5 to nil") - } - if err := b.ConsumeID(GetInactiveSupergroupChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getInactiveSupergroupChats#d8cbf9b5: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetInactiveSupergroupChatsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInactiveSupergroupChats#d8cbf9b5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetInactiveSupergroupChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getInactiveSupergroupChats#d8cbf9b5 as nil") - } - b.ObjStart() - b.PutID("getInactiveSupergroupChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetInactiveSupergroupChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getInactiveSupergroupChats#d8cbf9b5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getInactiveSupergroupChats"); err != nil { - return fmt.Errorf("unable to decode getInactiveSupergroupChats#d8cbf9b5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInactiveSupergroupChats invokes method getInactiveSupergroupChats#d8cbf9b5 returning error if any. -func (c *Client) GetInactiveSupergroupChats(ctx context.Context) (*Chats, error) { - var result Chats - - request := &GetInactiveSupergroupChatsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_inline_game_high_scores_gen.go b/tdapi/tl_get_inline_game_high_scores_gen.go deleted file mode 100644 index b42a0ef12..000000000 --- a/tdapi/tl_get_inline_game_high_scores_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetInlineGameHighScoresRequest represents TL type `getInlineGameHighScores#e0396baa`. -type GetInlineGameHighScoresRequest struct { - // Inline message identifier - InlineMessageID string - // User identifier - UserID int64 -} - -// GetInlineGameHighScoresRequestTypeID is TL type id of GetInlineGameHighScoresRequest. -const GetInlineGameHighScoresRequestTypeID = 0xe0396baa - -// Ensuring interfaces in compile-time for GetInlineGameHighScoresRequest. -var ( - _ bin.Encoder = &GetInlineGameHighScoresRequest{} - _ bin.Decoder = &GetInlineGameHighScoresRequest{} - _ bin.BareEncoder = &GetInlineGameHighScoresRequest{} - _ bin.BareDecoder = &GetInlineGameHighScoresRequest{} -) - -func (g *GetInlineGameHighScoresRequest) Zero() bool { - if g == nil { - return true - } - if !(g.InlineMessageID == "") { - return false - } - if !(g.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetInlineGameHighScoresRequest) String() string { - if g == nil { - return "GetInlineGameHighScoresRequest(nil)" - } - type Alias GetInlineGameHighScoresRequest - return fmt.Sprintf("GetInlineGameHighScoresRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetInlineGameHighScoresRequest) TypeID() uint32 { - return GetInlineGameHighScoresRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetInlineGameHighScoresRequest) TypeName() string { - return "getInlineGameHighScores" -} - -// TypeInfo returns info about TL type. -func (g *GetInlineGameHighScoresRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getInlineGameHighScores", - ID: GetInlineGameHighScoresRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InlineMessageID", - SchemaName: "inline_message_id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetInlineGameHighScoresRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInlineGameHighScores#e0396baa as nil") - } - b.PutID(GetInlineGameHighScoresRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetInlineGameHighScoresRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInlineGameHighScores#e0396baa as nil") - } - b.PutString(g.InlineMessageID) - b.PutInt53(g.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetInlineGameHighScoresRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInlineGameHighScores#e0396baa to nil") - } - if err := b.ConsumeID(GetInlineGameHighScoresRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getInlineGameHighScores#e0396baa: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetInlineGameHighScoresRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInlineGameHighScores#e0396baa to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getInlineGameHighScores#e0396baa: field inline_message_id: %w", err) - } - g.InlineMessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getInlineGameHighScores#e0396baa: field user_id: %w", err) - } - g.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetInlineGameHighScoresRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getInlineGameHighScores#e0396baa as nil") - } - b.ObjStart() - b.PutID("getInlineGameHighScores") - b.Comma() - b.FieldStart("inline_message_id") - b.PutString(g.InlineMessageID) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetInlineGameHighScoresRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getInlineGameHighScores#e0396baa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getInlineGameHighScores"); err != nil { - return fmt.Errorf("unable to decode getInlineGameHighScores#e0396baa: %w", err) - } - case "inline_message_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getInlineGameHighScores#e0396baa: field inline_message_id: %w", err) - } - g.InlineMessageID = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getInlineGameHighScores#e0396baa: field user_id: %w", err) - } - g.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInlineMessageID returns value of InlineMessageID field. -func (g *GetInlineGameHighScoresRequest) GetInlineMessageID() (value string) { - if g == nil { - return - } - return g.InlineMessageID -} - -// GetUserID returns value of UserID field. -func (g *GetInlineGameHighScoresRequest) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetInlineGameHighScores invokes method getInlineGameHighScores#e0396baa returning error if any. -func (c *Client) GetInlineGameHighScores(ctx context.Context, request *GetInlineGameHighScoresRequest) (*GameHighScores, error) { - var result GameHighScores - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_inline_query_results_gen.go b/tdapi/tl_get_inline_query_results_gen.go deleted file mode 100644 index b3638a0dd..000000000 --- a/tdapi/tl_get_inline_query_results_gen.go +++ /dev/null @@ -1,340 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetInlineQueryResultsRequest represents TL type `getInlineQueryResults#79dcf86c`. -type GetInlineQueryResultsRequest struct { - // Identifier of the target bot - BotUserID int64 - // Identifier of the chat where the query was sent - ChatID int64 - // Location of the user; pass null if unknown or the bot doesn't need user's location - UserLocation Location - // Text of the query - Query string - // Offset of the first entry to return; use empty string to get the first chunk of - // results - Offset string -} - -// GetInlineQueryResultsRequestTypeID is TL type id of GetInlineQueryResultsRequest. -const GetInlineQueryResultsRequestTypeID = 0x79dcf86c - -// Ensuring interfaces in compile-time for GetInlineQueryResultsRequest. -var ( - _ bin.Encoder = &GetInlineQueryResultsRequest{} - _ bin.Decoder = &GetInlineQueryResultsRequest{} - _ bin.BareEncoder = &GetInlineQueryResultsRequest{} - _ bin.BareDecoder = &GetInlineQueryResultsRequest{} -) - -func (g *GetInlineQueryResultsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BotUserID == 0) { - return false - } - if !(g.ChatID == 0) { - return false - } - if !(g.UserLocation.Zero()) { - return false - } - if !(g.Query == "") { - return false - } - if !(g.Offset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetInlineQueryResultsRequest) String() string { - if g == nil { - return "GetInlineQueryResultsRequest(nil)" - } - type Alias GetInlineQueryResultsRequest - return fmt.Sprintf("GetInlineQueryResultsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetInlineQueryResultsRequest) TypeID() uint32 { - return GetInlineQueryResultsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetInlineQueryResultsRequest) TypeName() string { - return "getInlineQueryResults" -} - -// TypeInfo returns info about TL type. -func (g *GetInlineQueryResultsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getInlineQueryResults", - ID: GetInlineQueryResultsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "UserLocation", - SchemaName: "user_location", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetInlineQueryResultsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInlineQueryResults#79dcf86c as nil") - } - b.PutID(GetInlineQueryResultsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetInlineQueryResultsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInlineQueryResults#79dcf86c as nil") - } - b.PutInt53(g.BotUserID) - b.PutInt53(g.ChatID) - if err := g.UserLocation.Encode(b); err != nil { - return fmt.Errorf("unable to encode getInlineQueryResults#79dcf86c: field user_location: %w", err) - } - b.PutString(g.Query) - b.PutString(g.Offset) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetInlineQueryResultsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInlineQueryResults#79dcf86c to nil") - } - if err := b.ConsumeID(GetInlineQueryResultsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetInlineQueryResultsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInlineQueryResults#79dcf86c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: field bot_user_id: %w", err) - } - g.BotUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: field chat_id: %w", err) - } - g.ChatID = value - } - { - if err := g.UserLocation.Decode(b); err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: field user_location: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: field query: %w", err) - } - g.Query = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: field offset: %w", err) - } - g.Offset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetInlineQueryResultsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getInlineQueryResults#79dcf86c as nil") - } - b.ObjStart() - b.PutID("getInlineQueryResults") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("user_location") - if err := g.UserLocation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getInlineQueryResults#79dcf86c: field user_location: %w", err) - } - b.Comma() - b.FieldStart("query") - b.PutString(g.Query) - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetInlineQueryResultsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getInlineQueryResults#79dcf86c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getInlineQueryResults"); err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: field bot_user_id: %w", err) - } - g.BotUserID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: field chat_id: %w", err) - } - g.ChatID = value - case "user_location": - if err := g.UserLocation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: field user_location: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: field query: %w", err) - } - g.Query = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getInlineQueryResults#79dcf86c: field offset: %w", err) - } - g.Offset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetInlineQueryResultsRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetChatID returns value of ChatID field. -func (g *GetInlineQueryResultsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetUserLocation returns value of UserLocation field. -func (g *GetInlineQueryResultsRequest) GetUserLocation() (value Location) { - if g == nil { - return - } - return g.UserLocation -} - -// GetQuery returns value of Query field. -func (g *GetInlineQueryResultsRequest) GetQuery() (value string) { - if g == nil { - return - } - return g.Query -} - -// GetOffset returns value of Offset field. -func (g *GetInlineQueryResultsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetInlineQueryResults invokes method getInlineQueryResults#79dcf86c returning error if any. -func (c *Client) GetInlineQueryResults(ctx context.Context, request *GetInlineQueryResultsRequest) (*InlineQueryResults, error) { - var result InlineQueryResults - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_installed_backgrounds_gen.go b/tdapi/tl_get_installed_backgrounds_gen.go deleted file mode 100644 index 4f3420f4e..000000000 --- a/tdapi/tl_get_installed_backgrounds_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetInstalledBackgroundsRequest represents TL type `getInstalledBackgrounds#c154d05f`. -type GetInstalledBackgroundsRequest struct { - // Pass true to order returned backgrounds for a dark theme - ForDarkTheme bool -} - -// GetInstalledBackgroundsRequestTypeID is TL type id of GetInstalledBackgroundsRequest. -const GetInstalledBackgroundsRequestTypeID = 0xc154d05f - -// Ensuring interfaces in compile-time for GetInstalledBackgroundsRequest. -var ( - _ bin.Encoder = &GetInstalledBackgroundsRequest{} - _ bin.Decoder = &GetInstalledBackgroundsRequest{} - _ bin.BareEncoder = &GetInstalledBackgroundsRequest{} - _ bin.BareDecoder = &GetInstalledBackgroundsRequest{} -) - -func (g *GetInstalledBackgroundsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ForDarkTheme == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetInstalledBackgroundsRequest) String() string { - if g == nil { - return "GetInstalledBackgroundsRequest(nil)" - } - type Alias GetInstalledBackgroundsRequest - return fmt.Sprintf("GetInstalledBackgroundsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetInstalledBackgroundsRequest) TypeID() uint32 { - return GetInstalledBackgroundsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetInstalledBackgroundsRequest) TypeName() string { - return "getInstalledBackgrounds" -} - -// TypeInfo returns info about TL type. -func (g *GetInstalledBackgroundsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getInstalledBackgrounds", - ID: GetInstalledBackgroundsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ForDarkTheme", - SchemaName: "for_dark_theme", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetInstalledBackgroundsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInstalledBackgrounds#c154d05f as nil") - } - b.PutID(GetInstalledBackgroundsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetInstalledBackgroundsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInstalledBackgrounds#c154d05f as nil") - } - b.PutBool(g.ForDarkTheme) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetInstalledBackgroundsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInstalledBackgrounds#c154d05f to nil") - } - if err := b.ConsumeID(GetInstalledBackgroundsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getInstalledBackgrounds#c154d05f: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetInstalledBackgroundsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInstalledBackgrounds#c154d05f to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getInstalledBackgrounds#c154d05f: field for_dark_theme: %w", err) - } - g.ForDarkTheme = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetInstalledBackgroundsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getInstalledBackgrounds#c154d05f as nil") - } - b.ObjStart() - b.PutID("getInstalledBackgrounds") - b.Comma() - b.FieldStart("for_dark_theme") - b.PutBool(g.ForDarkTheme) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetInstalledBackgroundsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getInstalledBackgrounds#c154d05f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getInstalledBackgrounds"); err != nil { - return fmt.Errorf("unable to decode getInstalledBackgrounds#c154d05f: %w", err) - } - case "for_dark_theme": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getInstalledBackgrounds#c154d05f: field for_dark_theme: %w", err) - } - g.ForDarkTheme = value - default: - return b.Skip() - } - return nil - }) -} - -// GetForDarkTheme returns value of ForDarkTheme field. -func (g *GetInstalledBackgroundsRequest) GetForDarkTheme() (value bool) { - if g == nil { - return - } - return g.ForDarkTheme -} - -// GetInstalledBackgrounds invokes method getInstalledBackgrounds#c154d05f returning error if any. -func (c *Client) GetInstalledBackgrounds(ctx context.Context, fordarktheme bool) (*Backgrounds, error) { - var result Backgrounds - - request := &GetInstalledBackgroundsRequest{ - ForDarkTheme: fordarktheme, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_installed_sticker_sets_gen.go b/tdapi/tl_get_installed_sticker_sets_gen.go deleted file mode 100644 index a1aa136d1..000000000 --- a/tdapi/tl_get_installed_sticker_sets_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetInstalledStickerSetsRequest represents TL type `getInstalledStickerSets#612ef6f6`. -type GetInstalledStickerSetsRequest struct { - // Type of the sticker sets to return - StickerType StickerTypeClass -} - -// GetInstalledStickerSetsRequestTypeID is TL type id of GetInstalledStickerSetsRequest. -const GetInstalledStickerSetsRequestTypeID = 0x612ef6f6 - -// Ensuring interfaces in compile-time for GetInstalledStickerSetsRequest. -var ( - _ bin.Encoder = &GetInstalledStickerSetsRequest{} - _ bin.Decoder = &GetInstalledStickerSetsRequest{} - _ bin.BareEncoder = &GetInstalledStickerSetsRequest{} - _ bin.BareDecoder = &GetInstalledStickerSetsRequest{} -) - -func (g *GetInstalledStickerSetsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.StickerType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetInstalledStickerSetsRequest) String() string { - if g == nil { - return "GetInstalledStickerSetsRequest(nil)" - } - type Alias GetInstalledStickerSetsRequest - return fmt.Sprintf("GetInstalledStickerSetsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetInstalledStickerSetsRequest) TypeID() uint32 { - return GetInstalledStickerSetsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetInstalledStickerSetsRequest) TypeName() string { - return "getInstalledStickerSets" -} - -// TypeInfo returns info about TL type. -func (g *GetInstalledStickerSetsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getInstalledStickerSets", - ID: GetInstalledStickerSetsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetInstalledStickerSetsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInstalledStickerSets#612ef6f6 as nil") - } - b.PutID(GetInstalledStickerSetsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetInstalledStickerSetsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInstalledStickerSets#612ef6f6 as nil") - } - if g.StickerType == nil { - return fmt.Errorf("unable to encode getInstalledStickerSets#612ef6f6: field sticker_type is nil") - } - if err := g.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode getInstalledStickerSets#612ef6f6: field sticker_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetInstalledStickerSetsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInstalledStickerSets#612ef6f6 to nil") - } - if err := b.ConsumeID(GetInstalledStickerSetsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getInstalledStickerSets#612ef6f6: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetInstalledStickerSetsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInstalledStickerSets#612ef6f6 to nil") - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode getInstalledStickerSets#612ef6f6: field sticker_type: %w", err) - } - g.StickerType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetInstalledStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getInstalledStickerSets#612ef6f6 as nil") - } - b.ObjStart() - b.PutID("getInstalledStickerSets") - b.Comma() - b.FieldStart("sticker_type") - if g.StickerType == nil { - return fmt.Errorf("unable to encode getInstalledStickerSets#612ef6f6: field sticker_type is nil") - } - if err := g.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getInstalledStickerSets#612ef6f6: field sticker_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetInstalledStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getInstalledStickerSets#612ef6f6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getInstalledStickerSets"); err != nil { - return fmt.Errorf("unable to decode getInstalledStickerSets#612ef6f6: %w", err) - } - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode getInstalledStickerSets#612ef6f6: field sticker_type: %w", err) - } - g.StickerType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerType returns value of StickerType field. -func (g *GetInstalledStickerSetsRequest) GetStickerType() (value StickerTypeClass) { - if g == nil { - return - } - return g.StickerType -} - -// GetInstalledStickerSets invokes method getInstalledStickerSets#612ef6f6 returning error if any. -func (c *Client) GetInstalledStickerSets(ctx context.Context, stickertype StickerTypeClass) (*StickerSets, error) { - var result StickerSets - - request := &GetInstalledStickerSetsRequest{ - StickerType: stickertype, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_internal_link_gen.go b/tdapi/tl_get_internal_link_gen.go deleted file mode 100644 index 3d6940b62..000000000 --- a/tdapi/tl_get_internal_link_gen.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetInternalLinkRequest represents TL type `getInternalLink#3960f1b0`. -type GetInternalLinkRequest struct { - // Expected type of the link - Type InternalLinkTypeClass - // Pass true to create an HTTPS link (only available for some link types); pass false to - // create a tg: link - IsHTTP bool -} - -// GetInternalLinkRequestTypeID is TL type id of GetInternalLinkRequest. -const GetInternalLinkRequestTypeID = 0x3960f1b0 - -// Ensuring interfaces in compile-time for GetInternalLinkRequest. -var ( - _ bin.Encoder = &GetInternalLinkRequest{} - _ bin.Decoder = &GetInternalLinkRequest{} - _ bin.BareEncoder = &GetInternalLinkRequest{} - _ bin.BareDecoder = &GetInternalLinkRequest{} -) - -func (g *GetInternalLinkRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Type == nil) { - return false - } - if !(g.IsHTTP == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetInternalLinkRequest) String() string { - if g == nil { - return "GetInternalLinkRequest(nil)" - } - type Alias GetInternalLinkRequest - return fmt.Sprintf("GetInternalLinkRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetInternalLinkRequest) TypeID() uint32 { - return GetInternalLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetInternalLinkRequest) TypeName() string { - return "getInternalLink" -} - -// TypeInfo returns info about TL type. -func (g *GetInternalLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getInternalLink", - ID: GetInternalLinkRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "IsHTTP", - SchemaName: "is_http", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetInternalLinkRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInternalLink#3960f1b0 as nil") - } - b.PutID(GetInternalLinkRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetInternalLinkRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInternalLink#3960f1b0 as nil") - } - if g.Type == nil { - return fmt.Errorf("unable to encode getInternalLink#3960f1b0: field type is nil") - } - if err := g.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode getInternalLink#3960f1b0: field type: %w", err) - } - b.PutBool(g.IsHTTP) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetInternalLinkRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInternalLink#3960f1b0 to nil") - } - if err := b.ConsumeID(GetInternalLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getInternalLink#3960f1b0: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetInternalLinkRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInternalLink#3960f1b0 to nil") - } - { - value, err := DecodeInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode getInternalLink#3960f1b0: field type: %w", err) - } - g.Type = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getInternalLink#3960f1b0: field is_http: %w", err) - } - g.IsHTTP = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetInternalLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getInternalLink#3960f1b0 as nil") - } - b.ObjStart() - b.PutID("getInternalLink") - b.Comma() - b.FieldStart("type") - if g.Type == nil { - return fmt.Errorf("unable to encode getInternalLink#3960f1b0: field type is nil") - } - if err := g.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getInternalLink#3960f1b0: field type: %w", err) - } - b.Comma() - b.FieldStart("is_http") - b.PutBool(g.IsHTTP) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetInternalLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getInternalLink#3960f1b0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getInternalLink"); err != nil { - return fmt.Errorf("unable to decode getInternalLink#3960f1b0: %w", err) - } - case "type": - value, err := DecodeTDLibJSONInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode getInternalLink#3960f1b0: field type: %w", err) - } - g.Type = value - case "is_http": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getInternalLink#3960f1b0: field is_http: %w", err) - } - g.IsHTTP = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (g *GetInternalLinkRequest) GetType() (value InternalLinkTypeClass) { - if g == nil { - return - } - return g.Type -} - -// GetIsHTTP returns value of IsHTTP field. -func (g *GetInternalLinkRequest) GetIsHTTP() (value bool) { - if g == nil { - return - } - return g.IsHTTP -} - -// GetInternalLink invokes method getInternalLink#3960f1b0 returning error if any. -func (c *Client) GetInternalLink(ctx context.Context, request *GetInternalLinkRequest) (*HTTPURL, error) { - var result HTTPURL - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_internal_link_type_gen.go b/tdapi/tl_get_internal_link_type_gen.go deleted file mode 100644 index 6ac3dee8f..000000000 --- a/tdapi/tl_get_internal_link_type_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetInternalLinkTypeRequest represents TL type `getInternalLinkType#8bdd5709`. -type GetInternalLinkTypeRequest struct { - // The link - Link string -} - -// GetInternalLinkTypeRequestTypeID is TL type id of GetInternalLinkTypeRequest. -const GetInternalLinkTypeRequestTypeID = 0x8bdd5709 - -// Ensuring interfaces in compile-time for GetInternalLinkTypeRequest. -var ( - _ bin.Encoder = &GetInternalLinkTypeRequest{} - _ bin.Decoder = &GetInternalLinkTypeRequest{} - _ bin.BareEncoder = &GetInternalLinkTypeRequest{} - _ bin.BareDecoder = &GetInternalLinkTypeRequest{} -) - -func (g *GetInternalLinkTypeRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Link == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetInternalLinkTypeRequest) String() string { - if g == nil { - return "GetInternalLinkTypeRequest(nil)" - } - type Alias GetInternalLinkTypeRequest - return fmt.Sprintf("GetInternalLinkTypeRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetInternalLinkTypeRequest) TypeID() uint32 { - return GetInternalLinkTypeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetInternalLinkTypeRequest) TypeName() string { - return "getInternalLinkType" -} - -// TypeInfo returns info about TL type. -func (g *GetInternalLinkTypeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getInternalLinkType", - ID: GetInternalLinkTypeRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetInternalLinkTypeRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInternalLinkType#8bdd5709 as nil") - } - b.PutID(GetInternalLinkTypeRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetInternalLinkTypeRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getInternalLinkType#8bdd5709 as nil") - } - b.PutString(g.Link) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetInternalLinkTypeRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInternalLinkType#8bdd5709 to nil") - } - if err := b.ConsumeID(GetInternalLinkTypeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getInternalLinkType#8bdd5709: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetInternalLinkTypeRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getInternalLinkType#8bdd5709 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getInternalLinkType#8bdd5709: field link: %w", err) - } - g.Link = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetInternalLinkTypeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getInternalLinkType#8bdd5709 as nil") - } - b.ObjStart() - b.PutID("getInternalLinkType") - b.Comma() - b.FieldStart("link") - b.PutString(g.Link) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetInternalLinkTypeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getInternalLinkType#8bdd5709 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getInternalLinkType"); err != nil { - return fmt.Errorf("unable to decode getInternalLinkType#8bdd5709: %w", err) - } - case "link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getInternalLinkType#8bdd5709: field link: %w", err) - } - g.Link = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (g *GetInternalLinkTypeRequest) GetLink() (value string) { - if g == nil { - return - } - return g.Link -} - -// GetInternalLinkType invokes method getInternalLinkType#8bdd5709 returning error if any. -func (c *Client) GetInternalLinkType(ctx context.Context, link string) (InternalLinkTypeClass, error) { - var result InternalLinkTypeBox - - request := &GetInternalLinkTypeRequest{ - Link: link, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.InternalLinkType, nil -} diff --git a/tdapi/tl_get_json_string_gen.go b/tdapi/tl_get_json_string_gen.go deleted file mode 100644 index df7b3ce9f..000000000 --- a/tdapi/tl_get_json_string_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetJSONStringRequest represents TL type `getJsonString#278b9421`. -type GetJSONStringRequest struct { - // The JsonValue object - JSONValue JSONValueClass -} - -// GetJSONStringRequestTypeID is TL type id of GetJSONStringRequest. -const GetJSONStringRequestTypeID = 0x278b9421 - -// Ensuring interfaces in compile-time for GetJSONStringRequest. -var ( - _ bin.Encoder = &GetJSONStringRequest{} - _ bin.Decoder = &GetJSONStringRequest{} - _ bin.BareEncoder = &GetJSONStringRequest{} - _ bin.BareDecoder = &GetJSONStringRequest{} -) - -func (g *GetJSONStringRequest) Zero() bool { - if g == nil { - return true - } - if !(g.JSONValue == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetJSONStringRequest) String() string { - if g == nil { - return "GetJSONStringRequest(nil)" - } - type Alias GetJSONStringRequest - return fmt.Sprintf("GetJSONStringRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetJSONStringRequest) TypeID() uint32 { - return GetJSONStringRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetJSONStringRequest) TypeName() string { - return "getJsonString" -} - -// TypeInfo returns info about TL type. -func (g *GetJSONStringRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getJsonString", - ID: GetJSONStringRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "JSONValue", - SchemaName: "json_value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetJSONStringRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getJsonString#278b9421 as nil") - } - b.PutID(GetJSONStringRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetJSONStringRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getJsonString#278b9421 as nil") - } - if g.JSONValue == nil { - return fmt.Errorf("unable to encode getJsonString#278b9421: field json_value is nil") - } - if err := g.JSONValue.Encode(b); err != nil { - return fmt.Errorf("unable to encode getJsonString#278b9421: field json_value: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetJSONStringRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getJsonString#278b9421 to nil") - } - if err := b.ConsumeID(GetJSONStringRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getJsonString#278b9421: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetJSONStringRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getJsonString#278b9421 to nil") - } - { - value, err := DecodeJSONValue(b) - if err != nil { - return fmt.Errorf("unable to decode getJsonString#278b9421: field json_value: %w", err) - } - g.JSONValue = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetJSONStringRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getJsonString#278b9421 as nil") - } - b.ObjStart() - b.PutID("getJsonString") - b.Comma() - b.FieldStart("json_value") - if g.JSONValue == nil { - return fmt.Errorf("unable to encode getJsonString#278b9421: field json_value is nil") - } - if err := g.JSONValue.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getJsonString#278b9421: field json_value: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetJSONStringRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getJsonString#278b9421 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getJsonString"); err != nil { - return fmt.Errorf("unable to decode getJsonString#278b9421: %w", err) - } - case "json_value": - value, err := DecodeTDLibJSONJSONValue(b) - if err != nil { - return fmt.Errorf("unable to decode getJsonString#278b9421: field json_value: %w", err) - } - g.JSONValue = value - default: - return b.Skip() - } - return nil - }) -} - -// GetJSONValue returns value of JSONValue field. -func (g *GetJSONStringRequest) GetJSONValue() (value JSONValueClass) { - if g == nil { - return - } - return g.JSONValue -} - -// GetJSONString invokes method getJsonString#278b9421 returning error if any. -func (c *Client) GetJSONString(ctx context.Context, jsonvalue JSONValueClass) (*Text, error) { - var result Text - - request := &GetJSONStringRequest{ - JSONValue: jsonvalue, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_json_value_gen.go b/tdapi/tl_get_json_value_gen.go deleted file mode 100644 index 45bc6c480..000000000 --- a/tdapi/tl_get_json_value_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetJSONValueRequest represents TL type `getJsonValue#92fa5a05`. -type GetJSONValueRequest struct { - // The JSON-serialized string - JSON string -} - -// GetJSONValueRequestTypeID is TL type id of GetJSONValueRequest. -const GetJSONValueRequestTypeID = 0x92fa5a05 - -// Ensuring interfaces in compile-time for GetJSONValueRequest. -var ( - _ bin.Encoder = &GetJSONValueRequest{} - _ bin.Decoder = &GetJSONValueRequest{} - _ bin.BareEncoder = &GetJSONValueRequest{} - _ bin.BareDecoder = &GetJSONValueRequest{} -) - -func (g *GetJSONValueRequest) Zero() bool { - if g == nil { - return true - } - if !(g.JSON == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetJSONValueRequest) String() string { - if g == nil { - return "GetJSONValueRequest(nil)" - } - type Alias GetJSONValueRequest - return fmt.Sprintf("GetJSONValueRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetJSONValueRequest) TypeID() uint32 { - return GetJSONValueRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetJSONValueRequest) TypeName() string { - return "getJsonValue" -} - -// TypeInfo returns info about TL type. -func (g *GetJSONValueRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getJsonValue", - ID: GetJSONValueRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "JSON", - SchemaName: "json", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetJSONValueRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getJsonValue#92fa5a05 as nil") - } - b.PutID(GetJSONValueRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetJSONValueRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getJsonValue#92fa5a05 as nil") - } - b.PutString(g.JSON) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetJSONValueRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getJsonValue#92fa5a05 to nil") - } - if err := b.ConsumeID(GetJSONValueRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getJsonValue#92fa5a05: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetJSONValueRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getJsonValue#92fa5a05 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getJsonValue#92fa5a05: field json: %w", err) - } - g.JSON = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetJSONValueRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getJsonValue#92fa5a05 as nil") - } - b.ObjStart() - b.PutID("getJsonValue") - b.Comma() - b.FieldStart("json") - b.PutString(g.JSON) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetJSONValueRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getJsonValue#92fa5a05 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getJsonValue"); err != nil { - return fmt.Errorf("unable to decode getJsonValue#92fa5a05: %w", err) - } - case "json": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getJsonValue#92fa5a05: field json: %w", err) - } - g.JSON = value - default: - return b.Skip() - } - return nil - }) -} - -// GetJSON returns value of JSON field. -func (g *GetJSONValueRequest) GetJSON() (value string) { - if g == nil { - return - } - return g.JSON -} - -// GetJSONValue invokes method getJsonValue#92fa5a05 returning error if any. -func (c *Client) GetJSONValue(ctx context.Context, json string) (JSONValueClass, error) { - var result JSONValueBox - - request := &GetJSONValueRequest{ - JSON: json, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.JsonValue, nil -} diff --git a/tdapi/tl_get_keyword_emojis_gen.go b/tdapi/tl_get_keyword_emojis_gen.go deleted file mode 100644 index 6d1d742b8..000000000 --- a/tdapi/tl_get_keyword_emojis_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetKeywordEmojisRequest represents TL type `getKeywordEmojis#7af81263`. -type GetKeywordEmojisRequest struct { - // Text to search for - Text string - // List of possible IETF language tags of the user's input language; may be empty if - // unknown - InputLanguageCodes []string -} - -// GetKeywordEmojisRequestTypeID is TL type id of GetKeywordEmojisRequest. -const GetKeywordEmojisRequestTypeID = 0x7af81263 - -// Ensuring interfaces in compile-time for GetKeywordEmojisRequest. -var ( - _ bin.Encoder = &GetKeywordEmojisRequest{} - _ bin.Decoder = &GetKeywordEmojisRequest{} - _ bin.BareEncoder = &GetKeywordEmojisRequest{} - _ bin.BareDecoder = &GetKeywordEmojisRequest{} -) - -func (g *GetKeywordEmojisRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Text == "") { - return false - } - if !(g.InputLanguageCodes == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetKeywordEmojisRequest) String() string { - if g == nil { - return "GetKeywordEmojisRequest(nil)" - } - type Alias GetKeywordEmojisRequest - return fmt.Sprintf("GetKeywordEmojisRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetKeywordEmojisRequest) TypeID() uint32 { - return GetKeywordEmojisRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetKeywordEmojisRequest) TypeName() string { - return "getKeywordEmojis" -} - -// TypeInfo returns info about TL type. -func (g *GetKeywordEmojisRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getKeywordEmojis", - ID: GetKeywordEmojisRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "InputLanguageCodes", - SchemaName: "input_language_codes", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetKeywordEmojisRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getKeywordEmojis#7af81263 as nil") - } - b.PutID(GetKeywordEmojisRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetKeywordEmojisRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getKeywordEmojis#7af81263 as nil") - } - b.PutString(g.Text) - b.PutInt(len(g.InputLanguageCodes)) - for _, v := range g.InputLanguageCodes { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetKeywordEmojisRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getKeywordEmojis#7af81263 to nil") - } - if err := b.ConsumeID(GetKeywordEmojisRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getKeywordEmojis#7af81263: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetKeywordEmojisRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getKeywordEmojis#7af81263 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getKeywordEmojis#7af81263: field text: %w", err) - } - g.Text = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode getKeywordEmojis#7af81263: field input_language_codes: %w", err) - } - - if headerLen > 0 { - g.InputLanguageCodes = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getKeywordEmojis#7af81263: field input_language_codes: %w", err) - } - g.InputLanguageCodes = append(g.InputLanguageCodes, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetKeywordEmojisRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getKeywordEmojis#7af81263 as nil") - } - b.ObjStart() - b.PutID("getKeywordEmojis") - b.Comma() - b.FieldStart("text") - b.PutString(g.Text) - b.Comma() - b.FieldStart("input_language_codes") - b.ArrStart() - for _, v := range g.InputLanguageCodes { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetKeywordEmojisRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getKeywordEmojis#7af81263 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getKeywordEmojis"); err != nil { - return fmt.Errorf("unable to decode getKeywordEmojis#7af81263: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getKeywordEmojis#7af81263: field text: %w", err) - } - g.Text = value - case "input_language_codes": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getKeywordEmojis#7af81263: field input_language_codes: %w", err) - } - g.InputLanguageCodes = append(g.InputLanguageCodes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode getKeywordEmojis#7af81263: field input_language_codes: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (g *GetKeywordEmojisRequest) GetText() (value string) { - if g == nil { - return - } - return g.Text -} - -// GetInputLanguageCodes returns value of InputLanguageCodes field. -func (g *GetKeywordEmojisRequest) GetInputLanguageCodes() (value []string) { - if g == nil { - return - } - return g.InputLanguageCodes -} - -// GetKeywordEmojis invokes method getKeywordEmojis#7af81263 returning error if any. -func (c *Client) GetKeywordEmojis(ctx context.Context, request *GetKeywordEmojisRequest) (*Emojis, error) { - var result Emojis - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_language_pack_info_gen.go b/tdapi/tl_get_language_pack_info_gen.go deleted file mode 100644 index 39d62e96c..000000000 --- a/tdapi/tl_get_language_pack_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetLanguagePackInfoRequest represents TL type `getLanguagePackInfo#7bd8daa8`. -type GetLanguagePackInfoRequest struct { - // Language pack identifier - LanguagePackID string -} - -// GetLanguagePackInfoRequestTypeID is TL type id of GetLanguagePackInfoRequest. -const GetLanguagePackInfoRequestTypeID = 0x7bd8daa8 - -// Ensuring interfaces in compile-time for GetLanguagePackInfoRequest. -var ( - _ bin.Encoder = &GetLanguagePackInfoRequest{} - _ bin.Decoder = &GetLanguagePackInfoRequest{} - _ bin.BareEncoder = &GetLanguagePackInfoRequest{} - _ bin.BareDecoder = &GetLanguagePackInfoRequest{} -) - -func (g *GetLanguagePackInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.LanguagePackID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetLanguagePackInfoRequest) String() string { - if g == nil { - return "GetLanguagePackInfoRequest(nil)" - } - type Alias GetLanguagePackInfoRequest - return fmt.Sprintf("GetLanguagePackInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetLanguagePackInfoRequest) TypeID() uint32 { - return GetLanguagePackInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetLanguagePackInfoRequest) TypeName() string { - return "getLanguagePackInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetLanguagePackInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getLanguagePackInfo", - ID: GetLanguagePackInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LanguagePackID", - SchemaName: "language_pack_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetLanguagePackInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLanguagePackInfo#7bd8daa8 as nil") - } - b.PutID(GetLanguagePackInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetLanguagePackInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLanguagePackInfo#7bd8daa8 as nil") - } - b.PutString(g.LanguagePackID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetLanguagePackInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLanguagePackInfo#7bd8daa8 to nil") - } - if err := b.ConsumeID(GetLanguagePackInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getLanguagePackInfo#7bd8daa8: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetLanguagePackInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLanguagePackInfo#7bd8daa8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackInfo#7bd8daa8: field language_pack_id: %w", err) - } - g.LanguagePackID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetLanguagePackInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getLanguagePackInfo#7bd8daa8 as nil") - } - b.ObjStart() - b.PutID("getLanguagePackInfo") - b.Comma() - b.FieldStart("language_pack_id") - b.PutString(g.LanguagePackID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetLanguagePackInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getLanguagePackInfo#7bd8daa8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getLanguagePackInfo"); err != nil { - return fmt.Errorf("unable to decode getLanguagePackInfo#7bd8daa8: %w", err) - } - case "language_pack_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackInfo#7bd8daa8: field language_pack_id: %w", err) - } - g.LanguagePackID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguagePackID returns value of LanguagePackID field. -func (g *GetLanguagePackInfoRequest) GetLanguagePackID() (value string) { - if g == nil { - return - } - return g.LanguagePackID -} - -// GetLanguagePackInfo invokes method getLanguagePackInfo#7bd8daa8 returning error if any. -func (c *Client) GetLanguagePackInfo(ctx context.Context, languagepackid string) (*LanguagePackInfo, error) { - var result LanguagePackInfo - - request := &GetLanguagePackInfoRequest{ - LanguagePackID: languagepackid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_language_pack_string_gen.go b/tdapi/tl_get_language_pack_string_gen.go deleted file mode 100644 index ec96c85d5..000000000 --- a/tdapi/tl_get_language_pack_string_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetLanguagePackStringRequest represents TL type `getLanguagePackString#8fcde73`. -type GetLanguagePackStringRequest struct { - // Path to the language pack database in which strings are stored - LanguagePackDatabasePath string - // Localization target to which the language pack belongs - LocalizationTarget string - // Language pack identifier - LanguagePackID string - // Language pack key of the string to be returned - Key string -} - -// GetLanguagePackStringRequestTypeID is TL type id of GetLanguagePackStringRequest. -const GetLanguagePackStringRequestTypeID = 0x8fcde73 - -// Ensuring interfaces in compile-time for GetLanguagePackStringRequest. -var ( - _ bin.Encoder = &GetLanguagePackStringRequest{} - _ bin.Decoder = &GetLanguagePackStringRequest{} - _ bin.BareEncoder = &GetLanguagePackStringRequest{} - _ bin.BareDecoder = &GetLanguagePackStringRequest{} -) - -func (g *GetLanguagePackStringRequest) Zero() bool { - if g == nil { - return true - } - if !(g.LanguagePackDatabasePath == "") { - return false - } - if !(g.LocalizationTarget == "") { - return false - } - if !(g.LanguagePackID == "") { - return false - } - if !(g.Key == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetLanguagePackStringRequest) String() string { - if g == nil { - return "GetLanguagePackStringRequest(nil)" - } - type Alias GetLanguagePackStringRequest - return fmt.Sprintf("GetLanguagePackStringRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetLanguagePackStringRequest) TypeID() uint32 { - return GetLanguagePackStringRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetLanguagePackStringRequest) TypeName() string { - return "getLanguagePackString" -} - -// TypeInfo returns info about TL type. -func (g *GetLanguagePackStringRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getLanguagePackString", - ID: GetLanguagePackStringRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LanguagePackDatabasePath", - SchemaName: "language_pack_database_path", - }, - { - Name: "LocalizationTarget", - SchemaName: "localization_target", - }, - { - Name: "LanguagePackID", - SchemaName: "language_pack_id", - }, - { - Name: "Key", - SchemaName: "key", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetLanguagePackStringRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLanguagePackString#8fcde73 as nil") - } - b.PutID(GetLanguagePackStringRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetLanguagePackStringRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLanguagePackString#8fcde73 as nil") - } - b.PutString(g.LanguagePackDatabasePath) - b.PutString(g.LocalizationTarget) - b.PutString(g.LanguagePackID) - b.PutString(g.Key) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetLanguagePackStringRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLanguagePackString#8fcde73 to nil") - } - if err := b.ConsumeID(GetLanguagePackStringRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getLanguagePackString#8fcde73: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetLanguagePackStringRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLanguagePackString#8fcde73 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackString#8fcde73: field language_pack_database_path: %w", err) - } - g.LanguagePackDatabasePath = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackString#8fcde73: field localization_target: %w", err) - } - g.LocalizationTarget = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackString#8fcde73: field language_pack_id: %w", err) - } - g.LanguagePackID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackString#8fcde73: field key: %w", err) - } - g.Key = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetLanguagePackStringRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getLanguagePackString#8fcde73 as nil") - } - b.ObjStart() - b.PutID("getLanguagePackString") - b.Comma() - b.FieldStart("language_pack_database_path") - b.PutString(g.LanguagePackDatabasePath) - b.Comma() - b.FieldStart("localization_target") - b.PutString(g.LocalizationTarget) - b.Comma() - b.FieldStart("language_pack_id") - b.PutString(g.LanguagePackID) - b.Comma() - b.FieldStart("key") - b.PutString(g.Key) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetLanguagePackStringRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getLanguagePackString#8fcde73 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getLanguagePackString"); err != nil { - return fmt.Errorf("unable to decode getLanguagePackString#8fcde73: %w", err) - } - case "language_pack_database_path": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackString#8fcde73: field language_pack_database_path: %w", err) - } - g.LanguagePackDatabasePath = value - case "localization_target": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackString#8fcde73: field localization_target: %w", err) - } - g.LocalizationTarget = value - case "language_pack_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackString#8fcde73: field language_pack_id: %w", err) - } - g.LanguagePackID = value - case "key": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackString#8fcde73: field key: %w", err) - } - g.Key = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguagePackDatabasePath returns value of LanguagePackDatabasePath field. -func (g *GetLanguagePackStringRequest) GetLanguagePackDatabasePath() (value string) { - if g == nil { - return - } - return g.LanguagePackDatabasePath -} - -// GetLocalizationTarget returns value of LocalizationTarget field. -func (g *GetLanguagePackStringRequest) GetLocalizationTarget() (value string) { - if g == nil { - return - } - return g.LocalizationTarget -} - -// GetLanguagePackID returns value of LanguagePackID field. -func (g *GetLanguagePackStringRequest) GetLanguagePackID() (value string) { - if g == nil { - return - } - return g.LanguagePackID -} - -// GetKey returns value of Key field. -func (g *GetLanguagePackStringRequest) GetKey() (value string) { - if g == nil { - return - } - return g.Key -} - -// GetLanguagePackString invokes method getLanguagePackString#8fcde73 returning error if any. -func (c *Client) GetLanguagePackString(ctx context.Context, request *GetLanguagePackStringRequest) (LanguagePackStringValueClass, error) { - var result LanguagePackStringValueBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.LanguagePackStringValue, nil -} diff --git a/tdapi/tl_get_language_pack_strings_gen.go b/tdapi/tl_get_language_pack_strings_gen.go deleted file mode 100644 index 45e755ec8..000000000 --- a/tdapi/tl_get_language_pack_strings_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetLanguagePackStringsRequest represents TL type `getLanguagePackStrings#b0b867bb`. -type GetLanguagePackStringsRequest struct { - // Language pack identifier of the strings to be returned - LanguagePackID string - // Language pack keys of the strings to be returned; leave empty to request all available - // strings - Keys []string -} - -// GetLanguagePackStringsRequestTypeID is TL type id of GetLanguagePackStringsRequest. -const GetLanguagePackStringsRequestTypeID = 0xb0b867bb - -// Ensuring interfaces in compile-time for GetLanguagePackStringsRequest. -var ( - _ bin.Encoder = &GetLanguagePackStringsRequest{} - _ bin.Decoder = &GetLanguagePackStringsRequest{} - _ bin.BareEncoder = &GetLanguagePackStringsRequest{} - _ bin.BareDecoder = &GetLanguagePackStringsRequest{} -) - -func (g *GetLanguagePackStringsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.LanguagePackID == "") { - return false - } - if !(g.Keys == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetLanguagePackStringsRequest) String() string { - if g == nil { - return "GetLanguagePackStringsRequest(nil)" - } - type Alias GetLanguagePackStringsRequest - return fmt.Sprintf("GetLanguagePackStringsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetLanguagePackStringsRequest) TypeID() uint32 { - return GetLanguagePackStringsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetLanguagePackStringsRequest) TypeName() string { - return "getLanguagePackStrings" -} - -// TypeInfo returns info about TL type. -func (g *GetLanguagePackStringsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getLanguagePackStrings", - ID: GetLanguagePackStringsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LanguagePackID", - SchemaName: "language_pack_id", - }, - { - Name: "Keys", - SchemaName: "keys", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetLanguagePackStringsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLanguagePackStrings#b0b867bb as nil") - } - b.PutID(GetLanguagePackStringsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetLanguagePackStringsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLanguagePackStrings#b0b867bb as nil") - } - b.PutString(g.LanguagePackID) - b.PutInt(len(g.Keys)) - for _, v := range g.Keys { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetLanguagePackStringsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLanguagePackStrings#b0b867bb to nil") - } - if err := b.ConsumeID(GetLanguagePackStringsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getLanguagePackStrings#b0b867bb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetLanguagePackStringsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLanguagePackStrings#b0b867bb to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackStrings#b0b867bb: field language_pack_id: %w", err) - } - g.LanguagePackID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackStrings#b0b867bb: field keys: %w", err) - } - - if headerLen > 0 { - g.Keys = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackStrings#b0b867bb: field keys: %w", err) - } - g.Keys = append(g.Keys, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetLanguagePackStringsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getLanguagePackStrings#b0b867bb as nil") - } - b.ObjStart() - b.PutID("getLanguagePackStrings") - b.Comma() - b.FieldStart("language_pack_id") - b.PutString(g.LanguagePackID) - b.Comma() - b.FieldStart("keys") - b.ArrStart() - for _, v := range g.Keys { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetLanguagePackStringsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getLanguagePackStrings#b0b867bb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getLanguagePackStrings"); err != nil { - return fmt.Errorf("unable to decode getLanguagePackStrings#b0b867bb: %w", err) - } - case "language_pack_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackStrings#b0b867bb: field language_pack_id: %w", err) - } - g.LanguagePackID = value - case "keys": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLanguagePackStrings#b0b867bb: field keys: %w", err) - } - g.Keys = append(g.Keys, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode getLanguagePackStrings#b0b867bb: field keys: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguagePackID returns value of LanguagePackID field. -func (g *GetLanguagePackStringsRequest) GetLanguagePackID() (value string) { - if g == nil { - return - } - return g.LanguagePackID -} - -// GetKeys returns value of Keys field. -func (g *GetLanguagePackStringsRequest) GetKeys() (value []string) { - if g == nil { - return - } - return g.Keys -} - -// GetLanguagePackStrings invokes method getLanguagePackStrings#b0b867bb returning error if any. -func (c *Client) GetLanguagePackStrings(ctx context.Context, request *GetLanguagePackStringsRequest) (*LanguagePackStrings, error) { - var result LanguagePackStrings - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_link_preview_gen.go b/tdapi/tl_get_link_preview_gen.go deleted file mode 100644 index a8b3e0acc..000000000 --- a/tdapi/tl_get_link_preview_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetLinkPreviewRequest represents TL type `getLinkPreview#c2096321`. -type GetLinkPreviewRequest struct { - // Message text with formatting - Text FormattedText - // Options to be used for generation of the link preview; pass null to use default link - // preview options - LinkPreviewOptions LinkPreviewOptions -} - -// GetLinkPreviewRequestTypeID is TL type id of GetLinkPreviewRequest. -const GetLinkPreviewRequestTypeID = 0xc2096321 - -// Ensuring interfaces in compile-time for GetLinkPreviewRequest. -var ( - _ bin.Encoder = &GetLinkPreviewRequest{} - _ bin.Decoder = &GetLinkPreviewRequest{} - _ bin.BareEncoder = &GetLinkPreviewRequest{} - _ bin.BareDecoder = &GetLinkPreviewRequest{} -) - -func (g *GetLinkPreviewRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Text.Zero()) { - return false - } - if !(g.LinkPreviewOptions.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetLinkPreviewRequest) String() string { - if g == nil { - return "GetLinkPreviewRequest(nil)" - } - type Alias GetLinkPreviewRequest - return fmt.Sprintf("GetLinkPreviewRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetLinkPreviewRequest) TypeID() uint32 { - return GetLinkPreviewRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetLinkPreviewRequest) TypeName() string { - return "getLinkPreview" -} - -// TypeInfo returns info about TL type. -func (g *GetLinkPreviewRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getLinkPreview", - ID: GetLinkPreviewRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "LinkPreviewOptions", - SchemaName: "link_preview_options", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetLinkPreviewRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLinkPreview#c2096321 as nil") - } - b.PutID(GetLinkPreviewRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetLinkPreviewRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLinkPreview#c2096321 as nil") - } - if err := g.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode getLinkPreview#c2096321: field text: %w", err) - } - if err := g.LinkPreviewOptions.Encode(b); err != nil { - return fmt.Errorf("unable to encode getLinkPreview#c2096321: field link_preview_options: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetLinkPreviewRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLinkPreview#c2096321 to nil") - } - if err := b.ConsumeID(GetLinkPreviewRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getLinkPreview#c2096321: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetLinkPreviewRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLinkPreview#c2096321 to nil") - } - { - if err := g.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode getLinkPreview#c2096321: field text: %w", err) - } - } - { - if err := g.LinkPreviewOptions.Decode(b); err != nil { - return fmt.Errorf("unable to decode getLinkPreview#c2096321: field link_preview_options: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetLinkPreviewRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getLinkPreview#c2096321 as nil") - } - b.ObjStart() - b.PutID("getLinkPreview") - b.Comma() - b.FieldStart("text") - if err := g.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getLinkPreview#c2096321: field text: %w", err) - } - b.Comma() - b.FieldStart("link_preview_options") - if err := g.LinkPreviewOptions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getLinkPreview#c2096321: field link_preview_options: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetLinkPreviewRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getLinkPreview#c2096321 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getLinkPreview"); err != nil { - return fmt.Errorf("unable to decode getLinkPreview#c2096321: %w", err) - } - case "text": - if err := g.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getLinkPreview#c2096321: field text: %w", err) - } - case "link_preview_options": - if err := g.LinkPreviewOptions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getLinkPreview#c2096321: field link_preview_options: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (g *GetLinkPreviewRequest) GetText() (value FormattedText) { - if g == nil { - return - } - return g.Text -} - -// GetLinkPreviewOptions returns value of LinkPreviewOptions field. -func (g *GetLinkPreviewRequest) GetLinkPreviewOptions() (value LinkPreviewOptions) { - if g == nil { - return - } - return g.LinkPreviewOptions -} - -// GetLinkPreview invokes method getLinkPreview#c2096321 returning error if any. -func (c *Client) GetLinkPreview(ctx context.Context, request *GetLinkPreviewRequest) (*LinkPreview, error) { - var result LinkPreview - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_localization_target_info_gen.go b/tdapi/tl_get_localization_target_info_gen.go deleted file mode 100644 index f88ee2dec..000000000 --- a/tdapi/tl_get_localization_target_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetLocalizationTargetInfoRequest represents TL type `getLocalizationTargetInfo#6e3d1f86`. -type GetLocalizationTargetInfoRequest struct { - // Pass true to get only locally available information without sending network requests - OnlyLocal bool -} - -// GetLocalizationTargetInfoRequestTypeID is TL type id of GetLocalizationTargetInfoRequest. -const GetLocalizationTargetInfoRequestTypeID = 0x6e3d1f86 - -// Ensuring interfaces in compile-time for GetLocalizationTargetInfoRequest. -var ( - _ bin.Encoder = &GetLocalizationTargetInfoRequest{} - _ bin.Decoder = &GetLocalizationTargetInfoRequest{} - _ bin.BareEncoder = &GetLocalizationTargetInfoRequest{} - _ bin.BareDecoder = &GetLocalizationTargetInfoRequest{} -) - -func (g *GetLocalizationTargetInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.OnlyLocal == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetLocalizationTargetInfoRequest) String() string { - if g == nil { - return "GetLocalizationTargetInfoRequest(nil)" - } - type Alias GetLocalizationTargetInfoRequest - return fmt.Sprintf("GetLocalizationTargetInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetLocalizationTargetInfoRequest) TypeID() uint32 { - return GetLocalizationTargetInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetLocalizationTargetInfoRequest) TypeName() string { - return "getLocalizationTargetInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetLocalizationTargetInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getLocalizationTargetInfo", - ID: GetLocalizationTargetInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OnlyLocal", - SchemaName: "only_local", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetLocalizationTargetInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLocalizationTargetInfo#6e3d1f86 as nil") - } - b.PutID(GetLocalizationTargetInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetLocalizationTargetInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLocalizationTargetInfo#6e3d1f86 as nil") - } - b.PutBool(g.OnlyLocal) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetLocalizationTargetInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLocalizationTargetInfo#6e3d1f86 to nil") - } - if err := b.ConsumeID(GetLocalizationTargetInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getLocalizationTargetInfo#6e3d1f86: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetLocalizationTargetInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLocalizationTargetInfo#6e3d1f86 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getLocalizationTargetInfo#6e3d1f86: field only_local: %w", err) - } - g.OnlyLocal = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetLocalizationTargetInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getLocalizationTargetInfo#6e3d1f86 as nil") - } - b.ObjStart() - b.PutID("getLocalizationTargetInfo") - b.Comma() - b.FieldStart("only_local") - b.PutBool(g.OnlyLocal) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetLocalizationTargetInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getLocalizationTargetInfo#6e3d1f86 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getLocalizationTargetInfo"); err != nil { - return fmt.Errorf("unable to decode getLocalizationTargetInfo#6e3d1f86: %w", err) - } - case "only_local": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getLocalizationTargetInfo#6e3d1f86: field only_local: %w", err) - } - g.OnlyLocal = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOnlyLocal returns value of OnlyLocal field. -func (g *GetLocalizationTargetInfoRequest) GetOnlyLocal() (value bool) { - if g == nil { - return - } - return g.OnlyLocal -} - -// GetLocalizationTargetInfo invokes method getLocalizationTargetInfo#6e3d1f86 returning error if any. -func (c *Client) GetLocalizationTargetInfo(ctx context.Context, onlylocal bool) (*LocalizationTargetInfo, error) { - var result LocalizationTargetInfo - - request := &GetLocalizationTargetInfoRequest{ - OnlyLocal: onlylocal, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_log_stream_gen.go b/tdapi/tl_get_log_stream_gen.go deleted file mode 100644 index c2575c3c7..000000000 --- a/tdapi/tl_get_log_stream_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetLogStreamRequest represents TL type `getLogStream#45984b5b`. -type GetLogStreamRequest struct { -} - -// GetLogStreamRequestTypeID is TL type id of GetLogStreamRequest. -const GetLogStreamRequestTypeID = 0x45984b5b - -// Ensuring interfaces in compile-time for GetLogStreamRequest. -var ( - _ bin.Encoder = &GetLogStreamRequest{} - _ bin.Decoder = &GetLogStreamRequest{} - _ bin.BareEncoder = &GetLogStreamRequest{} - _ bin.BareDecoder = &GetLogStreamRequest{} -) - -func (g *GetLogStreamRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetLogStreamRequest) String() string { - if g == nil { - return "GetLogStreamRequest(nil)" - } - type Alias GetLogStreamRequest - return fmt.Sprintf("GetLogStreamRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetLogStreamRequest) TypeID() uint32 { - return GetLogStreamRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetLogStreamRequest) TypeName() string { - return "getLogStream" -} - -// TypeInfo returns info about TL type. -func (g *GetLogStreamRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getLogStream", - ID: GetLogStreamRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetLogStreamRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLogStream#45984b5b as nil") - } - b.PutID(GetLogStreamRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetLogStreamRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLogStream#45984b5b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetLogStreamRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLogStream#45984b5b to nil") - } - if err := b.ConsumeID(GetLogStreamRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getLogStream#45984b5b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetLogStreamRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLogStream#45984b5b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetLogStreamRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getLogStream#45984b5b as nil") - } - b.ObjStart() - b.PutID("getLogStream") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetLogStreamRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getLogStream#45984b5b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getLogStream"); err != nil { - return fmt.Errorf("unable to decode getLogStream#45984b5b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLogStream invokes method getLogStream#45984b5b returning error if any. -func (c *Client) GetLogStream(ctx context.Context) (LogStreamClass, error) { - var result LogStreamBox - - request := &GetLogStreamRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.LogStream, nil -} diff --git a/tdapi/tl_get_log_tag_verbosity_level_gen.go b/tdapi/tl_get_log_tag_verbosity_level_gen.go deleted file mode 100644 index 56fb41410..000000000 --- a/tdapi/tl_get_log_tag_verbosity_level_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetLogTagVerbosityLevelRequest represents TL type `getLogTagVerbosityLevel#38af2d83`. -type GetLogTagVerbosityLevelRequest struct { - // Logging tag to change verbosity level - Tag string -} - -// GetLogTagVerbosityLevelRequestTypeID is TL type id of GetLogTagVerbosityLevelRequest. -const GetLogTagVerbosityLevelRequestTypeID = 0x38af2d83 - -// Ensuring interfaces in compile-time for GetLogTagVerbosityLevelRequest. -var ( - _ bin.Encoder = &GetLogTagVerbosityLevelRequest{} - _ bin.Decoder = &GetLogTagVerbosityLevelRequest{} - _ bin.BareEncoder = &GetLogTagVerbosityLevelRequest{} - _ bin.BareDecoder = &GetLogTagVerbosityLevelRequest{} -) - -func (g *GetLogTagVerbosityLevelRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Tag == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetLogTagVerbosityLevelRequest) String() string { - if g == nil { - return "GetLogTagVerbosityLevelRequest(nil)" - } - type Alias GetLogTagVerbosityLevelRequest - return fmt.Sprintf("GetLogTagVerbosityLevelRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetLogTagVerbosityLevelRequest) TypeID() uint32 { - return GetLogTagVerbosityLevelRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetLogTagVerbosityLevelRequest) TypeName() string { - return "getLogTagVerbosityLevel" -} - -// TypeInfo returns info about TL type. -func (g *GetLogTagVerbosityLevelRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getLogTagVerbosityLevel", - ID: GetLogTagVerbosityLevelRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Tag", - SchemaName: "tag", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetLogTagVerbosityLevelRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLogTagVerbosityLevel#38af2d83 as nil") - } - b.PutID(GetLogTagVerbosityLevelRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetLogTagVerbosityLevelRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLogTagVerbosityLevel#38af2d83 as nil") - } - b.PutString(g.Tag) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetLogTagVerbosityLevelRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLogTagVerbosityLevel#38af2d83 to nil") - } - if err := b.ConsumeID(GetLogTagVerbosityLevelRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getLogTagVerbosityLevel#38af2d83: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetLogTagVerbosityLevelRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLogTagVerbosityLevel#38af2d83 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLogTagVerbosityLevel#38af2d83: field tag: %w", err) - } - g.Tag = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetLogTagVerbosityLevelRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getLogTagVerbosityLevel#38af2d83 as nil") - } - b.ObjStart() - b.PutID("getLogTagVerbosityLevel") - b.Comma() - b.FieldStart("tag") - b.PutString(g.Tag) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetLogTagVerbosityLevelRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getLogTagVerbosityLevel#38af2d83 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getLogTagVerbosityLevel"); err != nil { - return fmt.Errorf("unable to decode getLogTagVerbosityLevel#38af2d83: %w", err) - } - case "tag": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getLogTagVerbosityLevel#38af2d83: field tag: %w", err) - } - g.Tag = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTag returns value of Tag field. -func (g *GetLogTagVerbosityLevelRequest) GetTag() (value string) { - if g == nil { - return - } - return g.Tag -} - -// GetLogTagVerbosityLevel invokes method getLogTagVerbosityLevel#38af2d83 returning error if any. -func (c *Client) GetLogTagVerbosityLevel(ctx context.Context, tag string) (*LogVerbosityLevel, error) { - var result LogVerbosityLevel - - request := &GetLogTagVerbosityLevelRequest{ - Tag: tag, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_log_tags_gen.go b/tdapi/tl_get_log_tags_gen.go deleted file mode 100644 index f9f29bed5..000000000 --- a/tdapi/tl_get_log_tags_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetLogTagsRequest represents TL type `getLogTags#f0d569da`. -type GetLogTagsRequest struct { -} - -// GetLogTagsRequestTypeID is TL type id of GetLogTagsRequest. -const GetLogTagsRequestTypeID = 0xf0d569da - -// Ensuring interfaces in compile-time for GetLogTagsRequest. -var ( - _ bin.Encoder = &GetLogTagsRequest{} - _ bin.Decoder = &GetLogTagsRequest{} - _ bin.BareEncoder = &GetLogTagsRequest{} - _ bin.BareDecoder = &GetLogTagsRequest{} -) - -func (g *GetLogTagsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetLogTagsRequest) String() string { - if g == nil { - return "GetLogTagsRequest(nil)" - } - type Alias GetLogTagsRequest - return fmt.Sprintf("GetLogTagsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetLogTagsRequest) TypeID() uint32 { - return GetLogTagsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetLogTagsRequest) TypeName() string { - return "getLogTags" -} - -// TypeInfo returns info about TL type. -func (g *GetLogTagsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getLogTags", - ID: GetLogTagsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetLogTagsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLogTags#f0d569da as nil") - } - b.PutID(GetLogTagsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetLogTagsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLogTags#f0d569da as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetLogTagsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLogTags#f0d569da to nil") - } - if err := b.ConsumeID(GetLogTagsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getLogTags#f0d569da: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetLogTagsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLogTags#f0d569da to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetLogTagsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getLogTags#f0d569da as nil") - } - b.ObjStart() - b.PutID("getLogTags") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetLogTagsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getLogTags#f0d569da to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getLogTags"); err != nil { - return fmt.Errorf("unable to decode getLogTags#f0d569da: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLogTags invokes method getLogTags#f0d569da returning error if any. -func (c *Client) GetLogTags(ctx context.Context) (*LogTags, error) { - var result LogTags - - request := &GetLogTagsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_log_verbosity_level_gen.go b/tdapi/tl_get_log_verbosity_level_gen.go deleted file mode 100644 index 71769a68a..000000000 --- a/tdapi/tl_get_log_verbosity_level_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetLogVerbosityLevelRequest represents TL type `getLogVerbosityLevel#23689ae4`. -type GetLogVerbosityLevelRequest struct { -} - -// GetLogVerbosityLevelRequestTypeID is TL type id of GetLogVerbosityLevelRequest. -const GetLogVerbosityLevelRequestTypeID = 0x23689ae4 - -// Ensuring interfaces in compile-time for GetLogVerbosityLevelRequest. -var ( - _ bin.Encoder = &GetLogVerbosityLevelRequest{} - _ bin.Decoder = &GetLogVerbosityLevelRequest{} - _ bin.BareEncoder = &GetLogVerbosityLevelRequest{} - _ bin.BareDecoder = &GetLogVerbosityLevelRequest{} -) - -func (g *GetLogVerbosityLevelRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetLogVerbosityLevelRequest) String() string { - if g == nil { - return "GetLogVerbosityLevelRequest(nil)" - } - type Alias GetLogVerbosityLevelRequest - return fmt.Sprintf("GetLogVerbosityLevelRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetLogVerbosityLevelRequest) TypeID() uint32 { - return GetLogVerbosityLevelRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetLogVerbosityLevelRequest) TypeName() string { - return "getLogVerbosityLevel" -} - -// TypeInfo returns info about TL type. -func (g *GetLogVerbosityLevelRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getLogVerbosityLevel", - ID: GetLogVerbosityLevelRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetLogVerbosityLevelRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLogVerbosityLevel#23689ae4 as nil") - } - b.PutID(GetLogVerbosityLevelRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetLogVerbosityLevelRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLogVerbosityLevel#23689ae4 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetLogVerbosityLevelRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLogVerbosityLevel#23689ae4 to nil") - } - if err := b.ConsumeID(GetLogVerbosityLevelRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getLogVerbosityLevel#23689ae4: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetLogVerbosityLevelRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLogVerbosityLevel#23689ae4 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetLogVerbosityLevelRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getLogVerbosityLevel#23689ae4 as nil") - } - b.ObjStart() - b.PutID("getLogVerbosityLevel") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetLogVerbosityLevelRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getLogVerbosityLevel#23689ae4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getLogVerbosityLevel"); err != nil { - return fmt.Errorf("unable to decode getLogVerbosityLevel#23689ae4: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLogVerbosityLevel invokes method getLogVerbosityLevel#23689ae4 returning error if any. -func (c *Client) GetLogVerbosityLevel(ctx context.Context) (*LogVerbosityLevel, error) { - var result LogVerbosityLevel - - request := &GetLogVerbosityLevelRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_login_url_gen.go b/tdapi/tl_get_login_url_gen.go deleted file mode 100644 index b228e6e50..000000000 --- a/tdapi/tl_get_login_url_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetLoginURLRequest represents TL type `getLoginUrl#2f3295d1`. -type GetLoginURLRequest struct { - // Chat identifier of the message with the button - ChatID int64 - // Message identifier of the message with the button - MessageID int64 - // Button identifier - ButtonID int64 - // Pass true to allow the bot to send messages to the current user - AllowWriteAccess bool -} - -// GetLoginURLRequestTypeID is TL type id of GetLoginURLRequest. -const GetLoginURLRequestTypeID = 0x2f3295d1 - -// Ensuring interfaces in compile-time for GetLoginURLRequest. -var ( - _ bin.Encoder = &GetLoginURLRequest{} - _ bin.Decoder = &GetLoginURLRequest{} - _ bin.BareEncoder = &GetLoginURLRequest{} - _ bin.BareDecoder = &GetLoginURLRequest{} -) - -func (g *GetLoginURLRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.ButtonID == 0) { - return false - } - if !(g.AllowWriteAccess == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetLoginURLRequest) String() string { - if g == nil { - return "GetLoginURLRequest(nil)" - } - type Alias GetLoginURLRequest - return fmt.Sprintf("GetLoginURLRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetLoginURLRequest) TypeID() uint32 { - return GetLoginURLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetLoginURLRequest) TypeName() string { - return "getLoginUrl" -} - -// TypeInfo returns info about TL type. -func (g *GetLoginURLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getLoginUrl", - ID: GetLoginURLRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ButtonID", - SchemaName: "button_id", - }, - { - Name: "AllowWriteAccess", - SchemaName: "allow_write_access", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetLoginURLRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLoginUrl#2f3295d1 as nil") - } - b.PutID(GetLoginURLRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetLoginURLRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLoginUrl#2f3295d1 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - b.PutInt53(g.ButtonID) - b.PutBool(g.AllowWriteAccess) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetLoginURLRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLoginUrl#2f3295d1 to nil") - } - if err := b.ConsumeID(GetLoginURLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getLoginUrl#2f3295d1: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetLoginURLRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLoginUrl#2f3295d1 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrl#2f3295d1: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrl#2f3295d1: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrl#2f3295d1: field button_id: %w", err) - } - g.ButtonID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrl#2f3295d1: field allow_write_access: %w", err) - } - g.AllowWriteAccess = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetLoginURLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getLoginUrl#2f3295d1 as nil") - } - b.ObjStart() - b.PutID("getLoginUrl") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("button_id") - b.PutInt53(g.ButtonID) - b.Comma() - b.FieldStart("allow_write_access") - b.PutBool(g.AllowWriteAccess) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetLoginURLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getLoginUrl#2f3295d1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getLoginUrl"); err != nil { - return fmt.Errorf("unable to decode getLoginUrl#2f3295d1: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrl#2f3295d1: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrl#2f3295d1: field message_id: %w", err) - } - g.MessageID = value - case "button_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrl#2f3295d1: field button_id: %w", err) - } - g.ButtonID = value - case "allow_write_access": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrl#2f3295d1: field allow_write_access: %w", err) - } - g.AllowWriteAccess = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetLoginURLRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetLoginURLRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetButtonID returns value of ButtonID field. -func (g *GetLoginURLRequest) GetButtonID() (value int64) { - if g == nil { - return - } - return g.ButtonID -} - -// GetAllowWriteAccess returns value of AllowWriteAccess field. -func (g *GetLoginURLRequest) GetAllowWriteAccess() (value bool) { - if g == nil { - return - } - return g.AllowWriteAccess -} - -// GetLoginURL invokes method getLoginUrl#2f3295d1 returning error if any. -func (c *Client) GetLoginURL(ctx context.Context, request *GetLoginURLRequest) (*HTTPURL, error) { - var result HTTPURL - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_login_url_info_gen.go b/tdapi/tl_get_login_url_info_gen.go deleted file mode 100644 index 873ed755c..000000000 --- a/tdapi/tl_get_login_url_info_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetLoginURLInfoRequest represents TL type `getLoginUrlInfo#ccc99db3`. -type GetLoginURLInfoRequest struct { - // Chat identifier of the message with the button - ChatID int64 - // Message identifier of the message with the button. The message must not be scheduled - MessageID int64 - // Button identifier - ButtonID int64 -} - -// GetLoginURLInfoRequestTypeID is TL type id of GetLoginURLInfoRequest. -const GetLoginURLInfoRequestTypeID = 0xccc99db3 - -// Ensuring interfaces in compile-time for GetLoginURLInfoRequest. -var ( - _ bin.Encoder = &GetLoginURLInfoRequest{} - _ bin.Decoder = &GetLoginURLInfoRequest{} - _ bin.BareEncoder = &GetLoginURLInfoRequest{} - _ bin.BareDecoder = &GetLoginURLInfoRequest{} -) - -func (g *GetLoginURLInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.ButtonID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetLoginURLInfoRequest) String() string { - if g == nil { - return "GetLoginURLInfoRequest(nil)" - } - type Alias GetLoginURLInfoRequest - return fmt.Sprintf("GetLoginURLInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetLoginURLInfoRequest) TypeID() uint32 { - return GetLoginURLInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetLoginURLInfoRequest) TypeName() string { - return "getLoginUrlInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetLoginURLInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getLoginUrlInfo", - ID: GetLoginURLInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ButtonID", - SchemaName: "button_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetLoginURLInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLoginUrlInfo#ccc99db3 as nil") - } - b.PutID(GetLoginURLInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetLoginURLInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getLoginUrlInfo#ccc99db3 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - b.PutInt53(g.ButtonID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetLoginURLInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLoginUrlInfo#ccc99db3 to nil") - } - if err := b.ConsumeID(GetLoginURLInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getLoginUrlInfo#ccc99db3: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetLoginURLInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getLoginUrlInfo#ccc99db3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrlInfo#ccc99db3: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrlInfo#ccc99db3: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrlInfo#ccc99db3: field button_id: %w", err) - } - g.ButtonID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetLoginURLInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getLoginUrlInfo#ccc99db3 as nil") - } - b.ObjStart() - b.PutID("getLoginUrlInfo") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("button_id") - b.PutInt53(g.ButtonID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetLoginURLInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getLoginUrlInfo#ccc99db3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getLoginUrlInfo"); err != nil { - return fmt.Errorf("unable to decode getLoginUrlInfo#ccc99db3: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrlInfo#ccc99db3: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrlInfo#ccc99db3: field message_id: %w", err) - } - g.MessageID = value - case "button_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getLoginUrlInfo#ccc99db3: field button_id: %w", err) - } - g.ButtonID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetLoginURLInfoRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetLoginURLInfoRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetButtonID returns value of ButtonID field. -func (g *GetLoginURLInfoRequest) GetButtonID() (value int64) { - if g == nil { - return - } - return g.ButtonID -} - -// GetLoginURLInfo invokes method getLoginUrlInfo#ccc99db3 returning error if any. -func (c *Client) GetLoginURLInfo(ctx context.Context, request *GetLoginURLInfoRequest) (LoginURLInfoClass, error) { - var result LoginURLInfoBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.LoginUrlInfo, nil -} diff --git a/tdapi/tl_get_main_web_app_gen.go b/tdapi/tl_get_main_web_app_gen.go deleted file mode 100644 index ffad35b18..000000000 --- a/tdapi/tl_get_main_web_app_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMainWebAppRequest represents TL type `getMainWebApp#23687ca6`. -type GetMainWebAppRequest struct { - // Identifier of the chat in which the Web App is opened; pass 0 if none - ChatID int64 - // Identifier of the target bot - BotUserID int64 - // Start parameter from internalLinkTypeMainWebApp - StartParameter string - // Parameters to use to open the Web App - Parameters WebAppOpenParameters -} - -// GetMainWebAppRequestTypeID is TL type id of GetMainWebAppRequest. -const GetMainWebAppRequestTypeID = 0x23687ca6 - -// Ensuring interfaces in compile-time for GetMainWebAppRequest. -var ( - _ bin.Encoder = &GetMainWebAppRequest{} - _ bin.Decoder = &GetMainWebAppRequest{} - _ bin.BareEncoder = &GetMainWebAppRequest{} - _ bin.BareDecoder = &GetMainWebAppRequest{} -) - -func (g *GetMainWebAppRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.BotUserID == 0) { - return false - } - if !(g.StartParameter == "") { - return false - } - if !(g.Parameters.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMainWebAppRequest) String() string { - if g == nil { - return "GetMainWebAppRequest(nil)" - } - type Alias GetMainWebAppRequest - return fmt.Sprintf("GetMainWebAppRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMainWebAppRequest) TypeID() uint32 { - return GetMainWebAppRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMainWebAppRequest) TypeName() string { - return "getMainWebApp" -} - -// TypeInfo returns info about TL type. -func (g *GetMainWebAppRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMainWebApp", - ID: GetMainWebAppRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "StartParameter", - SchemaName: "start_parameter", - }, - { - Name: "Parameters", - SchemaName: "parameters", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMainWebAppRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMainWebApp#23687ca6 as nil") - } - b.PutID(GetMainWebAppRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMainWebAppRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMainWebApp#23687ca6 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.BotUserID) - b.PutString(g.StartParameter) - if err := g.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode getMainWebApp#23687ca6: field parameters: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMainWebAppRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMainWebApp#23687ca6 to nil") - } - if err := b.ConsumeID(GetMainWebAppRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMainWebApp#23687ca6: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMainWebAppRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMainWebApp#23687ca6 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMainWebApp#23687ca6: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMainWebApp#23687ca6: field bot_user_id: %w", err) - } - g.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getMainWebApp#23687ca6: field start_parameter: %w", err) - } - g.StartParameter = value - } - { - if err := g.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode getMainWebApp#23687ca6: field parameters: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMainWebAppRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMainWebApp#23687ca6 as nil") - } - b.ObjStart() - b.PutID("getMainWebApp") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.FieldStart("start_parameter") - b.PutString(g.StartParameter) - b.Comma() - b.FieldStart("parameters") - if err := g.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getMainWebApp#23687ca6: field parameters: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMainWebAppRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMainWebApp#23687ca6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMainWebApp"); err != nil { - return fmt.Errorf("unable to decode getMainWebApp#23687ca6: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMainWebApp#23687ca6: field chat_id: %w", err) - } - g.ChatID = value - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMainWebApp#23687ca6: field bot_user_id: %w", err) - } - g.BotUserID = value - case "start_parameter": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getMainWebApp#23687ca6: field start_parameter: %w", err) - } - g.StartParameter = value - case "parameters": - if err := g.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getMainWebApp#23687ca6: field parameters: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMainWebAppRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetMainWebAppRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetStartParameter returns value of StartParameter field. -func (g *GetMainWebAppRequest) GetStartParameter() (value string) { - if g == nil { - return - } - return g.StartParameter -} - -// GetParameters returns value of Parameters field. -func (g *GetMainWebAppRequest) GetParameters() (value WebAppOpenParameters) { - if g == nil { - return - } - return g.Parameters -} - -// GetMainWebApp invokes method getMainWebApp#23687ca6 returning error if any. -func (c *Client) GetMainWebApp(ctx context.Context, request *GetMainWebAppRequest) (*MainWebApp, error) { - var result MainWebApp - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_map_thumbnail_file_gen.go b/tdapi/tl_get_map_thumbnail_file_gen.go deleted file mode 100644 index 15feb2de0..000000000 --- a/tdapi/tl_get_map_thumbnail_file_gen.go +++ /dev/null @@ -1,373 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMapThumbnailFileRequest represents TL type `getMapThumbnailFile#f6e6979a`. -type GetMapThumbnailFileRequest struct { - // Location of the map center - Location Location - // Map zoom level; 13-20 - Zoom int32 - // Map width in pixels before applying scale; 16-1024 - Width int32 - // Map height in pixels before applying scale; 16-1024 - Height int32 - // Map scale; 1-3 - Scale int32 - // Identifier of a chat in which the thumbnail will be shown. Use 0 if unknown - ChatID int64 -} - -// GetMapThumbnailFileRequestTypeID is TL type id of GetMapThumbnailFileRequest. -const GetMapThumbnailFileRequestTypeID = 0xf6e6979a - -// Ensuring interfaces in compile-time for GetMapThumbnailFileRequest. -var ( - _ bin.Encoder = &GetMapThumbnailFileRequest{} - _ bin.Decoder = &GetMapThumbnailFileRequest{} - _ bin.BareEncoder = &GetMapThumbnailFileRequest{} - _ bin.BareDecoder = &GetMapThumbnailFileRequest{} -) - -func (g *GetMapThumbnailFileRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Location.Zero()) { - return false - } - if !(g.Zoom == 0) { - return false - } - if !(g.Width == 0) { - return false - } - if !(g.Height == 0) { - return false - } - if !(g.Scale == 0) { - return false - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMapThumbnailFileRequest) String() string { - if g == nil { - return "GetMapThumbnailFileRequest(nil)" - } - type Alias GetMapThumbnailFileRequest - return fmt.Sprintf("GetMapThumbnailFileRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMapThumbnailFileRequest) TypeID() uint32 { - return GetMapThumbnailFileRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMapThumbnailFileRequest) TypeName() string { - return "getMapThumbnailFile" -} - -// TypeInfo returns info about TL type. -func (g *GetMapThumbnailFileRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMapThumbnailFile", - ID: GetMapThumbnailFileRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "Zoom", - SchemaName: "zoom", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "Scale", - SchemaName: "scale", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMapThumbnailFileRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMapThumbnailFile#f6e6979a as nil") - } - b.PutID(GetMapThumbnailFileRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMapThumbnailFileRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMapThumbnailFile#f6e6979a as nil") - } - if err := g.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode getMapThumbnailFile#f6e6979a: field location: %w", err) - } - b.PutInt32(g.Zoom) - b.PutInt32(g.Width) - b.PutInt32(g.Height) - b.PutInt32(g.Scale) - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMapThumbnailFileRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMapThumbnailFile#f6e6979a to nil") - } - if err := b.ConsumeID(GetMapThumbnailFileRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMapThumbnailFileRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMapThumbnailFile#f6e6979a to nil") - } - { - if err := g.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field location: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field zoom: %w", err) - } - g.Zoom = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field width: %w", err) - } - g.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field height: %w", err) - } - g.Height = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field scale: %w", err) - } - g.Scale = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMapThumbnailFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMapThumbnailFile#f6e6979a as nil") - } - b.ObjStart() - b.PutID("getMapThumbnailFile") - b.Comma() - b.FieldStart("location") - if err := g.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getMapThumbnailFile#f6e6979a: field location: %w", err) - } - b.Comma() - b.FieldStart("zoom") - b.PutInt32(g.Zoom) - b.Comma() - b.FieldStart("width") - b.PutInt32(g.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(g.Height) - b.Comma() - b.FieldStart("scale") - b.PutInt32(g.Scale) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMapThumbnailFileRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMapThumbnailFile#f6e6979a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMapThumbnailFile"); err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: %w", err) - } - case "location": - if err := g.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field location: %w", err) - } - case "zoom": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field zoom: %w", err) - } - g.Zoom = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field width: %w", err) - } - g.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field height: %w", err) - } - g.Height = value - case "scale": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field scale: %w", err) - } - g.Scale = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMapThumbnailFile#f6e6979a: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (g *GetMapThumbnailFileRequest) GetLocation() (value Location) { - if g == nil { - return - } - return g.Location -} - -// GetZoom returns value of Zoom field. -func (g *GetMapThumbnailFileRequest) GetZoom() (value int32) { - if g == nil { - return - } - return g.Zoom -} - -// GetWidth returns value of Width field. -func (g *GetMapThumbnailFileRequest) GetWidth() (value int32) { - if g == nil { - return - } - return g.Width -} - -// GetHeight returns value of Height field. -func (g *GetMapThumbnailFileRequest) GetHeight() (value int32) { - if g == nil { - return - } - return g.Height -} - -// GetScale returns value of Scale field. -func (g *GetMapThumbnailFileRequest) GetScale() (value int32) { - if g == nil { - return - } - return g.Scale -} - -// GetChatID returns value of ChatID field. -func (g *GetMapThumbnailFileRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMapThumbnailFile invokes method getMapThumbnailFile#f6e6979a returning error if any. -func (c *Client) GetMapThumbnailFile(ctx context.Context, request *GetMapThumbnailFileRequest) (*File, error) { - var result File - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_markdown_text_gen.go b/tdapi/tl_get_markdown_text_gen.go deleted file mode 100644 index 887111dcd..000000000 --- a/tdapi/tl_get_markdown_text_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMarkdownTextRequest represents TL type `getMarkdownText#9ce7228`. -type GetMarkdownTextRequest struct { - // The text - Text FormattedText -} - -// GetMarkdownTextRequestTypeID is TL type id of GetMarkdownTextRequest. -const GetMarkdownTextRequestTypeID = 0x9ce7228 - -// Ensuring interfaces in compile-time for GetMarkdownTextRequest. -var ( - _ bin.Encoder = &GetMarkdownTextRequest{} - _ bin.Decoder = &GetMarkdownTextRequest{} - _ bin.BareEncoder = &GetMarkdownTextRequest{} - _ bin.BareDecoder = &GetMarkdownTextRequest{} -) - -func (g *GetMarkdownTextRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Text.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMarkdownTextRequest) String() string { - if g == nil { - return "GetMarkdownTextRequest(nil)" - } - type Alias GetMarkdownTextRequest - return fmt.Sprintf("GetMarkdownTextRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMarkdownTextRequest) TypeID() uint32 { - return GetMarkdownTextRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMarkdownTextRequest) TypeName() string { - return "getMarkdownText" -} - -// TypeInfo returns info about TL type. -func (g *GetMarkdownTextRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMarkdownText", - ID: GetMarkdownTextRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMarkdownTextRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMarkdownText#9ce7228 as nil") - } - b.PutID(GetMarkdownTextRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMarkdownTextRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMarkdownText#9ce7228 as nil") - } - if err := g.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode getMarkdownText#9ce7228: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMarkdownTextRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMarkdownText#9ce7228 to nil") - } - if err := b.ConsumeID(GetMarkdownTextRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMarkdownText#9ce7228: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMarkdownTextRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMarkdownText#9ce7228 to nil") - } - { - if err := g.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode getMarkdownText#9ce7228: field text: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMarkdownTextRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMarkdownText#9ce7228 as nil") - } - b.ObjStart() - b.PutID("getMarkdownText") - b.Comma() - b.FieldStart("text") - if err := g.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getMarkdownText#9ce7228: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMarkdownTextRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMarkdownText#9ce7228 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMarkdownText"); err != nil { - return fmt.Errorf("unable to decode getMarkdownText#9ce7228: %w", err) - } - case "text": - if err := g.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getMarkdownText#9ce7228: field text: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (g *GetMarkdownTextRequest) GetText() (value FormattedText) { - if g == nil { - return - } - return g.Text -} - -// GetMarkdownText invokes method getMarkdownText#9ce7228 returning error if any. -func (c *Client) GetMarkdownText(ctx context.Context, text FormattedText) (*FormattedText, error) { - var result FormattedText - - request := &GetMarkdownTextRequest{ - Text: text, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_me_gen.go b/tdapi/tl_get_me_gen.go deleted file mode 100644 index dae415c50..000000000 --- a/tdapi/tl_get_me_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMeRequest represents TL type `getMe#f495b27f`. -type GetMeRequest struct { -} - -// GetMeRequestTypeID is TL type id of GetMeRequest. -const GetMeRequestTypeID = 0xf495b27f - -// Ensuring interfaces in compile-time for GetMeRequest. -var ( - _ bin.Encoder = &GetMeRequest{} - _ bin.Decoder = &GetMeRequest{} - _ bin.BareEncoder = &GetMeRequest{} - _ bin.BareDecoder = &GetMeRequest{} -) - -func (g *GetMeRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMeRequest) String() string { - if g == nil { - return "GetMeRequest(nil)" - } - type Alias GetMeRequest - return fmt.Sprintf("GetMeRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMeRequest) TypeID() uint32 { - return GetMeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMeRequest) TypeName() string { - return "getMe" -} - -// TypeInfo returns info about TL type. -func (g *GetMeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMe", - ID: GetMeRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMeRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMe#f495b27f as nil") - } - b.PutID(GetMeRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMeRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMe#f495b27f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMeRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMe#f495b27f to nil") - } - if err := b.ConsumeID(GetMeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMe#f495b27f: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMeRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMe#f495b27f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMe#f495b27f as nil") - } - b.ObjStart() - b.PutID("getMe") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMe#f495b27f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMe"); err != nil { - return fmt.Errorf("unable to decode getMe#f495b27f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMe invokes method getMe#f495b27f returning error if any. -func (c *Client) GetMe(ctx context.Context) (*User, error) { - var result User - - request := &GetMeRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_menu_button_gen.go b/tdapi/tl_get_menu_button_gen.go deleted file mode 100644 index f641b7444..000000000 --- a/tdapi/tl_get_menu_button_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMenuButtonRequest represents TL type `getMenuButton#e5eef440`. -type GetMenuButtonRequest struct { - // Identifier of the user or 0 to get the default menu button - UserID int64 -} - -// GetMenuButtonRequestTypeID is TL type id of GetMenuButtonRequest. -const GetMenuButtonRequestTypeID = 0xe5eef440 - -// Ensuring interfaces in compile-time for GetMenuButtonRequest. -var ( - _ bin.Encoder = &GetMenuButtonRequest{} - _ bin.Decoder = &GetMenuButtonRequest{} - _ bin.BareEncoder = &GetMenuButtonRequest{} - _ bin.BareDecoder = &GetMenuButtonRequest{} -) - -func (g *GetMenuButtonRequest) Zero() bool { - if g == nil { - return true - } - if !(g.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMenuButtonRequest) String() string { - if g == nil { - return "GetMenuButtonRequest(nil)" - } - type Alias GetMenuButtonRequest - return fmt.Sprintf("GetMenuButtonRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMenuButtonRequest) TypeID() uint32 { - return GetMenuButtonRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMenuButtonRequest) TypeName() string { - return "getMenuButton" -} - -// TypeInfo returns info about TL type. -func (g *GetMenuButtonRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMenuButton", - ID: GetMenuButtonRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMenuButtonRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMenuButton#e5eef440 as nil") - } - b.PutID(GetMenuButtonRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMenuButtonRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMenuButton#e5eef440 as nil") - } - b.PutInt53(g.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMenuButtonRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMenuButton#e5eef440 to nil") - } - if err := b.ConsumeID(GetMenuButtonRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMenuButton#e5eef440: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMenuButtonRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMenuButton#e5eef440 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMenuButton#e5eef440: field user_id: %w", err) - } - g.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMenuButtonRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMenuButton#e5eef440 as nil") - } - b.ObjStart() - b.PutID("getMenuButton") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMenuButtonRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMenuButton#e5eef440 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMenuButton"); err != nil { - return fmt.Errorf("unable to decode getMenuButton#e5eef440: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMenuButton#e5eef440: field user_id: %w", err) - } - g.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (g *GetMenuButtonRequest) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetMenuButton invokes method getMenuButton#e5eef440 returning error if any. -func (c *Client) GetMenuButton(ctx context.Context, userid int64) (*BotMenuButton, error) { - var result BotMenuButton - - request := &GetMenuButtonRequest{ - UserID: userid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_added_reactions_gen.go b/tdapi/tl_get_message_added_reactions_gen.go deleted file mode 100644 index 649f6970c..000000000 --- a/tdapi/tl_get_message_added_reactions_gen.go +++ /dev/null @@ -1,354 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageAddedReactionsRequest represents TL type `getMessageAddedReactions#7dc6ae52`. -type GetMessageAddedReactionsRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message. Use message.interaction_info.reactions - // can_get_added_reactions to check whether added reactions can be received for the - // message - MessageID int64 - // Type of the reactions to return; pass null to return all added reactions; - // reactionTypePaid isn't supported - ReactionType ReactionTypeClass - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of reactions to be returned; must be positive and can't be greater - // than 100 - Limit int32 -} - -// GetMessageAddedReactionsRequestTypeID is TL type id of GetMessageAddedReactionsRequest. -const GetMessageAddedReactionsRequestTypeID = 0x7dc6ae52 - -// Ensuring interfaces in compile-time for GetMessageAddedReactionsRequest. -var ( - _ bin.Encoder = &GetMessageAddedReactionsRequest{} - _ bin.Decoder = &GetMessageAddedReactionsRequest{} - _ bin.BareEncoder = &GetMessageAddedReactionsRequest{} - _ bin.BareDecoder = &GetMessageAddedReactionsRequest{} -) - -func (g *GetMessageAddedReactionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.ReactionType == nil) { - return false - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageAddedReactionsRequest) String() string { - if g == nil { - return "GetMessageAddedReactionsRequest(nil)" - } - type Alias GetMessageAddedReactionsRequest - return fmt.Sprintf("GetMessageAddedReactionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageAddedReactionsRequest) TypeID() uint32 { - return GetMessageAddedReactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageAddedReactionsRequest) TypeName() string { - return "getMessageAddedReactions" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageAddedReactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageAddedReactions", - ID: GetMessageAddedReactionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReactionType", - SchemaName: "reaction_type", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageAddedReactionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageAddedReactions#7dc6ae52 as nil") - } - b.PutID(GetMessageAddedReactionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageAddedReactionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageAddedReactions#7dc6ae52 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - if g.ReactionType == nil { - return fmt.Errorf("unable to encode getMessageAddedReactions#7dc6ae52: field reaction_type is nil") - } - if err := g.ReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode getMessageAddedReactions#7dc6ae52: field reaction_type: %w", err) - } - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageAddedReactionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageAddedReactions#7dc6ae52 to nil") - } - if err := b.ConsumeID(GetMessageAddedReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageAddedReactionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageAddedReactions#7dc6ae52 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: field reaction_type: %w", err) - } - g.ReactionType = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageAddedReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageAddedReactions#7dc6ae52 as nil") - } - b.ObjStart() - b.PutID("getMessageAddedReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("reaction_type") - if g.ReactionType == nil { - return fmt.Errorf("unable to encode getMessageAddedReactions#7dc6ae52: field reaction_type is nil") - } - if err := g.ReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getMessageAddedReactions#7dc6ae52: field reaction_type: %w", err) - } - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageAddedReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageAddedReactions#7dc6ae52 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageAddedReactions"); err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: field message_id: %w", err) - } - g.MessageID = value - case "reaction_type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: field reaction_type: %w", err) - } - g.ReactionType = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessageAddedReactions#7dc6ae52: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageAddedReactionsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessageAddedReactionsRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetReactionType returns value of ReactionType field. -func (g *GetMessageAddedReactionsRequest) GetReactionType() (value ReactionTypeClass) { - if g == nil { - return - } - return g.ReactionType -} - -// GetOffset returns value of Offset field. -func (g *GetMessageAddedReactionsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetMessageAddedReactionsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetMessageAddedReactions invokes method getMessageAddedReactions#7dc6ae52 returning error if any. -func (c *Client) GetMessageAddedReactions(ctx context.Context, request *GetMessageAddedReactionsRequest) (*AddedReactions, error) { - var result AddedReactions - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_available_reactions_gen.go b/tdapi/tl_get_message_available_reactions_gen.go deleted file mode 100644 index e49bc2739..000000000 --- a/tdapi/tl_get_message_available_reactions_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageAvailableReactionsRequest represents TL type `getMessageAvailableReactions#76db86b2`. -type GetMessageAvailableReactionsRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // Number of reaction per row, 5-25 - RowSize int32 -} - -// GetMessageAvailableReactionsRequestTypeID is TL type id of GetMessageAvailableReactionsRequest. -const GetMessageAvailableReactionsRequestTypeID = 0x76db86b2 - -// Ensuring interfaces in compile-time for GetMessageAvailableReactionsRequest. -var ( - _ bin.Encoder = &GetMessageAvailableReactionsRequest{} - _ bin.Decoder = &GetMessageAvailableReactionsRequest{} - _ bin.BareEncoder = &GetMessageAvailableReactionsRequest{} - _ bin.BareDecoder = &GetMessageAvailableReactionsRequest{} -) - -func (g *GetMessageAvailableReactionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.RowSize == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageAvailableReactionsRequest) String() string { - if g == nil { - return "GetMessageAvailableReactionsRequest(nil)" - } - type Alias GetMessageAvailableReactionsRequest - return fmt.Sprintf("GetMessageAvailableReactionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageAvailableReactionsRequest) TypeID() uint32 { - return GetMessageAvailableReactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageAvailableReactionsRequest) TypeName() string { - return "getMessageAvailableReactions" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageAvailableReactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageAvailableReactions", - ID: GetMessageAvailableReactionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "RowSize", - SchemaName: "row_size", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageAvailableReactionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageAvailableReactions#76db86b2 as nil") - } - b.PutID(GetMessageAvailableReactionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageAvailableReactionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageAvailableReactions#76db86b2 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - b.PutInt32(g.RowSize) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageAvailableReactionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageAvailableReactions#76db86b2 to nil") - } - if err := b.ConsumeID(GetMessageAvailableReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageAvailableReactions#76db86b2: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageAvailableReactionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageAvailableReactions#76db86b2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageAvailableReactions#76db86b2: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageAvailableReactions#76db86b2: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessageAvailableReactions#76db86b2: field row_size: %w", err) - } - g.RowSize = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageAvailableReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageAvailableReactions#76db86b2 as nil") - } - b.ObjStart() - b.PutID("getMessageAvailableReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("row_size") - b.PutInt32(g.RowSize) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageAvailableReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageAvailableReactions#76db86b2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageAvailableReactions"); err != nil { - return fmt.Errorf("unable to decode getMessageAvailableReactions#76db86b2: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageAvailableReactions#76db86b2: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageAvailableReactions#76db86b2: field message_id: %w", err) - } - g.MessageID = value - case "row_size": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessageAvailableReactions#76db86b2: field row_size: %w", err) - } - g.RowSize = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageAvailableReactionsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessageAvailableReactionsRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetRowSize returns value of RowSize field. -func (g *GetMessageAvailableReactionsRequest) GetRowSize() (value int32) { - if g == nil { - return - } - return g.RowSize -} - -// GetMessageAvailableReactions invokes method getMessageAvailableReactions#76db86b2 returning error if any. -func (c *Client) GetMessageAvailableReactions(ctx context.Context, request *GetMessageAvailableReactionsRequest) (*AvailableReactions, error) { - var result AvailableReactions - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_effect_gen.go b/tdapi/tl_get_message_effect_gen.go deleted file mode 100644 index cfa11b21b..000000000 --- a/tdapi/tl_get_message_effect_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageEffectRequest represents TL type `getMessageEffect#9e513d14`. -type GetMessageEffectRequest struct { - // Unique identifier of the effect - EffectID int64 -} - -// GetMessageEffectRequestTypeID is TL type id of GetMessageEffectRequest. -const GetMessageEffectRequestTypeID = 0x9e513d14 - -// Ensuring interfaces in compile-time for GetMessageEffectRequest. -var ( - _ bin.Encoder = &GetMessageEffectRequest{} - _ bin.Decoder = &GetMessageEffectRequest{} - _ bin.BareEncoder = &GetMessageEffectRequest{} - _ bin.BareDecoder = &GetMessageEffectRequest{} -) - -func (g *GetMessageEffectRequest) Zero() bool { - if g == nil { - return true - } - if !(g.EffectID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageEffectRequest) String() string { - if g == nil { - return "GetMessageEffectRequest(nil)" - } - type Alias GetMessageEffectRequest - return fmt.Sprintf("GetMessageEffectRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageEffectRequest) TypeID() uint32 { - return GetMessageEffectRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageEffectRequest) TypeName() string { - return "getMessageEffect" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageEffectRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageEffect", - ID: GetMessageEffectRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "EffectID", - SchemaName: "effect_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageEffectRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageEffect#9e513d14 as nil") - } - b.PutID(GetMessageEffectRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageEffectRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageEffect#9e513d14 as nil") - } - b.PutLong(g.EffectID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageEffectRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageEffect#9e513d14 to nil") - } - if err := b.ConsumeID(GetMessageEffectRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageEffect#9e513d14: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageEffectRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageEffect#9e513d14 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getMessageEffect#9e513d14: field effect_id: %w", err) - } - g.EffectID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageEffectRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageEffect#9e513d14 as nil") - } - b.ObjStart() - b.PutID("getMessageEffect") - b.Comma() - b.FieldStart("effect_id") - b.PutLong(g.EffectID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageEffectRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageEffect#9e513d14 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageEffect"); err != nil { - return fmt.Errorf("unable to decode getMessageEffect#9e513d14: %w", err) - } - case "effect_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getMessageEffect#9e513d14: field effect_id: %w", err) - } - g.EffectID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEffectID returns value of EffectID field. -func (g *GetMessageEffectRequest) GetEffectID() (value int64) { - if g == nil { - return - } - return g.EffectID -} - -// GetMessageEffect invokes method getMessageEffect#9e513d14 returning error if any. -func (c *Client) GetMessageEffect(ctx context.Context, effectid int64) (*MessageEffect, error) { - var result MessageEffect - - request := &GetMessageEffectRequest{ - EffectID: effectid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_embedding_code_gen.go b/tdapi/tl_get_message_embedding_code_gen.go deleted file mode 100644 index ad16f55f6..000000000 --- a/tdapi/tl_get_message_embedding_code_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageEmbeddingCodeRequest represents TL type `getMessageEmbeddingCode#62a4cd09`. -type GetMessageEmbeddingCodeRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // Pass true to return an HTML code for embedding of the whole media album - ForAlbum bool -} - -// GetMessageEmbeddingCodeRequestTypeID is TL type id of GetMessageEmbeddingCodeRequest. -const GetMessageEmbeddingCodeRequestTypeID = 0x62a4cd09 - -// Ensuring interfaces in compile-time for GetMessageEmbeddingCodeRequest. -var ( - _ bin.Encoder = &GetMessageEmbeddingCodeRequest{} - _ bin.Decoder = &GetMessageEmbeddingCodeRequest{} - _ bin.BareEncoder = &GetMessageEmbeddingCodeRequest{} - _ bin.BareDecoder = &GetMessageEmbeddingCodeRequest{} -) - -func (g *GetMessageEmbeddingCodeRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.ForAlbum == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageEmbeddingCodeRequest) String() string { - if g == nil { - return "GetMessageEmbeddingCodeRequest(nil)" - } - type Alias GetMessageEmbeddingCodeRequest - return fmt.Sprintf("GetMessageEmbeddingCodeRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageEmbeddingCodeRequest) TypeID() uint32 { - return GetMessageEmbeddingCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageEmbeddingCodeRequest) TypeName() string { - return "getMessageEmbeddingCode" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageEmbeddingCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageEmbeddingCode", - ID: GetMessageEmbeddingCodeRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ForAlbum", - SchemaName: "for_album", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageEmbeddingCodeRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageEmbeddingCode#62a4cd09 as nil") - } - b.PutID(GetMessageEmbeddingCodeRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageEmbeddingCodeRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageEmbeddingCode#62a4cd09 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - b.PutBool(g.ForAlbum) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageEmbeddingCodeRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageEmbeddingCode#62a4cd09 to nil") - } - if err := b.ConsumeID(GetMessageEmbeddingCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageEmbeddingCode#62a4cd09: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageEmbeddingCodeRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageEmbeddingCode#62a4cd09 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageEmbeddingCode#62a4cd09: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageEmbeddingCode#62a4cd09: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getMessageEmbeddingCode#62a4cd09: field for_album: %w", err) - } - g.ForAlbum = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageEmbeddingCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageEmbeddingCode#62a4cd09 as nil") - } - b.ObjStart() - b.PutID("getMessageEmbeddingCode") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("for_album") - b.PutBool(g.ForAlbum) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageEmbeddingCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageEmbeddingCode#62a4cd09 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageEmbeddingCode"); err != nil { - return fmt.Errorf("unable to decode getMessageEmbeddingCode#62a4cd09: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageEmbeddingCode#62a4cd09: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageEmbeddingCode#62a4cd09: field message_id: %w", err) - } - g.MessageID = value - case "for_album": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getMessageEmbeddingCode#62a4cd09: field for_album: %w", err) - } - g.ForAlbum = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageEmbeddingCodeRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessageEmbeddingCodeRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetForAlbum returns value of ForAlbum field. -func (g *GetMessageEmbeddingCodeRequest) GetForAlbum() (value bool) { - if g == nil { - return - } - return g.ForAlbum -} - -// GetMessageEmbeddingCode invokes method getMessageEmbeddingCode#62a4cd09 returning error if any. -func (c *Client) GetMessageEmbeddingCode(ctx context.Context, request *GetMessageEmbeddingCodeRequest) (*Text, error) { - var result Text - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_file_type_gen.go b/tdapi/tl_get_message_file_type_gen.go deleted file mode 100644 index 0d29eb85f..000000000 --- a/tdapi/tl_get_message_file_type_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageFileTypeRequest represents TL type `getMessageFileType#e2c70fd4`. -type GetMessageFileTypeRequest struct { - // Beginning of the message file; up to 100 first lines - MessageFileHead string -} - -// GetMessageFileTypeRequestTypeID is TL type id of GetMessageFileTypeRequest. -const GetMessageFileTypeRequestTypeID = 0xe2c70fd4 - -// Ensuring interfaces in compile-time for GetMessageFileTypeRequest. -var ( - _ bin.Encoder = &GetMessageFileTypeRequest{} - _ bin.Decoder = &GetMessageFileTypeRequest{} - _ bin.BareEncoder = &GetMessageFileTypeRequest{} - _ bin.BareDecoder = &GetMessageFileTypeRequest{} -) - -func (g *GetMessageFileTypeRequest) Zero() bool { - if g == nil { - return true - } - if !(g.MessageFileHead == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageFileTypeRequest) String() string { - if g == nil { - return "GetMessageFileTypeRequest(nil)" - } - type Alias GetMessageFileTypeRequest - return fmt.Sprintf("GetMessageFileTypeRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageFileTypeRequest) TypeID() uint32 { - return GetMessageFileTypeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageFileTypeRequest) TypeName() string { - return "getMessageFileType" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageFileTypeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageFileType", - ID: GetMessageFileTypeRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageFileHead", - SchemaName: "message_file_head", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageFileTypeRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageFileType#e2c70fd4 as nil") - } - b.PutID(GetMessageFileTypeRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageFileTypeRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageFileType#e2c70fd4 as nil") - } - b.PutString(g.MessageFileHead) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageFileTypeRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageFileType#e2c70fd4 to nil") - } - if err := b.ConsumeID(GetMessageFileTypeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageFileType#e2c70fd4: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageFileTypeRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageFileType#e2c70fd4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getMessageFileType#e2c70fd4: field message_file_head: %w", err) - } - g.MessageFileHead = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageFileTypeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageFileType#e2c70fd4 as nil") - } - b.ObjStart() - b.PutID("getMessageFileType") - b.Comma() - b.FieldStart("message_file_head") - b.PutString(g.MessageFileHead) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageFileTypeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageFileType#e2c70fd4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageFileType"); err != nil { - return fmt.Errorf("unable to decode getMessageFileType#e2c70fd4: %w", err) - } - case "message_file_head": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getMessageFileType#e2c70fd4: field message_file_head: %w", err) - } - g.MessageFileHead = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageFileHead returns value of MessageFileHead field. -func (g *GetMessageFileTypeRequest) GetMessageFileHead() (value string) { - if g == nil { - return - } - return g.MessageFileHead -} - -// GetMessageFileType invokes method getMessageFileType#e2c70fd4 returning error if any. -func (c *Client) GetMessageFileType(ctx context.Context, messagefilehead string) (MessageFileTypeClass, error) { - var result MessageFileTypeBox - - request := &GetMessageFileTypeRequest{ - MessageFileHead: messagefilehead, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.MessageFileType, nil -} diff --git a/tdapi/tl_get_message_gen.go b/tdapi/tl_get_message_gen.go deleted file mode 100644 index f4ea97fe5..000000000 --- a/tdapi/tl_get_message_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageRequest represents TL type `getMessage#9372c080`. -type GetMessageRequest struct { - // Identifier of the chat the message belongs to - ChatID int64 - // Identifier of the message to get - MessageID int64 -} - -// GetMessageRequestTypeID is TL type id of GetMessageRequest. -const GetMessageRequestTypeID = 0x9372c080 - -// Ensuring interfaces in compile-time for GetMessageRequest. -var ( - _ bin.Encoder = &GetMessageRequest{} - _ bin.Decoder = &GetMessageRequest{} - _ bin.BareEncoder = &GetMessageRequest{} - _ bin.BareDecoder = &GetMessageRequest{} -) - -func (g *GetMessageRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageRequest) String() string { - if g == nil { - return "GetMessageRequest(nil)" - } - type Alias GetMessageRequest - return fmt.Sprintf("GetMessageRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageRequest) TypeID() uint32 { - return GetMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageRequest) TypeName() string { - return "getMessage" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessage", - ID: GetMessageRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessage#9372c080 as nil") - } - b.PutID(GetMessageRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessage#9372c080 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessage#9372c080 to nil") - } - if err := b.ConsumeID(GetMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessage#9372c080: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessage#9372c080 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessage#9372c080: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessage#9372c080: field message_id: %w", err) - } - g.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessage#9372c080 as nil") - } - b.ObjStart() - b.PutID("getMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessage#9372c080 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessage"); err != nil { - return fmt.Errorf("unable to decode getMessage#9372c080: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessage#9372c080: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessage#9372c080: field message_id: %w", err) - } - g.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessageRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetMessage invokes method getMessage#9372c080 returning error if any. -func (c *Client) GetMessage(ctx context.Context, request *GetMessageRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_import_confirmation_text_gen.go b/tdapi/tl_get_message_import_confirmation_text_gen.go deleted file mode 100644 index 047ed1e8c..000000000 --- a/tdapi/tl_get_message_import_confirmation_text_gen.go +++ /dev/null @@ -1,208 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageImportConfirmationTextRequest represents TL type `getMessageImportConfirmationText#174881a8`. -type GetMessageImportConfirmationTextRequest struct { - // Identifier of a chat to which the messages will be imported. It must be an identifier - // of a private chat with a mutual contact or an identifier of a supergroup chat with - // can_change_info member right - ChatID int64 -} - -// GetMessageImportConfirmationTextRequestTypeID is TL type id of GetMessageImportConfirmationTextRequest. -const GetMessageImportConfirmationTextRequestTypeID = 0x174881a8 - -// Ensuring interfaces in compile-time for GetMessageImportConfirmationTextRequest. -var ( - _ bin.Encoder = &GetMessageImportConfirmationTextRequest{} - _ bin.Decoder = &GetMessageImportConfirmationTextRequest{} - _ bin.BareEncoder = &GetMessageImportConfirmationTextRequest{} - _ bin.BareDecoder = &GetMessageImportConfirmationTextRequest{} -) - -func (g *GetMessageImportConfirmationTextRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageImportConfirmationTextRequest) String() string { - if g == nil { - return "GetMessageImportConfirmationTextRequest(nil)" - } - type Alias GetMessageImportConfirmationTextRequest - return fmt.Sprintf("GetMessageImportConfirmationTextRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageImportConfirmationTextRequest) TypeID() uint32 { - return GetMessageImportConfirmationTextRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageImportConfirmationTextRequest) TypeName() string { - return "getMessageImportConfirmationText" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageImportConfirmationTextRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageImportConfirmationText", - ID: GetMessageImportConfirmationTextRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageImportConfirmationTextRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageImportConfirmationText#174881a8 as nil") - } - b.PutID(GetMessageImportConfirmationTextRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageImportConfirmationTextRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageImportConfirmationText#174881a8 as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageImportConfirmationTextRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageImportConfirmationText#174881a8 to nil") - } - if err := b.ConsumeID(GetMessageImportConfirmationTextRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageImportConfirmationText#174881a8: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageImportConfirmationTextRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageImportConfirmationText#174881a8 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageImportConfirmationText#174881a8: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageImportConfirmationTextRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageImportConfirmationText#174881a8 as nil") - } - b.ObjStart() - b.PutID("getMessageImportConfirmationText") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageImportConfirmationTextRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageImportConfirmationText#174881a8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageImportConfirmationText"); err != nil { - return fmt.Errorf("unable to decode getMessageImportConfirmationText#174881a8: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageImportConfirmationText#174881a8: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageImportConfirmationTextRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageImportConfirmationText invokes method getMessageImportConfirmationText#174881a8 returning error if any. -func (c *Client) GetMessageImportConfirmationText(ctx context.Context, chatid int64) (*Text, error) { - var result Text - - request := &GetMessageImportConfirmationTextRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_link_gen.go b/tdapi/tl_get_message_link_gen.go deleted file mode 100644 index b77d242a5..000000000 --- a/tdapi/tl_get_message_link_gen.go +++ /dev/null @@ -1,341 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageLinkRequest represents TL type `getMessageLink#c556ef7a`. -type GetMessageLinkRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // If not 0, timestamp from which the video/audio/video note/voice note/story playing - // must start, in seconds. The media can be in the message content or in its link preview - MediaTimestamp int32 - // Pass true to create a link for the whole media album - ForAlbum bool - // Pass true to create a link to the message as a channel post comment, in a message - // thread, or a forum topic - InMessageThread bool -} - -// GetMessageLinkRequestTypeID is TL type id of GetMessageLinkRequest. -const GetMessageLinkRequestTypeID = 0xc556ef7a - -// Ensuring interfaces in compile-time for GetMessageLinkRequest. -var ( - _ bin.Encoder = &GetMessageLinkRequest{} - _ bin.Decoder = &GetMessageLinkRequest{} - _ bin.BareEncoder = &GetMessageLinkRequest{} - _ bin.BareDecoder = &GetMessageLinkRequest{} -) - -func (g *GetMessageLinkRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.MediaTimestamp == 0) { - return false - } - if !(g.ForAlbum == false) { - return false - } - if !(g.InMessageThread == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageLinkRequest) String() string { - if g == nil { - return "GetMessageLinkRequest(nil)" - } - type Alias GetMessageLinkRequest - return fmt.Sprintf("GetMessageLinkRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageLinkRequest) TypeID() uint32 { - return GetMessageLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageLinkRequest) TypeName() string { - return "getMessageLink" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageLink", - ID: GetMessageLinkRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "MediaTimestamp", - SchemaName: "media_timestamp", - }, - { - Name: "ForAlbum", - SchemaName: "for_album", - }, - { - Name: "InMessageThread", - SchemaName: "in_message_thread", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageLinkRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageLink#c556ef7a as nil") - } - b.PutID(GetMessageLinkRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageLinkRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageLink#c556ef7a as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - b.PutInt32(g.MediaTimestamp) - b.PutBool(g.ForAlbum) - b.PutBool(g.InMessageThread) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageLinkRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageLink#c556ef7a to nil") - } - if err := b.ConsumeID(GetMessageLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageLinkRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageLink#c556ef7a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: field media_timestamp: %w", err) - } - g.MediaTimestamp = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: field for_album: %w", err) - } - g.ForAlbum = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: field in_message_thread: %w", err) - } - g.InMessageThread = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageLink#c556ef7a as nil") - } - b.ObjStart() - b.PutID("getMessageLink") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("media_timestamp") - b.PutInt32(g.MediaTimestamp) - b.Comma() - b.FieldStart("for_album") - b.PutBool(g.ForAlbum) - b.Comma() - b.FieldStart("in_message_thread") - b.PutBool(g.InMessageThread) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageLink#c556ef7a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageLink"); err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: field message_id: %w", err) - } - g.MessageID = value - case "media_timestamp": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: field media_timestamp: %w", err) - } - g.MediaTimestamp = value - case "for_album": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: field for_album: %w", err) - } - g.ForAlbum = value - case "in_message_thread": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getMessageLink#c556ef7a: field in_message_thread: %w", err) - } - g.InMessageThread = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageLinkRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessageLinkRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetMediaTimestamp returns value of MediaTimestamp field. -func (g *GetMessageLinkRequest) GetMediaTimestamp() (value int32) { - if g == nil { - return - } - return g.MediaTimestamp -} - -// GetForAlbum returns value of ForAlbum field. -func (g *GetMessageLinkRequest) GetForAlbum() (value bool) { - if g == nil { - return - } - return g.ForAlbum -} - -// GetInMessageThread returns value of InMessageThread field. -func (g *GetMessageLinkRequest) GetInMessageThread() (value bool) { - if g == nil { - return - } - return g.InMessageThread -} - -// GetMessageLink invokes method getMessageLink#c556ef7a returning error if any. -func (c *Client) GetMessageLink(ctx context.Context, request *GetMessageLinkRequest) (*MessageLink, error) { - var result MessageLink - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_link_info_gen.go b/tdapi/tl_get_message_link_info_gen.go deleted file mode 100644 index 97a9fbeee..000000000 --- a/tdapi/tl_get_message_link_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageLinkInfoRequest represents TL type `getMessageLinkInfo#d63eb458`. -type GetMessageLinkInfoRequest struct { - // The message link - URL string -} - -// GetMessageLinkInfoRequestTypeID is TL type id of GetMessageLinkInfoRequest. -const GetMessageLinkInfoRequestTypeID = 0xd63eb458 - -// Ensuring interfaces in compile-time for GetMessageLinkInfoRequest. -var ( - _ bin.Encoder = &GetMessageLinkInfoRequest{} - _ bin.Decoder = &GetMessageLinkInfoRequest{} - _ bin.BareEncoder = &GetMessageLinkInfoRequest{} - _ bin.BareDecoder = &GetMessageLinkInfoRequest{} -) - -func (g *GetMessageLinkInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageLinkInfoRequest) String() string { - if g == nil { - return "GetMessageLinkInfoRequest(nil)" - } - type Alias GetMessageLinkInfoRequest - return fmt.Sprintf("GetMessageLinkInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageLinkInfoRequest) TypeID() uint32 { - return GetMessageLinkInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageLinkInfoRequest) TypeName() string { - return "getMessageLinkInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageLinkInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageLinkInfo", - ID: GetMessageLinkInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageLinkInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageLinkInfo#d63eb458 as nil") - } - b.PutID(GetMessageLinkInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageLinkInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageLinkInfo#d63eb458 as nil") - } - b.PutString(g.URL) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageLinkInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageLinkInfo#d63eb458 to nil") - } - if err := b.ConsumeID(GetMessageLinkInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageLinkInfo#d63eb458: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageLinkInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageLinkInfo#d63eb458 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getMessageLinkInfo#d63eb458: field url: %w", err) - } - g.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageLinkInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageLinkInfo#d63eb458 as nil") - } - b.ObjStart() - b.PutID("getMessageLinkInfo") - b.Comma() - b.FieldStart("url") - b.PutString(g.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageLinkInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageLinkInfo#d63eb458 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageLinkInfo"); err != nil { - return fmt.Errorf("unable to decode getMessageLinkInfo#d63eb458: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getMessageLinkInfo#d63eb458: field url: %w", err) - } - g.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (g *GetMessageLinkInfoRequest) GetURL() (value string) { - if g == nil { - return - } - return g.URL -} - -// GetMessageLinkInfo invokes method getMessageLinkInfo#d63eb458 returning error if any. -func (c *Client) GetMessageLinkInfo(ctx context.Context, url string) (*MessageLinkInfo, error) { - var result MessageLinkInfo - - request := &GetMessageLinkInfoRequest{ - URL: url, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_locally_gen.go b/tdapi/tl_get_message_locally_gen.go deleted file mode 100644 index c41863f9e..000000000 --- a/tdapi/tl_get_message_locally_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageLocallyRequest represents TL type `getMessageLocally#dc062b6c`. -type GetMessageLocallyRequest struct { - // Identifier of the chat the message belongs to - ChatID int64 - // Identifier of the message to get - MessageID int64 -} - -// GetMessageLocallyRequestTypeID is TL type id of GetMessageLocallyRequest. -const GetMessageLocallyRequestTypeID = 0xdc062b6c - -// Ensuring interfaces in compile-time for GetMessageLocallyRequest. -var ( - _ bin.Encoder = &GetMessageLocallyRequest{} - _ bin.Decoder = &GetMessageLocallyRequest{} - _ bin.BareEncoder = &GetMessageLocallyRequest{} - _ bin.BareDecoder = &GetMessageLocallyRequest{} -) - -func (g *GetMessageLocallyRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageLocallyRequest) String() string { - if g == nil { - return "GetMessageLocallyRequest(nil)" - } - type Alias GetMessageLocallyRequest - return fmt.Sprintf("GetMessageLocallyRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageLocallyRequest) TypeID() uint32 { - return GetMessageLocallyRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageLocallyRequest) TypeName() string { - return "getMessageLocally" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageLocallyRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageLocally", - ID: GetMessageLocallyRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageLocallyRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageLocally#dc062b6c as nil") - } - b.PutID(GetMessageLocallyRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageLocallyRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageLocally#dc062b6c as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageLocallyRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageLocally#dc062b6c to nil") - } - if err := b.ConsumeID(GetMessageLocallyRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageLocally#dc062b6c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageLocallyRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageLocally#dc062b6c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageLocally#dc062b6c: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageLocally#dc062b6c: field message_id: %w", err) - } - g.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageLocallyRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageLocally#dc062b6c as nil") - } - b.ObjStart() - b.PutID("getMessageLocally") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageLocallyRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageLocally#dc062b6c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageLocally"); err != nil { - return fmt.Errorf("unable to decode getMessageLocally#dc062b6c: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageLocally#dc062b6c: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageLocally#dc062b6c: field message_id: %w", err) - } - g.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageLocallyRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessageLocallyRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetMessageLocally invokes method getMessageLocally#dc062b6c returning error if any. -func (c *Client) GetMessageLocally(ctx context.Context, request *GetMessageLocallyRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_properties_gen.go b/tdapi/tl_get_message_properties_gen.go deleted file mode 100644 index 63af073cc..000000000 --- a/tdapi/tl_get_message_properties_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessagePropertiesRequest represents TL type `getMessageProperties#2e18e1ab`. -type GetMessagePropertiesRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the message - MessageID int64 -} - -// GetMessagePropertiesRequestTypeID is TL type id of GetMessagePropertiesRequest. -const GetMessagePropertiesRequestTypeID = 0x2e18e1ab - -// Ensuring interfaces in compile-time for GetMessagePropertiesRequest. -var ( - _ bin.Encoder = &GetMessagePropertiesRequest{} - _ bin.Decoder = &GetMessagePropertiesRequest{} - _ bin.BareEncoder = &GetMessagePropertiesRequest{} - _ bin.BareDecoder = &GetMessagePropertiesRequest{} -) - -func (g *GetMessagePropertiesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessagePropertiesRequest) String() string { - if g == nil { - return "GetMessagePropertiesRequest(nil)" - } - type Alias GetMessagePropertiesRequest - return fmt.Sprintf("GetMessagePropertiesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessagePropertiesRequest) TypeID() uint32 { - return GetMessagePropertiesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessagePropertiesRequest) TypeName() string { - return "getMessageProperties" -} - -// TypeInfo returns info about TL type. -func (g *GetMessagePropertiesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageProperties", - ID: GetMessagePropertiesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessagePropertiesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageProperties#2e18e1ab as nil") - } - b.PutID(GetMessagePropertiesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessagePropertiesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageProperties#2e18e1ab as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessagePropertiesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageProperties#2e18e1ab to nil") - } - if err := b.ConsumeID(GetMessagePropertiesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessagePropertiesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageProperties#2e18e1ab to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: field message_id: %w", err) - } - g.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessagePropertiesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageProperties#2e18e1ab as nil") - } - b.ObjStart() - b.PutID("getMessageProperties") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessagePropertiesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageProperties#2e18e1ab to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageProperties"); err != nil { - return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageProperties#2e18e1ab: field message_id: %w", err) - } - g.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessagePropertiesRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessagePropertiesRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetMessageProperties invokes method getMessageProperties#2e18e1ab returning error if any. -func (c *Client) GetMessageProperties(ctx context.Context, request *GetMessagePropertiesRequest) (*MessageProperties, error) { - var result MessageProperties - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_public_forwards_gen.go b/tdapi/tl_get_message_public_forwards_gen.go deleted file mode 100644 index ff6f747e5..000000000 --- a/tdapi/tl_get_message_public_forwards_gen.go +++ /dev/null @@ -1,308 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessagePublicForwardsRequest represents TL type `getMessagePublicForwards#519da4b4`. -type GetMessagePublicForwardsRequest struct { - // Chat identifier of the message - ChatID int64 - // Message identifier - MessageID int64 - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of messages and stories to be returned; must be positive and can't - // be greater than 100. For optimal performance, the number of returned objects is chosen - // by TDLib and can be smaller than the specified limit - Limit int32 -} - -// GetMessagePublicForwardsRequestTypeID is TL type id of GetMessagePublicForwardsRequest. -const GetMessagePublicForwardsRequestTypeID = 0x519da4b4 - -// Ensuring interfaces in compile-time for GetMessagePublicForwardsRequest. -var ( - _ bin.Encoder = &GetMessagePublicForwardsRequest{} - _ bin.Decoder = &GetMessagePublicForwardsRequest{} - _ bin.BareEncoder = &GetMessagePublicForwardsRequest{} - _ bin.BareDecoder = &GetMessagePublicForwardsRequest{} -) - -func (g *GetMessagePublicForwardsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessagePublicForwardsRequest) String() string { - if g == nil { - return "GetMessagePublicForwardsRequest(nil)" - } - type Alias GetMessagePublicForwardsRequest - return fmt.Sprintf("GetMessagePublicForwardsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessagePublicForwardsRequest) TypeID() uint32 { - return GetMessagePublicForwardsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessagePublicForwardsRequest) TypeName() string { - return "getMessagePublicForwards" -} - -// TypeInfo returns info about TL type. -func (g *GetMessagePublicForwardsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessagePublicForwards", - ID: GetMessagePublicForwardsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessagePublicForwardsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessagePublicForwards#519da4b4 as nil") - } - b.PutID(GetMessagePublicForwardsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessagePublicForwardsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessagePublicForwards#519da4b4 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessagePublicForwardsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessagePublicForwards#519da4b4 to nil") - } - if err := b.ConsumeID(GetMessagePublicForwardsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessagePublicForwards#519da4b4: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessagePublicForwardsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessagePublicForwards#519da4b4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessagePublicForwards#519da4b4: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessagePublicForwards#519da4b4: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getMessagePublicForwards#519da4b4: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessagePublicForwards#519da4b4: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessagePublicForwardsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessagePublicForwards#519da4b4 as nil") - } - b.ObjStart() - b.PutID("getMessagePublicForwards") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessagePublicForwardsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessagePublicForwards#519da4b4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessagePublicForwards"); err != nil { - return fmt.Errorf("unable to decode getMessagePublicForwards#519da4b4: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessagePublicForwards#519da4b4: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessagePublicForwards#519da4b4: field message_id: %w", err) - } - g.MessageID = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getMessagePublicForwards#519da4b4: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessagePublicForwards#519da4b4: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessagePublicForwardsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessagePublicForwardsRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetOffset returns value of Offset field. -func (g *GetMessagePublicForwardsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetMessagePublicForwardsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetMessagePublicForwards invokes method getMessagePublicForwards#519da4b4 returning error if any. -func (c *Client) GetMessagePublicForwards(ctx context.Context, request *GetMessagePublicForwardsRequest) (*PublicForwards, error) { - var result PublicForwards - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_read_date_gen.go b/tdapi/tl_get_message_read_date_gen.go deleted file mode 100644 index aafbc5653..000000000 --- a/tdapi/tl_get_message_read_date_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageReadDateRequest represents TL type `getMessageReadDate#a7850343`. -type GetMessageReadDateRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the message - MessageID int64 -} - -// GetMessageReadDateRequestTypeID is TL type id of GetMessageReadDateRequest. -const GetMessageReadDateRequestTypeID = 0xa7850343 - -// Ensuring interfaces in compile-time for GetMessageReadDateRequest. -var ( - _ bin.Encoder = &GetMessageReadDateRequest{} - _ bin.Decoder = &GetMessageReadDateRequest{} - _ bin.BareEncoder = &GetMessageReadDateRequest{} - _ bin.BareDecoder = &GetMessageReadDateRequest{} -) - -func (g *GetMessageReadDateRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageReadDateRequest) String() string { - if g == nil { - return "GetMessageReadDateRequest(nil)" - } - type Alias GetMessageReadDateRequest - return fmt.Sprintf("GetMessageReadDateRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageReadDateRequest) TypeID() uint32 { - return GetMessageReadDateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageReadDateRequest) TypeName() string { - return "getMessageReadDate" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageReadDateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageReadDate", - ID: GetMessageReadDateRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageReadDateRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageReadDate#a7850343 as nil") - } - b.PutID(GetMessageReadDateRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageReadDateRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageReadDate#a7850343 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageReadDateRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageReadDate#a7850343 to nil") - } - if err := b.ConsumeID(GetMessageReadDateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageReadDate#a7850343: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageReadDateRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageReadDate#a7850343 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageReadDate#a7850343: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageReadDate#a7850343: field message_id: %w", err) - } - g.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageReadDateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageReadDate#a7850343 as nil") - } - b.ObjStart() - b.PutID("getMessageReadDate") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageReadDateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageReadDate#a7850343 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageReadDate"); err != nil { - return fmt.Errorf("unable to decode getMessageReadDate#a7850343: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageReadDate#a7850343: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageReadDate#a7850343: field message_id: %w", err) - } - g.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageReadDateRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessageReadDateRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetMessageReadDate invokes method getMessageReadDate#a7850343 returning error if any. -func (c *Client) GetMessageReadDate(ctx context.Context, request *GetMessageReadDateRequest) (MessageReadDateClass, error) { - var result MessageReadDateBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.MessageReadDate, nil -} diff --git a/tdapi/tl_get_message_statistics_gen.go b/tdapi/tl_get_message_statistics_gen.go deleted file mode 100644 index 75f1af752..000000000 --- a/tdapi/tl_get_message_statistics_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageStatisticsRequest represents TL type `getMessageStatistics#4bb5a1d8`. -type GetMessageStatisticsRequest struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 - // Pass true if a dark theme is used by the application - IsDark bool -} - -// GetMessageStatisticsRequestTypeID is TL type id of GetMessageStatisticsRequest. -const GetMessageStatisticsRequestTypeID = 0x4bb5a1d8 - -// Ensuring interfaces in compile-time for GetMessageStatisticsRequest. -var ( - _ bin.Encoder = &GetMessageStatisticsRequest{} - _ bin.Decoder = &GetMessageStatisticsRequest{} - _ bin.BareEncoder = &GetMessageStatisticsRequest{} - _ bin.BareDecoder = &GetMessageStatisticsRequest{} -) - -func (g *GetMessageStatisticsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.IsDark == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageStatisticsRequest) String() string { - if g == nil { - return "GetMessageStatisticsRequest(nil)" - } - type Alias GetMessageStatisticsRequest - return fmt.Sprintf("GetMessageStatisticsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageStatisticsRequest) TypeID() uint32 { - return GetMessageStatisticsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageStatisticsRequest) TypeName() string { - return "getMessageStatistics" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageStatisticsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageStatistics", - ID: GetMessageStatisticsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "IsDark", - SchemaName: "is_dark", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageStatisticsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageStatistics#4bb5a1d8 as nil") - } - b.PutID(GetMessageStatisticsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageStatisticsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageStatistics#4bb5a1d8 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - b.PutBool(g.IsDark) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageStatisticsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageStatistics#4bb5a1d8 to nil") - } - if err := b.ConsumeID(GetMessageStatisticsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageStatistics#4bb5a1d8: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageStatisticsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageStatistics#4bb5a1d8 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageStatistics#4bb5a1d8: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageStatistics#4bb5a1d8: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getMessageStatistics#4bb5a1d8: field is_dark: %w", err) - } - g.IsDark = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageStatisticsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageStatistics#4bb5a1d8 as nil") - } - b.ObjStart() - b.PutID("getMessageStatistics") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("is_dark") - b.PutBool(g.IsDark) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageStatisticsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageStatistics#4bb5a1d8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageStatistics"); err != nil { - return fmt.Errorf("unable to decode getMessageStatistics#4bb5a1d8: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageStatistics#4bb5a1d8: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageStatistics#4bb5a1d8: field message_id: %w", err) - } - g.MessageID = value - case "is_dark": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getMessageStatistics#4bb5a1d8: field is_dark: %w", err) - } - g.IsDark = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageStatisticsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessageStatisticsRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetIsDark returns value of IsDark field. -func (g *GetMessageStatisticsRequest) GetIsDark() (value bool) { - if g == nil { - return - } - return g.IsDark -} - -// GetMessageStatistics invokes method getMessageStatistics#4bb5a1d8 returning error if any. -func (c *Client) GetMessageStatistics(ctx context.Context, request *GetMessageStatisticsRequest) (*MessageStatistics, error) { - var result MessageStatistics - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_thread_gen.go b/tdapi/tl_get_message_thread_gen.go deleted file mode 100644 index 00397499c..000000000 --- a/tdapi/tl_get_message_thread_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageThreadRequest represents TL type `getMessageThread#7af23e3e`. -type GetMessageThreadRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the message - MessageID int64 -} - -// GetMessageThreadRequestTypeID is TL type id of GetMessageThreadRequest. -const GetMessageThreadRequestTypeID = 0x7af23e3e - -// Ensuring interfaces in compile-time for GetMessageThreadRequest. -var ( - _ bin.Encoder = &GetMessageThreadRequest{} - _ bin.Decoder = &GetMessageThreadRequest{} - _ bin.BareEncoder = &GetMessageThreadRequest{} - _ bin.BareDecoder = &GetMessageThreadRequest{} -) - -func (g *GetMessageThreadRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageThreadRequest) String() string { - if g == nil { - return "GetMessageThreadRequest(nil)" - } - type Alias GetMessageThreadRequest - return fmt.Sprintf("GetMessageThreadRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageThreadRequest) TypeID() uint32 { - return GetMessageThreadRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageThreadRequest) TypeName() string { - return "getMessageThread" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageThreadRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageThread", - ID: GetMessageThreadRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageThreadRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageThread#7af23e3e as nil") - } - b.PutID(GetMessageThreadRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageThreadRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageThread#7af23e3e as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageThreadRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageThread#7af23e3e to nil") - } - if err := b.ConsumeID(GetMessageThreadRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageThread#7af23e3e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageThreadRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageThread#7af23e3e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageThread#7af23e3e: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageThread#7af23e3e: field message_id: %w", err) - } - g.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageThreadRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageThread#7af23e3e as nil") - } - b.ObjStart() - b.PutID("getMessageThread") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageThreadRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageThread#7af23e3e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageThread"); err != nil { - return fmt.Errorf("unable to decode getMessageThread#7af23e3e: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageThread#7af23e3e: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageThread#7af23e3e: field message_id: %w", err) - } - g.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageThreadRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessageThreadRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetMessageThread invokes method getMessageThread#7af23e3e returning error if any. -func (c *Client) GetMessageThread(ctx context.Context, request *GetMessageThreadRequest) (*MessageThreadInfo, error) { - var result MessageThreadInfo - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_thread_history_gen.go b/tdapi/tl_get_message_thread_history_gen.go deleted file mode 100644 index b67d67b41..000000000 --- a/tdapi/tl_get_message_thread_history_gen.go +++ /dev/null @@ -1,343 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageThreadHistoryRequest represents TL type `getMessageThreadHistory#9435d428`. -type GetMessageThreadHistoryRequest struct { - // Chat identifier - ChatID int64 - // Message identifier, which thread history needs to be returned - MessageID int64 - // Identifier of the message starting from which history must be fetched; use 0 to get - // results from the last message - FromMessageID int64 - // Specify 0 to get results from exactly the message from_message_id or a negative offset - // up to 99 to get additionally some newer messages - Offset int32 - // The maximum number of messages to be returned; must be positive and can't be greater - // than 100. If the offset is negative, the limit must be greater than or equal to - // -offset. - Limit int32 -} - -// GetMessageThreadHistoryRequestTypeID is TL type id of GetMessageThreadHistoryRequest. -const GetMessageThreadHistoryRequestTypeID = 0x9435d428 - -// Ensuring interfaces in compile-time for GetMessageThreadHistoryRequest. -var ( - _ bin.Encoder = &GetMessageThreadHistoryRequest{} - _ bin.Decoder = &GetMessageThreadHistoryRequest{} - _ bin.BareEncoder = &GetMessageThreadHistoryRequest{} - _ bin.BareDecoder = &GetMessageThreadHistoryRequest{} -) - -func (g *GetMessageThreadHistoryRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.FromMessageID == 0) { - return false - } - if !(g.Offset == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageThreadHistoryRequest) String() string { - if g == nil { - return "GetMessageThreadHistoryRequest(nil)" - } - type Alias GetMessageThreadHistoryRequest - return fmt.Sprintf("GetMessageThreadHistoryRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageThreadHistoryRequest) TypeID() uint32 { - return GetMessageThreadHistoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageThreadHistoryRequest) TypeName() string { - return "getMessageThreadHistory" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageThreadHistoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageThreadHistory", - ID: GetMessageThreadHistoryRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "FromMessageID", - SchemaName: "from_message_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageThreadHistoryRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageThreadHistory#9435d428 as nil") - } - b.PutID(GetMessageThreadHistoryRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageThreadHistoryRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageThreadHistory#9435d428 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - b.PutInt53(g.FromMessageID) - b.PutInt32(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageThreadHistoryRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageThreadHistory#9435d428 to nil") - } - if err := b.ConsumeID(GetMessageThreadHistoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageThreadHistoryRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageThreadHistory#9435d428 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: field from_message_id: %w", err) - } - g.FromMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageThreadHistoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageThreadHistory#9435d428 as nil") - } - b.ObjStart() - b.PutID("getMessageThreadHistory") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("from_message_id") - b.PutInt53(g.FromMessageID) - b.Comma() - b.FieldStart("offset") - b.PutInt32(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageThreadHistoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageThreadHistory#9435d428 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageThreadHistory"); err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: field message_id: %w", err) - } - g.MessageID = value - case "from_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: field from_message_id: %w", err) - } - g.FromMessageID = value - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getMessageThreadHistory#9435d428: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageThreadHistoryRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessageThreadHistoryRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetFromMessageID returns value of FromMessageID field. -func (g *GetMessageThreadHistoryRequest) GetFromMessageID() (value int64) { - if g == nil { - return - } - return g.FromMessageID -} - -// GetOffset returns value of Offset field. -func (g *GetMessageThreadHistoryRequest) GetOffset() (value int32) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetMessageThreadHistoryRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetMessageThreadHistory invokes method getMessageThreadHistory#9435d428 returning error if any. -func (c *Client) GetMessageThreadHistory(ctx context.Context, request *GetMessageThreadHistoryRequest) (*Messages, error) { - var result Messages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_message_viewers_gen.go b/tdapi/tl_get_message_viewers_gen.go deleted file mode 100644 index 56b6caf91..000000000 --- a/tdapi/tl_get_message_viewers_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessageViewersRequest represents TL type `getMessageViewers#a18f1ace`. -type GetMessageViewersRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the message - MessageID int64 -} - -// GetMessageViewersRequestTypeID is TL type id of GetMessageViewersRequest. -const GetMessageViewersRequestTypeID = 0xa18f1ace - -// Ensuring interfaces in compile-time for GetMessageViewersRequest. -var ( - _ bin.Encoder = &GetMessageViewersRequest{} - _ bin.Decoder = &GetMessageViewersRequest{} - _ bin.BareEncoder = &GetMessageViewersRequest{} - _ bin.BareDecoder = &GetMessageViewersRequest{} -) - -func (g *GetMessageViewersRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessageViewersRequest) String() string { - if g == nil { - return "GetMessageViewersRequest(nil)" - } - type Alias GetMessageViewersRequest - return fmt.Sprintf("GetMessageViewersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessageViewersRequest) TypeID() uint32 { - return GetMessageViewersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessageViewersRequest) TypeName() string { - return "getMessageViewers" -} - -// TypeInfo returns info about TL type. -func (g *GetMessageViewersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessageViewers", - ID: GetMessageViewersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessageViewersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageViewers#a18f1ace as nil") - } - b.PutID(GetMessageViewersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessageViewersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessageViewers#a18f1ace as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessageViewersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageViewers#a18f1ace to nil") - } - if err := b.ConsumeID(GetMessageViewersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessageViewers#a18f1ace: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessageViewersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessageViewers#a18f1ace to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageViewers#a18f1ace: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageViewers#a18f1ace: field message_id: %w", err) - } - g.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessageViewersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessageViewers#a18f1ace as nil") - } - b.ObjStart() - b.PutID("getMessageViewers") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessageViewersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessageViewers#a18f1ace to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessageViewers"); err != nil { - return fmt.Errorf("unable to decode getMessageViewers#a18f1ace: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageViewers#a18f1ace: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessageViewers#a18f1ace: field message_id: %w", err) - } - g.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessageViewersRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetMessageViewersRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetMessageViewers invokes method getMessageViewers#a18f1ace returning error if any. -func (c *Client) GetMessageViewers(ctx context.Context, request *GetMessageViewersRequest) (*MessageViewers, error) { - var result MessageViewers - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_messages_gen.go b/tdapi/tl_get_messages_gen.go deleted file mode 100644 index d35b89b2f..000000000 --- a/tdapi/tl_get_messages_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetMessagesRequest represents TL type `getMessages#d5dd28bf`. -type GetMessagesRequest struct { - // Identifier of the chat the messages belong to - ChatID int64 - // Identifiers of the messages to get - MessageIDs []int64 -} - -// GetMessagesRequestTypeID is TL type id of GetMessagesRequest. -const GetMessagesRequestTypeID = 0xd5dd28bf - -// Ensuring interfaces in compile-time for GetMessagesRequest. -var ( - _ bin.Encoder = &GetMessagesRequest{} - _ bin.Decoder = &GetMessagesRequest{} - _ bin.BareEncoder = &GetMessagesRequest{} - _ bin.BareDecoder = &GetMessagesRequest{} -) - -func (g *GetMessagesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetMessagesRequest) String() string { - if g == nil { - return "GetMessagesRequest(nil)" - } - type Alias GetMessagesRequest - return fmt.Sprintf("GetMessagesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetMessagesRequest) TypeID() uint32 { - return GetMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetMessagesRequest) TypeName() string { - return "getMessages" -} - -// TypeInfo returns info about TL type. -func (g *GetMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getMessages", - ID: GetMessagesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageIDs", - SchemaName: "message_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetMessagesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessages#d5dd28bf as nil") - } - b.PutID(GetMessagesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetMessagesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getMessages#d5dd28bf as nil") - } - b.PutInt53(g.ChatID) - b.PutInt(len(g.MessageIDs)) - for _, v := range g.MessageIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetMessagesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessages#d5dd28bf to nil") - } - if err := b.ConsumeID(GetMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getMessages#d5dd28bf: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetMessagesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getMessages#d5dd28bf to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessages#d5dd28bf: field chat_id: %w", err) - } - g.ChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode getMessages#d5dd28bf: field message_ids: %w", err) - } - - if headerLen > 0 { - g.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessages#d5dd28bf: field message_ids: %w", err) - } - g.MessageIDs = append(g.MessageIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getMessages#d5dd28bf as nil") - } - b.ObjStart() - b.PutID("getMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_ids") - b.ArrStart() - for _, v := range g.MessageIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getMessages#d5dd28bf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getMessages"); err != nil { - return fmt.Errorf("unable to decode getMessages#d5dd28bf: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessages#d5dd28bf: field chat_id: %w", err) - } - g.ChatID = value - case "message_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getMessages#d5dd28bf: field message_ids: %w", err) - } - g.MessageIDs = append(g.MessageIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode getMessages#d5dd28bf: field message_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetMessagesRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageIDs returns value of MessageIDs field. -func (g *GetMessagesRequest) GetMessageIDs() (value []int64) { - if g == nil { - return - } - return g.MessageIDs -} - -// GetMessages invokes method getMessages#d5dd28bf returning error if any. -func (c *Client) GetMessages(ctx context.Context, request *GetMessagesRequest) (*Messages, error) { - var result Messages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_network_statistics_gen.go b/tdapi/tl_get_network_statistics_gen.go deleted file mode 100644 index e9b93dd8b..000000000 --- a/tdapi/tl_get_network_statistics_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetNetworkStatisticsRequest represents TL type `getNetworkStatistics#c537581e`. -type GetNetworkStatisticsRequest struct { - // Pass true to get statistics only for the current library launch - OnlyCurrent bool -} - -// GetNetworkStatisticsRequestTypeID is TL type id of GetNetworkStatisticsRequest. -const GetNetworkStatisticsRequestTypeID = 0xc537581e - -// Ensuring interfaces in compile-time for GetNetworkStatisticsRequest. -var ( - _ bin.Encoder = &GetNetworkStatisticsRequest{} - _ bin.Decoder = &GetNetworkStatisticsRequest{} - _ bin.BareEncoder = &GetNetworkStatisticsRequest{} - _ bin.BareDecoder = &GetNetworkStatisticsRequest{} -) - -func (g *GetNetworkStatisticsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.OnlyCurrent == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetNetworkStatisticsRequest) String() string { - if g == nil { - return "GetNetworkStatisticsRequest(nil)" - } - type Alias GetNetworkStatisticsRequest - return fmt.Sprintf("GetNetworkStatisticsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetNetworkStatisticsRequest) TypeID() uint32 { - return GetNetworkStatisticsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetNetworkStatisticsRequest) TypeName() string { - return "getNetworkStatistics" -} - -// TypeInfo returns info about TL type. -func (g *GetNetworkStatisticsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getNetworkStatistics", - ID: GetNetworkStatisticsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OnlyCurrent", - SchemaName: "only_current", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetNetworkStatisticsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getNetworkStatistics#c537581e as nil") - } - b.PutID(GetNetworkStatisticsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetNetworkStatisticsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getNetworkStatistics#c537581e as nil") - } - b.PutBool(g.OnlyCurrent) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetNetworkStatisticsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getNetworkStatistics#c537581e to nil") - } - if err := b.ConsumeID(GetNetworkStatisticsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getNetworkStatistics#c537581e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetNetworkStatisticsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getNetworkStatistics#c537581e to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getNetworkStatistics#c537581e: field only_current: %w", err) - } - g.OnlyCurrent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetNetworkStatisticsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getNetworkStatistics#c537581e as nil") - } - b.ObjStart() - b.PutID("getNetworkStatistics") - b.Comma() - b.FieldStart("only_current") - b.PutBool(g.OnlyCurrent) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetNetworkStatisticsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getNetworkStatistics#c537581e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getNetworkStatistics"); err != nil { - return fmt.Errorf("unable to decode getNetworkStatistics#c537581e: %w", err) - } - case "only_current": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getNetworkStatistics#c537581e: field only_current: %w", err) - } - g.OnlyCurrent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOnlyCurrent returns value of OnlyCurrent field. -func (g *GetNetworkStatisticsRequest) GetOnlyCurrent() (value bool) { - if g == nil { - return - } - return g.OnlyCurrent -} - -// GetNetworkStatistics invokes method getNetworkStatistics#c537581e returning error if any. -func (c *Client) GetNetworkStatistics(ctx context.Context, onlycurrent bool) (*NetworkStatistics, error) { - var result NetworkStatistics - - request := &GetNetworkStatisticsRequest{ - OnlyCurrent: onlycurrent, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_new_chat_privacy_settings_gen.go b/tdapi/tl_get_new_chat_privacy_settings_gen.go deleted file mode 100644 index 7f889af77..000000000 --- a/tdapi/tl_get_new_chat_privacy_settings_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetNewChatPrivacySettingsRequest represents TL type `getNewChatPrivacySettings#b2cb4bb7`. -type GetNewChatPrivacySettingsRequest struct { -} - -// GetNewChatPrivacySettingsRequestTypeID is TL type id of GetNewChatPrivacySettingsRequest. -const GetNewChatPrivacySettingsRequestTypeID = 0xb2cb4bb7 - -// Ensuring interfaces in compile-time for GetNewChatPrivacySettingsRequest. -var ( - _ bin.Encoder = &GetNewChatPrivacySettingsRequest{} - _ bin.Decoder = &GetNewChatPrivacySettingsRequest{} - _ bin.BareEncoder = &GetNewChatPrivacySettingsRequest{} - _ bin.BareDecoder = &GetNewChatPrivacySettingsRequest{} -) - -func (g *GetNewChatPrivacySettingsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetNewChatPrivacySettingsRequest) String() string { - if g == nil { - return "GetNewChatPrivacySettingsRequest(nil)" - } - type Alias GetNewChatPrivacySettingsRequest - return fmt.Sprintf("GetNewChatPrivacySettingsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetNewChatPrivacySettingsRequest) TypeID() uint32 { - return GetNewChatPrivacySettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetNewChatPrivacySettingsRequest) TypeName() string { - return "getNewChatPrivacySettings" -} - -// TypeInfo returns info about TL type. -func (g *GetNewChatPrivacySettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getNewChatPrivacySettings", - ID: GetNewChatPrivacySettingsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetNewChatPrivacySettingsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getNewChatPrivacySettings#b2cb4bb7 as nil") - } - b.PutID(GetNewChatPrivacySettingsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetNewChatPrivacySettingsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getNewChatPrivacySettings#b2cb4bb7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetNewChatPrivacySettingsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getNewChatPrivacySettings#b2cb4bb7 to nil") - } - if err := b.ConsumeID(GetNewChatPrivacySettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getNewChatPrivacySettings#b2cb4bb7: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetNewChatPrivacySettingsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getNewChatPrivacySettings#b2cb4bb7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetNewChatPrivacySettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getNewChatPrivacySettings#b2cb4bb7 as nil") - } - b.ObjStart() - b.PutID("getNewChatPrivacySettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetNewChatPrivacySettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getNewChatPrivacySettings#b2cb4bb7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getNewChatPrivacySettings"); err != nil { - return fmt.Errorf("unable to decode getNewChatPrivacySettings#b2cb4bb7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetNewChatPrivacySettings invokes method getNewChatPrivacySettings#b2cb4bb7 returning error if any. -func (c *Client) GetNewChatPrivacySettings(ctx context.Context) (*NewChatPrivacySettings, error) { - var result NewChatPrivacySettings - - request := &GetNewChatPrivacySettingsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_option_gen.go b/tdapi/tl_get_option_gen.go deleted file mode 100644 index 7b346ed49..000000000 --- a/tdapi/tl_get_option_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetOptionRequest represents TL type `getOption#a2459e7e`. -type GetOptionRequest struct { - // The name of the option - Name string -} - -// GetOptionRequestTypeID is TL type id of GetOptionRequest. -const GetOptionRequestTypeID = 0xa2459e7e - -// Ensuring interfaces in compile-time for GetOptionRequest. -var ( - _ bin.Encoder = &GetOptionRequest{} - _ bin.Decoder = &GetOptionRequest{} - _ bin.BareEncoder = &GetOptionRequest{} - _ bin.BareDecoder = &GetOptionRequest{} -) - -func (g *GetOptionRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetOptionRequest) String() string { - if g == nil { - return "GetOptionRequest(nil)" - } - type Alias GetOptionRequest - return fmt.Sprintf("GetOptionRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetOptionRequest) TypeID() uint32 { - return GetOptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetOptionRequest) TypeName() string { - return "getOption" -} - -// TypeInfo returns info about TL type. -func (g *GetOptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getOption", - ID: GetOptionRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetOptionRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getOption#a2459e7e as nil") - } - b.PutID(GetOptionRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetOptionRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getOption#a2459e7e as nil") - } - b.PutString(g.Name) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetOptionRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getOption#a2459e7e to nil") - } - if err := b.ConsumeID(GetOptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getOption#a2459e7e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetOptionRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getOption#a2459e7e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getOption#a2459e7e: field name: %w", err) - } - g.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetOptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getOption#a2459e7e as nil") - } - b.ObjStart() - b.PutID("getOption") - b.Comma() - b.FieldStart("name") - b.PutString(g.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetOptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getOption#a2459e7e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getOption"); err != nil { - return fmt.Errorf("unable to decode getOption#a2459e7e: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getOption#a2459e7e: field name: %w", err) - } - g.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (g *GetOptionRequest) GetName() (value string) { - if g == nil { - return - } - return g.Name -} - -// GetOption invokes method getOption#a2459e7e returning error if any. -func (c *Client) GetOption(ctx context.Context, name string) (OptionValueClass, error) { - var result OptionValueBox - - request := &GetOptionRequest{ - Name: name, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.OptionValue, nil -} diff --git a/tdapi/tl_get_owned_bots_gen.go b/tdapi/tl_get_owned_bots_gen.go deleted file mode 100644 index 2f9926542..000000000 --- a/tdapi/tl_get_owned_bots_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetOwnedBotsRequest represents TL type `getOwnedBots#8b87c7fd`. -type GetOwnedBotsRequest struct { -} - -// GetOwnedBotsRequestTypeID is TL type id of GetOwnedBotsRequest. -const GetOwnedBotsRequestTypeID = 0x8b87c7fd - -// Ensuring interfaces in compile-time for GetOwnedBotsRequest. -var ( - _ bin.Encoder = &GetOwnedBotsRequest{} - _ bin.Decoder = &GetOwnedBotsRequest{} - _ bin.BareEncoder = &GetOwnedBotsRequest{} - _ bin.BareDecoder = &GetOwnedBotsRequest{} -) - -func (g *GetOwnedBotsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetOwnedBotsRequest) String() string { - if g == nil { - return "GetOwnedBotsRequest(nil)" - } - type Alias GetOwnedBotsRequest - return fmt.Sprintf("GetOwnedBotsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetOwnedBotsRequest) TypeID() uint32 { - return GetOwnedBotsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetOwnedBotsRequest) TypeName() string { - return "getOwnedBots" -} - -// TypeInfo returns info about TL type. -func (g *GetOwnedBotsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getOwnedBots", - ID: GetOwnedBotsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetOwnedBotsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getOwnedBots#8b87c7fd as nil") - } - b.PutID(GetOwnedBotsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetOwnedBotsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getOwnedBots#8b87c7fd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetOwnedBotsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getOwnedBots#8b87c7fd to nil") - } - if err := b.ConsumeID(GetOwnedBotsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getOwnedBots#8b87c7fd: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetOwnedBotsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getOwnedBots#8b87c7fd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetOwnedBotsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getOwnedBots#8b87c7fd as nil") - } - b.ObjStart() - b.PutID("getOwnedBots") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetOwnedBotsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getOwnedBots#8b87c7fd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getOwnedBots"); err != nil { - return fmt.Errorf("unable to decode getOwnedBots#8b87c7fd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOwnedBots invokes method getOwnedBots#8b87c7fd returning error if any. -func (c *Client) GetOwnedBots(ctx context.Context) (*Users, error) { - var result Users - - request := &GetOwnedBotsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_owned_sticker_sets_gen.go b/tdapi/tl_get_owned_sticker_sets_gen.go deleted file mode 100644 index 07cbf9abe..000000000 --- a/tdapi/tl_get_owned_sticker_sets_gen.go +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetOwnedStickerSetsRequest represents TL type `getOwnedStickerSets#58fe8120`. -type GetOwnedStickerSetsRequest struct { - // Identifier of the sticker set from which to return owned sticker sets; use 0 to get - // results from the beginning - OffsetStickerSetID int64 - // The maximum number of sticker sets to be returned; must be positive and can't be - // greater than 100. For optimal performance, the number of returned objects is chosen by - // TDLib and can be smaller than the specified limit - Limit int32 -} - -// GetOwnedStickerSetsRequestTypeID is TL type id of GetOwnedStickerSetsRequest. -const GetOwnedStickerSetsRequestTypeID = 0x58fe8120 - -// Ensuring interfaces in compile-time for GetOwnedStickerSetsRequest. -var ( - _ bin.Encoder = &GetOwnedStickerSetsRequest{} - _ bin.Decoder = &GetOwnedStickerSetsRequest{} - _ bin.BareEncoder = &GetOwnedStickerSetsRequest{} - _ bin.BareDecoder = &GetOwnedStickerSetsRequest{} -) - -func (g *GetOwnedStickerSetsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.OffsetStickerSetID == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetOwnedStickerSetsRequest) String() string { - if g == nil { - return "GetOwnedStickerSetsRequest(nil)" - } - type Alias GetOwnedStickerSetsRequest - return fmt.Sprintf("GetOwnedStickerSetsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetOwnedStickerSetsRequest) TypeID() uint32 { - return GetOwnedStickerSetsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetOwnedStickerSetsRequest) TypeName() string { - return "getOwnedStickerSets" -} - -// TypeInfo returns info about TL type. -func (g *GetOwnedStickerSetsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getOwnedStickerSets", - ID: GetOwnedStickerSetsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OffsetStickerSetID", - SchemaName: "offset_sticker_set_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetOwnedStickerSetsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getOwnedStickerSets#58fe8120 as nil") - } - b.PutID(GetOwnedStickerSetsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetOwnedStickerSetsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getOwnedStickerSets#58fe8120 as nil") - } - b.PutLong(g.OffsetStickerSetID) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetOwnedStickerSetsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getOwnedStickerSets#58fe8120 to nil") - } - if err := b.ConsumeID(GetOwnedStickerSetsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getOwnedStickerSets#58fe8120: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetOwnedStickerSetsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getOwnedStickerSets#58fe8120 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getOwnedStickerSets#58fe8120: field offset_sticker_set_id: %w", err) - } - g.OffsetStickerSetID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getOwnedStickerSets#58fe8120: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetOwnedStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getOwnedStickerSets#58fe8120 as nil") - } - b.ObjStart() - b.PutID("getOwnedStickerSets") - b.Comma() - b.FieldStart("offset_sticker_set_id") - b.PutLong(g.OffsetStickerSetID) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetOwnedStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getOwnedStickerSets#58fe8120 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getOwnedStickerSets"); err != nil { - return fmt.Errorf("unable to decode getOwnedStickerSets#58fe8120: %w", err) - } - case "offset_sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getOwnedStickerSets#58fe8120: field offset_sticker_set_id: %w", err) - } - g.OffsetStickerSetID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getOwnedStickerSets#58fe8120: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOffsetStickerSetID returns value of OffsetStickerSetID field. -func (g *GetOwnedStickerSetsRequest) GetOffsetStickerSetID() (value int64) { - if g == nil { - return - } - return g.OffsetStickerSetID -} - -// GetLimit returns value of Limit field. -func (g *GetOwnedStickerSetsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetOwnedStickerSets invokes method getOwnedStickerSets#58fe8120 returning error if any. -func (c *Client) GetOwnedStickerSets(ctx context.Context, request *GetOwnedStickerSetsRequest) (*StickerSets, error) { - var result StickerSets - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_passport_authorization_form_available_elements_gen.go b/tdapi/tl_get_passport_authorization_form_available_elements_gen.go deleted file mode 100644 index 1c1aa68a6..000000000 --- a/tdapi/tl_get_passport_authorization_form_available_elements_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPassportAuthorizationFormAvailableElementsRequest represents TL type `getPassportAuthorizationFormAvailableElements#3fb314fc`. -type GetPassportAuthorizationFormAvailableElementsRequest struct { - // Authorization form identifier - AuthorizationFormID int32 - // The 2-step verification password of the current user - Password string -} - -// GetPassportAuthorizationFormAvailableElementsRequestTypeID is TL type id of GetPassportAuthorizationFormAvailableElementsRequest. -const GetPassportAuthorizationFormAvailableElementsRequestTypeID = 0x3fb314fc - -// Ensuring interfaces in compile-time for GetPassportAuthorizationFormAvailableElementsRequest. -var ( - _ bin.Encoder = &GetPassportAuthorizationFormAvailableElementsRequest{} - _ bin.Decoder = &GetPassportAuthorizationFormAvailableElementsRequest{} - _ bin.BareEncoder = &GetPassportAuthorizationFormAvailableElementsRequest{} - _ bin.BareDecoder = &GetPassportAuthorizationFormAvailableElementsRequest{} -) - -func (g *GetPassportAuthorizationFormAvailableElementsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.AuthorizationFormID == 0) { - return false - } - if !(g.Password == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPassportAuthorizationFormAvailableElementsRequest) String() string { - if g == nil { - return "GetPassportAuthorizationFormAvailableElementsRequest(nil)" - } - type Alias GetPassportAuthorizationFormAvailableElementsRequest - return fmt.Sprintf("GetPassportAuthorizationFormAvailableElementsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPassportAuthorizationFormAvailableElementsRequest) TypeID() uint32 { - return GetPassportAuthorizationFormAvailableElementsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPassportAuthorizationFormAvailableElementsRequest) TypeName() string { - return "getPassportAuthorizationFormAvailableElements" -} - -// TypeInfo returns info about TL type. -func (g *GetPassportAuthorizationFormAvailableElementsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPassportAuthorizationFormAvailableElements", - ID: GetPassportAuthorizationFormAvailableElementsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AuthorizationFormID", - SchemaName: "authorization_form_id", - }, - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPassportAuthorizationFormAvailableElementsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPassportAuthorizationFormAvailableElements#3fb314fc as nil") - } - b.PutID(GetPassportAuthorizationFormAvailableElementsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPassportAuthorizationFormAvailableElementsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPassportAuthorizationFormAvailableElements#3fb314fc as nil") - } - b.PutInt32(g.AuthorizationFormID) - b.PutString(g.Password) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPassportAuthorizationFormAvailableElementsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPassportAuthorizationFormAvailableElements#3fb314fc to nil") - } - if err := b.ConsumeID(GetPassportAuthorizationFormAvailableElementsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationFormAvailableElements#3fb314fc: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPassportAuthorizationFormAvailableElementsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPassportAuthorizationFormAvailableElements#3fb314fc to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationFormAvailableElements#3fb314fc: field authorization_form_id: %w", err) - } - g.AuthorizationFormID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationFormAvailableElements#3fb314fc: field password: %w", err) - } - g.Password = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPassportAuthorizationFormAvailableElementsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPassportAuthorizationFormAvailableElements#3fb314fc as nil") - } - b.ObjStart() - b.PutID("getPassportAuthorizationFormAvailableElements") - b.Comma() - b.FieldStart("authorization_form_id") - b.PutInt32(g.AuthorizationFormID) - b.Comma() - b.FieldStart("password") - b.PutString(g.Password) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPassportAuthorizationFormAvailableElementsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPassportAuthorizationFormAvailableElements#3fb314fc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPassportAuthorizationFormAvailableElements"); err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationFormAvailableElements#3fb314fc: %w", err) - } - case "authorization_form_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationFormAvailableElements#3fb314fc: field authorization_form_id: %w", err) - } - g.AuthorizationFormID = value - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationFormAvailableElements#3fb314fc: field password: %w", err) - } - g.Password = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAuthorizationFormID returns value of AuthorizationFormID field. -func (g *GetPassportAuthorizationFormAvailableElementsRequest) GetAuthorizationFormID() (value int32) { - if g == nil { - return - } - return g.AuthorizationFormID -} - -// GetPassword returns value of Password field. -func (g *GetPassportAuthorizationFormAvailableElementsRequest) GetPassword() (value string) { - if g == nil { - return - } - return g.Password -} - -// GetPassportAuthorizationFormAvailableElements invokes method getPassportAuthorizationFormAvailableElements#3fb314fc returning error if any. -func (c *Client) GetPassportAuthorizationFormAvailableElements(ctx context.Context, request *GetPassportAuthorizationFormAvailableElementsRequest) (*PassportElementsWithErrors, error) { - var result PassportElementsWithErrors - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_passport_authorization_form_gen.go b/tdapi/tl_get_passport_authorization_form_gen.go deleted file mode 100644 index 4a382fb46..000000000 --- a/tdapi/tl_get_passport_authorization_form_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPassportAuthorizationFormRequest represents TL type `getPassportAuthorizationForm#61850486`. -type GetPassportAuthorizationFormRequest struct { - // User identifier of the service's bot - BotUserID int64 - // Telegram Passport element types requested by the service - Scope string - // Service's public key - PublicKey string - // Unique request identifier provided by the service - Nonce string -} - -// GetPassportAuthorizationFormRequestTypeID is TL type id of GetPassportAuthorizationFormRequest. -const GetPassportAuthorizationFormRequestTypeID = 0x61850486 - -// Ensuring interfaces in compile-time for GetPassportAuthorizationFormRequest. -var ( - _ bin.Encoder = &GetPassportAuthorizationFormRequest{} - _ bin.Decoder = &GetPassportAuthorizationFormRequest{} - _ bin.BareEncoder = &GetPassportAuthorizationFormRequest{} - _ bin.BareDecoder = &GetPassportAuthorizationFormRequest{} -) - -func (g *GetPassportAuthorizationFormRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BotUserID == 0) { - return false - } - if !(g.Scope == "") { - return false - } - if !(g.PublicKey == "") { - return false - } - if !(g.Nonce == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPassportAuthorizationFormRequest) String() string { - if g == nil { - return "GetPassportAuthorizationFormRequest(nil)" - } - type Alias GetPassportAuthorizationFormRequest - return fmt.Sprintf("GetPassportAuthorizationFormRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPassportAuthorizationFormRequest) TypeID() uint32 { - return GetPassportAuthorizationFormRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPassportAuthorizationFormRequest) TypeName() string { - return "getPassportAuthorizationForm" -} - -// TypeInfo returns info about TL type. -func (g *GetPassportAuthorizationFormRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPassportAuthorizationForm", - ID: GetPassportAuthorizationFormRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Scope", - SchemaName: "scope", - }, - { - Name: "PublicKey", - SchemaName: "public_key", - }, - { - Name: "Nonce", - SchemaName: "nonce", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPassportAuthorizationFormRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPassportAuthorizationForm#61850486 as nil") - } - b.PutID(GetPassportAuthorizationFormRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPassportAuthorizationFormRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPassportAuthorizationForm#61850486 as nil") - } - b.PutInt53(g.BotUserID) - b.PutString(g.Scope) - b.PutString(g.PublicKey) - b.PutString(g.Nonce) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPassportAuthorizationFormRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPassportAuthorizationForm#61850486 to nil") - } - if err := b.ConsumeID(GetPassportAuthorizationFormRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationForm#61850486: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPassportAuthorizationFormRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPassportAuthorizationForm#61850486 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationForm#61850486: field bot_user_id: %w", err) - } - g.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationForm#61850486: field scope: %w", err) - } - g.Scope = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationForm#61850486: field public_key: %w", err) - } - g.PublicKey = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationForm#61850486: field nonce: %w", err) - } - g.Nonce = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPassportAuthorizationFormRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPassportAuthorizationForm#61850486 as nil") - } - b.ObjStart() - b.PutID("getPassportAuthorizationForm") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.FieldStart("scope") - b.PutString(g.Scope) - b.Comma() - b.FieldStart("public_key") - b.PutString(g.PublicKey) - b.Comma() - b.FieldStart("nonce") - b.PutString(g.Nonce) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPassportAuthorizationFormRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPassportAuthorizationForm#61850486 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPassportAuthorizationForm"); err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationForm#61850486: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationForm#61850486: field bot_user_id: %w", err) - } - g.BotUserID = value - case "scope": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationForm#61850486: field scope: %w", err) - } - g.Scope = value - case "public_key": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationForm#61850486: field public_key: %w", err) - } - g.PublicKey = value - case "nonce": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPassportAuthorizationForm#61850486: field nonce: %w", err) - } - g.Nonce = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetPassportAuthorizationFormRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetScope returns value of Scope field. -func (g *GetPassportAuthorizationFormRequest) GetScope() (value string) { - if g == nil { - return - } - return g.Scope -} - -// GetPublicKey returns value of PublicKey field. -func (g *GetPassportAuthorizationFormRequest) GetPublicKey() (value string) { - if g == nil { - return - } - return g.PublicKey -} - -// GetNonce returns value of Nonce field. -func (g *GetPassportAuthorizationFormRequest) GetNonce() (value string) { - if g == nil { - return - } - return g.Nonce -} - -// GetPassportAuthorizationForm invokes method getPassportAuthorizationForm#61850486 returning error if any. -func (c *Client) GetPassportAuthorizationForm(ctx context.Context, request *GetPassportAuthorizationFormRequest) (*PassportAuthorizationForm, error) { - var result PassportAuthorizationForm - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_passport_element_gen.go b/tdapi/tl_get_passport_element_gen.go deleted file mode 100644 index 2e561382e..000000000 --- a/tdapi/tl_get_passport_element_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPassportElementRequest represents TL type `getPassportElement#8fcce17a`. -type GetPassportElementRequest struct { - // Telegram Passport element type - Type PassportElementTypeClass - // The 2-step verification password of the current user - Password string -} - -// GetPassportElementRequestTypeID is TL type id of GetPassportElementRequest. -const GetPassportElementRequestTypeID = 0x8fcce17a - -// Ensuring interfaces in compile-time for GetPassportElementRequest. -var ( - _ bin.Encoder = &GetPassportElementRequest{} - _ bin.Decoder = &GetPassportElementRequest{} - _ bin.BareEncoder = &GetPassportElementRequest{} - _ bin.BareDecoder = &GetPassportElementRequest{} -) - -func (g *GetPassportElementRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Type == nil) { - return false - } - if !(g.Password == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPassportElementRequest) String() string { - if g == nil { - return "GetPassportElementRequest(nil)" - } - type Alias GetPassportElementRequest - return fmt.Sprintf("GetPassportElementRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPassportElementRequest) TypeID() uint32 { - return GetPassportElementRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPassportElementRequest) TypeName() string { - return "getPassportElement" -} - -// TypeInfo returns info about TL type. -func (g *GetPassportElementRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPassportElement", - ID: GetPassportElementRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPassportElementRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPassportElement#8fcce17a as nil") - } - b.PutID(GetPassportElementRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPassportElementRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPassportElement#8fcce17a as nil") - } - if g.Type == nil { - return fmt.Errorf("unable to encode getPassportElement#8fcce17a: field type is nil") - } - if err := g.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode getPassportElement#8fcce17a: field type: %w", err) - } - b.PutString(g.Password) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPassportElementRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPassportElement#8fcce17a to nil") - } - if err := b.ConsumeID(GetPassportElementRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPassportElement#8fcce17a: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPassportElementRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPassportElement#8fcce17a to nil") - } - { - value, err := DecodePassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode getPassportElement#8fcce17a: field type: %w", err) - } - g.Type = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPassportElement#8fcce17a: field password: %w", err) - } - g.Password = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPassportElementRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPassportElement#8fcce17a as nil") - } - b.ObjStart() - b.PutID("getPassportElement") - b.Comma() - b.FieldStart("type") - if g.Type == nil { - return fmt.Errorf("unable to encode getPassportElement#8fcce17a: field type is nil") - } - if err := g.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getPassportElement#8fcce17a: field type: %w", err) - } - b.Comma() - b.FieldStart("password") - b.PutString(g.Password) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPassportElementRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPassportElement#8fcce17a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPassportElement"); err != nil { - return fmt.Errorf("unable to decode getPassportElement#8fcce17a: %w", err) - } - case "type": - value, err := DecodeTDLibJSONPassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode getPassportElement#8fcce17a: field type: %w", err) - } - g.Type = value - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPassportElement#8fcce17a: field password: %w", err) - } - g.Password = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (g *GetPassportElementRequest) GetType() (value PassportElementTypeClass) { - if g == nil { - return - } - return g.Type -} - -// GetPassword returns value of Password field. -func (g *GetPassportElementRequest) GetPassword() (value string) { - if g == nil { - return - } - return g.Password -} - -// GetPassportElement invokes method getPassportElement#8fcce17a returning error if any. -func (c *Client) GetPassportElement(ctx context.Context, request *GetPassportElementRequest) (PassportElementClass, error) { - var result PassportElementBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.PassportElement, nil -} diff --git a/tdapi/tl_get_password_state_gen.go b/tdapi/tl_get_password_state_gen.go deleted file mode 100644 index 4044da751..000000000 --- a/tdapi/tl_get_password_state_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPasswordStateRequest represents TL type `getPasswordState#f5957b78`. -type GetPasswordStateRequest struct { -} - -// GetPasswordStateRequestTypeID is TL type id of GetPasswordStateRequest. -const GetPasswordStateRequestTypeID = 0xf5957b78 - -// Ensuring interfaces in compile-time for GetPasswordStateRequest. -var ( - _ bin.Encoder = &GetPasswordStateRequest{} - _ bin.Decoder = &GetPasswordStateRequest{} - _ bin.BareEncoder = &GetPasswordStateRequest{} - _ bin.BareDecoder = &GetPasswordStateRequest{} -) - -func (g *GetPasswordStateRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPasswordStateRequest) String() string { - if g == nil { - return "GetPasswordStateRequest(nil)" - } - type Alias GetPasswordStateRequest - return fmt.Sprintf("GetPasswordStateRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPasswordStateRequest) TypeID() uint32 { - return GetPasswordStateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPasswordStateRequest) TypeName() string { - return "getPasswordState" -} - -// TypeInfo returns info about TL type. -func (g *GetPasswordStateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPasswordState", - ID: GetPasswordStateRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPasswordStateRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPasswordState#f5957b78 as nil") - } - b.PutID(GetPasswordStateRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPasswordStateRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPasswordState#f5957b78 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPasswordStateRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPasswordState#f5957b78 to nil") - } - if err := b.ConsumeID(GetPasswordStateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPasswordState#f5957b78: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPasswordStateRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPasswordState#f5957b78 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPasswordStateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPasswordState#f5957b78 as nil") - } - b.ObjStart() - b.PutID("getPasswordState") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPasswordStateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPasswordState#f5957b78 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPasswordState"); err != nil { - return fmt.Errorf("unable to decode getPasswordState#f5957b78: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPasswordState invokes method getPasswordState#f5957b78 returning error if any. -func (c *Client) GetPasswordState(ctx context.Context) (*PasswordState, error) { - var result PasswordState - - request := &GetPasswordStateRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_payment_form_gen.go b/tdapi/tl_get_payment_form_gen.go deleted file mode 100644 index da567beae..000000000 --- a/tdapi/tl_get_payment_form_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPaymentFormRequest represents TL type `getPaymentForm#8d4f76d4`. -type GetPaymentFormRequest struct { - // The invoice - InputInvoice InputInvoiceClass - // Preferred payment form theme; pass null to use the default theme - Theme ThemeParameters -} - -// GetPaymentFormRequestTypeID is TL type id of GetPaymentFormRequest. -const GetPaymentFormRequestTypeID = 0x8d4f76d4 - -// Ensuring interfaces in compile-time for GetPaymentFormRequest. -var ( - _ bin.Encoder = &GetPaymentFormRequest{} - _ bin.Decoder = &GetPaymentFormRequest{} - _ bin.BareEncoder = &GetPaymentFormRequest{} - _ bin.BareDecoder = &GetPaymentFormRequest{} -) - -func (g *GetPaymentFormRequest) Zero() bool { - if g == nil { - return true - } - if !(g.InputInvoice == nil) { - return false - } - if !(g.Theme.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPaymentFormRequest) String() string { - if g == nil { - return "GetPaymentFormRequest(nil)" - } - type Alias GetPaymentFormRequest - return fmt.Sprintf("GetPaymentFormRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPaymentFormRequest) TypeID() uint32 { - return GetPaymentFormRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPaymentFormRequest) TypeName() string { - return "getPaymentForm" -} - -// TypeInfo returns info about TL type. -func (g *GetPaymentFormRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPaymentForm", - ID: GetPaymentFormRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InputInvoice", - SchemaName: "input_invoice", - }, - { - Name: "Theme", - SchemaName: "theme", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPaymentFormRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPaymentForm#8d4f76d4 as nil") - } - b.PutID(GetPaymentFormRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPaymentFormRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPaymentForm#8d4f76d4 as nil") - } - if g.InputInvoice == nil { - return fmt.Errorf("unable to encode getPaymentForm#8d4f76d4: field input_invoice is nil") - } - if err := g.InputInvoice.Encode(b); err != nil { - return fmt.Errorf("unable to encode getPaymentForm#8d4f76d4: field input_invoice: %w", err) - } - if err := g.Theme.Encode(b); err != nil { - return fmt.Errorf("unable to encode getPaymentForm#8d4f76d4: field theme: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPaymentFormRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPaymentForm#8d4f76d4 to nil") - } - if err := b.ConsumeID(GetPaymentFormRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPaymentForm#8d4f76d4: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPaymentFormRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPaymentForm#8d4f76d4 to nil") - } - { - value, err := DecodeInputInvoice(b) - if err != nil { - return fmt.Errorf("unable to decode getPaymentForm#8d4f76d4: field input_invoice: %w", err) - } - g.InputInvoice = value - } - { - if err := g.Theme.Decode(b); err != nil { - return fmt.Errorf("unable to decode getPaymentForm#8d4f76d4: field theme: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPaymentFormRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPaymentForm#8d4f76d4 as nil") - } - b.ObjStart() - b.PutID("getPaymentForm") - b.Comma() - b.FieldStart("input_invoice") - if g.InputInvoice == nil { - return fmt.Errorf("unable to encode getPaymentForm#8d4f76d4: field input_invoice is nil") - } - if err := g.InputInvoice.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getPaymentForm#8d4f76d4: field input_invoice: %w", err) - } - b.Comma() - b.FieldStart("theme") - if err := g.Theme.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getPaymentForm#8d4f76d4: field theme: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPaymentFormRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPaymentForm#8d4f76d4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPaymentForm"); err != nil { - return fmt.Errorf("unable to decode getPaymentForm#8d4f76d4: %w", err) - } - case "input_invoice": - value, err := DecodeTDLibJSONInputInvoice(b) - if err != nil { - return fmt.Errorf("unable to decode getPaymentForm#8d4f76d4: field input_invoice: %w", err) - } - g.InputInvoice = value - case "theme": - if err := g.Theme.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getPaymentForm#8d4f76d4: field theme: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInputInvoice returns value of InputInvoice field. -func (g *GetPaymentFormRequest) GetInputInvoice() (value InputInvoiceClass) { - if g == nil { - return - } - return g.InputInvoice -} - -// GetTheme returns value of Theme field. -func (g *GetPaymentFormRequest) GetTheme() (value ThemeParameters) { - if g == nil { - return - } - return g.Theme -} - -// GetPaymentForm invokes method getPaymentForm#8d4f76d4 returning error if any. -func (c *Client) GetPaymentForm(ctx context.Context, request *GetPaymentFormRequest) (*PaymentForm, error) { - var result PaymentForm - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_payment_receipt_gen.go b/tdapi/tl_get_payment_receipt_gen.go deleted file mode 100644 index 6c8935901..000000000 --- a/tdapi/tl_get_payment_receipt_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPaymentReceiptRequest represents TL type `getPaymentReceipt#3c6cb956`. -type GetPaymentReceiptRequest struct { - // Chat identifier of the messagePaymentSuccessful message - ChatID int64 - // Message identifier - MessageID int64 -} - -// GetPaymentReceiptRequestTypeID is TL type id of GetPaymentReceiptRequest. -const GetPaymentReceiptRequestTypeID = 0x3c6cb956 - -// Ensuring interfaces in compile-time for GetPaymentReceiptRequest. -var ( - _ bin.Encoder = &GetPaymentReceiptRequest{} - _ bin.Decoder = &GetPaymentReceiptRequest{} - _ bin.BareEncoder = &GetPaymentReceiptRequest{} - _ bin.BareDecoder = &GetPaymentReceiptRequest{} -) - -func (g *GetPaymentReceiptRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPaymentReceiptRequest) String() string { - if g == nil { - return "GetPaymentReceiptRequest(nil)" - } - type Alias GetPaymentReceiptRequest - return fmt.Sprintf("GetPaymentReceiptRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPaymentReceiptRequest) TypeID() uint32 { - return GetPaymentReceiptRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPaymentReceiptRequest) TypeName() string { - return "getPaymentReceipt" -} - -// TypeInfo returns info about TL type. -func (g *GetPaymentReceiptRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPaymentReceipt", - ID: GetPaymentReceiptRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPaymentReceiptRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPaymentReceipt#3c6cb956 as nil") - } - b.PutID(GetPaymentReceiptRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPaymentReceiptRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPaymentReceipt#3c6cb956 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPaymentReceiptRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPaymentReceipt#3c6cb956 to nil") - } - if err := b.ConsumeID(GetPaymentReceiptRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPaymentReceipt#3c6cb956: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPaymentReceiptRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPaymentReceipt#3c6cb956 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPaymentReceipt#3c6cb956: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPaymentReceipt#3c6cb956: field message_id: %w", err) - } - g.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPaymentReceiptRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPaymentReceipt#3c6cb956 as nil") - } - b.ObjStart() - b.PutID("getPaymentReceipt") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPaymentReceiptRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPaymentReceipt#3c6cb956 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPaymentReceipt"); err != nil { - return fmt.Errorf("unable to decode getPaymentReceipt#3c6cb956: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPaymentReceipt#3c6cb956: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPaymentReceipt#3c6cb956: field message_id: %w", err) - } - g.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetPaymentReceiptRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetPaymentReceiptRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetPaymentReceipt invokes method getPaymentReceipt#3c6cb956 returning error if any. -func (c *Client) GetPaymentReceipt(ctx context.Context, request *GetPaymentReceiptRequest) (*PaymentReceipt, error) { - var result PaymentReceipt - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_phone_number_info_gen.go b/tdapi/tl_get_phone_number_info_gen.go deleted file mode 100644 index d539d2695..000000000 --- a/tdapi/tl_get_phone_number_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPhoneNumberInfoRequest represents TL type `getPhoneNumberInfo#a0229bf9`. -type GetPhoneNumberInfoRequest struct { - // The phone number prefix - PhoneNumberPrefix string -} - -// GetPhoneNumberInfoRequestTypeID is TL type id of GetPhoneNumberInfoRequest. -const GetPhoneNumberInfoRequestTypeID = 0xa0229bf9 - -// Ensuring interfaces in compile-time for GetPhoneNumberInfoRequest. -var ( - _ bin.Encoder = &GetPhoneNumberInfoRequest{} - _ bin.Decoder = &GetPhoneNumberInfoRequest{} - _ bin.BareEncoder = &GetPhoneNumberInfoRequest{} - _ bin.BareDecoder = &GetPhoneNumberInfoRequest{} -) - -func (g *GetPhoneNumberInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.PhoneNumberPrefix == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPhoneNumberInfoRequest) String() string { - if g == nil { - return "GetPhoneNumberInfoRequest(nil)" - } - type Alias GetPhoneNumberInfoRequest - return fmt.Sprintf("GetPhoneNumberInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPhoneNumberInfoRequest) TypeID() uint32 { - return GetPhoneNumberInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPhoneNumberInfoRequest) TypeName() string { - return "getPhoneNumberInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetPhoneNumberInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPhoneNumberInfo", - ID: GetPhoneNumberInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PhoneNumberPrefix", - SchemaName: "phone_number_prefix", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPhoneNumberInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPhoneNumberInfo#a0229bf9 as nil") - } - b.PutID(GetPhoneNumberInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPhoneNumberInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPhoneNumberInfo#a0229bf9 as nil") - } - b.PutString(g.PhoneNumberPrefix) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPhoneNumberInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPhoneNumberInfo#a0229bf9 to nil") - } - if err := b.ConsumeID(GetPhoneNumberInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPhoneNumberInfo#a0229bf9: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPhoneNumberInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPhoneNumberInfo#a0229bf9 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPhoneNumberInfo#a0229bf9: field phone_number_prefix: %w", err) - } - g.PhoneNumberPrefix = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPhoneNumberInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPhoneNumberInfo#a0229bf9 as nil") - } - b.ObjStart() - b.PutID("getPhoneNumberInfo") - b.Comma() - b.FieldStart("phone_number_prefix") - b.PutString(g.PhoneNumberPrefix) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPhoneNumberInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPhoneNumberInfo#a0229bf9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPhoneNumberInfo"); err != nil { - return fmt.Errorf("unable to decode getPhoneNumberInfo#a0229bf9: %w", err) - } - case "phone_number_prefix": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPhoneNumberInfo#a0229bf9: field phone_number_prefix: %w", err) - } - g.PhoneNumberPrefix = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoneNumberPrefix returns value of PhoneNumberPrefix field. -func (g *GetPhoneNumberInfoRequest) GetPhoneNumberPrefix() (value string) { - if g == nil { - return - } - return g.PhoneNumberPrefix -} - -// GetPhoneNumberInfo invokes method getPhoneNumberInfo#a0229bf9 returning error if any. -func (c *Client) GetPhoneNumberInfo(ctx context.Context, phonenumberprefix string) (*PhoneNumberInfo, error) { - var result PhoneNumberInfo - - request := &GetPhoneNumberInfoRequest{ - PhoneNumberPrefix: phonenumberprefix, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_phone_number_info_sync_gen.go b/tdapi/tl_get_phone_number_info_sync_gen.go deleted file mode 100644 index 08427f09b..000000000 --- a/tdapi/tl_get_phone_number_info_sync_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPhoneNumberInfoSyncRequest represents TL type `getPhoneNumberInfoSync#209b7d38`. -type GetPhoneNumberInfoSyncRequest struct { - // A two-letter ISO 639-1 language code for country information localization - LanguageCode string - // The phone number prefix - PhoneNumberPrefix string -} - -// GetPhoneNumberInfoSyncRequestTypeID is TL type id of GetPhoneNumberInfoSyncRequest. -const GetPhoneNumberInfoSyncRequestTypeID = 0x209b7d38 - -// Ensuring interfaces in compile-time for GetPhoneNumberInfoSyncRequest. -var ( - _ bin.Encoder = &GetPhoneNumberInfoSyncRequest{} - _ bin.Decoder = &GetPhoneNumberInfoSyncRequest{} - _ bin.BareEncoder = &GetPhoneNumberInfoSyncRequest{} - _ bin.BareDecoder = &GetPhoneNumberInfoSyncRequest{} -) - -func (g *GetPhoneNumberInfoSyncRequest) Zero() bool { - if g == nil { - return true - } - if !(g.LanguageCode == "") { - return false - } - if !(g.PhoneNumberPrefix == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPhoneNumberInfoSyncRequest) String() string { - if g == nil { - return "GetPhoneNumberInfoSyncRequest(nil)" - } - type Alias GetPhoneNumberInfoSyncRequest - return fmt.Sprintf("GetPhoneNumberInfoSyncRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPhoneNumberInfoSyncRequest) TypeID() uint32 { - return GetPhoneNumberInfoSyncRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPhoneNumberInfoSyncRequest) TypeName() string { - return "getPhoneNumberInfoSync" -} - -// TypeInfo returns info about TL type. -func (g *GetPhoneNumberInfoSyncRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPhoneNumberInfoSync", - ID: GetPhoneNumberInfoSyncRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - { - Name: "PhoneNumberPrefix", - SchemaName: "phone_number_prefix", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPhoneNumberInfoSyncRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPhoneNumberInfoSync#209b7d38 as nil") - } - b.PutID(GetPhoneNumberInfoSyncRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPhoneNumberInfoSyncRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPhoneNumberInfoSync#209b7d38 as nil") - } - b.PutString(g.LanguageCode) - b.PutString(g.PhoneNumberPrefix) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPhoneNumberInfoSyncRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPhoneNumberInfoSync#209b7d38 to nil") - } - if err := b.ConsumeID(GetPhoneNumberInfoSyncRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPhoneNumberInfoSync#209b7d38: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPhoneNumberInfoSyncRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPhoneNumberInfoSync#209b7d38 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPhoneNumberInfoSync#209b7d38: field language_code: %w", err) - } - g.LanguageCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPhoneNumberInfoSync#209b7d38: field phone_number_prefix: %w", err) - } - g.PhoneNumberPrefix = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPhoneNumberInfoSyncRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPhoneNumberInfoSync#209b7d38 as nil") - } - b.ObjStart() - b.PutID("getPhoneNumberInfoSync") - b.Comma() - b.FieldStart("language_code") - b.PutString(g.LanguageCode) - b.Comma() - b.FieldStart("phone_number_prefix") - b.PutString(g.PhoneNumberPrefix) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPhoneNumberInfoSyncRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPhoneNumberInfoSync#209b7d38 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPhoneNumberInfoSync"); err != nil { - return fmt.Errorf("unable to decode getPhoneNumberInfoSync#209b7d38: %w", err) - } - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPhoneNumberInfoSync#209b7d38: field language_code: %w", err) - } - g.LanguageCode = value - case "phone_number_prefix": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPhoneNumberInfoSync#209b7d38: field phone_number_prefix: %w", err) - } - g.PhoneNumberPrefix = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguageCode returns value of LanguageCode field. -func (g *GetPhoneNumberInfoSyncRequest) GetLanguageCode() (value string) { - if g == nil { - return - } - return g.LanguageCode -} - -// GetPhoneNumberPrefix returns value of PhoneNumberPrefix field. -func (g *GetPhoneNumberInfoSyncRequest) GetPhoneNumberPrefix() (value string) { - if g == nil { - return - } - return g.PhoneNumberPrefix -} - -// GetPhoneNumberInfoSync invokes method getPhoneNumberInfoSync#209b7d38 returning error if any. -func (c *Client) GetPhoneNumberInfoSync(ctx context.Context, request *GetPhoneNumberInfoSyncRequest) (*PhoneNumberInfo, error) { - var result PhoneNumberInfo - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_poll_voters_gen.go b/tdapi/tl_get_poll_voters_gen.go deleted file mode 100644 index 75023ab1c..000000000 --- a/tdapi/tl_get_poll_voters_gen.go +++ /dev/null @@ -1,342 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPollVotersRequest represents TL type `getPollVoters#c45ba9ac`. -type GetPollVotersRequest struct { - // Identifier of the chat to which the poll belongs - ChatID int64 - // Identifier of the message containing the poll - MessageID int64 - // 0-based identifier of the answer option - OptionID int32 - // Number of voters to skip in the result; must be non-negative - Offset int32 - // The maximum number of voters to be returned; must be positive and can't be greater - // than 50. For optimal performance, the number of returned voters is chosen by TDLib and - // can be smaller than the specified limit, even if the end of the voter list has not - // been reached - Limit int32 -} - -// GetPollVotersRequestTypeID is TL type id of GetPollVotersRequest. -const GetPollVotersRequestTypeID = 0xc45ba9ac - -// Ensuring interfaces in compile-time for GetPollVotersRequest. -var ( - _ bin.Encoder = &GetPollVotersRequest{} - _ bin.Decoder = &GetPollVotersRequest{} - _ bin.BareEncoder = &GetPollVotersRequest{} - _ bin.BareDecoder = &GetPollVotersRequest{} -) - -func (g *GetPollVotersRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - if !(g.OptionID == 0) { - return false - } - if !(g.Offset == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPollVotersRequest) String() string { - if g == nil { - return "GetPollVotersRequest(nil)" - } - type Alias GetPollVotersRequest - return fmt.Sprintf("GetPollVotersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPollVotersRequest) TypeID() uint32 { - return GetPollVotersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPollVotersRequest) TypeName() string { - return "getPollVoters" -} - -// TypeInfo returns info about TL type. -func (g *GetPollVotersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPollVoters", - ID: GetPollVotersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "OptionID", - SchemaName: "option_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPollVotersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPollVoters#c45ba9ac as nil") - } - b.PutID(GetPollVotersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPollVotersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPollVoters#c45ba9ac as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - b.PutInt32(g.OptionID) - b.PutInt32(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPollVotersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPollVoters#c45ba9ac to nil") - } - if err := b.ConsumeID(GetPollVotersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPollVotersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPollVoters#c45ba9ac to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: field message_id: %w", err) - } - g.MessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: field option_id: %w", err) - } - g.OptionID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPollVotersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPollVoters#c45ba9ac as nil") - } - b.ObjStart() - b.PutID("getPollVoters") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.FieldStart("option_id") - b.PutInt32(g.OptionID) - b.Comma() - b.FieldStart("offset") - b.PutInt32(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPollVotersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPollVoters#c45ba9ac to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPollVoters"); err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: field message_id: %w", err) - } - g.MessageID = value - case "option_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: field option_id: %w", err) - } - g.OptionID = value - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPollVoters#c45ba9ac: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetPollVotersRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetPollVotersRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetOptionID returns value of OptionID field. -func (g *GetPollVotersRequest) GetOptionID() (value int32) { - if g == nil { - return - } - return g.OptionID -} - -// GetOffset returns value of Offset field. -func (g *GetPollVotersRequest) GetOffset() (value int32) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetPollVotersRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetPollVoters invokes method getPollVoters#c45ba9ac returning error if any. -func (c *Client) GetPollVoters(ctx context.Context, request *GetPollVotersRequest) (*MessageSenders, error) { - var result MessageSenders - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_preferred_country_language_gen.go b/tdapi/tl_get_preferred_country_language_gen.go deleted file mode 100644 index 3c6edead7..000000000 --- a/tdapi/tl_get_preferred_country_language_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPreferredCountryLanguageRequest represents TL type `getPreferredCountryLanguage#c862cbd6`. -type GetPreferredCountryLanguageRequest struct { - // A two-letter ISO 3166-1 alpha-2 country code - CountryCode string -} - -// GetPreferredCountryLanguageRequestTypeID is TL type id of GetPreferredCountryLanguageRequest. -const GetPreferredCountryLanguageRequestTypeID = 0xc862cbd6 - -// Ensuring interfaces in compile-time for GetPreferredCountryLanguageRequest. -var ( - _ bin.Encoder = &GetPreferredCountryLanguageRequest{} - _ bin.Decoder = &GetPreferredCountryLanguageRequest{} - _ bin.BareEncoder = &GetPreferredCountryLanguageRequest{} - _ bin.BareDecoder = &GetPreferredCountryLanguageRequest{} -) - -func (g *GetPreferredCountryLanguageRequest) Zero() bool { - if g == nil { - return true - } - if !(g.CountryCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPreferredCountryLanguageRequest) String() string { - if g == nil { - return "GetPreferredCountryLanguageRequest(nil)" - } - type Alias GetPreferredCountryLanguageRequest - return fmt.Sprintf("GetPreferredCountryLanguageRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPreferredCountryLanguageRequest) TypeID() uint32 { - return GetPreferredCountryLanguageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPreferredCountryLanguageRequest) TypeName() string { - return "getPreferredCountryLanguage" -} - -// TypeInfo returns info about TL type. -func (g *GetPreferredCountryLanguageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPreferredCountryLanguage", - ID: GetPreferredCountryLanguageRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CountryCode", - SchemaName: "country_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPreferredCountryLanguageRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPreferredCountryLanguage#c862cbd6 as nil") - } - b.PutID(GetPreferredCountryLanguageRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPreferredCountryLanguageRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPreferredCountryLanguage#c862cbd6 as nil") - } - b.PutString(g.CountryCode) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPreferredCountryLanguageRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPreferredCountryLanguage#c862cbd6 to nil") - } - if err := b.ConsumeID(GetPreferredCountryLanguageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPreferredCountryLanguage#c862cbd6: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPreferredCountryLanguageRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPreferredCountryLanguage#c862cbd6 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPreferredCountryLanguage#c862cbd6: field country_code: %w", err) - } - g.CountryCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPreferredCountryLanguageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPreferredCountryLanguage#c862cbd6 as nil") - } - b.ObjStart() - b.PutID("getPreferredCountryLanguage") - b.Comma() - b.FieldStart("country_code") - b.PutString(g.CountryCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPreferredCountryLanguageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPreferredCountryLanguage#c862cbd6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPreferredCountryLanguage"); err != nil { - return fmt.Errorf("unable to decode getPreferredCountryLanguage#c862cbd6: %w", err) - } - case "country_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPreferredCountryLanguage#c862cbd6: field country_code: %w", err) - } - g.CountryCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCountryCode returns value of CountryCode field. -func (g *GetPreferredCountryLanguageRequest) GetCountryCode() (value string) { - if g == nil { - return - } - return g.CountryCode -} - -// GetPreferredCountryLanguage invokes method getPreferredCountryLanguage#c862cbd6 returning error if any. -func (c *Client) GetPreferredCountryLanguage(ctx context.Context, countrycode string) (*Text, error) { - var result Text - - request := &GetPreferredCountryLanguageRequest{ - CountryCode: countrycode, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_premium_features_gen.go b/tdapi/tl_get_premium_features_gen.go deleted file mode 100644 index 5b51df5d2..000000000 --- a/tdapi/tl_get_premium_features_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPremiumFeaturesRequest represents TL type `getPremiumFeatures#b4dc2649`. -type GetPremiumFeaturesRequest struct { - // Source of the request; pass null if the method is called from some non-standard source - Source PremiumSourceClass -} - -// GetPremiumFeaturesRequestTypeID is TL type id of GetPremiumFeaturesRequest. -const GetPremiumFeaturesRequestTypeID = 0xb4dc2649 - -// Ensuring interfaces in compile-time for GetPremiumFeaturesRequest. -var ( - _ bin.Encoder = &GetPremiumFeaturesRequest{} - _ bin.Decoder = &GetPremiumFeaturesRequest{} - _ bin.BareEncoder = &GetPremiumFeaturesRequest{} - _ bin.BareDecoder = &GetPremiumFeaturesRequest{} -) - -func (g *GetPremiumFeaturesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Source == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPremiumFeaturesRequest) String() string { - if g == nil { - return "GetPremiumFeaturesRequest(nil)" - } - type Alias GetPremiumFeaturesRequest - return fmt.Sprintf("GetPremiumFeaturesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPremiumFeaturesRequest) TypeID() uint32 { - return GetPremiumFeaturesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPremiumFeaturesRequest) TypeName() string { - return "getPremiumFeatures" -} - -// TypeInfo returns info about TL type. -func (g *GetPremiumFeaturesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPremiumFeatures", - ID: GetPremiumFeaturesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Source", - SchemaName: "source", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPremiumFeaturesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumFeatures#b4dc2649 as nil") - } - b.PutID(GetPremiumFeaturesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPremiumFeaturesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumFeatures#b4dc2649 as nil") - } - if g.Source == nil { - return fmt.Errorf("unable to encode getPremiumFeatures#b4dc2649: field source is nil") - } - if err := g.Source.Encode(b); err != nil { - return fmt.Errorf("unable to encode getPremiumFeatures#b4dc2649: field source: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPremiumFeaturesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumFeatures#b4dc2649 to nil") - } - if err := b.ConsumeID(GetPremiumFeaturesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPremiumFeatures#b4dc2649: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPremiumFeaturesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumFeatures#b4dc2649 to nil") - } - { - value, err := DecodePremiumSource(b) - if err != nil { - return fmt.Errorf("unable to decode getPremiumFeatures#b4dc2649: field source: %w", err) - } - g.Source = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPremiumFeaturesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumFeatures#b4dc2649 as nil") - } - b.ObjStart() - b.PutID("getPremiumFeatures") - b.Comma() - b.FieldStart("source") - if g.Source == nil { - return fmt.Errorf("unable to encode getPremiumFeatures#b4dc2649: field source is nil") - } - if err := g.Source.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getPremiumFeatures#b4dc2649: field source: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPremiumFeaturesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumFeatures#b4dc2649 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPremiumFeatures"); err != nil { - return fmt.Errorf("unable to decode getPremiumFeatures#b4dc2649: %w", err) - } - case "source": - value, err := DecodeTDLibJSONPremiumSource(b) - if err != nil { - return fmt.Errorf("unable to decode getPremiumFeatures#b4dc2649: field source: %w", err) - } - g.Source = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSource returns value of Source field. -func (g *GetPremiumFeaturesRequest) GetSource() (value PremiumSourceClass) { - if g == nil { - return - } - return g.Source -} - -// GetPremiumFeatures invokes method getPremiumFeatures#b4dc2649 returning error if any. -func (c *Client) GetPremiumFeatures(ctx context.Context, source PremiumSourceClass) (*PremiumFeatures, error) { - var result PremiumFeatures - - request := &GetPremiumFeaturesRequest{ - Source: source, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_premium_gift_code_payment_options_gen.go b/tdapi/tl_get_premium_gift_code_payment_options_gen.go deleted file mode 100644 index 9a1fdb371..000000000 --- a/tdapi/tl_get_premium_gift_code_payment_options_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPremiumGiftCodePaymentOptionsRequest represents TL type `getPremiumGiftCodePaymentOptions#89523a2c`. -type GetPremiumGiftCodePaymentOptionsRequest struct { - // Identifier of the supergroup or channel chat, which will be automatically boosted by - // receivers of the gift codes and which is administered by the user; 0 if none - BoostedChatID int64 -} - -// GetPremiumGiftCodePaymentOptionsRequestTypeID is TL type id of GetPremiumGiftCodePaymentOptionsRequest. -const GetPremiumGiftCodePaymentOptionsRequestTypeID = 0x89523a2c - -// Ensuring interfaces in compile-time for GetPremiumGiftCodePaymentOptionsRequest. -var ( - _ bin.Encoder = &GetPremiumGiftCodePaymentOptionsRequest{} - _ bin.Decoder = &GetPremiumGiftCodePaymentOptionsRequest{} - _ bin.BareEncoder = &GetPremiumGiftCodePaymentOptionsRequest{} - _ bin.BareDecoder = &GetPremiumGiftCodePaymentOptionsRequest{} -) - -func (g *GetPremiumGiftCodePaymentOptionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BoostedChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPremiumGiftCodePaymentOptionsRequest) String() string { - if g == nil { - return "GetPremiumGiftCodePaymentOptionsRequest(nil)" - } - type Alias GetPremiumGiftCodePaymentOptionsRequest - return fmt.Sprintf("GetPremiumGiftCodePaymentOptionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPremiumGiftCodePaymentOptionsRequest) TypeID() uint32 { - return GetPremiumGiftCodePaymentOptionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPremiumGiftCodePaymentOptionsRequest) TypeName() string { - return "getPremiumGiftCodePaymentOptions" -} - -// TypeInfo returns info about TL type. -func (g *GetPremiumGiftCodePaymentOptionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPremiumGiftCodePaymentOptions", - ID: GetPremiumGiftCodePaymentOptionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BoostedChatID", - SchemaName: "boosted_chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPremiumGiftCodePaymentOptionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumGiftCodePaymentOptions#89523a2c as nil") - } - b.PutID(GetPremiumGiftCodePaymentOptionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPremiumGiftCodePaymentOptionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumGiftCodePaymentOptions#89523a2c as nil") - } - b.PutInt53(g.BoostedChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPremiumGiftCodePaymentOptionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumGiftCodePaymentOptions#89523a2c to nil") - } - if err := b.ConsumeID(GetPremiumGiftCodePaymentOptionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPremiumGiftCodePaymentOptions#89523a2c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPremiumGiftCodePaymentOptionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumGiftCodePaymentOptions#89523a2c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPremiumGiftCodePaymentOptions#89523a2c: field boosted_chat_id: %w", err) - } - g.BoostedChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPremiumGiftCodePaymentOptionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumGiftCodePaymentOptions#89523a2c as nil") - } - b.ObjStart() - b.PutID("getPremiumGiftCodePaymentOptions") - b.Comma() - b.FieldStart("boosted_chat_id") - b.PutInt53(g.BoostedChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPremiumGiftCodePaymentOptionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumGiftCodePaymentOptions#89523a2c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPremiumGiftCodePaymentOptions"); err != nil { - return fmt.Errorf("unable to decode getPremiumGiftCodePaymentOptions#89523a2c: %w", err) - } - case "boosted_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPremiumGiftCodePaymentOptions#89523a2c: field boosted_chat_id: %w", err) - } - g.BoostedChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBoostedChatID returns value of BoostedChatID field. -func (g *GetPremiumGiftCodePaymentOptionsRequest) GetBoostedChatID() (value int64) { - if g == nil { - return - } - return g.BoostedChatID -} - -// GetPremiumGiftCodePaymentOptions invokes method getPremiumGiftCodePaymentOptions#89523a2c returning error if any. -func (c *Client) GetPremiumGiftCodePaymentOptions(ctx context.Context, boostedchatid int64) (*PremiumGiftCodePaymentOptions, error) { - var result PremiumGiftCodePaymentOptions - - request := &GetPremiumGiftCodePaymentOptionsRequest{ - BoostedChatID: boostedchatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_premium_info_sticker_gen.go b/tdapi/tl_get_premium_info_sticker_gen.go deleted file mode 100644 index 0cc436596..000000000 --- a/tdapi/tl_get_premium_info_sticker_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPremiumInfoStickerRequest represents TL type `getPremiumInfoSticker#79ce4a9b`. -type GetPremiumInfoStickerRequest struct { - // Number of months the Telegram Premium subscription will be active - MonthCount int32 -} - -// GetPremiumInfoStickerRequestTypeID is TL type id of GetPremiumInfoStickerRequest. -const GetPremiumInfoStickerRequestTypeID = 0x79ce4a9b - -// Ensuring interfaces in compile-time for GetPremiumInfoStickerRequest. -var ( - _ bin.Encoder = &GetPremiumInfoStickerRequest{} - _ bin.Decoder = &GetPremiumInfoStickerRequest{} - _ bin.BareEncoder = &GetPremiumInfoStickerRequest{} - _ bin.BareDecoder = &GetPremiumInfoStickerRequest{} -) - -func (g *GetPremiumInfoStickerRequest) Zero() bool { - if g == nil { - return true - } - if !(g.MonthCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPremiumInfoStickerRequest) String() string { - if g == nil { - return "GetPremiumInfoStickerRequest(nil)" - } - type Alias GetPremiumInfoStickerRequest - return fmt.Sprintf("GetPremiumInfoStickerRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPremiumInfoStickerRequest) TypeID() uint32 { - return GetPremiumInfoStickerRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPremiumInfoStickerRequest) TypeName() string { - return "getPremiumInfoSticker" -} - -// TypeInfo returns info about TL type. -func (g *GetPremiumInfoStickerRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPremiumInfoSticker", - ID: GetPremiumInfoStickerRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MonthCount", - SchemaName: "month_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPremiumInfoStickerRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumInfoSticker#79ce4a9b as nil") - } - b.PutID(GetPremiumInfoStickerRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPremiumInfoStickerRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumInfoSticker#79ce4a9b as nil") - } - b.PutInt32(g.MonthCount) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPremiumInfoStickerRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumInfoSticker#79ce4a9b to nil") - } - if err := b.ConsumeID(GetPremiumInfoStickerRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPremiumInfoSticker#79ce4a9b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPremiumInfoStickerRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumInfoSticker#79ce4a9b to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPremiumInfoSticker#79ce4a9b: field month_count: %w", err) - } - g.MonthCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPremiumInfoStickerRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumInfoSticker#79ce4a9b as nil") - } - b.ObjStart() - b.PutID("getPremiumInfoSticker") - b.Comma() - b.FieldStart("month_count") - b.PutInt32(g.MonthCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPremiumInfoStickerRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumInfoSticker#79ce4a9b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPremiumInfoSticker"); err != nil { - return fmt.Errorf("unable to decode getPremiumInfoSticker#79ce4a9b: %w", err) - } - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPremiumInfoSticker#79ce4a9b: field month_count: %w", err) - } - g.MonthCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMonthCount returns value of MonthCount field. -func (g *GetPremiumInfoStickerRequest) GetMonthCount() (value int32) { - if g == nil { - return - } - return g.MonthCount -} - -// GetPremiumInfoSticker invokes method getPremiumInfoSticker#79ce4a9b returning error if any. -func (c *Client) GetPremiumInfoSticker(ctx context.Context, monthcount int32) (*Sticker, error) { - var result Sticker - - request := &GetPremiumInfoStickerRequest{ - MonthCount: monthcount, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_premium_limit_gen.go b/tdapi/tl_get_premium_limit_gen.go deleted file mode 100644 index 52218d456..000000000 --- a/tdapi/tl_get_premium_limit_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPremiumLimitRequest represents TL type `getPremiumLimit#4017fcea`. -type GetPremiumLimitRequest struct { - // Type of the limit - LimitType PremiumLimitTypeClass -} - -// GetPremiumLimitRequestTypeID is TL type id of GetPremiumLimitRequest. -const GetPremiumLimitRequestTypeID = 0x4017fcea - -// Ensuring interfaces in compile-time for GetPremiumLimitRequest. -var ( - _ bin.Encoder = &GetPremiumLimitRequest{} - _ bin.Decoder = &GetPremiumLimitRequest{} - _ bin.BareEncoder = &GetPremiumLimitRequest{} - _ bin.BareDecoder = &GetPremiumLimitRequest{} -) - -func (g *GetPremiumLimitRequest) Zero() bool { - if g == nil { - return true - } - if !(g.LimitType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPremiumLimitRequest) String() string { - if g == nil { - return "GetPremiumLimitRequest(nil)" - } - type Alias GetPremiumLimitRequest - return fmt.Sprintf("GetPremiumLimitRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPremiumLimitRequest) TypeID() uint32 { - return GetPremiumLimitRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPremiumLimitRequest) TypeName() string { - return "getPremiumLimit" -} - -// TypeInfo returns info about TL type. -func (g *GetPremiumLimitRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPremiumLimit", - ID: GetPremiumLimitRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LimitType", - SchemaName: "limit_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPremiumLimitRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumLimit#4017fcea as nil") - } - b.PutID(GetPremiumLimitRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPremiumLimitRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumLimit#4017fcea as nil") - } - if g.LimitType == nil { - return fmt.Errorf("unable to encode getPremiumLimit#4017fcea: field limit_type is nil") - } - if err := g.LimitType.Encode(b); err != nil { - return fmt.Errorf("unable to encode getPremiumLimit#4017fcea: field limit_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPremiumLimitRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumLimit#4017fcea to nil") - } - if err := b.ConsumeID(GetPremiumLimitRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPremiumLimit#4017fcea: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPremiumLimitRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumLimit#4017fcea to nil") - } - { - value, err := DecodePremiumLimitType(b) - if err != nil { - return fmt.Errorf("unable to decode getPremiumLimit#4017fcea: field limit_type: %w", err) - } - g.LimitType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPremiumLimitRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumLimit#4017fcea as nil") - } - b.ObjStart() - b.PutID("getPremiumLimit") - b.Comma() - b.FieldStart("limit_type") - if g.LimitType == nil { - return fmt.Errorf("unable to encode getPremiumLimit#4017fcea: field limit_type is nil") - } - if err := g.LimitType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getPremiumLimit#4017fcea: field limit_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPremiumLimitRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumLimit#4017fcea to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPremiumLimit"); err != nil { - return fmt.Errorf("unable to decode getPremiumLimit#4017fcea: %w", err) - } - case "limit_type": - value, err := DecodeTDLibJSONPremiumLimitType(b) - if err != nil { - return fmt.Errorf("unable to decode getPremiumLimit#4017fcea: field limit_type: %w", err) - } - g.LimitType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLimitType returns value of LimitType field. -func (g *GetPremiumLimitRequest) GetLimitType() (value PremiumLimitTypeClass) { - if g == nil { - return - } - return g.LimitType -} - -// GetPremiumLimit invokes method getPremiumLimit#4017fcea returning error if any. -func (c *Client) GetPremiumLimit(ctx context.Context, limittype PremiumLimitTypeClass) (*PremiumLimit, error) { - var result PremiumLimit - - request := &GetPremiumLimitRequest{ - LimitType: limittype, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_premium_state_gen.go b/tdapi/tl_get_premium_state_gen.go deleted file mode 100644 index 8d056a826..000000000 --- a/tdapi/tl_get_premium_state_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPremiumStateRequest represents TL type `getPremiumState#278e3ae2`. -type GetPremiumStateRequest struct { -} - -// GetPremiumStateRequestTypeID is TL type id of GetPremiumStateRequest. -const GetPremiumStateRequestTypeID = 0x278e3ae2 - -// Ensuring interfaces in compile-time for GetPremiumStateRequest. -var ( - _ bin.Encoder = &GetPremiumStateRequest{} - _ bin.Decoder = &GetPremiumStateRequest{} - _ bin.BareEncoder = &GetPremiumStateRequest{} - _ bin.BareDecoder = &GetPremiumStateRequest{} -) - -func (g *GetPremiumStateRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPremiumStateRequest) String() string { - if g == nil { - return "GetPremiumStateRequest(nil)" - } - type Alias GetPremiumStateRequest - return fmt.Sprintf("GetPremiumStateRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPremiumStateRequest) TypeID() uint32 { - return GetPremiumStateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPremiumStateRequest) TypeName() string { - return "getPremiumState" -} - -// TypeInfo returns info about TL type. -func (g *GetPremiumStateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPremiumState", - ID: GetPremiumStateRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPremiumStateRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumState#278e3ae2 as nil") - } - b.PutID(GetPremiumStateRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPremiumStateRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumState#278e3ae2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPremiumStateRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumState#278e3ae2 to nil") - } - if err := b.ConsumeID(GetPremiumStateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPremiumState#278e3ae2: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPremiumStateRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumState#278e3ae2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPremiumStateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumState#278e3ae2 as nil") - } - b.ObjStart() - b.PutID("getPremiumState") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPremiumStateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumState#278e3ae2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPremiumState"); err != nil { - return fmt.Errorf("unable to decode getPremiumState#278e3ae2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPremiumState invokes method getPremiumState#278e3ae2 returning error if any. -func (c *Client) GetPremiumState(ctx context.Context) (*PremiumState, error) { - var result PremiumState - - request := &GetPremiumStateRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_premium_sticker_examples_gen.go b/tdapi/tl_get_premium_sticker_examples_gen.go deleted file mode 100644 index 5df4fdbbf..000000000 --- a/tdapi/tl_get_premium_sticker_examples_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPremiumStickerExamplesRequest represents TL type `getPremiumStickerExamples#5369cb98`. -type GetPremiumStickerExamplesRequest struct { -} - -// GetPremiumStickerExamplesRequestTypeID is TL type id of GetPremiumStickerExamplesRequest. -const GetPremiumStickerExamplesRequestTypeID = 0x5369cb98 - -// Ensuring interfaces in compile-time for GetPremiumStickerExamplesRequest. -var ( - _ bin.Encoder = &GetPremiumStickerExamplesRequest{} - _ bin.Decoder = &GetPremiumStickerExamplesRequest{} - _ bin.BareEncoder = &GetPremiumStickerExamplesRequest{} - _ bin.BareDecoder = &GetPremiumStickerExamplesRequest{} -) - -func (g *GetPremiumStickerExamplesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPremiumStickerExamplesRequest) String() string { - if g == nil { - return "GetPremiumStickerExamplesRequest(nil)" - } - type Alias GetPremiumStickerExamplesRequest - return fmt.Sprintf("GetPremiumStickerExamplesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPremiumStickerExamplesRequest) TypeID() uint32 { - return GetPremiumStickerExamplesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPremiumStickerExamplesRequest) TypeName() string { - return "getPremiumStickerExamples" -} - -// TypeInfo returns info about TL type. -func (g *GetPremiumStickerExamplesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPremiumStickerExamples", - ID: GetPremiumStickerExamplesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPremiumStickerExamplesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumStickerExamples#5369cb98 as nil") - } - b.PutID(GetPremiumStickerExamplesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPremiumStickerExamplesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumStickerExamples#5369cb98 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPremiumStickerExamplesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumStickerExamples#5369cb98 to nil") - } - if err := b.ConsumeID(GetPremiumStickerExamplesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPremiumStickerExamples#5369cb98: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPremiumStickerExamplesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumStickerExamples#5369cb98 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPremiumStickerExamplesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumStickerExamples#5369cb98 as nil") - } - b.ObjStart() - b.PutID("getPremiumStickerExamples") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPremiumStickerExamplesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumStickerExamples#5369cb98 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPremiumStickerExamples"); err != nil { - return fmt.Errorf("unable to decode getPremiumStickerExamples#5369cb98: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPremiumStickerExamples invokes method getPremiumStickerExamples#5369cb98 returning error if any. -func (c *Client) GetPremiumStickerExamples(ctx context.Context) (*Stickers, error) { - var result Stickers - - request := &GetPremiumStickerExamplesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_premium_stickers_gen.go b/tdapi/tl_get_premium_stickers_gen.go deleted file mode 100644 index 4bda506f3..000000000 --- a/tdapi/tl_get_premium_stickers_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPremiumStickersRequest represents TL type `getPremiumStickers#ef410a50`. -type GetPremiumStickersRequest struct { - // The maximum number of stickers to be returned; 0-100 - Limit int32 -} - -// GetPremiumStickersRequestTypeID is TL type id of GetPremiumStickersRequest. -const GetPremiumStickersRequestTypeID = 0xef410a50 - -// Ensuring interfaces in compile-time for GetPremiumStickersRequest. -var ( - _ bin.Encoder = &GetPremiumStickersRequest{} - _ bin.Decoder = &GetPremiumStickersRequest{} - _ bin.BareEncoder = &GetPremiumStickersRequest{} - _ bin.BareDecoder = &GetPremiumStickersRequest{} -) - -func (g *GetPremiumStickersRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPremiumStickersRequest) String() string { - if g == nil { - return "GetPremiumStickersRequest(nil)" - } - type Alias GetPremiumStickersRequest - return fmt.Sprintf("GetPremiumStickersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPremiumStickersRequest) TypeID() uint32 { - return GetPremiumStickersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPremiumStickersRequest) TypeName() string { - return "getPremiumStickers" -} - -// TypeInfo returns info about TL type. -func (g *GetPremiumStickersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPremiumStickers", - ID: GetPremiumStickersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPremiumStickersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumStickers#ef410a50 as nil") - } - b.PutID(GetPremiumStickersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPremiumStickersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumStickers#ef410a50 as nil") - } - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPremiumStickersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumStickers#ef410a50 to nil") - } - if err := b.ConsumeID(GetPremiumStickersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPremiumStickers#ef410a50: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPremiumStickersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumStickers#ef410a50 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPremiumStickers#ef410a50: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPremiumStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPremiumStickers#ef410a50 as nil") - } - b.ObjStart() - b.PutID("getPremiumStickers") - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPremiumStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPremiumStickers#ef410a50 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPremiumStickers"); err != nil { - return fmt.Errorf("unable to decode getPremiumStickers#ef410a50: %w", err) - } - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getPremiumStickers#ef410a50: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLimit returns value of Limit field. -func (g *GetPremiumStickersRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetPremiumStickers invokes method getPremiumStickers#ef410a50 returning error if any. -func (c *Client) GetPremiumStickers(ctx context.Context, limit int32) (*Stickers, error) { - var result Stickers - - request := &GetPremiumStickersRequest{ - Limit: limit, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_prepared_inline_message_gen.go b/tdapi/tl_get_prepared_inline_message_gen.go deleted file mode 100644 index b438d25d5..000000000 --- a/tdapi/tl_get_prepared_inline_message_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPreparedInlineMessageRequest represents TL type `getPreparedInlineMessage#fb0ac74b`. -type GetPreparedInlineMessageRequest struct { - // Identifier of the bot that created the message - BotUserID int64 - // Identifier of the prepared message - PreparedMessageID string -} - -// GetPreparedInlineMessageRequestTypeID is TL type id of GetPreparedInlineMessageRequest. -const GetPreparedInlineMessageRequestTypeID = 0xfb0ac74b - -// Ensuring interfaces in compile-time for GetPreparedInlineMessageRequest. -var ( - _ bin.Encoder = &GetPreparedInlineMessageRequest{} - _ bin.Decoder = &GetPreparedInlineMessageRequest{} - _ bin.BareEncoder = &GetPreparedInlineMessageRequest{} - _ bin.BareDecoder = &GetPreparedInlineMessageRequest{} -) - -func (g *GetPreparedInlineMessageRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BotUserID == 0) { - return false - } - if !(g.PreparedMessageID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPreparedInlineMessageRequest) String() string { - if g == nil { - return "GetPreparedInlineMessageRequest(nil)" - } - type Alias GetPreparedInlineMessageRequest - return fmt.Sprintf("GetPreparedInlineMessageRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPreparedInlineMessageRequest) TypeID() uint32 { - return GetPreparedInlineMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPreparedInlineMessageRequest) TypeName() string { - return "getPreparedInlineMessage" -} - -// TypeInfo returns info about TL type. -func (g *GetPreparedInlineMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPreparedInlineMessage", - ID: GetPreparedInlineMessageRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "PreparedMessageID", - SchemaName: "prepared_message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPreparedInlineMessageRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPreparedInlineMessage#fb0ac74b as nil") - } - b.PutID(GetPreparedInlineMessageRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPreparedInlineMessageRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPreparedInlineMessage#fb0ac74b as nil") - } - b.PutInt53(g.BotUserID) - b.PutString(g.PreparedMessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPreparedInlineMessageRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPreparedInlineMessage#fb0ac74b to nil") - } - if err := b.ConsumeID(GetPreparedInlineMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPreparedInlineMessage#fb0ac74b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPreparedInlineMessageRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPreparedInlineMessage#fb0ac74b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPreparedInlineMessage#fb0ac74b: field bot_user_id: %w", err) - } - g.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPreparedInlineMessage#fb0ac74b: field prepared_message_id: %w", err) - } - g.PreparedMessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPreparedInlineMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPreparedInlineMessage#fb0ac74b as nil") - } - b.ObjStart() - b.PutID("getPreparedInlineMessage") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.FieldStart("prepared_message_id") - b.PutString(g.PreparedMessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPreparedInlineMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPreparedInlineMessage#fb0ac74b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPreparedInlineMessage"); err != nil { - return fmt.Errorf("unable to decode getPreparedInlineMessage#fb0ac74b: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getPreparedInlineMessage#fb0ac74b: field bot_user_id: %w", err) - } - g.BotUserID = value - case "prepared_message_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPreparedInlineMessage#fb0ac74b: field prepared_message_id: %w", err) - } - g.PreparedMessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetPreparedInlineMessageRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetPreparedMessageID returns value of PreparedMessageID field. -func (g *GetPreparedInlineMessageRequest) GetPreparedMessageID() (value string) { - if g == nil { - return - } - return g.PreparedMessageID -} - -// GetPreparedInlineMessage invokes method getPreparedInlineMessage#fb0ac74b returning error if any. -func (c *Client) GetPreparedInlineMessage(ctx context.Context, request *GetPreparedInlineMessageRequest) (*PreparedInlineMessage, error) { - var result PreparedInlineMessage - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_proxies_gen.go b/tdapi/tl_get_proxies_gen.go deleted file mode 100644 index bddf084ed..000000000 --- a/tdapi/tl_get_proxies_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetProxiesRequest represents TL type `getProxies#fa560333`. -type GetProxiesRequest struct { -} - -// GetProxiesRequestTypeID is TL type id of GetProxiesRequest. -const GetProxiesRequestTypeID = 0xfa560333 - -// Ensuring interfaces in compile-time for GetProxiesRequest. -var ( - _ bin.Encoder = &GetProxiesRequest{} - _ bin.Decoder = &GetProxiesRequest{} - _ bin.BareEncoder = &GetProxiesRequest{} - _ bin.BareDecoder = &GetProxiesRequest{} -) - -func (g *GetProxiesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetProxiesRequest) String() string { - if g == nil { - return "GetProxiesRequest(nil)" - } - type Alias GetProxiesRequest - return fmt.Sprintf("GetProxiesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetProxiesRequest) TypeID() uint32 { - return GetProxiesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetProxiesRequest) TypeName() string { - return "getProxies" -} - -// TypeInfo returns info about TL type. -func (g *GetProxiesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getProxies", - ID: GetProxiesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetProxiesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getProxies#fa560333 as nil") - } - b.PutID(GetProxiesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetProxiesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getProxies#fa560333 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetProxiesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getProxies#fa560333 to nil") - } - if err := b.ConsumeID(GetProxiesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getProxies#fa560333: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetProxiesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getProxies#fa560333 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetProxiesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getProxies#fa560333 as nil") - } - b.ObjStart() - b.PutID("getProxies") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetProxiesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getProxies#fa560333 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getProxies"); err != nil { - return fmt.Errorf("unable to decode getProxies#fa560333: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetProxies invokes method getProxies#fa560333 returning error if any. -func (c *Client) GetProxies(ctx context.Context) (*Proxies, error) { - var result Proxies - - request := &GetProxiesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_proxy_link_gen.go b/tdapi/tl_get_proxy_link_gen.go deleted file mode 100644 index 3f48eb806..000000000 --- a/tdapi/tl_get_proxy_link_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetProxyLinkRequest represents TL type `getProxyLink#c125ae78`. -type GetProxyLinkRequest struct { - // Proxy identifier - ProxyID int32 -} - -// GetProxyLinkRequestTypeID is TL type id of GetProxyLinkRequest. -const GetProxyLinkRequestTypeID = 0xc125ae78 - -// Ensuring interfaces in compile-time for GetProxyLinkRequest. -var ( - _ bin.Encoder = &GetProxyLinkRequest{} - _ bin.Decoder = &GetProxyLinkRequest{} - _ bin.BareEncoder = &GetProxyLinkRequest{} - _ bin.BareDecoder = &GetProxyLinkRequest{} -) - -func (g *GetProxyLinkRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ProxyID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetProxyLinkRequest) String() string { - if g == nil { - return "GetProxyLinkRequest(nil)" - } - type Alias GetProxyLinkRequest - return fmt.Sprintf("GetProxyLinkRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetProxyLinkRequest) TypeID() uint32 { - return GetProxyLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetProxyLinkRequest) TypeName() string { - return "getProxyLink" -} - -// TypeInfo returns info about TL type. -func (g *GetProxyLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getProxyLink", - ID: GetProxyLinkRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ProxyID", - SchemaName: "proxy_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetProxyLinkRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getProxyLink#c125ae78 as nil") - } - b.PutID(GetProxyLinkRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetProxyLinkRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getProxyLink#c125ae78 as nil") - } - b.PutInt32(g.ProxyID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetProxyLinkRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getProxyLink#c125ae78 to nil") - } - if err := b.ConsumeID(GetProxyLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getProxyLink#c125ae78: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetProxyLinkRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getProxyLink#c125ae78 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getProxyLink#c125ae78: field proxy_id: %w", err) - } - g.ProxyID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetProxyLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getProxyLink#c125ae78 as nil") - } - b.ObjStart() - b.PutID("getProxyLink") - b.Comma() - b.FieldStart("proxy_id") - b.PutInt32(g.ProxyID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetProxyLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getProxyLink#c125ae78 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getProxyLink"); err != nil { - return fmt.Errorf("unable to decode getProxyLink#c125ae78: %w", err) - } - case "proxy_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getProxyLink#c125ae78: field proxy_id: %w", err) - } - g.ProxyID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProxyID returns value of ProxyID field. -func (g *GetProxyLinkRequest) GetProxyID() (value int32) { - if g == nil { - return - } - return g.ProxyID -} - -// GetProxyLink invokes method getProxyLink#c125ae78 returning error if any. -func (c *Client) GetProxyLink(ctx context.Context, proxyid int32) (*HTTPURL, error) { - var result HTTPURL - - request := &GetProxyLinkRequest{ - ProxyID: proxyid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_push_receiver_id_gen.go b/tdapi/tl_get_push_receiver_id_gen.go deleted file mode 100644 index 8a4001351..000000000 --- a/tdapi/tl_get_push_receiver_id_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetPushReceiverIDRequest represents TL type `getPushReceiverId#eeec46b2`. -type GetPushReceiverIDRequest struct { - // JSON-encoded push notification payload - Payload string -} - -// GetPushReceiverIDRequestTypeID is TL type id of GetPushReceiverIDRequest. -const GetPushReceiverIDRequestTypeID = 0xeeec46b2 - -// Ensuring interfaces in compile-time for GetPushReceiverIDRequest. -var ( - _ bin.Encoder = &GetPushReceiverIDRequest{} - _ bin.Decoder = &GetPushReceiverIDRequest{} - _ bin.BareEncoder = &GetPushReceiverIDRequest{} - _ bin.BareDecoder = &GetPushReceiverIDRequest{} -) - -func (g *GetPushReceiverIDRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Payload == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetPushReceiverIDRequest) String() string { - if g == nil { - return "GetPushReceiverIDRequest(nil)" - } - type Alias GetPushReceiverIDRequest - return fmt.Sprintf("GetPushReceiverIDRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetPushReceiverIDRequest) TypeID() uint32 { - return GetPushReceiverIDRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetPushReceiverIDRequest) TypeName() string { - return "getPushReceiverId" -} - -// TypeInfo returns info about TL type. -func (g *GetPushReceiverIDRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getPushReceiverId", - ID: GetPushReceiverIDRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Payload", - SchemaName: "payload", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetPushReceiverIDRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPushReceiverId#eeec46b2 as nil") - } - b.PutID(GetPushReceiverIDRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetPushReceiverIDRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getPushReceiverId#eeec46b2 as nil") - } - b.PutString(g.Payload) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetPushReceiverIDRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPushReceiverId#eeec46b2 to nil") - } - if err := b.ConsumeID(GetPushReceiverIDRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getPushReceiverId#eeec46b2: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetPushReceiverIDRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getPushReceiverId#eeec46b2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPushReceiverId#eeec46b2: field payload: %w", err) - } - g.Payload = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetPushReceiverIDRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getPushReceiverId#eeec46b2 as nil") - } - b.ObjStart() - b.PutID("getPushReceiverId") - b.Comma() - b.FieldStart("payload") - b.PutString(g.Payload) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetPushReceiverIDRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getPushReceiverId#eeec46b2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getPushReceiverId"); err != nil { - return fmt.Errorf("unable to decode getPushReceiverId#eeec46b2: %w", err) - } - case "payload": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getPushReceiverId#eeec46b2: field payload: %w", err) - } - g.Payload = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPayload returns value of Payload field. -func (g *GetPushReceiverIDRequest) GetPayload() (value string) { - if g == nil { - return - } - return g.Payload -} - -// GetPushReceiverID invokes method getPushReceiverId#eeec46b2 returning error if any. -func (c *Client) GetPushReceiverID(ctx context.Context, payload string) (*PushReceiverID, error) { - var result PushReceiverID - - request := &GetPushReceiverIDRequest{ - Payload: payload, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_read_date_privacy_settings_gen.go b/tdapi/tl_get_read_date_privacy_settings_gen.go deleted file mode 100644 index dbf7038f2..000000000 --- a/tdapi/tl_get_read_date_privacy_settings_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetReadDatePrivacySettingsRequest represents TL type `getReadDatePrivacySettings#1ae85bbb`. -type GetReadDatePrivacySettingsRequest struct { -} - -// GetReadDatePrivacySettingsRequestTypeID is TL type id of GetReadDatePrivacySettingsRequest. -const GetReadDatePrivacySettingsRequestTypeID = 0x1ae85bbb - -// Ensuring interfaces in compile-time for GetReadDatePrivacySettingsRequest. -var ( - _ bin.Encoder = &GetReadDatePrivacySettingsRequest{} - _ bin.Decoder = &GetReadDatePrivacySettingsRequest{} - _ bin.BareEncoder = &GetReadDatePrivacySettingsRequest{} - _ bin.BareDecoder = &GetReadDatePrivacySettingsRequest{} -) - -func (g *GetReadDatePrivacySettingsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetReadDatePrivacySettingsRequest) String() string { - if g == nil { - return "GetReadDatePrivacySettingsRequest(nil)" - } - type Alias GetReadDatePrivacySettingsRequest - return fmt.Sprintf("GetReadDatePrivacySettingsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetReadDatePrivacySettingsRequest) TypeID() uint32 { - return GetReadDatePrivacySettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetReadDatePrivacySettingsRequest) TypeName() string { - return "getReadDatePrivacySettings" -} - -// TypeInfo returns info about TL type. -func (g *GetReadDatePrivacySettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getReadDatePrivacySettings", - ID: GetReadDatePrivacySettingsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetReadDatePrivacySettingsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getReadDatePrivacySettings#1ae85bbb as nil") - } - b.PutID(GetReadDatePrivacySettingsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetReadDatePrivacySettingsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getReadDatePrivacySettings#1ae85bbb as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetReadDatePrivacySettingsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getReadDatePrivacySettings#1ae85bbb to nil") - } - if err := b.ConsumeID(GetReadDatePrivacySettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getReadDatePrivacySettings#1ae85bbb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetReadDatePrivacySettingsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getReadDatePrivacySettings#1ae85bbb to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetReadDatePrivacySettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getReadDatePrivacySettings#1ae85bbb as nil") - } - b.ObjStart() - b.PutID("getReadDatePrivacySettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetReadDatePrivacySettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getReadDatePrivacySettings#1ae85bbb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getReadDatePrivacySettings"); err != nil { - return fmt.Errorf("unable to decode getReadDatePrivacySettings#1ae85bbb: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetReadDatePrivacySettings invokes method getReadDatePrivacySettings#1ae85bbb returning error if any. -func (c *Client) GetReadDatePrivacySettings(ctx context.Context) (*ReadDatePrivacySettings, error) { - var result ReadDatePrivacySettings - - request := &GetReadDatePrivacySettingsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_recent_emoji_statuses_gen.go b/tdapi/tl_get_recent_emoji_statuses_gen.go deleted file mode 100644 index 7a4191049..000000000 --- a/tdapi/tl_get_recent_emoji_statuses_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetRecentEmojiStatusesRequest represents TL type `getRecentEmojiStatuses#ae3a3d29`. -type GetRecentEmojiStatusesRequest struct { -} - -// GetRecentEmojiStatusesRequestTypeID is TL type id of GetRecentEmojiStatusesRequest. -const GetRecentEmojiStatusesRequestTypeID = 0xae3a3d29 - -// Ensuring interfaces in compile-time for GetRecentEmojiStatusesRequest. -var ( - _ bin.Encoder = &GetRecentEmojiStatusesRequest{} - _ bin.Decoder = &GetRecentEmojiStatusesRequest{} - _ bin.BareEncoder = &GetRecentEmojiStatusesRequest{} - _ bin.BareDecoder = &GetRecentEmojiStatusesRequest{} -) - -func (g *GetRecentEmojiStatusesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetRecentEmojiStatusesRequest) String() string { - if g == nil { - return "GetRecentEmojiStatusesRequest(nil)" - } - type Alias GetRecentEmojiStatusesRequest - return fmt.Sprintf("GetRecentEmojiStatusesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetRecentEmojiStatusesRequest) TypeID() uint32 { - return GetRecentEmojiStatusesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetRecentEmojiStatusesRequest) TypeName() string { - return "getRecentEmojiStatuses" -} - -// TypeInfo returns info about TL type. -func (g *GetRecentEmojiStatusesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getRecentEmojiStatuses", - ID: GetRecentEmojiStatusesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetRecentEmojiStatusesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecentEmojiStatuses#ae3a3d29 as nil") - } - b.PutID(GetRecentEmojiStatusesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetRecentEmojiStatusesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecentEmojiStatuses#ae3a3d29 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetRecentEmojiStatusesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecentEmojiStatuses#ae3a3d29 to nil") - } - if err := b.ConsumeID(GetRecentEmojiStatusesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getRecentEmojiStatuses#ae3a3d29: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetRecentEmojiStatusesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecentEmojiStatuses#ae3a3d29 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetRecentEmojiStatusesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getRecentEmojiStatuses#ae3a3d29 as nil") - } - b.ObjStart() - b.PutID("getRecentEmojiStatuses") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetRecentEmojiStatusesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getRecentEmojiStatuses#ae3a3d29 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getRecentEmojiStatuses"); err != nil { - return fmt.Errorf("unable to decode getRecentEmojiStatuses#ae3a3d29: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetRecentEmojiStatuses invokes method getRecentEmojiStatuses#ae3a3d29 returning error if any. -func (c *Client) GetRecentEmojiStatuses(ctx context.Context) (*EmojiStatuses, error) { - var result EmojiStatuses - - request := &GetRecentEmojiStatusesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_recent_inline_bots_gen.go b/tdapi/tl_get_recent_inline_bots_gen.go deleted file mode 100644 index 368fac43d..000000000 --- a/tdapi/tl_get_recent_inline_bots_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetRecentInlineBotsRequest represents TL type `getRecentInlineBots#55b3723c`. -type GetRecentInlineBotsRequest struct { -} - -// GetRecentInlineBotsRequestTypeID is TL type id of GetRecentInlineBotsRequest. -const GetRecentInlineBotsRequestTypeID = 0x55b3723c - -// Ensuring interfaces in compile-time for GetRecentInlineBotsRequest. -var ( - _ bin.Encoder = &GetRecentInlineBotsRequest{} - _ bin.Decoder = &GetRecentInlineBotsRequest{} - _ bin.BareEncoder = &GetRecentInlineBotsRequest{} - _ bin.BareDecoder = &GetRecentInlineBotsRequest{} -) - -func (g *GetRecentInlineBotsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetRecentInlineBotsRequest) String() string { - if g == nil { - return "GetRecentInlineBotsRequest(nil)" - } - type Alias GetRecentInlineBotsRequest - return fmt.Sprintf("GetRecentInlineBotsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetRecentInlineBotsRequest) TypeID() uint32 { - return GetRecentInlineBotsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetRecentInlineBotsRequest) TypeName() string { - return "getRecentInlineBots" -} - -// TypeInfo returns info about TL type. -func (g *GetRecentInlineBotsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getRecentInlineBots", - ID: GetRecentInlineBotsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetRecentInlineBotsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecentInlineBots#55b3723c as nil") - } - b.PutID(GetRecentInlineBotsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetRecentInlineBotsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecentInlineBots#55b3723c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetRecentInlineBotsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecentInlineBots#55b3723c to nil") - } - if err := b.ConsumeID(GetRecentInlineBotsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getRecentInlineBots#55b3723c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetRecentInlineBotsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecentInlineBots#55b3723c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetRecentInlineBotsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getRecentInlineBots#55b3723c as nil") - } - b.ObjStart() - b.PutID("getRecentInlineBots") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetRecentInlineBotsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getRecentInlineBots#55b3723c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getRecentInlineBots"); err != nil { - return fmt.Errorf("unable to decode getRecentInlineBots#55b3723c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetRecentInlineBots invokes method getRecentInlineBots#55b3723c returning error if any. -func (c *Client) GetRecentInlineBots(ctx context.Context) (*Users, error) { - var result Users - - request := &GetRecentInlineBotsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_recent_stickers_gen.go b/tdapi/tl_get_recent_stickers_gen.go deleted file mode 100644 index a3def5cb8..000000000 --- a/tdapi/tl_get_recent_stickers_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetRecentStickersRequest represents TL type `getRecentStickers#dd73aa9f`. -type GetRecentStickersRequest struct { - // Pass true to return stickers and masks that were recently attached to photos or video - // files; pass false to return recently sent stickers - IsAttached bool -} - -// GetRecentStickersRequestTypeID is TL type id of GetRecentStickersRequest. -const GetRecentStickersRequestTypeID = 0xdd73aa9f - -// Ensuring interfaces in compile-time for GetRecentStickersRequest. -var ( - _ bin.Encoder = &GetRecentStickersRequest{} - _ bin.Decoder = &GetRecentStickersRequest{} - _ bin.BareEncoder = &GetRecentStickersRequest{} - _ bin.BareDecoder = &GetRecentStickersRequest{} -) - -func (g *GetRecentStickersRequest) Zero() bool { - if g == nil { - return true - } - if !(g.IsAttached == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetRecentStickersRequest) String() string { - if g == nil { - return "GetRecentStickersRequest(nil)" - } - type Alias GetRecentStickersRequest - return fmt.Sprintf("GetRecentStickersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetRecentStickersRequest) TypeID() uint32 { - return GetRecentStickersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetRecentStickersRequest) TypeName() string { - return "getRecentStickers" -} - -// TypeInfo returns info about TL type. -func (g *GetRecentStickersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getRecentStickers", - ID: GetRecentStickersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsAttached", - SchemaName: "is_attached", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetRecentStickersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecentStickers#dd73aa9f as nil") - } - b.PutID(GetRecentStickersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetRecentStickersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecentStickers#dd73aa9f as nil") - } - b.PutBool(g.IsAttached) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetRecentStickersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecentStickers#dd73aa9f to nil") - } - if err := b.ConsumeID(GetRecentStickersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getRecentStickers#dd73aa9f: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetRecentStickersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecentStickers#dd73aa9f to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getRecentStickers#dd73aa9f: field is_attached: %w", err) - } - g.IsAttached = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetRecentStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getRecentStickers#dd73aa9f as nil") - } - b.ObjStart() - b.PutID("getRecentStickers") - b.Comma() - b.FieldStart("is_attached") - b.PutBool(g.IsAttached) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetRecentStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getRecentStickers#dd73aa9f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getRecentStickers"); err != nil { - return fmt.Errorf("unable to decode getRecentStickers#dd73aa9f: %w", err) - } - case "is_attached": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getRecentStickers#dd73aa9f: field is_attached: %w", err) - } - g.IsAttached = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsAttached returns value of IsAttached field. -func (g *GetRecentStickersRequest) GetIsAttached() (value bool) { - if g == nil { - return - } - return g.IsAttached -} - -// GetRecentStickers invokes method getRecentStickers#dd73aa9f returning error if any. -func (c *Client) GetRecentStickers(ctx context.Context, isattached bool) (*Stickers, error) { - var result Stickers - - request := &GetRecentStickersRequest{ - IsAttached: isattached, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_recently_opened_chats_gen.go b/tdapi/tl_get_recently_opened_chats_gen.go deleted file mode 100644 index 677652bef..000000000 --- a/tdapi/tl_get_recently_opened_chats_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetRecentlyOpenedChatsRequest represents TL type `getRecentlyOpenedChats#8d4fb223`. -type GetRecentlyOpenedChatsRequest struct { - // The maximum number of chats to be returned - Limit int32 -} - -// GetRecentlyOpenedChatsRequestTypeID is TL type id of GetRecentlyOpenedChatsRequest. -const GetRecentlyOpenedChatsRequestTypeID = 0x8d4fb223 - -// Ensuring interfaces in compile-time for GetRecentlyOpenedChatsRequest. -var ( - _ bin.Encoder = &GetRecentlyOpenedChatsRequest{} - _ bin.Decoder = &GetRecentlyOpenedChatsRequest{} - _ bin.BareEncoder = &GetRecentlyOpenedChatsRequest{} - _ bin.BareDecoder = &GetRecentlyOpenedChatsRequest{} -) - -func (g *GetRecentlyOpenedChatsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetRecentlyOpenedChatsRequest) String() string { - if g == nil { - return "GetRecentlyOpenedChatsRequest(nil)" - } - type Alias GetRecentlyOpenedChatsRequest - return fmt.Sprintf("GetRecentlyOpenedChatsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetRecentlyOpenedChatsRequest) TypeID() uint32 { - return GetRecentlyOpenedChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetRecentlyOpenedChatsRequest) TypeName() string { - return "getRecentlyOpenedChats" -} - -// TypeInfo returns info about TL type. -func (g *GetRecentlyOpenedChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getRecentlyOpenedChats", - ID: GetRecentlyOpenedChatsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetRecentlyOpenedChatsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecentlyOpenedChats#8d4fb223 as nil") - } - b.PutID(GetRecentlyOpenedChatsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetRecentlyOpenedChatsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecentlyOpenedChats#8d4fb223 as nil") - } - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetRecentlyOpenedChatsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecentlyOpenedChats#8d4fb223 to nil") - } - if err := b.ConsumeID(GetRecentlyOpenedChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getRecentlyOpenedChats#8d4fb223: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetRecentlyOpenedChatsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecentlyOpenedChats#8d4fb223 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getRecentlyOpenedChats#8d4fb223: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetRecentlyOpenedChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getRecentlyOpenedChats#8d4fb223 as nil") - } - b.ObjStart() - b.PutID("getRecentlyOpenedChats") - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetRecentlyOpenedChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getRecentlyOpenedChats#8d4fb223 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getRecentlyOpenedChats"); err != nil { - return fmt.Errorf("unable to decode getRecentlyOpenedChats#8d4fb223: %w", err) - } - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getRecentlyOpenedChats#8d4fb223: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLimit returns value of Limit field. -func (g *GetRecentlyOpenedChatsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetRecentlyOpenedChats invokes method getRecentlyOpenedChats#8d4fb223 returning error if any. -func (c *Client) GetRecentlyOpenedChats(ctx context.Context, limit int32) (*Chats, error) { - var result Chats - - request := &GetRecentlyOpenedChatsRequest{ - Limit: limit, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_recently_visited_t_me_urls_gen.go b/tdapi/tl_get_recently_visited_t_me_urls_gen.go deleted file mode 100644 index 5df25728a..000000000 --- a/tdapi/tl_get_recently_visited_t_me_urls_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetRecentlyVisitedTMeURLsRequest represents TL type `getRecentlyVisitedTMeUrls#30161a91`. -type GetRecentlyVisitedTMeURLsRequest struct { - // Google Play referrer to identify the user - Referrer string -} - -// GetRecentlyVisitedTMeURLsRequestTypeID is TL type id of GetRecentlyVisitedTMeURLsRequest. -const GetRecentlyVisitedTMeURLsRequestTypeID = 0x30161a91 - -// Ensuring interfaces in compile-time for GetRecentlyVisitedTMeURLsRequest. -var ( - _ bin.Encoder = &GetRecentlyVisitedTMeURLsRequest{} - _ bin.Decoder = &GetRecentlyVisitedTMeURLsRequest{} - _ bin.BareEncoder = &GetRecentlyVisitedTMeURLsRequest{} - _ bin.BareDecoder = &GetRecentlyVisitedTMeURLsRequest{} -) - -func (g *GetRecentlyVisitedTMeURLsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Referrer == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetRecentlyVisitedTMeURLsRequest) String() string { - if g == nil { - return "GetRecentlyVisitedTMeURLsRequest(nil)" - } - type Alias GetRecentlyVisitedTMeURLsRequest - return fmt.Sprintf("GetRecentlyVisitedTMeURLsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetRecentlyVisitedTMeURLsRequest) TypeID() uint32 { - return GetRecentlyVisitedTMeURLsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetRecentlyVisitedTMeURLsRequest) TypeName() string { - return "getRecentlyVisitedTMeUrls" -} - -// TypeInfo returns info about TL type. -func (g *GetRecentlyVisitedTMeURLsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getRecentlyVisitedTMeUrls", - ID: GetRecentlyVisitedTMeURLsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Referrer", - SchemaName: "referrer", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetRecentlyVisitedTMeURLsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecentlyVisitedTMeUrls#30161a91 as nil") - } - b.PutID(GetRecentlyVisitedTMeURLsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetRecentlyVisitedTMeURLsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecentlyVisitedTMeUrls#30161a91 as nil") - } - b.PutString(g.Referrer) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetRecentlyVisitedTMeURLsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecentlyVisitedTMeUrls#30161a91 to nil") - } - if err := b.ConsumeID(GetRecentlyVisitedTMeURLsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getRecentlyVisitedTMeUrls#30161a91: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetRecentlyVisitedTMeURLsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecentlyVisitedTMeUrls#30161a91 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getRecentlyVisitedTMeUrls#30161a91: field referrer: %w", err) - } - g.Referrer = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetRecentlyVisitedTMeURLsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getRecentlyVisitedTMeUrls#30161a91 as nil") - } - b.ObjStart() - b.PutID("getRecentlyVisitedTMeUrls") - b.Comma() - b.FieldStart("referrer") - b.PutString(g.Referrer) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetRecentlyVisitedTMeURLsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getRecentlyVisitedTMeUrls#30161a91 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getRecentlyVisitedTMeUrls"); err != nil { - return fmt.Errorf("unable to decode getRecentlyVisitedTMeUrls#30161a91: %w", err) - } - case "referrer": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getRecentlyVisitedTMeUrls#30161a91: field referrer: %w", err) - } - g.Referrer = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReferrer returns value of Referrer field. -func (g *GetRecentlyVisitedTMeURLsRequest) GetReferrer() (value string) { - if g == nil { - return - } - return g.Referrer -} - -// GetRecentlyVisitedTMeURLs invokes method getRecentlyVisitedTMeUrls#30161a91 returning error if any. -func (c *Client) GetRecentlyVisitedTMeURLs(ctx context.Context, referrer string) (*TMeURLs, error) { - var result TMeURLs - - request := &GetRecentlyVisitedTMeURLsRequest{ - Referrer: referrer, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_recommended_chat_folders_gen.go b/tdapi/tl_get_recommended_chat_folders_gen.go deleted file mode 100644 index 3a8cea224..000000000 --- a/tdapi/tl_get_recommended_chat_folders_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetRecommendedChatFoldersRequest represents TL type `getRecommendedChatFolders#f7533b87`. -type GetRecommendedChatFoldersRequest struct { -} - -// GetRecommendedChatFoldersRequestTypeID is TL type id of GetRecommendedChatFoldersRequest. -const GetRecommendedChatFoldersRequestTypeID = 0xf7533b87 - -// Ensuring interfaces in compile-time for GetRecommendedChatFoldersRequest. -var ( - _ bin.Encoder = &GetRecommendedChatFoldersRequest{} - _ bin.Decoder = &GetRecommendedChatFoldersRequest{} - _ bin.BareEncoder = &GetRecommendedChatFoldersRequest{} - _ bin.BareDecoder = &GetRecommendedChatFoldersRequest{} -) - -func (g *GetRecommendedChatFoldersRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetRecommendedChatFoldersRequest) String() string { - if g == nil { - return "GetRecommendedChatFoldersRequest(nil)" - } - type Alias GetRecommendedChatFoldersRequest - return fmt.Sprintf("GetRecommendedChatFoldersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetRecommendedChatFoldersRequest) TypeID() uint32 { - return GetRecommendedChatFoldersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetRecommendedChatFoldersRequest) TypeName() string { - return "getRecommendedChatFolders" -} - -// TypeInfo returns info about TL type. -func (g *GetRecommendedChatFoldersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getRecommendedChatFolders", - ID: GetRecommendedChatFoldersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetRecommendedChatFoldersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecommendedChatFolders#f7533b87 as nil") - } - b.PutID(GetRecommendedChatFoldersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetRecommendedChatFoldersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecommendedChatFolders#f7533b87 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetRecommendedChatFoldersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecommendedChatFolders#f7533b87 to nil") - } - if err := b.ConsumeID(GetRecommendedChatFoldersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getRecommendedChatFolders#f7533b87: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetRecommendedChatFoldersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecommendedChatFolders#f7533b87 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetRecommendedChatFoldersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getRecommendedChatFolders#f7533b87 as nil") - } - b.ObjStart() - b.PutID("getRecommendedChatFolders") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetRecommendedChatFoldersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getRecommendedChatFolders#f7533b87 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getRecommendedChatFolders"); err != nil { - return fmt.Errorf("unable to decode getRecommendedChatFolders#f7533b87: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetRecommendedChatFolders invokes method getRecommendedChatFolders#f7533b87 returning error if any. -func (c *Client) GetRecommendedChatFolders(ctx context.Context) (*RecommendedChatFolders, error) { - var result RecommendedChatFolders - - request := &GetRecommendedChatFoldersRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_recommended_chats_gen.go b/tdapi/tl_get_recommended_chats_gen.go deleted file mode 100644 index d5ce8ac70..000000000 --- a/tdapi/tl_get_recommended_chats_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetRecommendedChatsRequest represents TL type `getRecommendedChats#d9438d71`. -type GetRecommendedChatsRequest struct { -} - -// GetRecommendedChatsRequestTypeID is TL type id of GetRecommendedChatsRequest. -const GetRecommendedChatsRequestTypeID = 0xd9438d71 - -// Ensuring interfaces in compile-time for GetRecommendedChatsRequest. -var ( - _ bin.Encoder = &GetRecommendedChatsRequest{} - _ bin.Decoder = &GetRecommendedChatsRequest{} - _ bin.BareEncoder = &GetRecommendedChatsRequest{} - _ bin.BareDecoder = &GetRecommendedChatsRequest{} -) - -func (g *GetRecommendedChatsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetRecommendedChatsRequest) String() string { - if g == nil { - return "GetRecommendedChatsRequest(nil)" - } - type Alias GetRecommendedChatsRequest - return fmt.Sprintf("GetRecommendedChatsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetRecommendedChatsRequest) TypeID() uint32 { - return GetRecommendedChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetRecommendedChatsRequest) TypeName() string { - return "getRecommendedChats" -} - -// TypeInfo returns info about TL type. -func (g *GetRecommendedChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getRecommendedChats", - ID: GetRecommendedChatsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetRecommendedChatsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecommendedChats#d9438d71 as nil") - } - b.PutID(GetRecommendedChatsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetRecommendedChatsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecommendedChats#d9438d71 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetRecommendedChatsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecommendedChats#d9438d71 to nil") - } - if err := b.ConsumeID(GetRecommendedChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getRecommendedChats#d9438d71: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetRecommendedChatsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecommendedChats#d9438d71 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetRecommendedChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getRecommendedChats#d9438d71 as nil") - } - b.ObjStart() - b.PutID("getRecommendedChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetRecommendedChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getRecommendedChats#d9438d71 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getRecommendedChats"); err != nil { - return fmt.Errorf("unable to decode getRecommendedChats#d9438d71: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetRecommendedChats invokes method getRecommendedChats#d9438d71 returning error if any. -func (c *Client) GetRecommendedChats(ctx context.Context) (*Chats, error) { - var result Chats - - request := &GetRecommendedChatsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_recovery_email_address_gen.go b/tdapi/tl_get_recovery_email_address_gen.go deleted file mode 100644 index fc22d96e9..000000000 --- a/tdapi/tl_get_recovery_email_address_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetRecoveryEmailAddressRequest represents TL type `getRecoveryEmailAddress#a0f1b9fd`. -type GetRecoveryEmailAddressRequest struct { - // The 2-step verification password for the current user - Password string -} - -// GetRecoveryEmailAddressRequestTypeID is TL type id of GetRecoveryEmailAddressRequest. -const GetRecoveryEmailAddressRequestTypeID = 0xa0f1b9fd - -// Ensuring interfaces in compile-time for GetRecoveryEmailAddressRequest. -var ( - _ bin.Encoder = &GetRecoveryEmailAddressRequest{} - _ bin.Decoder = &GetRecoveryEmailAddressRequest{} - _ bin.BareEncoder = &GetRecoveryEmailAddressRequest{} - _ bin.BareDecoder = &GetRecoveryEmailAddressRequest{} -) - -func (g *GetRecoveryEmailAddressRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Password == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetRecoveryEmailAddressRequest) String() string { - if g == nil { - return "GetRecoveryEmailAddressRequest(nil)" - } - type Alias GetRecoveryEmailAddressRequest - return fmt.Sprintf("GetRecoveryEmailAddressRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetRecoveryEmailAddressRequest) TypeID() uint32 { - return GetRecoveryEmailAddressRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetRecoveryEmailAddressRequest) TypeName() string { - return "getRecoveryEmailAddress" -} - -// TypeInfo returns info about TL type. -func (g *GetRecoveryEmailAddressRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getRecoveryEmailAddress", - ID: GetRecoveryEmailAddressRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetRecoveryEmailAddressRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecoveryEmailAddress#a0f1b9fd as nil") - } - b.PutID(GetRecoveryEmailAddressRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetRecoveryEmailAddressRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRecoveryEmailAddress#a0f1b9fd as nil") - } - b.PutString(g.Password) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetRecoveryEmailAddressRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecoveryEmailAddress#a0f1b9fd to nil") - } - if err := b.ConsumeID(GetRecoveryEmailAddressRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getRecoveryEmailAddress#a0f1b9fd: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetRecoveryEmailAddressRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRecoveryEmailAddress#a0f1b9fd to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getRecoveryEmailAddress#a0f1b9fd: field password: %w", err) - } - g.Password = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetRecoveryEmailAddressRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getRecoveryEmailAddress#a0f1b9fd as nil") - } - b.ObjStart() - b.PutID("getRecoveryEmailAddress") - b.Comma() - b.FieldStart("password") - b.PutString(g.Password) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetRecoveryEmailAddressRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getRecoveryEmailAddress#a0f1b9fd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getRecoveryEmailAddress"); err != nil { - return fmt.Errorf("unable to decode getRecoveryEmailAddress#a0f1b9fd: %w", err) - } - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getRecoveryEmailAddress#a0f1b9fd: field password: %w", err) - } - g.Password = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPassword returns value of Password field. -func (g *GetRecoveryEmailAddressRequest) GetPassword() (value string) { - if g == nil { - return - } - return g.Password -} - -// GetRecoveryEmailAddress invokes method getRecoveryEmailAddress#a0f1b9fd returning error if any. -func (c *Client) GetRecoveryEmailAddress(ctx context.Context, password string) (*RecoveryEmailAddress, error) { - var result RecoveryEmailAddress - - request := &GetRecoveryEmailAddressRequest{ - Password: password, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_remote_file_gen.go b/tdapi/tl_get_remote_file_gen.go deleted file mode 100644 index 9e6120891..000000000 --- a/tdapi/tl_get_remote_file_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetRemoteFileRequest represents TL type `getRemoteFile#7f632732`. -type GetRemoteFileRequest struct { - // Remote identifier of the file to get - RemoteFileID string - // File type; pass null if unknown - FileType FileTypeClass -} - -// GetRemoteFileRequestTypeID is TL type id of GetRemoteFileRequest. -const GetRemoteFileRequestTypeID = 0x7f632732 - -// Ensuring interfaces in compile-time for GetRemoteFileRequest. -var ( - _ bin.Encoder = &GetRemoteFileRequest{} - _ bin.Decoder = &GetRemoteFileRequest{} - _ bin.BareEncoder = &GetRemoteFileRequest{} - _ bin.BareDecoder = &GetRemoteFileRequest{} -) - -func (g *GetRemoteFileRequest) Zero() bool { - if g == nil { - return true - } - if !(g.RemoteFileID == "") { - return false - } - if !(g.FileType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetRemoteFileRequest) String() string { - if g == nil { - return "GetRemoteFileRequest(nil)" - } - type Alias GetRemoteFileRequest - return fmt.Sprintf("GetRemoteFileRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetRemoteFileRequest) TypeID() uint32 { - return GetRemoteFileRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetRemoteFileRequest) TypeName() string { - return "getRemoteFile" -} - -// TypeInfo returns info about TL type. -func (g *GetRemoteFileRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getRemoteFile", - ID: GetRemoteFileRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RemoteFileID", - SchemaName: "remote_file_id", - }, - { - Name: "FileType", - SchemaName: "file_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetRemoteFileRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRemoteFile#7f632732 as nil") - } - b.PutID(GetRemoteFileRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetRemoteFileRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRemoteFile#7f632732 as nil") - } - b.PutString(g.RemoteFileID) - if g.FileType == nil { - return fmt.Errorf("unable to encode getRemoteFile#7f632732: field file_type is nil") - } - if err := g.FileType.Encode(b); err != nil { - return fmt.Errorf("unable to encode getRemoteFile#7f632732: field file_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetRemoteFileRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRemoteFile#7f632732 to nil") - } - if err := b.ConsumeID(GetRemoteFileRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getRemoteFile#7f632732: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetRemoteFileRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRemoteFile#7f632732 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getRemoteFile#7f632732: field remote_file_id: %w", err) - } - g.RemoteFileID = value - } - { - value, err := DecodeFileType(b) - if err != nil { - return fmt.Errorf("unable to decode getRemoteFile#7f632732: field file_type: %w", err) - } - g.FileType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetRemoteFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getRemoteFile#7f632732 as nil") - } - b.ObjStart() - b.PutID("getRemoteFile") - b.Comma() - b.FieldStart("remote_file_id") - b.PutString(g.RemoteFileID) - b.Comma() - b.FieldStart("file_type") - if g.FileType == nil { - return fmt.Errorf("unable to encode getRemoteFile#7f632732: field file_type is nil") - } - if err := g.FileType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getRemoteFile#7f632732: field file_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetRemoteFileRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getRemoteFile#7f632732 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getRemoteFile"); err != nil { - return fmt.Errorf("unable to decode getRemoteFile#7f632732: %w", err) - } - case "remote_file_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getRemoteFile#7f632732: field remote_file_id: %w", err) - } - g.RemoteFileID = value - case "file_type": - value, err := DecodeTDLibJSONFileType(b) - if err != nil { - return fmt.Errorf("unable to decode getRemoteFile#7f632732: field file_type: %w", err) - } - g.FileType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRemoteFileID returns value of RemoteFileID field. -func (g *GetRemoteFileRequest) GetRemoteFileID() (value string) { - if g == nil { - return - } - return g.RemoteFileID -} - -// GetFileType returns value of FileType field. -func (g *GetRemoteFileRequest) GetFileType() (value FileTypeClass) { - if g == nil { - return - } - return g.FileType -} - -// GetRemoteFile invokes method getRemoteFile#7f632732 returning error if any. -func (c *Client) GetRemoteFile(ctx context.Context, request *GetRemoteFileRequest) (*File, error) { - var result File - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_replied_message_gen.go b/tdapi/tl_get_replied_message_gen.go deleted file mode 100644 index e518d064c..000000000 --- a/tdapi/tl_get_replied_message_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetRepliedMessageRequest represents TL type `getRepliedMessage#d9bd19bd`. -type GetRepliedMessageRequest struct { - // Identifier of the chat the message belongs to - ChatID int64 - // Identifier of the reply message - MessageID int64 -} - -// GetRepliedMessageRequestTypeID is TL type id of GetRepliedMessageRequest. -const GetRepliedMessageRequestTypeID = 0xd9bd19bd - -// Ensuring interfaces in compile-time for GetRepliedMessageRequest. -var ( - _ bin.Encoder = &GetRepliedMessageRequest{} - _ bin.Decoder = &GetRepliedMessageRequest{} - _ bin.BareEncoder = &GetRepliedMessageRequest{} - _ bin.BareDecoder = &GetRepliedMessageRequest{} -) - -func (g *GetRepliedMessageRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetRepliedMessageRequest) String() string { - if g == nil { - return "GetRepliedMessageRequest(nil)" - } - type Alias GetRepliedMessageRequest - return fmt.Sprintf("GetRepliedMessageRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetRepliedMessageRequest) TypeID() uint32 { - return GetRepliedMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetRepliedMessageRequest) TypeName() string { - return "getRepliedMessage" -} - -// TypeInfo returns info about TL type. -func (g *GetRepliedMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getRepliedMessage", - ID: GetRepliedMessageRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetRepliedMessageRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRepliedMessage#d9bd19bd as nil") - } - b.PutID(GetRepliedMessageRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetRepliedMessageRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getRepliedMessage#d9bd19bd as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetRepliedMessageRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRepliedMessage#d9bd19bd to nil") - } - if err := b.ConsumeID(GetRepliedMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getRepliedMessage#d9bd19bd: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetRepliedMessageRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getRepliedMessage#d9bd19bd to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getRepliedMessage#d9bd19bd: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getRepliedMessage#d9bd19bd: field message_id: %w", err) - } - g.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetRepliedMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getRepliedMessage#d9bd19bd as nil") - } - b.ObjStart() - b.PutID("getRepliedMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetRepliedMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getRepliedMessage#d9bd19bd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getRepliedMessage"); err != nil { - return fmt.Errorf("unable to decode getRepliedMessage#d9bd19bd: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getRepliedMessage#d9bd19bd: field chat_id: %w", err) - } - g.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getRepliedMessage#d9bd19bd: field message_id: %w", err) - } - g.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetRepliedMessageRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetMessageID returns value of MessageID field. -func (g *GetRepliedMessageRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetRepliedMessage invokes method getRepliedMessage#d9bd19bd returning error if any. -func (c *Client) GetRepliedMessage(ctx context.Context, request *GetRepliedMessageRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_saved_animations_gen.go b/tdapi/tl_get_saved_animations_gen.go deleted file mode 100644 index b338ba51d..000000000 --- a/tdapi/tl_get_saved_animations_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSavedAnimationsRequest represents TL type `getSavedAnimations#6b9718`. -type GetSavedAnimationsRequest struct { -} - -// GetSavedAnimationsRequestTypeID is TL type id of GetSavedAnimationsRequest. -const GetSavedAnimationsRequestTypeID = 0x6b9718 - -// Ensuring interfaces in compile-time for GetSavedAnimationsRequest. -var ( - _ bin.Encoder = &GetSavedAnimationsRequest{} - _ bin.Decoder = &GetSavedAnimationsRequest{} - _ bin.BareEncoder = &GetSavedAnimationsRequest{} - _ bin.BareDecoder = &GetSavedAnimationsRequest{} -) - -func (g *GetSavedAnimationsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSavedAnimationsRequest) String() string { - if g == nil { - return "GetSavedAnimationsRequest(nil)" - } - type Alias GetSavedAnimationsRequest - return fmt.Sprintf("GetSavedAnimationsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSavedAnimationsRequest) TypeID() uint32 { - return GetSavedAnimationsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSavedAnimationsRequest) TypeName() string { - return "getSavedAnimations" -} - -// TypeInfo returns info about TL type. -func (g *GetSavedAnimationsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSavedAnimations", - ID: GetSavedAnimationsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSavedAnimationsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedAnimations#6b9718 as nil") - } - b.PutID(GetSavedAnimationsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSavedAnimationsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedAnimations#6b9718 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSavedAnimationsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedAnimations#6b9718 to nil") - } - if err := b.ConsumeID(GetSavedAnimationsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSavedAnimations#6b9718: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSavedAnimationsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedAnimations#6b9718 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSavedAnimationsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSavedAnimations#6b9718 as nil") - } - b.ObjStart() - b.PutID("getSavedAnimations") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSavedAnimationsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSavedAnimations#6b9718 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSavedAnimations"); err != nil { - return fmt.Errorf("unable to decode getSavedAnimations#6b9718: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedAnimations invokes method getSavedAnimations#6b9718 returning error if any. -func (c *Client) GetSavedAnimations(ctx context.Context) (*Animations, error) { - var result Animations - - request := &GetSavedAnimationsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_saved_messages_tags_gen.go b/tdapi/tl_get_saved_messages_tags_gen.go deleted file mode 100644 index b5e191f22..000000000 --- a/tdapi/tl_get_saved_messages_tags_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSavedMessagesTagsRequest represents TL type `getSavedMessagesTags#8cd667a9`. -type GetSavedMessagesTagsRequest struct { - // Identifier of Saved Messages topic which tags will be returned; pass 0 to get all - // Saved Messages tags - SavedMessagesTopicID int64 -} - -// GetSavedMessagesTagsRequestTypeID is TL type id of GetSavedMessagesTagsRequest. -const GetSavedMessagesTagsRequestTypeID = 0x8cd667a9 - -// Ensuring interfaces in compile-time for GetSavedMessagesTagsRequest. -var ( - _ bin.Encoder = &GetSavedMessagesTagsRequest{} - _ bin.Decoder = &GetSavedMessagesTagsRequest{} - _ bin.BareEncoder = &GetSavedMessagesTagsRequest{} - _ bin.BareDecoder = &GetSavedMessagesTagsRequest{} -) - -func (g *GetSavedMessagesTagsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.SavedMessagesTopicID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSavedMessagesTagsRequest) String() string { - if g == nil { - return "GetSavedMessagesTagsRequest(nil)" - } - type Alias GetSavedMessagesTagsRequest - return fmt.Sprintf("GetSavedMessagesTagsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSavedMessagesTagsRequest) TypeID() uint32 { - return GetSavedMessagesTagsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSavedMessagesTagsRequest) TypeName() string { - return "getSavedMessagesTags" -} - -// TypeInfo returns info about TL type. -func (g *GetSavedMessagesTagsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSavedMessagesTags", - ID: GetSavedMessagesTagsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSavedMessagesTagsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTags#8cd667a9 as nil") - } - b.PutID(GetSavedMessagesTagsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSavedMessagesTagsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTags#8cd667a9 as nil") - } - b.PutInt53(g.SavedMessagesTopicID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSavedMessagesTagsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTags#8cd667a9 to nil") - } - if err := b.ConsumeID(GetSavedMessagesTagsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTags#8cd667a9: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSavedMessagesTagsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTags#8cd667a9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTags#8cd667a9: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSavedMessagesTagsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTags#8cd667a9 as nil") - } - b.ObjStart() - b.PutID("getSavedMessagesTags") - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(g.SavedMessagesTopicID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSavedMessagesTagsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTags#8cd667a9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSavedMessagesTags"); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTags#8cd667a9: %w", err) - } - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTags#8cd667a9: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (g *GetSavedMessagesTagsRequest) GetSavedMessagesTopicID() (value int64) { - if g == nil { - return - } - return g.SavedMessagesTopicID -} - -// GetSavedMessagesTags invokes method getSavedMessagesTags#8cd667a9 returning error if any. -func (c *Client) GetSavedMessagesTags(ctx context.Context, savedmessagestopicid int64) (*SavedMessagesTags, error) { - var result SavedMessagesTags - - request := &GetSavedMessagesTagsRequest{ - SavedMessagesTopicID: savedmessagestopicid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_saved_messages_topic_history_gen.go b/tdapi/tl_get_saved_messages_topic_history_gen.go deleted file mode 100644 index 20a1a2183..000000000 --- a/tdapi/tl_get_saved_messages_topic_history_gen.go +++ /dev/null @@ -1,309 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSavedMessagesTopicHistoryRequest represents TL type `getSavedMessagesTopicHistory#77e5da68`. -type GetSavedMessagesTopicHistoryRequest struct { - // Identifier of Saved Messages topic which messages will be fetched - SavedMessagesTopicID int64 - // Identifier of the message starting from which messages must be fetched; use 0 to get - // results from the last message - FromMessageID int64 - // Specify 0 to get results from exactly the message from_message_id or a negative offset - // up to 99 to get additionally some newer messages - Offset int32 - // The maximum number of messages to be returned; must be positive and can't be greater - // than 100. If the offset is negative, the limit must be greater than or equal to - // -offset. - Limit int32 -} - -// GetSavedMessagesTopicHistoryRequestTypeID is TL type id of GetSavedMessagesTopicHistoryRequest. -const GetSavedMessagesTopicHistoryRequestTypeID = 0x77e5da68 - -// Ensuring interfaces in compile-time for GetSavedMessagesTopicHistoryRequest. -var ( - _ bin.Encoder = &GetSavedMessagesTopicHistoryRequest{} - _ bin.Decoder = &GetSavedMessagesTopicHistoryRequest{} - _ bin.BareEncoder = &GetSavedMessagesTopicHistoryRequest{} - _ bin.BareDecoder = &GetSavedMessagesTopicHistoryRequest{} -) - -func (g *GetSavedMessagesTopicHistoryRequest) Zero() bool { - if g == nil { - return true - } - if !(g.SavedMessagesTopicID == 0) { - return false - } - if !(g.FromMessageID == 0) { - return false - } - if !(g.Offset == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSavedMessagesTopicHistoryRequest) String() string { - if g == nil { - return "GetSavedMessagesTopicHistoryRequest(nil)" - } - type Alias GetSavedMessagesTopicHistoryRequest - return fmt.Sprintf("GetSavedMessagesTopicHistoryRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSavedMessagesTopicHistoryRequest) TypeID() uint32 { - return GetSavedMessagesTopicHistoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSavedMessagesTopicHistoryRequest) TypeName() string { - return "getSavedMessagesTopicHistory" -} - -// TypeInfo returns info about TL type. -func (g *GetSavedMessagesTopicHistoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSavedMessagesTopicHistory", - ID: GetSavedMessagesTopicHistoryRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - { - Name: "FromMessageID", - SchemaName: "from_message_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSavedMessagesTopicHistoryRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicHistory#77e5da68 as nil") - } - b.PutID(GetSavedMessagesTopicHistoryRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSavedMessagesTopicHistoryRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicHistory#77e5da68 as nil") - } - b.PutInt53(g.SavedMessagesTopicID) - b.PutInt53(g.FromMessageID) - b.PutInt32(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSavedMessagesTopicHistoryRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicHistory#77e5da68 to nil") - } - if err := b.ConsumeID(GetSavedMessagesTopicHistoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSavedMessagesTopicHistoryRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicHistory#77e5da68 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field from_message_id: %w", err) - } - g.FromMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSavedMessagesTopicHistoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicHistory#77e5da68 as nil") - } - b.ObjStart() - b.PutID("getSavedMessagesTopicHistory") - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(g.SavedMessagesTopicID) - b.Comma() - b.FieldStart("from_message_id") - b.PutInt53(g.FromMessageID) - b.Comma() - b.FieldStart("offset") - b.PutInt32(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSavedMessagesTopicHistoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicHistory#77e5da68 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSavedMessagesTopicHistory"); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: %w", err) - } - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - case "from_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field from_message_id: %w", err) - } - g.FromMessageID = value - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicHistory#77e5da68: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (g *GetSavedMessagesTopicHistoryRequest) GetSavedMessagesTopicID() (value int64) { - if g == nil { - return - } - return g.SavedMessagesTopicID -} - -// GetFromMessageID returns value of FromMessageID field. -func (g *GetSavedMessagesTopicHistoryRequest) GetFromMessageID() (value int64) { - if g == nil { - return - } - return g.FromMessageID -} - -// GetOffset returns value of Offset field. -func (g *GetSavedMessagesTopicHistoryRequest) GetOffset() (value int32) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetSavedMessagesTopicHistoryRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetSavedMessagesTopicHistory invokes method getSavedMessagesTopicHistory#77e5da68 returning error if any. -func (c *Client) GetSavedMessagesTopicHistory(ctx context.Context, request *GetSavedMessagesTopicHistoryRequest) (*Messages, error) { - var result Messages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_saved_messages_topic_message_by_date_gen.go b/tdapi/tl_get_saved_messages_topic_message_by_date_gen.go deleted file mode 100644 index de976ec31..000000000 --- a/tdapi/tl_get_saved_messages_topic_message_by_date_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSavedMessagesTopicMessageByDateRequest represents TL type `getSavedMessagesTopicMessageByDate#c15e4680`. -type GetSavedMessagesTopicMessageByDateRequest struct { - // Identifier of Saved Messages topic which message will be returned - SavedMessagesTopicID int64 - // Point in time (Unix timestamp) relative to which to search for messages - Date int32 -} - -// GetSavedMessagesTopicMessageByDateRequestTypeID is TL type id of GetSavedMessagesTopicMessageByDateRequest. -const GetSavedMessagesTopicMessageByDateRequestTypeID = 0xc15e4680 - -// Ensuring interfaces in compile-time for GetSavedMessagesTopicMessageByDateRequest. -var ( - _ bin.Encoder = &GetSavedMessagesTopicMessageByDateRequest{} - _ bin.Decoder = &GetSavedMessagesTopicMessageByDateRequest{} - _ bin.BareEncoder = &GetSavedMessagesTopicMessageByDateRequest{} - _ bin.BareDecoder = &GetSavedMessagesTopicMessageByDateRequest{} -) - -func (g *GetSavedMessagesTopicMessageByDateRequest) Zero() bool { - if g == nil { - return true - } - if !(g.SavedMessagesTopicID == 0) { - return false - } - if !(g.Date == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSavedMessagesTopicMessageByDateRequest) String() string { - if g == nil { - return "GetSavedMessagesTopicMessageByDateRequest(nil)" - } - type Alias GetSavedMessagesTopicMessageByDateRequest - return fmt.Sprintf("GetSavedMessagesTopicMessageByDateRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSavedMessagesTopicMessageByDateRequest) TypeID() uint32 { - return GetSavedMessagesTopicMessageByDateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSavedMessagesTopicMessageByDateRequest) TypeName() string { - return "getSavedMessagesTopicMessageByDate" -} - -// TypeInfo returns info about TL type. -func (g *GetSavedMessagesTopicMessageByDateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSavedMessagesTopicMessageByDate", - ID: GetSavedMessagesTopicMessageByDateRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - { - Name: "Date", - SchemaName: "date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSavedMessagesTopicMessageByDateRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicMessageByDate#c15e4680 as nil") - } - b.PutID(GetSavedMessagesTopicMessageByDateRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSavedMessagesTopicMessageByDateRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicMessageByDate#c15e4680 as nil") - } - b.PutInt53(g.SavedMessagesTopicID) - b.PutInt32(g.Date) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSavedMessagesTopicMessageByDateRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicMessageByDate#c15e4680 to nil") - } - if err := b.ConsumeID(GetSavedMessagesTopicMessageByDateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSavedMessagesTopicMessageByDateRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicMessageByDate#c15e4680 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: field date: %w", err) - } - g.Date = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSavedMessagesTopicMessageByDateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSavedMessagesTopicMessageByDate#c15e4680 as nil") - } - b.ObjStart() - b.PutID("getSavedMessagesTopicMessageByDate") - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(g.SavedMessagesTopicID) - b.Comma() - b.FieldStart("date") - b.PutInt32(g.Date) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSavedMessagesTopicMessageByDateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSavedMessagesTopicMessageByDate#c15e4680 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSavedMessagesTopicMessageByDate"); err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: %w", err) - } - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: field saved_messages_topic_id: %w", err) - } - g.SavedMessagesTopicID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSavedMessagesTopicMessageByDate#c15e4680: field date: %w", err) - } - g.Date = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (g *GetSavedMessagesTopicMessageByDateRequest) GetSavedMessagesTopicID() (value int64) { - if g == nil { - return - } - return g.SavedMessagesTopicID -} - -// GetDate returns value of Date field. -func (g *GetSavedMessagesTopicMessageByDateRequest) GetDate() (value int32) { - if g == nil { - return - } - return g.Date -} - -// GetSavedMessagesTopicMessageByDate invokes method getSavedMessagesTopicMessageByDate#c15e4680 returning error if any. -func (c *Client) GetSavedMessagesTopicMessageByDate(ctx context.Context, request *GetSavedMessagesTopicMessageByDateRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_saved_notification_sound_gen.go b/tdapi/tl_get_saved_notification_sound_gen.go deleted file mode 100644 index 5f09d0e23..000000000 --- a/tdapi/tl_get_saved_notification_sound_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSavedNotificationSoundRequest represents TL type `getSavedNotificationSound#1b647917`. -type GetSavedNotificationSoundRequest struct { - // Identifier of the notification sound - NotificationSoundID int64 -} - -// GetSavedNotificationSoundRequestTypeID is TL type id of GetSavedNotificationSoundRequest. -const GetSavedNotificationSoundRequestTypeID = 0x1b647917 - -// Ensuring interfaces in compile-time for GetSavedNotificationSoundRequest. -var ( - _ bin.Encoder = &GetSavedNotificationSoundRequest{} - _ bin.Decoder = &GetSavedNotificationSoundRequest{} - _ bin.BareEncoder = &GetSavedNotificationSoundRequest{} - _ bin.BareDecoder = &GetSavedNotificationSoundRequest{} -) - -func (g *GetSavedNotificationSoundRequest) Zero() bool { - if g == nil { - return true - } - if !(g.NotificationSoundID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSavedNotificationSoundRequest) String() string { - if g == nil { - return "GetSavedNotificationSoundRequest(nil)" - } - type Alias GetSavedNotificationSoundRequest - return fmt.Sprintf("GetSavedNotificationSoundRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSavedNotificationSoundRequest) TypeID() uint32 { - return GetSavedNotificationSoundRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSavedNotificationSoundRequest) TypeName() string { - return "getSavedNotificationSound" -} - -// TypeInfo returns info about TL type. -func (g *GetSavedNotificationSoundRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSavedNotificationSound", - ID: GetSavedNotificationSoundRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NotificationSoundID", - SchemaName: "notification_sound_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSavedNotificationSoundRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedNotificationSound#1b647917 as nil") - } - b.PutID(GetSavedNotificationSoundRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSavedNotificationSoundRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedNotificationSound#1b647917 as nil") - } - b.PutLong(g.NotificationSoundID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSavedNotificationSoundRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedNotificationSound#1b647917 to nil") - } - if err := b.ConsumeID(GetSavedNotificationSoundRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSavedNotificationSound#1b647917: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSavedNotificationSoundRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedNotificationSound#1b647917 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getSavedNotificationSound#1b647917: field notification_sound_id: %w", err) - } - g.NotificationSoundID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSavedNotificationSoundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSavedNotificationSound#1b647917 as nil") - } - b.ObjStart() - b.PutID("getSavedNotificationSound") - b.Comma() - b.FieldStart("notification_sound_id") - b.PutLong(g.NotificationSoundID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSavedNotificationSoundRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSavedNotificationSound#1b647917 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSavedNotificationSound"); err != nil { - return fmt.Errorf("unable to decode getSavedNotificationSound#1b647917: %w", err) - } - case "notification_sound_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getSavedNotificationSound#1b647917: field notification_sound_id: %w", err) - } - g.NotificationSoundID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetNotificationSoundID returns value of NotificationSoundID field. -func (g *GetSavedNotificationSoundRequest) GetNotificationSoundID() (value int64) { - if g == nil { - return - } - return g.NotificationSoundID -} - -// GetSavedNotificationSound invokes method getSavedNotificationSound#1b647917 returning error if any. -func (c *Client) GetSavedNotificationSound(ctx context.Context, notificationsoundid int64) (*NotificationSounds, error) { - var result NotificationSounds - - request := &GetSavedNotificationSoundRequest{ - NotificationSoundID: notificationsoundid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_saved_notification_sounds_gen.go b/tdapi/tl_get_saved_notification_sounds_gen.go deleted file mode 100644 index 81e2d516a..000000000 --- a/tdapi/tl_get_saved_notification_sounds_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSavedNotificationSoundsRequest represents TL type `getSavedNotificationSounds#c0346fa8`. -type GetSavedNotificationSoundsRequest struct { -} - -// GetSavedNotificationSoundsRequestTypeID is TL type id of GetSavedNotificationSoundsRequest. -const GetSavedNotificationSoundsRequestTypeID = 0xc0346fa8 - -// Ensuring interfaces in compile-time for GetSavedNotificationSoundsRequest. -var ( - _ bin.Encoder = &GetSavedNotificationSoundsRequest{} - _ bin.Decoder = &GetSavedNotificationSoundsRequest{} - _ bin.BareEncoder = &GetSavedNotificationSoundsRequest{} - _ bin.BareDecoder = &GetSavedNotificationSoundsRequest{} -) - -func (g *GetSavedNotificationSoundsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSavedNotificationSoundsRequest) String() string { - if g == nil { - return "GetSavedNotificationSoundsRequest(nil)" - } - type Alias GetSavedNotificationSoundsRequest - return fmt.Sprintf("GetSavedNotificationSoundsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSavedNotificationSoundsRequest) TypeID() uint32 { - return GetSavedNotificationSoundsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSavedNotificationSoundsRequest) TypeName() string { - return "getSavedNotificationSounds" -} - -// TypeInfo returns info about TL type. -func (g *GetSavedNotificationSoundsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSavedNotificationSounds", - ID: GetSavedNotificationSoundsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSavedNotificationSoundsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedNotificationSounds#c0346fa8 as nil") - } - b.PutID(GetSavedNotificationSoundsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSavedNotificationSoundsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedNotificationSounds#c0346fa8 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSavedNotificationSoundsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedNotificationSounds#c0346fa8 to nil") - } - if err := b.ConsumeID(GetSavedNotificationSoundsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSavedNotificationSounds#c0346fa8: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSavedNotificationSoundsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedNotificationSounds#c0346fa8 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSavedNotificationSoundsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSavedNotificationSounds#c0346fa8 as nil") - } - b.ObjStart() - b.PutID("getSavedNotificationSounds") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSavedNotificationSoundsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSavedNotificationSounds#c0346fa8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSavedNotificationSounds"); err != nil { - return fmt.Errorf("unable to decode getSavedNotificationSounds#c0346fa8: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedNotificationSounds invokes method getSavedNotificationSounds#c0346fa8 returning error if any. -func (c *Client) GetSavedNotificationSounds(ctx context.Context) (*NotificationSounds, error) { - var result NotificationSounds - - request := &GetSavedNotificationSoundsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_saved_order_info_gen.go b/tdapi/tl_get_saved_order_info_gen.go deleted file mode 100644 index 261f03966..000000000 --- a/tdapi/tl_get_saved_order_info_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSavedOrderInfoRequest represents TL type `getSavedOrderInfo#bb559edd`. -type GetSavedOrderInfoRequest struct { -} - -// GetSavedOrderInfoRequestTypeID is TL type id of GetSavedOrderInfoRequest. -const GetSavedOrderInfoRequestTypeID = 0xbb559edd - -// Ensuring interfaces in compile-time for GetSavedOrderInfoRequest. -var ( - _ bin.Encoder = &GetSavedOrderInfoRequest{} - _ bin.Decoder = &GetSavedOrderInfoRequest{} - _ bin.BareEncoder = &GetSavedOrderInfoRequest{} - _ bin.BareDecoder = &GetSavedOrderInfoRequest{} -) - -func (g *GetSavedOrderInfoRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSavedOrderInfoRequest) String() string { - if g == nil { - return "GetSavedOrderInfoRequest(nil)" - } - type Alias GetSavedOrderInfoRequest - return fmt.Sprintf("GetSavedOrderInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSavedOrderInfoRequest) TypeID() uint32 { - return GetSavedOrderInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSavedOrderInfoRequest) TypeName() string { - return "getSavedOrderInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetSavedOrderInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSavedOrderInfo", - ID: GetSavedOrderInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSavedOrderInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedOrderInfo#bb559edd as nil") - } - b.PutID(GetSavedOrderInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSavedOrderInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSavedOrderInfo#bb559edd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSavedOrderInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedOrderInfo#bb559edd to nil") - } - if err := b.ConsumeID(GetSavedOrderInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSavedOrderInfo#bb559edd: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSavedOrderInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSavedOrderInfo#bb559edd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSavedOrderInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSavedOrderInfo#bb559edd as nil") - } - b.ObjStart() - b.PutID("getSavedOrderInfo") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSavedOrderInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSavedOrderInfo#bb559edd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSavedOrderInfo"); err != nil { - return fmt.Errorf("unable to decode getSavedOrderInfo#bb559edd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedOrderInfo invokes method getSavedOrderInfo#bb559edd returning error if any. -func (c *Client) GetSavedOrderInfo(ctx context.Context) (*OrderInfo, error) { - var result OrderInfo - - request := &GetSavedOrderInfoRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_scope_notification_settings_gen.go b/tdapi/tl_get_scope_notification_settings_gen.go deleted file mode 100644 index 6a37e2f1c..000000000 --- a/tdapi/tl_get_scope_notification_settings_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetScopeNotificationSettingsRequest represents TL type `getScopeNotificationSettings#c4a8254f`. -type GetScopeNotificationSettingsRequest struct { - // Types of chats for which to return the notification settings information - Scope NotificationSettingsScopeClass -} - -// GetScopeNotificationSettingsRequestTypeID is TL type id of GetScopeNotificationSettingsRequest. -const GetScopeNotificationSettingsRequestTypeID = 0xc4a8254f - -// Ensuring interfaces in compile-time for GetScopeNotificationSettingsRequest. -var ( - _ bin.Encoder = &GetScopeNotificationSettingsRequest{} - _ bin.Decoder = &GetScopeNotificationSettingsRequest{} - _ bin.BareEncoder = &GetScopeNotificationSettingsRequest{} - _ bin.BareDecoder = &GetScopeNotificationSettingsRequest{} -) - -func (g *GetScopeNotificationSettingsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Scope == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetScopeNotificationSettingsRequest) String() string { - if g == nil { - return "GetScopeNotificationSettingsRequest(nil)" - } - type Alias GetScopeNotificationSettingsRequest - return fmt.Sprintf("GetScopeNotificationSettingsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetScopeNotificationSettingsRequest) TypeID() uint32 { - return GetScopeNotificationSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetScopeNotificationSettingsRequest) TypeName() string { - return "getScopeNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (g *GetScopeNotificationSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getScopeNotificationSettings", - ID: GetScopeNotificationSettingsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Scope", - SchemaName: "scope", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetScopeNotificationSettingsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getScopeNotificationSettings#c4a8254f as nil") - } - b.PutID(GetScopeNotificationSettingsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetScopeNotificationSettingsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getScopeNotificationSettings#c4a8254f as nil") - } - if g.Scope == nil { - return fmt.Errorf("unable to encode getScopeNotificationSettings#c4a8254f: field scope is nil") - } - if err := g.Scope.Encode(b); err != nil { - return fmt.Errorf("unable to encode getScopeNotificationSettings#c4a8254f: field scope: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetScopeNotificationSettingsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getScopeNotificationSettings#c4a8254f to nil") - } - if err := b.ConsumeID(GetScopeNotificationSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getScopeNotificationSettings#c4a8254f: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetScopeNotificationSettingsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getScopeNotificationSettings#c4a8254f to nil") - } - { - value, err := DecodeNotificationSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode getScopeNotificationSettings#c4a8254f: field scope: %w", err) - } - g.Scope = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetScopeNotificationSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getScopeNotificationSettings#c4a8254f as nil") - } - b.ObjStart() - b.PutID("getScopeNotificationSettings") - b.Comma() - b.FieldStart("scope") - if g.Scope == nil { - return fmt.Errorf("unable to encode getScopeNotificationSettings#c4a8254f: field scope is nil") - } - if err := g.Scope.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getScopeNotificationSettings#c4a8254f: field scope: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetScopeNotificationSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getScopeNotificationSettings#c4a8254f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getScopeNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode getScopeNotificationSettings#c4a8254f: %w", err) - } - case "scope": - value, err := DecodeTDLibJSONNotificationSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode getScopeNotificationSettings#c4a8254f: field scope: %w", err) - } - g.Scope = value - default: - return b.Skip() - } - return nil - }) -} - -// GetScope returns value of Scope field. -func (g *GetScopeNotificationSettingsRequest) GetScope() (value NotificationSettingsScopeClass) { - if g == nil { - return - } - return g.Scope -} - -// GetScopeNotificationSettings invokes method getScopeNotificationSettings#c4a8254f returning error if any. -func (c *Client) GetScopeNotificationSettings(ctx context.Context, scope NotificationSettingsScopeClass) (*ScopeNotificationSettings, error) { - var result ScopeNotificationSettings - - request := &GetScopeNotificationSettingsRequest{ - Scope: scope, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_searched_for_tags_gen.go b/tdapi/tl_get_searched_for_tags_gen.go deleted file mode 100644 index 8c91418bd..000000000 --- a/tdapi/tl_get_searched_for_tags_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSearchedForTagsRequest represents TL type `getSearchedForTags#9b1b30cd`. -type GetSearchedForTagsRequest struct { - // Prefix of hashtags or cashtags to return - TagPrefix string - // The maximum number of items to be returned - Limit int32 -} - -// GetSearchedForTagsRequestTypeID is TL type id of GetSearchedForTagsRequest. -const GetSearchedForTagsRequestTypeID = 0x9b1b30cd - -// Ensuring interfaces in compile-time for GetSearchedForTagsRequest. -var ( - _ bin.Encoder = &GetSearchedForTagsRequest{} - _ bin.Decoder = &GetSearchedForTagsRequest{} - _ bin.BareEncoder = &GetSearchedForTagsRequest{} - _ bin.BareDecoder = &GetSearchedForTagsRequest{} -) - -func (g *GetSearchedForTagsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.TagPrefix == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSearchedForTagsRequest) String() string { - if g == nil { - return "GetSearchedForTagsRequest(nil)" - } - type Alias GetSearchedForTagsRequest - return fmt.Sprintf("GetSearchedForTagsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSearchedForTagsRequest) TypeID() uint32 { - return GetSearchedForTagsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSearchedForTagsRequest) TypeName() string { - return "getSearchedForTags" -} - -// TypeInfo returns info about TL type. -func (g *GetSearchedForTagsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSearchedForTags", - ID: GetSearchedForTagsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TagPrefix", - SchemaName: "tag_prefix", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSearchedForTagsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSearchedForTags#9b1b30cd as nil") - } - b.PutID(GetSearchedForTagsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSearchedForTagsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSearchedForTags#9b1b30cd as nil") - } - b.PutString(g.TagPrefix) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSearchedForTagsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSearchedForTags#9b1b30cd to nil") - } - if err := b.ConsumeID(GetSearchedForTagsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSearchedForTags#9b1b30cd: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSearchedForTagsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSearchedForTags#9b1b30cd to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getSearchedForTags#9b1b30cd: field tag_prefix: %w", err) - } - g.TagPrefix = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSearchedForTags#9b1b30cd: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSearchedForTagsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSearchedForTags#9b1b30cd as nil") - } - b.ObjStart() - b.PutID("getSearchedForTags") - b.Comma() - b.FieldStart("tag_prefix") - b.PutString(g.TagPrefix) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSearchedForTagsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSearchedForTags#9b1b30cd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSearchedForTags"); err != nil { - return fmt.Errorf("unable to decode getSearchedForTags#9b1b30cd: %w", err) - } - case "tag_prefix": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getSearchedForTags#9b1b30cd: field tag_prefix: %w", err) - } - g.TagPrefix = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSearchedForTags#9b1b30cd: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTagPrefix returns value of TagPrefix field. -func (g *GetSearchedForTagsRequest) GetTagPrefix() (value string) { - if g == nil { - return - } - return g.TagPrefix -} - -// GetLimit returns value of Limit field. -func (g *GetSearchedForTagsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetSearchedForTags invokes method getSearchedForTags#9b1b30cd returning error if any. -func (c *Client) GetSearchedForTags(ctx context.Context, request *GetSearchedForTagsRequest) (*Hashtags, error) { - var result Hashtags - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_secret_chat_gen.go b/tdapi/tl_get_secret_chat_gen.go deleted file mode 100644 index 56a3d8712..000000000 --- a/tdapi/tl_get_secret_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSecretChatRequest represents TL type `getSecretChat#26b7e81`. -type GetSecretChatRequest struct { - // Secret chat identifier - SecretChatID int32 -} - -// GetSecretChatRequestTypeID is TL type id of GetSecretChatRequest. -const GetSecretChatRequestTypeID = 0x26b7e81 - -// Ensuring interfaces in compile-time for GetSecretChatRequest. -var ( - _ bin.Encoder = &GetSecretChatRequest{} - _ bin.Decoder = &GetSecretChatRequest{} - _ bin.BareEncoder = &GetSecretChatRequest{} - _ bin.BareDecoder = &GetSecretChatRequest{} -) - -func (g *GetSecretChatRequest) Zero() bool { - if g == nil { - return true - } - if !(g.SecretChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSecretChatRequest) String() string { - if g == nil { - return "GetSecretChatRequest(nil)" - } - type Alias GetSecretChatRequest - return fmt.Sprintf("GetSecretChatRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSecretChatRequest) TypeID() uint32 { - return GetSecretChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSecretChatRequest) TypeName() string { - return "getSecretChat" -} - -// TypeInfo returns info about TL type. -func (g *GetSecretChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSecretChat", - ID: GetSecretChatRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SecretChatID", - SchemaName: "secret_chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSecretChatRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSecretChat#26b7e81 as nil") - } - b.PutID(GetSecretChatRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSecretChatRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSecretChat#26b7e81 as nil") - } - b.PutInt32(g.SecretChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSecretChatRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSecretChat#26b7e81 to nil") - } - if err := b.ConsumeID(GetSecretChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSecretChat#26b7e81: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSecretChatRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSecretChat#26b7e81 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSecretChat#26b7e81: field secret_chat_id: %w", err) - } - g.SecretChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSecretChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSecretChat#26b7e81 as nil") - } - b.ObjStart() - b.PutID("getSecretChat") - b.Comma() - b.FieldStart("secret_chat_id") - b.PutInt32(g.SecretChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSecretChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSecretChat#26b7e81 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSecretChat"); err != nil { - return fmt.Errorf("unable to decode getSecretChat#26b7e81: %w", err) - } - case "secret_chat_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSecretChat#26b7e81: field secret_chat_id: %w", err) - } - g.SecretChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSecretChatID returns value of SecretChatID field. -func (g *GetSecretChatRequest) GetSecretChatID() (value int32) { - if g == nil { - return - } - return g.SecretChatID -} - -// GetSecretChat invokes method getSecretChat#26b7e81 returning error if any. -func (c *Client) GetSecretChat(ctx context.Context, secretchatid int32) (*SecretChat, error) { - var result SecretChat - - request := &GetSecretChatRequest{ - SecretChatID: secretchatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_star_ad_account_url_gen.go b/tdapi/tl_get_star_ad_account_url_gen.go deleted file mode 100644 index 9c3249376..000000000 --- a/tdapi/tl_get_star_ad_account_url_gen.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStarAdAccountURLRequest represents TL type `getStarAdAccountUrl#73a9455d`. -type GetStarAdAccountURLRequest struct { - // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or - // identifier of an owned channel chat - OwnerID MessageSenderClass -} - -// GetStarAdAccountURLRequestTypeID is TL type id of GetStarAdAccountURLRequest. -const GetStarAdAccountURLRequestTypeID = 0x73a9455d - -// Ensuring interfaces in compile-time for GetStarAdAccountURLRequest. -var ( - _ bin.Encoder = &GetStarAdAccountURLRequest{} - _ bin.Decoder = &GetStarAdAccountURLRequest{} - _ bin.BareEncoder = &GetStarAdAccountURLRequest{} - _ bin.BareDecoder = &GetStarAdAccountURLRequest{} -) - -func (g *GetStarAdAccountURLRequest) Zero() bool { - if g == nil { - return true - } - if !(g.OwnerID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStarAdAccountURLRequest) String() string { - if g == nil { - return "GetStarAdAccountURLRequest(nil)" - } - type Alias GetStarAdAccountURLRequest - return fmt.Sprintf("GetStarAdAccountURLRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStarAdAccountURLRequest) TypeID() uint32 { - return GetStarAdAccountURLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStarAdAccountURLRequest) TypeName() string { - return "getStarAdAccountUrl" -} - -// TypeInfo returns info about TL type. -func (g *GetStarAdAccountURLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStarAdAccountUrl", - ID: GetStarAdAccountURLRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OwnerID", - SchemaName: "owner_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStarAdAccountURLRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarAdAccountUrl#73a9455d as nil") - } - b.PutID(GetStarAdAccountURLRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStarAdAccountURLRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarAdAccountUrl#73a9455d as nil") - } - if g.OwnerID == nil { - return fmt.Errorf("unable to encode getStarAdAccountUrl#73a9455d: field owner_id is nil") - } - if err := g.OwnerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode getStarAdAccountUrl#73a9455d: field owner_id: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStarAdAccountURLRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarAdAccountUrl#73a9455d to nil") - } - if err := b.ConsumeID(GetStarAdAccountURLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStarAdAccountUrl#73a9455d: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStarAdAccountURLRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarAdAccountUrl#73a9455d to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode getStarAdAccountUrl#73a9455d: field owner_id: %w", err) - } - g.OwnerID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStarAdAccountURLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStarAdAccountUrl#73a9455d as nil") - } - b.ObjStart() - b.PutID("getStarAdAccountUrl") - b.Comma() - b.FieldStart("owner_id") - if g.OwnerID == nil { - return fmt.Errorf("unable to encode getStarAdAccountUrl#73a9455d: field owner_id is nil") - } - if err := g.OwnerID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getStarAdAccountUrl#73a9455d: field owner_id: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStarAdAccountURLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStarAdAccountUrl#73a9455d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStarAdAccountUrl"); err != nil { - return fmt.Errorf("unable to decode getStarAdAccountUrl#73a9455d: %w", err) - } - case "owner_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode getStarAdAccountUrl#73a9455d: field owner_id: %w", err) - } - g.OwnerID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOwnerID returns value of OwnerID field. -func (g *GetStarAdAccountURLRequest) GetOwnerID() (value MessageSenderClass) { - if g == nil { - return - } - return g.OwnerID -} - -// GetStarAdAccountURL invokes method getStarAdAccountUrl#73a9455d returning error if any. -func (c *Client) GetStarAdAccountURL(ctx context.Context, ownerid MessageSenderClass) (*HTTPURL, error) { - var result HTTPURL - - request := &GetStarAdAccountURLRequest{ - OwnerID: ownerid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_star_gift_payment_options_gen.go b/tdapi/tl_get_star_gift_payment_options_gen.go deleted file mode 100644 index 1cf3b9b18..000000000 --- a/tdapi/tl_get_star_gift_payment_options_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStarGiftPaymentOptionsRequest represents TL type `getStarGiftPaymentOptions#e22760e3`. -type GetStarGiftPaymentOptionsRequest struct { - // Identifier of the user that will receive Telegram Stars; pass 0 to get options for an - // unspecified user - UserID int64 -} - -// GetStarGiftPaymentOptionsRequestTypeID is TL type id of GetStarGiftPaymentOptionsRequest. -const GetStarGiftPaymentOptionsRequestTypeID = 0xe22760e3 - -// Ensuring interfaces in compile-time for GetStarGiftPaymentOptionsRequest. -var ( - _ bin.Encoder = &GetStarGiftPaymentOptionsRequest{} - _ bin.Decoder = &GetStarGiftPaymentOptionsRequest{} - _ bin.BareEncoder = &GetStarGiftPaymentOptionsRequest{} - _ bin.BareDecoder = &GetStarGiftPaymentOptionsRequest{} -) - -func (g *GetStarGiftPaymentOptionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStarGiftPaymentOptionsRequest) String() string { - if g == nil { - return "GetStarGiftPaymentOptionsRequest(nil)" - } - type Alias GetStarGiftPaymentOptionsRequest - return fmt.Sprintf("GetStarGiftPaymentOptionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStarGiftPaymentOptionsRequest) TypeID() uint32 { - return GetStarGiftPaymentOptionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStarGiftPaymentOptionsRequest) TypeName() string { - return "getStarGiftPaymentOptions" -} - -// TypeInfo returns info about TL type. -func (g *GetStarGiftPaymentOptionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStarGiftPaymentOptions", - ID: GetStarGiftPaymentOptionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStarGiftPaymentOptionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarGiftPaymentOptions#e22760e3 as nil") - } - b.PutID(GetStarGiftPaymentOptionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStarGiftPaymentOptionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarGiftPaymentOptions#e22760e3 as nil") - } - b.PutInt53(g.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStarGiftPaymentOptionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarGiftPaymentOptions#e22760e3 to nil") - } - if err := b.ConsumeID(GetStarGiftPaymentOptionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStarGiftPaymentOptions#e22760e3: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStarGiftPaymentOptionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarGiftPaymentOptions#e22760e3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStarGiftPaymentOptions#e22760e3: field user_id: %w", err) - } - g.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStarGiftPaymentOptionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStarGiftPaymentOptions#e22760e3 as nil") - } - b.ObjStart() - b.PutID("getStarGiftPaymentOptions") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStarGiftPaymentOptionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStarGiftPaymentOptions#e22760e3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStarGiftPaymentOptions"); err != nil { - return fmt.Errorf("unable to decode getStarGiftPaymentOptions#e22760e3: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStarGiftPaymentOptions#e22760e3: field user_id: %w", err) - } - g.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (g *GetStarGiftPaymentOptionsRequest) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetStarGiftPaymentOptions invokes method getStarGiftPaymentOptions#e22760e3 returning error if any. -func (c *Client) GetStarGiftPaymentOptions(ctx context.Context, userid int64) (*StarPaymentOptions, error) { - var result StarPaymentOptions - - request := &GetStarGiftPaymentOptionsRequest{ - UserID: userid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_star_giveaway_payment_options_gen.go b/tdapi/tl_get_star_giveaway_payment_options_gen.go deleted file mode 100644 index 9f9ef5562..000000000 --- a/tdapi/tl_get_star_giveaway_payment_options_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStarGiveawayPaymentOptionsRequest represents TL type `getStarGiveawayPaymentOptions#cb5bdb1e`. -type GetStarGiveawayPaymentOptionsRequest struct { -} - -// GetStarGiveawayPaymentOptionsRequestTypeID is TL type id of GetStarGiveawayPaymentOptionsRequest. -const GetStarGiveawayPaymentOptionsRequestTypeID = 0xcb5bdb1e - -// Ensuring interfaces in compile-time for GetStarGiveawayPaymentOptionsRequest. -var ( - _ bin.Encoder = &GetStarGiveawayPaymentOptionsRequest{} - _ bin.Decoder = &GetStarGiveawayPaymentOptionsRequest{} - _ bin.BareEncoder = &GetStarGiveawayPaymentOptionsRequest{} - _ bin.BareDecoder = &GetStarGiveawayPaymentOptionsRequest{} -) - -func (g *GetStarGiveawayPaymentOptionsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStarGiveawayPaymentOptionsRequest) String() string { - if g == nil { - return "GetStarGiveawayPaymentOptionsRequest(nil)" - } - type Alias GetStarGiveawayPaymentOptionsRequest - return fmt.Sprintf("GetStarGiveawayPaymentOptionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStarGiveawayPaymentOptionsRequest) TypeID() uint32 { - return GetStarGiveawayPaymentOptionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStarGiveawayPaymentOptionsRequest) TypeName() string { - return "getStarGiveawayPaymentOptions" -} - -// TypeInfo returns info about TL type. -func (g *GetStarGiveawayPaymentOptionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStarGiveawayPaymentOptions", - ID: GetStarGiveawayPaymentOptionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStarGiveawayPaymentOptionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarGiveawayPaymentOptions#cb5bdb1e as nil") - } - b.PutID(GetStarGiveawayPaymentOptionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStarGiveawayPaymentOptionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarGiveawayPaymentOptions#cb5bdb1e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStarGiveawayPaymentOptionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarGiveawayPaymentOptions#cb5bdb1e to nil") - } - if err := b.ConsumeID(GetStarGiveawayPaymentOptionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStarGiveawayPaymentOptions#cb5bdb1e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStarGiveawayPaymentOptionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarGiveawayPaymentOptions#cb5bdb1e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStarGiveawayPaymentOptionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStarGiveawayPaymentOptions#cb5bdb1e as nil") - } - b.ObjStart() - b.PutID("getStarGiveawayPaymentOptions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStarGiveawayPaymentOptionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStarGiveawayPaymentOptions#cb5bdb1e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStarGiveawayPaymentOptions"); err != nil { - return fmt.Errorf("unable to decode getStarGiveawayPaymentOptions#cb5bdb1e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStarGiveawayPaymentOptions invokes method getStarGiveawayPaymentOptions#cb5bdb1e returning error if any. -func (c *Client) GetStarGiveawayPaymentOptions(ctx context.Context) (*StarGiveawayPaymentOptions, error) { - var result StarGiveawayPaymentOptions - - request := &GetStarGiveawayPaymentOptionsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_star_payment_options_gen.go b/tdapi/tl_get_star_payment_options_gen.go deleted file mode 100644 index 72f0b0f68..000000000 --- a/tdapi/tl_get_star_payment_options_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStarPaymentOptionsRequest represents TL type `getStarPaymentOptions#6d930644`. -type GetStarPaymentOptionsRequest struct { -} - -// GetStarPaymentOptionsRequestTypeID is TL type id of GetStarPaymentOptionsRequest. -const GetStarPaymentOptionsRequestTypeID = 0x6d930644 - -// Ensuring interfaces in compile-time for GetStarPaymentOptionsRequest. -var ( - _ bin.Encoder = &GetStarPaymentOptionsRequest{} - _ bin.Decoder = &GetStarPaymentOptionsRequest{} - _ bin.BareEncoder = &GetStarPaymentOptionsRequest{} - _ bin.BareDecoder = &GetStarPaymentOptionsRequest{} -) - -func (g *GetStarPaymentOptionsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStarPaymentOptionsRequest) String() string { - if g == nil { - return "GetStarPaymentOptionsRequest(nil)" - } - type Alias GetStarPaymentOptionsRequest - return fmt.Sprintf("GetStarPaymentOptionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStarPaymentOptionsRequest) TypeID() uint32 { - return GetStarPaymentOptionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStarPaymentOptionsRequest) TypeName() string { - return "getStarPaymentOptions" -} - -// TypeInfo returns info about TL type. -func (g *GetStarPaymentOptionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStarPaymentOptions", - ID: GetStarPaymentOptionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStarPaymentOptionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarPaymentOptions#6d930644 as nil") - } - b.PutID(GetStarPaymentOptionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStarPaymentOptionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarPaymentOptions#6d930644 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStarPaymentOptionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarPaymentOptions#6d930644 to nil") - } - if err := b.ConsumeID(GetStarPaymentOptionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStarPaymentOptions#6d930644: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStarPaymentOptionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarPaymentOptions#6d930644 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStarPaymentOptionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStarPaymentOptions#6d930644 as nil") - } - b.ObjStart() - b.PutID("getStarPaymentOptions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStarPaymentOptionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStarPaymentOptions#6d930644 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStarPaymentOptions"); err != nil { - return fmt.Errorf("unable to decode getStarPaymentOptions#6d930644: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStarPaymentOptions invokes method getStarPaymentOptions#6d930644 returning error if any. -func (c *Client) GetStarPaymentOptions(ctx context.Context) (*StarPaymentOptions, error) { - var result StarPaymentOptions - - request := &GetStarPaymentOptionsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_star_revenue_statistics_gen.go b/tdapi/tl_get_star_revenue_statistics_gen.go deleted file mode 100644 index 906ed2209..000000000 --- a/tdapi/tl_get_star_revenue_statistics_gen.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStarRevenueStatisticsRequest represents TL type `getStarRevenueStatistics#f07b4517`. -type GetStarRevenueStatisticsRequest struct { - // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or - // identifier of a channel chat with supergroupFullInfo.can_get_star_revenue_statistics - // == true - OwnerID MessageSenderClass - // Pass true if a dark theme is used by the application - IsDark bool -} - -// GetStarRevenueStatisticsRequestTypeID is TL type id of GetStarRevenueStatisticsRequest. -const GetStarRevenueStatisticsRequestTypeID = 0xf07b4517 - -// Ensuring interfaces in compile-time for GetStarRevenueStatisticsRequest. -var ( - _ bin.Encoder = &GetStarRevenueStatisticsRequest{} - _ bin.Decoder = &GetStarRevenueStatisticsRequest{} - _ bin.BareEncoder = &GetStarRevenueStatisticsRequest{} - _ bin.BareDecoder = &GetStarRevenueStatisticsRequest{} -) - -func (g *GetStarRevenueStatisticsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.OwnerID == nil) { - return false - } - if !(g.IsDark == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStarRevenueStatisticsRequest) String() string { - if g == nil { - return "GetStarRevenueStatisticsRequest(nil)" - } - type Alias GetStarRevenueStatisticsRequest - return fmt.Sprintf("GetStarRevenueStatisticsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStarRevenueStatisticsRequest) TypeID() uint32 { - return GetStarRevenueStatisticsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStarRevenueStatisticsRequest) TypeName() string { - return "getStarRevenueStatistics" -} - -// TypeInfo returns info about TL type. -func (g *GetStarRevenueStatisticsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStarRevenueStatistics", - ID: GetStarRevenueStatisticsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OwnerID", - SchemaName: "owner_id", - }, - { - Name: "IsDark", - SchemaName: "is_dark", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStarRevenueStatisticsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarRevenueStatistics#f07b4517 as nil") - } - b.PutID(GetStarRevenueStatisticsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStarRevenueStatisticsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarRevenueStatistics#f07b4517 as nil") - } - if g.OwnerID == nil { - return fmt.Errorf("unable to encode getStarRevenueStatistics#f07b4517: field owner_id is nil") - } - if err := g.OwnerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode getStarRevenueStatistics#f07b4517: field owner_id: %w", err) - } - b.PutBool(g.IsDark) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStarRevenueStatisticsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarRevenueStatistics#f07b4517 to nil") - } - if err := b.ConsumeID(GetStarRevenueStatisticsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStarRevenueStatistics#f07b4517: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStarRevenueStatisticsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarRevenueStatistics#f07b4517 to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode getStarRevenueStatistics#f07b4517: field owner_id: %w", err) - } - g.OwnerID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStarRevenueStatistics#f07b4517: field is_dark: %w", err) - } - g.IsDark = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStarRevenueStatisticsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStarRevenueStatistics#f07b4517 as nil") - } - b.ObjStart() - b.PutID("getStarRevenueStatistics") - b.Comma() - b.FieldStart("owner_id") - if g.OwnerID == nil { - return fmt.Errorf("unable to encode getStarRevenueStatistics#f07b4517: field owner_id is nil") - } - if err := g.OwnerID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getStarRevenueStatistics#f07b4517: field owner_id: %w", err) - } - b.Comma() - b.FieldStart("is_dark") - b.PutBool(g.IsDark) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStarRevenueStatisticsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStarRevenueStatistics#f07b4517 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStarRevenueStatistics"); err != nil { - return fmt.Errorf("unable to decode getStarRevenueStatistics#f07b4517: %w", err) - } - case "owner_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode getStarRevenueStatistics#f07b4517: field owner_id: %w", err) - } - g.OwnerID = value - case "is_dark": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStarRevenueStatistics#f07b4517: field is_dark: %w", err) - } - g.IsDark = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOwnerID returns value of OwnerID field. -func (g *GetStarRevenueStatisticsRequest) GetOwnerID() (value MessageSenderClass) { - if g == nil { - return - } - return g.OwnerID -} - -// GetIsDark returns value of IsDark field. -func (g *GetStarRevenueStatisticsRequest) GetIsDark() (value bool) { - if g == nil { - return - } - return g.IsDark -} - -// GetStarRevenueStatistics invokes method getStarRevenueStatistics#f07b4517 returning error if any. -func (c *Client) GetStarRevenueStatistics(ctx context.Context, request *GetStarRevenueStatisticsRequest) (*StarRevenueStatistics, error) { - var result StarRevenueStatistics - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_star_subscriptions_gen.go b/tdapi/tl_get_star_subscriptions_gen.go deleted file mode 100644 index b693f7bd7..000000000 --- a/tdapi/tl_get_star_subscriptions_gen.go +++ /dev/null @@ -1,239 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStarSubscriptionsRequest represents TL type `getStarSubscriptions#d9c7b2ec`. -type GetStarSubscriptionsRequest struct { - // Pass true to receive only expiring subscriptions for which there are no enough - // Telegram Stars to extend - OnlyExpiring bool - // Offset of the first subscription to return as received from the previous request; use - // empty string to get the first chunk of results - Offset string -} - -// GetStarSubscriptionsRequestTypeID is TL type id of GetStarSubscriptionsRequest. -const GetStarSubscriptionsRequestTypeID = 0xd9c7b2ec - -// Ensuring interfaces in compile-time for GetStarSubscriptionsRequest. -var ( - _ bin.Encoder = &GetStarSubscriptionsRequest{} - _ bin.Decoder = &GetStarSubscriptionsRequest{} - _ bin.BareEncoder = &GetStarSubscriptionsRequest{} - _ bin.BareDecoder = &GetStarSubscriptionsRequest{} -) - -func (g *GetStarSubscriptionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.OnlyExpiring == false) { - return false - } - if !(g.Offset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStarSubscriptionsRequest) String() string { - if g == nil { - return "GetStarSubscriptionsRequest(nil)" - } - type Alias GetStarSubscriptionsRequest - return fmt.Sprintf("GetStarSubscriptionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStarSubscriptionsRequest) TypeID() uint32 { - return GetStarSubscriptionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStarSubscriptionsRequest) TypeName() string { - return "getStarSubscriptions" -} - -// TypeInfo returns info about TL type. -func (g *GetStarSubscriptionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStarSubscriptions", - ID: GetStarSubscriptionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OnlyExpiring", - SchemaName: "only_expiring", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStarSubscriptionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarSubscriptions#d9c7b2ec as nil") - } - b.PutID(GetStarSubscriptionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStarSubscriptionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarSubscriptions#d9c7b2ec as nil") - } - b.PutBool(g.OnlyExpiring) - b.PutString(g.Offset) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStarSubscriptionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarSubscriptions#d9c7b2ec to nil") - } - if err := b.ConsumeID(GetStarSubscriptionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStarSubscriptionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarSubscriptions#d9c7b2ec to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: field only_expiring: %w", err) - } - g.OnlyExpiring = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: field offset: %w", err) - } - g.Offset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStarSubscriptionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStarSubscriptions#d9c7b2ec as nil") - } - b.ObjStart() - b.PutID("getStarSubscriptions") - b.Comma() - b.FieldStart("only_expiring") - b.PutBool(g.OnlyExpiring) - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStarSubscriptionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStarSubscriptions#d9c7b2ec to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStarSubscriptions"); err != nil { - return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: %w", err) - } - case "only_expiring": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: field only_expiring: %w", err) - } - g.OnlyExpiring = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStarSubscriptions#d9c7b2ec: field offset: %w", err) - } - g.Offset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOnlyExpiring returns value of OnlyExpiring field. -func (g *GetStarSubscriptionsRequest) GetOnlyExpiring() (value bool) { - if g == nil { - return - } - return g.OnlyExpiring -} - -// GetOffset returns value of Offset field. -func (g *GetStarSubscriptionsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetStarSubscriptions invokes method getStarSubscriptions#d9c7b2ec returning error if any. -func (c *Client) GetStarSubscriptions(ctx context.Context, request *GetStarSubscriptionsRequest) (*StarSubscriptions, error) { - var result StarSubscriptions - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_star_transactions_gen.go b/tdapi/tl_get_star_transactions_gen.go deleted file mode 100644 index fde7b47ee..000000000 --- a/tdapi/tl_get_star_transactions_gen.go +++ /dev/null @@ -1,361 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStarTransactionsRequest represents TL type `getStarTransactions#f096f8f1`. -type GetStarTransactionsRequest struct { - // Identifier of the owner of the Telegram Stars; can be the identifier of the current - // user, identifier of an owned bot, - OwnerID MessageSenderClass - // If non-empty, only transactions related to the Star Subscription will be returned - SubscriptionID string - // Direction of the transactions to receive; pass null to get all transactions - Direction StarTransactionDirectionClass - // Offset of the first transaction to return as received from the previous request; use - // empty string to get the first chunk of results - Offset string - // The maximum number of transactions to return - Limit int32 -} - -// GetStarTransactionsRequestTypeID is TL type id of GetStarTransactionsRequest. -const GetStarTransactionsRequestTypeID = 0xf096f8f1 - -// Ensuring interfaces in compile-time for GetStarTransactionsRequest. -var ( - _ bin.Encoder = &GetStarTransactionsRequest{} - _ bin.Decoder = &GetStarTransactionsRequest{} - _ bin.BareEncoder = &GetStarTransactionsRequest{} - _ bin.BareDecoder = &GetStarTransactionsRequest{} -) - -func (g *GetStarTransactionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.OwnerID == nil) { - return false - } - if !(g.SubscriptionID == "") { - return false - } - if !(g.Direction == nil) { - return false - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStarTransactionsRequest) String() string { - if g == nil { - return "GetStarTransactionsRequest(nil)" - } - type Alias GetStarTransactionsRequest - return fmt.Sprintf("GetStarTransactionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStarTransactionsRequest) TypeID() uint32 { - return GetStarTransactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStarTransactionsRequest) TypeName() string { - return "getStarTransactions" -} - -// TypeInfo returns info about TL type. -func (g *GetStarTransactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStarTransactions", - ID: GetStarTransactionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OwnerID", - SchemaName: "owner_id", - }, - { - Name: "SubscriptionID", - SchemaName: "subscription_id", - }, - { - Name: "Direction", - SchemaName: "direction", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStarTransactionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarTransactions#f096f8f1 as nil") - } - b.PutID(GetStarTransactionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStarTransactionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarTransactions#f096f8f1 as nil") - } - if g.OwnerID == nil { - return fmt.Errorf("unable to encode getStarTransactions#f096f8f1: field owner_id is nil") - } - if err := g.OwnerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode getStarTransactions#f096f8f1: field owner_id: %w", err) - } - b.PutString(g.SubscriptionID) - if g.Direction == nil { - return fmt.Errorf("unable to encode getStarTransactions#f096f8f1: field direction is nil") - } - if err := g.Direction.Encode(b); err != nil { - return fmt.Errorf("unable to encode getStarTransactions#f096f8f1: field direction: %w", err) - } - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStarTransactionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarTransactions#f096f8f1 to nil") - } - if err := b.ConsumeID(GetStarTransactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStarTransactionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarTransactions#f096f8f1 to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: field owner_id: %w", err) - } - g.OwnerID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: field subscription_id: %w", err) - } - g.SubscriptionID = value - } - { - value, err := DecodeStarTransactionDirection(b) - if err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: field direction: %w", err) - } - g.Direction = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStarTransactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStarTransactions#f096f8f1 as nil") - } - b.ObjStart() - b.PutID("getStarTransactions") - b.Comma() - b.FieldStart("owner_id") - if g.OwnerID == nil { - return fmt.Errorf("unable to encode getStarTransactions#f096f8f1: field owner_id is nil") - } - if err := g.OwnerID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getStarTransactions#f096f8f1: field owner_id: %w", err) - } - b.Comma() - b.FieldStart("subscription_id") - b.PutString(g.SubscriptionID) - b.Comma() - b.FieldStart("direction") - if g.Direction == nil { - return fmt.Errorf("unable to encode getStarTransactions#f096f8f1: field direction is nil") - } - if err := g.Direction.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getStarTransactions#f096f8f1: field direction: %w", err) - } - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStarTransactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStarTransactions#f096f8f1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStarTransactions"); err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: %w", err) - } - case "owner_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: field owner_id: %w", err) - } - g.OwnerID = value - case "subscription_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: field subscription_id: %w", err) - } - g.SubscriptionID = value - case "direction": - value, err := DecodeTDLibJSONStarTransactionDirection(b) - if err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: field direction: %w", err) - } - g.Direction = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStarTransactions#f096f8f1: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOwnerID returns value of OwnerID field. -func (g *GetStarTransactionsRequest) GetOwnerID() (value MessageSenderClass) { - if g == nil { - return - } - return g.OwnerID -} - -// GetSubscriptionID returns value of SubscriptionID field. -func (g *GetStarTransactionsRequest) GetSubscriptionID() (value string) { - if g == nil { - return - } - return g.SubscriptionID -} - -// GetDirection returns value of Direction field. -func (g *GetStarTransactionsRequest) GetDirection() (value StarTransactionDirectionClass) { - if g == nil { - return - } - return g.Direction -} - -// GetOffset returns value of Offset field. -func (g *GetStarTransactionsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetStarTransactionsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetStarTransactions invokes method getStarTransactions#f096f8f1 returning error if any. -func (c *Client) GetStarTransactions(ctx context.Context, request *GetStarTransactionsRequest) (*StarTransactions, error) { - var result StarTransactions - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_star_withdrawal_url_gen.go b/tdapi/tl_get_star_withdrawal_url_gen.go deleted file mode 100644 index fa3e822b2..000000000 --- a/tdapi/tl_get_star_withdrawal_url_gen.go +++ /dev/null @@ -1,283 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStarWithdrawalURLRequest represents TL type `getStarWithdrawalUrl#a9d23712`. -type GetStarWithdrawalURLRequest struct { - // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or - // identifier of an owned channel chat - OwnerID MessageSenderClass - // The number of Telegram Stars to withdraw. Must be at least - // getOption("star_withdrawal_count_min") - StarCount int64 - // The 2-step verification password of the current user - Password string -} - -// GetStarWithdrawalURLRequestTypeID is TL type id of GetStarWithdrawalURLRequest. -const GetStarWithdrawalURLRequestTypeID = 0xa9d23712 - -// Ensuring interfaces in compile-time for GetStarWithdrawalURLRequest. -var ( - _ bin.Encoder = &GetStarWithdrawalURLRequest{} - _ bin.Decoder = &GetStarWithdrawalURLRequest{} - _ bin.BareEncoder = &GetStarWithdrawalURLRequest{} - _ bin.BareDecoder = &GetStarWithdrawalURLRequest{} -) - -func (g *GetStarWithdrawalURLRequest) Zero() bool { - if g == nil { - return true - } - if !(g.OwnerID == nil) { - return false - } - if !(g.StarCount == 0) { - return false - } - if !(g.Password == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStarWithdrawalURLRequest) String() string { - if g == nil { - return "GetStarWithdrawalURLRequest(nil)" - } - type Alias GetStarWithdrawalURLRequest - return fmt.Sprintf("GetStarWithdrawalURLRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStarWithdrawalURLRequest) TypeID() uint32 { - return GetStarWithdrawalURLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStarWithdrawalURLRequest) TypeName() string { - return "getStarWithdrawalUrl" -} - -// TypeInfo returns info about TL type. -func (g *GetStarWithdrawalURLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStarWithdrawalUrl", - ID: GetStarWithdrawalURLRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OwnerID", - SchemaName: "owner_id", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStarWithdrawalURLRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarWithdrawalUrl#a9d23712 as nil") - } - b.PutID(GetStarWithdrawalURLRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStarWithdrawalURLRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStarWithdrawalUrl#a9d23712 as nil") - } - if g.OwnerID == nil { - return fmt.Errorf("unable to encode getStarWithdrawalUrl#a9d23712: field owner_id is nil") - } - if err := g.OwnerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode getStarWithdrawalUrl#a9d23712: field owner_id: %w", err) - } - b.PutInt53(g.StarCount) - b.PutString(g.Password) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStarWithdrawalURLRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarWithdrawalUrl#a9d23712 to nil") - } - if err := b.ConsumeID(GetStarWithdrawalURLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStarWithdrawalUrl#a9d23712: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStarWithdrawalURLRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStarWithdrawalUrl#a9d23712 to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode getStarWithdrawalUrl#a9d23712: field owner_id: %w", err) - } - g.OwnerID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStarWithdrawalUrl#a9d23712: field star_count: %w", err) - } - g.StarCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStarWithdrawalUrl#a9d23712: field password: %w", err) - } - g.Password = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStarWithdrawalURLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStarWithdrawalUrl#a9d23712 as nil") - } - b.ObjStart() - b.PutID("getStarWithdrawalUrl") - b.Comma() - b.FieldStart("owner_id") - if g.OwnerID == nil { - return fmt.Errorf("unable to encode getStarWithdrawalUrl#a9d23712: field owner_id is nil") - } - if err := g.OwnerID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getStarWithdrawalUrl#a9d23712: field owner_id: %w", err) - } - b.Comma() - b.FieldStart("star_count") - b.PutInt53(g.StarCount) - b.Comma() - b.FieldStart("password") - b.PutString(g.Password) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStarWithdrawalURLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStarWithdrawalUrl#a9d23712 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStarWithdrawalUrl"); err != nil { - return fmt.Errorf("unable to decode getStarWithdrawalUrl#a9d23712: %w", err) - } - case "owner_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode getStarWithdrawalUrl#a9d23712: field owner_id: %w", err) - } - g.OwnerID = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStarWithdrawalUrl#a9d23712: field star_count: %w", err) - } - g.StarCount = value - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStarWithdrawalUrl#a9d23712: field password: %w", err) - } - g.Password = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOwnerID returns value of OwnerID field. -func (g *GetStarWithdrawalURLRequest) GetOwnerID() (value MessageSenderClass) { - if g == nil { - return - } - return g.OwnerID -} - -// GetStarCount returns value of StarCount field. -func (g *GetStarWithdrawalURLRequest) GetStarCount() (value int64) { - if g == nil { - return - } - return g.StarCount -} - -// GetPassword returns value of Password field. -func (g *GetStarWithdrawalURLRequest) GetPassword() (value string) { - if g == nil { - return - } - return g.Password -} - -// GetStarWithdrawalURL invokes method getStarWithdrawalUrl#a9d23712 returning error if any. -func (c *Client) GetStarWithdrawalURL(ctx context.Context, request *GetStarWithdrawalURLRequest) (*HTTPURL, error) { - var result HTTPURL - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_statistical_graph_gen.go b/tdapi/tl_get_statistical_graph_gen.go deleted file mode 100644 index 83f0a3271..000000000 --- a/tdapi/tl_get_statistical_graph_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStatisticalGraphRequest represents TL type `getStatisticalGraph#419f8d9b`. -type GetStatisticalGraphRequest struct { - // Chat identifier - ChatID int64 - // The token for graph loading - Token string - // X-value for zoomed in graph or 0 otherwise - X int64 -} - -// GetStatisticalGraphRequestTypeID is TL type id of GetStatisticalGraphRequest. -const GetStatisticalGraphRequestTypeID = 0x419f8d9b - -// Ensuring interfaces in compile-time for GetStatisticalGraphRequest. -var ( - _ bin.Encoder = &GetStatisticalGraphRequest{} - _ bin.Decoder = &GetStatisticalGraphRequest{} - _ bin.BareEncoder = &GetStatisticalGraphRequest{} - _ bin.BareDecoder = &GetStatisticalGraphRequest{} -) - -func (g *GetStatisticalGraphRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.Token == "") { - return false - } - if !(g.X == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStatisticalGraphRequest) String() string { - if g == nil { - return "GetStatisticalGraphRequest(nil)" - } - type Alias GetStatisticalGraphRequest - return fmt.Sprintf("GetStatisticalGraphRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStatisticalGraphRequest) TypeID() uint32 { - return GetStatisticalGraphRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStatisticalGraphRequest) TypeName() string { - return "getStatisticalGraph" -} - -// TypeInfo returns info about TL type. -func (g *GetStatisticalGraphRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStatisticalGraph", - ID: GetStatisticalGraphRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Token", - SchemaName: "token", - }, - { - Name: "X", - SchemaName: "x", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStatisticalGraphRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStatisticalGraph#419f8d9b as nil") - } - b.PutID(GetStatisticalGraphRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStatisticalGraphRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStatisticalGraph#419f8d9b as nil") - } - b.PutInt53(g.ChatID) - b.PutString(g.Token) - b.PutInt53(g.X) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStatisticalGraphRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStatisticalGraph#419f8d9b to nil") - } - if err := b.ConsumeID(GetStatisticalGraphRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStatisticalGraph#419f8d9b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStatisticalGraphRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStatisticalGraph#419f8d9b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStatisticalGraph#419f8d9b: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStatisticalGraph#419f8d9b: field token: %w", err) - } - g.Token = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStatisticalGraph#419f8d9b: field x: %w", err) - } - g.X = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStatisticalGraphRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStatisticalGraph#419f8d9b as nil") - } - b.ObjStart() - b.PutID("getStatisticalGraph") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("token") - b.PutString(g.Token) - b.Comma() - b.FieldStart("x") - b.PutInt53(g.X) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStatisticalGraphRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStatisticalGraph#419f8d9b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStatisticalGraph"); err != nil { - return fmt.Errorf("unable to decode getStatisticalGraph#419f8d9b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStatisticalGraph#419f8d9b: field chat_id: %w", err) - } - g.ChatID = value - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStatisticalGraph#419f8d9b: field token: %w", err) - } - g.Token = value - case "x": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStatisticalGraph#419f8d9b: field x: %w", err) - } - g.X = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetStatisticalGraphRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetToken returns value of Token field. -func (g *GetStatisticalGraphRequest) GetToken() (value string) { - if g == nil { - return - } - return g.Token -} - -// GetX returns value of X field. -func (g *GetStatisticalGraphRequest) GetX() (value int64) { - if g == nil { - return - } - return g.X -} - -// GetStatisticalGraph invokes method getStatisticalGraph#419f8d9b returning error if any. -func (c *Client) GetStatisticalGraph(ctx context.Context, request *GetStatisticalGraphRequest) (StatisticalGraphClass, error) { - var result StatisticalGraphBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.StatisticalGraph, nil -} diff --git a/tdapi/tl_get_sticker_emojis_gen.go b/tdapi/tl_get_sticker_emojis_gen.go deleted file mode 100644 index 2f32f682b..000000000 --- a/tdapi/tl_get_sticker_emojis_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStickerEmojisRequest represents TL type `getStickerEmojis#8f04d547`. -type GetStickerEmojisRequest struct { - // Sticker file identifier - Sticker InputFileClass -} - -// GetStickerEmojisRequestTypeID is TL type id of GetStickerEmojisRequest. -const GetStickerEmojisRequestTypeID = 0x8f04d547 - -// Ensuring interfaces in compile-time for GetStickerEmojisRequest. -var ( - _ bin.Encoder = &GetStickerEmojisRequest{} - _ bin.Decoder = &GetStickerEmojisRequest{} - _ bin.BareEncoder = &GetStickerEmojisRequest{} - _ bin.BareDecoder = &GetStickerEmojisRequest{} -) - -func (g *GetStickerEmojisRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Sticker == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStickerEmojisRequest) String() string { - if g == nil { - return "GetStickerEmojisRequest(nil)" - } - type Alias GetStickerEmojisRequest - return fmt.Sprintf("GetStickerEmojisRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStickerEmojisRequest) TypeID() uint32 { - return GetStickerEmojisRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStickerEmojisRequest) TypeName() string { - return "getStickerEmojis" -} - -// TypeInfo returns info about TL type. -func (g *GetStickerEmojisRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStickerEmojis", - ID: GetStickerEmojisRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStickerEmojisRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStickerEmojis#8f04d547 as nil") - } - b.PutID(GetStickerEmojisRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStickerEmojisRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStickerEmojis#8f04d547 as nil") - } - if g.Sticker == nil { - return fmt.Errorf("unable to encode getStickerEmojis#8f04d547: field sticker is nil") - } - if err := g.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode getStickerEmojis#8f04d547: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStickerEmojisRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStickerEmojis#8f04d547 to nil") - } - if err := b.ConsumeID(GetStickerEmojisRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStickerEmojis#8f04d547: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStickerEmojisRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStickerEmojis#8f04d547 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode getStickerEmojis#8f04d547: field sticker: %w", err) - } - g.Sticker = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStickerEmojisRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStickerEmojis#8f04d547 as nil") - } - b.ObjStart() - b.PutID("getStickerEmojis") - b.Comma() - b.FieldStart("sticker") - if g.Sticker == nil { - return fmt.Errorf("unable to encode getStickerEmojis#8f04d547: field sticker is nil") - } - if err := g.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getStickerEmojis#8f04d547: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStickerEmojisRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStickerEmojis#8f04d547 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStickerEmojis"); err != nil { - return fmt.Errorf("unable to decode getStickerEmojis#8f04d547: %w", err) - } - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode getStickerEmojis#8f04d547: field sticker: %w", err) - } - g.Sticker = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (g *GetStickerEmojisRequest) GetSticker() (value InputFileClass) { - if g == nil { - return - } - return g.Sticker -} - -// GetStickerEmojis invokes method getStickerEmojis#8f04d547 returning error if any. -func (c *Client) GetStickerEmojis(ctx context.Context, sticker InputFileClass) (*Emojis, error) { - var result Emojis - - request := &GetStickerEmojisRequest{ - Sticker: sticker, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_sticker_outline_gen.go b/tdapi/tl_get_sticker_outline_gen.go deleted file mode 100644 index f09f65965..000000000 --- a/tdapi/tl_get_sticker_outline_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStickerOutlineRequest represents TL type `getStickerOutline#a3952da5`. -type GetStickerOutlineRequest struct { - // File identifier of the sticker - StickerFileID int32 - // Pass true to get the outline scaled for animated emoji - ForAnimatedEmoji bool - // Pass true to get the outline scaled for clicked animated emoji message - ForClickedAnimatedEmojiMessage bool -} - -// GetStickerOutlineRequestTypeID is TL type id of GetStickerOutlineRequest. -const GetStickerOutlineRequestTypeID = 0xa3952da5 - -// Ensuring interfaces in compile-time for GetStickerOutlineRequest. -var ( - _ bin.Encoder = &GetStickerOutlineRequest{} - _ bin.Decoder = &GetStickerOutlineRequest{} - _ bin.BareEncoder = &GetStickerOutlineRequest{} - _ bin.BareDecoder = &GetStickerOutlineRequest{} -) - -func (g *GetStickerOutlineRequest) Zero() bool { - if g == nil { - return true - } - if !(g.StickerFileID == 0) { - return false - } - if !(g.ForAnimatedEmoji == false) { - return false - } - if !(g.ForClickedAnimatedEmojiMessage == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStickerOutlineRequest) String() string { - if g == nil { - return "GetStickerOutlineRequest(nil)" - } - type Alias GetStickerOutlineRequest - return fmt.Sprintf("GetStickerOutlineRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStickerOutlineRequest) TypeID() uint32 { - return GetStickerOutlineRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStickerOutlineRequest) TypeName() string { - return "getStickerOutline" -} - -// TypeInfo returns info about TL type. -func (g *GetStickerOutlineRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStickerOutline", - ID: GetStickerOutlineRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerFileID", - SchemaName: "sticker_file_id", - }, - { - Name: "ForAnimatedEmoji", - SchemaName: "for_animated_emoji", - }, - { - Name: "ForClickedAnimatedEmojiMessage", - SchemaName: "for_clicked_animated_emoji_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStickerOutlineRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStickerOutline#a3952da5 as nil") - } - b.PutID(GetStickerOutlineRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStickerOutlineRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStickerOutline#a3952da5 as nil") - } - b.PutInt32(g.StickerFileID) - b.PutBool(g.ForAnimatedEmoji) - b.PutBool(g.ForClickedAnimatedEmojiMessage) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStickerOutlineRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStickerOutline#a3952da5 to nil") - } - if err := b.ConsumeID(GetStickerOutlineRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStickerOutline#a3952da5: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStickerOutlineRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStickerOutline#a3952da5 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStickerOutline#a3952da5: field sticker_file_id: %w", err) - } - g.StickerFileID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStickerOutline#a3952da5: field for_animated_emoji: %w", err) - } - g.ForAnimatedEmoji = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStickerOutline#a3952da5: field for_clicked_animated_emoji_message: %w", err) - } - g.ForClickedAnimatedEmojiMessage = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStickerOutlineRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStickerOutline#a3952da5 as nil") - } - b.ObjStart() - b.PutID("getStickerOutline") - b.Comma() - b.FieldStart("sticker_file_id") - b.PutInt32(g.StickerFileID) - b.Comma() - b.FieldStart("for_animated_emoji") - b.PutBool(g.ForAnimatedEmoji) - b.Comma() - b.FieldStart("for_clicked_animated_emoji_message") - b.PutBool(g.ForClickedAnimatedEmojiMessage) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStickerOutlineRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStickerOutline#a3952da5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStickerOutline"); err != nil { - return fmt.Errorf("unable to decode getStickerOutline#a3952da5: %w", err) - } - case "sticker_file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStickerOutline#a3952da5: field sticker_file_id: %w", err) - } - g.StickerFileID = value - case "for_animated_emoji": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStickerOutline#a3952da5: field for_animated_emoji: %w", err) - } - g.ForAnimatedEmoji = value - case "for_clicked_animated_emoji_message": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStickerOutline#a3952da5: field for_clicked_animated_emoji_message: %w", err) - } - g.ForClickedAnimatedEmojiMessage = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerFileID returns value of StickerFileID field. -func (g *GetStickerOutlineRequest) GetStickerFileID() (value int32) { - if g == nil { - return - } - return g.StickerFileID -} - -// GetForAnimatedEmoji returns value of ForAnimatedEmoji field. -func (g *GetStickerOutlineRequest) GetForAnimatedEmoji() (value bool) { - if g == nil { - return - } - return g.ForAnimatedEmoji -} - -// GetForClickedAnimatedEmojiMessage returns value of ForClickedAnimatedEmojiMessage field. -func (g *GetStickerOutlineRequest) GetForClickedAnimatedEmojiMessage() (value bool) { - if g == nil { - return - } - return g.ForClickedAnimatedEmojiMessage -} - -// GetStickerOutline invokes method getStickerOutline#a3952da5 returning error if any. -func (c *Client) GetStickerOutline(ctx context.Context, request *GetStickerOutlineRequest) (*Outline, error) { - var result Outline - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_sticker_set_gen.go b/tdapi/tl_get_sticker_set_gen.go deleted file mode 100644 index 68d7442d2..000000000 --- a/tdapi/tl_get_sticker_set_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStickerSetRequest represents TL type `getStickerSet#3eb91bc3`. -type GetStickerSetRequest struct { - // Identifier of the sticker set - SetID int64 -} - -// GetStickerSetRequestTypeID is TL type id of GetStickerSetRequest. -const GetStickerSetRequestTypeID = 0x3eb91bc3 - -// Ensuring interfaces in compile-time for GetStickerSetRequest. -var ( - _ bin.Encoder = &GetStickerSetRequest{} - _ bin.Decoder = &GetStickerSetRequest{} - _ bin.BareEncoder = &GetStickerSetRequest{} - _ bin.BareDecoder = &GetStickerSetRequest{} -) - -func (g *GetStickerSetRequest) Zero() bool { - if g == nil { - return true - } - if !(g.SetID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStickerSetRequest) String() string { - if g == nil { - return "GetStickerSetRequest(nil)" - } - type Alias GetStickerSetRequest - return fmt.Sprintf("GetStickerSetRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStickerSetRequest) TypeID() uint32 { - return GetStickerSetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStickerSetRequest) TypeName() string { - return "getStickerSet" -} - -// TypeInfo returns info about TL type. -func (g *GetStickerSetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStickerSet", - ID: GetStickerSetRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SetID", - SchemaName: "set_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStickerSetRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStickerSet#3eb91bc3 as nil") - } - b.PutID(GetStickerSetRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStickerSetRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStickerSet#3eb91bc3 as nil") - } - b.PutLong(g.SetID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStickerSetRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStickerSet#3eb91bc3 to nil") - } - if err := b.ConsumeID(GetStickerSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStickerSet#3eb91bc3: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStickerSetRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStickerSet#3eb91bc3 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getStickerSet#3eb91bc3: field set_id: %w", err) - } - g.SetID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStickerSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStickerSet#3eb91bc3 as nil") - } - b.ObjStart() - b.PutID("getStickerSet") - b.Comma() - b.FieldStart("set_id") - b.PutLong(g.SetID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStickerSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStickerSet#3eb91bc3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStickerSet"); err != nil { - return fmt.Errorf("unable to decode getStickerSet#3eb91bc3: %w", err) - } - case "set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getStickerSet#3eb91bc3: field set_id: %w", err) - } - g.SetID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSetID returns value of SetID field. -func (g *GetStickerSetRequest) GetSetID() (value int64) { - if g == nil { - return - } - return g.SetID -} - -// GetStickerSet invokes method getStickerSet#3eb91bc3 returning error if any. -func (c *Client) GetStickerSet(ctx context.Context, setid int64) (*StickerSet, error) { - var result StickerSet - - request := &GetStickerSetRequest{ - SetID: setid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_sticker_set_name_gen.go b/tdapi/tl_get_sticker_set_name_gen.go deleted file mode 100644 index 674b125a3..000000000 --- a/tdapi/tl_get_sticker_set_name_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStickerSetNameRequest represents TL type `getStickerSetName#3dfad681`. -type GetStickerSetNameRequest struct { - // Identifier of the sticker set - SetID int64 -} - -// GetStickerSetNameRequestTypeID is TL type id of GetStickerSetNameRequest. -const GetStickerSetNameRequestTypeID = 0x3dfad681 - -// Ensuring interfaces in compile-time for GetStickerSetNameRequest. -var ( - _ bin.Encoder = &GetStickerSetNameRequest{} - _ bin.Decoder = &GetStickerSetNameRequest{} - _ bin.BareEncoder = &GetStickerSetNameRequest{} - _ bin.BareDecoder = &GetStickerSetNameRequest{} -) - -func (g *GetStickerSetNameRequest) Zero() bool { - if g == nil { - return true - } - if !(g.SetID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStickerSetNameRequest) String() string { - if g == nil { - return "GetStickerSetNameRequest(nil)" - } - type Alias GetStickerSetNameRequest - return fmt.Sprintf("GetStickerSetNameRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStickerSetNameRequest) TypeID() uint32 { - return GetStickerSetNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStickerSetNameRequest) TypeName() string { - return "getStickerSetName" -} - -// TypeInfo returns info about TL type. -func (g *GetStickerSetNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStickerSetName", - ID: GetStickerSetNameRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SetID", - SchemaName: "set_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStickerSetNameRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStickerSetName#3dfad681 as nil") - } - b.PutID(GetStickerSetNameRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStickerSetNameRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStickerSetName#3dfad681 as nil") - } - b.PutLong(g.SetID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStickerSetNameRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStickerSetName#3dfad681 to nil") - } - if err := b.ConsumeID(GetStickerSetNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStickerSetName#3dfad681: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStickerSetNameRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStickerSetName#3dfad681 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getStickerSetName#3dfad681: field set_id: %w", err) - } - g.SetID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStickerSetNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStickerSetName#3dfad681 as nil") - } - b.ObjStart() - b.PutID("getStickerSetName") - b.Comma() - b.FieldStart("set_id") - b.PutLong(g.SetID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStickerSetNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStickerSetName#3dfad681 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStickerSetName"); err != nil { - return fmt.Errorf("unable to decode getStickerSetName#3dfad681: %w", err) - } - case "set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode getStickerSetName#3dfad681: field set_id: %w", err) - } - g.SetID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSetID returns value of SetID field. -func (g *GetStickerSetNameRequest) GetSetID() (value int64) { - if g == nil { - return - } - return g.SetID -} - -// GetStickerSetName invokes method getStickerSetName#3dfad681 returning error if any. -func (c *Client) GetStickerSetName(ctx context.Context, setid int64) (*Text, error) { - var result Text - - request := &GetStickerSetNameRequest{ - SetID: setid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_stickers_gen.go b/tdapi/tl_get_stickers_gen.go deleted file mode 100644 index 4f8da3535..000000000 --- a/tdapi/tl_get_stickers_gen.go +++ /dev/null @@ -1,317 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStickersRequest represents TL type `getStickers#45069343`. -type GetStickersRequest struct { - // Type of the stickers to return - StickerType StickerTypeClass - // Search query; a space-separated list of emojis or a keyword prefix. If empty, returns - // all known installed stickers - Query string - // The maximum number of stickers to be returned - Limit int32 - // Chat identifier for which to return stickers. Available custom emoji stickers may be - // different for different chats - ChatID int64 -} - -// GetStickersRequestTypeID is TL type id of GetStickersRequest. -const GetStickersRequestTypeID = 0x45069343 - -// Ensuring interfaces in compile-time for GetStickersRequest. -var ( - _ bin.Encoder = &GetStickersRequest{} - _ bin.Decoder = &GetStickersRequest{} - _ bin.BareEncoder = &GetStickersRequest{} - _ bin.BareDecoder = &GetStickersRequest{} -) - -func (g *GetStickersRequest) Zero() bool { - if g == nil { - return true - } - if !(g.StickerType == nil) { - return false - } - if !(g.Query == "") { - return false - } - if !(g.Limit == 0) { - return false - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStickersRequest) String() string { - if g == nil { - return "GetStickersRequest(nil)" - } - type Alias GetStickersRequest - return fmt.Sprintf("GetStickersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStickersRequest) TypeID() uint32 { - return GetStickersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStickersRequest) TypeName() string { - return "getStickers" -} - -// TypeInfo returns info about TL type. -func (g *GetStickersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStickers", - ID: GetStickersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStickersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStickers#45069343 as nil") - } - b.PutID(GetStickersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStickersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStickers#45069343 as nil") - } - if g.StickerType == nil { - return fmt.Errorf("unable to encode getStickers#45069343: field sticker_type is nil") - } - if err := g.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode getStickers#45069343: field sticker_type: %w", err) - } - b.PutString(g.Query) - b.PutInt32(g.Limit) - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStickersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStickers#45069343 to nil") - } - if err := b.ConsumeID(GetStickersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStickers#45069343: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStickersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStickers#45069343 to nil") - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode getStickers#45069343: field sticker_type: %w", err) - } - g.StickerType = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStickers#45069343: field query: %w", err) - } - g.Query = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStickers#45069343: field limit: %w", err) - } - g.Limit = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStickers#45069343: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStickers#45069343 as nil") - } - b.ObjStart() - b.PutID("getStickers") - b.Comma() - b.FieldStart("sticker_type") - if g.StickerType == nil { - return fmt.Errorf("unable to encode getStickers#45069343: field sticker_type is nil") - } - if err := g.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getStickers#45069343: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("query") - b.PutString(g.Query) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStickers#45069343 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStickers"); err != nil { - return fmt.Errorf("unable to decode getStickers#45069343: %w", err) - } - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode getStickers#45069343: field sticker_type: %w", err) - } - g.StickerType = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStickers#45069343: field query: %w", err) - } - g.Query = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStickers#45069343: field limit: %w", err) - } - g.Limit = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStickers#45069343: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerType returns value of StickerType field. -func (g *GetStickersRequest) GetStickerType() (value StickerTypeClass) { - if g == nil { - return - } - return g.StickerType -} - -// GetQuery returns value of Query field. -func (g *GetStickersRequest) GetQuery() (value string) { - if g == nil { - return - } - return g.Query -} - -// GetLimit returns value of Limit field. -func (g *GetStickersRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetChatID returns value of ChatID field. -func (g *GetStickersRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetStickers invokes method getStickers#45069343 returning error if any. -func (c *Client) GetStickers(ctx context.Context, request *GetStickersRequest) (*Stickers, error) { - var result Stickers - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_storage_statistics_fast_gen.go b/tdapi/tl_get_storage_statistics_fast_gen.go deleted file mode 100644 index 041784ec1..000000000 --- a/tdapi/tl_get_storage_statistics_fast_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStorageStatisticsFastRequest represents TL type `getStorageStatisticsFast#3a86702`. -type GetStorageStatisticsFastRequest struct { -} - -// GetStorageStatisticsFastRequestTypeID is TL type id of GetStorageStatisticsFastRequest. -const GetStorageStatisticsFastRequestTypeID = 0x3a86702 - -// Ensuring interfaces in compile-time for GetStorageStatisticsFastRequest. -var ( - _ bin.Encoder = &GetStorageStatisticsFastRequest{} - _ bin.Decoder = &GetStorageStatisticsFastRequest{} - _ bin.BareEncoder = &GetStorageStatisticsFastRequest{} - _ bin.BareDecoder = &GetStorageStatisticsFastRequest{} -) - -func (g *GetStorageStatisticsFastRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStorageStatisticsFastRequest) String() string { - if g == nil { - return "GetStorageStatisticsFastRequest(nil)" - } - type Alias GetStorageStatisticsFastRequest - return fmt.Sprintf("GetStorageStatisticsFastRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStorageStatisticsFastRequest) TypeID() uint32 { - return GetStorageStatisticsFastRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStorageStatisticsFastRequest) TypeName() string { - return "getStorageStatisticsFast" -} - -// TypeInfo returns info about TL type. -func (g *GetStorageStatisticsFastRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStorageStatisticsFast", - ID: GetStorageStatisticsFastRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStorageStatisticsFastRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStorageStatisticsFast#3a86702 as nil") - } - b.PutID(GetStorageStatisticsFastRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStorageStatisticsFastRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStorageStatisticsFast#3a86702 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStorageStatisticsFastRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStorageStatisticsFast#3a86702 to nil") - } - if err := b.ConsumeID(GetStorageStatisticsFastRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStorageStatisticsFast#3a86702: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStorageStatisticsFastRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStorageStatisticsFast#3a86702 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStorageStatisticsFastRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStorageStatisticsFast#3a86702 as nil") - } - b.ObjStart() - b.PutID("getStorageStatisticsFast") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStorageStatisticsFastRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStorageStatisticsFast#3a86702 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStorageStatisticsFast"); err != nil { - return fmt.Errorf("unable to decode getStorageStatisticsFast#3a86702: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStorageStatisticsFast invokes method getStorageStatisticsFast#3a86702 returning error if any. -func (c *Client) GetStorageStatisticsFast(ctx context.Context) (*StorageStatisticsFast, error) { - var result StorageStatisticsFast - - request := &GetStorageStatisticsFastRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_storage_statistics_gen.go b/tdapi/tl_get_storage_statistics_gen.go deleted file mode 100644 index ed688ccd8..000000000 --- a/tdapi/tl_get_storage_statistics_gen.go +++ /dev/null @@ -1,209 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStorageStatisticsRequest represents TL type `getStorageStatistics#cd254b37`. -type GetStorageStatisticsRequest struct { - // The maximum number of chats with the largest storage usage for which separate - // statistics need to be returned. All other chats will be grouped in entries with - // chat_id == 0. If the chat info database is not used, the chat_limit is ignored and is - // always set to 0 - ChatLimit int32 -} - -// GetStorageStatisticsRequestTypeID is TL type id of GetStorageStatisticsRequest. -const GetStorageStatisticsRequestTypeID = 0xcd254b37 - -// Ensuring interfaces in compile-time for GetStorageStatisticsRequest. -var ( - _ bin.Encoder = &GetStorageStatisticsRequest{} - _ bin.Decoder = &GetStorageStatisticsRequest{} - _ bin.BareEncoder = &GetStorageStatisticsRequest{} - _ bin.BareDecoder = &GetStorageStatisticsRequest{} -) - -func (g *GetStorageStatisticsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatLimit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStorageStatisticsRequest) String() string { - if g == nil { - return "GetStorageStatisticsRequest(nil)" - } - type Alias GetStorageStatisticsRequest - return fmt.Sprintf("GetStorageStatisticsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStorageStatisticsRequest) TypeID() uint32 { - return GetStorageStatisticsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStorageStatisticsRequest) TypeName() string { - return "getStorageStatistics" -} - -// TypeInfo returns info about TL type. -func (g *GetStorageStatisticsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStorageStatistics", - ID: GetStorageStatisticsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatLimit", - SchemaName: "chat_limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStorageStatisticsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStorageStatistics#cd254b37 as nil") - } - b.PutID(GetStorageStatisticsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStorageStatisticsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStorageStatistics#cd254b37 as nil") - } - b.PutInt32(g.ChatLimit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStorageStatisticsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStorageStatistics#cd254b37 to nil") - } - if err := b.ConsumeID(GetStorageStatisticsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStorageStatistics#cd254b37: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStorageStatisticsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStorageStatistics#cd254b37 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStorageStatistics#cd254b37: field chat_limit: %w", err) - } - g.ChatLimit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStorageStatisticsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStorageStatistics#cd254b37 as nil") - } - b.ObjStart() - b.PutID("getStorageStatistics") - b.Comma() - b.FieldStart("chat_limit") - b.PutInt32(g.ChatLimit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStorageStatisticsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStorageStatistics#cd254b37 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStorageStatistics"); err != nil { - return fmt.Errorf("unable to decode getStorageStatistics#cd254b37: %w", err) - } - case "chat_limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStorageStatistics#cd254b37: field chat_limit: %w", err) - } - g.ChatLimit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatLimit returns value of ChatLimit field. -func (g *GetStorageStatisticsRequest) GetChatLimit() (value int32) { - if g == nil { - return - } - return g.ChatLimit -} - -// GetStorageStatistics invokes method getStorageStatistics#cd254b37 returning error if any. -func (c *Client) GetStorageStatistics(ctx context.Context, chatlimit int32) (*StorageStatistics, error) { - var result StorageStatistics - - request := &GetStorageStatisticsRequest{ - ChatLimit: chatlimit, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_story_available_reactions_gen.go b/tdapi/tl_get_story_available_reactions_gen.go deleted file mode 100644 index 57c8d06af..000000000 --- a/tdapi/tl_get_story_available_reactions_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStoryAvailableReactionsRequest represents TL type `getStoryAvailableReactions#23854d3b`. -type GetStoryAvailableReactionsRequest struct { - // Number of reaction per row, 5-25 - RowSize int32 -} - -// GetStoryAvailableReactionsRequestTypeID is TL type id of GetStoryAvailableReactionsRequest. -const GetStoryAvailableReactionsRequestTypeID = 0x23854d3b - -// Ensuring interfaces in compile-time for GetStoryAvailableReactionsRequest. -var ( - _ bin.Encoder = &GetStoryAvailableReactionsRequest{} - _ bin.Decoder = &GetStoryAvailableReactionsRequest{} - _ bin.BareEncoder = &GetStoryAvailableReactionsRequest{} - _ bin.BareDecoder = &GetStoryAvailableReactionsRequest{} -) - -func (g *GetStoryAvailableReactionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.RowSize == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStoryAvailableReactionsRequest) String() string { - if g == nil { - return "GetStoryAvailableReactionsRequest(nil)" - } - type Alias GetStoryAvailableReactionsRequest - return fmt.Sprintf("GetStoryAvailableReactionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStoryAvailableReactionsRequest) TypeID() uint32 { - return GetStoryAvailableReactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStoryAvailableReactionsRequest) TypeName() string { - return "getStoryAvailableReactions" -} - -// TypeInfo returns info about TL type. -func (g *GetStoryAvailableReactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStoryAvailableReactions", - ID: GetStoryAvailableReactionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RowSize", - SchemaName: "row_size", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStoryAvailableReactionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStoryAvailableReactions#23854d3b as nil") - } - b.PutID(GetStoryAvailableReactionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStoryAvailableReactionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStoryAvailableReactions#23854d3b as nil") - } - b.PutInt32(g.RowSize) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStoryAvailableReactionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStoryAvailableReactions#23854d3b to nil") - } - if err := b.ConsumeID(GetStoryAvailableReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStoryAvailableReactions#23854d3b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStoryAvailableReactionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStoryAvailableReactions#23854d3b to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryAvailableReactions#23854d3b: field row_size: %w", err) - } - g.RowSize = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStoryAvailableReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStoryAvailableReactions#23854d3b as nil") - } - b.ObjStart() - b.PutID("getStoryAvailableReactions") - b.Comma() - b.FieldStart("row_size") - b.PutInt32(g.RowSize) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStoryAvailableReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStoryAvailableReactions#23854d3b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStoryAvailableReactions"); err != nil { - return fmt.Errorf("unable to decode getStoryAvailableReactions#23854d3b: %w", err) - } - case "row_size": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryAvailableReactions#23854d3b: field row_size: %w", err) - } - g.RowSize = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRowSize returns value of RowSize field. -func (g *GetStoryAvailableReactionsRequest) GetRowSize() (value int32) { - if g == nil { - return - } - return g.RowSize -} - -// GetStoryAvailableReactions invokes method getStoryAvailableReactions#23854d3b returning error if any. -func (c *Client) GetStoryAvailableReactions(ctx context.Context, rowsize int32) (*AvailableReactions, error) { - var result AvailableReactions - - request := &GetStoryAvailableReactionsRequest{ - RowSize: rowsize, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_story_gen.go b/tdapi/tl_get_story_gen.go deleted file mode 100644 index b82c835ee..000000000 --- a/tdapi/tl_get_story_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStoryRequest represents TL type `getStory#717b1c78`. -type GetStoryRequest struct { - // Identifier of the chat that posted the story - StorySenderChatID int64 - // Story identifier - StoryID int32 - // Pass true to get only locally available information without sending network requests - OnlyLocal bool -} - -// GetStoryRequestTypeID is TL type id of GetStoryRequest. -const GetStoryRequestTypeID = 0x717b1c78 - -// Ensuring interfaces in compile-time for GetStoryRequest. -var ( - _ bin.Encoder = &GetStoryRequest{} - _ bin.Decoder = &GetStoryRequest{} - _ bin.BareEncoder = &GetStoryRequest{} - _ bin.BareDecoder = &GetStoryRequest{} -) - -func (g *GetStoryRequest) Zero() bool { - if g == nil { - return true - } - if !(g.StorySenderChatID == 0) { - return false - } - if !(g.StoryID == 0) { - return false - } - if !(g.OnlyLocal == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStoryRequest) String() string { - if g == nil { - return "GetStoryRequest(nil)" - } - type Alias GetStoryRequest - return fmt.Sprintf("GetStoryRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStoryRequest) TypeID() uint32 { - return GetStoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStoryRequest) TypeName() string { - return "getStory" -} - -// TypeInfo returns info about TL type. -func (g *GetStoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStory", - ID: GetStoryRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "OnlyLocal", - SchemaName: "only_local", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStoryRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStory#717b1c78 as nil") - } - b.PutID(GetStoryRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStoryRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStory#717b1c78 as nil") - } - b.PutInt53(g.StorySenderChatID) - b.PutInt32(g.StoryID) - b.PutBool(g.OnlyLocal) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStoryRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStory#717b1c78 to nil") - } - if err := b.ConsumeID(GetStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStory#717b1c78: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStoryRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStory#717b1c78 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStory#717b1c78: field story_sender_chat_id: %w", err) - } - g.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStory#717b1c78: field story_id: %w", err) - } - g.StoryID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStory#717b1c78: field only_local: %w", err) - } - g.OnlyLocal = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStory#717b1c78 as nil") - } - b.ObjStart() - b.PutID("getStory") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(g.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(g.StoryID) - b.Comma() - b.FieldStart("only_local") - b.PutBool(g.OnlyLocal) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStory#717b1c78 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStory"); err != nil { - return fmt.Errorf("unable to decode getStory#717b1c78: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStory#717b1c78: field story_sender_chat_id: %w", err) - } - g.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStory#717b1c78: field story_id: %w", err) - } - g.StoryID = value - case "only_local": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStory#717b1c78: field only_local: %w", err) - } - g.OnlyLocal = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (g *GetStoryRequest) GetStorySenderChatID() (value int64) { - if g == nil { - return - } - return g.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (g *GetStoryRequest) GetStoryID() (value int32) { - if g == nil { - return - } - return g.StoryID -} - -// GetOnlyLocal returns value of OnlyLocal field. -func (g *GetStoryRequest) GetOnlyLocal() (value bool) { - if g == nil { - return - } - return g.OnlyLocal -} - -// GetStory invokes method getStory#717b1c78 returning error if any. -func (c *Client) GetStory(ctx context.Context, request *GetStoryRequest) (*Story, error) { - var result Story - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_story_interactions_gen.go b/tdapi/tl_get_story_interactions_gen.go deleted file mode 100644 index 8d76c768b..000000000 --- a/tdapi/tl_get_story_interactions_gen.go +++ /dev/null @@ -1,412 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStoryInteractionsRequest represents TL type `getStoryInteractions#1cd1400d`. -type GetStoryInteractionsRequest struct { - // Story identifier - StoryID int32 - // Query to search for in names, usernames and titles; may be empty to get all relevant - // interactions - Query string - // Pass true to get only interactions by contacts; pass false to get all relevant - // interactions - OnlyContacts bool - // Pass true to get forwards and reposts first, then reactions, then other views; pass - // false to get interactions sorted just by interaction date - PreferForwards bool - // Pass true to get interactions with reaction first; pass false to get interactions - // sorted just by interaction date. Ignored if prefer_forwards == true - PreferWithReaction bool - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of story interactions to return - Limit int32 -} - -// GetStoryInteractionsRequestTypeID is TL type id of GetStoryInteractionsRequest. -const GetStoryInteractionsRequestTypeID = 0x1cd1400d - -// Ensuring interfaces in compile-time for GetStoryInteractionsRequest. -var ( - _ bin.Encoder = &GetStoryInteractionsRequest{} - _ bin.Decoder = &GetStoryInteractionsRequest{} - _ bin.BareEncoder = &GetStoryInteractionsRequest{} - _ bin.BareDecoder = &GetStoryInteractionsRequest{} -) - -func (g *GetStoryInteractionsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.StoryID == 0) { - return false - } - if !(g.Query == "") { - return false - } - if !(g.OnlyContacts == false) { - return false - } - if !(g.PreferForwards == false) { - return false - } - if !(g.PreferWithReaction == false) { - return false - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStoryInteractionsRequest) String() string { - if g == nil { - return "GetStoryInteractionsRequest(nil)" - } - type Alias GetStoryInteractionsRequest - return fmt.Sprintf("GetStoryInteractionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStoryInteractionsRequest) TypeID() uint32 { - return GetStoryInteractionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStoryInteractionsRequest) TypeName() string { - return "getStoryInteractions" -} - -// TypeInfo returns info about TL type. -func (g *GetStoryInteractionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStoryInteractions", - ID: GetStoryInteractionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "OnlyContacts", - SchemaName: "only_contacts", - }, - { - Name: "PreferForwards", - SchemaName: "prefer_forwards", - }, - { - Name: "PreferWithReaction", - SchemaName: "prefer_with_reaction", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStoryInteractionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStoryInteractions#1cd1400d as nil") - } - b.PutID(GetStoryInteractionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStoryInteractionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStoryInteractions#1cd1400d as nil") - } - b.PutInt32(g.StoryID) - b.PutString(g.Query) - b.PutBool(g.OnlyContacts) - b.PutBool(g.PreferForwards) - b.PutBool(g.PreferWithReaction) - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStoryInteractionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStoryInteractions#1cd1400d to nil") - } - if err := b.ConsumeID(GetStoryInteractionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStoryInteractionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStoryInteractions#1cd1400d to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field story_id: %w", err) - } - g.StoryID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field query: %w", err) - } - g.Query = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field only_contacts: %w", err) - } - g.OnlyContacts = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field prefer_forwards: %w", err) - } - g.PreferForwards = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field prefer_with_reaction: %w", err) - } - g.PreferWithReaction = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStoryInteractionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStoryInteractions#1cd1400d as nil") - } - b.ObjStart() - b.PutID("getStoryInteractions") - b.Comma() - b.FieldStart("story_id") - b.PutInt32(g.StoryID) - b.Comma() - b.FieldStart("query") - b.PutString(g.Query) - b.Comma() - b.FieldStart("only_contacts") - b.PutBool(g.OnlyContacts) - b.Comma() - b.FieldStart("prefer_forwards") - b.PutBool(g.PreferForwards) - b.Comma() - b.FieldStart("prefer_with_reaction") - b.PutBool(g.PreferWithReaction) - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStoryInteractionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStoryInteractions#1cd1400d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStoryInteractions"); err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: %w", err) - } - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field story_id: %w", err) - } - g.StoryID = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field query: %w", err) - } - g.Query = value - case "only_contacts": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field only_contacts: %w", err) - } - g.OnlyContacts = value - case "prefer_forwards": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field prefer_forwards: %w", err) - } - g.PreferForwards = value - case "prefer_with_reaction": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field prefer_with_reaction: %w", err) - } - g.PreferWithReaction = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryInteractions#1cd1400d: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStoryID returns value of StoryID field. -func (g *GetStoryInteractionsRequest) GetStoryID() (value int32) { - if g == nil { - return - } - return g.StoryID -} - -// GetQuery returns value of Query field. -func (g *GetStoryInteractionsRequest) GetQuery() (value string) { - if g == nil { - return - } - return g.Query -} - -// GetOnlyContacts returns value of OnlyContacts field. -func (g *GetStoryInteractionsRequest) GetOnlyContacts() (value bool) { - if g == nil { - return - } - return g.OnlyContacts -} - -// GetPreferForwards returns value of PreferForwards field. -func (g *GetStoryInteractionsRequest) GetPreferForwards() (value bool) { - if g == nil { - return - } - return g.PreferForwards -} - -// GetPreferWithReaction returns value of PreferWithReaction field. -func (g *GetStoryInteractionsRequest) GetPreferWithReaction() (value bool) { - if g == nil { - return - } - return g.PreferWithReaction -} - -// GetOffset returns value of Offset field. -func (g *GetStoryInteractionsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetStoryInteractionsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetStoryInteractions invokes method getStoryInteractions#1cd1400d returning error if any. -func (c *Client) GetStoryInteractions(ctx context.Context, request *GetStoryInteractionsRequest) (*StoryInteractions, error) { - var result StoryInteractions - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_story_notification_settings_exceptions_gen.go b/tdapi/tl_get_story_notification_settings_exceptions_gen.go deleted file mode 100644 index bb5ab3d89..000000000 --- a/tdapi/tl_get_story_notification_settings_exceptions_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStoryNotificationSettingsExceptionsRequest represents TL type `getStoryNotificationSettingsExceptions#256a2eb0`. -type GetStoryNotificationSettingsExceptionsRequest struct { -} - -// GetStoryNotificationSettingsExceptionsRequestTypeID is TL type id of GetStoryNotificationSettingsExceptionsRequest. -const GetStoryNotificationSettingsExceptionsRequestTypeID = 0x256a2eb0 - -// Ensuring interfaces in compile-time for GetStoryNotificationSettingsExceptionsRequest. -var ( - _ bin.Encoder = &GetStoryNotificationSettingsExceptionsRequest{} - _ bin.Decoder = &GetStoryNotificationSettingsExceptionsRequest{} - _ bin.BareEncoder = &GetStoryNotificationSettingsExceptionsRequest{} - _ bin.BareDecoder = &GetStoryNotificationSettingsExceptionsRequest{} -) - -func (g *GetStoryNotificationSettingsExceptionsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStoryNotificationSettingsExceptionsRequest) String() string { - if g == nil { - return "GetStoryNotificationSettingsExceptionsRequest(nil)" - } - type Alias GetStoryNotificationSettingsExceptionsRequest - return fmt.Sprintf("GetStoryNotificationSettingsExceptionsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStoryNotificationSettingsExceptionsRequest) TypeID() uint32 { - return GetStoryNotificationSettingsExceptionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStoryNotificationSettingsExceptionsRequest) TypeName() string { - return "getStoryNotificationSettingsExceptions" -} - -// TypeInfo returns info about TL type. -func (g *GetStoryNotificationSettingsExceptionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStoryNotificationSettingsExceptions", - ID: GetStoryNotificationSettingsExceptionsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStoryNotificationSettingsExceptionsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStoryNotificationSettingsExceptions#256a2eb0 as nil") - } - b.PutID(GetStoryNotificationSettingsExceptionsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStoryNotificationSettingsExceptionsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStoryNotificationSettingsExceptions#256a2eb0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStoryNotificationSettingsExceptionsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStoryNotificationSettingsExceptions#256a2eb0 to nil") - } - if err := b.ConsumeID(GetStoryNotificationSettingsExceptionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStoryNotificationSettingsExceptions#256a2eb0: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStoryNotificationSettingsExceptionsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStoryNotificationSettingsExceptions#256a2eb0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStoryNotificationSettingsExceptionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStoryNotificationSettingsExceptions#256a2eb0 as nil") - } - b.ObjStart() - b.PutID("getStoryNotificationSettingsExceptions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStoryNotificationSettingsExceptionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStoryNotificationSettingsExceptions#256a2eb0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStoryNotificationSettingsExceptions"); err != nil { - return fmt.Errorf("unable to decode getStoryNotificationSettingsExceptions#256a2eb0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStoryNotificationSettingsExceptions invokes method getStoryNotificationSettingsExceptions#256a2eb0 returning error if any. -func (c *Client) GetStoryNotificationSettingsExceptions(ctx context.Context) (*Chats, error) { - var result Chats - - request := &GetStoryNotificationSettingsExceptionsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_story_public_forwards_gen.go b/tdapi/tl_get_story_public_forwards_gen.go deleted file mode 100644 index d48294212..000000000 --- a/tdapi/tl_get_story_public_forwards_gen.go +++ /dev/null @@ -1,308 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStoryPublicForwardsRequest represents TL type `getStoryPublicForwards#68f7dcbb`. -type GetStoryPublicForwardsRequest struct { - // The identifier of the sender of the story - StorySenderChatID int64 - // The identifier of the story - StoryID int32 - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of messages and stories to be returned; must be positive and can't - // be greater than 100. For optimal performance, the number of returned objects is chosen - // by TDLib and can be smaller than the specified limit - Limit int32 -} - -// GetStoryPublicForwardsRequestTypeID is TL type id of GetStoryPublicForwardsRequest. -const GetStoryPublicForwardsRequestTypeID = 0x68f7dcbb - -// Ensuring interfaces in compile-time for GetStoryPublicForwardsRequest. -var ( - _ bin.Encoder = &GetStoryPublicForwardsRequest{} - _ bin.Decoder = &GetStoryPublicForwardsRequest{} - _ bin.BareEncoder = &GetStoryPublicForwardsRequest{} - _ bin.BareDecoder = &GetStoryPublicForwardsRequest{} -) - -func (g *GetStoryPublicForwardsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.StorySenderChatID == 0) { - return false - } - if !(g.StoryID == 0) { - return false - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStoryPublicForwardsRequest) String() string { - if g == nil { - return "GetStoryPublicForwardsRequest(nil)" - } - type Alias GetStoryPublicForwardsRequest - return fmt.Sprintf("GetStoryPublicForwardsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStoryPublicForwardsRequest) TypeID() uint32 { - return GetStoryPublicForwardsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStoryPublicForwardsRequest) TypeName() string { - return "getStoryPublicForwards" -} - -// TypeInfo returns info about TL type. -func (g *GetStoryPublicForwardsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStoryPublicForwards", - ID: GetStoryPublicForwardsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStoryPublicForwardsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStoryPublicForwards#68f7dcbb as nil") - } - b.PutID(GetStoryPublicForwardsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStoryPublicForwardsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStoryPublicForwards#68f7dcbb as nil") - } - b.PutInt53(g.StorySenderChatID) - b.PutInt32(g.StoryID) - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStoryPublicForwardsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStoryPublicForwards#68f7dcbb to nil") - } - if err := b.ConsumeID(GetStoryPublicForwardsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStoryPublicForwards#68f7dcbb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStoryPublicForwardsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStoryPublicForwards#68f7dcbb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStoryPublicForwards#68f7dcbb: field story_sender_chat_id: %w", err) - } - g.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryPublicForwards#68f7dcbb: field story_id: %w", err) - } - g.StoryID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStoryPublicForwards#68f7dcbb: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryPublicForwards#68f7dcbb: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStoryPublicForwardsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStoryPublicForwards#68f7dcbb as nil") - } - b.ObjStart() - b.PutID("getStoryPublicForwards") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(g.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(g.StoryID) - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStoryPublicForwardsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStoryPublicForwards#68f7dcbb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStoryPublicForwards"); err != nil { - return fmt.Errorf("unable to decode getStoryPublicForwards#68f7dcbb: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStoryPublicForwards#68f7dcbb: field story_sender_chat_id: %w", err) - } - g.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryPublicForwards#68f7dcbb: field story_id: %w", err) - } - g.StoryID = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getStoryPublicForwards#68f7dcbb: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryPublicForwards#68f7dcbb: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (g *GetStoryPublicForwardsRequest) GetStorySenderChatID() (value int64) { - if g == nil { - return - } - return g.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (g *GetStoryPublicForwardsRequest) GetStoryID() (value int32) { - if g == nil { - return - } - return g.StoryID -} - -// GetOffset returns value of Offset field. -func (g *GetStoryPublicForwardsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetStoryPublicForwardsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetStoryPublicForwards invokes method getStoryPublicForwards#68f7dcbb returning error if any. -func (c *Client) GetStoryPublicForwards(ctx context.Context, request *GetStoryPublicForwardsRequest) (*PublicForwards, error) { - var result PublicForwards - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_story_statistics_gen.go b/tdapi/tl_get_story_statistics_gen.go deleted file mode 100644 index 0eaae4b0d..000000000 --- a/tdapi/tl_get_story_statistics_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetStoryStatisticsRequest represents TL type `getStoryStatistics#3a964342`. -type GetStoryStatisticsRequest struct { - // Chat identifier - ChatID int64 - // Story identifier - StoryID int32 - // Pass true if a dark theme is used by the application - IsDark bool -} - -// GetStoryStatisticsRequestTypeID is TL type id of GetStoryStatisticsRequest. -const GetStoryStatisticsRequestTypeID = 0x3a964342 - -// Ensuring interfaces in compile-time for GetStoryStatisticsRequest. -var ( - _ bin.Encoder = &GetStoryStatisticsRequest{} - _ bin.Decoder = &GetStoryStatisticsRequest{} - _ bin.BareEncoder = &GetStoryStatisticsRequest{} - _ bin.BareDecoder = &GetStoryStatisticsRequest{} -) - -func (g *GetStoryStatisticsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.StoryID == 0) { - return false - } - if !(g.IsDark == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetStoryStatisticsRequest) String() string { - if g == nil { - return "GetStoryStatisticsRequest(nil)" - } - type Alias GetStoryStatisticsRequest - return fmt.Sprintf("GetStoryStatisticsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetStoryStatisticsRequest) TypeID() uint32 { - return GetStoryStatisticsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetStoryStatisticsRequest) TypeName() string { - return "getStoryStatistics" -} - -// TypeInfo returns info about TL type. -func (g *GetStoryStatisticsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getStoryStatistics", - ID: GetStoryStatisticsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "IsDark", - SchemaName: "is_dark", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetStoryStatisticsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStoryStatistics#3a964342 as nil") - } - b.PutID(GetStoryStatisticsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetStoryStatisticsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getStoryStatistics#3a964342 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt32(g.StoryID) - b.PutBool(g.IsDark) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetStoryStatisticsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStoryStatistics#3a964342 to nil") - } - if err := b.ConsumeID(GetStoryStatisticsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getStoryStatistics#3a964342: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetStoryStatisticsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getStoryStatistics#3a964342 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field story_id: %w", err) - } - g.StoryID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field is_dark: %w", err) - } - g.IsDark = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetStoryStatisticsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getStoryStatistics#3a964342 as nil") - } - b.ObjStart() - b.PutID("getStoryStatistics") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(g.StoryID) - b.Comma() - b.FieldStart("is_dark") - b.PutBool(g.IsDark) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetStoryStatisticsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getStoryStatistics#3a964342 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getStoryStatistics"); err != nil { - return fmt.Errorf("unable to decode getStoryStatistics#3a964342: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field chat_id: %w", err) - } - g.ChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field story_id: %w", err) - } - g.StoryID = value - case "is_dark": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getStoryStatistics#3a964342: field is_dark: %w", err) - } - g.IsDark = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetStoryStatisticsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetStoryID returns value of StoryID field. -func (g *GetStoryStatisticsRequest) GetStoryID() (value int32) { - if g == nil { - return - } - return g.StoryID -} - -// GetIsDark returns value of IsDark field. -func (g *GetStoryStatisticsRequest) GetIsDark() (value bool) { - if g == nil { - return - } - return g.IsDark -} - -// GetStoryStatistics invokes method getStoryStatistics#3a964342 returning error if any. -func (c *Client) GetStoryStatistics(ctx context.Context, request *GetStoryStatisticsRequest) (*StoryStatistics, error) { - var result StoryStatistics - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_suggested_file_name_gen.go b/tdapi/tl_get_suggested_file_name_gen.go deleted file mode 100644 index ad02b1346..000000000 --- a/tdapi/tl_get_suggested_file_name_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSuggestedFileNameRequest represents TL type `getSuggestedFileName#85d8a486`. -type GetSuggestedFileNameRequest struct { - // Identifier of the file - FileID int32 - // Directory in which the file is expected to be saved - Directory string -} - -// GetSuggestedFileNameRequestTypeID is TL type id of GetSuggestedFileNameRequest. -const GetSuggestedFileNameRequestTypeID = 0x85d8a486 - -// Ensuring interfaces in compile-time for GetSuggestedFileNameRequest. -var ( - _ bin.Encoder = &GetSuggestedFileNameRequest{} - _ bin.Decoder = &GetSuggestedFileNameRequest{} - _ bin.BareEncoder = &GetSuggestedFileNameRequest{} - _ bin.BareDecoder = &GetSuggestedFileNameRequest{} -) - -func (g *GetSuggestedFileNameRequest) Zero() bool { - if g == nil { - return true - } - if !(g.FileID == 0) { - return false - } - if !(g.Directory == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSuggestedFileNameRequest) String() string { - if g == nil { - return "GetSuggestedFileNameRequest(nil)" - } - type Alias GetSuggestedFileNameRequest - return fmt.Sprintf("GetSuggestedFileNameRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSuggestedFileNameRequest) TypeID() uint32 { - return GetSuggestedFileNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSuggestedFileNameRequest) TypeName() string { - return "getSuggestedFileName" -} - -// TypeInfo returns info about TL type. -func (g *GetSuggestedFileNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSuggestedFileName", - ID: GetSuggestedFileNameRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "Directory", - SchemaName: "directory", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSuggestedFileNameRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSuggestedFileName#85d8a486 as nil") - } - b.PutID(GetSuggestedFileNameRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSuggestedFileNameRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSuggestedFileName#85d8a486 as nil") - } - b.PutInt32(g.FileID) - b.PutString(g.Directory) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSuggestedFileNameRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSuggestedFileName#85d8a486 to nil") - } - if err := b.ConsumeID(GetSuggestedFileNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSuggestedFileName#85d8a486: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSuggestedFileNameRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSuggestedFileName#85d8a486 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSuggestedFileName#85d8a486: field file_id: %w", err) - } - g.FileID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getSuggestedFileName#85d8a486: field directory: %w", err) - } - g.Directory = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSuggestedFileNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSuggestedFileName#85d8a486 as nil") - } - b.ObjStart() - b.PutID("getSuggestedFileName") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(g.FileID) - b.Comma() - b.FieldStart("directory") - b.PutString(g.Directory) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSuggestedFileNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSuggestedFileName#85d8a486 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSuggestedFileName"); err != nil { - return fmt.Errorf("unable to decode getSuggestedFileName#85d8a486: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSuggestedFileName#85d8a486: field file_id: %w", err) - } - g.FileID = value - case "directory": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getSuggestedFileName#85d8a486: field directory: %w", err) - } - g.Directory = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (g *GetSuggestedFileNameRequest) GetFileID() (value int32) { - if g == nil { - return - } - return g.FileID -} - -// GetDirectory returns value of Directory field. -func (g *GetSuggestedFileNameRequest) GetDirectory() (value string) { - if g == nil { - return - } - return g.Directory -} - -// GetSuggestedFileName invokes method getSuggestedFileName#85d8a486 returning error if any. -func (c *Client) GetSuggestedFileName(ctx context.Context, request *GetSuggestedFileNameRequest) (*Text, error) { - var result Text - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_suggested_sticker_set_name_gen.go b/tdapi/tl_get_suggested_sticker_set_name_gen.go deleted file mode 100644 index 228d4bc37..000000000 --- a/tdapi/tl_get_suggested_sticker_set_name_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSuggestedStickerSetNameRequest represents TL type `getSuggestedStickerSetName#b0120840`. -type GetSuggestedStickerSetNameRequest struct { - // Sticker set title; 1-64 characters - Title string -} - -// GetSuggestedStickerSetNameRequestTypeID is TL type id of GetSuggestedStickerSetNameRequest. -const GetSuggestedStickerSetNameRequestTypeID = 0xb0120840 - -// Ensuring interfaces in compile-time for GetSuggestedStickerSetNameRequest. -var ( - _ bin.Encoder = &GetSuggestedStickerSetNameRequest{} - _ bin.Decoder = &GetSuggestedStickerSetNameRequest{} - _ bin.BareEncoder = &GetSuggestedStickerSetNameRequest{} - _ bin.BareDecoder = &GetSuggestedStickerSetNameRequest{} -) - -func (g *GetSuggestedStickerSetNameRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSuggestedStickerSetNameRequest) String() string { - if g == nil { - return "GetSuggestedStickerSetNameRequest(nil)" - } - type Alias GetSuggestedStickerSetNameRequest - return fmt.Sprintf("GetSuggestedStickerSetNameRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSuggestedStickerSetNameRequest) TypeID() uint32 { - return GetSuggestedStickerSetNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSuggestedStickerSetNameRequest) TypeName() string { - return "getSuggestedStickerSetName" -} - -// TypeInfo returns info about TL type. -func (g *GetSuggestedStickerSetNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSuggestedStickerSetName", - ID: GetSuggestedStickerSetNameRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSuggestedStickerSetNameRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSuggestedStickerSetName#b0120840 as nil") - } - b.PutID(GetSuggestedStickerSetNameRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSuggestedStickerSetNameRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSuggestedStickerSetName#b0120840 as nil") - } - b.PutString(g.Title) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSuggestedStickerSetNameRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSuggestedStickerSetName#b0120840 to nil") - } - if err := b.ConsumeID(GetSuggestedStickerSetNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSuggestedStickerSetName#b0120840: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSuggestedStickerSetNameRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSuggestedStickerSetName#b0120840 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getSuggestedStickerSetName#b0120840: field title: %w", err) - } - g.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSuggestedStickerSetNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSuggestedStickerSetName#b0120840 as nil") - } - b.ObjStart() - b.PutID("getSuggestedStickerSetName") - b.Comma() - b.FieldStart("title") - b.PutString(g.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSuggestedStickerSetNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSuggestedStickerSetName#b0120840 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSuggestedStickerSetName"); err != nil { - return fmt.Errorf("unable to decode getSuggestedStickerSetName#b0120840: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getSuggestedStickerSetName#b0120840: field title: %w", err) - } - g.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (g *GetSuggestedStickerSetNameRequest) GetTitle() (value string) { - if g == nil { - return - } - return g.Title -} - -// GetSuggestedStickerSetName invokes method getSuggestedStickerSetName#b0120840 returning error if any. -func (c *Client) GetSuggestedStickerSetName(ctx context.Context, title string) (*Text, error) { - var result Text - - request := &GetSuggestedStickerSetNameRequest{ - Title: title, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_suitable_discussion_chats_gen.go b/tdapi/tl_get_suitable_discussion_chats_gen.go deleted file mode 100644 index 5851a7e3d..000000000 --- a/tdapi/tl_get_suitable_discussion_chats_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSuitableDiscussionChatsRequest represents TL type `getSuitableDiscussionChats#2ec5df6`. -type GetSuitableDiscussionChatsRequest struct { -} - -// GetSuitableDiscussionChatsRequestTypeID is TL type id of GetSuitableDiscussionChatsRequest. -const GetSuitableDiscussionChatsRequestTypeID = 0x2ec5df6 - -// Ensuring interfaces in compile-time for GetSuitableDiscussionChatsRequest. -var ( - _ bin.Encoder = &GetSuitableDiscussionChatsRequest{} - _ bin.Decoder = &GetSuitableDiscussionChatsRequest{} - _ bin.BareEncoder = &GetSuitableDiscussionChatsRequest{} - _ bin.BareDecoder = &GetSuitableDiscussionChatsRequest{} -) - -func (g *GetSuitableDiscussionChatsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSuitableDiscussionChatsRequest) String() string { - if g == nil { - return "GetSuitableDiscussionChatsRequest(nil)" - } - type Alias GetSuitableDiscussionChatsRequest - return fmt.Sprintf("GetSuitableDiscussionChatsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSuitableDiscussionChatsRequest) TypeID() uint32 { - return GetSuitableDiscussionChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSuitableDiscussionChatsRequest) TypeName() string { - return "getSuitableDiscussionChats" -} - -// TypeInfo returns info about TL type. -func (g *GetSuitableDiscussionChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSuitableDiscussionChats", - ID: GetSuitableDiscussionChatsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSuitableDiscussionChatsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSuitableDiscussionChats#2ec5df6 as nil") - } - b.PutID(GetSuitableDiscussionChatsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSuitableDiscussionChatsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSuitableDiscussionChats#2ec5df6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSuitableDiscussionChatsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSuitableDiscussionChats#2ec5df6 to nil") - } - if err := b.ConsumeID(GetSuitableDiscussionChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSuitableDiscussionChats#2ec5df6: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSuitableDiscussionChatsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSuitableDiscussionChats#2ec5df6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSuitableDiscussionChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSuitableDiscussionChats#2ec5df6 as nil") - } - b.ObjStart() - b.PutID("getSuitableDiscussionChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSuitableDiscussionChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSuitableDiscussionChats#2ec5df6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSuitableDiscussionChats"); err != nil { - return fmt.Errorf("unable to decode getSuitableDiscussionChats#2ec5df6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSuitableDiscussionChats invokes method getSuitableDiscussionChats#2ec5df6 returning error if any. -func (c *Client) GetSuitableDiscussionChats(ctx context.Context) (*Chats, error) { - var result Chats - - request := &GetSuitableDiscussionChatsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_suitable_personal_chats_gen.go b/tdapi/tl_get_suitable_personal_chats_gen.go deleted file mode 100644 index 2ae2ceff5..000000000 --- a/tdapi/tl_get_suitable_personal_chats_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSuitablePersonalChatsRequest represents TL type `getSuitablePersonalChats#90849bf5`. -type GetSuitablePersonalChatsRequest struct { -} - -// GetSuitablePersonalChatsRequestTypeID is TL type id of GetSuitablePersonalChatsRequest. -const GetSuitablePersonalChatsRequestTypeID = 0x90849bf5 - -// Ensuring interfaces in compile-time for GetSuitablePersonalChatsRequest. -var ( - _ bin.Encoder = &GetSuitablePersonalChatsRequest{} - _ bin.Decoder = &GetSuitablePersonalChatsRequest{} - _ bin.BareEncoder = &GetSuitablePersonalChatsRequest{} - _ bin.BareDecoder = &GetSuitablePersonalChatsRequest{} -) - -func (g *GetSuitablePersonalChatsRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSuitablePersonalChatsRequest) String() string { - if g == nil { - return "GetSuitablePersonalChatsRequest(nil)" - } - type Alias GetSuitablePersonalChatsRequest - return fmt.Sprintf("GetSuitablePersonalChatsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSuitablePersonalChatsRequest) TypeID() uint32 { - return GetSuitablePersonalChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSuitablePersonalChatsRequest) TypeName() string { - return "getSuitablePersonalChats" -} - -// TypeInfo returns info about TL type. -func (g *GetSuitablePersonalChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSuitablePersonalChats", - ID: GetSuitablePersonalChatsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSuitablePersonalChatsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSuitablePersonalChats#90849bf5 as nil") - } - b.PutID(GetSuitablePersonalChatsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSuitablePersonalChatsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSuitablePersonalChats#90849bf5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSuitablePersonalChatsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSuitablePersonalChats#90849bf5 to nil") - } - if err := b.ConsumeID(GetSuitablePersonalChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSuitablePersonalChats#90849bf5: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSuitablePersonalChatsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSuitablePersonalChats#90849bf5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSuitablePersonalChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSuitablePersonalChats#90849bf5 as nil") - } - b.ObjStart() - b.PutID("getSuitablePersonalChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSuitablePersonalChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSuitablePersonalChats#90849bf5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSuitablePersonalChats"); err != nil { - return fmt.Errorf("unable to decode getSuitablePersonalChats#90849bf5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSuitablePersonalChats invokes method getSuitablePersonalChats#90849bf5 returning error if any. -func (c *Client) GetSuitablePersonalChats(ctx context.Context) (*Chats, error) { - var result Chats - - request := &GetSuitablePersonalChatsRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_supergroup_full_info_gen.go b/tdapi/tl_get_supergroup_full_info_gen.go deleted file mode 100644 index 39e852c1a..000000000 --- a/tdapi/tl_get_supergroup_full_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSupergroupFullInfoRequest represents TL type `getSupergroupFullInfo#418d4038`. -type GetSupergroupFullInfoRequest struct { - // Supergroup or channel identifier - SupergroupID int64 -} - -// GetSupergroupFullInfoRequestTypeID is TL type id of GetSupergroupFullInfoRequest. -const GetSupergroupFullInfoRequestTypeID = 0x418d4038 - -// Ensuring interfaces in compile-time for GetSupergroupFullInfoRequest. -var ( - _ bin.Encoder = &GetSupergroupFullInfoRequest{} - _ bin.Decoder = &GetSupergroupFullInfoRequest{} - _ bin.BareEncoder = &GetSupergroupFullInfoRequest{} - _ bin.BareDecoder = &GetSupergroupFullInfoRequest{} -) - -func (g *GetSupergroupFullInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.SupergroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSupergroupFullInfoRequest) String() string { - if g == nil { - return "GetSupergroupFullInfoRequest(nil)" - } - type Alias GetSupergroupFullInfoRequest - return fmt.Sprintf("GetSupergroupFullInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSupergroupFullInfoRequest) TypeID() uint32 { - return GetSupergroupFullInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSupergroupFullInfoRequest) TypeName() string { - return "getSupergroupFullInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetSupergroupFullInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSupergroupFullInfo", - ID: GetSupergroupFullInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSupergroupFullInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSupergroupFullInfo#418d4038 as nil") - } - b.PutID(GetSupergroupFullInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSupergroupFullInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSupergroupFullInfo#418d4038 as nil") - } - b.PutInt53(g.SupergroupID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSupergroupFullInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSupergroupFullInfo#418d4038 to nil") - } - if err := b.ConsumeID(GetSupergroupFullInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSupergroupFullInfo#418d4038: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSupergroupFullInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSupergroupFullInfo#418d4038 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSupergroupFullInfo#418d4038: field supergroup_id: %w", err) - } - g.SupergroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSupergroupFullInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSupergroupFullInfo#418d4038 as nil") - } - b.ObjStart() - b.PutID("getSupergroupFullInfo") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(g.SupergroupID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSupergroupFullInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSupergroupFullInfo#418d4038 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSupergroupFullInfo"); err != nil { - return fmt.Errorf("unable to decode getSupergroupFullInfo#418d4038: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSupergroupFullInfo#418d4038: field supergroup_id: %w", err) - } - g.SupergroupID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (g *GetSupergroupFullInfoRequest) GetSupergroupID() (value int64) { - if g == nil { - return - } - return g.SupergroupID -} - -// GetSupergroupFullInfo invokes method getSupergroupFullInfo#418d4038 returning error if any. -func (c *Client) GetSupergroupFullInfo(ctx context.Context, supergroupid int64) (*SupergroupFullInfo, error) { - var result SupergroupFullInfo - - request := &GetSupergroupFullInfoRequest{ - SupergroupID: supergroupid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_supergroup_gen.go b/tdapi/tl_get_supergroup_gen.go deleted file mode 100644 index cfcc687aa..000000000 --- a/tdapi/tl_get_supergroup_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSupergroupRequest represents TL type `getSupergroup#3afd10e2`. -type GetSupergroupRequest struct { - // Supergroup or channel identifier - SupergroupID int64 -} - -// GetSupergroupRequestTypeID is TL type id of GetSupergroupRequest. -const GetSupergroupRequestTypeID = 0x3afd10e2 - -// Ensuring interfaces in compile-time for GetSupergroupRequest. -var ( - _ bin.Encoder = &GetSupergroupRequest{} - _ bin.Decoder = &GetSupergroupRequest{} - _ bin.BareEncoder = &GetSupergroupRequest{} - _ bin.BareDecoder = &GetSupergroupRequest{} -) - -func (g *GetSupergroupRequest) Zero() bool { - if g == nil { - return true - } - if !(g.SupergroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSupergroupRequest) String() string { - if g == nil { - return "GetSupergroupRequest(nil)" - } - type Alias GetSupergroupRequest - return fmt.Sprintf("GetSupergroupRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSupergroupRequest) TypeID() uint32 { - return GetSupergroupRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSupergroupRequest) TypeName() string { - return "getSupergroup" -} - -// TypeInfo returns info about TL type. -func (g *GetSupergroupRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSupergroup", - ID: GetSupergroupRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSupergroupRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSupergroup#3afd10e2 as nil") - } - b.PutID(GetSupergroupRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSupergroupRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSupergroup#3afd10e2 as nil") - } - b.PutInt53(g.SupergroupID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSupergroupRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSupergroup#3afd10e2 to nil") - } - if err := b.ConsumeID(GetSupergroupRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSupergroup#3afd10e2: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSupergroupRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSupergroup#3afd10e2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSupergroup#3afd10e2: field supergroup_id: %w", err) - } - g.SupergroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSupergroupRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSupergroup#3afd10e2 as nil") - } - b.ObjStart() - b.PutID("getSupergroup") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(g.SupergroupID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSupergroupRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSupergroup#3afd10e2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSupergroup"); err != nil { - return fmt.Errorf("unable to decode getSupergroup#3afd10e2: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSupergroup#3afd10e2: field supergroup_id: %w", err) - } - g.SupergroupID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (g *GetSupergroupRequest) GetSupergroupID() (value int64) { - if g == nil { - return - } - return g.SupergroupID -} - -// GetSupergroup invokes method getSupergroup#3afd10e2 returning error if any. -func (c *Client) GetSupergroup(ctx context.Context, supergroupid int64) (*Supergroup, error) { - var result Supergroup - - request := &GetSupergroupRequest{ - SupergroupID: supergroupid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_supergroup_members_gen.go b/tdapi/tl_get_supergroup_members_gen.go deleted file mode 100644 index 006d6eb50..000000000 --- a/tdapi/tl_get_supergroup_members_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSupergroupMembersRequest represents TL type `getSupergroupMembers#ddf821c8`. -type GetSupergroupMembersRequest struct { - // Identifier of the supergroup or channel - SupergroupID int64 - // The type of users to return; pass null to use supergroupMembersFilterRecent - Filter SupergroupMembersFilterClass - // Number of users to skip - Offset int32 - // The maximum number of users to be returned; up to 200 - Limit int32 -} - -// GetSupergroupMembersRequestTypeID is TL type id of GetSupergroupMembersRequest. -const GetSupergroupMembersRequestTypeID = 0xddf821c8 - -// Ensuring interfaces in compile-time for GetSupergroupMembersRequest. -var ( - _ bin.Encoder = &GetSupergroupMembersRequest{} - _ bin.Decoder = &GetSupergroupMembersRequest{} - _ bin.BareEncoder = &GetSupergroupMembersRequest{} - _ bin.BareDecoder = &GetSupergroupMembersRequest{} -) - -func (g *GetSupergroupMembersRequest) Zero() bool { - if g == nil { - return true - } - if !(g.SupergroupID == 0) { - return false - } - if !(g.Filter == nil) { - return false - } - if !(g.Offset == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSupergroupMembersRequest) String() string { - if g == nil { - return "GetSupergroupMembersRequest(nil)" - } - type Alias GetSupergroupMembersRequest - return fmt.Sprintf("GetSupergroupMembersRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSupergroupMembersRequest) TypeID() uint32 { - return GetSupergroupMembersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSupergroupMembersRequest) TypeName() string { - return "getSupergroupMembers" -} - -// TypeInfo returns info about TL type. -func (g *GetSupergroupMembersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSupergroupMembers", - ID: GetSupergroupMembersRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "Filter", - SchemaName: "filter", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSupergroupMembersRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSupergroupMembers#ddf821c8 as nil") - } - b.PutID(GetSupergroupMembersRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSupergroupMembersRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSupergroupMembers#ddf821c8 as nil") - } - b.PutInt53(g.SupergroupID) - if g.Filter == nil { - return fmt.Errorf("unable to encode getSupergroupMembers#ddf821c8: field filter is nil") - } - if err := g.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode getSupergroupMembers#ddf821c8: field filter: %w", err) - } - b.PutInt32(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSupergroupMembersRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSupergroupMembers#ddf821c8 to nil") - } - if err := b.ConsumeID(GetSupergroupMembersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSupergroupMembers#ddf821c8: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSupergroupMembersRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSupergroupMembers#ddf821c8 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSupergroupMembers#ddf821c8: field supergroup_id: %w", err) - } - g.SupergroupID = value - } - { - value, err := DecodeSupergroupMembersFilter(b) - if err != nil { - return fmt.Errorf("unable to decode getSupergroupMembers#ddf821c8: field filter: %w", err) - } - g.Filter = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSupergroupMembers#ddf821c8: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSupergroupMembers#ddf821c8: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSupergroupMembersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSupergroupMembers#ddf821c8 as nil") - } - b.ObjStart() - b.PutID("getSupergroupMembers") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(g.SupergroupID) - b.Comma() - b.FieldStart("filter") - if g.Filter == nil { - return fmt.Errorf("unable to encode getSupergroupMembers#ddf821c8: field filter is nil") - } - if err := g.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getSupergroupMembers#ddf821c8: field filter: %w", err) - } - b.Comma() - b.FieldStart("offset") - b.PutInt32(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSupergroupMembersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSupergroupMembers#ddf821c8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSupergroupMembers"); err != nil { - return fmt.Errorf("unable to decode getSupergroupMembers#ddf821c8: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getSupergroupMembers#ddf821c8: field supergroup_id: %w", err) - } - g.SupergroupID = value - case "filter": - value, err := DecodeTDLibJSONSupergroupMembersFilter(b) - if err != nil { - return fmt.Errorf("unable to decode getSupergroupMembers#ddf821c8: field filter: %w", err) - } - g.Filter = value - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSupergroupMembers#ddf821c8: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getSupergroupMembers#ddf821c8: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (g *GetSupergroupMembersRequest) GetSupergroupID() (value int64) { - if g == nil { - return - } - return g.SupergroupID -} - -// GetFilter returns value of Filter field. -func (g *GetSupergroupMembersRequest) GetFilter() (value SupergroupMembersFilterClass) { - if g == nil { - return - } - return g.Filter -} - -// GetOffset returns value of Offset field. -func (g *GetSupergroupMembersRequest) GetOffset() (value int32) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetSupergroupMembersRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetSupergroupMembers invokes method getSupergroupMembers#ddf821c8 returning error if any. -func (c *Client) GetSupergroupMembers(ctx context.Context, request *GetSupergroupMembersRequest) (*ChatMembers, error) { - var result ChatMembers - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_support_name_gen.go b/tdapi/tl_get_support_name_gen.go deleted file mode 100644 index 5899d9900..000000000 --- a/tdapi/tl_get_support_name_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSupportNameRequest represents TL type `getSupportName#4d9e1562`. -type GetSupportNameRequest struct { -} - -// GetSupportNameRequestTypeID is TL type id of GetSupportNameRequest. -const GetSupportNameRequestTypeID = 0x4d9e1562 - -// Ensuring interfaces in compile-time for GetSupportNameRequest. -var ( - _ bin.Encoder = &GetSupportNameRequest{} - _ bin.Decoder = &GetSupportNameRequest{} - _ bin.BareEncoder = &GetSupportNameRequest{} - _ bin.BareDecoder = &GetSupportNameRequest{} -) - -func (g *GetSupportNameRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSupportNameRequest) String() string { - if g == nil { - return "GetSupportNameRequest(nil)" - } - type Alias GetSupportNameRequest - return fmt.Sprintf("GetSupportNameRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSupportNameRequest) TypeID() uint32 { - return GetSupportNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSupportNameRequest) TypeName() string { - return "getSupportName" -} - -// TypeInfo returns info about TL type. -func (g *GetSupportNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSupportName", - ID: GetSupportNameRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSupportNameRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSupportName#4d9e1562 as nil") - } - b.PutID(GetSupportNameRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSupportNameRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSupportName#4d9e1562 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSupportNameRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSupportName#4d9e1562 to nil") - } - if err := b.ConsumeID(GetSupportNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSupportName#4d9e1562: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSupportNameRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSupportName#4d9e1562 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSupportNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSupportName#4d9e1562 as nil") - } - b.ObjStart() - b.PutID("getSupportName") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSupportNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSupportName#4d9e1562 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSupportName"); err != nil { - return fmt.Errorf("unable to decode getSupportName#4d9e1562: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSupportName invokes method getSupportName#4d9e1562 returning error if any. -func (c *Client) GetSupportName(ctx context.Context) (*Text, error) { - var result Text - - request := &GetSupportNameRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_support_user_gen.go b/tdapi/tl_get_support_user_gen.go deleted file mode 100644 index 22753e71c..000000000 --- a/tdapi/tl_get_support_user_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetSupportUserRequest represents TL type `getSupportUser#98acec9c`. -type GetSupportUserRequest struct { -} - -// GetSupportUserRequestTypeID is TL type id of GetSupportUserRequest. -const GetSupportUserRequestTypeID = 0x98acec9c - -// Ensuring interfaces in compile-time for GetSupportUserRequest. -var ( - _ bin.Encoder = &GetSupportUserRequest{} - _ bin.Decoder = &GetSupportUserRequest{} - _ bin.BareEncoder = &GetSupportUserRequest{} - _ bin.BareDecoder = &GetSupportUserRequest{} -) - -func (g *GetSupportUserRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetSupportUserRequest) String() string { - if g == nil { - return "GetSupportUserRequest(nil)" - } - type Alias GetSupportUserRequest - return fmt.Sprintf("GetSupportUserRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetSupportUserRequest) TypeID() uint32 { - return GetSupportUserRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetSupportUserRequest) TypeName() string { - return "getSupportUser" -} - -// TypeInfo returns info about TL type. -func (g *GetSupportUserRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getSupportUser", - ID: GetSupportUserRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetSupportUserRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSupportUser#98acec9c as nil") - } - b.PutID(GetSupportUserRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetSupportUserRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getSupportUser#98acec9c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetSupportUserRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSupportUser#98acec9c to nil") - } - if err := b.ConsumeID(GetSupportUserRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getSupportUser#98acec9c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetSupportUserRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getSupportUser#98acec9c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetSupportUserRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getSupportUser#98acec9c as nil") - } - b.ObjStart() - b.PutID("getSupportUser") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetSupportUserRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getSupportUser#98acec9c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getSupportUser"); err != nil { - return fmt.Errorf("unable to decode getSupportUser#98acec9c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSupportUser invokes method getSupportUser#98acec9c returning error if any. -func (c *Client) GetSupportUser(ctx context.Context) (*User, error) { - var result User - - request := &GetSupportUserRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_temporary_password_state_gen.go b/tdapi/tl_get_temporary_password_state_gen.go deleted file mode 100644 index 0926789c3..000000000 --- a/tdapi/tl_get_temporary_password_state_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetTemporaryPasswordStateRequest represents TL type `getTemporaryPasswordState#ff3ea892`. -type GetTemporaryPasswordStateRequest struct { -} - -// GetTemporaryPasswordStateRequestTypeID is TL type id of GetTemporaryPasswordStateRequest. -const GetTemporaryPasswordStateRequestTypeID = 0xff3ea892 - -// Ensuring interfaces in compile-time for GetTemporaryPasswordStateRequest. -var ( - _ bin.Encoder = &GetTemporaryPasswordStateRequest{} - _ bin.Decoder = &GetTemporaryPasswordStateRequest{} - _ bin.BareEncoder = &GetTemporaryPasswordStateRequest{} - _ bin.BareDecoder = &GetTemporaryPasswordStateRequest{} -) - -func (g *GetTemporaryPasswordStateRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetTemporaryPasswordStateRequest) String() string { - if g == nil { - return "GetTemporaryPasswordStateRequest(nil)" - } - type Alias GetTemporaryPasswordStateRequest - return fmt.Sprintf("GetTemporaryPasswordStateRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetTemporaryPasswordStateRequest) TypeID() uint32 { - return GetTemporaryPasswordStateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetTemporaryPasswordStateRequest) TypeName() string { - return "getTemporaryPasswordState" -} - -// TypeInfo returns info about TL type. -func (g *GetTemporaryPasswordStateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getTemporaryPasswordState", - ID: GetTemporaryPasswordStateRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetTemporaryPasswordStateRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getTemporaryPasswordState#ff3ea892 as nil") - } - b.PutID(GetTemporaryPasswordStateRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetTemporaryPasswordStateRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getTemporaryPasswordState#ff3ea892 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetTemporaryPasswordStateRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getTemporaryPasswordState#ff3ea892 to nil") - } - if err := b.ConsumeID(GetTemporaryPasswordStateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getTemporaryPasswordState#ff3ea892: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetTemporaryPasswordStateRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getTemporaryPasswordState#ff3ea892 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetTemporaryPasswordStateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getTemporaryPasswordState#ff3ea892 as nil") - } - b.ObjStart() - b.PutID("getTemporaryPasswordState") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetTemporaryPasswordStateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getTemporaryPasswordState#ff3ea892 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getTemporaryPasswordState"); err != nil { - return fmt.Errorf("unable to decode getTemporaryPasswordState#ff3ea892: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTemporaryPasswordState invokes method getTemporaryPasswordState#ff3ea892 returning error if any. -func (c *Client) GetTemporaryPasswordState(ctx context.Context) (*TemporaryPasswordState, error) { - var result TemporaryPasswordState - - request := &GetTemporaryPasswordStateRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_text_entities_gen.go b/tdapi/tl_get_text_entities_gen.go deleted file mode 100644 index 15711affb..000000000 --- a/tdapi/tl_get_text_entities_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetTextEntitiesRequest represents TL type `getTextEntities#eba543fb`. -type GetTextEntitiesRequest struct { - // The text in which to look for entities - Text string -} - -// GetTextEntitiesRequestTypeID is TL type id of GetTextEntitiesRequest. -const GetTextEntitiesRequestTypeID = 0xeba543fb - -// Ensuring interfaces in compile-time for GetTextEntitiesRequest. -var ( - _ bin.Encoder = &GetTextEntitiesRequest{} - _ bin.Decoder = &GetTextEntitiesRequest{} - _ bin.BareEncoder = &GetTextEntitiesRequest{} - _ bin.BareDecoder = &GetTextEntitiesRequest{} -) - -func (g *GetTextEntitiesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetTextEntitiesRequest) String() string { - if g == nil { - return "GetTextEntitiesRequest(nil)" - } - type Alias GetTextEntitiesRequest - return fmt.Sprintf("GetTextEntitiesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetTextEntitiesRequest) TypeID() uint32 { - return GetTextEntitiesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetTextEntitiesRequest) TypeName() string { - return "getTextEntities" -} - -// TypeInfo returns info about TL type. -func (g *GetTextEntitiesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getTextEntities", - ID: GetTextEntitiesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetTextEntitiesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getTextEntities#eba543fb as nil") - } - b.PutID(GetTextEntitiesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetTextEntitiesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getTextEntities#eba543fb as nil") - } - b.PutString(g.Text) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetTextEntitiesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getTextEntities#eba543fb to nil") - } - if err := b.ConsumeID(GetTextEntitiesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getTextEntities#eba543fb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetTextEntitiesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getTextEntities#eba543fb to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getTextEntities#eba543fb: field text: %w", err) - } - g.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetTextEntitiesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getTextEntities#eba543fb as nil") - } - b.ObjStart() - b.PutID("getTextEntities") - b.Comma() - b.FieldStart("text") - b.PutString(g.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetTextEntitiesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getTextEntities#eba543fb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getTextEntities"); err != nil { - return fmt.Errorf("unable to decode getTextEntities#eba543fb: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getTextEntities#eba543fb: field text: %w", err) - } - g.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (g *GetTextEntitiesRequest) GetText() (value string) { - if g == nil { - return - } - return g.Text -} - -// GetTextEntities invokes method getTextEntities#eba543fb returning error if any. -func (c *Client) GetTextEntities(ctx context.Context, text string) (*TextEntities, error) { - var result TextEntities - - request := &GetTextEntitiesRequest{ - Text: text, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_theme_parameters_json_string_gen.go b/tdapi/tl_get_theme_parameters_json_string_gen.go deleted file mode 100644 index b72329140..000000000 --- a/tdapi/tl_get_theme_parameters_json_string_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetThemeParametersJSONStringRequest represents TL type `getThemeParametersJsonString#91b905f8`. -type GetThemeParametersJSONStringRequest struct { - // Theme parameters to convert to JSON - Theme ThemeParameters -} - -// GetThemeParametersJSONStringRequestTypeID is TL type id of GetThemeParametersJSONStringRequest. -const GetThemeParametersJSONStringRequestTypeID = 0x91b905f8 - -// Ensuring interfaces in compile-time for GetThemeParametersJSONStringRequest. -var ( - _ bin.Encoder = &GetThemeParametersJSONStringRequest{} - _ bin.Decoder = &GetThemeParametersJSONStringRequest{} - _ bin.BareEncoder = &GetThemeParametersJSONStringRequest{} - _ bin.BareDecoder = &GetThemeParametersJSONStringRequest{} -) - -func (g *GetThemeParametersJSONStringRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Theme.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetThemeParametersJSONStringRequest) String() string { - if g == nil { - return "GetThemeParametersJSONStringRequest(nil)" - } - type Alias GetThemeParametersJSONStringRequest - return fmt.Sprintf("GetThemeParametersJSONStringRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetThemeParametersJSONStringRequest) TypeID() uint32 { - return GetThemeParametersJSONStringRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetThemeParametersJSONStringRequest) TypeName() string { - return "getThemeParametersJsonString" -} - -// TypeInfo returns info about TL type. -func (g *GetThemeParametersJSONStringRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getThemeParametersJsonString", - ID: GetThemeParametersJSONStringRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Theme", - SchemaName: "theme", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetThemeParametersJSONStringRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getThemeParametersJsonString#91b905f8 as nil") - } - b.PutID(GetThemeParametersJSONStringRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetThemeParametersJSONStringRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getThemeParametersJsonString#91b905f8 as nil") - } - if err := g.Theme.Encode(b); err != nil { - return fmt.Errorf("unable to encode getThemeParametersJsonString#91b905f8: field theme: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetThemeParametersJSONStringRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getThemeParametersJsonString#91b905f8 to nil") - } - if err := b.ConsumeID(GetThemeParametersJSONStringRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getThemeParametersJsonString#91b905f8: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetThemeParametersJSONStringRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getThemeParametersJsonString#91b905f8 to nil") - } - { - if err := g.Theme.Decode(b); err != nil { - return fmt.Errorf("unable to decode getThemeParametersJsonString#91b905f8: field theme: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetThemeParametersJSONStringRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getThemeParametersJsonString#91b905f8 as nil") - } - b.ObjStart() - b.PutID("getThemeParametersJsonString") - b.Comma() - b.FieldStart("theme") - if err := g.Theme.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getThemeParametersJsonString#91b905f8: field theme: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetThemeParametersJSONStringRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getThemeParametersJsonString#91b905f8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getThemeParametersJsonString"); err != nil { - return fmt.Errorf("unable to decode getThemeParametersJsonString#91b905f8: %w", err) - } - case "theme": - if err := g.Theme.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getThemeParametersJsonString#91b905f8: field theme: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTheme returns value of Theme field. -func (g *GetThemeParametersJSONStringRequest) GetTheme() (value ThemeParameters) { - if g == nil { - return - } - return g.Theme -} - -// GetThemeParametersJSONString invokes method getThemeParametersJsonString#91b905f8 returning error if any. -func (c *Client) GetThemeParametersJSONString(ctx context.Context, theme ThemeParameters) (*Text, error) { - var result Text - - request := &GetThemeParametersJSONStringRequest{ - Theme: theme, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_themed_chat_emoji_statuses_gen.go b/tdapi/tl_get_themed_chat_emoji_statuses_gen.go deleted file mode 100644 index 26a7c073b..000000000 --- a/tdapi/tl_get_themed_chat_emoji_statuses_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetThemedChatEmojiStatusesRequest represents TL type `getThemedChatEmojiStatuses#fb735cb5`. -type GetThemedChatEmojiStatusesRequest struct { -} - -// GetThemedChatEmojiStatusesRequestTypeID is TL type id of GetThemedChatEmojiStatusesRequest. -const GetThemedChatEmojiStatusesRequestTypeID = 0xfb735cb5 - -// Ensuring interfaces in compile-time for GetThemedChatEmojiStatusesRequest. -var ( - _ bin.Encoder = &GetThemedChatEmojiStatusesRequest{} - _ bin.Decoder = &GetThemedChatEmojiStatusesRequest{} - _ bin.BareEncoder = &GetThemedChatEmojiStatusesRequest{} - _ bin.BareDecoder = &GetThemedChatEmojiStatusesRequest{} -) - -func (g *GetThemedChatEmojiStatusesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetThemedChatEmojiStatusesRequest) String() string { - if g == nil { - return "GetThemedChatEmojiStatusesRequest(nil)" - } - type Alias GetThemedChatEmojiStatusesRequest - return fmt.Sprintf("GetThemedChatEmojiStatusesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetThemedChatEmojiStatusesRequest) TypeID() uint32 { - return GetThemedChatEmojiStatusesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetThemedChatEmojiStatusesRequest) TypeName() string { - return "getThemedChatEmojiStatuses" -} - -// TypeInfo returns info about TL type. -func (g *GetThemedChatEmojiStatusesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getThemedChatEmojiStatuses", - ID: GetThemedChatEmojiStatusesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetThemedChatEmojiStatusesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getThemedChatEmojiStatuses#fb735cb5 as nil") - } - b.PutID(GetThemedChatEmojiStatusesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetThemedChatEmojiStatusesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getThemedChatEmojiStatuses#fb735cb5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetThemedChatEmojiStatusesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getThemedChatEmojiStatuses#fb735cb5 to nil") - } - if err := b.ConsumeID(GetThemedChatEmojiStatusesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getThemedChatEmojiStatuses#fb735cb5: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetThemedChatEmojiStatusesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getThemedChatEmojiStatuses#fb735cb5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetThemedChatEmojiStatusesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getThemedChatEmojiStatuses#fb735cb5 as nil") - } - b.ObjStart() - b.PutID("getThemedChatEmojiStatuses") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetThemedChatEmojiStatusesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getThemedChatEmojiStatuses#fb735cb5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getThemedChatEmojiStatuses"); err != nil { - return fmt.Errorf("unable to decode getThemedChatEmojiStatuses#fb735cb5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetThemedChatEmojiStatuses invokes method getThemedChatEmojiStatuses#fb735cb5 returning error if any. -func (c *Client) GetThemedChatEmojiStatuses(ctx context.Context) (*EmojiStatuses, error) { - var result EmojiStatuses - - request := &GetThemedChatEmojiStatusesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_themed_emoji_statuses_gen.go b/tdapi/tl_get_themed_emoji_statuses_gen.go deleted file mode 100644 index 7e3a27783..000000000 --- a/tdapi/tl_get_themed_emoji_statuses_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetThemedEmojiStatusesRequest represents TL type `getThemedEmojiStatuses#6ac5c8c2`. -type GetThemedEmojiStatusesRequest struct { -} - -// GetThemedEmojiStatusesRequestTypeID is TL type id of GetThemedEmojiStatusesRequest. -const GetThemedEmojiStatusesRequestTypeID = 0x6ac5c8c2 - -// Ensuring interfaces in compile-time for GetThemedEmojiStatusesRequest. -var ( - _ bin.Encoder = &GetThemedEmojiStatusesRequest{} - _ bin.Decoder = &GetThemedEmojiStatusesRequest{} - _ bin.BareEncoder = &GetThemedEmojiStatusesRequest{} - _ bin.BareDecoder = &GetThemedEmojiStatusesRequest{} -) - -func (g *GetThemedEmojiStatusesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetThemedEmojiStatusesRequest) String() string { - if g == nil { - return "GetThemedEmojiStatusesRequest(nil)" - } - type Alias GetThemedEmojiStatusesRequest - return fmt.Sprintf("GetThemedEmojiStatusesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetThemedEmojiStatusesRequest) TypeID() uint32 { - return GetThemedEmojiStatusesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetThemedEmojiStatusesRequest) TypeName() string { - return "getThemedEmojiStatuses" -} - -// TypeInfo returns info about TL type. -func (g *GetThemedEmojiStatusesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getThemedEmojiStatuses", - ID: GetThemedEmojiStatusesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetThemedEmojiStatusesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getThemedEmojiStatuses#6ac5c8c2 as nil") - } - b.PutID(GetThemedEmojiStatusesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetThemedEmojiStatusesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getThemedEmojiStatuses#6ac5c8c2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetThemedEmojiStatusesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getThemedEmojiStatuses#6ac5c8c2 to nil") - } - if err := b.ConsumeID(GetThemedEmojiStatusesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getThemedEmojiStatuses#6ac5c8c2: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetThemedEmojiStatusesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getThemedEmojiStatuses#6ac5c8c2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetThemedEmojiStatusesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getThemedEmojiStatuses#6ac5c8c2 as nil") - } - b.ObjStart() - b.PutID("getThemedEmojiStatuses") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetThemedEmojiStatusesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getThemedEmojiStatuses#6ac5c8c2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getThemedEmojiStatuses"); err != nil { - return fmt.Errorf("unable to decode getThemedEmojiStatuses#6ac5c8c2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetThemedEmojiStatuses invokes method getThemedEmojiStatuses#6ac5c8c2 returning error if any. -func (c *Client) GetThemedEmojiStatuses(ctx context.Context) (*EmojiStatuses, error) { - var result EmojiStatuses - - request := &GetThemedEmojiStatusesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_time_zones_gen.go b/tdapi/tl_get_time_zones_gen.go deleted file mode 100644 index e8b0b69c0..000000000 --- a/tdapi/tl_get_time_zones_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetTimeZonesRequest represents TL type `getTimeZones#4fe2e058`. -type GetTimeZonesRequest struct { -} - -// GetTimeZonesRequestTypeID is TL type id of GetTimeZonesRequest. -const GetTimeZonesRequestTypeID = 0x4fe2e058 - -// Ensuring interfaces in compile-time for GetTimeZonesRequest. -var ( - _ bin.Encoder = &GetTimeZonesRequest{} - _ bin.Decoder = &GetTimeZonesRequest{} - _ bin.BareEncoder = &GetTimeZonesRequest{} - _ bin.BareDecoder = &GetTimeZonesRequest{} -) - -func (g *GetTimeZonesRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetTimeZonesRequest) String() string { - if g == nil { - return "GetTimeZonesRequest(nil)" - } - type Alias GetTimeZonesRequest - return fmt.Sprintf("GetTimeZonesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetTimeZonesRequest) TypeID() uint32 { - return GetTimeZonesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetTimeZonesRequest) TypeName() string { - return "getTimeZones" -} - -// TypeInfo returns info about TL type. -func (g *GetTimeZonesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getTimeZones", - ID: GetTimeZonesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetTimeZonesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getTimeZones#4fe2e058 as nil") - } - b.PutID(GetTimeZonesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetTimeZonesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getTimeZones#4fe2e058 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetTimeZonesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getTimeZones#4fe2e058 to nil") - } - if err := b.ConsumeID(GetTimeZonesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getTimeZones#4fe2e058: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetTimeZonesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getTimeZones#4fe2e058 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetTimeZonesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getTimeZones#4fe2e058 as nil") - } - b.ObjStart() - b.PutID("getTimeZones") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetTimeZonesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getTimeZones#4fe2e058 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getTimeZones"); err != nil { - return fmt.Errorf("unable to decode getTimeZones#4fe2e058: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTimeZones invokes method getTimeZones#4fe2e058 returning error if any. -func (c *Client) GetTimeZones(ctx context.Context) (*TimeZones, error) { - var result TimeZones - - request := &GetTimeZonesRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_top_chats_gen.go b/tdapi/tl_get_top_chats_gen.go deleted file mode 100644 index 3a3961d6c..000000000 --- a/tdapi/tl_get_top_chats_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetTopChatsRequest represents TL type `getTopChats#e8d95221`. -type GetTopChatsRequest struct { - // Category of chats to be returned - Category TopChatCategoryClass - // The maximum number of chats to be returned; up to 30 - Limit int32 -} - -// GetTopChatsRequestTypeID is TL type id of GetTopChatsRequest. -const GetTopChatsRequestTypeID = 0xe8d95221 - -// Ensuring interfaces in compile-time for GetTopChatsRequest. -var ( - _ bin.Encoder = &GetTopChatsRequest{} - _ bin.Decoder = &GetTopChatsRequest{} - _ bin.BareEncoder = &GetTopChatsRequest{} - _ bin.BareDecoder = &GetTopChatsRequest{} -) - -func (g *GetTopChatsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Category == nil) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetTopChatsRequest) String() string { - if g == nil { - return "GetTopChatsRequest(nil)" - } - type Alias GetTopChatsRequest - return fmt.Sprintf("GetTopChatsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetTopChatsRequest) TypeID() uint32 { - return GetTopChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetTopChatsRequest) TypeName() string { - return "getTopChats" -} - -// TypeInfo returns info about TL type. -func (g *GetTopChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getTopChats", - ID: GetTopChatsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Category", - SchemaName: "category", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetTopChatsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getTopChats#e8d95221 as nil") - } - b.PutID(GetTopChatsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetTopChatsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getTopChats#e8d95221 as nil") - } - if g.Category == nil { - return fmt.Errorf("unable to encode getTopChats#e8d95221: field category is nil") - } - if err := g.Category.Encode(b); err != nil { - return fmt.Errorf("unable to encode getTopChats#e8d95221: field category: %w", err) - } - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetTopChatsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getTopChats#e8d95221 to nil") - } - if err := b.ConsumeID(GetTopChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getTopChats#e8d95221: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetTopChatsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getTopChats#e8d95221 to nil") - } - { - value, err := DecodeTopChatCategory(b) - if err != nil { - return fmt.Errorf("unable to decode getTopChats#e8d95221: field category: %w", err) - } - g.Category = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getTopChats#e8d95221: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetTopChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getTopChats#e8d95221 as nil") - } - b.ObjStart() - b.PutID("getTopChats") - b.Comma() - b.FieldStart("category") - if g.Category == nil { - return fmt.Errorf("unable to encode getTopChats#e8d95221: field category is nil") - } - if err := g.Category.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getTopChats#e8d95221: field category: %w", err) - } - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetTopChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getTopChats#e8d95221 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getTopChats"); err != nil { - return fmt.Errorf("unable to decode getTopChats#e8d95221: %w", err) - } - case "category": - value, err := DecodeTDLibJSONTopChatCategory(b) - if err != nil { - return fmt.Errorf("unable to decode getTopChats#e8d95221: field category: %w", err) - } - g.Category = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getTopChats#e8d95221: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCategory returns value of Category field. -func (g *GetTopChatsRequest) GetCategory() (value TopChatCategoryClass) { - if g == nil { - return - } - return g.Category -} - -// GetLimit returns value of Limit field. -func (g *GetTopChatsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetTopChats invokes method getTopChats#e8d95221 returning error if any. -func (c *Client) GetTopChats(ctx context.Context, request *GetTopChatsRequest) (*Chats, error) { - var result Chats - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_trending_sticker_sets_gen.go b/tdapi/tl_get_trending_sticker_sets_gen.go deleted file mode 100644 index 5a5e57d08..000000000 --- a/tdapi/tl_get_trending_sticker_sets_gen.go +++ /dev/null @@ -1,283 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetTrendingStickerSetsRequest represents TL type `getTrendingStickerSets#e058455e`. -type GetTrendingStickerSetsRequest struct { - // Type of the sticker sets to return - StickerType StickerTypeClass - // The offset from which to return the sticker sets; must be non-negative - Offset int32 - // The maximum number of sticker sets to be returned; up to 100. For optimal performance, - // the number of returned sticker sets is chosen by TDLib and can be smaller than the - // specified limit, even if the end of the list has not been reached - Limit int32 -} - -// GetTrendingStickerSetsRequestTypeID is TL type id of GetTrendingStickerSetsRequest. -const GetTrendingStickerSetsRequestTypeID = 0xe058455e - -// Ensuring interfaces in compile-time for GetTrendingStickerSetsRequest. -var ( - _ bin.Encoder = &GetTrendingStickerSetsRequest{} - _ bin.Decoder = &GetTrendingStickerSetsRequest{} - _ bin.BareEncoder = &GetTrendingStickerSetsRequest{} - _ bin.BareDecoder = &GetTrendingStickerSetsRequest{} -) - -func (g *GetTrendingStickerSetsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.StickerType == nil) { - return false - } - if !(g.Offset == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetTrendingStickerSetsRequest) String() string { - if g == nil { - return "GetTrendingStickerSetsRequest(nil)" - } - type Alias GetTrendingStickerSetsRequest - return fmt.Sprintf("GetTrendingStickerSetsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetTrendingStickerSetsRequest) TypeID() uint32 { - return GetTrendingStickerSetsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetTrendingStickerSetsRequest) TypeName() string { - return "getTrendingStickerSets" -} - -// TypeInfo returns info about TL type. -func (g *GetTrendingStickerSetsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getTrendingStickerSets", - ID: GetTrendingStickerSetsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetTrendingStickerSetsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getTrendingStickerSets#e058455e as nil") - } - b.PutID(GetTrendingStickerSetsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetTrendingStickerSetsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getTrendingStickerSets#e058455e as nil") - } - if g.StickerType == nil { - return fmt.Errorf("unable to encode getTrendingStickerSets#e058455e: field sticker_type is nil") - } - if err := g.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode getTrendingStickerSets#e058455e: field sticker_type: %w", err) - } - b.PutInt32(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetTrendingStickerSetsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getTrendingStickerSets#e058455e to nil") - } - if err := b.ConsumeID(GetTrendingStickerSetsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getTrendingStickerSets#e058455e: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetTrendingStickerSetsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getTrendingStickerSets#e058455e to nil") - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode getTrendingStickerSets#e058455e: field sticker_type: %w", err) - } - g.StickerType = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getTrendingStickerSets#e058455e: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getTrendingStickerSets#e058455e: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetTrendingStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getTrendingStickerSets#e058455e as nil") - } - b.ObjStart() - b.PutID("getTrendingStickerSets") - b.Comma() - b.FieldStart("sticker_type") - if g.StickerType == nil { - return fmt.Errorf("unable to encode getTrendingStickerSets#e058455e: field sticker_type is nil") - } - if err := g.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getTrendingStickerSets#e058455e: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("offset") - b.PutInt32(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetTrendingStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getTrendingStickerSets#e058455e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getTrendingStickerSets"); err != nil { - return fmt.Errorf("unable to decode getTrendingStickerSets#e058455e: %w", err) - } - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode getTrendingStickerSets#e058455e: field sticker_type: %w", err) - } - g.StickerType = value - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getTrendingStickerSets#e058455e: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getTrendingStickerSets#e058455e: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerType returns value of StickerType field. -func (g *GetTrendingStickerSetsRequest) GetStickerType() (value StickerTypeClass) { - if g == nil { - return - } - return g.StickerType -} - -// GetOffset returns value of Offset field. -func (g *GetTrendingStickerSetsRequest) GetOffset() (value int32) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetTrendingStickerSetsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetTrendingStickerSets invokes method getTrendingStickerSets#e058455e returning error if any. -func (c *Client) GetTrendingStickerSets(ctx context.Context, request *GetTrendingStickerSetsRequest) (*TrendingStickerSets, error) { - var result TrendingStickerSets - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_user_chat_boosts_gen.go b/tdapi/tl_get_user_chat_boosts_gen.go deleted file mode 100644 index 78bc69f53..000000000 --- a/tdapi/tl_get_user_chat_boosts_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetUserChatBoostsRequest represents TL type `getUserChatBoosts#b90ee799`. -type GetUserChatBoostsRequest struct { - // Identifier of the chat - ChatID int64 - // Identifier of the user - UserID int64 -} - -// GetUserChatBoostsRequestTypeID is TL type id of GetUserChatBoostsRequest. -const GetUserChatBoostsRequestTypeID = 0xb90ee799 - -// Ensuring interfaces in compile-time for GetUserChatBoostsRequest. -var ( - _ bin.Encoder = &GetUserChatBoostsRequest{} - _ bin.Decoder = &GetUserChatBoostsRequest{} - _ bin.BareEncoder = &GetUserChatBoostsRequest{} - _ bin.BareDecoder = &GetUserChatBoostsRequest{} -) - -func (g *GetUserChatBoostsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetUserChatBoostsRequest) String() string { - if g == nil { - return "GetUserChatBoostsRequest(nil)" - } - type Alias GetUserChatBoostsRequest - return fmt.Sprintf("GetUserChatBoostsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetUserChatBoostsRequest) TypeID() uint32 { - return GetUserChatBoostsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetUserChatBoostsRequest) TypeName() string { - return "getUserChatBoosts" -} - -// TypeInfo returns info about TL type. -func (g *GetUserChatBoostsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getUserChatBoosts", - ID: GetUserChatBoostsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetUserChatBoostsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserChatBoosts#b90ee799 as nil") - } - b.PutID(GetUserChatBoostsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetUserChatBoostsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserChatBoosts#b90ee799 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetUserChatBoostsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserChatBoosts#b90ee799 to nil") - } - if err := b.ConsumeID(GetUserChatBoostsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getUserChatBoosts#b90ee799: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetUserChatBoostsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserChatBoosts#b90ee799 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserChatBoosts#b90ee799: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserChatBoosts#b90ee799: field user_id: %w", err) - } - g.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetUserChatBoostsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getUserChatBoosts#b90ee799 as nil") - } - b.ObjStart() - b.PutID("getUserChatBoosts") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetUserChatBoostsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getUserChatBoosts#b90ee799 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getUserChatBoosts"); err != nil { - return fmt.Errorf("unable to decode getUserChatBoosts#b90ee799: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserChatBoosts#b90ee799: field chat_id: %w", err) - } - g.ChatID = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserChatBoosts#b90ee799: field user_id: %w", err) - } - g.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetUserChatBoostsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetUserID returns value of UserID field. -func (g *GetUserChatBoostsRequest) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetUserChatBoosts invokes method getUserChatBoosts#b90ee799 returning error if any. -func (c *Client) GetUserChatBoosts(ctx context.Context, request *GetUserChatBoostsRequest) (*FoundChatBoosts, error) { - var result FoundChatBoosts - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_user_full_info_gen.go b/tdapi/tl_get_user_full_info_gen.go deleted file mode 100644 index 2175b22e8..000000000 --- a/tdapi/tl_get_user_full_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetUserFullInfoRequest represents TL type `getUserFullInfo#d1b29c58`. -type GetUserFullInfoRequest struct { - // User identifier - UserID int64 -} - -// GetUserFullInfoRequestTypeID is TL type id of GetUserFullInfoRequest. -const GetUserFullInfoRequestTypeID = 0xd1b29c58 - -// Ensuring interfaces in compile-time for GetUserFullInfoRequest. -var ( - _ bin.Encoder = &GetUserFullInfoRequest{} - _ bin.Decoder = &GetUserFullInfoRequest{} - _ bin.BareEncoder = &GetUserFullInfoRequest{} - _ bin.BareDecoder = &GetUserFullInfoRequest{} -) - -func (g *GetUserFullInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetUserFullInfoRequest) String() string { - if g == nil { - return "GetUserFullInfoRequest(nil)" - } - type Alias GetUserFullInfoRequest - return fmt.Sprintf("GetUserFullInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetUserFullInfoRequest) TypeID() uint32 { - return GetUserFullInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetUserFullInfoRequest) TypeName() string { - return "getUserFullInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetUserFullInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getUserFullInfo", - ID: GetUserFullInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetUserFullInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserFullInfo#d1b29c58 as nil") - } - b.PutID(GetUserFullInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetUserFullInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserFullInfo#d1b29c58 as nil") - } - b.PutInt53(g.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetUserFullInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserFullInfo#d1b29c58 to nil") - } - if err := b.ConsumeID(GetUserFullInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getUserFullInfo#d1b29c58: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetUserFullInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserFullInfo#d1b29c58 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserFullInfo#d1b29c58: field user_id: %w", err) - } - g.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetUserFullInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getUserFullInfo#d1b29c58 as nil") - } - b.ObjStart() - b.PutID("getUserFullInfo") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetUserFullInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getUserFullInfo#d1b29c58 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getUserFullInfo"); err != nil { - return fmt.Errorf("unable to decode getUserFullInfo#d1b29c58: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserFullInfo#d1b29c58: field user_id: %w", err) - } - g.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (g *GetUserFullInfoRequest) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetUserFullInfo invokes method getUserFullInfo#d1b29c58 returning error if any. -func (c *Client) GetUserFullInfo(ctx context.Context, userid int64) (*UserFullInfo, error) { - var result UserFullInfo - - request := &GetUserFullInfoRequest{ - UserID: userid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_user_gen.go b/tdapi/tl_get_user_gen.go deleted file mode 100644 index 978857300..000000000 --- a/tdapi/tl_get_user_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetUserRequest represents TL type `getUser#42999c0b`. -type GetUserRequest struct { - // User identifier - UserID int64 -} - -// GetUserRequestTypeID is TL type id of GetUserRequest. -const GetUserRequestTypeID = 0x42999c0b - -// Ensuring interfaces in compile-time for GetUserRequest. -var ( - _ bin.Encoder = &GetUserRequest{} - _ bin.Decoder = &GetUserRequest{} - _ bin.BareEncoder = &GetUserRequest{} - _ bin.BareDecoder = &GetUserRequest{} -) - -func (g *GetUserRequest) Zero() bool { - if g == nil { - return true - } - if !(g.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetUserRequest) String() string { - if g == nil { - return "GetUserRequest(nil)" - } - type Alias GetUserRequest - return fmt.Sprintf("GetUserRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetUserRequest) TypeID() uint32 { - return GetUserRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetUserRequest) TypeName() string { - return "getUser" -} - -// TypeInfo returns info about TL type. -func (g *GetUserRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getUser", - ID: GetUserRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetUserRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUser#42999c0b as nil") - } - b.PutID(GetUserRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetUserRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUser#42999c0b as nil") - } - b.PutInt53(g.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetUserRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUser#42999c0b to nil") - } - if err := b.ConsumeID(GetUserRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getUser#42999c0b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetUserRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUser#42999c0b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUser#42999c0b: field user_id: %w", err) - } - g.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetUserRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getUser#42999c0b as nil") - } - b.ObjStart() - b.PutID("getUser") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetUserRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getUser#42999c0b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getUser"); err != nil { - return fmt.Errorf("unable to decode getUser#42999c0b: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUser#42999c0b: field user_id: %w", err) - } - g.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (g *GetUserRequest) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetUser invokes method getUser#42999c0b returning error if any. -func (c *Client) GetUser(ctx context.Context, userid int64) (*User, error) { - var result User - - request := &GetUserRequest{ - UserID: userid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_user_gift_gen.go b/tdapi/tl_get_user_gift_gen.go deleted file mode 100644 index d08a2f0f4..000000000 --- a/tdapi/tl_get_user_gift_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetUserGiftRequest represents TL type `getUserGift#74e6a939`. -type GetUserGiftRequest struct { - // Identifier of the message with the gift - MessageID int64 -} - -// GetUserGiftRequestTypeID is TL type id of GetUserGiftRequest. -const GetUserGiftRequestTypeID = 0x74e6a939 - -// Ensuring interfaces in compile-time for GetUserGiftRequest. -var ( - _ bin.Encoder = &GetUserGiftRequest{} - _ bin.Decoder = &GetUserGiftRequest{} - _ bin.BareEncoder = &GetUserGiftRequest{} - _ bin.BareDecoder = &GetUserGiftRequest{} -) - -func (g *GetUserGiftRequest) Zero() bool { - if g == nil { - return true - } - if !(g.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetUserGiftRequest) String() string { - if g == nil { - return "GetUserGiftRequest(nil)" - } - type Alias GetUserGiftRequest - return fmt.Sprintf("GetUserGiftRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetUserGiftRequest) TypeID() uint32 { - return GetUserGiftRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetUserGiftRequest) TypeName() string { - return "getUserGift" -} - -// TypeInfo returns info about TL type. -func (g *GetUserGiftRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getUserGift", - ID: GetUserGiftRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetUserGiftRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserGift#74e6a939 as nil") - } - b.PutID(GetUserGiftRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetUserGiftRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserGift#74e6a939 as nil") - } - b.PutInt53(g.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetUserGiftRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserGift#74e6a939 to nil") - } - if err := b.ConsumeID(GetUserGiftRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getUserGift#74e6a939: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetUserGiftRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserGift#74e6a939 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserGift#74e6a939: field message_id: %w", err) - } - g.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetUserGiftRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getUserGift#74e6a939 as nil") - } - b.ObjStart() - b.PutID("getUserGift") - b.Comma() - b.FieldStart("message_id") - b.PutInt53(g.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetUserGiftRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getUserGift#74e6a939 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getUserGift"); err != nil { - return fmt.Errorf("unable to decode getUserGift#74e6a939: %w", err) - } - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserGift#74e6a939: field message_id: %w", err) - } - g.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageID returns value of MessageID field. -func (g *GetUserGiftRequest) GetMessageID() (value int64) { - if g == nil { - return - } - return g.MessageID -} - -// GetUserGift invokes method getUserGift#74e6a939 returning error if any. -func (c *Client) GetUserGift(ctx context.Context, messageid int64) (*UserGift, error) { - var result UserGift - - request := &GetUserGiftRequest{ - MessageID: messageid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_user_gifts_gen.go b/tdapi/tl_get_user_gifts_gen.go deleted file mode 100644 index b779d9158..000000000 --- a/tdapi/tl_get_user_gifts_gen.go +++ /dev/null @@ -1,274 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetUserGiftsRequest represents TL type `getUserGifts#b7cdbc7c`. -type GetUserGiftsRequest struct { - // Identifier of the user - UserID int64 - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of gifts to be returned; must be positive and can't be greater than - // 100. For optimal performance, the number of returned objects is chosen by TDLib and - // can be smaller than the specified limit - Limit int32 -} - -// GetUserGiftsRequestTypeID is TL type id of GetUserGiftsRequest. -const GetUserGiftsRequestTypeID = 0xb7cdbc7c - -// Ensuring interfaces in compile-time for GetUserGiftsRequest. -var ( - _ bin.Encoder = &GetUserGiftsRequest{} - _ bin.Decoder = &GetUserGiftsRequest{} - _ bin.BareEncoder = &GetUserGiftsRequest{} - _ bin.BareDecoder = &GetUserGiftsRequest{} -) - -func (g *GetUserGiftsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.UserID == 0) { - return false - } - if !(g.Offset == "") { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetUserGiftsRequest) String() string { - if g == nil { - return "GetUserGiftsRequest(nil)" - } - type Alias GetUserGiftsRequest - return fmt.Sprintf("GetUserGiftsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetUserGiftsRequest) TypeID() uint32 { - return GetUserGiftsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetUserGiftsRequest) TypeName() string { - return "getUserGifts" -} - -// TypeInfo returns info about TL type. -func (g *GetUserGiftsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getUserGifts", - ID: GetUserGiftsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetUserGiftsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserGifts#b7cdbc7c as nil") - } - b.PutID(GetUserGiftsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetUserGiftsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserGifts#b7cdbc7c as nil") - } - b.PutInt53(g.UserID) - b.PutString(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetUserGiftsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserGifts#b7cdbc7c to nil") - } - if err := b.ConsumeID(GetUserGiftsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getUserGifts#b7cdbc7c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetUserGiftsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserGifts#b7cdbc7c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserGifts#b7cdbc7c: field user_id: %w", err) - } - g.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getUserGifts#b7cdbc7c: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getUserGifts#b7cdbc7c: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetUserGiftsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getUserGifts#b7cdbc7c as nil") - } - b.ObjStart() - b.PutID("getUserGifts") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.FieldStart("offset") - b.PutString(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetUserGiftsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getUserGifts#b7cdbc7c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getUserGifts"); err != nil { - return fmt.Errorf("unable to decode getUserGifts#b7cdbc7c: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserGifts#b7cdbc7c: field user_id: %w", err) - } - g.UserID = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getUserGifts#b7cdbc7c: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getUserGifts#b7cdbc7c: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (g *GetUserGiftsRequest) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetOffset returns value of Offset field. -func (g *GetUserGiftsRequest) GetOffset() (value string) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetUserGiftsRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetUserGifts invokes method getUserGifts#b7cdbc7c returning error if any. -func (c *Client) GetUserGifts(ctx context.Context, request *GetUserGiftsRequest) (*UserGifts, error) { - var result UserGifts - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_user_link_gen.go b/tdapi/tl_get_user_link_gen.go deleted file mode 100644 index 9d29c4f41..000000000 --- a/tdapi/tl_get_user_link_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetUserLinkRequest represents TL type `getUserLink#492014e6`. -type GetUserLinkRequest struct { -} - -// GetUserLinkRequestTypeID is TL type id of GetUserLinkRequest. -const GetUserLinkRequestTypeID = 0x492014e6 - -// Ensuring interfaces in compile-time for GetUserLinkRequest. -var ( - _ bin.Encoder = &GetUserLinkRequest{} - _ bin.Decoder = &GetUserLinkRequest{} - _ bin.BareEncoder = &GetUserLinkRequest{} - _ bin.BareDecoder = &GetUserLinkRequest{} -) - -func (g *GetUserLinkRequest) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetUserLinkRequest) String() string { - if g == nil { - return "GetUserLinkRequest(nil)" - } - type Alias GetUserLinkRequest - return fmt.Sprintf("GetUserLinkRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetUserLinkRequest) TypeID() uint32 { - return GetUserLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetUserLinkRequest) TypeName() string { - return "getUserLink" -} - -// TypeInfo returns info about TL type. -func (g *GetUserLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getUserLink", - ID: GetUserLinkRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GetUserLinkRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserLink#492014e6 as nil") - } - b.PutID(GetUserLinkRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetUserLinkRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserLink#492014e6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetUserLinkRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserLink#492014e6 to nil") - } - if err := b.ConsumeID(GetUserLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getUserLink#492014e6: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetUserLinkRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserLink#492014e6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetUserLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getUserLink#492014e6 as nil") - } - b.ObjStart() - b.PutID("getUserLink") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetUserLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getUserLink#492014e6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getUserLink"); err != nil { - return fmt.Errorf("unable to decode getUserLink#492014e6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserLink invokes method getUserLink#492014e6 returning error if any. -func (c *Client) GetUserLink(ctx context.Context) (*UserLink, error) { - var result UserLink - - request := &GetUserLinkRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_user_privacy_setting_rules_gen.go b/tdapi/tl_get_user_privacy_setting_rules_gen.go deleted file mode 100644 index 3eaef14c5..000000000 --- a/tdapi/tl_get_user_privacy_setting_rules_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetUserPrivacySettingRulesRequest represents TL type `getUserPrivacySettingRules#84301671`. -type GetUserPrivacySettingRulesRequest struct { - // The privacy setting - Setting UserPrivacySettingClass -} - -// GetUserPrivacySettingRulesRequestTypeID is TL type id of GetUserPrivacySettingRulesRequest. -const GetUserPrivacySettingRulesRequestTypeID = 0x84301671 - -// Ensuring interfaces in compile-time for GetUserPrivacySettingRulesRequest. -var ( - _ bin.Encoder = &GetUserPrivacySettingRulesRequest{} - _ bin.Decoder = &GetUserPrivacySettingRulesRequest{} - _ bin.BareEncoder = &GetUserPrivacySettingRulesRequest{} - _ bin.BareDecoder = &GetUserPrivacySettingRulesRequest{} -) - -func (g *GetUserPrivacySettingRulesRequest) Zero() bool { - if g == nil { - return true - } - if !(g.Setting == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetUserPrivacySettingRulesRequest) String() string { - if g == nil { - return "GetUserPrivacySettingRulesRequest(nil)" - } - type Alias GetUserPrivacySettingRulesRequest - return fmt.Sprintf("GetUserPrivacySettingRulesRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetUserPrivacySettingRulesRequest) TypeID() uint32 { - return GetUserPrivacySettingRulesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetUserPrivacySettingRulesRequest) TypeName() string { - return "getUserPrivacySettingRules" -} - -// TypeInfo returns info about TL type. -func (g *GetUserPrivacySettingRulesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getUserPrivacySettingRules", - ID: GetUserPrivacySettingRulesRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Setting", - SchemaName: "setting", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetUserPrivacySettingRulesRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserPrivacySettingRules#84301671 as nil") - } - b.PutID(GetUserPrivacySettingRulesRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetUserPrivacySettingRulesRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserPrivacySettingRules#84301671 as nil") - } - if g.Setting == nil { - return fmt.Errorf("unable to encode getUserPrivacySettingRules#84301671: field setting is nil") - } - if err := g.Setting.Encode(b); err != nil { - return fmt.Errorf("unable to encode getUserPrivacySettingRules#84301671: field setting: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetUserPrivacySettingRulesRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserPrivacySettingRules#84301671 to nil") - } - if err := b.ConsumeID(GetUserPrivacySettingRulesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getUserPrivacySettingRules#84301671: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetUserPrivacySettingRulesRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserPrivacySettingRules#84301671 to nil") - } - { - value, err := DecodeUserPrivacySetting(b) - if err != nil { - return fmt.Errorf("unable to decode getUserPrivacySettingRules#84301671: field setting: %w", err) - } - g.Setting = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetUserPrivacySettingRulesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getUserPrivacySettingRules#84301671 as nil") - } - b.ObjStart() - b.PutID("getUserPrivacySettingRules") - b.Comma() - b.FieldStart("setting") - if g.Setting == nil { - return fmt.Errorf("unable to encode getUserPrivacySettingRules#84301671: field setting is nil") - } - if err := g.Setting.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getUserPrivacySettingRules#84301671: field setting: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetUserPrivacySettingRulesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getUserPrivacySettingRules#84301671 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getUserPrivacySettingRules"); err != nil { - return fmt.Errorf("unable to decode getUserPrivacySettingRules#84301671: %w", err) - } - case "setting": - value, err := DecodeTDLibJSONUserPrivacySetting(b) - if err != nil { - return fmt.Errorf("unable to decode getUserPrivacySettingRules#84301671: field setting: %w", err) - } - g.Setting = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSetting returns value of Setting field. -func (g *GetUserPrivacySettingRulesRequest) GetSetting() (value UserPrivacySettingClass) { - if g == nil { - return - } - return g.Setting -} - -// GetUserPrivacySettingRules invokes method getUserPrivacySettingRules#84301671 returning error if any. -func (c *Client) GetUserPrivacySettingRules(ctx context.Context, setting UserPrivacySettingClass) (*UserPrivacySettingRules, error) { - var result UserPrivacySettingRules - - request := &GetUserPrivacySettingRulesRequest{ - Setting: setting, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_user_profile_photos_gen.go b/tdapi/tl_get_user_profile_photos_gen.go deleted file mode 100644 index 1705612fe..000000000 --- a/tdapi/tl_get_user_profile_photos_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetUserProfilePhotosRequest represents TL type `getUserProfilePhotos#c9defe42`. -type GetUserProfilePhotosRequest struct { - // User identifier - UserID int64 - // The number of photos to skip; must be non-negative - Offset int32 - // The maximum number of photos to be returned; up to 100 - Limit int32 -} - -// GetUserProfilePhotosRequestTypeID is TL type id of GetUserProfilePhotosRequest. -const GetUserProfilePhotosRequestTypeID = 0xc9defe42 - -// Ensuring interfaces in compile-time for GetUserProfilePhotosRequest. -var ( - _ bin.Encoder = &GetUserProfilePhotosRequest{} - _ bin.Decoder = &GetUserProfilePhotosRequest{} - _ bin.BareEncoder = &GetUserProfilePhotosRequest{} - _ bin.BareDecoder = &GetUserProfilePhotosRequest{} -) - -func (g *GetUserProfilePhotosRequest) Zero() bool { - if g == nil { - return true - } - if !(g.UserID == 0) { - return false - } - if !(g.Offset == 0) { - return false - } - if !(g.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetUserProfilePhotosRequest) String() string { - if g == nil { - return "GetUserProfilePhotosRequest(nil)" - } - type Alias GetUserProfilePhotosRequest - return fmt.Sprintf("GetUserProfilePhotosRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetUserProfilePhotosRequest) TypeID() uint32 { - return GetUserProfilePhotosRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetUserProfilePhotosRequest) TypeName() string { - return "getUserProfilePhotos" -} - -// TypeInfo returns info about TL type. -func (g *GetUserProfilePhotosRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getUserProfilePhotos", - ID: GetUserProfilePhotosRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetUserProfilePhotosRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserProfilePhotos#c9defe42 as nil") - } - b.PutID(GetUserProfilePhotosRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetUserProfilePhotosRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserProfilePhotos#c9defe42 as nil") - } - b.PutInt53(g.UserID) - b.PutInt32(g.Offset) - b.PutInt32(g.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetUserProfilePhotosRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserProfilePhotos#c9defe42 to nil") - } - if err := b.ConsumeID(GetUserProfilePhotosRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getUserProfilePhotos#c9defe42: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetUserProfilePhotosRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserProfilePhotos#c9defe42 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserProfilePhotos#c9defe42: field user_id: %w", err) - } - g.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getUserProfilePhotos#c9defe42: field offset: %w", err) - } - g.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getUserProfilePhotos#c9defe42: field limit: %w", err) - } - g.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetUserProfilePhotosRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getUserProfilePhotos#c9defe42 as nil") - } - b.ObjStart() - b.PutID("getUserProfilePhotos") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.FieldStart("offset") - b.PutInt32(g.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(g.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetUserProfilePhotosRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getUserProfilePhotos#c9defe42 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getUserProfilePhotos"); err != nil { - return fmt.Errorf("unable to decode getUserProfilePhotos#c9defe42: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserProfilePhotos#c9defe42: field user_id: %w", err) - } - g.UserID = value - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getUserProfilePhotos#c9defe42: field offset: %w", err) - } - g.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode getUserProfilePhotos#c9defe42: field limit: %w", err) - } - g.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (g *GetUserProfilePhotosRequest) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetOffset returns value of Offset field. -func (g *GetUserProfilePhotosRequest) GetOffset() (value int32) { - if g == nil { - return - } - return g.Offset -} - -// GetLimit returns value of Limit field. -func (g *GetUserProfilePhotosRequest) GetLimit() (value int32) { - if g == nil { - return - } - return g.Limit -} - -// GetUserProfilePhotos invokes method getUserProfilePhotos#c9defe42 returning error if any. -func (c *Client) GetUserProfilePhotos(ctx context.Context, request *GetUserProfilePhotosRequest) (*ChatPhotos, error) { - var result ChatPhotos - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_user_support_info_gen.go b/tdapi/tl_get_user_support_info_gen.go deleted file mode 100644 index 51169c5a4..000000000 --- a/tdapi/tl_get_user_support_info_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetUserSupportInfoRequest represents TL type `getUserSupportInfo#74a59305`. -type GetUserSupportInfoRequest struct { - // User identifier - UserID int64 -} - -// GetUserSupportInfoRequestTypeID is TL type id of GetUserSupportInfoRequest. -const GetUserSupportInfoRequestTypeID = 0x74a59305 - -// Ensuring interfaces in compile-time for GetUserSupportInfoRequest. -var ( - _ bin.Encoder = &GetUserSupportInfoRequest{} - _ bin.Decoder = &GetUserSupportInfoRequest{} - _ bin.BareEncoder = &GetUserSupportInfoRequest{} - _ bin.BareDecoder = &GetUserSupportInfoRequest{} -) - -func (g *GetUserSupportInfoRequest) Zero() bool { - if g == nil { - return true - } - if !(g.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetUserSupportInfoRequest) String() string { - if g == nil { - return "GetUserSupportInfoRequest(nil)" - } - type Alias GetUserSupportInfoRequest - return fmt.Sprintf("GetUserSupportInfoRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetUserSupportInfoRequest) TypeID() uint32 { - return GetUserSupportInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetUserSupportInfoRequest) TypeName() string { - return "getUserSupportInfo" -} - -// TypeInfo returns info about TL type. -func (g *GetUserSupportInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getUserSupportInfo", - ID: GetUserSupportInfoRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetUserSupportInfoRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserSupportInfo#74a59305 as nil") - } - b.PutID(GetUserSupportInfoRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetUserSupportInfoRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getUserSupportInfo#74a59305 as nil") - } - b.PutInt53(g.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetUserSupportInfoRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserSupportInfo#74a59305 to nil") - } - if err := b.ConsumeID(GetUserSupportInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getUserSupportInfo#74a59305: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetUserSupportInfoRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getUserSupportInfo#74a59305 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserSupportInfo#74a59305: field user_id: %w", err) - } - g.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetUserSupportInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getUserSupportInfo#74a59305 as nil") - } - b.ObjStart() - b.PutID("getUserSupportInfo") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(g.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetUserSupportInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getUserSupportInfo#74a59305 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getUserSupportInfo"); err != nil { - return fmt.Errorf("unable to decode getUserSupportInfo#74a59305: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getUserSupportInfo#74a59305: field user_id: %w", err) - } - g.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (g *GetUserSupportInfoRequest) GetUserID() (value int64) { - if g == nil { - return - } - return g.UserID -} - -// GetUserSupportInfo invokes method getUserSupportInfo#74a59305 returning error if any. -func (c *Client) GetUserSupportInfo(ctx context.Context, userid int64) (*UserSupportInfo, error) { - var result UserSupportInfo - - request := &GetUserSupportInfoRequest{ - UserID: userid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_video_chat_available_participants_gen.go b/tdapi/tl_get_video_chat_available_participants_gen.go deleted file mode 100644 index edb2a19cd..000000000 --- a/tdapi/tl_get_video_chat_available_participants_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetVideoChatAvailableParticipantsRequest represents TL type `getVideoChatAvailableParticipants#c45da305`. -type GetVideoChatAvailableParticipantsRequest struct { - // Chat identifier - ChatID int64 -} - -// GetVideoChatAvailableParticipantsRequestTypeID is TL type id of GetVideoChatAvailableParticipantsRequest. -const GetVideoChatAvailableParticipantsRequestTypeID = 0xc45da305 - -// Ensuring interfaces in compile-time for GetVideoChatAvailableParticipantsRequest. -var ( - _ bin.Encoder = &GetVideoChatAvailableParticipantsRequest{} - _ bin.Decoder = &GetVideoChatAvailableParticipantsRequest{} - _ bin.BareEncoder = &GetVideoChatAvailableParticipantsRequest{} - _ bin.BareDecoder = &GetVideoChatAvailableParticipantsRequest{} -) - -func (g *GetVideoChatAvailableParticipantsRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetVideoChatAvailableParticipantsRequest) String() string { - if g == nil { - return "GetVideoChatAvailableParticipantsRequest(nil)" - } - type Alias GetVideoChatAvailableParticipantsRequest - return fmt.Sprintf("GetVideoChatAvailableParticipantsRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetVideoChatAvailableParticipantsRequest) TypeID() uint32 { - return GetVideoChatAvailableParticipantsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetVideoChatAvailableParticipantsRequest) TypeName() string { - return "getVideoChatAvailableParticipants" -} - -// TypeInfo returns info about TL type. -func (g *GetVideoChatAvailableParticipantsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getVideoChatAvailableParticipants", - ID: GetVideoChatAvailableParticipantsRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetVideoChatAvailableParticipantsRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getVideoChatAvailableParticipants#c45da305 as nil") - } - b.PutID(GetVideoChatAvailableParticipantsRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetVideoChatAvailableParticipantsRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getVideoChatAvailableParticipants#c45da305 as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetVideoChatAvailableParticipantsRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getVideoChatAvailableParticipants#c45da305 to nil") - } - if err := b.ConsumeID(GetVideoChatAvailableParticipantsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getVideoChatAvailableParticipants#c45da305: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetVideoChatAvailableParticipantsRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getVideoChatAvailableParticipants#c45da305 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getVideoChatAvailableParticipants#c45da305: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetVideoChatAvailableParticipantsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getVideoChatAvailableParticipants#c45da305 as nil") - } - b.ObjStart() - b.PutID("getVideoChatAvailableParticipants") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetVideoChatAvailableParticipantsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getVideoChatAvailableParticipants#c45da305 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getVideoChatAvailableParticipants"); err != nil { - return fmt.Errorf("unable to decode getVideoChatAvailableParticipants#c45da305: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getVideoChatAvailableParticipants#c45da305: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetVideoChatAvailableParticipantsRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetVideoChatAvailableParticipants invokes method getVideoChatAvailableParticipants#c45da305 returning error if any. -func (c *Client) GetVideoChatAvailableParticipants(ctx context.Context, chatid int64) (*MessageSenders, error) { - var result MessageSenders - - request := &GetVideoChatAvailableParticipantsRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_video_chat_rtmp_url_gen.go b/tdapi/tl_get_video_chat_rtmp_url_gen.go deleted file mode 100644 index 2d4af2ded..000000000 --- a/tdapi/tl_get_video_chat_rtmp_url_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetVideoChatRtmpURLRequest represents TL type `getVideoChatRtmpUrl#482b1b1f`. -type GetVideoChatRtmpURLRequest struct { - // Chat identifier - ChatID int64 -} - -// GetVideoChatRtmpURLRequestTypeID is TL type id of GetVideoChatRtmpURLRequest. -const GetVideoChatRtmpURLRequestTypeID = 0x482b1b1f - -// Ensuring interfaces in compile-time for GetVideoChatRtmpURLRequest. -var ( - _ bin.Encoder = &GetVideoChatRtmpURLRequest{} - _ bin.Decoder = &GetVideoChatRtmpURLRequest{} - _ bin.BareEncoder = &GetVideoChatRtmpURLRequest{} - _ bin.BareDecoder = &GetVideoChatRtmpURLRequest{} -) - -func (g *GetVideoChatRtmpURLRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetVideoChatRtmpURLRequest) String() string { - if g == nil { - return "GetVideoChatRtmpURLRequest(nil)" - } - type Alias GetVideoChatRtmpURLRequest - return fmt.Sprintf("GetVideoChatRtmpURLRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetVideoChatRtmpURLRequest) TypeID() uint32 { - return GetVideoChatRtmpURLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetVideoChatRtmpURLRequest) TypeName() string { - return "getVideoChatRtmpUrl" -} - -// TypeInfo returns info about TL type. -func (g *GetVideoChatRtmpURLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getVideoChatRtmpUrl", - ID: GetVideoChatRtmpURLRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetVideoChatRtmpURLRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getVideoChatRtmpUrl#482b1b1f as nil") - } - b.PutID(GetVideoChatRtmpURLRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetVideoChatRtmpURLRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getVideoChatRtmpUrl#482b1b1f as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetVideoChatRtmpURLRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getVideoChatRtmpUrl#482b1b1f to nil") - } - if err := b.ConsumeID(GetVideoChatRtmpURLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getVideoChatRtmpUrl#482b1b1f: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetVideoChatRtmpURLRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getVideoChatRtmpUrl#482b1b1f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getVideoChatRtmpUrl#482b1b1f: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetVideoChatRtmpURLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getVideoChatRtmpUrl#482b1b1f as nil") - } - b.ObjStart() - b.PutID("getVideoChatRtmpUrl") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetVideoChatRtmpURLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getVideoChatRtmpUrl#482b1b1f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getVideoChatRtmpUrl"); err != nil { - return fmt.Errorf("unable to decode getVideoChatRtmpUrl#482b1b1f: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getVideoChatRtmpUrl#482b1b1f: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetVideoChatRtmpURLRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetVideoChatRtmpURL invokes method getVideoChatRtmpUrl#482b1b1f returning error if any. -func (c *Client) GetVideoChatRtmpURL(ctx context.Context, chatid int64) (*RtmpURL, error) { - var result RtmpURL - - request := &GetVideoChatRtmpURLRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_web_app_link_url_gen.go b/tdapi/tl_get_web_app_link_url_gen.go deleted file mode 100644 index 56891cb9c..000000000 --- a/tdapi/tl_get_web_app_link_url_gen.go +++ /dev/null @@ -1,373 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetWebAppLinkURLRequest represents TL type `getWebAppLinkUrl#60fe62c1`. -type GetWebAppLinkURLRequest struct { - // Identifier of the chat in which the link was clicked; pass 0 if none - ChatID int64 - // Identifier of the target bot - BotUserID int64 - // Short name of the Web App - WebAppShortName string - // Start parameter from internalLinkTypeWebApp - StartParameter string - // Pass true if the current user allowed the bot to send them messages - AllowWriteAccess bool - // Parameters to use to open the Web App - Parameters WebAppOpenParameters -} - -// GetWebAppLinkURLRequestTypeID is TL type id of GetWebAppLinkURLRequest. -const GetWebAppLinkURLRequestTypeID = 0x60fe62c1 - -// Ensuring interfaces in compile-time for GetWebAppLinkURLRequest. -var ( - _ bin.Encoder = &GetWebAppLinkURLRequest{} - _ bin.Decoder = &GetWebAppLinkURLRequest{} - _ bin.BareEncoder = &GetWebAppLinkURLRequest{} - _ bin.BareDecoder = &GetWebAppLinkURLRequest{} -) - -func (g *GetWebAppLinkURLRequest) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - if !(g.BotUserID == 0) { - return false - } - if !(g.WebAppShortName == "") { - return false - } - if !(g.StartParameter == "") { - return false - } - if !(g.AllowWriteAccess == false) { - return false - } - if !(g.Parameters.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetWebAppLinkURLRequest) String() string { - if g == nil { - return "GetWebAppLinkURLRequest(nil)" - } - type Alias GetWebAppLinkURLRequest - return fmt.Sprintf("GetWebAppLinkURLRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetWebAppLinkURLRequest) TypeID() uint32 { - return GetWebAppLinkURLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetWebAppLinkURLRequest) TypeName() string { - return "getWebAppLinkUrl" -} - -// TypeInfo returns info about TL type. -func (g *GetWebAppLinkURLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getWebAppLinkUrl", - ID: GetWebAppLinkURLRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "WebAppShortName", - SchemaName: "web_app_short_name", - }, - { - Name: "StartParameter", - SchemaName: "start_parameter", - }, - { - Name: "AllowWriteAccess", - SchemaName: "allow_write_access", - }, - { - Name: "Parameters", - SchemaName: "parameters", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetWebAppLinkURLRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getWebAppLinkUrl#60fe62c1 as nil") - } - b.PutID(GetWebAppLinkURLRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetWebAppLinkURLRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getWebAppLinkUrl#60fe62c1 as nil") - } - b.PutInt53(g.ChatID) - b.PutInt53(g.BotUserID) - b.PutString(g.WebAppShortName) - b.PutString(g.StartParameter) - b.PutBool(g.AllowWriteAccess) - if err := g.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode getWebAppLinkUrl#60fe62c1: field parameters: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetWebAppLinkURLRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getWebAppLinkUrl#60fe62c1 to nil") - } - if err := b.ConsumeID(GetWebAppLinkURLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetWebAppLinkURLRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getWebAppLinkUrl#60fe62c1 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field chat_id: %w", err) - } - g.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field bot_user_id: %w", err) - } - g.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field web_app_short_name: %w", err) - } - g.WebAppShortName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field start_parameter: %w", err) - } - g.StartParameter = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field allow_write_access: %w", err) - } - g.AllowWriteAccess = value - } - { - if err := g.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field parameters: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetWebAppLinkURLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getWebAppLinkUrl#60fe62c1 as nil") - } - b.ObjStart() - b.PutID("getWebAppLinkUrl") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.FieldStart("web_app_short_name") - b.PutString(g.WebAppShortName) - b.Comma() - b.FieldStart("start_parameter") - b.PutString(g.StartParameter) - b.Comma() - b.FieldStart("allow_write_access") - b.PutBool(g.AllowWriteAccess) - b.Comma() - b.FieldStart("parameters") - if err := g.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getWebAppLinkUrl#60fe62c1: field parameters: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetWebAppLinkURLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getWebAppLinkUrl#60fe62c1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getWebAppLinkUrl"); err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field chat_id: %w", err) - } - g.ChatID = value - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field bot_user_id: %w", err) - } - g.BotUserID = value - case "web_app_short_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field web_app_short_name: %w", err) - } - g.WebAppShortName = value - case "start_parameter": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field start_parameter: %w", err) - } - g.StartParameter = value - case "allow_write_access": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field allow_write_access: %w", err) - } - g.AllowWriteAccess = value - case "parameters": - if err := g.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getWebAppLinkUrl#60fe62c1: field parameters: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GetWebAppLinkURLRequest) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetWebAppLinkURLRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetWebAppShortName returns value of WebAppShortName field. -func (g *GetWebAppLinkURLRequest) GetWebAppShortName() (value string) { - if g == nil { - return - } - return g.WebAppShortName -} - -// GetStartParameter returns value of StartParameter field. -func (g *GetWebAppLinkURLRequest) GetStartParameter() (value string) { - if g == nil { - return - } - return g.StartParameter -} - -// GetAllowWriteAccess returns value of AllowWriteAccess field. -func (g *GetWebAppLinkURLRequest) GetAllowWriteAccess() (value bool) { - if g == nil { - return - } - return g.AllowWriteAccess -} - -// GetParameters returns value of Parameters field. -func (g *GetWebAppLinkURLRequest) GetParameters() (value WebAppOpenParameters) { - if g == nil { - return - } - return g.Parameters -} - -// GetWebAppLinkURL invokes method getWebAppLinkUrl#60fe62c1 returning error if any. -func (c *Client) GetWebAppLinkURL(ctx context.Context, request *GetWebAppLinkURLRequest) (*HTTPURL, error) { - var result HTTPURL - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_web_app_placeholder_gen.go b/tdapi/tl_get_web_app_placeholder_gen.go deleted file mode 100644 index e6af091e1..000000000 --- a/tdapi/tl_get_web_app_placeholder_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetWebAppPlaceholderRequest represents TL type `getWebAppPlaceholder#22c70d8f`. -type GetWebAppPlaceholderRequest struct { - // Identifier of the target bot - BotUserID int64 -} - -// GetWebAppPlaceholderRequestTypeID is TL type id of GetWebAppPlaceholderRequest. -const GetWebAppPlaceholderRequestTypeID = 0x22c70d8f - -// Ensuring interfaces in compile-time for GetWebAppPlaceholderRequest. -var ( - _ bin.Encoder = &GetWebAppPlaceholderRequest{} - _ bin.Decoder = &GetWebAppPlaceholderRequest{} - _ bin.BareEncoder = &GetWebAppPlaceholderRequest{} - _ bin.BareDecoder = &GetWebAppPlaceholderRequest{} -) - -func (g *GetWebAppPlaceholderRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BotUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetWebAppPlaceholderRequest) String() string { - if g == nil { - return "GetWebAppPlaceholderRequest(nil)" - } - type Alias GetWebAppPlaceholderRequest - return fmt.Sprintf("GetWebAppPlaceholderRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetWebAppPlaceholderRequest) TypeID() uint32 { - return GetWebAppPlaceholderRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetWebAppPlaceholderRequest) TypeName() string { - return "getWebAppPlaceholder" -} - -// TypeInfo returns info about TL type. -func (g *GetWebAppPlaceholderRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getWebAppPlaceholder", - ID: GetWebAppPlaceholderRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetWebAppPlaceholderRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getWebAppPlaceholder#22c70d8f as nil") - } - b.PutID(GetWebAppPlaceholderRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetWebAppPlaceholderRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getWebAppPlaceholder#22c70d8f as nil") - } - b.PutInt53(g.BotUserID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetWebAppPlaceholderRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getWebAppPlaceholder#22c70d8f to nil") - } - if err := b.ConsumeID(GetWebAppPlaceholderRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getWebAppPlaceholder#22c70d8f: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetWebAppPlaceholderRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getWebAppPlaceholder#22c70d8f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getWebAppPlaceholder#22c70d8f: field bot_user_id: %w", err) - } - g.BotUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetWebAppPlaceholderRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getWebAppPlaceholder#22c70d8f as nil") - } - b.ObjStart() - b.PutID("getWebAppPlaceholder") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetWebAppPlaceholderRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getWebAppPlaceholder#22c70d8f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getWebAppPlaceholder"); err != nil { - return fmt.Errorf("unable to decode getWebAppPlaceholder#22c70d8f: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getWebAppPlaceholder#22c70d8f: field bot_user_id: %w", err) - } - g.BotUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetWebAppPlaceholderRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetWebAppPlaceholder invokes method getWebAppPlaceholder#22c70d8f returning error if any. -func (c *Client) GetWebAppPlaceholder(ctx context.Context, botuserid int64) (*Outline, error) { - var result Outline - - request := &GetWebAppPlaceholderRequest{ - BotUserID: botuserid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_web_app_url_gen.go b/tdapi/tl_get_web_app_url_gen.go deleted file mode 100644 index 72f4980cd..000000000 --- a/tdapi/tl_get_web_app_url_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetWebAppURLRequest represents TL type `getWebAppUrl#a4ff1f44`. -type GetWebAppURLRequest struct { - // Identifier of the target bot - BotUserID int64 - // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp - // button, or an empty string when the bot is opened from the side menu - URL string - // Parameters to use to open the Web App - Parameters WebAppOpenParameters -} - -// GetWebAppURLRequestTypeID is TL type id of GetWebAppURLRequest. -const GetWebAppURLRequestTypeID = 0xa4ff1f44 - -// Ensuring interfaces in compile-time for GetWebAppURLRequest. -var ( - _ bin.Encoder = &GetWebAppURLRequest{} - _ bin.Decoder = &GetWebAppURLRequest{} - _ bin.BareEncoder = &GetWebAppURLRequest{} - _ bin.BareDecoder = &GetWebAppURLRequest{} -) - -func (g *GetWebAppURLRequest) Zero() bool { - if g == nil { - return true - } - if !(g.BotUserID == 0) { - return false - } - if !(g.URL == "") { - return false - } - if !(g.Parameters.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetWebAppURLRequest) String() string { - if g == nil { - return "GetWebAppURLRequest(nil)" - } - type Alias GetWebAppURLRequest - return fmt.Sprintf("GetWebAppURLRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetWebAppURLRequest) TypeID() uint32 { - return GetWebAppURLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetWebAppURLRequest) TypeName() string { - return "getWebAppUrl" -} - -// TypeInfo returns info about TL type. -func (g *GetWebAppURLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getWebAppUrl", - ID: GetWebAppURLRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Parameters", - SchemaName: "parameters", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetWebAppURLRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getWebAppUrl#a4ff1f44 as nil") - } - b.PutID(GetWebAppURLRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetWebAppURLRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getWebAppUrl#a4ff1f44 as nil") - } - b.PutInt53(g.BotUserID) - b.PutString(g.URL) - if err := g.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode getWebAppUrl#a4ff1f44: field parameters: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GetWebAppURLRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getWebAppUrl#a4ff1f44 to nil") - } - if err := b.ConsumeID(GetWebAppURLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getWebAppUrl#a4ff1f44: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetWebAppURLRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getWebAppUrl#a4ff1f44 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getWebAppUrl#a4ff1f44: field bot_user_id: %w", err) - } - g.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getWebAppUrl#a4ff1f44: field url: %w", err) - } - g.URL = value - } - { - if err := g.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode getWebAppUrl#a4ff1f44: field parameters: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetWebAppURLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getWebAppUrl#a4ff1f44 as nil") - } - b.ObjStart() - b.PutID("getWebAppUrl") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(g.BotUserID) - b.Comma() - b.FieldStart("url") - b.PutString(g.URL) - b.Comma() - b.FieldStart("parameters") - if err := g.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode getWebAppUrl#a4ff1f44: field parameters: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetWebAppURLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getWebAppUrl#a4ff1f44 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getWebAppUrl"); err != nil { - return fmt.Errorf("unable to decode getWebAppUrl#a4ff1f44: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode getWebAppUrl#a4ff1f44: field bot_user_id: %w", err) - } - g.BotUserID = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getWebAppUrl#a4ff1f44: field url: %w", err) - } - g.URL = value - case "parameters": - if err := g.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode getWebAppUrl#a4ff1f44: field parameters: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (g *GetWebAppURLRequest) GetBotUserID() (value int64) { - if g == nil { - return - } - return g.BotUserID -} - -// GetURL returns value of URL field. -func (g *GetWebAppURLRequest) GetURL() (value string) { - if g == nil { - return - } - return g.URL -} - -// GetParameters returns value of Parameters field. -func (g *GetWebAppURLRequest) GetParameters() (value WebAppOpenParameters) { - if g == nil { - return - } - return g.Parameters -} - -// GetWebAppURL invokes method getWebAppUrl#a4ff1f44 returning error if any. -func (c *Client) GetWebAppURL(ctx context.Context, request *GetWebAppURLRequest) (*HTTPURL, error) { - var result HTTPURL - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_get_web_page_instant_view_gen.go b/tdapi/tl_get_web_page_instant_view_gen.go deleted file mode 100644 index f0b95215c..000000000 --- a/tdapi/tl_get_web_page_instant_view_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GetWebPageInstantViewRequest represents TL type `getWebPageInstantView#8b045689`. -type GetWebPageInstantViewRequest struct { - // The web page URL - URL string - // Pass true to get full instant view for the web page - ForceFull bool -} - -// GetWebPageInstantViewRequestTypeID is TL type id of GetWebPageInstantViewRequest. -const GetWebPageInstantViewRequestTypeID = 0x8b045689 - -// Ensuring interfaces in compile-time for GetWebPageInstantViewRequest. -var ( - _ bin.Encoder = &GetWebPageInstantViewRequest{} - _ bin.Decoder = &GetWebPageInstantViewRequest{} - _ bin.BareEncoder = &GetWebPageInstantViewRequest{} - _ bin.BareDecoder = &GetWebPageInstantViewRequest{} -) - -func (g *GetWebPageInstantViewRequest) Zero() bool { - if g == nil { - return true - } - if !(g.URL == "") { - return false - } - if !(g.ForceFull == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GetWebPageInstantViewRequest) String() string { - if g == nil { - return "GetWebPageInstantViewRequest(nil)" - } - type Alias GetWebPageInstantViewRequest - return fmt.Sprintf("GetWebPageInstantViewRequest%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GetWebPageInstantViewRequest) TypeID() uint32 { - return GetWebPageInstantViewRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*GetWebPageInstantViewRequest) TypeName() string { - return "getWebPageInstantView" -} - -// TypeInfo returns info about TL type. -func (g *GetWebPageInstantViewRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "getWebPageInstantView", - ID: GetWebPageInstantViewRequestTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "ForceFull", - SchemaName: "force_full", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GetWebPageInstantViewRequest) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getWebPageInstantView#8b045689 as nil") - } - b.PutID(GetWebPageInstantViewRequestTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GetWebPageInstantViewRequest) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode getWebPageInstantView#8b045689 as nil") - } - b.PutString(g.URL) - b.PutBool(g.ForceFull) - return nil -} - -// Decode implements bin.Decoder. -func (g *GetWebPageInstantViewRequest) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getWebPageInstantView#8b045689 to nil") - } - if err := b.ConsumeID(GetWebPageInstantViewRequestTypeID); err != nil { - return fmt.Errorf("unable to decode getWebPageInstantView#8b045689: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GetWebPageInstantViewRequest) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode getWebPageInstantView#8b045689 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getWebPageInstantView#8b045689: field url: %w", err) - } - g.URL = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getWebPageInstantView#8b045689: field force_full: %w", err) - } - g.ForceFull = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GetWebPageInstantViewRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode getWebPageInstantView#8b045689 as nil") - } - b.ObjStart() - b.PutID("getWebPageInstantView") - b.Comma() - b.FieldStart("url") - b.PutString(g.URL) - b.Comma() - b.FieldStart("force_full") - b.PutBool(g.ForceFull) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GetWebPageInstantViewRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode getWebPageInstantView#8b045689 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("getWebPageInstantView"); err != nil { - return fmt.Errorf("unable to decode getWebPageInstantView#8b045689: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode getWebPageInstantView#8b045689: field url: %w", err) - } - g.URL = value - case "force_full": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode getWebPageInstantView#8b045689: field force_full: %w", err) - } - g.ForceFull = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (g *GetWebPageInstantViewRequest) GetURL() (value string) { - if g == nil { - return - } - return g.URL -} - -// GetForceFull returns value of ForceFull field. -func (g *GetWebPageInstantViewRequest) GetForceFull() (value bool) { - if g == nil { - return - } - return g.ForceFull -} - -// GetWebPageInstantView invokes method getWebPageInstantView#8b045689 returning error if any. -func (c *Client) GetWebPageInstantView(ctx context.Context, request *GetWebPageInstantViewRequest) (*WebPageInstantView, error) { - var result WebPageInstantView - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_gift_gen.go b/tdapi/tl_gift_gen.go deleted file mode 100644 index 9acaaa19c..000000000 --- a/tdapi/tl_gift_gen.go +++ /dev/null @@ -1,505 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Gift represents TL type `gift#7cf9442d`. -type Gift struct { - // Unique identifier of the gift - ID int64 - // The sticker representing the gift - Sticker Sticker - // Number of Telegram Stars that must be paid for the gift - StarCount int64 - // Number of Telegram Stars that can be claimed by the receiver instead of the regular - // gift by default. If the gift was paid with just bought Telegram Stars, then full value - // can be claimed - DefaultSellStarCount int64 - // Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't - // possible - UpgradeStarCount int64 - // True, if the gift is a birthday gift - IsForBirthday bool - // Number of remaining times the gift can be purchased by all users; 0 if not limited or - // the gift was sold out - RemainingCount int32 - // Number of total times the gift can be purchased by all users; 0 if not limited - TotalCount int32 - // Point in time (Unix timestamp) when the gift was send for the first time; for sold out - // gifts only - FirstSendDate int32 - // Point in time (Unix timestamp) when the gift was send for the last time; for sold out - // gifts only - LastSendDate int32 -} - -// GiftTypeID is TL type id of Gift. -const GiftTypeID = 0x7cf9442d - -// Ensuring interfaces in compile-time for Gift. -var ( - _ bin.Encoder = &Gift{} - _ bin.Decoder = &Gift{} - _ bin.BareEncoder = &Gift{} - _ bin.BareDecoder = &Gift{} -) - -func (g *Gift) Zero() bool { - if g == nil { - return true - } - if !(g.ID == 0) { - return false - } - if !(g.Sticker.Zero()) { - return false - } - if !(g.StarCount == 0) { - return false - } - if !(g.DefaultSellStarCount == 0) { - return false - } - if !(g.UpgradeStarCount == 0) { - return false - } - if !(g.IsForBirthday == false) { - return false - } - if !(g.RemainingCount == 0) { - return false - } - if !(g.TotalCount == 0) { - return false - } - if !(g.FirstSendDate == 0) { - return false - } - if !(g.LastSendDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *Gift) String() string { - if g == nil { - return "Gift(nil)" - } - type Alias Gift - return fmt.Sprintf("Gift%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Gift) TypeID() uint32 { - return GiftTypeID -} - -// TypeName returns name of type in TL schema. -func (*Gift) TypeName() string { - return "gift" -} - -// TypeInfo returns info about TL type. -func (g *Gift) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "gift", - ID: GiftTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "DefaultSellStarCount", - SchemaName: "default_sell_star_count", - }, - { - Name: "UpgradeStarCount", - SchemaName: "upgrade_star_count", - }, - { - Name: "IsForBirthday", - SchemaName: "is_for_birthday", - }, - { - Name: "RemainingCount", - SchemaName: "remaining_count", - }, - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "FirstSendDate", - SchemaName: "first_send_date", - }, - { - Name: "LastSendDate", - SchemaName: "last_send_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *Gift) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode gift#7cf9442d as nil") - } - b.PutID(GiftTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *Gift) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode gift#7cf9442d as nil") - } - b.PutLong(g.ID) - if err := g.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode gift#7cf9442d: field sticker: %w", err) - } - b.PutInt53(g.StarCount) - b.PutInt53(g.DefaultSellStarCount) - b.PutInt53(g.UpgradeStarCount) - b.PutBool(g.IsForBirthday) - b.PutInt32(g.RemainingCount) - b.PutInt32(g.TotalCount) - b.PutInt32(g.FirstSendDate) - b.PutInt32(g.LastSendDate) - return nil -} - -// Decode implements bin.Decoder. -func (g *Gift) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode gift#7cf9442d to nil") - } - if err := b.ConsumeID(GiftTypeID); err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *Gift) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode gift#7cf9442d to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field id: %w", err) - } - g.ID = value - } - { - if err := g.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field sticker: %w", err) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field star_count: %w", err) - } - g.StarCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field default_sell_star_count: %w", err) - } - g.DefaultSellStarCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field upgrade_star_count: %w", err) - } - g.UpgradeStarCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field is_for_birthday: %w", err) - } - g.IsForBirthday = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field remaining_count: %w", err) - } - g.RemainingCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field total_count: %w", err) - } - g.TotalCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field first_send_date: %w", err) - } - g.FirstSendDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field last_send_date: %w", err) - } - g.LastSendDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *Gift) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode gift#7cf9442d as nil") - } - b.ObjStart() - b.PutID("gift") - b.Comma() - b.FieldStart("id") - b.PutLong(g.ID) - b.Comma() - b.FieldStart("sticker") - if err := g.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode gift#7cf9442d: field sticker: %w", err) - } - b.Comma() - b.FieldStart("star_count") - b.PutInt53(g.StarCount) - b.Comma() - b.FieldStart("default_sell_star_count") - b.PutInt53(g.DefaultSellStarCount) - b.Comma() - b.FieldStart("upgrade_star_count") - b.PutInt53(g.UpgradeStarCount) - b.Comma() - b.FieldStart("is_for_birthday") - b.PutBool(g.IsForBirthday) - b.Comma() - b.FieldStart("remaining_count") - b.PutInt32(g.RemainingCount) - b.Comma() - b.FieldStart("total_count") - b.PutInt32(g.TotalCount) - b.Comma() - b.FieldStart("first_send_date") - b.PutInt32(g.FirstSendDate) - b.Comma() - b.FieldStart("last_send_date") - b.PutInt32(g.LastSendDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *Gift) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode gift#7cf9442d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("gift"); err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field id: %w", err) - } - g.ID = value - case "sticker": - if err := g.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field sticker: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field star_count: %w", err) - } - g.StarCount = value - case "default_sell_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field default_sell_star_count: %w", err) - } - g.DefaultSellStarCount = value - case "upgrade_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field upgrade_star_count: %w", err) - } - g.UpgradeStarCount = value - case "is_for_birthday": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field is_for_birthday: %w", err) - } - g.IsForBirthday = value - case "remaining_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field remaining_count: %w", err) - } - g.RemainingCount = value - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field total_count: %w", err) - } - g.TotalCount = value - case "first_send_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field first_send_date: %w", err) - } - g.FirstSendDate = value - case "last_send_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode gift#7cf9442d: field last_send_date: %w", err) - } - g.LastSendDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (g *Gift) GetID() (value int64) { - if g == nil { - return - } - return g.ID -} - -// GetSticker returns value of Sticker field. -func (g *Gift) GetSticker() (value Sticker) { - if g == nil { - return - } - return g.Sticker -} - -// GetStarCount returns value of StarCount field. -func (g *Gift) GetStarCount() (value int64) { - if g == nil { - return - } - return g.StarCount -} - -// GetDefaultSellStarCount returns value of DefaultSellStarCount field. -func (g *Gift) GetDefaultSellStarCount() (value int64) { - if g == nil { - return - } - return g.DefaultSellStarCount -} - -// GetUpgradeStarCount returns value of UpgradeStarCount field. -func (g *Gift) GetUpgradeStarCount() (value int64) { - if g == nil { - return - } - return g.UpgradeStarCount -} - -// GetIsForBirthday returns value of IsForBirthday field. -func (g *Gift) GetIsForBirthday() (value bool) { - if g == nil { - return - } - return g.IsForBirthday -} - -// GetRemainingCount returns value of RemainingCount field. -func (g *Gift) GetRemainingCount() (value int32) { - if g == nil { - return - } - return g.RemainingCount -} - -// GetTotalCount returns value of TotalCount field. -func (g *Gift) GetTotalCount() (value int32) { - if g == nil { - return - } - return g.TotalCount -} - -// GetFirstSendDate returns value of FirstSendDate field. -func (g *Gift) GetFirstSendDate() (value int32) { - if g == nil { - return - } - return g.FirstSendDate -} - -// GetLastSendDate returns value of LastSendDate field. -func (g *Gift) GetLastSendDate() (value int32) { - if g == nil { - return - } - return g.LastSendDate -} diff --git a/tdapi/tl_gift_upgrade_preview_gen.go b/tdapi/tl_gift_upgrade_preview_gen.go deleted file mode 100644 index 93d77a011..000000000 --- a/tdapi/tl_gift_upgrade_preview_gen.go +++ /dev/null @@ -1,345 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GiftUpgradePreview represents TL type `giftUpgradePreview#4319deef`. -type GiftUpgradePreview struct { - // Examples of possible models that can be chosen for the gift after upgrade - Models []UpgradedGiftModel - // Examples of possible symbols that can be chosen for the gift after upgrade - Symbols []UpgradedGiftSymbol - // Examples of possible backdrops that can be chosen for the gift after upgrade - Backdrops []UpgradedGiftBackdrop -} - -// GiftUpgradePreviewTypeID is TL type id of GiftUpgradePreview. -const GiftUpgradePreviewTypeID = 0x4319deef - -// Ensuring interfaces in compile-time for GiftUpgradePreview. -var ( - _ bin.Encoder = &GiftUpgradePreview{} - _ bin.Decoder = &GiftUpgradePreview{} - _ bin.BareEncoder = &GiftUpgradePreview{} - _ bin.BareDecoder = &GiftUpgradePreview{} -) - -func (g *GiftUpgradePreview) Zero() bool { - if g == nil { - return true - } - if !(g.Models == nil) { - return false - } - if !(g.Symbols == nil) { - return false - } - if !(g.Backdrops == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GiftUpgradePreview) String() string { - if g == nil { - return "GiftUpgradePreview(nil)" - } - type Alias GiftUpgradePreview - return fmt.Sprintf("GiftUpgradePreview%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GiftUpgradePreview) TypeID() uint32 { - return GiftUpgradePreviewTypeID -} - -// TypeName returns name of type in TL schema. -func (*GiftUpgradePreview) TypeName() string { - return "giftUpgradePreview" -} - -// TypeInfo returns info about TL type. -func (g *GiftUpgradePreview) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "giftUpgradePreview", - ID: GiftUpgradePreviewTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Models", - SchemaName: "models", - }, - { - Name: "Symbols", - SchemaName: "symbols", - }, - { - Name: "Backdrops", - SchemaName: "backdrops", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GiftUpgradePreview) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giftUpgradePreview#4319deef as nil") - } - b.PutID(GiftUpgradePreviewTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GiftUpgradePreview) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giftUpgradePreview#4319deef as nil") - } - b.PutInt(len(g.Models)) - for idx, v := range g.Models { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare giftUpgradePreview#4319deef: field models element with index %d: %w", idx, err) - } - } - b.PutInt(len(g.Symbols)) - for idx, v := range g.Symbols { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare giftUpgradePreview#4319deef: field symbols element with index %d: %w", idx, err) - } - } - b.PutInt(len(g.Backdrops)) - for idx, v := range g.Backdrops { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare giftUpgradePreview#4319deef: field backdrops element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GiftUpgradePreview) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giftUpgradePreview#4319deef to nil") - } - if err := b.ConsumeID(GiftUpgradePreviewTypeID); err != nil { - return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GiftUpgradePreview) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giftUpgradePreview#4319deef to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field models: %w", err) - } - - if headerLen > 0 { - g.Models = make([]UpgradedGiftModel, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value UpgradedGiftModel - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare giftUpgradePreview#4319deef: field models: %w", err) - } - g.Models = append(g.Models, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field symbols: %w", err) - } - - if headerLen > 0 { - g.Symbols = make([]UpgradedGiftSymbol, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value UpgradedGiftSymbol - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare giftUpgradePreview#4319deef: field symbols: %w", err) - } - g.Symbols = append(g.Symbols, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field backdrops: %w", err) - } - - if headerLen > 0 { - g.Backdrops = make([]UpgradedGiftBackdrop, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value UpgradedGiftBackdrop - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare giftUpgradePreview#4319deef: field backdrops: %w", err) - } - g.Backdrops = append(g.Backdrops, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GiftUpgradePreview) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode giftUpgradePreview#4319deef as nil") - } - b.ObjStart() - b.PutID("giftUpgradePreview") - b.Comma() - b.FieldStart("models") - b.ArrStart() - for idx, v := range g.Models { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode giftUpgradePreview#4319deef: field models element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("symbols") - b.ArrStart() - for idx, v := range g.Symbols { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode giftUpgradePreview#4319deef: field symbols element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("backdrops") - b.ArrStart() - for idx, v := range g.Backdrops { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode giftUpgradePreview#4319deef: field backdrops element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GiftUpgradePreview) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode giftUpgradePreview#4319deef to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("giftUpgradePreview"); err != nil { - return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: %w", err) - } - case "models": - if err := b.Arr(func(b tdjson.Decoder) error { - var value UpgradedGiftModel - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field models: %w", err) - } - g.Models = append(g.Models, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field models: %w", err) - } - case "symbols": - if err := b.Arr(func(b tdjson.Decoder) error { - var value UpgradedGiftSymbol - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field symbols: %w", err) - } - g.Symbols = append(g.Symbols, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field symbols: %w", err) - } - case "backdrops": - if err := b.Arr(func(b tdjson.Decoder) error { - var value UpgradedGiftBackdrop - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field backdrops: %w", err) - } - g.Backdrops = append(g.Backdrops, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode giftUpgradePreview#4319deef: field backdrops: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetModels returns value of Models field. -func (g *GiftUpgradePreview) GetModels() (value []UpgradedGiftModel) { - if g == nil { - return - } - return g.Models -} - -// GetSymbols returns value of Symbols field. -func (g *GiftUpgradePreview) GetSymbols() (value []UpgradedGiftSymbol) { - if g == nil { - return - } - return g.Symbols -} - -// GetBackdrops returns value of Backdrops field. -func (g *GiftUpgradePreview) GetBackdrops() (value []UpgradedGiftBackdrop) { - if g == nil { - return - } - return g.Backdrops -} diff --git a/tdapi/tl_gifts_gen.go b/tdapi/tl_gifts_gen.go deleted file mode 100644 index 04bc3ab4b..000000000 --- a/tdapi/tl_gifts_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Gifts represents TL type `gifts#7ea494b8`. -type Gifts struct { - // The list of gifts - Gifts []Gift -} - -// GiftsTypeID is TL type id of Gifts. -const GiftsTypeID = 0x7ea494b8 - -// Ensuring interfaces in compile-time for Gifts. -var ( - _ bin.Encoder = &Gifts{} - _ bin.Decoder = &Gifts{} - _ bin.BareEncoder = &Gifts{} - _ bin.BareDecoder = &Gifts{} -) - -func (g *Gifts) Zero() bool { - if g == nil { - return true - } - if !(g.Gifts == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *Gifts) String() string { - if g == nil { - return "Gifts(nil)" - } - type Alias Gifts - return fmt.Sprintf("Gifts%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Gifts) TypeID() uint32 { - return GiftsTypeID -} - -// TypeName returns name of type in TL schema. -func (*Gifts) TypeName() string { - return "gifts" -} - -// TypeInfo returns info about TL type. -func (g *Gifts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "gifts", - ID: GiftsTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Gifts", - SchemaName: "gifts", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *Gifts) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode gifts#7ea494b8 as nil") - } - b.PutID(GiftsTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *Gifts) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode gifts#7ea494b8 as nil") - } - b.PutInt(len(g.Gifts)) - for idx, v := range g.Gifts { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare gifts#7ea494b8: field gifts element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (g *Gifts) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode gifts#7ea494b8 to nil") - } - if err := b.ConsumeID(GiftsTypeID); err != nil { - return fmt.Errorf("unable to decode gifts#7ea494b8: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *Gifts) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode gifts#7ea494b8 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode gifts#7ea494b8: field gifts: %w", err) - } - - if headerLen > 0 { - g.Gifts = make([]Gift, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Gift - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare gifts#7ea494b8: field gifts: %w", err) - } - g.Gifts = append(g.Gifts, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *Gifts) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode gifts#7ea494b8 as nil") - } - b.ObjStart() - b.PutID("gifts") - b.Comma() - b.FieldStart("gifts") - b.ArrStart() - for idx, v := range g.Gifts { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode gifts#7ea494b8: field gifts element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *Gifts) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode gifts#7ea494b8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("gifts"); err != nil { - return fmt.Errorf("unable to decode gifts#7ea494b8: %w", err) - } - case "gifts": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Gift - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode gifts#7ea494b8: field gifts: %w", err) - } - g.Gifts = append(g.Gifts, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode gifts#7ea494b8: field gifts: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGifts returns value of Gifts field. -func (g *Gifts) GetGifts() (value []Gift) { - if g == nil { - return - } - return g.Gifts -} diff --git a/tdapi/tl_giveaway_info_gen.go b/tdapi/tl_giveaway_info_gen.go deleted file mode 100644 index 111db1431..000000000 --- a/tdapi/tl_giveaway_info_gen.go +++ /dev/null @@ -1,824 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GiveawayInfoOngoing represents TL type `giveawayInfoOngoing#624ee050`. -type GiveawayInfoOngoing struct { - // Point in time (Unix timestamp) when the giveaway was created - CreationDate int32 - // Status of the current user in the giveaway - Status GiveawayParticipantStatusClass - // True, if the giveaway has ended and results are being prepared - IsEnded bool -} - -// GiveawayInfoOngoingTypeID is TL type id of GiveawayInfoOngoing. -const GiveawayInfoOngoingTypeID = 0x624ee050 - -// construct implements constructor of GiveawayInfoClass. -func (g GiveawayInfoOngoing) construct() GiveawayInfoClass { return &g } - -// Ensuring interfaces in compile-time for GiveawayInfoOngoing. -var ( - _ bin.Encoder = &GiveawayInfoOngoing{} - _ bin.Decoder = &GiveawayInfoOngoing{} - _ bin.BareEncoder = &GiveawayInfoOngoing{} - _ bin.BareDecoder = &GiveawayInfoOngoing{} - - _ GiveawayInfoClass = &GiveawayInfoOngoing{} -) - -func (g *GiveawayInfoOngoing) Zero() bool { - if g == nil { - return true - } - if !(g.CreationDate == 0) { - return false - } - if !(g.Status == nil) { - return false - } - if !(g.IsEnded == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GiveawayInfoOngoing) String() string { - if g == nil { - return "GiveawayInfoOngoing(nil)" - } - type Alias GiveawayInfoOngoing - return fmt.Sprintf("GiveawayInfoOngoing%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GiveawayInfoOngoing) TypeID() uint32 { - return GiveawayInfoOngoingTypeID -} - -// TypeName returns name of type in TL schema. -func (*GiveawayInfoOngoing) TypeName() string { - return "giveawayInfoOngoing" -} - -// TypeInfo returns info about TL type. -func (g *GiveawayInfoOngoing) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "giveawayInfoOngoing", - ID: GiveawayInfoOngoingTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CreationDate", - SchemaName: "creation_date", - }, - { - Name: "Status", - SchemaName: "status", - }, - { - Name: "IsEnded", - SchemaName: "is_ended", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GiveawayInfoOngoing) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayInfoOngoing#624ee050 as nil") - } - b.PutID(GiveawayInfoOngoingTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GiveawayInfoOngoing) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayInfoOngoing#624ee050 as nil") - } - b.PutInt32(g.CreationDate) - if g.Status == nil { - return fmt.Errorf("unable to encode giveawayInfoOngoing#624ee050: field status is nil") - } - if err := g.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode giveawayInfoOngoing#624ee050: field status: %w", err) - } - b.PutBool(g.IsEnded) - return nil -} - -// Decode implements bin.Decoder. -func (g *GiveawayInfoOngoing) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayInfoOngoing#624ee050 to nil") - } - if err := b.ConsumeID(GiveawayInfoOngoingTypeID); err != nil { - return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GiveawayInfoOngoing) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayInfoOngoing#624ee050 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field creation_date: %w", err) - } - g.CreationDate = value - } - { - value, err := DecodeGiveawayParticipantStatus(b) - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field status: %w", err) - } - g.Status = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field is_ended: %w", err) - } - g.IsEnded = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GiveawayInfoOngoing) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode giveawayInfoOngoing#624ee050 as nil") - } - b.ObjStart() - b.PutID("giveawayInfoOngoing") - b.Comma() - b.FieldStart("creation_date") - b.PutInt32(g.CreationDate) - b.Comma() - b.FieldStart("status") - if g.Status == nil { - return fmt.Errorf("unable to encode giveawayInfoOngoing#624ee050: field status is nil") - } - if err := g.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode giveawayInfoOngoing#624ee050: field status: %w", err) - } - b.Comma() - b.FieldStart("is_ended") - b.PutBool(g.IsEnded) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GiveawayInfoOngoing) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode giveawayInfoOngoing#624ee050 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("giveawayInfoOngoing"); err != nil { - return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: %w", err) - } - case "creation_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field creation_date: %w", err) - } - g.CreationDate = value - case "status": - value, err := DecodeTDLibJSONGiveawayParticipantStatus(b) - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field status: %w", err) - } - g.Status = value - case "is_ended": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoOngoing#624ee050: field is_ended: %w", err) - } - g.IsEnded = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCreationDate returns value of CreationDate field. -func (g *GiveawayInfoOngoing) GetCreationDate() (value int32) { - if g == nil { - return - } - return g.CreationDate -} - -// GetStatus returns value of Status field. -func (g *GiveawayInfoOngoing) GetStatus() (value GiveawayParticipantStatusClass) { - if g == nil { - return - } - return g.Status -} - -// GetIsEnded returns value of IsEnded field. -func (g *GiveawayInfoOngoing) GetIsEnded() (value bool) { - if g == nil { - return - } - return g.IsEnded -} - -// GiveawayInfoCompleted represents TL type `giveawayInfoCompleted#328cc35c`. -type GiveawayInfoCompleted struct { - // Point in time (Unix timestamp) when the giveaway was created - CreationDate int32 - // Point in time (Unix timestamp) when the winners were selected. May be bigger than - // winners selection date specified in parameters of the giveaway - ActualWinnersSelectionDate int32 - // True, if the giveaway was canceled and was fully refunded - WasRefunded bool - // True, if the current user is a winner of the giveaway - IsWinner bool - // Number of winners in the giveaway - WinnerCount int32 - // Number of winners, which activated their gift codes; for Telegram Premium giveaways - // only - ActivationCount int32 - // Telegram Premium gift code that was received by the current user; empty if the user - // isn't a winner in the giveaway or the giveaway isn't a Telegram Premium giveaway - GiftCode string - // The amount of Telegram Stars won by the current user; 0 if the user isn't a winner in - // the giveaway or the giveaway isn't a Telegram Star giveaway - WonStarCount int64 -} - -// GiveawayInfoCompletedTypeID is TL type id of GiveawayInfoCompleted. -const GiveawayInfoCompletedTypeID = 0x328cc35c - -// construct implements constructor of GiveawayInfoClass. -func (g GiveawayInfoCompleted) construct() GiveawayInfoClass { return &g } - -// Ensuring interfaces in compile-time for GiveawayInfoCompleted. -var ( - _ bin.Encoder = &GiveawayInfoCompleted{} - _ bin.Decoder = &GiveawayInfoCompleted{} - _ bin.BareEncoder = &GiveawayInfoCompleted{} - _ bin.BareDecoder = &GiveawayInfoCompleted{} - - _ GiveawayInfoClass = &GiveawayInfoCompleted{} -) - -func (g *GiveawayInfoCompleted) Zero() bool { - if g == nil { - return true - } - if !(g.CreationDate == 0) { - return false - } - if !(g.ActualWinnersSelectionDate == 0) { - return false - } - if !(g.WasRefunded == false) { - return false - } - if !(g.IsWinner == false) { - return false - } - if !(g.WinnerCount == 0) { - return false - } - if !(g.ActivationCount == 0) { - return false - } - if !(g.GiftCode == "") { - return false - } - if !(g.WonStarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GiveawayInfoCompleted) String() string { - if g == nil { - return "GiveawayInfoCompleted(nil)" - } - type Alias GiveawayInfoCompleted - return fmt.Sprintf("GiveawayInfoCompleted%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GiveawayInfoCompleted) TypeID() uint32 { - return GiveawayInfoCompletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*GiveawayInfoCompleted) TypeName() string { - return "giveawayInfoCompleted" -} - -// TypeInfo returns info about TL type. -func (g *GiveawayInfoCompleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "giveawayInfoCompleted", - ID: GiveawayInfoCompletedTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CreationDate", - SchemaName: "creation_date", - }, - { - Name: "ActualWinnersSelectionDate", - SchemaName: "actual_winners_selection_date", - }, - { - Name: "WasRefunded", - SchemaName: "was_refunded", - }, - { - Name: "IsWinner", - SchemaName: "is_winner", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "ActivationCount", - SchemaName: "activation_count", - }, - { - Name: "GiftCode", - SchemaName: "gift_code", - }, - { - Name: "WonStarCount", - SchemaName: "won_star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GiveawayInfoCompleted) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayInfoCompleted#328cc35c as nil") - } - b.PutID(GiveawayInfoCompletedTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GiveawayInfoCompleted) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayInfoCompleted#328cc35c as nil") - } - b.PutInt32(g.CreationDate) - b.PutInt32(g.ActualWinnersSelectionDate) - b.PutBool(g.WasRefunded) - b.PutBool(g.IsWinner) - b.PutInt32(g.WinnerCount) - b.PutInt32(g.ActivationCount) - b.PutString(g.GiftCode) - b.PutInt53(g.WonStarCount) - return nil -} - -// Decode implements bin.Decoder. -func (g *GiveawayInfoCompleted) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayInfoCompleted#328cc35c to nil") - } - if err := b.ConsumeID(GiveawayInfoCompletedTypeID); err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GiveawayInfoCompleted) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayInfoCompleted#328cc35c to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field creation_date: %w", err) - } - g.CreationDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field actual_winners_selection_date: %w", err) - } - g.ActualWinnersSelectionDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field was_refunded: %w", err) - } - g.WasRefunded = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field is_winner: %w", err) - } - g.IsWinner = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field winner_count: %w", err) - } - g.WinnerCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field activation_count: %w", err) - } - g.ActivationCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field gift_code: %w", err) - } - g.GiftCode = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field won_star_count: %w", err) - } - g.WonStarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GiveawayInfoCompleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode giveawayInfoCompleted#328cc35c as nil") - } - b.ObjStart() - b.PutID("giveawayInfoCompleted") - b.Comma() - b.FieldStart("creation_date") - b.PutInt32(g.CreationDate) - b.Comma() - b.FieldStart("actual_winners_selection_date") - b.PutInt32(g.ActualWinnersSelectionDate) - b.Comma() - b.FieldStart("was_refunded") - b.PutBool(g.WasRefunded) - b.Comma() - b.FieldStart("is_winner") - b.PutBool(g.IsWinner) - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(g.WinnerCount) - b.Comma() - b.FieldStart("activation_count") - b.PutInt32(g.ActivationCount) - b.Comma() - b.FieldStart("gift_code") - b.PutString(g.GiftCode) - b.Comma() - b.FieldStart("won_star_count") - b.PutInt53(g.WonStarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GiveawayInfoCompleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode giveawayInfoCompleted#328cc35c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("giveawayInfoCompleted"); err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: %w", err) - } - case "creation_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field creation_date: %w", err) - } - g.CreationDate = value - case "actual_winners_selection_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field actual_winners_selection_date: %w", err) - } - g.ActualWinnersSelectionDate = value - case "was_refunded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field was_refunded: %w", err) - } - g.WasRefunded = value - case "is_winner": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field is_winner: %w", err) - } - g.IsWinner = value - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field winner_count: %w", err) - } - g.WinnerCount = value - case "activation_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field activation_count: %w", err) - } - g.ActivationCount = value - case "gift_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field gift_code: %w", err) - } - g.GiftCode = value - case "won_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode giveawayInfoCompleted#328cc35c: field won_star_count: %w", err) - } - g.WonStarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCreationDate returns value of CreationDate field. -func (g *GiveawayInfoCompleted) GetCreationDate() (value int32) { - if g == nil { - return - } - return g.CreationDate -} - -// GetActualWinnersSelectionDate returns value of ActualWinnersSelectionDate field. -func (g *GiveawayInfoCompleted) GetActualWinnersSelectionDate() (value int32) { - if g == nil { - return - } - return g.ActualWinnersSelectionDate -} - -// GetWasRefunded returns value of WasRefunded field. -func (g *GiveawayInfoCompleted) GetWasRefunded() (value bool) { - if g == nil { - return - } - return g.WasRefunded -} - -// GetIsWinner returns value of IsWinner field. -func (g *GiveawayInfoCompleted) GetIsWinner() (value bool) { - if g == nil { - return - } - return g.IsWinner -} - -// GetWinnerCount returns value of WinnerCount field. -func (g *GiveawayInfoCompleted) GetWinnerCount() (value int32) { - if g == nil { - return - } - return g.WinnerCount -} - -// GetActivationCount returns value of ActivationCount field. -func (g *GiveawayInfoCompleted) GetActivationCount() (value int32) { - if g == nil { - return - } - return g.ActivationCount -} - -// GetGiftCode returns value of GiftCode field. -func (g *GiveawayInfoCompleted) GetGiftCode() (value string) { - if g == nil { - return - } - return g.GiftCode -} - -// GetWonStarCount returns value of WonStarCount field. -func (g *GiveawayInfoCompleted) GetWonStarCount() (value int64) { - if g == nil { - return - } - return g.WonStarCount -} - -// GiveawayInfoClassName is schema name of GiveawayInfoClass. -const GiveawayInfoClassName = "GiveawayInfo" - -// GiveawayInfoClass represents GiveawayInfo generic type. -// -// Example: -// -// g, err := tdapi.DecodeGiveawayInfo(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.GiveawayInfoOngoing: // giveawayInfoOngoing#624ee050 -// case *tdapi.GiveawayInfoCompleted: // giveawayInfoCompleted#328cc35c -// default: panic(v) -// } -type GiveawayInfoClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() GiveawayInfoClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error - - // Point in time (Unix timestamp) when the giveaway was created - GetCreationDate() (value int32) -} - -// DecodeGiveawayInfo implements binary de-serialization for GiveawayInfoClass. -func DecodeGiveawayInfo(buf *bin.Buffer) (GiveawayInfoClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case GiveawayInfoOngoingTypeID: - // Decoding giveawayInfoOngoing#624ee050. - v := GiveawayInfoOngoing{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", err) - } - return &v, nil - case GiveawayInfoCompletedTypeID: - // Decoding giveawayInfoCompleted#328cc35c. - v := GiveawayInfoCompleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONGiveawayInfo implements binary de-serialization for GiveawayInfoClass. -func DecodeTDLibJSONGiveawayInfo(buf tdjson.Decoder) (GiveawayInfoClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "giveawayInfoOngoing": - // Decoding giveawayInfoOngoing#624ee050. - v := GiveawayInfoOngoing{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", err) - } - return &v, nil - case "giveawayInfoCompleted": - // Decoding giveawayInfoCompleted#328cc35c. - v := GiveawayInfoCompleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode GiveawayInfoClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// GiveawayInfo boxes the GiveawayInfoClass providing a helper. -type GiveawayInfoBox struct { - GiveawayInfo GiveawayInfoClass -} - -// Decode implements bin.Decoder for GiveawayInfoBox. -func (b *GiveawayInfoBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode GiveawayInfoBox to nil") - } - v, err := DecodeGiveawayInfo(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.GiveawayInfo = v - return nil -} - -// Encode implements bin.Encode for GiveawayInfoBox. -func (b *GiveawayInfoBox) Encode(buf *bin.Buffer) error { - if b == nil || b.GiveawayInfo == nil { - return fmt.Errorf("unable to encode GiveawayInfoClass as nil") - } - return b.GiveawayInfo.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for GiveawayInfoBox. -func (b *GiveawayInfoBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode GiveawayInfoBox to nil") - } - v, err := DecodeTDLibJSONGiveawayInfo(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.GiveawayInfo = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for GiveawayInfoBox. -func (b *GiveawayInfoBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.GiveawayInfo == nil { - return fmt.Errorf("unable to encode GiveawayInfoClass as nil") - } - return b.GiveawayInfo.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_giveaway_parameters_gen.go b/tdapi/tl_giveaway_parameters_gen.go deleted file mode 100644 index dbe0462ed..000000000 --- a/tdapi/tl_giveaway_parameters_gen.go +++ /dev/null @@ -1,450 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GiveawayParameters represents TL type `giveawayParameters#16f1de3d`. -type GiveawayParameters struct { - // Identifier of the supergroup or channel chat, which will be automatically boosted by - // the winners of the giveaway for duration of the Telegram Premium subscription, - BoostedChatID int64 - // Identifiers of other supergroup or channel chats that must be subscribed by the users - // to be eligible for the giveaway. There can be up to - // getOption("giveaway_additional_chat_count_max") additional chats - AdditionalChatIDs []int64 - // Point in time (Unix timestamp) when the giveaway is expected to be performed; must be - // 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways - WinnersSelectionDate int32 - // True, if only new members of the chats will be eligible for the giveaway - OnlyNewMembers bool - // True, if the list of winners of the giveaway will be available to everyone - HasPublicWinners bool - // The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be - // eligible for the giveaway. If empty, then all users can participate in the giveaway. - CountryCodes []string - // Additional description of the giveaway prize; 0-128 characters - PrizeDescription string -} - -// GiveawayParametersTypeID is TL type id of GiveawayParameters. -const GiveawayParametersTypeID = 0x16f1de3d - -// Ensuring interfaces in compile-time for GiveawayParameters. -var ( - _ bin.Encoder = &GiveawayParameters{} - _ bin.Decoder = &GiveawayParameters{} - _ bin.BareEncoder = &GiveawayParameters{} - _ bin.BareDecoder = &GiveawayParameters{} -) - -func (g *GiveawayParameters) Zero() bool { - if g == nil { - return true - } - if !(g.BoostedChatID == 0) { - return false - } - if !(g.AdditionalChatIDs == nil) { - return false - } - if !(g.WinnersSelectionDate == 0) { - return false - } - if !(g.OnlyNewMembers == false) { - return false - } - if !(g.HasPublicWinners == false) { - return false - } - if !(g.CountryCodes == nil) { - return false - } - if !(g.PrizeDescription == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GiveawayParameters) String() string { - if g == nil { - return "GiveawayParameters(nil)" - } - type Alias GiveawayParameters - return fmt.Sprintf("GiveawayParameters%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GiveawayParameters) TypeID() uint32 { - return GiveawayParametersTypeID -} - -// TypeName returns name of type in TL schema. -func (*GiveawayParameters) TypeName() string { - return "giveawayParameters" -} - -// TypeInfo returns info about TL type. -func (g *GiveawayParameters) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "giveawayParameters", - ID: GiveawayParametersTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BoostedChatID", - SchemaName: "boosted_chat_id", - }, - { - Name: "AdditionalChatIDs", - SchemaName: "additional_chat_ids", - }, - { - Name: "WinnersSelectionDate", - SchemaName: "winners_selection_date", - }, - { - Name: "OnlyNewMembers", - SchemaName: "only_new_members", - }, - { - Name: "HasPublicWinners", - SchemaName: "has_public_winners", - }, - { - Name: "CountryCodes", - SchemaName: "country_codes", - }, - { - Name: "PrizeDescription", - SchemaName: "prize_description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GiveawayParameters) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParameters#16f1de3d as nil") - } - b.PutID(GiveawayParametersTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GiveawayParameters) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParameters#16f1de3d as nil") - } - b.PutInt53(g.BoostedChatID) - b.PutInt(len(g.AdditionalChatIDs)) - for _, v := range g.AdditionalChatIDs { - b.PutInt53(v) - } - b.PutInt32(g.WinnersSelectionDate) - b.PutBool(g.OnlyNewMembers) - b.PutBool(g.HasPublicWinners) - b.PutInt(len(g.CountryCodes)) - for _, v := range g.CountryCodes { - b.PutString(v) - } - b.PutString(g.PrizeDescription) - return nil -} - -// Decode implements bin.Decoder. -func (g *GiveawayParameters) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParameters#16f1de3d to nil") - } - if err := b.ConsumeID(GiveawayParametersTypeID); err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GiveawayParameters) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParameters#16f1de3d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field boosted_chat_id: %w", err) - } - g.BoostedChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field additional_chat_ids: %w", err) - } - - if headerLen > 0 { - g.AdditionalChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field additional_chat_ids: %w", err) - } - g.AdditionalChatIDs = append(g.AdditionalChatIDs, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field winners_selection_date: %w", err) - } - g.WinnersSelectionDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field only_new_members: %w", err) - } - g.OnlyNewMembers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field has_public_winners: %w", err) - } - g.HasPublicWinners = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field country_codes: %w", err) - } - - if headerLen > 0 { - g.CountryCodes = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field country_codes: %w", err) - } - g.CountryCodes = append(g.CountryCodes, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field prize_description: %w", err) - } - g.PrizeDescription = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GiveawayParameters) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParameters#16f1de3d as nil") - } - b.ObjStart() - b.PutID("giveawayParameters") - b.Comma() - b.FieldStart("boosted_chat_id") - b.PutInt53(g.BoostedChatID) - b.Comma() - b.FieldStart("additional_chat_ids") - b.ArrStart() - for _, v := range g.AdditionalChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("winners_selection_date") - b.PutInt32(g.WinnersSelectionDate) - b.Comma() - b.FieldStart("only_new_members") - b.PutBool(g.OnlyNewMembers) - b.Comma() - b.FieldStart("has_public_winners") - b.PutBool(g.HasPublicWinners) - b.Comma() - b.FieldStart("country_codes") - b.ArrStart() - for _, v := range g.CountryCodes { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("prize_description") - b.PutString(g.PrizeDescription) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GiveawayParameters) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParameters#16f1de3d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("giveawayParameters"); err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: %w", err) - } - case "boosted_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field boosted_chat_id: %w", err) - } - g.BoostedChatID = value - case "additional_chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field additional_chat_ids: %w", err) - } - g.AdditionalChatIDs = append(g.AdditionalChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field additional_chat_ids: %w", err) - } - case "winners_selection_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field winners_selection_date: %w", err) - } - g.WinnersSelectionDate = value - case "only_new_members": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field only_new_members: %w", err) - } - g.OnlyNewMembers = value - case "has_public_winners": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field has_public_winners: %w", err) - } - g.HasPublicWinners = value - case "country_codes": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field country_codes: %w", err) - } - g.CountryCodes = append(g.CountryCodes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field country_codes: %w", err) - } - case "prize_description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode giveawayParameters#16f1de3d: field prize_description: %w", err) - } - g.PrizeDescription = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBoostedChatID returns value of BoostedChatID field. -func (g *GiveawayParameters) GetBoostedChatID() (value int64) { - if g == nil { - return - } - return g.BoostedChatID -} - -// GetAdditionalChatIDs returns value of AdditionalChatIDs field. -func (g *GiveawayParameters) GetAdditionalChatIDs() (value []int64) { - if g == nil { - return - } - return g.AdditionalChatIDs -} - -// GetWinnersSelectionDate returns value of WinnersSelectionDate field. -func (g *GiveawayParameters) GetWinnersSelectionDate() (value int32) { - if g == nil { - return - } - return g.WinnersSelectionDate -} - -// GetOnlyNewMembers returns value of OnlyNewMembers field. -func (g *GiveawayParameters) GetOnlyNewMembers() (value bool) { - if g == nil { - return - } - return g.OnlyNewMembers -} - -// GetHasPublicWinners returns value of HasPublicWinners field. -func (g *GiveawayParameters) GetHasPublicWinners() (value bool) { - if g == nil { - return - } - return g.HasPublicWinners -} - -// GetCountryCodes returns value of CountryCodes field. -func (g *GiveawayParameters) GetCountryCodes() (value []string) { - if g == nil { - return - } - return g.CountryCodes -} - -// GetPrizeDescription returns value of PrizeDescription field. -func (g *GiveawayParameters) GetPrizeDescription() (value string) { - if g == nil { - return - } - return g.PrizeDescription -} diff --git a/tdapi/tl_giveaway_participant_status_gen.go b/tdapi/tl_giveaway_participant_status_gen.go deleted file mode 100644 index ca6eefdf2..000000000 --- a/tdapi/tl_giveaway_participant_status_gen.go +++ /dev/null @@ -1,978 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GiveawayParticipantStatusEligible represents TL type `giveawayParticipantStatusEligible#122ade97`. -type GiveawayParticipantStatusEligible struct { -} - -// GiveawayParticipantStatusEligibleTypeID is TL type id of GiveawayParticipantStatusEligible. -const GiveawayParticipantStatusEligibleTypeID = 0x122ade97 - -// construct implements constructor of GiveawayParticipantStatusClass. -func (g GiveawayParticipantStatusEligible) construct() GiveawayParticipantStatusClass { return &g } - -// Ensuring interfaces in compile-time for GiveawayParticipantStatusEligible. -var ( - _ bin.Encoder = &GiveawayParticipantStatusEligible{} - _ bin.Decoder = &GiveawayParticipantStatusEligible{} - _ bin.BareEncoder = &GiveawayParticipantStatusEligible{} - _ bin.BareDecoder = &GiveawayParticipantStatusEligible{} - - _ GiveawayParticipantStatusClass = &GiveawayParticipantStatusEligible{} -) - -func (g *GiveawayParticipantStatusEligible) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GiveawayParticipantStatusEligible) String() string { - if g == nil { - return "GiveawayParticipantStatusEligible(nil)" - } - type Alias GiveawayParticipantStatusEligible - return fmt.Sprintf("GiveawayParticipantStatusEligible%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GiveawayParticipantStatusEligible) TypeID() uint32 { - return GiveawayParticipantStatusEligibleTypeID -} - -// TypeName returns name of type in TL schema. -func (*GiveawayParticipantStatusEligible) TypeName() string { - return "giveawayParticipantStatusEligible" -} - -// TypeInfo returns info about TL type. -func (g *GiveawayParticipantStatusEligible) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "giveawayParticipantStatusEligible", - ID: GiveawayParticipantStatusEligibleTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GiveawayParticipantStatusEligible) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusEligible#122ade97 as nil") - } - b.PutID(GiveawayParticipantStatusEligibleTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GiveawayParticipantStatusEligible) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusEligible#122ade97 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GiveawayParticipantStatusEligible) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusEligible#122ade97 to nil") - } - if err := b.ConsumeID(GiveawayParticipantStatusEligibleTypeID); err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusEligible#122ade97: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GiveawayParticipantStatusEligible) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusEligible#122ade97 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GiveawayParticipantStatusEligible) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusEligible#122ade97 as nil") - } - b.ObjStart() - b.PutID("giveawayParticipantStatusEligible") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GiveawayParticipantStatusEligible) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusEligible#122ade97 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("giveawayParticipantStatusEligible"); err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusEligible#122ade97: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GiveawayParticipantStatusParticipating represents TL type `giveawayParticipantStatusParticipating#1d53e36f`. -type GiveawayParticipantStatusParticipating struct { -} - -// GiveawayParticipantStatusParticipatingTypeID is TL type id of GiveawayParticipantStatusParticipating. -const GiveawayParticipantStatusParticipatingTypeID = 0x1d53e36f - -// construct implements constructor of GiveawayParticipantStatusClass. -func (g GiveawayParticipantStatusParticipating) construct() GiveawayParticipantStatusClass { return &g } - -// Ensuring interfaces in compile-time for GiveawayParticipantStatusParticipating. -var ( - _ bin.Encoder = &GiveawayParticipantStatusParticipating{} - _ bin.Decoder = &GiveawayParticipantStatusParticipating{} - _ bin.BareEncoder = &GiveawayParticipantStatusParticipating{} - _ bin.BareDecoder = &GiveawayParticipantStatusParticipating{} - - _ GiveawayParticipantStatusClass = &GiveawayParticipantStatusParticipating{} -) - -func (g *GiveawayParticipantStatusParticipating) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GiveawayParticipantStatusParticipating) String() string { - if g == nil { - return "GiveawayParticipantStatusParticipating(nil)" - } - type Alias GiveawayParticipantStatusParticipating - return fmt.Sprintf("GiveawayParticipantStatusParticipating%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GiveawayParticipantStatusParticipating) TypeID() uint32 { - return GiveawayParticipantStatusParticipatingTypeID -} - -// TypeName returns name of type in TL schema. -func (*GiveawayParticipantStatusParticipating) TypeName() string { - return "giveawayParticipantStatusParticipating" -} - -// TypeInfo returns info about TL type. -func (g *GiveawayParticipantStatusParticipating) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "giveawayParticipantStatusParticipating", - ID: GiveawayParticipantStatusParticipatingTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GiveawayParticipantStatusParticipating) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusParticipating#1d53e36f as nil") - } - b.PutID(GiveawayParticipantStatusParticipatingTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GiveawayParticipantStatusParticipating) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusParticipating#1d53e36f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GiveawayParticipantStatusParticipating) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusParticipating#1d53e36f to nil") - } - if err := b.ConsumeID(GiveawayParticipantStatusParticipatingTypeID); err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusParticipating#1d53e36f: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GiveawayParticipantStatusParticipating) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusParticipating#1d53e36f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GiveawayParticipantStatusParticipating) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusParticipating#1d53e36f as nil") - } - b.ObjStart() - b.PutID("giveawayParticipantStatusParticipating") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GiveawayParticipantStatusParticipating) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusParticipating#1d53e36f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("giveawayParticipantStatusParticipating"); err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusParticipating#1d53e36f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GiveawayParticipantStatusAlreadyWasMember represents TL type `giveawayParticipantStatusAlreadyWasMember#11f9b5a0`. -type GiveawayParticipantStatusAlreadyWasMember struct { - // Point in time (Unix timestamp) when the user joined the chat - JoinedChatDate int32 -} - -// GiveawayParticipantStatusAlreadyWasMemberTypeID is TL type id of GiveawayParticipantStatusAlreadyWasMember. -const GiveawayParticipantStatusAlreadyWasMemberTypeID = 0x11f9b5a0 - -// construct implements constructor of GiveawayParticipantStatusClass. -func (g GiveawayParticipantStatusAlreadyWasMember) construct() GiveawayParticipantStatusClass { - return &g -} - -// Ensuring interfaces in compile-time for GiveawayParticipantStatusAlreadyWasMember. -var ( - _ bin.Encoder = &GiveawayParticipantStatusAlreadyWasMember{} - _ bin.Decoder = &GiveawayParticipantStatusAlreadyWasMember{} - _ bin.BareEncoder = &GiveawayParticipantStatusAlreadyWasMember{} - _ bin.BareDecoder = &GiveawayParticipantStatusAlreadyWasMember{} - - _ GiveawayParticipantStatusClass = &GiveawayParticipantStatusAlreadyWasMember{} -) - -func (g *GiveawayParticipantStatusAlreadyWasMember) Zero() bool { - if g == nil { - return true - } - if !(g.JoinedChatDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GiveawayParticipantStatusAlreadyWasMember) String() string { - if g == nil { - return "GiveawayParticipantStatusAlreadyWasMember(nil)" - } - type Alias GiveawayParticipantStatusAlreadyWasMember - return fmt.Sprintf("GiveawayParticipantStatusAlreadyWasMember%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GiveawayParticipantStatusAlreadyWasMember) TypeID() uint32 { - return GiveawayParticipantStatusAlreadyWasMemberTypeID -} - -// TypeName returns name of type in TL schema. -func (*GiveawayParticipantStatusAlreadyWasMember) TypeName() string { - return "giveawayParticipantStatusAlreadyWasMember" -} - -// TypeInfo returns info about TL type. -func (g *GiveawayParticipantStatusAlreadyWasMember) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "giveawayParticipantStatusAlreadyWasMember", - ID: GiveawayParticipantStatusAlreadyWasMemberTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "JoinedChatDate", - SchemaName: "joined_chat_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GiveawayParticipantStatusAlreadyWasMember) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 as nil") - } - b.PutID(GiveawayParticipantStatusAlreadyWasMemberTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GiveawayParticipantStatusAlreadyWasMember) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 as nil") - } - b.PutInt32(g.JoinedChatDate) - return nil -} - -// Decode implements bin.Decoder. -func (g *GiveawayParticipantStatusAlreadyWasMember) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 to nil") - } - if err := b.ConsumeID(GiveawayParticipantStatusAlreadyWasMemberTypeID); err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GiveawayParticipantStatusAlreadyWasMember) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: field joined_chat_date: %w", err) - } - g.JoinedChatDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GiveawayParticipantStatusAlreadyWasMember) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 as nil") - } - b.ObjStart() - b.PutID("giveawayParticipantStatusAlreadyWasMember") - b.Comma() - b.FieldStart("joined_chat_date") - b.PutInt32(g.JoinedChatDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GiveawayParticipantStatusAlreadyWasMember) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("giveawayParticipantStatusAlreadyWasMember"); err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: %w", err) - } - case "joined_chat_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusAlreadyWasMember#11f9b5a0: field joined_chat_date: %w", err) - } - g.JoinedChatDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetJoinedChatDate returns value of JoinedChatDate field. -func (g *GiveawayParticipantStatusAlreadyWasMember) GetJoinedChatDate() (value int32) { - if g == nil { - return - } - return g.JoinedChatDate -} - -// GiveawayParticipantStatusAdministrator represents TL type `giveawayParticipantStatusAdministrator#c84b3a75`. -type GiveawayParticipantStatusAdministrator struct { - // Identifier of the chat administered by the user - ChatID int64 -} - -// GiveawayParticipantStatusAdministratorTypeID is TL type id of GiveawayParticipantStatusAdministrator. -const GiveawayParticipantStatusAdministratorTypeID = 0xc84b3a75 - -// construct implements constructor of GiveawayParticipantStatusClass. -func (g GiveawayParticipantStatusAdministrator) construct() GiveawayParticipantStatusClass { return &g } - -// Ensuring interfaces in compile-time for GiveawayParticipantStatusAdministrator. -var ( - _ bin.Encoder = &GiveawayParticipantStatusAdministrator{} - _ bin.Decoder = &GiveawayParticipantStatusAdministrator{} - _ bin.BareEncoder = &GiveawayParticipantStatusAdministrator{} - _ bin.BareDecoder = &GiveawayParticipantStatusAdministrator{} - - _ GiveawayParticipantStatusClass = &GiveawayParticipantStatusAdministrator{} -) - -func (g *GiveawayParticipantStatusAdministrator) Zero() bool { - if g == nil { - return true - } - if !(g.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GiveawayParticipantStatusAdministrator) String() string { - if g == nil { - return "GiveawayParticipantStatusAdministrator(nil)" - } - type Alias GiveawayParticipantStatusAdministrator - return fmt.Sprintf("GiveawayParticipantStatusAdministrator%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GiveawayParticipantStatusAdministrator) TypeID() uint32 { - return GiveawayParticipantStatusAdministratorTypeID -} - -// TypeName returns name of type in TL schema. -func (*GiveawayParticipantStatusAdministrator) TypeName() string { - return "giveawayParticipantStatusAdministrator" -} - -// TypeInfo returns info about TL type. -func (g *GiveawayParticipantStatusAdministrator) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "giveawayParticipantStatusAdministrator", - ID: GiveawayParticipantStatusAdministratorTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GiveawayParticipantStatusAdministrator) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusAdministrator#c84b3a75 as nil") - } - b.PutID(GiveawayParticipantStatusAdministratorTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GiveawayParticipantStatusAdministrator) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusAdministrator#c84b3a75 as nil") - } - b.PutInt53(g.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GiveawayParticipantStatusAdministrator) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusAdministrator#c84b3a75 to nil") - } - if err := b.ConsumeID(GiveawayParticipantStatusAdministratorTypeID); err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GiveawayParticipantStatusAdministrator) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusAdministrator#c84b3a75 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: field chat_id: %w", err) - } - g.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GiveawayParticipantStatusAdministrator) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusAdministrator#c84b3a75 as nil") - } - b.ObjStart() - b.PutID("giveawayParticipantStatusAdministrator") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(g.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GiveawayParticipantStatusAdministrator) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusAdministrator#c84b3a75 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("giveawayParticipantStatusAdministrator"); err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusAdministrator#c84b3a75: field chat_id: %w", err) - } - g.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (g *GiveawayParticipantStatusAdministrator) GetChatID() (value int64) { - if g == nil { - return - } - return g.ChatID -} - -// GiveawayParticipantStatusDisallowedCountry represents TL type `giveawayParticipantStatusDisallowedCountry#700b645b`. -type GiveawayParticipantStatusDisallowedCountry struct { - // A two-letter ISO 3166-1 alpha-2 country code of the user's country - UserCountryCode string -} - -// GiveawayParticipantStatusDisallowedCountryTypeID is TL type id of GiveawayParticipantStatusDisallowedCountry. -const GiveawayParticipantStatusDisallowedCountryTypeID = 0x700b645b - -// construct implements constructor of GiveawayParticipantStatusClass. -func (g GiveawayParticipantStatusDisallowedCountry) construct() GiveawayParticipantStatusClass { - return &g -} - -// Ensuring interfaces in compile-time for GiveawayParticipantStatusDisallowedCountry. -var ( - _ bin.Encoder = &GiveawayParticipantStatusDisallowedCountry{} - _ bin.Decoder = &GiveawayParticipantStatusDisallowedCountry{} - _ bin.BareEncoder = &GiveawayParticipantStatusDisallowedCountry{} - _ bin.BareDecoder = &GiveawayParticipantStatusDisallowedCountry{} - - _ GiveawayParticipantStatusClass = &GiveawayParticipantStatusDisallowedCountry{} -) - -func (g *GiveawayParticipantStatusDisallowedCountry) Zero() bool { - if g == nil { - return true - } - if !(g.UserCountryCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GiveawayParticipantStatusDisallowedCountry) String() string { - if g == nil { - return "GiveawayParticipantStatusDisallowedCountry(nil)" - } - type Alias GiveawayParticipantStatusDisallowedCountry - return fmt.Sprintf("GiveawayParticipantStatusDisallowedCountry%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GiveawayParticipantStatusDisallowedCountry) TypeID() uint32 { - return GiveawayParticipantStatusDisallowedCountryTypeID -} - -// TypeName returns name of type in TL schema. -func (*GiveawayParticipantStatusDisallowedCountry) TypeName() string { - return "giveawayParticipantStatusDisallowedCountry" -} - -// TypeInfo returns info about TL type. -func (g *GiveawayParticipantStatusDisallowedCountry) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "giveawayParticipantStatusDisallowedCountry", - ID: GiveawayParticipantStatusDisallowedCountryTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserCountryCode", - SchemaName: "user_country_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GiveawayParticipantStatusDisallowedCountry) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusDisallowedCountry#700b645b as nil") - } - b.PutID(GiveawayParticipantStatusDisallowedCountryTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GiveawayParticipantStatusDisallowedCountry) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusDisallowedCountry#700b645b as nil") - } - b.PutString(g.UserCountryCode) - return nil -} - -// Decode implements bin.Decoder. -func (g *GiveawayParticipantStatusDisallowedCountry) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusDisallowedCountry#700b645b to nil") - } - if err := b.ConsumeID(GiveawayParticipantStatusDisallowedCountryTypeID); err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GiveawayParticipantStatusDisallowedCountry) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusDisallowedCountry#700b645b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: field user_country_code: %w", err) - } - g.UserCountryCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GiveawayParticipantStatusDisallowedCountry) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode giveawayParticipantStatusDisallowedCountry#700b645b as nil") - } - b.ObjStart() - b.PutID("giveawayParticipantStatusDisallowedCountry") - b.Comma() - b.FieldStart("user_country_code") - b.PutString(g.UserCountryCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GiveawayParticipantStatusDisallowedCountry) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode giveawayParticipantStatusDisallowedCountry#700b645b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("giveawayParticipantStatusDisallowedCountry"); err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: %w", err) - } - case "user_country_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode giveawayParticipantStatusDisallowedCountry#700b645b: field user_country_code: %w", err) - } - g.UserCountryCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserCountryCode returns value of UserCountryCode field. -func (g *GiveawayParticipantStatusDisallowedCountry) GetUserCountryCode() (value string) { - if g == nil { - return - } - return g.UserCountryCode -} - -// GiveawayParticipantStatusClassName is schema name of GiveawayParticipantStatusClass. -const GiveawayParticipantStatusClassName = "GiveawayParticipantStatus" - -// GiveawayParticipantStatusClass represents GiveawayParticipantStatus generic type. -// -// Example: -// -// g, err := tdapi.DecodeGiveawayParticipantStatus(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.GiveawayParticipantStatusEligible: // giveawayParticipantStatusEligible#122ade97 -// case *tdapi.GiveawayParticipantStatusParticipating: // giveawayParticipantStatusParticipating#1d53e36f -// case *tdapi.GiveawayParticipantStatusAlreadyWasMember: // giveawayParticipantStatusAlreadyWasMember#11f9b5a0 -// case *tdapi.GiveawayParticipantStatusAdministrator: // giveawayParticipantStatusAdministrator#c84b3a75 -// case *tdapi.GiveawayParticipantStatusDisallowedCountry: // giveawayParticipantStatusDisallowedCountry#700b645b -// default: panic(v) -// } -type GiveawayParticipantStatusClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() GiveawayParticipantStatusClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeGiveawayParticipantStatus implements binary de-serialization for GiveawayParticipantStatusClass. -func DecodeGiveawayParticipantStatus(buf *bin.Buffer) (GiveawayParticipantStatusClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case GiveawayParticipantStatusEligibleTypeID: - // Decoding giveawayParticipantStatusEligible#122ade97. - v := GiveawayParticipantStatusEligible{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case GiveawayParticipantStatusParticipatingTypeID: - // Decoding giveawayParticipantStatusParticipating#1d53e36f. - v := GiveawayParticipantStatusParticipating{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case GiveawayParticipantStatusAlreadyWasMemberTypeID: - // Decoding giveawayParticipantStatusAlreadyWasMember#11f9b5a0. - v := GiveawayParticipantStatusAlreadyWasMember{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case GiveawayParticipantStatusAdministratorTypeID: - // Decoding giveawayParticipantStatusAdministrator#c84b3a75. - v := GiveawayParticipantStatusAdministrator{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case GiveawayParticipantStatusDisallowedCountryTypeID: - // Decoding giveawayParticipantStatusDisallowedCountry#700b645b. - v := GiveawayParticipantStatusDisallowedCountry{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONGiveawayParticipantStatus implements binary de-serialization for GiveawayParticipantStatusClass. -func DecodeTDLibJSONGiveawayParticipantStatus(buf tdjson.Decoder) (GiveawayParticipantStatusClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "giveawayParticipantStatusEligible": - // Decoding giveawayParticipantStatusEligible#122ade97. - v := GiveawayParticipantStatusEligible{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case "giveawayParticipantStatusParticipating": - // Decoding giveawayParticipantStatusParticipating#1d53e36f. - v := GiveawayParticipantStatusParticipating{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case "giveawayParticipantStatusAlreadyWasMember": - // Decoding giveawayParticipantStatusAlreadyWasMember#11f9b5a0. - v := GiveawayParticipantStatusAlreadyWasMember{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case "giveawayParticipantStatusAdministrator": - // Decoding giveawayParticipantStatusAdministrator#c84b3a75. - v := GiveawayParticipantStatusAdministrator{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) - } - return &v, nil - case "giveawayParticipantStatusDisallowedCountry": - // Decoding giveawayParticipantStatusDisallowedCountry#700b645b. - v := GiveawayParticipantStatusDisallowedCountry{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode GiveawayParticipantStatusClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// GiveawayParticipantStatus boxes the GiveawayParticipantStatusClass providing a helper. -type GiveawayParticipantStatusBox struct { - GiveawayParticipantStatus GiveawayParticipantStatusClass -} - -// Decode implements bin.Decoder for GiveawayParticipantStatusBox. -func (b *GiveawayParticipantStatusBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode GiveawayParticipantStatusBox to nil") - } - v, err := DecodeGiveawayParticipantStatus(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.GiveawayParticipantStatus = v - return nil -} - -// Encode implements bin.Encode for GiveawayParticipantStatusBox. -func (b *GiveawayParticipantStatusBox) Encode(buf *bin.Buffer) error { - if b == nil || b.GiveawayParticipantStatus == nil { - return fmt.Errorf("unable to encode GiveawayParticipantStatusClass as nil") - } - return b.GiveawayParticipantStatus.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for GiveawayParticipantStatusBox. -func (b *GiveawayParticipantStatusBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode GiveawayParticipantStatusBox to nil") - } - v, err := DecodeTDLibJSONGiveawayParticipantStatus(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.GiveawayParticipantStatus = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for GiveawayParticipantStatusBox. -func (b *GiveawayParticipantStatusBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.GiveawayParticipantStatus == nil { - return fmt.Errorf("unable to encode GiveawayParticipantStatusClass as nil") - } - return b.GiveawayParticipantStatus.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_giveaway_prize_gen.go b/tdapi/tl_giveaway_prize_gen.go deleted file mode 100644 index 383db8fb0..000000000 --- a/tdapi/tl_giveaway_prize_gen.go +++ /dev/null @@ -1,502 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GiveawayPrizePremium represents TL type `giveawayPrizePremium#1b12e978`. -type GiveawayPrizePremium struct { - // Number of months the Telegram Premium subscription will be active after code - // activation - MonthCount int32 -} - -// GiveawayPrizePremiumTypeID is TL type id of GiveawayPrizePremium. -const GiveawayPrizePremiumTypeID = 0x1b12e978 - -// construct implements constructor of GiveawayPrizeClass. -func (g GiveawayPrizePremium) construct() GiveawayPrizeClass { return &g } - -// Ensuring interfaces in compile-time for GiveawayPrizePremium. -var ( - _ bin.Encoder = &GiveawayPrizePremium{} - _ bin.Decoder = &GiveawayPrizePremium{} - _ bin.BareEncoder = &GiveawayPrizePremium{} - _ bin.BareDecoder = &GiveawayPrizePremium{} - - _ GiveawayPrizeClass = &GiveawayPrizePremium{} -) - -func (g *GiveawayPrizePremium) Zero() bool { - if g == nil { - return true - } - if !(g.MonthCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GiveawayPrizePremium) String() string { - if g == nil { - return "GiveawayPrizePremium(nil)" - } - type Alias GiveawayPrizePremium - return fmt.Sprintf("GiveawayPrizePremium%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GiveawayPrizePremium) TypeID() uint32 { - return GiveawayPrizePremiumTypeID -} - -// TypeName returns name of type in TL schema. -func (*GiveawayPrizePremium) TypeName() string { - return "giveawayPrizePremium" -} - -// TypeInfo returns info about TL type. -func (g *GiveawayPrizePremium) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "giveawayPrizePremium", - ID: GiveawayPrizePremiumTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MonthCount", - SchemaName: "month_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GiveawayPrizePremium) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayPrizePremium#1b12e978 as nil") - } - b.PutID(GiveawayPrizePremiumTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GiveawayPrizePremium) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayPrizePremium#1b12e978 as nil") - } - b.PutInt32(g.MonthCount) - return nil -} - -// Decode implements bin.Decoder. -func (g *GiveawayPrizePremium) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayPrizePremium#1b12e978 to nil") - } - if err := b.ConsumeID(GiveawayPrizePremiumTypeID); err != nil { - return fmt.Errorf("unable to decode giveawayPrizePremium#1b12e978: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GiveawayPrizePremium) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayPrizePremium#1b12e978 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayPrizePremium#1b12e978: field month_count: %w", err) - } - g.MonthCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GiveawayPrizePremium) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode giveawayPrizePremium#1b12e978 as nil") - } - b.ObjStart() - b.PutID("giveawayPrizePremium") - b.Comma() - b.FieldStart("month_count") - b.PutInt32(g.MonthCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GiveawayPrizePremium) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode giveawayPrizePremium#1b12e978 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("giveawayPrizePremium"); err != nil { - return fmt.Errorf("unable to decode giveawayPrizePremium#1b12e978: %w", err) - } - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode giveawayPrizePremium#1b12e978: field month_count: %w", err) - } - g.MonthCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMonthCount returns value of MonthCount field. -func (g *GiveawayPrizePremium) GetMonthCount() (value int32) { - if g == nil { - return - } - return g.MonthCount -} - -// GiveawayPrizeStars represents TL type `giveawayPrizeStars#954c1fa4`. -type GiveawayPrizeStars struct { - // Number of Telegram Stars that will be shared by all winners - StarCount int64 -} - -// GiveawayPrizeStarsTypeID is TL type id of GiveawayPrizeStars. -const GiveawayPrizeStarsTypeID = 0x954c1fa4 - -// construct implements constructor of GiveawayPrizeClass. -func (g GiveawayPrizeStars) construct() GiveawayPrizeClass { return &g } - -// Ensuring interfaces in compile-time for GiveawayPrizeStars. -var ( - _ bin.Encoder = &GiveawayPrizeStars{} - _ bin.Decoder = &GiveawayPrizeStars{} - _ bin.BareEncoder = &GiveawayPrizeStars{} - _ bin.BareDecoder = &GiveawayPrizeStars{} - - _ GiveawayPrizeClass = &GiveawayPrizeStars{} -) - -func (g *GiveawayPrizeStars) Zero() bool { - if g == nil { - return true - } - if !(g.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GiveawayPrizeStars) String() string { - if g == nil { - return "GiveawayPrizeStars(nil)" - } - type Alias GiveawayPrizeStars - return fmt.Sprintf("GiveawayPrizeStars%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GiveawayPrizeStars) TypeID() uint32 { - return GiveawayPrizeStarsTypeID -} - -// TypeName returns name of type in TL schema. -func (*GiveawayPrizeStars) TypeName() string { - return "giveawayPrizeStars" -} - -// TypeInfo returns info about TL type. -func (g *GiveawayPrizeStars) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "giveawayPrizeStars", - ID: GiveawayPrizeStarsTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GiveawayPrizeStars) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayPrizeStars#954c1fa4 as nil") - } - b.PutID(GiveawayPrizeStarsTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GiveawayPrizeStars) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode giveawayPrizeStars#954c1fa4 as nil") - } - b.PutInt53(g.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (g *GiveawayPrizeStars) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayPrizeStars#954c1fa4 to nil") - } - if err := b.ConsumeID(GiveawayPrizeStarsTypeID); err != nil { - return fmt.Errorf("unable to decode giveawayPrizeStars#954c1fa4: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GiveawayPrizeStars) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode giveawayPrizeStars#954c1fa4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode giveawayPrizeStars#954c1fa4: field star_count: %w", err) - } - g.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GiveawayPrizeStars) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode giveawayPrizeStars#954c1fa4 as nil") - } - b.ObjStart() - b.PutID("giveawayPrizeStars") - b.Comma() - b.FieldStart("star_count") - b.PutInt53(g.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GiveawayPrizeStars) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode giveawayPrizeStars#954c1fa4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("giveawayPrizeStars"); err != nil { - return fmt.Errorf("unable to decode giveawayPrizeStars#954c1fa4: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode giveawayPrizeStars#954c1fa4: field star_count: %w", err) - } - g.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarCount returns value of StarCount field. -func (g *GiveawayPrizeStars) GetStarCount() (value int64) { - if g == nil { - return - } - return g.StarCount -} - -// GiveawayPrizeClassName is schema name of GiveawayPrizeClass. -const GiveawayPrizeClassName = "GiveawayPrize" - -// GiveawayPrizeClass represents GiveawayPrize generic type. -// -// Example: -// -// g, err := tdapi.DecodeGiveawayPrize(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.GiveawayPrizePremium: // giveawayPrizePremium#1b12e978 -// case *tdapi.GiveawayPrizeStars: // giveawayPrizeStars#954c1fa4 -// default: panic(v) -// } -type GiveawayPrizeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() GiveawayPrizeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeGiveawayPrize implements binary de-serialization for GiveawayPrizeClass. -func DecodeGiveawayPrize(buf *bin.Buffer) (GiveawayPrizeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case GiveawayPrizePremiumTypeID: - // Decoding giveawayPrizePremium#1b12e978. - v := GiveawayPrizePremium{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", err) - } - return &v, nil - case GiveawayPrizeStarsTypeID: - // Decoding giveawayPrizeStars#954c1fa4. - v := GiveawayPrizeStars{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONGiveawayPrize implements binary de-serialization for GiveawayPrizeClass. -func DecodeTDLibJSONGiveawayPrize(buf tdjson.Decoder) (GiveawayPrizeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "giveawayPrizePremium": - // Decoding giveawayPrizePremium#1b12e978. - v := GiveawayPrizePremium{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", err) - } - return &v, nil - case "giveawayPrizeStars": - // Decoding giveawayPrizeStars#954c1fa4. - v := GiveawayPrizeStars{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode GiveawayPrizeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// GiveawayPrize boxes the GiveawayPrizeClass providing a helper. -type GiveawayPrizeBox struct { - GiveawayPrize GiveawayPrizeClass -} - -// Decode implements bin.Decoder for GiveawayPrizeBox. -func (b *GiveawayPrizeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode GiveawayPrizeBox to nil") - } - v, err := DecodeGiveawayPrize(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.GiveawayPrize = v - return nil -} - -// Encode implements bin.Encode for GiveawayPrizeBox. -func (b *GiveawayPrizeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.GiveawayPrize == nil { - return fmt.Errorf("unable to encode GiveawayPrizeClass as nil") - } - return b.GiveawayPrize.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for GiveawayPrizeBox. -func (b *GiveawayPrizeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode GiveawayPrizeBox to nil") - } - v, err := DecodeTDLibJSONGiveawayPrize(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.GiveawayPrize = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for GiveawayPrizeBox. -func (b *GiveawayPrizeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.GiveawayPrize == nil { - return fmt.Errorf("unable to encode GiveawayPrizeClass as nil") - } - return b.GiveawayPrize.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_group_call_gen.go b/tdapi/tl_group_call_gen.go deleted file mode 100644 index b75b930a1..000000000 --- a/tdapi/tl_group_call_gen.go +++ /dev/null @@ -1,906 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GroupCall represents TL type `groupCall#9ac55fff`. -type GroupCall struct { - // Group call identifier - ID int32 - // Group call title - Title string - // Point in time (Unix timestamp) when the group call is expected to be started by an - // administrator; 0 if it is already active or was ended - ScheduledStartDate int32 - // True, if the group call is scheduled and the current user will receive a notification - // when the group call starts - EnabledStartNotification bool - // True, if the call is active - IsActive bool - // True, if the chat is an RTMP stream instead of an ordinary video chat - IsRtmpStream bool - // True, if the call is joined - IsJoined bool - // True, if user was kicked from the call because of network loss and the call needs to - // be rejoined - NeedRejoin bool - // True, if the current user can manage the group call - CanBeManaged bool - // Number of participants in the group call - ParticipantCount int32 - // True, if group call participants, which are muted, aren't returned in participant list - HasHiddenListeners bool - // True, if all group call participants are loaded - LoadedAllParticipants bool - // At most 3 recently speaking users in the group call - RecentSpeakers []GroupCallRecentSpeaker - // True, if the current user's video is enabled - IsMyVideoEnabled bool - // True, if the current user's video is paused - IsMyVideoPaused bool - // True, if the current user can broadcast video or share screen - CanEnableVideo bool - // True, if only group call administrators can unmute new participants - MuteNewParticipants bool - // True, if the current user can enable or disable mute_new_participants setting - CanToggleMuteNewParticipants bool - // Duration of the ongoing group call recording, in seconds; 0 if none. An - // updateGroupCall update is not triggered when value of this field changes, but the same - // recording goes on - RecordDuration int32 - // True, if a video file is being recorded for the call - IsVideoRecorded bool - // Call duration, in seconds; for ended calls only - Duration int32 -} - -// GroupCallTypeID is TL type id of GroupCall. -const GroupCallTypeID = 0x9ac55fff - -// Ensuring interfaces in compile-time for GroupCall. -var ( - _ bin.Encoder = &GroupCall{} - _ bin.Decoder = &GroupCall{} - _ bin.BareEncoder = &GroupCall{} - _ bin.BareDecoder = &GroupCall{} -) - -func (g *GroupCall) Zero() bool { - if g == nil { - return true - } - if !(g.ID == 0) { - return false - } - if !(g.Title == "") { - return false - } - if !(g.ScheduledStartDate == 0) { - return false - } - if !(g.EnabledStartNotification == false) { - return false - } - if !(g.IsActive == false) { - return false - } - if !(g.IsRtmpStream == false) { - return false - } - if !(g.IsJoined == false) { - return false - } - if !(g.NeedRejoin == false) { - return false - } - if !(g.CanBeManaged == false) { - return false - } - if !(g.ParticipantCount == 0) { - return false - } - if !(g.HasHiddenListeners == false) { - return false - } - if !(g.LoadedAllParticipants == false) { - return false - } - if !(g.RecentSpeakers == nil) { - return false - } - if !(g.IsMyVideoEnabled == false) { - return false - } - if !(g.IsMyVideoPaused == false) { - return false - } - if !(g.CanEnableVideo == false) { - return false - } - if !(g.MuteNewParticipants == false) { - return false - } - if !(g.CanToggleMuteNewParticipants == false) { - return false - } - if !(g.RecordDuration == 0) { - return false - } - if !(g.IsVideoRecorded == false) { - return false - } - if !(g.Duration == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GroupCall) String() string { - if g == nil { - return "GroupCall(nil)" - } - type Alias GroupCall - return fmt.Sprintf("GroupCall%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GroupCall) TypeID() uint32 { - return GroupCallTypeID -} - -// TypeName returns name of type in TL schema. -func (*GroupCall) TypeName() string { - return "groupCall" -} - -// TypeInfo returns info about TL type. -func (g *GroupCall) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "groupCall", - ID: GroupCallTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "ScheduledStartDate", - SchemaName: "scheduled_start_date", - }, - { - Name: "EnabledStartNotification", - SchemaName: "enabled_start_notification", - }, - { - Name: "IsActive", - SchemaName: "is_active", - }, - { - Name: "IsRtmpStream", - SchemaName: "is_rtmp_stream", - }, - { - Name: "IsJoined", - SchemaName: "is_joined", - }, - { - Name: "NeedRejoin", - SchemaName: "need_rejoin", - }, - { - Name: "CanBeManaged", - SchemaName: "can_be_managed", - }, - { - Name: "ParticipantCount", - SchemaName: "participant_count", - }, - { - Name: "HasHiddenListeners", - SchemaName: "has_hidden_listeners", - }, - { - Name: "LoadedAllParticipants", - SchemaName: "loaded_all_participants", - }, - { - Name: "RecentSpeakers", - SchemaName: "recent_speakers", - }, - { - Name: "IsMyVideoEnabled", - SchemaName: "is_my_video_enabled", - }, - { - Name: "IsMyVideoPaused", - SchemaName: "is_my_video_paused", - }, - { - Name: "CanEnableVideo", - SchemaName: "can_enable_video", - }, - { - Name: "MuteNewParticipants", - SchemaName: "mute_new_participants", - }, - { - Name: "CanToggleMuteNewParticipants", - SchemaName: "can_toggle_mute_new_participants", - }, - { - Name: "RecordDuration", - SchemaName: "record_duration", - }, - { - Name: "IsVideoRecorded", - SchemaName: "is_video_recorded", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GroupCall) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCall#9ac55fff as nil") - } - b.PutID(GroupCallTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GroupCall) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCall#9ac55fff as nil") - } - b.PutInt32(g.ID) - b.PutString(g.Title) - b.PutInt32(g.ScheduledStartDate) - b.PutBool(g.EnabledStartNotification) - b.PutBool(g.IsActive) - b.PutBool(g.IsRtmpStream) - b.PutBool(g.IsJoined) - b.PutBool(g.NeedRejoin) - b.PutBool(g.CanBeManaged) - b.PutInt32(g.ParticipantCount) - b.PutBool(g.HasHiddenListeners) - b.PutBool(g.LoadedAllParticipants) - b.PutInt(len(g.RecentSpeakers)) - for idx, v := range g.RecentSpeakers { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare groupCall#9ac55fff: field recent_speakers element with index %d: %w", idx, err) - } - } - b.PutBool(g.IsMyVideoEnabled) - b.PutBool(g.IsMyVideoPaused) - b.PutBool(g.CanEnableVideo) - b.PutBool(g.MuteNewParticipants) - b.PutBool(g.CanToggleMuteNewParticipants) - b.PutInt32(g.RecordDuration) - b.PutBool(g.IsVideoRecorded) - b.PutInt32(g.Duration) - return nil -} - -// Decode implements bin.Decoder. -func (g *GroupCall) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCall#9ac55fff to nil") - } - if err := b.ConsumeID(GroupCallTypeID); err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GroupCall) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCall#9ac55fff to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field id: %w", err) - } - g.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field title: %w", err) - } - g.Title = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field scheduled_start_date: %w", err) - } - g.ScheduledStartDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field enabled_start_notification: %w", err) - } - g.EnabledStartNotification = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_active: %w", err) - } - g.IsActive = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_rtmp_stream: %w", err) - } - g.IsRtmpStream = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_joined: %w", err) - } - g.IsJoined = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field need_rejoin: %w", err) - } - g.NeedRejoin = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field can_be_managed: %w", err) - } - g.CanBeManaged = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field participant_count: %w", err) - } - g.ParticipantCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field has_hidden_listeners: %w", err) - } - g.HasHiddenListeners = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field loaded_all_participants: %w", err) - } - g.LoadedAllParticipants = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field recent_speakers: %w", err) - } - - if headerLen > 0 { - g.RecentSpeakers = make([]GroupCallRecentSpeaker, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value GroupCallRecentSpeaker - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare groupCall#9ac55fff: field recent_speakers: %w", err) - } - g.RecentSpeakers = append(g.RecentSpeakers, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_my_video_enabled: %w", err) - } - g.IsMyVideoEnabled = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_my_video_paused: %w", err) - } - g.IsMyVideoPaused = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field can_enable_video: %w", err) - } - g.CanEnableVideo = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field mute_new_participants: %w", err) - } - g.MuteNewParticipants = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field can_toggle_mute_new_participants: %w", err) - } - g.CanToggleMuteNewParticipants = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field record_duration: %w", err) - } - g.RecordDuration = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_video_recorded: %w", err) - } - g.IsVideoRecorded = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field duration: %w", err) - } - g.Duration = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GroupCall) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode groupCall#9ac55fff as nil") - } - b.ObjStart() - b.PutID("groupCall") - b.Comma() - b.FieldStart("id") - b.PutInt32(g.ID) - b.Comma() - b.FieldStart("title") - b.PutString(g.Title) - b.Comma() - b.FieldStart("scheduled_start_date") - b.PutInt32(g.ScheduledStartDate) - b.Comma() - b.FieldStart("enabled_start_notification") - b.PutBool(g.EnabledStartNotification) - b.Comma() - b.FieldStart("is_active") - b.PutBool(g.IsActive) - b.Comma() - b.FieldStart("is_rtmp_stream") - b.PutBool(g.IsRtmpStream) - b.Comma() - b.FieldStart("is_joined") - b.PutBool(g.IsJoined) - b.Comma() - b.FieldStart("need_rejoin") - b.PutBool(g.NeedRejoin) - b.Comma() - b.FieldStart("can_be_managed") - b.PutBool(g.CanBeManaged) - b.Comma() - b.FieldStart("participant_count") - b.PutInt32(g.ParticipantCount) - b.Comma() - b.FieldStart("has_hidden_listeners") - b.PutBool(g.HasHiddenListeners) - b.Comma() - b.FieldStart("loaded_all_participants") - b.PutBool(g.LoadedAllParticipants) - b.Comma() - b.FieldStart("recent_speakers") - b.ArrStart() - for idx, v := range g.RecentSpeakers { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode groupCall#9ac55fff: field recent_speakers element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("is_my_video_enabled") - b.PutBool(g.IsMyVideoEnabled) - b.Comma() - b.FieldStart("is_my_video_paused") - b.PutBool(g.IsMyVideoPaused) - b.Comma() - b.FieldStart("can_enable_video") - b.PutBool(g.CanEnableVideo) - b.Comma() - b.FieldStart("mute_new_participants") - b.PutBool(g.MuteNewParticipants) - b.Comma() - b.FieldStart("can_toggle_mute_new_participants") - b.PutBool(g.CanToggleMuteNewParticipants) - b.Comma() - b.FieldStart("record_duration") - b.PutInt32(g.RecordDuration) - b.Comma() - b.FieldStart("is_video_recorded") - b.PutBool(g.IsVideoRecorded) - b.Comma() - b.FieldStart("duration") - b.PutInt32(g.Duration) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GroupCall) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode groupCall#9ac55fff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("groupCall"); err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field id: %w", err) - } - g.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field title: %w", err) - } - g.Title = value - case "scheduled_start_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field scheduled_start_date: %w", err) - } - g.ScheduledStartDate = value - case "enabled_start_notification": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field enabled_start_notification: %w", err) - } - g.EnabledStartNotification = value - case "is_active": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_active: %w", err) - } - g.IsActive = value - case "is_rtmp_stream": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_rtmp_stream: %w", err) - } - g.IsRtmpStream = value - case "is_joined": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_joined: %w", err) - } - g.IsJoined = value - case "need_rejoin": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field need_rejoin: %w", err) - } - g.NeedRejoin = value - case "can_be_managed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field can_be_managed: %w", err) - } - g.CanBeManaged = value - case "participant_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field participant_count: %w", err) - } - g.ParticipantCount = value - case "has_hidden_listeners": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field has_hidden_listeners: %w", err) - } - g.HasHiddenListeners = value - case "loaded_all_participants": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field loaded_all_participants: %w", err) - } - g.LoadedAllParticipants = value - case "recent_speakers": - if err := b.Arr(func(b tdjson.Decoder) error { - var value GroupCallRecentSpeaker - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field recent_speakers: %w", err) - } - g.RecentSpeakers = append(g.RecentSpeakers, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field recent_speakers: %w", err) - } - case "is_my_video_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_my_video_enabled: %w", err) - } - g.IsMyVideoEnabled = value - case "is_my_video_paused": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_my_video_paused: %w", err) - } - g.IsMyVideoPaused = value - case "can_enable_video": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field can_enable_video: %w", err) - } - g.CanEnableVideo = value - case "mute_new_participants": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field mute_new_participants: %w", err) - } - g.MuteNewParticipants = value - case "can_toggle_mute_new_participants": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field can_toggle_mute_new_participants: %w", err) - } - g.CanToggleMuteNewParticipants = value - case "record_duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field record_duration: %w", err) - } - g.RecordDuration = value - case "is_video_recorded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field is_video_recorded: %w", err) - } - g.IsVideoRecorded = value - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCall#9ac55fff: field duration: %w", err) - } - g.Duration = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (g *GroupCall) GetID() (value int32) { - if g == nil { - return - } - return g.ID -} - -// GetTitle returns value of Title field. -func (g *GroupCall) GetTitle() (value string) { - if g == nil { - return - } - return g.Title -} - -// GetScheduledStartDate returns value of ScheduledStartDate field. -func (g *GroupCall) GetScheduledStartDate() (value int32) { - if g == nil { - return - } - return g.ScheduledStartDate -} - -// GetEnabledStartNotification returns value of EnabledStartNotification field. -func (g *GroupCall) GetEnabledStartNotification() (value bool) { - if g == nil { - return - } - return g.EnabledStartNotification -} - -// GetIsActive returns value of IsActive field. -func (g *GroupCall) GetIsActive() (value bool) { - if g == nil { - return - } - return g.IsActive -} - -// GetIsRtmpStream returns value of IsRtmpStream field. -func (g *GroupCall) GetIsRtmpStream() (value bool) { - if g == nil { - return - } - return g.IsRtmpStream -} - -// GetIsJoined returns value of IsJoined field. -func (g *GroupCall) GetIsJoined() (value bool) { - if g == nil { - return - } - return g.IsJoined -} - -// GetNeedRejoin returns value of NeedRejoin field. -func (g *GroupCall) GetNeedRejoin() (value bool) { - if g == nil { - return - } - return g.NeedRejoin -} - -// GetCanBeManaged returns value of CanBeManaged field. -func (g *GroupCall) GetCanBeManaged() (value bool) { - if g == nil { - return - } - return g.CanBeManaged -} - -// GetParticipantCount returns value of ParticipantCount field. -func (g *GroupCall) GetParticipantCount() (value int32) { - if g == nil { - return - } - return g.ParticipantCount -} - -// GetHasHiddenListeners returns value of HasHiddenListeners field. -func (g *GroupCall) GetHasHiddenListeners() (value bool) { - if g == nil { - return - } - return g.HasHiddenListeners -} - -// GetLoadedAllParticipants returns value of LoadedAllParticipants field. -func (g *GroupCall) GetLoadedAllParticipants() (value bool) { - if g == nil { - return - } - return g.LoadedAllParticipants -} - -// GetRecentSpeakers returns value of RecentSpeakers field. -func (g *GroupCall) GetRecentSpeakers() (value []GroupCallRecentSpeaker) { - if g == nil { - return - } - return g.RecentSpeakers -} - -// GetIsMyVideoEnabled returns value of IsMyVideoEnabled field. -func (g *GroupCall) GetIsMyVideoEnabled() (value bool) { - if g == nil { - return - } - return g.IsMyVideoEnabled -} - -// GetIsMyVideoPaused returns value of IsMyVideoPaused field. -func (g *GroupCall) GetIsMyVideoPaused() (value bool) { - if g == nil { - return - } - return g.IsMyVideoPaused -} - -// GetCanEnableVideo returns value of CanEnableVideo field. -func (g *GroupCall) GetCanEnableVideo() (value bool) { - if g == nil { - return - } - return g.CanEnableVideo -} - -// GetMuteNewParticipants returns value of MuteNewParticipants field. -func (g *GroupCall) GetMuteNewParticipants() (value bool) { - if g == nil { - return - } - return g.MuteNewParticipants -} - -// GetCanToggleMuteNewParticipants returns value of CanToggleMuteNewParticipants field. -func (g *GroupCall) GetCanToggleMuteNewParticipants() (value bool) { - if g == nil { - return - } - return g.CanToggleMuteNewParticipants -} - -// GetRecordDuration returns value of RecordDuration field. -func (g *GroupCall) GetRecordDuration() (value int32) { - if g == nil { - return - } - return g.RecordDuration -} - -// GetIsVideoRecorded returns value of IsVideoRecorded field. -func (g *GroupCall) GetIsVideoRecorded() (value bool) { - if g == nil { - return - } - return g.IsVideoRecorded -} - -// GetDuration returns value of Duration field. -func (g *GroupCall) GetDuration() (value int32) { - if g == nil { - return - } - return g.Duration -} diff --git a/tdapi/tl_group_call_id_gen.go b/tdapi/tl_group_call_id_gen.go deleted file mode 100644 index 8ec98c6b8..000000000 --- a/tdapi/tl_group_call_id_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GroupCallID represents TL type `groupCallId#14e4bb45`. -type GroupCallID struct { - // Group call identifier - ID int32 -} - -// GroupCallIDTypeID is TL type id of GroupCallID. -const GroupCallIDTypeID = 0x14e4bb45 - -// Ensuring interfaces in compile-time for GroupCallID. -var ( - _ bin.Encoder = &GroupCallID{} - _ bin.Decoder = &GroupCallID{} - _ bin.BareEncoder = &GroupCallID{} - _ bin.BareDecoder = &GroupCallID{} -) - -func (g *GroupCallID) Zero() bool { - if g == nil { - return true - } - if !(g.ID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GroupCallID) String() string { - if g == nil { - return "GroupCallID(nil)" - } - type Alias GroupCallID - return fmt.Sprintf("GroupCallID%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GroupCallID) TypeID() uint32 { - return GroupCallIDTypeID -} - -// TypeName returns name of type in TL schema. -func (*GroupCallID) TypeName() string { - return "groupCallId" -} - -// TypeInfo returns info about TL type. -func (g *GroupCallID) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "groupCallId", - ID: GroupCallIDTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GroupCallID) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallId#14e4bb45 as nil") - } - b.PutID(GroupCallIDTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GroupCallID) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallId#14e4bb45 as nil") - } - b.PutInt32(g.ID) - return nil -} - -// Decode implements bin.Decoder. -func (g *GroupCallID) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallId#14e4bb45 to nil") - } - if err := b.ConsumeID(GroupCallIDTypeID); err != nil { - return fmt.Errorf("unable to decode groupCallId#14e4bb45: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GroupCallID) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallId#14e4bb45 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallId#14e4bb45: field id: %w", err) - } - g.ID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GroupCallID) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode groupCallId#14e4bb45 as nil") - } - b.ObjStart() - b.PutID("groupCallId") - b.Comma() - b.FieldStart("id") - b.PutInt32(g.ID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GroupCallID) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode groupCallId#14e4bb45 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("groupCallId"); err != nil { - return fmt.Errorf("unable to decode groupCallId#14e4bb45: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallId#14e4bb45: field id: %w", err) - } - g.ID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (g *GroupCallID) GetID() (value int32) { - if g == nil { - return - } - return g.ID -} diff --git a/tdapi/tl_group_call_participant_gen.go b/tdapi/tl_group_call_participant_gen.go deleted file mode 100644 index 2570ba14a..000000000 --- a/tdapi/tl_group_call_participant_gen.go +++ /dev/null @@ -1,786 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GroupCallParticipant represents TL type `groupCallParticipant#7abca1eb`. -type GroupCallParticipant struct { - // Identifier of the group call participant - ParticipantID MessageSenderClass - // User's audio channel synchronization source identifier - AudioSourceID int32 - // User's screen sharing audio channel synchronization source identifier - ScreenSharingAudioSourceID int32 - // Information about user's video channel; may be null if there is no active video - VideoInfo GroupCallParticipantVideoInfo - // Information about user's screen sharing video channel; may be null if there is no - // active screen sharing video - ScreenSharingVideoInfo GroupCallParticipantVideoInfo - // The participant user's bio or the participant chat's description - Bio string - // True, if the participant is the current user - IsCurrentUser bool - // True, if the participant is speaking as set by setGroupCallParticipantIsSpeaking - IsSpeaking bool - // True, if the participant hand is raised - IsHandRaised bool - // True, if the current user can mute the participant for all other group call - // participants - CanBeMutedForAllUsers bool - // True, if the current user can allow the participant to unmute themselves or unmute the - // participant (if the participant is the current user) - CanBeUnmutedForAllUsers bool - // True, if the current user can mute the participant only for self - CanBeMutedForCurrentUser bool - // True, if the current user can unmute the participant for self - CanBeUnmutedForCurrentUser bool - // True, if the participant is muted for all users - IsMutedForAllUsers bool - // True, if the participant is muted for the current user - IsMutedForCurrentUser bool - // True, if the participant is muted for all users, but can unmute themselves - CanUnmuteSelf bool - // Participant's volume level; 1-20000 in hundreds of percents - VolumeLevel int32 - // User's order in the group call participant list. Orders must be compared - // lexicographically. The bigger is order, the higher is user in the list. If order is - // empty, the user must be removed from the participant list - Order string -} - -// GroupCallParticipantTypeID is TL type id of GroupCallParticipant. -const GroupCallParticipantTypeID = 0x7abca1eb - -// Ensuring interfaces in compile-time for GroupCallParticipant. -var ( - _ bin.Encoder = &GroupCallParticipant{} - _ bin.Decoder = &GroupCallParticipant{} - _ bin.BareEncoder = &GroupCallParticipant{} - _ bin.BareDecoder = &GroupCallParticipant{} -) - -func (g *GroupCallParticipant) Zero() bool { - if g == nil { - return true - } - if !(g.ParticipantID == nil) { - return false - } - if !(g.AudioSourceID == 0) { - return false - } - if !(g.ScreenSharingAudioSourceID == 0) { - return false - } - if !(g.VideoInfo.Zero()) { - return false - } - if !(g.ScreenSharingVideoInfo.Zero()) { - return false - } - if !(g.Bio == "") { - return false - } - if !(g.IsCurrentUser == false) { - return false - } - if !(g.IsSpeaking == false) { - return false - } - if !(g.IsHandRaised == false) { - return false - } - if !(g.CanBeMutedForAllUsers == false) { - return false - } - if !(g.CanBeUnmutedForAllUsers == false) { - return false - } - if !(g.CanBeMutedForCurrentUser == false) { - return false - } - if !(g.CanBeUnmutedForCurrentUser == false) { - return false - } - if !(g.IsMutedForAllUsers == false) { - return false - } - if !(g.IsMutedForCurrentUser == false) { - return false - } - if !(g.CanUnmuteSelf == false) { - return false - } - if !(g.VolumeLevel == 0) { - return false - } - if !(g.Order == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GroupCallParticipant) String() string { - if g == nil { - return "GroupCallParticipant(nil)" - } - type Alias GroupCallParticipant - return fmt.Sprintf("GroupCallParticipant%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GroupCallParticipant) TypeID() uint32 { - return GroupCallParticipantTypeID -} - -// TypeName returns name of type in TL schema. -func (*GroupCallParticipant) TypeName() string { - return "groupCallParticipant" -} - -// TypeInfo returns info about TL type. -func (g *GroupCallParticipant) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "groupCallParticipant", - ID: GroupCallParticipantTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ParticipantID", - SchemaName: "participant_id", - }, - { - Name: "AudioSourceID", - SchemaName: "audio_source_id", - }, - { - Name: "ScreenSharingAudioSourceID", - SchemaName: "screen_sharing_audio_source_id", - }, - { - Name: "VideoInfo", - SchemaName: "video_info", - }, - { - Name: "ScreenSharingVideoInfo", - SchemaName: "screen_sharing_video_info", - }, - { - Name: "Bio", - SchemaName: "bio", - }, - { - Name: "IsCurrentUser", - SchemaName: "is_current_user", - }, - { - Name: "IsSpeaking", - SchemaName: "is_speaking", - }, - { - Name: "IsHandRaised", - SchemaName: "is_hand_raised", - }, - { - Name: "CanBeMutedForAllUsers", - SchemaName: "can_be_muted_for_all_users", - }, - { - Name: "CanBeUnmutedForAllUsers", - SchemaName: "can_be_unmuted_for_all_users", - }, - { - Name: "CanBeMutedForCurrentUser", - SchemaName: "can_be_muted_for_current_user", - }, - { - Name: "CanBeUnmutedForCurrentUser", - SchemaName: "can_be_unmuted_for_current_user", - }, - { - Name: "IsMutedForAllUsers", - SchemaName: "is_muted_for_all_users", - }, - { - Name: "IsMutedForCurrentUser", - SchemaName: "is_muted_for_current_user", - }, - { - Name: "CanUnmuteSelf", - SchemaName: "can_unmute_self", - }, - { - Name: "VolumeLevel", - SchemaName: "volume_level", - }, - { - Name: "Order", - SchemaName: "order", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GroupCallParticipant) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallParticipant#7abca1eb as nil") - } - b.PutID(GroupCallParticipantTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GroupCallParticipant) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallParticipant#7abca1eb as nil") - } - if g.ParticipantID == nil { - return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field participant_id is nil") - } - if err := g.ParticipantID.Encode(b); err != nil { - return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field participant_id: %w", err) - } - b.PutInt32(g.AudioSourceID) - b.PutInt32(g.ScreenSharingAudioSourceID) - if err := g.VideoInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field video_info: %w", err) - } - if err := g.ScreenSharingVideoInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field screen_sharing_video_info: %w", err) - } - b.PutString(g.Bio) - b.PutBool(g.IsCurrentUser) - b.PutBool(g.IsSpeaking) - b.PutBool(g.IsHandRaised) - b.PutBool(g.CanBeMutedForAllUsers) - b.PutBool(g.CanBeUnmutedForAllUsers) - b.PutBool(g.CanBeMutedForCurrentUser) - b.PutBool(g.CanBeUnmutedForCurrentUser) - b.PutBool(g.IsMutedForAllUsers) - b.PutBool(g.IsMutedForCurrentUser) - b.PutBool(g.CanUnmuteSelf) - b.PutInt32(g.VolumeLevel) - b.PutString(g.Order) - return nil -} - -// Decode implements bin.Decoder. -func (g *GroupCallParticipant) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallParticipant#7abca1eb to nil") - } - if err := b.ConsumeID(GroupCallParticipantTypeID); err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GroupCallParticipant) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallParticipant#7abca1eb to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field participant_id: %w", err) - } - g.ParticipantID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field audio_source_id: %w", err) - } - g.AudioSourceID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field screen_sharing_audio_source_id: %w", err) - } - g.ScreenSharingAudioSourceID = value - } - { - if err := g.VideoInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field video_info: %w", err) - } - } - { - if err := g.ScreenSharingVideoInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field screen_sharing_video_info: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field bio: %w", err) - } - g.Bio = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_current_user: %w", err) - } - g.IsCurrentUser = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_speaking: %w", err) - } - g.IsSpeaking = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_hand_raised: %w", err) - } - g.IsHandRaised = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_muted_for_all_users: %w", err) - } - g.CanBeMutedForAllUsers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_unmuted_for_all_users: %w", err) - } - g.CanBeUnmutedForAllUsers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_muted_for_current_user: %w", err) - } - g.CanBeMutedForCurrentUser = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_unmuted_for_current_user: %w", err) - } - g.CanBeUnmutedForCurrentUser = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_muted_for_all_users: %w", err) - } - g.IsMutedForAllUsers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_muted_for_current_user: %w", err) - } - g.IsMutedForCurrentUser = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_unmute_self: %w", err) - } - g.CanUnmuteSelf = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field volume_level: %w", err) - } - g.VolumeLevel = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field order: %w", err) - } - g.Order = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GroupCallParticipant) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode groupCallParticipant#7abca1eb as nil") - } - b.ObjStart() - b.PutID("groupCallParticipant") - b.Comma() - b.FieldStart("participant_id") - if g.ParticipantID == nil { - return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field participant_id is nil") - } - if err := g.ParticipantID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field participant_id: %w", err) - } - b.Comma() - b.FieldStart("audio_source_id") - b.PutInt32(g.AudioSourceID) - b.Comma() - b.FieldStart("screen_sharing_audio_source_id") - b.PutInt32(g.ScreenSharingAudioSourceID) - b.Comma() - b.FieldStart("video_info") - if err := g.VideoInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field video_info: %w", err) - } - b.Comma() - b.FieldStart("screen_sharing_video_info") - if err := g.ScreenSharingVideoInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode groupCallParticipant#7abca1eb: field screen_sharing_video_info: %w", err) - } - b.Comma() - b.FieldStart("bio") - b.PutString(g.Bio) - b.Comma() - b.FieldStart("is_current_user") - b.PutBool(g.IsCurrentUser) - b.Comma() - b.FieldStart("is_speaking") - b.PutBool(g.IsSpeaking) - b.Comma() - b.FieldStart("is_hand_raised") - b.PutBool(g.IsHandRaised) - b.Comma() - b.FieldStart("can_be_muted_for_all_users") - b.PutBool(g.CanBeMutedForAllUsers) - b.Comma() - b.FieldStart("can_be_unmuted_for_all_users") - b.PutBool(g.CanBeUnmutedForAllUsers) - b.Comma() - b.FieldStart("can_be_muted_for_current_user") - b.PutBool(g.CanBeMutedForCurrentUser) - b.Comma() - b.FieldStart("can_be_unmuted_for_current_user") - b.PutBool(g.CanBeUnmutedForCurrentUser) - b.Comma() - b.FieldStart("is_muted_for_all_users") - b.PutBool(g.IsMutedForAllUsers) - b.Comma() - b.FieldStart("is_muted_for_current_user") - b.PutBool(g.IsMutedForCurrentUser) - b.Comma() - b.FieldStart("can_unmute_self") - b.PutBool(g.CanUnmuteSelf) - b.Comma() - b.FieldStart("volume_level") - b.PutInt32(g.VolumeLevel) - b.Comma() - b.FieldStart("order") - b.PutString(g.Order) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GroupCallParticipant) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode groupCallParticipant#7abca1eb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("groupCallParticipant"); err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: %w", err) - } - case "participant_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field participant_id: %w", err) - } - g.ParticipantID = value - case "audio_source_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field audio_source_id: %w", err) - } - g.AudioSourceID = value - case "screen_sharing_audio_source_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field screen_sharing_audio_source_id: %w", err) - } - g.ScreenSharingAudioSourceID = value - case "video_info": - if err := g.VideoInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field video_info: %w", err) - } - case "screen_sharing_video_info": - if err := g.ScreenSharingVideoInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field screen_sharing_video_info: %w", err) - } - case "bio": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field bio: %w", err) - } - g.Bio = value - case "is_current_user": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_current_user: %w", err) - } - g.IsCurrentUser = value - case "is_speaking": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_speaking: %w", err) - } - g.IsSpeaking = value - case "is_hand_raised": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_hand_raised: %w", err) - } - g.IsHandRaised = value - case "can_be_muted_for_all_users": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_muted_for_all_users: %w", err) - } - g.CanBeMutedForAllUsers = value - case "can_be_unmuted_for_all_users": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_unmuted_for_all_users: %w", err) - } - g.CanBeUnmutedForAllUsers = value - case "can_be_muted_for_current_user": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_muted_for_current_user: %w", err) - } - g.CanBeMutedForCurrentUser = value - case "can_be_unmuted_for_current_user": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_be_unmuted_for_current_user: %w", err) - } - g.CanBeUnmutedForCurrentUser = value - case "is_muted_for_all_users": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_muted_for_all_users: %w", err) - } - g.IsMutedForAllUsers = value - case "is_muted_for_current_user": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field is_muted_for_current_user: %w", err) - } - g.IsMutedForCurrentUser = value - case "can_unmute_self": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field can_unmute_self: %w", err) - } - g.CanUnmuteSelf = value - case "volume_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field volume_level: %w", err) - } - g.VolumeLevel = value - case "order": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipant#7abca1eb: field order: %w", err) - } - g.Order = value - default: - return b.Skip() - } - return nil - }) -} - -// GetParticipantID returns value of ParticipantID field. -func (g *GroupCallParticipant) GetParticipantID() (value MessageSenderClass) { - if g == nil { - return - } - return g.ParticipantID -} - -// GetAudioSourceID returns value of AudioSourceID field. -func (g *GroupCallParticipant) GetAudioSourceID() (value int32) { - if g == nil { - return - } - return g.AudioSourceID -} - -// GetScreenSharingAudioSourceID returns value of ScreenSharingAudioSourceID field. -func (g *GroupCallParticipant) GetScreenSharingAudioSourceID() (value int32) { - if g == nil { - return - } - return g.ScreenSharingAudioSourceID -} - -// GetVideoInfo returns value of VideoInfo field. -func (g *GroupCallParticipant) GetVideoInfo() (value GroupCallParticipantVideoInfo) { - if g == nil { - return - } - return g.VideoInfo -} - -// GetScreenSharingVideoInfo returns value of ScreenSharingVideoInfo field. -func (g *GroupCallParticipant) GetScreenSharingVideoInfo() (value GroupCallParticipantVideoInfo) { - if g == nil { - return - } - return g.ScreenSharingVideoInfo -} - -// GetBio returns value of Bio field. -func (g *GroupCallParticipant) GetBio() (value string) { - if g == nil { - return - } - return g.Bio -} - -// GetIsCurrentUser returns value of IsCurrentUser field. -func (g *GroupCallParticipant) GetIsCurrentUser() (value bool) { - if g == nil { - return - } - return g.IsCurrentUser -} - -// GetIsSpeaking returns value of IsSpeaking field. -func (g *GroupCallParticipant) GetIsSpeaking() (value bool) { - if g == nil { - return - } - return g.IsSpeaking -} - -// GetIsHandRaised returns value of IsHandRaised field. -func (g *GroupCallParticipant) GetIsHandRaised() (value bool) { - if g == nil { - return - } - return g.IsHandRaised -} - -// GetCanBeMutedForAllUsers returns value of CanBeMutedForAllUsers field. -func (g *GroupCallParticipant) GetCanBeMutedForAllUsers() (value bool) { - if g == nil { - return - } - return g.CanBeMutedForAllUsers -} - -// GetCanBeUnmutedForAllUsers returns value of CanBeUnmutedForAllUsers field. -func (g *GroupCallParticipant) GetCanBeUnmutedForAllUsers() (value bool) { - if g == nil { - return - } - return g.CanBeUnmutedForAllUsers -} - -// GetCanBeMutedForCurrentUser returns value of CanBeMutedForCurrentUser field. -func (g *GroupCallParticipant) GetCanBeMutedForCurrentUser() (value bool) { - if g == nil { - return - } - return g.CanBeMutedForCurrentUser -} - -// GetCanBeUnmutedForCurrentUser returns value of CanBeUnmutedForCurrentUser field. -func (g *GroupCallParticipant) GetCanBeUnmutedForCurrentUser() (value bool) { - if g == nil { - return - } - return g.CanBeUnmutedForCurrentUser -} - -// GetIsMutedForAllUsers returns value of IsMutedForAllUsers field. -func (g *GroupCallParticipant) GetIsMutedForAllUsers() (value bool) { - if g == nil { - return - } - return g.IsMutedForAllUsers -} - -// GetIsMutedForCurrentUser returns value of IsMutedForCurrentUser field. -func (g *GroupCallParticipant) GetIsMutedForCurrentUser() (value bool) { - if g == nil { - return - } - return g.IsMutedForCurrentUser -} - -// GetCanUnmuteSelf returns value of CanUnmuteSelf field. -func (g *GroupCallParticipant) GetCanUnmuteSelf() (value bool) { - if g == nil { - return - } - return g.CanUnmuteSelf -} - -// GetVolumeLevel returns value of VolumeLevel field. -func (g *GroupCallParticipant) GetVolumeLevel() (value int32) { - if g == nil { - return - } - return g.VolumeLevel -} - -// GetOrder returns value of Order field. -func (g *GroupCallParticipant) GetOrder() (value string) { - if g == nil { - return - } - return g.Order -} diff --git a/tdapi/tl_group_call_participant_video_info_gen.go b/tdapi/tl_group_call_participant_video_info_gen.go deleted file mode 100644 index 9dc6857f7..000000000 --- a/tdapi/tl_group_call_participant_video_info_gen.go +++ /dev/null @@ -1,290 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GroupCallParticipantVideoInfo represents TL type `groupCallParticipantVideoInfo#70f7eff6`. -type GroupCallParticipantVideoInfo struct { - // List of synchronization source groups of the video - SourceGroups []GroupCallVideoSourceGroup - // Video channel endpoint identifier - EndpointID string - // True, if the video is paused. This flag needs to be ignored, if new video frames are - // received - IsPaused bool -} - -// GroupCallParticipantVideoInfoTypeID is TL type id of GroupCallParticipantVideoInfo. -const GroupCallParticipantVideoInfoTypeID = 0x70f7eff6 - -// Ensuring interfaces in compile-time for GroupCallParticipantVideoInfo. -var ( - _ bin.Encoder = &GroupCallParticipantVideoInfo{} - _ bin.Decoder = &GroupCallParticipantVideoInfo{} - _ bin.BareEncoder = &GroupCallParticipantVideoInfo{} - _ bin.BareDecoder = &GroupCallParticipantVideoInfo{} -) - -func (g *GroupCallParticipantVideoInfo) Zero() bool { - if g == nil { - return true - } - if !(g.SourceGroups == nil) { - return false - } - if !(g.EndpointID == "") { - return false - } - if !(g.IsPaused == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GroupCallParticipantVideoInfo) String() string { - if g == nil { - return "GroupCallParticipantVideoInfo(nil)" - } - type Alias GroupCallParticipantVideoInfo - return fmt.Sprintf("GroupCallParticipantVideoInfo%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GroupCallParticipantVideoInfo) TypeID() uint32 { - return GroupCallParticipantVideoInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*GroupCallParticipantVideoInfo) TypeName() string { - return "groupCallParticipantVideoInfo" -} - -// TypeInfo returns info about TL type. -func (g *GroupCallParticipantVideoInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "groupCallParticipantVideoInfo", - ID: GroupCallParticipantVideoInfoTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SourceGroups", - SchemaName: "source_groups", - }, - { - Name: "EndpointID", - SchemaName: "endpoint_id", - }, - { - Name: "IsPaused", - SchemaName: "is_paused", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GroupCallParticipantVideoInfo) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallParticipantVideoInfo#70f7eff6 as nil") - } - b.PutID(GroupCallParticipantVideoInfoTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GroupCallParticipantVideoInfo) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallParticipantVideoInfo#70f7eff6 as nil") - } - b.PutInt(len(g.SourceGroups)) - for idx, v := range g.SourceGroups { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare groupCallParticipantVideoInfo#70f7eff6: field source_groups element with index %d: %w", idx, err) - } - } - b.PutString(g.EndpointID) - b.PutBool(g.IsPaused) - return nil -} - -// Decode implements bin.Decoder. -func (g *GroupCallParticipantVideoInfo) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallParticipantVideoInfo#70f7eff6 to nil") - } - if err := b.ConsumeID(GroupCallParticipantVideoInfoTypeID); err != nil { - return fmt.Errorf("unable to decode groupCallParticipantVideoInfo#70f7eff6: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GroupCallParticipantVideoInfo) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallParticipantVideoInfo#70f7eff6 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipantVideoInfo#70f7eff6: field source_groups: %w", err) - } - - if headerLen > 0 { - g.SourceGroups = make([]GroupCallVideoSourceGroup, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value GroupCallVideoSourceGroup - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare groupCallParticipantVideoInfo#70f7eff6: field source_groups: %w", err) - } - g.SourceGroups = append(g.SourceGroups, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipantVideoInfo#70f7eff6: field endpoint_id: %w", err) - } - g.EndpointID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipantVideoInfo#70f7eff6: field is_paused: %w", err) - } - g.IsPaused = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GroupCallParticipantVideoInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode groupCallParticipantVideoInfo#70f7eff6 as nil") - } - b.ObjStart() - b.PutID("groupCallParticipantVideoInfo") - b.Comma() - b.FieldStart("source_groups") - b.ArrStart() - for idx, v := range g.SourceGroups { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode groupCallParticipantVideoInfo#70f7eff6: field source_groups element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("endpoint_id") - b.PutString(g.EndpointID) - b.Comma() - b.FieldStart("is_paused") - b.PutBool(g.IsPaused) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GroupCallParticipantVideoInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode groupCallParticipantVideoInfo#70f7eff6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("groupCallParticipantVideoInfo"); err != nil { - return fmt.Errorf("unable to decode groupCallParticipantVideoInfo#70f7eff6: %w", err) - } - case "source_groups": - if err := b.Arr(func(b tdjson.Decoder) error { - var value GroupCallVideoSourceGroup - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode groupCallParticipantVideoInfo#70f7eff6: field source_groups: %w", err) - } - g.SourceGroups = append(g.SourceGroups, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode groupCallParticipantVideoInfo#70f7eff6: field source_groups: %w", err) - } - case "endpoint_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipantVideoInfo#70f7eff6: field endpoint_id: %w", err) - } - g.EndpointID = value - case "is_paused": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallParticipantVideoInfo#70f7eff6: field is_paused: %w", err) - } - g.IsPaused = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSourceGroups returns value of SourceGroups field. -func (g *GroupCallParticipantVideoInfo) GetSourceGroups() (value []GroupCallVideoSourceGroup) { - if g == nil { - return - } - return g.SourceGroups -} - -// GetEndpointID returns value of EndpointID field. -func (g *GroupCallParticipantVideoInfo) GetEndpointID() (value string) { - if g == nil { - return - } - return g.EndpointID -} - -// GetIsPaused returns value of IsPaused field. -func (g *GroupCallParticipantVideoInfo) GetIsPaused() (value bool) { - if g == nil { - return - } - return g.IsPaused -} diff --git a/tdapi/tl_group_call_recent_speaker_gen.go b/tdapi/tl_group_call_recent_speaker_gen.go deleted file mode 100644 index ab7aed64b..000000000 --- a/tdapi/tl_group_call_recent_speaker_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GroupCallRecentSpeaker represents TL type `groupCallRecentSpeaker#6c73a9cc`. -type GroupCallRecentSpeaker struct { - // Group call participant identifier - ParticipantID MessageSenderClass - // True, is the user has spoken recently - IsSpeaking bool -} - -// GroupCallRecentSpeakerTypeID is TL type id of GroupCallRecentSpeaker. -const GroupCallRecentSpeakerTypeID = 0x6c73a9cc - -// Ensuring interfaces in compile-time for GroupCallRecentSpeaker. -var ( - _ bin.Encoder = &GroupCallRecentSpeaker{} - _ bin.Decoder = &GroupCallRecentSpeaker{} - _ bin.BareEncoder = &GroupCallRecentSpeaker{} - _ bin.BareDecoder = &GroupCallRecentSpeaker{} -) - -func (g *GroupCallRecentSpeaker) Zero() bool { - if g == nil { - return true - } - if !(g.ParticipantID == nil) { - return false - } - if !(g.IsSpeaking == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GroupCallRecentSpeaker) String() string { - if g == nil { - return "GroupCallRecentSpeaker(nil)" - } - type Alias GroupCallRecentSpeaker - return fmt.Sprintf("GroupCallRecentSpeaker%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GroupCallRecentSpeaker) TypeID() uint32 { - return GroupCallRecentSpeakerTypeID -} - -// TypeName returns name of type in TL schema. -func (*GroupCallRecentSpeaker) TypeName() string { - return "groupCallRecentSpeaker" -} - -// TypeInfo returns info about TL type. -func (g *GroupCallRecentSpeaker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "groupCallRecentSpeaker", - ID: GroupCallRecentSpeakerTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ParticipantID", - SchemaName: "participant_id", - }, - { - Name: "IsSpeaking", - SchemaName: "is_speaking", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GroupCallRecentSpeaker) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallRecentSpeaker#6c73a9cc as nil") - } - b.PutID(GroupCallRecentSpeakerTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GroupCallRecentSpeaker) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallRecentSpeaker#6c73a9cc as nil") - } - if g.ParticipantID == nil { - return fmt.Errorf("unable to encode groupCallRecentSpeaker#6c73a9cc: field participant_id is nil") - } - if err := g.ParticipantID.Encode(b); err != nil { - return fmt.Errorf("unable to encode groupCallRecentSpeaker#6c73a9cc: field participant_id: %w", err) - } - b.PutBool(g.IsSpeaking) - return nil -} - -// Decode implements bin.Decoder. -func (g *GroupCallRecentSpeaker) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallRecentSpeaker#6c73a9cc to nil") - } - if err := b.ConsumeID(GroupCallRecentSpeakerTypeID); err != nil { - return fmt.Errorf("unable to decode groupCallRecentSpeaker#6c73a9cc: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GroupCallRecentSpeaker) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallRecentSpeaker#6c73a9cc to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode groupCallRecentSpeaker#6c73a9cc: field participant_id: %w", err) - } - g.ParticipantID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallRecentSpeaker#6c73a9cc: field is_speaking: %w", err) - } - g.IsSpeaking = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GroupCallRecentSpeaker) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode groupCallRecentSpeaker#6c73a9cc as nil") - } - b.ObjStart() - b.PutID("groupCallRecentSpeaker") - b.Comma() - b.FieldStart("participant_id") - if g.ParticipantID == nil { - return fmt.Errorf("unable to encode groupCallRecentSpeaker#6c73a9cc: field participant_id is nil") - } - if err := g.ParticipantID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode groupCallRecentSpeaker#6c73a9cc: field participant_id: %w", err) - } - b.Comma() - b.FieldStart("is_speaking") - b.PutBool(g.IsSpeaking) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GroupCallRecentSpeaker) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode groupCallRecentSpeaker#6c73a9cc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("groupCallRecentSpeaker"); err != nil { - return fmt.Errorf("unable to decode groupCallRecentSpeaker#6c73a9cc: %w", err) - } - case "participant_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode groupCallRecentSpeaker#6c73a9cc: field participant_id: %w", err) - } - g.ParticipantID = value - case "is_speaking": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode groupCallRecentSpeaker#6c73a9cc: field is_speaking: %w", err) - } - g.IsSpeaking = value - default: - return b.Skip() - } - return nil - }) -} - -// GetParticipantID returns value of ParticipantID field. -func (g *GroupCallRecentSpeaker) GetParticipantID() (value MessageSenderClass) { - if g == nil { - return - } - return g.ParticipantID -} - -// GetIsSpeaking returns value of IsSpeaking field. -func (g *GroupCallRecentSpeaker) GetIsSpeaking() (value bool) { - if g == nil { - return - } - return g.IsSpeaking -} diff --git a/tdapi/tl_group_call_stream_gen.go b/tdapi/tl_group_call_stream_gen.go deleted file mode 100644 index af4365f5d..000000000 --- a/tdapi/tl_group_call_stream_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GroupCallStream represents TL type `groupCallStream#f03b0fc5`. -type GroupCallStream struct { - // Identifier of an audio/video channel - ChannelID int32 - // Scale of segment durations in the stream. The duration is 1000/(2**scale) milliseconds - Scale int32 - // Point in time when the stream currently ends; Unix timestamp in milliseconds - TimeOffset int64 -} - -// GroupCallStreamTypeID is TL type id of GroupCallStream. -const GroupCallStreamTypeID = 0xf03b0fc5 - -// Ensuring interfaces in compile-time for GroupCallStream. -var ( - _ bin.Encoder = &GroupCallStream{} - _ bin.Decoder = &GroupCallStream{} - _ bin.BareEncoder = &GroupCallStream{} - _ bin.BareDecoder = &GroupCallStream{} -) - -func (g *GroupCallStream) Zero() bool { - if g == nil { - return true - } - if !(g.ChannelID == 0) { - return false - } - if !(g.Scale == 0) { - return false - } - if !(g.TimeOffset == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GroupCallStream) String() string { - if g == nil { - return "GroupCallStream(nil)" - } - type Alias GroupCallStream - return fmt.Sprintf("GroupCallStream%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GroupCallStream) TypeID() uint32 { - return GroupCallStreamTypeID -} - -// TypeName returns name of type in TL schema. -func (*GroupCallStream) TypeName() string { - return "groupCallStream" -} - -// TypeInfo returns info about TL type. -func (g *GroupCallStream) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "groupCallStream", - ID: GroupCallStreamTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChannelID", - SchemaName: "channel_id", - }, - { - Name: "Scale", - SchemaName: "scale", - }, - { - Name: "TimeOffset", - SchemaName: "time_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GroupCallStream) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallStream#f03b0fc5 as nil") - } - b.PutID(GroupCallStreamTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GroupCallStream) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallStream#f03b0fc5 as nil") - } - b.PutInt32(g.ChannelID) - b.PutInt32(g.Scale) - b.PutInt53(g.TimeOffset) - return nil -} - -// Decode implements bin.Decoder. -func (g *GroupCallStream) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallStream#f03b0fc5 to nil") - } - if err := b.ConsumeID(GroupCallStreamTypeID); err != nil { - return fmt.Errorf("unable to decode groupCallStream#f03b0fc5: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GroupCallStream) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallStream#f03b0fc5 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallStream#f03b0fc5: field channel_id: %w", err) - } - g.ChannelID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallStream#f03b0fc5: field scale: %w", err) - } - g.Scale = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode groupCallStream#f03b0fc5: field time_offset: %w", err) - } - g.TimeOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GroupCallStream) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode groupCallStream#f03b0fc5 as nil") - } - b.ObjStart() - b.PutID("groupCallStream") - b.Comma() - b.FieldStart("channel_id") - b.PutInt32(g.ChannelID) - b.Comma() - b.FieldStart("scale") - b.PutInt32(g.Scale) - b.Comma() - b.FieldStart("time_offset") - b.PutInt53(g.TimeOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GroupCallStream) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode groupCallStream#f03b0fc5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("groupCallStream"); err != nil { - return fmt.Errorf("unable to decode groupCallStream#f03b0fc5: %w", err) - } - case "channel_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallStream#f03b0fc5: field channel_id: %w", err) - } - g.ChannelID = value - case "scale": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallStream#f03b0fc5: field scale: %w", err) - } - g.Scale = value - case "time_offset": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode groupCallStream#f03b0fc5: field time_offset: %w", err) - } - g.TimeOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChannelID returns value of ChannelID field. -func (g *GroupCallStream) GetChannelID() (value int32) { - if g == nil { - return - } - return g.ChannelID -} - -// GetScale returns value of Scale field. -func (g *GroupCallStream) GetScale() (value int32) { - if g == nil { - return - } - return g.Scale -} - -// GetTimeOffset returns value of TimeOffset field. -func (g *GroupCallStream) GetTimeOffset() (value int64) { - if g == nil { - return - } - return g.TimeOffset -} diff --git a/tdapi/tl_group_call_streams_gen.go b/tdapi/tl_group_call_streams_gen.go deleted file mode 100644 index 90b2fe2dc..000000000 --- a/tdapi/tl_group_call_streams_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GroupCallStreams represents TL type `groupCallStreams#c89191b`. -type GroupCallStreams struct { - // A list of group call streams - Streams []GroupCallStream -} - -// GroupCallStreamsTypeID is TL type id of GroupCallStreams. -const GroupCallStreamsTypeID = 0xc89191b - -// Ensuring interfaces in compile-time for GroupCallStreams. -var ( - _ bin.Encoder = &GroupCallStreams{} - _ bin.Decoder = &GroupCallStreams{} - _ bin.BareEncoder = &GroupCallStreams{} - _ bin.BareDecoder = &GroupCallStreams{} -) - -func (g *GroupCallStreams) Zero() bool { - if g == nil { - return true - } - if !(g.Streams == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GroupCallStreams) String() string { - if g == nil { - return "GroupCallStreams(nil)" - } - type Alias GroupCallStreams - return fmt.Sprintf("GroupCallStreams%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GroupCallStreams) TypeID() uint32 { - return GroupCallStreamsTypeID -} - -// TypeName returns name of type in TL schema. -func (*GroupCallStreams) TypeName() string { - return "groupCallStreams" -} - -// TypeInfo returns info about TL type. -func (g *GroupCallStreams) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "groupCallStreams", - ID: GroupCallStreamsTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Streams", - SchemaName: "streams", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GroupCallStreams) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallStreams#c89191b as nil") - } - b.PutID(GroupCallStreamsTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GroupCallStreams) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallStreams#c89191b as nil") - } - b.PutInt(len(g.Streams)) - for idx, v := range g.Streams { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare groupCallStreams#c89191b: field streams element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GroupCallStreams) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallStreams#c89191b to nil") - } - if err := b.ConsumeID(GroupCallStreamsTypeID); err != nil { - return fmt.Errorf("unable to decode groupCallStreams#c89191b: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GroupCallStreams) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallStreams#c89191b to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode groupCallStreams#c89191b: field streams: %w", err) - } - - if headerLen > 0 { - g.Streams = make([]GroupCallStream, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value GroupCallStream - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare groupCallStreams#c89191b: field streams: %w", err) - } - g.Streams = append(g.Streams, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GroupCallStreams) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode groupCallStreams#c89191b as nil") - } - b.ObjStart() - b.PutID("groupCallStreams") - b.Comma() - b.FieldStart("streams") - b.ArrStart() - for idx, v := range g.Streams { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode groupCallStreams#c89191b: field streams element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GroupCallStreams) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode groupCallStreams#c89191b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("groupCallStreams"); err != nil { - return fmt.Errorf("unable to decode groupCallStreams#c89191b: %w", err) - } - case "streams": - if err := b.Arr(func(b tdjson.Decoder) error { - var value GroupCallStream - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode groupCallStreams#c89191b: field streams: %w", err) - } - g.Streams = append(g.Streams, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode groupCallStreams#c89191b: field streams: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStreams returns value of Streams field. -func (g *GroupCallStreams) GetStreams() (value []GroupCallStream) { - if g == nil { - return - } - return g.Streams -} diff --git a/tdapi/tl_group_call_video_quality_gen.go b/tdapi/tl_group_call_video_quality_gen.go deleted file mode 100644 index 10b52e6ae..000000000 --- a/tdapi/tl_group_call_video_quality_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GroupCallVideoQualityThumbnail represents TL type `groupCallVideoQualityThumbnail#e9661380`. -type GroupCallVideoQualityThumbnail struct { -} - -// GroupCallVideoQualityThumbnailTypeID is TL type id of GroupCallVideoQualityThumbnail. -const GroupCallVideoQualityThumbnailTypeID = 0xe9661380 - -// construct implements constructor of GroupCallVideoQualityClass. -func (g GroupCallVideoQualityThumbnail) construct() GroupCallVideoQualityClass { return &g } - -// Ensuring interfaces in compile-time for GroupCallVideoQualityThumbnail. -var ( - _ bin.Encoder = &GroupCallVideoQualityThumbnail{} - _ bin.Decoder = &GroupCallVideoQualityThumbnail{} - _ bin.BareEncoder = &GroupCallVideoQualityThumbnail{} - _ bin.BareDecoder = &GroupCallVideoQualityThumbnail{} - - _ GroupCallVideoQualityClass = &GroupCallVideoQualityThumbnail{} -) - -func (g *GroupCallVideoQualityThumbnail) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GroupCallVideoQualityThumbnail) String() string { - if g == nil { - return "GroupCallVideoQualityThumbnail(nil)" - } - type Alias GroupCallVideoQualityThumbnail - return fmt.Sprintf("GroupCallVideoQualityThumbnail%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GroupCallVideoQualityThumbnail) TypeID() uint32 { - return GroupCallVideoQualityThumbnailTypeID -} - -// TypeName returns name of type in TL schema. -func (*GroupCallVideoQualityThumbnail) TypeName() string { - return "groupCallVideoQualityThumbnail" -} - -// TypeInfo returns info about TL type. -func (g *GroupCallVideoQualityThumbnail) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "groupCallVideoQualityThumbnail", - ID: GroupCallVideoQualityThumbnailTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GroupCallVideoQualityThumbnail) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoQualityThumbnail#e9661380 as nil") - } - b.PutID(GroupCallVideoQualityThumbnailTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GroupCallVideoQualityThumbnail) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoQualityThumbnail#e9661380 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GroupCallVideoQualityThumbnail) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoQualityThumbnail#e9661380 to nil") - } - if err := b.ConsumeID(GroupCallVideoQualityThumbnailTypeID); err != nil { - return fmt.Errorf("unable to decode groupCallVideoQualityThumbnail#e9661380: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GroupCallVideoQualityThumbnail) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoQualityThumbnail#e9661380 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GroupCallVideoQualityThumbnail) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoQualityThumbnail#e9661380 as nil") - } - b.ObjStart() - b.PutID("groupCallVideoQualityThumbnail") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GroupCallVideoQualityThumbnail) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoQualityThumbnail#e9661380 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("groupCallVideoQualityThumbnail"); err != nil { - return fmt.Errorf("unable to decode groupCallVideoQualityThumbnail#e9661380: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GroupCallVideoQualityMedium represents TL type `groupCallVideoQualityMedium#178abcaa`. -type GroupCallVideoQualityMedium struct { -} - -// GroupCallVideoQualityMediumTypeID is TL type id of GroupCallVideoQualityMedium. -const GroupCallVideoQualityMediumTypeID = 0x178abcaa - -// construct implements constructor of GroupCallVideoQualityClass. -func (g GroupCallVideoQualityMedium) construct() GroupCallVideoQualityClass { return &g } - -// Ensuring interfaces in compile-time for GroupCallVideoQualityMedium. -var ( - _ bin.Encoder = &GroupCallVideoQualityMedium{} - _ bin.Decoder = &GroupCallVideoQualityMedium{} - _ bin.BareEncoder = &GroupCallVideoQualityMedium{} - _ bin.BareDecoder = &GroupCallVideoQualityMedium{} - - _ GroupCallVideoQualityClass = &GroupCallVideoQualityMedium{} -) - -func (g *GroupCallVideoQualityMedium) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GroupCallVideoQualityMedium) String() string { - if g == nil { - return "GroupCallVideoQualityMedium(nil)" - } - type Alias GroupCallVideoQualityMedium - return fmt.Sprintf("GroupCallVideoQualityMedium%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GroupCallVideoQualityMedium) TypeID() uint32 { - return GroupCallVideoQualityMediumTypeID -} - -// TypeName returns name of type in TL schema. -func (*GroupCallVideoQualityMedium) TypeName() string { - return "groupCallVideoQualityMedium" -} - -// TypeInfo returns info about TL type. -func (g *GroupCallVideoQualityMedium) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "groupCallVideoQualityMedium", - ID: GroupCallVideoQualityMediumTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GroupCallVideoQualityMedium) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoQualityMedium#178abcaa as nil") - } - b.PutID(GroupCallVideoQualityMediumTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GroupCallVideoQualityMedium) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoQualityMedium#178abcaa as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GroupCallVideoQualityMedium) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoQualityMedium#178abcaa to nil") - } - if err := b.ConsumeID(GroupCallVideoQualityMediumTypeID); err != nil { - return fmt.Errorf("unable to decode groupCallVideoQualityMedium#178abcaa: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GroupCallVideoQualityMedium) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoQualityMedium#178abcaa to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GroupCallVideoQualityMedium) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoQualityMedium#178abcaa as nil") - } - b.ObjStart() - b.PutID("groupCallVideoQualityMedium") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GroupCallVideoQualityMedium) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoQualityMedium#178abcaa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("groupCallVideoQualityMedium"); err != nil { - return fmt.Errorf("unable to decode groupCallVideoQualityMedium#178abcaa: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GroupCallVideoQualityFull represents TL type `groupCallVideoQualityFull#81491637`. -type GroupCallVideoQualityFull struct { -} - -// GroupCallVideoQualityFullTypeID is TL type id of GroupCallVideoQualityFull. -const GroupCallVideoQualityFullTypeID = 0x81491637 - -// construct implements constructor of GroupCallVideoQualityClass. -func (g GroupCallVideoQualityFull) construct() GroupCallVideoQualityClass { return &g } - -// Ensuring interfaces in compile-time for GroupCallVideoQualityFull. -var ( - _ bin.Encoder = &GroupCallVideoQualityFull{} - _ bin.Decoder = &GroupCallVideoQualityFull{} - _ bin.BareEncoder = &GroupCallVideoQualityFull{} - _ bin.BareDecoder = &GroupCallVideoQualityFull{} - - _ GroupCallVideoQualityClass = &GroupCallVideoQualityFull{} -) - -func (g *GroupCallVideoQualityFull) Zero() bool { - if g == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (g *GroupCallVideoQualityFull) String() string { - if g == nil { - return "GroupCallVideoQualityFull(nil)" - } - type Alias GroupCallVideoQualityFull - return fmt.Sprintf("GroupCallVideoQualityFull%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GroupCallVideoQualityFull) TypeID() uint32 { - return GroupCallVideoQualityFullTypeID -} - -// TypeName returns name of type in TL schema. -func (*GroupCallVideoQualityFull) TypeName() string { - return "groupCallVideoQualityFull" -} - -// TypeInfo returns info about TL type. -func (g *GroupCallVideoQualityFull) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "groupCallVideoQualityFull", - ID: GroupCallVideoQualityFullTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (g *GroupCallVideoQualityFull) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoQualityFull#81491637 as nil") - } - b.PutID(GroupCallVideoQualityFullTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GroupCallVideoQualityFull) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoQualityFull#81491637 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GroupCallVideoQualityFull) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoQualityFull#81491637 to nil") - } - if err := b.ConsumeID(GroupCallVideoQualityFullTypeID); err != nil { - return fmt.Errorf("unable to decode groupCallVideoQualityFull#81491637: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GroupCallVideoQualityFull) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoQualityFull#81491637 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GroupCallVideoQualityFull) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoQualityFull#81491637 as nil") - } - b.ObjStart() - b.PutID("groupCallVideoQualityFull") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GroupCallVideoQualityFull) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoQualityFull#81491637 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("groupCallVideoQualityFull"); err != nil { - return fmt.Errorf("unable to decode groupCallVideoQualityFull#81491637: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GroupCallVideoQualityClassName is schema name of GroupCallVideoQualityClass. -const GroupCallVideoQualityClassName = "GroupCallVideoQuality" - -// GroupCallVideoQualityClass represents GroupCallVideoQuality generic type. -// -// Example: -// -// g, err := tdapi.DecodeGroupCallVideoQuality(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.GroupCallVideoQualityThumbnail: // groupCallVideoQualityThumbnail#e9661380 -// case *tdapi.GroupCallVideoQualityMedium: // groupCallVideoQualityMedium#178abcaa -// case *tdapi.GroupCallVideoQualityFull: // groupCallVideoQualityFull#81491637 -// default: panic(v) -// } -type GroupCallVideoQualityClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() GroupCallVideoQualityClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeGroupCallVideoQuality implements binary de-serialization for GroupCallVideoQualityClass. -func DecodeGroupCallVideoQuality(buf *bin.Buffer) (GroupCallVideoQualityClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case GroupCallVideoQualityThumbnailTypeID: - // Decoding groupCallVideoQualityThumbnail#e9661380. - v := GroupCallVideoQualityThumbnail{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err) - } - return &v, nil - case GroupCallVideoQualityMediumTypeID: - // Decoding groupCallVideoQualityMedium#178abcaa. - v := GroupCallVideoQualityMedium{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err) - } - return &v, nil - case GroupCallVideoQualityFullTypeID: - // Decoding groupCallVideoQualityFull#81491637. - v := GroupCallVideoQualityFull{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONGroupCallVideoQuality implements binary de-serialization for GroupCallVideoQualityClass. -func DecodeTDLibJSONGroupCallVideoQuality(buf tdjson.Decoder) (GroupCallVideoQualityClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "groupCallVideoQualityThumbnail": - // Decoding groupCallVideoQualityThumbnail#e9661380. - v := GroupCallVideoQualityThumbnail{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err) - } - return &v, nil - case "groupCallVideoQualityMedium": - // Decoding groupCallVideoQualityMedium#178abcaa. - v := GroupCallVideoQualityMedium{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err) - } - return &v, nil - case "groupCallVideoQualityFull": - // Decoding groupCallVideoQualityFull#81491637. - v := GroupCallVideoQualityFull{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode GroupCallVideoQualityClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// GroupCallVideoQuality boxes the GroupCallVideoQualityClass providing a helper. -type GroupCallVideoQualityBox struct { - GroupCallVideoQuality GroupCallVideoQualityClass -} - -// Decode implements bin.Decoder for GroupCallVideoQualityBox. -func (b *GroupCallVideoQualityBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode GroupCallVideoQualityBox to nil") - } - v, err := DecodeGroupCallVideoQuality(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.GroupCallVideoQuality = v - return nil -} - -// Encode implements bin.Encode for GroupCallVideoQualityBox. -func (b *GroupCallVideoQualityBox) Encode(buf *bin.Buffer) error { - if b == nil || b.GroupCallVideoQuality == nil { - return fmt.Errorf("unable to encode GroupCallVideoQualityClass as nil") - } - return b.GroupCallVideoQuality.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for GroupCallVideoQualityBox. -func (b *GroupCallVideoQualityBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode GroupCallVideoQualityBox to nil") - } - v, err := DecodeTDLibJSONGroupCallVideoQuality(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.GroupCallVideoQuality = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for GroupCallVideoQualityBox. -func (b *GroupCallVideoQualityBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.GroupCallVideoQuality == nil { - return fmt.Errorf("unable to encode GroupCallVideoQualityClass as nil") - } - return b.GroupCallVideoQuality.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_group_call_video_source_group_gen.go b/tdapi/tl_group_call_video_source_group_gen.go deleted file mode 100644 index 75162d641..000000000 --- a/tdapi/tl_group_call_video_source_group_gen.go +++ /dev/null @@ -1,251 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// GroupCallVideoSourceGroup represents TL type `groupCallVideoSourceGroup#4ef8a4af`. -type GroupCallVideoSourceGroup struct { - // The semantics of sources, one of "SIM" or "FID" - Semantics string - // The list of synchronization source identifiers - SourceIDs []int32 -} - -// GroupCallVideoSourceGroupTypeID is TL type id of GroupCallVideoSourceGroup. -const GroupCallVideoSourceGroupTypeID = 0x4ef8a4af - -// Ensuring interfaces in compile-time for GroupCallVideoSourceGroup. -var ( - _ bin.Encoder = &GroupCallVideoSourceGroup{} - _ bin.Decoder = &GroupCallVideoSourceGroup{} - _ bin.BareEncoder = &GroupCallVideoSourceGroup{} - _ bin.BareDecoder = &GroupCallVideoSourceGroup{} -) - -func (g *GroupCallVideoSourceGroup) Zero() bool { - if g == nil { - return true - } - if !(g.Semantics == "") { - return false - } - if !(g.SourceIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (g *GroupCallVideoSourceGroup) String() string { - if g == nil { - return "GroupCallVideoSourceGroup(nil)" - } - type Alias GroupCallVideoSourceGroup - return fmt.Sprintf("GroupCallVideoSourceGroup%+v", Alias(*g)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*GroupCallVideoSourceGroup) TypeID() uint32 { - return GroupCallVideoSourceGroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*GroupCallVideoSourceGroup) TypeName() string { - return "groupCallVideoSourceGroup" -} - -// TypeInfo returns info about TL type. -func (g *GroupCallVideoSourceGroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "groupCallVideoSourceGroup", - ID: GroupCallVideoSourceGroupTypeID, - } - if g == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Semantics", - SchemaName: "semantics", - }, - { - Name: "SourceIDs", - SchemaName: "source_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (g *GroupCallVideoSourceGroup) Encode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoSourceGroup#4ef8a4af as nil") - } - b.PutID(GroupCallVideoSourceGroupTypeID) - return g.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (g *GroupCallVideoSourceGroup) EncodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoSourceGroup#4ef8a4af as nil") - } - b.PutString(g.Semantics) - b.PutInt(len(g.SourceIDs)) - for _, v := range g.SourceIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (g *GroupCallVideoSourceGroup) Decode(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoSourceGroup#4ef8a4af to nil") - } - if err := b.ConsumeID(GroupCallVideoSourceGroupTypeID); err != nil { - return fmt.Errorf("unable to decode groupCallVideoSourceGroup#4ef8a4af: %w", err) - } - return g.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (g *GroupCallVideoSourceGroup) DecodeBare(b *bin.Buffer) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoSourceGroup#4ef8a4af to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode groupCallVideoSourceGroup#4ef8a4af: field semantics: %w", err) - } - g.Semantics = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode groupCallVideoSourceGroup#4ef8a4af: field source_ids: %w", err) - } - - if headerLen > 0 { - g.SourceIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallVideoSourceGroup#4ef8a4af: field source_ids: %w", err) - } - g.SourceIDs = append(g.SourceIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (g *GroupCallVideoSourceGroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if g == nil { - return fmt.Errorf("can't encode groupCallVideoSourceGroup#4ef8a4af as nil") - } - b.ObjStart() - b.PutID("groupCallVideoSourceGroup") - b.Comma() - b.FieldStart("semantics") - b.PutString(g.Semantics) - b.Comma() - b.FieldStart("source_ids") - b.ArrStart() - for _, v := range g.SourceIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (g *GroupCallVideoSourceGroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if g == nil { - return fmt.Errorf("can't decode groupCallVideoSourceGroup#4ef8a4af to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("groupCallVideoSourceGroup"); err != nil { - return fmt.Errorf("unable to decode groupCallVideoSourceGroup#4ef8a4af: %w", err) - } - case "semantics": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode groupCallVideoSourceGroup#4ef8a4af: field semantics: %w", err) - } - g.Semantics = value - case "source_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode groupCallVideoSourceGroup#4ef8a4af: field source_ids: %w", err) - } - g.SourceIDs = append(g.SourceIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode groupCallVideoSourceGroup#4ef8a4af: field source_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSemantics returns value of Semantics field. -func (g *GroupCallVideoSourceGroup) GetSemantics() (value string) { - if g == nil { - return - } - return g.Semantics -} - -// GetSourceIDs returns value of SourceIDs field. -func (g *GroupCallVideoSourceGroup) GetSourceIDs() (value []int32) { - if g == nil { - return - } - return g.SourceIDs -} diff --git a/tdapi/tl_hashtags_gen.go b/tdapi/tl_hashtags_gen.go deleted file mode 100644 index d99c9e9b5..000000000 --- a/tdapi/tl_hashtags_gen.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Hashtags represents TL type `hashtags#6c2c0ae1`. -type Hashtags struct { - // A list of hashtags - Hashtags []string -} - -// HashtagsTypeID is TL type id of Hashtags. -const HashtagsTypeID = 0x6c2c0ae1 - -// Ensuring interfaces in compile-time for Hashtags. -var ( - _ bin.Encoder = &Hashtags{} - _ bin.Decoder = &Hashtags{} - _ bin.BareEncoder = &Hashtags{} - _ bin.BareDecoder = &Hashtags{} -) - -func (h *Hashtags) Zero() bool { - if h == nil { - return true - } - if !(h.Hashtags == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (h *Hashtags) String() string { - if h == nil { - return "Hashtags(nil)" - } - type Alias Hashtags - return fmt.Sprintf("Hashtags%+v", Alias(*h)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Hashtags) TypeID() uint32 { - return HashtagsTypeID -} - -// TypeName returns name of type in TL schema. -func (*Hashtags) TypeName() string { - return "hashtags" -} - -// TypeInfo returns info about TL type. -func (h *Hashtags) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "hashtags", - ID: HashtagsTypeID, - } - if h == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Hashtags", - SchemaName: "hashtags", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (h *Hashtags) Encode(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't encode hashtags#6c2c0ae1 as nil") - } - b.PutID(HashtagsTypeID) - return h.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (h *Hashtags) EncodeBare(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't encode hashtags#6c2c0ae1 as nil") - } - b.PutInt(len(h.Hashtags)) - for _, v := range h.Hashtags { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (h *Hashtags) Decode(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't decode hashtags#6c2c0ae1 to nil") - } - if err := b.ConsumeID(HashtagsTypeID); err != nil { - return fmt.Errorf("unable to decode hashtags#6c2c0ae1: %w", err) - } - return h.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (h *Hashtags) DecodeBare(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't decode hashtags#6c2c0ae1 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode hashtags#6c2c0ae1: field hashtags: %w", err) - } - - if headerLen > 0 { - h.Hashtags = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode hashtags#6c2c0ae1: field hashtags: %w", err) - } - h.Hashtags = append(h.Hashtags, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (h *Hashtags) EncodeTDLibJSON(b tdjson.Encoder) error { - if h == nil { - return fmt.Errorf("can't encode hashtags#6c2c0ae1 as nil") - } - b.ObjStart() - b.PutID("hashtags") - b.Comma() - b.FieldStart("hashtags") - b.ArrStart() - for _, v := range h.Hashtags { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (h *Hashtags) DecodeTDLibJSON(b tdjson.Decoder) error { - if h == nil { - return fmt.Errorf("can't decode hashtags#6c2c0ae1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("hashtags"); err != nil { - return fmt.Errorf("unable to decode hashtags#6c2c0ae1: %w", err) - } - case "hashtags": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode hashtags#6c2c0ae1: field hashtags: %w", err) - } - h.Hashtags = append(h.Hashtags, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode hashtags#6c2c0ae1: field hashtags: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetHashtags returns value of Hashtags field. -func (h *Hashtags) GetHashtags() (value []string) { - if h == nil { - return - } - return h.Hashtags -} diff --git a/tdapi/tl_hide_contact_close_birthdays_gen.go b/tdapi/tl_hide_contact_close_birthdays_gen.go deleted file mode 100644 index 9cc98cff0..000000000 --- a/tdapi/tl_hide_contact_close_birthdays_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// HideContactCloseBirthdaysRequest represents TL type `hideContactCloseBirthdays#baad087b`. -type HideContactCloseBirthdaysRequest struct { -} - -// HideContactCloseBirthdaysRequestTypeID is TL type id of HideContactCloseBirthdaysRequest. -const HideContactCloseBirthdaysRequestTypeID = 0xbaad087b - -// Ensuring interfaces in compile-time for HideContactCloseBirthdaysRequest. -var ( - _ bin.Encoder = &HideContactCloseBirthdaysRequest{} - _ bin.Decoder = &HideContactCloseBirthdaysRequest{} - _ bin.BareEncoder = &HideContactCloseBirthdaysRequest{} - _ bin.BareDecoder = &HideContactCloseBirthdaysRequest{} -) - -func (h *HideContactCloseBirthdaysRequest) Zero() bool { - if h == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (h *HideContactCloseBirthdaysRequest) String() string { - if h == nil { - return "HideContactCloseBirthdaysRequest(nil)" - } - type Alias HideContactCloseBirthdaysRequest - return fmt.Sprintf("HideContactCloseBirthdaysRequest%+v", Alias(*h)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*HideContactCloseBirthdaysRequest) TypeID() uint32 { - return HideContactCloseBirthdaysRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*HideContactCloseBirthdaysRequest) TypeName() string { - return "hideContactCloseBirthdays" -} - -// TypeInfo returns info about TL type. -func (h *HideContactCloseBirthdaysRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "hideContactCloseBirthdays", - ID: HideContactCloseBirthdaysRequestTypeID, - } - if h == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (h *HideContactCloseBirthdaysRequest) Encode(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't encode hideContactCloseBirthdays#baad087b as nil") - } - b.PutID(HideContactCloseBirthdaysRequestTypeID) - return h.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (h *HideContactCloseBirthdaysRequest) EncodeBare(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't encode hideContactCloseBirthdays#baad087b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (h *HideContactCloseBirthdaysRequest) Decode(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't decode hideContactCloseBirthdays#baad087b to nil") - } - if err := b.ConsumeID(HideContactCloseBirthdaysRequestTypeID); err != nil { - return fmt.Errorf("unable to decode hideContactCloseBirthdays#baad087b: %w", err) - } - return h.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (h *HideContactCloseBirthdaysRequest) DecodeBare(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't decode hideContactCloseBirthdays#baad087b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (h *HideContactCloseBirthdaysRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if h == nil { - return fmt.Errorf("can't encode hideContactCloseBirthdays#baad087b as nil") - } - b.ObjStart() - b.PutID("hideContactCloseBirthdays") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (h *HideContactCloseBirthdaysRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if h == nil { - return fmt.Errorf("can't decode hideContactCloseBirthdays#baad087b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("hideContactCloseBirthdays"); err != nil { - return fmt.Errorf("unable to decode hideContactCloseBirthdays#baad087b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// HideContactCloseBirthdays invokes method hideContactCloseBirthdays#baad087b returning error if any. -func (c *Client) HideContactCloseBirthdays(ctx context.Context) error { - var ok Ok - - request := &HideContactCloseBirthdaysRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_hide_suggested_action_gen.go b/tdapi/tl_hide_suggested_action_gen.go deleted file mode 100644 index 8286a0ea4..000000000 --- a/tdapi/tl_hide_suggested_action_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// HideSuggestedActionRequest represents TL type `hideSuggestedAction#a2ef2b7f`. -type HideSuggestedActionRequest struct { - // Suggested action to hide - Action SuggestedActionClass -} - -// HideSuggestedActionRequestTypeID is TL type id of HideSuggestedActionRequest. -const HideSuggestedActionRequestTypeID = 0xa2ef2b7f - -// Ensuring interfaces in compile-time for HideSuggestedActionRequest. -var ( - _ bin.Encoder = &HideSuggestedActionRequest{} - _ bin.Decoder = &HideSuggestedActionRequest{} - _ bin.BareEncoder = &HideSuggestedActionRequest{} - _ bin.BareDecoder = &HideSuggestedActionRequest{} -) - -func (h *HideSuggestedActionRequest) Zero() bool { - if h == nil { - return true - } - if !(h.Action == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (h *HideSuggestedActionRequest) String() string { - if h == nil { - return "HideSuggestedActionRequest(nil)" - } - type Alias HideSuggestedActionRequest - return fmt.Sprintf("HideSuggestedActionRequest%+v", Alias(*h)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*HideSuggestedActionRequest) TypeID() uint32 { - return HideSuggestedActionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*HideSuggestedActionRequest) TypeName() string { - return "hideSuggestedAction" -} - -// TypeInfo returns info about TL type. -func (h *HideSuggestedActionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "hideSuggestedAction", - ID: HideSuggestedActionRequestTypeID, - } - if h == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Action", - SchemaName: "action", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (h *HideSuggestedActionRequest) Encode(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't encode hideSuggestedAction#a2ef2b7f as nil") - } - b.PutID(HideSuggestedActionRequestTypeID) - return h.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (h *HideSuggestedActionRequest) EncodeBare(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't encode hideSuggestedAction#a2ef2b7f as nil") - } - if h.Action == nil { - return fmt.Errorf("unable to encode hideSuggestedAction#a2ef2b7f: field action is nil") - } - if err := h.Action.Encode(b); err != nil { - return fmt.Errorf("unable to encode hideSuggestedAction#a2ef2b7f: field action: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (h *HideSuggestedActionRequest) Decode(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't decode hideSuggestedAction#a2ef2b7f to nil") - } - if err := b.ConsumeID(HideSuggestedActionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode hideSuggestedAction#a2ef2b7f: %w", err) - } - return h.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (h *HideSuggestedActionRequest) DecodeBare(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't decode hideSuggestedAction#a2ef2b7f to nil") - } - { - value, err := DecodeSuggestedAction(b) - if err != nil { - return fmt.Errorf("unable to decode hideSuggestedAction#a2ef2b7f: field action: %w", err) - } - h.Action = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (h *HideSuggestedActionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if h == nil { - return fmt.Errorf("can't encode hideSuggestedAction#a2ef2b7f as nil") - } - b.ObjStart() - b.PutID("hideSuggestedAction") - b.Comma() - b.FieldStart("action") - if h.Action == nil { - return fmt.Errorf("unable to encode hideSuggestedAction#a2ef2b7f: field action is nil") - } - if err := h.Action.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode hideSuggestedAction#a2ef2b7f: field action: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (h *HideSuggestedActionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if h == nil { - return fmt.Errorf("can't decode hideSuggestedAction#a2ef2b7f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("hideSuggestedAction"); err != nil { - return fmt.Errorf("unable to decode hideSuggestedAction#a2ef2b7f: %w", err) - } - case "action": - value, err := DecodeTDLibJSONSuggestedAction(b) - if err != nil { - return fmt.Errorf("unable to decode hideSuggestedAction#a2ef2b7f: field action: %w", err) - } - h.Action = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAction returns value of Action field. -func (h *HideSuggestedActionRequest) GetAction() (value SuggestedActionClass) { - if h == nil { - return - } - return h.Action -} - -// HideSuggestedAction invokes method hideSuggestedAction#a2ef2b7f returning error if any. -func (c *Client) HideSuggestedAction(ctx context.Context, action SuggestedActionClass) error { - var ok Ok - - request := &HideSuggestedActionRequest{ - Action: action, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_http_url_gen.go b/tdapi/tl_http_url_gen.go deleted file mode 100644 index 60b832f6d..000000000 --- a/tdapi/tl_http_url_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// HTTPURL represents TL type `httpUrl#87b775a6`. -type HTTPURL struct { - // The URL - URL string -} - -// HTTPURLTypeID is TL type id of HTTPURL. -const HTTPURLTypeID = 0x87b775a6 - -// Ensuring interfaces in compile-time for HTTPURL. -var ( - _ bin.Encoder = &HTTPURL{} - _ bin.Decoder = &HTTPURL{} - _ bin.BareEncoder = &HTTPURL{} - _ bin.BareDecoder = &HTTPURL{} -) - -func (h *HTTPURL) Zero() bool { - if h == nil { - return true - } - if !(h.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (h *HTTPURL) String() string { - if h == nil { - return "HTTPURL(nil)" - } - type Alias HTTPURL - return fmt.Sprintf("HTTPURL%+v", Alias(*h)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*HTTPURL) TypeID() uint32 { - return HTTPURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*HTTPURL) TypeName() string { - return "httpUrl" -} - -// TypeInfo returns info about TL type. -func (h *HTTPURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "httpUrl", - ID: HTTPURLTypeID, - } - if h == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (h *HTTPURL) Encode(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't encode httpUrl#87b775a6 as nil") - } - b.PutID(HTTPURLTypeID) - return h.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (h *HTTPURL) EncodeBare(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't encode httpUrl#87b775a6 as nil") - } - b.PutString(h.URL) - return nil -} - -// Decode implements bin.Decoder. -func (h *HTTPURL) Decode(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't decode httpUrl#87b775a6 to nil") - } - if err := b.ConsumeID(HTTPURLTypeID); err != nil { - return fmt.Errorf("unable to decode httpUrl#87b775a6: %w", err) - } - return h.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (h *HTTPURL) DecodeBare(b *bin.Buffer) error { - if h == nil { - return fmt.Errorf("can't decode httpUrl#87b775a6 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode httpUrl#87b775a6: field url: %w", err) - } - h.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (h *HTTPURL) EncodeTDLibJSON(b tdjson.Encoder) error { - if h == nil { - return fmt.Errorf("can't encode httpUrl#87b775a6 as nil") - } - b.ObjStart() - b.PutID("httpUrl") - b.Comma() - b.FieldStart("url") - b.PutString(h.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (h *HTTPURL) DecodeTDLibJSON(b tdjson.Decoder) error { - if h == nil { - return fmt.Errorf("can't decode httpUrl#87b775a6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("httpUrl"); err != nil { - return fmt.Errorf("unable to decode httpUrl#87b775a6: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode httpUrl#87b775a6: field url: %w", err) - } - h.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (h *HTTPURL) GetURL() (value string) { - if h == nil { - return - } - return h.URL -} diff --git a/tdapi/tl_identity_document_gen.go b/tdapi/tl_identity_document_gen.go deleted file mode 100644 index 09504118d..000000000 --- a/tdapi/tl_identity_document_gen.go +++ /dev/null @@ -1,391 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// IdentityDocument represents TL type `identityDocument#289299ff`. -type IdentityDocument struct { - // Document number; 1-24 characters - Number string - // Document expiration date; may be null if not applicable - ExpirationDate Date - // Front side of the document - FrontSide DatedFile - // Reverse side of the document; only for driver license and identity card; may be null - ReverseSide DatedFile - // Selfie with the document; may be null - Selfie DatedFile - // List of files containing a certified English translation of the document - Translation []DatedFile -} - -// IdentityDocumentTypeID is TL type id of IdentityDocument. -const IdentityDocumentTypeID = 0x289299ff - -// Ensuring interfaces in compile-time for IdentityDocument. -var ( - _ bin.Encoder = &IdentityDocument{} - _ bin.Decoder = &IdentityDocument{} - _ bin.BareEncoder = &IdentityDocument{} - _ bin.BareDecoder = &IdentityDocument{} -) - -func (i *IdentityDocument) Zero() bool { - if i == nil { - return true - } - if !(i.Number == "") { - return false - } - if !(i.ExpirationDate.Zero()) { - return false - } - if !(i.FrontSide.Zero()) { - return false - } - if !(i.ReverseSide.Zero()) { - return false - } - if !(i.Selfie.Zero()) { - return false - } - if !(i.Translation == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *IdentityDocument) String() string { - if i == nil { - return "IdentityDocument(nil)" - } - type Alias IdentityDocument - return fmt.Sprintf("IdentityDocument%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*IdentityDocument) TypeID() uint32 { - return IdentityDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*IdentityDocument) TypeName() string { - return "identityDocument" -} - -// TypeInfo returns info about TL type. -func (i *IdentityDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "identityDocument", - ID: IdentityDocumentTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Number", - SchemaName: "number", - }, - { - Name: "ExpirationDate", - SchemaName: "expiration_date", - }, - { - Name: "FrontSide", - SchemaName: "front_side", - }, - { - Name: "ReverseSide", - SchemaName: "reverse_side", - }, - { - Name: "Selfie", - SchemaName: "selfie", - }, - { - Name: "Translation", - SchemaName: "translation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *IdentityDocument) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode identityDocument#289299ff as nil") - } - b.PutID(IdentityDocumentTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *IdentityDocument) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode identityDocument#289299ff as nil") - } - b.PutString(i.Number) - if err := i.ExpirationDate.Encode(b); err != nil { - return fmt.Errorf("unable to encode identityDocument#289299ff: field expiration_date: %w", err) - } - if err := i.FrontSide.Encode(b); err != nil { - return fmt.Errorf("unable to encode identityDocument#289299ff: field front_side: %w", err) - } - if err := i.ReverseSide.Encode(b); err != nil { - return fmt.Errorf("unable to encode identityDocument#289299ff: field reverse_side: %w", err) - } - if err := i.Selfie.Encode(b); err != nil { - return fmt.Errorf("unable to encode identityDocument#289299ff: field selfie: %w", err) - } - b.PutInt(len(i.Translation)) - for idx, v := range i.Translation { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare identityDocument#289299ff: field translation element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (i *IdentityDocument) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode identityDocument#289299ff to nil") - } - if err := b.ConsumeID(IdentityDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *IdentityDocument) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode identityDocument#289299ff to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field number: %w", err) - } - i.Number = value - } - { - if err := i.ExpirationDate.Decode(b); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field expiration_date: %w", err) - } - } - { - if err := i.FrontSide.Decode(b); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field front_side: %w", err) - } - } - { - if err := i.ReverseSide.Decode(b); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field reverse_side: %w", err) - } - } - { - if err := i.Selfie.Decode(b); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field selfie: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field translation: %w", err) - } - - if headerLen > 0 { - i.Translation = make([]DatedFile, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value DatedFile - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare identityDocument#289299ff: field translation: %w", err) - } - i.Translation = append(i.Translation, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *IdentityDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode identityDocument#289299ff as nil") - } - b.ObjStart() - b.PutID("identityDocument") - b.Comma() - b.FieldStart("number") - b.PutString(i.Number) - b.Comma() - b.FieldStart("expiration_date") - if err := i.ExpirationDate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode identityDocument#289299ff: field expiration_date: %w", err) - } - b.Comma() - b.FieldStart("front_side") - if err := i.FrontSide.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode identityDocument#289299ff: field front_side: %w", err) - } - b.Comma() - b.FieldStart("reverse_side") - if err := i.ReverseSide.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode identityDocument#289299ff: field reverse_side: %w", err) - } - b.Comma() - b.FieldStart("selfie") - if err := i.Selfie.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode identityDocument#289299ff: field selfie: %w", err) - } - b.Comma() - b.FieldStart("translation") - b.ArrStart() - for idx, v := range i.Translation { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode identityDocument#289299ff: field translation element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *IdentityDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode identityDocument#289299ff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("identityDocument"); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: %w", err) - } - case "number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field number: %w", err) - } - i.Number = value - case "expiration_date": - if err := i.ExpirationDate.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field expiration_date: %w", err) - } - case "front_side": - if err := i.FrontSide.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field front_side: %w", err) - } - case "reverse_side": - if err := i.ReverseSide.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field reverse_side: %w", err) - } - case "selfie": - if err := i.Selfie.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field selfie: %w", err) - } - case "translation": - if err := b.Arr(func(b tdjson.Decoder) error { - var value DatedFile - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field translation: %w", err) - } - i.Translation = append(i.Translation, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode identityDocument#289299ff: field translation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetNumber returns value of Number field. -func (i *IdentityDocument) GetNumber() (value string) { - if i == nil { - return - } - return i.Number -} - -// GetExpirationDate returns value of ExpirationDate field. -func (i *IdentityDocument) GetExpirationDate() (value Date) { - if i == nil { - return - } - return i.ExpirationDate -} - -// GetFrontSide returns value of FrontSide field. -func (i *IdentityDocument) GetFrontSide() (value DatedFile) { - if i == nil { - return - } - return i.FrontSide -} - -// GetReverseSide returns value of ReverseSide field. -func (i *IdentityDocument) GetReverseSide() (value DatedFile) { - if i == nil { - return - } - return i.ReverseSide -} - -// GetSelfie returns value of Selfie field. -func (i *IdentityDocument) GetSelfie() (value DatedFile) { - if i == nil { - return - } - return i.Selfie -} - -// GetTranslation returns value of Translation field. -func (i *IdentityDocument) GetTranslation() (value []DatedFile) { - if i == nil { - return - } - return i.Translation -} diff --git a/tdapi/tl_import_contacts_gen.go b/tdapi/tl_import_contacts_gen.go deleted file mode 100644 index 44cad7d17..000000000 --- a/tdapi/tl_import_contacts_gen.go +++ /dev/null @@ -1,235 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ImportContactsRequest represents TL type `importContacts#77bdb718`. -type ImportContactsRequest struct { - // The list of contacts to import or edit; contacts' vCard are ignored and are not - // imported - Contacts []Contact -} - -// ImportContactsRequestTypeID is TL type id of ImportContactsRequest. -const ImportContactsRequestTypeID = 0x77bdb718 - -// Ensuring interfaces in compile-time for ImportContactsRequest. -var ( - _ bin.Encoder = &ImportContactsRequest{} - _ bin.Decoder = &ImportContactsRequest{} - _ bin.BareEncoder = &ImportContactsRequest{} - _ bin.BareDecoder = &ImportContactsRequest{} -) - -func (i *ImportContactsRequest) Zero() bool { - if i == nil { - return true - } - if !(i.Contacts == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *ImportContactsRequest) String() string { - if i == nil { - return "ImportContactsRequest(nil)" - } - type Alias ImportContactsRequest - return fmt.Sprintf("ImportContactsRequest%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ImportContactsRequest) TypeID() uint32 { - return ImportContactsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ImportContactsRequest) TypeName() string { - return "importContacts" -} - -// TypeInfo returns info about TL type. -func (i *ImportContactsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "importContacts", - ID: ImportContactsRequestTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Contacts", - SchemaName: "contacts", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *ImportContactsRequest) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode importContacts#77bdb718 as nil") - } - b.PutID(ImportContactsRequestTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *ImportContactsRequest) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode importContacts#77bdb718 as nil") - } - b.PutInt(len(i.Contacts)) - for idx, v := range i.Contacts { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare importContacts#77bdb718: field contacts element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (i *ImportContactsRequest) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode importContacts#77bdb718 to nil") - } - if err := b.ConsumeID(ImportContactsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode importContacts#77bdb718: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *ImportContactsRequest) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode importContacts#77bdb718 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode importContacts#77bdb718: field contacts: %w", err) - } - - if headerLen > 0 { - i.Contacts = make([]Contact, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Contact - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare importContacts#77bdb718: field contacts: %w", err) - } - i.Contacts = append(i.Contacts, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *ImportContactsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode importContacts#77bdb718 as nil") - } - b.ObjStart() - b.PutID("importContacts") - b.Comma() - b.FieldStart("contacts") - b.ArrStart() - for idx, v := range i.Contacts { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode importContacts#77bdb718: field contacts element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *ImportContactsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode importContacts#77bdb718 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("importContacts"); err != nil { - return fmt.Errorf("unable to decode importContacts#77bdb718: %w", err) - } - case "contacts": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Contact - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode importContacts#77bdb718: field contacts: %w", err) - } - i.Contacts = append(i.Contacts, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode importContacts#77bdb718: field contacts: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetContacts returns value of Contacts field. -func (i *ImportContactsRequest) GetContacts() (value []Contact) { - if i == nil { - return - } - return i.Contacts -} - -// ImportContacts invokes method importContacts#77bdb718 returning error if any. -func (c *Client) ImportContacts(ctx context.Context, contacts []Contact) (*ImportedContacts, error) { - var result ImportedContacts - - request := &ImportContactsRequest{ - Contacts: contacts, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_import_messages_gen.go b/tdapi/tl_import_messages_gen.go deleted file mode 100644 index e11d3311e..000000000 --- a/tdapi/tl_import_messages_gen.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ImportMessagesRequest represents TL type `importMessages#7e98592b`. -type ImportMessagesRequest struct { - // Identifier of a chat to which the messages will be imported. It must be an identifier - // of a private chat with a mutual contact or an identifier of a supergroup chat with - // can_change_info member right - ChatID int64 - // File with messages to import. Only inputFileLocal and inputFileGenerated are supported - // The file must not be previously uploaded - MessageFile InputFileClass - // Files used in the imported messages. Only inputFileLocal and inputFileGenerated are - // supported. The files must not be previously uploaded - AttachedFiles []InputFileClass -} - -// ImportMessagesRequestTypeID is TL type id of ImportMessagesRequest. -const ImportMessagesRequestTypeID = 0x7e98592b - -// Ensuring interfaces in compile-time for ImportMessagesRequest. -var ( - _ bin.Encoder = &ImportMessagesRequest{} - _ bin.Decoder = &ImportMessagesRequest{} - _ bin.BareEncoder = &ImportMessagesRequest{} - _ bin.BareDecoder = &ImportMessagesRequest{} -) - -func (i *ImportMessagesRequest) Zero() bool { - if i == nil { - return true - } - if !(i.ChatID == 0) { - return false - } - if !(i.MessageFile == nil) { - return false - } - if !(i.AttachedFiles == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *ImportMessagesRequest) String() string { - if i == nil { - return "ImportMessagesRequest(nil)" - } - type Alias ImportMessagesRequest - return fmt.Sprintf("ImportMessagesRequest%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ImportMessagesRequest) TypeID() uint32 { - return ImportMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ImportMessagesRequest) TypeName() string { - return "importMessages" -} - -// TypeInfo returns info about TL type. -func (i *ImportMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "importMessages", - ID: ImportMessagesRequestTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageFile", - SchemaName: "message_file", - }, - { - Name: "AttachedFiles", - SchemaName: "attached_files", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *ImportMessagesRequest) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode importMessages#7e98592b as nil") - } - b.PutID(ImportMessagesRequestTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *ImportMessagesRequest) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode importMessages#7e98592b as nil") - } - b.PutInt53(i.ChatID) - if i.MessageFile == nil { - return fmt.Errorf("unable to encode importMessages#7e98592b: field message_file is nil") - } - if err := i.MessageFile.Encode(b); err != nil { - return fmt.Errorf("unable to encode importMessages#7e98592b: field message_file: %w", err) - } - b.PutInt(len(i.AttachedFiles)) - for idx, v := range i.AttachedFiles { - if v == nil { - return fmt.Errorf("unable to encode importMessages#7e98592b: field attached_files element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare importMessages#7e98592b: field attached_files element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (i *ImportMessagesRequest) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode importMessages#7e98592b to nil") - } - if err := b.ConsumeID(ImportMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode importMessages#7e98592b: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *ImportMessagesRequest) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode importMessages#7e98592b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode importMessages#7e98592b: field chat_id: %w", err) - } - i.ChatID = value - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode importMessages#7e98592b: field message_file: %w", err) - } - i.MessageFile = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode importMessages#7e98592b: field attached_files: %w", err) - } - - if headerLen > 0 { - i.AttachedFiles = make([]InputFileClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode importMessages#7e98592b: field attached_files: %w", err) - } - i.AttachedFiles = append(i.AttachedFiles, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *ImportMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode importMessages#7e98592b as nil") - } - b.ObjStart() - b.PutID("importMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(i.ChatID) - b.Comma() - b.FieldStart("message_file") - if i.MessageFile == nil { - return fmt.Errorf("unable to encode importMessages#7e98592b: field message_file is nil") - } - if err := i.MessageFile.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode importMessages#7e98592b: field message_file: %w", err) - } - b.Comma() - b.FieldStart("attached_files") - b.ArrStart() - for idx, v := range i.AttachedFiles { - if v == nil { - return fmt.Errorf("unable to encode importMessages#7e98592b: field attached_files element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode importMessages#7e98592b: field attached_files element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *ImportMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode importMessages#7e98592b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("importMessages"); err != nil { - return fmt.Errorf("unable to decode importMessages#7e98592b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode importMessages#7e98592b: field chat_id: %w", err) - } - i.ChatID = value - case "message_file": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode importMessages#7e98592b: field message_file: %w", err) - } - i.MessageFile = value - case "attached_files": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode importMessages#7e98592b: field attached_files: %w", err) - } - i.AttachedFiles = append(i.AttachedFiles, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode importMessages#7e98592b: field attached_files: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (i *ImportMessagesRequest) GetChatID() (value int64) { - if i == nil { - return - } - return i.ChatID -} - -// GetMessageFile returns value of MessageFile field. -func (i *ImportMessagesRequest) GetMessageFile() (value InputFileClass) { - if i == nil { - return - } - return i.MessageFile -} - -// GetAttachedFiles returns value of AttachedFiles field. -func (i *ImportMessagesRequest) GetAttachedFiles() (value []InputFileClass) { - if i == nil { - return - } - return i.AttachedFiles -} - -// ImportMessages invokes method importMessages#7e98592b returning error if any. -func (c *Client) ImportMessages(ctx context.Context, request *ImportMessagesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_imported_contacts_gen.go b/tdapi/tl_imported_contacts_gen.go deleted file mode 100644 index d9fe18eb7..000000000 --- a/tdapi/tl_imported_contacts_gen.go +++ /dev/null @@ -1,277 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ImportedContacts represents TL type `importedContacts#1119a03e`. -type ImportedContacts struct { - // User identifiers of the imported contacts in the same order as they were specified in - // the request; 0 if the contact is not yet a registered user - UserIDs []int64 - // The number of users that imported the corresponding contact; 0 for already registered - // users or if unavailable - ImporterCount []int32 -} - -// ImportedContactsTypeID is TL type id of ImportedContacts. -const ImportedContactsTypeID = 0x1119a03e - -// Ensuring interfaces in compile-time for ImportedContacts. -var ( - _ bin.Encoder = &ImportedContacts{} - _ bin.Decoder = &ImportedContacts{} - _ bin.BareEncoder = &ImportedContacts{} - _ bin.BareDecoder = &ImportedContacts{} -) - -func (i *ImportedContacts) Zero() bool { - if i == nil { - return true - } - if !(i.UserIDs == nil) { - return false - } - if !(i.ImporterCount == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *ImportedContacts) String() string { - if i == nil { - return "ImportedContacts(nil)" - } - type Alias ImportedContacts - return fmt.Sprintf("ImportedContacts%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ImportedContacts) TypeID() uint32 { - return ImportedContactsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ImportedContacts) TypeName() string { - return "importedContacts" -} - -// TypeInfo returns info about TL type. -func (i *ImportedContacts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "importedContacts", - ID: ImportedContactsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - { - Name: "ImporterCount", - SchemaName: "importer_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *ImportedContacts) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode importedContacts#1119a03e as nil") - } - b.PutID(ImportedContactsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *ImportedContacts) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode importedContacts#1119a03e as nil") - } - b.PutInt(len(i.UserIDs)) - for _, v := range i.UserIDs { - b.PutInt53(v) - } - b.PutInt(len(i.ImporterCount)) - for _, v := range i.ImporterCount { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *ImportedContacts) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode importedContacts#1119a03e to nil") - } - if err := b.ConsumeID(ImportedContactsTypeID); err != nil { - return fmt.Errorf("unable to decode importedContacts#1119a03e: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *ImportedContacts) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode importedContacts#1119a03e to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode importedContacts#1119a03e: field user_ids: %w", err) - } - - if headerLen > 0 { - i.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode importedContacts#1119a03e: field user_ids: %w", err) - } - i.UserIDs = append(i.UserIDs, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode importedContacts#1119a03e: field importer_count: %w", err) - } - - if headerLen > 0 { - i.ImporterCount = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode importedContacts#1119a03e: field importer_count: %w", err) - } - i.ImporterCount = append(i.ImporterCount, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *ImportedContacts) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode importedContacts#1119a03e as nil") - } - b.ObjStart() - b.PutID("importedContacts") - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range i.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("importer_count") - b.ArrStart() - for _, v := range i.ImporterCount { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *ImportedContacts) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode importedContacts#1119a03e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("importedContacts"); err != nil { - return fmt.Errorf("unable to decode importedContacts#1119a03e: %w", err) - } - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode importedContacts#1119a03e: field user_ids: %w", err) - } - i.UserIDs = append(i.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode importedContacts#1119a03e: field user_ids: %w", err) - } - case "importer_count": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode importedContacts#1119a03e: field importer_count: %w", err) - } - i.ImporterCount = append(i.ImporterCount, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode importedContacts#1119a03e: field importer_count: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserIDs returns value of UserIDs field. -func (i *ImportedContacts) GetUserIDs() (value []int64) { - if i == nil { - return - } - return i.UserIDs -} - -// GetImporterCount returns value of ImporterCount field. -func (i *ImportedContacts) GetImporterCount() (value []int32) { - if i == nil { - return - } - return i.ImporterCount -} diff --git a/tdapi/tl_inline_keyboard_button_gen.go b/tdapi/tl_inline_keyboard_button_gen.go deleted file mode 100644 index 15d2cad75..000000000 --- a/tdapi/tl_inline_keyboard_button_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InlineKeyboardButton represents TL type `inlineKeyboardButton#e9d21e18`. -type InlineKeyboardButton struct { - // Text of the button - Text string - // Type of the button - Type InlineKeyboardButtonTypeClass -} - -// InlineKeyboardButtonTypeID is TL type id of InlineKeyboardButton. -const InlineKeyboardButtonTypeID = 0xe9d21e18 - -// Ensuring interfaces in compile-time for InlineKeyboardButton. -var ( - _ bin.Encoder = &InlineKeyboardButton{} - _ bin.Decoder = &InlineKeyboardButton{} - _ bin.BareEncoder = &InlineKeyboardButton{} - _ bin.BareDecoder = &InlineKeyboardButton{} -) - -func (i *InlineKeyboardButton) Zero() bool { - if i == nil { - return true - } - if !(i.Text == "") { - return false - } - if !(i.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineKeyboardButton) String() string { - if i == nil { - return "InlineKeyboardButton(nil)" - } - type Alias InlineKeyboardButton - return fmt.Sprintf("InlineKeyboardButton%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineKeyboardButton) TypeID() uint32 { - return InlineKeyboardButtonTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineKeyboardButton) TypeName() string { - return "inlineKeyboardButton" -} - -// TypeInfo returns info about TL type. -func (i *InlineKeyboardButton) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineKeyboardButton", - ID: InlineKeyboardButtonTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineKeyboardButton) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButton#e9d21e18 as nil") - } - b.PutID(InlineKeyboardButtonTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineKeyboardButton) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButton#e9d21e18 as nil") - } - b.PutString(i.Text) - if i.Type == nil { - return fmt.Errorf("unable to encode inlineKeyboardButton#e9d21e18: field type is nil") - } - if err := i.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineKeyboardButton#e9d21e18: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineKeyboardButton) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButton#e9d21e18 to nil") - } - if err := b.ConsumeID(InlineKeyboardButtonTypeID); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButton#e9d21e18: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineKeyboardButton) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButton#e9d21e18 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButton#e9d21e18: field text: %w", err) - } - i.Text = value - } - { - value, err := DecodeInlineKeyboardButtonType(b) - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButton#e9d21e18: field type: %w", err) - } - i.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineKeyboardButton) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButton#e9d21e18 as nil") - } - b.ObjStart() - b.PutID("inlineKeyboardButton") - b.Comma() - b.FieldStart("text") - b.PutString(i.Text) - b.Comma() - b.FieldStart("type") - if i.Type == nil { - return fmt.Errorf("unable to encode inlineKeyboardButton#e9d21e18: field type is nil") - } - if err := i.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineKeyboardButton#e9d21e18: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineKeyboardButton) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButton#e9d21e18 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineKeyboardButton"); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButton#e9d21e18: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButton#e9d21e18: field text: %w", err) - } - i.Text = value - case "type": - value, err := DecodeTDLibJSONInlineKeyboardButtonType(b) - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButton#e9d21e18: field type: %w", err) - } - i.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (i *InlineKeyboardButton) GetText() (value string) { - if i == nil { - return - } - return i.Text -} - -// GetType returns value of Type field. -func (i *InlineKeyboardButton) GetType() (value InlineKeyboardButtonTypeClass) { - if i == nil { - return - } - return i.Type -} diff --git a/tdapi/tl_inline_keyboard_button_type_gen.go b/tdapi/tl_inline_keyboard_button_type_gen.go deleted file mode 100644 index b9b40fb34..000000000 --- a/tdapi/tl_inline_keyboard_button_type_gen.go +++ /dev/null @@ -1,1994 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InlineKeyboardButtonTypeURL represents TL type `inlineKeyboardButtonTypeUrl#4365beac`. -type InlineKeyboardButtonTypeURL struct { - // HTTP or tg:// URL to open. If the link is of the type internalLinkTypeWebApp, then the - // button must be marked as a Web App button - URL string -} - -// InlineKeyboardButtonTypeURLTypeID is TL type id of InlineKeyboardButtonTypeURL. -const InlineKeyboardButtonTypeURLTypeID = 0x4365beac - -// construct implements constructor of InlineKeyboardButtonTypeClass. -func (i InlineKeyboardButtonTypeURL) construct() InlineKeyboardButtonTypeClass { return &i } - -// Ensuring interfaces in compile-time for InlineKeyboardButtonTypeURL. -var ( - _ bin.Encoder = &InlineKeyboardButtonTypeURL{} - _ bin.Decoder = &InlineKeyboardButtonTypeURL{} - _ bin.BareEncoder = &InlineKeyboardButtonTypeURL{} - _ bin.BareDecoder = &InlineKeyboardButtonTypeURL{} - - _ InlineKeyboardButtonTypeClass = &InlineKeyboardButtonTypeURL{} -) - -func (i *InlineKeyboardButtonTypeURL) Zero() bool { - if i == nil { - return true - } - if !(i.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineKeyboardButtonTypeURL) String() string { - if i == nil { - return "InlineKeyboardButtonTypeURL(nil)" - } - type Alias InlineKeyboardButtonTypeURL - return fmt.Sprintf("InlineKeyboardButtonTypeURL%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineKeyboardButtonTypeURL) TypeID() uint32 { - return InlineKeyboardButtonTypeURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineKeyboardButtonTypeURL) TypeName() string { - return "inlineKeyboardButtonTypeUrl" -} - -// TypeInfo returns info about TL type. -func (i *InlineKeyboardButtonTypeURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineKeyboardButtonTypeUrl", - ID: InlineKeyboardButtonTypeURLTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineKeyboardButtonTypeURL) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeUrl#4365beac as nil") - } - b.PutID(InlineKeyboardButtonTypeURLTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineKeyboardButtonTypeURL) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeUrl#4365beac as nil") - } - b.PutString(i.URL) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineKeyboardButtonTypeURL) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeUrl#4365beac to nil") - } - if err := b.ConsumeID(InlineKeyboardButtonTypeURLTypeID); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeUrl#4365beac: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineKeyboardButtonTypeURL) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeUrl#4365beac to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeUrl#4365beac: field url: %w", err) - } - i.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineKeyboardButtonTypeURL) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeUrl#4365beac as nil") - } - b.ObjStart() - b.PutID("inlineKeyboardButtonTypeUrl") - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineKeyboardButtonTypeURL) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeUrl#4365beac to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineKeyboardButtonTypeUrl"); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeUrl#4365beac: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeUrl#4365beac: field url: %w", err) - } - i.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (i *InlineKeyboardButtonTypeURL) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// InlineKeyboardButtonTypeLoginURL represents TL type `inlineKeyboardButtonTypeLoginUrl#b8455fa7`. -type InlineKeyboardButtonTypeLoginURL struct { - // An HTTP URL to pass to getLoginUrlInfo - URL string - // Unique button identifier - ID int64 - // If non-empty, new text of the button in forwarded messages - ForwardText string -} - -// InlineKeyboardButtonTypeLoginURLTypeID is TL type id of InlineKeyboardButtonTypeLoginURL. -const InlineKeyboardButtonTypeLoginURLTypeID = 0xb8455fa7 - -// construct implements constructor of InlineKeyboardButtonTypeClass. -func (i InlineKeyboardButtonTypeLoginURL) construct() InlineKeyboardButtonTypeClass { return &i } - -// Ensuring interfaces in compile-time for InlineKeyboardButtonTypeLoginURL. -var ( - _ bin.Encoder = &InlineKeyboardButtonTypeLoginURL{} - _ bin.Decoder = &InlineKeyboardButtonTypeLoginURL{} - _ bin.BareEncoder = &InlineKeyboardButtonTypeLoginURL{} - _ bin.BareDecoder = &InlineKeyboardButtonTypeLoginURL{} - - _ InlineKeyboardButtonTypeClass = &InlineKeyboardButtonTypeLoginURL{} -) - -func (i *InlineKeyboardButtonTypeLoginURL) Zero() bool { - if i == nil { - return true - } - if !(i.URL == "") { - return false - } - if !(i.ID == 0) { - return false - } - if !(i.ForwardText == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineKeyboardButtonTypeLoginURL) String() string { - if i == nil { - return "InlineKeyboardButtonTypeLoginURL(nil)" - } - type Alias InlineKeyboardButtonTypeLoginURL - return fmt.Sprintf("InlineKeyboardButtonTypeLoginURL%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineKeyboardButtonTypeLoginURL) TypeID() uint32 { - return InlineKeyboardButtonTypeLoginURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineKeyboardButtonTypeLoginURL) TypeName() string { - return "inlineKeyboardButtonTypeLoginUrl" -} - -// TypeInfo returns info about TL type. -func (i *InlineKeyboardButtonTypeLoginURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineKeyboardButtonTypeLoginUrl", - ID: InlineKeyboardButtonTypeLoginURLTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "ForwardText", - SchemaName: "forward_text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineKeyboardButtonTypeLoginURL) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeLoginUrl#b8455fa7 as nil") - } - b.PutID(InlineKeyboardButtonTypeLoginURLTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineKeyboardButtonTypeLoginURL) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeLoginUrl#b8455fa7 as nil") - } - b.PutString(i.URL) - b.PutInt53(i.ID) - b.PutString(i.ForwardText) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineKeyboardButtonTypeLoginURL) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeLoginUrl#b8455fa7 to nil") - } - if err := b.ConsumeID(InlineKeyboardButtonTypeLoginURLTypeID); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeLoginUrl#b8455fa7: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineKeyboardButtonTypeLoginURL) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeLoginUrl#b8455fa7 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeLoginUrl#b8455fa7: field url: %w", err) - } - i.URL = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeLoginUrl#b8455fa7: field id: %w", err) - } - i.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeLoginUrl#b8455fa7: field forward_text: %w", err) - } - i.ForwardText = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineKeyboardButtonTypeLoginURL) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeLoginUrl#b8455fa7 as nil") - } - b.ObjStart() - b.PutID("inlineKeyboardButtonTypeLoginUrl") - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.FieldStart("id") - b.PutInt53(i.ID) - b.Comma() - b.FieldStart("forward_text") - b.PutString(i.ForwardText) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineKeyboardButtonTypeLoginURL) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeLoginUrl#b8455fa7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineKeyboardButtonTypeLoginUrl"); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeLoginUrl#b8455fa7: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeLoginUrl#b8455fa7: field url: %w", err) - } - i.URL = value - case "id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeLoginUrl#b8455fa7: field id: %w", err) - } - i.ID = value - case "forward_text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeLoginUrl#b8455fa7: field forward_text: %w", err) - } - i.ForwardText = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (i *InlineKeyboardButtonTypeLoginURL) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// GetID returns value of ID field. -func (i *InlineKeyboardButtonTypeLoginURL) GetID() (value int64) { - if i == nil { - return - } - return i.ID -} - -// GetForwardText returns value of ForwardText field. -func (i *InlineKeyboardButtonTypeLoginURL) GetForwardText() (value string) { - if i == nil { - return - } - return i.ForwardText -} - -// InlineKeyboardButtonTypeWebApp represents TL type `inlineKeyboardButtonTypeWebApp#96a685c8`. -type InlineKeyboardButtonTypeWebApp struct { - // An HTTP URL to pass to openWebApp - URL string -} - -// InlineKeyboardButtonTypeWebAppTypeID is TL type id of InlineKeyboardButtonTypeWebApp. -const InlineKeyboardButtonTypeWebAppTypeID = 0x96a685c8 - -// construct implements constructor of InlineKeyboardButtonTypeClass. -func (i InlineKeyboardButtonTypeWebApp) construct() InlineKeyboardButtonTypeClass { return &i } - -// Ensuring interfaces in compile-time for InlineKeyboardButtonTypeWebApp. -var ( - _ bin.Encoder = &InlineKeyboardButtonTypeWebApp{} - _ bin.Decoder = &InlineKeyboardButtonTypeWebApp{} - _ bin.BareEncoder = &InlineKeyboardButtonTypeWebApp{} - _ bin.BareDecoder = &InlineKeyboardButtonTypeWebApp{} - - _ InlineKeyboardButtonTypeClass = &InlineKeyboardButtonTypeWebApp{} -) - -func (i *InlineKeyboardButtonTypeWebApp) Zero() bool { - if i == nil { - return true - } - if !(i.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineKeyboardButtonTypeWebApp) String() string { - if i == nil { - return "InlineKeyboardButtonTypeWebApp(nil)" - } - type Alias InlineKeyboardButtonTypeWebApp - return fmt.Sprintf("InlineKeyboardButtonTypeWebApp%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineKeyboardButtonTypeWebApp) TypeID() uint32 { - return InlineKeyboardButtonTypeWebAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineKeyboardButtonTypeWebApp) TypeName() string { - return "inlineKeyboardButtonTypeWebApp" -} - -// TypeInfo returns info about TL type. -func (i *InlineKeyboardButtonTypeWebApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineKeyboardButtonTypeWebApp", - ID: InlineKeyboardButtonTypeWebAppTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineKeyboardButtonTypeWebApp) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeWebApp#96a685c8 as nil") - } - b.PutID(InlineKeyboardButtonTypeWebAppTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineKeyboardButtonTypeWebApp) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeWebApp#96a685c8 as nil") - } - b.PutString(i.URL) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineKeyboardButtonTypeWebApp) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeWebApp#96a685c8 to nil") - } - if err := b.ConsumeID(InlineKeyboardButtonTypeWebAppTypeID); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeWebApp#96a685c8: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineKeyboardButtonTypeWebApp) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeWebApp#96a685c8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeWebApp#96a685c8: field url: %w", err) - } - i.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineKeyboardButtonTypeWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeWebApp#96a685c8 as nil") - } - b.ObjStart() - b.PutID("inlineKeyboardButtonTypeWebApp") - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineKeyboardButtonTypeWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeWebApp#96a685c8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineKeyboardButtonTypeWebApp"); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeWebApp#96a685c8: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeWebApp#96a685c8: field url: %w", err) - } - i.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (i *InlineKeyboardButtonTypeWebApp) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// InlineKeyboardButtonTypeCallback represents TL type `inlineKeyboardButtonTypeCallback#bccb7bfd`. -type InlineKeyboardButtonTypeCallback struct { - // Data to be sent to the bot via a callback query - Data []byte -} - -// InlineKeyboardButtonTypeCallbackTypeID is TL type id of InlineKeyboardButtonTypeCallback. -const InlineKeyboardButtonTypeCallbackTypeID = 0xbccb7bfd - -// construct implements constructor of InlineKeyboardButtonTypeClass. -func (i InlineKeyboardButtonTypeCallback) construct() InlineKeyboardButtonTypeClass { return &i } - -// Ensuring interfaces in compile-time for InlineKeyboardButtonTypeCallback. -var ( - _ bin.Encoder = &InlineKeyboardButtonTypeCallback{} - _ bin.Decoder = &InlineKeyboardButtonTypeCallback{} - _ bin.BareEncoder = &InlineKeyboardButtonTypeCallback{} - _ bin.BareDecoder = &InlineKeyboardButtonTypeCallback{} - - _ InlineKeyboardButtonTypeClass = &InlineKeyboardButtonTypeCallback{} -) - -func (i *InlineKeyboardButtonTypeCallback) Zero() bool { - if i == nil { - return true - } - if !(i.Data == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineKeyboardButtonTypeCallback) String() string { - if i == nil { - return "InlineKeyboardButtonTypeCallback(nil)" - } - type Alias InlineKeyboardButtonTypeCallback - return fmt.Sprintf("InlineKeyboardButtonTypeCallback%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineKeyboardButtonTypeCallback) TypeID() uint32 { - return InlineKeyboardButtonTypeCallbackTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineKeyboardButtonTypeCallback) TypeName() string { - return "inlineKeyboardButtonTypeCallback" -} - -// TypeInfo returns info about TL type. -func (i *InlineKeyboardButtonTypeCallback) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineKeyboardButtonTypeCallback", - ID: InlineKeyboardButtonTypeCallbackTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineKeyboardButtonTypeCallback) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCallback#bccb7bfd as nil") - } - b.PutID(InlineKeyboardButtonTypeCallbackTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineKeyboardButtonTypeCallback) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCallback#bccb7bfd as nil") - } - b.PutBytes(i.Data) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineKeyboardButtonTypeCallback) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCallback#bccb7bfd to nil") - } - if err := b.ConsumeID(InlineKeyboardButtonTypeCallbackTypeID); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCallback#bccb7bfd: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineKeyboardButtonTypeCallback) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCallback#bccb7bfd to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCallback#bccb7bfd: field data: %w", err) - } - i.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineKeyboardButtonTypeCallback) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCallback#bccb7bfd as nil") - } - b.ObjStart() - b.PutID("inlineKeyboardButtonTypeCallback") - b.Comma() - b.FieldStart("data") - b.PutBytes(i.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineKeyboardButtonTypeCallback) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCallback#bccb7bfd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineKeyboardButtonTypeCallback"); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCallback#bccb7bfd: %w", err) - } - case "data": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCallback#bccb7bfd: field data: %w", err) - } - i.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetData returns value of Data field. -func (i *InlineKeyboardButtonTypeCallback) GetData() (value []byte) { - if i == nil { - return - } - return i.Data -} - -// InlineKeyboardButtonTypeCallbackWithPassword represents TL type `inlineKeyboardButtonTypeCallbackWithPassword#361f4248`. -type InlineKeyboardButtonTypeCallbackWithPassword struct { - // Data to be sent to the bot via a callback query - Data []byte -} - -// InlineKeyboardButtonTypeCallbackWithPasswordTypeID is TL type id of InlineKeyboardButtonTypeCallbackWithPassword. -const InlineKeyboardButtonTypeCallbackWithPasswordTypeID = 0x361f4248 - -// construct implements constructor of InlineKeyboardButtonTypeClass. -func (i InlineKeyboardButtonTypeCallbackWithPassword) construct() InlineKeyboardButtonTypeClass { - return &i -} - -// Ensuring interfaces in compile-time for InlineKeyboardButtonTypeCallbackWithPassword. -var ( - _ bin.Encoder = &InlineKeyboardButtonTypeCallbackWithPassword{} - _ bin.Decoder = &InlineKeyboardButtonTypeCallbackWithPassword{} - _ bin.BareEncoder = &InlineKeyboardButtonTypeCallbackWithPassword{} - _ bin.BareDecoder = &InlineKeyboardButtonTypeCallbackWithPassword{} - - _ InlineKeyboardButtonTypeClass = &InlineKeyboardButtonTypeCallbackWithPassword{} -) - -func (i *InlineKeyboardButtonTypeCallbackWithPassword) Zero() bool { - if i == nil { - return true - } - if !(i.Data == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineKeyboardButtonTypeCallbackWithPassword) String() string { - if i == nil { - return "InlineKeyboardButtonTypeCallbackWithPassword(nil)" - } - type Alias InlineKeyboardButtonTypeCallbackWithPassword - return fmt.Sprintf("InlineKeyboardButtonTypeCallbackWithPassword%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineKeyboardButtonTypeCallbackWithPassword) TypeID() uint32 { - return InlineKeyboardButtonTypeCallbackWithPasswordTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineKeyboardButtonTypeCallbackWithPassword) TypeName() string { - return "inlineKeyboardButtonTypeCallbackWithPassword" -} - -// TypeInfo returns info about TL type. -func (i *InlineKeyboardButtonTypeCallbackWithPassword) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineKeyboardButtonTypeCallbackWithPassword", - ID: InlineKeyboardButtonTypeCallbackWithPasswordTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineKeyboardButtonTypeCallbackWithPassword) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCallbackWithPassword#361f4248 as nil") - } - b.PutID(InlineKeyboardButtonTypeCallbackWithPasswordTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineKeyboardButtonTypeCallbackWithPassword) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCallbackWithPassword#361f4248 as nil") - } - b.PutBytes(i.Data) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineKeyboardButtonTypeCallbackWithPassword) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCallbackWithPassword#361f4248 to nil") - } - if err := b.ConsumeID(InlineKeyboardButtonTypeCallbackWithPasswordTypeID); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCallbackWithPassword#361f4248: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineKeyboardButtonTypeCallbackWithPassword) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCallbackWithPassword#361f4248 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCallbackWithPassword#361f4248: field data: %w", err) - } - i.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineKeyboardButtonTypeCallbackWithPassword) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCallbackWithPassword#361f4248 as nil") - } - b.ObjStart() - b.PutID("inlineKeyboardButtonTypeCallbackWithPassword") - b.Comma() - b.FieldStart("data") - b.PutBytes(i.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineKeyboardButtonTypeCallbackWithPassword) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCallbackWithPassword#361f4248 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineKeyboardButtonTypeCallbackWithPassword"); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCallbackWithPassword#361f4248: %w", err) - } - case "data": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCallbackWithPassword#361f4248: field data: %w", err) - } - i.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetData returns value of Data field. -func (i *InlineKeyboardButtonTypeCallbackWithPassword) GetData() (value []byte) { - if i == nil { - return - } - return i.Data -} - -// InlineKeyboardButtonTypeCallbackGame represents TL type `inlineKeyboardButtonTypeCallbackGame#e9255468`. -type InlineKeyboardButtonTypeCallbackGame struct { -} - -// InlineKeyboardButtonTypeCallbackGameTypeID is TL type id of InlineKeyboardButtonTypeCallbackGame. -const InlineKeyboardButtonTypeCallbackGameTypeID = 0xe9255468 - -// construct implements constructor of InlineKeyboardButtonTypeClass. -func (i InlineKeyboardButtonTypeCallbackGame) construct() InlineKeyboardButtonTypeClass { return &i } - -// Ensuring interfaces in compile-time for InlineKeyboardButtonTypeCallbackGame. -var ( - _ bin.Encoder = &InlineKeyboardButtonTypeCallbackGame{} - _ bin.Decoder = &InlineKeyboardButtonTypeCallbackGame{} - _ bin.BareEncoder = &InlineKeyboardButtonTypeCallbackGame{} - _ bin.BareDecoder = &InlineKeyboardButtonTypeCallbackGame{} - - _ InlineKeyboardButtonTypeClass = &InlineKeyboardButtonTypeCallbackGame{} -) - -func (i *InlineKeyboardButtonTypeCallbackGame) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineKeyboardButtonTypeCallbackGame) String() string { - if i == nil { - return "InlineKeyboardButtonTypeCallbackGame(nil)" - } - type Alias InlineKeyboardButtonTypeCallbackGame - return fmt.Sprintf("InlineKeyboardButtonTypeCallbackGame%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineKeyboardButtonTypeCallbackGame) TypeID() uint32 { - return InlineKeyboardButtonTypeCallbackGameTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineKeyboardButtonTypeCallbackGame) TypeName() string { - return "inlineKeyboardButtonTypeCallbackGame" -} - -// TypeInfo returns info about TL type. -func (i *InlineKeyboardButtonTypeCallbackGame) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineKeyboardButtonTypeCallbackGame", - ID: InlineKeyboardButtonTypeCallbackGameTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineKeyboardButtonTypeCallbackGame) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCallbackGame#e9255468 as nil") - } - b.PutID(InlineKeyboardButtonTypeCallbackGameTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineKeyboardButtonTypeCallbackGame) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCallbackGame#e9255468 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineKeyboardButtonTypeCallbackGame) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCallbackGame#e9255468 to nil") - } - if err := b.ConsumeID(InlineKeyboardButtonTypeCallbackGameTypeID); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCallbackGame#e9255468: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineKeyboardButtonTypeCallbackGame) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCallbackGame#e9255468 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineKeyboardButtonTypeCallbackGame) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCallbackGame#e9255468 as nil") - } - b.ObjStart() - b.PutID("inlineKeyboardButtonTypeCallbackGame") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineKeyboardButtonTypeCallbackGame) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCallbackGame#e9255468 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineKeyboardButtonTypeCallbackGame"); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCallbackGame#e9255468: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InlineKeyboardButtonTypeSwitchInline represents TL type `inlineKeyboardButtonTypeSwitchInline#207a9cf5`. -type InlineKeyboardButtonTypeSwitchInline struct { - // Inline query to be sent to the bot - Query string - // Target chat from which to send the inline query - TargetChat TargetChatClass -} - -// InlineKeyboardButtonTypeSwitchInlineTypeID is TL type id of InlineKeyboardButtonTypeSwitchInline. -const InlineKeyboardButtonTypeSwitchInlineTypeID = 0x207a9cf5 - -// construct implements constructor of InlineKeyboardButtonTypeClass. -func (i InlineKeyboardButtonTypeSwitchInline) construct() InlineKeyboardButtonTypeClass { return &i } - -// Ensuring interfaces in compile-time for InlineKeyboardButtonTypeSwitchInline. -var ( - _ bin.Encoder = &InlineKeyboardButtonTypeSwitchInline{} - _ bin.Decoder = &InlineKeyboardButtonTypeSwitchInline{} - _ bin.BareEncoder = &InlineKeyboardButtonTypeSwitchInline{} - _ bin.BareDecoder = &InlineKeyboardButtonTypeSwitchInline{} - - _ InlineKeyboardButtonTypeClass = &InlineKeyboardButtonTypeSwitchInline{} -) - -func (i *InlineKeyboardButtonTypeSwitchInline) Zero() bool { - if i == nil { - return true - } - if !(i.Query == "") { - return false - } - if !(i.TargetChat == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineKeyboardButtonTypeSwitchInline) String() string { - if i == nil { - return "InlineKeyboardButtonTypeSwitchInline(nil)" - } - type Alias InlineKeyboardButtonTypeSwitchInline - return fmt.Sprintf("InlineKeyboardButtonTypeSwitchInline%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineKeyboardButtonTypeSwitchInline) TypeID() uint32 { - return InlineKeyboardButtonTypeSwitchInlineTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineKeyboardButtonTypeSwitchInline) TypeName() string { - return "inlineKeyboardButtonTypeSwitchInline" -} - -// TypeInfo returns info about TL type. -func (i *InlineKeyboardButtonTypeSwitchInline) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineKeyboardButtonTypeSwitchInline", - ID: InlineKeyboardButtonTypeSwitchInlineTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "TargetChat", - SchemaName: "target_chat", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineKeyboardButtonTypeSwitchInline) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeSwitchInline#207a9cf5 as nil") - } - b.PutID(InlineKeyboardButtonTypeSwitchInlineTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineKeyboardButtonTypeSwitchInline) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeSwitchInline#207a9cf5 as nil") - } - b.PutString(i.Query) - if i.TargetChat == nil { - return fmt.Errorf("unable to encode inlineKeyboardButtonTypeSwitchInline#207a9cf5: field target_chat is nil") - } - if err := i.TargetChat.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineKeyboardButtonTypeSwitchInline#207a9cf5: field target_chat: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineKeyboardButtonTypeSwitchInline) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeSwitchInline#207a9cf5 to nil") - } - if err := b.ConsumeID(InlineKeyboardButtonTypeSwitchInlineTypeID); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeSwitchInline#207a9cf5: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineKeyboardButtonTypeSwitchInline) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeSwitchInline#207a9cf5 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeSwitchInline#207a9cf5: field query: %w", err) - } - i.Query = value - } - { - value, err := DecodeTargetChat(b) - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeSwitchInline#207a9cf5: field target_chat: %w", err) - } - i.TargetChat = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineKeyboardButtonTypeSwitchInline) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeSwitchInline#207a9cf5 as nil") - } - b.ObjStart() - b.PutID("inlineKeyboardButtonTypeSwitchInline") - b.Comma() - b.FieldStart("query") - b.PutString(i.Query) - b.Comma() - b.FieldStart("target_chat") - if i.TargetChat == nil { - return fmt.Errorf("unable to encode inlineKeyboardButtonTypeSwitchInline#207a9cf5: field target_chat is nil") - } - if err := i.TargetChat.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineKeyboardButtonTypeSwitchInline#207a9cf5: field target_chat: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineKeyboardButtonTypeSwitchInline) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeSwitchInline#207a9cf5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineKeyboardButtonTypeSwitchInline"); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeSwitchInline#207a9cf5: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeSwitchInline#207a9cf5: field query: %w", err) - } - i.Query = value - case "target_chat": - value, err := DecodeTDLibJSONTargetChat(b) - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeSwitchInline#207a9cf5: field target_chat: %w", err) - } - i.TargetChat = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (i *InlineKeyboardButtonTypeSwitchInline) GetQuery() (value string) { - if i == nil { - return - } - return i.Query -} - -// GetTargetChat returns value of TargetChat field. -func (i *InlineKeyboardButtonTypeSwitchInline) GetTargetChat() (value TargetChatClass) { - if i == nil { - return - } - return i.TargetChat -} - -// InlineKeyboardButtonTypeBuy represents TL type `inlineKeyboardButtonTypeBuy#511b3c70`. -type InlineKeyboardButtonTypeBuy struct { -} - -// InlineKeyboardButtonTypeBuyTypeID is TL type id of InlineKeyboardButtonTypeBuy. -const InlineKeyboardButtonTypeBuyTypeID = 0x511b3c70 - -// construct implements constructor of InlineKeyboardButtonTypeClass. -func (i InlineKeyboardButtonTypeBuy) construct() InlineKeyboardButtonTypeClass { return &i } - -// Ensuring interfaces in compile-time for InlineKeyboardButtonTypeBuy. -var ( - _ bin.Encoder = &InlineKeyboardButtonTypeBuy{} - _ bin.Decoder = &InlineKeyboardButtonTypeBuy{} - _ bin.BareEncoder = &InlineKeyboardButtonTypeBuy{} - _ bin.BareDecoder = &InlineKeyboardButtonTypeBuy{} - - _ InlineKeyboardButtonTypeClass = &InlineKeyboardButtonTypeBuy{} -) - -func (i *InlineKeyboardButtonTypeBuy) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineKeyboardButtonTypeBuy) String() string { - if i == nil { - return "InlineKeyboardButtonTypeBuy(nil)" - } - type Alias InlineKeyboardButtonTypeBuy - return fmt.Sprintf("InlineKeyboardButtonTypeBuy%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineKeyboardButtonTypeBuy) TypeID() uint32 { - return InlineKeyboardButtonTypeBuyTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineKeyboardButtonTypeBuy) TypeName() string { - return "inlineKeyboardButtonTypeBuy" -} - -// TypeInfo returns info about TL type. -func (i *InlineKeyboardButtonTypeBuy) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineKeyboardButtonTypeBuy", - ID: InlineKeyboardButtonTypeBuyTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineKeyboardButtonTypeBuy) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeBuy#511b3c70 as nil") - } - b.PutID(InlineKeyboardButtonTypeBuyTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineKeyboardButtonTypeBuy) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeBuy#511b3c70 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineKeyboardButtonTypeBuy) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeBuy#511b3c70 to nil") - } - if err := b.ConsumeID(InlineKeyboardButtonTypeBuyTypeID); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeBuy#511b3c70: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineKeyboardButtonTypeBuy) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeBuy#511b3c70 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineKeyboardButtonTypeBuy) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeBuy#511b3c70 as nil") - } - b.ObjStart() - b.PutID("inlineKeyboardButtonTypeBuy") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineKeyboardButtonTypeBuy) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeBuy#511b3c70 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineKeyboardButtonTypeBuy"); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeBuy#511b3c70: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InlineKeyboardButtonTypeUser represents TL type `inlineKeyboardButtonTypeUser#6d77e5a2`. -type InlineKeyboardButtonTypeUser struct { - // User identifier - UserID int64 -} - -// InlineKeyboardButtonTypeUserTypeID is TL type id of InlineKeyboardButtonTypeUser. -const InlineKeyboardButtonTypeUserTypeID = 0x6d77e5a2 - -// construct implements constructor of InlineKeyboardButtonTypeClass. -func (i InlineKeyboardButtonTypeUser) construct() InlineKeyboardButtonTypeClass { return &i } - -// Ensuring interfaces in compile-time for InlineKeyboardButtonTypeUser. -var ( - _ bin.Encoder = &InlineKeyboardButtonTypeUser{} - _ bin.Decoder = &InlineKeyboardButtonTypeUser{} - _ bin.BareEncoder = &InlineKeyboardButtonTypeUser{} - _ bin.BareDecoder = &InlineKeyboardButtonTypeUser{} - - _ InlineKeyboardButtonTypeClass = &InlineKeyboardButtonTypeUser{} -) - -func (i *InlineKeyboardButtonTypeUser) Zero() bool { - if i == nil { - return true - } - if !(i.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineKeyboardButtonTypeUser) String() string { - if i == nil { - return "InlineKeyboardButtonTypeUser(nil)" - } - type Alias InlineKeyboardButtonTypeUser - return fmt.Sprintf("InlineKeyboardButtonTypeUser%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineKeyboardButtonTypeUser) TypeID() uint32 { - return InlineKeyboardButtonTypeUserTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineKeyboardButtonTypeUser) TypeName() string { - return "inlineKeyboardButtonTypeUser" -} - -// TypeInfo returns info about TL type. -func (i *InlineKeyboardButtonTypeUser) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineKeyboardButtonTypeUser", - ID: InlineKeyboardButtonTypeUserTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineKeyboardButtonTypeUser) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeUser#6d77e5a2 as nil") - } - b.PutID(InlineKeyboardButtonTypeUserTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineKeyboardButtonTypeUser) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeUser#6d77e5a2 as nil") - } - b.PutInt53(i.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineKeyboardButtonTypeUser) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeUser#6d77e5a2 to nil") - } - if err := b.ConsumeID(InlineKeyboardButtonTypeUserTypeID); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeUser#6d77e5a2: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineKeyboardButtonTypeUser) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeUser#6d77e5a2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeUser#6d77e5a2: field user_id: %w", err) - } - i.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineKeyboardButtonTypeUser) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeUser#6d77e5a2 as nil") - } - b.ObjStart() - b.PutID("inlineKeyboardButtonTypeUser") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(i.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineKeyboardButtonTypeUser) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeUser#6d77e5a2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineKeyboardButtonTypeUser"); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeUser#6d77e5a2: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeUser#6d77e5a2: field user_id: %w", err) - } - i.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (i *InlineKeyboardButtonTypeUser) GetUserID() (value int64) { - if i == nil { - return - } - return i.UserID -} - -// InlineKeyboardButtonTypeCopyText represents TL type `inlineKeyboardButtonTypeCopyText#41b1306`. -type InlineKeyboardButtonTypeCopyText struct { - // The text to copy to clipboard - Text string -} - -// InlineKeyboardButtonTypeCopyTextTypeID is TL type id of InlineKeyboardButtonTypeCopyText. -const InlineKeyboardButtonTypeCopyTextTypeID = 0x41b1306 - -// construct implements constructor of InlineKeyboardButtonTypeClass. -func (i InlineKeyboardButtonTypeCopyText) construct() InlineKeyboardButtonTypeClass { return &i } - -// Ensuring interfaces in compile-time for InlineKeyboardButtonTypeCopyText. -var ( - _ bin.Encoder = &InlineKeyboardButtonTypeCopyText{} - _ bin.Decoder = &InlineKeyboardButtonTypeCopyText{} - _ bin.BareEncoder = &InlineKeyboardButtonTypeCopyText{} - _ bin.BareDecoder = &InlineKeyboardButtonTypeCopyText{} - - _ InlineKeyboardButtonTypeClass = &InlineKeyboardButtonTypeCopyText{} -) - -func (i *InlineKeyboardButtonTypeCopyText) Zero() bool { - if i == nil { - return true - } - if !(i.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineKeyboardButtonTypeCopyText) String() string { - if i == nil { - return "InlineKeyboardButtonTypeCopyText(nil)" - } - type Alias InlineKeyboardButtonTypeCopyText - return fmt.Sprintf("InlineKeyboardButtonTypeCopyText%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineKeyboardButtonTypeCopyText) TypeID() uint32 { - return InlineKeyboardButtonTypeCopyTextTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineKeyboardButtonTypeCopyText) TypeName() string { - return "inlineKeyboardButtonTypeCopyText" -} - -// TypeInfo returns info about TL type. -func (i *InlineKeyboardButtonTypeCopyText) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineKeyboardButtonTypeCopyText", - ID: InlineKeyboardButtonTypeCopyTextTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineKeyboardButtonTypeCopyText) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCopyText#41b1306 as nil") - } - b.PutID(InlineKeyboardButtonTypeCopyTextTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineKeyboardButtonTypeCopyText) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCopyText#41b1306 as nil") - } - b.PutString(i.Text) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineKeyboardButtonTypeCopyText) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCopyText#41b1306 to nil") - } - if err := b.ConsumeID(InlineKeyboardButtonTypeCopyTextTypeID); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCopyText#41b1306: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineKeyboardButtonTypeCopyText) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCopyText#41b1306 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCopyText#41b1306: field text: %w", err) - } - i.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineKeyboardButtonTypeCopyText) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineKeyboardButtonTypeCopyText#41b1306 as nil") - } - b.ObjStart() - b.PutID("inlineKeyboardButtonTypeCopyText") - b.Comma() - b.FieldStart("text") - b.PutString(i.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineKeyboardButtonTypeCopyText) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineKeyboardButtonTypeCopyText#41b1306 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineKeyboardButtonTypeCopyText"); err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCopyText#41b1306: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineKeyboardButtonTypeCopyText#41b1306: field text: %w", err) - } - i.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (i *InlineKeyboardButtonTypeCopyText) GetText() (value string) { - if i == nil { - return - } - return i.Text -} - -// InlineKeyboardButtonTypeClassName is schema name of InlineKeyboardButtonTypeClass. -const InlineKeyboardButtonTypeClassName = "InlineKeyboardButtonType" - -// InlineKeyboardButtonTypeClass represents InlineKeyboardButtonType generic type. -// -// Example: -// -// g, err := tdapi.DecodeInlineKeyboardButtonType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InlineKeyboardButtonTypeURL: // inlineKeyboardButtonTypeUrl#4365beac -// case *tdapi.InlineKeyboardButtonTypeLoginURL: // inlineKeyboardButtonTypeLoginUrl#b8455fa7 -// case *tdapi.InlineKeyboardButtonTypeWebApp: // inlineKeyboardButtonTypeWebApp#96a685c8 -// case *tdapi.InlineKeyboardButtonTypeCallback: // inlineKeyboardButtonTypeCallback#bccb7bfd -// case *tdapi.InlineKeyboardButtonTypeCallbackWithPassword: // inlineKeyboardButtonTypeCallbackWithPassword#361f4248 -// case *tdapi.InlineKeyboardButtonTypeCallbackGame: // inlineKeyboardButtonTypeCallbackGame#e9255468 -// case *tdapi.InlineKeyboardButtonTypeSwitchInline: // inlineKeyboardButtonTypeSwitchInline#207a9cf5 -// case *tdapi.InlineKeyboardButtonTypeBuy: // inlineKeyboardButtonTypeBuy#511b3c70 -// case *tdapi.InlineKeyboardButtonTypeUser: // inlineKeyboardButtonTypeUser#6d77e5a2 -// case *tdapi.InlineKeyboardButtonTypeCopyText: // inlineKeyboardButtonTypeCopyText#41b1306 -// default: panic(v) -// } -type InlineKeyboardButtonTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InlineKeyboardButtonTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInlineKeyboardButtonType implements binary de-serialization for InlineKeyboardButtonTypeClass. -func DecodeInlineKeyboardButtonType(buf *bin.Buffer) (InlineKeyboardButtonTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InlineKeyboardButtonTypeURLTypeID: - // Decoding inlineKeyboardButtonTypeUrl#4365beac. - v := InlineKeyboardButtonTypeURL{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case InlineKeyboardButtonTypeLoginURLTypeID: - // Decoding inlineKeyboardButtonTypeLoginUrl#b8455fa7. - v := InlineKeyboardButtonTypeLoginURL{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case InlineKeyboardButtonTypeWebAppTypeID: - // Decoding inlineKeyboardButtonTypeWebApp#96a685c8. - v := InlineKeyboardButtonTypeWebApp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case InlineKeyboardButtonTypeCallbackTypeID: - // Decoding inlineKeyboardButtonTypeCallback#bccb7bfd. - v := InlineKeyboardButtonTypeCallback{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case InlineKeyboardButtonTypeCallbackWithPasswordTypeID: - // Decoding inlineKeyboardButtonTypeCallbackWithPassword#361f4248. - v := InlineKeyboardButtonTypeCallbackWithPassword{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case InlineKeyboardButtonTypeCallbackGameTypeID: - // Decoding inlineKeyboardButtonTypeCallbackGame#e9255468. - v := InlineKeyboardButtonTypeCallbackGame{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case InlineKeyboardButtonTypeSwitchInlineTypeID: - // Decoding inlineKeyboardButtonTypeSwitchInline#207a9cf5. - v := InlineKeyboardButtonTypeSwitchInline{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case InlineKeyboardButtonTypeBuyTypeID: - // Decoding inlineKeyboardButtonTypeBuy#511b3c70. - v := InlineKeyboardButtonTypeBuy{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case InlineKeyboardButtonTypeUserTypeID: - // Decoding inlineKeyboardButtonTypeUser#6d77e5a2. - v := InlineKeyboardButtonTypeUser{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case InlineKeyboardButtonTypeCopyTextTypeID: - // Decoding inlineKeyboardButtonTypeCopyText#41b1306. - v := InlineKeyboardButtonTypeCopyText{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInlineKeyboardButtonType implements binary de-serialization for InlineKeyboardButtonTypeClass. -func DecodeTDLibJSONInlineKeyboardButtonType(buf tdjson.Decoder) (InlineKeyboardButtonTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inlineKeyboardButtonTypeUrl": - // Decoding inlineKeyboardButtonTypeUrl#4365beac. - v := InlineKeyboardButtonTypeURL{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "inlineKeyboardButtonTypeLoginUrl": - // Decoding inlineKeyboardButtonTypeLoginUrl#b8455fa7. - v := InlineKeyboardButtonTypeLoginURL{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "inlineKeyboardButtonTypeWebApp": - // Decoding inlineKeyboardButtonTypeWebApp#96a685c8. - v := InlineKeyboardButtonTypeWebApp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "inlineKeyboardButtonTypeCallback": - // Decoding inlineKeyboardButtonTypeCallback#bccb7bfd. - v := InlineKeyboardButtonTypeCallback{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "inlineKeyboardButtonTypeCallbackWithPassword": - // Decoding inlineKeyboardButtonTypeCallbackWithPassword#361f4248. - v := InlineKeyboardButtonTypeCallbackWithPassword{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "inlineKeyboardButtonTypeCallbackGame": - // Decoding inlineKeyboardButtonTypeCallbackGame#e9255468. - v := InlineKeyboardButtonTypeCallbackGame{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "inlineKeyboardButtonTypeSwitchInline": - // Decoding inlineKeyboardButtonTypeSwitchInline#207a9cf5. - v := InlineKeyboardButtonTypeSwitchInline{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "inlineKeyboardButtonTypeBuy": - // Decoding inlineKeyboardButtonTypeBuy#511b3c70. - v := InlineKeyboardButtonTypeBuy{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "inlineKeyboardButtonTypeUser": - // Decoding inlineKeyboardButtonTypeUser#6d77e5a2. - v := InlineKeyboardButtonTypeUser{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "inlineKeyboardButtonTypeCopyText": - // Decoding inlineKeyboardButtonTypeCopyText#41b1306. - v := InlineKeyboardButtonTypeCopyText{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InlineKeyboardButtonTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InlineKeyboardButtonType boxes the InlineKeyboardButtonTypeClass providing a helper. -type InlineKeyboardButtonTypeBox struct { - InlineKeyboardButtonType InlineKeyboardButtonTypeClass -} - -// Decode implements bin.Decoder for InlineKeyboardButtonTypeBox. -func (b *InlineKeyboardButtonTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InlineKeyboardButtonTypeBox to nil") - } - v, err := DecodeInlineKeyboardButtonType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InlineKeyboardButtonType = v - return nil -} - -// Encode implements bin.Encode for InlineKeyboardButtonTypeBox. -func (b *InlineKeyboardButtonTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InlineKeyboardButtonType == nil { - return fmt.Errorf("unable to encode InlineKeyboardButtonTypeClass as nil") - } - return b.InlineKeyboardButtonType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InlineKeyboardButtonTypeBox. -func (b *InlineKeyboardButtonTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InlineKeyboardButtonTypeBox to nil") - } - v, err := DecodeTDLibJSONInlineKeyboardButtonType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InlineKeyboardButtonType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InlineKeyboardButtonTypeBox. -func (b *InlineKeyboardButtonTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InlineKeyboardButtonType == nil { - return fmt.Errorf("unable to encode InlineKeyboardButtonTypeClass as nil") - } - return b.InlineKeyboardButtonType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_inline_query_result_gen.go b/tdapi/tl_inline_query_result_gen.go deleted file mode 100644 index 7c46c10e7..000000000 --- a/tdapi/tl_inline_query_result_gen.go +++ /dev/null @@ -1,3232 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InlineQueryResultArticle represents TL type `inlineQueryResultArticle#1016d01a`. -type InlineQueryResultArticle struct { - // Unique identifier of the query result - ID string - // URL of the result, if it exists - URL string - // Title of the result - Title string - // Represents a link to an article or web page - Description string - // Result thumbnail in JPEG format; may be null - Thumbnail Thumbnail -} - -// InlineQueryResultArticleTypeID is TL type id of InlineQueryResultArticle. -const InlineQueryResultArticleTypeID = 0x1016d01a - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultArticle) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultArticle. -var ( - _ bin.Encoder = &InlineQueryResultArticle{} - _ bin.Decoder = &InlineQueryResultArticle{} - _ bin.BareEncoder = &InlineQueryResultArticle{} - _ bin.BareDecoder = &InlineQueryResultArticle{} - - _ InlineQueryResultClass = &InlineQueryResultArticle{} -) - -func (i *InlineQueryResultArticle) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.URL == "") { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Description == "") { - return false - } - if !(i.Thumbnail.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultArticle) String() string { - if i == nil { - return "InlineQueryResultArticle(nil)" - } - type Alias InlineQueryResultArticle - return fmt.Sprintf("InlineQueryResultArticle%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultArticle) TypeID() uint32 { - return InlineQueryResultArticleTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultArticle) TypeName() string { - return "inlineQueryResultArticle" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultArticle) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultArticle", - ID: InlineQueryResultArticleTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultArticle) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultArticle#1016d01a as nil") - } - b.PutID(InlineQueryResultArticleTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultArticle) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultArticle#1016d01a as nil") - } - b.PutString(i.ID) - b.PutString(i.URL) - b.PutString(i.Title) - b.PutString(i.Description) - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultArticle) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultArticle#1016d01a to nil") - } - if err := b.ConsumeID(InlineQueryResultArticleTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultArticle) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultArticle#1016d01a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field id: %w", err) - } - i.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field url: %w", err) - } - i.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field description: %w", err) - } - i.Description = value - } - { - if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultArticle#1016d01a as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultArticle") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("description") - b.PutString(i.Description) - b.Comma() - b.FieldStart("thumbnail") - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultArticle) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultArticle#1016d01a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultArticle"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field id: %w", err) - } - i.ID = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field url: %w", err) - } - i.URL = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field title: %w", err) - } - i.Title = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field description: %w", err) - } - i.Description = value - case "thumbnail": - if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultArticle#1016d01a: field thumbnail: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultArticle) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetURL returns value of URL field. -func (i *InlineQueryResultArticle) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// GetTitle returns value of Title field. -func (i *InlineQueryResultArticle) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetDescription returns value of Description field. -func (i *InlineQueryResultArticle) GetDescription() (value string) { - if i == nil { - return - } - return i.Description -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InlineQueryResultArticle) GetThumbnail() (value Thumbnail) { - if i == nil { - return - } - return i.Thumbnail -} - -// InlineQueryResultContact represents TL type `inlineQueryResultContact#f5278212`. -type InlineQueryResultContact struct { - // Unique identifier of the query result - ID string - // A user contact - Contact Contact - // Result thumbnail in JPEG format; may be null - Thumbnail Thumbnail -} - -// InlineQueryResultContactTypeID is TL type id of InlineQueryResultContact. -const InlineQueryResultContactTypeID = 0xf5278212 - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultContact) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultContact. -var ( - _ bin.Encoder = &InlineQueryResultContact{} - _ bin.Decoder = &InlineQueryResultContact{} - _ bin.BareEncoder = &InlineQueryResultContact{} - _ bin.BareDecoder = &InlineQueryResultContact{} - - _ InlineQueryResultClass = &InlineQueryResultContact{} -) - -func (i *InlineQueryResultContact) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Contact.Zero()) { - return false - } - if !(i.Thumbnail.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultContact) String() string { - if i == nil { - return "InlineQueryResultContact(nil)" - } - type Alias InlineQueryResultContact - return fmt.Sprintf("InlineQueryResultContact%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultContact) TypeID() uint32 { - return InlineQueryResultContactTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultContact) TypeName() string { - return "inlineQueryResultContact" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultContact) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultContact", - ID: InlineQueryResultContactTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Contact", - SchemaName: "contact", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultContact) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultContact#f5278212 as nil") - } - b.PutID(InlineQueryResultContactTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultContact) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultContact#f5278212 as nil") - } - b.PutString(i.ID) - if err := i.Contact.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultContact#f5278212: field contact: %w", err) - } - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultContact#f5278212: field thumbnail: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultContact) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultContact#f5278212 to nil") - } - if err := b.ConsumeID(InlineQueryResultContactTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultContact) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultContact#f5278212 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field id: %w", err) - } - i.ID = value - } - { - if err := i.Contact.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field contact: %w", err) - } - } - { - if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field thumbnail: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultContact) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultContact#f5278212 as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultContact") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("contact") - if err := i.Contact.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultContact#f5278212: field contact: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultContact#f5278212: field thumbnail: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultContact) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultContact#f5278212 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultContact"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field id: %w", err) - } - i.ID = value - case "contact": - if err := i.Contact.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field contact: %w", err) - } - case "thumbnail": - if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultContact#f5278212: field thumbnail: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultContact) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetContact returns value of Contact field. -func (i *InlineQueryResultContact) GetContact() (value Contact) { - if i == nil { - return - } - return i.Contact -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InlineQueryResultContact) GetThumbnail() (value Thumbnail) { - if i == nil { - return - } - return i.Thumbnail -} - -// InlineQueryResultLocation represents TL type `inlineQueryResultLocation#1bc6ab10`. -type InlineQueryResultLocation struct { - // Unique identifier of the query result - ID string - // Location result - Location Location - // Title of the result - Title string - // Result thumbnail in JPEG format; may be null - Thumbnail Thumbnail -} - -// InlineQueryResultLocationTypeID is TL type id of InlineQueryResultLocation. -const InlineQueryResultLocationTypeID = 0x1bc6ab10 - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultLocation) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultLocation. -var ( - _ bin.Encoder = &InlineQueryResultLocation{} - _ bin.Decoder = &InlineQueryResultLocation{} - _ bin.BareEncoder = &InlineQueryResultLocation{} - _ bin.BareDecoder = &InlineQueryResultLocation{} - - _ InlineQueryResultClass = &InlineQueryResultLocation{} -) - -func (i *InlineQueryResultLocation) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Location.Zero()) { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Thumbnail.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultLocation) String() string { - if i == nil { - return "InlineQueryResultLocation(nil)" - } - type Alias InlineQueryResultLocation - return fmt.Sprintf("InlineQueryResultLocation%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultLocation) TypeID() uint32 { - return InlineQueryResultLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultLocation) TypeName() string { - return "inlineQueryResultLocation" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultLocation", - ID: InlineQueryResultLocationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultLocation) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultLocation#1bc6ab10 as nil") - } - b.PutID(InlineQueryResultLocationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultLocation) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultLocation#1bc6ab10 as nil") - } - b.PutString(i.ID) - if err := i.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultLocation#1bc6ab10: field location: %w", err) - } - b.PutString(i.Title) - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultLocation#1bc6ab10: field thumbnail: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultLocation) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultLocation#1bc6ab10 to nil") - } - if err := b.ConsumeID(InlineQueryResultLocationTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultLocation) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultLocation#1bc6ab10 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field id: %w", err) - } - i.ID = value - } - { - if err := i.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field location: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field title: %w", err) - } - i.Title = value - } - { - if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field thumbnail: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultLocation) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultLocation#1bc6ab10 as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultLocation") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("location") - if err := i.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultLocation#1bc6ab10: field location: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("thumbnail") - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultLocation#1bc6ab10: field thumbnail: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultLocation) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultLocation#1bc6ab10 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultLocation"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field id: %w", err) - } - i.ID = value - case "location": - if err := i.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field location: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field title: %w", err) - } - i.Title = value - case "thumbnail": - if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultLocation#1bc6ab10: field thumbnail: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultLocation) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetLocation returns value of Location field. -func (i *InlineQueryResultLocation) GetLocation() (value Location) { - if i == nil { - return - } - return i.Location -} - -// GetTitle returns value of Title field. -func (i *InlineQueryResultLocation) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InlineQueryResultLocation) GetThumbnail() (value Thumbnail) { - if i == nil { - return - } - return i.Thumbnail -} - -// InlineQueryResultVenue represents TL type `inlineQueryResultVenue#4c5b105e`. -type InlineQueryResultVenue struct { - // Unique identifier of the query result - ID string - // Venue result - Venue Venue - // Result thumbnail in JPEG format; may be null - Thumbnail Thumbnail -} - -// InlineQueryResultVenueTypeID is TL type id of InlineQueryResultVenue. -const InlineQueryResultVenueTypeID = 0x4c5b105e - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultVenue) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultVenue. -var ( - _ bin.Encoder = &InlineQueryResultVenue{} - _ bin.Decoder = &InlineQueryResultVenue{} - _ bin.BareEncoder = &InlineQueryResultVenue{} - _ bin.BareDecoder = &InlineQueryResultVenue{} - - _ InlineQueryResultClass = &InlineQueryResultVenue{} -) - -func (i *InlineQueryResultVenue) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Venue.Zero()) { - return false - } - if !(i.Thumbnail.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultVenue) String() string { - if i == nil { - return "InlineQueryResultVenue(nil)" - } - type Alias InlineQueryResultVenue - return fmt.Sprintf("InlineQueryResultVenue%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultVenue) TypeID() uint32 { - return InlineQueryResultVenueTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultVenue) TypeName() string { - return "inlineQueryResultVenue" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultVenue) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultVenue", - ID: InlineQueryResultVenueTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Venue", - SchemaName: "venue", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultVenue) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultVenue#4c5b105e as nil") - } - b.PutID(InlineQueryResultVenueTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultVenue) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultVenue#4c5b105e as nil") - } - b.PutString(i.ID) - if err := i.Venue.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultVenue#4c5b105e: field venue: %w", err) - } - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultVenue#4c5b105e: field thumbnail: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultVenue) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultVenue#4c5b105e to nil") - } - if err := b.ConsumeID(InlineQueryResultVenueTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultVenue) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultVenue#4c5b105e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field id: %w", err) - } - i.ID = value - } - { - if err := i.Venue.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field venue: %w", err) - } - } - { - if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field thumbnail: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultVenue) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultVenue#4c5b105e as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultVenue") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("venue") - if err := i.Venue.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultVenue#4c5b105e: field venue: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultVenue#4c5b105e: field thumbnail: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultVenue) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultVenue#4c5b105e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultVenue"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field id: %w", err) - } - i.ID = value - case "venue": - if err := i.Venue.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field venue: %w", err) - } - case "thumbnail": - if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVenue#4c5b105e: field thumbnail: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultVenue) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetVenue returns value of Venue field. -func (i *InlineQueryResultVenue) GetVenue() (value Venue) { - if i == nil { - return - } - return i.Venue -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InlineQueryResultVenue) GetThumbnail() (value Thumbnail) { - if i == nil { - return - } - return i.Thumbnail -} - -// InlineQueryResultGame represents TL type `inlineQueryResultGame#65bd7c7b`. -type InlineQueryResultGame struct { - // Unique identifier of the query result - ID string - // Game result - Game Game -} - -// InlineQueryResultGameTypeID is TL type id of InlineQueryResultGame. -const InlineQueryResultGameTypeID = 0x65bd7c7b - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultGame) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultGame. -var ( - _ bin.Encoder = &InlineQueryResultGame{} - _ bin.Decoder = &InlineQueryResultGame{} - _ bin.BareEncoder = &InlineQueryResultGame{} - _ bin.BareDecoder = &InlineQueryResultGame{} - - _ InlineQueryResultClass = &InlineQueryResultGame{} -) - -func (i *InlineQueryResultGame) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Game.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultGame) String() string { - if i == nil { - return "InlineQueryResultGame(nil)" - } - type Alias InlineQueryResultGame - return fmt.Sprintf("InlineQueryResultGame%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultGame) TypeID() uint32 { - return InlineQueryResultGameTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultGame) TypeName() string { - return "inlineQueryResultGame" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultGame) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultGame", - ID: InlineQueryResultGameTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Game", - SchemaName: "game", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultGame) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultGame#65bd7c7b as nil") - } - b.PutID(InlineQueryResultGameTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultGame) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultGame#65bd7c7b as nil") - } - b.PutString(i.ID) - if err := i.Game.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultGame#65bd7c7b: field game: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultGame) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultGame#65bd7c7b to nil") - } - if err := b.ConsumeID(InlineQueryResultGameTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultGame) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultGame#65bd7c7b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: field id: %w", err) - } - i.ID = value - } - { - if err := i.Game.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: field game: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultGame) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultGame#65bd7c7b as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultGame") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("game") - if err := i.Game.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultGame#65bd7c7b: field game: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultGame) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultGame#65bd7c7b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultGame"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: field id: %w", err) - } - i.ID = value - case "game": - if err := i.Game.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultGame#65bd7c7b: field game: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultGame) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetGame returns value of Game field. -func (i *InlineQueryResultGame) GetGame() (value Game) { - if i == nil { - return - } - return i.Game -} - -// InlineQueryResultAnimation represents TL type `inlineQueryResultAnimation#77cded0b`. -type InlineQueryResultAnimation struct { - // Unique identifier of the query result - ID string - // Animation file - Animation Animation - // Animation title - Title string -} - -// InlineQueryResultAnimationTypeID is TL type id of InlineQueryResultAnimation. -const InlineQueryResultAnimationTypeID = 0x77cded0b - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultAnimation) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultAnimation. -var ( - _ bin.Encoder = &InlineQueryResultAnimation{} - _ bin.Decoder = &InlineQueryResultAnimation{} - _ bin.BareEncoder = &InlineQueryResultAnimation{} - _ bin.BareDecoder = &InlineQueryResultAnimation{} - - _ InlineQueryResultClass = &InlineQueryResultAnimation{} -) - -func (i *InlineQueryResultAnimation) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Animation.Zero()) { - return false - } - if !(i.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultAnimation) String() string { - if i == nil { - return "InlineQueryResultAnimation(nil)" - } - type Alias InlineQueryResultAnimation - return fmt.Sprintf("InlineQueryResultAnimation%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultAnimation) TypeID() uint32 { - return InlineQueryResultAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultAnimation) TypeName() string { - return "inlineQueryResultAnimation" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultAnimation", - ID: InlineQueryResultAnimationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Animation", - SchemaName: "animation", - }, - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultAnimation) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultAnimation#77cded0b as nil") - } - b.PutID(InlineQueryResultAnimationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultAnimation) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultAnimation#77cded0b as nil") - } - b.PutString(i.ID) - if err := i.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultAnimation#77cded0b: field animation: %w", err) - } - b.PutString(i.Title) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultAnimation) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultAnimation#77cded0b to nil") - } - if err := b.ConsumeID(InlineQueryResultAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultAnimation) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultAnimation#77cded0b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field id: %w", err) - } - i.ID = value - } - { - if err := i.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field animation: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field title: %w", err) - } - i.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultAnimation#77cded0b as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultAnimation") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("animation") - if err := i.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultAnimation#77cded0b: field animation: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultAnimation#77cded0b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultAnimation"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field id: %w", err) - } - i.ID = value - case "animation": - if err := i.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field animation: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAnimation#77cded0b: field title: %w", err) - } - i.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultAnimation) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetAnimation returns value of Animation field. -func (i *InlineQueryResultAnimation) GetAnimation() (value Animation) { - if i == nil { - return - } - return i.Animation -} - -// GetTitle returns value of Title field. -func (i *InlineQueryResultAnimation) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// InlineQueryResultAudio represents TL type `inlineQueryResultAudio#3239d2f8`. -type InlineQueryResultAudio struct { - // Unique identifier of the query result - ID string - // Audio file - Audio Audio -} - -// InlineQueryResultAudioTypeID is TL type id of InlineQueryResultAudio. -const InlineQueryResultAudioTypeID = 0x3239d2f8 - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultAudio) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultAudio. -var ( - _ bin.Encoder = &InlineQueryResultAudio{} - _ bin.Decoder = &InlineQueryResultAudio{} - _ bin.BareEncoder = &InlineQueryResultAudio{} - _ bin.BareDecoder = &InlineQueryResultAudio{} - - _ InlineQueryResultClass = &InlineQueryResultAudio{} -) - -func (i *InlineQueryResultAudio) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Audio.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultAudio) String() string { - if i == nil { - return "InlineQueryResultAudio(nil)" - } - type Alias InlineQueryResultAudio - return fmt.Sprintf("InlineQueryResultAudio%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultAudio) TypeID() uint32 { - return InlineQueryResultAudioTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultAudio) TypeName() string { - return "inlineQueryResultAudio" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultAudio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultAudio", - ID: InlineQueryResultAudioTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Audio", - SchemaName: "audio", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultAudio) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultAudio#3239d2f8 as nil") - } - b.PutID(InlineQueryResultAudioTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultAudio) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultAudio#3239d2f8 as nil") - } - b.PutString(i.ID) - if err := i.Audio.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultAudio#3239d2f8: field audio: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultAudio) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultAudio#3239d2f8 to nil") - } - if err := b.ConsumeID(InlineQueryResultAudioTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultAudio) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultAudio#3239d2f8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: field id: %w", err) - } - i.ID = value - } - { - if err := i.Audio.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: field audio: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultAudio) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultAudio#3239d2f8 as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultAudio") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("audio") - if err := i.Audio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultAudio#3239d2f8: field audio: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultAudio) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultAudio#3239d2f8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultAudio"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: field id: %w", err) - } - i.ID = value - case "audio": - if err := i.Audio.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultAudio#3239d2f8: field audio: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultAudio) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetAudio returns value of Audio field. -func (i *InlineQueryResultAudio) GetAudio() (value Audio) { - if i == nil { - return - } - return i.Audio -} - -// InlineQueryResultDocument represents TL type `inlineQueryResultDocument#a71d0c45`. -type InlineQueryResultDocument struct { - // Unique identifier of the query result - ID string - // Document - Document Document - // Document title - Title string - // Represents a document - Description string -} - -// InlineQueryResultDocumentTypeID is TL type id of InlineQueryResultDocument. -const InlineQueryResultDocumentTypeID = 0xa71d0c45 - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultDocument) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultDocument. -var ( - _ bin.Encoder = &InlineQueryResultDocument{} - _ bin.Decoder = &InlineQueryResultDocument{} - _ bin.BareEncoder = &InlineQueryResultDocument{} - _ bin.BareDecoder = &InlineQueryResultDocument{} - - _ InlineQueryResultClass = &InlineQueryResultDocument{} -) - -func (i *InlineQueryResultDocument) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Document.Zero()) { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Description == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultDocument) String() string { - if i == nil { - return "InlineQueryResultDocument(nil)" - } - type Alias InlineQueryResultDocument - return fmt.Sprintf("InlineQueryResultDocument%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultDocument) TypeID() uint32 { - return InlineQueryResultDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultDocument) TypeName() string { - return "inlineQueryResultDocument" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultDocument", - ID: InlineQueryResultDocumentTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Document", - SchemaName: "document", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultDocument) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultDocument#a71d0c45 as nil") - } - b.PutID(InlineQueryResultDocumentTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultDocument) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultDocument#a71d0c45 as nil") - } - b.PutString(i.ID) - if err := i.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultDocument#a71d0c45: field document: %w", err) - } - b.PutString(i.Title) - b.PutString(i.Description) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultDocument) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultDocument#a71d0c45 to nil") - } - if err := b.ConsumeID(InlineQueryResultDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultDocument) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultDocument#a71d0c45 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field id: %w", err) - } - i.ID = value - } - { - if err := i.Document.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field document: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field description: %w", err) - } - i.Description = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultDocument#a71d0c45 as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultDocument") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("document") - if err := i.Document.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultDocument#a71d0c45: field document: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("description") - b.PutString(i.Description) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultDocument#a71d0c45 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultDocument"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field id: %w", err) - } - i.ID = value - case "document": - if err := i.Document.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field document: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field title: %w", err) - } - i.Title = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultDocument#a71d0c45: field description: %w", err) - } - i.Description = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultDocument) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetDocument returns value of Document field. -func (i *InlineQueryResultDocument) GetDocument() (value Document) { - if i == nil { - return - } - return i.Document -} - -// GetTitle returns value of Title field. -func (i *InlineQueryResultDocument) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetDescription returns value of Description field. -func (i *InlineQueryResultDocument) GetDescription() (value string) { - if i == nil { - return - } - return i.Description -} - -// InlineQueryResultPhoto represents TL type `inlineQueryResultPhoto#6e2b1dd0`. -type InlineQueryResultPhoto struct { - // Unique identifier of the query result - ID string - // Photo - Photo Photo - // Title of the result, if known - Title string - // Represents a photo - Description string -} - -// InlineQueryResultPhotoTypeID is TL type id of InlineQueryResultPhoto. -const InlineQueryResultPhotoTypeID = 0x6e2b1dd0 - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultPhoto) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultPhoto. -var ( - _ bin.Encoder = &InlineQueryResultPhoto{} - _ bin.Decoder = &InlineQueryResultPhoto{} - _ bin.BareEncoder = &InlineQueryResultPhoto{} - _ bin.BareDecoder = &InlineQueryResultPhoto{} - - _ InlineQueryResultClass = &InlineQueryResultPhoto{} -) - -func (i *InlineQueryResultPhoto) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Photo.Zero()) { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Description == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultPhoto) String() string { - if i == nil { - return "InlineQueryResultPhoto(nil)" - } - type Alias InlineQueryResultPhoto - return fmt.Sprintf("InlineQueryResultPhoto%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultPhoto) TypeID() uint32 { - return InlineQueryResultPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultPhoto) TypeName() string { - return "inlineQueryResultPhoto" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultPhoto", - ID: InlineQueryResultPhotoTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultPhoto) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultPhoto#6e2b1dd0 as nil") - } - b.PutID(InlineQueryResultPhotoTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultPhoto) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultPhoto#6e2b1dd0 as nil") - } - b.PutString(i.ID) - if err := i.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultPhoto#6e2b1dd0: field photo: %w", err) - } - b.PutString(i.Title) - b.PutString(i.Description) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultPhoto) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultPhoto#6e2b1dd0 to nil") - } - if err := b.ConsumeID(InlineQueryResultPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultPhoto) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultPhoto#6e2b1dd0 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field id: %w", err) - } - i.ID = value - } - { - if err := i.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field photo: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field description: %w", err) - } - i.Description = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultPhoto#6e2b1dd0 as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultPhoto") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("photo") - if err := i.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultPhoto#6e2b1dd0: field photo: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("description") - b.PutString(i.Description) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultPhoto#6e2b1dd0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultPhoto"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field id: %w", err) - } - i.ID = value - case "photo": - if err := i.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field photo: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field title: %w", err) - } - i.Title = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultPhoto#6e2b1dd0: field description: %w", err) - } - i.Description = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultPhoto) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetPhoto returns value of Photo field. -func (i *InlineQueryResultPhoto) GetPhoto() (value Photo) { - if i == nil { - return - } - return i.Photo -} - -// GetTitle returns value of Title field. -func (i *InlineQueryResultPhoto) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetDescription returns value of Description field. -func (i *InlineQueryResultPhoto) GetDescription() (value string) { - if i == nil { - return - } - return i.Description -} - -// InlineQueryResultSticker represents TL type `inlineQueryResultSticker#91d6560b`. -type InlineQueryResultSticker struct { - // Unique identifier of the query result - ID string - // Sticker - Sticker Sticker -} - -// InlineQueryResultStickerTypeID is TL type id of InlineQueryResultSticker. -const InlineQueryResultStickerTypeID = 0x91d6560b - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultSticker) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultSticker. -var ( - _ bin.Encoder = &InlineQueryResultSticker{} - _ bin.Decoder = &InlineQueryResultSticker{} - _ bin.BareEncoder = &InlineQueryResultSticker{} - _ bin.BareDecoder = &InlineQueryResultSticker{} - - _ InlineQueryResultClass = &InlineQueryResultSticker{} -) - -func (i *InlineQueryResultSticker) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultSticker) String() string { - if i == nil { - return "InlineQueryResultSticker(nil)" - } - type Alias InlineQueryResultSticker - return fmt.Sprintf("InlineQueryResultSticker%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultSticker) TypeID() uint32 { - return InlineQueryResultStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultSticker) TypeName() string { - return "inlineQueryResultSticker" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultSticker", - ID: InlineQueryResultStickerTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultSticker) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultSticker#91d6560b as nil") - } - b.PutID(InlineQueryResultStickerTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultSticker) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultSticker#91d6560b as nil") - } - b.PutString(i.ID) - if err := i.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultSticker#91d6560b: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultSticker) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultSticker#91d6560b to nil") - } - if err := b.ConsumeID(InlineQueryResultStickerTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultSticker) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultSticker#91d6560b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: field id: %w", err) - } - i.ID = value - } - { - if err := i.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultSticker#91d6560b as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultSticker") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("sticker") - if err := i.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultSticker#91d6560b: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultSticker#91d6560b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultSticker"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: field id: %w", err) - } - i.ID = value - case "sticker": - if err := i.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultSticker#91d6560b: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultSticker) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetSticker returns value of Sticker field. -func (i *InlineQueryResultSticker) GetSticker() (value Sticker) { - if i == nil { - return - } - return i.Sticker -} - -// InlineQueryResultVideo represents TL type `inlineQueryResultVideo#ae2742e5`. -type InlineQueryResultVideo struct { - // Unique identifier of the query result - ID string - // Video - Video Video - // Title of the video - Title string - // Represents a video - Description string -} - -// InlineQueryResultVideoTypeID is TL type id of InlineQueryResultVideo. -const InlineQueryResultVideoTypeID = 0xae2742e5 - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultVideo) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultVideo. -var ( - _ bin.Encoder = &InlineQueryResultVideo{} - _ bin.Decoder = &InlineQueryResultVideo{} - _ bin.BareEncoder = &InlineQueryResultVideo{} - _ bin.BareDecoder = &InlineQueryResultVideo{} - - _ InlineQueryResultClass = &InlineQueryResultVideo{} -) - -func (i *InlineQueryResultVideo) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Video.Zero()) { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Description == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultVideo) String() string { - if i == nil { - return "InlineQueryResultVideo(nil)" - } - type Alias InlineQueryResultVideo - return fmt.Sprintf("InlineQueryResultVideo%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultVideo) TypeID() uint32 { - return InlineQueryResultVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultVideo) TypeName() string { - return "inlineQueryResultVideo" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultVideo", - ID: InlineQueryResultVideoTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Video", - SchemaName: "video", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultVideo) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultVideo#ae2742e5 as nil") - } - b.PutID(InlineQueryResultVideoTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultVideo) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultVideo#ae2742e5 as nil") - } - b.PutString(i.ID) - if err := i.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultVideo#ae2742e5: field video: %w", err) - } - b.PutString(i.Title) - b.PutString(i.Description) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultVideo) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultVideo#ae2742e5 to nil") - } - if err := b.ConsumeID(InlineQueryResultVideoTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultVideo) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultVideo#ae2742e5 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field id: %w", err) - } - i.ID = value - } - { - if err := i.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field video: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field description: %w", err) - } - i.Description = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultVideo#ae2742e5 as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultVideo") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("video") - if err := i.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultVideo#ae2742e5: field video: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("description") - b.PutString(i.Description) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultVideo#ae2742e5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultVideo"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field id: %w", err) - } - i.ID = value - case "video": - if err := i.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field video: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field title: %w", err) - } - i.Title = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVideo#ae2742e5: field description: %w", err) - } - i.Description = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultVideo) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetVideo returns value of Video field. -func (i *InlineQueryResultVideo) GetVideo() (value Video) { - if i == nil { - return - } - return i.Video -} - -// GetTitle returns value of Title field. -func (i *InlineQueryResultVideo) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetDescription returns value of Description field. -func (i *InlineQueryResultVideo) GetDescription() (value string) { - if i == nil { - return - } - return i.Description -} - -// InlineQueryResultVoiceNote represents TL type `inlineQueryResultVoiceNote#8ee8142f`. -type InlineQueryResultVoiceNote struct { - // Unique identifier of the query result - ID string - // Voice note - VoiceNote VoiceNote - // Title of the voice note - Title string -} - -// InlineQueryResultVoiceNoteTypeID is TL type id of InlineQueryResultVoiceNote. -const InlineQueryResultVoiceNoteTypeID = 0x8ee8142f - -// construct implements constructor of InlineQueryResultClass. -func (i InlineQueryResultVoiceNote) construct() InlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultVoiceNote. -var ( - _ bin.Encoder = &InlineQueryResultVoiceNote{} - _ bin.Decoder = &InlineQueryResultVoiceNote{} - _ bin.BareEncoder = &InlineQueryResultVoiceNote{} - _ bin.BareDecoder = &InlineQueryResultVoiceNote{} - - _ InlineQueryResultClass = &InlineQueryResultVoiceNote{} -) - -func (i *InlineQueryResultVoiceNote) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.VoiceNote.Zero()) { - return false - } - if !(i.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultVoiceNote) String() string { - if i == nil { - return "InlineQueryResultVoiceNote(nil)" - } - type Alias InlineQueryResultVoiceNote - return fmt.Sprintf("InlineQueryResultVoiceNote%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultVoiceNote) TypeID() uint32 { - return InlineQueryResultVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultVoiceNote) TypeName() string { - return "inlineQueryResultVoiceNote" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultVoiceNote", - ID: InlineQueryResultVoiceNoteTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "VoiceNote", - SchemaName: "voice_note", - }, - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultVoiceNote) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultVoiceNote#8ee8142f as nil") - } - b.PutID(InlineQueryResultVoiceNoteTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultVoiceNote) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultVoiceNote#8ee8142f as nil") - } - b.PutString(i.ID) - if err := i.VoiceNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultVoiceNote#8ee8142f: field voice_note: %w", err) - } - b.PutString(i.Title) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultVoiceNote) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultVoiceNote#8ee8142f to nil") - } - if err := b.ConsumeID(InlineQueryResultVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultVoiceNote) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultVoiceNote#8ee8142f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field id: %w", err) - } - i.ID = value - } - { - if err := i.VoiceNote.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field voice_note: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field title: %w", err) - } - i.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultVoiceNote#8ee8142f as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultVoiceNote") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("voice_note") - if err := i.VoiceNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultVoiceNote#8ee8142f: field voice_note: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultVoiceNote#8ee8142f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultVoiceNote"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field id: %w", err) - } - i.ID = value - case "voice_note": - if err := i.VoiceNote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field voice_note: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultVoiceNote#8ee8142f: field title: %w", err) - } - i.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InlineQueryResultVoiceNote) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetVoiceNote returns value of VoiceNote field. -func (i *InlineQueryResultVoiceNote) GetVoiceNote() (value VoiceNote) { - if i == nil { - return - } - return i.VoiceNote -} - -// GetTitle returns value of Title field. -func (i *InlineQueryResultVoiceNote) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// InlineQueryResultClassName is schema name of InlineQueryResultClass. -const InlineQueryResultClassName = "InlineQueryResult" - -// InlineQueryResultClass represents InlineQueryResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeInlineQueryResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InlineQueryResultArticle: // inlineQueryResultArticle#1016d01a -// case *tdapi.InlineQueryResultContact: // inlineQueryResultContact#f5278212 -// case *tdapi.InlineQueryResultLocation: // inlineQueryResultLocation#1bc6ab10 -// case *tdapi.InlineQueryResultVenue: // inlineQueryResultVenue#4c5b105e -// case *tdapi.InlineQueryResultGame: // inlineQueryResultGame#65bd7c7b -// case *tdapi.InlineQueryResultAnimation: // inlineQueryResultAnimation#77cded0b -// case *tdapi.InlineQueryResultAudio: // inlineQueryResultAudio#3239d2f8 -// case *tdapi.InlineQueryResultDocument: // inlineQueryResultDocument#a71d0c45 -// case *tdapi.InlineQueryResultPhoto: // inlineQueryResultPhoto#6e2b1dd0 -// case *tdapi.InlineQueryResultSticker: // inlineQueryResultSticker#91d6560b -// case *tdapi.InlineQueryResultVideo: // inlineQueryResultVideo#ae2742e5 -// case *tdapi.InlineQueryResultVoiceNote: // inlineQueryResultVoiceNote#8ee8142f -// default: panic(v) -// } -type InlineQueryResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InlineQueryResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error - - // Unique identifier of the query result - GetID() (value string) -} - -// DecodeInlineQueryResult implements binary de-serialization for InlineQueryResultClass. -func DecodeInlineQueryResult(buf *bin.Buffer) (InlineQueryResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InlineQueryResultArticleTypeID: - // Decoding inlineQueryResultArticle#1016d01a. - v := InlineQueryResultArticle{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case InlineQueryResultContactTypeID: - // Decoding inlineQueryResultContact#f5278212. - v := InlineQueryResultContact{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case InlineQueryResultLocationTypeID: - // Decoding inlineQueryResultLocation#1bc6ab10. - v := InlineQueryResultLocation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case InlineQueryResultVenueTypeID: - // Decoding inlineQueryResultVenue#4c5b105e. - v := InlineQueryResultVenue{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case InlineQueryResultGameTypeID: - // Decoding inlineQueryResultGame#65bd7c7b. - v := InlineQueryResultGame{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case InlineQueryResultAnimationTypeID: - // Decoding inlineQueryResultAnimation#77cded0b. - v := InlineQueryResultAnimation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case InlineQueryResultAudioTypeID: - // Decoding inlineQueryResultAudio#3239d2f8. - v := InlineQueryResultAudio{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case InlineQueryResultDocumentTypeID: - // Decoding inlineQueryResultDocument#a71d0c45. - v := InlineQueryResultDocument{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case InlineQueryResultPhotoTypeID: - // Decoding inlineQueryResultPhoto#6e2b1dd0. - v := InlineQueryResultPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case InlineQueryResultStickerTypeID: - // Decoding inlineQueryResultSticker#91d6560b. - v := InlineQueryResultSticker{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case InlineQueryResultVideoTypeID: - // Decoding inlineQueryResultVideo#ae2742e5. - v := InlineQueryResultVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case InlineQueryResultVoiceNoteTypeID: - // Decoding inlineQueryResultVoiceNote#8ee8142f. - v := InlineQueryResultVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInlineQueryResult implements binary de-serialization for InlineQueryResultClass. -func DecodeTDLibJSONInlineQueryResult(buf tdjson.Decoder) (InlineQueryResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inlineQueryResultArticle": - // Decoding inlineQueryResultArticle#1016d01a. - v := InlineQueryResultArticle{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case "inlineQueryResultContact": - // Decoding inlineQueryResultContact#f5278212. - v := InlineQueryResultContact{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case "inlineQueryResultLocation": - // Decoding inlineQueryResultLocation#1bc6ab10. - v := InlineQueryResultLocation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case "inlineQueryResultVenue": - // Decoding inlineQueryResultVenue#4c5b105e. - v := InlineQueryResultVenue{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case "inlineQueryResultGame": - // Decoding inlineQueryResultGame#65bd7c7b. - v := InlineQueryResultGame{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case "inlineQueryResultAnimation": - // Decoding inlineQueryResultAnimation#77cded0b. - v := InlineQueryResultAnimation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case "inlineQueryResultAudio": - // Decoding inlineQueryResultAudio#3239d2f8. - v := InlineQueryResultAudio{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case "inlineQueryResultDocument": - // Decoding inlineQueryResultDocument#a71d0c45. - v := InlineQueryResultDocument{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case "inlineQueryResultPhoto": - // Decoding inlineQueryResultPhoto#6e2b1dd0. - v := InlineQueryResultPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case "inlineQueryResultSticker": - // Decoding inlineQueryResultSticker#91d6560b. - v := InlineQueryResultSticker{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case "inlineQueryResultVideo": - // Decoding inlineQueryResultVideo#ae2742e5. - v := InlineQueryResultVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - case "inlineQueryResultVoiceNote": - // Decoding inlineQueryResultVoiceNote#8ee8142f. - v := InlineQueryResultVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InlineQueryResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InlineQueryResult boxes the InlineQueryResultClass providing a helper. -type InlineQueryResultBox struct { - InlineQueryResult InlineQueryResultClass -} - -// Decode implements bin.Decoder for InlineQueryResultBox. -func (b *InlineQueryResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InlineQueryResultBox to nil") - } - v, err := DecodeInlineQueryResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InlineQueryResult = v - return nil -} - -// Encode implements bin.Encode for InlineQueryResultBox. -func (b *InlineQueryResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InlineQueryResult == nil { - return fmt.Errorf("unable to encode InlineQueryResultClass as nil") - } - return b.InlineQueryResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InlineQueryResultBox. -func (b *InlineQueryResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InlineQueryResultBox to nil") - } - v, err := DecodeTDLibJSONInlineQueryResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InlineQueryResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InlineQueryResultBox. -func (b *InlineQueryResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InlineQueryResult == nil { - return fmt.Errorf("unable to encode InlineQueryResultClass as nil") - } - return b.InlineQueryResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_inline_query_results_button_gen.go b/tdapi/tl_inline_query_results_button_gen.go deleted file mode 100644 index e114c5283..000000000 --- a/tdapi/tl_inline_query_results_button_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InlineQueryResultsButton represents TL type `inlineQueryResultsButton#d0df08ae`. -type InlineQueryResultsButton struct { - // The text of the button - Text string - // Type of the button - Type InlineQueryResultsButtonTypeClass -} - -// InlineQueryResultsButtonTypeID is TL type id of InlineQueryResultsButton. -const InlineQueryResultsButtonTypeID = 0xd0df08ae - -// Ensuring interfaces in compile-time for InlineQueryResultsButton. -var ( - _ bin.Encoder = &InlineQueryResultsButton{} - _ bin.Decoder = &InlineQueryResultsButton{} - _ bin.BareEncoder = &InlineQueryResultsButton{} - _ bin.BareDecoder = &InlineQueryResultsButton{} -) - -func (i *InlineQueryResultsButton) Zero() bool { - if i == nil { - return true - } - if !(i.Text == "") { - return false - } - if !(i.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultsButton) String() string { - if i == nil { - return "InlineQueryResultsButton(nil)" - } - type Alias InlineQueryResultsButton - return fmt.Sprintf("InlineQueryResultsButton%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultsButton) TypeID() uint32 { - return InlineQueryResultsButtonTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultsButton) TypeName() string { - return "inlineQueryResultsButton" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultsButton) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultsButton", - ID: InlineQueryResultsButtonTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultsButton) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultsButton#d0df08ae as nil") - } - b.PutID(InlineQueryResultsButtonTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultsButton) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultsButton#d0df08ae as nil") - } - b.PutString(i.Text) - if i.Type == nil { - return fmt.Errorf("unable to encode inlineQueryResultsButton#d0df08ae: field type is nil") - } - if err := i.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultsButton#d0df08ae: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultsButton) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultsButton#d0df08ae to nil") - } - if err := b.ConsumeID(InlineQueryResultsButtonTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButton#d0df08ae: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultsButton) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultsButton#d0df08ae to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButton#d0df08ae: field text: %w", err) - } - i.Text = value - } - { - value, err := DecodeInlineQueryResultsButtonType(b) - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButton#d0df08ae: field type: %w", err) - } - i.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultsButton) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultsButton#d0df08ae as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultsButton") - b.Comma() - b.FieldStart("text") - b.PutString(i.Text) - b.Comma() - b.FieldStart("type") - if i.Type == nil { - return fmt.Errorf("unable to encode inlineQueryResultsButton#d0df08ae: field type is nil") - } - if err := i.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResultsButton#d0df08ae: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultsButton) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultsButton#d0df08ae to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultsButton"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButton#d0df08ae: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButton#d0df08ae: field text: %w", err) - } - i.Text = value - case "type": - value, err := DecodeTDLibJSONInlineQueryResultsButtonType(b) - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButton#d0df08ae: field type: %w", err) - } - i.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (i *InlineQueryResultsButton) GetText() (value string) { - if i == nil { - return - } - return i.Text -} - -// GetType returns value of Type field. -func (i *InlineQueryResultsButton) GetType() (value InlineQueryResultsButtonTypeClass) { - if i == nil { - return - } - return i.Type -} diff --git a/tdapi/tl_inline_query_results_button_type_gen.go b/tdapi/tl_inline_query_results_button_type_gen.go deleted file mode 100644 index d71bc33b8..000000000 --- a/tdapi/tl_inline_query_results_button_type_gen.go +++ /dev/null @@ -1,503 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InlineQueryResultsButtonTypeStartBot represents TL type `inlineQueryResultsButtonTypeStartBot#fe9af0d5`. -type InlineQueryResultsButtonTypeStartBot struct { - // The parameter for the bot start message - Parameter string -} - -// InlineQueryResultsButtonTypeStartBotTypeID is TL type id of InlineQueryResultsButtonTypeStartBot. -const InlineQueryResultsButtonTypeStartBotTypeID = 0xfe9af0d5 - -// construct implements constructor of InlineQueryResultsButtonTypeClass. -func (i InlineQueryResultsButtonTypeStartBot) construct() InlineQueryResultsButtonTypeClass { - return &i -} - -// Ensuring interfaces in compile-time for InlineQueryResultsButtonTypeStartBot. -var ( - _ bin.Encoder = &InlineQueryResultsButtonTypeStartBot{} - _ bin.Decoder = &InlineQueryResultsButtonTypeStartBot{} - _ bin.BareEncoder = &InlineQueryResultsButtonTypeStartBot{} - _ bin.BareDecoder = &InlineQueryResultsButtonTypeStartBot{} - - _ InlineQueryResultsButtonTypeClass = &InlineQueryResultsButtonTypeStartBot{} -) - -func (i *InlineQueryResultsButtonTypeStartBot) Zero() bool { - if i == nil { - return true - } - if !(i.Parameter == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultsButtonTypeStartBot) String() string { - if i == nil { - return "InlineQueryResultsButtonTypeStartBot(nil)" - } - type Alias InlineQueryResultsButtonTypeStartBot - return fmt.Sprintf("InlineQueryResultsButtonTypeStartBot%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultsButtonTypeStartBot) TypeID() uint32 { - return InlineQueryResultsButtonTypeStartBotTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultsButtonTypeStartBot) TypeName() string { - return "inlineQueryResultsButtonTypeStartBot" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultsButtonTypeStartBot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultsButtonTypeStartBot", - ID: InlineQueryResultsButtonTypeStartBotTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Parameter", - SchemaName: "parameter", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultsButtonTypeStartBot) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultsButtonTypeStartBot#fe9af0d5 as nil") - } - b.PutID(InlineQueryResultsButtonTypeStartBotTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultsButtonTypeStartBot) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultsButtonTypeStartBot#fe9af0d5 as nil") - } - b.PutString(i.Parameter) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultsButtonTypeStartBot) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultsButtonTypeStartBot#fe9af0d5 to nil") - } - if err := b.ConsumeID(InlineQueryResultsButtonTypeStartBotTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButtonTypeStartBot#fe9af0d5: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultsButtonTypeStartBot) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultsButtonTypeStartBot#fe9af0d5 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButtonTypeStartBot#fe9af0d5: field parameter: %w", err) - } - i.Parameter = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultsButtonTypeStartBot) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultsButtonTypeStartBot#fe9af0d5 as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultsButtonTypeStartBot") - b.Comma() - b.FieldStart("parameter") - b.PutString(i.Parameter) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultsButtonTypeStartBot) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultsButtonTypeStartBot#fe9af0d5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultsButtonTypeStartBot"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButtonTypeStartBot#fe9af0d5: %w", err) - } - case "parameter": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButtonTypeStartBot#fe9af0d5: field parameter: %w", err) - } - i.Parameter = value - default: - return b.Skip() - } - return nil - }) -} - -// GetParameter returns value of Parameter field. -func (i *InlineQueryResultsButtonTypeStartBot) GetParameter() (value string) { - if i == nil { - return - } - return i.Parameter -} - -// InlineQueryResultsButtonTypeWebApp represents TL type `inlineQueryResultsButtonTypeWebApp#b8a16362`. -type InlineQueryResultsButtonTypeWebApp struct { - // An HTTP URL to pass to getWebAppUrl - URL string -} - -// InlineQueryResultsButtonTypeWebAppTypeID is TL type id of InlineQueryResultsButtonTypeWebApp. -const InlineQueryResultsButtonTypeWebAppTypeID = 0xb8a16362 - -// construct implements constructor of InlineQueryResultsButtonTypeClass. -func (i InlineQueryResultsButtonTypeWebApp) construct() InlineQueryResultsButtonTypeClass { return &i } - -// Ensuring interfaces in compile-time for InlineQueryResultsButtonTypeWebApp. -var ( - _ bin.Encoder = &InlineQueryResultsButtonTypeWebApp{} - _ bin.Decoder = &InlineQueryResultsButtonTypeWebApp{} - _ bin.BareEncoder = &InlineQueryResultsButtonTypeWebApp{} - _ bin.BareDecoder = &InlineQueryResultsButtonTypeWebApp{} - - _ InlineQueryResultsButtonTypeClass = &InlineQueryResultsButtonTypeWebApp{} -) - -func (i *InlineQueryResultsButtonTypeWebApp) Zero() bool { - if i == nil { - return true - } - if !(i.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResultsButtonTypeWebApp) String() string { - if i == nil { - return "InlineQueryResultsButtonTypeWebApp(nil)" - } - type Alias InlineQueryResultsButtonTypeWebApp - return fmt.Sprintf("InlineQueryResultsButtonTypeWebApp%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResultsButtonTypeWebApp) TypeID() uint32 { - return InlineQueryResultsButtonTypeWebAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResultsButtonTypeWebApp) TypeName() string { - return "inlineQueryResultsButtonTypeWebApp" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResultsButtonTypeWebApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResultsButtonTypeWebApp", - ID: InlineQueryResultsButtonTypeWebAppTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResultsButtonTypeWebApp) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultsButtonTypeWebApp#b8a16362 as nil") - } - b.PutID(InlineQueryResultsButtonTypeWebAppTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResultsButtonTypeWebApp) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultsButtonTypeWebApp#b8a16362 as nil") - } - b.PutString(i.URL) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResultsButtonTypeWebApp) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultsButtonTypeWebApp#b8a16362 to nil") - } - if err := b.ConsumeID(InlineQueryResultsButtonTypeWebAppTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButtonTypeWebApp#b8a16362: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResultsButtonTypeWebApp) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultsButtonTypeWebApp#b8a16362 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButtonTypeWebApp#b8a16362: field url: %w", err) - } - i.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResultsButtonTypeWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResultsButtonTypeWebApp#b8a16362 as nil") - } - b.ObjStart() - b.PutID("inlineQueryResultsButtonTypeWebApp") - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResultsButtonTypeWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResultsButtonTypeWebApp#b8a16362 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResultsButtonTypeWebApp"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButtonTypeWebApp#b8a16362: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResultsButtonTypeWebApp#b8a16362: field url: %w", err) - } - i.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (i *InlineQueryResultsButtonTypeWebApp) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// InlineQueryResultsButtonTypeClassName is schema name of InlineQueryResultsButtonTypeClass. -const InlineQueryResultsButtonTypeClassName = "InlineQueryResultsButtonType" - -// InlineQueryResultsButtonTypeClass represents InlineQueryResultsButtonType generic type. -// -// Example: -// -// g, err := tdapi.DecodeInlineQueryResultsButtonType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InlineQueryResultsButtonTypeStartBot: // inlineQueryResultsButtonTypeStartBot#fe9af0d5 -// case *tdapi.InlineQueryResultsButtonTypeWebApp: // inlineQueryResultsButtonTypeWebApp#b8a16362 -// default: panic(v) -// } -type InlineQueryResultsButtonTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InlineQueryResultsButtonTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInlineQueryResultsButtonType implements binary de-serialization for InlineQueryResultsButtonTypeClass. -func DecodeInlineQueryResultsButtonType(buf *bin.Buffer) (InlineQueryResultsButtonTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InlineQueryResultsButtonTypeStartBotTypeID: - // Decoding inlineQueryResultsButtonTypeStartBot#fe9af0d5. - v := InlineQueryResultsButtonTypeStartBot{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultsButtonTypeClass: %w", err) - } - return &v, nil - case InlineQueryResultsButtonTypeWebAppTypeID: - // Decoding inlineQueryResultsButtonTypeWebApp#b8a16362. - v := InlineQueryResultsButtonTypeWebApp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultsButtonTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InlineQueryResultsButtonTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInlineQueryResultsButtonType implements binary de-serialization for InlineQueryResultsButtonTypeClass. -func DecodeTDLibJSONInlineQueryResultsButtonType(buf tdjson.Decoder) (InlineQueryResultsButtonTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inlineQueryResultsButtonTypeStartBot": - // Decoding inlineQueryResultsButtonTypeStartBot#fe9af0d5. - v := InlineQueryResultsButtonTypeStartBot{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultsButtonTypeClass: %w", err) - } - return &v, nil - case "inlineQueryResultsButtonTypeWebApp": - // Decoding inlineQueryResultsButtonTypeWebApp#b8a16362. - v := InlineQueryResultsButtonTypeWebApp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InlineQueryResultsButtonTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InlineQueryResultsButtonTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InlineQueryResultsButtonType boxes the InlineQueryResultsButtonTypeClass providing a helper. -type InlineQueryResultsButtonTypeBox struct { - InlineQueryResultsButtonType InlineQueryResultsButtonTypeClass -} - -// Decode implements bin.Decoder for InlineQueryResultsButtonTypeBox. -func (b *InlineQueryResultsButtonTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InlineQueryResultsButtonTypeBox to nil") - } - v, err := DecodeInlineQueryResultsButtonType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InlineQueryResultsButtonType = v - return nil -} - -// Encode implements bin.Encode for InlineQueryResultsButtonTypeBox. -func (b *InlineQueryResultsButtonTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InlineQueryResultsButtonType == nil { - return fmt.Errorf("unable to encode InlineQueryResultsButtonTypeClass as nil") - } - return b.InlineQueryResultsButtonType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InlineQueryResultsButtonTypeBox. -func (b *InlineQueryResultsButtonTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InlineQueryResultsButtonTypeBox to nil") - } - v, err := DecodeTDLibJSONInlineQueryResultsButtonType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InlineQueryResultsButtonType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InlineQueryResultsButtonTypeBox. -func (b *InlineQueryResultsButtonTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InlineQueryResultsButtonType == nil { - return fmt.Errorf("unable to encode InlineQueryResultsButtonTypeClass as nil") - } - return b.InlineQueryResultsButtonType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_inline_query_results_gen.go b/tdapi/tl_inline_query_results_gen.go deleted file mode 100644 index 7d3eee681..000000000 --- a/tdapi/tl_inline_query_results_gen.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InlineQueryResults represents TL type `inlineQueryResults#ffd17579`. -type InlineQueryResults struct { - // Unique identifier of the inline query - InlineQueryID int64 - // Button to be shown above inline query results; may be null - Button InlineQueryResultsButton - // Results of the query - Results []InlineQueryResultClass - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// InlineQueryResultsTypeID is TL type id of InlineQueryResults. -const InlineQueryResultsTypeID = 0xffd17579 - -// Ensuring interfaces in compile-time for InlineQueryResults. -var ( - _ bin.Encoder = &InlineQueryResults{} - _ bin.Decoder = &InlineQueryResults{} - _ bin.BareEncoder = &InlineQueryResults{} - _ bin.BareDecoder = &InlineQueryResults{} -) - -func (i *InlineQueryResults) Zero() bool { - if i == nil { - return true - } - if !(i.InlineQueryID == 0) { - return false - } - if !(i.Button.Zero()) { - return false - } - if !(i.Results == nil) { - return false - } - if !(i.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InlineQueryResults) String() string { - if i == nil { - return "InlineQueryResults(nil)" - } - type Alias InlineQueryResults - return fmt.Sprintf("InlineQueryResults%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InlineQueryResults) TypeID() uint32 { - return InlineQueryResultsTypeID -} - -// TypeName returns name of type in TL schema. -func (*InlineQueryResults) TypeName() string { - return "inlineQueryResults" -} - -// TypeInfo returns info about TL type. -func (i *InlineQueryResults) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inlineQueryResults", - ID: InlineQueryResultsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InlineQueryID", - SchemaName: "inline_query_id", - }, - { - Name: "Button", - SchemaName: "button", - }, - { - Name: "Results", - SchemaName: "results", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InlineQueryResults) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResults#ffd17579 as nil") - } - b.PutID(InlineQueryResultsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InlineQueryResults) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResults#ffd17579 as nil") - } - b.PutLong(i.InlineQueryID) - if err := i.Button.Encode(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResults#ffd17579: field button: %w", err) - } - b.PutInt(len(i.Results)) - for idx, v := range i.Results { - if v == nil { - return fmt.Errorf("unable to encode inlineQueryResults#ffd17579: field results element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare inlineQueryResults#ffd17579: field results element with index %d: %w", idx, err) - } - } - b.PutString(i.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (i *InlineQueryResults) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResults#ffd17579 to nil") - } - if err := b.ConsumeID(InlineQueryResultsTypeID); err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InlineQueryResults) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResults#ffd17579 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: field inline_query_id: %w", err) - } - i.InlineQueryID = value - } - { - if err := i.Button.Decode(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: field button: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: field results: %w", err) - } - - if headerLen > 0 { - i.Results = make([]InlineQueryResultClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeInlineQueryResult(b) - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: field results: %w", err) - } - i.Results = append(i.Results, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: field next_offset: %w", err) - } - i.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InlineQueryResults) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inlineQueryResults#ffd17579 as nil") - } - b.ObjStart() - b.PutID("inlineQueryResults") - b.Comma() - b.FieldStart("inline_query_id") - b.PutLong(i.InlineQueryID) - b.Comma() - b.FieldStart("button") - if err := i.Button.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResults#ffd17579: field button: %w", err) - } - b.Comma() - b.FieldStart("results") - b.ArrStart() - for idx, v := range i.Results { - if v == nil { - return fmt.Errorf("unable to encode inlineQueryResults#ffd17579: field results element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inlineQueryResults#ffd17579: field results element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(i.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InlineQueryResults) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inlineQueryResults#ffd17579 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inlineQueryResults"); err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: %w", err) - } - case "inline_query_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: field inline_query_id: %w", err) - } - i.InlineQueryID = value - case "button": - if err := i.Button.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: field button: %w", err) - } - case "results": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONInlineQueryResult(b) - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: field results: %w", err) - } - i.Results = append(i.Results, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: field results: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inlineQueryResults#ffd17579: field next_offset: %w", err) - } - i.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInlineQueryID returns value of InlineQueryID field. -func (i *InlineQueryResults) GetInlineQueryID() (value int64) { - if i == nil { - return - } - return i.InlineQueryID -} - -// GetButton returns value of Button field. -func (i *InlineQueryResults) GetButton() (value InlineQueryResultsButton) { - if i == nil { - return - } - return i.Button -} - -// GetResults returns value of Results field. -func (i *InlineQueryResults) GetResults() (value []InlineQueryResultClass) { - if i == nil { - return - } - return i.Results -} - -// GetNextOffset returns value of NextOffset field. -func (i *InlineQueryResults) GetNextOffset() (value string) { - if i == nil { - return - } - return i.NextOffset -} diff --git a/tdapi/tl_input_background_gen.go b/tdapi/tl_input_background_gen.go deleted file mode 100644 index 53868989f..000000000 --- a/tdapi/tl_input_background_gen.go +++ /dev/null @@ -1,693 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputBackgroundLocal represents TL type `inputBackgroundLocal#97dd74a4`. -type InputBackgroundLocal struct { - // Background file to use. Only inputFileLocal and inputFileGenerated are supported. The - // file must be in JPEG format for wallpapers and in PNG format for patterns - Background InputFileClass -} - -// InputBackgroundLocalTypeID is TL type id of InputBackgroundLocal. -const InputBackgroundLocalTypeID = 0x97dd74a4 - -// construct implements constructor of InputBackgroundClass. -func (i InputBackgroundLocal) construct() InputBackgroundClass { return &i } - -// Ensuring interfaces in compile-time for InputBackgroundLocal. -var ( - _ bin.Encoder = &InputBackgroundLocal{} - _ bin.Decoder = &InputBackgroundLocal{} - _ bin.BareEncoder = &InputBackgroundLocal{} - _ bin.BareDecoder = &InputBackgroundLocal{} - - _ InputBackgroundClass = &InputBackgroundLocal{} -) - -func (i *InputBackgroundLocal) Zero() bool { - if i == nil { - return true - } - if !(i.Background == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputBackgroundLocal) String() string { - if i == nil { - return "InputBackgroundLocal(nil)" - } - type Alias InputBackgroundLocal - return fmt.Sprintf("InputBackgroundLocal%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputBackgroundLocal) TypeID() uint32 { - return InputBackgroundLocalTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputBackgroundLocal) TypeName() string { - return "inputBackgroundLocal" -} - -// TypeInfo returns info about TL type. -func (i *InputBackgroundLocal) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputBackgroundLocal", - ID: InputBackgroundLocalTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Background", - SchemaName: "background", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputBackgroundLocal) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputBackgroundLocal#97dd74a4 as nil") - } - b.PutID(InputBackgroundLocalTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputBackgroundLocal) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputBackgroundLocal#97dd74a4 as nil") - } - if i.Background == nil { - return fmt.Errorf("unable to encode inputBackgroundLocal#97dd74a4: field background is nil") - } - if err := i.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputBackgroundLocal#97dd74a4: field background: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputBackgroundLocal) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputBackgroundLocal#97dd74a4 to nil") - } - if err := b.ConsumeID(InputBackgroundLocalTypeID); err != nil { - return fmt.Errorf("unable to decode inputBackgroundLocal#97dd74a4: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputBackgroundLocal) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputBackgroundLocal#97dd74a4 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputBackgroundLocal#97dd74a4: field background: %w", err) - } - i.Background = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputBackgroundLocal) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputBackgroundLocal#97dd74a4 as nil") - } - b.ObjStart() - b.PutID("inputBackgroundLocal") - b.Comma() - b.FieldStart("background") - if i.Background == nil { - return fmt.Errorf("unable to encode inputBackgroundLocal#97dd74a4: field background is nil") - } - if err := i.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputBackgroundLocal#97dd74a4: field background: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputBackgroundLocal) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputBackgroundLocal#97dd74a4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputBackgroundLocal"); err != nil { - return fmt.Errorf("unable to decode inputBackgroundLocal#97dd74a4: %w", err) - } - case "background": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputBackgroundLocal#97dd74a4: field background: %w", err) - } - i.Background = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBackground returns value of Background field. -func (i *InputBackgroundLocal) GetBackground() (value InputFileClass) { - if i == nil { - return - } - return i.Background -} - -// InputBackgroundRemote represents TL type `inputBackgroundRemote#ef9c3219`. -type InputBackgroundRemote struct { - // The background identifier - BackgroundID int64 -} - -// InputBackgroundRemoteTypeID is TL type id of InputBackgroundRemote. -const InputBackgroundRemoteTypeID = 0xef9c3219 - -// construct implements constructor of InputBackgroundClass. -func (i InputBackgroundRemote) construct() InputBackgroundClass { return &i } - -// Ensuring interfaces in compile-time for InputBackgroundRemote. -var ( - _ bin.Encoder = &InputBackgroundRemote{} - _ bin.Decoder = &InputBackgroundRemote{} - _ bin.BareEncoder = &InputBackgroundRemote{} - _ bin.BareDecoder = &InputBackgroundRemote{} - - _ InputBackgroundClass = &InputBackgroundRemote{} -) - -func (i *InputBackgroundRemote) Zero() bool { - if i == nil { - return true - } - if !(i.BackgroundID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputBackgroundRemote) String() string { - if i == nil { - return "InputBackgroundRemote(nil)" - } - type Alias InputBackgroundRemote - return fmt.Sprintf("InputBackgroundRemote%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputBackgroundRemote) TypeID() uint32 { - return InputBackgroundRemoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputBackgroundRemote) TypeName() string { - return "inputBackgroundRemote" -} - -// TypeInfo returns info about TL type. -func (i *InputBackgroundRemote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputBackgroundRemote", - ID: InputBackgroundRemoteTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BackgroundID", - SchemaName: "background_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputBackgroundRemote) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputBackgroundRemote#ef9c3219 as nil") - } - b.PutID(InputBackgroundRemoteTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputBackgroundRemote) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputBackgroundRemote#ef9c3219 as nil") - } - b.PutLong(i.BackgroundID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputBackgroundRemote) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputBackgroundRemote#ef9c3219 to nil") - } - if err := b.ConsumeID(InputBackgroundRemoteTypeID); err != nil { - return fmt.Errorf("unable to decode inputBackgroundRemote#ef9c3219: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputBackgroundRemote) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputBackgroundRemote#ef9c3219 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode inputBackgroundRemote#ef9c3219: field background_id: %w", err) - } - i.BackgroundID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputBackgroundRemote) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputBackgroundRemote#ef9c3219 as nil") - } - b.ObjStart() - b.PutID("inputBackgroundRemote") - b.Comma() - b.FieldStart("background_id") - b.PutLong(i.BackgroundID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputBackgroundRemote) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputBackgroundRemote#ef9c3219 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputBackgroundRemote"); err != nil { - return fmt.Errorf("unable to decode inputBackgroundRemote#ef9c3219: %w", err) - } - case "background_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode inputBackgroundRemote#ef9c3219: field background_id: %w", err) - } - i.BackgroundID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBackgroundID returns value of BackgroundID field. -func (i *InputBackgroundRemote) GetBackgroundID() (value int64) { - if i == nil { - return - } - return i.BackgroundID -} - -// InputBackgroundPrevious represents TL type `inputBackgroundPrevious#eb06575e`. -type InputBackgroundPrevious struct { - // Identifier of the message with the background - MessageID int64 -} - -// InputBackgroundPreviousTypeID is TL type id of InputBackgroundPrevious. -const InputBackgroundPreviousTypeID = 0xeb06575e - -// construct implements constructor of InputBackgroundClass. -func (i InputBackgroundPrevious) construct() InputBackgroundClass { return &i } - -// Ensuring interfaces in compile-time for InputBackgroundPrevious. -var ( - _ bin.Encoder = &InputBackgroundPrevious{} - _ bin.Decoder = &InputBackgroundPrevious{} - _ bin.BareEncoder = &InputBackgroundPrevious{} - _ bin.BareDecoder = &InputBackgroundPrevious{} - - _ InputBackgroundClass = &InputBackgroundPrevious{} -) - -func (i *InputBackgroundPrevious) Zero() bool { - if i == nil { - return true - } - if !(i.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputBackgroundPrevious) String() string { - if i == nil { - return "InputBackgroundPrevious(nil)" - } - type Alias InputBackgroundPrevious - return fmt.Sprintf("InputBackgroundPrevious%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputBackgroundPrevious) TypeID() uint32 { - return InputBackgroundPreviousTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputBackgroundPrevious) TypeName() string { - return "inputBackgroundPrevious" -} - -// TypeInfo returns info about TL type. -func (i *InputBackgroundPrevious) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputBackgroundPrevious", - ID: InputBackgroundPreviousTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputBackgroundPrevious) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputBackgroundPrevious#eb06575e as nil") - } - b.PutID(InputBackgroundPreviousTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputBackgroundPrevious) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputBackgroundPrevious#eb06575e as nil") - } - b.PutInt53(i.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputBackgroundPrevious) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputBackgroundPrevious#eb06575e to nil") - } - if err := b.ConsumeID(InputBackgroundPreviousTypeID); err != nil { - return fmt.Errorf("unable to decode inputBackgroundPrevious#eb06575e: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputBackgroundPrevious) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputBackgroundPrevious#eb06575e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputBackgroundPrevious#eb06575e: field message_id: %w", err) - } - i.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputBackgroundPrevious) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputBackgroundPrevious#eb06575e as nil") - } - b.ObjStart() - b.PutID("inputBackgroundPrevious") - b.Comma() - b.FieldStart("message_id") - b.PutInt53(i.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputBackgroundPrevious) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputBackgroundPrevious#eb06575e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputBackgroundPrevious"); err != nil { - return fmt.Errorf("unable to decode inputBackgroundPrevious#eb06575e: %w", err) - } - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputBackgroundPrevious#eb06575e: field message_id: %w", err) - } - i.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageID returns value of MessageID field. -func (i *InputBackgroundPrevious) GetMessageID() (value int64) { - if i == nil { - return - } - return i.MessageID -} - -// InputBackgroundClassName is schema name of InputBackgroundClass. -const InputBackgroundClassName = "InputBackground" - -// InputBackgroundClass represents InputBackground generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputBackground(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputBackgroundLocal: // inputBackgroundLocal#97dd74a4 -// case *tdapi.InputBackgroundRemote: // inputBackgroundRemote#ef9c3219 -// case *tdapi.InputBackgroundPrevious: // inputBackgroundPrevious#eb06575e -// default: panic(v) -// } -type InputBackgroundClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputBackgroundClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInputBackground implements binary de-serialization for InputBackgroundClass. -func DecodeInputBackground(buf *bin.Buffer) (InputBackgroundClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputBackgroundLocalTypeID: - // Decoding inputBackgroundLocal#97dd74a4. - v := InputBackgroundLocal{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputBackgroundClass: %w", err) - } - return &v, nil - case InputBackgroundRemoteTypeID: - // Decoding inputBackgroundRemote#ef9c3219. - v := InputBackgroundRemote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputBackgroundClass: %w", err) - } - return &v, nil - case InputBackgroundPreviousTypeID: - // Decoding inputBackgroundPrevious#eb06575e. - v := InputBackgroundPrevious{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputBackgroundClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputBackgroundClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputBackground implements binary de-serialization for InputBackgroundClass. -func DecodeTDLibJSONInputBackground(buf tdjson.Decoder) (InputBackgroundClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputBackgroundLocal": - // Decoding inputBackgroundLocal#97dd74a4. - v := InputBackgroundLocal{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputBackgroundClass: %w", err) - } - return &v, nil - case "inputBackgroundRemote": - // Decoding inputBackgroundRemote#ef9c3219. - v := InputBackgroundRemote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputBackgroundClass: %w", err) - } - return &v, nil - case "inputBackgroundPrevious": - // Decoding inputBackgroundPrevious#eb06575e. - v := InputBackgroundPrevious{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputBackgroundClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputBackgroundClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputBackground boxes the InputBackgroundClass providing a helper. -type InputBackgroundBox struct { - InputBackground InputBackgroundClass -} - -// Decode implements bin.Decoder for InputBackgroundBox. -func (b *InputBackgroundBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputBackgroundBox to nil") - } - v, err := DecodeInputBackground(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputBackground = v - return nil -} - -// Encode implements bin.Encode for InputBackgroundBox. -func (b *InputBackgroundBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputBackground == nil { - return fmt.Errorf("unable to encode InputBackgroundClass as nil") - } - return b.InputBackground.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputBackgroundBox. -func (b *InputBackgroundBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputBackgroundBox to nil") - } - v, err := DecodeTDLibJSONInputBackground(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputBackground = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputBackgroundBox. -func (b *InputBackgroundBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputBackground == nil { - return fmt.Errorf("unable to encode InputBackgroundClass as nil") - } - return b.InputBackground.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_business_chat_link_gen.go b/tdapi/tl_input_business_chat_link_gen.go deleted file mode 100644 index fd5e5758a..000000000 --- a/tdapi/tl_input_business_chat_link_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputBusinessChatLink represents TL type `inputBusinessChatLink#e2d6df8`. -type InputBusinessChatLink struct { - // Message draft text that will be added to the input field - Text FormattedText - // Link title - Title string -} - -// InputBusinessChatLinkTypeID is TL type id of InputBusinessChatLink. -const InputBusinessChatLinkTypeID = 0xe2d6df8 - -// Ensuring interfaces in compile-time for InputBusinessChatLink. -var ( - _ bin.Encoder = &InputBusinessChatLink{} - _ bin.Decoder = &InputBusinessChatLink{} - _ bin.BareEncoder = &InputBusinessChatLink{} - _ bin.BareDecoder = &InputBusinessChatLink{} -) - -func (i *InputBusinessChatLink) Zero() bool { - if i == nil { - return true - } - if !(i.Text.Zero()) { - return false - } - if !(i.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputBusinessChatLink) String() string { - if i == nil { - return "InputBusinessChatLink(nil)" - } - type Alias InputBusinessChatLink - return fmt.Sprintf("InputBusinessChatLink%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputBusinessChatLink) TypeID() uint32 { - return InputBusinessChatLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputBusinessChatLink) TypeName() string { - return "inputBusinessChatLink" -} - -// TypeInfo returns info about TL type. -func (i *InputBusinessChatLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputBusinessChatLink", - ID: InputBusinessChatLinkTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputBusinessChatLink) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputBusinessChatLink#e2d6df8 as nil") - } - b.PutID(InputBusinessChatLinkTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputBusinessChatLink) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputBusinessChatLink#e2d6df8 as nil") - } - if err := i.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputBusinessChatLink#e2d6df8: field text: %w", err) - } - b.PutString(i.Title) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputBusinessChatLink) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputBusinessChatLink#e2d6df8 to nil") - } - if err := b.ConsumeID(InputBusinessChatLinkTypeID); err != nil { - return fmt.Errorf("unable to decode inputBusinessChatLink#e2d6df8: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputBusinessChatLink) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputBusinessChatLink#e2d6df8 to nil") - } - { - if err := i.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputBusinessChatLink#e2d6df8: field text: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputBusinessChatLink#e2d6df8: field title: %w", err) - } - i.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputBusinessChatLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputBusinessChatLink#e2d6df8 as nil") - } - b.ObjStart() - b.PutID("inputBusinessChatLink") - b.Comma() - b.FieldStart("text") - if err := i.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputBusinessChatLink#e2d6df8: field text: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputBusinessChatLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputBusinessChatLink#e2d6df8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputBusinessChatLink"); err != nil { - return fmt.Errorf("unable to decode inputBusinessChatLink#e2d6df8: %w", err) - } - case "text": - if err := i.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputBusinessChatLink#e2d6df8: field text: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputBusinessChatLink#e2d6df8: field title: %w", err) - } - i.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (i *InputBusinessChatLink) GetText() (value FormattedText) { - if i == nil { - return - } - return i.Text -} - -// GetTitle returns value of Title field. -func (i *InputBusinessChatLink) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} diff --git a/tdapi/tl_input_business_start_page_gen.go b/tdapi/tl_input_business_start_page_gen.go deleted file mode 100644 index ddaac1fb3..000000000 --- a/tdapi/tl_input_business_start_page_gen.go +++ /dev/null @@ -1,274 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputBusinessStartPage represents TL type `inputBusinessStartPage#ec7c87e0`. -type InputBusinessStartPage struct { - // Title text of the start page; 0-getOption("business_start_page_title_length_max") - // characters - Title string - // Message text of the start page; 0-getOption("business_start_page_message_length_max") - // characters - Message string - // Greeting sticker of the start page; pass null if none. The sticker must belong to a - // sticker set and must not be a custom emoji - Sticker InputFileClass -} - -// InputBusinessStartPageTypeID is TL type id of InputBusinessStartPage. -const InputBusinessStartPageTypeID = 0xec7c87e0 - -// Ensuring interfaces in compile-time for InputBusinessStartPage. -var ( - _ bin.Encoder = &InputBusinessStartPage{} - _ bin.Decoder = &InputBusinessStartPage{} - _ bin.BareEncoder = &InputBusinessStartPage{} - _ bin.BareDecoder = &InputBusinessStartPage{} -) - -func (i *InputBusinessStartPage) Zero() bool { - if i == nil { - return true - } - if !(i.Title == "") { - return false - } - if !(i.Message == "") { - return false - } - if !(i.Sticker == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputBusinessStartPage) String() string { - if i == nil { - return "InputBusinessStartPage(nil)" - } - type Alias InputBusinessStartPage - return fmt.Sprintf("InputBusinessStartPage%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputBusinessStartPage) TypeID() uint32 { - return InputBusinessStartPageTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputBusinessStartPage) TypeName() string { - return "inputBusinessStartPage" -} - -// TypeInfo returns info about TL type. -func (i *InputBusinessStartPage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputBusinessStartPage", - ID: InputBusinessStartPageTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputBusinessStartPage) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputBusinessStartPage#ec7c87e0 as nil") - } - b.PutID(InputBusinessStartPageTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputBusinessStartPage) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputBusinessStartPage#ec7c87e0 as nil") - } - b.PutString(i.Title) - b.PutString(i.Message) - if i.Sticker == nil { - return fmt.Errorf("unable to encode inputBusinessStartPage#ec7c87e0: field sticker is nil") - } - if err := i.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputBusinessStartPage#ec7c87e0: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputBusinessStartPage) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputBusinessStartPage#ec7c87e0 to nil") - } - if err := b.ConsumeID(InputBusinessStartPageTypeID); err != nil { - return fmt.Errorf("unable to decode inputBusinessStartPage#ec7c87e0: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputBusinessStartPage) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputBusinessStartPage#ec7c87e0 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputBusinessStartPage#ec7c87e0: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputBusinessStartPage#ec7c87e0: field message: %w", err) - } - i.Message = value - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputBusinessStartPage#ec7c87e0: field sticker: %w", err) - } - i.Sticker = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputBusinessStartPage) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputBusinessStartPage#ec7c87e0 as nil") - } - b.ObjStart() - b.PutID("inputBusinessStartPage") - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("message") - b.PutString(i.Message) - b.Comma() - b.FieldStart("sticker") - if i.Sticker == nil { - return fmt.Errorf("unable to encode inputBusinessStartPage#ec7c87e0: field sticker is nil") - } - if err := i.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputBusinessStartPage#ec7c87e0: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputBusinessStartPage) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputBusinessStartPage#ec7c87e0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputBusinessStartPage"); err != nil { - return fmt.Errorf("unable to decode inputBusinessStartPage#ec7c87e0: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputBusinessStartPage#ec7c87e0: field title: %w", err) - } - i.Title = value - case "message": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputBusinessStartPage#ec7c87e0: field message: %w", err) - } - i.Message = value - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputBusinessStartPage#ec7c87e0: field sticker: %w", err) - } - i.Sticker = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (i *InputBusinessStartPage) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetMessage returns value of Message field. -func (i *InputBusinessStartPage) GetMessage() (value string) { - if i == nil { - return - } - return i.Message -} - -// GetSticker returns value of Sticker field. -func (i *InputBusinessStartPage) GetSticker() (value InputFileClass) { - if i == nil { - return - } - return i.Sticker -} diff --git a/tdapi/tl_input_chat_photo_gen.go b/tdapi/tl_input_chat_photo_gen.go deleted file mode 100644 index 222af0a8f..000000000 --- a/tdapi/tl_input_chat_photo_gen.go +++ /dev/null @@ -1,919 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputChatPhotoPrevious represents TL type `inputChatPhotoPrevious#160e9d1`. -type InputChatPhotoPrevious struct { - // Identifier of the current user's profile photo to reuse - ChatPhotoID int64 -} - -// InputChatPhotoPreviousTypeID is TL type id of InputChatPhotoPrevious. -const InputChatPhotoPreviousTypeID = 0x160e9d1 - -// construct implements constructor of InputChatPhotoClass. -func (i InputChatPhotoPrevious) construct() InputChatPhotoClass { return &i } - -// Ensuring interfaces in compile-time for InputChatPhotoPrevious. -var ( - _ bin.Encoder = &InputChatPhotoPrevious{} - _ bin.Decoder = &InputChatPhotoPrevious{} - _ bin.BareEncoder = &InputChatPhotoPrevious{} - _ bin.BareDecoder = &InputChatPhotoPrevious{} - - _ InputChatPhotoClass = &InputChatPhotoPrevious{} -) - -func (i *InputChatPhotoPrevious) Zero() bool { - if i == nil { - return true - } - if !(i.ChatPhotoID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputChatPhotoPrevious) String() string { - if i == nil { - return "InputChatPhotoPrevious(nil)" - } - type Alias InputChatPhotoPrevious - return fmt.Sprintf("InputChatPhotoPrevious%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputChatPhotoPrevious) TypeID() uint32 { - return InputChatPhotoPreviousTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputChatPhotoPrevious) TypeName() string { - return "inputChatPhotoPrevious" -} - -// TypeInfo returns info about TL type. -func (i *InputChatPhotoPrevious) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputChatPhotoPrevious", - ID: InputChatPhotoPreviousTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatPhotoID", - SchemaName: "chat_photo_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputChatPhotoPrevious) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoPrevious#160e9d1 as nil") - } - b.PutID(InputChatPhotoPreviousTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputChatPhotoPrevious) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoPrevious#160e9d1 as nil") - } - b.PutLong(i.ChatPhotoID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputChatPhotoPrevious) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoPrevious#160e9d1 to nil") - } - if err := b.ConsumeID(InputChatPhotoPreviousTypeID); err != nil { - return fmt.Errorf("unable to decode inputChatPhotoPrevious#160e9d1: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputChatPhotoPrevious) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoPrevious#160e9d1 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode inputChatPhotoPrevious#160e9d1: field chat_photo_id: %w", err) - } - i.ChatPhotoID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputChatPhotoPrevious) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoPrevious#160e9d1 as nil") - } - b.ObjStart() - b.PutID("inputChatPhotoPrevious") - b.Comma() - b.FieldStart("chat_photo_id") - b.PutLong(i.ChatPhotoID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputChatPhotoPrevious) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoPrevious#160e9d1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputChatPhotoPrevious"); err != nil { - return fmt.Errorf("unable to decode inputChatPhotoPrevious#160e9d1: %w", err) - } - case "chat_photo_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode inputChatPhotoPrevious#160e9d1: field chat_photo_id: %w", err) - } - i.ChatPhotoID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatPhotoID returns value of ChatPhotoID field. -func (i *InputChatPhotoPrevious) GetChatPhotoID() (value int64) { - if i == nil { - return - } - return i.ChatPhotoID -} - -// InputChatPhotoStatic represents TL type `inputChatPhotoStatic#75f7e2b3`. -type InputChatPhotoStatic struct { - // Photo to be set as profile photo. Only inputFileLocal and inputFileGenerated are - // allowed - Photo InputFileClass -} - -// InputChatPhotoStaticTypeID is TL type id of InputChatPhotoStatic. -const InputChatPhotoStaticTypeID = 0x75f7e2b3 - -// construct implements constructor of InputChatPhotoClass. -func (i InputChatPhotoStatic) construct() InputChatPhotoClass { return &i } - -// Ensuring interfaces in compile-time for InputChatPhotoStatic. -var ( - _ bin.Encoder = &InputChatPhotoStatic{} - _ bin.Decoder = &InputChatPhotoStatic{} - _ bin.BareEncoder = &InputChatPhotoStatic{} - _ bin.BareDecoder = &InputChatPhotoStatic{} - - _ InputChatPhotoClass = &InputChatPhotoStatic{} -) - -func (i *InputChatPhotoStatic) Zero() bool { - if i == nil { - return true - } - if !(i.Photo == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputChatPhotoStatic) String() string { - if i == nil { - return "InputChatPhotoStatic(nil)" - } - type Alias InputChatPhotoStatic - return fmt.Sprintf("InputChatPhotoStatic%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputChatPhotoStatic) TypeID() uint32 { - return InputChatPhotoStaticTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputChatPhotoStatic) TypeName() string { - return "inputChatPhotoStatic" -} - -// TypeInfo returns info about TL type. -func (i *InputChatPhotoStatic) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputChatPhotoStatic", - ID: InputChatPhotoStaticTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputChatPhotoStatic) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoStatic#75f7e2b3 as nil") - } - b.PutID(InputChatPhotoStaticTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputChatPhotoStatic) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoStatic#75f7e2b3 as nil") - } - if i.Photo == nil { - return fmt.Errorf("unable to encode inputChatPhotoStatic#75f7e2b3: field photo is nil") - } - if err := i.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputChatPhotoStatic#75f7e2b3: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputChatPhotoStatic) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoStatic#75f7e2b3 to nil") - } - if err := b.ConsumeID(InputChatPhotoStaticTypeID); err != nil { - return fmt.Errorf("unable to decode inputChatPhotoStatic#75f7e2b3: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputChatPhotoStatic) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoStatic#75f7e2b3 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputChatPhotoStatic#75f7e2b3: field photo: %w", err) - } - i.Photo = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputChatPhotoStatic) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoStatic#75f7e2b3 as nil") - } - b.ObjStart() - b.PutID("inputChatPhotoStatic") - b.Comma() - b.FieldStart("photo") - if i.Photo == nil { - return fmt.Errorf("unable to encode inputChatPhotoStatic#75f7e2b3: field photo is nil") - } - if err := i.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputChatPhotoStatic#75f7e2b3: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputChatPhotoStatic) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoStatic#75f7e2b3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputChatPhotoStatic"); err != nil { - return fmt.Errorf("unable to decode inputChatPhotoStatic#75f7e2b3: %w", err) - } - case "photo": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputChatPhotoStatic#75f7e2b3: field photo: %w", err) - } - i.Photo = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (i *InputChatPhotoStatic) GetPhoto() (value InputFileClass) { - if i == nil { - return - } - return i.Photo -} - -// InputChatPhotoAnimation represents TL type `inputChatPhotoAnimation#56a3422`. -type InputChatPhotoAnimation struct { - // Animation to be set as profile photo. Only inputFileLocal and inputFileGenerated are - // allowed - Animation InputFileClass - // Timestamp of the frame, which will be used as static chat photo - MainFrameTimestamp float64 -} - -// InputChatPhotoAnimationTypeID is TL type id of InputChatPhotoAnimation. -const InputChatPhotoAnimationTypeID = 0x56a3422 - -// construct implements constructor of InputChatPhotoClass. -func (i InputChatPhotoAnimation) construct() InputChatPhotoClass { return &i } - -// Ensuring interfaces in compile-time for InputChatPhotoAnimation. -var ( - _ bin.Encoder = &InputChatPhotoAnimation{} - _ bin.Decoder = &InputChatPhotoAnimation{} - _ bin.BareEncoder = &InputChatPhotoAnimation{} - _ bin.BareDecoder = &InputChatPhotoAnimation{} - - _ InputChatPhotoClass = &InputChatPhotoAnimation{} -) - -func (i *InputChatPhotoAnimation) Zero() bool { - if i == nil { - return true - } - if !(i.Animation == nil) { - return false - } - if !(i.MainFrameTimestamp == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputChatPhotoAnimation) String() string { - if i == nil { - return "InputChatPhotoAnimation(nil)" - } - type Alias InputChatPhotoAnimation - return fmt.Sprintf("InputChatPhotoAnimation%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputChatPhotoAnimation) TypeID() uint32 { - return InputChatPhotoAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputChatPhotoAnimation) TypeName() string { - return "inputChatPhotoAnimation" -} - -// TypeInfo returns info about TL type. -func (i *InputChatPhotoAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputChatPhotoAnimation", - ID: InputChatPhotoAnimationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Animation", - SchemaName: "animation", - }, - { - Name: "MainFrameTimestamp", - SchemaName: "main_frame_timestamp", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputChatPhotoAnimation) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoAnimation#56a3422 as nil") - } - b.PutID(InputChatPhotoAnimationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputChatPhotoAnimation) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoAnimation#56a3422 as nil") - } - if i.Animation == nil { - return fmt.Errorf("unable to encode inputChatPhotoAnimation#56a3422: field animation is nil") - } - if err := i.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputChatPhotoAnimation#56a3422: field animation: %w", err) - } - b.PutDouble(i.MainFrameTimestamp) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputChatPhotoAnimation) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoAnimation#56a3422 to nil") - } - if err := b.ConsumeID(InputChatPhotoAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode inputChatPhotoAnimation#56a3422: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputChatPhotoAnimation) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoAnimation#56a3422 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputChatPhotoAnimation#56a3422: field animation: %w", err) - } - i.Animation = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode inputChatPhotoAnimation#56a3422: field main_frame_timestamp: %w", err) - } - i.MainFrameTimestamp = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputChatPhotoAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoAnimation#56a3422 as nil") - } - b.ObjStart() - b.PutID("inputChatPhotoAnimation") - b.Comma() - b.FieldStart("animation") - if i.Animation == nil { - return fmt.Errorf("unable to encode inputChatPhotoAnimation#56a3422: field animation is nil") - } - if err := i.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputChatPhotoAnimation#56a3422: field animation: %w", err) - } - b.Comma() - b.FieldStart("main_frame_timestamp") - b.PutDouble(i.MainFrameTimestamp) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputChatPhotoAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoAnimation#56a3422 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputChatPhotoAnimation"); err != nil { - return fmt.Errorf("unable to decode inputChatPhotoAnimation#56a3422: %w", err) - } - case "animation": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputChatPhotoAnimation#56a3422: field animation: %w", err) - } - i.Animation = value - case "main_frame_timestamp": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode inputChatPhotoAnimation#56a3422: field main_frame_timestamp: %w", err) - } - i.MainFrameTimestamp = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAnimation returns value of Animation field. -func (i *InputChatPhotoAnimation) GetAnimation() (value InputFileClass) { - if i == nil { - return - } - return i.Animation -} - -// GetMainFrameTimestamp returns value of MainFrameTimestamp field. -func (i *InputChatPhotoAnimation) GetMainFrameTimestamp() (value float64) { - if i == nil { - return - } - return i.MainFrameTimestamp -} - -// InputChatPhotoSticker represents TL type `inputChatPhotoSticker#4e6e735d`. -type InputChatPhotoSticker struct { - // Information about the sticker - Sticker ChatPhotoSticker -} - -// InputChatPhotoStickerTypeID is TL type id of InputChatPhotoSticker. -const InputChatPhotoStickerTypeID = 0x4e6e735d - -// construct implements constructor of InputChatPhotoClass. -func (i InputChatPhotoSticker) construct() InputChatPhotoClass { return &i } - -// Ensuring interfaces in compile-time for InputChatPhotoSticker. -var ( - _ bin.Encoder = &InputChatPhotoSticker{} - _ bin.Decoder = &InputChatPhotoSticker{} - _ bin.BareEncoder = &InputChatPhotoSticker{} - _ bin.BareDecoder = &InputChatPhotoSticker{} - - _ InputChatPhotoClass = &InputChatPhotoSticker{} -) - -func (i *InputChatPhotoSticker) Zero() bool { - if i == nil { - return true - } - if !(i.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputChatPhotoSticker) String() string { - if i == nil { - return "InputChatPhotoSticker(nil)" - } - type Alias InputChatPhotoSticker - return fmt.Sprintf("InputChatPhotoSticker%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputChatPhotoSticker) TypeID() uint32 { - return InputChatPhotoStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputChatPhotoSticker) TypeName() string { - return "inputChatPhotoSticker" -} - -// TypeInfo returns info about TL type. -func (i *InputChatPhotoSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputChatPhotoSticker", - ID: InputChatPhotoStickerTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputChatPhotoSticker) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoSticker#4e6e735d as nil") - } - b.PutID(InputChatPhotoStickerTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputChatPhotoSticker) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoSticker#4e6e735d as nil") - } - if err := i.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputChatPhotoSticker#4e6e735d: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputChatPhotoSticker) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoSticker#4e6e735d to nil") - } - if err := b.ConsumeID(InputChatPhotoStickerTypeID); err != nil { - return fmt.Errorf("unable to decode inputChatPhotoSticker#4e6e735d: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputChatPhotoSticker) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoSticker#4e6e735d to nil") - } - { - if err := i.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputChatPhotoSticker#4e6e735d: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputChatPhotoSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputChatPhotoSticker#4e6e735d as nil") - } - b.ObjStart() - b.PutID("inputChatPhotoSticker") - b.Comma() - b.FieldStart("sticker") - if err := i.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputChatPhotoSticker#4e6e735d: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputChatPhotoSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputChatPhotoSticker#4e6e735d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputChatPhotoSticker"); err != nil { - return fmt.Errorf("unable to decode inputChatPhotoSticker#4e6e735d: %w", err) - } - case "sticker": - if err := i.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputChatPhotoSticker#4e6e735d: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (i *InputChatPhotoSticker) GetSticker() (value ChatPhotoSticker) { - if i == nil { - return - } - return i.Sticker -} - -// InputChatPhotoClassName is schema name of InputChatPhotoClass. -const InputChatPhotoClassName = "InputChatPhoto" - -// InputChatPhotoClass represents InputChatPhoto generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputChatPhoto(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputChatPhotoPrevious: // inputChatPhotoPrevious#160e9d1 -// case *tdapi.InputChatPhotoStatic: // inputChatPhotoStatic#75f7e2b3 -// case *tdapi.InputChatPhotoAnimation: // inputChatPhotoAnimation#56a3422 -// case *tdapi.InputChatPhotoSticker: // inputChatPhotoSticker#4e6e735d -// default: panic(v) -// } -type InputChatPhotoClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputChatPhotoClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInputChatPhoto implements binary de-serialization for InputChatPhotoClass. -func DecodeInputChatPhoto(buf *bin.Buffer) (InputChatPhotoClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputChatPhotoPreviousTypeID: - // Decoding inputChatPhotoPrevious#160e9d1. - v := InputChatPhotoPrevious{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputChatPhotoClass: %w", err) - } - return &v, nil - case InputChatPhotoStaticTypeID: - // Decoding inputChatPhotoStatic#75f7e2b3. - v := InputChatPhotoStatic{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputChatPhotoClass: %w", err) - } - return &v, nil - case InputChatPhotoAnimationTypeID: - // Decoding inputChatPhotoAnimation#56a3422. - v := InputChatPhotoAnimation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputChatPhotoClass: %w", err) - } - return &v, nil - case InputChatPhotoStickerTypeID: - // Decoding inputChatPhotoSticker#4e6e735d. - v := InputChatPhotoSticker{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputChatPhotoClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputChatPhotoClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputChatPhoto implements binary de-serialization for InputChatPhotoClass. -func DecodeTDLibJSONInputChatPhoto(buf tdjson.Decoder) (InputChatPhotoClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputChatPhotoPrevious": - // Decoding inputChatPhotoPrevious#160e9d1. - v := InputChatPhotoPrevious{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputChatPhotoClass: %w", err) - } - return &v, nil - case "inputChatPhotoStatic": - // Decoding inputChatPhotoStatic#75f7e2b3. - v := InputChatPhotoStatic{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputChatPhotoClass: %w", err) - } - return &v, nil - case "inputChatPhotoAnimation": - // Decoding inputChatPhotoAnimation#56a3422. - v := InputChatPhotoAnimation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputChatPhotoClass: %w", err) - } - return &v, nil - case "inputChatPhotoSticker": - // Decoding inputChatPhotoSticker#4e6e735d. - v := InputChatPhotoSticker{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputChatPhotoClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputChatPhotoClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputChatPhoto boxes the InputChatPhotoClass providing a helper. -type InputChatPhotoBox struct { - InputChatPhoto InputChatPhotoClass -} - -// Decode implements bin.Decoder for InputChatPhotoBox. -func (b *InputChatPhotoBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputChatPhotoBox to nil") - } - v, err := DecodeInputChatPhoto(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputChatPhoto = v - return nil -} - -// Encode implements bin.Encode for InputChatPhotoBox. -func (b *InputChatPhotoBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputChatPhoto == nil { - return fmt.Errorf("unable to encode InputChatPhotoClass as nil") - } - return b.InputChatPhoto.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputChatPhotoBox. -func (b *InputChatPhotoBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputChatPhotoBox to nil") - } - v, err := DecodeTDLibJSONInputChatPhoto(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputChatPhoto = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputChatPhotoBox. -func (b *InputChatPhotoBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputChatPhoto == nil { - return fmt.Errorf("unable to encode InputChatPhotoClass as nil") - } - return b.InputChatPhoto.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_credentials_gen.go b/tdapi/tl_input_credentials_gen.go deleted file mode 100644 index adf0f4388..000000000 --- a/tdapi/tl_input_credentials_gen.go +++ /dev/null @@ -1,897 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputCredentialsSaved represents TL type `inputCredentialsSaved#86bdbe2c`. -type InputCredentialsSaved struct { - // Identifier of the saved credentials - SavedCredentialsID string -} - -// InputCredentialsSavedTypeID is TL type id of InputCredentialsSaved. -const InputCredentialsSavedTypeID = 0x86bdbe2c - -// construct implements constructor of InputCredentialsClass. -func (i InputCredentialsSaved) construct() InputCredentialsClass { return &i } - -// Ensuring interfaces in compile-time for InputCredentialsSaved. -var ( - _ bin.Encoder = &InputCredentialsSaved{} - _ bin.Decoder = &InputCredentialsSaved{} - _ bin.BareEncoder = &InputCredentialsSaved{} - _ bin.BareDecoder = &InputCredentialsSaved{} - - _ InputCredentialsClass = &InputCredentialsSaved{} -) - -func (i *InputCredentialsSaved) Zero() bool { - if i == nil { - return true - } - if !(i.SavedCredentialsID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputCredentialsSaved) String() string { - if i == nil { - return "InputCredentialsSaved(nil)" - } - type Alias InputCredentialsSaved - return fmt.Sprintf("InputCredentialsSaved%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputCredentialsSaved) TypeID() uint32 { - return InputCredentialsSavedTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputCredentialsSaved) TypeName() string { - return "inputCredentialsSaved" -} - -// TypeInfo returns info about TL type. -func (i *InputCredentialsSaved) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputCredentialsSaved", - ID: InputCredentialsSavedTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SavedCredentialsID", - SchemaName: "saved_credentials_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputCredentialsSaved) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsSaved#86bdbe2c as nil") - } - b.PutID(InputCredentialsSavedTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputCredentialsSaved) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsSaved#86bdbe2c as nil") - } - b.PutString(i.SavedCredentialsID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputCredentialsSaved) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsSaved#86bdbe2c to nil") - } - if err := b.ConsumeID(InputCredentialsSavedTypeID); err != nil { - return fmt.Errorf("unable to decode inputCredentialsSaved#86bdbe2c: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputCredentialsSaved) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsSaved#86bdbe2c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputCredentialsSaved#86bdbe2c: field saved_credentials_id: %w", err) - } - i.SavedCredentialsID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputCredentialsSaved) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsSaved#86bdbe2c as nil") - } - b.ObjStart() - b.PutID("inputCredentialsSaved") - b.Comma() - b.FieldStart("saved_credentials_id") - b.PutString(i.SavedCredentialsID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputCredentialsSaved) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsSaved#86bdbe2c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputCredentialsSaved"); err != nil { - return fmt.Errorf("unable to decode inputCredentialsSaved#86bdbe2c: %w", err) - } - case "saved_credentials_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputCredentialsSaved#86bdbe2c: field saved_credentials_id: %w", err) - } - i.SavedCredentialsID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedCredentialsID returns value of SavedCredentialsID field. -func (i *InputCredentialsSaved) GetSavedCredentialsID() (value string) { - if i == nil { - return - } - return i.SavedCredentialsID -} - -// InputCredentialsNew represents TL type `inputCredentialsNew#ce8bf12a`. -type InputCredentialsNew struct { - // JSON-encoded data with the credential identifier from the payment provider - Data string - // True, if the credential identifier can be saved on the server side - AllowSave bool -} - -// InputCredentialsNewTypeID is TL type id of InputCredentialsNew. -const InputCredentialsNewTypeID = 0xce8bf12a - -// construct implements constructor of InputCredentialsClass. -func (i InputCredentialsNew) construct() InputCredentialsClass { return &i } - -// Ensuring interfaces in compile-time for InputCredentialsNew. -var ( - _ bin.Encoder = &InputCredentialsNew{} - _ bin.Decoder = &InputCredentialsNew{} - _ bin.BareEncoder = &InputCredentialsNew{} - _ bin.BareDecoder = &InputCredentialsNew{} - - _ InputCredentialsClass = &InputCredentialsNew{} -) - -func (i *InputCredentialsNew) Zero() bool { - if i == nil { - return true - } - if !(i.Data == "") { - return false - } - if !(i.AllowSave == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputCredentialsNew) String() string { - if i == nil { - return "InputCredentialsNew(nil)" - } - type Alias InputCredentialsNew - return fmt.Sprintf("InputCredentialsNew%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputCredentialsNew) TypeID() uint32 { - return InputCredentialsNewTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputCredentialsNew) TypeName() string { - return "inputCredentialsNew" -} - -// TypeInfo returns info about TL type. -func (i *InputCredentialsNew) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputCredentialsNew", - ID: InputCredentialsNewTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Data", - SchemaName: "data", - }, - { - Name: "AllowSave", - SchemaName: "allow_save", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputCredentialsNew) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsNew#ce8bf12a as nil") - } - b.PutID(InputCredentialsNewTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputCredentialsNew) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsNew#ce8bf12a as nil") - } - b.PutString(i.Data) - b.PutBool(i.AllowSave) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputCredentialsNew) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsNew#ce8bf12a to nil") - } - if err := b.ConsumeID(InputCredentialsNewTypeID); err != nil { - return fmt.Errorf("unable to decode inputCredentialsNew#ce8bf12a: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputCredentialsNew) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsNew#ce8bf12a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputCredentialsNew#ce8bf12a: field data: %w", err) - } - i.Data = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputCredentialsNew#ce8bf12a: field allow_save: %w", err) - } - i.AllowSave = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputCredentialsNew) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsNew#ce8bf12a as nil") - } - b.ObjStart() - b.PutID("inputCredentialsNew") - b.Comma() - b.FieldStart("data") - b.PutString(i.Data) - b.Comma() - b.FieldStart("allow_save") - b.PutBool(i.AllowSave) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputCredentialsNew) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsNew#ce8bf12a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputCredentialsNew"); err != nil { - return fmt.Errorf("unable to decode inputCredentialsNew#ce8bf12a: %w", err) - } - case "data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputCredentialsNew#ce8bf12a: field data: %w", err) - } - i.Data = value - case "allow_save": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputCredentialsNew#ce8bf12a: field allow_save: %w", err) - } - i.AllowSave = value - default: - return b.Skip() - } - return nil - }) -} - -// GetData returns value of Data field. -func (i *InputCredentialsNew) GetData() (value string) { - if i == nil { - return - } - return i.Data -} - -// GetAllowSave returns value of AllowSave field. -func (i *InputCredentialsNew) GetAllowSave() (value bool) { - if i == nil { - return - } - return i.AllowSave -} - -// InputCredentialsApplePay represents TL type `inputCredentialsApplePay#b5b2d6d1`. -type InputCredentialsApplePay struct { - // JSON-encoded data with the credential identifier - Data string -} - -// InputCredentialsApplePayTypeID is TL type id of InputCredentialsApplePay. -const InputCredentialsApplePayTypeID = 0xb5b2d6d1 - -// construct implements constructor of InputCredentialsClass. -func (i InputCredentialsApplePay) construct() InputCredentialsClass { return &i } - -// Ensuring interfaces in compile-time for InputCredentialsApplePay. -var ( - _ bin.Encoder = &InputCredentialsApplePay{} - _ bin.Decoder = &InputCredentialsApplePay{} - _ bin.BareEncoder = &InputCredentialsApplePay{} - _ bin.BareDecoder = &InputCredentialsApplePay{} - - _ InputCredentialsClass = &InputCredentialsApplePay{} -) - -func (i *InputCredentialsApplePay) Zero() bool { - if i == nil { - return true - } - if !(i.Data == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputCredentialsApplePay) String() string { - if i == nil { - return "InputCredentialsApplePay(nil)" - } - type Alias InputCredentialsApplePay - return fmt.Sprintf("InputCredentialsApplePay%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputCredentialsApplePay) TypeID() uint32 { - return InputCredentialsApplePayTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputCredentialsApplePay) TypeName() string { - return "inputCredentialsApplePay" -} - -// TypeInfo returns info about TL type. -func (i *InputCredentialsApplePay) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputCredentialsApplePay", - ID: InputCredentialsApplePayTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputCredentialsApplePay) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsApplePay#b5b2d6d1 as nil") - } - b.PutID(InputCredentialsApplePayTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputCredentialsApplePay) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsApplePay#b5b2d6d1 as nil") - } - b.PutString(i.Data) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputCredentialsApplePay) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsApplePay#b5b2d6d1 to nil") - } - if err := b.ConsumeID(InputCredentialsApplePayTypeID); err != nil { - return fmt.Errorf("unable to decode inputCredentialsApplePay#b5b2d6d1: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputCredentialsApplePay) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsApplePay#b5b2d6d1 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputCredentialsApplePay#b5b2d6d1: field data: %w", err) - } - i.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputCredentialsApplePay) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsApplePay#b5b2d6d1 as nil") - } - b.ObjStart() - b.PutID("inputCredentialsApplePay") - b.Comma() - b.FieldStart("data") - b.PutString(i.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputCredentialsApplePay) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsApplePay#b5b2d6d1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputCredentialsApplePay"); err != nil { - return fmt.Errorf("unable to decode inputCredentialsApplePay#b5b2d6d1: %w", err) - } - case "data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputCredentialsApplePay#b5b2d6d1: field data: %w", err) - } - i.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetData returns value of Data field. -func (i *InputCredentialsApplePay) GetData() (value string) { - if i == nil { - return - } - return i.Data -} - -// InputCredentialsGooglePay represents TL type `inputCredentialsGooglePay#32544764`. -type InputCredentialsGooglePay struct { - // JSON-encoded data with the credential identifier - Data string -} - -// InputCredentialsGooglePayTypeID is TL type id of InputCredentialsGooglePay. -const InputCredentialsGooglePayTypeID = 0x32544764 - -// construct implements constructor of InputCredentialsClass. -func (i InputCredentialsGooglePay) construct() InputCredentialsClass { return &i } - -// Ensuring interfaces in compile-time for InputCredentialsGooglePay. -var ( - _ bin.Encoder = &InputCredentialsGooglePay{} - _ bin.Decoder = &InputCredentialsGooglePay{} - _ bin.BareEncoder = &InputCredentialsGooglePay{} - _ bin.BareDecoder = &InputCredentialsGooglePay{} - - _ InputCredentialsClass = &InputCredentialsGooglePay{} -) - -func (i *InputCredentialsGooglePay) Zero() bool { - if i == nil { - return true - } - if !(i.Data == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputCredentialsGooglePay) String() string { - if i == nil { - return "InputCredentialsGooglePay(nil)" - } - type Alias InputCredentialsGooglePay - return fmt.Sprintf("InputCredentialsGooglePay%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputCredentialsGooglePay) TypeID() uint32 { - return InputCredentialsGooglePayTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputCredentialsGooglePay) TypeName() string { - return "inputCredentialsGooglePay" -} - -// TypeInfo returns info about TL type. -func (i *InputCredentialsGooglePay) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputCredentialsGooglePay", - ID: InputCredentialsGooglePayTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputCredentialsGooglePay) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsGooglePay#32544764 as nil") - } - b.PutID(InputCredentialsGooglePayTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputCredentialsGooglePay) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsGooglePay#32544764 as nil") - } - b.PutString(i.Data) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputCredentialsGooglePay) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsGooglePay#32544764 to nil") - } - if err := b.ConsumeID(InputCredentialsGooglePayTypeID); err != nil { - return fmt.Errorf("unable to decode inputCredentialsGooglePay#32544764: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputCredentialsGooglePay) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsGooglePay#32544764 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputCredentialsGooglePay#32544764: field data: %w", err) - } - i.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputCredentialsGooglePay) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputCredentialsGooglePay#32544764 as nil") - } - b.ObjStart() - b.PutID("inputCredentialsGooglePay") - b.Comma() - b.FieldStart("data") - b.PutString(i.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputCredentialsGooglePay) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputCredentialsGooglePay#32544764 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputCredentialsGooglePay"); err != nil { - return fmt.Errorf("unable to decode inputCredentialsGooglePay#32544764: %w", err) - } - case "data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputCredentialsGooglePay#32544764: field data: %w", err) - } - i.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetData returns value of Data field. -func (i *InputCredentialsGooglePay) GetData() (value string) { - if i == nil { - return - } - return i.Data -} - -// InputCredentialsClassName is schema name of InputCredentialsClass. -const InputCredentialsClassName = "InputCredentials" - -// InputCredentialsClass represents InputCredentials generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputCredentials(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputCredentialsSaved: // inputCredentialsSaved#86bdbe2c -// case *tdapi.InputCredentialsNew: // inputCredentialsNew#ce8bf12a -// case *tdapi.InputCredentialsApplePay: // inputCredentialsApplePay#b5b2d6d1 -// case *tdapi.InputCredentialsGooglePay: // inputCredentialsGooglePay#32544764 -// default: panic(v) -// } -type InputCredentialsClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputCredentialsClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInputCredentials implements binary de-serialization for InputCredentialsClass. -func DecodeInputCredentials(buf *bin.Buffer) (InputCredentialsClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputCredentialsSavedTypeID: - // Decoding inputCredentialsSaved#86bdbe2c. - v := InputCredentialsSaved{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputCredentialsClass: %w", err) - } - return &v, nil - case InputCredentialsNewTypeID: - // Decoding inputCredentialsNew#ce8bf12a. - v := InputCredentialsNew{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputCredentialsClass: %w", err) - } - return &v, nil - case InputCredentialsApplePayTypeID: - // Decoding inputCredentialsApplePay#b5b2d6d1. - v := InputCredentialsApplePay{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputCredentialsClass: %w", err) - } - return &v, nil - case InputCredentialsGooglePayTypeID: - // Decoding inputCredentialsGooglePay#32544764. - v := InputCredentialsGooglePay{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputCredentialsClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputCredentialsClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputCredentials implements binary de-serialization for InputCredentialsClass. -func DecodeTDLibJSONInputCredentials(buf tdjson.Decoder) (InputCredentialsClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputCredentialsSaved": - // Decoding inputCredentialsSaved#86bdbe2c. - v := InputCredentialsSaved{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputCredentialsClass: %w", err) - } - return &v, nil - case "inputCredentialsNew": - // Decoding inputCredentialsNew#ce8bf12a. - v := InputCredentialsNew{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputCredentialsClass: %w", err) - } - return &v, nil - case "inputCredentialsApplePay": - // Decoding inputCredentialsApplePay#b5b2d6d1. - v := InputCredentialsApplePay{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputCredentialsClass: %w", err) - } - return &v, nil - case "inputCredentialsGooglePay": - // Decoding inputCredentialsGooglePay#32544764. - v := InputCredentialsGooglePay{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputCredentialsClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputCredentialsClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputCredentials boxes the InputCredentialsClass providing a helper. -type InputCredentialsBox struct { - InputCredentials InputCredentialsClass -} - -// Decode implements bin.Decoder for InputCredentialsBox. -func (b *InputCredentialsBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputCredentialsBox to nil") - } - v, err := DecodeInputCredentials(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputCredentials = v - return nil -} - -// Encode implements bin.Encode for InputCredentialsBox. -func (b *InputCredentialsBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputCredentials == nil { - return fmt.Errorf("unable to encode InputCredentialsClass as nil") - } - return b.InputCredentials.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputCredentialsBox. -func (b *InputCredentialsBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputCredentialsBox to nil") - } - v, err := DecodeTDLibJSONInputCredentials(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputCredentials = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputCredentialsBox. -func (b *InputCredentialsBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputCredentials == nil { - return fmt.Errorf("unable to encode InputCredentialsClass as nil") - } - return b.InputCredentials.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_file_gen.go b/tdapi/tl_input_file_gen.go deleted file mode 100644 index 32708398d..000000000 --- a/tdapi/tl_input_file_gen.go +++ /dev/null @@ -1,935 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputFileID represents TL type `inputFileId#6aa08b0d`. -type InputFileID struct { - // Unique file identifier - ID int32 -} - -// InputFileIDTypeID is TL type id of InputFileID. -const InputFileIDTypeID = 0x6aa08b0d - -// construct implements constructor of InputFileClass. -func (i InputFileID) construct() InputFileClass { return &i } - -// Ensuring interfaces in compile-time for InputFileID. -var ( - _ bin.Encoder = &InputFileID{} - _ bin.Decoder = &InputFileID{} - _ bin.BareEncoder = &InputFileID{} - _ bin.BareDecoder = &InputFileID{} - - _ InputFileClass = &InputFileID{} -) - -func (i *InputFileID) Zero() bool { - if i == nil { - return true - } - if !(i.ID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputFileID) String() string { - if i == nil { - return "InputFileID(nil)" - } - type Alias InputFileID - return fmt.Sprintf("InputFileID%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputFileID) TypeID() uint32 { - return InputFileIDTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputFileID) TypeName() string { - return "inputFileId" -} - -// TypeInfo returns info about TL type. -func (i *InputFileID) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputFileId", - ID: InputFileIDTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputFileID) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputFileId#6aa08b0d as nil") - } - b.PutID(InputFileIDTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputFileID) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputFileId#6aa08b0d as nil") - } - b.PutInt32(i.ID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputFileID) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputFileId#6aa08b0d to nil") - } - if err := b.ConsumeID(InputFileIDTypeID); err != nil { - return fmt.Errorf("unable to decode inputFileId#6aa08b0d: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputFileID) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputFileId#6aa08b0d to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputFileId#6aa08b0d: field id: %w", err) - } - i.ID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputFileID) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputFileId#6aa08b0d as nil") - } - b.ObjStart() - b.PutID("inputFileId") - b.Comma() - b.FieldStart("id") - b.PutInt32(i.ID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputFileID) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputFileId#6aa08b0d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputFileId"); err != nil { - return fmt.Errorf("unable to decode inputFileId#6aa08b0d: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputFileId#6aa08b0d: field id: %w", err) - } - i.ID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputFileID) GetID() (value int32) { - if i == nil { - return - } - return i.ID -} - -// InputFileRemote represents TL type `inputFileRemote#f9968b3e`. -type InputFileRemote struct { - // Remote file identifier - ID string -} - -// InputFileRemoteTypeID is TL type id of InputFileRemote. -const InputFileRemoteTypeID = 0xf9968b3e - -// construct implements constructor of InputFileClass. -func (i InputFileRemote) construct() InputFileClass { return &i } - -// Ensuring interfaces in compile-time for InputFileRemote. -var ( - _ bin.Encoder = &InputFileRemote{} - _ bin.Decoder = &InputFileRemote{} - _ bin.BareEncoder = &InputFileRemote{} - _ bin.BareDecoder = &InputFileRemote{} - - _ InputFileClass = &InputFileRemote{} -) - -func (i *InputFileRemote) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputFileRemote) String() string { - if i == nil { - return "InputFileRemote(nil)" - } - type Alias InputFileRemote - return fmt.Sprintf("InputFileRemote%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputFileRemote) TypeID() uint32 { - return InputFileRemoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputFileRemote) TypeName() string { - return "inputFileRemote" -} - -// TypeInfo returns info about TL type. -func (i *InputFileRemote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputFileRemote", - ID: InputFileRemoteTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputFileRemote) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputFileRemote#f9968b3e as nil") - } - b.PutID(InputFileRemoteTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputFileRemote) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputFileRemote#f9968b3e as nil") - } - b.PutString(i.ID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputFileRemote) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputFileRemote#f9968b3e to nil") - } - if err := b.ConsumeID(InputFileRemoteTypeID); err != nil { - return fmt.Errorf("unable to decode inputFileRemote#f9968b3e: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputFileRemote) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputFileRemote#f9968b3e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputFileRemote#f9968b3e: field id: %w", err) - } - i.ID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputFileRemote) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputFileRemote#f9968b3e as nil") - } - b.ObjStart() - b.PutID("inputFileRemote") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputFileRemote) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputFileRemote#f9968b3e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputFileRemote"); err != nil { - return fmt.Errorf("unable to decode inputFileRemote#f9968b3e: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputFileRemote#f9968b3e: field id: %w", err) - } - i.ID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputFileRemote) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// InputFileLocal represents TL type `inputFileLocal#7a8c8ac7`. -type InputFileLocal struct { - // Local path to the file - Path string -} - -// InputFileLocalTypeID is TL type id of InputFileLocal. -const InputFileLocalTypeID = 0x7a8c8ac7 - -// construct implements constructor of InputFileClass. -func (i InputFileLocal) construct() InputFileClass { return &i } - -// Ensuring interfaces in compile-time for InputFileLocal. -var ( - _ bin.Encoder = &InputFileLocal{} - _ bin.Decoder = &InputFileLocal{} - _ bin.BareEncoder = &InputFileLocal{} - _ bin.BareDecoder = &InputFileLocal{} - - _ InputFileClass = &InputFileLocal{} -) - -func (i *InputFileLocal) Zero() bool { - if i == nil { - return true - } - if !(i.Path == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputFileLocal) String() string { - if i == nil { - return "InputFileLocal(nil)" - } - type Alias InputFileLocal - return fmt.Sprintf("InputFileLocal%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputFileLocal) TypeID() uint32 { - return InputFileLocalTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputFileLocal) TypeName() string { - return "inputFileLocal" -} - -// TypeInfo returns info about TL type. -func (i *InputFileLocal) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputFileLocal", - ID: InputFileLocalTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Path", - SchemaName: "path", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputFileLocal) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputFileLocal#7a8c8ac7 as nil") - } - b.PutID(InputFileLocalTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputFileLocal) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputFileLocal#7a8c8ac7 as nil") - } - b.PutString(i.Path) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputFileLocal) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputFileLocal#7a8c8ac7 to nil") - } - if err := b.ConsumeID(InputFileLocalTypeID); err != nil { - return fmt.Errorf("unable to decode inputFileLocal#7a8c8ac7: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputFileLocal) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputFileLocal#7a8c8ac7 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputFileLocal#7a8c8ac7: field path: %w", err) - } - i.Path = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputFileLocal) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputFileLocal#7a8c8ac7 as nil") - } - b.ObjStart() - b.PutID("inputFileLocal") - b.Comma() - b.FieldStart("path") - b.PutString(i.Path) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputFileLocal) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputFileLocal#7a8c8ac7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputFileLocal"); err != nil { - return fmt.Errorf("unable to decode inputFileLocal#7a8c8ac7: %w", err) - } - case "path": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputFileLocal#7a8c8ac7: field path: %w", err) - } - i.Path = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPath returns value of Path field. -func (i *InputFileLocal) GetPath() (value string) { - if i == nil { - return - } - return i.Path -} - -// InputFileGenerated represents TL type `inputFileGenerated#b0862800`. -type InputFileGenerated struct { - // Local path to a file from which the file is generated. The path doesn't have to be a - // valid path and is used by TDLib only to detect name and MIME type of the generated - // file - OriginalPath string - // String specifying the conversion applied to the original file; must be persistent - // across application restarts. Conversions beginning with '#' are reserved for internal - // TDLib usage - Conversion string - // Expected size of the generated file, in bytes; pass 0 if unknown - ExpectedSize int64 -} - -// InputFileGeneratedTypeID is TL type id of InputFileGenerated. -const InputFileGeneratedTypeID = 0xb0862800 - -// construct implements constructor of InputFileClass. -func (i InputFileGenerated) construct() InputFileClass { return &i } - -// Ensuring interfaces in compile-time for InputFileGenerated. -var ( - _ bin.Encoder = &InputFileGenerated{} - _ bin.Decoder = &InputFileGenerated{} - _ bin.BareEncoder = &InputFileGenerated{} - _ bin.BareDecoder = &InputFileGenerated{} - - _ InputFileClass = &InputFileGenerated{} -) - -func (i *InputFileGenerated) Zero() bool { - if i == nil { - return true - } - if !(i.OriginalPath == "") { - return false - } - if !(i.Conversion == "") { - return false - } - if !(i.ExpectedSize == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputFileGenerated) String() string { - if i == nil { - return "InputFileGenerated(nil)" - } - type Alias InputFileGenerated - return fmt.Sprintf("InputFileGenerated%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputFileGenerated) TypeID() uint32 { - return InputFileGeneratedTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputFileGenerated) TypeName() string { - return "inputFileGenerated" -} - -// TypeInfo returns info about TL type. -func (i *InputFileGenerated) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputFileGenerated", - ID: InputFileGeneratedTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OriginalPath", - SchemaName: "original_path", - }, - { - Name: "Conversion", - SchemaName: "conversion", - }, - { - Name: "ExpectedSize", - SchemaName: "expected_size", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputFileGenerated) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputFileGenerated#b0862800 as nil") - } - b.PutID(InputFileGeneratedTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputFileGenerated) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputFileGenerated#b0862800 as nil") - } - b.PutString(i.OriginalPath) - b.PutString(i.Conversion) - b.PutInt53(i.ExpectedSize) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputFileGenerated) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputFileGenerated#b0862800 to nil") - } - if err := b.ConsumeID(InputFileGeneratedTypeID); err != nil { - return fmt.Errorf("unable to decode inputFileGenerated#b0862800: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputFileGenerated) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputFileGenerated#b0862800 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputFileGenerated#b0862800: field original_path: %w", err) - } - i.OriginalPath = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputFileGenerated#b0862800: field conversion: %w", err) - } - i.Conversion = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputFileGenerated#b0862800: field expected_size: %w", err) - } - i.ExpectedSize = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputFileGenerated) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputFileGenerated#b0862800 as nil") - } - b.ObjStart() - b.PutID("inputFileGenerated") - b.Comma() - b.FieldStart("original_path") - b.PutString(i.OriginalPath) - b.Comma() - b.FieldStart("conversion") - b.PutString(i.Conversion) - b.Comma() - b.FieldStart("expected_size") - b.PutInt53(i.ExpectedSize) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputFileGenerated) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputFileGenerated#b0862800 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputFileGenerated"); err != nil { - return fmt.Errorf("unable to decode inputFileGenerated#b0862800: %w", err) - } - case "original_path": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputFileGenerated#b0862800: field original_path: %w", err) - } - i.OriginalPath = value - case "conversion": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputFileGenerated#b0862800: field conversion: %w", err) - } - i.Conversion = value - case "expected_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputFileGenerated#b0862800: field expected_size: %w", err) - } - i.ExpectedSize = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOriginalPath returns value of OriginalPath field. -func (i *InputFileGenerated) GetOriginalPath() (value string) { - if i == nil { - return - } - return i.OriginalPath -} - -// GetConversion returns value of Conversion field. -func (i *InputFileGenerated) GetConversion() (value string) { - if i == nil { - return - } - return i.Conversion -} - -// GetExpectedSize returns value of ExpectedSize field. -func (i *InputFileGenerated) GetExpectedSize() (value int64) { - if i == nil { - return - } - return i.ExpectedSize -} - -// InputFileClassName is schema name of InputFileClass. -const InputFileClassName = "InputFile" - -// InputFileClass represents InputFile generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputFile(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputFileID: // inputFileId#6aa08b0d -// case *tdapi.InputFileRemote: // inputFileRemote#f9968b3e -// case *tdapi.InputFileLocal: // inputFileLocal#7a8c8ac7 -// case *tdapi.InputFileGenerated: // inputFileGenerated#b0862800 -// default: panic(v) -// } -type InputFileClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputFileClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInputFile implements binary de-serialization for InputFileClass. -func DecodeInputFile(buf *bin.Buffer) (InputFileClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputFileIDTypeID: - // Decoding inputFileId#6aa08b0d. - v := InputFileID{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputFileClass: %w", err) - } - return &v, nil - case InputFileRemoteTypeID: - // Decoding inputFileRemote#f9968b3e. - v := InputFileRemote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputFileClass: %w", err) - } - return &v, nil - case InputFileLocalTypeID: - // Decoding inputFileLocal#7a8c8ac7. - v := InputFileLocal{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputFileClass: %w", err) - } - return &v, nil - case InputFileGeneratedTypeID: - // Decoding inputFileGenerated#b0862800. - v := InputFileGenerated{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputFileClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputFileClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputFile implements binary de-serialization for InputFileClass. -func DecodeTDLibJSONInputFile(buf tdjson.Decoder) (InputFileClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputFileId": - // Decoding inputFileId#6aa08b0d. - v := InputFileID{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputFileClass: %w", err) - } - return &v, nil - case "inputFileRemote": - // Decoding inputFileRemote#f9968b3e. - v := InputFileRemote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputFileClass: %w", err) - } - return &v, nil - case "inputFileLocal": - // Decoding inputFileLocal#7a8c8ac7. - v := InputFileLocal{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputFileClass: %w", err) - } - return &v, nil - case "inputFileGenerated": - // Decoding inputFileGenerated#b0862800. - v := InputFileGenerated{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputFileClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputFileClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputFile boxes the InputFileClass providing a helper. -type InputFileBox struct { - InputFile InputFileClass -} - -// Decode implements bin.Decoder for InputFileBox. -func (b *InputFileBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputFileBox to nil") - } - v, err := DecodeInputFile(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputFile = v - return nil -} - -// Encode implements bin.Encode for InputFileBox. -func (b *InputFileBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputFile == nil { - return fmt.Errorf("unable to encode InputFileClass as nil") - } - return b.InputFile.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputFileBox. -func (b *InputFileBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputFileBox to nil") - } - v, err := DecodeTDLibJSONInputFile(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputFile = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputFileBox. -func (b *InputFileBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputFile == nil { - return fmt.Errorf("unable to encode InputFileClass as nil") - } - return b.InputFile.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_identity_document_gen.go b/tdapi/tl_input_identity_document_gen.go deleted file mode 100644 index 77d4b0a72..000000000 --- a/tdapi/tl_input_identity_document_gen.go +++ /dev/null @@ -1,428 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputIdentityDocument represents TL type `inputIdentityDocument#185f2052`. -type InputIdentityDocument struct { - // Document number; 1-24 characters - Number string - // Document expiration date; pass null if not applicable - ExpirationDate Date - // Front side of the document - FrontSide InputFileClass - // Reverse side of the document; only for driver license and identity card; pass null - // otherwise - ReverseSide InputFileClass - // Selfie with the document; pass null if unavailable - Selfie InputFileClass - // List of files containing a certified English translation of the document - Translation []InputFileClass -} - -// InputIdentityDocumentTypeID is TL type id of InputIdentityDocument. -const InputIdentityDocumentTypeID = 0x185f2052 - -// Ensuring interfaces in compile-time for InputIdentityDocument. -var ( - _ bin.Encoder = &InputIdentityDocument{} - _ bin.Decoder = &InputIdentityDocument{} - _ bin.BareEncoder = &InputIdentityDocument{} - _ bin.BareDecoder = &InputIdentityDocument{} -) - -func (i *InputIdentityDocument) Zero() bool { - if i == nil { - return true - } - if !(i.Number == "") { - return false - } - if !(i.ExpirationDate.Zero()) { - return false - } - if !(i.FrontSide == nil) { - return false - } - if !(i.ReverseSide == nil) { - return false - } - if !(i.Selfie == nil) { - return false - } - if !(i.Translation == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputIdentityDocument) String() string { - if i == nil { - return "InputIdentityDocument(nil)" - } - type Alias InputIdentityDocument - return fmt.Sprintf("InputIdentityDocument%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputIdentityDocument) TypeID() uint32 { - return InputIdentityDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputIdentityDocument) TypeName() string { - return "inputIdentityDocument" -} - -// TypeInfo returns info about TL type. -func (i *InputIdentityDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputIdentityDocument", - ID: InputIdentityDocumentTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Number", - SchemaName: "number", - }, - { - Name: "ExpirationDate", - SchemaName: "expiration_date", - }, - { - Name: "FrontSide", - SchemaName: "front_side", - }, - { - Name: "ReverseSide", - SchemaName: "reverse_side", - }, - { - Name: "Selfie", - SchemaName: "selfie", - }, - { - Name: "Translation", - SchemaName: "translation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputIdentityDocument) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputIdentityDocument#185f2052 as nil") - } - b.PutID(InputIdentityDocumentTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputIdentityDocument) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputIdentityDocument#185f2052 as nil") - } - b.PutString(i.Number) - if err := i.ExpirationDate.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field expiration_date: %w", err) - } - if i.FrontSide == nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field front_side is nil") - } - if err := i.FrontSide.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field front_side: %w", err) - } - if i.ReverseSide == nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field reverse_side is nil") - } - if err := i.ReverseSide.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field reverse_side: %w", err) - } - if i.Selfie == nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field selfie is nil") - } - if err := i.Selfie.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field selfie: %w", err) - } - b.PutInt(len(i.Translation)) - for idx, v := range i.Translation { - if v == nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field translation element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare inputIdentityDocument#185f2052: field translation element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputIdentityDocument) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputIdentityDocument#185f2052 to nil") - } - if err := b.ConsumeID(InputIdentityDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputIdentityDocument) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputIdentityDocument#185f2052 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field number: %w", err) - } - i.Number = value - } - { - if err := i.ExpirationDate.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field expiration_date: %w", err) - } - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field front_side: %w", err) - } - i.FrontSide = value - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field reverse_side: %w", err) - } - i.ReverseSide = value - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field selfie: %w", err) - } - i.Selfie = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field translation: %w", err) - } - - if headerLen > 0 { - i.Translation = make([]InputFileClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field translation: %w", err) - } - i.Translation = append(i.Translation, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputIdentityDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputIdentityDocument#185f2052 as nil") - } - b.ObjStart() - b.PutID("inputIdentityDocument") - b.Comma() - b.FieldStart("number") - b.PutString(i.Number) - b.Comma() - b.FieldStart("expiration_date") - if err := i.ExpirationDate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field expiration_date: %w", err) - } - b.Comma() - b.FieldStart("front_side") - if i.FrontSide == nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field front_side is nil") - } - if err := i.FrontSide.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field front_side: %w", err) - } - b.Comma() - b.FieldStart("reverse_side") - if i.ReverseSide == nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field reverse_side is nil") - } - if err := i.ReverseSide.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field reverse_side: %w", err) - } - b.Comma() - b.FieldStart("selfie") - if i.Selfie == nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field selfie is nil") - } - if err := i.Selfie.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field selfie: %w", err) - } - b.Comma() - b.FieldStart("translation") - b.ArrStart() - for idx, v := range i.Translation { - if v == nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field translation element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputIdentityDocument#185f2052: field translation element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputIdentityDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputIdentityDocument#185f2052 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputIdentityDocument"); err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: %w", err) - } - case "number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field number: %w", err) - } - i.Number = value - case "expiration_date": - if err := i.ExpirationDate.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field expiration_date: %w", err) - } - case "front_side": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field front_side: %w", err) - } - i.FrontSide = value - case "reverse_side": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field reverse_side: %w", err) - } - i.ReverseSide = value - case "selfie": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field selfie: %w", err) - } - i.Selfie = value - case "translation": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field translation: %w", err) - } - i.Translation = append(i.Translation, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputIdentityDocument#185f2052: field translation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetNumber returns value of Number field. -func (i *InputIdentityDocument) GetNumber() (value string) { - if i == nil { - return - } - return i.Number -} - -// GetExpirationDate returns value of ExpirationDate field. -func (i *InputIdentityDocument) GetExpirationDate() (value Date) { - if i == nil { - return - } - return i.ExpirationDate -} - -// GetFrontSide returns value of FrontSide field. -func (i *InputIdentityDocument) GetFrontSide() (value InputFileClass) { - if i == nil { - return - } - return i.FrontSide -} - -// GetReverseSide returns value of ReverseSide field. -func (i *InputIdentityDocument) GetReverseSide() (value InputFileClass) { - if i == nil { - return - } - return i.ReverseSide -} - -// GetSelfie returns value of Selfie field. -func (i *InputIdentityDocument) GetSelfie() (value InputFileClass) { - if i == nil { - return - } - return i.Selfie -} - -// GetTranslation returns value of Translation field. -func (i *InputIdentityDocument) GetTranslation() (value []InputFileClass) { - if i == nil { - return - } - return i.Translation -} diff --git a/tdapi/tl_input_inline_query_result_gen.go b/tdapi/tl_input_inline_query_result_gen.go deleted file mode 100644 index 5dbbd6d45..000000000 --- a/tdapi/tl_input_inline_query_result_gen.go +++ /dev/null @@ -1,5441 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputInlineQueryResultAnimation represents TL type `inputInlineQueryResultAnimation#a7335216`. -type InputInlineQueryResultAnimation struct { - // Unique identifier of the query result - ID string - // Title of the query result - Title string - // URL of the result thumbnail (JPEG, GIF, or MPEG4), if it exists - ThumbnailURL string - // MIME type of the video thumbnail. If non-empty, must be one of "image/jpeg", - // "image/gif" and "video/mp4" - ThumbnailMimeType string - // The URL of the video file (file size must not exceed 1MB) - VideoURL string - // MIME type of the video file. Must be one of "image/gif" and "video/mp4" - VideoMimeType string - // Duration of the video, in seconds - VideoDuration int32 - // Width of the video - VideoWidth int32 - // Height of the video - VideoHeight int32 - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent. Must be one of the following types: - // inputMessageText, inputMessageAnimation, inputMessageInvoice, inputMessageLocation, - // inputMessageVenue or inputMessageContact - InputMessageContent InputMessageContentClass -} - -// InputInlineQueryResultAnimationTypeID is TL type id of InputInlineQueryResultAnimation. -const InputInlineQueryResultAnimationTypeID = 0xa7335216 - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultAnimation) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultAnimation. -var ( - _ bin.Encoder = &InputInlineQueryResultAnimation{} - _ bin.Decoder = &InputInlineQueryResultAnimation{} - _ bin.BareEncoder = &InputInlineQueryResultAnimation{} - _ bin.BareDecoder = &InputInlineQueryResultAnimation{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultAnimation{} -) - -func (i *InputInlineQueryResultAnimation) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Title == "") { - return false - } - if !(i.ThumbnailURL == "") { - return false - } - if !(i.ThumbnailMimeType == "") { - return false - } - if !(i.VideoURL == "") { - return false - } - if !(i.VideoMimeType == "") { - return false - } - if !(i.VideoDuration == 0) { - return false - } - if !(i.VideoWidth == 0) { - return false - } - if !(i.VideoHeight == 0) { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - if !(i.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultAnimation) String() string { - if i == nil { - return "InputInlineQueryResultAnimation(nil)" - } - type Alias InputInlineQueryResultAnimation - return fmt.Sprintf("InputInlineQueryResultAnimation%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultAnimation) TypeID() uint32 { - return InputInlineQueryResultAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultAnimation) TypeName() string { - return "inputInlineQueryResultAnimation" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultAnimation", - ID: InputInlineQueryResultAnimationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "ThumbnailURL", - SchemaName: "thumbnail_url", - }, - { - Name: "ThumbnailMimeType", - SchemaName: "thumbnail_mime_type", - }, - { - Name: "VideoURL", - SchemaName: "video_url", - }, - { - Name: "VideoMimeType", - SchemaName: "video_mime_type", - }, - { - Name: "VideoDuration", - SchemaName: "video_duration", - }, - { - Name: "VideoWidth", - SchemaName: "video_width", - }, - { - Name: "VideoHeight", - SchemaName: "video_height", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultAnimation) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultAnimation#a7335216 as nil") - } - b.PutID(InputInlineQueryResultAnimationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultAnimation) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultAnimation#a7335216 as nil") - } - b.PutString(i.ID) - b.PutString(i.Title) - b.PutString(i.ThumbnailURL) - b.PutString(i.ThumbnailMimeType) - b.PutString(i.VideoURL) - b.PutString(i.VideoMimeType) - b.PutInt32(i.VideoDuration) - b.PutInt32(i.VideoWidth) - b.PutInt32(i.VideoHeight) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field reply_markup: %w", err) - } - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field input_message_content is nil") - } - if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultAnimation) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultAnimation#a7335216 to nil") - } - if err := b.ConsumeID(InputInlineQueryResultAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultAnimation) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultAnimation#a7335216 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field id: %w", err) - } - i.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field thumbnail_mime_type: %w", err) - } - i.ThumbnailMimeType = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_url: %w", err) - } - i.VideoURL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_mime_type: %w", err) - } - i.VideoMimeType = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_duration: %w", err) - } - i.VideoDuration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_width: %w", err) - } - i.VideoWidth = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_height: %w", err) - } - i.VideoHeight = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field input_message_content: %w", err) - } - i.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultAnimation#a7335216 as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultAnimation") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("thumbnail_url") - b.PutString(i.ThumbnailURL) - b.Comma() - b.FieldStart("thumbnail_mime_type") - b.PutString(i.ThumbnailMimeType) - b.Comma() - b.FieldStart("video_url") - b.PutString(i.VideoURL) - b.Comma() - b.FieldStart("video_mime_type") - b.PutString(i.VideoMimeType) - b.Comma() - b.FieldStart("video_duration") - b.PutInt32(i.VideoDuration) - b.Comma() - b.FieldStart("video_width") - b.PutInt32(i.VideoWidth) - b.Comma() - b.FieldStart("video_height") - b.PutInt32(i.VideoHeight) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field input_message_content is nil") - } - if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAnimation#a7335216: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultAnimation#a7335216 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultAnimation"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field id: %w", err) - } - i.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field title: %w", err) - } - i.Title = value - case "thumbnail_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - case "thumbnail_mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field thumbnail_mime_type: %w", err) - } - i.ThumbnailMimeType = value - case "video_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_url: %w", err) - } - i.VideoURL = value - case "video_mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_mime_type: %w", err) - } - i.VideoMimeType = value - case "video_duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_duration: %w", err) - } - i.VideoDuration = value - case "video_width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_width: %w", err) - } - i.VideoWidth = value - case "video_height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field video_height: %w", err) - } - i.VideoHeight = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field reply_markup: %w", err) - } - i.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAnimation#a7335216: field input_message_content: %w", err) - } - i.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultAnimation) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetTitle returns value of Title field. -func (i *InputInlineQueryResultAnimation) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetThumbnailURL returns value of ThumbnailURL field. -func (i *InputInlineQueryResultAnimation) GetThumbnailURL() (value string) { - if i == nil { - return - } - return i.ThumbnailURL -} - -// GetThumbnailMimeType returns value of ThumbnailMimeType field. -func (i *InputInlineQueryResultAnimation) GetThumbnailMimeType() (value string) { - if i == nil { - return - } - return i.ThumbnailMimeType -} - -// GetVideoURL returns value of VideoURL field. -func (i *InputInlineQueryResultAnimation) GetVideoURL() (value string) { - if i == nil { - return - } - return i.VideoURL -} - -// GetVideoMimeType returns value of VideoMimeType field. -func (i *InputInlineQueryResultAnimation) GetVideoMimeType() (value string) { - if i == nil { - return - } - return i.VideoMimeType -} - -// GetVideoDuration returns value of VideoDuration field. -func (i *InputInlineQueryResultAnimation) GetVideoDuration() (value int32) { - if i == nil { - return - } - return i.VideoDuration -} - -// GetVideoWidth returns value of VideoWidth field. -func (i *InputInlineQueryResultAnimation) GetVideoWidth() (value int32) { - if i == nil { - return - } - return i.VideoWidth -} - -// GetVideoHeight returns value of VideoHeight field. -func (i *InputInlineQueryResultAnimation) GetVideoHeight() (value int32) { - if i == nil { - return - } - return i.VideoHeight -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultAnimation) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (i *InputInlineQueryResultAnimation) GetInputMessageContent() (value InputMessageContentClass) { - if i == nil { - return - } - return i.InputMessageContent -} - -// InputInlineQueryResultArticle represents TL type `inputInlineQueryResultArticle#763583bc`. -type InputInlineQueryResultArticle struct { - // Unique identifier of the query result - ID string - // URL of the result, if it exists - URL string - // Title of the result - Title string - // Represents a link to an article or web page - Description string - // URL of the result thumbnail, if it exists - ThumbnailURL string - // Thumbnail width, if known - ThumbnailWidth int32 - // Thumbnail height, if known - ThumbnailHeight int32 - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent. Must be one of the following types: - // inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or - // inputMessageContact - InputMessageContent InputMessageContentClass -} - -// InputInlineQueryResultArticleTypeID is TL type id of InputInlineQueryResultArticle. -const InputInlineQueryResultArticleTypeID = 0x763583bc - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultArticle) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultArticle. -var ( - _ bin.Encoder = &InputInlineQueryResultArticle{} - _ bin.Decoder = &InputInlineQueryResultArticle{} - _ bin.BareEncoder = &InputInlineQueryResultArticle{} - _ bin.BareDecoder = &InputInlineQueryResultArticle{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultArticle{} -) - -func (i *InputInlineQueryResultArticle) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.URL == "") { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Description == "") { - return false - } - if !(i.ThumbnailURL == "") { - return false - } - if !(i.ThumbnailWidth == 0) { - return false - } - if !(i.ThumbnailHeight == 0) { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - if !(i.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultArticle) String() string { - if i == nil { - return "InputInlineQueryResultArticle(nil)" - } - type Alias InputInlineQueryResultArticle - return fmt.Sprintf("InputInlineQueryResultArticle%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultArticle) TypeID() uint32 { - return InputInlineQueryResultArticleTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultArticle) TypeName() string { - return "inputInlineQueryResultArticle" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultArticle) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultArticle", - ID: InputInlineQueryResultArticleTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "ThumbnailURL", - SchemaName: "thumbnail_url", - }, - { - Name: "ThumbnailWidth", - SchemaName: "thumbnail_width", - }, - { - Name: "ThumbnailHeight", - SchemaName: "thumbnail_height", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultArticle) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultArticle#763583bc as nil") - } - b.PutID(InputInlineQueryResultArticleTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultArticle) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultArticle#763583bc as nil") - } - b.PutString(i.ID) - b.PutString(i.URL) - b.PutString(i.Title) - b.PutString(i.Description) - b.PutString(i.ThumbnailURL) - b.PutInt32(i.ThumbnailWidth) - b.PutInt32(i.ThumbnailHeight) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err) - } - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content is nil") - } - if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultArticle) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultArticle#763583bc to nil") - } - if err := b.ConsumeID(InputInlineQueryResultArticleTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultArticle) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultArticle#763583bc to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field id: %w", err) - } - i.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field url: %w", err) - } - i.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field description: %w", err) - } - i.Description = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_width: %w", err) - } - i.ThumbnailWidth = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_height: %w", err) - } - i.ThumbnailHeight = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err) - } - i.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultArticle) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultArticle#763583bc as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultArticle") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("description") - b.PutString(i.Description) - b.Comma() - b.FieldStart("thumbnail_url") - b.PutString(i.ThumbnailURL) - b.Comma() - b.FieldStart("thumbnail_width") - b.PutInt32(i.ThumbnailWidth) - b.Comma() - b.FieldStart("thumbnail_height") - b.PutInt32(i.ThumbnailHeight) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content is nil") - } - if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultArticle) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultArticle#763583bc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultArticle"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field id: %w", err) - } - i.ID = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field url: %w", err) - } - i.URL = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field title: %w", err) - } - i.Title = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field description: %w", err) - } - i.Description = value - case "thumbnail_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - case "thumbnail_width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_width: %w", err) - } - i.ThumbnailWidth = value - case "thumbnail_height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field thumbnail_height: %w", err) - } - i.ThumbnailHeight = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field reply_markup: %w", err) - } - i.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultArticle#763583bc: field input_message_content: %w", err) - } - i.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultArticle) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetURL returns value of URL field. -func (i *InputInlineQueryResultArticle) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// GetTitle returns value of Title field. -func (i *InputInlineQueryResultArticle) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetDescription returns value of Description field. -func (i *InputInlineQueryResultArticle) GetDescription() (value string) { - if i == nil { - return - } - return i.Description -} - -// GetThumbnailURL returns value of ThumbnailURL field. -func (i *InputInlineQueryResultArticle) GetThumbnailURL() (value string) { - if i == nil { - return - } - return i.ThumbnailURL -} - -// GetThumbnailWidth returns value of ThumbnailWidth field. -func (i *InputInlineQueryResultArticle) GetThumbnailWidth() (value int32) { - if i == nil { - return - } - return i.ThumbnailWidth -} - -// GetThumbnailHeight returns value of ThumbnailHeight field. -func (i *InputInlineQueryResultArticle) GetThumbnailHeight() (value int32) { - if i == nil { - return - } - return i.ThumbnailHeight -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultArticle) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (i *InputInlineQueryResultArticle) GetInputMessageContent() (value InputMessageContentClass) { - if i == nil { - return - } - return i.InputMessageContent -} - -// InputInlineQueryResultAudio represents TL type `inputInlineQueryResultAudio#4b1c35d4`. -type InputInlineQueryResultAudio struct { - // Unique identifier of the query result - ID string - // Title of the audio file - Title string - // Performer of the audio file - Performer string - // The URL of the audio file - AudioURL string - // Audio file duration, in seconds - AudioDuration int32 - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent. Must be one of the following types: - // inputMessageText, inputMessageAudio, inputMessageInvoice, inputMessageLocation, - // inputMessageVenue or inputMessageContact - InputMessageContent InputMessageContentClass -} - -// InputInlineQueryResultAudioTypeID is TL type id of InputInlineQueryResultAudio. -const InputInlineQueryResultAudioTypeID = 0x4b1c35d4 - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultAudio) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultAudio. -var ( - _ bin.Encoder = &InputInlineQueryResultAudio{} - _ bin.Decoder = &InputInlineQueryResultAudio{} - _ bin.BareEncoder = &InputInlineQueryResultAudio{} - _ bin.BareDecoder = &InputInlineQueryResultAudio{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultAudio{} -) - -func (i *InputInlineQueryResultAudio) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Performer == "") { - return false - } - if !(i.AudioURL == "") { - return false - } - if !(i.AudioDuration == 0) { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - if !(i.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultAudio) String() string { - if i == nil { - return "InputInlineQueryResultAudio(nil)" - } - type Alias InputInlineQueryResultAudio - return fmt.Sprintf("InputInlineQueryResultAudio%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultAudio) TypeID() uint32 { - return InputInlineQueryResultAudioTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultAudio) TypeName() string { - return "inputInlineQueryResultAudio" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultAudio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultAudio", - ID: InputInlineQueryResultAudioTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Performer", - SchemaName: "performer", - }, - { - Name: "AudioURL", - SchemaName: "audio_url", - }, - { - Name: "AudioDuration", - SchemaName: "audio_duration", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultAudio) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultAudio#4b1c35d4 as nil") - } - b.PutID(InputInlineQueryResultAudioTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultAudio) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultAudio#4b1c35d4 as nil") - } - b.PutString(i.ID) - b.PutString(i.Title) - b.PutString(i.Performer) - b.PutString(i.AudioURL) - b.PutInt32(i.AudioDuration) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field reply_markup: %w", err) - } - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field input_message_content is nil") - } - if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultAudio) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultAudio#4b1c35d4 to nil") - } - if err := b.ConsumeID(InputInlineQueryResultAudioTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultAudio) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultAudio#4b1c35d4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field id: %w", err) - } - i.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field performer: %w", err) - } - i.Performer = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field audio_url: %w", err) - } - i.AudioURL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field audio_duration: %w", err) - } - i.AudioDuration = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field input_message_content: %w", err) - } - i.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultAudio) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultAudio#4b1c35d4 as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultAudio") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("performer") - b.PutString(i.Performer) - b.Comma() - b.FieldStart("audio_url") - b.PutString(i.AudioURL) - b.Comma() - b.FieldStart("audio_duration") - b.PutInt32(i.AudioDuration) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field input_message_content is nil") - } - if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultAudio#4b1c35d4: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultAudio) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultAudio#4b1c35d4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultAudio"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field id: %w", err) - } - i.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field title: %w", err) - } - i.Title = value - case "performer": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field performer: %w", err) - } - i.Performer = value - case "audio_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field audio_url: %w", err) - } - i.AudioURL = value - case "audio_duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field audio_duration: %w", err) - } - i.AudioDuration = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field reply_markup: %w", err) - } - i.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultAudio#4b1c35d4: field input_message_content: %w", err) - } - i.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultAudio) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetTitle returns value of Title field. -func (i *InputInlineQueryResultAudio) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetPerformer returns value of Performer field. -func (i *InputInlineQueryResultAudio) GetPerformer() (value string) { - if i == nil { - return - } - return i.Performer -} - -// GetAudioURL returns value of AudioURL field. -func (i *InputInlineQueryResultAudio) GetAudioURL() (value string) { - if i == nil { - return - } - return i.AudioURL -} - -// GetAudioDuration returns value of AudioDuration field. -func (i *InputInlineQueryResultAudio) GetAudioDuration() (value int32) { - if i == nil { - return - } - return i.AudioDuration -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultAudio) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (i *InputInlineQueryResultAudio) GetInputMessageContent() (value InputMessageContentClass) { - if i == nil { - return - } - return i.InputMessageContent -} - -// InputInlineQueryResultContact represents TL type `inputInlineQueryResultContact#6e08b5d2`. -type InputInlineQueryResultContact struct { - // Unique identifier of the query result - ID string - // User contact - Contact Contact - // URL of the result thumbnail, if it exists - ThumbnailURL string - // Thumbnail width, if known - ThumbnailWidth int32 - // Thumbnail height, if known - ThumbnailHeight int32 - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent. Must be one of the following types: - // inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or - // inputMessageContact - InputMessageContent InputMessageContentClass -} - -// InputInlineQueryResultContactTypeID is TL type id of InputInlineQueryResultContact. -const InputInlineQueryResultContactTypeID = 0x6e08b5d2 - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultContact) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultContact. -var ( - _ bin.Encoder = &InputInlineQueryResultContact{} - _ bin.Decoder = &InputInlineQueryResultContact{} - _ bin.BareEncoder = &InputInlineQueryResultContact{} - _ bin.BareDecoder = &InputInlineQueryResultContact{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultContact{} -) - -func (i *InputInlineQueryResultContact) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Contact.Zero()) { - return false - } - if !(i.ThumbnailURL == "") { - return false - } - if !(i.ThumbnailWidth == 0) { - return false - } - if !(i.ThumbnailHeight == 0) { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - if !(i.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultContact) String() string { - if i == nil { - return "InputInlineQueryResultContact(nil)" - } - type Alias InputInlineQueryResultContact - return fmt.Sprintf("InputInlineQueryResultContact%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultContact) TypeID() uint32 { - return InputInlineQueryResultContactTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultContact) TypeName() string { - return "inputInlineQueryResultContact" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultContact) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultContact", - ID: InputInlineQueryResultContactTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Contact", - SchemaName: "contact", - }, - { - Name: "ThumbnailURL", - SchemaName: "thumbnail_url", - }, - { - Name: "ThumbnailWidth", - SchemaName: "thumbnail_width", - }, - { - Name: "ThumbnailHeight", - SchemaName: "thumbnail_height", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultContact) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultContact#6e08b5d2 as nil") - } - b.PutID(InputInlineQueryResultContactTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultContact) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultContact#6e08b5d2 as nil") - } - b.PutString(i.ID) - if err := i.Contact.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field contact: %w", err) - } - b.PutString(i.ThumbnailURL) - b.PutInt32(i.ThumbnailWidth) - b.PutInt32(i.ThumbnailHeight) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field reply_markup: %w", err) - } - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field input_message_content is nil") - } - if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultContact) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultContact#6e08b5d2 to nil") - } - if err := b.ConsumeID(InputInlineQueryResultContactTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultContact) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultContact#6e08b5d2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field id: %w", err) - } - i.ID = value - } - { - if err := i.Contact.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field contact: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_width: %w", err) - } - i.ThumbnailWidth = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_height: %w", err) - } - i.ThumbnailHeight = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field input_message_content: %w", err) - } - i.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultContact) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultContact#6e08b5d2 as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultContact") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("contact") - if err := i.Contact.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field contact: %w", err) - } - b.Comma() - b.FieldStart("thumbnail_url") - b.PutString(i.ThumbnailURL) - b.Comma() - b.FieldStart("thumbnail_width") - b.PutInt32(i.ThumbnailWidth) - b.Comma() - b.FieldStart("thumbnail_height") - b.PutInt32(i.ThumbnailHeight) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field input_message_content is nil") - } - if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultContact#6e08b5d2: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultContact) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultContact#6e08b5d2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultContact"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field id: %w", err) - } - i.ID = value - case "contact": - if err := i.Contact.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field contact: %w", err) - } - case "thumbnail_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - case "thumbnail_width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_width: %w", err) - } - i.ThumbnailWidth = value - case "thumbnail_height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field thumbnail_height: %w", err) - } - i.ThumbnailHeight = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field reply_markup: %w", err) - } - i.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultContact#6e08b5d2: field input_message_content: %w", err) - } - i.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultContact) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetContact returns value of Contact field. -func (i *InputInlineQueryResultContact) GetContact() (value Contact) { - if i == nil { - return - } - return i.Contact -} - -// GetThumbnailURL returns value of ThumbnailURL field. -func (i *InputInlineQueryResultContact) GetThumbnailURL() (value string) { - if i == nil { - return - } - return i.ThumbnailURL -} - -// GetThumbnailWidth returns value of ThumbnailWidth field. -func (i *InputInlineQueryResultContact) GetThumbnailWidth() (value int32) { - if i == nil { - return - } - return i.ThumbnailWidth -} - -// GetThumbnailHeight returns value of ThumbnailHeight field. -func (i *InputInlineQueryResultContact) GetThumbnailHeight() (value int32) { - if i == nil { - return - } - return i.ThumbnailHeight -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultContact) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (i *InputInlineQueryResultContact) GetInputMessageContent() (value InputMessageContentClass) { - if i == nil { - return - } - return i.InputMessageContent -} - -// InputInlineQueryResultDocument represents TL type `inputInlineQueryResultDocument#227fd0cd`. -type InputInlineQueryResultDocument struct { - // Unique identifier of the query result - ID string - // Title of the resulting file - Title string - // Represents a link to a file - Description string - // URL of the file - DocumentURL string - // MIME type of the file content; only "application/pdf" and "application/zip" are - // currently allowed - MimeType string - // The URL of the file thumbnail, if it exists - ThumbnailURL string - // Width of the thumbnail - ThumbnailWidth int32 - // Height of the thumbnail - ThumbnailHeight int32 - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent. Must be one of the following types: - // inputMessageText, inputMessageDocument, inputMessageInvoice, inputMessageLocation, - // inputMessageVenue or inputMessageContact - InputMessageContent InputMessageContentClass -} - -// InputInlineQueryResultDocumentTypeID is TL type id of InputInlineQueryResultDocument. -const InputInlineQueryResultDocumentTypeID = 0x227fd0cd - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultDocument) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultDocument. -var ( - _ bin.Encoder = &InputInlineQueryResultDocument{} - _ bin.Decoder = &InputInlineQueryResultDocument{} - _ bin.BareEncoder = &InputInlineQueryResultDocument{} - _ bin.BareDecoder = &InputInlineQueryResultDocument{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultDocument{} -) - -func (i *InputInlineQueryResultDocument) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Description == "") { - return false - } - if !(i.DocumentURL == "") { - return false - } - if !(i.MimeType == "") { - return false - } - if !(i.ThumbnailURL == "") { - return false - } - if !(i.ThumbnailWidth == 0) { - return false - } - if !(i.ThumbnailHeight == 0) { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - if !(i.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultDocument) String() string { - if i == nil { - return "InputInlineQueryResultDocument(nil)" - } - type Alias InputInlineQueryResultDocument - return fmt.Sprintf("InputInlineQueryResultDocument%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultDocument) TypeID() uint32 { - return InputInlineQueryResultDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultDocument) TypeName() string { - return "inputInlineQueryResultDocument" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultDocument", - ID: InputInlineQueryResultDocumentTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "DocumentURL", - SchemaName: "document_url", - }, - { - Name: "MimeType", - SchemaName: "mime_type", - }, - { - Name: "ThumbnailURL", - SchemaName: "thumbnail_url", - }, - { - Name: "ThumbnailWidth", - SchemaName: "thumbnail_width", - }, - { - Name: "ThumbnailHeight", - SchemaName: "thumbnail_height", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultDocument) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultDocument#227fd0cd as nil") - } - b.PutID(InputInlineQueryResultDocumentTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultDocument) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultDocument#227fd0cd as nil") - } - b.PutString(i.ID) - b.PutString(i.Title) - b.PutString(i.Description) - b.PutString(i.DocumentURL) - b.PutString(i.MimeType) - b.PutString(i.ThumbnailURL) - b.PutInt32(i.ThumbnailWidth) - b.PutInt32(i.ThumbnailHeight) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field reply_markup: %w", err) - } - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field input_message_content is nil") - } - if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultDocument) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultDocument#227fd0cd to nil") - } - if err := b.ConsumeID(InputInlineQueryResultDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultDocument) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultDocument#227fd0cd to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field id: %w", err) - } - i.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field description: %w", err) - } - i.Description = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field document_url: %w", err) - } - i.DocumentURL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field mime_type: %w", err) - } - i.MimeType = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_width: %w", err) - } - i.ThumbnailWidth = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_height: %w", err) - } - i.ThumbnailHeight = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field input_message_content: %w", err) - } - i.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultDocument#227fd0cd as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultDocument") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("description") - b.PutString(i.Description) - b.Comma() - b.FieldStart("document_url") - b.PutString(i.DocumentURL) - b.Comma() - b.FieldStart("mime_type") - b.PutString(i.MimeType) - b.Comma() - b.FieldStart("thumbnail_url") - b.PutString(i.ThumbnailURL) - b.Comma() - b.FieldStart("thumbnail_width") - b.PutInt32(i.ThumbnailWidth) - b.Comma() - b.FieldStart("thumbnail_height") - b.PutInt32(i.ThumbnailHeight) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field input_message_content is nil") - } - if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultDocument#227fd0cd: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultDocument#227fd0cd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultDocument"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field id: %w", err) - } - i.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field title: %w", err) - } - i.Title = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field description: %w", err) - } - i.Description = value - case "document_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field document_url: %w", err) - } - i.DocumentURL = value - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field mime_type: %w", err) - } - i.MimeType = value - case "thumbnail_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - case "thumbnail_width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_width: %w", err) - } - i.ThumbnailWidth = value - case "thumbnail_height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field thumbnail_height: %w", err) - } - i.ThumbnailHeight = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field reply_markup: %w", err) - } - i.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultDocument#227fd0cd: field input_message_content: %w", err) - } - i.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultDocument) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetTitle returns value of Title field. -func (i *InputInlineQueryResultDocument) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetDescription returns value of Description field. -func (i *InputInlineQueryResultDocument) GetDescription() (value string) { - if i == nil { - return - } - return i.Description -} - -// GetDocumentURL returns value of DocumentURL field. -func (i *InputInlineQueryResultDocument) GetDocumentURL() (value string) { - if i == nil { - return - } - return i.DocumentURL -} - -// GetMimeType returns value of MimeType field. -func (i *InputInlineQueryResultDocument) GetMimeType() (value string) { - if i == nil { - return - } - return i.MimeType -} - -// GetThumbnailURL returns value of ThumbnailURL field. -func (i *InputInlineQueryResultDocument) GetThumbnailURL() (value string) { - if i == nil { - return - } - return i.ThumbnailURL -} - -// GetThumbnailWidth returns value of ThumbnailWidth field. -func (i *InputInlineQueryResultDocument) GetThumbnailWidth() (value int32) { - if i == nil { - return - } - return i.ThumbnailWidth -} - -// GetThumbnailHeight returns value of ThumbnailHeight field. -func (i *InputInlineQueryResultDocument) GetThumbnailHeight() (value int32) { - if i == nil { - return - } - return i.ThumbnailHeight -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultDocument) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (i *InputInlineQueryResultDocument) GetInputMessageContent() (value InputMessageContentClass) { - if i == nil { - return - } - return i.InputMessageContent -} - -// InputInlineQueryResultGame represents TL type `inputInlineQueryResultGame#39951fd7`. -type InputInlineQueryResultGame struct { - // Unique identifier of the query result - ID string - // Short name of the game - GameShortName string - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass -} - -// InputInlineQueryResultGameTypeID is TL type id of InputInlineQueryResultGame. -const InputInlineQueryResultGameTypeID = 0x39951fd7 - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultGame) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultGame. -var ( - _ bin.Encoder = &InputInlineQueryResultGame{} - _ bin.Decoder = &InputInlineQueryResultGame{} - _ bin.BareEncoder = &InputInlineQueryResultGame{} - _ bin.BareDecoder = &InputInlineQueryResultGame{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultGame{} -) - -func (i *InputInlineQueryResultGame) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.GameShortName == "") { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultGame) String() string { - if i == nil { - return "InputInlineQueryResultGame(nil)" - } - type Alias InputInlineQueryResultGame - return fmt.Sprintf("InputInlineQueryResultGame%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultGame) TypeID() uint32 { - return InputInlineQueryResultGameTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultGame) TypeName() string { - return "inputInlineQueryResultGame" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultGame) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultGame", - ID: InputInlineQueryResultGameTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "GameShortName", - SchemaName: "game_short_name", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultGame) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultGame#39951fd7 as nil") - } - b.PutID(InputInlineQueryResultGameTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultGame) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultGame#39951fd7 as nil") - } - b.PutString(i.ID) - b.PutString(i.GameShortName) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultGame#39951fd7: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultGame#39951fd7: field reply_markup: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultGame) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultGame#39951fd7 to nil") - } - if err := b.ConsumeID(InputInlineQueryResultGameTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultGame) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultGame#39951fd7 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field id: %w", err) - } - i.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field game_short_name: %w", err) - } - i.GameShortName = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultGame) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultGame#39951fd7 as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultGame") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("game_short_name") - b.PutString(i.GameShortName) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultGame#39951fd7: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultGame#39951fd7: field reply_markup: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultGame) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultGame#39951fd7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultGame"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field id: %w", err) - } - i.ID = value - case "game_short_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field game_short_name: %w", err) - } - i.GameShortName = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultGame#39951fd7: field reply_markup: %w", err) - } - i.ReplyMarkup = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultGame) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetGameShortName returns value of GameShortName field. -func (i *InputInlineQueryResultGame) GetGameShortName() (value string) { - if i == nil { - return - } - return i.GameShortName -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultGame) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// InputInlineQueryResultLocation represents TL type `inputInlineQueryResultLocation#8f7cbe56`. -type InputInlineQueryResultLocation struct { - // Unique identifier of the query result - ID string - // Location result - Location Location - // Amount of time relative to the message sent time until the location can be updated, in - // seconds - LivePeriod int32 - // Title of the result - Title string - // URL of the result thumbnail, if it exists - ThumbnailURL string - // Thumbnail width, if known - ThumbnailWidth int32 - // Thumbnail height, if known - ThumbnailHeight int32 - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent. Must be one of the following types: - // inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or - // inputMessageContact - InputMessageContent InputMessageContentClass -} - -// InputInlineQueryResultLocationTypeID is TL type id of InputInlineQueryResultLocation. -const InputInlineQueryResultLocationTypeID = 0x8f7cbe56 - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultLocation) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultLocation. -var ( - _ bin.Encoder = &InputInlineQueryResultLocation{} - _ bin.Decoder = &InputInlineQueryResultLocation{} - _ bin.BareEncoder = &InputInlineQueryResultLocation{} - _ bin.BareDecoder = &InputInlineQueryResultLocation{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultLocation{} -) - -func (i *InputInlineQueryResultLocation) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Location.Zero()) { - return false - } - if !(i.LivePeriod == 0) { - return false - } - if !(i.Title == "") { - return false - } - if !(i.ThumbnailURL == "") { - return false - } - if !(i.ThumbnailWidth == 0) { - return false - } - if !(i.ThumbnailHeight == 0) { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - if !(i.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultLocation) String() string { - if i == nil { - return "InputInlineQueryResultLocation(nil)" - } - type Alias InputInlineQueryResultLocation - return fmt.Sprintf("InputInlineQueryResultLocation%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultLocation) TypeID() uint32 { - return InputInlineQueryResultLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultLocation) TypeName() string { - return "inputInlineQueryResultLocation" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultLocation", - ID: InputInlineQueryResultLocationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "LivePeriod", - SchemaName: "live_period", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "ThumbnailURL", - SchemaName: "thumbnail_url", - }, - { - Name: "ThumbnailWidth", - SchemaName: "thumbnail_width", - }, - { - Name: "ThumbnailHeight", - SchemaName: "thumbnail_height", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultLocation) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultLocation#8f7cbe56 as nil") - } - b.PutID(InputInlineQueryResultLocationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultLocation) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultLocation#8f7cbe56 as nil") - } - b.PutString(i.ID) - if err := i.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field location: %w", err) - } - b.PutInt32(i.LivePeriod) - b.PutString(i.Title) - b.PutString(i.ThumbnailURL) - b.PutInt32(i.ThumbnailWidth) - b.PutInt32(i.ThumbnailHeight) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field reply_markup: %w", err) - } - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field input_message_content is nil") - } - if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultLocation) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultLocation#8f7cbe56 to nil") - } - if err := b.ConsumeID(InputInlineQueryResultLocationTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultLocation) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultLocation#8f7cbe56 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field id: %w", err) - } - i.ID = value - } - { - if err := i.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field location: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field live_period: %w", err) - } - i.LivePeriod = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_width: %w", err) - } - i.ThumbnailWidth = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_height: %w", err) - } - i.ThumbnailHeight = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field input_message_content: %w", err) - } - i.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultLocation) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultLocation#8f7cbe56 as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultLocation") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("location") - if err := i.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field location: %w", err) - } - b.Comma() - b.FieldStart("live_period") - b.PutInt32(i.LivePeriod) - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("thumbnail_url") - b.PutString(i.ThumbnailURL) - b.Comma() - b.FieldStart("thumbnail_width") - b.PutInt32(i.ThumbnailWidth) - b.Comma() - b.FieldStart("thumbnail_height") - b.PutInt32(i.ThumbnailHeight) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field input_message_content is nil") - } - if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultLocation#8f7cbe56: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultLocation) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultLocation#8f7cbe56 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultLocation"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field id: %w", err) - } - i.ID = value - case "location": - if err := i.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field location: %w", err) - } - case "live_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field live_period: %w", err) - } - i.LivePeriod = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field title: %w", err) - } - i.Title = value - case "thumbnail_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - case "thumbnail_width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_width: %w", err) - } - i.ThumbnailWidth = value - case "thumbnail_height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field thumbnail_height: %w", err) - } - i.ThumbnailHeight = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field reply_markup: %w", err) - } - i.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultLocation#8f7cbe56: field input_message_content: %w", err) - } - i.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultLocation) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetLocation returns value of Location field. -func (i *InputInlineQueryResultLocation) GetLocation() (value Location) { - if i == nil { - return - } - return i.Location -} - -// GetLivePeriod returns value of LivePeriod field. -func (i *InputInlineQueryResultLocation) GetLivePeriod() (value int32) { - if i == nil { - return - } - return i.LivePeriod -} - -// GetTitle returns value of Title field. -func (i *InputInlineQueryResultLocation) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetThumbnailURL returns value of ThumbnailURL field. -func (i *InputInlineQueryResultLocation) GetThumbnailURL() (value string) { - if i == nil { - return - } - return i.ThumbnailURL -} - -// GetThumbnailWidth returns value of ThumbnailWidth field. -func (i *InputInlineQueryResultLocation) GetThumbnailWidth() (value int32) { - if i == nil { - return - } - return i.ThumbnailWidth -} - -// GetThumbnailHeight returns value of ThumbnailHeight field. -func (i *InputInlineQueryResultLocation) GetThumbnailHeight() (value int32) { - if i == nil { - return - } - return i.ThumbnailHeight -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultLocation) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (i *InputInlineQueryResultLocation) GetInputMessageContent() (value InputMessageContentClass) { - if i == nil { - return - } - return i.InputMessageContent -} - -// InputInlineQueryResultPhoto represents TL type `inputInlineQueryResultPhoto#bd0b361f`. -type InputInlineQueryResultPhoto struct { - // Unique identifier of the query result - ID string - // Title of the result, if known - Title string - // Represents link to a JPEG image - Description string - // URL of the photo thumbnail, if it exists - ThumbnailURL string - // The URL of the JPEG photo (photo size must not exceed 5MB) - PhotoURL string - // Width of the photo - PhotoWidth int32 - // Height of the photo - PhotoHeight int32 - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent. Must be one of the following types: - // inputMessageText, inputMessagePhoto, inputMessageInvoice, inputMessageLocation, - // inputMessageVenue or inputMessageContact - InputMessageContent InputMessageContentClass -} - -// InputInlineQueryResultPhotoTypeID is TL type id of InputInlineQueryResultPhoto. -const InputInlineQueryResultPhotoTypeID = 0xbd0b361f - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultPhoto) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultPhoto. -var ( - _ bin.Encoder = &InputInlineQueryResultPhoto{} - _ bin.Decoder = &InputInlineQueryResultPhoto{} - _ bin.BareEncoder = &InputInlineQueryResultPhoto{} - _ bin.BareDecoder = &InputInlineQueryResultPhoto{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultPhoto{} -) - -func (i *InputInlineQueryResultPhoto) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Description == "") { - return false - } - if !(i.ThumbnailURL == "") { - return false - } - if !(i.PhotoURL == "") { - return false - } - if !(i.PhotoWidth == 0) { - return false - } - if !(i.PhotoHeight == 0) { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - if !(i.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultPhoto) String() string { - if i == nil { - return "InputInlineQueryResultPhoto(nil)" - } - type Alias InputInlineQueryResultPhoto - return fmt.Sprintf("InputInlineQueryResultPhoto%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultPhoto) TypeID() uint32 { - return InputInlineQueryResultPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultPhoto) TypeName() string { - return "inputInlineQueryResultPhoto" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultPhoto", - ID: InputInlineQueryResultPhotoTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "ThumbnailURL", - SchemaName: "thumbnail_url", - }, - { - Name: "PhotoURL", - SchemaName: "photo_url", - }, - { - Name: "PhotoWidth", - SchemaName: "photo_width", - }, - { - Name: "PhotoHeight", - SchemaName: "photo_height", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultPhoto) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultPhoto#bd0b361f as nil") - } - b.PutID(InputInlineQueryResultPhotoTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultPhoto) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultPhoto#bd0b361f as nil") - } - b.PutString(i.ID) - b.PutString(i.Title) - b.PutString(i.Description) - b.PutString(i.ThumbnailURL) - b.PutString(i.PhotoURL) - b.PutInt32(i.PhotoWidth) - b.PutInt32(i.PhotoHeight) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field reply_markup: %w", err) - } - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field input_message_content is nil") - } - if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultPhoto) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultPhoto#bd0b361f to nil") - } - if err := b.ConsumeID(InputInlineQueryResultPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultPhoto) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultPhoto#bd0b361f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field id: %w", err) - } - i.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field description: %w", err) - } - i.Description = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_url: %w", err) - } - i.PhotoURL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_width: %w", err) - } - i.PhotoWidth = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_height: %w", err) - } - i.PhotoHeight = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field input_message_content: %w", err) - } - i.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultPhoto#bd0b361f as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultPhoto") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("description") - b.PutString(i.Description) - b.Comma() - b.FieldStart("thumbnail_url") - b.PutString(i.ThumbnailURL) - b.Comma() - b.FieldStart("photo_url") - b.PutString(i.PhotoURL) - b.Comma() - b.FieldStart("photo_width") - b.PutInt32(i.PhotoWidth) - b.Comma() - b.FieldStart("photo_height") - b.PutInt32(i.PhotoHeight) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field input_message_content is nil") - } - if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultPhoto#bd0b361f: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultPhoto#bd0b361f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultPhoto"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field id: %w", err) - } - i.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field title: %w", err) - } - i.Title = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field description: %w", err) - } - i.Description = value - case "thumbnail_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - case "photo_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_url: %w", err) - } - i.PhotoURL = value - case "photo_width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_width: %w", err) - } - i.PhotoWidth = value - case "photo_height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field photo_height: %w", err) - } - i.PhotoHeight = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field reply_markup: %w", err) - } - i.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultPhoto#bd0b361f: field input_message_content: %w", err) - } - i.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultPhoto) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetTitle returns value of Title field. -func (i *InputInlineQueryResultPhoto) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetDescription returns value of Description field. -func (i *InputInlineQueryResultPhoto) GetDescription() (value string) { - if i == nil { - return - } - return i.Description -} - -// GetThumbnailURL returns value of ThumbnailURL field. -func (i *InputInlineQueryResultPhoto) GetThumbnailURL() (value string) { - if i == nil { - return - } - return i.ThumbnailURL -} - -// GetPhotoURL returns value of PhotoURL field. -func (i *InputInlineQueryResultPhoto) GetPhotoURL() (value string) { - if i == nil { - return - } - return i.PhotoURL -} - -// GetPhotoWidth returns value of PhotoWidth field. -func (i *InputInlineQueryResultPhoto) GetPhotoWidth() (value int32) { - if i == nil { - return - } - return i.PhotoWidth -} - -// GetPhotoHeight returns value of PhotoHeight field. -func (i *InputInlineQueryResultPhoto) GetPhotoHeight() (value int32) { - if i == nil { - return - } - return i.PhotoHeight -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultPhoto) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (i *InputInlineQueryResultPhoto) GetInputMessageContent() (value InputMessageContentClass) { - if i == nil { - return - } - return i.InputMessageContent -} - -// InputInlineQueryResultSticker represents TL type `inputInlineQueryResultSticker#10550459`. -type InputInlineQueryResultSticker struct { - // Unique identifier of the query result - ID string - // URL of the sticker thumbnail, if it exists - ThumbnailURL string - // The URL of the WEBP, TGS, or WEBM sticker (sticker file size must not exceed 5MB) - StickerURL string - // Width of the sticker - StickerWidth int32 - // Height of the sticker - StickerHeight int32 - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent. Must be one of the following types: - // inputMessageText, inputMessageSticker, inputMessageInvoice, inputMessageLocation, - // inputMessageVenue or inputMessageContact - InputMessageContent InputMessageContentClass -} - -// InputInlineQueryResultStickerTypeID is TL type id of InputInlineQueryResultSticker. -const InputInlineQueryResultStickerTypeID = 0x10550459 - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultSticker) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultSticker. -var ( - _ bin.Encoder = &InputInlineQueryResultSticker{} - _ bin.Decoder = &InputInlineQueryResultSticker{} - _ bin.BareEncoder = &InputInlineQueryResultSticker{} - _ bin.BareDecoder = &InputInlineQueryResultSticker{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultSticker{} -) - -func (i *InputInlineQueryResultSticker) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.ThumbnailURL == "") { - return false - } - if !(i.StickerURL == "") { - return false - } - if !(i.StickerWidth == 0) { - return false - } - if !(i.StickerHeight == 0) { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - if !(i.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultSticker) String() string { - if i == nil { - return "InputInlineQueryResultSticker(nil)" - } - type Alias InputInlineQueryResultSticker - return fmt.Sprintf("InputInlineQueryResultSticker%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultSticker) TypeID() uint32 { - return InputInlineQueryResultStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultSticker) TypeName() string { - return "inputInlineQueryResultSticker" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultSticker", - ID: InputInlineQueryResultStickerTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "ThumbnailURL", - SchemaName: "thumbnail_url", - }, - { - Name: "StickerURL", - SchemaName: "sticker_url", - }, - { - Name: "StickerWidth", - SchemaName: "sticker_width", - }, - { - Name: "StickerHeight", - SchemaName: "sticker_height", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultSticker) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultSticker#10550459 as nil") - } - b.PutID(InputInlineQueryResultStickerTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultSticker) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultSticker#10550459 as nil") - } - b.PutString(i.ID) - b.PutString(i.ThumbnailURL) - b.PutString(i.StickerURL) - b.PutInt32(i.StickerWidth) - b.PutInt32(i.StickerHeight) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field reply_markup: %w", err) - } - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field input_message_content is nil") - } - if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultSticker) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultSticker#10550459 to nil") - } - if err := b.ConsumeID(InputInlineQueryResultStickerTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultSticker) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultSticker#10550459 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field id: %w", err) - } - i.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_url: %w", err) - } - i.StickerURL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_width: %w", err) - } - i.StickerWidth = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_height: %w", err) - } - i.StickerHeight = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field input_message_content: %w", err) - } - i.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultSticker#10550459 as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultSticker") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("thumbnail_url") - b.PutString(i.ThumbnailURL) - b.Comma() - b.FieldStart("sticker_url") - b.PutString(i.StickerURL) - b.Comma() - b.FieldStart("sticker_width") - b.PutInt32(i.StickerWidth) - b.Comma() - b.FieldStart("sticker_height") - b.PutInt32(i.StickerHeight) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field input_message_content is nil") - } - if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultSticker#10550459: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultSticker#10550459 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultSticker"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field id: %w", err) - } - i.ID = value - case "thumbnail_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - case "sticker_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_url: %w", err) - } - i.StickerURL = value - case "sticker_width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_width: %w", err) - } - i.StickerWidth = value - case "sticker_height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field sticker_height: %w", err) - } - i.StickerHeight = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field reply_markup: %w", err) - } - i.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultSticker#10550459: field input_message_content: %w", err) - } - i.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultSticker) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetThumbnailURL returns value of ThumbnailURL field. -func (i *InputInlineQueryResultSticker) GetThumbnailURL() (value string) { - if i == nil { - return - } - return i.ThumbnailURL -} - -// GetStickerURL returns value of StickerURL field. -func (i *InputInlineQueryResultSticker) GetStickerURL() (value string) { - if i == nil { - return - } - return i.StickerURL -} - -// GetStickerWidth returns value of StickerWidth field. -func (i *InputInlineQueryResultSticker) GetStickerWidth() (value int32) { - if i == nil { - return - } - return i.StickerWidth -} - -// GetStickerHeight returns value of StickerHeight field. -func (i *InputInlineQueryResultSticker) GetStickerHeight() (value int32) { - if i == nil { - return - } - return i.StickerHeight -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultSticker) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (i *InputInlineQueryResultSticker) GetInputMessageContent() (value InputMessageContentClass) { - if i == nil { - return - } - return i.InputMessageContent -} - -// InputInlineQueryResultVenue represents TL type `inputInlineQueryResultVenue#2049c13d`. -type InputInlineQueryResultVenue struct { - // Unique identifier of the query result - ID string - // Venue result - Venue Venue - // URL of the result thumbnail, if it exists - ThumbnailURL string - // Thumbnail width, if known - ThumbnailWidth int32 - // Thumbnail height, if known - ThumbnailHeight int32 - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent. Must be one of the following types: - // inputMessageText, inputMessageInvoice, inputMessageLocation, inputMessageVenue or - // inputMessageContact - InputMessageContent InputMessageContentClass -} - -// InputInlineQueryResultVenueTypeID is TL type id of InputInlineQueryResultVenue. -const InputInlineQueryResultVenueTypeID = 0x2049c13d - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultVenue) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultVenue. -var ( - _ bin.Encoder = &InputInlineQueryResultVenue{} - _ bin.Decoder = &InputInlineQueryResultVenue{} - _ bin.BareEncoder = &InputInlineQueryResultVenue{} - _ bin.BareDecoder = &InputInlineQueryResultVenue{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultVenue{} -) - -func (i *InputInlineQueryResultVenue) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Venue.Zero()) { - return false - } - if !(i.ThumbnailURL == "") { - return false - } - if !(i.ThumbnailWidth == 0) { - return false - } - if !(i.ThumbnailHeight == 0) { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - if !(i.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultVenue) String() string { - if i == nil { - return "InputInlineQueryResultVenue(nil)" - } - type Alias InputInlineQueryResultVenue - return fmt.Sprintf("InputInlineQueryResultVenue%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultVenue) TypeID() uint32 { - return InputInlineQueryResultVenueTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultVenue) TypeName() string { - return "inputInlineQueryResultVenue" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultVenue) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultVenue", - ID: InputInlineQueryResultVenueTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Venue", - SchemaName: "venue", - }, - { - Name: "ThumbnailURL", - SchemaName: "thumbnail_url", - }, - { - Name: "ThumbnailWidth", - SchemaName: "thumbnail_width", - }, - { - Name: "ThumbnailHeight", - SchemaName: "thumbnail_height", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultVenue) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultVenue#2049c13d as nil") - } - b.PutID(InputInlineQueryResultVenueTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultVenue) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultVenue#2049c13d as nil") - } - b.PutString(i.ID) - if err := i.Venue.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field venue: %w", err) - } - b.PutString(i.ThumbnailURL) - b.PutInt32(i.ThumbnailWidth) - b.PutInt32(i.ThumbnailHeight) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field reply_markup: %w", err) - } - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field input_message_content is nil") - } - if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultVenue) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultVenue#2049c13d to nil") - } - if err := b.ConsumeID(InputInlineQueryResultVenueTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultVenue) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultVenue#2049c13d to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field id: %w", err) - } - i.ID = value - } - { - if err := i.Venue.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field venue: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_width: %w", err) - } - i.ThumbnailWidth = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_height: %w", err) - } - i.ThumbnailHeight = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field input_message_content: %w", err) - } - i.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultVenue) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultVenue#2049c13d as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultVenue") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("venue") - if err := i.Venue.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field venue: %w", err) - } - b.Comma() - b.FieldStart("thumbnail_url") - b.PutString(i.ThumbnailURL) - b.Comma() - b.FieldStart("thumbnail_width") - b.PutInt32(i.ThumbnailWidth) - b.Comma() - b.FieldStart("thumbnail_height") - b.PutInt32(i.ThumbnailHeight) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field input_message_content is nil") - } - if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVenue#2049c13d: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultVenue) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultVenue#2049c13d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultVenue"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field id: %w", err) - } - i.ID = value - case "venue": - if err := i.Venue.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field venue: %w", err) - } - case "thumbnail_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - case "thumbnail_width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_width: %w", err) - } - i.ThumbnailWidth = value - case "thumbnail_height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field thumbnail_height: %w", err) - } - i.ThumbnailHeight = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field reply_markup: %w", err) - } - i.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVenue#2049c13d: field input_message_content: %w", err) - } - i.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultVenue) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetVenue returns value of Venue field. -func (i *InputInlineQueryResultVenue) GetVenue() (value Venue) { - if i == nil { - return - } - return i.Venue -} - -// GetThumbnailURL returns value of ThumbnailURL field. -func (i *InputInlineQueryResultVenue) GetThumbnailURL() (value string) { - if i == nil { - return - } - return i.ThumbnailURL -} - -// GetThumbnailWidth returns value of ThumbnailWidth field. -func (i *InputInlineQueryResultVenue) GetThumbnailWidth() (value int32) { - if i == nil { - return - } - return i.ThumbnailWidth -} - -// GetThumbnailHeight returns value of ThumbnailHeight field. -func (i *InputInlineQueryResultVenue) GetThumbnailHeight() (value int32) { - if i == nil { - return - } - return i.ThumbnailHeight -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultVenue) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (i *InputInlineQueryResultVenue) GetInputMessageContent() (value InputMessageContentClass) { - if i == nil { - return - } - return i.InputMessageContent -} - -// InputInlineQueryResultVideo represents TL type `inputInlineQueryResultVideo#66c344e7`. -type InputInlineQueryResultVideo struct { - // Unique identifier of the query result - ID string - // Title of the result - Title string - // Represents a link to a page containing an embedded video player or a video file - Description string - // The URL of the video thumbnail (JPEG), if it exists - ThumbnailURL string - // URL of the embedded video player or video file - VideoURL string - // MIME type of the content of the video URL, only "text/html" or "video/mp4" are - // currently supported - MimeType string - // Width of the video - VideoWidth int32 - // Height of the video - VideoHeight int32 - // Video duration, in seconds - VideoDuration int32 - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent. Must be one of the following types: - // inputMessageText, inputMessageVideo, inputMessageInvoice, inputMessageLocation, - // inputMessageVenue or inputMessageContact - InputMessageContent InputMessageContentClass -} - -// InputInlineQueryResultVideoTypeID is TL type id of InputInlineQueryResultVideo. -const InputInlineQueryResultVideoTypeID = 0x66c344e7 - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultVideo) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultVideo. -var ( - _ bin.Encoder = &InputInlineQueryResultVideo{} - _ bin.Decoder = &InputInlineQueryResultVideo{} - _ bin.BareEncoder = &InputInlineQueryResultVideo{} - _ bin.BareDecoder = &InputInlineQueryResultVideo{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultVideo{} -) - -func (i *InputInlineQueryResultVideo) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Description == "") { - return false - } - if !(i.ThumbnailURL == "") { - return false - } - if !(i.VideoURL == "") { - return false - } - if !(i.MimeType == "") { - return false - } - if !(i.VideoWidth == 0) { - return false - } - if !(i.VideoHeight == 0) { - return false - } - if !(i.VideoDuration == 0) { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - if !(i.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultVideo) String() string { - if i == nil { - return "InputInlineQueryResultVideo(nil)" - } - type Alias InputInlineQueryResultVideo - return fmt.Sprintf("InputInlineQueryResultVideo%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultVideo) TypeID() uint32 { - return InputInlineQueryResultVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultVideo) TypeName() string { - return "inputInlineQueryResultVideo" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultVideo", - ID: InputInlineQueryResultVideoTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "ThumbnailURL", - SchemaName: "thumbnail_url", - }, - { - Name: "VideoURL", - SchemaName: "video_url", - }, - { - Name: "MimeType", - SchemaName: "mime_type", - }, - { - Name: "VideoWidth", - SchemaName: "video_width", - }, - { - Name: "VideoHeight", - SchemaName: "video_height", - }, - { - Name: "VideoDuration", - SchemaName: "video_duration", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultVideo) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultVideo#66c344e7 as nil") - } - b.PutID(InputInlineQueryResultVideoTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultVideo) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultVideo#66c344e7 as nil") - } - b.PutString(i.ID) - b.PutString(i.Title) - b.PutString(i.Description) - b.PutString(i.ThumbnailURL) - b.PutString(i.VideoURL) - b.PutString(i.MimeType) - b.PutInt32(i.VideoWidth) - b.PutInt32(i.VideoHeight) - b.PutInt32(i.VideoDuration) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field reply_markup: %w", err) - } - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field input_message_content is nil") - } - if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultVideo) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultVideo#66c344e7 to nil") - } - if err := b.ConsumeID(InputInlineQueryResultVideoTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultVideo) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultVideo#66c344e7 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field id: %w", err) - } - i.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field description: %w", err) - } - i.Description = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_url: %w", err) - } - i.VideoURL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field mime_type: %w", err) - } - i.MimeType = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_width: %w", err) - } - i.VideoWidth = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_height: %w", err) - } - i.VideoHeight = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_duration: %w", err) - } - i.VideoDuration = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field input_message_content: %w", err) - } - i.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultVideo#66c344e7 as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultVideo") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("description") - b.PutString(i.Description) - b.Comma() - b.FieldStart("thumbnail_url") - b.PutString(i.ThumbnailURL) - b.Comma() - b.FieldStart("video_url") - b.PutString(i.VideoURL) - b.Comma() - b.FieldStart("mime_type") - b.PutString(i.MimeType) - b.Comma() - b.FieldStart("video_width") - b.PutInt32(i.VideoWidth) - b.Comma() - b.FieldStart("video_height") - b.PutInt32(i.VideoHeight) - b.Comma() - b.FieldStart("video_duration") - b.PutInt32(i.VideoDuration) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field input_message_content is nil") - } - if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVideo#66c344e7: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultVideo#66c344e7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultVideo"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field id: %w", err) - } - i.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field title: %w", err) - } - i.Title = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field description: %w", err) - } - i.Description = value - case "thumbnail_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field thumbnail_url: %w", err) - } - i.ThumbnailURL = value - case "video_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_url: %w", err) - } - i.VideoURL = value - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field mime_type: %w", err) - } - i.MimeType = value - case "video_width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_width: %w", err) - } - i.VideoWidth = value - case "video_height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_height: %w", err) - } - i.VideoHeight = value - case "video_duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field video_duration: %w", err) - } - i.VideoDuration = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field reply_markup: %w", err) - } - i.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVideo#66c344e7: field input_message_content: %w", err) - } - i.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultVideo) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetTitle returns value of Title field. -func (i *InputInlineQueryResultVideo) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetDescription returns value of Description field. -func (i *InputInlineQueryResultVideo) GetDescription() (value string) { - if i == nil { - return - } - return i.Description -} - -// GetThumbnailURL returns value of ThumbnailURL field. -func (i *InputInlineQueryResultVideo) GetThumbnailURL() (value string) { - if i == nil { - return - } - return i.ThumbnailURL -} - -// GetVideoURL returns value of VideoURL field. -func (i *InputInlineQueryResultVideo) GetVideoURL() (value string) { - if i == nil { - return - } - return i.VideoURL -} - -// GetMimeType returns value of MimeType field. -func (i *InputInlineQueryResultVideo) GetMimeType() (value string) { - if i == nil { - return - } - return i.MimeType -} - -// GetVideoWidth returns value of VideoWidth field. -func (i *InputInlineQueryResultVideo) GetVideoWidth() (value int32) { - if i == nil { - return - } - return i.VideoWidth -} - -// GetVideoHeight returns value of VideoHeight field. -func (i *InputInlineQueryResultVideo) GetVideoHeight() (value int32) { - if i == nil { - return - } - return i.VideoHeight -} - -// GetVideoDuration returns value of VideoDuration field. -func (i *InputInlineQueryResultVideo) GetVideoDuration() (value int32) { - if i == nil { - return - } - return i.VideoDuration -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultVideo) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (i *InputInlineQueryResultVideo) GetInputMessageContent() (value InputMessageContentClass) { - if i == nil { - return - } - return i.InputMessageContent -} - -// InputInlineQueryResultVoiceNote represents TL type `inputInlineQueryResultVoiceNote#954da949`. -type InputInlineQueryResultVoiceNote struct { - // Unique identifier of the query result - ID string - // Title of the voice note - Title string - // The URL of the voice note file - VoiceNoteURL string - // Duration of the voice note, in seconds - VoiceNoteDuration int32 - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent. Must be one of the following types: - // inputMessageText, inputMessageVoiceNote, inputMessageInvoice, inputMessageLocation, - // inputMessageVenue or inputMessageContact - InputMessageContent InputMessageContentClass -} - -// InputInlineQueryResultVoiceNoteTypeID is TL type id of InputInlineQueryResultVoiceNote. -const InputInlineQueryResultVoiceNoteTypeID = 0x954da949 - -// construct implements constructor of InputInlineQueryResultClass. -func (i InputInlineQueryResultVoiceNote) construct() InputInlineQueryResultClass { return &i } - -// Ensuring interfaces in compile-time for InputInlineQueryResultVoiceNote. -var ( - _ bin.Encoder = &InputInlineQueryResultVoiceNote{} - _ bin.Decoder = &InputInlineQueryResultVoiceNote{} - _ bin.BareEncoder = &InputInlineQueryResultVoiceNote{} - _ bin.BareDecoder = &InputInlineQueryResultVoiceNote{} - - _ InputInlineQueryResultClass = &InputInlineQueryResultVoiceNote{} -) - -func (i *InputInlineQueryResultVoiceNote) Zero() bool { - if i == nil { - return true - } - if !(i.ID == "") { - return false - } - if !(i.Title == "") { - return false - } - if !(i.VoiceNoteURL == "") { - return false - } - if !(i.VoiceNoteDuration == 0) { - return false - } - if !(i.ReplyMarkup == nil) { - return false - } - if !(i.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInlineQueryResultVoiceNote) String() string { - if i == nil { - return "InputInlineQueryResultVoiceNote(nil)" - } - type Alias InputInlineQueryResultVoiceNote - return fmt.Sprintf("InputInlineQueryResultVoiceNote%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInlineQueryResultVoiceNote) TypeID() uint32 { - return InputInlineQueryResultVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInlineQueryResultVoiceNote) TypeName() string { - return "inputInlineQueryResultVoiceNote" -} - -// TypeInfo returns info about TL type. -func (i *InputInlineQueryResultVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInlineQueryResultVoiceNote", - ID: InputInlineQueryResultVoiceNoteTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "VoiceNoteURL", - SchemaName: "voice_note_url", - }, - { - Name: "VoiceNoteDuration", - SchemaName: "voice_note_duration", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInlineQueryResultVoiceNote) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultVoiceNote#954da949 as nil") - } - b.PutID(InputInlineQueryResultVoiceNoteTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInlineQueryResultVoiceNote) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultVoiceNote#954da949 as nil") - } - b.PutString(i.ID) - b.PutString(i.Title) - b.PutString(i.VoiceNoteURL) - b.PutInt32(i.VoiceNoteDuration) - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field reply_markup is nil") - } - if err := i.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field reply_markup: %w", err) - } - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field input_message_content is nil") - } - if err := i.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInlineQueryResultVoiceNote) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultVoiceNote#954da949 to nil") - } - if err := b.ConsumeID(InputInlineQueryResultVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInlineQueryResultVoiceNote) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultVoiceNote#954da949 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field id: %w", err) - } - i.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field voice_note_url: %w", err) - } - i.VoiceNoteURL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field voice_note_duration: %w", err) - } - i.VoiceNoteDuration = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field reply_markup: %w", err) - } - i.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field input_message_content: %w", err) - } - i.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInlineQueryResultVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInlineQueryResultVoiceNote#954da949 as nil") - } - b.ObjStart() - b.PutID("inputInlineQueryResultVoiceNote") - b.Comma() - b.FieldStart("id") - b.PutString(i.ID) - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("voice_note_url") - b.PutString(i.VoiceNoteURL) - b.Comma() - b.FieldStart("voice_note_duration") - b.PutInt32(i.VoiceNoteDuration) - b.Comma() - b.FieldStart("reply_markup") - if i.ReplyMarkup == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field reply_markup is nil") - } - if err := i.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if i.InputMessageContent == nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field input_message_content is nil") - } - if err := i.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInlineQueryResultVoiceNote#954da949: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInlineQueryResultVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInlineQueryResultVoiceNote#954da949 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInlineQueryResultVoiceNote"); err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field id: %w", err) - } - i.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field title: %w", err) - } - i.Title = value - case "voice_note_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field voice_note_url: %w", err) - } - i.VoiceNoteURL = value - case "voice_note_duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field voice_note_duration: %w", err) - } - i.VoiceNoteDuration = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field reply_markup: %w", err) - } - i.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode inputInlineQueryResultVoiceNote#954da949: field input_message_content: %w", err) - } - i.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (i *InputInlineQueryResultVoiceNote) GetID() (value string) { - if i == nil { - return - } - return i.ID -} - -// GetTitle returns value of Title field. -func (i *InputInlineQueryResultVoiceNote) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetVoiceNoteURL returns value of VoiceNoteURL field. -func (i *InputInlineQueryResultVoiceNote) GetVoiceNoteURL() (value string) { - if i == nil { - return - } - return i.VoiceNoteURL -} - -// GetVoiceNoteDuration returns value of VoiceNoteDuration field. -func (i *InputInlineQueryResultVoiceNote) GetVoiceNoteDuration() (value int32) { - if i == nil { - return - } - return i.VoiceNoteDuration -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (i *InputInlineQueryResultVoiceNote) GetReplyMarkup() (value ReplyMarkupClass) { - if i == nil { - return - } - return i.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (i *InputInlineQueryResultVoiceNote) GetInputMessageContent() (value InputMessageContentClass) { - if i == nil { - return - } - return i.InputMessageContent -} - -// InputInlineQueryResultClassName is schema name of InputInlineQueryResultClass. -const InputInlineQueryResultClassName = "InputInlineQueryResult" - -// InputInlineQueryResultClass represents InputInlineQueryResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputInlineQueryResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputInlineQueryResultAnimation: // inputInlineQueryResultAnimation#a7335216 -// case *tdapi.InputInlineQueryResultArticle: // inputInlineQueryResultArticle#763583bc -// case *tdapi.InputInlineQueryResultAudio: // inputInlineQueryResultAudio#4b1c35d4 -// case *tdapi.InputInlineQueryResultContact: // inputInlineQueryResultContact#6e08b5d2 -// case *tdapi.InputInlineQueryResultDocument: // inputInlineQueryResultDocument#227fd0cd -// case *tdapi.InputInlineQueryResultGame: // inputInlineQueryResultGame#39951fd7 -// case *tdapi.InputInlineQueryResultLocation: // inputInlineQueryResultLocation#8f7cbe56 -// case *tdapi.InputInlineQueryResultPhoto: // inputInlineQueryResultPhoto#bd0b361f -// case *tdapi.InputInlineQueryResultSticker: // inputInlineQueryResultSticker#10550459 -// case *tdapi.InputInlineQueryResultVenue: // inputInlineQueryResultVenue#2049c13d -// case *tdapi.InputInlineQueryResultVideo: // inputInlineQueryResultVideo#66c344e7 -// case *tdapi.InputInlineQueryResultVoiceNote: // inputInlineQueryResultVoiceNote#954da949 -// default: panic(v) -// } -type InputInlineQueryResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputInlineQueryResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error - - // Unique identifier of the query result - GetID() (value string) - // The message reply markup; pass null if none. Must be of type replyMarkupInlineKeyboard - // or null - GetReplyMarkup() (value ReplyMarkupClass) -} - -// DecodeInputInlineQueryResult implements binary de-serialization for InputInlineQueryResultClass. -func DecodeInputInlineQueryResult(buf *bin.Buffer) (InputInlineQueryResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputInlineQueryResultAnimationTypeID: - // Decoding inputInlineQueryResultAnimation#a7335216. - v := InputInlineQueryResultAnimation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case InputInlineQueryResultArticleTypeID: - // Decoding inputInlineQueryResultArticle#763583bc. - v := InputInlineQueryResultArticle{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case InputInlineQueryResultAudioTypeID: - // Decoding inputInlineQueryResultAudio#4b1c35d4. - v := InputInlineQueryResultAudio{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case InputInlineQueryResultContactTypeID: - // Decoding inputInlineQueryResultContact#6e08b5d2. - v := InputInlineQueryResultContact{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case InputInlineQueryResultDocumentTypeID: - // Decoding inputInlineQueryResultDocument#227fd0cd. - v := InputInlineQueryResultDocument{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case InputInlineQueryResultGameTypeID: - // Decoding inputInlineQueryResultGame#39951fd7. - v := InputInlineQueryResultGame{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case InputInlineQueryResultLocationTypeID: - // Decoding inputInlineQueryResultLocation#8f7cbe56. - v := InputInlineQueryResultLocation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case InputInlineQueryResultPhotoTypeID: - // Decoding inputInlineQueryResultPhoto#bd0b361f. - v := InputInlineQueryResultPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case InputInlineQueryResultStickerTypeID: - // Decoding inputInlineQueryResultSticker#10550459. - v := InputInlineQueryResultSticker{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case InputInlineQueryResultVenueTypeID: - // Decoding inputInlineQueryResultVenue#2049c13d. - v := InputInlineQueryResultVenue{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case InputInlineQueryResultVideoTypeID: - // Decoding inputInlineQueryResultVideo#66c344e7. - v := InputInlineQueryResultVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case InputInlineQueryResultVoiceNoteTypeID: - // Decoding inputInlineQueryResultVoiceNote#954da949. - v := InputInlineQueryResultVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputInlineQueryResult implements binary de-serialization for InputInlineQueryResultClass. -func DecodeTDLibJSONInputInlineQueryResult(buf tdjson.Decoder) (InputInlineQueryResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputInlineQueryResultAnimation": - // Decoding inputInlineQueryResultAnimation#a7335216. - v := InputInlineQueryResultAnimation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case "inputInlineQueryResultArticle": - // Decoding inputInlineQueryResultArticle#763583bc. - v := InputInlineQueryResultArticle{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case "inputInlineQueryResultAudio": - // Decoding inputInlineQueryResultAudio#4b1c35d4. - v := InputInlineQueryResultAudio{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case "inputInlineQueryResultContact": - // Decoding inputInlineQueryResultContact#6e08b5d2. - v := InputInlineQueryResultContact{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case "inputInlineQueryResultDocument": - // Decoding inputInlineQueryResultDocument#227fd0cd. - v := InputInlineQueryResultDocument{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case "inputInlineQueryResultGame": - // Decoding inputInlineQueryResultGame#39951fd7. - v := InputInlineQueryResultGame{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case "inputInlineQueryResultLocation": - // Decoding inputInlineQueryResultLocation#8f7cbe56. - v := InputInlineQueryResultLocation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case "inputInlineQueryResultPhoto": - // Decoding inputInlineQueryResultPhoto#bd0b361f. - v := InputInlineQueryResultPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case "inputInlineQueryResultSticker": - // Decoding inputInlineQueryResultSticker#10550459. - v := InputInlineQueryResultSticker{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case "inputInlineQueryResultVenue": - // Decoding inputInlineQueryResultVenue#2049c13d. - v := InputInlineQueryResultVenue{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case "inputInlineQueryResultVideo": - // Decoding inputInlineQueryResultVideo#66c344e7. - v := InputInlineQueryResultVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - case "inputInlineQueryResultVoiceNote": - // Decoding inputInlineQueryResultVoiceNote#954da949. - v := InputInlineQueryResultVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputInlineQueryResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputInlineQueryResult boxes the InputInlineQueryResultClass providing a helper. -type InputInlineQueryResultBox struct { - InputInlineQueryResult InputInlineQueryResultClass -} - -// Decode implements bin.Decoder for InputInlineQueryResultBox. -func (b *InputInlineQueryResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputInlineQueryResultBox to nil") - } - v, err := DecodeInputInlineQueryResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputInlineQueryResult = v - return nil -} - -// Encode implements bin.Encode for InputInlineQueryResultBox. -func (b *InputInlineQueryResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputInlineQueryResult == nil { - return fmt.Errorf("unable to encode InputInlineQueryResultClass as nil") - } - return b.InputInlineQueryResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputInlineQueryResultBox. -func (b *InputInlineQueryResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputInlineQueryResultBox to nil") - } - v, err := DecodeTDLibJSONInputInlineQueryResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputInlineQueryResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputInlineQueryResultBox. -func (b *InputInlineQueryResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputInlineQueryResult == nil { - return fmt.Errorf("unable to encode InputInlineQueryResultClass as nil") - } - return b.InputInlineQueryResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_invoice_gen.go b/tdapi/tl_input_invoice_gen.go deleted file mode 100644 index 7f12d4e3f..000000000 --- a/tdapi/tl_input_invoice_gen.go +++ /dev/null @@ -1,727 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputInvoiceMessage represents TL type `inputInvoiceMessage#58dcea10`. -type InputInvoiceMessage struct { - // Chat identifier of the message - ChatID int64 - // Message identifier. Use messageProperties.can_be_paid to check whether the message can - // be used in the method - MessageID int64 -} - -// InputInvoiceMessageTypeID is TL type id of InputInvoiceMessage. -const InputInvoiceMessageTypeID = 0x58dcea10 - -// construct implements constructor of InputInvoiceClass. -func (i InputInvoiceMessage) construct() InputInvoiceClass { return &i } - -// Ensuring interfaces in compile-time for InputInvoiceMessage. -var ( - _ bin.Encoder = &InputInvoiceMessage{} - _ bin.Decoder = &InputInvoiceMessage{} - _ bin.BareEncoder = &InputInvoiceMessage{} - _ bin.BareDecoder = &InputInvoiceMessage{} - - _ InputInvoiceClass = &InputInvoiceMessage{} -) - -func (i *InputInvoiceMessage) Zero() bool { - if i == nil { - return true - } - if !(i.ChatID == 0) { - return false - } - if !(i.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInvoiceMessage) String() string { - if i == nil { - return "InputInvoiceMessage(nil)" - } - type Alias InputInvoiceMessage - return fmt.Sprintf("InputInvoiceMessage%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInvoiceMessage) TypeID() uint32 { - return InputInvoiceMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInvoiceMessage) TypeName() string { - return "inputInvoiceMessage" -} - -// TypeInfo returns info about TL type. -func (i *InputInvoiceMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInvoiceMessage", - ID: InputInvoiceMessageTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInvoiceMessage) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInvoiceMessage#58dcea10 as nil") - } - b.PutID(InputInvoiceMessageTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInvoiceMessage) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInvoiceMessage#58dcea10 as nil") - } - b.PutInt53(i.ChatID) - b.PutInt53(i.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInvoiceMessage) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInvoiceMessage#58dcea10 to nil") - } - if err := b.ConsumeID(InputInvoiceMessageTypeID); err != nil { - return fmt.Errorf("unable to decode inputInvoiceMessage#58dcea10: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInvoiceMessage) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInvoiceMessage#58dcea10 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputInvoiceMessage#58dcea10: field chat_id: %w", err) - } - i.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputInvoiceMessage#58dcea10: field message_id: %w", err) - } - i.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInvoiceMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInvoiceMessage#58dcea10 as nil") - } - b.ObjStart() - b.PutID("inputInvoiceMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(i.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(i.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInvoiceMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInvoiceMessage#58dcea10 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInvoiceMessage"); err != nil { - return fmt.Errorf("unable to decode inputInvoiceMessage#58dcea10: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputInvoiceMessage#58dcea10: field chat_id: %w", err) - } - i.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputInvoiceMessage#58dcea10: field message_id: %w", err) - } - i.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (i *InputInvoiceMessage) GetChatID() (value int64) { - if i == nil { - return - } - return i.ChatID -} - -// GetMessageID returns value of MessageID field. -func (i *InputInvoiceMessage) GetMessageID() (value int64) { - if i == nil { - return - } - return i.MessageID -} - -// InputInvoiceName represents TL type `inputInvoiceName#b1ca16f3`. -type InputInvoiceName struct { - // Name of the invoice - Name string -} - -// InputInvoiceNameTypeID is TL type id of InputInvoiceName. -const InputInvoiceNameTypeID = 0xb1ca16f3 - -// construct implements constructor of InputInvoiceClass. -func (i InputInvoiceName) construct() InputInvoiceClass { return &i } - -// Ensuring interfaces in compile-time for InputInvoiceName. -var ( - _ bin.Encoder = &InputInvoiceName{} - _ bin.Decoder = &InputInvoiceName{} - _ bin.BareEncoder = &InputInvoiceName{} - _ bin.BareDecoder = &InputInvoiceName{} - - _ InputInvoiceClass = &InputInvoiceName{} -) - -func (i *InputInvoiceName) Zero() bool { - if i == nil { - return true - } - if !(i.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInvoiceName) String() string { - if i == nil { - return "InputInvoiceName(nil)" - } - type Alias InputInvoiceName - return fmt.Sprintf("InputInvoiceName%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInvoiceName) TypeID() uint32 { - return InputInvoiceNameTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInvoiceName) TypeName() string { - return "inputInvoiceName" -} - -// TypeInfo returns info about TL type. -func (i *InputInvoiceName) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInvoiceName", - ID: InputInvoiceNameTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInvoiceName) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInvoiceName#b1ca16f3 as nil") - } - b.PutID(InputInvoiceNameTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInvoiceName) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInvoiceName#b1ca16f3 as nil") - } - b.PutString(i.Name) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInvoiceName) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInvoiceName#b1ca16f3 to nil") - } - if err := b.ConsumeID(InputInvoiceNameTypeID); err != nil { - return fmt.Errorf("unable to decode inputInvoiceName#b1ca16f3: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInvoiceName) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInvoiceName#b1ca16f3 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInvoiceName#b1ca16f3: field name: %w", err) - } - i.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInvoiceName) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInvoiceName#b1ca16f3 as nil") - } - b.ObjStart() - b.PutID("inputInvoiceName") - b.Comma() - b.FieldStart("name") - b.PutString(i.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInvoiceName) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInvoiceName#b1ca16f3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInvoiceName"); err != nil { - return fmt.Errorf("unable to decode inputInvoiceName#b1ca16f3: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputInvoiceName#b1ca16f3: field name: %w", err) - } - i.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (i *InputInvoiceName) GetName() (value string) { - if i == nil { - return - } - return i.Name -} - -// InputInvoiceTelegram represents TL type `inputInvoiceTelegram#96ecfeed`. -type InputInvoiceTelegram struct { - // Transaction purpose - Purpose TelegramPaymentPurposeClass -} - -// InputInvoiceTelegramTypeID is TL type id of InputInvoiceTelegram. -const InputInvoiceTelegramTypeID = 0x96ecfeed - -// construct implements constructor of InputInvoiceClass. -func (i InputInvoiceTelegram) construct() InputInvoiceClass { return &i } - -// Ensuring interfaces in compile-time for InputInvoiceTelegram. -var ( - _ bin.Encoder = &InputInvoiceTelegram{} - _ bin.Decoder = &InputInvoiceTelegram{} - _ bin.BareEncoder = &InputInvoiceTelegram{} - _ bin.BareDecoder = &InputInvoiceTelegram{} - - _ InputInvoiceClass = &InputInvoiceTelegram{} -) - -func (i *InputInvoiceTelegram) Zero() bool { - if i == nil { - return true - } - if !(i.Purpose == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputInvoiceTelegram) String() string { - if i == nil { - return "InputInvoiceTelegram(nil)" - } - type Alias InputInvoiceTelegram - return fmt.Sprintf("InputInvoiceTelegram%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputInvoiceTelegram) TypeID() uint32 { - return InputInvoiceTelegramTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputInvoiceTelegram) TypeName() string { - return "inputInvoiceTelegram" -} - -// TypeInfo returns info about TL type. -func (i *InputInvoiceTelegram) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputInvoiceTelegram", - ID: InputInvoiceTelegramTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Purpose", - SchemaName: "purpose", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputInvoiceTelegram) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInvoiceTelegram#96ecfeed as nil") - } - b.PutID(InputInvoiceTelegramTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputInvoiceTelegram) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputInvoiceTelegram#96ecfeed as nil") - } - if i.Purpose == nil { - return fmt.Errorf("unable to encode inputInvoiceTelegram#96ecfeed: field purpose is nil") - } - if err := i.Purpose.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputInvoiceTelegram#96ecfeed: field purpose: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputInvoiceTelegram) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInvoiceTelegram#96ecfeed to nil") - } - if err := b.ConsumeID(InputInvoiceTelegramTypeID); err != nil { - return fmt.Errorf("unable to decode inputInvoiceTelegram#96ecfeed: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputInvoiceTelegram) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputInvoiceTelegram#96ecfeed to nil") - } - { - value, err := DecodeTelegramPaymentPurpose(b) - if err != nil { - return fmt.Errorf("unable to decode inputInvoiceTelegram#96ecfeed: field purpose: %w", err) - } - i.Purpose = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputInvoiceTelegram) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputInvoiceTelegram#96ecfeed as nil") - } - b.ObjStart() - b.PutID("inputInvoiceTelegram") - b.Comma() - b.FieldStart("purpose") - if i.Purpose == nil { - return fmt.Errorf("unable to encode inputInvoiceTelegram#96ecfeed: field purpose is nil") - } - if err := i.Purpose.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputInvoiceTelegram#96ecfeed: field purpose: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputInvoiceTelegram) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputInvoiceTelegram#96ecfeed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputInvoiceTelegram"); err != nil { - return fmt.Errorf("unable to decode inputInvoiceTelegram#96ecfeed: %w", err) - } - case "purpose": - value, err := DecodeTDLibJSONTelegramPaymentPurpose(b) - if err != nil { - return fmt.Errorf("unable to decode inputInvoiceTelegram#96ecfeed: field purpose: %w", err) - } - i.Purpose = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPurpose returns value of Purpose field. -func (i *InputInvoiceTelegram) GetPurpose() (value TelegramPaymentPurposeClass) { - if i == nil { - return - } - return i.Purpose -} - -// InputInvoiceClassName is schema name of InputInvoiceClass. -const InputInvoiceClassName = "InputInvoice" - -// InputInvoiceClass represents InputInvoice generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputInvoice(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputInvoiceMessage: // inputInvoiceMessage#58dcea10 -// case *tdapi.InputInvoiceName: // inputInvoiceName#b1ca16f3 -// case *tdapi.InputInvoiceTelegram: // inputInvoiceTelegram#96ecfeed -// default: panic(v) -// } -type InputInvoiceClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputInvoiceClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInputInvoice implements binary de-serialization for InputInvoiceClass. -func DecodeInputInvoice(buf *bin.Buffer) (InputInvoiceClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputInvoiceMessageTypeID: - // Decoding inputInvoiceMessage#58dcea10. - v := InputInvoiceMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err) - } - return &v, nil - case InputInvoiceNameTypeID: - // Decoding inputInvoiceName#b1ca16f3. - v := InputInvoiceName{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err) - } - return &v, nil - case InputInvoiceTelegramTypeID: - // Decoding inputInvoiceTelegram#96ecfeed. - v := InputInvoiceTelegram{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputInvoice implements binary de-serialization for InputInvoiceClass. -func DecodeTDLibJSONInputInvoice(buf tdjson.Decoder) (InputInvoiceClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputInvoiceMessage": - // Decoding inputInvoiceMessage#58dcea10. - v := InputInvoiceMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err) - } - return &v, nil - case "inputInvoiceName": - // Decoding inputInvoiceName#b1ca16f3. - v := InputInvoiceName{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err) - } - return &v, nil - case "inputInvoiceTelegram": - // Decoding inputInvoiceTelegram#96ecfeed. - v := InputInvoiceTelegram{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputInvoiceClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputInvoice boxes the InputInvoiceClass providing a helper. -type InputInvoiceBox struct { - InputInvoice InputInvoiceClass -} - -// Decode implements bin.Decoder for InputInvoiceBox. -func (b *InputInvoiceBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputInvoiceBox to nil") - } - v, err := DecodeInputInvoice(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputInvoice = v - return nil -} - -// Encode implements bin.Encode for InputInvoiceBox. -func (b *InputInvoiceBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputInvoice == nil { - return fmt.Errorf("unable to encode InputInvoiceClass as nil") - } - return b.InputInvoice.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputInvoiceBox. -func (b *InputInvoiceBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputInvoiceBox to nil") - } - v, err := DecodeTDLibJSONInputInvoice(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputInvoice = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputInvoiceBox. -func (b *InputInvoiceBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputInvoice == nil { - return fmt.Errorf("unable to encode InputInvoiceClass as nil") - } - return b.InputInvoice.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_message_content_gen.go b/tdapi/tl_input_message_content_gen.go deleted file mode 100644 index 49b6e01b8..000000000 --- a/tdapi/tl_input_message_content_gen.go +++ /dev/null @@ -1,6562 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputMessageText represents TL type `inputMessageText#f350d894`. -type InputMessageText struct { - // Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only - // Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, - // ExpandableBlockQuote, - Text FormattedText - // Options to be used for generation of a link preview; may be null if none; pass null to - // use default link preview options - LinkPreviewOptions LinkPreviewOptions - // True, if a chat message draft must be deleted - ClearDraft bool -} - -// InputMessageTextTypeID is TL type id of InputMessageText. -const InputMessageTextTypeID = 0xf350d894 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageText) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageText. -var ( - _ bin.Encoder = &InputMessageText{} - _ bin.Decoder = &InputMessageText{} - _ bin.BareEncoder = &InputMessageText{} - _ bin.BareDecoder = &InputMessageText{} - - _ InputMessageContentClass = &InputMessageText{} -) - -func (i *InputMessageText) Zero() bool { - if i == nil { - return true - } - if !(i.Text.Zero()) { - return false - } - if !(i.LinkPreviewOptions.Zero()) { - return false - } - if !(i.ClearDraft == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageText) String() string { - if i == nil { - return "InputMessageText(nil)" - } - type Alias InputMessageText - return fmt.Sprintf("InputMessageText%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageText) TypeID() uint32 { - return InputMessageTextTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageText) TypeName() string { - return "inputMessageText" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageText) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageText", - ID: InputMessageTextTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "LinkPreviewOptions", - SchemaName: "link_preview_options", - }, - { - Name: "ClearDraft", - SchemaName: "clear_draft", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageText) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageText#f350d894 as nil") - } - b.PutID(InputMessageTextTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageText) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageText#f350d894 as nil") - } - if err := i.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageText#f350d894: field text: %w", err) - } - if err := i.LinkPreviewOptions.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageText#f350d894: field link_preview_options: %w", err) - } - b.PutBool(i.ClearDraft) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageText) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageText#f350d894 to nil") - } - if err := b.ConsumeID(InputMessageTextTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageText#f350d894: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageText) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageText#f350d894 to nil") - } - { - if err := i.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageText#f350d894: field text: %w", err) - } - } - { - if err := i.LinkPreviewOptions.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageText#f350d894: field link_preview_options: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageText#f350d894: field clear_draft: %w", err) - } - i.ClearDraft = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageText) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageText#f350d894 as nil") - } - b.ObjStart() - b.PutID("inputMessageText") - b.Comma() - b.FieldStart("text") - if err := i.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageText#f350d894: field text: %w", err) - } - b.Comma() - b.FieldStart("link_preview_options") - if err := i.LinkPreviewOptions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageText#f350d894: field link_preview_options: %w", err) - } - b.Comma() - b.FieldStart("clear_draft") - b.PutBool(i.ClearDraft) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageText) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageText#f350d894 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageText"); err != nil { - return fmt.Errorf("unable to decode inputMessageText#f350d894: %w", err) - } - case "text": - if err := i.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageText#f350d894: field text: %w", err) - } - case "link_preview_options": - if err := i.LinkPreviewOptions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageText#f350d894: field link_preview_options: %w", err) - } - case "clear_draft": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageText#f350d894: field clear_draft: %w", err) - } - i.ClearDraft = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (i *InputMessageText) GetText() (value FormattedText) { - if i == nil { - return - } - return i.Text -} - -// GetLinkPreviewOptions returns value of LinkPreviewOptions field. -func (i *InputMessageText) GetLinkPreviewOptions() (value LinkPreviewOptions) { - if i == nil { - return - } - return i.LinkPreviewOptions -} - -// GetClearDraft returns value of ClearDraft field. -func (i *InputMessageText) GetClearDraft() (value bool) { - if i == nil { - return - } - return i.ClearDraft -} - -// InputMessageAnimation represents TL type `inputMessageAnimation#19fe563`. -type InputMessageAnimation struct { - // Animation file to be sent - Animation InputFileClass - // Animation thumbnail; pass null to skip thumbnail uploading - Thumbnail InputThumbnail - // File identifiers of the stickers added to the animation, if applicable - AddedStickerFileIDs []int32 - // Duration of the animation, in seconds - Duration int32 - // Width of the animation; may be replaced by the server - Width int32 - // Height of the animation; may be replaced by the server - Height int32 - // Animation caption; pass null to use an empty caption; - // 0-getOption("message_caption_length_max") characters - Caption FormattedText - // True, if the caption must be shown above the animation; otherwise, the caption must be - // shown below the animation; not supported in secret chats - ShowCaptionAboveMedia bool - // True, if the animation preview must be covered by a spoiler animation; not supported - // in secret chats - HasSpoiler bool -} - -// InputMessageAnimationTypeID is TL type id of InputMessageAnimation. -const InputMessageAnimationTypeID = 0x19fe563 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageAnimation) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageAnimation. -var ( - _ bin.Encoder = &InputMessageAnimation{} - _ bin.Decoder = &InputMessageAnimation{} - _ bin.BareEncoder = &InputMessageAnimation{} - _ bin.BareDecoder = &InputMessageAnimation{} - - _ InputMessageContentClass = &InputMessageAnimation{} -) - -func (i *InputMessageAnimation) Zero() bool { - if i == nil { - return true - } - if !(i.Animation == nil) { - return false - } - if !(i.Thumbnail.Zero()) { - return false - } - if !(i.AddedStickerFileIDs == nil) { - return false - } - if !(i.Duration == 0) { - return false - } - if !(i.Width == 0) { - return false - } - if !(i.Height == 0) { - return false - } - if !(i.Caption.Zero()) { - return false - } - if !(i.ShowCaptionAboveMedia == false) { - return false - } - if !(i.HasSpoiler == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageAnimation) String() string { - if i == nil { - return "InputMessageAnimation(nil)" - } - type Alias InputMessageAnimation - return fmt.Sprintf("InputMessageAnimation%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageAnimation) TypeID() uint32 { - return InputMessageAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageAnimation) TypeName() string { - return "inputMessageAnimation" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageAnimation", - ID: InputMessageAnimationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Animation", - SchemaName: "animation", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "AddedStickerFileIDs", - SchemaName: "added_sticker_file_ids", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "ShowCaptionAboveMedia", - SchemaName: "show_caption_above_media", - }, - { - Name: "HasSpoiler", - SchemaName: "has_spoiler", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageAnimation) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageAnimation#19fe563 as nil") - } - b.PutID(InputMessageAnimationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageAnimation) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageAnimation#19fe563 as nil") - } - if i.Animation == nil { - return fmt.Errorf("unable to encode inputMessageAnimation#19fe563: field animation is nil") - } - if err := i.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAnimation#19fe563: field animation: %w", err) - } - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAnimation#19fe563: field thumbnail: %w", err) - } - b.PutInt(len(i.AddedStickerFileIDs)) - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - } - b.PutInt32(i.Duration) - b.PutInt32(i.Width) - b.PutInt32(i.Height) - if err := i.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAnimation#19fe563: field caption: %w", err) - } - b.PutBool(i.ShowCaptionAboveMedia) - b.PutBool(i.HasSpoiler) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageAnimation) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageAnimation#19fe563 to nil") - } - if err := b.ConsumeID(InputMessageAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageAnimation) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageAnimation#19fe563 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field animation: %w", err) - } - i.Animation = value - } - { - if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field thumbnail: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field added_sticker_file_ids: %w", err) - } - - if headerLen > 0 { - i.AddedStickerFileIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field duration: %w", err) - } - i.Duration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field width: %w", err) - } - i.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field height: %w", err) - } - i.Height = value - } - { - if err := i.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field show_caption_above_media: %w", err) - } - i.ShowCaptionAboveMedia = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field has_spoiler: %w", err) - } - i.HasSpoiler = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageAnimation#19fe563 as nil") - } - b.ObjStart() - b.PutID("inputMessageAnimation") - b.Comma() - b.FieldStart("animation") - if i.Animation == nil { - return fmt.Errorf("unable to encode inputMessageAnimation#19fe563: field animation is nil") - } - if err := i.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAnimation#19fe563: field animation: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAnimation#19fe563: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("added_sticker_file_ids") - b.ArrStart() - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("duration") - b.PutInt32(i.Duration) - b.Comma() - b.FieldStart("width") - b.PutInt32(i.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(i.Height) - b.Comma() - b.FieldStart("caption") - if err := i.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAnimation#19fe563: field caption: %w", err) - } - b.Comma() - b.FieldStart("show_caption_above_media") - b.PutBool(i.ShowCaptionAboveMedia) - b.Comma() - b.FieldStart("has_spoiler") - b.PutBool(i.HasSpoiler) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageAnimation#19fe563 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageAnimation"); err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: %w", err) - } - case "animation": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field animation: %w", err) - } - i.Animation = value - case "thumbnail": - if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field thumbnail: %w", err) - } - case "added_sticker_file_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field added_sticker_file_ids: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field duration: %w", err) - } - i.Duration = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field width: %w", err) - } - i.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field height: %w", err) - } - i.Height = value - case "caption": - if err := i.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field caption: %w", err) - } - case "show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field show_caption_above_media: %w", err) - } - i.ShowCaptionAboveMedia = value - case "has_spoiler": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAnimation#19fe563: field has_spoiler: %w", err) - } - i.HasSpoiler = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAnimation returns value of Animation field. -func (i *InputMessageAnimation) GetAnimation() (value InputFileClass) { - if i == nil { - return - } - return i.Animation -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InputMessageAnimation) GetThumbnail() (value InputThumbnail) { - if i == nil { - return - } - return i.Thumbnail -} - -// GetAddedStickerFileIDs returns value of AddedStickerFileIDs field. -func (i *InputMessageAnimation) GetAddedStickerFileIDs() (value []int32) { - if i == nil { - return - } - return i.AddedStickerFileIDs -} - -// GetDuration returns value of Duration field. -func (i *InputMessageAnimation) GetDuration() (value int32) { - if i == nil { - return - } - return i.Duration -} - -// GetWidth returns value of Width field. -func (i *InputMessageAnimation) GetWidth() (value int32) { - if i == nil { - return - } - return i.Width -} - -// GetHeight returns value of Height field. -func (i *InputMessageAnimation) GetHeight() (value int32) { - if i == nil { - return - } - return i.Height -} - -// GetCaption returns value of Caption field. -func (i *InputMessageAnimation) GetCaption() (value FormattedText) { - if i == nil { - return - } - return i.Caption -} - -// GetShowCaptionAboveMedia returns value of ShowCaptionAboveMedia field. -func (i *InputMessageAnimation) GetShowCaptionAboveMedia() (value bool) { - if i == nil { - return - } - return i.ShowCaptionAboveMedia -} - -// GetHasSpoiler returns value of HasSpoiler field. -func (i *InputMessageAnimation) GetHasSpoiler() (value bool) { - if i == nil { - return - } - return i.HasSpoiler -} - -// InputMessageAudio represents TL type `inputMessageAudio#daa400b2`. -type InputMessageAudio struct { - // Audio file to be sent - Audio InputFileClass - // Thumbnail of the cover for the album; pass null to skip thumbnail uploading - AlbumCoverThumbnail InputThumbnail - // Duration of the audio, in seconds; may be replaced by the server - Duration int32 - // Title of the audio; 0-64 characters; may be replaced by the server - Title string - // Performer of the audio; 0-64 characters, may be replaced by the server - Performer string - // Audio caption; pass null to use an empty caption; - // 0-getOption("message_caption_length_max") characters - Caption FormattedText -} - -// InputMessageAudioTypeID is TL type id of InputMessageAudio. -const InputMessageAudioTypeID = 0xdaa400b2 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageAudio) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageAudio. -var ( - _ bin.Encoder = &InputMessageAudio{} - _ bin.Decoder = &InputMessageAudio{} - _ bin.BareEncoder = &InputMessageAudio{} - _ bin.BareDecoder = &InputMessageAudio{} - - _ InputMessageContentClass = &InputMessageAudio{} -) - -func (i *InputMessageAudio) Zero() bool { - if i == nil { - return true - } - if !(i.Audio == nil) { - return false - } - if !(i.AlbumCoverThumbnail.Zero()) { - return false - } - if !(i.Duration == 0) { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Performer == "") { - return false - } - if !(i.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageAudio) String() string { - if i == nil { - return "InputMessageAudio(nil)" - } - type Alias InputMessageAudio - return fmt.Sprintf("InputMessageAudio%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageAudio) TypeID() uint32 { - return InputMessageAudioTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageAudio) TypeName() string { - return "inputMessageAudio" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageAudio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageAudio", - ID: InputMessageAudioTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Audio", - SchemaName: "audio", - }, - { - Name: "AlbumCoverThumbnail", - SchemaName: "album_cover_thumbnail", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Performer", - SchemaName: "performer", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageAudio) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageAudio#daa400b2 as nil") - } - b.PutID(InputMessageAudioTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageAudio) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageAudio#daa400b2 as nil") - } - if i.Audio == nil { - return fmt.Errorf("unable to encode inputMessageAudio#daa400b2: field audio is nil") - } - if err := i.Audio.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAudio#daa400b2: field audio: %w", err) - } - if err := i.AlbumCoverThumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAudio#daa400b2: field album_cover_thumbnail: %w", err) - } - b.PutInt32(i.Duration) - b.PutString(i.Title) - b.PutString(i.Performer) - if err := i.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAudio#daa400b2: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageAudio) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageAudio#daa400b2 to nil") - } - if err := b.ConsumeID(InputMessageAudioTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageAudio) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageAudio#daa400b2 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field audio: %w", err) - } - i.Audio = value - } - { - if err := i.AlbumCoverThumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field album_cover_thumbnail: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field duration: %w", err) - } - i.Duration = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field performer: %w", err) - } - i.Performer = value - } - { - if err := i.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageAudio) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageAudio#daa400b2 as nil") - } - b.ObjStart() - b.PutID("inputMessageAudio") - b.Comma() - b.FieldStart("audio") - if i.Audio == nil { - return fmt.Errorf("unable to encode inputMessageAudio#daa400b2: field audio is nil") - } - if err := i.Audio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAudio#daa400b2: field audio: %w", err) - } - b.Comma() - b.FieldStart("album_cover_thumbnail") - if err := i.AlbumCoverThumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAudio#daa400b2: field album_cover_thumbnail: %w", err) - } - b.Comma() - b.FieldStart("duration") - b.PutInt32(i.Duration) - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("performer") - b.PutString(i.Performer) - b.Comma() - b.FieldStart("caption") - if err := i.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageAudio#daa400b2: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageAudio) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageAudio#daa400b2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageAudio"); err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: %w", err) - } - case "audio": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field audio: %w", err) - } - i.Audio = value - case "album_cover_thumbnail": - if err := i.AlbumCoverThumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field album_cover_thumbnail: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field duration: %w", err) - } - i.Duration = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field title: %w", err) - } - i.Title = value - case "performer": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field performer: %w", err) - } - i.Performer = value - case "caption": - if err := i.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageAudio#daa400b2: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAudio returns value of Audio field. -func (i *InputMessageAudio) GetAudio() (value InputFileClass) { - if i == nil { - return - } - return i.Audio -} - -// GetAlbumCoverThumbnail returns value of AlbumCoverThumbnail field. -func (i *InputMessageAudio) GetAlbumCoverThumbnail() (value InputThumbnail) { - if i == nil { - return - } - return i.AlbumCoverThumbnail -} - -// GetDuration returns value of Duration field. -func (i *InputMessageAudio) GetDuration() (value int32) { - if i == nil { - return - } - return i.Duration -} - -// GetTitle returns value of Title field. -func (i *InputMessageAudio) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetPerformer returns value of Performer field. -func (i *InputMessageAudio) GetPerformer() (value string) { - if i == nil { - return - } - return i.Performer -} - -// GetCaption returns value of Caption field. -func (i *InputMessageAudio) GetCaption() (value FormattedText) { - if i == nil { - return - } - return i.Caption -} - -// InputMessageDocument represents TL type `inputMessageDocument#615b72b9`. -type InputMessageDocument struct { - // Document to be sent - Document InputFileClass - // Document thumbnail; pass null to skip thumbnail uploading - Thumbnail InputThumbnail - // Pass true to disable automatic file type detection and send the document as a file. - // Always true for files sent to secret chats - DisableContentTypeDetection bool - // Document caption; pass null to use an empty caption; - // 0-getOption("message_caption_length_max") characters - Caption FormattedText -} - -// InputMessageDocumentTypeID is TL type id of InputMessageDocument. -const InputMessageDocumentTypeID = 0x615b72b9 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageDocument) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageDocument. -var ( - _ bin.Encoder = &InputMessageDocument{} - _ bin.Decoder = &InputMessageDocument{} - _ bin.BareEncoder = &InputMessageDocument{} - _ bin.BareDecoder = &InputMessageDocument{} - - _ InputMessageContentClass = &InputMessageDocument{} -) - -func (i *InputMessageDocument) Zero() bool { - if i == nil { - return true - } - if !(i.Document == nil) { - return false - } - if !(i.Thumbnail.Zero()) { - return false - } - if !(i.DisableContentTypeDetection == false) { - return false - } - if !(i.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageDocument) String() string { - if i == nil { - return "InputMessageDocument(nil)" - } - type Alias InputMessageDocument - return fmt.Sprintf("InputMessageDocument%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageDocument) TypeID() uint32 { - return InputMessageDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageDocument) TypeName() string { - return "inputMessageDocument" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageDocument", - ID: InputMessageDocumentTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Document", - SchemaName: "document", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "DisableContentTypeDetection", - SchemaName: "disable_content_type_detection", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageDocument) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageDocument#615b72b9 as nil") - } - b.PutID(InputMessageDocumentTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageDocument) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageDocument#615b72b9 as nil") - } - if i.Document == nil { - return fmt.Errorf("unable to encode inputMessageDocument#615b72b9: field document is nil") - } - if err := i.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageDocument#615b72b9: field document: %w", err) - } - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageDocument#615b72b9: field thumbnail: %w", err) - } - b.PutBool(i.DisableContentTypeDetection) - if err := i.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageDocument#615b72b9: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageDocument) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageDocument#615b72b9 to nil") - } - if err := b.ConsumeID(InputMessageDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageDocument#615b72b9: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageDocument) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageDocument#615b72b9 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageDocument#615b72b9: field document: %w", err) - } - i.Document = value - } - { - if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageDocument#615b72b9: field thumbnail: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageDocument#615b72b9: field disable_content_type_detection: %w", err) - } - i.DisableContentTypeDetection = value - } - { - if err := i.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageDocument#615b72b9: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageDocument#615b72b9 as nil") - } - b.ObjStart() - b.PutID("inputMessageDocument") - b.Comma() - b.FieldStart("document") - if i.Document == nil { - return fmt.Errorf("unable to encode inputMessageDocument#615b72b9: field document is nil") - } - if err := i.Document.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageDocument#615b72b9: field document: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageDocument#615b72b9: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("disable_content_type_detection") - b.PutBool(i.DisableContentTypeDetection) - b.Comma() - b.FieldStart("caption") - if err := i.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageDocument#615b72b9: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageDocument#615b72b9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageDocument"); err != nil { - return fmt.Errorf("unable to decode inputMessageDocument#615b72b9: %w", err) - } - case "document": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageDocument#615b72b9: field document: %w", err) - } - i.Document = value - case "thumbnail": - if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageDocument#615b72b9: field thumbnail: %w", err) - } - case "disable_content_type_detection": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageDocument#615b72b9: field disable_content_type_detection: %w", err) - } - i.DisableContentTypeDetection = value - case "caption": - if err := i.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageDocument#615b72b9: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDocument returns value of Document field. -func (i *InputMessageDocument) GetDocument() (value InputFileClass) { - if i == nil { - return - } - return i.Document -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InputMessageDocument) GetThumbnail() (value InputThumbnail) { - if i == nil { - return - } - return i.Thumbnail -} - -// GetDisableContentTypeDetection returns value of DisableContentTypeDetection field. -func (i *InputMessageDocument) GetDisableContentTypeDetection() (value bool) { - if i == nil { - return - } - return i.DisableContentTypeDetection -} - -// GetCaption returns value of Caption field. -func (i *InputMessageDocument) GetCaption() (value FormattedText) { - if i == nil { - return - } - return i.Caption -} - -// InputMessagePaidMedia represents TL type `inputMessagePaidMedia#370c4490`. -type InputMessagePaidMedia struct { - // The number of Telegram Stars that must be paid to see the media; - // 1-getOption("paid_media_message_star_count_max") - StarCount int64 - // The content of the paid media - PaidMedia []InputPaidMedia - // Message caption; pass null to use an empty caption; - // 0-getOption("message_caption_length_max") characters - Caption FormattedText - // True, if the caption must be shown above the media; otherwise, the caption must be - // shown below the media; not supported in secret chats - ShowCaptionAboveMedia bool - // Bot-provided data for the paid media; bots only - Payload string -} - -// InputMessagePaidMediaTypeID is TL type id of InputMessagePaidMedia. -const InputMessagePaidMediaTypeID = 0x370c4490 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessagePaidMedia) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessagePaidMedia. -var ( - _ bin.Encoder = &InputMessagePaidMedia{} - _ bin.Decoder = &InputMessagePaidMedia{} - _ bin.BareEncoder = &InputMessagePaidMedia{} - _ bin.BareDecoder = &InputMessagePaidMedia{} - - _ InputMessageContentClass = &InputMessagePaidMedia{} -) - -func (i *InputMessagePaidMedia) Zero() bool { - if i == nil { - return true - } - if !(i.StarCount == 0) { - return false - } - if !(i.PaidMedia == nil) { - return false - } - if !(i.Caption.Zero()) { - return false - } - if !(i.ShowCaptionAboveMedia == false) { - return false - } - if !(i.Payload == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessagePaidMedia) String() string { - if i == nil { - return "InputMessagePaidMedia(nil)" - } - type Alias InputMessagePaidMedia - return fmt.Sprintf("InputMessagePaidMedia%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessagePaidMedia) TypeID() uint32 { - return InputMessagePaidMediaTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessagePaidMedia) TypeName() string { - return "inputMessagePaidMedia" -} - -// TypeInfo returns info about TL type. -func (i *InputMessagePaidMedia) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessagePaidMedia", - ID: InputMessagePaidMediaTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "PaidMedia", - SchemaName: "paid_media", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "ShowCaptionAboveMedia", - SchemaName: "show_caption_above_media", - }, - { - Name: "Payload", - SchemaName: "payload", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessagePaidMedia) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessagePaidMedia#370c4490 as nil") - } - b.PutID(InputMessagePaidMediaTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessagePaidMedia) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessagePaidMedia#370c4490 as nil") - } - b.PutInt53(i.StarCount) - b.PutInt(len(i.PaidMedia)) - for idx, v := range i.PaidMedia { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare inputMessagePaidMedia#370c4490: field paid_media element with index %d: %w", idx, err) - } - } - if err := i.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePaidMedia#370c4490: field caption: %w", err) - } - b.PutBool(i.ShowCaptionAboveMedia) - b.PutString(i.Payload) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessagePaidMedia) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessagePaidMedia#370c4490 to nil") - } - if err := b.ConsumeID(InputMessagePaidMediaTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessagePaidMedia) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessagePaidMedia#370c4490 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field star_count: %w", err) - } - i.StarCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field paid_media: %w", err) - } - - if headerLen > 0 { - i.PaidMedia = make([]InputPaidMedia, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value InputPaidMedia - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare inputMessagePaidMedia#370c4490: field paid_media: %w", err) - } - i.PaidMedia = append(i.PaidMedia, value) - } - } - { - if err := i.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field show_caption_above_media: %w", err) - } - i.ShowCaptionAboveMedia = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field payload: %w", err) - } - i.Payload = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessagePaidMedia) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessagePaidMedia#370c4490 as nil") - } - b.ObjStart() - b.PutID("inputMessagePaidMedia") - b.Comma() - b.FieldStart("star_count") - b.PutInt53(i.StarCount) - b.Comma() - b.FieldStart("paid_media") - b.ArrStart() - for idx, v := range i.PaidMedia { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePaidMedia#370c4490: field paid_media element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("caption") - if err := i.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePaidMedia#370c4490: field caption: %w", err) - } - b.Comma() - b.FieldStart("show_caption_above_media") - b.PutBool(i.ShowCaptionAboveMedia) - b.Comma() - b.FieldStart("payload") - b.PutString(i.Payload) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessagePaidMedia) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessagePaidMedia#370c4490 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessagePaidMedia"); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field star_count: %w", err) - } - i.StarCount = value - case "paid_media": - if err := b.Arr(func(b tdjson.Decoder) error { - var value InputPaidMedia - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field paid_media: %w", err) - } - i.PaidMedia = append(i.PaidMedia, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field paid_media: %w", err) - } - case "caption": - if err := i.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field caption: %w", err) - } - case "show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field show_caption_above_media: %w", err) - } - i.ShowCaptionAboveMedia = value - case "payload": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePaidMedia#370c4490: field payload: %w", err) - } - i.Payload = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarCount returns value of StarCount field. -func (i *InputMessagePaidMedia) GetStarCount() (value int64) { - if i == nil { - return - } - return i.StarCount -} - -// GetPaidMedia returns value of PaidMedia field. -func (i *InputMessagePaidMedia) GetPaidMedia() (value []InputPaidMedia) { - if i == nil { - return - } - return i.PaidMedia -} - -// GetCaption returns value of Caption field. -func (i *InputMessagePaidMedia) GetCaption() (value FormattedText) { - if i == nil { - return - } - return i.Caption -} - -// GetShowCaptionAboveMedia returns value of ShowCaptionAboveMedia field. -func (i *InputMessagePaidMedia) GetShowCaptionAboveMedia() (value bool) { - if i == nil { - return - } - return i.ShowCaptionAboveMedia -} - -// GetPayload returns value of Payload field. -func (i *InputMessagePaidMedia) GetPayload() (value string) { - if i == nil { - return - } - return i.Payload -} - -// InputMessagePhoto represents TL type `inputMessagePhoto#bc78dbcc`. -type InputMessagePhoto struct { - // Photo to send. The photo must be at most 10 MB in size. The photo's width and height - // must not exceed 10000 in total. Width and height ratio must be at most 20 - Photo InputFileClass - // Photo thumbnail to be sent; pass null to skip thumbnail uploading. The thumbnail is - // sent to the other party only in secret chats - Thumbnail InputThumbnail - // File identifiers of the stickers added to the photo, if applicable - AddedStickerFileIDs []int32 - // Photo width - Width int32 - // Photo height - Height int32 - // Photo caption; pass null to use an empty caption; - // 0-getOption("message_caption_length_max") characters - Caption FormattedText - // True, if the caption must be shown above the photo; otherwise, the caption must be - // shown below the photo; not supported in secret chats - ShowCaptionAboveMedia bool - // Photo self-destruct type; pass null if none; private chats only - SelfDestructType MessageSelfDestructTypeClass - // True, if the photo preview must be covered by a spoiler animation; not supported in - // secret chats - HasSpoiler bool -} - -// InputMessagePhotoTypeID is TL type id of InputMessagePhoto. -const InputMessagePhotoTypeID = 0xbc78dbcc - -// construct implements constructor of InputMessageContentClass. -func (i InputMessagePhoto) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessagePhoto. -var ( - _ bin.Encoder = &InputMessagePhoto{} - _ bin.Decoder = &InputMessagePhoto{} - _ bin.BareEncoder = &InputMessagePhoto{} - _ bin.BareDecoder = &InputMessagePhoto{} - - _ InputMessageContentClass = &InputMessagePhoto{} -) - -func (i *InputMessagePhoto) Zero() bool { - if i == nil { - return true - } - if !(i.Photo == nil) { - return false - } - if !(i.Thumbnail.Zero()) { - return false - } - if !(i.AddedStickerFileIDs == nil) { - return false - } - if !(i.Width == 0) { - return false - } - if !(i.Height == 0) { - return false - } - if !(i.Caption.Zero()) { - return false - } - if !(i.ShowCaptionAboveMedia == false) { - return false - } - if !(i.SelfDestructType == nil) { - return false - } - if !(i.HasSpoiler == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessagePhoto) String() string { - if i == nil { - return "InputMessagePhoto(nil)" - } - type Alias InputMessagePhoto - return fmt.Sprintf("InputMessagePhoto%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessagePhoto) TypeID() uint32 { - return InputMessagePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessagePhoto) TypeName() string { - return "inputMessagePhoto" -} - -// TypeInfo returns info about TL type. -func (i *InputMessagePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessagePhoto", - ID: InputMessagePhotoTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "AddedStickerFileIDs", - SchemaName: "added_sticker_file_ids", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "ShowCaptionAboveMedia", - SchemaName: "show_caption_above_media", - }, - { - Name: "SelfDestructType", - SchemaName: "self_destruct_type", - }, - { - Name: "HasSpoiler", - SchemaName: "has_spoiler", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessagePhoto) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessagePhoto#bc78dbcc as nil") - } - b.PutID(InputMessagePhotoTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessagePhoto) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessagePhoto#bc78dbcc as nil") - } - if i.Photo == nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field photo is nil") - } - if err := i.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field photo: %w", err) - } - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field thumbnail: %w", err) - } - b.PutInt(len(i.AddedStickerFileIDs)) - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - } - b.PutInt32(i.Width) - b.PutInt32(i.Height) - if err := i.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field caption: %w", err) - } - b.PutBool(i.ShowCaptionAboveMedia) - if i.SelfDestructType == nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field self_destruct_type is nil") - } - if err := i.SelfDestructType.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field self_destruct_type: %w", err) - } - b.PutBool(i.HasSpoiler) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessagePhoto) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessagePhoto#bc78dbcc to nil") - } - if err := b.ConsumeID(InputMessagePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessagePhoto) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessagePhoto#bc78dbcc to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field photo: %w", err) - } - i.Photo = value - } - { - if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field thumbnail: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field added_sticker_file_ids: %w", err) - } - - if headerLen > 0 { - i.AddedStickerFileIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field width: %w", err) - } - i.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field height: %w", err) - } - i.Height = value - } - { - if err := i.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field show_caption_above_media: %w", err) - } - i.ShowCaptionAboveMedia = value - } - { - value, err := DecodeMessageSelfDestructType(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field self_destruct_type: %w", err) - } - i.SelfDestructType = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field has_spoiler: %w", err) - } - i.HasSpoiler = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessagePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessagePhoto#bc78dbcc as nil") - } - b.ObjStart() - b.PutID("inputMessagePhoto") - b.Comma() - b.FieldStart("photo") - if i.Photo == nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field photo is nil") - } - if err := i.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field photo: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("added_sticker_file_ids") - b.ArrStart() - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("width") - b.PutInt32(i.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(i.Height) - b.Comma() - b.FieldStart("caption") - if err := i.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field caption: %w", err) - } - b.Comma() - b.FieldStart("show_caption_above_media") - b.PutBool(i.ShowCaptionAboveMedia) - b.Comma() - b.FieldStart("self_destruct_type") - if i.SelfDestructType == nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field self_destruct_type is nil") - } - if err := i.SelfDestructType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePhoto#bc78dbcc: field self_destruct_type: %w", err) - } - b.Comma() - b.FieldStart("has_spoiler") - b.PutBool(i.HasSpoiler) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessagePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessagePhoto#bc78dbcc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessagePhoto"); err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: %w", err) - } - case "photo": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field photo: %w", err) - } - i.Photo = value - case "thumbnail": - if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field thumbnail: %w", err) - } - case "added_sticker_file_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field added_sticker_file_ids: %w", err) - } - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field width: %w", err) - } - i.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field height: %w", err) - } - i.Height = value - case "caption": - if err := i.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field caption: %w", err) - } - case "show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field show_caption_above_media: %w", err) - } - i.ShowCaptionAboveMedia = value - case "self_destruct_type": - value, err := DecodeTDLibJSONMessageSelfDestructType(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field self_destruct_type: %w", err) - } - i.SelfDestructType = value - case "has_spoiler": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePhoto#bc78dbcc: field has_spoiler: %w", err) - } - i.HasSpoiler = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (i *InputMessagePhoto) GetPhoto() (value InputFileClass) { - if i == nil { - return - } - return i.Photo -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InputMessagePhoto) GetThumbnail() (value InputThumbnail) { - if i == nil { - return - } - return i.Thumbnail -} - -// GetAddedStickerFileIDs returns value of AddedStickerFileIDs field. -func (i *InputMessagePhoto) GetAddedStickerFileIDs() (value []int32) { - if i == nil { - return - } - return i.AddedStickerFileIDs -} - -// GetWidth returns value of Width field. -func (i *InputMessagePhoto) GetWidth() (value int32) { - if i == nil { - return - } - return i.Width -} - -// GetHeight returns value of Height field. -func (i *InputMessagePhoto) GetHeight() (value int32) { - if i == nil { - return - } - return i.Height -} - -// GetCaption returns value of Caption field. -func (i *InputMessagePhoto) GetCaption() (value FormattedText) { - if i == nil { - return - } - return i.Caption -} - -// GetShowCaptionAboveMedia returns value of ShowCaptionAboveMedia field. -func (i *InputMessagePhoto) GetShowCaptionAboveMedia() (value bool) { - if i == nil { - return - } - return i.ShowCaptionAboveMedia -} - -// GetSelfDestructType returns value of SelfDestructType field. -func (i *InputMessagePhoto) GetSelfDestructType() (value MessageSelfDestructTypeClass) { - if i == nil { - return - } - return i.SelfDestructType -} - -// GetHasSpoiler returns value of HasSpoiler field. -func (i *InputMessagePhoto) GetHasSpoiler() (value bool) { - if i == nil { - return - } - return i.HasSpoiler -} - -// InputMessageSticker represents TL type `inputMessageSticker#3ff1b6f9`. -type InputMessageSticker struct { - // Sticker to be sent - Sticker InputFileClass - // Sticker thumbnail; pass null to skip thumbnail uploading - Thumbnail InputThumbnail - // Sticker width - Width int32 - // Sticker height - Height int32 - // Emoji used to choose the sticker - Emoji string -} - -// InputMessageStickerTypeID is TL type id of InputMessageSticker. -const InputMessageStickerTypeID = 0x3ff1b6f9 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageSticker) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageSticker. -var ( - _ bin.Encoder = &InputMessageSticker{} - _ bin.Decoder = &InputMessageSticker{} - _ bin.BareEncoder = &InputMessageSticker{} - _ bin.BareDecoder = &InputMessageSticker{} - - _ InputMessageContentClass = &InputMessageSticker{} -) - -func (i *InputMessageSticker) Zero() bool { - if i == nil { - return true - } - if !(i.Sticker == nil) { - return false - } - if !(i.Thumbnail.Zero()) { - return false - } - if !(i.Width == 0) { - return false - } - if !(i.Height == 0) { - return false - } - if !(i.Emoji == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageSticker) String() string { - if i == nil { - return "InputMessageSticker(nil)" - } - type Alias InputMessageSticker - return fmt.Sprintf("InputMessageSticker%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageSticker) TypeID() uint32 { - return InputMessageStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageSticker) TypeName() string { - return "inputMessageSticker" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageSticker", - ID: InputMessageStickerTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "Emoji", - SchemaName: "emoji", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageSticker) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageSticker#3ff1b6f9 as nil") - } - b.PutID(InputMessageStickerTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageSticker) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageSticker#3ff1b6f9 as nil") - } - if i.Sticker == nil { - return fmt.Errorf("unable to encode inputMessageSticker#3ff1b6f9: field sticker is nil") - } - if err := i.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageSticker#3ff1b6f9: field sticker: %w", err) - } - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageSticker#3ff1b6f9: field thumbnail: %w", err) - } - b.PutInt32(i.Width) - b.PutInt32(i.Height) - b.PutString(i.Emoji) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageSticker) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageSticker#3ff1b6f9 to nil") - } - if err := b.ConsumeID(InputMessageStickerTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageSticker) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageSticker#3ff1b6f9 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: field sticker: %w", err) - } - i.Sticker = value - } - { - if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: field thumbnail: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: field width: %w", err) - } - i.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: field height: %w", err) - } - i.Height = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: field emoji: %w", err) - } - i.Emoji = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageSticker#3ff1b6f9 as nil") - } - b.ObjStart() - b.PutID("inputMessageSticker") - b.Comma() - b.FieldStart("sticker") - if i.Sticker == nil { - return fmt.Errorf("unable to encode inputMessageSticker#3ff1b6f9: field sticker is nil") - } - if err := i.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageSticker#3ff1b6f9: field sticker: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageSticker#3ff1b6f9: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("width") - b.PutInt32(i.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(i.Height) - b.Comma() - b.FieldStart("emoji") - b.PutString(i.Emoji) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageSticker#3ff1b6f9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageSticker"); err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: %w", err) - } - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: field sticker: %w", err) - } - i.Sticker = value - case "thumbnail": - if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: field thumbnail: %w", err) - } - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: field width: %w", err) - } - i.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: field height: %w", err) - } - i.Height = value - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageSticker#3ff1b6f9: field emoji: %w", err) - } - i.Emoji = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (i *InputMessageSticker) GetSticker() (value InputFileClass) { - if i == nil { - return - } - return i.Sticker -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InputMessageSticker) GetThumbnail() (value InputThumbnail) { - if i == nil { - return - } - return i.Thumbnail -} - -// GetWidth returns value of Width field. -func (i *InputMessageSticker) GetWidth() (value int32) { - if i == nil { - return - } - return i.Width -} - -// GetHeight returns value of Height field. -func (i *InputMessageSticker) GetHeight() (value int32) { - if i == nil { - return - } - return i.Height -} - -// GetEmoji returns value of Emoji field. -func (i *InputMessageSticker) GetEmoji() (value string) { - if i == nil { - return - } - return i.Emoji -} - -// InputMessageVideo represents TL type `inputMessageVideo#1a64cc26`. -type InputMessageVideo struct { - // Video to be sent. The video is expected to be re-encoded to MPEG4 format with H.264 - // codec by the sender - Video InputFileClass - // Video thumbnail; pass null to skip thumbnail uploading - Thumbnail InputThumbnail - // File identifiers of the stickers added to the video, if applicable - AddedStickerFileIDs []int32 - // Duration of the video, in seconds - Duration int32 - // Video width - Width int32 - // Video height - Height int32 - // True, if the video is expected to be streamed - SupportsStreaming bool - // Video caption; pass null to use an empty caption; - // 0-getOption("message_caption_length_max") characters - Caption FormattedText - // True, if the caption must be shown above the video; otherwise, the caption must be - // shown below the video; not supported in secret chats - ShowCaptionAboveMedia bool - // Video self-destruct type; pass null if none; private chats only - SelfDestructType MessageSelfDestructTypeClass - // True, if the video preview must be covered by a spoiler animation; not supported in - // secret chats - HasSpoiler bool -} - -// InputMessageVideoTypeID is TL type id of InputMessageVideo. -const InputMessageVideoTypeID = 0x1a64cc26 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageVideo) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageVideo. -var ( - _ bin.Encoder = &InputMessageVideo{} - _ bin.Decoder = &InputMessageVideo{} - _ bin.BareEncoder = &InputMessageVideo{} - _ bin.BareDecoder = &InputMessageVideo{} - - _ InputMessageContentClass = &InputMessageVideo{} -) - -func (i *InputMessageVideo) Zero() bool { - if i == nil { - return true - } - if !(i.Video == nil) { - return false - } - if !(i.Thumbnail.Zero()) { - return false - } - if !(i.AddedStickerFileIDs == nil) { - return false - } - if !(i.Duration == 0) { - return false - } - if !(i.Width == 0) { - return false - } - if !(i.Height == 0) { - return false - } - if !(i.SupportsStreaming == false) { - return false - } - if !(i.Caption.Zero()) { - return false - } - if !(i.ShowCaptionAboveMedia == false) { - return false - } - if !(i.SelfDestructType == nil) { - return false - } - if !(i.HasSpoiler == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageVideo) String() string { - if i == nil { - return "InputMessageVideo(nil)" - } - type Alias InputMessageVideo - return fmt.Sprintf("InputMessageVideo%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageVideo) TypeID() uint32 { - return InputMessageVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageVideo) TypeName() string { - return "inputMessageVideo" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageVideo", - ID: InputMessageVideoTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Video", - SchemaName: "video", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "AddedStickerFileIDs", - SchemaName: "added_sticker_file_ids", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "SupportsStreaming", - SchemaName: "supports_streaming", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "ShowCaptionAboveMedia", - SchemaName: "show_caption_above_media", - }, - { - Name: "SelfDestructType", - SchemaName: "self_destruct_type", - }, - { - Name: "HasSpoiler", - SchemaName: "has_spoiler", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageVideo) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVideo#1a64cc26 as nil") - } - b.PutID(InputMessageVideoTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageVideo) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVideo#1a64cc26 as nil") - } - if i.Video == nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field video is nil") - } - if err := i.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field video: %w", err) - } - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field thumbnail: %w", err) - } - b.PutInt(len(i.AddedStickerFileIDs)) - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - } - b.PutInt32(i.Duration) - b.PutInt32(i.Width) - b.PutInt32(i.Height) - b.PutBool(i.SupportsStreaming) - if err := i.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field caption: %w", err) - } - b.PutBool(i.ShowCaptionAboveMedia) - if i.SelfDestructType == nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field self_destruct_type is nil") - } - if err := i.SelfDestructType.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field self_destruct_type: %w", err) - } - b.PutBool(i.HasSpoiler) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageVideo) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVideo#1a64cc26 to nil") - } - if err := b.ConsumeID(InputMessageVideoTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageVideo) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVideo#1a64cc26 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field video: %w", err) - } - i.Video = value - } - { - if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field thumbnail: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field added_sticker_file_ids: %w", err) - } - - if headerLen > 0 { - i.AddedStickerFileIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field duration: %w", err) - } - i.Duration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field width: %w", err) - } - i.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field height: %w", err) - } - i.Height = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field supports_streaming: %w", err) - } - i.SupportsStreaming = value - } - { - if err := i.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field show_caption_above_media: %w", err) - } - i.ShowCaptionAboveMedia = value - } - { - value, err := DecodeMessageSelfDestructType(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field self_destruct_type: %w", err) - } - i.SelfDestructType = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field has_spoiler: %w", err) - } - i.HasSpoiler = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVideo#1a64cc26 as nil") - } - b.ObjStart() - b.PutID("inputMessageVideo") - b.Comma() - b.FieldStart("video") - if i.Video == nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field video is nil") - } - if err := i.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field video: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("added_sticker_file_ids") - b.ArrStart() - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("duration") - b.PutInt32(i.Duration) - b.Comma() - b.FieldStart("width") - b.PutInt32(i.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(i.Height) - b.Comma() - b.FieldStart("supports_streaming") - b.PutBool(i.SupportsStreaming) - b.Comma() - b.FieldStart("caption") - if err := i.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field caption: %w", err) - } - b.Comma() - b.FieldStart("show_caption_above_media") - b.PutBool(i.ShowCaptionAboveMedia) - b.Comma() - b.FieldStart("self_destruct_type") - if i.SelfDestructType == nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field self_destruct_type is nil") - } - if err := i.SelfDestructType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideo#1a64cc26: field self_destruct_type: %w", err) - } - b.Comma() - b.FieldStart("has_spoiler") - b.PutBool(i.HasSpoiler) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVideo#1a64cc26 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageVideo"); err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: %w", err) - } - case "video": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field video: %w", err) - } - i.Video = value - case "thumbnail": - if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field thumbnail: %w", err) - } - case "added_sticker_file_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field added_sticker_file_ids: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field duration: %w", err) - } - i.Duration = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field width: %w", err) - } - i.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field height: %w", err) - } - i.Height = value - case "supports_streaming": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field supports_streaming: %w", err) - } - i.SupportsStreaming = value - case "caption": - if err := i.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field caption: %w", err) - } - case "show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field show_caption_above_media: %w", err) - } - i.ShowCaptionAboveMedia = value - case "self_destruct_type": - value, err := DecodeTDLibJSONMessageSelfDestructType(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field self_destruct_type: %w", err) - } - i.SelfDestructType = value - case "has_spoiler": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideo#1a64cc26: field has_spoiler: %w", err) - } - i.HasSpoiler = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVideo returns value of Video field. -func (i *InputMessageVideo) GetVideo() (value InputFileClass) { - if i == nil { - return - } - return i.Video -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InputMessageVideo) GetThumbnail() (value InputThumbnail) { - if i == nil { - return - } - return i.Thumbnail -} - -// GetAddedStickerFileIDs returns value of AddedStickerFileIDs field. -func (i *InputMessageVideo) GetAddedStickerFileIDs() (value []int32) { - if i == nil { - return - } - return i.AddedStickerFileIDs -} - -// GetDuration returns value of Duration field. -func (i *InputMessageVideo) GetDuration() (value int32) { - if i == nil { - return - } - return i.Duration -} - -// GetWidth returns value of Width field. -func (i *InputMessageVideo) GetWidth() (value int32) { - if i == nil { - return - } - return i.Width -} - -// GetHeight returns value of Height field. -func (i *InputMessageVideo) GetHeight() (value int32) { - if i == nil { - return - } - return i.Height -} - -// GetSupportsStreaming returns value of SupportsStreaming field. -func (i *InputMessageVideo) GetSupportsStreaming() (value bool) { - if i == nil { - return - } - return i.SupportsStreaming -} - -// GetCaption returns value of Caption field. -func (i *InputMessageVideo) GetCaption() (value FormattedText) { - if i == nil { - return - } - return i.Caption -} - -// GetShowCaptionAboveMedia returns value of ShowCaptionAboveMedia field. -func (i *InputMessageVideo) GetShowCaptionAboveMedia() (value bool) { - if i == nil { - return - } - return i.ShowCaptionAboveMedia -} - -// GetSelfDestructType returns value of SelfDestructType field. -func (i *InputMessageVideo) GetSelfDestructType() (value MessageSelfDestructTypeClass) { - if i == nil { - return - } - return i.SelfDestructType -} - -// GetHasSpoiler returns value of HasSpoiler field. -func (i *InputMessageVideo) GetHasSpoiler() (value bool) { - if i == nil { - return - } - return i.HasSpoiler -} - -// InputMessageVideoNote represents TL type `inputMessageVideoNote#d56816dd`. -type InputMessageVideoNote struct { - // Video note to be sent. The video is expected to be encoded to MPEG4 format with H.264 - // codec and have no data outside of the visible circle - VideoNote InputFileClass - // Video thumbnail; may be null if empty; pass null to skip thumbnail uploading - Thumbnail InputThumbnail - // Duration of the video, in seconds; 0-60 - Duration int32 - // Video width and height; must be positive and not greater than 640 - Length int32 - // Video note self-destruct type; may be null if none; pass null if none; private chats - // only - SelfDestructType MessageSelfDestructTypeClass -} - -// InputMessageVideoNoteTypeID is TL type id of InputMessageVideoNote. -const InputMessageVideoNoteTypeID = 0xd56816dd - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageVideoNote) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageVideoNote. -var ( - _ bin.Encoder = &InputMessageVideoNote{} - _ bin.Decoder = &InputMessageVideoNote{} - _ bin.BareEncoder = &InputMessageVideoNote{} - _ bin.BareDecoder = &InputMessageVideoNote{} - - _ InputMessageContentClass = &InputMessageVideoNote{} -) - -func (i *InputMessageVideoNote) Zero() bool { - if i == nil { - return true - } - if !(i.VideoNote == nil) { - return false - } - if !(i.Thumbnail.Zero()) { - return false - } - if !(i.Duration == 0) { - return false - } - if !(i.Length == 0) { - return false - } - if !(i.SelfDestructType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageVideoNote) String() string { - if i == nil { - return "InputMessageVideoNote(nil)" - } - type Alias InputMessageVideoNote - return fmt.Sprintf("InputMessageVideoNote%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageVideoNote) TypeID() uint32 { - return InputMessageVideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageVideoNote) TypeName() string { - return "inputMessageVideoNote" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageVideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageVideoNote", - ID: InputMessageVideoNoteTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VideoNote", - SchemaName: "video_note", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Length", - SchemaName: "length", - }, - { - Name: "SelfDestructType", - SchemaName: "self_destruct_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageVideoNote) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVideoNote#d56816dd as nil") - } - b.PutID(InputMessageVideoNoteTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageVideoNote) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVideoNote#d56816dd as nil") - } - if i.VideoNote == nil { - return fmt.Errorf("unable to encode inputMessageVideoNote#d56816dd: field video_note is nil") - } - if err := i.VideoNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideoNote#d56816dd: field video_note: %w", err) - } - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideoNote#d56816dd: field thumbnail: %w", err) - } - b.PutInt32(i.Duration) - b.PutInt32(i.Length) - if i.SelfDestructType == nil { - return fmt.Errorf("unable to encode inputMessageVideoNote#d56816dd: field self_destruct_type is nil") - } - if err := i.SelfDestructType.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideoNote#d56816dd: field self_destruct_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageVideoNote) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVideoNote#d56816dd to nil") - } - if err := b.ConsumeID(InputMessageVideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageVideoNote) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVideoNote#d56816dd to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: field video_note: %w", err) - } - i.VideoNote = value - } - { - if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: field thumbnail: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: field duration: %w", err) - } - i.Duration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: field length: %w", err) - } - i.Length = value - } - { - value, err := DecodeMessageSelfDestructType(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: field self_destruct_type: %w", err) - } - i.SelfDestructType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVideoNote#d56816dd as nil") - } - b.ObjStart() - b.PutID("inputMessageVideoNote") - b.Comma() - b.FieldStart("video_note") - if i.VideoNote == nil { - return fmt.Errorf("unable to encode inputMessageVideoNote#d56816dd: field video_note is nil") - } - if err := i.VideoNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideoNote#d56816dd: field video_note: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideoNote#d56816dd: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("duration") - b.PutInt32(i.Duration) - b.Comma() - b.FieldStart("length") - b.PutInt32(i.Length) - b.Comma() - b.FieldStart("self_destruct_type") - if i.SelfDestructType == nil { - return fmt.Errorf("unable to encode inputMessageVideoNote#d56816dd: field self_destruct_type is nil") - } - if err := i.SelfDestructType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVideoNote#d56816dd: field self_destruct_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVideoNote#d56816dd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageVideoNote"); err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: %w", err) - } - case "video_note": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: field video_note: %w", err) - } - i.VideoNote = value - case "thumbnail": - if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: field thumbnail: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: field duration: %w", err) - } - i.Duration = value - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: field length: %w", err) - } - i.Length = value - case "self_destruct_type": - value, err := DecodeTDLibJSONMessageSelfDestructType(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVideoNote#d56816dd: field self_destruct_type: %w", err) - } - i.SelfDestructType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVideoNote returns value of VideoNote field. -func (i *InputMessageVideoNote) GetVideoNote() (value InputFileClass) { - if i == nil { - return - } - return i.VideoNote -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InputMessageVideoNote) GetThumbnail() (value InputThumbnail) { - if i == nil { - return - } - return i.Thumbnail -} - -// GetDuration returns value of Duration field. -func (i *InputMessageVideoNote) GetDuration() (value int32) { - if i == nil { - return - } - return i.Duration -} - -// GetLength returns value of Length field. -func (i *InputMessageVideoNote) GetLength() (value int32) { - if i == nil { - return - } - return i.Length -} - -// GetSelfDestructType returns value of SelfDestructType field. -func (i *InputMessageVideoNote) GetSelfDestructType() (value MessageSelfDestructTypeClass) { - if i == nil { - return - } - return i.SelfDestructType -} - -// InputMessageVoiceNote represents TL type `inputMessageVoiceNote#5723ffac`. -type InputMessageVoiceNote struct { - // Voice note to be sent. The voice note must be encoded with the Opus codec and stored - // inside an OGG container with a single audio channel, or be in MP3 or M4A format as - // regular audio - VoiceNote InputFileClass - // Duration of the voice note, in seconds - Duration int32 - // Waveform representation of the voice note in 5-bit format - Waveform []byte - // Voice note caption; may be null if empty; pass null to use an empty caption; - // 0-getOption("message_caption_length_max") characters - Caption FormattedText - // Voice note self-destruct type; may be null if none; pass null if none; private chats - // only - SelfDestructType MessageSelfDestructTypeClass -} - -// InputMessageVoiceNoteTypeID is TL type id of InputMessageVoiceNote. -const InputMessageVoiceNoteTypeID = 0x5723ffac - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageVoiceNote) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageVoiceNote. -var ( - _ bin.Encoder = &InputMessageVoiceNote{} - _ bin.Decoder = &InputMessageVoiceNote{} - _ bin.BareEncoder = &InputMessageVoiceNote{} - _ bin.BareDecoder = &InputMessageVoiceNote{} - - _ InputMessageContentClass = &InputMessageVoiceNote{} -) - -func (i *InputMessageVoiceNote) Zero() bool { - if i == nil { - return true - } - if !(i.VoiceNote == nil) { - return false - } - if !(i.Duration == 0) { - return false - } - if !(i.Waveform == nil) { - return false - } - if !(i.Caption.Zero()) { - return false - } - if !(i.SelfDestructType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageVoiceNote) String() string { - if i == nil { - return "InputMessageVoiceNote(nil)" - } - type Alias InputMessageVoiceNote - return fmt.Sprintf("InputMessageVoiceNote%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageVoiceNote) TypeID() uint32 { - return InputMessageVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageVoiceNote) TypeName() string { - return "inputMessageVoiceNote" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageVoiceNote", - ID: InputMessageVoiceNoteTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VoiceNote", - SchemaName: "voice_note", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Waveform", - SchemaName: "waveform", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "SelfDestructType", - SchemaName: "self_destruct_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageVoiceNote) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVoiceNote#5723ffac as nil") - } - b.PutID(InputMessageVoiceNoteTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageVoiceNote) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVoiceNote#5723ffac as nil") - } - if i.VoiceNote == nil { - return fmt.Errorf("unable to encode inputMessageVoiceNote#5723ffac: field voice_note is nil") - } - if err := i.VoiceNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVoiceNote#5723ffac: field voice_note: %w", err) - } - b.PutInt32(i.Duration) - b.PutBytes(i.Waveform) - if err := i.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVoiceNote#5723ffac: field caption: %w", err) - } - if i.SelfDestructType == nil { - return fmt.Errorf("unable to encode inputMessageVoiceNote#5723ffac: field self_destruct_type is nil") - } - if err := i.SelfDestructType.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVoiceNote#5723ffac: field self_destruct_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageVoiceNote) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVoiceNote#5723ffac to nil") - } - if err := b.ConsumeID(InputMessageVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageVoiceNote) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVoiceNote#5723ffac to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: field voice_note: %w", err) - } - i.VoiceNote = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: field duration: %w", err) - } - i.Duration = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: field waveform: %w", err) - } - i.Waveform = value - } - { - if err := i.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: field caption: %w", err) - } - } - { - value, err := DecodeMessageSelfDestructType(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: field self_destruct_type: %w", err) - } - i.SelfDestructType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVoiceNote#5723ffac as nil") - } - b.ObjStart() - b.PutID("inputMessageVoiceNote") - b.Comma() - b.FieldStart("voice_note") - if i.VoiceNote == nil { - return fmt.Errorf("unable to encode inputMessageVoiceNote#5723ffac: field voice_note is nil") - } - if err := i.VoiceNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVoiceNote#5723ffac: field voice_note: %w", err) - } - b.Comma() - b.FieldStart("duration") - b.PutInt32(i.Duration) - b.Comma() - b.FieldStart("waveform") - b.PutBytes(i.Waveform) - b.Comma() - b.FieldStart("caption") - if err := i.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVoiceNote#5723ffac: field caption: %w", err) - } - b.Comma() - b.FieldStart("self_destruct_type") - if i.SelfDestructType == nil { - return fmt.Errorf("unable to encode inputMessageVoiceNote#5723ffac: field self_destruct_type is nil") - } - if err := i.SelfDestructType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVoiceNote#5723ffac: field self_destruct_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVoiceNote#5723ffac to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageVoiceNote"); err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: %w", err) - } - case "voice_note": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: field voice_note: %w", err) - } - i.VoiceNote = value - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: field duration: %w", err) - } - i.Duration = value - case "waveform": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: field waveform: %w", err) - } - i.Waveform = value - case "caption": - if err := i.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: field caption: %w", err) - } - case "self_destruct_type": - value, err := DecodeTDLibJSONMessageSelfDestructType(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessageVoiceNote#5723ffac: field self_destruct_type: %w", err) - } - i.SelfDestructType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVoiceNote returns value of VoiceNote field. -func (i *InputMessageVoiceNote) GetVoiceNote() (value InputFileClass) { - if i == nil { - return - } - return i.VoiceNote -} - -// GetDuration returns value of Duration field. -func (i *InputMessageVoiceNote) GetDuration() (value int32) { - if i == nil { - return - } - return i.Duration -} - -// GetWaveform returns value of Waveform field. -func (i *InputMessageVoiceNote) GetWaveform() (value []byte) { - if i == nil { - return - } - return i.Waveform -} - -// GetCaption returns value of Caption field. -func (i *InputMessageVoiceNote) GetCaption() (value FormattedText) { - if i == nil { - return - } - return i.Caption -} - -// GetSelfDestructType returns value of SelfDestructType field. -func (i *InputMessageVoiceNote) GetSelfDestructType() (value MessageSelfDestructTypeClass) { - if i == nil { - return - } - return i.SelfDestructType -} - -// InputMessageLocation represents TL type `inputMessageLocation#26aae970`. -type InputMessageLocation struct { - // Location to be sent - Location Location - // Period for which the location can be updated, in seconds; must be between 60 and 86400 - // for a temporary live location, 0x7FFFFFFF for permanent live location, and 0 otherwise - LivePeriod int32 - // For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 - // if unknown - Heading int32 - // For live locations, a maximum distance to another chat member for proximity alerts, in - // meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in - // channels and Saved Messages - ProximityAlertRadius int32 -} - -// InputMessageLocationTypeID is TL type id of InputMessageLocation. -const InputMessageLocationTypeID = 0x26aae970 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageLocation) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageLocation. -var ( - _ bin.Encoder = &InputMessageLocation{} - _ bin.Decoder = &InputMessageLocation{} - _ bin.BareEncoder = &InputMessageLocation{} - _ bin.BareDecoder = &InputMessageLocation{} - - _ InputMessageContentClass = &InputMessageLocation{} -) - -func (i *InputMessageLocation) Zero() bool { - if i == nil { - return true - } - if !(i.Location.Zero()) { - return false - } - if !(i.LivePeriod == 0) { - return false - } - if !(i.Heading == 0) { - return false - } - if !(i.ProximityAlertRadius == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageLocation) String() string { - if i == nil { - return "InputMessageLocation(nil)" - } - type Alias InputMessageLocation - return fmt.Sprintf("InputMessageLocation%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageLocation) TypeID() uint32 { - return InputMessageLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageLocation) TypeName() string { - return "inputMessageLocation" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageLocation", - ID: InputMessageLocationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "LivePeriod", - SchemaName: "live_period", - }, - { - Name: "Heading", - SchemaName: "heading", - }, - { - Name: "ProximityAlertRadius", - SchemaName: "proximity_alert_radius", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageLocation) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageLocation#26aae970 as nil") - } - b.PutID(InputMessageLocationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageLocation) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageLocation#26aae970 as nil") - } - if err := i.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageLocation#26aae970: field location: %w", err) - } - b.PutInt32(i.LivePeriod) - b.PutInt32(i.Heading) - b.PutInt32(i.ProximityAlertRadius) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageLocation) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageLocation#26aae970 to nil") - } - if err := b.ConsumeID(InputMessageLocationTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageLocation#26aae970: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageLocation) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageLocation#26aae970 to nil") - } - { - if err := i.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageLocation#26aae970: field location: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageLocation#26aae970: field live_period: %w", err) - } - i.LivePeriod = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageLocation#26aae970: field heading: %w", err) - } - i.Heading = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageLocation#26aae970: field proximity_alert_radius: %w", err) - } - i.ProximityAlertRadius = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageLocation) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageLocation#26aae970 as nil") - } - b.ObjStart() - b.PutID("inputMessageLocation") - b.Comma() - b.FieldStart("location") - if err := i.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageLocation#26aae970: field location: %w", err) - } - b.Comma() - b.FieldStart("live_period") - b.PutInt32(i.LivePeriod) - b.Comma() - b.FieldStart("heading") - b.PutInt32(i.Heading) - b.Comma() - b.FieldStart("proximity_alert_radius") - b.PutInt32(i.ProximityAlertRadius) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageLocation) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageLocation#26aae970 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageLocation"); err != nil { - return fmt.Errorf("unable to decode inputMessageLocation#26aae970: %w", err) - } - case "location": - if err := i.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageLocation#26aae970: field location: %w", err) - } - case "live_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageLocation#26aae970: field live_period: %w", err) - } - i.LivePeriod = value - case "heading": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageLocation#26aae970: field heading: %w", err) - } - i.Heading = value - case "proximity_alert_radius": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageLocation#26aae970: field proximity_alert_radius: %w", err) - } - i.ProximityAlertRadius = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (i *InputMessageLocation) GetLocation() (value Location) { - if i == nil { - return - } - return i.Location -} - -// GetLivePeriod returns value of LivePeriod field. -func (i *InputMessageLocation) GetLivePeriod() (value int32) { - if i == nil { - return - } - return i.LivePeriod -} - -// GetHeading returns value of Heading field. -func (i *InputMessageLocation) GetHeading() (value int32) { - if i == nil { - return - } - return i.Heading -} - -// GetProximityAlertRadius returns value of ProximityAlertRadius field. -func (i *InputMessageLocation) GetProximityAlertRadius() (value int32) { - if i == nil { - return - } - return i.ProximityAlertRadius -} - -// InputMessageVenue represents TL type `inputMessageVenue#564d99fd`. -type InputMessageVenue struct { - // Venue to send - Venue Venue -} - -// InputMessageVenueTypeID is TL type id of InputMessageVenue. -const InputMessageVenueTypeID = 0x564d99fd - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageVenue) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageVenue. -var ( - _ bin.Encoder = &InputMessageVenue{} - _ bin.Decoder = &InputMessageVenue{} - _ bin.BareEncoder = &InputMessageVenue{} - _ bin.BareDecoder = &InputMessageVenue{} - - _ InputMessageContentClass = &InputMessageVenue{} -) - -func (i *InputMessageVenue) Zero() bool { - if i == nil { - return true - } - if !(i.Venue.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageVenue) String() string { - if i == nil { - return "InputMessageVenue(nil)" - } - type Alias InputMessageVenue - return fmt.Sprintf("InputMessageVenue%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageVenue) TypeID() uint32 { - return InputMessageVenueTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageVenue) TypeName() string { - return "inputMessageVenue" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageVenue) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageVenue", - ID: InputMessageVenueTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Venue", - SchemaName: "venue", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageVenue) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVenue#564d99fd as nil") - } - b.PutID(InputMessageVenueTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageVenue) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVenue#564d99fd as nil") - } - if err := i.Venue.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVenue#564d99fd: field venue: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageVenue) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVenue#564d99fd to nil") - } - if err := b.ConsumeID(InputMessageVenueTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageVenue#564d99fd: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageVenue) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVenue#564d99fd to nil") - } - { - if err := i.Venue.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageVenue#564d99fd: field venue: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageVenue) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageVenue#564d99fd as nil") - } - b.ObjStart() - b.PutID("inputMessageVenue") - b.Comma() - b.FieldStart("venue") - if err := i.Venue.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageVenue#564d99fd: field venue: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageVenue) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageVenue#564d99fd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageVenue"); err != nil { - return fmt.Errorf("unable to decode inputMessageVenue#564d99fd: %w", err) - } - case "venue": - if err := i.Venue.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageVenue#564d99fd: field venue: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetVenue returns value of Venue field. -func (i *InputMessageVenue) GetVenue() (value Venue) { - if i == nil { - return - } - return i.Venue -} - -// InputMessageContact represents TL type `inputMessageContact#c5710cff`. -type InputMessageContact struct { - // Contact to send - Contact Contact -} - -// InputMessageContactTypeID is TL type id of InputMessageContact. -const InputMessageContactTypeID = 0xc5710cff - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageContact) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageContact. -var ( - _ bin.Encoder = &InputMessageContact{} - _ bin.Decoder = &InputMessageContact{} - _ bin.BareEncoder = &InputMessageContact{} - _ bin.BareDecoder = &InputMessageContact{} - - _ InputMessageContentClass = &InputMessageContact{} -) - -func (i *InputMessageContact) Zero() bool { - if i == nil { - return true - } - if !(i.Contact.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageContact) String() string { - if i == nil { - return "InputMessageContact(nil)" - } - type Alias InputMessageContact - return fmt.Sprintf("InputMessageContact%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageContact) TypeID() uint32 { - return InputMessageContactTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageContact) TypeName() string { - return "inputMessageContact" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageContact) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageContact", - ID: InputMessageContactTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Contact", - SchemaName: "contact", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageContact) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageContact#c5710cff as nil") - } - b.PutID(InputMessageContactTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageContact) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageContact#c5710cff as nil") - } - if err := i.Contact.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageContact#c5710cff: field contact: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageContact) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageContact#c5710cff to nil") - } - if err := b.ConsumeID(InputMessageContactTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageContact#c5710cff: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageContact) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageContact#c5710cff to nil") - } - { - if err := i.Contact.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageContact#c5710cff: field contact: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageContact) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageContact#c5710cff as nil") - } - b.ObjStart() - b.PutID("inputMessageContact") - b.Comma() - b.FieldStart("contact") - if err := i.Contact.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageContact#c5710cff: field contact: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageContact) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageContact#c5710cff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageContact"); err != nil { - return fmt.Errorf("unable to decode inputMessageContact#c5710cff: %w", err) - } - case "contact": - if err := i.Contact.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageContact#c5710cff: field contact: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetContact returns value of Contact field. -func (i *InputMessageContact) GetContact() (value Contact) { - if i == nil { - return - } - return i.Contact -} - -// InputMessageDice represents TL type `inputMessageDice#322967a9`. -type InputMessageDice struct { - // Emoji on which the dice throw animation is based - Emoji string - // True, if the chat message draft must be deleted - ClearDraft bool -} - -// InputMessageDiceTypeID is TL type id of InputMessageDice. -const InputMessageDiceTypeID = 0x322967a9 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageDice) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageDice. -var ( - _ bin.Encoder = &InputMessageDice{} - _ bin.Decoder = &InputMessageDice{} - _ bin.BareEncoder = &InputMessageDice{} - _ bin.BareDecoder = &InputMessageDice{} - - _ InputMessageContentClass = &InputMessageDice{} -) - -func (i *InputMessageDice) Zero() bool { - if i == nil { - return true - } - if !(i.Emoji == "") { - return false - } - if !(i.ClearDraft == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageDice) String() string { - if i == nil { - return "InputMessageDice(nil)" - } - type Alias InputMessageDice - return fmt.Sprintf("InputMessageDice%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageDice) TypeID() uint32 { - return InputMessageDiceTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageDice) TypeName() string { - return "inputMessageDice" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageDice) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageDice", - ID: InputMessageDiceTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Emoji", - SchemaName: "emoji", - }, - { - Name: "ClearDraft", - SchemaName: "clear_draft", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageDice) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageDice#322967a9 as nil") - } - b.PutID(InputMessageDiceTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageDice) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageDice#322967a9 as nil") - } - b.PutString(i.Emoji) - b.PutBool(i.ClearDraft) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageDice) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageDice#322967a9 to nil") - } - if err := b.ConsumeID(InputMessageDiceTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageDice#322967a9: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageDice) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageDice#322967a9 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageDice#322967a9: field emoji: %w", err) - } - i.Emoji = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageDice#322967a9: field clear_draft: %w", err) - } - i.ClearDraft = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageDice) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageDice#322967a9 as nil") - } - b.ObjStart() - b.PutID("inputMessageDice") - b.Comma() - b.FieldStart("emoji") - b.PutString(i.Emoji) - b.Comma() - b.FieldStart("clear_draft") - b.PutBool(i.ClearDraft) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageDice) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageDice#322967a9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageDice"); err != nil { - return fmt.Errorf("unable to decode inputMessageDice#322967a9: %w", err) - } - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageDice#322967a9: field emoji: %w", err) - } - i.Emoji = value - case "clear_draft": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageDice#322967a9: field clear_draft: %w", err) - } - i.ClearDraft = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEmoji returns value of Emoji field. -func (i *InputMessageDice) GetEmoji() (value string) { - if i == nil { - return - } - return i.Emoji -} - -// GetClearDraft returns value of ClearDraft field. -func (i *InputMessageDice) GetClearDraft() (value bool) { - if i == nil { - return - } - return i.ClearDraft -} - -// InputMessageGame represents TL type `inputMessageGame#4aae6ae2`. -type InputMessageGame struct { - // User identifier of the bot that owns the game - BotUserID int64 - // Short name of the game - GameShortName string -} - -// InputMessageGameTypeID is TL type id of InputMessageGame. -const InputMessageGameTypeID = 0x4aae6ae2 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageGame) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageGame. -var ( - _ bin.Encoder = &InputMessageGame{} - _ bin.Decoder = &InputMessageGame{} - _ bin.BareEncoder = &InputMessageGame{} - _ bin.BareDecoder = &InputMessageGame{} - - _ InputMessageContentClass = &InputMessageGame{} -) - -func (i *InputMessageGame) Zero() bool { - if i == nil { - return true - } - if !(i.BotUserID == 0) { - return false - } - if !(i.GameShortName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageGame) String() string { - if i == nil { - return "InputMessageGame(nil)" - } - type Alias InputMessageGame - return fmt.Sprintf("InputMessageGame%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageGame) TypeID() uint32 { - return InputMessageGameTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageGame) TypeName() string { - return "inputMessageGame" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageGame) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageGame", - ID: InputMessageGameTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "GameShortName", - SchemaName: "game_short_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageGame) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageGame#4aae6ae2 as nil") - } - b.PutID(InputMessageGameTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageGame) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageGame#4aae6ae2 as nil") - } - b.PutInt53(i.BotUserID) - b.PutString(i.GameShortName) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageGame) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageGame#4aae6ae2 to nil") - } - if err := b.ConsumeID(InputMessageGameTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageGame#4aae6ae2: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageGame) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageGame#4aae6ae2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageGame#4aae6ae2: field bot_user_id: %w", err) - } - i.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageGame#4aae6ae2: field game_short_name: %w", err) - } - i.GameShortName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageGame) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageGame#4aae6ae2 as nil") - } - b.ObjStart() - b.PutID("inputMessageGame") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(i.BotUserID) - b.Comma() - b.FieldStart("game_short_name") - b.PutString(i.GameShortName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageGame) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageGame#4aae6ae2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageGame"); err != nil { - return fmt.Errorf("unable to decode inputMessageGame#4aae6ae2: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageGame#4aae6ae2: field bot_user_id: %w", err) - } - i.BotUserID = value - case "game_short_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageGame#4aae6ae2: field game_short_name: %w", err) - } - i.GameShortName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (i *InputMessageGame) GetBotUserID() (value int64) { - if i == nil { - return - } - return i.BotUserID -} - -// GetGameShortName returns value of GameShortName field. -func (i *InputMessageGame) GetGameShortName() (value string) { - if i == nil { - return - } - return i.GameShortName -} - -// InputMessageInvoice represents TL type `inputMessageInvoice#babc8f71`. -type InputMessageInvoice struct { - // Invoice - Invoice Invoice - // Product title; 1-32 characters - Title string - // A message with an invoice; can be used only by bots - Description string - // Product photo URL; optional - PhotoURL string - // Product photo size - PhotoSize int32 - // Product photo width - PhotoWidth int32 - // Product photo height - PhotoHeight int32 - // The invoice payload - Payload []byte - // Payment provider token; may be empty for payments in Telegram Stars - ProviderToken string - // JSON-encoded data about the invoice, which will be shared with the payment provider - ProviderData string - // Unique invoice bot deep link parameter for the generation of this invoice. If empty, - // it would be possible to pay directly from forwards of the invoice message - StartParameter string - // The content of paid media attached to the invoice; pass null if none - PaidMedia InputPaidMedia - // Paid media caption; pass null to use an empty caption; - // 0-getOption("message_caption_length_max") characters - PaidMediaCaption FormattedText -} - -// InputMessageInvoiceTypeID is TL type id of InputMessageInvoice. -const InputMessageInvoiceTypeID = 0xbabc8f71 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageInvoice) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageInvoice. -var ( - _ bin.Encoder = &InputMessageInvoice{} - _ bin.Decoder = &InputMessageInvoice{} - _ bin.BareEncoder = &InputMessageInvoice{} - _ bin.BareDecoder = &InputMessageInvoice{} - - _ InputMessageContentClass = &InputMessageInvoice{} -) - -func (i *InputMessageInvoice) Zero() bool { - if i == nil { - return true - } - if !(i.Invoice.Zero()) { - return false - } - if !(i.Title == "") { - return false - } - if !(i.Description == "") { - return false - } - if !(i.PhotoURL == "") { - return false - } - if !(i.PhotoSize == 0) { - return false - } - if !(i.PhotoWidth == 0) { - return false - } - if !(i.PhotoHeight == 0) { - return false - } - if !(i.Payload == nil) { - return false - } - if !(i.ProviderToken == "") { - return false - } - if !(i.ProviderData == "") { - return false - } - if !(i.StartParameter == "") { - return false - } - if !(i.PaidMedia.Zero()) { - return false - } - if !(i.PaidMediaCaption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageInvoice) String() string { - if i == nil { - return "InputMessageInvoice(nil)" - } - type Alias InputMessageInvoice - return fmt.Sprintf("InputMessageInvoice%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageInvoice) TypeID() uint32 { - return InputMessageInvoiceTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageInvoice) TypeName() string { - return "inputMessageInvoice" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageInvoice) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageInvoice", - ID: InputMessageInvoiceTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Invoice", - SchemaName: "invoice", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "PhotoURL", - SchemaName: "photo_url", - }, - { - Name: "PhotoSize", - SchemaName: "photo_size", - }, - { - Name: "PhotoWidth", - SchemaName: "photo_width", - }, - { - Name: "PhotoHeight", - SchemaName: "photo_height", - }, - { - Name: "Payload", - SchemaName: "payload", - }, - { - Name: "ProviderToken", - SchemaName: "provider_token", - }, - { - Name: "ProviderData", - SchemaName: "provider_data", - }, - { - Name: "StartParameter", - SchemaName: "start_parameter", - }, - { - Name: "PaidMedia", - SchemaName: "paid_media", - }, - { - Name: "PaidMediaCaption", - SchemaName: "paid_media_caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageInvoice) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageInvoice#babc8f71 as nil") - } - b.PutID(InputMessageInvoiceTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageInvoice) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageInvoice#babc8f71 as nil") - } - if err := i.Invoice.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageInvoice#babc8f71: field invoice: %w", err) - } - b.PutString(i.Title) - b.PutString(i.Description) - b.PutString(i.PhotoURL) - b.PutInt32(i.PhotoSize) - b.PutInt32(i.PhotoWidth) - b.PutInt32(i.PhotoHeight) - b.PutBytes(i.Payload) - b.PutString(i.ProviderToken) - b.PutString(i.ProviderData) - b.PutString(i.StartParameter) - if err := i.PaidMedia.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageInvoice#babc8f71: field paid_media: %w", err) - } - if err := i.PaidMediaCaption.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageInvoice#babc8f71: field paid_media_caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageInvoice) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageInvoice#babc8f71 to nil") - } - if err := b.ConsumeID(InputMessageInvoiceTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageInvoice) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageInvoice#babc8f71 to nil") - } - { - if err := i.Invoice.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field invoice: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field title: %w", err) - } - i.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field description: %w", err) - } - i.Description = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field photo_url: %w", err) - } - i.PhotoURL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field photo_size: %w", err) - } - i.PhotoSize = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field photo_width: %w", err) - } - i.PhotoWidth = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field photo_height: %w", err) - } - i.PhotoHeight = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field payload: %w", err) - } - i.Payload = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field provider_token: %w", err) - } - i.ProviderToken = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field provider_data: %w", err) - } - i.ProviderData = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field start_parameter: %w", err) - } - i.StartParameter = value - } - { - if err := i.PaidMedia.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field paid_media: %w", err) - } - } - { - if err := i.PaidMediaCaption.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field paid_media_caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageInvoice) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageInvoice#babc8f71 as nil") - } - b.ObjStart() - b.PutID("inputMessageInvoice") - b.Comma() - b.FieldStart("invoice") - if err := i.Invoice.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageInvoice#babc8f71: field invoice: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(i.Title) - b.Comma() - b.FieldStart("description") - b.PutString(i.Description) - b.Comma() - b.FieldStart("photo_url") - b.PutString(i.PhotoURL) - b.Comma() - b.FieldStart("photo_size") - b.PutInt32(i.PhotoSize) - b.Comma() - b.FieldStart("photo_width") - b.PutInt32(i.PhotoWidth) - b.Comma() - b.FieldStart("photo_height") - b.PutInt32(i.PhotoHeight) - b.Comma() - b.FieldStart("payload") - b.PutBytes(i.Payload) - b.Comma() - b.FieldStart("provider_token") - b.PutString(i.ProviderToken) - b.Comma() - b.FieldStart("provider_data") - b.PutString(i.ProviderData) - b.Comma() - b.FieldStart("start_parameter") - b.PutString(i.StartParameter) - b.Comma() - b.FieldStart("paid_media") - if err := i.PaidMedia.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageInvoice#babc8f71: field paid_media: %w", err) - } - b.Comma() - b.FieldStart("paid_media_caption") - if err := i.PaidMediaCaption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageInvoice#babc8f71: field paid_media_caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageInvoice) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageInvoice#babc8f71 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageInvoice"); err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: %w", err) - } - case "invoice": - if err := i.Invoice.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field invoice: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field title: %w", err) - } - i.Title = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field description: %w", err) - } - i.Description = value - case "photo_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field photo_url: %w", err) - } - i.PhotoURL = value - case "photo_size": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field photo_size: %w", err) - } - i.PhotoSize = value - case "photo_width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field photo_width: %w", err) - } - i.PhotoWidth = value - case "photo_height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field photo_height: %w", err) - } - i.PhotoHeight = value - case "payload": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field payload: %w", err) - } - i.Payload = value - case "provider_token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field provider_token: %w", err) - } - i.ProviderToken = value - case "provider_data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field provider_data: %w", err) - } - i.ProviderData = value - case "start_parameter": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field start_parameter: %w", err) - } - i.StartParameter = value - case "paid_media": - if err := i.PaidMedia.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field paid_media: %w", err) - } - case "paid_media_caption": - if err := i.PaidMediaCaption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageInvoice#babc8f71: field paid_media_caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInvoice returns value of Invoice field. -func (i *InputMessageInvoice) GetInvoice() (value Invoice) { - if i == nil { - return - } - return i.Invoice -} - -// GetTitle returns value of Title field. -func (i *InputMessageInvoice) GetTitle() (value string) { - if i == nil { - return - } - return i.Title -} - -// GetDescription returns value of Description field. -func (i *InputMessageInvoice) GetDescription() (value string) { - if i == nil { - return - } - return i.Description -} - -// GetPhotoURL returns value of PhotoURL field. -func (i *InputMessageInvoice) GetPhotoURL() (value string) { - if i == nil { - return - } - return i.PhotoURL -} - -// GetPhotoSize returns value of PhotoSize field. -func (i *InputMessageInvoice) GetPhotoSize() (value int32) { - if i == nil { - return - } - return i.PhotoSize -} - -// GetPhotoWidth returns value of PhotoWidth field. -func (i *InputMessageInvoice) GetPhotoWidth() (value int32) { - if i == nil { - return - } - return i.PhotoWidth -} - -// GetPhotoHeight returns value of PhotoHeight field. -func (i *InputMessageInvoice) GetPhotoHeight() (value int32) { - if i == nil { - return - } - return i.PhotoHeight -} - -// GetPayload returns value of Payload field. -func (i *InputMessageInvoice) GetPayload() (value []byte) { - if i == nil { - return - } - return i.Payload -} - -// GetProviderToken returns value of ProviderToken field. -func (i *InputMessageInvoice) GetProviderToken() (value string) { - if i == nil { - return - } - return i.ProviderToken -} - -// GetProviderData returns value of ProviderData field. -func (i *InputMessageInvoice) GetProviderData() (value string) { - if i == nil { - return - } - return i.ProviderData -} - -// GetStartParameter returns value of StartParameter field. -func (i *InputMessageInvoice) GetStartParameter() (value string) { - if i == nil { - return - } - return i.StartParameter -} - -// GetPaidMedia returns value of PaidMedia field. -func (i *InputMessageInvoice) GetPaidMedia() (value InputPaidMedia) { - if i == nil { - return - } - return i.PaidMedia -} - -// GetPaidMediaCaption returns value of PaidMediaCaption field. -func (i *InputMessageInvoice) GetPaidMediaCaption() (value FormattedText) { - if i == nil { - return - } - return i.PaidMediaCaption -} - -// InputMessagePoll represents TL type `inputMessagePoll#9046c716`. -type InputMessagePoll struct { - // Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji - // entities are allowed to be added and only by Premium users - Question FormattedText - // List of poll answer options, 2-10 strings 1-100 characters each. Only custom emoji - // entities are allowed to be added and only by Premium users - Options []FormattedText - // True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded - // to channels - IsAnonymous bool - // Type of the poll - Type PollTypeClass - // Amount of time the poll will be active after creation, in seconds; for bots only - OpenPeriod int32 - // Point in time (Unix timestamp) when the poll will automatically be closed; for bots - // only - CloseDate int32 - // True, if the poll needs to be sent already closed; for bots only - IsClosed bool -} - -// InputMessagePollTypeID is TL type id of InputMessagePoll. -const InputMessagePollTypeID = 0x9046c716 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessagePoll) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessagePoll. -var ( - _ bin.Encoder = &InputMessagePoll{} - _ bin.Decoder = &InputMessagePoll{} - _ bin.BareEncoder = &InputMessagePoll{} - _ bin.BareDecoder = &InputMessagePoll{} - - _ InputMessageContentClass = &InputMessagePoll{} -) - -func (i *InputMessagePoll) Zero() bool { - if i == nil { - return true - } - if !(i.Question.Zero()) { - return false - } - if !(i.Options == nil) { - return false - } - if !(i.IsAnonymous == false) { - return false - } - if !(i.Type == nil) { - return false - } - if !(i.OpenPeriod == 0) { - return false - } - if !(i.CloseDate == 0) { - return false - } - if !(i.IsClosed == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessagePoll) String() string { - if i == nil { - return "InputMessagePoll(nil)" - } - type Alias InputMessagePoll - return fmt.Sprintf("InputMessagePoll%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessagePoll) TypeID() uint32 { - return InputMessagePollTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessagePoll) TypeName() string { - return "inputMessagePoll" -} - -// TypeInfo returns info about TL type. -func (i *InputMessagePoll) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessagePoll", - ID: InputMessagePollTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Question", - SchemaName: "question", - }, - { - Name: "Options", - SchemaName: "options", - }, - { - Name: "IsAnonymous", - SchemaName: "is_anonymous", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "OpenPeriod", - SchemaName: "open_period", - }, - { - Name: "CloseDate", - SchemaName: "close_date", - }, - { - Name: "IsClosed", - SchemaName: "is_closed", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessagePoll) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessagePoll#9046c716 as nil") - } - b.PutID(InputMessagePollTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessagePoll) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessagePoll#9046c716 as nil") - } - if err := i.Question.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field question: %w", err) - } - b.PutInt(len(i.Options)) - for idx, v := range i.Options { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare inputMessagePoll#9046c716: field options element with index %d: %w", idx, err) - } - } - b.PutBool(i.IsAnonymous) - if i.Type == nil { - return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field type is nil") - } - if err := i.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field type: %w", err) - } - b.PutInt32(i.OpenPeriod) - b.PutInt32(i.CloseDate) - b.PutBool(i.IsClosed) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessagePoll) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessagePoll#9046c716 to nil") - } - if err := b.ConsumeID(InputMessagePollTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessagePoll) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessagePoll#9046c716 to nil") - } - { - if err := i.Question.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field question: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field options: %w", err) - } - - if headerLen > 0 { - i.Options = make([]FormattedText, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value FormattedText - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare inputMessagePoll#9046c716: field options: %w", err) - } - i.Options = append(i.Options, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field is_anonymous: %w", err) - } - i.IsAnonymous = value - } - { - value, err := DecodePollType(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field type: %w", err) - } - i.Type = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field open_period: %w", err) - } - i.OpenPeriod = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field close_date: %w", err) - } - i.CloseDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field is_closed: %w", err) - } - i.IsClosed = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessagePoll) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessagePoll#9046c716 as nil") - } - b.ObjStart() - b.PutID("inputMessagePoll") - b.Comma() - b.FieldStart("question") - if err := i.Question.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field question: %w", err) - } - b.Comma() - b.FieldStart("options") - b.ArrStart() - for idx, v := range i.Options { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("is_anonymous") - b.PutBool(i.IsAnonymous) - b.Comma() - b.FieldStart("type") - if i.Type == nil { - return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field type is nil") - } - if err := i.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessagePoll#9046c716: field type: %w", err) - } - b.Comma() - b.FieldStart("open_period") - b.PutInt32(i.OpenPeriod) - b.Comma() - b.FieldStart("close_date") - b.PutInt32(i.CloseDate) - b.Comma() - b.FieldStart("is_closed") - b.PutBool(i.IsClosed) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessagePoll) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessagePoll#9046c716 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessagePoll"); err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: %w", err) - } - case "question": - if err := i.Question.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field question: %w", err) - } - case "options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value FormattedText - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field options: %w", err) - } - i.Options = append(i.Options, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field options: %w", err) - } - case "is_anonymous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field is_anonymous: %w", err) - } - i.IsAnonymous = value - case "type": - value, err := DecodeTDLibJSONPollType(b) - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field type: %w", err) - } - i.Type = value - case "open_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field open_period: %w", err) - } - i.OpenPeriod = value - case "close_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field close_date: %w", err) - } - i.CloseDate = value - case "is_closed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessagePoll#9046c716: field is_closed: %w", err) - } - i.IsClosed = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuestion returns value of Question field. -func (i *InputMessagePoll) GetQuestion() (value FormattedText) { - if i == nil { - return - } - return i.Question -} - -// GetOptions returns value of Options field. -func (i *InputMessagePoll) GetOptions() (value []FormattedText) { - if i == nil { - return - } - return i.Options -} - -// GetIsAnonymous returns value of IsAnonymous field. -func (i *InputMessagePoll) GetIsAnonymous() (value bool) { - if i == nil { - return - } - return i.IsAnonymous -} - -// GetType returns value of Type field. -func (i *InputMessagePoll) GetType() (value PollTypeClass) { - if i == nil { - return - } - return i.Type -} - -// GetOpenPeriod returns value of OpenPeriod field. -func (i *InputMessagePoll) GetOpenPeriod() (value int32) { - if i == nil { - return - } - return i.OpenPeriod -} - -// GetCloseDate returns value of CloseDate field. -func (i *InputMessagePoll) GetCloseDate() (value int32) { - if i == nil { - return - } - return i.CloseDate -} - -// GetIsClosed returns value of IsClosed field. -func (i *InputMessagePoll) GetIsClosed() (value bool) { - if i == nil { - return - } - return i.IsClosed -} - -// InputMessageStory represents TL type `inputMessageStory#21099d63`. -type InputMessageStory struct { - // Identifier of the chat that posted the story - StorySenderChatID int64 - // Story identifier - StoryID int32 -} - -// InputMessageStoryTypeID is TL type id of InputMessageStory. -const InputMessageStoryTypeID = 0x21099d63 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageStory) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageStory. -var ( - _ bin.Encoder = &InputMessageStory{} - _ bin.Decoder = &InputMessageStory{} - _ bin.BareEncoder = &InputMessageStory{} - _ bin.BareDecoder = &InputMessageStory{} - - _ InputMessageContentClass = &InputMessageStory{} -) - -func (i *InputMessageStory) Zero() bool { - if i == nil { - return true - } - if !(i.StorySenderChatID == 0) { - return false - } - if !(i.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageStory) String() string { - if i == nil { - return "InputMessageStory(nil)" - } - type Alias InputMessageStory - return fmt.Sprintf("InputMessageStory%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageStory) TypeID() uint32 { - return InputMessageStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageStory) TypeName() string { - return "inputMessageStory" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageStory", - ID: InputMessageStoryTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageStory) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageStory#21099d63 as nil") - } - b.PutID(InputMessageStoryTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageStory) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageStory#21099d63 as nil") - } - b.PutInt53(i.StorySenderChatID) - b.PutInt32(i.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageStory) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageStory#21099d63 to nil") - } - if err := b.ConsumeID(InputMessageStoryTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageStory#21099d63: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageStory) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageStory#21099d63 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageStory#21099d63: field story_sender_chat_id: %w", err) - } - i.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageStory#21099d63: field story_id: %w", err) - } - i.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageStory#21099d63 as nil") - } - b.ObjStart() - b.PutID("inputMessageStory") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(i.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(i.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageStory#21099d63 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageStory"); err != nil { - return fmt.Errorf("unable to decode inputMessageStory#21099d63: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageStory#21099d63: field story_sender_chat_id: %w", err) - } - i.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageStory#21099d63: field story_id: %w", err) - } - i.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (i *InputMessageStory) GetStorySenderChatID() (value int64) { - if i == nil { - return - } - return i.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (i *InputMessageStory) GetStoryID() (value int32) { - if i == nil { - return - } - return i.StoryID -} - -// InputMessageForwarded represents TL type `inputMessageForwarded#651a73f8`. -type InputMessageForwarded struct { - // Identifier for the chat this forwarded message came from - FromChatID int64 - // Identifier of the message to forward. A message can be forwarded only if - // messageProperties.can_be_forwarded - MessageID int64 - // True, if a game message is being shared from a launched game; applies only to game - // messages - InGameShare bool - // Options to be used to copy content of the message without reference to the original - // sender; pass null to forward the message as usual - CopyOptions MessageCopyOptions -} - -// InputMessageForwardedTypeID is TL type id of InputMessageForwarded. -const InputMessageForwardedTypeID = 0x651a73f8 - -// construct implements constructor of InputMessageContentClass. -func (i InputMessageForwarded) construct() InputMessageContentClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageForwarded. -var ( - _ bin.Encoder = &InputMessageForwarded{} - _ bin.Decoder = &InputMessageForwarded{} - _ bin.BareEncoder = &InputMessageForwarded{} - _ bin.BareDecoder = &InputMessageForwarded{} - - _ InputMessageContentClass = &InputMessageForwarded{} -) - -func (i *InputMessageForwarded) Zero() bool { - if i == nil { - return true - } - if !(i.FromChatID == 0) { - return false - } - if !(i.MessageID == 0) { - return false - } - if !(i.InGameShare == false) { - return false - } - if !(i.CopyOptions.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageForwarded) String() string { - if i == nil { - return "InputMessageForwarded(nil)" - } - type Alias InputMessageForwarded - return fmt.Sprintf("InputMessageForwarded%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageForwarded) TypeID() uint32 { - return InputMessageForwardedTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageForwarded) TypeName() string { - return "inputMessageForwarded" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageForwarded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageForwarded", - ID: InputMessageForwardedTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FromChatID", - SchemaName: "from_chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "InGameShare", - SchemaName: "in_game_share", - }, - { - Name: "CopyOptions", - SchemaName: "copy_options", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageForwarded) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageForwarded#651a73f8 as nil") - } - b.PutID(InputMessageForwardedTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageForwarded) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageForwarded#651a73f8 as nil") - } - b.PutInt53(i.FromChatID) - b.PutInt53(i.MessageID) - b.PutBool(i.InGameShare) - if err := i.CopyOptions.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageForwarded#651a73f8: field copy_options: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageForwarded) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageForwarded#651a73f8 to nil") - } - if err := b.ConsumeID(InputMessageForwardedTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageForwarded#651a73f8: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageForwarded) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageForwarded#651a73f8 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageForwarded#651a73f8: field from_chat_id: %w", err) - } - i.FromChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageForwarded#651a73f8: field message_id: %w", err) - } - i.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageForwarded#651a73f8: field in_game_share: %w", err) - } - i.InGameShare = value - } - { - if err := i.CopyOptions.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageForwarded#651a73f8: field copy_options: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageForwarded) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageForwarded#651a73f8 as nil") - } - b.ObjStart() - b.PutID("inputMessageForwarded") - b.Comma() - b.FieldStart("from_chat_id") - b.PutInt53(i.FromChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(i.MessageID) - b.Comma() - b.FieldStart("in_game_share") - b.PutBool(i.InGameShare) - b.Comma() - b.FieldStart("copy_options") - if err := i.CopyOptions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageForwarded#651a73f8: field copy_options: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageForwarded) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageForwarded#651a73f8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageForwarded"); err != nil { - return fmt.Errorf("unable to decode inputMessageForwarded#651a73f8: %w", err) - } - case "from_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageForwarded#651a73f8: field from_chat_id: %w", err) - } - i.FromChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageForwarded#651a73f8: field message_id: %w", err) - } - i.MessageID = value - case "in_game_share": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputMessageForwarded#651a73f8: field in_game_share: %w", err) - } - i.InGameShare = value - case "copy_options": - if err := i.CopyOptions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageForwarded#651a73f8: field copy_options: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFromChatID returns value of FromChatID field. -func (i *InputMessageForwarded) GetFromChatID() (value int64) { - if i == nil { - return - } - return i.FromChatID -} - -// GetMessageID returns value of MessageID field. -func (i *InputMessageForwarded) GetMessageID() (value int64) { - if i == nil { - return - } - return i.MessageID -} - -// GetInGameShare returns value of InGameShare field. -func (i *InputMessageForwarded) GetInGameShare() (value bool) { - if i == nil { - return - } - return i.InGameShare -} - -// GetCopyOptions returns value of CopyOptions field. -func (i *InputMessageForwarded) GetCopyOptions() (value MessageCopyOptions) { - if i == nil { - return - } - return i.CopyOptions -} - -// InputMessageContentClassName is schema name of InputMessageContentClass. -const InputMessageContentClassName = "InputMessageContent" - -// InputMessageContentClass represents InputMessageContent generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputMessageContent(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputMessageText: // inputMessageText#f350d894 -// case *tdapi.InputMessageAnimation: // inputMessageAnimation#19fe563 -// case *tdapi.InputMessageAudio: // inputMessageAudio#daa400b2 -// case *tdapi.InputMessageDocument: // inputMessageDocument#615b72b9 -// case *tdapi.InputMessagePaidMedia: // inputMessagePaidMedia#370c4490 -// case *tdapi.InputMessagePhoto: // inputMessagePhoto#bc78dbcc -// case *tdapi.InputMessageSticker: // inputMessageSticker#3ff1b6f9 -// case *tdapi.InputMessageVideo: // inputMessageVideo#1a64cc26 -// case *tdapi.InputMessageVideoNote: // inputMessageVideoNote#d56816dd -// case *tdapi.InputMessageVoiceNote: // inputMessageVoiceNote#5723ffac -// case *tdapi.InputMessageLocation: // inputMessageLocation#26aae970 -// case *tdapi.InputMessageVenue: // inputMessageVenue#564d99fd -// case *tdapi.InputMessageContact: // inputMessageContact#c5710cff -// case *tdapi.InputMessageDice: // inputMessageDice#322967a9 -// case *tdapi.InputMessageGame: // inputMessageGame#4aae6ae2 -// case *tdapi.InputMessageInvoice: // inputMessageInvoice#babc8f71 -// case *tdapi.InputMessagePoll: // inputMessagePoll#9046c716 -// case *tdapi.InputMessageStory: // inputMessageStory#21099d63 -// case *tdapi.InputMessageForwarded: // inputMessageForwarded#651a73f8 -// default: panic(v) -// } -type InputMessageContentClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputMessageContentClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInputMessageContent implements binary de-serialization for InputMessageContentClass. -func DecodeInputMessageContent(buf *bin.Buffer) (InputMessageContentClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputMessageTextTypeID: - // Decoding inputMessageText#f350d894. - v := InputMessageText{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageAnimationTypeID: - // Decoding inputMessageAnimation#19fe563. - v := InputMessageAnimation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageAudioTypeID: - // Decoding inputMessageAudio#daa400b2. - v := InputMessageAudio{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageDocumentTypeID: - // Decoding inputMessageDocument#615b72b9. - v := InputMessageDocument{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessagePaidMediaTypeID: - // Decoding inputMessagePaidMedia#370c4490. - v := InputMessagePaidMedia{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessagePhotoTypeID: - // Decoding inputMessagePhoto#bc78dbcc. - v := InputMessagePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageStickerTypeID: - // Decoding inputMessageSticker#3ff1b6f9. - v := InputMessageSticker{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageVideoTypeID: - // Decoding inputMessageVideo#1a64cc26. - v := InputMessageVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageVideoNoteTypeID: - // Decoding inputMessageVideoNote#d56816dd. - v := InputMessageVideoNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageVoiceNoteTypeID: - // Decoding inputMessageVoiceNote#5723ffac. - v := InputMessageVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageLocationTypeID: - // Decoding inputMessageLocation#26aae970. - v := InputMessageLocation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageVenueTypeID: - // Decoding inputMessageVenue#564d99fd. - v := InputMessageVenue{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageContactTypeID: - // Decoding inputMessageContact#c5710cff. - v := InputMessageContact{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageDiceTypeID: - // Decoding inputMessageDice#322967a9. - v := InputMessageDice{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageGameTypeID: - // Decoding inputMessageGame#4aae6ae2. - v := InputMessageGame{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageInvoiceTypeID: - // Decoding inputMessageInvoice#babc8f71. - v := InputMessageInvoice{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessagePollTypeID: - // Decoding inputMessagePoll#9046c716. - v := InputMessagePoll{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageStoryTypeID: - // Decoding inputMessageStory#21099d63. - v := InputMessageStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case InputMessageForwardedTypeID: - // Decoding inputMessageForwarded#651a73f8. - v := InputMessageForwarded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputMessageContent implements binary de-serialization for InputMessageContentClass. -func DecodeTDLibJSONInputMessageContent(buf tdjson.Decoder) (InputMessageContentClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputMessageText": - // Decoding inputMessageText#f350d894. - v := InputMessageText{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageAnimation": - // Decoding inputMessageAnimation#19fe563. - v := InputMessageAnimation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageAudio": - // Decoding inputMessageAudio#daa400b2. - v := InputMessageAudio{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageDocument": - // Decoding inputMessageDocument#615b72b9. - v := InputMessageDocument{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessagePaidMedia": - // Decoding inputMessagePaidMedia#370c4490. - v := InputMessagePaidMedia{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessagePhoto": - // Decoding inputMessagePhoto#bc78dbcc. - v := InputMessagePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageSticker": - // Decoding inputMessageSticker#3ff1b6f9. - v := InputMessageSticker{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageVideo": - // Decoding inputMessageVideo#1a64cc26. - v := InputMessageVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageVideoNote": - // Decoding inputMessageVideoNote#d56816dd. - v := InputMessageVideoNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageVoiceNote": - // Decoding inputMessageVoiceNote#5723ffac. - v := InputMessageVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageLocation": - // Decoding inputMessageLocation#26aae970. - v := InputMessageLocation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageVenue": - // Decoding inputMessageVenue#564d99fd. - v := InputMessageVenue{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageContact": - // Decoding inputMessageContact#c5710cff. - v := InputMessageContact{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageDice": - // Decoding inputMessageDice#322967a9. - v := InputMessageDice{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageGame": - // Decoding inputMessageGame#4aae6ae2. - v := InputMessageGame{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageInvoice": - // Decoding inputMessageInvoice#babc8f71. - v := InputMessageInvoice{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessagePoll": - // Decoding inputMessagePoll#9046c716. - v := InputMessagePoll{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageStory": - // Decoding inputMessageStory#21099d63. - v := InputMessageStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - case "inputMessageForwarded": - // Decoding inputMessageForwarded#651a73f8. - v := InputMessageForwarded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputMessageContentClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputMessageContent boxes the InputMessageContentClass providing a helper. -type InputMessageContentBox struct { - InputMessageContent InputMessageContentClass -} - -// Decode implements bin.Decoder for InputMessageContentBox. -func (b *InputMessageContentBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputMessageContentBox to nil") - } - v, err := DecodeInputMessageContent(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputMessageContent = v - return nil -} - -// Encode implements bin.Encode for InputMessageContentBox. -func (b *InputMessageContentBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputMessageContent == nil { - return fmt.Errorf("unable to encode InputMessageContentClass as nil") - } - return b.InputMessageContent.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputMessageContentBox. -func (b *InputMessageContentBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputMessageContentBox to nil") - } - v, err := DecodeTDLibJSONInputMessageContent(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputMessageContent = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputMessageContentBox. -func (b *InputMessageContentBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputMessageContent == nil { - return fmt.Errorf("unable to encode InputMessageContentClass as nil") - } - return b.InputMessageContent.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_message_reply_to_gen.go b/tdapi/tl_input_message_reply_to_gen.go deleted file mode 100644 index b239d56bf..000000000 --- a/tdapi/tl_input_message_reply_to_gen.go +++ /dev/null @@ -1,824 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputMessageReplyToMessage represents TL type `inputMessageReplyToMessage#c25e9903`. -type InputMessageReplyToMessage struct { - // The identifier of the message to be replied in the same chat and forum topic. A - // message can be replied in the same chat and forum topic only if messageProperties - // can_be_replied - MessageID int64 - // Quote from the message to be replied; pass null if none. Must always be null for - // replies in secret chats - Quote InputTextQuote -} - -// InputMessageReplyToMessageTypeID is TL type id of InputMessageReplyToMessage. -const InputMessageReplyToMessageTypeID = 0xc25e9903 - -// construct implements constructor of InputMessageReplyToClass. -func (i InputMessageReplyToMessage) construct() InputMessageReplyToClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageReplyToMessage. -var ( - _ bin.Encoder = &InputMessageReplyToMessage{} - _ bin.Decoder = &InputMessageReplyToMessage{} - _ bin.BareEncoder = &InputMessageReplyToMessage{} - _ bin.BareDecoder = &InputMessageReplyToMessage{} - - _ InputMessageReplyToClass = &InputMessageReplyToMessage{} -) - -func (i *InputMessageReplyToMessage) Zero() bool { - if i == nil { - return true - } - if !(i.MessageID == 0) { - return false - } - if !(i.Quote.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageReplyToMessage) String() string { - if i == nil { - return "InputMessageReplyToMessage(nil)" - } - type Alias InputMessageReplyToMessage - return fmt.Sprintf("InputMessageReplyToMessage%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageReplyToMessage) TypeID() uint32 { - return InputMessageReplyToMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageReplyToMessage) TypeName() string { - return "inputMessageReplyToMessage" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageReplyToMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageReplyToMessage", - ID: InputMessageReplyToMessageTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Quote", - SchemaName: "quote", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageReplyToMessage) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToMessage#c25e9903 as nil") - } - b.PutID(InputMessageReplyToMessageTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageReplyToMessage) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToMessage#c25e9903 as nil") - } - b.PutInt53(i.MessageID) - if err := i.Quote.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageReplyToMessage#c25e9903: field quote: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageReplyToMessage) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToMessage#c25e9903 to nil") - } - if err := b.ConsumeID(InputMessageReplyToMessageTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#c25e9903: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageReplyToMessage) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToMessage#c25e9903 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#c25e9903: field message_id: %w", err) - } - i.MessageID = value - } - { - if err := i.Quote.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#c25e9903: field quote: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageReplyToMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToMessage#c25e9903 as nil") - } - b.ObjStart() - b.PutID("inputMessageReplyToMessage") - b.Comma() - b.FieldStart("message_id") - b.PutInt53(i.MessageID) - b.Comma() - b.FieldStart("quote") - if err := i.Quote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageReplyToMessage#c25e9903: field quote: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageReplyToMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToMessage#c25e9903 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageReplyToMessage"); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#c25e9903: %w", err) - } - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#c25e9903: field message_id: %w", err) - } - i.MessageID = value - case "quote": - if err := i.Quote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToMessage#c25e9903: field quote: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageID returns value of MessageID field. -func (i *InputMessageReplyToMessage) GetMessageID() (value int64) { - if i == nil { - return - } - return i.MessageID -} - -// GetQuote returns value of Quote field. -func (i *InputMessageReplyToMessage) GetQuote() (value InputTextQuote) { - if i == nil { - return - } - return i.Quote -} - -// InputMessageReplyToExternalMessage represents TL type `inputMessageReplyToExternalMessage#892d232a`. -type InputMessageReplyToExternalMessage struct { - // The identifier of the chat to which the message to be replied belongs - ChatID int64 - // The identifier of the message to be replied in the specified chat. A message can be - // replied in another chat or forum topic only if messageProperties - // can_be_replied_in_another_chat - MessageID int64 - // Quote from the message to be replied; pass null if none - Quote InputTextQuote -} - -// InputMessageReplyToExternalMessageTypeID is TL type id of InputMessageReplyToExternalMessage. -const InputMessageReplyToExternalMessageTypeID = 0x892d232a - -// construct implements constructor of InputMessageReplyToClass. -func (i InputMessageReplyToExternalMessage) construct() InputMessageReplyToClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageReplyToExternalMessage. -var ( - _ bin.Encoder = &InputMessageReplyToExternalMessage{} - _ bin.Decoder = &InputMessageReplyToExternalMessage{} - _ bin.BareEncoder = &InputMessageReplyToExternalMessage{} - _ bin.BareDecoder = &InputMessageReplyToExternalMessage{} - - _ InputMessageReplyToClass = &InputMessageReplyToExternalMessage{} -) - -func (i *InputMessageReplyToExternalMessage) Zero() bool { - if i == nil { - return true - } - if !(i.ChatID == 0) { - return false - } - if !(i.MessageID == 0) { - return false - } - if !(i.Quote.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageReplyToExternalMessage) String() string { - if i == nil { - return "InputMessageReplyToExternalMessage(nil)" - } - type Alias InputMessageReplyToExternalMessage - return fmt.Sprintf("InputMessageReplyToExternalMessage%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageReplyToExternalMessage) TypeID() uint32 { - return InputMessageReplyToExternalMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageReplyToExternalMessage) TypeName() string { - return "inputMessageReplyToExternalMessage" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageReplyToExternalMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageReplyToExternalMessage", - ID: InputMessageReplyToExternalMessageTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Quote", - SchemaName: "quote", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageReplyToExternalMessage) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToExternalMessage#892d232a as nil") - } - b.PutID(InputMessageReplyToExternalMessageTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageReplyToExternalMessage) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToExternalMessage#892d232a as nil") - } - b.PutInt53(i.ChatID) - b.PutInt53(i.MessageID) - if err := i.Quote.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputMessageReplyToExternalMessage#892d232a: field quote: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageReplyToExternalMessage) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToExternalMessage#892d232a to nil") - } - if err := b.ConsumeID(InputMessageReplyToExternalMessageTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToExternalMessage#892d232a: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageReplyToExternalMessage) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToExternalMessage#892d232a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToExternalMessage#892d232a: field chat_id: %w", err) - } - i.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToExternalMessage#892d232a: field message_id: %w", err) - } - i.MessageID = value - } - { - if err := i.Quote.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToExternalMessage#892d232a: field quote: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageReplyToExternalMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToExternalMessage#892d232a as nil") - } - b.ObjStart() - b.PutID("inputMessageReplyToExternalMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(i.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(i.MessageID) - b.Comma() - b.FieldStart("quote") - if err := i.Quote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputMessageReplyToExternalMessage#892d232a: field quote: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageReplyToExternalMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToExternalMessage#892d232a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageReplyToExternalMessage"); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToExternalMessage#892d232a: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToExternalMessage#892d232a: field chat_id: %w", err) - } - i.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToExternalMessage#892d232a: field message_id: %w", err) - } - i.MessageID = value - case "quote": - if err := i.Quote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToExternalMessage#892d232a: field quote: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (i *InputMessageReplyToExternalMessage) GetChatID() (value int64) { - if i == nil { - return - } - return i.ChatID -} - -// GetMessageID returns value of MessageID field. -func (i *InputMessageReplyToExternalMessage) GetMessageID() (value int64) { - if i == nil { - return - } - return i.MessageID -} - -// GetQuote returns value of Quote field. -func (i *InputMessageReplyToExternalMessage) GetQuote() (value InputTextQuote) { - if i == nil { - return - } - return i.Quote -} - -// InputMessageReplyToStory represents TL type `inputMessageReplyToStory#51aece78`. -type InputMessageReplyToStory struct { - // The identifier of the sender of the story. Currently, stories can be replied only in - // the sender's chat and channel stories can't be replied - StorySenderChatID int64 - // The identifier of the story - StoryID int32 -} - -// InputMessageReplyToStoryTypeID is TL type id of InputMessageReplyToStory. -const InputMessageReplyToStoryTypeID = 0x51aece78 - -// construct implements constructor of InputMessageReplyToClass. -func (i InputMessageReplyToStory) construct() InputMessageReplyToClass { return &i } - -// Ensuring interfaces in compile-time for InputMessageReplyToStory. -var ( - _ bin.Encoder = &InputMessageReplyToStory{} - _ bin.Decoder = &InputMessageReplyToStory{} - _ bin.BareEncoder = &InputMessageReplyToStory{} - _ bin.BareDecoder = &InputMessageReplyToStory{} - - _ InputMessageReplyToClass = &InputMessageReplyToStory{} -) - -func (i *InputMessageReplyToStory) Zero() bool { - if i == nil { - return true - } - if !(i.StorySenderChatID == 0) { - return false - } - if !(i.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputMessageReplyToStory) String() string { - if i == nil { - return "InputMessageReplyToStory(nil)" - } - type Alias InputMessageReplyToStory - return fmt.Sprintf("InputMessageReplyToStory%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputMessageReplyToStory) TypeID() uint32 { - return InputMessageReplyToStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputMessageReplyToStory) TypeName() string { - return "inputMessageReplyToStory" -} - -// TypeInfo returns info about TL type. -func (i *InputMessageReplyToStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputMessageReplyToStory", - ID: InputMessageReplyToStoryTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputMessageReplyToStory) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToStory#51aece78 as nil") - } - b.PutID(InputMessageReplyToStoryTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputMessageReplyToStory) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToStory#51aece78 as nil") - } - b.PutInt53(i.StorySenderChatID) - b.PutInt32(i.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputMessageReplyToStory) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToStory#51aece78 to nil") - } - if err := b.ConsumeID(InputMessageReplyToStoryTypeID); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToStory#51aece78: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputMessageReplyToStory) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToStory#51aece78 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToStory#51aece78: field story_sender_chat_id: %w", err) - } - i.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToStory#51aece78: field story_id: %w", err) - } - i.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputMessageReplyToStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputMessageReplyToStory#51aece78 as nil") - } - b.ObjStart() - b.PutID("inputMessageReplyToStory") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(i.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(i.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputMessageReplyToStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputMessageReplyToStory#51aece78 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputMessageReplyToStory"); err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToStory#51aece78: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToStory#51aece78: field story_sender_chat_id: %w", err) - } - i.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputMessageReplyToStory#51aece78: field story_id: %w", err) - } - i.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (i *InputMessageReplyToStory) GetStorySenderChatID() (value int64) { - if i == nil { - return - } - return i.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (i *InputMessageReplyToStory) GetStoryID() (value int32) { - if i == nil { - return - } - return i.StoryID -} - -// InputMessageReplyToClassName is schema name of InputMessageReplyToClass. -const InputMessageReplyToClassName = "InputMessageReplyTo" - -// InputMessageReplyToClass represents InputMessageReplyTo generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputMessageReplyTo(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputMessageReplyToMessage: // inputMessageReplyToMessage#c25e9903 -// case *tdapi.InputMessageReplyToExternalMessage: // inputMessageReplyToExternalMessage#892d232a -// case *tdapi.InputMessageReplyToStory: // inputMessageReplyToStory#51aece78 -// default: panic(v) -// } -type InputMessageReplyToClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputMessageReplyToClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInputMessageReplyTo implements binary de-serialization for InputMessageReplyToClass. -func DecodeInputMessageReplyTo(buf *bin.Buffer) (InputMessageReplyToClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputMessageReplyToMessageTypeID: - // Decoding inputMessageReplyToMessage#c25e9903. - v := InputMessageReplyToMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageReplyToClass: %w", err) - } - return &v, nil - case InputMessageReplyToExternalMessageTypeID: - // Decoding inputMessageReplyToExternalMessage#892d232a. - v := InputMessageReplyToExternalMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageReplyToClass: %w", err) - } - return &v, nil - case InputMessageReplyToStoryTypeID: - // Decoding inputMessageReplyToStory#51aece78. - v := InputMessageReplyToStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageReplyToClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputMessageReplyToClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputMessageReplyTo implements binary de-serialization for InputMessageReplyToClass. -func DecodeTDLibJSONInputMessageReplyTo(buf tdjson.Decoder) (InputMessageReplyToClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputMessageReplyToMessage": - // Decoding inputMessageReplyToMessage#c25e9903. - v := InputMessageReplyToMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageReplyToClass: %w", err) - } - return &v, nil - case "inputMessageReplyToExternalMessage": - // Decoding inputMessageReplyToExternalMessage#892d232a. - v := InputMessageReplyToExternalMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageReplyToClass: %w", err) - } - return &v, nil - case "inputMessageReplyToStory": - // Decoding inputMessageReplyToStory#51aece78. - v := InputMessageReplyToStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputMessageReplyToClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputMessageReplyToClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputMessageReplyTo boxes the InputMessageReplyToClass providing a helper. -type InputMessageReplyToBox struct { - InputMessageReplyTo InputMessageReplyToClass -} - -// Decode implements bin.Decoder for InputMessageReplyToBox. -func (b *InputMessageReplyToBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputMessageReplyToBox to nil") - } - v, err := DecodeInputMessageReplyTo(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputMessageReplyTo = v - return nil -} - -// Encode implements bin.Encode for InputMessageReplyToBox. -func (b *InputMessageReplyToBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputMessageReplyTo == nil { - return fmt.Errorf("unable to encode InputMessageReplyToClass as nil") - } - return b.InputMessageReplyTo.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputMessageReplyToBox. -func (b *InputMessageReplyToBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputMessageReplyToBox to nil") - } - v, err := DecodeTDLibJSONInputMessageReplyTo(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputMessageReplyTo = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputMessageReplyToBox. -func (b *InputMessageReplyToBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputMessageReplyTo == nil { - return fmt.Errorf("unable to encode InputMessageReplyToClass as nil") - } - return b.InputMessageReplyTo.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_paid_media_gen.go b/tdapi/tl_input_paid_media_gen.go deleted file mode 100644 index b09b40c47..000000000 --- a/tdapi/tl_input_paid_media_gen.go +++ /dev/null @@ -1,407 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputPaidMedia represents TL type `inputPaidMedia#19f0fc79`. -type InputPaidMedia struct { - // Type of the media - Type InputPaidMediaTypeClass - // Photo or video to be sent - Media InputFileClass - // Media thumbnail; pass null to skip thumbnail uploading - Thumbnail InputThumbnail - // File identifiers of the stickers added to the media, if applicable - AddedStickerFileIDs []int32 - // Media width - Width int32 - // Media height - Height int32 -} - -// InputPaidMediaTypeID is TL type id of InputPaidMedia. -const InputPaidMediaTypeID = 0x19f0fc79 - -// Ensuring interfaces in compile-time for InputPaidMedia. -var ( - _ bin.Encoder = &InputPaidMedia{} - _ bin.Decoder = &InputPaidMedia{} - _ bin.BareEncoder = &InputPaidMedia{} - _ bin.BareDecoder = &InputPaidMedia{} -) - -func (i *InputPaidMedia) Zero() bool { - if i == nil { - return true - } - if !(i.Type == nil) { - return false - } - if !(i.Media == nil) { - return false - } - if !(i.Thumbnail.Zero()) { - return false - } - if !(i.AddedStickerFileIDs == nil) { - return false - } - if !(i.Width == 0) { - return false - } - if !(i.Height == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPaidMedia) String() string { - if i == nil { - return "InputPaidMedia(nil)" - } - type Alias InputPaidMedia - return fmt.Sprintf("InputPaidMedia%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPaidMedia) TypeID() uint32 { - return InputPaidMediaTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPaidMedia) TypeName() string { - return "inputPaidMedia" -} - -// TypeInfo returns info about TL type. -func (i *InputPaidMedia) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPaidMedia", - ID: InputPaidMediaTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "Media", - SchemaName: "media", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "AddedStickerFileIDs", - SchemaName: "added_sticker_file_ids", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPaidMedia) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPaidMedia#19f0fc79 as nil") - } - b.PutID(InputPaidMediaTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPaidMedia) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPaidMedia#19f0fc79 as nil") - } - if i.Type == nil { - return fmt.Errorf("unable to encode inputPaidMedia#19f0fc79: field type is nil") - } - if err := i.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPaidMedia#19f0fc79: field type: %w", err) - } - if i.Media == nil { - return fmt.Errorf("unable to encode inputPaidMedia#19f0fc79: field media is nil") - } - if err := i.Media.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPaidMedia#19f0fc79: field media: %w", err) - } - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPaidMedia#19f0fc79: field thumbnail: %w", err) - } - b.PutInt(len(i.AddedStickerFileIDs)) - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - } - b.PutInt32(i.Width) - b.PutInt32(i.Height) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPaidMedia) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPaidMedia#19f0fc79 to nil") - } - if err := b.ConsumeID(InputPaidMediaTypeID); err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPaidMedia) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPaidMedia#19f0fc79 to nil") - } - { - value, err := DecodeInputPaidMediaType(b) - if err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field type: %w", err) - } - i.Type = value - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field media: %w", err) - } - i.Media = value - } - { - if err := i.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field thumbnail: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field added_sticker_file_ids: %w", err) - } - - if headerLen > 0 { - i.AddedStickerFileIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field width: %w", err) - } - i.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field height: %w", err) - } - i.Height = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPaidMedia) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPaidMedia#19f0fc79 as nil") - } - b.ObjStart() - b.PutID("inputPaidMedia") - b.Comma() - b.FieldStart("type") - if i.Type == nil { - return fmt.Errorf("unable to encode inputPaidMedia#19f0fc79: field type is nil") - } - if err := i.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPaidMedia#19f0fc79: field type: %w", err) - } - b.Comma() - b.FieldStart("media") - if i.Media == nil { - return fmt.Errorf("unable to encode inputPaidMedia#19f0fc79: field media is nil") - } - if err := i.Media.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPaidMedia#19f0fc79: field media: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPaidMedia#19f0fc79: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("added_sticker_file_ids") - b.ArrStart() - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("width") - b.PutInt32(i.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(i.Height) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPaidMedia) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPaidMedia#19f0fc79 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPaidMedia"); err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: %w", err) - } - case "type": - value, err := DecodeTDLibJSONInputPaidMediaType(b) - if err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field type: %w", err) - } - i.Type = value - case "media": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field media: %w", err) - } - i.Media = value - case "thumbnail": - if err := i.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field thumbnail: %w", err) - } - case "added_sticker_file_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field added_sticker_file_ids: %w", err) - } - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field width: %w", err) - } - i.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputPaidMedia#19f0fc79: field height: %w", err) - } - i.Height = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (i *InputPaidMedia) GetType() (value InputPaidMediaTypeClass) { - if i == nil { - return - } - return i.Type -} - -// GetMedia returns value of Media field. -func (i *InputPaidMedia) GetMedia() (value InputFileClass) { - if i == nil { - return - } - return i.Media -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InputPaidMedia) GetThumbnail() (value InputThumbnail) { - if i == nil { - return - } - return i.Thumbnail -} - -// GetAddedStickerFileIDs returns value of AddedStickerFileIDs field. -func (i *InputPaidMedia) GetAddedStickerFileIDs() (value []int32) { - if i == nil { - return - } - return i.AddedStickerFileIDs -} - -// GetWidth returns value of Width field. -func (i *InputPaidMedia) GetWidth() (value int32) { - if i == nil { - return - } - return i.Width -} - -// GetHeight returns value of Height field. -func (i *InputPaidMedia) GetHeight() (value int32) { - if i == nil { - return - } - return i.Height -} diff --git a/tdapi/tl_input_paid_media_type_gen.go b/tdapi/tl_input_paid_media_type_gen.go deleted file mode 100644 index 7f5060b1e..000000000 --- a/tdapi/tl_input_paid_media_type_gen.go +++ /dev/null @@ -1,500 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputPaidMediaTypePhoto represents TL type `inputPaidMediaTypePhoto#d299fd1a`. -type InputPaidMediaTypePhoto struct { -} - -// InputPaidMediaTypePhotoTypeID is TL type id of InputPaidMediaTypePhoto. -const InputPaidMediaTypePhotoTypeID = 0xd299fd1a - -// construct implements constructor of InputPaidMediaTypeClass. -func (i InputPaidMediaTypePhoto) construct() InputPaidMediaTypeClass { return &i } - -// Ensuring interfaces in compile-time for InputPaidMediaTypePhoto. -var ( - _ bin.Encoder = &InputPaidMediaTypePhoto{} - _ bin.Decoder = &InputPaidMediaTypePhoto{} - _ bin.BareEncoder = &InputPaidMediaTypePhoto{} - _ bin.BareDecoder = &InputPaidMediaTypePhoto{} - - _ InputPaidMediaTypeClass = &InputPaidMediaTypePhoto{} -) - -func (i *InputPaidMediaTypePhoto) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPaidMediaTypePhoto) String() string { - if i == nil { - return "InputPaidMediaTypePhoto(nil)" - } - type Alias InputPaidMediaTypePhoto - return fmt.Sprintf("InputPaidMediaTypePhoto%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPaidMediaTypePhoto) TypeID() uint32 { - return InputPaidMediaTypePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPaidMediaTypePhoto) TypeName() string { - return "inputPaidMediaTypePhoto" -} - -// TypeInfo returns info about TL type. -func (i *InputPaidMediaTypePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPaidMediaTypePhoto", - ID: InputPaidMediaTypePhotoTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPaidMediaTypePhoto) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPaidMediaTypePhoto#d299fd1a as nil") - } - b.PutID(InputPaidMediaTypePhotoTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPaidMediaTypePhoto) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPaidMediaTypePhoto#d299fd1a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPaidMediaTypePhoto) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPaidMediaTypePhoto#d299fd1a to nil") - } - if err := b.ConsumeID(InputPaidMediaTypePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode inputPaidMediaTypePhoto#d299fd1a: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPaidMediaTypePhoto) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPaidMediaTypePhoto#d299fd1a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPaidMediaTypePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPaidMediaTypePhoto#d299fd1a as nil") - } - b.ObjStart() - b.PutID("inputPaidMediaTypePhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPaidMediaTypePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPaidMediaTypePhoto#d299fd1a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPaidMediaTypePhoto"); err != nil { - return fmt.Errorf("unable to decode inputPaidMediaTypePhoto#d299fd1a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InputPaidMediaTypeVideo represents TL type `inputPaidMediaTypeVideo#b053f9fc`. -type InputPaidMediaTypeVideo struct { - // Duration of the video, in seconds - Duration int32 - // True, if the video is expected to be streamed - SupportsStreaming bool -} - -// InputPaidMediaTypeVideoTypeID is TL type id of InputPaidMediaTypeVideo. -const InputPaidMediaTypeVideoTypeID = 0xb053f9fc - -// construct implements constructor of InputPaidMediaTypeClass. -func (i InputPaidMediaTypeVideo) construct() InputPaidMediaTypeClass { return &i } - -// Ensuring interfaces in compile-time for InputPaidMediaTypeVideo. -var ( - _ bin.Encoder = &InputPaidMediaTypeVideo{} - _ bin.Decoder = &InputPaidMediaTypeVideo{} - _ bin.BareEncoder = &InputPaidMediaTypeVideo{} - _ bin.BareDecoder = &InputPaidMediaTypeVideo{} - - _ InputPaidMediaTypeClass = &InputPaidMediaTypeVideo{} -) - -func (i *InputPaidMediaTypeVideo) Zero() bool { - if i == nil { - return true - } - if !(i.Duration == 0) { - return false - } - if !(i.SupportsStreaming == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPaidMediaTypeVideo) String() string { - if i == nil { - return "InputPaidMediaTypeVideo(nil)" - } - type Alias InputPaidMediaTypeVideo - return fmt.Sprintf("InputPaidMediaTypeVideo%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPaidMediaTypeVideo) TypeID() uint32 { - return InputPaidMediaTypeVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPaidMediaTypeVideo) TypeName() string { - return "inputPaidMediaTypeVideo" -} - -// TypeInfo returns info about TL type. -func (i *InputPaidMediaTypeVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPaidMediaTypeVideo", - ID: InputPaidMediaTypeVideoTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "SupportsStreaming", - SchemaName: "supports_streaming", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPaidMediaTypeVideo) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPaidMediaTypeVideo#b053f9fc as nil") - } - b.PutID(InputPaidMediaTypeVideoTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPaidMediaTypeVideo) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPaidMediaTypeVideo#b053f9fc as nil") - } - b.PutInt32(i.Duration) - b.PutBool(i.SupportsStreaming) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPaidMediaTypeVideo) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPaidMediaTypeVideo#b053f9fc to nil") - } - if err := b.ConsumeID(InputPaidMediaTypeVideoTypeID); err != nil { - return fmt.Errorf("unable to decode inputPaidMediaTypeVideo#b053f9fc: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPaidMediaTypeVideo) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPaidMediaTypeVideo#b053f9fc to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputPaidMediaTypeVideo#b053f9fc: field duration: %w", err) - } - i.Duration = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputPaidMediaTypeVideo#b053f9fc: field supports_streaming: %w", err) - } - i.SupportsStreaming = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPaidMediaTypeVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPaidMediaTypeVideo#b053f9fc as nil") - } - b.ObjStart() - b.PutID("inputPaidMediaTypeVideo") - b.Comma() - b.FieldStart("duration") - b.PutInt32(i.Duration) - b.Comma() - b.FieldStart("supports_streaming") - b.PutBool(i.SupportsStreaming) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPaidMediaTypeVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPaidMediaTypeVideo#b053f9fc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPaidMediaTypeVideo"); err != nil { - return fmt.Errorf("unable to decode inputPaidMediaTypeVideo#b053f9fc: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputPaidMediaTypeVideo#b053f9fc: field duration: %w", err) - } - i.Duration = value - case "supports_streaming": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputPaidMediaTypeVideo#b053f9fc: field supports_streaming: %w", err) - } - i.SupportsStreaming = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDuration returns value of Duration field. -func (i *InputPaidMediaTypeVideo) GetDuration() (value int32) { - if i == nil { - return - } - return i.Duration -} - -// GetSupportsStreaming returns value of SupportsStreaming field. -func (i *InputPaidMediaTypeVideo) GetSupportsStreaming() (value bool) { - if i == nil { - return - } - return i.SupportsStreaming -} - -// InputPaidMediaTypeClassName is schema name of InputPaidMediaTypeClass. -const InputPaidMediaTypeClassName = "InputPaidMediaType" - -// InputPaidMediaTypeClass represents InputPaidMediaType generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputPaidMediaType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputPaidMediaTypePhoto: // inputPaidMediaTypePhoto#d299fd1a -// case *tdapi.InputPaidMediaTypeVideo: // inputPaidMediaTypeVideo#b053f9fc -// default: panic(v) -// } -type InputPaidMediaTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputPaidMediaTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInputPaidMediaType implements binary de-serialization for InputPaidMediaTypeClass. -func DecodeInputPaidMediaType(buf *bin.Buffer) (InputPaidMediaTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputPaidMediaTypePhotoTypeID: - // Decoding inputPaidMediaTypePhoto#d299fd1a. - v := InputPaidMediaTypePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPaidMediaTypeClass: %w", err) - } - return &v, nil - case InputPaidMediaTypeVideoTypeID: - // Decoding inputPaidMediaTypeVideo#b053f9fc. - v := InputPaidMediaTypeVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPaidMediaTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputPaidMediaTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputPaidMediaType implements binary de-serialization for InputPaidMediaTypeClass. -func DecodeTDLibJSONInputPaidMediaType(buf tdjson.Decoder) (InputPaidMediaTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputPaidMediaTypePhoto": - // Decoding inputPaidMediaTypePhoto#d299fd1a. - v := InputPaidMediaTypePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPaidMediaTypeClass: %w", err) - } - return &v, nil - case "inputPaidMediaTypeVideo": - // Decoding inputPaidMediaTypeVideo#b053f9fc. - v := InputPaidMediaTypeVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPaidMediaTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputPaidMediaTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputPaidMediaType boxes the InputPaidMediaTypeClass providing a helper. -type InputPaidMediaTypeBox struct { - InputPaidMediaType InputPaidMediaTypeClass -} - -// Decode implements bin.Decoder for InputPaidMediaTypeBox. -func (b *InputPaidMediaTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputPaidMediaTypeBox to nil") - } - v, err := DecodeInputPaidMediaType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputPaidMediaType = v - return nil -} - -// Encode implements bin.Encode for InputPaidMediaTypeBox. -func (b *InputPaidMediaTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputPaidMediaType == nil { - return fmt.Errorf("unable to encode InputPaidMediaTypeClass as nil") - } - return b.InputPaidMediaType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputPaidMediaTypeBox. -func (b *InputPaidMediaTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputPaidMediaTypeBox to nil") - } - v, err := DecodeTDLibJSONInputPaidMediaType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputPaidMediaType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputPaidMediaTypeBox. -func (b *InputPaidMediaTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputPaidMediaType == nil { - return fmt.Errorf("unable to encode InputPaidMediaTypeClass as nil") - } - return b.InputPaidMediaType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_passport_element_error_gen.go b/tdapi/tl_input_passport_element_error_gen.go deleted file mode 100644 index 0fb592da4..000000000 --- a/tdapi/tl_input_passport_element_error_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputPassportElementError represents TL type `inputPassportElementError#11084de2`. -type InputPassportElementError struct { - // Type of Telegram Passport element that has the error - Type PassportElementTypeClass - // Error message - Message string - // Error source - Source InputPassportElementErrorSourceClass -} - -// InputPassportElementErrorTypeID is TL type id of InputPassportElementError. -const InputPassportElementErrorTypeID = 0x11084de2 - -// Ensuring interfaces in compile-time for InputPassportElementError. -var ( - _ bin.Encoder = &InputPassportElementError{} - _ bin.Decoder = &InputPassportElementError{} - _ bin.BareEncoder = &InputPassportElementError{} - _ bin.BareDecoder = &InputPassportElementError{} -) - -func (i *InputPassportElementError) Zero() bool { - if i == nil { - return true - } - if !(i.Type == nil) { - return false - } - if !(i.Message == "") { - return false - } - if !(i.Source == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementError) String() string { - if i == nil { - return "InputPassportElementError(nil)" - } - type Alias InputPassportElementError - return fmt.Sprintf("InputPassportElementError%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementError) TypeID() uint32 { - return InputPassportElementErrorTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementError) TypeName() string { - return "inputPassportElementError" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementError) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementError", - ID: InputPassportElementErrorTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "Source", - SchemaName: "source", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementError) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementError#11084de2 as nil") - } - b.PutID(InputPassportElementErrorTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementError) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementError#11084de2 as nil") - } - if i.Type == nil { - return fmt.Errorf("unable to encode inputPassportElementError#11084de2: field type is nil") - } - if err := i.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementError#11084de2: field type: %w", err) - } - b.PutString(i.Message) - if i.Source == nil { - return fmt.Errorf("unable to encode inputPassportElementError#11084de2: field source is nil") - } - if err := i.Source.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementError#11084de2: field source: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementError) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementError#11084de2 to nil") - } - if err := b.ConsumeID(InputPassportElementErrorTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementError#11084de2: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementError) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementError#11084de2 to nil") - } - { - value, err := DecodePassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementError#11084de2: field type: %w", err) - } - i.Type = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementError#11084de2: field message: %w", err) - } - i.Message = value - } - { - value, err := DecodeInputPassportElementErrorSource(b) - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementError#11084de2: field source: %w", err) - } - i.Source = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementError) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementError#11084de2 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementError") - b.Comma() - b.FieldStart("type") - if i.Type == nil { - return fmt.Errorf("unable to encode inputPassportElementError#11084de2: field type is nil") - } - if err := i.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementError#11084de2: field type: %w", err) - } - b.Comma() - b.FieldStart("message") - b.PutString(i.Message) - b.Comma() - b.FieldStart("source") - if i.Source == nil { - return fmt.Errorf("unable to encode inputPassportElementError#11084de2: field source is nil") - } - if err := i.Source.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementError#11084de2: field source: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementError) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementError#11084de2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementError"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementError#11084de2: %w", err) - } - case "type": - value, err := DecodeTDLibJSONPassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementError#11084de2: field type: %w", err) - } - i.Type = value - case "message": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementError#11084de2: field message: %w", err) - } - i.Message = value - case "source": - value, err := DecodeTDLibJSONInputPassportElementErrorSource(b) - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementError#11084de2: field source: %w", err) - } - i.Source = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (i *InputPassportElementError) GetType() (value PassportElementTypeClass) { - if i == nil { - return - } - return i.Type -} - -// GetMessage returns value of Message field. -func (i *InputPassportElementError) GetMessage() (value string) { - if i == nil { - return - } - return i.Message -} - -// GetSource returns value of Source field. -func (i *InputPassportElementError) GetSource() (value InputPassportElementErrorSourceClass) { - if i == nil { - return - } - return i.Source -} diff --git a/tdapi/tl_input_passport_element_error_source_gen.go b/tdapi/tl_input_passport_element_error_source_gen.go deleted file mode 100644 index 931c6d0ec..000000000 --- a/tdapi/tl_input_passport_element_error_source_gen.go +++ /dev/null @@ -1,1868 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputPassportElementErrorSourceUnspecified represents TL type `inputPassportElementErrorSourceUnspecified#fed9c6f`. -type InputPassportElementErrorSourceUnspecified struct { - // Current hash of the entire element - ElementHash []byte -} - -// InputPassportElementErrorSourceUnspecifiedTypeID is TL type id of InputPassportElementErrorSourceUnspecified. -const InputPassportElementErrorSourceUnspecifiedTypeID = 0xfed9c6f - -// construct implements constructor of InputPassportElementErrorSourceClass. -func (i InputPassportElementErrorSourceUnspecified) construct() InputPassportElementErrorSourceClass { - return &i -} - -// Ensuring interfaces in compile-time for InputPassportElementErrorSourceUnspecified. -var ( - _ bin.Encoder = &InputPassportElementErrorSourceUnspecified{} - _ bin.Decoder = &InputPassportElementErrorSourceUnspecified{} - _ bin.BareEncoder = &InputPassportElementErrorSourceUnspecified{} - _ bin.BareDecoder = &InputPassportElementErrorSourceUnspecified{} - - _ InputPassportElementErrorSourceClass = &InputPassportElementErrorSourceUnspecified{} -) - -func (i *InputPassportElementErrorSourceUnspecified) Zero() bool { - if i == nil { - return true - } - if !(i.ElementHash == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementErrorSourceUnspecified) String() string { - if i == nil { - return "InputPassportElementErrorSourceUnspecified(nil)" - } - type Alias InputPassportElementErrorSourceUnspecified - return fmt.Sprintf("InputPassportElementErrorSourceUnspecified%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementErrorSourceUnspecified) TypeID() uint32 { - return InputPassportElementErrorSourceUnspecifiedTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementErrorSourceUnspecified) TypeName() string { - return "inputPassportElementErrorSourceUnspecified" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementErrorSourceUnspecified) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementErrorSourceUnspecified", - ID: InputPassportElementErrorSourceUnspecifiedTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ElementHash", - SchemaName: "element_hash", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementErrorSourceUnspecified) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceUnspecified#fed9c6f as nil") - } - b.PutID(InputPassportElementErrorSourceUnspecifiedTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementErrorSourceUnspecified) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceUnspecified#fed9c6f as nil") - } - b.PutBytes(i.ElementHash) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementErrorSourceUnspecified) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceUnspecified#fed9c6f to nil") - } - if err := b.ConsumeID(InputPassportElementErrorSourceUnspecifiedTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceUnspecified#fed9c6f: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementErrorSourceUnspecified) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceUnspecified#fed9c6f to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceUnspecified#fed9c6f: field element_hash: %w", err) - } - i.ElementHash = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementErrorSourceUnspecified) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceUnspecified#fed9c6f as nil") - } - b.ObjStart() - b.PutID("inputPassportElementErrorSourceUnspecified") - b.Comma() - b.FieldStart("element_hash") - b.PutBytes(i.ElementHash) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementErrorSourceUnspecified) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceUnspecified#fed9c6f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementErrorSourceUnspecified"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceUnspecified#fed9c6f: %w", err) - } - case "element_hash": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceUnspecified#fed9c6f: field element_hash: %w", err) - } - i.ElementHash = value - default: - return b.Skip() - } - return nil - }) -} - -// GetElementHash returns value of ElementHash field. -func (i *InputPassportElementErrorSourceUnspecified) GetElementHash() (value []byte) { - if i == nil { - return - } - return i.ElementHash -} - -// InputPassportElementErrorSourceDataField represents TL type `inputPassportElementErrorSourceDataField#e68fa006`. -type InputPassportElementErrorSourceDataField struct { - // Field name - FieldName string - // Current data hash - DataHash []byte -} - -// InputPassportElementErrorSourceDataFieldTypeID is TL type id of InputPassportElementErrorSourceDataField. -const InputPassportElementErrorSourceDataFieldTypeID = 0xe68fa006 - -// construct implements constructor of InputPassportElementErrorSourceClass. -func (i InputPassportElementErrorSourceDataField) construct() InputPassportElementErrorSourceClass { - return &i -} - -// Ensuring interfaces in compile-time for InputPassportElementErrorSourceDataField. -var ( - _ bin.Encoder = &InputPassportElementErrorSourceDataField{} - _ bin.Decoder = &InputPassportElementErrorSourceDataField{} - _ bin.BareEncoder = &InputPassportElementErrorSourceDataField{} - _ bin.BareDecoder = &InputPassportElementErrorSourceDataField{} - - _ InputPassportElementErrorSourceClass = &InputPassportElementErrorSourceDataField{} -) - -func (i *InputPassportElementErrorSourceDataField) Zero() bool { - if i == nil { - return true - } - if !(i.FieldName == "") { - return false - } - if !(i.DataHash == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementErrorSourceDataField) String() string { - if i == nil { - return "InputPassportElementErrorSourceDataField(nil)" - } - type Alias InputPassportElementErrorSourceDataField - return fmt.Sprintf("InputPassportElementErrorSourceDataField%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementErrorSourceDataField) TypeID() uint32 { - return InputPassportElementErrorSourceDataFieldTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementErrorSourceDataField) TypeName() string { - return "inputPassportElementErrorSourceDataField" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementErrorSourceDataField) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementErrorSourceDataField", - ID: InputPassportElementErrorSourceDataFieldTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FieldName", - SchemaName: "field_name", - }, - { - Name: "DataHash", - SchemaName: "data_hash", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementErrorSourceDataField) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceDataField#e68fa006 as nil") - } - b.PutID(InputPassportElementErrorSourceDataFieldTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementErrorSourceDataField) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceDataField#e68fa006 as nil") - } - b.PutString(i.FieldName) - b.PutBytes(i.DataHash) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementErrorSourceDataField) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceDataField#e68fa006 to nil") - } - if err := b.ConsumeID(InputPassportElementErrorSourceDataFieldTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceDataField#e68fa006: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementErrorSourceDataField) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceDataField#e68fa006 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceDataField#e68fa006: field field_name: %w", err) - } - i.FieldName = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceDataField#e68fa006: field data_hash: %w", err) - } - i.DataHash = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementErrorSourceDataField) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceDataField#e68fa006 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementErrorSourceDataField") - b.Comma() - b.FieldStart("field_name") - b.PutString(i.FieldName) - b.Comma() - b.FieldStart("data_hash") - b.PutBytes(i.DataHash) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementErrorSourceDataField) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceDataField#e68fa006 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementErrorSourceDataField"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceDataField#e68fa006: %w", err) - } - case "field_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceDataField#e68fa006: field field_name: %w", err) - } - i.FieldName = value - case "data_hash": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceDataField#e68fa006: field data_hash: %w", err) - } - i.DataHash = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFieldName returns value of FieldName field. -func (i *InputPassportElementErrorSourceDataField) GetFieldName() (value string) { - if i == nil { - return - } - return i.FieldName -} - -// GetDataHash returns value of DataHash field. -func (i *InputPassportElementErrorSourceDataField) GetDataHash() (value []byte) { - if i == nil { - return - } - return i.DataHash -} - -// InputPassportElementErrorSourceFrontSide represents TL type `inputPassportElementErrorSourceFrontSide#230c87bd`. -type InputPassportElementErrorSourceFrontSide struct { - // Current hash of the file containing the front side - FileHash []byte -} - -// InputPassportElementErrorSourceFrontSideTypeID is TL type id of InputPassportElementErrorSourceFrontSide. -const InputPassportElementErrorSourceFrontSideTypeID = 0x230c87bd - -// construct implements constructor of InputPassportElementErrorSourceClass. -func (i InputPassportElementErrorSourceFrontSide) construct() InputPassportElementErrorSourceClass { - return &i -} - -// Ensuring interfaces in compile-time for InputPassportElementErrorSourceFrontSide. -var ( - _ bin.Encoder = &InputPassportElementErrorSourceFrontSide{} - _ bin.Decoder = &InputPassportElementErrorSourceFrontSide{} - _ bin.BareEncoder = &InputPassportElementErrorSourceFrontSide{} - _ bin.BareDecoder = &InputPassportElementErrorSourceFrontSide{} - - _ InputPassportElementErrorSourceClass = &InputPassportElementErrorSourceFrontSide{} -) - -func (i *InputPassportElementErrorSourceFrontSide) Zero() bool { - if i == nil { - return true - } - if !(i.FileHash == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementErrorSourceFrontSide) String() string { - if i == nil { - return "InputPassportElementErrorSourceFrontSide(nil)" - } - type Alias InputPassportElementErrorSourceFrontSide - return fmt.Sprintf("InputPassportElementErrorSourceFrontSide%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementErrorSourceFrontSide) TypeID() uint32 { - return InputPassportElementErrorSourceFrontSideTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementErrorSourceFrontSide) TypeName() string { - return "inputPassportElementErrorSourceFrontSide" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementErrorSourceFrontSide) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementErrorSourceFrontSide", - ID: InputPassportElementErrorSourceFrontSideTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileHash", - SchemaName: "file_hash", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementErrorSourceFrontSide) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceFrontSide#230c87bd as nil") - } - b.PutID(InputPassportElementErrorSourceFrontSideTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementErrorSourceFrontSide) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceFrontSide#230c87bd as nil") - } - b.PutBytes(i.FileHash) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementErrorSourceFrontSide) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceFrontSide#230c87bd to nil") - } - if err := b.ConsumeID(InputPassportElementErrorSourceFrontSideTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFrontSide#230c87bd: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementErrorSourceFrontSide) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceFrontSide#230c87bd to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFrontSide#230c87bd: field file_hash: %w", err) - } - i.FileHash = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementErrorSourceFrontSide) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceFrontSide#230c87bd as nil") - } - b.ObjStart() - b.PutID("inputPassportElementErrorSourceFrontSide") - b.Comma() - b.FieldStart("file_hash") - b.PutBytes(i.FileHash) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementErrorSourceFrontSide) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceFrontSide#230c87bd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementErrorSourceFrontSide"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFrontSide#230c87bd: %w", err) - } - case "file_hash": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFrontSide#230c87bd: field file_hash: %w", err) - } - i.FileHash = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileHash returns value of FileHash field. -func (i *InputPassportElementErrorSourceFrontSide) GetFileHash() (value []byte) { - if i == nil { - return - } - return i.FileHash -} - -// InputPassportElementErrorSourceReverseSide represents TL type `inputPassportElementErrorSourceReverseSide#189efdfb`. -type InputPassportElementErrorSourceReverseSide struct { - // Current hash of the file containing the reverse side - FileHash []byte -} - -// InputPassportElementErrorSourceReverseSideTypeID is TL type id of InputPassportElementErrorSourceReverseSide. -const InputPassportElementErrorSourceReverseSideTypeID = 0x189efdfb - -// construct implements constructor of InputPassportElementErrorSourceClass. -func (i InputPassportElementErrorSourceReverseSide) construct() InputPassportElementErrorSourceClass { - return &i -} - -// Ensuring interfaces in compile-time for InputPassportElementErrorSourceReverseSide. -var ( - _ bin.Encoder = &InputPassportElementErrorSourceReverseSide{} - _ bin.Decoder = &InputPassportElementErrorSourceReverseSide{} - _ bin.BareEncoder = &InputPassportElementErrorSourceReverseSide{} - _ bin.BareDecoder = &InputPassportElementErrorSourceReverseSide{} - - _ InputPassportElementErrorSourceClass = &InputPassportElementErrorSourceReverseSide{} -) - -func (i *InputPassportElementErrorSourceReverseSide) Zero() bool { - if i == nil { - return true - } - if !(i.FileHash == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementErrorSourceReverseSide) String() string { - if i == nil { - return "InputPassportElementErrorSourceReverseSide(nil)" - } - type Alias InputPassportElementErrorSourceReverseSide - return fmt.Sprintf("InputPassportElementErrorSourceReverseSide%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementErrorSourceReverseSide) TypeID() uint32 { - return InputPassportElementErrorSourceReverseSideTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementErrorSourceReverseSide) TypeName() string { - return "inputPassportElementErrorSourceReverseSide" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementErrorSourceReverseSide) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementErrorSourceReverseSide", - ID: InputPassportElementErrorSourceReverseSideTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileHash", - SchemaName: "file_hash", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementErrorSourceReverseSide) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceReverseSide#189efdfb as nil") - } - b.PutID(InputPassportElementErrorSourceReverseSideTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementErrorSourceReverseSide) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceReverseSide#189efdfb as nil") - } - b.PutBytes(i.FileHash) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementErrorSourceReverseSide) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceReverseSide#189efdfb to nil") - } - if err := b.ConsumeID(InputPassportElementErrorSourceReverseSideTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceReverseSide#189efdfb: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementErrorSourceReverseSide) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceReverseSide#189efdfb to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceReverseSide#189efdfb: field file_hash: %w", err) - } - i.FileHash = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementErrorSourceReverseSide) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceReverseSide#189efdfb as nil") - } - b.ObjStart() - b.PutID("inputPassportElementErrorSourceReverseSide") - b.Comma() - b.FieldStart("file_hash") - b.PutBytes(i.FileHash) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementErrorSourceReverseSide) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceReverseSide#189efdfb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementErrorSourceReverseSide"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceReverseSide#189efdfb: %w", err) - } - case "file_hash": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceReverseSide#189efdfb: field file_hash: %w", err) - } - i.FileHash = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileHash returns value of FileHash field. -func (i *InputPassportElementErrorSourceReverseSide) GetFileHash() (value []byte) { - if i == nil { - return - } - return i.FileHash -} - -// InputPassportElementErrorSourceSelfie represents TL type `inputPassportElementErrorSourceSelfie#d1e42c98`. -type InputPassportElementErrorSourceSelfie struct { - // Current hash of the file containing the selfie - FileHash []byte -} - -// InputPassportElementErrorSourceSelfieTypeID is TL type id of InputPassportElementErrorSourceSelfie. -const InputPassportElementErrorSourceSelfieTypeID = 0xd1e42c98 - -// construct implements constructor of InputPassportElementErrorSourceClass. -func (i InputPassportElementErrorSourceSelfie) construct() InputPassportElementErrorSourceClass { - return &i -} - -// Ensuring interfaces in compile-time for InputPassportElementErrorSourceSelfie. -var ( - _ bin.Encoder = &InputPassportElementErrorSourceSelfie{} - _ bin.Decoder = &InputPassportElementErrorSourceSelfie{} - _ bin.BareEncoder = &InputPassportElementErrorSourceSelfie{} - _ bin.BareDecoder = &InputPassportElementErrorSourceSelfie{} - - _ InputPassportElementErrorSourceClass = &InputPassportElementErrorSourceSelfie{} -) - -func (i *InputPassportElementErrorSourceSelfie) Zero() bool { - if i == nil { - return true - } - if !(i.FileHash == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementErrorSourceSelfie) String() string { - if i == nil { - return "InputPassportElementErrorSourceSelfie(nil)" - } - type Alias InputPassportElementErrorSourceSelfie - return fmt.Sprintf("InputPassportElementErrorSourceSelfie%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementErrorSourceSelfie) TypeID() uint32 { - return InputPassportElementErrorSourceSelfieTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementErrorSourceSelfie) TypeName() string { - return "inputPassportElementErrorSourceSelfie" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementErrorSourceSelfie) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementErrorSourceSelfie", - ID: InputPassportElementErrorSourceSelfieTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileHash", - SchemaName: "file_hash", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementErrorSourceSelfie) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceSelfie#d1e42c98 as nil") - } - b.PutID(InputPassportElementErrorSourceSelfieTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementErrorSourceSelfie) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceSelfie#d1e42c98 as nil") - } - b.PutBytes(i.FileHash) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementErrorSourceSelfie) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceSelfie#d1e42c98 to nil") - } - if err := b.ConsumeID(InputPassportElementErrorSourceSelfieTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceSelfie#d1e42c98: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementErrorSourceSelfie) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceSelfie#d1e42c98 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceSelfie#d1e42c98: field file_hash: %w", err) - } - i.FileHash = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementErrorSourceSelfie) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceSelfie#d1e42c98 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementErrorSourceSelfie") - b.Comma() - b.FieldStart("file_hash") - b.PutBytes(i.FileHash) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementErrorSourceSelfie) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceSelfie#d1e42c98 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementErrorSourceSelfie"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceSelfie#d1e42c98: %w", err) - } - case "file_hash": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceSelfie#d1e42c98: field file_hash: %w", err) - } - i.FileHash = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileHash returns value of FileHash field. -func (i *InputPassportElementErrorSourceSelfie) GetFileHash() (value []byte) { - if i == nil { - return - } - return i.FileHash -} - -// InputPassportElementErrorSourceTranslationFile represents TL type `inputPassportElementErrorSourceTranslationFile#1e268a7b`. -type InputPassportElementErrorSourceTranslationFile struct { - // Current hash of the file containing the translation - FileHash []byte -} - -// InputPassportElementErrorSourceTranslationFileTypeID is TL type id of InputPassportElementErrorSourceTranslationFile. -const InputPassportElementErrorSourceTranslationFileTypeID = 0x1e268a7b - -// construct implements constructor of InputPassportElementErrorSourceClass. -func (i InputPassportElementErrorSourceTranslationFile) construct() InputPassportElementErrorSourceClass { - return &i -} - -// Ensuring interfaces in compile-time for InputPassportElementErrorSourceTranslationFile. -var ( - _ bin.Encoder = &InputPassportElementErrorSourceTranslationFile{} - _ bin.Decoder = &InputPassportElementErrorSourceTranslationFile{} - _ bin.BareEncoder = &InputPassportElementErrorSourceTranslationFile{} - _ bin.BareDecoder = &InputPassportElementErrorSourceTranslationFile{} - - _ InputPassportElementErrorSourceClass = &InputPassportElementErrorSourceTranslationFile{} -) - -func (i *InputPassportElementErrorSourceTranslationFile) Zero() bool { - if i == nil { - return true - } - if !(i.FileHash == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementErrorSourceTranslationFile) String() string { - if i == nil { - return "InputPassportElementErrorSourceTranslationFile(nil)" - } - type Alias InputPassportElementErrorSourceTranslationFile - return fmt.Sprintf("InputPassportElementErrorSourceTranslationFile%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementErrorSourceTranslationFile) TypeID() uint32 { - return InputPassportElementErrorSourceTranslationFileTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementErrorSourceTranslationFile) TypeName() string { - return "inputPassportElementErrorSourceTranslationFile" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementErrorSourceTranslationFile) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementErrorSourceTranslationFile", - ID: InputPassportElementErrorSourceTranslationFileTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileHash", - SchemaName: "file_hash", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementErrorSourceTranslationFile) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceTranslationFile#1e268a7b as nil") - } - b.PutID(InputPassportElementErrorSourceTranslationFileTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementErrorSourceTranslationFile) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceTranslationFile#1e268a7b as nil") - } - b.PutBytes(i.FileHash) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementErrorSourceTranslationFile) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceTranslationFile#1e268a7b to nil") - } - if err := b.ConsumeID(InputPassportElementErrorSourceTranslationFileTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceTranslationFile#1e268a7b: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementErrorSourceTranslationFile) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceTranslationFile#1e268a7b to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceTranslationFile#1e268a7b: field file_hash: %w", err) - } - i.FileHash = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementErrorSourceTranslationFile) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceTranslationFile#1e268a7b as nil") - } - b.ObjStart() - b.PutID("inputPassportElementErrorSourceTranslationFile") - b.Comma() - b.FieldStart("file_hash") - b.PutBytes(i.FileHash) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementErrorSourceTranslationFile) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceTranslationFile#1e268a7b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementErrorSourceTranslationFile"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceTranslationFile#1e268a7b: %w", err) - } - case "file_hash": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceTranslationFile#1e268a7b: field file_hash: %w", err) - } - i.FileHash = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileHash returns value of FileHash field. -func (i *InputPassportElementErrorSourceTranslationFile) GetFileHash() (value []byte) { - if i == nil { - return - } - return i.FileHash -} - -// InputPassportElementErrorSourceTranslationFiles represents TL type `inputPassportElementErrorSourceTranslationFiles#ef54819b`. -type InputPassportElementErrorSourceTranslationFiles struct { - // Current hashes of all files with the translation - FileHashes [][]byte -} - -// InputPassportElementErrorSourceTranslationFilesTypeID is TL type id of InputPassportElementErrorSourceTranslationFiles. -const InputPassportElementErrorSourceTranslationFilesTypeID = 0xef54819b - -// construct implements constructor of InputPassportElementErrorSourceClass. -func (i InputPassportElementErrorSourceTranslationFiles) construct() InputPassportElementErrorSourceClass { - return &i -} - -// Ensuring interfaces in compile-time for InputPassportElementErrorSourceTranslationFiles. -var ( - _ bin.Encoder = &InputPassportElementErrorSourceTranslationFiles{} - _ bin.Decoder = &InputPassportElementErrorSourceTranslationFiles{} - _ bin.BareEncoder = &InputPassportElementErrorSourceTranslationFiles{} - _ bin.BareDecoder = &InputPassportElementErrorSourceTranslationFiles{} - - _ InputPassportElementErrorSourceClass = &InputPassportElementErrorSourceTranslationFiles{} -) - -func (i *InputPassportElementErrorSourceTranslationFiles) Zero() bool { - if i == nil { - return true - } - if !(i.FileHashes == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementErrorSourceTranslationFiles) String() string { - if i == nil { - return "InputPassportElementErrorSourceTranslationFiles(nil)" - } - type Alias InputPassportElementErrorSourceTranslationFiles - return fmt.Sprintf("InputPassportElementErrorSourceTranslationFiles%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementErrorSourceTranslationFiles) TypeID() uint32 { - return InputPassportElementErrorSourceTranslationFilesTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementErrorSourceTranslationFiles) TypeName() string { - return "inputPassportElementErrorSourceTranslationFiles" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementErrorSourceTranslationFiles) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementErrorSourceTranslationFiles", - ID: InputPassportElementErrorSourceTranslationFilesTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileHashes", - SchemaName: "file_hashes", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementErrorSourceTranslationFiles) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceTranslationFiles#ef54819b as nil") - } - b.PutID(InputPassportElementErrorSourceTranslationFilesTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementErrorSourceTranslationFiles) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceTranslationFiles#ef54819b as nil") - } - b.PutInt(len(i.FileHashes)) - for _, v := range i.FileHashes { - b.PutBytes(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementErrorSourceTranslationFiles) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceTranslationFiles#ef54819b to nil") - } - if err := b.ConsumeID(InputPassportElementErrorSourceTranslationFilesTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceTranslationFiles#ef54819b: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementErrorSourceTranslationFiles) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceTranslationFiles#ef54819b to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceTranslationFiles#ef54819b: field file_hashes: %w", err) - } - - if headerLen > 0 { - i.FileHashes = make([][]byte, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceTranslationFiles#ef54819b: field file_hashes: %w", err) - } - i.FileHashes = append(i.FileHashes, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementErrorSourceTranslationFiles) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceTranslationFiles#ef54819b as nil") - } - b.ObjStart() - b.PutID("inputPassportElementErrorSourceTranslationFiles") - b.Comma() - b.FieldStart("file_hashes") - b.ArrStart() - for _, v := range i.FileHashes { - b.PutBytes(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementErrorSourceTranslationFiles) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceTranslationFiles#ef54819b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementErrorSourceTranslationFiles"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceTranslationFiles#ef54819b: %w", err) - } - case "file_hashes": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceTranslationFiles#ef54819b: field file_hashes: %w", err) - } - i.FileHashes = append(i.FileHashes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceTranslationFiles#ef54819b: field file_hashes: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFileHashes returns value of FileHashes field. -func (i *InputPassportElementErrorSourceTranslationFiles) GetFileHashes() (value [][]byte) { - if i == nil { - return - } - return i.FileHashes -} - -// InputPassportElementErrorSourceFile represents TL type `inputPassportElementErrorSourceFile#ee355dcb`. -type InputPassportElementErrorSourceFile struct { - // Current hash of the file which has the error - FileHash []byte -} - -// InputPassportElementErrorSourceFileTypeID is TL type id of InputPassportElementErrorSourceFile. -const InputPassportElementErrorSourceFileTypeID = 0xee355dcb - -// construct implements constructor of InputPassportElementErrorSourceClass. -func (i InputPassportElementErrorSourceFile) construct() InputPassportElementErrorSourceClass { - return &i -} - -// Ensuring interfaces in compile-time for InputPassportElementErrorSourceFile. -var ( - _ bin.Encoder = &InputPassportElementErrorSourceFile{} - _ bin.Decoder = &InputPassportElementErrorSourceFile{} - _ bin.BareEncoder = &InputPassportElementErrorSourceFile{} - _ bin.BareDecoder = &InputPassportElementErrorSourceFile{} - - _ InputPassportElementErrorSourceClass = &InputPassportElementErrorSourceFile{} -) - -func (i *InputPassportElementErrorSourceFile) Zero() bool { - if i == nil { - return true - } - if !(i.FileHash == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementErrorSourceFile) String() string { - if i == nil { - return "InputPassportElementErrorSourceFile(nil)" - } - type Alias InputPassportElementErrorSourceFile - return fmt.Sprintf("InputPassportElementErrorSourceFile%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementErrorSourceFile) TypeID() uint32 { - return InputPassportElementErrorSourceFileTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementErrorSourceFile) TypeName() string { - return "inputPassportElementErrorSourceFile" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementErrorSourceFile) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementErrorSourceFile", - ID: InputPassportElementErrorSourceFileTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileHash", - SchemaName: "file_hash", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementErrorSourceFile) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceFile#ee355dcb as nil") - } - b.PutID(InputPassportElementErrorSourceFileTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementErrorSourceFile) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceFile#ee355dcb as nil") - } - b.PutBytes(i.FileHash) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementErrorSourceFile) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceFile#ee355dcb to nil") - } - if err := b.ConsumeID(InputPassportElementErrorSourceFileTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFile#ee355dcb: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementErrorSourceFile) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceFile#ee355dcb to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFile#ee355dcb: field file_hash: %w", err) - } - i.FileHash = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementErrorSourceFile) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceFile#ee355dcb as nil") - } - b.ObjStart() - b.PutID("inputPassportElementErrorSourceFile") - b.Comma() - b.FieldStart("file_hash") - b.PutBytes(i.FileHash) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementErrorSourceFile) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceFile#ee355dcb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementErrorSourceFile"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFile#ee355dcb: %w", err) - } - case "file_hash": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFile#ee355dcb: field file_hash: %w", err) - } - i.FileHash = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileHash returns value of FileHash field. -func (i *InputPassportElementErrorSourceFile) GetFileHash() (value []byte) { - if i == nil { - return - } - return i.FileHash -} - -// InputPassportElementErrorSourceFiles represents TL type `inputPassportElementErrorSourceFiles#673401d6`. -type InputPassportElementErrorSourceFiles struct { - // Current hashes of all attached files - FileHashes [][]byte -} - -// InputPassportElementErrorSourceFilesTypeID is TL type id of InputPassportElementErrorSourceFiles. -const InputPassportElementErrorSourceFilesTypeID = 0x673401d6 - -// construct implements constructor of InputPassportElementErrorSourceClass. -func (i InputPassportElementErrorSourceFiles) construct() InputPassportElementErrorSourceClass { - return &i -} - -// Ensuring interfaces in compile-time for InputPassportElementErrorSourceFiles. -var ( - _ bin.Encoder = &InputPassportElementErrorSourceFiles{} - _ bin.Decoder = &InputPassportElementErrorSourceFiles{} - _ bin.BareEncoder = &InputPassportElementErrorSourceFiles{} - _ bin.BareDecoder = &InputPassportElementErrorSourceFiles{} - - _ InputPassportElementErrorSourceClass = &InputPassportElementErrorSourceFiles{} -) - -func (i *InputPassportElementErrorSourceFiles) Zero() bool { - if i == nil { - return true - } - if !(i.FileHashes == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementErrorSourceFiles) String() string { - if i == nil { - return "InputPassportElementErrorSourceFiles(nil)" - } - type Alias InputPassportElementErrorSourceFiles - return fmt.Sprintf("InputPassportElementErrorSourceFiles%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementErrorSourceFiles) TypeID() uint32 { - return InputPassportElementErrorSourceFilesTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementErrorSourceFiles) TypeName() string { - return "inputPassportElementErrorSourceFiles" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementErrorSourceFiles) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementErrorSourceFiles", - ID: InputPassportElementErrorSourceFilesTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileHashes", - SchemaName: "file_hashes", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementErrorSourceFiles) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceFiles#673401d6 as nil") - } - b.PutID(InputPassportElementErrorSourceFilesTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementErrorSourceFiles) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceFiles#673401d6 as nil") - } - b.PutInt(len(i.FileHashes)) - for _, v := range i.FileHashes { - b.PutBytes(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementErrorSourceFiles) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceFiles#673401d6 to nil") - } - if err := b.ConsumeID(InputPassportElementErrorSourceFilesTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFiles#673401d6: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementErrorSourceFiles) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceFiles#673401d6 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFiles#673401d6: field file_hashes: %w", err) - } - - if headerLen > 0 { - i.FileHashes = make([][]byte, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFiles#673401d6: field file_hashes: %w", err) - } - i.FileHashes = append(i.FileHashes, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementErrorSourceFiles) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementErrorSourceFiles#673401d6 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementErrorSourceFiles") - b.Comma() - b.FieldStart("file_hashes") - b.ArrStart() - for _, v := range i.FileHashes { - b.PutBytes(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementErrorSourceFiles) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementErrorSourceFiles#673401d6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementErrorSourceFiles"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFiles#673401d6: %w", err) - } - case "file_hashes": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFiles#673401d6: field file_hashes: %w", err) - } - i.FileHashes = append(i.FileHashes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputPassportElementErrorSourceFiles#673401d6: field file_hashes: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFileHashes returns value of FileHashes field. -func (i *InputPassportElementErrorSourceFiles) GetFileHashes() (value [][]byte) { - if i == nil { - return - } - return i.FileHashes -} - -// InputPassportElementErrorSourceClassName is schema name of InputPassportElementErrorSourceClass. -const InputPassportElementErrorSourceClassName = "InputPassportElementErrorSource" - -// InputPassportElementErrorSourceClass represents InputPassportElementErrorSource generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputPassportElementErrorSource(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputPassportElementErrorSourceUnspecified: // inputPassportElementErrorSourceUnspecified#fed9c6f -// case *tdapi.InputPassportElementErrorSourceDataField: // inputPassportElementErrorSourceDataField#e68fa006 -// case *tdapi.InputPassportElementErrorSourceFrontSide: // inputPassportElementErrorSourceFrontSide#230c87bd -// case *tdapi.InputPassportElementErrorSourceReverseSide: // inputPassportElementErrorSourceReverseSide#189efdfb -// case *tdapi.InputPassportElementErrorSourceSelfie: // inputPassportElementErrorSourceSelfie#d1e42c98 -// case *tdapi.InputPassportElementErrorSourceTranslationFile: // inputPassportElementErrorSourceTranslationFile#1e268a7b -// case *tdapi.InputPassportElementErrorSourceTranslationFiles: // inputPassportElementErrorSourceTranslationFiles#ef54819b -// case *tdapi.InputPassportElementErrorSourceFile: // inputPassportElementErrorSourceFile#ee355dcb -// case *tdapi.InputPassportElementErrorSourceFiles: // inputPassportElementErrorSourceFiles#673401d6 -// default: panic(v) -// } -type InputPassportElementErrorSourceClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputPassportElementErrorSourceClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInputPassportElementErrorSource implements binary de-serialization for InputPassportElementErrorSourceClass. -func DecodeInputPassportElementErrorSource(buf *bin.Buffer) (InputPassportElementErrorSourceClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputPassportElementErrorSourceUnspecifiedTypeID: - // Decoding inputPassportElementErrorSourceUnspecified#fed9c6f. - v := InputPassportElementErrorSourceUnspecified{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case InputPassportElementErrorSourceDataFieldTypeID: - // Decoding inputPassportElementErrorSourceDataField#e68fa006. - v := InputPassportElementErrorSourceDataField{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case InputPassportElementErrorSourceFrontSideTypeID: - // Decoding inputPassportElementErrorSourceFrontSide#230c87bd. - v := InputPassportElementErrorSourceFrontSide{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case InputPassportElementErrorSourceReverseSideTypeID: - // Decoding inputPassportElementErrorSourceReverseSide#189efdfb. - v := InputPassportElementErrorSourceReverseSide{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case InputPassportElementErrorSourceSelfieTypeID: - // Decoding inputPassportElementErrorSourceSelfie#d1e42c98. - v := InputPassportElementErrorSourceSelfie{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case InputPassportElementErrorSourceTranslationFileTypeID: - // Decoding inputPassportElementErrorSourceTranslationFile#1e268a7b. - v := InputPassportElementErrorSourceTranslationFile{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case InputPassportElementErrorSourceTranslationFilesTypeID: - // Decoding inputPassportElementErrorSourceTranslationFiles#ef54819b. - v := InputPassportElementErrorSourceTranslationFiles{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case InputPassportElementErrorSourceFileTypeID: - // Decoding inputPassportElementErrorSourceFile#ee355dcb. - v := InputPassportElementErrorSourceFile{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case InputPassportElementErrorSourceFilesTypeID: - // Decoding inputPassportElementErrorSourceFiles#673401d6. - v := InputPassportElementErrorSourceFiles{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputPassportElementErrorSource implements binary de-serialization for InputPassportElementErrorSourceClass. -func DecodeTDLibJSONInputPassportElementErrorSource(buf tdjson.Decoder) (InputPassportElementErrorSourceClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputPassportElementErrorSourceUnspecified": - // Decoding inputPassportElementErrorSourceUnspecified#fed9c6f. - v := InputPassportElementErrorSourceUnspecified{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "inputPassportElementErrorSourceDataField": - // Decoding inputPassportElementErrorSourceDataField#e68fa006. - v := InputPassportElementErrorSourceDataField{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "inputPassportElementErrorSourceFrontSide": - // Decoding inputPassportElementErrorSourceFrontSide#230c87bd. - v := InputPassportElementErrorSourceFrontSide{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "inputPassportElementErrorSourceReverseSide": - // Decoding inputPassportElementErrorSourceReverseSide#189efdfb. - v := InputPassportElementErrorSourceReverseSide{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "inputPassportElementErrorSourceSelfie": - // Decoding inputPassportElementErrorSourceSelfie#d1e42c98. - v := InputPassportElementErrorSourceSelfie{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "inputPassportElementErrorSourceTranslationFile": - // Decoding inputPassportElementErrorSourceTranslationFile#1e268a7b. - v := InputPassportElementErrorSourceTranslationFile{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "inputPassportElementErrorSourceTranslationFiles": - // Decoding inputPassportElementErrorSourceTranslationFiles#ef54819b. - v := InputPassportElementErrorSourceTranslationFiles{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "inputPassportElementErrorSourceFile": - // Decoding inputPassportElementErrorSourceFile#ee355dcb. - v := InputPassportElementErrorSourceFile{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "inputPassportElementErrorSourceFiles": - // Decoding inputPassportElementErrorSourceFiles#673401d6. - v := InputPassportElementErrorSourceFiles{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputPassportElementErrorSourceClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputPassportElementErrorSource boxes the InputPassportElementErrorSourceClass providing a helper. -type InputPassportElementErrorSourceBox struct { - InputPassportElementErrorSource InputPassportElementErrorSourceClass -} - -// Decode implements bin.Decoder for InputPassportElementErrorSourceBox. -func (b *InputPassportElementErrorSourceBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputPassportElementErrorSourceBox to nil") - } - v, err := DecodeInputPassportElementErrorSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputPassportElementErrorSource = v - return nil -} - -// Encode implements bin.Encode for InputPassportElementErrorSourceBox. -func (b *InputPassportElementErrorSourceBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputPassportElementErrorSource == nil { - return fmt.Errorf("unable to encode InputPassportElementErrorSourceClass as nil") - } - return b.InputPassportElementErrorSource.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputPassportElementErrorSourceBox. -func (b *InputPassportElementErrorSourceBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputPassportElementErrorSourceBox to nil") - } - v, err := DecodeTDLibJSONInputPassportElementErrorSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputPassportElementErrorSource = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputPassportElementErrorSourceBox. -func (b *InputPassportElementErrorSourceBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputPassportElementErrorSource == nil { - return fmt.Errorf("unable to encode InputPassportElementErrorSourceClass as nil") - } - return b.InputPassportElementErrorSource.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_passport_element_gen.go b/tdapi/tl_input_passport_element_gen.go deleted file mode 100644 index e1c1a2f21..000000000 --- a/tdapi/tl_input_passport_element_gen.go +++ /dev/null @@ -1,2492 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputPassportElementPersonalDetails represents TL type `inputPassportElementPersonalDetails#9d2843f`. -type InputPassportElementPersonalDetails struct { - // Personal details of the user - PersonalDetails PersonalDetails -} - -// InputPassportElementPersonalDetailsTypeID is TL type id of InputPassportElementPersonalDetails. -const InputPassportElementPersonalDetailsTypeID = 0x9d2843f - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementPersonalDetails) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementPersonalDetails. -var ( - _ bin.Encoder = &InputPassportElementPersonalDetails{} - _ bin.Decoder = &InputPassportElementPersonalDetails{} - _ bin.BareEncoder = &InputPassportElementPersonalDetails{} - _ bin.BareDecoder = &InputPassportElementPersonalDetails{} - - _ InputPassportElementClass = &InputPassportElementPersonalDetails{} -) - -func (i *InputPassportElementPersonalDetails) Zero() bool { - if i == nil { - return true - } - if !(i.PersonalDetails.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementPersonalDetails) String() string { - if i == nil { - return "InputPassportElementPersonalDetails(nil)" - } - type Alias InputPassportElementPersonalDetails - return fmt.Sprintf("InputPassportElementPersonalDetails%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementPersonalDetails) TypeID() uint32 { - return InputPassportElementPersonalDetailsTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementPersonalDetails) TypeName() string { - return "inputPassportElementPersonalDetails" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementPersonalDetails) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementPersonalDetails", - ID: InputPassportElementPersonalDetailsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PersonalDetails", - SchemaName: "personal_details", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementPersonalDetails) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPersonalDetails#9d2843f as nil") - } - b.PutID(InputPassportElementPersonalDetailsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementPersonalDetails) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPersonalDetails#9d2843f as nil") - } - if err := i.PersonalDetails.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementPersonalDetails#9d2843f: field personal_details: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementPersonalDetails) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPersonalDetails#9d2843f to nil") - } - if err := b.ConsumeID(InputPassportElementPersonalDetailsTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPersonalDetails#9d2843f: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementPersonalDetails) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPersonalDetails#9d2843f to nil") - } - { - if err := i.PersonalDetails.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPersonalDetails#9d2843f: field personal_details: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementPersonalDetails) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPersonalDetails#9d2843f as nil") - } - b.ObjStart() - b.PutID("inputPassportElementPersonalDetails") - b.Comma() - b.FieldStart("personal_details") - if err := i.PersonalDetails.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementPersonalDetails#9d2843f: field personal_details: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementPersonalDetails) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPersonalDetails#9d2843f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementPersonalDetails"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPersonalDetails#9d2843f: %w", err) - } - case "personal_details": - if err := i.PersonalDetails.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPersonalDetails#9d2843f: field personal_details: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPersonalDetails returns value of PersonalDetails field. -func (i *InputPassportElementPersonalDetails) GetPersonalDetails() (value PersonalDetails) { - if i == nil { - return - } - return i.PersonalDetails -} - -// InputPassportElementPassport represents TL type `inputPassportElementPassport#e2603564`. -type InputPassportElementPassport struct { - // The passport to be saved - Passport InputIdentityDocument -} - -// InputPassportElementPassportTypeID is TL type id of InputPassportElementPassport. -const InputPassportElementPassportTypeID = 0xe2603564 - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementPassport) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementPassport. -var ( - _ bin.Encoder = &InputPassportElementPassport{} - _ bin.Decoder = &InputPassportElementPassport{} - _ bin.BareEncoder = &InputPassportElementPassport{} - _ bin.BareDecoder = &InputPassportElementPassport{} - - _ InputPassportElementClass = &InputPassportElementPassport{} -) - -func (i *InputPassportElementPassport) Zero() bool { - if i == nil { - return true - } - if !(i.Passport.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementPassport) String() string { - if i == nil { - return "InputPassportElementPassport(nil)" - } - type Alias InputPassportElementPassport - return fmt.Sprintf("InputPassportElementPassport%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementPassport) TypeID() uint32 { - return InputPassportElementPassportTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementPassport) TypeName() string { - return "inputPassportElementPassport" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementPassport) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementPassport", - ID: InputPassportElementPassportTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Passport", - SchemaName: "passport", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementPassport) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPassport#e2603564 as nil") - } - b.PutID(InputPassportElementPassportTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementPassport) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPassport#e2603564 as nil") - } - if err := i.Passport.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementPassport#e2603564: field passport: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementPassport) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPassport#e2603564 to nil") - } - if err := b.ConsumeID(InputPassportElementPassportTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPassport#e2603564: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementPassport) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPassport#e2603564 to nil") - } - { - if err := i.Passport.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPassport#e2603564: field passport: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementPassport) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPassport#e2603564 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementPassport") - b.Comma() - b.FieldStart("passport") - if err := i.Passport.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementPassport#e2603564: field passport: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementPassport) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPassport#e2603564 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementPassport"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPassport#e2603564: %w", err) - } - case "passport": - if err := i.Passport.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPassport#e2603564: field passport: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPassport returns value of Passport field. -func (i *InputPassportElementPassport) GetPassport() (value InputIdentityDocument) { - if i == nil { - return - } - return i.Passport -} - -// InputPassportElementDriverLicense represents TL type `inputPassportElementDriverLicense#122b14d0`. -type InputPassportElementDriverLicense struct { - // The driver license to be saved - DriverLicense InputIdentityDocument -} - -// InputPassportElementDriverLicenseTypeID is TL type id of InputPassportElementDriverLicense. -const InputPassportElementDriverLicenseTypeID = 0x122b14d0 - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementDriverLicense) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementDriverLicense. -var ( - _ bin.Encoder = &InputPassportElementDriverLicense{} - _ bin.Decoder = &InputPassportElementDriverLicense{} - _ bin.BareEncoder = &InputPassportElementDriverLicense{} - _ bin.BareDecoder = &InputPassportElementDriverLicense{} - - _ InputPassportElementClass = &InputPassportElementDriverLicense{} -) - -func (i *InputPassportElementDriverLicense) Zero() bool { - if i == nil { - return true - } - if !(i.DriverLicense.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementDriverLicense) String() string { - if i == nil { - return "InputPassportElementDriverLicense(nil)" - } - type Alias InputPassportElementDriverLicense - return fmt.Sprintf("InputPassportElementDriverLicense%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementDriverLicense) TypeID() uint32 { - return InputPassportElementDriverLicenseTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementDriverLicense) TypeName() string { - return "inputPassportElementDriverLicense" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementDriverLicense) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementDriverLicense", - ID: InputPassportElementDriverLicenseTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DriverLicense", - SchemaName: "driver_license", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementDriverLicense) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementDriverLicense#122b14d0 as nil") - } - b.PutID(InputPassportElementDriverLicenseTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementDriverLicense) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementDriverLicense#122b14d0 as nil") - } - if err := i.DriverLicense.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementDriverLicense#122b14d0: field driver_license: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementDriverLicense) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementDriverLicense#122b14d0 to nil") - } - if err := b.ConsumeID(InputPassportElementDriverLicenseTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementDriverLicense#122b14d0: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementDriverLicense) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementDriverLicense#122b14d0 to nil") - } - { - if err := i.DriverLicense.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementDriverLicense#122b14d0: field driver_license: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementDriverLicense) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementDriverLicense#122b14d0 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementDriverLicense") - b.Comma() - b.FieldStart("driver_license") - if err := i.DriverLicense.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementDriverLicense#122b14d0: field driver_license: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementDriverLicense) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementDriverLicense#122b14d0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementDriverLicense"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementDriverLicense#122b14d0: %w", err) - } - case "driver_license": - if err := i.DriverLicense.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementDriverLicense#122b14d0: field driver_license: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDriverLicense returns value of DriverLicense field. -func (i *InputPassportElementDriverLicense) GetDriverLicense() (value InputIdentityDocument) { - if i == nil { - return - } - return i.DriverLicense -} - -// InputPassportElementIdentityCard represents TL type `inputPassportElementIdentityCard#ff67f882`. -type InputPassportElementIdentityCard struct { - // The identity card to be saved - IdentityCard InputIdentityDocument -} - -// InputPassportElementIdentityCardTypeID is TL type id of InputPassportElementIdentityCard. -const InputPassportElementIdentityCardTypeID = 0xff67f882 - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementIdentityCard) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementIdentityCard. -var ( - _ bin.Encoder = &InputPassportElementIdentityCard{} - _ bin.Decoder = &InputPassportElementIdentityCard{} - _ bin.BareEncoder = &InputPassportElementIdentityCard{} - _ bin.BareDecoder = &InputPassportElementIdentityCard{} - - _ InputPassportElementClass = &InputPassportElementIdentityCard{} -) - -func (i *InputPassportElementIdentityCard) Zero() bool { - if i == nil { - return true - } - if !(i.IdentityCard.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementIdentityCard) String() string { - if i == nil { - return "InputPassportElementIdentityCard(nil)" - } - type Alias InputPassportElementIdentityCard - return fmt.Sprintf("InputPassportElementIdentityCard%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementIdentityCard) TypeID() uint32 { - return InputPassportElementIdentityCardTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementIdentityCard) TypeName() string { - return "inputPassportElementIdentityCard" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementIdentityCard) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementIdentityCard", - ID: InputPassportElementIdentityCardTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IdentityCard", - SchemaName: "identity_card", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementIdentityCard) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementIdentityCard#ff67f882 as nil") - } - b.PutID(InputPassportElementIdentityCardTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementIdentityCard) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementIdentityCard#ff67f882 as nil") - } - if err := i.IdentityCard.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementIdentityCard#ff67f882: field identity_card: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementIdentityCard) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementIdentityCard#ff67f882 to nil") - } - if err := b.ConsumeID(InputPassportElementIdentityCardTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementIdentityCard#ff67f882: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementIdentityCard) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementIdentityCard#ff67f882 to nil") - } - { - if err := i.IdentityCard.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementIdentityCard#ff67f882: field identity_card: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementIdentityCard) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementIdentityCard#ff67f882 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementIdentityCard") - b.Comma() - b.FieldStart("identity_card") - if err := i.IdentityCard.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementIdentityCard#ff67f882: field identity_card: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementIdentityCard) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementIdentityCard#ff67f882 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementIdentityCard"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementIdentityCard#ff67f882: %w", err) - } - case "identity_card": - if err := i.IdentityCard.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementIdentityCard#ff67f882: field identity_card: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetIdentityCard returns value of IdentityCard field. -func (i *InputPassportElementIdentityCard) GetIdentityCard() (value InputIdentityDocument) { - if i == nil { - return - } - return i.IdentityCard -} - -// InputPassportElementInternalPassport represents TL type `inputPassportElementInternalPassport#2aa3872b`. -type InputPassportElementInternalPassport struct { - // The internal passport to be saved - InternalPassport InputIdentityDocument -} - -// InputPassportElementInternalPassportTypeID is TL type id of InputPassportElementInternalPassport. -const InputPassportElementInternalPassportTypeID = 0x2aa3872b - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementInternalPassport) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementInternalPassport. -var ( - _ bin.Encoder = &InputPassportElementInternalPassport{} - _ bin.Decoder = &InputPassportElementInternalPassport{} - _ bin.BareEncoder = &InputPassportElementInternalPassport{} - _ bin.BareDecoder = &InputPassportElementInternalPassport{} - - _ InputPassportElementClass = &InputPassportElementInternalPassport{} -) - -func (i *InputPassportElementInternalPassport) Zero() bool { - if i == nil { - return true - } - if !(i.InternalPassport.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementInternalPassport) String() string { - if i == nil { - return "InputPassportElementInternalPassport(nil)" - } - type Alias InputPassportElementInternalPassport - return fmt.Sprintf("InputPassportElementInternalPassport%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementInternalPassport) TypeID() uint32 { - return InputPassportElementInternalPassportTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementInternalPassport) TypeName() string { - return "inputPassportElementInternalPassport" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementInternalPassport) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementInternalPassport", - ID: InputPassportElementInternalPassportTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InternalPassport", - SchemaName: "internal_passport", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementInternalPassport) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementInternalPassport#2aa3872b as nil") - } - b.PutID(InputPassportElementInternalPassportTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementInternalPassport) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementInternalPassport#2aa3872b as nil") - } - if err := i.InternalPassport.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementInternalPassport#2aa3872b: field internal_passport: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementInternalPassport) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementInternalPassport#2aa3872b to nil") - } - if err := b.ConsumeID(InputPassportElementInternalPassportTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementInternalPassport#2aa3872b: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementInternalPassport) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementInternalPassport#2aa3872b to nil") - } - { - if err := i.InternalPassport.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementInternalPassport#2aa3872b: field internal_passport: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementInternalPassport) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementInternalPassport#2aa3872b as nil") - } - b.ObjStart() - b.PutID("inputPassportElementInternalPassport") - b.Comma() - b.FieldStart("internal_passport") - if err := i.InternalPassport.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementInternalPassport#2aa3872b: field internal_passport: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementInternalPassport) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementInternalPassport#2aa3872b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementInternalPassport"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementInternalPassport#2aa3872b: %w", err) - } - case "internal_passport": - if err := i.InternalPassport.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementInternalPassport#2aa3872b: field internal_passport: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInternalPassport returns value of InternalPassport field. -func (i *InputPassportElementInternalPassport) GetInternalPassport() (value InputIdentityDocument) { - if i == nil { - return - } - return i.InternalPassport -} - -// InputPassportElementAddress represents TL type `inputPassportElementAddress#1b83ec10`. -type InputPassportElementAddress struct { - // The address to be saved - Address Address -} - -// InputPassportElementAddressTypeID is TL type id of InputPassportElementAddress. -const InputPassportElementAddressTypeID = 0x1b83ec10 - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementAddress) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementAddress. -var ( - _ bin.Encoder = &InputPassportElementAddress{} - _ bin.Decoder = &InputPassportElementAddress{} - _ bin.BareEncoder = &InputPassportElementAddress{} - _ bin.BareDecoder = &InputPassportElementAddress{} - - _ InputPassportElementClass = &InputPassportElementAddress{} -) - -func (i *InputPassportElementAddress) Zero() bool { - if i == nil { - return true - } - if !(i.Address.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementAddress) String() string { - if i == nil { - return "InputPassportElementAddress(nil)" - } - type Alias InputPassportElementAddress - return fmt.Sprintf("InputPassportElementAddress%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementAddress) TypeID() uint32 { - return InputPassportElementAddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementAddress) TypeName() string { - return "inputPassportElementAddress" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementAddress) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementAddress", - ID: InputPassportElementAddressTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Address", - SchemaName: "address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementAddress) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementAddress#1b83ec10 as nil") - } - b.PutID(InputPassportElementAddressTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementAddress) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementAddress#1b83ec10 as nil") - } - if err := i.Address.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementAddress#1b83ec10: field address: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementAddress) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementAddress#1b83ec10 to nil") - } - if err := b.ConsumeID(InputPassportElementAddressTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementAddress#1b83ec10: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementAddress) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementAddress#1b83ec10 to nil") - } - { - if err := i.Address.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementAddress#1b83ec10: field address: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementAddress) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementAddress#1b83ec10 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementAddress") - b.Comma() - b.FieldStart("address") - if err := i.Address.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementAddress#1b83ec10: field address: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementAddress) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementAddress#1b83ec10 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementAddress"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementAddress#1b83ec10: %w", err) - } - case "address": - if err := i.Address.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementAddress#1b83ec10: field address: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAddress returns value of Address field. -func (i *InputPassportElementAddress) GetAddress() (value Address) { - if i == nil { - return - } - return i.Address -} - -// InputPassportElementUtilityBill represents TL type `inputPassportElementUtilityBill#52cd9181`. -type InputPassportElementUtilityBill struct { - // The utility bill to be saved - UtilityBill InputPersonalDocument -} - -// InputPassportElementUtilityBillTypeID is TL type id of InputPassportElementUtilityBill. -const InputPassportElementUtilityBillTypeID = 0x52cd9181 - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementUtilityBill) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementUtilityBill. -var ( - _ bin.Encoder = &InputPassportElementUtilityBill{} - _ bin.Decoder = &InputPassportElementUtilityBill{} - _ bin.BareEncoder = &InputPassportElementUtilityBill{} - _ bin.BareDecoder = &InputPassportElementUtilityBill{} - - _ InputPassportElementClass = &InputPassportElementUtilityBill{} -) - -func (i *InputPassportElementUtilityBill) Zero() bool { - if i == nil { - return true - } - if !(i.UtilityBill.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementUtilityBill) String() string { - if i == nil { - return "InputPassportElementUtilityBill(nil)" - } - type Alias InputPassportElementUtilityBill - return fmt.Sprintf("InputPassportElementUtilityBill%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementUtilityBill) TypeID() uint32 { - return InputPassportElementUtilityBillTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementUtilityBill) TypeName() string { - return "inputPassportElementUtilityBill" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementUtilityBill) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementUtilityBill", - ID: InputPassportElementUtilityBillTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UtilityBill", - SchemaName: "utility_bill", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementUtilityBill) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementUtilityBill#52cd9181 as nil") - } - b.PutID(InputPassportElementUtilityBillTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementUtilityBill) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementUtilityBill#52cd9181 as nil") - } - if err := i.UtilityBill.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementUtilityBill#52cd9181: field utility_bill: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementUtilityBill) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementUtilityBill#52cd9181 to nil") - } - if err := b.ConsumeID(InputPassportElementUtilityBillTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementUtilityBill#52cd9181: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementUtilityBill) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementUtilityBill#52cd9181 to nil") - } - { - if err := i.UtilityBill.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementUtilityBill#52cd9181: field utility_bill: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementUtilityBill) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementUtilityBill#52cd9181 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementUtilityBill") - b.Comma() - b.FieldStart("utility_bill") - if err := i.UtilityBill.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementUtilityBill#52cd9181: field utility_bill: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementUtilityBill) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementUtilityBill#52cd9181 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementUtilityBill"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementUtilityBill#52cd9181: %w", err) - } - case "utility_bill": - if err := i.UtilityBill.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementUtilityBill#52cd9181: field utility_bill: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUtilityBill returns value of UtilityBill field. -func (i *InputPassportElementUtilityBill) GetUtilityBill() (value InputPersonalDocument) { - if i == nil { - return - } - return i.UtilityBill -} - -// InputPassportElementBankStatement represents TL type `inputPassportElementBankStatement#fe6a5788`. -type InputPassportElementBankStatement struct { - // The bank statement to be saved - BankStatement InputPersonalDocument -} - -// InputPassportElementBankStatementTypeID is TL type id of InputPassportElementBankStatement. -const InputPassportElementBankStatementTypeID = 0xfe6a5788 - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementBankStatement) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementBankStatement. -var ( - _ bin.Encoder = &InputPassportElementBankStatement{} - _ bin.Decoder = &InputPassportElementBankStatement{} - _ bin.BareEncoder = &InputPassportElementBankStatement{} - _ bin.BareDecoder = &InputPassportElementBankStatement{} - - _ InputPassportElementClass = &InputPassportElementBankStatement{} -) - -func (i *InputPassportElementBankStatement) Zero() bool { - if i == nil { - return true - } - if !(i.BankStatement.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementBankStatement) String() string { - if i == nil { - return "InputPassportElementBankStatement(nil)" - } - type Alias InputPassportElementBankStatement - return fmt.Sprintf("InputPassportElementBankStatement%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementBankStatement) TypeID() uint32 { - return InputPassportElementBankStatementTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementBankStatement) TypeName() string { - return "inputPassportElementBankStatement" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementBankStatement) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementBankStatement", - ID: InputPassportElementBankStatementTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BankStatement", - SchemaName: "bank_statement", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementBankStatement) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementBankStatement#fe6a5788 as nil") - } - b.PutID(InputPassportElementBankStatementTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementBankStatement) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementBankStatement#fe6a5788 as nil") - } - if err := i.BankStatement.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementBankStatement#fe6a5788: field bank_statement: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementBankStatement) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementBankStatement#fe6a5788 to nil") - } - if err := b.ConsumeID(InputPassportElementBankStatementTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementBankStatement#fe6a5788: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementBankStatement) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementBankStatement#fe6a5788 to nil") - } - { - if err := i.BankStatement.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementBankStatement#fe6a5788: field bank_statement: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementBankStatement) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementBankStatement#fe6a5788 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementBankStatement") - b.Comma() - b.FieldStart("bank_statement") - if err := i.BankStatement.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementBankStatement#fe6a5788: field bank_statement: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementBankStatement) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementBankStatement#fe6a5788 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementBankStatement"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementBankStatement#fe6a5788: %w", err) - } - case "bank_statement": - if err := i.BankStatement.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementBankStatement#fe6a5788: field bank_statement: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBankStatement returns value of BankStatement field. -func (i *InputPassportElementBankStatement) GetBankStatement() (value InputPersonalDocument) { - if i == nil { - return - } - return i.BankStatement -} - -// InputPassportElementRentalAgreement represents TL type `inputPassportElementRentalAgreement#677b9c2b`. -type InputPassportElementRentalAgreement struct { - // The rental agreement to be saved - RentalAgreement InputPersonalDocument -} - -// InputPassportElementRentalAgreementTypeID is TL type id of InputPassportElementRentalAgreement. -const InputPassportElementRentalAgreementTypeID = 0x677b9c2b - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementRentalAgreement) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementRentalAgreement. -var ( - _ bin.Encoder = &InputPassportElementRentalAgreement{} - _ bin.Decoder = &InputPassportElementRentalAgreement{} - _ bin.BareEncoder = &InputPassportElementRentalAgreement{} - _ bin.BareDecoder = &InputPassportElementRentalAgreement{} - - _ InputPassportElementClass = &InputPassportElementRentalAgreement{} -) - -func (i *InputPassportElementRentalAgreement) Zero() bool { - if i == nil { - return true - } - if !(i.RentalAgreement.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementRentalAgreement) String() string { - if i == nil { - return "InputPassportElementRentalAgreement(nil)" - } - type Alias InputPassportElementRentalAgreement - return fmt.Sprintf("InputPassportElementRentalAgreement%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementRentalAgreement) TypeID() uint32 { - return InputPassportElementRentalAgreementTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementRentalAgreement) TypeName() string { - return "inputPassportElementRentalAgreement" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementRentalAgreement) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementRentalAgreement", - ID: InputPassportElementRentalAgreementTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RentalAgreement", - SchemaName: "rental_agreement", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementRentalAgreement) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementRentalAgreement#677b9c2b as nil") - } - b.PutID(InputPassportElementRentalAgreementTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementRentalAgreement) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementRentalAgreement#677b9c2b as nil") - } - if err := i.RentalAgreement.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementRentalAgreement#677b9c2b: field rental_agreement: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementRentalAgreement) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementRentalAgreement#677b9c2b to nil") - } - if err := b.ConsumeID(InputPassportElementRentalAgreementTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementRentalAgreement#677b9c2b: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementRentalAgreement) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementRentalAgreement#677b9c2b to nil") - } - { - if err := i.RentalAgreement.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementRentalAgreement#677b9c2b: field rental_agreement: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementRentalAgreement) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementRentalAgreement#677b9c2b as nil") - } - b.ObjStart() - b.PutID("inputPassportElementRentalAgreement") - b.Comma() - b.FieldStart("rental_agreement") - if err := i.RentalAgreement.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementRentalAgreement#677b9c2b: field rental_agreement: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementRentalAgreement) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementRentalAgreement#677b9c2b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementRentalAgreement"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementRentalAgreement#677b9c2b: %w", err) - } - case "rental_agreement": - if err := i.RentalAgreement.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementRentalAgreement#677b9c2b: field rental_agreement: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetRentalAgreement returns value of RentalAgreement field. -func (i *InputPassportElementRentalAgreement) GetRentalAgreement() (value InputPersonalDocument) { - if i == nil { - return - } - return i.RentalAgreement -} - -// InputPassportElementPassportRegistration represents TL type `inputPassportElementPassportRegistration#4e5aa050`. -type InputPassportElementPassportRegistration struct { - // The passport registration page to be saved - PassportRegistration InputPersonalDocument -} - -// InputPassportElementPassportRegistrationTypeID is TL type id of InputPassportElementPassportRegistration. -const InputPassportElementPassportRegistrationTypeID = 0x4e5aa050 - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementPassportRegistration) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementPassportRegistration. -var ( - _ bin.Encoder = &InputPassportElementPassportRegistration{} - _ bin.Decoder = &InputPassportElementPassportRegistration{} - _ bin.BareEncoder = &InputPassportElementPassportRegistration{} - _ bin.BareDecoder = &InputPassportElementPassportRegistration{} - - _ InputPassportElementClass = &InputPassportElementPassportRegistration{} -) - -func (i *InputPassportElementPassportRegistration) Zero() bool { - if i == nil { - return true - } - if !(i.PassportRegistration.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementPassportRegistration) String() string { - if i == nil { - return "InputPassportElementPassportRegistration(nil)" - } - type Alias InputPassportElementPassportRegistration - return fmt.Sprintf("InputPassportElementPassportRegistration%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementPassportRegistration) TypeID() uint32 { - return InputPassportElementPassportRegistrationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementPassportRegistration) TypeName() string { - return "inputPassportElementPassportRegistration" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementPassportRegistration) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementPassportRegistration", - ID: InputPassportElementPassportRegistrationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PassportRegistration", - SchemaName: "passport_registration", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementPassportRegistration) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPassportRegistration#4e5aa050 as nil") - } - b.PutID(InputPassportElementPassportRegistrationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementPassportRegistration) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPassportRegistration#4e5aa050 as nil") - } - if err := i.PassportRegistration.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementPassportRegistration#4e5aa050: field passport_registration: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementPassportRegistration) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPassportRegistration#4e5aa050 to nil") - } - if err := b.ConsumeID(InputPassportElementPassportRegistrationTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPassportRegistration#4e5aa050: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementPassportRegistration) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPassportRegistration#4e5aa050 to nil") - } - { - if err := i.PassportRegistration.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPassportRegistration#4e5aa050: field passport_registration: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementPassportRegistration) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPassportRegistration#4e5aa050 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementPassportRegistration") - b.Comma() - b.FieldStart("passport_registration") - if err := i.PassportRegistration.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementPassportRegistration#4e5aa050: field passport_registration: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementPassportRegistration) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPassportRegistration#4e5aa050 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementPassportRegistration"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPassportRegistration#4e5aa050: %w", err) - } - case "passport_registration": - if err := i.PassportRegistration.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPassportRegistration#4e5aa050: field passport_registration: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPassportRegistration returns value of PassportRegistration field. -func (i *InputPassportElementPassportRegistration) GetPassportRegistration() (value InputPersonalDocument) { - if i == nil { - return - } - return i.PassportRegistration -} - -// InputPassportElementTemporaryRegistration represents TL type `inputPassportElementTemporaryRegistration#8df64de1`. -type InputPassportElementTemporaryRegistration struct { - // The temporary registration document to be saved - TemporaryRegistration InputPersonalDocument -} - -// InputPassportElementTemporaryRegistrationTypeID is TL type id of InputPassportElementTemporaryRegistration. -const InputPassportElementTemporaryRegistrationTypeID = 0x8df64de1 - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementTemporaryRegistration) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementTemporaryRegistration. -var ( - _ bin.Encoder = &InputPassportElementTemporaryRegistration{} - _ bin.Decoder = &InputPassportElementTemporaryRegistration{} - _ bin.BareEncoder = &InputPassportElementTemporaryRegistration{} - _ bin.BareDecoder = &InputPassportElementTemporaryRegistration{} - - _ InputPassportElementClass = &InputPassportElementTemporaryRegistration{} -) - -func (i *InputPassportElementTemporaryRegistration) Zero() bool { - if i == nil { - return true - } - if !(i.TemporaryRegistration.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementTemporaryRegistration) String() string { - if i == nil { - return "InputPassportElementTemporaryRegistration(nil)" - } - type Alias InputPassportElementTemporaryRegistration - return fmt.Sprintf("InputPassportElementTemporaryRegistration%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementTemporaryRegistration) TypeID() uint32 { - return InputPassportElementTemporaryRegistrationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementTemporaryRegistration) TypeName() string { - return "inputPassportElementTemporaryRegistration" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementTemporaryRegistration) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementTemporaryRegistration", - ID: InputPassportElementTemporaryRegistrationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TemporaryRegistration", - SchemaName: "temporary_registration", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementTemporaryRegistration) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementTemporaryRegistration#8df64de1 as nil") - } - b.PutID(InputPassportElementTemporaryRegistrationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementTemporaryRegistration) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementTemporaryRegistration#8df64de1 as nil") - } - if err := i.TemporaryRegistration.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementTemporaryRegistration#8df64de1: field temporary_registration: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementTemporaryRegistration) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementTemporaryRegistration#8df64de1 to nil") - } - if err := b.ConsumeID(InputPassportElementTemporaryRegistrationTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementTemporaryRegistration#8df64de1: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementTemporaryRegistration) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementTemporaryRegistration#8df64de1 to nil") - } - { - if err := i.TemporaryRegistration.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementTemporaryRegistration#8df64de1: field temporary_registration: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementTemporaryRegistration) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementTemporaryRegistration#8df64de1 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementTemporaryRegistration") - b.Comma() - b.FieldStart("temporary_registration") - if err := i.TemporaryRegistration.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPassportElementTemporaryRegistration#8df64de1: field temporary_registration: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementTemporaryRegistration) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementTemporaryRegistration#8df64de1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementTemporaryRegistration"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementTemporaryRegistration#8df64de1: %w", err) - } - case "temporary_registration": - if err := i.TemporaryRegistration.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputPassportElementTemporaryRegistration#8df64de1: field temporary_registration: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTemporaryRegistration returns value of TemporaryRegistration field. -func (i *InputPassportElementTemporaryRegistration) GetTemporaryRegistration() (value InputPersonalDocument) { - if i == nil { - return - } - return i.TemporaryRegistration -} - -// InputPassportElementPhoneNumber represents TL type `inputPassportElementPhoneNumber#4ea3cc39`. -type InputPassportElementPhoneNumber struct { - // The phone number to be saved - PhoneNumber string -} - -// InputPassportElementPhoneNumberTypeID is TL type id of InputPassportElementPhoneNumber. -const InputPassportElementPhoneNumberTypeID = 0x4ea3cc39 - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementPhoneNumber) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementPhoneNumber. -var ( - _ bin.Encoder = &InputPassportElementPhoneNumber{} - _ bin.Decoder = &InputPassportElementPhoneNumber{} - _ bin.BareEncoder = &InputPassportElementPhoneNumber{} - _ bin.BareDecoder = &InputPassportElementPhoneNumber{} - - _ InputPassportElementClass = &InputPassportElementPhoneNumber{} -) - -func (i *InputPassportElementPhoneNumber) Zero() bool { - if i == nil { - return true - } - if !(i.PhoneNumber == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementPhoneNumber) String() string { - if i == nil { - return "InputPassportElementPhoneNumber(nil)" - } - type Alias InputPassportElementPhoneNumber - return fmt.Sprintf("InputPassportElementPhoneNumber%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementPhoneNumber) TypeID() uint32 { - return InputPassportElementPhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementPhoneNumber) TypeName() string { - return "inputPassportElementPhoneNumber" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementPhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementPhoneNumber", - ID: InputPassportElementPhoneNumberTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementPhoneNumber) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPhoneNumber#4ea3cc39 as nil") - } - b.PutID(InputPassportElementPhoneNumberTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementPhoneNumber) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPhoneNumber#4ea3cc39 as nil") - } - b.PutString(i.PhoneNumber) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementPhoneNumber) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPhoneNumber#4ea3cc39 to nil") - } - if err := b.ConsumeID(InputPassportElementPhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPhoneNumber#4ea3cc39: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementPhoneNumber) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPhoneNumber#4ea3cc39 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementPhoneNumber#4ea3cc39: field phone_number: %w", err) - } - i.PhoneNumber = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementPhoneNumber#4ea3cc39 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementPhoneNumber") - b.Comma() - b.FieldStart("phone_number") - b.PutString(i.PhoneNumber) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementPhoneNumber#4ea3cc39 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementPhoneNumber#4ea3cc39: %w", err) - } - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementPhoneNumber#4ea3cc39: field phone_number: %w", err) - } - i.PhoneNumber = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (i *InputPassportElementPhoneNumber) GetPhoneNumber() (value string) { - if i == nil { - return - } - return i.PhoneNumber -} - -// InputPassportElementEmailAddress represents TL type `inputPassportElementEmailAddress#f12e9425`. -type InputPassportElementEmailAddress struct { - // The email address to be saved - EmailAddress string -} - -// InputPassportElementEmailAddressTypeID is TL type id of InputPassportElementEmailAddress. -const InputPassportElementEmailAddressTypeID = 0xf12e9425 - -// construct implements constructor of InputPassportElementClass. -func (i InputPassportElementEmailAddress) construct() InputPassportElementClass { return &i } - -// Ensuring interfaces in compile-time for InputPassportElementEmailAddress. -var ( - _ bin.Encoder = &InputPassportElementEmailAddress{} - _ bin.Decoder = &InputPassportElementEmailAddress{} - _ bin.BareEncoder = &InputPassportElementEmailAddress{} - _ bin.BareDecoder = &InputPassportElementEmailAddress{} - - _ InputPassportElementClass = &InputPassportElementEmailAddress{} -) - -func (i *InputPassportElementEmailAddress) Zero() bool { - if i == nil { - return true - } - if !(i.EmailAddress == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPassportElementEmailAddress) String() string { - if i == nil { - return "InputPassportElementEmailAddress(nil)" - } - type Alias InputPassportElementEmailAddress - return fmt.Sprintf("InputPassportElementEmailAddress%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPassportElementEmailAddress) TypeID() uint32 { - return InputPassportElementEmailAddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPassportElementEmailAddress) TypeName() string { - return "inputPassportElementEmailAddress" -} - -// TypeInfo returns info about TL type. -func (i *InputPassportElementEmailAddress) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPassportElementEmailAddress", - ID: InputPassportElementEmailAddressTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "EmailAddress", - SchemaName: "email_address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPassportElementEmailAddress) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementEmailAddress#f12e9425 as nil") - } - b.PutID(InputPassportElementEmailAddressTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPassportElementEmailAddress) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementEmailAddress#f12e9425 as nil") - } - b.PutString(i.EmailAddress) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPassportElementEmailAddress) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementEmailAddress#f12e9425 to nil") - } - if err := b.ConsumeID(InputPassportElementEmailAddressTypeID); err != nil { - return fmt.Errorf("unable to decode inputPassportElementEmailAddress#f12e9425: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPassportElementEmailAddress) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementEmailAddress#f12e9425 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementEmailAddress#f12e9425: field email_address: %w", err) - } - i.EmailAddress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPassportElementEmailAddress) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPassportElementEmailAddress#f12e9425 as nil") - } - b.ObjStart() - b.PutID("inputPassportElementEmailAddress") - b.Comma() - b.FieldStart("email_address") - b.PutString(i.EmailAddress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPassportElementEmailAddress) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPassportElementEmailAddress#f12e9425 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPassportElementEmailAddress"); err != nil { - return fmt.Errorf("unable to decode inputPassportElementEmailAddress#f12e9425: %w", err) - } - case "email_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputPassportElementEmailAddress#f12e9425: field email_address: %w", err) - } - i.EmailAddress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEmailAddress returns value of EmailAddress field. -func (i *InputPassportElementEmailAddress) GetEmailAddress() (value string) { - if i == nil { - return - } - return i.EmailAddress -} - -// InputPassportElementClassName is schema name of InputPassportElementClass. -const InputPassportElementClassName = "InputPassportElement" - -// InputPassportElementClass represents InputPassportElement generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputPassportElement(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputPassportElementPersonalDetails: // inputPassportElementPersonalDetails#9d2843f -// case *tdapi.InputPassportElementPassport: // inputPassportElementPassport#e2603564 -// case *tdapi.InputPassportElementDriverLicense: // inputPassportElementDriverLicense#122b14d0 -// case *tdapi.InputPassportElementIdentityCard: // inputPassportElementIdentityCard#ff67f882 -// case *tdapi.InputPassportElementInternalPassport: // inputPassportElementInternalPassport#2aa3872b -// case *tdapi.InputPassportElementAddress: // inputPassportElementAddress#1b83ec10 -// case *tdapi.InputPassportElementUtilityBill: // inputPassportElementUtilityBill#52cd9181 -// case *tdapi.InputPassportElementBankStatement: // inputPassportElementBankStatement#fe6a5788 -// case *tdapi.InputPassportElementRentalAgreement: // inputPassportElementRentalAgreement#677b9c2b -// case *tdapi.InputPassportElementPassportRegistration: // inputPassportElementPassportRegistration#4e5aa050 -// case *tdapi.InputPassportElementTemporaryRegistration: // inputPassportElementTemporaryRegistration#8df64de1 -// case *tdapi.InputPassportElementPhoneNumber: // inputPassportElementPhoneNumber#4ea3cc39 -// case *tdapi.InputPassportElementEmailAddress: // inputPassportElementEmailAddress#f12e9425 -// default: panic(v) -// } -type InputPassportElementClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputPassportElementClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInputPassportElement implements binary de-serialization for InputPassportElementClass. -func DecodeInputPassportElement(buf *bin.Buffer) (InputPassportElementClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputPassportElementPersonalDetailsTypeID: - // Decoding inputPassportElementPersonalDetails#9d2843f. - v := InputPassportElementPersonalDetails{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementPassportTypeID: - // Decoding inputPassportElementPassport#e2603564. - v := InputPassportElementPassport{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementDriverLicenseTypeID: - // Decoding inputPassportElementDriverLicense#122b14d0. - v := InputPassportElementDriverLicense{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementIdentityCardTypeID: - // Decoding inputPassportElementIdentityCard#ff67f882. - v := InputPassportElementIdentityCard{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementInternalPassportTypeID: - // Decoding inputPassportElementInternalPassport#2aa3872b. - v := InputPassportElementInternalPassport{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementAddressTypeID: - // Decoding inputPassportElementAddress#1b83ec10. - v := InputPassportElementAddress{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementUtilityBillTypeID: - // Decoding inputPassportElementUtilityBill#52cd9181. - v := InputPassportElementUtilityBill{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementBankStatementTypeID: - // Decoding inputPassportElementBankStatement#fe6a5788. - v := InputPassportElementBankStatement{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementRentalAgreementTypeID: - // Decoding inputPassportElementRentalAgreement#677b9c2b. - v := InputPassportElementRentalAgreement{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementPassportRegistrationTypeID: - // Decoding inputPassportElementPassportRegistration#4e5aa050. - v := InputPassportElementPassportRegistration{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementTemporaryRegistrationTypeID: - // Decoding inputPassportElementTemporaryRegistration#8df64de1. - v := InputPassportElementTemporaryRegistration{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementPhoneNumberTypeID: - // Decoding inputPassportElementPhoneNumber#4ea3cc39. - v := InputPassportElementPhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case InputPassportElementEmailAddressTypeID: - // Decoding inputPassportElementEmailAddress#f12e9425. - v := InputPassportElementEmailAddress{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputPassportElement implements binary de-serialization for InputPassportElementClass. -func DecodeTDLibJSONInputPassportElement(buf tdjson.Decoder) (InputPassportElementClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputPassportElementPersonalDetails": - // Decoding inputPassportElementPersonalDetails#9d2843f. - v := InputPassportElementPersonalDetails{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementPassport": - // Decoding inputPassportElementPassport#e2603564. - v := InputPassportElementPassport{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementDriverLicense": - // Decoding inputPassportElementDriverLicense#122b14d0. - v := InputPassportElementDriverLicense{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementIdentityCard": - // Decoding inputPassportElementIdentityCard#ff67f882. - v := InputPassportElementIdentityCard{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementInternalPassport": - // Decoding inputPassportElementInternalPassport#2aa3872b. - v := InputPassportElementInternalPassport{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementAddress": - // Decoding inputPassportElementAddress#1b83ec10. - v := InputPassportElementAddress{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementUtilityBill": - // Decoding inputPassportElementUtilityBill#52cd9181. - v := InputPassportElementUtilityBill{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementBankStatement": - // Decoding inputPassportElementBankStatement#fe6a5788. - v := InputPassportElementBankStatement{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementRentalAgreement": - // Decoding inputPassportElementRentalAgreement#677b9c2b. - v := InputPassportElementRentalAgreement{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementPassportRegistration": - // Decoding inputPassportElementPassportRegistration#4e5aa050. - v := InputPassportElementPassportRegistration{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementTemporaryRegistration": - // Decoding inputPassportElementTemporaryRegistration#8df64de1. - v := InputPassportElementTemporaryRegistration{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementPhoneNumber": - // Decoding inputPassportElementPhoneNumber#4ea3cc39. - v := InputPassportElementPhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - case "inputPassportElementEmailAddress": - // Decoding inputPassportElementEmailAddress#f12e9425. - v := InputPassportElementEmailAddress{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputPassportElementClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputPassportElement boxes the InputPassportElementClass providing a helper. -type InputPassportElementBox struct { - InputPassportElement InputPassportElementClass -} - -// Decode implements bin.Decoder for InputPassportElementBox. -func (b *InputPassportElementBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputPassportElementBox to nil") - } - v, err := DecodeInputPassportElement(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputPassportElement = v - return nil -} - -// Encode implements bin.Encode for InputPassportElementBox. -func (b *InputPassportElementBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputPassportElement == nil { - return fmt.Errorf("unable to encode InputPassportElementClass as nil") - } - return b.InputPassportElement.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputPassportElementBox. -func (b *InputPassportElementBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputPassportElementBox to nil") - } - v, err := DecodeTDLibJSONInputPassportElement(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputPassportElement = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputPassportElementBox. -func (b *InputPassportElementBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputPassportElement == nil { - return fmt.Errorf("unable to encode InputPassportElementClass as nil") - } - return b.InputPassportElement.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_personal_document_gen.go b/tdapi/tl_input_personal_document_gen.go deleted file mode 100644 index 1c0841207..000000000 --- a/tdapi/tl_input_personal_document_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputPersonalDocument represents TL type `inputPersonalDocument#bb343fae`. -type InputPersonalDocument struct { - // List of files containing the pages of the document - Files []InputFileClass - // List of files containing a certified English translation of the document - Translation []InputFileClass -} - -// InputPersonalDocumentTypeID is TL type id of InputPersonalDocument. -const InputPersonalDocumentTypeID = 0xbb343fae - -// Ensuring interfaces in compile-time for InputPersonalDocument. -var ( - _ bin.Encoder = &InputPersonalDocument{} - _ bin.Decoder = &InputPersonalDocument{} - _ bin.BareEncoder = &InputPersonalDocument{} - _ bin.BareDecoder = &InputPersonalDocument{} -) - -func (i *InputPersonalDocument) Zero() bool { - if i == nil { - return true - } - if !(i.Files == nil) { - return false - } - if !(i.Translation == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputPersonalDocument) String() string { - if i == nil { - return "InputPersonalDocument(nil)" - } - type Alias InputPersonalDocument - return fmt.Sprintf("InputPersonalDocument%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputPersonalDocument) TypeID() uint32 { - return InputPersonalDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputPersonalDocument) TypeName() string { - return "inputPersonalDocument" -} - -// TypeInfo returns info about TL type. -func (i *InputPersonalDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputPersonalDocument", - ID: InputPersonalDocumentTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Files", - SchemaName: "files", - }, - { - Name: "Translation", - SchemaName: "translation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputPersonalDocument) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPersonalDocument#bb343fae as nil") - } - b.PutID(InputPersonalDocumentTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputPersonalDocument) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputPersonalDocument#bb343fae as nil") - } - b.PutInt(len(i.Files)) - for idx, v := range i.Files { - if v == nil { - return fmt.Errorf("unable to encode inputPersonalDocument#bb343fae: field files element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare inputPersonalDocument#bb343fae: field files element with index %d: %w", idx, err) - } - } - b.PutInt(len(i.Translation)) - for idx, v := range i.Translation { - if v == nil { - return fmt.Errorf("unable to encode inputPersonalDocument#bb343fae: field translation element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare inputPersonalDocument#bb343fae: field translation element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputPersonalDocument) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPersonalDocument#bb343fae to nil") - } - if err := b.ConsumeID(InputPersonalDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode inputPersonalDocument#bb343fae: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputPersonalDocument) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputPersonalDocument#bb343fae to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputPersonalDocument#bb343fae: field files: %w", err) - } - - if headerLen > 0 { - i.Files = make([]InputFileClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputPersonalDocument#bb343fae: field files: %w", err) - } - i.Files = append(i.Files, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputPersonalDocument#bb343fae: field translation: %w", err) - } - - if headerLen > 0 { - i.Translation = make([]InputFileClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputPersonalDocument#bb343fae: field translation: %w", err) - } - i.Translation = append(i.Translation, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputPersonalDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputPersonalDocument#bb343fae as nil") - } - b.ObjStart() - b.PutID("inputPersonalDocument") - b.Comma() - b.FieldStart("files") - b.ArrStart() - for idx, v := range i.Files { - if v == nil { - return fmt.Errorf("unable to encode inputPersonalDocument#bb343fae: field files element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPersonalDocument#bb343fae: field files element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("translation") - b.ArrStart() - for idx, v := range i.Translation { - if v == nil { - return fmt.Errorf("unable to encode inputPersonalDocument#bb343fae: field translation element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputPersonalDocument#bb343fae: field translation element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputPersonalDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputPersonalDocument#bb343fae to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputPersonalDocument"); err != nil { - return fmt.Errorf("unable to decode inputPersonalDocument#bb343fae: %w", err) - } - case "files": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputPersonalDocument#bb343fae: field files: %w", err) - } - i.Files = append(i.Files, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputPersonalDocument#bb343fae: field files: %w", err) - } - case "translation": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputPersonalDocument#bb343fae: field translation: %w", err) - } - i.Translation = append(i.Translation, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputPersonalDocument#bb343fae: field translation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFiles returns value of Files field. -func (i *InputPersonalDocument) GetFiles() (value []InputFileClass) { - if i == nil { - return - } - return i.Files -} - -// GetTranslation returns value of Translation field. -func (i *InputPersonalDocument) GetTranslation() (value []InputFileClass) { - if i == nil { - return - } - return i.Translation -} diff --git a/tdapi/tl_input_sticker_gen.go b/tdapi/tl_input_sticker_gen.go deleted file mode 100644 index ddf49f546..000000000 --- a/tdapi/tl_input_sticker_gen.go +++ /dev/null @@ -1,375 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputSticker represents TL type `inputSticker#1f1d0998`. -type InputSticker struct { - // File with the sticker; must fit in a 512x512 square. For WEBP stickers the file must - // be in WEBP or PNG format, which will be converted to WEBP server-side. - Sticker InputFileClass - // Format of the sticker - Format StickerFormatClass - // String with 1-20 emoji corresponding to the sticker - Emojis string - // Position where the mask is placed; pass null if not specified - MaskPosition MaskPosition - // List of up to 20 keywords with total length up to 64 characters, which can be used to - // find the sticker - Keywords []string -} - -// InputStickerTypeID is TL type id of InputSticker. -const InputStickerTypeID = 0x1f1d0998 - -// Ensuring interfaces in compile-time for InputSticker. -var ( - _ bin.Encoder = &InputSticker{} - _ bin.Decoder = &InputSticker{} - _ bin.BareEncoder = &InputSticker{} - _ bin.BareDecoder = &InputSticker{} -) - -func (i *InputSticker) Zero() bool { - if i == nil { - return true - } - if !(i.Sticker == nil) { - return false - } - if !(i.Format == nil) { - return false - } - if !(i.Emojis == "") { - return false - } - if !(i.MaskPosition.Zero()) { - return false - } - if !(i.Keywords == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputSticker) String() string { - if i == nil { - return "InputSticker(nil)" - } - type Alias InputSticker - return fmt.Sprintf("InputSticker%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputSticker) TypeID() uint32 { - return InputStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputSticker) TypeName() string { - return "inputSticker" -} - -// TypeInfo returns info about TL type. -func (i *InputSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputSticker", - ID: InputStickerTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "Format", - SchemaName: "format", - }, - { - Name: "Emojis", - SchemaName: "emojis", - }, - { - Name: "MaskPosition", - SchemaName: "mask_position", - }, - { - Name: "Keywords", - SchemaName: "keywords", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputSticker) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputSticker#1f1d0998 as nil") - } - b.PutID(InputStickerTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputSticker) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputSticker#1f1d0998 as nil") - } - if i.Sticker == nil { - return fmt.Errorf("unable to encode inputSticker#1f1d0998: field sticker is nil") - } - if err := i.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputSticker#1f1d0998: field sticker: %w", err) - } - if i.Format == nil { - return fmt.Errorf("unable to encode inputSticker#1f1d0998: field format is nil") - } - if err := i.Format.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputSticker#1f1d0998: field format: %w", err) - } - b.PutString(i.Emojis) - if err := i.MaskPosition.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputSticker#1f1d0998: field mask_position: %w", err) - } - b.PutInt(len(i.Keywords)) - for _, v := range i.Keywords { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputSticker) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputSticker#1f1d0998 to nil") - } - if err := b.ConsumeID(InputStickerTypeID); err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputSticker) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputSticker#1f1d0998 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field sticker: %w", err) - } - i.Sticker = value - } - { - value, err := DecodeStickerFormat(b) - if err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field format: %w", err) - } - i.Format = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field emojis: %w", err) - } - i.Emojis = value - } - { - if err := i.MaskPosition.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field mask_position: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field keywords: %w", err) - } - - if headerLen > 0 { - i.Keywords = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field keywords: %w", err) - } - i.Keywords = append(i.Keywords, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputSticker#1f1d0998 as nil") - } - b.ObjStart() - b.PutID("inputSticker") - b.Comma() - b.FieldStart("sticker") - if i.Sticker == nil { - return fmt.Errorf("unable to encode inputSticker#1f1d0998: field sticker is nil") - } - if err := i.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputSticker#1f1d0998: field sticker: %w", err) - } - b.Comma() - b.FieldStart("format") - if i.Format == nil { - return fmt.Errorf("unable to encode inputSticker#1f1d0998: field format is nil") - } - if err := i.Format.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputSticker#1f1d0998: field format: %w", err) - } - b.Comma() - b.FieldStart("emojis") - b.PutString(i.Emojis) - b.Comma() - b.FieldStart("mask_position") - if err := i.MaskPosition.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputSticker#1f1d0998: field mask_position: %w", err) - } - b.Comma() - b.FieldStart("keywords") - b.ArrStart() - for _, v := range i.Keywords { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputSticker#1f1d0998 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputSticker"); err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: %w", err) - } - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field sticker: %w", err) - } - i.Sticker = value - case "format": - value, err := DecodeTDLibJSONStickerFormat(b) - if err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field format: %w", err) - } - i.Format = value - case "emojis": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field emojis: %w", err) - } - i.Emojis = value - case "mask_position": - if err := i.MaskPosition.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field mask_position: %w", err) - } - case "keywords": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field keywords: %w", err) - } - i.Keywords = append(i.Keywords, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputSticker#1f1d0998: field keywords: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (i *InputSticker) GetSticker() (value InputFileClass) { - if i == nil { - return - } - return i.Sticker -} - -// GetFormat returns value of Format field. -func (i *InputSticker) GetFormat() (value StickerFormatClass) { - if i == nil { - return - } - return i.Format -} - -// GetEmojis returns value of Emojis field. -func (i *InputSticker) GetEmojis() (value string) { - if i == nil { - return - } - return i.Emojis -} - -// GetMaskPosition returns value of MaskPosition field. -func (i *InputSticker) GetMaskPosition() (value MaskPosition) { - if i == nil { - return - } - return i.MaskPosition -} - -// GetKeywords returns value of Keywords field. -func (i *InputSticker) GetKeywords() (value []string) { - if i == nil { - return - } - return i.Keywords -} diff --git a/tdapi/tl_input_story_area_gen.go b/tdapi/tl_input_story_area_gen.go deleted file mode 100644 index da3d57e74..000000000 --- a/tdapi/tl_input_story_area_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputStoryArea represents TL type `inputStoryArea#752ae7f`. -type InputStoryArea struct { - // Position of the area - Position StoryAreaPosition - // Type of the area - Type InputStoryAreaTypeClass -} - -// InputStoryAreaTypeID is TL type id of InputStoryArea. -const InputStoryAreaTypeID = 0x752ae7f - -// Ensuring interfaces in compile-time for InputStoryArea. -var ( - _ bin.Encoder = &InputStoryArea{} - _ bin.Decoder = &InputStoryArea{} - _ bin.BareEncoder = &InputStoryArea{} - _ bin.BareDecoder = &InputStoryArea{} -) - -func (i *InputStoryArea) Zero() bool { - if i == nil { - return true - } - if !(i.Position.Zero()) { - return false - } - if !(i.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStoryArea) String() string { - if i == nil { - return "InputStoryArea(nil)" - } - type Alias InputStoryArea - return fmt.Sprintf("InputStoryArea%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStoryArea) TypeID() uint32 { - return InputStoryAreaTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStoryArea) TypeName() string { - return "inputStoryArea" -} - -// TypeInfo returns info about TL type. -func (i *InputStoryArea) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStoryArea", - ID: InputStoryAreaTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Position", - SchemaName: "position", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStoryArea) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryArea#752ae7f as nil") - } - b.PutID(InputStoryAreaTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStoryArea) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryArea#752ae7f as nil") - } - if err := i.Position.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field position: %w", err) - } - if i.Type == nil { - return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field type is nil") - } - if err := i.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStoryArea) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryArea#752ae7f to nil") - } - if err := b.ConsumeID(InputStoryAreaTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryArea#752ae7f: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStoryArea) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryArea#752ae7f to nil") - } - { - if err := i.Position.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputStoryArea#752ae7f: field position: %w", err) - } - } - { - value, err := DecodeInputStoryAreaType(b) - if err != nil { - return fmt.Errorf("unable to decode inputStoryArea#752ae7f: field type: %w", err) - } - i.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStoryArea) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryArea#752ae7f as nil") - } - b.ObjStart() - b.PutID("inputStoryArea") - b.Comma() - b.FieldStart("position") - if err := i.Position.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field position: %w", err) - } - b.Comma() - b.FieldStart("type") - if i.Type == nil { - return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field type is nil") - } - if err := i.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStoryArea#752ae7f: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStoryArea) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryArea#752ae7f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStoryArea"); err != nil { - return fmt.Errorf("unable to decode inputStoryArea#752ae7f: %w", err) - } - case "position": - if err := i.Position.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputStoryArea#752ae7f: field position: %w", err) - } - case "type": - value, err := DecodeTDLibJSONInputStoryAreaType(b) - if err != nil { - return fmt.Errorf("unable to decode inputStoryArea#752ae7f: field type: %w", err) - } - i.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPosition returns value of Position field. -func (i *InputStoryArea) GetPosition() (value StoryAreaPosition) { - if i == nil { - return - } - return i.Position -} - -// GetType returns value of Type field. -func (i *InputStoryArea) GetType() (value InputStoryAreaTypeClass) { - if i == nil { - return - } - return i.Type -} diff --git a/tdapi/tl_input_story_area_type_gen.go b/tdapi/tl_input_story_area_type_gen.go deleted file mode 100644 index 506140a55..000000000 --- a/tdapi/tl_input_story_area_type_gen.go +++ /dev/null @@ -1,1690 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputStoryAreaTypeLocation represents TL type `inputStoryAreaTypeLocation#aa8b3f39`. -type InputStoryAreaTypeLocation struct { - // The location - Location Location - // Address of the location; pass null if unknown - Address LocationAddress -} - -// InputStoryAreaTypeLocationTypeID is TL type id of InputStoryAreaTypeLocation. -const InputStoryAreaTypeLocationTypeID = 0xaa8b3f39 - -// construct implements constructor of InputStoryAreaTypeClass. -func (i InputStoryAreaTypeLocation) construct() InputStoryAreaTypeClass { return &i } - -// Ensuring interfaces in compile-time for InputStoryAreaTypeLocation. -var ( - _ bin.Encoder = &InputStoryAreaTypeLocation{} - _ bin.Decoder = &InputStoryAreaTypeLocation{} - _ bin.BareEncoder = &InputStoryAreaTypeLocation{} - _ bin.BareDecoder = &InputStoryAreaTypeLocation{} - - _ InputStoryAreaTypeClass = &InputStoryAreaTypeLocation{} -) - -func (i *InputStoryAreaTypeLocation) Zero() bool { - if i == nil { - return true - } - if !(i.Location.Zero()) { - return false - } - if !(i.Address.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStoryAreaTypeLocation) String() string { - if i == nil { - return "InputStoryAreaTypeLocation(nil)" - } - type Alias InputStoryAreaTypeLocation - return fmt.Sprintf("InputStoryAreaTypeLocation%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStoryAreaTypeLocation) TypeID() uint32 { - return InputStoryAreaTypeLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStoryAreaTypeLocation) TypeName() string { - return "inputStoryAreaTypeLocation" -} - -// TypeInfo returns info about TL type. -func (i *InputStoryAreaTypeLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStoryAreaTypeLocation", - ID: InputStoryAreaTypeLocationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "Address", - SchemaName: "address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStoryAreaTypeLocation) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeLocation#aa8b3f39 as nil") - } - b.PutID(InputStoryAreaTypeLocationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStoryAreaTypeLocation) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeLocation#aa8b3f39 as nil") - } - if err := i.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStoryAreaTypeLocation#aa8b3f39: field location: %w", err) - } - if err := i.Address.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStoryAreaTypeLocation#aa8b3f39: field address: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStoryAreaTypeLocation) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeLocation#aa8b3f39 to nil") - } - if err := b.ConsumeID(InputStoryAreaTypeLocationTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeLocation#aa8b3f39: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStoryAreaTypeLocation) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeLocation#aa8b3f39 to nil") - } - { - if err := i.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeLocation#aa8b3f39: field location: %w", err) - } - } - { - if err := i.Address.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeLocation#aa8b3f39: field address: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStoryAreaTypeLocation) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeLocation#aa8b3f39 as nil") - } - b.ObjStart() - b.PutID("inputStoryAreaTypeLocation") - b.Comma() - b.FieldStart("location") - if err := i.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStoryAreaTypeLocation#aa8b3f39: field location: %w", err) - } - b.Comma() - b.FieldStart("address") - if err := i.Address.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStoryAreaTypeLocation#aa8b3f39: field address: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStoryAreaTypeLocation) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeLocation#aa8b3f39 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStoryAreaTypeLocation"); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeLocation#aa8b3f39: %w", err) - } - case "location": - if err := i.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeLocation#aa8b3f39: field location: %w", err) - } - case "address": - if err := i.Address.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeLocation#aa8b3f39: field address: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (i *InputStoryAreaTypeLocation) GetLocation() (value Location) { - if i == nil { - return - } - return i.Location -} - -// GetAddress returns value of Address field. -func (i *InputStoryAreaTypeLocation) GetAddress() (value LocationAddress) { - if i == nil { - return - } - return i.Address -} - -// InputStoryAreaTypeFoundVenue represents TL type `inputStoryAreaTypeFoundVenue#accda496`. -type InputStoryAreaTypeFoundVenue struct { - // Identifier of the inline query, used to found the venue - QueryID int64 - // Identifier of the inline query result - ResultID string -} - -// InputStoryAreaTypeFoundVenueTypeID is TL type id of InputStoryAreaTypeFoundVenue. -const InputStoryAreaTypeFoundVenueTypeID = 0xaccda496 - -// construct implements constructor of InputStoryAreaTypeClass. -func (i InputStoryAreaTypeFoundVenue) construct() InputStoryAreaTypeClass { return &i } - -// Ensuring interfaces in compile-time for InputStoryAreaTypeFoundVenue. -var ( - _ bin.Encoder = &InputStoryAreaTypeFoundVenue{} - _ bin.Decoder = &InputStoryAreaTypeFoundVenue{} - _ bin.BareEncoder = &InputStoryAreaTypeFoundVenue{} - _ bin.BareDecoder = &InputStoryAreaTypeFoundVenue{} - - _ InputStoryAreaTypeClass = &InputStoryAreaTypeFoundVenue{} -) - -func (i *InputStoryAreaTypeFoundVenue) Zero() bool { - if i == nil { - return true - } - if !(i.QueryID == 0) { - return false - } - if !(i.ResultID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStoryAreaTypeFoundVenue) String() string { - if i == nil { - return "InputStoryAreaTypeFoundVenue(nil)" - } - type Alias InputStoryAreaTypeFoundVenue - return fmt.Sprintf("InputStoryAreaTypeFoundVenue%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStoryAreaTypeFoundVenue) TypeID() uint32 { - return InputStoryAreaTypeFoundVenueTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStoryAreaTypeFoundVenue) TypeName() string { - return "inputStoryAreaTypeFoundVenue" -} - -// TypeInfo returns info about TL type. -func (i *InputStoryAreaTypeFoundVenue) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStoryAreaTypeFoundVenue", - ID: InputStoryAreaTypeFoundVenueTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "QueryID", - SchemaName: "query_id", - }, - { - Name: "ResultID", - SchemaName: "result_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStoryAreaTypeFoundVenue) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeFoundVenue#accda496 as nil") - } - b.PutID(InputStoryAreaTypeFoundVenueTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStoryAreaTypeFoundVenue) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeFoundVenue#accda496 as nil") - } - b.PutLong(i.QueryID) - b.PutString(i.ResultID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStoryAreaTypeFoundVenue) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeFoundVenue#accda496 to nil") - } - if err := b.ConsumeID(InputStoryAreaTypeFoundVenueTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeFoundVenue#accda496: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStoryAreaTypeFoundVenue) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeFoundVenue#accda496 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeFoundVenue#accda496: field query_id: %w", err) - } - i.QueryID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeFoundVenue#accda496: field result_id: %w", err) - } - i.ResultID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStoryAreaTypeFoundVenue) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeFoundVenue#accda496 as nil") - } - b.ObjStart() - b.PutID("inputStoryAreaTypeFoundVenue") - b.Comma() - b.FieldStart("query_id") - b.PutLong(i.QueryID) - b.Comma() - b.FieldStart("result_id") - b.PutString(i.ResultID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStoryAreaTypeFoundVenue) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeFoundVenue#accda496 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStoryAreaTypeFoundVenue"); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeFoundVenue#accda496: %w", err) - } - case "query_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeFoundVenue#accda496: field query_id: %w", err) - } - i.QueryID = value - case "result_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeFoundVenue#accda496: field result_id: %w", err) - } - i.ResultID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQueryID returns value of QueryID field. -func (i *InputStoryAreaTypeFoundVenue) GetQueryID() (value int64) { - if i == nil { - return - } - return i.QueryID -} - -// GetResultID returns value of ResultID field. -func (i *InputStoryAreaTypeFoundVenue) GetResultID() (value string) { - if i == nil { - return - } - return i.ResultID -} - -// InputStoryAreaTypePreviousVenue represents TL type `inputStoryAreaTypePreviousVenue#6e124e0c`. -type InputStoryAreaTypePreviousVenue struct { - // Provider of the venue - VenueProvider string - // Identifier of the venue in the provider database - VenueID string -} - -// InputStoryAreaTypePreviousVenueTypeID is TL type id of InputStoryAreaTypePreviousVenue. -const InputStoryAreaTypePreviousVenueTypeID = 0x6e124e0c - -// construct implements constructor of InputStoryAreaTypeClass. -func (i InputStoryAreaTypePreviousVenue) construct() InputStoryAreaTypeClass { return &i } - -// Ensuring interfaces in compile-time for InputStoryAreaTypePreviousVenue. -var ( - _ bin.Encoder = &InputStoryAreaTypePreviousVenue{} - _ bin.Decoder = &InputStoryAreaTypePreviousVenue{} - _ bin.BareEncoder = &InputStoryAreaTypePreviousVenue{} - _ bin.BareDecoder = &InputStoryAreaTypePreviousVenue{} - - _ InputStoryAreaTypeClass = &InputStoryAreaTypePreviousVenue{} -) - -func (i *InputStoryAreaTypePreviousVenue) Zero() bool { - if i == nil { - return true - } - if !(i.VenueProvider == "") { - return false - } - if !(i.VenueID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStoryAreaTypePreviousVenue) String() string { - if i == nil { - return "InputStoryAreaTypePreviousVenue(nil)" - } - type Alias InputStoryAreaTypePreviousVenue - return fmt.Sprintf("InputStoryAreaTypePreviousVenue%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStoryAreaTypePreviousVenue) TypeID() uint32 { - return InputStoryAreaTypePreviousVenueTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStoryAreaTypePreviousVenue) TypeName() string { - return "inputStoryAreaTypePreviousVenue" -} - -// TypeInfo returns info about TL type. -func (i *InputStoryAreaTypePreviousVenue) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStoryAreaTypePreviousVenue", - ID: InputStoryAreaTypePreviousVenueTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VenueProvider", - SchemaName: "venue_provider", - }, - { - Name: "VenueID", - SchemaName: "venue_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStoryAreaTypePreviousVenue) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypePreviousVenue#6e124e0c as nil") - } - b.PutID(InputStoryAreaTypePreviousVenueTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStoryAreaTypePreviousVenue) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypePreviousVenue#6e124e0c as nil") - } - b.PutString(i.VenueProvider) - b.PutString(i.VenueID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStoryAreaTypePreviousVenue) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypePreviousVenue#6e124e0c to nil") - } - if err := b.ConsumeID(InputStoryAreaTypePreviousVenueTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypePreviousVenue#6e124e0c: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStoryAreaTypePreviousVenue) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypePreviousVenue#6e124e0c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypePreviousVenue#6e124e0c: field venue_provider: %w", err) - } - i.VenueProvider = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypePreviousVenue#6e124e0c: field venue_id: %w", err) - } - i.VenueID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStoryAreaTypePreviousVenue) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypePreviousVenue#6e124e0c as nil") - } - b.ObjStart() - b.PutID("inputStoryAreaTypePreviousVenue") - b.Comma() - b.FieldStart("venue_provider") - b.PutString(i.VenueProvider) - b.Comma() - b.FieldStart("venue_id") - b.PutString(i.VenueID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStoryAreaTypePreviousVenue) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypePreviousVenue#6e124e0c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStoryAreaTypePreviousVenue"); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypePreviousVenue#6e124e0c: %w", err) - } - case "venue_provider": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypePreviousVenue#6e124e0c: field venue_provider: %w", err) - } - i.VenueProvider = value - case "venue_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypePreviousVenue#6e124e0c: field venue_id: %w", err) - } - i.VenueID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVenueProvider returns value of VenueProvider field. -func (i *InputStoryAreaTypePreviousVenue) GetVenueProvider() (value string) { - if i == nil { - return - } - return i.VenueProvider -} - -// GetVenueID returns value of VenueID field. -func (i *InputStoryAreaTypePreviousVenue) GetVenueID() (value string) { - if i == nil { - return - } - return i.VenueID -} - -// InputStoryAreaTypeSuggestedReaction represents TL type `inputStoryAreaTypeSuggestedReaction#7d4751d3`. -type InputStoryAreaTypeSuggestedReaction struct { - // Type of the reaction - ReactionType ReactionTypeClass - // True, if reaction has a dark background - IsDark bool - // True, if reaction corner is flipped - IsFlipped bool -} - -// InputStoryAreaTypeSuggestedReactionTypeID is TL type id of InputStoryAreaTypeSuggestedReaction. -const InputStoryAreaTypeSuggestedReactionTypeID = 0x7d4751d3 - -// construct implements constructor of InputStoryAreaTypeClass. -func (i InputStoryAreaTypeSuggestedReaction) construct() InputStoryAreaTypeClass { return &i } - -// Ensuring interfaces in compile-time for InputStoryAreaTypeSuggestedReaction. -var ( - _ bin.Encoder = &InputStoryAreaTypeSuggestedReaction{} - _ bin.Decoder = &InputStoryAreaTypeSuggestedReaction{} - _ bin.BareEncoder = &InputStoryAreaTypeSuggestedReaction{} - _ bin.BareDecoder = &InputStoryAreaTypeSuggestedReaction{} - - _ InputStoryAreaTypeClass = &InputStoryAreaTypeSuggestedReaction{} -) - -func (i *InputStoryAreaTypeSuggestedReaction) Zero() bool { - if i == nil { - return true - } - if !(i.ReactionType == nil) { - return false - } - if !(i.IsDark == false) { - return false - } - if !(i.IsFlipped == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStoryAreaTypeSuggestedReaction) String() string { - if i == nil { - return "InputStoryAreaTypeSuggestedReaction(nil)" - } - type Alias InputStoryAreaTypeSuggestedReaction - return fmt.Sprintf("InputStoryAreaTypeSuggestedReaction%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStoryAreaTypeSuggestedReaction) TypeID() uint32 { - return InputStoryAreaTypeSuggestedReactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStoryAreaTypeSuggestedReaction) TypeName() string { - return "inputStoryAreaTypeSuggestedReaction" -} - -// TypeInfo returns info about TL type. -func (i *InputStoryAreaTypeSuggestedReaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStoryAreaTypeSuggestedReaction", - ID: InputStoryAreaTypeSuggestedReactionTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ReactionType", - SchemaName: "reaction_type", - }, - { - Name: "IsDark", - SchemaName: "is_dark", - }, - { - Name: "IsFlipped", - SchemaName: "is_flipped", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStoryAreaTypeSuggestedReaction) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeSuggestedReaction#7d4751d3 as nil") - } - b.PutID(InputStoryAreaTypeSuggestedReactionTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStoryAreaTypeSuggestedReaction) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeSuggestedReaction#7d4751d3 as nil") - } - if i.ReactionType == nil { - return fmt.Errorf("unable to encode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type is nil") - } - if err := i.ReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type: %w", err) - } - b.PutBool(i.IsDark) - b.PutBool(i.IsFlipped) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStoryAreaTypeSuggestedReaction) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeSuggestedReaction#7d4751d3 to nil") - } - if err := b.ConsumeID(InputStoryAreaTypeSuggestedReactionTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStoryAreaTypeSuggestedReaction) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeSuggestedReaction#7d4751d3 to nil") - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type: %w", err) - } - i.ReactionType = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field is_dark: %w", err) - } - i.IsDark = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field is_flipped: %w", err) - } - i.IsFlipped = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStoryAreaTypeSuggestedReaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeSuggestedReaction#7d4751d3 as nil") - } - b.ObjStart() - b.PutID("inputStoryAreaTypeSuggestedReaction") - b.Comma() - b.FieldStart("reaction_type") - if i.ReactionType == nil { - return fmt.Errorf("unable to encode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type is nil") - } - if err := i.ReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type: %w", err) - } - b.Comma() - b.FieldStart("is_dark") - b.PutBool(i.IsDark) - b.Comma() - b.FieldStart("is_flipped") - b.PutBool(i.IsFlipped) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStoryAreaTypeSuggestedReaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeSuggestedReaction#7d4751d3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStoryAreaTypeSuggestedReaction"); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: %w", err) - } - case "reaction_type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field reaction_type: %w", err) - } - i.ReactionType = value - case "is_dark": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field is_dark: %w", err) - } - i.IsDark = value - case "is_flipped": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeSuggestedReaction#7d4751d3: field is_flipped: %w", err) - } - i.IsFlipped = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReactionType returns value of ReactionType field. -func (i *InputStoryAreaTypeSuggestedReaction) GetReactionType() (value ReactionTypeClass) { - if i == nil { - return - } - return i.ReactionType -} - -// GetIsDark returns value of IsDark field. -func (i *InputStoryAreaTypeSuggestedReaction) GetIsDark() (value bool) { - if i == nil { - return - } - return i.IsDark -} - -// GetIsFlipped returns value of IsFlipped field. -func (i *InputStoryAreaTypeSuggestedReaction) GetIsFlipped() (value bool) { - if i == nil { - return - } - return i.IsFlipped -} - -// InputStoryAreaTypeMessage represents TL type `inputStoryAreaTypeMessage#f01be457`. -type InputStoryAreaTypeMessage struct { - // Identifier of the chat with the message. Currently, the chat must be a supergroup or a - // channel chat - ChatID int64 - // Identifier of the message. Use messageProperties.can_be_shared_in_story to check - // whether the message is suitable - MessageID int64 -} - -// InputStoryAreaTypeMessageTypeID is TL type id of InputStoryAreaTypeMessage. -const InputStoryAreaTypeMessageTypeID = 0xf01be457 - -// construct implements constructor of InputStoryAreaTypeClass. -func (i InputStoryAreaTypeMessage) construct() InputStoryAreaTypeClass { return &i } - -// Ensuring interfaces in compile-time for InputStoryAreaTypeMessage. -var ( - _ bin.Encoder = &InputStoryAreaTypeMessage{} - _ bin.Decoder = &InputStoryAreaTypeMessage{} - _ bin.BareEncoder = &InputStoryAreaTypeMessage{} - _ bin.BareDecoder = &InputStoryAreaTypeMessage{} - - _ InputStoryAreaTypeClass = &InputStoryAreaTypeMessage{} -) - -func (i *InputStoryAreaTypeMessage) Zero() bool { - if i == nil { - return true - } - if !(i.ChatID == 0) { - return false - } - if !(i.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStoryAreaTypeMessage) String() string { - if i == nil { - return "InputStoryAreaTypeMessage(nil)" - } - type Alias InputStoryAreaTypeMessage - return fmt.Sprintf("InputStoryAreaTypeMessage%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStoryAreaTypeMessage) TypeID() uint32 { - return InputStoryAreaTypeMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStoryAreaTypeMessage) TypeName() string { - return "inputStoryAreaTypeMessage" -} - -// TypeInfo returns info about TL type. -func (i *InputStoryAreaTypeMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStoryAreaTypeMessage", - ID: InputStoryAreaTypeMessageTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStoryAreaTypeMessage) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeMessage#f01be457 as nil") - } - b.PutID(InputStoryAreaTypeMessageTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStoryAreaTypeMessage) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeMessage#f01be457 as nil") - } - b.PutInt53(i.ChatID) - b.PutInt53(i.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStoryAreaTypeMessage) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeMessage#f01be457 to nil") - } - if err := b.ConsumeID(InputStoryAreaTypeMessageTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeMessage#f01be457: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStoryAreaTypeMessage) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeMessage#f01be457 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeMessage#f01be457: field chat_id: %w", err) - } - i.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeMessage#f01be457: field message_id: %w", err) - } - i.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStoryAreaTypeMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeMessage#f01be457 as nil") - } - b.ObjStart() - b.PutID("inputStoryAreaTypeMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(i.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(i.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStoryAreaTypeMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeMessage#f01be457 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStoryAreaTypeMessage"); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeMessage#f01be457: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeMessage#f01be457: field chat_id: %w", err) - } - i.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeMessage#f01be457: field message_id: %w", err) - } - i.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (i *InputStoryAreaTypeMessage) GetChatID() (value int64) { - if i == nil { - return - } - return i.ChatID -} - -// GetMessageID returns value of MessageID field. -func (i *InputStoryAreaTypeMessage) GetMessageID() (value int64) { - if i == nil { - return - } - return i.MessageID -} - -// InputStoryAreaTypeLink represents TL type `inputStoryAreaTypeLink#53f31b48`. -type InputStoryAreaTypeLink struct { - // HTTP or tg:// URL to be opened when the area is clicked - URL string -} - -// InputStoryAreaTypeLinkTypeID is TL type id of InputStoryAreaTypeLink. -const InputStoryAreaTypeLinkTypeID = 0x53f31b48 - -// construct implements constructor of InputStoryAreaTypeClass. -func (i InputStoryAreaTypeLink) construct() InputStoryAreaTypeClass { return &i } - -// Ensuring interfaces in compile-time for InputStoryAreaTypeLink. -var ( - _ bin.Encoder = &InputStoryAreaTypeLink{} - _ bin.Decoder = &InputStoryAreaTypeLink{} - _ bin.BareEncoder = &InputStoryAreaTypeLink{} - _ bin.BareDecoder = &InputStoryAreaTypeLink{} - - _ InputStoryAreaTypeClass = &InputStoryAreaTypeLink{} -) - -func (i *InputStoryAreaTypeLink) Zero() bool { - if i == nil { - return true - } - if !(i.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStoryAreaTypeLink) String() string { - if i == nil { - return "InputStoryAreaTypeLink(nil)" - } - type Alias InputStoryAreaTypeLink - return fmt.Sprintf("InputStoryAreaTypeLink%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStoryAreaTypeLink) TypeID() uint32 { - return InputStoryAreaTypeLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStoryAreaTypeLink) TypeName() string { - return "inputStoryAreaTypeLink" -} - -// TypeInfo returns info about TL type. -func (i *InputStoryAreaTypeLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStoryAreaTypeLink", - ID: InputStoryAreaTypeLinkTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStoryAreaTypeLink) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeLink#53f31b48 as nil") - } - b.PutID(InputStoryAreaTypeLinkTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStoryAreaTypeLink) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeLink#53f31b48 as nil") - } - b.PutString(i.URL) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStoryAreaTypeLink) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeLink#53f31b48 to nil") - } - if err := b.ConsumeID(InputStoryAreaTypeLinkTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeLink#53f31b48: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStoryAreaTypeLink) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeLink#53f31b48 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeLink#53f31b48: field url: %w", err) - } - i.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStoryAreaTypeLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeLink#53f31b48 as nil") - } - b.ObjStart() - b.PutID("inputStoryAreaTypeLink") - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStoryAreaTypeLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeLink#53f31b48 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStoryAreaTypeLink"); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeLink#53f31b48: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeLink#53f31b48: field url: %w", err) - } - i.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (i *InputStoryAreaTypeLink) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// InputStoryAreaTypeWeather represents TL type `inputStoryAreaTypeWeather#b7b7de9d`. -type InputStoryAreaTypeWeather struct { - // Temperature, in degree Celsius - Temperature float64 - // Emoji representing the weather - Emoji string - // A color of the area background in the ARGB format - BackgroundColor int32 -} - -// InputStoryAreaTypeWeatherTypeID is TL type id of InputStoryAreaTypeWeather. -const InputStoryAreaTypeWeatherTypeID = 0xb7b7de9d - -// construct implements constructor of InputStoryAreaTypeClass. -func (i InputStoryAreaTypeWeather) construct() InputStoryAreaTypeClass { return &i } - -// Ensuring interfaces in compile-time for InputStoryAreaTypeWeather. -var ( - _ bin.Encoder = &InputStoryAreaTypeWeather{} - _ bin.Decoder = &InputStoryAreaTypeWeather{} - _ bin.BareEncoder = &InputStoryAreaTypeWeather{} - _ bin.BareDecoder = &InputStoryAreaTypeWeather{} - - _ InputStoryAreaTypeClass = &InputStoryAreaTypeWeather{} -) - -func (i *InputStoryAreaTypeWeather) Zero() bool { - if i == nil { - return true - } - if !(i.Temperature == 0) { - return false - } - if !(i.Emoji == "") { - return false - } - if !(i.BackgroundColor == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStoryAreaTypeWeather) String() string { - if i == nil { - return "InputStoryAreaTypeWeather(nil)" - } - type Alias InputStoryAreaTypeWeather - return fmt.Sprintf("InputStoryAreaTypeWeather%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStoryAreaTypeWeather) TypeID() uint32 { - return InputStoryAreaTypeWeatherTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStoryAreaTypeWeather) TypeName() string { - return "inputStoryAreaTypeWeather" -} - -// TypeInfo returns info about TL type. -func (i *InputStoryAreaTypeWeather) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStoryAreaTypeWeather", - ID: InputStoryAreaTypeWeatherTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Temperature", - SchemaName: "temperature", - }, - { - Name: "Emoji", - SchemaName: "emoji", - }, - { - Name: "BackgroundColor", - SchemaName: "background_color", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStoryAreaTypeWeather) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeWeather#b7b7de9d as nil") - } - b.PutID(InputStoryAreaTypeWeatherTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStoryAreaTypeWeather) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeWeather#b7b7de9d as nil") - } - b.PutDouble(i.Temperature) - b.PutString(i.Emoji) - b.PutInt32(i.BackgroundColor) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStoryAreaTypeWeather) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeWeather#b7b7de9d to nil") - } - if err := b.ConsumeID(InputStoryAreaTypeWeatherTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStoryAreaTypeWeather) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeWeather#b7b7de9d to nil") - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field temperature: %w", err) - } - i.Temperature = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field emoji: %w", err) - } - i.Emoji = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field background_color: %w", err) - } - i.BackgroundColor = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStoryAreaTypeWeather) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreaTypeWeather#b7b7de9d as nil") - } - b.ObjStart() - b.PutID("inputStoryAreaTypeWeather") - b.Comma() - b.FieldStart("temperature") - b.PutDouble(i.Temperature) - b.Comma() - b.FieldStart("emoji") - b.PutString(i.Emoji) - b.Comma() - b.FieldStart("background_color") - b.PutInt32(i.BackgroundColor) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStoryAreaTypeWeather) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreaTypeWeather#b7b7de9d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStoryAreaTypeWeather"); err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: %w", err) - } - case "temperature": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field temperature: %w", err) - } - i.Temperature = value - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field emoji: %w", err) - } - i.Emoji = value - case "background_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreaTypeWeather#b7b7de9d: field background_color: %w", err) - } - i.BackgroundColor = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTemperature returns value of Temperature field. -func (i *InputStoryAreaTypeWeather) GetTemperature() (value float64) { - if i == nil { - return - } - return i.Temperature -} - -// GetEmoji returns value of Emoji field. -func (i *InputStoryAreaTypeWeather) GetEmoji() (value string) { - if i == nil { - return - } - return i.Emoji -} - -// GetBackgroundColor returns value of BackgroundColor field. -func (i *InputStoryAreaTypeWeather) GetBackgroundColor() (value int32) { - if i == nil { - return - } - return i.BackgroundColor -} - -// InputStoryAreaTypeClassName is schema name of InputStoryAreaTypeClass. -const InputStoryAreaTypeClassName = "InputStoryAreaType" - -// InputStoryAreaTypeClass represents InputStoryAreaType generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputStoryAreaType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputStoryAreaTypeLocation: // inputStoryAreaTypeLocation#aa8b3f39 -// case *tdapi.InputStoryAreaTypeFoundVenue: // inputStoryAreaTypeFoundVenue#accda496 -// case *tdapi.InputStoryAreaTypePreviousVenue: // inputStoryAreaTypePreviousVenue#6e124e0c -// case *tdapi.InputStoryAreaTypeSuggestedReaction: // inputStoryAreaTypeSuggestedReaction#7d4751d3 -// case *tdapi.InputStoryAreaTypeMessage: // inputStoryAreaTypeMessage#f01be457 -// case *tdapi.InputStoryAreaTypeLink: // inputStoryAreaTypeLink#53f31b48 -// case *tdapi.InputStoryAreaTypeWeather: // inputStoryAreaTypeWeather#b7b7de9d -// default: panic(v) -// } -type InputStoryAreaTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputStoryAreaTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInputStoryAreaType implements binary de-serialization for InputStoryAreaTypeClass. -func DecodeInputStoryAreaType(buf *bin.Buffer) (InputStoryAreaTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputStoryAreaTypeLocationTypeID: - // Decoding inputStoryAreaTypeLocation#aa8b3f39. - v := InputStoryAreaTypeLocation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case InputStoryAreaTypeFoundVenueTypeID: - // Decoding inputStoryAreaTypeFoundVenue#accda496. - v := InputStoryAreaTypeFoundVenue{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case InputStoryAreaTypePreviousVenueTypeID: - // Decoding inputStoryAreaTypePreviousVenue#6e124e0c. - v := InputStoryAreaTypePreviousVenue{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case InputStoryAreaTypeSuggestedReactionTypeID: - // Decoding inputStoryAreaTypeSuggestedReaction#7d4751d3. - v := InputStoryAreaTypeSuggestedReaction{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case InputStoryAreaTypeMessageTypeID: - // Decoding inputStoryAreaTypeMessage#f01be457. - v := InputStoryAreaTypeMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case InputStoryAreaTypeLinkTypeID: - // Decoding inputStoryAreaTypeLink#53f31b48. - v := InputStoryAreaTypeLink{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case InputStoryAreaTypeWeatherTypeID: - // Decoding inputStoryAreaTypeWeather#b7b7de9d. - v := InputStoryAreaTypeWeather{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputStoryAreaType implements binary de-serialization for InputStoryAreaTypeClass. -func DecodeTDLibJSONInputStoryAreaType(buf tdjson.Decoder) (InputStoryAreaTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputStoryAreaTypeLocation": - // Decoding inputStoryAreaTypeLocation#aa8b3f39. - v := InputStoryAreaTypeLocation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case "inputStoryAreaTypeFoundVenue": - // Decoding inputStoryAreaTypeFoundVenue#accda496. - v := InputStoryAreaTypeFoundVenue{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case "inputStoryAreaTypePreviousVenue": - // Decoding inputStoryAreaTypePreviousVenue#6e124e0c. - v := InputStoryAreaTypePreviousVenue{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case "inputStoryAreaTypeSuggestedReaction": - // Decoding inputStoryAreaTypeSuggestedReaction#7d4751d3. - v := InputStoryAreaTypeSuggestedReaction{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case "inputStoryAreaTypeMessage": - // Decoding inputStoryAreaTypeMessage#f01be457. - v := InputStoryAreaTypeMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case "inputStoryAreaTypeLink": - // Decoding inputStoryAreaTypeLink#53f31b48. - v := InputStoryAreaTypeLink{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - case "inputStoryAreaTypeWeather": - // Decoding inputStoryAreaTypeWeather#b7b7de9d. - v := InputStoryAreaTypeWeather{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputStoryAreaTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputStoryAreaType boxes the InputStoryAreaTypeClass providing a helper. -type InputStoryAreaTypeBox struct { - InputStoryAreaType InputStoryAreaTypeClass -} - -// Decode implements bin.Decoder for InputStoryAreaTypeBox. -func (b *InputStoryAreaTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputStoryAreaTypeBox to nil") - } - v, err := DecodeInputStoryAreaType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputStoryAreaType = v - return nil -} - -// Encode implements bin.Encode for InputStoryAreaTypeBox. -func (b *InputStoryAreaTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputStoryAreaType == nil { - return fmt.Errorf("unable to encode InputStoryAreaTypeClass as nil") - } - return b.InputStoryAreaType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputStoryAreaTypeBox. -func (b *InputStoryAreaTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputStoryAreaTypeBox to nil") - } - v, err := DecodeTDLibJSONInputStoryAreaType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputStoryAreaType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputStoryAreaTypeBox. -func (b *InputStoryAreaTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputStoryAreaType == nil { - return fmt.Errorf("unable to encode InputStoryAreaTypeClass as nil") - } - return b.InputStoryAreaType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_story_areas_gen.go b/tdapi/tl_input_story_areas_gen.go deleted file mode 100644 index aac6bcab8..000000000 --- a/tdapi/tl_input_story_areas_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputStoryAreas represents TL type `inputStoryAreas#b8ba29fe`. -type InputStoryAreas struct { - // List of input story areas. Currently, a story can have - Areas []InputStoryArea -} - -// InputStoryAreasTypeID is TL type id of InputStoryAreas. -const InputStoryAreasTypeID = 0xb8ba29fe - -// Ensuring interfaces in compile-time for InputStoryAreas. -var ( - _ bin.Encoder = &InputStoryAreas{} - _ bin.Decoder = &InputStoryAreas{} - _ bin.BareEncoder = &InputStoryAreas{} - _ bin.BareDecoder = &InputStoryAreas{} -) - -func (i *InputStoryAreas) Zero() bool { - if i == nil { - return true - } - if !(i.Areas == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStoryAreas) String() string { - if i == nil { - return "InputStoryAreas(nil)" - } - type Alias InputStoryAreas - return fmt.Sprintf("InputStoryAreas%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStoryAreas) TypeID() uint32 { - return InputStoryAreasTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStoryAreas) TypeName() string { - return "inputStoryAreas" -} - -// TypeInfo returns info about TL type. -func (i *InputStoryAreas) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStoryAreas", - ID: InputStoryAreasTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Areas", - SchemaName: "areas", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStoryAreas) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreas#b8ba29fe as nil") - } - b.PutID(InputStoryAreasTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStoryAreas) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreas#b8ba29fe as nil") - } - b.PutInt(len(i.Areas)) - for idx, v := range i.Areas { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare inputStoryAreas#b8ba29fe: field areas element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStoryAreas) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreas#b8ba29fe to nil") - } - if err := b.ConsumeID(InputStoryAreasTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryAreas#b8ba29fe: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStoryAreas) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreas#b8ba29fe to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputStoryAreas#b8ba29fe: field areas: %w", err) - } - - if headerLen > 0 { - i.Areas = make([]InputStoryArea, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value InputStoryArea - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare inputStoryAreas#b8ba29fe: field areas: %w", err) - } - i.Areas = append(i.Areas, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStoryAreas) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryAreas#b8ba29fe as nil") - } - b.ObjStart() - b.PutID("inputStoryAreas") - b.Comma() - b.FieldStart("areas") - b.ArrStart() - for idx, v := range i.Areas { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStoryAreas#b8ba29fe: field areas element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStoryAreas) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryAreas#b8ba29fe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStoryAreas"); err != nil { - return fmt.Errorf("unable to decode inputStoryAreas#b8ba29fe: %w", err) - } - case "areas": - if err := b.Arr(func(b tdjson.Decoder) error { - var value InputStoryArea - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputStoryAreas#b8ba29fe: field areas: %w", err) - } - i.Areas = append(i.Areas, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputStoryAreas#b8ba29fe: field areas: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAreas returns value of Areas field. -func (i *InputStoryAreas) GetAreas() (value []InputStoryArea) { - if i == nil { - return - } - return i.Areas -} diff --git a/tdapi/tl_input_story_content_gen.go b/tdapi/tl_input_story_content_gen.go deleted file mode 100644 index 8cf9f85b4..000000000 --- a/tdapi/tl_input_story_content_gen.go +++ /dev/null @@ -1,745 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputStoryContentPhoto represents TL type `inputStoryContentPhoto#3286fbe0`. -type InputStoryContentPhoto struct { - // Photo to send. The photo must be at most 10 MB in size. The photo size must be - // 1080x1920 - Photo InputFileClass - // File identifiers of the stickers added to the photo, if applicable - AddedStickerFileIDs []int32 -} - -// InputStoryContentPhotoTypeID is TL type id of InputStoryContentPhoto. -const InputStoryContentPhotoTypeID = 0x3286fbe0 - -// construct implements constructor of InputStoryContentClass. -func (i InputStoryContentPhoto) construct() InputStoryContentClass { return &i } - -// Ensuring interfaces in compile-time for InputStoryContentPhoto. -var ( - _ bin.Encoder = &InputStoryContentPhoto{} - _ bin.Decoder = &InputStoryContentPhoto{} - _ bin.BareEncoder = &InputStoryContentPhoto{} - _ bin.BareDecoder = &InputStoryContentPhoto{} - - _ InputStoryContentClass = &InputStoryContentPhoto{} -) - -func (i *InputStoryContentPhoto) Zero() bool { - if i == nil { - return true - } - if !(i.Photo == nil) { - return false - } - if !(i.AddedStickerFileIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStoryContentPhoto) String() string { - if i == nil { - return "InputStoryContentPhoto(nil)" - } - type Alias InputStoryContentPhoto - return fmt.Sprintf("InputStoryContentPhoto%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStoryContentPhoto) TypeID() uint32 { - return InputStoryContentPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStoryContentPhoto) TypeName() string { - return "inputStoryContentPhoto" -} - -// TypeInfo returns info about TL type. -func (i *InputStoryContentPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStoryContentPhoto", - ID: InputStoryContentPhotoTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "AddedStickerFileIDs", - SchemaName: "added_sticker_file_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStoryContentPhoto) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryContentPhoto#3286fbe0 as nil") - } - b.PutID(InputStoryContentPhotoTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStoryContentPhoto) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryContentPhoto#3286fbe0 as nil") - } - if i.Photo == nil { - return fmt.Errorf("unable to encode inputStoryContentPhoto#3286fbe0: field photo is nil") - } - if err := i.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStoryContentPhoto#3286fbe0: field photo: %w", err) - } - b.PutInt(len(i.AddedStickerFileIDs)) - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStoryContentPhoto) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryContentPhoto#3286fbe0 to nil") - } - if err := b.ConsumeID(InputStoryContentPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryContentPhoto#3286fbe0: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStoryContentPhoto) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryContentPhoto#3286fbe0 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentPhoto#3286fbe0: field photo: %w", err) - } - i.Photo = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentPhoto#3286fbe0: field added_sticker_file_ids: %w", err) - } - - if headerLen > 0 { - i.AddedStickerFileIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentPhoto#3286fbe0: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStoryContentPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryContentPhoto#3286fbe0 as nil") - } - b.ObjStart() - b.PutID("inputStoryContentPhoto") - b.Comma() - b.FieldStart("photo") - if i.Photo == nil { - return fmt.Errorf("unable to encode inputStoryContentPhoto#3286fbe0: field photo is nil") - } - if err := i.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStoryContentPhoto#3286fbe0: field photo: %w", err) - } - b.Comma() - b.FieldStart("added_sticker_file_ids") - b.ArrStart() - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStoryContentPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryContentPhoto#3286fbe0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStoryContentPhoto"); err != nil { - return fmt.Errorf("unable to decode inputStoryContentPhoto#3286fbe0: %w", err) - } - case "photo": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentPhoto#3286fbe0: field photo: %w", err) - } - i.Photo = value - case "added_sticker_file_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentPhoto#3286fbe0: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputStoryContentPhoto#3286fbe0: field added_sticker_file_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (i *InputStoryContentPhoto) GetPhoto() (value InputFileClass) { - if i == nil { - return - } - return i.Photo -} - -// GetAddedStickerFileIDs returns value of AddedStickerFileIDs field. -func (i *InputStoryContentPhoto) GetAddedStickerFileIDs() (value []int32) { - if i == nil { - return - } - return i.AddedStickerFileIDs -} - -// InputStoryContentVideo represents TL type `inputStoryContentVideo#cc1e4239`. -type InputStoryContentVideo struct { - // Video to be sent. The video size must be 720x1280. The video must be streamable and - // stored in MPEG4 format, after encoding with H.265 codec and key frames added each - // second - Video InputFileClass - // File identifiers of the stickers added to the video, if applicable - AddedStickerFileIDs []int32 - // Precise duration of the video, in seconds; 0-60 - Duration float64 - // Timestamp of the frame, which will be used as video thumbnail - CoverFrameTimestamp float64 - // True, if the video has no sound - IsAnimation bool -} - -// InputStoryContentVideoTypeID is TL type id of InputStoryContentVideo. -const InputStoryContentVideoTypeID = 0xcc1e4239 - -// construct implements constructor of InputStoryContentClass. -func (i InputStoryContentVideo) construct() InputStoryContentClass { return &i } - -// Ensuring interfaces in compile-time for InputStoryContentVideo. -var ( - _ bin.Encoder = &InputStoryContentVideo{} - _ bin.Decoder = &InputStoryContentVideo{} - _ bin.BareEncoder = &InputStoryContentVideo{} - _ bin.BareDecoder = &InputStoryContentVideo{} - - _ InputStoryContentClass = &InputStoryContentVideo{} -) - -func (i *InputStoryContentVideo) Zero() bool { - if i == nil { - return true - } - if !(i.Video == nil) { - return false - } - if !(i.AddedStickerFileIDs == nil) { - return false - } - if !(i.Duration == 0) { - return false - } - if !(i.CoverFrameTimestamp == 0) { - return false - } - if !(i.IsAnimation == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputStoryContentVideo) String() string { - if i == nil { - return "InputStoryContentVideo(nil)" - } - type Alias InputStoryContentVideo - return fmt.Sprintf("InputStoryContentVideo%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputStoryContentVideo) TypeID() uint32 { - return InputStoryContentVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputStoryContentVideo) TypeName() string { - return "inputStoryContentVideo" -} - -// TypeInfo returns info about TL type. -func (i *InputStoryContentVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputStoryContentVideo", - ID: InputStoryContentVideoTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Video", - SchemaName: "video", - }, - { - Name: "AddedStickerFileIDs", - SchemaName: "added_sticker_file_ids", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "CoverFrameTimestamp", - SchemaName: "cover_frame_timestamp", - }, - { - Name: "IsAnimation", - SchemaName: "is_animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputStoryContentVideo) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryContentVideo#cc1e4239 as nil") - } - b.PutID(InputStoryContentVideoTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputStoryContentVideo) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryContentVideo#cc1e4239 as nil") - } - if i.Video == nil { - return fmt.Errorf("unable to encode inputStoryContentVideo#cc1e4239: field video is nil") - } - if err := i.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputStoryContentVideo#cc1e4239: field video: %w", err) - } - b.PutInt(len(i.AddedStickerFileIDs)) - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - } - b.PutDouble(i.Duration) - b.PutDouble(i.CoverFrameTimestamp) - b.PutBool(i.IsAnimation) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputStoryContentVideo) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryContentVideo#cc1e4239 to nil") - } - if err := b.ConsumeID(InputStoryContentVideoTypeID); err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputStoryContentVideo) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryContentVideo#cc1e4239 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field video: %w", err) - } - i.Video = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field added_sticker_file_ids: %w", err) - } - - if headerLen > 0 { - i.AddedStickerFileIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - } - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field duration: %w", err) - } - i.Duration = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field cover_frame_timestamp: %w", err) - } - i.CoverFrameTimestamp = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field is_animation: %w", err) - } - i.IsAnimation = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputStoryContentVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputStoryContentVideo#cc1e4239 as nil") - } - b.ObjStart() - b.PutID("inputStoryContentVideo") - b.Comma() - b.FieldStart("video") - if i.Video == nil { - return fmt.Errorf("unable to encode inputStoryContentVideo#cc1e4239: field video is nil") - } - if err := i.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputStoryContentVideo#cc1e4239: field video: %w", err) - } - b.Comma() - b.FieldStart("added_sticker_file_ids") - b.ArrStart() - for _, v := range i.AddedStickerFileIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("duration") - b.PutDouble(i.Duration) - b.Comma() - b.FieldStart("cover_frame_timestamp") - b.PutDouble(i.CoverFrameTimestamp) - b.Comma() - b.FieldStart("is_animation") - b.PutBool(i.IsAnimation) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputStoryContentVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputStoryContentVideo#cc1e4239 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputStoryContentVideo"); err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: %w", err) - } - case "video": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field video: %w", err) - } - i.Video = value - case "added_sticker_file_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field added_sticker_file_ids: %w", err) - } - i.AddedStickerFileIDs = append(i.AddedStickerFileIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field added_sticker_file_ids: %w", err) - } - case "duration": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field duration: %w", err) - } - i.Duration = value - case "cover_frame_timestamp": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field cover_frame_timestamp: %w", err) - } - i.CoverFrameTimestamp = value - case "is_animation": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode inputStoryContentVideo#cc1e4239: field is_animation: %w", err) - } - i.IsAnimation = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVideo returns value of Video field. -func (i *InputStoryContentVideo) GetVideo() (value InputFileClass) { - if i == nil { - return - } - return i.Video -} - -// GetAddedStickerFileIDs returns value of AddedStickerFileIDs field. -func (i *InputStoryContentVideo) GetAddedStickerFileIDs() (value []int32) { - if i == nil { - return - } - return i.AddedStickerFileIDs -} - -// GetDuration returns value of Duration field. -func (i *InputStoryContentVideo) GetDuration() (value float64) { - if i == nil { - return - } - return i.Duration -} - -// GetCoverFrameTimestamp returns value of CoverFrameTimestamp field. -func (i *InputStoryContentVideo) GetCoverFrameTimestamp() (value float64) { - if i == nil { - return - } - return i.CoverFrameTimestamp -} - -// GetIsAnimation returns value of IsAnimation field. -func (i *InputStoryContentVideo) GetIsAnimation() (value bool) { - if i == nil { - return - } - return i.IsAnimation -} - -// InputStoryContentClassName is schema name of InputStoryContentClass. -const InputStoryContentClassName = "InputStoryContent" - -// InputStoryContentClass represents InputStoryContent generic type. -// -// Example: -// -// g, err := tdapi.DecodeInputStoryContent(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InputStoryContentPhoto: // inputStoryContentPhoto#3286fbe0 -// case *tdapi.InputStoryContentVideo: // inputStoryContentVideo#cc1e4239 -// default: panic(v) -// } -type InputStoryContentClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InputStoryContentClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error - - // File identifiers of the stickers added to the photo, if applicable - GetAddedStickerFileIDs() (value []int32) -} - -// DecodeInputStoryContent implements binary de-serialization for InputStoryContentClass. -func DecodeInputStoryContent(buf *bin.Buffer) (InputStoryContentClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InputStoryContentPhotoTypeID: - // Decoding inputStoryContentPhoto#3286fbe0. - v := InputStoryContentPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryContentClass: %w", err) - } - return &v, nil - case InputStoryContentVideoTypeID: - // Decoding inputStoryContentVideo#cc1e4239. - v := InputStoryContentVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryContentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputStoryContentClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInputStoryContent implements binary de-serialization for InputStoryContentClass. -func DecodeTDLibJSONInputStoryContent(buf tdjson.Decoder) (InputStoryContentClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inputStoryContentPhoto": - // Decoding inputStoryContentPhoto#3286fbe0. - v := InputStoryContentPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryContentClass: %w", err) - } - return &v, nil - case "inputStoryContentVideo": - // Decoding inputStoryContentVideo#cc1e4239. - v := InputStoryContentVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InputStoryContentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InputStoryContentClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InputStoryContent boxes the InputStoryContentClass providing a helper. -type InputStoryContentBox struct { - InputStoryContent InputStoryContentClass -} - -// Decode implements bin.Decoder for InputStoryContentBox. -func (b *InputStoryContentBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InputStoryContentBox to nil") - } - v, err := DecodeInputStoryContent(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputStoryContent = v - return nil -} - -// Encode implements bin.Encode for InputStoryContentBox. -func (b *InputStoryContentBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InputStoryContent == nil { - return fmt.Errorf("unable to encode InputStoryContentClass as nil") - } - return b.InputStoryContent.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InputStoryContentBox. -func (b *InputStoryContentBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InputStoryContentBox to nil") - } - v, err := DecodeTDLibJSONInputStoryContent(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InputStoryContent = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InputStoryContentBox. -func (b *InputStoryContentBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InputStoryContent == nil { - return fmt.Errorf("unable to encode InputStoryContentClass as nil") - } - return b.InputStoryContent.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_input_text_quote_gen.go b/tdapi/tl_input_text_quote_gen.go deleted file mode 100644 index 109b32dce..000000000 --- a/tdapi/tl_input_text_quote_gen.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputTextQuote represents TL type `inputTextQuote#b74a6d1c`. -type InputTextQuote struct { - // Text of the quote; 0-getOption("message_reply_quote_length_max") characters. Only Bold - // Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be - // kept and must be kept in the quote - Text FormattedText - // Quote position in the original message in UTF-16 code units - Position int32 -} - -// InputTextQuoteTypeID is TL type id of InputTextQuote. -const InputTextQuoteTypeID = 0xb74a6d1c - -// Ensuring interfaces in compile-time for InputTextQuote. -var ( - _ bin.Encoder = &InputTextQuote{} - _ bin.Decoder = &InputTextQuote{} - _ bin.BareEncoder = &InputTextQuote{} - _ bin.BareDecoder = &InputTextQuote{} -) - -func (i *InputTextQuote) Zero() bool { - if i == nil { - return true - } - if !(i.Text.Zero()) { - return false - } - if !(i.Position == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputTextQuote) String() string { - if i == nil { - return "InputTextQuote(nil)" - } - type Alias InputTextQuote - return fmt.Sprintf("InputTextQuote%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputTextQuote) TypeID() uint32 { - return InputTextQuoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputTextQuote) TypeName() string { - return "inputTextQuote" -} - -// TypeInfo returns info about TL type. -func (i *InputTextQuote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputTextQuote", - ID: InputTextQuoteTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Position", - SchemaName: "position", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputTextQuote) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputTextQuote#b74a6d1c as nil") - } - b.PutID(InputTextQuoteTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputTextQuote) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputTextQuote#b74a6d1c as nil") - } - if err := i.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputTextQuote#b74a6d1c: field text: %w", err) - } - b.PutInt32(i.Position) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputTextQuote) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputTextQuote#b74a6d1c to nil") - } - if err := b.ConsumeID(InputTextQuoteTypeID); err != nil { - return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputTextQuote) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputTextQuote#b74a6d1c to nil") - } - { - if err := i.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: field text: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: field position: %w", err) - } - i.Position = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputTextQuote) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputTextQuote#b74a6d1c as nil") - } - b.ObjStart() - b.PutID("inputTextQuote") - b.Comma() - b.FieldStart("text") - if err := i.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputTextQuote#b74a6d1c: field text: %w", err) - } - b.Comma() - b.FieldStart("position") - b.PutInt32(i.Position) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputTextQuote) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputTextQuote#b74a6d1c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputTextQuote"); err != nil { - return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: %w", err) - } - case "text": - if err := i.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: field text: %w", err) - } - case "position": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputTextQuote#b74a6d1c: field position: %w", err) - } - i.Position = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (i *InputTextQuote) GetText() (value FormattedText) { - if i == nil { - return - } - return i.Text -} - -// GetPosition returns value of Position field. -func (i *InputTextQuote) GetPosition() (value int32) { - if i == nil { - return - } - return i.Position -} diff --git a/tdapi/tl_input_thumbnail_gen.go b/tdapi/tl_input_thumbnail_gen.go deleted file mode 100644 index ff564dd16..000000000 --- a/tdapi/tl_input_thumbnail_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InputThumbnail represents TL type `inputThumbnail#5e515024`. -type InputThumbnail struct { - // Thumbnail file to send. Sending thumbnails by file_id is currently not supported - Thumbnail InputFileClass - // Thumbnail width, usually shouldn't exceed 320. Use 0 if unknown - Width int32 - // Thumbnail height, usually shouldn't exceed 320. Use 0 if unknown - Height int32 -} - -// InputThumbnailTypeID is TL type id of InputThumbnail. -const InputThumbnailTypeID = 0x5e515024 - -// Ensuring interfaces in compile-time for InputThumbnail. -var ( - _ bin.Encoder = &InputThumbnail{} - _ bin.Decoder = &InputThumbnail{} - _ bin.BareEncoder = &InputThumbnail{} - _ bin.BareDecoder = &InputThumbnail{} -) - -func (i *InputThumbnail) Zero() bool { - if i == nil { - return true - } - if !(i.Thumbnail == nil) { - return false - } - if !(i.Width == 0) { - return false - } - if !(i.Height == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InputThumbnail) String() string { - if i == nil { - return "InputThumbnail(nil)" - } - type Alias InputThumbnail - return fmt.Sprintf("InputThumbnail%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InputThumbnail) TypeID() uint32 { - return InputThumbnailTypeID -} - -// TypeName returns name of type in TL schema. -func (*InputThumbnail) TypeName() string { - return "inputThumbnail" -} - -// TypeInfo returns info about TL type. -func (i *InputThumbnail) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inputThumbnail", - ID: InputThumbnailTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InputThumbnail) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputThumbnail#5e515024 as nil") - } - b.PutID(InputThumbnailTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InputThumbnail) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inputThumbnail#5e515024 as nil") - } - if i.Thumbnail == nil { - return fmt.Errorf("unable to encode inputThumbnail#5e515024: field thumbnail is nil") - } - if err := i.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode inputThumbnail#5e515024: field thumbnail: %w", err) - } - b.PutInt32(i.Width) - b.PutInt32(i.Height) - return nil -} - -// Decode implements bin.Decoder. -func (i *InputThumbnail) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputThumbnail#5e515024 to nil") - } - if err := b.ConsumeID(InputThumbnailTypeID); err != nil { - return fmt.Errorf("unable to decode inputThumbnail#5e515024: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InputThumbnail) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inputThumbnail#5e515024 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputThumbnail#5e515024: field thumbnail: %w", err) - } - i.Thumbnail = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputThumbnail#5e515024: field width: %w", err) - } - i.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputThumbnail#5e515024: field height: %w", err) - } - i.Height = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InputThumbnail) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inputThumbnail#5e515024 as nil") - } - b.ObjStart() - b.PutID("inputThumbnail") - b.Comma() - b.FieldStart("thumbnail") - if i.Thumbnail == nil { - return fmt.Errorf("unable to encode inputThumbnail#5e515024: field thumbnail is nil") - } - if err := i.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode inputThumbnail#5e515024: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("width") - b.PutInt32(i.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(i.Height) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InputThumbnail) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inputThumbnail#5e515024 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inputThumbnail"); err != nil { - return fmt.Errorf("unable to decode inputThumbnail#5e515024: %w", err) - } - case "thumbnail": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode inputThumbnail#5e515024: field thumbnail: %w", err) - } - i.Thumbnail = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputThumbnail#5e515024: field width: %w", err) - } - i.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inputThumbnail#5e515024: field height: %w", err) - } - i.Height = value - default: - return b.Skip() - } - return nil - }) -} - -// GetThumbnail returns value of Thumbnail field. -func (i *InputThumbnail) GetThumbnail() (value InputFileClass) { - if i == nil { - return - } - return i.Thumbnail -} - -// GetWidth returns value of Width field. -func (i *InputThumbnail) GetWidth() (value int32) { - if i == nil { - return - } - return i.Width -} - -// GetHeight returns value of Height field. -func (i *InputThumbnail) GetHeight() (value int32) { - if i == nil { - return - } - return i.Height -} diff --git a/tdapi/tl_int32_gen.go b/tdapi/tl_int32_gen.go deleted file mode 100644 index 2cab9725d..000000000 --- a/tdapi/tl_int32_gen.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Int32 represents TL type `int32#5cb934fa`. -type Int32 struct { -} - -// Int32TypeID is TL type id of Int32. -const Int32TypeID = 0x5cb934fa - -// Ensuring interfaces in compile-time for Int32. -var ( - _ bin.Encoder = &Int32{} - _ bin.Decoder = &Int32{} - _ bin.BareEncoder = &Int32{} - _ bin.BareDecoder = &Int32{} -) - -func (i *Int32) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *Int32) String() string { - if i == nil { - return "Int32(nil)" - } - type Alias Int32 - return fmt.Sprintf("Int32%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Int32) TypeID() uint32 { - return Int32TypeID -} - -// TypeName returns name of type in TL schema. -func (*Int32) TypeName() string { - return "int32" -} - -// TypeInfo returns info about TL type. -func (i *Int32) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "int32", - ID: Int32TypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *Int32) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode int32#5cb934fa as nil") - } - b.PutID(Int32TypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *Int32) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode int32#5cb934fa as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *Int32) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode int32#5cb934fa to nil") - } - if err := b.ConsumeID(Int32TypeID); err != nil { - return fmt.Errorf("unable to decode int32#5cb934fa: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *Int32) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode int32#5cb934fa to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *Int32) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode int32#5cb934fa as nil") - } - b.ObjStart() - b.PutID("int32") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *Int32) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode int32#5cb934fa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("int32"); err != nil { - return fmt.Errorf("unable to decode int32#5cb934fa: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} diff --git a/tdapi/tl_int53_gen.go b/tdapi/tl_int53_gen.go deleted file mode 100644 index e83b646f7..000000000 --- a/tdapi/tl_int53_gen.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Int53 represents TL type `int53#6781c7ee`. -type Int53 struct { -} - -// Int53TypeID is TL type id of Int53. -const Int53TypeID = 0x6781c7ee - -// Ensuring interfaces in compile-time for Int53. -var ( - _ bin.Encoder = &Int53{} - _ bin.Decoder = &Int53{} - _ bin.BareEncoder = &Int53{} - _ bin.BareDecoder = &Int53{} -) - -func (i *Int53) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *Int53) String() string { - if i == nil { - return "Int53(nil)" - } - type Alias Int53 - return fmt.Sprintf("Int53%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Int53) TypeID() uint32 { - return Int53TypeID -} - -// TypeName returns name of type in TL schema. -func (*Int53) TypeName() string { - return "int53" -} - -// TypeInfo returns info about TL type. -func (i *Int53) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "int53", - ID: Int53TypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *Int53) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode int53#6781c7ee as nil") - } - b.PutID(Int53TypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *Int53) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode int53#6781c7ee as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *Int53) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode int53#6781c7ee to nil") - } - if err := b.ConsumeID(Int53TypeID); err != nil { - return fmt.Errorf("unable to decode int53#6781c7ee: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *Int53) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode int53#6781c7ee to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *Int53) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode int53#6781c7ee as nil") - } - b.ObjStart() - b.PutID("int53") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *Int53) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode int53#6781c7ee to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("int53"); err != nil { - return fmt.Errorf("unable to decode int53#6781c7ee: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} diff --git a/tdapi/tl_int64_gen.go b/tdapi/tl_int64_gen.go deleted file mode 100644 index 1a04c1b9a..000000000 --- a/tdapi/tl_int64_gen.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Int64 represents TL type `int64#5d9ed744`. -type Int64 struct { -} - -// Int64TypeID is TL type id of Int64. -const Int64TypeID = 0x5d9ed744 - -// Ensuring interfaces in compile-time for Int64. -var ( - _ bin.Encoder = &Int64{} - _ bin.Decoder = &Int64{} - _ bin.BareEncoder = &Int64{} - _ bin.BareDecoder = &Int64{} -) - -func (i *Int64) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *Int64) String() string { - if i == nil { - return "Int64(nil)" - } - type Alias Int64 - return fmt.Sprintf("Int64%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Int64) TypeID() uint32 { - return Int64TypeID -} - -// TypeName returns name of type in TL schema. -func (*Int64) TypeName() string { - return "int64" -} - -// TypeInfo returns info about TL type. -func (i *Int64) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "int64", - ID: Int64TypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *Int64) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode int64#5d9ed744 as nil") - } - b.PutID(Int64TypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *Int64) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode int64#5d9ed744 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *Int64) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode int64#5d9ed744 to nil") - } - if err := b.ConsumeID(Int64TypeID); err != nil { - return fmt.Errorf("unable to decode int64#5d9ed744: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *Int64) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode int64#5d9ed744 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *Int64) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode int64#5d9ed744 as nil") - } - b.ObjStart() - b.PutID("int64") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *Int64) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode int64#5d9ed744 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("int64"); err != nil { - return fmt.Errorf("unable to decode int64#5d9ed744: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} diff --git a/tdapi/tl_internal_link_type_gen.go b/tdapi/tl_internal_link_type_gen.go deleted file mode 100644 index 2d098517b..000000000 --- a/tdapi/tl_internal_link_type_gen.go +++ /dev/null @@ -1,9184 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InternalLinkTypeActiveSessions represents TL type `internalLinkTypeActiveSessions#706bbbad`. -type InternalLinkTypeActiveSessions struct { -} - -// InternalLinkTypeActiveSessionsTypeID is TL type id of InternalLinkTypeActiveSessions. -const InternalLinkTypeActiveSessionsTypeID = 0x706bbbad - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeActiveSessions) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeActiveSessions. -var ( - _ bin.Encoder = &InternalLinkTypeActiveSessions{} - _ bin.Decoder = &InternalLinkTypeActiveSessions{} - _ bin.BareEncoder = &InternalLinkTypeActiveSessions{} - _ bin.BareDecoder = &InternalLinkTypeActiveSessions{} - - _ InternalLinkTypeClass = &InternalLinkTypeActiveSessions{} -) - -func (i *InternalLinkTypeActiveSessions) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeActiveSessions) String() string { - if i == nil { - return "InternalLinkTypeActiveSessions(nil)" - } - type Alias InternalLinkTypeActiveSessions - return fmt.Sprintf("InternalLinkTypeActiveSessions%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeActiveSessions) TypeID() uint32 { - return InternalLinkTypeActiveSessionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeActiveSessions) TypeName() string { - return "internalLinkTypeActiveSessions" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeActiveSessions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeActiveSessions", - ID: InternalLinkTypeActiveSessionsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeActiveSessions) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeActiveSessions#706bbbad as nil") - } - b.PutID(InternalLinkTypeActiveSessionsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeActiveSessions) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeActiveSessions#706bbbad as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeActiveSessions) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeActiveSessions#706bbbad to nil") - } - if err := b.ConsumeID(InternalLinkTypeActiveSessionsTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeActiveSessions#706bbbad: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeActiveSessions) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeActiveSessions#706bbbad to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeActiveSessions) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeActiveSessions#706bbbad as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeActiveSessions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeActiveSessions) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeActiveSessions#706bbbad to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeActiveSessions"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeActiveSessions#706bbbad: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeAttachmentMenuBot represents TL type `internalLinkTypeAttachmentMenuBot#644c4225`. -type InternalLinkTypeAttachmentMenuBot struct { - // Target chat to be opened - TargetChat TargetChatClass - // Username of the bot - BotUsername string - // URL to be passed to openWebApp - URL string -} - -// InternalLinkTypeAttachmentMenuBotTypeID is TL type id of InternalLinkTypeAttachmentMenuBot. -const InternalLinkTypeAttachmentMenuBotTypeID = 0x644c4225 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeAttachmentMenuBot) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeAttachmentMenuBot. -var ( - _ bin.Encoder = &InternalLinkTypeAttachmentMenuBot{} - _ bin.Decoder = &InternalLinkTypeAttachmentMenuBot{} - _ bin.BareEncoder = &InternalLinkTypeAttachmentMenuBot{} - _ bin.BareDecoder = &InternalLinkTypeAttachmentMenuBot{} - - _ InternalLinkTypeClass = &InternalLinkTypeAttachmentMenuBot{} -) - -func (i *InternalLinkTypeAttachmentMenuBot) Zero() bool { - if i == nil { - return true - } - if !(i.TargetChat == nil) { - return false - } - if !(i.BotUsername == "") { - return false - } - if !(i.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeAttachmentMenuBot) String() string { - if i == nil { - return "InternalLinkTypeAttachmentMenuBot(nil)" - } - type Alias InternalLinkTypeAttachmentMenuBot - return fmt.Sprintf("InternalLinkTypeAttachmentMenuBot%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeAttachmentMenuBot) TypeID() uint32 { - return InternalLinkTypeAttachmentMenuBotTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeAttachmentMenuBot) TypeName() string { - return "internalLinkTypeAttachmentMenuBot" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeAttachmentMenuBot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeAttachmentMenuBot", - ID: InternalLinkTypeAttachmentMenuBotTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TargetChat", - SchemaName: "target_chat", - }, - { - Name: "BotUsername", - SchemaName: "bot_username", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeAttachmentMenuBot) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeAttachmentMenuBot#644c4225 as nil") - } - b.PutID(InternalLinkTypeAttachmentMenuBotTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeAttachmentMenuBot) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeAttachmentMenuBot#644c4225 as nil") - } - if i.TargetChat == nil { - return fmt.Errorf("unable to encode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat is nil") - } - if err := i.TargetChat.Encode(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat: %w", err) - } - b.PutString(i.BotUsername) - b.PutString(i.URL) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeAttachmentMenuBot) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeAttachmentMenuBot#644c4225 to nil") - } - if err := b.ConsumeID(InternalLinkTypeAttachmentMenuBotTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeAttachmentMenuBot) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeAttachmentMenuBot#644c4225 to nil") - } - { - value, err := DecodeTargetChat(b) - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat: %w", err) - } - i.TargetChat = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field bot_username: %w", err) - } - i.BotUsername = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field url: %w", err) - } - i.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeAttachmentMenuBot) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeAttachmentMenuBot#644c4225 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeAttachmentMenuBot") - b.Comma() - b.FieldStart("target_chat") - if i.TargetChat == nil { - return fmt.Errorf("unable to encode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat is nil") - } - if err := i.TargetChat.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat: %w", err) - } - b.Comma() - b.FieldStart("bot_username") - b.PutString(i.BotUsername) - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeAttachmentMenuBot) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeAttachmentMenuBot#644c4225 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeAttachmentMenuBot"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: %w", err) - } - case "target_chat": - value, err := DecodeTDLibJSONTargetChat(b) - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field target_chat: %w", err) - } - i.TargetChat = value - case "bot_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field bot_username: %w", err) - } - i.BotUsername = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAttachmentMenuBot#644c4225: field url: %w", err) - } - i.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTargetChat returns value of TargetChat field. -func (i *InternalLinkTypeAttachmentMenuBot) GetTargetChat() (value TargetChatClass) { - if i == nil { - return - } - return i.TargetChat -} - -// GetBotUsername returns value of BotUsername field. -func (i *InternalLinkTypeAttachmentMenuBot) GetBotUsername() (value string) { - if i == nil { - return - } - return i.BotUsername -} - -// GetURL returns value of URL field. -func (i *InternalLinkTypeAttachmentMenuBot) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// InternalLinkTypeAuthenticationCode represents TL type `internalLinkTypeAuthenticationCode#f3874ff2`. -type InternalLinkTypeAuthenticationCode struct { - // The authentication code - Code string -} - -// InternalLinkTypeAuthenticationCodeTypeID is TL type id of InternalLinkTypeAuthenticationCode. -const InternalLinkTypeAuthenticationCodeTypeID = 0xf3874ff2 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeAuthenticationCode) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeAuthenticationCode. -var ( - _ bin.Encoder = &InternalLinkTypeAuthenticationCode{} - _ bin.Decoder = &InternalLinkTypeAuthenticationCode{} - _ bin.BareEncoder = &InternalLinkTypeAuthenticationCode{} - _ bin.BareDecoder = &InternalLinkTypeAuthenticationCode{} - - _ InternalLinkTypeClass = &InternalLinkTypeAuthenticationCode{} -) - -func (i *InternalLinkTypeAuthenticationCode) Zero() bool { - if i == nil { - return true - } - if !(i.Code == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeAuthenticationCode) String() string { - if i == nil { - return "InternalLinkTypeAuthenticationCode(nil)" - } - type Alias InternalLinkTypeAuthenticationCode - return fmt.Sprintf("InternalLinkTypeAuthenticationCode%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeAuthenticationCode) TypeID() uint32 { - return InternalLinkTypeAuthenticationCodeTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeAuthenticationCode) TypeName() string { - return "internalLinkTypeAuthenticationCode" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeAuthenticationCode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeAuthenticationCode", - ID: InternalLinkTypeAuthenticationCodeTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeAuthenticationCode) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeAuthenticationCode#f3874ff2 as nil") - } - b.PutID(InternalLinkTypeAuthenticationCodeTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeAuthenticationCode) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeAuthenticationCode#f3874ff2 as nil") - } - b.PutString(i.Code) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeAuthenticationCode) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeAuthenticationCode#f3874ff2 to nil") - } - if err := b.ConsumeID(InternalLinkTypeAuthenticationCodeTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAuthenticationCode#f3874ff2: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeAuthenticationCode) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeAuthenticationCode#f3874ff2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAuthenticationCode#f3874ff2: field code: %w", err) - } - i.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeAuthenticationCode) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeAuthenticationCode#f3874ff2 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeAuthenticationCode") - b.Comma() - b.FieldStart("code") - b.PutString(i.Code) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeAuthenticationCode) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeAuthenticationCode#f3874ff2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeAuthenticationCode"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAuthenticationCode#f3874ff2: %w", err) - } - case "code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeAuthenticationCode#f3874ff2: field code: %w", err) - } - i.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (i *InternalLinkTypeAuthenticationCode) GetCode() (value string) { - if i == nil { - return - } - return i.Code -} - -// InternalLinkTypeBackground represents TL type `internalLinkTypeBackground#b0d2908`. -type InternalLinkTypeBackground struct { - // Name of the background - BackgroundName string -} - -// InternalLinkTypeBackgroundTypeID is TL type id of InternalLinkTypeBackground. -const InternalLinkTypeBackgroundTypeID = 0xb0d2908 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeBackground) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeBackground. -var ( - _ bin.Encoder = &InternalLinkTypeBackground{} - _ bin.Decoder = &InternalLinkTypeBackground{} - _ bin.BareEncoder = &InternalLinkTypeBackground{} - _ bin.BareDecoder = &InternalLinkTypeBackground{} - - _ InternalLinkTypeClass = &InternalLinkTypeBackground{} -) - -func (i *InternalLinkTypeBackground) Zero() bool { - if i == nil { - return true - } - if !(i.BackgroundName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeBackground) String() string { - if i == nil { - return "InternalLinkTypeBackground(nil)" - } - type Alias InternalLinkTypeBackground - return fmt.Sprintf("InternalLinkTypeBackground%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeBackground) TypeID() uint32 { - return InternalLinkTypeBackgroundTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeBackground) TypeName() string { - return "internalLinkTypeBackground" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeBackground) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeBackground", - ID: InternalLinkTypeBackgroundTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BackgroundName", - SchemaName: "background_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeBackground) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBackground#b0d2908 as nil") - } - b.PutID(InternalLinkTypeBackgroundTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeBackground) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBackground#b0d2908 as nil") - } - b.PutString(i.BackgroundName) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeBackground) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBackground#b0d2908 to nil") - } - if err := b.ConsumeID(InternalLinkTypeBackgroundTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBackground#b0d2908: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeBackground) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBackground#b0d2908 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBackground#b0d2908: field background_name: %w", err) - } - i.BackgroundName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeBackground) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBackground#b0d2908 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeBackground") - b.Comma() - b.FieldStart("background_name") - b.PutString(i.BackgroundName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeBackground) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBackground#b0d2908 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeBackground"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBackground#b0d2908: %w", err) - } - case "background_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBackground#b0d2908: field background_name: %w", err) - } - i.BackgroundName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBackgroundName returns value of BackgroundName field. -func (i *InternalLinkTypeBackground) GetBackgroundName() (value string) { - if i == nil { - return - } - return i.BackgroundName -} - -// InternalLinkTypeBotAddToChannel represents TL type `internalLinkTypeBotAddToChannel#538ac2c0`. -type InternalLinkTypeBotAddToChannel struct { - // Username of the bot - BotUsername string - // Expected administrator rights for the bot - AdministratorRights ChatAdministratorRights -} - -// InternalLinkTypeBotAddToChannelTypeID is TL type id of InternalLinkTypeBotAddToChannel. -const InternalLinkTypeBotAddToChannelTypeID = 0x538ac2c0 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeBotAddToChannel) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeBotAddToChannel. -var ( - _ bin.Encoder = &InternalLinkTypeBotAddToChannel{} - _ bin.Decoder = &InternalLinkTypeBotAddToChannel{} - _ bin.BareEncoder = &InternalLinkTypeBotAddToChannel{} - _ bin.BareDecoder = &InternalLinkTypeBotAddToChannel{} - - _ InternalLinkTypeClass = &InternalLinkTypeBotAddToChannel{} -) - -func (i *InternalLinkTypeBotAddToChannel) Zero() bool { - if i == nil { - return true - } - if !(i.BotUsername == "") { - return false - } - if !(i.AdministratorRights.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeBotAddToChannel) String() string { - if i == nil { - return "InternalLinkTypeBotAddToChannel(nil)" - } - type Alias InternalLinkTypeBotAddToChannel - return fmt.Sprintf("InternalLinkTypeBotAddToChannel%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeBotAddToChannel) TypeID() uint32 { - return InternalLinkTypeBotAddToChannelTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeBotAddToChannel) TypeName() string { - return "internalLinkTypeBotAddToChannel" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeBotAddToChannel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeBotAddToChannel", - ID: InternalLinkTypeBotAddToChannelTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUsername", - SchemaName: "bot_username", - }, - { - Name: "AdministratorRights", - SchemaName: "administrator_rights", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeBotAddToChannel) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBotAddToChannel#538ac2c0 as nil") - } - b.PutID(InternalLinkTypeBotAddToChannelTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeBotAddToChannel) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBotAddToChannel#538ac2c0 as nil") - } - b.PutString(i.BotUsername) - if err := i.AdministratorRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeBotAddToChannel#538ac2c0: field administrator_rights: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeBotAddToChannel) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBotAddToChannel#538ac2c0 to nil") - } - if err := b.ConsumeID(InternalLinkTypeBotAddToChannelTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeBotAddToChannel) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBotAddToChannel#538ac2c0 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: field bot_username: %w", err) - } - i.BotUsername = value - } - { - if err := i.AdministratorRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: field administrator_rights: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeBotAddToChannel) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBotAddToChannel#538ac2c0 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeBotAddToChannel") - b.Comma() - b.FieldStart("bot_username") - b.PutString(i.BotUsername) - b.Comma() - b.FieldStart("administrator_rights") - if err := i.AdministratorRights.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeBotAddToChannel#538ac2c0: field administrator_rights: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeBotAddToChannel) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBotAddToChannel#538ac2c0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeBotAddToChannel"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: %w", err) - } - case "bot_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: field bot_username: %w", err) - } - i.BotUsername = value - case "administrator_rights": - if err := i.AdministratorRights.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotAddToChannel#538ac2c0: field administrator_rights: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUsername returns value of BotUsername field. -func (i *InternalLinkTypeBotAddToChannel) GetBotUsername() (value string) { - if i == nil { - return - } - return i.BotUsername -} - -// GetAdministratorRights returns value of AdministratorRights field. -func (i *InternalLinkTypeBotAddToChannel) GetAdministratorRights() (value ChatAdministratorRights) { - if i == nil { - return - } - return i.AdministratorRights -} - -// InternalLinkTypeBotStart represents TL type `internalLinkTypeBotStart#3f985fed`. -type InternalLinkTypeBotStart struct { - // Username of the bot - BotUsername string - // The parameter to be passed to sendBotStartMessage - StartParameter string - // True, if sendBotStartMessage must be called automatically without showing the START - // button - Autostart bool -} - -// InternalLinkTypeBotStartTypeID is TL type id of InternalLinkTypeBotStart. -const InternalLinkTypeBotStartTypeID = 0x3f985fed - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeBotStart) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeBotStart. -var ( - _ bin.Encoder = &InternalLinkTypeBotStart{} - _ bin.Decoder = &InternalLinkTypeBotStart{} - _ bin.BareEncoder = &InternalLinkTypeBotStart{} - _ bin.BareDecoder = &InternalLinkTypeBotStart{} - - _ InternalLinkTypeClass = &InternalLinkTypeBotStart{} -) - -func (i *InternalLinkTypeBotStart) Zero() bool { - if i == nil { - return true - } - if !(i.BotUsername == "") { - return false - } - if !(i.StartParameter == "") { - return false - } - if !(i.Autostart == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeBotStart) String() string { - if i == nil { - return "InternalLinkTypeBotStart(nil)" - } - type Alias InternalLinkTypeBotStart - return fmt.Sprintf("InternalLinkTypeBotStart%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeBotStart) TypeID() uint32 { - return InternalLinkTypeBotStartTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeBotStart) TypeName() string { - return "internalLinkTypeBotStart" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeBotStart) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeBotStart", - ID: InternalLinkTypeBotStartTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUsername", - SchemaName: "bot_username", - }, - { - Name: "StartParameter", - SchemaName: "start_parameter", - }, - { - Name: "Autostart", - SchemaName: "autostart", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeBotStart) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBotStart#3f985fed as nil") - } - b.PutID(InternalLinkTypeBotStartTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeBotStart) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBotStart#3f985fed as nil") - } - b.PutString(i.BotUsername) - b.PutString(i.StartParameter) - b.PutBool(i.Autostart) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeBotStart) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBotStart#3f985fed to nil") - } - if err := b.ConsumeID(InternalLinkTypeBotStartTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeBotStart) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBotStart#3f985fed to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field bot_username: %w", err) - } - i.BotUsername = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field start_parameter: %w", err) - } - i.StartParameter = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field autostart: %w", err) - } - i.Autostart = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeBotStart) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBotStart#3f985fed as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeBotStart") - b.Comma() - b.FieldStart("bot_username") - b.PutString(i.BotUsername) - b.Comma() - b.FieldStart("start_parameter") - b.PutString(i.StartParameter) - b.Comma() - b.FieldStart("autostart") - b.PutBool(i.Autostart) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeBotStart) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBotStart#3f985fed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeBotStart"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: %w", err) - } - case "bot_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field bot_username: %w", err) - } - i.BotUsername = value - case "start_parameter": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field start_parameter: %w", err) - } - i.StartParameter = value - case "autostart": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStart#3f985fed: field autostart: %w", err) - } - i.Autostart = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUsername returns value of BotUsername field. -func (i *InternalLinkTypeBotStart) GetBotUsername() (value string) { - if i == nil { - return - } - return i.BotUsername -} - -// GetStartParameter returns value of StartParameter field. -func (i *InternalLinkTypeBotStart) GetStartParameter() (value string) { - if i == nil { - return - } - return i.StartParameter -} - -// GetAutostart returns value of Autostart field. -func (i *InternalLinkTypeBotStart) GetAutostart() (value bool) { - if i == nil { - return - } - return i.Autostart -} - -// InternalLinkTypeBotStartInGroup represents TL type `internalLinkTypeBotStartInGroup#ca0d8cce`. -type InternalLinkTypeBotStartInGroup struct { - // Username of the bot - BotUsername string - // The parameter to be passed to sendBotStartMessage - StartParameter string - // Expected administrator rights for the bot; may be null - AdministratorRights ChatAdministratorRights -} - -// InternalLinkTypeBotStartInGroupTypeID is TL type id of InternalLinkTypeBotStartInGroup. -const InternalLinkTypeBotStartInGroupTypeID = 0xca0d8cce - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeBotStartInGroup) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeBotStartInGroup. -var ( - _ bin.Encoder = &InternalLinkTypeBotStartInGroup{} - _ bin.Decoder = &InternalLinkTypeBotStartInGroup{} - _ bin.BareEncoder = &InternalLinkTypeBotStartInGroup{} - _ bin.BareDecoder = &InternalLinkTypeBotStartInGroup{} - - _ InternalLinkTypeClass = &InternalLinkTypeBotStartInGroup{} -) - -func (i *InternalLinkTypeBotStartInGroup) Zero() bool { - if i == nil { - return true - } - if !(i.BotUsername == "") { - return false - } - if !(i.StartParameter == "") { - return false - } - if !(i.AdministratorRights.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeBotStartInGroup) String() string { - if i == nil { - return "InternalLinkTypeBotStartInGroup(nil)" - } - type Alias InternalLinkTypeBotStartInGroup - return fmt.Sprintf("InternalLinkTypeBotStartInGroup%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeBotStartInGroup) TypeID() uint32 { - return InternalLinkTypeBotStartInGroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeBotStartInGroup) TypeName() string { - return "internalLinkTypeBotStartInGroup" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeBotStartInGroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeBotStartInGroup", - ID: InternalLinkTypeBotStartInGroupTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUsername", - SchemaName: "bot_username", - }, - { - Name: "StartParameter", - SchemaName: "start_parameter", - }, - { - Name: "AdministratorRights", - SchemaName: "administrator_rights", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeBotStartInGroup) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBotStartInGroup#ca0d8cce as nil") - } - b.PutID(InternalLinkTypeBotStartInGroupTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeBotStartInGroup) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBotStartInGroup#ca0d8cce as nil") - } - b.PutString(i.BotUsername) - b.PutString(i.StartParameter) - if err := i.AdministratorRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeBotStartInGroup#ca0d8cce: field administrator_rights: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeBotStartInGroup) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBotStartInGroup#ca0d8cce to nil") - } - if err := b.ConsumeID(InternalLinkTypeBotStartInGroupTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeBotStartInGroup) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBotStartInGroup#ca0d8cce to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field bot_username: %w", err) - } - i.BotUsername = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field start_parameter: %w", err) - } - i.StartParameter = value - } - { - if err := i.AdministratorRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field administrator_rights: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeBotStartInGroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBotStartInGroup#ca0d8cce as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeBotStartInGroup") - b.Comma() - b.FieldStart("bot_username") - b.PutString(i.BotUsername) - b.Comma() - b.FieldStart("start_parameter") - b.PutString(i.StartParameter) - b.Comma() - b.FieldStart("administrator_rights") - if err := i.AdministratorRights.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeBotStartInGroup#ca0d8cce: field administrator_rights: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeBotStartInGroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBotStartInGroup#ca0d8cce to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeBotStartInGroup"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: %w", err) - } - case "bot_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field bot_username: %w", err) - } - i.BotUsername = value - case "start_parameter": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field start_parameter: %w", err) - } - i.StartParameter = value - case "administrator_rights": - if err := i.AdministratorRights.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBotStartInGroup#ca0d8cce: field administrator_rights: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUsername returns value of BotUsername field. -func (i *InternalLinkTypeBotStartInGroup) GetBotUsername() (value string) { - if i == nil { - return - } - return i.BotUsername -} - -// GetStartParameter returns value of StartParameter field. -func (i *InternalLinkTypeBotStartInGroup) GetStartParameter() (value string) { - if i == nil { - return - } - return i.StartParameter -} - -// GetAdministratorRights returns value of AdministratorRights field. -func (i *InternalLinkTypeBotStartInGroup) GetAdministratorRights() (value ChatAdministratorRights) { - if i == nil { - return - } - return i.AdministratorRights -} - -// InternalLinkTypeBusinessChat represents TL type `internalLinkTypeBusinessChat#a03ae9d7`. -type InternalLinkTypeBusinessChat struct { - // Name of the link - LinkName string -} - -// InternalLinkTypeBusinessChatTypeID is TL type id of InternalLinkTypeBusinessChat. -const InternalLinkTypeBusinessChatTypeID = 0xa03ae9d7 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeBusinessChat) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeBusinessChat. -var ( - _ bin.Encoder = &InternalLinkTypeBusinessChat{} - _ bin.Decoder = &InternalLinkTypeBusinessChat{} - _ bin.BareEncoder = &InternalLinkTypeBusinessChat{} - _ bin.BareDecoder = &InternalLinkTypeBusinessChat{} - - _ InternalLinkTypeClass = &InternalLinkTypeBusinessChat{} -) - -func (i *InternalLinkTypeBusinessChat) Zero() bool { - if i == nil { - return true - } - if !(i.LinkName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeBusinessChat) String() string { - if i == nil { - return "InternalLinkTypeBusinessChat(nil)" - } - type Alias InternalLinkTypeBusinessChat - return fmt.Sprintf("InternalLinkTypeBusinessChat%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeBusinessChat) TypeID() uint32 { - return InternalLinkTypeBusinessChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeBusinessChat) TypeName() string { - return "internalLinkTypeBusinessChat" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeBusinessChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeBusinessChat", - ID: InternalLinkTypeBusinessChatTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LinkName", - SchemaName: "link_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeBusinessChat) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBusinessChat#a03ae9d7 as nil") - } - b.PutID(InternalLinkTypeBusinessChatTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeBusinessChat) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBusinessChat#a03ae9d7 as nil") - } - b.PutString(i.LinkName) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeBusinessChat) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBusinessChat#a03ae9d7 to nil") - } - if err := b.ConsumeID(InternalLinkTypeBusinessChatTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBusinessChat#a03ae9d7: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeBusinessChat) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBusinessChat#a03ae9d7 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBusinessChat#a03ae9d7: field link_name: %w", err) - } - i.LinkName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeBusinessChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBusinessChat#a03ae9d7 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeBusinessChat") - b.Comma() - b.FieldStart("link_name") - b.PutString(i.LinkName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeBusinessChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBusinessChat#a03ae9d7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeBusinessChat"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBusinessChat#a03ae9d7: %w", err) - } - case "link_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBusinessChat#a03ae9d7: field link_name: %w", err) - } - i.LinkName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLinkName returns value of LinkName field. -func (i *InternalLinkTypeBusinessChat) GetLinkName() (value string) { - if i == nil { - return - } - return i.LinkName -} - -// InternalLinkTypeBuyStars represents TL type `internalLinkTypeBuyStars#a94cc347`. -type InternalLinkTypeBuyStars struct { - // The number of Telegram Stars that must be owned by the user - StarCount int64 - // Purpose of Telegram Star purchase. Arbitrary string specified by the server, for - // example, "subs" if the Telegram Stars are required to extend channel subscriptions - Purpose string -} - -// InternalLinkTypeBuyStarsTypeID is TL type id of InternalLinkTypeBuyStars. -const InternalLinkTypeBuyStarsTypeID = 0xa94cc347 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeBuyStars) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeBuyStars. -var ( - _ bin.Encoder = &InternalLinkTypeBuyStars{} - _ bin.Decoder = &InternalLinkTypeBuyStars{} - _ bin.BareEncoder = &InternalLinkTypeBuyStars{} - _ bin.BareDecoder = &InternalLinkTypeBuyStars{} - - _ InternalLinkTypeClass = &InternalLinkTypeBuyStars{} -) - -func (i *InternalLinkTypeBuyStars) Zero() bool { - if i == nil { - return true - } - if !(i.StarCount == 0) { - return false - } - if !(i.Purpose == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeBuyStars) String() string { - if i == nil { - return "InternalLinkTypeBuyStars(nil)" - } - type Alias InternalLinkTypeBuyStars - return fmt.Sprintf("InternalLinkTypeBuyStars%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeBuyStars) TypeID() uint32 { - return InternalLinkTypeBuyStarsTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeBuyStars) TypeName() string { - return "internalLinkTypeBuyStars" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeBuyStars) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeBuyStars", - ID: InternalLinkTypeBuyStarsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "Purpose", - SchemaName: "purpose", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeBuyStars) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBuyStars#a94cc347 as nil") - } - b.PutID(InternalLinkTypeBuyStarsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeBuyStars) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBuyStars#a94cc347 as nil") - } - b.PutInt53(i.StarCount) - b.PutString(i.Purpose) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeBuyStars) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBuyStars#a94cc347 to nil") - } - if err := b.ConsumeID(InternalLinkTypeBuyStarsTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBuyStars#a94cc347: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeBuyStars) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBuyStars#a94cc347 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBuyStars#a94cc347: field star_count: %w", err) - } - i.StarCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBuyStars#a94cc347: field purpose: %w", err) - } - i.Purpose = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeBuyStars) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeBuyStars#a94cc347 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeBuyStars") - b.Comma() - b.FieldStart("star_count") - b.PutInt53(i.StarCount) - b.Comma() - b.FieldStart("purpose") - b.PutString(i.Purpose) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeBuyStars) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeBuyStars#a94cc347 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeBuyStars"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBuyStars#a94cc347: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBuyStars#a94cc347: field star_count: %w", err) - } - i.StarCount = value - case "purpose": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeBuyStars#a94cc347: field purpose: %w", err) - } - i.Purpose = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarCount returns value of StarCount field. -func (i *InternalLinkTypeBuyStars) GetStarCount() (value int64) { - if i == nil { - return - } - return i.StarCount -} - -// GetPurpose returns value of Purpose field. -func (i *InternalLinkTypeBuyStars) GetPurpose() (value string) { - if i == nil { - return - } - return i.Purpose -} - -// InternalLinkTypeChangePhoneNumber represents TL type `internalLinkTypeChangePhoneNumber#f0275b01`. -type InternalLinkTypeChangePhoneNumber struct { -} - -// InternalLinkTypeChangePhoneNumberTypeID is TL type id of InternalLinkTypeChangePhoneNumber. -const InternalLinkTypeChangePhoneNumberTypeID = 0xf0275b01 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeChangePhoneNumber) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeChangePhoneNumber. -var ( - _ bin.Encoder = &InternalLinkTypeChangePhoneNumber{} - _ bin.Decoder = &InternalLinkTypeChangePhoneNumber{} - _ bin.BareEncoder = &InternalLinkTypeChangePhoneNumber{} - _ bin.BareDecoder = &InternalLinkTypeChangePhoneNumber{} - - _ InternalLinkTypeClass = &InternalLinkTypeChangePhoneNumber{} -) - -func (i *InternalLinkTypeChangePhoneNumber) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeChangePhoneNumber) String() string { - if i == nil { - return "InternalLinkTypeChangePhoneNumber(nil)" - } - type Alias InternalLinkTypeChangePhoneNumber - return fmt.Sprintf("InternalLinkTypeChangePhoneNumber%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeChangePhoneNumber) TypeID() uint32 { - return InternalLinkTypeChangePhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeChangePhoneNumber) TypeName() string { - return "internalLinkTypeChangePhoneNumber" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeChangePhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeChangePhoneNumber", - ID: InternalLinkTypeChangePhoneNumberTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeChangePhoneNumber) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChangePhoneNumber#f0275b01 as nil") - } - b.PutID(InternalLinkTypeChangePhoneNumberTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeChangePhoneNumber) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChangePhoneNumber#f0275b01 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeChangePhoneNumber) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChangePhoneNumber#f0275b01 to nil") - } - if err := b.ConsumeID(InternalLinkTypeChangePhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChangePhoneNumber#f0275b01: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeChangePhoneNumber) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChangePhoneNumber#f0275b01 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeChangePhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChangePhoneNumber#f0275b01 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeChangePhoneNumber") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeChangePhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChangePhoneNumber#f0275b01 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeChangePhoneNumber"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChangePhoneNumber#f0275b01: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeChatAffiliateProgram represents TL type `internalLinkTypeChatAffiliateProgram#25ac5024`. -type InternalLinkTypeChatAffiliateProgram struct { - // Username to be passed to searchChatAffiliateProgram - Username string - // Referrer to be passed to searchChatAffiliateProgram - Referrer string -} - -// InternalLinkTypeChatAffiliateProgramTypeID is TL type id of InternalLinkTypeChatAffiliateProgram. -const InternalLinkTypeChatAffiliateProgramTypeID = 0x25ac5024 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeChatAffiliateProgram) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeChatAffiliateProgram. -var ( - _ bin.Encoder = &InternalLinkTypeChatAffiliateProgram{} - _ bin.Decoder = &InternalLinkTypeChatAffiliateProgram{} - _ bin.BareEncoder = &InternalLinkTypeChatAffiliateProgram{} - _ bin.BareDecoder = &InternalLinkTypeChatAffiliateProgram{} - - _ InternalLinkTypeClass = &InternalLinkTypeChatAffiliateProgram{} -) - -func (i *InternalLinkTypeChatAffiliateProgram) Zero() bool { - if i == nil { - return true - } - if !(i.Username == "") { - return false - } - if !(i.Referrer == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeChatAffiliateProgram) String() string { - if i == nil { - return "InternalLinkTypeChatAffiliateProgram(nil)" - } - type Alias InternalLinkTypeChatAffiliateProgram - return fmt.Sprintf("InternalLinkTypeChatAffiliateProgram%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeChatAffiliateProgram) TypeID() uint32 { - return InternalLinkTypeChatAffiliateProgramTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeChatAffiliateProgram) TypeName() string { - return "internalLinkTypeChatAffiliateProgram" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeChatAffiliateProgram) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeChatAffiliateProgram", - ID: InternalLinkTypeChatAffiliateProgramTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Username", - SchemaName: "username", - }, - { - Name: "Referrer", - SchemaName: "referrer", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeChatAffiliateProgram) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatAffiliateProgram#25ac5024 as nil") - } - b.PutID(InternalLinkTypeChatAffiliateProgramTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeChatAffiliateProgram) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatAffiliateProgram#25ac5024 as nil") - } - b.PutString(i.Username) - b.PutString(i.Referrer) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeChatAffiliateProgram) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatAffiliateProgram#25ac5024 to nil") - } - if err := b.ConsumeID(InternalLinkTypeChatAffiliateProgramTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeChatAffiliateProgram) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatAffiliateProgram#25ac5024 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: field username: %w", err) - } - i.Username = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: field referrer: %w", err) - } - i.Referrer = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeChatAffiliateProgram) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatAffiliateProgram#25ac5024 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeChatAffiliateProgram") - b.Comma() - b.FieldStart("username") - b.PutString(i.Username) - b.Comma() - b.FieldStart("referrer") - b.PutString(i.Referrer) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeChatAffiliateProgram) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatAffiliateProgram#25ac5024 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeChatAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: %w", err) - } - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: field username: %w", err) - } - i.Username = value - case "referrer": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatAffiliateProgram#25ac5024: field referrer: %w", err) - } - i.Referrer = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUsername returns value of Username field. -func (i *InternalLinkTypeChatAffiliateProgram) GetUsername() (value string) { - if i == nil { - return - } - return i.Username -} - -// GetReferrer returns value of Referrer field. -func (i *InternalLinkTypeChatAffiliateProgram) GetReferrer() (value string) { - if i == nil { - return - } - return i.Referrer -} - -// InternalLinkTypeChatBoost represents TL type `internalLinkTypeChatBoost#d549fd40`. -type InternalLinkTypeChatBoost struct { - // URL to be passed to getChatBoostLinkInfo - URL string -} - -// InternalLinkTypeChatBoostTypeID is TL type id of InternalLinkTypeChatBoost. -const InternalLinkTypeChatBoostTypeID = 0xd549fd40 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeChatBoost) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeChatBoost. -var ( - _ bin.Encoder = &InternalLinkTypeChatBoost{} - _ bin.Decoder = &InternalLinkTypeChatBoost{} - _ bin.BareEncoder = &InternalLinkTypeChatBoost{} - _ bin.BareDecoder = &InternalLinkTypeChatBoost{} - - _ InternalLinkTypeClass = &InternalLinkTypeChatBoost{} -) - -func (i *InternalLinkTypeChatBoost) Zero() bool { - if i == nil { - return true - } - if !(i.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeChatBoost) String() string { - if i == nil { - return "InternalLinkTypeChatBoost(nil)" - } - type Alias InternalLinkTypeChatBoost - return fmt.Sprintf("InternalLinkTypeChatBoost%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeChatBoost) TypeID() uint32 { - return InternalLinkTypeChatBoostTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeChatBoost) TypeName() string { - return "internalLinkTypeChatBoost" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeChatBoost) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeChatBoost", - ID: InternalLinkTypeChatBoostTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeChatBoost) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatBoost#d549fd40 as nil") - } - b.PutID(InternalLinkTypeChatBoostTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeChatBoost) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatBoost#d549fd40 as nil") - } - b.PutString(i.URL) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeChatBoost) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatBoost#d549fd40 to nil") - } - if err := b.ConsumeID(InternalLinkTypeChatBoostTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatBoost#d549fd40: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeChatBoost) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatBoost#d549fd40 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatBoost#d549fd40: field url: %w", err) - } - i.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeChatBoost) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatBoost#d549fd40 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeChatBoost") - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeChatBoost) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatBoost#d549fd40 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeChatBoost"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatBoost#d549fd40: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatBoost#d549fd40: field url: %w", err) - } - i.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (i *InternalLinkTypeChatBoost) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// InternalLinkTypeChatFolderInvite represents TL type `internalLinkTypeChatFolderInvite#89b2493e`. -type InternalLinkTypeChatFolderInvite struct { - // Internal representation of the invite link - InviteLink string -} - -// InternalLinkTypeChatFolderInviteTypeID is TL type id of InternalLinkTypeChatFolderInvite. -const InternalLinkTypeChatFolderInviteTypeID = 0x89b2493e - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeChatFolderInvite) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeChatFolderInvite. -var ( - _ bin.Encoder = &InternalLinkTypeChatFolderInvite{} - _ bin.Decoder = &InternalLinkTypeChatFolderInvite{} - _ bin.BareEncoder = &InternalLinkTypeChatFolderInvite{} - _ bin.BareDecoder = &InternalLinkTypeChatFolderInvite{} - - _ InternalLinkTypeClass = &InternalLinkTypeChatFolderInvite{} -) - -func (i *InternalLinkTypeChatFolderInvite) Zero() bool { - if i == nil { - return true - } - if !(i.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeChatFolderInvite) String() string { - if i == nil { - return "InternalLinkTypeChatFolderInvite(nil)" - } - type Alias InternalLinkTypeChatFolderInvite - return fmt.Sprintf("InternalLinkTypeChatFolderInvite%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeChatFolderInvite) TypeID() uint32 { - return InternalLinkTypeChatFolderInviteTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeChatFolderInvite) TypeName() string { - return "internalLinkTypeChatFolderInvite" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeChatFolderInvite) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeChatFolderInvite", - ID: InternalLinkTypeChatFolderInviteTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeChatFolderInvite) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatFolderInvite#89b2493e as nil") - } - b.PutID(InternalLinkTypeChatFolderInviteTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeChatFolderInvite) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatFolderInvite#89b2493e as nil") - } - b.PutString(i.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeChatFolderInvite) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatFolderInvite#89b2493e to nil") - } - if err := b.ConsumeID(InternalLinkTypeChatFolderInviteTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatFolderInvite#89b2493e: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeChatFolderInvite) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatFolderInvite#89b2493e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatFolderInvite#89b2493e: field invite_link: %w", err) - } - i.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeChatFolderInvite) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatFolderInvite#89b2493e as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeChatFolderInvite") - b.Comma() - b.FieldStart("invite_link") - b.PutString(i.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeChatFolderInvite) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatFolderInvite#89b2493e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeChatFolderInvite"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatFolderInvite#89b2493e: %w", err) - } - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatFolderInvite#89b2493e: field invite_link: %w", err) - } - i.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (i *InternalLinkTypeChatFolderInvite) GetInviteLink() (value string) { - if i == nil { - return - } - return i.InviteLink -} - -// InternalLinkTypeChatFolderSettings represents TL type `internalLinkTypeChatFolderSettings#bfff055c`. -type InternalLinkTypeChatFolderSettings struct { -} - -// InternalLinkTypeChatFolderSettingsTypeID is TL type id of InternalLinkTypeChatFolderSettings. -const InternalLinkTypeChatFolderSettingsTypeID = 0xbfff055c - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeChatFolderSettings) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeChatFolderSettings. -var ( - _ bin.Encoder = &InternalLinkTypeChatFolderSettings{} - _ bin.Decoder = &InternalLinkTypeChatFolderSettings{} - _ bin.BareEncoder = &InternalLinkTypeChatFolderSettings{} - _ bin.BareDecoder = &InternalLinkTypeChatFolderSettings{} - - _ InternalLinkTypeClass = &InternalLinkTypeChatFolderSettings{} -) - -func (i *InternalLinkTypeChatFolderSettings) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeChatFolderSettings) String() string { - if i == nil { - return "InternalLinkTypeChatFolderSettings(nil)" - } - type Alias InternalLinkTypeChatFolderSettings - return fmt.Sprintf("InternalLinkTypeChatFolderSettings%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeChatFolderSettings) TypeID() uint32 { - return InternalLinkTypeChatFolderSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeChatFolderSettings) TypeName() string { - return "internalLinkTypeChatFolderSettings" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeChatFolderSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeChatFolderSettings", - ID: InternalLinkTypeChatFolderSettingsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeChatFolderSettings) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatFolderSettings#bfff055c as nil") - } - b.PutID(InternalLinkTypeChatFolderSettingsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeChatFolderSettings) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatFolderSettings#bfff055c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeChatFolderSettings) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatFolderSettings#bfff055c to nil") - } - if err := b.ConsumeID(InternalLinkTypeChatFolderSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatFolderSettings#bfff055c: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeChatFolderSettings) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatFolderSettings#bfff055c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeChatFolderSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatFolderSettings#bfff055c as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeChatFolderSettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeChatFolderSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatFolderSettings#bfff055c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeChatFolderSettings"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatFolderSettings#bfff055c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeChatInvite represents TL type `internalLinkTypeChatInvite#198c3cd9`. -type InternalLinkTypeChatInvite struct { - // Internal representation of the invite link - InviteLink string -} - -// InternalLinkTypeChatInviteTypeID is TL type id of InternalLinkTypeChatInvite. -const InternalLinkTypeChatInviteTypeID = 0x198c3cd9 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeChatInvite) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeChatInvite. -var ( - _ bin.Encoder = &InternalLinkTypeChatInvite{} - _ bin.Decoder = &InternalLinkTypeChatInvite{} - _ bin.BareEncoder = &InternalLinkTypeChatInvite{} - _ bin.BareDecoder = &InternalLinkTypeChatInvite{} - - _ InternalLinkTypeClass = &InternalLinkTypeChatInvite{} -) - -func (i *InternalLinkTypeChatInvite) Zero() bool { - if i == nil { - return true - } - if !(i.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeChatInvite) String() string { - if i == nil { - return "InternalLinkTypeChatInvite(nil)" - } - type Alias InternalLinkTypeChatInvite - return fmt.Sprintf("InternalLinkTypeChatInvite%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeChatInvite) TypeID() uint32 { - return InternalLinkTypeChatInviteTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeChatInvite) TypeName() string { - return "internalLinkTypeChatInvite" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeChatInvite) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeChatInvite", - ID: InternalLinkTypeChatInviteTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeChatInvite) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatInvite#198c3cd9 as nil") - } - b.PutID(InternalLinkTypeChatInviteTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeChatInvite) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatInvite#198c3cd9 as nil") - } - b.PutString(i.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeChatInvite) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatInvite#198c3cd9 to nil") - } - if err := b.ConsumeID(InternalLinkTypeChatInviteTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatInvite#198c3cd9: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeChatInvite) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatInvite#198c3cd9 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatInvite#198c3cd9: field invite_link: %w", err) - } - i.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeChatInvite) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeChatInvite#198c3cd9 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeChatInvite") - b.Comma() - b.FieldStart("invite_link") - b.PutString(i.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeChatInvite) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeChatInvite#198c3cd9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeChatInvite"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatInvite#198c3cd9: %w", err) - } - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeChatInvite#198c3cd9: field invite_link: %w", err) - } - i.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (i *InternalLinkTypeChatInvite) GetInviteLink() (value string) { - if i == nil { - return - } - return i.InviteLink -} - -// InternalLinkTypeDefaultMessageAutoDeleteTimerSettings represents TL type `internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931`. -type InternalLinkTypeDefaultMessageAutoDeleteTimerSettings struct { -} - -// InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID is TL type id of InternalLinkTypeDefaultMessageAutoDeleteTimerSettings. -const InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID = 0x2baaf931 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) construct() InternalLinkTypeClass { - return &i -} - -// Ensuring interfaces in compile-time for InternalLinkTypeDefaultMessageAutoDeleteTimerSettings. -var ( - _ bin.Encoder = &InternalLinkTypeDefaultMessageAutoDeleteTimerSettings{} - _ bin.Decoder = &InternalLinkTypeDefaultMessageAutoDeleteTimerSettings{} - _ bin.BareEncoder = &InternalLinkTypeDefaultMessageAutoDeleteTimerSettings{} - _ bin.BareDecoder = &InternalLinkTypeDefaultMessageAutoDeleteTimerSettings{} - - _ InternalLinkTypeClass = &InternalLinkTypeDefaultMessageAutoDeleteTimerSettings{} -) - -func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) String() string { - if i == nil { - return "InternalLinkTypeDefaultMessageAutoDeleteTimerSettings(nil)" - } - type Alias InternalLinkTypeDefaultMessageAutoDeleteTimerSettings - return fmt.Sprintf("InternalLinkTypeDefaultMessageAutoDeleteTimerSettings%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) TypeID() uint32 { - return InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) TypeName() string { - return "internalLinkTypeDefaultMessageAutoDeleteTimerSettings" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeDefaultMessageAutoDeleteTimerSettings", - ID: InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 as nil") - } - b.PutID(InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 to nil") - } - if err := b.ConsumeID(InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeDefaultMessageAutoDeleteTimerSettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeDefaultMessageAutoDeleteTimerSettings"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeEditProfileSettings represents TL type `internalLinkTypeEditProfileSettings#c30e5066`. -type InternalLinkTypeEditProfileSettings struct { -} - -// InternalLinkTypeEditProfileSettingsTypeID is TL type id of InternalLinkTypeEditProfileSettings. -const InternalLinkTypeEditProfileSettingsTypeID = 0xc30e5066 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeEditProfileSettings) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeEditProfileSettings. -var ( - _ bin.Encoder = &InternalLinkTypeEditProfileSettings{} - _ bin.Decoder = &InternalLinkTypeEditProfileSettings{} - _ bin.BareEncoder = &InternalLinkTypeEditProfileSettings{} - _ bin.BareDecoder = &InternalLinkTypeEditProfileSettings{} - - _ InternalLinkTypeClass = &InternalLinkTypeEditProfileSettings{} -) - -func (i *InternalLinkTypeEditProfileSettings) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeEditProfileSettings) String() string { - if i == nil { - return "InternalLinkTypeEditProfileSettings(nil)" - } - type Alias InternalLinkTypeEditProfileSettings - return fmt.Sprintf("InternalLinkTypeEditProfileSettings%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeEditProfileSettings) TypeID() uint32 { - return InternalLinkTypeEditProfileSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeEditProfileSettings) TypeName() string { - return "internalLinkTypeEditProfileSettings" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeEditProfileSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeEditProfileSettings", - ID: InternalLinkTypeEditProfileSettingsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeEditProfileSettings) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeEditProfileSettings#c30e5066 as nil") - } - b.PutID(InternalLinkTypeEditProfileSettingsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeEditProfileSettings) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeEditProfileSettings#c30e5066 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeEditProfileSettings) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeEditProfileSettings#c30e5066 to nil") - } - if err := b.ConsumeID(InternalLinkTypeEditProfileSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeEditProfileSettings#c30e5066: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeEditProfileSettings) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeEditProfileSettings#c30e5066 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeEditProfileSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeEditProfileSettings#c30e5066 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeEditProfileSettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeEditProfileSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeEditProfileSettings#c30e5066 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeEditProfileSettings"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeEditProfileSettings#c30e5066: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeGame represents TL type `internalLinkTypeGame#f074adcd`. -type InternalLinkTypeGame struct { - // Username of the bot that owns the game - BotUsername string - // Short name of the game - GameShortName string -} - -// InternalLinkTypeGameTypeID is TL type id of InternalLinkTypeGame. -const InternalLinkTypeGameTypeID = 0xf074adcd - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeGame) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeGame. -var ( - _ bin.Encoder = &InternalLinkTypeGame{} - _ bin.Decoder = &InternalLinkTypeGame{} - _ bin.BareEncoder = &InternalLinkTypeGame{} - _ bin.BareDecoder = &InternalLinkTypeGame{} - - _ InternalLinkTypeClass = &InternalLinkTypeGame{} -) - -func (i *InternalLinkTypeGame) Zero() bool { - if i == nil { - return true - } - if !(i.BotUsername == "") { - return false - } - if !(i.GameShortName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeGame) String() string { - if i == nil { - return "InternalLinkTypeGame(nil)" - } - type Alias InternalLinkTypeGame - return fmt.Sprintf("InternalLinkTypeGame%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeGame) TypeID() uint32 { - return InternalLinkTypeGameTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeGame) TypeName() string { - return "internalLinkTypeGame" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeGame) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeGame", - ID: InternalLinkTypeGameTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUsername", - SchemaName: "bot_username", - }, - { - Name: "GameShortName", - SchemaName: "game_short_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeGame) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeGame#f074adcd as nil") - } - b.PutID(InternalLinkTypeGameTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeGame) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeGame#f074adcd as nil") - } - b.PutString(i.BotUsername) - b.PutString(i.GameShortName) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeGame) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeGame#f074adcd to nil") - } - if err := b.ConsumeID(InternalLinkTypeGameTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeGame#f074adcd: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeGame) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeGame#f074adcd to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeGame#f074adcd: field bot_username: %w", err) - } - i.BotUsername = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeGame#f074adcd: field game_short_name: %w", err) - } - i.GameShortName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeGame) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeGame#f074adcd as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeGame") - b.Comma() - b.FieldStart("bot_username") - b.PutString(i.BotUsername) - b.Comma() - b.FieldStart("game_short_name") - b.PutString(i.GameShortName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeGame) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeGame#f074adcd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeGame"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeGame#f074adcd: %w", err) - } - case "bot_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeGame#f074adcd: field bot_username: %w", err) - } - i.BotUsername = value - case "game_short_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeGame#f074adcd: field game_short_name: %w", err) - } - i.GameShortName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUsername returns value of BotUsername field. -func (i *InternalLinkTypeGame) GetBotUsername() (value string) { - if i == nil { - return - } - return i.BotUsername -} - -// GetGameShortName returns value of GameShortName field. -func (i *InternalLinkTypeGame) GetGameShortName() (value string) { - if i == nil { - return - } - return i.GameShortName -} - -// InternalLinkTypeInstantView represents TL type `internalLinkTypeInstantView#69e4df3f`. -type InternalLinkTypeInstantView struct { - // URL to be passed to getWebPageInstantView - URL string - // An URL to open if getWebPageInstantView fails - FallbackURL string -} - -// InternalLinkTypeInstantViewTypeID is TL type id of InternalLinkTypeInstantView. -const InternalLinkTypeInstantViewTypeID = 0x69e4df3f - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeInstantView) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeInstantView. -var ( - _ bin.Encoder = &InternalLinkTypeInstantView{} - _ bin.Decoder = &InternalLinkTypeInstantView{} - _ bin.BareEncoder = &InternalLinkTypeInstantView{} - _ bin.BareDecoder = &InternalLinkTypeInstantView{} - - _ InternalLinkTypeClass = &InternalLinkTypeInstantView{} -) - -func (i *InternalLinkTypeInstantView) Zero() bool { - if i == nil { - return true - } - if !(i.URL == "") { - return false - } - if !(i.FallbackURL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeInstantView) String() string { - if i == nil { - return "InternalLinkTypeInstantView(nil)" - } - type Alias InternalLinkTypeInstantView - return fmt.Sprintf("InternalLinkTypeInstantView%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeInstantView) TypeID() uint32 { - return InternalLinkTypeInstantViewTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeInstantView) TypeName() string { - return "internalLinkTypeInstantView" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeInstantView) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeInstantView", - ID: InternalLinkTypeInstantViewTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "FallbackURL", - SchemaName: "fallback_url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeInstantView) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeInstantView#69e4df3f as nil") - } - b.PutID(InternalLinkTypeInstantViewTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeInstantView) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeInstantView#69e4df3f as nil") - } - b.PutString(i.URL) - b.PutString(i.FallbackURL) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeInstantView) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeInstantView#69e4df3f to nil") - } - if err := b.ConsumeID(InternalLinkTypeInstantViewTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeInstantView) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeInstantView#69e4df3f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: field url: %w", err) - } - i.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: field fallback_url: %w", err) - } - i.FallbackURL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeInstantView) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeInstantView#69e4df3f as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeInstantView") - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.FieldStart("fallback_url") - b.PutString(i.FallbackURL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeInstantView) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeInstantView#69e4df3f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeInstantView"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: field url: %w", err) - } - i.URL = value - case "fallback_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeInstantView#69e4df3f: field fallback_url: %w", err) - } - i.FallbackURL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (i *InternalLinkTypeInstantView) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// GetFallbackURL returns value of FallbackURL field. -func (i *InternalLinkTypeInstantView) GetFallbackURL() (value string) { - if i == nil { - return - } - return i.FallbackURL -} - -// InternalLinkTypeInvoice represents TL type `internalLinkTypeInvoice#f34c6dac`. -type InternalLinkTypeInvoice struct { - // Name of the invoice - InvoiceName string -} - -// InternalLinkTypeInvoiceTypeID is TL type id of InternalLinkTypeInvoice. -const InternalLinkTypeInvoiceTypeID = 0xf34c6dac - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeInvoice) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeInvoice. -var ( - _ bin.Encoder = &InternalLinkTypeInvoice{} - _ bin.Decoder = &InternalLinkTypeInvoice{} - _ bin.BareEncoder = &InternalLinkTypeInvoice{} - _ bin.BareDecoder = &InternalLinkTypeInvoice{} - - _ InternalLinkTypeClass = &InternalLinkTypeInvoice{} -) - -func (i *InternalLinkTypeInvoice) Zero() bool { - if i == nil { - return true - } - if !(i.InvoiceName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeInvoice) String() string { - if i == nil { - return "InternalLinkTypeInvoice(nil)" - } - type Alias InternalLinkTypeInvoice - return fmt.Sprintf("InternalLinkTypeInvoice%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeInvoice) TypeID() uint32 { - return InternalLinkTypeInvoiceTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeInvoice) TypeName() string { - return "internalLinkTypeInvoice" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeInvoice) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeInvoice", - ID: InternalLinkTypeInvoiceTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InvoiceName", - SchemaName: "invoice_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeInvoice) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeInvoice#f34c6dac as nil") - } - b.PutID(InternalLinkTypeInvoiceTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeInvoice) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeInvoice#f34c6dac as nil") - } - b.PutString(i.InvoiceName) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeInvoice) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeInvoice#f34c6dac to nil") - } - if err := b.ConsumeID(InternalLinkTypeInvoiceTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeInvoice#f34c6dac: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeInvoice) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeInvoice#f34c6dac to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeInvoice#f34c6dac: field invoice_name: %w", err) - } - i.InvoiceName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeInvoice) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeInvoice#f34c6dac as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeInvoice") - b.Comma() - b.FieldStart("invoice_name") - b.PutString(i.InvoiceName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeInvoice) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeInvoice#f34c6dac to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeInvoice"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeInvoice#f34c6dac: %w", err) - } - case "invoice_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeInvoice#f34c6dac: field invoice_name: %w", err) - } - i.InvoiceName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInvoiceName returns value of InvoiceName field. -func (i *InternalLinkTypeInvoice) GetInvoiceName() (value string) { - if i == nil { - return - } - return i.InvoiceName -} - -// InternalLinkTypeLanguagePack represents TL type `internalLinkTypeLanguagePack#a9870d6c`. -type InternalLinkTypeLanguagePack struct { - // Language pack identifier - LanguagePackID string -} - -// InternalLinkTypeLanguagePackTypeID is TL type id of InternalLinkTypeLanguagePack. -const InternalLinkTypeLanguagePackTypeID = 0xa9870d6c - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeLanguagePack) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeLanguagePack. -var ( - _ bin.Encoder = &InternalLinkTypeLanguagePack{} - _ bin.Decoder = &InternalLinkTypeLanguagePack{} - _ bin.BareEncoder = &InternalLinkTypeLanguagePack{} - _ bin.BareDecoder = &InternalLinkTypeLanguagePack{} - - _ InternalLinkTypeClass = &InternalLinkTypeLanguagePack{} -) - -func (i *InternalLinkTypeLanguagePack) Zero() bool { - if i == nil { - return true - } - if !(i.LanguagePackID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeLanguagePack) String() string { - if i == nil { - return "InternalLinkTypeLanguagePack(nil)" - } - type Alias InternalLinkTypeLanguagePack - return fmt.Sprintf("InternalLinkTypeLanguagePack%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeLanguagePack) TypeID() uint32 { - return InternalLinkTypeLanguagePackTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeLanguagePack) TypeName() string { - return "internalLinkTypeLanguagePack" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeLanguagePack) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeLanguagePack", - ID: InternalLinkTypeLanguagePackTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LanguagePackID", - SchemaName: "language_pack_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeLanguagePack) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeLanguagePack#a9870d6c as nil") - } - b.PutID(InternalLinkTypeLanguagePackTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeLanguagePack) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeLanguagePack#a9870d6c as nil") - } - b.PutString(i.LanguagePackID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeLanguagePack) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeLanguagePack#a9870d6c to nil") - } - if err := b.ConsumeID(InternalLinkTypeLanguagePackTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeLanguagePack#a9870d6c: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeLanguagePack) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeLanguagePack#a9870d6c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeLanguagePack#a9870d6c: field language_pack_id: %w", err) - } - i.LanguagePackID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeLanguagePack) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeLanguagePack#a9870d6c as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeLanguagePack") - b.Comma() - b.FieldStart("language_pack_id") - b.PutString(i.LanguagePackID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeLanguagePack) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeLanguagePack#a9870d6c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeLanguagePack"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeLanguagePack#a9870d6c: %w", err) - } - case "language_pack_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeLanguagePack#a9870d6c: field language_pack_id: %w", err) - } - i.LanguagePackID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguagePackID returns value of LanguagePackID field. -func (i *InternalLinkTypeLanguagePack) GetLanguagePackID() (value string) { - if i == nil { - return - } - return i.LanguagePackID -} - -// InternalLinkTypeLanguageSettings represents TL type `internalLinkTypeLanguageSettings#b019e6e6`. -type InternalLinkTypeLanguageSettings struct { -} - -// InternalLinkTypeLanguageSettingsTypeID is TL type id of InternalLinkTypeLanguageSettings. -const InternalLinkTypeLanguageSettingsTypeID = 0xb019e6e6 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeLanguageSettings) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeLanguageSettings. -var ( - _ bin.Encoder = &InternalLinkTypeLanguageSettings{} - _ bin.Decoder = &InternalLinkTypeLanguageSettings{} - _ bin.BareEncoder = &InternalLinkTypeLanguageSettings{} - _ bin.BareDecoder = &InternalLinkTypeLanguageSettings{} - - _ InternalLinkTypeClass = &InternalLinkTypeLanguageSettings{} -) - -func (i *InternalLinkTypeLanguageSettings) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeLanguageSettings) String() string { - if i == nil { - return "InternalLinkTypeLanguageSettings(nil)" - } - type Alias InternalLinkTypeLanguageSettings - return fmt.Sprintf("InternalLinkTypeLanguageSettings%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeLanguageSettings) TypeID() uint32 { - return InternalLinkTypeLanguageSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeLanguageSettings) TypeName() string { - return "internalLinkTypeLanguageSettings" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeLanguageSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeLanguageSettings", - ID: InternalLinkTypeLanguageSettingsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeLanguageSettings) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeLanguageSettings#b019e6e6 as nil") - } - b.PutID(InternalLinkTypeLanguageSettingsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeLanguageSettings) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeLanguageSettings#b019e6e6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeLanguageSettings) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeLanguageSettings#b019e6e6 to nil") - } - if err := b.ConsumeID(InternalLinkTypeLanguageSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeLanguageSettings#b019e6e6: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeLanguageSettings) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeLanguageSettings#b019e6e6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeLanguageSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeLanguageSettings#b019e6e6 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeLanguageSettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeLanguageSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeLanguageSettings#b019e6e6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeLanguageSettings"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeLanguageSettings#b019e6e6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeMainWebApp represents TL type `internalLinkTypeMainWebApp#5ddf72e9`. -type InternalLinkTypeMainWebApp struct { - // Username of the bot - BotUsername string - // Start parameter to be passed to getMainWebApp - StartParameter string - // The mode to be passed to getMainWebApp - Mode WebAppOpenModeClass -} - -// InternalLinkTypeMainWebAppTypeID is TL type id of InternalLinkTypeMainWebApp. -const InternalLinkTypeMainWebAppTypeID = 0x5ddf72e9 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeMainWebApp) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeMainWebApp. -var ( - _ bin.Encoder = &InternalLinkTypeMainWebApp{} - _ bin.Decoder = &InternalLinkTypeMainWebApp{} - _ bin.BareEncoder = &InternalLinkTypeMainWebApp{} - _ bin.BareDecoder = &InternalLinkTypeMainWebApp{} - - _ InternalLinkTypeClass = &InternalLinkTypeMainWebApp{} -) - -func (i *InternalLinkTypeMainWebApp) Zero() bool { - if i == nil { - return true - } - if !(i.BotUsername == "") { - return false - } - if !(i.StartParameter == "") { - return false - } - if !(i.Mode == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeMainWebApp) String() string { - if i == nil { - return "InternalLinkTypeMainWebApp(nil)" - } - type Alias InternalLinkTypeMainWebApp - return fmt.Sprintf("InternalLinkTypeMainWebApp%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeMainWebApp) TypeID() uint32 { - return InternalLinkTypeMainWebAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeMainWebApp) TypeName() string { - return "internalLinkTypeMainWebApp" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeMainWebApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeMainWebApp", - ID: InternalLinkTypeMainWebAppTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUsername", - SchemaName: "bot_username", - }, - { - Name: "StartParameter", - SchemaName: "start_parameter", - }, - { - Name: "Mode", - SchemaName: "mode", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeMainWebApp) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeMainWebApp#5ddf72e9 as nil") - } - b.PutID(InternalLinkTypeMainWebAppTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeMainWebApp) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeMainWebApp#5ddf72e9 as nil") - } - b.PutString(i.BotUsername) - b.PutString(i.StartParameter) - if i.Mode == nil { - return fmt.Errorf("unable to encode internalLinkTypeMainWebApp#5ddf72e9: field mode is nil") - } - if err := i.Mode.Encode(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeMainWebApp#5ddf72e9: field mode: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeMainWebApp) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeMainWebApp#5ddf72e9 to nil") - } - if err := b.ConsumeID(InternalLinkTypeMainWebAppTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeMainWebApp) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeMainWebApp#5ddf72e9 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field bot_username: %w", err) - } - i.BotUsername = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field start_parameter: %w", err) - } - i.StartParameter = value - } - { - value, err := DecodeWebAppOpenMode(b) - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field mode: %w", err) - } - i.Mode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeMainWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeMainWebApp#5ddf72e9 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeMainWebApp") - b.Comma() - b.FieldStart("bot_username") - b.PutString(i.BotUsername) - b.Comma() - b.FieldStart("start_parameter") - b.PutString(i.StartParameter) - b.Comma() - b.FieldStart("mode") - if i.Mode == nil { - return fmt.Errorf("unable to encode internalLinkTypeMainWebApp#5ddf72e9: field mode is nil") - } - if err := i.Mode.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeMainWebApp#5ddf72e9: field mode: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeMainWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeMainWebApp#5ddf72e9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeMainWebApp"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: %w", err) - } - case "bot_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field bot_username: %w", err) - } - i.BotUsername = value - case "start_parameter": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field start_parameter: %w", err) - } - i.StartParameter = value - case "mode": - value, err := DecodeTDLibJSONWebAppOpenMode(b) - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMainWebApp#5ddf72e9: field mode: %w", err) - } - i.Mode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUsername returns value of BotUsername field. -func (i *InternalLinkTypeMainWebApp) GetBotUsername() (value string) { - if i == nil { - return - } - return i.BotUsername -} - -// GetStartParameter returns value of StartParameter field. -func (i *InternalLinkTypeMainWebApp) GetStartParameter() (value string) { - if i == nil { - return - } - return i.StartParameter -} - -// GetMode returns value of Mode field. -func (i *InternalLinkTypeMainWebApp) GetMode() (value WebAppOpenModeClass) { - if i == nil { - return - } - return i.Mode -} - -// InternalLinkTypeMessage represents TL type `internalLinkTypeMessage#3a535c52`. -type InternalLinkTypeMessage struct { - // URL to be passed to getMessageLinkInfo - URL string -} - -// InternalLinkTypeMessageTypeID is TL type id of InternalLinkTypeMessage. -const InternalLinkTypeMessageTypeID = 0x3a535c52 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeMessage) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeMessage. -var ( - _ bin.Encoder = &InternalLinkTypeMessage{} - _ bin.Decoder = &InternalLinkTypeMessage{} - _ bin.BareEncoder = &InternalLinkTypeMessage{} - _ bin.BareDecoder = &InternalLinkTypeMessage{} - - _ InternalLinkTypeClass = &InternalLinkTypeMessage{} -) - -func (i *InternalLinkTypeMessage) Zero() bool { - if i == nil { - return true - } - if !(i.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeMessage) String() string { - if i == nil { - return "InternalLinkTypeMessage(nil)" - } - type Alias InternalLinkTypeMessage - return fmt.Sprintf("InternalLinkTypeMessage%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeMessage) TypeID() uint32 { - return InternalLinkTypeMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeMessage) TypeName() string { - return "internalLinkTypeMessage" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeMessage", - ID: InternalLinkTypeMessageTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeMessage) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeMessage#3a535c52 as nil") - } - b.PutID(InternalLinkTypeMessageTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeMessage) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeMessage#3a535c52 as nil") - } - b.PutString(i.URL) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeMessage) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeMessage#3a535c52 to nil") - } - if err := b.ConsumeID(InternalLinkTypeMessageTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMessage#3a535c52: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeMessage) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeMessage#3a535c52 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMessage#3a535c52: field url: %w", err) - } - i.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeMessage#3a535c52 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeMessage") - b.Comma() - b.FieldStart("url") - b.PutString(i.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeMessage#3a535c52 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeMessage"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMessage#3a535c52: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMessage#3a535c52: field url: %w", err) - } - i.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (i *InternalLinkTypeMessage) GetURL() (value string) { - if i == nil { - return - } - return i.URL -} - -// InternalLinkTypeMessageDraft represents TL type `internalLinkTypeMessageDraft#276fbad5`. -type InternalLinkTypeMessageDraft struct { - // Message draft text - Text FormattedText - // True, if the first line of the text contains a link. If true, the input field needs to - // be focused and the text after the link must be selected - ContainsLink bool -} - -// InternalLinkTypeMessageDraftTypeID is TL type id of InternalLinkTypeMessageDraft. -const InternalLinkTypeMessageDraftTypeID = 0x276fbad5 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeMessageDraft) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeMessageDraft. -var ( - _ bin.Encoder = &InternalLinkTypeMessageDraft{} - _ bin.Decoder = &InternalLinkTypeMessageDraft{} - _ bin.BareEncoder = &InternalLinkTypeMessageDraft{} - _ bin.BareDecoder = &InternalLinkTypeMessageDraft{} - - _ InternalLinkTypeClass = &InternalLinkTypeMessageDraft{} -) - -func (i *InternalLinkTypeMessageDraft) Zero() bool { - if i == nil { - return true - } - if !(i.Text.Zero()) { - return false - } - if !(i.ContainsLink == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeMessageDraft) String() string { - if i == nil { - return "InternalLinkTypeMessageDraft(nil)" - } - type Alias InternalLinkTypeMessageDraft - return fmt.Sprintf("InternalLinkTypeMessageDraft%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeMessageDraft) TypeID() uint32 { - return InternalLinkTypeMessageDraftTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeMessageDraft) TypeName() string { - return "internalLinkTypeMessageDraft" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeMessageDraft) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeMessageDraft", - ID: InternalLinkTypeMessageDraftTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "ContainsLink", - SchemaName: "contains_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeMessageDraft) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeMessageDraft#276fbad5 as nil") - } - b.PutID(InternalLinkTypeMessageDraftTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeMessageDraft) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeMessageDraft#276fbad5 as nil") - } - if err := i.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeMessageDraft#276fbad5: field text: %w", err) - } - b.PutBool(i.ContainsLink) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeMessageDraft) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeMessageDraft#276fbad5 to nil") - } - if err := b.ConsumeID(InternalLinkTypeMessageDraftTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeMessageDraft) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeMessageDraft#276fbad5 to nil") - } - { - if err := i.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: field text: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: field contains_link: %w", err) - } - i.ContainsLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeMessageDraft) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeMessageDraft#276fbad5 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeMessageDraft") - b.Comma() - b.FieldStart("text") - if err := i.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeMessageDraft#276fbad5: field text: %w", err) - } - b.Comma() - b.FieldStart("contains_link") - b.PutBool(i.ContainsLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeMessageDraft) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeMessageDraft#276fbad5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeMessageDraft"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: %w", err) - } - case "text": - if err := i.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: field text: %w", err) - } - case "contains_link": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeMessageDraft#276fbad5: field contains_link: %w", err) - } - i.ContainsLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (i *InternalLinkTypeMessageDraft) GetText() (value FormattedText) { - if i == nil { - return - } - return i.Text -} - -// GetContainsLink returns value of ContainsLink field. -func (i *InternalLinkTypeMessageDraft) GetContainsLink() (value bool) { - if i == nil { - return - } - return i.ContainsLink -} - -// InternalLinkTypePassportDataRequest represents TL type `internalLinkTypePassportDataRequest#c50fce81`. -type InternalLinkTypePassportDataRequest struct { - // User identifier of the service's bot; the corresponding user may be unknown yet - BotUserID int64 - // Telegram Passport element types requested by the service - Scope string - // Service's public key - PublicKey string - // Unique request identifier provided by the service - Nonce string - // An HTTP URL to open once the request is finished, canceled, or failed with the - // parameters tg_passport=success, tg_passport=cancel, or tg_passport=error&error=... - // respectively. - CallbackURL string -} - -// InternalLinkTypePassportDataRequestTypeID is TL type id of InternalLinkTypePassportDataRequest. -const InternalLinkTypePassportDataRequestTypeID = 0xc50fce81 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypePassportDataRequest) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypePassportDataRequest. -var ( - _ bin.Encoder = &InternalLinkTypePassportDataRequest{} - _ bin.Decoder = &InternalLinkTypePassportDataRequest{} - _ bin.BareEncoder = &InternalLinkTypePassportDataRequest{} - _ bin.BareDecoder = &InternalLinkTypePassportDataRequest{} - - _ InternalLinkTypeClass = &InternalLinkTypePassportDataRequest{} -) - -func (i *InternalLinkTypePassportDataRequest) Zero() bool { - if i == nil { - return true - } - if !(i.BotUserID == 0) { - return false - } - if !(i.Scope == "") { - return false - } - if !(i.PublicKey == "") { - return false - } - if !(i.Nonce == "") { - return false - } - if !(i.CallbackURL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypePassportDataRequest) String() string { - if i == nil { - return "InternalLinkTypePassportDataRequest(nil)" - } - type Alias InternalLinkTypePassportDataRequest - return fmt.Sprintf("InternalLinkTypePassportDataRequest%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypePassportDataRequest) TypeID() uint32 { - return InternalLinkTypePassportDataRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypePassportDataRequest) TypeName() string { - return "internalLinkTypePassportDataRequest" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypePassportDataRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypePassportDataRequest", - ID: InternalLinkTypePassportDataRequestTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Scope", - SchemaName: "scope", - }, - { - Name: "PublicKey", - SchemaName: "public_key", - }, - { - Name: "Nonce", - SchemaName: "nonce", - }, - { - Name: "CallbackURL", - SchemaName: "callback_url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypePassportDataRequest) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePassportDataRequest#c50fce81 as nil") - } - b.PutID(InternalLinkTypePassportDataRequestTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypePassportDataRequest) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePassportDataRequest#c50fce81 as nil") - } - b.PutInt53(i.BotUserID) - b.PutString(i.Scope) - b.PutString(i.PublicKey) - b.PutString(i.Nonce) - b.PutString(i.CallbackURL) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypePassportDataRequest) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePassportDataRequest#c50fce81 to nil") - } - if err := b.ConsumeID(InternalLinkTypePassportDataRequestTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypePassportDataRequest) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePassportDataRequest#c50fce81 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field bot_user_id: %w", err) - } - i.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field scope: %w", err) - } - i.Scope = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field public_key: %w", err) - } - i.PublicKey = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field nonce: %w", err) - } - i.Nonce = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field callback_url: %w", err) - } - i.CallbackURL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypePassportDataRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePassportDataRequest#c50fce81 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypePassportDataRequest") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(i.BotUserID) - b.Comma() - b.FieldStart("scope") - b.PutString(i.Scope) - b.Comma() - b.FieldStart("public_key") - b.PutString(i.PublicKey) - b.Comma() - b.FieldStart("nonce") - b.PutString(i.Nonce) - b.Comma() - b.FieldStart("callback_url") - b.PutString(i.CallbackURL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypePassportDataRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePassportDataRequest#c50fce81 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypePassportDataRequest"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field bot_user_id: %w", err) - } - i.BotUserID = value - case "scope": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field scope: %w", err) - } - i.Scope = value - case "public_key": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field public_key: %w", err) - } - i.PublicKey = value - case "nonce": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field nonce: %w", err) - } - i.Nonce = value - case "callback_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePassportDataRequest#c50fce81: field callback_url: %w", err) - } - i.CallbackURL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (i *InternalLinkTypePassportDataRequest) GetBotUserID() (value int64) { - if i == nil { - return - } - return i.BotUserID -} - -// GetScope returns value of Scope field. -func (i *InternalLinkTypePassportDataRequest) GetScope() (value string) { - if i == nil { - return - } - return i.Scope -} - -// GetPublicKey returns value of PublicKey field. -func (i *InternalLinkTypePassportDataRequest) GetPublicKey() (value string) { - if i == nil { - return - } - return i.PublicKey -} - -// GetNonce returns value of Nonce field. -func (i *InternalLinkTypePassportDataRequest) GetNonce() (value string) { - if i == nil { - return - } - return i.Nonce -} - -// GetCallbackURL returns value of CallbackURL field. -func (i *InternalLinkTypePassportDataRequest) GetCallbackURL() (value string) { - if i == nil { - return - } - return i.CallbackURL -} - -// InternalLinkTypePhoneNumberConfirmation represents TL type `internalLinkTypePhoneNumberConfirmation#68bf6b16`. -type InternalLinkTypePhoneNumberConfirmation struct { - // Hash value from the link - Hash string - // Phone number value from the link - PhoneNumber string -} - -// InternalLinkTypePhoneNumberConfirmationTypeID is TL type id of InternalLinkTypePhoneNumberConfirmation. -const InternalLinkTypePhoneNumberConfirmationTypeID = 0x68bf6b16 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypePhoneNumberConfirmation) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypePhoneNumberConfirmation. -var ( - _ bin.Encoder = &InternalLinkTypePhoneNumberConfirmation{} - _ bin.Decoder = &InternalLinkTypePhoneNumberConfirmation{} - _ bin.BareEncoder = &InternalLinkTypePhoneNumberConfirmation{} - _ bin.BareDecoder = &InternalLinkTypePhoneNumberConfirmation{} - - _ InternalLinkTypeClass = &InternalLinkTypePhoneNumberConfirmation{} -) - -func (i *InternalLinkTypePhoneNumberConfirmation) Zero() bool { - if i == nil { - return true - } - if !(i.Hash == "") { - return false - } - if !(i.PhoneNumber == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypePhoneNumberConfirmation) String() string { - if i == nil { - return "InternalLinkTypePhoneNumberConfirmation(nil)" - } - type Alias InternalLinkTypePhoneNumberConfirmation - return fmt.Sprintf("InternalLinkTypePhoneNumberConfirmation%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypePhoneNumberConfirmation) TypeID() uint32 { - return InternalLinkTypePhoneNumberConfirmationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypePhoneNumberConfirmation) TypeName() string { - return "internalLinkTypePhoneNumberConfirmation" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypePhoneNumberConfirmation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypePhoneNumberConfirmation", - ID: InternalLinkTypePhoneNumberConfirmationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Hash", - SchemaName: "hash", - }, - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypePhoneNumberConfirmation) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePhoneNumberConfirmation#68bf6b16 as nil") - } - b.PutID(InternalLinkTypePhoneNumberConfirmationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypePhoneNumberConfirmation) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePhoneNumberConfirmation#68bf6b16 as nil") - } - b.PutString(i.Hash) - b.PutString(i.PhoneNumber) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypePhoneNumberConfirmation) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePhoneNumberConfirmation#68bf6b16 to nil") - } - if err := b.ConsumeID(InternalLinkTypePhoneNumberConfirmationTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypePhoneNumberConfirmation) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePhoneNumberConfirmation#68bf6b16 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: field hash: %w", err) - } - i.Hash = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: field phone_number: %w", err) - } - i.PhoneNumber = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypePhoneNumberConfirmation) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePhoneNumberConfirmation#68bf6b16 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypePhoneNumberConfirmation") - b.Comma() - b.FieldStart("hash") - b.PutString(i.Hash) - b.Comma() - b.FieldStart("phone_number") - b.PutString(i.PhoneNumber) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypePhoneNumberConfirmation) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePhoneNumberConfirmation#68bf6b16 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypePhoneNumberConfirmation"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: %w", err) - } - case "hash": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: field hash: %w", err) - } - i.Hash = value - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePhoneNumberConfirmation#68bf6b16: field phone_number: %w", err) - } - i.PhoneNumber = value - default: - return b.Skip() - } - return nil - }) -} - -// GetHash returns value of Hash field. -func (i *InternalLinkTypePhoneNumberConfirmation) GetHash() (value string) { - if i == nil { - return - } - return i.Hash -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (i *InternalLinkTypePhoneNumberConfirmation) GetPhoneNumber() (value string) { - if i == nil { - return - } - return i.PhoneNumber -} - -// InternalLinkTypePremiumFeatures represents TL type `internalLinkTypePremiumFeatures#48884f49`. -type InternalLinkTypePremiumFeatures struct { - // Referrer specified in the link - Referrer string -} - -// InternalLinkTypePremiumFeaturesTypeID is TL type id of InternalLinkTypePremiumFeatures. -const InternalLinkTypePremiumFeaturesTypeID = 0x48884f49 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypePremiumFeatures) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypePremiumFeatures. -var ( - _ bin.Encoder = &InternalLinkTypePremiumFeatures{} - _ bin.Decoder = &InternalLinkTypePremiumFeatures{} - _ bin.BareEncoder = &InternalLinkTypePremiumFeatures{} - _ bin.BareDecoder = &InternalLinkTypePremiumFeatures{} - - _ InternalLinkTypeClass = &InternalLinkTypePremiumFeatures{} -) - -func (i *InternalLinkTypePremiumFeatures) Zero() bool { - if i == nil { - return true - } - if !(i.Referrer == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypePremiumFeatures) String() string { - if i == nil { - return "InternalLinkTypePremiumFeatures(nil)" - } - type Alias InternalLinkTypePremiumFeatures - return fmt.Sprintf("InternalLinkTypePremiumFeatures%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypePremiumFeatures) TypeID() uint32 { - return InternalLinkTypePremiumFeaturesTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypePremiumFeatures) TypeName() string { - return "internalLinkTypePremiumFeatures" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypePremiumFeatures) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypePremiumFeatures", - ID: InternalLinkTypePremiumFeaturesTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Referrer", - SchemaName: "referrer", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypePremiumFeatures) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePremiumFeatures#48884f49 as nil") - } - b.PutID(InternalLinkTypePremiumFeaturesTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypePremiumFeatures) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePremiumFeatures#48884f49 as nil") - } - b.PutString(i.Referrer) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypePremiumFeatures) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePremiumFeatures#48884f49 to nil") - } - if err := b.ConsumeID(InternalLinkTypePremiumFeaturesTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumFeatures#48884f49: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypePremiumFeatures) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePremiumFeatures#48884f49 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumFeatures#48884f49: field referrer: %w", err) - } - i.Referrer = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypePremiumFeatures) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePremiumFeatures#48884f49 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypePremiumFeatures") - b.Comma() - b.FieldStart("referrer") - b.PutString(i.Referrer) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypePremiumFeatures) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePremiumFeatures#48884f49 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypePremiumFeatures"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumFeatures#48884f49: %w", err) - } - case "referrer": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumFeatures#48884f49: field referrer: %w", err) - } - i.Referrer = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReferrer returns value of Referrer field. -func (i *InternalLinkTypePremiumFeatures) GetReferrer() (value string) { - if i == nil { - return - } - return i.Referrer -} - -// InternalLinkTypePremiumGift represents TL type `internalLinkTypePremiumGift#5ad56d41`. -type InternalLinkTypePremiumGift struct { - // Referrer specified in the link - Referrer string -} - -// InternalLinkTypePremiumGiftTypeID is TL type id of InternalLinkTypePremiumGift. -const InternalLinkTypePremiumGiftTypeID = 0x5ad56d41 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypePremiumGift) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypePremiumGift. -var ( - _ bin.Encoder = &InternalLinkTypePremiumGift{} - _ bin.Decoder = &InternalLinkTypePremiumGift{} - _ bin.BareEncoder = &InternalLinkTypePremiumGift{} - _ bin.BareDecoder = &InternalLinkTypePremiumGift{} - - _ InternalLinkTypeClass = &InternalLinkTypePremiumGift{} -) - -func (i *InternalLinkTypePremiumGift) Zero() bool { - if i == nil { - return true - } - if !(i.Referrer == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypePremiumGift) String() string { - if i == nil { - return "InternalLinkTypePremiumGift(nil)" - } - type Alias InternalLinkTypePremiumGift - return fmt.Sprintf("InternalLinkTypePremiumGift%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypePremiumGift) TypeID() uint32 { - return InternalLinkTypePremiumGiftTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypePremiumGift) TypeName() string { - return "internalLinkTypePremiumGift" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypePremiumGift) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypePremiumGift", - ID: InternalLinkTypePremiumGiftTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Referrer", - SchemaName: "referrer", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypePremiumGift) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePremiumGift#5ad56d41 as nil") - } - b.PutID(InternalLinkTypePremiumGiftTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypePremiumGift) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePremiumGift#5ad56d41 as nil") - } - b.PutString(i.Referrer) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypePremiumGift) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePremiumGift#5ad56d41 to nil") - } - if err := b.ConsumeID(InternalLinkTypePremiumGiftTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumGift#5ad56d41: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypePremiumGift) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePremiumGift#5ad56d41 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumGift#5ad56d41: field referrer: %w", err) - } - i.Referrer = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypePremiumGift) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePremiumGift#5ad56d41 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypePremiumGift") - b.Comma() - b.FieldStart("referrer") - b.PutString(i.Referrer) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypePremiumGift) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePremiumGift#5ad56d41 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypePremiumGift"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumGift#5ad56d41: %w", err) - } - case "referrer": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumGift#5ad56d41: field referrer: %w", err) - } - i.Referrer = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReferrer returns value of Referrer field. -func (i *InternalLinkTypePremiumGift) GetReferrer() (value string) { - if i == nil { - return - } - return i.Referrer -} - -// InternalLinkTypePremiumGiftCode represents TL type `internalLinkTypePremiumGiftCode#de5c9892`. -type InternalLinkTypePremiumGiftCode struct { - // The Telegram Premium gift code - Code string -} - -// InternalLinkTypePremiumGiftCodeTypeID is TL type id of InternalLinkTypePremiumGiftCode. -const InternalLinkTypePremiumGiftCodeTypeID = 0xde5c9892 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypePremiumGiftCode) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypePremiumGiftCode. -var ( - _ bin.Encoder = &InternalLinkTypePremiumGiftCode{} - _ bin.Decoder = &InternalLinkTypePremiumGiftCode{} - _ bin.BareEncoder = &InternalLinkTypePremiumGiftCode{} - _ bin.BareDecoder = &InternalLinkTypePremiumGiftCode{} - - _ InternalLinkTypeClass = &InternalLinkTypePremiumGiftCode{} -) - -func (i *InternalLinkTypePremiumGiftCode) Zero() bool { - if i == nil { - return true - } - if !(i.Code == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypePremiumGiftCode) String() string { - if i == nil { - return "InternalLinkTypePremiumGiftCode(nil)" - } - type Alias InternalLinkTypePremiumGiftCode - return fmt.Sprintf("InternalLinkTypePremiumGiftCode%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypePremiumGiftCode) TypeID() uint32 { - return InternalLinkTypePremiumGiftCodeTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypePremiumGiftCode) TypeName() string { - return "internalLinkTypePremiumGiftCode" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypePremiumGiftCode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypePremiumGiftCode", - ID: InternalLinkTypePremiumGiftCodeTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypePremiumGiftCode) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePremiumGiftCode#de5c9892 as nil") - } - b.PutID(InternalLinkTypePremiumGiftCodeTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypePremiumGiftCode) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePremiumGiftCode#de5c9892 as nil") - } - b.PutString(i.Code) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypePremiumGiftCode) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePremiumGiftCode#de5c9892 to nil") - } - if err := b.ConsumeID(InternalLinkTypePremiumGiftCodeTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumGiftCode#de5c9892: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypePremiumGiftCode) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePremiumGiftCode#de5c9892 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumGiftCode#de5c9892: field code: %w", err) - } - i.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypePremiumGiftCode) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePremiumGiftCode#de5c9892 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypePremiumGiftCode") - b.Comma() - b.FieldStart("code") - b.PutString(i.Code) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypePremiumGiftCode) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePremiumGiftCode#de5c9892 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypePremiumGiftCode"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumGiftCode#de5c9892: %w", err) - } - case "code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePremiumGiftCode#de5c9892: field code: %w", err) - } - i.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCode returns value of Code field. -func (i *InternalLinkTypePremiumGiftCode) GetCode() (value string) { - if i == nil { - return - } - return i.Code -} - -// InternalLinkTypePrivacyAndSecuritySettings represents TL type `internalLinkTypePrivacyAndSecuritySettings#ad5f6acf`. -type InternalLinkTypePrivacyAndSecuritySettings struct { -} - -// InternalLinkTypePrivacyAndSecuritySettingsTypeID is TL type id of InternalLinkTypePrivacyAndSecuritySettings. -const InternalLinkTypePrivacyAndSecuritySettingsTypeID = 0xad5f6acf - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypePrivacyAndSecuritySettings) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypePrivacyAndSecuritySettings. -var ( - _ bin.Encoder = &InternalLinkTypePrivacyAndSecuritySettings{} - _ bin.Decoder = &InternalLinkTypePrivacyAndSecuritySettings{} - _ bin.BareEncoder = &InternalLinkTypePrivacyAndSecuritySettings{} - _ bin.BareDecoder = &InternalLinkTypePrivacyAndSecuritySettings{} - - _ InternalLinkTypeClass = &InternalLinkTypePrivacyAndSecuritySettings{} -) - -func (i *InternalLinkTypePrivacyAndSecuritySettings) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypePrivacyAndSecuritySettings) String() string { - if i == nil { - return "InternalLinkTypePrivacyAndSecuritySettings(nil)" - } - type Alias InternalLinkTypePrivacyAndSecuritySettings - return fmt.Sprintf("InternalLinkTypePrivacyAndSecuritySettings%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypePrivacyAndSecuritySettings) TypeID() uint32 { - return InternalLinkTypePrivacyAndSecuritySettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypePrivacyAndSecuritySettings) TypeName() string { - return "internalLinkTypePrivacyAndSecuritySettings" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypePrivacyAndSecuritySettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypePrivacyAndSecuritySettings", - ID: InternalLinkTypePrivacyAndSecuritySettingsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypePrivacyAndSecuritySettings) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf as nil") - } - b.PutID(InternalLinkTypePrivacyAndSecuritySettingsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypePrivacyAndSecuritySettings) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypePrivacyAndSecuritySettings) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf to nil") - } - if err := b.ConsumeID(InternalLinkTypePrivacyAndSecuritySettingsTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypePrivacyAndSecuritySettings) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypePrivacyAndSecuritySettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf as nil") - } - b.ObjStart() - b.PutID("internalLinkTypePrivacyAndSecuritySettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypePrivacyAndSecuritySettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypePrivacyAndSecuritySettings"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePrivacyAndSecuritySettings#ad5f6acf: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeProxy represents TL type `internalLinkTypeProxy#b1b12cea`. -type InternalLinkTypeProxy struct { - // Proxy server domain or IP address - Server string - // Proxy server port - Port int32 - // Type of the proxy - Type ProxyTypeClass -} - -// InternalLinkTypeProxyTypeID is TL type id of InternalLinkTypeProxy. -const InternalLinkTypeProxyTypeID = 0xb1b12cea - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeProxy) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeProxy. -var ( - _ bin.Encoder = &InternalLinkTypeProxy{} - _ bin.Decoder = &InternalLinkTypeProxy{} - _ bin.BareEncoder = &InternalLinkTypeProxy{} - _ bin.BareDecoder = &InternalLinkTypeProxy{} - - _ InternalLinkTypeClass = &InternalLinkTypeProxy{} -) - -func (i *InternalLinkTypeProxy) Zero() bool { - if i == nil { - return true - } - if !(i.Server == "") { - return false - } - if !(i.Port == 0) { - return false - } - if !(i.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeProxy) String() string { - if i == nil { - return "InternalLinkTypeProxy(nil)" - } - type Alias InternalLinkTypeProxy - return fmt.Sprintf("InternalLinkTypeProxy%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeProxy) TypeID() uint32 { - return InternalLinkTypeProxyTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeProxy) TypeName() string { - return "internalLinkTypeProxy" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeProxy) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeProxy", - ID: InternalLinkTypeProxyTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Server", - SchemaName: "server", - }, - { - Name: "Port", - SchemaName: "port", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeProxy) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeProxy#b1b12cea as nil") - } - b.PutID(InternalLinkTypeProxyTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeProxy) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeProxy#b1b12cea as nil") - } - b.PutString(i.Server) - b.PutInt32(i.Port) - if i.Type == nil { - return fmt.Errorf("unable to encode internalLinkTypeProxy#b1b12cea: field type is nil") - } - if err := i.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeProxy#b1b12cea: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeProxy) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeProxy#b1b12cea to nil") - } - if err := b.ConsumeID(InternalLinkTypeProxyTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeProxy) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeProxy#b1b12cea to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field server: %w", err) - } - i.Server = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field port: %w", err) - } - i.Port = value - } - { - value, err := DecodeProxyType(b) - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field type: %w", err) - } - i.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeProxy) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeProxy#b1b12cea as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeProxy") - b.Comma() - b.FieldStart("server") - b.PutString(i.Server) - b.Comma() - b.FieldStart("port") - b.PutInt32(i.Port) - b.Comma() - b.FieldStart("type") - if i.Type == nil { - return fmt.Errorf("unable to encode internalLinkTypeProxy#b1b12cea: field type is nil") - } - if err := i.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeProxy#b1b12cea: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeProxy) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeProxy#b1b12cea to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeProxy"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: %w", err) - } - case "server": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field server: %w", err) - } - i.Server = value - case "port": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field port: %w", err) - } - i.Port = value - case "type": - value, err := DecodeTDLibJSONProxyType(b) - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeProxy#b1b12cea: field type: %w", err) - } - i.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetServer returns value of Server field. -func (i *InternalLinkTypeProxy) GetServer() (value string) { - if i == nil { - return - } - return i.Server -} - -// GetPort returns value of Port field. -func (i *InternalLinkTypeProxy) GetPort() (value int32) { - if i == nil { - return - } - return i.Port -} - -// GetType returns value of Type field. -func (i *InternalLinkTypeProxy) GetType() (value ProxyTypeClass) { - if i == nil { - return - } - return i.Type -} - -// InternalLinkTypePublicChat represents TL type `internalLinkTypePublicChat#697a2d00`. -type InternalLinkTypePublicChat struct { - // Username of the chat - ChatUsername string - // Draft text for message to send in the chat - DraftText string - // True, if chat profile information screen must be opened; otherwise, the chat itself - // must be opened - OpenProfile bool -} - -// InternalLinkTypePublicChatTypeID is TL type id of InternalLinkTypePublicChat. -const InternalLinkTypePublicChatTypeID = 0x697a2d00 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypePublicChat) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypePublicChat. -var ( - _ bin.Encoder = &InternalLinkTypePublicChat{} - _ bin.Decoder = &InternalLinkTypePublicChat{} - _ bin.BareEncoder = &InternalLinkTypePublicChat{} - _ bin.BareDecoder = &InternalLinkTypePublicChat{} - - _ InternalLinkTypeClass = &InternalLinkTypePublicChat{} -) - -func (i *InternalLinkTypePublicChat) Zero() bool { - if i == nil { - return true - } - if !(i.ChatUsername == "") { - return false - } - if !(i.DraftText == "") { - return false - } - if !(i.OpenProfile == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypePublicChat) String() string { - if i == nil { - return "InternalLinkTypePublicChat(nil)" - } - type Alias InternalLinkTypePublicChat - return fmt.Sprintf("InternalLinkTypePublicChat%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypePublicChat) TypeID() uint32 { - return InternalLinkTypePublicChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypePublicChat) TypeName() string { - return "internalLinkTypePublicChat" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypePublicChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypePublicChat", - ID: InternalLinkTypePublicChatTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatUsername", - SchemaName: "chat_username", - }, - { - Name: "DraftText", - SchemaName: "draft_text", - }, - { - Name: "OpenProfile", - SchemaName: "open_profile", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypePublicChat) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePublicChat#697a2d00 as nil") - } - b.PutID(InternalLinkTypePublicChatTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypePublicChat) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePublicChat#697a2d00 as nil") - } - b.PutString(i.ChatUsername) - b.PutString(i.DraftText) - b.PutBool(i.OpenProfile) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypePublicChat) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePublicChat#697a2d00 to nil") - } - if err := b.ConsumeID(InternalLinkTypePublicChatTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypePublicChat) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePublicChat#697a2d00 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field chat_username: %w", err) - } - i.ChatUsername = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field draft_text: %w", err) - } - i.DraftText = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field open_profile: %w", err) - } - i.OpenProfile = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypePublicChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypePublicChat#697a2d00 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypePublicChat") - b.Comma() - b.FieldStart("chat_username") - b.PutString(i.ChatUsername) - b.Comma() - b.FieldStart("draft_text") - b.PutString(i.DraftText) - b.Comma() - b.FieldStart("open_profile") - b.PutBool(i.OpenProfile) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypePublicChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypePublicChat#697a2d00 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypePublicChat"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: %w", err) - } - case "chat_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field chat_username: %w", err) - } - i.ChatUsername = value - case "draft_text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field draft_text: %w", err) - } - i.DraftText = value - case "open_profile": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypePublicChat#697a2d00: field open_profile: %w", err) - } - i.OpenProfile = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatUsername returns value of ChatUsername field. -func (i *InternalLinkTypePublicChat) GetChatUsername() (value string) { - if i == nil { - return - } - return i.ChatUsername -} - -// GetDraftText returns value of DraftText field. -func (i *InternalLinkTypePublicChat) GetDraftText() (value string) { - if i == nil { - return - } - return i.DraftText -} - -// GetOpenProfile returns value of OpenProfile field. -func (i *InternalLinkTypePublicChat) GetOpenProfile() (value bool) { - if i == nil { - return - } - return i.OpenProfile -} - -// InternalLinkTypeQrCodeAuthentication represents TL type `internalLinkTypeQrCodeAuthentication#bf121924`. -type InternalLinkTypeQrCodeAuthentication struct { -} - -// InternalLinkTypeQrCodeAuthenticationTypeID is TL type id of InternalLinkTypeQrCodeAuthentication. -const InternalLinkTypeQrCodeAuthenticationTypeID = 0xbf121924 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeQrCodeAuthentication) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeQrCodeAuthentication. -var ( - _ bin.Encoder = &InternalLinkTypeQrCodeAuthentication{} - _ bin.Decoder = &InternalLinkTypeQrCodeAuthentication{} - _ bin.BareEncoder = &InternalLinkTypeQrCodeAuthentication{} - _ bin.BareDecoder = &InternalLinkTypeQrCodeAuthentication{} - - _ InternalLinkTypeClass = &InternalLinkTypeQrCodeAuthentication{} -) - -func (i *InternalLinkTypeQrCodeAuthentication) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeQrCodeAuthentication) String() string { - if i == nil { - return "InternalLinkTypeQrCodeAuthentication(nil)" - } - type Alias InternalLinkTypeQrCodeAuthentication - return fmt.Sprintf("InternalLinkTypeQrCodeAuthentication%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeQrCodeAuthentication) TypeID() uint32 { - return InternalLinkTypeQrCodeAuthenticationTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeQrCodeAuthentication) TypeName() string { - return "internalLinkTypeQrCodeAuthentication" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeQrCodeAuthentication) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeQrCodeAuthentication", - ID: InternalLinkTypeQrCodeAuthenticationTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeQrCodeAuthentication) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeQrCodeAuthentication#bf121924 as nil") - } - b.PutID(InternalLinkTypeQrCodeAuthenticationTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeQrCodeAuthentication) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeQrCodeAuthentication#bf121924 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeQrCodeAuthentication) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeQrCodeAuthentication#bf121924 to nil") - } - if err := b.ConsumeID(InternalLinkTypeQrCodeAuthenticationTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeQrCodeAuthentication#bf121924: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeQrCodeAuthentication) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeQrCodeAuthentication#bf121924 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeQrCodeAuthentication) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeQrCodeAuthentication#bf121924 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeQrCodeAuthentication") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeQrCodeAuthentication) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeQrCodeAuthentication#bf121924 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeQrCodeAuthentication"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeQrCodeAuthentication#bf121924: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeRestorePurchases represents TL type `internalLinkTypeRestorePurchases#24203483`. -type InternalLinkTypeRestorePurchases struct { -} - -// InternalLinkTypeRestorePurchasesTypeID is TL type id of InternalLinkTypeRestorePurchases. -const InternalLinkTypeRestorePurchasesTypeID = 0x24203483 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeRestorePurchases) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeRestorePurchases. -var ( - _ bin.Encoder = &InternalLinkTypeRestorePurchases{} - _ bin.Decoder = &InternalLinkTypeRestorePurchases{} - _ bin.BareEncoder = &InternalLinkTypeRestorePurchases{} - _ bin.BareDecoder = &InternalLinkTypeRestorePurchases{} - - _ InternalLinkTypeClass = &InternalLinkTypeRestorePurchases{} -) - -func (i *InternalLinkTypeRestorePurchases) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeRestorePurchases) String() string { - if i == nil { - return "InternalLinkTypeRestorePurchases(nil)" - } - type Alias InternalLinkTypeRestorePurchases - return fmt.Sprintf("InternalLinkTypeRestorePurchases%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeRestorePurchases) TypeID() uint32 { - return InternalLinkTypeRestorePurchasesTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeRestorePurchases) TypeName() string { - return "internalLinkTypeRestorePurchases" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeRestorePurchases) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeRestorePurchases", - ID: InternalLinkTypeRestorePurchasesTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeRestorePurchases) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeRestorePurchases#24203483 as nil") - } - b.PutID(InternalLinkTypeRestorePurchasesTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeRestorePurchases) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeRestorePurchases#24203483 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeRestorePurchases) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeRestorePurchases#24203483 to nil") - } - if err := b.ConsumeID(InternalLinkTypeRestorePurchasesTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeRestorePurchases#24203483: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeRestorePurchases) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeRestorePurchases#24203483 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeRestorePurchases) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeRestorePurchases#24203483 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeRestorePurchases") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeRestorePurchases) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeRestorePurchases#24203483 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeRestorePurchases"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeRestorePurchases#24203483: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeSettings represents TL type `internalLinkTypeSettings#177545b4`. -type InternalLinkTypeSettings struct { -} - -// InternalLinkTypeSettingsTypeID is TL type id of InternalLinkTypeSettings. -const InternalLinkTypeSettingsTypeID = 0x177545b4 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeSettings) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeSettings. -var ( - _ bin.Encoder = &InternalLinkTypeSettings{} - _ bin.Decoder = &InternalLinkTypeSettings{} - _ bin.BareEncoder = &InternalLinkTypeSettings{} - _ bin.BareDecoder = &InternalLinkTypeSettings{} - - _ InternalLinkTypeClass = &InternalLinkTypeSettings{} -) - -func (i *InternalLinkTypeSettings) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeSettings) String() string { - if i == nil { - return "InternalLinkTypeSettings(nil)" - } - type Alias InternalLinkTypeSettings - return fmt.Sprintf("InternalLinkTypeSettings%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeSettings) TypeID() uint32 { - return InternalLinkTypeSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeSettings) TypeName() string { - return "internalLinkTypeSettings" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeSettings", - ID: InternalLinkTypeSettingsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeSettings) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeSettings#177545b4 as nil") - } - b.PutID(InternalLinkTypeSettingsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeSettings) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeSettings#177545b4 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeSettings) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeSettings#177545b4 to nil") - } - if err := b.ConsumeID(InternalLinkTypeSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeSettings#177545b4: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeSettings) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeSettings#177545b4 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeSettings#177545b4 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeSettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeSettings#177545b4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeSettings"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeSettings#177545b4: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeStickerSet represents TL type `internalLinkTypeStickerSet#a1464fa2`. -type InternalLinkTypeStickerSet struct { - // Name of the sticker set - StickerSetName string - // True, if the sticker set is expected to contain custom emoji - ExpectCustomEmoji bool -} - -// InternalLinkTypeStickerSetTypeID is TL type id of InternalLinkTypeStickerSet. -const InternalLinkTypeStickerSetTypeID = 0xa1464fa2 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeStickerSet) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeStickerSet. -var ( - _ bin.Encoder = &InternalLinkTypeStickerSet{} - _ bin.Decoder = &InternalLinkTypeStickerSet{} - _ bin.BareEncoder = &InternalLinkTypeStickerSet{} - _ bin.BareDecoder = &InternalLinkTypeStickerSet{} - - _ InternalLinkTypeClass = &InternalLinkTypeStickerSet{} -) - -func (i *InternalLinkTypeStickerSet) Zero() bool { - if i == nil { - return true - } - if !(i.StickerSetName == "") { - return false - } - if !(i.ExpectCustomEmoji == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeStickerSet) String() string { - if i == nil { - return "InternalLinkTypeStickerSet(nil)" - } - type Alias InternalLinkTypeStickerSet - return fmt.Sprintf("InternalLinkTypeStickerSet%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeStickerSet) TypeID() uint32 { - return InternalLinkTypeStickerSetTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeStickerSet) TypeName() string { - return "internalLinkTypeStickerSet" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeStickerSet) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeStickerSet", - ID: InternalLinkTypeStickerSetTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerSetName", - SchemaName: "sticker_set_name", - }, - { - Name: "ExpectCustomEmoji", - SchemaName: "expect_custom_emoji", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeStickerSet) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeStickerSet#a1464fa2 as nil") - } - b.PutID(InternalLinkTypeStickerSetTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeStickerSet) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeStickerSet#a1464fa2 as nil") - } - b.PutString(i.StickerSetName) - b.PutBool(i.ExpectCustomEmoji) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeStickerSet) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeStickerSet#a1464fa2 to nil") - } - if err := b.ConsumeID(InternalLinkTypeStickerSetTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStickerSet#a1464fa2: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeStickerSet) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeStickerSet#a1464fa2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStickerSet#a1464fa2: field sticker_set_name: %w", err) - } - i.StickerSetName = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStickerSet#a1464fa2: field expect_custom_emoji: %w", err) - } - i.ExpectCustomEmoji = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeStickerSet) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeStickerSet#a1464fa2 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeStickerSet") - b.Comma() - b.FieldStart("sticker_set_name") - b.PutString(i.StickerSetName) - b.Comma() - b.FieldStart("expect_custom_emoji") - b.PutBool(i.ExpectCustomEmoji) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeStickerSet) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeStickerSet#a1464fa2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeStickerSet"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStickerSet#a1464fa2: %w", err) - } - case "sticker_set_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStickerSet#a1464fa2: field sticker_set_name: %w", err) - } - i.StickerSetName = value - case "expect_custom_emoji": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStickerSet#a1464fa2: field expect_custom_emoji: %w", err) - } - i.ExpectCustomEmoji = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerSetName returns value of StickerSetName field. -func (i *InternalLinkTypeStickerSet) GetStickerSetName() (value string) { - if i == nil { - return - } - return i.StickerSetName -} - -// GetExpectCustomEmoji returns value of ExpectCustomEmoji field. -func (i *InternalLinkTypeStickerSet) GetExpectCustomEmoji() (value bool) { - if i == nil { - return - } - return i.ExpectCustomEmoji -} - -// InternalLinkTypeStory represents TL type `internalLinkTypeStory#57bce647`. -type InternalLinkTypeStory struct { - // Username of the sender of the story - StorySenderUsername string - // Story identifier - StoryID int32 -} - -// InternalLinkTypeStoryTypeID is TL type id of InternalLinkTypeStory. -const InternalLinkTypeStoryTypeID = 0x57bce647 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeStory) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeStory. -var ( - _ bin.Encoder = &InternalLinkTypeStory{} - _ bin.Decoder = &InternalLinkTypeStory{} - _ bin.BareEncoder = &InternalLinkTypeStory{} - _ bin.BareDecoder = &InternalLinkTypeStory{} - - _ InternalLinkTypeClass = &InternalLinkTypeStory{} -) - -func (i *InternalLinkTypeStory) Zero() bool { - if i == nil { - return true - } - if !(i.StorySenderUsername == "") { - return false - } - if !(i.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeStory) String() string { - if i == nil { - return "InternalLinkTypeStory(nil)" - } - type Alias InternalLinkTypeStory - return fmt.Sprintf("InternalLinkTypeStory%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeStory) TypeID() uint32 { - return InternalLinkTypeStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeStory) TypeName() string { - return "internalLinkTypeStory" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeStory", - ID: InternalLinkTypeStoryTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderUsername", - SchemaName: "story_sender_username", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeStory) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeStory#57bce647 as nil") - } - b.PutID(InternalLinkTypeStoryTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeStory) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeStory#57bce647 as nil") - } - b.PutString(i.StorySenderUsername) - b.PutInt32(i.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeStory) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeStory#57bce647 to nil") - } - if err := b.ConsumeID(InternalLinkTypeStoryTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStory#57bce647: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeStory) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeStory#57bce647 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStory#57bce647: field story_sender_username: %w", err) - } - i.StorySenderUsername = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStory#57bce647: field story_id: %w", err) - } - i.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeStory#57bce647 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeStory") - b.Comma() - b.FieldStart("story_sender_username") - b.PutString(i.StorySenderUsername) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(i.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeStory#57bce647 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeStory"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStory#57bce647: %w", err) - } - case "story_sender_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStory#57bce647: field story_sender_username: %w", err) - } - i.StorySenderUsername = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeStory#57bce647: field story_id: %w", err) - } - i.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderUsername returns value of StorySenderUsername field. -func (i *InternalLinkTypeStory) GetStorySenderUsername() (value string) { - if i == nil { - return - } - return i.StorySenderUsername -} - -// GetStoryID returns value of StoryID field. -func (i *InternalLinkTypeStory) GetStoryID() (value int32) { - if i == nil { - return - } - return i.StoryID -} - -// InternalLinkTypeTheme represents TL type `internalLinkTypeTheme#f405f807`. -type InternalLinkTypeTheme struct { - // Name of the theme - ThemeName string -} - -// InternalLinkTypeThemeTypeID is TL type id of InternalLinkTypeTheme. -const InternalLinkTypeThemeTypeID = 0xf405f807 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeTheme) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeTheme. -var ( - _ bin.Encoder = &InternalLinkTypeTheme{} - _ bin.Decoder = &InternalLinkTypeTheme{} - _ bin.BareEncoder = &InternalLinkTypeTheme{} - _ bin.BareDecoder = &InternalLinkTypeTheme{} - - _ InternalLinkTypeClass = &InternalLinkTypeTheme{} -) - -func (i *InternalLinkTypeTheme) Zero() bool { - if i == nil { - return true - } - if !(i.ThemeName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeTheme) String() string { - if i == nil { - return "InternalLinkTypeTheme(nil)" - } - type Alias InternalLinkTypeTheme - return fmt.Sprintf("InternalLinkTypeTheme%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeTheme) TypeID() uint32 { - return InternalLinkTypeThemeTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeTheme) TypeName() string { - return "internalLinkTypeTheme" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeTheme) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeTheme", - ID: InternalLinkTypeThemeTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ThemeName", - SchemaName: "theme_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeTheme) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeTheme#f405f807 as nil") - } - b.PutID(InternalLinkTypeThemeTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeTheme) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeTheme#f405f807 as nil") - } - b.PutString(i.ThemeName) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeTheme) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeTheme#f405f807 to nil") - } - if err := b.ConsumeID(InternalLinkTypeThemeTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeTheme#f405f807: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeTheme) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeTheme#f405f807 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeTheme#f405f807: field theme_name: %w", err) - } - i.ThemeName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeTheme) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeTheme#f405f807 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeTheme") - b.Comma() - b.FieldStart("theme_name") - b.PutString(i.ThemeName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeTheme) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeTheme#f405f807 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeTheme"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeTheme#f405f807: %w", err) - } - case "theme_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeTheme#f405f807: field theme_name: %w", err) - } - i.ThemeName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetThemeName returns value of ThemeName field. -func (i *InternalLinkTypeTheme) GetThemeName() (value string) { - if i == nil { - return - } - return i.ThemeName -} - -// InternalLinkTypeThemeSettings represents TL type `internalLinkTypeThemeSettings#c14d3916`. -type InternalLinkTypeThemeSettings struct { -} - -// InternalLinkTypeThemeSettingsTypeID is TL type id of InternalLinkTypeThemeSettings. -const InternalLinkTypeThemeSettingsTypeID = 0xc14d3916 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeThemeSettings) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeThemeSettings. -var ( - _ bin.Encoder = &InternalLinkTypeThemeSettings{} - _ bin.Decoder = &InternalLinkTypeThemeSettings{} - _ bin.BareEncoder = &InternalLinkTypeThemeSettings{} - _ bin.BareDecoder = &InternalLinkTypeThemeSettings{} - - _ InternalLinkTypeClass = &InternalLinkTypeThemeSettings{} -) - -func (i *InternalLinkTypeThemeSettings) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeThemeSettings) String() string { - if i == nil { - return "InternalLinkTypeThemeSettings(nil)" - } - type Alias InternalLinkTypeThemeSettings - return fmt.Sprintf("InternalLinkTypeThemeSettings%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeThemeSettings) TypeID() uint32 { - return InternalLinkTypeThemeSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeThemeSettings) TypeName() string { - return "internalLinkTypeThemeSettings" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeThemeSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeThemeSettings", - ID: InternalLinkTypeThemeSettingsTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeThemeSettings) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeThemeSettings#c14d3916 as nil") - } - b.PutID(InternalLinkTypeThemeSettingsTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeThemeSettings) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeThemeSettings#c14d3916 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeThemeSettings) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeThemeSettings#c14d3916 to nil") - } - if err := b.ConsumeID(InternalLinkTypeThemeSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeThemeSettings#c14d3916: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeThemeSettings) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeThemeSettings#c14d3916 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeThemeSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeThemeSettings#c14d3916 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeThemeSettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeThemeSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeThemeSettings#c14d3916 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeThemeSettings"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeThemeSettings#c14d3916: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeUnknownDeepLink represents TL type `internalLinkTypeUnknownDeepLink#2549d7db`. -type InternalLinkTypeUnknownDeepLink struct { - // Link to be passed to getDeepLinkInfo - Link string -} - -// InternalLinkTypeUnknownDeepLinkTypeID is TL type id of InternalLinkTypeUnknownDeepLink. -const InternalLinkTypeUnknownDeepLinkTypeID = 0x2549d7db - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeUnknownDeepLink) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeUnknownDeepLink. -var ( - _ bin.Encoder = &InternalLinkTypeUnknownDeepLink{} - _ bin.Decoder = &InternalLinkTypeUnknownDeepLink{} - _ bin.BareEncoder = &InternalLinkTypeUnknownDeepLink{} - _ bin.BareDecoder = &InternalLinkTypeUnknownDeepLink{} - - _ InternalLinkTypeClass = &InternalLinkTypeUnknownDeepLink{} -) - -func (i *InternalLinkTypeUnknownDeepLink) Zero() bool { - if i == nil { - return true - } - if !(i.Link == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeUnknownDeepLink) String() string { - if i == nil { - return "InternalLinkTypeUnknownDeepLink(nil)" - } - type Alias InternalLinkTypeUnknownDeepLink - return fmt.Sprintf("InternalLinkTypeUnknownDeepLink%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeUnknownDeepLink) TypeID() uint32 { - return InternalLinkTypeUnknownDeepLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeUnknownDeepLink) TypeName() string { - return "internalLinkTypeUnknownDeepLink" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeUnknownDeepLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeUnknownDeepLink", - ID: InternalLinkTypeUnknownDeepLinkTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeUnknownDeepLink) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUnknownDeepLink#2549d7db as nil") - } - b.PutID(InternalLinkTypeUnknownDeepLinkTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeUnknownDeepLink) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUnknownDeepLink#2549d7db as nil") - } - b.PutString(i.Link) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeUnknownDeepLink) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUnknownDeepLink#2549d7db to nil") - } - if err := b.ConsumeID(InternalLinkTypeUnknownDeepLinkTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUnknownDeepLink#2549d7db: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeUnknownDeepLink) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUnknownDeepLink#2549d7db to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUnknownDeepLink#2549d7db: field link: %w", err) - } - i.Link = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeUnknownDeepLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUnknownDeepLink#2549d7db as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeUnknownDeepLink") - b.Comma() - b.FieldStart("link") - b.PutString(i.Link) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeUnknownDeepLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUnknownDeepLink#2549d7db to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeUnknownDeepLink"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUnknownDeepLink#2549d7db: %w", err) - } - case "link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUnknownDeepLink#2549d7db: field link: %w", err) - } - i.Link = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (i *InternalLinkTypeUnknownDeepLink) GetLink() (value string) { - if i == nil { - return - } - return i.Link -} - -// InternalLinkTypeUnsupportedProxy represents TL type `internalLinkTypeUnsupportedProxy#de399f09`. -type InternalLinkTypeUnsupportedProxy struct { -} - -// InternalLinkTypeUnsupportedProxyTypeID is TL type id of InternalLinkTypeUnsupportedProxy. -const InternalLinkTypeUnsupportedProxyTypeID = 0xde399f09 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeUnsupportedProxy) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeUnsupportedProxy. -var ( - _ bin.Encoder = &InternalLinkTypeUnsupportedProxy{} - _ bin.Decoder = &InternalLinkTypeUnsupportedProxy{} - _ bin.BareEncoder = &InternalLinkTypeUnsupportedProxy{} - _ bin.BareDecoder = &InternalLinkTypeUnsupportedProxy{} - - _ InternalLinkTypeClass = &InternalLinkTypeUnsupportedProxy{} -) - -func (i *InternalLinkTypeUnsupportedProxy) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeUnsupportedProxy) String() string { - if i == nil { - return "InternalLinkTypeUnsupportedProxy(nil)" - } - type Alias InternalLinkTypeUnsupportedProxy - return fmt.Sprintf("InternalLinkTypeUnsupportedProxy%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeUnsupportedProxy) TypeID() uint32 { - return InternalLinkTypeUnsupportedProxyTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeUnsupportedProxy) TypeName() string { - return "internalLinkTypeUnsupportedProxy" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeUnsupportedProxy) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeUnsupportedProxy", - ID: InternalLinkTypeUnsupportedProxyTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeUnsupportedProxy) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUnsupportedProxy#de399f09 as nil") - } - b.PutID(InternalLinkTypeUnsupportedProxyTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeUnsupportedProxy) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUnsupportedProxy#de399f09 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeUnsupportedProxy) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUnsupportedProxy#de399f09 to nil") - } - if err := b.ConsumeID(InternalLinkTypeUnsupportedProxyTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUnsupportedProxy#de399f09: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeUnsupportedProxy) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUnsupportedProxy#de399f09 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeUnsupportedProxy) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUnsupportedProxy#de399f09 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeUnsupportedProxy") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeUnsupportedProxy) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUnsupportedProxy#de399f09 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeUnsupportedProxy"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUnsupportedProxy#de399f09: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InternalLinkTypeUserPhoneNumber represents TL type `internalLinkTypeUserPhoneNumber#104bbb08`. -type InternalLinkTypeUserPhoneNumber struct { - // Phone number of the user - PhoneNumber string - // Draft text for message to send in the chat - DraftText string - // True, if user's profile information screen must be opened; otherwise, the chat itself - // must be opened - OpenProfile bool -} - -// InternalLinkTypeUserPhoneNumberTypeID is TL type id of InternalLinkTypeUserPhoneNumber. -const InternalLinkTypeUserPhoneNumberTypeID = 0x104bbb08 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeUserPhoneNumber) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeUserPhoneNumber. -var ( - _ bin.Encoder = &InternalLinkTypeUserPhoneNumber{} - _ bin.Decoder = &InternalLinkTypeUserPhoneNumber{} - _ bin.BareEncoder = &InternalLinkTypeUserPhoneNumber{} - _ bin.BareDecoder = &InternalLinkTypeUserPhoneNumber{} - - _ InternalLinkTypeClass = &InternalLinkTypeUserPhoneNumber{} -) - -func (i *InternalLinkTypeUserPhoneNumber) Zero() bool { - if i == nil { - return true - } - if !(i.PhoneNumber == "") { - return false - } - if !(i.DraftText == "") { - return false - } - if !(i.OpenProfile == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeUserPhoneNumber) String() string { - if i == nil { - return "InternalLinkTypeUserPhoneNumber(nil)" - } - type Alias InternalLinkTypeUserPhoneNumber - return fmt.Sprintf("InternalLinkTypeUserPhoneNumber%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeUserPhoneNumber) TypeID() uint32 { - return InternalLinkTypeUserPhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeUserPhoneNumber) TypeName() string { - return "internalLinkTypeUserPhoneNumber" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeUserPhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeUserPhoneNumber", - ID: InternalLinkTypeUserPhoneNumberTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - { - Name: "DraftText", - SchemaName: "draft_text", - }, - { - Name: "OpenProfile", - SchemaName: "open_profile", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeUserPhoneNumber) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#104bbb08 as nil") - } - b.PutID(InternalLinkTypeUserPhoneNumberTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeUserPhoneNumber) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#104bbb08 as nil") - } - b.PutString(i.PhoneNumber) - b.PutString(i.DraftText) - b.PutBool(i.OpenProfile) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeUserPhoneNumber) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#104bbb08 to nil") - } - if err := b.ConsumeID(InternalLinkTypeUserPhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeUserPhoneNumber) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#104bbb08 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field phone_number: %w", err) - } - i.PhoneNumber = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field draft_text: %w", err) - } - i.DraftText = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field open_profile: %w", err) - } - i.OpenProfile = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeUserPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUserPhoneNumber#104bbb08 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeUserPhoneNumber") - b.Comma() - b.FieldStart("phone_number") - b.PutString(i.PhoneNumber) - b.Comma() - b.FieldStart("draft_text") - b.PutString(i.DraftText) - b.Comma() - b.FieldStart("open_profile") - b.PutBool(i.OpenProfile) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeUserPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUserPhoneNumber#104bbb08 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeUserPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: %w", err) - } - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field phone_number: %w", err) - } - i.PhoneNumber = value - case "draft_text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field draft_text: %w", err) - } - i.DraftText = value - case "open_profile": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserPhoneNumber#104bbb08: field open_profile: %w", err) - } - i.OpenProfile = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (i *InternalLinkTypeUserPhoneNumber) GetPhoneNumber() (value string) { - if i == nil { - return - } - return i.PhoneNumber -} - -// GetDraftText returns value of DraftText field. -func (i *InternalLinkTypeUserPhoneNumber) GetDraftText() (value string) { - if i == nil { - return - } - return i.DraftText -} - -// GetOpenProfile returns value of OpenProfile field. -func (i *InternalLinkTypeUserPhoneNumber) GetOpenProfile() (value bool) { - if i == nil { - return - } - return i.OpenProfile -} - -// InternalLinkTypeUserToken represents TL type `internalLinkTypeUserToken#a8d7db59`. -type InternalLinkTypeUserToken struct { - // The token - Token string -} - -// InternalLinkTypeUserTokenTypeID is TL type id of InternalLinkTypeUserToken. -const InternalLinkTypeUserTokenTypeID = 0xa8d7db59 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeUserToken) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeUserToken. -var ( - _ bin.Encoder = &InternalLinkTypeUserToken{} - _ bin.Decoder = &InternalLinkTypeUserToken{} - _ bin.BareEncoder = &InternalLinkTypeUserToken{} - _ bin.BareDecoder = &InternalLinkTypeUserToken{} - - _ InternalLinkTypeClass = &InternalLinkTypeUserToken{} -) - -func (i *InternalLinkTypeUserToken) Zero() bool { - if i == nil { - return true - } - if !(i.Token == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeUserToken) String() string { - if i == nil { - return "InternalLinkTypeUserToken(nil)" - } - type Alias InternalLinkTypeUserToken - return fmt.Sprintf("InternalLinkTypeUserToken%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeUserToken) TypeID() uint32 { - return InternalLinkTypeUserTokenTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeUserToken) TypeName() string { - return "internalLinkTypeUserToken" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeUserToken) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeUserToken", - ID: InternalLinkTypeUserTokenTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeUserToken) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUserToken#a8d7db59 as nil") - } - b.PutID(InternalLinkTypeUserTokenTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeUserToken) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUserToken#a8d7db59 as nil") - } - b.PutString(i.Token) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeUserToken) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUserToken#a8d7db59 to nil") - } - if err := b.ConsumeID(InternalLinkTypeUserTokenTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserToken#a8d7db59: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeUserToken) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUserToken#a8d7db59 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserToken#a8d7db59: field token: %w", err) - } - i.Token = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeUserToken) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeUserToken#a8d7db59 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeUserToken") - b.Comma() - b.FieldStart("token") - b.PutString(i.Token) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeUserToken) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeUserToken#a8d7db59 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeUserToken"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserToken#a8d7db59: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeUserToken#a8d7db59: field token: %w", err) - } - i.Token = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (i *InternalLinkTypeUserToken) GetToken() (value string) { - if i == nil { - return - } - return i.Token -} - -// InternalLinkTypeVideoChat represents TL type `internalLinkTypeVideoChat#8796f8b4`. -type InternalLinkTypeVideoChat struct { - // Username of the chat with the video chat - ChatUsername string - // If non-empty, invite hash to be used to join the video chat without being muted by - // administrators - InviteHash string - // True, if the video chat is expected to be a live stream in a channel or a broadcast - // group - IsLiveStream bool -} - -// InternalLinkTypeVideoChatTypeID is TL type id of InternalLinkTypeVideoChat. -const InternalLinkTypeVideoChatTypeID = 0x8796f8b4 - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeVideoChat) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeVideoChat. -var ( - _ bin.Encoder = &InternalLinkTypeVideoChat{} - _ bin.Decoder = &InternalLinkTypeVideoChat{} - _ bin.BareEncoder = &InternalLinkTypeVideoChat{} - _ bin.BareDecoder = &InternalLinkTypeVideoChat{} - - _ InternalLinkTypeClass = &InternalLinkTypeVideoChat{} -) - -func (i *InternalLinkTypeVideoChat) Zero() bool { - if i == nil { - return true - } - if !(i.ChatUsername == "") { - return false - } - if !(i.InviteHash == "") { - return false - } - if !(i.IsLiveStream == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeVideoChat) String() string { - if i == nil { - return "InternalLinkTypeVideoChat(nil)" - } - type Alias InternalLinkTypeVideoChat - return fmt.Sprintf("InternalLinkTypeVideoChat%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeVideoChat) TypeID() uint32 { - return InternalLinkTypeVideoChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeVideoChat) TypeName() string { - return "internalLinkTypeVideoChat" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeVideoChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeVideoChat", - ID: InternalLinkTypeVideoChatTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatUsername", - SchemaName: "chat_username", - }, - { - Name: "InviteHash", - SchemaName: "invite_hash", - }, - { - Name: "IsLiveStream", - SchemaName: "is_live_stream", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeVideoChat) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeVideoChat#8796f8b4 as nil") - } - b.PutID(InternalLinkTypeVideoChatTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeVideoChat) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeVideoChat#8796f8b4 as nil") - } - b.PutString(i.ChatUsername) - b.PutString(i.InviteHash) - b.PutBool(i.IsLiveStream) - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeVideoChat) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeVideoChat#8796f8b4 to nil") - } - if err := b.ConsumeID(InternalLinkTypeVideoChatTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeVideoChat) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeVideoChat#8796f8b4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field chat_username: %w", err) - } - i.ChatUsername = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field invite_hash: %w", err) - } - i.InviteHash = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field is_live_stream: %w", err) - } - i.IsLiveStream = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeVideoChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeVideoChat#8796f8b4 as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeVideoChat") - b.Comma() - b.FieldStart("chat_username") - b.PutString(i.ChatUsername) - b.Comma() - b.FieldStart("invite_hash") - b.PutString(i.InviteHash) - b.Comma() - b.FieldStart("is_live_stream") - b.PutBool(i.IsLiveStream) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeVideoChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeVideoChat#8796f8b4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeVideoChat"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: %w", err) - } - case "chat_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field chat_username: %w", err) - } - i.ChatUsername = value - case "invite_hash": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field invite_hash: %w", err) - } - i.InviteHash = value - case "is_live_stream": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeVideoChat#8796f8b4: field is_live_stream: %w", err) - } - i.IsLiveStream = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatUsername returns value of ChatUsername field. -func (i *InternalLinkTypeVideoChat) GetChatUsername() (value string) { - if i == nil { - return - } - return i.ChatUsername -} - -// GetInviteHash returns value of InviteHash field. -func (i *InternalLinkTypeVideoChat) GetInviteHash() (value string) { - if i == nil { - return - } - return i.InviteHash -} - -// GetIsLiveStream returns value of IsLiveStream field. -func (i *InternalLinkTypeVideoChat) GetIsLiveStream() (value bool) { - if i == nil { - return - } - return i.IsLiveStream -} - -// InternalLinkTypeWebApp represents TL type `internalLinkTypeWebApp#7ae9552d`. -type InternalLinkTypeWebApp struct { - // Username of the bot that owns the Web App - BotUsername string - // Short name of the Web App - WebAppShortName string - // Start parameter to be passed to getWebAppLinkUrl - StartParameter string - // The mode in which the Web App must be opened - Mode WebAppOpenModeClass -} - -// InternalLinkTypeWebAppTypeID is TL type id of InternalLinkTypeWebApp. -const InternalLinkTypeWebAppTypeID = 0x7ae9552d - -// construct implements constructor of InternalLinkTypeClass. -func (i InternalLinkTypeWebApp) construct() InternalLinkTypeClass { return &i } - -// Ensuring interfaces in compile-time for InternalLinkTypeWebApp. -var ( - _ bin.Encoder = &InternalLinkTypeWebApp{} - _ bin.Decoder = &InternalLinkTypeWebApp{} - _ bin.BareEncoder = &InternalLinkTypeWebApp{} - _ bin.BareDecoder = &InternalLinkTypeWebApp{} - - _ InternalLinkTypeClass = &InternalLinkTypeWebApp{} -) - -func (i *InternalLinkTypeWebApp) Zero() bool { - if i == nil { - return true - } - if !(i.BotUsername == "") { - return false - } - if !(i.WebAppShortName == "") { - return false - } - if !(i.StartParameter == "") { - return false - } - if !(i.Mode == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InternalLinkTypeWebApp) String() string { - if i == nil { - return "InternalLinkTypeWebApp(nil)" - } - type Alias InternalLinkTypeWebApp - return fmt.Sprintf("InternalLinkTypeWebApp%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InternalLinkTypeWebApp) TypeID() uint32 { - return InternalLinkTypeWebAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*InternalLinkTypeWebApp) TypeName() string { - return "internalLinkTypeWebApp" -} - -// TypeInfo returns info about TL type. -func (i *InternalLinkTypeWebApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "internalLinkTypeWebApp", - ID: InternalLinkTypeWebAppTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUsername", - SchemaName: "bot_username", - }, - { - Name: "WebAppShortName", - SchemaName: "web_app_short_name", - }, - { - Name: "StartParameter", - SchemaName: "start_parameter", - }, - { - Name: "Mode", - SchemaName: "mode", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InternalLinkTypeWebApp) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeWebApp#7ae9552d as nil") - } - b.PutID(InternalLinkTypeWebAppTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InternalLinkTypeWebApp) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeWebApp#7ae9552d as nil") - } - b.PutString(i.BotUsername) - b.PutString(i.WebAppShortName) - b.PutString(i.StartParameter) - if i.Mode == nil { - return fmt.Errorf("unable to encode internalLinkTypeWebApp#7ae9552d: field mode is nil") - } - if err := i.Mode.Encode(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeWebApp#7ae9552d: field mode: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InternalLinkTypeWebApp) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeWebApp#7ae9552d to nil") - } - if err := b.ConsumeID(InternalLinkTypeWebAppTypeID); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InternalLinkTypeWebApp) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeWebApp#7ae9552d to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field bot_username: %w", err) - } - i.BotUsername = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field web_app_short_name: %w", err) - } - i.WebAppShortName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field start_parameter: %w", err) - } - i.StartParameter = value - } - { - value, err := DecodeWebAppOpenMode(b) - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field mode: %w", err) - } - i.Mode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InternalLinkTypeWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode internalLinkTypeWebApp#7ae9552d as nil") - } - b.ObjStart() - b.PutID("internalLinkTypeWebApp") - b.Comma() - b.FieldStart("bot_username") - b.PutString(i.BotUsername) - b.Comma() - b.FieldStart("web_app_short_name") - b.PutString(i.WebAppShortName) - b.Comma() - b.FieldStart("start_parameter") - b.PutString(i.StartParameter) - b.Comma() - b.FieldStart("mode") - if i.Mode == nil { - return fmt.Errorf("unable to encode internalLinkTypeWebApp#7ae9552d: field mode is nil") - } - if err := i.Mode.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode internalLinkTypeWebApp#7ae9552d: field mode: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InternalLinkTypeWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode internalLinkTypeWebApp#7ae9552d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("internalLinkTypeWebApp"); err != nil { - return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: %w", err) - } - case "bot_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field bot_username: %w", err) - } - i.BotUsername = value - case "web_app_short_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field web_app_short_name: %w", err) - } - i.WebAppShortName = value - case "start_parameter": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field start_parameter: %w", err) - } - i.StartParameter = value - case "mode": - value, err := DecodeTDLibJSONWebAppOpenMode(b) - if err != nil { - return fmt.Errorf("unable to decode internalLinkTypeWebApp#7ae9552d: field mode: %w", err) - } - i.Mode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUsername returns value of BotUsername field. -func (i *InternalLinkTypeWebApp) GetBotUsername() (value string) { - if i == nil { - return - } - return i.BotUsername -} - -// GetWebAppShortName returns value of WebAppShortName field. -func (i *InternalLinkTypeWebApp) GetWebAppShortName() (value string) { - if i == nil { - return - } - return i.WebAppShortName -} - -// GetStartParameter returns value of StartParameter field. -func (i *InternalLinkTypeWebApp) GetStartParameter() (value string) { - if i == nil { - return - } - return i.StartParameter -} - -// GetMode returns value of Mode field. -func (i *InternalLinkTypeWebApp) GetMode() (value WebAppOpenModeClass) { - if i == nil { - return - } - return i.Mode -} - -// InternalLinkTypeClassName is schema name of InternalLinkTypeClass. -const InternalLinkTypeClassName = "InternalLinkType" - -// InternalLinkTypeClass represents InternalLinkType generic type. -// -// Example: -// -// g, err := tdapi.DecodeInternalLinkType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InternalLinkTypeActiveSessions: // internalLinkTypeActiveSessions#706bbbad -// case *tdapi.InternalLinkTypeAttachmentMenuBot: // internalLinkTypeAttachmentMenuBot#644c4225 -// case *tdapi.InternalLinkTypeAuthenticationCode: // internalLinkTypeAuthenticationCode#f3874ff2 -// case *tdapi.InternalLinkTypeBackground: // internalLinkTypeBackground#b0d2908 -// case *tdapi.InternalLinkTypeBotAddToChannel: // internalLinkTypeBotAddToChannel#538ac2c0 -// case *tdapi.InternalLinkTypeBotStart: // internalLinkTypeBotStart#3f985fed -// case *tdapi.InternalLinkTypeBotStartInGroup: // internalLinkTypeBotStartInGroup#ca0d8cce -// case *tdapi.InternalLinkTypeBusinessChat: // internalLinkTypeBusinessChat#a03ae9d7 -// case *tdapi.InternalLinkTypeBuyStars: // internalLinkTypeBuyStars#a94cc347 -// case *tdapi.InternalLinkTypeChangePhoneNumber: // internalLinkTypeChangePhoneNumber#f0275b01 -// case *tdapi.InternalLinkTypeChatAffiliateProgram: // internalLinkTypeChatAffiliateProgram#25ac5024 -// case *tdapi.InternalLinkTypeChatBoost: // internalLinkTypeChatBoost#d549fd40 -// case *tdapi.InternalLinkTypeChatFolderInvite: // internalLinkTypeChatFolderInvite#89b2493e -// case *tdapi.InternalLinkTypeChatFolderSettings: // internalLinkTypeChatFolderSettings#bfff055c -// case *tdapi.InternalLinkTypeChatInvite: // internalLinkTypeChatInvite#198c3cd9 -// case *tdapi.InternalLinkTypeDefaultMessageAutoDeleteTimerSettings: // internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931 -// case *tdapi.InternalLinkTypeEditProfileSettings: // internalLinkTypeEditProfileSettings#c30e5066 -// case *tdapi.InternalLinkTypeGame: // internalLinkTypeGame#f074adcd -// case *tdapi.InternalLinkTypeInstantView: // internalLinkTypeInstantView#69e4df3f -// case *tdapi.InternalLinkTypeInvoice: // internalLinkTypeInvoice#f34c6dac -// case *tdapi.InternalLinkTypeLanguagePack: // internalLinkTypeLanguagePack#a9870d6c -// case *tdapi.InternalLinkTypeLanguageSettings: // internalLinkTypeLanguageSettings#b019e6e6 -// case *tdapi.InternalLinkTypeMainWebApp: // internalLinkTypeMainWebApp#5ddf72e9 -// case *tdapi.InternalLinkTypeMessage: // internalLinkTypeMessage#3a535c52 -// case *tdapi.InternalLinkTypeMessageDraft: // internalLinkTypeMessageDraft#276fbad5 -// case *tdapi.InternalLinkTypePassportDataRequest: // internalLinkTypePassportDataRequest#c50fce81 -// case *tdapi.InternalLinkTypePhoneNumberConfirmation: // internalLinkTypePhoneNumberConfirmation#68bf6b16 -// case *tdapi.InternalLinkTypePremiumFeatures: // internalLinkTypePremiumFeatures#48884f49 -// case *tdapi.InternalLinkTypePremiumGift: // internalLinkTypePremiumGift#5ad56d41 -// case *tdapi.InternalLinkTypePremiumGiftCode: // internalLinkTypePremiumGiftCode#de5c9892 -// case *tdapi.InternalLinkTypePrivacyAndSecuritySettings: // internalLinkTypePrivacyAndSecuritySettings#ad5f6acf -// case *tdapi.InternalLinkTypeProxy: // internalLinkTypeProxy#b1b12cea -// case *tdapi.InternalLinkTypePublicChat: // internalLinkTypePublicChat#697a2d00 -// case *tdapi.InternalLinkTypeQrCodeAuthentication: // internalLinkTypeQrCodeAuthentication#bf121924 -// case *tdapi.InternalLinkTypeRestorePurchases: // internalLinkTypeRestorePurchases#24203483 -// case *tdapi.InternalLinkTypeSettings: // internalLinkTypeSettings#177545b4 -// case *tdapi.InternalLinkTypeStickerSet: // internalLinkTypeStickerSet#a1464fa2 -// case *tdapi.InternalLinkTypeStory: // internalLinkTypeStory#57bce647 -// case *tdapi.InternalLinkTypeTheme: // internalLinkTypeTheme#f405f807 -// case *tdapi.InternalLinkTypeThemeSettings: // internalLinkTypeThemeSettings#c14d3916 -// case *tdapi.InternalLinkTypeUnknownDeepLink: // internalLinkTypeUnknownDeepLink#2549d7db -// case *tdapi.InternalLinkTypeUnsupportedProxy: // internalLinkTypeUnsupportedProxy#de399f09 -// case *tdapi.InternalLinkTypeUserPhoneNumber: // internalLinkTypeUserPhoneNumber#104bbb08 -// case *tdapi.InternalLinkTypeUserToken: // internalLinkTypeUserToken#a8d7db59 -// case *tdapi.InternalLinkTypeVideoChat: // internalLinkTypeVideoChat#8796f8b4 -// case *tdapi.InternalLinkTypeWebApp: // internalLinkTypeWebApp#7ae9552d -// default: panic(v) -// } -type InternalLinkTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InternalLinkTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInternalLinkType implements binary de-serialization for InternalLinkTypeClass. -func DecodeInternalLinkType(buf *bin.Buffer) (InternalLinkTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InternalLinkTypeActiveSessionsTypeID: - // Decoding internalLinkTypeActiveSessions#706bbbad. - v := InternalLinkTypeActiveSessions{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeAttachmentMenuBotTypeID: - // Decoding internalLinkTypeAttachmentMenuBot#644c4225. - v := InternalLinkTypeAttachmentMenuBot{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeAuthenticationCodeTypeID: - // Decoding internalLinkTypeAuthenticationCode#f3874ff2. - v := InternalLinkTypeAuthenticationCode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeBackgroundTypeID: - // Decoding internalLinkTypeBackground#b0d2908. - v := InternalLinkTypeBackground{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeBotAddToChannelTypeID: - // Decoding internalLinkTypeBotAddToChannel#538ac2c0. - v := InternalLinkTypeBotAddToChannel{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeBotStartTypeID: - // Decoding internalLinkTypeBotStart#3f985fed. - v := InternalLinkTypeBotStart{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeBotStartInGroupTypeID: - // Decoding internalLinkTypeBotStartInGroup#ca0d8cce. - v := InternalLinkTypeBotStartInGroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeBusinessChatTypeID: - // Decoding internalLinkTypeBusinessChat#a03ae9d7. - v := InternalLinkTypeBusinessChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeBuyStarsTypeID: - // Decoding internalLinkTypeBuyStars#a94cc347. - v := InternalLinkTypeBuyStars{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeChangePhoneNumberTypeID: - // Decoding internalLinkTypeChangePhoneNumber#f0275b01. - v := InternalLinkTypeChangePhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeChatAffiliateProgramTypeID: - // Decoding internalLinkTypeChatAffiliateProgram#25ac5024. - v := InternalLinkTypeChatAffiliateProgram{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeChatBoostTypeID: - // Decoding internalLinkTypeChatBoost#d549fd40. - v := InternalLinkTypeChatBoost{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeChatFolderInviteTypeID: - // Decoding internalLinkTypeChatFolderInvite#89b2493e. - v := InternalLinkTypeChatFolderInvite{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeChatFolderSettingsTypeID: - // Decoding internalLinkTypeChatFolderSettings#bfff055c. - v := InternalLinkTypeChatFolderSettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeChatInviteTypeID: - // Decoding internalLinkTypeChatInvite#198c3cd9. - v := InternalLinkTypeChatInvite{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID: - // Decoding internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931. - v := InternalLinkTypeDefaultMessageAutoDeleteTimerSettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeEditProfileSettingsTypeID: - // Decoding internalLinkTypeEditProfileSettings#c30e5066. - v := InternalLinkTypeEditProfileSettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeGameTypeID: - // Decoding internalLinkTypeGame#f074adcd. - v := InternalLinkTypeGame{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeInstantViewTypeID: - // Decoding internalLinkTypeInstantView#69e4df3f. - v := InternalLinkTypeInstantView{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeInvoiceTypeID: - // Decoding internalLinkTypeInvoice#f34c6dac. - v := InternalLinkTypeInvoice{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeLanguagePackTypeID: - // Decoding internalLinkTypeLanguagePack#a9870d6c. - v := InternalLinkTypeLanguagePack{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeLanguageSettingsTypeID: - // Decoding internalLinkTypeLanguageSettings#b019e6e6. - v := InternalLinkTypeLanguageSettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeMainWebAppTypeID: - // Decoding internalLinkTypeMainWebApp#5ddf72e9. - v := InternalLinkTypeMainWebApp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeMessageTypeID: - // Decoding internalLinkTypeMessage#3a535c52. - v := InternalLinkTypeMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeMessageDraftTypeID: - // Decoding internalLinkTypeMessageDraft#276fbad5. - v := InternalLinkTypeMessageDraft{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypePassportDataRequestTypeID: - // Decoding internalLinkTypePassportDataRequest#c50fce81. - v := InternalLinkTypePassportDataRequest{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypePhoneNumberConfirmationTypeID: - // Decoding internalLinkTypePhoneNumberConfirmation#68bf6b16. - v := InternalLinkTypePhoneNumberConfirmation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypePremiumFeaturesTypeID: - // Decoding internalLinkTypePremiumFeatures#48884f49. - v := InternalLinkTypePremiumFeatures{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypePremiumGiftTypeID: - // Decoding internalLinkTypePremiumGift#5ad56d41. - v := InternalLinkTypePremiumGift{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypePremiumGiftCodeTypeID: - // Decoding internalLinkTypePremiumGiftCode#de5c9892. - v := InternalLinkTypePremiumGiftCode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypePrivacyAndSecuritySettingsTypeID: - // Decoding internalLinkTypePrivacyAndSecuritySettings#ad5f6acf. - v := InternalLinkTypePrivacyAndSecuritySettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeProxyTypeID: - // Decoding internalLinkTypeProxy#b1b12cea. - v := InternalLinkTypeProxy{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypePublicChatTypeID: - // Decoding internalLinkTypePublicChat#697a2d00. - v := InternalLinkTypePublicChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeQrCodeAuthenticationTypeID: - // Decoding internalLinkTypeQrCodeAuthentication#bf121924. - v := InternalLinkTypeQrCodeAuthentication{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeRestorePurchasesTypeID: - // Decoding internalLinkTypeRestorePurchases#24203483. - v := InternalLinkTypeRestorePurchases{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeSettingsTypeID: - // Decoding internalLinkTypeSettings#177545b4. - v := InternalLinkTypeSettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeStickerSetTypeID: - // Decoding internalLinkTypeStickerSet#a1464fa2. - v := InternalLinkTypeStickerSet{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeStoryTypeID: - // Decoding internalLinkTypeStory#57bce647. - v := InternalLinkTypeStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeThemeTypeID: - // Decoding internalLinkTypeTheme#f405f807. - v := InternalLinkTypeTheme{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeThemeSettingsTypeID: - // Decoding internalLinkTypeThemeSettings#c14d3916. - v := InternalLinkTypeThemeSettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeUnknownDeepLinkTypeID: - // Decoding internalLinkTypeUnknownDeepLink#2549d7db. - v := InternalLinkTypeUnknownDeepLink{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeUnsupportedProxyTypeID: - // Decoding internalLinkTypeUnsupportedProxy#de399f09. - v := InternalLinkTypeUnsupportedProxy{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeUserPhoneNumberTypeID: - // Decoding internalLinkTypeUserPhoneNumber#104bbb08. - v := InternalLinkTypeUserPhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeUserTokenTypeID: - // Decoding internalLinkTypeUserToken#a8d7db59. - v := InternalLinkTypeUserToken{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeVideoChatTypeID: - // Decoding internalLinkTypeVideoChat#8796f8b4. - v := InternalLinkTypeVideoChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case InternalLinkTypeWebAppTypeID: - // Decoding internalLinkTypeWebApp#7ae9552d. - v := InternalLinkTypeWebApp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInternalLinkType implements binary de-serialization for InternalLinkTypeClass. -func DecodeTDLibJSONInternalLinkType(buf tdjson.Decoder) (InternalLinkTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "internalLinkTypeActiveSessions": - // Decoding internalLinkTypeActiveSessions#706bbbad. - v := InternalLinkTypeActiveSessions{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeAttachmentMenuBot": - // Decoding internalLinkTypeAttachmentMenuBot#644c4225. - v := InternalLinkTypeAttachmentMenuBot{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeAuthenticationCode": - // Decoding internalLinkTypeAuthenticationCode#f3874ff2. - v := InternalLinkTypeAuthenticationCode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeBackground": - // Decoding internalLinkTypeBackground#b0d2908. - v := InternalLinkTypeBackground{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeBotAddToChannel": - // Decoding internalLinkTypeBotAddToChannel#538ac2c0. - v := InternalLinkTypeBotAddToChannel{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeBotStart": - // Decoding internalLinkTypeBotStart#3f985fed. - v := InternalLinkTypeBotStart{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeBotStartInGroup": - // Decoding internalLinkTypeBotStartInGroup#ca0d8cce. - v := InternalLinkTypeBotStartInGroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeBusinessChat": - // Decoding internalLinkTypeBusinessChat#a03ae9d7. - v := InternalLinkTypeBusinessChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeBuyStars": - // Decoding internalLinkTypeBuyStars#a94cc347. - v := InternalLinkTypeBuyStars{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeChangePhoneNumber": - // Decoding internalLinkTypeChangePhoneNumber#f0275b01. - v := InternalLinkTypeChangePhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeChatAffiliateProgram": - // Decoding internalLinkTypeChatAffiliateProgram#25ac5024. - v := InternalLinkTypeChatAffiliateProgram{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeChatBoost": - // Decoding internalLinkTypeChatBoost#d549fd40. - v := InternalLinkTypeChatBoost{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeChatFolderInvite": - // Decoding internalLinkTypeChatFolderInvite#89b2493e. - v := InternalLinkTypeChatFolderInvite{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeChatFolderSettings": - // Decoding internalLinkTypeChatFolderSettings#bfff055c. - v := InternalLinkTypeChatFolderSettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeChatInvite": - // Decoding internalLinkTypeChatInvite#198c3cd9. - v := InternalLinkTypeChatInvite{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeDefaultMessageAutoDeleteTimerSettings": - // Decoding internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931. - v := InternalLinkTypeDefaultMessageAutoDeleteTimerSettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeEditProfileSettings": - // Decoding internalLinkTypeEditProfileSettings#c30e5066. - v := InternalLinkTypeEditProfileSettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeGame": - // Decoding internalLinkTypeGame#f074adcd. - v := InternalLinkTypeGame{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeInstantView": - // Decoding internalLinkTypeInstantView#69e4df3f. - v := InternalLinkTypeInstantView{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeInvoice": - // Decoding internalLinkTypeInvoice#f34c6dac. - v := InternalLinkTypeInvoice{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeLanguagePack": - // Decoding internalLinkTypeLanguagePack#a9870d6c. - v := InternalLinkTypeLanguagePack{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeLanguageSettings": - // Decoding internalLinkTypeLanguageSettings#b019e6e6. - v := InternalLinkTypeLanguageSettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeMainWebApp": - // Decoding internalLinkTypeMainWebApp#5ddf72e9. - v := InternalLinkTypeMainWebApp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeMessage": - // Decoding internalLinkTypeMessage#3a535c52. - v := InternalLinkTypeMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeMessageDraft": - // Decoding internalLinkTypeMessageDraft#276fbad5. - v := InternalLinkTypeMessageDraft{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypePassportDataRequest": - // Decoding internalLinkTypePassportDataRequest#c50fce81. - v := InternalLinkTypePassportDataRequest{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypePhoneNumberConfirmation": - // Decoding internalLinkTypePhoneNumberConfirmation#68bf6b16. - v := InternalLinkTypePhoneNumberConfirmation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypePremiumFeatures": - // Decoding internalLinkTypePremiumFeatures#48884f49. - v := InternalLinkTypePremiumFeatures{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypePremiumGift": - // Decoding internalLinkTypePremiumGift#5ad56d41. - v := InternalLinkTypePremiumGift{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypePremiumGiftCode": - // Decoding internalLinkTypePremiumGiftCode#de5c9892. - v := InternalLinkTypePremiumGiftCode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypePrivacyAndSecuritySettings": - // Decoding internalLinkTypePrivacyAndSecuritySettings#ad5f6acf. - v := InternalLinkTypePrivacyAndSecuritySettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeProxy": - // Decoding internalLinkTypeProxy#b1b12cea. - v := InternalLinkTypeProxy{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypePublicChat": - // Decoding internalLinkTypePublicChat#697a2d00. - v := InternalLinkTypePublicChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeQrCodeAuthentication": - // Decoding internalLinkTypeQrCodeAuthentication#bf121924. - v := InternalLinkTypeQrCodeAuthentication{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeRestorePurchases": - // Decoding internalLinkTypeRestorePurchases#24203483. - v := InternalLinkTypeRestorePurchases{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeSettings": - // Decoding internalLinkTypeSettings#177545b4. - v := InternalLinkTypeSettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeStickerSet": - // Decoding internalLinkTypeStickerSet#a1464fa2. - v := InternalLinkTypeStickerSet{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeStory": - // Decoding internalLinkTypeStory#57bce647. - v := InternalLinkTypeStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeTheme": - // Decoding internalLinkTypeTheme#f405f807. - v := InternalLinkTypeTheme{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeThemeSettings": - // Decoding internalLinkTypeThemeSettings#c14d3916. - v := InternalLinkTypeThemeSettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeUnknownDeepLink": - // Decoding internalLinkTypeUnknownDeepLink#2549d7db. - v := InternalLinkTypeUnknownDeepLink{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeUnsupportedProxy": - // Decoding internalLinkTypeUnsupportedProxy#de399f09. - v := InternalLinkTypeUnsupportedProxy{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeUserPhoneNumber": - // Decoding internalLinkTypeUserPhoneNumber#104bbb08. - v := InternalLinkTypeUserPhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeUserToken": - // Decoding internalLinkTypeUserToken#a8d7db59. - v := InternalLinkTypeUserToken{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeVideoChat": - // Decoding internalLinkTypeVideoChat#8796f8b4. - v := InternalLinkTypeVideoChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - case "internalLinkTypeWebApp": - // Decoding internalLinkTypeWebApp#7ae9552d. - v := InternalLinkTypeWebApp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InternalLinkTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InternalLinkType boxes the InternalLinkTypeClass providing a helper. -type InternalLinkTypeBox struct { - InternalLinkType InternalLinkTypeClass -} - -// Decode implements bin.Decoder for InternalLinkTypeBox. -func (b *InternalLinkTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InternalLinkTypeBox to nil") - } - v, err := DecodeInternalLinkType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InternalLinkType = v - return nil -} - -// Encode implements bin.Encode for InternalLinkTypeBox. -func (b *InternalLinkTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InternalLinkType == nil { - return fmt.Errorf("unable to encode InternalLinkTypeClass as nil") - } - return b.InternalLinkType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InternalLinkTypeBox. -func (b *InternalLinkTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InternalLinkTypeBox to nil") - } - v, err := DecodeTDLibJSONInternalLinkType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InternalLinkType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InternalLinkTypeBox. -func (b *InternalLinkTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InternalLinkType == nil { - return fmt.Errorf("unable to encode InternalLinkTypeClass as nil") - } - return b.InternalLinkType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_invite_group_call_participants_gen.go b/tdapi/tl_invite_group_call_participants_gen.go deleted file mode 100644 index 62e9459e3..000000000 --- a/tdapi/tl_invite_group_call_participants_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InviteGroupCallParticipantsRequest represents TL type `inviteGroupCallParticipants#56c030a6`. -type InviteGroupCallParticipantsRequest struct { - // Group call identifier - GroupCallID int32 - // User identifiers. At most 10 users can be invited simultaneously - UserIDs []int64 -} - -// InviteGroupCallParticipantsRequestTypeID is TL type id of InviteGroupCallParticipantsRequest. -const InviteGroupCallParticipantsRequestTypeID = 0x56c030a6 - -// Ensuring interfaces in compile-time for InviteGroupCallParticipantsRequest. -var ( - _ bin.Encoder = &InviteGroupCallParticipantsRequest{} - _ bin.Decoder = &InviteGroupCallParticipantsRequest{} - _ bin.BareEncoder = &InviteGroupCallParticipantsRequest{} - _ bin.BareDecoder = &InviteGroupCallParticipantsRequest{} -) - -func (i *InviteGroupCallParticipantsRequest) Zero() bool { - if i == nil { - return true - } - if !(i.GroupCallID == 0) { - return false - } - if !(i.UserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *InviteGroupCallParticipantsRequest) String() string { - if i == nil { - return "InviteGroupCallParticipantsRequest(nil)" - } - type Alias InviteGroupCallParticipantsRequest - return fmt.Sprintf("InviteGroupCallParticipantsRequest%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InviteGroupCallParticipantsRequest) TypeID() uint32 { - return InviteGroupCallParticipantsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*InviteGroupCallParticipantsRequest) TypeName() string { - return "inviteGroupCallParticipants" -} - -// TypeInfo returns info about TL type. -func (i *InviteGroupCallParticipantsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inviteGroupCallParticipants", - ID: InviteGroupCallParticipantsRequestTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *InviteGroupCallParticipantsRequest) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inviteGroupCallParticipants#56c030a6 as nil") - } - b.PutID(InviteGroupCallParticipantsRequestTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InviteGroupCallParticipantsRequest) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inviteGroupCallParticipants#56c030a6 as nil") - } - b.PutInt32(i.GroupCallID) - b.PutInt(len(i.UserIDs)) - for _, v := range i.UserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InviteGroupCallParticipantsRequest) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inviteGroupCallParticipants#56c030a6 to nil") - } - if err := b.ConsumeID(InviteGroupCallParticipantsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode inviteGroupCallParticipants#56c030a6: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InviteGroupCallParticipantsRequest) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inviteGroupCallParticipants#56c030a6 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inviteGroupCallParticipants#56c030a6: field group_call_id: %w", err) - } - i.GroupCallID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode inviteGroupCallParticipants#56c030a6: field user_ids: %w", err) - } - - if headerLen > 0 { - i.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inviteGroupCallParticipants#56c030a6: field user_ids: %w", err) - } - i.UserIDs = append(i.UserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InviteGroupCallParticipantsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inviteGroupCallParticipants#56c030a6 as nil") - } - b.ObjStart() - b.PutID("inviteGroupCallParticipants") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(i.GroupCallID) - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range i.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InviteGroupCallParticipantsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inviteGroupCallParticipants#56c030a6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inviteGroupCallParticipants"); err != nil { - return fmt.Errorf("unable to decode inviteGroupCallParticipants#56c030a6: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode inviteGroupCallParticipants#56c030a6: field group_call_id: %w", err) - } - i.GroupCallID = value - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode inviteGroupCallParticipants#56c030a6: field user_ids: %w", err) - } - i.UserIDs = append(i.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode inviteGroupCallParticipants#56c030a6: field user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (i *InviteGroupCallParticipantsRequest) GetGroupCallID() (value int32) { - if i == nil { - return - } - return i.GroupCallID -} - -// GetUserIDs returns value of UserIDs field. -func (i *InviteGroupCallParticipantsRequest) GetUserIDs() (value []int64) { - if i == nil { - return - } - return i.UserIDs -} - -// InviteGroupCallParticipants invokes method inviteGroupCallParticipants#56c030a6 returning error if any. -func (c *Client) InviteGroupCallParticipants(ctx context.Context, request *InviteGroupCallParticipantsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_invite_link_chat_type_gen.go b/tdapi/tl_invite_link_chat_type_gen.go deleted file mode 100644 index ae5583ea8..000000000 --- a/tdapi/tl_invite_link_chat_type_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// InviteLinkChatTypeBasicGroup represents TL type `inviteLinkChatTypeBasicGroup#4d43c5ee`. -type InviteLinkChatTypeBasicGroup struct { -} - -// InviteLinkChatTypeBasicGroupTypeID is TL type id of InviteLinkChatTypeBasicGroup. -const InviteLinkChatTypeBasicGroupTypeID = 0x4d43c5ee - -// construct implements constructor of InviteLinkChatTypeClass. -func (i InviteLinkChatTypeBasicGroup) construct() InviteLinkChatTypeClass { return &i } - -// Ensuring interfaces in compile-time for InviteLinkChatTypeBasicGroup. -var ( - _ bin.Encoder = &InviteLinkChatTypeBasicGroup{} - _ bin.Decoder = &InviteLinkChatTypeBasicGroup{} - _ bin.BareEncoder = &InviteLinkChatTypeBasicGroup{} - _ bin.BareDecoder = &InviteLinkChatTypeBasicGroup{} - - _ InviteLinkChatTypeClass = &InviteLinkChatTypeBasicGroup{} -) - -func (i *InviteLinkChatTypeBasicGroup) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InviteLinkChatTypeBasicGroup) String() string { - if i == nil { - return "InviteLinkChatTypeBasicGroup(nil)" - } - type Alias InviteLinkChatTypeBasicGroup - return fmt.Sprintf("InviteLinkChatTypeBasicGroup%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InviteLinkChatTypeBasicGroup) TypeID() uint32 { - return InviteLinkChatTypeBasicGroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*InviteLinkChatTypeBasicGroup) TypeName() string { - return "inviteLinkChatTypeBasicGroup" -} - -// TypeInfo returns info about TL type. -func (i *InviteLinkChatTypeBasicGroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inviteLinkChatTypeBasicGroup", - ID: InviteLinkChatTypeBasicGroupTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InviteLinkChatTypeBasicGroup) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inviteLinkChatTypeBasicGroup#4d43c5ee as nil") - } - b.PutID(InviteLinkChatTypeBasicGroupTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InviteLinkChatTypeBasicGroup) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inviteLinkChatTypeBasicGroup#4d43c5ee as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InviteLinkChatTypeBasicGroup) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inviteLinkChatTypeBasicGroup#4d43c5ee to nil") - } - if err := b.ConsumeID(InviteLinkChatTypeBasicGroupTypeID); err != nil { - return fmt.Errorf("unable to decode inviteLinkChatTypeBasicGroup#4d43c5ee: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InviteLinkChatTypeBasicGroup) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inviteLinkChatTypeBasicGroup#4d43c5ee to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InviteLinkChatTypeBasicGroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inviteLinkChatTypeBasicGroup#4d43c5ee as nil") - } - b.ObjStart() - b.PutID("inviteLinkChatTypeBasicGroup") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InviteLinkChatTypeBasicGroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inviteLinkChatTypeBasicGroup#4d43c5ee to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inviteLinkChatTypeBasicGroup"); err != nil { - return fmt.Errorf("unable to decode inviteLinkChatTypeBasicGroup#4d43c5ee: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InviteLinkChatTypeSupergroup represents TL type `inviteLinkChatTypeSupergroup#3de86758`. -type InviteLinkChatTypeSupergroup struct { -} - -// InviteLinkChatTypeSupergroupTypeID is TL type id of InviteLinkChatTypeSupergroup. -const InviteLinkChatTypeSupergroupTypeID = 0x3de86758 - -// construct implements constructor of InviteLinkChatTypeClass. -func (i InviteLinkChatTypeSupergroup) construct() InviteLinkChatTypeClass { return &i } - -// Ensuring interfaces in compile-time for InviteLinkChatTypeSupergroup. -var ( - _ bin.Encoder = &InviteLinkChatTypeSupergroup{} - _ bin.Decoder = &InviteLinkChatTypeSupergroup{} - _ bin.BareEncoder = &InviteLinkChatTypeSupergroup{} - _ bin.BareDecoder = &InviteLinkChatTypeSupergroup{} - - _ InviteLinkChatTypeClass = &InviteLinkChatTypeSupergroup{} -) - -func (i *InviteLinkChatTypeSupergroup) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InviteLinkChatTypeSupergroup) String() string { - if i == nil { - return "InviteLinkChatTypeSupergroup(nil)" - } - type Alias InviteLinkChatTypeSupergroup - return fmt.Sprintf("InviteLinkChatTypeSupergroup%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InviteLinkChatTypeSupergroup) TypeID() uint32 { - return InviteLinkChatTypeSupergroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*InviteLinkChatTypeSupergroup) TypeName() string { - return "inviteLinkChatTypeSupergroup" -} - -// TypeInfo returns info about TL type. -func (i *InviteLinkChatTypeSupergroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inviteLinkChatTypeSupergroup", - ID: InviteLinkChatTypeSupergroupTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InviteLinkChatTypeSupergroup) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inviteLinkChatTypeSupergroup#3de86758 as nil") - } - b.PutID(InviteLinkChatTypeSupergroupTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InviteLinkChatTypeSupergroup) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inviteLinkChatTypeSupergroup#3de86758 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InviteLinkChatTypeSupergroup) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inviteLinkChatTypeSupergroup#3de86758 to nil") - } - if err := b.ConsumeID(InviteLinkChatTypeSupergroupTypeID); err != nil { - return fmt.Errorf("unable to decode inviteLinkChatTypeSupergroup#3de86758: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InviteLinkChatTypeSupergroup) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inviteLinkChatTypeSupergroup#3de86758 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InviteLinkChatTypeSupergroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inviteLinkChatTypeSupergroup#3de86758 as nil") - } - b.ObjStart() - b.PutID("inviteLinkChatTypeSupergroup") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InviteLinkChatTypeSupergroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inviteLinkChatTypeSupergroup#3de86758 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inviteLinkChatTypeSupergroup"); err != nil { - return fmt.Errorf("unable to decode inviteLinkChatTypeSupergroup#3de86758: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InviteLinkChatTypeChannel represents TL type `inviteLinkChatTypeChannel#3012ef0b`. -type InviteLinkChatTypeChannel struct { -} - -// InviteLinkChatTypeChannelTypeID is TL type id of InviteLinkChatTypeChannel. -const InviteLinkChatTypeChannelTypeID = 0x3012ef0b - -// construct implements constructor of InviteLinkChatTypeClass. -func (i InviteLinkChatTypeChannel) construct() InviteLinkChatTypeClass { return &i } - -// Ensuring interfaces in compile-time for InviteLinkChatTypeChannel. -var ( - _ bin.Encoder = &InviteLinkChatTypeChannel{} - _ bin.Decoder = &InviteLinkChatTypeChannel{} - _ bin.BareEncoder = &InviteLinkChatTypeChannel{} - _ bin.BareDecoder = &InviteLinkChatTypeChannel{} - - _ InviteLinkChatTypeClass = &InviteLinkChatTypeChannel{} -) - -func (i *InviteLinkChatTypeChannel) Zero() bool { - if i == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (i *InviteLinkChatTypeChannel) String() string { - if i == nil { - return "InviteLinkChatTypeChannel(nil)" - } - type Alias InviteLinkChatTypeChannel - return fmt.Sprintf("InviteLinkChatTypeChannel%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*InviteLinkChatTypeChannel) TypeID() uint32 { - return InviteLinkChatTypeChannelTypeID -} - -// TypeName returns name of type in TL schema. -func (*InviteLinkChatTypeChannel) TypeName() string { - return "inviteLinkChatTypeChannel" -} - -// TypeInfo returns info about TL type. -func (i *InviteLinkChatTypeChannel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "inviteLinkChatTypeChannel", - ID: InviteLinkChatTypeChannelTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (i *InviteLinkChatTypeChannel) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inviteLinkChatTypeChannel#3012ef0b as nil") - } - b.PutID(InviteLinkChatTypeChannelTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *InviteLinkChatTypeChannel) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode inviteLinkChatTypeChannel#3012ef0b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (i *InviteLinkChatTypeChannel) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inviteLinkChatTypeChannel#3012ef0b to nil") - } - if err := b.ConsumeID(InviteLinkChatTypeChannelTypeID); err != nil { - return fmt.Errorf("unable to decode inviteLinkChatTypeChannel#3012ef0b: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *InviteLinkChatTypeChannel) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode inviteLinkChatTypeChannel#3012ef0b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *InviteLinkChatTypeChannel) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode inviteLinkChatTypeChannel#3012ef0b as nil") - } - b.ObjStart() - b.PutID("inviteLinkChatTypeChannel") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *InviteLinkChatTypeChannel) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode inviteLinkChatTypeChannel#3012ef0b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("inviteLinkChatTypeChannel"); err != nil { - return fmt.Errorf("unable to decode inviteLinkChatTypeChannel#3012ef0b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// InviteLinkChatTypeClassName is schema name of InviteLinkChatTypeClass. -const InviteLinkChatTypeClassName = "InviteLinkChatType" - -// InviteLinkChatTypeClass represents InviteLinkChatType generic type. -// -// Example: -// -// g, err := tdapi.DecodeInviteLinkChatType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.InviteLinkChatTypeBasicGroup: // inviteLinkChatTypeBasicGroup#4d43c5ee -// case *tdapi.InviteLinkChatTypeSupergroup: // inviteLinkChatTypeSupergroup#3de86758 -// case *tdapi.InviteLinkChatTypeChannel: // inviteLinkChatTypeChannel#3012ef0b -// default: panic(v) -// } -type InviteLinkChatTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() InviteLinkChatTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeInviteLinkChatType implements binary de-serialization for InviteLinkChatTypeClass. -func DecodeInviteLinkChatType(buf *bin.Buffer) (InviteLinkChatTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case InviteLinkChatTypeBasicGroupTypeID: - // Decoding inviteLinkChatTypeBasicGroup#4d43c5ee. - v := InviteLinkChatTypeBasicGroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InviteLinkChatTypeClass: %w", err) - } - return &v, nil - case InviteLinkChatTypeSupergroupTypeID: - // Decoding inviteLinkChatTypeSupergroup#3de86758. - v := InviteLinkChatTypeSupergroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InviteLinkChatTypeClass: %w", err) - } - return &v, nil - case InviteLinkChatTypeChannelTypeID: - // Decoding inviteLinkChatTypeChannel#3012ef0b. - v := InviteLinkChatTypeChannel{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode InviteLinkChatTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InviteLinkChatTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONInviteLinkChatType implements binary de-serialization for InviteLinkChatTypeClass. -func DecodeTDLibJSONInviteLinkChatType(buf tdjson.Decoder) (InviteLinkChatTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "inviteLinkChatTypeBasicGroup": - // Decoding inviteLinkChatTypeBasicGroup#4d43c5ee. - v := InviteLinkChatTypeBasicGroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InviteLinkChatTypeClass: %w", err) - } - return &v, nil - case "inviteLinkChatTypeSupergroup": - // Decoding inviteLinkChatTypeSupergroup#3de86758. - v := InviteLinkChatTypeSupergroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InviteLinkChatTypeClass: %w", err) - } - return &v, nil - case "inviteLinkChatTypeChannel": - // Decoding inviteLinkChatTypeChannel#3012ef0b. - v := InviteLinkChatTypeChannel{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode InviteLinkChatTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode InviteLinkChatTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// InviteLinkChatType boxes the InviteLinkChatTypeClass providing a helper. -type InviteLinkChatTypeBox struct { - InviteLinkChatType InviteLinkChatTypeClass -} - -// Decode implements bin.Decoder for InviteLinkChatTypeBox. -func (b *InviteLinkChatTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode InviteLinkChatTypeBox to nil") - } - v, err := DecodeInviteLinkChatType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InviteLinkChatType = v - return nil -} - -// Encode implements bin.Encode for InviteLinkChatTypeBox. -func (b *InviteLinkChatTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.InviteLinkChatType == nil { - return fmt.Errorf("unable to encode InviteLinkChatTypeClass as nil") - } - return b.InviteLinkChatType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for InviteLinkChatTypeBox. -func (b *InviteLinkChatTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode InviteLinkChatTypeBox to nil") - } - v, err := DecodeTDLibJSONInviteLinkChatType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.InviteLinkChatType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for InviteLinkChatTypeBox. -func (b *InviteLinkChatTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.InviteLinkChatType == nil { - return fmt.Errorf("unable to encode InviteLinkChatTypeClass as nil") - } - return b.InviteLinkChatType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_invoice_gen.go b/tdapi/tl_invoice_gen.go deleted file mode 100644 index b79853f40..000000000 --- a/tdapi/tl_invoice_gen.go +++ /dev/null @@ -1,725 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Invoice represents TL type `invoice#67dc0e89`. -type Invoice struct { - // ISO 4217 currency code - Currency string - // A list of objects used to calculate the total price of the product - PriceParts []LabeledPricePart - // The number of seconds between consecutive Telegram Star debiting for subscription - // invoices; 0 if the invoice doesn't create subscription - SubscriptionPeriod int32 - // The maximum allowed amount of tip in the smallest units of the currency - MaxTipAmount int64 - // Suggested amounts of tip in the smallest units of the currency - SuggestedTipAmounts []int64 - // An HTTP URL with terms of service for recurring payments. If non-empty, the invoice - // payment will result in recurring payments and the user must accept the terms of - // service before allowed to pay - RecurringPaymentTermsOfServiceURL string - // An HTTP URL with terms of service for non-recurring payments. If non-empty, then the - // user must accept the terms of service before allowed to pay - TermsOfServiceURL string - // True, if the payment is a test payment - IsTest bool - // True, if the user's name is needed for payment - NeedName bool - // True, if the user's phone number is needed for payment - NeedPhoneNumber bool - // True, if the user's email address is needed for payment - NeedEmailAddress bool - // True, if the user's shipping address is needed for payment - NeedShippingAddress bool - // True, if the user's phone number will be sent to the provider - SendPhoneNumberToProvider bool - // True, if the user's email address will be sent to the provider - SendEmailAddressToProvider bool - // True, if the total price depends on the shipping method - IsFlexible bool -} - -// InvoiceTypeID is TL type id of Invoice. -const InvoiceTypeID = 0x67dc0e89 - -// Ensuring interfaces in compile-time for Invoice. -var ( - _ bin.Encoder = &Invoice{} - _ bin.Decoder = &Invoice{} - _ bin.BareEncoder = &Invoice{} - _ bin.BareDecoder = &Invoice{} -) - -func (i *Invoice) Zero() bool { - if i == nil { - return true - } - if !(i.Currency == "") { - return false - } - if !(i.PriceParts == nil) { - return false - } - if !(i.SubscriptionPeriod == 0) { - return false - } - if !(i.MaxTipAmount == 0) { - return false - } - if !(i.SuggestedTipAmounts == nil) { - return false - } - if !(i.RecurringPaymentTermsOfServiceURL == "") { - return false - } - if !(i.TermsOfServiceURL == "") { - return false - } - if !(i.IsTest == false) { - return false - } - if !(i.NeedName == false) { - return false - } - if !(i.NeedPhoneNumber == false) { - return false - } - if !(i.NeedEmailAddress == false) { - return false - } - if !(i.NeedShippingAddress == false) { - return false - } - if !(i.SendPhoneNumberToProvider == false) { - return false - } - if !(i.SendEmailAddressToProvider == false) { - return false - } - if !(i.IsFlexible == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (i *Invoice) String() string { - if i == nil { - return "Invoice(nil)" - } - type Alias Invoice - return fmt.Sprintf("Invoice%+v", Alias(*i)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Invoice) TypeID() uint32 { - return InvoiceTypeID -} - -// TypeName returns name of type in TL schema. -func (*Invoice) TypeName() string { - return "invoice" -} - -// TypeInfo returns info about TL type. -func (i *Invoice) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "invoice", - ID: InvoiceTypeID, - } - if i == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "PriceParts", - SchemaName: "price_parts", - }, - { - Name: "SubscriptionPeriod", - SchemaName: "subscription_period", - }, - { - Name: "MaxTipAmount", - SchemaName: "max_tip_amount", - }, - { - Name: "SuggestedTipAmounts", - SchemaName: "suggested_tip_amounts", - }, - { - Name: "RecurringPaymentTermsOfServiceURL", - SchemaName: "recurring_payment_terms_of_service_url", - }, - { - Name: "TermsOfServiceURL", - SchemaName: "terms_of_service_url", - }, - { - Name: "IsTest", - SchemaName: "is_test", - }, - { - Name: "NeedName", - SchemaName: "need_name", - }, - { - Name: "NeedPhoneNumber", - SchemaName: "need_phone_number", - }, - { - Name: "NeedEmailAddress", - SchemaName: "need_email_address", - }, - { - Name: "NeedShippingAddress", - SchemaName: "need_shipping_address", - }, - { - Name: "SendPhoneNumberToProvider", - SchemaName: "send_phone_number_to_provider", - }, - { - Name: "SendEmailAddressToProvider", - SchemaName: "send_email_address_to_provider", - }, - { - Name: "IsFlexible", - SchemaName: "is_flexible", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (i *Invoice) Encode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode invoice#67dc0e89 as nil") - } - b.PutID(InvoiceTypeID) - return i.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (i *Invoice) EncodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't encode invoice#67dc0e89 as nil") - } - b.PutString(i.Currency) - b.PutInt(len(i.PriceParts)) - for idx, v := range i.PriceParts { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare invoice#67dc0e89: field price_parts element with index %d: %w", idx, err) - } - } - b.PutInt32(i.SubscriptionPeriod) - b.PutInt53(i.MaxTipAmount) - b.PutInt(len(i.SuggestedTipAmounts)) - for _, v := range i.SuggestedTipAmounts { - b.PutInt53(v) - } - b.PutString(i.RecurringPaymentTermsOfServiceURL) - b.PutString(i.TermsOfServiceURL) - b.PutBool(i.IsTest) - b.PutBool(i.NeedName) - b.PutBool(i.NeedPhoneNumber) - b.PutBool(i.NeedEmailAddress) - b.PutBool(i.NeedShippingAddress) - b.PutBool(i.SendPhoneNumberToProvider) - b.PutBool(i.SendEmailAddressToProvider) - b.PutBool(i.IsFlexible) - return nil -} - -// Decode implements bin.Decoder. -func (i *Invoice) Decode(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode invoice#67dc0e89 to nil") - } - if err := b.ConsumeID(InvoiceTypeID); err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: %w", err) - } - return i.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (i *Invoice) DecodeBare(b *bin.Buffer) error { - if i == nil { - return fmt.Errorf("can't decode invoice#67dc0e89 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field currency: %w", err) - } - i.Currency = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field price_parts: %w", err) - } - - if headerLen > 0 { - i.PriceParts = make([]LabeledPricePart, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value LabeledPricePart - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare invoice#67dc0e89: field price_parts: %w", err) - } - i.PriceParts = append(i.PriceParts, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field subscription_period: %w", err) - } - i.SubscriptionPeriod = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field max_tip_amount: %w", err) - } - i.MaxTipAmount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field suggested_tip_amounts: %w", err) - } - - if headerLen > 0 { - i.SuggestedTipAmounts = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field suggested_tip_amounts: %w", err) - } - i.SuggestedTipAmounts = append(i.SuggestedTipAmounts, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field recurring_payment_terms_of_service_url: %w", err) - } - i.RecurringPaymentTermsOfServiceURL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field terms_of_service_url: %w", err) - } - i.TermsOfServiceURL = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field is_test: %w", err) - } - i.IsTest = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field need_name: %w", err) - } - i.NeedName = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field need_phone_number: %w", err) - } - i.NeedPhoneNumber = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field need_email_address: %w", err) - } - i.NeedEmailAddress = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field need_shipping_address: %w", err) - } - i.NeedShippingAddress = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field send_phone_number_to_provider: %w", err) - } - i.SendPhoneNumberToProvider = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field send_email_address_to_provider: %w", err) - } - i.SendEmailAddressToProvider = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field is_flexible: %w", err) - } - i.IsFlexible = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (i *Invoice) EncodeTDLibJSON(b tdjson.Encoder) error { - if i == nil { - return fmt.Errorf("can't encode invoice#67dc0e89 as nil") - } - b.ObjStart() - b.PutID("invoice") - b.Comma() - b.FieldStart("currency") - b.PutString(i.Currency) - b.Comma() - b.FieldStart("price_parts") - b.ArrStart() - for idx, v := range i.PriceParts { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode invoice#67dc0e89: field price_parts element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("subscription_period") - b.PutInt32(i.SubscriptionPeriod) - b.Comma() - b.FieldStart("max_tip_amount") - b.PutInt53(i.MaxTipAmount) - b.Comma() - b.FieldStart("suggested_tip_amounts") - b.ArrStart() - for _, v := range i.SuggestedTipAmounts { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("recurring_payment_terms_of_service_url") - b.PutString(i.RecurringPaymentTermsOfServiceURL) - b.Comma() - b.FieldStart("terms_of_service_url") - b.PutString(i.TermsOfServiceURL) - b.Comma() - b.FieldStart("is_test") - b.PutBool(i.IsTest) - b.Comma() - b.FieldStart("need_name") - b.PutBool(i.NeedName) - b.Comma() - b.FieldStart("need_phone_number") - b.PutBool(i.NeedPhoneNumber) - b.Comma() - b.FieldStart("need_email_address") - b.PutBool(i.NeedEmailAddress) - b.Comma() - b.FieldStart("need_shipping_address") - b.PutBool(i.NeedShippingAddress) - b.Comma() - b.FieldStart("send_phone_number_to_provider") - b.PutBool(i.SendPhoneNumberToProvider) - b.Comma() - b.FieldStart("send_email_address_to_provider") - b.PutBool(i.SendEmailAddressToProvider) - b.Comma() - b.FieldStart("is_flexible") - b.PutBool(i.IsFlexible) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (i *Invoice) DecodeTDLibJSON(b tdjson.Decoder) error { - if i == nil { - return fmt.Errorf("can't decode invoice#67dc0e89 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("invoice"); err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field currency: %w", err) - } - i.Currency = value - case "price_parts": - if err := b.Arr(func(b tdjson.Decoder) error { - var value LabeledPricePart - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field price_parts: %w", err) - } - i.PriceParts = append(i.PriceParts, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field price_parts: %w", err) - } - case "subscription_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field subscription_period: %w", err) - } - i.SubscriptionPeriod = value - case "max_tip_amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field max_tip_amount: %w", err) - } - i.MaxTipAmount = value - case "suggested_tip_amounts": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field suggested_tip_amounts: %w", err) - } - i.SuggestedTipAmounts = append(i.SuggestedTipAmounts, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field suggested_tip_amounts: %w", err) - } - case "recurring_payment_terms_of_service_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field recurring_payment_terms_of_service_url: %w", err) - } - i.RecurringPaymentTermsOfServiceURL = value - case "terms_of_service_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field terms_of_service_url: %w", err) - } - i.TermsOfServiceURL = value - case "is_test": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field is_test: %w", err) - } - i.IsTest = value - case "need_name": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field need_name: %w", err) - } - i.NeedName = value - case "need_phone_number": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field need_phone_number: %w", err) - } - i.NeedPhoneNumber = value - case "need_email_address": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field need_email_address: %w", err) - } - i.NeedEmailAddress = value - case "need_shipping_address": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field need_shipping_address: %w", err) - } - i.NeedShippingAddress = value - case "send_phone_number_to_provider": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field send_phone_number_to_provider: %w", err) - } - i.SendPhoneNumberToProvider = value - case "send_email_address_to_provider": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field send_email_address_to_provider: %w", err) - } - i.SendEmailAddressToProvider = value - case "is_flexible": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode invoice#67dc0e89: field is_flexible: %w", err) - } - i.IsFlexible = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCurrency returns value of Currency field. -func (i *Invoice) GetCurrency() (value string) { - if i == nil { - return - } - return i.Currency -} - -// GetPriceParts returns value of PriceParts field. -func (i *Invoice) GetPriceParts() (value []LabeledPricePart) { - if i == nil { - return - } - return i.PriceParts -} - -// GetSubscriptionPeriod returns value of SubscriptionPeriod field. -func (i *Invoice) GetSubscriptionPeriod() (value int32) { - if i == nil { - return - } - return i.SubscriptionPeriod -} - -// GetMaxTipAmount returns value of MaxTipAmount field. -func (i *Invoice) GetMaxTipAmount() (value int64) { - if i == nil { - return - } - return i.MaxTipAmount -} - -// GetSuggestedTipAmounts returns value of SuggestedTipAmounts field. -func (i *Invoice) GetSuggestedTipAmounts() (value []int64) { - if i == nil { - return - } - return i.SuggestedTipAmounts -} - -// GetRecurringPaymentTermsOfServiceURL returns value of RecurringPaymentTermsOfServiceURL field. -func (i *Invoice) GetRecurringPaymentTermsOfServiceURL() (value string) { - if i == nil { - return - } - return i.RecurringPaymentTermsOfServiceURL -} - -// GetTermsOfServiceURL returns value of TermsOfServiceURL field. -func (i *Invoice) GetTermsOfServiceURL() (value string) { - if i == nil { - return - } - return i.TermsOfServiceURL -} - -// GetIsTest returns value of IsTest field. -func (i *Invoice) GetIsTest() (value bool) { - if i == nil { - return - } - return i.IsTest -} - -// GetNeedName returns value of NeedName field. -func (i *Invoice) GetNeedName() (value bool) { - if i == nil { - return - } - return i.NeedName -} - -// GetNeedPhoneNumber returns value of NeedPhoneNumber field. -func (i *Invoice) GetNeedPhoneNumber() (value bool) { - if i == nil { - return - } - return i.NeedPhoneNumber -} - -// GetNeedEmailAddress returns value of NeedEmailAddress field. -func (i *Invoice) GetNeedEmailAddress() (value bool) { - if i == nil { - return - } - return i.NeedEmailAddress -} - -// GetNeedShippingAddress returns value of NeedShippingAddress field. -func (i *Invoice) GetNeedShippingAddress() (value bool) { - if i == nil { - return - } - return i.NeedShippingAddress -} - -// GetSendPhoneNumberToProvider returns value of SendPhoneNumberToProvider field. -func (i *Invoice) GetSendPhoneNumberToProvider() (value bool) { - if i == nil { - return - } - return i.SendPhoneNumberToProvider -} - -// GetSendEmailAddressToProvider returns value of SendEmailAddressToProvider field. -func (i *Invoice) GetSendEmailAddressToProvider() (value bool) { - if i == nil { - return - } - return i.SendEmailAddressToProvider -} - -// GetIsFlexible returns value of IsFlexible field. -func (i *Invoice) GetIsFlexible() (value bool) { - if i == nil { - return - } - return i.IsFlexible -} diff --git a/tdapi/tl_join_chat_by_invite_link_gen.go b/tdapi/tl_join_chat_by_invite_link_gen.go deleted file mode 100644 index 3200303fa..000000000 --- a/tdapi/tl_join_chat_by_invite_link_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// JoinChatByInviteLinkRequest represents TL type `joinChatByInviteLink#c16aab86`. -type JoinChatByInviteLinkRequest struct { - // Invite link to use - InviteLink string -} - -// JoinChatByInviteLinkRequestTypeID is TL type id of JoinChatByInviteLinkRequest. -const JoinChatByInviteLinkRequestTypeID = 0xc16aab86 - -// Ensuring interfaces in compile-time for JoinChatByInviteLinkRequest. -var ( - _ bin.Encoder = &JoinChatByInviteLinkRequest{} - _ bin.Decoder = &JoinChatByInviteLinkRequest{} - _ bin.BareEncoder = &JoinChatByInviteLinkRequest{} - _ bin.BareDecoder = &JoinChatByInviteLinkRequest{} -) - -func (j *JoinChatByInviteLinkRequest) Zero() bool { - if j == nil { - return true - } - if !(j.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (j *JoinChatByInviteLinkRequest) String() string { - if j == nil { - return "JoinChatByInviteLinkRequest(nil)" - } - type Alias JoinChatByInviteLinkRequest - return fmt.Sprintf("JoinChatByInviteLinkRequest%+v", Alias(*j)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*JoinChatByInviteLinkRequest) TypeID() uint32 { - return JoinChatByInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*JoinChatByInviteLinkRequest) TypeName() string { - return "joinChatByInviteLink" -} - -// TypeInfo returns info about TL type. -func (j *JoinChatByInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "joinChatByInviteLink", - ID: JoinChatByInviteLinkRequestTypeID, - } - if j == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (j *JoinChatByInviteLinkRequest) Encode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode joinChatByInviteLink#c16aab86 as nil") - } - b.PutID(JoinChatByInviteLinkRequestTypeID) - return j.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (j *JoinChatByInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode joinChatByInviteLink#c16aab86 as nil") - } - b.PutString(j.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (j *JoinChatByInviteLinkRequest) Decode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode joinChatByInviteLink#c16aab86 to nil") - } - if err := b.ConsumeID(JoinChatByInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode joinChatByInviteLink#c16aab86: %w", err) - } - return j.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (j *JoinChatByInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode joinChatByInviteLink#c16aab86 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode joinChatByInviteLink#c16aab86: field invite_link: %w", err) - } - j.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (j *JoinChatByInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if j == nil { - return fmt.Errorf("can't encode joinChatByInviteLink#c16aab86 as nil") - } - b.ObjStart() - b.PutID("joinChatByInviteLink") - b.Comma() - b.FieldStart("invite_link") - b.PutString(j.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (j *JoinChatByInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if j == nil { - return fmt.Errorf("can't decode joinChatByInviteLink#c16aab86 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("joinChatByInviteLink"); err != nil { - return fmt.Errorf("unable to decode joinChatByInviteLink#c16aab86: %w", err) - } - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode joinChatByInviteLink#c16aab86: field invite_link: %w", err) - } - j.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (j *JoinChatByInviteLinkRequest) GetInviteLink() (value string) { - if j == nil { - return - } - return j.InviteLink -} - -// JoinChatByInviteLink invokes method joinChatByInviteLink#c16aab86 returning error if any. -func (c *Client) JoinChatByInviteLink(ctx context.Context, invitelink string) (*Chat, error) { - var result Chat - - request := &JoinChatByInviteLinkRequest{ - InviteLink: invitelink, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_join_chat_gen.go b/tdapi/tl_join_chat_gen.go deleted file mode 100644 index 55564ccb2..000000000 --- a/tdapi/tl_join_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// JoinChatRequest represents TL type `joinChat#137a1aa1`. -type JoinChatRequest struct { - // Chat identifier - ChatID int64 -} - -// JoinChatRequestTypeID is TL type id of JoinChatRequest. -const JoinChatRequestTypeID = 0x137a1aa1 - -// Ensuring interfaces in compile-time for JoinChatRequest. -var ( - _ bin.Encoder = &JoinChatRequest{} - _ bin.Decoder = &JoinChatRequest{} - _ bin.BareEncoder = &JoinChatRequest{} - _ bin.BareDecoder = &JoinChatRequest{} -) - -func (j *JoinChatRequest) Zero() bool { - if j == nil { - return true - } - if !(j.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (j *JoinChatRequest) String() string { - if j == nil { - return "JoinChatRequest(nil)" - } - type Alias JoinChatRequest - return fmt.Sprintf("JoinChatRequest%+v", Alias(*j)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*JoinChatRequest) TypeID() uint32 { - return JoinChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*JoinChatRequest) TypeName() string { - return "joinChat" -} - -// TypeInfo returns info about TL type. -func (j *JoinChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "joinChat", - ID: JoinChatRequestTypeID, - } - if j == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (j *JoinChatRequest) Encode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode joinChat#137a1aa1 as nil") - } - b.PutID(JoinChatRequestTypeID) - return j.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (j *JoinChatRequest) EncodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode joinChat#137a1aa1 as nil") - } - b.PutInt53(j.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (j *JoinChatRequest) Decode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode joinChat#137a1aa1 to nil") - } - if err := b.ConsumeID(JoinChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode joinChat#137a1aa1: %w", err) - } - return j.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (j *JoinChatRequest) DecodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode joinChat#137a1aa1 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode joinChat#137a1aa1: field chat_id: %w", err) - } - j.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (j *JoinChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if j == nil { - return fmt.Errorf("can't encode joinChat#137a1aa1 as nil") - } - b.ObjStart() - b.PutID("joinChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(j.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (j *JoinChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if j == nil { - return fmt.Errorf("can't decode joinChat#137a1aa1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("joinChat"); err != nil { - return fmt.Errorf("unable to decode joinChat#137a1aa1: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode joinChat#137a1aa1: field chat_id: %w", err) - } - j.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (j *JoinChatRequest) GetChatID() (value int64) { - if j == nil { - return - } - return j.ChatID -} - -// JoinChat invokes method joinChat#137a1aa1 returning error if any. -func (c *Client) JoinChat(ctx context.Context, chatid int64) error { - var ok Ok - - request := &JoinChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_join_group_call_gen.go b/tdapi/tl_join_group_call_gen.go deleted file mode 100644 index ed2c368f7..000000000 --- a/tdapi/tl_join_group_call_gen.go +++ /dev/null @@ -1,419 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// JoinGroupCallRequest represents TL type `joinGroupCall#c1c947e5`. -type JoinGroupCallRequest struct { - // Group call identifier - GroupCallID int32 - // Identifier of a group call participant, which will be used to join the call; pass null - // to join as self; video chats only - ParticipantID MessageSenderClass - // Caller audio channel synchronization source identifier; received from tgcalls - AudioSourceID int32 - // Group call join payload; received from tgcalls - Payload string - // Pass true to join the call with muted microphone - IsMuted bool - // Pass true if the user's video is enabled - IsMyVideoEnabled bool - // If non-empty, invite hash to be used to join the group call without being muted by - // administrators - InviteHash string -} - -// JoinGroupCallRequestTypeID is TL type id of JoinGroupCallRequest. -const JoinGroupCallRequestTypeID = 0xc1c947e5 - -// Ensuring interfaces in compile-time for JoinGroupCallRequest. -var ( - _ bin.Encoder = &JoinGroupCallRequest{} - _ bin.Decoder = &JoinGroupCallRequest{} - _ bin.BareEncoder = &JoinGroupCallRequest{} - _ bin.BareDecoder = &JoinGroupCallRequest{} -) - -func (j *JoinGroupCallRequest) Zero() bool { - if j == nil { - return true - } - if !(j.GroupCallID == 0) { - return false - } - if !(j.ParticipantID == nil) { - return false - } - if !(j.AudioSourceID == 0) { - return false - } - if !(j.Payload == "") { - return false - } - if !(j.IsMuted == false) { - return false - } - if !(j.IsMyVideoEnabled == false) { - return false - } - if !(j.InviteHash == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (j *JoinGroupCallRequest) String() string { - if j == nil { - return "JoinGroupCallRequest(nil)" - } - type Alias JoinGroupCallRequest - return fmt.Sprintf("JoinGroupCallRequest%+v", Alias(*j)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*JoinGroupCallRequest) TypeID() uint32 { - return JoinGroupCallRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*JoinGroupCallRequest) TypeName() string { - return "joinGroupCall" -} - -// TypeInfo returns info about TL type. -func (j *JoinGroupCallRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "joinGroupCall", - ID: JoinGroupCallRequestTypeID, - } - if j == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "ParticipantID", - SchemaName: "participant_id", - }, - { - Name: "AudioSourceID", - SchemaName: "audio_source_id", - }, - { - Name: "Payload", - SchemaName: "payload", - }, - { - Name: "IsMuted", - SchemaName: "is_muted", - }, - { - Name: "IsMyVideoEnabled", - SchemaName: "is_my_video_enabled", - }, - { - Name: "InviteHash", - SchemaName: "invite_hash", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (j *JoinGroupCallRequest) Encode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode joinGroupCall#c1c947e5 as nil") - } - b.PutID(JoinGroupCallRequestTypeID) - return j.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (j *JoinGroupCallRequest) EncodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode joinGroupCall#c1c947e5 as nil") - } - b.PutInt32(j.GroupCallID) - if j.ParticipantID == nil { - return fmt.Errorf("unable to encode joinGroupCall#c1c947e5: field participant_id is nil") - } - if err := j.ParticipantID.Encode(b); err != nil { - return fmt.Errorf("unable to encode joinGroupCall#c1c947e5: field participant_id: %w", err) - } - b.PutInt32(j.AudioSourceID) - b.PutString(j.Payload) - b.PutBool(j.IsMuted) - b.PutBool(j.IsMyVideoEnabled) - b.PutString(j.InviteHash) - return nil -} - -// Decode implements bin.Decoder. -func (j *JoinGroupCallRequest) Decode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode joinGroupCall#c1c947e5 to nil") - } - if err := b.ConsumeID(JoinGroupCallRequestTypeID); err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: %w", err) - } - return j.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (j *JoinGroupCallRequest) DecodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode joinGroupCall#c1c947e5 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field group_call_id: %w", err) - } - j.GroupCallID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field participant_id: %w", err) - } - j.ParticipantID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field audio_source_id: %w", err) - } - j.AudioSourceID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field payload: %w", err) - } - j.Payload = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field is_muted: %w", err) - } - j.IsMuted = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field is_my_video_enabled: %w", err) - } - j.IsMyVideoEnabled = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field invite_hash: %w", err) - } - j.InviteHash = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (j *JoinGroupCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if j == nil { - return fmt.Errorf("can't encode joinGroupCall#c1c947e5 as nil") - } - b.ObjStart() - b.PutID("joinGroupCall") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(j.GroupCallID) - b.Comma() - b.FieldStart("participant_id") - if j.ParticipantID == nil { - return fmt.Errorf("unable to encode joinGroupCall#c1c947e5: field participant_id is nil") - } - if err := j.ParticipantID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode joinGroupCall#c1c947e5: field participant_id: %w", err) - } - b.Comma() - b.FieldStart("audio_source_id") - b.PutInt32(j.AudioSourceID) - b.Comma() - b.FieldStart("payload") - b.PutString(j.Payload) - b.Comma() - b.FieldStart("is_muted") - b.PutBool(j.IsMuted) - b.Comma() - b.FieldStart("is_my_video_enabled") - b.PutBool(j.IsMyVideoEnabled) - b.Comma() - b.FieldStart("invite_hash") - b.PutString(j.InviteHash) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (j *JoinGroupCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if j == nil { - return fmt.Errorf("can't decode joinGroupCall#c1c947e5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("joinGroupCall"); err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field group_call_id: %w", err) - } - j.GroupCallID = value - case "participant_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field participant_id: %w", err) - } - j.ParticipantID = value - case "audio_source_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field audio_source_id: %w", err) - } - j.AudioSourceID = value - case "payload": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field payload: %w", err) - } - j.Payload = value - case "is_muted": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field is_muted: %w", err) - } - j.IsMuted = value - case "is_my_video_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field is_my_video_enabled: %w", err) - } - j.IsMyVideoEnabled = value - case "invite_hash": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode joinGroupCall#c1c947e5: field invite_hash: %w", err) - } - j.InviteHash = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (j *JoinGroupCallRequest) GetGroupCallID() (value int32) { - if j == nil { - return - } - return j.GroupCallID -} - -// GetParticipantID returns value of ParticipantID field. -func (j *JoinGroupCallRequest) GetParticipantID() (value MessageSenderClass) { - if j == nil { - return - } - return j.ParticipantID -} - -// GetAudioSourceID returns value of AudioSourceID field. -func (j *JoinGroupCallRequest) GetAudioSourceID() (value int32) { - if j == nil { - return - } - return j.AudioSourceID -} - -// GetPayload returns value of Payload field. -func (j *JoinGroupCallRequest) GetPayload() (value string) { - if j == nil { - return - } - return j.Payload -} - -// GetIsMuted returns value of IsMuted field. -func (j *JoinGroupCallRequest) GetIsMuted() (value bool) { - if j == nil { - return - } - return j.IsMuted -} - -// GetIsMyVideoEnabled returns value of IsMyVideoEnabled field. -func (j *JoinGroupCallRequest) GetIsMyVideoEnabled() (value bool) { - if j == nil { - return - } - return j.IsMyVideoEnabled -} - -// GetInviteHash returns value of InviteHash field. -func (j *JoinGroupCallRequest) GetInviteHash() (value string) { - if j == nil { - return - } - return j.InviteHash -} - -// JoinGroupCall invokes method joinGroupCall#c1c947e5 returning error if any. -func (c *Client) JoinGroupCall(ctx context.Context, request *JoinGroupCallRequest) (*Text, error) { - var result Text - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_json_object_member_gen.go b/tdapi/tl_json_object_member_gen.go deleted file mode 100644 index f52bab588..000000000 --- a/tdapi/tl_json_object_member_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// JSONObjectMember represents TL type `jsonObjectMember#9483ae96`. -type JSONObjectMember struct { - // Member's key - Key string - // Member's value - Value JSONValueClass -} - -// JSONObjectMemberTypeID is TL type id of JSONObjectMember. -const JSONObjectMemberTypeID = 0x9483ae96 - -// Ensuring interfaces in compile-time for JSONObjectMember. -var ( - _ bin.Encoder = &JSONObjectMember{} - _ bin.Decoder = &JSONObjectMember{} - _ bin.BareEncoder = &JSONObjectMember{} - _ bin.BareDecoder = &JSONObjectMember{} -) - -func (j *JSONObjectMember) Zero() bool { - if j == nil { - return true - } - if !(j.Key == "") { - return false - } - if !(j.Value == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (j *JSONObjectMember) String() string { - if j == nil { - return "JSONObjectMember(nil)" - } - type Alias JSONObjectMember - return fmt.Sprintf("JSONObjectMember%+v", Alias(*j)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*JSONObjectMember) TypeID() uint32 { - return JSONObjectMemberTypeID -} - -// TypeName returns name of type in TL schema. -func (*JSONObjectMember) TypeName() string { - return "jsonObjectMember" -} - -// TypeInfo returns info about TL type. -func (j *JSONObjectMember) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "jsonObjectMember", - ID: JSONObjectMemberTypeID, - } - if j == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Key", - SchemaName: "key", - }, - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (j *JSONObjectMember) Encode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonObjectMember#9483ae96 as nil") - } - b.PutID(JSONObjectMemberTypeID) - return j.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (j *JSONObjectMember) EncodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonObjectMember#9483ae96 as nil") - } - b.PutString(j.Key) - if j.Value == nil { - return fmt.Errorf("unable to encode jsonObjectMember#9483ae96: field value is nil") - } - if err := j.Value.Encode(b); err != nil { - return fmt.Errorf("unable to encode jsonObjectMember#9483ae96: field value: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (j *JSONObjectMember) Decode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonObjectMember#9483ae96 to nil") - } - if err := b.ConsumeID(JSONObjectMemberTypeID); err != nil { - return fmt.Errorf("unable to decode jsonObjectMember#9483ae96: %w", err) - } - return j.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (j *JSONObjectMember) DecodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonObjectMember#9483ae96 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode jsonObjectMember#9483ae96: field key: %w", err) - } - j.Key = value - } - { - value, err := DecodeJSONValue(b) - if err != nil { - return fmt.Errorf("unable to decode jsonObjectMember#9483ae96: field value: %w", err) - } - j.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (j *JSONObjectMember) EncodeTDLibJSON(b tdjson.Encoder) error { - if j == nil { - return fmt.Errorf("can't encode jsonObjectMember#9483ae96 as nil") - } - b.ObjStart() - b.PutID("jsonObjectMember") - b.Comma() - b.FieldStart("key") - b.PutString(j.Key) - b.Comma() - b.FieldStart("value") - if j.Value == nil { - return fmt.Errorf("unable to encode jsonObjectMember#9483ae96: field value is nil") - } - if err := j.Value.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode jsonObjectMember#9483ae96: field value: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (j *JSONObjectMember) DecodeTDLibJSON(b tdjson.Decoder) error { - if j == nil { - return fmt.Errorf("can't decode jsonObjectMember#9483ae96 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("jsonObjectMember"); err != nil { - return fmt.Errorf("unable to decode jsonObjectMember#9483ae96: %w", err) - } - case "key": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode jsonObjectMember#9483ae96: field key: %w", err) - } - j.Key = value - case "value": - value, err := DecodeTDLibJSONJSONValue(b) - if err != nil { - return fmt.Errorf("unable to decode jsonObjectMember#9483ae96: field value: %w", err) - } - j.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetKey returns value of Key field. -func (j *JSONObjectMember) GetKey() (value string) { - if j == nil { - return - } - return j.Key -} - -// GetValue returns value of Value field. -func (j *JSONObjectMember) GetValue() (value JSONValueClass) { - if j == nil { - return - } - return j.Value -} diff --git a/tdapi/tl_json_value_gen.go b/tdapi/tl_json_value_gen.go deleted file mode 100644 index 66d21957a..000000000 --- a/tdapi/tl_json_value_gen.go +++ /dev/null @@ -1,1252 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// JSONValueNull represents TL type `jsonValueNull#fa76e0cd`. -type JSONValueNull struct { -} - -// JSONValueNullTypeID is TL type id of JSONValueNull. -const JSONValueNullTypeID = 0xfa76e0cd - -// construct implements constructor of JSONValueClass. -func (j JSONValueNull) construct() JSONValueClass { return &j } - -// Ensuring interfaces in compile-time for JSONValueNull. -var ( - _ bin.Encoder = &JSONValueNull{} - _ bin.Decoder = &JSONValueNull{} - _ bin.BareEncoder = &JSONValueNull{} - _ bin.BareDecoder = &JSONValueNull{} - - _ JSONValueClass = &JSONValueNull{} -) - -func (j *JSONValueNull) Zero() bool { - if j == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (j *JSONValueNull) String() string { - if j == nil { - return "JSONValueNull(nil)" - } - type Alias JSONValueNull - return fmt.Sprintf("JSONValueNull%+v", Alias(*j)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*JSONValueNull) TypeID() uint32 { - return JSONValueNullTypeID -} - -// TypeName returns name of type in TL schema. -func (*JSONValueNull) TypeName() string { - return "jsonValueNull" -} - -// TypeInfo returns info about TL type. -func (j *JSONValueNull) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "jsonValueNull", - ID: JSONValueNullTypeID, - } - if j == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (j *JSONValueNull) Encode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueNull#fa76e0cd as nil") - } - b.PutID(JSONValueNullTypeID) - return j.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (j *JSONValueNull) EncodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueNull#fa76e0cd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (j *JSONValueNull) Decode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueNull#fa76e0cd to nil") - } - if err := b.ConsumeID(JSONValueNullTypeID); err != nil { - return fmt.Errorf("unable to decode jsonValueNull#fa76e0cd: %w", err) - } - return j.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (j *JSONValueNull) DecodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueNull#fa76e0cd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (j *JSONValueNull) EncodeTDLibJSON(b tdjson.Encoder) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueNull#fa76e0cd as nil") - } - b.ObjStart() - b.PutID("jsonValueNull") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (j *JSONValueNull) DecodeTDLibJSON(b tdjson.Decoder) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueNull#fa76e0cd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("jsonValueNull"); err != nil { - return fmt.Errorf("unable to decode jsonValueNull#fa76e0cd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// JSONValueBoolean represents TL type `jsonValueBoolean#8050d3b0`. -type JSONValueBoolean struct { - // The value - Value bool -} - -// JSONValueBooleanTypeID is TL type id of JSONValueBoolean. -const JSONValueBooleanTypeID = 0x8050d3b0 - -// construct implements constructor of JSONValueClass. -func (j JSONValueBoolean) construct() JSONValueClass { return &j } - -// Ensuring interfaces in compile-time for JSONValueBoolean. -var ( - _ bin.Encoder = &JSONValueBoolean{} - _ bin.Decoder = &JSONValueBoolean{} - _ bin.BareEncoder = &JSONValueBoolean{} - _ bin.BareDecoder = &JSONValueBoolean{} - - _ JSONValueClass = &JSONValueBoolean{} -) - -func (j *JSONValueBoolean) Zero() bool { - if j == nil { - return true - } - if !(j.Value == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (j *JSONValueBoolean) String() string { - if j == nil { - return "JSONValueBoolean(nil)" - } - type Alias JSONValueBoolean - return fmt.Sprintf("JSONValueBoolean%+v", Alias(*j)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*JSONValueBoolean) TypeID() uint32 { - return JSONValueBooleanTypeID -} - -// TypeName returns name of type in TL schema. -func (*JSONValueBoolean) TypeName() string { - return "jsonValueBoolean" -} - -// TypeInfo returns info about TL type. -func (j *JSONValueBoolean) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "jsonValueBoolean", - ID: JSONValueBooleanTypeID, - } - if j == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (j *JSONValueBoolean) Encode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueBoolean#8050d3b0 as nil") - } - b.PutID(JSONValueBooleanTypeID) - return j.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (j *JSONValueBoolean) EncodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueBoolean#8050d3b0 as nil") - } - b.PutBool(j.Value) - return nil -} - -// Decode implements bin.Decoder. -func (j *JSONValueBoolean) Decode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueBoolean#8050d3b0 to nil") - } - if err := b.ConsumeID(JSONValueBooleanTypeID); err != nil { - return fmt.Errorf("unable to decode jsonValueBoolean#8050d3b0: %w", err) - } - return j.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (j *JSONValueBoolean) DecodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueBoolean#8050d3b0 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode jsonValueBoolean#8050d3b0: field value: %w", err) - } - j.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (j *JSONValueBoolean) EncodeTDLibJSON(b tdjson.Encoder) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueBoolean#8050d3b0 as nil") - } - b.ObjStart() - b.PutID("jsonValueBoolean") - b.Comma() - b.FieldStart("value") - b.PutBool(j.Value) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (j *JSONValueBoolean) DecodeTDLibJSON(b tdjson.Decoder) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueBoolean#8050d3b0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("jsonValueBoolean"); err != nil { - return fmt.Errorf("unable to decode jsonValueBoolean#8050d3b0: %w", err) - } - case "value": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode jsonValueBoolean#8050d3b0: field value: %w", err) - } - j.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (j *JSONValueBoolean) GetValue() (value bool) { - if j == nil { - return - } - return j.Value -} - -// JSONValueNumber represents TL type `jsonValueNumber#c3c0146f`. -type JSONValueNumber struct { - // The value - Value float64 -} - -// JSONValueNumberTypeID is TL type id of JSONValueNumber. -const JSONValueNumberTypeID = 0xc3c0146f - -// construct implements constructor of JSONValueClass. -func (j JSONValueNumber) construct() JSONValueClass { return &j } - -// Ensuring interfaces in compile-time for JSONValueNumber. -var ( - _ bin.Encoder = &JSONValueNumber{} - _ bin.Decoder = &JSONValueNumber{} - _ bin.BareEncoder = &JSONValueNumber{} - _ bin.BareDecoder = &JSONValueNumber{} - - _ JSONValueClass = &JSONValueNumber{} -) - -func (j *JSONValueNumber) Zero() bool { - if j == nil { - return true - } - if !(j.Value == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (j *JSONValueNumber) String() string { - if j == nil { - return "JSONValueNumber(nil)" - } - type Alias JSONValueNumber - return fmt.Sprintf("JSONValueNumber%+v", Alias(*j)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*JSONValueNumber) TypeID() uint32 { - return JSONValueNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*JSONValueNumber) TypeName() string { - return "jsonValueNumber" -} - -// TypeInfo returns info about TL type. -func (j *JSONValueNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "jsonValueNumber", - ID: JSONValueNumberTypeID, - } - if j == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (j *JSONValueNumber) Encode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueNumber#c3c0146f as nil") - } - b.PutID(JSONValueNumberTypeID) - return j.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (j *JSONValueNumber) EncodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueNumber#c3c0146f as nil") - } - b.PutDouble(j.Value) - return nil -} - -// Decode implements bin.Decoder. -func (j *JSONValueNumber) Decode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueNumber#c3c0146f to nil") - } - if err := b.ConsumeID(JSONValueNumberTypeID); err != nil { - return fmt.Errorf("unable to decode jsonValueNumber#c3c0146f: %w", err) - } - return j.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (j *JSONValueNumber) DecodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueNumber#c3c0146f to nil") - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode jsonValueNumber#c3c0146f: field value: %w", err) - } - j.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (j *JSONValueNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueNumber#c3c0146f as nil") - } - b.ObjStart() - b.PutID("jsonValueNumber") - b.Comma() - b.FieldStart("value") - b.PutDouble(j.Value) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (j *JSONValueNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueNumber#c3c0146f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("jsonValueNumber"); err != nil { - return fmt.Errorf("unable to decode jsonValueNumber#c3c0146f: %w", err) - } - case "value": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode jsonValueNumber#c3c0146f: field value: %w", err) - } - j.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (j *JSONValueNumber) GetValue() (value float64) { - if j == nil { - return - } - return j.Value -} - -// JSONValueString represents TL type `jsonValueString#5f3ebdb1`. -type JSONValueString struct { - // The value - Value string -} - -// JSONValueStringTypeID is TL type id of JSONValueString. -const JSONValueStringTypeID = 0x5f3ebdb1 - -// construct implements constructor of JSONValueClass. -func (j JSONValueString) construct() JSONValueClass { return &j } - -// Ensuring interfaces in compile-time for JSONValueString. -var ( - _ bin.Encoder = &JSONValueString{} - _ bin.Decoder = &JSONValueString{} - _ bin.BareEncoder = &JSONValueString{} - _ bin.BareDecoder = &JSONValueString{} - - _ JSONValueClass = &JSONValueString{} -) - -func (j *JSONValueString) Zero() bool { - if j == nil { - return true - } - if !(j.Value == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (j *JSONValueString) String() string { - if j == nil { - return "JSONValueString(nil)" - } - type Alias JSONValueString - return fmt.Sprintf("JSONValueString%+v", Alias(*j)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*JSONValueString) TypeID() uint32 { - return JSONValueStringTypeID -} - -// TypeName returns name of type in TL schema. -func (*JSONValueString) TypeName() string { - return "jsonValueString" -} - -// TypeInfo returns info about TL type. -func (j *JSONValueString) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "jsonValueString", - ID: JSONValueStringTypeID, - } - if j == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (j *JSONValueString) Encode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueString#5f3ebdb1 as nil") - } - b.PutID(JSONValueStringTypeID) - return j.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (j *JSONValueString) EncodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueString#5f3ebdb1 as nil") - } - b.PutString(j.Value) - return nil -} - -// Decode implements bin.Decoder. -func (j *JSONValueString) Decode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueString#5f3ebdb1 to nil") - } - if err := b.ConsumeID(JSONValueStringTypeID); err != nil { - return fmt.Errorf("unable to decode jsonValueString#5f3ebdb1: %w", err) - } - return j.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (j *JSONValueString) DecodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueString#5f3ebdb1 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode jsonValueString#5f3ebdb1: field value: %w", err) - } - j.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (j *JSONValueString) EncodeTDLibJSON(b tdjson.Encoder) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueString#5f3ebdb1 as nil") - } - b.ObjStart() - b.PutID("jsonValueString") - b.Comma() - b.FieldStart("value") - b.PutString(j.Value) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (j *JSONValueString) DecodeTDLibJSON(b tdjson.Decoder) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueString#5f3ebdb1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("jsonValueString"); err != nil { - return fmt.Errorf("unable to decode jsonValueString#5f3ebdb1: %w", err) - } - case "value": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode jsonValueString#5f3ebdb1: field value: %w", err) - } - j.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (j *JSONValueString) GetValue() (value string) { - if j == nil { - return - } - return j.Value -} - -// JSONValueArray represents TL type `jsonValueArray#eccdb0d8`. -type JSONValueArray struct { - // The list of array elements - Values []JSONValueClass -} - -// JSONValueArrayTypeID is TL type id of JSONValueArray. -const JSONValueArrayTypeID = 0xeccdb0d8 - -// construct implements constructor of JSONValueClass. -func (j JSONValueArray) construct() JSONValueClass { return &j } - -// Ensuring interfaces in compile-time for JSONValueArray. -var ( - _ bin.Encoder = &JSONValueArray{} - _ bin.Decoder = &JSONValueArray{} - _ bin.BareEncoder = &JSONValueArray{} - _ bin.BareDecoder = &JSONValueArray{} - - _ JSONValueClass = &JSONValueArray{} -) - -func (j *JSONValueArray) Zero() bool { - if j == nil { - return true - } - if !(j.Values == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (j *JSONValueArray) String() string { - if j == nil { - return "JSONValueArray(nil)" - } - type Alias JSONValueArray - return fmt.Sprintf("JSONValueArray%+v", Alias(*j)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*JSONValueArray) TypeID() uint32 { - return JSONValueArrayTypeID -} - -// TypeName returns name of type in TL schema. -func (*JSONValueArray) TypeName() string { - return "jsonValueArray" -} - -// TypeInfo returns info about TL type. -func (j *JSONValueArray) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "jsonValueArray", - ID: JSONValueArrayTypeID, - } - if j == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Values", - SchemaName: "values", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (j *JSONValueArray) Encode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueArray#eccdb0d8 as nil") - } - b.PutID(JSONValueArrayTypeID) - return j.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (j *JSONValueArray) EncodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueArray#eccdb0d8 as nil") - } - b.PutInt(len(j.Values)) - for idx, v := range j.Values { - if v == nil { - return fmt.Errorf("unable to encode jsonValueArray#eccdb0d8: field values element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare jsonValueArray#eccdb0d8: field values element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (j *JSONValueArray) Decode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueArray#eccdb0d8 to nil") - } - if err := b.ConsumeID(JSONValueArrayTypeID); err != nil { - return fmt.Errorf("unable to decode jsonValueArray#eccdb0d8: %w", err) - } - return j.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (j *JSONValueArray) DecodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueArray#eccdb0d8 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode jsonValueArray#eccdb0d8: field values: %w", err) - } - - if headerLen > 0 { - j.Values = make([]JSONValueClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeJSONValue(b) - if err != nil { - return fmt.Errorf("unable to decode jsonValueArray#eccdb0d8: field values: %w", err) - } - j.Values = append(j.Values, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (j *JSONValueArray) EncodeTDLibJSON(b tdjson.Encoder) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueArray#eccdb0d8 as nil") - } - b.ObjStart() - b.PutID("jsonValueArray") - b.Comma() - b.FieldStart("values") - b.ArrStart() - for idx, v := range j.Values { - if v == nil { - return fmt.Errorf("unable to encode jsonValueArray#eccdb0d8: field values element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode jsonValueArray#eccdb0d8: field values element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (j *JSONValueArray) DecodeTDLibJSON(b tdjson.Decoder) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueArray#eccdb0d8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("jsonValueArray"); err != nil { - return fmt.Errorf("unable to decode jsonValueArray#eccdb0d8: %w", err) - } - case "values": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONJSONValue(b) - if err != nil { - return fmt.Errorf("unable to decode jsonValueArray#eccdb0d8: field values: %w", err) - } - j.Values = append(j.Values, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode jsonValueArray#eccdb0d8: field values: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetValues returns value of Values field. -func (j *JSONValueArray) GetValues() (value []JSONValueClass) { - if j == nil { - return - } - return j.Values -} - -// JSONValueObject represents TL type `jsonValueObject#c67bff40`. -type JSONValueObject struct { - // The list of object members - Members []JSONObjectMember -} - -// JSONValueObjectTypeID is TL type id of JSONValueObject. -const JSONValueObjectTypeID = 0xc67bff40 - -// construct implements constructor of JSONValueClass. -func (j JSONValueObject) construct() JSONValueClass { return &j } - -// Ensuring interfaces in compile-time for JSONValueObject. -var ( - _ bin.Encoder = &JSONValueObject{} - _ bin.Decoder = &JSONValueObject{} - _ bin.BareEncoder = &JSONValueObject{} - _ bin.BareDecoder = &JSONValueObject{} - - _ JSONValueClass = &JSONValueObject{} -) - -func (j *JSONValueObject) Zero() bool { - if j == nil { - return true - } - if !(j.Members == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (j *JSONValueObject) String() string { - if j == nil { - return "JSONValueObject(nil)" - } - type Alias JSONValueObject - return fmt.Sprintf("JSONValueObject%+v", Alias(*j)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*JSONValueObject) TypeID() uint32 { - return JSONValueObjectTypeID -} - -// TypeName returns name of type in TL schema. -func (*JSONValueObject) TypeName() string { - return "jsonValueObject" -} - -// TypeInfo returns info about TL type. -func (j *JSONValueObject) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "jsonValueObject", - ID: JSONValueObjectTypeID, - } - if j == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Members", - SchemaName: "members", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (j *JSONValueObject) Encode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueObject#c67bff40 as nil") - } - b.PutID(JSONValueObjectTypeID) - return j.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (j *JSONValueObject) EncodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueObject#c67bff40 as nil") - } - b.PutInt(len(j.Members)) - for idx, v := range j.Members { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare jsonValueObject#c67bff40: field members element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (j *JSONValueObject) Decode(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueObject#c67bff40 to nil") - } - if err := b.ConsumeID(JSONValueObjectTypeID); err != nil { - return fmt.Errorf("unable to decode jsonValueObject#c67bff40: %w", err) - } - return j.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (j *JSONValueObject) DecodeBare(b *bin.Buffer) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueObject#c67bff40 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode jsonValueObject#c67bff40: field members: %w", err) - } - - if headerLen > 0 { - j.Members = make([]JSONObjectMember, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value JSONObjectMember - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare jsonValueObject#c67bff40: field members: %w", err) - } - j.Members = append(j.Members, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (j *JSONValueObject) EncodeTDLibJSON(b tdjson.Encoder) error { - if j == nil { - return fmt.Errorf("can't encode jsonValueObject#c67bff40 as nil") - } - b.ObjStart() - b.PutID("jsonValueObject") - b.Comma() - b.FieldStart("members") - b.ArrStart() - for idx, v := range j.Members { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode jsonValueObject#c67bff40: field members element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (j *JSONValueObject) DecodeTDLibJSON(b tdjson.Decoder) error { - if j == nil { - return fmt.Errorf("can't decode jsonValueObject#c67bff40 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("jsonValueObject"); err != nil { - return fmt.Errorf("unable to decode jsonValueObject#c67bff40: %w", err) - } - case "members": - if err := b.Arr(func(b tdjson.Decoder) error { - var value JSONObjectMember - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode jsonValueObject#c67bff40: field members: %w", err) - } - j.Members = append(j.Members, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode jsonValueObject#c67bff40: field members: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMembers returns value of Members field. -func (j *JSONValueObject) GetMembers() (value []JSONObjectMember) { - if j == nil { - return - } - return j.Members -} - -// JSONValueClassName is schema name of JSONValueClass. -const JSONValueClassName = "JsonValue" - -// JSONValueClass represents JsonValue generic type. -// -// Example: -// -// g, err := tdapi.DecodeJSONValue(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.JSONValueNull: // jsonValueNull#fa76e0cd -// case *tdapi.JSONValueBoolean: // jsonValueBoolean#8050d3b0 -// case *tdapi.JSONValueNumber: // jsonValueNumber#c3c0146f -// case *tdapi.JSONValueString: // jsonValueString#5f3ebdb1 -// case *tdapi.JSONValueArray: // jsonValueArray#eccdb0d8 -// case *tdapi.JSONValueObject: // jsonValueObject#c67bff40 -// default: panic(v) -// } -type JSONValueClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() JSONValueClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeJSONValue implements binary de-serialization for JSONValueClass. -func DecodeJSONValue(buf *bin.Buffer) (JSONValueClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case JSONValueNullTypeID: - // Decoding jsonValueNull#fa76e0cd. - v := JSONValueNull{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - case JSONValueBooleanTypeID: - // Decoding jsonValueBoolean#8050d3b0. - v := JSONValueBoolean{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - case JSONValueNumberTypeID: - // Decoding jsonValueNumber#c3c0146f. - v := JSONValueNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - case JSONValueStringTypeID: - // Decoding jsonValueString#5f3ebdb1. - v := JSONValueString{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - case JSONValueArrayTypeID: - // Decoding jsonValueArray#eccdb0d8. - v := JSONValueArray{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - case JSONValueObjectTypeID: - // Decoding jsonValueObject#c67bff40. - v := JSONValueObject{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONJSONValue implements binary de-serialization for JSONValueClass. -func DecodeTDLibJSONJSONValue(buf tdjson.Decoder) (JSONValueClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "jsonValueNull": - // Decoding jsonValueNull#fa76e0cd. - v := JSONValueNull{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - case "jsonValueBoolean": - // Decoding jsonValueBoolean#8050d3b0. - v := JSONValueBoolean{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - case "jsonValueNumber": - // Decoding jsonValueNumber#c3c0146f. - v := JSONValueNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - case "jsonValueString": - // Decoding jsonValueString#5f3ebdb1. - v := JSONValueString{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - case "jsonValueArray": - // Decoding jsonValueArray#eccdb0d8. - v := JSONValueArray{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - case "jsonValueObject": - // Decoding jsonValueObject#c67bff40. - v := JSONValueObject{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode JSONValueClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// JSONValue boxes the JSONValueClass providing a helper. -type JSONValueBox struct { - JsonValue JSONValueClass -} - -// Decode implements bin.Decoder for JSONValueBox. -func (b *JSONValueBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode JSONValueBox to nil") - } - v, err := DecodeJSONValue(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.JsonValue = v - return nil -} - -// Encode implements bin.Encode for JSONValueBox. -func (b *JSONValueBox) Encode(buf *bin.Buffer) error { - if b == nil || b.JsonValue == nil { - return fmt.Errorf("unable to encode JSONValueClass as nil") - } - return b.JsonValue.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for JSONValueBox. -func (b *JSONValueBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode JSONValueBox to nil") - } - v, err := DecodeTDLibJSONJSONValue(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.JsonValue = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for JSONValueBox. -func (b *JSONValueBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.JsonValue == nil { - return fmt.Errorf("unable to encode JSONValueClass as nil") - } - return b.JsonValue.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_keyboard_button_gen.go b/tdapi/tl_keyboard_button_gen.go deleted file mode 100644 index 20660169e..000000000 --- a/tdapi/tl_keyboard_button_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// KeyboardButton represents TL type `keyboardButton#84a0ce74`. -type KeyboardButton struct { - // Text of the button - Text string - // Type of the button - Type KeyboardButtonTypeClass -} - -// KeyboardButtonTypeID is TL type id of KeyboardButton. -const KeyboardButtonTypeID = 0x84a0ce74 - -// Ensuring interfaces in compile-time for KeyboardButton. -var ( - _ bin.Encoder = &KeyboardButton{} - _ bin.Decoder = &KeyboardButton{} - _ bin.BareEncoder = &KeyboardButton{} - _ bin.BareDecoder = &KeyboardButton{} -) - -func (k *KeyboardButton) Zero() bool { - if k == nil { - return true - } - if !(k.Text == "") { - return false - } - if !(k.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (k *KeyboardButton) String() string { - if k == nil { - return "KeyboardButton(nil)" - } - type Alias KeyboardButton - return fmt.Sprintf("KeyboardButton%+v", Alias(*k)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*KeyboardButton) TypeID() uint32 { - return KeyboardButtonTypeID -} - -// TypeName returns name of type in TL schema. -func (*KeyboardButton) TypeName() string { - return "keyboardButton" -} - -// TypeInfo returns info about TL type. -func (k *KeyboardButton) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "keyboardButton", - ID: KeyboardButtonTypeID, - } - if k == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (k *KeyboardButton) Encode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButton#84a0ce74 as nil") - } - b.PutID(KeyboardButtonTypeID) - return k.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (k *KeyboardButton) EncodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButton#84a0ce74 as nil") - } - b.PutString(k.Text) - if k.Type == nil { - return fmt.Errorf("unable to encode keyboardButton#84a0ce74: field type is nil") - } - if err := k.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode keyboardButton#84a0ce74: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (k *KeyboardButton) Decode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButton#84a0ce74 to nil") - } - if err := b.ConsumeID(KeyboardButtonTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButton#84a0ce74: %w", err) - } - return k.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (k *KeyboardButton) DecodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButton#84a0ce74 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode keyboardButton#84a0ce74: field text: %w", err) - } - k.Text = value - } - { - value, err := DecodeKeyboardButtonType(b) - if err != nil { - return fmt.Errorf("unable to decode keyboardButton#84a0ce74: field type: %w", err) - } - k.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (k *KeyboardButton) EncodeTDLibJSON(b tdjson.Encoder) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButton#84a0ce74 as nil") - } - b.ObjStart() - b.PutID("keyboardButton") - b.Comma() - b.FieldStart("text") - b.PutString(k.Text) - b.Comma() - b.FieldStart("type") - if k.Type == nil { - return fmt.Errorf("unable to encode keyboardButton#84a0ce74: field type is nil") - } - if err := k.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode keyboardButton#84a0ce74: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (k *KeyboardButton) DecodeTDLibJSON(b tdjson.Decoder) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButton#84a0ce74 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("keyboardButton"); err != nil { - return fmt.Errorf("unable to decode keyboardButton#84a0ce74: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode keyboardButton#84a0ce74: field text: %w", err) - } - k.Text = value - case "type": - value, err := DecodeTDLibJSONKeyboardButtonType(b) - if err != nil { - return fmt.Errorf("unable to decode keyboardButton#84a0ce74: field type: %w", err) - } - k.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (k *KeyboardButton) GetText() (value string) { - if k == nil { - return - } - return k.Text -} - -// GetType returns value of Type field. -func (k *KeyboardButton) GetType() (value KeyboardButtonTypeClass) { - if k == nil { - return - } - return k.Type -} diff --git a/tdapi/tl_keyboard_button_type_gen.go b/tdapi/tl_keyboard_button_type_gen.go deleted file mode 100644 index 2a9552490..000000000 --- a/tdapi/tl_keyboard_button_type_gen.go +++ /dev/null @@ -1,2021 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// KeyboardButtonTypeText represents TL type `keyboardButtonTypeText#96519938`. -type KeyboardButtonTypeText struct { -} - -// KeyboardButtonTypeTextTypeID is TL type id of KeyboardButtonTypeText. -const KeyboardButtonTypeTextTypeID = 0x96519938 - -// construct implements constructor of KeyboardButtonTypeClass. -func (k KeyboardButtonTypeText) construct() KeyboardButtonTypeClass { return &k } - -// Ensuring interfaces in compile-time for KeyboardButtonTypeText. -var ( - _ bin.Encoder = &KeyboardButtonTypeText{} - _ bin.Decoder = &KeyboardButtonTypeText{} - _ bin.BareEncoder = &KeyboardButtonTypeText{} - _ bin.BareDecoder = &KeyboardButtonTypeText{} - - _ KeyboardButtonTypeClass = &KeyboardButtonTypeText{} -) - -func (k *KeyboardButtonTypeText) Zero() bool { - if k == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (k *KeyboardButtonTypeText) String() string { - if k == nil { - return "KeyboardButtonTypeText(nil)" - } - type Alias KeyboardButtonTypeText - return fmt.Sprintf("KeyboardButtonTypeText%+v", Alias(*k)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*KeyboardButtonTypeText) TypeID() uint32 { - return KeyboardButtonTypeTextTypeID -} - -// TypeName returns name of type in TL schema. -func (*KeyboardButtonTypeText) TypeName() string { - return "keyboardButtonTypeText" -} - -// TypeInfo returns info about TL type. -func (k *KeyboardButtonTypeText) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "keyboardButtonTypeText", - ID: KeyboardButtonTypeTextTypeID, - } - if k == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (k *KeyboardButtonTypeText) Encode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeText#96519938 as nil") - } - b.PutID(KeyboardButtonTypeTextTypeID) - return k.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (k *KeyboardButtonTypeText) EncodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeText#96519938 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (k *KeyboardButtonTypeText) Decode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeText#96519938 to nil") - } - if err := b.ConsumeID(KeyboardButtonTypeTextTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeText#96519938: %w", err) - } - return k.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (k *KeyboardButtonTypeText) DecodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeText#96519938 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (k *KeyboardButtonTypeText) EncodeTDLibJSON(b tdjson.Encoder) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeText#96519938 as nil") - } - b.ObjStart() - b.PutID("keyboardButtonTypeText") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (k *KeyboardButtonTypeText) DecodeTDLibJSON(b tdjson.Decoder) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeText#96519938 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("keyboardButtonTypeText"); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeText#96519938: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// KeyboardButtonTypeRequestPhoneNumber represents TL type `keyboardButtonTypeRequestPhoneNumber#a4d9b7b9`. -type KeyboardButtonTypeRequestPhoneNumber struct { -} - -// KeyboardButtonTypeRequestPhoneNumberTypeID is TL type id of KeyboardButtonTypeRequestPhoneNumber. -const KeyboardButtonTypeRequestPhoneNumberTypeID = 0xa4d9b7b9 - -// construct implements constructor of KeyboardButtonTypeClass. -func (k KeyboardButtonTypeRequestPhoneNumber) construct() KeyboardButtonTypeClass { return &k } - -// Ensuring interfaces in compile-time for KeyboardButtonTypeRequestPhoneNumber. -var ( - _ bin.Encoder = &KeyboardButtonTypeRequestPhoneNumber{} - _ bin.Decoder = &KeyboardButtonTypeRequestPhoneNumber{} - _ bin.BareEncoder = &KeyboardButtonTypeRequestPhoneNumber{} - _ bin.BareDecoder = &KeyboardButtonTypeRequestPhoneNumber{} - - _ KeyboardButtonTypeClass = &KeyboardButtonTypeRequestPhoneNumber{} -) - -func (k *KeyboardButtonTypeRequestPhoneNumber) Zero() bool { - if k == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (k *KeyboardButtonTypeRequestPhoneNumber) String() string { - if k == nil { - return "KeyboardButtonTypeRequestPhoneNumber(nil)" - } - type Alias KeyboardButtonTypeRequestPhoneNumber - return fmt.Sprintf("KeyboardButtonTypeRequestPhoneNumber%+v", Alias(*k)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*KeyboardButtonTypeRequestPhoneNumber) TypeID() uint32 { - return KeyboardButtonTypeRequestPhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*KeyboardButtonTypeRequestPhoneNumber) TypeName() string { - return "keyboardButtonTypeRequestPhoneNumber" -} - -// TypeInfo returns info about TL type. -func (k *KeyboardButtonTypeRequestPhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "keyboardButtonTypeRequestPhoneNumber", - ID: KeyboardButtonTypeRequestPhoneNumberTypeID, - } - if k == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (k *KeyboardButtonTypeRequestPhoneNumber) Encode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestPhoneNumber#a4d9b7b9 as nil") - } - b.PutID(KeyboardButtonTypeRequestPhoneNumberTypeID) - return k.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (k *KeyboardButtonTypeRequestPhoneNumber) EncodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestPhoneNumber#a4d9b7b9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (k *KeyboardButtonTypeRequestPhoneNumber) Decode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestPhoneNumber#a4d9b7b9 to nil") - } - if err := b.ConsumeID(KeyboardButtonTypeRequestPhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestPhoneNumber#a4d9b7b9: %w", err) - } - return k.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (k *KeyboardButtonTypeRequestPhoneNumber) DecodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestPhoneNumber#a4d9b7b9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (k *KeyboardButtonTypeRequestPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestPhoneNumber#a4d9b7b9 as nil") - } - b.ObjStart() - b.PutID("keyboardButtonTypeRequestPhoneNumber") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (k *KeyboardButtonTypeRequestPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestPhoneNumber#a4d9b7b9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("keyboardButtonTypeRequestPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestPhoneNumber#a4d9b7b9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// KeyboardButtonTypeRequestLocation represents TL type `keyboardButtonTypeRequestLocation#f8828cfd`. -type KeyboardButtonTypeRequestLocation struct { -} - -// KeyboardButtonTypeRequestLocationTypeID is TL type id of KeyboardButtonTypeRequestLocation. -const KeyboardButtonTypeRequestLocationTypeID = 0xf8828cfd - -// construct implements constructor of KeyboardButtonTypeClass. -func (k KeyboardButtonTypeRequestLocation) construct() KeyboardButtonTypeClass { return &k } - -// Ensuring interfaces in compile-time for KeyboardButtonTypeRequestLocation. -var ( - _ bin.Encoder = &KeyboardButtonTypeRequestLocation{} - _ bin.Decoder = &KeyboardButtonTypeRequestLocation{} - _ bin.BareEncoder = &KeyboardButtonTypeRequestLocation{} - _ bin.BareDecoder = &KeyboardButtonTypeRequestLocation{} - - _ KeyboardButtonTypeClass = &KeyboardButtonTypeRequestLocation{} -) - -func (k *KeyboardButtonTypeRequestLocation) Zero() bool { - if k == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (k *KeyboardButtonTypeRequestLocation) String() string { - if k == nil { - return "KeyboardButtonTypeRequestLocation(nil)" - } - type Alias KeyboardButtonTypeRequestLocation - return fmt.Sprintf("KeyboardButtonTypeRequestLocation%+v", Alias(*k)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*KeyboardButtonTypeRequestLocation) TypeID() uint32 { - return KeyboardButtonTypeRequestLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*KeyboardButtonTypeRequestLocation) TypeName() string { - return "keyboardButtonTypeRequestLocation" -} - -// TypeInfo returns info about TL type. -func (k *KeyboardButtonTypeRequestLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "keyboardButtonTypeRequestLocation", - ID: KeyboardButtonTypeRequestLocationTypeID, - } - if k == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (k *KeyboardButtonTypeRequestLocation) Encode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestLocation#f8828cfd as nil") - } - b.PutID(KeyboardButtonTypeRequestLocationTypeID) - return k.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (k *KeyboardButtonTypeRequestLocation) EncodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestLocation#f8828cfd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (k *KeyboardButtonTypeRequestLocation) Decode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestLocation#f8828cfd to nil") - } - if err := b.ConsumeID(KeyboardButtonTypeRequestLocationTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestLocation#f8828cfd: %w", err) - } - return k.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (k *KeyboardButtonTypeRequestLocation) DecodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestLocation#f8828cfd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (k *KeyboardButtonTypeRequestLocation) EncodeTDLibJSON(b tdjson.Encoder) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestLocation#f8828cfd as nil") - } - b.ObjStart() - b.PutID("keyboardButtonTypeRequestLocation") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (k *KeyboardButtonTypeRequestLocation) DecodeTDLibJSON(b tdjson.Decoder) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestLocation#f8828cfd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("keyboardButtonTypeRequestLocation"); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestLocation#f8828cfd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// KeyboardButtonTypeRequestPoll represents TL type `keyboardButtonTypeRequestPoll#7164dcb8`. -type KeyboardButtonTypeRequestPoll struct { - // If true, only regular polls must be allowed to create - ForceRegular bool - // If true, only polls in quiz mode must be allowed to create - ForceQuiz bool -} - -// KeyboardButtonTypeRequestPollTypeID is TL type id of KeyboardButtonTypeRequestPoll. -const KeyboardButtonTypeRequestPollTypeID = 0x7164dcb8 - -// construct implements constructor of KeyboardButtonTypeClass. -func (k KeyboardButtonTypeRequestPoll) construct() KeyboardButtonTypeClass { return &k } - -// Ensuring interfaces in compile-time for KeyboardButtonTypeRequestPoll. -var ( - _ bin.Encoder = &KeyboardButtonTypeRequestPoll{} - _ bin.Decoder = &KeyboardButtonTypeRequestPoll{} - _ bin.BareEncoder = &KeyboardButtonTypeRequestPoll{} - _ bin.BareDecoder = &KeyboardButtonTypeRequestPoll{} - - _ KeyboardButtonTypeClass = &KeyboardButtonTypeRequestPoll{} -) - -func (k *KeyboardButtonTypeRequestPoll) Zero() bool { - if k == nil { - return true - } - if !(k.ForceRegular == false) { - return false - } - if !(k.ForceQuiz == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (k *KeyboardButtonTypeRequestPoll) String() string { - if k == nil { - return "KeyboardButtonTypeRequestPoll(nil)" - } - type Alias KeyboardButtonTypeRequestPoll - return fmt.Sprintf("KeyboardButtonTypeRequestPoll%+v", Alias(*k)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*KeyboardButtonTypeRequestPoll) TypeID() uint32 { - return KeyboardButtonTypeRequestPollTypeID -} - -// TypeName returns name of type in TL schema. -func (*KeyboardButtonTypeRequestPoll) TypeName() string { - return "keyboardButtonTypeRequestPoll" -} - -// TypeInfo returns info about TL type. -func (k *KeyboardButtonTypeRequestPoll) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "keyboardButtonTypeRequestPoll", - ID: KeyboardButtonTypeRequestPollTypeID, - } - if k == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ForceRegular", - SchemaName: "force_regular", - }, - { - Name: "ForceQuiz", - SchemaName: "force_quiz", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (k *KeyboardButtonTypeRequestPoll) Encode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestPoll#7164dcb8 as nil") - } - b.PutID(KeyboardButtonTypeRequestPollTypeID) - return k.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (k *KeyboardButtonTypeRequestPoll) EncodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestPoll#7164dcb8 as nil") - } - b.PutBool(k.ForceRegular) - b.PutBool(k.ForceQuiz) - return nil -} - -// Decode implements bin.Decoder. -func (k *KeyboardButtonTypeRequestPoll) Decode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestPoll#7164dcb8 to nil") - } - if err := b.ConsumeID(KeyboardButtonTypeRequestPollTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestPoll#7164dcb8: %w", err) - } - return k.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (k *KeyboardButtonTypeRequestPoll) DecodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestPoll#7164dcb8 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestPoll#7164dcb8: field force_regular: %w", err) - } - k.ForceRegular = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestPoll#7164dcb8: field force_quiz: %w", err) - } - k.ForceQuiz = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (k *KeyboardButtonTypeRequestPoll) EncodeTDLibJSON(b tdjson.Encoder) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestPoll#7164dcb8 as nil") - } - b.ObjStart() - b.PutID("keyboardButtonTypeRequestPoll") - b.Comma() - b.FieldStart("force_regular") - b.PutBool(k.ForceRegular) - b.Comma() - b.FieldStart("force_quiz") - b.PutBool(k.ForceQuiz) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (k *KeyboardButtonTypeRequestPoll) DecodeTDLibJSON(b tdjson.Decoder) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestPoll#7164dcb8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("keyboardButtonTypeRequestPoll"); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestPoll#7164dcb8: %w", err) - } - case "force_regular": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestPoll#7164dcb8: field force_regular: %w", err) - } - k.ForceRegular = value - case "force_quiz": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestPoll#7164dcb8: field force_quiz: %w", err) - } - k.ForceQuiz = value - default: - return b.Skip() - } - return nil - }) -} - -// GetForceRegular returns value of ForceRegular field. -func (k *KeyboardButtonTypeRequestPoll) GetForceRegular() (value bool) { - if k == nil { - return - } - return k.ForceRegular -} - -// GetForceQuiz returns value of ForceQuiz field. -func (k *KeyboardButtonTypeRequestPoll) GetForceQuiz() (value bool) { - if k == nil { - return - } - return k.ForceQuiz -} - -// KeyboardButtonTypeRequestUsers represents TL type `keyboardButtonTypeRequestUsers#985c8bfd`. -type KeyboardButtonTypeRequestUsers struct { - // Unique button identifier - ID int32 - // True, if the shared users must or must not be bots - RestrictUserIsBot bool - // True, if the shared users must be bots; otherwise, the shared users must not be bots. - // Ignored if restrict_user_is_bot is false - UserIsBot bool - // True, if the shared users must or must not be Telegram Premium users - RestrictUserIsPremium bool - // True, if the shared users must be Telegram Premium users; otherwise, the shared users - // must not be Telegram Premium users. Ignored if restrict_user_is_premium is false - UserIsPremium bool - // The maximum number of users to share - MaxQuantity int32 - // Pass true to request name of the users; bots only - RequestName bool - // Pass true to request username of the users; bots only - RequestUsername bool - // Pass true to request photo of the users; bots only - RequestPhoto bool -} - -// KeyboardButtonTypeRequestUsersTypeID is TL type id of KeyboardButtonTypeRequestUsers. -const KeyboardButtonTypeRequestUsersTypeID = 0x985c8bfd - -// construct implements constructor of KeyboardButtonTypeClass. -func (k KeyboardButtonTypeRequestUsers) construct() KeyboardButtonTypeClass { return &k } - -// Ensuring interfaces in compile-time for KeyboardButtonTypeRequestUsers. -var ( - _ bin.Encoder = &KeyboardButtonTypeRequestUsers{} - _ bin.Decoder = &KeyboardButtonTypeRequestUsers{} - _ bin.BareEncoder = &KeyboardButtonTypeRequestUsers{} - _ bin.BareDecoder = &KeyboardButtonTypeRequestUsers{} - - _ KeyboardButtonTypeClass = &KeyboardButtonTypeRequestUsers{} -) - -func (k *KeyboardButtonTypeRequestUsers) Zero() bool { - if k == nil { - return true - } - if !(k.ID == 0) { - return false - } - if !(k.RestrictUserIsBot == false) { - return false - } - if !(k.UserIsBot == false) { - return false - } - if !(k.RestrictUserIsPremium == false) { - return false - } - if !(k.UserIsPremium == false) { - return false - } - if !(k.MaxQuantity == 0) { - return false - } - if !(k.RequestName == false) { - return false - } - if !(k.RequestUsername == false) { - return false - } - if !(k.RequestPhoto == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (k *KeyboardButtonTypeRequestUsers) String() string { - if k == nil { - return "KeyboardButtonTypeRequestUsers(nil)" - } - type Alias KeyboardButtonTypeRequestUsers - return fmt.Sprintf("KeyboardButtonTypeRequestUsers%+v", Alias(*k)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*KeyboardButtonTypeRequestUsers) TypeID() uint32 { - return KeyboardButtonTypeRequestUsersTypeID -} - -// TypeName returns name of type in TL schema. -func (*KeyboardButtonTypeRequestUsers) TypeName() string { - return "keyboardButtonTypeRequestUsers" -} - -// TypeInfo returns info about TL type. -func (k *KeyboardButtonTypeRequestUsers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "keyboardButtonTypeRequestUsers", - ID: KeyboardButtonTypeRequestUsersTypeID, - } - if k == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "RestrictUserIsBot", - SchemaName: "restrict_user_is_bot", - }, - { - Name: "UserIsBot", - SchemaName: "user_is_bot", - }, - { - Name: "RestrictUserIsPremium", - SchemaName: "restrict_user_is_premium", - }, - { - Name: "UserIsPremium", - SchemaName: "user_is_premium", - }, - { - Name: "MaxQuantity", - SchemaName: "max_quantity", - }, - { - Name: "RequestName", - SchemaName: "request_name", - }, - { - Name: "RequestUsername", - SchemaName: "request_username", - }, - { - Name: "RequestPhoto", - SchemaName: "request_photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (k *KeyboardButtonTypeRequestUsers) Encode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestUsers#985c8bfd as nil") - } - b.PutID(KeyboardButtonTypeRequestUsersTypeID) - return k.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (k *KeyboardButtonTypeRequestUsers) EncodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestUsers#985c8bfd as nil") - } - b.PutInt32(k.ID) - b.PutBool(k.RestrictUserIsBot) - b.PutBool(k.UserIsBot) - b.PutBool(k.RestrictUserIsPremium) - b.PutBool(k.UserIsPremium) - b.PutInt32(k.MaxQuantity) - b.PutBool(k.RequestName) - b.PutBool(k.RequestUsername) - b.PutBool(k.RequestPhoto) - return nil -} - -// Decode implements bin.Decoder. -func (k *KeyboardButtonTypeRequestUsers) Decode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestUsers#985c8bfd to nil") - } - if err := b.ConsumeID(KeyboardButtonTypeRequestUsersTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: %w", err) - } - return k.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (k *KeyboardButtonTypeRequestUsers) DecodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestUsers#985c8bfd to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field id: %w", err) - } - k.ID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field restrict_user_is_bot: %w", err) - } - k.RestrictUserIsBot = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field user_is_bot: %w", err) - } - k.UserIsBot = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field restrict_user_is_premium: %w", err) - } - k.RestrictUserIsPremium = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field user_is_premium: %w", err) - } - k.UserIsPremium = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field max_quantity: %w", err) - } - k.MaxQuantity = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field request_name: %w", err) - } - k.RequestName = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field request_username: %w", err) - } - k.RequestUsername = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field request_photo: %w", err) - } - k.RequestPhoto = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (k *KeyboardButtonTypeRequestUsers) EncodeTDLibJSON(b tdjson.Encoder) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestUsers#985c8bfd as nil") - } - b.ObjStart() - b.PutID("keyboardButtonTypeRequestUsers") - b.Comma() - b.FieldStart("id") - b.PutInt32(k.ID) - b.Comma() - b.FieldStart("restrict_user_is_bot") - b.PutBool(k.RestrictUserIsBot) - b.Comma() - b.FieldStart("user_is_bot") - b.PutBool(k.UserIsBot) - b.Comma() - b.FieldStart("restrict_user_is_premium") - b.PutBool(k.RestrictUserIsPremium) - b.Comma() - b.FieldStart("user_is_premium") - b.PutBool(k.UserIsPremium) - b.Comma() - b.FieldStart("max_quantity") - b.PutInt32(k.MaxQuantity) - b.Comma() - b.FieldStart("request_name") - b.PutBool(k.RequestName) - b.Comma() - b.FieldStart("request_username") - b.PutBool(k.RequestUsername) - b.Comma() - b.FieldStart("request_photo") - b.PutBool(k.RequestPhoto) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (k *KeyboardButtonTypeRequestUsers) DecodeTDLibJSON(b tdjson.Decoder) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestUsers#985c8bfd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("keyboardButtonTypeRequestUsers"); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field id: %w", err) - } - k.ID = value - case "restrict_user_is_bot": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field restrict_user_is_bot: %w", err) - } - k.RestrictUserIsBot = value - case "user_is_bot": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field user_is_bot: %w", err) - } - k.UserIsBot = value - case "restrict_user_is_premium": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field restrict_user_is_premium: %w", err) - } - k.RestrictUserIsPremium = value - case "user_is_premium": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field user_is_premium: %w", err) - } - k.UserIsPremium = value - case "max_quantity": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field max_quantity: %w", err) - } - k.MaxQuantity = value - case "request_name": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field request_name: %w", err) - } - k.RequestName = value - case "request_username": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field request_username: %w", err) - } - k.RequestUsername = value - case "request_photo": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestUsers#985c8bfd: field request_photo: %w", err) - } - k.RequestPhoto = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (k *KeyboardButtonTypeRequestUsers) GetID() (value int32) { - if k == nil { - return - } - return k.ID -} - -// GetRestrictUserIsBot returns value of RestrictUserIsBot field. -func (k *KeyboardButtonTypeRequestUsers) GetRestrictUserIsBot() (value bool) { - if k == nil { - return - } - return k.RestrictUserIsBot -} - -// GetUserIsBot returns value of UserIsBot field. -func (k *KeyboardButtonTypeRequestUsers) GetUserIsBot() (value bool) { - if k == nil { - return - } - return k.UserIsBot -} - -// GetRestrictUserIsPremium returns value of RestrictUserIsPremium field. -func (k *KeyboardButtonTypeRequestUsers) GetRestrictUserIsPremium() (value bool) { - if k == nil { - return - } - return k.RestrictUserIsPremium -} - -// GetUserIsPremium returns value of UserIsPremium field. -func (k *KeyboardButtonTypeRequestUsers) GetUserIsPremium() (value bool) { - if k == nil { - return - } - return k.UserIsPremium -} - -// GetMaxQuantity returns value of MaxQuantity field. -func (k *KeyboardButtonTypeRequestUsers) GetMaxQuantity() (value int32) { - if k == nil { - return - } - return k.MaxQuantity -} - -// GetRequestName returns value of RequestName field. -func (k *KeyboardButtonTypeRequestUsers) GetRequestName() (value bool) { - if k == nil { - return - } - return k.RequestName -} - -// GetRequestUsername returns value of RequestUsername field. -func (k *KeyboardButtonTypeRequestUsers) GetRequestUsername() (value bool) { - if k == nil { - return - } - return k.RequestUsername -} - -// GetRequestPhoto returns value of RequestPhoto field. -func (k *KeyboardButtonTypeRequestUsers) GetRequestPhoto() (value bool) { - if k == nil { - return - } - return k.RequestPhoto -} - -// KeyboardButtonTypeRequestChat represents TL type `keyboardButtonTypeRequestChat#5a1224b5`. -type KeyboardButtonTypeRequestChat struct { - // Unique button identifier - ID int32 - // True, if the chat must be a channel; otherwise, a basic group or a supergroup chat is - // shared - ChatIsChannel bool - // True, if the chat must or must not be a forum supergroup - RestrictChatIsForum bool - // True, if the chat must be a forum supergroup; otherwise, the chat must not be a forum - // supergroup. Ignored if restrict_chat_is_forum is false - ChatIsForum bool - // True, if the chat must or must not have a username - RestrictChatHasUsername bool - // True, if the chat must have a username; otherwise, the chat must not have a username. - // Ignored if restrict_chat_has_username is false - ChatHasUsername bool - // True, if the chat must be created by the current user - ChatIsCreated bool - // Expected user administrator rights in the chat; may be null if they aren't restricted - UserAdministratorRights ChatAdministratorRights - // Expected bot administrator rights in the chat; may be null if they aren't restricted - BotAdministratorRights ChatAdministratorRights - // True, if the bot must be a member of the chat; for basic group and supergroup chats - // only - BotIsMember bool - // Pass true to request title of the chat; bots only - RequestTitle bool - // Pass true to request username of the chat; bots only - RequestUsername bool - // Pass true to request photo of the chat; bots only - RequestPhoto bool -} - -// KeyboardButtonTypeRequestChatTypeID is TL type id of KeyboardButtonTypeRequestChat. -const KeyboardButtonTypeRequestChatTypeID = 0x5a1224b5 - -// construct implements constructor of KeyboardButtonTypeClass. -func (k KeyboardButtonTypeRequestChat) construct() KeyboardButtonTypeClass { return &k } - -// Ensuring interfaces in compile-time for KeyboardButtonTypeRequestChat. -var ( - _ bin.Encoder = &KeyboardButtonTypeRequestChat{} - _ bin.Decoder = &KeyboardButtonTypeRequestChat{} - _ bin.BareEncoder = &KeyboardButtonTypeRequestChat{} - _ bin.BareDecoder = &KeyboardButtonTypeRequestChat{} - - _ KeyboardButtonTypeClass = &KeyboardButtonTypeRequestChat{} -) - -func (k *KeyboardButtonTypeRequestChat) Zero() bool { - if k == nil { - return true - } - if !(k.ID == 0) { - return false - } - if !(k.ChatIsChannel == false) { - return false - } - if !(k.RestrictChatIsForum == false) { - return false - } - if !(k.ChatIsForum == false) { - return false - } - if !(k.RestrictChatHasUsername == false) { - return false - } - if !(k.ChatHasUsername == false) { - return false - } - if !(k.ChatIsCreated == false) { - return false - } - if !(k.UserAdministratorRights.Zero()) { - return false - } - if !(k.BotAdministratorRights.Zero()) { - return false - } - if !(k.BotIsMember == false) { - return false - } - if !(k.RequestTitle == false) { - return false - } - if !(k.RequestUsername == false) { - return false - } - if !(k.RequestPhoto == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (k *KeyboardButtonTypeRequestChat) String() string { - if k == nil { - return "KeyboardButtonTypeRequestChat(nil)" - } - type Alias KeyboardButtonTypeRequestChat - return fmt.Sprintf("KeyboardButtonTypeRequestChat%+v", Alias(*k)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*KeyboardButtonTypeRequestChat) TypeID() uint32 { - return KeyboardButtonTypeRequestChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*KeyboardButtonTypeRequestChat) TypeName() string { - return "keyboardButtonTypeRequestChat" -} - -// TypeInfo returns info about TL type. -func (k *KeyboardButtonTypeRequestChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "keyboardButtonTypeRequestChat", - ID: KeyboardButtonTypeRequestChatTypeID, - } - if k == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "ChatIsChannel", - SchemaName: "chat_is_channel", - }, - { - Name: "RestrictChatIsForum", - SchemaName: "restrict_chat_is_forum", - }, - { - Name: "ChatIsForum", - SchemaName: "chat_is_forum", - }, - { - Name: "RestrictChatHasUsername", - SchemaName: "restrict_chat_has_username", - }, - { - Name: "ChatHasUsername", - SchemaName: "chat_has_username", - }, - { - Name: "ChatIsCreated", - SchemaName: "chat_is_created", - }, - { - Name: "UserAdministratorRights", - SchemaName: "user_administrator_rights", - }, - { - Name: "BotAdministratorRights", - SchemaName: "bot_administrator_rights", - }, - { - Name: "BotIsMember", - SchemaName: "bot_is_member", - }, - { - Name: "RequestTitle", - SchemaName: "request_title", - }, - { - Name: "RequestUsername", - SchemaName: "request_username", - }, - { - Name: "RequestPhoto", - SchemaName: "request_photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (k *KeyboardButtonTypeRequestChat) Encode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestChat#5a1224b5 as nil") - } - b.PutID(KeyboardButtonTypeRequestChatTypeID) - return k.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (k *KeyboardButtonTypeRequestChat) EncodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestChat#5a1224b5 as nil") - } - b.PutInt32(k.ID) - b.PutBool(k.ChatIsChannel) - b.PutBool(k.RestrictChatIsForum) - b.PutBool(k.ChatIsForum) - b.PutBool(k.RestrictChatHasUsername) - b.PutBool(k.ChatHasUsername) - b.PutBool(k.ChatIsCreated) - if err := k.UserAdministratorRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode keyboardButtonTypeRequestChat#5a1224b5: field user_administrator_rights: %w", err) - } - if err := k.BotAdministratorRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode keyboardButtonTypeRequestChat#5a1224b5: field bot_administrator_rights: %w", err) - } - b.PutBool(k.BotIsMember) - b.PutBool(k.RequestTitle) - b.PutBool(k.RequestUsername) - b.PutBool(k.RequestPhoto) - return nil -} - -// Decode implements bin.Decoder. -func (k *KeyboardButtonTypeRequestChat) Decode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestChat#5a1224b5 to nil") - } - if err := b.ConsumeID(KeyboardButtonTypeRequestChatTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: %w", err) - } - return k.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (k *KeyboardButtonTypeRequestChat) DecodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestChat#5a1224b5 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field id: %w", err) - } - k.ID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field chat_is_channel: %w", err) - } - k.ChatIsChannel = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field restrict_chat_is_forum: %w", err) - } - k.RestrictChatIsForum = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field chat_is_forum: %w", err) - } - k.ChatIsForum = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field restrict_chat_has_username: %w", err) - } - k.RestrictChatHasUsername = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field chat_has_username: %w", err) - } - k.ChatHasUsername = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field chat_is_created: %w", err) - } - k.ChatIsCreated = value - } - { - if err := k.UserAdministratorRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field user_administrator_rights: %w", err) - } - } - { - if err := k.BotAdministratorRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field bot_administrator_rights: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field bot_is_member: %w", err) - } - k.BotIsMember = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field request_title: %w", err) - } - k.RequestTitle = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field request_username: %w", err) - } - k.RequestUsername = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field request_photo: %w", err) - } - k.RequestPhoto = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (k *KeyboardButtonTypeRequestChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeRequestChat#5a1224b5 as nil") - } - b.ObjStart() - b.PutID("keyboardButtonTypeRequestChat") - b.Comma() - b.FieldStart("id") - b.PutInt32(k.ID) - b.Comma() - b.FieldStart("chat_is_channel") - b.PutBool(k.ChatIsChannel) - b.Comma() - b.FieldStart("restrict_chat_is_forum") - b.PutBool(k.RestrictChatIsForum) - b.Comma() - b.FieldStart("chat_is_forum") - b.PutBool(k.ChatIsForum) - b.Comma() - b.FieldStart("restrict_chat_has_username") - b.PutBool(k.RestrictChatHasUsername) - b.Comma() - b.FieldStart("chat_has_username") - b.PutBool(k.ChatHasUsername) - b.Comma() - b.FieldStart("chat_is_created") - b.PutBool(k.ChatIsCreated) - b.Comma() - b.FieldStart("user_administrator_rights") - if err := k.UserAdministratorRights.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode keyboardButtonTypeRequestChat#5a1224b5: field user_administrator_rights: %w", err) - } - b.Comma() - b.FieldStart("bot_administrator_rights") - if err := k.BotAdministratorRights.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode keyboardButtonTypeRequestChat#5a1224b5: field bot_administrator_rights: %w", err) - } - b.Comma() - b.FieldStart("bot_is_member") - b.PutBool(k.BotIsMember) - b.Comma() - b.FieldStart("request_title") - b.PutBool(k.RequestTitle) - b.Comma() - b.FieldStart("request_username") - b.PutBool(k.RequestUsername) - b.Comma() - b.FieldStart("request_photo") - b.PutBool(k.RequestPhoto) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (k *KeyboardButtonTypeRequestChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeRequestChat#5a1224b5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("keyboardButtonTypeRequestChat"); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field id: %w", err) - } - k.ID = value - case "chat_is_channel": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field chat_is_channel: %w", err) - } - k.ChatIsChannel = value - case "restrict_chat_is_forum": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field restrict_chat_is_forum: %w", err) - } - k.RestrictChatIsForum = value - case "chat_is_forum": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field chat_is_forum: %w", err) - } - k.ChatIsForum = value - case "restrict_chat_has_username": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field restrict_chat_has_username: %w", err) - } - k.RestrictChatHasUsername = value - case "chat_has_username": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field chat_has_username: %w", err) - } - k.ChatHasUsername = value - case "chat_is_created": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field chat_is_created: %w", err) - } - k.ChatIsCreated = value - case "user_administrator_rights": - if err := k.UserAdministratorRights.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field user_administrator_rights: %w", err) - } - case "bot_administrator_rights": - if err := k.BotAdministratorRights.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field bot_administrator_rights: %w", err) - } - case "bot_is_member": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field bot_is_member: %w", err) - } - k.BotIsMember = value - case "request_title": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field request_title: %w", err) - } - k.RequestTitle = value - case "request_username": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field request_username: %w", err) - } - k.RequestUsername = value - case "request_photo": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeRequestChat#5a1224b5: field request_photo: %w", err) - } - k.RequestPhoto = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (k *KeyboardButtonTypeRequestChat) GetID() (value int32) { - if k == nil { - return - } - return k.ID -} - -// GetChatIsChannel returns value of ChatIsChannel field. -func (k *KeyboardButtonTypeRequestChat) GetChatIsChannel() (value bool) { - if k == nil { - return - } - return k.ChatIsChannel -} - -// GetRestrictChatIsForum returns value of RestrictChatIsForum field. -func (k *KeyboardButtonTypeRequestChat) GetRestrictChatIsForum() (value bool) { - if k == nil { - return - } - return k.RestrictChatIsForum -} - -// GetChatIsForum returns value of ChatIsForum field. -func (k *KeyboardButtonTypeRequestChat) GetChatIsForum() (value bool) { - if k == nil { - return - } - return k.ChatIsForum -} - -// GetRestrictChatHasUsername returns value of RestrictChatHasUsername field. -func (k *KeyboardButtonTypeRequestChat) GetRestrictChatHasUsername() (value bool) { - if k == nil { - return - } - return k.RestrictChatHasUsername -} - -// GetChatHasUsername returns value of ChatHasUsername field. -func (k *KeyboardButtonTypeRequestChat) GetChatHasUsername() (value bool) { - if k == nil { - return - } - return k.ChatHasUsername -} - -// GetChatIsCreated returns value of ChatIsCreated field. -func (k *KeyboardButtonTypeRequestChat) GetChatIsCreated() (value bool) { - if k == nil { - return - } - return k.ChatIsCreated -} - -// GetUserAdministratorRights returns value of UserAdministratorRights field. -func (k *KeyboardButtonTypeRequestChat) GetUserAdministratorRights() (value ChatAdministratorRights) { - if k == nil { - return - } - return k.UserAdministratorRights -} - -// GetBotAdministratorRights returns value of BotAdministratorRights field. -func (k *KeyboardButtonTypeRequestChat) GetBotAdministratorRights() (value ChatAdministratorRights) { - if k == nil { - return - } - return k.BotAdministratorRights -} - -// GetBotIsMember returns value of BotIsMember field. -func (k *KeyboardButtonTypeRequestChat) GetBotIsMember() (value bool) { - if k == nil { - return - } - return k.BotIsMember -} - -// GetRequestTitle returns value of RequestTitle field. -func (k *KeyboardButtonTypeRequestChat) GetRequestTitle() (value bool) { - if k == nil { - return - } - return k.RequestTitle -} - -// GetRequestUsername returns value of RequestUsername field. -func (k *KeyboardButtonTypeRequestChat) GetRequestUsername() (value bool) { - if k == nil { - return - } - return k.RequestUsername -} - -// GetRequestPhoto returns value of RequestPhoto field. -func (k *KeyboardButtonTypeRequestChat) GetRequestPhoto() (value bool) { - if k == nil { - return - } - return k.RequestPhoto -} - -// KeyboardButtonTypeWebApp represents TL type `keyboardButtonTypeWebApp#70c8ff62`. -type KeyboardButtonTypeWebApp struct { - // An HTTP URL to pass to getWebAppUrl - URL string -} - -// KeyboardButtonTypeWebAppTypeID is TL type id of KeyboardButtonTypeWebApp. -const KeyboardButtonTypeWebAppTypeID = 0x70c8ff62 - -// construct implements constructor of KeyboardButtonTypeClass. -func (k KeyboardButtonTypeWebApp) construct() KeyboardButtonTypeClass { return &k } - -// Ensuring interfaces in compile-time for KeyboardButtonTypeWebApp. -var ( - _ bin.Encoder = &KeyboardButtonTypeWebApp{} - _ bin.Decoder = &KeyboardButtonTypeWebApp{} - _ bin.BareEncoder = &KeyboardButtonTypeWebApp{} - _ bin.BareDecoder = &KeyboardButtonTypeWebApp{} - - _ KeyboardButtonTypeClass = &KeyboardButtonTypeWebApp{} -) - -func (k *KeyboardButtonTypeWebApp) Zero() bool { - if k == nil { - return true - } - if !(k.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (k *KeyboardButtonTypeWebApp) String() string { - if k == nil { - return "KeyboardButtonTypeWebApp(nil)" - } - type Alias KeyboardButtonTypeWebApp - return fmt.Sprintf("KeyboardButtonTypeWebApp%+v", Alias(*k)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*KeyboardButtonTypeWebApp) TypeID() uint32 { - return KeyboardButtonTypeWebAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*KeyboardButtonTypeWebApp) TypeName() string { - return "keyboardButtonTypeWebApp" -} - -// TypeInfo returns info about TL type. -func (k *KeyboardButtonTypeWebApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "keyboardButtonTypeWebApp", - ID: KeyboardButtonTypeWebAppTypeID, - } - if k == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (k *KeyboardButtonTypeWebApp) Encode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeWebApp#70c8ff62 as nil") - } - b.PutID(KeyboardButtonTypeWebAppTypeID) - return k.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (k *KeyboardButtonTypeWebApp) EncodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeWebApp#70c8ff62 as nil") - } - b.PutString(k.URL) - return nil -} - -// Decode implements bin.Decoder. -func (k *KeyboardButtonTypeWebApp) Decode(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeWebApp#70c8ff62 to nil") - } - if err := b.ConsumeID(KeyboardButtonTypeWebAppTypeID); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeWebApp#70c8ff62: %w", err) - } - return k.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (k *KeyboardButtonTypeWebApp) DecodeBare(b *bin.Buffer) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeWebApp#70c8ff62 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeWebApp#70c8ff62: field url: %w", err) - } - k.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (k *KeyboardButtonTypeWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { - if k == nil { - return fmt.Errorf("can't encode keyboardButtonTypeWebApp#70c8ff62 as nil") - } - b.ObjStart() - b.PutID("keyboardButtonTypeWebApp") - b.Comma() - b.FieldStart("url") - b.PutString(k.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (k *KeyboardButtonTypeWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { - if k == nil { - return fmt.Errorf("can't decode keyboardButtonTypeWebApp#70c8ff62 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("keyboardButtonTypeWebApp"); err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeWebApp#70c8ff62: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode keyboardButtonTypeWebApp#70c8ff62: field url: %w", err) - } - k.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (k *KeyboardButtonTypeWebApp) GetURL() (value string) { - if k == nil { - return - } - return k.URL -} - -// KeyboardButtonTypeClassName is schema name of KeyboardButtonTypeClass. -const KeyboardButtonTypeClassName = "KeyboardButtonType" - -// KeyboardButtonTypeClass represents KeyboardButtonType generic type. -// -// Example: -// -// g, err := tdapi.DecodeKeyboardButtonType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.KeyboardButtonTypeText: // keyboardButtonTypeText#96519938 -// case *tdapi.KeyboardButtonTypeRequestPhoneNumber: // keyboardButtonTypeRequestPhoneNumber#a4d9b7b9 -// case *tdapi.KeyboardButtonTypeRequestLocation: // keyboardButtonTypeRequestLocation#f8828cfd -// case *tdapi.KeyboardButtonTypeRequestPoll: // keyboardButtonTypeRequestPoll#7164dcb8 -// case *tdapi.KeyboardButtonTypeRequestUsers: // keyboardButtonTypeRequestUsers#985c8bfd -// case *tdapi.KeyboardButtonTypeRequestChat: // keyboardButtonTypeRequestChat#5a1224b5 -// case *tdapi.KeyboardButtonTypeWebApp: // keyboardButtonTypeWebApp#70c8ff62 -// default: panic(v) -// } -type KeyboardButtonTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() KeyboardButtonTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeKeyboardButtonType implements binary de-serialization for KeyboardButtonTypeClass. -func DecodeKeyboardButtonType(buf *bin.Buffer) (KeyboardButtonTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case KeyboardButtonTypeTextTypeID: - // Decoding keyboardButtonTypeText#96519938. - v := KeyboardButtonTypeText{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case KeyboardButtonTypeRequestPhoneNumberTypeID: - // Decoding keyboardButtonTypeRequestPhoneNumber#a4d9b7b9. - v := KeyboardButtonTypeRequestPhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case KeyboardButtonTypeRequestLocationTypeID: - // Decoding keyboardButtonTypeRequestLocation#f8828cfd. - v := KeyboardButtonTypeRequestLocation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case KeyboardButtonTypeRequestPollTypeID: - // Decoding keyboardButtonTypeRequestPoll#7164dcb8. - v := KeyboardButtonTypeRequestPoll{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case KeyboardButtonTypeRequestUsersTypeID: - // Decoding keyboardButtonTypeRequestUsers#985c8bfd. - v := KeyboardButtonTypeRequestUsers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case KeyboardButtonTypeRequestChatTypeID: - // Decoding keyboardButtonTypeRequestChat#5a1224b5. - v := KeyboardButtonTypeRequestChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case KeyboardButtonTypeWebAppTypeID: - // Decoding keyboardButtonTypeWebApp#70c8ff62. - v := KeyboardButtonTypeWebApp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONKeyboardButtonType implements binary de-serialization for KeyboardButtonTypeClass. -func DecodeTDLibJSONKeyboardButtonType(buf tdjson.Decoder) (KeyboardButtonTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "keyboardButtonTypeText": - // Decoding keyboardButtonTypeText#96519938. - v := KeyboardButtonTypeText{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "keyboardButtonTypeRequestPhoneNumber": - // Decoding keyboardButtonTypeRequestPhoneNumber#a4d9b7b9. - v := KeyboardButtonTypeRequestPhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "keyboardButtonTypeRequestLocation": - // Decoding keyboardButtonTypeRequestLocation#f8828cfd. - v := KeyboardButtonTypeRequestLocation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "keyboardButtonTypeRequestPoll": - // Decoding keyboardButtonTypeRequestPoll#7164dcb8. - v := KeyboardButtonTypeRequestPoll{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "keyboardButtonTypeRequestUsers": - // Decoding keyboardButtonTypeRequestUsers#985c8bfd. - v := KeyboardButtonTypeRequestUsers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "keyboardButtonTypeRequestChat": - // Decoding keyboardButtonTypeRequestChat#5a1224b5. - v := KeyboardButtonTypeRequestChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - case "keyboardButtonTypeWebApp": - // Decoding keyboardButtonTypeWebApp#70c8ff62. - v := KeyboardButtonTypeWebApp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode KeyboardButtonTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// KeyboardButtonType boxes the KeyboardButtonTypeClass providing a helper. -type KeyboardButtonTypeBox struct { - KeyboardButtonType KeyboardButtonTypeClass -} - -// Decode implements bin.Decoder for KeyboardButtonTypeBox. -func (b *KeyboardButtonTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode KeyboardButtonTypeBox to nil") - } - v, err := DecodeKeyboardButtonType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.KeyboardButtonType = v - return nil -} - -// Encode implements bin.Encode for KeyboardButtonTypeBox. -func (b *KeyboardButtonTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.KeyboardButtonType == nil { - return fmt.Errorf("unable to encode KeyboardButtonTypeClass as nil") - } - return b.KeyboardButtonType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for KeyboardButtonTypeBox. -func (b *KeyboardButtonTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode KeyboardButtonTypeBox to nil") - } - v, err := DecodeTDLibJSONKeyboardButtonType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.KeyboardButtonType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for KeyboardButtonTypeBox. -func (b *KeyboardButtonTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.KeyboardButtonType == nil { - return fmt.Errorf("unable to encode KeyboardButtonTypeClass as nil") - } - return b.KeyboardButtonType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_labeled_price_part_gen.go b/tdapi/tl_labeled_price_part_gen.go deleted file mode 100644 index 22cf7387f..000000000 --- a/tdapi/tl_labeled_price_part_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LabeledPricePart represents TL type `labeledPricePart#20f2e726`. -type LabeledPricePart struct { - // Label for this portion of the product price - Label string - // Currency amount in the smallest units of the currency - Amount int64 -} - -// LabeledPricePartTypeID is TL type id of LabeledPricePart. -const LabeledPricePartTypeID = 0x20f2e726 - -// Ensuring interfaces in compile-time for LabeledPricePart. -var ( - _ bin.Encoder = &LabeledPricePart{} - _ bin.Decoder = &LabeledPricePart{} - _ bin.BareEncoder = &LabeledPricePart{} - _ bin.BareDecoder = &LabeledPricePart{} -) - -func (l *LabeledPricePart) Zero() bool { - if l == nil { - return true - } - if !(l.Label == "") { - return false - } - if !(l.Amount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LabeledPricePart) String() string { - if l == nil { - return "LabeledPricePart(nil)" - } - type Alias LabeledPricePart - return fmt.Sprintf("LabeledPricePart%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LabeledPricePart) TypeID() uint32 { - return LabeledPricePartTypeID -} - -// TypeName returns name of type in TL schema. -func (*LabeledPricePart) TypeName() string { - return "labeledPricePart" -} - -// TypeInfo returns info about TL type. -func (l *LabeledPricePart) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "labeledPricePart", - ID: LabeledPricePartTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Label", - SchemaName: "label", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LabeledPricePart) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode labeledPricePart#20f2e726 as nil") - } - b.PutID(LabeledPricePartTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LabeledPricePart) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode labeledPricePart#20f2e726 as nil") - } - b.PutString(l.Label) - b.PutInt53(l.Amount) - return nil -} - -// Decode implements bin.Decoder. -func (l *LabeledPricePart) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode labeledPricePart#20f2e726 to nil") - } - if err := b.ConsumeID(LabeledPricePartTypeID); err != nil { - return fmt.Errorf("unable to decode labeledPricePart#20f2e726: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LabeledPricePart) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode labeledPricePart#20f2e726 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode labeledPricePart#20f2e726: field label: %w", err) - } - l.Label = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode labeledPricePart#20f2e726: field amount: %w", err) - } - l.Amount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LabeledPricePart) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode labeledPricePart#20f2e726 as nil") - } - b.ObjStart() - b.PutID("labeledPricePart") - b.Comma() - b.FieldStart("label") - b.PutString(l.Label) - b.Comma() - b.FieldStart("amount") - b.PutInt53(l.Amount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LabeledPricePart) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode labeledPricePart#20f2e726 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("labeledPricePart"); err != nil { - return fmt.Errorf("unable to decode labeledPricePart#20f2e726: %w", err) - } - case "label": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode labeledPricePart#20f2e726: field label: %w", err) - } - l.Label = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode labeledPricePart#20f2e726: field amount: %w", err) - } - l.Amount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLabel returns value of Label field. -func (l *LabeledPricePart) GetLabel() (value string) { - if l == nil { - return - } - return l.Label -} - -// GetAmount returns value of Amount field. -func (l *LabeledPricePart) GetAmount() (value int64) { - if l == nil { - return - } - return l.Amount -} diff --git a/tdapi/tl_language_pack_info_gen.go b/tdapi/tl_language_pack_info_gen.go deleted file mode 100644 index a9a9b1fe0..000000000 --- a/tdapi/tl_language_pack_info_gen.go +++ /dev/null @@ -1,604 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LanguagePackInfo represents TL type `languagePackInfo#20514f5a`. -type LanguagePackInfo struct { - // Unique language pack identifier - ID string - // Identifier of a base language pack; may be empty. If a string is missed in the - // language pack, then it must be fetched from base language pack. Unsupported in custom - // language packs - BaseLanguagePackID string - // Language name - Name string - // Name of the language in that language - NativeName string - // A language code to be used to apply plural forms. See https://www.unicode - // org/cldr/charts/latest/supplemental/language_plural_rules.html for more information - PluralCode string - // True, if the language pack is official - IsOfficial bool - // True, if the language pack strings are RTL - IsRtl bool - // True, if the language pack is a beta language pack - IsBeta bool - // True, if the language pack is installed by the current user - IsInstalled bool - // Total number of non-deleted strings from the language pack - TotalStringCount int32 - // Total number of translated strings from the language pack - TranslatedStringCount int32 - // Total number of non-deleted strings from the language pack available locally - LocalStringCount int32 - // Link to language translation interface; empty for custom local language packs - TranslationURL string -} - -// LanguagePackInfoTypeID is TL type id of LanguagePackInfo. -const LanguagePackInfoTypeID = 0x20514f5a - -// Ensuring interfaces in compile-time for LanguagePackInfo. -var ( - _ bin.Encoder = &LanguagePackInfo{} - _ bin.Decoder = &LanguagePackInfo{} - _ bin.BareEncoder = &LanguagePackInfo{} - _ bin.BareDecoder = &LanguagePackInfo{} -) - -func (l *LanguagePackInfo) Zero() bool { - if l == nil { - return true - } - if !(l.ID == "") { - return false - } - if !(l.BaseLanguagePackID == "") { - return false - } - if !(l.Name == "") { - return false - } - if !(l.NativeName == "") { - return false - } - if !(l.PluralCode == "") { - return false - } - if !(l.IsOfficial == false) { - return false - } - if !(l.IsRtl == false) { - return false - } - if !(l.IsBeta == false) { - return false - } - if !(l.IsInstalled == false) { - return false - } - if !(l.TotalStringCount == 0) { - return false - } - if !(l.TranslatedStringCount == 0) { - return false - } - if !(l.LocalStringCount == 0) { - return false - } - if !(l.TranslationURL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LanguagePackInfo) String() string { - if l == nil { - return "LanguagePackInfo(nil)" - } - type Alias LanguagePackInfo - return fmt.Sprintf("LanguagePackInfo%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LanguagePackInfo) TypeID() uint32 { - return LanguagePackInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*LanguagePackInfo) TypeName() string { - return "languagePackInfo" -} - -// TypeInfo returns info about TL type. -func (l *LanguagePackInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "languagePackInfo", - ID: LanguagePackInfoTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "BaseLanguagePackID", - SchemaName: "base_language_pack_id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "NativeName", - SchemaName: "native_name", - }, - { - Name: "PluralCode", - SchemaName: "plural_code", - }, - { - Name: "IsOfficial", - SchemaName: "is_official", - }, - { - Name: "IsRtl", - SchemaName: "is_rtl", - }, - { - Name: "IsBeta", - SchemaName: "is_beta", - }, - { - Name: "IsInstalled", - SchemaName: "is_installed", - }, - { - Name: "TotalStringCount", - SchemaName: "total_string_count", - }, - { - Name: "TranslatedStringCount", - SchemaName: "translated_string_count", - }, - { - Name: "LocalStringCount", - SchemaName: "local_string_count", - }, - { - Name: "TranslationURL", - SchemaName: "translation_url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LanguagePackInfo) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackInfo#20514f5a as nil") - } - b.PutID(LanguagePackInfoTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LanguagePackInfo) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackInfo#20514f5a as nil") - } - b.PutString(l.ID) - b.PutString(l.BaseLanguagePackID) - b.PutString(l.Name) - b.PutString(l.NativeName) - b.PutString(l.PluralCode) - b.PutBool(l.IsOfficial) - b.PutBool(l.IsRtl) - b.PutBool(l.IsBeta) - b.PutBool(l.IsInstalled) - b.PutInt32(l.TotalStringCount) - b.PutInt32(l.TranslatedStringCount) - b.PutInt32(l.LocalStringCount) - b.PutString(l.TranslationURL) - return nil -} - -// Decode implements bin.Decoder. -func (l *LanguagePackInfo) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackInfo#20514f5a to nil") - } - if err := b.ConsumeID(LanguagePackInfoTypeID); err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LanguagePackInfo) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackInfo#20514f5a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field id: %w", err) - } - l.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field base_language_pack_id: %w", err) - } - l.BaseLanguagePackID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field name: %w", err) - } - l.Name = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field native_name: %w", err) - } - l.NativeName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field plural_code: %w", err) - } - l.PluralCode = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field is_official: %w", err) - } - l.IsOfficial = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field is_rtl: %w", err) - } - l.IsRtl = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field is_beta: %w", err) - } - l.IsBeta = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field is_installed: %w", err) - } - l.IsInstalled = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field total_string_count: %w", err) - } - l.TotalStringCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field translated_string_count: %w", err) - } - l.TranslatedStringCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field local_string_count: %w", err) - } - l.LocalStringCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field translation_url: %w", err) - } - l.TranslationURL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LanguagePackInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode languagePackInfo#20514f5a as nil") - } - b.ObjStart() - b.PutID("languagePackInfo") - b.Comma() - b.FieldStart("id") - b.PutString(l.ID) - b.Comma() - b.FieldStart("base_language_pack_id") - b.PutString(l.BaseLanguagePackID) - b.Comma() - b.FieldStart("name") - b.PutString(l.Name) - b.Comma() - b.FieldStart("native_name") - b.PutString(l.NativeName) - b.Comma() - b.FieldStart("plural_code") - b.PutString(l.PluralCode) - b.Comma() - b.FieldStart("is_official") - b.PutBool(l.IsOfficial) - b.Comma() - b.FieldStart("is_rtl") - b.PutBool(l.IsRtl) - b.Comma() - b.FieldStart("is_beta") - b.PutBool(l.IsBeta) - b.Comma() - b.FieldStart("is_installed") - b.PutBool(l.IsInstalled) - b.Comma() - b.FieldStart("total_string_count") - b.PutInt32(l.TotalStringCount) - b.Comma() - b.FieldStart("translated_string_count") - b.PutInt32(l.TranslatedStringCount) - b.Comma() - b.FieldStart("local_string_count") - b.PutInt32(l.LocalStringCount) - b.Comma() - b.FieldStart("translation_url") - b.PutString(l.TranslationURL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LanguagePackInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode languagePackInfo#20514f5a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("languagePackInfo"); err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field id: %w", err) - } - l.ID = value - case "base_language_pack_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field base_language_pack_id: %w", err) - } - l.BaseLanguagePackID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field name: %w", err) - } - l.Name = value - case "native_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field native_name: %w", err) - } - l.NativeName = value - case "plural_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field plural_code: %w", err) - } - l.PluralCode = value - case "is_official": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field is_official: %w", err) - } - l.IsOfficial = value - case "is_rtl": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field is_rtl: %w", err) - } - l.IsRtl = value - case "is_beta": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field is_beta: %w", err) - } - l.IsBeta = value - case "is_installed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field is_installed: %w", err) - } - l.IsInstalled = value - case "total_string_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field total_string_count: %w", err) - } - l.TotalStringCount = value - case "translated_string_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field translated_string_count: %w", err) - } - l.TranslatedStringCount = value - case "local_string_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field local_string_count: %w", err) - } - l.LocalStringCount = value - case "translation_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackInfo#20514f5a: field translation_url: %w", err) - } - l.TranslationURL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (l *LanguagePackInfo) GetID() (value string) { - if l == nil { - return - } - return l.ID -} - -// GetBaseLanguagePackID returns value of BaseLanguagePackID field. -func (l *LanguagePackInfo) GetBaseLanguagePackID() (value string) { - if l == nil { - return - } - return l.BaseLanguagePackID -} - -// GetName returns value of Name field. -func (l *LanguagePackInfo) GetName() (value string) { - if l == nil { - return - } - return l.Name -} - -// GetNativeName returns value of NativeName field. -func (l *LanguagePackInfo) GetNativeName() (value string) { - if l == nil { - return - } - return l.NativeName -} - -// GetPluralCode returns value of PluralCode field. -func (l *LanguagePackInfo) GetPluralCode() (value string) { - if l == nil { - return - } - return l.PluralCode -} - -// GetIsOfficial returns value of IsOfficial field. -func (l *LanguagePackInfo) GetIsOfficial() (value bool) { - if l == nil { - return - } - return l.IsOfficial -} - -// GetIsRtl returns value of IsRtl field. -func (l *LanguagePackInfo) GetIsRtl() (value bool) { - if l == nil { - return - } - return l.IsRtl -} - -// GetIsBeta returns value of IsBeta field. -func (l *LanguagePackInfo) GetIsBeta() (value bool) { - if l == nil { - return - } - return l.IsBeta -} - -// GetIsInstalled returns value of IsInstalled field. -func (l *LanguagePackInfo) GetIsInstalled() (value bool) { - if l == nil { - return - } - return l.IsInstalled -} - -// GetTotalStringCount returns value of TotalStringCount field. -func (l *LanguagePackInfo) GetTotalStringCount() (value int32) { - if l == nil { - return - } - return l.TotalStringCount -} - -// GetTranslatedStringCount returns value of TranslatedStringCount field. -func (l *LanguagePackInfo) GetTranslatedStringCount() (value int32) { - if l == nil { - return - } - return l.TranslatedStringCount -} - -// GetLocalStringCount returns value of LocalStringCount field. -func (l *LanguagePackInfo) GetLocalStringCount() (value int32) { - if l == nil { - return - } - return l.LocalStringCount -} - -// GetTranslationURL returns value of TranslationURL field. -func (l *LanguagePackInfo) GetTranslationURL() (value string) { - if l == nil { - return - } - return l.TranslationURL -} diff --git a/tdapi/tl_language_pack_string_gen.go b/tdapi/tl_language_pack_string_gen.go deleted file mode 100644 index a5897df35..000000000 --- a/tdapi/tl_language_pack_string_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LanguagePackString represents TL type `languagePackString#4df0e460`. -type LanguagePackString struct { - // String key - Key string - // String value; pass null if the string needs to be taken from the built-in English - // language pack - Value LanguagePackStringValueClass -} - -// LanguagePackStringTypeID is TL type id of LanguagePackString. -const LanguagePackStringTypeID = 0x4df0e460 - -// Ensuring interfaces in compile-time for LanguagePackString. -var ( - _ bin.Encoder = &LanguagePackString{} - _ bin.Decoder = &LanguagePackString{} - _ bin.BareEncoder = &LanguagePackString{} - _ bin.BareDecoder = &LanguagePackString{} -) - -func (l *LanguagePackString) Zero() bool { - if l == nil { - return true - } - if !(l.Key == "") { - return false - } - if !(l.Value == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LanguagePackString) String() string { - if l == nil { - return "LanguagePackString(nil)" - } - type Alias LanguagePackString - return fmt.Sprintf("LanguagePackString%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LanguagePackString) TypeID() uint32 { - return LanguagePackStringTypeID -} - -// TypeName returns name of type in TL schema. -func (*LanguagePackString) TypeName() string { - return "languagePackString" -} - -// TypeInfo returns info about TL type. -func (l *LanguagePackString) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "languagePackString", - ID: LanguagePackStringTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Key", - SchemaName: "key", - }, - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LanguagePackString) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackString#4df0e460 as nil") - } - b.PutID(LanguagePackStringTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LanguagePackString) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackString#4df0e460 as nil") - } - b.PutString(l.Key) - if l.Value == nil { - return fmt.Errorf("unable to encode languagePackString#4df0e460: field value is nil") - } - if err := l.Value.Encode(b); err != nil { - return fmt.Errorf("unable to encode languagePackString#4df0e460: field value: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LanguagePackString) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackString#4df0e460 to nil") - } - if err := b.ConsumeID(LanguagePackStringTypeID); err != nil { - return fmt.Errorf("unable to decode languagePackString#4df0e460: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LanguagePackString) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackString#4df0e460 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackString#4df0e460: field key: %w", err) - } - l.Key = value - } - { - value, err := DecodeLanguagePackStringValue(b) - if err != nil { - return fmt.Errorf("unable to decode languagePackString#4df0e460: field value: %w", err) - } - l.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LanguagePackString) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode languagePackString#4df0e460 as nil") - } - b.ObjStart() - b.PutID("languagePackString") - b.Comma() - b.FieldStart("key") - b.PutString(l.Key) - b.Comma() - b.FieldStart("value") - if l.Value == nil { - return fmt.Errorf("unable to encode languagePackString#4df0e460: field value is nil") - } - if err := l.Value.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode languagePackString#4df0e460: field value: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LanguagePackString) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode languagePackString#4df0e460 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("languagePackString"); err != nil { - return fmt.Errorf("unable to decode languagePackString#4df0e460: %w", err) - } - case "key": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackString#4df0e460: field key: %w", err) - } - l.Key = value - case "value": - value, err := DecodeTDLibJSONLanguagePackStringValue(b) - if err != nil { - return fmt.Errorf("unable to decode languagePackString#4df0e460: field value: %w", err) - } - l.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetKey returns value of Key field. -func (l *LanguagePackString) GetKey() (value string) { - if l == nil { - return - } - return l.Key -} - -// GetValue returns value of Value field. -func (l *LanguagePackString) GetValue() (value LanguagePackStringValueClass) { - if l == nil { - return - } - return l.Value -} diff --git a/tdapi/tl_language_pack_string_value_gen.go b/tdapi/tl_language_pack_string_value_gen.go deleted file mode 100644 index 954378cbb..000000000 --- a/tdapi/tl_language_pack_string_value_gen.go +++ /dev/null @@ -1,817 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LanguagePackStringValueOrdinary represents TL type `languagePackStringValueOrdinary#f124a660`. -type LanguagePackStringValueOrdinary struct { - // String value - Value string -} - -// LanguagePackStringValueOrdinaryTypeID is TL type id of LanguagePackStringValueOrdinary. -const LanguagePackStringValueOrdinaryTypeID = 0xf124a660 - -// construct implements constructor of LanguagePackStringValueClass. -func (l LanguagePackStringValueOrdinary) construct() LanguagePackStringValueClass { return &l } - -// Ensuring interfaces in compile-time for LanguagePackStringValueOrdinary. -var ( - _ bin.Encoder = &LanguagePackStringValueOrdinary{} - _ bin.Decoder = &LanguagePackStringValueOrdinary{} - _ bin.BareEncoder = &LanguagePackStringValueOrdinary{} - _ bin.BareDecoder = &LanguagePackStringValueOrdinary{} - - _ LanguagePackStringValueClass = &LanguagePackStringValueOrdinary{} -) - -func (l *LanguagePackStringValueOrdinary) Zero() bool { - if l == nil { - return true - } - if !(l.Value == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LanguagePackStringValueOrdinary) String() string { - if l == nil { - return "LanguagePackStringValueOrdinary(nil)" - } - type Alias LanguagePackStringValueOrdinary - return fmt.Sprintf("LanguagePackStringValueOrdinary%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LanguagePackStringValueOrdinary) TypeID() uint32 { - return LanguagePackStringValueOrdinaryTypeID -} - -// TypeName returns name of type in TL schema. -func (*LanguagePackStringValueOrdinary) TypeName() string { - return "languagePackStringValueOrdinary" -} - -// TypeInfo returns info about TL type. -func (l *LanguagePackStringValueOrdinary) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "languagePackStringValueOrdinary", - ID: LanguagePackStringValueOrdinaryTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LanguagePackStringValueOrdinary) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStringValueOrdinary#f124a660 as nil") - } - b.PutID(LanguagePackStringValueOrdinaryTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LanguagePackStringValueOrdinary) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStringValueOrdinary#f124a660 as nil") - } - b.PutString(l.Value) - return nil -} - -// Decode implements bin.Decoder. -func (l *LanguagePackStringValueOrdinary) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStringValueOrdinary#f124a660 to nil") - } - if err := b.ConsumeID(LanguagePackStringValueOrdinaryTypeID); err != nil { - return fmt.Errorf("unable to decode languagePackStringValueOrdinary#f124a660: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LanguagePackStringValueOrdinary) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStringValueOrdinary#f124a660 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValueOrdinary#f124a660: field value: %w", err) - } - l.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LanguagePackStringValueOrdinary) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStringValueOrdinary#f124a660 as nil") - } - b.ObjStart() - b.PutID("languagePackStringValueOrdinary") - b.Comma() - b.FieldStart("value") - b.PutString(l.Value) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LanguagePackStringValueOrdinary) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStringValueOrdinary#f124a660 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("languagePackStringValueOrdinary"); err != nil { - return fmt.Errorf("unable to decode languagePackStringValueOrdinary#f124a660: %w", err) - } - case "value": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValueOrdinary#f124a660: field value: %w", err) - } - l.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (l *LanguagePackStringValueOrdinary) GetValue() (value string) { - if l == nil { - return - } - return l.Value -} - -// LanguagePackStringValuePluralized represents TL type `languagePackStringValuePluralized#71a812c5`. -type LanguagePackStringValuePluralized struct { - // Value for zero objects - ZeroValue string - // Value for one object - OneValue string - // Value for two objects - TwoValue string - // Value for few objects - FewValue string - // Value for many objects - ManyValue string - // Default value - OtherValue string -} - -// LanguagePackStringValuePluralizedTypeID is TL type id of LanguagePackStringValuePluralized. -const LanguagePackStringValuePluralizedTypeID = 0x71a812c5 - -// construct implements constructor of LanguagePackStringValueClass. -func (l LanguagePackStringValuePluralized) construct() LanguagePackStringValueClass { return &l } - -// Ensuring interfaces in compile-time for LanguagePackStringValuePluralized. -var ( - _ bin.Encoder = &LanguagePackStringValuePluralized{} - _ bin.Decoder = &LanguagePackStringValuePluralized{} - _ bin.BareEncoder = &LanguagePackStringValuePluralized{} - _ bin.BareDecoder = &LanguagePackStringValuePluralized{} - - _ LanguagePackStringValueClass = &LanguagePackStringValuePluralized{} -) - -func (l *LanguagePackStringValuePluralized) Zero() bool { - if l == nil { - return true - } - if !(l.ZeroValue == "") { - return false - } - if !(l.OneValue == "") { - return false - } - if !(l.TwoValue == "") { - return false - } - if !(l.FewValue == "") { - return false - } - if !(l.ManyValue == "") { - return false - } - if !(l.OtherValue == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LanguagePackStringValuePluralized) String() string { - if l == nil { - return "LanguagePackStringValuePluralized(nil)" - } - type Alias LanguagePackStringValuePluralized - return fmt.Sprintf("LanguagePackStringValuePluralized%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LanguagePackStringValuePluralized) TypeID() uint32 { - return LanguagePackStringValuePluralizedTypeID -} - -// TypeName returns name of type in TL schema. -func (*LanguagePackStringValuePluralized) TypeName() string { - return "languagePackStringValuePluralized" -} - -// TypeInfo returns info about TL type. -func (l *LanguagePackStringValuePluralized) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "languagePackStringValuePluralized", - ID: LanguagePackStringValuePluralizedTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ZeroValue", - SchemaName: "zero_value", - }, - { - Name: "OneValue", - SchemaName: "one_value", - }, - { - Name: "TwoValue", - SchemaName: "two_value", - }, - { - Name: "FewValue", - SchemaName: "few_value", - }, - { - Name: "ManyValue", - SchemaName: "many_value", - }, - { - Name: "OtherValue", - SchemaName: "other_value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LanguagePackStringValuePluralized) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStringValuePluralized#71a812c5 as nil") - } - b.PutID(LanguagePackStringValuePluralizedTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LanguagePackStringValuePluralized) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStringValuePluralized#71a812c5 as nil") - } - b.PutString(l.ZeroValue) - b.PutString(l.OneValue) - b.PutString(l.TwoValue) - b.PutString(l.FewValue) - b.PutString(l.ManyValue) - b.PutString(l.OtherValue) - return nil -} - -// Decode implements bin.Decoder. -func (l *LanguagePackStringValuePluralized) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStringValuePluralized#71a812c5 to nil") - } - if err := b.ConsumeID(LanguagePackStringValuePluralizedTypeID); err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LanguagePackStringValuePluralized) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStringValuePluralized#71a812c5 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field zero_value: %w", err) - } - l.ZeroValue = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field one_value: %w", err) - } - l.OneValue = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field two_value: %w", err) - } - l.TwoValue = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field few_value: %w", err) - } - l.FewValue = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field many_value: %w", err) - } - l.ManyValue = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field other_value: %w", err) - } - l.OtherValue = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LanguagePackStringValuePluralized) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStringValuePluralized#71a812c5 as nil") - } - b.ObjStart() - b.PutID("languagePackStringValuePluralized") - b.Comma() - b.FieldStart("zero_value") - b.PutString(l.ZeroValue) - b.Comma() - b.FieldStart("one_value") - b.PutString(l.OneValue) - b.Comma() - b.FieldStart("two_value") - b.PutString(l.TwoValue) - b.Comma() - b.FieldStart("few_value") - b.PutString(l.FewValue) - b.Comma() - b.FieldStart("many_value") - b.PutString(l.ManyValue) - b.Comma() - b.FieldStart("other_value") - b.PutString(l.OtherValue) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LanguagePackStringValuePluralized) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStringValuePluralized#71a812c5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("languagePackStringValuePluralized"); err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: %w", err) - } - case "zero_value": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field zero_value: %w", err) - } - l.ZeroValue = value - case "one_value": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field one_value: %w", err) - } - l.OneValue = value - case "two_value": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field two_value: %w", err) - } - l.TwoValue = value - case "few_value": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field few_value: %w", err) - } - l.FewValue = value - case "many_value": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field many_value: %w", err) - } - l.ManyValue = value - case "other_value": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode languagePackStringValuePluralized#71a812c5: field other_value: %w", err) - } - l.OtherValue = value - default: - return b.Skip() - } - return nil - }) -} - -// GetZeroValue returns value of ZeroValue field. -func (l *LanguagePackStringValuePluralized) GetZeroValue() (value string) { - if l == nil { - return - } - return l.ZeroValue -} - -// GetOneValue returns value of OneValue field. -func (l *LanguagePackStringValuePluralized) GetOneValue() (value string) { - if l == nil { - return - } - return l.OneValue -} - -// GetTwoValue returns value of TwoValue field. -func (l *LanguagePackStringValuePluralized) GetTwoValue() (value string) { - if l == nil { - return - } - return l.TwoValue -} - -// GetFewValue returns value of FewValue field. -func (l *LanguagePackStringValuePluralized) GetFewValue() (value string) { - if l == nil { - return - } - return l.FewValue -} - -// GetManyValue returns value of ManyValue field. -func (l *LanguagePackStringValuePluralized) GetManyValue() (value string) { - if l == nil { - return - } - return l.ManyValue -} - -// GetOtherValue returns value of OtherValue field. -func (l *LanguagePackStringValuePluralized) GetOtherValue() (value string) { - if l == nil { - return - } - return l.OtherValue -} - -// LanguagePackStringValueDeleted represents TL type `languagePackStringValueDeleted#6d5cb6fa`. -type LanguagePackStringValueDeleted struct { -} - -// LanguagePackStringValueDeletedTypeID is TL type id of LanguagePackStringValueDeleted. -const LanguagePackStringValueDeletedTypeID = 0x6d5cb6fa - -// construct implements constructor of LanguagePackStringValueClass. -func (l LanguagePackStringValueDeleted) construct() LanguagePackStringValueClass { return &l } - -// Ensuring interfaces in compile-time for LanguagePackStringValueDeleted. -var ( - _ bin.Encoder = &LanguagePackStringValueDeleted{} - _ bin.Decoder = &LanguagePackStringValueDeleted{} - _ bin.BareEncoder = &LanguagePackStringValueDeleted{} - _ bin.BareDecoder = &LanguagePackStringValueDeleted{} - - _ LanguagePackStringValueClass = &LanguagePackStringValueDeleted{} -) - -func (l *LanguagePackStringValueDeleted) Zero() bool { - if l == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (l *LanguagePackStringValueDeleted) String() string { - if l == nil { - return "LanguagePackStringValueDeleted(nil)" - } - type Alias LanguagePackStringValueDeleted - return fmt.Sprintf("LanguagePackStringValueDeleted%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LanguagePackStringValueDeleted) TypeID() uint32 { - return LanguagePackStringValueDeletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*LanguagePackStringValueDeleted) TypeName() string { - return "languagePackStringValueDeleted" -} - -// TypeInfo returns info about TL type. -func (l *LanguagePackStringValueDeleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "languagePackStringValueDeleted", - ID: LanguagePackStringValueDeletedTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (l *LanguagePackStringValueDeleted) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStringValueDeleted#6d5cb6fa as nil") - } - b.PutID(LanguagePackStringValueDeletedTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LanguagePackStringValueDeleted) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStringValueDeleted#6d5cb6fa as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LanguagePackStringValueDeleted) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStringValueDeleted#6d5cb6fa to nil") - } - if err := b.ConsumeID(LanguagePackStringValueDeletedTypeID); err != nil { - return fmt.Errorf("unable to decode languagePackStringValueDeleted#6d5cb6fa: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LanguagePackStringValueDeleted) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStringValueDeleted#6d5cb6fa to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LanguagePackStringValueDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStringValueDeleted#6d5cb6fa as nil") - } - b.ObjStart() - b.PutID("languagePackStringValueDeleted") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LanguagePackStringValueDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStringValueDeleted#6d5cb6fa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("languagePackStringValueDeleted"); err != nil { - return fmt.Errorf("unable to decode languagePackStringValueDeleted#6d5cb6fa: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// LanguagePackStringValueClassName is schema name of LanguagePackStringValueClass. -const LanguagePackStringValueClassName = "LanguagePackStringValue" - -// LanguagePackStringValueClass represents LanguagePackStringValue generic type. -// -// Example: -// -// g, err := tdapi.DecodeLanguagePackStringValue(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.LanguagePackStringValueOrdinary: // languagePackStringValueOrdinary#f124a660 -// case *tdapi.LanguagePackStringValuePluralized: // languagePackStringValuePluralized#71a812c5 -// case *tdapi.LanguagePackStringValueDeleted: // languagePackStringValueDeleted#6d5cb6fa -// default: panic(v) -// } -type LanguagePackStringValueClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() LanguagePackStringValueClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeLanguagePackStringValue implements binary de-serialization for LanguagePackStringValueClass. -func DecodeLanguagePackStringValue(buf *bin.Buffer) (LanguagePackStringValueClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case LanguagePackStringValueOrdinaryTypeID: - // Decoding languagePackStringValueOrdinary#f124a660. - v := LanguagePackStringValueOrdinary{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LanguagePackStringValueClass: %w", err) - } - return &v, nil - case LanguagePackStringValuePluralizedTypeID: - // Decoding languagePackStringValuePluralized#71a812c5. - v := LanguagePackStringValuePluralized{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LanguagePackStringValueClass: %w", err) - } - return &v, nil - case LanguagePackStringValueDeletedTypeID: - // Decoding languagePackStringValueDeleted#6d5cb6fa. - v := LanguagePackStringValueDeleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LanguagePackStringValueClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode LanguagePackStringValueClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONLanguagePackStringValue implements binary de-serialization for LanguagePackStringValueClass. -func DecodeTDLibJSONLanguagePackStringValue(buf tdjson.Decoder) (LanguagePackStringValueClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "languagePackStringValueOrdinary": - // Decoding languagePackStringValueOrdinary#f124a660. - v := LanguagePackStringValueOrdinary{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LanguagePackStringValueClass: %w", err) - } - return &v, nil - case "languagePackStringValuePluralized": - // Decoding languagePackStringValuePluralized#71a812c5. - v := LanguagePackStringValuePluralized{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LanguagePackStringValueClass: %w", err) - } - return &v, nil - case "languagePackStringValueDeleted": - // Decoding languagePackStringValueDeleted#6d5cb6fa. - v := LanguagePackStringValueDeleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LanguagePackStringValueClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode LanguagePackStringValueClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// LanguagePackStringValue boxes the LanguagePackStringValueClass providing a helper. -type LanguagePackStringValueBox struct { - LanguagePackStringValue LanguagePackStringValueClass -} - -// Decode implements bin.Decoder for LanguagePackStringValueBox. -func (b *LanguagePackStringValueBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode LanguagePackStringValueBox to nil") - } - v, err := DecodeLanguagePackStringValue(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.LanguagePackStringValue = v - return nil -} - -// Encode implements bin.Encode for LanguagePackStringValueBox. -func (b *LanguagePackStringValueBox) Encode(buf *bin.Buffer) error { - if b == nil || b.LanguagePackStringValue == nil { - return fmt.Errorf("unable to encode LanguagePackStringValueClass as nil") - } - return b.LanguagePackStringValue.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for LanguagePackStringValueBox. -func (b *LanguagePackStringValueBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode LanguagePackStringValueBox to nil") - } - v, err := DecodeTDLibJSONLanguagePackStringValue(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.LanguagePackStringValue = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for LanguagePackStringValueBox. -func (b *LanguagePackStringValueBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.LanguagePackStringValue == nil { - return fmt.Errorf("unable to encode LanguagePackStringValueClass as nil") - } - return b.LanguagePackStringValue.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_language_pack_strings_gen.go b/tdapi/tl_language_pack_strings_gen.go deleted file mode 100644 index 0006c6268..000000000 --- a/tdapi/tl_language_pack_strings_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LanguagePackStrings represents TL type `languagePackStrings#4aa681ef`. -type LanguagePackStrings struct { - // A list of language pack strings - Strings []LanguagePackString -} - -// LanguagePackStringsTypeID is TL type id of LanguagePackStrings. -const LanguagePackStringsTypeID = 0x4aa681ef - -// Ensuring interfaces in compile-time for LanguagePackStrings. -var ( - _ bin.Encoder = &LanguagePackStrings{} - _ bin.Decoder = &LanguagePackStrings{} - _ bin.BareEncoder = &LanguagePackStrings{} - _ bin.BareDecoder = &LanguagePackStrings{} -) - -func (l *LanguagePackStrings) Zero() bool { - if l == nil { - return true - } - if !(l.Strings == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LanguagePackStrings) String() string { - if l == nil { - return "LanguagePackStrings(nil)" - } - type Alias LanguagePackStrings - return fmt.Sprintf("LanguagePackStrings%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LanguagePackStrings) TypeID() uint32 { - return LanguagePackStringsTypeID -} - -// TypeName returns name of type in TL schema. -func (*LanguagePackStrings) TypeName() string { - return "languagePackStrings" -} - -// TypeInfo returns info about TL type. -func (l *LanguagePackStrings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "languagePackStrings", - ID: LanguagePackStringsTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Strings", - SchemaName: "strings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LanguagePackStrings) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStrings#4aa681ef as nil") - } - b.PutID(LanguagePackStringsTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LanguagePackStrings) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStrings#4aa681ef as nil") - } - b.PutInt(len(l.Strings)) - for idx, v := range l.Strings { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare languagePackStrings#4aa681ef: field strings element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LanguagePackStrings) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStrings#4aa681ef to nil") - } - if err := b.ConsumeID(LanguagePackStringsTypeID); err != nil { - return fmt.Errorf("unable to decode languagePackStrings#4aa681ef: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LanguagePackStrings) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStrings#4aa681ef to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode languagePackStrings#4aa681ef: field strings: %w", err) - } - - if headerLen > 0 { - l.Strings = make([]LanguagePackString, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value LanguagePackString - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare languagePackStrings#4aa681ef: field strings: %w", err) - } - l.Strings = append(l.Strings, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LanguagePackStrings) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode languagePackStrings#4aa681ef as nil") - } - b.ObjStart() - b.PutID("languagePackStrings") - b.Comma() - b.FieldStart("strings") - b.ArrStart() - for idx, v := range l.Strings { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode languagePackStrings#4aa681ef: field strings element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LanguagePackStrings) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode languagePackStrings#4aa681ef to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("languagePackStrings"); err != nil { - return fmt.Errorf("unable to decode languagePackStrings#4aa681ef: %w", err) - } - case "strings": - if err := b.Arr(func(b tdjson.Decoder) error { - var value LanguagePackString - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode languagePackStrings#4aa681ef: field strings: %w", err) - } - l.Strings = append(l.Strings, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode languagePackStrings#4aa681ef: field strings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStrings returns value of Strings field. -func (l *LanguagePackStrings) GetStrings() (value []LanguagePackString) { - if l == nil { - return - } - return l.Strings -} diff --git a/tdapi/tl_launch_prepaid_giveaway_gen.go b/tdapi/tl_launch_prepaid_giveaway_gen.go deleted file mode 100644 index 692f04bc3..000000000 --- a/tdapi/tl_launch_prepaid_giveaway_gen.go +++ /dev/null @@ -1,306 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LaunchPrepaidGiveawayRequest represents TL type `launchPrepaidGiveaway#261d783a`. -type LaunchPrepaidGiveawayRequest struct { - // Unique identifier of the prepaid giveaway - GiveawayID int64 - // Giveaway parameters - Parameters GiveawayParameters - // The number of users to receive giveaway prize - WinnerCount int32 - // The number of Telegram Stars to be distributed through the giveaway; pass 0 for - // Telegram Premium giveaways - StarCount int64 -} - -// LaunchPrepaidGiveawayRequestTypeID is TL type id of LaunchPrepaidGiveawayRequest. -const LaunchPrepaidGiveawayRequestTypeID = 0x261d783a - -// Ensuring interfaces in compile-time for LaunchPrepaidGiveawayRequest. -var ( - _ bin.Encoder = &LaunchPrepaidGiveawayRequest{} - _ bin.Decoder = &LaunchPrepaidGiveawayRequest{} - _ bin.BareEncoder = &LaunchPrepaidGiveawayRequest{} - _ bin.BareDecoder = &LaunchPrepaidGiveawayRequest{} -) - -func (l *LaunchPrepaidGiveawayRequest) Zero() bool { - if l == nil { - return true - } - if !(l.GiveawayID == 0) { - return false - } - if !(l.Parameters.Zero()) { - return false - } - if !(l.WinnerCount == 0) { - return false - } - if !(l.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LaunchPrepaidGiveawayRequest) String() string { - if l == nil { - return "LaunchPrepaidGiveawayRequest(nil)" - } - type Alias LaunchPrepaidGiveawayRequest - return fmt.Sprintf("LaunchPrepaidGiveawayRequest%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LaunchPrepaidGiveawayRequest) TypeID() uint32 { - return LaunchPrepaidGiveawayRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*LaunchPrepaidGiveawayRequest) TypeName() string { - return "launchPrepaidGiveaway" -} - -// TypeInfo returns info about TL type. -func (l *LaunchPrepaidGiveawayRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "launchPrepaidGiveaway", - ID: LaunchPrepaidGiveawayRequestTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GiveawayID", - SchemaName: "giveaway_id", - }, - { - Name: "Parameters", - SchemaName: "parameters", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LaunchPrepaidGiveawayRequest) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode launchPrepaidGiveaway#261d783a as nil") - } - b.PutID(LaunchPrepaidGiveawayRequestTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LaunchPrepaidGiveawayRequest) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode launchPrepaidGiveaway#261d783a as nil") - } - b.PutLong(l.GiveawayID) - if err := l.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode launchPrepaidGiveaway#261d783a: field parameters: %w", err) - } - b.PutInt32(l.WinnerCount) - b.PutInt53(l.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (l *LaunchPrepaidGiveawayRequest) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode launchPrepaidGiveaway#261d783a to nil") - } - if err := b.ConsumeID(LaunchPrepaidGiveawayRequestTypeID); err != nil { - return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LaunchPrepaidGiveawayRequest) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode launchPrepaidGiveaway#261d783a to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field giveaway_id: %w", err) - } - l.GiveawayID = value - } - { - if err := l.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field parameters: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field winner_count: %w", err) - } - l.WinnerCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field star_count: %w", err) - } - l.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LaunchPrepaidGiveawayRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode launchPrepaidGiveaway#261d783a as nil") - } - b.ObjStart() - b.PutID("launchPrepaidGiveaway") - b.Comma() - b.FieldStart("giveaway_id") - b.PutLong(l.GiveawayID) - b.Comma() - b.FieldStart("parameters") - if err := l.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode launchPrepaidGiveaway#261d783a: field parameters: %w", err) - } - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(l.WinnerCount) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(l.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LaunchPrepaidGiveawayRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode launchPrepaidGiveaway#261d783a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("launchPrepaidGiveaway"); err != nil { - return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: %w", err) - } - case "giveaway_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field giveaway_id: %w", err) - } - l.GiveawayID = value - case "parameters": - if err := l.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field parameters: %w", err) - } - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field winner_count: %w", err) - } - l.WinnerCount = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode launchPrepaidGiveaway#261d783a: field star_count: %w", err) - } - l.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGiveawayID returns value of GiveawayID field. -func (l *LaunchPrepaidGiveawayRequest) GetGiveawayID() (value int64) { - if l == nil { - return - } - return l.GiveawayID -} - -// GetParameters returns value of Parameters field. -func (l *LaunchPrepaidGiveawayRequest) GetParameters() (value GiveawayParameters) { - if l == nil { - return - } - return l.Parameters -} - -// GetWinnerCount returns value of WinnerCount field. -func (l *LaunchPrepaidGiveawayRequest) GetWinnerCount() (value int32) { - if l == nil { - return - } - return l.WinnerCount -} - -// GetStarCount returns value of StarCount field. -func (l *LaunchPrepaidGiveawayRequest) GetStarCount() (value int64) { - if l == nil { - return - } - return l.StarCount -} - -// LaunchPrepaidGiveaway invokes method launchPrepaidGiveaway#261d783a returning error if any. -func (c *Client) LaunchPrepaidGiveaway(ctx context.Context, request *LaunchPrepaidGiveawayRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_leave_chat_gen.go b/tdapi/tl_leave_chat_gen.go deleted file mode 100644 index 04e668520..000000000 --- a/tdapi/tl_leave_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LeaveChatRequest represents TL type `leaveChat#93377a61`. -type LeaveChatRequest struct { - // Chat identifier - ChatID int64 -} - -// LeaveChatRequestTypeID is TL type id of LeaveChatRequest. -const LeaveChatRequestTypeID = 0x93377a61 - -// Ensuring interfaces in compile-time for LeaveChatRequest. -var ( - _ bin.Encoder = &LeaveChatRequest{} - _ bin.Decoder = &LeaveChatRequest{} - _ bin.BareEncoder = &LeaveChatRequest{} - _ bin.BareDecoder = &LeaveChatRequest{} -) - -func (l *LeaveChatRequest) Zero() bool { - if l == nil { - return true - } - if !(l.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LeaveChatRequest) String() string { - if l == nil { - return "LeaveChatRequest(nil)" - } - type Alias LeaveChatRequest - return fmt.Sprintf("LeaveChatRequest%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LeaveChatRequest) TypeID() uint32 { - return LeaveChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*LeaveChatRequest) TypeName() string { - return "leaveChat" -} - -// TypeInfo returns info about TL type. -func (l *LeaveChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "leaveChat", - ID: LeaveChatRequestTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LeaveChatRequest) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode leaveChat#93377a61 as nil") - } - b.PutID(LeaveChatRequestTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LeaveChatRequest) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode leaveChat#93377a61 as nil") - } - b.PutInt53(l.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (l *LeaveChatRequest) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode leaveChat#93377a61 to nil") - } - if err := b.ConsumeID(LeaveChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode leaveChat#93377a61: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LeaveChatRequest) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode leaveChat#93377a61 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode leaveChat#93377a61: field chat_id: %w", err) - } - l.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LeaveChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode leaveChat#93377a61 as nil") - } - b.ObjStart() - b.PutID("leaveChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(l.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LeaveChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode leaveChat#93377a61 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("leaveChat"); err != nil { - return fmt.Errorf("unable to decode leaveChat#93377a61: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode leaveChat#93377a61: field chat_id: %w", err) - } - l.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (l *LeaveChatRequest) GetChatID() (value int64) { - if l == nil { - return - } - return l.ChatID -} - -// LeaveChat invokes method leaveChat#93377a61 returning error if any. -func (c *Client) LeaveChat(ctx context.Context, chatid int64) error { - var ok Ok - - request := &LeaveChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_leave_group_call_gen.go b/tdapi/tl_leave_group_call_gen.go deleted file mode 100644 index 75da1a5bf..000000000 --- a/tdapi/tl_leave_group_call_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LeaveGroupCallRequest represents TL type `leaveGroupCall#3a6befa9`. -type LeaveGroupCallRequest struct { - // Group call identifier - GroupCallID int32 -} - -// LeaveGroupCallRequestTypeID is TL type id of LeaveGroupCallRequest. -const LeaveGroupCallRequestTypeID = 0x3a6befa9 - -// Ensuring interfaces in compile-time for LeaveGroupCallRequest. -var ( - _ bin.Encoder = &LeaveGroupCallRequest{} - _ bin.Decoder = &LeaveGroupCallRequest{} - _ bin.BareEncoder = &LeaveGroupCallRequest{} - _ bin.BareDecoder = &LeaveGroupCallRequest{} -) - -func (l *LeaveGroupCallRequest) Zero() bool { - if l == nil { - return true - } - if !(l.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LeaveGroupCallRequest) String() string { - if l == nil { - return "LeaveGroupCallRequest(nil)" - } - type Alias LeaveGroupCallRequest - return fmt.Sprintf("LeaveGroupCallRequest%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LeaveGroupCallRequest) TypeID() uint32 { - return LeaveGroupCallRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*LeaveGroupCallRequest) TypeName() string { - return "leaveGroupCall" -} - -// TypeInfo returns info about TL type. -func (l *LeaveGroupCallRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "leaveGroupCall", - ID: LeaveGroupCallRequestTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LeaveGroupCallRequest) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode leaveGroupCall#3a6befa9 as nil") - } - b.PutID(LeaveGroupCallRequestTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LeaveGroupCallRequest) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode leaveGroupCall#3a6befa9 as nil") - } - b.PutInt32(l.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (l *LeaveGroupCallRequest) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode leaveGroupCall#3a6befa9 to nil") - } - if err := b.ConsumeID(LeaveGroupCallRequestTypeID); err != nil { - return fmt.Errorf("unable to decode leaveGroupCall#3a6befa9: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LeaveGroupCallRequest) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode leaveGroupCall#3a6befa9 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode leaveGroupCall#3a6befa9: field group_call_id: %w", err) - } - l.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LeaveGroupCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode leaveGroupCall#3a6befa9 as nil") - } - b.ObjStart() - b.PutID("leaveGroupCall") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(l.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LeaveGroupCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode leaveGroupCall#3a6befa9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("leaveGroupCall"); err != nil { - return fmt.Errorf("unable to decode leaveGroupCall#3a6befa9: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode leaveGroupCall#3a6befa9: field group_call_id: %w", err) - } - l.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (l *LeaveGroupCallRequest) GetGroupCallID() (value int32) { - if l == nil { - return - } - return l.GroupCallID -} - -// LeaveGroupCall invokes method leaveGroupCall#3a6befa9 returning error if any. -func (c *Client) LeaveGroupCall(ctx context.Context, groupcallid int32) error { - var ok Ok - - request := &LeaveGroupCallRequest{ - GroupCallID: groupcallid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_link_preview_album_media_gen.go b/tdapi/tl_link_preview_album_media_gen.go deleted file mode 100644 index fa9f28bc7..000000000 --- a/tdapi/tl_link_preview_album_media_gen.go +++ /dev/null @@ -1,501 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LinkPreviewAlbumMediaPhoto represents TL type `linkPreviewAlbumMediaPhoto#c83db38e`. -type LinkPreviewAlbumMediaPhoto struct { - // Photo description - Photo Photo -} - -// LinkPreviewAlbumMediaPhotoTypeID is TL type id of LinkPreviewAlbumMediaPhoto. -const LinkPreviewAlbumMediaPhotoTypeID = 0xc83db38e - -// construct implements constructor of LinkPreviewAlbumMediaClass. -func (l LinkPreviewAlbumMediaPhoto) construct() LinkPreviewAlbumMediaClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewAlbumMediaPhoto. -var ( - _ bin.Encoder = &LinkPreviewAlbumMediaPhoto{} - _ bin.Decoder = &LinkPreviewAlbumMediaPhoto{} - _ bin.BareEncoder = &LinkPreviewAlbumMediaPhoto{} - _ bin.BareDecoder = &LinkPreviewAlbumMediaPhoto{} - - _ LinkPreviewAlbumMediaClass = &LinkPreviewAlbumMediaPhoto{} -) - -func (l *LinkPreviewAlbumMediaPhoto) Zero() bool { - if l == nil { - return true - } - if !(l.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewAlbumMediaPhoto) String() string { - if l == nil { - return "LinkPreviewAlbumMediaPhoto(nil)" - } - type Alias LinkPreviewAlbumMediaPhoto - return fmt.Sprintf("LinkPreviewAlbumMediaPhoto%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewAlbumMediaPhoto) TypeID() uint32 { - return LinkPreviewAlbumMediaPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewAlbumMediaPhoto) TypeName() string { - return "linkPreviewAlbumMediaPhoto" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewAlbumMediaPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewAlbumMediaPhoto", - ID: LinkPreviewAlbumMediaPhotoTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewAlbumMediaPhoto) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewAlbumMediaPhoto#c83db38e as nil") - } - b.PutID(LinkPreviewAlbumMediaPhotoTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewAlbumMediaPhoto) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewAlbumMediaPhoto#c83db38e as nil") - } - if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewAlbumMediaPhoto#c83db38e: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewAlbumMediaPhoto) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewAlbumMediaPhoto#c83db38e to nil") - } - if err := b.ConsumeID(LinkPreviewAlbumMediaPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewAlbumMediaPhoto#c83db38e: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewAlbumMediaPhoto) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewAlbumMediaPhoto#c83db38e to nil") - } - { - if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewAlbumMediaPhoto#c83db38e: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewAlbumMediaPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewAlbumMediaPhoto#c83db38e as nil") - } - b.ObjStart() - b.PutID("linkPreviewAlbumMediaPhoto") - b.Comma() - b.FieldStart("photo") - if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewAlbumMediaPhoto#c83db38e: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewAlbumMediaPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewAlbumMediaPhoto#c83db38e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewAlbumMediaPhoto"); err != nil { - return fmt.Errorf("unable to decode linkPreviewAlbumMediaPhoto#c83db38e: %w", err) - } - case "photo": - if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewAlbumMediaPhoto#c83db38e: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (l *LinkPreviewAlbumMediaPhoto) GetPhoto() (value Photo) { - if l == nil { - return - } - return l.Photo -} - -// LinkPreviewAlbumMediaVideo represents TL type `linkPreviewAlbumMediaVideo#174856db`. -type LinkPreviewAlbumMediaVideo struct { - // Video description - Video Video -} - -// LinkPreviewAlbumMediaVideoTypeID is TL type id of LinkPreviewAlbumMediaVideo. -const LinkPreviewAlbumMediaVideoTypeID = 0x174856db - -// construct implements constructor of LinkPreviewAlbumMediaClass. -func (l LinkPreviewAlbumMediaVideo) construct() LinkPreviewAlbumMediaClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewAlbumMediaVideo. -var ( - _ bin.Encoder = &LinkPreviewAlbumMediaVideo{} - _ bin.Decoder = &LinkPreviewAlbumMediaVideo{} - _ bin.BareEncoder = &LinkPreviewAlbumMediaVideo{} - _ bin.BareDecoder = &LinkPreviewAlbumMediaVideo{} - - _ LinkPreviewAlbumMediaClass = &LinkPreviewAlbumMediaVideo{} -) - -func (l *LinkPreviewAlbumMediaVideo) Zero() bool { - if l == nil { - return true - } - if !(l.Video.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewAlbumMediaVideo) String() string { - if l == nil { - return "LinkPreviewAlbumMediaVideo(nil)" - } - type Alias LinkPreviewAlbumMediaVideo - return fmt.Sprintf("LinkPreviewAlbumMediaVideo%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewAlbumMediaVideo) TypeID() uint32 { - return LinkPreviewAlbumMediaVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewAlbumMediaVideo) TypeName() string { - return "linkPreviewAlbumMediaVideo" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewAlbumMediaVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewAlbumMediaVideo", - ID: LinkPreviewAlbumMediaVideoTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Video", - SchemaName: "video", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewAlbumMediaVideo) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewAlbumMediaVideo#174856db as nil") - } - b.PutID(LinkPreviewAlbumMediaVideoTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewAlbumMediaVideo) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewAlbumMediaVideo#174856db as nil") - } - if err := l.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewAlbumMediaVideo#174856db: field video: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewAlbumMediaVideo) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewAlbumMediaVideo#174856db to nil") - } - if err := b.ConsumeID(LinkPreviewAlbumMediaVideoTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewAlbumMediaVideo#174856db: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewAlbumMediaVideo) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewAlbumMediaVideo#174856db to nil") - } - { - if err := l.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewAlbumMediaVideo#174856db: field video: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewAlbumMediaVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewAlbumMediaVideo#174856db as nil") - } - b.ObjStart() - b.PutID("linkPreviewAlbumMediaVideo") - b.Comma() - b.FieldStart("video") - if err := l.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewAlbumMediaVideo#174856db: field video: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewAlbumMediaVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewAlbumMediaVideo#174856db to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewAlbumMediaVideo"); err != nil { - return fmt.Errorf("unable to decode linkPreviewAlbumMediaVideo#174856db: %w", err) - } - case "video": - if err := l.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewAlbumMediaVideo#174856db: field video: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetVideo returns value of Video field. -func (l *LinkPreviewAlbumMediaVideo) GetVideo() (value Video) { - if l == nil { - return - } - return l.Video -} - -// LinkPreviewAlbumMediaClassName is schema name of LinkPreviewAlbumMediaClass. -const LinkPreviewAlbumMediaClassName = "LinkPreviewAlbumMedia" - -// LinkPreviewAlbumMediaClass represents LinkPreviewAlbumMedia generic type. -// -// Example: -// -// g, err := tdapi.DecodeLinkPreviewAlbumMedia(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.LinkPreviewAlbumMediaPhoto: // linkPreviewAlbumMediaPhoto#c83db38e -// case *tdapi.LinkPreviewAlbumMediaVideo: // linkPreviewAlbumMediaVideo#174856db -// default: panic(v) -// } -type LinkPreviewAlbumMediaClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() LinkPreviewAlbumMediaClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeLinkPreviewAlbumMedia implements binary de-serialization for LinkPreviewAlbumMediaClass. -func DecodeLinkPreviewAlbumMedia(buf *bin.Buffer) (LinkPreviewAlbumMediaClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case LinkPreviewAlbumMediaPhotoTypeID: - // Decoding linkPreviewAlbumMediaPhoto#c83db38e. - v := LinkPreviewAlbumMediaPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewAlbumMediaClass: %w", err) - } - return &v, nil - case LinkPreviewAlbumMediaVideoTypeID: - // Decoding linkPreviewAlbumMediaVideo#174856db. - v := LinkPreviewAlbumMediaVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewAlbumMediaClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode LinkPreviewAlbumMediaClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONLinkPreviewAlbumMedia implements binary de-serialization for LinkPreviewAlbumMediaClass. -func DecodeTDLibJSONLinkPreviewAlbumMedia(buf tdjson.Decoder) (LinkPreviewAlbumMediaClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "linkPreviewAlbumMediaPhoto": - // Decoding linkPreviewAlbumMediaPhoto#c83db38e. - v := LinkPreviewAlbumMediaPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewAlbumMediaClass: %w", err) - } - return &v, nil - case "linkPreviewAlbumMediaVideo": - // Decoding linkPreviewAlbumMediaVideo#174856db. - v := LinkPreviewAlbumMediaVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewAlbumMediaClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode LinkPreviewAlbumMediaClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// LinkPreviewAlbumMedia boxes the LinkPreviewAlbumMediaClass providing a helper. -type LinkPreviewAlbumMediaBox struct { - LinkPreviewAlbumMedia LinkPreviewAlbumMediaClass -} - -// Decode implements bin.Decoder for LinkPreviewAlbumMediaBox. -func (b *LinkPreviewAlbumMediaBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode LinkPreviewAlbumMediaBox to nil") - } - v, err := DecodeLinkPreviewAlbumMedia(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.LinkPreviewAlbumMedia = v - return nil -} - -// Encode implements bin.Encode for LinkPreviewAlbumMediaBox. -func (b *LinkPreviewAlbumMediaBox) Encode(buf *bin.Buffer) error { - if b == nil || b.LinkPreviewAlbumMedia == nil { - return fmt.Errorf("unable to encode LinkPreviewAlbumMediaClass as nil") - } - return b.LinkPreviewAlbumMedia.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for LinkPreviewAlbumMediaBox. -func (b *LinkPreviewAlbumMediaBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode LinkPreviewAlbumMediaBox to nil") - } - v, err := DecodeTDLibJSONLinkPreviewAlbumMedia(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.LinkPreviewAlbumMedia = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for LinkPreviewAlbumMediaBox. -func (b *LinkPreviewAlbumMediaBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.LinkPreviewAlbumMedia == nil { - return fmt.Errorf("unable to encode LinkPreviewAlbumMediaClass as nil") - } - return b.LinkPreviewAlbumMedia.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_link_preview_gen.go b/tdapi/tl_link_preview_gen.go deleted file mode 100644 index 5e7e15878..000000000 --- a/tdapi/tl_link_preview_gen.go +++ /dev/null @@ -1,615 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LinkPreview represents TL type `linkPreview#6714d1f2`. -type LinkPreview struct { - // Original URL of the link - URL string - // URL to display - DisplayURL string - // Short name of the site (e.g., Google Docs, App Store) - SiteName string - // Title of the content - Title string - // Describes a link preview - Description FormattedText - // Author of the content - Author string - // Type of the link preview - Type LinkPreviewTypeClass - // True, if size of media in the preview can be changed - HasLargeMedia bool - // True, if large media preview must be shown; otherwise, the media preview must be shown - // small and only the first frame must be shown for videos - ShowLargeMedia bool - // True, if media must be shown above link preview description; otherwise, the media must - // be shown below the description - ShowMediaAboveDescription bool - // True, if there is no need to show an ordinary open URL confirmation, when opening the - // URL from the preview, because the URL is shown in the message text in clear - SkipConfirmation bool - // True, if the link preview must be shown above message text; otherwise, the link - // preview must be shown below the message text - ShowAboveText bool - // Version of instant view (currently, can be 1 or 2) for the web page; 0 if none - InstantViewVersion int32 -} - -// LinkPreviewTypeID is TL type id of LinkPreview. -const LinkPreviewTypeID = 0x6714d1f2 - -// Ensuring interfaces in compile-time for LinkPreview. -var ( - _ bin.Encoder = &LinkPreview{} - _ bin.Decoder = &LinkPreview{} - _ bin.BareEncoder = &LinkPreview{} - _ bin.BareDecoder = &LinkPreview{} -) - -func (l *LinkPreview) Zero() bool { - if l == nil { - return true - } - if !(l.URL == "") { - return false - } - if !(l.DisplayURL == "") { - return false - } - if !(l.SiteName == "") { - return false - } - if !(l.Title == "") { - return false - } - if !(l.Description.Zero()) { - return false - } - if !(l.Author == "") { - return false - } - if !(l.Type == nil) { - return false - } - if !(l.HasLargeMedia == false) { - return false - } - if !(l.ShowLargeMedia == false) { - return false - } - if !(l.ShowMediaAboveDescription == false) { - return false - } - if !(l.SkipConfirmation == false) { - return false - } - if !(l.ShowAboveText == false) { - return false - } - if !(l.InstantViewVersion == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreview) String() string { - if l == nil { - return "LinkPreview(nil)" - } - type Alias LinkPreview - return fmt.Sprintf("LinkPreview%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreview) TypeID() uint32 { - return LinkPreviewTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreview) TypeName() string { - return "linkPreview" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreview) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreview", - ID: LinkPreviewTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "DisplayURL", - SchemaName: "display_url", - }, - { - Name: "SiteName", - SchemaName: "site_name", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "Author", - SchemaName: "author", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "HasLargeMedia", - SchemaName: "has_large_media", - }, - { - Name: "ShowLargeMedia", - SchemaName: "show_large_media", - }, - { - Name: "ShowMediaAboveDescription", - SchemaName: "show_media_above_description", - }, - { - Name: "SkipConfirmation", - SchemaName: "skip_confirmation", - }, - { - Name: "ShowAboveText", - SchemaName: "show_above_text", - }, - { - Name: "InstantViewVersion", - SchemaName: "instant_view_version", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreview) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreview#6714d1f2 as nil") - } - b.PutID(LinkPreviewTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreview) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreview#6714d1f2 as nil") - } - b.PutString(l.URL) - b.PutString(l.DisplayURL) - b.PutString(l.SiteName) - b.PutString(l.Title) - if err := l.Description.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#6714d1f2: field description: %w", err) - } - b.PutString(l.Author) - if l.Type == nil { - return fmt.Errorf("unable to encode linkPreview#6714d1f2: field type is nil") - } - if err := l.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#6714d1f2: field type: %w", err) - } - b.PutBool(l.HasLargeMedia) - b.PutBool(l.ShowLargeMedia) - b.PutBool(l.ShowMediaAboveDescription) - b.PutBool(l.SkipConfirmation) - b.PutBool(l.ShowAboveText) - b.PutInt32(l.InstantViewVersion) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreview) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreview#6714d1f2 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreview) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreview#6714d1f2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field url: %w", err) - } - l.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field display_url: %w", err) - } - l.DisplayURL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field site_name: %w", err) - } - l.SiteName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field title: %w", err) - } - l.Title = value - } - { - if err := l.Description.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field description: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field author: %w", err) - } - l.Author = value - } - { - value, err := DecodeLinkPreviewType(b) - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field type: %w", err) - } - l.Type = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field has_large_media: %w", err) - } - l.HasLargeMedia = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_large_media: %w", err) - } - l.ShowLargeMedia = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_media_above_description: %w", err) - } - l.ShowMediaAboveDescription = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field skip_confirmation: %w", err) - } - l.SkipConfirmation = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_above_text: %w", err) - } - l.ShowAboveText = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field instant_view_version: %w", err) - } - l.InstantViewVersion = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreview) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreview#6714d1f2 as nil") - } - b.ObjStart() - b.PutID("linkPreview") - b.Comma() - b.FieldStart("url") - b.PutString(l.URL) - b.Comma() - b.FieldStart("display_url") - b.PutString(l.DisplayURL) - b.Comma() - b.FieldStart("site_name") - b.PutString(l.SiteName) - b.Comma() - b.FieldStart("title") - b.PutString(l.Title) - b.Comma() - b.FieldStart("description") - if err := l.Description.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#6714d1f2: field description: %w", err) - } - b.Comma() - b.FieldStart("author") - b.PutString(l.Author) - b.Comma() - b.FieldStart("type") - if l.Type == nil { - return fmt.Errorf("unable to encode linkPreview#6714d1f2: field type is nil") - } - if err := l.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreview#6714d1f2: field type: %w", err) - } - b.Comma() - b.FieldStart("has_large_media") - b.PutBool(l.HasLargeMedia) - b.Comma() - b.FieldStart("show_large_media") - b.PutBool(l.ShowLargeMedia) - b.Comma() - b.FieldStart("show_media_above_description") - b.PutBool(l.ShowMediaAboveDescription) - b.Comma() - b.FieldStart("skip_confirmation") - b.PutBool(l.SkipConfirmation) - b.Comma() - b.FieldStart("show_above_text") - b.PutBool(l.ShowAboveText) - b.Comma() - b.FieldStart("instant_view_version") - b.PutInt32(l.InstantViewVersion) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreview) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreview#6714d1f2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreview"); err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field url: %w", err) - } - l.URL = value - case "display_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field display_url: %w", err) - } - l.DisplayURL = value - case "site_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field site_name: %w", err) - } - l.SiteName = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field title: %w", err) - } - l.Title = value - case "description": - if err := l.Description.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field description: %w", err) - } - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field author: %w", err) - } - l.Author = value - case "type": - value, err := DecodeTDLibJSONLinkPreviewType(b) - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field type: %w", err) - } - l.Type = value - case "has_large_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field has_large_media: %w", err) - } - l.HasLargeMedia = value - case "show_large_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_large_media: %w", err) - } - l.ShowLargeMedia = value - case "show_media_above_description": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_media_above_description: %w", err) - } - l.ShowMediaAboveDescription = value - case "skip_confirmation": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field skip_confirmation: %w", err) - } - l.SkipConfirmation = value - case "show_above_text": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field show_above_text: %w", err) - } - l.ShowAboveText = value - case "instant_view_version": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreview#6714d1f2: field instant_view_version: %w", err) - } - l.InstantViewVersion = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (l *LinkPreview) GetURL() (value string) { - if l == nil { - return - } - return l.URL -} - -// GetDisplayURL returns value of DisplayURL field. -func (l *LinkPreview) GetDisplayURL() (value string) { - if l == nil { - return - } - return l.DisplayURL -} - -// GetSiteName returns value of SiteName field. -func (l *LinkPreview) GetSiteName() (value string) { - if l == nil { - return - } - return l.SiteName -} - -// GetTitle returns value of Title field. -func (l *LinkPreview) GetTitle() (value string) { - if l == nil { - return - } - return l.Title -} - -// GetDescription returns value of Description field. -func (l *LinkPreview) GetDescription() (value FormattedText) { - if l == nil { - return - } - return l.Description -} - -// GetAuthor returns value of Author field. -func (l *LinkPreview) GetAuthor() (value string) { - if l == nil { - return - } - return l.Author -} - -// GetType returns value of Type field. -func (l *LinkPreview) GetType() (value LinkPreviewTypeClass) { - if l == nil { - return - } - return l.Type -} - -// GetHasLargeMedia returns value of HasLargeMedia field. -func (l *LinkPreview) GetHasLargeMedia() (value bool) { - if l == nil { - return - } - return l.HasLargeMedia -} - -// GetShowLargeMedia returns value of ShowLargeMedia field. -func (l *LinkPreview) GetShowLargeMedia() (value bool) { - if l == nil { - return - } - return l.ShowLargeMedia -} - -// GetShowMediaAboveDescription returns value of ShowMediaAboveDescription field. -func (l *LinkPreview) GetShowMediaAboveDescription() (value bool) { - if l == nil { - return - } - return l.ShowMediaAboveDescription -} - -// GetSkipConfirmation returns value of SkipConfirmation field. -func (l *LinkPreview) GetSkipConfirmation() (value bool) { - if l == nil { - return - } - return l.SkipConfirmation -} - -// GetShowAboveText returns value of ShowAboveText field. -func (l *LinkPreview) GetShowAboveText() (value bool) { - if l == nil { - return - } - return l.ShowAboveText -} - -// GetInstantViewVersion returns value of InstantViewVersion field. -func (l *LinkPreview) GetInstantViewVersion() (value int32) { - if l == nil { - return - } - return l.InstantViewVersion -} diff --git a/tdapi/tl_link_preview_options_gen.go b/tdapi/tl_link_preview_options_gen.go deleted file mode 100644 index 205a3211f..000000000 --- a/tdapi/tl_link_preview_options_gen.go +++ /dev/null @@ -1,333 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LinkPreviewOptions represents TL type `linkPreviewOptions#3e61b3f3`. -type LinkPreviewOptions struct { - // True, if link preview must be disabled - IsDisabled bool - // URL to use for link preview. If empty, then the first URL found in the message text - // will be used - URL string - // True, if shown media preview must be small; ignored in secret chats or if the URL - // isn't explicitly specified - ForceSmallMedia bool - // True, if shown media preview must be large; ignored in secret chats or if the URL - // isn't explicitly specified - ForceLargeMedia bool - // True, if link preview must be shown above message text; otherwise, the link preview - // will be shown below the message text; ignored in secret chats - ShowAboveText bool -} - -// LinkPreviewOptionsTypeID is TL type id of LinkPreviewOptions. -const LinkPreviewOptionsTypeID = 0x3e61b3f3 - -// Ensuring interfaces in compile-time for LinkPreviewOptions. -var ( - _ bin.Encoder = &LinkPreviewOptions{} - _ bin.Decoder = &LinkPreviewOptions{} - _ bin.BareEncoder = &LinkPreviewOptions{} - _ bin.BareDecoder = &LinkPreviewOptions{} -) - -func (l *LinkPreviewOptions) Zero() bool { - if l == nil { - return true - } - if !(l.IsDisabled == false) { - return false - } - if !(l.URL == "") { - return false - } - if !(l.ForceSmallMedia == false) { - return false - } - if !(l.ForceLargeMedia == false) { - return false - } - if !(l.ShowAboveText == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewOptions) String() string { - if l == nil { - return "LinkPreviewOptions(nil)" - } - type Alias LinkPreviewOptions - return fmt.Sprintf("LinkPreviewOptions%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewOptions) TypeID() uint32 { - return LinkPreviewOptionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewOptions) TypeName() string { - return "linkPreviewOptions" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewOptions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewOptions", - ID: LinkPreviewOptionsTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsDisabled", - SchemaName: "is_disabled", - }, - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "ForceSmallMedia", - SchemaName: "force_small_media", - }, - { - Name: "ForceLargeMedia", - SchemaName: "force_large_media", - }, - { - Name: "ShowAboveText", - SchemaName: "show_above_text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewOptions) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewOptions#3e61b3f3 as nil") - } - b.PutID(LinkPreviewOptionsTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewOptions) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewOptions#3e61b3f3 as nil") - } - b.PutBool(l.IsDisabled) - b.PutString(l.URL) - b.PutBool(l.ForceSmallMedia) - b.PutBool(l.ForceLargeMedia) - b.PutBool(l.ShowAboveText) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewOptions) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewOptions#3e61b3f3 to nil") - } - if err := b.ConsumeID(LinkPreviewOptionsTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewOptions) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewOptions#3e61b3f3 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: field is_disabled: %w", err) - } - l.IsDisabled = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: field url: %w", err) - } - l.URL = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: field force_small_media: %w", err) - } - l.ForceSmallMedia = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: field force_large_media: %w", err) - } - l.ForceLargeMedia = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: field show_above_text: %w", err) - } - l.ShowAboveText = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewOptions) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewOptions#3e61b3f3 as nil") - } - b.ObjStart() - b.PutID("linkPreviewOptions") - b.Comma() - b.FieldStart("is_disabled") - b.PutBool(l.IsDisabled) - b.Comma() - b.FieldStart("url") - b.PutString(l.URL) - b.Comma() - b.FieldStart("force_small_media") - b.PutBool(l.ForceSmallMedia) - b.Comma() - b.FieldStart("force_large_media") - b.PutBool(l.ForceLargeMedia) - b.Comma() - b.FieldStart("show_above_text") - b.PutBool(l.ShowAboveText) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewOptions) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewOptions#3e61b3f3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewOptions"); err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: %w", err) - } - case "is_disabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: field is_disabled: %w", err) - } - l.IsDisabled = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: field url: %w", err) - } - l.URL = value - case "force_small_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: field force_small_media: %w", err) - } - l.ForceSmallMedia = value - case "force_large_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: field force_large_media: %w", err) - } - l.ForceLargeMedia = value - case "show_above_text": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewOptions#3e61b3f3: field show_above_text: %w", err) - } - l.ShowAboveText = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsDisabled returns value of IsDisabled field. -func (l *LinkPreviewOptions) GetIsDisabled() (value bool) { - if l == nil { - return - } - return l.IsDisabled -} - -// GetURL returns value of URL field. -func (l *LinkPreviewOptions) GetURL() (value string) { - if l == nil { - return - } - return l.URL -} - -// GetForceSmallMedia returns value of ForceSmallMedia field. -func (l *LinkPreviewOptions) GetForceSmallMedia() (value bool) { - if l == nil { - return - } - return l.ForceSmallMedia -} - -// GetForceLargeMedia returns value of ForceLargeMedia field. -func (l *LinkPreviewOptions) GetForceLargeMedia() (value bool) { - if l == nil { - return - } - return l.ForceLargeMedia -} - -// GetShowAboveText returns value of ShowAboveText field. -func (l *LinkPreviewOptions) GetShowAboveText() (value bool) { - if l == nil { - return - } - return l.ShowAboveText -} diff --git a/tdapi/tl_link_preview_type_gen.go b/tdapi/tl_link_preview_type_gen.go deleted file mode 100644 index ecf14a0be..000000000 --- a/tdapi/tl_link_preview_type_gen.go +++ /dev/null @@ -1,6570 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LinkPreviewTypeAlbum represents TL type `linkPreviewTypeAlbum#186d97b4`. -type LinkPreviewTypeAlbum struct { - // The list of album media - Media []LinkPreviewAlbumMediaClass - // Album caption - Caption string -} - -// LinkPreviewTypeAlbumTypeID is TL type id of LinkPreviewTypeAlbum. -const LinkPreviewTypeAlbumTypeID = 0x186d97b4 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeAlbum) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeAlbum. -var ( - _ bin.Encoder = &LinkPreviewTypeAlbum{} - _ bin.Decoder = &LinkPreviewTypeAlbum{} - _ bin.BareEncoder = &LinkPreviewTypeAlbum{} - _ bin.BareDecoder = &LinkPreviewTypeAlbum{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeAlbum{} -) - -func (l *LinkPreviewTypeAlbum) Zero() bool { - if l == nil { - return true - } - if !(l.Media == nil) { - return false - } - if !(l.Caption == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeAlbum) String() string { - if l == nil { - return "LinkPreviewTypeAlbum(nil)" - } - type Alias LinkPreviewTypeAlbum - return fmt.Sprintf("LinkPreviewTypeAlbum%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeAlbum) TypeID() uint32 { - return LinkPreviewTypeAlbumTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeAlbum) TypeName() string { - return "linkPreviewTypeAlbum" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeAlbum) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeAlbum", - ID: LinkPreviewTypeAlbumTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Media", - SchemaName: "media", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeAlbum) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAlbum#186d97b4 as nil") - } - b.PutID(LinkPreviewTypeAlbumTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeAlbum) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAlbum#186d97b4 as nil") - } - b.PutInt(len(l.Media)) - for idx, v := range l.Media { - if v == nil { - return fmt.Errorf("unable to encode linkPreviewTypeAlbum#186d97b4: field media element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare linkPreviewTypeAlbum#186d97b4: field media element with index %d: %w", idx, err) - } - } - b.PutString(l.Caption) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeAlbum) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAlbum#186d97b4 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeAlbumTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAlbum#186d97b4: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeAlbum) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAlbum#186d97b4 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAlbum#186d97b4: field media: %w", err) - } - - if headerLen > 0 { - l.Media = make([]LinkPreviewAlbumMediaClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeLinkPreviewAlbumMedia(b) - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAlbum#186d97b4: field media: %w", err) - } - l.Media = append(l.Media, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAlbum#186d97b4: field caption: %w", err) - } - l.Caption = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeAlbum) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAlbum#186d97b4 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeAlbum") - b.Comma() - b.FieldStart("media") - b.ArrStart() - for idx, v := range l.Media { - if v == nil { - return fmt.Errorf("unable to encode linkPreviewTypeAlbum#186d97b4: field media element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeAlbum#186d97b4: field media element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("caption") - b.PutString(l.Caption) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeAlbum) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAlbum#186d97b4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeAlbum"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAlbum#186d97b4: %w", err) - } - case "media": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONLinkPreviewAlbumMedia(b) - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAlbum#186d97b4: field media: %w", err) - } - l.Media = append(l.Media, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAlbum#186d97b4: field media: %w", err) - } - case "caption": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAlbum#186d97b4: field caption: %w", err) - } - l.Caption = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMedia returns value of Media field. -func (l *LinkPreviewTypeAlbum) GetMedia() (value []LinkPreviewAlbumMediaClass) { - if l == nil { - return - } - return l.Media -} - -// GetCaption returns value of Caption field. -func (l *LinkPreviewTypeAlbum) GetCaption() (value string) { - if l == nil { - return - } - return l.Caption -} - -// LinkPreviewTypeAnimation represents TL type `linkPreviewTypeAnimation#ad5cc534`. -type LinkPreviewTypeAnimation struct { - // The animation - Animation Animation -} - -// LinkPreviewTypeAnimationTypeID is TL type id of LinkPreviewTypeAnimation. -const LinkPreviewTypeAnimationTypeID = 0xad5cc534 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeAnimation) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeAnimation. -var ( - _ bin.Encoder = &LinkPreviewTypeAnimation{} - _ bin.Decoder = &LinkPreviewTypeAnimation{} - _ bin.BareEncoder = &LinkPreviewTypeAnimation{} - _ bin.BareDecoder = &LinkPreviewTypeAnimation{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeAnimation{} -) - -func (l *LinkPreviewTypeAnimation) Zero() bool { - if l == nil { - return true - } - if !(l.Animation.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeAnimation) String() string { - if l == nil { - return "LinkPreviewTypeAnimation(nil)" - } - type Alias LinkPreviewTypeAnimation - return fmt.Sprintf("LinkPreviewTypeAnimation%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeAnimation) TypeID() uint32 { - return LinkPreviewTypeAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeAnimation) TypeName() string { - return "linkPreviewTypeAnimation" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeAnimation", - ID: LinkPreviewTypeAnimationTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Animation", - SchemaName: "animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeAnimation) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAnimation#ad5cc534 as nil") - } - b.PutID(LinkPreviewTypeAnimationTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeAnimation) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAnimation#ad5cc534 as nil") - } - if err := l.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeAnimation#ad5cc534: field animation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeAnimation) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAnimation#ad5cc534 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAnimation#ad5cc534: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeAnimation) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAnimation#ad5cc534 to nil") - } - { - if err := l.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAnimation#ad5cc534: field animation: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAnimation#ad5cc534 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeAnimation") - b.Comma() - b.FieldStart("animation") - if err := l.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeAnimation#ad5cc534: field animation: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAnimation#ad5cc534 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeAnimation"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAnimation#ad5cc534: %w", err) - } - case "animation": - if err := l.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAnimation#ad5cc534: field animation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAnimation returns value of Animation field. -func (l *LinkPreviewTypeAnimation) GetAnimation() (value Animation) { - if l == nil { - return - } - return l.Animation -} - -// LinkPreviewTypeApp represents TL type `linkPreviewTypeApp#e3a68def`. -type LinkPreviewTypeApp struct { - // Photo for the app - Photo Photo -} - -// LinkPreviewTypeAppTypeID is TL type id of LinkPreviewTypeApp. -const LinkPreviewTypeAppTypeID = 0xe3a68def - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeApp) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeApp. -var ( - _ bin.Encoder = &LinkPreviewTypeApp{} - _ bin.Decoder = &LinkPreviewTypeApp{} - _ bin.BareEncoder = &LinkPreviewTypeApp{} - _ bin.BareDecoder = &LinkPreviewTypeApp{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeApp{} -) - -func (l *LinkPreviewTypeApp) Zero() bool { - if l == nil { - return true - } - if !(l.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeApp) String() string { - if l == nil { - return "LinkPreviewTypeApp(nil)" - } - type Alias LinkPreviewTypeApp - return fmt.Sprintf("LinkPreviewTypeApp%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeApp) TypeID() uint32 { - return LinkPreviewTypeAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeApp) TypeName() string { - return "linkPreviewTypeApp" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeApp", - ID: LinkPreviewTypeAppTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeApp) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeApp#e3a68def as nil") - } - b.PutID(LinkPreviewTypeAppTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeApp) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeApp#e3a68def as nil") - } - if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeApp#e3a68def: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeApp) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeApp#e3a68def to nil") - } - if err := b.ConsumeID(LinkPreviewTypeAppTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeApp#e3a68def: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeApp) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeApp#e3a68def to nil") - } - { - if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeApp#e3a68def: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeApp) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeApp#e3a68def as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeApp") - b.Comma() - b.FieldStart("photo") - if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeApp#e3a68def: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeApp) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeApp#e3a68def to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeApp"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeApp#e3a68def: %w", err) - } - case "photo": - if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeApp#e3a68def: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (l *LinkPreviewTypeApp) GetPhoto() (value Photo) { - if l == nil { - return - } - return l.Photo -} - -// LinkPreviewTypeArticle represents TL type `linkPreviewTypeArticle#7cce9bd9`. -type LinkPreviewTypeArticle struct { - // Article's main photo; may be null - Photo Photo -} - -// LinkPreviewTypeArticleTypeID is TL type id of LinkPreviewTypeArticle. -const LinkPreviewTypeArticleTypeID = 0x7cce9bd9 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeArticle) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeArticle. -var ( - _ bin.Encoder = &LinkPreviewTypeArticle{} - _ bin.Decoder = &LinkPreviewTypeArticle{} - _ bin.BareEncoder = &LinkPreviewTypeArticle{} - _ bin.BareDecoder = &LinkPreviewTypeArticle{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeArticle{} -) - -func (l *LinkPreviewTypeArticle) Zero() bool { - if l == nil { - return true - } - if !(l.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeArticle) String() string { - if l == nil { - return "LinkPreviewTypeArticle(nil)" - } - type Alias LinkPreviewTypeArticle - return fmt.Sprintf("LinkPreviewTypeArticle%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeArticle) TypeID() uint32 { - return LinkPreviewTypeArticleTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeArticle) TypeName() string { - return "linkPreviewTypeArticle" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeArticle) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeArticle", - ID: LinkPreviewTypeArticleTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeArticle) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeArticle#7cce9bd9 as nil") - } - b.PutID(LinkPreviewTypeArticleTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeArticle) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeArticle#7cce9bd9 as nil") - } - if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeArticle#7cce9bd9: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeArticle) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeArticle#7cce9bd9 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeArticleTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeArticle#7cce9bd9: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeArticle) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeArticle#7cce9bd9 to nil") - } - { - if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeArticle#7cce9bd9: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeArticle) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeArticle#7cce9bd9 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeArticle") - b.Comma() - b.FieldStart("photo") - if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeArticle#7cce9bd9: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeArticle) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeArticle#7cce9bd9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeArticle"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeArticle#7cce9bd9: %w", err) - } - case "photo": - if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeArticle#7cce9bd9: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (l *LinkPreviewTypeArticle) GetPhoto() (value Photo) { - if l == nil { - return - } - return l.Photo -} - -// LinkPreviewTypeAudio represents TL type `linkPreviewTypeAudio#75e407d2`. -type LinkPreviewTypeAudio struct { - // The audio description - Audio Audio -} - -// LinkPreviewTypeAudioTypeID is TL type id of LinkPreviewTypeAudio. -const LinkPreviewTypeAudioTypeID = 0x75e407d2 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeAudio) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeAudio. -var ( - _ bin.Encoder = &LinkPreviewTypeAudio{} - _ bin.Decoder = &LinkPreviewTypeAudio{} - _ bin.BareEncoder = &LinkPreviewTypeAudio{} - _ bin.BareDecoder = &LinkPreviewTypeAudio{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeAudio{} -) - -func (l *LinkPreviewTypeAudio) Zero() bool { - if l == nil { - return true - } - if !(l.Audio.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeAudio) String() string { - if l == nil { - return "LinkPreviewTypeAudio(nil)" - } - type Alias LinkPreviewTypeAudio - return fmt.Sprintf("LinkPreviewTypeAudio%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeAudio) TypeID() uint32 { - return LinkPreviewTypeAudioTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeAudio) TypeName() string { - return "linkPreviewTypeAudio" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeAudio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeAudio", - ID: LinkPreviewTypeAudioTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Audio", - SchemaName: "audio", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeAudio) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAudio#75e407d2 as nil") - } - b.PutID(LinkPreviewTypeAudioTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeAudio) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAudio#75e407d2 as nil") - } - if err := l.Audio.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeAudio#75e407d2: field audio: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeAudio) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAudio#75e407d2 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeAudioTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#75e407d2: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeAudio) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAudio#75e407d2 to nil") - } - { - if err := l.Audio.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#75e407d2: field audio: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeAudio) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeAudio#75e407d2 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeAudio") - b.Comma() - b.FieldStart("audio") - if err := l.Audio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeAudio#75e407d2: field audio: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeAudio) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeAudio#75e407d2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeAudio"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#75e407d2: %w", err) - } - case "audio": - if err := l.Audio.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeAudio#75e407d2: field audio: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAudio returns value of Audio field. -func (l *LinkPreviewTypeAudio) GetAudio() (value Audio) { - if l == nil { - return - } - return l.Audio -} - -// LinkPreviewTypeBackground represents TL type `linkPreviewTypeBackground#3a48a1e0`. -type LinkPreviewTypeBackground struct { - // Document with the background; may be null for filled backgrounds - Document Document - // Type of the background; may be null if unknown - BackgroundType BackgroundTypeClass -} - -// LinkPreviewTypeBackgroundTypeID is TL type id of LinkPreviewTypeBackground. -const LinkPreviewTypeBackgroundTypeID = 0x3a48a1e0 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeBackground) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeBackground. -var ( - _ bin.Encoder = &LinkPreviewTypeBackground{} - _ bin.Decoder = &LinkPreviewTypeBackground{} - _ bin.BareEncoder = &LinkPreviewTypeBackground{} - _ bin.BareDecoder = &LinkPreviewTypeBackground{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeBackground{} -) - -func (l *LinkPreviewTypeBackground) Zero() bool { - if l == nil { - return true - } - if !(l.Document.Zero()) { - return false - } - if !(l.BackgroundType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeBackground) String() string { - if l == nil { - return "LinkPreviewTypeBackground(nil)" - } - type Alias LinkPreviewTypeBackground - return fmt.Sprintf("LinkPreviewTypeBackground%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeBackground) TypeID() uint32 { - return LinkPreviewTypeBackgroundTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeBackground) TypeName() string { - return "linkPreviewTypeBackground" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeBackground) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeBackground", - ID: LinkPreviewTypeBackgroundTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Document", - SchemaName: "document", - }, - { - Name: "BackgroundType", - SchemaName: "background_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeBackground) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeBackground#3a48a1e0 as nil") - } - b.PutID(LinkPreviewTypeBackgroundTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeBackground) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeBackground#3a48a1e0 as nil") - } - if err := l.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeBackground#3a48a1e0: field document: %w", err) - } - if l.BackgroundType == nil { - return fmt.Errorf("unable to encode linkPreviewTypeBackground#3a48a1e0: field background_type is nil") - } - if err := l.BackgroundType.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeBackground#3a48a1e0: field background_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeBackground) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeBackground#3a48a1e0 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeBackgroundTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeBackground#3a48a1e0: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeBackground) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeBackground#3a48a1e0 to nil") - } - { - if err := l.Document.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeBackground#3a48a1e0: field document: %w", err) - } - } - { - value, err := DecodeBackgroundType(b) - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeBackground#3a48a1e0: field background_type: %w", err) - } - l.BackgroundType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeBackground) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeBackground#3a48a1e0 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeBackground") - b.Comma() - b.FieldStart("document") - if err := l.Document.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeBackground#3a48a1e0: field document: %w", err) - } - b.Comma() - b.FieldStart("background_type") - if l.BackgroundType == nil { - return fmt.Errorf("unable to encode linkPreviewTypeBackground#3a48a1e0: field background_type is nil") - } - if err := l.BackgroundType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeBackground#3a48a1e0: field background_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeBackground) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeBackground#3a48a1e0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeBackground"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeBackground#3a48a1e0: %w", err) - } - case "document": - if err := l.Document.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeBackground#3a48a1e0: field document: %w", err) - } - case "background_type": - value, err := DecodeTDLibJSONBackgroundType(b) - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeBackground#3a48a1e0: field background_type: %w", err) - } - l.BackgroundType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDocument returns value of Document field. -func (l *LinkPreviewTypeBackground) GetDocument() (value Document) { - if l == nil { - return - } - return l.Document -} - -// GetBackgroundType returns value of BackgroundType field. -func (l *LinkPreviewTypeBackground) GetBackgroundType() (value BackgroundTypeClass) { - if l == nil { - return - } - return l.BackgroundType -} - -// LinkPreviewTypeChannelBoost represents TL type `linkPreviewTypeChannelBoost#c6f40456`. -type LinkPreviewTypeChannelBoost struct { - // Photo of the chat; may be null - Photo ChatPhoto -} - -// LinkPreviewTypeChannelBoostTypeID is TL type id of LinkPreviewTypeChannelBoost. -const LinkPreviewTypeChannelBoostTypeID = 0xc6f40456 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeChannelBoost) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeChannelBoost. -var ( - _ bin.Encoder = &LinkPreviewTypeChannelBoost{} - _ bin.Decoder = &LinkPreviewTypeChannelBoost{} - _ bin.BareEncoder = &LinkPreviewTypeChannelBoost{} - _ bin.BareDecoder = &LinkPreviewTypeChannelBoost{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeChannelBoost{} -) - -func (l *LinkPreviewTypeChannelBoost) Zero() bool { - if l == nil { - return true - } - if !(l.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeChannelBoost) String() string { - if l == nil { - return "LinkPreviewTypeChannelBoost(nil)" - } - type Alias LinkPreviewTypeChannelBoost - return fmt.Sprintf("LinkPreviewTypeChannelBoost%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeChannelBoost) TypeID() uint32 { - return LinkPreviewTypeChannelBoostTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeChannelBoost) TypeName() string { - return "linkPreviewTypeChannelBoost" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeChannelBoost) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeChannelBoost", - ID: LinkPreviewTypeChannelBoostTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeChannelBoost) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeChannelBoost#c6f40456 as nil") - } - b.PutID(LinkPreviewTypeChannelBoostTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeChannelBoost) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeChannelBoost#c6f40456 as nil") - } - if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeChannelBoost#c6f40456: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeChannelBoost) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeChannelBoost#c6f40456 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeChannelBoostTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChannelBoost#c6f40456: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeChannelBoost) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeChannelBoost#c6f40456 to nil") - } - { - if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChannelBoost#c6f40456: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeChannelBoost) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeChannelBoost#c6f40456 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeChannelBoost") - b.Comma() - b.FieldStart("photo") - if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeChannelBoost#c6f40456: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeChannelBoost) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeChannelBoost#c6f40456 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeChannelBoost"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChannelBoost#c6f40456: %w", err) - } - case "photo": - if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChannelBoost#c6f40456: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (l *LinkPreviewTypeChannelBoost) GetPhoto() (value ChatPhoto) { - if l == nil { - return - } - return l.Photo -} - -// LinkPreviewTypeChat represents TL type `linkPreviewTypeChat#ae2fa122`. -type LinkPreviewTypeChat struct { - // Type of the chat - Type InviteLinkChatTypeClass - // Photo of the chat; may be null - Photo ChatPhoto - // True, if the link only creates join request - CreatesJoinRequest bool -} - -// LinkPreviewTypeChatTypeID is TL type id of LinkPreviewTypeChat. -const LinkPreviewTypeChatTypeID = 0xae2fa122 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeChat) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeChat. -var ( - _ bin.Encoder = &LinkPreviewTypeChat{} - _ bin.Decoder = &LinkPreviewTypeChat{} - _ bin.BareEncoder = &LinkPreviewTypeChat{} - _ bin.BareDecoder = &LinkPreviewTypeChat{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeChat{} -) - -func (l *LinkPreviewTypeChat) Zero() bool { - if l == nil { - return true - } - if !(l.Type == nil) { - return false - } - if !(l.Photo.Zero()) { - return false - } - if !(l.CreatesJoinRequest == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeChat) String() string { - if l == nil { - return "LinkPreviewTypeChat(nil)" - } - type Alias LinkPreviewTypeChat - return fmt.Sprintf("LinkPreviewTypeChat%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeChat) TypeID() uint32 { - return LinkPreviewTypeChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeChat) TypeName() string { - return "linkPreviewTypeChat" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeChat", - ID: LinkPreviewTypeChatTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "CreatesJoinRequest", - SchemaName: "creates_join_request", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeChat) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeChat#ae2fa122 as nil") - } - b.PutID(LinkPreviewTypeChatTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeChat) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeChat#ae2fa122 as nil") - } - if l.Type == nil { - return fmt.Errorf("unable to encode linkPreviewTypeChat#ae2fa122: field type is nil") - } - if err := l.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeChat#ae2fa122: field type: %w", err) - } - if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeChat#ae2fa122: field photo: %w", err) - } - b.PutBool(l.CreatesJoinRequest) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeChat) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeChat#ae2fa122 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeChatTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChat#ae2fa122: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeChat) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeChat#ae2fa122 to nil") - } - { - value, err := DecodeInviteLinkChatType(b) - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChat#ae2fa122: field type: %w", err) - } - l.Type = value - } - { - if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChat#ae2fa122: field photo: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChat#ae2fa122: field creates_join_request: %w", err) - } - l.CreatesJoinRequest = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeChat#ae2fa122 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeChat") - b.Comma() - b.FieldStart("type") - if l.Type == nil { - return fmt.Errorf("unable to encode linkPreviewTypeChat#ae2fa122: field type is nil") - } - if err := l.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeChat#ae2fa122: field type: %w", err) - } - b.Comma() - b.FieldStart("photo") - if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeChat#ae2fa122: field photo: %w", err) - } - b.Comma() - b.FieldStart("creates_join_request") - b.PutBool(l.CreatesJoinRequest) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeChat#ae2fa122 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeChat"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChat#ae2fa122: %w", err) - } - case "type": - value, err := DecodeTDLibJSONInviteLinkChatType(b) - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChat#ae2fa122: field type: %w", err) - } - l.Type = value - case "photo": - if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChat#ae2fa122: field photo: %w", err) - } - case "creates_join_request": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeChat#ae2fa122: field creates_join_request: %w", err) - } - l.CreatesJoinRequest = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (l *LinkPreviewTypeChat) GetType() (value InviteLinkChatTypeClass) { - if l == nil { - return - } - return l.Type -} - -// GetPhoto returns value of Photo field. -func (l *LinkPreviewTypeChat) GetPhoto() (value ChatPhoto) { - if l == nil { - return - } - return l.Photo -} - -// GetCreatesJoinRequest returns value of CreatesJoinRequest field. -func (l *LinkPreviewTypeChat) GetCreatesJoinRequest() (value bool) { - if l == nil { - return - } - return l.CreatesJoinRequest -} - -// LinkPreviewTypeDocument represents TL type `linkPreviewTypeDocument#bf0169a2`. -type LinkPreviewTypeDocument struct { - // The document description - Document Document -} - -// LinkPreviewTypeDocumentTypeID is TL type id of LinkPreviewTypeDocument. -const LinkPreviewTypeDocumentTypeID = 0xbf0169a2 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeDocument) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeDocument. -var ( - _ bin.Encoder = &LinkPreviewTypeDocument{} - _ bin.Decoder = &LinkPreviewTypeDocument{} - _ bin.BareEncoder = &LinkPreviewTypeDocument{} - _ bin.BareDecoder = &LinkPreviewTypeDocument{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeDocument{} -) - -func (l *LinkPreviewTypeDocument) Zero() bool { - if l == nil { - return true - } - if !(l.Document.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeDocument) String() string { - if l == nil { - return "LinkPreviewTypeDocument(nil)" - } - type Alias LinkPreviewTypeDocument - return fmt.Sprintf("LinkPreviewTypeDocument%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeDocument) TypeID() uint32 { - return LinkPreviewTypeDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeDocument) TypeName() string { - return "linkPreviewTypeDocument" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeDocument", - ID: LinkPreviewTypeDocumentTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Document", - SchemaName: "document", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeDocument) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeDocument#bf0169a2 as nil") - } - b.PutID(LinkPreviewTypeDocumentTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeDocument) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeDocument#bf0169a2 as nil") - } - if err := l.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeDocument#bf0169a2: field document: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeDocument) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeDocument#bf0169a2 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeDocument#bf0169a2: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeDocument) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeDocument#bf0169a2 to nil") - } - { - if err := l.Document.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeDocument#bf0169a2: field document: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeDocument#bf0169a2 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeDocument") - b.Comma() - b.FieldStart("document") - if err := l.Document.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeDocument#bf0169a2: field document: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeDocument#bf0169a2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeDocument"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeDocument#bf0169a2: %w", err) - } - case "document": - if err := l.Document.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeDocument#bf0169a2: field document: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDocument returns value of Document field. -func (l *LinkPreviewTypeDocument) GetDocument() (value Document) { - if l == nil { - return - } - return l.Document -} - -// LinkPreviewTypeEmbeddedAnimationPlayer represents TL type `linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605`. -type LinkPreviewTypeEmbeddedAnimationPlayer struct { - // URL of the external animation player - URL string - // Thumbnail of the animation; may be null if unknown - Thumbnail Photo - // Duration of the animation, in seconds - Duration int32 - // Expected width of the embedded player - Width int32 - // Expected height of the embedded player - Height int32 -} - -// LinkPreviewTypeEmbeddedAnimationPlayerTypeID is TL type id of LinkPreviewTypeEmbeddedAnimationPlayer. -const LinkPreviewTypeEmbeddedAnimationPlayerTypeID = 0xaa5ad605 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeEmbeddedAnimationPlayer) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeEmbeddedAnimationPlayer. -var ( - _ bin.Encoder = &LinkPreviewTypeEmbeddedAnimationPlayer{} - _ bin.Decoder = &LinkPreviewTypeEmbeddedAnimationPlayer{} - _ bin.BareEncoder = &LinkPreviewTypeEmbeddedAnimationPlayer{} - _ bin.BareDecoder = &LinkPreviewTypeEmbeddedAnimationPlayer{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeEmbeddedAnimationPlayer{} -) - -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) Zero() bool { - if l == nil { - return true - } - if !(l.URL == "") { - return false - } - if !(l.Thumbnail.Zero()) { - return false - } - if !(l.Duration == 0) { - return false - } - if !(l.Width == 0) { - return false - } - if !(l.Height == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) String() string { - if l == nil { - return "LinkPreviewTypeEmbeddedAnimationPlayer(nil)" - } - type Alias LinkPreviewTypeEmbeddedAnimationPlayer - return fmt.Sprintf("LinkPreviewTypeEmbeddedAnimationPlayer%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeEmbeddedAnimationPlayer) TypeID() uint32 { - return LinkPreviewTypeEmbeddedAnimationPlayerTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeEmbeddedAnimationPlayer) TypeName() string { - return "linkPreviewTypeEmbeddedAnimationPlayer" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeEmbeddedAnimationPlayer", - ID: LinkPreviewTypeEmbeddedAnimationPlayerTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 as nil") - } - b.PutID(LinkPreviewTypeEmbeddedAnimationPlayerTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 as nil") - } - b.PutString(l.URL) - if err := l.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field thumbnail: %w", err) - } - b.PutInt32(l.Duration) - b.PutInt32(l.Width) - b.PutInt32(l.Height) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeEmbeddedAnimationPlayerTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field url: %w", err) - } - l.URL = value - } - { - if err := l.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field thumbnail: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field duration: %w", err) - } - l.Duration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field width: %w", err) - } - l.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field height: %w", err) - } - l.Height = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeEmbeddedAnimationPlayer") - b.Comma() - b.FieldStart("url") - b.PutString(l.URL) - b.Comma() - b.FieldStart("thumbnail") - if err := l.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("duration") - b.PutInt32(l.Duration) - b.Comma() - b.FieldStart("width") - b.PutInt32(l.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(l.Height) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeEmbeddedAnimationPlayer"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field url: %w", err) - } - l.URL = value - case "thumbnail": - if err := l.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field thumbnail: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field duration: %w", err) - } - l.Duration = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field width: %w", err) - } - l.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605: field height: %w", err) - } - l.Height = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetURL() (value string) { - if l == nil { - return - } - return l.URL -} - -// GetThumbnail returns value of Thumbnail field. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetThumbnail() (value Photo) { - if l == nil { - return - } - return l.Thumbnail -} - -// GetDuration returns value of Duration field. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetDuration() (value int32) { - if l == nil { - return - } - return l.Duration -} - -// GetWidth returns value of Width field. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetWidth() (value int32) { - if l == nil { - return - } - return l.Width -} - -// GetHeight returns value of Height field. -func (l *LinkPreviewTypeEmbeddedAnimationPlayer) GetHeight() (value int32) { - if l == nil { - return - } - return l.Height -} - -// LinkPreviewTypeEmbeddedAudioPlayer represents TL type `linkPreviewTypeEmbeddedAudioPlayer#220b429c`. -type LinkPreviewTypeEmbeddedAudioPlayer struct { - // URL of the external audio player - URL string - // Thumbnail of the audio; may be null if unknown - Thumbnail Photo - // Duration of the audio, in seconds - Duration int32 - // Expected width of the embedded player - Width int32 - // Expected height of the embedded player - Height int32 -} - -// LinkPreviewTypeEmbeddedAudioPlayerTypeID is TL type id of LinkPreviewTypeEmbeddedAudioPlayer. -const LinkPreviewTypeEmbeddedAudioPlayerTypeID = 0x220b429c - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeEmbeddedAudioPlayer) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeEmbeddedAudioPlayer. -var ( - _ bin.Encoder = &LinkPreviewTypeEmbeddedAudioPlayer{} - _ bin.Decoder = &LinkPreviewTypeEmbeddedAudioPlayer{} - _ bin.BareEncoder = &LinkPreviewTypeEmbeddedAudioPlayer{} - _ bin.BareDecoder = &LinkPreviewTypeEmbeddedAudioPlayer{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeEmbeddedAudioPlayer{} -) - -func (l *LinkPreviewTypeEmbeddedAudioPlayer) Zero() bool { - if l == nil { - return true - } - if !(l.URL == "") { - return false - } - if !(l.Thumbnail.Zero()) { - return false - } - if !(l.Duration == 0) { - return false - } - if !(l.Width == 0) { - return false - } - if !(l.Height == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) String() string { - if l == nil { - return "LinkPreviewTypeEmbeddedAudioPlayer(nil)" - } - type Alias LinkPreviewTypeEmbeddedAudioPlayer - return fmt.Sprintf("LinkPreviewTypeEmbeddedAudioPlayer%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeEmbeddedAudioPlayer) TypeID() uint32 { - return LinkPreviewTypeEmbeddedAudioPlayerTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeEmbeddedAudioPlayer) TypeName() string { - return "linkPreviewTypeEmbeddedAudioPlayer" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeEmbeddedAudioPlayer", - ID: LinkPreviewTypeEmbeddedAudioPlayerTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#220b429c as nil") - } - b.PutID(LinkPreviewTypeEmbeddedAudioPlayerTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#220b429c as nil") - } - b.PutString(l.URL) - if err := l.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field thumbnail: %w", err) - } - b.PutInt32(l.Duration) - b.PutInt32(l.Width) - b.PutInt32(l.Height) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#220b429c to nil") - } - if err := b.ConsumeID(LinkPreviewTypeEmbeddedAudioPlayerTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#220b429c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field url: %w", err) - } - l.URL = value - } - { - if err := l.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field thumbnail: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field duration: %w", err) - } - l.Duration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field width: %w", err) - } - l.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field height: %w", err) - } - l.Height = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedAudioPlayer#220b429c as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeEmbeddedAudioPlayer") - b.Comma() - b.FieldStart("url") - b.PutString(l.URL) - b.Comma() - b.FieldStart("thumbnail") - if err := l.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("duration") - b.PutInt32(l.Duration) - b.Comma() - b.FieldStart("width") - b.PutInt32(l.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(l.Height) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedAudioPlayer#220b429c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeEmbeddedAudioPlayer"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field url: %w", err) - } - l.URL = value - case "thumbnail": - if err := l.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field thumbnail: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field duration: %w", err) - } - l.Duration = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field width: %w", err) - } - l.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedAudioPlayer#220b429c: field height: %w", err) - } - l.Height = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetURL() (value string) { - if l == nil { - return - } - return l.URL -} - -// GetThumbnail returns value of Thumbnail field. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetThumbnail() (value Photo) { - if l == nil { - return - } - return l.Thumbnail -} - -// GetDuration returns value of Duration field. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetDuration() (value int32) { - if l == nil { - return - } - return l.Duration -} - -// GetWidth returns value of Width field. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetWidth() (value int32) { - if l == nil { - return - } - return l.Width -} - -// GetHeight returns value of Height field. -func (l *LinkPreviewTypeEmbeddedAudioPlayer) GetHeight() (value int32) { - if l == nil { - return - } - return l.Height -} - -// LinkPreviewTypeEmbeddedVideoPlayer represents TL type `linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03`. -type LinkPreviewTypeEmbeddedVideoPlayer struct { - // URL of the external video player - URL string - // Thumbnail of the video; may be null if unknown - Thumbnail Photo - // Duration of the video, in seconds - Duration int32 - // Expected width of the embedded player - Width int32 - // Expected height of the embedded player - Height int32 -} - -// LinkPreviewTypeEmbeddedVideoPlayerTypeID is TL type id of LinkPreviewTypeEmbeddedVideoPlayer. -const LinkPreviewTypeEmbeddedVideoPlayerTypeID = 0xa7bfbb03 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeEmbeddedVideoPlayer) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeEmbeddedVideoPlayer. -var ( - _ bin.Encoder = &LinkPreviewTypeEmbeddedVideoPlayer{} - _ bin.Decoder = &LinkPreviewTypeEmbeddedVideoPlayer{} - _ bin.BareEncoder = &LinkPreviewTypeEmbeddedVideoPlayer{} - _ bin.BareDecoder = &LinkPreviewTypeEmbeddedVideoPlayer{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeEmbeddedVideoPlayer{} -) - -func (l *LinkPreviewTypeEmbeddedVideoPlayer) Zero() bool { - if l == nil { - return true - } - if !(l.URL == "") { - return false - } - if !(l.Thumbnail.Zero()) { - return false - } - if !(l.Duration == 0) { - return false - } - if !(l.Width == 0) { - return false - } - if !(l.Height == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) String() string { - if l == nil { - return "LinkPreviewTypeEmbeddedVideoPlayer(nil)" - } - type Alias LinkPreviewTypeEmbeddedVideoPlayer - return fmt.Sprintf("LinkPreviewTypeEmbeddedVideoPlayer%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeEmbeddedVideoPlayer) TypeID() uint32 { - return LinkPreviewTypeEmbeddedVideoPlayerTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeEmbeddedVideoPlayer) TypeName() string { - return "linkPreviewTypeEmbeddedVideoPlayer" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeEmbeddedVideoPlayer", - ID: LinkPreviewTypeEmbeddedVideoPlayerTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 as nil") - } - b.PutID(LinkPreviewTypeEmbeddedVideoPlayerTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 as nil") - } - b.PutString(l.URL) - if err := l.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field thumbnail: %w", err) - } - b.PutInt32(l.Duration) - b.PutInt32(l.Width) - b.PutInt32(l.Height) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeEmbeddedVideoPlayerTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field url: %w", err) - } - l.URL = value - } - { - if err := l.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field thumbnail: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field duration: %w", err) - } - l.Duration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field width: %w", err) - } - l.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field height: %w", err) - } - l.Height = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeEmbeddedVideoPlayer") - b.Comma() - b.FieldStart("url") - b.PutString(l.URL) - b.Comma() - b.FieldStart("thumbnail") - if err := l.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("duration") - b.PutInt32(l.Duration) - b.Comma() - b.FieldStart("width") - b.PutInt32(l.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(l.Height) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeEmbeddedVideoPlayer"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field url: %w", err) - } - l.URL = value - case "thumbnail": - if err := l.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field thumbnail: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field duration: %w", err) - } - l.Duration = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field width: %w", err) - } - l.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03: field height: %w", err) - } - l.Height = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetURL() (value string) { - if l == nil { - return - } - return l.URL -} - -// GetThumbnail returns value of Thumbnail field. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetThumbnail() (value Photo) { - if l == nil { - return - } - return l.Thumbnail -} - -// GetDuration returns value of Duration field. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetDuration() (value int32) { - if l == nil { - return - } - return l.Duration -} - -// GetWidth returns value of Width field. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetWidth() (value int32) { - if l == nil { - return - } - return l.Width -} - -// GetHeight returns value of Height field. -func (l *LinkPreviewTypeEmbeddedVideoPlayer) GetHeight() (value int32) { - if l == nil { - return - } - return l.Height -} - -// LinkPreviewTypeExternalAudio represents TL type `linkPreviewTypeExternalAudio#8a82ffed`. -type LinkPreviewTypeExternalAudio struct { - // URL of the audio file - URL string - // MIME type of the audio file - MimeType string - // Duration of the audio, in seconds; 0 if unknown - Duration int32 -} - -// LinkPreviewTypeExternalAudioTypeID is TL type id of LinkPreviewTypeExternalAudio. -const LinkPreviewTypeExternalAudioTypeID = 0x8a82ffed - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeExternalAudio) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeExternalAudio. -var ( - _ bin.Encoder = &LinkPreviewTypeExternalAudio{} - _ bin.Decoder = &LinkPreviewTypeExternalAudio{} - _ bin.BareEncoder = &LinkPreviewTypeExternalAudio{} - _ bin.BareDecoder = &LinkPreviewTypeExternalAudio{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeExternalAudio{} -) - -func (l *LinkPreviewTypeExternalAudio) Zero() bool { - if l == nil { - return true - } - if !(l.URL == "") { - return false - } - if !(l.MimeType == "") { - return false - } - if !(l.Duration == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeExternalAudio) String() string { - if l == nil { - return "LinkPreviewTypeExternalAudio(nil)" - } - type Alias LinkPreviewTypeExternalAudio - return fmt.Sprintf("LinkPreviewTypeExternalAudio%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeExternalAudio) TypeID() uint32 { - return LinkPreviewTypeExternalAudioTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeExternalAudio) TypeName() string { - return "linkPreviewTypeExternalAudio" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeExternalAudio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeExternalAudio", - ID: LinkPreviewTypeExternalAudioTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "MimeType", - SchemaName: "mime_type", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeExternalAudio) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeExternalAudio#8a82ffed as nil") - } - b.PutID(LinkPreviewTypeExternalAudioTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeExternalAudio) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeExternalAudio#8a82ffed as nil") - } - b.PutString(l.URL) - b.PutString(l.MimeType) - b.PutInt32(l.Duration) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeExternalAudio) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeExternalAudio#8a82ffed to nil") - } - if err := b.ConsumeID(LinkPreviewTypeExternalAudioTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeExternalAudio) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeExternalAudio#8a82ffed to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field url: %w", err) - } - l.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field mime_type: %w", err) - } - l.MimeType = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field duration: %w", err) - } - l.Duration = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeExternalAudio) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeExternalAudio#8a82ffed as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeExternalAudio") - b.Comma() - b.FieldStart("url") - b.PutString(l.URL) - b.Comma() - b.FieldStart("mime_type") - b.PutString(l.MimeType) - b.Comma() - b.FieldStart("duration") - b.PutInt32(l.Duration) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeExternalAudio) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeExternalAudio#8a82ffed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeExternalAudio"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field url: %w", err) - } - l.URL = value - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field mime_type: %w", err) - } - l.MimeType = value - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalAudio#8a82ffed: field duration: %w", err) - } - l.Duration = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (l *LinkPreviewTypeExternalAudio) GetURL() (value string) { - if l == nil { - return - } - return l.URL -} - -// GetMimeType returns value of MimeType field. -func (l *LinkPreviewTypeExternalAudio) GetMimeType() (value string) { - if l == nil { - return - } - return l.MimeType -} - -// GetDuration returns value of Duration field. -func (l *LinkPreviewTypeExternalAudio) GetDuration() (value int32) { - if l == nil { - return - } - return l.Duration -} - -// LinkPreviewTypeExternalVideo represents TL type `linkPreviewTypeExternalVideo#517dcb98`. -type LinkPreviewTypeExternalVideo struct { - // URL of the video file - URL string - // MIME type of the video file - MimeType string - // Expected width of the video preview; 0 if unknown - Width int32 - // Expected height of the video preview; 0 if unknown - Height int32 - // Duration of the video, in seconds; 0 if unknown - Duration int32 -} - -// LinkPreviewTypeExternalVideoTypeID is TL type id of LinkPreviewTypeExternalVideo. -const LinkPreviewTypeExternalVideoTypeID = 0x517dcb98 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeExternalVideo) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeExternalVideo. -var ( - _ bin.Encoder = &LinkPreviewTypeExternalVideo{} - _ bin.Decoder = &LinkPreviewTypeExternalVideo{} - _ bin.BareEncoder = &LinkPreviewTypeExternalVideo{} - _ bin.BareDecoder = &LinkPreviewTypeExternalVideo{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeExternalVideo{} -) - -func (l *LinkPreviewTypeExternalVideo) Zero() bool { - if l == nil { - return true - } - if !(l.URL == "") { - return false - } - if !(l.MimeType == "") { - return false - } - if !(l.Width == 0) { - return false - } - if !(l.Height == 0) { - return false - } - if !(l.Duration == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeExternalVideo) String() string { - if l == nil { - return "LinkPreviewTypeExternalVideo(nil)" - } - type Alias LinkPreviewTypeExternalVideo - return fmt.Sprintf("LinkPreviewTypeExternalVideo%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeExternalVideo) TypeID() uint32 { - return LinkPreviewTypeExternalVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeExternalVideo) TypeName() string { - return "linkPreviewTypeExternalVideo" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeExternalVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeExternalVideo", - ID: LinkPreviewTypeExternalVideoTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "MimeType", - SchemaName: "mime_type", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeExternalVideo) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeExternalVideo#517dcb98 as nil") - } - b.PutID(LinkPreviewTypeExternalVideoTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeExternalVideo) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeExternalVideo#517dcb98 as nil") - } - b.PutString(l.URL) - b.PutString(l.MimeType) - b.PutInt32(l.Width) - b.PutInt32(l.Height) - b.PutInt32(l.Duration) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeExternalVideo) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeExternalVideo#517dcb98 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeExternalVideoTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeExternalVideo) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeExternalVideo#517dcb98 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field url: %w", err) - } - l.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field mime_type: %w", err) - } - l.MimeType = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field width: %w", err) - } - l.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field height: %w", err) - } - l.Height = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field duration: %w", err) - } - l.Duration = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeExternalVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeExternalVideo#517dcb98 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeExternalVideo") - b.Comma() - b.FieldStart("url") - b.PutString(l.URL) - b.Comma() - b.FieldStart("mime_type") - b.PutString(l.MimeType) - b.Comma() - b.FieldStart("width") - b.PutInt32(l.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(l.Height) - b.Comma() - b.FieldStart("duration") - b.PutInt32(l.Duration) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeExternalVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeExternalVideo#517dcb98 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeExternalVideo"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field url: %w", err) - } - l.URL = value - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field mime_type: %w", err) - } - l.MimeType = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field width: %w", err) - } - l.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field height: %w", err) - } - l.Height = value - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeExternalVideo#517dcb98: field duration: %w", err) - } - l.Duration = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (l *LinkPreviewTypeExternalVideo) GetURL() (value string) { - if l == nil { - return - } - return l.URL -} - -// GetMimeType returns value of MimeType field. -func (l *LinkPreviewTypeExternalVideo) GetMimeType() (value string) { - if l == nil { - return - } - return l.MimeType -} - -// GetWidth returns value of Width field. -func (l *LinkPreviewTypeExternalVideo) GetWidth() (value int32) { - if l == nil { - return - } - return l.Width -} - -// GetHeight returns value of Height field. -func (l *LinkPreviewTypeExternalVideo) GetHeight() (value int32) { - if l == nil { - return - } - return l.Height -} - -// GetDuration returns value of Duration field. -func (l *LinkPreviewTypeExternalVideo) GetDuration() (value int32) { - if l == nil { - return - } - return l.Duration -} - -// LinkPreviewTypeInvoice represents TL type `linkPreviewTypeInvoice#d47f48da`. -type LinkPreviewTypeInvoice struct { -} - -// LinkPreviewTypeInvoiceTypeID is TL type id of LinkPreviewTypeInvoice. -const LinkPreviewTypeInvoiceTypeID = 0xd47f48da - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeInvoice) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeInvoice. -var ( - _ bin.Encoder = &LinkPreviewTypeInvoice{} - _ bin.Decoder = &LinkPreviewTypeInvoice{} - _ bin.BareEncoder = &LinkPreviewTypeInvoice{} - _ bin.BareDecoder = &LinkPreviewTypeInvoice{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeInvoice{} -) - -func (l *LinkPreviewTypeInvoice) Zero() bool { - if l == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeInvoice) String() string { - if l == nil { - return "LinkPreviewTypeInvoice(nil)" - } - type Alias LinkPreviewTypeInvoice - return fmt.Sprintf("LinkPreviewTypeInvoice%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeInvoice) TypeID() uint32 { - return LinkPreviewTypeInvoiceTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeInvoice) TypeName() string { - return "linkPreviewTypeInvoice" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeInvoice) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeInvoice", - ID: LinkPreviewTypeInvoiceTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeInvoice) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeInvoice#d47f48da as nil") - } - b.PutID(LinkPreviewTypeInvoiceTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeInvoice) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeInvoice#d47f48da as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeInvoice) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeInvoice#d47f48da to nil") - } - if err := b.ConsumeID(LinkPreviewTypeInvoiceTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeInvoice#d47f48da: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeInvoice) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeInvoice#d47f48da to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeInvoice) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeInvoice#d47f48da as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeInvoice") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeInvoice) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeInvoice#d47f48da to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeInvoice"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeInvoice#d47f48da: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// LinkPreviewTypeMessage represents TL type `linkPreviewTypeMessage#19f4c19e`. -type LinkPreviewTypeMessage struct { -} - -// LinkPreviewTypeMessageTypeID is TL type id of LinkPreviewTypeMessage. -const LinkPreviewTypeMessageTypeID = 0x19f4c19e - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeMessage) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeMessage. -var ( - _ bin.Encoder = &LinkPreviewTypeMessage{} - _ bin.Decoder = &LinkPreviewTypeMessage{} - _ bin.BareEncoder = &LinkPreviewTypeMessage{} - _ bin.BareDecoder = &LinkPreviewTypeMessage{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeMessage{} -) - -func (l *LinkPreviewTypeMessage) Zero() bool { - if l == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeMessage) String() string { - if l == nil { - return "LinkPreviewTypeMessage(nil)" - } - type Alias LinkPreviewTypeMessage - return fmt.Sprintf("LinkPreviewTypeMessage%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeMessage) TypeID() uint32 { - return LinkPreviewTypeMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeMessage) TypeName() string { - return "linkPreviewTypeMessage" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeMessage", - ID: LinkPreviewTypeMessageTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeMessage) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeMessage#19f4c19e as nil") - } - b.PutID(LinkPreviewTypeMessageTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeMessage) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeMessage#19f4c19e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeMessage) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeMessage#19f4c19e to nil") - } - if err := b.ConsumeID(LinkPreviewTypeMessageTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeMessage#19f4c19e: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeMessage) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeMessage#19f4c19e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeMessage#19f4c19e as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeMessage") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeMessage#19f4c19e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeMessage"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeMessage#19f4c19e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// LinkPreviewTypePhoto represents TL type `linkPreviewTypePhoto#aecfaaac`. -type LinkPreviewTypePhoto struct { - // The photo - Photo Photo -} - -// LinkPreviewTypePhotoTypeID is TL type id of LinkPreviewTypePhoto. -const LinkPreviewTypePhotoTypeID = 0xaecfaaac - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypePhoto) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypePhoto. -var ( - _ bin.Encoder = &LinkPreviewTypePhoto{} - _ bin.Decoder = &LinkPreviewTypePhoto{} - _ bin.BareEncoder = &LinkPreviewTypePhoto{} - _ bin.BareDecoder = &LinkPreviewTypePhoto{} - - _ LinkPreviewTypeClass = &LinkPreviewTypePhoto{} -) - -func (l *LinkPreviewTypePhoto) Zero() bool { - if l == nil { - return true - } - if !(l.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypePhoto) String() string { - if l == nil { - return "LinkPreviewTypePhoto(nil)" - } - type Alias LinkPreviewTypePhoto - return fmt.Sprintf("LinkPreviewTypePhoto%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypePhoto) TypeID() uint32 { - return LinkPreviewTypePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypePhoto) TypeName() string { - return "linkPreviewTypePhoto" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypePhoto", - ID: LinkPreviewTypePhotoTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypePhoto) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypePhoto#aecfaaac as nil") - } - b.PutID(LinkPreviewTypePhotoTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypePhoto) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypePhoto#aecfaaac as nil") - } - if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypePhoto#aecfaaac: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypePhoto) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypePhoto#aecfaaac to nil") - } - if err := b.ConsumeID(LinkPreviewTypePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePhoto#aecfaaac: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypePhoto) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypePhoto#aecfaaac to nil") - } - { - if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePhoto#aecfaaac: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypePhoto#aecfaaac as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypePhoto") - b.Comma() - b.FieldStart("photo") - if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypePhoto#aecfaaac: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypePhoto#aecfaaac to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypePhoto"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePhoto#aecfaaac: %w", err) - } - case "photo": - if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePhoto#aecfaaac: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (l *LinkPreviewTypePhoto) GetPhoto() (value Photo) { - if l == nil { - return - } - return l.Photo -} - -// LinkPreviewTypePremiumGiftCode represents TL type `linkPreviewTypePremiumGiftCode#4e0d80b1`. -type LinkPreviewTypePremiumGiftCode struct { -} - -// LinkPreviewTypePremiumGiftCodeTypeID is TL type id of LinkPreviewTypePremiumGiftCode. -const LinkPreviewTypePremiumGiftCodeTypeID = 0x4e0d80b1 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypePremiumGiftCode) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypePremiumGiftCode. -var ( - _ bin.Encoder = &LinkPreviewTypePremiumGiftCode{} - _ bin.Decoder = &LinkPreviewTypePremiumGiftCode{} - _ bin.BareEncoder = &LinkPreviewTypePremiumGiftCode{} - _ bin.BareDecoder = &LinkPreviewTypePremiumGiftCode{} - - _ LinkPreviewTypeClass = &LinkPreviewTypePremiumGiftCode{} -) - -func (l *LinkPreviewTypePremiumGiftCode) Zero() bool { - if l == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypePremiumGiftCode) String() string { - if l == nil { - return "LinkPreviewTypePremiumGiftCode(nil)" - } - type Alias LinkPreviewTypePremiumGiftCode - return fmt.Sprintf("LinkPreviewTypePremiumGiftCode%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypePremiumGiftCode) TypeID() uint32 { - return LinkPreviewTypePremiumGiftCodeTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypePremiumGiftCode) TypeName() string { - return "linkPreviewTypePremiumGiftCode" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypePremiumGiftCode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypePremiumGiftCode", - ID: LinkPreviewTypePremiumGiftCodeTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypePremiumGiftCode) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypePremiumGiftCode#4e0d80b1 as nil") - } - b.PutID(LinkPreviewTypePremiumGiftCodeTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypePremiumGiftCode) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypePremiumGiftCode#4e0d80b1 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypePremiumGiftCode) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypePremiumGiftCode#4e0d80b1 to nil") - } - if err := b.ConsumeID(LinkPreviewTypePremiumGiftCodeTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePremiumGiftCode#4e0d80b1: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypePremiumGiftCode) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypePremiumGiftCode#4e0d80b1 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypePremiumGiftCode) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypePremiumGiftCode#4e0d80b1 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypePremiumGiftCode") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypePremiumGiftCode) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypePremiumGiftCode#4e0d80b1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypePremiumGiftCode"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypePremiumGiftCode#4e0d80b1: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// LinkPreviewTypeShareableChatFolder represents TL type `linkPreviewTypeShareableChatFolder#805ab33c`. -type LinkPreviewTypeShareableChatFolder struct { -} - -// LinkPreviewTypeShareableChatFolderTypeID is TL type id of LinkPreviewTypeShareableChatFolder. -const LinkPreviewTypeShareableChatFolderTypeID = 0x805ab33c - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeShareableChatFolder) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeShareableChatFolder. -var ( - _ bin.Encoder = &LinkPreviewTypeShareableChatFolder{} - _ bin.Decoder = &LinkPreviewTypeShareableChatFolder{} - _ bin.BareEncoder = &LinkPreviewTypeShareableChatFolder{} - _ bin.BareDecoder = &LinkPreviewTypeShareableChatFolder{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeShareableChatFolder{} -) - -func (l *LinkPreviewTypeShareableChatFolder) Zero() bool { - if l == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeShareableChatFolder) String() string { - if l == nil { - return "LinkPreviewTypeShareableChatFolder(nil)" - } - type Alias LinkPreviewTypeShareableChatFolder - return fmt.Sprintf("LinkPreviewTypeShareableChatFolder%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeShareableChatFolder) TypeID() uint32 { - return LinkPreviewTypeShareableChatFolderTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeShareableChatFolder) TypeName() string { - return "linkPreviewTypeShareableChatFolder" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeShareableChatFolder) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeShareableChatFolder", - ID: LinkPreviewTypeShareableChatFolderTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeShareableChatFolder) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeShareableChatFolder#805ab33c as nil") - } - b.PutID(LinkPreviewTypeShareableChatFolderTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeShareableChatFolder) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeShareableChatFolder#805ab33c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeShareableChatFolder) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeShareableChatFolder#805ab33c to nil") - } - if err := b.ConsumeID(LinkPreviewTypeShareableChatFolderTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeShareableChatFolder#805ab33c: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeShareableChatFolder) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeShareableChatFolder#805ab33c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeShareableChatFolder) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeShareableChatFolder#805ab33c as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeShareableChatFolder") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeShareableChatFolder) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeShareableChatFolder#805ab33c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeShareableChatFolder"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeShareableChatFolder#805ab33c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// LinkPreviewTypeSticker represents TL type `linkPreviewTypeSticker#245f4d25`. -type LinkPreviewTypeSticker struct { - // The sticker. It can be an arbitrary WEBP image and can have dimensions bigger than 512 - Sticker Sticker -} - -// LinkPreviewTypeStickerTypeID is TL type id of LinkPreviewTypeSticker. -const LinkPreviewTypeStickerTypeID = 0x245f4d25 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeSticker) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeSticker. -var ( - _ bin.Encoder = &LinkPreviewTypeSticker{} - _ bin.Decoder = &LinkPreviewTypeSticker{} - _ bin.BareEncoder = &LinkPreviewTypeSticker{} - _ bin.BareDecoder = &LinkPreviewTypeSticker{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeSticker{} -) - -func (l *LinkPreviewTypeSticker) Zero() bool { - if l == nil { - return true - } - if !(l.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeSticker) String() string { - if l == nil { - return "LinkPreviewTypeSticker(nil)" - } - type Alias LinkPreviewTypeSticker - return fmt.Sprintf("LinkPreviewTypeSticker%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeSticker) TypeID() uint32 { - return LinkPreviewTypeStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeSticker) TypeName() string { - return "linkPreviewTypeSticker" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeSticker", - ID: LinkPreviewTypeStickerTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeSticker) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeSticker#245f4d25 as nil") - } - b.PutID(LinkPreviewTypeStickerTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeSticker) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeSticker#245f4d25 as nil") - } - if err := l.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeSticker#245f4d25: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeSticker) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeSticker#245f4d25 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeStickerTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeSticker#245f4d25: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeSticker) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeSticker#245f4d25 to nil") - } - { - if err := l.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeSticker#245f4d25: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeSticker#245f4d25 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeSticker") - b.Comma() - b.FieldStart("sticker") - if err := l.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeSticker#245f4d25: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeSticker#245f4d25 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeSticker"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeSticker#245f4d25: %w", err) - } - case "sticker": - if err := l.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeSticker#245f4d25: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (l *LinkPreviewTypeSticker) GetSticker() (value Sticker) { - if l == nil { - return - } - return l.Sticker -} - -// LinkPreviewTypeStickerSet represents TL type `linkPreviewTypeStickerSet#cb82a523`. -type LinkPreviewTypeStickerSet struct { - // Up to 4 stickers from the sticker set - Stickers []Sticker -} - -// LinkPreviewTypeStickerSetTypeID is TL type id of LinkPreviewTypeStickerSet. -const LinkPreviewTypeStickerSetTypeID = 0xcb82a523 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeStickerSet) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeStickerSet. -var ( - _ bin.Encoder = &LinkPreviewTypeStickerSet{} - _ bin.Decoder = &LinkPreviewTypeStickerSet{} - _ bin.BareEncoder = &LinkPreviewTypeStickerSet{} - _ bin.BareDecoder = &LinkPreviewTypeStickerSet{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeStickerSet{} -) - -func (l *LinkPreviewTypeStickerSet) Zero() bool { - if l == nil { - return true - } - if !(l.Stickers == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeStickerSet) String() string { - if l == nil { - return "LinkPreviewTypeStickerSet(nil)" - } - type Alias LinkPreviewTypeStickerSet - return fmt.Sprintf("LinkPreviewTypeStickerSet%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeStickerSet) TypeID() uint32 { - return LinkPreviewTypeStickerSetTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeStickerSet) TypeName() string { - return "linkPreviewTypeStickerSet" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeStickerSet) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeStickerSet", - ID: LinkPreviewTypeStickerSetTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Stickers", - SchemaName: "stickers", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeStickerSet) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeStickerSet#cb82a523 as nil") - } - b.PutID(LinkPreviewTypeStickerSetTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeStickerSet) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeStickerSet#cb82a523 as nil") - } - b.PutInt(len(l.Stickers)) - for idx, v := range l.Stickers { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare linkPreviewTypeStickerSet#cb82a523: field stickers element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeStickerSet) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeStickerSet#cb82a523 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeStickerSetTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeStickerSet#cb82a523: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeStickerSet) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeStickerSet#cb82a523 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeStickerSet#cb82a523: field stickers: %w", err) - } - - if headerLen > 0 { - l.Stickers = make([]Sticker, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Sticker - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare linkPreviewTypeStickerSet#cb82a523: field stickers: %w", err) - } - l.Stickers = append(l.Stickers, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeStickerSet) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeStickerSet#cb82a523 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeStickerSet") - b.Comma() - b.FieldStart("stickers") - b.ArrStart() - for idx, v := range l.Stickers { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeStickerSet#cb82a523: field stickers element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeStickerSet) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeStickerSet#cb82a523 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeStickerSet"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeStickerSet#cb82a523: %w", err) - } - case "stickers": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Sticker - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeStickerSet#cb82a523: field stickers: %w", err) - } - l.Stickers = append(l.Stickers, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeStickerSet#cb82a523: field stickers: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStickers returns value of Stickers field. -func (l *LinkPreviewTypeStickerSet) GetStickers() (value []Sticker) { - if l == nil { - return - } - return l.Stickers -} - -// LinkPreviewTypeStory represents TL type `linkPreviewTypeStory#1e9c87ce`. -type LinkPreviewTypeStory struct { - // The identifier of the chat that posted the story - StorySenderChatID int64 - // Story identifier - StoryID int32 -} - -// LinkPreviewTypeStoryTypeID is TL type id of LinkPreviewTypeStory. -const LinkPreviewTypeStoryTypeID = 0x1e9c87ce - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeStory) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeStory. -var ( - _ bin.Encoder = &LinkPreviewTypeStory{} - _ bin.Decoder = &LinkPreviewTypeStory{} - _ bin.BareEncoder = &LinkPreviewTypeStory{} - _ bin.BareDecoder = &LinkPreviewTypeStory{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeStory{} -) - -func (l *LinkPreviewTypeStory) Zero() bool { - if l == nil { - return true - } - if !(l.StorySenderChatID == 0) { - return false - } - if !(l.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeStory) String() string { - if l == nil { - return "LinkPreviewTypeStory(nil)" - } - type Alias LinkPreviewTypeStory - return fmt.Sprintf("LinkPreviewTypeStory%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeStory) TypeID() uint32 { - return LinkPreviewTypeStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeStory) TypeName() string { - return "linkPreviewTypeStory" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeStory", - ID: LinkPreviewTypeStoryTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeStory) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeStory#1e9c87ce as nil") - } - b.PutID(LinkPreviewTypeStoryTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeStory) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeStory#1e9c87ce as nil") - } - b.PutInt53(l.StorySenderChatID) - b.PutInt32(l.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeStory) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeStory#1e9c87ce to nil") - } - if err := b.ConsumeID(LinkPreviewTypeStoryTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeStory#1e9c87ce: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeStory) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeStory#1e9c87ce to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeStory#1e9c87ce: field story_sender_chat_id: %w", err) - } - l.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeStory#1e9c87ce: field story_id: %w", err) - } - l.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeStory#1e9c87ce as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeStory") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(l.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(l.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeStory#1e9c87ce to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeStory"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeStory#1e9c87ce: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeStory#1e9c87ce: field story_sender_chat_id: %w", err) - } - l.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeStory#1e9c87ce: field story_id: %w", err) - } - l.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (l *LinkPreviewTypeStory) GetStorySenderChatID() (value int64) { - if l == nil { - return - } - return l.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (l *LinkPreviewTypeStory) GetStoryID() (value int32) { - if l == nil { - return - } - return l.StoryID -} - -// LinkPreviewTypeSupergroupBoost represents TL type `linkPreviewTypeSupergroupBoost#90570476`. -type LinkPreviewTypeSupergroupBoost struct { - // Photo of the chat; may be null - Photo ChatPhoto -} - -// LinkPreviewTypeSupergroupBoostTypeID is TL type id of LinkPreviewTypeSupergroupBoost. -const LinkPreviewTypeSupergroupBoostTypeID = 0x90570476 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeSupergroupBoost) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeSupergroupBoost. -var ( - _ bin.Encoder = &LinkPreviewTypeSupergroupBoost{} - _ bin.Decoder = &LinkPreviewTypeSupergroupBoost{} - _ bin.BareEncoder = &LinkPreviewTypeSupergroupBoost{} - _ bin.BareDecoder = &LinkPreviewTypeSupergroupBoost{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeSupergroupBoost{} -) - -func (l *LinkPreviewTypeSupergroupBoost) Zero() bool { - if l == nil { - return true - } - if !(l.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeSupergroupBoost) String() string { - if l == nil { - return "LinkPreviewTypeSupergroupBoost(nil)" - } - type Alias LinkPreviewTypeSupergroupBoost - return fmt.Sprintf("LinkPreviewTypeSupergroupBoost%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeSupergroupBoost) TypeID() uint32 { - return LinkPreviewTypeSupergroupBoostTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeSupergroupBoost) TypeName() string { - return "linkPreviewTypeSupergroupBoost" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeSupergroupBoost) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeSupergroupBoost", - ID: LinkPreviewTypeSupergroupBoostTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeSupergroupBoost) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeSupergroupBoost#90570476 as nil") - } - b.PutID(LinkPreviewTypeSupergroupBoostTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeSupergroupBoost) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeSupergroupBoost#90570476 as nil") - } - if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeSupergroupBoost#90570476: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeSupergroupBoost) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeSupergroupBoost#90570476 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeSupergroupBoostTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeSupergroupBoost#90570476: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeSupergroupBoost) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeSupergroupBoost#90570476 to nil") - } - { - if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeSupergroupBoost#90570476: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeSupergroupBoost) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeSupergroupBoost#90570476 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeSupergroupBoost") - b.Comma() - b.FieldStart("photo") - if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeSupergroupBoost#90570476: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeSupergroupBoost) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeSupergroupBoost#90570476 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeSupergroupBoost"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeSupergroupBoost#90570476: %w", err) - } - case "photo": - if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeSupergroupBoost#90570476: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (l *LinkPreviewTypeSupergroupBoost) GetPhoto() (value ChatPhoto) { - if l == nil { - return - } - return l.Photo -} - -// LinkPreviewTypeTheme represents TL type `linkPreviewTypeTheme#6b7a9ba5`. -type LinkPreviewTypeTheme struct { - // The list of files with theme description - Documents []Document - // Settings for the cloud theme; may be null if unknown - Settings ThemeSettings -} - -// LinkPreviewTypeThemeTypeID is TL type id of LinkPreviewTypeTheme. -const LinkPreviewTypeThemeTypeID = 0x6b7a9ba5 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeTheme) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeTheme. -var ( - _ bin.Encoder = &LinkPreviewTypeTheme{} - _ bin.Decoder = &LinkPreviewTypeTheme{} - _ bin.BareEncoder = &LinkPreviewTypeTheme{} - _ bin.BareDecoder = &LinkPreviewTypeTheme{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeTheme{} -) - -func (l *LinkPreviewTypeTheme) Zero() bool { - if l == nil { - return true - } - if !(l.Documents == nil) { - return false - } - if !(l.Settings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeTheme) String() string { - if l == nil { - return "LinkPreviewTypeTheme(nil)" - } - type Alias LinkPreviewTypeTheme - return fmt.Sprintf("LinkPreviewTypeTheme%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeTheme) TypeID() uint32 { - return LinkPreviewTypeThemeTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeTheme) TypeName() string { - return "linkPreviewTypeTheme" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeTheme) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeTheme", - ID: LinkPreviewTypeThemeTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Documents", - SchemaName: "documents", - }, - { - Name: "Settings", - SchemaName: "settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeTheme) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeTheme#6b7a9ba5 as nil") - } - b.PutID(LinkPreviewTypeThemeTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeTheme) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeTheme#6b7a9ba5 as nil") - } - b.PutInt(len(l.Documents)) - for idx, v := range l.Documents { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare linkPreviewTypeTheme#6b7a9ba5: field documents element with index %d: %w", idx, err) - } - } - if err := l.Settings.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeTheme#6b7a9ba5: field settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeTheme) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeTheme#6b7a9ba5 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeThemeTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeTheme#6b7a9ba5: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeTheme) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeTheme#6b7a9ba5 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeTheme#6b7a9ba5: field documents: %w", err) - } - - if headerLen > 0 { - l.Documents = make([]Document, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Document - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare linkPreviewTypeTheme#6b7a9ba5: field documents: %w", err) - } - l.Documents = append(l.Documents, value) - } - } - { - if err := l.Settings.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeTheme#6b7a9ba5: field settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeTheme) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeTheme#6b7a9ba5 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeTheme") - b.Comma() - b.FieldStart("documents") - b.ArrStart() - for idx, v := range l.Documents { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeTheme#6b7a9ba5: field documents element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("settings") - if err := l.Settings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeTheme#6b7a9ba5: field settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeTheme) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeTheme#6b7a9ba5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeTheme"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeTheme#6b7a9ba5: %w", err) - } - case "documents": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Document - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeTheme#6b7a9ba5: field documents: %w", err) - } - l.Documents = append(l.Documents, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeTheme#6b7a9ba5: field documents: %w", err) - } - case "settings": - if err := l.Settings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeTheme#6b7a9ba5: field settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDocuments returns value of Documents field. -func (l *LinkPreviewTypeTheme) GetDocuments() (value []Document) { - if l == nil { - return - } - return l.Documents -} - -// GetSettings returns value of Settings field. -func (l *LinkPreviewTypeTheme) GetSettings() (value ThemeSettings) { - if l == nil { - return - } - return l.Settings -} - -// LinkPreviewTypeUnsupported represents TL type `linkPreviewTypeUnsupported#72b92cb9`. -type LinkPreviewTypeUnsupported struct { -} - -// LinkPreviewTypeUnsupportedTypeID is TL type id of LinkPreviewTypeUnsupported. -const LinkPreviewTypeUnsupportedTypeID = 0x72b92cb9 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeUnsupported) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeUnsupported. -var ( - _ bin.Encoder = &LinkPreviewTypeUnsupported{} - _ bin.Decoder = &LinkPreviewTypeUnsupported{} - _ bin.BareEncoder = &LinkPreviewTypeUnsupported{} - _ bin.BareDecoder = &LinkPreviewTypeUnsupported{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeUnsupported{} -) - -func (l *LinkPreviewTypeUnsupported) Zero() bool { - if l == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeUnsupported) String() string { - if l == nil { - return "LinkPreviewTypeUnsupported(nil)" - } - type Alias LinkPreviewTypeUnsupported - return fmt.Sprintf("LinkPreviewTypeUnsupported%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeUnsupported) TypeID() uint32 { - return LinkPreviewTypeUnsupportedTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeUnsupported) TypeName() string { - return "linkPreviewTypeUnsupported" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeUnsupported) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeUnsupported", - ID: LinkPreviewTypeUnsupportedTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeUnsupported) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeUnsupported#72b92cb9 as nil") - } - b.PutID(LinkPreviewTypeUnsupportedTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeUnsupported) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeUnsupported#72b92cb9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeUnsupported) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeUnsupported#72b92cb9 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeUnsupportedTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeUnsupported#72b92cb9: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeUnsupported) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeUnsupported#72b92cb9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeUnsupported) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeUnsupported#72b92cb9 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeUnsupported") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeUnsupported) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeUnsupported#72b92cb9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeUnsupported"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeUnsupported#72b92cb9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// LinkPreviewTypeUser represents TL type `linkPreviewTypeUser#a8ad817c`. -type LinkPreviewTypeUser struct { - // Photo of the user; may be null if none - Photo ChatPhoto - // True, if the user is a bot - IsBot bool -} - -// LinkPreviewTypeUserTypeID is TL type id of LinkPreviewTypeUser. -const LinkPreviewTypeUserTypeID = 0xa8ad817c - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeUser) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeUser. -var ( - _ bin.Encoder = &LinkPreviewTypeUser{} - _ bin.Decoder = &LinkPreviewTypeUser{} - _ bin.BareEncoder = &LinkPreviewTypeUser{} - _ bin.BareDecoder = &LinkPreviewTypeUser{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeUser{} -) - -func (l *LinkPreviewTypeUser) Zero() bool { - if l == nil { - return true - } - if !(l.Photo.Zero()) { - return false - } - if !(l.IsBot == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeUser) String() string { - if l == nil { - return "LinkPreviewTypeUser(nil)" - } - type Alias LinkPreviewTypeUser - return fmt.Sprintf("LinkPreviewTypeUser%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeUser) TypeID() uint32 { - return LinkPreviewTypeUserTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeUser) TypeName() string { - return "linkPreviewTypeUser" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeUser) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeUser", - ID: LinkPreviewTypeUserTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "IsBot", - SchemaName: "is_bot", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeUser) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeUser#a8ad817c as nil") - } - b.PutID(LinkPreviewTypeUserTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeUser) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeUser#a8ad817c as nil") - } - if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeUser#a8ad817c: field photo: %w", err) - } - b.PutBool(l.IsBot) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeUser) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeUser#a8ad817c to nil") - } - if err := b.ConsumeID(LinkPreviewTypeUserTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeUser#a8ad817c: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeUser) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeUser#a8ad817c to nil") - } - { - if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeUser#a8ad817c: field photo: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeUser#a8ad817c: field is_bot: %w", err) - } - l.IsBot = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeUser) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeUser#a8ad817c as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeUser") - b.Comma() - b.FieldStart("photo") - if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeUser#a8ad817c: field photo: %w", err) - } - b.Comma() - b.FieldStart("is_bot") - b.PutBool(l.IsBot) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeUser) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeUser#a8ad817c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeUser"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeUser#a8ad817c: %w", err) - } - case "photo": - if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeUser#a8ad817c: field photo: %w", err) - } - case "is_bot": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeUser#a8ad817c: field is_bot: %w", err) - } - l.IsBot = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (l *LinkPreviewTypeUser) GetPhoto() (value ChatPhoto) { - if l == nil { - return - } - return l.Photo -} - -// GetIsBot returns value of IsBot field. -func (l *LinkPreviewTypeUser) GetIsBot() (value bool) { - if l == nil { - return - } - return l.IsBot -} - -// LinkPreviewTypeVideo represents TL type `linkPreviewTypeVideo#10c9fc08`. -type LinkPreviewTypeVideo struct { - // The video description - Video Video -} - -// LinkPreviewTypeVideoTypeID is TL type id of LinkPreviewTypeVideo. -const LinkPreviewTypeVideoTypeID = 0x10c9fc08 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeVideo) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeVideo. -var ( - _ bin.Encoder = &LinkPreviewTypeVideo{} - _ bin.Decoder = &LinkPreviewTypeVideo{} - _ bin.BareEncoder = &LinkPreviewTypeVideo{} - _ bin.BareDecoder = &LinkPreviewTypeVideo{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeVideo{} -) - -func (l *LinkPreviewTypeVideo) Zero() bool { - if l == nil { - return true - } - if !(l.Video.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeVideo) String() string { - if l == nil { - return "LinkPreviewTypeVideo(nil)" - } - type Alias LinkPreviewTypeVideo - return fmt.Sprintf("LinkPreviewTypeVideo%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeVideo) TypeID() uint32 { - return LinkPreviewTypeVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeVideo) TypeName() string { - return "linkPreviewTypeVideo" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeVideo", - ID: LinkPreviewTypeVideoTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Video", - SchemaName: "video", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeVideo) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideo#10c9fc08 as nil") - } - b.PutID(LinkPreviewTypeVideoTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeVideo) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideo#10c9fc08 as nil") - } - if err := l.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeVideo#10c9fc08: field video: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeVideo) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideo#10c9fc08 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeVideoTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#10c9fc08: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeVideo) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideo#10c9fc08 to nil") - } - { - if err := l.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#10c9fc08: field video: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideo#10c9fc08 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeVideo") - b.Comma() - b.FieldStart("video") - if err := l.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeVideo#10c9fc08: field video: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideo#10c9fc08 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeVideo"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#10c9fc08: %w", err) - } - case "video": - if err := l.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideo#10c9fc08: field video: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetVideo returns value of Video field. -func (l *LinkPreviewTypeVideo) GetVideo() (value Video) { - if l == nil { - return - } - return l.Video -} - -// LinkPreviewTypeVideoChat represents TL type `linkPreviewTypeVideoChat#1908ee13`. -type LinkPreviewTypeVideoChat struct { - // Photo of the chat with the video chat; may be null if none - Photo ChatPhoto - // True, if the video chat is expected to be a live stream in a channel or a broadcast - // group - IsLiveStream bool -} - -// LinkPreviewTypeVideoChatTypeID is TL type id of LinkPreviewTypeVideoChat. -const LinkPreviewTypeVideoChatTypeID = 0x1908ee13 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeVideoChat) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeVideoChat. -var ( - _ bin.Encoder = &LinkPreviewTypeVideoChat{} - _ bin.Decoder = &LinkPreviewTypeVideoChat{} - _ bin.BareEncoder = &LinkPreviewTypeVideoChat{} - _ bin.BareDecoder = &LinkPreviewTypeVideoChat{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeVideoChat{} -) - -func (l *LinkPreviewTypeVideoChat) Zero() bool { - if l == nil { - return true - } - if !(l.Photo.Zero()) { - return false - } - if !(l.IsLiveStream == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeVideoChat) String() string { - if l == nil { - return "LinkPreviewTypeVideoChat(nil)" - } - type Alias LinkPreviewTypeVideoChat - return fmt.Sprintf("LinkPreviewTypeVideoChat%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeVideoChat) TypeID() uint32 { - return LinkPreviewTypeVideoChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeVideoChat) TypeName() string { - return "linkPreviewTypeVideoChat" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeVideoChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeVideoChat", - ID: LinkPreviewTypeVideoChatTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "IsLiveStream", - SchemaName: "is_live_stream", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeVideoChat) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideoChat#1908ee13 as nil") - } - b.PutID(LinkPreviewTypeVideoChatTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeVideoChat) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideoChat#1908ee13 as nil") - } - if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeVideoChat#1908ee13: field photo: %w", err) - } - b.PutBool(l.IsLiveStream) - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeVideoChat) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideoChat#1908ee13 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeVideoChatTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideoChat#1908ee13: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeVideoChat) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideoChat#1908ee13 to nil") - } - { - if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideoChat#1908ee13: field photo: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideoChat#1908ee13: field is_live_stream: %w", err) - } - l.IsLiveStream = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeVideoChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideoChat#1908ee13 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeVideoChat") - b.Comma() - b.FieldStart("photo") - if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeVideoChat#1908ee13: field photo: %w", err) - } - b.Comma() - b.FieldStart("is_live_stream") - b.PutBool(l.IsLiveStream) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeVideoChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideoChat#1908ee13 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeVideoChat"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideoChat#1908ee13: %w", err) - } - case "photo": - if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideoChat#1908ee13: field photo: %w", err) - } - case "is_live_stream": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideoChat#1908ee13: field is_live_stream: %w", err) - } - l.IsLiveStream = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (l *LinkPreviewTypeVideoChat) GetPhoto() (value ChatPhoto) { - if l == nil { - return - } - return l.Photo -} - -// GetIsLiveStream returns value of IsLiveStream field. -func (l *LinkPreviewTypeVideoChat) GetIsLiveStream() (value bool) { - if l == nil { - return - } - return l.IsLiveStream -} - -// LinkPreviewTypeVideoNote represents TL type `linkPreviewTypeVideoNote#cf70db61`. -type LinkPreviewTypeVideoNote struct { - // The video note - VideoNote VideoNote -} - -// LinkPreviewTypeVideoNoteTypeID is TL type id of LinkPreviewTypeVideoNote. -const LinkPreviewTypeVideoNoteTypeID = 0xcf70db61 - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeVideoNote) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeVideoNote. -var ( - _ bin.Encoder = &LinkPreviewTypeVideoNote{} - _ bin.Decoder = &LinkPreviewTypeVideoNote{} - _ bin.BareEncoder = &LinkPreviewTypeVideoNote{} - _ bin.BareDecoder = &LinkPreviewTypeVideoNote{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeVideoNote{} -) - -func (l *LinkPreviewTypeVideoNote) Zero() bool { - if l == nil { - return true - } - if !(l.VideoNote.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeVideoNote) String() string { - if l == nil { - return "LinkPreviewTypeVideoNote(nil)" - } - type Alias LinkPreviewTypeVideoNote - return fmt.Sprintf("LinkPreviewTypeVideoNote%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeVideoNote) TypeID() uint32 { - return LinkPreviewTypeVideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeVideoNote) TypeName() string { - return "linkPreviewTypeVideoNote" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeVideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeVideoNote", - ID: LinkPreviewTypeVideoNoteTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VideoNote", - SchemaName: "video_note", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeVideoNote) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideoNote#cf70db61 as nil") - } - b.PutID(LinkPreviewTypeVideoNoteTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeVideoNote) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideoNote#cf70db61 as nil") - } - if err := l.VideoNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeVideoNote#cf70db61: field video_note: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeVideoNote) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideoNote#cf70db61 to nil") - } - if err := b.ConsumeID(LinkPreviewTypeVideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideoNote#cf70db61: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeVideoNote) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideoNote#cf70db61 to nil") - } - { - if err := l.VideoNote.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideoNote#cf70db61: field video_note: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVideoNote#cf70db61 as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeVideoNote") - b.Comma() - b.FieldStart("video_note") - if err := l.VideoNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeVideoNote#cf70db61: field video_note: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVideoNote#cf70db61 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeVideoNote"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideoNote#cf70db61: %w", err) - } - case "video_note": - if err := l.VideoNote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVideoNote#cf70db61: field video_note: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetVideoNote returns value of VideoNote field. -func (l *LinkPreviewTypeVideoNote) GetVideoNote() (value VideoNote) { - if l == nil { - return - } - return l.VideoNote -} - -// LinkPreviewTypeVoiceNote represents TL type `linkPreviewTypeVoiceNote#d2d2cf2b`. -type LinkPreviewTypeVoiceNote struct { - // The voice note - VoiceNote VoiceNote -} - -// LinkPreviewTypeVoiceNoteTypeID is TL type id of LinkPreviewTypeVoiceNote. -const LinkPreviewTypeVoiceNoteTypeID = 0xd2d2cf2b - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeVoiceNote) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeVoiceNote. -var ( - _ bin.Encoder = &LinkPreviewTypeVoiceNote{} - _ bin.Decoder = &LinkPreviewTypeVoiceNote{} - _ bin.BareEncoder = &LinkPreviewTypeVoiceNote{} - _ bin.BareDecoder = &LinkPreviewTypeVoiceNote{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeVoiceNote{} -) - -func (l *LinkPreviewTypeVoiceNote) Zero() bool { - if l == nil { - return true - } - if !(l.VoiceNote.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeVoiceNote) String() string { - if l == nil { - return "LinkPreviewTypeVoiceNote(nil)" - } - type Alias LinkPreviewTypeVoiceNote - return fmt.Sprintf("LinkPreviewTypeVoiceNote%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeVoiceNote) TypeID() uint32 { - return LinkPreviewTypeVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeVoiceNote) TypeName() string { - return "linkPreviewTypeVoiceNote" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeVoiceNote", - ID: LinkPreviewTypeVoiceNoteTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VoiceNote", - SchemaName: "voice_note", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeVoiceNote) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVoiceNote#d2d2cf2b as nil") - } - b.PutID(LinkPreviewTypeVoiceNoteTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeVoiceNote) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVoiceNote#d2d2cf2b as nil") - } - if err := l.VoiceNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeVoiceNote#d2d2cf2b: field voice_note: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeVoiceNote) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVoiceNote#d2d2cf2b to nil") - } - if err := b.ConsumeID(LinkPreviewTypeVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVoiceNote#d2d2cf2b: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeVoiceNote) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVoiceNote#d2d2cf2b to nil") - } - { - if err := l.VoiceNote.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVoiceNote#d2d2cf2b: field voice_note: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeVoiceNote#d2d2cf2b as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeVoiceNote") - b.Comma() - b.FieldStart("voice_note") - if err := l.VoiceNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeVoiceNote#d2d2cf2b: field voice_note: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeVoiceNote#d2d2cf2b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeVoiceNote"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVoiceNote#d2d2cf2b: %w", err) - } - case "voice_note": - if err := l.VoiceNote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeVoiceNote#d2d2cf2b: field voice_note: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetVoiceNote returns value of VoiceNote field. -func (l *LinkPreviewTypeVoiceNote) GetVoiceNote() (value VoiceNote) { - if l == nil { - return - } - return l.VoiceNote -} - -// LinkPreviewTypeWebApp represents TL type `linkPreviewTypeWebApp#a62eef8a`. -type LinkPreviewTypeWebApp struct { - // Web App photo; may be null if none - Photo Photo -} - -// LinkPreviewTypeWebAppTypeID is TL type id of LinkPreviewTypeWebApp. -const LinkPreviewTypeWebAppTypeID = 0xa62eef8a - -// construct implements constructor of LinkPreviewTypeClass. -func (l LinkPreviewTypeWebApp) construct() LinkPreviewTypeClass { return &l } - -// Ensuring interfaces in compile-time for LinkPreviewTypeWebApp. -var ( - _ bin.Encoder = &LinkPreviewTypeWebApp{} - _ bin.Decoder = &LinkPreviewTypeWebApp{} - _ bin.BareEncoder = &LinkPreviewTypeWebApp{} - _ bin.BareDecoder = &LinkPreviewTypeWebApp{} - - _ LinkPreviewTypeClass = &LinkPreviewTypeWebApp{} -) - -func (l *LinkPreviewTypeWebApp) Zero() bool { - if l == nil { - return true - } - if !(l.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LinkPreviewTypeWebApp) String() string { - if l == nil { - return "LinkPreviewTypeWebApp(nil)" - } - type Alias LinkPreviewTypeWebApp - return fmt.Sprintf("LinkPreviewTypeWebApp%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LinkPreviewTypeWebApp) TypeID() uint32 { - return LinkPreviewTypeWebAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*LinkPreviewTypeWebApp) TypeName() string { - return "linkPreviewTypeWebApp" -} - -// TypeInfo returns info about TL type. -func (l *LinkPreviewTypeWebApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "linkPreviewTypeWebApp", - ID: LinkPreviewTypeWebAppTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LinkPreviewTypeWebApp) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeWebApp#a62eef8a as nil") - } - b.PutID(LinkPreviewTypeWebAppTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LinkPreviewTypeWebApp) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeWebApp#a62eef8a as nil") - } - if err := l.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeWebApp#a62eef8a: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LinkPreviewTypeWebApp) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeWebApp#a62eef8a to nil") - } - if err := b.ConsumeID(LinkPreviewTypeWebAppTypeID); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeWebApp#a62eef8a: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LinkPreviewTypeWebApp) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeWebApp#a62eef8a to nil") - } - { - if err := l.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeWebApp#a62eef8a: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LinkPreviewTypeWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode linkPreviewTypeWebApp#a62eef8a as nil") - } - b.ObjStart() - b.PutID("linkPreviewTypeWebApp") - b.Comma() - b.FieldStart("photo") - if err := l.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode linkPreviewTypeWebApp#a62eef8a: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LinkPreviewTypeWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode linkPreviewTypeWebApp#a62eef8a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("linkPreviewTypeWebApp"); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeWebApp#a62eef8a: %w", err) - } - case "photo": - if err := l.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode linkPreviewTypeWebApp#a62eef8a: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (l *LinkPreviewTypeWebApp) GetPhoto() (value Photo) { - if l == nil { - return - } - return l.Photo -} - -// LinkPreviewTypeClassName is schema name of LinkPreviewTypeClass. -const LinkPreviewTypeClassName = "LinkPreviewType" - -// LinkPreviewTypeClass represents LinkPreviewType generic type. -// -// Example: -// -// g, err := tdapi.DecodeLinkPreviewType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.LinkPreviewTypeAlbum: // linkPreviewTypeAlbum#186d97b4 -// case *tdapi.LinkPreviewTypeAnimation: // linkPreviewTypeAnimation#ad5cc534 -// case *tdapi.LinkPreviewTypeApp: // linkPreviewTypeApp#e3a68def -// case *tdapi.LinkPreviewTypeArticle: // linkPreviewTypeArticle#7cce9bd9 -// case *tdapi.LinkPreviewTypeAudio: // linkPreviewTypeAudio#75e407d2 -// case *tdapi.LinkPreviewTypeBackground: // linkPreviewTypeBackground#3a48a1e0 -// case *tdapi.LinkPreviewTypeChannelBoost: // linkPreviewTypeChannelBoost#c6f40456 -// case *tdapi.LinkPreviewTypeChat: // linkPreviewTypeChat#ae2fa122 -// case *tdapi.LinkPreviewTypeDocument: // linkPreviewTypeDocument#bf0169a2 -// case *tdapi.LinkPreviewTypeEmbeddedAnimationPlayer: // linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605 -// case *tdapi.LinkPreviewTypeEmbeddedAudioPlayer: // linkPreviewTypeEmbeddedAudioPlayer#220b429c -// case *tdapi.LinkPreviewTypeEmbeddedVideoPlayer: // linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03 -// case *tdapi.LinkPreviewTypeExternalAudio: // linkPreviewTypeExternalAudio#8a82ffed -// case *tdapi.LinkPreviewTypeExternalVideo: // linkPreviewTypeExternalVideo#517dcb98 -// case *tdapi.LinkPreviewTypeInvoice: // linkPreviewTypeInvoice#d47f48da -// case *tdapi.LinkPreviewTypeMessage: // linkPreviewTypeMessage#19f4c19e -// case *tdapi.LinkPreviewTypePhoto: // linkPreviewTypePhoto#aecfaaac -// case *tdapi.LinkPreviewTypePremiumGiftCode: // linkPreviewTypePremiumGiftCode#4e0d80b1 -// case *tdapi.LinkPreviewTypeShareableChatFolder: // linkPreviewTypeShareableChatFolder#805ab33c -// case *tdapi.LinkPreviewTypeSticker: // linkPreviewTypeSticker#245f4d25 -// case *tdapi.LinkPreviewTypeStickerSet: // linkPreviewTypeStickerSet#cb82a523 -// case *tdapi.LinkPreviewTypeStory: // linkPreviewTypeStory#1e9c87ce -// case *tdapi.LinkPreviewTypeSupergroupBoost: // linkPreviewTypeSupergroupBoost#90570476 -// case *tdapi.LinkPreviewTypeTheme: // linkPreviewTypeTheme#6b7a9ba5 -// case *tdapi.LinkPreviewTypeUnsupported: // linkPreviewTypeUnsupported#72b92cb9 -// case *tdapi.LinkPreviewTypeUser: // linkPreviewTypeUser#a8ad817c -// case *tdapi.LinkPreviewTypeVideo: // linkPreviewTypeVideo#10c9fc08 -// case *tdapi.LinkPreviewTypeVideoChat: // linkPreviewTypeVideoChat#1908ee13 -// case *tdapi.LinkPreviewTypeVideoNote: // linkPreviewTypeVideoNote#cf70db61 -// case *tdapi.LinkPreviewTypeVoiceNote: // linkPreviewTypeVoiceNote#d2d2cf2b -// case *tdapi.LinkPreviewTypeWebApp: // linkPreviewTypeWebApp#a62eef8a -// default: panic(v) -// } -type LinkPreviewTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() LinkPreviewTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeLinkPreviewType implements binary de-serialization for LinkPreviewTypeClass. -func DecodeLinkPreviewType(buf *bin.Buffer) (LinkPreviewTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case LinkPreviewTypeAlbumTypeID: - // Decoding linkPreviewTypeAlbum#186d97b4. - v := LinkPreviewTypeAlbum{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeAnimationTypeID: - // Decoding linkPreviewTypeAnimation#ad5cc534. - v := LinkPreviewTypeAnimation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeAppTypeID: - // Decoding linkPreviewTypeApp#e3a68def. - v := LinkPreviewTypeApp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeArticleTypeID: - // Decoding linkPreviewTypeArticle#7cce9bd9. - v := LinkPreviewTypeArticle{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeAudioTypeID: - // Decoding linkPreviewTypeAudio#75e407d2. - v := LinkPreviewTypeAudio{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeBackgroundTypeID: - // Decoding linkPreviewTypeBackground#3a48a1e0. - v := LinkPreviewTypeBackground{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeChannelBoostTypeID: - // Decoding linkPreviewTypeChannelBoost#c6f40456. - v := LinkPreviewTypeChannelBoost{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeChatTypeID: - // Decoding linkPreviewTypeChat#ae2fa122. - v := LinkPreviewTypeChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeDocumentTypeID: - // Decoding linkPreviewTypeDocument#bf0169a2. - v := LinkPreviewTypeDocument{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeEmbeddedAnimationPlayerTypeID: - // Decoding linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605. - v := LinkPreviewTypeEmbeddedAnimationPlayer{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeEmbeddedAudioPlayerTypeID: - // Decoding linkPreviewTypeEmbeddedAudioPlayer#220b429c. - v := LinkPreviewTypeEmbeddedAudioPlayer{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeEmbeddedVideoPlayerTypeID: - // Decoding linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03. - v := LinkPreviewTypeEmbeddedVideoPlayer{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeExternalAudioTypeID: - // Decoding linkPreviewTypeExternalAudio#8a82ffed. - v := LinkPreviewTypeExternalAudio{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeExternalVideoTypeID: - // Decoding linkPreviewTypeExternalVideo#517dcb98. - v := LinkPreviewTypeExternalVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeInvoiceTypeID: - // Decoding linkPreviewTypeInvoice#d47f48da. - v := LinkPreviewTypeInvoice{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeMessageTypeID: - // Decoding linkPreviewTypeMessage#19f4c19e. - v := LinkPreviewTypeMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypePhotoTypeID: - // Decoding linkPreviewTypePhoto#aecfaaac. - v := LinkPreviewTypePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypePremiumGiftCodeTypeID: - // Decoding linkPreviewTypePremiumGiftCode#4e0d80b1. - v := LinkPreviewTypePremiumGiftCode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeShareableChatFolderTypeID: - // Decoding linkPreviewTypeShareableChatFolder#805ab33c. - v := LinkPreviewTypeShareableChatFolder{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeStickerTypeID: - // Decoding linkPreviewTypeSticker#245f4d25. - v := LinkPreviewTypeSticker{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeStickerSetTypeID: - // Decoding linkPreviewTypeStickerSet#cb82a523. - v := LinkPreviewTypeStickerSet{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeStoryTypeID: - // Decoding linkPreviewTypeStory#1e9c87ce. - v := LinkPreviewTypeStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeSupergroupBoostTypeID: - // Decoding linkPreviewTypeSupergroupBoost#90570476. - v := LinkPreviewTypeSupergroupBoost{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeThemeTypeID: - // Decoding linkPreviewTypeTheme#6b7a9ba5. - v := LinkPreviewTypeTheme{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeUnsupportedTypeID: - // Decoding linkPreviewTypeUnsupported#72b92cb9. - v := LinkPreviewTypeUnsupported{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeUserTypeID: - // Decoding linkPreviewTypeUser#a8ad817c. - v := LinkPreviewTypeUser{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeVideoTypeID: - // Decoding linkPreviewTypeVideo#10c9fc08. - v := LinkPreviewTypeVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeVideoChatTypeID: - // Decoding linkPreviewTypeVideoChat#1908ee13. - v := LinkPreviewTypeVideoChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeVideoNoteTypeID: - // Decoding linkPreviewTypeVideoNote#cf70db61. - v := LinkPreviewTypeVideoNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeVoiceNoteTypeID: - // Decoding linkPreviewTypeVoiceNote#d2d2cf2b. - v := LinkPreviewTypeVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case LinkPreviewTypeWebAppTypeID: - // Decoding linkPreviewTypeWebApp#a62eef8a. - v := LinkPreviewTypeWebApp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONLinkPreviewType implements binary de-serialization for LinkPreviewTypeClass. -func DecodeTDLibJSONLinkPreviewType(buf tdjson.Decoder) (LinkPreviewTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "linkPreviewTypeAlbum": - // Decoding linkPreviewTypeAlbum#186d97b4. - v := LinkPreviewTypeAlbum{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeAnimation": - // Decoding linkPreviewTypeAnimation#ad5cc534. - v := LinkPreviewTypeAnimation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeApp": - // Decoding linkPreviewTypeApp#e3a68def. - v := LinkPreviewTypeApp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeArticle": - // Decoding linkPreviewTypeArticle#7cce9bd9. - v := LinkPreviewTypeArticle{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeAudio": - // Decoding linkPreviewTypeAudio#75e407d2. - v := LinkPreviewTypeAudio{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeBackground": - // Decoding linkPreviewTypeBackground#3a48a1e0. - v := LinkPreviewTypeBackground{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeChannelBoost": - // Decoding linkPreviewTypeChannelBoost#c6f40456. - v := LinkPreviewTypeChannelBoost{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeChat": - // Decoding linkPreviewTypeChat#ae2fa122. - v := LinkPreviewTypeChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeDocument": - // Decoding linkPreviewTypeDocument#bf0169a2. - v := LinkPreviewTypeDocument{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeEmbeddedAnimationPlayer": - // Decoding linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605. - v := LinkPreviewTypeEmbeddedAnimationPlayer{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeEmbeddedAudioPlayer": - // Decoding linkPreviewTypeEmbeddedAudioPlayer#220b429c. - v := LinkPreviewTypeEmbeddedAudioPlayer{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeEmbeddedVideoPlayer": - // Decoding linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03. - v := LinkPreviewTypeEmbeddedVideoPlayer{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeExternalAudio": - // Decoding linkPreviewTypeExternalAudio#8a82ffed. - v := LinkPreviewTypeExternalAudio{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeExternalVideo": - // Decoding linkPreviewTypeExternalVideo#517dcb98. - v := LinkPreviewTypeExternalVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeInvoice": - // Decoding linkPreviewTypeInvoice#d47f48da. - v := LinkPreviewTypeInvoice{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeMessage": - // Decoding linkPreviewTypeMessage#19f4c19e. - v := LinkPreviewTypeMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypePhoto": - // Decoding linkPreviewTypePhoto#aecfaaac. - v := LinkPreviewTypePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypePremiumGiftCode": - // Decoding linkPreviewTypePremiumGiftCode#4e0d80b1. - v := LinkPreviewTypePremiumGiftCode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeShareableChatFolder": - // Decoding linkPreviewTypeShareableChatFolder#805ab33c. - v := LinkPreviewTypeShareableChatFolder{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeSticker": - // Decoding linkPreviewTypeSticker#245f4d25. - v := LinkPreviewTypeSticker{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeStickerSet": - // Decoding linkPreviewTypeStickerSet#cb82a523. - v := LinkPreviewTypeStickerSet{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeStory": - // Decoding linkPreviewTypeStory#1e9c87ce. - v := LinkPreviewTypeStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeSupergroupBoost": - // Decoding linkPreviewTypeSupergroupBoost#90570476. - v := LinkPreviewTypeSupergroupBoost{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeTheme": - // Decoding linkPreviewTypeTheme#6b7a9ba5. - v := LinkPreviewTypeTheme{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeUnsupported": - // Decoding linkPreviewTypeUnsupported#72b92cb9. - v := LinkPreviewTypeUnsupported{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeUser": - // Decoding linkPreviewTypeUser#a8ad817c. - v := LinkPreviewTypeUser{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeVideo": - // Decoding linkPreviewTypeVideo#10c9fc08. - v := LinkPreviewTypeVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeVideoChat": - // Decoding linkPreviewTypeVideoChat#1908ee13. - v := LinkPreviewTypeVideoChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeVideoNote": - // Decoding linkPreviewTypeVideoNote#cf70db61. - v := LinkPreviewTypeVideoNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeVoiceNote": - // Decoding linkPreviewTypeVoiceNote#d2d2cf2b. - v := LinkPreviewTypeVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - case "linkPreviewTypeWebApp": - // Decoding linkPreviewTypeWebApp#a62eef8a. - v := LinkPreviewTypeWebApp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode LinkPreviewTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// LinkPreviewType boxes the LinkPreviewTypeClass providing a helper. -type LinkPreviewTypeBox struct { - LinkPreviewType LinkPreviewTypeClass -} - -// Decode implements bin.Decoder for LinkPreviewTypeBox. -func (b *LinkPreviewTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode LinkPreviewTypeBox to nil") - } - v, err := DecodeLinkPreviewType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.LinkPreviewType = v - return nil -} - -// Encode implements bin.Encode for LinkPreviewTypeBox. -func (b *LinkPreviewTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.LinkPreviewType == nil { - return fmt.Errorf("unable to encode LinkPreviewTypeClass as nil") - } - return b.LinkPreviewType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for LinkPreviewTypeBox. -func (b *LinkPreviewTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode LinkPreviewTypeBox to nil") - } - v, err := DecodeTDLibJSONLinkPreviewType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.LinkPreviewType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for LinkPreviewTypeBox. -func (b *LinkPreviewTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.LinkPreviewType == nil { - return fmt.Errorf("unable to encode LinkPreviewTypeClass as nil") - } - return b.LinkPreviewType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_load_active_stories_gen.go b/tdapi/tl_load_active_stories_gen.go deleted file mode 100644 index 369953b4e..000000000 --- a/tdapi/tl_load_active_stories_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LoadActiveStoriesRequest represents TL type `loadActiveStories#7d8cf738`. -type LoadActiveStoriesRequest struct { - // The story list in which to load active stories - StoryList StoryListClass -} - -// LoadActiveStoriesRequestTypeID is TL type id of LoadActiveStoriesRequest. -const LoadActiveStoriesRequestTypeID = 0x7d8cf738 - -// Ensuring interfaces in compile-time for LoadActiveStoriesRequest. -var ( - _ bin.Encoder = &LoadActiveStoriesRequest{} - _ bin.Decoder = &LoadActiveStoriesRequest{} - _ bin.BareEncoder = &LoadActiveStoriesRequest{} - _ bin.BareDecoder = &LoadActiveStoriesRequest{} -) - -func (l *LoadActiveStoriesRequest) Zero() bool { - if l == nil { - return true - } - if !(l.StoryList == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LoadActiveStoriesRequest) String() string { - if l == nil { - return "LoadActiveStoriesRequest(nil)" - } - type Alias LoadActiveStoriesRequest - return fmt.Sprintf("LoadActiveStoriesRequest%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LoadActiveStoriesRequest) TypeID() uint32 { - return LoadActiveStoriesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*LoadActiveStoriesRequest) TypeName() string { - return "loadActiveStories" -} - -// TypeInfo returns info about TL type. -func (l *LoadActiveStoriesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "loadActiveStories", - ID: LoadActiveStoriesRequestTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StoryList", - SchemaName: "story_list", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LoadActiveStoriesRequest) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadActiveStories#7d8cf738 as nil") - } - b.PutID(LoadActiveStoriesRequestTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LoadActiveStoriesRequest) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadActiveStories#7d8cf738 as nil") - } - if l.StoryList == nil { - return fmt.Errorf("unable to encode loadActiveStories#7d8cf738: field story_list is nil") - } - if err := l.StoryList.Encode(b); err != nil { - return fmt.Errorf("unable to encode loadActiveStories#7d8cf738: field story_list: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LoadActiveStoriesRequest) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadActiveStories#7d8cf738 to nil") - } - if err := b.ConsumeID(LoadActiveStoriesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode loadActiveStories#7d8cf738: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LoadActiveStoriesRequest) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadActiveStories#7d8cf738 to nil") - } - { - value, err := DecodeStoryList(b) - if err != nil { - return fmt.Errorf("unable to decode loadActiveStories#7d8cf738: field story_list: %w", err) - } - l.StoryList = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LoadActiveStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode loadActiveStories#7d8cf738 as nil") - } - b.ObjStart() - b.PutID("loadActiveStories") - b.Comma() - b.FieldStart("story_list") - if l.StoryList == nil { - return fmt.Errorf("unable to encode loadActiveStories#7d8cf738: field story_list is nil") - } - if err := l.StoryList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode loadActiveStories#7d8cf738: field story_list: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LoadActiveStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode loadActiveStories#7d8cf738 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("loadActiveStories"); err != nil { - return fmt.Errorf("unable to decode loadActiveStories#7d8cf738: %w", err) - } - case "story_list": - value, err := DecodeTDLibJSONStoryList(b) - if err != nil { - return fmt.Errorf("unable to decode loadActiveStories#7d8cf738: field story_list: %w", err) - } - l.StoryList = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStoryList returns value of StoryList field. -func (l *LoadActiveStoriesRequest) GetStoryList() (value StoryListClass) { - if l == nil { - return - } - return l.StoryList -} - -// LoadActiveStories invokes method loadActiveStories#7d8cf738 returning error if any. -func (c *Client) LoadActiveStories(ctx context.Context, storylist StoryListClass) error { - var ok Ok - - request := &LoadActiveStoriesRequest{ - StoryList: storylist, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_load_chats_gen.go b/tdapi/tl_load_chats_gen.go deleted file mode 100644 index ccb040695..000000000 --- a/tdapi/tl_load_chats_gen.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LoadChatsRequest represents TL type `loadChats#8f9b7d7b`. -type LoadChatsRequest struct { - // The chat list in which to load chats; pass null to load chats from the main chat list - ChatList ChatListClass - // The maximum number of chats to be loaded. For optimal performance, the number of - // loaded chats is chosen by TDLib and can be smaller than the specified limit, even if - // the end of the list is not reached - Limit int32 -} - -// LoadChatsRequestTypeID is TL type id of LoadChatsRequest. -const LoadChatsRequestTypeID = 0x8f9b7d7b - -// Ensuring interfaces in compile-time for LoadChatsRequest. -var ( - _ bin.Encoder = &LoadChatsRequest{} - _ bin.Decoder = &LoadChatsRequest{} - _ bin.BareEncoder = &LoadChatsRequest{} - _ bin.BareDecoder = &LoadChatsRequest{} -) - -func (l *LoadChatsRequest) Zero() bool { - if l == nil { - return true - } - if !(l.ChatList == nil) { - return false - } - if !(l.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LoadChatsRequest) String() string { - if l == nil { - return "LoadChatsRequest(nil)" - } - type Alias LoadChatsRequest - return fmt.Sprintf("LoadChatsRequest%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LoadChatsRequest) TypeID() uint32 { - return LoadChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*LoadChatsRequest) TypeName() string { - return "loadChats" -} - -// TypeInfo returns info about TL type. -func (l *LoadChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "loadChats", - ID: LoadChatsRequestTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatList", - SchemaName: "chat_list", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LoadChatsRequest) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadChats#8f9b7d7b as nil") - } - b.PutID(LoadChatsRequestTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LoadChatsRequest) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadChats#8f9b7d7b as nil") - } - if l.ChatList == nil { - return fmt.Errorf("unable to encode loadChats#8f9b7d7b: field chat_list is nil") - } - if err := l.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode loadChats#8f9b7d7b: field chat_list: %w", err) - } - b.PutInt32(l.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (l *LoadChatsRequest) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadChats#8f9b7d7b to nil") - } - if err := b.ConsumeID(LoadChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode loadChats#8f9b7d7b: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LoadChatsRequest) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadChats#8f9b7d7b to nil") - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode loadChats#8f9b7d7b: field chat_list: %w", err) - } - l.ChatList = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode loadChats#8f9b7d7b: field limit: %w", err) - } - l.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LoadChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode loadChats#8f9b7d7b as nil") - } - b.ObjStart() - b.PutID("loadChats") - b.Comma() - b.FieldStart("chat_list") - if l.ChatList == nil { - return fmt.Errorf("unable to encode loadChats#8f9b7d7b: field chat_list is nil") - } - if err := l.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode loadChats#8f9b7d7b: field chat_list: %w", err) - } - b.Comma() - b.FieldStart("limit") - b.PutInt32(l.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LoadChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode loadChats#8f9b7d7b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("loadChats"); err != nil { - return fmt.Errorf("unable to decode loadChats#8f9b7d7b: %w", err) - } - case "chat_list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode loadChats#8f9b7d7b: field chat_list: %w", err) - } - l.ChatList = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode loadChats#8f9b7d7b: field limit: %w", err) - } - l.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatList returns value of ChatList field. -func (l *LoadChatsRequest) GetChatList() (value ChatListClass) { - if l == nil { - return - } - return l.ChatList -} - -// GetLimit returns value of Limit field. -func (l *LoadChatsRequest) GetLimit() (value int32) { - if l == nil { - return - } - return l.Limit -} - -// LoadChats invokes method loadChats#8f9b7d7b returning error if any. -func (c *Client) LoadChats(ctx context.Context, request *LoadChatsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_load_group_call_participants_gen.go b/tdapi/tl_load_group_call_participants_gen.go deleted file mode 100644 index 175e8a5b2..000000000 --- a/tdapi/tl_load_group_call_participants_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LoadGroupCallParticipantsRequest represents TL type `loadGroupCallParticipants#37f3bece`. -type LoadGroupCallParticipantsRequest struct { - // Group call identifier. The group call must be previously received through getGroupCall - // and must be joined or being joined - GroupCallID int32 - // The maximum number of participants to load; up to 100 - Limit int32 -} - -// LoadGroupCallParticipantsRequestTypeID is TL type id of LoadGroupCallParticipantsRequest. -const LoadGroupCallParticipantsRequestTypeID = 0x37f3bece - -// Ensuring interfaces in compile-time for LoadGroupCallParticipantsRequest. -var ( - _ bin.Encoder = &LoadGroupCallParticipantsRequest{} - _ bin.Decoder = &LoadGroupCallParticipantsRequest{} - _ bin.BareEncoder = &LoadGroupCallParticipantsRequest{} - _ bin.BareDecoder = &LoadGroupCallParticipantsRequest{} -) - -func (l *LoadGroupCallParticipantsRequest) Zero() bool { - if l == nil { - return true - } - if !(l.GroupCallID == 0) { - return false - } - if !(l.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LoadGroupCallParticipantsRequest) String() string { - if l == nil { - return "LoadGroupCallParticipantsRequest(nil)" - } - type Alias LoadGroupCallParticipantsRequest - return fmt.Sprintf("LoadGroupCallParticipantsRequest%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LoadGroupCallParticipantsRequest) TypeID() uint32 { - return LoadGroupCallParticipantsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*LoadGroupCallParticipantsRequest) TypeName() string { - return "loadGroupCallParticipants" -} - -// TypeInfo returns info about TL type. -func (l *LoadGroupCallParticipantsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "loadGroupCallParticipants", - ID: LoadGroupCallParticipantsRequestTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LoadGroupCallParticipantsRequest) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadGroupCallParticipants#37f3bece as nil") - } - b.PutID(LoadGroupCallParticipantsRequestTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LoadGroupCallParticipantsRequest) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadGroupCallParticipants#37f3bece as nil") - } - b.PutInt32(l.GroupCallID) - b.PutInt32(l.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (l *LoadGroupCallParticipantsRequest) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadGroupCallParticipants#37f3bece to nil") - } - if err := b.ConsumeID(LoadGroupCallParticipantsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode loadGroupCallParticipants#37f3bece: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LoadGroupCallParticipantsRequest) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadGroupCallParticipants#37f3bece to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode loadGroupCallParticipants#37f3bece: field group_call_id: %w", err) - } - l.GroupCallID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode loadGroupCallParticipants#37f3bece: field limit: %w", err) - } - l.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LoadGroupCallParticipantsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode loadGroupCallParticipants#37f3bece as nil") - } - b.ObjStart() - b.PutID("loadGroupCallParticipants") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(l.GroupCallID) - b.Comma() - b.FieldStart("limit") - b.PutInt32(l.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LoadGroupCallParticipantsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode loadGroupCallParticipants#37f3bece to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("loadGroupCallParticipants"); err != nil { - return fmt.Errorf("unable to decode loadGroupCallParticipants#37f3bece: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode loadGroupCallParticipants#37f3bece: field group_call_id: %w", err) - } - l.GroupCallID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode loadGroupCallParticipants#37f3bece: field limit: %w", err) - } - l.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (l *LoadGroupCallParticipantsRequest) GetGroupCallID() (value int32) { - if l == nil { - return - } - return l.GroupCallID -} - -// GetLimit returns value of Limit field. -func (l *LoadGroupCallParticipantsRequest) GetLimit() (value int32) { - if l == nil { - return - } - return l.Limit -} - -// LoadGroupCallParticipants invokes method loadGroupCallParticipants#37f3bece returning error if any. -func (c *Client) LoadGroupCallParticipants(ctx context.Context, request *LoadGroupCallParticipantsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_load_quick_reply_shortcut_messages_gen.go b/tdapi/tl_load_quick_reply_shortcut_messages_gen.go deleted file mode 100644 index 2a61a12cf..000000000 --- a/tdapi/tl_load_quick_reply_shortcut_messages_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LoadQuickReplyShortcutMessagesRequest represents TL type `loadQuickReplyShortcutMessages#fd40aed4`. -type LoadQuickReplyShortcutMessagesRequest struct { - // Unique identifier of the quick reply shortcut - ShortcutID int32 -} - -// LoadQuickReplyShortcutMessagesRequestTypeID is TL type id of LoadQuickReplyShortcutMessagesRequest. -const LoadQuickReplyShortcutMessagesRequestTypeID = 0xfd40aed4 - -// Ensuring interfaces in compile-time for LoadQuickReplyShortcutMessagesRequest. -var ( - _ bin.Encoder = &LoadQuickReplyShortcutMessagesRequest{} - _ bin.Decoder = &LoadQuickReplyShortcutMessagesRequest{} - _ bin.BareEncoder = &LoadQuickReplyShortcutMessagesRequest{} - _ bin.BareDecoder = &LoadQuickReplyShortcutMessagesRequest{} -) - -func (l *LoadQuickReplyShortcutMessagesRequest) Zero() bool { - if l == nil { - return true - } - if !(l.ShortcutID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LoadQuickReplyShortcutMessagesRequest) String() string { - if l == nil { - return "LoadQuickReplyShortcutMessagesRequest(nil)" - } - type Alias LoadQuickReplyShortcutMessagesRequest - return fmt.Sprintf("LoadQuickReplyShortcutMessagesRequest%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LoadQuickReplyShortcutMessagesRequest) TypeID() uint32 { - return LoadQuickReplyShortcutMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*LoadQuickReplyShortcutMessagesRequest) TypeName() string { - return "loadQuickReplyShortcutMessages" -} - -// TypeInfo returns info about TL type. -func (l *LoadQuickReplyShortcutMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "loadQuickReplyShortcutMessages", - ID: LoadQuickReplyShortcutMessagesRequestTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutID", - SchemaName: "shortcut_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LoadQuickReplyShortcutMessagesRequest) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadQuickReplyShortcutMessages#fd40aed4 as nil") - } - b.PutID(LoadQuickReplyShortcutMessagesRequestTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LoadQuickReplyShortcutMessagesRequest) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadQuickReplyShortcutMessages#fd40aed4 as nil") - } - b.PutInt32(l.ShortcutID) - return nil -} - -// Decode implements bin.Decoder. -func (l *LoadQuickReplyShortcutMessagesRequest) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadQuickReplyShortcutMessages#fd40aed4 to nil") - } - if err := b.ConsumeID(LoadQuickReplyShortcutMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode loadQuickReplyShortcutMessages#fd40aed4: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LoadQuickReplyShortcutMessagesRequest) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadQuickReplyShortcutMessages#fd40aed4 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode loadQuickReplyShortcutMessages#fd40aed4: field shortcut_id: %w", err) - } - l.ShortcutID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LoadQuickReplyShortcutMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode loadQuickReplyShortcutMessages#fd40aed4 as nil") - } - b.ObjStart() - b.PutID("loadQuickReplyShortcutMessages") - b.Comma() - b.FieldStart("shortcut_id") - b.PutInt32(l.ShortcutID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LoadQuickReplyShortcutMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode loadQuickReplyShortcutMessages#fd40aed4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("loadQuickReplyShortcutMessages"); err != nil { - return fmt.Errorf("unable to decode loadQuickReplyShortcutMessages#fd40aed4: %w", err) - } - case "shortcut_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode loadQuickReplyShortcutMessages#fd40aed4: field shortcut_id: %w", err) - } - l.ShortcutID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutID returns value of ShortcutID field. -func (l *LoadQuickReplyShortcutMessagesRequest) GetShortcutID() (value int32) { - if l == nil { - return - } - return l.ShortcutID -} - -// LoadQuickReplyShortcutMessages invokes method loadQuickReplyShortcutMessages#fd40aed4 returning error if any. -func (c *Client) LoadQuickReplyShortcutMessages(ctx context.Context, shortcutid int32) error { - var ok Ok - - request := &LoadQuickReplyShortcutMessagesRequest{ - ShortcutID: shortcutid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_load_quick_reply_shortcuts_gen.go b/tdapi/tl_load_quick_reply_shortcuts_gen.go deleted file mode 100644 index 231de0cea..000000000 --- a/tdapi/tl_load_quick_reply_shortcuts_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LoadQuickReplyShortcutsRequest represents TL type `loadQuickReplyShortcuts#c367b29d`. -type LoadQuickReplyShortcutsRequest struct { -} - -// LoadQuickReplyShortcutsRequestTypeID is TL type id of LoadQuickReplyShortcutsRequest. -const LoadQuickReplyShortcutsRequestTypeID = 0xc367b29d - -// Ensuring interfaces in compile-time for LoadQuickReplyShortcutsRequest. -var ( - _ bin.Encoder = &LoadQuickReplyShortcutsRequest{} - _ bin.Decoder = &LoadQuickReplyShortcutsRequest{} - _ bin.BareEncoder = &LoadQuickReplyShortcutsRequest{} - _ bin.BareDecoder = &LoadQuickReplyShortcutsRequest{} -) - -func (l *LoadQuickReplyShortcutsRequest) Zero() bool { - if l == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (l *LoadQuickReplyShortcutsRequest) String() string { - if l == nil { - return "LoadQuickReplyShortcutsRequest(nil)" - } - type Alias LoadQuickReplyShortcutsRequest - return fmt.Sprintf("LoadQuickReplyShortcutsRequest%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LoadQuickReplyShortcutsRequest) TypeID() uint32 { - return LoadQuickReplyShortcutsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*LoadQuickReplyShortcutsRequest) TypeName() string { - return "loadQuickReplyShortcuts" -} - -// TypeInfo returns info about TL type. -func (l *LoadQuickReplyShortcutsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "loadQuickReplyShortcuts", - ID: LoadQuickReplyShortcutsRequestTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (l *LoadQuickReplyShortcutsRequest) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadQuickReplyShortcuts#c367b29d as nil") - } - b.PutID(LoadQuickReplyShortcutsRequestTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LoadQuickReplyShortcutsRequest) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadQuickReplyShortcuts#c367b29d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LoadQuickReplyShortcutsRequest) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadQuickReplyShortcuts#c367b29d to nil") - } - if err := b.ConsumeID(LoadQuickReplyShortcutsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode loadQuickReplyShortcuts#c367b29d: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LoadQuickReplyShortcutsRequest) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadQuickReplyShortcuts#c367b29d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LoadQuickReplyShortcutsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode loadQuickReplyShortcuts#c367b29d as nil") - } - b.ObjStart() - b.PutID("loadQuickReplyShortcuts") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LoadQuickReplyShortcutsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode loadQuickReplyShortcuts#c367b29d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("loadQuickReplyShortcuts"); err != nil { - return fmt.Errorf("unable to decode loadQuickReplyShortcuts#c367b29d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// LoadQuickReplyShortcuts invokes method loadQuickReplyShortcuts#c367b29d returning error if any. -func (c *Client) LoadQuickReplyShortcuts(ctx context.Context) error { - var ok Ok - - request := &LoadQuickReplyShortcutsRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_load_saved_messages_topics_gen.go b/tdapi/tl_load_saved_messages_topics_gen.go deleted file mode 100644 index 245e3fd61..000000000 --- a/tdapi/tl_load_saved_messages_topics_gen.go +++ /dev/null @@ -1,208 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LoadSavedMessagesTopicsRequest represents TL type `loadSavedMessagesTopics#1146d6b8`. -type LoadSavedMessagesTopicsRequest struct { - // The maximum number of topics to be loaded. For optimal performance, the number of - // loaded topics is chosen by TDLib and can be smaller than the specified limit, even if - // the end of the list is not reached - Limit int32 -} - -// LoadSavedMessagesTopicsRequestTypeID is TL type id of LoadSavedMessagesTopicsRequest. -const LoadSavedMessagesTopicsRequestTypeID = 0x1146d6b8 - -// Ensuring interfaces in compile-time for LoadSavedMessagesTopicsRequest. -var ( - _ bin.Encoder = &LoadSavedMessagesTopicsRequest{} - _ bin.Decoder = &LoadSavedMessagesTopicsRequest{} - _ bin.BareEncoder = &LoadSavedMessagesTopicsRequest{} - _ bin.BareDecoder = &LoadSavedMessagesTopicsRequest{} -) - -func (l *LoadSavedMessagesTopicsRequest) Zero() bool { - if l == nil { - return true - } - if !(l.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LoadSavedMessagesTopicsRequest) String() string { - if l == nil { - return "LoadSavedMessagesTopicsRequest(nil)" - } - type Alias LoadSavedMessagesTopicsRequest - return fmt.Sprintf("LoadSavedMessagesTopicsRequest%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LoadSavedMessagesTopicsRequest) TypeID() uint32 { - return LoadSavedMessagesTopicsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*LoadSavedMessagesTopicsRequest) TypeName() string { - return "loadSavedMessagesTopics" -} - -// TypeInfo returns info about TL type. -func (l *LoadSavedMessagesTopicsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "loadSavedMessagesTopics", - ID: LoadSavedMessagesTopicsRequestTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LoadSavedMessagesTopicsRequest) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadSavedMessagesTopics#1146d6b8 as nil") - } - b.PutID(LoadSavedMessagesTopicsRequestTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LoadSavedMessagesTopicsRequest) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loadSavedMessagesTopics#1146d6b8 as nil") - } - b.PutInt32(l.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (l *LoadSavedMessagesTopicsRequest) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadSavedMessagesTopics#1146d6b8 to nil") - } - if err := b.ConsumeID(LoadSavedMessagesTopicsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode loadSavedMessagesTopics#1146d6b8: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LoadSavedMessagesTopicsRequest) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loadSavedMessagesTopics#1146d6b8 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode loadSavedMessagesTopics#1146d6b8: field limit: %w", err) - } - l.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LoadSavedMessagesTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode loadSavedMessagesTopics#1146d6b8 as nil") - } - b.ObjStart() - b.PutID("loadSavedMessagesTopics") - b.Comma() - b.FieldStart("limit") - b.PutInt32(l.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LoadSavedMessagesTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode loadSavedMessagesTopics#1146d6b8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("loadSavedMessagesTopics"); err != nil { - return fmt.Errorf("unable to decode loadSavedMessagesTopics#1146d6b8: %w", err) - } - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode loadSavedMessagesTopics#1146d6b8: field limit: %w", err) - } - l.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLimit returns value of Limit field. -func (l *LoadSavedMessagesTopicsRequest) GetLimit() (value int32) { - if l == nil { - return - } - return l.Limit -} - -// LoadSavedMessagesTopics invokes method loadSavedMessagesTopics#1146d6b8 returning error if any. -func (c *Client) LoadSavedMessagesTopics(ctx context.Context, limit int32) error { - var ok Ok - - request := &LoadSavedMessagesTopicsRequest{ - Limit: limit, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_local_file_gen.go b/tdapi/tl_local_file_gen.go deleted file mode 100644 index 42f197ae7..000000000 --- a/tdapi/tl_local_file_gen.go +++ /dev/null @@ -1,436 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LocalFile represents TL type `localFile#a2da9987`. -type LocalFile struct { - // Local path to the locally available file part; may be empty - Path string - // True, if it is possible to download or generate the file - CanBeDownloaded bool - // True, if the file can be deleted - CanBeDeleted bool - // True, if the file is currently being downloaded (or a local copy is being generated by - // some other means) - IsDownloadingActive bool - // True, if the local copy is fully available - IsDownloadingCompleted bool - // Download will be started from this offset. downloaded_prefix_size is calculated from - // this offset - DownloadOffset int64 - // If is_downloading_completed is false, then only some prefix of the file starting from - // download_offset is ready to be read. downloaded_prefix_size is the size of that prefix - // in bytes - DownloadedPrefixSize int64 - // Total downloaded file size, in bytes. Can be used only for calculating download - // progress. The actual file size may be bigger, and some parts of it may contain garbage - DownloadedSize int64 -} - -// LocalFileTypeID is TL type id of LocalFile. -const LocalFileTypeID = 0xa2da9987 - -// Ensuring interfaces in compile-time for LocalFile. -var ( - _ bin.Encoder = &LocalFile{} - _ bin.Decoder = &LocalFile{} - _ bin.BareEncoder = &LocalFile{} - _ bin.BareDecoder = &LocalFile{} -) - -func (l *LocalFile) Zero() bool { - if l == nil { - return true - } - if !(l.Path == "") { - return false - } - if !(l.CanBeDownloaded == false) { - return false - } - if !(l.CanBeDeleted == false) { - return false - } - if !(l.IsDownloadingActive == false) { - return false - } - if !(l.IsDownloadingCompleted == false) { - return false - } - if !(l.DownloadOffset == 0) { - return false - } - if !(l.DownloadedPrefixSize == 0) { - return false - } - if !(l.DownloadedSize == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LocalFile) String() string { - if l == nil { - return "LocalFile(nil)" - } - type Alias LocalFile - return fmt.Sprintf("LocalFile%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LocalFile) TypeID() uint32 { - return LocalFileTypeID -} - -// TypeName returns name of type in TL schema. -func (*LocalFile) TypeName() string { - return "localFile" -} - -// TypeInfo returns info about TL type. -func (l *LocalFile) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "localFile", - ID: LocalFileTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Path", - SchemaName: "path", - }, - { - Name: "CanBeDownloaded", - SchemaName: "can_be_downloaded", - }, - { - Name: "CanBeDeleted", - SchemaName: "can_be_deleted", - }, - { - Name: "IsDownloadingActive", - SchemaName: "is_downloading_active", - }, - { - Name: "IsDownloadingCompleted", - SchemaName: "is_downloading_completed", - }, - { - Name: "DownloadOffset", - SchemaName: "download_offset", - }, - { - Name: "DownloadedPrefixSize", - SchemaName: "downloaded_prefix_size", - }, - { - Name: "DownloadedSize", - SchemaName: "downloaded_size", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LocalFile) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode localFile#a2da9987 as nil") - } - b.PutID(LocalFileTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LocalFile) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode localFile#a2da9987 as nil") - } - b.PutString(l.Path) - b.PutBool(l.CanBeDownloaded) - b.PutBool(l.CanBeDeleted) - b.PutBool(l.IsDownloadingActive) - b.PutBool(l.IsDownloadingCompleted) - b.PutInt53(l.DownloadOffset) - b.PutInt53(l.DownloadedPrefixSize) - b.PutInt53(l.DownloadedSize) - return nil -} - -// Decode implements bin.Decoder. -func (l *LocalFile) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode localFile#a2da9987 to nil") - } - if err := b.ConsumeID(LocalFileTypeID); err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LocalFile) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode localFile#a2da9987 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field path: %w", err) - } - l.Path = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field can_be_downloaded: %w", err) - } - l.CanBeDownloaded = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field can_be_deleted: %w", err) - } - l.CanBeDeleted = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field is_downloading_active: %w", err) - } - l.IsDownloadingActive = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field is_downloading_completed: %w", err) - } - l.IsDownloadingCompleted = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field download_offset: %w", err) - } - l.DownloadOffset = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field downloaded_prefix_size: %w", err) - } - l.DownloadedPrefixSize = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field downloaded_size: %w", err) - } - l.DownloadedSize = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LocalFile) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode localFile#a2da9987 as nil") - } - b.ObjStart() - b.PutID("localFile") - b.Comma() - b.FieldStart("path") - b.PutString(l.Path) - b.Comma() - b.FieldStart("can_be_downloaded") - b.PutBool(l.CanBeDownloaded) - b.Comma() - b.FieldStart("can_be_deleted") - b.PutBool(l.CanBeDeleted) - b.Comma() - b.FieldStart("is_downloading_active") - b.PutBool(l.IsDownloadingActive) - b.Comma() - b.FieldStart("is_downloading_completed") - b.PutBool(l.IsDownloadingCompleted) - b.Comma() - b.FieldStart("download_offset") - b.PutInt53(l.DownloadOffset) - b.Comma() - b.FieldStart("downloaded_prefix_size") - b.PutInt53(l.DownloadedPrefixSize) - b.Comma() - b.FieldStart("downloaded_size") - b.PutInt53(l.DownloadedSize) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LocalFile) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode localFile#a2da9987 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("localFile"); err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: %w", err) - } - case "path": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field path: %w", err) - } - l.Path = value - case "can_be_downloaded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field can_be_downloaded: %w", err) - } - l.CanBeDownloaded = value - case "can_be_deleted": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field can_be_deleted: %w", err) - } - l.CanBeDeleted = value - case "is_downloading_active": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field is_downloading_active: %w", err) - } - l.IsDownloadingActive = value - case "is_downloading_completed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field is_downloading_completed: %w", err) - } - l.IsDownloadingCompleted = value - case "download_offset": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field download_offset: %w", err) - } - l.DownloadOffset = value - case "downloaded_prefix_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field downloaded_prefix_size: %w", err) - } - l.DownloadedPrefixSize = value - case "downloaded_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode localFile#a2da9987: field downloaded_size: %w", err) - } - l.DownloadedSize = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPath returns value of Path field. -func (l *LocalFile) GetPath() (value string) { - if l == nil { - return - } - return l.Path -} - -// GetCanBeDownloaded returns value of CanBeDownloaded field. -func (l *LocalFile) GetCanBeDownloaded() (value bool) { - if l == nil { - return - } - return l.CanBeDownloaded -} - -// GetCanBeDeleted returns value of CanBeDeleted field. -func (l *LocalFile) GetCanBeDeleted() (value bool) { - if l == nil { - return - } - return l.CanBeDeleted -} - -// GetIsDownloadingActive returns value of IsDownloadingActive field. -func (l *LocalFile) GetIsDownloadingActive() (value bool) { - if l == nil { - return - } - return l.IsDownloadingActive -} - -// GetIsDownloadingCompleted returns value of IsDownloadingCompleted field. -func (l *LocalFile) GetIsDownloadingCompleted() (value bool) { - if l == nil { - return - } - return l.IsDownloadingCompleted -} - -// GetDownloadOffset returns value of DownloadOffset field. -func (l *LocalFile) GetDownloadOffset() (value int64) { - if l == nil { - return - } - return l.DownloadOffset -} - -// GetDownloadedPrefixSize returns value of DownloadedPrefixSize field. -func (l *LocalFile) GetDownloadedPrefixSize() (value int64) { - if l == nil { - return - } - return l.DownloadedPrefixSize -} - -// GetDownloadedSize returns value of DownloadedSize field. -func (l *LocalFile) GetDownloadedSize() (value int64) { - if l == nil { - return - } - return l.DownloadedSize -} diff --git a/tdapi/tl_localization_target_info_gen.go b/tdapi/tl_localization_target_info_gen.go deleted file mode 100644 index 38b155859..000000000 --- a/tdapi/tl_localization_target_info_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LocalizationTargetInfo represents TL type `localizationTargetInfo#2ca3903b`. -type LocalizationTargetInfo struct { - // List of available language packs for this application - LanguagePacks []LanguagePackInfo -} - -// LocalizationTargetInfoTypeID is TL type id of LocalizationTargetInfo. -const LocalizationTargetInfoTypeID = 0x2ca3903b - -// Ensuring interfaces in compile-time for LocalizationTargetInfo. -var ( - _ bin.Encoder = &LocalizationTargetInfo{} - _ bin.Decoder = &LocalizationTargetInfo{} - _ bin.BareEncoder = &LocalizationTargetInfo{} - _ bin.BareDecoder = &LocalizationTargetInfo{} -) - -func (l *LocalizationTargetInfo) Zero() bool { - if l == nil { - return true - } - if !(l.LanguagePacks == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LocalizationTargetInfo) String() string { - if l == nil { - return "LocalizationTargetInfo(nil)" - } - type Alias LocalizationTargetInfo - return fmt.Sprintf("LocalizationTargetInfo%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LocalizationTargetInfo) TypeID() uint32 { - return LocalizationTargetInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*LocalizationTargetInfo) TypeName() string { - return "localizationTargetInfo" -} - -// TypeInfo returns info about TL type. -func (l *LocalizationTargetInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "localizationTargetInfo", - ID: LocalizationTargetInfoTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LanguagePacks", - SchemaName: "language_packs", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LocalizationTargetInfo) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode localizationTargetInfo#2ca3903b as nil") - } - b.PutID(LocalizationTargetInfoTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LocalizationTargetInfo) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode localizationTargetInfo#2ca3903b as nil") - } - b.PutInt(len(l.LanguagePacks)) - for idx, v := range l.LanguagePacks { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare localizationTargetInfo#2ca3903b: field language_packs element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LocalizationTargetInfo) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode localizationTargetInfo#2ca3903b to nil") - } - if err := b.ConsumeID(LocalizationTargetInfoTypeID); err != nil { - return fmt.Errorf("unable to decode localizationTargetInfo#2ca3903b: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LocalizationTargetInfo) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode localizationTargetInfo#2ca3903b to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode localizationTargetInfo#2ca3903b: field language_packs: %w", err) - } - - if headerLen > 0 { - l.LanguagePacks = make([]LanguagePackInfo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value LanguagePackInfo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare localizationTargetInfo#2ca3903b: field language_packs: %w", err) - } - l.LanguagePacks = append(l.LanguagePacks, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LocalizationTargetInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode localizationTargetInfo#2ca3903b as nil") - } - b.ObjStart() - b.PutID("localizationTargetInfo") - b.Comma() - b.FieldStart("language_packs") - b.ArrStart() - for idx, v := range l.LanguagePacks { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode localizationTargetInfo#2ca3903b: field language_packs element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LocalizationTargetInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode localizationTargetInfo#2ca3903b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("localizationTargetInfo"); err != nil { - return fmt.Errorf("unable to decode localizationTargetInfo#2ca3903b: %w", err) - } - case "language_packs": - if err := b.Arr(func(b tdjson.Decoder) error { - var value LanguagePackInfo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode localizationTargetInfo#2ca3903b: field language_packs: %w", err) - } - l.LanguagePacks = append(l.LanguagePacks, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode localizationTargetInfo#2ca3903b: field language_packs: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguagePacks returns value of LanguagePacks field. -func (l *LocalizationTargetInfo) GetLanguagePacks() (value []LanguagePackInfo) { - if l == nil { - return - } - return l.LanguagePacks -} diff --git a/tdapi/tl_location_address_gen.go b/tdapi/tl_location_address_gen.go deleted file mode 100644 index c7ed4ac6b..000000000 --- a/tdapi/tl_location_address_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LocationAddress represents TL type `locationAddress#a3dad322`. -type LocationAddress struct { - // A two-letter ISO 3166-1 alpha-2 country code - CountryCode string - // State, if applicable; empty if unknown - State string - // City; empty if unknown - City string - // The address; empty if unknown - Street string -} - -// LocationAddressTypeID is TL type id of LocationAddress. -const LocationAddressTypeID = 0xa3dad322 - -// Ensuring interfaces in compile-time for LocationAddress. -var ( - _ bin.Encoder = &LocationAddress{} - _ bin.Decoder = &LocationAddress{} - _ bin.BareEncoder = &LocationAddress{} - _ bin.BareDecoder = &LocationAddress{} -) - -func (l *LocationAddress) Zero() bool { - if l == nil { - return true - } - if !(l.CountryCode == "") { - return false - } - if !(l.State == "") { - return false - } - if !(l.City == "") { - return false - } - if !(l.Street == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LocationAddress) String() string { - if l == nil { - return "LocationAddress(nil)" - } - type Alias LocationAddress - return fmt.Sprintf("LocationAddress%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LocationAddress) TypeID() uint32 { - return LocationAddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*LocationAddress) TypeName() string { - return "locationAddress" -} - -// TypeInfo returns info about TL type. -func (l *LocationAddress) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "locationAddress", - ID: LocationAddressTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CountryCode", - SchemaName: "country_code", - }, - { - Name: "State", - SchemaName: "state", - }, - { - Name: "City", - SchemaName: "city", - }, - { - Name: "Street", - SchemaName: "street", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LocationAddress) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode locationAddress#a3dad322 as nil") - } - b.PutID(LocationAddressTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LocationAddress) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode locationAddress#a3dad322 as nil") - } - b.PutString(l.CountryCode) - b.PutString(l.State) - b.PutString(l.City) - b.PutString(l.Street) - return nil -} - -// Decode implements bin.Decoder. -func (l *LocationAddress) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode locationAddress#a3dad322 to nil") - } - if err := b.ConsumeID(LocationAddressTypeID); err != nil { - return fmt.Errorf("unable to decode locationAddress#a3dad322: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LocationAddress) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode locationAddress#a3dad322 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode locationAddress#a3dad322: field country_code: %w", err) - } - l.CountryCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode locationAddress#a3dad322: field state: %w", err) - } - l.State = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode locationAddress#a3dad322: field city: %w", err) - } - l.City = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode locationAddress#a3dad322: field street: %w", err) - } - l.Street = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LocationAddress) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode locationAddress#a3dad322 as nil") - } - b.ObjStart() - b.PutID("locationAddress") - b.Comma() - b.FieldStart("country_code") - b.PutString(l.CountryCode) - b.Comma() - b.FieldStart("state") - b.PutString(l.State) - b.Comma() - b.FieldStart("city") - b.PutString(l.City) - b.Comma() - b.FieldStart("street") - b.PutString(l.Street) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LocationAddress) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode locationAddress#a3dad322 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("locationAddress"); err != nil { - return fmt.Errorf("unable to decode locationAddress#a3dad322: %w", err) - } - case "country_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode locationAddress#a3dad322: field country_code: %w", err) - } - l.CountryCode = value - case "state": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode locationAddress#a3dad322: field state: %w", err) - } - l.State = value - case "city": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode locationAddress#a3dad322: field city: %w", err) - } - l.City = value - case "street": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode locationAddress#a3dad322: field street: %w", err) - } - l.Street = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCountryCode returns value of CountryCode field. -func (l *LocationAddress) GetCountryCode() (value string) { - if l == nil { - return - } - return l.CountryCode -} - -// GetState returns value of State field. -func (l *LocationAddress) GetState() (value string) { - if l == nil { - return - } - return l.State -} - -// GetCity returns value of City field. -func (l *LocationAddress) GetCity() (value string) { - if l == nil { - return - } - return l.City -} - -// GetStreet returns value of Street field. -func (l *LocationAddress) GetStreet() (value string) { - if l == nil { - return - } - return l.Street -} diff --git a/tdapi/tl_location_gen.go b/tdapi/tl_location_gen.go deleted file mode 100644 index cbae2f782..000000000 --- a/tdapi/tl_location_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Location represents TL type `location#e5925f73`. -type Location struct { - // Latitude of the location in degrees; as defined by the sender - Latitude float64 - // Longitude of the location, in degrees; as defined by the sender - Longitude float64 - // The estimated horizontal accuracy of the location, in meters; as defined by the sender - // 0 if unknown - HorizontalAccuracy float64 -} - -// LocationTypeID is TL type id of Location. -const LocationTypeID = 0xe5925f73 - -// Ensuring interfaces in compile-time for Location. -var ( - _ bin.Encoder = &Location{} - _ bin.Decoder = &Location{} - _ bin.BareEncoder = &Location{} - _ bin.BareDecoder = &Location{} -) - -func (l *Location) Zero() bool { - if l == nil { - return true - } - if !(l.Latitude == 0) { - return false - } - if !(l.Longitude == 0) { - return false - } - if !(l.HorizontalAccuracy == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *Location) String() string { - if l == nil { - return "Location(nil)" - } - type Alias Location - return fmt.Sprintf("Location%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Location) TypeID() uint32 { - return LocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*Location) TypeName() string { - return "location" -} - -// TypeInfo returns info about TL type. -func (l *Location) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "location", - ID: LocationTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Latitude", - SchemaName: "latitude", - }, - { - Name: "Longitude", - SchemaName: "longitude", - }, - { - Name: "HorizontalAccuracy", - SchemaName: "horizontal_accuracy", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *Location) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode location#e5925f73 as nil") - } - b.PutID(LocationTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *Location) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode location#e5925f73 as nil") - } - b.PutDouble(l.Latitude) - b.PutDouble(l.Longitude) - b.PutDouble(l.HorizontalAccuracy) - return nil -} - -// Decode implements bin.Decoder. -func (l *Location) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode location#e5925f73 to nil") - } - if err := b.ConsumeID(LocationTypeID); err != nil { - return fmt.Errorf("unable to decode location#e5925f73: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *Location) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode location#e5925f73 to nil") - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode location#e5925f73: field latitude: %w", err) - } - l.Latitude = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode location#e5925f73: field longitude: %w", err) - } - l.Longitude = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode location#e5925f73: field horizontal_accuracy: %w", err) - } - l.HorizontalAccuracy = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *Location) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode location#e5925f73 as nil") - } - b.ObjStart() - b.PutID("location") - b.Comma() - b.FieldStart("latitude") - b.PutDouble(l.Latitude) - b.Comma() - b.FieldStart("longitude") - b.PutDouble(l.Longitude) - b.Comma() - b.FieldStart("horizontal_accuracy") - b.PutDouble(l.HorizontalAccuracy) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *Location) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode location#e5925f73 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("location"); err != nil { - return fmt.Errorf("unable to decode location#e5925f73: %w", err) - } - case "latitude": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode location#e5925f73: field latitude: %w", err) - } - l.Latitude = value - case "longitude": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode location#e5925f73: field longitude: %w", err) - } - l.Longitude = value - case "horizontal_accuracy": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode location#e5925f73: field horizontal_accuracy: %w", err) - } - l.HorizontalAccuracy = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLatitude returns value of Latitude field. -func (l *Location) GetLatitude() (value float64) { - if l == nil { - return - } - return l.Latitude -} - -// GetLongitude returns value of Longitude field. -func (l *Location) GetLongitude() (value float64) { - if l == nil { - return - } - return l.Longitude -} - -// GetHorizontalAccuracy returns value of HorizontalAccuracy field. -func (l *Location) GetHorizontalAccuracy() (value float64) { - if l == nil { - return - } - return l.HorizontalAccuracy -} diff --git a/tdapi/tl_log_out_gen.go b/tdapi/tl_log_out_gen.go deleted file mode 100644 index a194c21d7..000000000 --- a/tdapi/tl_log_out_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LogOutRequest represents TL type `logOut#a1b5c41b`. -type LogOutRequest struct { -} - -// LogOutRequestTypeID is TL type id of LogOutRequest. -const LogOutRequestTypeID = 0xa1b5c41b - -// Ensuring interfaces in compile-time for LogOutRequest. -var ( - _ bin.Encoder = &LogOutRequest{} - _ bin.Decoder = &LogOutRequest{} - _ bin.BareEncoder = &LogOutRequest{} - _ bin.BareDecoder = &LogOutRequest{} -) - -func (l *LogOutRequest) Zero() bool { - if l == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (l *LogOutRequest) String() string { - if l == nil { - return "LogOutRequest(nil)" - } - type Alias LogOutRequest - return fmt.Sprintf("LogOutRequest%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LogOutRequest) TypeID() uint32 { - return LogOutRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*LogOutRequest) TypeName() string { - return "logOut" -} - -// TypeInfo returns info about TL type. -func (l *LogOutRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "logOut", - ID: LogOutRequestTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (l *LogOutRequest) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logOut#a1b5c41b as nil") - } - b.PutID(LogOutRequestTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LogOutRequest) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logOut#a1b5c41b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LogOutRequest) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logOut#a1b5c41b to nil") - } - if err := b.ConsumeID(LogOutRequestTypeID); err != nil { - return fmt.Errorf("unable to decode logOut#a1b5c41b: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LogOutRequest) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logOut#a1b5c41b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LogOutRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode logOut#a1b5c41b as nil") - } - b.ObjStart() - b.PutID("logOut") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LogOutRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode logOut#a1b5c41b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("logOut"); err != nil { - return fmt.Errorf("unable to decode logOut#a1b5c41b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// LogOut invokes method logOut#a1b5c41b returning error if any. -func (c *Client) LogOut(ctx context.Context) error { - var ok Ok - - request := &LogOutRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_log_stream_gen.go b/tdapi/tl_log_stream_gen.go deleted file mode 100644 index 833a954d7..000000000 --- a/tdapi/tl_log_stream_gen.go +++ /dev/null @@ -1,681 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LogStreamDefault represents TL type `logStreamDefault#52e296bc`. -type LogStreamDefault struct { -} - -// LogStreamDefaultTypeID is TL type id of LogStreamDefault. -const LogStreamDefaultTypeID = 0x52e296bc - -// construct implements constructor of LogStreamClass. -func (l LogStreamDefault) construct() LogStreamClass { return &l } - -// Ensuring interfaces in compile-time for LogStreamDefault. -var ( - _ bin.Encoder = &LogStreamDefault{} - _ bin.Decoder = &LogStreamDefault{} - _ bin.BareEncoder = &LogStreamDefault{} - _ bin.BareDecoder = &LogStreamDefault{} - - _ LogStreamClass = &LogStreamDefault{} -) - -func (l *LogStreamDefault) Zero() bool { - if l == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (l *LogStreamDefault) String() string { - if l == nil { - return "LogStreamDefault(nil)" - } - type Alias LogStreamDefault - return fmt.Sprintf("LogStreamDefault%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LogStreamDefault) TypeID() uint32 { - return LogStreamDefaultTypeID -} - -// TypeName returns name of type in TL schema. -func (*LogStreamDefault) TypeName() string { - return "logStreamDefault" -} - -// TypeInfo returns info about TL type. -func (l *LogStreamDefault) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "logStreamDefault", - ID: LogStreamDefaultTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (l *LogStreamDefault) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logStreamDefault#52e296bc as nil") - } - b.PutID(LogStreamDefaultTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LogStreamDefault) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logStreamDefault#52e296bc as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LogStreamDefault) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logStreamDefault#52e296bc to nil") - } - if err := b.ConsumeID(LogStreamDefaultTypeID); err != nil { - return fmt.Errorf("unable to decode logStreamDefault#52e296bc: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LogStreamDefault) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logStreamDefault#52e296bc to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LogStreamDefault) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode logStreamDefault#52e296bc as nil") - } - b.ObjStart() - b.PutID("logStreamDefault") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LogStreamDefault) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode logStreamDefault#52e296bc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("logStreamDefault"); err != nil { - return fmt.Errorf("unable to decode logStreamDefault#52e296bc: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// LogStreamFile represents TL type `logStreamFile#5b528de5`. -type LogStreamFile struct { - // Path to the file to where the internal TDLib log will be written - Path string - // The maximum size of the file to where the internal TDLib log is written before the - // file will automatically be rotated, in bytes - MaxFileSize int64 - // Pass true to additionally redirect stderr to the log file. Ignored on Windows - RedirectStderr bool -} - -// LogStreamFileTypeID is TL type id of LogStreamFile. -const LogStreamFileTypeID = 0x5b528de5 - -// construct implements constructor of LogStreamClass. -func (l LogStreamFile) construct() LogStreamClass { return &l } - -// Ensuring interfaces in compile-time for LogStreamFile. -var ( - _ bin.Encoder = &LogStreamFile{} - _ bin.Decoder = &LogStreamFile{} - _ bin.BareEncoder = &LogStreamFile{} - _ bin.BareDecoder = &LogStreamFile{} - - _ LogStreamClass = &LogStreamFile{} -) - -func (l *LogStreamFile) Zero() bool { - if l == nil { - return true - } - if !(l.Path == "") { - return false - } - if !(l.MaxFileSize == 0) { - return false - } - if !(l.RedirectStderr == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LogStreamFile) String() string { - if l == nil { - return "LogStreamFile(nil)" - } - type Alias LogStreamFile - return fmt.Sprintf("LogStreamFile%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LogStreamFile) TypeID() uint32 { - return LogStreamFileTypeID -} - -// TypeName returns name of type in TL schema. -func (*LogStreamFile) TypeName() string { - return "logStreamFile" -} - -// TypeInfo returns info about TL type. -func (l *LogStreamFile) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "logStreamFile", - ID: LogStreamFileTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Path", - SchemaName: "path", - }, - { - Name: "MaxFileSize", - SchemaName: "max_file_size", - }, - { - Name: "RedirectStderr", - SchemaName: "redirect_stderr", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LogStreamFile) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logStreamFile#5b528de5 as nil") - } - b.PutID(LogStreamFileTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LogStreamFile) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logStreamFile#5b528de5 as nil") - } - b.PutString(l.Path) - b.PutInt53(l.MaxFileSize) - b.PutBool(l.RedirectStderr) - return nil -} - -// Decode implements bin.Decoder. -func (l *LogStreamFile) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logStreamFile#5b528de5 to nil") - } - if err := b.ConsumeID(LogStreamFileTypeID); err != nil { - return fmt.Errorf("unable to decode logStreamFile#5b528de5: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LogStreamFile) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logStreamFile#5b528de5 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode logStreamFile#5b528de5: field path: %w", err) - } - l.Path = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode logStreamFile#5b528de5: field max_file_size: %w", err) - } - l.MaxFileSize = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode logStreamFile#5b528de5: field redirect_stderr: %w", err) - } - l.RedirectStderr = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LogStreamFile) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode logStreamFile#5b528de5 as nil") - } - b.ObjStart() - b.PutID("logStreamFile") - b.Comma() - b.FieldStart("path") - b.PutString(l.Path) - b.Comma() - b.FieldStart("max_file_size") - b.PutInt53(l.MaxFileSize) - b.Comma() - b.FieldStart("redirect_stderr") - b.PutBool(l.RedirectStderr) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LogStreamFile) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode logStreamFile#5b528de5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("logStreamFile"); err != nil { - return fmt.Errorf("unable to decode logStreamFile#5b528de5: %w", err) - } - case "path": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode logStreamFile#5b528de5: field path: %w", err) - } - l.Path = value - case "max_file_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode logStreamFile#5b528de5: field max_file_size: %w", err) - } - l.MaxFileSize = value - case "redirect_stderr": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode logStreamFile#5b528de5: field redirect_stderr: %w", err) - } - l.RedirectStderr = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPath returns value of Path field. -func (l *LogStreamFile) GetPath() (value string) { - if l == nil { - return - } - return l.Path -} - -// GetMaxFileSize returns value of MaxFileSize field. -func (l *LogStreamFile) GetMaxFileSize() (value int64) { - if l == nil { - return - } - return l.MaxFileSize -} - -// GetRedirectStderr returns value of RedirectStderr field. -func (l *LogStreamFile) GetRedirectStderr() (value bool) { - if l == nil { - return - } - return l.RedirectStderr -} - -// LogStreamEmpty represents TL type `logStreamEmpty#e233f1cc`. -type LogStreamEmpty struct { -} - -// LogStreamEmptyTypeID is TL type id of LogStreamEmpty. -const LogStreamEmptyTypeID = 0xe233f1cc - -// construct implements constructor of LogStreamClass. -func (l LogStreamEmpty) construct() LogStreamClass { return &l } - -// Ensuring interfaces in compile-time for LogStreamEmpty. -var ( - _ bin.Encoder = &LogStreamEmpty{} - _ bin.Decoder = &LogStreamEmpty{} - _ bin.BareEncoder = &LogStreamEmpty{} - _ bin.BareDecoder = &LogStreamEmpty{} - - _ LogStreamClass = &LogStreamEmpty{} -) - -func (l *LogStreamEmpty) Zero() bool { - if l == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (l *LogStreamEmpty) String() string { - if l == nil { - return "LogStreamEmpty(nil)" - } - type Alias LogStreamEmpty - return fmt.Sprintf("LogStreamEmpty%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LogStreamEmpty) TypeID() uint32 { - return LogStreamEmptyTypeID -} - -// TypeName returns name of type in TL schema. -func (*LogStreamEmpty) TypeName() string { - return "logStreamEmpty" -} - -// TypeInfo returns info about TL type. -func (l *LogStreamEmpty) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "logStreamEmpty", - ID: LogStreamEmptyTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (l *LogStreamEmpty) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logStreamEmpty#e233f1cc as nil") - } - b.PutID(LogStreamEmptyTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LogStreamEmpty) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logStreamEmpty#e233f1cc as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LogStreamEmpty) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logStreamEmpty#e233f1cc to nil") - } - if err := b.ConsumeID(LogStreamEmptyTypeID); err != nil { - return fmt.Errorf("unable to decode logStreamEmpty#e233f1cc: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LogStreamEmpty) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logStreamEmpty#e233f1cc to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LogStreamEmpty) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode logStreamEmpty#e233f1cc as nil") - } - b.ObjStart() - b.PutID("logStreamEmpty") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LogStreamEmpty) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode logStreamEmpty#e233f1cc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("logStreamEmpty"); err != nil { - return fmt.Errorf("unable to decode logStreamEmpty#e233f1cc: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// LogStreamClassName is schema name of LogStreamClass. -const LogStreamClassName = "LogStream" - -// LogStreamClass represents LogStream generic type. -// -// Example: -// -// g, err := tdapi.DecodeLogStream(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.LogStreamDefault: // logStreamDefault#52e296bc -// case *tdapi.LogStreamFile: // logStreamFile#5b528de5 -// case *tdapi.LogStreamEmpty: // logStreamEmpty#e233f1cc -// default: panic(v) -// } -type LogStreamClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() LogStreamClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeLogStream implements binary de-serialization for LogStreamClass. -func DecodeLogStream(buf *bin.Buffer) (LogStreamClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case LogStreamDefaultTypeID: - // Decoding logStreamDefault#52e296bc. - v := LogStreamDefault{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LogStreamClass: %w", err) - } - return &v, nil - case LogStreamFileTypeID: - // Decoding logStreamFile#5b528de5. - v := LogStreamFile{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LogStreamClass: %w", err) - } - return &v, nil - case LogStreamEmptyTypeID: - // Decoding logStreamEmpty#e233f1cc. - v := LogStreamEmpty{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LogStreamClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode LogStreamClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONLogStream implements binary de-serialization for LogStreamClass. -func DecodeTDLibJSONLogStream(buf tdjson.Decoder) (LogStreamClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "logStreamDefault": - // Decoding logStreamDefault#52e296bc. - v := LogStreamDefault{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LogStreamClass: %w", err) - } - return &v, nil - case "logStreamFile": - // Decoding logStreamFile#5b528de5. - v := LogStreamFile{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LogStreamClass: %w", err) - } - return &v, nil - case "logStreamEmpty": - // Decoding logStreamEmpty#e233f1cc. - v := LogStreamEmpty{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LogStreamClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode LogStreamClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// LogStream boxes the LogStreamClass providing a helper. -type LogStreamBox struct { - LogStream LogStreamClass -} - -// Decode implements bin.Decoder for LogStreamBox. -func (b *LogStreamBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode LogStreamBox to nil") - } - v, err := DecodeLogStream(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.LogStream = v - return nil -} - -// Encode implements bin.Encode for LogStreamBox. -func (b *LogStreamBox) Encode(buf *bin.Buffer) error { - if b == nil || b.LogStream == nil { - return fmt.Errorf("unable to encode LogStreamClass as nil") - } - return b.LogStream.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for LogStreamBox. -func (b *LogStreamBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode LogStreamBox to nil") - } - v, err := DecodeTDLibJSONLogStream(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.LogStream = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for LogStreamBox. -func (b *LogStreamBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.LogStream == nil { - return fmt.Errorf("unable to encode LogStreamClass as nil") - } - return b.LogStream.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_log_tags_gen.go b/tdapi/tl_log_tags_gen.go deleted file mode 100644 index 4c42b7343..000000000 --- a/tdapi/tl_log_tags_gen.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LogTags represents TL type `logTags#dc09ced4`. -type LogTags struct { - // List of log tags - Tags []string -} - -// LogTagsTypeID is TL type id of LogTags. -const LogTagsTypeID = 0xdc09ced4 - -// Ensuring interfaces in compile-time for LogTags. -var ( - _ bin.Encoder = &LogTags{} - _ bin.Decoder = &LogTags{} - _ bin.BareEncoder = &LogTags{} - _ bin.BareDecoder = &LogTags{} -) - -func (l *LogTags) Zero() bool { - if l == nil { - return true - } - if !(l.Tags == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LogTags) String() string { - if l == nil { - return "LogTags(nil)" - } - type Alias LogTags - return fmt.Sprintf("LogTags%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LogTags) TypeID() uint32 { - return LogTagsTypeID -} - -// TypeName returns name of type in TL schema. -func (*LogTags) TypeName() string { - return "logTags" -} - -// TypeInfo returns info about TL type. -func (l *LogTags) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "logTags", - ID: LogTagsTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Tags", - SchemaName: "tags", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LogTags) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logTags#dc09ced4 as nil") - } - b.PutID(LogTagsTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LogTags) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logTags#dc09ced4 as nil") - } - b.PutInt(len(l.Tags)) - for _, v := range l.Tags { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (l *LogTags) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logTags#dc09ced4 to nil") - } - if err := b.ConsumeID(LogTagsTypeID); err != nil { - return fmt.Errorf("unable to decode logTags#dc09ced4: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LogTags) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logTags#dc09ced4 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode logTags#dc09ced4: field tags: %w", err) - } - - if headerLen > 0 { - l.Tags = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode logTags#dc09ced4: field tags: %w", err) - } - l.Tags = append(l.Tags, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LogTags) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode logTags#dc09ced4 as nil") - } - b.ObjStart() - b.PutID("logTags") - b.Comma() - b.FieldStart("tags") - b.ArrStart() - for _, v := range l.Tags { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LogTags) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode logTags#dc09ced4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("logTags"); err != nil { - return fmt.Errorf("unable to decode logTags#dc09ced4: %w", err) - } - case "tags": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode logTags#dc09ced4: field tags: %w", err) - } - l.Tags = append(l.Tags, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode logTags#dc09ced4: field tags: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTags returns value of Tags field. -func (l *LogTags) GetTags() (value []string) { - if l == nil { - return - } - return l.Tags -} diff --git a/tdapi/tl_log_verbosity_level_gen.go b/tdapi/tl_log_verbosity_level_gen.go deleted file mode 100644 index cd7b021af..000000000 --- a/tdapi/tl_log_verbosity_level_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LogVerbosityLevel represents TL type `logVerbosityLevel#676443ea`. -type LogVerbosityLevel struct { - // Log verbosity level - VerbosityLevel int32 -} - -// LogVerbosityLevelTypeID is TL type id of LogVerbosityLevel. -const LogVerbosityLevelTypeID = 0x676443ea - -// Ensuring interfaces in compile-time for LogVerbosityLevel. -var ( - _ bin.Encoder = &LogVerbosityLevel{} - _ bin.Decoder = &LogVerbosityLevel{} - _ bin.BareEncoder = &LogVerbosityLevel{} - _ bin.BareDecoder = &LogVerbosityLevel{} -) - -func (l *LogVerbosityLevel) Zero() bool { - if l == nil { - return true - } - if !(l.VerbosityLevel == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LogVerbosityLevel) String() string { - if l == nil { - return "LogVerbosityLevel(nil)" - } - type Alias LogVerbosityLevel - return fmt.Sprintf("LogVerbosityLevel%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LogVerbosityLevel) TypeID() uint32 { - return LogVerbosityLevelTypeID -} - -// TypeName returns name of type in TL schema. -func (*LogVerbosityLevel) TypeName() string { - return "logVerbosityLevel" -} - -// TypeInfo returns info about TL type. -func (l *LogVerbosityLevel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "logVerbosityLevel", - ID: LogVerbosityLevelTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VerbosityLevel", - SchemaName: "verbosity_level", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LogVerbosityLevel) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logVerbosityLevel#676443ea as nil") - } - b.PutID(LogVerbosityLevelTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LogVerbosityLevel) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode logVerbosityLevel#676443ea as nil") - } - b.PutInt32(l.VerbosityLevel) - return nil -} - -// Decode implements bin.Decoder. -func (l *LogVerbosityLevel) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logVerbosityLevel#676443ea to nil") - } - if err := b.ConsumeID(LogVerbosityLevelTypeID); err != nil { - return fmt.Errorf("unable to decode logVerbosityLevel#676443ea: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LogVerbosityLevel) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode logVerbosityLevel#676443ea to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode logVerbosityLevel#676443ea: field verbosity_level: %w", err) - } - l.VerbosityLevel = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LogVerbosityLevel) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode logVerbosityLevel#676443ea as nil") - } - b.ObjStart() - b.PutID("logVerbosityLevel") - b.Comma() - b.FieldStart("verbosity_level") - b.PutInt32(l.VerbosityLevel) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LogVerbosityLevel) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode logVerbosityLevel#676443ea to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("logVerbosityLevel"); err != nil { - return fmt.Errorf("unable to decode logVerbosityLevel#676443ea: %w", err) - } - case "verbosity_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode logVerbosityLevel#676443ea: field verbosity_level: %w", err) - } - l.VerbosityLevel = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVerbosityLevel returns value of VerbosityLevel field. -func (l *LogVerbosityLevel) GetVerbosityLevel() (value int32) { - if l == nil { - return - } - return l.VerbosityLevel -} diff --git a/tdapi/tl_login_url_info_gen.go b/tdapi/tl_login_url_info_gen.go deleted file mode 100644 index 5f17fa915..000000000 --- a/tdapi/tl_login_url_info_gen.go +++ /dev/null @@ -1,640 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// LoginURLInfoOpen represents TL type `loginUrlInfoOpen#31e7ea02`. -type LoginURLInfoOpen struct { - // The URL to open - URL string - // True, if there is no need to show an ordinary open URL confirmation - SkipConfirmation bool -} - -// LoginURLInfoOpenTypeID is TL type id of LoginURLInfoOpen. -const LoginURLInfoOpenTypeID = 0x31e7ea02 - -// construct implements constructor of LoginURLInfoClass. -func (l LoginURLInfoOpen) construct() LoginURLInfoClass { return &l } - -// Ensuring interfaces in compile-time for LoginURLInfoOpen. -var ( - _ bin.Encoder = &LoginURLInfoOpen{} - _ bin.Decoder = &LoginURLInfoOpen{} - _ bin.BareEncoder = &LoginURLInfoOpen{} - _ bin.BareDecoder = &LoginURLInfoOpen{} - - _ LoginURLInfoClass = &LoginURLInfoOpen{} -) - -func (l *LoginURLInfoOpen) Zero() bool { - if l == nil { - return true - } - if !(l.URL == "") { - return false - } - if !(l.SkipConfirmation == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LoginURLInfoOpen) String() string { - if l == nil { - return "LoginURLInfoOpen(nil)" - } - type Alias LoginURLInfoOpen - return fmt.Sprintf("LoginURLInfoOpen%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LoginURLInfoOpen) TypeID() uint32 { - return LoginURLInfoOpenTypeID -} - -// TypeName returns name of type in TL schema. -func (*LoginURLInfoOpen) TypeName() string { - return "loginUrlInfoOpen" -} - -// TypeInfo returns info about TL type. -func (l *LoginURLInfoOpen) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "loginUrlInfoOpen", - ID: LoginURLInfoOpenTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "SkipConfirmation", - SchemaName: "skip_confirmation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LoginURLInfoOpen) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loginUrlInfoOpen#31e7ea02 as nil") - } - b.PutID(LoginURLInfoOpenTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LoginURLInfoOpen) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loginUrlInfoOpen#31e7ea02 as nil") - } - b.PutString(l.URL) - b.PutBool(l.SkipConfirmation) - return nil -} - -// Decode implements bin.Decoder. -func (l *LoginURLInfoOpen) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loginUrlInfoOpen#31e7ea02 to nil") - } - if err := b.ConsumeID(LoginURLInfoOpenTypeID); err != nil { - return fmt.Errorf("unable to decode loginUrlInfoOpen#31e7ea02: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LoginURLInfoOpen) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loginUrlInfoOpen#31e7ea02 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoOpen#31e7ea02: field url: %w", err) - } - l.URL = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoOpen#31e7ea02: field skip_confirmation: %w", err) - } - l.SkipConfirmation = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LoginURLInfoOpen) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode loginUrlInfoOpen#31e7ea02 as nil") - } - b.ObjStart() - b.PutID("loginUrlInfoOpen") - b.Comma() - b.FieldStart("url") - b.PutString(l.URL) - b.Comma() - b.FieldStart("skip_confirmation") - b.PutBool(l.SkipConfirmation) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LoginURLInfoOpen) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode loginUrlInfoOpen#31e7ea02 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("loginUrlInfoOpen"); err != nil { - return fmt.Errorf("unable to decode loginUrlInfoOpen#31e7ea02: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoOpen#31e7ea02: field url: %w", err) - } - l.URL = value - case "skip_confirmation": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoOpen#31e7ea02: field skip_confirmation: %w", err) - } - l.SkipConfirmation = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (l *LoginURLInfoOpen) GetURL() (value string) { - if l == nil { - return - } - return l.URL -} - -// GetSkipConfirmation returns value of SkipConfirmation field. -func (l *LoginURLInfoOpen) GetSkipConfirmation() (value bool) { - if l == nil { - return - } - return l.SkipConfirmation -} - -// LoginURLInfoRequestConfirmation represents TL type `loginUrlInfoRequestConfirmation#7edb242f`. -type LoginURLInfoRequestConfirmation struct { - // An HTTP URL to be opened - URL string - // A domain of the URL - Domain string - // User identifier of a bot linked with the website - BotUserID int64 - // True, if the user must be asked for the permission to the bot to send them messages - RequestWriteAccess bool -} - -// LoginURLInfoRequestConfirmationTypeID is TL type id of LoginURLInfoRequestConfirmation. -const LoginURLInfoRequestConfirmationTypeID = 0x7edb242f - -// construct implements constructor of LoginURLInfoClass. -func (l LoginURLInfoRequestConfirmation) construct() LoginURLInfoClass { return &l } - -// Ensuring interfaces in compile-time for LoginURLInfoRequestConfirmation. -var ( - _ bin.Encoder = &LoginURLInfoRequestConfirmation{} - _ bin.Decoder = &LoginURLInfoRequestConfirmation{} - _ bin.BareEncoder = &LoginURLInfoRequestConfirmation{} - _ bin.BareDecoder = &LoginURLInfoRequestConfirmation{} - - _ LoginURLInfoClass = &LoginURLInfoRequestConfirmation{} -) - -func (l *LoginURLInfoRequestConfirmation) Zero() bool { - if l == nil { - return true - } - if !(l.URL == "") { - return false - } - if !(l.Domain == "") { - return false - } - if !(l.BotUserID == 0) { - return false - } - if !(l.RequestWriteAccess == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (l *LoginURLInfoRequestConfirmation) String() string { - if l == nil { - return "LoginURLInfoRequestConfirmation(nil)" - } - type Alias LoginURLInfoRequestConfirmation - return fmt.Sprintf("LoginURLInfoRequestConfirmation%+v", Alias(*l)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*LoginURLInfoRequestConfirmation) TypeID() uint32 { - return LoginURLInfoRequestConfirmationTypeID -} - -// TypeName returns name of type in TL schema. -func (*LoginURLInfoRequestConfirmation) TypeName() string { - return "loginUrlInfoRequestConfirmation" -} - -// TypeInfo returns info about TL type. -func (l *LoginURLInfoRequestConfirmation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "loginUrlInfoRequestConfirmation", - ID: LoginURLInfoRequestConfirmationTypeID, - } - if l == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Domain", - SchemaName: "domain", - }, - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "RequestWriteAccess", - SchemaName: "request_write_access", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (l *LoginURLInfoRequestConfirmation) Encode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loginUrlInfoRequestConfirmation#7edb242f as nil") - } - b.PutID(LoginURLInfoRequestConfirmationTypeID) - return l.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (l *LoginURLInfoRequestConfirmation) EncodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't encode loginUrlInfoRequestConfirmation#7edb242f as nil") - } - b.PutString(l.URL) - b.PutString(l.Domain) - b.PutInt53(l.BotUserID) - b.PutBool(l.RequestWriteAccess) - return nil -} - -// Decode implements bin.Decoder. -func (l *LoginURLInfoRequestConfirmation) Decode(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loginUrlInfoRequestConfirmation#7edb242f to nil") - } - if err := b.ConsumeID(LoginURLInfoRequestConfirmationTypeID); err != nil { - return fmt.Errorf("unable to decode loginUrlInfoRequestConfirmation#7edb242f: %w", err) - } - return l.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (l *LoginURLInfoRequestConfirmation) DecodeBare(b *bin.Buffer) error { - if l == nil { - return fmt.Errorf("can't decode loginUrlInfoRequestConfirmation#7edb242f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoRequestConfirmation#7edb242f: field url: %w", err) - } - l.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoRequestConfirmation#7edb242f: field domain: %w", err) - } - l.Domain = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoRequestConfirmation#7edb242f: field bot_user_id: %w", err) - } - l.BotUserID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoRequestConfirmation#7edb242f: field request_write_access: %w", err) - } - l.RequestWriteAccess = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (l *LoginURLInfoRequestConfirmation) EncodeTDLibJSON(b tdjson.Encoder) error { - if l == nil { - return fmt.Errorf("can't encode loginUrlInfoRequestConfirmation#7edb242f as nil") - } - b.ObjStart() - b.PutID("loginUrlInfoRequestConfirmation") - b.Comma() - b.FieldStart("url") - b.PutString(l.URL) - b.Comma() - b.FieldStart("domain") - b.PutString(l.Domain) - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(l.BotUserID) - b.Comma() - b.FieldStart("request_write_access") - b.PutBool(l.RequestWriteAccess) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (l *LoginURLInfoRequestConfirmation) DecodeTDLibJSON(b tdjson.Decoder) error { - if l == nil { - return fmt.Errorf("can't decode loginUrlInfoRequestConfirmation#7edb242f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("loginUrlInfoRequestConfirmation"); err != nil { - return fmt.Errorf("unable to decode loginUrlInfoRequestConfirmation#7edb242f: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoRequestConfirmation#7edb242f: field url: %w", err) - } - l.URL = value - case "domain": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoRequestConfirmation#7edb242f: field domain: %w", err) - } - l.Domain = value - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoRequestConfirmation#7edb242f: field bot_user_id: %w", err) - } - l.BotUserID = value - case "request_write_access": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode loginUrlInfoRequestConfirmation#7edb242f: field request_write_access: %w", err) - } - l.RequestWriteAccess = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (l *LoginURLInfoRequestConfirmation) GetURL() (value string) { - if l == nil { - return - } - return l.URL -} - -// GetDomain returns value of Domain field. -func (l *LoginURLInfoRequestConfirmation) GetDomain() (value string) { - if l == nil { - return - } - return l.Domain -} - -// GetBotUserID returns value of BotUserID field. -func (l *LoginURLInfoRequestConfirmation) GetBotUserID() (value int64) { - if l == nil { - return - } - return l.BotUserID -} - -// GetRequestWriteAccess returns value of RequestWriteAccess field. -func (l *LoginURLInfoRequestConfirmation) GetRequestWriteAccess() (value bool) { - if l == nil { - return - } - return l.RequestWriteAccess -} - -// LoginURLInfoClassName is schema name of LoginURLInfoClass. -const LoginURLInfoClassName = "LoginUrlInfo" - -// LoginURLInfoClass represents LoginUrlInfo generic type. -// -// Example: -// -// g, err := tdapi.DecodeLoginURLInfo(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.LoginURLInfoOpen: // loginUrlInfoOpen#31e7ea02 -// case *tdapi.LoginURLInfoRequestConfirmation: // loginUrlInfoRequestConfirmation#7edb242f -// default: panic(v) -// } -type LoginURLInfoClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() LoginURLInfoClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error - - // The URL to open - GetURL() (value string) -} - -// DecodeLoginURLInfo implements binary de-serialization for LoginURLInfoClass. -func DecodeLoginURLInfo(buf *bin.Buffer) (LoginURLInfoClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case LoginURLInfoOpenTypeID: - // Decoding loginUrlInfoOpen#31e7ea02. - v := LoginURLInfoOpen{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LoginURLInfoClass: %w", err) - } - return &v, nil - case LoginURLInfoRequestConfirmationTypeID: - // Decoding loginUrlInfoRequestConfirmation#7edb242f. - v := LoginURLInfoRequestConfirmation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode LoginURLInfoClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode LoginURLInfoClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONLoginURLInfo implements binary de-serialization for LoginURLInfoClass. -func DecodeTDLibJSONLoginURLInfo(buf tdjson.Decoder) (LoginURLInfoClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "loginUrlInfoOpen": - // Decoding loginUrlInfoOpen#31e7ea02. - v := LoginURLInfoOpen{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LoginURLInfoClass: %w", err) - } - return &v, nil - case "loginUrlInfoRequestConfirmation": - // Decoding loginUrlInfoRequestConfirmation#7edb242f. - v := LoginURLInfoRequestConfirmation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode LoginURLInfoClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode LoginURLInfoClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// LoginURLInfo boxes the LoginURLInfoClass providing a helper. -type LoginURLInfoBox struct { - LoginUrlInfo LoginURLInfoClass -} - -// Decode implements bin.Decoder for LoginURLInfoBox. -func (b *LoginURLInfoBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode LoginURLInfoBox to nil") - } - v, err := DecodeLoginURLInfo(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.LoginUrlInfo = v - return nil -} - -// Encode implements bin.Encode for LoginURLInfoBox. -func (b *LoginURLInfoBox) Encode(buf *bin.Buffer) error { - if b == nil || b.LoginUrlInfo == nil { - return fmt.Errorf("unable to encode LoginURLInfoClass as nil") - } - return b.LoginUrlInfo.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for LoginURLInfoBox. -func (b *LoginURLInfoBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode LoginURLInfoBox to nil") - } - v, err := DecodeTDLibJSONLoginURLInfo(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.LoginUrlInfo = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for LoginURLInfoBox. -func (b *LoginURLInfoBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.LoginUrlInfo == nil { - return fmt.Errorf("unable to encode LoginURLInfoClass as nil") - } - return b.LoginUrlInfo.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_main_web_app_gen.go b/tdapi/tl_main_web_app_gen.go deleted file mode 100644 index 414a737a5..000000000 --- a/tdapi/tl_main_web_app_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MainWebApp represents TL type `mainWebApp#73a7ac7a`. -type MainWebApp struct { - // URL of the Web App to open - URL string - // The mode in which the Web App must be opened - Mode WebAppOpenModeClass -} - -// MainWebAppTypeID is TL type id of MainWebApp. -const MainWebAppTypeID = 0x73a7ac7a - -// Ensuring interfaces in compile-time for MainWebApp. -var ( - _ bin.Encoder = &MainWebApp{} - _ bin.Decoder = &MainWebApp{} - _ bin.BareEncoder = &MainWebApp{} - _ bin.BareDecoder = &MainWebApp{} -) - -func (m *MainWebApp) Zero() bool { - if m == nil { - return true - } - if !(m.URL == "") { - return false - } - if !(m.Mode == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MainWebApp) String() string { - if m == nil { - return "MainWebApp(nil)" - } - type Alias MainWebApp - return fmt.Sprintf("MainWebApp%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MainWebApp) TypeID() uint32 { - return MainWebAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*MainWebApp) TypeName() string { - return "mainWebApp" -} - -// TypeInfo returns info about TL type. -func (m *MainWebApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "mainWebApp", - ID: MainWebAppTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Mode", - SchemaName: "mode", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MainWebApp) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode mainWebApp#73a7ac7a as nil") - } - b.PutID(MainWebAppTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MainWebApp) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode mainWebApp#73a7ac7a as nil") - } - b.PutString(m.URL) - if m.Mode == nil { - return fmt.Errorf("unable to encode mainWebApp#73a7ac7a: field mode is nil") - } - if err := m.Mode.Encode(b); err != nil { - return fmt.Errorf("unable to encode mainWebApp#73a7ac7a: field mode: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MainWebApp) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode mainWebApp#73a7ac7a to nil") - } - if err := b.ConsumeID(MainWebAppTypeID); err != nil { - return fmt.Errorf("unable to decode mainWebApp#73a7ac7a: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MainWebApp) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode mainWebApp#73a7ac7a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode mainWebApp#73a7ac7a: field url: %w", err) - } - m.URL = value - } - { - value, err := DecodeWebAppOpenMode(b) - if err != nil { - return fmt.Errorf("unable to decode mainWebApp#73a7ac7a: field mode: %w", err) - } - m.Mode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MainWebApp) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode mainWebApp#73a7ac7a as nil") - } - b.ObjStart() - b.PutID("mainWebApp") - b.Comma() - b.FieldStart("url") - b.PutString(m.URL) - b.Comma() - b.FieldStart("mode") - if m.Mode == nil { - return fmt.Errorf("unable to encode mainWebApp#73a7ac7a: field mode is nil") - } - if err := m.Mode.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode mainWebApp#73a7ac7a: field mode: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MainWebApp) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode mainWebApp#73a7ac7a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("mainWebApp"); err != nil { - return fmt.Errorf("unable to decode mainWebApp#73a7ac7a: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode mainWebApp#73a7ac7a: field url: %w", err) - } - m.URL = value - case "mode": - value, err := DecodeTDLibJSONWebAppOpenMode(b) - if err != nil { - return fmt.Errorf("unable to decode mainWebApp#73a7ac7a: field mode: %w", err) - } - m.Mode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (m *MainWebApp) GetURL() (value string) { - if m == nil { - return - } - return m.URL -} - -// GetMode returns value of Mode field. -func (m *MainWebApp) GetMode() (value WebAppOpenModeClass) { - if m == nil { - return - } - return m.Mode -} diff --git a/tdapi/tl_mask_point_gen.go b/tdapi/tl_mask_point_gen.go deleted file mode 100644 index 3d5839abe..000000000 --- a/tdapi/tl_mask_point_gen.go +++ /dev/null @@ -1,723 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MaskPointForehead represents TL type `maskPointForehead#3d3e96c5`. -type MaskPointForehead struct { -} - -// MaskPointForeheadTypeID is TL type id of MaskPointForehead. -const MaskPointForeheadTypeID = 0x3d3e96c5 - -// construct implements constructor of MaskPointClass. -func (m MaskPointForehead) construct() MaskPointClass { return &m } - -// Ensuring interfaces in compile-time for MaskPointForehead. -var ( - _ bin.Encoder = &MaskPointForehead{} - _ bin.Decoder = &MaskPointForehead{} - _ bin.BareEncoder = &MaskPointForehead{} - _ bin.BareDecoder = &MaskPointForehead{} - - _ MaskPointClass = &MaskPointForehead{} -) - -func (m *MaskPointForehead) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MaskPointForehead) String() string { - if m == nil { - return "MaskPointForehead(nil)" - } - type Alias MaskPointForehead - return fmt.Sprintf("MaskPointForehead%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MaskPointForehead) TypeID() uint32 { - return MaskPointForeheadTypeID -} - -// TypeName returns name of type in TL schema. -func (*MaskPointForehead) TypeName() string { - return "maskPointForehead" -} - -// TypeInfo returns info about TL type. -func (m *MaskPointForehead) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "maskPointForehead", - ID: MaskPointForeheadTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MaskPointForehead) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode maskPointForehead#3d3e96c5 as nil") - } - b.PutID(MaskPointForeheadTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MaskPointForehead) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode maskPointForehead#3d3e96c5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MaskPointForehead) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode maskPointForehead#3d3e96c5 to nil") - } - if err := b.ConsumeID(MaskPointForeheadTypeID); err != nil { - return fmt.Errorf("unable to decode maskPointForehead#3d3e96c5: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MaskPointForehead) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode maskPointForehead#3d3e96c5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MaskPointForehead) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode maskPointForehead#3d3e96c5 as nil") - } - b.ObjStart() - b.PutID("maskPointForehead") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MaskPointForehead) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode maskPointForehead#3d3e96c5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("maskPointForehead"); err != nil { - return fmt.Errorf("unable to decode maskPointForehead#3d3e96c5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MaskPointEyes represents TL type `maskPointEyes#68351b4d`. -type MaskPointEyes struct { -} - -// MaskPointEyesTypeID is TL type id of MaskPointEyes. -const MaskPointEyesTypeID = 0x68351b4d - -// construct implements constructor of MaskPointClass. -func (m MaskPointEyes) construct() MaskPointClass { return &m } - -// Ensuring interfaces in compile-time for MaskPointEyes. -var ( - _ bin.Encoder = &MaskPointEyes{} - _ bin.Decoder = &MaskPointEyes{} - _ bin.BareEncoder = &MaskPointEyes{} - _ bin.BareDecoder = &MaskPointEyes{} - - _ MaskPointClass = &MaskPointEyes{} -) - -func (m *MaskPointEyes) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MaskPointEyes) String() string { - if m == nil { - return "MaskPointEyes(nil)" - } - type Alias MaskPointEyes - return fmt.Sprintf("MaskPointEyes%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MaskPointEyes) TypeID() uint32 { - return MaskPointEyesTypeID -} - -// TypeName returns name of type in TL schema. -func (*MaskPointEyes) TypeName() string { - return "maskPointEyes" -} - -// TypeInfo returns info about TL type. -func (m *MaskPointEyes) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "maskPointEyes", - ID: MaskPointEyesTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MaskPointEyes) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode maskPointEyes#68351b4d as nil") - } - b.PutID(MaskPointEyesTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MaskPointEyes) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode maskPointEyes#68351b4d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MaskPointEyes) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode maskPointEyes#68351b4d to nil") - } - if err := b.ConsumeID(MaskPointEyesTypeID); err != nil { - return fmt.Errorf("unable to decode maskPointEyes#68351b4d: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MaskPointEyes) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode maskPointEyes#68351b4d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MaskPointEyes) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode maskPointEyes#68351b4d as nil") - } - b.ObjStart() - b.PutID("maskPointEyes") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MaskPointEyes) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode maskPointEyes#68351b4d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("maskPointEyes"); err != nil { - return fmt.Errorf("unable to decode maskPointEyes#68351b4d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MaskPointMouth represents TL type `maskPointMouth#188b29de`. -type MaskPointMouth struct { -} - -// MaskPointMouthTypeID is TL type id of MaskPointMouth. -const MaskPointMouthTypeID = 0x188b29de - -// construct implements constructor of MaskPointClass. -func (m MaskPointMouth) construct() MaskPointClass { return &m } - -// Ensuring interfaces in compile-time for MaskPointMouth. -var ( - _ bin.Encoder = &MaskPointMouth{} - _ bin.Decoder = &MaskPointMouth{} - _ bin.BareEncoder = &MaskPointMouth{} - _ bin.BareDecoder = &MaskPointMouth{} - - _ MaskPointClass = &MaskPointMouth{} -) - -func (m *MaskPointMouth) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MaskPointMouth) String() string { - if m == nil { - return "MaskPointMouth(nil)" - } - type Alias MaskPointMouth - return fmt.Sprintf("MaskPointMouth%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MaskPointMouth) TypeID() uint32 { - return MaskPointMouthTypeID -} - -// TypeName returns name of type in TL schema. -func (*MaskPointMouth) TypeName() string { - return "maskPointMouth" -} - -// TypeInfo returns info about TL type. -func (m *MaskPointMouth) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "maskPointMouth", - ID: MaskPointMouthTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MaskPointMouth) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode maskPointMouth#188b29de as nil") - } - b.PutID(MaskPointMouthTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MaskPointMouth) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode maskPointMouth#188b29de as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MaskPointMouth) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode maskPointMouth#188b29de to nil") - } - if err := b.ConsumeID(MaskPointMouthTypeID); err != nil { - return fmt.Errorf("unable to decode maskPointMouth#188b29de: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MaskPointMouth) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode maskPointMouth#188b29de to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MaskPointMouth) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode maskPointMouth#188b29de as nil") - } - b.ObjStart() - b.PutID("maskPointMouth") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MaskPointMouth) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode maskPointMouth#188b29de to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("maskPointMouth"); err != nil { - return fmt.Errorf("unable to decode maskPointMouth#188b29de: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MaskPointChin represents TL type `maskPointChin#1fe36187`. -type MaskPointChin struct { -} - -// MaskPointChinTypeID is TL type id of MaskPointChin. -const MaskPointChinTypeID = 0x1fe36187 - -// construct implements constructor of MaskPointClass. -func (m MaskPointChin) construct() MaskPointClass { return &m } - -// Ensuring interfaces in compile-time for MaskPointChin. -var ( - _ bin.Encoder = &MaskPointChin{} - _ bin.Decoder = &MaskPointChin{} - _ bin.BareEncoder = &MaskPointChin{} - _ bin.BareDecoder = &MaskPointChin{} - - _ MaskPointClass = &MaskPointChin{} -) - -func (m *MaskPointChin) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MaskPointChin) String() string { - if m == nil { - return "MaskPointChin(nil)" - } - type Alias MaskPointChin - return fmt.Sprintf("MaskPointChin%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MaskPointChin) TypeID() uint32 { - return MaskPointChinTypeID -} - -// TypeName returns name of type in TL schema. -func (*MaskPointChin) TypeName() string { - return "maskPointChin" -} - -// TypeInfo returns info about TL type. -func (m *MaskPointChin) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "maskPointChin", - ID: MaskPointChinTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MaskPointChin) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode maskPointChin#1fe36187 as nil") - } - b.PutID(MaskPointChinTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MaskPointChin) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode maskPointChin#1fe36187 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MaskPointChin) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode maskPointChin#1fe36187 to nil") - } - if err := b.ConsumeID(MaskPointChinTypeID); err != nil { - return fmt.Errorf("unable to decode maskPointChin#1fe36187: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MaskPointChin) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode maskPointChin#1fe36187 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MaskPointChin) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode maskPointChin#1fe36187 as nil") - } - b.ObjStart() - b.PutID("maskPointChin") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MaskPointChin) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode maskPointChin#1fe36187 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("maskPointChin"); err != nil { - return fmt.Errorf("unable to decode maskPointChin#1fe36187: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MaskPointClassName is schema name of MaskPointClass. -const MaskPointClassName = "MaskPoint" - -// MaskPointClass represents MaskPoint generic type. -// -// Example: -// -// g, err := tdapi.DecodeMaskPoint(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MaskPointForehead: // maskPointForehead#3d3e96c5 -// case *tdapi.MaskPointEyes: // maskPointEyes#68351b4d -// case *tdapi.MaskPointMouth: // maskPointMouth#188b29de -// case *tdapi.MaskPointChin: // maskPointChin#1fe36187 -// default: panic(v) -// } -type MaskPointClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MaskPointClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMaskPoint implements binary de-serialization for MaskPointClass. -func DecodeMaskPoint(buf *bin.Buffer) (MaskPointClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MaskPointForeheadTypeID: - // Decoding maskPointForehead#3d3e96c5. - v := MaskPointForehead{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MaskPointClass: %w", err) - } - return &v, nil - case MaskPointEyesTypeID: - // Decoding maskPointEyes#68351b4d. - v := MaskPointEyes{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MaskPointClass: %w", err) - } - return &v, nil - case MaskPointMouthTypeID: - // Decoding maskPointMouth#188b29de. - v := MaskPointMouth{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MaskPointClass: %w", err) - } - return &v, nil - case MaskPointChinTypeID: - // Decoding maskPointChin#1fe36187. - v := MaskPointChin{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MaskPointClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MaskPointClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMaskPoint implements binary de-serialization for MaskPointClass. -func DecodeTDLibJSONMaskPoint(buf tdjson.Decoder) (MaskPointClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "maskPointForehead": - // Decoding maskPointForehead#3d3e96c5. - v := MaskPointForehead{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MaskPointClass: %w", err) - } - return &v, nil - case "maskPointEyes": - // Decoding maskPointEyes#68351b4d. - v := MaskPointEyes{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MaskPointClass: %w", err) - } - return &v, nil - case "maskPointMouth": - // Decoding maskPointMouth#188b29de. - v := MaskPointMouth{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MaskPointClass: %w", err) - } - return &v, nil - case "maskPointChin": - // Decoding maskPointChin#1fe36187. - v := MaskPointChin{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MaskPointClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MaskPointClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MaskPoint boxes the MaskPointClass providing a helper. -type MaskPointBox struct { - MaskPoint MaskPointClass -} - -// Decode implements bin.Decoder for MaskPointBox. -func (b *MaskPointBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MaskPointBox to nil") - } - v, err := DecodeMaskPoint(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MaskPoint = v - return nil -} - -// Encode implements bin.Encode for MaskPointBox. -func (b *MaskPointBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MaskPoint == nil { - return fmt.Errorf("unable to encode MaskPointClass as nil") - } - return b.MaskPoint.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MaskPointBox. -func (b *MaskPointBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MaskPointBox to nil") - } - v, err := DecodeTDLibJSONMaskPoint(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MaskPoint = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MaskPointBox. -func (b *MaskPointBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MaskPoint == nil { - return fmt.Errorf("unable to encode MaskPointClass as nil") - } - return b.MaskPoint.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_mask_position_gen.go b/tdapi/tl_mask_position_gen.go deleted file mode 100644 index 02518a7a0..000000000 --- a/tdapi/tl_mask_position_gen.go +++ /dev/null @@ -1,308 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MaskPosition represents TL type `maskPosition#82fbb63e`. -type MaskPosition struct { - // Part of the face, relative to which the mask is placed - Point MaskPointClass - // Shift by X-axis measured in widths of the mask scaled to the face size, from left to - // right. (For example, -1.0 will place the mask just to the left of the default mask - // position) - XShift float64 - // Shift by Y-axis measured in heights of the mask scaled to the face size, from top to - // bottom. (For example, 1.0 will place the mask just below the default mask position) - YShift float64 - // Mask scaling coefficient. (For example, 2.0 means a doubled size) - Scale float64 -} - -// MaskPositionTypeID is TL type id of MaskPosition. -const MaskPositionTypeID = 0x82fbb63e - -// Ensuring interfaces in compile-time for MaskPosition. -var ( - _ bin.Encoder = &MaskPosition{} - _ bin.Decoder = &MaskPosition{} - _ bin.BareEncoder = &MaskPosition{} - _ bin.BareDecoder = &MaskPosition{} -) - -func (m *MaskPosition) Zero() bool { - if m == nil { - return true - } - if !(m.Point == nil) { - return false - } - if !(m.XShift == 0) { - return false - } - if !(m.YShift == 0) { - return false - } - if !(m.Scale == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MaskPosition) String() string { - if m == nil { - return "MaskPosition(nil)" - } - type Alias MaskPosition - return fmt.Sprintf("MaskPosition%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MaskPosition) TypeID() uint32 { - return MaskPositionTypeID -} - -// TypeName returns name of type in TL schema. -func (*MaskPosition) TypeName() string { - return "maskPosition" -} - -// TypeInfo returns info about TL type. -func (m *MaskPosition) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "maskPosition", - ID: MaskPositionTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Point", - SchemaName: "point", - }, - { - Name: "XShift", - SchemaName: "x_shift", - }, - { - Name: "YShift", - SchemaName: "y_shift", - }, - { - Name: "Scale", - SchemaName: "scale", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MaskPosition) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode maskPosition#82fbb63e as nil") - } - b.PutID(MaskPositionTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MaskPosition) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode maskPosition#82fbb63e as nil") - } - if m.Point == nil { - return fmt.Errorf("unable to encode maskPosition#82fbb63e: field point is nil") - } - if err := m.Point.Encode(b); err != nil { - return fmt.Errorf("unable to encode maskPosition#82fbb63e: field point: %w", err) - } - b.PutDouble(m.XShift) - b.PutDouble(m.YShift) - b.PutDouble(m.Scale) - return nil -} - -// Decode implements bin.Decoder. -func (m *MaskPosition) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode maskPosition#82fbb63e to nil") - } - if err := b.ConsumeID(MaskPositionTypeID); err != nil { - return fmt.Errorf("unable to decode maskPosition#82fbb63e: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MaskPosition) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode maskPosition#82fbb63e to nil") - } - { - value, err := DecodeMaskPoint(b) - if err != nil { - return fmt.Errorf("unable to decode maskPosition#82fbb63e: field point: %w", err) - } - m.Point = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode maskPosition#82fbb63e: field x_shift: %w", err) - } - m.XShift = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode maskPosition#82fbb63e: field y_shift: %w", err) - } - m.YShift = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode maskPosition#82fbb63e: field scale: %w", err) - } - m.Scale = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MaskPosition) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode maskPosition#82fbb63e as nil") - } - b.ObjStart() - b.PutID("maskPosition") - b.Comma() - b.FieldStart("point") - if m.Point == nil { - return fmt.Errorf("unable to encode maskPosition#82fbb63e: field point is nil") - } - if err := m.Point.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode maskPosition#82fbb63e: field point: %w", err) - } - b.Comma() - b.FieldStart("x_shift") - b.PutDouble(m.XShift) - b.Comma() - b.FieldStart("y_shift") - b.PutDouble(m.YShift) - b.Comma() - b.FieldStart("scale") - b.PutDouble(m.Scale) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MaskPosition) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode maskPosition#82fbb63e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("maskPosition"); err != nil { - return fmt.Errorf("unable to decode maskPosition#82fbb63e: %w", err) - } - case "point": - value, err := DecodeTDLibJSONMaskPoint(b) - if err != nil { - return fmt.Errorf("unable to decode maskPosition#82fbb63e: field point: %w", err) - } - m.Point = value - case "x_shift": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode maskPosition#82fbb63e: field x_shift: %w", err) - } - m.XShift = value - case "y_shift": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode maskPosition#82fbb63e: field y_shift: %w", err) - } - m.YShift = value - case "scale": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode maskPosition#82fbb63e: field scale: %w", err) - } - m.Scale = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPoint returns value of Point field. -func (m *MaskPosition) GetPoint() (value MaskPointClass) { - if m == nil { - return - } - return m.Point -} - -// GetXShift returns value of XShift field. -func (m *MaskPosition) GetXShift() (value float64) { - if m == nil { - return - } - return m.XShift -} - -// GetYShift returns value of YShift field. -func (m *MaskPosition) GetYShift() (value float64) { - if m == nil { - return - } - return m.YShift -} - -// GetScale returns value of Scale field. -func (m *MaskPosition) GetScale() (value float64) { - if m == nil { - return - } - return m.Scale -} diff --git a/tdapi/tl_message_auto_delete_time_gen.go b/tdapi/tl_message_auto_delete_time_gen.go deleted file mode 100644 index 923bb70d6..000000000 --- a/tdapi/tl_message_auto_delete_time_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageAutoDeleteTime represents TL type `messageAutoDeleteTime#758b0715`. -type MessageAutoDeleteTime struct { - // Message auto-delete time, in seconds. If 0, then messages aren't deleted automatically - Time int32 -} - -// MessageAutoDeleteTimeTypeID is TL type id of MessageAutoDeleteTime. -const MessageAutoDeleteTimeTypeID = 0x758b0715 - -// Ensuring interfaces in compile-time for MessageAutoDeleteTime. -var ( - _ bin.Encoder = &MessageAutoDeleteTime{} - _ bin.Decoder = &MessageAutoDeleteTime{} - _ bin.BareEncoder = &MessageAutoDeleteTime{} - _ bin.BareDecoder = &MessageAutoDeleteTime{} -) - -func (m *MessageAutoDeleteTime) Zero() bool { - if m == nil { - return true - } - if !(m.Time == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageAutoDeleteTime) String() string { - if m == nil { - return "MessageAutoDeleteTime(nil)" - } - type Alias MessageAutoDeleteTime - return fmt.Sprintf("MessageAutoDeleteTime%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageAutoDeleteTime) TypeID() uint32 { - return MessageAutoDeleteTimeTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageAutoDeleteTime) TypeName() string { - return "messageAutoDeleteTime" -} - -// TypeInfo returns info about TL type. -func (m *MessageAutoDeleteTime) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageAutoDeleteTime", - ID: MessageAutoDeleteTimeTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Time", - SchemaName: "time", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageAutoDeleteTime) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageAutoDeleteTime#758b0715 as nil") - } - b.PutID(MessageAutoDeleteTimeTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageAutoDeleteTime) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageAutoDeleteTime#758b0715 as nil") - } - b.PutInt32(m.Time) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageAutoDeleteTime) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageAutoDeleteTime#758b0715 to nil") - } - if err := b.ConsumeID(MessageAutoDeleteTimeTypeID); err != nil { - return fmt.Errorf("unable to decode messageAutoDeleteTime#758b0715: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageAutoDeleteTime) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageAutoDeleteTime#758b0715 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageAutoDeleteTime#758b0715: field time: %w", err) - } - m.Time = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageAutoDeleteTime) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageAutoDeleteTime#758b0715 as nil") - } - b.ObjStart() - b.PutID("messageAutoDeleteTime") - b.Comma() - b.FieldStart("time") - b.PutInt32(m.Time) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageAutoDeleteTime) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageAutoDeleteTime#758b0715 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageAutoDeleteTime"); err != nil { - return fmt.Errorf("unable to decode messageAutoDeleteTime#758b0715: %w", err) - } - case "time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageAutoDeleteTime#758b0715: field time: %w", err) - } - m.Time = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTime returns value of Time field. -func (m *MessageAutoDeleteTime) GetTime() (value int32) { - if m == nil { - return - } - return m.Time -} diff --git a/tdapi/tl_message_calendar_day_gen.go b/tdapi/tl_message_calendar_day_gen.go deleted file mode 100644 index 117ac3e74..000000000 --- a/tdapi/tl_message_calendar_day_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageCalendarDay represents TL type `messageCalendarDay#e98f8f62`. -type MessageCalendarDay struct { - // Total number of found messages sent on the day - TotalCount int32 - // First message sent on the day - Message Message -} - -// MessageCalendarDayTypeID is TL type id of MessageCalendarDay. -const MessageCalendarDayTypeID = 0xe98f8f62 - -// Ensuring interfaces in compile-time for MessageCalendarDay. -var ( - _ bin.Encoder = &MessageCalendarDay{} - _ bin.Decoder = &MessageCalendarDay{} - _ bin.BareEncoder = &MessageCalendarDay{} - _ bin.BareDecoder = &MessageCalendarDay{} -) - -func (m *MessageCalendarDay) Zero() bool { - if m == nil { - return true - } - if !(m.TotalCount == 0) { - return false - } - if !(m.Message.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageCalendarDay) String() string { - if m == nil { - return "MessageCalendarDay(nil)" - } - type Alias MessageCalendarDay - return fmt.Sprintf("MessageCalendarDay%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageCalendarDay) TypeID() uint32 { - return MessageCalendarDayTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageCalendarDay) TypeName() string { - return "messageCalendarDay" -} - -// TypeInfo returns info about TL type. -func (m *MessageCalendarDay) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageCalendarDay", - ID: MessageCalendarDayTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageCalendarDay) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageCalendarDay#e98f8f62 as nil") - } - b.PutID(MessageCalendarDayTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageCalendarDay) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageCalendarDay#e98f8f62 as nil") - } - b.PutInt32(m.TotalCount) - if err := m.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageCalendarDay#e98f8f62: field message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageCalendarDay) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageCalendarDay#e98f8f62 to nil") - } - if err := b.ConsumeID(MessageCalendarDayTypeID); err != nil { - return fmt.Errorf("unable to decode messageCalendarDay#e98f8f62: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageCalendarDay) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageCalendarDay#e98f8f62 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageCalendarDay#e98f8f62: field total_count: %w", err) - } - m.TotalCount = value - } - { - if err := m.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageCalendarDay#e98f8f62: field message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageCalendarDay) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageCalendarDay#e98f8f62 as nil") - } - b.ObjStart() - b.PutID("messageCalendarDay") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(m.TotalCount) - b.Comma() - b.FieldStart("message") - if err := m.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageCalendarDay#e98f8f62: field message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageCalendarDay) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageCalendarDay#e98f8f62 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageCalendarDay"); err != nil { - return fmt.Errorf("unable to decode messageCalendarDay#e98f8f62: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageCalendarDay#e98f8f62: field total_count: %w", err) - } - m.TotalCount = value - case "message": - if err := m.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageCalendarDay#e98f8f62: field message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (m *MessageCalendarDay) GetTotalCount() (value int32) { - if m == nil { - return - } - return m.TotalCount -} - -// GetMessage returns value of Message field. -func (m *MessageCalendarDay) GetMessage() (value Message) { - if m == nil { - return - } - return m.Message -} diff --git a/tdapi/tl_message_calendar_gen.go b/tdapi/tl_message_calendar_gen.go deleted file mode 100644 index 21bdedd12..000000000 --- a/tdapi/tl_message_calendar_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageCalendar represents TL type `messageCalendar#2582bbd7`. -type MessageCalendar struct { - // Total number of found messages - TotalCount int32 - // Information about messages sent - Days []MessageCalendarDay -} - -// MessageCalendarTypeID is TL type id of MessageCalendar. -const MessageCalendarTypeID = 0x2582bbd7 - -// Ensuring interfaces in compile-time for MessageCalendar. -var ( - _ bin.Encoder = &MessageCalendar{} - _ bin.Decoder = &MessageCalendar{} - _ bin.BareEncoder = &MessageCalendar{} - _ bin.BareDecoder = &MessageCalendar{} -) - -func (m *MessageCalendar) Zero() bool { - if m == nil { - return true - } - if !(m.TotalCount == 0) { - return false - } - if !(m.Days == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageCalendar) String() string { - if m == nil { - return "MessageCalendar(nil)" - } - type Alias MessageCalendar - return fmt.Sprintf("MessageCalendar%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageCalendar) TypeID() uint32 { - return MessageCalendarTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageCalendar) TypeName() string { - return "messageCalendar" -} - -// TypeInfo returns info about TL type. -func (m *MessageCalendar) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageCalendar", - ID: MessageCalendarTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Days", - SchemaName: "days", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageCalendar) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageCalendar#2582bbd7 as nil") - } - b.PutID(MessageCalendarTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageCalendar) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageCalendar#2582bbd7 as nil") - } - b.PutInt32(m.TotalCount) - b.PutInt(len(m.Days)) - for idx, v := range m.Days { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messageCalendar#2582bbd7: field days element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageCalendar) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageCalendar#2582bbd7 to nil") - } - if err := b.ConsumeID(MessageCalendarTypeID); err != nil { - return fmt.Errorf("unable to decode messageCalendar#2582bbd7: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageCalendar) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageCalendar#2582bbd7 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageCalendar#2582bbd7: field total_count: %w", err) - } - m.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageCalendar#2582bbd7: field days: %w", err) - } - - if headerLen > 0 { - m.Days = make([]MessageCalendarDay, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value MessageCalendarDay - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare messageCalendar#2582bbd7: field days: %w", err) - } - m.Days = append(m.Days, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageCalendar) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageCalendar#2582bbd7 as nil") - } - b.ObjStart() - b.PutID("messageCalendar") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(m.TotalCount) - b.Comma() - b.FieldStart("days") - b.ArrStart() - for idx, v := range m.Days { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageCalendar#2582bbd7: field days element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageCalendar) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageCalendar#2582bbd7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageCalendar"); err != nil { - return fmt.Errorf("unable to decode messageCalendar#2582bbd7: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageCalendar#2582bbd7: field total_count: %w", err) - } - m.TotalCount = value - case "days": - if err := b.Arr(func(b tdjson.Decoder) error { - var value MessageCalendarDay - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageCalendar#2582bbd7: field days: %w", err) - } - m.Days = append(m.Days, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageCalendar#2582bbd7: field days: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (m *MessageCalendar) GetTotalCount() (value int32) { - if m == nil { - return - } - return m.TotalCount -} - -// GetDays returns value of Days field. -func (m *MessageCalendar) GetDays() (value []MessageCalendarDay) { - if m == nil { - return - } - return m.Days -} diff --git a/tdapi/tl_message_content_gen.go b/tdapi/tl_message_content_gen.go deleted file mode 100644 index 7ca9dac4b..000000000 --- a/tdapi/tl_message_content_gen.go +++ /dev/null @@ -1,19019 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageText represents TL type `messageText#68654c84`. -type MessageText struct { - // Text of the message - Text FormattedText - // A link preview attached to the message; may be null - LinkPreview LinkPreview - // Options which were used for generation of the link preview; may be null if default - // options were used - LinkPreviewOptions LinkPreviewOptions -} - -// MessageTextTypeID is TL type id of MessageText. -const MessageTextTypeID = 0x68654c84 - -// construct implements constructor of MessageContentClass. -func (m MessageText) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageText. -var ( - _ bin.Encoder = &MessageText{} - _ bin.Decoder = &MessageText{} - _ bin.BareEncoder = &MessageText{} - _ bin.BareDecoder = &MessageText{} - - _ MessageContentClass = &MessageText{} -) - -func (m *MessageText) Zero() bool { - if m == nil { - return true - } - if !(m.Text.Zero()) { - return false - } - if !(m.LinkPreview.Zero()) { - return false - } - if !(m.LinkPreviewOptions.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageText) String() string { - if m == nil { - return "MessageText(nil)" - } - type Alias MessageText - return fmt.Sprintf("MessageText%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageText) TypeID() uint32 { - return MessageTextTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageText) TypeName() string { - return "messageText" -} - -// TypeInfo returns info about TL type. -func (m *MessageText) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageText", - ID: MessageTextTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "LinkPreview", - SchemaName: "link_preview", - }, - { - Name: "LinkPreviewOptions", - SchemaName: "link_preview_options", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageText) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageText#68654c84 as nil") - } - b.PutID(MessageTextTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageText) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageText#68654c84 as nil") - } - if err := m.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageText#68654c84: field text: %w", err) - } - if err := m.LinkPreview.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageText#68654c84: field link_preview: %w", err) - } - if err := m.LinkPreviewOptions.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageText#68654c84: field link_preview_options: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageText) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageText#68654c84 to nil") - } - if err := b.ConsumeID(MessageTextTypeID); err != nil { - return fmt.Errorf("unable to decode messageText#68654c84: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageText) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageText#68654c84 to nil") - } - { - if err := m.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageText#68654c84: field text: %w", err) - } - } - { - if err := m.LinkPreview.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageText#68654c84: field link_preview: %w", err) - } - } - { - if err := m.LinkPreviewOptions.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageText#68654c84: field link_preview_options: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageText) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageText#68654c84 as nil") - } - b.ObjStart() - b.PutID("messageText") - b.Comma() - b.FieldStart("text") - if err := m.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageText#68654c84: field text: %w", err) - } - b.Comma() - b.FieldStart("link_preview") - if err := m.LinkPreview.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageText#68654c84: field link_preview: %w", err) - } - b.Comma() - b.FieldStart("link_preview_options") - if err := m.LinkPreviewOptions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageText#68654c84: field link_preview_options: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageText) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageText#68654c84 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageText"); err != nil { - return fmt.Errorf("unable to decode messageText#68654c84: %w", err) - } - case "text": - if err := m.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageText#68654c84: field text: %w", err) - } - case "link_preview": - if err := m.LinkPreview.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageText#68654c84: field link_preview: %w", err) - } - case "link_preview_options": - if err := m.LinkPreviewOptions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageText#68654c84: field link_preview_options: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (m *MessageText) GetText() (value FormattedText) { - if m == nil { - return - } - return m.Text -} - -// GetLinkPreview returns value of LinkPreview field. -func (m *MessageText) GetLinkPreview() (value LinkPreview) { - if m == nil { - return - } - return m.LinkPreview -} - -// GetLinkPreviewOptions returns value of LinkPreviewOptions field. -func (m *MessageText) GetLinkPreviewOptions() (value LinkPreviewOptions) { - if m == nil { - return - } - return m.LinkPreviewOptions -} - -// MessageAnimation represents TL type `messageAnimation#8ecb1128`. -type MessageAnimation struct { - // The animation description - Animation Animation - // Animation caption - Caption FormattedText - // True, if the caption must be shown above the animation; otherwise, the caption must be - // shown below the animation - ShowCaptionAboveMedia bool - // True, if the animation preview must be covered by a spoiler animation - HasSpoiler bool - // True, if the animation thumbnail must be blurred and the animation must be shown only - // while tapped - IsSecret bool -} - -// MessageAnimationTypeID is TL type id of MessageAnimation. -const MessageAnimationTypeID = 0x8ecb1128 - -// construct implements constructor of MessageContentClass. -func (m MessageAnimation) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageAnimation. -var ( - _ bin.Encoder = &MessageAnimation{} - _ bin.Decoder = &MessageAnimation{} - _ bin.BareEncoder = &MessageAnimation{} - _ bin.BareDecoder = &MessageAnimation{} - - _ MessageContentClass = &MessageAnimation{} -) - -func (m *MessageAnimation) Zero() bool { - if m == nil { - return true - } - if !(m.Animation.Zero()) { - return false - } - if !(m.Caption.Zero()) { - return false - } - if !(m.ShowCaptionAboveMedia == false) { - return false - } - if !(m.HasSpoiler == false) { - return false - } - if !(m.IsSecret == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageAnimation) String() string { - if m == nil { - return "MessageAnimation(nil)" - } - type Alias MessageAnimation - return fmt.Sprintf("MessageAnimation%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageAnimation) TypeID() uint32 { - return MessageAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageAnimation) TypeName() string { - return "messageAnimation" -} - -// TypeInfo returns info about TL type. -func (m *MessageAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageAnimation", - ID: MessageAnimationTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Animation", - SchemaName: "animation", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "ShowCaptionAboveMedia", - SchemaName: "show_caption_above_media", - }, - { - Name: "HasSpoiler", - SchemaName: "has_spoiler", - }, - { - Name: "IsSecret", - SchemaName: "is_secret", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageAnimation) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageAnimation#8ecb1128 as nil") - } - b.PutID(MessageAnimationTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageAnimation) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageAnimation#8ecb1128 as nil") - } - if err := m.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageAnimation#8ecb1128: field animation: %w", err) - } - if err := m.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageAnimation#8ecb1128: field caption: %w", err) - } - b.PutBool(m.ShowCaptionAboveMedia) - b.PutBool(m.HasSpoiler) - b.PutBool(m.IsSecret) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageAnimation) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageAnimation#8ecb1128 to nil") - } - if err := b.ConsumeID(MessageAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageAnimation) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageAnimation#8ecb1128 to nil") - } - { - if err := m.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: field animation: %w", err) - } - } - { - if err := m.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: field show_caption_above_media: %w", err) - } - m.ShowCaptionAboveMedia = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: field has_spoiler: %w", err) - } - m.HasSpoiler = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: field is_secret: %w", err) - } - m.IsSecret = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageAnimation#8ecb1128 as nil") - } - b.ObjStart() - b.PutID("messageAnimation") - b.Comma() - b.FieldStart("animation") - if err := m.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageAnimation#8ecb1128: field animation: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := m.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageAnimation#8ecb1128: field caption: %w", err) - } - b.Comma() - b.FieldStart("show_caption_above_media") - b.PutBool(m.ShowCaptionAboveMedia) - b.Comma() - b.FieldStart("has_spoiler") - b.PutBool(m.HasSpoiler) - b.Comma() - b.FieldStart("is_secret") - b.PutBool(m.IsSecret) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageAnimation#8ecb1128 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageAnimation"); err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: %w", err) - } - case "animation": - if err := m.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: field animation: %w", err) - } - case "caption": - if err := m.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: field caption: %w", err) - } - case "show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: field show_caption_above_media: %w", err) - } - m.ShowCaptionAboveMedia = value - case "has_spoiler": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: field has_spoiler: %w", err) - } - m.HasSpoiler = value - case "is_secret": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageAnimation#8ecb1128: field is_secret: %w", err) - } - m.IsSecret = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAnimation returns value of Animation field. -func (m *MessageAnimation) GetAnimation() (value Animation) { - if m == nil { - return - } - return m.Animation -} - -// GetCaption returns value of Caption field. -func (m *MessageAnimation) GetCaption() (value FormattedText) { - if m == nil { - return - } - return m.Caption -} - -// GetShowCaptionAboveMedia returns value of ShowCaptionAboveMedia field. -func (m *MessageAnimation) GetShowCaptionAboveMedia() (value bool) { - if m == nil { - return - } - return m.ShowCaptionAboveMedia -} - -// GetHasSpoiler returns value of HasSpoiler field. -func (m *MessageAnimation) GetHasSpoiler() (value bool) { - if m == nil { - return - } - return m.HasSpoiler -} - -// GetIsSecret returns value of IsSecret field. -func (m *MessageAnimation) GetIsSecret() (value bool) { - if m == nil { - return - } - return m.IsSecret -} - -// MessageAudio represents TL type `messageAudio#107e741c`. -type MessageAudio struct { - // The audio description - Audio Audio - // Audio caption - Caption FormattedText -} - -// MessageAudioTypeID is TL type id of MessageAudio. -const MessageAudioTypeID = 0x107e741c - -// construct implements constructor of MessageContentClass. -func (m MessageAudio) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageAudio. -var ( - _ bin.Encoder = &MessageAudio{} - _ bin.Decoder = &MessageAudio{} - _ bin.BareEncoder = &MessageAudio{} - _ bin.BareDecoder = &MessageAudio{} - - _ MessageContentClass = &MessageAudio{} -) - -func (m *MessageAudio) Zero() bool { - if m == nil { - return true - } - if !(m.Audio.Zero()) { - return false - } - if !(m.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageAudio) String() string { - if m == nil { - return "MessageAudio(nil)" - } - type Alias MessageAudio - return fmt.Sprintf("MessageAudio%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageAudio) TypeID() uint32 { - return MessageAudioTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageAudio) TypeName() string { - return "messageAudio" -} - -// TypeInfo returns info about TL type. -func (m *MessageAudio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageAudio", - ID: MessageAudioTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Audio", - SchemaName: "audio", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageAudio) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageAudio#107e741c as nil") - } - b.PutID(MessageAudioTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageAudio) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageAudio#107e741c as nil") - } - if err := m.Audio.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageAudio#107e741c: field audio: %w", err) - } - if err := m.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageAudio#107e741c: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageAudio) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageAudio#107e741c to nil") - } - if err := b.ConsumeID(MessageAudioTypeID); err != nil { - return fmt.Errorf("unable to decode messageAudio#107e741c: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageAudio) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageAudio#107e741c to nil") - } - { - if err := m.Audio.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageAudio#107e741c: field audio: %w", err) - } - } - { - if err := m.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageAudio#107e741c: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageAudio) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageAudio#107e741c as nil") - } - b.ObjStart() - b.PutID("messageAudio") - b.Comma() - b.FieldStart("audio") - if err := m.Audio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageAudio#107e741c: field audio: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := m.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageAudio#107e741c: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageAudio) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageAudio#107e741c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageAudio"); err != nil { - return fmt.Errorf("unable to decode messageAudio#107e741c: %w", err) - } - case "audio": - if err := m.Audio.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageAudio#107e741c: field audio: %w", err) - } - case "caption": - if err := m.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageAudio#107e741c: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAudio returns value of Audio field. -func (m *MessageAudio) GetAudio() (value Audio) { - if m == nil { - return - } - return m.Audio -} - -// GetCaption returns value of Caption field. -func (m *MessageAudio) GetCaption() (value FormattedText) { - if m == nil { - return - } - return m.Caption -} - -// MessageDocument represents TL type `messageDocument#2394ab77`. -type MessageDocument struct { - // The document description - Document Document - // Document caption - Caption FormattedText -} - -// MessageDocumentTypeID is TL type id of MessageDocument. -const MessageDocumentTypeID = 0x2394ab77 - -// construct implements constructor of MessageContentClass. -func (m MessageDocument) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageDocument. -var ( - _ bin.Encoder = &MessageDocument{} - _ bin.Decoder = &MessageDocument{} - _ bin.BareEncoder = &MessageDocument{} - _ bin.BareDecoder = &MessageDocument{} - - _ MessageContentClass = &MessageDocument{} -) - -func (m *MessageDocument) Zero() bool { - if m == nil { - return true - } - if !(m.Document.Zero()) { - return false - } - if !(m.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageDocument) String() string { - if m == nil { - return "MessageDocument(nil)" - } - type Alias MessageDocument - return fmt.Sprintf("MessageDocument%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageDocument) TypeID() uint32 { - return MessageDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageDocument) TypeName() string { - return "messageDocument" -} - -// TypeInfo returns info about TL type. -func (m *MessageDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageDocument", - ID: MessageDocumentTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Document", - SchemaName: "document", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageDocument) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageDocument#2394ab77 as nil") - } - b.PutID(MessageDocumentTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageDocument) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageDocument#2394ab77 as nil") - } - if err := m.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageDocument#2394ab77: field document: %w", err) - } - if err := m.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageDocument#2394ab77: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageDocument) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageDocument#2394ab77 to nil") - } - if err := b.ConsumeID(MessageDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode messageDocument#2394ab77: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageDocument) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageDocument#2394ab77 to nil") - } - { - if err := m.Document.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageDocument#2394ab77: field document: %w", err) - } - } - { - if err := m.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageDocument#2394ab77: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageDocument#2394ab77 as nil") - } - b.ObjStart() - b.PutID("messageDocument") - b.Comma() - b.FieldStart("document") - if err := m.Document.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageDocument#2394ab77: field document: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := m.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageDocument#2394ab77: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageDocument#2394ab77 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageDocument"); err != nil { - return fmt.Errorf("unable to decode messageDocument#2394ab77: %w", err) - } - case "document": - if err := m.Document.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageDocument#2394ab77: field document: %w", err) - } - case "caption": - if err := m.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageDocument#2394ab77: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDocument returns value of Document field. -func (m *MessageDocument) GetDocument() (value Document) { - if m == nil { - return - } - return m.Document -} - -// GetCaption returns value of Caption field. -func (m *MessageDocument) GetCaption() (value FormattedText) { - if m == nil { - return - } - return m.Caption -} - -// MessagePaidMedia represents TL type `messagePaidMedia#3e5fd7c2`. -type MessagePaidMedia struct { - // Number of Telegram Stars needed to buy access to the media in the message - StarCount int64 - // Information about the media - Media []PaidMediaClass - // Media caption - Caption FormattedText - // True, if the caption must be shown above the media; otherwise, the caption must be - // shown below the media - ShowCaptionAboveMedia bool -} - -// MessagePaidMediaTypeID is TL type id of MessagePaidMedia. -const MessagePaidMediaTypeID = 0x3e5fd7c2 - -// construct implements constructor of MessageContentClass. -func (m MessagePaidMedia) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessagePaidMedia. -var ( - _ bin.Encoder = &MessagePaidMedia{} - _ bin.Decoder = &MessagePaidMedia{} - _ bin.BareEncoder = &MessagePaidMedia{} - _ bin.BareDecoder = &MessagePaidMedia{} - - _ MessageContentClass = &MessagePaidMedia{} -) - -func (m *MessagePaidMedia) Zero() bool { - if m == nil { - return true - } - if !(m.StarCount == 0) { - return false - } - if !(m.Media == nil) { - return false - } - if !(m.Caption.Zero()) { - return false - } - if !(m.ShowCaptionAboveMedia == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePaidMedia) String() string { - if m == nil { - return "MessagePaidMedia(nil)" - } - type Alias MessagePaidMedia - return fmt.Sprintf("MessagePaidMedia%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePaidMedia) TypeID() uint32 { - return MessagePaidMediaTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePaidMedia) TypeName() string { - return "messagePaidMedia" -} - -// TypeInfo returns info about TL type. -func (m *MessagePaidMedia) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePaidMedia", - ID: MessagePaidMediaTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "Media", - SchemaName: "media", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "ShowCaptionAboveMedia", - SchemaName: "show_caption_above_media", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePaidMedia) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePaidMedia#3e5fd7c2 as nil") - } - b.PutID(MessagePaidMediaTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePaidMedia) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePaidMedia#3e5fd7c2 as nil") - } - b.PutInt53(m.StarCount) - b.PutInt(len(m.Media)) - for idx, v := range m.Media { - if v == nil { - return fmt.Errorf("unable to encode messagePaidMedia#3e5fd7c2: field media element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messagePaidMedia#3e5fd7c2: field media element with index %d: %w", idx, err) - } - } - if err := m.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePaidMedia#3e5fd7c2: field caption: %w", err) - } - b.PutBool(m.ShowCaptionAboveMedia) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePaidMedia) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePaidMedia#3e5fd7c2 to nil") - } - if err := b.ConsumeID(MessagePaidMediaTypeID); err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePaidMedia) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePaidMedia#3e5fd7c2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: field star_count: %w", err) - } - m.StarCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: field media: %w", err) - } - - if headerLen > 0 { - m.Media = make([]PaidMediaClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: field media: %w", err) - } - m.Media = append(m.Media, value) - } - } - { - if err := m.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: field show_caption_above_media: %w", err) - } - m.ShowCaptionAboveMedia = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePaidMedia) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePaidMedia#3e5fd7c2 as nil") - } - b.ObjStart() - b.PutID("messagePaidMedia") - b.Comma() - b.FieldStart("star_count") - b.PutInt53(m.StarCount) - b.Comma() - b.FieldStart("media") - b.ArrStart() - for idx, v := range m.Media { - if v == nil { - return fmt.Errorf("unable to encode messagePaidMedia#3e5fd7c2: field media element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePaidMedia#3e5fd7c2: field media element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("caption") - if err := m.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePaidMedia#3e5fd7c2: field caption: %w", err) - } - b.Comma() - b.FieldStart("show_caption_above_media") - b.PutBool(m.ShowCaptionAboveMedia) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePaidMedia) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePaidMedia#3e5fd7c2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePaidMedia"); err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: field star_count: %w", err) - } - m.StarCount = value - case "media": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: field media: %w", err) - } - m.Media = append(m.Media, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: field media: %w", err) - } - case "caption": - if err := m.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: field caption: %w", err) - } - case "show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePaidMedia#3e5fd7c2: field show_caption_above_media: %w", err) - } - m.ShowCaptionAboveMedia = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarCount returns value of StarCount field. -func (m *MessagePaidMedia) GetStarCount() (value int64) { - if m == nil { - return - } - return m.StarCount -} - -// GetMedia returns value of Media field. -func (m *MessagePaidMedia) GetMedia() (value []PaidMediaClass) { - if m == nil { - return - } - return m.Media -} - -// GetCaption returns value of Caption field. -func (m *MessagePaidMedia) GetCaption() (value FormattedText) { - if m == nil { - return - } - return m.Caption -} - -// GetShowCaptionAboveMedia returns value of ShowCaptionAboveMedia field. -func (m *MessagePaidMedia) GetShowCaptionAboveMedia() (value bool) { - if m == nil { - return - } - return m.ShowCaptionAboveMedia -} - -// MessagePhoto represents TL type `messagePhoto#754c7e1f`. -type MessagePhoto struct { - // The photo - Photo Photo - // Photo caption - Caption FormattedText - // True, if the caption must be shown above the photo; otherwise, the caption must be - // shown below the photo - ShowCaptionAboveMedia bool - // True, if the photo preview must be covered by a spoiler animation - HasSpoiler bool - // True, if the photo must be blurred and must be shown only while tapped - IsSecret bool -} - -// MessagePhotoTypeID is TL type id of MessagePhoto. -const MessagePhotoTypeID = 0x754c7e1f - -// construct implements constructor of MessageContentClass. -func (m MessagePhoto) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessagePhoto. -var ( - _ bin.Encoder = &MessagePhoto{} - _ bin.Decoder = &MessagePhoto{} - _ bin.BareEncoder = &MessagePhoto{} - _ bin.BareDecoder = &MessagePhoto{} - - _ MessageContentClass = &MessagePhoto{} -) - -func (m *MessagePhoto) Zero() bool { - if m == nil { - return true - } - if !(m.Photo.Zero()) { - return false - } - if !(m.Caption.Zero()) { - return false - } - if !(m.ShowCaptionAboveMedia == false) { - return false - } - if !(m.HasSpoiler == false) { - return false - } - if !(m.IsSecret == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePhoto) String() string { - if m == nil { - return "MessagePhoto(nil)" - } - type Alias MessagePhoto - return fmt.Sprintf("MessagePhoto%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePhoto) TypeID() uint32 { - return MessagePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePhoto) TypeName() string { - return "messagePhoto" -} - -// TypeInfo returns info about TL type. -func (m *MessagePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePhoto", - ID: MessagePhotoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "ShowCaptionAboveMedia", - SchemaName: "show_caption_above_media", - }, - { - Name: "HasSpoiler", - SchemaName: "has_spoiler", - }, - { - Name: "IsSecret", - SchemaName: "is_secret", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePhoto) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePhoto#754c7e1f as nil") - } - b.PutID(MessagePhotoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePhoto) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePhoto#754c7e1f as nil") - } - if err := m.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePhoto#754c7e1f: field photo: %w", err) - } - if err := m.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePhoto#754c7e1f: field caption: %w", err) - } - b.PutBool(m.ShowCaptionAboveMedia) - b.PutBool(m.HasSpoiler) - b.PutBool(m.IsSecret) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePhoto) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePhoto#754c7e1f to nil") - } - if err := b.ConsumeID(MessagePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePhoto) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePhoto#754c7e1f to nil") - } - { - if err := m.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: field photo: %w", err) - } - } - { - if err := m.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: field show_caption_above_media: %w", err) - } - m.ShowCaptionAboveMedia = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: field has_spoiler: %w", err) - } - m.HasSpoiler = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: field is_secret: %w", err) - } - m.IsSecret = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePhoto#754c7e1f as nil") - } - b.ObjStart() - b.PutID("messagePhoto") - b.Comma() - b.FieldStart("photo") - if err := m.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePhoto#754c7e1f: field photo: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := m.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePhoto#754c7e1f: field caption: %w", err) - } - b.Comma() - b.FieldStart("show_caption_above_media") - b.PutBool(m.ShowCaptionAboveMedia) - b.Comma() - b.FieldStart("has_spoiler") - b.PutBool(m.HasSpoiler) - b.Comma() - b.FieldStart("is_secret") - b.PutBool(m.IsSecret) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePhoto#754c7e1f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePhoto"); err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: %w", err) - } - case "photo": - if err := m.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: field photo: %w", err) - } - case "caption": - if err := m.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: field caption: %w", err) - } - case "show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: field show_caption_above_media: %w", err) - } - m.ShowCaptionAboveMedia = value - case "has_spoiler": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: field has_spoiler: %w", err) - } - m.HasSpoiler = value - case "is_secret": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePhoto#754c7e1f: field is_secret: %w", err) - } - m.IsSecret = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (m *MessagePhoto) GetPhoto() (value Photo) { - if m == nil { - return - } - return m.Photo -} - -// GetCaption returns value of Caption field. -func (m *MessagePhoto) GetCaption() (value FormattedText) { - if m == nil { - return - } - return m.Caption -} - -// GetShowCaptionAboveMedia returns value of ShowCaptionAboveMedia field. -func (m *MessagePhoto) GetShowCaptionAboveMedia() (value bool) { - if m == nil { - return - } - return m.ShowCaptionAboveMedia -} - -// GetHasSpoiler returns value of HasSpoiler field. -func (m *MessagePhoto) GetHasSpoiler() (value bool) { - if m == nil { - return - } - return m.HasSpoiler -} - -// GetIsSecret returns value of IsSecret field. -func (m *MessagePhoto) GetIsSecret() (value bool) { - if m == nil { - return - } - return m.IsSecret -} - -// MessageSticker represents TL type `messageSticker#e5f0dcca`. -type MessageSticker struct { - // The sticker description - Sticker Sticker - // True, if premium animation of the sticker must be played - IsPremium bool -} - -// MessageStickerTypeID is TL type id of MessageSticker. -const MessageStickerTypeID = 0xe5f0dcca - -// construct implements constructor of MessageContentClass. -func (m MessageSticker) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageSticker. -var ( - _ bin.Encoder = &MessageSticker{} - _ bin.Decoder = &MessageSticker{} - _ bin.BareEncoder = &MessageSticker{} - _ bin.BareDecoder = &MessageSticker{} - - _ MessageContentClass = &MessageSticker{} -) - -func (m *MessageSticker) Zero() bool { - if m == nil { - return true - } - if !(m.Sticker.Zero()) { - return false - } - if !(m.IsPremium == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSticker) String() string { - if m == nil { - return "MessageSticker(nil)" - } - type Alias MessageSticker - return fmt.Sprintf("MessageSticker%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSticker) TypeID() uint32 { - return MessageStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSticker) TypeName() string { - return "messageSticker" -} - -// TypeInfo returns info about TL type. -func (m *MessageSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSticker", - ID: MessageStickerTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "IsPremium", - SchemaName: "is_premium", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSticker) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSticker#e5f0dcca as nil") - } - b.PutID(MessageStickerTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSticker) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSticker#e5f0dcca as nil") - } - if err := m.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageSticker#e5f0dcca: field sticker: %w", err) - } - b.PutBool(m.IsPremium) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSticker) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSticker#e5f0dcca to nil") - } - if err := b.ConsumeID(MessageStickerTypeID); err != nil { - return fmt.Errorf("unable to decode messageSticker#e5f0dcca: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSticker) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSticker#e5f0dcca to nil") - } - { - if err := m.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageSticker#e5f0dcca: field sticker: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSticker#e5f0dcca: field is_premium: %w", err) - } - m.IsPremium = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSticker#e5f0dcca as nil") - } - b.ObjStart() - b.PutID("messageSticker") - b.Comma() - b.FieldStart("sticker") - if err := m.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageSticker#e5f0dcca: field sticker: %w", err) - } - b.Comma() - b.FieldStart("is_premium") - b.PutBool(m.IsPremium) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSticker#e5f0dcca to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSticker"); err != nil { - return fmt.Errorf("unable to decode messageSticker#e5f0dcca: %w", err) - } - case "sticker": - if err := m.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageSticker#e5f0dcca: field sticker: %w", err) - } - case "is_premium": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSticker#e5f0dcca: field is_premium: %w", err) - } - m.IsPremium = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (m *MessageSticker) GetSticker() (value Sticker) { - if m == nil { - return - } - return m.Sticker -} - -// GetIsPremium returns value of IsPremium field. -func (m *MessageSticker) GetIsPremium() (value bool) { - if m == nil { - return - } - return m.IsPremium -} - -// MessageVideo represents TL type `messageVideo#fdcc35d5`. -type MessageVideo struct { - // The video description - Video Video - // Alternative qualities of the video - AlternativeVideos []AlternativeVideo - // Video caption - Caption FormattedText - // True, if the caption must be shown above the video; otherwise, the caption must be - // shown below the video - ShowCaptionAboveMedia bool - // True, if the video preview must be covered by a spoiler animation - HasSpoiler bool - // True, if the video thumbnail must be blurred and the video must be shown only while - // tapped - IsSecret bool -} - -// MessageVideoTypeID is TL type id of MessageVideo. -const MessageVideoTypeID = 0xfdcc35d5 - -// construct implements constructor of MessageContentClass. -func (m MessageVideo) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageVideo. -var ( - _ bin.Encoder = &MessageVideo{} - _ bin.Decoder = &MessageVideo{} - _ bin.BareEncoder = &MessageVideo{} - _ bin.BareDecoder = &MessageVideo{} - - _ MessageContentClass = &MessageVideo{} -) - -func (m *MessageVideo) Zero() bool { - if m == nil { - return true - } - if !(m.Video.Zero()) { - return false - } - if !(m.AlternativeVideos == nil) { - return false - } - if !(m.Caption.Zero()) { - return false - } - if !(m.ShowCaptionAboveMedia == false) { - return false - } - if !(m.HasSpoiler == false) { - return false - } - if !(m.IsSecret == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageVideo) String() string { - if m == nil { - return "MessageVideo(nil)" - } - type Alias MessageVideo - return fmt.Sprintf("MessageVideo%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageVideo) TypeID() uint32 { - return MessageVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageVideo) TypeName() string { - return "messageVideo" -} - -// TypeInfo returns info about TL type. -func (m *MessageVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageVideo", - ID: MessageVideoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Video", - SchemaName: "video", - }, - { - Name: "AlternativeVideos", - SchemaName: "alternative_videos", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "ShowCaptionAboveMedia", - SchemaName: "show_caption_above_media", - }, - { - Name: "HasSpoiler", - SchemaName: "has_spoiler", - }, - { - Name: "IsSecret", - SchemaName: "is_secret", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageVideo) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVideo#fdcc35d5 as nil") - } - b.PutID(MessageVideoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageVideo) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVideo#fdcc35d5 as nil") - } - if err := m.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageVideo#fdcc35d5: field video: %w", err) - } - b.PutInt(len(m.AlternativeVideos)) - for idx, v := range m.AlternativeVideos { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messageVideo#fdcc35d5: field alternative_videos element with index %d: %w", idx, err) - } - } - if err := m.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageVideo#fdcc35d5: field caption: %w", err) - } - b.PutBool(m.ShowCaptionAboveMedia) - b.PutBool(m.HasSpoiler) - b.PutBool(m.IsSecret) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageVideo) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVideo#fdcc35d5 to nil") - } - if err := b.ConsumeID(MessageVideoTypeID); err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageVideo) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVideo#fdcc35d5 to nil") - } - { - if err := m.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field video: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field alternative_videos: %w", err) - } - - if headerLen > 0 { - m.AlternativeVideos = make([]AlternativeVideo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value AlternativeVideo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare messageVideo#fdcc35d5: field alternative_videos: %w", err) - } - m.AlternativeVideos = append(m.AlternativeVideos, value) - } - } - { - if err := m.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field show_caption_above_media: %w", err) - } - m.ShowCaptionAboveMedia = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field has_spoiler: %w", err) - } - m.HasSpoiler = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field is_secret: %w", err) - } - m.IsSecret = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageVideo#fdcc35d5 as nil") - } - b.ObjStart() - b.PutID("messageVideo") - b.Comma() - b.FieldStart("video") - if err := m.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageVideo#fdcc35d5: field video: %w", err) - } - b.Comma() - b.FieldStart("alternative_videos") - b.ArrStart() - for idx, v := range m.AlternativeVideos { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageVideo#fdcc35d5: field alternative_videos element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("caption") - if err := m.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageVideo#fdcc35d5: field caption: %w", err) - } - b.Comma() - b.FieldStart("show_caption_above_media") - b.PutBool(m.ShowCaptionAboveMedia) - b.Comma() - b.FieldStart("has_spoiler") - b.PutBool(m.HasSpoiler) - b.Comma() - b.FieldStart("is_secret") - b.PutBool(m.IsSecret) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageVideo#fdcc35d5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageVideo"); err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: %w", err) - } - case "video": - if err := m.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field video: %w", err) - } - case "alternative_videos": - if err := b.Arr(func(b tdjson.Decoder) error { - var value AlternativeVideo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field alternative_videos: %w", err) - } - m.AlternativeVideos = append(m.AlternativeVideos, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field alternative_videos: %w", err) - } - case "caption": - if err := m.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field caption: %w", err) - } - case "show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field show_caption_above_media: %w", err) - } - m.ShowCaptionAboveMedia = value - case "has_spoiler": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field has_spoiler: %w", err) - } - m.HasSpoiler = value - case "is_secret": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVideo#fdcc35d5: field is_secret: %w", err) - } - m.IsSecret = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVideo returns value of Video field. -func (m *MessageVideo) GetVideo() (value Video) { - if m == nil { - return - } - return m.Video -} - -// GetAlternativeVideos returns value of AlternativeVideos field. -func (m *MessageVideo) GetAlternativeVideos() (value []AlternativeVideo) { - if m == nil { - return - } - return m.AlternativeVideos -} - -// GetCaption returns value of Caption field. -func (m *MessageVideo) GetCaption() (value FormattedText) { - if m == nil { - return - } - return m.Caption -} - -// GetShowCaptionAboveMedia returns value of ShowCaptionAboveMedia field. -func (m *MessageVideo) GetShowCaptionAboveMedia() (value bool) { - if m == nil { - return - } - return m.ShowCaptionAboveMedia -} - -// GetHasSpoiler returns value of HasSpoiler field. -func (m *MessageVideo) GetHasSpoiler() (value bool) { - if m == nil { - return - } - return m.HasSpoiler -} - -// GetIsSecret returns value of IsSecret field. -func (m *MessageVideo) GetIsSecret() (value bool) { - if m == nil { - return - } - return m.IsSecret -} - -// MessageVideoNote represents TL type `messageVideoNote#396b2486`. -type MessageVideoNote struct { - // The video note description - VideoNote VideoNote - // True, if at least one of the recipients has viewed the video note - IsViewed bool - // True, if the video note thumbnail must be blurred and the video note must be shown - // only while tapped - IsSecret bool -} - -// MessageVideoNoteTypeID is TL type id of MessageVideoNote. -const MessageVideoNoteTypeID = 0x396b2486 - -// construct implements constructor of MessageContentClass. -func (m MessageVideoNote) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageVideoNote. -var ( - _ bin.Encoder = &MessageVideoNote{} - _ bin.Decoder = &MessageVideoNote{} - _ bin.BareEncoder = &MessageVideoNote{} - _ bin.BareDecoder = &MessageVideoNote{} - - _ MessageContentClass = &MessageVideoNote{} -) - -func (m *MessageVideoNote) Zero() bool { - if m == nil { - return true - } - if !(m.VideoNote.Zero()) { - return false - } - if !(m.IsViewed == false) { - return false - } - if !(m.IsSecret == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageVideoNote) String() string { - if m == nil { - return "MessageVideoNote(nil)" - } - type Alias MessageVideoNote - return fmt.Sprintf("MessageVideoNote%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageVideoNote) TypeID() uint32 { - return MessageVideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageVideoNote) TypeName() string { - return "messageVideoNote" -} - -// TypeInfo returns info about TL type. -func (m *MessageVideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageVideoNote", - ID: MessageVideoNoteTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VideoNote", - SchemaName: "video_note", - }, - { - Name: "IsViewed", - SchemaName: "is_viewed", - }, - { - Name: "IsSecret", - SchemaName: "is_secret", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageVideoNote) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoNote#396b2486 as nil") - } - b.PutID(MessageVideoNoteTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageVideoNote) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoNote#396b2486 as nil") - } - if err := m.VideoNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageVideoNote#396b2486: field video_note: %w", err) - } - b.PutBool(m.IsViewed) - b.PutBool(m.IsSecret) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageVideoNote) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoNote#396b2486 to nil") - } - if err := b.ConsumeID(MessageVideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode messageVideoNote#396b2486: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageVideoNote) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoNote#396b2486 to nil") - } - { - if err := m.VideoNote.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageVideoNote#396b2486: field video_note: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVideoNote#396b2486: field is_viewed: %w", err) - } - m.IsViewed = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVideoNote#396b2486: field is_secret: %w", err) - } - m.IsSecret = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoNote#396b2486 as nil") - } - b.ObjStart() - b.PutID("messageVideoNote") - b.Comma() - b.FieldStart("video_note") - if err := m.VideoNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageVideoNote#396b2486: field video_note: %w", err) - } - b.Comma() - b.FieldStart("is_viewed") - b.PutBool(m.IsViewed) - b.Comma() - b.FieldStart("is_secret") - b.PutBool(m.IsSecret) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoNote#396b2486 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageVideoNote"); err != nil { - return fmt.Errorf("unable to decode messageVideoNote#396b2486: %w", err) - } - case "video_note": - if err := m.VideoNote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageVideoNote#396b2486: field video_note: %w", err) - } - case "is_viewed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVideoNote#396b2486: field is_viewed: %w", err) - } - m.IsViewed = value - case "is_secret": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVideoNote#396b2486: field is_secret: %w", err) - } - m.IsSecret = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVideoNote returns value of VideoNote field. -func (m *MessageVideoNote) GetVideoNote() (value VideoNote) { - if m == nil { - return - } - return m.VideoNote -} - -// GetIsViewed returns value of IsViewed field. -func (m *MessageVideoNote) GetIsViewed() (value bool) { - if m == nil { - return - } - return m.IsViewed -} - -// GetIsSecret returns value of IsSecret field. -func (m *MessageVideoNote) GetIsSecret() (value bool) { - if m == nil { - return - } - return m.IsSecret -} - -// MessageVoiceNote represents TL type `messageVoiceNote#1f753ff5`. -type MessageVoiceNote struct { - // The voice note description - VoiceNote VoiceNote - // Voice note caption - Caption FormattedText - // True, if at least one of the recipients has listened to the voice note - IsListened bool -} - -// MessageVoiceNoteTypeID is TL type id of MessageVoiceNote. -const MessageVoiceNoteTypeID = 0x1f753ff5 - -// construct implements constructor of MessageContentClass. -func (m MessageVoiceNote) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageVoiceNote. -var ( - _ bin.Encoder = &MessageVoiceNote{} - _ bin.Decoder = &MessageVoiceNote{} - _ bin.BareEncoder = &MessageVoiceNote{} - _ bin.BareDecoder = &MessageVoiceNote{} - - _ MessageContentClass = &MessageVoiceNote{} -) - -func (m *MessageVoiceNote) Zero() bool { - if m == nil { - return true - } - if !(m.VoiceNote.Zero()) { - return false - } - if !(m.Caption.Zero()) { - return false - } - if !(m.IsListened == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageVoiceNote) String() string { - if m == nil { - return "MessageVoiceNote(nil)" - } - type Alias MessageVoiceNote - return fmt.Sprintf("MessageVoiceNote%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageVoiceNote) TypeID() uint32 { - return MessageVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageVoiceNote) TypeName() string { - return "messageVoiceNote" -} - -// TypeInfo returns info about TL type. -func (m *MessageVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageVoiceNote", - ID: MessageVoiceNoteTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VoiceNote", - SchemaName: "voice_note", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "IsListened", - SchemaName: "is_listened", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageVoiceNote) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVoiceNote#1f753ff5 as nil") - } - b.PutID(MessageVoiceNoteTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageVoiceNote) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVoiceNote#1f753ff5 as nil") - } - if err := m.VoiceNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageVoiceNote#1f753ff5: field voice_note: %w", err) - } - if err := m.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageVoiceNote#1f753ff5: field caption: %w", err) - } - b.PutBool(m.IsListened) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageVoiceNote) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVoiceNote#1f753ff5 to nil") - } - if err := b.ConsumeID(MessageVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode messageVoiceNote#1f753ff5: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageVoiceNote) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVoiceNote#1f753ff5 to nil") - } - { - if err := m.VoiceNote.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageVoiceNote#1f753ff5: field voice_note: %w", err) - } - } - { - if err := m.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageVoiceNote#1f753ff5: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVoiceNote#1f753ff5: field is_listened: %w", err) - } - m.IsListened = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageVoiceNote#1f753ff5 as nil") - } - b.ObjStart() - b.PutID("messageVoiceNote") - b.Comma() - b.FieldStart("voice_note") - if err := m.VoiceNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageVoiceNote#1f753ff5: field voice_note: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := m.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageVoiceNote#1f753ff5: field caption: %w", err) - } - b.Comma() - b.FieldStart("is_listened") - b.PutBool(m.IsListened) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageVoiceNote#1f753ff5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageVoiceNote"); err != nil { - return fmt.Errorf("unable to decode messageVoiceNote#1f753ff5: %w", err) - } - case "voice_note": - if err := m.VoiceNote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageVoiceNote#1f753ff5: field voice_note: %w", err) - } - case "caption": - if err := m.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageVoiceNote#1f753ff5: field caption: %w", err) - } - case "is_listened": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageVoiceNote#1f753ff5: field is_listened: %w", err) - } - m.IsListened = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVoiceNote returns value of VoiceNote field. -func (m *MessageVoiceNote) GetVoiceNote() (value VoiceNote) { - if m == nil { - return - } - return m.VoiceNote -} - -// GetCaption returns value of Caption field. -func (m *MessageVoiceNote) GetCaption() (value FormattedText) { - if m == nil { - return - } - return m.Caption -} - -// GetIsListened returns value of IsListened field. -func (m *MessageVoiceNote) GetIsListened() (value bool) { - if m == nil { - return - } - return m.IsListened -} - -// MessageExpiredPhoto represents TL type `messageExpiredPhoto#ac46ddf7`. -type MessageExpiredPhoto struct { -} - -// MessageExpiredPhotoTypeID is TL type id of MessageExpiredPhoto. -const MessageExpiredPhotoTypeID = 0xac46ddf7 - -// construct implements constructor of MessageContentClass. -func (m MessageExpiredPhoto) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageExpiredPhoto. -var ( - _ bin.Encoder = &MessageExpiredPhoto{} - _ bin.Decoder = &MessageExpiredPhoto{} - _ bin.BareEncoder = &MessageExpiredPhoto{} - _ bin.BareDecoder = &MessageExpiredPhoto{} - - _ MessageContentClass = &MessageExpiredPhoto{} -) - -func (m *MessageExpiredPhoto) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageExpiredPhoto) String() string { - if m == nil { - return "MessageExpiredPhoto(nil)" - } - type Alias MessageExpiredPhoto - return fmt.Sprintf("MessageExpiredPhoto%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageExpiredPhoto) TypeID() uint32 { - return MessageExpiredPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageExpiredPhoto) TypeName() string { - return "messageExpiredPhoto" -} - -// TypeInfo returns info about TL type. -func (m *MessageExpiredPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageExpiredPhoto", - ID: MessageExpiredPhotoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageExpiredPhoto) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredPhoto#ac46ddf7 as nil") - } - b.PutID(MessageExpiredPhotoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageExpiredPhoto) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredPhoto#ac46ddf7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageExpiredPhoto) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredPhoto#ac46ddf7 to nil") - } - if err := b.ConsumeID(MessageExpiredPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode messageExpiredPhoto#ac46ddf7: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageExpiredPhoto) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredPhoto#ac46ddf7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageExpiredPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredPhoto#ac46ddf7 as nil") - } - b.ObjStart() - b.PutID("messageExpiredPhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageExpiredPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredPhoto#ac46ddf7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageExpiredPhoto"); err != nil { - return fmt.Errorf("unable to decode messageExpiredPhoto#ac46ddf7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageExpiredVideo represents TL type `messageExpiredVideo#b7bf24c3`. -type MessageExpiredVideo struct { -} - -// MessageExpiredVideoTypeID is TL type id of MessageExpiredVideo. -const MessageExpiredVideoTypeID = 0xb7bf24c3 - -// construct implements constructor of MessageContentClass. -func (m MessageExpiredVideo) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageExpiredVideo. -var ( - _ bin.Encoder = &MessageExpiredVideo{} - _ bin.Decoder = &MessageExpiredVideo{} - _ bin.BareEncoder = &MessageExpiredVideo{} - _ bin.BareDecoder = &MessageExpiredVideo{} - - _ MessageContentClass = &MessageExpiredVideo{} -) - -func (m *MessageExpiredVideo) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageExpiredVideo) String() string { - if m == nil { - return "MessageExpiredVideo(nil)" - } - type Alias MessageExpiredVideo - return fmt.Sprintf("MessageExpiredVideo%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageExpiredVideo) TypeID() uint32 { - return MessageExpiredVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageExpiredVideo) TypeName() string { - return "messageExpiredVideo" -} - -// TypeInfo returns info about TL type. -func (m *MessageExpiredVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageExpiredVideo", - ID: MessageExpiredVideoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageExpiredVideo) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredVideo#b7bf24c3 as nil") - } - b.PutID(MessageExpiredVideoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageExpiredVideo) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredVideo#b7bf24c3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageExpiredVideo) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredVideo#b7bf24c3 to nil") - } - if err := b.ConsumeID(MessageExpiredVideoTypeID); err != nil { - return fmt.Errorf("unable to decode messageExpiredVideo#b7bf24c3: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageExpiredVideo) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredVideo#b7bf24c3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageExpiredVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredVideo#b7bf24c3 as nil") - } - b.ObjStart() - b.PutID("messageExpiredVideo") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageExpiredVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredVideo#b7bf24c3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageExpiredVideo"); err != nil { - return fmt.Errorf("unable to decode messageExpiredVideo#b7bf24c3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageExpiredVideoNote represents TL type `messageExpiredVideoNote#23bc43e7`. -type MessageExpiredVideoNote struct { -} - -// MessageExpiredVideoNoteTypeID is TL type id of MessageExpiredVideoNote. -const MessageExpiredVideoNoteTypeID = 0x23bc43e7 - -// construct implements constructor of MessageContentClass. -func (m MessageExpiredVideoNote) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageExpiredVideoNote. -var ( - _ bin.Encoder = &MessageExpiredVideoNote{} - _ bin.Decoder = &MessageExpiredVideoNote{} - _ bin.BareEncoder = &MessageExpiredVideoNote{} - _ bin.BareDecoder = &MessageExpiredVideoNote{} - - _ MessageContentClass = &MessageExpiredVideoNote{} -) - -func (m *MessageExpiredVideoNote) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageExpiredVideoNote) String() string { - if m == nil { - return "MessageExpiredVideoNote(nil)" - } - type Alias MessageExpiredVideoNote - return fmt.Sprintf("MessageExpiredVideoNote%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageExpiredVideoNote) TypeID() uint32 { - return MessageExpiredVideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageExpiredVideoNote) TypeName() string { - return "messageExpiredVideoNote" -} - -// TypeInfo returns info about TL type. -func (m *MessageExpiredVideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageExpiredVideoNote", - ID: MessageExpiredVideoNoteTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageExpiredVideoNote) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredVideoNote#23bc43e7 as nil") - } - b.PutID(MessageExpiredVideoNoteTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageExpiredVideoNote) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredVideoNote#23bc43e7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageExpiredVideoNote) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredVideoNote#23bc43e7 to nil") - } - if err := b.ConsumeID(MessageExpiredVideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode messageExpiredVideoNote#23bc43e7: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageExpiredVideoNote) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredVideoNote#23bc43e7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageExpiredVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredVideoNote#23bc43e7 as nil") - } - b.ObjStart() - b.PutID("messageExpiredVideoNote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageExpiredVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredVideoNote#23bc43e7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageExpiredVideoNote"); err != nil { - return fmt.Errorf("unable to decode messageExpiredVideoNote#23bc43e7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageExpiredVoiceNote represents TL type `messageExpiredVoiceNote#890757d`. -type MessageExpiredVoiceNote struct { -} - -// MessageExpiredVoiceNoteTypeID is TL type id of MessageExpiredVoiceNote. -const MessageExpiredVoiceNoteTypeID = 0x890757d - -// construct implements constructor of MessageContentClass. -func (m MessageExpiredVoiceNote) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageExpiredVoiceNote. -var ( - _ bin.Encoder = &MessageExpiredVoiceNote{} - _ bin.Decoder = &MessageExpiredVoiceNote{} - _ bin.BareEncoder = &MessageExpiredVoiceNote{} - _ bin.BareDecoder = &MessageExpiredVoiceNote{} - - _ MessageContentClass = &MessageExpiredVoiceNote{} -) - -func (m *MessageExpiredVoiceNote) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageExpiredVoiceNote) String() string { - if m == nil { - return "MessageExpiredVoiceNote(nil)" - } - type Alias MessageExpiredVoiceNote - return fmt.Sprintf("MessageExpiredVoiceNote%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageExpiredVoiceNote) TypeID() uint32 { - return MessageExpiredVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageExpiredVoiceNote) TypeName() string { - return "messageExpiredVoiceNote" -} - -// TypeInfo returns info about TL type. -func (m *MessageExpiredVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageExpiredVoiceNote", - ID: MessageExpiredVoiceNoteTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageExpiredVoiceNote) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredVoiceNote#890757d as nil") - } - b.PutID(MessageExpiredVoiceNoteTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageExpiredVoiceNote) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredVoiceNote#890757d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageExpiredVoiceNote) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredVoiceNote#890757d to nil") - } - if err := b.ConsumeID(MessageExpiredVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode messageExpiredVoiceNote#890757d: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageExpiredVoiceNote) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredVoiceNote#890757d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageExpiredVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageExpiredVoiceNote#890757d as nil") - } - b.ObjStart() - b.PutID("messageExpiredVoiceNote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageExpiredVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageExpiredVoiceNote#890757d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageExpiredVoiceNote"); err != nil { - return fmt.Errorf("unable to decode messageExpiredVoiceNote#890757d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageLocation represents TL type `messageLocation#121e4474`. -type MessageLocation struct { - // The location description - Location Location - // Time relative to the message send date, for which the location can be updated, in - // seconds; if 0x7FFFFFFF, then location can be updated forever - LivePeriod int32 - // Left time for which the location can be updated, in seconds. If 0, then the location - // can't be updated anymore. The update updateMessageContent is not sent when this field - // changes - ExpiresIn int32 - // For live locations, a direction in which the location moves, in degrees; 1-360. If 0 - // the direction is unknown - Heading int32 - // For live locations, a maximum distance to another chat member for proximity alerts, in - // meters (0-100000). 0 if the notification is disabled. Available only to the message - // sender - ProximityAlertRadius int32 -} - -// MessageLocationTypeID is TL type id of MessageLocation. -const MessageLocationTypeID = 0x121e4474 - -// construct implements constructor of MessageContentClass. -func (m MessageLocation) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageLocation. -var ( - _ bin.Encoder = &MessageLocation{} - _ bin.Decoder = &MessageLocation{} - _ bin.BareEncoder = &MessageLocation{} - _ bin.BareDecoder = &MessageLocation{} - - _ MessageContentClass = &MessageLocation{} -) - -func (m *MessageLocation) Zero() bool { - if m == nil { - return true - } - if !(m.Location.Zero()) { - return false - } - if !(m.LivePeriod == 0) { - return false - } - if !(m.ExpiresIn == 0) { - return false - } - if !(m.Heading == 0) { - return false - } - if !(m.ProximityAlertRadius == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageLocation) String() string { - if m == nil { - return "MessageLocation(nil)" - } - type Alias MessageLocation - return fmt.Sprintf("MessageLocation%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageLocation) TypeID() uint32 { - return MessageLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageLocation) TypeName() string { - return "messageLocation" -} - -// TypeInfo returns info about TL type. -func (m *MessageLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageLocation", - ID: MessageLocationTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "LivePeriod", - SchemaName: "live_period", - }, - { - Name: "ExpiresIn", - SchemaName: "expires_in", - }, - { - Name: "Heading", - SchemaName: "heading", - }, - { - Name: "ProximityAlertRadius", - SchemaName: "proximity_alert_radius", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageLocation) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageLocation#121e4474 as nil") - } - b.PutID(MessageLocationTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageLocation) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageLocation#121e4474 as nil") - } - if err := m.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageLocation#121e4474: field location: %w", err) - } - b.PutInt32(m.LivePeriod) - b.PutInt32(m.ExpiresIn) - b.PutInt32(m.Heading) - b.PutInt32(m.ProximityAlertRadius) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageLocation) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageLocation#121e4474 to nil") - } - if err := b.ConsumeID(MessageLocationTypeID); err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageLocation) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageLocation#121e4474 to nil") - } - { - if err := m.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: field location: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: field live_period: %w", err) - } - m.LivePeriod = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: field expires_in: %w", err) - } - m.ExpiresIn = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: field heading: %w", err) - } - m.Heading = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: field proximity_alert_radius: %w", err) - } - m.ProximityAlertRadius = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageLocation) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageLocation#121e4474 as nil") - } - b.ObjStart() - b.PutID("messageLocation") - b.Comma() - b.FieldStart("location") - if err := m.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageLocation#121e4474: field location: %w", err) - } - b.Comma() - b.FieldStart("live_period") - b.PutInt32(m.LivePeriod) - b.Comma() - b.FieldStart("expires_in") - b.PutInt32(m.ExpiresIn) - b.Comma() - b.FieldStart("heading") - b.PutInt32(m.Heading) - b.Comma() - b.FieldStart("proximity_alert_radius") - b.PutInt32(m.ProximityAlertRadius) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageLocation) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageLocation#121e4474 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageLocation"); err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: %w", err) - } - case "location": - if err := m.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: field location: %w", err) - } - case "live_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: field live_period: %w", err) - } - m.LivePeriod = value - case "expires_in": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: field expires_in: %w", err) - } - m.ExpiresIn = value - case "heading": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: field heading: %w", err) - } - m.Heading = value - case "proximity_alert_radius": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageLocation#121e4474: field proximity_alert_radius: %w", err) - } - m.ProximityAlertRadius = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (m *MessageLocation) GetLocation() (value Location) { - if m == nil { - return - } - return m.Location -} - -// GetLivePeriod returns value of LivePeriod field. -func (m *MessageLocation) GetLivePeriod() (value int32) { - if m == nil { - return - } - return m.LivePeriod -} - -// GetExpiresIn returns value of ExpiresIn field. -func (m *MessageLocation) GetExpiresIn() (value int32) { - if m == nil { - return - } - return m.ExpiresIn -} - -// GetHeading returns value of Heading field. -func (m *MessageLocation) GetHeading() (value int32) { - if m == nil { - return - } - return m.Heading -} - -// GetProximityAlertRadius returns value of ProximityAlertRadius field. -func (m *MessageLocation) GetProximityAlertRadius() (value int32) { - if m == nil { - return - } - return m.ProximityAlertRadius -} - -// MessageVenue represents TL type `messageVenue#800f2175`. -type MessageVenue struct { - // The venue description - Venue Venue -} - -// MessageVenueTypeID is TL type id of MessageVenue. -const MessageVenueTypeID = 0x800f2175 - -// construct implements constructor of MessageContentClass. -func (m MessageVenue) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageVenue. -var ( - _ bin.Encoder = &MessageVenue{} - _ bin.Decoder = &MessageVenue{} - _ bin.BareEncoder = &MessageVenue{} - _ bin.BareDecoder = &MessageVenue{} - - _ MessageContentClass = &MessageVenue{} -) - -func (m *MessageVenue) Zero() bool { - if m == nil { - return true - } - if !(m.Venue.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageVenue) String() string { - if m == nil { - return "MessageVenue(nil)" - } - type Alias MessageVenue - return fmt.Sprintf("MessageVenue%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageVenue) TypeID() uint32 { - return MessageVenueTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageVenue) TypeName() string { - return "messageVenue" -} - -// TypeInfo returns info about TL type. -func (m *MessageVenue) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageVenue", - ID: MessageVenueTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Venue", - SchemaName: "venue", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageVenue) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVenue#800f2175 as nil") - } - b.PutID(MessageVenueTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageVenue) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVenue#800f2175 as nil") - } - if err := m.Venue.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageVenue#800f2175: field venue: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageVenue) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVenue#800f2175 to nil") - } - if err := b.ConsumeID(MessageVenueTypeID); err != nil { - return fmt.Errorf("unable to decode messageVenue#800f2175: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageVenue) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVenue#800f2175 to nil") - } - { - if err := m.Venue.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageVenue#800f2175: field venue: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageVenue) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageVenue#800f2175 as nil") - } - b.ObjStart() - b.PutID("messageVenue") - b.Comma() - b.FieldStart("venue") - if err := m.Venue.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageVenue#800f2175: field venue: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageVenue) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageVenue#800f2175 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageVenue"); err != nil { - return fmt.Errorf("unable to decode messageVenue#800f2175: %w", err) - } - case "venue": - if err := m.Venue.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageVenue#800f2175: field venue: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetVenue returns value of Venue field. -func (m *MessageVenue) GetVenue() (value Venue) { - if m == nil { - return - } - return m.Venue -} - -// MessageContact represents TL type `messageContact#e1710c5a`. -type MessageContact struct { - // The contact description - Contact Contact -} - -// MessageContactTypeID is TL type id of MessageContact. -const MessageContactTypeID = 0xe1710c5a - -// construct implements constructor of MessageContentClass. -func (m MessageContact) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageContact. -var ( - _ bin.Encoder = &MessageContact{} - _ bin.Decoder = &MessageContact{} - _ bin.BareEncoder = &MessageContact{} - _ bin.BareDecoder = &MessageContact{} - - _ MessageContentClass = &MessageContact{} -) - -func (m *MessageContact) Zero() bool { - if m == nil { - return true - } - if !(m.Contact.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageContact) String() string { - if m == nil { - return "MessageContact(nil)" - } - type Alias MessageContact - return fmt.Sprintf("MessageContact%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageContact) TypeID() uint32 { - return MessageContactTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageContact) TypeName() string { - return "messageContact" -} - -// TypeInfo returns info about TL type. -func (m *MessageContact) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageContact", - ID: MessageContactTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Contact", - SchemaName: "contact", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageContact) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageContact#e1710c5a as nil") - } - b.PutID(MessageContactTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageContact) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageContact#e1710c5a as nil") - } - if err := m.Contact.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageContact#e1710c5a: field contact: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageContact) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageContact#e1710c5a to nil") - } - if err := b.ConsumeID(MessageContactTypeID); err != nil { - return fmt.Errorf("unable to decode messageContact#e1710c5a: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageContact) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageContact#e1710c5a to nil") - } - { - if err := m.Contact.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageContact#e1710c5a: field contact: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageContact) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageContact#e1710c5a as nil") - } - b.ObjStart() - b.PutID("messageContact") - b.Comma() - b.FieldStart("contact") - if err := m.Contact.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageContact#e1710c5a: field contact: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageContact) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageContact#e1710c5a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageContact"); err != nil { - return fmt.Errorf("unable to decode messageContact#e1710c5a: %w", err) - } - case "contact": - if err := m.Contact.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageContact#e1710c5a: field contact: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetContact returns value of Contact field. -func (m *MessageContact) GetContact() (value Contact) { - if m == nil { - return - } - return m.Contact -} - -// MessageAnimatedEmoji represents TL type `messageAnimatedEmoji#3621f5e2`. -type MessageAnimatedEmoji struct { - // The animated emoji - AnimatedEmoji AnimatedEmoji - // The corresponding emoji - Emoji string -} - -// MessageAnimatedEmojiTypeID is TL type id of MessageAnimatedEmoji. -const MessageAnimatedEmojiTypeID = 0x3621f5e2 - -// construct implements constructor of MessageContentClass. -func (m MessageAnimatedEmoji) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageAnimatedEmoji. -var ( - _ bin.Encoder = &MessageAnimatedEmoji{} - _ bin.Decoder = &MessageAnimatedEmoji{} - _ bin.BareEncoder = &MessageAnimatedEmoji{} - _ bin.BareDecoder = &MessageAnimatedEmoji{} - - _ MessageContentClass = &MessageAnimatedEmoji{} -) - -func (m *MessageAnimatedEmoji) Zero() bool { - if m == nil { - return true - } - if !(m.AnimatedEmoji.Zero()) { - return false - } - if !(m.Emoji == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageAnimatedEmoji) String() string { - if m == nil { - return "MessageAnimatedEmoji(nil)" - } - type Alias MessageAnimatedEmoji - return fmt.Sprintf("MessageAnimatedEmoji%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageAnimatedEmoji) TypeID() uint32 { - return MessageAnimatedEmojiTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageAnimatedEmoji) TypeName() string { - return "messageAnimatedEmoji" -} - -// TypeInfo returns info about TL type. -func (m *MessageAnimatedEmoji) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageAnimatedEmoji", - ID: MessageAnimatedEmojiTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AnimatedEmoji", - SchemaName: "animated_emoji", - }, - { - Name: "Emoji", - SchemaName: "emoji", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageAnimatedEmoji) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageAnimatedEmoji#3621f5e2 as nil") - } - b.PutID(MessageAnimatedEmojiTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageAnimatedEmoji) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageAnimatedEmoji#3621f5e2 as nil") - } - if err := m.AnimatedEmoji.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageAnimatedEmoji#3621f5e2: field animated_emoji: %w", err) - } - b.PutString(m.Emoji) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageAnimatedEmoji) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageAnimatedEmoji#3621f5e2 to nil") - } - if err := b.ConsumeID(MessageAnimatedEmojiTypeID); err != nil { - return fmt.Errorf("unable to decode messageAnimatedEmoji#3621f5e2: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageAnimatedEmoji) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageAnimatedEmoji#3621f5e2 to nil") - } - { - if err := m.AnimatedEmoji.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageAnimatedEmoji#3621f5e2: field animated_emoji: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageAnimatedEmoji#3621f5e2: field emoji: %w", err) - } - m.Emoji = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageAnimatedEmoji) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageAnimatedEmoji#3621f5e2 as nil") - } - b.ObjStart() - b.PutID("messageAnimatedEmoji") - b.Comma() - b.FieldStart("animated_emoji") - if err := m.AnimatedEmoji.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageAnimatedEmoji#3621f5e2: field animated_emoji: %w", err) - } - b.Comma() - b.FieldStart("emoji") - b.PutString(m.Emoji) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageAnimatedEmoji) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageAnimatedEmoji#3621f5e2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageAnimatedEmoji"); err != nil { - return fmt.Errorf("unable to decode messageAnimatedEmoji#3621f5e2: %w", err) - } - case "animated_emoji": - if err := m.AnimatedEmoji.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageAnimatedEmoji#3621f5e2: field animated_emoji: %w", err) - } - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageAnimatedEmoji#3621f5e2: field emoji: %w", err) - } - m.Emoji = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAnimatedEmoji returns value of AnimatedEmoji field. -func (m *MessageAnimatedEmoji) GetAnimatedEmoji() (value AnimatedEmoji) { - if m == nil { - return - } - return m.AnimatedEmoji -} - -// GetEmoji returns value of Emoji field. -func (m *MessageAnimatedEmoji) GetEmoji() (value string) { - if m == nil { - return - } - return m.Emoji -} - -// MessageDice represents TL type `messageDice#42817239`. -type MessageDice struct { - // The animated stickers with the initial dice animation; may be null if unknown. The - // update updateMessageContent will be sent when the sticker became known - InitialState DiceStickersClass - // The animated stickers with the final dice animation; may be null if unknown. The - // update updateMessageContent will be sent when the sticker became known - FinalState DiceStickersClass - // Emoji on which the dice throw animation is based - Emoji string - // The dice value. If the value is 0, the dice don't have final state yet - Value int32 - // Number of frame after which a success animation like a shower of confetti needs to be - // shown on updateMessageSendSucceeded - SuccessAnimationFrameNumber int32 -} - -// MessageDiceTypeID is TL type id of MessageDice. -const MessageDiceTypeID = 0x42817239 - -// construct implements constructor of MessageContentClass. -func (m MessageDice) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageDice. -var ( - _ bin.Encoder = &MessageDice{} - _ bin.Decoder = &MessageDice{} - _ bin.BareEncoder = &MessageDice{} - _ bin.BareDecoder = &MessageDice{} - - _ MessageContentClass = &MessageDice{} -) - -func (m *MessageDice) Zero() bool { - if m == nil { - return true - } - if !(m.InitialState == nil) { - return false - } - if !(m.FinalState == nil) { - return false - } - if !(m.Emoji == "") { - return false - } - if !(m.Value == 0) { - return false - } - if !(m.SuccessAnimationFrameNumber == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageDice) String() string { - if m == nil { - return "MessageDice(nil)" - } - type Alias MessageDice - return fmt.Sprintf("MessageDice%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageDice) TypeID() uint32 { - return MessageDiceTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageDice) TypeName() string { - return "messageDice" -} - -// TypeInfo returns info about TL type. -func (m *MessageDice) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageDice", - ID: MessageDiceTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InitialState", - SchemaName: "initial_state", - }, - { - Name: "FinalState", - SchemaName: "final_state", - }, - { - Name: "Emoji", - SchemaName: "emoji", - }, - { - Name: "Value", - SchemaName: "value", - }, - { - Name: "SuccessAnimationFrameNumber", - SchemaName: "success_animation_frame_number", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageDice) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageDice#42817239 as nil") - } - b.PutID(MessageDiceTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageDice) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageDice#42817239 as nil") - } - if m.InitialState == nil { - return fmt.Errorf("unable to encode messageDice#42817239: field initial_state is nil") - } - if err := m.InitialState.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageDice#42817239: field initial_state: %w", err) - } - if m.FinalState == nil { - return fmt.Errorf("unable to encode messageDice#42817239: field final_state is nil") - } - if err := m.FinalState.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageDice#42817239: field final_state: %w", err) - } - b.PutString(m.Emoji) - b.PutInt32(m.Value) - b.PutInt32(m.SuccessAnimationFrameNumber) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageDice) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageDice#42817239 to nil") - } - if err := b.ConsumeID(MessageDiceTypeID); err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageDice) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageDice#42817239 to nil") - } - { - value, err := DecodeDiceStickers(b) - if err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: field initial_state: %w", err) - } - m.InitialState = value - } - { - value, err := DecodeDiceStickers(b) - if err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: field final_state: %w", err) - } - m.FinalState = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: field emoji: %w", err) - } - m.Emoji = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: field value: %w", err) - } - m.Value = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: field success_animation_frame_number: %w", err) - } - m.SuccessAnimationFrameNumber = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageDice) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageDice#42817239 as nil") - } - b.ObjStart() - b.PutID("messageDice") - b.Comma() - b.FieldStart("initial_state") - if m.InitialState == nil { - return fmt.Errorf("unable to encode messageDice#42817239: field initial_state is nil") - } - if err := m.InitialState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageDice#42817239: field initial_state: %w", err) - } - b.Comma() - b.FieldStart("final_state") - if m.FinalState == nil { - return fmt.Errorf("unable to encode messageDice#42817239: field final_state is nil") - } - if err := m.FinalState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageDice#42817239: field final_state: %w", err) - } - b.Comma() - b.FieldStart("emoji") - b.PutString(m.Emoji) - b.Comma() - b.FieldStart("value") - b.PutInt32(m.Value) - b.Comma() - b.FieldStart("success_animation_frame_number") - b.PutInt32(m.SuccessAnimationFrameNumber) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageDice) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageDice#42817239 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageDice"); err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: %w", err) - } - case "initial_state": - value, err := DecodeTDLibJSONDiceStickers(b) - if err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: field initial_state: %w", err) - } - m.InitialState = value - case "final_state": - value, err := DecodeTDLibJSONDiceStickers(b) - if err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: field final_state: %w", err) - } - m.FinalState = value - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: field emoji: %w", err) - } - m.Emoji = value - case "value": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: field value: %w", err) - } - m.Value = value - case "success_animation_frame_number": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageDice#42817239: field success_animation_frame_number: %w", err) - } - m.SuccessAnimationFrameNumber = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInitialState returns value of InitialState field. -func (m *MessageDice) GetInitialState() (value DiceStickersClass) { - if m == nil { - return - } - return m.InitialState -} - -// GetFinalState returns value of FinalState field. -func (m *MessageDice) GetFinalState() (value DiceStickersClass) { - if m == nil { - return - } - return m.FinalState -} - -// GetEmoji returns value of Emoji field. -func (m *MessageDice) GetEmoji() (value string) { - if m == nil { - return - } - return m.Emoji -} - -// GetValue returns value of Value field. -func (m *MessageDice) GetValue() (value int32) { - if m == nil { - return - } - return m.Value -} - -// GetSuccessAnimationFrameNumber returns value of SuccessAnimationFrameNumber field. -func (m *MessageDice) GetSuccessAnimationFrameNumber() (value int32) { - if m == nil { - return - } - return m.SuccessAnimationFrameNumber -} - -// MessageGame represents TL type `messageGame#fbdc6976`. -type MessageGame struct { - // The game description - Game Game -} - -// MessageGameTypeID is TL type id of MessageGame. -const MessageGameTypeID = 0xfbdc6976 - -// construct implements constructor of MessageContentClass. -func (m MessageGame) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageGame. -var ( - _ bin.Encoder = &MessageGame{} - _ bin.Decoder = &MessageGame{} - _ bin.BareEncoder = &MessageGame{} - _ bin.BareDecoder = &MessageGame{} - - _ MessageContentClass = &MessageGame{} -) - -func (m *MessageGame) Zero() bool { - if m == nil { - return true - } - if !(m.Game.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageGame) String() string { - if m == nil { - return "MessageGame(nil)" - } - type Alias MessageGame - return fmt.Sprintf("MessageGame%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageGame) TypeID() uint32 { - return MessageGameTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageGame) TypeName() string { - return "messageGame" -} - -// TypeInfo returns info about TL type. -func (m *MessageGame) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageGame", - ID: MessageGameTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Game", - SchemaName: "game", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageGame) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGame#fbdc6976 as nil") - } - b.PutID(MessageGameTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageGame) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGame#fbdc6976 as nil") - } - if err := m.Game.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGame#fbdc6976: field game: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageGame) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGame#fbdc6976 to nil") - } - if err := b.ConsumeID(MessageGameTypeID); err != nil { - return fmt.Errorf("unable to decode messageGame#fbdc6976: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageGame) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGame#fbdc6976 to nil") - } - { - if err := m.Game.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGame#fbdc6976: field game: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageGame) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageGame#fbdc6976 as nil") - } - b.ObjStart() - b.PutID("messageGame") - b.Comma() - b.FieldStart("game") - if err := m.Game.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGame#fbdc6976: field game: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageGame) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageGame#fbdc6976 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageGame"); err != nil { - return fmt.Errorf("unable to decode messageGame#fbdc6976: %w", err) - } - case "game": - if err := m.Game.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGame#fbdc6976: field game: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGame returns value of Game field. -func (m *MessageGame) GetGame() (value Game) { - if m == nil { - return - } - return m.Game -} - -// MessagePoll represents TL type `messagePoll#d888b24d`. -type MessagePoll struct { - // The poll description - Poll Poll -} - -// MessagePollTypeID is TL type id of MessagePoll. -const MessagePollTypeID = 0xd888b24d - -// construct implements constructor of MessageContentClass. -func (m MessagePoll) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessagePoll. -var ( - _ bin.Encoder = &MessagePoll{} - _ bin.Decoder = &MessagePoll{} - _ bin.BareEncoder = &MessagePoll{} - _ bin.BareDecoder = &MessagePoll{} - - _ MessageContentClass = &MessagePoll{} -) - -func (m *MessagePoll) Zero() bool { - if m == nil { - return true - } - if !(m.Poll.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePoll) String() string { - if m == nil { - return "MessagePoll(nil)" - } - type Alias MessagePoll - return fmt.Sprintf("MessagePoll%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePoll) TypeID() uint32 { - return MessagePollTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePoll) TypeName() string { - return "messagePoll" -} - -// TypeInfo returns info about TL type. -func (m *MessagePoll) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePoll", - ID: MessagePollTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Poll", - SchemaName: "poll", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePoll) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePoll#d888b24d as nil") - } - b.PutID(MessagePollTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePoll) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePoll#d888b24d as nil") - } - if err := m.Poll.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePoll#d888b24d: field poll: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePoll) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePoll#d888b24d to nil") - } - if err := b.ConsumeID(MessagePollTypeID); err != nil { - return fmt.Errorf("unable to decode messagePoll#d888b24d: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePoll) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePoll#d888b24d to nil") - } - { - if err := m.Poll.Decode(b); err != nil { - return fmt.Errorf("unable to decode messagePoll#d888b24d: field poll: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePoll) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePoll#d888b24d as nil") - } - b.ObjStart() - b.PutID("messagePoll") - b.Comma() - b.FieldStart("poll") - if err := m.Poll.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePoll#d888b24d: field poll: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePoll) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePoll#d888b24d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePoll"); err != nil { - return fmt.Errorf("unable to decode messagePoll#d888b24d: %w", err) - } - case "poll": - if err := m.Poll.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePoll#d888b24d: field poll: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPoll returns value of Poll field. -func (m *MessagePoll) GetPoll() (value Poll) { - if m == nil { - return - } - return m.Poll -} - -// MessageStory represents TL type `messageStory#3329f2d4`. -type MessageStory struct { - // Identifier of the chat that posted the story - StorySenderChatID int64 - // Story identifier - StoryID int32 - // True, if the story was automatically forwarded because of a mention of the user - ViaMention bool -} - -// MessageStoryTypeID is TL type id of MessageStory. -const MessageStoryTypeID = 0x3329f2d4 - -// construct implements constructor of MessageContentClass. -func (m MessageStory) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageStory. -var ( - _ bin.Encoder = &MessageStory{} - _ bin.Decoder = &MessageStory{} - _ bin.BareEncoder = &MessageStory{} - _ bin.BareDecoder = &MessageStory{} - - _ MessageContentClass = &MessageStory{} -) - -func (m *MessageStory) Zero() bool { - if m == nil { - return true - } - if !(m.StorySenderChatID == 0) { - return false - } - if !(m.StoryID == 0) { - return false - } - if !(m.ViaMention == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageStory) String() string { - if m == nil { - return "MessageStory(nil)" - } - type Alias MessageStory - return fmt.Sprintf("MessageStory%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageStory) TypeID() uint32 { - return MessageStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageStory) TypeName() string { - return "messageStory" -} - -// TypeInfo returns info about TL type. -func (m *MessageStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageStory", - ID: MessageStoryTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "ViaMention", - SchemaName: "via_mention", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageStory) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageStory#3329f2d4 as nil") - } - b.PutID(MessageStoryTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageStory) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageStory#3329f2d4 as nil") - } - b.PutInt53(m.StorySenderChatID) - b.PutInt32(m.StoryID) - b.PutBool(m.ViaMention) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageStory) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageStory#3329f2d4 to nil") - } - if err := b.ConsumeID(MessageStoryTypeID); err != nil { - return fmt.Errorf("unable to decode messageStory#3329f2d4: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageStory) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageStory#3329f2d4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageStory#3329f2d4: field story_sender_chat_id: %w", err) - } - m.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageStory#3329f2d4: field story_id: %w", err) - } - m.StoryID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageStory#3329f2d4: field via_mention: %w", err) - } - m.ViaMention = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageStory#3329f2d4 as nil") - } - b.ObjStart() - b.PutID("messageStory") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(m.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(m.StoryID) - b.Comma() - b.FieldStart("via_mention") - b.PutBool(m.ViaMention) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageStory#3329f2d4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageStory"); err != nil { - return fmt.Errorf("unable to decode messageStory#3329f2d4: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageStory#3329f2d4: field story_sender_chat_id: %w", err) - } - m.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageStory#3329f2d4: field story_id: %w", err) - } - m.StoryID = value - case "via_mention": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageStory#3329f2d4: field via_mention: %w", err) - } - m.ViaMention = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (m *MessageStory) GetStorySenderChatID() (value int64) { - if m == nil { - return - } - return m.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (m *MessageStory) GetStoryID() (value int32) { - if m == nil { - return - } - return m.StoryID -} - -// GetViaMention returns value of ViaMention field. -func (m *MessageStory) GetViaMention() (value bool) { - if m == nil { - return - } - return m.ViaMention -} - -// MessageInvoice represents TL type `messageInvoice#fadfd46`. -type MessageInvoice struct { - // Information about the product - ProductInfo ProductInfo - // Currency for the product price - Currency string - // Product total price in the smallest units of the currency - TotalAmount int64 - // Unique invoice bot start_parameter to be passed to getInternalLink - StartParameter string - // True, if the invoice is a test invoice - IsTest bool - // True, if the shipping address must be specified - NeedShippingAddress bool - // The identifier of the message with the receipt, after the product has been purchased - ReceiptMessageID int64 - // Extended media attached to the invoice; may be null if none - PaidMedia PaidMediaClass - // Extended media caption; may be null if none - PaidMediaCaption FormattedText -} - -// MessageInvoiceTypeID is TL type id of MessageInvoice. -const MessageInvoiceTypeID = 0xfadfd46 - -// construct implements constructor of MessageContentClass. -func (m MessageInvoice) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageInvoice. -var ( - _ bin.Encoder = &MessageInvoice{} - _ bin.Decoder = &MessageInvoice{} - _ bin.BareEncoder = &MessageInvoice{} - _ bin.BareDecoder = &MessageInvoice{} - - _ MessageContentClass = &MessageInvoice{} -) - -func (m *MessageInvoice) Zero() bool { - if m == nil { - return true - } - if !(m.ProductInfo.Zero()) { - return false - } - if !(m.Currency == "") { - return false - } - if !(m.TotalAmount == 0) { - return false - } - if !(m.StartParameter == "") { - return false - } - if !(m.IsTest == false) { - return false - } - if !(m.NeedShippingAddress == false) { - return false - } - if !(m.ReceiptMessageID == 0) { - return false - } - if !(m.PaidMedia == nil) { - return false - } - if !(m.PaidMediaCaption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageInvoice) String() string { - if m == nil { - return "MessageInvoice(nil)" - } - type Alias MessageInvoice - return fmt.Sprintf("MessageInvoice%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageInvoice) TypeID() uint32 { - return MessageInvoiceTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageInvoice) TypeName() string { - return "messageInvoice" -} - -// TypeInfo returns info about TL type. -func (m *MessageInvoice) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageInvoice", - ID: MessageInvoiceTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ProductInfo", - SchemaName: "product_info", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "TotalAmount", - SchemaName: "total_amount", - }, - { - Name: "StartParameter", - SchemaName: "start_parameter", - }, - { - Name: "IsTest", - SchemaName: "is_test", - }, - { - Name: "NeedShippingAddress", - SchemaName: "need_shipping_address", - }, - { - Name: "ReceiptMessageID", - SchemaName: "receipt_message_id", - }, - { - Name: "PaidMedia", - SchemaName: "paid_media", - }, - { - Name: "PaidMediaCaption", - SchemaName: "paid_media_caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageInvoice) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageInvoice#fadfd46 as nil") - } - b.PutID(MessageInvoiceTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageInvoice) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageInvoice#fadfd46 as nil") - } - if err := m.ProductInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageInvoice#fadfd46: field product_info: %w", err) - } - b.PutString(m.Currency) - b.PutInt53(m.TotalAmount) - b.PutString(m.StartParameter) - b.PutBool(m.IsTest) - b.PutBool(m.NeedShippingAddress) - b.PutInt53(m.ReceiptMessageID) - if m.PaidMedia == nil { - return fmt.Errorf("unable to encode messageInvoice#fadfd46: field paid_media is nil") - } - if err := m.PaidMedia.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageInvoice#fadfd46: field paid_media: %w", err) - } - if err := m.PaidMediaCaption.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageInvoice#fadfd46: field paid_media_caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageInvoice) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageInvoice#fadfd46 to nil") - } - if err := b.ConsumeID(MessageInvoiceTypeID); err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageInvoice) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageInvoice#fadfd46 to nil") - } - { - if err := m.ProductInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field product_info: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field currency: %w", err) - } - m.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field total_amount: %w", err) - } - m.TotalAmount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field start_parameter: %w", err) - } - m.StartParameter = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field is_test: %w", err) - } - m.IsTest = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field need_shipping_address: %w", err) - } - m.NeedShippingAddress = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field receipt_message_id: %w", err) - } - m.ReceiptMessageID = value - } - { - value, err := DecodePaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field paid_media: %w", err) - } - m.PaidMedia = value - } - { - if err := m.PaidMediaCaption.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field paid_media_caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageInvoice) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageInvoice#fadfd46 as nil") - } - b.ObjStart() - b.PutID("messageInvoice") - b.Comma() - b.FieldStart("product_info") - if err := m.ProductInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageInvoice#fadfd46: field product_info: %w", err) - } - b.Comma() - b.FieldStart("currency") - b.PutString(m.Currency) - b.Comma() - b.FieldStart("total_amount") - b.PutInt53(m.TotalAmount) - b.Comma() - b.FieldStart("start_parameter") - b.PutString(m.StartParameter) - b.Comma() - b.FieldStart("is_test") - b.PutBool(m.IsTest) - b.Comma() - b.FieldStart("need_shipping_address") - b.PutBool(m.NeedShippingAddress) - b.Comma() - b.FieldStart("receipt_message_id") - b.PutInt53(m.ReceiptMessageID) - b.Comma() - b.FieldStart("paid_media") - if m.PaidMedia == nil { - return fmt.Errorf("unable to encode messageInvoice#fadfd46: field paid_media is nil") - } - if err := m.PaidMedia.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageInvoice#fadfd46: field paid_media: %w", err) - } - b.Comma() - b.FieldStart("paid_media_caption") - if err := m.PaidMediaCaption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageInvoice#fadfd46: field paid_media_caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageInvoice) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageInvoice#fadfd46 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageInvoice"); err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: %w", err) - } - case "product_info": - if err := m.ProductInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field product_info: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field currency: %w", err) - } - m.Currency = value - case "total_amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field total_amount: %w", err) - } - m.TotalAmount = value - case "start_parameter": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field start_parameter: %w", err) - } - m.StartParameter = value - case "is_test": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field is_test: %w", err) - } - m.IsTest = value - case "need_shipping_address": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field need_shipping_address: %w", err) - } - m.NeedShippingAddress = value - case "receipt_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field receipt_message_id: %w", err) - } - m.ReceiptMessageID = value - case "paid_media": - value, err := DecodeTDLibJSONPaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field paid_media: %w", err) - } - m.PaidMedia = value - case "paid_media_caption": - if err := m.PaidMediaCaption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageInvoice#fadfd46: field paid_media_caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetProductInfo returns value of ProductInfo field. -func (m *MessageInvoice) GetProductInfo() (value ProductInfo) { - if m == nil { - return - } - return m.ProductInfo -} - -// GetCurrency returns value of Currency field. -func (m *MessageInvoice) GetCurrency() (value string) { - if m == nil { - return - } - return m.Currency -} - -// GetTotalAmount returns value of TotalAmount field. -func (m *MessageInvoice) GetTotalAmount() (value int64) { - if m == nil { - return - } - return m.TotalAmount -} - -// GetStartParameter returns value of StartParameter field. -func (m *MessageInvoice) GetStartParameter() (value string) { - if m == nil { - return - } - return m.StartParameter -} - -// GetIsTest returns value of IsTest field. -func (m *MessageInvoice) GetIsTest() (value bool) { - if m == nil { - return - } - return m.IsTest -} - -// GetNeedShippingAddress returns value of NeedShippingAddress field. -func (m *MessageInvoice) GetNeedShippingAddress() (value bool) { - if m == nil { - return - } - return m.NeedShippingAddress -} - -// GetReceiptMessageID returns value of ReceiptMessageID field. -func (m *MessageInvoice) GetReceiptMessageID() (value int64) { - if m == nil { - return - } - return m.ReceiptMessageID -} - -// GetPaidMedia returns value of PaidMedia field. -func (m *MessageInvoice) GetPaidMedia() (value PaidMediaClass) { - if m == nil { - return - } - return m.PaidMedia -} - -// GetPaidMediaCaption returns value of PaidMediaCaption field. -func (m *MessageInvoice) GetPaidMediaCaption() (value FormattedText) { - if m == nil { - return - } - return m.PaidMediaCaption -} - -// MessageCall represents TL type `messageCall#201ede00`. -type MessageCall struct { - // True, if the call was a video call - IsVideo bool - // Reason why the call was discarded - DiscardReason CallDiscardReasonClass - // Call duration, in seconds - Duration int32 -} - -// MessageCallTypeID is TL type id of MessageCall. -const MessageCallTypeID = 0x201ede00 - -// construct implements constructor of MessageContentClass. -func (m MessageCall) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageCall. -var ( - _ bin.Encoder = &MessageCall{} - _ bin.Decoder = &MessageCall{} - _ bin.BareEncoder = &MessageCall{} - _ bin.BareDecoder = &MessageCall{} - - _ MessageContentClass = &MessageCall{} -) - -func (m *MessageCall) Zero() bool { - if m == nil { - return true - } - if !(m.IsVideo == false) { - return false - } - if !(m.DiscardReason == nil) { - return false - } - if !(m.Duration == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageCall) String() string { - if m == nil { - return "MessageCall(nil)" - } - type Alias MessageCall - return fmt.Sprintf("MessageCall%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageCall) TypeID() uint32 { - return MessageCallTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageCall) TypeName() string { - return "messageCall" -} - -// TypeInfo returns info about TL type. -func (m *MessageCall) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageCall", - ID: MessageCallTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsVideo", - SchemaName: "is_video", - }, - { - Name: "DiscardReason", - SchemaName: "discard_reason", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageCall) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageCall#201ede00 as nil") - } - b.PutID(MessageCallTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageCall) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageCall#201ede00 as nil") - } - b.PutBool(m.IsVideo) - if m.DiscardReason == nil { - return fmt.Errorf("unable to encode messageCall#201ede00: field discard_reason is nil") - } - if err := m.DiscardReason.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageCall#201ede00: field discard_reason: %w", err) - } - b.PutInt32(m.Duration) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageCall) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageCall#201ede00 to nil") - } - if err := b.ConsumeID(MessageCallTypeID); err != nil { - return fmt.Errorf("unable to decode messageCall#201ede00: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageCall) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageCall#201ede00 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageCall#201ede00: field is_video: %w", err) - } - m.IsVideo = value - } - { - value, err := DecodeCallDiscardReason(b) - if err != nil { - return fmt.Errorf("unable to decode messageCall#201ede00: field discard_reason: %w", err) - } - m.DiscardReason = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageCall#201ede00: field duration: %w", err) - } - m.Duration = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageCall) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageCall#201ede00 as nil") - } - b.ObjStart() - b.PutID("messageCall") - b.Comma() - b.FieldStart("is_video") - b.PutBool(m.IsVideo) - b.Comma() - b.FieldStart("discard_reason") - if m.DiscardReason == nil { - return fmt.Errorf("unable to encode messageCall#201ede00: field discard_reason is nil") - } - if err := m.DiscardReason.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageCall#201ede00: field discard_reason: %w", err) - } - b.Comma() - b.FieldStart("duration") - b.PutInt32(m.Duration) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageCall) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageCall#201ede00 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageCall"); err != nil { - return fmt.Errorf("unable to decode messageCall#201ede00: %w", err) - } - case "is_video": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageCall#201ede00: field is_video: %w", err) - } - m.IsVideo = value - case "discard_reason": - value, err := DecodeTDLibJSONCallDiscardReason(b) - if err != nil { - return fmt.Errorf("unable to decode messageCall#201ede00: field discard_reason: %w", err) - } - m.DiscardReason = value - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageCall#201ede00: field duration: %w", err) - } - m.Duration = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsVideo returns value of IsVideo field. -func (m *MessageCall) GetIsVideo() (value bool) { - if m == nil { - return - } - return m.IsVideo -} - -// GetDiscardReason returns value of DiscardReason field. -func (m *MessageCall) GetDiscardReason() (value CallDiscardReasonClass) { - if m == nil { - return - } - return m.DiscardReason -} - -// GetDuration returns value of Duration field. -func (m *MessageCall) GetDuration() (value int32) { - if m == nil { - return - } - return m.Duration -} - -// MessageVideoChatScheduled represents TL type `messageVideoChatScheduled#916c1db7`. -type MessageVideoChatScheduled struct { - // Identifier of the video chat. The video chat can be received through the method - // getGroupCall - GroupCallID int32 - // Point in time (Unix timestamp) when the group call is expected to be started by an - // administrator - StartDate int32 -} - -// MessageVideoChatScheduledTypeID is TL type id of MessageVideoChatScheduled. -const MessageVideoChatScheduledTypeID = 0x916c1db7 - -// construct implements constructor of MessageContentClass. -func (m MessageVideoChatScheduled) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageVideoChatScheduled. -var ( - _ bin.Encoder = &MessageVideoChatScheduled{} - _ bin.Decoder = &MessageVideoChatScheduled{} - _ bin.BareEncoder = &MessageVideoChatScheduled{} - _ bin.BareDecoder = &MessageVideoChatScheduled{} - - _ MessageContentClass = &MessageVideoChatScheduled{} -) - -func (m *MessageVideoChatScheduled) Zero() bool { - if m == nil { - return true - } - if !(m.GroupCallID == 0) { - return false - } - if !(m.StartDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageVideoChatScheduled) String() string { - if m == nil { - return "MessageVideoChatScheduled(nil)" - } - type Alias MessageVideoChatScheduled - return fmt.Sprintf("MessageVideoChatScheduled%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageVideoChatScheduled) TypeID() uint32 { - return MessageVideoChatScheduledTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageVideoChatScheduled) TypeName() string { - return "messageVideoChatScheduled" -} - -// TypeInfo returns info about TL type. -func (m *MessageVideoChatScheduled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageVideoChatScheduled", - ID: MessageVideoChatScheduledTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "StartDate", - SchemaName: "start_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageVideoChatScheduled) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoChatScheduled#916c1db7 as nil") - } - b.PutID(MessageVideoChatScheduledTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageVideoChatScheduled) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoChatScheduled#916c1db7 as nil") - } - b.PutInt32(m.GroupCallID) - b.PutInt32(m.StartDate) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageVideoChatScheduled) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoChatScheduled#916c1db7 to nil") - } - if err := b.ConsumeID(MessageVideoChatScheduledTypeID); err != nil { - return fmt.Errorf("unable to decode messageVideoChatScheduled#916c1db7: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageVideoChatScheduled) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoChatScheduled#916c1db7 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageVideoChatScheduled#916c1db7: field group_call_id: %w", err) - } - m.GroupCallID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageVideoChatScheduled#916c1db7: field start_date: %w", err) - } - m.StartDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageVideoChatScheduled) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoChatScheduled#916c1db7 as nil") - } - b.ObjStart() - b.PutID("messageVideoChatScheduled") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(m.GroupCallID) - b.Comma() - b.FieldStart("start_date") - b.PutInt32(m.StartDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageVideoChatScheduled) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoChatScheduled#916c1db7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageVideoChatScheduled"); err != nil { - return fmt.Errorf("unable to decode messageVideoChatScheduled#916c1db7: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageVideoChatScheduled#916c1db7: field group_call_id: %w", err) - } - m.GroupCallID = value - case "start_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageVideoChatScheduled#916c1db7: field start_date: %w", err) - } - m.StartDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (m *MessageVideoChatScheduled) GetGroupCallID() (value int32) { - if m == nil { - return - } - return m.GroupCallID -} - -// GetStartDate returns value of StartDate field. -func (m *MessageVideoChatScheduled) GetStartDate() (value int32) { - if m == nil { - return - } - return m.StartDate -} - -// MessageVideoChatStarted represents TL type `messageVideoChatStarted#1f114559`. -type MessageVideoChatStarted struct { - // Identifier of the video chat. The video chat can be received through the method - // getGroupCall - GroupCallID int32 -} - -// MessageVideoChatStartedTypeID is TL type id of MessageVideoChatStarted. -const MessageVideoChatStartedTypeID = 0x1f114559 - -// construct implements constructor of MessageContentClass. -func (m MessageVideoChatStarted) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageVideoChatStarted. -var ( - _ bin.Encoder = &MessageVideoChatStarted{} - _ bin.Decoder = &MessageVideoChatStarted{} - _ bin.BareEncoder = &MessageVideoChatStarted{} - _ bin.BareDecoder = &MessageVideoChatStarted{} - - _ MessageContentClass = &MessageVideoChatStarted{} -) - -func (m *MessageVideoChatStarted) Zero() bool { - if m == nil { - return true - } - if !(m.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageVideoChatStarted) String() string { - if m == nil { - return "MessageVideoChatStarted(nil)" - } - type Alias MessageVideoChatStarted - return fmt.Sprintf("MessageVideoChatStarted%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageVideoChatStarted) TypeID() uint32 { - return MessageVideoChatStartedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageVideoChatStarted) TypeName() string { - return "messageVideoChatStarted" -} - -// TypeInfo returns info about TL type. -func (m *MessageVideoChatStarted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageVideoChatStarted", - ID: MessageVideoChatStartedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageVideoChatStarted) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoChatStarted#1f114559 as nil") - } - b.PutID(MessageVideoChatStartedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageVideoChatStarted) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoChatStarted#1f114559 as nil") - } - b.PutInt32(m.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageVideoChatStarted) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoChatStarted#1f114559 to nil") - } - if err := b.ConsumeID(MessageVideoChatStartedTypeID); err != nil { - return fmt.Errorf("unable to decode messageVideoChatStarted#1f114559: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageVideoChatStarted) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoChatStarted#1f114559 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageVideoChatStarted#1f114559: field group_call_id: %w", err) - } - m.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageVideoChatStarted) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoChatStarted#1f114559 as nil") - } - b.ObjStart() - b.PutID("messageVideoChatStarted") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(m.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageVideoChatStarted) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoChatStarted#1f114559 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageVideoChatStarted"); err != nil { - return fmt.Errorf("unable to decode messageVideoChatStarted#1f114559: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageVideoChatStarted#1f114559: field group_call_id: %w", err) - } - m.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (m *MessageVideoChatStarted) GetGroupCallID() (value int32) { - if m == nil { - return - } - return m.GroupCallID -} - -// MessageVideoChatEnded represents TL type `messageVideoChatEnded#79262c57`. -type MessageVideoChatEnded struct { - // Call duration, in seconds - Duration int32 -} - -// MessageVideoChatEndedTypeID is TL type id of MessageVideoChatEnded. -const MessageVideoChatEndedTypeID = 0x79262c57 - -// construct implements constructor of MessageContentClass. -func (m MessageVideoChatEnded) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageVideoChatEnded. -var ( - _ bin.Encoder = &MessageVideoChatEnded{} - _ bin.Decoder = &MessageVideoChatEnded{} - _ bin.BareEncoder = &MessageVideoChatEnded{} - _ bin.BareDecoder = &MessageVideoChatEnded{} - - _ MessageContentClass = &MessageVideoChatEnded{} -) - -func (m *MessageVideoChatEnded) Zero() bool { - if m == nil { - return true - } - if !(m.Duration == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageVideoChatEnded) String() string { - if m == nil { - return "MessageVideoChatEnded(nil)" - } - type Alias MessageVideoChatEnded - return fmt.Sprintf("MessageVideoChatEnded%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageVideoChatEnded) TypeID() uint32 { - return MessageVideoChatEndedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageVideoChatEnded) TypeName() string { - return "messageVideoChatEnded" -} - -// TypeInfo returns info about TL type. -func (m *MessageVideoChatEnded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageVideoChatEnded", - ID: MessageVideoChatEndedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Duration", - SchemaName: "duration", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageVideoChatEnded) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoChatEnded#79262c57 as nil") - } - b.PutID(MessageVideoChatEndedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageVideoChatEnded) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoChatEnded#79262c57 as nil") - } - b.PutInt32(m.Duration) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageVideoChatEnded) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoChatEnded#79262c57 to nil") - } - if err := b.ConsumeID(MessageVideoChatEndedTypeID); err != nil { - return fmt.Errorf("unable to decode messageVideoChatEnded#79262c57: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageVideoChatEnded) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoChatEnded#79262c57 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageVideoChatEnded#79262c57: field duration: %w", err) - } - m.Duration = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageVideoChatEnded) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageVideoChatEnded#79262c57 as nil") - } - b.ObjStart() - b.PutID("messageVideoChatEnded") - b.Comma() - b.FieldStart("duration") - b.PutInt32(m.Duration) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageVideoChatEnded) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageVideoChatEnded#79262c57 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageVideoChatEnded"); err != nil { - return fmt.Errorf("unable to decode messageVideoChatEnded#79262c57: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageVideoChatEnded#79262c57: field duration: %w", err) - } - m.Duration = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDuration returns value of Duration field. -func (m *MessageVideoChatEnded) GetDuration() (value int32) { - if m == nil { - return - } - return m.Duration -} - -// MessageInviteVideoChatParticipants represents TL type `messageInviteVideoChatParticipants#f58d603`. -type MessageInviteVideoChatParticipants struct { - // Identifier of the video chat. The video chat can be received through the method - // getGroupCall - GroupCallID int32 - // Invited user identifiers - UserIDs []int64 -} - -// MessageInviteVideoChatParticipantsTypeID is TL type id of MessageInviteVideoChatParticipants. -const MessageInviteVideoChatParticipantsTypeID = 0xf58d603 - -// construct implements constructor of MessageContentClass. -func (m MessageInviteVideoChatParticipants) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageInviteVideoChatParticipants. -var ( - _ bin.Encoder = &MessageInviteVideoChatParticipants{} - _ bin.Decoder = &MessageInviteVideoChatParticipants{} - _ bin.BareEncoder = &MessageInviteVideoChatParticipants{} - _ bin.BareDecoder = &MessageInviteVideoChatParticipants{} - - _ MessageContentClass = &MessageInviteVideoChatParticipants{} -) - -func (m *MessageInviteVideoChatParticipants) Zero() bool { - if m == nil { - return true - } - if !(m.GroupCallID == 0) { - return false - } - if !(m.UserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageInviteVideoChatParticipants) String() string { - if m == nil { - return "MessageInviteVideoChatParticipants(nil)" - } - type Alias MessageInviteVideoChatParticipants - return fmt.Sprintf("MessageInviteVideoChatParticipants%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageInviteVideoChatParticipants) TypeID() uint32 { - return MessageInviteVideoChatParticipantsTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageInviteVideoChatParticipants) TypeName() string { - return "messageInviteVideoChatParticipants" -} - -// TypeInfo returns info about TL type. -func (m *MessageInviteVideoChatParticipants) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageInviteVideoChatParticipants", - ID: MessageInviteVideoChatParticipantsTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageInviteVideoChatParticipants) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageInviteVideoChatParticipants#f58d603 as nil") - } - b.PutID(MessageInviteVideoChatParticipantsTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageInviteVideoChatParticipants) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageInviteVideoChatParticipants#f58d603 as nil") - } - b.PutInt32(m.GroupCallID) - b.PutInt(len(m.UserIDs)) - for _, v := range m.UserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageInviteVideoChatParticipants) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageInviteVideoChatParticipants#f58d603 to nil") - } - if err := b.ConsumeID(MessageInviteVideoChatParticipantsTypeID); err != nil { - return fmt.Errorf("unable to decode messageInviteVideoChatParticipants#f58d603: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageInviteVideoChatParticipants) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageInviteVideoChatParticipants#f58d603 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageInviteVideoChatParticipants#f58d603: field group_call_id: %w", err) - } - m.GroupCallID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageInviteVideoChatParticipants#f58d603: field user_ids: %w", err) - } - - if headerLen > 0 { - m.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageInviteVideoChatParticipants#f58d603: field user_ids: %w", err) - } - m.UserIDs = append(m.UserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageInviteVideoChatParticipants) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageInviteVideoChatParticipants#f58d603 as nil") - } - b.ObjStart() - b.PutID("messageInviteVideoChatParticipants") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(m.GroupCallID) - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range m.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageInviteVideoChatParticipants) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageInviteVideoChatParticipants#f58d603 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageInviteVideoChatParticipants"); err != nil { - return fmt.Errorf("unable to decode messageInviteVideoChatParticipants#f58d603: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageInviteVideoChatParticipants#f58d603: field group_call_id: %w", err) - } - m.GroupCallID = value - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageInviteVideoChatParticipants#f58d603: field user_ids: %w", err) - } - m.UserIDs = append(m.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageInviteVideoChatParticipants#f58d603: field user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (m *MessageInviteVideoChatParticipants) GetGroupCallID() (value int32) { - if m == nil { - return - } - return m.GroupCallID -} - -// GetUserIDs returns value of UserIDs field. -func (m *MessageInviteVideoChatParticipants) GetUserIDs() (value []int64) { - if m == nil { - return - } - return m.UserIDs -} - -// MessageBasicGroupChatCreate represents TL type `messageBasicGroupChatCreate#8b60f757`. -type MessageBasicGroupChatCreate struct { - // Title of the basic group - Title string - // User identifiers of members in the basic group - MemberUserIDs []int64 -} - -// MessageBasicGroupChatCreateTypeID is TL type id of MessageBasicGroupChatCreate. -const MessageBasicGroupChatCreateTypeID = 0x8b60f757 - -// construct implements constructor of MessageContentClass. -func (m MessageBasicGroupChatCreate) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageBasicGroupChatCreate. -var ( - _ bin.Encoder = &MessageBasicGroupChatCreate{} - _ bin.Decoder = &MessageBasicGroupChatCreate{} - _ bin.BareEncoder = &MessageBasicGroupChatCreate{} - _ bin.BareDecoder = &MessageBasicGroupChatCreate{} - - _ MessageContentClass = &MessageBasicGroupChatCreate{} -) - -func (m *MessageBasicGroupChatCreate) Zero() bool { - if m == nil { - return true - } - if !(m.Title == "") { - return false - } - if !(m.MemberUserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageBasicGroupChatCreate) String() string { - if m == nil { - return "MessageBasicGroupChatCreate(nil)" - } - type Alias MessageBasicGroupChatCreate - return fmt.Sprintf("MessageBasicGroupChatCreate%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageBasicGroupChatCreate) TypeID() uint32 { - return MessageBasicGroupChatCreateTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageBasicGroupChatCreate) TypeName() string { - return "messageBasicGroupChatCreate" -} - -// TypeInfo returns info about TL type. -func (m *MessageBasicGroupChatCreate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageBasicGroupChatCreate", - ID: MessageBasicGroupChatCreateTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "MemberUserIDs", - SchemaName: "member_user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageBasicGroupChatCreate) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageBasicGroupChatCreate#8b60f757 as nil") - } - b.PutID(MessageBasicGroupChatCreateTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageBasicGroupChatCreate) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageBasicGroupChatCreate#8b60f757 as nil") - } - b.PutString(m.Title) - b.PutInt(len(m.MemberUserIDs)) - for _, v := range m.MemberUserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageBasicGroupChatCreate) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageBasicGroupChatCreate#8b60f757 to nil") - } - if err := b.ConsumeID(MessageBasicGroupChatCreateTypeID); err != nil { - return fmt.Errorf("unable to decode messageBasicGroupChatCreate#8b60f757: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageBasicGroupChatCreate) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageBasicGroupChatCreate#8b60f757 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageBasicGroupChatCreate#8b60f757: field title: %w", err) - } - m.Title = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageBasicGroupChatCreate#8b60f757: field member_user_ids: %w", err) - } - - if headerLen > 0 { - m.MemberUserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageBasicGroupChatCreate#8b60f757: field member_user_ids: %w", err) - } - m.MemberUserIDs = append(m.MemberUserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageBasicGroupChatCreate) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageBasicGroupChatCreate#8b60f757 as nil") - } - b.ObjStart() - b.PutID("messageBasicGroupChatCreate") - b.Comma() - b.FieldStart("title") - b.PutString(m.Title) - b.Comma() - b.FieldStart("member_user_ids") - b.ArrStart() - for _, v := range m.MemberUserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageBasicGroupChatCreate) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageBasicGroupChatCreate#8b60f757 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageBasicGroupChatCreate"); err != nil { - return fmt.Errorf("unable to decode messageBasicGroupChatCreate#8b60f757: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageBasicGroupChatCreate#8b60f757: field title: %w", err) - } - m.Title = value - case "member_user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageBasicGroupChatCreate#8b60f757: field member_user_ids: %w", err) - } - m.MemberUserIDs = append(m.MemberUserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageBasicGroupChatCreate#8b60f757: field member_user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (m *MessageBasicGroupChatCreate) GetTitle() (value string) { - if m == nil { - return - } - return m.Title -} - -// GetMemberUserIDs returns value of MemberUserIDs field. -func (m *MessageBasicGroupChatCreate) GetMemberUserIDs() (value []int64) { - if m == nil { - return - } - return m.MemberUserIDs -} - -// MessageSupergroupChatCreate represents TL type `messageSupergroupChatCreate#e61cb71b`. -type MessageSupergroupChatCreate struct { - // Title of the supergroup or channel - Title string -} - -// MessageSupergroupChatCreateTypeID is TL type id of MessageSupergroupChatCreate. -const MessageSupergroupChatCreateTypeID = 0xe61cb71b - -// construct implements constructor of MessageContentClass. -func (m MessageSupergroupChatCreate) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageSupergroupChatCreate. -var ( - _ bin.Encoder = &MessageSupergroupChatCreate{} - _ bin.Decoder = &MessageSupergroupChatCreate{} - _ bin.BareEncoder = &MessageSupergroupChatCreate{} - _ bin.BareDecoder = &MessageSupergroupChatCreate{} - - _ MessageContentClass = &MessageSupergroupChatCreate{} -) - -func (m *MessageSupergroupChatCreate) Zero() bool { - if m == nil { - return true - } - if !(m.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSupergroupChatCreate) String() string { - if m == nil { - return "MessageSupergroupChatCreate(nil)" - } - type Alias MessageSupergroupChatCreate - return fmt.Sprintf("MessageSupergroupChatCreate%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSupergroupChatCreate) TypeID() uint32 { - return MessageSupergroupChatCreateTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSupergroupChatCreate) TypeName() string { - return "messageSupergroupChatCreate" -} - -// TypeInfo returns info about TL type. -func (m *MessageSupergroupChatCreate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSupergroupChatCreate", - ID: MessageSupergroupChatCreateTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSupergroupChatCreate) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSupergroupChatCreate#e61cb71b as nil") - } - b.PutID(MessageSupergroupChatCreateTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSupergroupChatCreate) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSupergroupChatCreate#e61cb71b as nil") - } - b.PutString(m.Title) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSupergroupChatCreate) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSupergroupChatCreate#e61cb71b to nil") - } - if err := b.ConsumeID(MessageSupergroupChatCreateTypeID); err != nil { - return fmt.Errorf("unable to decode messageSupergroupChatCreate#e61cb71b: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSupergroupChatCreate) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSupergroupChatCreate#e61cb71b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSupergroupChatCreate#e61cb71b: field title: %w", err) - } - m.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSupergroupChatCreate) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSupergroupChatCreate#e61cb71b as nil") - } - b.ObjStart() - b.PutID("messageSupergroupChatCreate") - b.Comma() - b.FieldStart("title") - b.PutString(m.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSupergroupChatCreate) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSupergroupChatCreate#e61cb71b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSupergroupChatCreate"); err != nil { - return fmt.Errorf("unable to decode messageSupergroupChatCreate#e61cb71b: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSupergroupChatCreate#e61cb71b: field title: %w", err) - } - m.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (m *MessageSupergroupChatCreate) GetTitle() (value string) { - if m == nil { - return - } - return m.Title -} - -// MessageChatChangeTitle represents TL type `messageChatChangeTitle#2c99bb41`. -type MessageChatChangeTitle struct { - // New chat title - Title string -} - -// MessageChatChangeTitleTypeID is TL type id of MessageChatChangeTitle. -const MessageChatChangeTitleTypeID = 0x2c99bb41 - -// construct implements constructor of MessageContentClass. -func (m MessageChatChangeTitle) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatChangeTitle. -var ( - _ bin.Encoder = &MessageChatChangeTitle{} - _ bin.Decoder = &MessageChatChangeTitle{} - _ bin.BareEncoder = &MessageChatChangeTitle{} - _ bin.BareDecoder = &MessageChatChangeTitle{} - - _ MessageContentClass = &MessageChatChangeTitle{} -) - -func (m *MessageChatChangeTitle) Zero() bool { - if m == nil { - return true - } - if !(m.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatChangeTitle) String() string { - if m == nil { - return "MessageChatChangeTitle(nil)" - } - type Alias MessageChatChangeTitle - return fmt.Sprintf("MessageChatChangeTitle%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatChangeTitle) TypeID() uint32 { - return MessageChatChangeTitleTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatChangeTitle) TypeName() string { - return "messageChatChangeTitle" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatChangeTitle) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatChangeTitle", - ID: MessageChatChangeTitleTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatChangeTitle) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatChangeTitle#2c99bb41 as nil") - } - b.PutID(MessageChatChangeTitleTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatChangeTitle) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatChangeTitle#2c99bb41 as nil") - } - b.PutString(m.Title) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatChangeTitle) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatChangeTitle#2c99bb41 to nil") - } - if err := b.ConsumeID(MessageChatChangeTitleTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatChangeTitle#2c99bb41: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatChangeTitle) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatChangeTitle#2c99bb41 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageChatChangeTitle#2c99bb41: field title: %w", err) - } - m.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatChangeTitle) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatChangeTitle#2c99bb41 as nil") - } - b.ObjStart() - b.PutID("messageChatChangeTitle") - b.Comma() - b.FieldStart("title") - b.PutString(m.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatChangeTitle) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatChangeTitle#2c99bb41 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatChangeTitle"); err != nil { - return fmt.Errorf("unable to decode messageChatChangeTitle#2c99bb41: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageChatChangeTitle#2c99bb41: field title: %w", err) - } - m.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (m *MessageChatChangeTitle) GetTitle() (value string) { - if m == nil { - return - } - return m.Title -} - -// MessageChatChangePhoto represents TL type `messageChatChangePhoto#cf84454b`. -type MessageChatChangePhoto struct { - // New chat photo - Photo ChatPhoto -} - -// MessageChatChangePhotoTypeID is TL type id of MessageChatChangePhoto. -const MessageChatChangePhotoTypeID = 0xcf84454b - -// construct implements constructor of MessageContentClass. -func (m MessageChatChangePhoto) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatChangePhoto. -var ( - _ bin.Encoder = &MessageChatChangePhoto{} - _ bin.Decoder = &MessageChatChangePhoto{} - _ bin.BareEncoder = &MessageChatChangePhoto{} - _ bin.BareDecoder = &MessageChatChangePhoto{} - - _ MessageContentClass = &MessageChatChangePhoto{} -) - -func (m *MessageChatChangePhoto) Zero() bool { - if m == nil { - return true - } - if !(m.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatChangePhoto) String() string { - if m == nil { - return "MessageChatChangePhoto(nil)" - } - type Alias MessageChatChangePhoto - return fmt.Sprintf("MessageChatChangePhoto%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatChangePhoto) TypeID() uint32 { - return MessageChatChangePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatChangePhoto) TypeName() string { - return "messageChatChangePhoto" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatChangePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatChangePhoto", - ID: MessageChatChangePhotoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatChangePhoto) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatChangePhoto#cf84454b as nil") - } - b.PutID(MessageChatChangePhotoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatChangePhoto) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatChangePhoto#cf84454b as nil") - } - if err := m.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageChatChangePhoto#cf84454b: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatChangePhoto) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatChangePhoto#cf84454b to nil") - } - if err := b.ConsumeID(MessageChatChangePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatChangePhoto#cf84454b: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatChangePhoto) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatChangePhoto#cf84454b to nil") - } - { - if err := m.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageChatChangePhoto#cf84454b: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatChangePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatChangePhoto#cf84454b as nil") - } - b.ObjStart() - b.PutID("messageChatChangePhoto") - b.Comma() - b.FieldStart("photo") - if err := m.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageChatChangePhoto#cf84454b: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatChangePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatChangePhoto#cf84454b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatChangePhoto"); err != nil { - return fmt.Errorf("unable to decode messageChatChangePhoto#cf84454b: %w", err) - } - case "photo": - if err := m.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageChatChangePhoto#cf84454b: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (m *MessageChatChangePhoto) GetPhoto() (value ChatPhoto) { - if m == nil { - return - } - return m.Photo -} - -// MessageChatDeletePhoto represents TL type `messageChatDeletePhoto#f502a9e7`. -type MessageChatDeletePhoto struct { -} - -// MessageChatDeletePhotoTypeID is TL type id of MessageChatDeletePhoto. -const MessageChatDeletePhotoTypeID = 0xf502a9e7 - -// construct implements constructor of MessageContentClass. -func (m MessageChatDeletePhoto) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatDeletePhoto. -var ( - _ bin.Encoder = &MessageChatDeletePhoto{} - _ bin.Decoder = &MessageChatDeletePhoto{} - _ bin.BareEncoder = &MessageChatDeletePhoto{} - _ bin.BareDecoder = &MessageChatDeletePhoto{} - - _ MessageContentClass = &MessageChatDeletePhoto{} -) - -func (m *MessageChatDeletePhoto) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatDeletePhoto) String() string { - if m == nil { - return "MessageChatDeletePhoto(nil)" - } - type Alias MessageChatDeletePhoto - return fmt.Sprintf("MessageChatDeletePhoto%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatDeletePhoto) TypeID() uint32 { - return MessageChatDeletePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatDeletePhoto) TypeName() string { - return "messageChatDeletePhoto" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatDeletePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatDeletePhoto", - ID: MessageChatDeletePhotoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatDeletePhoto) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatDeletePhoto#f502a9e7 as nil") - } - b.PutID(MessageChatDeletePhotoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatDeletePhoto) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatDeletePhoto#f502a9e7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatDeletePhoto) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatDeletePhoto#f502a9e7 to nil") - } - if err := b.ConsumeID(MessageChatDeletePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatDeletePhoto#f502a9e7: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatDeletePhoto) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatDeletePhoto#f502a9e7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatDeletePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatDeletePhoto#f502a9e7 as nil") - } - b.ObjStart() - b.PutID("messageChatDeletePhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatDeletePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatDeletePhoto#f502a9e7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatDeletePhoto"); err != nil { - return fmt.Errorf("unable to decode messageChatDeletePhoto#f502a9e7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageChatAddMembers represents TL type `messageChatAddMembers#1e95b1cd`. -type MessageChatAddMembers struct { - // User identifiers of the new members - MemberUserIDs []int64 -} - -// MessageChatAddMembersTypeID is TL type id of MessageChatAddMembers. -const MessageChatAddMembersTypeID = 0x1e95b1cd - -// construct implements constructor of MessageContentClass. -func (m MessageChatAddMembers) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatAddMembers. -var ( - _ bin.Encoder = &MessageChatAddMembers{} - _ bin.Decoder = &MessageChatAddMembers{} - _ bin.BareEncoder = &MessageChatAddMembers{} - _ bin.BareDecoder = &MessageChatAddMembers{} - - _ MessageContentClass = &MessageChatAddMembers{} -) - -func (m *MessageChatAddMembers) Zero() bool { - if m == nil { - return true - } - if !(m.MemberUserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatAddMembers) String() string { - if m == nil { - return "MessageChatAddMembers(nil)" - } - type Alias MessageChatAddMembers - return fmt.Sprintf("MessageChatAddMembers%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatAddMembers) TypeID() uint32 { - return MessageChatAddMembersTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatAddMembers) TypeName() string { - return "messageChatAddMembers" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatAddMembers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatAddMembers", - ID: MessageChatAddMembersTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MemberUserIDs", - SchemaName: "member_user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatAddMembers) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatAddMembers#1e95b1cd as nil") - } - b.PutID(MessageChatAddMembersTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatAddMembers) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatAddMembers#1e95b1cd as nil") - } - b.PutInt(len(m.MemberUserIDs)) - for _, v := range m.MemberUserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatAddMembers) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatAddMembers#1e95b1cd to nil") - } - if err := b.ConsumeID(MessageChatAddMembersTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatAddMembers#1e95b1cd: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatAddMembers) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatAddMembers#1e95b1cd to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageChatAddMembers#1e95b1cd: field member_user_ids: %w", err) - } - - if headerLen > 0 { - m.MemberUserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatAddMembers#1e95b1cd: field member_user_ids: %w", err) - } - m.MemberUserIDs = append(m.MemberUserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatAddMembers) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatAddMembers#1e95b1cd as nil") - } - b.ObjStart() - b.PutID("messageChatAddMembers") - b.Comma() - b.FieldStart("member_user_ids") - b.ArrStart() - for _, v := range m.MemberUserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatAddMembers) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatAddMembers#1e95b1cd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatAddMembers"); err != nil { - return fmt.Errorf("unable to decode messageChatAddMembers#1e95b1cd: %w", err) - } - case "member_user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatAddMembers#1e95b1cd: field member_user_ids: %w", err) - } - m.MemberUserIDs = append(m.MemberUserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageChatAddMembers#1e95b1cd: field member_user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMemberUserIDs returns value of MemberUserIDs field. -func (m *MessageChatAddMembers) GetMemberUserIDs() (value []int64) { - if m == nil { - return - } - return m.MemberUserIDs -} - -// MessageChatJoinByLink represents TL type `messageChatJoinByLink#6e0f407f`. -type MessageChatJoinByLink struct { -} - -// MessageChatJoinByLinkTypeID is TL type id of MessageChatJoinByLink. -const MessageChatJoinByLinkTypeID = 0x6e0f407f - -// construct implements constructor of MessageContentClass. -func (m MessageChatJoinByLink) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatJoinByLink. -var ( - _ bin.Encoder = &MessageChatJoinByLink{} - _ bin.Decoder = &MessageChatJoinByLink{} - _ bin.BareEncoder = &MessageChatJoinByLink{} - _ bin.BareDecoder = &MessageChatJoinByLink{} - - _ MessageContentClass = &MessageChatJoinByLink{} -) - -func (m *MessageChatJoinByLink) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatJoinByLink) String() string { - if m == nil { - return "MessageChatJoinByLink(nil)" - } - type Alias MessageChatJoinByLink - return fmt.Sprintf("MessageChatJoinByLink%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatJoinByLink) TypeID() uint32 { - return MessageChatJoinByLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatJoinByLink) TypeName() string { - return "messageChatJoinByLink" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatJoinByLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatJoinByLink", - ID: MessageChatJoinByLinkTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatJoinByLink) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatJoinByLink#6e0f407f as nil") - } - b.PutID(MessageChatJoinByLinkTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatJoinByLink) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatJoinByLink#6e0f407f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatJoinByLink) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatJoinByLink#6e0f407f to nil") - } - if err := b.ConsumeID(MessageChatJoinByLinkTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatJoinByLink#6e0f407f: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatJoinByLink) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatJoinByLink#6e0f407f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatJoinByLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatJoinByLink#6e0f407f as nil") - } - b.ObjStart() - b.PutID("messageChatJoinByLink") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatJoinByLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatJoinByLink#6e0f407f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatJoinByLink"); err != nil { - return fmt.Errorf("unable to decode messageChatJoinByLink#6e0f407f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageChatJoinByRequest represents TL type `messageChatJoinByRequest#4740cb7c`. -type MessageChatJoinByRequest struct { -} - -// MessageChatJoinByRequestTypeID is TL type id of MessageChatJoinByRequest. -const MessageChatJoinByRequestTypeID = 0x4740cb7c - -// construct implements constructor of MessageContentClass. -func (m MessageChatJoinByRequest) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatJoinByRequest. -var ( - _ bin.Encoder = &MessageChatJoinByRequest{} - _ bin.Decoder = &MessageChatJoinByRequest{} - _ bin.BareEncoder = &MessageChatJoinByRequest{} - _ bin.BareDecoder = &MessageChatJoinByRequest{} - - _ MessageContentClass = &MessageChatJoinByRequest{} -) - -func (m *MessageChatJoinByRequest) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatJoinByRequest) String() string { - if m == nil { - return "MessageChatJoinByRequest(nil)" - } - type Alias MessageChatJoinByRequest - return fmt.Sprintf("MessageChatJoinByRequest%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatJoinByRequest) TypeID() uint32 { - return MessageChatJoinByRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatJoinByRequest) TypeName() string { - return "messageChatJoinByRequest" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatJoinByRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatJoinByRequest", - ID: MessageChatJoinByRequestTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatJoinByRequest) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatJoinByRequest#4740cb7c as nil") - } - b.PutID(MessageChatJoinByRequestTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatJoinByRequest) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatJoinByRequest#4740cb7c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatJoinByRequest) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatJoinByRequest#4740cb7c to nil") - } - if err := b.ConsumeID(MessageChatJoinByRequestTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatJoinByRequest#4740cb7c: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatJoinByRequest) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatJoinByRequest#4740cb7c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatJoinByRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatJoinByRequest#4740cb7c as nil") - } - b.ObjStart() - b.PutID("messageChatJoinByRequest") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatJoinByRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatJoinByRequest#4740cb7c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatJoinByRequest"); err != nil { - return fmt.Errorf("unable to decode messageChatJoinByRequest#4740cb7c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageChatDeleteMember represents TL type `messageChatDeleteMember#37e931a9`. -type MessageChatDeleteMember struct { - // User identifier of the deleted chat member - UserID int64 -} - -// MessageChatDeleteMemberTypeID is TL type id of MessageChatDeleteMember. -const MessageChatDeleteMemberTypeID = 0x37e931a9 - -// construct implements constructor of MessageContentClass. -func (m MessageChatDeleteMember) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatDeleteMember. -var ( - _ bin.Encoder = &MessageChatDeleteMember{} - _ bin.Decoder = &MessageChatDeleteMember{} - _ bin.BareEncoder = &MessageChatDeleteMember{} - _ bin.BareDecoder = &MessageChatDeleteMember{} - - _ MessageContentClass = &MessageChatDeleteMember{} -) - -func (m *MessageChatDeleteMember) Zero() bool { - if m == nil { - return true - } - if !(m.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatDeleteMember) String() string { - if m == nil { - return "MessageChatDeleteMember(nil)" - } - type Alias MessageChatDeleteMember - return fmt.Sprintf("MessageChatDeleteMember%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatDeleteMember) TypeID() uint32 { - return MessageChatDeleteMemberTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatDeleteMember) TypeName() string { - return "messageChatDeleteMember" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatDeleteMember) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatDeleteMember", - ID: MessageChatDeleteMemberTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatDeleteMember) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatDeleteMember#37e931a9 as nil") - } - b.PutID(MessageChatDeleteMemberTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatDeleteMember) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatDeleteMember#37e931a9 as nil") - } - b.PutInt53(m.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatDeleteMember) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatDeleteMember#37e931a9 to nil") - } - if err := b.ConsumeID(MessageChatDeleteMemberTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatDeleteMember#37e931a9: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatDeleteMember) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatDeleteMember#37e931a9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatDeleteMember#37e931a9: field user_id: %w", err) - } - m.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatDeleteMember) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatDeleteMember#37e931a9 as nil") - } - b.ObjStart() - b.PutID("messageChatDeleteMember") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(m.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatDeleteMember) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatDeleteMember#37e931a9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatDeleteMember"); err != nil { - return fmt.Errorf("unable to decode messageChatDeleteMember#37e931a9: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatDeleteMember#37e931a9: field user_id: %w", err) - } - m.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (m *MessageChatDeleteMember) GetUserID() (value int64) { - if m == nil { - return - } - return m.UserID -} - -// MessageChatUpgradeTo represents TL type `messageChatUpgradeTo#63f549b`. -type MessageChatUpgradeTo struct { - // Identifier of the supergroup to which the basic group was upgraded - SupergroupID int64 -} - -// MessageChatUpgradeToTypeID is TL type id of MessageChatUpgradeTo. -const MessageChatUpgradeToTypeID = 0x63f549b - -// construct implements constructor of MessageContentClass. -func (m MessageChatUpgradeTo) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatUpgradeTo. -var ( - _ bin.Encoder = &MessageChatUpgradeTo{} - _ bin.Decoder = &MessageChatUpgradeTo{} - _ bin.BareEncoder = &MessageChatUpgradeTo{} - _ bin.BareDecoder = &MessageChatUpgradeTo{} - - _ MessageContentClass = &MessageChatUpgradeTo{} -) - -func (m *MessageChatUpgradeTo) Zero() bool { - if m == nil { - return true - } - if !(m.SupergroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatUpgradeTo) String() string { - if m == nil { - return "MessageChatUpgradeTo(nil)" - } - type Alias MessageChatUpgradeTo - return fmt.Sprintf("MessageChatUpgradeTo%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatUpgradeTo) TypeID() uint32 { - return MessageChatUpgradeToTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatUpgradeTo) TypeName() string { - return "messageChatUpgradeTo" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatUpgradeTo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatUpgradeTo", - ID: MessageChatUpgradeToTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatUpgradeTo) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatUpgradeTo#63f549b as nil") - } - b.PutID(MessageChatUpgradeToTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatUpgradeTo) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatUpgradeTo#63f549b as nil") - } - b.PutInt53(m.SupergroupID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatUpgradeTo) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatUpgradeTo#63f549b to nil") - } - if err := b.ConsumeID(MessageChatUpgradeToTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatUpgradeTo#63f549b: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatUpgradeTo) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatUpgradeTo#63f549b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatUpgradeTo#63f549b: field supergroup_id: %w", err) - } - m.SupergroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatUpgradeTo) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatUpgradeTo#63f549b as nil") - } - b.ObjStart() - b.PutID("messageChatUpgradeTo") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(m.SupergroupID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatUpgradeTo) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatUpgradeTo#63f549b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatUpgradeTo"); err != nil { - return fmt.Errorf("unable to decode messageChatUpgradeTo#63f549b: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatUpgradeTo#63f549b: field supergroup_id: %w", err) - } - m.SupergroupID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (m *MessageChatUpgradeTo) GetSupergroupID() (value int64) { - if m == nil { - return - } - return m.SupergroupID -} - -// MessageChatUpgradeFrom represents TL type `messageChatUpgradeFrom#136daadc`. -type MessageChatUpgradeFrom struct { - // Title of the newly created supergroup - Title string - // The identifier of the original basic group - BasicGroupID int64 -} - -// MessageChatUpgradeFromTypeID is TL type id of MessageChatUpgradeFrom. -const MessageChatUpgradeFromTypeID = 0x136daadc - -// construct implements constructor of MessageContentClass. -func (m MessageChatUpgradeFrom) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatUpgradeFrom. -var ( - _ bin.Encoder = &MessageChatUpgradeFrom{} - _ bin.Decoder = &MessageChatUpgradeFrom{} - _ bin.BareEncoder = &MessageChatUpgradeFrom{} - _ bin.BareDecoder = &MessageChatUpgradeFrom{} - - _ MessageContentClass = &MessageChatUpgradeFrom{} -) - -func (m *MessageChatUpgradeFrom) Zero() bool { - if m == nil { - return true - } - if !(m.Title == "") { - return false - } - if !(m.BasicGroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatUpgradeFrom) String() string { - if m == nil { - return "MessageChatUpgradeFrom(nil)" - } - type Alias MessageChatUpgradeFrom - return fmt.Sprintf("MessageChatUpgradeFrom%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatUpgradeFrom) TypeID() uint32 { - return MessageChatUpgradeFromTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatUpgradeFrom) TypeName() string { - return "messageChatUpgradeFrom" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatUpgradeFrom) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatUpgradeFrom", - ID: MessageChatUpgradeFromTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "BasicGroupID", - SchemaName: "basic_group_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatUpgradeFrom) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatUpgradeFrom#136daadc as nil") - } - b.PutID(MessageChatUpgradeFromTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatUpgradeFrom) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatUpgradeFrom#136daadc as nil") - } - b.PutString(m.Title) - b.PutInt53(m.BasicGroupID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatUpgradeFrom) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatUpgradeFrom#136daadc to nil") - } - if err := b.ConsumeID(MessageChatUpgradeFromTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatUpgradeFrom#136daadc: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatUpgradeFrom) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatUpgradeFrom#136daadc to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageChatUpgradeFrom#136daadc: field title: %w", err) - } - m.Title = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatUpgradeFrom#136daadc: field basic_group_id: %w", err) - } - m.BasicGroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatUpgradeFrom) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatUpgradeFrom#136daadc as nil") - } - b.ObjStart() - b.PutID("messageChatUpgradeFrom") - b.Comma() - b.FieldStart("title") - b.PutString(m.Title) - b.Comma() - b.FieldStart("basic_group_id") - b.PutInt53(m.BasicGroupID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatUpgradeFrom) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatUpgradeFrom#136daadc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatUpgradeFrom"); err != nil { - return fmt.Errorf("unable to decode messageChatUpgradeFrom#136daadc: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageChatUpgradeFrom#136daadc: field title: %w", err) - } - m.Title = value - case "basic_group_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatUpgradeFrom#136daadc: field basic_group_id: %w", err) - } - m.BasicGroupID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (m *MessageChatUpgradeFrom) GetTitle() (value string) { - if m == nil { - return - } - return m.Title -} - -// GetBasicGroupID returns value of BasicGroupID field. -func (m *MessageChatUpgradeFrom) GetBasicGroupID() (value int64) { - if m == nil { - return - } - return m.BasicGroupID -} - -// MessagePinMessage represents TL type `messagePinMessage#38d55039`. -type MessagePinMessage struct { - // Identifier of the pinned message, can be an identifier of a deleted message or 0 - MessageID int64 -} - -// MessagePinMessageTypeID is TL type id of MessagePinMessage. -const MessagePinMessageTypeID = 0x38d55039 - -// construct implements constructor of MessageContentClass. -func (m MessagePinMessage) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessagePinMessage. -var ( - _ bin.Encoder = &MessagePinMessage{} - _ bin.Decoder = &MessagePinMessage{} - _ bin.BareEncoder = &MessagePinMessage{} - _ bin.BareDecoder = &MessagePinMessage{} - - _ MessageContentClass = &MessagePinMessage{} -) - -func (m *MessagePinMessage) Zero() bool { - if m == nil { - return true - } - if !(m.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePinMessage) String() string { - if m == nil { - return "MessagePinMessage(nil)" - } - type Alias MessagePinMessage - return fmt.Sprintf("MessagePinMessage%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePinMessage) TypeID() uint32 { - return MessagePinMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePinMessage) TypeName() string { - return "messagePinMessage" -} - -// TypeInfo returns info about TL type. -func (m *MessagePinMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePinMessage", - ID: MessagePinMessageTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePinMessage) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePinMessage#38d55039 as nil") - } - b.PutID(MessagePinMessageTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePinMessage) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePinMessage#38d55039 as nil") - } - b.PutInt53(m.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePinMessage) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePinMessage#38d55039 to nil") - } - if err := b.ConsumeID(MessagePinMessageTypeID); err != nil { - return fmt.Errorf("unable to decode messagePinMessage#38d55039: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePinMessage) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePinMessage#38d55039 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePinMessage#38d55039: field message_id: %w", err) - } - m.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePinMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePinMessage#38d55039 as nil") - } - b.ObjStart() - b.PutID("messagePinMessage") - b.Comma() - b.FieldStart("message_id") - b.PutInt53(m.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePinMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePinMessage#38d55039 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePinMessage"); err != nil { - return fmt.Errorf("unable to decode messagePinMessage#38d55039: %w", err) - } - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePinMessage#38d55039: field message_id: %w", err) - } - m.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageID returns value of MessageID field. -func (m *MessagePinMessage) GetMessageID() (value int64) { - if m == nil { - return - } - return m.MessageID -} - -// MessageScreenshotTaken represents TL type `messageScreenshotTaken#a2b86dab`. -type MessageScreenshotTaken struct { -} - -// MessageScreenshotTakenTypeID is TL type id of MessageScreenshotTaken. -const MessageScreenshotTakenTypeID = 0xa2b86dab - -// construct implements constructor of MessageContentClass. -func (m MessageScreenshotTaken) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageScreenshotTaken. -var ( - _ bin.Encoder = &MessageScreenshotTaken{} - _ bin.Decoder = &MessageScreenshotTaken{} - _ bin.BareEncoder = &MessageScreenshotTaken{} - _ bin.BareDecoder = &MessageScreenshotTaken{} - - _ MessageContentClass = &MessageScreenshotTaken{} -) - -func (m *MessageScreenshotTaken) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageScreenshotTaken) String() string { - if m == nil { - return "MessageScreenshotTaken(nil)" - } - type Alias MessageScreenshotTaken - return fmt.Sprintf("MessageScreenshotTaken%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageScreenshotTaken) TypeID() uint32 { - return MessageScreenshotTakenTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageScreenshotTaken) TypeName() string { - return "messageScreenshotTaken" -} - -// TypeInfo returns info about TL type. -func (m *MessageScreenshotTaken) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageScreenshotTaken", - ID: MessageScreenshotTakenTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageScreenshotTaken) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageScreenshotTaken#a2b86dab as nil") - } - b.PutID(MessageScreenshotTakenTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageScreenshotTaken) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageScreenshotTaken#a2b86dab as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageScreenshotTaken) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageScreenshotTaken#a2b86dab to nil") - } - if err := b.ConsumeID(MessageScreenshotTakenTypeID); err != nil { - return fmt.Errorf("unable to decode messageScreenshotTaken#a2b86dab: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageScreenshotTaken) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageScreenshotTaken#a2b86dab to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageScreenshotTaken) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageScreenshotTaken#a2b86dab as nil") - } - b.ObjStart() - b.PutID("messageScreenshotTaken") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageScreenshotTaken) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageScreenshotTaken#a2b86dab to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageScreenshotTaken"); err != nil { - return fmt.Errorf("unable to decode messageScreenshotTaken#a2b86dab: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageChatSetBackground represents TL type `messageChatSetBackground#3d5d7c40`. -type MessageChatSetBackground struct { - // Identifier of the message with a previously set same background; 0 if none. Can be an - // identifier of a deleted message - OldBackgroundMessageID int64 - // The new background - Background ChatBackground - // True, if the background was set only for self - OnlyForSelf bool -} - -// MessageChatSetBackgroundTypeID is TL type id of MessageChatSetBackground. -const MessageChatSetBackgroundTypeID = 0x3d5d7c40 - -// construct implements constructor of MessageContentClass. -func (m MessageChatSetBackground) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatSetBackground. -var ( - _ bin.Encoder = &MessageChatSetBackground{} - _ bin.Decoder = &MessageChatSetBackground{} - _ bin.BareEncoder = &MessageChatSetBackground{} - _ bin.BareDecoder = &MessageChatSetBackground{} - - _ MessageContentClass = &MessageChatSetBackground{} -) - -func (m *MessageChatSetBackground) Zero() bool { - if m == nil { - return true - } - if !(m.OldBackgroundMessageID == 0) { - return false - } - if !(m.Background.Zero()) { - return false - } - if !(m.OnlyForSelf == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatSetBackground) String() string { - if m == nil { - return "MessageChatSetBackground(nil)" - } - type Alias MessageChatSetBackground - return fmt.Sprintf("MessageChatSetBackground%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatSetBackground) TypeID() uint32 { - return MessageChatSetBackgroundTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatSetBackground) TypeName() string { - return "messageChatSetBackground" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatSetBackground) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatSetBackground", - ID: MessageChatSetBackgroundTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldBackgroundMessageID", - SchemaName: "old_background_message_id", - }, - { - Name: "Background", - SchemaName: "background", - }, - { - Name: "OnlyForSelf", - SchemaName: "only_for_self", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatSetBackground) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatSetBackground#3d5d7c40 as nil") - } - b.PutID(MessageChatSetBackgroundTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatSetBackground) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatSetBackground#3d5d7c40 as nil") - } - b.PutInt53(m.OldBackgroundMessageID) - if err := m.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageChatSetBackground#3d5d7c40: field background: %w", err) - } - b.PutBool(m.OnlyForSelf) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatSetBackground) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatSetBackground#3d5d7c40 to nil") - } - if err := b.ConsumeID(MessageChatSetBackgroundTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatSetBackground) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatSetBackground#3d5d7c40 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field old_background_message_id: %w", err) - } - m.OldBackgroundMessageID = value - } - { - if err := m.Background.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field background: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field only_for_self: %w", err) - } - m.OnlyForSelf = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatSetBackground) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatSetBackground#3d5d7c40 as nil") - } - b.ObjStart() - b.PutID("messageChatSetBackground") - b.Comma() - b.FieldStart("old_background_message_id") - b.PutInt53(m.OldBackgroundMessageID) - b.Comma() - b.FieldStart("background") - if err := m.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageChatSetBackground#3d5d7c40: field background: %w", err) - } - b.Comma() - b.FieldStart("only_for_self") - b.PutBool(m.OnlyForSelf) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatSetBackground) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatSetBackground#3d5d7c40 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatSetBackground"); err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: %w", err) - } - case "old_background_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field old_background_message_id: %w", err) - } - m.OldBackgroundMessageID = value - case "background": - if err := m.Background.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field background: %w", err) - } - case "only_for_self": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageChatSetBackground#3d5d7c40: field only_for_self: %w", err) - } - m.OnlyForSelf = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldBackgroundMessageID returns value of OldBackgroundMessageID field. -func (m *MessageChatSetBackground) GetOldBackgroundMessageID() (value int64) { - if m == nil { - return - } - return m.OldBackgroundMessageID -} - -// GetBackground returns value of Background field. -func (m *MessageChatSetBackground) GetBackground() (value ChatBackground) { - if m == nil { - return - } - return m.Background -} - -// GetOnlyForSelf returns value of OnlyForSelf field. -func (m *MessageChatSetBackground) GetOnlyForSelf() (value bool) { - if m == nil { - return - } - return m.OnlyForSelf -} - -// MessageChatSetTheme represents TL type `messageChatSetTheme#99ae9408`. -type MessageChatSetTheme struct { - // If non-empty, name of a new theme, set for the chat. Otherwise, chat theme was reset - // to the default one - ThemeName string -} - -// MessageChatSetThemeTypeID is TL type id of MessageChatSetTheme. -const MessageChatSetThemeTypeID = 0x99ae9408 - -// construct implements constructor of MessageContentClass. -func (m MessageChatSetTheme) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatSetTheme. -var ( - _ bin.Encoder = &MessageChatSetTheme{} - _ bin.Decoder = &MessageChatSetTheme{} - _ bin.BareEncoder = &MessageChatSetTheme{} - _ bin.BareDecoder = &MessageChatSetTheme{} - - _ MessageContentClass = &MessageChatSetTheme{} -) - -func (m *MessageChatSetTheme) Zero() bool { - if m == nil { - return true - } - if !(m.ThemeName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatSetTheme) String() string { - if m == nil { - return "MessageChatSetTheme(nil)" - } - type Alias MessageChatSetTheme - return fmt.Sprintf("MessageChatSetTheme%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatSetTheme) TypeID() uint32 { - return MessageChatSetThemeTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatSetTheme) TypeName() string { - return "messageChatSetTheme" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatSetTheme) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatSetTheme", - ID: MessageChatSetThemeTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ThemeName", - SchemaName: "theme_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatSetTheme) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatSetTheme#99ae9408 as nil") - } - b.PutID(MessageChatSetThemeTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatSetTheme) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatSetTheme#99ae9408 as nil") - } - b.PutString(m.ThemeName) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatSetTheme) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatSetTheme#99ae9408 to nil") - } - if err := b.ConsumeID(MessageChatSetThemeTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatSetTheme#99ae9408: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatSetTheme) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatSetTheme#99ae9408 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageChatSetTheme#99ae9408: field theme_name: %w", err) - } - m.ThemeName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatSetTheme) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatSetTheme#99ae9408 as nil") - } - b.ObjStart() - b.PutID("messageChatSetTheme") - b.Comma() - b.FieldStart("theme_name") - b.PutString(m.ThemeName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatSetTheme) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatSetTheme#99ae9408 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatSetTheme"); err != nil { - return fmt.Errorf("unable to decode messageChatSetTheme#99ae9408: %w", err) - } - case "theme_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageChatSetTheme#99ae9408: field theme_name: %w", err) - } - m.ThemeName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetThemeName returns value of ThemeName field. -func (m *MessageChatSetTheme) GetThemeName() (value string) { - if m == nil { - return - } - return m.ThemeName -} - -// MessageChatSetMessageAutoDeleteTime represents TL type `messageChatSetMessageAutoDeleteTime#619e052e`. -type MessageChatSetMessageAutoDeleteTime struct { - // New value auto-delete or self-destruct time, in seconds; 0 if disabled - MessageAutoDeleteTime int32 - // If not 0, a user identifier, which default setting was automatically applied - FromUserID int64 -} - -// MessageChatSetMessageAutoDeleteTimeTypeID is TL type id of MessageChatSetMessageAutoDeleteTime. -const MessageChatSetMessageAutoDeleteTimeTypeID = 0x619e052e - -// construct implements constructor of MessageContentClass. -func (m MessageChatSetMessageAutoDeleteTime) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatSetMessageAutoDeleteTime. -var ( - _ bin.Encoder = &MessageChatSetMessageAutoDeleteTime{} - _ bin.Decoder = &MessageChatSetMessageAutoDeleteTime{} - _ bin.BareEncoder = &MessageChatSetMessageAutoDeleteTime{} - _ bin.BareDecoder = &MessageChatSetMessageAutoDeleteTime{} - - _ MessageContentClass = &MessageChatSetMessageAutoDeleteTime{} -) - -func (m *MessageChatSetMessageAutoDeleteTime) Zero() bool { - if m == nil { - return true - } - if !(m.MessageAutoDeleteTime == 0) { - return false - } - if !(m.FromUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatSetMessageAutoDeleteTime) String() string { - if m == nil { - return "MessageChatSetMessageAutoDeleteTime(nil)" - } - type Alias MessageChatSetMessageAutoDeleteTime - return fmt.Sprintf("MessageChatSetMessageAutoDeleteTime%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatSetMessageAutoDeleteTime) TypeID() uint32 { - return MessageChatSetMessageAutoDeleteTimeTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatSetMessageAutoDeleteTime) TypeName() string { - return "messageChatSetMessageAutoDeleteTime" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatSetMessageAutoDeleteTime) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatSetMessageAutoDeleteTime", - ID: MessageChatSetMessageAutoDeleteTimeTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageAutoDeleteTime", - SchemaName: "message_auto_delete_time", - }, - { - Name: "FromUserID", - SchemaName: "from_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatSetMessageAutoDeleteTime) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatSetMessageAutoDeleteTime#619e052e as nil") - } - b.PutID(MessageChatSetMessageAutoDeleteTimeTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatSetMessageAutoDeleteTime) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatSetMessageAutoDeleteTime#619e052e as nil") - } - b.PutInt32(m.MessageAutoDeleteTime) - b.PutInt53(m.FromUserID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatSetMessageAutoDeleteTime) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatSetMessageAutoDeleteTime#619e052e to nil") - } - if err := b.ConsumeID(MessageChatSetMessageAutoDeleteTimeTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatSetMessageAutoDeleteTime#619e052e: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatSetMessageAutoDeleteTime) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatSetMessageAutoDeleteTime#619e052e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageChatSetMessageAutoDeleteTime#619e052e: field message_auto_delete_time: %w", err) - } - m.MessageAutoDeleteTime = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatSetMessageAutoDeleteTime#619e052e: field from_user_id: %w", err) - } - m.FromUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatSetMessageAutoDeleteTime) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatSetMessageAutoDeleteTime#619e052e as nil") - } - b.ObjStart() - b.PutID("messageChatSetMessageAutoDeleteTime") - b.Comma() - b.FieldStart("message_auto_delete_time") - b.PutInt32(m.MessageAutoDeleteTime) - b.Comma() - b.FieldStart("from_user_id") - b.PutInt53(m.FromUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatSetMessageAutoDeleteTime) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatSetMessageAutoDeleteTime#619e052e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatSetMessageAutoDeleteTime"); err != nil { - return fmt.Errorf("unable to decode messageChatSetMessageAutoDeleteTime#619e052e: %w", err) - } - case "message_auto_delete_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageChatSetMessageAutoDeleteTime#619e052e: field message_auto_delete_time: %w", err) - } - m.MessageAutoDeleteTime = value - case "from_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageChatSetMessageAutoDeleteTime#619e052e: field from_user_id: %w", err) - } - m.FromUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageAutoDeleteTime returns value of MessageAutoDeleteTime field. -func (m *MessageChatSetMessageAutoDeleteTime) GetMessageAutoDeleteTime() (value int32) { - if m == nil { - return - } - return m.MessageAutoDeleteTime -} - -// GetFromUserID returns value of FromUserID field. -func (m *MessageChatSetMessageAutoDeleteTime) GetFromUserID() (value int64) { - if m == nil { - return - } - return m.FromUserID -} - -// MessageChatBoost represents TL type `messageChatBoost#5e5f658b`. -type MessageChatBoost struct { - // Number of times the chat was boosted - BoostCount int32 -} - -// MessageChatBoostTypeID is TL type id of MessageChatBoost. -const MessageChatBoostTypeID = 0x5e5f658b - -// construct implements constructor of MessageContentClass. -func (m MessageChatBoost) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatBoost. -var ( - _ bin.Encoder = &MessageChatBoost{} - _ bin.Decoder = &MessageChatBoost{} - _ bin.BareEncoder = &MessageChatBoost{} - _ bin.BareDecoder = &MessageChatBoost{} - - _ MessageContentClass = &MessageChatBoost{} -) - -func (m *MessageChatBoost) Zero() bool { - if m == nil { - return true - } - if !(m.BoostCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatBoost) String() string { - if m == nil { - return "MessageChatBoost(nil)" - } - type Alias MessageChatBoost - return fmt.Sprintf("MessageChatBoost%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatBoost) TypeID() uint32 { - return MessageChatBoostTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatBoost) TypeName() string { - return "messageChatBoost" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatBoost) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatBoost", - ID: MessageChatBoostTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BoostCount", - SchemaName: "boost_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatBoost) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatBoost#5e5f658b as nil") - } - b.PutID(MessageChatBoostTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatBoost) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatBoost#5e5f658b as nil") - } - b.PutInt32(m.BoostCount) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatBoost) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatBoost#5e5f658b to nil") - } - if err := b.ConsumeID(MessageChatBoostTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatBoost#5e5f658b: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatBoost) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatBoost#5e5f658b to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageChatBoost#5e5f658b: field boost_count: %w", err) - } - m.BoostCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatBoost) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatBoost#5e5f658b as nil") - } - b.ObjStart() - b.PutID("messageChatBoost") - b.Comma() - b.FieldStart("boost_count") - b.PutInt32(m.BoostCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatBoost) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatBoost#5e5f658b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatBoost"); err != nil { - return fmt.Errorf("unable to decode messageChatBoost#5e5f658b: %w", err) - } - case "boost_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageChatBoost#5e5f658b: field boost_count: %w", err) - } - m.BoostCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBoostCount returns value of BoostCount field. -func (m *MessageChatBoost) GetBoostCount() (value int32) { - if m == nil { - return - } - return m.BoostCount -} - -// MessageForumTopicCreated represents TL type `messageForumTopicCreated#b8ce47d1`. -type MessageForumTopicCreated struct { - // Name of the topic - Name string - // Icon of the topic - Icon ForumTopicIcon -} - -// MessageForumTopicCreatedTypeID is TL type id of MessageForumTopicCreated. -const MessageForumTopicCreatedTypeID = 0xb8ce47d1 - -// construct implements constructor of MessageContentClass. -func (m MessageForumTopicCreated) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageForumTopicCreated. -var ( - _ bin.Encoder = &MessageForumTopicCreated{} - _ bin.Decoder = &MessageForumTopicCreated{} - _ bin.BareEncoder = &MessageForumTopicCreated{} - _ bin.BareDecoder = &MessageForumTopicCreated{} - - _ MessageContentClass = &MessageForumTopicCreated{} -) - -func (m *MessageForumTopicCreated) Zero() bool { - if m == nil { - return true - } - if !(m.Name == "") { - return false - } - if !(m.Icon.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageForumTopicCreated) String() string { - if m == nil { - return "MessageForumTopicCreated(nil)" - } - type Alias MessageForumTopicCreated - return fmt.Sprintf("MessageForumTopicCreated%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageForumTopicCreated) TypeID() uint32 { - return MessageForumTopicCreatedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageForumTopicCreated) TypeName() string { - return "messageForumTopicCreated" -} - -// TypeInfo returns info about TL type. -func (m *MessageForumTopicCreated) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageForumTopicCreated", - ID: MessageForumTopicCreatedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Icon", - SchemaName: "icon", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageForumTopicCreated) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicCreated#b8ce47d1 as nil") - } - b.PutID(MessageForumTopicCreatedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageForumTopicCreated) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicCreated#b8ce47d1 as nil") - } - b.PutString(m.Name) - if err := m.Icon.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageForumTopicCreated#b8ce47d1: field icon: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageForumTopicCreated) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicCreated#b8ce47d1 to nil") - } - if err := b.ConsumeID(MessageForumTopicCreatedTypeID); err != nil { - return fmt.Errorf("unable to decode messageForumTopicCreated#b8ce47d1: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageForumTopicCreated) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicCreated#b8ce47d1 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicCreated#b8ce47d1: field name: %w", err) - } - m.Name = value - } - { - if err := m.Icon.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageForumTopicCreated#b8ce47d1: field icon: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageForumTopicCreated) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicCreated#b8ce47d1 as nil") - } - b.ObjStart() - b.PutID("messageForumTopicCreated") - b.Comma() - b.FieldStart("name") - b.PutString(m.Name) - b.Comma() - b.FieldStart("icon") - if err := m.Icon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageForumTopicCreated#b8ce47d1: field icon: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageForumTopicCreated) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicCreated#b8ce47d1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageForumTopicCreated"); err != nil { - return fmt.Errorf("unable to decode messageForumTopicCreated#b8ce47d1: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicCreated#b8ce47d1: field name: %w", err) - } - m.Name = value - case "icon": - if err := m.Icon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageForumTopicCreated#b8ce47d1: field icon: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (m *MessageForumTopicCreated) GetName() (value string) { - if m == nil { - return - } - return m.Name -} - -// GetIcon returns value of Icon field. -func (m *MessageForumTopicCreated) GetIcon() (value ForumTopicIcon) { - if m == nil { - return - } - return m.Icon -} - -// MessageForumTopicEdited represents TL type `messageForumTopicEdited#c0b780`. -type MessageForumTopicEdited struct { - // If non-empty, the new name of the topic - Name string - // True, if icon's custom_emoji_id is changed - EditIconCustomEmojiID bool - // New unique identifier of the custom emoji shown on the topic icon; 0 if none. Must be - // ignored if edit_icon_custom_emoji_id is false - IconCustomEmojiID int64 -} - -// MessageForumTopicEditedTypeID is TL type id of MessageForumTopicEdited. -const MessageForumTopicEditedTypeID = 0xc0b780 - -// construct implements constructor of MessageContentClass. -func (m MessageForumTopicEdited) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageForumTopicEdited. -var ( - _ bin.Encoder = &MessageForumTopicEdited{} - _ bin.Decoder = &MessageForumTopicEdited{} - _ bin.BareEncoder = &MessageForumTopicEdited{} - _ bin.BareDecoder = &MessageForumTopicEdited{} - - _ MessageContentClass = &MessageForumTopicEdited{} -) - -func (m *MessageForumTopicEdited) Zero() bool { - if m == nil { - return true - } - if !(m.Name == "") { - return false - } - if !(m.EditIconCustomEmojiID == false) { - return false - } - if !(m.IconCustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageForumTopicEdited) String() string { - if m == nil { - return "MessageForumTopicEdited(nil)" - } - type Alias MessageForumTopicEdited - return fmt.Sprintf("MessageForumTopicEdited%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageForumTopicEdited) TypeID() uint32 { - return MessageForumTopicEditedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageForumTopicEdited) TypeName() string { - return "messageForumTopicEdited" -} - -// TypeInfo returns info about TL type. -func (m *MessageForumTopicEdited) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageForumTopicEdited", - ID: MessageForumTopicEditedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "EditIconCustomEmojiID", - SchemaName: "edit_icon_custom_emoji_id", - }, - { - Name: "IconCustomEmojiID", - SchemaName: "icon_custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageForumTopicEdited) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicEdited#c0b780 as nil") - } - b.PutID(MessageForumTopicEditedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageForumTopicEdited) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicEdited#c0b780 as nil") - } - b.PutString(m.Name) - b.PutBool(m.EditIconCustomEmojiID) - b.PutLong(m.IconCustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageForumTopicEdited) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicEdited#c0b780 to nil") - } - if err := b.ConsumeID(MessageForumTopicEditedTypeID); err != nil { - return fmt.Errorf("unable to decode messageForumTopicEdited#c0b780: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageForumTopicEdited) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicEdited#c0b780 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicEdited#c0b780: field name: %w", err) - } - m.Name = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicEdited#c0b780: field edit_icon_custom_emoji_id: %w", err) - } - m.EditIconCustomEmojiID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicEdited#c0b780: field icon_custom_emoji_id: %w", err) - } - m.IconCustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageForumTopicEdited) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicEdited#c0b780 as nil") - } - b.ObjStart() - b.PutID("messageForumTopicEdited") - b.Comma() - b.FieldStart("name") - b.PutString(m.Name) - b.Comma() - b.FieldStart("edit_icon_custom_emoji_id") - b.PutBool(m.EditIconCustomEmojiID) - b.Comma() - b.FieldStart("icon_custom_emoji_id") - b.PutLong(m.IconCustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageForumTopicEdited) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicEdited#c0b780 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageForumTopicEdited"); err != nil { - return fmt.Errorf("unable to decode messageForumTopicEdited#c0b780: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicEdited#c0b780: field name: %w", err) - } - m.Name = value - case "edit_icon_custom_emoji_id": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicEdited#c0b780: field edit_icon_custom_emoji_id: %w", err) - } - m.EditIconCustomEmojiID = value - case "icon_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicEdited#c0b780: field icon_custom_emoji_id: %w", err) - } - m.IconCustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (m *MessageForumTopicEdited) GetName() (value string) { - if m == nil { - return - } - return m.Name -} - -// GetEditIconCustomEmojiID returns value of EditIconCustomEmojiID field. -func (m *MessageForumTopicEdited) GetEditIconCustomEmojiID() (value bool) { - if m == nil { - return - } - return m.EditIconCustomEmojiID -} - -// GetIconCustomEmojiID returns value of IconCustomEmojiID field. -func (m *MessageForumTopicEdited) GetIconCustomEmojiID() (value int64) { - if m == nil { - return - } - return m.IconCustomEmojiID -} - -// MessageForumTopicIsClosedToggled represents TL type `messageForumTopicIsClosedToggled#4b578fe0`. -type MessageForumTopicIsClosedToggled struct { - // True, if the topic was closed; otherwise, the topic was reopened - IsClosed bool -} - -// MessageForumTopicIsClosedToggledTypeID is TL type id of MessageForumTopicIsClosedToggled. -const MessageForumTopicIsClosedToggledTypeID = 0x4b578fe0 - -// construct implements constructor of MessageContentClass. -func (m MessageForumTopicIsClosedToggled) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageForumTopicIsClosedToggled. -var ( - _ bin.Encoder = &MessageForumTopicIsClosedToggled{} - _ bin.Decoder = &MessageForumTopicIsClosedToggled{} - _ bin.BareEncoder = &MessageForumTopicIsClosedToggled{} - _ bin.BareDecoder = &MessageForumTopicIsClosedToggled{} - - _ MessageContentClass = &MessageForumTopicIsClosedToggled{} -) - -func (m *MessageForumTopicIsClosedToggled) Zero() bool { - if m == nil { - return true - } - if !(m.IsClosed == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageForumTopicIsClosedToggled) String() string { - if m == nil { - return "MessageForumTopicIsClosedToggled(nil)" - } - type Alias MessageForumTopicIsClosedToggled - return fmt.Sprintf("MessageForumTopicIsClosedToggled%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageForumTopicIsClosedToggled) TypeID() uint32 { - return MessageForumTopicIsClosedToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageForumTopicIsClosedToggled) TypeName() string { - return "messageForumTopicIsClosedToggled" -} - -// TypeInfo returns info about TL type. -func (m *MessageForumTopicIsClosedToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageForumTopicIsClosedToggled", - ID: MessageForumTopicIsClosedToggledTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsClosed", - SchemaName: "is_closed", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageForumTopicIsClosedToggled) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicIsClosedToggled#4b578fe0 as nil") - } - b.PutID(MessageForumTopicIsClosedToggledTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageForumTopicIsClosedToggled) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicIsClosedToggled#4b578fe0 as nil") - } - b.PutBool(m.IsClosed) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageForumTopicIsClosedToggled) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicIsClosedToggled#4b578fe0 to nil") - } - if err := b.ConsumeID(MessageForumTopicIsClosedToggledTypeID); err != nil { - return fmt.Errorf("unable to decode messageForumTopicIsClosedToggled#4b578fe0: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageForumTopicIsClosedToggled) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicIsClosedToggled#4b578fe0 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicIsClosedToggled#4b578fe0: field is_closed: %w", err) - } - m.IsClosed = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageForumTopicIsClosedToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicIsClosedToggled#4b578fe0 as nil") - } - b.ObjStart() - b.PutID("messageForumTopicIsClosedToggled") - b.Comma() - b.FieldStart("is_closed") - b.PutBool(m.IsClosed) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageForumTopicIsClosedToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicIsClosedToggled#4b578fe0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageForumTopicIsClosedToggled"); err != nil { - return fmt.Errorf("unable to decode messageForumTopicIsClosedToggled#4b578fe0: %w", err) - } - case "is_closed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicIsClosedToggled#4b578fe0: field is_closed: %w", err) - } - m.IsClosed = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsClosed returns value of IsClosed field. -func (m *MessageForumTopicIsClosedToggled) GetIsClosed() (value bool) { - if m == nil { - return - } - return m.IsClosed -} - -// MessageForumTopicIsHiddenToggled represents TL type `messageForumTopicIsHiddenToggled#979393fe`. -type MessageForumTopicIsHiddenToggled struct { - // True, if the topic was hidden; otherwise, the topic was unhidden - IsHidden bool -} - -// MessageForumTopicIsHiddenToggledTypeID is TL type id of MessageForumTopicIsHiddenToggled. -const MessageForumTopicIsHiddenToggledTypeID = 0x979393fe - -// construct implements constructor of MessageContentClass. -func (m MessageForumTopicIsHiddenToggled) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageForumTopicIsHiddenToggled. -var ( - _ bin.Encoder = &MessageForumTopicIsHiddenToggled{} - _ bin.Decoder = &MessageForumTopicIsHiddenToggled{} - _ bin.BareEncoder = &MessageForumTopicIsHiddenToggled{} - _ bin.BareDecoder = &MessageForumTopicIsHiddenToggled{} - - _ MessageContentClass = &MessageForumTopicIsHiddenToggled{} -) - -func (m *MessageForumTopicIsHiddenToggled) Zero() bool { - if m == nil { - return true - } - if !(m.IsHidden == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageForumTopicIsHiddenToggled) String() string { - if m == nil { - return "MessageForumTopicIsHiddenToggled(nil)" - } - type Alias MessageForumTopicIsHiddenToggled - return fmt.Sprintf("MessageForumTopicIsHiddenToggled%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageForumTopicIsHiddenToggled) TypeID() uint32 { - return MessageForumTopicIsHiddenToggledTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageForumTopicIsHiddenToggled) TypeName() string { - return "messageForumTopicIsHiddenToggled" -} - -// TypeInfo returns info about TL type. -func (m *MessageForumTopicIsHiddenToggled) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageForumTopicIsHiddenToggled", - ID: MessageForumTopicIsHiddenToggledTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsHidden", - SchemaName: "is_hidden", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageForumTopicIsHiddenToggled) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicIsHiddenToggled#979393fe as nil") - } - b.PutID(MessageForumTopicIsHiddenToggledTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageForumTopicIsHiddenToggled) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicIsHiddenToggled#979393fe as nil") - } - b.PutBool(m.IsHidden) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageForumTopicIsHiddenToggled) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicIsHiddenToggled#979393fe to nil") - } - if err := b.ConsumeID(MessageForumTopicIsHiddenToggledTypeID); err != nil { - return fmt.Errorf("unable to decode messageForumTopicIsHiddenToggled#979393fe: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageForumTopicIsHiddenToggled) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicIsHiddenToggled#979393fe to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicIsHiddenToggled#979393fe: field is_hidden: %w", err) - } - m.IsHidden = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageForumTopicIsHiddenToggled) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageForumTopicIsHiddenToggled#979393fe as nil") - } - b.ObjStart() - b.PutID("messageForumTopicIsHiddenToggled") - b.Comma() - b.FieldStart("is_hidden") - b.PutBool(m.IsHidden) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageForumTopicIsHiddenToggled) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageForumTopicIsHiddenToggled#979393fe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageForumTopicIsHiddenToggled"); err != nil { - return fmt.Errorf("unable to decode messageForumTopicIsHiddenToggled#979393fe: %w", err) - } - case "is_hidden": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageForumTopicIsHiddenToggled#979393fe: field is_hidden: %w", err) - } - m.IsHidden = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsHidden returns value of IsHidden field. -func (m *MessageForumTopicIsHiddenToggled) GetIsHidden() (value bool) { - if m == nil { - return - } - return m.IsHidden -} - -// MessageSuggestProfilePhoto represents TL type `messageSuggestProfilePhoto#b5611ee7`. -type MessageSuggestProfilePhoto struct { - // The suggested chat photo. Use the method setProfilePhoto with inputChatPhotoPrevious - // to apply the photo - Photo ChatPhoto -} - -// MessageSuggestProfilePhotoTypeID is TL type id of MessageSuggestProfilePhoto. -const MessageSuggestProfilePhotoTypeID = 0xb5611ee7 - -// construct implements constructor of MessageContentClass. -func (m MessageSuggestProfilePhoto) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageSuggestProfilePhoto. -var ( - _ bin.Encoder = &MessageSuggestProfilePhoto{} - _ bin.Decoder = &MessageSuggestProfilePhoto{} - _ bin.BareEncoder = &MessageSuggestProfilePhoto{} - _ bin.BareDecoder = &MessageSuggestProfilePhoto{} - - _ MessageContentClass = &MessageSuggestProfilePhoto{} -) - -func (m *MessageSuggestProfilePhoto) Zero() bool { - if m == nil { - return true - } - if !(m.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSuggestProfilePhoto) String() string { - if m == nil { - return "MessageSuggestProfilePhoto(nil)" - } - type Alias MessageSuggestProfilePhoto - return fmt.Sprintf("MessageSuggestProfilePhoto%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSuggestProfilePhoto) TypeID() uint32 { - return MessageSuggestProfilePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSuggestProfilePhoto) TypeName() string { - return "messageSuggestProfilePhoto" -} - -// TypeInfo returns info about TL type. -func (m *MessageSuggestProfilePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSuggestProfilePhoto", - ID: MessageSuggestProfilePhotoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSuggestProfilePhoto) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSuggestProfilePhoto#b5611ee7 as nil") - } - b.PutID(MessageSuggestProfilePhotoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSuggestProfilePhoto) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSuggestProfilePhoto#b5611ee7 as nil") - } - if err := m.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageSuggestProfilePhoto#b5611ee7: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSuggestProfilePhoto) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSuggestProfilePhoto#b5611ee7 to nil") - } - if err := b.ConsumeID(MessageSuggestProfilePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode messageSuggestProfilePhoto#b5611ee7: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSuggestProfilePhoto) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSuggestProfilePhoto#b5611ee7 to nil") - } - { - if err := m.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageSuggestProfilePhoto#b5611ee7: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSuggestProfilePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSuggestProfilePhoto#b5611ee7 as nil") - } - b.ObjStart() - b.PutID("messageSuggestProfilePhoto") - b.Comma() - b.FieldStart("photo") - if err := m.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageSuggestProfilePhoto#b5611ee7: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSuggestProfilePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSuggestProfilePhoto#b5611ee7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSuggestProfilePhoto"); err != nil { - return fmt.Errorf("unable to decode messageSuggestProfilePhoto#b5611ee7: %w", err) - } - case "photo": - if err := m.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageSuggestProfilePhoto#b5611ee7: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (m *MessageSuggestProfilePhoto) GetPhoto() (value ChatPhoto) { - if m == nil { - return - } - return m.Photo -} - -// MessageCustomServiceAction represents TL type `messageCustomServiceAction#5595c772`. -type MessageCustomServiceAction struct { - // Message text to be shown in the chat - Text string -} - -// MessageCustomServiceActionTypeID is TL type id of MessageCustomServiceAction. -const MessageCustomServiceActionTypeID = 0x5595c772 - -// construct implements constructor of MessageContentClass. -func (m MessageCustomServiceAction) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageCustomServiceAction. -var ( - _ bin.Encoder = &MessageCustomServiceAction{} - _ bin.Decoder = &MessageCustomServiceAction{} - _ bin.BareEncoder = &MessageCustomServiceAction{} - _ bin.BareDecoder = &MessageCustomServiceAction{} - - _ MessageContentClass = &MessageCustomServiceAction{} -) - -func (m *MessageCustomServiceAction) Zero() bool { - if m == nil { - return true - } - if !(m.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageCustomServiceAction) String() string { - if m == nil { - return "MessageCustomServiceAction(nil)" - } - type Alias MessageCustomServiceAction - return fmt.Sprintf("MessageCustomServiceAction%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageCustomServiceAction) TypeID() uint32 { - return MessageCustomServiceActionTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageCustomServiceAction) TypeName() string { - return "messageCustomServiceAction" -} - -// TypeInfo returns info about TL type. -func (m *MessageCustomServiceAction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageCustomServiceAction", - ID: MessageCustomServiceActionTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageCustomServiceAction) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageCustomServiceAction#5595c772 as nil") - } - b.PutID(MessageCustomServiceActionTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageCustomServiceAction) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageCustomServiceAction#5595c772 as nil") - } - b.PutString(m.Text) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageCustomServiceAction) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageCustomServiceAction#5595c772 to nil") - } - if err := b.ConsumeID(MessageCustomServiceActionTypeID); err != nil { - return fmt.Errorf("unable to decode messageCustomServiceAction#5595c772: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageCustomServiceAction) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageCustomServiceAction#5595c772 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageCustomServiceAction#5595c772: field text: %w", err) - } - m.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageCustomServiceAction) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageCustomServiceAction#5595c772 as nil") - } - b.ObjStart() - b.PutID("messageCustomServiceAction") - b.Comma() - b.FieldStart("text") - b.PutString(m.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageCustomServiceAction) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageCustomServiceAction#5595c772 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageCustomServiceAction"); err != nil { - return fmt.Errorf("unable to decode messageCustomServiceAction#5595c772: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageCustomServiceAction#5595c772: field text: %w", err) - } - m.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (m *MessageCustomServiceAction) GetText() (value string) { - if m == nil { - return - } - return m.Text -} - -// MessageGameScore represents TL type `messageGameScore#50299d7f`. -type MessageGameScore struct { - // Identifier of the message with the game, can be an identifier of a deleted message - GameMessageID int64 - // Identifier of the game; may be different from the games presented in the message with - // the game - GameID int64 - // New score - Score int32 -} - -// MessageGameScoreTypeID is TL type id of MessageGameScore. -const MessageGameScoreTypeID = 0x50299d7f - -// construct implements constructor of MessageContentClass. -func (m MessageGameScore) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageGameScore. -var ( - _ bin.Encoder = &MessageGameScore{} - _ bin.Decoder = &MessageGameScore{} - _ bin.BareEncoder = &MessageGameScore{} - _ bin.BareDecoder = &MessageGameScore{} - - _ MessageContentClass = &MessageGameScore{} -) - -func (m *MessageGameScore) Zero() bool { - if m == nil { - return true - } - if !(m.GameMessageID == 0) { - return false - } - if !(m.GameID == 0) { - return false - } - if !(m.Score == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageGameScore) String() string { - if m == nil { - return "MessageGameScore(nil)" - } - type Alias MessageGameScore - return fmt.Sprintf("MessageGameScore%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageGameScore) TypeID() uint32 { - return MessageGameScoreTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageGameScore) TypeName() string { - return "messageGameScore" -} - -// TypeInfo returns info about TL type. -func (m *MessageGameScore) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageGameScore", - ID: MessageGameScoreTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GameMessageID", - SchemaName: "game_message_id", - }, - { - Name: "GameID", - SchemaName: "game_id", - }, - { - Name: "Score", - SchemaName: "score", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageGameScore) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGameScore#50299d7f as nil") - } - b.PutID(MessageGameScoreTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageGameScore) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGameScore#50299d7f as nil") - } - b.PutInt53(m.GameMessageID) - b.PutLong(m.GameID) - b.PutInt32(m.Score) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageGameScore) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGameScore#50299d7f to nil") - } - if err := b.ConsumeID(MessageGameScoreTypeID); err != nil { - return fmt.Errorf("unable to decode messageGameScore#50299d7f: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageGameScore) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGameScore#50299d7f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGameScore#50299d7f: field game_message_id: %w", err) - } - m.GameMessageID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageGameScore#50299d7f: field game_id: %w", err) - } - m.GameID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGameScore#50299d7f: field score: %w", err) - } - m.Score = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageGameScore) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageGameScore#50299d7f as nil") - } - b.ObjStart() - b.PutID("messageGameScore") - b.Comma() - b.FieldStart("game_message_id") - b.PutInt53(m.GameMessageID) - b.Comma() - b.FieldStart("game_id") - b.PutLong(m.GameID) - b.Comma() - b.FieldStart("score") - b.PutInt32(m.Score) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageGameScore) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageGameScore#50299d7f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageGameScore"); err != nil { - return fmt.Errorf("unable to decode messageGameScore#50299d7f: %w", err) - } - case "game_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGameScore#50299d7f: field game_message_id: %w", err) - } - m.GameMessageID = value - case "game_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageGameScore#50299d7f: field game_id: %w", err) - } - m.GameID = value - case "score": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGameScore#50299d7f: field score: %w", err) - } - m.Score = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGameMessageID returns value of GameMessageID field. -func (m *MessageGameScore) GetGameMessageID() (value int64) { - if m == nil { - return - } - return m.GameMessageID -} - -// GetGameID returns value of GameID field. -func (m *MessageGameScore) GetGameID() (value int64) { - if m == nil { - return - } - return m.GameID -} - -// GetScore returns value of Score field. -func (m *MessageGameScore) GetScore() (value int32) { - if m == nil { - return - } - return m.Score -} - -// MessagePaymentSuccessful represents TL type `messagePaymentSuccessful#3e661911`. -type MessagePaymentSuccessful struct { - // Identifier of the chat, containing the corresponding invoice message - InvoiceChatID int64 - // Identifier of the message with the corresponding invoice; can be 0 or an identifier of - // a deleted message - InvoiceMessageID int64 - // Currency for the price of the product - Currency string - // Total price for the product, in the smallest units of the currency - TotalAmount int64 - // Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the - // payment isn't recurring - SubscriptionUntilDate int32 - // True, if this is a recurring payment - IsRecurring bool - // True, if this is the first recurring payment - IsFirstRecurring bool - // Name of the invoice; may be empty if unknown - InvoiceName string -} - -// MessagePaymentSuccessfulTypeID is TL type id of MessagePaymentSuccessful. -const MessagePaymentSuccessfulTypeID = 0x3e661911 - -// construct implements constructor of MessageContentClass. -func (m MessagePaymentSuccessful) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessagePaymentSuccessful. -var ( - _ bin.Encoder = &MessagePaymentSuccessful{} - _ bin.Decoder = &MessagePaymentSuccessful{} - _ bin.BareEncoder = &MessagePaymentSuccessful{} - _ bin.BareDecoder = &MessagePaymentSuccessful{} - - _ MessageContentClass = &MessagePaymentSuccessful{} -) - -func (m *MessagePaymentSuccessful) Zero() bool { - if m == nil { - return true - } - if !(m.InvoiceChatID == 0) { - return false - } - if !(m.InvoiceMessageID == 0) { - return false - } - if !(m.Currency == "") { - return false - } - if !(m.TotalAmount == 0) { - return false - } - if !(m.SubscriptionUntilDate == 0) { - return false - } - if !(m.IsRecurring == false) { - return false - } - if !(m.IsFirstRecurring == false) { - return false - } - if !(m.InvoiceName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePaymentSuccessful) String() string { - if m == nil { - return "MessagePaymentSuccessful(nil)" - } - type Alias MessagePaymentSuccessful - return fmt.Sprintf("MessagePaymentSuccessful%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePaymentSuccessful) TypeID() uint32 { - return MessagePaymentSuccessfulTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePaymentSuccessful) TypeName() string { - return "messagePaymentSuccessful" -} - -// TypeInfo returns info about TL type. -func (m *MessagePaymentSuccessful) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePaymentSuccessful", - ID: MessagePaymentSuccessfulTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InvoiceChatID", - SchemaName: "invoice_chat_id", - }, - { - Name: "InvoiceMessageID", - SchemaName: "invoice_message_id", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "TotalAmount", - SchemaName: "total_amount", - }, - { - Name: "SubscriptionUntilDate", - SchemaName: "subscription_until_date", - }, - { - Name: "IsRecurring", - SchemaName: "is_recurring", - }, - { - Name: "IsFirstRecurring", - SchemaName: "is_first_recurring", - }, - { - Name: "InvoiceName", - SchemaName: "invoice_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePaymentSuccessful) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePaymentSuccessful#3e661911 as nil") - } - b.PutID(MessagePaymentSuccessfulTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePaymentSuccessful) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePaymentSuccessful#3e661911 as nil") - } - b.PutInt53(m.InvoiceChatID) - b.PutInt53(m.InvoiceMessageID) - b.PutString(m.Currency) - b.PutInt53(m.TotalAmount) - b.PutInt32(m.SubscriptionUntilDate) - b.PutBool(m.IsRecurring) - b.PutBool(m.IsFirstRecurring) - b.PutString(m.InvoiceName) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePaymentSuccessful) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePaymentSuccessful#3e661911 to nil") - } - if err := b.ConsumeID(MessagePaymentSuccessfulTypeID); err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePaymentSuccessful) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePaymentSuccessful#3e661911 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field invoice_chat_id: %w", err) - } - m.InvoiceChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field invoice_message_id: %w", err) - } - m.InvoiceMessageID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field currency: %w", err) - } - m.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field total_amount: %w", err) - } - m.TotalAmount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field subscription_until_date: %w", err) - } - m.SubscriptionUntilDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field is_recurring: %w", err) - } - m.IsRecurring = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field is_first_recurring: %w", err) - } - m.IsFirstRecurring = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field invoice_name: %w", err) - } - m.InvoiceName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePaymentSuccessful) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePaymentSuccessful#3e661911 as nil") - } - b.ObjStart() - b.PutID("messagePaymentSuccessful") - b.Comma() - b.FieldStart("invoice_chat_id") - b.PutInt53(m.InvoiceChatID) - b.Comma() - b.FieldStart("invoice_message_id") - b.PutInt53(m.InvoiceMessageID) - b.Comma() - b.FieldStart("currency") - b.PutString(m.Currency) - b.Comma() - b.FieldStart("total_amount") - b.PutInt53(m.TotalAmount) - b.Comma() - b.FieldStart("subscription_until_date") - b.PutInt32(m.SubscriptionUntilDate) - b.Comma() - b.FieldStart("is_recurring") - b.PutBool(m.IsRecurring) - b.Comma() - b.FieldStart("is_first_recurring") - b.PutBool(m.IsFirstRecurring) - b.Comma() - b.FieldStart("invoice_name") - b.PutString(m.InvoiceName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePaymentSuccessful) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePaymentSuccessful#3e661911 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePaymentSuccessful"); err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: %w", err) - } - case "invoice_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field invoice_chat_id: %w", err) - } - m.InvoiceChatID = value - case "invoice_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field invoice_message_id: %w", err) - } - m.InvoiceMessageID = value - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field currency: %w", err) - } - m.Currency = value - case "total_amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field total_amount: %w", err) - } - m.TotalAmount = value - case "subscription_until_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field subscription_until_date: %w", err) - } - m.SubscriptionUntilDate = value - case "is_recurring": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field is_recurring: %w", err) - } - m.IsRecurring = value - case "is_first_recurring": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field is_first_recurring: %w", err) - } - m.IsFirstRecurring = value - case "invoice_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessful#3e661911: field invoice_name: %w", err) - } - m.InvoiceName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInvoiceChatID returns value of InvoiceChatID field. -func (m *MessagePaymentSuccessful) GetInvoiceChatID() (value int64) { - if m == nil { - return - } - return m.InvoiceChatID -} - -// GetInvoiceMessageID returns value of InvoiceMessageID field. -func (m *MessagePaymentSuccessful) GetInvoiceMessageID() (value int64) { - if m == nil { - return - } - return m.InvoiceMessageID -} - -// GetCurrency returns value of Currency field. -func (m *MessagePaymentSuccessful) GetCurrency() (value string) { - if m == nil { - return - } - return m.Currency -} - -// GetTotalAmount returns value of TotalAmount field. -func (m *MessagePaymentSuccessful) GetTotalAmount() (value int64) { - if m == nil { - return - } - return m.TotalAmount -} - -// GetSubscriptionUntilDate returns value of SubscriptionUntilDate field. -func (m *MessagePaymentSuccessful) GetSubscriptionUntilDate() (value int32) { - if m == nil { - return - } - return m.SubscriptionUntilDate -} - -// GetIsRecurring returns value of IsRecurring field. -func (m *MessagePaymentSuccessful) GetIsRecurring() (value bool) { - if m == nil { - return - } - return m.IsRecurring -} - -// GetIsFirstRecurring returns value of IsFirstRecurring field. -func (m *MessagePaymentSuccessful) GetIsFirstRecurring() (value bool) { - if m == nil { - return - } - return m.IsFirstRecurring -} - -// GetInvoiceName returns value of InvoiceName field. -func (m *MessagePaymentSuccessful) GetInvoiceName() (value string) { - if m == nil { - return - } - return m.InvoiceName -} - -// MessagePaymentSuccessfulBot represents TL type `messagePaymentSuccessfulBot#c7664dbf`. -type MessagePaymentSuccessfulBot struct { - // Currency for price of the product - Currency string - // Total price for the product, in the smallest units of the currency - TotalAmount int64 - // Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the - // payment isn't recurring - SubscriptionUntilDate int32 - // True, if this is a recurring payment - IsRecurring bool - // True, if this is the first recurring payment - IsFirstRecurring bool - // Invoice payload - InvoicePayload []byte - // Identifier of the shipping option chosen by the user; may be empty if not applicable; - // for bots only - ShippingOptionID string - // Information about the order; may be null; for bots only - OrderInfo OrderInfo - // Telegram payment identifier - TelegramPaymentChargeID string - // Provider payment identifier - ProviderPaymentChargeID string -} - -// MessagePaymentSuccessfulBotTypeID is TL type id of MessagePaymentSuccessfulBot. -const MessagePaymentSuccessfulBotTypeID = 0xc7664dbf - -// construct implements constructor of MessageContentClass. -func (m MessagePaymentSuccessfulBot) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessagePaymentSuccessfulBot. -var ( - _ bin.Encoder = &MessagePaymentSuccessfulBot{} - _ bin.Decoder = &MessagePaymentSuccessfulBot{} - _ bin.BareEncoder = &MessagePaymentSuccessfulBot{} - _ bin.BareDecoder = &MessagePaymentSuccessfulBot{} - - _ MessageContentClass = &MessagePaymentSuccessfulBot{} -) - -func (m *MessagePaymentSuccessfulBot) Zero() bool { - if m == nil { - return true - } - if !(m.Currency == "") { - return false - } - if !(m.TotalAmount == 0) { - return false - } - if !(m.SubscriptionUntilDate == 0) { - return false - } - if !(m.IsRecurring == false) { - return false - } - if !(m.IsFirstRecurring == false) { - return false - } - if !(m.InvoicePayload == nil) { - return false - } - if !(m.ShippingOptionID == "") { - return false - } - if !(m.OrderInfo.Zero()) { - return false - } - if !(m.TelegramPaymentChargeID == "") { - return false - } - if !(m.ProviderPaymentChargeID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePaymentSuccessfulBot) String() string { - if m == nil { - return "MessagePaymentSuccessfulBot(nil)" - } - type Alias MessagePaymentSuccessfulBot - return fmt.Sprintf("MessagePaymentSuccessfulBot%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePaymentSuccessfulBot) TypeID() uint32 { - return MessagePaymentSuccessfulBotTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePaymentSuccessfulBot) TypeName() string { - return "messagePaymentSuccessfulBot" -} - -// TypeInfo returns info about TL type. -func (m *MessagePaymentSuccessfulBot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePaymentSuccessfulBot", - ID: MessagePaymentSuccessfulBotTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "TotalAmount", - SchemaName: "total_amount", - }, - { - Name: "SubscriptionUntilDate", - SchemaName: "subscription_until_date", - }, - { - Name: "IsRecurring", - SchemaName: "is_recurring", - }, - { - Name: "IsFirstRecurring", - SchemaName: "is_first_recurring", - }, - { - Name: "InvoicePayload", - SchemaName: "invoice_payload", - }, - { - Name: "ShippingOptionID", - SchemaName: "shipping_option_id", - }, - { - Name: "OrderInfo", - SchemaName: "order_info", - }, - { - Name: "TelegramPaymentChargeID", - SchemaName: "telegram_payment_charge_id", - }, - { - Name: "ProviderPaymentChargeID", - SchemaName: "provider_payment_charge_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePaymentSuccessfulBot) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePaymentSuccessfulBot#c7664dbf as nil") - } - b.PutID(MessagePaymentSuccessfulBotTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePaymentSuccessfulBot) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePaymentSuccessfulBot#c7664dbf as nil") - } - b.PutString(m.Currency) - b.PutInt53(m.TotalAmount) - b.PutInt32(m.SubscriptionUntilDate) - b.PutBool(m.IsRecurring) - b.PutBool(m.IsFirstRecurring) - b.PutBytes(m.InvoicePayload) - b.PutString(m.ShippingOptionID) - if err := m.OrderInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePaymentSuccessfulBot#c7664dbf: field order_info: %w", err) - } - b.PutString(m.TelegramPaymentChargeID) - b.PutString(m.ProviderPaymentChargeID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePaymentSuccessfulBot) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePaymentSuccessfulBot#c7664dbf to nil") - } - if err := b.ConsumeID(MessagePaymentSuccessfulBotTypeID); err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePaymentSuccessfulBot) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePaymentSuccessfulBot#c7664dbf to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field currency: %w", err) - } - m.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field total_amount: %w", err) - } - m.TotalAmount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field subscription_until_date: %w", err) - } - m.SubscriptionUntilDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field is_recurring: %w", err) - } - m.IsRecurring = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field is_first_recurring: %w", err) - } - m.IsFirstRecurring = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field invoice_payload: %w", err) - } - m.InvoicePayload = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field shipping_option_id: %w", err) - } - m.ShippingOptionID = value - } - { - if err := m.OrderInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field order_info: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field telegram_payment_charge_id: %w", err) - } - m.TelegramPaymentChargeID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field provider_payment_charge_id: %w", err) - } - m.ProviderPaymentChargeID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePaymentSuccessfulBot) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePaymentSuccessfulBot#c7664dbf as nil") - } - b.ObjStart() - b.PutID("messagePaymentSuccessfulBot") - b.Comma() - b.FieldStart("currency") - b.PutString(m.Currency) - b.Comma() - b.FieldStart("total_amount") - b.PutInt53(m.TotalAmount) - b.Comma() - b.FieldStart("subscription_until_date") - b.PutInt32(m.SubscriptionUntilDate) - b.Comma() - b.FieldStart("is_recurring") - b.PutBool(m.IsRecurring) - b.Comma() - b.FieldStart("is_first_recurring") - b.PutBool(m.IsFirstRecurring) - b.Comma() - b.FieldStart("invoice_payload") - b.PutBytes(m.InvoicePayload) - b.Comma() - b.FieldStart("shipping_option_id") - b.PutString(m.ShippingOptionID) - b.Comma() - b.FieldStart("order_info") - if err := m.OrderInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePaymentSuccessfulBot#c7664dbf: field order_info: %w", err) - } - b.Comma() - b.FieldStart("telegram_payment_charge_id") - b.PutString(m.TelegramPaymentChargeID) - b.Comma() - b.FieldStart("provider_payment_charge_id") - b.PutString(m.ProviderPaymentChargeID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePaymentSuccessfulBot) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePaymentSuccessfulBot#c7664dbf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePaymentSuccessfulBot"); err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field currency: %w", err) - } - m.Currency = value - case "total_amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field total_amount: %w", err) - } - m.TotalAmount = value - case "subscription_until_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field subscription_until_date: %w", err) - } - m.SubscriptionUntilDate = value - case "is_recurring": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field is_recurring: %w", err) - } - m.IsRecurring = value - case "is_first_recurring": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field is_first_recurring: %w", err) - } - m.IsFirstRecurring = value - case "invoice_payload": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field invoice_payload: %w", err) - } - m.InvoicePayload = value - case "shipping_option_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field shipping_option_id: %w", err) - } - m.ShippingOptionID = value - case "order_info": - if err := m.OrderInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field order_info: %w", err) - } - case "telegram_payment_charge_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field telegram_payment_charge_id: %w", err) - } - m.TelegramPaymentChargeID = value - case "provider_payment_charge_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentSuccessfulBot#c7664dbf: field provider_payment_charge_id: %w", err) - } - m.ProviderPaymentChargeID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCurrency returns value of Currency field. -func (m *MessagePaymentSuccessfulBot) GetCurrency() (value string) { - if m == nil { - return - } - return m.Currency -} - -// GetTotalAmount returns value of TotalAmount field. -func (m *MessagePaymentSuccessfulBot) GetTotalAmount() (value int64) { - if m == nil { - return - } - return m.TotalAmount -} - -// GetSubscriptionUntilDate returns value of SubscriptionUntilDate field. -func (m *MessagePaymentSuccessfulBot) GetSubscriptionUntilDate() (value int32) { - if m == nil { - return - } - return m.SubscriptionUntilDate -} - -// GetIsRecurring returns value of IsRecurring field. -func (m *MessagePaymentSuccessfulBot) GetIsRecurring() (value bool) { - if m == nil { - return - } - return m.IsRecurring -} - -// GetIsFirstRecurring returns value of IsFirstRecurring field. -func (m *MessagePaymentSuccessfulBot) GetIsFirstRecurring() (value bool) { - if m == nil { - return - } - return m.IsFirstRecurring -} - -// GetInvoicePayload returns value of InvoicePayload field. -func (m *MessagePaymentSuccessfulBot) GetInvoicePayload() (value []byte) { - if m == nil { - return - } - return m.InvoicePayload -} - -// GetShippingOptionID returns value of ShippingOptionID field. -func (m *MessagePaymentSuccessfulBot) GetShippingOptionID() (value string) { - if m == nil { - return - } - return m.ShippingOptionID -} - -// GetOrderInfo returns value of OrderInfo field. -func (m *MessagePaymentSuccessfulBot) GetOrderInfo() (value OrderInfo) { - if m == nil { - return - } - return m.OrderInfo -} - -// GetTelegramPaymentChargeID returns value of TelegramPaymentChargeID field. -func (m *MessagePaymentSuccessfulBot) GetTelegramPaymentChargeID() (value string) { - if m == nil { - return - } - return m.TelegramPaymentChargeID -} - -// GetProviderPaymentChargeID returns value of ProviderPaymentChargeID field. -func (m *MessagePaymentSuccessfulBot) GetProviderPaymentChargeID() (value string) { - if m == nil { - return - } - return m.ProviderPaymentChargeID -} - -// MessagePaymentRefunded represents TL type `messagePaymentRefunded#11bcb8f3`. -type MessagePaymentRefunded struct { - // Identifier of the previous owner of the Telegram Stars that refunds them - OwnerID MessageSenderClass - // Currency for the price of the product - Currency string - // Total price for the product, in the smallest units of the currency - TotalAmount int64 - // Invoice payload; only for bots - InvoicePayload []byte - // Telegram payment identifier - TelegramPaymentChargeID string - // Provider payment identifier - ProviderPaymentChargeID string -} - -// MessagePaymentRefundedTypeID is TL type id of MessagePaymentRefunded. -const MessagePaymentRefundedTypeID = 0x11bcb8f3 - -// construct implements constructor of MessageContentClass. -func (m MessagePaymentRefunded) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessagePaymentRefunded. -var ( - _ bin.Encoder = &MessagePaymentRefunded{} - _ bin.Decoder = &MessagePaymentRefunded{} - _ bin.BareEncoder = &MessagePaymentRefunded{} - _ bin.BareDecoder = &MessagePaymentRefunded{} - - _ MessageContentClass = &MessagePaymentRefunded{} -) - -func (m *MessagePaymentRefunded) Zero() bool { - if m == nil { - return true - } - if !(m.OwnerID == nil) { - return false - } - if !(m.Currency == "") { - return false - } - if !(m.TotalAmount == 0) { - return false - } - if !(m.InvoicePayload == nil) { - return false - } - if !(m.TelegramPaymentChargeID == "") { - return false - } - if !(m.ProviderPaymentChargeID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePaymentRefunded) String() string { - if m == nil { - return "MessagePaymentRefunded(nil)" - } - type Alias MessagePaymentRefunded - return fmt.Sprintf("MessagePaymentRefunded%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePaymentRefunded) TypeID() uint32 { - return MessagePaymentRefundedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePaymentRefunded) TypeName() string { - return "messagePaymentRefunded" -} - -// TypeInfo returns info about TL type. -func (m *MessagePaymentRefunded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePaymentRefunded", - ID: MessagePaymentRefundedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OwnerID", - SchemaName: "owner_id", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "TotalAmount", - SchemaName: "total_amount", - }, - { - Name: "InvoicePayload", - SchemaName: "invoice_payload", - }, - { - Name: "TelegramPaymentChargeID", - SchemaName: "telegram_payment_charge_id", - }, - { - Name: "ProviderPaymentChargeID", - SchemaName: "provider_payment_charge_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePaymentRefunded) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePaymentRefunded#11bcb8f3 as nil") - } - b.PutID(MessagePaymentRefundedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePaymentRefunded) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePaymentRefunded#11bcb8f3 as nil") - } - if m.OwnerID == nil { - return fmt.Errorf("unable to encode messagePaymentRefunded#11bcb8f3: field owner_id is nil") - } - if err := m.OwnerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePaymentRefunded#11bcb8f3: field owner_id: %w", err) - } - b.PutString(m.Currency) - b.PutInt53(m.TotalAmount) - b.PutBytes(m.InvoicePayload) - b.PutString(m.TelegramPaymentChargeID) - b.PutString(m.ProviderPaymentChargeID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePaymentRefunded) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePaymentRefunded#11bcb8f3 to nil") - } - if err := b.ConsumeID(MessagePaymentRefundedTypeID); err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePaymentRefunded) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePaymentRefunded#11bcb8f3 to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field owner_id: %w", err) - } - m.OwnerID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field currency: %w", err) - } - m.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field total_amount: %w", err) - } - m.TotalAmount = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field invoice_payload: %w", err) - } - m.InvoicePayload = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field telegram_payment_charge_id: %w", err) - } - m.TelegramPaymentChargeID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field provider_payment_charge_id: %w", err) - } - m.ProviderPaymentChargeID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePaymentRefunded) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePaymentRefunded#11bcb8f3 as nil") - } - b.ObjStart() - b.PutID("messagePaymentRefunded") - b.Comma() - b.FieldStart("owner_id") - if m.OwnerID == nil { - return fmt.Errorf("unable to encode messagePaymentRefunded#11bcb8f3: field owner_id is nil") - } - if err := m.OwnerID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePaymentRefunded#11bcb8f3: field owner_id: %w", err) - } - b.Comma() - b.FieldStart("currency") - b.PutString(m.Currency) - b.Comma() - b.FieldStart("total_amount") - b.PutInt53(m.TotalAmount) - b.Comma() - b.FieldStart("invoice_payload") - b.PutBytes(m.InvoicePayload) - b.Comma() - b.FieldStart("telegram_payment_charge_id") - b.PutString(m.TelegramPaymentChargeID) - b.Comma() - b.FieldStart("provider_payment_charge_id") - b.PutString(m.ProviderPaymentChargeID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePaymentRefunded) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePaymentRefunded#11bcb8f3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePaymentRefunded"); err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: %w", err) - } - case "owner_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field owner_id: %w", err) - } - m.OwnerID = value - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field currency: %w", err) - } - m.Currency = value - case "total_amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field total_amount: %w", err) - } - m.TotalAmount = value - case "invoice_payload": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field invoice_payload: %w", err) - } - m.InvoicePayload = value - case "telegram_payment_charge_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field telegram_payment_charge_id: %w", err) - } - m.TelegramPaymentChargeID = value - case "provider_payment_charge_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePaymentRefunded#11bcb8f3: field provider_payment_charge_id: %w", err) - } - m.ProviderPaymentChargeID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOwnerID returns value of OwnerID field. -func (m *MessagePaymentRefunded) GetOwnerID() (value MessageSenderClass) { - if m == nil { - return - } - return m.OwnerID -} - -// GetCurrency returns value of Currency field. -func (m *MessagePaymentRefunded) GetCurrency() (value string) { - if m == nil { - return - } - return m.Currency -} - -// GetTotalAmount returns value of TotalAmount field. -func (m *MessagePaymentRefunded) GetTotalAmount() (value int64) { - if m == nil { - return - } - return m.TotalAmount -} - -// GetInvoicePayload returns value of InvoicePayload field. -func (m *MessagePaymentRefunded) GetInvoicePayload() (value []byte) { - if m == nil { - return - } - return m.InvoicePayload -} - -// GetTelegramPaymentChargeID returns value of TelegramPaymentChargeID field. -func (m *MessagePaymentRefunded) GetTelegramPaymentChargeID() (value string) { - if m == nil { - return - } - return m.TelegramPaymentChargeID -} - -// GetProviderPaymentChargeID returns value of ProviderPaymentChargeID field. -func (m *MessagePaymentRefunded) GetProviderPaymentChargeID() (value string) { - if m == nil { - return - } - return m.ProviderPaymentChargeID -} - -// MessageGiftedPremium represents TL type `messageGiftedPremium#e4d0e07a`. -type MessageGiftedPremium struct { - // The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous or - // is outgoing - GifterUserID int64 - // The identifier of a user that received Telegram Premium; 0 if the gift is incoming - ReceiverUserID int64 - // Message added to the gifted Telegram Premium by the sender - Text FormattedText - // Currency for the paid amount - Currency string - // The paid amount, in the smallest units of the currency - Amount int64 - // Cryptocurrency used to pay for the gift; may be empty if none - Cryptocurrency string - // The paid amount, in the smallest units of the cryptocurrency; 0 if none - CryptocurrencyAmount int64 - // Number of months the Telegram Premium subscription will be active - MonthCount int32 - // A sticker to be shown in the message; may be null if unknown - Sticker Sticker -} - -// MessageGiftedPremiumTypeID is TL type id of MessageGiftedPremium. -const MessageGiftedPremiumTypeID = 0xe4d0e07a - -// construct implements constructor of MessageContentClass. -func (m MessageGiftedPremium) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageGiftedPremium. -var ( - _ bin.Encoder = &MessageGiftedPremium{} - _ bin.Decoder = &MessageGiftedPremium{} - _ bin.BareEncoder = &MessageGiftedPremium{} - _ bin.BareDecoder = &MessageGiftedPremium{} - - _ MessageContentClass = &MessageGiftedPremium{} -) - -func (m *MessageGiftedPremium) Zero() bool { - if m == nil { - return true - } - if !(m.GifterUserID == 0) { - return false - } - if !(m.ReceiverUserID == 0) { - return false - } - if !(m.Text.Zero()) { - return false - } - if !(m.Currency == "") { - return false - } - if !(m.Amount == 0) { - return false - } - if !(m.Cryptocurrency == "") { - return false - } - if !(m.CryptocurrencyAmount == 0) { - return false - } - if !(m.MonthCount == 0) { - return false - } - if !(m.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageGiftedPremium) String() string { - if m == nil { - return "MessageGiftedPremium(nil)" - } - type Alias MessageGiftedPremium - return fmt.Sprintf("MessageGiftedPremium%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageGiftedPremium) TypeID() uint32 { - return MessageGiftedPremiumTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageGiftedPremium) TypeName() string { - return "messageGiftedPremium" -} - -// TypeInfo returns info about TL type. -func (m *MessageGiftedPremium) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageGiftedPremium", - ID: MessageGiftedPremiumTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GifterUserID", - SchemaName: "gifter_user_id", - }, - { - Name: "ReceiverUserID", - SchemaName: "receiver_user_id", - }, - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "Cryptocurrency", - SchemaName: "cryptocurrency", - }, - { - Name: "CryptocurrencyAmount", - SchemaName: "cryptocurrency_amount", - }, - { - Name: "MonthCount", - SchemaName: "month_count", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageGiftedPremium) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiftedPremium#e4d0e07a as nil") - } - b.PutID(MessageGiftedPremiumTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageGiftedPremium) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiftedPremium#e4d0e07a as nil") - } - b.PutInt53(m.GifterUserID) - b.PutInt53(m.ReceiverUserID) - if err := m.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGiftedPremium#e4d0e07a: field text: %w", err) - } - b.PutString(m.Currency) - b.PutInt53(m.Amount) - b.PutString(m.Cryptocurrency) - b.PutLong(m.CryptocurrencyAmount) - b.PutInt32(m.MonthCount) - if err := m.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGiftedPremium#e4d0e07a: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageGiftedPremium) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiftedPremium#e4d0e07a to nil") - } - if err := b.ConsumeID(MessageGiftedPremiumTypeID); err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageGiftedPremium) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiftedPremium#e4d0e07a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field gifter_user_id: %w", err) - } - m.GifterUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field receiver_user_id: %w", err) - } - m.ReceiverUserID = value - } - { - if err := m.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field text: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field currency: %w", err) - } - m.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field amount: %w", err) - } - m.Amount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field cryptocurrency: %w", err) - } - m.Cryptocurrency = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field cryptocurrency_amount: %w", err) - } - m.CryptocurrencyAmount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field month_count: %w", err) - } - m.MonthCount = value - } - { - if err := m.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageGiftedPremium) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageGiftedPremium#e4d0e07a as nil") - } - b.ObjStart() - b.PutID("messageGiftedPremium") - b.Comma() - b.FieldStart("gifter_user_id") - b.PutInt53(m.GifterUserID) - b.Comma() - b.FieldStart("receiver_user_id") - b.PutInt53(m.ReceiverUserID) - b.Comma() - b.FieldStart("text") - if err := m.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGiftedPremium#e4d0e07a: field text: %w", err) - } - b.Comma() - b.FieldStart("currency") - b.PutString(m.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(m.Amount) - b.Comma() - b.FieldStart("cryptocurrency") - b.PutString(m.Cryptocurrency) - b.Comma() - b.FieldStart("cryptocurrency_amount") - b.PutLong(m.CryptocurrencyAmount) - b.Comma() - b.FieldStart("month_count") - b.PutInt32(m.MonthCount) - b.Comma() - b.FieldStart("sticker") - if err := m.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGiftedPremium#e4d0e07a: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageGiftedPremium) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageGiftedPremium#e4d0e07a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageGiftedPremium"); err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: %w", err) - } - case "gifter_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field gifter_user_id: %w", err) - } - m.GifterUserID = value - case "receiver_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field receiver_user_id: %w", err) - } - m.ReceiverUserID = value - case "text": - if err := m.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field text: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field currency: %w", err) - } - m.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field amount: %w", err) - } - m.Amount = value - case "cryptocurrency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field cryptocurrency: %w", err) - } - m.Cryptocurrency = value - case "cryptocurrency_amount": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field cryptocurrency_amount: %w", err) - } - m.CryptocurrencyAmount = value - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field month_count: %w", err) - } - m.MonthCount = value - case "sticker": - if err := m.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGiftedPremium#e4d0e07a: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGifterUserID returns value of GifterUserID field. -func (m *MessageGiftedPremium) GetGifterUserID() (value int64) { - if m == nil { - return - } - return m.GifterUserID -} - -// GetReceiverUserID returns value of ReceiverUserID field. -func (m *MessageGiftedPremium) GetReceiverUserID() (value int64) { - if m == nil { - return - } - return m.ReceiverUserID -} - -// GetText returns value of Text field. -func (m *MessageGiftedPremium) GetText() (value FormattedText) { - if m == nil { - return - } - return m.Text -} - -// GetCurrency returns value of Currency field. -func (m *MessageGiftedPremium) GetCurrency() (value string) { - if m == nil { - return - } - return m.Currency -} - -// GetAmount returns value of Amount field. -func (m *MessageGiftedPremium) GetAmount() (value int64) { - if m == nil { - return - } - return m.Amount -} - -// GetCryptocurrency returns value of Cryptocurrency field. -func (m *MessageGiftedPremium) GetCryptocurrency() (value string) { - if m == nil { - return - } - return m.Cryptocurrency -} - -// GetCryptocurrencyAmount returns value of CryptocurrencyAmount field. -func (m *MessageGiftedPremium) GetCryptocurrencyAmount() (value int64) { - if m == nil { - return - } - return m.CryptocurrencyAmount -} - -// GetMonthCount returns value of MonthCount field. -func (m *MessageGiftedPremium) GetMonthCount() (value int32) { - if m == nil { - return - } - return m.MonthCount -} - -// GetSticker returns value of Sticker field. -func (m *MessageGiftedPremium) GetSticker() (value Sticker) { - if m == nil { - return - } - return m.Sticker -} - -// MessagePremiumGiftCode represents TL type `messagePremiumGiftCode#29d22e4e`. -type MessagePremiumGiftCode struct { - // Identifier of a chat or a user that created the gift code; may be null if unknown - CreatorID MessageSenderClass - // Message added to the gift - Text FormattedText - // True, if the gift code was created for a giveaway - IsFromGiveaway bool - // True, if the winner for the corresponding Telegram Premium subscription wasn't chosen - IsUnclaimed bool - // Currency for the paid amount; empty if unknown - Currency string - // The paid amount, in the smallest units of the currency; 0 if unknown - Amount int64 - // Cryptocurrency used to pay for the gift; may be empty if none or unknown - Cryptocurrency string - // The paid amount, in the smallest units of the cryptocurrency; 0 if unknown - CryptocurrencyAmount int64 - // Number of months the Telegram Premium subscription will be active after code - // activation - MonthCount int32 - // A sticker to be shown in the message; may be null if unknown - Sticker Sticker - // The gift code - Code string -} - -// MessagePremiumGiftCodeTypeID is TL type id of MessagePremiumGiftCode. -const MessagePremiumGiftCodeTypeID = 0x29d22e4e - -// construct implements constructor of MessageContentClass. -func (m MessagePremiumGiftCode) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessagePremiumGiftCode. -var ( - _ bin.Encoder = &MessagePremiumGiftCode{} - _ bin.Decoder = &MessagePremiumGiftCode{} - _ bin.BareEncoder = &MessagePremiumGiftCode{} - _ bin.BareDecoder = &MessagePremiumGiftCode{} - - _ MessageContentClass = &MessagePremiumGiftCode{} -) - -func (m *MessagePremiumGiftCode) Zero() bool { - if m == nil { - return true - } - if !(m.CreatorID == nil) { - return false - } - if !(m.Text.Zero()) { - return false - } - if !(m.IsFromGiveaway == false) { - return false - } - if !(m.IsUnclaimed == false) { - return false - } - if !(m.Currency == "") { - return false - } - if !(m.Amount == 0) { - return false - } - if !(m.Cryptocurrency == "") { - return false - } - if !(m.CryptocurrencyAmount == 0) { - return false - } - if !(m.MonthCount == 0) { - return false - } - if !(m.Sticker.Zero()) { - return false - } - if !(m.Code == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePremiumGiftCode) String() string { - if m == nil { - return "MessagePremiumGiftCode(nil)" - } - type Alias MessagePremiumGiftCode - return fmt.Sprintf("MessagePremiumGiftCode%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePremiumGiftCode) TypeID() uint32 { - return MessagePremiumGiftCodeTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePremiumGiftCode) TypeName() string { - return "messagePremiumGiftCode" -} - -// TypeInfo returns info about TL type. -func (m *MessagePremiumGiftCode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePremiumGiftCode", - ID: MessagePremiumGiftCodeTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CreatorID", - SchemaName: "creator_id", - }, - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "IsFromGiveaway", - SchemaName: "is_from_giveaway", - }, - { - Name: "IsUnclaimed", - SchemaName: "is_unclaimed", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "Cryptocurrency", - SchemaName: "cryptocurrency", - }, - { - Name: "CryptocurrencyAmount", - SchemaName: "cryptocurrency_amount", - }, - { - Name: "MonthCount", - SchemaName: "month_count", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "Code", - SchemaName: "code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePremiumGiftCode) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePremiumGiftCode#29d22e4e as nil") - } - b.PutID(MessagePremiumGiftCodeTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePremiumGiftCode) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePremiumGiftCode#29d22e4e as nil") - } - if m.CreatorID == nil { - return fmt.Errorf("unable to encode messagePremiumGiftCode#29d22e4e: field creator_id is nil") - } - if err := m.CreatorID.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePremiumGiftCode#29d22e4e: field creator_id: %w", err) - } - if err := m.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePremiumGiftCode#29d22e4e: field text: %w", err) - } - b.PutBool(m.IsFromGiveaway) - b.PutBool(m.IsUnclaimed) - b.PutString(m.Currency) - b.PutInt53(m.Amount) - b.PutString(m.Cryptocurrency) - b.PutLong(m.CryptocurrencyAmount) - b.PutInt32(m.MonthCount) - if err := m.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePremiumGiftCode#29d22e4e: field sticker: %w", err) - } - b.PutString(m.Code) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePremiumGiftCode) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePremiumGiftCode#29d22e4e to nil") - } - if err := b.ConsumeID(MessagePremiumGiftCodeTypeID); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePremiumGiftCode) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePremiumGiftCode#29d22e4e to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field creator_id: %w", err) - } - m.CreatorID = value - } - { - if err := m.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field text: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field is_from_giveaway: %w", err) - } - m.IsFromGiveaway = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field is_unclaimed: %w", err) - } - m.IsUnclaimed = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field currency: %w", err) - } - m.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field amount: %w", err) - } - m.Amount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field cryptocurrency: %w", err) - } - m.Cryptocurrency = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field cryptocurrency_amount: %w", err) - } - m.CryptocurrencyAmount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field month_count: %w", err) - } - m.MonthCount = value - } - { - if err := m.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field sticker: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field code: %w", err) - } - m.Code = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePremiumGiftCode) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePremiumGiftCode#29d22e4e as nil") - } - b.ObjStart() - b.PutID("messagePremiumGiftCode") - b.Comma() - b.FieldStart("creator_id") - if m.CreatorID == nil { - return fmt.Errorf("unable to encode messagePremiumGiftCode#29d22e4e: field creator_id is nil") - } - if err := m.CreatorID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePremiumGiftCode#29d22e4e: field creator_id: %w", err) - } - b.Comma() - b.FieldStart("text") - if err := m.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePremiumGiftCode#29d22e4e: field text: %w", err) - } - b.Comma() - b.FieldStart("is_from_giveaway") - b.PutBool(m.IsFromGiveaway) - b.Comma() - b.FieldStart("is_unclaimed") - b.PutBool(m.IsUnclaimed) - b.Comma() - b.FieldStart("currency") - b.PutString(m.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(m.Amount) - b.Comma() - b.FieldStart("cryptocurrency") - b.PutString(m.Cryptocurrency) - b.Comma() - b.FieldStart("cryptocurrency_amount") - b.PutLong(m.CryptocurrencyAmount) - b.Comma() - b.FieldStart("month_count") - b.PutInt32(m.MonthCount) - b.Comma() - b.FieldStart("sticker") - if err := m.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePremiumGiftCode#29d22e4e: field sticker: %w", err) - } - b.Comma() - b.FieldStart("code") - b.PutString(m.Code) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePremiumGiftCode) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePremiumGiftCode#29d22e4e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePremiumGiftCode"); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: %w", err) - } - case "creator_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field creator_id: %w", err) - } - m.CreatorID = value - case "text": - if err := m.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field text: %w", err) - } - case "is_from_giveaway": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field is_from_giveaway: %w", err) - } - m.IsFromGiveaway = value - case "is_unclaimed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field is_unclaimed: %w", err) - } - m.IsUnclaimed = value - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field currency: %w", err) - } - m.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field amount: %w", err) - } - m.Amount = value - case "cryptocurrency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field cryptocurrency: %w", err) - } - m.Cryptocurrency = value - case "cryptocurrency_amount": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field cryptocurrency_amount: %w", err) - } - m.CryptocurrencyAmount = value - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field month_count: %w", err) - } - m.MonthCount = value - case "sticker": - if err := m.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field sticker: %w", err) - } - case "code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messagePremiumGiftCode#29d22e4e: field code: %w", err) - } - m.Code = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCreatorID returns value of CreatorID field. -func (m *MessagePremiumGiftCode) GetCreatorID() (value MessageSenderClass) { - if m == nil { - return - } - return m.CreatorID -} - -// GetText returns value of Text field. -func (m *MessagePremiumGiftCode) GetText() (value FormattedText) { - if m == nil { - return - } - return m.Text -} - -// GetIsFromGiveaway returns value of IsFromGiveaway field. -func (m *MessagePremiumGiftCode) GetIsFromGiveaway() (value bool) { - if m == nil { - return - } - return m.IsFromGiveaway -} - -// GetIsUnclaimed returns value of IsUnclaimed field. -func (m *MessagePremiumGiftCode) GetIsUnclaimed() (value bool) { - if m == nil { - return - } - return m.IsUnclaimed -} - -// GetCurrency returns value of Currency field. -func (m *MessagePremiumGiftCode) GetCurrency() (value string) { - if m == nil { - return - } - return m.Currency -} - -// GetAmount returns value of Amount field. -func (m *MessagePremiumGiftCode) GetAmount() (value int64) { - if m == nil { - return - } - return m.Amount -} - -// GetCryptocurrency returns value of Cryptocurrency field. -func (m *MessagePremiumGiftCode) GetCryptocurrency() (value string) { - if m == nil { - return - } - return m.Cryptocurrency -} - -// GetCryptocurrencyAmount returns value of CryptocurrencyAmount field. -func (m *MessagePremiumGiftCode) GetCryptocurrencyAmount() (value int64) { - if m == nil { - return - } - return m.CryptocurrencyAmount -} - -// GetMonthCount returns value of MonthCount field. -func (m *MessagePremiumGiftCode) GetMonthCount() (value int32) { - if m == nil { - return - } - return m.MonthCount -} - -// GetSticker returns value of Sticker field. -func (m *MessagePremiumGiftCode) GetSticker() (value Sticker) { - if m == nil { - return - } - return m.Sticker -} - -// GetCode returns value of Code field. -func (m *MessagePremiumGiftCode) GetCode() (value string) { - if m == nil { - return - } - return m.Code -} - -// MessageGiveawayCreated represents TL type `messageGiveawayCreated#39f3639f`. -type MessageGiveawayCreated struct { - // Number of Telegram Stars that will be shared by winners of the giveaway; 0 for - // Telegram Premium giveaways - StarCount int64 -} - -// MessageGiveawayCreatedTypeID is TL type id of MessageGiveawayCreated. -const MessageGiveawayCreatedTypeID = 0x39f3639f - -// construct implements constructor of MessageContentClass. -func (m MessageGiveawayCreated) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageGiveawayCreated. -var ( - _ bin.Encoder = &MessageGiveawayCreated{} - _ bin.Decoder = &MessageGiveawayCreated{} - _ bin.BareEncoder = &MessageGiveawayCreated{} - _ bin.BareDecoder = &MessageGiveawayCreated{} - - _ MessageContentClass = &MessageGiveawayCreated{} -) - -func (m *MessageGiveawayCreated) Zero() bool { - if m == nil { - return true - } - if !(m.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageGiveawayCreated) String() string { - if m == nil { - return "MessageGiveawayCreated(nil)" - } - type Alias MessageGiveawayCreated - return fmt.Sprintf("MessageGiveawayCreated%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageGiveawayCreated) TypeID() uint32 { - return MessageGiveawayCreatedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageGiveawayCreated) TypeName() string { - return "messageGiveawayCreated" -} - -// TypeInfo returns info about TL type. -func (m *MessageGiveawayCreated) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageGiveawayCreated", - ID: MessageGiveawayCreatedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageGiveawayCreated) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayCreated#39f3639f as nil") - } - b.PutID(MessageGiveawayCreatedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageGiveawayCreated) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayCreated#39f3639f as nil") - } - b.PutInt53(m.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageGiveawayCreated) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayCreated#39f3639f to nil") - } - if err := b.ConsumeID(MessageGiveawayCreatedTypeID); err != nil { - return fmt.Errorf("unable to decode messageGiveawayCreated#39f3639f: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageGiveawayCreated) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayCreated#39f3639f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayCreated#39f3639f: field star_count: %w", err) - } - m.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageGiveawayCreated) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayCreated#39f3639f as nil") - } - b.ObjStart() - b.PutID("messageGiveawayCreated") - b.Comma() - b.FieldStart("star_count") - b.PutInt53(m.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageGiveawayCreated) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayCreated#39f3639f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageGiveawayCreated"); err != nil { - return fmt.Errorf("unable to decode messageGiveawayCreated#39f3639f: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayCreated#39f3639f: field star_count: %w", err) - } - m.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarCount returns value of StarCount field. -func (m *MessageGiveawayCreated) GetStarCount() (value int64) { - if m == nil { - return - } - return m.StarCount -} - -// MessageGiveaway represents TL type `messageGiveaway#eb61daa8`. -type MessageGiveaway struct { - // Giveaway parameters - Parameters GiveawayParameters - // Number of users which will receive Telegram Premium subscription gift codes - WinnerCount int32 - // Prize of the giveaway - Prize GiveawayPrizeClass - // A sticker to be shown in the message; may be null if unknown - Sticker Sticker -} - -// MessageGiveawayTypeID is TL type id of MessageGiveaway. -const MessageGiveawayTypeID = 0xeb61daa8 - -// construct implements constructor of MessageContentClass. -func (m MessageGiveaway) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageGiveaway. -var ( - _ bin.Encoder = &MessageGiveaway{} - _ bin.Decoder = &MessageGiveaway{} - _ bin.BareEncoder = &MessageGiveaway{} - _ bin.BareDecoder = &MessageGiveaway{} - - _ MessageContentClass = &MessageGiveaway{} -) - -func (m *MessageGiveaway) Zero() bool { - if m == nil { - return true - } - if !(m.Parameters.Zero()) { - return false - } - if !(m.WinnerCount == 0) { - return false - } - if !(m.Prize == nil) { - return false - } - if !(m.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageGiveaway) String() string { - if m == nil { - return "MessageGiveaway(nil)" - } - type Alias MessageGiveaway - return fmt.Sprintf("MessageGiveaway%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageGiveaway) TypeID() uint32 { - return MessageGiveawayTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageGiveaway) TypeName() string { - return "messageGiveaway" -} - -// TypeInfo returns info about TL type. -func (m *MessageGiveaway) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageGiveaway", - ID: MessageGiveawayTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Parameters", - SchemaName: "parameters", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "Prize", - SchemaName: "prize", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageGiveaway) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveaway#eb61daa8 as nil") - } - b.PutID(MessageGiveawayTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageGiveaway) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveaway#eb61daa8 as nil") - } - if err := m.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field parameters: %w", err) - } - b.PutInt32(m.WinnerCount) - if m.Prize == nil { - return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field prize is nil") - } - if err := m.Prize.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field prize: %w", err) - } - if err := m.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageGiveaway) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveaway#eb61daa8 to nil") - } - if err := b.ConsumeID(MessageGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageGiveaway) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveaway#eb61daa8 to nil") - } - { - if err := m.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field parameters: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field winner_count: %w", err) - } - m.WinnerCount = value - } - { - value, err := DecodeGiveawayPrize(b) - if err != nil { - return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field prize: %w", err) - } - m.Prize = value - } - { - if err := m.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveaway#eb61daa8 as nil") - } - b.ObjStart() - b.PutID("messageGiveaway") - b.Comma() - b.FieldStart("parameters") - if err := m.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field parameters: %w", err) - } - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(m.WinnerCount) - b.Comma() - b.FieldStart("prize") - if m.Prize == nil { - return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field prize is nil") - } - if err := m.Prize.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field prize: %w", err) - } - b.Comma() - b.FieldStart("sticker") - if err := m.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGiveaway#eb61daa8: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveaway#eb61daa8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageGiveaway"); err != nil { - return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: %w", err) - } - case "parameters": - if err := m.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field parameters: %w", err) - } - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field winner_count: %w", err) - } - m.WinnerCount = value - case "prize": - value, err := DecodeTDLibJSONGiveawayPrize(b) - if err != nil { - return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field prize: %w", err) - } - m.Prize = value - case "sticker": - if err := m.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGiveaway#eb61daa8: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetParameters returns value of Parameters field. -func (m *MessageGiveaway) GetParameters() (value GiveawayParameters) { - if m == nil { - return - } - return m.Parameters -} - -// GetWinnerCount returns value of WinnerCount field. -func (m *MessageGiveaway) GetWinnerCount() (value int32) { - if m == nil { - return - } - return m.WinnerCount -} - -// GetPrize returns value of Prize field. -func (m *MessageGiveaway) GetPrize() (value GiveawayPrizeClass) { - if m == nil { - return - } - return m.Prize -} - -// GetSticker returns value of Sticker field. -func (m *MessageGiveaway) GetSticker() (value Sticker) { - if m == nil { - return - } - return m.Sticker -} - -// MessageGiveawayCompleted represents TL type `messageGiveawayCompleted#e424c8f7`. -type MessageGiveawayCompleted struct { - // Identifier of the message with the giveaway; can be 0 if the message was deleted - GiveawayMessageID int64 - // Number of winners in the giveaway - WinnerCount int32 - // True, if the giveaway is a Telegram Star giveaway - IsStarGiveaway bool - // Number of undistributed prizes; for Telegram Premium giveaways only - UnclaimedPrizeCount int32 -} - -// MessageGiveawayCompletedTypeID is TL type id of MessageGiveawayCompleted. -const MessageGiveawayCompletedTypeID = 0xe424c8f7 - -// construct implements constructor of MessageContentClass. -func (m MessageGiveawayCompleted) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageGiveawayCompleted. -var ( - _ bin.Encoder = &MessageGiveawayCompleted{} - _ bin.Decoder = &MessageGiveawayCompleted{} - _ bin.BareEncoder = &MessageGiveawayCompleted{} - _ bin.BareDecoder = &MessageGiveawayCompleted{} - - _ MessageContentClass = &MessageGiveawayCompleted{} -) - -func (m *MessageGiveawayCompleted) Zero() bool { - if m == nil { - return true - } - if !(m.GiveawayMessageID == 0) { - return false - } - if !(m.WinnerCount == 0) { - return false - } - if !(m.IsStarGiveaway == false) { - return false - } - if !(m.UnclaimedPrizeCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageGiveawayCompleted) String() string { - if m == nil { - return "MessageGiveawayCompleted(nil)" - } - type Alias MessageGiveawayCompleted - return fmt.Sprintf("MessageGiveawayCompleted%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageGiveawayCompleted) TypeID() uint32 { - return MessageGiveawayCompletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageGiveawayCompleted) TypeName() string { - return "messageGiveawayCompleted" -} - -// TypeInfo returns info about TL type. -func (m *MessageGiveawayCompleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageGiveawayCompleted", - ID: MessageGiveawayCompletedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GiveawayMessageID", - SchemaName: "giveaway_message_id", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "IsStarGiveaway", - SchemaName: "is_star_giveaway", - }, - { - Name: "UnclaimedPrizeCount", - SchemaName: "unclaimed_prize_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageGiveawayCompleted) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayCompleted#e424c8f7 as nil") - } - b.PutID(MessageGiveawayCompletedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageGiveawayCompleted) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayCompleted#e424c8f7 as nil") - } - b.PutInt53(m.GiveawayMessageID) - b.PutInt32(m.WinnerCount) - b.PutBool(m.IsStarGiveaway) - b.PutInt32(m.UnclaimedPrizeCount) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageGiveawayCompleted) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayCompleted#e424c8f7 to nil") - } - if err := b.ConsumeID(MessageGiveawayCompletedTypeID); err != nil { - return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageGiveawayCompleted) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayCompleted#e424c8f7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field giveaway_message_id: %w", err) - } - m.GiveawayMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field winner_count: %w", err) - } - m.WinnerCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field is_star_giveaway: %w", err) - } - m.IsStarGiveaway = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field unclaimed_prize_count: %w", err) - } - m.UnclaimedPrizeCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageGiveawayCompleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayCompleted#e424c8f7 as nil") - } - b.ObjStart() - b.PutID("messageGiveawayCompleted") - b.Comma() - b.FieldStart("giveaway_message_id") - b.PutInt53(m.GiveawayMessageID) - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(m.WinnerCount) - b.Comma() - b.FieldStart("is_star_giveaway") - b.PutBool(m.IsStarGiveaway) - b.Comma() - b.FieldStart("unclaimed_prize_count") - b.PutInt32(m.UnclaimedPrizeCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageGiveawayCompleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayCompleted#e424c8f7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageGiveawayCompleted"); err != nil { - return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: %w", err) - } - case "giveaway_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field giveaway_message_id: %w", err) - } - m.GiveawayMessageID = value - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field winner_count: %w", err) - } - m.WinnerCount = value - case "is_star_giveaway": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field is_star_giveaway: %w", err) - } - m.IsStarGiveaway = value - case "unclaimed_prize_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayCompleted#e424c8f7: field unclaimed_prize_count: %w", err) - } - m.UnclaimedPrizeCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGiveawayMessageID returns value of GiveawayMessageID field. -func (m *MessageGiveawayCompleted) GetGiveawayMessageID() (value int64) { - if m == nil { - return - } - return m.GiveawayMessageID -} - -// GetWinnerCount returns value of WinnerCount field. -func (m *MessageGiveawayCompleted) GetWinnerCount() (value int32) { - if m == nil { - return - } - return m.WinnerCount -} - -// GetIsStarGiveaway returns value of IsStarGiveaway field. -func (m *MessageGiveawayCompleted) GetIsStarGiveaway() (value bool) { - if m == nil { - return - } - return m.IsStarGiveaway -} - -// GetUnclaimedPrizeCount returns value of UnclaimedPrizeCount field. -func (m *MessageGiveawayCompleted) GetUnclaimedPrizeCount() (value int32) { - if m == nil { - return - } - return m.UnclaimedPrizeCount -} - -// MessageGiveawayWinners represents TL type `messageGiveawayWinners#1d99a27a`. -type MessageGiveawayWinners struct { - // Identifier of the supergroup or channel chat, which was automatically boosted by the - // winners of the giveaway - BoostedChatID int64 - // Identifier of the message with the giveaway in the boosted chat - GiveawayMessageID int64 - // Number of other chats that participated in the giveaway - AdditionalChatCount int32 - // Point in time (Unix timestamp) when the winners were selected. May be bigger than - // winners selection date specified in parameters of the giveaway - ActualWinnersSelectionDate int32 - // True, if only new members of the chats were eligible for the giveaway - OnlyNewMembers bool - // True, if the giveaway was canceled and was fully refunded - WasRefunded bool - // Prize of the giveaway - Prize GiveawayPrizeClass - // Additional description of the giveaway prize - PrizeDescription string - // Total number of winners in the giveaway - WinnerCount int32 - // Up to 100 user identifiers of the winners of the giveaway - WinnerUserIDs []int64 - // Number of undistributed prizes; for Telegram Premium giveaways only - UnclaimedPrizeCount int32 -} - -// MessageGiveawayWinnersTypeID is TL type id of MessageGiveawayWinners. -const MessageGiveawayWinnersTypeID = 0x1d99a27a - -// construct implements constructor of MessageContentClass. -func (m MessageGiveawayWinners) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageGiveawayWinners. -var ( - _ bin.Encoder = &MessageGiveawayWinners{} - _ bin.Decoder = &MessageGiveawayWinners{} - _ bin.BareEncoder = &MessageGiveawayWinners{} - _ bin.BareDecoder = &MessageGiveawayWinners{} - - _ MessageContentClass = &MessageGiveawayWinners{} -) - -func (m *MessageGiveawayWinners) Zero() bool { - if m == nil { - return true - } - if !(m.BoostedChatID == 0) { - return false - } - if !(m.GiveawayMessageID == 0) { - return false - } - if !(m.AdditionalChatCount == 0) { - return false - } - if !(m.ActualWinnersSelectionDate == 0) { - return false - } - if !(m.OnlyNewMembers == false) { - return false - } - if !(m.WasRefunded == false) { - return false - } - if !(m.Prize == nil) { - return false - } - if !(m.PrizeDescription == "") { - return false - } - if !(m.WinnerCount == 0) { - return false - } - if !(m.WinnerUserIDs == nil) { - return false - } - if !(m.UnclaimedPrizeCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageGiveawayWinners) String() string { - if m == nil { - return "MessageGiveawayWinners(nil)" - } - type Alias MessageGiveawayWinners - return fmt.Sprintf("MessageGiveawayWinners%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageGiveawayWinners) TypeID() uint32 { - return MessageGiveawayWinnersTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageGiveawayWinners) TypeName() string { - return "messageGiveawayWinners" -} - -// TypeInfo returns info about TL type. -func (m *MessageGiveawayWinners) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageGiveawayWinners", - ID: MessageGiveawayWinnersTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BoostedChatID", - SchemaName: "boosted_chat_id", - }, - { - Name: "GiveawayMessageID", - SchemaName: "giveaway_message_id", - }, - { - Name: "AdditionalChatCount", - SchemaName: "additional_chat_count", - }, - { - Name: "ActualWinnersSelectionDate", - SchemaName: "actual_winners_selection_date", - }, - { - Name: "OnlyNewMembers", - SchemaName: "only_new_members", - }, - { - Name: "WasRefunded", - SchemaName: "was_refunded", - }, - { - Name: "Prize", - SchemaName: "prize", - }, - { - Name: "PrizeDescription", - SchemaName: "prize_description", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "WinnerUserIDs", - SchemaName: "winner_user_ids", - }, - { - Name: "UnclaimedPrizeCount", - SchemaName: "unclaimed_prize_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageGiveawayWinners) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayWinners#1d99a27a as nil") - } - b.PutID(MessageGiveawayWinnersTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageGiveawayWinners) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayWinners#1d99a27a as nil") - } - b.PutInt53(m.BoostedChatID) - b.PutInt53(m.GiveawayMessageID) - b.PutInt32(m.AdditionalChatCount) - b.PutInt32(m.ActualWinnersSelectionDate) - b.PutBool(m.OnlyNewMembers) - b.PutBool(m.WasRefunded) - if m.Prize == nil { - return fmt.Errorf("unable to encode messageGiveawayWinners#1d99a27a: field prize is nil") - } - if err := m.Prize.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGiveawayWinners#1d99a27a: field prize: %w", err) - } - b.PutString(m.PrizeDescription) - b.PutInt32(m.WinnerCount) - b.PutInt(len(m.WinnerUserIDs)) - for _, v := range m.WinnerUserIDs { - b.PutInt53(v) - } - b.PutInt32(m.UnclaimedPrizeCount) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageGiveawayWinners) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayWinners#1d99a27a to nil") - } - if err := b.ConsumeID(MessageGiveawayWinnersTypeID); err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageGiveawayWinners) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayWinners#1d99a27a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field boosted_chat_id: %w", err) - } - m.BoostedChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field giveaway_message_id: %w", err) - } - m.GiveawayMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field additional_chat_count: %w", err) - } - m.AdditionalChatCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field actual_winners_selection_date: %w", err) - } - m.ActualWinnersSelectionDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field only_new_members: %w", err) - } - m.OnlyNewMembers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field was_refunded: %w", err) - } - m.WasRefunded = value - } - { - value, err := DecodeGiveawayPrize(b) - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field prize: %w", err) - } - m.Prize = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field prize_description: %w", err) - } - m.PrizeDescription = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_count: %w", err) - } - m.WinnerCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_user_ids: %w", err) - } - - if headerLen > 0 { - m.WinnerUserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_user_ids: %w", err) - } - m.WinnerUserIDs = append(m.WinnerUserIDs, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field unclaimed_prize_count: %w", err) - } - m.UnclaimedPrizeCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageGiveawayWinners) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayWinners#1d99a27a as nil") - } - b.ObjStart() - b.PutID("messageGiveawayWinners") - b.Comma() - b.FieldStart("boosted_chat_id") - b.PutInt53(m.BoostedChatID) - b.Comma() - b.FieldStart("giveaway_message_id") - b.PutInt53(m.GiveawayMessageID) - b.Comma() - b.FieldStart("additional_chat_count") - b.PutInt32(m.AdditionalChatCount) - b.Comma() - b.FieldStart("actual_winners_selection_date") - b.PutInt32(m.ActualWinnersSelectionDate) - b.Comma() - b.FieldStart("only_new_members") - b.PutBool(m.OnlyNewMembers) - b.Comma() - b.FieldStart("was_refunded") - b.PutBool(m.WasRefunded) - b.Comma() - b.FieldStart("prize") - if m.Prize == nil { - return fmt.Errorf("unable to encode messageGiveawayWinners#1d99a27a: field prize is nil") - } - if err := m.Prize.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGiveawayWinners#1d99a27a: field prize: %w", err) - } - b.Comma() - b.FieldStart("prize_description") - b.PutString(m.PrizeDescription) - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(m.WinnerCount) - b.Comma() - b.FieldStart("winner_user_ids") - b.ArrStart() - for _, v := range m.WinnerUserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("unclaimed_prize_count") - b.PutInt32(m.UnclaimedPrizeCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageGiveawayWinners) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayWinners#1d99a27a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageGiveawayWinners"); err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: %w", err) - } - case "boosted_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field boosted_chat_id: %w", err) - } - m.BoostedChatID = value - case "giveaway_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field giveaway_message_id: %w", err) - } - m.GiveawayMessageID = value - case "additional_chat_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field additional_chat_count: %w", err) - } - m.AdditionalChatCount = value - case "actual_winners_selection_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field actual_winners_selection_date: %w", err) - } - m.ActualWinnersSelectionDate = value - case "only_new_members": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field only_new_members: %w", err) - } - m.OnlyNewMembers = value - case "was_refunded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field was_refunded: %w", err) - } - m.WasRefunded = value - case "prize": - value, err := DecodeTDLibJSONGiveawayPrize(b) - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field prize: %w", err) - } - m.Prize = value - case "prize_description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field prize_description: %w", err) - } - m.PrizeDescription = value - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_count: %w", err) - } - m.WinnerCount = value - case "winner_user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_user_ids: %w", err) - } - m.WinnerUserIDs = append(m.WinnerUserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field winner_user_ids: %w", err) - } - case "unclaimed_prize_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayWinners#1d99a27a: field unclaimed_prize_count: %w", err) - } - m.UnclaimedPrizeCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBoostedChatID returns value of BoostedChatID field. -func (m *MessageGiveawayWinners) GetBoostedChatID() (value int64) { - if m == nil { - return - } - return m.BoostedChatID -} - -// GetGiveawayMessageID returns value of GiveawayMessageID field. -func (m *MessageGiveawayWinners) GetGiveawayMessageID() (value int64) { - if m == nil { - return - } - return m.GiveawayMessageID -} - -// GetAdditionalChatCount returns value of AdditionalChatCount field. -func (m *MessageGiveawayWinners) GetAdditionalChatCount() (value int32) { - if m == nil { - return - } - return m.AdditionalChatCount -} - -// GetActualWinnersSelectionDate returns value of ActualWinnersSelectionDate field. -func (m *MessageGiveawayWinners) GetActualWinnersSelectionDate() (value int32) { - if m == nil { - return - } - return m.ActualWinnersSelectionDate -} - -// GetOnlyNewMembers returns value of OnlyNewMembers field. -func (m *MessageGiveawayWinners) GetOnlyNewMembers() (value bool) { - if m == nil { - return - } - return m.OnlyNewMembers -} - -// GetWasRefunded returns value of WasRefunded field. -func (m *MessageGiveawayWinners) GetWasRefunded() (value bool) { - if m == nil { - return - } - return m.WasRefunded -} - -// GetPrize returns value of Prize field. -func (m *MessageGiveawayWinners) GetPrize() (value GiveawayPrizeClass) { - if m == nil { - return - } - return m.Prize -} - -// GetPrizeDescription returns value of PrizeDescription field. -func (m *MessageGiveawayWinners) GetPrizeDescription() (value string) { - if m == nil { - return - } - return m.PrizeDescription -} - -// GetWinnerCount returns value of WinnerCount field. -func (m *MessageGiveawayWinners) GetWinnerCount() (value int32) { - if m == nil { - return - } - return m.WinnerCount -} - -// GetWinnerUserIDs returns value of WinnerUserIDs field. -func (m *MessageGiveawayWinners) GetWinnerUserIDs() (value []int64) { - if m == nil { - return - } - return m.WinnerUserIDs -} - -// GetUnclaimedPrizeCount returns value of UnclaimedPrizeCount field. -func (m *MessageGiveawayWinners) GetUnclaimedPrizeCount() (value int32) { - if m == nil { - return - } - return m.UnclaimedPrizeCount -} - -// MessageGiftedStars represents TL type `messageGiftedStars#41bdbea7`. -type MessageGiftedStars struct { - // The identifier of a user that gifted Telegram Stars; 0 if the gift was anonymous or is - // outgoing - GifterUserID int64 - // The identifier of a user that received Telegram Stars; 0 if the gift is incoming - ReceiverUserID int64 - // Currency for the paid amount - Currency string - // The paid amount, in the smallest units of the currency - Amount int64 - // Cryptocurrency used to pay for the gift; may be empty if none - Cryptocurrency string - // The paid amount, in the smallest units of the cryptocurrency; 0 if none - CryptocurrencyAmount int64 - // Number of Telegram Stars that were gifted - StarCount int64 - // Identifier of the transaction for Telegram Stars purchase; for receiver only - TransactionID string - // A sticker to be shown in the message; may be null if unknown - Sticker Sticker -} - -// MessageGiftedStarsTypeID is TL type id of MessageGiftedStars. -const MessageGiftedStarsTypeID = 0x41bdbea7 - -// construct implements constructor of MessageContentClass. -func (m MessageGiftedStars) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageGiftedStars. -var ( - _ bin.Encoder = &MessageGiftedStars{} - _ bin.Decoder = &MessageGiftedStars{} - _ bin.BareEncoder = &MessageGiftedStars{} - _ bin.BareDecoder = &MessageGiftedStars{} - - _ MessageContentClass = &MessageGiftedStars{} -) - -func (m *MessageGiftedStars) Zero() bool { - if m == nil { - return true - } - if !(m.GifterUserID == 0) { - return false - } - if !(m.ReceiverUserID == 0) { - return false - } - if !(m.Currency == "") { - return false - } - if !(m.Amount == 0) { - return false - } - if !(m.Cryptocurrency == "") { - return false - } - if !(m.CryptocurrencyAmount == 0) { - return false - } - if !(m.StarCount == 0) { - return false - } - if !(m.TransactionID == "") { - return false - } - if !(m.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageGiftedStars) String() string { - if m == nil { - return "MessageGiftedStars(nil)" - } - type Alias MessageGiftedStars - return fmt.Sprintf("MessageGiftedStars%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageGiftedStars) TypeID() uint32 { - return MessageGiftedStarsTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageGiftedStars) TypeName() string { - return "messageGiftedStars" -} - -// TypeInfo returns info about TL type. -func (m *MessageGiftedStars) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageGiftedStars", - ID: MessageGiftedStarsTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GifterUserID", - SchemaName: "gifter_user_id", - }, - { - Name: "ReceiverUserID", - SchemaName: "receiver_user_id", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "Cryptocurrency", - SchemaName: "cryptocurrency", - }, - { - Name: "CryptocurrencyAmount", - SchemaName: "cryptocurrency_amount", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "TransactionID", - SchemaName: "transaction_id", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageGiftedStars) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiftedStars#41bdbea7 as nil") - } - b.PutID(MessageGiftedStarsTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageGiftedStars) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiftedStars#41bdbea7 as nil") - } - b.PutInt53(m.GifterUserID) - b.PutInt53(m.ReceiverUserID) - b.PutString(m.Currency) - b.PutInt53(m.Amount) - b.PutString(m.Cryptocurrency) - b.PutLong(m.CryptocurrencyAmount) - b.PutInt53(m.StarCount) - b.PutString(m.TransactionID) - if err := m.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGiftedStars#41bdbea7: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageGiftedStars) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiftedStars#41bdbea7 to nil") - } - if err := b.ConsumeID(MessageGiftedStarsTypeID); err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageGiftedStars) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiftedStars#41bdbea7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field gifter_user_id: %w", err) - } - m.GifterUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field receiver_user_id: %w", err) - } - m.ReceiverUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field currency: %w", err) - } - m.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field amount: %w", err) - } - m.Amount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field cryptocurrency: %w", err) - } - m.Cryptocurrency = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field cryptocurrency_amount: %w", err) - } - m.CryptocurrencyAmount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field star_count: %w", err) - } - m.StarCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field transaction_id: %w", err) - } - m.TransactionID = value - } - { - if err := m.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageGiftedStars) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageGiftedStars#41bdbea7 as nil") - } - b.ObjStart() - b.PutID("messageGiftedStars") - b.Comma() - b.FieldStart("gifter_user_id") - b.PutInt53(m.GifterUserID) - b.Comma() - b.FieldStart("receiver_user_id") - b.PutInt53(m.ReceiverUserID) - b.Comma() - b.FieldStart("currency") - b.PutString(m.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(m.Amount) - b.Comma() - b.FieldStart("cryptocurrency") - b.PutString(m.Cryptocurrency) - b.Comma() - b.FieldStart("cryptocurrency_amount") - b.PutLong(m.CryptocurrencyAmount) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(m.StarCount) - b.Comma() - b.FieldStart("transaction_id") - b.PutString(m.TransactionID) - b.Comma() - b.FieldStart("sticker") - if err := m.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGiftedStars#41bdbea7: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageGiftedStars) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageGiftedStars#41bdbea7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageGiftedStars"); err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: %w", err) - } - case "gifter_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field gifter_user_id: %w", err) - } - m.GifterUserID = value - case "receiver_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field receiver_user_id: %w", err) - } - m.ReceiverUserID = value - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field currency: %w", err) - } - m.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field amount: %w", err) - } - m.Amount = value - case "cryptocurrency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field cryptocurrency: %w", err) - } - m.Cryptocurrency = value - case "cryptocurrency_amount": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field cryptocurrency_amount: %w", err) - } - m.CryptocurrencyAmount = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field star_count: %w", err) - } - m.StarCount = value - case "transaction_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field transaction_id: %w", err) - } - m.TransactionID = value - case "sticker": - if err := m.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGiftedStars#41bdbea7: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGifterUserID returns value of GifterUserID field. -func (m *MessageGiftedStars) GetGifterUserID() (value int64) { - if m == nil { - return - } - return m.GifterUserID -} - -// GetReceiverUserID returns value of ReceiverUserID field. -func (m *MessageGiftedStars) GetReceiverUserID() (value int64) { - if m == nil { - return - } - return m.ReceiverUserID -} - -// GetCurrency returns value of Currency field. -func (m *MessageGiftedStars) GetCurrency() (value string) { - if m == nil { - return - } - return m.Currency -} - -// GetAmount returns value of Amount field. -func (m *MessageGiftedStars) GetAmount() (value int64) { - if m == nil { - return - } - return m.Amount -} - -// GetCryptocurrency returns value of Cryptocurrency field. -func (m *MessageGiftedStars) GetCryptocurrency() (value string) { - if m == nil { - return - } - return m.Cryptocurrency -} - -// GetCryptocurrencyAmount returns value of CryptocurrencyAmount field. -func (m *MessageGiftedStars) GetCryptocurrencyAmount() (value int64) { - if m == nil { - return - } - return m.CryptocurrencyAmount -} - -// GetStarCount returns value of StarCount field. -func (m *MessageGiftedStars) GetStarCount() (value int64) { - if m == nil { - return - } - return m.StarCount -} - -// GetTransactionID returns value of TransactionID field. -func (m *MessageGiftedStars) GetTransactionID() (value string) { - if m == nil { - return - } - return m.TransactionID -} - -// GetSticker returns value of Sticker field. -func (m *MessageGiftedStars) GetSticker() (value Sticker) { - if m == nil { - return - } - return m.Sticker -} - -// MessageGiveawayPrizeStars represents TL type `messageGiveawayPrizeStars#aa0f5de3`. -type MessageGiveawayPrizeStars struct { - // Number of Telegram Stars that were received - StarCount int64 - // Identifier of the transaction for Telegram Stars credit - TransactionID string - // Identifier of the supergroup or channel chat, which was automatically boosted by the - // winners of the giveaway - BoostedChatID int64 - // Identifier of the message with the giveaway in the boosted chat; can be 0 if the - // message was deleted - GiveawayMessageID int64 - // True, if the corresponding winner wasn't chosen and the Telegram Stars were received - // by the owner of the boosted chat - IsUnclaimed bool - // A sticker to be shown in the message; may be null if unknown - Sticker Sticker -} - -// MessageGiveawayPrizeStarsTypeID is TL type id of MessageGiveawayPrizeStars. -const MessageGiveawayPrizeStarsTypeID = 0xaa0f5de3 - -// construct implements constructor of MessageContentClass. -func (m MessageGiveawayPrizeStars) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageGiveawayPrizeStars. -var ( - _ bin.Encoder = &MessageGiveawayPrizeStars{} - _ bin.Decoder = &MessageGiveawayPrizeStars{} - _ bin.BareEncoder = &MessageGiveawayPrizeStars{} - _ bin.BareDecoder = &MessageGiveawayPrizeStars{} - - _ MessageContentClass = &MessageGiveawayPrizeStars{} -) - -func (m *MessageGiveawayPrizeStars) Zero() bool { - if m == nil { - return true - } - if !(m.StarCount == 0) { - return false - } - if !(m.TransactionID == "") { - return false - } - if !(m.BoostedChatID == 0) { - return false - } - if !(m.GiveawayMessageID == 0) { - return false - } - if !(m.IsUnclaimed == false) { - return false - } - if !(m.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageGiveawayPrizeStars) String() string { - if m == nil { - return "MessageGiveawayPrizeStars(nil)" - } - type Alias MessageGiveawayPrizeStars - return fmt.Sprintf("MessageGiveawayPrizeStars%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageGiveawayPrizeStars) TypeID() uint32 { - return MessageGiveawayPrizeStarsTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageGiveawayPrizeStars) TypeName() string { - return "messageGiveawayPrizeStars" -} - -// TypeInfo returns info about TL type. -func (m *MessageGiveawayPrizeStars) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageGiveawayPrizeStars", - ID: MessageGiveawayPrizeStarsTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "TransactionID", - SchemaName: "transaction_id", - }, - { - Name: "BoostedChatID", - SchemaName: "boosted_chat_id", - }, - { - Name: "GiveawayMessageID", - SchemaName: "giveaway_message_id", - }, - { - Name: "IsUnclaimed", - SchemaName: "is_unclaimed", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageGiveawayPrizeStars) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayPrizeStars#aa0f5de3 as nil") - } - b.PutID(MessageGiveawayPrizeStarsTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageGiveawayPrizeStars) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayPrizeStars#aa0f5de3 as nil") - } - b.PutInt53(m.StarCount) - b.PutString(m.TransactionID) - b.PutInt53(m.BoostedChatID) - b.PutInt53(m.GiveawayMessageID) - b.PutBool(m.IsUnclaimed) - if err := m.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGiveawayPrizeStars#aa0f5de3: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageGiveawayPrizeStars) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayPrizeStars#aa0f5de3 to nil") - } - if err := b.ConsumeID(MessageGiveawayPrizeStarsTypeID); err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageGiveawayPrizeStars) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayPrizeStars#aa0f5de3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field star_count: %w", err) - } - m.StarCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field transaction_id: %w", err) - } - m.TransactionID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field boosted_chat_id: %w", err) - } - m.BoostedChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field giveaway_message_id: %w", err) - } - m.GiveawayMessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field is_unclaimed: %w", err) - } - m.IsUnclaimed = value - } - { - if err := m.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageGiveawayPrizeStars) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageGiveawayPrizeStars#aa0f5de3 as nil") - } - b.ObjStart() - b.PutID("messageGiveawayPrizeStars") - b.Comma() - b.FieldStart("star_count") - b.PutInt53(m.StarCount) - b.Comma() - b.FieldStart("transaction_id") - b.PutString(m.TransactionID) - b.Comma() - b.FieldStart("boosted_chat_id") - b.PutInt53(m.BoostedChatID) - b.Comma() - b.FieldStart("giveaway_message_id") - b.PutInt53(m.GiveawayMessageID) - b.Comma() - b.FieldStart("is_unclaimed") - b.PutBool(m.IsUnclaimed) - b.Comma() - b.FieldStart("sticker") - if err := m.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGiveawayPrizeStars#aa0f5de3: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageGiveawayPrizeStars) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageGiveawayPrizeStars#aa0f5de3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageGiveawayPrizeStars"); err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field star_count: %w", err) - } - m.StarCount = value - case "transaction_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field transaction_id: %w", err) - } - m.TransactionID = value - case "boosted_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field boosted_chat_id: %w", err) - } - m.BoostedChatID = value - case "giveaway_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field giveaway_message_id: %w", err) - } - m.GiveawayMessageID = value - case "is_unclaimed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field is_unclaimed: %w", err) - } - m.IsUnclaimed = value - case "sticker": - if err := m.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGiveawayPrizeStars#aa0f5de3: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStarCount returns value of StarCount field. -func (m *MessageGiveawayPrizeStars) GetStarCount() (value int64) { - if m == nil { - return - } - return m.StarCount -} - -// GetTransactionID returns value of TransactionID field. -func (m *MessageGiveawayPrizeStars) GetTransactionID() (value string) { - if m == nil { - return - } - return m.TransactionID -} - -// GetBoostedChatID returns value of BoostedChatID field. -func (m *MessageGiveawayPrizeStars) GetBoostedChatID() (value int64) { - if m == nil { - return - } - return m.BoostedChatID -} - -// GetGiveawayMessageID returns value of GiveawayMessageID field. -func (m *MessageGiveawayPrizeStars) GetGiveawayMessageID() (value int64) { - if m == nil { - return - } - return m.GiveawayMessageID -} - -// GetIsUnclaimed returns value of IsUnclaimed field. -func (m *MessageGiveawayPrizeStars) GetIsUnclaimed() (value bool) { - if m == nil { - return - } - return m.IsUnclaimed -} - -// GetSticker returns value of Sticker field. -func (m *MessageGiveawayPrizeStars) GetSticker() (value Sticker) { - if m == nil { - return - } - return m.Sticker -} - -// MessageGift represents TL type `messageGift#621a3876`. -type MessageGift struct { - // The gift - Gift Gift - // Message added to the gift - Text FormattedText - // Number of Telegram Stars that can be claimed by the receiver instead of the regular - // gift; 0 if the gift can't be sold by the receiver - SellStarCount int64 - // Number of Telegram Stars that were paid by the sender for the ability to upgrade the - // gift - PrepaidUpgradeStarCount int64 - // True, if the sender and gift text are shown only to the gift receiver; otherwise, - // everyone will be able to see them - IsPrivate bool - // True, if the gift is displayed on the user's profile page; only for the receiver of - // the gift - IsSaved bool - // True, if the gift can be upgraded to a unique gift; only for the receiver of the gift - CanBeUpgraded bool - // True, if the gift was converted to Telegram Stars; only for the receiver of the gift - WasConverted bool - // True, if the gift was upgraded to a unique gift - WasUpgraded bool - // True, if the gift was refunded and isn't available anymore - WasRefunded bool - // Identifier of the service message messageUpgradedGift or messageRefundedUpgradedGift - // with upgraded version of the gift; can be 0 if none or an identifier of a deleted - // message. - UpgradeMessageID int64 -} - -// MessageGiftTypeID is TL type id of MessageGift. -const MessageGiftTypeID = 0x621a3876 - -// construct implements constructor of MessageContentClass. -func (m MessageGift) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageGift. -var ( - _ bin.Encoder = &MessageGift{} - _ bin.Decoder = &MessageGift{} - _ bin.BareEncoder = &MessageGift{} - _ bin.BareDecoder = &MessageGift{} - - _ MessageContentClass = &MessageGift{} -) - -func (m *MessageGift) Zero() bool { - if m == nil { - return true - } - if !(m.Gift.Zero()) { - return false - } - if !(m.Text.Zero()) { - return false - } - if !(m.SellStarCount == 0) { - return false - } - if !(m.PrepaidUpgradeStarCount == 0) { - return false - } - if !(m.IsPrivate == false) { - return false - } - if !(m.IsSaved == false) { - return false - } - if !(m.CanBeUpgraded == false) { - return false - } - if !(m.WasConverted == false) { - return false - } - if !(m.WasUpgraded == false) { - return false - } - if !(m.WasRefunded == false) { - return false - } - if !(m.UpgradeMessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageGift) String() string { - if m == nil { - return "MessageGift(nil)" - } - type Alias MessageGift - return fmt.Sprintf("MessageGift%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageGift) TypeID() uint32 { - return MessageGiftTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageGift) TypeName() string { - return "messageGift" -} - -// TypeInfo returns info about TL type. -func (m *MessageGift) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageGift", - ID: MessageGiftTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Gift", - SchemaName: "gift", - }, - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "SellStarCount", - SchemaName: "sell_star_count", - }, - { - Name: "PrepaidUpgradeStarCount", - SchemaName: "prepaid_upgrade_star_count", - }, - { - Name: "IsPrivate", - SchemaName: "is_private", - }, - { - Name: "IsSaved", - SchemaName: "is_saved", - }, - { - Name: "CanBeUpgraded", - SchemaName: "can_be_upgraded", - }, - { - Name: "WasConverted", - SchemaName: "was_converted", - }, - { - Name: "WasUpgraded", - SchemaName: "was_upgraded", - }, - { - Name: "WasRefunded", - SchemaName: "was_refunded", - }, - { - Name: "UpgradeMessageID", - SchemaName: "upgrade_message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageGift) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGift#621a3876 as nil") - } - b.PutID(MessageGiftTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageGift) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageGift#621a3876 as nil") - } - if err := m.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGift#621a3876: field gift: %w", err) - } - if err := m.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageGift#621a3876: field text: %w", err) - } - b.PutInt53(m.SellStarCount) - b.PutInt53(m.PrepaidUpgradeStarCount) - b.PutBool(m.IsPrivate) - b.PutBool(m.IsSaved) - b.PutBool(m.CanBeUpgraded) - b.PutBool(m.WasConverted) - b.PutBool(m.WasUpgraded) - b.PutBool(m.WasRefunded) - b.PutInt53(m.UpgradeMessageID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageGift) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGift#621a3876 to nil") - } - if err := b.ConsumeID(MessageGiftTypeID); err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageGift) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageGift#621a3876 to nil") - } - { - if err := m.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field gift: %w", err) - } - } - { - if err := m.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field text: %w", err) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field sell_star_count: %w", err) - } - m.SellStarCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field prepaid_upgrade_star_count: %w", err) - } - m.PrepaidUpgradeStarCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field is_private: %w", err) - } - m.IsPrivate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field is_saved: %w", err) - } - m.IsSaved = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field can_be_upgraded: %w", err) - } - m.CanBeUpgraded = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field was_converted: %w", err) - } - m.WasConverted = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field was_upgraded: %w", err) - } - m.WasUpgraded = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field was_refunded: %w", err) - } - m.WasRefunded = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field upgrade_message_id: %w", err) - } - m.UpgradeMessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageGift) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageGift#621a3876 as nil") - } - b.ObjStart() - b.PutID("messageGift") - b.Comma() - b.FieldStart("gift") - if err := m.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGift#621a3876: field gift: %w", err) - } - b.Comma() - b.FieldStart("text") - if err := m.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageGift#621a3876: field text: %w", err) - } - b.Comma() - b.FieldStart("sell_star_count") - b.PutInt53(m.SellStarCount) - b.Comma() - b.FieldStart("prepaid_upgrade_star_count") - b.PutInt53(m.PrepaidUpgradeStarCount) - b.Comma() - b.FieldStart("is_private") - b.PutBool(m.IsPrivate) - b.Comma() - b.FieldStart("is_saved") - b.PutBool(m.IsSaved) - b.Comma() - b.FieldStart("can_be_upgraded") - b.PutBool(m.CanBeUpgraded) - b.Comma() - b.FieldStart("was_converted") - b.PutBool(m.WasConverted) - b.Comma() - b.FieldStart("was_upgraded") - b.PutBool(m.WasUpgraded) - b.Comma() - b.FieldStart("was_refunded") - b.PutBool(m.WasRefunded) - b.Comma() - b.FieldStart("upgrade_message_id") - b.PutInt53(m.UpgradeMessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageGift) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageGift#621a3876 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageGift"); err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: %w", err) - } - case "gift": - if err := m.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field gift: %w", err) - } - case "text": - if err := m.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field text: %w", err) - } - case "sell_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field sell_star_count: %w", err) - } - m.SellStarCount = value - case "prepaid_upgrade_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field prepaid_upgrade_star_count: %w", err) - } - m.PrepaidUpgradeStarCount = value - case "is_private": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field is_private: %w", err) - } - m.IsPrivate = value - case "is_saved": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field is_saved: %w", err) - } - m.IsSaved = value - case "can_be_upgraded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field can_be_upgraded: %w", err) - } - m.CanBeUpgraded = value - case "was_converted": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field was_converted: %w", err) - } - m.WasConverted = value - case "was_upgraded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field was_upgraded: %w", err) - } - m.WasUpgraded = value - case "was_refunded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field was_refunded: %w", err) - } - m.WasRefunded = value - case "upgrade_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageGift#621a3876: field upgrade_message_id: %w", err) - } - m.UpgradeMessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGift returns value of Gift field. -func (m *MessageGift) GetGift() (value Gift) { - if m == nil { - return - } - return m.Gift -} - -// GetText returns value of Text field. -func (m *MessageGift) GetText() (value FormattedText) { - if m == nil { - return - } - return m.Text -} - -// GetSellStarCount returns value of SellStarCount field. -func (m *MessageGift) GetSellStarCount() (value int64) { - if m == nil { - return - } - return m.SellStarCount -} - -// GetPrepaidUpgradeStarCount returns value of PrepaidUpgradeStarCount field. -func (m *MessageGift) GetPrepaidUpgradeStarCount() (value int64) { - if m == nil { - return - } - return m.PrepaidUpgradeStarCount -} - -// GetIsPrivate returns value of IsPrivate field. -func (m *MessageGift) GetIsPrivate() (value bool) { - if m == nil { - return - } - return m.IsPrivate -} - -// GetIsSaved returns value of IsSaved field. -func (m *MessageGift) GetIsSaved() (value bool) { - if m == nil { - return - } - return m.IsSaved -} - -// GetCanBeUpgraded returns value of CanBeUpgraded field. -func (m *MessageGift) GetCanBeUpgraded() (value bool) { - if m == nil { - return - } - return m.CanBeUpgraded -} - -// GetWasConverted returns value of WasConverted field. -func (m *MessageGift) GetWasConverted() (value bool) { - if m == nil { - return - } - return m.WasConverted -} - -// GetWasUpgraded returns value of WasUpgraded field. -func (m *MessageGift) GetWasUpgraded() (value bool) { - if m == nil { - return - } - return m.WasUpgraded -} - -// GetWasRefunded returns value of WasRefunded field. -func (m *MessageGift) GetWasRefunded() (value bool) { - if m == nil { - return - } - return m.WasRefunded -} - -// GetUpgradeMessageID returns value of UpgradeMessageID field. -func (m *MessageGift) GetUpgradeMessageID() (value int64) { - if m == nil { - return - } - return m.UpgradeMessageID -} - -// MessageUpgradedGift represents TL type `messageUpgradedGift#4932f215`. -type MessageUpgradedGift struct { - // The gift - Gift UpgradedGift - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, - // this is a transferred gift - IsUpgrade bool - // True, if the gift is displayed on the user's profile page; only for the receiver of - // the gift - IsSaved bool - // True, if the gift can be transferred to another user; only for the receiver of the - // gift - CanBeTransferred bool - // True, if the gift was transferred to another user; only for the receiver of the gift - WasTransferred bool - // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the - // receiver of the gift - TransferStarCount int64 - // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as - // an NFT; 0 if NFT export isn't possible; only for the receiver of the gift - ExportDate int32 -} - -// MessageUpgradedGiftTypeID is TL type id of MessageUpgradedGift. -const MessageUpgradedGiftTypeID = 0x4932f215 - -// construct implements constructor of MessageContentClass. -func (m MessageUpgradedGift) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageUpgradedGift. -var ( - _ bin.Encoder = &MessageUpgradedGift{} - _ bin.Decoder = &MessageUpgradedGift{} - _ bin.BareEncoder = &MessageUpgradedGift{} - _ bin.BareDecoder = &MessageUpgradedGift{} - - _ MessageContentClass = &MessageUpgradedGift{} -) - -func (m *MessageUpgradedGift) Zero() bool { - if m == nil { - return true - } - if !(m.Gift.Zero()) { - return false - } - if !(m.IsUpgrade == false) { - return false - } - if !(m.IsSaved == false) { - return false - } - if !(m.CanBeTransferred == false) { - return false - } - if !(m.WasTransferred == false) { - return false - } - if !(m.TransferStarCount == 0) { - return false - } - if !(m.ExportDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageUpgradedGift) String() string { - if m == nil { - return "MessageUpgradedGift(nil)" - } - type Alias MessageUpgradedGift - return fmt.Sprintf("MessageUpgradedGift%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageUpgradedGift) TypeID() uint32 { - return MessageUpgradedGiftTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageUpgradedGift) TypeName() string { - return "messageUpgradedGift" -} - -// TypeInfo returns info about TL type. -func (m *MessageUpgradedGift) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageUpgradedGift", - ID: MessageUpgradedGiftTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Gift", - SchemaName: "gift", - }, - { - Name: "IsUpgrade", - SchemaName: "is_upgrade", - }, - { - Name: "IsSaved", - SchemaName: "is_saved", - }, - { - Name: "CanBeTransferred", - SchemaName: "can_be_transferred", - }, - { - Name: "WasTransferred", - SchemaName: "was_transferred", - }, - { - Name: "TransferStarCount", - SchemaName: "transfer_star_count", - }, - { - Name: "ExportDate", - SchemaName: "export_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageUpgradedGift) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageUpgradedGift#4932f215 as nil") - } - b.PutID(MessageUpgradedGiftTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageUpgradedGift) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageUpgradedGift#4932f215 as nil") - } - if err := m.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageUpgradedGift#4932f215: field gift: %w", err) - } - b.PutBool(m.IsUpgrade) - b.PutBool(m.IsSaved) - b.PutBool(m.CanBeTransferred) - b.PutBool(m.WasTransferred) - b.PutInt53(m.TransferStarCount) - b.PutInt32(m.ExportDate) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageUpgradedGift) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageUpgradedGift#4932f215 to nil") - } - if err := b.ConsumeID(MessageUpgradedGiftTypeID); err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageUpgradedGift) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageUpgradedGift#4932f215 to nil") - } - { - if err := m.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field gift: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field is_upgrade: %w", err) - } - m.IsUpgrade = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field is_saved: %w", err) - } - m.IsSaved = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field can_be_transferred: %w", err) - } - m.CanBeTransferred = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field was_transferred: %w", err) - } - m.WasTransferred = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field transfer_star_count: %w", err) - } - m.TransferStarCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field export_date: %w", err) - } - m.ExportDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageUpgradedGift) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageUpgradedGift#4932f215 as nil") - } - b.ObjStart() - b.PutID("messageUpgradedGift") - b.Comma() - b.FieldStart("gift") - if err := m.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageUpgradedGift#4932f215: field gift: %w", err) - } - b.Comma() - b.FieldStart("is_upgrade") - b.PutBool(m.IsUpgrade) - b.Comma() - b.FieldStart("is_saved") - b.PutBool(m.IsSaved) - b.Comma() - b.FieldStart("can_be_transferred") - b.PutBool(m.CanBeTransferred) - b.Comma() - b.FieldStart("was_transferred") - b.PutBool(m.WasTransferred) - b.Comma() - b.FieldStart("transfer_star_count") - b.PutInt53(m.TransferStarCount) - b.Comma() - b.FieldStart("export_date") - b.PutInt32(m.ExportDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageUpgradedGift) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageUpgradedGift#4932f215 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageUpgradedGift"); err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: %w", err) - } - case "gift": - if err := m.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field gift: %w", err) - } - case "is_upgrade": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field is_upgrade: %w", err) - } - m.IsUpgrade = value - case "is_saved": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field is_saved: %w", err) - } - m.IsSaved = value - case "can_be_transferred": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field can_be_transferred: %w", err) - } - m.CanBeTransferred = value - case "was_transferred": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field was_transferred: %w", err) - } - m.WasTransferred = value - case "transfer_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field transfer_star_count: %w", err) - } - m.TransferStarCount = value - case "export_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageUpgradedGift#4932f215: field export_date: %w", err) - } - m.ExportDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGift returns value of Gift field. -func (m *MessageUpgradedGift) GetGift() (value UpgradedGift) { - if m == nil { - return - } - return m.Gift -} - -// GetIsUpgrade returns value of IsUpgrade field. -func (m *MessageUpgradedGift) GetIsUpgrade() (value bool) { - if m == nil { - return - } - return m.IsUpgrade -} - -// GetIsSaved returns value of IsSaved field. -func (m *MessageUpgradedGift) GetIsSaved() (value bool) { - if m == nil { - return - } - return m.IsSaved -} - -// GetCanBeTransferred returns value of CanBeTransferred field. -func (m *MessageUpgradedGift) GetCanBeTransferred() (value bool) { - if m == nil { - return - } - return m.CanBeTransferred -} - -// GetWasTransferred returns value of WasTransferred field. -func (m *MessageUpgradedGift) GetWasTransferred() (value bool) { - if m == nil { - return - } - return m.WasTransferred -} - -// GetTransferStarCount returns value of TransferStarCount field. -func (m *MessageUpgradedGift) GetTransferStarCount() (value int64) { - if m == nil { - return - } - return m.TransferStarCount -} - -// GetExportDate returns value of ExportDate field. -func (m *MessageUpgradedGift) GetExportDate() (value int32) { - if m == nil { - return - } - return m.ExportDate -} - -// MessageRefundedUpgradedGift represents TL type `messageRefundedUpgradedGift#d373886d`. -type MessageRefundedUpgradedGift struct { - // The gift - Gift Gift - // True, if the gift was obtained by upgrading of a previously received gift - IsUpgrade bool -} - -// MessageRefundedUpgradedGiftTypeID is TL type id of MessageRefundedUpgradedGift. -const MessageRefundedUpgradedGiftTypeID = 0xd373886d - -// construct implements constructor of MessageContentClass. -func (m MessageRefundedUpgradedGift) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageRefundedUpgradedGift. -var ( - _ bin.Encoder = &MessageRefundedUpgradedGift{} - _ bin.Decoder = &MessageRefundedUpgradedGift{} - _ bin.BareEncoder = &MessageRefundedUpgradedGift{} - _ bin.BareDecoder = &MessageRefundedUpgradedGift{} - - _ MessageContentClass = &MessageRefundedUpgradedGift{} -) - -func (m *MessageRefundedUpgradedGift) Zero() bool { - if m == nil { - return true - } - if !(m.Gift.Zero()) { - return false - } - if !(m.IsUpgrade == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageRefundedUpgradedGift) String() string { - if m == nil { - return "MessageRefundedUpgradedGift(nil)" - } - type Alias MessageRefundedUpgradedGift - return fmt.Sprintf("MessageRefundedUpgradedGift%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageRefundedUpgradedGift) TypeID() uint32 { - return MessageRefundedUpgradedGiftTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageRefundedUpgradedGift) TypeName() string { - return "messageRefundedUpgradedGift" -} - -// TypeInfo returns info about TL type. -func (m *MessageRefundedUpgradedGift) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageRefundedUpgradedGift", - ID: MessageRefundedUpgradedGiftTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Gift", - SchemaName: "gift", - }, - { - Name: "IsUpgrade", - SchemaName: "is_upgrade", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageRefundedUpgradedGift) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageRefundedUpgradedGift#d373886d as nil") - } - b.PutID(MessageRefundedUpgradedGiftTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageRefundedUpgradedGift) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageRefundedUpgradedGift#d373886d as nil") - } - if err := m.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageRefundedUpgradedGift#d373886d: field gift: %w", err) - } - b.PutBool(m.IsUpgrade) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageRefundedUpgradedGift) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageRefundedUpgradedGift#d373886d to nil") - } - if err := b.ConsumeID(MessageRefundedUpgradedGiftTypeID); err != nil { - return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageRefundedUpgradedGift) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageRefundedUpgradedGift#d373886d to nil") - } - { - if err := m.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: field gift: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: field is_upgrade: %w", err) - } - m.IsUpgrade = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageRefundedUpgradedGift) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageRefundedUpgradedGift#d373886d as nil") - } - b.ObjStart() - b.PutID("messageRefundedUpgradedGift") - b.Comma() - b.FieldStart("gift") - if err := m.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageRefundedUpgradedGift#d373886d: field gift: %w", err) - } - b.Comma() - b.FieldStart("is_upgrade") - b.PutBool(m.IsUpgrade) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageRefundedUpgradedGift) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageRefundedUpgradedGift#d373886d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageRefundedUpgradedGift"); err != nil { - return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: %w", err) - } - case "gift": - if err := m.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: field gift: %w", err) - } - case "is_upgrade": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageRefundedUpgradedGift#d373886d: field is_upgrade: %w", err) - } - m.IsUpgrade = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGift returns value of Gift field. -func (m *MessageRefundedUpgradedGift) GetGift() (value Gift) { - if m == nil { - return - } - return m.Gift -} - -// GetIsUpgrade returns value of IsUpgrade field. -func (m *MessageRefundedUpgradedGift) GetIsUpgrade() (value bool) { - if m == nil { - return - } - return m.IsUpgrade -} - -// MessageContactRegistered represents TL type `messageContactRegistered#a678fcff`. -type MessageContactRegistered struct { -} - -// MessageContactRegisteredTypeID is TL type id of MessageContactRegistered. -const MessageContactRegisteredTypeID = 0xa678fcff - -// construct implements constructor of MessageContentClass. -func (m MessageContactRegistered) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageContactRegistered. -var ( - _ bin.Encoder = &MessageContactRegistered{} - _ bin.Decoder = &MessageContactRegistered{} - _ bin.BareEncoder = &MessageContactRegistered{} - _ bin.BareDecoder = &MessageContactRegistered{} - - _ MessageContentClass = &MessageContactRegistered{} -) - -func (m *MessageContactRegistered) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageContactRegistered) String() string { - if m == nil { - return "MessageContactRegistered(nil)" - } - type Alias MessageContactRegistered - return fmt.Sprintf("MessageContactRegistered%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageContactRegistered) TypeID() uint32 { - return MessageContactRegisteredTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageContactRegistered) TypeName() string { - return "messageContactRegistered" -} - -// TypeInfo returns info about TL type. -func (m *MessageContactRegistered) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageContactRegistered", - ID: MessageContactRegisteredTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageContactRegistered) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageContactRegistered#a678fcff as nil") - } - b.PutID(MessageContactRegisteredTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageContactRegistered) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageContactRegistered#a678fcff as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageContactRegistered) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageContactRegistered#a678fcff to nil") - } - if err := b.ConsumeID(MessageContactRegisteredTypeID); err != nil { - return fmt.Errorf("unable to decode messageContactRegistered#a678fcff: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageContactRegistered) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageContactRegistered#a678fcff to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageContactRegistered) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageContactRegistered#a678fcff as nil") - } - b.ObjStart() - b.PutID("messageContactRegistered") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageContactRegistered) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageContactRegistered#a678fcff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageContactRegistered"); err != nil { - return fmt.Errorf("unable to decode messageContactRegistered#a678fcff: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageUsersShared represents TL type `messageUsersShared#7f1f4a22`. -type MessageUsersShared struct { - // The shared users - Users []SharedUser - // Identifier of the keyboard button with the request - ButtonID int32 -} - -// MessageUsersSharedTypeID is TL type id of MessageUsersShared. -const MessageUsersSharedTypeID = 0x7f1f4a22 - -// construct implements constructor of MessageContentClass. -func (m MessageUsersShared) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageUsersShared. -var ( - _ bin.Encoder = &MessageUsersShared{} - _ bin.Decoder = &MessageUsersShared{} - _ bin.BareEncoder = &MessageUsersShared{} - _ bin.BareDecoder = &MessageUsersShared{} - - _ MessageContentClass = &MessageUsersShared{} -) - -func (m *MessageUsersShared) Zero() bool { - if m == nil { - return true - } - if !(m.Users == nil) { - return false - } - if !(m.ButtonID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageUsersShared) String() string { - if m == nil { - return "MessageUsersShared(nil)" - } - type Alias MessageUsersShared - return fmt.Sprintf("MessageUsersShared%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageUsersShared) TypeID() uint32 { - return MessageUsersSharedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageUsersShared) TypeName() string { - return "messageUsersShared" -} - -// TypeInfo returns info about TL type. -func (m *MessageUsersShared) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageUsersShared", - ID: MessageUsersSharedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Users", - SchemaName: "users", - }, - { - Name: "ButtonID", - SchemaName: "button_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageUsersShared) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageUsersShared#7f1f4a22 as nil") - } - b.PutID(MessageUsersSharedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageUsersShared) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageUsersShared#7f1f4a22 as nil") - } - b.PutInt(len(m.Users)) - for idx, v := range m.Users { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messageUsersShared#7f1f4a22: field users element with index %d: %w", idx, err) - } - } - b.PutInt32(m.ButtonID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageUsersShared) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageUsersShared#7f1f4a22 to nil") - } - if err := b.ConsumeID(MessageUsersSharedTypeID); err != nil { - return fmt.Errorf("unable to decode messageUsersShared#7f1f4a22: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageUsersShared) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageUsersShared#7f1f4a22 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageUsersShared#7f1f4a22: field users: %w", err) - } - - if headerLen > 0 { - m.Users = make([]SharedUser, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value SharedUser - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare messageUsersShared#7f1f4a22: field users: %w", err) - } - m.Users = append(m.Users, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageUsersShared#7f1f4a22: field button_id: %w", err) - } - m.ButtonID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageUsersShared) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageUsersShared#7f1f4a22 as nil") - } - b.ObjStart() - b.PutID("messageUsersShared") - b.Comma() - b.FieldStart("users") - b.ArrStart() - for idx, v := range m.Users { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageUsersShared#7f1f4a22: field users element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("button_id") - b.PutInt32(m.ButtonID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageUsersShared) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageUsersShared#7f1f4a22 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageUsersShared"); err != nil { - return fmt.Errorf("unable to decode messageUsersShared#7f1f4a22: %w", err) - } - case "users": - if err := b.Arr(func(b tdjson.Decoder) error { - var value SharedUser - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageUsersShared#7f1f4a22: field users: %w", err) - } - m.Users = append(m.Users, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageUsersShared#7f1f4a22: field users: %w", err) - } - case "button_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageUsersShared#7f1f4a22: field button_id: %w", err) - } - m.ButtonID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUsers returns value of Users field. -func (m *MessageUsersShared) GetUsers() (value []SharedUser) { - if m == nil { - return - } - return m.Users -} - -// GetButtonID returns value of ButtonID field. -func (m *MessageUsersShared) GetButtonID() (value int32) { - if m == nil { - return - } - return m.ButtonID -} - -// MessageChatShared represents TL type `messageChatShared#aec6d961`. -type MessageChatShared struct { - // The shared chat - Chat SharedChat - // Identifier of the keyboard button with the request - ButtonID int32 -} - -// MessageChatSharedTypeID is TL type id of MessageChatShared. -const MessageChatSharedTypeID = 0xaec6d961 - -// construct implements constructor of MessageContentClass. -func (m MessageChatShared) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageChatShared. -var ( - _ bin.Encoder = &MessageChatShared{} - _ bin.Decoder = &MessageChatShared{} - _ bin.BareEncoder = &MessageChatShared{} - _ bin.BareDecoder = &MessageChatShared{} - - _ MessageContentClass = &MessageChatShared{} -) - -func (m *MessageChatShared) Zero() bool { - if m == nil { - return true - } - if !(m.Chat.Zero()) { - return false - } - if !(m.ButtonID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageChatShared) String() string { - if m == nil { - return "MessageChatShared(nil)" - } - type Alias MessageChatShared - return fmt.Sprintf("MessageChatShared%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageChatShared) TypeID() uint32 { - return MessageChatSharedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageChatShared) TypeName() string { - return "messageChatShared" -} - -// TypeInfo returns info about TL type. -func (m *MessageChatShared) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageChatShared", - ID: MessageChatSharedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Chat", - SchemaName: "chat", - }, - { - Name: "ButtonID", - SchemaName: "button_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageChatShared) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatShared#aec6d961 as nil") - } - b.PutID(MessageChatSharedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageChatShared) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageChatShared#aec6d961 as nil") - } - if err := m.Chat.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageChatShared#aec6d961: field chat: %w", err) - } - b.PutInt32(m.ButtonID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageChatShared) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatShared#aec6d961 to nil") - } - if err := b.ConsumeID(MessageChatSharedTypeID); err != nil { - return fmt.Errorf("unable to decode messageChatShared#aec6d961: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageChatShared) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageChatShared#aec6d961 to nil") - } - { - if err := m.Chat.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageChatShared#aec6d961: field chat: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageChatShared#aec6d961: field button_id: %w", err) - } - m.ButtonID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageChatShared) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageChatShared#aec6d961 as nil") - } - b.ObjStart() - b.PutID("messageChatShared") - b.Comma() - b.FieldStart("chat") - if err := m.Chat.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageChatShared#aec6d961: field chat: %w", err) - } - b.Comma() - b.FieldStart("button_id") - b.PutInt32(m.ButtonID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageChatShared) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageChatShared#aec6d961 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageChatShared"); err != nil { - return fmt.Errorf("unable to decode messageChatShared#aec6d961: %w", err) - } - case "chat": - if err := m.Chat.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageChatShared#aec6d961: field chat: %w", err) - } - case "button_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageChatShared#aec6d961: field button_id: %w", err) - } - m.ButtonID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChat returns value of Chat field. -func (m *MessageChatShared) GetChat() (value SharedChat) { - if m == nil { - return - } - return m.Chat -} - -// GetButtonID returns value of ButtonID field. -func (m *MessageChatShared) GetButtonID() (value int32) { - if m == nil { - return - } - return m.ButtonID -} - -// MessageBotWriteAccessAllowed represents TL type `messageBotWriteAccessAllowed#9a8ab7b4`. -type MessageBotWriteAccessAllowed struct { - // The reason why the bot was allowed to write messages - Reason BotWriteAccessAllowReasonClass -} - -// MessageBotWriteAccessAllowedTypeID is TL type id of MessageBotWriteAccessAllowed. -const MessageBotWriteAccessAllowedTypeID = 0x9a8ab7b4 - -// construct implements constructor of MessageContentClass. -func (m MessageBotWriteAccessAllowed) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageBotWriteAccessAllowed. -var ( - _ bin.Encoder = &MessageBotWriteAccessAllowed{} - _ bin.Decoder = &MessageBotWriteAccessAllowed{} - _ bin.BareEncoder = &MessageBotWriteAccessAllowed{} - _ bin.BareDecoder = &MessageBotWriteAccessAllowed{} - - _ MessageContentClass = &MessageBotWriteAccessAllowed{} -) - -func (m *MessageBotWriteAccessAllowed) Zero() bool { - if m == nil { - return true - } - if !(m.Reason == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageBotWriteAccessAllowed) String() string { - if m == nil { - return "MessageBotWriteAccessAllowed(nil)" - } - type Alias MessageBotWriteAccessAllowed - return fmt.Sprintf("MessageBotWriteAccessAllowed%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageBotWriteAccessAllowed) TypeID() uint32 { - return MessageBotWriteAccessAllowedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageBotWriteAccessAllowed) TypeName() string { - return "messageBotWriteAccessAllowed" -} - -// TypeInfo returns info about TL type. -func (m *MessageBotWriteAccessAllowed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageBotWriteAccessAllowed", - ID: MessageBotWriteAccessAllowedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Reason", - SchemaName: "reason", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageBotWriteAccessAllowed) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageBotWriteAccessAllowed#9a8ab7b4 as nil") - } - b.PutID(MessageBotWriteAccessAllowedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageBotWriteAccessAllowed) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageBotWriteAccessAllowed#9a8ab7b4 as nil") - } - if m.Reason == nil { - return fmt.Errorf("unable to encode messageBotWriteAccessAllowed#9a8ab7b4: field reason is nil") - } - if err := m.Reason.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageBotWriteAccessAllowed#9a8ab7b4: field reason: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageBotWriteAccessAllowed) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageBotWriteAccessAllowed#9a8ab7b4 to nil") - } - if err := b.ConsumeID(MessageBotWriteAccessAllowedTypeID); err != nil { - return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#9a8ab7b4: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageBotWriteAccessAllowed) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageBotWriteAccessAllowed#9a8ab7b4 to nil") - } - { - value, err := DecodeBotWriteAccessAllowReason(b) - if err != nil { - return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#9a8ab7b4: field reason: %w", err) - } - m.Reason = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageBotWriteAccessAllowed) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageBotWriteAccessAllowed#9a8ab7b4 as nil") - } - b.ObjStart() - b.PutID("messageBotWriteAccessAllowed") - b.Comma() - b.FieldStart("reason") - if m.Reason == nil { - return fmt.Errorf("unable to encode messageBotWriteAccessAllowed#9a8ab7b4: field reason is nil") - } - if err := m.Reason.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageBotWriteAccessAllowed#9a8ab7b4: field reason: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageBotWriteAccessAllowed) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageBotWriteAccessAllowed#9a8ab7b4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageBotWriteAccessAllowed"); err != nil { - return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#9a8ab7b4: %w", err) - } - case "reason": - value, err := DecodeTDLibJSONBotWriteAccessAllowReason(b) - if err != nil { - return fmt.Errorf("unable to decode messageBotWriteAccessAllowed#9a8ab7b4: field reason: %w", err) - } - m.Reason = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReason returns value of Reason field. -func (m *MessageBotWriteAccessAllowed) GetReason() (value BotWriteAccessAllowReasonClass) { - if m == nil { - return - } - return m.Reason -} - -// MessageWebAppDataSent represents TL type `messageWebAppDataSent#fb033912`. -type MessageWebAppDataSent struct { - // Text of the keyboardButtonTypeWebApp button, which opened the Web App - ButtonText string -} - -// MessageWebAppDataSentTypeID is TL type id of MessageWebAppDataSent. -const MessageWebAppDataSentTypeID = 0xfb033912 - -// construct implements constructor of MessageContentClass. -func (m MessageWebAppDataSent) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageWebAppDataSent. -var ( - _ bin.Encoder = &MessageWebAppDataSent{} - _ bin.Decoder = &MessageWebAppDataSent{} - _ bin.BareEncoder = &MessageWebAppDataSent{} - _ bin.BareDecoder = &MessageWebAppDataSent{} - - _ MessageContentClass = &MessageWebAppDataSent{} -) - -func (m *MessageWebAppDataSent) Zero() bool { - if m == nil { - return true - } - if !(m.ButtonText == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageWebAppDataSent) String() string { - if m == nil { - return "MessageWebAppDataSent(nil)" - } - type Alias MessageWebAppDataSent - return fmt.Sprintf("MessageWebAppDataSent%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageWebAppDataSent) TypeID() uint32 { - return MessageWebAppDataSentTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageWebAppDataSent) TypeName() string { - return "messageWebAppDataSent" -} - -// TypeInfo returns info about TL type. -func (m *MessageWebAppDataSent) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageWebAppDataSent", - ID: MessageWebAppDataSentTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ButtonText", - SchemaName: "button_text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageWebAppDataSent) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageWebAppDataSent#fb033912 as nil") - } - b.PutID(MessageWebAppDataSentTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageWebAppDataSent) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageWebAppDataSent#fb033912 as nil") - } - b.PutString(m.ButtonText) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageWebAppDataSent) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageWebAppDataSent#fb033912 to nil") - } - if err := b.ConsumeID(MessageWebAppDataSentTypeID); err != nil { - return fmt.Errorf("unable to decode messageWebAppDataSent#fb033912: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageWebAppDataSent) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageWebAppDataSent#fb033912 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageWebAppDataSent#fb033912: field button_text: %w", err) - } - m.ButtonText = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageWebAppDataSent) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageWebAppDataSent#fb033912 as nil") - } - b.ObjStart() - b.PutID("messageWebAppDataSent") - b.Comma() - b.FieldStart("button_text") - b.PutString(m.ButtonText) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageWebAppDataSent) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageWebAppDataSent#fb033912 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageWebAppDataSent"); err != nil { - return fmt.Errorf("unable to decode messageWebAppDataSent#fb033912: %w", err) - } - case "button_text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageWebAppDataSent#fb033912: field button_text: %w", err) - } - m.ButtonText = value - default: - return b.Skip() - } - return nil - }) -} - -// GetButtonText returns value of ButtonText field. -func (m *MessageWebAppDataSent) GetButtonText() (value string) { - if m == nil { - return - } - return m.ButtonText -} - -// MessageWebAppDataReceived represents TL type `messageWebAppDataReceived#ff7d1a15`. -type MessageWebAppDataReceived struct { - // Text of the keyboardButtonTypeWebApp button, which opened the Web App - ButtonText string - // The data - Data string -} - -// MessageWebAppDataReceivedTypeID is TL type id of MessageWebAppDataReceived. -const MessageWebAppDataReceivedTypeID = 0xff7d1a15 - -// construct implements constructor of MessageContentClass. -func (m MessageWebAppDataReceived) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageWebAppDataReceived. -var ( - _ bin.Encoder = &MessageWebAppDataReceived{} - _ bin.Decoder = &MessageWebAppDataReceived{} - _ bin.BareEncoder = &MessageWebAppDataReceived{} - _ bin.BareDecoder = &MessageWebAppDataReceived{} - - _ MessageContentClass = &MessageWebAppDataReceived{} -) - -func (m *MessageWebAppDataReceived) Zero() bool { - if m == nil { - return true - } - if !(m.ButtonText == "") { - return false - } - if !(m.Data == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageWebAppDataReceived) String() string { - if m == nil { - return "MessageWebAppDataReceived(nil)" - } - type Alias MessageWebAppDataReceived - return fmt.Sprintf("MessageWebAppDataReceived%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageWebAppDataReceived) TypeID() uint32 { - return MessageWebAppDataReceivedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageWebAppDataReceived) TypeName() string { - return "messageWebAppDataReceived" -} - -// TypeInfo returns info about TL type. -func (m *MessageWebAppDataReceived) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageWebAppDataReceived", - ID: MessageWebAppDataReceivedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ButtonText", - SchemaName: "button_text", - }, - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageWebAppDataReceived) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageWebAppDataReceived#ff7d1a15 as nil") - } - b.PutID(MessageWebAppDataReceivedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageWebAppDataReceived) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageWebAppDataReceived#ff7d1a15 as nil") - } - b.PutString(m.ButtonText) - b.PutString(m.Data) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageWebAppDataReceived) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageWebAppDataReceived#ff7d1a15 to nil") - } - if err := b.ConsumeID(MessageWebAppDataReceivedTypeID); err != nil { - return fmt.Errorf("unable to decode messageWebAppDataReceived#ff7d1a15: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageWebAppDataReceived) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageWebAppDataReceived#ff7d1a15 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageWebAppDataReceived#ff7d1a15: field button_text: %w", err) - } - m.ButtonText = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageWebAppDataReceived#ff7d1a15: field data: %w", err) - } - m.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageWebAppDataReceived) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageWebAppDataReceived#ff7d1a15 as nil") - } - b.ObjStart() - b.PutID("messageWebAppDataReceived") - b.Comma() - b.FieldStart("button_text") - b.PutString(m.ButtonText) - b.Comma() - b.FieldStart("data") - b.PutString(m.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageWebAppDataReceived) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageWebAppDataReceived#ff7d1a15 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageWebAppDataReceived"); err != nil { - return fmt.Errorf("unable to decode messageWebAppDataReceived#ff7d1a15: %w", err) - } - case "button_text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageWebAppDataReceived#ff7d1a15: field button_text: %w", err) - } - m.ButtonText = value - case "data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageWebAppDataReceived#ff7d1a15: field data: %w", err) - } - m.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetButtonText returns value of ButtonText field. -func (m *MessageWebAppDataReceived) GetButtonText() (value string) { - if m == nil { - return - } - return m.ButtonText -} - -// GetData returns value of Data field. -func (m *MessageWebAppDataReceived) GetData() (value string) { - if m == nil { - return - } - return m.Data -} - -// MessagePassportDataSent represents TL type `messagePassportDataSent#26c5ed6b`. -type MessagePassportDataSent struct { - // List of Telegram Passport element types sent - Types []PassportElementTypeClass -} - -// MessagePassportDataSentTypeID is TL type id of MessagePassportDataSent. -const MessagePassportDataSentTypeID = 0x26c5ed6b - -// construct implements constructor of MessageContentClass. -func (m MessagePassportDataSent) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessagePassportDataSent. -var ( - _ bin.Encoder = &MessagePassportDataSent{} - _ bin.Decoder = &MessagePassportDataSent{} - _ bin.BareEncoder = &MessagePassportDataSent{} - _ bin.BareDecoder = &MessagePassportDataSent{} - - _ MessageContentClass = &MessagePassportDataSent{} -) - -func (m *MessagePassportDataSent) Zero() bool { - if m == nil { - return true - } - if !(m.Types == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePassportDataSent) String() string { - if m == nil { - return "MessagePassportDataSent(nil)" - } - type Alias MessagePassportDataSent - return fmt.Sprintf("MessagePassportDataSent%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePassportDataSent) TypeID() uint32 { - return MessagePassportDataSentTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePassportDataSent) TypeName() string { - return "messagePassportDataSent" -} - -// TypeInfo returns info about TL type. -func (m *MessagePassportDataSent) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePassportDataSent", - ID: MessagePassportDataSentTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Types", - SchemaName: "types", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePassportDataSent) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePassportDataSent#26c5ed6b as nil") - } - b.PutID(MessagePassportDataSentTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePassportDataSent) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePassportDataSent#26c5ed6b as nil") - } - b.PutInt(len(m.Types)) - for idx, v := range m.Types { - if v == nil { - return fmt.Errorf("unable to encode messagePassportDataSent#26c5ed6b: field types element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messagePassportDataSent#26c5ed6b: field types element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePassportDataSent) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePassportDataSent#26c5ed6b to nil") - } - if err := b.ConsumeID(MessagePassportDataSentTypeID); err != nil { - return fmt.Errorf("unable to decode messagePassportDataSent#26c5ed6b: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePassportDataSent) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePassportDataSent#26c5ed6b to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messagePassportDataSent#26c5ed6b: field types: %w", err) - } - - if headerLen > 0 { - m.Types = make([]PassportElementTypeClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode messagePassportDataSent#26c5ed6b: field types: %w", err) - } - m.Types = append(m.Types, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePassportDataSent) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePassportDataSent#26c5ed6b as nil") - } - b.ObjStart() - b.PutID("messagePassportDataSent") - b.Comma() - b.FieldStart("types") - b.ArrStart() - for idx, v := range m.Types { - if v == nil { - return fmt.Errorf("unable to encode messagePassportDataSent#26c5ed6b: field types element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePassportDataSent#26c5ed6b: field types element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePassportDataSent) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePassportDataSent#26c5ed6b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePassportDataSent"); err != nil { - return fmt.Errorf("unable to decode messagePassportDataSent#26c5ed6b: %w", err) - } - case "types": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode messagePassportDataSent#26c5ed6b: field types: %w", err) - } - m.Types = append(m.Types, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messagePassportDataSent#26c5ed6b: field types: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTypes returns value of Types field. -func (m *MessagePassportDataSent) GetTypes() (value []PassportElementTypeClass) { - if m == nil { - return - } - return m.Types -} - -// MessagePassportDataReceived represents TL type `messagePassportDataReceived#e0b936b9`. -type MessagePassportDataReceived struct { - // List of received Telegram Passport elements - Elements []EncryptedPassportElement - // Encrypted data credentials - Credentials EncryptedCredentials -} - -// MessagePassportDataReceivedTypeID is TL type id of MessagePassportDataReceived. -const MessagePassportDataReceivedTypeID = 0xe0b936b9 - -// construct implements constructor of MessageContentClass. -func (m MessagePassportDataReceived) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessagePassportDataReceived. -var ( - _ bin.Encoder = &MessagePassportDataReceived{} - _ bin.Decoder = &MessagePassportDataReceived{} - _ bin.BareEncoder = &MessagePassportDataReceived{} - _ bin.BareDecoder = &MessagePassportDataReceived{} - - _ MessageContentClass = &MessagePassportDataReceived{} -) - -func (m *MessagePassportDataReceived) Zero() bool { - if m == nil { - return true - } - if !(m.Elements == nil) { - return false - } - if !(m.Credentials.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePassportDataReceived) String() string { - if m == nil { - return "MessagePassportDataReceived(nil)" - } - type Alias MessagePassportDataReceived - return fmt.Sprintf("MessagePassportDataReceived%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePassportDataReceived) TypeID() uint32 { - return MessagePassportDataReceivedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePassportDataReceived) TypeName() string { - return "messagePassportDataReceived" -} - -// TypeInfo returns info about TL type. -func (m *MessagePassportDataReceived) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePassportDataReceived", - ID: MessagePassportDataReceivedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Elements", - SchemaName: "elements", - }, - { - Name: "Credentials", - SchemaName: "credentials", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePassportDataReceived) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePassportDataReceived#e0b936b9 as nil") - } - b.PutID(MessagePassportDataReceivedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePassportDataReceived) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePassportDataReceived#e0b936b9 as nil") - } - b.PutInt(len(m.Elements)) - for idx, v := range m.Elements { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messagePassportDataReceived#e0b936b9: field elements element with index %d: %w", idx, err) - } - } - if err := m.Credentials.Encode(b); err != nil { - return fmt.Errorf("unable to encode messagePassportDataReceived#e0b936b9: field credentials: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePassportDataReceived) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePassportDataReceived#e0b936b9 to nil") - } - if err := b.ConsumeID(MessagePassportDataReceivedTypeID); err != nil { - return fmt.Errorf("unable to decode messagePassportDataReceived#e0b936b9: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePassportDataReceived) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePassportDataReceived#e0b936b9 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messagePassportDataReceived#e0b936b9: field elements: %w", err) - } - - if headerLen > 0 { - m.Elements = make([]EncryptedPassportElement, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value EncryptedPassportElement - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare messagePassportDataReceived#e0b936b9: field elements: %w", err) - } - m.Elements = append(m.Elements, value) - } - } - { - if err := m.Credentials.Decode(b); err != nil { - return fmt.Errorf("unable to decode messagePassportDataReceived#e0b936b9: field credentials: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePassportDataReceived) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePassportDataReceived#e0b936b9 as nil") - } - b.ObjStart() - b.PutID("messagePassportDataReceived") - b.Comma() - b.FieldStart("elements") - b.ArrStart() - for idx, v := range m.Elements { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePassportDataReceived#e0b936b9: field elements element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("credentials") - if err := m.Credentials.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePassportDataReceived#e0b936b9: field credentials: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePassportDataReceived) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePassportDataReceived#e0b936b9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePassportDataReceived"); err != nil { - return fmt.Errorf("unable to decode messagePassportDataReceived#e0b936b9: %w", err) - } - case "elements": - if err := b.Arr(func(b tdjson.Decoder) error { - var value EncryptedPassportElement - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePassportDataReceived#e0b936b9: field elements: %w", err) - } - m.Elements = append(m.Elements, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messagePassportDataReceived#e0b936b9: field elements: %w", err) - } - case "credentials": - if err := m.Credentials.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePassportDataReceived#e0b936b9: field credentials: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetElements returns value of Elements field. -func (m *MessagePassportDataReceived) GetElements() (value []EncryptedPassportElement) { - if m == nil { - return - } - return m.Elements -} - -// GetCredentials returns value of Credentials field. -func (m *MessagePassportDataReceived) GetCredentials() (value EncryptedCredentials) { - if m == nil { - return - } - return m.Credentials -} - -// MessageProximityAlertTriggered represents TL type `messageProximityAlertTriggered#409f6d3`. -type MessageProximityAlertTriggered struct { - // The identifier of a user or chat that triggered the proximity alert - TravelerID MessageSenderClass - // The identifier of a user or chat that subscribed for the proximity alert - WatcherID MessageSenderClass - // The distance between the users - Distance int32 -} - -// MessageProximityAlertTriggeredTypeID is TL type id of MessageProximityAlertTriggered. -const MessageProximityAlertTriggeredTypeID = 0x409f6d3 - -// construct implements constructor of MessageContentClass. -func (m MessageProximityAlertTriggered) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageProximityAlertTriggered. -var ( - _ bin.Encoder = &MessageProximityAlertTriggered{} - _ bin.Decoder = &MessageProximityAlertTriggered{} - _ bin.BareEncoder = &MessageProximityAlertTriggered{} - _ bin.BareDecoder = &MessageProximityAlertTriggered{} - - _ MessageContentClass = &MessageProximityAlertTriggered{} -) - -func (m *MessageProximityAlertTriggered) Zero() bool { - if m == nil { - return true - } - if !(m.TravelerID == nil) { - return false - } - if !(m.WatcherID == nil) { - return false - } - if !(m.Distance == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageProximityAlertTriggered) String() string { - if m == nil { - return "MessageProximityAlertTriggered(nil)" - } - type Alias MessageProximityAlertTriggered - return fmt.Sprintf("MessageProximityAlertTriggered%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageProximityAlertTriggered) TypeID() uint32 { - return MessageProximityAlertTriggeredTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageProximityAlertTriggered) TypeName() string { - return "messageProximityAlertTriggered" -} - -// TypeInfo returns info about TL type. -func (m *MessageProximityAlertTriggered) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageProximityAlertTriggered", - ID: MessageProximityAlertTriggeredTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TravelerID", - SchemaName: "traveler_id", - }, - { - Name: "WatcherID", - SchemaName: "watcher_id", - }, - { - Name: "Distance", - SchemaName: "distance", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageProximityAlertTriggered) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageProximityAlertTriggered#409f6d3 as nil") - } - b.PutID(MessageProximityAlertTriggeredTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageProximityAlertTriggered) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageProximityAlertTriggered#409f6d3 as nil") - } - if m.TravelerID == nil { - return fmt.Errorf("unable to encode messageProximityAlertTriggered#409f6d3: field traveler_id is nil") - } - if err := m.TravelerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageProximityAlertTriggered#409f6d3: field traveler_id: %w", err) - } - if m.WatcherID == nil { - return fmt.Errorf("unable to encode messageProximityAlertTriggered#409f6d3: field watcher_id is nil") - } - if err := m.WatcherID.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageProximityAlertTriggered#409f6d3: field watcher_id: %w", err) - } - b.PutInt32(m.Distance) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageProximityAlertTriggered) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageProximityAlertTriggered#409f6d3 to nil") - } - if err := b.ConsumeID(MessageProximityAlertTriggeredTypeID); err != nil { - return fmt.Errorf("unable to decode messageProximityAlertTriggered#409f6d3: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageProximityAlertTriggered) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageProximityAlertTriggered#409f6d3 to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageProximityAlertTriggered#409f6d3: field traveler_id: %w", err) - } - m.TravelerID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageProximityAlertTriggered#409f6d3: field watcher_id: %w", err) - } - m.WatcherID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageProximityAlertTriggered#409f6d3: field distance: %w", err) - } - m.Distance = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageProximityAlertTriggered) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageProximityAlertTriggered#409f6d3 as nil") - } - b.ObjStart() - b.PutID("messageProximityAlertTriggered") - b.Comma() - b.FieldStart("traveler_id") - if m.TravelerID == nil { - return fmt.Errorf("unable to encode messageProximityAlertTriggered#409f6d3: field traveler_id is nil") - } - if err := m.TravelerID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageProximityAlertTriggered#409f6d3: field traveler_id: %w", err) - } - b.Comma() - b.FieldStart("watcher_id") - if m.WatcherID == nil { - return fmt.Errorf("unable to encode messageProximityAlertTriggered#409f6d3: field watcher_id is nil") - } - if err := m.WatcherID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageProximityAlertTriggered#409f6d3: field watcher_id: %w", err) - } - b.Comma() - b.FieldStart("distance") - b.PutInt32(m.Distance) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageProximityAlertTriggered) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageProximityAlertTriggered#409f6d3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageProximityAlertTriggered"); err != nil { - return fmt.Errorf("unable to decode messageProximityAlertTriggered#409f6d3: %w", err) - } - case "traveler_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageProximityAlertTriggered#409f6d3: field traveler_id: %w", err) - } - m.TravelerID = value - case "watcher_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageProximityAlertTriggered#409f6d3: field watcher_id: %w", err) - } - m.WatcherID = value - case "distance": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageProximityAlertTriggered#409f6d3: field distance: %w", err) - } - m.Distance = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTravelerID returns value of TravelerID field. -func (m *MessageProximityAlertTriggered) GetTravelerID() (value MessageSenderClass) { - if m == nil { - return - } - return m.TravelerID -} - -// GetWatcherID returns value of WatcherID field. -func (m *MessageProximityAlertTriggered) GetWatcherID() (value MessageSenderClass) { - if m == nil { - return - } - return m.WatcherID -} - -// GetDistance returns value of Distance field. -func (m *MessageProximityAlertTriggered) GetDistance() (value int32) { - if m == nil { - return - } - return m.Distance -} - -// MessageUnsupported represents TL type `messageUnsupported#93b6f585`. -type MessageUnsupported struct { -} - -// MessageUnsupportedTypeID is TL type id of MessageUnsupported. -const MessageUnsupportedTypeID = 0x93b6f585 - -// construct implements constructor of MessageContentClass. -func (m MessageUnsupported) construct() MessageContentClass { return &m } - -// Ensuring interfaces in compile-time for MessageUnsupported. -var ( - _ bin.Encoder = &MessageUnsupported{} - _ bin.Decoder = &MessageUnsupported{} - _ bin.BareEncoder = &MessageUnsupported{} - _ bin.BareDecoder = &MessageUnsupported{} - - _ MessageContentClass = &MessageUnsupported{} -) - -func (m *MessageUnsupported) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageUnsupported) String() string { - if m == nil { - return "MessageUnsupported(nil)" - } - type Alias MessageUnsupported - return fmt.Sprintf("MessageUnsupported%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageUnsupported) TypeID() uint32 { - return MessageUnsupportedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageUnsupported) TypeName() string { - return "messageUnsupported" -} - -// TypeInfo returns info about TL type. -func (m *MessageUnsupported) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageUnsupported", - ID: MessageUnsupportedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageUnsupported) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageUnsupported#93b6f585 as nil") - } - b.PutID(MessageUnsupportedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageUnsupported) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageUnsupported#93b6f585 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageUnsupported) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageUnsupported#93b6f585 to nil") - } - if err := b.ConsumeID(MessageUnsupportedTypeID); err != nil { - return fmt.Errorf("unable to decode messageUnsupported#93b6f585: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageUnsupported) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageUnsupported#93b6f585 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageUnsupported) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageUnsupported#93b6f585 as nil") - } - b.ObjStart() - b.PutID("messageUnsupported") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageUnsupported) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageUnsupported#93b6f585 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageUnsupported"); err != nil { - return fmt.Errorf("unable to decode messageUnsupported#93b6f585: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageContentClassName is schema name of MessageContentClass. -const MessageContentClassName = "MessageContent" - -// MessageContentClass represents MessageContent generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageContent(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageText: // messageText#68654c84 -// case *tdapi.MessageAnimation: // messageAnimation#8ecb1128 -// case *tdapi.MessageAudio: // messageAudio#107e741c -// case *tdapi.MessageDocument: // messageDocument#2394ab77 -// case *tdapi.MessagePaidMedia: // messagePaidMedia#3e5fd7c2 -// case *tdapi.MessagePhoto: // messagePhoto#754c7e1f -// case *tdapi.MessageSticker: // messageSticker#e5f0dcca -// case *tdapi.MessageVideo: // messageVideo#fdcc35d5 -// case *tdapi.MessageVideoNote: // messageVideoNote#396b2486 -// case *tdapi.MessageVoiceNote: // messageVoiceNote#1f753ff5 -// case *tdapi.MessageExpiredPhoto: // messageExpiredPhoto#ac46ddf7 -// case *tdapi.MessageExpiredVideo: // messageExpiredVideo#b7bf24c3 -// case *tdapi.MessageExpiredVideoNote: // messageExpiredVideoNote#23bc43e7 -// case *tdapi.MessageExpiredVoiceNote: // messageExpiredVoiceNote#890757d -// case *tdapi.MessageLocation: // messageLocation#121e4474 -// case *tdapi.MessageVenue: // messageVenue#800f2175 -// case *tdapi.MessageContact: // messageContact#e1710c5a -// case *tdapi.MessageAnimatedEmoji: // messageAnimatedEmoji#3621f5e2 -// case *tdapi.MessageDice: // messageDice#42817239 -// case *tdapi.MessageGame: // messageGame#fbdc6976 -// case *tdapi.MessagePoll: // messagePoll#d888b24d -// case *tdapi.MessageStory: // messageStory#3329f2d4 -// case *tdapi.MessageInvoice: // messageInvoice#fadfd46 -// case *tdapi.MessageCall: // messageCall#201ede00 -// case *tdapi.MessageVideoChatScheduled: // messageVideoChatScheduled#916c1db7 -// case *tdapi.MessageVideoChatStarted: // messageVideoChatStarted#1f114559 -// case *tdapi.MessageVideoChatEnded: // messageVideoChatEnded#79262c57 -// case *tdapi.MessageInviteVideoChatParticipants: // messageInviteVideoChatParticipants#f58d603 -// case *tdapi.MessageBasicGroupChatCreate: // messageBasicGroupChatCreate#8b60f757 -// case *tdapi.MessageSupergroupChatCreate: // messageSupergroupChatCreate#e61cb71b -// case *tdapi.MessageChatChangeTitle: // messageChatChangeTitle#2c99bb41 -// case *tdapi.MessageChatChangePhoto: // messageChatChangePhoto#cf84454b -// case *tdapi.MessageChatDeletePhoto: // messageChatDeletePhoto#f502a9e7 -// case *tdapi.MessageChatAddMembers: // messageChatAddMembers#1e95b1cd -// case *tdapi.MessageChatJoinByLink: // messageChatJoinByLink#6e0f407f -// case *tdapi.MessageChatJoinByRequest: // messageChatJoinByRequest#4740cb7c -// case *tdapi.MessageChatDeleteMember: // messageChatDeleteMember#37e931a9 -// case *tdapi.MessageChatUpgradeTo: // messageChatUpgradeTo#63f549b -// case *tdapi.MessageChatUpgradeFrom: // messageChatUpgradeFrom#136daadc -// case *tdapi.MessagePinMessage: // messagePinMessage#38d55039 -// case *tdapi.MessageScreenshotTaken: // messageScreenshotTaken#a2b86dab -// case *tdapi.MessageChatSetBackground: // messageChatSetBackground#3d5d7c40 -// case *tdapi.MessageChatSetTheme: // messageChatSetTheme#99ae9408 -// case *tdapi.MessageChatSetMessageAutoDeleteTime: // messageChatSetMessageAutoDeleteTime#619e052e -// case *tdapi.MessageChatBoost: // messageChatBoost#5e5f658b -// case *tdapi.MessageForumTopicCreated: // messageForumTopicCreated#b8ce47d1 -// case *tdapi.MessageForumTopicEdited: // messageForumTopicEdited#c0b780 -// case *tdapi.MessageForumTopicIsClosedToggled: // messageForumTopicIsClosedToggled#4b578fe0 -// case *tdapi.MessageForumTopicIsHiddenToggled: // messageForumTopicIsHiddenToggled#979393fe -// case *tdapi.MessageSuggestProfilePhoto: // messageSuggestProfilePhoto#b5611ee7 -// case *tdapi.MessageCustomServiceAction: // messageCustomServiceAction#5595c772 -// case *tdapi.MessageGameScore: // messageGameScore#50299d7f -// case *tdapi.MessagePaymentSuccessful: // messagePaymentSuccessful#3e661911 -// case *tdapi.MessagePaymentSuccessfulBot: // messagePaymentSuccessfulBot#c7664dbf -// case *tdapi.MessagePaymentRefunded: // messagePaymentRefunded#11bcb8f3 -// case *tdapi.MessageGiftedPremium: // messageGiftedPremium#e4d0e07a -// case *tdapi.MessagePremiumGiftCode: // messagePremiumGiftCode#29d22e4e -// case *tdapi.MessageGiveawayCreated: // messageGiveawayCreated#39f3639f -// case *tdapi.MessageGiveaway: // messageGiveaway#eb61daa8 -// case *tdapi.MessageGiveawayCompleted: // messageGiveawayCompleted#e424c8f7 -// case *tdapi.MessageGiveawayWinners: // messageGiveawayWinners#1d99a27a -// case *tdapi.MessageGiftedStars: // messageGiftedStars#41bdbea7 -// case *tdapi.MessageGiveawayPrizeStars: // messageGiveawayPrizeStars#aa0f5de3 -// case *tdapi.MessageGift: // messageGift#621a3876 -// case *tdapi.MessageUpgradedGift: // messageUpgradedGift#4932f215 -// case *tdapi.MessageRefundedUpgradedGift: // messageRefundedUpgradedGift#d373886d -// case *tdapi.MessageContactRegistered: // messageContactRegistered#a678fcff -// case *tdapi.MessageUsersShared: // messageUsersShared#7f1f4a22 -// case *tdapi.MessageChatShared: // messageChatShared#aec6d961 -// case *tdapi.MessageBotWriteAccessAllowed: // messageBotWriteAccessAllowed#9a8ab7b4 -// case *tdapi.MessageWebAppDataSent: // messageWebAppDataSent#fb033912 -// case *tdapi.MessageWebAppDataReceived: // messageWebAppDataReceived#ff7d1a15 -// case *tdapi.MessagePassportDataSent: // messagePassportDataSent#26c5ed6b -// case *tdapi.MessagePassportDataReceived: // messagePassportDataReceived#e0b936b9 -// case *tdapi.MessageProximityAlertTriggered: // messageProximityAlertTriggered#409f6d3 -// case *tdapi.MessageUnsupported: // messageUnsupported#93b6f585 -// default: panic(v) -// } -type MessageContentClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageContentClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMessageContent implements binary de-serialization for MessageContentClass. -func DecodeMessageContent(buf *bin.Buffer) (MessageContentClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageTextTypeID: - // Decoding messageText#68654c84. - v := MessageText{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageAnimationTypeID: - // Decoding messageAnimation#8ecb1128. - v := MessageAnimation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageAudioTypeID: - // Decoding messageAudio#107e741c. - v := MessageAudio{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageDocumentTypeID: - // Decoding messageDocument#2394ab77. - v := MessageDocument{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessagePaidMediaTypeID: - // Decoding messagePaidMedia#3e5fd7c2. - v := MessagePaidMedia{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessagePhotoTypeID: - // Decoding messagePhoto#754c7e1f. - v := MessagePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageStickerTypeID: - // Decoding messageSticker#e5f0dcca. - v := MessageSticker{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageVideoTypeID: - // Decoding messageVideo#fdcc35d5. - v := MessageVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageVideoNoteTypeID: - // Decoding messageVideoNote#396b2486. - v := MessageVideoNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageVoiceNoteTypeID: - // Decoding messageVoiceNote#1f753ff5. - v := MessageVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageExpiredPhotoTypeID: - // Decoding messageExpiredPhoto#ac46ddf7. - v := MessageExpiredPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageExpiredVideoTypeID: - // Decoding messageExpiredVideo#b7bf24c3. - v := MessageExpiredVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageExpiredVideoNoteTypeID: - // Decoding messageExpiredVideoNote#23bc43e7. - v := MessageExpiredVideoNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageExpiredVoiceNoteTypeID: - // Decoding messageExpiredVoiceNote#890757d. - v := MessageExpiredVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageLocationTypeID: - // Decoding messageLocation#121e4474. - v := MessageLocation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageVenueTypeID: - // Decoding messageVenue#800f2175. - v := MessageVenue{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageContactTypeID: - // Decoding messageContact#e1710c5a. - v := MessageContact{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageAnimatedEmojiTypeID: - // Decoding messageAnimatedEmoji#3621f5e2. - v := MessageAnimatedEmoji{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageDiceTypeID: - // Decoding messageDice#42817239. - v := MessageDice{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageGameTypeID: - // Decoding messageGame#fbdc6976. - v := MessageGame{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessagePollTypeID: - // Decoding messagePoll#d888b24d. - v := MessagePoll{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageStoryTypeID: - // Decoding messageStory#3329f2d4. - v := MessageStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageInvoiceTypeID: - // Decoding messageInvoice#fadfd46. - v := MessageInvoice{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageCallTypeID: - // Decoding messageCall#201ede00. - v := MessageCall{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageVideoChatScheduledTypeID: - // Decoding messageVideoChatScheduled#916c1db7. - v := MessageVideoChatScheduled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageVideoChatStartedTypeID: - // Decoding messageVideoChatStarted#1f114559. - v := MessageVideoChatStarted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageVideoChatEndedTypeID: - // Decoding messageVideoChatEnded#79262c57. - v := MessageVideoChatEnded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageInviteVideoChatParticipantsTypeID: - // Decoding messageInviteVideoChatParticipants#f58d603. - v := MessageInviteVideoChatParticipants{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageBasicGroupChatCreateTypeID: - // Decoding messageBasicGroupChatCreate#8b60f757. - v := MessageBasicGroupChatCreate{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageSupergroupChatCreateTypeID: - // Decoding messageSupergroupChatCreate#e61cb71b. - v := MessageSupergroupChatCreate{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatChangeTitleTypeID: - // Decoding messageChatChangeTitle#2c99bb41. - v := MessageChatChangeTitle{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatChangePhotoTypeID: - // Decoding messageChatChangePhoto#cf84454b. - v := MessageChatChangePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatDeletePhotoTypeID: - // Decoding messageChatDeletePhoto#f502a9e7. - v := MessageChatDeletePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatAddMembersTypeID: - // Decoding messageChatAddMembers#1e95b1cd. - v := MessageChatAddMembers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatJoinByLinkTypeID: - // Decoding messageChatJoinByLink#6e0f407f. - v := MessageChatJoinByLink{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatJoinByRequestTypeID: - // Decoding messageChatJoinByRequest#4740cb7c. - v := MessageChatJoinByRequest{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatDeleteMemberTypeID: - // Decoding messageChatDeleteMember#37e931a9. - v := MessageChatDeleteMember{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatUpgradeToTypeID: - // Decoding messageChatUpgradeTo#63f549b. - v := MessageChatUpgradeTo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatUpgradeFromTypeID: - // Decoding messageChatUpgradeFrom#136daadc. - v := MessageChatUpgradeFrom{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessagePinMessageTypeID: - // Decoding messagePinMessage#38d55039. - v := MessagePinMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageScreenshotTakenTypeID: - // Decoding messageScreenshotTaken#a2b86dab. - v := MessageScreenshotTaken{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatSetBackgroundTypeID: - // Decoding messageChatSetBackground#3d5d7c40. - v := MessageChatSetBackground{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatSetThemeTypeID: - // Decoding messageChatSetTheme#99ae9408. - v := MessageChatSetTheme{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatSetMessageAutoDeleteTimeTypeID: - // Decoding messageChatSetMessageAutoDeleteTime#619e052e. - v := MessageChatSetMessageAutoDeleteTime{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatBoostTypeID: - // Decoding messageChatBoost#5e5f658b. - v := MessageChatBoost{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageForumTopicCreatedTypeID: - // Decoding messageForumTopicCreated#b8ce47d1. - v := MessageForumTopicCreated{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageForumTopicEditedTypeID: - // Decoding messageForumTopicEdited#c0b780. - v := MessageForumTopicEdited{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageForumTopicIsClosedToggledTypeID: - // Decoding messageForumTopicIsClosedToggled#4b578fe0. - v := MessageForumTopicIsClosedToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageForumTopicIsHiddenToggledTypeID: - // Decoding messageForumTopicIsHiddenToggled#979393fe. - v := MessageForumTopicIsHiddenToggled{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageSuggestProfilePhotoTypeID: - // Decoding messageSuggestProfilePhoto#b5611ee7. - v := MessageSuggestProfilePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageCustomServiceActionTypeID: - // Decoding messageCustomServiceAction#5595c772. - v := MessageCustomServiceAction{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageGameScoreTypeID: - // Decoding messageGameScore#50299d7f. - v := MessageGameScore{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessagePaymentSuccessfulTypeID: - // Decoding messagePaymentSuccessful#3e661911. - v := MessagePaymentSuccessful{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessagePaymentSuccessfulBotTypeID: - // Decoding messagePaymentSuccessfulBot#c7664dbf. - v := MessagePaymentSuccessfulBot{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessagePaymentRefundedTypeID: - // Decoding messagePaymentRefunded#11bcb8f3. - v := MessagePaymentRefunded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageGiftedPremiumTypeID: - // Decoding messageGiftedPremium#e4d0e07a. - v := MessageGiftedPremium{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessagePremiumGiftCodeTypeID: - // Decoding messagePremiumGiftCode#29d22e4e. - v := MessagePremiumGiftCode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageGiveawayCreatedTypeID: - // Decoding messageGiveawayCreated#39f3639f. - v := MessageGiveawayCreated{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageGiveawayTypeID: - // Decoding messageGiveaway#eb61daa8. - v := MessageGiveaway{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageGiveawayCompletedTypeID: - // Decoding messageGiveawayCompleted#e424c8f7. - v := MessageGiveawayCompleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageGiveawayWinnersTypeID: - // Decoding messageGiveawayWinners#1d99a27a. - v := MessageGiveawayWinners{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageGiftedStarsTypeID: - // Decoding messageGiftedStars#41bdbea7. - v := MessageGiftedStars{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageGiveawayPrizeStarsTypeID: - // Decoding messageGiveawayPrizeStars#aa0f5de3. - v := MessageGiveawayPrizeStars{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageGiftTypeID: - // Decoding messageGift#621a3876. - v := MessageGift{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageUpgradedGiftTypeID: - // Decoding messageUpgradedGift#4932f215. - v := MessageUpgradedGift{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageRefundedUpgradedGiftTypeID: - // Decoding messageRefundedUpgradedGift#d373886d. - v := MessageRefundedUpgradedGift{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageContactRegisteredTypeID: - // Decoding messageContactRegistered#a678fcff. - v := MessageContactRegistered{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageUsersSharedTypeID: - // Decoding messageUsersShared#7f1f4a22. - v := MessageUsersShared{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageChatSharedTypeID: - // Decoding messageChatShared#aec6d961. - v := MessageChatShared{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageBotWriteAccessAllowedTypeID: - // Decoding messageBotWriteAccessAllowed#9a8ab7b4. - v := MessageBotWriteAccessAllowed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageWebAppDataSentTypeID: - // Decoding messageWebAppDataSent#fb033912. - v := MessageWebAppDataSent{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageWebAppDataReceivedTypeID: - // Decoding messageWebAppDataReceived#ff7d1a15. - v := MessageWebAppDataReceived{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessagePassportDataSentTypeID: - // Decoding messagePassportDataSent#26c5ed6b. - v := MessagePassportDataSent{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessagePassportDataReceivedTypeID: - // Decoding messagePassportDataReceived#e0b936b9. - v := MessagePassportDataReceived{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageProximityAlertTriggeredTypeID: - // Decoding messageProximityAlertTriggered#409f6d3. - v := MessageProximityAlertTriggered{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case MessageUnsupportedTypeID: - // Decoding messageUnsupported#93b6f585. - v := MessageUnsupported{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageContent implements binary de-serialization for MessageContentClass. -func DecodeTDLibJSONMessageContent(buf tdjson.Decoder) (MessageContentClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageText": - // Decoding messageText#68654c84. - v := MessageText{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageAnimation": - // Decoding messageAnimation#8ecb1128. - v := MessageAnimation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageAudio": - // Decoding messageAudio#107e741c. - v := MessageAudio{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageDocument": - // Decoding messageDocument#2394ab77. - v := MessageDocument{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messagePaidMedia": - // Decoding messagePaidMedia#3e5fd7c2. - v := MessagePaidMedia{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messagePhoto": - // Decoding messagePhoto#754c7e1f. - v := MessagePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageSticker": - // Decoding messageSticker#e5f0dcca. - v := MessageSticker{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageVideo": - // Decoding messageVideo#fdcc35d5. - v := MessageVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageVideoNote": - // Decoding messageVideoNote#396b2486. - v := MessageVideoNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageVoiceNote": - // Decoding messageVoiceNote#1f753ff5. - v := MessageVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageExpiredPhoto": - // Decoding messageExpiredPhoto#ac46ddf7. - v := MessageExpiredPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageExpiredVideo": - // Decoding messageExpiredVideo#b7bf24c3. - v := MessageExpiredVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageExpiredVideoNote": - // Decoding messageExpiredVideoNote#23bc43e7. - v := MessageExpiredVideoNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageExpiredVoiceNote": - // Decoding messageExpiredVoiceNote#890757d. - v := MessageExpiredVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageLocation": - // Decoding messageLocation#121e4474. - v := MessageLocation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageVenue": - // Decoding messageVenue#800f2175. - v := MessageVenue{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageContact": - // Decoding messageContact#e1710c5a. - v := MessageContact{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageAnimatedEmoji": - // Decoding messageAnimatedEmoji#3621f5e2. - v := MessageAnimatedEmoji{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageDice": - // Decoding messageDice#42817239. - v := MessageDice{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageGame": - // Decoding messageGame#fbdc6976. - v := MessageGame{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messagePoll": - // Decoding messagePoll#d888b24d. - v := MessagePoll{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageStory": - // Decoding messageStory#3329f2d4. - v := MessageStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageInvoice": - // Decoding messageInvoice#fadfd46. - v := MessageInvoice{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageCall": - // Decoding messageCall#201ede00. - v := MessageCall{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageVideoChatScheduled": - // Decoding messageVideoChatScheduled#916c1db7. - v := MessageVideoChatScheduled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageVideoChatStarted": - // Decoding messageVideoChatStarted#1f114559. - v := MessageVideoChatStarted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageVideoChatEnded": - // Decoding messageVideoChatEnded#79262c57. - v := MessageVideoChatEnded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageInviteVideoChatParticipants": - // Decoding messageInviteVideoChatParticipants#f58d603. - v := MessageInviteVideoChatParticipants{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageBasicGroupChatCreate": - // Decoding messageBasicGroupChatCreate#8b60f757. - v := MessageBasicGroupChatCreate{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageSupergroupChatCreate": - // Decoding messageSupergroupChatCreate#e61cb71b. - v := MessageSupergroupChatCreate{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatChangeTitle": - // Decoding messageChatChangeTitle#2c99bb41. - v := MessageChatChangeTitle{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatChangePhoto": - // Decoding messageChatChangePhoto#cf84454b. - v := MessageChatChangePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatDeletePhoto": - // Decoding messageChatDeletePhoto#f502a9e7. - v := MessageChatDeletePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatAddMembers": - // Decoding messageChatAddMembers#1e95b1cd. - v := MessageChatAddMembers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatJoinByLink": - // Decoding messageChatJoinByLink#6e0f407f. - v := MessageChatJoinByLink{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatJoinByRequest": - // Decoding messageChatJoinByRequest#4740cb7c. - v := MessageChatJoinByRequest{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatDeleteMember": - // Decoding messageChatDeleteMember#37e931a9. - v := MessageChatDeleteMember{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatUpgradeTo": - // Decoding messageChatUpgradeTo#63f549b. - v := MessageChatUpgradeTo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatUpgradeFrom": - // Decoding messageChatUpgradeFrom#136daadc. - v := MessageChatUpgradeFrom{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messagePinMessage": - // Decoding messagePinMessage#38d55039. - v := MessagePinMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageScreenshotTaken": - // Decoding messageScreenshotTaken#a2b86dab. - v := MessageScreenshotTaken{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatSetBackground": - // Decoding messageChatSetBackground#3d5d7c40. - v := MessageChatSetBackground{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatSetTheme": - // Decoding messageChatSetTheme#99ae9408. - v := MessageChatSetTheme{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatSetMessageAutoDeleteTime": - // Decoding messageChatSetMessageAutoDeleteTime#619e052e. - v := MessageChatSetMessageAutoDeleteTime{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatBoost": - // Decoding messageChatBoost#5e5f658b. - v := MessageChatBoost{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageForumTopicCreated": - // Decoding messageForumTopicCreated#b8ce47d1. - v := MessageForumTopicCreated{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageForumTopicEdited": - // Decoding messageForumTopicEdited#c0b780. - v := MessageForumTopicEdited{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageForumTopicIsClosedToggled": - // Decoding messageForumTopicIsClosedToggled#4b578fe0. - v := MessageForumTopicIsClosedToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageForumTopicIsHiddenToggled": - // Decoding messageForumTopicIsHiddenToggled#979393fe. - v := MessageForumTopicIsHiddenToggled{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageSuggestProfilePhoto": - // Decoding messageSuggestProfilePhoto#b5611ee7. - v := MessageSuggestProfilePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageCustomServiceAction": - // Decoding messageCustomServiceAction#5595c772. - v := MessageCustomServiceAction{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageGameScore": - // Decoding messageGameScore#50299d7f. - v := MessageGameScore{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messagePaymentSuccessful": - // Decoding messagePaymentSuccessful#3e661911. - v := MessagePaymentSuccessful{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messagePaymentSuccessfulBot": - // Decoding messagePaymentSuccessfulBot#c7664dbf. - v := MessagePaymentSuccessfulBot{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messagePaymentRefunded": - // Decoding messagePaymentRefunded#11bcb8f3. - v := MessagePaymentRefunded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageGiftedPremium": - // Decoding messageGiftedPremium#e4d0e07a. - v := MessageGiftedPremium{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messagePremiumGiftCode": - // Decoding messagePremiumGiftCode#29d22e4e. - v := MessagePremiumGiftCode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageGiveawayCreated": - // Decoding messageGiveawayCreated#39f3639f. - v := MessageGiveawayCreated{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageGiveaway": - // Decoding messageGiveaway#eb61daa8. - v := MessageGiveaway{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageGiveawayCompleted": - // Decoding messageGiveawayCompleted#e424c8f7. - v := MessageGiveawayCompleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageGiveawayWinners": - // Decoding messageGiveawayWinners#1d99a27a. - v := MessageGiveawayWinners{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageGiftedStars": - // Decoding messageGiftedStars#41bdbea7. - v := MessageGiftedStars{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageGiveawayPrizeStars": - // Decoding messageGiveawayPrizeStars#aa0f5de3. - v := MessageGiveawayPrizeStars{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageGift": - // Decoding messageGift#621a3876. - v := MessageGift{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageUpgradedGift": - // Decoding messageUpgradedGift#4932f215. - v := MessageUpgradedGift{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageRefundedUpgradedGift": - // Decoding messageRefundedUpgradedGift#d373886d. - v := MessageRefundedUpgradedGift{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageContactRegistered": - // Decoding messageContactRegistered#a678fcff. - v := MessageContactRegistered{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageUsersShared": - // Decoding messageUsersShared#7f1f4a22. - v := MessageUsersShared{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageChatShared": - // Decoding messageChatShared#aec6d961. - v := MessageChatShared{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageBotWriteAccessAllowed": - // Decoding messageBotWriteAccessAllowed#9a8ab7b4. - v := MessageBotWriteAccessAllowed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageWebAppDataSent": - // Decoding messageWebAppDataSent#fb033912. - v := MessageWebAppDataSent{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageWebAppDataReceived": - // Decoding messageWebAppDataReceived#ff7d1a15. - v := MessageWebAppDataReceived{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messagePassportDataSent": - // Decoding messagePassportDataSent#26c5ed6b. - v := MessagePassportDataSent{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messagePassportDataReceived": - // Decoding messagePassportDataReceived#e0b936b9. - v := MessagePassportDataReceived{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageProximityAlertTriggered": - // Decoding messageProximityAlertTriggered#409f6d3. - v := MessageProximityAlertTriggered{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - case "messageUnsupported": - // Decoding messageUnsupported#93b6f585. - v := MessageUnsupported{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageContentClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageContent boxes the MessageContentClass providing a helper. -type MessageContentBox struct { - MessageContent MessageContentClass -} - -// Decode implements bin.Decoder for MessageContentBox. -func (b *MessageContentBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageContentBox to nil") - } - v, err := DecodeMessageContent(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageContent = v - return nil -} - -// Encode implements bin.Encode for MessageContentBox. -func (b *MessageContentBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageContent == nil { - return fmt.Errorf("unable to encode MessageContentClass as nil") - } - return b.MessageContent.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageContentBox. -func (b *MessageContentBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageContentBox to nil") - } - v, err := DecodeTDLibJSONMessageContent(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageContent = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageContentBox. -func (b *MessageContentBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageContent == nil { - return fmt.Errorf("unable to encode MessageContentClass as nil") - } - return b.MessageContent.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_message_copy_options_gen.go b/tdapi/tl_message_copy_options_gen.go deleted file mode 100644 index 12456318a..000000000 --- a/tdapi/tl_message_copy_options_gen.go +++ /dev/null @@ -1,300 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageCopyOptions represents TL type `messageCopyOptions#405c03ba`. -type MessageCopyOptions struct { - // True, if content of the message needs to be copied without reference to the original - // sender. Always true if the message is forwarded to a secret chat or is local. - SendCopy bool - // True, if media caption of the message copy needs to be replaced. Ignored if send_copy - // is false - ReplaceCaption bool - // New message caption; pass null to copy message without caption. Ignored if - // replace_caption is false - NewCaption FormattedText - // True, if new caption must be shown above the media; otherwise, new caption must be - // shown below the media; not supported in secret chats. Ignored if replace_caption is - // false - NewShowCaptionAboveMedia bool -} - -// MessageCopyOptionsTypeID is TL type id of MessageCopyOptions. -const MessageCopyOptionsTypeID = 0x405c03ba - -// Ensuring interfaces in compile-time for MessageCopyOptions. -var ( - _ bin.Encoder = &MessageCopyOptions{} - _ bin.Decoder = &MessageCopyOptions{} - _ bin.BareEncoder = &MessageCopyOptions{} - _ bin.BareDecoder = &MessageCopyOptions{} -) - -func (m *MessageCopyOptions) Zero() bool { - if m == nil { - return true - } - if !(m.SendCopy == false) { - return false - } - if !(m.ReplaceCaption == false) { - return false - } - if !(m.NewCaption.Zero()) { - return false - } - if !(m.NewShowCaptionAboveMedia == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageCopyOptions) String() string { - if m == nil { - return "MessageCopyOptions(nil)" - } - type Alias MessageCopyOptions - return fmt.Sprintf("MessageCopyOptions%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageCopyOptions) TypeID() uint32 { - return MessageCopyOptionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageCopyOptions) TypeName() string { - return "messageCopyOptions" -} - -// TypeInfo returns info about TL type. -func (m *MessageCopyOptions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageCopyOptions", - ID: MessageCopyOptionsTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SendCopy", - SchemaName: "send_copy", - }, - { - Name: "ReplaceCaption", - SchemaName: "replace_caption", - }, - { - Name: "NewCaption", - SchemaName: "new_caption", - }, - { - Name: "NewShowCaptionAboveMedia", - SchemaName: "new_show_caption_above_media", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageCopyOptions) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageCopyOptions#405c03ba as nil") - } - b.PutID(MessageCopyOptionsTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageCopyOptions) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageCopyOptions#405c03ba as nil") - } - b.PutBool(m.SendCopy) - b.PutBool(m.ReplaceCaption) - if err := m.NewCaption.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageCopyOptions#405c03ba: field new_caption: %w", err) - } - b.PutBool(m.NewShowCaptionAboveMedia) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageCopyOptions) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageCopyOptions#405c03ba to nil") - } - if err := b.ConsumeID(MessageCopyOptionsTypeID); err != nil { - return fmt.Errorf("unable to decode messageCopyOptions#405c03ba: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageCopyOptions) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageCopyOptions#405c03ba to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageCopyOptions#405c03ba: field send_copy: %w", err) - } - m.SendCopy = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageCopyOptions#405c03ba: field replace_caption: %w", err) - } - m.ReplaceCaption = value - } - { - if err := m.NewCaption.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageCopyOptions#405c03ba: field new_caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageCopyOptions#405c03ba: field new_show_caption_above_media: %w", err) - } - m.NewShowCaptionAboveMedia = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageCopyOptions) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageCopyOptions#405c03ba as nil") - } - b.ObjStart() - b.PutID("messageCopyOptions") - b.Comma() - b.FieldStart("send_copy") - b.PutBool(m.SendCopy) - b.Comma() - b.FieldStart("replace_caption") - b.PutBool(m.ReplaceCaption) - b.Comma() - b.FieldStart("new_caption") - if err := m.NewCaption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageCopyOptions#405c03ba: field new_caption: %w", err) - } - b.Comma() - b.FieldStart("new_show_caption_above_media") - b.PutBool(m.NewShowCaptionAboveMedia) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageCopyOptions) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageCopyOptions#405c03ba to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageCopyOptions"); err != nil { - return fmt.Errorf("unable to decode messageCopyOptions#405c03ba: %w", err) - } - case "send_copy": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageCopyOptions#405c03ba: field send_copy: %w", err) - } - m.SendCopy = value - case "replace_caption": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageCopyOptions#405c03ba: field replace_caption: %w", err) - } - m.ReplaceCaption = value - case "new_caption": - if err := m.NewCaption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageCopyOptions#405c03ba: field new_caption: %w", err) - } - case "new_show_caption_above_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageCopyOptions#405c03ba: field new_show_caption_above_media: %w", err) - } - m.NewShowCaptionAboveMedia = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSendCopy returns value of SendCopy field. -func (m *MessageCopyOptions) GetSendCopy() (value bool) { - if m == nil { - return - } - return m.SendCopy -} - -// GetReplaceCaption returns value of ReplaceCaption field. -func (m *MessageCopyOptions) GetReplaceCaption() (value bool) { - if m == nil { - return - } - return m.ReplaceCaption -} - -// GetNewCaption returns value of NewCaption field. -func (m *MessageCopyOptions) GetNewCaption() (value FormattedText) { - if m == nil { - return - } - return m.NewCaption -} - -// GetNewShowCaptionAboveMedia returns value of NewShowCaptionAboveMedia field. -func (m *MessageCopyOptions) GetNewShowCaptionAboveMedia() (value bool) { - if m == nil { - return - } - return m.NewShowCaptionAboveMedia -} diff --git a/tdapi/tl_message_effect_gen.go b/tdapi/tl_message_effect_gen.go deleted file mode 100644 index 6f6196a44..000000000 --- a/tdapi/tl_message_effect_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageEffect represents TL type `messageEffect#972a492f`. -type MessageEffect struct { - // Unique identifier of the effect - ID int64 - // Static icon for the effect in WEBP format; may be null if none - StaticIcon Sticker - // Emoji corresponding to the effect that can be used if static icon isn't available - Emoji string - // True, if Telegram Premium subscription is required to use the effect - IsPremium bool - // Type of the effect - Type MessageEffectTypeClass -} - -// MessageEffectTypeID is TL type id of MessageEffect. -const MessageEffectTypeID = 0x972a492f - -// Ensuring interfaces in compile-time for MessageEffect. -var ( - _ bin.Encoder = &MessageEffect{} - _ bin.Decoder = &MessageEffect{} - _ bin.BareEncoder = &MessageEffect{} - _ bin.BareDecoder = &MessageEffect{} -) - -func (m *MessageEffect) Zero() bool { - if m == nil { - return true - } - if !(m.ID == 0) { - return false - } - if !(m.StaticIcon.Zero()) { - return false - } - if !(m.Emoji == "") { - return false - } - if !(m.IsPremium == false) { - return false - } - if !(m.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageEffect) String() string { - if m == nil { - return "MessageEffect(nil)" - } - type Alias MessageEffect - return fmt.Sprintf("MessageEffect%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageEffect) TypeID() uint32 { - return MessageEffectTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageEffect) TypeName() string { - return "messageEffect" -} - -// TypeInfo returns info about TL type. -func (m *MessageEffect) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageEffect", - ID: MessageEffectTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "StaticIcon", - SchemaName: "static_icon", - }, - { - Name: "Emoji", - SchemaName: "emoji", - }, - { - Name: "IsPremium", - SchemaName: "is_premium", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageEffect) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageEffect#972a492f as nil") - } - b.PutID(MessageEffectTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageEffect) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageEffect#972a492f as nil") - } - b.PutLong(m.ID) - if err := m.StaticIcon.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageEffect#972a492f: field static_icon: %w", err) - } - b.PutString(m.Emoji) - b.PutBool(m.IsPremium) - if m.Type == nil { - return fmt.Errorf("unable to encode messageEffect#972a492f: field type is nil") - } - if err := m.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageEffect#972a492f: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageEffect) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageEffect#972a492f to nil") - } - if err := b.ConsumeID(MessageEffectTypeID); err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageEffect) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageEffect#972a492f to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: field id: %w", err) - } - m.ID = value - } - { - if err := m.StaticIcon.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: field static_icon: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: field emoji: %w", err) - } - m.Emoji = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: field is_premium: %w", err) - } - m.IsPremium = value - } - { - value, err := DecodeMessageEffectType(b) - if err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: field type: %w", err) - } - m.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageEffect) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageEffect#972a492f as nil") - } - b.ObjStart() - b.PutID("messageEffect") - b.Comma() - b.FieldStart("id") - b.PutLong(m.ID) - b.Comma() - b.FieldStart("static_icon") - if err := m.StaticIcon.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageEffect#972a492f: field static_icon: %w", err) - } - b.Comma() - b.FieldStart("emoji") - b.PutString(m.Emoji) - b.Comma() - b.FieldStart("is_premium") - b.PutBool(m.IsPremium) - b.Comma() - b.FieldStart("type") - if m.Type == nil { - return fmt.Errorf("unable to encode messageEffect#972a492f: field type is nil") - } - if err := m.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageEffect#972a492f: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageEffect) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageEffect#972a492f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageEffect"); err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: field id: %w", err) - } - m.ID = value - case "static_icon": - if err := m.StaticIcon.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: field static_icon: %w", err) - } - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: field emoji: %w", err) - } - m.Emoji = value - case "is_premium": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: field is_premium: %w", err) - } - m.IsPremium = value - case "type": - value, err := DecodeTDLibJSONMessageEffectType(b) - if err != nil { - return fmt.Errorf("unable to decode messageEffect#972a492f: field type: %w", err) - } - m.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (m *MessageEffect) GetID() (value int64) { - if m == nil { - return - } - return m.ID -} - -// GetStaticIcon returns value of StaticIcon field. -func (m *MessageEffect) GetStaticIcon() (value Sticker) { - if m == nil { - return - } - return m.StaticIcon -} - -// GetEmoji returns value of Emoji field. -func (m *MessageEffect) GetEmoji() (value string) { - if m == nil { - return - } - return m.Emoji -} - -// GetIsPremium returns value of IsPremium field. -func (m *MessageEffect) GetIsPremium() (value bool) { - if m == nil { - return - } - return m.IsPremium -} - -// GetType returns value of Type field. -func (m *MessageEffect) GetType() (value MessageEffectTypeClass) { - if m == nil { - return - } - return m.Type -} diff --git a/tdapi/tl_message_effect_type_gen.go b/tdapi/tl_message_effect_type_gen.go deleted file mode 100644 index 458cdc65b..000000000 --- a/tdapi/tl_message_effect_type_gen.go +++ /dev/null @@ -1,535 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageEffectTypeEmojiReaction represents TL type `messageEffectTypeEmojiReaction#68aba63e`. -type MessageEffectTypeEmojiReaction struct { - // Select animation for the effect in TGS format - SelectAnimation Sticker - // Effect animation for the effect in TGS format - EffectAnimation Sticker -} - -// MessageEffectTypeEmojiReactionTypeID is TL type id of MessageEffectTypeEmojiReaction. -const MessageEffectTypeEmojiReactionTypeID = 0x68aba63e - -// construct implements constructor of MessageEffectTypeClass. -func (m MessageEffectTypeEmojiReaction) construct() MessageEffectTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageEffectTypeEmojiReaction. -var ( - _ bin.Encoder = &MessageEffectTypeEmojiReaction{} - _ bin.Decoder = &MessageEffectTypeEmojiReaction{} - _ bin.BareEncoder = &MessageEffectTypeEmojiReaction{} - _ bin.BareDecoder = &MessageEffectTypeEmojiReaction{} - - _ MessageEffectTypeClass = &MessageEffectTypeEmojiReaction{} -) - -func (m *MessageEffectTypeEmojiReaction) Zero() bool { - if m == nil { - return true - } - if !(m.SelectAnimation.Zero()) { - return false - } - if !(m.EffectAnimation.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageEffectTypeEmojiReaction) String() string { - if m == nil { - return "MessageEffectTypeEmojiReaction(nil)" - } - type Alias MessageEffectTypeEmojiReaction - return fmt.Sprintf("MessageEffectTypeEmojiReaction%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageEffectTypeEmojiReaction) TypeID() uint32 { - return MessageEffectTypeEmojiReactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageEffectTypeEmojiReaction) TypeName() string { - return "messageEffectTypeEmojiReaction" -} - -// TypeInfo returns info about TL type. -func (m *MessageEffectTypeEmojiReaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageEffectTypeEmojiReaction", - ID: MessageEffectTypeEmojiReactionTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SelectAnimation", - SchemaName: "select_animation", - }, - { - Name: "EffectAnimation", - SchemaName: "effect_animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageEffectTypeEmojiReaction) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageEffectTypeEmojiReaction#68aba63e as nil") - } - b.PutID(MessageEffectTypeEmojiReactionTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageEffectTypeEmojiReaction) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageEffectTypeEmojiReaction#68aba63e as nil") - } - if err := m.SelectAnimation.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageEffectTypeEmojiReaction#68aba63e: field select_animation: %w", err) - } - if err := m.EffectAnimation.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageEffectTypeEmojiReaction#68aba63e: field effect_animation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageEffectTypeEmojiReaction) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageEffectTypeEmojiReaction#68aba63e to nil") - } - if err := b.ConsumeID(MessageEffectTypeEmojiReactionTypeID); err != nil { - return fmt.Errorf("unable to decode messageEffectTypeEmojiReaction#68aba63e: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageEffectTypeEmojiReaction) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageEffectTypeEmojiReaction#68aba63e to nil") - } - { - if err := m.SelectAnimation.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageEffectTypeEmojiReaction#68aba63e: field select_animation: %w", err) - } - } - { - if err := m.EffectAnimation.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageEffectTypeEmojiReaction#68aba63e: field effect_animation: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageEffectTypeEmojiReaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageEffectTypeEmojiReaction#68aba63e as nil") - } - b.ObjStart() - b.PutID("messageEffectTypeEmojiReaction") - b.Comma() - b.FieldStart("select_animation") - if err := m.SelectAnimation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageEffectTypeEmojiReaction#68aba63e: field select_animation: %w", err) - } - b.Comma() - b.FieldStart("effect_animation") - if err := m.EffectAnimation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageEffectTypeEmojiReaction#68aba63e: field effect_animation: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageEffectTypeEmojiReaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageEffectTypeEmojiReaction#68aba63e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageEffectTypeEmojiReaction"); err != nil { - return fmt.Errorf("unable to decode messageEffectTypeEmojiReaction#68aba63e: %w", err) - } - case "select_animation": - if err := m.SelectAnimation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageEffectTypeEmojiReaction#68aba63e: field select_animation: %w", err) - } - case "effect_animation": - if err := m.EffectAnimation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageEffectTypeEmojiReaction#68aba63e: field effect_animation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSelectAnimation returns value of SelectAnimation field. -func (m *MessageEffectTypeEmojiReaction) GetSelectAnimation() (value Sticker) { - if m == nil { - return - } - return m.SelectAnimation -} - -// GetEffectAnimation returns value of EffectAnimation field. -func (m *MessageEffectTypeEmojiReaction) GetEffectAnimation() (value Sticker) { - if m == nil { - return - } - return m.EffectAnimation -} - -// MessageEffectTypePremiumSticker represents TL type `messageEffectTypePremiumSticker#61962bf9`. -type MessageEffectTypePremiumSticker struct { - // The premium sticker. The effect can be found at sticker.full_type.premium_animation - Sticker Sticker -} - -// MessageEffectTypePremiumStickerTypeID is TL type id of MessageEffectTypePremiumSticker. -const MessageEffectTypePremiumStickerTypeID = 0x61962bf9 - -// construct implements constructor of MessageEffectTypeClass. -func (m MessageEffectTypePremiumSticker) construct() MessageEffectTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageEffectTypePremiumSticker. -var ( - _ bin.Encoder = &MessageEffectTypePremiumSticker{} - _ bin.Decoder = &MessageEffectTypePremiumSticker{} - _ bin.BareEncoder = &MessageEffectTypePremiumSticker{} - _ bin.BareDecoder = &MessageEffectTypePremiumSticker{} - - _ MessageEffectTypeClass = &MessageEffectTypePremiumSticker{} -) - -func (m *MessageEffectTypePremiumSticker) Zero() bool { - if m == nil { - return true - } - if !(m.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageEffectTypePremiumSticker) String() string { - if m == nil { - return "MessageEffectTypePremiumSticker(nil)" - } - type Alias MessageEffectTypePremiumSticker - return fmt.Sprintf("MessageEffectTypePremiumSticker%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageEffectTypePremiumSticker) TypeID() uint32 { - return MessageEffectTypePremiumStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageEffectTypePremiumSticker) TypeName() string { - return "messageEffectTypePremiumSticker" -} - -// TypeInfo returns info about TL type. -func (m *MessageEffectTypePremiumSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageEffectTypePremiumSticker", - ID: MessageEffectTypePremiumStickerTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageEffectTypePremiumSticker) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageEffectTypePremiumSticker#61962bf9 as nil") - } - b.PutID(MessageEffectTypePremiumStickerTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageEffectTypePremiumSticker) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageEffectTypePremiumSticker#61962bf9 as nil") - } - if err := m.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageEffectTypePremiumSticker#61962bf9: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageEffectTypePremiumSticker) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageEffectTypePremiumSticker#61962bf9 to nil") - } - if err := b.ConsumeID(MessageEffectTypePremiumStickerTypeID); err != nil { - return fmt.Errorf("unable to decode messageEffectTypePremiumSticker#61962bf9: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageEffectTypePremiumSticker) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageEffectTypePremiumSticker#61962bf9 to nil") - } - { - if err := m.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageEffectTypePremiumSticker#61962bf9: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageEffectTypePremiumSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageEffectTypePremiumSticker#61962bf9 as nil") - } - b.ObjStart() - b.PutID("messageEffectTypePremiumSticker") - b.Comma() - b.FieldStart("sticker") - if err := m.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageEffectTypePremiumSticker#61962bf9: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageEffectTypePremiumSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageEffectTypePremiumSticker#61962bf9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageEffectTypePremiumSticker"); err != nil { - return fmt.Errorf("unable to decode messageEffectTypePremiumSticker#61962bf9: %w", err) - } - case "sticker": - if err := m.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageEffectTypePremiumSticker#61962bf9: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (m *MessageEffectTypePremiumSticker) GetSticker() (value Sticker) { - if m == nil { - return - } - return m.Sticker -} - -// MessageEffectTypeClassName is schema name of MessageEffectTypeClass. -const MessageEffectTypeClassName = "MessageEffectType" - -// MessageEffectTypeClass represents MessageEffectType generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageEffectType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageEffectTypeEmojiReaction: // messageEffectTypeEmojiReaction#68aba63e -// case *tdapi.MessageEffectTypePremiumSticker: // messageEffectTypePremiumSticker#61962bf9 -// default: panic(v) -// } -type MessageEffectTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageEffectTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMessageEffectType implements binary de-serialization for MessageEffectTypeClass. -func DecodeMessageEffectType(buf *bin.Buffer) (MessageEffectTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageEffectTypeEmojiReactionTypeID: - // Decoding messageEffectTypeEmojiReaction#68aba63e. - v := MessageEffectTypeEmojiReaction{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageEffectTypeClass: %w", err) - } - return &v, nil - case MessageEffectTypePremiumStickerTypeID: - // Decoding messageEffectTypePremiumSticker#61962bf9. - v := MessageEffectTypePremiumSticker{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageEffectTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageEffectTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageEffectType implements binary de-serialization for MessageEffectTypeClass. -func DecodeTDLibJSONMessageEffectType(buf tdjson.Decoder) (MessageEffectTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageEffectTypeEmojiReaction": - // Decoding messageEffectTypeEmojiReaction#68aba63e. - v := MessageEffectTypeEmojiReaction{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageEffectTypeClass: %w", err) - } - return &v, nil - case "messageEffectTypePremiumSticker": - // Decoding messageEffectTypePremiumSticker#61962bf9. - v := MessageEffectTypePremiumSticker{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageEffectTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageEffectTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageEffectType boxes the MessageEffectTypeClass providing a helper. -type MessageEffectTypeBox struct { - MessageEffectType MessageEffectTypeClass -} - -// Decode implements bin.Decoder for MessageEffectTypeBox. -func (b *MessageEffectTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageEffectTypeBox to nil") - } - v, err := DecodeMessageEffectType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageEffectType = v - return nil -} - -// Encode implements bin.Encode for MessageEffectTypeBox. -func (b *MessageEffectTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageEffectType == nil { - return fmt.Errorf("unable to encode MessageEffectTypeClass as nil") - } - return b.MessageEffectType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageEffectTypeBox. -func (b *MessageEffectTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageEffectTypeBox to nil") - } - v, err := DecodeTDLibJSONMessageEffectType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageEffectType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageEffectTypeBox. -func (b *MessageEffectTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageEffectType == nil { - return fmt.Errorf("unable to encode MessageEffectTypeClass as nil") - } - return b.MessageEffectType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_message_file_type_gen.go b/tdapi/tl_message_file_type_gen.go deleted file mode 100644 index 4183b5045..000000000 --- a/tdapi/tl_message_file_type_gen.go +++ /dev/null @@ -1,647 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageFileTypePrivate represents TL type `messageFileTypePrivate#e0e44ed4`. -type MessageFileTypePrivate struct { - // Name of the other party; may be empty if unrecognized - Name string -} - -// MessageFileTypePrivateTypeID is TL type id of MessageFileTypePrivate. -const MessageFileTypePrivateTypeID = 0xe0e44ed4 - -// construct implements constructor of MessageFileTypeClass. -func (m MessageFileTypePrivate) construct() MessageFileTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageFileTypePrivate. -var ( - _ bin.Encoder = &MessageFileTypePrivate{} - _ bin.Decoder = &MessageFileTypePrivate{} - _ bin.BareEncoder = &MessageFileTypePrivate{} - _ bin.BareDecoder = &MessageFileTypePrivate{} - - _ MessageFileTypeClass = &MessageFileTypePrivate{} -) - -func (m *MessageFileTypePrivate) Zero() bool { - if m == nil { - return true - } - if !(m.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageFileTypePrivate) String() string { - if m == nil { - return "MessageFileTypePrivate(nil)" - } - type Alias MessageFileTypePrivate - return fmt.Sprintf("MessageFileTypePrivate%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageFileTypePrivate) TypeID() uint32 { - return MessageFileTypePrivateTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageFileTypePrivate) TypeName() string { - return "messageFileTypePrivate" -} - -// TypeInfo returns info about TL type. -func (m *MessageFileTypePrivate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageFileTypePrivate", - ID: MessageFileTypePrivateTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageFileTypePrivate) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageFileTypePrivate#e0e44ed4 as nil") - } - b.PutID(MessageFileTypePrivateTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageFileTypePrivate) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageFileTypePrivate#e0e44ed4 as nil") - } - b.PutString(m.Name) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageFileTypePrivate) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageFileTypePrivate#e0e44ed4 to nil") - } - if err := b.ConsumeID(MessageFileTypePrivateTypeID); err != nil { - return fmt.Errorf("unable to decode messageFileTypePrivate#e0e44ed4: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageFileTypePrivate) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageFileTypePrivate#e0e44ed4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageFileTypePrivate#e0e44ed4: field name: %w", err) - } - m.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageFileTypePrivate) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageFileTypePrivate#e0e44ed4 as nil") - } - b.ObjStart() - b.PutID("messageFileTypePrivate") - b.Comma() - b.FieldStart("name") - b.PutString(m.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageFileTypePrivate) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageFileTypePrivate#e0e44ed4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageFileTypePrivate"); err != nil { - return fmt.Errorf("unable to decode messageFileTypePrivate#e0e44ed4: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageFileTypePrivate#e0e44ed4: field name: %w", err) - } - m.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (m *MessageFileTypePrivate) GetName() (value string) { - if m == nil { - return - } - return m.Name -} - -// MessageFileTypeGroup represents TL type `messageFileTypeGroup#f2e58f68`. -type MessageFileTypeGroup struct { - // Title of the group chat; may be empty if unrecognized - Title string -} - -// MessageFileTypeGroupTypeID is TL type id of MessageFileTypeGroup. -const MessageFileTypeGroupTypeID = 0xf2e58f68 - -// construct implements constructor of MessageFileTypeClass. -func (m MessageFileTypeGroup) construct() MessageFileTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageFileTypeGroup. -var ( - _ bin.Encoder = &MessageFileTypeGroup{} - _ bin.Decoder = &MessageFileTypeGroup{} - _ bin.BareEncoder = &MessageFileTypeGroup{} - _ bin.BareDecoder = &MessageFileTypeGroup{} - - _ MessageFileTypeClass = &MessageFileTypeGroup{} -) - -func (m *MessageFileTypeGroup) Zero() bool { - if m == nil { - return true - } - if !(m.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageFileTypeGroup) String() string { - if m == nil { - return "MessageFileTypeGroup(nil)" - } - type Alias MessageFileTypeGroup - return fmt.Sprintf("MessageFileTypeGroup%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageFileTypeGroup) TypeID() uint32 { - return MessageFileTypeGroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageFileTypeGroup) TypeName() string { - return "messageFileTypeGroup" -} - -// TypeInfo returns info about TL type. -func (m *MessageFileTypeGroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageFileTypeGroup", - ID: MessageFileTypeGroupTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageFileTypeGroup) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageFileTypeGroup#f2e58f68 as nil") - } - b.PutID(MessageFileTypeGroupTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageFileTypeGroup) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageFileTypeGroup#f2e58f68 as nil") - } - b.PutString(m.Title) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageFileTypeGroup) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageFileTypeGroup#f2e58f68 to nil") - } - if err := b.ConsumeID(MessageFileTypeGroupTypeID); err != nil { - return fmt.Errorf("unable to decode messageFileTypeGroup#f2e58f68: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageFileTypeGroup) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageFileTypeGroup#f2e58f68 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageFileTypeGroup#f2e58f68: field title: %w", err) - } - m.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageFileTypeGroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageFileTypeGroup#f2e58f68 as nil") - } - b.ObjStart() - b.PutID("messageFileTypeGroup") - b.Comma() - b.FieldStart("title") - b.PutString(m.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageFileTypeGroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageFileTypeGroup#f2e58f68 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageFileTypeGroup"); err != nil { - return fmt.Errorf("unable to decode messageFileTypeGroup#f2e58f68: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageFileTypeGroup#f2e58f68: field title: %w", err) - } - m.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (m *MessageFileTypeGroup) GetTitle() (value string) { - if m == nil { - return - } - return m.Title -} - -// MessageFileTypeUnknown represents TL type `messageFileTypeUnknown#461dbab2`. -type MessageFileTypeUnknown struct { -} - -// MessageFileTypeUnknownTypeID is TL type id of MessageFileTypeUnknown. -const MessageFileTypeUnknownTypeID = 0x461dbab2 - -// construct implements constructor of MessageFileTypeClass. -func (m MessageFileTypeUnknown) construct() MessageFileTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageFileTypeUnknown. -var ( - _ bin.Encoder = &MessageFileTypeUnknown{} - _ bin.Decoder = &MessageFileTypeUnknown{} - _ bin.BareEncoder = &MessageFileTypeUnknown{} - _ bin.BareDecoder = &MessageFileTypeUnknown{} - - _ MessageFileTypeClass = &MessageFileTypeUnknown{} -) - -func (m *MessageFileTypeUnknown) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageFileTypeUnknown) String() string { - if m == nil { - return "MessageFileTypeUnknown(nil)" - } - type Alias MessageFileTypeUnknown - return fmt.Sprintf("MessageFileTypeUnknown%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageFileTypeUnknown) TypeID() uint32 { - return MessageFileTypeUnknownTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageFileTypeUnknown) TypeName() string { - return "messageFileTypeUnknown" -} - -// TypeInfo returns info about TL type. -func (m *MessageFileTypeUnknown) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageFileTypeUnknown", - ID: MessageFileTypeUnknownTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageFileTypeUnknown) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageFileTypeUnknown#461dbab2 as nil") - } - b.PutID(MessageFileTypeUnknownTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageFileTypeUnknown) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageFileTypeUnknown#461dbab2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageFileTypeUnknown) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageFileTypeUnknown#461dbab2 to nil") - } - if err := b.ConsumeID(MessageFileTypeUnknownTypeID); err != nil { - return fmt.Errorf("unable to decode messageFileTypeUnknown#461dbab2: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageFileTypeUnknown) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageFileTypeUnknown#461dbab2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageFileTypeUnknown) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageFileTypeUnknown#461dbab2 as nil") - } - b.ObjStart() - b.PutID("messageFileTypeUnknown") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageFileTypeUnknown) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageFileTypeUnknown#461dbab2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageFileTypeUnknown"); err != nil { - return fmt.Errorf("unable to decode messageFileTypeUnknown#461dbab2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageFileTypeClassName is schema name of MessageFileTypeClass. -const MessageFileTypeClassName = "MessageFileType" - -// MessageFileTypeClass represents MessageFileType generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageFileType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageFileTypePrivate: // messageFileTypePrivate#e0e44ed4 -// case *tdapi.MessageFileTypeGroup: // messageFileTypeGroup#f2e58f68 -// case *tdapi.MessageFileTypeUnknown: // messageFileTypeUnknown#461dbab2 -// default: panic(v) -// } -type MessageFileTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageFileTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMessageFileType implements binary de-serialization for MessageFileTypeClass. -func DecodeMessageFileType(buf *bin.Buffer) (MessageFileTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageFileTypePrivateTypeID: - // Decoding messageFileTypePrivate#e0e44ed4. - v := MessageFileTypePrivate{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageFileTypeClass: %w", err) - } - return &v, nil - case MessageFileTypeGroupTypeID: - // Decoding messageFileTypeGroup#f2e58f68. - v := MessageFileTypeGroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageFileTypeClass: %w", err) - } - return &v, nil - case MessageFileTypeUnknownTypeID: - // Decoding messageFileTypeUnknown#461dbab2. - v := MessageFileTypeUnknown{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageFileTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageFileTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageFileType implements binary de-serialization for MessageFileTypeClass. -func DecodeTDLibJSONMessageFileType(buf tdjson.Decoder) (MessageFileTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageFileTypePrivate": - // Decoding messageFileTypePrivate#e0e44ed4. - v := MessageFileTypePrivate{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageFileTypeClass: %w", err) - } - return &v, nil - case "messageFileTypeGroup": - // Decoding messageFileTypeGroup#f2e58f68. - v := MessageFileTypeGroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageFileTypeClass: %w", err) - } - return &v, nil - case "messageFileTypeUnknown": - // Decoding messageFileTypeUnknown#461dbab2. - v := MessageFileTypeUnknown{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageFileTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageFileTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageFileType boxes the MessageFileTypeClass providing a helper. -type MessageFileTypeBox struct { - MessageFileType MessageFileTypeClass -} - -// Decode implements bin.Decoder for MessageFileTypeBox. -func (b *MessageFileTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageFileTypeBox to nil") - } - v, err := DecodeMessageFileType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageFileType = v - return nil -} - -// Encode implements bin.Encode for MessageFileTypeBox. -func (b *MessageFileTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageFileType == nil { - return fmt.Errorf("unable to encode MessageFileTypeClass as nil") - } - return b.MessageFileType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageFileTypeBox. -func (b *MessageFileTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageFileTypeBox to nil") - } - v, err := DecodeTDLibJSONMessageFileType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageFileType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageFileTypeBox. -func (b *MessageFileTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageFileType == nil { - return fmt.Errorf("unable to encode MessageFileTypeClass as nil") - } - return b.MessageFileType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_message_forward_info_gen.go b/tdapi/tl_message_forward_info_gen.go deleted file mode 100644 index d54ab4853..000000000 --- a/tdapi/tl_message_forward_info_gen.go +++ /dev/null @@ -1,308 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageForwardInfo represents TL type `messageForwardInfo#cb877b7d`. -type MessageForwardInfo struct { - // Origin of the forwarded message - Origin MessageOriginClass - // Point in time (Unix timestamp) when the message was originally sent - Date int32 - // For messages forwarded to the chat with the current user (Saved Messages), to the - // Replies bot chat, or to the channel's discussion group, information about the source - // message from which the message was forwarded last time; may be null for other forwards - // or if unknown - Source ForwardSource - // The type of public service announcement for the forwarded message - PublicServiceAnnouncementType string -} - -// MessageForwardInfoTypeID is TL type id of MessageForwardInfo. -const MessageForwardInfoTypeID = 0xcb877b7d - -// Ensuring interfaces in compile-time for MessageForwardInfo. -var ( - _ bin.Encoder = &MessageForwardInfo{} - _ bin.Decoder = &MessageForwardInfo{} - _ bin.BareEncoder = &MessageForwardInfo{} - _ bin.BareDecoder = &MessageForwardInfo{} -) - -func (m *MessageForwardInfo) Zero() bool { - if m == nil { - return true - } - if !(m.Origin == nil) { - return false - } - if !(m.Date == 0) { - return false - } - if !(m.Source.Zero()) { - return false - } - if !(m.PublicServiceAnnouncementType == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageForwardInfo) String() string { - if m == nil { - return "MessageForwardInfo(nil)" - } - type Alias MessageForwardInfo - return fmt.Sprintf("MessageForwardInfo%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageForwardInfo) TypeID() uint32 { - return MessageForwardInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageForwardInfo) TypeName() string { - return "messageForwardInfo" -} - -// TypeInfo returns info about TL type. -func (m *MessageForwardInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageForwardInfo", - ID: MessageForwardInfoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Origin", - SchemaName: "origin", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "Source", - SchemaName: "source", - }, - { - Name: "PublicServiceAnnouncementType", - SchemaName: "public_service_announcement_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageForwardInfo) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForwardInfo#cb877b7d as nil") - } - b.PutID(MessageForwardInfoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageForwardInfo) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageForwardInfo#cb877b7d as nil") - } - if m.Origin == nil { - return fmt.Errorf("unable to encode messageForwardInfo#cb877b7d: field origin is nil") - } - if err := m.Origin.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageForwardInfo#cb877b7d: field origin: %w", err) - } - b.PutInt32(m.Date) - if err := m.Source.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageForwardInfo#cb877b7d: field source: %w", err) - } - b.PutString(m.PublicServiceAnnouncementType) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageForwardInfo) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForwardInfo#cb877b7d to nil") - } - if err := b.ConsumeID(MessageForwardInfoTypeID); err != nil { - return fmt.Errorf("unable to decode messageForwardInfo#cb877b7d: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageForwardInfo) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageForwardInfo#cb877b7d to nil") - } - { - value, err := DecodeMessageOrigin(b) - if err != nil { - return fmt.Errorf("unable to decode messageForwardInfo#cb877b7d: field origin: %w", err) - } - m.Origin = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageForwardInfo#cb877b7d: field date: %w", err) - } - m.Date = value - } - { - if err := m.Source.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageForwardInfo#cb877b7d: field source: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageForwardInfo#cb877b7d: field public_service_announcement_type: %w", err) - } - m.PublicServiceAnnouncementType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageForwardInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageForwardInfo#cb877b7d as nil") - } - b.ObjStart() - b.PutID("messageForwardInfo") - b.Comma() - b.FieldStart("origin") - if m.Origin == nil { - return fmt.Errorf("unable to encode messageForwardInfo#cb877b7d: field origin is nil") - } - if err := m.Origin.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageForwardInfo#cb877b7d: field origin: %w", err) - } - b.Comma() - b.FieldStart("date") - b.PutInt32(m.Date) - b.Comma() - b.FieldStart("source") - if err := m.Source.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageForwardInfo#cb877b7d: field source: %w", err) - } - b.Comma() - b.FieldStart("public_service_announcement_type") - b.PutString(m.PublicServiceAnnouncementType) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageForwardInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageForwardInfo#cb877b7d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageForwardInfo"); err != nil { - return fmt.Errorf("unable to decode messageForwardInfo#cb877b7d: %w", err) - } - case "origin": - value, err := DecodeTDLibJSONMessageOrigin(b) - if err != nil { - return fmt.Errorf("unable to decode messageForwardInfo#cb877b7d: field origin: %w", err) - } - m.Origin = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageForwardInfo#cb877b7d: field date: %w", err) - } - m.Date = value - case "source": - if err := m.Source.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageForwardInfo#cb877b7d: field source: %w", err) - } - case "public_service_announcement_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageForwardInfo#cb877b7d: field public_service_announcement_type: %w", err) - } - m.PublicServiceAnnouncementType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOrigin returns value of Origin field. -func (m *MessageForwardInfo) GetOrigin() (value MessageOriginClass) { - if m == nil { - return - } - return m.Origin -} - -// GetDate returns value of Date field. -func (m *MessageForwardInfo) GetDate() (value int32) { - if m == nil { - return - } - return m.Date -} - -// GetSource returns value of Source field. -func (m *MessageForwardInfo) GetSource() (value ForwardSource) { - if m == nil { - return - } - return m.Source -} - -// GetPublicServiceAnnouncementType returns value of PublicServiceAnnouncementType field. -func (m *MessageForwardInfo) GetPublicServiceAnnouncementType() (value string) { - if m == nil { - return - } - return m.PublicServiceAnnouncementType -} diff --git a/tdapi/tl_message_gen.go b/tdapi/tl_message_gen.go deleted file mode 100644 index 908e24b22..000000000 --- a/tdapi/tl_message_gen.go +++ /dev/null @@ -1,1497 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Message represents TL type `message#a9c04bbc`. -type Message struct { - // Message identifier; unique for the chat to which the message belongs - ID int64 - // Identifier of the sender of the message - SenderID MessageSenderClass - // Chat identifier - ChatID int64 - // The sending state of the message; may be null if the message isn't being sent and - // didn't fail to be sent - SendingState MessageSendingStateClass - // The scheduling state of the message; may be null if the message isn't scheduled - SchedulingState MessageSchedulingStateClass - // True, if the message is outgoing - IsOutgoing bool - // True, if the message is pinned - IsPinned bool - // True, if the message was sent because of a scheduled action by the message sender, for - // example, as away, or greeting service message - IsFromOffline bool - // True, if content of the message can be saved locally or copied using - // inputMessageForwarded or forwardMessages with copy options - CanBeSaved bool - // True, if media timestamp entities refers to a media in this message as opposed to a - // media in the replied message - HasTimestampedMedia bool - // True, if the message is a channel post. All messages to channels are channel posts, - // all other messages are not channel posts - IsChannelPost bool - // True, if the message is a forum topic message - IsTopicMessage bool - // True, if the message contains an unread mention for the current user - ContainsUnreadMention bool - // Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages - Date int32 - // Point in time (Unix timestamp) when the message was last edited; 0 for scheduled - // messages - EditDate int32 - // Information about the initial message sender; may be null if none or unknown - ForwardInfo MessageForwardInfo - // Information about the initial message for messages created with importMessages; may be - // null if the message isn't imported - ImportInfo MessageImportInfo - // Information about interactions with the message; may be null if none - InteractionInfo MessageInteractionInfo - // Information about unread reactions added to the message - UnreadReactions []UnreadReaction - // Information about fact-check added to the message; may be null if none - FactCheck FactCheck - // Information about the message or the story this message is replying to; may be null if - // none - ReplyTo MessageReplyToClass - // If non-zero, the identifier of the message thread the message belongs to; unique - // within the chat to which the message belongs - MessageThreadID int64 - // Identifier of the Saved Messages topic for the message; 0 for messages not from Saved - // Messages - SavedMessagesTopicID int64 - // The message's self-destruct type; may be null if none - SelfDestructType MessageSelfDestructTypeClass - // Time left before the message self-destruct timer expires, in seconds; 0 if - // self-destruction isn't scheduled yet - SelfDestructIn float64 - // Time left before the message will be automatically deleted by message_auto_delete_time - // setting of the chat, in seconds; 0 if never - AutoDeleteIn float64 - // If non-zero, the user identifier of the inline bot through which this message was sent - ViaBotUserID int64 - // If non-zero, the user identifier of the business bot that sent this message - SenderBusinessBotUserID int64 - // Number of times the sender of the message boosted the supergroup at the time the - // message was sent; 0 if none or unknown. For messages sent by the current user, - // supergroupFullInfo.my_boost_count must be used instead - SenderBoostCount int32 - // For channel posts and anonymous group messages, optional author signature - AuthorSignature string - // Unique identifier of an album this message belongs to; 0 if none. Only audios, - // documents, photos and videos can be grouped together in albums - MediaAlbumID int64 - // Unique identifier of the effect added to the message; 0 if none - EffectID int64 - // True, if media content of the message must be hidden with 18+ spoiler - HasSensitiveContent bool - // If non-empty, contains a human-readable description of the reason why access to this - // message must be restricted - RestrictionReason string - // Content of the message - Content MessageContentClass - // Reply markup for the message; may be null if none - ReplyMarkup ReplyMarkupClass -} - -// MessageTypeID is TL type id of Message. -const MessageTypeID = 0xa9c04bbc - -// Ensuring interfaces in compile-time for Message. -var ( - _ bin.Encoder = &Message{} - _ bin.Decoder = &Message{} - _ bin.BareEncoder = &Message{} - _ bin.BareDecoder = &Message{} -) - -func (m *Message) Zero() bool { - if m == nil { - return true - } - if !(m.ID == 0) { - return false - } - if !(m.SenderID == nil) { - return false - } - if !(m.ChatID == 0) { - return false - } - if !(m.SendingState == nil) { - return false - } - if !(m.SchedulingState == nil) { - return false - } - if !(m.IsOutgoing == false) { - return false - } - if !(m.IsPinned == false) { - return false - } - if !(m.IsFromOffline == false) { - return false - } - if !(m.CanBeSaved == false) { - return false - } - if !(m.HasTimestampedMedia == false) { - return false - } - if !(m.IsChannelPost == false) { - return false - } - if !(m.IsTopicMessage == false) { - return false - } - if !(m.ContainsUnreadMention == false) { - return false - } - if !(m.Date == 0) { - return false - } - if !(m.EditDate == 0) { - return false - } - if !(m.ForwardInfo.Zero()) { - return false - } - if !(m.ImportInfo.Zero()) { - return false - } - if !(m.InteractionInfo.Zero()) { - return false - } - if !(m.UnreadReactions == nil) { - return false - } - if !(m.FactCheck.Zero()) { - return false - } - if !(m.ReplyTo == nil) { - return false - } - if !(m.MessageThreadID == 0) { - return false - } - if !(m.SavedMessagesTopicID == 0) { - return false - } - if !(m.SelfDestructType == nil) { - return false - } - if !(m.SelfDestructIn == 0) { - return false - } - if !(m.AutoDeleteIn == 0) { - return false - } - if !(m.ViaBotUserID == 0) { - return false - } - if !(m.SenderBusinessBotUserID == 0) { - return false - } - if !(m.SenderBoostCount == 0) { - return false - } - if !(m.AuthorSignature == "") { - return false - } - if !(m.MediaAlbumID == 0) { - return false - } - if !(m.EffectID == 0) { - return false - } - if !(m.HasSensitiveContent == false) { - return false - } - if !(m.RestrictionReason == "") { - return false - } - if !(m.Content == nil) { - return false - } - if !(m.ReplyMarkup == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *Message) String() string { - if m == nil { - return "Message(nil)" - } - type Alias Message - return fmt.Sprintf("Message%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Message) TypeID() uint32 { - return MessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*Message) TypeName() string { - return "message" -} - -// TypeInfo returns info about TL type. -func (m *Message) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "message", - ID: MessageTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "SenderID", - SchemaName: "sender_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "SendingState", - SchemaName: "sending_state", - }, - { - Name: "SchedulingState", - SchemaName: "scheduling_state", - }, - { - Name: "IsOutgoing", - SchemaName: "is_outgoing", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - { - Name: "IsFromOffline", - SchemaName: "is_from_offline", - }, - { - Name: "CanBeSaved", - SchemaName: "can_be_saved", - }, - { - Name: "HasTimestampedMedia", - SchemaName: "has_timestamped_media", - }, - { - Name: "IsChannelPost", - SchemaName: "is_channel_post", - }, - { - Name: "IsTopicMessage", - SchemaName: "is_topic_message", - }, - { - Name: "ContainsUnreadMention", - SchemaName: "contains_unread_mention", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "EditDate", - SchemaName: "edit_date", - }, - { - Name: "ForwardInfo", - SchemaName: "forward_info", - }, - { - Name: "ImportInfo", - SchemaName: "import_info", - }, - { - Name: "InteractionInfo", - SchemaName: "interaction_info", - }, - { - Name: "UnreadReactions", - SchemaName: "unread_reactions", - }, - { - Name: "FactCheck", - SchemaName: "fact_check", - }, - { - Name: "ReplyTo", - SchemaName: "reply_to", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - { - Name: "SelfDestructType", - SchemaName: "self_destruct_type", - }, - { - Name: "SelfDestructIn", - SchemaName: "self_destruct_in", - }, - { - Name: "AutoDeleteIn", - SchemaName: "auto_delete_in", - }, - { - Name: "ViaBotUserID", - SchemaName: "via_bot_user_id", - }, - { - Name: "SenderBusinessBotUserID", - SchemaName: "sender_business_bot_user_id", - }, - { - Name: "SenderBoostCount", - SchemaName: "sender_boost_count", - }, - { - Name: "AuthorSignature", - SchemaName: "author_signature", - }, - { - Name: "MediaAlbumID", - SchemaName: "media_album_id", - }, - { - Name: "EffectID", - SchemaName: "effect_id", - }, - { - Name: "HasSensitiveContent", - SchemaName: "has_sensitive_content", - }, - { - Name: "RestrictionReason", - SchemaName: "restriction_reason", - }, - { - Name: "Content", - SchemaName: "content", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *Message) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode message#a9c04bbc as nil") - } - b.PutID(MessageTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *Message) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode message#a9c04bbc as nil") - } - b.PutInt53(m.ID) - if m.SenderID == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field sender_id is nil") - } - if err := m.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field sender_id: %w", err) - } - b.PutInt53(m.ChatID) - if m.SendingState == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field sending_state is nil") - } - if err := m.SendingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field sending_state: %w", err) - } - if m.SchedulingState == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field scheduling_state is nil") - } - if err := m.SchedulingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field scheduling_state: %w", err) - } - b.PutBool(m.IsOutgoing) - b.PutBool(m.IsPinned) - b.PutBool(m.IsFromOffline) - b.PutBool(m.CanBeSaved) - b.PutBool(m.HasTimestampedMedia) - b.PutBool(m.IsChannelPost) - b.PutBool(m.IsTopicMessage) - b.PutBool(m.ContainsUnreadMention) - b.PutInt32(m.Date) - b.PutInt32(m.EditDate) - if err := m.ForwardInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field forward_info: %w", err) - } - if err := m.ImportInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field import_info: %w", err) - } - if err := m.InteractionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field interaction_info: %w", err) - } - b.PutInt(len(m.UnreadReactions)) - for idx, v := range m.UnreadReactions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare message#a9c04bbc: field unread_reactions element with index %d: %w", idx, err) - } - } - if err := m.FactCheck.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field fact_check: %w", err) - } - if m.ReplyTo == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field reply_to is nil") - } - if err := m.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field reply_to: %w", err) - } - b.PutInt53(m.MessageThreadID) - b.PutInt53(m.SavedMessagesTopicID) - if m.SelfDestructType == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field self_destruct_type is nil") - } - if err := m.SelfDestructType.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field self_destruct_type: %w", err) - } - b.PutDouble(m.SelfDestructIn) - b.PutDouble(m.AutoDeleteIn) - b.PutInt53(m.ViaBotUserID) - b.PutInt53(m.SenderBusinessBotUserID) - b.PutInt32(m.SenderBoostCount) - b.PutString(m.AuthorSignature) - b.PutLong(m.MediaAlbumID) - b.PutLong(m.EffectID) - b.PutBool(m.HasSensitiveContent) - b.PutString(m.RestrictionReason) - if m.Content == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field content is nil") - } - if err := m.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field content: %w", err) - } - if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field reply_markup is nil") - } - if err := m.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field reply_markup: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *Message) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode message#a9c04bbc to nil") - } - if err := b.ConsumeID(MessageTypeID); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *Message) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode message#a9c04bbc to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field id: %w", err) - } - m.ID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field sender_id: %w", err) - } - m.SenderID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field chat_id: %w", err) - } - m.ChatID = value - } - { - value, err := DecodeMessageSendingState(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field sending_state: %w", err) - } - m.SendingState = value - } - { - value, err := DecodeMessageSchedulingState(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field scheduling_state: %w", err) - } - m.SchedulingState = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field is_outgoing: %w", err) - } - m.IsOutgoing = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field is_pinned: %w", err) - } - m.IsPinned = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field is_from_offline: %w", err) - } - m.IsFromOffline = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field can_be_saved: %w", err) - } - m.CanBeSaved = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field has_timestamped_media: %w", err) - } - m.HasTimestampedMedia = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field is_channel_post: %w", err) - } - m.IsChannelPost = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field is_topic_message: %w", err) - } - m.IsTopicMessage = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field contains_unread_mention: %w", err) - } - m.ContainsUnreadMention = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field date: %w", err) - } - m.Date = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field edit_date: %w", err) - } - m.EditDate = value - } - { - if err := m.ForwardInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field forward_info: %w", err) - } - } - { - if err := m.ImportInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field import_info: %w", err) - } - } - { - if err := m.InteractionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field interaction_info: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field unread_reactions: %w", err) - } - - if headerLen > 0 { - m.UnreadReactions = make([]UnreadReaction, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value UnreadReaction - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare message#a9c04bbc: field unread_reactions: %w", err) - } - m.UnreadReactions = append(m.UnreadReactions, value) - } - } - { - if err := m.FactCheck.Decode(b); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field fact_check: %w", err) - } - } - { - value, err := DecodeMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field reply_to: %w", err) - } - m.ReplyTo = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field message_thread_id: %w", err) - } - m.MessageThreadID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field saved_messages_topic_id: %w", err) - } - m.SavedMessagesTopicID = value - } - { - value, err := DecodeMessageSelfDestructType(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field self_destruct_type: %w", err) - } - m.SelfDestructType = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field self_destruct_in: %w", err) - } - m.SelfDestructIn = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field auto_delete_in: %w", err) - } - m.AutoDeleteIn = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field via_bot_user_id: %w", err) - } - m.ViaBotUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field sender_business_bot_user_id: %w", err) - } - m.SenderBusinessBotUserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field sender_boost_count: %w", err) - } - m.SenderBoostCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field author_signature: %w", err) - } - m.AuthorSignature = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field media_album_id: %w", err) - } - m.MediaAlbumID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field effect_id: %w", err) - } - m.EffectID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field has_sensitive_content: %w", err) - } - m.HasSensitiveContent = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field restriction_reason: %w", err) - } - m.RestrictionReason = value - } - { - value, err := DecodeMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field content: %w", err) - } - m.Content = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field reply_markup: %w", err) - } - m.ReplyMarkup = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *Message) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode message#a9c04bbc as nil") - } - b.ObjStart() - b.PutID("message") - b.Comma() - b.FieldStart("id") - b.PutInt53(m.ID) - b.Comma() - b.FieldStart("sender_id") - if m.SenderID == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field sender_id is nil") - } - if err := m.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field sender_id: %w", err) - } - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(m.ChatID) - b.Comma() - b.FieldStart("sending_state") - if m.SendingState == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field sending_state is nil") - } - if err := m.SendingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field sending_state: %w", err) - } - b.Comma() - b.FieldStart("scheduling_state") - if m.SchedulingState == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field scheduling_state is nil") - } - if err := m.SchedulingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field scheduling_state: %w", err) - } - b.Comma() - b.FieldStart("is_outgoing") - b.PutBool(m.IsOutgoing) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(m.IsPinned) - b.Comma() - b.FieldStart("is_from_offline") - b.PutBool(m.IsFromOffline) - b.Comma() - b.FieldStart("can_be_saved") - b.PutBool(m.CanBeSaved) - b.Comma() - b.FieldStart("has_timestamped_media") - b.PutBool(m.HasTimestampedMedia) - b.Comma() - b.FieldStart("is_channel_post") - b.PutBool(m.IsChannelPost) - b.Comma() - b.FieldStart("is_topic_message") - b.PutBool(m.IsTopicMessage) - b.Comma() - b.FieldStart("contains_unread_mention") - b.PutBool(m.ContainsUnreadMention) - b.Comma() - b.FieldStart("date") - b.PutInt32(m.Date) - b.Comma() - b.FieldStart("edit_date") - b.PutInt32(m.EditDate) - b.Comma() - b.FieldStart("forward_info") - if err := m.ForwardInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field forward_info: %w", err) - } - b.Comma() - b.FieldStart("import_info") - if err := m.ImportInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field import_info: %w", err) - } - b.Comma() - b.FieldStart("interaction_info") - if err := m.InteractionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field interaction_info: %w", err) - } - b.Comma() - b.FieldStart("unread_reactions") - b.ArrStart() - for idx, v := range m.UnreadReactions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field unread_reactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("fact_check") - if err := m.FactCheck.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field fact_check: %w", err) - } - b.Comma() - b.FieldStart("reply_to") - if m.ReplyTo == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field reply_to is nil") - } - if err := m.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field reply_to: %w", err) - } - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(m.MessageThreadID) - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(m.SavedMessagesTopicID) - b.Comma() - b.FieldStart("self_destruct_type") - if m.SelfDestructType == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field self_destruct_type is nil") - } - if err := m.SelfDestructType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field self_destruct_type: %w", err) - } - b.Comma() - b.FieldStart("self_destruct_in") - b.PutDouble(m.SelfDestructIn) - b.Comma() - b.FieldStart("auto_delete_in") - b.PutDouble(m.AutoDeleteIn) - b.Comma() - b.FieldStart("via_bot_user_id") - b.PutInt53(m.ViaBotUserID) - b.Comma() - b.FieldStart("sender_business_bot_user_id") - b.PutInt53(m.SenderBusinessBotUserID) - b.Comma() - b.FieldStart("sender_boost_count") - b.PutInt32(m.SenderBoostCount) - b.Comma() - b.FieldStart("author_signature") - b.PutString(m.AuthorSignature) - b.Comma() - b.FieldStart("media_album_id") - b.PutLong(m.MediaAlbumID) - b.Comma() - b.FieldStart("effect_id") - b.PutLong(m.EffectID) - b.Comma() - b.FieldStart("has_sensitive_content") - b.PutBool(m.HasSensitiveContent) - b.Comma() - b.FieldStart("restriction_reason") - b.PutString(m.RestrictionReason) - b.Comma() - b.FieldStart("content") - if m.Content == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field content is nil") - } - if err := m.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field content: %w", err) - } - b.Comma() - b.FieldStart("reply_markup") - if m.ReplyMarkup == nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field reply_markup is nil") - } - if err := m.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode message#a9c04bbc: field reply_markup: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *Message) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode message#a9c04bbc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("message"); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: %w", err) - } - case "id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field id: %w", err) - } - m.ID = value - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field sender_id: %w", err) - } - m.SenderID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field chat_id: %w", err) - } - m.ChatID = value - case "sending_state": - value, err := DecodeTDLibJSONMessageSendingState(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field sending_state: %w", err) - } - m.SendingState = value - case "scheduling_state": - value, err := DecodeTDLibJSONMessageSchedulingState(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field scheduling_state: %w", err) - } - m.SchedulingState = value - case "is_outgoing": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field is_outgoing: %w", err) - } - m.IsOutgoing = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field is_pinned: %w", err) - } - m.IsPinned = value - case "is_from_offline": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field is_from_offline: %w", err) - } - m.IsFromOffline = value - case "can_be_saved": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field can_be_saved: %w", err) - } - m.CanBeSaved = value - case "has_timestamped_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field has_timestamped_media: %w", err) - } - m.HasTimestampedMedia = value - case "is_channel_post": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field is_channel_post: %w", err) - } - m.IsChannelPost = value - case "is_topic_message": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field is_topic_message: %w", err) - } - m.IsTopicMessage = value - case "contains_unread_mention": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field contains_unread_mention: %w", err) - } - m.ContainsUnreadMention = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field date: %w", err) - } - m.Date = value - case "edit_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field edit_date: %w", err) - } - m.EditDate = value - case "forward_info": - if err := m.ForwardInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field forward_info: %w", err) - } - case "import_info": - if err := m.ImportInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field import_info: %w", err) - } - case "interaction_info": - if err := m.InteractionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field interaction_info: %w", err) - } - case "unread_reactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value UnreadReaction - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field unread_reactions: %w", err) - } - m.UnreadReactions = append(m.UnreadReactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field unread_reactions: %w", err) - } - case "fact_check": - if err := m.FactCheck.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field fact_check: %w", err) - } - case "reply_to": - value, err := DecodeTDLibJSONMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field reply_to: %w", err) - } - m.ReplyTo = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field message_thread_id: %w", err) - } - m.MessageThreadID = value - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field saved_messages_topic_id: %w", err) - } - m.SavedMessagesTopicID = value - case "self_destruct_type": - value, err := DecodeTDLibJSONMessageSelfDestructType(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field self_destruct_type: %w", err) - } - m.SelfDestructType = value - case "self_destruct_in": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field self_destruct_in: %w", err) - } - m.SelfDestructIn = value - case "auto_delete_in": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field auto_delete_in: %w", err) - } - m.AutoDeleteIn = value - case "via_bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field via_bot_user_id: %w", err) - } - m.ViaBotUserID = value - case "sender_business_bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field sender_business_bot_user_id: %w", err) - } - m.SenderBusinessBotUserID = value - case "sender_boost_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field sender_boost_count: %w", err) - } - m.SenderBoostCount = value - case "author_signature": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field author_signature: %w", err) - } - m.AuthorSignature = value - case "media_album_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field media_album_id: %w", err) - } - m.MediaAlbumID = value - case "effect_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field effect_id: %w", err) - } - m.EffectID = value - case "has_sensitive_content": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field has_sensitive_content: %w", err) - } - m.HasSensitiveContent = value - case "restriction_reason": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field restriction_reason: %w", err) - } - m.RestrictionReason = value - case "content": - value, err := DecodeTDLibJSONMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field content: %w", err) - } - m.Content = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode message#a9c04bbc: field reply_markup: %w", err) - } - m.ReplyMarkup = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (m *Message) GetID() (value int64) { - if m == nil { - return - } - return m.ID -} - -// GetSenderID returns value of SenderID field. -func (m *Message) GetSenderID() (value MessageSenderClass) { - if m == nil { - return - } - return m.SenderID -} - -// GetChatID returns value of ChatID field. -func (m *Message) GetChatID() (value int64) { - if m == nil { - return - } - return m.ChatID -} - -// GetSendingState returns value of SendingState field. -func (m *Message) GetSendingState() (value MessageSendingStateClass) { - if m == nil { - return - } - return m.SendingState -} - -// GetSchedulingState returns value of SchedulingState field. -func (m *Message) GetSchedulingState() (value MessageSchedulingStateClass) { - if m == nil { - return - } - return m.SchedulingState -} - -// GetIsOutgoing returns value of IsOutgoing field. -func (m *Message) GetIsOutgoing() (value bool) { - if m == nil { - return - } - return m.IsOutgoing -} - -// GetIsPinned returns value of IsPinned field. -func (m *Message) GetIsPinned() (value bool) { - if m == nil { - return - } - return m.IsPinned -} - -// GetIsFromOffline returns value of IsFromOffline field. -func (m *Message) GetIsFromOffline() (value bool) { - if m == nil { - return - } - return m.IsFromOffline -} - -// GetCanBeSaved returns value of CanBeSaved field. -func (m *Message) GetCanBeSaved() (value bool) { - if m == nil { - return - } - return m.CanBeSaved -} - -// GetHasTimestampedMedia returns value of HasTimestampedMedia field. -func (m *Message) GetHasTimestampedMedia() (value bool) { - if m == nil { - return - } - return m.HasTimestampedMedia -} - -// GetIsChannelPost returns value of IsChannelPost field. -func (m *Message) GetIsChannelPost() (value bool) { - if m == nil { - return - } - return m.IsChannelPost -} - -// GetIsTopicMessage returns value of IsTopicMessage field. -func (m *Message) GetIsTopicMessage() (value bool) { - if m == nil { - return - } - return m.IsTopicMessage -} - -// GetContainsUnreadMention returns value of ContainsUnreadMention field. -func (m *Message) GetContainsUnreadMention() (value bool) { - if m == nil { - return - } - return m.ContainsUnreadMention -} - -// GetDate returns value of Date field. -func (m *Message) GetDate() (value int32) { - if m == nil { - return - } - return m.Date -} - -// GetEditDate returns value of EditDate field. -func (m *Message) GetEditDate() (value int32) { - if m == nil { - return - } - return m.EditDate -} - -// GetForwardInfo returns value of ForwardInfo field. -func (m *Message) GetForwardInfo() (value MessageForwardInfo) { - if m == nil { - return - } - return m.ForwardInfo -} - -// GetImportInfo returns value of ImportInfo field. -func (m *Message) GetImportInfo() (value MessageImportInfo) { - if m == nil { - return - } - return m.ImportInfo -} - -// GetInteractionInfo returns value of InteractionInfo field. -func (m *Message) GetInteractionInfo() (value MessageInteractionInfo) { - if m == nil { - return - } - return m.InteractionInfo -} - -// GetUnreadReactions returns value of UnreadReactions field. -func (m *Message) GetUnreadReactions() (value []UnreadReaction) { - if m == nil { - return - } - return m.UnreadReactions -} - -// GetFactCheck returns value of FactCheck field. -func (m *Message) GetFactCheck() (value FactCheck) { - if m == nil { - return - } - return m.FactCheck -} - -// GetReplyTo returns value of ReplyTo field. -func (m *Message) GetReplyTo() (value MessageReplyToClass) { - if m == nil { - return - } - return m.ReplyTo -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (m *Message) GetMessageThreadID() (value int64) { - if m == nil { - return - } - return m.MessageThreadID -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (m *Message) GetSavedMessagesTopicID() (value int64) { - if m == nil { - return - } - return m.SavedMessagesTopicID -} - -// GetSelfDestructType returns value of SelfDestructType field. -func (m *Message) GetSelfDestructType() (value MessageSelfDestructTypeClass) { - if m == nil { - return - } - return m.SelfDestructType -} - -// GetSelfDestructIn returns value of SelfDestructIn field. -func (m *Message) GetSelfDestructIn() (value float64) { - if m == nil { - return - } - return m.SelfDestructIn -} - -// GetAutoDeleteIn returns value of AutoDeleteIn field. -func (m *Message) GetAutoDeleteIn() (value float64) { - if m == nil { - return - } - return m.AutoDeleteIn -} - -// GetViaBotUserID returns value of ViaBotUserID field. -func (m *Message) GetViaBotUserID() (value int64) { - if m == nil { - return - } - return m.ViaBotUserID -} - -// GetSenderBusinessBotUserID returns value of SenderBusinessBotUserID field. -func (m *Message) GetSenderBusinessBotUserID() (value int64) { - if m == nil { - return - } - return m.SenderBusinessBotUserID -} - -// GetSenderBoostCount returns value of SenderBoostCount field. -func (m *Message) GetSenderBoostCount() (value int32) { - if m == nil { - return - } - return m.SenderBoostCount -} - -// GetAuthorSignature returns value of AuthorSignature field. -func (m *Message) GetAuthorSignature() (value string) { - if m == nil { - return - } - return m.AuthorSignature -} - -// GetMediaAlbumID returns value of MediaAlbumID field. -func (m *Message) GetMediaAlbumID() (value int64) { - if m == nil { - return - } - return m.MediaAlbumID -} - -// GetEffectID returns value of EffectID field. -func (m *Message) GetEffectID() (value int64) { - if m == nil { - return - } - return m.EffectID -} - -// GetHasSensitiveContent returns value of HasSensitiveContent field. -func (m *Message) GetHasSensitiveContent() (value bool) { - if m == nil { - return - } - return m.HasSensitiveContent -} - -// GetRestrictionReason returns value of RestrictionReason field. -func (m *Message) GetRestrictionReason() (value string) { - if m == nil { - return - } - return m.RestrictionReason -} - -// GetContent returns value of Content field. -func (m *Message) GetContent() (value MessageContentClass) { - if m == nil { - return - } - return m.Content -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (m *Message) GetReplyMarkup() (value ReplyMarkupClass) { - if m == nil { - return - } - return m.ReplyMarkup -} diff --git a/tdapi/tl_message_import_info_gen.go b/tdapi/tl_message_import_info_gen.go deleted file mode 100644 index 250c87784..000000000 --- a/tdapi/tl_message_import_info_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageImportInfo represents TL type `messageImportInfo#e6dfabcf`. -type MessageImportInfo struct { - // Name of the original sender - SenderName string - // Point in time (Unix timestamp) when the message was originally sent - Date int32 -} - -// MessageImportInfoTypeID is TL type id of MessageImportInfo. -const MessageImportInfoTypeID = 0xe6dfabcf - -// Ensuring interfaces in compile-time for MessageImportInfo. -var ( - _ bin.Encoder = &MessageImportInfo{} - _ bin.Decoder = &MessageImportInfo{} - _ bin.BareEncoder = &MessageImportInfo{} - _ bin.BareDecoder = &MessageImportInfo{} -) - -func (m *MessageImportInfo) Zero() bool { - if m == nil { - return true - } - if !(m.SenderName == "") { - return false - } - if !(m.Date == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageImportInfo) String() string { - if m == nil { - return "MessageImportInfo(nil)" - } - type Alias MessageImportInfo - return fmt.Sprintf("MessageImportInfo%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageImportInfo) TypeID() uint32 { - return MessageImportInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageImportInfo) TypeName() string { - return "messageImportInfo" -} - -// TypeInfo returns info about TL type. -func (m *MessageImportInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageImportInfo", - ID: MessageImportInfoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderName", - SchemaName: "sender_name", - }, - { - Name: "Date", - SchemaName: "date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageImportInfo) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageImportInfo#e6dfabcf as nil") - } - b.PutID(MessageImportInfoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageImportInfo) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageImportInfo#e6dfabcf as nil") - } - b.PutString(m.SenderName) - b.PutInt32(m.Date) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageImportInfo) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageImportInfo#e6dfabcf to nil") - } - if err := b.ConsumeID(MessageImportInfoTypeID); err != nil { - return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageImportInfo) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageImportInfo#e6dfabcf to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: field sender_name: %w", err) - } - m.SenderName = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: field date: %w", err) - } - m.Date = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageImportInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageImportInfo#e6dfabcf as nil") - } - b.ObjStart() - b.PutID("messageImportInfo") - b.Comma() - b.FieldStart("sender_name") - b.PutString(m.SenderName) - b.Comma() - b.FieldStart("date") - b.PutInt32(m.Date) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageImportInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageImportInfo#e6dfabcf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageImportInfo"); err != nil { - return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: %w", err) - } - case "sender_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: field sender_name: %w", err) - } - m.SenderName = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageImportInfo#e6dfabcf: field date: %w", err) - } - m.Date = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderName returns value of SenderName field. -func (m *MessageImportInfo) GetSenderName() (value string) { - if m == nil { - return - } - return m.SenderName -} - -// GetDate returns value of Date field. -func (m *MessageImportInfo) GetDate() (value int32) { - if m == nil { - return - } - return m.Date -} diff --git a/tdapi/tl_message_interaction_info_gen.go b/tdapi/tl_message_interaction_info_gen.go deleted file mode 100644 index 5afe73d1b..000000000 --- a/tdapi/tl_message_interaction_info_gen.go +++ /dev/null @@ -1,297 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageInteractionInfo represents TL type `messageInteractionInfo#2bbcde05`. -type MessageInteractionInfo struct { - // Number of times the message was viewed - ViewCount int32 - // Number of times the message was forwarded - ForwardCount int32 - // Information about direct or indirect replies to the message; may be null. Currently, - // available only in channels with a discussion supergroup and discussion supergroups for - // messages, which are not replies itself - ReplyInfo MessageReplyInfo - // The list of reactions or tags added to the message; may be null - Reactions MessageReactions -} - -// MessageInteractionInfoTypeID is TL type id of MessageInteractionInfo. -const MessageInteractionInfoTypeID = 0x2bbcde05 - -// Ensuring interfaces in compile-time for MessageInteractionInfo. -var ( - _ bin.Encoder = &MessageInteractionInfo{} - _ bin.Decoder = &MessageInteractionInfo{} - _ bin.BareEncoder = &MessageInteractionInfo{} - _ bin.BareDecoder = &MessageInteractionInfo{} -) - -func (m *MessageInteractionInfo) Zero() bool { - if m == nil { - return true - } - if !(m.ViewCount == 0) { - return false - } - if !(m.ForwardCount == 0) { - return false - } - if !(m.ReplyInfo.Zero()) { - return false - } - if !(m.Reactions.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageInteractionInfo) String() string { - if m == nil { - return "MessageInteractionInfo(nil)" - } - type Alias MessageInteractionInfo - return fmt.Sprintf("MessageInteractionInfo%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageInteractionInfo) TypeID() uint32 { - return MessageInteractionInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageInteractionInfo) TypeName() string { - return "messageInteractionInfo" -} - -// TypeInfo returns info about TL type. -func (m *MessageInteractionInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageInteractionInfo", - ID: MessageInteractionInfoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ViewCount", - SchemaName: "view_count", - }, - { - Name: "ForwardCount", - SchemaName: "forward_count", - }, - { - Name: "ReplyInfo", - SchemaName: "reply_info", - }, - { - Name: "Reactions", - SchemaName: "reactions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageInteractionInfo) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageInteractionInfo#2bbcde05 as nil") - } - b.PutID(MessageInteractionInfoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageInteractionInfo) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageInteractionInfo#2bbcde05 as nil") - } - b.PutInt32(m.ViewCount) - b.PutInt32(m.ForwardCount) - if err := m.ReplyInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageInteractionInfo#2bbcde05: field reply_info: %w", err) - } - if err := m.Reactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageInteractionInfo#2bbcde05: field reactions: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageInteractionInfo) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageInteractionInfo#2bbcde05 to nil") - } - if err := b.ConsumeID(MessageInteractionInfoTypeID); err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#2bbcde05: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageInteractionInfo) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageInteractionInfo#2bbcde05 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#2bbcde05: field view_count: %w", err) - } - m.ViewCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#2bbcde05: field forward_count: %w", err) - } - m.ForwardCount = value - } - { - if err := m.ReplyInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#2bbcde05: field reply_info: %w", err) - } - } - { - if err := m.Reactions.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#2bbcde05: field reactions: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageInteractionInfo#2bbcde05 as nil") - } - b.ObjStart() - b.PutID("messageInteractionInfo") - b.Comma() - b.FieldStart("view_count") - b.PutInt32(m.ViewCount) - b.Comma() - b.FieldStart("forward_count") - b.PutInt32(m.ForwardCount) - b.Comma() - b.FieldStart("reply_info") - if err := m.ReplyInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageInteractionInfo#2bbcde05: field reply_info: %w", err) - } - b.Comma() - b.FieldStart("reactions") - if err := m.Reactions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageInteractionInfo#2bbcde05: field reactions: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageInteractionInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageInteractionInfo#2bbcde05 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageInteractionInfo"); err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#2bbcde05: %w", err) - } - case "view_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#2bbcde05: field view_count: %w", err) - } - m.ViewCount = value - case "forward_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#2bbcde05: field forward_count: %w", err) - } - m.ForwardCount = value - case "reply_info": - if err := m.ReplyInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#2bbcde05: field reply_info: %w", err) - } - case "reactions": - if err := m.Reactions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageInteractionInfo#2bbcde05: field reactions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetViewCount returns value of ViewCount field. -func (m *MessageInteractionInfo) GetViewCount() (value int32) { - if m == nil { - return - } - return m.ViewCount -} - -// GetForwardCount returns value of ForwardCount field. -func (m *MessageInteractionInfo) GetForwardCount() (value int32) { - if m == nil { - return - } - return m.ForwardCount -} - -// GetReplyInfo returns value of ReplyInfo field. -func (m *MessageInteractionInfo) GetReplyInfo() (value MessageReplyInfo) { - if m == nil { - return - } - return m.ReplyInfo -} - -// GetReactions returns value of Reactions field. -func (m *MessageInteractionInfo) GetReactions() (value MessageReactions) { - if m == nil { - return - } - return m.Reactions -} diff --git a/tdapi/tl_message_link_gen.go b/tdapi/tl_message_link_gen.go deleted file mode 100644 index c57a245f3..000000000 --- a/tdapi/tl_message_link_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageLink represents TL type `messageLink#af4a3aa6`. -type MessageLink struct { - // The link - Link string - // True, if the link will work for non-members of the chat - IsPublic bool -} - -// MessageLinkTypeID is TL type id of MessageLink. -const MessageLinkTypeID = 0xaf4a3aa6 - -// Ensuring interfaces in compile-time for MessageLink. -var ( - _ bin.Encoder = &MessageLink{} - _ bin.Decoder = &MessageLink{} - _ bin.BareEncoder = &MessageLink{} - _ bin.BareDecoder = &MessageLink{} -) - -func (m *MessageLink) Zero() bool { - if m == nil { - return true - } - if !(m.Link == "") { - return false - } - if !(m.IsPublic == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageLink) String() string { - if m == nil { - return "MessageLink(nil)" - } - type Alias MessageLink - return fmt.Sprintf("MessageLink%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageLink) TypeID() uint32 { - return MessageLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageLink) TypeName() string { - return "messageLink" -} - -// TypeInfo returns info about TL type. -func (m *MessageLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageLink", - ID: MessageLinkTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - { - Name: "IsPublic", - SchemaName: "is_public", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageLink) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageLink#af4a3aa6 as nil") - } - b.PutID(MessageLinkTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageLink) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageLink#af4a3aa6 as nil") - } - b.PutString(m.Link) - b.PutBool(m.IsPublic) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageLink) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageLink#af4a3aa6 to nil") - } - if err := b.ConsumeID(MessageLinkTypeID); err != nil { - return fmt.Errorf("unable to decode messageLink#af4a3aa6: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageLink) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageLink#af4a3aa6 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageLink#af4a3aa6: field link: %w", err) - } - m.Link = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageLink#af4a3aa6: field is_public: %w", err) - } - m.IsPublic = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageLink#af4a3aa6 as nil") - } - b.ObjStart() - b.PutID("messageLink") - b.Comma() - b.FieldStart("link") - b.PutString(m.Link) - b.Comma() - b.FieldStart("is_public") - b.PutBool(m.IsPublic) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageLink#af4a3aa6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageLink"); err != nil { - return fmt.Errorf("unable to decode messageLink#af4a3aa6: %w", err) - } - case "link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageLink#af4a3aa6: field link: %w", err) - } - m.Link = value - case "is_public": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageLink#af4a3aa6: field is_public: %w", err) - } - m.IsPublic = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (m *MessageLink) GetLink() (value string) { - if m == nil { - return - } - return m.Link -} - -// GetIsPublic returns value of IsPublic field. -func (m *MessageLink) GetIsPublic() (value bool) { - if m == nil { - return - } - return m.IsPublic -} diff --git a/tdapi/tl_message_link_info_gen.go b/tdapi/tl_message_link_info_gen.go deleted file mode 100644 index 49f96c075..000000000 --- a/tdapi/tl_message_link_info_gen.go +++ /dev/null @@ -1,366 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageLinkInfo represents TL type `messageLinkInfo#2b96fb50`. -type MessageLinkInfo struct { - // True, if the link is a public link for a message or a forum topic in a chat - IsPublic bool - // If found, identifier of the chat to which the link points, 0 otherwise - ChatID int64 - // If found, identifier of the message thread in which to open the message, or a forum - // topic to open if the message is missing - MessageThreadID int64 - // If found, the linked message; may be null - Message Message - // Timestamp from which the video/audio/video note/voice note/story playing must start, - // in seconds; 0 if not specified. The media can be in the message content or in its link - // preview - MediaTimestamp int32 - // True, if the whole media album to which the message belongs is linked - ForAlbum bool -} - -// MessageLinkInfoTypeID is TL type id of MessageLinkInfo. -const MessageLinkInfoTypeID = 0x2b96fb50 - -// Ensuring interfaces in compile-time for MessageLinkInfo. -var ( - _ bin.Encoder = &MessageLinkInfo{} - _ bin.Decoder = &MessageLinkInfo{} - _ bin.BareEncoder = &MessageLinkInfo{} - _ bin.BareDecoder = &MessageLinkInfo{} -) - -func (m *MessageLinkInfo) Zero() bool { - if m == nil { - return true - } - if !(m.IsPublic == false) { - return false - } - if !(m.ChatID == 0) { - return false - } - if !(m.MessageThreadID == 0) { - return false - } - if !(m.Message.Zero()) { - return false - } - if !(m.MediaTimestamp == 0) { - return false - } - if !(m.ForAlbum == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageLinkInfo) String() string { - if m == nil { - return "MessageLinkInfo(nil)" - } - type Alias MessageLinkInfo - return fmt.Sprintf("MessageLinkInfo%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageLinkInfo) TypeID() uint32 { - return MessageLinkInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageLinkInfo) TypeName() string { - return "messageLinkInfo" -} - -// TypeInfo returns info about TL type. -func (m *MessageLinkInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageLinkInfo", - ID: MessageLinkInfoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsPublic", - SchemaName: "is_public", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "MediaTimestamp", - SchemaName: "media_timestamp", - }, - { - Name: "ForAlbum", - SchemaName: "for_album", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageLinkInfo) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageLinkInfo#2b96fb50 as nil") - } - b.PutID(MessageLinkInfoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageLinkInfo) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageLinkInfo#2b96fb50 as nil") - } - b.PutBool(m.IsPublic) - b.PutInt53(m.ChatID) - b.PutInt53(m.MessageThreadID) - if err := m.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageLinkInfo#2b96fb50: field message: %w", err) - } - b.PutInt32(m.MediaTimestamp) - b.PutBool(m.ForAlbum) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageLinkInfo) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageLinkInfo#2b96fb50 to nil") - } - if err := b.ConsumeID(MessageLinkInfoTypeID); err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageLinkInfo) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageLinkInfo#2b96fb50 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field is_public: %w", err) - } - m.IsPublic = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field chat_id: %w", err) - } - m.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field message_thread_id: %w", err) - } - m.MessageThreadID = value - } - { - if err := m.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field message: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field media_timestamp: %w", err) - } - m.MediaTimestamp = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field for_album: %w", err) - } - m.ForAlbum = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageLinkInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageLinkInfo#2b96fb50 as nil") - } - b.ObjStart() - b.PutID("messageLinkInfo") - b.Comma() - b.FieldStart("is_public") - b.PutBool(m.IsPublic) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(m.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(m.MessageThreadID) - b.Comma() - b.FieldStart("message") - if err := m.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageLinkInfo#2b96fb50: field message: %w", err) - } - b.Comma() - b.FieldStart("media_timestamp") - b.PutInt32(m.MediaTimestamp) - b.Comma() - b.FieldStart("for_album") - b.PutBool(m.ForAlbum) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageLinkInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageLinkInfo#2b96fb50 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageLinkInfo"); err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: %w", err) - } - case "is_public": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field is_public: %w", err) - } - m.IsPublic = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field chat_id: %w", err) - } - m.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field message_thread_id: %w", err) - } - m.MessageThreadID = value - case "message": - if err := m.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field message: %w", err) - } - case "media_timestamp": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field media_timestamp: %w", err) - } - m.MediaTimestamp = value - case "for_album": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageLinkInfo#2b96fb50: field for_album: %w", err) - } - m.ForAlbum = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsPublic returns value of IsPublic field. -func (m *MessageLinkInfo) GetIsPublic() (value bool) { - if m == nil { - return - } - return m.IsPublic -} - -// GetChatID returns value of ChatID field. -func (m *MessageLinkInfo) GetChatID() (value int64) { - if m == nil { - return - } - return m.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (m *MessageLinkInfo) GetMessageThreadID() (value int64) { - if m == nil { - return - } - return m.MessageThreadID -} - -// GetMessage returns value of Message field. -func (m *MessageLinkInfo) GetMessage() (value Message) { - if m == nil { - return - } - return m.Message -} - -// GetMediaTimestamp returns value of MediaTimestamp field. -func (m *MessageLinkInfo) GetMediaTimestamp() (value int32) { - if m == nil { - return - } - return m.MediaTimestamp -} - -// GetForAlbum returns value of ForAlbum field. -func (m *MessageLinkInfo) GetForAlbum() (value bool) { - if m == nil { - return - } - return m.ForAlbum -} diff --git a/tdapi/tl_message_origin_gen.go b/tdapi/tl_message_origin_gen.go deleted file mode 100644 index 47421d6f9..000000000 --- a/tdapi/tl_message_origin_gen.go +++ /dev/null @@ -1,966 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageOriginUser represents TL type `messageOriginUser#9c009043`. -type MessageOriginUser struct { - // Identifier of the user that originally sent the message - SenderUserID int64 -} - -// MessageOriginUserTypeID is TL type id of MessageOriginUser. -const MessageOriginUserTypeID = 0x9c009043 - -// construct implements constructor of MessageOriginClass. -func (m MessageOriginUser) construct() MessageOriginClass { return &m } - -// Ensuring interfaces in compile-time for MessageOriginUser. -var ( - _ bin.Encoder = &MessageOriginUser{} - _ bin.Decoder = &MessageOriginUser{} - _ bin.BareEncoder = &MessageOriginUser{} - _ bin.BareDecoder = &MessageOriginUser{} - - _ MessageOriginClass = &MessageOriginUser{} -) - -func (m *MessageOriginUser) Zero() bool { - if m == nil { - return true - } - if !(m.SenderUserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageOriginUser) String() string { - if m == nil { - return "MessageOriginUser(nil)" - } - type Alias MessageOriginUser - return fmt.Sprintf("MessageOriginUser%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageOriginUser) TypeID() uint32 { - return MessageOriginUserTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageOriginUser) TypeName() string { - return "messageOriginUser" -} - -// TypeInfo returns info about TL type. -func (m *MessageOriginUser) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageOriginUser", - ID: MessageOriginUserTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageOriginUser) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginUser#9c009043 as nil") - } - b.PutID(MessageOriginUserTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageOriginUser) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginUser#9c009043 as nil") - } - b.PutInt53(m.SenderUserID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageOriginUser) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginUser#9c009043 to nil") - } - if err := b.ConsumeID(MessageOriginUserTypeID); err != nil { - return fmt.Errorf("unable to decode messageOriginUser#9c009043: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageOriginUser) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginUser#9c009043 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageOriginUser#9c009043: field sender_user_id: %w", err) - } - m.SenderUserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageOriginUser) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginUser#9c009043 as nil") - } - b.ObjStart() - b.PutID("messageOriginUser") - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(m.SenderUserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageOriginUser) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginUser#9c009043 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageOriginUser"); err != nil { - return fmt.Errorf("unable to decode messageOriginUser#9c009043: %w", err) - } - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageOriginUser#9c009043: field sender_user_id: %w", err) - } - m.SenderUserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderUserID returns value of SenderUserID field. -func (m *MessageOriginUser) GetSenderUserID() (value int64) { - if m == nil { - return - } - return m.SenderUserID -} - -// MessageOriginHiddenUser represents TL type `messageOriginHiddenUser#ed0c23da`. -type MessageOriginHiddenUser struct { - // Name of the sender - SenderName string -} - -// MessageOriginHiddenUserTypeID is TL type id of MessageOriginHiddenUser. -const MessageOriginHiddenUserTypeID = 0xed0c23da - -// construct implements constructor of MessageOriginClass. -func (m MessageOriginHiddenUser) construct() MessageOriginClass { return &m } - -// Ensuring interfaces in compile-time for MessageOriginHiddenUser. -var ( - _ bin.Encoder = &MessageOriginHiddenUser{} - _ bin.Decoder = &MessageOriginHiddenUser{} - _ bin.BareEncoder = &MessageOriginHiddenUser{} - _ bin.BareDecoder = &MessageOriginHiddenUser{} - - _ MessageOriginClass = &MessageOriginHiddenUser{} -) - -func (m *MessageOriginHiddenUser) Zero() bool { - if m == nil { - return true - } - if !(m.SenderName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageOriginHiddenUser) String() string { - if m == nil { - return "MessageOriginHiddenUser(nil)" - } - type Alias MessageOriginHiddenUser - return fmt.Sprintf("MessageOriginHiddenUser%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageOriginHiddenUser) TypeID() uint32 { - return MessageOriginHiddenUserTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageOriginHiddenUser) TypeName() string { - return "messageOriginHiddenUser" -} - -// TypeInfo returns info about TL type. -func (m *MessageOriginHiddenUser) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageOriginHiddenUser", - ID: MessageOriginHiddenUserTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderName", - SchemaName: "sender_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageOriginHiddenUser) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginHiddenUser#ed0c23da as nil") - } - b.PutID(MessageOriginHiddenUserTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageOriginHiddenUser) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginHiddenUser#ed0c23da as nil") - } - b.PutString(m.SenderName) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageOriginHiddenUser) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginHiddenUser#ed0c23da to nil") - } - if err := b.ConsumeID(MessageOriginHiddenUserTypeID); err != nil { - return fmt.Errorf("unable to decode messageOriginHiddenUser#ed0c23da: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageOriginHiddenUser) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginHiddenUser#ed0c23da to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageOriginHiddenUser#ed0c23da: field sender_name: %w", err) - } - m.SenderName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageOriginHiddenUser) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginHiddenUser#ed0c23da as nil") - } - b.ObjStart() - b.PutID("messageOriginHiddenUser") - b.Comma() - b.FieldStart("sender_name") - b.PutString(m.SenderName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageOriginHiddenUser) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginHiddenUser#ed0c23da to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageOriginHiddenUser"); err != nil { - return fmt.Errorf("unable to decode messageOriginHiddenUser#ed0c23da: %w", err) - } - case "sender_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageOriginHiddenUser#ed0c23da: field sender_name: %w", err) - } - m.SenderName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderName returns value of SenderName field. -func (m *MessageOriginHiddenUser) GetSenderName() (value string) { - if m == nil { - return - } - return m.SenderName -} - -// MessageOriginChat represents TL type `messageOriginChat#f3bb5eb4`. -type MessageOriginChat struct { - // Identifier of the chat that originally sent the message - SenderChatID int64 - // For messages originally sent by an anonymous chat administrator, original message - // author signature - AuthorSignature string -} - -// MessageOriginChatTypeID is TL type id of MessageOriginChat. -const MessageOriginChatTypeID = 0xf3bb5eb4 - -// construct implements constructor of MessageOriginClass. -func (m MessageOriginChat) construct() MessageOriginClass { return &m } - -// Ensuring interfaces in compile-time for MessageOriginChat. -var ( - _ bin.Encoder = &MessageOriginChat{} - _ bin.Decoder = &MessageOriginChat{} - _ bin.BareEncoder = &MessageOriginChat{} - _ bin.BareDecoder = &MessageOriginChat{} - - _ MessageOriginClass = &MessageOriginChat{} -) - -func (m *MessageOriginChat) Zero() bool { - if m == nil { - return true - } - if !(m.SenderChatID == 0) { - return false - } - if !(m.AuthorSignature == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageOriginChat) String() string { - if m == nil { - return "MessageOriginChat(nil)" - } - type Alias MessageOriginChat - return fmt.Sprintf("MessageOriginChat%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageOriginChat) TypeID() uint32 { - return MessageOriginChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageOriginChat) TypeName() string { - return "messageOriginChat" -} - -// TypeInfo returns info about TL type. -func (m *MessageOriginChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageOriginChat", - ID: MessageOriginChatTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderChatID", - SchemaName: "sender_chat_id", - }, - { - Name: "AuthorSignature", - SchemaName: "author_signature", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageOriginChat) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginChat#f3bb5eb4 as nil") - } - b.PutID(MessageOriginChatTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageOriginChat) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginChat#f3bb5eb4 as nil") - } - b.PutInt53(m.SenderChatID) - b.PutString(m.AuthorSignature) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageOriginChat) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginChat#f3bb5eb4 to nil") - } - if err := b.ConsumeID(MessageOriginChatTypeID); err != nil { - return fmt.Errorf("unable to decode messageOriginChat#f3bb5eb4: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageOriginChat) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginChat#f3bb5eb4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageOriginChat#f3bb5eb4: field sender_chat_id: %w", err) - } - m.SenderChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageOriginChat#f3bb5eb4: field author_signature: %w", err) - } - m.AuthorSignature = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageOriginChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginChat#f3bb5eb4 as nil") - } - b.ObjStart() - b.PutID("messageOriginChat") - b.Comma() - b.FieldStart("sender_chat_id") - b.PutInt53(m.SenderChatID) - b.Comma() - b.FieldStart("author_signature") - b.PutString(m.AuthorSignature) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageOriginChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginChat#f3bb5eb4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageOriginChat"); err != nil { - return fmt.Errorf("unable to decode messageOriginChat#f3bb5eb4: %w", err) - } - case "sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageOriginChat#f3bb5eb4: field sender_chat_id: %w", err) - } - m.SenderChatID = value - case "author_signature": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageOriginChat#f3bb5eb4: field author_signature: %w", err) - } - m.AuthorSignature = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderChatID returns value of SenderChatID field. -func (m *MessageOriginChat) GetSenderChatID() (value int64) { - if m == nil { - return - } - return m.SenderChatID -} - -// GetAuthorSignature returns value of AuthorSignature field. -func (m *MessageOriginChat) GetAuthorSignature() (value string) { - if m == nil { - return - } - return m.AuthorSignature -} - -// MessageOriginChannel represents TL type `messageOriginChannel#a97b51be`. -type MessageOriginChannel struct { - // Identifier of the channel chat to which the message was originally sent - ChatID int64 - // Message identifier of the original message - MessageID int64 - // Original post author signature - AuthorSignature string -} - -// MessageOriginChannelTypeID is TL type id of MessageOriginChannel. -const MessageOriginChannelTypeID = 0xa97b51be - -// construct implements constructor of MessageOriginClass. -func (m MessageOriginChannel) construct() MessageOriginClass { return &m } - -// Ensuring interfaces in compile-time for MessageOriginChannel. -var ( - _ bin.Encoder = &MessageOriginChannel{} - _ bin.Decoder = &MessageOriginChannel{} - _ bin.BareEncoder = &MessageOriginChannel{} - _ bin.BareDecoder = &MessageOriginChannel{} - - _ MessageOriginClass = &MessageOriginChannel{} -) - -func (m *MessageOriginChannel) Zero() bool { - if m == nil { - return true - } - if !(m.ChatID == 0) { - return false - } - if !(m.MessageID == 0) { - return false - } - if !(m.AuthorSignature == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageOriginChannel) String() string { - if m == nil { - return "MessageOriginChannel(nil)" - } - type Alias MessageOriginChannel - return fmt.Sprintf("MessageOriginChannel%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageOriginChannel) TypeID() uint32 { - return MessageOriginChannelTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageOriginChannel) TypeName() string { - return "messageOriginChannel" -} - -// TypeInfo returns info about TL type. -func (m *MessageOriginChannel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageOriginChannel", - ID: MessageOriginChannelTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "AuthorSignature", - SchemaName: "author_signature", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageOriginChannel) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginChannel#a97b51be as nil") - } - b.PutID(MessageOriginChannelTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageOriginChannel) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginChannel#a97b51be as nil") - } - b.PutInt53(m.ChatID) - b.PutInt53(m.MessageID) - b.PutString(m.AuthorSignature) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageOriginChannel) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginChannel#a97b51be to nil") - } - if err := b.ConsumeID(MessageOriginChannelTypeID); err != nil { - return fmt.Errorf("unable to decode messageOriginChannel#a97b51be: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageOriginChannel) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginChannel#a97b51be to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageOriginChannel#a97b51be: field chat_id: %w", err) - } - m.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageOriginChannel#a97b51be: field message_id: %w", err) - } - m.MessageID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageOriginChannel#a97b51be: field author_signature: %w", err) - } - m.AuthorSignature = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageOriginChannel) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageOriginChannel#a97b51be as nil") - } - b.ObjStart() - b.PutID("messageOriginChannel") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(m.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(m.MessageID) - b.Comma() - b.FieldStart("author_signature") - b.PutString(m.AuthorSignature) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageOriginChannel) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageOriginChannel#a97b51be to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageOriginChannel"); err != nil { - return fmt.Errorf("unable to decode messageOriginChannel#a97b51be: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageOriginChannel#a97b51be: field chat_id: %w", err) - } - m.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageOriginChannel#a97b51be: field message_id: %w", err) - } - m.MessageID = value - case "author_signature": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageOriginChannel#a97b51be: field author_signature: %w", err) - } - m.AuthorSignature = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (m *MessageOriginChannel) GetChatID() (value int64) { - if m == nil { - return - } - return m.ChatID -} - -// GetMessageID returns value of MessageID field. -func (m *MessageOriginChannel) GetMessageID() (value int64) { - if m == nil { - return - } - return m.MessageID -} - -// GetAuthorSignature returns value of AuthorSignature field. -func (m *MessageOriginChannel) GetAuthorSignature() (value string) { - if m == nil { - return - } - return m.AuthorSignature -} - -// MessageOriginClassName is schema name of MessageOriginClass. -const MessageOriginClassName = "MessageOrigin" - -// MessageOriginClass represents MessageOrigin generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageOrigin(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageOriginUser: // messageOriginUser#9c009043 -// case *tdapi.MessageOriginHiddenUser: // messageOriginHiddenUser#ed0c23da -// case *tdapi.MessageOriginChat: // messageOriginChat#f3bb5eb4 -// case *tdapi.MessageOriginChannel: // messageOriginChannel#a97b51be -// default: panic(v) -// } -type MessageOriginClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageOriginClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMessageOrigin implements binary de-serialization for MessageOriginClass. -func DecodeMessageOrigin(buf *bin.Buffer) (MessageOriginClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageOriginUserTypeID: - // Decoding messageOriginUser#9c009043. - v := MessageOriginUser{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageOriginClass: %w", err) - } - return &v, nil - case MessageOriginHiddenUserTypeID: - // Decoding messageOriginHiddenUser#ed0c23da. - v := MessageOriginHiddenUser{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageOriginClass: %w", err) - } - return &v, nil - case MessageOriginChatTypeID: - // Decoding messageOriginChat#f3bb5eb4. - v := MessageOriginChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageOriginClass: %w", err) - } - return &v, nil - case MessageOriginChannelTypeID: - // Decoding messageOriginChannel#a97b51be. - v := MessageOriginChannel{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageOriginClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageOriginClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageOrigin implements binary de-serialization for MessageOriginClass. -func DecodeTDLibJSONMessageOrigin(buf tdjson.Decoder) (MessageOriginClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageOriginUser": - // Decoding messageOriginUser#9c009043. - v := MessageOriginUser{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageOriginClass: %w", err) - } - return &v, nil - case "messageOriginHiddenUser": - // Decoding messageOriginHiddenUser#ed0c23da. - v := MessageOriginHiddenUser{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageOriginClass: %w", err) - } - return &v, nil - case "messageOriginChat": - // Decoding messageOriginChat#f3bb5eb4. - v := MessageOriginChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageOriginClass: %w", err) - } - return &v, nil - case "messageOriginChannel": - // Decoding messageOriginChannel#a97b51be. - v := MessageOriginChannel{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageOriginClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageOriginClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageOrigin boxes the MessageOriginClass providing a helper. -type MessageOriginBox struct { - MessageOrigin MessageOriginClass -} - -// Decode implements bin.Decoder for MessageOriginBox. -func (b *MessageOriginBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageOriginBox to nil") - } - v, err := DecodeMessageOrigin(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageOrigin = v - return nil -} - -// Encode implements bin.Encode for MessageOriginBox. -func (b *MessageOriginBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageOrigin == nil { - return fmt.Errorf("unable to encode MessageOriginClass as nil") - } - return b.MessageOrigin.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageOriginBox. -func (b *MessageOriginBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageOriginBox to nil") - } - v, err := DecodeTDLibJSONMessageOrigin(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageOrigin = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageOriginBox. -func (b *MessageOriginBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageOrigin == nil { - return fmt.Errorf("unable to encode MessageOriginClass as nil") - } - return b.MessageOrigin.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_message_position_gen.go b/tdapi/tl_message_position_gen.go deleted file mode 100644 index bac291baa..000000000 --- a/tdapi/tl_message_position_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessagePosition represents TL type `messagePosition#4d0540ef`. -type MessagePosition struct { - // 0-based message position in the full list of suitable messages - Position int32 - // Message identifier - MessageID int64 - // Point in time (Unix timestamp) when the message was sent - Date int32 -} - -// MessagePositionTypeID is TL type id of MessagePosition. -const MessagePositionTypeID = 0x4d0540ef - -// Ensuring interfaces in compile-time for MessagePosition. -var ( - _ bin.Encoder = &MessagePosition{} - _ bin.Decoder = &MessagePosition{} - _ bin.BareEncoder = &MessagePosition{} - _ bin.BareDecoder = &MessagePosition{} -) - -func (m *MessagePosition) Zero() bool { - if m == nil { - return true - } - if !(m.Position == 0) { - return false - } - if !(m.MessageID == 0) { - return false - } - if !(m.Date == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePosition) String() string { - if m == nil { - return "MessagePosition(nil)" - } - type Alias MessagePosition - return fmt.Sprintf("MessagePosition%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePosition) TypeID() uint32 { - return MessagePositionTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePosition) TypeName() string { - return "messagePosition" -} - -// TypeInfo returns info about TL type. -func (m *MessagePosition) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePosition", - ID: MessagePositionTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Position", - SchemaName: "position", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Date", - SchemaName: "date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePosition) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePosition#4d0540ef as nil") - } - b.PutID(MessagePositionTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePosition) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePosition#4d0540ef as nil") - } - b.PutInt32(m.Position) - b.PutInt53(m.MessageID) - b.PutInt32(m.Date) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePosition) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePosition#4d0540ef to nil") - } - if err := b.ConsumeID(MessagePositionTypeID); err != nil { - return fmt.Errorf("unable to decode messagePosition#4d0540ef: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePosition) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePosition#4d0540ef to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePosition#4d0540ef: field position: %w", err) - } - m.Position = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePosition#4d0540ef: field message_id: %w", err) - } - m.MessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePosition#4d0540ef: field date: %w", err) - } - m.Date = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePosition) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePosition#4d0540ef as nil") - } - b.ObjStart() - b.PutID("messagePosition") - b.Comma() - b.FieldStart("position") - b.PutInt32(m.Position) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(m.MessageID) - b.Comma() - b.FieldStart("date") - b.PutInt32(m.Date) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePosition) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePosition#4d0540ef to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePosition"); err != nil { - return fmt.Errorf("unable to decode messagePosition#4d0540ef: %w", err) - } - case "position": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePosition#4d0540ef: field position: %w", err) - } - m.Position = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messagePosition#4d0540ef: field message_id: %w", err) - } - m.MessageID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePosition#4d0540ef: field date: %w", err) - } - m.Date = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPosition returns value of Position field. -func (m *MessagePosition) GetPosition() (value int32) { - if m == nil { - return - } - return m.Position -} - -// GetMessageID returns value of MessageID field. -func (m *MessagePosition) GetMessageID() (value int64) { - if m == nil { - return - } - return m.MessageID -} - -// GetDate returns value of Date field. -func (m *MessagePosition) GetDate() (value int32) { - if m == nil { - return - } - return m.Date -} diff --git a/tdapi/tl_message_positions_gen.go b/tdapi/tl_message_positions_gen.go deleted file mode 100644 index 1de496225..000000000 --- a/tdapi/tl_message_positions_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessagePositions represents TL type `messagePositions#912eab72`. -type MessagePositions struct { - // Total number of messages found - TotalCount int32 - // List of message positions - Positions []MessagePosition -} - -// MessagePositionsTypeID is TL type id of MessagePositions. -const MessagePositionsTypeID = 0x912eab72 - -// Ensuring interfaces in compile-time for MessagePositions. -var ( - _ bin.Encoder = &MessagePositions{} - _ bin.Decoder = &MessagePositions{} - _ bin.BareEncoder = &MessagePositions{} - _ bin.BareDecoder = &MessagePositions{} -) - -func (m *MessagePositions) Zero() bool { - if m == nil { - return true - } - if !(m.TotalCount == 0) { - return false - } - if !(m.Positions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessagePositions) String() string { - if m == nil { - return "MessagePositions(nil)" - } - type Alias MessagePositions - return fmt.Sprintf("MessagePositions%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessagePositions) TypeID() uint32 { - return MessagePositionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessagePositions) TypeName() string { - return "messagePositions" -} - -// TypeInfo returns info about TL type. -func (m *MessagePositions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messagePositions", - ID: MessagePositionsTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Positions", - SchemaName: "positions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessagePositions) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePositions#912eab72 as nil") - } - b.PutID(MessagePositionsTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessagePositions) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messagePositions#912eab72 as nil") - } - b.PutInt32(m.TotalCount) - b.PutInt(len(m.Positions)) - for idx, v := range m.Positions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messagePositions#912eab72: field positions element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessagePositions) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePositions#912eab72 to nil") - } - if err := b.ConsumeID(MessagePositionsTypeID); err != nil { - return fmt.Errorf("unable to decode messagePositions#912eab72: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessagePositions) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messagePositions#912eab72 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePositions#912eab72: field total_count: %w", err) - } - m.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messagePositions#912eab72: field positions: %w", err) - } - - if headerLen > 0 { - m.Positions = make([]MessagePosition, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value MessagePosition - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare messagePositions#912eab72: field positions: %w", err) - } - m.Positions = append(m.Positions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessagePositions) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messagePositions#912eab72 as nil") - } - b.ObjStart() - b.PutID("messagePositions") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(m.TotalCount) - b.Comma() - b.FieldStart("positions") - b.ArrStart() - for idx, v := range m.Positions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messagePositions#912eab72: field positions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessagePositions) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messagePositions#912eab72 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messagePositions"); err != nil { - return fmt.Errorf("unable to decode messagePositions#912eab72: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messagePositions#912eab72: field total_count: %w", err) - } - m.TotalCount = value - case "positions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value MessagePosition - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messagePositions#912eab72: field positions: %w", err) - } - m.Positions = append(m.Positions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messagePositions#912eab72: field positions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (m *MessagePositions) GetTotalCount() (value int32) { - if m == nil { - return - } - return m.TotalCount -} - -// GetPositions returns value of Positions field. -func (m *MessagePositions) GetPositions() (value []MessagePosition) { - if m == nil { - return - } - return m.Positions -} diff --git a/tdapi/tl_message_properties_gen.go b/tdapi/tl_message_properties_gen.go deleted file mode 100644 index ff46ed1ce..000000000 --- a/tdapi/tl_message_properties_gen.go +++ /dev/null @@ -1,1055 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageProperties represents TL type `messageProperties#fe63ca01`. -type MessageProperties struct { - // True, if content of the message can be copied to a secret chat using - // inputMessageForwarded or forwardMessages with copy options - CanBeCopiedToSecretChat bool - // True, if the message can be deleted only for the current user while other users will - // continue to see it using the method deleteMessages with revoke == false - CanBeDeletedOnlyForSelf bool - // True, if the message can be deleted for all users using the method deleteMessages with - // revoke == true - CanBeDeletedForAllUsers bool - // True, if the message can be edited using the methods editMessageText, - // editMessageCaption, or editMessageReplyMarkup. - CanBeEdited bool - // True, if the message can be forwarded using inputMessageForwarded or forwardMessages - CanBeForwarded bool - // True, if the message can be paid using inputInvoiceMessage - CanBePaid bool - // True, if the message can be pinned or unpinned in the chat using pinChatMessage or - // unpinChatMessage - CanBePinned bool - // True, if the message can be replied in the same chat and forum topic using - // inputMessageReplyToMessage - CanBeReplied bool - // True, if the message can be replied in another chat or forum topic using - // inputMessageReplyToExternalMessage - CanBeRepliedInAnotherChat bool - // True, if content of the message can be saved locally or copied using - // inputMessageForwarded or forwardMessages with copy options - CanBeSaved bool - // True, if the message can be shared in a story using inputStoryAreaTypeMessage - CanBeSharedInStory bool - // True, if the message can be edited using the method editMessageMedia - CanEditMedia bool - // True, if scheduling state of the message can be edited - CanEditSchedulingState bool - // True, if code for message embedding can be received using getMessageEmbeddingCode - CanGetEmbeddingCode bool - // True, if a link can be generated for the message using getMessageLink - CanGetLink bool - // True, if media timestamp links can be generated for media timestamp entities in the - // message text, caption or link preview description using getMessageLink - CanGetMediaTimestampLinks bool - // True, if information about the message thread is available through getMessageThread - // and getMessageThreadHistory - CanGetMessageThread bool - // True, if read date of the message can be received through getMessageReadDate - CanGetReadDate bool - // True, if message statistics are available through getMessageStatistics and message - // forwards can be received using getMessagePublicForwards - CanGetStatistics bool - // True, if chat members already viewed the message can be received through - // getMessageViewers - CanGetViewers bool - // True, if speech can be recognized for the message through recognizeSpeech - CanRecognizeSpeech bool - // True, if the message can be reported using reportChat - CanReportChat bool - // True, if reactions on the message can be reported through reportMessageReactions - CanReportReactions bool - // True, if the message can be reported using reportSupergroupSpam - CanReportSupergroupSpam bool - // True, if fact check for the message can be changed through setMessageFactCheck - CanSetFactCheck bool - // True, if message statistics must be available from context menu of the message - NeedShowStatistics bool -} - -// MessagePropertiesTypeID is TL type id of MessageProperties. -const MessagePropertiesTypeID = 0xfe63ca01 - -// Ensuring interfaces in compile-time for MessageProperties. -var ( - _ bin.Encoder = &MessageProperties{} - _ bin.Decoder = &MessageProperties{} - _ bin.BareEncoder = &MessageProperties{} - _ bin.BareDecoder = &MessageProperties{} -) - -func (m *MessageProperties) Zero() bool { - if m == nil { - return true - } - if !(m.CanBeCopiedToSecretChat == false) { - return false - } - if !(m.CanBeDeletedOnlyForSelf == false) { - return false - } - if !(m.CanBeDeletedForAllUsers == false) { - return false - } - if !(m.CanBeEdited == false) { - return false - } - if !(m.CanBeForwarded == false) { - return false - } - if !(m.CanBePaid == false) { - return false - } - if !(m.CanBePinned == false) { - return false - } - if !(m.CanBeReplied == false) { - return false - } - if !(m.CanBeRepliedInAnotherChat == false) { - return false - } - if !(m.CanBeSaved == false) { - return false - } - if !(m.CanBeSharedInStory == false) { - return false - } - if !(m.CanEditMedia == false) { - return false - } - if !(m.CanEditSchedulingState == false) { - return false - } - if !(m.CanGetEmbeddingCode == false) { - return false - } - if !(m.CanGetLink == false) { - return false - } - if !(m.CanGetMediaTimestampLinks == false) { - return false - } - if !(m.CanGetMessageThread == false) { - return false - } - if !(m.CanGetReadDate == false) { - return false - } - if !(m.CanGetStatistics == false) { - return false - } - if !(m.CanGetViewers == false) { - return false - } - if !(m.CanRecognizeSpeech == false) { - return false - } - if !(m.CanReportChat == false) { - return false - } - if !(m.CanReportReactions == false) { - return false - } - if !(m.CanReportSupergroupSpam == false) { - return false - } - if !(m.CanSetFactCheck == false) { - return false - } - if !(m.NeedShowStatistics == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageProperties) String() string { - if m == nil { - return "MessageProperties(nil)" - } - type Alias MessageProperties - return fmt.Sprintf("MessageProperties%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageProperties) TypeID() uint32 { - return MessagePropertiesTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageProperties) TypeName() string { - return "messageProperties" -} - -// TypeInfo returns info about TL type. -func (m *MessageProperties) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageProperties", - ID: MessagePropertiesTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CanBeCopiedToSecretChat", - SchemaName: "can_be_copied_to_secret_chat", - }, - { - Name: "CanBeDeletedOnlyForSelf", - SchemaName: "can_be_deleted_only_for_self", - }, - { - Name: "CanBeDeletedForAllUsers", - SchemaName: "can_be_deleted_for_all_users", - }, - { - Name: "CanBeEdited", - SchemaName: "can_be_edited", - }, - { - Name: "CanBeForwarded", - SchemaName: "can_be_forwarded", - }, - { - Name: "CanBePaid", - SchemaName: "can_be_paid", - }, - { - Name: "CanBePinned", - SchemaName: "can_be_pinned", - }, - { - Name: "CanBeReplied", - SchemaName: "can_be_replied", - }, - { - Name: "CanBeRepliedInAnotherChat", - SchemaName: "can_be_replied_in_another_chat", - }, - { - Name: "CanBeSaved", - SchemaName: "can_be_saved", - }, - { - Name: "CanBeSharedInStory", - SchemaName: "can_be_shared_in_story", - }, - { - Name: "CanEditMedia", - SchemaName: "can_edit_media", - }, - { - Name: "CanEditSchedulingState", - SchemaName: "can_edit_scheduling_state", - }, - { - Name: "CanGetEmbeddingCode", - SchemaName: "can_get_embedding_code", - }, - { - Name: "CanGetLink", - SchemaName: "can_get_link", - }, - { - Name: "CanGetMediaTimestampLinks", - SchemaName: "can_get_media_timestamp_links", - }, - { - Name: "CanGetMessageThread", - SchemaName: "can_get_message_thread", - }, - { - Name: "CanGetReadDate", - SchemaName: "can_get_read_date", - }, - { - Name: "CanGetStatistics", - SchemaName: "can_get_statistics", - }, - { - Name: "CanGetViewers", - SchemaName: "can_get_viewers", - }, - { - Name: "CanRecognizeSpeech", - SchemaName: "can_recognize_speech", - }, - { - Name: "CanReportChat", - SchemaName: "can_report_chat", - }, - { - Name: "CanReportReactions", - SchemaName: "can_report_reactions", - }, - { - Name: "CanReportSupergroupSpam", - SchemaName: "can_report_supergroup_spam", - }, - { - Name: "CanSetFactCheck", - SchemaName: "can_set_fact_check", - }, - { - Name: "NeedShowStatistics", - SchemaName: "need_show_statistics", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageProperties) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageProperties#fe63ca01 as nil") - } - b.PutID(MessagePropertiesTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageProperties) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageProperties#fe63ca01 as nil") - } - b.PutBool(m.CanBeCopiedToSecretChat) - b.PutBool(m.CanBeDeletedOnlyForSelf) - b.PutBool(m.CanBeDeletedForAllUsers) - b.PutBool(m.CanBeEdited) - b.PutBool(m.CanBeForwarded) - b.PutBool(m.CanBePaid) - b.PutBool(m.CanBePinned) - b.PutBool(m.CanBeReplied) - b.PutBool(m.CanBeRepliedInAnotherChat) - b.PutBool(m.CanBeSaved) - b.PutBool(m.CanBeSharedInStory) - b.PutBool(m.CanEditMedia) - b.PutBool(m.CanEditSchedulingState) - b.PutBool(m.CanGetEmbeddingCode) - b.PutBool(m.CanGetLink) - b.PutBool(m.CanGetMediaTimestampLinks) - b.PutBool(m.CanGetMessageThread) - b.PutBool(m.CanGetReadDate) - b.PutBool(m.CanGetStatistics) - b.PutBool(m.CanGetViewers) - b.PutBool(m.CanRecognizeSpeech) - b.PutBool(m.CanReportChat) - b.PutBool(m.CanReportReactions) - b.PutBool(m.CanReportSupergroupSpam) - b.PutBool(m.CanSetFactCheck) - b.PutBool(m.NeedShowStatistics) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageProperties) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageProperties#fe63ca01 to nil") - } - if err := b.ConsumeID(MessagePropertiesTypeID); err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageProperties) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageProperties#fe63ca01 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_copied_to_secret_chat: %w", err) - } - m.CanBeCopiedToSecretChat = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_deleted_only_for_self: %w", err) - } - m.CanBeDeletedOnlyForSelf = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_deleted_for_all_users: %w", err) - } - m.CanBeDeletedForAllUsers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_edited: %w", err) - } - m.CanBeEdited = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_forwarded: %w", err) - } - m.CanBeForwarded = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_paid: %w", err) - } - m.CanBePaid = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_pinned: %w", err) - } - m.CanBePinned = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_replied: %w", err) - } - m.CanBeReplied = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_replied_in_another_chat: %w", err) - } - m.CanBeRepliedInAnotherChat = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_saved: %w", err) - } - m.CanBeSaved = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_shared_in_story: %w", err) - } - m.CanBeSharedInStory = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_edit_media: %w", err) - } - m.CanEditMedia = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_edit_scheduling_state: %w", err) - } - m.CanEditSchedulingState = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_embedding_code: %w", err) - } - m.CanGetEmbeddingCode = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_link: %w", err) - } - m.CanGetLink = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_media_timestamp_links: %w", err) - } - m.CanGetMediaTimestampLinks = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_message_thread: %w", err) - } - m.CanGetMessageThread = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_read_date: %w", err) - } - m.CanGetReadDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_statistics: %w", err) - } - m.CanGetStatistics = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_viewers: %w", err) - } - m.CanGetViewers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_recognize_speech: %w", err) - } - m.CanRecognizeSpeech = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_report_chat: %w", err) - } - m.CanReportChat = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_report_reactions: %w", err) - } - m.CanReportReactions = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_report_supergroup_spam: %w", err) - } - m.CanReportSupergroupSpam = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_set_fact_check: %w", err) - } - m.CanSetFactCheck = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field need_show_statistics: %w", err) - } - m.NeedShowStatistics = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageProperties) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageProperties#fe63ca01 as nil") - } - b.ObjStart() - b.PutID("messageProperties") - b.Comma() - b.FieldStart("can_be_copied_to_secret_chat") - b.PutBool(m.CanBeCopiedToSecretChat) - b.Comma() - b.FieldStart("can_be_deleted_only_for_self") - b.PutBool(m.CanBeDeletedOnlyForSelf) - b.Comma() - b.FieldStart("can_be_deleted_for_all_users") - b.PutBool(m.CanBeDeletedForAllUsers) - b.Comma() - b.FieldStart("can_be_edited") - b.PutBool(m.CanBeEdited) - b.Comma() - b.FieldStart("can_be_forwarded") - b.PutBool(m.CanBeForwarded) - b.Comma() - b.FieldStart("can_be_paid") - b.PutBool(m.CanBePaid) - b.Comma() - b.FieldStart("can_be_pinned") - b.PutBool(m.CanBePinned) - b.Comma() - b.FieldStart("can_be_replied") - b.PutBool(m.CanBeReplied) - b.Comma() - b.FieldStart("can_be_replied_in_another_chat") - b.PutBool(m.CanBeRepliedInAnotherChat) - b.Comma() - b.FieldStart("can_be_saved") - b.PutBool(m.CanBeSaved) - b.Comma() - b.FieldStart("can_be_shared_in_story") - b.PutBool(m.CanBeSharedInStory) - b.Comma() - b.FieldStart("can_edit_media") - b.PutBool(m.CanEditMedia) - b.Comma() - b.FieldStart("can_edit_scheduling_state") - b.PutBool(m.CanEditSchedulingState) - b.Comma() - b.FieldStart("can_get_embedding_code") - b.PutBool(m.CanGetEmbeddingCode) - b.Comma() - b.FieldStart("can_get_link") - b.PutBool(m.CanGetLink) - b.Comma() - b.FieldStart("can_get_media_timestamp_links") - b.PutBool(m.CanGetMediaTimestampLinks) - b.Comma() - b.FieldStart("can_get_message_thread") - b.PutBool(m.CanGetMessageThread) - b.Comma() - b.FieldStart("can_get_read_date") - b.PutBool(m.CanGetReadDate) - b.Comma() - b.FieldStart("can_get_statistics") - b.PutBool(m.CanGetStatistics) - b.Comma() - b.FieldStart("can_get_viewers") - b.PutBool(m.CanGetViewers) - b.Comma() - b.FieldStart("can_recognize_speech") - b.PutBool(m.CanRecognizeSpeech) - b.Comma() - b.FieldStart("can_report_chat") - b.PutBool(m.CanReportChat) - b.Comma() - b.FieldStart("can_report_reactions") - b.PutBool(m.CanReportReactions) - b.Comma() - b.FieldStart("can_report_supergroup_spam") - b.PutBool(m.CanReportSupergroupSpam) - b.Comma() - b.FieldStart("can_set_fact_check") - b.PutBool(m.CanSetFactCheck) - b.Comma() - b.FieldStart("need_show_statistics") - b.PutBool(m.NeedShowStatistics) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageProperties) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageProperties#fe63ca01 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageProperties"); err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: %w", err) - } - case "can_be_copied_to_secret_chat": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_copied_to_secret_chat: %w", err) - } - m.CanBeCopiedToSecretChat = value - case "can_be_deleted_only_for_self": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_deleted_only_for_self: %w", err) - } - m.CanBeDeletedOnlyForSelf = value - case "can_be_deleted_for_all_users": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_deleted_for_all_users: %w", err) - } - m.CanBeDeletedForAllUsers = value - case "can_be_edited": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_edited: %w", err) - } - m.CanBeEdited = value - case "can_be_forwarded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_forwarded: %w", err) - } - m.CanBeForwarded = value - case "can_be_paid": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_paid: %w", err) - } - m.CanBePaid = value - case "can_be_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_pinned: %w", err) - } - m.CanBePinned = value - case "can_be_replied": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_replied: %w", err) - } - m.CanBeReplied = value - case "can_be_replied_in_another_chat": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_replied_in_another_chat: %w", err) - } - m.CanBeRepliedInAnotherChat = value - case "can_be_saved": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_saved: %w", err) - } - m.CanBeSaved = value - case "can_be_shared_in_story": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_be_shared_in_story: %w", err) - } - m.CanBeSharedInStory = value - case "can_edit_media": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_edit_media: %w", err) - } - m.CanEditMedia = value - case "can_edit_scheduling_state": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_edit_scheduling_state: %w", err) - } - m.CanEditSchedulingState = value - case "can_get_embedding_code": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_embedding_code: %w", err) - } - m.CanGetEmbeddingCode = value - case "can_get_link": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_link: %w", err) - } - m.CanGetLink = value - case "can_get_media_timestamp_links": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_media_timestamp_links: %w", err) - } - m.CanGetMediaTimestampLinks = value - case "can_get_message_thread": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_message_thread: %w", err) - } - m.CanGetMessageThread = value - case "can_get_read_date": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_read_date: %w", err) - } - m.CanGetReadDate = value - case "can_get_statistics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_statistics: %w", err) - } - m.CanGetStatistics = value - case "can_get_viewers": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_get_viewers: %w", err) - } - m.CanGetViewers = value - case "can_recognize_speech": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_recognize_speech: %w", err) - } - m.CanRecognizeSpeech = value - case "can_report_chat": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_report_chat: %w", err) - } - m.CanReportChat = value - case "can_report_reactions": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_report_reactions: %w", err) - } - m.CanReportReactions = value - case "can_report_supergroup_spam": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_report_supergroup_spam: %w", err) - } - m.CanReportSupergroupSpam = value - case "can_set_fact_check": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field can_set_fact_check: %w", err) - } - m.CanSetFactCheck = value - case "need_show_statistics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageProperties#fe63ca01: field need_show_statistics: %w", err) - } - m.NeedShowStatistics = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCanBeCopiedToSecretChat returns value of CanBeCopiedToSecretChat field. -func (m *MessageProperties) GetCanBeCopiedToSecretChat() (value bool) { - if m == nil { - return - } - return m.CanBeCopiedToSecretChat -} - -// GetCanBeDeletedOnlyForSelf returns value of CanBeDeletedOnlyForSelf field. -func (m *MessageProperties) GetCanBeDeletedOnlyForSelf() (value bool) { - if m == nil { - return - } - return m.CanBeDeletedOnlyForSelf -} - -// GetCanBeDeletedForAllUsers returns value of CanBeDeletedForAllUsers field. -func (m *MessageProperties) GetCanBeDeletedForAllUsers() (value bool) { - if m == nil { - return - } - return m.CanBeDeletedForAllUsers -} - -// GetCanBeEdited returns value of CanBeEdited field. -func (m *MessageProperties) GetCanBeEdited() (value bool) { - if m == nil { - return - } - return m.CanBeEdited -} - -// GetCanBeForwarded returns value of CanBeForwarded field. -func (m *MessageProperties) GetCanBeForwarded() (value bool) { - if m == nil { - return - } - return m.CanBeForwarded -} - -// GetCanBePaid returns value of CanBePaid field. -func (m *MessageProperties) GetCanBePaid() (value bool) { - if m == nil { - return - } - return m.CanBePaid -} - -// GetCanBePinned returns value of CanBePinned field. -func (m *MessageProperties) GetCanBePinned() (value bool) { - if m == nil { - return - } - return m.CanBePinned -} - -// GetCanBeReplied returns value of CanBeReplied field. -func (m *MessageProperties) GetCanBeReplied() (value bool) { - if m == nil { - return - } - return m.CanBeReplied -} - -// GetCanBeRepliedInAnotherChat returns value of CanBeRepliedInAnotherChat field. -func (m *MessageProperties) GetCanBeRepliedInAnotherChat() (value bool) { - if m == nil { - return - } - return m.CanBeRepliedInAnotherChat -} - -// GetCanBeSaved returns value of CanBeSaved field. -func (m *MessageProperties) GetCanBeSaved() (value bool) { - if m == nil { - return - } - return m.CanBeSaved -} - -// GetCanBeSharedInStory returns value of CanBeSharedInStory field. -func (m *MessageProperties) GetCanBeSharedInStory() (value bool) { - if m == nil { - return - } - return m.CanBeSharedInStory -} - -// GetCanEditMedia returns value of CanEditMedia field. -func (m *MessageProperties) GetCanEditMedia() (value bool) { - if m == nil { - return - } - return m.CanEditMedia -} - -// GetCanEditSchedulingState returns value of CanEditSchedulingState field. -func (m *MessageProperties) GetCanEditSchedulingState() (value bool) { - if m == nil { - return - } - return m.CanEditSchedulingState -} - -// GetCanGetEmbeddingCode returns value of CanGetEmbeddingCode field. -func (m *MessageProperties) GetCanGetEmbeddingCode() (value bool) { - if m == nil { - return - } - return m.CanGetEmbeddingCode -} - -// GetCanGetLink returns value of CanGetLink field. -func (m *MessageProperties) GetCanGetLink() (value bool) { - if m == nil { - return - } - return m.CanGetLink -} - -// GetCanGetMediaTimestampLinks returns value of CanGetMediaTimestampLinks field. -func (m *MessageProperties) GetCanGetMediaTimestampLinks() (value bool) { - if m == nil { - return - } - return m.CanGetMediaTimestampLinks -} - -// GetCanGetMessageThread returns value of CanGetMessageThread field. -func (m *MessageProperties) GetCanGetMessageThread() (value bool) { - if m == nil { - return - } - return m.CanGetMessageThread -} - -// GetCanGetReadDate returns value of CanGetReadDate field. -func (m *MessageProperties) GetCanGetReadDate() (value bool) { - if m == nil { - return - } - return m.CanGetReadDate -} - -// GetCanGetStatistics returns value of CanGetStatistics field. -func (m *MessageProperties) GetCanGetStatistics() (value bool) { - if m == nil { - return - } - return m.CanGetStatistics -} - -// GetCanGetViewers returns value of CanGetViewers field. -func (m *MessageProperties) GetCanGetViewers() (value bool) { - if m == nil { - return - } - return m.CanGetViewers -} - -// GetCanRecognizeSpeech returns value of CanRecognizeSpeech field. -func (m *MessageProperties) GetCanRecognizeSpeech() (value bool) { - if m == nil { - return - } - return m.CanRecognizeSpeech -} - -// GetCanReportChat returns value of CanReportChat field. -func (m *MessageProperties) GetCanReportChat() (value bool) { - if m == nil { - return - } - return m.CanReportChat -} - -// GetCanReportReactions returns value of CanReportReactions field. -func (m *MessageProperties) GetCanReportReactions() (value bool) { - if m == nil { - return - } - return m.CanReportReactions -} - -// GetCanReportSupergroupSpam returns value of CanReportSupergroupSpam field. -func (m *MessageProperties) GetCanReportSupergroupSpam() (value bool) { - if m == nil { - return - } - return m.CanReportSupergroupSpam -} - -// GetCanSetFactCheck returns value of CanSetFactCheck field. -func (m *MessageProperties) GetCanSetFactCheck() (value bool) { - if m == nil { - return - } - return m.CanSetFactCheck -} - -// GetNeedShowStatistics returns value of NeedShowStatistics field. -func (m *MessageProperties) GetNeedShowStatistics() (value bool) { - if m == nil { - return - } - return m.NeedShowStatistics -} diff --git a/tdapi/tl_message_reaction_gen.go b/tdapi/tl_message_reaction_gen.go deleted file mode 100644 index a6eacb32c..000000000 --- a/tdapi/tl_message_reaction_gen.go +++ /dev/null @@ -1,385 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageReaction represents TL type `messageReaction#7d9e9864`. -type MessageReaction struct { - // Type of the reaction - Type ReactionTypeClass - // Number of times the reaction was added - TotalCount int32 - // True, if the reaction is chosen by the current user - IsChosen bool - // Identifier of the message sender used by the current user to add the reaction; may be - // null if unknown or the reaction isn't chosen - UsedSenderID MessageSenderClass - // Identifiers of at most 3 recent message senders, added the reaction; available in - // private, basic group and supergroup chats - RecentSenderIDs []MessageSenderClass -} - -// MessageReactionTypeID is TL type id of MessageReaction. -const MessageReactionTypeID = 0x7d9e9864 - -// Ensuring interfaces in compile-time for MessageReaction. -var ( - _ bin.Encoder = &MessageReaction{} - _ bin.Decoder = &MessageReaction{} - _ bin.BareEncoder = &MessageReaction{} - _ bin.BareDecoder = &MessageReaction{} -) - -func (m *MessageReaction) Zero() bool { - if m == nil { - return true - } - if !(m.Type == nil) { - return false - } - if !(m.TotalCount == 0) { - return false - } - if !(m.IsChosen == false) { - return false - } - if !(m.UsedSenderID == nil) { - return false - } - if !(m.RecentSenderIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageReaction) String() string { - if m == nil { - return "MessageReaction(nil)" - } - type Alias MessageReaction - return fmt.Sprintf("MessageReaction%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageReaction) TypeID() uint32 { - return MessageReactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageReaction) TypeName() string { - return "messageReaction" -} - -// TypeInfo returns info about TL type. -func (m *MessageReaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageReaction", - ID: MessageReactionTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "IsChosen", - SchemaName: "is_chosen", - }, - { - Name: "UsedSenderID", - SchemaName: "used_sender_id", - }, - { - Name: "RecentSenderIDs", - SchemaName: "recent_sender_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageReaction) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReaction#7d9e9864 as nil") - } - b.PutID(MessageReactionTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageReaction) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReaction#7d9e9864 as nil") - } - if m.Type == nil { - return fmt.Errorf("unable to encode messageReaction#7d9e9864: field type is nil") - } - if err := m.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReaction#7d9e9864: field type: %w", err) - } - b.PutInt32(m.TotalCount) - b.PutBool(m.IsChosen) - if m.UsedSenderID == nil { - return fmt.Errorf("unable to encode messageReaction#7d9e9864: field used_sender_id is nil") - } - if err := m.UsedSenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReaction#7d9e9864: field used_sender_id: %w", err) - } - b.PutInt(len(m.RecentSenderIDs)) - for idx, v := range m.RecentSenderIDs { - if v == nil { - return fmt.Errorf("unable to encode messageReaction#7d9e9864: field recent_sender_ids element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messageReaction#7d9e9864: field recent_sender_ids element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageReaction) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReaction#7d9e9864 to nil") - } - if err := b.ConsumeID(MessageReactionTypeID); err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageReaction) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReaction#7d9e9864 to nil") - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field type: %w", err) - } - m.Type = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field total_count: %w", err) - } - m.TotalCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field is_chosen: %w", err) - } - m.IsChosen = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field used_sender_id: %w", err) - } - m.UsedSenderID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field recent_sender_ids: %w", err) - } - - if headerLen > 0 { - m.RecentSenderIDs = make([]MessageSenderClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field recent_sender_ids: %w", err) - } - m.RecentSenderIDs = append(m.RecentSenderIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageReaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageReaction#7d9e9864 as nil") - } - b.ObjStart() - b.PutID("messageReaction") - b.Comma() - b.FieldStart("type") - if m.Type == nil { - return fmt.Errorf("unable to encode messageReaction#7d9e9864: field type is nil") - } - if err := m.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReaction#7d9e9864: field type: %w", err) - } - b.Comma() - b.FieldStart("total_count") - b.PutInt32(m.TotalCount) - b.Comma() - b.FieldStart("is_chosen") - b.PutBool(m.IsChosen) - b.Comma() - b.FieldStart("used_sender_id") - if m.UsedSenderID == nil { - return fmt.Errorf("unable to encode messageReaction#7d9e9864: field used_sender_id is nil") - } - if err := m.UsedSenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReaction#7d9e9864: field used_sender_id: %w", err) - } - b.Comma() - b.FieldStart("recent_sender_ids") - b.ArrStart() - for idx, v := range m.RecentSenderIDs { - if v == nil { - return fmt.Errorf("unable to encode messageReaction#7d9e9864: field recent_sender_ids element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReaction#7d9e9864: field recent_sender_ids element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageReaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageReaction#7d9e9864 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageReaction"); err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: %w", err) - } - case "type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field type: %w", err) - } - m.Type = value - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field total_count: %w", err) - } - m.TotalCount = value - case "is_chosen": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field is_chosen: %w", err) - } - m.IsChosen = value - case "used_sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field used_sender_id: %w", err) - } - m.UsedSenderID = value - case "recent_sender_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field recent_sender_ids: %w", err) - } - m.RecentSenderIDs = append(m.RecentSenderIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageReaction#7d9e9864: field recent_sender_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (m *MessageReaction) GetType() (value ReactionTypeClass) { - if m == nil { - return - } - return m.Type -} - -// GetTotalCount returns value of TotalCount field. -func (m *MessageReaction) GetTotalCount() (value int32) { - if m == nil { - return - } - return m.TotalCount -} - -// GetIsChosen returns value of IsChosen field. -func (m *MessageReaction) GetIsChosen() (value bool) { - if m == nil { - return - } - return m.IsChosen -} - -// GetUsedSenderID returns value of UsedSenderID field. -func (m *MessageReaction) GetUsedSenderID() (value MessageSenderClass) { - if m == nil { - return - } - return m.UsedSenderID -} - -// GetRecentSenderIDs returns value of RecentSenderIDs field. -func (m *MessageReaction) GetRecentSenderIDs() (value []MessageSenderClass) { - if m == nil { - return - } - return m.RecentSenderIDs -} diff --git a/tdapi/tl_message_reactions_gen.go b/tdapi/tl_message_reactions_gen.go deleted file mode 100644 index 810cd2cd7..000000000 --- a/tdapi/tl_message_reactions_gen.go +++ /dev/null @@ -1,351 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageReactions represents TL type `messageReactions#9d558cb`. -type MessageReactions struct { - // List of added reactions - Reactions []MessageReaction - // True, if the reactions are tags and Telegram Premium users can filter messages by them - AreTags bool - // Information about top users that added the paid reaction - PaidReactors []PaidReactor - // True, if the list of added reactions is available using getMessageAddedReactions - CanGetAddedReactions bool -} - -// MessageReactionsTypeID is TL type id of MessageReactions. -const MessageReactionsTypeID = 0x9d558cb - -// Ensuring interfaces in compile-time for MessageReactions. -var ( - _ bin.Encoder = &MessageReactions{} - _ bin.Decoder = &MessageReactions{} - _ bin.BareEncoder = &MessageReactions{} - _ bin.BareDecoder = &MessageReactions{} -) - -func (m *MessageReactions) Zero() bool { - if m == nil { - return true - } - if !(m.Reactions == nil) { - return false - } - if !(m.AreTags == false) { - return false - } - if !(m.PaidReactors == nil) { - return false - } - if !(m.CanGetAddedReactions == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageReactions) String() string { - if m == nil { - return "MessageReactions(nil)" - } - type Alias MessageReactions - return fmt.Sprintf("MessageReactions%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageReactions) TypeID() uint32 { - return MessageReactionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageReactions) TypeName() string { - return "messageReactions" -} - -// TypeInfo returns info about TL type. -func (m *MessageReactions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageReactions", - ID: MessageReactionsTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Reactions", - SchemaName: "reactions", - }, - { - Name: "AreTags", - SchemaName: "are_tags", - }, - { - Name: "PaidReactors", - SchemaName: "paid_reactors", - }, - { - Name: "CanGetAddedReactions", - SchemaName: "can_get_added_reactions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageReactions) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReactions#9d558cb as nil") - } - b.PutID(MessageReactionsTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageReactions) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReactions#9d558cb as nil") - } - b.PutInt(len(m.Reactions)) - for idx, v := range m.Reactions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messageReactions#9d558cb: field reactions element with index %d: %w", idx, err) - } - } - b.PutBool(m.AreTags) - b.PutInt(len(m.PaidReactors)) - for idx, v := range m.PaidReactors { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messageReactions#9d558cb: field paid_reactors element with index %d: %w", idx, err) - } - } - b.PutBool(m.CanGetAddedReactions) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageReactions) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReactions#9d558cb to nil") - } - if err := b.ConsumeID(MessageReactionsTypeID); err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageReactions) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReactions#9d558cb to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: field reactions: %w", err) - } - - if headerLen > 0 { - m.Reactions = make([]MessageReaction, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value MessageReaction - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare messageReactions#9d558cb: field reactions: %w", err) - } - m.Reactions = append(m.Reactions, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: field are_tags: %w", err) - } - m.AreTags = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: field paid_reactors: %w", err) - } - - if headerLen > 0 { - m.PaidReactors = make([]PaidReactor, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PaidReactor - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare messageReactions#9d558cb: field paid_reactors: %w", err) - } - m.PaidReactors = append(m.PaidReactors, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: field can_get_added_reactions: %w", err) - } - m.CanGetAddedReactions = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageReactions) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageReactions#9d558cb as nil") - } - b.ObjStart() - b.PutID("messageReactions") - b.Comma() - b.FieldStart("reactions") - b.ArrStart() - for idx, v := range m.Reactions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReactions#9d558cb: field reactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("are_tags") - b.PutBool(m.AreTags) - b.Comma() - b.FieldStart("paid_reactors") - b.ArrStart() - for idx, v := range m.PaidReactors { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReactions#9d558cb: field paid_reactors element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("can_get_added_reactions") - b.PutBool(m.CanGetAddedReactions) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageReactions) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageReactions#9d558cb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageReactions"); err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: %w", err) - } - case "reactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value MessageReaction - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: field reactions: %w", err) - } - m.Reactions = append(m.Reactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: field reactions: %w", err) - } - case "are_tags": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: field are_tags: %w", err) - } - m.AreTags = value - case "paid_reactors": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PaidReactor - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: field paid_reactors: %w", err) - } - m.PaidReactors = append(m.PaidReactors, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: field paid_reactors: %w", err) - } - case "can_get_added_reactions": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageReactions#9d558cb: field can_get_added_reactions: %w", err) - } - m.CanGetAddedReactions = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReactions returns value of Reactions field. -func (m *MessageReactions) GetReactions() (value []MessageReaction) { - if m == nil { - return - } - return m.Reactions -} - -// GetAreTags returns value of AreTags field. -func (m *MessageReactions) GetAreTags() (value bool) { - if m == nil { - return - } - return m.AreTags -} - -// GetPaidReactors returns value of PaidReactors field. -func (m *MessageReactions) GetPaidReactors() (value []PaidReactor) { - if m == nil { - return - } - return m.PaidReactors -} - -// GetCanGetAddedReactions returns value of CanGetAddedReactions field. -func (m *MessageReactions) GetCanGetAddedReactions() (value bool) { - if m == nil { - return - } - return m.CanGetAddedReactions -} diff --git a/tdapi/tl_message_read_date_gen.go b/tdapi/tl_message_read_date_gen.go deleted file mode 100644 index 8a283a366..000000000 --- a/tdapi/tl_message_read_date_gen.go +++ /dev/null @@ -1,904 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageReadDateRead represents TL type `messageReadDateRead#758d2e30`. -type MessageReadDateRead struct { - // Point in time (Unix timestamp) when the message was read by the other user - ReadDate int32 -} - -// MessageReadDateReadTypeID is TL type id of MessageReadDateRead. -const MessageReadDateReadTypeID = 0x758d2e30 - -// construct implements constructor of MessageReadDateClass. -func (m MessageReadDateRead) construct() MessageReadDateClass { return &m } - -// Ensuring interfaces in compile-time for MessageReadDateRead. -var ( - _ bin.Encoder = &MessageReadDateRead{} - _ bin.Decoder = &MessageReadDateRead{} - _ bin.BareEncoder = &MessageReadDateRead{} - _ bin.BareDecoder = &MessageReadDateRead{} - - _ MessageReadDateClass = &MessageReadDateRead{} -) - -func (m *MessageReadDateRead) Zero() bool { - if m == nil { - return true - } - if !(m.ReadDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageReadDateRead) String() string { - if m == nil { - return "MessageReadDateRead(nil)" - } - type Alias MessageReadDateRead - return fmt.Sprintf("MessageReadDateRead%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageReadDateRead) TypeID() uint32 { - return MessageReadDateReadTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageReadDateRead) TypeName() string { - return "messageReadDateRead" -} - -// TypeInfo returns info about TL type. -func (m *MessageReadDateRead) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageReadDateRead", - ID: MessageReadDateReadTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ReadDate", - SchemaName: "read_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageReadDateRead) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateRead#758d2e30 as nil") - } - b.PutID(MessageReadDateReadTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageReadDateRead) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateRead#758d2e30 as nil") - } - b.PutInt32(m.ReadDate) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageReadDateRead) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateRead#758d2e30 to nil") - } - if err := b.ConsumeID(MessageReadDateReadTypeID); err != nil { - return fmt.Errorf("unable to decode messageReadDateRead#758d2e30: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageReadDateRead) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateRead#758d2e30 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageReadDateRead#758d2e30: field read_date: %w", err) - } - m.ReadDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageReadDateRead) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateRead#758d2e30 as nil") - } - b.ObjStart() - b.PutID("messageReadDateRead") - b.Comma() - b.FieldStart("read_date") - b.PutInt32(m.ReadDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageReadDateRead) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateRead#758d2e30 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageReadDateRead"); err != nil { - return fmt.Errorf("unable to decode messageReadDateRead#758d2e30: %w", err) - } - case "read_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageReadDateRead#758d2e30: field read_date: %w", err) - } - m.ReadDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReadDate returns value of ReadDate field. -func (m *MessageReadDateRead) GetReadDate() (value int32) { - if m == nil { - return - } - return m.ReadDate -} - -// MessageReadDateUnread represents TL type `messageReadDateUnread#17b2212c`. -type MessageReadDateUnread struct { -} - -// MessageReadDateUnreadTypeID is TL type id of MessageReadDateUnread. -const MessageReadDateUnreadTypeID = 0x17b2212c - -// construct implements constructor of MessageReadDateClass. -func (m MessageReadDateUnread) construct() MessageReadDateClass { return &m } - -// Ensuring interfaces in compile-time for MessageReadDateUnread. -var ( - _ bin.Encoder = &MessageReadDateUnread{} - _ bin.Decoder = &MessageReadDateUnread{} - _ bin.BareEncoder = &MessageReadDateUnread{} - _ bin.BareDecoder = &MessageReadDateUnread{} - - _ MessageReadDateClass = &MessageReadDateUnread{} -) - -func (m *MessageReadDateUnread) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageReadDateUnread) String() string { - if m == nil { - return "MessageReadDateUnread(nil)" - } - type Alias MessageReadDateUnread - return fmt.Sprintf("MessageReadDateUnread%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageReadDateUnread) TypeID() uint32 { - return MessageReadDateUnreadTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageReadDateUnread) TypeName() string { - return "messageReadDateUnread" -} - -// TypeInfo returns info about TL type. -func (m *MessageReadDateUnread) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageReadDateUnread", - ID: MessageReadDateUnreadTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageReadDateUnread) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateUnread#17b2212c as nil") - } - b.PutID(MessageReadDateUnreadTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageReadDateUnread) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateUnread#17b2212c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageReadDateUnread) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateUnread#17b2212c to nil") - } - if err := b.ConsumeID(MessageReadDateUnreadTypeID); err != nil { - return fmt.Errorf("unable to decode messageReadDateUnread#17b2212c: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageReadDateUnread) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateUnread#17b2212c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageReadDateUnread) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateUnread#17b2212c as nil") - } - b.ObjStart() - b.PutID("messageReadDateUnread") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageReadDateUnread) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateUnread#17b2212c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageReadDateUnread"); err != nil { - return fmt.Errorf("unable to decode messageReadDateUnread#17b2212c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageReadDateTooOld represents TL type `messageReadDateTooOld#b6761e20`. -type MessageReadDateTooOld struct { -} - -// MessageReadDateTooOldTypeID is TL type id of MessageReadDateTooOld. -const MessageReadDateTooOldTypeID = 0xb6761e20 - -// construct implements constructor of MessageReadDateClass. -func (m MessageReadDateTooOld) construct() MessageReadDateClass { return &m } - -// Ensuring interfaces in compile-time for MessageReadDateTooOld. -var ( - _ bin.Encoder = &MessageReadDateTooOld{} - _ bin.Decoder = &MessageReadDateTooOld{} - _ bin.BareEncoder = &MessageReadDateTooOld{} - _ bin.BareDecoder = &MessageReadDateTooOld{} - - _ MessageReadDateClass = &MessageReadDateTooOld{} -) - -func (m *MessageReadDateTooOld) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageReadDateTooOld) String() string { - if m == nil { - return "MessageReadDateTooOld(nil)" - } - type Alias MessageReadDateTooOld - return fmt.Sprintf("MessageReadDateTooOld%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageReadDateTooOld) TypeID() uint32 { - return MessageReadDateTooOldTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageReadDateTooOld) TypeName() string { - return "messageReadDateTooOld" -} - -// TypeInfo returns info about TL type. -func (m *MessageReadDateTooOld) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageReadDateTooOld", - ID: MessageReadDateTooOldTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageReadDateTooOld) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateTooOld#b6761e20 as nil") - } - b.PutID(MessageReadDateTooOldTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageReadDateTooOld) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateTooOld#b6761e20 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageReadDateTooOld) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateTooOld#b6761e20 to nil") - } - if err := b.ConsumeID(MessageReadDateTooOldTypeID); err != nil { - return fmt.Errorf("unable to decode messageReadDateTooOld#b6761e20: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageReadDateTooOld) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateTooOld#b6761e20 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageReadDateTooOld) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateTooOld#b6761e20 as nil") - } - b.ObjStart() - b.PutID("messageReadDateTooOld") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageReadDateTooOld) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateTooOld#b6761e20 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageReadDateTooOld"); err != nil { - return fmt.Errorf("unable to decode messageReadDateTooOld#b6761e20: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageReadDateUserPrivacyRestricted represents TL type `messageReadDateUserPrivacyRestricted#b38d9426`. -type MessageReadDateUserPrivacyRestricted struct { -} - -// MessageReadDateUserPrivacyRestrictedTypeID is TL type id of MessageReadDateUserPrivacyRestricted. -const MessageReadDateUserPrivacyRestrictedTypeID = 0xb38d9426 - -// construct implements constructor of MessageReadDateClass. -func (m MessageReadDateUserPrivacyRestricted) construct() MessageReadDateClass { return &m } - -// Ensuring interfaces in compile-time for MessageReadDateUserPrivacyRestricted. -var ( - _ bin.Encoder = &MessageReadDateUserPrivacyRestricted{} - _ bin.Decoder = &MessageReadDateUserPrivacyRestricted{} - _ bin.BareEncoder = &MessageReadDateUserPrivacyRestricted{} - _ bin.BareDecoder = &MessageReadDateUserPrivacyRestricted{} - - _ MessageReadDateClass = &MessageReadDateUserPrivacyRestricted{} -) - -func (m *MessageReadDateUserPrivacyRestricted) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageReadDateUserPrivacyRestricted) String() string { - if m == nil { - return "MessageReadDateUserPrivacyRestricted(nil)" - } - type Alias MessageReadDateUserPrivacyRestricted - return fmt.Sprintf("MessageReadDateUserPrivacyRestricted%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageReadDateUserPrivacyRestricted) TypeID() uint32 { - return MessageReadDateUserPrivacyRestrictedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageReadDateUserPrivacyRestricted) TypeName() string { - return "messageReadDateUserPrivacyRestricted" -} - -// TypeInfo returns info about TL type. -func (m *MessageReadDateUserPrivacyRestricted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageReadDateUserPrivacyRestricted", - ID: MessageReadDateUserPrivacyRestrictedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageReadDateUserPrivacyRestricted) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateUserPrivacyRestricted#b38d9426 as nil") - } - b.PutID(MessageReadDateUserPrivacyRestrictedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageReadDateUserPrivacyRestricted) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateUserPrivacyRestricted#b38d9426 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageReadDateUserPrivacyRestricted) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateUserPrivacyRestricted#b38d9426 to nil") - } - if err := b.ConsumeID(MessageReadDateUserPrivacyRestrictedTypeID); err != nil { - return fmt.Errorf("unable to decode messageReadDateUserPrivacyRestricted#b38d9426: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageReadDateUserPrivacyRestricted) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateUserPrivacyRestricted#b38d9426 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageReadDateUserPrivacyRestricted) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateUserPrivacyRestricted#b38d9426 as nil") - } - b.ObjStart() - b.PutID("messageReadDateUserPrivacyRestricted") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageReadDateUserPrivacyRestricted) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateUserPrivacyRestricted#b38d9426 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageReadDateUserPrivacyRestricted"); err != nil { - return fmt.Errorf("unable to decode messageReadDateUserPrivacyRestricted#b38d9426: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageReadDateMyPrivacyRestricted represents TL type `messageReadDateMyPrivacyRestricted#d6a2d474`. -type MessageReadDateMyPrivacyRestricted struct { -} - -// MessageReadDateMyPrivacyRestrictedTypeID is TL type id of MessageReadDateMyPrivacyRestricted. -const MessageReadDateMyPrivacyRestrictedTypeID = 0xd6a2d474 - -// construct implements constructor of MessageReadDateClass. -func (m MessageReadDateMyPrivacyRestricted) construct() MessageReadDateClass { return &m } - -// Ensuring interfaces in compile-time for MessageReadDateMyPrivacyRestricted. -var ( - _ bin.Encoder = &MessageReadDateMyPrivacyRestricted{} - _ bin.Decoder = &MessageReadDateMyPrivacyRestricted{} - _ bin.BareEncoder = &MessageReadDateMyPrivacyRestricted{} - _ bin.BareDecoder = &MessageReadDateMyPrivacyRestricted{} - - _ MessageReadDateClass = &MessageReadDateMyPrivacyRestricted{} -) - -func (m *MessageReadDateMyPrivacyRestricted) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageReadDateMyPrivacyRestricted) String() string { - if m == nil { - return "MessageReadDateMyPrivacyRestricted(nil)" - } - type Alias MessageReadDateMyPrivacyRestricted - return fmt.Sprintf("MessageReadDateMyPrivacyRestricted%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageReadDateMyPrivacyRestricted) TypeID() uint32 { - return MessageReadDateMyPrivacyRestrictedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageReadDateMyPrivacyRestricted) TypeName() string { - return "messageReadDateMyPrivacyRestricted" -} - -// TypeInfo returns info about TL type. -func (m *MessageReadDateMyPrivacyRestricted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageReadDateMyPrivacyRestricted", - ID: MessageReadDateMyPrivacyRestrictedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageReadDateMyPrivacyRestricted) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateMyPrivacyRestricted#d6a2d474 as nil") - } - b.PutID(MessageReadDateMyPrivacyRestrictedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageReadDateMyPrivacyRestricted) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateMyPrivacyRestricted#d6a2d474 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageReadDateMyPrivacyRestricted) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateMyPrivacyRestricted#d6a2d474 to nil") - } - if err := b.ConsumeID(MessageReadDateMyPrivacyRestrictedTypeID); err != nil { - return fmt.Errorf("unable to decode messageReadDateMyPrivacyRestricted#d6a2d474: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageReadDateMyPrivacyRestricted) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateMyPrivacyRestricted#d6a2d474 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageReadDateMyPrivacyRestricted) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageReadDateMyPrivacyRestricted#d6a2d474 as nil") - } - b.ObjStart() - b.PutID("messageReadDateMyPrivacyRestricted") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageReadDateMyPrivacyRestricted) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageReadDateMyPrivacyRestricted#d6a2d474 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageReadDateMyPrivacyRestricted"); err != nil { - return fmt.Errorf("unable to decode messageReadDateMyPrivacyRestricted#d6a2d474: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageReadDateClassName is schema name of MessageReadDateClass. -const MessageReadDateClassName = "MessageReadDate" - -// MessageReadDateClass represents MessageReadDate generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageReadDate(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageReadDateRead: // messageReadDateRead#758d2e30 -// case *tdapi.MessageReadDateUnread: // messageReadDateUnread#17b2212c -// case *tdapi.MessageReadDateTooOld: // messageReadDateTooOld#b6761e20 -// case *tdapi.MessageReadDateUserPrivacyRestricted: // messageReadDateUserPrivacyRestricted#b38d9426 -// case *tdapi.MessageReadDateMyPrivacyRestricted: // messageReadDateMyPrivacyRestricted#d6a2d474 -// default: panic(v) -// } -type MessageReadDateClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageReadDateClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMessageReadDate implements binary de-serialization for MessageReadDateClass. -func DecodeMessageReadDate(buf *bin.Buffer) (MessageReadDateClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageReadDateReadTypeID: - // Decoding messageReadDateRead#758d2e30. - v := MessageReadDateRead{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", err) - } - return &v, nil - case MessageReadDateUnreadTypeID: - // Decoding messageReadDateUnread#17b2212c. - v := MessageReadDateUnread{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", err) - } - return &v, nil - case MessageReadDateTooOldTypeID: - // Decoding messageReadDateTooOld#b6761e20. - v := MessageReadDateTooOld{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", err) - } - return &v, nil - case MessageReadDateUserPrivacyRestrictedTypeID: - // Decoding messageReadDateUserPrivacyRestricted#b38d9426. - v := MessageReadDateUserPrivacyRestricted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", err) - } - return &v, nil - case MessageReadDateMyPrivacyRestrictedTypeID: - // Decoding messageReadDateMyPrivacyRestricted#d6a2d474. - v := MessageReadDateMyPrivacyRestricted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageReadDate implements binary de-serialization for MessageReadDateClass. -func DecodeTDLibJSONMessageReadDate(buf tdjson.Decoder) (MessageReadDateClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageReadDateRead": - // Decoding messageReadDateRead#758d2e30. - v := MessageReadDateRead{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", err) - } - return &v, nil - case "messageReadDateUnread": - // Decoding messageReadDateUnread#17b2212c. - v := MessageReadDateUnread{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", err) - } - return &v, nil - case "messageReadDateTooOld": - // Decoding messageReadDateTooOld#b6761e20. - v := MessageReadDateTooOld{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", err) - } - return &v, nil - case "messageReadDateUserPrivacyRestricted": - // Decoding messageReadDateUserPrivacyRestricted#b38d9426. - v := MessageReadDateUserPrivacyRestricted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", err) - } - return &v, nil - case "messageReadDateMyPrivacyRestricted": - // Decoding messageReadDateMyPrivacyRestricted#d6a2d474. - v := MessageReadDateMyPrivacyRestricted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageReadDateClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageReadDate boxes the MessageReadDateClass providing a helper. -type MessageReadDateBox struct { - MessageReadDate MessageReadDateClass -} - -// Decode implements bin.Decoder for MessageReadDateBox. -func (b *MessageReadDateBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageReadDateBox to nil") - } - v, err := DecodeMessageReadDate(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageReadDate = v - return nil -} - -// Encode implements bin.Encode for MessageReadDateBox. -func (b *MessageReadDateBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageReadDate == nil { - return fmt.Errorf("unable to encode MessageReadDateClass as nil") - } - return b.MessageReadDate.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageReadDateBox. -func (b *MessageReadDateBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageReadDateBox to nil") - } - v, err := DecodeTDLibJSONMessageReadDate(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageReadDate = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageReadDateBox. -func (b *MessageReadDateBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageReadDate == nil { - return fmt.Errorf("unable to encode MessageReadDateClass as nil") - } - return b.MessageReadDate.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_message_reply_info_gen.go b/tdapi/tl_message_reply_info_gen.go deleted file mode 100644 index 0920e1b87..000000000 --- a/tdapi/tl_message_reply_info_gen.go +++ /dev/null @@ -1,365 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageReplyInfo represents TL type `messageReplyInfo#69240cb9`. -type MessageReplyInfo struct { - // Number of times the message was directly or indirectly replied - ReplyCount int32 - // Identifiers of at most 3 recent repliers to the message; available in channels with a - // discussion supergroup. The users and chats are expected to be inaccessible: only their - // photo and name will be available - RecentReplierIDs []MessageSenderClass - // Identifier of the last read incoming reply to the message - LastReadInboxMessageID int64 - // Identifier of the last read outgoing reply to the message - LastReadOutboxMessageID int64 - // Identifier of the last reply to the message - LastMessageID int64 -} - -// MessageReplyInfoTypeID is TL type id of MessageReplyInfo. -const MessageReplyInfoTypeID = 0x69240cb9 - -// Ensuring interfaces in compile-time for MessageReplyInfo. -var ( - _ bin.Encoder = &MessageReplyInfo{} - _ bin.Decoder = &MessageReplyInfo{} - _ bin.BareEncoder = &MessageReplyInfo{} - _ bin.BareDecoder = &MessageReplyInfo{} -) - -func (m *MessageReplyInfo) Zero() bool { - if m == nil { - return true - } - if !(m.ReplyCount == 0) { - return false - } - if !(m.RecentReplierIDs == nil) { - return false - } - if !(m.LastReadInboxMessageID == 0) { - return false - } - if !(m.LastReadOutboxMessageID == 0) { - return false - } - if !(m.LastMessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageReplyInfo) String() string { - if m == nil { - return "MessageReplyInfo(nil)" - } - type Alias MessageReplyInfo - return fmt.Sprintf("MessageReplyInfo%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageReplyInfo) TypeID() uint32 { - return MessageReplyInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageReplyInfo) TypeName() string { - return "messageReplyInfo" -} - -// TypeInfo returns info about TL type. -func (m *MessageReplyInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageReplyInfo", - ID: MessageReplyInfoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ReplyCount", - SchemaName: "reply_count", - }, - { - Name: "RecentReplierIDs", - SchemaName: "recent_replier_ids", - }, - { - Name: "LastReadInboxMessageID", - SchemaName: "last_read_inbox_message_id", - }, - { - Name: "LastReadOutboxMessageID", - SchemaName: "last_read_outbox_message_id", - }, - { - Name: "LastMessageID", - SchemaName: "last_message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageReplyInfo) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReplyInfo#69240cb9 as nil") - } - b.PutID(MessageReplyInfoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageReplyInfo) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReplyInfo#69240cb9 as nil") - } - b.PutInt32(m.ReplyCount) - b.PutInt(len(m.RecentReplierIDs)) - for idx, v := range m.RecentReplierIDs { - if v == nil { - return fmt.Errorf("unable to encode messageReplyInfo#69240cb9: field recent_replier_ids element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messageReplyInfo#69240cb9: field recent_replier_ids element with index %d: %w", idx, err) - } - } - b.PutInt53(m.LastReadInboxMessageID) - b.PutInt53(m.LastReadOutboxMessageID) - b.PutInt53(m.LastMessageID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageReplyInfo) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReplyInfo#69240cb9 to nil") - } - if err := b.ConsumeID(MessageReplyInfoTypeID); err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageReplyInfo) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReplyInfo#69240cb9 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field reply_count: %w", err) - } - m.ReplyCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field recent_replier_ids: %w", err) - } - - if headerLen > 0 { - m.RecentReplierIDs = make([]MessageSenderClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field recent_replier_ids: %w", err) - } - m.RecentReplierIDs = append(m.RecentReplierIDs, value) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field last_read_inbox_message_id: %w", err) - } - m.LastReadInboxMessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field last_read_outbox_message_id: %w", err) - } - m.LastReadOutboxMessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field last_message_id: %w", err) - } - m.LastMessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageReplyInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageReplyInfo#69240cb9 as nil") - } - b.ObjStart() - b.PutID("messageReplyInfo") - b.Comma() - b.FieldStart("reply_count") - b.PutInt32(m.ReplyCount) - b.Comma() - b.FieldStart("recent_replier_ids") - b.ArrStart() - for idx, v := range m.RecentReplierIDs { - if v == nil { - return fmt.Errorf("unable to encode messageReplyInfo#69240cb9: field recent_replier_ids element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReplyInfo#69240cb9: field recent_replier_ids element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("last_read_inbox_message_id") - b.PutInt53(m.LastReadInboxMessageID) - b.Comma() - b.FieldStart("last_read_outbox_message_id") - b.PutInt53(m.LastReadOutboxMessageID) - b.Comma() - b.FieldStart("last_message_id") - b.PutInt53(m.LastMessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageReplyInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageReplyInfo#69240cb9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageReplyInfo"); err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: %w", err) - } - case "reply_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field reply_count: %w", err) - } - m.ReplyCount = value - case "recent_replier_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field recent_replier_ids: %w", err) - } - m.RecentReplierIDs = append(m.RecentReplierIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field recent_replier_ids: %w", err) - } - case "last_read_inbox_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field last_read_inbox_message_id: %w", err) - } - m.LastReadInboxMessageID = value - case "last_read_outbox_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field last_read_outbox_message_id: %w", err) - } - m.LastReadOutboxMessageID = value - case "last_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyInfo#69240cb9: field last_message_id: %w", err) - } - m.LastMessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReplyCount returns value of ReplyCount field. -func (m *MessageReplyInfo) GetReplyCount() (value int32) { - if m == nil { - return - } - return m.ReplyCount -} - -// GetRecentReplierIDs returns value of RecentReplierIDs field. -func (m *MessageReplyInfo) GetRecentReplierIDs() (value []MessageSenderClass) { - if m == nil { - return - } - return m.RecentReplierIDs -} - -// GetLastReadInboxMessageID returns value of LastReadInboxMessageID field. -func (m *MessageReplyInfo) GetLastReadInboxMessageID() (value int64) { - if m == nil { - return - } - return m.LastReadInboxMessageID -} - -// GetLastReadOutboxMessageID returns value of LastReadOutboxMessageID field. -func (m *MessageReplyInfo) GetLastReadOutboxMessageID() (value int64) { - if m == nil { - return - } - return m.LastReadOutboxMessageID -} - -// GetLastMessageID returns value of LastMessageID field. -func (m *MessageReplyInfo) GetLastMessageID() (value int64) { - if m == nil { - return - } - return m.LastMessageID -} diff --git a/tdapi/tl_message_reply_to_gen.go b/tdapi/tl_message_reply_to_gen.go deleted file mode 100644 index 2409a715e..000000000 --- a/tdapi/tl_message_reply_to_gen.go +++ /dev/null @@ -1,729 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageReplyToMessage represents TL type `messageReplyToMessage#ee105987`. -type MessageReplyToMessage struct { - // The identifier of the chat to which the message belongs; may be 0 if the replied - // message is in unknown chat - ChatID int64 - // The identifier of the message; may be 0 if the replied message is in unknown chat - MessageID int64 - // Chosen quote from the replied message; may be null if none - Quote TextQuote - // Information about origin of the message if the message was from another chat or topic; - // may be null for messages from the same chat - Origin MessageOriginClass - // Point in time (Unix timestamp) when the message was sent if the message was from - // another chat or topic; 0 for messages from the same chat - OriginSendDate int32 - // Media content of the message if the message was from another chat or topic; may be - // null for messages from the same chat and messages without media. - Content MessageContentClass -} - -// MessageReplyToMessageTypeID is TL type id of MessageReplyToMessage. -const MessageReplyToMessageTypeID = 0xee105987 - -// construct implements constructor of MessageReplyToClass. -func (m MessageReplyToMessage) construct() MessageReplyToClass { return &m } - -// Ensuring interfaces in compile-time for MessageReplyToMessage. -var ( - _ bin.Encoder = &MessageReplyToMessage{} - _ bin.Decoder = &MessageReplyToMessage{} - _ bin.BareEncoder = &MessageReplyToMessage{} - _ bin.BareDecoder = &MessageReplyToMessage{} - - _ MessageReplyToClass = &MessageReplyToMessage{} -) - -func (m *MessageReplyToMessage) Zero() bool { - if m == nil { - return true - } - if !(m.ChatID == 0) { - return false - } - if !(m.MessageID == 0) { - return false - } - if !(m.Quote.Zero()) { - return false - } - if !(m.Origin == nil) { - return false - } - if !(m.OriginSendDate == 0) { - return false - } - if !(m.Content == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageReplyToMessage) String() string { - if m == nil { - return "MessageReplyToMessage(nil)" - } - type Alias MessageReplyToMessage - return fmt.Sprintf("MessageReplyToMessage%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageReplyToMessage) TypeID() uint32 { - return MessageReplyToMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageReplyToMessage) TypeName() string { - return "messageReplyToMessage" -} - -// TypeInfo returns info about TL type. -func (m *MessageReplyToMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageReplyToMessage", - ID: MessageReplyToMessageTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Quote", - SchemaName: "quote", - }, - { - Name: "Origin", - SchemaName: "origin", - }, - { - Name: "OriginSendDate", - SchemaName: "origin_send_date", - }, - { - Name: "Content", - SchemaName: "content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageReplyToMessage) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReplyToMessage#ee105987 as nil") - } - b.PutID(MessageReplyToMessageTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageReplyToMessage) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReplyToMessage#ee105987 as nil") - } - b.PutInt53(m.ChatID) - b.PutInt53(m.MessageID) - if err := m.Quote.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field quote: %w", err) - } - if m.Origin == nil { - return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field origin is nil") - } - if err := m.Origin.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field origin: %w", err) - } - b.PutInt32(m.OriginSendDate) - if m.Content == nil { - return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field content is nil") - } - if err := m.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageReplyToMessage) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReplyToMessage#ee105987 to nil") - } - if err := b.ConsumeID(MessageReplyToMessageTypeID); err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageReplyToMessage) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReplyToMessage#ee105987 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field chat_id: %w", err) - } - m.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field message_id: %w", err) - } - m.MessageID = value - } - { - if err := m.Quote.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field quote: %w", err) - } - } - { - value, err := DecodeMessageOrigin(b) - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field origin: %w", err) - } - m.Origin = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field origin_send_date: %w", err) - } - m.OriginSendDate = value - } - { - value, err := DecodeMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field content: %w", err) - } - m.Content = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageReplyToMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageReplyToMessage#ee105987 as nil") - } - b.ObjStart() - b.PutID("messageReplyToMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(m.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(m.MessageID) - b.Comma() - b.FieldStart("quote") - if err := m.Quote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field quote: %w", err) - } - b.Comma() - b.FieldStart("origin") - if m.Origin == nil { - return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field origin is nil") - } - if err := m.Origin.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field origin: %w", err) - } - b.Comma() - b.FieldStart("origin_send_date") - b.PutInt32(m.OriginSendDate) - b.Comma() - b.FieldStart("content") - if m.Content == nil { - return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field content is nil") - } - if err := m.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageReplyToMessage#ee105987: field content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageReplyToMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageReplyToMessage#ee105987 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageReplyToMessage"); err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field chat_id: %w", err) - } - m.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field message_id: %w", err) - } - m.MessageID = value - case "quote": - if err := m.Quote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field quote: %w", err) - } - case "origin": - value, err := DecodeTDLibJSONMessageOrigin(b) - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field origin: %w", err) - } - m.Origin = value - case "origin_send_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field origin_send_date: %w", err) - } - m.OriginSendDate = value - case "content": - value, err := DecodeTDLibJSONMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode messageReplyToMessage#ee105987: field content: %w", err) - } - m.Content = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (m *MessageReplyToMessage) GetChatID() (value int64) { - if m == nil { - return - } - return m.ChatID -} - -// GetMessageID returns value of MessageID field. -func (m *MessageReplyToMessage) GetMessageID() (value int64) { - if m == nil { - return - } - return m.MessageID -} - -// GetQuote returns value of Quote field. -func (m *MessageReplyToMessage) GetQuote() (value TextQuote) { - if m == nil { - return - } - return m.Quote -} - -// GetOrigin returns value of Origin field. -func (m *MessageReplyToMessage) GetOrigin() (value MessageOriginClass) { - if m == nil { - return - } - return m.Origin -} - -// GetOriginSendDate returns value of OriginSendDate field. -func (m *MessageReplyToMessage) GetOriginSendDate() (value int32) { - if m == nil { - return - } - return m.OriginSendDate -} - -// GetContent returns value of Content field. -func (m *MessageReplyToMessage) GetContent() (value MessageContentClass) { - if m == nil { - return - } - return m.Content -} - -// MessageReplyToStory represents TL type `messageReplyToStory#708ca939`. -type MessageReplyToStory struct { - // The identifier of the sender of the story - StorySenderChatID int64 - // The identifier of the story - StoryID int32 -} - -// MessageReplyToStoryTypeID is TL type id of MessageReplyToStory. -const MessageReplyToStoryTypeID = 0x708ca939 - -// construct implements constructor of MessageReplyToClass. -func (m MessageReplyToStory) construct() MessageReplyToClass { return &m } - -// Ensuring interfaces in compile-time for MessageReplyToStory. -var ( - _ bin.Encoder = &MessageReplyToStory{} - _ bin.Decoder = &MessageReplyToStory{} - _ bin.BareEncoder = &MessageReplyToStory{} - _ bin.BareDecoder = &MessageReplyToStory{} - - _ MessageReplyToClass = &MessageReplyToStory{} -) - -func (m *MessageReplyToStory) Zero() bool { - if m == nil { - return true - } - if !(m.StorySenderChatID == 0) { - return false - } - if !(m.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageReplyToStory) String() string { - if m == nil { - return "MessageReplyToStory(nil)" - } - type Alias MessageReplyToStory - return fmt.Sprintf("MessageReplyToStory%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageReplyToStory) TypeID() uint32 { - return MessageReplyToStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageReplyToStory) TypeName() string { - return "messageReplyToStory" -} - -// TypeInfo returns info about TL type. -func (m *MessageReplyToStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageReplyToStory", - ID: MessageReplyToStoryTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageReplyToStory) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReplyToStory#708ca939 as nil") - } - b.PutID(MessageReplyToStoryTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageReplyToStory) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageReplyToStory#708ca939 as nil") - } - b.PutInt53(m.StorySenderChatID) - b.PutInt32(m.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageReplyToStory) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReplyToStory#708ca939 to nil") - } - if err := b.ConsumeID(MessageReplyToStoryTypeID); err != nil { - return fmt.Errorf("unable to decode messageReplyToStory#708ca939: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageReplyToStory) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageReplyToStory#708ca939 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToStory#708ca939: field story_sender_chat_id: %w", err) - } - m.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToStory#708ca939: field story_id: %w", err) - } - m.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageReplyToStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageReplyToStory#708ca939 as nil") - } - b.ObjStart() - b.PutID("messageReplyToStory") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(m.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(m.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageReplyToStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageReplyToStory#708ca939 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageReplyToStory"); err != nil { - return fmt.Errorf("unable to decode messageReplyToStory#708ca939: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToStory#708ca939: field story_sender_chat_id: %w", err) - } - m.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageReplyToStory#708ca939: field story_id: %w", err) - } - m.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (m *MessageReplyToStory) GetStorySenderChatID() (value int64) { - if m == nil { - return - } - return m.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (m *MessageReplyToStory) GetStoryID() (value int32) { - if m == nil { - return - } - return m.StoryID -} - -// MessageReplyToClassName is schema name of MessageReplyToClass. -const MessageReplyToClassName = "MessageReplyTo" - -// MessageReplyToClass represents MessageReplyTo generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageReplyTo(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageReplyToMessage: // messageReplyToMessage#ee105987 -// case *tdapi.MessageReplyToStory: // messageReplyToStory#708ca939 -// default: panic(v) -// } -type MessageReplyToClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageReplyToClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMessageReplyTo implements binary de-serialization for MessageReplyToClass. -func DecodeMessageReplyTo(buf *bin.Buffer) (MessageReplyToClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageReplyToMessageTypeID: - // Decoding messageReplyToMessage#ee105987. - v := MessageReplyToMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReplyToClass: %w", err) - } - return &v, nil - case MessageReplyToStoryTypeID: - // Decoding messageReplyToStory#708ca939. - v := MessageReplyToStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReplyToClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageReplyToClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageReplyTo implements binary de-serialization for MessageReplyToClass. -func DecodeTDLibJSONMessageReplyTo(buf tdjson.Decoder) (MessageReplyToClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageReplyToMessage": - // Decoding messageReplyToMessage#ee105987. - v := MessageReplyToMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReplyToClass: %w", err) - } - return &v, nil - case "messageReplyToStory": - // Decoding messageReplyToStory#708ca939. - v := MessageReplyToStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageReplyToClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageReplyToClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageReplyTo boxes the MessageReplyToClass providing a helper. -type MessageReplyToBox struct { - MessageReplyTo MessageReplyToClass -} - -// Decode implements bin.Decoder for MessageReplyToBox. -func (b *MessageReplyToBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageReplyToBox to nil") - } - v, err := DecodeMessageReplyTo(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageReplyTo = v - return nil -} - -// Encode implements bin.Encode for MessageReplyToBox. -func (b *MessageReplyToBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageReplyTo == nil { - return fmt.Errorf("unable to encode MessageReplyToClass as nil") - } - return b.MessageReplyTo.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageReplyToBox. -func (b *MessageReplyToBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageReplyToBox to nil") - } - v, err := DecodeTDLibJSONMessageReplyTo(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageReplyTo = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageReplyToBox. -func (b *MessageReplyToBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageReplyTo == nil { - return fmt.Errorf("unable to encode MessageReplyToClass as nil") - } - return b.MessageReplyTo.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_message_scheduling_state_gen.go b/tdapi/tl_message_scheduling_state_gen.go deleted file mode 100644 index 2ee02423e..000000000 --- a/tdapi/tl_message_scheduling_state_gen.go +++ /dev/null @@ -1,650 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageSchedulingStateSendAtDate represents TL type `messageSchedulingStateSendAtDate#a773ffe7`. -type MessageSchedulingStateSendAtDate struct { - // Point in time (Unix timestamp) when the message will be sent. The date must be within - // 367 days in the future - SendDate int32 -} - -// MessageSchedulingStateSendAtDateTypeID is TL type id of MessageSchedulingStateSendAtDate. -const MessageSchedulingStateSendAtDateTypeID = 0xa773ffe7 - -// construct implements constructor of MessageSchedulingStateClass. -func (m MessageSchedulingStateSendAtDate) construct() MessageSchedulingStateClass { return &m } - -// Ensuring interfaces in compile-time for MessageSchedulingStateSendAtDate. -var ( - _ bin.Encoder = &MessageSchedulingStateSendAtDate{} - _ bin.Decoder = &MessageSchedulingStateSendAtDate{} - _ bin.BareEncoder = &MessageSchedulingStateSendAtDate{} - _ bin.BareDecoder = &MessageSchedulingStateSendAtDate{} - - _ MessageSchedulingStateClass = &MessageSchedulingStateSendAtDate{} -) - -func (m *MessageSchedulingStateSendAtDate) Zero() bool { - if m == nil { - return true - } - if !(m.SendDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSchedulingStateSendAtDate) String() string { - if m == nil { - return "MessageSchedulingStateSendAtDate(nil)" - } - type Alias MessageSchedulingStateSendAtDate - return fmt.Sprintf("MessageSchedulingStateSendAtDate%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSchedulingStateSendAtDate) TypeID() uint32 { - return MessageSchedulingStateSendAtDateTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSchedulingStateSendAtDate) TypeName() string { - return "messageSchedulingStateSendAtDate" -} - -// TypeInfo returns info about TL type. -func (m *MessageSchedulingStateSendAtDate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSchedulingStateSendAtDate", - ID: MessageSchedulingStateSendAtDateTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SendDate", - SchemaName: "send_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSchedulingStateSendAtDate) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSchedulingStateSendAtDate#a773ffe7 as nil") - } - b.PutID(MessageSchedulingStateSendAtDateTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSchedulingStateSendAtDate) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSchedulingStateSendAtDate#a773ffe7 as nil") - } - b.PutInt32(m.SendDate) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSchedulingStateSendAtDate) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSchedulingStateSendAtDate#a773ffe7 to nil") - } - if err := b.ConsumeID(MessageSchedulingStateSendAtDateTypeID); err != nil { - return fmt.Errorf("unable to decode messageSchedulingStateSendAtDate#a773ffe7: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSchedulingStateSendAtDate) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSchedulingStateSendAtDate#a773ffe7 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSchedulingStateSendAtDate#a773ffe7: field send_date: %w", err) - } - m.SendDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSchedulingStateSendAtDate) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSchedulingStateSendAtDate#a773ffe7 as nil") - } - b.ObjStart() - b.PutID("messageSchedulingStateSendAtDate") - b.Comma() - b.FieldStart("send_date") - b.PutInt32(m.SendDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSchedulingStateSendAtDate) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSchedulingStateSendAtDate#a773ffe7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSchedulingStateSendAtDate"); err != nil { - return fmt.Errorf("unable to decode messageSchedulingStateSendAtDate#a773ffe7: %w", err) - } - case "send_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSchedulingStateSendAtDate#a773ffe7: field send_date: %w", err) - } - m.SendDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSendDate returns value of SendDate field. -func (m *MessageSchedulingStateSendAtDate) GetSendDate() (value int32) { - if m == nil { - return - } - return m.SendDate -} - -// MessageSchedulingStateSendWhenOnline represents TL type `messageSchedulingStateSendWhenOnline#7cbfd808`. -type MessageSchedulingStateSendWhenOnline struct { -} - -// MessageSchedulingStateSendWhenOnlineTypeID is TL type id of MessageSchedulingStateSendWhenOnline. -const MessageSchedulingStateSendWhenOnlineTypeID = 0x7cbfd808 - -// construct implements constructor of MessageSchedulingStateClass. -func (m MessageSchedulingStateSendWhenOnline) construct() MessageSchedulingStateClass { return &m } - -// Ensuring interfaces in compile-time for MessageSchedulingStateSendWhenOnline. -var ( - _ bin.Encoder = &MessageSchedulingStateSendWhenOnline{} - _ bin.Decoder = &MessageSchedulingStateSendWhenOnline{} - _ bin.BareEncoder = &MessageSchedulingStateSendWhenOnline{} - _ bin.BareDecoder = &MessageSchedulingStateSendWhenOnline{} - - _ MessageSchedulingStateClass = &MessageSchedulingStateSendWhenOnline{} -) - -func (m *MessageSchedulingStateSendWhenOnline) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSchedulingStateSendWhenOnline) String() string { - if m == nil { - return "MessageSchedulingStateSendWhenOnline(nil)" - } - type Alias MessageSchedulingStateSendWhenOnline - return fmt.Sprintf("MessageSchedulingStateSendWhenOnline%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSchedulingStateSendWhenOnline) TypeID() uint32 { - return MessageSchedulingStateSendWhenOnlineTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSchedulingStateSendWhenOnline) TypeName() string { - return "messageSchedulingStateSendWhenOnline" -} - -// TypeInfo returns info about TL type. -func (m *MessageSchedulingStateSendWhenOnline) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSchedulingStateSendWhenOnline", - ID: MessageSchedulingStateSendWhenOnlineTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSchedulingStateSendWhenOnline) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSchedulingStateSendWhenOnline#7cbfd808 as nil") - } - b.PutID(MessageSchedulingStateSendWhenOnlineTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSchedulingStateSendWhenOnline) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSchedulingStateSendWhenOnline#7cbfd808 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSchedulingStateSendWhenOnline) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSchedulingStateSendWhenOnline#7cbfd808 to nil") - } - if err := b.ConsumeID(MessageSchedulingStateSendWhenOnlineTypeID); err != nil { - return fmt.Errorf("unable to decode messageSchedulingStateSendWhenOnline#7cbfd808: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSchedulingStateSendWhenOnline) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSchedulingStateSendWhenOnline#7cbfd808 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSchedulingStateSendWhenOnline) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSchedulingStateSendWhenOnline#7cbfd808 as nil") - } - b.ObjStart() - b.PutID("messageSchedulingStateSendWhenOnline") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSchedulingStateSendWhenOnline) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSchedulingStateSendWhenOnline#7cbfd808 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSchedulingStateSendWhenOnline"); err != nil { - return fmt.Errorf("unable to decode messageSchedulingStateSendWhenOnline#7cbfd808: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSchedulingStateSendWhenVideoProcessed represents TL type `messageSchedulingStateSendWhenVideoProcessed#7d438bee`. -type MessageSchedulingStateSendWhenVideoProcessed struct { - // Approximate point in time (Unix timestamp) when the message is expected to be sent - SendDate int32 -} - -// MessageSchedulingStateSendWhenVideoProcessedTypeID is TL type id of MessageSchedulingStateSendWhenVideoProcessed. -const MessageSchedulingStateSendWhenVideoProcessedTypeID = 0x7d438bee - -// construct implements constructor of MessageSchedulingStateClass. -func (m MessageSchedulingStateSendWhenVideoProcessed) construct() MessageSchedulingStateClass { - return &m -} - -// Ensuring interfaces in compile-time for MessageSchedulingStateSendWhenVideoProcessed. -var ( - _ bin.Encoder = &MessageSchedulingStateSendWhenVideoProcessed{} - _ bin.Decoder = &MessageSchedulingStateSendWhenVideoProcessed{} - _ bin.BareEncoder = &MessageSchedulingStateSendWhenVideoProcessed{} - _ bin.BareDecoder = &MessageSchedulingStateSendWhenVideoProcessed{} - - _ MessageSchedulingStateClass = &MessageSchedulingStateSendWhenVideoProcessed{} -) - -func (m *MessageSchedulingStateSendWhenVideoProcessed) Zero() bool { - if m == nil { - return true - } - if !(m.SendDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSchedulingStateSendWhenVideoProcessed) String() string { - if m == nil { - return "MessageSchedulingStateSendWhenVideoProcessed(nil)" - } - type Alias MessageSchedulingStateSendWhenVideoProcessed - return fmt.Sprintf("MessageSchedulingStateSendWhenVideoProcessed%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSchedulingStateSendWhenVideoProcessed) TypeID() uint32 { - return MessageSchedulingStateSendWhenVideoProcessedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSchedulingStateSendWhenVideoProcessed) TypeName() string { - return "messageSchedulingStateSendWhenVideoProcessed" -} - -// TypeInfo returns info about TL type. -func (m *MessageSchedulingStateSendWhenVideoProcessed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSchedulingStateSendWhenVideoProcessed", - ID: MessageSchedulingStateSendWhenVideoProcessedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SendDate", - SchemaName: "send_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSchedulingStateSendWhenVideoProcessed) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSchedulingStateSendWhenVideoProcessed#7d438bee as nil") - } - b.PutID(MessageSchedulingStateSendWhenVideoProcessedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSchedulingStateSendWhenVideoProcessed) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSchedulingStateSendWhenVideoProcessed#7d438bee as nil") - } - b.PutInt32(m.SendDate) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSchedulingStateSendWhenVideoProcessed) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSchedulingStateSendWhenVideoProcessed#7d438bee to nil") - } - if err := b.ConsumeID(MessageSchedulingStateSendWhenVideoProcessedTypeID); err != nil { - return fmt.Errorf("unable to decode messageSchedulingStateSendWhenVideoProcessed#7d438bee: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSchedulingStateSendWhenVideoProcessed) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSchedulingStateSendWhenVideoProcessed#7d438bee to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSchedulingStateSendWhenVideoProcessed#7d438bee: field send_date: %w", err) - } - m.SendDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSchedulingStateSendWhenVideoProcessed) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSchedulingStateSendWhenVideoProcessed#7d438bee as nil") - } - b.ObjStart() - b.PutID("messageSchedulingStateSendWhenVideoProcessed") - b.Comma() - b.FieldStart("send_date") - b.PutInt32(m.SendDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSchedulingStateSendWhenVideoProcessed) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSchedulingStateSendWhenVideoProcessed#7d438bee to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSchedulingStateSendWhenVideoProcessed"); err != nil { - return fmt.Errorf("unable to decode messageSchedulingStateSendWhenVideoProcessed#7d438bee: %w", err) - } - case "send_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSchedulingStateSendWhenVideoProcessed#7d438bee: field send_date: %w", err) - } - m.SendDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSendDate returns value of SendDate field. -func (m *MessageSchedulingStateSendWhenVideoProcessed) GetSendDate() (value int32) { - if m == nil { - return - } - return m.SendDate -} - -// MessageSchedulingStateClassName is schema name of MessageSchedulingStateClass. -const MessageSchedulingStateClassName = "MessageSchedulingState" - -// MessageSchedulingStateClass represents MessageSchedulingState generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageSchedulingState(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageSchedulingStateSendAtDate: // messageSchedulingStateSendAtDate#a773ffe7 -// case *tdapi.MessageSchedulingStateSendWhenOnline: // messageSchedulingStateSendWhenOnline#7cbfd808 -// case *tdapi.MessageSchedulingStateSendWhenVideoProcessed: // messageSchedulingStateSendWhenVideoProcessed#7d438bee -// default: panic(v) -// } -type MessageSchedulingStateClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageSchedulingStateClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMessageSchedulingState implements binary de-serialization for MessageSchedulingStateClass. -func DecodeMessageSchedulingState(buf *bin.Buffer) (MessageSchedulingStateClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageSchedulingStateSendAtDateTypeID: - // Decoding messageSchedulingStateSendAtDate#a773ffe7. - v := MessageSchedulingStateSendAtDate{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSchedulingStateClass: %w", err) - } - return &v, nil - case MessageSchedulingStateSendWhenOnlineTypeID: - // Decoding messageSchedulingStateSendWhenOnline#7cbfd808. - v := MessageSchedulingStateSendWhenOnline{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSchedulingStateClass: %w", err) - } - return &v, nil - case MessageSchedulingStateSendWhenVideoProcessedTypeID: - // Decoding messageSchedulingStateSendWhenVideoProcessed#7d438bee. - v := MessageSchedulingStateSendWhenVideoProcessed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSchedulingStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSchedulingStateClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageSchedulingState implements binary de-serialization for MessageSchedulingStateClass. -func DecodeTDLibJSONMessageSchedulingState(buf tdjson.Decoder) (MessageSchedulingStateClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageSchedulingStateSendAtDate": - // Decoding messageSchedulingStateSendAtDate#a773ffe7. - v := MessageSchedulingStateSendAtDate{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSchedulingStateClass: %w", err) - } - return &v, nil - case "messageSchedulingStateSendWhenOnline": - // Decoding messageSchedulingStateSendWhenOnline#7cbfd808. - v := MessageSchedulingStateSendWhenOnline{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSchedulingStateClass: %w", err) - } - return &v, nil - case "messageSchedulingStateSendWhenVideoProcessed": - // Decoding messageSchedulingStateSendWhenVideoProcessed#7d438bee. - v := MessageSchedulingStateSendWhenVideoProcessed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSchedulingStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSchedulingStateClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageSchedulingState boxes the MessageSchedulingStateClass providing a helper. -type MessageSchedulingStateBox struct { - MessageSchedulingState MessageSchedulingStateClass -} - -// Decode implements bin.Decoder for MessageSchedulingStateBox. -func (b *MessageSchedulingStateBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSchedulingStateBox to nil") - } - v, err := DecodeMessageSchedulingState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSchedulingState = v - return nil -} - -// Encode implements bin.Encode for MessageSchedulingStateBox. -func (b *MessageSchedulingStateBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageSchedulingState == nil { - return fmt.Errorf("unable to encode MessageSchedulingStateClass as nil") - } - return b.MessageSchedulingState.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageSchedulingStateBox. -func (b *MessageSchedulingStateBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSchedulingStateBox to nil") - } - v, err := DecodeTDLibJSONMessageSchedulingState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSchedulingState = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageSchedulingStateBox. -func (b *MessageSchedulingStateBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageSchedulingState == nil { - return fmt.Errorf("unable to encode MessageSchedulingStateClass as nil") - } - return b.MessageSchedulingState.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_message_self_destruct_type_gen.go b/tdapi/tl_message_self_destruct_type_gen.go deleted file mode 100644 index 4fe53a5ff..000000000 --- a/tdapi/tl_message_self_destruct_type_gen.go +++ /dev/null @@ -1,467 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageSelfDestructTypeTimer represents TL type `messageSelfDestructTypeTimer#508d57cd`. -type MessageSelfDestructTypeTimer struct { - // The message's self-destruct time, in seconds; must be between 0 and 60 in private - // chats - SelfDestructTime int32 -} - -// MessageSelfDestructTypeTimerTypeID is TL type id of MessageSelfDestructTypeTimer. -const MessageSelfDestructTypeTimerTypeID = 0x508d57cd - -// construct implements constructor of MessageSelfDestructTypeClass. -func (m MessageSelfDestructTypeTimer) construct() MessageSelfDestructTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageSelfDestructTypeTimer. -var ( - _ bin.Encoder = &MessageSelfDestructTypeTimer{} - _ bin.Decoder = &MessageSelfDestructTypeTimer{} - _ bin.BareEncoder = &MessageSelfDestructTypeTimer{} - _ bin.BareDecoder = &MessageSelfDestructTypeTimer{} - - _ MessageSelfDestructTypeClass = &MessageSelfDestructTypeTimer{} -) - -func (m *MessageSelfDestructTypeTimer) Zero() bool { - if m == nil { - return true - } - if !(m.SelfDestructTime == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSelfDestructTypeTimer) String() string { - if m == nil { - return "MessageSelfDestructTypeTimer(nil)" - } - type Alias MessageSelfDestructTypeTimer - return fmt.Sprintf("MessageSelfDestructTypeTimer%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSelfDestructTypeTimer) TypeID() uint32 { - return MessageSelfDestructTypeTimerTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSelfDestructTypeTimer) TypeName() string { - return "messageSelfDestructTypeTimer" -} - -// TypeInfo returns info about TL type. -func (m *MessageSelfDestructTypeTimer) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSelfDestructTypeTimer", - ID: MessageSelfDestructTypeTimerTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SelfDestructTime", - SchemaName: "self_destruct_time", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSelfDestructTypeTimer) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSelfDestructTypeTimer#508d57cd as nil") - } - b.PutID(MessageSelfDestructTypeTimerTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSelfDestructTypeTimer) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSelfDestructTypeTimer#508d57cd as nil") - } - b.PutInt32(m.SelfDestructTime) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSelfDestructTypeTimer) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSelfDestructTypeTimer#508d57cd to nil") - } - if err := b.ConsumeID(MessageSelfDestructTypeTimerTypeID); err != nil { - return fmt.Errorf("unable to decode messageSelfDestructTypeTimer#508d57cd: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSelfDestructTypeTimer) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSelfDestructTypeTimer#508d57cd to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSelfDestructTypeTimer#508d57cd: field self_destruct_time: %w", err) - } - m.SelfDestructTime = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSelfDestructTypeTimer) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSelfDestructTypeTimer#508d57cd as nil") - } - b.ObjStart() - b.PutID("messageSelfDestructTypeTimer") - b.Comma() - b.FieldStart("self_destruct_time") - b.PutInt32(m.SelfDestructTime) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSelfDestructTypeTimer) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSelfDestructTypeTimer#508d57cd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSelfDestructTypeTimer"); err != nil { - return fmt.Errorf("unable to decode messageSelfDestructTypeTimer#508d57cd: %w", err) - } - case "self_destruct_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSelfDestructTypeTimer#508d57cd: field self_destruct_time: %w", err) - } - m.SelfDestructTime = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSelfDestructTime returns value of SelfDestructTime field. -func (m *MessageSelfDestructTypeTimer) GetSelfDestructTime() (value int32) { - if m == nil { - return - } - return m.SelfDestructTime -} - -// MessageSelfDestructTypeImmediately represents TL type `messageSelfDestructTypeImmediately#c23c9005`. -type MessageSelfDestructTypeImmediately struct { -} - -// MessageSelfDestructTypeImmediatelyTypeID is TL type id of MessageSelfDestructTypeImmediately. -const MessageSelfDestructTypeImmediatelyTypeID = 0xc23c9005 - -// construct implements constructor of MessageSelfDestructTypeClass. -func (m MessageSelfDestructTypeImmediately) construct() MessageSelfDestructTypeClass { return &m } - -// Ensuring interfaces in compile-time for MessageSelfDestructTypeImmediately. -var ( - _ bin.Encoder = &MessageSelfDestructTypeImmediately{} - _ bin.Decoder = &MessageSelfDestructTypeImmediately{} - _ bin.BareEncoder = &MessageSelfDestructTypeImmediately{} - _ bin.BareDecoder = &MessageSelfDestructTypeImmediately{} - - _ MessageSelfDestructTypeClass = &MessageSelfDestructTypeImmediately{} -) - -func (m *MessageSelfDestructTypeImmediately) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSelfDestructTypeImmediately) String() string { - if m == nil { - return "MessageSelfDestructTypeImmediately(nil)" - } - type Alias MessageSelfDestructTypeImmediately - return fmt.Sprintf("MessageSelfDestructTypeImmediately%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSelfDestructTypeImmediately) TypeID() uint32 { - return MessageSelfDestructTypeImmediatelyTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSelfDestructTypeImmediately) TypeName() string { - return "messageSelfDestructTypeImmediately" -} - -// TypeInfo returns info about TL type. -func (m *MessageSelfDestructTypeImmediately) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSelfDestructTypeImmediately", - ID: MessageSelfDestructTypeImmediatelyTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSelfDestructTypeImmediately) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSelfDestructTypeImmediately#c23c9005 as nil") - } - b.PutID(MessageSelfDestructTypeImmediatelyTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSelfDestructTypeImmediately) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSelfDestructTypeImmediately#c23c9005 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSelfDestructTypeImmediately) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSelfDestructTypeImmediately#c23c9005 to nil") - } - if err := b.ConsumeID(MessageSelfDestructTypeImmediatelyTypeID); err != nil { - return fmt.Errorf("unable to decode messageSelfDestructTypeImmediately#c23c9005: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSelfDestructTypeImmediately) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSelfDestructTypeImmediately#c23c9005 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSelfDestructTypeImmediately) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSelfDestructTypeImmediately#c23c9005 as nil") - } - b.ObjStart() - b.PutID("messageSelfDestructTypeImmediately") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSelfDestructTypeImmediately) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSelfDestructTypeImmediately#c23c9005 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSelfDestructTypeImmediately"); err != nil { - return fmt.Errorf("unable to decode messageSelfDestructTypeImmediately#c23c9005: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSelfDestructTypeClassName is schema name of MessageSelfDestructTypeClass. -const MessageSelfDestructTypeClassName = "MessageSelfDestructType" - -// MessageSelfDestructTypeClass represents MessageSelfDestructType generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageSelfDestructType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageSelfDestructTypeTimer: // messageSelfDestructTypeTimer#508d57cd -// case *tdapi.MessageSelfDestructTypeImmediately: // messageSelfDestructTypeImmediately#c23c9005 -// default: panic(v) -// } -type MessageSelfDestructTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageSelfDestructTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMessageSelfDestructType implements binary de-serialization for MessageSelfDestructTypeClass. -func DecodeMessageSelfDestructType(buf *bin.Buffer) (MessageSelfDestructTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageSelfDestructTypeTimerTypeID: - // Decoding messageSelfDestructTypeTimer#508d57cd. - v := MessageSelfDestructTypeTimer{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSelfDestructTypeClass: %w", err) - } - return &v, nil - case MessageSelfDestructTypeImmediatelyTypeID: - // Decoding messageSelfDestructTypeImmediately#c23c9005. - v := MessageSelfDestructTypeImmediately{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSelfDestructTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSelfDestructTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageSelfDestructType implements binary de-serialization for MessageSelfDestructTypeClass. -func DecodeTDLibJSONMessageSelfDestructType(buf tdjson.Decoder) (MessageSelfDestructTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageSelfDestructTypeTimer": - // Decoding messageSelfDestructTypeTimer#508d57cd. - v := MessageSelfDestructTypeTimer{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSelfDestructTypeClass: %w", err) - } - return &v, nil - case "messageSelfDestructTypeImmediately": - // Decoding messageSelfDestructTypeImmediately#c23c9005. - v := MessageSelfDestructTypeImmediately{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSelfDestructTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSelfDestructTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageSelfDestructType boxes the MessageSelfDestructTypeClass providing a helper. -type MessageSelfDestructTypeBox struct { - MessageSelfDestructType MessageSelfDestructTypeClass -} - -// Decode implements bin.Decoder for MessageSelfDestructTypeBox. -func (b *MessageSelfDestructTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSelfDestructTypeBox to nil") - } - v, err := DecodeMessageSelfDestructType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSelfDestructType = v - return nil -} - -// Encode implements bin.Encode for MessageSelfDestructTypeBox. -func (b *MessageSelfDestructTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageSelfDestructType == nil { - return fmt.Errorf("unable to encode MessageSelfDestructTypeClass as nil") - } - return b.MessageSelfDestructType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageSelfDestructTypeBox. -func (b *MessageSelfDestructTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSelfDestructTypeBox to nil") - } - v, err := DecodeTDLibJSONMessageSelfDestructType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSelfDestructType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageSelfDestructTypeBox. -func (b *MessageSelfDestructTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageSelfDestructType == nil { - return fmt.Errorf("unable to encode MessageSelfDestructTypeClass as nil") - } - return b.MessageSelfDestructType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_message_send_options_gen.go b/tdapi/tl_message_send_options_gen.go deleted file mode 100644 index a32f74f43..000000000 --- a/tdapi/tl_message_send_options_gen.go +++ /dev/null @@ -1,482 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageSendOptions represents TL type `messageSendOptions#2e463a4a`. -type MessageSendOptions struct { - // Pass true to disable notification for the message - DisableNotification bool - // Pass true if the message is sent from the background - FromBackground bool - // Pass true if the content of the message must be protected from forwarding and saving; - // for bots only - ProtectContent bool - // Pass true to allow the message to ignore regular broadcast limits for a small fee; for - // bots only - AllowPaidBroadcast bool - // Pass true if the user explicitly chosen a sticker or a custom emoji from an installed - // sticker set; applicable only to sendMessage and sendMessageAlbum - UpdateOrderOfInstalledStickerSets bool - // Message scheduling state; pass null to send message immediately. Messages sent to a - // secret chat, live location messages and self-destructing messages can't be scheduled - SchedulingState MessageSchedulingStateClass - // Identifier of the effect to apply to the message; pass 0 if none; applicable only to - // sendMessage and sendMessageAlbum in private chats - EffectID int64 - // Non-persistent identifier, which will be returned back in messageSendingStatePending - // object and can be used to match sent messages and corresponding updateNewMessage - // updates - SendingID int32 - // Pass true to get a fake message instead of actually sending them - OnlyPreview bool -} - -// MessageSendOptionsTypeID is TL type id of MessageSendOptions. -const MessageSendOptionsTypeID = 0x2e463a4a - -// Ensuring interfaces in compile-time for MessageSendOptions. -var ( - _ bin.Encoder = &MessageSendOptions{} - _ bin.Decoder = &MessageSendOptions{} - _ bin.BareEncoder = &MessageSendOptions{} - _ bin.BareDecoder = &MessageSendOptions{} -) - -func (m *MessageSendOptions) Zero() bool { - if m == nil { - return true - } - if !(m.DisableNotification == false) { - return false - } - if !(m.FromBackground == false) { - return false - } - if !(m.ProtectContent == false) { - return false - } - if !(m.AllowPaidBroadcast == false) { - return false - } - if !(m.UpdateOrderOfInstalledStickerSets == false) { - return false - } - if !(m.SchedulingState == nil) { - return false - } - if !(m.EffectID == 0) { - return false - } - if !(m.SendingID == 0) { - return false - } - if !(m.OnlyPreview == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSendOptions) String() string { - if m == nil { - return "MessageSendOptions(nil)" - } - type Alias MessageSendOptions - return fmt.Sprintf("MessageSendOptions%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSendOptions) TypeID() uint32 { - return MessageSendOptionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSendOptions) TypeName() string { - return "messageSendOptions" -} - -// TypeInfo returns info about TL type. -func (m *MessageSendOptions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSendOptions", - ID: MessageSendOptionsTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DisableNotification", - SchemaName: "disable_notification", - }, - { - Name: "FromBackground", - SchemaName: "from_background", - }, - { - Name: "ProtectContent", - SchemaName: "protect_content", - }, - { - Name: "AllowPaidBroadcast", - SchemaName: "allow_paid_broadcast", - }, - { - Name: "UpdateOrderOfInstalledStickerSets", - SchemaName: "update_order_of_installed_sticker_sets", - }, - { - Name: "SchedulingState", - SchemaName: "scheduling_state", - }, - { - Name: "EffectID", - SchemaName: "effect_id", - }, - { - Name: "SendingID", - SchemaName: "sending_id", - }, - { - Name: "OnlyPreview", - SchemaName: "only_preview", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSendOptions) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSendOptions#2e463a4a as nil") - } - b.PutID(MessageSendOptionsTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSendOptions) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSendOptions#2e463a4a as nil") - } - b.PutBool(m.DisableNotification) - b.PutBool(m.FromBackground) - b.PutBool(m.ProtectContent) - b.PutBool(m.AllowPaidBroadcast) - b.PutBool(m.UpdateOrderOfInstalledStickerSets) - if m.SchedulingState == nil { - return fmt.Errorf("unable to encode messageSendOptions#2e463a4a: field scheduling_state is nil") - } - if err := m.SchedulingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageSendOptions#2e463a4a: field scheduling_state: %w", err) - } - b.PutLong(m.EffectID) - b.PutInt32(m.SendingID) - b.PutBool(m.OnlyPreview) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSendOptions) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSendOptions#2e463a4a to nil") - } - if err := b.ConsumeID(MessageSendOptionsTypeID); err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSendOptions) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSendOptions#2e463a4a to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field disable_notification: %w", err) - } - m.DisableNotification = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field from_background: %w", err) - } - m.FromBackground = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field protect_content: %w", err) - } - m.ProtectContent = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field allow_paid_broadcast: %w", err) - } - m.AllowPaidBroadcast = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field update_order_of_installed_sticker_sets: %w", err) - } - m.UpdateOrderOfInstalledStickerSets = value - } - { - value, err := DecodeMessageSchedulingState(b) - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field scheduling_state: %w", err) - } - m.SchedulingState = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field effect_id: %w", err) - } - m.EffectID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field sending_id: %w", err) - } - m.SendingID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field only_preview: %w", err) - } - m.OnlyPreview = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSendOptions) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSendOptions#2e463a4a as nil") - } - b.ObjStart() - b.PutID("messageSendOptions") - b.Comma() - b.FieldStart("disable_notification") - b.PutBool(m.DisableNotification) - b.Comma() - b.FieldStart("from_background") - b.PutBool(m.FromBackground) - b.Comma() - b.FieldStart("protect_content") - b.PutBool(m.ProtectContent) - b.Comma() - b.FieldStart("allow_paid_broadcast") - b.PutBool(m.AllowPaidBroadcast) - b.Comma() - b.FieldStart("update_order_of_installed_sticker_sets") - b.PutBool(m.UpdateOrderOfInstalledStickerSets) - b.Comma() - b.FieldStart("scheduling_state") - if m.SchedulingState == nil { - return fmt.Errorf("unable to encode messageSendOptions#2e463a4a: field scheduling_state is nil") - } - if err := m.SchedulingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageSendOptions#2e463a4a: field scheduling_state: %w", err) - } - b.Comma() - b.FieldStart("effect_id") - b.PutLong(m.EffectID) - b.Comma() - b.FieldStart("sending_id") - b.PutInt32(m.SendingID) - b.Comma() - b.FieldStart("only_preview") - b.PutBool(m.OnlyPreview) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSendOptions) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSendOptions#2e463a4a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSendOptions"); err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: %w", err) - } - case "disable_notification": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field disable_notification: %w", err) - } - m.DisableNotification = value - case "from_background": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field from_background: %w", err) - } - m.FromBackground = value - case "protect_content": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field protect_content: %w", err) - } - m.ProtectContent = value - case "allow_paid_broadcast": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field allow_paid_broadcast: %w", err) - } - m.AllowPaidBroadcast = value - case "update_order_of_installed_sticker_sets": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field update_order_of_installed_sticker_sets: %w", err) - } - m.UpdateOrderOfInstalledStickerSets = value - case "scheduling_state": - value, err := DecodeTDLibJSONMessageSchedulingState(b) - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field scheduling_state: %w", err) - } - m.SchedulingState = value - case "effect_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field effect_id: %w", err) - } - m.EffectID = value - case "sending_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field sending_id: %w", err) - } - m.SendingID = value - case "only_preview": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendOptions#2e463a4a: field only_preview: %w", err) - } - m.OnlyPreview = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDisableNotification returns value of DisableNotification field. -func (m *MessageSendOptions) GetDisableNotification() (value bool) { - if m == nil { - return - } - return m.DisableNotification -} - -// GetFromBackground returns value of FromBackground field. -func (m *MessageSendOptions) GetFromBackground() (value bool) { - if m == nil { - return - } - return m.FromBackground -} - -// GetProtectContent returns value of ProtectContent field. -func (m *MessageSendOptions) GetProtectContent() (value bool) { - if m == nil { - return - } - return m.ProtectContent -} - -// GetAllowPaidBroadcast returns value of AllowPaidBroadcast field. -func (m *MessageSendOptions) GetAllowPaidBroadcast() (value bool) { - if m == nil { - return - } - return m.AllowPaidBroadcast -} - -// GetUpdateOrderOfInstalledStickerSets returns value of UpdateOrderOfInstalledStickerSets field. -func (m *MessageSendOptions) GetUpdateOrderOfInstalledStickerSets() (value bool) { - if m == nil { - return - } - return m.UpdateOrderOfInstalledStickerSets -} - -// GetSchedulingState returns value of SchedulingState field. -func (m *MessageSendOptions) GetSchedulingState() (value MessageSchedulingStateClass) { - if m == nil { - return - } - return m.SchedulingState -} - -// GetEffectID returns value of EffectID field. -func (m *MessageSendOptions) GetEffectID() (value int64) { - if m == nil { - return - } - return m.EffectID -} - -// GetSendingID returns value of SendingID field. -func (m *MessageSendOptions) GetSendingID() (value int32) { - if m == nil { - return - } - return m.SendingID -} - -// GetOnlyPreview returns value of OnlyPreview field. -func (m *MessageSendOptions) GetOnlyPreview() (value bool) { - if m == nil { - return - } - return m.OnlyPreview -} diff --git a/tdapi/tl_message_sender_gen.go b/tdapi/tl_message_sender_gen.go deleted file mode 100644 index 479ffe838..000000000 --- a/tdapi/tl_message_sender_gen.go +++ /dev/null @@ -1,501 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageSenderUser represents TL type `messageSenderUser#ebf760e3`. -type MessageSenderUser struct { - // Identifier of the user that sent the message - UserID int64 -} - -// MessageSenderUserTypeID is TL type id of MessageSenderUser. -const MessageSenderUserTypeID = 0xebf760e3 - -// construct implements constructor of MessageSenderClass. -func (m MessageSenderUser) construct() MessageSenderClass { return &m } - -// Ensuring interfaces in compile-time for MessageSenderUser. -var ( - _ bin.Encoder = &MessageSenderUser{} - _ bin.Decoder = &MessageSenderUser{} - _ bin.BareEncoder = &MessageSenderUser{} - _ bin.BareDecoder = &MessageSenderUser{} - - _ MessageSenderClass = &MessageSenderUser{} -) - -func (m *MessageSenderUser) Zero() bool { - if m == nil { - return true - } - if !(m.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSenderUser) String() string { - if m == nil { - return "MessageSenderUser(nil)" - } - type Alias MessageSenderUser - return fmt.Sprintf("MessageSenderUser%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSenderUser) TypeID() uint32 { - return MessageSenderUserTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSenderUser) TypeName() string { - return "messageSenderUser" -} - -// TypeInfo returns info about TL type. -func (m *MessageSenderUser) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSenderUser", - ID: MessageSenderUserTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSenderUser) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSenderUser#ebf760e3 as nil") - } - b.PutID(MessageSenderUserTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSenderUser) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSenderUser#ebf760e3 as nil") - } - b.PutInt53(m.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSenderUser) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSenderUser#ebf760e3 to nil") - } - if err := b.ConsumeID(MessageSenderUserTypeID); err != nil { - return fmt.Errorf("unable to decode messageSenderUser#ebf760e3: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSenderUser) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSenderUser#ebf760e3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageSenderUser#ebf760e3: field user_id: %w", err) - } - m.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSenderUser) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSenderUser#ebf760e3 as nil") - } - b.ObjStart() - b.PutID("messageSenderUser") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(m.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSenderUser) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSenderUser#ebf760e3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSenderUser"); err != nil { - return fmt.Errorf("unable to decode messageSenderUser#ebf760e3: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageSenderUser#ebf760e3: field user_id: %w", err) - } - m.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (m *MessageSenderUser) GetUserID() (value int64) { - if m == nil { - return - } - return m.UserID -} - -// MessageSenderChat represents TL type `messageSenderChat#f1b71131`. -type MessageSenderChat struct { - // Identifier of the chat that sent the message - ChatID int64 -} - -// MessageSenderChatTypeID is TL type id of MessageSenderChat. -const MessageSenderChatTypeID = 0xf1b71131 - -// construct implements constructor of MessageSenderClass. -func (m MessageSenderChat) construct() MessageSenderClass { return &m } - -// Ensuring interfaces in compile-time for MessageSenderChat. -var ( - _ bin.Encoder = &MessageSenderChat{} - _ bin.Decoder = &MessageSenderChat{} - _ bin.BareEncoder = &MessageSenderChat{} - _ bin.BareDecoder = &MessageSenderChat{} - - _ MessageSenderClass = &MessageSenderChat{} -) - -func (m *MessageSenderChat) Zero() bool { - if m == nil { - return true - } - if !(m.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSenderChat) String() string { - if m == nil { - return "MessageSenderChat(nil)" - } - type Alias MessageSenderChat - return fmt.Sprintf("MessageSenderChat%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSenderChat) TypeID() uint32 { - return MessageSenderChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSenderChat) TypeName() string { - return "messageSenderChat" -} - -// TypeInfo returns info about TL type. -func (m *MessageSenderChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSenderChat", - ID: MessageSenderChatTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSenderChat) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSenderChat#f1b71131 as nil") - } - b.PutID(MessageSenderChatTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSenderChat) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSenderChat#f1b71131 as nil") - } - b.PutInt53(m.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSenderChat) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSenderChat#f1b71131 to nil") - } - if err := b.ConsumeID(MessageSenderChatTypeID); err != nil { - return fmt.Errorf("unable to decode messageSenderChat#f1b71131: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSenderChat) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSenderChat#f1b71131 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageSenderChat#f1b71131: field chat_id: %w", err) - } - m.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSenderChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSenderChat#f1b71131 as nil") - } - b.ObjStart() - b.PutID("messageSenderChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(m.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSenderChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSenderChat#f1b71131 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSenderChat"); err != nil { - return fmt.Errorf("unable to decode messageSenderChat#f1b71131: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageSenderChat#f1b71131: field chat_id: %w", err) - } - m.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (m *MessageSenderChat) GetChatID() (value int64) { - if m == nil { - return - } - return m.ChatID -} - -// MessageSenderClassName is schema name of MessageSenderClass. -const MessageSenderClassName = "MessageSender" - -// MessageSenderClass represents MessageSender generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageSender(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageSenderUser: // messageSenderUser#ebf760e3 -// case *tdapi.MessageSenderChat: // messageSenderChat#f1b71131 -// default: panic(v) -// } -type MessageSenderClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageSenderClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMessageSender implements binary de-serialization for MessageSenderClass. -func DecodeMessageSender(buf *bin.Buffer) (MessageSenderClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageSenderUserTypeID: - // Decoding messageSenderUser#ebf760e3. - v := MessageSenderUser{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSenderClass: %w", err) - } - return &v, nil - case MessageSenderChatTypeID: - // Decoding messageSenderChat#f1b71131. - v := MessageSenderChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSenderClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSenderClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageSender implements binary de-serialization for MessageSenderClass. -func DecodeTDLibJSONMessageSender(buf tdjson.Decoder) (MessageSenderClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageSenderUser": - // Decoding messageSenderUser#ebf760e3. - v := MessageSenderUser{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSenderClass: %w", err) - } - return &v, nil - case "messageSenderChat": - // Decoding messageSenderChat#f1b71131. - v := MessageSenderChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSenderClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSenderClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageSender boxes the MessageSenderClass providing a helper. -type MessageSenderBox struct { - MessageSender MessageSenderClass -} - -// Decode implements bin.Decoder for MessageSenderBox. -func (b *MessageSenderBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSenderBox to nil") - } - v, err := DecodeMessageSender(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSender = v - return nil -} - -// Encode implements bin.Encode for MessageSenderBox. -func (b *MessageSenderBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageSender == nil { - return fmt.Errorf("unable to encode MessageSenderClass as nil") - } - return b.MessageSender.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageSenderBox. -func (b *MessageSenderBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSenderBox to nil") - } - v, err := DecodeTDLibJSONMessageSender(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSender = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageSenderBox. -func (b *MessageSenderBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageSender == nil { - return fmt.Errorf("unable to encode MessageSenderClass as nil") - } - return b.MessageSender.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_message_senders_gen.go b/tdapi/tl_message_senders_gen.go deleted file mode 100644 index 10ee55cd1..000000000 --- a/tdapi/tl_message_senders_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageSenders represents TL type `messageSenders#f6929bcc`. -type MessageSenders struct { - // Approximate total number of messages senders found - TotalCount int32 - // List of message senders - Senders []MessageSenderClass -} - -// MessageSendersTypeID is TL type id of MessageSenders. -const MessageSendersTypeID = 0xf6929bcc - -// Ensuring interfaces in compile-time for MessageSenders. -var ( - _ bin.Encoder = &MessageSenders{} - _ bin.Decoder = &MessageSenders{} - _ bin.BareEncoder = &MessageSenders{} - _ bin.BareDecoder = &MessageSenders{} -) - -func (m *MessageSenders) Zero() bool { - if m == nil { - return true - } - if !(m.TotalCount == 0) { - return false - } - if !(m.Senders == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSenders) String() string { - if m == nil { - return "MessageSenders(nil)" - } - type Alias MessageSenders - return fmt.Sprintf("MessageSenders%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSenders) TypeID() uint32 { - return MessageSendersTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSenders) TypeName() string { - return "messageSenders" -} - -// TypeInfo returns info about TL type. -func (m *MessageSenders) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSenders", - ID: MessageSendersTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Senders", - SchemaName: "senders", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSenders) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSenders#f6929bcc as nil") - } - b.PutID(MessageSendersTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSenders) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSenders#f6929bcc as nil") - } - b.PutInt32(m.TotalCount) - b.PutInt(len(m.Senders)) - for idx, v := range m.Senders { - if v == nil { - return fmt.Errorf("unable to encode messageSenders#f6929bcc: field senders element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messageSenders#f6929bcc: field senders element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSenders) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSenders#f6929bcc to nil") - } - if err := b.ConsumeID(MessageSendersTypeID); err != nil { - return fmt.Errorf("unable to decode messageSenders#f6929bcc: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSenders) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSenders#f6929bcc to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSenders#f6929bcc: field total_count: %w", err) - } - m.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageSenders#f6929bcc: field senders: %w", err) - } - - if headerLen > 0 { - m.Senders = make([]MessageSenderClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageSenders#f6929bcc: field senders: %w", err) - } - m.Senders = append(m.Senders, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSenders) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSenders#f6929bcc as nil") - } - b.ObjStart() - b.PutID("messageSenders") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(m.TotalCount) - b.Comma() - b.FieldStart("senders") - b.ArrStart() - for idx, v := range m.Senders { - if v == nil { - return fmt.Errorf("unable to encode messageSenders#f6929bcc: field senders element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageSenders#f6929bcc: field senders element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSenders) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSenders#f6929bcc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSenders"); err != nil { - return fmt.Errorf("unable to decode messageSenders#f6929bcc: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSenders#f6929bcc: field total_count: %w", err) - } - m.TotalCount = value - case "senders": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode messageSenders#f6929bcc: field senders: %w", err) - } - m.Senders = append(m.Senders, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageSenders#f6929bcc: field senders: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (m *MessageSenders) GetTotalCount() (value int32) { - if m == nil { - return - } - return m.TotalCount -} - -// GetSenders returns value of Senders field. -func (m *MessageSenders) GetSenders() (value []MessageSenderClass) { - if m == nil { - return - } - return m.Senders -} diff --git a/tdapi/tl_message_sending_state_gen.go b/tdapi/tl_message_sending_state_gen.go deleted file mode 100644 index 2c79a6273..000000000 --- a/tdapi/tl_message_sending_state_gen.go +++ /dev/null @@ -1,675 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageSendingStatePending represents TL type `messageSendingStatePending#f32b63b4`. -type MessageSendingStatePending struct { - // Non-persistent message sending identifier, specified by the application - SendingID int32 -} - -// MessageSendingStatePendingTypeID is TL type id of MessageSendingStatePending. -const MessageSendingStatePendingTypeID = 0xf32b63b4 - -// construct implements constructor of MessageSendingStateClass. -func (m MessageSendingStatePending) construct() MessageSendingStateClass { return &m } - -// Ensuring interfaces in compile-time for MessageSendingStatePending. -var ( - _ bin.Encoder = &MessageSendingStatePending{} - _ bin.Decoder = &MessageSendingStatePending{} - _ bin.BareEncoder = &MessageSendingStatePending{} - _ bin.BareDecoder = &MessageSendingStatePending{} - - _ MessageSendingStateClass = &MessageSendingStatePending{} -) - -func (m *MessageSendingStatePending) Zero() bool { - if m == nil { - return true - } - if !(m.SendingID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSendingStatePending) String() string { - if m == nil { - return "MessageSendingStatePending(nil)" - } - type Alias MessageSendingStatePending - return fmt.Sprintf("MessageSendingStatePending%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSendingStatePending) TypeID() uint32 { - return MessageSendingStatePendingTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSendingStatePending) TypeName() string { - return "messageSendingStatePending" -} - -// TypeInfo returns info about TL type. -func (m *MessageSendingStatePending) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSendingStatePending", - ID: MessageSendingStatePendingTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SendingID", - SchemaName: "sending_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSendingStatePending) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSendingStatePending#f32b63b4 as nil") - } - b.PutID(MessageSendingStatePendingTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSendingStatePending) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSendingStatePending#f32b63b4 as nil") - } - b.PutInt32(m.SendingID) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSendingStatePending) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSendingStatePending#f32b63b4 to nil") - } - if err := b.ConsumeID(MessageSendingStatePendingTypeID); err != nil { - return fmt.Errorf("unable to decode messageSendingStatePending#f32b63b4: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSendingStatePending) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSendingStatePending#f32b63b4 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStatePending#f32b63b4: field sending_id: %w", err) - } - m.SendingID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSendingStatePending) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSendingStatePending#f32b63b4 as nil") - } - b.ObjStart() - b.PutID("messageSendingStatePending") - b.Comma() - b.FieldStart("sending_id") - b.PutInt32(m.SendingID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSendingStatePending) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSendingStatePending#f32b63b4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSendingStatePending"); err != nil { - return fmt.Errorf("unable to decode messageSendingStatePending#f32b63b4: %w", err) - } - case "sending_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStatePending#f32b63b4: field sending_id: %w", err) - } - m.SendingID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSendingID returns value of SendingID field. -func (m *MessageSendingStatePending) GetSendingID() (value int32) { - if m == nil { - return - } - return m.SendingID -} - -// MessageSendingStateFailed represents TL type `messageSendingStateFailed#ac81ee5e`. -type MessageSendingStateFailed struct { - // The cause of the message sending failure - Error Error - // True, if the message can be re-sent using resendMessages or - // readdQuickReplyShortcutMessages - CanRetry bool - // True, if the message can be re-sent only on behalf of a different sender - NeedAnotherSender bool - // True, if the message can be re-sent only if another quote is chosen in the message - // that is replied by the given message - NeedAnotherReplyQuote bool - // True, if the message can be re-sent only if the message to be replied is removed. This - // will be done automatically by resendMessages - NeedDropReply bool - // Time left before the message can be re-sent, in seconds. No update is sent when this - // field changes - RetryAfter float64 -} - -// MessageSendingStateFailedTypeID is TL type id of MessageSendingStateFailed. -const MessageSendingStateFailedTypeID = 0xac81ee5e - -// construct implements constructor of MessageSendingStateClass. -func (m MessageSendingStateFailed) construct() MessageSendingStateClass { return &m } - -// Ensuring interfaces in compile-time for MessageSendingStateFailed. -var ( - _ bin.Encoder = &MessageSendingStateFailed{} - _ bin.Decoder = &MessageSendingStateFailed{} - _ bin.BareEncoder = &MessageSendingStateFailed{} - _ bin.BareDecoder = &MessageSendingStateFailed{} - - _ MessageSendingStateClass = &MessageSendingStateFailed{} -) - -func (m *MessageSendingStateFailed) Zero() bool { - if m == nil { - return true - } - if !(m.Error.Zero()) { - return false - } - if !(m.CanRetry == false) { - return false - } - if !(m.NeedAnotherSender == false) { - return false - } - if !(m.NeedAnotherReplyQuote == false) { - return false - } - if !(m.NeedDropReply == false) { - return false - } - if !(m.RetryAfter == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSendingStateFailed) String() string { - if m == nil { - return "MessageSendingStateFailed(nil)" - } - type Alias MessageSendingStateFailed - return fmt.Sprintf("MessageSendingStateFailed%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSendingStateFailed) TypeID() uint32 { - return MessageSendingStateFailedTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSendingStateFailed) TypeName() string { - return "messageSendingStateFailed" -} - -// TypeInfo returns info about TL type. -func (m *MessageSendingStateFailed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSendingStateFailed", - ID: MessageSendingStateFailedTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Error", - SchemaName: "error", - }, - { - Name: "CanRetry", - SchemaName: "can_retry", - }, - { - Name: "NeedAnotherSender", - SchemaName: "need_another_sender", - }, - { - Name: "NeedAnotherReplyQuote", - SchemaName: "need_another_reply_quote", - }, - { - Name: "NeedDropReply", - SchemaName: "need_drop_reply", - }, - { - Name: "RetryAfter", - SchemaName: "retry_after", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSendingStateFailed) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSendingStateFailed#ac81ee5e as nil") - } - b.PutID(MessageSendingStateFailedTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSendingStateFailed) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSendingStateFailed#ac81ee5e as nil") - } - if err := m.Error.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageSendingStateFailed#ac81ee5e: field error: %w", err) - } - b.PutBool(m.CanRetry) - b.PutBool(m.NeedAnotherSender) - b.PutBool(m.NeedAnotherReplyQuote) - b.PutBool(m.NeedDropReply) - b.PutDouble(m.RetryAfter) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSendingStateFailed) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSendingStateFailed#ac81ee5e to nil") - } - if err := b.ConsumeID(MessageSendingStateFailedTypeID); err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSendingStateFailed) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSendingStateFailed#ac81ee5e to nil") - } - { - if err := m.Error.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field error: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field can_retry: %w", err) - } - m.CanRetry = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field need_another_sender: %w", err) - } - m.NeedAnotherSender = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field need_another_reply_quote: %w", err) - } - m.NeedAnotherReplyQuote = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field need_drop_reply: %w", err) - } - m.NeedDropReply = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field retry_after: %w", err) - } - m.RetryAfter = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSendingStateFailed) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSendingStateFailed#ac81ee5e as nil") - } - b.ObjStart() - b.PutID("messageSendingStateFailed") - b.Comma() - b.FieldStart("error") - if err := m.Error.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageSendingStateFailed#ac81ee5e: field error: %w", err) - } - b.Comma() - b.FieldStart("can_retry") - b.PutBool(m.CanRetry) - b.Comma() - b.FieldStart("need_another_sender") - b.PutBool(m.NeedAnotherSender) - b.Comma() - b.FieldStart("need_another_reply_quote") - b.PutBool(m.NeedAnotherReplyQuote) - b.Comma() - b.FieldStart("need_drop_reply") - b.PutBool(m.NeedDropReply) - b.Comma() - b.FieldStart("retry_after") - b.PutDouble(m.RetryAfter) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSendingStateFailed) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSendingStateFailed#ac81ee5e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSendingStateFailed"); err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: %w", err) - } - case "error": - if err := m.Error.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field error: %w", err) - } - case "can_retry": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field can_retry: %w", err) - } - m.CanRetry = value - case "need_another_sender": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field need_another_sender: %w", err) - } - m.NeedAnotherSender = value - case "need_another_reply_quote": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field need_another_reply_quote: %w", err) - } - m.NeedAnotherReplyQuote = value - case "need_drop_reply": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field need_drop_reply: %w", err) - } - m.NeedDropReply = value - case "retry_after": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode messageSendingStateFailed#ac81ee5e: field retry_after: %w", err) - } - m.RetryAfter = value - default: - return b.Skip() - } - return nil - }) -} - -// GetError returns value of Error field. -func (m *MessageSendingStateFailed) GetError() (value Error) { - if m == nil { - return - } - return m.Error -} - -// GetCanRetry returns value of CanRetry field. -func (m *MessageSendingStateFailed) GetCanRetry() (value bool) { - if m == nil { - return - } - return m.CanRetry -} - -// GetNeedAnotherSender returns value of NeedAnotherSender field. -func (m *MessageSendingStateFailed) GetNeedAnotherSender() (value bool) { - if m == nil { - return - } - return m.NeedAnotherSender -} - -// GetNeedAnotherReplyQuote returns value of NeedAnotherReplyQuote field. -func (m *MessageSendingStateFailed) GetNeedAnotherReplyQuote() (value bool) { - if m == nil { - return - } - return m.NeedAnotherReplyQuote -} - -// GetNeedDropReply returns value of NeedDropReply field. -func (m *MessageSendingStateFailed) GetNeedDropReply() (value bool) { - if m == nil { - return - } - return m.NeedDropReply -} - -// GetRetryAfter returns value of RetryAfter field. -func (m *MessageSendingStateFailed) GetRetryAfter() (value float64) { - if m == nil { - return - } - return m.RetryAfter -} - -// MessageSendingStateClassName is schema name of MessageSendingStateClass. -const MessageSendingStateClassName = "MessageSendingState" - -// MessageSendingStateClass represents MessageSendingState generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageSendingState(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageSendingStatePending: // messageSendingStatePending#f32b63b4 -// case *tdapi.MessageSendingStateFailed: // messageSendingStateFailed#ac81ee5e -// default: panic(v) -// } -type MessageSendingStateClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageSendingStateClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMessageSendingState implements binary de-serialization for MessageSendingStateClass. -func DecodeMessageSendingState(buf *bin.Buffer) (MessageSendingStateClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageSendingStatePendingTypeID: - // Decoding messageSendingStatePending#f32b63b4. - v := MessageSendingStatePending{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSendingStateClass: %w", err) - } - return &v, nil - case MessageSendingStateFailedTypeID: - // Decoding messageSendingStateFailed#ac81ee5e. - v := MessageSendingStateFailed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSendingStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSendingStateClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageSendingState implements binary de-serialization for MessageSendingStateClass. -func DecodeTDLibJSONMessageSendingState(buf tdjson.Decoder) (MessageSendingStateClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageSendingStatePending": - // Decoding messageSendingStatePending#f32b63b4. - v := MessageSendingStatePending{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSendingStateClass: %w", err) - } - return &v, nil - case "messageSendingStateFailed": - // Decoding messageSendingStateFailed#ac81ee5e. - v := MessageSendingStateFailed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSendingStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSendingStateClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageSendingState boxes the MessageSendingStateClass providing a helper. -type MessageSendingStateBox struct { - MessageSendingState MessageSendingStateClass -} - -// Decode implements bin.Decoder for MessageSendingStateBox. -func (b *MessageSendingStateBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSendingStateBox to nil") - } - v, err := DecodeMessageSendingState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSendingState = v - return nil -} - -// Encode implements bin.Encode for MessageSendingStateBox. -func (b *MessageSendingStateBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageSendingState == nil { - return fmt.Errorf("unable to encode MessageSendingStateClass as nil") - } - return b.MessageSendingState.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageSendingStateBox. -func (b *MessageSendingStateBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSendingStateBox to nil") - } - v, err := DecodeTDLibJSONMessageSendingState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSendingState = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageSendingStateBox. -func (b *MessageSendingStateBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageSendingState == nil { - return fmt.Errorf("unable to encode MessageSendingStateClass as nil") - } - return b.MessageSendingState.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_message_source_gen.go b/tdapi/tl_message_source_gen.go deleted file mode 100644 index a33bbed97..000000000 --- a/tdapi/tl_message_source_gen.go +++ /dev/null @@ -1,1599 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageSourceChatHistory represents TL type `messageSourceChatHistory#bf02073c`. -type MessageSourceChatHistory struct { -} - -// MessageSourceChatHistoryTypeID is TL type id of MessageSourceChatHistory. -const MessageSourceChatHistoryTypeID = 0xbf02073c - -// construct implements constructor of MessageSourceClass. -func (m MessageSourceChatHistory) construct() MessageSourceClass { return &m } - -// Ensuring interfaces in compile-time for MessageSourceChatHistory. -var ( - _ bin.Encoder = &MessageSourceChatHistory{} - _ bin.Decoder = &MessageSourceChatHistory{} - _ bin.BareEncoder = &MessageSourceChatHistory{} - _ bin.BareDecoder = &MessageSourceChatHistory{} - - _ MessageSourceClass = &MessageSourceChatHistory{} -) - -func (m *MessageSourceChatHistory) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSourceChatHistory) String() string { - if m == nil { - return "MessageSourceChatHistory(nil)" - } - type Alias MessageSourceChatHistory - return fmt.Sprintf("MessageSourceChatHistory%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSourceChatHistory) TypeID() uint32 { - return MessageSourceChatHistoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSourceChatHistory) TypeName() string { - return "messageSourceChatHistory" -} - -// TypeInfo returns info about TL type. -func (m *MessageSourceChatHistory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSourceChatHistory", - ID: MessageSourceChatHistoryTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSourceChatHistory) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceChatHistory#bf02073c as nil") - } - b.PutID(MessageSourceChatHistoryTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSourceChatHistory) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceChatHistory#bf02073c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSourceChatHistory) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceChatHistory#bf02073c to nil") - } - if err := b.ConsumeID(MessageSourceChatHistoryTypeID); err != nil { - return fmt.Errorf("unable to decode messageSourceChatHistory#bf02073c: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSourceChatHistory) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceChatHistory#bf02073c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSourceChatHistory) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceChatHistory#bf02073c as nil") - } - b.ObjStart() - b.PutID("messageSourceChatHistory") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSourceChatHistory) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceChatHistory#bf02073c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSourceChatHistory"); err != nil { - return fmt.Errorf("unable to decode messageSourceChatHistory#bf02073c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSourceMessageThreadHistory represents TL type `messageSourceMessageThreadHistory#114f9106`. -type MessageSourceMessageThreadHistory struct { -} - -// MessageSourceMessageThreadHistoryTypeID is TL type id of MessageSourceMessageThreadHistory. -const MessageSourceMessageThreadHistoryTypeID = 0x114f9106 - -// construct implements constructor of MessageSourceClass. -func (m MessageSourceMessageThreadHistory) construct() MessageSourceClass { return &m } - -// Ensuring interfaces in compile-time for MessageSourceMessageThreadHistory. -var ( - _ bin.Encoder = &MessageSourceMessageThreadHistory{} - _ bin.Decoder = &MessageSourceMessageThreadHistory{} - _ bin.BareEncoder = &MessageSourceMessageThreadHistory{} - _ bin.BareDecoder = &MessageSourceMessageThreadHistory{} - - _ MessageSourceClass = &MessageSourceMessageThreadHistory{} -) - -func (m *MessageSourceMessageThreadHistory) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSourceMessageThreadHistory) String() string { - if m == nil { - return "MessageSourceMessageThreadHistory(nil)" - } - type Alias MessageSourceMessageThreadHistory - return fmt.Sprintf("MessageSourceMessageThreadHistory%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSourceMessageThreadHistory) TypeID() uint32 { - return MessageSourceMessageThreadHistoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSourceMessageThreadHistory) TypeName() string { - return "messageSourceMessageThreadHistory" -} - -// TypeInfo returns info about TL type. -func (m *MessageSourceMessageThreadHistory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSourceMessageThreadHistory", - ID: MessageSourceMessageThreadHistoryTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSourceMessageThreadHistory) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceMessageThreadHistory#114f9106 as nil") - } - b.PutID(MessageSourceMessageThreadHistoryTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSourceMessageThreadHistory) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceMessageThreadHistory#114f9106 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSourceMessageThreadHistory) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceMessageThreadHistory#114f9106 to nil") - } - if err := b.ConsumeID(MessageSourceMessageThreadHistoryTypeID); err != nil { - return fmt.Errorf("unable to decode messageSourceMessageThreadHistory#114f9106: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSourceMessageThreadHistory) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceMessageThreadHistory#114f9106 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSourceMessageThreadHistory) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceMessageThreadHistory#114f9106 as nil") - } - b.ObjStart() - b.PutID("messageSourceMessageThreadHistory") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSourceMessageThreadHistory) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceMessageThreadHistory#114f9106 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSourceMessageThreadHistory"); err != nil { - return fmt.Errorf("unable to decode messageSourceMessageThreadHistory#114f9106: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSourceForumTopicHistory represents TL type `messageSourceForumTopicHistory#a5842cb7`. -type MessageSourceForumTopicHistory struct { -} - -// MessageSourceForumTopicHistoryTypeID is TL type id of MessageSourceForumTopicHistory. -const MessageSourceForumTopicHistoryTypeID = 0xa5842cb7 - -// construct implements constructor of MessageSourceClass. -func (m MessageSourceForumTopicHistory) construct() MessageSourceClass { return &m } - -// Ensuring interfaces in compile-time for MessageSourceForumTopicHistory. -var ( - _ bin.Encoder = &MessageSourceForumTopicHistory{} - _ bin.Decoder = &MessageSourceForumTopicHistory{} - _ bin.BareEncoder = &MessageSourceForumTopicHistory{} - _ bin.BareDecoder = &MessageSourceForumTopicHistory{} - - _ MessageSourceClass = &MessageSourceForumTopicHistory{} -) - -func (m *MessageSourceForumTopicHistory) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSourceForumTopicHistory) String() string { - if m == nil { - return "MessageSourceForumTopicHistory(nil)" - } - type Alias MessageSourceForumTopicHistory - return fmt.Sprintf("MessageSourceForumTopicHistory%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSourceForumTopicHistory) TypeID() uint32 { - return MessageSourceForumTopicHistoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSourceForumTopicHistory) TypeName() string { - return "messageSourceForumTopicHistory" -} - -// TypeInfo returns info about TL type. -func (m *MessageSourceForumTopicHistory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSourceForumTopicHistory", - ID: MessageSourceForumTopicHistoryTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSourceForumTopicHistory) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceForumTopicHistory#a5842cb7 as nil") - } - b.PutID(MessageSourceForumTopicHistoryTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSourceForumTopicHistory) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceForumTopicHistory#a5842cb7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSourceForumTopicHistory) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceForumTopicHistory#a5842cb7 to nil") - } - if err := b.ConsumeID(MessageSourceForumTopicHistoryTypeID); err != nil { - return fmt.Errorf("unable to decode messageSourceForumTopicHistory#a5842cb7: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSourceForumTopicHistory) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceForumTopicHistory#a5842cb7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSourceForumTopicHistory) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceForumTopicHistory#a5842cb7 as nil") - } - b.ObjStart() - b.PutID("messageSourceForumTopicHistory") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSourceForumTopicHistory) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceForumTopicHistory#a5842cb7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSourceForumTopicHistory"); err != nil { - return fmt.Errorf("unable to decode messageSourceForumTopicHistory#a5842cb7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSourceHistoryPreview represents TL type `messageSourceHistoryPreview#3d0ce411`. -type MessageSourceHistoryPreview struct { -} - -// MessageSourceHistoryPreviewTypeID is TL type id of MessageSourceHistoryPreview. -const MessageSourceHistoryPreviewTypeID = 0x3d0ce411 - -// construct implements constructor of MessageSourceClass. -func (m MessageSourceHistoryPreview) construct() MessageSourceClass { return &m } - -// Ensuring interfaces in compile-time for MessageSourceHistoryPreview. -var ( - _ bin.Encoder = &MessageSourceHistoryPreview{} - _ bin.Decoder = &MessageSourceHistoryPreview{} - _ bin.BareEncoder = &MessageSourceHistoryPreview{} - _ bin.BareDecoder = &MessageSourceHistoryPreview{} - - _ MessageSourceClass = &MessageSourceHistoryPreview{} -) - -func (m *MessageSourceHistoryPreview) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSourceHistoryPreview) String() string { - if m == nil { - return "MessageSourceHistoryPreview(nil)" - } - type Alias MessageSourceHistoryPreview - return fmt.Sprintf("MessageSourceHistoryPreview%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSourceHistoryPreview) TypeID() uint32 { - return MessageSourceHistoryPreviewTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSourceHistoryPreview) TypeName() string { - return "messageSourceHistoryPreview" -} - -// TypeInfo returns info about TL type. -func (m *MessageSourceHistoryPreview) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSourceHistoryPreview", - ID: MessageSourceHistoryPreviewTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSourceHistoryPreview) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceHistoryPreview#3d0ce411 as nil") - } - b.PutID(MessageSourceHistoryPreviewTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSourceHistoryPreview) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceHistoryPreview#3d0ce411 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSourceHistoryPreview) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceHistoryPreview#3d0ce411 to nil") - } - if err := b.ConsumeID(MessageSourceHistoryPreviewTypeID); err != nil { - return fmt.Errorf("unable to decode messageSourceHistoryPreview#3d0ce411: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSourceHistoryPreview) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceHistoryPreview#3d0ce411 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSourceHistoryPreview) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceHistoryPreview#3d0ce411 as nil") - } - b.ObjStart() - b.PutID("messageSourceHistoryPreview") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSourceHistoryPreview) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceHistoryPreview#3d0ce411 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSourceHistoryPreview"); err != nil { - return fmt.Errorf("unable to decode messageSourceHistoryPreview#3d0ce411: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSourceChatList represents TL type `messageSourceChatList#85f70fea`. -type MessageSourceChatList struct { -} - -// MessageSourceChatListTypeID is TL type id of MessageSourceChatList. -const MessageSourceChatListTypeID = 0x85f70fea - -// construct implements constructor of MessageSourceClass. -func (m MessageSourceChatList) construct() MessageSourceClass { return &m } - -// Ensuring interfaces in compile-time for MessageSourceChatList. -var ( - _ bin.Encoder = &MessageSourceChatList{} - _ bin.Decoder = &MessageSourceChatList{} - _ bin.BareEncoder = &MessageSourceChatList{} - _ bin.BareDecoder = &MessageSourceChatList{} - - _ MessageSourceClass = &MessageSourceChatList{} -) - -func (m *MessageSourceChatList) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSourceChatList) String() string { - if m == nil { - return "MessageSourceChatList(nil)" - } - type Alias MessageSourceChatList - return fmt.Sprintf("MessageSourceChatList%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSourceChatList) TypeID() uint32 { - return MessageSourceChatListTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSourceChatList) TypeName() string { - return "messageSourceChatList" -} - -// TypeInfo returns info about TL type. -func (m *MessageSourceChatList) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSourceChatList", - ID: MessageSourceChatListTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSourceChatList) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceChatList#85f70fea as nil") - } - b.PutID(MessageSourceChatListTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSourceChatList) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceChatList#85f70fea as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSourceChatList) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceChatList#85f70fea to nil") - } - if err := b.ConsumeID(MessageSourceChatListTypeID); err != nil { - return fmt.Errorf("unable to decode messageSourceChatList#85f70fea: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSourceChatList) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceChatList#85f70fea to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSourceChatList) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceChatList#85f70fea as nil") - } - b.ObjStart() - b.PutID("messageSourceChatList") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSourceChatList) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceChatList#85f70fea to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSourceChatList"); err != nil { - return fmt.Errorf("unable to decode messageSourceChatList#85f70fea: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSourceSearch represents TL type `messageSourceSearch#72853771`. -type MessageSourceSearch struct { -} - -// MessageSourceSearchTypeID is TL type id of MessageSourceSearch. -const MessageSourceSearchTypeID = 0x72853771 - -// construct implements constructor of MessageSourceClass. -func (m MessageSourceSearch) construct() MessageSourceClass { return &m } - -// Ensuring interfaces in compile-time for MessageSourceSearch. -var ( - _ bin.Encoder = &MessageSourceSearch{} - _ bin.Decoder = &MessageSourceSearch{} - _ bin.BareEncoder = &MessageSourceSearch{} - _ bin.BareDecoder = &MessageSourceSearch{} - - _ MessageSourceClass = &MessageSourceSearch{} -) - -func (m *MessageSourceSearch) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSourceSearch) String() string { - if m == nil { - return "MessageSourceSearch(nil)" - } - type Alias MessageSourceSearch - return fmt.Sprintf("MessageSourceSearch%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSourceSearch) TypeID() uint32 { - return MessageSourceSearchTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSourceSearch) TypeName() string { - return "messageSourceSearch" -} - -// TypeInfo returns info about TL type. -func (m *MessageSourceSearch) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSourceSearch", - ID: MessageSourceSearchTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSourceSearch) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceSearch#72853771 as nil") - } - b.PutID(MessageSourceSearchTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSourceSearch) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceSearch#72853771 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSourceSearch) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceSearch#72853771 to nil") - } - if err := b.ConsumeID(MessageSourceSearchTypeID); err != nil { - return fmt.Errorf("unable to decode messageSourceSearch#72853771: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSourceSearch) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceSearch#72853771 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSourceSearch) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceSearch#72853771 as nil") - } - b.ObjStart() - b.PutID("messageSourceSearch") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSourceSearch) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceSearch#72853771 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSourceSearch"); err != nil { - return fmt.Errorf("unable to decode messageSourceSearch#72853771: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSourceChatEventLog represents TL type `messageSourceChatEventLog#c2ae19bc`. -type MessageSourceChatEventLog struct { -} - -// MessageSourceChatEventLogTypeID is TL type id of MessageSourceChatEventLog. -const MessageSourceChatEventLogTypeID = 0xc2ae19bc - -// construct implements constructor of MessageSourceClass. -func (m MessageSourceChatEventLog) construct() MessageSourceClass { return &m } - -// Ensuring interfaces in compile-time for MessageSourceChatEventLog. -var ( - _ bin.Encoder = &MessageSourceChatEventLog{} - _ bin.Decoder = &MessageSourceChatEventLog{} - _ bin.BareEncoder = &MessageSourceChatEventLog{} - _ bin.BareDecoder = &MessageSourceChatEventLog{} - - _ MessageSourceClass = &MessageSourceChatEventLog{} -) - -func (m *MessageSourceChatEventLog) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSourceChatEventLog) String() string { - if m == nil { - return "MessageSourceChatEventLog(nil)" - } - type Alias MessageSourceChatEventLog - return fmt.Sprintf("MessageSourceChatEventLog%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSourceChatEventLog) TypeID() uint32 { - return MessageSourceChatEventLogTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSourceChatEventLog) TypeName() string { - return "messageSourceChatEventLog" -} - -// TypeInfo returns info about TL type. -func (m *MessageSourceChatEventLog) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSourceChatEventLog", - ID: MessageSourceChatEventLogTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSourceChatEventLog) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceChatEventLog#c2ae19bc as nil") - } - b.PutID(MessageSourceChatEventLogTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSourceChatEventLog) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceChatEventLog#c2ae19bc as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSourceChatEventLog) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceChatEventLog#c2ae19bc to nil") - } - if err := b.ConsumeID(MessageSourceChatEventLogTypeID); err != nil { - return fmt.Errorf("unable to decode messageSourceChatEventLog#c2ae19bc: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSourceChatEventLog) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceChatEventLog#c2ae19bc to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSourceChatEventLog) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceChatEventLog#c2ae19bc as nil") - } - b.ObjStart() - b.PutID("messageSourceChatEventLog") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSourceChatEventLog) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceChatEventLog#c2ae19bc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSourceChatEventLog"); err != nil { - return fmt.Errorf("unable to decode messageSourceChatEventLog#c2ae19bc: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSourceNotification represents TL type `messageSourceNotification#c1a11bed`. -type MessageSourceNotification struct { -} - -// MessageSourceNotificationTypeID is TL type id of MessageSourceNotification. -const MessageSourceNotificationTypeID = 0xc1a11bed - -// construct implements constructor of MessageSourceClass. -func (m MessageSourceNotification) construct() MessageSourceClass { return &m } - -// Ensuring interfaces in compile-time for MessageSourceNotification. -var ( - _ bin.Encoder = &MessageSourceNotification{} - _ bin.Decoder = &MessageSourceNotification{} - _ bin.BareEncoder = &MessageSourceNotification{} - _ bin.BareDecoder = &MessageSourceNotification{} - - _ MessageSourceClass = &MessageSourceNotification{} -) - -func (m *MessageSourceNotification) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSourceNotification) String() string { - if m == nil { - return "MessageSourceNotification(nil)" - } - type Alias MessageSourceNotification - return fmt.Sprintf("MessageSourceNotification%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSourceNotification) TypeID() uint32 { - return MessageSourceNotificationTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSourceNotification) TypeName() string { - return "messageSourceNotification" -} - -// TypeInfo returns info about TL type. -func (m *MessageSourceNotification) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSourceNotification", - ID: MessageSourceNotificationTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSourceNotification) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceNotification#c1a11bed as nil") - } - b.PutID(MessageSourceNotificationTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSourceNotification) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceNotification#c1a11bed as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSourceNotification) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceNotification#c1a11bed to nil") - } - if err := b.ConsumeID(MessageSourceNotificationTypeID); err != nil { - return fmt.Errorf("unable to decode messageSourceNotification#c1a11bed: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSourceNotification) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceNotification#c1a11bed to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSourceNotification) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceNotification#c1a11bed as nil") - } - b.ObjStart() - b.PutID("messageSourceNotification") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSourceNotification) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceNotification#c1a11bed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSourceNotification"); err != nil { - return fmt.Errorf("unable to decode messageSourceNotification#c1a11bed: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSourceScreenshot represents TL type `messageSourceScreenshot#1c035d0a`. -type MessageSourceScreenshot struct { -} - -// MessageSourceScreenshotTypeID is TL type id of MessageSourceScreenshot. -const MessageSourceScreenshotTypeID = 0x1c035d0a - -// construct implements constructor of MessageSourceClass. -func (m MessageSourceScreenshot) construct() MessageSourceClass { return &m } - -// Ensuring interfaces in compile-time for MessageSourceScreenshot. -var ( - _ bin.Encoder = &MessageSourceScreenshot{} - _ bin.Decoder = &MessageSourceScreenshot{} - _ bin.BareEncoder = &MessageSourceScreenshot{} - _ bin.BareDecoder = &MessageSourceScreenshot{} - - _ MessageSourceClass = &MessageSourceScreenshot{} -) - -func (m *MessageSourceScreenshot) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSourceScreenshot) String() string { - if m == nil { - return "MessageSourceScreenshot(nil)" - } - type Alias MessageSourceScreenshot - return fmt.Sprintf("MessageSourceScreenshot%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSourceScreenshot) TypeID() uint32 { - return MessageSourceScreenshotTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSourceScreenshot) TypeName() string { - return "messageSourceScreenshot" -} - -// TypeInfo returns info about TL type. -func (m *MessageSourceScreenshot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSourceScreenshot", - ID: MessageSourceScreenshotTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSourceScreenshot) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceScreenshot#1c035d0a as nil") - } - b.PutID(MessageSourceScreenshotTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSourceScreenshot) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceScreenshot#1c035d0a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSourceScreenshot) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceScreenshot#1c035d0a to nil") - } - if err := b.ConsumeID(MessageSourceScreenshotTypeID); err != nil { - return fmt.Errorf("unable to decode messageSourceScreenshot#1c035d0a: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSourceScreenshot) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceScreenshot#1c035d0a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSourceScreenshot) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceScreenshot#1c035d0a as nil") - } - b.ObjStart() - b.PutID("messageSourceScreenshot") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSourceScreenshot) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceScreenshot#1c035d0a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSourceScreenshot"); err != nil { - return fmt.Errorf("unable to decode messageSourceScreenshot#1c035d0a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSourceOther represents TL type `messageSourceOther#35c0a702`. -type MessageSourceOther struct { -} - -// MessageSourceOtherTypeID is TL type id of MessageSourceOther. -const MessageSourceOtherTypeID = 0x35c0a702 - -// construct implements constructor of MessageSourceClass. -func (m MessageSourceOther) construct() MessageSourceClass { return &m } - -// Ensuring interfaces in compile-time for MessageSourceOther. -var ( - _ bin.Encoder = &MessageSourceOther{} - _ bin.Decoder = &MessageSourceOther{} - _ bin.BareEncoder = &MessageSourceOther{} - _ bin.BareDecoder = &MessageSourceOther{} - - _ MessageSourceClass = &MessageSourceOther{} -) - -func (m *MessageSourceOther) Zero() bool { - if m == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSourceOther) String() string { - if m == nil { - return "MessageSourceOther(nil)" - } - type Alias MessageSourceOther - return fmt.Sprintf("MessageSourceOther%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSourceOther) TypeID() uint32 { - return MessageSourceOtherTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSourceOther) TypeName() string { - return "messageSourceOther" -} - -// TypeInfo returns info about TL type. -func (m *MessageSourceOther) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSourceOther", - ID: MessageSourceOtherTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSourceOther) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceOther#35c0a702 as nil") - } - b.PutID(MessageSourceOtherTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSourceOther) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceOther#35c0a702 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSourceOther) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceOther#35c0a702 to nil") - } - if err := b.ConsumeID(MessageSourceOtherTypeID); err != nil { - return fmt.Errorf("unable to decode messageSourceOther#35c0a702: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSourceOther) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceOther#35c0a702 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSourceOther) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSourceOther#35c0a702 as nil") - } - b.ObjStart() - b.PutID("messageSourceOther") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSourceOther) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSourceOther#35c0a702 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSourceOther"); err != nil { - return fmt.Errorf("unable to decode messageSourceOther#35c0a702: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// MessageSourceClassName is schema name of MessageSourceClass. -const MessageSourceClassName = "MessageSource" - -// MessageSourceClass represents MessageSource generic type. -// -// Example: -// -// g, err := tdapi.DecodeMessageSource(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.MessageSourceChatHistory: // messageSourceChatHistory#bf02073c -// case *tdapi.MessageSourceMessageThreadHistory: // messageSourceMessageThreadHistory#114f9106 -// case *tdapi.MessageSourceForumTopicHistory: // messageSourceForumTopicHistory#a5842cb7 -// case *tdapi.MessageSourceHistoryPreview: // messageSourceHistoryPreview#3d0ce411 -// case *tdapi.MessageSourceChatList: // messageSourceChatList#85f70fea -// case *tdapi.MessageSourceSearch: // messageSourceSearch#72853771 -// case *tdapi.MessageSourceChatEventLog: // messageSourceChatEventLog#c2ae19bc -// case *tdapi.MessageSourceNotification: // messageSourceNotification#c1a11bed -// case *tdapi.MessageSourceScreenshot: // messageSourceScreenshot#1c035d0a -// case *tdapi.MessageSourceOther: // messageSourceOther#35c0a702 -// default: panic(v) -// } -type MessageSourceClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() MessageSourceClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeMessageSource implements binary de-serialization for MessageSourceClass. -func DecodeMessageSource(buf *bin.Buffer) (MessageSourceClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case MessageSourceChatHistoryTypeID: - // Decoding messageSourceChatHistory#bf02073c. - v := MessageSourceChatHistory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case MessageSourceMessageThreadHistoryTypeID: - // Decoding messageSourceMessageThreadHistory#114f9106. - v := MessageSourceMessageThreadHistory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case MessageSourceForumTopicHistoryTypeID: - // Decoding messageSourceForumTopicHistory#a5842cb7. - v := MessageSourceForumTopicHistory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case MessageSourceHistoryPreviewTypeID: - // Decoding messageSourceHistoryPreview#3d0ce411. - v := MessageSourceHistoryPreview{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case MessageSourceChatListTypeID: - // Decoding messageSourceChatList#85f70fea. - v := MessageSourceChatList{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case MessageSourceSearchTypeID: - // Decoding messageSourceSearch#72853771. - v := MessageSourceSearch{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case MessageSourceChatEventLogTypeID: - // Decoding messageSourceChatEventLog#c2ae19bc. - v := MessageSourceChatEventLog{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case MessageSourceNotificationTypeID: - // Decoding messageSourceNotification#c1a11bed. - v := MessageSourceNotification{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case MessageSourceScreenshotTypeID: - // Decoding messageSourceScreenshot#1c035d0a. - v := MessageSourceScreenshot{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case MessageSourceOtherTypeID: - // Decoding messageSourceOther#35c0a702. - v := MessageSourceOther{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONMessageSource implements binary de-serialization for MessageSourceClass. -func DecodeTDLibJSONMessageSource(buf tdjson.Decoder) (MessageSourceClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "messageSourceChatHistory": - // Decoding messageSourceChatHistory#bf02073c. - v := MessageSourceChatHistory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case "messageSourceMessageThreadHistory": - // Decoding messageSourceMessageThreadHistory#114f9106. - v := MessageSourceMessageThreadHistory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case "messageSourceForumTopicHistory": - // Decoding messageSourceForumTopicHistory#a5842cb7. - v := MessageSourceForumTopicHistory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case "messageSourceHistoryPreview": - // Decoding messageSourceHistoryPreview#3d0ce411. - v := MessageSourceHistoryPreview{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case "messageSourceChatList": - // Decoding messageSourceChatList#85f70fea. - v := MessageSourceChatList{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case "messageSourceSearch": - // Decoding messageSourceSearch#72853771. - v := MessageSourceSearch{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case "messageSourceChatEventLog": - // Decoding messageSourceChatEventLog#c2ae19bc. - v := MessageSourceChatEventLog{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case "messageSourceNotification": - // Decoding messageSourceNotification#c1a11bed. - v := MessageSourceNotification{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case "messageSourceScreenshot": - // Decoding messageSourceScreenshot#1c035d0a. - v := MessageSourceScreenshot{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - case "messageSourceOther": - // Decoding messageSourceOther#35c0a702. - v := MessageSourceOther{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode MessageSourceClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// MessageSource boxes the MessageSourceClass providing a helper. -type MessageSourceBox struct { - MessageSource MessageSourceClass -} - -// Decode implements bin.Decoder for MessageSourceBox. -func (b *MessageSourceBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSourceBox to nil") - } - v, err := DecodeMessageSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSource = v - return nil -} - -// Encode implements bin.Encode for MessageSourceBox. -func (b *MessageSourceBox) Encode(buf *bin.Buffer) error { - if b == nil || b.MessageSource == nil { - return fmt.Errorf("unable to encode MessageSourceClass as nil") - } - return b.MessageSource.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for MessageSourceBox. -func (b *MessageSourceBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode MessageSourceBox to nil") - } - v, err := DecodeTDLibJSONMessageSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.MessageSource = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for MessageSourceBox. -func (b *MessageSourceBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.MessageSource == nil { - return fmt.Errorf("unable to encode MessageSourceClass as nil") - } - return b.MessageSource.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_message_sponsor_gen.go b/tdapi/tl_message_sponsor_gen.go deleted file mode 100644 index 6390aa9f5..000000000 --- a/tdapi/tl_message_sponsor_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageSponsor represents TL type `messageSponsor#77c251de`. -type MessageSponsor struct { - // URL of the sponsor to be opened when the message is clicked - URL string - // Photo of the sponsor; may be null if must not be shown - Photo Photo - // Additional optional information about the sponsor to be shown along with the message - Info string -} - -// MessageSponsorTypeID is TL type id of MessageSponsor. -const MessageSponsorTypeID = 0x77c251de - -// Ensuring interfaces in compile-time for MessageSponsor. -var ( - _ bin.Encoder = &MessageSponsor{} - _ bin.Decoder = &MessageSponsor{} - _ bin.BareEncoder = &MessageSponsor{} - _ bin.BareDecoder = &MessageSponsor{} -) - -func (m *MessageSponsor) Zero() bool { - if m == nil { - return true - } - if !(m.URL == "") { - return false - } - if !(m.Photo.Zero()) { - return false - } - if !(m.Info == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageSponsor) String() string { - if m == nil { - return "MessageSponsor(nil)" - } - type Alias MessageSponsor - return fmt.Sprintf("MessageSponsor%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageSponsor) TypeID() uint32 { - return MessageSponsorTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageSponsor) TypeName() string { - return "messageSponsor" -} - -// TypeInfo returns info about TL type. -func (m *MessageSponsor) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageSponsor", - ID: MessageSponsorTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Info", - SchemaName: "info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageSponsor) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsor#77c251de as nil") - } - b.PutID(MessageSponsorTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageSponsor) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsor#77c251de as nil") - } - b.PutString(m.URL) - if err := m.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageSponsor#77c251de: field photo: %w", err) - } - b.PutString(m.Info) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageSponsor) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsor#77c251de to nil") - } - if err := b.ConsumeID(MessageSponsorTypeID); err != nil { - return fmt.Errorf("unable to decode messageSponsor#77c251de: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageSponsor) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsor#77c251de to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsor#77c251de: field url: %w", err) - } - m.URL = value - } - { - if err := m.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageSponsor#77c251de: field photo: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsor#77c251de: field info: %w", err) - } - m.Info = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageSponsor) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageSponsor#77c251de as nil") - } - b.ObjStart() - b.PutID("messageSponsor") - b.Comma() - b.FieldStart("url") - b.PutString(m.URL) - b.Comma() - b.FieldStart("photo") - if err := m.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageSponsor#77c251de: field photo: %w", err) - } - b.Comma() - b.FieldStart("info") - b.PutString(m.Info) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageSponsor) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageSponsor#77c251de to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageSponsor"); err != nil { - return fmt.Errorf("unable to decode messageSponsor#77c251de: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsor#77c251de: field url: %w", err) - } - m.URL = value - case "photo": - if err := m.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageSponsor#77c251de: field photo: %w", err) - } - case "info": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode messageSponsor#77c251de: field info: %w", err) - } - m.Info = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (m *MessageSponsor) GetURL() (value string) { - if m == nil { - return - } - return m.URL -} - -// GetPhoto returns value of Photo field. -func (m *MessageSponsor) GetPhoto() (value Photo) { - if m == nil { - return - } - return m.Photo -} - -// GetInfo returns value of Info field. -func (m *MessageSponsor) GetInfo() (value string) { - if m == nil { - return - } - return m.Info -} diff --git a/tdapi/tl_message_statistics_gen.go b/tdapi/tl_message_statistics_gen.go deleted file mode 100644 index 965ec38a4..000000000 --- a/tdapi/tl_message_statistics_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageStatistics represents TL type `messageStatistics#a2ce4f07`. -type MessageStatistics struct { - // A graph containing number of message views and shares - MessageInteractionGraph StatisticalGraphClass - // A graph containing number of message reactions - MessageReactionGraph StatisticalGraphClass -} - -// MessageStatisticsTypeID is TL type id of MessageStatistics. -const MessageStatisticsTypeID = 0xa2ce4f07 - -// Ensuring interfaces in compile-time for MessageStatistics. -var ( - _ bin.Encoder = &MessageStatistics{} - _ bin.Decoder = &MessageStatistics{} - _ bin.BareEncoder = &MessageStatistics{} - _ bin.BareDecoder = &MessageStatistics{} -) - -func (m *MessageStatistics) Zero() bool { - if m == nil { - return true - } - if !(m.MessageInteractionGraph == nil) { - return false - } - if !(m.MessageReactionGraph == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageStatistics) String() string { - if m == nil { - return "MessageStatistics(nil)" - } - type Alias MessageStatistics - return fmt.Sprintf("MessageStatistics%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageStatistics) TypeID() uint32 { - return MessageStatisticsTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageStatistics) TypeName() string { - return "messageStatistics" -} - -// TypeInfo returns info about TL type. -func (m *MessageStatistics) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageStatistics", - ID: MessageStatisticsTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageInteractionGraph", - SchemaName: "message_interaction_graph", - }, - { - Name: "MessageReactionGraph", - SchemaName: "message_reaction_graph", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageStatistics) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageStatistics#a2ce4f07 as nil") - } - b.PutID(MessageStatisticsTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageStatistics) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageStatistics#a2ce4f07 as nil") - } - if m.MessageInteractionGraph == nil { - return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_interaction_graph is nil") - } - if err := m.MessageInteractionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_interaction_graph: %w", err) - } - if m.MessageReactionGraph == nil { - return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_reaction_graph is nil") - } - if err := m.MessageReactionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_reaction_graph: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageStatistics) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageStatistics#a2ce4f07 to nil") - } - if err := b.ConsumeID(MessageStatisticsTypeID); err != nil { - return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageStatistics) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageStatistics#a2ce4f07 to nil") - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: field message_interaction_graph: %w", err) - } - m.MessageInteractionGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: field message_reaction_graph: %w", err) - } - m.MessageReactionGraph = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageStatistics#a2ce4f07 as nil") - } - b.ObjStart() - b.PutID("messageStatistics") - b.Comma() - b.FieldStart("message_interaction_graph") - if m.MessageInteractionGraph == nil { - return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_interaction_graph is nil") - } - if err := m.MessageInteractionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_interaction_graph: %w", err) - } - b.Comma() - b.FieldStart("message_reaction_graph") - if m.MessageReactionGraph == nil { - return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_reaction_graph is nil") - } - if err := m.MessageReactionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageStatistics#a2ce4f07: field message_reaction_graph: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageStatistics) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageStatistics#a2ce4f07 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageStatistics"); err != nil { - return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: %w", err) - } - case "message_interaction_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: field message_interaction_graph: %w", err) - } - m.MessageInteractionGraph = value - case "message_reaction_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode messageStatistics#a2ce4f07: field message_reaction_graph: %w", err) - } - m.MessageReactionGraph = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageInteractionGraph returns value of MessageInteractionGraph field. -func (m *MessageStatistics) GetMessageInteractionGraph() (value StatisticalGraphClass) { - if m == nil { - return - } - return m.MessageInteractionGraph -} - -// GetMessageReactionGraph returns value of MessageReactionGraph field. -func (m *MessageStatistics) GetMessageReactionGraph() (value StatisticalGraphClass) { - if m == nil { - return - } - return m.MessageReactionGraph -} diff --git a/tdapi/tl_message_thread_info_gen.go b/tdapi/tl_message_thread_info_gen.go deleted file mode 100644 index 4612a2ea3..000000000 --- a/tdapi/tl_message_thread_info_gen.go +++ /dev/null @@ -1,392 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageThreadInfo represents TL type `messageThreadInfo#683fd5ad`. -type MessageThreadInfo struct { - // Identifier of the chat to which the message thread belongs - ChatID int64 - // Message thread identifier, unique within the chat - MessageThreadID int64 - // Information about the message thread; may be null for forum topic threads - ReplyInfo MessageReplyInfo - // Approximate number of unread messages in the message thread - UnreadMessageCount int32 - // The messages from which the thread starts. The messages are returned in reverse - // chronological order (i.e., in order of decreasing message_id) - Messages []Message - // A draft of a message in the message thread; may be null if none - DraftMessage DraftMessage -} - -// MessageThreadInfoTypeID is TL type id of MessageThreadInfo. -const MessageThreadInfoTypeID = 0x683fd5ad - -// Ensuring interfaces in compile-time for MessageThreadInfo. -var ( - _ bin.Encoder = &MessageThreadInfo{} - _ bin.Decoder = &MessageThreadInfo{} - _ bin.BareEncoder = &MessageThreadInfo{} - _ bin.BareDecoder = &MessageThreadInfo{} -) - -func (m *MessageThreadInfo) Zero() bool { - if m == nil { - return true - } - if !(m.ChatID == 0) { - return false - } - if !(m.MessageThreadID == 0) { - return false - } - if !(m.ReplyInfo.Zero()) { - return false - } - if !(m.UnreadMessageCount == 0) { - return false - } - if !(m.Messages == nil) { - return false - } - if !(m.DraftMessage.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageThreadInfo) String() string { - if m == nil { - return "MessageThreadInfo(nil)" - } - type Alias MessageThreadInfo - return fmt.Sprintf("MessageThreadInfo%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageThreadInfo) TypeID() uint32 { - return MessageThreadInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageThreadInfo) TypeName() string { - return "messageThreadInfo" -} - -// TypeInfo returns info about TL type. -func (m *MessageThreadInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageThreadInfo", - ID: MessageThreadInfoTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "ReplyInfo", - SchemaName: "reply_info", - }, - { - Name: "UnreadMessageCount", - SchemaName: "unread_message_count", - }, - { - Name: "Messages", - SchemaName: "messages", - }, - { - Name: "DraftMessage", - SchemaName: "draft_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageThreadInfo) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageThreadInfo#683fd5ad as nil") - } - b.PutID(MessageThreadInfoTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageThreadInfo) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageThreadInfo#683fd5ad as nil") - } - b.PutInt53(m.ChatID) - b.PutInt53(m.MessageThreadID) - if err := m.ReplyInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageThreadInfo#683fd5ad: field reply_info: %w", err) - } - b.PutInt32(m.UnreadMessageCount) - b.PutInt(len(m.Messages)) - for idx, v := range m.Messages { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messageThreadInfo#683fd5ad: field messages element with index %d: %w", idx, err) - } - } - if err := m.DraftMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode messageThreadInfo#683fd5ad: field draft_message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageThreadInfo) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageThreadInfo#683fd5ad to nil") - } - if err := b.ConsumeID(MessageThreadInfoTypeID); err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageThreadInfo) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageThreadInfo#683fd5ad to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field chat_id: %w", err) - } - m.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field message_thread_id: %w", err) - } - m.MessageThreadID = value - } - { - if err := m.ReplyInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field reply_info: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field unread_message_count: %w", err) - } - m.UnreadMessageCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field messages: %w", err) - } - - if headerLen > 0 { - m.Messages = make([]Message, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Message - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare messageThreadInfo#683fd5ad: field messages: %w", err) - } - m.Messages = append(m.Messages, value) - } - } - { - if err := m.DraftMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field draft_message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageThreadInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageThreadInfo#683fd5ad as nil") - } - b.ObjStart() - b.PutID("messageThreadInfo") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(m.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(m.MessageThreadID) - b.Comma() - b.FieldStart("reply_info") - if err := m.ReplyInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageThreadInfo#683fd5ad: field reply_info: %w", err) - } - b.Comma() - b.FieldStart("unread_message_count") - b.PutInt32(m.UnreadMessageCount) - b.Comma() - b.FieldStart("messages") - b.ArrStart() - for idx, v := range m.Messages { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageThreadInfo#683fd5ad: field messages element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("draft_message") - if err := m.DraftMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageThreadInfo#683fd5ad: field draft_message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageThreadInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageThreadInfo#683fd5ad to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageThreadInfo"); err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field chat_id: %w", err) - } - m.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field message_thread_id: %w", err) - } - m.MessageThreadID = value - case "reply_info": - if err := m.ReplyInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field reply_info: %w", err) - } - case "unread_message_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field unread_message_count: %w", err) - } - m.UnreadMessageCount = value - case "messages": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Message - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field messages: %w", err) - } - m.Messages = append(m.Messages, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field messages: %w", err) - } - case "draft_message": - if err := m.DraftMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageThreadInfo#683fd5ad: field draft_message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (m *MessageThreadInfo) GetChatID() (value int64) { - if m == nil { - return - } - return m.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (m *MessageThreadInfo) GetMessageThreadID() (value int64) { - if m == nil { - return - } - return m.MessageThreadID -} - -// GetReplyInfo returns value of ReplyInfo field. -func (m *MessageThreadInfo) GetReplyInfo() (value MessageReplyInfo) { - if m == nil { - return - } - return m.ReplyInfo -} - -// GetUnreadMessageCount returns value of UnreadMessageCount field. -func (m *MessageThreadInfo) GetUnreadMessageCount() (value int32) { - if m == nil { - return - } - return m.UnreadMessageCount -} - -// GetMessages returns value of Messages field. -func (m *MessageThreadInfo) GetMessages() (value []Message) { - if m == nil { - return - } - return m.Messages -} - -// GetDraftMessage returns value of DraftMessage field. -func (m *MessageThreadInfo) GetDraftMessage() (value DraftMessage) { - if m == nil { - return - } - return m.DraftMessage -} diff --git a/tdapi/tl_message_viewer_gen.go b/tdapi/tl_message_viewer_gen.go deleted file mode 100644 index 593d73d1e..000000000 --- a/tdapi/tl_message_viewer_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageViewer represents TL type `messageViewer#56f111cd`. -type MessageViewer struct { - // User identifier of the viewer - UserID int64 - // Approximate point in time (Unix timestamp) when the message was viewed - ViewDate int32 -} - -// MessageViewerTypeID is TL type id of MessageViewer. -const MessageViewerTypeID = 0x56f111cd - -// Ensuring interfaces in compile-time for MessageViewer. -var ( - _ bin.Encoder = &MessageViewer{} - _ bin.Decoder = &MessageViewer{} - _ bin.BareEncoder = &MessageViewer{} - _ bin.BareDecoder = &MessageViewer{} -) - -func (m *MessageViewer) Zero() bool { - if m == nil { - return true - } - if !(m.UserID == 0) { - return false - } - if !(m.ViewDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageViewer) String() string { - if m == nil { - return "MessageViewer(nil)" - } - type Alias MessageViewer - return fmt.Sprintf("MessageViewer%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageViewer) TypeID() uint32 { - return MessageViewerTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageViewer) TypeName() string { - return "messageViewer" -} - -// TypeInfo returns info about TL type. -func (m *MessageViewer) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageViewer", - ID: MessageViewerTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "ViewDate", - SchemaName: "view_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageViewer) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageViewer#56f111cd as nil") - } - b.PutID(MessageViewerTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageViewer) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageViewer#56f111cd as nil") - } - b.PutInt53(m.UserID) - b.PutInt32(m.ViewDate) - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageViewer) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageViewer#56f111cd to nil") - } - if err := b.ConsumeID(MessageViewerTypeID); err != nil { - return fmt.Errorf("unable to decode messageViewer#56f111cd: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageViewer) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageViewer#56f111cd to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageViewer#56f111cd: field user_id: %w", err) - } - m.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageViewer#56f111cd: field view_date: %w", err) - } - m.ViewDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageViewer) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageViewer#56f111cd as nil") - } - b.ObjStart() - b.PutID("messageViewer") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(m.UserID) - b.Comma() - b.FieldStart("view_date") - b.PutInt32(m.ViewDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageViewer) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageViewer#56f111cd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageViewer"); err != nil { - return fmt.Errorf("unable to decode messageViewer#56f111cd: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode messageViewer#56f111cd: field user_id: %w", err) - } - m.UserID = value - case "view_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messageViewer#56f111cd: field view_date: %w", err) - } - m.ViewDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (m *MessageViewer) GetUserID() (value int64) { - if m == nil { - return - } - return m.UserID -} - -// GetViewDate returns value of ViewDate field. -func (m *MessageViewer) GetViewDate() (value int32) { - if m == nil { - return - } - return m.ViewDate -} diff --git a/tdapi/tl_message_viewers_gen.go b/tdapi/tl_message_viewers_gen.go deleted file mode 100644 index 1322d2c8e..000000000 --- a/tdapi/tl_message_viewers_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// MessageViewers represents TL type `messageViewers#87c73f6c`. -type MessageViewers struct { - // List of message viewers - Viewers []MessageViewer -} - -// MessageViewersTypeID is TL type id of MessageViewers. -const MessageViewersTypeID = 0x87c73f6c - -// Ensuring interfaces in compile-time for MessageViewers. -var ( - _ bin.Encoder = &MessageViewers{} - _ bin.Decoder = &MessageViewers{} - _ bin.BareEncoder = &MessageViewers{} - _ bin.BareDecoder = &MessageViewers{} -) - -func (m *MessageViewers) Zero() bool { - if m == nil { - return true - } - if !(m.Viewers == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *MessageViewers) String() string { - if m == nil { - return "MessageViewers(nil)" - } - type Alias MessageViewers - return fmt.Sprintf("MessageViewers%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*MessageViewers) TypeID() uint32 { - return MessageViewersTypeID -} - -// TypeName returns name of type in TL schema. -func (*MessageViewers) TypeName() string { - return "messageViewers" -} - -// TypeInfo returns info about TL type. -func (m *MessageViewers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messageViewers", - ID: MessageViewersTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Viewers", - SchemaName: "viewers", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *MessageViewers) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageViewers#87c73f6c as nil") - } - b.PutID(MessageViewersTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *MessageViewers) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messageViewers#87c73f6c as nil") - } - b.PutInt(len(m.Viewers)) - for idx, v := range m.Viewers { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messageViewers#87c73f6c: field viewers element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (m *MessageViewers) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageViewers#87c73f6c to nil") - } - if err := b.ConsumeID(MessageViewersTypeID); err != nil { - return fmt.Errorf("unable to decode messageViewers#87c73f6c: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *MessageViewers) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messageViewers#87c73f6c to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messageViewers#87c73f6c: field viewers: %w", err) - } - - if headerLen > 0 { - m.Viewers = make([]MessageViewer, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value MessageViewer - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare messageViewers#87c73f6c: field viewers: %w", err) - } - m.Viewers = append(m.Viewers, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *MessageViewers) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messageViewers#87c73f6c as nil") - } - b.ObjStart() - b.PutID("messageViewers") - b.Comma() - b.FieldStart("viewers") - b.ArrStart() - for idx, v := range m.Viewers { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messageViewers#87c73f6c: field viewers element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *MessageViewers) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messageViewers#87c73f6c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messageViewers"); err != nil { - return fmt.Errorf("unable to decode messageViewers#87c73f6c: %w", err) - } - case "viewers": - if err := b.Arr(func(b tdjson.Decoder) error { - var value MessageViewer - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messageViewers#87c73f6c: field viewers: %w", err) - } - m.Viewers = append(m.Viewers, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messageViewers#87c73f6c: field viewers: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetViewers returns value of Viewers field. -func (m *MessageViewers) GetViewers() (value []MessageViewer) { - if m == nil { - return - } - return m.Viewers -} diff --git a/tdapi/tl_messages_gen.go b/tdapi/tl_messages_gen.go deleted file mode 100644 index 9a66eb378..000000000 --- a/tdapi/tl_messages_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Messages represents TL type `messages#b34c8c60`. -type Messages struct { - // Approximate total number of messages found - TotalCount int32 - // List of messages; messages may be null - Messages []Message -} - -// MessagesTypeID is TL type id of Messages. -const MessagesTypeID = 0xb34c8c60 - -// Ensuring interfaces in compile-time for Messages. -var ( - _ bin.Encoder = &Messages{} - _ bin.Decoder = &Messages{} - _ bin.BareEncoder = &Messages{} - _ bin.BareDecoder = &Messages{} -) - -func (m *Messages) Zero() bool { - if m == nil { - return true - } - if !(m.TotalCount == 0) { - return false - } - if !(m.Messages == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (m *Messages) String() string { - if m == nil { - return "Messages(nil)" - } - type Alias Messages - return fmt.Sprintf("Messages%+v", Alias(*m)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Messages) TypeID() uint32 { - return MessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*Messages) TypeName() string { - return "messages" -} - -// TypeInfo returns info about TL type. -func (m *Messages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "messages", - ID: MessagesTypeID, - } - if m == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Messages", - SchemaName: "messages", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (m *Messages) Encode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messages#b34c8c60 as nil") - } - b.PutID(MessagesTypeID) - return m.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (m *Messages) EncodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't encode messages#b34c8c60 as nil") - } - b.PutInt32(m.TotalCount) - b.PutInt(len(m.Messages)) - for idx, v := range m.Messages { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare messages#b34c8c60: field messages element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (m *Messages) Decode(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messages#b34c8c60 to nil") - } - if err := b.ConsumeID(MessagesTypeID); err != nil { - return fmt.Errorf("unable to decode messages#b34c8c60: %w", err) - } - return m.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (m *Messages) DecodeBare(b *bin.Buffer) error { - if m == nil { - return fmt.Errorf("can't decode messages#b34c8c60 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messages#b34c8c60: field total_count: %w", err) - } - m.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode messages#b34c8c60: field messages: %w", err) - } - - if headerLen > 0 { - m.Messages = make([]Message, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Message - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare messages#b34c8c60: field messages: %w", err) - } - m.Messages = append(m.Messages, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (m *Messages) EncodeTDLibJSON(b tdjson.Encoder) error { - if m == nil { - return fmt.Errorf("can't encode messages#b34c8c60 as nil") - } - b.ObjStart() - b.PutID("messages") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(m.TotalCount) - b.Comma() - b.FieldStart("messages") - b.ArrStart() - for idx, v := range m.Messages { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode messages#b34c8c60: field messages element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (m *Messages) DecodeTDLibJSON(b tdjson.Decoder) error { - if m == nil { - return fmt.Errorf("can't decode messages#b34c8c60 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("messages"); err != nil { - return fmt.Errorf("unable to decode messages#b34c8c60: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode messages#b34c8c60: field total_count: %w", err) - } - m.TotalCount = value - case "messages": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Message - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode messages#b34c8c60: field messages: %w", err) - } - m.Messages = append(m.Messages, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode messages#b34c8c60: field messages: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (m *Messages) GetTotalCount() (value int32) { - if m == nil { - return - } - return m.TotalCount -} - -// GetMessages returns value of Messages field. -func (m *Messages) GetMessages() (value []Message) { - if m == nil { - return - } - return m.Messages -} diff --git a/tdapi/tl_network_statistics_entry_gen.go b/tdapi/tl_network_statistics_entry_gen.go deleted file mode 100644 index 9d2b761ef..000000000 --- a/tdapi/tl_network_statistics_entry_gen.go +++ /dev/null @@ -1,745 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// NetworkStatisticsEntryFile represents TL type `networkStatisticsEntryFile#b3b8f62`. -type NetworkStatisticsEntryFile struct { - // Type of the file the data is part of; pass null if the data isn't related to files - FileType FileTypeClass - // Type of the network the data was sent through. Call setNetworkType to maintain the - // actual network type - NetworkType NetworkTypeClass - // Total number of bytes sent - SentBytes int64 - // Total number of bytes received - ReceivedBytes int64 -} - -// NetworkStatisticsEntryFileTypeID is TL type id of NetworkStatisticsEntryFile. -const NetworkStatisticsEntryFileTypeID = 0xb3b8f62 - -// construct implements constructor of NetworkStatisticsEntryClass. -func (n NetworkStatisticsEntryFile) construct() NetworkStatisticsEntryClass { return &n } - -// Ensuring interfaces in compile-time for NetworkStatisticsEntryFile. -var ( - _ bin.Encoder = &NetworkStatisticsEntryFile{} - _ bin.Decoder = &NetworkStatisticsEntryFile{} - _ bin.BareEncoder = &NetworkStatisticsEntryFile{} - _ bin.BareDecoder = &NetworkStatisticsEntryFile{} - - _ NetworkStatisticsEntryClass = &NetworkStatisticsEntryFile{} -) - -func (n *NetworkStatisticsEntryFile) Zero() bool { - if n == nil { - return true - } - if !(n.FileType == nil) { - return false - } - if !(n.NetworkType == nil) { - return false - } - if !(n.SentBytes == 0) { - return false - } - if !(n.ReceivedBytes == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (n *NetworkStatisticsEntryFile) String() string { - if n == nil { - return "NetworkStatisticsEntryFile(nil)" - } - type Alias NetworkStatisticsEntryFile - return fmt.Sprintf("NetworkStatisticsEntryFile%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NetworkStatisticsEntryFile) TypeID() uint32 { - return NetworkStatisticsEntryFileTypeID -} - -// TypeName returns name of type in TL schema. -func (*NetworkStatisticsEntryFile) TypeName() string { - return "networkStatisticsEntryFile" -} - -// TypeInfo returns info about TL type. -func (n *NetworkStatisticsEntryFile) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "networkStatisticsEntryFile", - ID: NetworkStatisticsEntryFileTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileType", - SchemaName: "file_type", - }, - { - Name: "NetworkType", - SchemaName: "network_type", - }, - { - Name: "SentBytes", - SchemaName: "sent_bytes", - }, - { - Name: "ReceivedBytes", - SchemaName: "received_bytes", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (n *NetworkStatisticsEntryFile) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkStatisticsEntryFile#b3b8f62 as nil") - } - b.PutID(NetworkStatisticsEntryFileTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NetworkStatisticsEntryFile) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkStatisticsEntryFile#b3b8f62 as nil") - } - if n.FileType == nil { - return fmt.Errorf("unable to encode networkStatisticsEntryFile#b3b8f62: field file_type is nil") - } - if err := n.FileType.Encode(b); err != nil { - return fmt.Errorf("unable to encode networkStatisticsEntryFile#b3b8f62: field file_type: %w", err) - } - if n.NetworkType == nil { - return fmt.Errorf("unable to encode networkStatisticsEntryFile#b3b8f62: field network_type is nil") - } - if err := n.NetworkType.Encode(b); err != nil { - return fmt.Errorf("unable to encode networkStatisticsEntryFile#b3b8f62: field network_type: %w", err) - } - b.PutInt53(n.SentBytes) - b.PutInt53(n.ReceivedBytes) - return nil -} - -// Decode implements bin.Decoder. -func (n *NetworkStatisticsEntryFile) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkStatisticsEntryFile#b3b8f62 to nil") - } - if err := b.ConsumeID(NetworkStatisticsEntryFileTypeID); err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryFile#b3b8f62: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NetworkStatisticsEntryFile) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkStatisticsEntryFile#b3b8f62 to nil") - } - { - value, err := DecodeFileType(b) - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryFile#b3b8f62: field file_type: %w", err) - } - n.FileType = value - } - { - value, err := DecodeNetworkType(b) - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryFile#b3b8f62: field network_type: %w", err) - } - n.NetworkType = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryFile#b3b8f62: field sent_bytes: %w", err) - } - n.SentBytes = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryFile#b3b8f62: field received_bytes: %w", err) - } - n.ReceivedBytes = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NetworkStatisticsEntryFile) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode networkStatisticsEntryFile#b3b8f62 as nil") - } - b.ObjStart() - b.PutID("networkStatisticsEntryFile") - b.Comma() - b.FieldStart("file_type") - if n.FileType == nil { - return fmt.Errorf("unable to encode networkStatisticsEntryFile#b3b8f62: field file_type is nil") - } - if err := n.FileType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode networkStatisticsEntryFile#b3b8f62: field file_type: %w", err) - } - b.Comma() - b.FieldStart("network_type") - if n.NetworkType == nil { - return fmt.Errorf("unable to encode networkStatisticsEntryFile#b3b8f62: field network_type is nil") - } - if err := n.NetworkType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode networkStatisticsEntryFile#b3b8f62: field network_type: %w", err) - } - b.Comma() - b.FieldStart("sent_bytes") - b.PutInt53(n.SentBytes) - b.Comma() - b.FieldStart("received_bytes") - b.PutInt53(n.ReceivedBytes) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NetworkStatisticsEntryFile) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode networkStatisticsEntryFile#b3b8f62 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("networkStatisticsEntryFile"); err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryFile#b3b8f62: %w", err) - } - case "file_type": - value, err := DecodeTDLibJSONFileType(b) - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryFile#b3b8f62: field file_type: %w", err) - } - n.FileType = value - case "network_type": - value, err := DecodeTDLibJSONNetworkType(b) - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryFile#b3b8f62: field network_type: %w", err) - } - n.NetworkType = value - case "sent_bytes": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryFile#b3b8f62: field sent_bytes: %w", err) - } - n.SentBytes = value - case "received_bytes": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryFile#b3b8f62: field received_bytes: %w", err) - } - n.ReceivedBytes = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileType returns value of FileType field. -func (n *NetworkStatisticsEntryFile) GetFileType() (value FileTypeClass) { - if n == nil { - return - } - return n.FileType -} - -// GetNetworkType returns value of NetworkType field. -func (n *NetworkStatisticsEntryFile) GetNetworkType() (value NetworkTypeClass) { - if n == nil { - return - } - return n.NetworkType -} - -// GetSentBytes returns value of SentBytes field. -func (n *NetworkStatisticsEntryFile) GetSentBytes() (value int64) { - if n == nil { - return - } - return n.SentBytes -} - -// GetReceivedBytes returns value of ReceivedBytes field. -func (n *NetworkStatisticsEntryFile) GetReceivedBytes() (value int64) { - if n == nil { - return - } - return n.ReceivedBytes -} - -// NetworkStatisticsEntryCall represents TL type `networkStatisticsEntryCall#2bedbbad`. -type NetworkStatisticsEntryCall struct { - // Type of the network the data was sent through. Call setNetworkType to maintain the - // actual network type - NetworkType NetworkTypeClass - // Total number of bytes sent - SentBytes int64 - // Total number of bytes received - ReceivedBytes int64 - // Total call duration, in seconds - Duration float64 -} - -// NetworkStatisticsEntryCallTypeID is TL type id of NetworkStatisticsEntryCall. -const NetworkStatisticsEntryCallTypeID = 0x2bedbbad - -// construct implements constructor of NetworkStatisticsEntryClass. -func (n NetworkStatisticsEntryCall) construct() NetworkStatisticsEntryClass { return &n } - -// Ensuring interfaces in compile-time for NetworkStatisticsEntryCall. -var ( - _ bin.Encoder = &NetworkStatisticsEntryCall{} - _ bin.Decoder = &NetworkStatisticsEntryCall{} - _ bin.BareEncoder = &NetworkStatisticsEntryCall{} - _ bin.BareDecoder = &NetworkStatisticsEntryCall{} - - _ NetworkStatisticsEntryClass = &NetworkStatisticsEntryCall{} -) - -func (n *NetworkStatisticsEntryCall) Zero() bool { - if n == nil { - return true - } - if !(n.NetworkType == nil) { - return false - } - if !(n.SentBytes == 0) { - return false - } - if !(n.ReceivedBytes == 0) { - return false - } - if !(n.Duration == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (n *NetworkStatisticsEntryCall) String() string { - if n == nil { - return "NetworkStatisticsEntryCall(nil)" - } - type Alias NetworkStatisticsEntryCall - return fmt.Sprintf("NetworkStatisticsEntryCall%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NetworkStatisticsEntryCall) TypeID() uint32 { - return NetworkStatisticsEntryCallTypeID -} - -// TypeName returns name of type in TL schema. -func (*NetworkStatisticsEntryCall) TypeName() string { - return "networkStatisticsEntryCall" -} - -// TypeInfo returns info about TL type. -func (n *NetworkStatisticsEntryCall) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "networkStatisticsEntryCall", - ID: NetworkStatisticsEntryCallTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NetworkType", - SchemaName: "network_type", - }, - { - Name: "SentBytes", - SchemaName: "sent_bytes", - }, - { - Name: "ReceivedBytes", - SchemaName: "received_bytes", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (n *NetworkStatisticsEntryCall) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkStatisticsEntryCall#2bedbbad as nil") - } - b.PutID(NetworkStatisticsEntryCallTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NetworkStatisticsEntryCall) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkStatisticsEntryCall#2bedbbad as nil") - } - if n.NetworkType == nil { - return fmt.Errorf("unable to encode networkStatisticsEntryCall#2bedbbad: field network_type is nil") - } - if err := n.NetworkType.Encode(b); err != nil { - return fmt.Errorf("unable to encode networkStatisticsEntryCall#2bedbbad: field network_type: %w", err) - } - b.PutInt53(n.SentBytes) - b.PutInt53(n.ReceivedBytes) - b.PutDouble(n.Duration) - return nil -} - -// Decode implements bin.Decoder. -func (n *NetworkStatisticsEntryCall) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkStatisticsEntryCall#2bedbbad to nil") - } - if err := b.ConsumeID(NetworkStatisticsEntryCallTypeID); err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryCall#2bedbbad: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NetworkStatisticsEntryCall) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkStatisticsEntryCall#2bedbbad to nil") - } - { - value, err := DecodeNetworkType(b) - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryCall#2bedbbad: field network_type: %w", err) - } - n.NetworkType = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryCall#2bedbbad: field sent_bytes: %w", err) - } - n.SentBytes = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryCall#2bedbbad: field received_bytes: %w", err) - } - n.ReceivedBytes = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryCall#2bedbbad: field duration: %w", err) - } - n.Duration = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NetworkStatisticsEntryCall) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode networkStatisticsEntryCall#2bedbbad as nil") - } - b.ObjStart() - b.PutID("networkStatisticsEntryCall") - b.Comma() - b.FieldStart("network_type") - if n.NetworkType == nil { - return fmt.Errorf("unable to encode networkStatisticsEntryCall#2bedbbad: field network_type is nil") - } - if err := n.NetworkType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode networkStatisticsEntryCall#2bedbbad: field network_type: %w", err) - } - b.Comma() - b.FieldStart("sent_bytes") - b.PutInt53(n.SentBytes) - b.Comma() - b.FieldStart("received_bytes") - b.PutInt53(n.ReceivedBytes) - b.Comma() - b.FieldStart("duration") - b.PutDouble(n.Duration) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NetworkStatisticsEntryCall) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode networkStatisticsEntryCall#2bedbbad to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("networkStatisticsEntryCall"); err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryCall#2bedbbad: %w", err) - } - case "network_type": - value, err := DecodeTDLibJSONNetworkType(b) - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryCall#2bedbbad: field network_type: %w", err) - } - n.NetworkType = value - case "sent_bytes": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryCall#2bedbbad: field sent_bytes: %w", err) - } - n.SentBytes = value - case "received_bytes": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryCall#2bedbbad: field received_bytes: %w", err) - } - n.ReceivedBytes = value - case "duration": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode networkStatisticsEntryCall#2bedbbad: field duration: %w", err) - } - n.Duration = value - default: - return b.Skip() - } - return nil - }) -} - -// GetNetworkType returns value of NetworkType field. -func (n *NetworkStatisticsEntryCall) GetNetworkType() (value NetworkTypeClass) { - if n == nil { - return - } - return n.NetworkType -} - -// GetSentBytes returns value of SentBytes field. -func (n *NetworkStatisticsEntryCall) GetSentBytes() (value int64) { - if n == nil { - return - } - return n.SentBytes -} - -// GetReceivedBytes returns value of ReceivedBytes field. -func (n *NetworkStatisticsEntryCall) GetReceivedBytes() (value int64) { - if n == nil { - return - } - return n.ReceivedBytes -} - -// GetDuration returns value of Duration field. -func (n *NetworkStatisticsEntryCall) GetDuration() (value float64) { - if n == nil { - return - } - return n.Duration -} - -// NetworkStatisticsEntryClassName is schema name of NetworkStatisticsEntryClass. -const NetworkStatisticsEntryClassName = "NetworkStatisticsEntry" - -// NetworkStatisticsEntryClass represents NetworkStatisticsEntry generic type. -// -// Example: -// -// g, err := tdapi.DecodeNetworkStatisticsEntry(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.NetworkStatisticsEntryFile: // networkStatisticsEntryFile#b3b8f62 -// case *tdapi.NetworkStatisticsEntryCall: // networkStatisticsEntryCall#2bedbbad -// default: panic(v) -// } -type NetworkStatisticsEntryClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() NetworkStatisticsEntryClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error - - // Type of the network the data was sent through. Call setNetworkType to maintain the - // actual network type - GetNetworkType() (value NetworkTypeClass) - // Total number of bytes sent - GetSentBytes() (value int64) - // Total number of bytes received - GetReceivedBytes() (value int64) -} - -// DecodeNetworkStatisticsEntry implements binary de-serialization for NetworkStatisticsEntryClass. -func DecodeNetworkStatisticsEntry(buf *bin.Buffer) (NetworkStatisticsEntryClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case NetworkStatisticsEntryFileTypeID: - // Decoding networkStatisticsEntryFile#b3b8f62. - v := NetworkStatisticsEntryFile{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkStatisticsEntryClass: %w", err) - } - return &v, nil - case NetworkStatisticsEntryCallTypeID: - // Decoding networkStatisticsEntryCall#2bedbbad. - v := NetworkStatisticsEntryCall{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkStatisticsEntryClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode NetworkStatisticsEntryClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONNetworkStatisticsEntry implements binary de-serialization for NetworkStatisticsEntryClass. -func DecodeTDLibJSONNetworkStatisticsEntry(buf tdjson.Decoder) (NetworkStatisticsEntryClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "networkStatisticsEntryFile": - // Decoding networkStatisticsEntryFile#b3b8f62. - v := NetworkStatisticsEntryFile{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkStatisticsEntryClass: %w", err) - } - return &v, nil - case "networkStatisticsEntryCall": - // Decoding networkStatisticsEntryCall#2bedbbad. - v := NetworkStatisticsEntryCall{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkStatisticsEntryClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode NetworkStatisticsEntryClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// NetworkStatisticsEntry boxes the NetworkStatisticsEntryClass providing a helper. -type NetworkStatisticsEntryBox struct { - NetworkStatisticsEntry NetworkStatisticsEntryClass -} - -// Decode implements bin.Decoder for NetworkStatisticsEntryBox. -func (b *NetworkStatisticsEntryBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode NetworkStatisticsEntryBox to nil") - } - v, err := DecodeNetworkStatisticsEntry(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.NetworkStatisticsEntry = v - return nil -} - -// Encode implements bin.Encode for NetworkStatisticsEntryBox. -func (b *NetworkStatisticsEntryBox) Encode(buf *bin.Buffer) error { - if b == nil || b.NetworkStatisticsEntry == nil { - return fmt.Errorf("unable to encode NetworkStatisticsEntryClass as nil") - } - return b.NetworkStatisticsEntry.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for NetworkStatisticsEntryBox. -func (b *NetworkStatisticsEntryBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode NetworkStatisticsEntryBox to nil") - } - v, err := DecodeTDLibJSONNetworkStatisticsEntry(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.NetworkStatisticsEntry = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for NetworkStatisticsEntryBox. -func (b *NetworkStatisticsEntryBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.NetworkStatisticsEntry == nil { - return fmt.Errorf("unable to encode NetworkStatisticsEntryClass as nil") - } - return b.NetworkStatisticsEntry.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_network_statistics_gen.go b/tdapi/tl_network_statistics_gen.go deleted file mode 100644 index a50006359..000000000 --- a/tdapi/tl_network_statistics_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// NetworkStatistics represents TL type `networkStatistics#d86acb3c`. -type NetworkStatistics struct { - // Point in time (Unix timestamp) from which the statistics are collected - SinceDate int32 - // Network statistics entries - Entries []NetworkStatisticsEntryClass -} - -// NetworkStatisticsTypeID is TL type id of NetworkStatistics. -const NetworkStatisticsTypeID = 0xd86acb3c - -// Ensuring interfaces in compile-time for NetworkStatistics. -var ( - _ bin.Encoder = &NetworkStatistics{} - _ bin.Decoder = &NetworkStatistics{} - _ bin.BareEncoder = &NetworkStatistics{} - _ bin.BareDecoder = &NetworkStatistics{} -) - -func (n *NetworkStatistics) Zero() bool { - if n == nil { - return true - } - if !(n.SinceDate == 0) { - return false - } - if !(n.Entries == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (n *NetworkStatistics) String() string { - if n == nil { - return "NetworkStatistics(nil)" - } - type Alias NetworkStatistics - return fmt.Sprintf("NetworkStatistics%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NetworkStatistics) TypeID() uint32 { - return NetworkStatisticsTypeID -} - -// TypeName returns name of type in TL schema. -func (*NetworkStatistics) TypeName() string { - return "networkStatistics" -} - -// TypeInfo returns info about TL type. -func (n *NetworkStatistics) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "networkStatistics", - ID: NetworkStatisticsTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SinceDate", - SchemaName: "since_date", - }, - { - Name: "Entries", - SchemaName: "entries", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (n *NetworkStatistics) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkStatistics#d86acb3c as nil") - } - b.PutID(NetworkStatisticsTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NetworkStatistics) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkStatistics#d86acb3c as nil") - } - b.PutInt32(n.SinceDate) - b.PutInt(len(n.Entries)) - for idx, v := range n.Entries { - if v == nil { - return fmt.Errorf("unable to encode networkStatistics#d86acb3c: field entries element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare networkStatistics#d86acb3c: field entries element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NetworkStatistics) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkStatistics#d86acb3c to nil") - } - if err := b.ConsumeID(NetworkStatisticsTypeID); err != nil { - return fmt.Errorf("unable to decode networkStatistics#d86acb3c: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NetworkStatistics) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkStatistics#d86acb3c to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode networkStatistics#d86acb3c: field since_date: %w", err) - } - n.SinceDate = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode networkStatistics#d86acb3c: field entries: %w", err) - } - - if headerLen > 0 { - n.Entries = make([]NetworkStatisticsEntryClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeNetworkStatisticsEntry(b) - if err != nil { - return fmt.Errorf("unable to decode networkStatistics#d86acb3c: field entries: %w", err) - } - n.Entries = append(n.Entries, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NetworkStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode networkStatistics#d86acb3c as nil") - } - b.ObjStart() - b.PutID("networkStatistics") - b.Comma() - b.FieldStart("since_date") - b.PutInt32(n.SinceDate) - b.Comma() - b.FieldStart("entries") - b.ArrStart() - for idx, v := range n.Entries { - if v == nil { - return fmt.Errorf("unable to encode networkStatistics#d86acb3c: field entries element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode networkStatistics#d86acb3c: field entries element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NetworkStatistics) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode networkStatistics#d86acb3c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("networkStatistics"); err != nil { - return fmt.Errorf("unable to decode networkStatistics#d86acb3c: %w", err) - } - case "since_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode networkStatistics#d86acb3c: field since_date: %w", err) - } - n.SinceDate = value - case "entries": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONNetworkStatisticsEntry(b) - if err != nil { - return fmt.Errorf("unable to decode networkStatistics#d86acb3c: field entries: %w", err) - } - n.Entries = append(n.Entries, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode networkStatistics#d86acb3c: field entries: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSinceDate returns value of SinceDate field. -func (n *NetworkStatistics) GetSinceDate() (value int32) { - if n == nil { - return - } - return n.SinceDate -} - -// GetEntries returns value of Entries field. -func (n *NetworkStatistics) GetEntries() (value []NetworkStatisticsEntryClass) { - if n == nil { - return - } - return n.Entries -} diff --git a/tdapi/tl_network_type_gen.go b/tdapi/tl_network_type_gen.go deleted file mode 100644 index a5697fa9f..000000000 --- a/tdapi/tl_network_type_gen.go +++ /dev/null @@ -1,869 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// NetworkTypeNone represents TL type `networkTypeNone#8a7a5f11`. -type NetworkTypeNone struct { -} - -// NetworkTypeNoneTypeID is TL type id of NetworkTypeNone. -const NetworkTypeNoneTypeID = 0x8a7a5f11 - -// construct implements constructor of NetworkTypeClass. -func (n NetworkTypeNone) construct() NetworkTypeClass { return &n } - -// Ensuring interfaces in compile-time for NetworkTypeNone. -var ( - _ bin.Encoder = &NetworkTypeNone{} - _ bin.Decoder = &NetworkTypeNone{} - _ bin.BareEncoder = &NetworkTypeNone{} - _ bin.BareDecoder = &NetworkTypeNone{} - - _ NetworkTypeClass = &NetworkTypeNone{} -) - -func (n *NetworkTypeNone) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NetworkTypeNone) String() string { - if n == nil { - return "NetworkTypeNone(nil)" - } - type Alias NetworkTypeNone - return fmt.Sprintf("NetworkTypeNone%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NetworkTypeNone) TypeID() uint32 { - return NetworkTypeNoneTypeID -} - -// TypeName returns name of type in TL schema. -func (*NetworkTypeNone) TypeName() string { - return "networkTypeNone" -} - -// TypeInfo returns info about TL type. -func (n *NetworkTypeNone) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "networkTypeNone", - ID: NetworkTypeNoneTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NetworkTypeNone) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeNone#8a7a5f11 as nil") - } - b.PutID(NetworkTypeNoneTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NetworkTypeNone) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeNone#8a7a5f11 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NetworkTypeNone) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeNone#8a7a5f11 to nil") - } - if err := b.ConsumeID(NetworkTypeNoneTypeID); err != nil { - return fmt.Errorf("unable to decode networkTypeNone#8a7a5f11: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NetworkTypeNone) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeNone#8a7a5f11 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NetworkTypeNone) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeNone#8a7a5f11 as nil") - } - b.ObjStart() - b.PutID("networkTypeNone") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NetworkTypeNone) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeNone#8a7a5f11 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("networkTypeNone"); err != nil { - return fmt.Errorf("unable to decode networkTypeNone#8a7a5f11: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NetworkTypeMobile represents TL type `networkTypeMobile#30d46e4f`. -type NetworkTypeMobile struct { -} - -// NetworkTypeMobileTypeID is TL type id of NetworkTypeMobile. -const NetworkTypeMobileTypeID = 0x30d46e4f - -// construct implements constructor of NetworkTypeClass. -func (n NetworkTypeMobile) construct() NetworkTypeClass { return &n } - -// Ensuring interfaces in compile-time for NetworkTypeMobile. -var ( - _ bin.Encoder = &NetworkTypeMobile{} - _ bin.Decoder = &NetworkTypeMobile{} - _ bin.BareEncoder = &NetworkTypeMobile{} - _ bin.BareDecoder = &NetworkTypeMobile{} - - _ NetworkTypeClass = &NetworkTypeMobile{} -) - -func (n *NetworkTypeMobile) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NetworkTypeMobile) String() string { - if n == nil { - return "NetworkTypeMobile(nil)" - } - type Alias NetworkTypeMobile - return fmt.Sprintf("NetworkTypeMobile%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NetworkTypeMobile) TypeID() uint32 { - return NetworkTypeMobileTypeID -} - -// TypeName returns name of type in TL schema. -func (*NetworkTypeMobile) TypeName() string { - return "networkTypeMobile" -} - -// TypeInfo returns info about TL type. -func (n *NetworkTypeMobile) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "networkTypeMobile", - ID: NetworkTypeMobileTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NetworkTypeMobile) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeMobile#30d46e4f as nil") - } - b.PutID(NetworkTypeMobileTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NetworkTypeMobile) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeMobile#30d46e4f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NetworkTypeMobile) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeMobile#30d46e4f to nil") - } - if err := b.ConsumeID(NetworkTypeMobileTypeID); err != nil { - return fmt.Errorf("unable to decode networkTypeMobile#30d46e4f: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NetworkTypeMobile) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeMobile#30d46e4f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NetworkTypeMobile) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeMobile#30d46e4f as nil") - } - b.ObjStart() - b.PutID("networkTypeMobile") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NetworkTypeMobile) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeMobile#30d46e4f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("networkTypeMobile"); err != nil { - return fmt.Errorf("unable to decode networkTypeMobile#30d46e4f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NetworkTypeMobileRoaming represents TL type `networkTypeMobileRoaming#aa7496f0`. -type NetworkTypeMobileRoaming struct { -} - -// NetworkTypeMobileRoamingTypeID is TL type id of NetworkTypeMobileRoaming. -const NetworkTypeMobileRoamingTypeID = 0xaa7496f0 - -// construct implements constructor of NetworkTypeClass. -func (n NetworkTypeMobileRoaming) construct() NetworkTypeClass { return &n } - -// Ensuring interfaces in compile-time for NetworkTypeMobileRoaming. -var ( - _ bin.Encoder = &NetworkTypeMobileRoaming{} - _ bin.Decoder = &NetworkTypeMobileRoaming{} - _ bin.BareEncoder = &NetworkTypeMobileRoaming{} - _ bin.BareDecoder = &NetworkTypeMobileRoaming{} - - _ NetworkTypeClass = &NetworkTypeMobileRoaming{} -) - -func (n *NetworkTypeMobileRoaming) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NetworkTypeMobileRoaming) String() string { - if n == nil { - return "NetworkTypeMobileRoaming(nil)" - } - type Alias NetworkTypeMobileRoaming - return fmt.Sprintf("NetworkTypeMobileRoaming%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NetworkTypeMobileRoaming) TypeID() uint32 { - return NetworkTypeMobileRoamingTypeID -} - -// TypeName returns name of type in TL schema. -func (*NetworkTypeMobileRoaming) TypeName() string { - return "networkTypeMobileRoaming" -} - -// TypeInfo returns info about TL type. -func (n *NetworkTypeMobileRoaming) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "networkTypeMobileRoaming", - ID: NetworkTypeMobileRoamingTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NetworkTypeMobileRoaming) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeMobileRoaming#aa7496f0 as nil") - } - b.PutID(NetworkTypeMobileRoamingTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NetworkTypeMobileRoaming) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeMobileRoaming#aa7496f0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NetworkTypeMobileRoaming) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeMobileRoaming#aa7496f0 to nil") - } - if err := b.ConsumeID(NetworkTypeMobileRoamingTypeID); err != nil { - return fmt.Errorf("unable to decode networkTypeMobileRoaming#aa7496f0: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NetworkTypeMobileRoaming) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeMobileRoaming#aa7496f0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NetworkTypeMobileRoaming) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeMobileRoaming#aa7496f0 as nil") - } - b.ObjStart() - b.PutID("networkTypeMobileRoaming") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NetworkTypeMobileRoaming) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeMobileRoaming#aa7496f0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("networkTypeMobileRoaming"); err != nil { - return fmt.Errorf("unable to decode networkTypeMobileRoaming#aa7496f0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NetworkTypeWiFi represents TL type `networkTypeWiFi#da37e13a`. -type NetworkTypeWiFi struct { -} - -// NetworkTypeWiFiTypeID is TL type id of NetworkTypeWiFi. -const NetworkTypeWiFiTypeID = 0xda37e13a - -// construct implements constructor of NetworkTypeClass. -func (n NetworkTypeWiFi) construct() NetworkTypeClass { return &n } - -// Ensuring interfaces in compile-time for NetworkTypeWiFi. -var ( - _ bin.Encoder = &NetworkTypeWiFi{} - _ bin.Decoder = &NetworkTypeWiFi{} - _ bin.BareEncoder = &NetworkTypeWiFi{} - _ bin.BareDecoder = &NetworkTypeWiFi{} - - _ NetworkTypeClass = &NetworkTypeWiFi{} -) - -func (n *NetworkTypeWiFi) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NetworkTypeWiFi) String() string { - if n == nil { - return "NetworkTypeWiFi(nil)" - } - type Alias NetworkTypeWiFi - return fmt.Sprintf("NetworkTypeWiFi%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NetworkTypeWiFi) TypeID() uint32 { - return NetworkTypeWiFiTypeID -} - -// TypeName returns name of type in TL schema. -func (*NetworkTypeWiFi) TypeName() string { - return "networkTypeWiFi" -} - -// TypeInfo returns info about TL type. -func (n *NetworkTypeWiFi) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "networkTypeWiFi", - ID: NetworkTypeWiFiTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NetworkTypeWiFi) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeWiFi#da37e13a as nil") - } - b.PutID(NetworkTypeWiFiTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NetworkTypeWiFi) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeWiFi#da37e13a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NetworkTypeWiFi) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeWiFi#da37e13a to nil") - } - if err := b.ConsumeID(NetworkTypeWiFiTypeID); err != nil { - return fmt.Errorf("unable to decode networkTypeWiFi#da37e13a: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NetworkTypeWiFi) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeWiFi#da37e13a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NetworkTypeWiFi) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeWiFi#da37e13a as nil") - } - b.ObjStart() - b.PutID("networkTypeWiFi") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NetworkTypeWiFi) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeWiFi#da37e13a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("networkTypeWiFi"); err != nil { - return fmt.Errorf("unable to decode networkTypeWiFi#da37e13a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NetworkTypeOther represents TL type `networkTypeOther#73c2879b`. -type NetworkTypeOther struct { -} - -// NetworkTypeOtherTypeID is TL type id of NetworkTypeOther. -const NetworkTypeOtherTypeID = 0x73c2879b - -// construct implements constructor of NetworkTypeClass. -func (n NetworkTypeOther) construct() NetworkTypeClass { return &n } - -// Ensuring interfaces in compile-time for NetworkTypeOther. -var ( - _ bin.Encoder = &NetworkTypeOther{} - _ bin.Decoder = &NetworkTypeOther{} - _ bin.BareEncoder = &NetworkTypeOther{} - _ bin.BareDecoder = &NetworkTypeOther{} - - _ NetworkTypeClass = &NetworkTypeOther{} -) - -func (n *NetworkTypeOther) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NetworkTypeOther) String() string { - if n == nil { - return "NetworkTypeOther(nil)" - } - type Alias NetworkTypeOther - return fmt.Sprintf("NetworkTypeOther%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NetworkTypeOther) TypeID() uint32 { - return NetworkTypeOtherTypeID -} - -// TypeName returns name of type in TL schema. -func (*NetworkTypeOther) TypeName() string { - return "networkTypeOther" -} - -// TypeInfo returns info about TL type. -func (n *NetworkTypeOther) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "networkTypeOther", - ID: NetworkTypeOtherTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NetworkTypeOther) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeOther#73c2879b as nil") - } - b.PutID(NetworkTypeOtherTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NetworkTypeOther) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeOther#73c2879b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NetworkTypeOther) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeOther#73c2879b to nil") - } - if err := b.ConsumeID(NetworkTypeOtherTypeID); err != nil { - return fmt.Errorf("unable to decode networkTypeOther#73c2879b: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NetworkTypeOther) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeOther#73c2879b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NetworkTypeOther) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode networkTypeOther#73c2879b as nil") - } - b.ObjStart() - b.PutID("networkTypeOther") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NetworkTypeOther) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode networkTypeOther#73c2879b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("networkTypeOther"); err != nil { - return fmt.Errorf("unable to decode networkTypeOther#73c2879b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NetworkTypeClassName is schema name of NetworkTypeClass. -const NetworkTypeClassName = "NetworkType" - -// NetworkTypeClass represents NetworkType generic type. -// -// Example: -// -// g, err := tdapi.DecodeNetworkType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.NetworkTypeNone: // networkTypeNone#8a7a5f11 -// case *tdapi.NetworkTypeMobile: // networkTypeMobile#30d46e4f -// case *tdapi.NetworkTypeMobileRoaming: // networkTypeMobileRoaming#aa7496f0 -// case *tdapi.NetworkTypeWiFi: // networkTypeWiFi#da37e13a -// case *tdapi.NetworkTypeOther: // networkTypeOther#73c2879b -// default: panic(v) -// } -type NetworkTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() NetworkTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeNetworkType implements binary de-serialization for NetworkTypeClass. -func DecodeNetworkType(buf *bin.Buffer) (NetworkTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case NetworkTypeNoneTypeID: - // Decoding networkTypeNone#8a7a5f11. - v := NetworkTypeNone{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", err) - } - return &v, nil - case NetworkTypeMobileTypeID: - // Decoding networkTypeMobile#30d46e4f. - v := NetworkTypeMobile{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", err) - } - return &v, nil - case NetworkTypeMobileRoamingTypeID: - // Decoding networkTypeMobileRoaming#aa7496f0. - v := NetworkTypeMobileRoaming{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", err) - } - return &v, nil - case NetworkTypeWiFiTypeID: - // Decoding networkTypeWiFi#da37e13a. - v := NetworkTypeWiFi{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", err) - } - return &v, nil - case NetworkTypeOtherTypeID: - // Decoding networkTypeOther#73c2879b. - v := NetworkTypeOther{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONNetworkType implements binary de-serialization for NetworkTypeClass. -func DecodeTDLibJSONNetworkType(buf tdjson.Decoder) (NetworkTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "networkTypeNone": - // Decoding networkTypeNone#8a7a5f11. - v := NetworkTypeNone{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", err) - } - return &v, nil - case "networkTypeMobile": - // Decoding networkTypeMobile#30d46e4f. - v := NetworkTypeMobile{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", err) - } - return &v, nil - case "networkTypeMobileRoaming": - // Decoding networkTypeMobileRoaming#aa7496f0. - v := NetworkTypeMobileRoaming{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", err) - } - return &v, nil - case "networkTypeWiFi": - // Decoding networkTypeWiFi#da37e13a. - v := NetworkTypeWiFi{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", err) - } - return &v, nil - case "networkTypeOther": - // Decoding networkTypeOther#73c2879b. - v := NetworkTypeOther{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode NetworkTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// NetworkType boxes the NetworkTypeClass providing a helper. -type NetworkTypeBox struct { - NetworkType NetworkTypeClass -} - -// Decode implements bin.Decoder for NetworkTypeBox. -func (b *NetworkTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode NetworkTypeBox to nil") - } - v, err := DecodeNetworkType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.NetworkType = v - return nil -} - -// Encode implements bin.Encode for NetworkTypeBox. -func (b *NetworkTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.NetworkType == nil { - return fmt.Errorf("unable to encode NetworkTypeClass as nil") - } - return b.NetworkType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for NetworkTypeBox. -func (b *NetworkTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode NetworkTypeBox to nil") - } - v, err := DecodeTDLibJSONNetworkType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.NetworkType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for NetworkTypeBox. -func (b *NetworkTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.NetworkType == nil { - return fmt.Errorf("unable to encode NetworkTypeClass as nil") - } - return b.NetworkType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_new_chat_privacy_settings_gen.go b/tdapi/tl_new_chat_privacy_settings_gen.go deleted file mode 100644 index 3e9deb38f..000000000 --- a/tdapi/tl_new_chat_privacy_settings_gen.go +++ /dev/null @@ -1,194 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// NewChatPrivacySettings represents TL type `newChatPrivacySettings#5b15ca46`. -type NewChatPrivacySettings struct { - // True, if non-contacts users are able to write first to the current user. Telegram - // Premium subscribers are able to write first regardless of this setting - AllowNewChatsFromUnknownUsers bool -} - -// NewChatPrivacySettingsTypeID is TL type id of NewChatPrivacySettings. -const NewChatPrivacySettingsTypeID = 0x5b15ca46 - -// Ensuring interfaces in compile-time for NewChatPrivacySettings. -var ( - _ bin.Encoder = &NewChatPrivacySettings{} - _ bin.Decoder = &NewChatPrivacySettings{} - _ bin.BareEncoder = &NewChatPrivacySettings{} - _ bin.BareDecoder = &NewChatPrivacySettings{} -) - -func (n *NewChatPrivacySettings) Zero() bool { - if n == nil { - return true - } - if !(n.AllowNewChatsFromUnknownUsers == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (n *NewChatPrivacySettings) String() string { - if n == nil { - return "NewChatPrivacySettings(nil)" - } - type Alias NewChatPrivacySettings - return fmt.Sprintf("NewChatPrivacySettings%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NewChatPrivacySettings) TypeID() uint32 { - return NewChatPrivacySettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*NewChatPrivacySettings) TypeName() string { - return "newChatPrivacySettings" -} - -// TypeInfo returns info about TL type. -func (n *NewChatPrivacySettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "newChatPrivacySettings", - ID: NewChatPrivacySettingsTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AllowNewChatsFromUnknownUsers", - SchemaName: "allow_new_chats_from_unknown_users", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (n *NewChatPrivacySettings) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode newChatPrivacySettings#5b15ca46 as nil") - } - b.PutID(NewChatPrivacySettingsTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NewChatPrivacySettings) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode newChatPrivacySettings#5b15ca46 as nil") - } - b.PutBool(n.AllowNewChatsFromUnknownUsers) - return nil -} - -// Decode implements bin.Decoder. -func (n *NewChatPrivacySettings) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode newChatPrivacySettings#5b15ca46 to nil") - } - if err := b.ConsumeID(NewChatPrivacySettingsTypeID); err != nil { - return fmt.Errorf("unable to decode newChatPrivacySettings#5b15ca46: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NewChatPrivacySettings) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode newChatPrivacySettings#5b15ca46 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode newChatPrivacySettings#5b15ca46: field allow_new_chats_from_unknown_users: %w", err) - } - n.AllowNewChatsFromUnknownUsers = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NewChatPrivacySettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode newChatPrivacySettings#5b15ca46 as nil") - } - b.ObjStart() - b.PutID("newChatPrivacySettings") - b.Comma() - b.FieldStart("allow_new_chats_from_unknown_users") - b.PutBool(n.AllowNewChatsFromUnknownUsers) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NewChatPrivacySettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode newChatPrivacySettings#5b15ca46 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("newChatPrivacySettings"); err != nil { - return fmt.Errorf("unable to decode newChatPrivacySettings#5b15ca46: %w", err) - } - case "allow_new_chats_from_unknown_users": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode newChatPrivacySettings#5b15ca46: field allow_new_chats_from_unknown_users: %w", err) - } - n.AllowNewChatsFromUnknownUsers = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAllowNewChatsFromUnknownUsers returns value of AllowNewChatsFromUnknownUsers field. -func (n *NewChatPrivacySettings) GetAllowNewChatsFromUnknownUsers() (value bool) { - if n == nil { - return - } - return n.AllowNewChatsFromUnknownUsers -} diff --git a/tdapi/tl_notification_gen.go b/tdapi/tl_notification_gen.go deleted file mode 100644 index bf908ff3d..000000000 --- a/tdapi/tl_notification_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Notification represents TL type `notification#2f0343d0`. -type Notification struct { - // Unique persistent identifier of this notification - ID int32 - // Notification date - Date int32 - // True, if the notification was explicitly sent without sound - IsSilent bool - // Notification type - Type NotificationTypeClass -} - -// NotificationTypeID is TL type id of Notification. -const NotificationTypeID = 0x2f0343d0 - -// Ensuring interfaces in compile-time for Notification. -var ( - _ bin.Encoder = &Notification{} - _ bin.Decoder = &Notification{} - _ bin.BareEncoder = &Notification{} - _ bin.BareDecoder = &Notification{} -) - -func (n *Notification) Zero() bool { - if n == nil { - return true - } - if !(n.ID == 0) { - return false - } - if !(n.Date == 0) { - return false - } - if !(n.IsSilent == false) { - return false - } - if !(n.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (n *Notification) String() string { - if n == nil { - return "Notification(nil)" - } - type Alias Notification - return fmt.Sprintf("Notification%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Notification) TypeID() uint32 { - return NotificationTypeID -} - -// TypeName returns name of type in TL schema. -func (*Notification) TypeName() string { - return "notification" -} - -// TypeInfo returns info about TL type. -func (n *Notification) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notification", - ID: NotificationTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "IsSilent", - SchemaName: "is_silent", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (n *Notification) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notification#2f0343d0 as nil") - } - b.PutID(NotificationTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *Notification) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notification#2f0343d0 as nil") - } - b.PutInt32(n.ID) - b.PutInt32(n.Date) - b.PutBool(n.IsSilent) - if n.Type == nil { - return fmt.Errorf("unable to encode notification#2f0343d0: field type is nil") - } - if err := n.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode notification#2f0343d0: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (n *Notification) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notification#2f0343d0 to nil") - } - if err := b.ConsumeID(NotificationTypeID); err != nil { - return fmt.Errorf("unable to decode notification#2f0343d0: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *Notification) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notification#2f0343d0 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notification#2f0343d0: field id: %w", err) - } - n.ID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notification#2f0343d0: field date: %w", err) - } - n.Date = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode notification#2f0343d0: field is_silent: %w", err) - } - n.IsSilent = value - } - { - value, err := DecodeNotificationType(b) - if err != nil { - return fmt.Errorf("unable to decode notification#2f0343d0: field type: %w", err) - } - n.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *Notification) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notification#2f0343d0 as nil") - } - b.ObjStart() - b.PutID("notification") - b.Comma() - b.FieldStart("id") - b.PutInt32(n.ID) - b.Comma() - b.FieldStart("date") - b.PutInt32(n.Date) - b.Comma() - b.FieldStart("is_silent") - b.PutBool(n.IsSilent) - b.Comma() - b.FieldStart("type") - if n.Type == nil { - return fmt.Errorf("unable to encode notification#2f0343d0: field type is nil") - } - if err := n.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode notification#2f0343d0: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *Notification) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notification#2f0343d0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notification"); err != nil { - return fmt.Errorf("unable to decode notification#2f0343d0: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notification#2f0343d0: field id: %w", err) - } - n.ID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notification#2f0343d0: field date: %w", err) - } - n.Date = value - case "is_silent": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode notification#2f0343d0: field is_silent: %w", err) - } - n.IsSilent = value - case "type": - value, err := DecodeTDLibJSONNotificationType(b) - if err != nil { - return fmt.Errorf("unable to decode notification#2f0343d0: field type: %w", err) - } - n.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (n *Notification) GetID() (value int32) { - if n == nil { - return - } - return n.ID -} - -// GetDate returns value of Date field. -func (n *Notification) GetDate() (value int32) { - if n == nil { - return - } - return n.Date -} - -// GetIsSilent returns value of IsSilent field. -func (n *Notification) GetIsSilent() (value bool) { - if n == nil { - return - } - return n.IsSilent -} - -// GetType returns value of Type field. -func (n *Notification) GetType() (value NotificationTypeClass) { - if n == nil { - return - } - return n.Type -} diff --git a/tdapi/tl_notification_group_gen.go b/tdapi/tl_notification_group_gen.go deleted file mode 100644 index 79ff9c37a..000000000 --- a/tdapi/tl_notification_group_gen.go +++ /dev/null @@ -1,367 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// NotificationGroup represents TL type `notificationGroup#d02a41ba`. -type NotificationGroup struct { - // Unique persistent auto-incremented from 1 identifier of the notification group - ID int32 - // Type of the group - Type NotificationGroupTypeClass - // Identifier of a chat to which all notifications in the group belong - ChatID int64 - // Total number of active notifications in the group - TotalCount int32 - // The list of active notifications - Notifications []Notification -} - -// NotificationGroupTypeID is TL type id of NotificationGroup. -const NotificationGroupTypeID = 0xd02a41ba - -// Ensuring interfaces in compile-time for NotificationGroup. -var ( - _ bin.Encoder = &NotificationGroup{} - _ bin.Decoder = &NotificationGroup{} - _ bin.BareEncoder = &NotificationGroup{} - _ bin.BareDecoder = &NotificationGroup{} -) - -func (n *NotificationGroup) Zero() bool { - if n == nil { - return true - } - if !(n.ID == 0) { - return false - } - if !(n.Type == nil) { - return false - } - if !(n.ChatID == 0) { - return false - } - if !(n.TotalCount == 0) { - return false - } - if !(n.Notifications == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationGroup) String() string { - if n == nil { - return "NotificationGroup(nil)" - } - type Alias NotificationGroup - return fmt.Sprintf("NotificationGroup%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationGroup) TypeID() uint32 { - return NotificationGroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationGroup) TypeName() string { - return "notificationGroup" -} - -// TypeInfo returns info about TL type. -func (n *NotificationGroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationGroup", - ID: NotificationGroupTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Notifications", - SchemaName: "notifications", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationGroup) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroup#d02a41ba as nil") - } - b.PutID(NotificationGroupTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationGroup) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroup#d02a41ba as nil") - } - b.PutInt32(n.ID) - if n.Type == nil { - return fmt.Errorf("unable to encode notificationGroup#d02a41ba: field type is nil") - } - if err := n.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode notificationGroup#d02a41ba: field type: %w", err) - } - b.PutInt53(n.ChatID) - b.PutInt32(n.TotalCount) - b.PutInt(len(n.Notifications)) - for idx, v := range n.Notifications { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare notificationGroup#d02a41ba: field notifications element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationGroup) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroup#d02a41ba to nil") - } - if err := b.ConsumeID(NotificationGroupTypeID); err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationGroup) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroup#d02a41ba to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: field id: %w", err) - } - n.ID = value - } - { - value, err := DecodeNotificationGroupType(b) - if err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: field type: %w", err) - } - n.Type = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: field chat_id: %w", err) - } - n.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: field total_count: %w", err) - } - n.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: field notifications: %w", err) - } - - if headerLen > 0 { - n.Notifications = make([]Notification, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Notification - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare notificationGroup#d02a41ba: field notifications: %w", err) - } - n.Notifications = append(n.Notifications, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationGroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroup#d02a41ba as nil") - } - b.ObjStart() - b.PutID("notificationGroup") - b.Comma() - b.FieldStart("id") - b.PutInt32(n.ID) - b.Comma() - b.FieldStart("type") - if n.Type == nil { - return fmt.Errorf("unable to encode notificationGroup#d02a41ba: field type is nil") - } - if err := n.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode notificationGroup#d02a41ba: field type: %w", err) - } - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(n.ChatID) - b.Comma() - b.FieldStart("total_count") - b.PutInt32(n.TotalCount) - b.Comma() - b.FieldStart("notifications") - b.ArrStart() - for idx, v := range n.Notifications { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode notificationGroup#d02a41ba: field notifications element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationGroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroup#d02a41ba to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationGroup"); err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: field id: %w", err) - } - n.ID = value - case "type": - value, err := DecodeTDLibJSONNotificationGroupType(b) - if err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: field type: %w", err) - } - n.Type = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: field chat_id: %w", err) - } - n.ChatID = value - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: field total_count: %w", err) - } - n.TotalCount = value - case "notifications": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Notification - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: field notifications: %w", err) - } - n.Notifications = append(n.Notifications, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode notificationGroup#d02a41ba: field notifications: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (n *NotificationGroup) GetID() (value int32) { - if n == nil { - return - } - return n.ID -} - -// GetType returns value of Type field. -func (n *NotificationGroup) GetType() (value NotificationGroupTypeClass) { - if n == nil { - return - } - return n.Type -} - -// GetChatID returns value of ChatID field. -func (n *NotificationGroup) GetChatID() (value int64) { - if n == nil { - return - } - return n.ChatID -} - -// GetTotalCount returns value of TotalCount field. -func (n *NotificationGroup) GetTotalCount() (value int32) { - if n == nil { - return - } - return n.TotalCount -} - -// GetNotifications returns value of Notifications field. -func (n *NotificationGroup) GetNotifications() (value []Notification) { - if n == nil { - return - } - return n.Notifications -} diff --git a/tdapi/tl_notification_group_type_gen.go b/tdapi/tl_notification_group_type_gen.go deleted file mode 100644 index dec6810f1..000000000 --- a/tdapi/tl_notification_group_type_gen.go +++ /dev/null @@ -1,723 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// NotificationGroupTypeMessages represents TL type `notificationGroupTypeMessages#9a86331d`. -type NotificationGroupTypeMessages struct { -} - -// NotificationGroupTypeMessagesTypeID is TL type id of NotificationGroupTypeMessages. -const NotificationGroupTypeMessagesTypeID = 0x9a86331d - -// construct implements constructor of NotificationGroupTypeClass. -func (n NotificationGroupTypeMessages) construct() NotificationGroupTypeClass { return &n } - -// Ensuring interfaces in compile-time for NotificationGroupTypeMessages. -var ( - _ bin.Encoder = &NotificationGroupTypeMessages{} - _ bin.Decoder = &NotificationGroupTypeMessages{} - _ bin.BareEncoder = &NotificationGroupTypeMessages{} - _ bin.BareDecoder = &NotificationGroupTypeMessages{} - - _ NotificationGroupTypeClass = &NotificationGroupTypeMessages{} -) - -func (n *NotificationGroupTypeMessages) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationGroupTypeMessages) String() string { - if n == nil { - return "NotificationGroupTypeMessages(nil)" - } - type Alias NotificationGroupTypeMessages - return fmt.Sprintf("NotificationGroupTypeMessages%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationGroupTypeMessages) TypeID() uint32 { - return NotificationGroupTypeMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationGroupTypeMessages) TypeName() string { - return "notificationGroupTypeMessages" -} - -// TypeInfo returns info about TL type. -func (n *NotificationGroupTypeMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationGroupTypeMessages", - ID: NotificationGroupTypeMessagesTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationGroupTypeMessages) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeMessages#9a86331d as nil") - } - b.PutID(NotificationGroupTypeMessagesTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationGroupTypeMessages) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeMessages#9a86331d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationGroupTypeMessages) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeMessages#9a86331d to nil") - } - if err := b.ConsumeID(NotificationGroupTypeMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode notificationGroupTypeMessages#9a86331d: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationGroupTypeMessages) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeMessages#9a86331d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationGroupTypeMessages) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeMessages#9a86331d as nil") - } - b.ObjStart() - b.PutID("notificationGroupTypeMessages") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationGroupTypeMessages) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeMessages#9a86331d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationGroupTypeMessages"); err != nil { - return fmt.Errorf("unable to decode notificationGroupTypeMessages#9a86331d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NotificationGroupTypeMentions represents TL type `notificationGroupTypeMentions#85ca89ad`. -type NotificationGroupTypeMentions struct { -} - -// NotificationGroupTypeMentionsTypeID is TL type id of NotificationGroupTypeMentions. -const NotificationGroupTypeMentionsTypeID = 0x85ca89ad - -// construct implements constructor of NotificationGroupTypeClass. -func (n NotificationGroupTypeMentions) construct() NotificationGroupTypeClass { return &n } - -// Ensuring interfaces in compile-time for NotificationGroupTypeMentions. -var ( - _ bin.Encoder = &NotificationGroupTypeMentions{} - _ bin.Decoder = &NotificationGroupTypeMentions{} - _ bin.BareEncoder = &NotificationGroupTypeMentions{} - _ bin.BareDecoder = &NotificationGroupTypeMentions{} - - _ NotificationGroupTypeClass = &NotificationGroupTypeMentions{} -) - -func (n *NotificationGroupTypeMentions) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationGroupTypeMentions) String() string { - if n == nil { - return "NotificationGroupTypeMentions(nil)" - } - type Alias NotificationGroupTypeMentions - return fmt.Sprintf("NotificationGroupTypeMentions%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationGroupTypeMentions) TypeID() uint32 { - return NotificationGroupTypeMentionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationGroupTypeMentions) TypeName() string { - return "notificationGroupTypeMentions" -} - -// TypeInfo returns info about TL type. -func (n *NotificationGroupTypeMentions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationGroupTypeMentions", - ID: NotificationGroupTypeMentionsTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationGroupTypeMentions) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeMentions#85ca89ad as nil") - } - b.PutID(NotificationGroupTypeMentionsTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationGroupTypeMentions) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeMentions#85ca89ad as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationGroupTypeMentions) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeMentions#85ca89ad to nil") - } - if err := b.ConsumeID(NotificationGroupTypeMentionsTypeID); err != nil { - return fmt.Errorf("unable to decode notificationGroupTypeMentions#85ca89ad: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationGroupTypeMentions) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeMentions#85ca89ad to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationGroupTypeMentions) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeMentions#85ca89ad as nil") - } - b.ObjStart() - b.PutID("notificationGroupTypeMentions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationGroupTypeMentions) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeMentions#85ca89ad to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationGroupTypeMentions"); err != nil { - return fmt.Errorf("unable to decode notificationGroupTypeMentions#85ca89ad: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NotificationGroupTypeSecretChat represents TL type `notificationGroupTypeSecretChat#52e54e34`. -type NotificationGroupTypeSecretChat struct { -} - -// NotificationGroupTypeSecretChatTypeID is TL type id of NotificationGroupTypeSecretChat. -const NotificationGroupTypeSecretChatTypeID = 0x52e54e34 - -// construct implements constructor of NotificationGroupTypeClass. -func (n NotificationGroupTypeSecretChat) construct() NotificationGroupTypeClass { return &n } - -// Ensuring interfaces in compile-time for NotificationGroupTypeSecretChat. -var ( - _ bin.Encoder = &NotificationGroupTypeSecretChat{} - _ bin.Decoder = &NotificationGroupTypeSecretChat{} - _ bin.BareEncoder = &NotificationGroupTypeSecretChat{} - _ bin.BareDecoder = &NotificationGroupTypeSecretChat{} - - _ NotificationGroupTypeClass = &NotificationGroupTypeSecretChat{} -) - -func (n *NotificationGroupTypeSecretChat) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationGroupTypeSecretChat) String() string { - if n == nil { - return "NotificationGroupTypeSecretChat(nil)" - } - type Alias NotificationGroupTypeSecretChat - return fmt.Sprintf("NotificationGroupTypeSecretChat%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationGroupTypeSecretChat) TypeID() uint32 { - return NotificationGroupTypeSecretChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationGroupTypeSecretChat) TypeName() string { - return "notificationGroupTypeSecretChat" -} - -// TypeInfo returns info about TL type. -func (n *NotificationGroupTypeSecretChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationGroupTypeSecretChat", - ID: NotificationGroupTypeSecretChatTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationGroupTypeSecretChat) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeSecretChat#52e54e34 as nil") - } - b.PutID(NotificationGroupTypeSecretChatTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationGroupTypeSecretChat) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeSecretChat#52e54e34 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationGroupTypeSecretChat) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeSecretChat#52e54e34 to nil") - } - if err := b.ConsumeID(NotificationGroupTypeSecretChatTypeID); err != nil { - return fmt.Errorf("unable to decode notificationGroupTypeSecretChat#52e54e34: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationGroupTypeSecretChat) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeSecretChat#52e54e34 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationGroupTypeSecretChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeSecretChat#52e54e34 as nil") - } - b.ObjStart() - b.PutID("notificationGroupTypeSecretChat") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationGroupTypeSecretChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeSecretChat#52e54e34 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationGroupTypeSecretChat"); err != nil { - return fmt.Errorf("unable to decode notificationGroupTypeSecretChat#52e54e34: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NotificationGroupTypeCalls represents TL type `notificationGroupTypeCalls#5233c152`. -type NotificationGroupTypeCalls struct { -} - -// NotificationGroupTypeCallsTypeID is TL type id of NotificationGroupTypeCalls. -const NotificationGroupTypeCallsTypeID = 0x5233c152 - -// construct implements constructor of NotificationGroupTypeClass. -func (n NotificationGroupTypeCalls) construct() NotificationGroupTypeClass { return &n } - -// Ensuring interfaces in compile-time for NotificationGroupTypeCalls. -var ( - _ bin.Encoder = &NotificationGroupTypeCalls{} - _ bin.Decoder = &NotificationGroupTypeCalls{} - _ bin.BareEncoder = &NotificationGroupTypeCalls{} - _ bin.BareDecoder = &NotificationGroupTypeCalls{} - - _ NotificationGroupTypeClass = &NotificationGroupTypeCalls{} -) - -func (n *NotificationGroupTypeCalls) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationGroupTypeCalls) String() string { - if n == nil { - return "NotificationGroupTypeCalls(nil)" - } - type Alias NotificationGroupTypeCalls - return fmt.Sprintf("NotificationGroupTypeCalls%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationGroupTypeCalls) TypeID() uint32 { - return NotificationGroupTypeCallsTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationGroupTypeCalls) TypeName() string { - return "notificationGroupTypeCalls" -} - -// TypeInfo returns info about TL type. -func (n *NotificationGroupTypeCalls) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationGroupTypeCalls", - ID: NotificationGroupTypeCallsTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationGroupTypeCalls) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeCalls#5233c152 as nil") - } - b.PutID(NotificationGroupTypeCallsTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationGroupTypeCalls) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeCalls#5233c152 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationGroupTypeCalls) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeCalls#5233c152 to nil") - } - if err := b.ConsumeID(NotificationGroupTypeCallsTypeID); err != nil { - return fmt.Errorf("unable to decode notificationGroupTypeCalls#5233c152: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationGroupTypeCalls) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeCalls#5233c152 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationGroupTypeCalls) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationGroupTypeCalls#5233c152 as nil") - } - b.ObjStart() - b.PutID("notificationGroupTypeCalls") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationGroupTypeCalls) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationGroupTypeCalls#5233c152 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationGroupTypeCalls"); err != nil { - return fmt.Errorf("unable to decode notificationGroupTypeCalls#5233c152: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NotificationGroupTypeClassName is schema name of NotificationGroupTypeClass. -const NotificationGroupTypeClassName = "NotificationGroupType" - -// NotificationGroupTypeClass represents NotificationGroupType generic type. -// -// Example: -// -// g, err := tdapi.DecodeNotificationGroupType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.NotificationGroupTypeMessages: // notificationGroupTypeMessages#9a86331d -// case *tdapi.NotificationGroupTypeMentions: // notificationGroupTypeMentions#85ca89ad -// case *tdapi.NotificationGroupTypeSecretChat: // notificationGroupTypeSecretChat#52e54e34 -// case *tdapi.NotificationGroupTypeCalls: // notificationGroupTypeCalls#5233c152 -// default: panic(v) -// } -type NotificationGroupTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() NotificationGroupTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeNotificationGroupType implements binary de-serialization for NotificationGroupTypeClass. -func DecodeNotificationGroupType(buf *bin.Buffer) (NotificationGroupTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case NotificationGroupTypeMessagesTypeID: - // Decoding notificationGroupTypeMessages#9a86331d. - v := NotificationGroupTypeMessages{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationGroupTypeClass: %w", err) - } - return &v, nil - case NotificationGroupTypeMentionsTypeID: - // Decoding notificationGroupTypeMentions#85ca89ad. - v := NotificationGroupTypeMentions{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationGroupTypeClass: %w", err) - } - return &v, nil - case NotificationGroupTypeSecretChatTypeID: - // Decoding notificationGroupTypeSecretChat#52e54e34. - v := NotificationGroupTypeSecretChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationGroupTypeClass: %w", err) - } - return &v, nil - case NotificationGroupTypeCallsTypeID: - // Decoding notificationGroupTypeCalls#5233c152. - v := NotificationGroupTypeCalls{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationGroupTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode NotificationGroupTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONNotificationGroupType implements binary de-serialization for NotificationGroupTypeClass. -func DecodeTDLibJSONNotificationGroupType(buf tdjson.Decoder) (NotificationGroupTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "notificationGroupTypeMessages": - // Decoding notificationGroupTypeMessages#9a86331d. - v := NotificationGroupTypeMessages{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationGroupTypeClass: %w", err) - } - return &v, nil - case "notificationGroupTypeMentions": - // Decoding notificationGroupTypeMentions#85ca89ad. - v := NotificationGroupTypeMentions{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationGroupTypeClass: %w", err) - } - return &v, nil - case "notificationGroupTypeSecretChat": - // Decoding notificationGroupTypeSecretChat#52e54e34. - v := NotificationGroupTypeSecretChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationGroupTypeClass: %w", err) - } - return &v, nil - case "notificationGroupTypeCalls": - // Decoding notificationGroupTypeCalls#5233c152. - v := NotificationGroupTypeCalls{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationGroupTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode NotificationGroupTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// NotificationGroupType boxes the NotificationGroupTypeClass providing a helper. -type NotificationGroupTypeBox struct { - NotificationGroupType NotificationGroupTypeClass -} - -// Decode implements bin.Decoder for NotificationGroupTypeBox. -func (b *NotificationGroupTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode NotificationGroupTypeBox to nil") - } - v, err := DecodeNotificationGroupType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.NotificationGroupType = v - return nil -} - -// Encode implements bin.Encode for NotificationGroupTypeBox. -func (b *NotificationGroupTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.NotificationGroupType == nil { - return fmt.Errorf("unable to encode NotificationGroupTypeClass as nil") - } - return b.NotificationGroupType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for NotificationGroupTypeBox. -func (b *NotificationGroupTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode NotificationGroupTypeBox to nil") - } - v, err := DecodeTDLibJSONNotificationGroupType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.NotificationGroupType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for NotificationGroupTypeBox. -func (b *NotificationGroupTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.NotificationGroupType == nil { - return fmt.Errorf("unable to encode NotificationGroupTypeClass as nil") - } - return b.NotificationGroupType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_notification_settings_scope_gen.go b/tdapi/tl_notification_settings_scope_gen.go deleted file mode 100644 index f591e2786..000000000 --- a/tdapi/tl_notification_settings_scope_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// NotificationSettingsScopePrivateChats represents TL type `notificationSettingsScopePrivateChats#37e04d67`. -type NotificationSettingsScopePrivateChats struct { -} - -// NotificationSettingsScopePrivateChatsTypeID is TL type id of NotificationSettingsScopePrivateChats. -const NotificationSettingsScopePrivateChatsTypeID = 0x37e04d67 - -// construct implements constructor of NotificationSettingsScopeClass. -func (n NotificationSettingsScopePrivateChats) construct() NotificationSettingsScopeClass { return &n } - -// Ensuring interfaces in compile-time for NotificationSettingsScopePrivateChats. -var ( - _ bin.Encoder = &NotificationSettingsScopePrivateChats{} - _ bin.Decoder = &NotificationSettingsScopePrivateChats{} - _ bin.BareEncoder = &NotificationSettingsScopePrivateChats{} - _ bin.BareDecoder = &NotificationSettingsScopePrivateChats{} - - _ NotificationSettingsScopeClass = &NotificationSettingsScopePrivateChats{} -) - -func (n *NotificationSettingsScopePrivateChats) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationSettingsScopePrivateChats) String() string { - if n == nil { - return "NotificationSettingsScopePrivateChats(nil)" - } - type Alias NotificationSettingsScopePrivateChats - return fmt.Sprintf("NotificationSettingsScopePrivateChats%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationSettingsScopePrivateChats) TypeID() uint32 { - return NotificationSettingsScopePrivateChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationSettingsScopePrivateChats) TypeName() string { - return "notificationSettingsScopePrivateChats" -} - -// TypeInfo returns info about TL type. -func (n *NotificationSettingsScopePrivateChats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationSettingsScopePrivateChats", - ID: NotificationSettingsScopePrivateChatsTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationSettingsScopePrivateChats) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationSettingsScopePrivateChats#37e04d67 as nil") - } - b.PutID(NotificationSettingsScopePrivateChatsTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationSettingsScopePrivateChats) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationSettingsScopePrivateChats#37e04d67 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationSettingsScopePrivateChats) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationSettingsScopePrivateChats#37e04d67 to nil") - } - if err := b.ConsumeID(NotificationSettingsScopePrivateChatsTypeID); err != nil { - return fmt.Errorf("unable to decode notificationSettingsScopePrivateChats#37e04d67: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationSettingsScopePrivateChats) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationSettingsScopePrivateChats#37e04d67 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationSettingsScopePrivateChats) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationSettingsScopePrivateChats#37e04d67 as nil") - } - b.ObjStart() - b.PutID("notificationSettingsScopePrivateChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationSettingsScopePrivateChats) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationSettingsScopePrivateChats#37e04d67 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationSettingsScopePrivateChats"); err != nil { - return fmt.Errorf("unable to decode notificationSettingsScopePrivateChats#37e04d67: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NotificationSettingsScopeGroupChats represents TL type `notificationSettingsScopeGroupChats#483fd1f3`. -type NotificationSettingsScopeGroupChats struct { -} - -// NotificationSettingsScopeGroupChatsTypeID is TL type id of NotificationSettingsScopeGroupChats. -const NotificationSettingsScopeGroupChatsTypeID = 0x483fd1f3 - -// construct implements constructor of NotificationSettingsScopeClass. -func (n NotificationSettingsScopeGroupChats) construct() NotificationSettingsScopeClass { return &n } - -// Ensuring interfaces in compile-time for NotificationSettingsScopeGroupChats. -var ( - _ bin.Encoder = &NotificationSettingsScopeGroupChats{} - _ bin.Decoder = &NotificationSettingsScopeGroupChats{} - _ bin.BareEncoder = &NotificationSettingsScopeGroupChats{} - _ bin.BareDecoder = &NotificationSettingsScopeGroupChats{} - - _ NotificationSettingsScopeClass = &NotificationSettingsScopeGroupChats{} -) - -func (n *NotificationSettingsScopeGroupChats) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationSettingsScopeGroupChats) String() string { - if n == nil { - return "NotificationSettingsScopeGroupChats(nil)" - } - type Alias NotificationSettingsScopeGroupChats - return fmt.Sprintf("NotificationSettingsScopeGroupChats%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationSettingsScopeGroupChats) TypeID() uint32 { - return NotificationSettingsScopeGroupChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationSettingsScopeGroupChats) TypeName() string { - return "notificationSettingsScopeGroupChats" -} - -// TypeInfo returns info about TL type. -func (n *NotificationSettingsScopeGroupChats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationSettingsScopeGroupChats", - ID: NotificationSettingsScopeGroupChatsTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationSettingsScopeGroupChats) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationSettingsScopeGroupChats#483fd1f3 as nil") - } - b.PutID(NotificationSettingsScopeGroupChatsTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationSettingsScopeGroupChats) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationSettingsScopeGroupChats#483fd1f3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationSettingsScopeGroupChats) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationSettingsScopeGroupChats#483fd1f3 to nil") - } - if err := b.ConsumeID(NotificationSettingsScopeGroupChatsTypeID); err != nil { - return fmt.Errorf("unable to decode notificationSettingsScopeGroupChats#483fd1f3: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationSettingsScopeGroupChats) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationSettingsScopeGroupChats#483fd1f3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationSettingsScopeGroupChats) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationSettingsScopeGroupChats#483fd1f3 as nil") - } - b.ObjStart() - b.PutID("notificationSettingsScopeGroupChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationSettingsScopeGroupChats) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationSettingsScopeGroupChats#483fd1f3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationSettingsScopeGroupChats"); err != nil { - return fmt.Errorf("unable to decode notificationSettingsScopeGroupChats#483fd1f3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NotificationSettingsScopeChannelChats represents TL type `notificationSettingsScopeChannelChats#20aa0588`. -type NotificationSettingsScopeChannelChats struct { -} - -// NotificationSettingsScopeChannelChatsTypeID is TL type id of NotificationSettingsScopeChannelChats. -const NotificationSettingsScopeChannelChatsTypeID = 0x20aa0588 - -// construct implements constructor of NotificationSettingsScopeClass. -func (n NotificationSettingsScopeChannelChats) construct() NotificationSettingsScopeClass { return &n } - -// Ensuring interfaces in compile-time for NotificationSettingsScopeChannelChats. -var ( - _ bin.Encoder = &NotificationSettingsScopeChannelChats{} - _ bin.Decoder = &NotificationSettingsScopeChannelChats{} - _ bin.BareEncoder = &NotificationSettingsScopeChannelChats{} - _ bin.BareDecoder = &NotificationSettingsScopeChannelChats{} - - _ NotificationSettingsScopeClass = &NotificationSettingsScopeChannelChats{} -) - -func (n *NotificationSettingsScopeChannelChats) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationSettingsScopeChannelChats) String() string { - if n == nil { - return "NotificationSettingsScopeChannelChats(nil)" - } - type Alias NotificationSettingsScopeChannelChats - return fmt.Sprintf("NotificationSettingsScopeChannelChats%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationSettingsScopeChannelChats) TypeID() uint32 { - return NotificationSettingsScopeChannelChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationSettingsScopeChannelChats) TypeName() string { - return "notificationSettingsScopeChannelChats" -} - -// TypeInfo returns info about TL type. -func (n *NotificationSettingsScopeChannelChats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationSettingsScopeChannelChats", - ID: NotificationSettingsScopeChannelChatsTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationSettingsScopeChannelChats) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationSettingsScopeChannelChats#20aa0588 as nil") - } - b.PutID(NotificationSettingsScopeChannelChatsTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationSettingsScopeChannelChats) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationSettingsScopeChannelChats#20aa0588 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationSettingsScopeChannelChats) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationSettingsScopeChannelChats#20aa0588 to nil") - } - if err := b.ConsumeID(NotificationSettingsScopeChannelChatsTypeID); err != nil { - return fmt.Errorf("unable to decode notificationSettingsScopeChannelChats#20aa0588: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationSettingsScopeChannelChats) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationSettingsScopeChannelChats#20aa0588 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationSettingsScopeChannelChats) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationSettingsScopeChannelChats#20aa0588 as nil") - } - b.ObjStart() - b.PutID("notificationSettingsScopeChannelChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationSettingsScopeChannelChats) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationSettingsScopeChannelChats#20aa0588 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationSettingsScopeChannelChats"); err != nil { - return fmt.Errorf("unable to decode notificationSettingsScopeChannelChats#20aa0588: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NotificationSettingsScopeClassName is schema name of NotificationSettingsScopeClass. -const NotificationSettingsScopeClassName = "NotificationSettingsScope" - -// NotificationSettingsScopeClass represents NotificationSettingsScope generic type. -// -// Example: -// -// g, err := tdapi.DecodeNotificationSettingsScope(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.NotificationSettingsScopePrivateChats: // notificationSettingsScopePrivateChats#37e04d67 -// case *tdapi.NotificationSettingsScopeGroupChats: // notificationSettingsScopeGroupChats#483fd1f3 -// case *tdapi.NotificationSettingsScopeChannelChats: // notificationSettingsScopeChannelChats#20aa0588 -// default: panic(v) -// } -type NotificationSettingsScopeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() NotificationSettingsScopeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeNotificationSettingsScope implements binary de-serialization for NotificationSettingsScopeClass. -func DecodeNotificationSettingsScope(buf *bin.Buffer) (NotificationSettingsScopeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case NotificationSettingsScopePrivateChatsTypeID: - // Decoding notificationSettingsScopePrivateChats#37e04d67. - v := NotificationSettingsScopePrivateChats{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationSettingsScopeClass: %w", err) - } - return &v, nil - case NotificationSettingsScopeGroupChatsTypeID: - // Decoding notificationSettingsScopeGroupChats#483fd1f3. - v := NotificationSettingsScopeGroupChats{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationSettingsScopeClass: %w", err) - } - return &v, nil - case NotificationSettingsScopeChannelChatsTypeID: - // Decoding notificationSettingsScopeChannelChats#20aa0588. - v := NotificationSettingsScopeChannelChats{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationSettingsScopeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode NotificationSettingsScopeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONNotificationSettingsScope implements binary de-serialization for NotificationSettingsScopeClass. -func DecodeTDLibJSONNotificationSettingsScope(buf tdjson.Decoder) (NotificationSettingsScopeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "notificationSettingsScopePrivateChats": - // Decoding notificationSettingsScopePrivateChats#37e04d67. - v := NotificationSettingsScopePrivateChats{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationSettingsScopeClass: %w", err) - } - return &v, nil - case "notificationSettingsScopeGroupChats": - // Decoding notificationSettingsScopeGroupChats#483fd1f3. - v := NotificationSettingsScopeGroupChats{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationSettingsScopeClass: %w", err) - } - return &v, nil - case "notificationSettingsScopeChannelChats": - // Decoding notificationSettingsScopeChannelChats#20aa0588. - v := NotificationSettingsScopeChannelChats{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationSettingsScopeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode NotificationSettingsScopeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// NotificationSettingsScope boxes the NotificationSettingsScopeClass providing a helper. -type NotificationSettingsScopeBox struct { - NotificationSettingsScope NotificationSettingsScopeClass -} - -// Decode implements bin.Decoder for NotificationSettingsScopeBox. -func (b *NotificationSettingsScopeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode NotificationSettingsScopeBox to nil") - } - v, err := DecodeNotificationSettingsScope(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.NotificationSettingsScope = v - return nil -} - -// Encode implements bin.Encode for NotificationSettingsScopeBox. -func (b *NotificationSettingsScopeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.NotificationSettingsScope == nil { - return fmt.Errorf("unable to encode NotificationSettingsScopeClass as nil") - } - return b.NotificationSettingsScope.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for NotificationSettingsScopeBox. -func (b *NotificationSettingsScopeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode NotificationSettingsScopeBox to nil") - } - v, err := DecodeTDLibJSONNotificationSettingsScope(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.NotificationSettingsScope = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for NotificationSettingsScopeBox. -func (b *NotificationSettingsScopeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.NotificationSettingsScope == nil { - return fmt.Errorf("unable to encode NotificationSettingsScopeClass as nil") - } - return b.NotificationSettingsScope.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_notification_sound_gen.go b/tdapi/tl_notification_sound_gen.go deleted file mode 100644 index 984213350..000000000 --- a/tdapi/tl_notification_sound_gen.go +++ /dev/null @@ -1,363 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// NotificationSound represents TL type `notificationSound#f4ef6137`. -type NotificationSound struct { - // Unique identifier of the notification sound - ID int64 - // Duration of the sound, in seconds - Duration int32 - // Point in time (Unix timestamp) when the sound was created - Date int32 - // Title of the notification sound - Title string - // Arbitrary data, defined while the sound was uploaded - Data string - // File containing the sound - Sound File -} - -// NotificationSoundTypeID is TL type id of NotificationSound. -const NotificationSoundTypeID = 0xf4ef6137 - -// Ensuring interfaces in compile-time for NotificationSound. -var ( - _ bin.Encoder = &NotificationSound{} - _ bin.Decoder = &NotificationSound{} - _ bin.BareEncoder = &NotificationSound{} - _ bin.BareDecoder = &NotificationSound{} -) - -func (n *NotificationSound) Zero() bool { - if n == nil { - return true - } - if !(n.ID == 0) { - return false - } - if !(n.Duration == 0) { - return false - } - if !(n.Date == 0) { - return false - } - if !(n.Title == "") { - return false - } - if !(n.Data == "") { - return false - } - if !(n.Sound.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationSound) String() string { - if n == nil { - return "NotificationSound(nil)" - } - type Alias NotificationSound - return fmt.Sprintf("NotificationSound%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationSound) TypeID() uint32 { - return NotificationSoundTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationSound) TypeName() string { - return "notificationSound" -} - -// TypeInfo returns info about TL type. -func (n *NotificationSound) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationSound", - ID: NotificationSoundTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Data", - SchemaName: "data", - }, - { - Name: "Sound", - SchemaName: "sound", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationSound) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationSound#f4ef6137 as nil") - } - b.PutID(NotificationSoundTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationSound) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationSound#f4ef6137 as nil") - } - b.PutLong(n.ID) - b.PutInt32(n.Duration) - b.PutInt32(n.Date) - b.PutString(n.Title) - b.PutString(n.Data) - if err := n.Sound.Encode(b); err != nil { - return fmt.Errorf("unable to encode notificationSound#f4ef6137: field sound: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationSound) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationSound#f4ef6137 to nil") - } - if err := b.ConsumeID(NotificationSoundTypeID); err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationSound) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationSound#f4ef6137 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field id: %w", err) - } - n.ID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field duration: %w", err) - } - n.Duration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field date: %w", err) - } - n.Date = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field title: %w", err) - } - n.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field data: %w", err) - } - n.Data = value - } - { - if err := n.Sound.Decode(b); err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field sound: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationSound) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationSound#f4ef6137 as nil") - } - b.ObjStart() - b.PutID("notificationSound") - b.Comma() - b.FieldStart("id") - b.PutLong(n.ID) - b.Comma() - b.FieldStart("duration") - b.PutInt32(n.Duration) - b.Comma() - b.FieldStart("date") - b.PutInt32(n.Date) - b.Comma() - b.FieldStart("title") - b.PutString(n.Title) - b.Comma() - b.FieldStart("data") - b.PutString(n.Data) - b.Comma() - b.FieldStart("sound") - if err := n.Sound.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode notificationSound#f4ef6137: field sound: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationSound) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationSound#f4ef6137 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationSound"); err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field id: %w", err) - } - n.ID = value - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field duration: %w", err) - } - n.Duration = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field date: %w", err) - } - n.Date = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field title: %w", err) - } - n.Title = value - case "data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field data: %w", err) - } - n.Data = value - case "sound": - if err := n.Sound.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode notificationSound#f4ef6137: field sound: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (n *NotificationSound) GetID() (value int64) { - if n == nil { - return - } - return n.ID -} - -// GetDuration returns value of Duration field. -func (n *NotificationSound) GetDuration() (value int32) { - if n == nil { - return - } - return n.Duration -} - -// GetDate returns value of Date field. -func (n *NotificationSound) GetDate() (value int32) { - if n == nil { - return - } - return n.Date -} - -// GetTitle returns value of Title field. -func (n *NotificationSound) GetTitle() (value string) { - if n == nil { - return - } - return n.Title -} - -// GetData returns value of Data field. -func (n *NotificationSound) GetData() (value string) { - if n == nil { - return - } - return n.Data -} - -// GetSound returns value of Sound field. -func (n *NotificationSound) GetSound() (value File) { - if n == nil { - return - } - return n.Sound -} diff --git a/tdapi/tl_notification_sounds_gen.go b/tdapi/tl_notification_sounds_gen.go deleted file mode 100644 index bf498632f..000000000 --- a/tdapi/tl_notification_sounds_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// NotificationSounds represents TL type `notificationSounds#7ba3c849`. -type NotificationSounds struct { - // A list of notification sounds - NotificationSounds []NotificationSound -} - -// NotificationSoundsTypeID is TL type id of NotificationSounds. -const NotificationSoundsTypeID = 0x7ba3c849 - -// Ensuring interfaces in compile-time for NotificationSounds. -var ( - _ bin.Encoder = &NotificationSounds{} - _ bin.Decoder = &NotificationSounds{} - _ bin.BareEncoder = &NotificationSounds{} - _ bin.BareDecoder = &NotificationSounds{} -) - -func (n *NotificationSounds) Zero() bool { - if n == nil { - return true - } - if !(n.NotificationSounds == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationSounds) String() string { - if n == nil { - return "NotificationSounds(nil)" - } - type Alias NotificationSounds - return fmt.Sprintf("NotificationSounds%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationSounds) TypeID() uint32 { - return NotificationSoundsTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationSounds) TypeName() string { - return "notificationSounds" -} - -// TypeInfo returns info about TL type. -func (n *NotificationSounds) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationSounds", - ID: NotificationSoundsTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NotificationSounds", - SchemaName: "notification_sounds", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationSounds) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationSounds#7ba3c849 as nil") - } - b.PutID(NotificationSoundsTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationSounds) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationSounds#7ba3c849 as nil") - } - b.PutInt(len(n.NotificationSounds)) - for idx, v := range n.NotificationSounds { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare notificationSounds#7ba3c849: field notification_sounds element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationSounds) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationSounds#7ba3c849 to nil") - } - if err := b.ConsumeID(NotificationSoundsTypeID); err != nil { - return fmt.Errorf("unable to decode notificationSounds#7ba3c849: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationSounds) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationSounds#7ba3c849 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode notificationSounds#7ba3c849: field notification_sounds: %w", err) - } - - if headerLen > 0 { - n.NotificationSounds = make([]NotificationSound, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value NotificationSound - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare notificationSounds#7ba3c849: field notification_sounds: %w", err) - } - n.NotificationSounds = append(n.NotificationSounds, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationSounds) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationSounds#7ba3c849 as nil") - } - b.ObjStart() - b.PutID("notificationSounds") - b.Comma() - b.FieldStart("notification_sounds") - b.ArrStart() - for idx, v := range n.NotificationSounds { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode notificationSounds#7ba3c849: field notification_sounds element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationSounds) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationSounds#7ba3c849 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationSounds"); err != nil { - return fmt.Errorf("unable to decode notificationSounds#7ba3c849: %w", err) - } - case "notification_sounds": - if err := b.Arr(func(b tdjson.Decoder) error { - var value NotificationSound - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode notificationSounds#7ba3c849: field notification_sounds: %w", err) - } - n.NotificationSounds = append(n.NotificationSounds, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode notificationSounds#7ba3c849: field notification_sounds: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetNotificationSounds returns value of NotificationSounds field. -func (n *NotificationSounds) GetNotificationSounds() (value []NotificationSound) { - if n == nil { - return - } - return n.NotificationSounds -} diff --git a/tdapi/tl_notification_type_gen.go b/tdapi/tl_notification_type_gen.go deleted file mode 100644 index 71bcd059c..000000000 --- a/tdapi/tl_notification_type_gen.go +++ /dev/null @@ -1,1020 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// NotificationTypeNewMessage represents TL type `notificationTypeNewMessage#f0d0e3f2`. -type NotificationTypeNewMessage struct { - // The message - Message Message - // True, if message content must be displayed in notifications - ShowPreview bool -} - -// NotificationTypeNewMessageTypeID is TL type id of NotificationTypeNewMessage. -const NotificationTypeNewMessageTypeID = 0xf0d0e3f2 - -// construct implements constructor of NotificationTypeClass. -func (n NotificationTypeNewMessage) construct() NotificationTypeClass { return &n } - -// Ensuring interfaces in compile-time for NotificationTypeNewMessage. -var ( - _ bin.Encoder = &NotificationTypeNewMessage{} - _ bin.Decoder = &NotificationTypeNewMessage{} - _ bin.BareEncoder = &NotificationTypeNewMessage{} - _ bin.BareDecoder = &NotificationTypeNewMessage{} - - _ NotificationTypeClass = &NotificationTypeNewMessage{} -) - -func (n *NotificationTypeNewMessage) Zero() bool { - if n == nil { - return true - } - if !(n.Message.Zero()) { - return false - } - if !(n.ShowPreview == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationTypeNewMessage) String() string { - if n == nil { - return "NotificationTypeNewMessage(nil)" - } - type Alias NotificationTypeNewMessage - return fmt.Sprintf("NotificationTypeNewMessage%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationTypeNewMessage) TypeID() uint32 { - return NotificationTypeNewMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationTypeNewMessage) TypeName() string { - return "notificationTypeNewMessage" -} - -// TypeInfo returns info about TL type. -func (n *NotificationTypeNewMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationTypeNewMessage", - ID: NotificationTypeNewMessageTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "ShowPreview", - SchemaName: "show_preview", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationTypeNewMessage) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewMessage#f0d0e3f2 as nil") - } - b.PutID(NotificationTypeNewMessageTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationTypeNewMessage) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewMessage#f0d0e3f2 as nil") - } - if err := n.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode notificationTypeNewMessage#f0d0e3f2: field message: %w", err) - } - b.PutBool(n.ShowPreview) - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationTypeNewMessage) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewMessage#f0d0e3f2 to nil") - } - if err := b.ConsumeID(NotificationTypeNewMessageTypeID); err != nil { - return fmt.Errorf("unable to decode notificationTypeNewMessage#f0d0e3f2: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationTypeNewMessage) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewMessage#f0d0e3f2 to nil") - } - { - if err := n.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode notificationTypeNewMessage#f0d0e3f2: field message: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewMessage#f0d0e3f2: field show_preview: %w", err) - } - n.ShowPreview = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationTypeNewMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewMessage#f0d0e3f2 as nil") - } - b.ObjStart() - b.PutID("notificationTypeNewMessage") - b.Comma() - b.FieldStart("message") - if err := n.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode notificationTypeNewMessage#f0d0e3f2: field message: %w", err) - } - b.Comma() - b.FieldStart("show_preview") - b.PutBool(n.ShowPreview) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationTypeNewMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewMessage#f0d0e3f2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationTypeNewMessage"); err != nil { - return fmt.Errorf("unable to decode notificationTypeNewMessage#f0d0e3f2: %w", err) - } - case "message": - if err := n.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode notificationTypeNewMessage#f0d0e3f2: field message: %w", err) - } - case "show_preview": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewMessage#f0d0e3f2: field show_preview: %w", err) - } - n.ShowPreview = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (n *NotificationTypeNewMessage) GetMessage() (value Message) { - if n == nil { - return - } - return n.Message -} - -// GetShowPreview returns value of ShowPreview field. -func (n *NotificationTypeNewMessage) GetShowPreview() (value bool) { - if n == nil { - return - } - return n.ShowPreview -} - -// NotificationTypeNewSecretChat represents TL type `notificationTypeNewSecretChat#4771c6b0`. -type NotificationTypeNewSecretChat struct { -} - -// NotificationTypeNewSecretChatTypeID is TL type id of NotificationTypeNewSecretChat. -const NotificationTypeNewSecretChatTypeID = 0x4771c6b0 - -// construct implements constructor of NotificationTypeClass. -func (n NotificationTypeNewSecretChat) construct() NotificationTypeClass { return &n } - -// Ensuring interfaces in compile-time for NotificationTypeNewSecretChat. -var ( - _ bin.Encoder = &NotificationTypeNewSecretChat{} - _ bin.Decoder = &NotificationTypeNewSecretChat{} - _ bin.BareEncoder = &NotificationTypeNewSecretChat{} - _ bin.BareDecoder = &NotificationTypeNewSecretChat{} - - _ NotificationTypeClass = &NotificationTypeNewSecretChat{} -) - -func (n *NotificationTypeNewSecretChat) Zero() bool { - if n == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationTypeNewSecretChat) String() string { - if n == nil { - return "NotificationTypeNewSecretChat(nil)" - } - type Alias NotificationTypeNewSecretChat - return fmt.Sprintf("NotificationTypeNewSecretChat%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationTypeNewSecretChat) TypeID() uint32 { - return NotificationTypeNewSecretChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationTypeNewSecretChat) TypeName() string { - return "notificationTypeNewSecretChat" -} - -// TypeInfo returns info about TL type. -func (n *NotificationTypeNewSecretChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationTypeNewSecretChat", - ID: NotificationTypeNewSecretChatTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationTypeNewSecretChat) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewSecretChat#4771c6b0 as nil") - } - b.PutID(NotificationTypeNewSecretChatTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationTypeNewSecretChat) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewSecretChat#4771c6b0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationTypeNewSecretChat) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewSecretChat#4771c6b0 to nil") - } - if err := b.ConsumeID(NotificationTypeNewSecretChatTypeID); err != nil { - return fmt.Errorf("unable to decode notificationTypeNewSecretChat#4771c6b0: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationTypeNewSecretChat) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewSecretChat#4771c6b0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationTypeNewSecretChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewSecretChat#4771c6b0 as nil") - } - b.ObjStart() - b.PutID("notificationTypeNewSecretChat") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationTypeNewSecretChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewSecretChat#4771c6b0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationTypeNewSecretChat"); err != nil { - return fmt.Errorf("unable to decode notificationTypeNewSecretChat#4771c6b0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// NotificationTypeNewCall represents TL type `notificationTypeNewCall#66164179`. -type NotificationTypeNewCall struct { - // Call identifier - CallID int32 -} - -// NotificationTypeNewCallTypeID is TL type id of NotificationTypeNewCall. -const NotificationTypeNewCallTypeID = 0x66164179 - -// construct implements constructor of NotificationTypeClass. -func (n NotificationTypeNewCall) construct() NotificationTypeClass { return &n } - -// Ensuring interfaces in compile-time for NotificationTypeNewCall. -var ( - _ bin.Encoder = &NotificationTypeNewCall{} - _ bin.Decoder = &NotificationTypeNewCall{} - _ bin.BareEncoder = &NotificationTypeNewCall{} - _ bin.BareDecoder = &NotificationTypeNewCall{} - - _ NotificationTypeClass = &NotificationTypeNewCall{} -) - -func (n *NotificationTypeNewCall) Zero() bool { - if n == nil { - return true - } - if !(n.CallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationTypeNewCall) String() string { - if n == nil { - return "NotificationTypeNewCall(nil)" - } - type Alias NotificationTypeNewCall - return fmt.Sprintf("NotificationTypeNewCall%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationTypeNewCall) TypeID() uint32 { - return NotificationTypeNewCallTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationTypeNewCall) TypeName() string { - return "notificationTypeNewCall" -} - -// TypeInfo returns info about TL type. -func (n *NotificationTypeNewCall) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationTypeNewCall", - ID: NotificationTypeNewCallTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CallID", - SchemaName: "call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationTypeNewCall) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewCall#66164179 as nil") - } - b.PutID(NotificationTypeNewCallTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationTypeNewCall) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewCall#66164179 as nil") - } - b.PutInt32(n.CallID) - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationTypeNewCall) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewCall#66164179 to nil") - } - if err := b.ConsumeID(NotificationTypeNewCallTypeID); err != nil { - return fmt.Errorf("unable to decode notificationTypeNewCall#66164179: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationTypeNewCall) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewCall#66164179 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewCall#66164179: field call_id: %w", err) - } - n.CallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationTypeNewCall) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewCall#66164179 as nil") - } - b.ObjStart() - b.PutID("notificationTypeNewCall") - b.Comma() - b.FieldStart("call_id") - b.PutInt32(n.CallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationTypeNewCall) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewCall#66164179 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationTypeNewCall"); err != nil { - return fmt.Errorf("unable to decode notificationTypeNewCall#66164179: %w", err) - } - case "call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewCall#66164179: field call_id: %w", err) - } - n.CallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCallID returns value of CallID field. -func (n *NotificationTypeNewCall) GetCallID() (value int32) { - if n == nil { - return - } - return n.CallID -} - -// NotificationTypeNewPushMessage represents TL type `notificationTypeNewPushMessage#d5949e32`. -type NotificationTypeNewPushMessage struct { - // The message identifier. The message will not be available in the chat history, but the - // identifier can be used in viewMessages, or as a message to be replied in the same chat - MessageID int64 - // Identifier of the sender of the message. Corresponding user or chat may be - // inaccessible - SenderID MessageSenderClass - // Name of the sender - SenderName string - // True, if the message is outgoing - IsOutgoing bool - // Push message content - Content PushMessageContentClass -} - -// NotificationTypeNewPushMessageTypeID is TL type id of NotificationTypeNewPushMessage. -const NotificationTypeNewPushMessageTypeID = 0xd5949e32 - -// construct implements constructor of NotificationTypeClass. -func (n NotificationTypeNewPushMessage) construct() NotificationTypeClass { return &n } - -// Ensuring interfaces in compile-time for NotificationTypeNewPushMessage. -var ( - _ bin.Encoder = &NotificationTypeNewPushMessage{} - _ bin.Decoder = &NotificationTypeNewPushMessage{} - _ bin.BareEncoder = &NotificationTypeNewPushMessage{} - _ bin.BareDecoder = &NotificationTypeNewPushMessage{} - - _ NotificationTypeClass = &NotificationTypeNewPushMessage{} -) - -func (n *NotificationTypeNewPushMessage) Zero() bool { - if n == nil { - return true - } - if !(n.MessageID == 0) { - return false - } - if !(n.SenderID == nil) { - return false - } - if !(n.SenderName == "") { - return false - } - if !(n.IsOutgoing == false) { - return false - } - if !(n.Content == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (n *NotificationTypeNewPushMessage) String() string { - if n == nil { - return "NotificationTypeNewPushMessage(nil)" - } - type Alias NotificationTypeNewPushMessage - return fmt.Sprintf("NotificationTypeNewPushMessage%+v", Alias(*n)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*NotificationTypeNewPushMessage) TypeID() uint32 { - return NotificationTypeNewPushMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*NotificationTypeNewPushMessage) TypeName() string { - return "notificationTypeNewPushMessage" -} - -// TypeInfo returns info about TL type. -func (n *NotificationTypeNewPushMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "notificationTypeNewPushMessage", - ID: NotificationTypeNewPushMessageTypeID, - } - if n == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "SenderID", - SchemaName: "sender_id", - }, - { - Name: "SenderName", - SchemaName: "sender_name", - }, - { - Name: "IsOutgoing", - SchemaName: "is_outgoing", - }, - { - Name: "Content", - SchemaName: "content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (n *NotificationTypeNewPushMessage) Encode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewPushMessage#d5949e32 as nil") - } - b.PutID(NotificationTypeNewPushMessageTypeID) - return n.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (n *NotificationTypeNewPushMessage) EncodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewPushMessage#d5949e32 as nil") - } - b.PutInt53(n.MessageID) - if n.SenderID == nil { - return fmt.Errorf("unable to encode notificationTypeNewPushMessage#d5949e32: field sender_id is nil") - } - if err := n.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode notificationTypeNewPushMessage#d5949e32: field sender_id: %w", err) - } - b.PutString(n.SenderName) - b.PutBool(n.IsOutgoing) - if n.Content == nil { - return fmt.Errorf("unable to encode notificationTypeNewPushMessage#d5949e32: field content is nil") - } - if err := n.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode notificationTypeNewPushMessage#d5949e32: field content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (n *NotificationTypeNewPushMessage) Decode(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewPushMessage#d5949e32 to nil") - } - if err := b.ConsumeID(NotificationTypeNewPushMessageTypeID); err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: %w", err) - } - return n.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (n *NotificationTypeNewPushMessage) DecodeBare(b *bin.Buffer) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewPushMessage#d5949e32 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: field message_id: %w", err) - } - n.MessageID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: field sender_id: %w", err) - } - n.SenderID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: field sender_name: %w", err) - } - n.SenderName = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: field is_outgoing: %w", err) - } - n.IsOutgoing = value - } - { - value, err := DecodePushMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: field content: %w", err) - } - n.Content = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (n *NotificationTypeNewPushMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if n == nil { - return fmt.Errorf("can't encode notificationTypeNewPushMessage#d5949e32 as nil") - } - b.ObjStart() - b.PutID("notificationTypeNewPushMessage") - b.Comma() - b.FieldStart("message_id") - b.PutInt53(n.MessageID) - b.Comma() - b.FieldStart("sender_id") - if n.SenderID == nil { - return fmt.Errorf("unable to encode notificationTypeNewPushMessage#d5949e32: field sender_id is nil") - } - if err := n.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode notificationTypeNewPushMessage#d5949e32: field sender_id: %w", err) - } - b.Comma() - b.FieldStart("sender_name") - b.PutString(n.SenderName) - b.Comma() - b.FieldStart("is_outgoing") - b.PutBool(n.IsOutgoing) - b.Comma() - b.FieldStart("content") - if n.Content == nil { - return fmt.Errorf("unable to encode notificationTypeNewPushMessage#d5949e32: field content is nil") - } - if err := n.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode notificationTypeNewPushMessage#d5949e32: field content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (n *NotificationTypeNewPushMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if n == nil { - return fmt.Errorf("can't decode notificationTypeNewPushMessage#d5949e32 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("notificationTypeNewPushMessage"); err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: %w", err) - } - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: field message_id: %w", err) - } - n.MessageID = value - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: field sender_id: %w", err) - } - n.SenderID = value - case "sender_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: field sender_name: %w", err) - } - n.SenderName = value - case "is_outgoing": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: field is_outgoing: %w", err) - } - n.IsOutgoing = value - case "content": - value, err := DecodeTDLibJSONPushMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode notificationTypeNewPushMessage#d5949e32: field content: %w", err) - } - n.Content = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageID returns value of MessageID field. -func (n *NotificationTypeNewPushMessage) GetMessageID() (value int64) { - if n == nil { - return - } - return n.MessageID -} - -// GetSenderID returns value of SenderID field. -func (n *NotificationTypeNewPushMessage) GetSenderID() (value MessageSenderClass) { - if n == nil { - return - } - return n.SenderID -} - -// GetSenderName returns value of SenderName field. -func (n *NotificationTypeNewPushMessage) GetSenderName() (value string) { - if n == nil { - return - } - return n.SenderName -} - -// GetIsOutgoing returns value of IsOutgoing field. -func (n *NotificationTypeNewPushMessage) GetIsOutgoing() (value bool) { - if n == nil { - return - } - return n.IsOutgoing -} - -// GetContent returns value of Content field. -func (n *NotificationTypeNewPushMessage) GetContent() (value PushMessageContentClass) { - if n == nil { - return - } - return n.Content -} - -// NotificationTypeClassName is schema name of NotificationTypeClass. -const NotificationTypeClassName = "NotificationType" - -// NotificationTypeClass represents NotificationType generic type. -// -// Example: -// -// g, err := tdapi.DecodeNotificationType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.NotificationTypeNewMessage: // notificationTypeNewMessage#f0d0e3f2 -// case *tdapi.NotificationTypeNewSecretChat: // notificationTypeNewSecretChat#4771c6b0 -// case *tdapi.NotificationTypeNewCall: // notificationTypeNewCall#66164179 -// case *tdapi.NotificationTypeNewPushMessage: // notificationTypeNewPushMessage#d5949e32 -// default: panic(v) -// } -type NotificationTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() NotificationTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeNotificationType implements binary de-serialization for NotificationTypeClass. -func DecodeNotificationType(buf *bin.Buffer) (NotificationTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case NotificationTypeNewMessageTypeID: - // Decoding notificationTypeNewMessage#f0d0e3f2. - v := NotificationTypeNewMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationTypeClass: %w", err) - } - return &v, nil - case NotificationTypeNewSecretChatTypeID: - // Decoding notificationTypeNewSecretChat#4771c6b0. - v := NotificationTypeNewSecretChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationTypeClass: %w", err) - } - return &v, nil - case NotificationTypeNewCallTypeID: - // Decoding notificationTypeNewCall#66164179. - v := NotificationTypeNewCall{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationTypeClass: %w", err) - } - return &v, nil - case NotificationTypeNewPushMessageTypeID: - // Decoding notificationTypeNewPushMessage#d5949e32. - v := NotificationTypeNewPushMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode NotificationTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONNotificationType implements binary de-serialization for NotificationTypeClass. -func DecodeTDLibJSONNotificationType(buf tdjson.Decoder) (NotificationTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "notificationTypeNewMessage": - // Decoding notificationTypeNewMessage#f0d0e3f2. - v := NotificationTypeNewMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationTypeClass: %w", err) - } - return &v, nil - case "notificationTypeNewSecretChat": - // Decoding notificationTypeNewSecretChat#4771c6b0. - v := NotificationTypeNewSecretChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationTypeClass: %w", err) - } - return &v, nil - case "notificationTypeNewCall": - // Decoding notificationTypeNewCall#66164179. - v := NotificationTypeNewCall{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationTypeClass: %w", err) - } - return &v, nil - case "notificationTypeNewPushMessage": - // Decoding notificationTypeNewPushMessage#d5949e32. - v := NotificationTypeNewPushMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode NotificationTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode NotificationTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// NotificationType boxes the NotificationTypeClass providing a helper. -type NotificationTypeBox struct { - NotificationType NotificationTypeClass -} - -// Decode implements bin.Decoder for NotificationTypeBox. -func (b *NotificationTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode NotificationTypeBox to nil") - } - v, err := DecodeNotificationType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.NotificationType = v - return nil -} - -// Encode implements bin.Encode for NotificationTypeBox. -func (b *NotificationTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.NotificationType == nil { - return fmt.Errorf("unable to encode NotificationTypeClass as nil") - } - return b.NotificationType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for NotificationTypeBox. -func (b *NotificationTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode NotificationTypeBox to nil") - } - v, err := DecodeTDLibJSONNotificationType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.NotificationType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for NotificationTypeBox. -func (b *NotificationTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.NotificationType == nil { - return fmt.Errorf("unable to encode NotificationTypeClass as nil") - } - return b.NotificationType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_ok_gen.go b/tdapi/tl_ok_gen.go deleted file mode 100644 index ed72ea68f..000000000 --- a/tdapi/tl_ok_gen.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Ok represents TL type `ok#d4edbe69`. -type Ok struct { -} - -// OkTypeID is TL type id of Ok. -const OkTypeID = 0xd4edbe69 - -// Ensuring interfaces in compile-time for Ok. -var ( - _ bin.Encoder = &Ok{} - _ bin.Decoder = &Ok{} - _ bin.BareEncoder = &Ok{} - _ bin.BareDecoder = &Ok{} -) - -func (o *Ok) Zero() bool { - if o == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (o *Ok) String() string { - if o == nil { - return "Ok(nil)" - } - type Alias Ok - return fmt.Sprintf("Ok%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Ok) TypeID() uint32 { - return OkTypeID -} - -// TypeName returns name of type in TL schema. -func (*Ok) TypeName() string { - return "ok" -} - -// TypeInfo returns info about TL type. -func (o *Ok) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "ok", - ID: OkTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (o *Ok) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode ok#d4edbe69 as nil") - } - b.PutID(OkTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *Ok) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode ok#d4edbe69 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (o *Ok) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode ok#d4edbe69 to nil") - } - if err := b.ConsumeID(OkTypeID); err != nil { - return fmt.Errorf("unable to decode ok#d4edbe69: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *Ok) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode ok#d4edbe69 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *Ok) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode ok#d4edbe69 as nil") - } - b.ObjStart() - b.PutID("ok") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *Ok) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode ok#d4edbe69 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("ok"); err != nil { - return fmt.Errorf("unable to decode ok#d4edbe69: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} diff --git a/tdapi/tl_open_chat_gen.go b/tdapi/tl_open_chat_gen.go deleted file mode 100644 index dce8d9366..000000000 --- a/tdapi/tl_open_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// OpenChatRequest represents TL type `openChat#ecb9be0b`. -type OpenChatRequest struct { - // Chat identifier - ChatID int64 -} - -// OpenChatRequestTypeID is TL type id of OpenChatRequest. -const OpenChatRequestTypeID = 0xecb9be0b - -// Ensuring interfaces in compile-time for OpenChatRequest. -var ( - _ bin.Encoder = &OpenChatRequest{} - _ bin.Decoder = &OpenChatRequest{} - _ bin.BareEncoder = &OpenChatRequest{} - _ bin.BareDecoder = &OpenChatRequest{} -) - -func (o *OpenChatRequest) Zero() bool { - if o == nil { - return true - } - if !(o.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (o *OpenChatRequest) String() string { - if o == nil { - return "OpenChatRequest(nil)" - } - type Alias OpenChatRequest - return fmt.Sprintf("OpenChatRequest%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*OpenChatRequest) TypeID() uint32 { - return OpenChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*OpenChatRequest) TypeName() string { - return "openChat" -} - -// TypeInfo returns info about TL type. -func (o *OpenChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "openChat", - ID: OpenChatRequestTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (o *OpenChatRequest) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode openChat#ecb9be0b as nil") - } - b.PutID(OpenChatRequestTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *OpenChatRequest) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode openChat#ecb9be0b as nil") - } - b.PutInt53(o.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (o *OpenChatRequest) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode openChat#ecb9be0b to nil") - } - if err := b.ConsumeID(OpenChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode openChat#ecb9be0b: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *OpenChatRequest) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode openChat#ecb9be0b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openChat#ecb9be0b: field chat_id: %w", err) - } - o.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *OpenChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode openChat#ecb9be0b as nil") - } - b.ObjStart() - b.PutID("openChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(o.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *OpenChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode openChat#ecb9be0b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("openChat"); err != nil { - return fmt.Errorf("unable to decode openChat#ecb9be0b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openChat#ecb9be0b: field chat_id: %w", err) - } - o.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (o *OpenChatRequest) GetChatID() (value int64) { - if o == nil { - return - } - return o.ChatID -} - -// OpenChat invokes method openChat#ecb9be0b returning error if any. -func (c *Client) OpenChat(ctx context.Context, chatid int64) error { - var ok Ok - - request := &OpenChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_open_chat_similar_chat_gen.go b/tdapi/tl_open_chat_similar_chat_gen.go deleted file mode 100644 index 38f8e9c4e..000000000 --- a/tdapi/tl_open_chat_similar_chat_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// OpenChatSimilarChatRequest represents TL type `openChatSimilarChat#8fa6f413`. -type OpenChatSimilarChatRequest struct { - // Identifier of the original chat, which similar chats were requested - ChatID int64 - // Identifier of the opened chat - OpenedChatID int64 -} - -// OpenChatSimilarChatRequestTypeID is TL type id of OpenChatSimilarChatRequest. -const OpenChatSimilarChatRequestTypeID = 0x8fa6f413 - -// Ensuring interfaces in compile-time for OpenChatSimilarChatRequest. -var ( - _ bin.Encoder = &OpenChatSimilarChatRequest{} - _ bin.Decoder = &OpenChatSimilarChatRequest{} - _ bin.BareEncoder = &OpenChatSimilarChatRequest{} - _ bin.BareDecoder = &OpenChatSimilarChatRequest{} -) - -func (o *OpenChatSimilarChatRequest) Zero() bool { - if o == nil { - return true - } - if !(o.ChatID == 0) { - return false - } - if !(o.OpenedChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (o *OpenChatSimilarChatRequest) String() string { - if o == nil { - return "OpenChatSimilarChatRequest(nil)" - } - type Alias OpenChatSimilarChatRequest - return fmt.Sprintf("OpenChatSimilarChatRequest%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*OpenChatSimilarChatRequest) TypeID() uint32 { - return OpenChatSimilarChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*OpenChatSimilarChatRequest) TypeName() string { - return "openChatSimilarChat" -} - -// TypeInfo returns info about TL type. -func (o *OpenChatSimilarChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "openChatSimilarChat", - ID: OpenChatSimilarChatRequestTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "OpenedChatID", - SchemaName: "opened_chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (o *OpenChatSimilarChatRequest) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode openChatSimilarChat#8fa6f413 as nil") - } - b.PutID(OpenChatSimilarChatRequestTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *OpenChatSimilarChatRequest) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode openChatSimilarChat#8fa6f413 as nil") - } - b.PutInt53(o.ChatID) - b.PutInt53(o.OpenedChatID) - return nil -} - -// Decode implements bin.Decoder. -func (o *OpenChatSimilarChatRequest) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode openChatSimilarChat#8fa6f413 to nil") - } - if err := b.ConsumeID(OpenChatSimilarChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode openChatSimilarChat#8fa6f413: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *OpenChatSimilarChatRequest) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode openChatSimilarChat#8fa6f413 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openChatSimilarChat#8fa6f413: field chat_id: %w", err) - } - o.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openChatSimilarChat#8fa6f413: field opened_chat_id: %w", err) - } - o.OpenedChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *OpenChatSimilarChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode openChatSimilarChat#8fa6f413 as nil") - } - b.ObjStart() - b.PutID("openChatSimilarChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(o.ChatID) - b.Comma() - b.FieldStart("opened_chat_id") - b.PutInt53(o.OpenedChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *OpenChatSimilarChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode openChatSimilarChat#8fa6f413 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("openChatSimilarChat"); err != nil { - return fmt.Errorf("unable to decode openChatSimilarChat#8fa6f413: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openChatSimilarChat#8fa6f413: field chat_id: %w", err) - } - o.ChatID = value - case "opened_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openChatSimilarChat#8fa6f413: field opened_chat_id: %w", err) - } - o.OpenedChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (o *OpenChatSimilarChatRequest) GetChatID() (value int64) { - if o == nil { - return - } - return o.ChatID -} - -// GetOpenedChatID returns value of OpenedChatID field. -func (o *OpenChatSimilarChatRequest) GetOpenedChatID() (value int64) { - if o == nil { - return - } - return o.OpenedChatID -} - -// OpenChatSimilarChat invokes method openChatSimilarChat#8fa6f413 returning error if any. -func (c *Client) OpenChatSimilarChat(ctx context.Context, request *OpenChatSimilarChatRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_open_message_content_gen.go b/tdapi/tl_open_message_content_gen.go deleted file mode 100644 index fd68a69bd..000000000 --- a/tdapi/tl_open_message_content_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// OpenMessageContentRequest represents TL type `openMessageContent#d3f2697b`. -type OpenMessageContentRequest struct { - // Chat identifier of the message - ChatID int64 - // Identifier of the message with the opened content - MessageID int64 -} - -// OpenMessageContentRequestTypeID is TL type id of OpenMessageContentRequest. -const OpenMessageContentRequestTypeID = 0xd3f2697b - -// Ensuring interfaces in compile-time for OpenMessageContentRequest. -var ( - _ bin.Encoder = &OpenMessageContentRequest{} - _ bin.Decoder = &OpenMessageContentRequest{} - _ bin.BareEncoder = &OpenMessageContentRequest{} - _ bin.BareDecoder = &OpenMessageContentRequest{} -) - -func (o *OpenMessageContentRequest) Zero() bool { - if o == nil { - return true - } - if !(o.ChatID == 0) { - return false - } - if !(o.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (o *OpenMessageContentRequest) String() string { - if o == nil { - return "OpenMessageContentRequest(nil)" - } - type Alias OpenMessageContentRequest - return fmt.Sprintf("OpenMessageContentRequest%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*OpenMessageContentRequest) TypeID() uint32 { - return OpenMessageContentRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*OpenMessageContentRequest) TypeName() string { - return "openMessageContent" -} - -// TypeInfo returns info about TL type. -func (o *OpenMessageContentRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "openMessageContent", - ID: OpenMessageContentRequestTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (o *OpenMessageContentRequest) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode openMessageContent#d3f2697b as nil") - } - b.PutID(OpenMessageContentRequestTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *OpenMessageContentRequest) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode openMessageContent#d3f2697b as nil") - } - b.PutInt53(o.ChatID) - b.PutInt53(o.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (o *OpenMessageContentRequest) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode openMessageContent#d3f2697b to nil") - } - if err := b.ConsumeID(OpenMessageContentRequestTypeID); err != nil { - return fmt.Errorf("unable to decode openMessageContent#d3f2697b: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *OpenMessageContentRequest) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode openMessageContent#d3f2697b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openMessageContent#d3f2697b: field chat_id: %w", err) - } - o.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openMessageContent#d3f2697b: field message_id: %w", err) - } - o.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *OpenMessageContentRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode openMessageContent#d3f2697b as nil") - } - b.ObjStart() - b.PutID("openMessageContent") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(o.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(o.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *OpenMessageContentRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode openMessageContent#d3f2697b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("openMessageContent"); err != nil { - return fmt.Errorf("unable to decode openMessageContent#d3f2697b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openMessageContent#d3f2697b: field chat_id: %w", err) - } - o.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openMessageContent#d3f2697b: field message_id: %w", err) - } - o.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (o *OpenMessageContentRequest) GetChatID() (value int64) { - if o == nil { - return - } - return o.ChatID -} - -// GetMessageID returns value of MessageID field. -func (o *OpenMessageContentRequest) GetMessageID() (value int64) { - if o == nil { - return - } - return o.MessageID -} - -// OpenMessageContent invokes method openMessageContent#d3f2697b returning error if any. -func (c *Client) OpenMessageContent(ctx context.Context, request *OpenMessageContentRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_open_story_gen.go b/tdapi/tl_open_story_gen.go deleted file mode 100644 index 511ceae7d..000000000 --- a/tdapi/tl_open_story_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// OpenStoryRequest represents TL type `openStory#ceda7c7d`. -type OpenStoryRequest struct { - // The identifier of the sender of the opened story - StorySenderChatID int64 - // The identifier of the story - StoryID int32 -} - -// OpenStoryRequestTypeID is TL type id of OpenStoryRequest. -const OpenStoryRequestTypeID = 0xceda7c7d - -// Ensuring interfaces in compile-time for OpenStoryRequest. -var ( - _ bin.Encoder = &OpenStoryRequest{} - _ bin.Decoder = &OpenStoryRequest{} - _ bin.BareEncoder = &OpenStoryRequest{} - _ bin.BareDecoder = &OpenStoryRequest{} -) - -func (o *OpenStoryRequest) Zero() bool { - if o == nil { - return true - } - if !(o.StorySenderChatID == 0) { - return false - } - if !(o.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (o *OpenStoryRequest) String() string { - if o == nil { - return "OpenStoryRequest(nil)" - } - type Alias OpenStoryRequest - return fmt.Sprintf("OpenStoryRequest%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*OpenStoryRequest) TypeID() uint32 { - return OpenStoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*OpenStoryRequest) TypeName() string { - return "openStory" -} - -// TypeInfo returns info about TL type. -func (o *OpenStoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "openStory", - ID: OpenStoryRequestTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (o *OpenStoryRequest) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode openStory#ceda7c7d as nil") - } - b.PutID(OpenStoryRequestTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *OpenStoryRequest) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode openStory#ceda7c7d as nil") - } - b.PutInt53(o.StorySenderChatID) - b.PutInt32(o.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (o *OpenStoryRequest) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode openStory#ceda7c7d to nil") - } - if err := b.ConsumeID(OpenStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode openStory#ceda7c7d: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *OpenStoryRequest) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode openStory#ceda7c7d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openStory#ceda7c7d: field story_sender_chat_id: %w", err) - } - o.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode openStory#ceda7c7d: field story_id: %w", err) - } - o.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *OpenStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode openStory#ceda7c7d as nil") - } - b.ObjStart() - b.PutID("openStory") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(o.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(o.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *OpenStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode openStory#ceda7c7d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("openStory"); err != nil { - return fmt.Errorf("unable to decode openStory#ceda7c7d: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openStory#ceda7c7d: field story_sender_chat_id: %w", err) - } - o.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode openStory#ceda7c7d: field story_id: %w", err) - } - o.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (o *OpenStoryRequest) GetStorySenderChatID() (value int64) { - if o == nil { - return - } - return o.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (o *OpenStoryRequest) GetStoryID() (value int32) { - if o == nil { - return - } - return o.StoryID -} - -// OpenStory invokes method openStory#ceda7c7d returning error if any. -func (c *Client) OpenStory(ctx context.Context, request *OpenStoryRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_open_web_app_gen.go b/tdapi/tl_open_web_app_gen.go deleted file mode 100644 index f69b6d308..000000000 --- a/tdapi/tl_open_web_app_gen.go +++ /dev/null @@ -1,386 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// OpenWebAppRequest represents TL type `openWebApp#278173a2`. -type OpenWebAppRequest struct { - // Identifier of the chat in which the Web App is opened. The Web App can't be opened in - // secret chats - ChatID int64 - // Identifier of the bot, providing the Web App - BotUserID int64 - // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an - // internalLinkTypeAttachmentMenuBot link, or an empty string otherwise - URL string - // If not 0, the message thread identifier in which the message will be sent - MessageThreadID int64 - // Information about the message or story to be replied in the message sent by the Web - // App; pass null if none - ReplyTo InputMessageReplyToClass - // Parameters to use to open the Web App - Parameters WebAppOpenParameters -} - -// OpenWebAppRequestTypeID is TL type id of OpenWebAppRequest. -const OpenWebAppRequestTypeID = 0x278173a2 - -// Ensuring interfaces in compile-time for OpenWebAppRequest. -var ( - _ bin.Encoder = &OpenWebAppRequest{} - _ bin.Decoder = &OpenWebAppRequest{} - _ bin.BareEncoder = &OpenWebAppRequest{} - _ bin.BareDecoder = &OpenWebAppRequest{} -) - -func (o *OpenWebAppRequest) Zero() bool { - if o == nil { - return true - } - if !(o.ChatID == 0) { - return false - } - if !(o.BotUserID == 0) { - return false - } - if !(o.URL == "") { - return false - } - if !(o.MessageThreadID == 0) { - return false - } - if !(o.ReplyTo == nil) { - return false - } - if !(o.Parameters.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (o *OpenWebAppRequest) String() string { - if o == nil { - return "OpenWebAppRequest(nil)" - } - type Alias OpenWebAppRequest - return fmt.Sprintf("OpenWebAppRequest%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*OpenWebAppRequest) TypeID() uint32 { - return OpenWebAppRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*OpenWebAppRequest) TypeName() string { - return "openWebApp" -} - -// TypeInfo returns info about TL type. -func (o *OpenWebAppRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "openWebApp", - ID: OpenWebAppRequestTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "ReplyTo", - SchemaName: "reply_to", - }, - { - Name: "Parameters", - SchemaName: "parameters", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (o *OpenWebAppRequest) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode openWebApp#278173a2 as nil") - } - b.PutID(OpenWebAppRequestTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *OpenWebAppRequest) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode openWebApp#278173a2 as nil") - } - b.PutInt53(o.ChatID) - b.PutInt53(o.BotUserID) - b.PutString(o.URL) - b.PutInt53(o.MessageThreadID) - if o.ReplyTo == nil { - return fmt.Errorf("unable to encode openWebApp#278173a2: field reply_to is nil") - } - if err := o.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode openWebApp#278173a2: field reply_to: %w", err) - } - if err := o.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode openWebApp#278173a2: field parameters: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (o *OpenWebAppRequest) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode openWebApp#278173a2 to nil") - } - if err := b.ConsumeID(OpenWebAppRequestTypeID); err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *OpenWebAppRequest) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode openWebApp#278173a2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field chat_id: %w", err) - } - o.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field bot_user_id: %w", err) - } - o.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field url: %w", err) - } - o.URL = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field message_thread_id: %w", err) - } - o.MessageThreadID = value - } - { - value, err := DecodeInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field reply_to: %w", err) - } - o.ReplyTo = value - } - { - if err := o.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field parameters: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *OpenWebAppRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode openWebApp#278173a2 as nil") - } - b.ObjStart() - b.PutID("openWebApp") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(o.ChatID) - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(o.BotUserID) - b.Comma() - b.FieldStart("url") - b.PutString(o.URL) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(o.MessageThreadID) - b.Comma() - b.FieldStart("reply_to") - if o.ReplyTo == nil { - return fmt.Errorf("unable to encode openWebApp#278173a2: field reply_to is nil") - } - if err := o.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode openWebApp#278173a2: field reply_to: %w", err) - } - b.Comma() - b.FieldStart("parameters") - if err := o.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode openWebApp#278173a2: field parameters: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *OpenWebAppRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode openWebApp#278173a2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("openWebApp"); err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field chat_id: %w", err) - } - o.ChatID = value - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field bot_user_id: %w", err) - } - o.BotUserID = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field url: %w", err) - } - o.URL = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field message_thread_id: %w", err) - } - o.MessageThreadID = value - case "reply_to": - value, err := DecodeTDLibJSONInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field reply_to: %w", err) - } - o.ReplyTo = value - case "parameters": - if err := o.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode openWebApp#278173a2: field parameters: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (o *OpenWebAppRequest) GetChatID() (value int64) { - if o == nil { - return - } - return o.ChatID -} - -// GetBotUserID returns value of BotUserID field. -func (o *OpenWebAppRequest) GetBotUserID() (value int64) { - if o == nil { - return - } - return o.BotUserID -} - -// GetURL returns value of URL field. -func (o *OpenWebAppRequest) GetURL() (value string) { - if o == nil { - return - } - return o.URL -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (o *OpenWebAppRequest) GetMessageThreadID() (value int64) { - if o == nil { - return - } - return o.MessageThreadID -} - -// GetReplyTo returns value of ReplyTo field. -func (o *OpenWebAppRequest) GetReplyTo() (value InputMessageReplyToClass) { - if o == nil { - return - } - return o.ReplyTo -} - -// GetParameters returns value of Parameters field. -func (o *OpenWebAppRequest) GetParameters() (value WebAppOpenParameters) { - if o == nil { - return - } - return o.Parameters -} - -// OpenWebApp invokes method openWebApp#278173a2 returning error if any. -func (c *Client) OpenWebApp(ctx context.Context, request *OpenWebAppRequest) (*WebAppInfo, error) { - var result WebAppInfo - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_optimize_storage_gen.go b/tdapi/tl_optimize_storage_gen.go deleted file mode 100644 index dac9d5263..000000000 --- a/tdapi/tl_optimize_storage_gen.go +++ /dev/null @@ -1,564 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// OptimizeStorageRequest represents TL type `optimizeStorage#ef73c8c5`. -type OptimizeStorageRequest struct { - // Limit on the total size of files after deletion, in bytes. Pass -1 to use the default - // limit - Size int64 - // Limit on the time that has passed since the last time a file was accessed (or creation - // time for some filesystems). Pass -1 to use the default limit - TTL int32 - // Limit on the total number of files after deletion. Pass -1 to use the default limit - Count int32 - // The amount of time after the creation of a file during which it can't be deleted, in - // seconds. Pass -1 to use the default value - ImmunityDelay int32 - // If non-empty, only files with the given types are considered. By default, all types - // except thumbnails, profile photos, stickers and wallpapers are deleted - FileTypes []FileTypeClass - // If non-empty, only files from the given chats are considered. Use 0 as chat identifier - // to delete files not belonging to any chat (e.g., profile photos) - ChatIDs []int64 - // If non-empty, files from the given chats are excluded. Use 0 as chat identifier to - // exclude all files not belonging to any chat (e.g., profile photos) - ExcludeChatIDs []int64 - // Pass true if statistics about the files that were deleted must be returned instead of - // the whole storage usage statistics. Affects only returned statistics - ReturnDeletedFileStatistics bool - // Same as in getStorageStatistics. Affects only returned statistics - ChatLimit int32 -} - -// OptimizeStorageRequestTypeID is TL type id of OptimizeStorageRequest. -const OptimizeStorageRequestTypeID = 0xef73c8c5 - -// Ensuring interfaces in compile-time for OptimizeStorageRequest. -var ( - _ bin.Encoder = &OptimizeStorageRequest{} - _ bin.Decoder = &OptimizeStorageRequest{} - _ bin.BareEncoder = &OptimizeStorageRequest{} - _ bin.BareDecoder = &OptimizeStorageRequest{} -) - -func (o *OptimizeStorageRequest) Zero() bool { - if o == nil { - return true - } - if !(o.Size == 0) { - return false - } - if !(o.TTL == 0) { - return false - } - if !(o.Count == 0) { - return false - } - if !(o.ImmunityDelay == 0) { - return false - } - if !(o.FileTypes == nil) { - return false - } - if !(o.ChatIDs == nil) { - return false - } - if !(o.ExcludeChatIDs == nil) { - return false - } - if !(o.ReturnDeletedFileStatistics == false) { - return false - } - if !(o.ChatLimit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (o *OptimizeStorageRequest) String() string { - if o == nil { - return "OptimizeStorageRequest(nil)" - } - type Alias OptimizeStorageRequest - return fmt.Sprintf("OptimizeStorageRequest%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*OptimizeStorageRequest) TypeID() uint32 { - return OptimizeStorageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*OptimizeStorageRequest) TypeName() string { - return "optimizeStorage" -} - -// TypeInfo returns info about TL type. -func (o *OptimizeStorageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "optimizeStorage", - ID: OptimizeStorageRequestTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Size", - SchemaName: "size", - }, - { - Name: "TTL", - SchemaName: "ttl", - }, - { - Name: "Count", - SchemaName: "count", - }, - { - Name: "ImmunityDelay", - SchemaName: "immunity_delay", - }, - { - Name: "FileTypes", - SchemaName: "file_types", - }, - { - Name: "ChatIDs", - SchemaName: "chat_ids", - }, - { - Name: "ExcludeChatIDs", - SchemaName: "exclude_chat_ids", - }, - { - Name: "ReturnDeletedFileStatistics", - SchemaName: "return_deleted_file_statistics", - }, - { - Name: "ChatLimit", - SchemaName: "chat_limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (o *OptimizeStorageRequest) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode optimizeStorage#ef73c8c5 as nil") - } - b.PutID(OptimizeStorageRequestTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *OptimizeStorageRequest) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode optimizeStorage#ef73c8c5 as nil") - } - b.PutInt53(o.Size) - b.PutInt32(o.TTL) - b.PutInt32(o.Count) - b.PutInt32(o.ImmunityDelay) - b.PutInt(len(o.FileTypes)) - for idx, v := range o.FileTypes { - if v == nil { - return fmt.Errorf("unable to encode optimizeStorage#ef73c8c5: field file_types element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare optimizeStorage#ef73c8c5: field file_types element with index %d: %w", idx, err) - } - } - b.PutInt(len(o.ChatIDs)) - for _, v := range o.ChatIDs { - b.PutInt53(v) - } - b.PutInt(len(o.ExcludeChatIDs)) - for _, v := range o.ExcludeChatIDs { - b.PutInt53(v) - } - b.PutBool(o.ReturnDeletedFileStatistics) - b.PutInt32(o.ChatLimit) - return nil -} - -// Decode implements bin.Decoder. -func (o *OptimizeStorageRequest) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode optimizeStorage#ef73c8c5 to nil") - } - if err := b.ConsumeID(OptimizeStorageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *OptimizeStorageRequest) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode optimizeStorage#ef73c8c5 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field size: %w", err) - } - o.Size = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field ttl: %w", err) - } - o.TTL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field count: %w", err) - } - o.Count = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field immunity_delay: %w", err) - } - o.ImmunityDelay = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field file_types: %w", err) - } - - if headerLen > 0 { - o.FileTypes = make([]FileTypeClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeFileType(b) - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field file_types: %w", err) - } - o.FileTypes = append(o.FileTypes, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field chat_ids: %w", err) - } - - if headerLen > 0 { - o.ChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field chat_ids: %w", err) - } - o.ChatIDs = append(o.ChatIDs, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field exclude_chat_ids: %w", err) - } - - if headerLen > 0 { - o.ExcludeChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field exclude_chat_ids: %w", err) - } - o.ExcludeChatIDs = append(o.ExcludeChatIDs, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field return_deleted_file_statistics: %w", err) - } - o.ReturnDeletedFileStatistics = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field chat_limit: %w", err) - } - o.ChatLimit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *OptimizeStorageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode optimizeStorage#ef73c8c5 as nil") - } - b.ObjStart() - b.PutID("optimizeStorage") - b.Comma() - b.FieldStart("size") - b.PutInt53(o.Size) - b.Comma() - b.FieldStart("ttl") - b.PutInt32(o.TTL) - b.Comma() - b.FieldStart("count") - b.PutInt32(o.Count) - b.Comma() - b.FieldStart("immunity_delay") - b.PutInt32(o.ImmunityDelay) - b.Comma() - b.FieldStart("file_types") - b.ArrStart() - for idx, v := range o.FileTypes { - if v == nil { - return fmt.Errorf("unable to encode optimizeStorage#ef73c8c5: field file_types element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode optimizeStorage#ef73c8c5: field file_types element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("chat_ids") - b.ArrStart() - for _, v := range o.ChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("exclude_chat_ids") - b.ArrStart() - for _, v := range o.ExcludeChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("return_deleted_file_statistics") - b.PutBool(o.ReturnDeletedFileStatistics) - b.Comma() - b.FieldStart("chat_limit") - b.PutInt32(o.ChatLimit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *OptimizeStorageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode optimizeStorage#ef73c8c5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("optimizeStorage"); err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: %w", err) - } - case "size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field size: %w", err) - } - o.Size = value - case "ttl": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field ttl: %w", err) - } - o.TTL = value - case "count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field count: %w", err) - } - o.Count = value - case "immunity_delay": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field immunity_delay: %w", err) - } - o.ImmunityDelay = value - case "file_types": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONFileType(b) - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field file_types: %w", err) - } - o.FileTypes = append(o.FileTypes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field file_types: %w", err) - } - case "chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field chat_ids: %w", err) - } - o.ChatIDs = append(o.ChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field chat_ids: %w", err) - } - case "exclude_chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field exclude_chat_ids: %w", err) - } - o.ExcludeChatIDs = append(o.ExcludeChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field exclude_chat_ids: %w", err) - } - case "return_deleted_file_statistics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field return_deleted_file_statistics: %w", err) - } - o.ReturnDeletedFileStatistics = value - case "chat_limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode optimizeStorage#ef73c8c5: field chat_limit: %w", err) - } - o.ChatLimit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSize returns value of Size field. -func (o *OptimizeStorageRequest) GetSize() (value int64) { - if o == nil { - return - } - return o.Size -} - -// GetTTL returns value of TTL field. -func (o *OptimizeStorageRequest) GetTTL() (value int32) { - if o == nil { - return - } - return o.TTL -} - -// GetCount returns value of Count field. -func (o *OptimizeStorageRequest) GetCount() (value int32) { - if o == nil { - return - } - return o.Count -} - -// GetImmunityDelay returns value of ImmunityDelay field. -func (o *OptimizeStorageRequest) GetImmunityDelay() (value int32) { - if o == nil { - return - } - return o.ImmunityDelay -} - -// GetFileTypes returns value of FileTypes field. -func (o *OptimizeStorageRequest) GetFileTypes() (value []FileTypeClass) { - if o == nil { - return - } - return o.FileTypes -} - -// GetChatIDs returns value of ChatIDs field. -func (o *OptimizeStorageRequest) GetChatIDs() (value []int64) { - if o == nil { - return - } - return o.ChatIDs -} - -// GetExcludeChatIDs returns value of ExcludeChatIDs field. -func (o *OptimizeStorageRequest) GetExcludeChatIDs() (value []int64) { - if o == nil { - return - } - return o.ExcludeChatIDs -} - -// GetReturnDeletedFileStatistics returns value of ReturnDeletedFileStatistics field. -func (o *OptimizeStorageRequest) GetReturnDeletedFileStatistics() (value bool) { - if o == nil { - return - } - return o.ReturnDeletedFileStatistics -} - -// GetChatLimit returns value of ChatLimit field. -func (o *OptimizeStorageRequest) GetChatLimit() (value int32) { - if o == nil { - return - } - return o.ChatLimit -} - -// OptimizeStorage invokes method optimizeStorage#ef73c8c5 returning error if any. -func (c *Client) OptimizeStorage(ctx context.Context, request *OptimizeStorageRequest) (*StorageStatistics, error) { - var result StorageStatistics - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_option_value_gen.go b/tdapi/tl_option_value_gen.go deleted file mode 100644 index 997caaf7d..000000000 --- a/tdapi/tl_option_value_gen.go +++ /dev/null @@ -1,828 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// OptionValueBoolean represents TL type `optionValueBoolean#3c35f1e`. -type OptionValueBoolean struct { - // The value of the option - Value bool -} - -// OptionValueBooleanTypeID is TL type id of OptionValueBoolean. -const OptionValueBooleanTypeID = 0x3c35f1e - -// construct implements constructor of OptionValueClass. -func (o OptionValueBoolean) construct() OptionValueClass { return &o } - -// Ensuring interfaces in compile-time for OptionValueBoolean. -var ( - _ bin.Encoder = &OptionValueBoolean{} - _ bin.Decoder = &OptionValueBoolean{} - _ bin.BareEncoder = &OptionValueBoolean{} - _ bin.BareDecoder = &OptionValueBoolean{} - - _ OptionValueClass = &OptionValueBoolean{} -) - -func (o *OptionValueBoolean) Zero() bool { - if o == nil { - return true - } - if !(o.Value == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (o *OptionValueBoolean) String() string { - if o == nil { - return "OptionValueBoolean(nil)" - } - type Alias OptionValueBoolean - return fmt.Sprintf("OptionValueBoolean%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*OptionValueBoolean) TypeID() uint32 { - return OptionValueBooleanTypeID -} - -// TypeName returns name of type in TL schema. -func (*OptionValueBoolean) TypeName() string { - return "optionValueBoolean" -} - -// TypeInfo returns info about TL type. -func (o *OptionValueBoolean) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "optionValueBoolean", - ID: OptionValueBooleanTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (o *OptionValueBoolean) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode optionValueBoolean#3c35f1e as nil") - } - b.PutID(OptionValueBooleanTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *OptionValueBoolean) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode optionValueBoolean#3c35f1e as nil") - } - b.PutBool(o.Value) - return nil -} - -// Decode implements bin.Decoder. -func (o *OptionValueBoolean) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode optionValueBoolean#3c35f1e to nil") - } - if err := b.ConsumeID(OptionValueBooleanTypeID); err != nil { - return fmt.Errorf("unable to decode optionValueBoolean#3c35f1e: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *OptionValueBoolean) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode optionValueBoolean#3c35f1e to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode optionValueBoolean#3c35f1e: field value: %w", err) - } - o.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *OptionValueBoolean) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode optionValueBoolean#3c35f1e as nil") - } - b.ObjStart() - b.PutID("optionValueBoolean") - b.Comma() - b.FieldStart("value") - b.PutBool(o.Value) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *OptionValueBoolean) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode optionValueBoolean#3c35f1e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("optionValueBoolean"); err != nil { - return fmt.Errorf("unable to decode optionValueBoolean#3c35f1e: %w", err) - } - case "value": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode optionValueBoolean#3c35f1e: field value: %w", err) - } - o.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (o *OptionValueBoolean) GetValue() (value bool) { - if o == nil { - return - } - return o.Value -} - -// OptionValueEmpty represents TL type `optionValueEmpty#36c62493`. -type OptionValueEmpty struct { -} - -// OptionValueEmptyTypeID is TL type id of OptionValueEmpty. -const OptionValueEmptyTypeID = 0x36c62493 - -// construct implements constructor of OptionValueClass. -func (o OptionValueEmpty) construct() OptionValueClass { return &o } - -// Ensuring interfaces in compile-time for OptionValueEmpty. -var ( - _ bin.Encoder = &OptionValueEmpty{} - _ bin.Decoder = &OptionValueEmpty{} - _ bin.BareEncoder = &OptionValueEmpty{} - _ bin.BareDecoder = &OptionValueEmpty{} - - _ OptionValueClass = &OptionValueEmpty{} -) - -func (o *OptionValueEmpty) Zero() bool { - if o == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (o *OptionValueEmpty) String() string { - if o == nil { - return "OptionValueEmpty(nil)" - } - type Alias OptionValueEmpty - return fmt.Sprintf("OptionValueEmpty%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*OptionValueEmpty) TypeID() uint32 { - return OptionValueEmptyTypeID -} - -// TypeName returns name of type in TL schema. -func (*OptionValueEmpty) TypeName() string { - return "optionValueEmpty" -} - -// TypeInfo returns info about TL type. -func (o *OptionValueEmpty) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "optionValueEmpty", - ID: OptionValueEmptyTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (o *OptionValueEmpty) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode optionValueEmpty#36c62493 as nil") - } - b.PutID(OptionValueEmptyTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *OptionValueEmpty) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode optionValueEmpty#36c62493 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (o *OptionValueEmpty) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode optionValueEmpty#36c62493 to nil") - } - if err := b.ConsumeID(OptionValueEmptyTypeID); err != nil { - return fmt.Errorf("unable to decode optionValueEmpty#36c62493: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *OptionValueEmpty) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode optionValueEmpty#36c62493 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *OptionValueEmpty) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode optionValueEmpty#36c62493 as nil") - } - b.ObjStart() - b.PutID("optionValueEmpty") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *OptionValueEmpty) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode optionValueEmpty#36c62493 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("optionValueEmpty"); err != nil { - return fmt.Errorf("unable to decode optionValueEmpty#36c62493: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// OptionValueInteger represents TL type `optionValueInteger#f4dcc2e4`. -type OptionValueInteger struct { - // The value of the option - Value int64 -} - -// OptionValueIntegerTypeID is TL type id of OptionValueInteger. -const OptionValueIntegerTypeID = 0xf4dcc2e4 - -// construct implements constructor of OptionValueClass. -func (o OptionValueInteger) construct() OptionValueClass { return &o } - -// Ensuring interfaces in compile-time for OptionValueInteger. -var ( - _ bin.Encoder = &OptionValueInteger{} - _ bin.Decoder = &OptionValueInteger{} - _ bin.BareEncoder = &OptionValueInteger{} - _ bin.BareDecoder = &OptionValueInteger{} - - _ OptionValueClass = &OptionValueInteger{} -) - -func (o *OptionValueInteger) Zero() bool { - if o == nil { - return true - } - if !(o.Value == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (o *OptionValueInteger) String() string { - if o == nil { - return "OptionValueInteger(nil)" - } - type Alias OptionValueInteger - return fmt.Sprintf("OptionValueInteger%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*OptionValueInteger) TypeID() uint32 { - return OptionValueIntegerTypeID -} - -// TypeName returns name of type in TL schema. -func (*OptionValueInteger) TypeName() string { - return "optionValueInteger" -} - -// TypeInfo returns info about TL type. -func (o *OptionValueInteger) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "optionValueInteger", - ID: OptionValueIntegerTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (o *OptionValueInteger) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode optionValueInteger#f4dcc2e4 as nil") - } - b.PutID(OptionValueIntegerTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *OptionValueInteger) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode optionValueInteger#f4dcc2e4 as nil") - } - b.PutLong(o.Value) - return nil -} - -// Decode implements bin.Decoder. -func (o *OptionValueInteger) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode optionValueInteger#f4dcc2e4 to nil") - } - if err := b.ConsumeID(OptionValueIntegerTypeID); err != nil { - return fmt.Errorf("unable to decode optionValueInteger#f4dcc2e4: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *OptionValueInteger) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode optionValueInteger#f4dcc2e4 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode optionValueInteger#f4dcc2e4: field value: %w", err) - } - o.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *OptionValueInteger) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode optionValueInteger#f4dcc2e4 as nil") - } - b.ObjStart() - b.PutID("optionValueInteger") - b.Comma() - b.FieldStart("value") - b.PutLong(o.Value) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *OptionValueInteger) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode optionValueInteger#f4dcc2e4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("optionValueInteger"); err != nil { - return fmt.Errorf("unable to decode optionValueInteger#f4dcc2e4: %w", err) - } - case "value": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode optionValueInteger#f4dcc2e4: field value: %w", err) - } - o.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (o *OptionValueInteger) GetValue() (value int64) { - if o == nil { - return - } - return o.Value -} - -// OptionValueString represents TL type `optionValueString#2d136e94`. -type OptionValueString struct { - // The value of the option - Value string -} - -// OptionValueStringTypeID is TL type id of OptionValueString. -const OptionValueStringTypeID = 0x2d136e94 - -// construct implements constructor of OptionValueClass. -func (o OptionValueString) construct() OptionValueClass { return &o } - -// Ensuring interfaces in compile-time for OptionValueString. -var ( - _ bin.Encoder = &OptionValueString{} - _ bin.Decoder = &OptionValueString{} - _ bin.BareEncoder = &OptionValueString{} - _ bin.BareDecoder = &OptionValueString{} - - _ OptionValueClass = &OptionValueString{} -) - -func (o *OptionValueString) Zero() bool { - if o == nil { - return true - } - if !(o.Value == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (o *OptionValueString) String() string { - if o == nil { - return "OptionValueString(nil)" - } - type Alias OptionValueString - return fmt.Sprintf("OptionValueString%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*OptionValueString) TypeID() uint32 { - return OptionValueStringTypeID -} - -// TypeName returns name of type in TL schema. -func (*OptionValueString) TypeName() string { - return "optionValueString" -} - -// TypeInfo returns info about TL type. -func (o *OptionValueString) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "optionValueString", - ID: OptionValueStringTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (o *OptionValueString) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode optionValueString#2d136e94 as nil") - } - b.PutID(OptionValueStringTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *OptionValueString) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode optionValueString#2d136e94 as nil") - } - b.PutString(o.Value) - return nil -} - -// Decode implements bin.Decoder. -func (o *OptionValueString) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode optionValueString#2d136e94 to nil") - } - if err := b.ConsumeID(OptionValueStringTypeID); err != nil { - return fmt.Errorf("unable to decode optionValueString#2d136e94: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *OptionValueString) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode optionValueString#2d136e94 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode optionValueString#2d136e94: field value: %w", err) - } - o.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *OptionValueString) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode optionValueString#2d136e94 as nil") - } - b.ObjStart() - b.PutID("optionValueString") - b.Comma() - b.FieldStart("value") - b.PutString(o.Value) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *OptionValueString) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode optionValueString#2d136e94 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("optionValueString"); err != nil { - return fmt.Errorf("unable to decode optionValueString#2d136e94: %w", err) - } - case "value": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode optionValueString#2d136e94: field value: %w", err) - } - o.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (o *OptionValueString) GetValue() (value string) { - if o == nil { - return - } - return o.Value -} - -// OptionValueClassName is schema name of OptionValueClass. -const OptionValueClassName = "OptionValue" - -// OptionValueClass represents OptionValue generic type. -// -// Example: -// -// g, err := tdapi.DecodeOptionValue(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.OptionValueBoolean: // optionValueBoolean#3c35f1e -// case *tdapi.OptionValueEmpty: // optionValueEmpty#36c62493 -// case *tdapi.OptionValueInteger: // optionValueInteger#f4dcc2e4 -// case *tdapi.OptionValueString: // optionValueString#2d136e94 -// default: panic(v) -// } -type OptionValueClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() OptionValueClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeOptionValue implements binary de-serialization for OptionValueClass. -func DecodeOptionValue(buf *bin.Buffer) (OptionValueClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case OptionValueBooleanTypeID: - // Decoding optionValueBoolean#3c35f1e. - v := OptionValueBoolean{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode OptionValueClass: %w", err) - } - return &v, nil - case OptionValueEmptyTypeID: - // Decoding optionValueEmpty#36c62493. - v := OptionValueEmpty{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode OptionValueClass: %w", err) - } - return &v, nil - case OptionValueIntegerTypeID: - // Decoding optionValueInteger#f4dcc2e4. - v := OptionValueInteger{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode OptionValueClass: %w", err) - } - return &v, nil - case OptionValueStringTypeID: - // Decoding optionValueString#2d136e94. - v := OptionValueString{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode OptionValueClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode OptionValueClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONOptionValue implements binary de-serialization for OptionValueClass. -func DecodeTDLibJSONOptionValue(buf tdjson.Decoder) (OptionValueClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "optionValueBoolean": - // Decoding optionValueBoolean#3c35f1e. - v := OptionValueBoolean{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode OptionValueClass: %w", err) - } - return &v, nil - case "optionValueEmpty": - // Decoding optionValueEmpty#36c62493. - v := OptionValueEmpty{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode OptionValueClass: %w", err) - } - return &v, nil - case "optionValueInteger": - // Decoding optionValueInteger#f4dcc2e4. - v := OptionValueInteger{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode OptionValueClass: %w", err) - } - return &v, nil - case "optionValueString": - // Decoding optionValueString#2d136e94. - v := OptionValueString{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode OptionValueClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode OptionValueClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// OptionValue boxes the OptionValueClass providing a helper. -type OptionValueBox struct { - OptionValue OptionValueClass -} - -// Decode implements bin.Decoder for OptionValueBox. -func (b *OptionValueBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode OptionValueBox to nil") - } - v, err := DecodeOptionValue(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.OptionValue = v - return nil -} - -// Encode implements bin.Encode for OptionValueBox. -func (b *OptionValueBox) Encode(buf *bin.Buffer) error { - if b == nil || b.OptionValue == nil { - return fmt.Errorf("unable to encode OptionValueClass as nil") - } - return b.OptionValue.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for OptionValueBox. -func (b *OptionValueBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode OptionValueBox to nil") - } - v, err := DecodeTDLibJSONOptionValue(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.OptionValue = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for OptionValueBox. -func (b *OptionValueBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.OptionValue == nil { - return fmt.Errorf("unable to encode OptionValueClass as nil") - } - return b.OptionValue.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_order_info_gen.go b/tdapi/tl_order_info_gen.go deleted file mode 100644 index 3ce99894b..000000000 --- a/tdapi/tl_order_info_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// OrderInfo represents TL type `orderInfo#2ebad96e`. -type OrderInfo struct { - // Name of the user - Name string - // Phone number of the user - PhoneNumber string - // Email address of the user - EmailAddress string - // Shipping address for this order; may be null - ShippingAddress Address -} - -// OrderInfoTypeID is TL type id of OrderInfo. -const OrderInfoTypeID = 0x2ebad96e - -// Ensuring interfaces in compile-time for OrderInfo. -var ( - _ bin.Encoder = &OrderInfo{} - _ bin.Decoder = &OrderInfo{} - _ bin.BareEncoder = &OrderInfo{} - _ bin.BareDecoder = &OrderInfo{} -) - -func (o *OrderInfo) Zero() bool { - if o == nil { - return true - } - if !(o.Name == "") { - return false - } - if !(o.PhoneNumber == "") { - return false - } - if !(o.EmailAddress == "") { - return false - } - if !(o.ShippingAddress.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (o *OrderInfo) String() string { - if o == nil { - return "OrderInfo(nil)" - } - type Alias OrderInfo - return fmt.Sprintf("OrderInfo%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*OrderInfo) TypeID() uint32 { - return OrderInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*OrderInfo) TypeName() string { - return "orderInfo" -} - -// TypeInfo returns info about TL type. -func (o *OrderInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "orderInfo", - ID: OrderInfoTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - { - Name: "EmailAddress", - SchemaName: "email_address", - }, - { - Name: "ShippingAddress", - SchemaName: "shipping_address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (o *OrderInfo) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode orderInfo#2ebad96e as nil") - } - b.PutID(OrderInfoTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *OrderInfo) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode orderInfo#2ebad96e as nil") - } - b.PutString(o.Name) - b.PutString(o.PhoneNumber) - b.PutString(o.EmailAddress) - if err := o.ShippingAddress.Encode(b); err != nil { - return fmt.Errorf("unable to encode orderInfo#2ebad96e: field shipping_address: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (o *OrderInfo) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode orderInfo#2ebad96e to nil") - } - if err := b.ConsumeID(OrderInfoTypeID); err != nil { - return fmt.Errorf("unable to decode orderInfo#2ebad96e: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *OrderInfo) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode orderInfo#2ebad96e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode orderInfo#2ebad96e: field name: %w", err) - } - o.Name = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode orderInfo#2ebad96e: field phone_number: %w", err) - } - o.PhoneNumber = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode orderInfo#2ebad96e: field email_address: %w", err) - } - o.EmailAddress = value - } - { - if err := o.ShippingAddress.Decode(b); err != nil { - return fmt.Errorf("unable to decode orderInfo#2ebad96e: field shipping_address: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *OrderInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode orderInfo#2ebad96e as nil") - } - b.ObjStart() - b.PutID("orderInfo") - b.Comma() - b.FieldStart("name") - b.PutString(o.Name) - b.Comma() - b.FieldStart("phone_number") - b.PutString(o.PhoneNumber) - b.Comma() - b.FieldStart("email_address") - b.PutString(o.EmailAddress) - b.Comma() - b.FieldStart("shipping_address") - if err := o.ShippingAddress.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode orderInfo#2ebad96e: field shipping_address: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *OrderInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode orderInfo#2ebad96e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("orderInfo"); err != nil { - return fmt.Errorf("unable to decode orderInfo#2ebad96e: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode orderInfo#2ebad96e: field name: %w", err) - } - o.Name = value - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode orderInfo#2ebad96e: field phone_number: %w", err) - } - o.PhoneNumber = value - case "email_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode orderInfo#2ebad96e: field email_address: %w", err) - } - o.EmailAddress = value - case "shipping_address": - if err := o.ShippingAddress.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode orderInfo#2ebad96e: field shipping_address: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (o *OrderInfo) GetName() (value string) { - if o == nil { - return - } - return o.Name -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (o *OrderInfo) GetPhoneNumber() (value string) { - if o == nil { - return - } - return o.PhoneNumber -} - -// GetEmailAddress returns value of EmailAddress field. -func (o *OrderInfo) GetEmailAddress() (value string) { - if o == nil { - return - } - return o.EmailAddress -} - -// GetShippingAddress returns value of ShippingAddress field. -func (o *OrderInfo) GetShippingAddress() (value Address) { - if o == nil { - return - } - return o.ShippingAddress -} diff --git a/tdapi/tl_outline_gen.go b/tdapi/tl_outline_gen.go deleted file mode 100644 index 81fd8e260..000000000 --- a/tdapi/tl_outline_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Outline represents TL type `outline#7d2ec0be`. -type Outline struct { - // The list of closed vector paths - Paths []ClosedVectorPath -} - -// OutlineTypeID is TL type id of Outline. -const OutlineTypeID = 0x7d2ec0be - -// Ensuring interfaces in compile-time for Outline. -var ( - _ bin.Encoder = &Outline{} - _ bin.Decoder = &Outline{} - _ bin.BareEncoder = &Outline{} - _ bin.BareDecoder = &Outline{} -) - -func (o *Outline) Zero() bool { - if o == nil { - return true - } - if !(o.Paths == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (o *Outline) String() string { - if o == nil { - return "Outline(nil)" - } - type Alias Outline - return fmt.Sprintf("Outline%+v", Alias(*o)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Outline) TypeID() uint32 { - return OutlineTypeID -} - -// TypeName returns name of type in TL schema. -func (*Outline) TypeName() string { - return "outline" -} - -// TypeInfo returns info about TL type. -func (o *Outline) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "outline", - ID: OutlineTypeID, - } - if o == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Paths", - SchemaName: "paths", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (o *Outline) Encode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode outline#7d2ec0be as nil") - } - b.PutID(OutlineTypeID) - return o.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (o *Outline) EncodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't encode outline#7d2ec0be as nil") - } - b.PutInt(len(o.Paths)) - for idx, v := range o.Paths { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare outline#7d2ec0be: field paths element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (o *Outline) Decode(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode outline#7d2ec0be to nil") - } - if err := b.ConsumeID(OutlineTypeID); err != nil { - return fmt.Errorf("unable to decode outline#7d2ec0be: %w", err) - } - return o.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (o *Outline) DecodeBare(b *bin.Buffer) error { - if o == nil { - return fmt.Errorf("can't decode outline#7d2ec0be to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode outline#7d2ec0be: field paths: %w", err) - } - - if headerLen > 0 { - o.Paths = make([]ClosedVectorPath, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ClosedVectorPath - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare outline#7d2ec0be: field paths: %w", err) - } - o.Paths = append(o.Paths, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (o *Outline) EncodeTDLibJSON(b tdjson.Encoder) error { - if o == nil { - return fmt.Errorf("can't encode outline#7d2ec0be as nil") - } - b.ObjStart() - b.PutID("outline") - b.Comma() - b.FieldStart("paths") - b.ArrStart() - for idx, v := range o.Paths { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode outline#7d2ec0be: field paths element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (o *Outline) DecodeTDLibJSON(b tdjson.Decoder) error { - if o == nil { - return fmt.Errorf("can't decode outline#7d2ec0be to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("outline"); err != nil { - return fmt.Errorf("unable to decode outline#7d2ec0be: %w", err) - } - case "paths": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ClosedVectorPath - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode outline#7d2ec0be: field paths: %w", err) - } - o.Paths = append(o.Paths, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode outline#7d2ec0be: field paths: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPaths returns value of Paths field. -func (o *Outline) GetPaths() (value []ClosedVectorPath) { - if o == nil { - return - } - return o.Paths -} diff --git a/tdapi/tl_page_block_caption_gen.go b/tdapi/tl_page_block_caption_gen.go deleted file mode 100644 index 29739e345..000000000 --- a/tdapi/tl_page_block_caption_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PageBlockCaption represents TL type `pageBlockCaption#b9a9a476`. -type PageBlockCaption struct { - // Content of the caption - Text RichTextClass - // Block credit (like HTML tag ) - Credit RichTextClass -} - -// PageBlockCaptionTypeID is TL type id of PageBlockCaption. -const PageBlockCaptionTypeID = 0xb9a9a476 - -// Ensuring interfaces in compile-time for PageBlockCaption. -var ( - _ bin.Encoder = &PageBlockCaption{} - _ bin.Decoder = &PageBlockCaption{} - _ bin.BareEncoder = &PageBlockCaption{} - _ bin.BareDecoder = &PageBlockCaption{} -) - -func (p *PageBlockCaption) Zero() bool { - if p == nil { - return true - } - if !(p.Text == nil) { - return false - } - if !(p.Credit == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockCaption) String() string { - if p == nil { - return "PageBlockCaption(nil)" - } - type Alias PageBlockCaption - return fmt.Sprintf("PageBlockCaption%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockCaption) TypeID() uint32 { - return PageBlockCaptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockCaption) TypeName() string { - return "pageBlockCaption" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockCaption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockCaption", - ID: PageBlockCaptionTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Credit", - SchemaName: "credit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockCaption) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockCaption#b9a9a476 as nil") - } - b.PutID(PageBlockCaptionTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockCaption) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockCaption#b9a9a476 as nil") - } - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockCaption#b9a9a476: field text is nil") - } - if err := p.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockCaption#b9a9a476: field text: %w", err) - } - if p.Credit == nil { - return fmt.Errorf("unable to encode pageBlockCaption#b9a9a476: field credit is nil") - } - if err := p.Credit.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockCaption#b9a9a476: field credit: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockCaption) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockCaption#b9a9a476 to nil") - } - if err := b.ConsumeID(PageBlockCaptionTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockCaption#b9a9a476: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockCaption) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockCaption#b9a9a476 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockCaption#b9a9a476: field text: %w", err) - } - p.Text = value - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockCaption#b9a9a476: field credit: %w", err) - } - p.Credit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockCaption) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockCaption#b9a9a476 as nil") - } - b.ObjStart() - b.PutID("pageBlockCaption") - b.Comma() - b.FieldStart("text") - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockCaption#b9a9a476: field text is nil") - } - if err := p.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockCaption#b9a9a476: field text: %w", err) - } - b.Comma() - b.FieldStart("credit") - if p.Credit == nil { - return fmt.Errorf("unable to encode pageBlockCaption#b9a9a476: field credit is nil") - } - if err := p.Credit.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockCaption#b9a9a476: field credit: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockCaption) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockCaption#b9a9a476 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockCaption"); err != nil { - return fmt.Errorf("unable to decode pageBlockCaption#b9a9a476: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockCaption#b9a9a476: field text: %w", err) - } - p.Text = value - case "credit": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockCaption#b9a9a476: field credit: %w", err) - } - p.Credit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (p *PageBlockCaption) GetText() (value RichTextClass) { - if p == nil { - return - } - return p.Text -} - -// GetCredit returns value of Credit field. -func (p *PageBlockCaption) GetCredit() (value RichTextClass) { - if p == nil { - return - } - return p.Credit -} diff --git a/tdapi/tl_page_block_gen.go b/tdapi/tl_page_block_gen.go deleted file mode 100644 index 22d60d66c..000000000 --- a/tdapi/tl_page_block_gen.go +++ /dev/null @@ -1,7131 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PageBlockTitle represents TL type `pageBlockTitle#6122b610`. -type PageBlockTitle struct { - // Title - Title RichTextClass -} - -// PageBlockTitleTypeID is TL type id of PageBlockTitle. -const PageBlockTitleTypeID = 0x6122b610 - -// construct implements constructor of PageBlockClass. -func (p PageBlockTitle) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockTitle. -var ( - _ bin.Encoder = &PageBlockTitle{} - _ bin.Decoder = &PageBlockTitle{} - _ bin.BareEncoder = &PageBlockTitle{} - _ bin.BareDecoder = &PageBlockTitle{} - - _ PageBlockClass = &PageBlockTitle{} -) - -func (p *PageBlockTitle) Zero() bool { - if p == nil { - return true - } - if !(p.Title == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockTitle) String() string { - if p == nil { - return "PageBlockTitle(nil)" - } - type Alias PageBlockTitle - return fmt.Sprintf("PageBlockTitle%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockTitle) TypeID() uint32 { - return PageBlockTitleTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockTitle) TypeName() string { - return "pageBlockTitle" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockTitle) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockTitle", - ID: PageBlockTitleTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockTitle) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockTitle#6122b610 as nil") - } - b.PutID(PageBlockTitleTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockTitle) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockTitle#6122b610 as nil") - } - if p.Title == nil { - return fmt.Errorf("unable to encode pageBlockTitle#6122b610: field title is nil") - } - if err := p.Title.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockTitle#6122b610: field title: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockTitle) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockTitle#6122b610 to nil") - } - if err := b.ConsumeID(PageBlockTitleTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockTitle#6122b610: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockTitle) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockTitle#6122b610 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockTitle#6122b610: field title: %w", err) - } - p.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockTitle) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockTitle#6122b610 as nil") - } - b.ObjStart() - b.PutID("pageBlockTitle") - b.Comma() - b.FieldStart("title") - if p.Title == nil { - return fmt.Errorf("unable to encode pageBlockTitle#6122b610: field title is nil") - } - if err := p.Title.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockTitle#6122b610: field title: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockTitle) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockTitle#6122b610 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockTitle"); err != nil { - return fmt.Errorf("unable to decode pageBlockTitle#6122b610: %w", err) - } - case "title": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockTitle#6122b610: field title: %w", err) - } - p.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (p *PageBlockTitle) GetTitle() (value RichTextClass) { - if p == nil { - return - } - return p.Title -} - -// PageBlockSubtitle represents TL type `pageBlockSubtitle#fc451e7`. -type PageBlockSubtitle struct { - // Subtitle - Subtitle RichTextClass -} - -// PageBlockSubtitleTypeID is TL type id of PageBlockSubtitle. -const PageBlockSubtitleTypeID = 0xfc451e7 - -// construct implements constructor of PageBlockClass. -func (p PageBlockSubtitle) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockSubtitle. -var ( - _ bin.Encoder = &PageBlockSubtitle{} - _ bin.Decoder = &PageBlockSubtitle{} - _ bin.BareEncoder = &PageBlockSubtitle{} - _ bin.BareDecoder = &PageBlockSubtitle{} - - _ PageBlockClass = &PageBlockSubtitle{} -) - -func (p *PageBlockSubtitle) Zero() bool { - if p == nil { - return true - } - if !(p.Subtitle == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockSubtitle) String() string { - if p == nil { - return "PageBlockSubtitle(nil)" - } - type Alias PageBlockSubtitle - return fmt.Sprintf("PageBlockSubtitle%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockSubtitle) TypeID() uint32 { - return PageBlockSubtitleTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockSubtitle) TypeName() string { - return "pageBlockSubtitle" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockSubtitle) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockSubtitle", - ID: PageBlockSubtitleTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Subtitle", - SchemaName: "subtitle", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockSubtitle) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockSubtitle#fc451e7 as nil") - } - b.PutID(PageBlockSubtitleTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockSubtitle) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockSubtitle#fc451e7 as nil") - } - if p.Subtitle == nil { - return fmt.Errorf("unable to encode pageBlockSubtitle#fc451e7: field subtitle is nil") - } - if err := p.Subtitle.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockSubtitle#fc451e7: field subtitle: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockSubtitle) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockSubtitle#fc451e7 to nil") - } - if err := b.ConsumeID(PageBlockSubtitleTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockSubtitle#fc451e7: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockSubtitle) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockSubtitle#fc451e7 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockSubtitle#fc451e7: field subtitle: %w", err) - } - p.Subtitle = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockSubtitle) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockSubtitle#fc451e7 as nil") - } - b.ObjStart() - b.PutID("pageBlockSubtitle") - b.Comma() - b.FieldStart("subtitle") - if p.Subtitle == nil { - return fmt.Errorf("unable to encode pageBlockSubtitle#fc451e7: field subtitle is nil") - } - if err := p.Subtitle.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockSubtitle#fc451e7: field subtitle: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockSubtitle) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockSubtitle#fc451e7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockSubtitle"); err != nil { - return fmt.Errorf("unable to decode pageBlockSubtitle#fc451e7: %w", err) - } - case "subtitle": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockSubtitle#fc451e7: field subtitle: %w", err) - } - p.Subtitle = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSubtitle returns value of Subtitle field. -func (p *PageBlockSubtitle) GetSubtitle() (value RichTextClass) { - if p == nil { - return - } - return p.Subtitle -} - -// PageBlockAuthorDate represents TL type `pageBlockAuthorDate#4d7ff410`. -type PageBlockAuthorDate struct { - // Author - Author RichTextClass - // Point in time (Unix timestamp) when the article was published; 0 if unknown - PublishDate int32 -} - -// PageBlockAuthorDateTypeID is TL type id of PageBlockAuthorDate. -const PageBlockAuthorDateTypeID = 0x4d7ff410 - -// construct implements constructor of PageBlockClass. -func (p PageBlockAuthorDate) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockAuthorDate. -var ( - _ bin.Encoder = &PageBlockAuthorDate{} - _ bin.Decoder = &PageBlockAuthorDate{} - _ bin.BareEncoder = &PageBlockAuthorDate{} - _ bin.BareDecoder = &PageBlockAuthorDate{} - - _ PageBlockClass = &PageBlockAuthorDate{} -) - -func (p *PageBlockAuthorDate) Zero() bool { - if p == nil { - return true - } - if !(p.Author == nil) { - return false - } - if !(p.PublishDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockAuthorDate) String() string { - if p == nil { - return "PageBlockAuthorDate(nil)" - } - type Alias PageBlockAuthorDate - return fmt.Sprintf("PageBlockAuthorDate%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockAuthorDate) TypeID() uint32 { - return PageBlockAuthorDateTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockAuthorDate) TypeName() string { - return "pageBlockAuthorDate" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockAuthorDate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockAuthorDate", - ID: PageBlockAuthorDateTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Author", - SchemaName: "author", - }, - { - Name: "PublishDate", - SchemaName: "publish_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockAuthorDate) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAuthorDate#4d7ff410 as nil") - } - b.PutID(PageBlockAuthorDateTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockAuthorDate) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAuthorDate#4d7ff410 as nil") - } - if p.Author == nil { - return fmt.Errorf("unable to encode pageBlockAuthorDate#4d7ff410: field author is nil") - } - if err := p.Author.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockAuthorDate#4d7ff410: field author: %w", err) - } - b.PutInt32(p.PublishDate) - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockAuthorDate) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAuthorDate#4d7ff410 to nil") - } - if err := b.ConsumeID(PageBlockAuthorDateTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockAuthorDate#4d7ff410: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockAuthorDate) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAuthorDate#4d7ff410 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockAuthorDate#4d7ff410: field author: %w", err) - } - p.Author = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockAuthorDate#4d7ff410: field publish_date: %w", err) - } - p.PublishDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockAuthorDate) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAuthorDate#4d7ff410 as nil") - } - b.ObjStart() - b.PutID("pageBlockAuthorDate") - b.Comma() - b.FieldStart("author") - if p.Author == nil { - return fmt.Errorf("unable to encode pageBlockAuthorDate#4d7ff410: field author is nil") - } - if err := p.Author.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockAuthorDate#4d7ff410: field author: %w", err) - } - b.Comma() - b.FieldStart("publish_date") - b.PutInt32(p.PublishDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockAuthorDate) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAuthorDate#4d7ff410 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockAuthorDate"); err != nil { - return fmt.Errorf("unable to decode pageBlockAuthorDate#4d7ff410: %w", err) - } - case "author": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockAuthorDate#4d7ff410: field author: %w", err) - } - p.Author = value - case "publish_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockAuthorDate#4d7ff410: field publish_date: %w", err) - } - p.PublishDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAuthor returns value of Author field. -func (p *PageBlockAuthorDate) GetAuthor() (value RichTextClass) { - if p == nil { - return - } - return p.Author -} - -// GetPublishDate returns value of PublishDate field. -func (p *PageBlockAuthorDate) GetPublishDate() (value int32) { - if p == nil { - return - } - return p.PublishDate -} - -// PageBlockHeader represents TL type `pageBlockHeader#539ddd9b`. -type PageBlockHeader struct { - // Header - Header RichTextClass -} - -// PageBlockHeaderTypeID is TL type id of PageBlockHeader. -const PageBlockHeaderTypeID = 0x539ddd9b - -// construct implements constructor of PageBlockClass. -func (p PageBlockHeader) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockHeader. -var ( - _ bin.Encoder = &PageBlockHeader{} - _ bin.Decoder = &PageBlockHeader{} - _ bin.BareEncoder = &PageBlockHeader{} - _ bin.BareDecoder = &PageBlockHeader{} - - _ PageBlockClass = &PageBlockHeader{} -) - -func (p *PageBlockHeader) Zero() bool { - if p == nil { - return true - } - if !(p.Header == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockHeader) String() string { - if p == nil { - return "PageBlockHeader(nil)" - } - type Alias PageBlockHeader - return fmt.Sprintf("PageBlockHeader%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockHeader) TypeID() uint32 { - return PageBlockHeaderTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockHeader) TypeName() string { - return "pageBlockHeader" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockHeader) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockHeader", - ID: PageBlockHeaderTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Header", - SchemaName: "header", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockHeader) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHeader#539ddd9b as nil") - } - b.PutID(PageBlockHeaderTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockHeader) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHeader#539ddd9b as nil") - } - if p.Header == nil { - return fmt.Errorf("unable to encode pageBlockHeader#539ddd9b: field header is nil") - } - if err := p.Header.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockHeader#539ddd9b: field header: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockHeader) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHeader#539ddd9b to nil") - } - if err := b.ConsumeID(PageBlockHeaderTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockHeader#539ddd9b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockHeader) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHeader#539ddd9b to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockHeader#539ddd9b: field header: %w", err) - } - p.Header = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockHeader) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHeader#539ddd9b as nil") - } - b.ObjStart() - b.PutID("pageBlockHeader") - b.Comma() - b.FieldStart("header") - if p.Header == nil { - return fmt.Errorf("unable to encode pageBlockHeader#539ddd9b: field header is nil") - } - if err := p.Header.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockHeader#539ddd9b: field header: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockHeader) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHeader#539ddd9b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockHeader"); err != nil { - return fmt.Errorf("unable to decode pageBlockHeader#539ddd9b: %w", err) - } - case "header": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockHeader#539ddd9b: field header: %w", err) - } - p.Header = value - default: - return b.Skip() - } - return nil - }) -} - -// GetHeader returns value of Header field. -func (p *PageBlockHeader) GetHeader() (value RichTextClass) { - if p == nil { - return - } - return p.Header -} - -// PageBlockSubheader represents TL type `pageBlockSubheader#4b567326`. -type PageBlockSubheader struct { - // Subheader - Subheader RichTextClass -} - -// PageBlockSubheaderTypeID is TL type id of PageBlockSubheader. -const PageBlockSubheaderTypeID = 0x4b567326 - -// construct implements constructor of PageBlockClass. -func (p PageBlockSubheader) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockSubheader. -var ( - _ bin.Encoder = &PageBlockSubheader{} - _ bin.Decoder = &PageBlockSubheader{} - _ bin.BareEncoder = &PageBlockSubheader{} - _ bin.BareDecoder = &PageBlockSubheader{} - - _ PageBlockClass = &PageBlockSubheader{} -) - -func (p *PageBlockSubheader) Zero() bool { - if p == nil { - return true - } - if !(p.Subheader == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockSubheader) String() string { - if p == nil { - return "PageBlockSubheader(nil)" - } - type Alias PageBlockSubheader - return fmt.Sprintf("PageBlockSubheader%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockSubheader) TypeID() uint32 { - return PageBlockSubheaderTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockSubheader) TypeName() string { - return "pageBlockSubheader" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockSubheader) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockSubheader", - ID: PageBlockSubheaderTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Subheader", - SchemaName: "subheader", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockSubheader) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockSubheader#4b567326 as nil") - } - b.PutID(PageBlockSubheaderTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockSubheader) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockSubheader#4b567326 as nil") - } - if p.Subheader == nil { - return fmt.Errorf("unable to encode pageBlockSubheader#4b567326: field subheader is nil") - } - if err := p.Subheader.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockSubheader#4b567326: field subheader: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockSubheader) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockSubheader#4b567326 to nil") - } - if err := b.ConsumeID(PageBlockSubheaderTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockSubheader#4b567326: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockSubheader) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockSubheader#4b567326 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockSubheader#4b567326: field subheader: %w", err) - } - p.Subheader = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockSubheader) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockSubheader#4b567326 as nil") - } - b.ObjStart() - b.PutID("pageBlockSubheader") - b.Comma() - b.FieldStart("subheader") - if p.Subheader == nil { - return fmt.Errorf("unable to encode pageBlockSubheader#4b567326: field subheader is nil") - } - if err := p.Subheader.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockSubheader#4b567326: field subheader: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockSubheader) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockSubheader#4b567326 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockSubheader"); err != nil { - return fmt.Errorf("unable to decode pageBlockSubheader#4b567326: %w", err) - } - case "subheader": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockSubheader#4b567326: field subheader: %w", err) - } - p.Subheader = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSubheader returns value of Subheader field. -func (p *PageBlockSubheader) GetSubheader() (value RichTextClass) { - if p == nil { - return - } - return p.Subheader -} - -// PageBlockKicker represents TL type `pageBlockKicker#5123864b`. -type PageBlockKicker struct { - // Kicker - Kicker RichTextClass -} - -// PageBlockKickerTypeID is TL type id of PageBlockKicker. -const PageBlockKickerTypeID = 0x5123864b - -// construct implements constructor of PageBlockClass. -func (p PageBlockKicker) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockKicker. -var ( - _ bin.Encoder = &PageBlockKicker{} - _ bin.Decoder = &PageBlockKicker{} - _ bin.BareEncoder = &PageBlockKicker{} - _ bin.BareDecoder = &PageBlockKicker{} - - _ PageBlockClass = &PageBlockKicker{} -) - -func (p *PageBlockKicker) Zero() bool { - if p == nil { - return true - } - if !(p.Kicker == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockKicker) String() string { - if p == nil { - return "PageBlockKicker(nil)" - } - type Alias PageBlockKicker - return fmt.Sprintf("PageBlockKicker%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockKicker) TypeID() uint32 { - return PageBlockKickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockKicker) TypeName() string { - return "pageBlockKicker" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockKicker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockKicker", - ID: PageBlockKickerTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Kicker", - SchemaName: "kicker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockKicker) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockKicker#5123864b as nil") - } - b.PutID(PageBlockKickerTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockKicker) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockKicker#5123864b as nil") - } - if p.Kicker == nil { - return fmt.Errorf("unable to encode pageBlockKicker#5123864b: field kicker is nil") - } - if err := p.Kicker.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockKicker#5123864b: field kicker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockKicker) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockKicker#5123864b to nil") - } - if err := b.ConsumeID(PageBlockKickerTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockKicker#5123864b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockKicker) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockKicker#5123864b to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockKicker#5123864b: field kicker: %w", err) - } - p.Kicker = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockKicker) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockKicker#5123864b as nil") - } - b.ObjStart() - b.PutID("pageBlockKicker") - b.Comma() - b.FieldStart("kicker") - if p.Kicker == nil { - return fmt.Errorf("unable to encode pageBlockKicker#5123864b: field kicker is nil") - } - if err := p.Kicker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockKicker#5123864b: field kicker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockKicker) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockKicker#5123864b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockKicker"); err != nil { - return fmt.Errorf("unable to decode pageBlockKicker#5123864b: %w", err) - } - case "kicker": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockKicker#5123864b: field kicker: %w", err) - } - p.Kicker = value - default: - return b.Skip() - } - return nil - }) -} - -// GetKicker returns value of Kicker field. -func (p *PageBlockKicker) GetKicker() (value RichTextClass) { - if p == nil { - return - } - return p.Kicker -} - -// PageBlockParagraph represents TL type `pageBlockParagraph#467a0766`. -type PageBlockParagraph struct { - // Paragraph text - Text RichTextClass -} - -// PageBlockParagraphTypeID is TL type id of PageBlockParagraph. -const PageBlockParagraphTypeID = 0x467a0766 - -// construct implements constructor of PageBlockClass. -func (p PageBlockParagraph) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockParagraph. -var ( - _ bin.Encoder = &PageBlockParagraph{} - _ bin.Decoder = &PageBlockParagraph{} - _ bin.BareEncoder = &PageBlockParagraph{} - _ bin.BareDecoder = &PageBlockParagraph{} - - _ PageBlockClass = &PageBlockParagraph{} -) - -func (p *PageBlockParagraph) Zero() bool { - if p == nil { - return true - } - if !(p.Text == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockParagraph) String() string { - if p == nil { - return "PageBlockParagraph(nil)" - } - type Alias PageBlockParagraph - return fmt.Sprintf("PageBlockParagraph%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockParagraph) TypeID() uint32 { - return PageBlockParagraphTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockParagraph) TypeName() string { - return "pageBlockParagraph" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockParagraph) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockParagraph", - ID: PageBlockParagraphTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockParagraph) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockParagraph#467a0766 as nil") - } - b.PutID(PageBlockParagraphTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockParagraph) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockParagraph#467a0766 as nil") - } - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockParagraph#467a0766: field text is nil") - } - if err := p.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockParagraph#467a0766: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockParagraph) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockParagraph#467a0766 to nil") - } - if err := b.ConsumeID(PageBlockParagraphTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockParagraph#467a0766: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockParagraph) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockParagraph#467a0766 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockParagraph#467a0766: field text: %w", err) - } - p.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockParagraph) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockParagraph#467a0766 as nil") - } - b.ObjStart() - b.PutID("pageBlockParagraph") - b.Comma() - b.FieldStart("text") - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockParagraph#467a0766: field text is nil") - } - if err := p.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockParagraph#467a0766: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockParagraph) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockParagraph#467a0766 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockParagraph"); err != nil { - return fmt.Errorf("unable to decode pageBlockParagraph#467a0766: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockParagraph#467a0766: field text: %w", err) - } - p.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (p *PageBlockParagraph) GetText() (value RichTextClass) { - if p == nil { - return - } - return p.Text -} - -// PageBlockPreformatted represents TL type `pageBlockPreformatted#c070d93e`. -type PageBlockPreformatted struct { - // Paragraph text - Text RichTextClass - // Programming language for which the text needs to be formatted - Language string -} - -// PageBlockPreformattedTypeID is TL type id of PageBlockPreformatted. -const PageBlockPreformattedTypeID = 0xc070d93e - -// construct implements constructor of PageBlockClass. -func (p PageBlockPreformatted) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockPreformatted. -var ( - _ bin.Encoder = &PageBlockPreformatted{} - _ bin.Decoder = &PageBlockPreformatted{} - _ bin.BareEncoder = &PageBlockPreformatted{} - _ bin.BareDecoder = &PageBlockPreformatted{} - - _ PageBlockClass = &PageBlockPreformatted{} -) - -func (p *PageBlockPreformatted) Zero() bool { - if p == nil { - return true - } - if !(p.Text == nil) { - return false - } - if !(p.Language == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockPreformatted) String() string { - if p == nil { - return "PageBlockPreformatted(nil)" - } - type Alias PageBlockPreformatted - return fmt.Sprintf("PageBlockPreformatted%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockPreformatted) TypeID() uint32 { - return PageBlockPreformattedTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockPreformatted) TypeName() string { - return "pageBlockPreformatted" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockPreformatted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockPreformatted", - ID: PageBlockPreformattedTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Language", - SchemaName: "language", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockPreformatted) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockPreformatted#c070d93e as nil") - } - b.PutID(PageBlockPreformattedTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockPreformatted) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockPreformatted#c070d93e as nil") - } - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockPreformatted#c070d93e: field text is nil") - } - if err := p.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockPreformatted#c070d93e: field text: %w", err) - } - b.PutString(p.Language) - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockPreformatted) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockPreformatted#c070d93e to nil") - } - if err := b.ConsumeID(PageBlockPreformattedTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockPreformatted#c070d93e: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockPreformatted) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockPreformatted#c070d93e to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockPreformatted#c070d93e: field text: %w", err) - } - p.Text = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockPreformatted#c070d93e: field language: %w", err) - } - p.Language = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockPreformatted) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockPreformatted#c070d93e as nil") - } - b.ObjStart() - b.PutID("pageBlockPreformatted") - b.Comma() - b.FieldStart("text") - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockPreformatted#c070d93e: field text is nil") - } - if err := p.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockPreformatted#c070d93e: field text: %w", err) - } - b.Comma() - b.FieldStart("language") - b.PutString(p.Language) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockPreformatted) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockPreformatted#c070d93e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockPreformatted"); err != nil { - return fmt.Errorf("unable to decode pageBlockPreformatted#c070d93e: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockPreformatted#c070d93e: field text: %w", err) - } - p.Text = value - case "language": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockPreformatted#c070d93e: field language: %w", err) - } - p.Language = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (p *PageBlockPreformatted) GetText() (value RichTextClass) { - if p == nil { - return - } - return p.Text -} - -// GetLanguage returns value of Language field. -func (p *PageBlockPreformatted) GetLanguage() (value string) { - if p == nil { - return - } - return p.Language -} - -// PageBlockFooter represents TL type `pageBlockFooter#34d5d728`. -type PageBlockFooter struct { - // Footer - Footer RichTextClass -} - -// PageBlockFooterTypeID is TL type id of PageBlockFooter. -const PageBlockFooterTypeID = 0x34d5d728 - -// construct implements constructor of PageBlockClass. -func (p PageBlockFooter) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockFooter. -var ( - _ bin.Encoder = &PageBlockFooter{} - _ bin.Decoder = &PageBlockFooter{} - _ bin.BareEncoder = &PageBlockFooter{} - _ bin.BareDecoder = &PageBlockFooter{} - - _ PageBlockClass = &PageBlockFooter{} -) - -func (p *PageBlockFooter) Zero() bool { - if p == nil { - return true - } - if !(p.Footer == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockFooter) String() string { - if p == nil { - return "PageBlockFooter(nil)" - } - type Alias PageBlockFooter - return fmt.Sprintf("PageBlockFooter%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockFooter) TypeID() uint32 { - return PageBlockFooterTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockFooter) TypeName() string { - return "pageBlockFooter" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockFooter) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockFooter", - ID: PageBlockFooterTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Footer", - SchemaName: "footer", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockFooter) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockFooter#34d5d728 as nil") - } - b.PutID(PageBlockFooterTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockFooter) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockFooter#34d5d728 as nil") - } - if p.Footer == nil { - return fmt.Errorf("unable to encode pageBlockFooter#34d5d728: field footer is nil") - } - if err := p.Footer.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockFooter#34d5d728: field footer: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockFooter) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockFooter#34d5d728 to nil") - } - if err := b.ConsumeID(PageBlockFooterTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockFooter#34d5d728: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockFooter) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockFooter#34d5d728 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockFooter#34d5d728: field footer: %w", err) - } - p.Footer = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockFooter) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockFooter#34d5d728 as nil") - } - b.ObjStart() - b.PutID("pageBlockFooter") - b.Comma() - b.FieldStart("footer") - if p.Footer == nil { - return fmt.Errorf("unable to encode pageBlockFooter#34d5d728: field footer is nil") - } - if err := p.Footer.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockFooter#34d5d728: field footer: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockFooter) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockFooter#34d5d728 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockFooter"); err != nil { - return fmt.Errorf("unable to decode pageBlockFooter#34d5d728: %w", err) - } - case "footer": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockFooter#34d5d728: field footer: %w", err) - } - p.Footer = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFooter returns value of Footer field. -func (p *PageBlockFooter) GetFooter() (value RichTextClass) { - if p == nil { - return - } - return p.Footer -} - -// PageBlockDivider represents TL type `pageBlockDivider#db20b188`. -type PageBlockDivider struct { -} - -// PageBlockDividerTypeID is TL type id of PageBlockDivider. -const PageBlockDividerTypeID = 0xdb20b188 - -// construct implements constructor of PageBlockClass. -func (p PageBlockDivider) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockDivider. -var ( - _ bin.Encoder = &PageBlockDivider{} - _ bin.Decoder = &PageBlockDivider{} - _ bin.BareEncoder = &PageBlockDivider{} - _ bin.BareDecoder = &PageBlockDivider{} - - _ PageBlockClass = &PageBlockDivider{} -) - -func (p *PageBlockDivider) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockDivider) String() string { - if p == nil { - return "PageBlockDivider(nil)" - } - type Alias PageBlockDivider - return fmt.Sprintf("PageBlockDivider%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockDivider) TypeID() uint32 { - return PageBlockDividerTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockDivider) TypeName() string { - return "pageBlockDivider" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockDivider) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockDivider", - ID: PageBlockDividerTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockDivider) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockDivider#db20b188 as nil") - } - b.PutID(PageBlockDividerTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockDivider) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockDivider#db20b188 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockDivider) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockDivider#db20b188 to nil") - } - if err := b.ConsumeID(PageBlockDividerTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockDivider#db20b188: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockDivider) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockDivider#db20b188 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockDivider) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockDivider#db20b188 as nil") - } - b.ObjStart() - b.PutID("pageBlockDivider") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockDivider) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockDivider#db20b188 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockDivider"); err != nil { - return fmt.Errorf("unable to decode pageBlockDivider#db20b188: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PageBlockAnchor represents TL type `pageBlockAnchor#ce0d37b0`. -type PageBlockAnchor struct { - // Name of the anchor - Name string -} - -// PageBlockAnchorTypeID is TL type id of PageBlockAnchor. -const PageBlockAnchorTypeID = 0xce0d37b0 - -// construct implements constructor of PageBlockClass. -func (p PageBlockAnchor) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockAnchor. -var ( - _ bin.Encoder = &PageBlockAnchor{} - _ bin.Decoder = &PageBlockAnchor{} - _ bin.BareEncoder = &PageBlockAnchor{} - _ bin.BareDecoder = &PageBlockAnchor{} - - _ PageBlockClass = &PageBlockAnchor{} -) - -func (p *PageBlockAnchor) Zero() bool { - if p == nil { - return true - } - if !(p.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockAnchor) String() string { - if p == nil { - return "PageBlockAnchor(nil)" - } - type Alias PageBlockAnchor - return fmt.Sprintf("PageBlockAnchor%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockAnchor) TypeID() uint32 { - return PageBlockAnchorTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockAnchor) TypeName() string { - return "pageBlockAnchor" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockAnchor) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockAnchor", - ID: PageBlockAnchorTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockAnchor) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAnchor#ce0d37b0 as nil") - } - b.PutID(PageBlockAnchorTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockAnchor) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAnchor#ce0d37b0 as nil") - } - b.PutString(p.Name) - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockAnchor) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAnchor#ce0d37b0 to nil") - } - if err := b.ConsumeID(PageBlockAnchorTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockAnchor#ce0d37b0: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockAnchor) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAnchor#ce0d37b0 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockAnchor#ce0d37b0: field name: %w", err) - } - p.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockAnchor) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAnchor#ce0d37b0 as nil") - } - b.ObjStart() - b.PutID("pageBlockAnchor") - b.Comma() - b.FieldStart("name") - b.PutString(p.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockAnchor) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAnchor#ce0d37b0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockAnchor"); err != nil { - return fmt.Errorf("unable to decode pageBlockAnchor#ce0d37b0: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockAnchor#ce0d37b0: field name: %w", err) - } - p.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (p *PageBlockAnchor) GetName() (value string) { - if p == nil { - return - } - return p.Name -} - -// PageBlockList represents TL type `pageBlockList#584af35a`. -type PageBlockList struct { - // The items of the list - Items []PageBlockListItem -} - -// PageBlockListTypeID is TL type id of PageBlockList. -const PageBlockListTypeID = 0x584af35a - -// construct implements constructor of PageBlockClass. -func (p PageBlockList) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockList. -var ( - _ bin.Encoder = &PageBlockList{} - _ bin.Decoder = &PageBlockList{} - _ bin.BareEncoder = &PageBlockList{} - _ bin.BareDecoder = &PageBlockList{} - - _ PageBlockClass = &PageBlockList{} -) - -func (p *PageBlockList) Zero() bool { - if p == nil { - return true - } - if !(p.Items == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockList) String() string { - if p == nil { - return "PageBlockList(nil)" - } - type Alias PageBlockList - return fmt.Sprintf("PageBlockList%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockList) TypeID() uint32 { - return PageBlockListTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockList) TypeName() string { - return "pageBlockList" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockList) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockList", - ID: PageBlockListTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Items", - SchemaName: "items", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockList) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockList#584af35a as nil") - } - b.PutID(PageBlockListTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockList) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockList#584af35a as nil") - } - b.PutInt(len(p.Items)) - for idx, v := range p.Items { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare pageBlockList#584af35a: field items element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockList) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockList#584af35a to nil") - } - if err := b.ConsumeID(PageBlockListTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockList#584af35a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockList) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockList#584af35a to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode pageBlockList#584af35a: field items: %w", err) - } - - if headerLen > 0 { - p.Items = make([]PageBlockListItem, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PageBlockListItem - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare pageBlockList#584af35a: field items: %w", err) - } - p.Items = append(p.Items, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockList) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockList#584af35a as nil") - } - b.ObjStart() - b.PutID("pageBlockList") - b.Comma() - b.FieldStart("items") - b.ArrStart() - for idx, v := range p.Items { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockList#584af35a: field items element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockList) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockList#584af35a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockList"); err != nil { - return fmt.Errorf("unable to decode pageBlockList#584af35a: %w", err) - } - case "items": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PageBlockListItem - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockList#584af35a: field items: %w", err) - } - p.Items = append(p.Items, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode pageBlockList#584af35a: field items: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetItems returns value of Items field. -func (p *PageBlockList) GetItems() (value []PageBlockListItem) { - if p == nil { - return - } - return p.Items -} - -// PageBlockBlockQuote represents TL type `pageBlockBlockQuote#62d08a9e`. -type PageBlockBlockQuote struct { - // Quote text - Text RichTextClass - // Quote credit - Credit RichTextClass -} - -// PageBlockBlockQuoteTypeID is TL type id of PageBlockBlockQuote. -const PageBlockBlockQuoteTypeID = 0x62d08a9e - -// construct implements constructor of PageBlockClass. -func (p PageBlockBlockQuote) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockBlockQuote. -var ( - _ bin.Encoder = &PageBlockBlockQuote{} - _ bin.Decoder = &PageBlockBlockQuote{} - _ bin.BareEncoder = &PageBlockBlockQuote{} - _ bin.BareDecoder = &PageBlockBlockQuote{} - - _ PageBlockClass = &PageBlockBlockQuote{} -) - -func (p *PageBlockBlockQuote) Zero() bool { - if p == nil { - return true - } - if !(p.Text == nil) { - return false - } - if !(p.Credit == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockBlockQuote) String() string { - if p == nil { - return "PageBlockBlockQuote(nil)" - } - type Alias PageBlockBlockQuote - return fmt.Sprintf("PageBlockBlockQuote%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockBlockQuote) TypeID() uint32 { - return PageBlockBlockQuoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockBlockQuote) TypeName() string { - return "pageBlockBlockQuote" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockBlockQuote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockBlockQuote", - ID: PageBlockBlockQuoteTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Credit", - SchemaName: "credit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockBlockQuote) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockBlockQuote#62d08a9e as nil") - } - b.PutID(PageBlockBlockQuoteTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockBlockQuote) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockBlockQuote#62d08a9e as nil") - } - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockBlockQuote#62d08a9e: field text is nil") - } - if err := p.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockBlockQuote#62d08a9e: field text: %w", err) - } - if p.Credit == nil { - return fmt.Errorf("unable to encode pageBlockBlockQuote#62d08a9e: field credit is nil") - } - if err := p.Credit.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockBlockQuote#62d08a9e: field credit: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockBlockQuote) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockBlockQuote#62d08a9e to nil") - } - if err := b.ConsumeID(PageBlockBlockQuoteTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockBlockQuote#62d08a9e: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockBlockQuote) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockBlockQuote#62d08a9e to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockBlockQuote#62d08a9e: field text: %w", err) - } - p.Text = value - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockBlockQuote#62d08a9e: field credit: %w", err) - } - p.Credit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockBlockQuote) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockBlockQuote#62d08a9e as nil") - } - b.ObjStart() - b.PutID("pageBlockBlockQuote") - b.Comma() - b.FieldStart("text") - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockBlockQuote#62d08a9e: field text is nil") - } - if err := p.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockBlockQuote#62d08a9e: field text: %w", err) - } - b.Comma() - b.FieldStart("credit") - if p.Credit == nil { - return fmt.Errorf("unable to encode pageBlockBlockQuote#62d08a9e: field credit is nil") - } - if err := p.Credit.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockBlockQuote#62d08a9e: field credit: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockBlockQuote) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockBlockQuote#62d08a9e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockBlockQuote"); err != nil { - return fmt.Errorf("unable to decode pageBlockBlockQuote#62d08a9e: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockBlockQuote#62d08a9e: field text: %w", err) - } - p.Text = value - case "credit": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockBlockQuote#62d08a9e: field credit: %w", err) - } - p.Credit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (p *PageBlockBlockQuote) GetText() (value RichTextClass) { - if p == nil { - return - } - return p.Text -} - -// GetCredit returns value of Credit field. -func (p *PageBlockBlockQuote) GetCredit() (value RichTextClass) { - if p == nil { - return - } - return p.Credit -} - -// PageBlockPullQuote represents TL type `pageBlockPullQuote#1d38810d`. -type PageBlockPullQuote struct { - // Quote text - Text RichTextClass - // Quote credit - Credit RichTextClass -} - -// PageBlockPullQuoteTypeID is TL type id of PageBlockPullQuote. -const PageBlockPullQuoteTypeID = 0x1d38810d - -// construct implements constructor of PageBlockClass. -func (p PageBlockPullQuote) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockPullQuote. -var ( - _ bin.Encoder = &PageBlockPullQuote{} - _ bin.Decoder = &PageBlockPullQuote{} - _ bin.BareEncoder = &PageBlockPullQuote{} - _ bin.BareDecoder = &PageBlockPullQuote{} - - _ PageBlockClass = &PageBlockPullQuote{} -) - -func (p *PageBlockPullQuote) Zero() bool { - if p == nil { - return true - } - if !(p.Text == nil) { - return false - } - if !(p.Credit == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockPullQuote) String() string { - if p == nil { - return "PageBlockPullQuote(nil)" - } - type Alias PageBlockPullQuote - return fmt.Sprintf("PageBlockPullQuote%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockPullQuote) TypeID() uint32 { - return PageBlockPullQuoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockPullQuote) TypeName() string { - return "pageBlockPullQuote" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockPullQuote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockPullQuote", - ID: PageBlockPullQuoteTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Credit", - SchemaName: "credit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockPullQuote) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockPullQuote#1d38810d as nil") - } - b.PutID(PageBlockPullQuoteTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockPullQuote) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockPullQuote#1d38810d as nil") - } - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockPullQuote#1d38810d: field text is nil") - } - if err := p.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockPullQuote#1d38810d: field text: %w", err) - } - if p.Credit == nil { - return fmt.Errorf("unable to encode pageBlockPullQuote#1d38810d: field credit is nil") - } - if err := p.Credit.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockPullQuote#1d38810d: field credit: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockPullQuote) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockPullQuote#1d38810d to nil") - } - if err := b.ConsumeID(PageBlockPullQuoteTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockPullQuote#1d38810d: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockPullQuote) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockPullQuote#1d38810d to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockPullQuote#1d38810d: field text: %w", err) - } - p.Text = value - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockPullQuote#1d38810d: field credit: %w", err) - } - p.Credit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockPullQuote) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockPullQuote#1d38810d as nil") - } - b.ObjStart() - b.PutID("pageBlockPullQuote") - b.Comma() - b.FieldStart("text") - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockPullQuote#1d38810d: field text is nil") - } - if err := p.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockPullQuote#1d38810d: field text: %w", err) - } - b.Comma() - b.FieldStart("credit") - if p.Credit == nil { - return fmt.Errorf("unable to encode pageBlockPullQuote#1d38810d: field credit is nil") - } - if err := p.Credit.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockPullQuote#1d38810d: field credit: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockPullQuote) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockPullQuote#1d38810d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockPullQuote"); err != nil { - return fmt.Errorf("unable to decode pageBlockPullQuote#1d38810d: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockPullQuote#1d38810d: field text: %w", err) - } - p.Text = value - case "credit": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockPullQuote#1d38810d: field credit: %w", err) - } - p.Credit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (p *PageBlockPullQuote) GetText() (value RichTextClass) { - if p == nil { - return - } - return p.Text -} - -// GetCredit returns value of Credit field. -func (p *PageBlockPullQuote) GetCredit() (value RichTextClass) { - if p == nil { - return - } - return p.Credit -} - -// PageBlockAnimation represents TL type `pageBlockAnimation#50cde009`. -type PageBlockAnimation struct { - // Animation file; may be null - Animation Animation - // Animation caption - Caption PageBlockCaption - // True, if the animation must be played automatically - NeedAutoplay bool -} - -// PageBlockAnimationTypeID is TL type id of PageBlockAnimation. -const PageBlockAnimationTypeID = 0x50cde009 - -// construct implements constructor of PageBlockClass. -func (p PageBlockAnimation) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockAnimation. -var ( - _ bin.Encoder = &PageBlockAnimation{} - _ bin.Decoder = &PageBlockAnimation{} - _ bin.BareEncoder = &PageBlockAnimation{} - _ bin.BareDecoder = &PageBlockAnimation{} - - _ PageBlockClass = &PageBlockAnimation{} -) - -func (p *PageBlockAnimation) Zero() bool { - if p == nil { - return true - } - if !(p.Animation.Zero()) { - return false - } - if !(p.Caption.Zero()) { - return false - } - if !(p.NeedAutoplay == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockAnimation) String() string { - if p == nil { - return "PageBlockAnimation(nil)" - } - type Alias PageBlockAnimation - return fmt.Sprintf("PageBlockAnimation%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockAnimation) TypeID() uint32 { - return PageBlockAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockAnimation) TypeName() string { - return "pageBlockAnimation" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockAnimation", - ID: PageBlockAnimationTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Animation", - SchemaName: "animation", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "NeedAutoplay", - SchemaName: "need_autoplay", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockAnimation) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAnimation#50cde009 as nil") - } - b.PutID(PageBlockAnimationTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockAnimation) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAnimation#50cde009 as nil") - } - if err := p.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockAnimation#50cde009: field animation: %w", err) - } - if err := p.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockAnimation#50cde009: field caption: %w", err) - } - b.PutBool(p.NeedAutoplay) - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockAnimation) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAnimation#50cde009 to nil") - } - if err := b.ConsumeID(PageBlockAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockAnimation#50cde009: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockAnimation) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAnimation#50cde009 to nil") - } - { - if err := p.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockAnimation#50cde009: field animation: %w", err) - } - } - { - if err := p.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockAnimation#50cde009: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockAnimation#50cde009: field need_autoplay: %w", err) - } - p.NeedAutoplay = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAnimation#50cde009 as nil") - } - b.ObjStart() - b.PutID("pageBlockAnimation") - b.Comma() - b.FieldStart("animation") - if err := p.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockAnimation#50cde009: field animation: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := p.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockAnimation#50cde009: field caption: %w", err) - } - b.Comma() - b.FieldStart("need_autoplay") - b.PutBool(p.NeedAutoplay) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAnimation#50cde009 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockAnimation"); err != nil { - return fmt.Errorf("unable to decode pageBlockAnimation#50cde009: %w", err) - } - case "animation": - if err := p.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockAnimation#50cde009: field animation: %w", err) - } - case "caption": - if err := p.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockAnimation#50cde009: field caption: %w", err) - } - case "need_autoplay": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockAnimation#50cde009: field need_autoplay: %w", err) - } - p.NeedAutoplay = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAnimation returns value of Animation field. -func (p *PageBlockAnimation) GetAnimation() (value Animation) { - if p == nil { - return - } - return p.Animation -} - -// GetCaption returns value of Caption field. -func (p *PageBlockAnimation) GetCaption() (value PageBlockCaption) { - if p == nil { - return - } - return p.Caption -} - -// GetNeedAutoplay returns value of NeedAutoplay field. -func (p *PageBlockAnimation) GetNeedAutoplay() (value bool) { - if p == nil { - return - } - return p.NeedAutoplay -} - -// PageBlockAudio represents TL type `pageBlockAudio#fc390813`. -type PageBlockAudio struct { - // Audio file; may be null - Audio Audio - // Audio file caption - Caption PageBlockCaption -} - -// PageBlockAudioTypeID is TL type id of PageBlockAudio. -const PageBlockAudioTypeID = 0xfc390813 - -// construct implements constructor of PageBlockClass. -func (p PageBlockAudio) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockAudio. -var ( - _ bin.Encoder = &PageBlockAudio{} - _ bin.Decoder = &PageBlockAudio{} - _ bin.BareEncoder = &PageBlockAudio{} - _ bin.BareDecoder = &PageBlockAudio{} - - _ PageBlockClass = &PageBlockAudio{} -) - -func (p *PageBlockAudio) Zero() bool { - if p == nil { - return true - } - if !(p.Audio.Zero()) { - return false - } - if !(p.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockAudio) String() string { - if p == nil { - return "PageBlockAudio(nil)" - } - type Alias PageBlockAudio - return fmt.Sprintf("PageBlockAudio%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockAudio) TypeID() uint32 { - return PageBlockAudioTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockAudio) TypeName() string { - return "pageBlockAudio" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockAudio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockAudio", - ID: PageBlockAudioTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Audio", - SchemaName: "audio", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockAudio) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAudio#fc390813 as nil") - } - b.PutID(PageBlockAudioTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockAudio) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAudio#fc390813 as nil") - } - if err := p.Audio.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockAudio#fc390813: field audio: %w", err) - } - if err := p.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockAudio#fc390813: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockAudio) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAudio#fc390813 to nil") - } - if err := b.ConsumeID(PageBlockAudioTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockAudio#fc390813: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockAudio) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAudio#fc390813 to nil") - } - { - if err := p.Audio.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockAudio#fc390813: field audio: %w", err) - } - } - { - if err := p.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockAudio#fc390813: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockAudio) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockAudio#fc390813 as nil") - } - b.ObjStart() - b.PutID("pageBlockAudio") - b.Comma() - b.FieldStart("audio") - if err := p.Audio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockAudio#fc390813: field audio: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := p.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockAudio#fc390813: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockAudio) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockAudio#fc390813 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockAudio"); err != nil { - return fmt.Errorf("unable to decode pageBlockAudio#fc390813: %w", err) - } - case "audio": - if err := p.Audio.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockAudio#fc390813: field audio: %w", err) - } - case "caption": - if err := p.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockAudio#fc390813: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAudio returns value of Audio field. -func (p *PageBlockAudio) GetAudio() (value Audio) { - if p == nil { - return - } - return p.Audio -} - -// GetCaption returns value of Caption field. -func (p *PageBlockAudio) GetCaption() (value PageBlockCaption) { - if p == nil { - return - } - return p.Caption -} - -// PageBlockPhoto represents TL type `pageBlockPhoto#18e41684`. -type PageBlockPhoto struct { - // Photo file; may be null - Photo Photo - // Photo caption - Caption PageBlockCaption - // URL that needs to be opened when the photo is clicked - URL string -} - -// PageBlockPhotoTypeID is TL type id of PageBlockPhoto. -const PageBlockPhotoTypeID = 0x18e41684 - -// construct implements constructor of PageBlockClass. -func (p PageBlockPhoto) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockPhoto. -var ( - _ bin.Encoder = &PageBlockPhoto{} - _ bin.Decoder = &PageBlockPhoto{} - _ bin.BareEncoder = &PageBlockPhoto{} - _ bin.BareDecoder = &PageBlockPhoto{} - - _ PageBlockClass = &PageBlockPhoto{} -) - -func (p *PageBlockPhoto) Zero() bool { - if p == nil { - return true - } - if !(p.Photo.Zero()) { - return false - } - if !(p.Caption.Zero()) { - return false - } - if !(p.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockPhoto) String() string { - if p == nil { - return "PageBlockPhoto(nil)" - } - type Alias PageBlockPhoto - return fmt.Sprintf("PageBlockPhoto%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockPhoto) TypeID() uint32 { - return PageBlockPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockPhoto) TypeName() string { - return "pageBlockPhoto" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockPhoto", - ID: PageBlockPhotoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockPhoto) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockPhoto#18e41684 as nil") - } - b.PutID(PageBlockPhotoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockPhoto) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockPhoto#18e41684 as nil") - } - if err := p.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockPhoto#18e41684: field photo: %w", err) - } - if err := p.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockPhoto#18e41684: field caption: %w", err) - } - b.PutString(p.URL) - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockPhoto) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockPhoto#18e41684 to nil") - } - if err := b.ConsumeID(PageBlockPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockPhoto#18e41684: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockPhoto) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockPhoto#18e41684 to nil") - } - { - if err := p.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockPhoto#18e41684: field photo: %w", err) - } - } - { - if err := p.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockPhoto#18e41684: field caption: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockPhoto#18e41684: field url: %w", err) - } - p.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockPhoto#18e41684 as nil") - } - b.ObjStart() - b.PutID("pageBlockPhoto") - b.Comma() - b.FieldStart("photo") - if err := p.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockPhoto#18e41684: field photo: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := p.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockPhoto#18e41684: field caption: %w", err) - } - b.Comma() - b.FieldStart("url") - b.PutString(p.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockPhoto#18e41684 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockPhoto"); err != nil { - return fmt.Errorf("unable to decode pageBlockPhoto#18e41684: %w", err) - } - case "photo": - if err := p.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockPhoto#18e41684: field photo: %w", err) - } - case "caption": - if err := p.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockPhoto#18e41684: field caption: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockPhoto#18e41684: field url: %w", err) - } - p.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (p *PageBlockPhoto) GetPhoto() (value Photo) { - if p == nil { - return - } - return p.Photo -} - -// GetCaption returns value of Caption field. -func (p *PageBlockPhoto) GetCaption() (value PageBlockCaption) { - if p == nil { - return - } - return p.Caption -} - -// GetURL returns value of URL field. -func (p *PageBlockPhoto) GetURL() (value string) { - if p == nil { - return - } - return p.URL -} - -// PageBlockVideo represents TL type `pageBlockVideo#1e669d32`. -type PageBlockVideo struct { - // Video file; may be null - Video Video - // Video caption - Caption PageBlockCaption - // True, if the video must be played automatically - NeedAutoplay bool - // True, if the video must be looped - IsLooped bool -} - -// PageBlockVideoTypeID is TL type id of PageBlockVideo. -const PageBlockVideoTypeID = 0x1e669d32 - -// construct implements constructor of PageBlockClass. -func (p PageBlockVideo) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockVideo. -var ( - _ bin.Encoder = &PageBlockVideo{} - _ bin.Decoder = &PageBlockVideo{} - _ bin.BareEncoder = &PageBlockVideo{} - _ bin.BareDecoder = &PageBlockVideo{} - - _ PageBlockClass = &PageBlockVideo{} -) - -func (p *PageBlockVideo) Zero() bool { - if p == nil { - return true - } - if !(p.Video.Zero()) { - return false - } - if !(p.Caption.Zero()) { - return false - } - if !(p.NeedAutoplay == false) { - return false - } - if !(p.IsLooped == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockVideo) String() string { - if p == nil { - return "PageBlockVideo(nil)" - } - type Alias PageBlockVideo - return fmt.Sprintf("PageBlockVideo%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockVideo) TypeID() uint32 { - return PageBlockVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockVideo) TypeName() string { - return "pageBlockVideo" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockVideo", - ID: PageBlockVideoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Video", - SchemaName: "video", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "NeedAutoplay", - SchemaName: "need_autoplay", - }, - { - Name: "IsLooped", - SchemaName: "is_looped", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockVideo) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVideo#1e669d32 as nil") - } - b.PutID(PageBlockVideoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockVideo) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVideo#1e669d32 as nil") - } - if err := p.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockVideo#1e669d32: field video: %w", err) - } - if err := p.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockVideo#1e669d32: field caption: %w", err) - } - b.PutBool(p.NeedAutoplay) - b.PutBool(p.IsLooped) - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockVideo) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVideo#1e669d32 to nil") - } - if err := b.ConsumeID(PageBlockVideoTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockVideo#1e669d32: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockVideo) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVideo#1e669d32 to nil") - } - { - if err := p.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockVideo#1e669d32: field video: %w", err) - } - } - { - if err := p.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockVideo#1e669d32: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockVideo#1e669d32: field need_autoplay: %w", err) - } - p.NeedAutoplay = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockVideo#1e669d32: field is_looped: %w", err) - } - p.IsLooped = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVideo#1e669d32 as nil") - } - b.ObjStart() - b.PutID("pageBlockVideo") - b.Comma() - b.FieldStart("video") - if err := p.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockVideo#1e669d32: field video: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := p.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockVideo#1e669d32: field caption: %w", err) - } - b.Comma() - b.FieldStart("need_autoplay") - b.PutBool(p.NeedAutoplay) - b.Comma() - b.FieldStart("is_looped") - b.PutBool(p.IsLooped) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVideo#1e669d32 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockVideo"); err != nil { - return fmt.Errorf("unable to decode pageBlockVideo#1e669d32: %w", err) - } - case "video": - if err := p.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockVideo#1e669d32: field video: %w", err) - } - case "caption": - if err := p.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockVideo#1e669d32: field caption: %w", err) - } - case "need_autoplay": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockVideo#1e669d32: field need_autoplay: %w", err) - } - p.NeedAutoplay = value - case "is_looped": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockVideo#1e669d32: field is_looped: %w", err) - } - p.IsLooped = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVideo returns value of Video field. -func (p *PageBlockVideo) GetVideo() (value Video) { - if p == nil { - return - } - return p.Video -} - -// GetCaption returns value of Caption field. -func (p *PageBlockVideo) GetCaption() (value PageBlockCaption) { - if p == nil { - return - } - return p.Caption -} - -// GetNeedAutoplay returns value of NeedAutoplay field. -func (p *PageBlockVideo) GetNeedAutoplay() (value bool) { - if p == nil { - return - } - return p.NeedAutoplay -} - -// GetIsLooped returns value of IsLooped field. -func (p *PageBlockVideo) GetIsLooped() (value bool) { - if p == nil { - return - } - return p.IsLooped -} - -// PageBlockVoiceNote represents TL type `pageBlockVoiceNote#6cad827f`. -type PageBlockVoiceNote struct { - // Voice note; may be null - VoiceNote VoiceNote - // Voice note caption - Caption PageBlockCaption -} - -// PageBlockVoiceNoteTypeID is TL type id of PageBlockVoiceNote. -const PageBlockVoiceNoteTypeID = 0x6cad827f - -// construct implements constructor of PageBlockClass. -func (p PageBlockVoiceNote) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockVoiceNote. -var ( - _ bin.Encoder = &PageBlockVoiceNote{} - _ bin.Decoder = &PageBlockVoiceNote{} - _ bin.BareEncoder = &PageBlockVoiceNote{} - _ bin.BareDecoder = &PageBlockVoiceNote{} - - _ PageBlockClass = &PageBlockVoiceNote{} -) - -func (p *PageBlockVoiceNote) Zero() bool { - if p == nil { - return true - } - if !(p.VoiceNote.Zero()) { - return false - } - if !(p.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockVoiceNote) String() string { - if p == nil { - return "PageBlockVoiceNote(nil)" - } - type Alias PageBlockVoiceNote - return fmt.Sprintf("PageBlockVoiceNote%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockVoiceNote) TypeID() uint32 { - return PageBlockVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockVoiceNote) TypeName() string { - return "pageBlockVoiceNote" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockVoiceNote", - ID: PageBlockVoiceNoteTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VoiceNote", - SchemaName: "voice_note", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockVoiceNote) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVoiceNote#6cad827f as nil") - } - b.PutID(PageBlockVoiceNoteTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockVoiceNote) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVoiceNote#6cad827f as nil") - } - if err := p.VoiceNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockVoiceNote#6cad827f: field voice_note: %w", err) - } - if err := p.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockVoiceNote#6cad827f: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockVoiceNote) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVoiceNote#6cad827f to nil") - } - if err := b.ConsumeID(PageBlockVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockVoiceNote#6cad827f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockVoiceNote) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVoiceNote#6cad827f to nil") - } - { - if err := p.VoiceNote.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockVoiceNote#6cad827f: field voice_note: %w", err) - } - } - { - if err := p.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockVoiceNote#6cad827f: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVoiceNote#6cad827f as nil") - } - b.ObjStart() - b.PutID("pageBlockVoiceNote") - b.Comma() - b.FieldStart("voice_note") - if err := p.VoiceNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockVoiceNote#6cad827f: field voice_note: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := p.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockVoiceNote#6cad827f: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVoiceNote#6cad827f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockVoiceNote"); err != nil { - return fmt.Errorf("unable to decode pageBlockVoiceNote#6cad827f: %w", err) - } - case "voice_note": - if err := p.VoiceNote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockVoiceNote#6cad827f: field voice_note: %w", err) - } - case "caption": - if err := p.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockVoiceNote#6cad827f: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetVoiceNote returns value of VoiceNote field. -func (p *PageBlockVoiceNote) GetVoiceNote() (value VoiceNote) { - if p == nil { - return - } - return p.VoiceNote -} - -// GetCaption returns value of Caption field. -func (p *PageBlockVoiceNote) GetCaption() (value PageBlockCaption) { - if p == nil { - return - } - return p.Caption -} - -// PageBlockCover represents TL type `pageBlockCover#39f23300`. -type PageBlockCover struct { - // Cover - Cover PageBlockClass -} - -// PageBlockCoverTypeID is TL type id of PageBlockCover. -const PageBlockCoverTypeID = 0x39f23300 - -// construct implements constructor of PageBlockClass. -func (p PageBlockCover) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockCover. -var ( - _ bin.Encoder = &PageBlockCover{} - _ bin.Decoder = &PageBlockCover{} - _ bin.BareEncoder = &PageBlockCover{} - _ bin.BareDecoder = &PageBlockCover{} - - _ PageBlockClass = &PageBlockCover{} -) - -func (p *PageBlockCover) Zero() bool { - if p == nil { - return true - } - if !(p.Cover == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockCover) String() string { - if p == nil { - return "PageBlockCover(nil)" - } - type Alias PageBlockCover - return fmt.Sprintf("PageBlockCover%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockCover) TypeID() uint32 { - return PageBlockCoverTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockCover) TypeName() string { - return "pageBlockCover" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockCover) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockCover", - ID: PageBlockCoverTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Cover", - SchemaName: "cover", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockCover) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockCover#39f23300 as nil") - } - b.PutID(PageBlockCoverTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockCover) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockCover#39f23300 as nil") - } - if p.Cover == nil { - return fmt.Errorf("unable to encode pageBlockCover#39f23300: field cover is nil") - } - if err := p.Cover.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockCover#39f23300: field cover: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockCover) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockCover#39f23300 to nil") - } - if err := b.ConsumeID(PageBlockCoverTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockCover#39f23300: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockCover) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockCover#39f23300 to nil") - } - { - value, err := DecodePageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockCover#39f23300: field cover: %w", err) - } - p.Cover = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockCover) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockCover#39f23300 as nil") - } - b.ObjStart() - b.PutID("pageBlockCover") - b.Comma() - b.FieldStart("cover") - if p.Cover == nil { - return fmt.Errorf("unable to encode pageBlockCover#39f23300: field cover is nil") - } - if err := p.Cover.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockCover#39f23300: field cover: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockCover) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockCover#39f23300 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockCover"); err != nil { - return fmt.Errorf("unable to decode pageBlockCover#39f23300: %w", err) - } - case "cover": - value, err := DecodeTDLibJSONPageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockCover#39f23300: field cover: %w", err) - } - p.Cover = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCover returns value of Cover field. -func (p *PageBlockCover) GetCover() (value PageBlockClass) { - if p == nil { - return - } - return p.Cover -} - -// PageBlockEmbedded represents TL type `pageBlockEmbedded#8c369d9d`. -type PageBlockEmbedded struct { - // URL of the embedded page, if available - URL string - // HTML-markup of the embedded page - HTML string - // Poster photo, if available; may be null - PosterPhoto Photo - // Block width; 0 if unknown - Width int32 - // Block height; 0 if unknown - Height int32 - // Block caption - Caption PageBlockCaption - // True, if the block must be full width - IsFullWidth bool - // True, if scrolling needs to be allowed - AllowScrolling bool -} - -// PageBlockEmbeddedTypeID is TL type id of PageBlockEmbedded. -const PageBlockEmbeddedTypeID = 0x8c369d9d - -// construct implements constructor of PageBlockClass. -func (p PageBlockEmbedded) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockEmbedded. -var ( - _ bin.Encoder = &PageBlockEmbedded{} - _ bin.Decoder = &PageBlockEmbedded{} - _ bin.BareEncoder = &PageBlockEmbedded{} - _ bin.BareDecoder = &PageBlockEmbedded{} - - _ PageBlockClass = &PageBlockEmbedded{} -) - -func (p *PageBlockEmbedded) Zero() bool { - if p == nil { - return true - } - if !(p.URL == "") { - return false - } - if !(p.HTML == "") { - return false - } - if !(p.PosterPhoto.Zero()) { - return false - } - if !(p.Width == 0) { - return false - } - if !(p.Height == 0) { - return false - } - if !(p.Caption.Zero()) { - return false - } - if !(p.IsFullWidth == false) { - return false - } - if !(p.AllowScrolling == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockEmbedded) String() string { - if p == nil { - return "PageBlockEmbedded(nil)" - } - type Alias PageBlockEmbedded - return fmt.Sprintf("PageBlockEmbedded%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockEmbedded) TypeID() uint32 { - return PageBlockEmbeddedTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockEmbedded) TypeName() string { - return "pageBlockEmbedded" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockEmbedded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockEmbedded", - ID: PageBlockEmbeddedTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "HTML", - SchemaName: "html", - }, - { - Name: "PosterPhoto", - SchemaName: "poster_photo", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "IsFullWidth", - SchemaName: "is_full_width", - }, - { - Name: "AllowScrolling", - SchemaName: "allow_scrolling", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockEmbedded) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockEmbedded#8c369d9d as nil") - } - b.PutID(PageBlockEmbeddedTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockEmbedded) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockEmbedded#8c369d9d as nil") - } - b.PutString(p.URL) - b.PutString(p.HTML) - if err := p.PosterPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockEmbedded#8c369d9d: field poster_photo: %w", err) - } - b.PutInt32(p.Width) - b.PutInt32(p.Height) - if err := p.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockEmbedded#8c369d9d: field caption: %w", err) - } - b.PutBool(p.IsFullWidth) - b.PutBool(p.AllowScrolling) - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockEmbedded) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockEmbedded#8c369d9d to nil") - } - if err := b.ConsumeID(PageBlockEmbeddedTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockEmbedded) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockEmbedded#8c369d9d to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field url: %w", err) - } - p.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field html: %w", err) - } - p.HTML = value - } - { - if err := p.PosterPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field poster_photo: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field width: %w", err) - } - p.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field height: %w", err) - } - p.Height = value - } - { - if err := p.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field caption: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field is_full_width: %w", err) - } - p.IsFullWidth = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field allow_scrolling: %w", err) - } - p.AllowScrolling = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockEmbedded) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockEmbedded#8c369d9d as nil") - } - b.ObjStart() - b.PutID("pageBlockEmbedded") - b.Comma() - b.FieldStart("url") - b.PutString(p.URL) - b.Comma() - b.FieldStart("html") - b.PutString(p.HTML) - b.Comma() - b.FieldStart("poster_photo") - if err := p.PosterPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockEmbedded#8c369d9d: field poster_photo: %w", err) - } - b.Comma() - b.FieldStart("width") - b.PutInt32(p.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(p.Height) - b.Comma() - b.FieldStart("caption") - if err := p.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockEmbedded#8c369d9d: field caption: %w", err) - } - b.Comma() - b.FieldStart("is_full_width") - b.PutBool(p.IsFullWidth) - b.Comma() - b.FieldStart("allow_scrolling") - b.PutBool(p.AllowScrolling) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockEmbedded) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockEmbedded#8c369d9d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockEmbedded"); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field url: %w", err) - } - p.URL = value - case "html": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field html: %w", err) - } - p.HTML = value - case "poster_photo": - if err := p.PosterPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field poster_photo: %w", err) - } - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field width: %w", err) - } - p.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field height: %w", err) - } - p.Height = value - case "caption": - if err := p.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field caption: %w", err) - } - case "is_full_width": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field is_full_width: %w", err) - } - p.IsFullWidth = value - case "allow_scrolling": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbedded#8c369d9d: field allow_scrolling: %w", err) - } - p.AllowScrolling = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (p *PageBlockEmbedded) GetURL() (value string) { - if p == nil { - return - } - return p.URL -} - -// GetHTML returns value of HTML field. -func (p *PageBlockEmbedded) GetHTML() (value string) { - if p == nil { - return - } - return p.HTML -} - -// GetPosterPhoto returns value of PosterPhoto field. -func (p *PageBlockEmbedded) GetPosterPhoto() (value Photo) { - if p == nil { - return - } - return p.PosterPhoto -} - -// GetWidth returns value of Width field. -func (p *PageBlockEmbedded) GetWidth() (value int32) { - if p == nil { - return - } - return p.Width -} - -// GetHeight returns value of Height field. -func (p *PageBlockEmbedded) GetHeight() (value int32) { - if p == nil { - return - } - return p.Height -} - -// GetCaption returns value of Caption field. -func (p *PageBlockEmbedded) GetCaption() (value PageBlockCaption) { - if p == nil { - return - } - return p.Caption -} - -// GetIsFullWidth returns value of IsFullWidth field. -func (p *PageBlockEmbedded) GetIsFullWidth() (value bool) { - if p == nil { - return - } - return p.IsFullWidth -} - -// GetAllowScrolling returns value of AllowScrolling field. -func (p *PageBlockEmbedded) GetAllowScrolling() (value bool) { - if p == nil { - return - } - return p.AllowScrolling -} - -// PageBlockEmbeddedPost represents TL type `pageBlockEmbeddedPost#bc57cdf5`. -type PageBlockEmbeddedPost struct { - // URL of the embedded post - URL string - // Post author - Author string - // Post author photo; may be null - AuthorPhoto Photo - // Point in time (Unix timestamp) when the post was created; 0 if unknown - Date int32 - // Post content - PageBlocks []PageBlockClass - // Post caption - Caption PageBlockCaption -} - -// PageBlockEmbeddedPostTypeID is TL type id of PageBlockEmbeddedPost. -const PageBlockEmbeddedPostTypeID = 0xbc57cdf5 - -// construct implements constructor of PageBlockClass. -func (p PageBlockEmbeddedPost) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockEmbeddedPost. -var ( - _ bin.Encoder = &PageBlockEmbeddedPost{} - _ bin.Decoder = &PageBlockEmbeddedPost{} - _ bin.BareEncoder = &PageBlockEmbeddedPost{} - _ bin.BareDecoder = &PageBlockEmbeddedPost{} - - _ PageBlockClass = &PageBlockEmbeddedPost{} -) - -func (p *PageBlockEmbeddedPost) Zero() bool { - if p == nil { - return true - } - if !(p.URL == "") { - return false - } - if !(p.Author == "") { - return false - } - if !(p.AuthorPhoto.Zero()) { - return false - } - if !(p.Date == 0) { - return false - } - if !(p.PageBlocks == nil) { - return false - } - if !(p.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockEmbeddedPost) String() string { - if p == nil { - return "PageBlockEmbeddedPost(nil)" - } - type Alias PageBlockEmbeddedPost - return fmt.Sprintf("PageBlockEmbeddedPost%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockEmbeddedPost) TypeID() uint32 { - return PageBlockEmbeddedPostTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockEmbeddedPost) TypeName() string { - return "pageBlockEmbeddedPost" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockEmbeddedPost) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockEmbeddedPost", - ID: PageBlockEmbeddedPostTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Author", - SchemaName: "author", - }, - { - Name: "AuthorPhoto", - SchemaName: "author_photo", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "PageBlocks", - SchemaName: "page_blocks", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockEmbeddedPost) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockEmbeddedPost#bc57cdf5 as nil") - } - b.PutID(PageBlockEmbeddedPostTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockEmbeddedPost) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockEmbeddedPost#bc57cdf5 as nil") - } - b.PutString(p.URL) - b.PutString(p.Author) - if err := p.AuthorPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockEmbeddedPost#bc57cdf5: field author_photo: %w", err) - } - b.PutInt32(p.Date) - b.PutInt(len(p.PageBlocks)) - for idx, v := range p.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode pageBlockEmbeddedPost#bc57cdf5: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare pageBlockEmbeddedPost#bc57cdf5: field page_blocks element with index %d: %w", idx, err) - } - } - if err := p.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockEmbeddedPost#bc57cdf5: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockEmbeddedPost) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockEmbeddedPost#bc57cdf5 to nil") - } - if err := b.ConsumeID(PageBlockEmbeddedPostTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockEmbeddedPost) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockEmbeddedPost#bc57cdf5 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field url: %w", err) - } - p.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field author: %w", err) - } - p.Author = value - } - { - if err := p.AuthorPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field author_photo: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field date: %w", err) - } - p.Date = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field page_blocks: %w", err) - } - - if headerLen > 0 { - p.PageBlocks = make([]PageBlockClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field page_blocks: %w", err) - } - p.PageBlocks = append(p.PageBlocks, value) - } - } - { - if err := p.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockEmbeddedPost) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockEmbeddedPost#bc57cdf5 as nil") - } - b.ObjStart() - b.PutID("pageBlockEmbeddedPost") - b.Comma() - b.FieldStart("url") - b.PutString(p.URL) - b.Comma() - b.FieldStart("author") - b.PutString(p.Author) - b.Comma() - b.FieldStart("author_photo") - if err := p.AuthorPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockEmbeddedPost#bc57cdf5: field author_photo: %w", err) - } - b.Comma() - b.FieldStart("date") - b.PutInt32(p.Date) - b.Comma() - b.FieldStart("page_blocks") - b.ArrStart() - for idx, v := range p.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode pageBlockEmbeddedPost#bc57cdf5: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockEmbeddedPost#bc57cdf5: field page_blocks element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("caption") - if err := p.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockEmbeddedPost#bc57cdf5: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockEmbeddedPost) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockEmbeddedPost#bc57cdf5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockEmbeddedPost"); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field url: %w", err) - } - p.URL = value - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field author: %w", err) - } - p.Author = value - case "author_photo": - if err := p.AuthorPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field author_photo: %w", err) - } - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field date: %w", err) - } - p.Date = value - case "page_blocks": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field page_blocks: %w", err) - } - p.PageBlocks = append(p.PageBlocks, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field page_blocks: %w", err) - } - case "caption": - if err := p.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockEmbeddedPost#bc57cdf5: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (p *PageBlockEmbeddedPost) GetURL() (value string) { - if p == nil { - return - } - return p.URL -} - -// GetAuthor returns value of Author field. -func (p *PageBlockEmbeddedPost) GetAuthor() (value string) { - if p == nil { - return - } - return p.Author -} - -// GetAuthorPhoto returns value of AuthorPhoto field. -func (p *PageBlockEmbeddedPost) GetAuthorPhoto() (value Photo) { - if p == nil { - return - } - return p.AuthorPhoto -} - -// GetDate returns value of Date field. -func (p *PageBlockEmbeddedPost) GetDate() (value int32) { - if p == nil { - return - } - return p.Date -} - -// GetPageBlocks returns value of PageBlocks field. -func (p *PageBlockEmbeddedPost) GetPageBlocks() (value []PageBlockClass) { - if p == nil { - return - } - return p.PageBlocks -} - -// GetCaption returns value of Caption field. -func (p *PageBlockEmbeddedPost) GetCaption() (value PageBlockCaption) { - if p == nil { - return - } - return p.Caption -} - -// PageBlockCollage represents TL type `pageBlockCollage#40bcaaf0`. -type PageBlockCollage struct { - // Collage item contents - PageBlocks []PageBlockClass - // Block caption - Caption PageBlockCaption -} - -// PageBlockCollageTypeID is TL type id of PageBlockCollage. -const PageBlockCollageTypeID = 0x40bcaaf0 - -// construct implements constructor of PageBlockClass. -func (p PageBlockCollage) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockCollage. -var ( - _ bin.Encoder = &PageBlockCollage{} - _ bin.Decoder = &PageBlockCollage{} - _ bin.BareEncoder = &PageBlockCollage{} - _ bin.BareDecoder = &PageBlockCollage{} - - _ PageBlockClass = &PageBlockCollage{} -) - -func (p *PageBlockCollage) Zero() bool { - if p == nil { - return true - } - if !(p.PageBlocks == nil) { - return false - } - if !(p.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockCollage) String() string { - if p == nil { - return "PageBlockCollage(nil)" - } - type Alias PageBlockCollage - return fmt.Sprintf("PageBlockCollage%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockCollage) TypeID() uint32 { - return PageBlockCollageTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockCollage) TypeName() string { - return "pageBlockCollage" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockCollage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockCollage", - ID: PageBlockCollageTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PageBlocks", - SchemaName: "page_blocks", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockCollage) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockCollage#40bcaaf0 as nil") - } - b.PutID(PageBlockCollageTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockCollage) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockCollage#40bcaaf0 as nil") - } - b.PutInt(len(p.PageBlocks)) - for idx, v := range p.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode pageBlockCollage#40bcaaf0: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare pageBlockCollage#40bcaaf0: field page_blocks element with index %d: %w", idx, err) - } - } - if err := p.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockCollage#40bcaaf0: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockCollage) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockCollage#40bcaaf0 to nil") - } - if err := b.ConsumeID(PageBlockCollageTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockCollage#40bcaaf0: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockCollage) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockCollage#40bcaaf0 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode pageBlockCollage#40bcaaf0: field page_blocks: %w", err) - } - - if headerLen > 0 { - p.PageBlocks = make([]PageBlockClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockCollage#40bcaaf0: field page_blocks: %w", err) - } - p.PageBlocks = append(p.PageBlocks, value) - } - } - { - if err := p.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockCollage#40bcaaf0: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockCollage) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockCollage#40bcaaf0 as nil") - } - b.ObjStart() - b.PutID("pageBlockCollage") - b.Comma() - b.FieldStart("page_blocks") - b.ArrStart() - for idx, v := range p.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode pageBlockCollage#40bcaaf0: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockCollage#40bcaaf0: field page_blocks element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("caption") - if err := p.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockCollage#40bcaaf0: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockCollage) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockCollage#40bcaaf0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockCollage"); err != nil { - return fmt.Errorf("unable to decode pageBlockCollage#40bcaaf0: %w", err) - } - case "page_blocks": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockCollage#40bcaaf0: field page_blocks: %w", err) - } - p.PageBlocks = append(p.PageBlocks, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode pageBlockCollage#40bcaaf0: field page_blocks: %w", err) - } - case "caption": - if err := p.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockCollage#40bcaaf0: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPageBlocks returns value of PageBlocks field. -func (p *PageBlockCollage) GetPageBlocks() (value []PageBlockClass) { - if p == nil { - return - } - return p.PageBlocks -} - -// GetCaption returns value of Caption field. -func (p *PageBlockCollage) GetCaption() (value PageBlockCaption) { - if p == nil { - return - } - return p.Caption -} - -// PageBlockSlideshow represents TL type `pageBlockSlideshow#1107d496`. -type PageBlockSlideshow struct { - // Slideshow item contents - PageBlocks []PageBlockClass - // Block caption - Caption PageBlockCaption -} - -// PageBlockSlideshowTypeID is TL type id of PageBlockSlideshow. -const PageBlockSlideshowTypeID = 0x1107d496 - -// construct implements constructor of PageBlockClass. -func (p PageBlockSlideshow) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockSlideshow. -var ( - _ bin.Encoder = &PageBlockSlideshow{} - _ bin.Decoder = &PageBlockSlideshow{} - _ bin.BareEncoder = &PageBlockSlideshow{} - _ bin.BareDecoder = &PageBlockSlideshow{} - - _ PageBlockClass = &PageBlockSlideshow{} -) - -func (p *PageBlockSlideshow) Zero() bool { - if p == nil { - return true - } - if !(p.PageBlocks == nil) { - return false - } - if !(p.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockSlideshow) String() string { - if p == nil { - return "PageBlockSlideshow(nil)" - } - type Alias PageBlockSlideshow - return fmt.Sprintf("PageBlockSlideshow%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockSlideshow) TypeID() uint32 { - return PageBlockSlideshowTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockSlideshow) TypeName() string { - return "pageBlockSlideshow" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockSlideshow) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockSlideshow", - ID: PageBlockSlideshowTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PageBlocks", - SchemaName: "page_blocks", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockSlideshow) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockSlideshow#1107d496 as nil") - } - b.PutID(PageBlockSlideshowTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockSlideshow) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockSlideshow#1107d496 as nil") - } - b.PutInt(len(p.PageBlocks)) - for idx, v := range p.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode pageBlockSlideshow#1107d496: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare pageBlockSlideshow#1107d496: field page_blocks element with index %d: %w", idx, err) - } - } - if err := p.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockSlideshow#1107d496: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockSlideshow) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockSlideshow#1107d496 to nil") - } - if err := b.ConsumeID(PageBlockSlideshowTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockSlideshow#1107d496: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockSlideshow) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockSlideshow#1107d496 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode pageBlockSlideshow#1107d496: field page_blocks: %w", err) - } - - if headerLen > 0 { - p.PageBlocks = make([]PageBlockClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockSlideshow#1107d496: field page_blocks: %w", err) - } - p.PageBlocks = append(p.PageBlocks, value) - } - } - { - if err := p.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockSlideshow#1107d496: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockSlideshow) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockSlideshow#1107d496 as nil") - } - b.ObjStart() - b.PutID("pageBlockSlideshow") - b.Comma() - b.FieldStart("page_blocks") - b.ArrStart() - for idx, v := range p.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode pageBlockSlideshow#1107d496: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockSlideshow#1107d496: field page_blocks element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("caption") - if err := p.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockSlideshow#1107d496: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockSlideshow) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockSlideshow#1107d496 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockSlideshow"); err != nil { - return fmt.Errorf("unable to decode pageBlockSlideshow#1107d496: %w", err) - } - case "page_blocks": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockSlideshow#1107d496: field page_blocks: %w", err) - } - p.PageBlocks = append(p.PageBlocks, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode pageBlockSlideshow#1107d496: field page_blocks: %w", err) - } - case "caption": - if err := p.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockSlideshow#1107d496: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPageBlocks returns value of PageBlocks field. -func (p *PageBlockSlideshow) GetPageBlocks() (value []PageBlockClass) { - if p == nil { - return - } - return p.PageBlocks -} - -// GetCaption returns value of Caption field. -func (p *PageBlockSlideshow) GetCaption() (value PageBlockCaption) { - if p == nil { - return - } - return p.Caption -} - -// PageBlockChatLink represents TL type `pageBlockChatLink#621ed8bb`. -type PageBlockChatLink struct { - // Chat title - Title string - // Chat photo; may be null - Photo ChatPhotoInfo - // Identifier of the accent color for chat title and background of chat photo - AccentColorID int32 - // Chat username by which all other information about the chat can be resolved - Username string -} - -// PageBlockChatLinkTypeID is TL type id of PageBlockChatLink. -const PageBlockChatLinkTypeID = 0x621ed8bb - -// construct implements constructor of PageBlockClass. -func (p PageBlockChatLink) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockChatLink. -var ( - _ bin.Encoder = &PageBlockChatLink{} - _ bin.Decoder = &PageBlockChatLink{} - _ bin.BareEncoder = &PageBlockChatLink{} - _ bin.BareDecoder = &PageBlockChatLink{} - - _ PageBlockClass = &PageBlockChatLink{} -) - -func (p *PageBlockChatLink) Zero() bool { - if p == nil { - return true - } - if !(p.Title == "") { - return false - } - if !(p.Photo.Zero()) { - return false - } - if !(p.AccentColorID == 0) { - return false - } - if !(p.Username == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockChatLink) String() string { - if p == nil { - return "PageBlockChatLink(nil)" - } - type Alias PageBlockChatLink - return fmt.Sprintf("PageBlockChatLink%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockChatLink) TypeID() uint32 { - return PageBlockChatLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockChatLink) TypeName() string { - return "pageBlockChatLink" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockChatLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockChatLink", - ID: PageBlockChatLinkTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "AccentColorID", - SchemaName: "accent_color_id", - }, - { - Name: "Username", - SchemaName: "username", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockChatLink) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockChatLink#621ed8bb as nil") - } - b.PutID(PageBlockChatLinkTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockChatLink) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockChatLink#621ed8bb as nil") - } - b.PutString(p.Title) - if err := p.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockChatLink#621ed8bb: field photo: %w", err) - } - b.PutInt32(p.AccentColorID) - b.PutString(p.Username) - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockChatLink) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockChatLink#621ed8bb to nil") - } - if err := b.ConsumeID(PageBlockChatLinkTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockChatLink#621ed8bb: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockChatLink) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockChatLink#621ed8bb to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockChatLink#621ed8bb: field title: %w", err) - } - p.Title = value - } - { - if err := p.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockChatLink#621ed8bb: field photo: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockChatLink#621ed8bb: field accent_color_id: %w", err) - } - p.AccentColorID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockChatLink#621ed8bb: field username: %w", err) - } - p.Username = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockChatLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockChatLink#621ed8bb as nil") - } - b.ObjStart() - b.PutID("pageBlockChatLink") - b.Comma() - b.FieldStart("title") - b.PutString(p.Title) - b.Comma() - b.FieldStart("photo") - if err := p.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockChatLink#621ed8bb: field photo: %w", err) - } - b.Comma() - b.FieldStart("accent_color_id") - b.PutInt32(p.AccentColorID) - b.Comma() - b.FieldStart("username") - b.PutString(p.Username) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockChatLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockChatLink#621ed8bb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockChatLink"); err != nil { - return fmt.Errorf("unable to decode pageBlockChatLink#621ed8bb: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockChatLink#621ed8bb: field title: %w", err) - } - p.Title = value - case "photo": - if err := p.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockChatLink#621ed8bb: field photo: %w", err) - } - case "accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockChatLink#621ed8bb: field accent_color_id: %w", err) - } - p.AccentColorID = value - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockChatLink#621ed8bb: field username: %w", err) - } - p.Username = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (p *PageBlockChatLink) GetTitle() (value string) { - if p == nil { - return - } - return p.Title -} - -// GetPhoto returns value of Photo field. -func (p *PageBlockChatLink) GetPhoto() (value ChatPhotoInfo) { - if p == nil { - return - } - return p.Photo -} - -// GetAccentColorID returns value of AccentColorID field. -func (p *PageBlockChatLink) GetAccentColorID() (value int32) { - if p == nil { - return - } - return p.AccentColorID -} - -// GetUsername returns value of Username field. -func (p *PageBlockChatLink) GetUsername() (value string) { - if p == nil { - return - } - return p.Username -} - -// PageBlockTable represents TL type `pageBlockTable#cc6352c3`. -type PageBlockTable struct { - // Table caption - Caption RichTextClass - // Table cells - Cells [][]PageBlockTableCell - // True, if the table is bordered - IsBordered bool - // True, if the table is striped - IsStriped bool -} - -// PageBlockTableTypeID is TL type id of PageBlockTable. -const PageBlockTableTypeID = 0xcc6352c3 - -// construct implements constructor of PageBlockClass. -func (p PageBlockTable) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockTable. -var ( - _ bin.Encoder = &PageBlockTable{} - _ bin.Decoder = &PageBlockTable{} - _ bin.BareEncoder = &PageBlockTable{} - _ bin.BareDecoder = &PageBlockTable{} - - _ PageBlockClass = &PageBlockTable{} -) - -func (p *PageBlockTable) Zero() bool { - if p == nil { - return true - } - if !(p.Caption == nil) { - return false - } - if !(p.Cells == nil) { - return false - } - if !(p.IsBordered == false) { - return false - } - if !(p.IsStriped == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockTable) String() string { - if p == nil { - return "PageBlockTable(nil)" - } - type Alias PageBlockTable - return fmt.Sprintf("PageBlockTable%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockTable) TypeID() uint32 { - return PageBlockTableTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockTable) TypeName() string { - return "pageBlockTable" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockTable) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockTable", - ID: PageBlockTableTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "Cells", - SchemaName: "cells", - }, - { - Name: "IsBordered", - SchemaName: "is_bordered", - }, - { - Name: "IsStriped", - SchemaName: "is_striped", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockTable) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockTable#cc6352c3 as nil") - } - b.PutID(PageBlockTableTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockTable) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockTable#cc6352c3 as nil") - } - if p.Caption == nil { - return fmt.Errorf("unable to encode pageBlockTable#cc6352c3: field caption is nil") - } - if err := p.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockTable#cc6352c3: field caption: %w", err) - } - b.PutInt(len(p.Cells)) - for idx, row := range p.Cells { - b.PutVectorHeader(len(row)) - for _, v := range row { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare pageBlockTable#cc6352c3: field cells element with index %d: %w", idx, err) - } - } - } - b.PutBool(p.IsBordered) - b.PutBool(p.IsStriped) - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockTable) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockTable#cc6352c3 to nil") - } - if err := b.ConsumeID(PageBlockTableTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockTable) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockTable#cc6352c3 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: field caption: %w", err) - } - p.Caption = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: field cells: %w", err) - } - - if headerLen > 0 { - p.Cells = make([][]PageBlockTableCell, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - innerLen, err := b.VectorHeader() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: field cells: %w", err) - } - - var row []PageBlockTableCell - if innerLen > 0 { - row = make([]PageBlockTableCell, 0, innerLen%bin.PreallocateLimit) - } - for innerIndex := 0; innerIndex < innerLen; innerLen++ { - var value PageBlockTableCell - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare pageBlockTable#cc6352c3: field cells: %w", err) - } - row = append(row, value) - } - p.Cells = append(p.Cells, row) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: field is_bordered: %w", err) - } - p.IsBordered = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: field is_striped: %w", err) - } - p.IsStriped = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockTable) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockTable#cc6352c3 as nil") - } - b.ObjStart() - b.PutID("pageBlockTable") - b.Comma() - b.FieldStart("caption") - if p.Caption == nil { - return fmt.Errorf("unable to encode pageBlockTable#cc6352c3: field caption is nil") - } - if err := p.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockTable#cc6352c3: field caption: %w", err) - } - b.Comma() - b.FieldStart("cells") - b.ArrStart() - for idx, row := range p.Cells { - b.ArrStart() - for _, v := range row { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockTable#cc6352c3: field cells element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("is_bordered") - b.PutBool(p.IsBordered) - b.Comma() - b.FieldStart("is_striped") - b.PutBool(p.IsStriped) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockTable) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockTable#cc6352c3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockTable"); err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: %w", err) - } - case "caption": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: field caption: %w", err) - } - p.Caption = value - case "cells": - if err := b.Arr(func(b tdjson.Decoder) error { - var row []PageBlockTableCell - if err := b.Arr(func(b tdjson.Decoder) error { - var value PageBlockTableCell - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: field cells: %w", err) - } - row = append(row, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: field cells: %w", err) - } - p.Cells = append(p.Cells, row) - return nil - }); err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: field cells: %w", err) - } - case "is_bordered": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: field is_bordered: %w", err) - } - p.IsBordered = value - case "is_striped": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTable#cc6352c3: field is_striped: %w", err) - } - p.IsStriped = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCaption returns value of Caption field. -func (p *PageBlockTable) GetCaption() (value RichTextClass) { - if p == nil { - return - } - return p.Caption -} - -// GetCells returns value of Cells field. -func (p *PageBlockTable) GetCells() (value [][]PageBlockTableCell) { - if p == nil { - return - } - return p.Cells -} - -// GetIsBordered returns value of IsBordered field. -func (p *PageBlockTable) GetIsBordered() (value bool) { - if p == nil { - return - } - return p.IsBordered -} - -// GetIsStriped returns value of IsStriped field. -func (p *PageBlockTable) GetIsStriped() (value bool) { - if p == nil { - return - } - return p.IsStriped -} - -// PageBlockDetails represents TL type `pageBlockDetails#990a0c0b`. -type PageBlockDetails struct { - // Always visible heading for the block - Header RichTextClass - // Block contents - PageBlocks []PageBlockClass - // True, if the block is open by default - IsOpen bool -} - -// PageBlockDetailsTypeID is TL type id of PageBlockDetails. -const PageBlockDetailsTypeID = 0x990a0c0b - -// construct implements constructor of PageBlockClass. -func (p PageBlockDetails) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockDetails. -var ( - _ bin.Encoder = &PageBlockDetails{} - _ bin.Decoder = &PageBlockDetails{} - _ bin.BareEncoder = &PageBlockDetails{} - _ bin.BareDecoder = &PageBlockDetails{} - - _ PageBlockClass = &PageBlockDetails{} -) - -func (p *PageBlockDetails) Zero() bool { - if p == nil { - return true - } - if !(p.Header == nil) { - return false - } - if !(p.PageBlocks == nil) { - return false - } - if !(p.IsOpen == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockDetails) String() string { - if p == nil { - return "PageBlockDetails(nil)" - } - type Alias PageBlockDetails - return fmt.Sprintf("PageBlockDetails%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockDetails) TypeID() uint32 { - return PageBlockDetailsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockDetails) TypeName() string { - return "pageBlockDetails" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockDetails) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockDetails", - ID: PageBlockDetailsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Header", - SchemaName: "header", - }, - { - Name: "PageBlocks", - SchemaName: "page_blocks", - }, - { - Name: "IsOpen", - SchemaName: "is_open", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockDetails) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockDetails#990a0c0b as nil") - } - b.PutID(PageBlockDetailsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockDetails) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockDetails#990a0c0b as nil") - } - if p.Header == nil { - return fmt.Errorf("unable to encode pageBlockDetails#990a0c0b: field header is nil") - } - if err := p.Header.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockDetails#990a0c0b: field header: %w", err) - } - b.PutInt(len(p.PageBlocks)) - for idx, v := range p.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode pageBlockDetails#990a0c0b: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare pageBlockDetails#990a0c0b: field page_blocks element with index %d: %w", idx, err) - } - } - b.PutBool(p.IsOpen) - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockDetails) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockDetails#990a0c0b to nil") - } - if err := b.ConsumeID(PageBlockDetailsTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockDetails#990a0c0b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockDetails) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockDetails#990a0c0b to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockDetails#990a0c0b: field header: %w", err) - } - p.Header = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode pageBlockDetails#990a0c0b: field page_blocks: %w", err) - } - - if headerLen > 0 { - p.PageBlocks = make([]PageBlockClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockDetails#990a0c0b: field page_blocks: %w", err) - } - p.PageBlocks = append(p.PageBlocks, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockDetails#990a0c0b: field is_open: %w", err) - } - p.IsOpen = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockDetails) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockDetails#990a0c0b as nil") - } - b.ObjStart() - b.PutID("pageBlockDetails") - b.Comma() - b.FieldStart("header") - if p.Header == nil { - return fmt.Errorf("unable to encode pageBlockDetails#990a0c0b: field header is nil") - } - if err := p.Header.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockDetails#990a0c0b: field header: %w", err) - } - b.Comma() - b.FieldStart("page_blocks") - b.ArrStart() - for idx, v := range p.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode pageBlockDetails#990a0c0b: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockDetails#990a0c0b: field page_blocks element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("is_open") - b.PutBool(p.IsOpen) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockDetails) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockDetails#990a0c0b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockDetails"); err != nil { - return fmt.Errorf("unable to decode pageBlockDetails#990a0c0b: %w", err) - } - case "header": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockDetails#990a0c0b: field header: %w", err) - } - p.Header = value - case "page_blocks": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockDetails#990a0c0b: field page_blocks: %w", err) - } - p.PageBlocks = append(p.PageBlocks, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode pageBlockDetails#990a0c0b: field page_blocks: %w", err) - } - case "is_open": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockDetails#990a0c0b: field is_open: %w", err) - } - p.IsOpen = value - default: - return b.Skip() - } - return nil - }) -} - -// GetHeader returns value of Header field. -func (p *PageBlockDetails) GetHeader() (value RichTextClass) { - if p == nil { - return - } - return p.Header -} - -// GetPageBlocks returns value of PageBlocks field. -func (p *PageBlockDetails) GetPageBlocks() (value []PageBlockClass) { - if p == nil { - return - } - return p.PageBlocks -} - -// GetIsOpen returns value of IsOpen field. -func (p *PageBlockDetails) GetIsOpen() (value bool) { - if p == nil { - return - } - return p.IsOpen -} - -// PageBlockRelatedArticles represents TL type `pageBlockRelatedArticles#936d81e6`. -type PageBlockRelatedArticles struct { - // Block header - Header RichTextClass - // List of related articles - Articles []PageBlockRelatedArticle -} - -// PageBlockRelatedArticlesTypeID is TL type id of PageBlockRelatedArticles. -const PageBlockRelatedArticlesTypeID = 0x936d81e6 - -// construct implements constructor of PageBlockClass. -func (p PageBlockRelatedArticles) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockRelatedArticles. -var ( - _ bin.Encoder = &PageBlockRelatedArticles{} - _ bin.Decoder = &PageBlockRelatedArticles{} - _ bin.BareEncoder = &PageBlockRelatedArticles{} - _ bin.BareDecoder = &PageBlockRelatedArticles{} - - _ PageBlockClass = &PageBlockRelatedArticles{} -) - -func (p *PageBlockRelatedArticles) Zero() bool { - if p == nil { - return true - } - if !(p.Header == nil) { - return false - } - if !(p.Articles == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockRelatedArticles) String() string { - if p == nil { - return "PageBlockRelatedArticles(nil)" - } - type Alias PageBlockRelatedArticles - return fmt.Sprintf("PageBlockRelatedArticles%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockRelatedArticles) TypeID() uint32 { - return PageBlockRelatedArticlesTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockRelatedArticles) TypeName() string { - return "pageBlockRelatedArticles" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockRelatedArticles) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockRelatedArticles", - ID: PageBlockRelatedArticlesTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Header", - SchemaName: "header", - }, - { - Name: "Articles", - SchemaName: "articles", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockRelatedArticles) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockRelatedArticles#936d81e6 as nil") - } - b.PutID(PageBlockRelatedArticlesTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockRelatedArticles) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockRelatedArticles#936d81e6 as nil") - } - if p.Header == nil { - return fmt.Errorf("unable to encode pageBlockRelatedArticles#936d81e6: field header is nil") - } - if err := p.Header.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockRelatedArticles#936d81e6: field header: %w", err) - } - b.PutInt(len(p.Articles)) - for idx, v := range p.Articles { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare pageBlockRelatedArticles#936d81e6: field articles element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockRelatedArticles) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockRelatedArticles#936d81e6 to nil") - } - if err := b.ConsumeID(PageBlockRelatedArticlesTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticles#936d81e6: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockRelatedArticles) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockRelatedArticles#936d81e6 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticles#936d81e6: field header: %w", err) - } - p.Header = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticles#936d81e6: field articles: %w", err) - } - - if headerLen > 0 { - p.Articles = make([]PageBlockRelatedArticle, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PageBlockRelatedArticle - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare pageBlockRelatedArticles#936d81e6: field articles: %w", err) - } - p.Articles = append(p.Articles, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockRelatedArticles) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockRelatedArticles#936d81e6 as nil") - } - b.ObjStart() - b.PutID("pageBlockRelatedArticles") - b.Comma() - b.FieldStart("header") - if p.Header == nil { - return fmt.Errorf("unable to encode pageBlockRelatedArticles#936d81e6: field header is nil") - } - if err := p.Header.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockRelatedArticles#936d81e6: field header: %w", err) - } - b.Comma() - b.FieldStart("articles") - b.ArrStart() - for idx, v := range p.Articles { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockRelatedArticles#936d81e6: field articles element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockRelatedArticles) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockRelatedArticles#936d81e6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockRelatedArticles"); err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticles#936d81e6: %w", err) - } - case "header": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticles#936d81e6: field header: %w", err) - } - p.Header = value - case "articles": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PageBlockRelatedArticle - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticles#936d81e6: field articles: %w", err) - } - p.Articles = append(p.Articles, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticles#936d81e6: field articles: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetHeader returns value of Header field. -func (p *PageBlockRelatedArticles) GetHeader() (value RichTextClass) { - if p == nil { - return - } - return p.Header -} - -// GetArticles returns value of Articles field. -func (p *PageBlockRelatedArticles) GetArticles() (value []PageBlockRelatedArticle) { - if p == nil { - return - } - return p.Articles -} - -// PageBlockMap represents TL type `pageBlockMap#5a0f7013`. -type PageBlockMap struct { - // Location of the map center - Location Location - // Map zoom level - Zoom int32 - // Map width - Width int32 - // Map height - Height int32 - // Block caption - Caption PageBlockCaption -} - -// PageBlockMapTypeID is TL type id of PageBlockMap. -const PageBlockMapTypeID = 0x5a0f7013 - -// construct implements constructor of PageBlockClass. -func (p PageBlockMap) construct() PageBlockClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockMap. -var ( - _ bin.Encoder = &PageBlockMap{} - _ bin.Decoder = &PageBlockMap{} - _ bin.BareEncoder = &PageBlockMap{} - _ bin.BareDecoder = &PageBlockMap{} - - _ PageBlockClass = &PageBlockMap{} -) - -func (p *PageBlockMap) Zero() bool { - if p == nil { - return true - } - if !(p.Location.Zero()) { - return false - } - if !(p.Zoom == 0) { - return false - } - if !(p.Width == 0) { - return false - } - if !(p.Height == 0) { - return false - } - if !(p.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockMap) String() string { - if p == nil { - return "PageBlockMap(nil)" - } - type Alias PageBlockMap - return fmt.Sprintf("PageBlockMap%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockMap) TypeID() uint32 { - return PageBlockMapTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockMap) TypeName() string { - return "pageBlockMap" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockMap) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockMap", - ID: PageBlockMapTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "Zoom", - SchemaName: "zoom", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockMap) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockMap#5a0f7013 as nil") - } - b.PutID(PageBlockMapTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockMap) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockMap#5a0f7013 as nil") - } - if err := p.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockMap#5a0f7013: field location: %w", err) - } - b.PutInt32(p.Zoom) - b.PutInt32(p.Width) - b.PutInt32(p.Height) - if err := p.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockMap#5a0f7013: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockMap) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockMap#5a0f7013 to nil") - } - if err := b.ConsumeID(PageBlockMapTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockMap) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockMap#5a0f7013 to nil") - } - { - if err := p.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: field location: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: field zoom: %w", err) - } - p.Zoom = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: field width: %w", err) - } - p.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: field height: %w", err) - } - p.Height = value - } - { - if err := p.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockMap) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockMap#5a0f7013 as nil") - } - b.ObjStart() - b.PutID("pageBlockMap") - b.Comma() - b.FieldStart("location") - if err := p.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockMap#5a0f7013: field location: %w", err) - } - b.Comma() - b.FieldStart("zoom") - b.PutInt32(p.Zoom) - b.Comma() - b.FieldStart("width") - b.PutInt32(p.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(p.Height) - b.Comma() - b.FieldStart("caption") - if err := p.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockMap#5a0f7013: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockMap) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockMap#5a0f7013 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockMap"); err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: %w", err) - } - case "location": - if err := p.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: field location: %w", err) - } - case "zoom": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: field zoom: %w", err) - } - p.Zoom = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: field width: %w", err) - } - p.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: field height: %w", err) - } - p.Height = value - case "caption": - if err := p.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockMap#5a0f7013: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (p *PageBlockMap) GetLocation() (value Location) { - if p == nil { - return - } - return p.Location -} - -// GetZoom returns value of Zoom field. -func (p *PageBlockMap) GetZoom() (value int32) { - if p == nil { - return - } - return p.Zoom -} - -// GetWidth returns value of Width field. -func (p *PageBlockMap) GetWidth() (value int32) { - if p == nil { - return - } - return p.Width -} - -// GetHeight returns value of Height field. -func (p *PageBlockMap) GetHeight() (value int32) { - if p == nil { - return - } - return p.Height -} - -// GetCaption returns value of Caption field. -func (p *PageBlockMap) GetCaption() (value PageBlockCaption) { - if p == nil { - return - } - return p.Caption -} - -// PageBlockClassName is schema name of PageBlockClass. -const PageBlockClassName = "PageBlock" - -// PageBlockClass represents PageBlock generic type. -// -// Example: -// -// g, err := tdapi.DecodePageBlock(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PageBlockTitle: // pageBlockTitle#6122b610 -// case *tdapi.PageBlockSubtitle: // pageBlockSubtitle#fc451e7 -// case *tdapi.PageBlockAuthorDate: // pageBlockAuthorDate#4d7ff410 -// case *tdapi.PageBlockHeader: // pageBlockHeader#539ddd9b -// case *tdapi.PageBlockSubheader: // pageBlockSubheader#4b567326 -// case *tdapi.PageBlockKicker: // pageBlockKicker#5123864b -// case *tdapi.PageBlockParagraph: // pageBlockParagraph#467a0766 -// case *tdapi.PageBlockPreformatted: // pageBlockPreformatted#c070d93e -// case *tdapi.PageBlockFooter: // pageBlockFooter#34d5d728 -// case *tdapi.PageBlockDivider: // pageBlockDivider#db20b188 -// case *tdapi.PageBlockAnchor: // pageBlockAnchor#ce0d37b0 -// case *tdapi.PageBlockList: // pageBlockList#584af35a -// case *tdapi.PageBlockBlockQuote: // pageBlockBlockQuote#62d08a9e -// case *tdapi.PageBlockPullQuote: // pageBlockPullQuote#1d38810d -// case *tdapi.PageBlockAnimation: // pageBlockAnimation#50cde009 -// case *tdapi.PageBlockAudio: // pageBlockAudio#fc390813 -// case *tdapi.PageBlockPhoto: // pageBlockPhoto#18e41684 -// case *tdapi.PageBlockVideo: // pageBlockVideo#1e669d32 -// case *tdapi.PageBlockVoiceNote: // pageBlockVoiceNote#6cad827f -// case *tdapi.PageBlockCover: // pageBlockCover#39f23300 -// case *tdapi.PageBlockEmbedded: // pageBlockEmbedded#8c369d9d -// case *tdapi.PageBlockEmbeddedPost: // pageBlockEmbeddedPost#bc57cdf5 -// case *tdapi.PageBlockCollage: // pageBlockCollage#40bcaaf0 -// case *tdapi.PageBlockSlideshow: // pageBlockSlideshow#1107d496 -// case *tdapi.PageBlockChatLink: // pageBlockChatLink#621ed8bb -// case *tdapi.PageBlockTable: // pageBlockTable#cc6352c3 -// case *tdapi.PageBlockDetails: // pageBlockDetails#990a0c0b -// case *tdapi.PageBlockRelatedArticles: // pageBlockRelatedArticles#936d81e6 -// case *tdapi.PageBlockMap: // pageBlockMap#5a0f7013 -// default: panic(v) -// } -type PageBlockClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PageBlockClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePageBlock implements binary de-serialization for PageBlockClass. -func DecodePageBlock(buf *bin.Buffer) (PageBlockClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PageBlockTitleTypeID: - // Decoding pageBlockTitle#6122b610. - v := PageBlockTitle{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockSubtitleTypeID: - // Decoding pageBlockSubtitle#fc451e7. - v := PageBlockSubtitle{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockAuthorDateTypeID: - // Decoding pageBlockAuthorDate#4d7ff410. - v := PageBlockAuthorDate{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockHeaderTypeID: - // Decoding pageBlockHeader#539ddd9b. - v := PageBlockHeader{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockSubheaderTypeID: - // Decoding pageBlockSubheader#4b567326. - v := PageBlockSubheader{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockKickerTypeID: - // Decoding pageBlockKicker#5123864b. - v := PageBlockKicker{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockParagraphTypeID: - // Decoding pageBlockParagraph#467a0766. - v := PageBlockParagraph{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockPreformattedTypeID: - // Decoding pageBlockPreformatted#c070d93e. - v := PageBlockPreformatted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockFooterTypeID: - // Decoding pageBlockFooter#34d5d728. - v := PageBlockFooter{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockDividerTypeID: - // Decoding pageBlockDivider#db20b188. - v := PageBlockDivider{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockAnchorTypeID: - // Decoding pageBlockAnchor#ce0d37b0. - v := PageBlockAnchor{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockListTypeID: - // Decoding pageBlockList#584af35a. - v := PageBlockList{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockBlockQuoteTypeID: - // Decoding pageBlockBlockQuote#62d08a9e. - v := PageBlockBlockQuote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockPullQuoteTypeID: - // Decoding pageBlockPullQuote#1d38810d. - v := PageBlockPullQuote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockAnimationTypeID: - // Decoding pageBlockAnimation#50cde009. - v := PageBlockAnimation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockAudioTypeID: - // Decoding pageBlockAudio#fc390813. - v := PageBlockAudio{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockPhotoTypeID: - // Decoding pageBlockPhoto#18e41684. - v := PageBlockPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockVideoTypeID: - // Decoding pageBlockVideo#1e669d32. - v := PageBlockVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockVoiceNoteTypeID: - // Decoding pageBlockVoiceNote#6cad827f. - v := PageBlockVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockCoverTypeID: - // Decoding pageBlockCover#39f23300. - v := PageBlockCover{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockEmbeddedTypeID: - // Decoding pageBlockEmbedded#8c369d9d. - v := PageBlockEmbedded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockEmbeddedPostTypeID: - // Decoding pageBlockEmbeddedPost#bc57cdf5. - v := PageBlockEmbeddedPost{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockCollageTypeID: - // Decoding pageBlockCollage#40bcaaf0. - v := PageBlockCollage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockSlideshowTypeID: - // Decoding pageBlockSlideshow#1107d496. - v := PageBlockSlideshow{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockChatLinkTypeID: - // Decoding pageBlockChatLink#621ed8bb. - v := PageBlockChatLink{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockTableTypeID: - // Decoding pageBlockTable#cc6352c3. - v := PageBlockTable{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockDetailsTypeID: - // Decoding pageBlockDetails#990a0c0b. - v := PageBlockDetails{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockRelatedArticlesTypeID: - // Decoding pageBlockRelatedArticles#936d81e6. - v := PageBlockRelatedArticles{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case PageBlockMapTypeID: - // Decoding pageBlockMap#5a0f7013. - v := PageBlockMap{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPageBlock implements binary de-serialization for PageBlockClass. -func DecodeTDLibJSONPageBlock(buf tdjson.Decoder) (PageBlockClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "pageBlockTitle": - // Decoding pageBlockTitle#6122b610. - v := PageBlockTitle{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockSubtitle": - // Decoding pageBlockSubtitle#fc451e7. - v := PageBlockSubtitle{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockAuthorDate": - // Decoding pageBlockAuthorDate#4d7ff410. - v := PageBlockAuthorDate{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockHeader": - // Decoding pageBlockHeader#539ddd9b. - v := PageBlockHeader{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockSubheader": - // Decoding pageBlockSubheader#4b567326. - v := PageBlockSubheader{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockKicker": - // Decoding pageBlockKicker#5123864b. - v := PageBlockKicker{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockParagraph": - // Decoding pageBlockParagraph#467a0766. - v := PageBlockParagraph{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockPreformatted": - // Decoding pageBlockPreformatted#c070d93e. - v := PageBlockPreformatted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockFooter": - // Decoding pageBlockFooter#34d5d728. - v := PageBlockFooter{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockDivider": - // Decoding pageBlockDivider#db20b188. - v := PageBlockDivider{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockAnchor": - // Decoding pageBlockAnchor#ce0d37b0. - v := PageBlockAnchor{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockList": - // Decoding pageBlockList#584af35a. - v := PageBlockList{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockBlockQuote": - // Decoding pageBlockBlockQuote#62d08a9e. - v := PageBlockBlockQuote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockPullQuote": - // Decoding pageBlockPullQuote#1d38810d. - v := PageBlockPullQuote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockAnimation": - // Decoding pageBlockAnimation#50cde009. - v := PageBlockAnimation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockAudio": - // Decoding pageBlockAudio#fc390813. - v := PageBlockAudio{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockPhoto": - // Decoding pageBlockPhoto#18e41684. - v := PageBlockPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockVideo": - // Decoding pageBlockVideo#1e669d32. - v := PageBlockVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockVoiceNote": - // Decoding pageBlockVoiceNote#6cad827f. - v := PageBlockVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockCover": - // Decoding pageBlockCover#39f23300. - v := PageBlockCover{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockEmbedded": - // Decoding pageBlockEmbedded#8c369d9d. - v := PageBlockEmbedded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockEmbeddedPost": - // Decoding pageBlockEmbeddedPost#bc57cdf5. - v := PageBlockEmbeddedPost{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockCollage": - // Decoding pageBlockCollage#40bcaaf0. - v := PageBlockCollage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockSlideshow": - // Decoding pageBlockSlideshow#1107d496. - v := PageBlockSlideshow{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockChatLink": - // Decoding pageBlockChatLink#621ed8bb. - v := PageBlockChatLink{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockTable": - // Decoding pageBlockTable#cc6352c3. - v := PageBlockTable{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockDetails": - // Decoding pageBlockDetails#990a0c0b. - v := PageBlockDetails{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockRelatedArticles": - // Decoding pageBlockRelatedArticles#936d81e6. - v := PageBlockRelatedArticles{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - case "pageBlockMap": - // Decoding pageBlockMap#5a0f7013. - v := PageBlockMap{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PageBlockClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PageBlock boxes the PageBlockClass providing a helper. -type PageBlockBox struct { - PageBlock PageBlockClass -} - -// Decode implements bin.Decoder for PageBlockBox. -func (b *PageBlockBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PageBlockBox to nil") - } - v, err := DecodePageBlock(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PageBlock = v - return nil -} - -// Encode implements bin.Encode for PageBlockBox. -func (b *PageBlockBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PageBlock == nil { - return fmt.Errorf("unable to encode PageBlockClass as nil") - } - return b.PageBlock.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PageBlockBox. -func (b *PageBlockBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PageBlockBox to nil") - } - v, err := DecodeTDLibJSONPageBlock(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PageBlock = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PageBlockBox. -func (b *PageBlockBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PageBlock == nil { - return fmt.Errorf("unable to encode PageBlockClass as nil") - } - return b.PageBlock.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_page_block_horizontal_alignment_gen.go b/tdapi/tl_page_block_horizontal_alignment_gen.go deleted file mode 100644 index 81cddfa0f..000000000 --- a/tdapi/tl_page_block_horizontal_alignment_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PageBlockHorizontalAlignmentLeft represents TL type `pageBlockHorizontalAlignmentLeft#329627e9`. -type PageBlockHorizontalAlignmentLeft struct { -} - -// PageBlockHorizontalAlignmentLeftTypeID is TL type id of PageBlockHorizontalAlignmentLeft. -const PageBlockHorizontalAlignmentLeftTypeID = 0x329627e9 - -// construct implements constructor of PageBlockHorizontalAlignmentClass. -func (p PageBlockHorizontalAlignmentLeft) construct() PageBlockHorizontalAlignmentClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockHorizontalAlignmentLeft. -var ( - _ bin.Encoder = &PageBlockHorizontalAlignmentLeft{} - _ bin.Decoder = &PageBlockHorizontalAlignmentLeft{} - _ bin.BareEncoder = &PageBlockHorizontalAlignmentLeft{} - _ bin.BareDecoder = &PageBlockHorizontalAlignmentLeft{} - - _ PageBlockHorizontalAlignmentClass = &PageBlockHorizontalAlignmentLeft{} -) - -func (p *PageBlockHorizontalAlignmentLeft) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockHorizontalAlignmentLeft) String() string { - if p == nil { - return "PageBlockHorizontalAlignmentLeft(nil)" - } - type Alias PageBlockHorizontalAlignmentLeft - return fmt.Sprintf("PageBlockHorizontalAlignmentLeft%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockHorizontalAlignmentLeft) TypeID() uint32 { - return PageBlockHorizontalAlignmentLeftTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockHorizontalAlignmentLeft) TypeName() string { - return "pageBlockHorizontalAlignmentLeft" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockHorizontalAlignmentLeft) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockHorizontalAlignmentLeft", - ID: PageBlockHorizontalAlignmentLeftTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockHorizontalAlignmentLeft) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHorizontalAlignmentLeft#329627e9 as nil") - } - b.PutID(PageBlockHorizontalAlignmentLeftTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockHorizontalAlignmentLeft) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHorizontalAlignmentLeft#329627e9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockHorizontalAlignmentLeft) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHorizontalAlignmentLeft#329627e9 to nil") - } - if err := b.ConsumeID(PageBlockHorizontalAlignmentLeftTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockHorizontalAlignmentLeft#329627e9: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockHorizontalAlignmentLeft) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHorizontalAlignmentLeft#329627e9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockHorizontalAlignmentLeft) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHorizontalAlignmentLeft#329627e9 as nil") - } - b.ObjStart() - b.PutID("pageBlockHorizontalAlignmentLeft") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockHorizontalAlignmentLeft) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHorizontalAlignmentLeft#329627e9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockHorizontalAlignmentLeft"); err != nil { - return fmt.Errorf("unable to decode pageBlockHorizontalAlignmentLeft#329627e9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PageBlockHorizontalAlignmentCenter represents TL type `pageBlockHorizontalAlignmentCenter#c3d8c4ea`. -type PageBlockHorizontalAlignmentCenter struct { -} - -// PageBlockHorizontalAlignmentCenterTypeID is TL type id of PageBlockHorizontalAlignmentCenter. -const PageBlockHorizontalAlignmentCenterTypeID = 0xc3d8c4ea - -// construct implements constructor of PageBlockHorizontalAlignmentClass. -func (p PageBlockHorizontalAlignmentCenter) construct() PageBlockHorizontalAlignmentClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockHorizontalAlignmentCenter. -var ( - _ bin.Encoder = &PageBlockHorizontalAlignmentCenter{} - _ bin.Decoder = &PageBlockHorizontalAlignmentCenter{} - _ bin.BareEncoder = &PageBlockHorizontalAlignmentCenter{} - _ bin.BareDecoder = &PageBlockHorizontalAlignmentCenter{} - - _ PageBlockHorizontalAlignmentClass = &PageBlockHorizontalAlignmentCenter{} -) - -func (p *PageBlockHorizontalAlignmentCenter) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockHorizontalAlignmentCenter) String() string { - if p == nil { - return "PageBlockHorizontalAlignmentCenter(nil)" - } - type Alias PageBlockHorizontalAlignmentCenter - return fmt.Sprintf("PageBlockHorizontalAlignmentCenter%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockHorizontalAlignmentCenter) TypeID() uint32 { - return PageBlockHorizontalAlignmentCenterTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockHorizontalAlignmentCenter) TypeName() string { - return "pageBlockHorizontalAlignmentCenter" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockHorizontalAlignmentCenter) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockHorizontalAlignmentCenter", - ID: PageBlockHorizontalAlignmentCenterTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockHorizontalAlignmentCenter) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHorizontalAlignmentCenter#c3d8c4ea as nil") - } - b.PutID(PageBlockHorizontalAlignmentCenterTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockHorizontalAlignmentCenter) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHorizontalAlignmentCenter#c3d8c4ea as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockHorizontalAlignmentCenter) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHorizontalAlignmentCenter#c3d8c4ea to nil") - } - if err := b.ConsumeID(PageBlockHorizontalAlignmentCenterTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockHorizontalAlignmentCenter#c3d8c4ea: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockHorizontalAlignmentCenter) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHorizontalAlignmentCenter#c3d8c4ea to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockHorizontalAlignmentCenter) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHorizontalAlignmentCenter#c3d8c4ea as nil") - } - b.ObjStart() - b.PutID("pageBlockHorizontalAlignmentCenter") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockHorizontalAlignmentCenter) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHorizontalAlignmentCenter#c3d8c4ea to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockHorizontalAlignmentCenter"); err != nil { - return fmt.Errorf("unable to decode pageBlockHorizontalAlignmentCenter#c3d8c4ea: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PageBlockHorizontalAlignmentRight represents TL type `pageBlockHorizontalAlignmentRight#51bd6efe`. -type PageBlockHorizontalAlignmentRight struct { -} - -// PageBlockHorizontalAlignmentRightTypeID is TL type id of PageBlockHorizontalAlignmentRight. -const PageBlockHorizontalAlignmentRightTypeID = 0x51bd6efe - -// construct implements constructor of PageBlockHorizontalAlignmentClass. -func (p PageBlockHorizontalAlignmentRight) construct() PageBlockHorizontalAlignmentClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockHorizontalAlignmentRight. -var ( - _ bin.Encoder = &PageBlockHorizontalAlignmentRight{} - _ bin.Decoder = &PageBlockHorizontalAlignmentRight{} - _ bin.BareEncoder = &PageBlockHorizontalAlignmentRight{} - _ bin.BareDecoder = &PageBlockHorizontalAlignmentRight{} - - _ PageBlockHorizontalAlignmentClass = &PageBlockHorizontalAlignmentRight{} -) - -func (p *PageBlockHorizontalAlignmentRight) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockHorizontalAlignmentRight) String() string { - if p == nil { - return "PageBlockHorizontalAlignmentRight(nil)" - } - type Alias PageBlockHorizontalAlignmentRight - return fmt.Sprintf("PageBlockHorizontalAlignmentRight%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockHorizontalAlignmentRight) TypeID() uint32 { - return PageBlockHorizontalAlignmentRightTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockHorizontalAlignmentRight) TypeName() string { - return "pageBlockHorizontalAlignmentRight" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockHorizontalAlignmentRight) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockHorizontalAlignmentRight", - ID: PageBlockHorizontalAlignmentRightTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockHorizontalAlignmentRight) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHorizontalAlignmentRight#51bd6efe as nil") - } - b.PutID(PageBlockHorizontalAlignmentRightTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockHorizontalAlignmentRight) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHorizontalAlignmentRight#51bd6efe as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockHorizontalAlignmentRight) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHorizontalAlignmentRight#51bd6efe to nil") - } - if err := b.ConsumeID(PageBlockHorizontalAlignmentRightTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockHorizontalAlignmentRight#51bd6efe: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockHorizontalAlignmentRight) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHorizontalAlignmentRight#51bd6efe to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockHorizontalAlignmentRight) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockHorizontalAlignmentRight#51bd6efe as nil") - } - b.ObjStart() - b.PutID("pageBlockHorizontalAlignmentRight") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockHorizontalAlignmentRight) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockHorizontalAlignmentRight#51bd6efe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockHorizontalAlignmentRight"); err != nil { - return fmt.Errorf("unable to decode pageBlockHorizontalAlignmentRight#51bd6efe: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PageBlockHorizontalAlignmentClassName is schema name of PageBlockHorizontalAlignmentClass. -const PageBlockHorizontalAlignmentClassName = "PageBlockHorizontalAlignment" - -// PageBlockHorizontalAlignmentClass represents PageBlockHorizontalAlignment generic type. -// -// Example: -// -// g, err := tdapi.DecodePageBlockHorizontalAlignment(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PageBlockHorizontalAlignmentLeft: // pageBlockHorizontalAlignmentLeft#329627e9 -// case *tdapi.PageBlockHorizontalAlignmentCenter: // pageBlockHorizontalAlignmentCenter#c3d8c4ea -// case *tdapi.PageBlockHorizontalAlignmentRight: // pageBlockHorizontalAlignmentRight#51bd6efe -// default: panic(v) -// } -type PageBlockHorizontalAlignmentClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PageBlockHorizontalAlignmentClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePageBlockHorizontalAlignment implements binary de-serialization for PageBlockHorizontalAlignmentClass. -func DecodePageBlockHorizontalAlignment(buf *bin.Buffer) (PageBlockHorizontalAlignmentClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PageBlockHorizontalAlignmentLeftTypeID: - // Decoding pageBlockHorizontalAlignmentLeft#329627e9. - v := PageBlockHorizontalAlignmentLeft{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockHorizontalAlignmentClass: %w", err) - } - return &v, nil - case PageBlockHorizontalAlignmentCenterTypeID: - // Decoding pageBlockHorizontalAlignmentCenter#c3d8c4ea. - v := PageBlockHorizontalAlignmentCenter{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockHorizontalAlignmentClass: %w", err) - } - return &v, nil - case PageBlockHorizontalAlignmentRightTypeID: - // Decoding pageBlockHorizontalAlignmentRight#51bd6efe. - v := PageBlockHorizontalAlignmentRight{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockHorizontalAlignmentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PageBlockHorizontalAlignmentClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPageBlockHorizontalAlignment implements binary de-serialization for PageBlockHorizontalAlignmentClass. -func DecodeTDLibJSONPageBlockHorizontalAlignment(buf tdjson.Decoder) (PageBlockHorizontalAlignmentClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "pageBlockHorizontalAlignmentLeft": - // Decoding pageBlockHorizontalAlignmentLeft#329627e9. - v := PageBlockHorizontalAlignmentLeft{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockHorizontalAlignmentClass: %w", err) - } - return &v, nil - case "pageBlockHorizontalAlignmentCenter": - // Decoding pageBlockHorizontalAlignmentCenter#c3d8c4ea. - v := PageBlockHorizontalAlignmentCenter{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockHorizontalAlignmentClass: %w", err) - } - return &v, nil - case "pageBlockHorizontalAlignmentRight": - // Decoding pageBlockHorizontalAlignmentRight#51bd6efe. - v := PageBlockHorizontalAlignmentRight{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockHorizontalAlignmentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PageBlockHorizontalAlignmentClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PageBlockHorizontalAlignment boxes the PageBlockHorizontalAlignmentClass providing a helper. -type PageBlockHorizontalAlignmentBox struct { - PageBlockHorizontalAlignment PageBlockHorizontalAlignmentClass -} - -// Decode implements bin.Decoder for PageBlockHorizontalAlignmentBox. -func (b *PageBlockHorizontalAlignmentBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PageBlockHorizontalAlignmentBox to nil") - } - v, err := DecodePageBlockHorizontalAlignment(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PageBlockHorizontalAlignment = v - return nil -} - -// Encode implements bin.Encode for PageBlockHorizontalAlignmentBox. -func (b *PageBlockHorizontalAlignmentBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PageBlockHorizontalAlignment == nil { - return fmt.Errorf("unable to encode PageBlockHorizontalAlignmentClass as nil") - } - return b.PageBlockHorizontalAlignment.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PageBlockHorizontalAlignmentBox. -func (b *PageBlockHorizontalAlignmentBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PageBlockHorizontalAlignmentBox to nil") - } - v, err := DecodeTDLibJSONPageBlockHorizontalAlignment(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PageBlockHorizontalAlignment = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PageBlockHorizontalAlignmentBox. -func (b *PageBlockHorizontalAlignmentBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PageBlockHorizontalAlignment == nil { - return fmt.Errorf("unable to encode PageBlockHorizontalAlignmentClass as nil") - } - return b.PageBlockHorizontalAlignment.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_page_block_list_item_gen.go b/tdapi/tl_page_block_list_item_gen.go deleted file mode 100644 index a98603de3..000000000 --- a/tdapi/tl_page_block_list_item_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PageBlockListItem represents TL type `pageBlockListItem#5f521776`. -type PageBlockListItem struct { - // Item label - Label string - // Item blocks - PageBlocks []PageBlockClass -} - -// PageBlockListItemTypeID is TL type id of PageBlockListItem. -const PageBlockListItemTypeID = 0x5f521776 - -// Ensuring interfaces in compile-time for PageBlockListItem. -var ( - _ bin.Encoder = &PageBlockListItem{} - _ bin.Decoder = &PageBlockListItem{} - _ bin.BareEncoder = &PageBlockListItem{} - _ bin.BareDecoder = &PageBlockListItem{} -) - -func (p *PageBlockListItem) Zero() bool { - if p == nil { - return true - } - if !(p.Label == "") { - return false - } - if !(p.PageBlocks == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockListItem) String() string { - if p == nil { - return "PageBlockListItem(nil)" - } - type Alias PageBlockListItem - return fmt.Sprintf("PageBlockListItem%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockListItem) TypeID() uint32 { - return PageBlockListItemTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockListItem) TypeName() string { - return "pageBlockListItem" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockListItem) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockListItem", - ID: PageBlockListItemTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Label", - SchemaName: "label", - }, - { - Name: "PageBlocks", - SchemaName: "page_blocks", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockListItem) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockListItem#5f521776 as nil") - } - b.PutID(PageBlockListItemTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockListItem) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockListItem#5f521776 as nil") - } - b.PutString(p.Label) - b.PutInt(len(p.PageBlocks)) - for idx, v := range p.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode pageBlockListItem#5f521776: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare pageBlockListItem#5f521776: field page_blocks element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockListItem) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockListItem#5f521776 to nil") - } - if err := b.ConsumeID(PageBlockListItemTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockListItem#5f521776: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockListItem) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockListItem#5f521776 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockListItem#5f521776: field label: %w", err) - } - p.Label = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode pageBlockListItem#5f521776: field page_blocks: %w", err) - } - - if headerLen > 0 { - p.PageBlocks = make([]PageBlockClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockListItem#5f521776: field page_blocks: %w", err) - } - p.PageBlocks = append(p.PageBlocks, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockListItem) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockListItem#5f521776 as nil") - } - b.ObjStart() - b.PutID("pageBlockListItem") - b.Comma() - b.FieldStart("label") - b.PutString(p.Label) - b.Comma() - b.FieldStart("page_blocks") - b.ArrStart() - for idx, v := range p.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode pageBlockListItem#5f521776: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockListItem#5f521776: field page_blocks element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockListItem) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockListItem#5f521776 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockListItem"); err != nil { - return fmt.Errorf("unable to decode pageBlockListItem#5f521776: %w", err) - } - case "label": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockListItem#5f521776: field label: %w", err) - } - p.Label = value - case "page_blocks": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockListItem#5f521776: field page_blocks: %w", err) - } - p.PageBlocks = append(p.PageBlocks, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode pageBlockListItem#5f521776: field page_blocks: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLabel returns value of Label field. -func (p *PageBlockListItem) GetLabel() (value string) { - if p == nil { - return - } - return p.Label -} - -// GetPageBlocks returns value of PageBlocks field. -func (p *PageBlockListItem) GetPageBlocks() (value []PageBlockClass) { - if p == nil { - return - } - return p.PageBlocks -} diff --git a/tdapi/tl_page_block_related_article_gen.go b/tdapi/tl_page_block_related_article_gen.go deleted file mode 100644 index 7bc01b5b3..000000000 --- a/tdapi/tl_page_block_related_article_gen.go +++ /dev/null @@ -1,363 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PageBlockRelatedArticle represents TL type `pageBlockRelatedArticle#1cae8493`. -type PageBlockRelatedArticle struct { - // Related article URL - URL string - // Article title; may be empty - Title string - // Contains information about a related article - Description string - // Article photo; may be null - Photo Photo - // Article author; may be empty - Author string - // Point in time (Unix timestamp) when the article was published; 0 if unknown - PublishDate int32 -} - -// PageBlockRelatedArticleTypeID is TL type id of PageBlockRelatedArticle. -const PageBlockRelatedArticleTypeID = 0x1cae8493 - -// Ensuring interfaces in compile-time for PageBlockRelatedArticle. -var ( - _ bin.Encoder = &PageBlockRelatedArticle{} - _ bin.Decoder = &PageBlockRelatedArticle{} - _ bin.BareEncoder = &PageBlockRelatedArticle{} - _ bin.BareDecoder = &PageBlockRelatedArticle{} -) - -func (p *PageBlockRelatedArticle) Zero() bool { - if p == nil { - return true - } - if !(p.URL == "") { - return false - } - if !(p.Title == "") { - return false - } - if !(p.Description == "") { - return false - } - if !(p.Photo.Zero()) { - return false - } - if !(p.Author == "") { - return false - } - if !(p.PublishDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockRelatedArticle) String() string { - if p == nil { - return "PageBlockRelatedArticle(nil)" - } - type Alias PageBlockRelatedArticle - return fmt.Sprintf("PageBlockRelatedArticle%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockRelatedArticle) TypeID() uint32 { - return PageBlockRelatedArticleTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockRelatedArticle) TypeName() string { - return "pageBlockRelatedArticle" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockRelatedArticle) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockRelatedArticle", - ID: PageBlockRelatedArticleTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Author", - SchemaName: "author", - }, - { - Name: "PublishDate", - SchemaName: "publish_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockRelatedArticle) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockRelatedArticle#1cae8493 as nil") - } - b.PutID(PageBlockRelatedArticleTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockRelatedArticle) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockRelatedArticle#1cae8493 as nil") - } - b.PutString(p.URL) - b.PutString(p.Title) - b.PutString(p.Description) - if err := p.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockRelatedArticle#1cae8493: field photo: %w", err) - } - b.PutString(p.Author) - b.PutInt32(p.PublishDate) - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockRelatedArticle) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockRelatedArticle#1cae8493 to nil") - } - if err := b.ConsumeID(PageBlockRelatedArticleTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockRelatedArticle) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockRelatedArticle#1cae8493 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field url: %w", err) - } - p.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field title: %w", err) - } - p.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field description: %w", err) - } - p.Description = value - } - { - if err := p.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field photo: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field author: %w", err) - } - p.Author = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field publish_date: %w", err) - } - p.PublishDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockRelatedArticle) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockRelatedArticle#1cae8493 as nil") - } - b.ObjStart() - b.PutID("pageBlockRelatedArticle") - b.Comma() - b.FieldStart("url") - b.PutString(p.URL) - b.Comma() - b.FieldStart("title") - b.PutString(p.Title) - b.Comma() - b.FieldStart("description") - b.PutString(p.Description) - b.Comma() - b.FieldStart("photo") - if err := p.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockRelatedArticle#1cae8493: field photo: %w", err) - } - b.Comma() - b.FieldStart("author") - b.PutString(p.Author) - b.Comma() - b.FieldStart("publish_date") - b.PutInt32(p.PublishDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockRelatedArticle) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockRelatedArticle#1cae8493 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockRelatedArticle"); err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field url: %w", err) - } - p.URL = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field title: %w", err) - } - p.Title = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field description: %w", err) - } - p.Description = value - case "photo": - if err := p.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field photo: %w", err) - } - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field author: %w", err) - } - p.Author = value - case "publish_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockRelatedArticle#1cae8493: field publish_date: %w", err) - } - p.PublishDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (p *PageBlockRelatedArticle) GetURL() (value string) { - if p == nil { - return - } - return p.URL -} - -// GetTitle returns value of Title field. -func (p *PageBlockRelatedArticle) GetTitle() (value string) { - if p == nil { - return - } - return p.Title -} - -// GetDescription returns value of Description field. -func (p *PageBlockRelatedArticle) GetDescription() (value string) { - if p == nil { - return - } - return p.Description -} - -// GetPhoto returns value of Photo field. -func (p *PageBlockRelatedArticle) GetPhoto() (value Photo) { - if p == nil { - return - } - return p.Photo -} - -// GetAuthor returns value of Author field. -func (p *PageBlockRelatedArticle) GetAuthor() (value string) { - if p == nil { - return - } - return p.Author -} - -// GetPublishDate returns value of PublishDate field. -func (p *PageBlockRelatedArticle) GetPublishDate() (value int32) { - if p == nil { - return - } - return p.PublishDate -} diff --git a/tdapi/tl_page_block_table_cell_gen.go b/tdapi/tl_page_block_table_cell_gen.go deleted file mode 100644 index dcb413799..000000000 --- a/tdapi/tl_page_block_table_cell_gen.go +++ /dev/null @@ -1,393 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PageBlockTableCell represents TL type `pageBlockTableCell#547fbf66`. -type PageBlockTableCell struct { - // Cell text; may be null. If the text is null, then the cell must be invisible - Text RichTextClass - // True, if it is a header cell - IsHeader bool - // The number of columns the cell spans - Colspan int32 - // The number of rows the cell spans - Rowspan int32 - // Horizontal cell content alignment - Align PageBlockHorizontalAlignmentClass - // Vertical cell content alignment - Valign PageBlockVerticalAlignmentClass -} - -// PageBlockTableCellTypeID is TL type id of PageBlockTableCell. -const PageBlockTableCellTypeID = 0x547fbf66 - -// Ensuring interfaces in compile-time for PageBlockTableCell. -var ( - _ bin.Encoder = &PageBlockTableCell{} - _ bin.Decoder = &PageBlockTableCell{} - _ bin.BareEncoder = &PageBlockTableCell{} - _ bin.BareDecoder = &PageBlockTableCell{} -) - -func (p *PageBlockTableCell) Zero() bool { - if p == nil { - return true - } - if !(p.Text == nil) { - return false - } - if !(p.IsHeader == false) { - return false - } - if !(p.Colspan == 0) { - return false - } - if !(p.Rowspan == 0) { - return false - } - if !(p.Align == nil) { - return false - } - if !(p.Valign == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockTableCell) String() string { - if p == nil { - return "PageBlockTableCell(nil)" - } - type Alias PageBlockTableCell - return fmt.Sprintf("PageBlockTableCell%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockTableCell) TypeID() uint32 { - return PageBlockTableCellTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockTableCell) TypeName() string { - return "pageBlockTableCell" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockTableCell) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockTableCell", - ID: PageBlockTableCellTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "IsHeader", - SchemaName: "is_header", - }, - { - Name: "Colspan", - SchemaName: "colspan", - }, - { - Name: "Rowspan", - SchemaName: "rowspan", - }, - { - Name: "Align", - SchemaName: "align", - }, - { - Name: "Valign", - SchemaName: "valign", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockTableCell) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockTableCell#547fbf66 as nil") - } - b.PutID(PageBlockTableCellTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockTableCell) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockTableCell#547fbf66 as nil") - } - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field text is nil") - } - if err := p.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field text: %w", err) - } - b.PutBool(p.IsHeader) - b.PutInt32(p.Colspan) - b.PutInt32(p.Rowspan) - if p.Align == nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field align is nil") - } - if err := p.Align.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field align: %w", err) - } - if p.Valign == nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field valign is nil") - } - if err := p.Valign.Encode(b); err != nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field valign: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockTableCell) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockTableCell#547fbf66 to nil") - } - if err := b.ConsumeID(PageBlockTableCellTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockTableCell) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockTableCell#547fbf66 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field text: %w", err) - } - p.Text = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field is_header: %w", err) - } - p.IsHeader = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field colspan: %w", err) - } - p.Colspan = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field rowspan: %w", err) - } - p.Rowspan = value - } - { - value, err := DecodePageBlockHorizontalAlignment(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field align: %w", err) - } - p.Align = value - } - { - value, err := DecodePageBlockVerticalAlignment(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field valign: %w", err) - } - p.Valign = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockTableCell) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockTableCell#547fbf66 as nil") - } - b.ObjStart() - b.PutID("pageBlockTableCell") - b.Comma() - b.FieldStart("text") - if p.Text == nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field text is nil") - } - if err := p.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field text: %w", err) - } - b.Comma() - b.FieldStart("is_header") - b.PutBool(p.IsHeader) - b.Comma() - b.FieldStart("colspan") - b.PutInt32(p.Colspan) - b.Comma() - b.FieldStart("rowspan") - b.PutInt32(p.Rowspan) - b.Comma() - b.FieldStart("align") - if p.Align == nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field align is nil") - } - if err := p.Align.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field align: %w", err) - } - b.Comma() - b.FieldStart("valign") - if p.Valign == nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field valign is nil") - } - if err := p.Valign.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pageBlockTableCell#547fbf66: field valign: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockTableCell) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockTableCell#547fbf66 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockTableCell"); err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field text: %w", err) - } - p.Text = value - case "is_header": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field is_header: %w", err) - } - p.IsHeader = value - case "colspan": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field colspan: %w", err) - } - p.Colspan = value - case "rowspan": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field rowspan: %w", err) - } - p.Rowspan = value - case "align": - value, err := DecodeTDLibJSONPageBlockHorizontalAlignment(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field align: %w", err) - } - p.Align = value - case "valign": - value, err := DecodeTDLibJSONPageBlockVerticalAlignment(b) - if err != nil { - return fmt.Errorf("unable to decode pageBlockTableCell#547fbf66: field valign: %w", err) - } - p.Valign = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (p *PageBlockTableCell) GetText() (value RichTextClass) { - if p == nil { - return - } - return p.Text -} - -// GetIsHeader returns value of IsHeader field. -func (p *PageBlockTableCell) GetIsHeader() (value bool) { - if p == nil { - return - } - return p.IsHeader -} - -// GetColspan returns value of Colspan field. -func (p *PageBlockTableCell) GetColspan() (value int32) { - if p == nil { - return - } - return p.Colspan -} - -// GetRowspan returns value of Rowspan field. -func (p *PageBlockTableCell) GetRowspan() (value int32) { - if p == nil { - return - } - return p.Rowspan -} - -// GetAlign returns value of Align field. -func (p *PageBlockTableCell) GetAlign() (value PageBlockHorizontalAlignmentClass) { - if p == nil { - return - } - return p.Align -} - -// GetValign returns value of Valign field. -func (p *PageBlockTableCell) GetValign() (value PageBlockVerticalAlignmentClass) { - if p == nil { - return - } - return p.Valign -} diff --git a/tdapi/tl_page_block_vertical_alignment_gen.go b/tdapi/tl_page_block_vertical_alignment_gen.go deleted file mode 100644 index e8d6473c0..000000000 --- a/tdapi/tl_page_block_vertical_alignment_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PageBlockVerticalAlignmentTop represents TL type `pageBlockVerticalAlignmentTop#ba719a6`. -type PageBlockVerticalAlignmentTop struct { -} - -// PageBlockVerticalAlignmentTopTypeID is TL type id of PageBlockVerticalAlignmentTop. -const PageBlockVerticalAlignmentTopTypeID = 0xba719a6 - -// construct implements constructor of PageBlockVerticalAlignmentClass. -func (p PageBlockVerticalAlignmentTop) construct() PageBlockVerticalAlignmentClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockVerticalAlignmentTop. -var ( - _ bin.Encoder = &PageBlockVerticalAlignmentTop{} - _ bin.Decoder = &PageBlockVerticalAlignmentTop{} - _ bin.BareEncoder = &PageBlockVerticalAlignmentTop{} - _ bin.BareDecoder = &PageBlockVerticalAlignmentTop{} - - _ PageBlockVerticalAlignmentClass = &PageBlockVerticalAlignmentTop{} -) - -func (p *PageBlockVerticalAlignmentTop) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockVerticalAlignmentTop) String() string { - if p == nil { - return "PageBlockVerticalAlignmentTop(nil)" - } - type Alias PageBlockVerticalAlignmentTop - return fmt.Sprintf("PageBlockVerticalAlignmentTop%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockVerticalAlignmentTop) TypeID() uint32 { - return PageBlockVerticalAlignmentTopTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockVerticalAlignmentTop) TypeName() string { - return "pageBlockVerticalAlignmentTop" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockVerticalAlignmentTop) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockVerticalAlignmentTop", - ID: PageBlockVerticalAlignmentTopTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockVerticalAlignmentTop) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVerticalAlignmentTop#ba719a6 as nil") - } - b.PutID(PageBlockVerticalAlignmentTopTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockVerticalAlignmentTop) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVerticalAlignmentTop#ba719a6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockVerticalAlignmentTop) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVerticalAlignmentTop#ba719a6 to nil") - } - if err := b.ConsumeID(PageBlockVerticalAlignmentTopTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockVerticalAlignmentTop#ba719a6: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockVerticalAlignmentTop) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVerticalAlignmentTop#ba719a6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockVerticalAlignmentTop) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVerticalAlignmentTop#ba719a6 as nil") - } - b.ObjStart() - b.PutID("pageBlockVerticalAlignmentTop") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockVerticalAlignmentTop) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVerticalAlignmentTop#ba719a6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockVerticalAlignmentTop"); err != nil { - return fmt.Errorf("unable to decode pageBlockVerticalAlignmentTop#ba719a6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PageBlockVerticalAlignmentMiddle represents TL type `pageBlockVerticalAlignmentMiddle#81741df5`. -type PageBlockVerticalAlignmentMiddle struct { -} - -// PageBlockVerticalAlignmentMiddleTypeID is TL type id of PageBlockVerticalAlignmentMiddle. -const PageBlockVerticalAlignmentMiddleTypeID = 0x81741df5 - -// construct implements constructor of PageBlockVerticalAlignmentClass. -func (p PageBlockVerticalAlignmentMiddle) construct() PageBlockVerticalAlignmentClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockVerticalAlignmentMiddle. -var ( - _ bin.Encoder = &PageBlockVerticalAlignmentMiddle{} - _ bin.Decoder = &PageBlockVerticalAlignmentMiddle{} - _ bin.BareEncoder = &PageBlockVerticalAlignmentMiddle{} - _ bin.BareDecoder = &PageBlockVerticalAlignmentMiddle{} - - _ PageBlockVerticalAlignmentClass = &PageBlockVerticalAlignmentMiddle{} -) - -func (p *PageBlockVerticalAlignmentMiddle) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockVerticalAlignmentMiddle) String() string { - if p == nil { - return "PageBlockVerticalAlignmentMiddle(nil)" - } - type Alias PageBlockVerticalAlignmentMiddle - return fmt.Sprintf("PageBlockVerticalAlignmentMiddle%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockVerticalAlignmentMiddle) TypeID() uint32 { - return PageBlockVerticalAlignmentMiddleTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockVerticalAlignmentMiddle) TypeName() string { - return "pageBlockVerticalAlignmentMiddle" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockVerticalAlignmentMiddle) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockVerticalAlignmentMiddle", - ID: PageBlockVerticalAlignmentMiddleTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockVerticalAlignmentMiddle) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVerticalAlignmentMiddle#81741df5 as nil") - } - b.PutID(PageBlockVerticalAlignmentMiddleTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockVerticalAlignmentMiddle) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVerticalAlignmentMiddle#81741df5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockVerticalAlignmentMiddle) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVerticalAlignmentMiddle#81741df5 to nil") - } - if err := b.ConsumeID(PageBlockVerticalAlignmentMiddleTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockVerticalAlignmentMiddle#81741df5: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockVerticalAlignmentMiddle) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVerticalAlignmentMiddle#81741df5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockVerticalAlignmentMiddle) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVerticalAlignmentMiddle#81741df5 as nil") - } - b.ObjStart() - b.PutID("pageBlockVerticalAlignmentMiddle") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockVerticalAlignmentMiddle) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVerticalAlignmentMiddle#81741df5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockVerticalAlignmentMiddle"); err != nil { - return fmt.Errorf("unable to decode pageBlockVerticalAlignmentMiddle#81741df5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PageBlockVerticalAlignmentBottom represents TL type `pageBlockVerticalAlignmentBottom#7cb97dd6`. -type PageBlockVerticalAlignmentBottom struct { -} - -// PageBlockVerticalAlignmentBottomTypeID is TL type id of PageBlockVerticalAlignmentBottom. -const PageBlockVerticalAlignmentBottomTypeID = 0x7cb97dd6 - -// construct implements constructor of PageBlockVerticalAlignmentClass. -func (p PageBlockVerticalAlignmentBottom) construct() PageBlockVerticalAlignmentClass { return &p } - -// Ensuring interfaces in compile-time for PageBlockVerticalAlignmentBottom. -var ( - _ bin.Encoder = &PageBlockVerticalAlignmentBottom{} - _ bin.Decoder = &PageBlockVerticalAlignmentBottom{} - _ bin.BareEncoder = &PageBlockVerticalAlignmentBottom{} - _ bin.BareDecoder = &PageBlockVerticalAlignmentBottom{} - - _ PageBlockVerticalAlignmentClass = &PageBlockVerticalAlignmentBottom{} -) - -func (p *PageBlockVerticalAlignmentBottom) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PageBlockVerticalAlignmentBottom) String() string { - if p == nil { - return "PageBlockVerticalAlignmentBottom(nil)" - } - type Alias PageBlockVerticalAlignmentBottom - return fmt.Sprintf("PageBlockVerticalAlignmentBottom%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PageBlockVerticalAlignmentBottom) TypeID() uint32 { - return PageBlockVerticalAlignmentBottomTypeID -} - -// TypeName returns name of type in TL schema. -func (*PageBlockVerticalAlignmentBottom) TypeName() string { - return "pageBlockVerticalAlignmentBottom" -} - -// TypeInfo returns info about TL type. -func (p *PageBlockVerticalAlignmentBottom) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pageBlockVerticalAlignmentBottom", - ID: PageBlockVerticalAlignmentBottomTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PageBlockVerticalAlignmentBottom) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVerticalAlignmentBottom#7cb97dd6 as nil") - } - b.PutID(PageBlockVerticalAlignmentBottomTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PageBlockVerticalAlignmentBottom) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVerticalAlignmentBottom#7cb97dd6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PageBlockVerticalAlignmentBottom) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVerticalAlignmentBottom#7cb97dd6 to nil") - } - if err := b.ConsumeID(PageBlockVerticalAlignmentBottomTypeID); err != nil { - return fmt.Errorf("unable to decode pageBlockVerticalAlignmentBottom#7cb97dd6: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PageBlockVerticalAlignmentBottom) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVerticalAlignmentBottom#7cb97dd6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PageBlockVerticalAlignmentBottom) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pageBlockVerticalAlignmentBottom#7cb97dd6 as nil") - } - b.ObjStart() - b.PutID("pageBlockVerticalAlignmentBottom") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PageBlockVerticalAlignmentBottom) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pageBlockVerticalAlignmentBottom#7cb97dd6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pageBlockVerticalAlignmentBottom"); err != nil { - return fmt.Errorf("unable to decode pageBlockVerticalAlignmentBottom#7cb97dd6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PageBlockVerticalAlignmentClassName is schema name of PageBlockVerticalAlignmentClass. -const PageBlockVerticalAlignmentClassName = "PageBlockVerticalAlignment" - -// PageBlockVerticalAlignmentClass represents PageBlockVerticalAlignment generic type. -// -// Example: -// -// g, err := tdapi.DecodePageBlockVerticalAlignment(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PageBlockVerticalAlignmentTop: // pageBlockVerticalAlignmentTop#ba719a6 -// case *tdapi.PageBlockVerticalAlignmentMiddle: // pageBlockVerticalAlignmentMiddle#81741df5 -// case *tdapi.PageBlockVerticalAlignmentBottom: // pageBlockVerticalAlignmentBottom#7cb97dd6 -// default: panic(v) -// } -type PageBlockVerticalAlignmentClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PageBlockVerticalAlignmentClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePageBlockVerticalAlignment implements binary de-serialization for PageBlockVerticalAlignmentClass. -func DecodePageBlockVerticalAlignment(buf *bin.Buffer) (PageBlockVerticalAlignmentClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PageBlockVerticalAlignmentTopTypeID: - // Decoding pageBlockVerticalAlignmentTop#ba719a6. - v := PageBlockVerticalAlignmentTop{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockVerticalAlignmentClass: %w", err) - } - return &v, nil - case PageBlockVerticalAlignmentMiddleTypeID: - // Decoding pageBlockVerticalAlignmentMiddle#81741df5. - v := PageBlockVerticalAlignmentMiddle{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockVerticalAlignmentClass: %w", err) - } - return &v, nil - case PageBlockVerticalAlignmentBottomTypeID: - // Decoding pageBlockVerticalAlignmentBottom#7cb97dd6. - v := PageBlockVerticalAlignmentBottom{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockVerticalAlignmentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PageBlockVerticalAlignmentClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPageBlockVerticalAlignment implements binary de-serialization for PageBlockVerticalAlignmentClass. -func DecodeTDLibJSONPageBlockVerticalAlignment(buf tdjson.Decoder) (PageBlockVerticalAlignmentClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "pageBlockVerticalAlignmentTop": - // Decoding pageBlockVerticalAlignmentTop#ba719a6. - v := PageBlockVerticalAlignmentTop{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockVerticalAlignmentClass: %w", err) - } - return &v, nil - case "pageBlockVerticalAlignmentMiddle": - // Decoding pageBlockVerticalAlignmentMiddle#81741df5. - v := PageBlockVerticalAlignmentMiddle{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockVerticalAlignmentClass: %w", err) - } - return &v, nil - case "pageBlockVerticalAlignmentBottom": - // Decoding pageBlockVerticalAlignmentBottom#7cb97dd6. - v := PageBlockVerticalAlignmentBottom{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PageBlockVerticalAlignmentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PageBlockVerticalAlignmentClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PageBlockVerticalAlignment boxes the PageBlockVerticalAlignmentClass providing a helper. -type PageBlockVerticalAlignmentBox struct { - PageBlockVerticalAlignment PageBlockVerticalAlignmentClass -} - -// Decode implements bin.Decoder for PageBlockVerticalAlignmentBox. -func (b *PageBlockVerticalAlignmentBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PageBlockVerticalAlignmentBox to nil") - } - v, err := DecodePageBlockVerticalAlignment(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PageBlockVerticalAlignment = v - return nil -} - -// Encode implements bin.Encode for PageBlockVerticalAlignmentBox. -func (b *PageBlockVerticalAlignmentBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PageBlockVerticalAlignment == nil { - return fmt.Errorf("unable to encode PageBlockVerticalAlignmentClass as nil") - } - return b.PageBlockVerticalAlignment.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PageBlockVerticalAlignmentBox. -func (b *PageBlockVerticalAlignmentBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PageBlockVerticalAlignmentBox to nil") - } - v, err := DecodeTDLibJSONPageBlockVerticalAlignment(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PageBlockVerticalAlignment = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PageBlockVerticalAlignmentBox. -func (b *PageBlockVerticalAlignmentBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PageBlockVerticalAlignment == nil { - return fmt.Errorf("unable to encode PageBlockVerticalAlignmentClass as nil") - } - return b.PageBlockVerticalAlignment.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_paid_media_gen.go b/tdapi/tl_paid_media_gen.go deleted file mode 100644 index 5e1ab3168..000000000 --- a/tdapi/tl_paid_media_gen.go +++ /dev/null @@ -1,930 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PaidMediaPreview represents TL type `paidMediaPreview#bcc1c474`. -type PaidMediaPreview struct { - // Media width; 0 if unknown - Width int32 - // Media height; 0 if unknown - Height int32 - // Media duration, in seconds; 0 if unknown - Duration int32 - // Media minithumbnail; may be null - Minithumbnail Minithumbnail -} - -// PaidMediaPreviewTypeID is TL type id of PaidMediaPreview. -const PaidMediaPreviewTypeID = 0xbcc1c474 - -// construct implements constructor of PaidMediaClass. -func (p PaidMediaPreview) construct() PaidMediaClass { return &p } - -// Ensuring interfaces in compile-time for PaidMediaPreview. -var ( - _ bin.Encoder = &PaidMediaPreview{} - _ bin.Decoder = &PaidMediaPreview{} - _ bin.BareEncoder = &PaidMediaPreview{} - _ bin.BareDecoder = &PaidMediaPreview{} - - _ PaidMediaClass = &PaidMediaPreview{} -) - -func (p *PaidMediaPreview) Zero() bool { - if p == nil { - return true - } - if !(p.Width == 0) { - return false - } - if !(p.Height == 0) { - return false - } - if !(p.Duration == 0) { - return false - } - if !(p.Minithumbnail.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaidMediaPreview) String() string { - if p == nil { - return "PaidMediaPreview(nil)" - } - type Alias PaidMediaPreview - return fmt.Sprintf("PaidMediaPreview%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaidMediaPreview) TypeID() uint32 { - return PaidMediaPreviewTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaidMediaPreview) TypeName() string { - return "paidMediaPreview" -} - -// TypeInfo returns info about TL type. -func (p *PaidMediaPreview) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paidMediaPreview", - ID: PaidMediaPreviewTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Minithumbnail", - SchemaName: "minithumbnail", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaidMediaPreview) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaPreview#bcc1c474 as nil") - } - b.PutID(PaidMediaPreviewTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaidMediaPreview) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaPreview#bcc1c474 as nil") - } - b.PutInt32(p.Width) - b.PutInt32(p.Height) - b.PutInt32(p.Duration) - if err := p.Minithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode paidMediaPreview#bcc1c474: field minithumbnail: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PaidMediaPreview) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaPreview#bcc1c474 to nil") - } - if err := b.ConsumeID(PaidMediaPreviewTypeID); err != nil { - return fmt.Errorf("unable to decode paidMediaPreview#bcc1c474: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaidMediaPreview) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaPreview#bcc1c474 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode paidMediaPreview#bcc1c474: field width: %w", err) - } - p.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode paidMediaPreview#bcc1c474: field height: %w", err) - } - p.Height = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode paidMediaPreview#bcc1c474: field duration: %w", err) - } - p.Duration = value - } - { - if err := p.Minithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode paidMediaPreview#bcc1c474: field minithumbnail: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaidMediaPreview) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaPreview#bcc1c474 as nil") - } - b.ObjStart() - b.PutID("paidMediaPreview") - b.Comma() - b.FieldStart("width") - b.PutInt32(p.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(p.Height) - b.Comma() - b.FieldStart("duration") - b.PutInt32(p.Duration) - b.Comma() - b.FieldStart("minithumbnail") - if err := p.Minithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paidMediaPreview#bcc1c474: field minithumbnail: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaidMediaPreview) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaPreview#bcc1c474 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paidMediaPreview"); err != nil { - return fmt.Errorf("unable to decode paidMediaPreview#bcc1c474: %w", err) - } - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode paidMediaPreview#bcc1c474: field width: %w", err) - } - p.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode paidMediaPreview#bcc1c474: field height: %w", err) - } - p.Height = value - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode paidMediaPreview#bcc1c474: field duration: %w", err) - } - p.Duration = value - case "minithumbnail": - if err := p.Minithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paidMediaPreview#bcc1c474: field minithumbnail: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetWidth returns value of Width field. -func (p *PaidMediaPreview) GetWidth() (value int32) { - if p == nil { - return - } - return p.Width -} - -// GetHeight returns value of Height field. -func (p *PaidMediaPreview) GetHeight() (value int32) { - if p == nil { - return - } - return p.Height -} - -// GetDuration returns value of Duration field. -func (p *PaidMediaPreview) GetDuration() (value int32) { - if p == nil { - return - } - return p.Duration -} - -// GetMinithumbnail returns value of Minithumbnail field. -func (p *PaidMediaPreview) GetMinithumbnail() (value Minithumbnail) { - if p == nil { - return - } - return p.Minithumbnail -} - -// PaidMediaPhoto represents TL type `paidMediaPhoto#ba82551a`. -type PaidMediaPhoto struct { - // The photo - Photo Photo -} - -// PaidMediaPhotoTypeID is TL type id of PaidMediaPhoto. -const PaidMediaPhotoTypeID = 0xba82551a - -// construct implements constructor of PaidMediaClass. -func (p PaidMediaPhoto) construct() PaidMediaClass { return &p } - -// Ensuring interfaces in compile-time for PaidMediaPhoto. -var ( - _ bin.Encoder = &PaidMediaPhoto{} - _ bin.Decoder = &PaidMediaPhoto{} - _ bin.BareEncoder = &PaidMediaPhoto{} - _ bin.BareDecoder = &PaidMediaPhoto{} - - _ PaidMediaClass = &PaidMediaPhoto{} -) - -func (p *PaidMediaPhoto) Zero() bool { - if p == nil { - return true - } - if !(p.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaidMediaPhoto) String() string { - if p == nil { - return "PaidMediaPhoto(nil)" - } - type Alias PaidMediaPhoto - return fmt.Sprintf("PaidMediaPhoto%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaidMediaPhoto) TypeID() uint32 { - return PaidMediaPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaidMediaPhoto) TypeName() string { - return "paidMediaPhoto" -} - -// TypeInfo returns info about TL type. -func (p *PaidMediaPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paidMediaPhoto", - ID: PaidMediaPhotoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaidMediaPhoto) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaPhoto#ba82551a as nil") - } - b.PutID(PaidMediaPhotoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaidMediaPhoto) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaPhoto#ba82551a as nil") - } - if err := p.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode paidMediaPhoto#ba82551a: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PaidMediaPhoto) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaPhoto#ba82551a to nil") - } - if err := b.ConsumeID(PaidMediaPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode paidMediaPhoto#ba82551a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaidMediaPhoto) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaPhoto#ba82551a to nil") - } - { - if err := p.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode paidMediaPhoto#ba82551a: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaidMediaPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaPhoto#ba82551a as nil") - } - b.ObjStart() - b.PutID("paidMediaPhoto") - b.Comma() - b.FieldStart("photo") - if err := p.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paidMediaPhoto#ba82551a: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaidMediaPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaPhoto#ba82551a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paidMediaPhoto"); err != nil { - return fmt.Errorf("unable to decode paidMediaPhoto#ba82551a: %w", err) - } - case "photo": - if err := p.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paidMediaPhoto#ba82551a: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (p *PaidMediaPhoto) GetPhoto() (value Photo) { - if p == nil { - return - } - return p.Photo -} - -// PaidMediaVideo represents TL type `paidMediaVideo#1bb52e09`. -type PaidMediaVideo struct { - // The video - Video Video -} - -// PaidMediaVideoTypeID is TL type id of PaidMediaVideo. -const PaidMediaVideoTypeID = 0x1bb52e09 - -// construct implements constructor of PaidMediaClass. -func (p PaidMediaVideo) construct() PaidMediaClass { return &p } - -// Ensuring interfaces in compile-time for PaidMediaVideo. -var ( - _ bin.Encoder = &PaidMediaVideo{} - _ bin.Decoder = &PaidMediaVideo{} - _ bin.BareEncoder = &PaidMediaVideo{} - _ bin.BareDecoder = &PaidMediaVideo{} - - _ PaidMediaClass = &PaidMediaVideo{} -) - -func (p *PaidMediaVideo) Zero() bool { - if p == nil { - return true - } - if !(p.Video.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaidMediaVideo) String() string { - if p == nil { - return "PaidMediaVideo(nil)" - } - type Alias PaidMediaVideo - return fmt.Sprintf("PaidMediaVideo%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaidMediaVideo) TypeID() uint32 { - return PaidMediaVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaidMediaVideo) TypeName() string { - return "paidMediaVideo" -} - -// TypeInfo returns info about TL type. -func (p *PaidMediaVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paidMediaVideo", - ID: PaidMediaVideoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Video", - SchemaName: "video", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaidMediaVideo) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaVideo#1bb52e09 as nil") - } - b.PutID(PaidMediaVideoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaidMediaVideo) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaVideo#1bb52e09 as nil") - } - if err := p.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode paidMediaVideo#1bb52e09: field video: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PaidMediaVideo) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaVideo#1bb52e09 to nil") - } - if err := b.ConsumeID(PaidMediaVideoTypeID); err != nil { - return fmt.Errorf("unable to decode paidMediaVideo#1bb52e09: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaidMediaVideo) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaVideo#1bb52e09 to nil") - } - { - if err := p.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode paidMediaVideo#1bb52e09: field video: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaidMediaVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaVideo#1bb52e09 as nil") - } - b.ObjStart() - b.PutID("paidMediaVideo") - b.Comma() - b.FieldStart("video") - if err := p.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paidMediaVideo#1bb52e09: field video: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaidMediaVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaVideo#1bb52e09 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paidMediaVideo"); err != nil { - return fmt.Errorf("unable to decode paidMediaVideo#1bb52e09: %w", err) - } - case "video": - if err := p.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paidMediaVideo#1bb52e09: field video: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetVideo returns value of Video field. -func (p *PaidMediaVideo) GetVideo() (value Video) { - if p == nil { - return - } - return p.Video -} - -// PaidMediaUnsupported represents TL type `paidMediaUnsupported#6bc3e26`. -type PaidMediaUnsupported struct { -} - -// PaidMediaUnsupportedTypeID is TL type id of PaidMediaUnsupported. -const PaidMediaUnsupportedTypeID = 0x6bc3e26 - -// construct implements constructor of PaidMediaClass. -func (p PaidMediaUnsupported) construct() PaidMediaClass { return &p } - -// Ensuring interfaces in compile-time for PaidMediaUnsupported. -var ( - _ bin.Encoder = &PaidMediaUnsupported{} - _ bin.Decoder = &PaidMediaUnsupported{} - _ bin.BareEncoder = &PaidMediaUnsupported{} - _ bin.BareDecoder = &PaidMediaUnsupported{} - - _ PaidMediaClass = &PaidMediaUnsupported{} -) - -func (p *PaidMediaUnsupported) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaidMediaUnsupported) String() string { - if p == nil { - return "PaidMediaUnsupported(nil)" - } - type Alias PaidMediaUnsupported - return fmt.Sprintf("PaidMediaUnsupported%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaidMediaUnsupported) TypeID() uint32 { - return PaidMediaUnsupportedTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaidMediaUnsupported) TypeName() string { - return "paidMediaUnsupported" -} - -// TypeInfo returns info about TL type. -func (p *PaidMediaUnsupported) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paidMediaUnsupported", - ID: PaidMediaUnsupportedTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PaidMediaUnsupported) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaUnsupported#6bc3e26 as nil") - } - b.PutID(PaidMediaUnsupportedTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaidMediaUnsupported) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaUnsupported#6bc3e26 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PaidMediaUnsupported) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaUnsupported#6bc3e26 to nil") - } - if err := b.ConsumeID(PaidMediaUnsupportedTypeID); err != nil { - return fmt.Errorf("unable to decode paidMediaUnsupported#6bc3e26: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaidMediaUnsupported) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaUnsupported#6bc3e26 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaidMediaUnsupported) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paidMediaUnsupported#6bc3e26 as nil") - } - b.ObjStart() - b.PutID("paidMediaUnsupported") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaidMediaUnsupported) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paidMediaUnsupported#6bc3e26 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paidMediaUnsupported"); err != nil { - return fmt.Errorf("unable to decode paidMediaUnsupported#6bc3e26: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PaidMediaClassName is schema name of PaidMediaClass. -const PaidMediaClassName = "PaidMedia" - -// PaidMediaClass represents PaidMedia generic type. -// -// Example: -// -// g, err := tdapi.DecodePaidMedia(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PaidMediaPreview: // paidMediaPreview#bcc1c474 -// case *tdapi.PaidMediaPhoto: // paidMediaPhoto#ba82551a -// case *tdapi.PaidMediaVideo: // paidMediaVideo#1bb52e09 -// case *tdapi.PaidMediaUnsupported: // paidMediaUnsupported#6bc3e26 -// default: panic(v) -// } -type PaidMediaClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PaidMediaClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePaidMedia implements binary de-serialization for PaidMediaClass. -func DecodePaidMedia(buf *bin.Buffer) (PaidMediaClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PaidMediaPreviewTypeID: - // Decoding paidMediaPreview#bcc1c474. - v := PaidMediaPreview{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaidMediaClass: %w", err) - } - return &v, nil - case PaidMediaPhotoTypeID: - // Decoding paidMediaPhoto#ba82551a. - v := PaidMediaPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaidMediaClass: %w", err) - } - return &v, nil - case PaidMediaVideoTypeID: - // Decoding paidMediaVideo#1bb52e09. - v := PaidMediaVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaidMediaClass: %w", err) - } - return &v, nil - case PaidMediaUnsupportedTypeID: - // Decoding paidMediaUnsupported#6bc3e26. - v := PaidMediaUnsupported{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaidMediaClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PaidMediaClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPaidMedia implements binary de-serialization for PaidMediaClass. -func DecodeTDLibJSONPaidMedia(buf tdjson.Decoder) (PaidMediaClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "paidMediaPreview": - // Decoding paidMediaPreview#bcc1c474. - v := PaidMediaPreview{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaidMediaClass: %w", err) - } - return &v, nil - case "paidMediaPhoto": - // Decoding paidMediaPhoto#ba82551a. - v := PaidMediaPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaidMediaClass: %w", err) - } - return &v, nil - case "paidMediaVideo": - // Decoding paidMediaVideo#1bb52e09. - v := PaidMediaVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaidMediaClass: %w", err) - } - return &v, nil - case "paidMediaUnsupported": - // Decoding paidMediaUnsupported#6bc3e26. - v := PaidMediaUnsupported{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaidMediaClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PaidMediaClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PaidMedia boxes the PaidMediaClass providing a helper. -type PaidMediaBox struct { - PaidMedia PaidMediaClass -} - -// Decode implements bin.Decoder for PaidMediaBox. -func (b *PaidMediaBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PaidMediaBox to nil") - } - v, err := DecodePaidMedia(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PaidMedia = v - return nil -} - -// Encode implements bin.Encode for PaidMediaBox. -func (b *PaidMediaBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PaidMedia == nil { - return fmt.Errorf("unable to encode PaidMediaClass as nil") - } - return b.PaidMedia.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PaidMediaBox. -func (b *PaidMediaBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PaidMediaBox to nil") - } - v, err := DecodeTDLibJSONPaidMedia(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PaidMedia = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PaidMediaBox. -func (b *PaidMediaBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PaidMedia == nil { - return fmt.Errorf("unable to encode PaidMediaClass as nil") - } - return b.PaidMedia.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_paid_reactor_gen.go b/tdapi/tl_paid_reactor_gen.go deleted file mode 100644 index af9396d42..000000000 --- a/tdapi/tl_paid_reactor_gen.go +++ /dev/null @@ -1,341 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PaidReactor represents TL type `paidReactor#9d379008`. -type PaidReactor struct { - // Identifier of the user or chat that added the reactions; may be null for anonymous - // reactors that aren't the current user - SenderID MessageSenderClass - // Number of Telegram Stars added - StarCount int32 - // True, if the reactor is one of the most active reactors; may be false if the reactor - // is the current user - IsTop bool - // True, if the paid reaction was added by the current user - IsMe bool - // True, if the reactor is anonymous - IsAnonymous bool -} - -// PaidReactorTypeID is TL type id of PaidReactor. -const PaidReactorTypeID = 0x9d379008 - -// Ensuring interfaces in compile-time for PaidReactor. -var ( - _ bin.Encoder = &PaidReactor{} - _ bin.Decoder = &PaidReactor{} - _ bin.BareEncoder = &PaidReactor{} - _ bin.BareDecoder = &PaidReactor{} -) - -func (p *PaidReactor) Zero() bool { - if p == nil { - return true - } - if !(p.SenderID == nil) { - return false - } - if !(p.StarCount == 0) { - return false - } - if !(p.IsTop == false) { - return false - } - if !(p.IsMe == false) { - return false - } - if !(p.IsAnonymous == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaidReactor) String() string { - if p == nil { - return "PaidReactor(nil)" - } - type Alias PaidReactor - return fmt.Sprintf("PaidReactor%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaidReactor) TypeID() uint32 { - return PaidReactorTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaidReactor) TypeName() string { - return "paidReactor" -} - -// TypeInfo returns info about TL type. -func (p *PaidReactor) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paidReactor", - ID: PaidReactorTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderID", - SchemaName: "sender_id", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "IsTop", - SchemaName: "is_top", - }, - { - Name: "IsMe", - SchemaName: "is_me", - }, - { - Name: "IsAnonymous", - SchemaName: "is_anonymous", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaidReactor) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paidReactor#9d379008 as nil") - } - b.PutID(PaidReactorTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaidReactor) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paidReactor#9d379008 as nil") - } - if p.SenderID == nil { - return fmt.Errorf("unable to encode paidReactor#9d379008: field sender_id is nil") - } - if err := p.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode paidReactor#9d379008: field sender_id: %w", err) - } - b.PutInt32(p.StarCount) - b.PutBool(p.IsTop) - b.PutBool(p.IsMe) - b.PutBool(p.IsAnonymous) - return nil -} - -// Decode implements bin.Decoder. -func (p *PaidReactor) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paidReactor#9d379008 to nil") - } - if err := b.ConsumeID(PaidReactorTypeID); err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaidReactor) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paidReactor#9d379008 to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: field sender_id: %w", err) - } - p.SenderID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: field star_count: %w", err) - } - p.StarCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: field is_top: %w", err) - } - p.IsTop = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: field is_me: %w", err) - } - p.IsMe = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: field is_anonymous: %w", err) - } - p.IsAnonymous = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaidReactor) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paidReactor#9d379008 as nil") - } - b.ObjStart() - b.PutID("paidReactor") - b.Comma() - b.FieldStart("sender_id") - if p.SenderID == nil { - return fmt.Errorf("unable to encode paidReactor#9d379008: field sender_id is nil") - } - if err := p.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paidReactor#9d379008: field sender_id: %w", err) - } - b.Comma() - b.FieldStart("star_count") - b.PutInt32(p.StarCount) - b.Comma() - b.FieldStart("is_top") - b.PutBool(p.IsTop) - b.Comma() - b.FieldStart("is_me") - b.PutBool(p.IsMe) - b.Comma() - b.FieldStart("is_anonymous") - b.PutBool(p.IsAnonymous) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaidReactor) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paidReactor#9d379008 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paidReactor"); err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: %w", err) - } - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: field sender_id: %w", err) - } - p.SenderID = value - case "star_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: field star_count: %w", err) - } - p.StarCount = value - case "is_top": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: field is_top: %w", err) - } - p.IsTop = value - case "is_me": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: field is_me: %w", err) - } - p.IsMe = value - case "is_anonymous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paidReactor#9d379008: field is_anonymous: %w", err) - } - p.IsAnonymous = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderID returns value of SenderID field. -func (p *PaidReactor) GetSenderID() (value MessageSenderClass) { - if p == nil { - return - } - return p.SenderID -} - -// GetStarCount returns value of StarCount field. -func (p *PaidReactor) GetStarCount() (value int32) { - if p == nil { - return - } - return p.StarCount -} - -// GetIsTop returns value of IsTop field. -func (p *PaidReactor) GetIsTop() (value bool) { - if p == nil { - return - } - return p.IsTop -} - -// GetIsMe returns value of IsMe field. -func (p *PaidReactor) GetIsMe() (value bool) { - if p == nil { - return - } - return p.IsMe -} - -// GetIsAnonymous returns value of IsAnonymous field. -func (p *PaidReactor) GetIsAnonymous() (value bool) { - if p == nil { - return - } - return p.IsAnonymous -} diff --git a/tdapi/tl_parse_markdown_gen.go b/tdapi/tl_parse_markdown_gen.go deleted file mode 100644 index 96d4fdad0..000000000 --- a/tdapi/tl_parse_markdown_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ParseMarkdownRequest represents TL type `parseMarkdown#2d153aef`. -type ParseMarkdownRequest struct { - // The text to parse. For example, "__italic__ ~~strikethrough~~ ||spoiler|| **bold** - // `code` ```pre``` __[italic__ text_url](telegram.org) __italic**bold italic__bold**" - Text FormattedText -} - -// ParseMarkdownRequestTypeID is TL type id of ParseMarkdownRequest. -const ParseMarkdownRequestTypeID = 0x2d153aef - -// Ensuring interfaces in compile-time for ParseMarkdownRequest. -var ( - _ bin.Encoder = &ParseMarkdownRequest{} - _ bin.Decoder = &ParseMarkdownRequest{} - _ bin.BareEncoder = &ParseMarkdownRequest{} - _ bin.BareDecoder = &ParseMarkdownRequest{} -) - -func (p *ParseMarkdownRequest) Zero() bool { - if p == nil { - return true - } - if !(p.Text.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ParseMarkdownRequest) String() string { - if p == nil { - return "ParseMarkdownRequest(nil)" - } - type Alias ParseMarkdownRequest - return fmt.Sprintf("ParseMarkdownRequest%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ParseMarkdownRequest) TypeID() uint32 { - return ParseMarkdownRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ParseMarkdownRequest) TypeName() string { - return "parseMarkdown" -} - -// TypeInfo returns info about TL type. -func (p *ParseMarkdownRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "parseMarkdown", - ID: ParseMarkdownRequestTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ParseMarkdownRequest) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode parseMarkdown#2d153aef as nil") - } - b.PutID(ParseMarkdownRequestTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ParseMarkdownRequest) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode parseMarkdown#2d153aef as nil") - } - if err := p.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode parseMarkdown#2d153aef: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *ParseMarkdownRequest) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode parseMarkdown#2d153aef to nil") - } - if err := b.ConsumeID(ParseMarkdownRequestTypeID); err != nil { - return fmt.Errorf("unable to decode parseMarkdown#2d153aef: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ParseMarkdownRequest) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode parseMarkdown#2d153aef to nil") - } - { - if err := p.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode parseMarkdown#2d153aef: field text: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ParseMarkdownRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode parseMarkdown#2d153aef as nil") - } - b.ObjStart() - b.PutID("parseMarkdown") - b.Comma() - b.FieldStart("text") - if err := p.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode parseMarkdown#2d153aef: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ParseMarkdownRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode parseMarkdown#2d153aef to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("parseMarkdown"); err != nil { - return fmt.Errorf("unable to decode parseMarkdown#2d153aef: %w", err) - } - case "text": - if err := p.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode parseMarkdown#2d153aef: field text: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (p *ParseMarkdownRequest) GetText() (value FormattedText) { - if p == nil { - return - } - return p.Text -} - -// ParseMarkdown invokes method parseMarkdown#2d153aef returning error if any. -func (c *Client) ParseMarkdown(ctx context.Context, text FormattedText) (*FormattedText, error) { - var result FormattedText - - request := &ParseMarkdownRequest{ - Text: text, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_parse_text_entities_gen.go b/tdapi/tl_parse_text_entities_gen.go deleted file mode 100644 index 9b8905c75..000000000 --- a/tdapi/tl_parse_text_entities_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ParseTextEntitiesRequest represents TL type `parseTextEntities#9a1fc29f`. -type ParseTextEntitiesRequest struct { - // The text to parse - Text string - // Text parse mode - ParseMode TextParseModeClass -} - -// ParseTextEntitiesRequestTypeID is TL type id of ParseTextEntitiesRequest. -const ParseTextEntitiesRequestTypeID = 0x9a1fc29f - -// Ensuring interfaces in compile-time for ParseTextEntitiesRequest. -var ( - _ bin.Encoder = &ParseTextEntitiesRequest{} - _ bin.Decoder = &ParseTextEntitiesRequest{} - _ bin.BareEncoder = &ParseTextEntitiesRequest{} - _ bin.BareDecoder = &ParseTextEntitiesRequest{} -) - -func (p *ParseTextEntitiesRequest) Zero() bool { - if p == nil { - return true - } - if !(p.Text == "") { - return false - } - if !(p.ParseMode == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ParseTextEntitiesRequest) String() string { - if p == nil { - return "ParseTextEntitiesRequest(nil)" - } - type Alias ParseTextEntitiesRequest - return fmt.Sprintf("ParseTextEntitiesRequest%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ParseTextEntitiesRequest) TypeID() uint32 { - return ParseTextEntitiesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ParseTextEntitiesRequest) TypeName() string { - return "parseTextEntities" -} - -// TypeInfo returns info about TL type. -func (p *ParseTextEntitiesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "parseTextEntities", - ID: ParseTextEntitiesRequestTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "ParseMode", - SchemaName: "parse_mode", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ParseTextEntitiesRequest) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode parseTextEntities#9a1fc29f as nil") - } - b.PutID(ParseTextEntitiesRequestTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ParseTextEntitiesRequest) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode parseTextEntities#9a1fc29f as nil") - } - b.PutString(p.Text) - if p.ParseMode == nil { - return fmt.Errorf("unable to encode parseTextEntities#9a1fc29f: field parse_mode is nil") - } - if err := p.ParseMode.Encode(b); err != nil { - return fmt.Errorf("unable to encode parseTextEntities#9a1fc29f: field parse_mode: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *ParseTextEntitiesRequest) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode parseTextEntities#9a1fc29f to nil") - } - if err := b.ConsumeID(ParseTextEntitiesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode parseTextEntities#9a1fc29f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ParseTextEntitiesRequest) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode parseTextEntities#9a1fc29f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode parseTextEntities#9a1fc29f: field text: %w", err) - } - p.Text = value - } - { - value, err := DecodeTextParseMode(b) - if err != nil { - return fmt.Errorf("unable to decode parseTextEntities#9a1fc29f: field parse_mode: %w", err) - } - p.ParseMode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ParseTextEntitiesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode parseTextEntities#9a1fc29f as nil") - } - b.ObjStart() - b.PutID("parseTextEntities") - b.Comma() - b.FieldStart("text") - b.PutString(p.Text) - b.Comma() - b.FieldStart("parse_mode") - if p.ParseMode == nil { - return fmt.Errorf("unable to encode parseTextEntities#9a1fc29f: field parse_mode is nil") - } - if err := p.ParseMode.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode parseTextEntities#9a1fc29f: field parse_mode: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ParseTextEntitiesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode parseTextEntities#9a1fc29f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("parseTextEntities"); err != nil { - return fmt.Errorf("unable to decode parseTextEntities#9a1fc29f: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode parseTextEntities#9a1fc29f: field text: %w", err) - } - p.Text = value - case "parse_mode": - value, err := DecodeTDLibJSONTextParseMode(b) - if err != nil { - return fmt.Errorf("unable to decode parseTextEntities#9a1fc29f: field parse_mode: %w", err) - } - p.ParseMode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (p *ParseTextEntitiesRequest) GetText() (value string) { - if p == nil { - return - } - return p.Text -} - -// GetParseMode returns value of ParseMode field. -func (p *ParseTextEntitiesRequest) GetParseMode() (value TextParseModeClass) { - if p == nil { - return - } - return p.ParseMode -} - -// ParseTextEntities invokes method parseTextEntities#9a1fc29f returning error if any. -func (c *Client) ParseTextEntities(ctx context.Context, request *ParseTextEntitiesRequest) (*FormattedText, error) { - var result FormattedText - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_passport_authorization_form_gen.go b/tdapi/tl_passport_authorization_form_gen.go deleted file mode 100644 index 8023a638f..000000000 --- a/tdapi/tl_passport_authorization_form_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PassportAuthorizationForm represents TL type `passportAuthorizationForm#3fe28cb0`. -type PassportAuthorizationForm struct { - // Unique identifier of the authorization form - ID int32 - // Telegram Passport elements that must be provided to complete the form - RequiredElements []PassportRequiredElement - // URL for the privacy policy of the service; may be empty - PrivacyPolicyURL string -} - -// PassportAuthorizationFormTypeID is TL type id of PassportAuthorizationForm. -const PassportAuthorizationFormTypeID = 0x3fe28cb0 - -// Ensuring interfaces in compile-time for PassportAuthorizationForm. -var ( - _ bin.Encoder = &PassportAuthorizationForm{} - _ bin.Decoder = &PassportAuthorizationForm{} - _ bin.BareEncoder = &PassportAuthorizationForm{} - _ bin.BareDecoder = &PassportAuthorizationForm{} -) - -func (p *PassportAuthorizationForm) Zero() bool { - if p == nil { - return true - } - if !(p.ID == 0) { - return false - } - if !(p.RequiredElements == nil) { - return false - } - if !(p.PrivacyPolicyURL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportAuthorizationForm) String() string { - if p == nil { - return "PassportAuthorizationForm(nil)" - } - type Alias PassportAuthorizationForm - return fmt.Sprintf("PassportAuthorizationForm%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportAuthorizationForm) TypeID() uint32 { - return PassportAuthorizationFormTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportAuthorizationForm) TypeName() string { - return "passportAuthorizationForm" -} - -// TypeInfo returns info about TL type. -func (p *PassportAuthorizationForm) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportAuthorizationForm", - ID: PassportAuthorizationFormTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "RequiredElements", - SchemaName: "required_elements", - }, - { - Name: "PrivacyPolicyURL", - SchemaName: "privacy_policy_url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportAuthorizationForm) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportAuthorizationForm#3fe28cb0 as nil") - } - b.PutID(PassportAuthorizationFormTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportAuthorizationForm) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportAuthorizationForm#3fe28cb0 as nil") - } - b.PutInt32(p.ID) - b.PutInt(len(p.RequiredElements)) - for idx, v := range p.RequiredElements { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare passportAuthorizationForm#3fe28cb0: field required_elements element with index %d: %w", idx, err) - } - } - b.PutString(p.PrivacyPolicyURL) - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportAuthorizationForm) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportAuthorizationForm#3fe28cb0 to nil") - } - if err := b.ConsumeID(PassportAuthorizationFormTypeID); err != nil { - return fmt.Errorf("unable to decode passportAuthorizationForm#3fe28cb0: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportAuthorizationForm) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportAuthorizationForm#3fe28cb0 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode passportAuthorizationForm#3fe28cb0: field id: %w", err) - } - p.ID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode passportAuthorizationForm#3fe28cb0: field required_elements: %w", err) - } - - if headerLen > 0 { - p.RequiredElements = make([]PassportRequiredElement, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PassportRequiredElement - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare passportAuthorizationForm#3fe28cb0: field required_elements: %w", err) - } - p.RequiredElements = append(p.RequiredElements, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passportAuthorizationForm#3fe28cb0: field privacy_policy_url: %w", err) - } - p.PrivacyPolicyURL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportAuthorizationForm) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportAuthorizationForm#3fe28cb0 as nil") - } - b.ObjStart() - b.PutID("passportAuthorizationForm") - b.Comma() - b.FieldStart("id") - b.PutInt32(p.ID) - b.Comma() - b.FieldStart("required_elements") - b.ArrStart() - for idx, v := range p.RequiredElements { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportAuthorizationForm#3fe28cb0: field required_elements element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("privacy_policy_url") - b.PutString(p.PrivacyPolicyURL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportAuthorizationForm) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportAuthorizationForm#3fe28cb0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportAuthorizationForm"); err != nil { - return fmt.Errorf("unable to decode passportAuthorizationForm#3fe28cb0: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode passportAuthorizationForm#3fe28cb0: field id: %w", err) - } - p.ID = value - case "required_elements": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PassportRequiredElement - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportAuthorizationForm#3fe28cb0: field required_elements: %w", err) - } - p.RequiredElements = append(p.RequiredElements, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode passportAuthorizationForm#3fe28cb0: field required_elements: %w", err) - } - case "privacy_policy_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passportAuthorizationForm#3fe28cb0: field privacy_policy_url: %w", err) - } - p.PrivacyPolicyURL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (p *PassportAuthorizationForm) GetID() (value int32) { - if p == nil { - return - } - return p.ID -} - -// GetRequiredElements returns value of RequiredElements field. -func (p *PassportAuthorizationForm) GetRequiredElements() (value []PassportRequiredElement) { - if p == nil { - return - } - return p.RequiredElements -} - -// GetPrivacyPolicyURL returns value of PrivacyPolicyURL field. -func (p *PassportAuthorizationForm) GetPrivacyPolicyURL() (value string) { - if p == nil { - return - } - return p.PrivacyPolicyURL -} diff --git a/tdapi/tl_passport_element_error_gen.go b/tdapi/tl_passport_element_error_gen.go deleted file mode 100644 index df0ebde86..000000000 --- a/tdapi/tl_passport_element_error_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PassportElementError represents TL type `passportElementError#91059fc5`. -type PassportElementError struct { - // Type of the Telegram Passport element which has the error - Type PassportElementTypeClass - // Error message - Message string - // Error source - Source PassportElementErrorSourceClass -} - -// PassportElementErrorTypeID is TL type id of PassportElementError. -const PassportElementErrorTypeID = 0x91059fc5 - -// Ensuring interfaces in compile-time for PassportElementError. -var ( - _ bin.Encoder = &PassportElementError{} - _ bin.Decoder = &PassportElementError{} - _ bin.BareEncoder = &PassportElementError{} - _ bin.BareDecoder = &PassportElementError{} -) - -func (p *PassportElementError) Zero() bool { - if p == nil { - return true - } - if !(p.Type == nil) { - return false - } - if !(p.Message == "") { - return false - } - if !(p.Source == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementError) String() string { - if p == nil { - return "PassportElementError(nil)" - } - type Alias PassportElementError - return fmt.Sprintf("PassportElementError%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementError) TypeID() uint32 { - return PassportElementErrorTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementError) TypeName() string { - return "passportElementError" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementError) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementError", - ID: PassportElementErrorTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "Source", - SchemaName: "source", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementError) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementError#91059fc5 as nil") - } - b.PutID(PassportElementErrorTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementError) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementError#91059fc5 as nil") - } - if p.Type == nil { - return fmt.Errorf("unable to encode passportElementError#91059fc5: field type is nil") - } - if err := p.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementError#91059fc5: field type: %w", err) - } - b.PutString(p.Message) - if p.Source == nil { - return fmt.Errorf("unable to encode passportElementError#91059fc5: field source is nil") - } - if err := p.Source.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementError#91059fc5: field source: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementError) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementError#91059fc5 to nil") - } - if err := b.ConsumeID(PassportElementErrorTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementError#91059fc5: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementError) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementError#91059fc5 to nil") - } - { - value, err := DecodePassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode passportElementError#91059fc5: field type: %w", err) - } - p.Type = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passportElementError#91059fc5: field message: %w", err) - } - p.Message = value - } - { - value, err := DecodePassportElementErrorSource(b) - if err != nil { - return fmt.Errorf("unable to decode passportElementError#91059fc5: field source: %w", err) - } - p.Source = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementError) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementError#91059fc5 as nil") - } - b.ObjStart() - b.PutID("passportElementError") - b.Comma() - b.FieldStart("type") - if p.Type == nil { - return fmt.Errorf("unable to encode passportElementError#91059fc5: field type is nil") - } - if err := p.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementError#91059fc5: field type: %w", err) - } - b.Comma() - b.FieldStart("message") - b.PutString(p.Message) - b.Comma() - b.FieldStart("source") - if p.Source == nil { - return fmt.Errorf("unable to encode passportElementError#91059fc5: field source is nil") - } - if err := p.Source.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementError#91059fc5: field source: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementError) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementError#91059fc5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementError"); err != nil { - return fmt.Errorf("unable to decode passportElementError#91059fc5: %w", err) - } - case "type": - value, err := DecodeTDLibJSONPassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode passportElementError#91059fc5: field type: %w", err) - } - p.Type = value - case "message": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passportElementError#91059fc5: field message: %w", err) - } - p.Message = value - case "source": - value, err := DecodeTDLibJSONPassportElementErrorSource(b) - if err != nil { - return fmt.Errorf("unable to decode passportElementError#91059fc5: field source: %w", err) - } - p.Source = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (p *PassportElementError) GetType() (value PassportElementTypeClass) { - if p == nil { - return - } - return p.Type -} - -// GetMessage returns value of Message field. -func (p *PassportElementError) GetMessage() (value string) { - if p == nil { - return - } - return p.Message -} - -// GetSource returns value of Source field. -func (p *PassportElementError) GetSource() (value PassportElementErrorSourceClass) { - if p == nil { - return - } - return p.Source -} diff --git a/tdapi/tl_passport_element_error_source_gen.go b/tdapi/tl_passport_element_error_source_gen.go deleted file mode 100644 index b4de6bd11..000000000 --- a/tdapi/tl_passport_element_error_source_gen.go +++ /dev/null @@ -1,1562 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PassportElementErrorSourceUnspecified represents TL type `passportElementErrorSourceUnspecified#e9734842`. -type PassportElementErrorSourceUnspecified struct { -} - -// PassportElementErrorSourceUnspecifiedTypeID is TL type id of PassportElementErrorSourceUnspecified. -const PassportElementErrorSourceUnspecifiedTypeID = 0xe9734842 - -// construct implements constructor of PassportElementErrorSourceClass. -func (p PassportElementErrorSourceUnspecified) construct() PassportElementErrorSourceClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementErrorSourceUnspecified. -var ( - _ bin.Encoder = &PassportElementErrorSourceUnspecified{} - _ bin.Decoder = &PassportElementErrorSourceUnspecified{} - _ bin.BareEncoder = &PassportElementErrorSourceUnspecified{} - _ bin.BareDecoder = &PassportElementErrorSourceUnspecified{} - - _ PassportElementErrorSourceClass = &PassportElementErrorSourceUnspecified{} -) - -func (p *PassportElementErrorSourceUnspecified) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementErrorSourceUnspecified) String() string { - if p == nil { - return "PassportElementErrorSourceUnspecified(nil)" - } - type Alias PassportElementErrorSourceUnspecified - return fmt.Sprintf("PassportElementErrorSourceUnspecified%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementErrorSourceUnspecified) TypeID() uint32 { - return PassportElementErrorSourceUnspecifiedTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementErrorSourceUnspecified) TypeName() string { - return "passportElementErrorSourceUnspecified" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementErrorSourceUnspecified) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementErrorSourceUnspecified", - ID: PassportElementErrorSourceUnspecifiedTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementErrorSourceUnspecified) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceUnspecified#e9734842 as nil") - } - b.PutID(PassportElementErrorSourceUnspecifiedTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementErrorSourceUnspecified) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceUnspecified#e9734842 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementErrorSourceUnspecified) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceUnspecified#e9734842 to nil") - } - if err := b.ConsumeID(PassportElementErrorSourceUnspecifiedTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceUnspecified#e9734842: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementErrorSourceUnspecified) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceUnspecified#e9734842 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementErrorSourceUnspecified) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceUnspecified#e9734842 as nil") - } - b.ObjStart() - b.PutID("passportElementErrorSourceUnspecified") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementErrorSourceUnspecified) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceUnspecified#e9734842 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementErrorSourceUnspecified"); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceUnspecified#e9734842: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementErrorSourceDataField represents TL type `passportElementErrorSourceDataField#ed9a5ce8`. -type PassportElementErrorSourceDataField struct { - // Field name - FieldName string -} - -// PassportElementErrorSourceDataFieldTypeID is TL type id of PassportElementErrorSourceDataField. -const PassportElementErrorSourceDataFieldTypeID = 0xed9a5ce8 - -// construct implements constructor of PassportElementErrorSourceClass. -func (p PassportElementErrorSourceDataField) construct() PassportElementErrorSourceClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementErrorSourceDataField. -var ( - _ bin.Encoder = &PassportElementErrorSourceDataField{} - _ bin.Decoder = &PassportElementErrorSourceDataField{} - _ bin.BareEncoder = &PassportElementErrorSourceDataField{} - _ bin.BareDecoder = &PassportElementErrorSourceDataField{} - - _ PassportElementErrorSourceClass = &PassportElementErrorSourceDataField{} -) - -func (p *PassportElementErrorSourceDataField) Zero() bool { - if p == nil { - return true - } - if !(p.FieldName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementErrorSourceDataField) String() string { - if p == nil { - return "PassportElementErrorSourceDataField(nil)" - } - type Alias PassportElementErrorSourceDataField - return fmt.Sprintf("PassportElementErrorSourceDataField%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementErrorSourceDataField) TypeID() uint32 { - return PassportElementErrorSourceDataFieldTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementErrorSourceDataField) TypeName() string { - return "passportElementErrorSourceDataField" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementErrorSourceDataField) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementErrorSourceDataField", - ID: PassportElementErrorSourceDataFieldTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FieldName", - SchemaName: "field_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementErrorSourceDataField) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceDataField#ed9a5ce8 as nil") - } - b.PutID(PassportElementErrorSourceDataFieldTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementErrorSourceDataField) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceDataField#ed9a5ce8 as nil") - } - b.PutString(p.FieldName) - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementErrorSourceDataField) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceDataField#ed9a5ce8 to nil") - } - if err := b.ConsumeID(PassportElementErrorSourceDataFieldTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceDataField#ed9a5ce8: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementErrorSourceDataField) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceDataField#ed9a5ce8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceDataField#ed9a5ce8: field field_name: %w", err) - } - p.FieldName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementErrorSourceDataField) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceDataField#ed9a5ce8 as nil") - } - b.ObjStart() - b.PutID("passportElementErrorSourceDataField") - b.Comma() - b.FieldStart("field_name") - b.PutString(p.FieldName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementErrorSourceDataField) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceDataField#ed9a5ce8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementErrorSourceDataField"); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceDataField#ed9a5ce8: %w", err) - } - case "field_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceDataField#ed9a5ce8: field field_name: %w", err) - } - p.FieldName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFieldName returns value of FieldName field. -func (p *PassportElementErrorSourceDataField) GetFieldName() (value string) { - if p == nil { - return - } - return p.FieldName -} - -// PassportElementErrorSourceFrontSide represents TL type `passportElementErrorSourceFrontSide#70fd7334`. -type PassportElementErrorSourceFrontSide struct { -} - -// PassportElementErrorSourceFrontSideTypeID is TL type id of PassportElementErrorSourceFrontSide. -const PassportElementErrorSourceFrontSideTypeID = 0x70fd7334 - -// construct implements constructor of PassportElementErrorSourceClass. -func (p PassportElementErrorSourceFrontSide) construct() PassportElementErrorSourceClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementErrorSourceFrontSide. -var ( - _ bin.Encoder = &PassportElementErrorSourceFrontSide{} - _ bin.Decoder = &PassportElementErrorSourceFrontSide{} - _ bin.BareEncoder = &PassportElementErrorSourceFrontSide{} - _ bin.BareDecoder = &PassportElementErrorSourceFrontSide{} - - _ PassportElementErrorSourceClass = &PassportElementErrorSourceFrontSide{} -) - -func (p *PassportElementErrorSourceFrontSide) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementErrorSourceFrontSide) String() string { - if p == nil { - return "PassportElementErrorSourceFrontSide(nil)" - } - type Alias PassportElementErrorSourceFrontSide - return fmt.Sprintf("PassportElementErrorSourceFrontSide%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementErrorSourceFrontSide) TypeID() uint32 { - return PassportElementErrorSourceFrontSideTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementErrorSourceFrontSide) TypeName() string { - return "passportElementErrorSourceFrontSide" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementErrorSourceFrontSide) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementErrorSourceFrontSide", - ID: PassportElementErrorSourceFrontSideTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementErrorSourceFrontSide) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceFrontSide#70fd7334 as nil") - } - b.PutID(PassportElementErrorSourceFrontSideTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementErrorSourceFrontSide) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceFrontSide#70fd7334 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementErrorSourceFrontSide) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceFrontSide#70fd7334 to nil") - } - if err := b.ConsumeID(PassportElementErrorSourceFrontSideTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceFrontSide#70fd7334: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementErrorSourceFrontSide) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceFrontSide#70fd7334 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementErrorSourceFrontSide) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceFrontSide#70fd7334 as nil") - } - b.ObjStart() - b.PutID("passportElementErrorSourceFrontSide") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementErrorSourceFrontSide) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceFrontSide#70fd7334 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementErrorSourceFrontSide"); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceFrontSide#70fd7334: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementErrorSourceReverseSide represents TL type `passportElementErrorSourceReverseSide#725bf9f7`. -type PassportElementErrorSourceReverseSide struct { -} - -// PassportElementErrorSourceReverseSideTypeID is TL type id of PassportElementErrorSourceReverseSide. -const PassportElementErrorSourceReverseSideTypeID = 0x725bf9f7 - -// construct implements constructor of PassportElementErrorSourceClass. -func (p PassportElementErrorSourceReverseSide) construct() PassportElementErrorSourceClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementErrorSourceReverseSide. -var ( - _ bin.Encoder = &PassportElementErrorSourceReverseSide{} - _ bin.Decoder = &PassportElementErrorSourceReverseSide{} - _ bin.BareEncoder = &PassportElementErrorSourceReverseSide{} - _ bin.BareDecoder = &PassportElementErrorSourceReverseSide{} - - _ PassportElementErrorSourceClass = &PassportElementErrorSourceReverseSide{} -) - -func (p *PassportElementErrorSourceReverseSide) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementErrorSourceReverseSide) String() string { - if p == nil { - return "PassportElementErrorSourceReverseSide(nil)" - } - type Alias PassportElementErrorSourceReverseSide - return fmt.Sprintf("PassportElementErrorSourceReverseSide%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementErrorSourceReverseSide) TypeID() uint32 { - return PassportElementErrorSourceReverseSideTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementErrorSourceReverseSide) TypeName() string { - return "passportElementErrorSourceReverseSide" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementErrorSourceReverseSide) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementErrorSourceReverseSide", - ID: PassportElementErrorSourceReverseSideTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementErrorSourceReverseSide) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceReverseSide#725bf9f7 as nil") - } - b.PutID(PassportElementErrorSourceReverseSideTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementErrorSourceReverseSide) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceReverseSide#725bf9f7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementErrorSourceReverseSide) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceReverseSide#725bf9f7 to nil") - } - if err := b.ConsumeID(PassportElementErrorSourceReverseSideTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceReverseSide#725bf9f7: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementErrorSourceReverseSide) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceReverseSide#725bf9f7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementErrorSourceReverseSide) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceReverseSide#725bf9f7 as nil") - } - b.ObjStart() - b.PutID("passportElementErrorSourceReverseSide") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementErrorSourceReverseSide) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceReverseSide#725bf9f7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementErrorSourceReverseSide"); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceReverseSide#725bf9f7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementErrorSourceSelfie represents TL type `passportElementErrorSourceSelfie#d07e1428`. -type PassportElementErrorSourceSelfie struct { -} - -// PassportElementErrorSourceSelfieTypeID is TL type id of PassportElementErrorSourceSelfie. -const PassportElementErrorSourceSelfieTypeID = 0xd07e1428 - -// construct implements constructor of PassportElementErrorSourceClass. -func (p PassportElementErrorSourceSelfie) construct() PassportElementErrorSourceClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementErrorSourceSelfie. -var ( - _ bin.Encoder = &PassportElementErrorSourceSelfie{} - _ bin.Decoder = &PassportElementErrorSourceSelfie{} - _ bin.BareEncoder = &PassportElementErrorSourceSelfie{} - _ bin.BareDecoder = &PassportElementErrorSourceSelfie{} - - _ PassportElementErrorSourceClass = &PassportElementErrorSourceSelfie{} -) - -func (p *PassportElementErrorSourceSelfie) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementErrorSourceSelfie) String() string { - if p == nil { - return "PassportElementErrorSourceSelfie(nil)" - } - type Alias PassportElementErrorSourceSelfie - return fmt.Sprintf("PassportElementErrorSourceSelfie%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementErrorSourceSelfie) TypeID() uint32 { - return PassportElementErrorSourceSelfieTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementErrorSourceSelfie) TypeName() string { - return "passportElementErrorSourceSelfie" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementErrorSourceSelfie) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementErrorSourceSelfie", - ID: PassportElementErrorSourceSelfieTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementErrorSourceSelfie) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceSelfie#d07e1428 as nil") - } - b.PutID(PassportElementErrorSourceSelfieTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementErrorSourceSelfie) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceSelfie#d07e1428 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementErrorSourceSelfie) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceSelfie#d07e1428 to nil") - } - if err := b.ConsumeID(PassportElementErrorSourceSelfieTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceSelfie#d07e1428: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementErrorSourceSelfie) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceSelfie#d07e1428 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementErrorSourceSelfie) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceSelfie#d07e1428 as nil") - } - b.ObjStart() - b.PutID("passportElementErrorSourceSelfie") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementErrorSourceSelfie) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceSelfie#d07e1428 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementErrorSourceSelfie"); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceSelfie#d07e1428: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementErrorSourceTranslationFile represents TL type `passportElementErrorSourceTranslationFile#d6e53714`. -type PassportElementErrorSourceTranslationFile struct { - // Index of a file with the error - FileIndex int32 -} - -// PassportElementErrorSourceTranslationFileTypeID is TL type id of PassportElementErrorSourceTranslationFile. -const PassportElementErrorSourceTranslationFileTypeID = 0xd6e53714 - -// construct implements constructor of PassportElementErrorSourceClass. -func (p PassportElementErrorSourceTranslationFile) construct() PassportElementErrorSourceClass { - return &p -} - -// Ensuring interfaces in compile-time for PassportElementErrorSourceTranslationFile. -var ( - _ bin.Encoder = &PassportElementErrorSourceTranslationFile{} - _ bin.Decoder = &PassportElementErrorSourceTranslationFile{} - _ bin.BareEncoder = &PassportElementErrorSourceTranslationFile{} - _ bin.BareDecoder = &PassportElementErrorSourceTranslationFile{} - - _ PassportElementErrorSourceClass = &PassportElementErrorSourceTranslationFile{} -) - -func (p *PassportElementErrorSourceTranslationFile) Zero() bool { - if p == nil { - return true - } - if !(p.FileIndex == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementErrorSourceTranslationFile) String() string { - if p == nil { - return "PassportElementErrorSourceTranslationFile(nil)" - } - type Alias PassportElementErrorSourceTranslationFile - return fmt.Sprintf("PassportElementErrorSourceTranslationFile%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementErrorSourceTranslationFile) TypeID() uint32 { - return PassportElementErrorSourceTranslationFileTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementErrorSourceTranslationFile) TypeName() string { - return "passportElementErrorSourceTranslationFile" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementErrorSourceTranslationFile) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementErrorSourceTranslationFile", - ID: PassportElementErrorSourceTranslationFileTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileIndex", - SchemaName: "file_index", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementErrorSourceTranslationFile) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceTranslationFile#d6e53714 as nil") - } - b.PutID(PassportElementErrorSourceTranslationFileTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementErrorSourceTranslationFile) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceTranslationFile#d6e53714 as nil") - } - b.PutInt32(p.FileIndex) - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementErrorSourceTranslationFile) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceTranslationFile#d6e53714 to nil") - } - if err := b.ConsumeID(PassportElementErrorSourceTranslationFileTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceTranslationFile#d6e53714: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementErrorSourceTranslationFile) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceTranslationFile#d6e53714 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceTranslationFile#d6e53714: field file_index: %w", err) - } - p.FileIndex = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementErrorSourceTranslationFile) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceTranslationFile#d6e53714 as nil") - } - b.ObjStart() - b.PutID("passportElementErrorSourceTranslationFile") - b.Comma() - b.FieldStart("file_index") - b.PutInt32(p.FileIndex) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementErrorSourceTranslationFile) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceTranslationFile#d6e53714 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementErrorSourceTranslationFile"); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceTranslationFile#d6e53714: %w", err) - } - case "file_index": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceTranslationFile#d6e53714: field file_index: %w", err) - } - p.FileIndex = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileIndex returns value of FileIndex field. -func (p *PassportElementErrorSourceTranslationFile) GetFileIndex() (value int32) { - if p == nil { - return - } - return p.FileIndex -} - -// PassportElementErrorSourceTranslationFiles represents TL type `passportElementErrorSourceTranslationFiles#22a5a41c`. -type PassportElementErrorSourceTranslationFiles struct { -} - -// PassportElementErrorSourceTranslationFilesTypeID is TL type id of PassportElementErrorSourceTranslationFiles. -const PassportElementErrorSourceTranslationFilesTypeID = 0x22a5a41c - -// construct implements constructor of PassportElementErrorSourceClass. -func (p PassportElementErrorSourceTranslationFiles) construct() PassportElementErrorSourceClass { - return &p -} - -// Ensuring interfaces in compile-time for PassportElementErrorSourceTranslationFiles. -var ( - _ bin.Encoder = &PassportElementErrorSourceTranslationFiles{} - _ bin.Decoder = &PassportElementErrorSourceTranslationFiles{} - _ bin.BareEncoder = &PassportElementErrorSourceTranslationFiles{} - _ bin.BareDecoder = &PassportElementErrorSourceTranslationFiles{} - - _ PassportElementErrorSourceClass = &PassportElementErrorSourceTranslationFiles{} -) - -func (p *PassportElementErrorSourceTranslationFiles) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementErrorSourceTranslationFiles) String() string { - if p == nil { - return "PassportElementErrorSourceTranslationFiles(nil)" - } - type Alias PassportElementErrorSourceTranslationFiles - return fmt.Sprintf("PassportElementErrorSourceTranslationFiles%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementErrorSourceTranslationFiles) TypeID() uint32 { - return PassportElementErrorSourceTranslationFilesTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementErrorSourceTranslationFiles) TypeName() string { - return "passportElementErrorSourceTranslationFiles" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementErrorSourceTranslationFiles) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementErrorSourceTranslationFiles", - ID: PassportElementErrorSourceTranslationFilesTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementErrorSourceTranslationFiles) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceTranslationFiles#22a5a41c as nil") - } - b.PutID(PassportElementErrorSourceTranslationFilesTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementErrorSourceTranslationFiles) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceTranslationFiles#22a5a41c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementErrorSourceTranslationFiles) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceTranslationFiles#22a5a41c to nil") - } - if err := b.ConsumeID(PassportElementErrorSourceTranslationFilesTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceTranslationFiles#22a5a41c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementErrorSourceTranslationFiles) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceTranslationFiles#22a5a41c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementErrorSourceTranslationFiles) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceTranslationFiles#22a5a41c as nil") - } - b.ObjStart() - b.PutID("passportElementErrorSourceTranslationFiles") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementErrorSourceTranslationFiles) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceTranslationFiles#22a5a41c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementErrorSourceTranslationFiles"); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceTranslationFiles#22a5a41c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementErrorSourceFile represents TL type `passportElementErrorSourceFile#786c3b30`. -type PassportElementErrorSourceFile struct { - // Index of a file with the error - FileIndex int32 -} - -// PassportElementErrorSourceFileTypeID is TL type id of PassportElementErrorSourceFile. -const PassportElementErrorSourceFileTypeID = 0x786c3b30 - -// construct implements constructor of PassportElementErrorSourceClass. -func (p PassportElementErrorSourceFile) construct() PassportElementErrorSourceClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementErrorSourceFile. -var ( - _ bin.Encoder = &PassportElementErrorSourceFile{} - _ bin.Decoder = &PassportElementErrorSourceFile{} - _ bin.BareEncoder = &PassportElementErrorSourceFile{} - _ bin.BareDecoder = &PassportElementErrorSourceFile{} - - _ PassportElementErrorSourceClass = &PassportElementErrorSourceFile{} -) - -func (p *PassportElementErrorSourceFile) Zero() bool { - if p == nil { - return true - } - if !(p.FileIndex == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementErrorSourceFile) String() string { - if p == nil { - return "PassportElementErrorSourceFile(nil)" - } - type Alias PassportElementErrorSourceFile - return fmt.Sprintf("PassportElementErrorSourceFile%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementErrorSourceFile) TypeID() uint32 { - return PassportElementErrorSourceFileTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementErrorSourceFile) TypeName() string { - return "passportElementErrorSourceFile" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementErrorSourceFile) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementErrorSourceFile", - ID: PassportElementErrorSourceFileTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileIndex", - SchemaName: "file_index", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementErrorSourceFile) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceFile#786c3b30 as nil") - } - b.PutID(PassportElementErrorSourceFileTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementErrorSourceFile) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceFile#786c3b30 as nil") - } - b.PutInt32(p.FileIndex) - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementErrorSourceFile) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceFile#786c3b30 to nil") - } - if err := b.ConsumeID(PassportElementErrorSourceFileTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceFile#786c3b30: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementErrorSourceFile) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceFile#786c3b30 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceFile#786c3b30: field file_index: %w", err) - } - p.FileIndex = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementErrorSourceFile) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceFile#786c3b30 as nil") - } - b.ObjStart() - b.PutID("passportElementErrorSourceFile") - b.Comma() - b.FieldStart("file_index") - b.PutInt32(p.FileIndex) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementErrorSourceFile) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceFile#786c3b30 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementErrorSourceFile"); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceFile#786c3b30: %w", err) - } - case "file_index": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceFile#786c3b30: field file_index: %w", err) - } - p.FileIndex = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileIndex returns value of FileIndex field. -func (p *PassportElementErrorSourceFile) GetFileIndex() (value int32) { - if p == nil { - return - } - return p.FileIndex -} - -// PassportElementErrorSourceFiles represents TL type `passportElementErrorSourceFiles#70e6a6d2`. -type PassportElementErrorSourceFiles struct { -} - -// PassportElementErrorSourceFilesTypeID is TL type id of PassportElementErrorSourceFiles. -const PassportElementErrorSourceFilesTypeID = 0x70e6a6d2 - -// construct implements constructor of PassportElementErrorSourceClass. -func (p PassportElementErrorSourceFiles) construct() PassportElementErrorSourceClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementErrorSourceFiles. -var ( - _ bin.Encoder = &PassportElementErrorSourceFiles{} - _ bin.Decoder = &PassportElementErrorSourceFiles{} - _ bin.BareEncoder = &PassportElementErrorSourceFiles{} - _ bin.BareDecoder = &PassportElementErrorSourceFiles{} - - _ PassportElementErrorSourceClass = &PassportElementErrorSourceFiles{} -) - -func (p *PassportElementErrorSourceFiles) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementErrorSourceFiles) String() string { - if p == nil { - return "PassportElementErrorSourceFiles(nil)" - } - type Alias PassportElementErrorSourceFiles - return fmt.Sprintf("PassportElementErrorSourceFiles%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementErrorSourceFiles) TypeID() uint32 { - return PassportElementErrorSourceFilesTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementErrorSourceFiles) TypeName() string { - return "passportElementErrorSourceFiles" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementErrorSourceFiles) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementErrorSourceFiles", - ID: PassportElementErrorSourceFilesTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementErrorSourceFiles) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceFiles#70e6a6d2 as nil") - } - b.PutID(PassportElementErrorSourceFilesTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementErrorSourceFiles) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceFiles#70e6a6d2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementErrorSourceFiles) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceFiles#70e6a6d2 to nil") - } - if err := b.ConsumeID(PassportElementErrorSourceFilesTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceFiles#70e6a6d2: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementErrorSourceFiles) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceFiles#70e6a6d2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementErrorSourceFiles) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementErrorSourceFiles#70e6a6d2 as nil") - } - b.ObjStart() - b.PutID("passportElementErrorSourceFiles") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementErrorSourceFiles) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementErrorSourceFiles#70e6a6d2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementErrorSourceFiles"); err != nil { - return fmt.Errorf("unable to decode passportElementErrorSourceFiles#70e6a6d2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementErrorSourceClassName is schema name of PassportElementErrorSourceClass. -const PassportElementErrorSourceClassName = "PassportElementErrorSource" - -// PassportElementErrorSourceClass represents PassportElementErrorSource generic type. -// -// Example: -// -// g, err := tdapi.DecodePassportElementErrorSource(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PassportElementErrorSourceUnspecified: // passportElementErrorSourceUnspecified#e9734842 -// case *tdapi.PassportElementErrorSourceDataField: // passportElementErrorSourceDataField#ed9a5ce8 -// case *tdapi.PassportElementErrorSourceFrontSide: // passportElementErrorSourceFrontSide#70fd7334 -// case *tdapi.PassportElementErrorSourceReverseSide: // passportElementErrorSourceReverseSide#725bf9f7 -// case *tdapi.PassportElementErrorSourceSelfie: // passportElementErrorSourceSelfie#d07e1428 -// case *tdapi.PassportElementErrorSourceTranslationFile: // passportElementErrorSourceTranslationFile#d6e53714 -// case *tdapi.PassportElementErrorSourceTranslationFiles: // passportElementErrorSourceTranslationFiles#22a5a41c -// case *tdapi.PassportElementErrorSourceFile: // passportElementErrorSourceFile#786c3b30 -// case *tdapi.PassportElementErrorSourceFiles: // passportElementErrorSourceFiles#70e6a6d2 -// default: panic(v) -// } -type PassportElementErrorSourceClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PassportElementErrorSourceClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePassportElementErrorSource implements binary de-serialization for PassportElementErrorSourceClass. -func DecodePassportElementErrorSource(buf *bin.Buffer) (PassportElementErrorSourceClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PassportElementErrorSourceUnspecifiedTypeID: - // Decoding passportElementErrorSourceUnspecified#e9734842. - v := PassportElementErrorSourceUnspecified{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case PassportElementErrorSourceDataFieldTypeID: - // Decoding passportElementErrorSourceDataField#ed9a5ce8. - v := PassportElementErrorSourceDataField{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case PassportElementErrorSourceFrontSideTypeID: - // Decoding passportElementErrorSourceFrontSide#70fd7334. - v := PassportElementErrorSourceFrontSide{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case PassportElementErrorSourceReverseSideTypeID: - // Decoding passportElementErrorSourceReverseSide#725bf9f7. - v := PassportElementErrorSourceReverseSide{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case PassportElementErrorSourceSelfieTypeID: - // Decoding passportElementErrorSourceSelfie#d07e1428. - v := PassportElementErrorSourceSelfie{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case PassportElementErrorSourceTranslationFileTypeID: - // Decoding passportElementErrorSourceTranslationFile#d6e53714. - v := PassportElementErrorSourceTranslationFile{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case PassportElementErrorSourceTranslationFilesTypeID: - // Decoding passportElementErrorSourceTranslationFiles#22a5a41c. - v := PassportElementErrorSourceTranslationFiles{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case PassportElementErrorSourceFileTypeID: - // Decoding passportElementErrorSourceFile#786c3b30. - v := PassportElementErrorSourceFile{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case PassportElementErrorSourceFilesTypeID: - // Decoding passportElementErrorSourceFiles#70e6a6d2. - v := PassportElementErrorSourceFiles{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPassportElementErrorSource implements binary de-serialization for PassportElementErrorSourceClass. -func DecodeTDLibJSONPassportElementErrorSource(buf tdjson.Decoder) (PassportElementErrorSourceClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "passportElementErrorSourceUnspecified": - // Decoding passportElementErrorSourceUnspecified#e9734842. - v := PassportElementErrorSourceUnspecified{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "passportElementErrorSourceDataField": - // Decoding passportElementErrorSourceDataField#ed9a5ce8. - v := PassportElementErrorSourceDataField{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "passportElementErrorSourceFrontSide": - // Decoding passportElementErrorSourceFrontSide#70fd7334. - v := PassportElementErrorSourceFrontSide{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "passportElementErrorSourceReverseSide": - // Decoding passportElementErrorSourceReverseSide#725bf9f7. - v := PassportElementErrorSourceReverseSide{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "passportElementErrorSourceSelfie": - // Decoding passportElementErrorSourceSelfie#d07e1428. - v := PassportElementErrorSourceSelfie{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "passportElementErrorSourceTranslationFile": - // Decoding passportElementErrorSourceTranslationFile#d6e53714. - v := PassportElementErrorSourceTranslationFile{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "passportElementErrorSourceTranslationFiles": - // Decoding passportElementErrorSourceTranslationFiles#22a5a41c. - v := PassportElementErrorSourceTranslationFiles{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "passportElementErrorSourceFile": - // Decoding passportElementErrorSourceFile#786c3b30. - v := PassportElementErrorSourceFile{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - case "passportElementErrorSourceFiles": - // Decoding passportElementErrorSourceFiles#70e6a6d2. - v := PassportElementErrorSourceFiles{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PassportElementErrorSourceClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PassportElementErrorSource boxes the PassportElementErrorSourceClass providing a helper. -type PassportElementErrorSourceBox struct { - PassportElementErrorSource PassportElementErrorSourceClass -} - -// Decode implements bin.Decoder for PassportElementErrorSourceBox. -func (b *PassportElementErrorSourceBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PassportElementErrorSourceBox to nil") - } - v, err := DecodePassportElementErrorSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PassportElementErrorSource = v - return nil -} - -// Encode implements bin.Encode for PassportElementErrorSourceBox. -func (b *PassportElementErrorSourceBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PassportElementErrorSource == nil { - return fmt.Errorf("unable to encode PassportElementErrorSourceClass as nil") - } - return b.PassportElementErrorSource.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PassportElementErrorSourceBox. -func (b *PassportElementErrorSourceBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PassportElementErrorSourceBox to nil") - } - v, err := DecodeTDLibJSONPassportElementErrorSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PassportElementErrorSource = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PassportElementErrorSourceBox. -func (b *PassportElementErrorSourceBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PassportElementErrorSource == nil { - return fmt.Errorf("unable to encode PassportElementErrorSourceClass as nil") - } - return b.PassportElementErrorSource.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_passport_element_gen.go b/tdapi/tl_passport_element_gen.go deleted file mode 100644 index c8a0170c7..000000000 --- a/tdapi/tl_passport_element_gen.go +++ /dev/null @@ -1,2492 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PassportElementPersonalDetails represents TL type `passportElementPersonalDetails#4894fe83`. -type PassportElementPersonalDetails struct { - // Personal details of the user - PersonalDetails PersonalDetails -} - -// PassportElementPersonalDetailsTypeID is TL type id of PassportElementPersonalDetails. -const PassportElementPersonalDetailsTypeID = 0x4894fe83 - -// construct implements constructor of PassportElementClass. -func (p PassportElementPersonalDetails) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementPersonalDetails. -var ( - _ bin.Encoder = &PassportElementPersonalDetails{} - _ bin.Decoder = &PassportElementPersonalDetails{} - _ bin.BareEncoder = &PassportElementPersonalDetails{} - _ bin.BareDecoder = &PassportElementPersonalDetails{} - - _ PassportElementClass = &PassportElementPersonalDetails{} -) - -func (p *PassportElementPersonalDetails) Zero() bool { - if p == nil { - return true - } - if !(p.PersonalDetails.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementPersonalDetails) String() string { - if p == nil { - return "PassportElementPersonalDetails(nil)" - } - type Alias PassportElementPersonalDetails - return fmt.Sprintf("PassportElementPersonalDetails%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementPersonalDetails) TypeID() uint32 { - return PassportElementPersonalDetailsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementPersonalDetails) TypeName() string { - return "passportElementPersonalDetails" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementPersonalDetails) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementPersonalDetails", - ID: PassportElementPersonalDetailsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PersonalDetails", - SchemaName: "personal_details", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementPersonalDetails) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPersonalDetails#4894fe83 as nil") - } - b.PutID(PassportElementPersonalDetailsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementPersonalDetails) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPersonalDetails#4894fe83 as nil") - } - if err := p.PersonalDetails.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementPersonalDetails#4894fe83: field personal_details: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementPersonalDetails) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPersonalDetails#4894fe83 to nil") - } - if err := b.ConsumeID(PassportElementPersonalDetailsTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementPersonalDetails#4894fe83: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementPersonalDetails) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPersonalDetails#4894fe83 to nil") - } - { - if err := p.PersonalDetails.Decode(b); err != nil { - return fmt.Errorf("unable to decode passportElementPersonalDetails#4894fe83: field personal_details: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementPersonalDetails) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPersonalDetails#4894fe83 as nil") - } - b.ObjStart() - b.PutID("passportElementPersonalDetails") - b.Comma() - b.FieldStart("personal_details") - if err := p.PersonalDetails.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementPersonalDetails#4894fe83: field personal_details: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementPersonalDetails) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPersonalDetails#4894fe83 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementPersonalDetails"); err != nil { - return fmt.Errorf("unable to decode passportElementPersonalDetails#4894fe83: %w", err) - } - case "personal_details": - if err := p.PersonalDetails.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementPersonalDetails#4894fe83: field personal_details: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPersonalDetails returns value of PersonalDetails field. -func (p *PassportElementPersonalDetails) GetPersonalDetails() (value PersonalDetails) { - if p == nil { - return - } - return p.PersonalDetails -} - -// PassportElementPassport represents TL type `passportElementPassport#f043e723`. -type PassportElementPassport struct { - // Passport - Passport IdentityDocument -} - -// PassportElementPassportTypeID is TL type id of PassportElementPassport. -const PassportElementPassportTypeID = 0xf043e723 - -// construct implements constructor of PassportElementClass. -func (p PassportElementPassport) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementPassport. -var ( - _ bin.Encoder = &PassportElementPassport{} - _ bin.Decoder = &PassportElementPassport{} - _ bin.BareEncoder = &PassportElementPassport{} - _ bin.BareDecoder = &PassportElementPassport{} - - _ PassportElementClass = &PassportElementPassport{} -) - -func (p *PassportElementPassport) Zero() bool { - if p == nil { - return true - } - if !(p.Passport.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementPassport) String() string { - if p == nil { - return "PassportElementPassport(nil)" - } - type Alias PassportElementPassport - return fmt.Sprintf("PassportElementPassport%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementPassport) TypeID() uint32 { - return PassportElementPassportTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementPassport) TypeName() string { - return "passportElementPassport" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementPassport) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementPassport", - ID: PassportElementPassportTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Passport", - SchemaName: "passport", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementPassport) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPassport#f043e723 as nil") - } - b.PutID(PassportElementPassportTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementPassport) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPassport#f043e723 as nil") - } - if err := p.Passport.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementPassport#f043e723: field passport: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementPassport) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPassport#f043e723 to nil") - } - if err := b.ConsumeID(PassportElementPassportTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementPassport#f043e723: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementPassport) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPassport#f043e723 to nil") - } - { - if err := p.Passport.Decode(b); err != nil { - return fmt.Errorf("unable to decode passportElementPassport#f043e723: field passport: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementPassport) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPassport#f043e723 as nil") - } - b.ObjStart() - b.PutID("passportElementPassport") - b.Comma() - b.FieldStart("passport") - if err := p.Passport.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementPassport#f043e723: field passport: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementPassport) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPassport#f043e723 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementPassport"); err != nil { - return fmt.Errorf("unable to decode passportElementPassport#f043e723: %w", err) - } - case "passport": - if err := p.Passport.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementPassport#f043e723: field passport: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPassport returns value of Passport field. -func (p *PassportElementPassport) GetPassport() (value IdentityDocument) { - if p == nil { - return - } - return p.Passport -} - -// PassportElementDriverLicense represents TL type `passportElementDriverLicense#61f70cad`. -type PassportElementDriverLicense struct { - // Driver license - DriverLicense IdentityDocument -} - -// PassportElementDriverLicenseTypeID is TL type id of PassportElementDriverLicense. -const PassportElementDriverLicenseTypeID = 0x61f70cad - -// construct implements constructor of PassportElementClass. -func (p PassportElementDriverLicense) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementDriverLicense. -var ( - _ bin.Encoder = &PassportElementDriverLicense{} - _ bin.Decoder = &PassportElementDriverLicense{} - _ bin.BareEncoder = &PassportElementDriverLicense{} - _ bin.BareDecoder = &PassportElementDriverLicense{} - - _ PassportElementClass = &PassportElementDriverLicense{} -) - -func (p *PassportElementDriverLicense) Zero() bool { - if p == nil { - return true - } - if !(p.DriverLicense.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementDriverLicense) String() string { - if p == nil { - return "PassportElementDriverLicense(nil)" - } - type Alias PassportElementDriverLicense - return fmt.Sprintf("PassportElementDriverLicense%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementDriverLicense) TypeID() uint32 { - return PassportElementDriverLicenseTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementDriverLicense) TypeName() string { - return "passportElementDriverLicense" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementDriverLicense) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementDriverLicense", - ID: PassportElementDriverLicenseTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DriverLicense", - SchemaName: "driver_license", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementDriverLicense) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementDriverLicense#61f70cad as nil") - } - b.PutID(PassportElementDriverLicenseTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementDriverLicense) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementDriverLicense#61f70cad as nil") - } - if err := p.DriverLicense.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementDriverLicense#61f70cad: field driver_license: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementDriverLicense) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementDriverLicense#61f70cad to nil") - } - if err := b.ConsumeID(PassportElementDriverLicenseTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementDriverLicense#61f70cad: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementDriverLicense) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementDriverLicense#61f70cad to nil") - } - { - if err := p.DriverLicense.Decode(b); err != nil { - return fmt.Errorf("unable to decode passportElementDriverLicense#61f70cad: field driver_license: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementDriverLicense) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementDriverLicense#61f70cad as nil") - } - b.ObjStart() - b.PutID("passportElementDriverLicense") - b.Comma() - b.FieldStart("driver_license") - if err := p.DriverLicense.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementDriverLicense#61f70cad: field driver_license: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementDriverLicense) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementDriverLicense#61f70cad to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementDriverLicense"); err != nil { - return fmt.Errorf("unable to decode passportElementDriverLicense#61f70cad: %w", err) - } - case "driver_license": - if err := p.DriverLicense.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementDriverLicense#61f70cad: field driver_license: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDriverLicense returns value of DriverLicense field. -func (p *PassportElementDriverLicense) GetDriverLicense() (value IdentityDocument) { - if p == nil { - return - } - return p.DriverLicense -} - -// PassportElementIdentityCard represents TL type `passportElementIdentityCard#7c33e535`. -type PassportElementIdentityCard struct { - // Identity card - IdentityCard IdentityDocument -} - -// PassportElementIdentityCardTypeID is TL type id of PassportElementIdentityCard. -const PassportElementIdentityCardTypeID = 0x7c33e535 - -// construct implements constructor of PassportElementClass. -func (p PassportElementIdentityCard) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementIdentityCard. -var ( - _ bin.Encoder = &PassportElementIdentityCard{} - _ bin.Decoder = &PassportElementIdentityCard{} - _ bin.BareEncoder = &PassportElementIdentityCard{} - _ bin.BareDecoder = &PassportElementIdentityCard{} - - _ PassportElementClass = &PassportElementIdentityCard{} -) - -func (p *PassportElementIdentityCard) Zero() bool { - if p == nil { - return true - } - if !(p.IdentityCard.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementIdentityCard) String() string { - if p == nil { - return "PassportElementIdentityCard(nil)" - } - type Alias PassportElementIdentityCard - return fmt.Sprintf("PassportElementIdentityCard%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementIdentityCard) TypeID() uint32 { - return PassportElementIdentityCardTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementIdentityCard) TypeName() string { - return "passportElementIdentityCard" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementIdentityCard) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementIdentityCard", - ID: PassportElementIdentityCardTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IdentityCard", - SchemaName: "identity_card", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementIdentityCard) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementIdentityCard#7c33e535 as nil") - } - b.PutID(PassportElementIdentityCardTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementIdentityCard) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementIdentityCard#7c33e535 as nil") - } - if err := p.IdentityCard.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementIdentityCard#7c33e535: field identity_card: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementIdentityCard) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementIdentityCard#7c33e535 to nil") - } - if err := b.ConsumeID(PassportElementIdentityCardTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementIdentityCard#7c33e535: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementIdentityCard) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementIdentityCard#7c33e535 to nil") - } - { - if err := p.IdentityCard.Decode(b); err != nil { - return fmt.Errorf("unable to decode passportElementIdentityCard#7c33e535: field identity_card: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementIdentityCard) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementIdentityCard#7c33e535 as nil") - } - b.ObjStart() - b.PutID("passportElementIdentityCard") - b.Comma() - b.FieldStart("identity_card") - if err := p.IdentityCard.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementIdentityCard#7c33e535: field identity_card: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementIdentityCard) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementIdentityCard#7c33e535 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementIdentityCard"); err != nil { - return fmt.Errorf("unable to decode passportElementIdentityCard#7c33e535: %w", err) - } - case "identity_card": - if err := p.IdentityCard.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementIdentityCard#7c33e535: field identity_card: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetIdentityCard returns value of IdentityCard field. -func (p *PassportElementIdentityCard) GetIdentityCard() (value IdentityDocument) { - if p == nil { - return - } - return p.IdentityCard -} - -// PassportElementInternalPassport represents TL type `passportElementInternalPassport#228ad87`. -type PassportElementInternalPassport struct { - // Internal passport - InternalPassport IdentityDocument -} - -// PassportElementInternalPassportTypeID is TL type id of PassportElementInternalPassport. -const PassportElementInternalPassportTypeID = 0x228ad87 - -// construct implements constructor of PassportElementClass. -func (p PassportElementInternalPassport) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementInternalPassport. -var ( - _ bin.Encoder = &PassportElementInternalPassport{} - _ bin.Decoder = &PassportElementInternalPassport{} - _ bin.BareEncoder = &PassportElementInternalPassport{} - _ bin.BareDecoder = &PassportElementInternalPassport{} - - _ PassportElementClass = &PassportElementInternalPassport{} -) - -func (p *PassportElementInternalPassport) Zero() bool { - if p == nil { - return true - } - if !(p.InternalPassport.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementInternalPassport) String() string { - if p == nil { - return "PassportElementInternalPassport(nil)" - } - type Alias PassportElementInternalPassport - return fmt.Sprintf("PassportElementInternalPassport%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementInternalPassport) TypeID() uint32 { - return PassportElementInternalPassportTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementInternalPassport) TypeName() string { - return "passportElementInternalPassport" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementInternalPassport) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementInternalPassport", - ID: PassportElementInternalPassportTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InternalPassport", - SchemaName: "internal_passport", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementInternalPassport) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementInternalPassport#228ad87 as nil") - } - b.PutID(PassportElementInternalPassportTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementInternalPassport) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementInternalPassport#228ad87 as nil") - } - if err := p.InternalPassport.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementInternalPassport#228ad87: field internal_passport: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementInternalPassport) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementInternalPassport#228ad87 to nil") - } - if err := b.ConsumeID(PassportElementInternalPassportTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementInternalPassport#228ad87: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementInternalPassport) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementInternalPassport#228ad87 to nil") - } - { - if err := p.InternalPassport.Decode(b); err != nil { - return fmt.Errorf("unable to decode passportElementInternalPassport#228ad87: field internal_passport: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementInternalPassport) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementInternalPassport#228ad87 as nil") - } - b.ObjStart() - b.PutID("passportElementInternalPassport") - b.Comma() - b.FieldStart("internal_passport") - if err := p.InternalPassport.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementInternalPassport#228ad87: field internal_passport: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementInternalPassport) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementInternalPassport#228ad87 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementInternalPassport"); err != nil { - return fmt.Errorf("unable to decode passportElementInternalPassport#228ad87: %w", err) - } - case "internal_passport": - if err := p.InternalPassport.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementInternalPassport#228ad87: field internal_passport: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInternalPassport returns value of InternalPassport field. -func (p *PassportElementInternalPassport) GetInternalPassport() (value IdentityDocument) { - if p == nil { - return - } - return p.InternalPassport -} - -// PassportElementAddress represents TL type `passportElementAddress#d15a1630`. -type PassportElementAddress struct { - // Address - Address Address -} - -// PassportElementAddressTypeID is TL type id of PassportElementAddress. -const PassportElementAddressTypeID = 0xd15a1630 - -// construct implements constructor of PassportElementClass. -func (p PassportElementAddress) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementAddress. -var ( - _ bin.Encoder = &PassportElementAddress{} - _ bin.Decoder = &PassportElementAddress{} - _ bin.BareEncoder = &PassportElementAddress{} - _ bin.BareDecoder = &PassportElementAddress{} - - _ PassportElementClass = &PassportElementAddress{} -) - -func (p *PassportElementAddress) Zero() bool { - if p == nil { - return true - } - if !(p.Address.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementAddress) String() string { - if p == nil { - return "PassportElementAddress(nil)" - } - type Alias PassportElementAddress - return fmt.Sprintf("PassportElementAddress%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementAddress) TypeID() uint32 { - return PassportElementAddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementAddress) TypeName() string { - return "passportElementAddress" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementAddress) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementAddress", - ID: PassportElementAddressTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Address", - SchemaName: "address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementAddress) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementAddress#d15a1630 as nil") - } - b.PutID(PassportElementAddressTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementAddress) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementAddress#d15a1630 as nil") - } - if err := p.Address.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementAddress#d15a1630: field address: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementAddress) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementAddress#d15a1630 to nil") - } - if err := b.ConsumeID(PassportElementAddressTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementAddress#d15a1630: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementAddress) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementAddress#d15a1630 to nil") - } - { - if err := p.Address.Decode(b); err != nil { - return fmt.Errorf("unable to decode passportElementAddress#d15a1630: field address: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementAddress) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementAddress#d15a1630 as nil") - } - b.ObjStart() - b.PutID("passportElementAddress") - b.Comma() - b.FieldStart("address") - if err := p.Address.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementAddress#d15a1630: field address: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementAddress) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementAddress#d15a1630 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementAddress"); err != nil { - return fmt.Errorf("unable to decode passportElementAddress#d15a1630: %w", err) - } - case "address": - if err := p.Address.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementAddress#d15a1630: field address: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAddress returns value of Address field. -func (p *PassportElementAddress) GetAddress() (value Address) { - if p == nil { - return - } - return p.Address -} - -// PassportElementUtilityBill represents TL type `passportElementUtilityBill#f2041dd2`. -type PassportElementUtilityBill struct { - // Utility bill - UtilityBill PersonalDocument -} - -// PassportElementUtilityBillTypeID is TL type id of PassportElementUtilityBill. -const PassportElementUtilityBillTypeID = 0xf2041dd2 - -// construct implements constructor of PassportElementClass. -func (p PassportElementUtilityBill) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementUtilityBill. -var ( - _ bin.Encoder = &PassportElementUtilityBill{} - _ bin.Decoder = &PassportElementUtilityBill{} - _ bin.BareEncoder = &PassportElementUtilityBill{} - _ bin.BareDecoder = &PassportElementUtilityBill{} - - _ PassportElementClass = &PassportElementUtilityBill{} -) - -func (p *PassportElementUtilityBill) Zero() bool { - if p == nil { - return true - } - if !(p.UtilityBill.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementUtilityBill) String() string { - if p == nil { - return "PassportElementUtilityBill(nil)" - } - type Alias PassportElementUtilityBill - return fmt.Sprintf("PassportElementUtilityBill%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementUtilityBill) TypeID() uint32 { - return PassportElementUtilityBillTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementUtilityBill) TypeName() string { - return "passportElementUtilityBill" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementUtilityBill) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementUtilityBill", - ID: PassportElementUtilityBillTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UtilityBill", - SchemaName: "utility_bill", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementUtilityBill) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementUtilityBill#f2041dd2 as nil") - } - b.PutID(PassportElementUtilityBillTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementUtilityBill) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementUtilityBill#f2041dd2 as nil") - } - if err := p.UtilityBill.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementUtilityBill#f2041dd2: field utility_bill: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementUtilityBill) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementUtilityBill#f2041dd2 to nil") - } - if err := b.ConsumeID(PassportElementUtilityBillTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementUtilityBill#f2041dd2: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementUtilityBill) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementUtilityBill#f2041dd2 to nil") - } - { - if err := p.UtilityBill.Decode(b); err != nil { - return fmt.Errorf("unable to decode passportElementUtilityBill#f2041dd2: field utility_bill: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementUtilityBill) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementUtilityBill#f2041dd2 as nil") - } - b.ObjStart() - b.PutID("passportElementUtilityBill") - b.Comma() - b.FieldStart("utility_bill") - if err := p.UtilityBill.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementUtilityBill#f2041dd2: field utility_bill: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementUtilityBill) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementUtilityBill#f2041dd2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementUtilityBill"); err != nil { - return fmt.Errorf("unable to decode passportElementUtilityBill#f2041dd2: %w", err) - } - case "utility_bill": - if err := p.UtilityBill.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementUtilityBill#f2041dd2: field utility_bill: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUtilityBill returns value of UtilityBill field. -func (p *PassportElementUtilityBill) GetUtilityBill() (value PersonalDocument) { - if p == nil { - return - } - return p.UtilityBill -} - -// PassportElementBankStatement represents TL type `passportElementBankStatement#ea283268`. -type PassportElementBankStatement struct { - // Bank statement - BankStatement PersonalDocument -} - -// PassportElementBankStatementTypeID is TL type id of PassportElementBankStatement. -const PassportElementBankStatementTypeID = 0xea283268 - -// construct implements constructor of PassportElementClass. -func (p PassportElementBankStatement) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementBankStatement. -var ( - _ bin.Encoder = &PassportElementBankStatement{} - _ bin.Decoder = &PassportElementBankStatement{} - _ bin.BareEncoder = &PassportElementBankStatement{} - _ bin.BareDecoder = &PassportElementBankStatement{} - - _ PassportElementClass = &PassportElementBankStatement{} -) - -func (p *PassportElementBankStatement) Zero() bool { - if p == nil { - return true - } - if !(p.BankStatement.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementBankStatement) String() string { - if p == nil { - return "PassportElementBankStatement(nil)" - } - type Alias PassportElementBankStatement - return fmt.Sprintf("PassportElementBankStatement%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementBankStatement) TypeID() uint32 { - return PassportElementBankStatementTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementBankStatement) TypeName() string { - return "passportElementBankStatement" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementBankStatement) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementBankStatement", - ID: PassportElementBankStatementTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BankStatement", - SchemaName: "bank_statement", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementBankStatement) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementBankStatement#ea283268 as nil") - } - b.PutID(PassportElementBankStatementTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementBankStatement) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementBankStatement#ea283268 as nil") - } - if err := p.BankStatement.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementBankStatement#ea283268: field bank_statement: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementBankStatement) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementBankStatement#ea283268 to nil") - } - if err := b.ConsumeID(PassportElementBankStatementTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementBankStatement#ea283268: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementBankStatement) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementBankStatement#ea283268 to nil") - } - { - if err := p.BankStatement.Decode(b); err != nil { - return fmt.Errorf("unable to decode passportElementBankStatement#ea283268: field bank_statement: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementBankStatement) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementBankStatement#ea283268 as nil") - } - b.ObjStart() - b.PutID("passportElementBankStatement") - b.Comma() - b.FieldStart("bank_statement") - if err := p.BankStatement.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementBankStatement#ea283268: field bank_statement: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementBankStatement) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementBankStatement#ea283268 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementBankStatement"); err != nil { - return fmt.Errorf("unable to decode passportElementBankStatement#ea283268: %w", err) - } - case "bank_statement": - if err := p.BankStatement.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementBankStatement#ea283268: field bank_statement: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBankStatement returns value of BankStatement field. -func (p *PassportElementBankStatement) GetBankStatement() (value PersonalDocument) { - if p == nil { - return - } - return p.BankStatement -} - -// PassportElementRentalAgreement represents TL type `passportElementRentalAgreement#eeb4cb28`. -type PassportElementRentalAgreement struct { - // Rental agreement - RentalAgreement PersonalDocument -} - -// PassportElementRentalAgreementTypeID is TL type id of PassportElementRentalAgreement. -const PassportElementRentalAgreementTypeID = 0xeeb4cb28 - -// construct implements constructor of PassportElementClass. -func (p PassportElementRentalAgreement) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementRentalAgreement. -var ( - _ bin.Encoder = &PassportElementRentalAgreement{} - _ bin.Decoder = &PassportElementRentalAgreement{} - _ bin.BareEncoder = &PassportElementRentalAgreement{} - _ bin.BareDecoder = &PassportElementRentalAgreement{} - - _ PassportElementClass = &PassportElementRentalAgreement{} -) - -func (p *PassportElementRentalAgreement) Zero() bool { - if p == nil { - return true - } - if !(p.RentalAgreement.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementRentalAgreement) String() string { - if p == nil { - return "PassportElementRentalAgreement(nil)" - } - type Alias PassportElementRentalAgreement - return fmt.Sprintf("PassportElementRentalAgreement%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementRentalAgreement) TypeID() uint32 { - return PassportElementRentalAgreementTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementRentalAgreement) TypeName() string { - return "passportElementRentalAgreement" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementRentalAgreement) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementRentalAgreement", - ID: PassportElementRentalAgreementTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RentalAgreement", - SchemaName: "rental_agreement", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementRentalAgreement) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementRentalAgreement#eeb4cb28 as nil") - } - b.PutID(PassportElementRentalAgreementTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementRentalAgreement) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementRentalAgreement#eeb4cb28 as nil") - } - if err := p.RentalAgreement.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementRentalAgreement#eeb4cb28: field rental_agreement: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementRentalAgreement) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementRentalAgreement#eeb4cb28 to nil") - } - if err := b.ConsumeID(PassportElementRentalAgreementTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementRentalAgreement#eeb4cb28: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementRentalAgreement) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementRentalAgreement#eeb4cb28 to nil") - } - { - if err := p.RentalAgreement.Decode(b); err != nil { - return fmt.Errorf("unable to decode passportElementRentalAgreement#eeb4cb28: field rental_agreement: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementRentalAgreement) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementRentalAgreement#eeb4cb28 as nil") - } - b.ObjStart() - b.PutID("passportElementRentalAgreement") - b.Comma() - b.FieldStart("rental_agreement") - if err := p.RentalAgreement.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementRentalAgreement#eeb4cb28: field rental_agreement: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementRentalAgreement) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementRentalAgreement#eeb4cb28 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementRentalAgreement"); err != nil { - return fmt.Errorf("unable to decode passportElementRentalAgreement#eeb4cb28: %w", err) - } - case "rental_agreement": - if err := p.RentalAgreement.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementRentalAgreement#eeb4cb28: field rental_agreement: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetRentalAgreement returns value of RentalAgreement field. -func (p *PassportElementRentalAgreement) GetRentalAgreement() (value PersonalDocument) { - if p == nil { - return - } - return p.RentalAgreement -} - -// PassportElementPassportRegistration represents TL type `passportElementPassportRegistration#24dadc7f`. -type PassportElementPassportRegistration struct { - // Passport registration pages - PassportRegistration PersonalDocument -} - -// PassportElementPassportRegistrationTypeID is TL type id of PassportElementPassportRegistration. -const PassportElementPassportRegistrationTypeID = 0x24dadc7f - -// construct implements constructor of PassportElementClass. -func (p PassportElementPassportRegistration) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementPassportRegistration. -var ( - _ bin.Encoder = &PassportElementPassportRegistration{} - _ bin.Decoder = &PassportElementPassportRegistration{} - _ bin.BareEncoder = &PassportElementPassportRegistration{} - _ bin.BareDecoder = &PassportElementPassportRegistration{} - - _ PassportElementClass = &PassportElementPassportRegistration{} -) - -func (p *PassportElementPassportRegistration) Zero() bool { - if p == nil { - return true - } - if !(p.PassportRegistration.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementPassportRegistration) String() string { - if p == nil { - return "PassportElementPassportRegistration(nil)" - } - type Alias PassportElementPassportRegistration - return fmt.Sprintf("PassportElementPassportRegistration%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementPassportRegistration) TypeID() uint32 { - return PassportElementPassportRegistrationTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementPassportRegistration) TypeName() string { - return "passportElementPassportRegistration" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementPassportRegistration) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementPassportRegistration", - ID: PassportElementPassportRegistrationTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PassportRegistration", - SchemaName: "passport_registration", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementPassportRegistration) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPassportRegistration#24dadc7f as nil") - } - b.PutID(PassportElementPassportRegistrationTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementPassportRegistration) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPassportRegistration#24dadc7f as nil") - } - if err := p.PassportRegistration.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementPassportRegistration#24dadc7f: field passport_registration: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementPassportRegistration) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPassportRegistration#24dadc7f to nil") - } - if err := b.ConsumeID(PassportElementPassportRegistrationTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementPassportRegistration#24dadc7f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementPassportRegistration) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPassportRegistration#24dadc7f to nil") - } - { - if err := p.PassportRegistration.Decode(b); err != nil { - return fmt.Errorf("unable to decode passportElementPassportRegistration#24dadc7f: field passport_registration: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementPassportRegistration) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPassportRegistration#24dadc7f as nil") - } - b.ObjStart() - b.PutID("passportElementPassportRegistration") - b.Comma() - b.FieldStart("passport_registration") - if err := p.PassportRegistration.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementPassportRegistration#24dadc7f: field passport_registration: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementPassportRegistration) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPassportRegistration#24dadc7f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementPassportRegistration"); err != nil { - return fmt.Errorf("unable to decode passportElementPassportRegistration#24dadc7f: %w", err) - } - case "passport_registration": - if err := p.PassportRegistration.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementPassportRegistration#24dadc7f: field passport_registration: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPassportRegistration returns value of PassportRegistration field. -func (p *PassportElementPassportRegistration) GetPassportRegistration() (value PersonalDocument) { - if p == nil { - return - } - return p.PassportRegistration -} - -// PassportElementTemporaryRegistration represents TL type `passportElementTemporaryRegistration#49c4aff0`. -type PassportElementTemporaryRegistration struct { - // Temporary registration - TemporaryRegistration PersonalDocument -} - -// PassportElementTemporaryRegistrationTypeID is TL type id of PassportElementTemporaryRegistration. -const PassportElementTemporaryRegistrationTypeID = 0x49c4aff0 - -// construct implements constructor of PassportElementClass. -func (p PassportElementTemporaryRegistration) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTemporaryRegistration. -var ( - _ bin.Encoder = &PassportElementTemporaryRegistration{} - _ bin.Decoder = &PassportElementTemporaryRegistration{} - _ bin.BareEncoder = &PassportElementTemporaryRegistration{} - _ bin.BareDecoder = &PassportElementTemporaryRegistration{} - - _ PassportElementClass = &PassportElementTemporaryRegistration{} -) - -func (p *PassportElementTemporaryRegistration) Zero() bool { - if p == nil { - return true - } - if !(p.TemporaryRegistration.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTemporaryRegistration) String() string { - if p == nil { - return "PassportElementTemporaryRegistration(nil)" - } - type Alias PassportElementTemporaryRegistration - return fmt.Sprintf("PassportElementTemporaryRegistration%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTemporaryRegistration) TypeID() uint32 { - return PassportElementTemporaryRegistrationTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTemporaryRegistration) TypeName() string { - return "passportElementTemporaryRegistration" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTemporaryRegistration) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTemporaryRegistration", - ID: PassportElementTemporaryRegistrationTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TemporaryRegistration", - SchemaName: "temporary_registration", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTemporaryRegistration) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTemporaryRegistration#49c4aff0 as nil") - } - b.PutID(PassportElementTemporaryRegistrationTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTemporaryRegistration) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTemporaryRegistration#49c4aff0 as nil") - } - if err := p.TemporaryRegistration.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportElementTemporaryRegistration#49c4aff0: field temporary_registration: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTemporaryRegistration) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTemporaryRegistration#49c4aff0 to nil") - } - if err := b.ConsumeID(PassportElementTemporaryRegistrationTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTemporaryRegistration#49c4aff0: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTemporaryRegistration) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTemporaryRegistration#49c4aff0 to nil") - } - { - if err := p.TemporaryRegistration.Decode(b); err != nil { - return fmt.Errorf("unable to decode passportElementTemporaryRegistration#49c4aff0: field temporary_registration: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTemporaryRegistration) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTemporaryRegistration#49c4aff0 as nil") - } - b.ObjStart() - b.PutID("passportElementTemporaryRegistration") - b.Comma() - b.FieldStart("temporary_registration") - if err := p.TemporaryRegistration.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementTemporaryRegistration#49c4aff0: field temporary_registration: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTemporaryRegistration) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTemporaryRegistration#49c4aff0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTemporaryRegistration"); err != nil { - return fmt.Errorf("unable to decode passportElementTemporaryRegistration#49c4aff0: %w", err) - } - case "temporary_registration": - if err := p.TemporaryRegistration.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementTemporaryRegistration#49c4aff0: field temporary_registration: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTemporaryRegistration returns value of TemporaryRegistration field. -func (p *PassportElementTemporaryRegistration) GetTemporaryRegistration() (value PersonalDocument) { - if p == nil { - return - } - return p.TemporaryRegistration -} - -// PassportElementPhoneNumber represents TL type `passportElementPhoneNumber#b1509799`. -type PassportElementPhoneNumber struct { - // Phone number - PhoneNumber string -} - -// PassportElementPhoneNumberTypeID is TL type id of PassportElementPhoneNumber. -const PassportElementPhoneNumberTypeID = 0xb1509799 - -// construct implements constructor of PassportElementClass. -func (p PassportElementPhoneNumber) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementPhoneNumber. -var ( - _ bin.Encoder = &PassportElementPhoneNumber{} - _ bin.Decoder = &PassportElementPhoneNumber{} - _ bin.BareEncoder = &PassportElementPhoneNumber{} - _ bin.BareDecoder = &PassportElementPhoneNumber{} - - _ PassportElementClass = &PassportElementPhoneNumber{} -) - -func (p *PassportElementPhoneNumber) Zero() bool { - if p == nil { - return true - } - if !(p.PhoneNumber == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementPhoneNumber) String() string { - if p == nil { - return "PassportElementPhoneNumber(nil)" - } - type Alias PassportElementPhoneNumber - return fmt.Sprintf("PassportElementPhoneNumber%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementPhoneNumber) TypeID() uint32 { - return PassportElementPhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementPhoneNumber) TypeName() string { - return "passportElementPhoneNumber" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementPhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementPhoneNumber", - ID: PassportElementPhoneNumberTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementPhoneNumber) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPhoneNumber#b1509799 as nil") - } - b.PutID(PassportElementPhoneNumberTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementPhoneNumber) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPhoneNumber#b1509799 as nil") - } - b.PutString(p.PhoneNumber) - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementPhoneNumber) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPhoneNumber#b1509799 to nil") - } - if err := b.ConsumeID(PassportElementPhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementPhoneNumber#b1509799: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementPhoneNumber) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPhoneNumber#b1509799 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passportElementPhoneNumber#b1509799: field phone_number: %w", err) - } - p.PhoneNumber = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementPhoneNumber#b1509799 as nil") - } - b.ObjStart() - b.PutID("passportElementPhoneNumber") - b.Comma() - b.FieldStart("phone_number") - b.PutString(p.PhoneNumber) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementPhoneNumber#b1509799 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode passportElementPhoneNumber#b1509799: %w", err) - } - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passportElementPhoneNumber#b1509799: field phone_number: %w", err) - } - p.PhoneNumber = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (p *PassportElementPhoneNumber) GetPhoneNumber() (value string) { - if p == nil { - return - } - return p.PhoneNumber -} - -// PassportElementEmailAddress represents TL type `passportElementEmailAddress#a4ea9805`. -type PassportElementEmailAddress struct { - // Email address - EmailAddress string -} - -// PassportElementEmailAddressTypeID is TL type id of PassportElementEmailAddress. -const PassportElementEmailAddressTypeID = 0xa4ea9805 - -// construct implements constructor of PassportElementClass. -func (p PassportElementEmailAddress) construct() PassportElementClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementEmailAddress. -var ( - _ bin.Encoder = &PassportElementEmailAddress{} - _ bin.Decoder = &PassportElementEmailAddress{} - _ bin.BareEncoder = &PassportElementEmailAddress{} - _ bin.BareDecoder = &PassportElementEmailAddress{} - - _ PassportElementClass = &PassportElementEmailAddress{} -) - -func (p *PassportElementEmailAddress) Zero() bool { - if p == nil { - return true - } - if !(p.EmailAddress == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementEmailAddress) String() string { - if p == nil { - return "PassportElementEmailAddress(nil)" - } - type Alias PassportElementEmailAddress - return fmt.Sprintf("PassportElementEmailAddress%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementEmailAddress) TypeID() uint32 { - return PassportElementEmailAddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementEmailAddress) TypeName() string { - return "passportElementEmailAddress" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementEmailAddress) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementEmailAddress", - ID: PassportElementEmailAddressTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "EmailAddress", - SchemaName: "email_address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementEmailAddress) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementEmailAddress#a4ea9805 as nil") - } - b.PutID(PassportElementEmailAddressTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementEmailAddress) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementEmailAddress#a4ea9805 as nil") - } - b.PutString(p.EmailAddress) - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementEmailAddress) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementEmailAddress#a4ea9805 to nil") - } - if err := b.ConsumeID(PassportElementEmailAddressTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementEmailAddress#a4ea9805: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementEmailAddress) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementEmailAddress#a4ea9805 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passportElementEmailAddress#a4ea9805: field email_address: %w", err) - } - p.EmailAddress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementEmailAddress) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementEmailAddress#a4ea9805 as nil") - } - b.ObjStart() - b.PutID("passportElementEmailAddress") - b.Comma() - b.FieldStart("email_address") - b.PutString(p.EmailAddress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementEmailAddress) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementEmailAddress#a4ea9805 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementEmailAddress"); err != nil { - return fmt.Errorf("unable to decode passportElementEmailAddress#a4ea9805: %w", err) - } - case "email_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passportElementEmailAddress#a4ea9805: field email_address: %w", err) - } - p.EmailAddress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEmailAddress returns value of EmailAddress field. -func (p *PassportElementEmailAddress) GetEmailAddress() (value string) { - if p == nil { - return - } - return p.EmailAddress -} - -// PassportElementClassName is schema name of PassportElementClass. -const PassportElementClassName = "PassportElement" - -// PassportElementClass represents PassportElement generic type. -// -// Example: -// -// g, err := tdapi.DecodePassportElement(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PassportElementPersonalDetails: // passportElementPersonalDetails#4894fe83 -// case *tdapi.PassportElementPassport: // passportElementPassport#f043e723 -// case *tdapi.PassportElementDriverLicense: // passportElementDriverLicense#61f70cad -// case *tdapi.PassportElementIdentityCard: // passportElementIdentityCard#7c33e535 -// case *tdapi.PassportElementInternalPassport: // passportElementInternalPassport#228ad87 -// case *tdapi.PassportElementAddress: // passportElementAddress#d15a1630 -// case *tdapi.PassportElementUtilityBill: // passportElementUtilityBill#f2041dd2 -// case *tdapi.PassportElementBankStatement: // passportElementBankStatement#ea283268 -// case *tdapi.PassportElementRentalAgreement: // passportElementRentalAgreement#eeb4cb28 -// case *tdapi.PassportElementPassportRegistration: // passportElementPassportRegistration#24dadc7f -// case *tdapi.PassportElementTemporaryRegistration: // passportElementTemporaryRegistration#49c4aff0 -// case *tdapi.PassportElementPhoneNumber: // passportElementPhoneNumber#b1509799 -// case *tdapi.PassportElementEmailAddress: // passportElementEmailAddress#a4ea9805 -// default: panic(v) -// } -type PassportElementClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PassportElementClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePassportElement implements binary de-serialization for PassportElementClass. -func DecodePassportElement(buf *bin.Buffer) (PassportElementClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PassportElementPersonalDetailsTypeID: - // Decoding passportElementPersonalDetails#4894fe83. - v := PassportElementPersonalDetails{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementPassportTypeID: - // Decoding passportElementPassport#f043e723. - v := PassportElementPassport{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementDriverLicenseTypeID: - // Decoding passportElementDriverLicense#61f70cad. - v := PassportElementDriverLicense{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementIdentityCardTypeID: - // Decoding passportElementIdentityCard#7c33e535. - v := PassportElementIdentityCard{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementInternalPassportTypeID: - // Decoding passportElementInternalPassport#228ad87. - v := PassportElementInternalPassport{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementAddressTypeID: - // Decoding passportElementAddress#d15a1630. - v := PassportElementAddress{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementUtilityBillTypeID: - // Decoding passportElementUtilityBill#f2041dd2. - v := PassportElementUtilityBill{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementBankStatementTypeID: - // Decoding passportElementBankStatement#ea283268. - v := PassportElementBankStatement{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementRentalAgreementTypeID: - // Decoding passportElementRentalAgreement#eeb4cb28. - v := PassportElementRentalAgreement{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementPassportRegistrationTypeID: - // Decoding passportElementPassportRegistration#24dadc7f. - v := PassportElementPassportRegistration{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementTemporaryRegistrationTypeID: - // Decoding passportElementTemporaryRegistration#49c4aff0. - v := PassportElementTemporaryRegistration{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementPhoneNumberTypeID: - // Decoding passportElementPhoneNumber#b1509799. - v := PassportElementPhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case PassportElementEmailAddressTypeID: - // Decoding passportElementEmailAddress#a4ea9805. - v := PassportElementEmailAddress{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPassportElement implements binary de-serialization for PassportElementClass. -func DecodeTDLibJSONPassportElement(buf tdjson.Decoder) (PassportElementClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "passportElementPersonalDetails": - // Decoding passportElementPersonalDetails#4894fe83. - v := PassportElementPersonalDetails{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementPassport": - // Decoding passportElementPassport#f043e723. - v := PassportElementPassport{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementDriverLicense": - // Decoding passportElementDriverLicense#61f70cad. - v := PassportElementDriverLicense{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementIdentityCard": - // Decoding passportElementIdentityCard#7c33e535. - v := PassportElementIdentityCard{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementInternalPassport": - // Decoding passportElementInternalPassport#228ad87. - v := PassportElementInternalPassport{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementAddress": - // Decoding passportElementAddress#d15a1630. - v := PassportElementAddress{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementUtilityBill": - // Decoding passportElementUtilityBill#f2041dd2. - v := PassportElementUtilityBill{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementBankStatement": - // Decoding passportElementBankStatement#ea283268. - v := PassportElementBankStatement{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementRentalAgreement": - // Decoding passportElementRentalAgreement#eeb4cb28. - v := PassportElementRentalAgreement{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementPassportRegistration": - // Decoding passportElementPassportRegistration#24dadc7f. - v := PassportElementPassportRegistration{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementTemporaryRegistration": - // Decoding passportElementTemporaryRegistration#49c4aff0. - v := PassportElementTemporaryRegistration{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementPhoneNumber": - // Decoding passportElementPhoneNumber#b1509799. - v := PassportElementPhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - case "passportElementEmailAddress": - // Decoding passportElementEmailAddress#a4ea9805. - v := PassportElementEmailAddress{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PassportElementClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PassportElement boxes the PassportElementClass providing a helper. -type PassportElementBox struct { - PassportElement PassportElementClass -} - -// Decode implements bin.Decoder for PassportElementBox. -func (b *PassportElementBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PassportElementBox to nil") - } - v, err := DecodePassportElement(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PassportElement = v - return nil -} - -// Encode implements bin.Encode for PassportElementBox. -func (b *PassportElementBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PassportElement == nil { - return fmt.Errorf("unable to encode PassportElementClass as nil") - } - return b.PassportElement.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PassportElementBox. -func (b *PassportElementBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PassportElementBox to nil") - } - v, err := DecodeTDLibJSONPassportElement(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PassportElement = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PassportElementBox. -func (b *PassportElementBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PassportElement == nil { - return fmt.Errorf("unable to encode PassportElementClass as nil") - } - return b.PassportElement.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_passport_element_type_gen.go b/tdapi/tl_passport_element_type_gen.go deleted file mode 100644 index 96fda00c2..000000000 --- a/tdapi/tl_passport_element_type_gen.go +++ /dev/null @@ -1,2037 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PassportElementTypePersonalDetails represents TL type `passportElementTypePersonalDetails#c27ad953`. -type PassportElementTypePersonalDetails struct { -} - -// PassportElementTypePersonalDetailsTypeID is TL type id of PassportElementTypePersonalDetails. -const PassportElementTypePersonalDetailsTypeID = 0xc27ad953 - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypePersonalDetails) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypePersonalDetails. -var ( - _ bin.Encoder = &PassportElementTypePersonalDetails{} - _ bin.Decoder = &PassportElementTypePersonalDetails{} - _ bin.BareEncoder = &PassportElementTypePersonalDetails{} - _ bin.BareDecoder = &PassportElementTypePersonalDetails{} - - _ PassportElementTypeClass = &PassportElementTypePersonalDetails{} -) - -func (p *PassportElementTypePersonalDetails) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypePersonalDetails) String() string { - if p == nil { - return "PassportElementTypePersonalDetails(nil)" - } - type Alias PassportElementTypePersonalDetails - return fmt.Sprintf("PassportElementTypePersonalDetails%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypePersonalDetails) TypeID() uint32 { - return PassportElementTypePersonalDetailsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypePersonalDetails) TypeName() string { - return "passportElementTypePersonalDetails" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypePersonalDetails) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypePersonalDetails", - ID: PassportElementTypePersonalDetailsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypePersonalDetails) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePersonalDetails#c27ad953 as nil") - } - b.PutID(PassportElementTypePersonalDetailsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypePersonalDetails) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePersonalDetails#c27ad953 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypePersonalDetails) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePersonalDetails#c27ad953 to nil") - } - if err := b.ConsumeID(PassportElementTypePersonalDetailsTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypePersonalDetails#c27ad953: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypePersonalDetails) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePersonalDetails#c27ad953 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypePersonalDetails) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePersonalDetails#c27ad953 as nil") - } - b.ObjStart() - b.PutID("passportElementTypePersonalDetails") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypePersonalDetails) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePersonalDetails#c27ad953 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypePersonalDetails"); err != nil { - return fmt.Errorf("unable to decode passportElementTypePersonalDetails#c27ad953: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypePassport represents TL type `passportElementTypePassport#e5fdab48`. -type PassportElementTypePassport struct { -} - -// PassportElementTypePassportTypeID is TL type id of PassportElementTypePassport. -const PassportElementTypePassportTypeID = 0xe5fdab48 - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypePassport) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypePassport. -var ( - _ bin.Encoder = &PassportElementTypePassport{} - _ bin.Decoder = &PassportElementTypePassport{} - _ bin.BareEncoder = &PassportElementTypePassport{} - _ bin.BareDecoder = &PassportElementTypePassport{} - - _ PassportElementTypeClass = &PassportElementTypePassport{} -) - -func (p *PassportElementTypePassport) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypePassport) String() string { - if p == nil { - return "PassportElementTypePassport(nil)" - } - type Alias PassportElementTypePassport - return fmt.Sprintf("PassportElementTypePassport%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypePassport) TypeID() uint32 { - return PassportElementTypePassportTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypePassport) TypeName() string { - return "passportElementTypePassport" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypePassport) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypePassport", - ID: PassportElementTypePassportTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypePassport) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePassport#e5fdab48 as nil") - } - b.PutID(PassportElementTypePassportTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypePassport) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePassport#e5fdab48 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypePassport) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePassport#e5fdab48 to nil") - } - if err := b.ConsumeID(PassportElementTypePassportTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypePassport#e5fdab48: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypePassport) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePassport#e5fdab48 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypePassport) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePassport#e5fdab48 as nil") - } - b.ObjStart() - b.PutID("passportElementTypePassport") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypePassport) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePassport#e5fdab48 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypePassport"); err != nil { - return fmt.Errorf("unable to decode passportElementTypePassport#e5fdab48: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypeDriverLicense represents TL type `passportElementTypeDriverLicense#6cea5c4b`. -type PassportElementTypeDriverLicense struct { -} - -// PassportElementTypeDriverLicenseTypeID is TL type id of PassportElementTypeDriverLicense. -const PassportElementTypeDriverLicenseTypeID = 0x6cea5c4b - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypeDriverLicense) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypeDriverLicense. -var ( - _ bin.Encoder = &PassportElementTypeDriverLicense{} - _ bin.Decoder = &PassportElementTypeDriverLicense{} - _ bin.BareEncoder = &PassportElementTypeDriverLicense{} - _ bin.BareDecoder = &PassportElementTypeDriverLicense{} - - _ PassportElementTypeClass = &PassportElementTypeDriverLicense{} -) - -func (p *PassportElementTypeDriverLicense) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypeDriverLicense) String() string { - if p == nil { - return "PassportElementTypeDriverLicense(nil)" - } - type Alias PassportElementTypeDriverLicense - return fmt.Sprintf("PassportElementTypeDriverLicense%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypeDriverLicense) TypeID() uint32 { - return PassportElementTypeDriverLicenseTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypeDriverLicense) TypeName() string { - return "passportElementTypeDriverLicense" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypeDriverLicense) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypeDriverLicense", - ID: PassportElementTypeDriverLicenseTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypeDriverLicense) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeDriverLicense#6cea5c4b as nil") - } - b.PutID(PassportElementTypeDriverLicenseTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypeDriverLicense) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeDriverLicense#6cea5c4b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypeDriverLicense) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeDriverLicense#6cea5c4b to nil") - } - if err := b.ConsumeID(PassportElementTypeDriverLicenseTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypeDriverLicense#6cea5c4b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypeDriverLicense) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeDriverLicense#6cea5c4b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypeDriverLicense) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeDriverLicense#6cea5c4b as nil") - } - b.ObjStart() - b.PutID("passportElementTypeDriverLicense") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypeDriverLicense) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeDriverLicense#6cea5c4b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypeDriverLicense"); err != nil { - return fmt.Errorf("unable to decode passportElementTypeDriverLicense#6cea5c4b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypeIdentityCard represents TL type `passportElementTypeIdentityCard#e20ea75c`. -type PassportElementTypeIdentityCard struct { -} - -// PassportElementTypeIdentityCardTypeID is TL type id of PassportElementTypeIdentityCard. -const PassportElementTypeIdentityCardTypeID = 0xe20ea75c - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypeIdentityCard) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypeIdentityCard. -var ( - _ bin.Encoder = &PassportElementTypeIdentityCard{} - _ bin.Decoder = &PassportElementTypeIdentityCard{} - _ bin.BareEncoder = &PassportElementTypeIdentityCard{} - _ bin.BareDecoder = &PassportElementTypeIdentityCard{} - - _ PassportElementTypeClass = &PassportElementTypeIdentityCard{} -) - -func (p *PassportElementTypeIdentityCard) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypeIdentityCard) String() string { - if p == nil { - return "PassportElementTypeIdentityCard(nil)" - } - type Alias PassportElementTypeIdentityCard - return fmt.Sprintf("PassportElementTypeIdentityCard%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypeIdentityCard) TypeID() uint32 { - return PassportElementTypeIdentityCardTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypeIdentityCard) TypeName() string { - return "passportElementTypeIdentityCard" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypeIdentityCard) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypeIdentityCard", - ID: PassportElementTypeIdentityCardTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypeIdentityCard) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeIdentityCard#e20ea75c as nil") - } - b.PutID(PassportElementTypeIdentityCardTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypeIdentityCard) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeIdentityCard#e20ea75c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypeIdentityCard) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeIdentityCard#e20ea75c to nil") - } - if err := b.ConsumeID(PassportElementTypeIdentityCardTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypeIdentityCard#e20ea75c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypeIdentityCard) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeIdentityCard#e20ea75c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypeIdentityCard) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeIdentityCard#e20ea75c as nil") - } - b.ObjStart() - b.PutID("passportElementTypeIdentityCard") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypeIdentityCard) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeIdentityCard#e20ea75c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypeIdentityCard"); err != nil { - return fmt.Errorf("unable to decode passportElementTypeIdentityCard#e20ea75c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypeInternalPassport represents TL type `passportElementTypeInternalPassport#d0afd939`. -type PassportElementTypeInternalPassport struct { -} - -// PassportElementTypeInternalPassportTypeID is TL type id of PassportElementTypeInternalPassport. -const PassportElementTypeInternalPassportTypeID = 0xd0afd939 - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypeInternalPassport) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypeInternalPassport. -var ( - _ bin.Encoder = &PassportElementTypeInternalPassport{} - _ bin.Decoder = &PassportElementTypeInternalPassport{} - _ bin.BareEncoder = &PassportElementTypeInternalPassport{} - _ bin.BareDecoder = &PassportElementTypeInternalPassport{} - - _ PassportElementTypeClass = &PassportElementTypeInternalPassport{} -) - -func (p *PassportElementTypeInternalPassport) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypeInternalPassport) String() string { - if p == nil { - return "PassportElementTypeInternalPassport(nil)" - } - type Alias PassportElementTypeInternalPassport - return fmt.Sprintf("PassportElementTypeInternalPassport%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypeInternalPassport) TypeID() uint32 { - return PassportElementTypeInternalPassportTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypeInternalPassport) TypeName() string { - return "passportElementTypeInternalPassport" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypeInternalPassport) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypeInternalPassport", - ID: PassportElementTypeInternalPassportTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypeInternalPassport) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeInternalPassport#d0afd939 as nil") - } - b.PutID(PassportElementTypeInternalPassportTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypeInternalPassport) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeInternalPassport#d0afd939 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypeInternalPassport) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeInternalPassport#d0afd939 to nil") - } - if err := b.ConsumeID(PassportElementTypeInternalPassportTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypeInternalPassport#d0afd939: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypeInternalPassport) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeInternalPassport#d0afd939 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypeInternalPassport) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeInternalPassport#d0afd939 as nil") - } - b.ObjStart() - b.PutID("passportElementTypeInternalPassport") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypeInternalPassport) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeInternalPassport#d0afd939 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypeInternalPassport"); err != nil { - return fmt.Errorf("unable to decode passportElementTypeInternalPassport#d0afd939: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypeAddress represents TL type `passportElementTypeAddress#1d955cc2`. -type PassportElementTypeAddress struct { -} - -// PassportElementTypeAddressTypeID is TL type id of PassportElementTypeAddress. -const PassportElementTypeAddressTypeID = 0x1d955cc2 - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypeAddress) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypeAddress. -var ( - _ bin.Encoder = &PassportElementTypeAddress{} - _ bin.Decoder = &PassportElementTypeAddress{} - _ bin.BareEncoder = &PassportElementTypeAddress{} - _ bin.BareDecoder = &PassportElementTypeAddress{} - - _ PassportElementTypeClass = &PassportElementTypeAddress{} -) - -func (p *PassportElementTypeAddress) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypeAddress) String() string { - if p == nil { - return "PassportElementTypeAddress(nil)" - } - type Alias PassportElementTypeAddress - return fmt.Sprintf("PassportElementTypeAddress%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypeAddress) TypeID() uint32 { - return PassportElementTypeAddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypeAddress) TypeName() string { - return "passportElementTypeAddress" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypeAddress) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypeAddress", - ID: PassportElementTypeAddressTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypeAddress) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeAddress#1d955cc2 as nil") - } - b.PutID(PassportElementTypeAddressTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypeAddress) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeAddress#1d955cc2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypeAddress) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeAddress#1d955cc2 to nil") - } - if err := b.ConsumeID(PassportElementTypeAddressTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypeAddress#1d955cc2: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypeAddress) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeAddress#1d955cc2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypeAddress) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeAddress#1d955cc2 as nil") - } - b.ObjStart() - b.PutID("passportElementTypeAddress") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypeAddress) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeAddress#1d955cc2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypeAddress"); err != nil { - return fmt.Errorf("unable to decode passportElementTypeAddress#1d955cc2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypeUtilityBill represents TL type `passportElementTypeUtilityBill#25608e6a`. -type PassportElementTypeUtilityBill struct { -} - -// PassportElementTypeUtilityBillTypeID is TL type id of PassportElementTypeUtilityBill. -const PassportElementTypeUtilityBillTypeID = 0x25608e6a - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypeUtilityBill) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypeUtilityBill. -var ( - _ bin.Encoder = &PassportElementTypeUtilityBill{} - _ bin.Decoder = &PassportElementTypeUtilityBill{} - _ bin.BareEncoder = &PassportElementTypeUtilityBill{} - _ bin.BareDecoder = &PassportElementTypeUtilityBill{} - - _ PassportElementTypeClass = &PassportElementTypeUtilityBill{} -) - -func (p *PassportElementTypeUtilityBill) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypeUtilityBill) String() string { - if p == nil { - return "PassportElementTypeUtilityBill(nil)" - } - type Alias PassportElementTypeUtilityBill - return fmt.Sprintf("PassportElementTypeUtilityBill%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypeUtilityBill) TypeID() uint32 { - return PassportElementTypeUtilityBillTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypeUtilityBill) TypeName() string { - return "passportElementTypeUtilityBill" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypeUtilityBill) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypeUtilityBill", - ID: PassportElementTypeUtilityBillTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypeUtilityBill) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeUtilityBill#25608e6a as nil") - } - b.PutID(PassportElementTypeUtilityBillTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypeUtilityBill) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeUtilityBill#25608e6a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypeUtilityBill) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeUtilityBill#25608e6a to nil") - } - if err := b.ConsumeID(PassportElementTypeUtilityBillTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypeUtilityBill#25608e6a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypeUtilityBill) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeUtilityBill#25608e6a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypeUtilityBill) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeUtilityBill#25608e6a as nil") - } - b.ObjStart() - b.PutID("passportElementTypeUtilityBill") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypeUtilityBill) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeUtilityBill#25608e6a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypeUtilityBill"); err != nil { - return fmt.Errorf("unable to decode passportElementTypeUtilityBill#25608e6a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypeBankStatement represents TL type `passportElementTypeBankStatement#22380133`. -type PassportElementTypeBankStatement struct { -} - -// PassportElementTypeBankStatementTypeID is TL type id of PassportElementTypeBankStatement. -const PassportElementTypeBankStatementTypeID = 0x22380133 - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypeBankStatement) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypeBankStatement. -var ( - _ bin.Encoder = &PassportElementTypeBankStatement{} - _ bin.Decoder = &PassportElementTypeBankStatement{} - _ bin.BareEncoder = &PassportElementTypeBankStatement{} - _ bin.BareDecoder = &PassportElementTypeBankStatement{} - - _ PassportElementTypeClass = &PassportElementTypeBankStatement{} -) - -func (p *PassportElementTypeBankStatement) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypeBankStatement) String() string { - if p == nil { - return "PassportElementTypeBankStatement(nil)" - } - type Alias PassportElementTypeBankStatement - return fmt.Sprintf("PassportElementTypeBankStatement%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypeBankStatement) TypeID() uint32 { - return PassportElementTypeBankStatementTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypeBankStatement) TypeName() string { - return "passportElementTypeBankStatement" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypeBankStatement) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypeBankStatement", - ID: PassportElementTypeBankStatementTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypeBankStatement) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeBankStatement#22380133 as nil") - } - b.PutID(PassportElementTypeBankStatementTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypeBankStatement) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeBankStatement#22380133 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypeBankStatement) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeBankStatement#22380133 to nil") - } - if err := b.ConsumeID(PassportElementTypeBankStatementTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypeBankStatement#22380133: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypeBankStatement) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeBankStatement#22380133 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypeBankStatement) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeBankStatement#22380133 as nil") - } - b.ObjStart() - b.PutID("passportElementTypeBankStatement") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypeBankStatement) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeBankStatement#22380133 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypeBankStatement"); err != nil { - return fmt.Errorf("unable to decode passportElementTypeBankStatement#22380133: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypeRentalAgreement represents TL type `passportElementTypeRentalAgreement#852dfe90`. -type PassportElementTypeRentalAgreement struct { -} - -// PassportElementTypeRentalAgreementTypeID is TL type id of PassportElementTypeRentalAgreement. -const PassportElementTypeRentalAgreementTypeID = 0x852dfe90 - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypeRentalAgreement) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypeRentalAgreement. -var ( - _ bin.Encoder = &PassportElementTypeRentalAgreement{} - _ bin.Decoder = &PassportElementTypeRentalAgreement{} - _ bin.BareEncoder = &PassportElementTypeRentalAgreement{} - _ bin.BareDecoder = &PassportElementTypeRentalAgreement{} - - _ PassportElementTypeClass = &PassportElementTypeRentalAgreement{} -) - -func (p *PassportElementTypeRentalAgreement) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypeRentalAgreement) String() string { - if p == nil { - return "PassportElementTypeRentalAgreement(nil)" - } - type Alias PassportElementTypeRentalAgreement - return fmt.Sprintf("PassportElementTypeRentalAgreement%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypeRentalAgreement) TypeID() uint32 { - return PassportElementTypeRentalAgreementTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypeRentalAgreement) TypeName() string { - return "passportElementTypeRentalAgreement" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypeRentalAgreement) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypeRentalAgreement", - ID: PassportElementTypeRentalAgreementTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypeRentalAgreement) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeRentalAgreement#852dfe90 as nil") - } - b.PutID(PassportElementTypeRentalAgreementTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypeRentalAgreement) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeRentalAgreement#852dfe90 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypeRentalAgreement) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeRentalAgreement#852dfe90 to nil") - } - if err := b.ConsumeID(PassportElementTypeRentalAgreementTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypeRentalAgreement#852dfe90: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypeRentalAgreement) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeRentalAgreement#852dfe90 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypeRentalAgreement) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeRentalAgreement#852dfe90 as nil") - } - b.ObjStart() - b.PutID("passportElementTypeRentalAgreement") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypeRentalAgreement) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeRentalAgreement#852dfe90 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypeRentalAgreement"); err != nil { - return fmt.Errorf("unable to decode passportElementTypeRentalAgreement#852dfe90: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypePassportRegistration represents TL type `passportElementTypePassportRegistration#f67e8e3f`. -type PassportElementTypePassportRegistration struct { -} - -// PassportElementTypePassportRegistrationTypeID is TL type id of PassportElementTypePassportRegistration. -const PassportElementTypePassportRegistrationTypeID = 0xf67e8e3f - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypePassportRegistration) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypePassportRegistration. -var ( - _ bin.Encoder = &PassportElementTypePassportRegistration{} - _ bin.Decoder = &PassportElementTypePassportRegistration{} - _ bin.BareEncoder = &PassportElementTypePassportRegistration{} - _ bin.BareDecoder = &PassportElementTypePassportRegistration{} - - _ PassportElementTypeClass = &PassportElementTypePassportRegistration{} -) - -func (p *PassportElementTypePassportRegistration) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypePassportRegistration) String() string { - if p == nil { - return "PassportElementTypePassportRegistration(nil)" - } - type Alias PassportElementTypePassportRegistration - return fmt.Sprintf("PassportElementTypePassportRegistration%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypePassportRegistration) TypeID() uint32 { - return PassportElementTypePassportRegistrationTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypePassportRegistration) TypeName() string { - return "passportElementTypePassportRegistration" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypePassportRegistration) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypePassportRegistration", - ID: PassportElementTypePassportRegistrationTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypePassportRegistration) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePassportRegistration#f67e8e3f as nil") - } - b.PutID(PassportElementTypePassportRegistrationTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypePassportRegistration) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePassportRegistration#f67e8e3f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypePassportRegistration) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePassportRegistration#f67e8e3f to nil") - } - if err := b.ConsumeID(PassportElementTypePassportRegistrationTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypePassportRegistration#f67e8e3f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypePassportRegistration) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePassportRegistration#f67e8e3f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypePassportRegistration) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePassportRegistration#f67e8e3f as nil") - } - b.ObjStart() - b.PutID("passportElementTypePassportRegistration") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypePassportRegistration) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePassportRegistration#f67e8e3f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypePassportRegistration"); err != nil { - return fmt.Errorf("unable to decode passportElementTypePassportRegistration#f67e8e3f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypeTemporaryRegistration represents TL type `passportElementTypeTemporaryRegistration#411e345f`. -type PassportElementTypeTemporaryRegistration struct { -} - -// PassportElementTypeTemporaryRegistrationTypeID is TL type id of PassportElementTypeTemporaryRegistration. -const PassportElementTypeTemporaryRegistrationTypeID = 0x411e345f - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypeTemporaryRegistration) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypeTemporaryRegistration. -var ( - _ bin.Encoder = &PassportElementTypeTemporaryRegistration{} - _ bin.Decoder = &PassportElementTypeTemporaryRegistration{} - _ bin.BareEncoder = &PassportElementTypeTemporaryRegistration{} - _ bin.BareDecoder = &PassportElementTypeTemporaryRegistration{} - - _ PassportElementTypeClass = &PassportElementTypeTemporaryRegistration{} -) - -func (p *PassportElementTypeTemporaryRegistration) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypeTemporaryRegistration) String() string { - if p == nil { - return "PassportElementTypeTemporaryRegistration(nil)" - } - type Alias PassportElementTypeTemporaryRegistration - return fmt.Sprintf("PassportElementTypeTemporaryRegistration%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypeTemporaryRegistration) TypeID() uint32 { - return PassportElementTypeTemporaryRegistrationTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypeTemporaryRegistration) TypeName() string { - return "passportElementTypeTemporaryRegistration" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypeTemporaryRegistration) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypeTemporaryRegistration", - ID: PassportElementTypeTemporaryRegistrationTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypeTemporaryRegistration) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeTemporaryRegistration#411e345f as nil") - } - b.PutID(PassportElementTypeTemporaryRegistrationTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypeTemporaryRegistration) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeTemporaryRegistration#411e345f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypeTemporaryRegistration) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeTemporaryRegistration#411e345f to nil") - } - if err := b.ConsumeID(PassportElementTypeTemporaryRegistrationTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypeTemporaryRegistration#411e345f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypeTemporaryRegistration) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeTemporaryRegistration#411e345f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypeTemporaryRegistration) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeTemporaryRegistration#411e345f as nil") - } - b.ObjStart() - b.PutID("passportElementTypeTemporaryRegistration") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypeTemporaryRegistration) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeTemporaryRegistration#411e345f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypeTemporaryRegistration"); err != nil { - return fmt.Errorf("unable to decode passportElementTypeTemporaryRegistration#411e345f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypePhoneNumber represents TL type `passportElementTypePhoneNumber#c4abfe6c`. -type PassportElementTypePhoneNumber struct { -} - -// PassportElementTypePhoneNumberTypeID is TL type id of PassportElementTypePhoneNumber. -const PassportElementTypePhoneNumberTypeID = 0xc4abfe6c - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypePhoneNumber) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypePhoneNumber. -var ( - _ bin.Encoder = &PassportElementTypePhoneNumber{} - _ bin.Decoder = &PassportElementTypePhoneNumber{} - _ bin.BareEncoder = &PassportElementTypePhoneNumber{} - _ bin.BareDecoder = &PassportElementTypePhoneNumber{} - - _ PassportElementTypeClass = &PassportElementTypePhoneNumber{} -) - -func (p *PassportElementTypePhoneNumber) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypePhoneNumber) String() string { - if p == nil { - return "PassportElementTypePhoneNumber(nil)" - } - type Alias PassportElementTypePhoneNumber - return fmt.Sprintf("PassportElementTypePhoneNumber%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypePhoneNumber) TypeID() uint32 { - return PassportElementTypePhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypePhoneNumber) TypeName() string { - return "passportElementTypePhoneNumber" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypePhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypePhoneNumber", - ID: PassportElementTypePhoneNumberTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypePhoneNumber) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePhoneNumber#c4abfe6c as nil") - } - b.PutID(PassportElementTypePhoneNumberTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypePhoneNumber) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePhoneNumber#c4abfe6c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypePhoneNumber) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePhoneNumber#c4abfe6c to nil") - } - if err := b.ConsumeID(PassportElementTypePhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypePhoneNumber#c4abfe6c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypePhoneNumber) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePhoneNumber#c4abfe6c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypePhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypePhoneNumber#c4abfe6c as nil") - } - b.ObjStart() - b.PutID("passportElementTypePhoneNumber") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypePhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypePhoneNumber#c4abfe6c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypePhoneNumber"); err != nil { - return fmt.Errorf("unable to decode passportElementTypePhoneNumber#c4abfe6c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypeEmailAddress represents TL type `passportElementTypeEmailAddress#fb45a6c3`. -type PassportElementTypeEmailAddress struct { -} - -// PassportElementTypeEmailAddressTypeID is TL type id of PassportElementTypeEmailAddress. -const PassportElementTypeEmailAddressTypeID = 0xfb45a6c3 - -// construct implements constructor of PassportElementTypeClass. -func (p PassportElementTypeEmailAddress) construct() PassportElementTypeClass { return &p } - -// Ensuring interfaces in compile-time for PassportElementTypeEmailAddress. -var ( - _ bin.Encoder = &PassportElementTypeEmailAddress{} - _ bin.Decoder = &PassportElementTypeEmailAddress{} - _ bin.BareEncoder = &PassportElementTypeEmailAddress{} - _ bin.BareDecoder = &PassportElementTypeEmailAddress{} - - _ PassportElementTypeClass = &PassportElementTypeEmailAddress{} -) - -func (p *PassportElementTypeEmailAddress) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementTypeEmailAddress) String() string { - if p == nil { - return "PassportElementTypeEmailAddress(nil)" - } - type Alias PassportElementTypeEmailAddress - return fmt.Sprintf("PassportElementTypeEmailAddress%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementTypeEmailAddress) TypeID() uint32 { - return PassportElementTypeEmailAddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementTypeEmailAddress) TypeName() string { - return "passportElementTypeEmailAddress" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementTypeEmailAddress) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementTypeEmailAddress", - ID: PassportElementTypeEmailAddressTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementTypeEmailAddress) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeEmailAddress#fb45a6c3 as nil") - } - b.PutID(PassportElementTypeEmailAddressTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementTypeEmailAddress) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeEmailAddress#fb45a6c3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementTypeEmailAddress) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeEmailAddress#fb45a6c3 to nil") - } - if err := b.ConsumeID(PassportElementTypeEmailAddressTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementTypeEmailAddress#fb45a6c3: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementTypeEmailAddress) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeEmailAddress#fb45a6c3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementTypeEmailAddress) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementTypeEmailAddress#fb45a6c3 as nil") - } - b.ObjStart() - b.PutID("passportElementTypeEmailAddress") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementTypeEmailAddress) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementTypeEmailAddress#fb45a6c3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementTypeEmailAddress"); err != nil { - return fmt.Errorf("unable to decode passportElementTypeEmailAddress#fb45a6c3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PassportElementTypeClassName is schema name of PassportElementTypeClass. -const PassportElementTypeClassName = "PassportElementType" - -// PassportElementTypeClass represents PassportElementType generic type. -// -// Example: -// -// g, err := tdapi.DecodePassportElementType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PassportElementTypePersonalDetails: // passportElementTypePersonalDetails#c27ad953 -// case *tdapi.PassportElementTypePassport: // passportElementTypePassport#e5fdab48 -// case *tdapi.PassportElementTypeDriverLicense: // passportElementTypeDriverLicense#6cea5c4b -// case *tdapi.PassportElementTypeIdentityCard: // passportElementTypeIdentityCard#e20ea75c -// case *tdapi.PassportElementTypeInternalPassport: // passportElementTypeInternalPassport#d0afd939 -// case *tdapi.PassportElementTypeAddress: // passportElementTypeAddress#1d955cc2 -// case *tdapi.PassportElementTypeUtilityBill: // passportElementTypeUtilityBill#25608e6a -// case *tdapi.PassportElementTypeBankStatement: // passportElementTypeBankStatement#22380133 -// case *tdapi.PassportElementTypeRentalAgreement: // passportElementTypeRentalAgreement#852dfe90 -// case *tdapi.PassportElementTypePassportRegistration: // passportElementTypePassportRegistration#f67e8e3f -// case *tdapi.PassportElementTypeTemporaryRegistration: // passportElementTypeTemporaryRegistration#411e345f -// case *tdapi.PassportElementTypePhoneNumber: // passportElementTypePhoneNumber#c4abfe6c -// case *tdapi.PassportElementTypeEmailAddress: // passportElementTypeEmailAddress#fb45a6c3 -// default: panic(v) -// } -type PassportElementTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PassportElementTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePassportElementType implements binary de-serialization for PassportElementTypeClass. -func DecodePassportElementType(buf *bin.Buffer) (PassportElementTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PassportElementTypePersonalDetailsTypeID: - // Decoding passportElementTypePersonalDetails#c27ad953. - v := PassportElementTypePersonalDetails{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypePassportTypeID: - // Decoding passportElementTypePassport#e5fdab48. - v := PassportElementTypePassport{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypeDriverLicenseTypeID: - // Decoding passportElementTypeDriverLicense#6cea5c4b. - v := PassportElementTypeDriverLicense{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypeIdentityCardTypeID: - // Decoding passportElementTypeIdentityCard#e20ea75c. - v := PassportElementTypeIdentityCard{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypeInternalPassportTypeID: - // Decoding passportElementTypeInternalPassport#d0afd939. - v := PassportElementTypeInternalPassport{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypeAddressTypeID: - // Decoding passportElementTypeAddress#1d955cc2. - v := PassportElementTypeAddress{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypeUtilityBillTypeID: - // Decoding passportElementTypeUtilityBill#25608e6a. - v := PassportElementTypeUtilityBill{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypeBankStatementTypeID: - // Decoding passportElementTypeBankStatement#22380133. - v := PassportElementTypeBankStatement{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypeRentalAgreementTypeID: - // Decoding passportElementTypeRentalAgreement#852dfe90. - v := PassportElementTypeRentalAgreement{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypePassportRegistrationTypeID: - // Decoding passportElementTypePassportRegistration#f67e8e3f. - v := PassportElementTypePassportRegistration{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypeTemporaryRegistrationTypeID: - // Decoding passportElementTypeTemporaryRegistration#411e345f. - v := PassportElementTypeTemporaryRegistration{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypePhoneNumberTypeID: - // Decoding passportElementTypePhoneNumber#c4abfe6c. - v := PassportElementTypePhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case PassportElementTypeEmailAddressTypeID: - // Decoding passportElementTypeEmailAddress#fb45a6c3. - v := PassportElementTypeEmailAddress{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPassportElementType implements binary de-serialization for PassportElementTypeClass. -func DecodeTDLibJSONPassportElementType(buf tdjson.Decoder) (PassportElementTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "passportElementTypePersonalDetails": - // Decoding passportElementTypePersonalDetails#c27ad953. - v := PassportElementTypePersonalDetails{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypePassport": - // Decoding passportElementTypePassport#e5fdab48. - v := PassportElementTypePassport{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypeDriverLicense": - // Decoding passportElementTypeDriverLicense#6cea5c4b. - v := PassportElementTypeDriverLicense{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypeIdentityCard": - // Decoding passportElementTypeIdentityCard#e20ea75c. - v := PassportElementTypeIdentityCard{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypeInternalPassport": - // Decoding passportElementTypeInternalPassport#d0afd939. - v := PassportElementTypeInternalPassport{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypeAddress": - // Decoding passportElementTypeAddress#1d955cc2. - v := PassportElementTypeAddress{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypeUtilityBill": - // Decoding passportElementTypeUtilityBill#25608e6a. - v := PassportElementTypeUtilityBill{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypeBankStatement": - // Decoding passportElementTypeBankStatement#22380133. - v := PassportElementTypeBankStatement{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypeRentalAgreement": - // Decoding passportElementTypeRentalAgreement#852dfe90. - v := PassportElementTypeRentalAgreement{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypePassportRegistration": - // Decoding passportElementTypePassportRegistration#f67e8e3f. - v := PassportElementTypePassportRegistration{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypeTemporaryRegistration": - // Decoding passportElementTypeTemporaryRegistration#411e345f. - v := PassportElementTypeTemporaryRegistration{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypePhoneNumber": - // Decoding passportElementTypePhoneNumber#c4abfe6c. - v := PassportElementTypePhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - case "passportElementTypeEmailAddress": - // Decoding passportElementTypeEmailAddress#fb45a6c3. - v := PassportElementTypeEmailAddress{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PassportElementTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PassportElementType boxes the PassportElementTypeClass providing a helper. -type PassportElementTypeBox struct { - PassportElementType PassportElementTypeClass -} - -// Decode implements bin.Decoder for PassportElementTypeBox. -func (b *PassportElementTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PassportElementTypeBox to nil") - } - v, err := DecodePassportElementType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PassportElementType = v - return nil -} - -// Encode implements bin.Encode for PassportElementTypeBox. -func (b *PassportElementTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PassportElementType == nil { - return fmt.Errorf("unable to encode PassportElementTypeClass as nil") - } - return b.PassportElementType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PassportElementTypeBox. -func (b *PassportElementTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PassportElementTypeBox to nil") - } - v, err := DecodeTDLibJSONPassportElementType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PassportElementType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PassportElementTypeBox. -func (b *PassportElementTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PassportElementType == nil { - return fmt.Errorf("unable to encode PassportElementTypeClass as nil") - } - return b.PassportElementType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_passport_elements_gen.go b/tdapi/tl_passport_elements_gen.go deleted file mode 100644 index f5c72c11d..000000000 --- a/tdapi/tl_passport_elements_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PassportElements represents TL type `passportElements#bd8eaceb`. -type PassportElements struct { - // Telegram Passport elements - Elements []PassportElementClass -} - -// PassportElementsTypeID is TL type id of PassportElements. -const PassportElementsTypeID = 0xbd8eaceb - -// Ensuring interfaces in compile-time for PassportElements. -var ( - _ bin.Encoder = &PassportElements{} - _ bin.Decoder = &PassportElements{} - _ bin.BareEncoder = &PassportElements{} - _ bin.BareDecoder = &PassportElements{} -) - -func (p *PassportElements) Zero() bool { - if p == nil { - return true - } - if !(p.Elements == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElements) String() string { - if p == nil { - return "PassportElements(nil)" - } - type Alias PassportElements - return fmt.Sprintf("PassportElements%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElements) TypeID() uint32 { - return PassportElementsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElements) TypeName() string { - return "passportElements" -} - -// TypeInfo returns info about TL type. -func (p *PassportElements) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElements", - ID: PassportElementsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Elements", - SchemaName: "elements", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElements) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElements#bd8eaceb as nil") - } - b.PutID(PassportElementsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElements) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElements#bd8eaceb as nil") - } - b.PutInt(len(p.Elements)) - for idx, v := range p.Elements { - if v == nil { - return fmt.Errorf("unable to encode passportElements#bd8eaceb: field elements element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare passportElements#bd8eaceb: field elements element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElements) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElements#bd8eaceb to nil") - } - if err := b.ConsumeID(PassportElementsTypeID); err != nil { - return fmt.Errorf("unable to decode passportElements#bd8eaceb: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElements) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElements#bd8eaceb to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode passportElements#bd8eaceb: field elements: %w", err) - } - - if headerLen > 0 { - p.Elements = make([]PassportElementClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePassportElement(b) - if err != nil { - return fmt.Errorf("unable to decode passportElements#bd8eaceb: field elements: %w", err) - } - p.Elements = append(p.Elements, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElements) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElements#bd8eaceb as nil") - } - b.ObjStart() - b.PutID("passportElements") - b.Comma() - b.FieldStart("elements") - b.ArrStart() - for idx, v := range p.Elements { - if v == nil { - return fmt.Errorf("unable to encode passportElements#bd8eaceb: field elements element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElements#bd8eaceb: field elements element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElements) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElements#bd8eaceb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElements"); err != nil { - return fmt.Errorf("unable to decode passportElements#bd8eaceb: %w", err) - } - case "elements": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPassportElement(b) - if err != nil { - return fmt.Errorf("unable to decode passportElements#bd8eaceb: field elements: %w", err) - } - p.Elements = append(p.Elements, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode passportElements#bd8eaceb: field elements: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetElements returns value of Elements field. -func (p *PassportElements) GetElements() (value []PassportElementClass) { - if p == nil { - return - } - return p.Elements -} diff --git a/tdapi/tl_passport_elements_with_errors_gen.go b/tdapi/tl_passport_elements_with_errors_gen.go deleted file mode 100644 index e851fbd83..000000000 --- a/tdapi/tl_passport_elements_with_errors_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PassportElementsWithErrors represents TL type `passportElementsWithErrors#438d1abf`. -type PassportElementsWithErrors struct { - // Telegram Passport elements - Elements []PassportElementClass - // Errors in the elements that are already available - Errors []PassportElementError -} - -// PassportElementsWithErrorsTypeID is TL type id of PassportElementsWithErrors. -const PassportElementsWithErrorsTypeID = 0x438d1abf - -// Ensuring interfaces in compile-time for PassportElementsWithErrors. -var ( - _ bin.Encoder = &PassportElementsWithErrors{} - _ bin.Decoder = &PassportElementsWithErrors{} - _ bin.BareEncoder = &PassportElementsWithErrors{} - _ bin.BareDecoder = &PassportElementsWithErrors{} -) - -func (p *PassportElementsWithErrors) Zero() bool { - if p == nil { - return true - } - if !(p.Elements == nil) { - return false - } - if !(p.Errors == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportElementsWithErrors) String() string { - if p == nil { - return "PassportElementsWithErrors(nil)" - } - type Alias PassportElementsWithErrors - return fmt.Sprintf("PassportElementsWithErrors%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportElementsWithErrors) TypeID() uint32 { - return PassportElementsWithErrorsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportElementsWithErrors) TypeName() string { - return "passportElementsWithErrors" -} - -// TypeInfo returns info about TL type. -func (p *PassportElementsWithErrors) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportElementsWithErrors", - ID: PassportElementsWithErrorsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Elements", - SchemaName: "elements", - }, - { - Name: "Errors", - SchemaName: "errors", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportElementsWithErrors) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementsWithErrors#438d1abf as nil") - } - b.PutID(PassportElementsWithErrorsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportElementsWithErrors) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportElementsWithErrors#438d1abf as nil") - } - b.PutInt(len(p.Elements)) - for idx, v := range p.Elements { - if v == nil { - return fmt.Errorf("unable to encode passportElementsWithErrors#438d1abf: field elements element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare passportElementsWithErrors#438d1abf: field elements element with index %d: %w", idx, err) - } - } - b.PutInt(len(p.Errors)) - for idx, v := range p.Errors { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare passportElementsWithErrors#438d1abf: field errors element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportElementsWithErrors) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementsWithErrors#438d1abf to nil") - } - if err := b.ConsumeID(PassportElementsWithErrorsTypeID); err != nil { - return fmt.Errorf("unable to decode passportElementsWithErrors#438d1abf: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportElementsWithErrors) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportElementsWithErrors#438d1abf to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode passportElementsWithErrors#438d1abf: field elements: %w", err) - } - - if headerLen > 0 { - p.Elements = make([]PassportElementClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePassportElement(b) - if err != nil { - return fmt.Errorf("unable to decode passportElementsWithErrors#438d1abf: field elements: %w", err) - } - p.Elements = append(p.Elements, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode passportElementsWithErrors#438d1abf: field errors: %w", err) - } - - if headerLen > 0 { - p.Errors = make([]PassportElementError, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PassportElementError - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare passportElementsWithErrors#438d1abf: field errors: %w", err) - } - p.Errors = append(p.Errors, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportElementsWithErrors) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportElementsWithErrors#438d1abf as nil") - } - b.ObjStart() - b.PutID("passportElementsWithErrors") - b.Comma() - b.FieldStart("elements") - b.ArrStart() - for idx, v := range p.Elements { - if v == nil { - return fmt.Errorf("unable to encode passportElementsWithErrors#438d1abf: field elements element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementsWithErrors#438d1abf: field elements element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("errors") - b.ArrStart() - for idx, v := range p.Errors { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportElementsWithErrors#438d1abf: field errors element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportElementsWithErrors) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportElementsWithErrors#438d1abf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportElementsWithErrors"); err != nil { - return fmt.Errorf("unable to decode passportElementsWithErrors#438d1abf: %w", err) - } - case "elements": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPassportElement(b) - if err != nil { - return fmt.Errorf("unable to decode passportElementsWithErrors#438d1abf: field elements: %w", err) - } - p.Elements = append(p.Elements, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode passportElementsWithErrors#438d1abf: field elements: %w", err) - } - case "errors": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PassportElementError - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportElementsWithErrors#438d1abf: field errors: %w", err) - } - p.Errors = append(p.Errors, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode passportElementsWithErrors#438d1abf: field errors: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetElements returns value of Elements field. -func (p *PassportElementsWithErrors) GetElements() (value []PassportElementClass) { - if p == nil { - return - } - return p.Elements -} - -// GetErrors returns value of Errors field. -func (p *PassportElementsWithErrors) GetErrors() (value []PassportElementError) { - if p == nil { - return - } - return p.Errors -} diff --git a/tdapi/tl_passport_required_element_gen.go b/tdapi/tl_passport_required_element_gen.go deleted file mode 100644 index ae78f2b21..000000000 --- a/tdapi/tl_passport_required_element_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PassportRequiredElement represents TL type `passportRequiredElement#f2ad05fd`. -type PassportRequiredElement struct { - // List of Telegram Passport elements any of which is enough to provide - SuitableElements []PassportSuitableElement -} - -// PassportRequiredElementTypeID is TL type id of PassportRequiredElement. -const PassportRequiredElementTypeID = 0xf2ad05fd - -// Ensuring interfaces in compile-time for PassportRequiredElement. -var ( - _ bin.Encoder = &PassportRequiredElement{} - _ bin.Decoder = &PassportRequiredElement{} - _ bin.BareEncoder = &PassportRequiredElement{} - _ bin.BareDecoder = &PassportRequiredElement{} -) - -func (p *PassportRequiredElement) Zero() bool { - if p == nil { - return true - } - if !(p.SuitableElements == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportRequiredElement) String() string { - if p == nil { - return "PassportRequiredElement(nil)" - } - type Alias PassportRequiredElement - return fmt.Sprintf("PassportRequiredElement%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportRequiredElement) TypeID() uint32 { - return PassportRequiredElementTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportRequiredElement) TypeName() string { - return "passportRequiredElement" -} - -// TypeInfo returns info about TL type. -func (p *PassportRequiredElement) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportRequiredElement", - ID: PassportRequiredElementTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SuitableElements", - SchemaName: "suitable_elements", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportRequiredElement) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportRequiredElement#f2ad05fd as nil") - } - b.PutID(PassportRequiredElementTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportRequiredElement) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportRequiredElement#f2ad05fd as nil") - } - b.PutInt(len(p.SuitableElements)) - for idx, v := range p.SuitableElements { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare passportRequiredElement#f2ad05fd: field suitable_elements element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportRequiredElement) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportRequiredElement#f2ad05fd to nil") - } - if err := b.ConsumeID(PassportRequiredElementTypeID); err != nil { - return fmt.Errorf("unable to decode passportRequiredElement#f2ad05fd: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportRequiredElement) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportRequiredElement#f2ad05fd to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode passportRequiredElement#f2ad05fd: field suitable_elements: %w", err) - } - - if headerLen > 0 { - p.SuitableElements = make([]PassportSuitableElement, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PassportSuitableElement - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare passportRequiredElement#f2ad05fd: field suitable_elements: %w", err) - } - p.SuitableElements = append(p.SuitableElements, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportRequiredElement) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportRequiredElement#f2ad05fd as nil") - } - b.ObjStart() - b.PutID("passportRequiredElement") - b.Comma() - b.FieldStart("suitable_elements") - b.ArrStart() - for idx, v := range p.SuitableElements { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportRequiredElement#f2ad05fd: field suitable_elements element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportRequiredElement) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportRequiredElement#f2ad05fd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportRequiredElement"); err != nil { - return fmt.Errorf("unable to decode passportRequiredElement#f2ad05fd: %w", err) - } - case "suitable_elements": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PassportSuitableElement - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passportRequiredElement#f2ad05fd: field suitable_elements: %w", err) - } - p.SuitableElements = append(p.SuitableElements, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode passportRequiredElement#f2ad05fd: field suitable_elements: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSuitableElements returns value of SuitableElements field. -func (p *PassportRequiredElement) GetSuitableElements() (value []PassportSuitableElement) { - if p == nil { - return - } - return p.SuitableElements -} diff --git a/tdapi/tl_passport_suitable_element_gen.go b/tdapi/tl_passport_suitable_element_gen.go deleted file mode 100644 index c51ce9ee0..000000000 --- a/tdapi/tl_passport_suitable_element_gen.go +++ /dev/null @@ -1,306 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PassportSuitableElement represents TL type `passportSuitableElement#d0f8831c`. -type PassportSuitableElement struct { - // Type of the element - Type PassportElementTypeClass - // True, if a selfie is required with the identity document - IsSelfieRequired bool - // True, if a certified English translation is required with the document - IsTranslationRequired bool - // True, if personal details must include the user's name in the language of their - // country of residence - IsNativeNameRequired bool -} - -// PassportSuitableElementTypeID is TL type id of PassportSuitableElement. -const PassportSuitableElementTypeID = 0xd0f8831c - -// Ensuring interfaces in compile-time for PassportSuitableElement. -var ( - _ bin.Encoder = &PassportSuitableElement{} - _ bin.Decoder = &PassportSuitableElement{} - _ bin.BareEncoder = &PassportSuitableElement{} - _ bin.BareDecoder = &PassportSuitableElement{} -) - -func (p *PassportSuitableElement) Zero() bool { - if p == nil { - return true - } - if !(p.Type == nil) { - return false - } - if !(p.IsSelfieRequired == false) { - return false - } - if !(p.IsTranslationRequired == false) { - return false - } - if !(p.IsNativeNameRequired == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PassportSuitableElement) String() string { - if p == nil { - return "PassportSuitableElement(nil)" - } - type Alias PassportSuitableElement - return fmt.Sprintf("PassportSuitableElement%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PassportSuitableElement) TypeID() uint32 { - return PassportSuitableElementTypeID -} - -// TypeName returns name of type in TL schema. -func (*PassportSuitableElement) TypeName() string { - return "passportSuitableElement" -} - -// TypeInfo returns info about TL type. -func (p *PassportSuitableElement) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passportSuitableElement", - ID: PassportSuitableElementTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "IsSelfieRequired", - SchemaName: "is_selfie_required", - }, - { - Name: "IsTranslationRequired", - SchemaName: "is_translation_required", - }, - { - Name: "IsNativeNameRequired", - SchemaName: "is_native_name_required", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PassportSuitableElement) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportSuitableElement#d0f8831c as nil") - } - b.PutID(PassportSuitableElementTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PassportSuitableElement) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passportSuitableElement#d0f8831c as nil") - } - if p.Type == nil { - return fmt.Errorf("unable to encode passportSuitableElement#d0f8831c: field type is nil") - } - if err := p.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode passportSuitableElement#d0f8831c: field type: %w", err) - } - b.PutBool(p.IsSelfieRequired) - b.PutBool(p.IsTranslationRequired) - b.PutBool(p.IsNativeNameRequired) - return nil -} - -// Decode implements bin.Decoder. -func (p *PassportSuitableElement) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportSuitableElement#d0f8831c to nil") - } - if err := b.ConsumeID(PassportSuitableElementTypeID); err != nil { - return fmt.Errorf("unable to decode passportSuitableElement#d0f8831c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PassportSuitableElement) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passportSuitableElement#d0f8831c to nil") - } - { - value, err := DecodePassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode passportSuitableElement#d0f8831c: field type: %w", err) - } - p.Type = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passportSuitableElement#d0f8831c: field is_selfie_required: %w", err) - } - p.IsSelfieRequired = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passportSuitableElement#d0f8831c: field is_translation_required: %w", err) - } - p.IsTranslationRequired = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passportSuitableElement#d0f8831c: field is_native_name_required: %w", err) - } - p.IsNativeNameRequired = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PassportSuitableElement) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passportSuitableElement#d0f8831c as nil") - } - b.ObjStart() - b.PutID("passportSuitableElement") - b.Comma() - b.FieldStart("type") - if p.Type == nil { - return fmt.Errorf("unable to encode passportSuitableElement#d0f8831c: field type is nil") - } - if err := p.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passportSuitableElement#d0f8831c: field type: %w", err) - } - b.Comma() - b.FieldStart("is_selfie_required") - b.PutBool(p.IsSelfieRequired) - b.Comma() - b.FieldStart("is_translation_required") - b.PutBool(p.IsTranslationRequired) - b.Comma() - b.FieldStart("is_native_name_required") - b.PutBool(p.IsNativeNameRequired) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PassportSuitableElement) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passportSuitableElement#d0f8831c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passportSuitableElement"); err != nil { - return fmt.Errorf("unable to decode passportSuitableElement#d0f8831c: %w", err) - } - case "type": - value, err := DecodeTDLibJSONPassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode passportSuitableElement#d0f8831c: field type: %w", err) - } - p.Type = value - case "is_selfie_required": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passportSuitableElement#d0f8831c: field is_selfie_required: %w", err) - } - p.IsSelfieRequired = value - case "is_translation_required": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passportSuitableElement#d0f8831c: field is_translation_required: %w", err) - } - p.IsTranslationRequired = value - case "is_native_name_required": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passportSuitableElement#d0f8831c: field is_native_name_required: %w", err) - } - p.IsNativeNameRequired = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (p *PassportSuitableElement) GetType() (value PassportElementTypeClass) { - if p == nil { - return - } - return p.Type -} - -// GetIsSelfieRequired returns value of IsSelfieRequired field. -func (p *PassportSuitableElement) GetIsSelfieRequired() (value bool) { - if p == nil { - return - } - return p.IsSelfieRequired -} - -// GetIsTranslationRequired returns value of IsTranslationRequired field. -func (p *PassportSuitableElement) GetIsTranslationRequired() (value bool) { - if p == nil { - return - } - return p.IsTranslationRequired -} - -// GetIsNativeNameRequired returns value of IsNativeNameRequired field. -func (p *PassportSuitableElement) GetIsNativeNameRequired() (value bool) { - if p == nil { - return - } - return p.IsNativeNameRequired -} diff --git a/tdapi/tl_password_state_gen.go b/tdapi/tl_password_state_gen.go deleted file mode 100644 index 9e1deec67..000000000 --- a/tdapi/tl_password_state_gen.go +++ /dev/null @@ -1,399 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PasswordState represents TL type `passwordState#1cd63828`. -type PasswordState struct { - // True, if a 2-step verification password is set - HasPassword bool - // Hint for the password; may be empty - PasswordHint string - // True, if a recovery email is set - HasRecoveryEmailAddress bool - // True, if some Telegram Passport elements were saved - HasPassportData bool - // Information about the recovery email address to which the confirmation email was sent; - // may be null - RecoveryEmailAddressCodeInfo EmailAddressAuthenticationCodeInfo - // Pattern of the email address set up for logging in - LoginEmailAddressPattern string - // If not 0, point in time (Unix timestamp) after which the 2-step verification password - // can be reset immediately using resetPassword - PendingResetDate int32 -} - -// PasswordStateTypeID is TL type id of PasswordState. -const PasswordStateTypeID = 0x1cd63828 - -// Ensuring interfaces in compile-time for PasswordState. -var ( - _ bin.Encoder = &PasswordState{} - _ bin.Decoder = &PasswordState{} - _ bin.BareEncoder = &PasswordState{} - _ bin.BareDecoder = &PasswordState{} -) - -func (p *PasswordState) Zero() bool { - if p == nil { - return true - } - if !(p.HasPassword == false) { - return false - } - if !(p.PasswordHint == "") { - return false - } - if !(p.HasRecoveryEmailAddress == false) { - return false - } - if !(p.HasPassportData == false) { - return false - } - if !(p.RecoveryEmailAddressCodeInfo.Zero()) { - return false - } - if !(p.LoginEmailAddressPattern == "") { - return false - } - if !(p.PendingResetDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PasswordState) String() string { - if p == nil { - return "PasswordState(nil)" - } - type Alias PasswordState - return fmt.Sprintf("PasswordState%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PasswordState) TypeID() uint32 { - return PasswordStateTypeID -} - -// TypeName returns name of type in TL schema. -func (*PasswordState) TypeName() string { - return "passwordState" -} - -// TypeInfo returns info about TL type. -func (p *PasswordState) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "passwordState", - ID: PasswordStateTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "HasPassword", - SchemaName: "has_password", - }, - { - Name: "PasswordHint", - SchemaName: "password_hint", - }, - { - Name: "HasRecoveryEmailAddress", - SchemaName: "has_recovery_email_address", - }, - { - Name: "HasPassportData", - SchemaName: "has_passport_data", - }, - { - Name: "RecoveryEmailAddressCodeInfo", - SchemaName: "recovery_email_address_code_info", - }, - { - Name: "LoginEmailAddressPattern", - SchemaName: "login_email_address_pattern", - }, - { - Name: "PendingResetDate", - SchemaName: "pending_reset_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PasswordState) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passwordState#1cd63828 as nil") - } - b.PutID(PasswordStateTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PasswordState) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode passwordState#1cd63828 as nil") - } - b.PutBool(p.HasPassword) - b.PutString(p.PasswordHint) - b.PutBool(p.HasRecoveryEmailAddress) - b.PutBool(p.HasPassportData) - if err := p.RecoveryEmailAddressCodeInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode passwordState#1cd63828: field recovery_email_address_code_info: %w", err) - } - b.PutString(p.LoginEmailAddressPattern) - b.PutInt32(p.PendingResetDate) - return nil -} - -// Decode implements bin.Decoder. -func (p *PasswordState) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passwordState#1cd63828 to nil") - } - if err := b.ConsumeID(PasswordStateTypeID); err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PasswordState) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode passwordState#1cd63828 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field has_password: %w", err) - } - p.HasPassword = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field password_hint: %w", err) - } - p.PasswordHint = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field has_recovery_email_address: %w", err) - } - p.HasRecoveryEmailAddress = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field has_passport_data: %w", err) - } - p.HasPassportData = value - } - { - if err := p.RecoveryEmailAddressCodeInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field recovery_email_address_code_info: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field login_email_address_pattern: %w", err) - } - p.LoginEmailAddressPattern = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field pending_reset_date: %w", err) - } - p.PendingResetDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PasswordState) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode passwordState#1cd63828 as nil") - } - b.ObjStart() - b.PutID("passwordState") - b.Comma() - b.FieldStart("has_password") - b.PutBool(p.HasPassword) - b.Comma() - b.FieldStart("password_hint") - b.PutString(p.PasswordHint) - b.Comma() - b.FieldStart("has_recovery_email_address") - b.PutBool(p.HasRecoveryEmailAddress) - b.Comma() - b.FieldStart("has_passport_data") - b.PutBool(p.HasPassportData) - b.Comma() - b.FieldStart("recovery_email_address_code_info") - if err := p.RecoveryEmailAddressCodeInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode passwordState#1cd63828: field recovery_email_address_code_info: %w", err) - } - b.Comma() - b.FieldStart("login_email_address_pattern") - b.PutString(p.LoginEmailAddressPattern) - b.Comma() - b.FieldStart("pending_reset_date") - b.PutInt32(p.PendingResetDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PasswordState) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode passwordState#1cd63828 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("passwordState"); err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: %w", err) - } - case "has_password": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field has_password: %w", err) - } - p.HasPassword = value - case "password_hint": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field password_hint: %w", err) - } - p.PasswordHint = value - case "has_recovery_email_address": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field has_recovery_email_address: %w", err) - } - p.HasRecoveryEmailAddress = value - case "has_passport_data": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field has_passport_data: %w", err) - } - p.HasPassportData = value - case "recovery_email_address_code_info": - if err := p.RecoveryEmailAddressCodeInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field recovery_email_address_code_info: %w", err) - } - case "login_email_address_pattern": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field login_email_address_pattern: %w", err) - } - p.LoginEmailAddressPattern = value - case "pending_reset_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode passwordState#1cd63828: field pending_reset_date: %w", err) - } - p.PendingResetDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetHasPassword returns value of HasPassword field. -func (p *PasswordState) GetHasPassword() (value bool) { - if p == nil { - return - } - return p.HasPassword -} - -// GetPasswordHint returns value of PasswordHint field. -func (p *PasswordState) GetPasswordHint() (value string) { - if p == nil { - return - } - return p.PasswordHint -} - -// GetHasRecoveryEmailAddress returns value of HasRecoveryEmailAddress field. -func (p *PasswordState) GetHasRecoveryEmailAddress() (value bool) { - if p == nil { - return - } - return p.HasRecoveryEmailAddress -} - -// GetHasPassportData returns value of HasPassportData field. -func (p *PasswordState) GetHasPassportData() (value bool) { - if p == nil { - return - } - return p.HasPassportData -} - -// GetRecoveryEmailAddressCodeInfo returns value of RecoveryEmailAddressCodeInfo field. -func (p *PasswordState) GetRecoveryEmailAddressCodeInfo() (value EmailAddressAuthenticationCodeInfo) { - if p == nil { - return - } - return p.RecoveryEmailAddressCodeInfo -} - -// GetLoginEmailAddressPattern returns value of LoginEmailAddressPattern field. -func (p *PasswordState) GetLoginEmailAddressPattern() (value string) { - if p == nil { - return - } - return p.LoginEmailAddressPattern -} - -// GetPendingResetDate returns value of PendingResetDate field. -func (p *PasswordState) GetPendingResetDate() (value int32) { - if p == nil { - return - } - return p.PendingResetDate -} diff --git a/tdapi/tl_payment_form_gen.go b/tdapi/tl_payment_form_gen.go deleted file mode 100644 index 1e92e1771..000000000 --- a/tdapi/tl_payment_form_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PaymentForm represents TL type `paymentForm#7720ffb3`. -type PaymentForm struct { - // The payment form identifier - ID int64 - // Type of the payment form - Type PaymentFormTypeClass - // User identifier of the seller bot - SellerBotUserID int64 - // Information about the product - ProductInfo ProductInfo -} - -// PaymentFormTypeID is TL type id of PaymentForm. -const PaymentFormTypeID = 0x7720ffb3 - -// Ensuring interfaces in compile-time for PaymentForm. -var ( - _ bin.Encoder = &PaymentForm{} - _ bin.Decoder = &PaymentForm{} - _ bin.BareEncoder = &PaymentForm{} - _ bin.BareDecoder = &PaymentForm{} -) - -func (p *PaymentForm) Zero() bool { - if p == nil { - return true - } - if !(p.ID == 0) { - return false - } - if !(p.Type == nil) { - return false - } - if !(p.SellerBotUserID == 0) { - return false - } - if !(p.ProductInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentForm) String() string { - if p == nil { - return "PaymentForm(nil)" - } - type Alias PaymentForm - return fmt.Sprintf("PaymentForm%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentForm) TypeID() uint32 { - return PaymentFormTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentForm) TypeName() string { - return "paymentForm" -} - -// TypeInfo returns info about TL type. -func (p *PaymentForm) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentForm", - ID: PaymentFormTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "SellerBotUserID", - SchemaName: "seller_bot_user_id", - }, - { - Name: "ProductInfo", - SchemaName: "product_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentForm) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentForm#7720ffb3 as nil") - } - b.PutID(PaymentFormTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentForm) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentForm#7720ffb3 as nil") - } - b.PutLong(p.ID) - if p.Type == nil { - return fmt.Errorf("unable to encode paymentForm#7720ffb3: field type is nil") - } - if err := p.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode paymentForm#7720ffb3: field type: %w", err) - } - b.PutInt53(p.SellerBotUserID) - if err := p.ProductInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode paymentForm#7720ffb3: field product_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentForm) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentForm#7720ffb3 to nil") - } - if err := b.ConsumeID(PaymentFormTypeID); err != nil { - return fmt.Errorf("unable to decode paymentForm#7720ffb3: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentForm) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentForm#7720ffb3 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode paymentForm#7720ffb3: field id: %w", err) - } - p.ID = value - } - { - value, err := DecodePaymentFormType(b) - if err != nil { - return fmt.Errorf("unable to decode paymentForm#7720ffb3: field type: %w", err) - } - p.Type = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentForm#7720ffb3: field seller_bot_user_id: %w", err) - } - p.SellerBotUserID = value - } - { - if err := p.ProductInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode paymentForm#7720ffb3: field product_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentForm) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentForm#7720ffb3 as nil") - } - b.ObjStart() - b.PutID("paymentForm") - b.Comma() - b.FieldStart("id") - b.PutLong(p.ID) - b.Comma() - b.FieldStart("type") - if p.Type == nil { - return fmt.Errorf("unable to encode paymentForm#7720ffb3: field type is nil") - } - if err := p.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentForm#7720ffb3: field type: %w", err) - } - b.Comma() - b.FieldStart("seller_bot_user_id") - b.PutInt53(p.SellerBotUserID) - b.Comma() - b.FieldStart("product_info") - if err := p.ProductInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentForm#7720ffb3: field product_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentForm) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentForm#7720ffb3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentForm"); err != nil { - return fmt.Errorf("unable to decode paymentForm#7720ffb3: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode paymentForm#7720ffb3: field id: %w", err) - } - p.ID = value - case "type": - value, err := DecodeTDLibJSONPaymentFormType(b) - if err != nil { - return fmt.Errorf("unable to decode paymentForm#7720ffb3: field type: %w", err) - } - p.Type = value - case "seller_bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentForm#7720ffb3: field seller_bot_user_id: %w", err) - } - p.SellerBotUserID = value - case "product_info": - if err := p.ProductInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paymentForm#7720ffb3: field product_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (p *PaymentForm) GetID() (value int64) { - if p == nil { - return - } - return p.ID -} - -// GetType returns value of Type field. -func (p *PaymentForm) GetType() (value PaymentFormTypeClass) { - if p == nil { - return - } - return p.Type -} - -// GetSellerBotUserID returns value of SellerBotUserID field. -func (p *PaymentForm) GetSellerBotUserID() (value int64) { - if p == nil { - return - } - return p.SellerBotUserID -} - -// GetProductInfo returns value of ProductInfo field. -func (p *PaymentForm) GetProductInfo() (value ProductInfo) { - if p == nil { - return - } - return p.ProductInfo -} diff --git a/tdapi/tl_payment_form_type_gen.go b/tdapi/tl_payment_form_type_gen.go deleted file mode 100644 index 49cf65b23..000000000 --- a/tdapi/tl_payment_form_type_gen.go +++ /dev/null @@ -1,987 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PaymentFormTypeRegular represents TL type `paymentFormTypeRegular#ba6d2f0f`. -type PaymentFormTypeRegular struct { - // Full information about the invoice - Invoice Invoice - // User identifier of the payment provider bot - PaymentProviderUserID int64 - // Information about the payment provider - PaymentProvider PaymentProviderClass - // The list of additional payment options - AdditionalPaymentOptions []PaymentOption - // Saved server-side order information; may be null - SavedOrderInfo OrderInfo - // The list of saved payment credentials - SavedCredentials []SavedCredentials - // True, if the user can choose to save credentials - CanSaveCredentials bool - // True, if the user will be able to save credentials, if sets up a 2-step verification - // password - NeedPassword bool -} - -// PaymentFormTypeRegularTypeID is TL type id of PaymentFormTypeRegular. -const PaymentFormTypeRegularTypeID = 0xba6d2f0f - -// construct implements constructor of PaymentFormTypeClass. -func (p PaymentFormTypeRegular) construct() PaymentFormTypeClass { return &p } - -// Ensuring interfaces in compile-time for PaymentFormTypeRegular. -var ( - _ bin.Encoder = &PaymentFormTypeRegular{} - _ bin.Decoder = &PaymentFormTypeRegular{} - _ bin.BareEncoder = &PaymentFormTypeRegular{} - _ bin.BareDecoder = &PaymentFormTypeRegular{} - - _ PaymentFormTypeClass = &PaymentFormTypeRegular{} -) - -func (p *PaymentFormTypeRegular) Zero() bool { - if p == nil { - return true - } - if !(p.Invoice.Zero()) { - return false - } - if !(p.PaymentProviderUserID == 0) { - return false - } - if !(p.PaymentProvider == nil) { - return false - } - if !(p.AdditionalPaymentOptions == nil) { - return false - } - if !(p.SavedOrderInfo.Zero()) { - return false - } - if !(p.SavedCredentials == nil) { - return false - } - if !(p.CanSaveCredentials == false) { - return false - } - if !(p.NeedPassword == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentFormTypeRegular) String() string { - if p == nil { - return "PaymentFormTypeRegular(nil)" - } - type Alias PaymentFormTypeRegular - return fmt.Sprintf("PaymentFormTypeRegular%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentFormTypeRegular) TypeID() uint32 { - return PaymentFormTypeRegularTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentFormTypeRegular) TypeName() string { - return "paymentFormTypeRegular" -} - -// TypeInfo returns info about TL type. -func (p *PaymentFormTypeRegular) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentFormTypeRegular", - ID: PaymentFormTypeRegularTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Invoice", - SchemaName: "invoice", - }, - { - Name: "PaymentProviderUserID", - SchemaName: "payment_provider_user_id", - }, - { - Name: "PaymentProvider", - SchemaName: "payment_provider", - }, - { - Name: "AdditionalPaymentOptions", - SchemaName: "additional_payment_options", - }, - { - Name: "SavedOrderInfo", - SchemaName: "saved_order_info", - }, - { - Name: "SavedCredentials", - SchemaName: "saved_credentials", - }, - { - Name: "CanSaveCredentials", - SchemaName: "can_save_credentials", - }, - { - Name: "NeedPassword", - SchemaName: "need_password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentFormTypeRegular) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentFormTypeRegular#ba6d2f0f as nil") - } - b.PutID(PaymentFormTypeRegularTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentFormTypeRegular) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentFormTypeRegular#ba6d2f0f as nil") - } - if err := p.Invoice.Encode(b); err != nil { - return fmt.Errorf("unable to encode paymentFormTypeRegular#ba6d2f0f: field invoice: %w", err) - } - b.PutInt53(p.PaymentProviderUserID) - if p.PaymentProvider == nil { - return fmt.Errorf("unable to encode paymentFormTypeRegular#ba6d2f0f: field payment_provider is nil") - } - if err := p.PaymentProvider.Encode(b); err != nil { - return fmt.Errorf("unable to encode paymentFormTypeRegular#ba6d2f0f: field payment_provider: %w", err) - } - b.PutInt(len(p.AdditionalPaymentOptions)) - for idx, v := range p.AdditionalPaymentOptions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare paymentFormTypeRegular#ba6d2f0f: field additional_payment_options element with index %d: %w", idx, err) - } - } - if err := p.SavedOrderInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode paymentFormTypeRegular#ba6d2f0f: field saved_order_info: %w", err) - } - b.PutInt(len(p.SavedCredentials)) - for idx, v := range p.SavedCredentials { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare paymentFormTypeRegular#ba6d2f0f: field saved_credentials element with index %d: %w", idx, err) - } - } - b.PutBool(p.CanSaveCredentials) - b.PutBool(p.NeedPassword) - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentFormTypeRegular) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentFormTypeRegular#ba6d2f0f to nil") - } - if err := b.ConsumeID(PaymentFormTypeRegularTypeID); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentFormTypeRegular) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentFormTypeRegular#ba6d2f0f to nil") - } - { - if err := p.Invoice.Decode(b); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field invoice: %w", err) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field payment_provider_user_id: %w", err) - } - p.PaymentProviderUserID = value - } - { - value, err := DecodePaymentProvider(b) - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field payment_provider: %w", err) - } - p.PaymentProvider = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field additional_payment_options: %w", err) - } - - if headerLen > 0 { - p.AdditionalPaymentOptions = make([]PaymentOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PaymentOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare paymentFormTypeRegular#ba6d2f0f: field additional_payment_options: %w", err) - } - p.AdditionalPaymentOptions = append(p.AdditionalPaymentOptions, value) - } - } - { - if err := p.SavedOrderInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field saved_order_info: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field saved_credentials: %w", err) - } - - if headerLen > 0 { - p.SavedCredentials = make([]SavedCredentials, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value SavedCredentials - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare paymentFormTypeRegular#ba6d2f0f: field saved_credentials: %w", err) - } - p.SavedCredentials = append(p.SavedCredentials, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field can_save_credentials: %w", err) - } - p.CanSaveCredentials = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field need_password: %w", err) - } - p.NeedPassword = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentFormTypeRegular) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentFormTypeRegular#ba6d2f0f as nil") - } - b.ObjStart() - b.PutID("paymentFormTypeRegular") - b.Comma() - b.FieldStart("invoice") - if err := p.Invoice.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentFormTypeRegular#ba6d2f0f: field invoice: %w", err) - } - b.Comma() - b.FieldStart("payment_provider_user_id") - b.PutInt53(p.PaymentProviderUserID) - b.Comma() - b.FieldStart("payment_provider") - if p.PaymentProvider == nil { - return fmt.Errorf("unable to encode paymentFormTypeRegular#ba6d2f0f: field payment_provider is nil") - } - if err := p.PaymentProvider.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentFormTypeRegular#ba6d2f0f: field payment_provider: %w", err) - } - b.Comma() - b.FieldStart("additional_payment_options") - b.ArrStart() - for idx, v := range p.AdditionalPaymentOptions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentFormTypeRegular#ba6d2f0f: field additional_payment_options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("saved_order_info") - if err := p.SavedOrderInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentFormTypeRegular#ba6d2f0f: field saved_order_info: %w", err) - } - b.Comma() - b.FieldStart("saved_credentials") - b.ArrStart() - for idx, v := range p.SavedCredentials { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentFormTypeRegular#ba6d2f0f: field saved_credentials element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("can_save_credentials") - b.PutBool(p.CanSaveCredentials) - b.Comma() - b.FieldStart("need_password") - b.PutBool(p.NeedPassword) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentFormTypeRegular) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentFormTypeRegular#ba6d2f0f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentFormTypeRegular"); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: %w", err) - } - case "invoice": - if err := p.Invoice.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field invoice: %w", err) - } - case "payment_provider_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field payment_provider_user_id: %w", err) - } - p.PaymentProviderUserID = value - case "payment_provider": - value, err := DecodeTDLibJSONPaymentProvider(b) - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field payment_provider: %w", err) - } - p.PaymentProvider = value - case "additional_payment_options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PaymentOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field additional_payment_options: %w", err) - } - p.AdditionalPaymentOptions = append(p.AdditionalPaymentOptions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field additional_payment_options: %w", err) - } - case "saved_order_info": - if err := p.SavedOrderInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field saved_order_info: %w", err) - } - case "saved_credentials": - if err := b.Arr(func(b tdjson.Decoder) error { - var value SavedCredentials - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field saved_credentials: %w", err) - } - p.SavedCredentials = append(p.SavedCredentials, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field saved_credentials: %w", err) - } - case "can_save_credentials": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field can_save_credentials: %w", err) - } - p.CanSaveCredentials = value - case "need_password": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeRegular#ba6d2f0f: field need_password: %w", err) - } - p.NeedPassword = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInvoice returns value of Invoice field. -func (p *PaymentFormTypeRegular) GetInvoice() (value Invoice) { - if p == nil { - return - } - return p.Invoice -} - -// GetPaymentProviderUserID returns value of PaymentProviderUserID field. -func (p *PaymentFormTypeRegular) GetPaymentProviderUserID() (value int64) { - if p == nil { - return - } - return p.PaymentProviderUserID -} - -// GetPaymentProvider returns value of PaymentProvider field. -func (p *PaymentFormTypeRegular) GetPaymentProvider() (value PaymentProviderClass) { - if p == nil { - return - } - return p.PaymentProvider -} - -// GetAdditionalPaymentOptions returns value of AdditionalPaymentOptions field. -func (p *PaymentFormTypeRegular) GetAdditionalPaymentOptions() (value []PaymentOption) { - if p == nil { - return - } - return p.AdditionalPaymentOptions -} - -// GetSavedOrderInfo returns value of SavedOrderInfo field. -func (p *PaymentFormTypeRegular) GetSavedOrderInfo() (value OrderInfo) { - if p == nil { - return - } - return p.SavedOrderInfo -} - -// GetSavedCredentials returns value of SavedCredentials field. -func (p *PaymentFormTypeRegular) GetSavedCredentials() (value []SavedCredentials) { - if p == nil { - return - } - return p.SavedCredentials -} - -// GetCanSaveCredentials returns value of CanSaveCredentials field. -func (p *PaymentFormTypeRegular) GetCanSaveCredentials() (value bool) { - if p == nil { - return - } - return p.CanSaveCredentials -} - -// GetNeedPassword returns value of NeedPassword field. -func (p *PaymentFormTypeRegular) GetNeedPassword() (value bool) { - if p == nil { - return - } - return p.NeedPassword -} - -// PaymentFormTypeStars represents TL type `paymentFormTypeStars#56b9d3d`. -type PaymentFormTypeStars struct { - // Number of Telegram Stars that will be paid - StarCount int64 -} - -// PaymentFormTypeStarsTypeID is TL type id of PaymentFormTypeStars. -const PaymentFormTypeStarsTypeID = 0x56b9d3d - -// construct implements constructor of PaymentFormTypeClass. -func (p PaymentFormTypeStars) construct() PaymentFormTypeClass { return &p } - -// Ensuring interfaces in compile-time for PaymentFormTypeStars. -var ( - _ bin.Encoder = &PaymentFormTypeStars{} - _ bin.Decoder = &PaymentFormTypeStars{} - _ bin.BareEncoder = &PaymentFormTypeStars{} - _ bin.BareDecoder = &PaymentFormTypeStars{} - - _ PaymentFormTypeClass = &PaymentFormTypeStars{} -) - -func (p *PaymentFormTypeStars) Zero() bool { - if p == nil { - return true - } - if !(p.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentFormTypeStars) String() string { - if p == nil { - return "PaymentFormTypeStars(nil)" - } - type Alias PaymentFormTypeStars - return fmt.Sprintf("PaymentFormTypeStars%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentFormTypeStars) TypeID() uint32 { - return PaymentFormTypeStarsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentFormTypeStars) TypeName() string { - return "paymentFormTypeStars" -} - -// TypeInfo returns info about TL type. -func (p *PaymentFormTypeStars) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentFormTypeStars", - ID: PaymentFormTypeStarsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentFormTypeStars) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentFormTypeStars#56b9d3d as nil") - } - b.PutID(PaymentFormTypeStarsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentFormTypeStars) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentFormTypeStars#56b9d3d as nil") - } - b.PutInt53(p.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentFormTypeStars) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentFormTypeStars#56b9d3d to nil") - } - if err := b.ConsumeID(PaymentFormTypeStarsTypeID); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeStars#56b9d3d: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentFormTypeStars) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentFormTypeStars#56b9d3d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeStars#56b9d3d: field star_count: %w", err) - } - p.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentFormTypeStars) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentFormTypeStars#56b9d3d as nil") - } - b.ObjStart() - b.PutID("paymentFormTypeStars") - b.Comma() - b.FieldStart("star_count") - b.PutInt53(p.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentFormTypeStars) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentFormTypeStars#56b9d3d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentFormTypeStars"); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeStars#56b9d3d: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentFormTypeStars#56b9d3d: field star_count: %w", err) - } - p.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarCount returns value of StarCount field. -func (p *PaymentFormTypeStars) GetStarCount() (value int64) { - if p == nil { - return - } - return p.StarCount -} - -// PaymentFormTypeStarSubscription represents TL type `paymentFormTypeStarSubscription#102deb5b`. -type PaymentFormTypeStarSubscription struct { - // Information about subscription plan - Pricing StarSubscriptionPricing -} - -// PaymentFormTypeStarSubscriptionTypeID is TL type id of PaymentFormTypeStarSubscription. -const PaymentFormTypeStarSubscriptionTypeID = 0x102deb5b - -// construct implements constructor of PaymentFormTypeClass. -func (p PaymentFormTypeStarSubscription) construct() PaymentFormTypeClass { return &p } - -// Ensuring interfaces in compile-time for PaymentFormTypeStarSubscription. -var ( - _ bin.Encoder = &PaymentFormTypeStarSubscription{} - _ bin.Decoder = &PaymentFormTypeStarSubscription{} - _ bin.BareEncoder = &PaymentFormTypeStarSubscription{} - _ bin.BareDecoder = &PaymentFormTypeStarSubscription{} - - _ PaymentFormTypeClass = &PaymentFormTypeStarSubscription{} -) - -func (p *PaymentFormTypeStarSubscription) Zero() bool { - if p == nil { - return true - } - if !(p.Pricing.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentFormTypeStarSubscription) String() string { - if p == nil { - return "PaymentFormTypeStarSubscription(nil)" - } - type Alias PaymentFormTypeStarSubscription - return fmt.Sprintf("PaymentFormTypeStarSubscription%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentFormTypeStarSubscription) TypeID() uint32 { - return PaymentFormTypeStarSubscriptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentFormTypeStarSubscription) TypeName() string { - return "paymentFormTypeStarSubscription" -} - -// TypeInfo returns info about TL type. -func (p *PaymentFormTypeStarSubscription) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentFormTypeStarSubscription", - ID: PaymentFormTypeStarSubscriptionTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Pricing", - SchemaName: "pricing", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentFormTypeStarSubscription) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentFormTypeStarSubscription#102deb5b as nil") - } - b.PutID(PaymentFormTypeStarSubscriptionTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentFormTypeStarSubscription) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentFormTypeStarSubscription#102deb5b as nil") - } - if err := p.Pricing.Encode(b); err != nil { - return fmt.Errorf("unable to encode paymentFormTypeStarSubscription#102deb5b: field pricing: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentFormTypeStarSubscription) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentFormTypeStarSubscription#102deb5b to nil") - } - if err := b.ConsumeID(PaymentFormTypeStarSubscriptionTypeID); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeStarSubscription#102deb5b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentFormTypeStarSubscription) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentFormTypeStarSubscription#102deb5b to nil") - } - { - if err := p.Pricing.Decode(b); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeStarSubscription#102deb5b: field pricing: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentFormTypeStarSubscription) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentFormTypeStarSubscription#102deb5b as nil") - } - b.ObjStart() - b.PutID("paymentFormTypeStarSubscription") - b.Comma() - b.FieldStart("pricing") - if err := p.Pricing.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentFormTypeStarSubscription#102deb5b: field pricing: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentFormTypeStarSubscription) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentFormTypeStarSubscription#102deb5b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentFormTypeStarSubscription"); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeStarSubscription#102deb5b: %w", err) - } - case "pricing": - if err := p.Pricing.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paymentFormTypeStarSubscription#102deb5b: field pricing: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPricing returns value of Pricing field. -func (p *PaymentFormTypeStarSubscription) GetPricing() (value StarSubscriptionPricing) { - if p == nil { - return - } - return p.Pricing -} - -// PaymentFormTypeClassName is schema name of PaymentFormTypeClass. -const PaymentFormTypeClassName = "PaymentFormType" - -// PaymentFormTypeClass represents PaymentFormType generic type. -// -// Example: -// -// g, err := tdapi.DecodePaymentFormType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PaymentFormTypeRegular: // paymentFormTypeRegular#ba6d2f0f -// case *tdapi.PaymentFormTypeStars: // paymentFormTypeStars#56b9d3d -// case *tdapi.PaymentFormTypeStarSubscription: // paymentFormTypeStarSubscription#102deb5b -// default: panic(v) -// } -type PaymentFormTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PaymentFormTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePaymentFormType implements binary de-serialization for PaymentFormTypeClass. -func DecodePaymentFormType(buf *bin.Buffer) (PaymentFormTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PaymentFormTypeRegularTypeID: - // Decoding paymentFormTypeRegular#ba6d2f0f. - v := PaymentFormTypeRegular{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentFormTypeClass: %w", err) - } - return &v, nil - case PaymentFormTypeStarsTypeID: - // Decoding paymentFormTypeStars#56b9d3d. - v := PaymentFormTypeStars{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentFormTypeClass: %w", err) - } - return &v, nil - case PaymentFormTypeStarSubscriptionTypeID: - // Decoding paymentFormTypeStarSubscription#102deb5b. - v := PaymentFormTypeStarSubscription{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentFormTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PaymentFormTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPaymentFormType implements binary de-serialization for PaymentFormTypeClass. -func DecodeTDLibJSONPaymentFormType(buf tdjson.Decoder) (PaymentFormTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "paymentFormTypeRegular": - // Decoding paymentFormTypeRegular#ba6d2f0f. - v := PaymentFormTypeRegular{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentFormTypeClass: %w", err) - } - return &v, nil - case "paymentFormTypeStars": - // Decoding paymentFormTypeStars#56b9d3d. - v := PaymentFormTypeStars{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentFormTypeClass: %w", err) - } - return &v, nil - case "paymentFormTypeStarSubscription": - // Decoding paymentFormTypeStarSubscription#102deb5b. - v := PaymentFormTypeStarSubscription{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentFormTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PaymentFormTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PaymentFormType boxes the PaymentFormTypeClass providing a helper. -type PaymentFormTypeBox struct { - PaymentFormType PaymentFormTypeClass -} - -// Decode implements bin.Decoder for PaymentFormTypeBox. -func (b *PaymentFormTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PaymentFormTypeBox to nil") - } - v, err := DecodePaymentFormType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PaymentFormType = v - return nil -} - -// Encode implements bin.Encode for PaymentFormTypeBox. -func (b *PaymentFormTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PaymentFormType == nil { - return fmt.Errorf("unable to encode PaymentFormTypeClass as nil") - } - return b.PaymentFormType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PaymentFormTypeBox. -func (b *PaymentFormTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PaymentFormTypeBox to nil") - } - v, err := DecodeTDLibJSONPaymentFormType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PaymentFormType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PaymentFormTypeBox. -func (b *PaymentFormTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PaymentFormType == nil { - return fmt.Errorf("unable to encode PaymentFormTypeClass as nil") - } - return b.PaymentFormType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_payment_option_gen.go b/tdapi/tl_payment_option_gen.go deleted file mode 100644 index 26b6ed994..000000000 --- a/tdapi/tl_payment_option_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PaymentOption represents TL type `paymentOption#ee79989b`. -type PaymentOption struct { - // Title for the payment option - Title string - // Payment form URL to be opened in a web view - URL string -} - -// PaymentOptionTypeID is TL type id of PaymentOption. -const PaymentOptionTypeID = 0xee79989b - -// Ensuring interfaces in compile-time for PaymentOption. -var ( - _ bin.Encoder = &PaymentOption{} - _ bin.Decoder = &PaymentOption{} - _ bin.BareEncoder = &PaymentOption{} - _ bin.BareDecoder = &PaymentOption{} -) - -func (p *PaymentOption) Zero() bool { - if p == nil { - return true - } - if !(p.Title == "") { - return false - } - if !(p.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentOption) String() string { - if p == nil { - return "PaymentOption(nil)" - } - type Alias PaymentOption - return fmt.Sprintf("PaymentOption%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentOption) TypeID() uint32 { - return PaymentOptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentOption) TypeName() string { - return "paymentOption" -} - -// TypeInfo returns info about TL type. -func (p *PaymentOption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentOption", - ID: PaymentOptionTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentOption) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentOption#ee79989b as nil") - } - b.PutID(PaymentOptionTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentOption) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentOption#ee79989b as nil") - } - b.PutString(p.Title) - b.PutString(p.URL) - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentOption) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentOption#ee79989b to nil") - } - if err := b.ConsumeID(PaymentOptionTypeID); err != nil { - return fmt.Errorf("unable to decode paymentOption#ee79989b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentOption) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentOption#ee79989b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentOption#ee79989b: field title: %w", err) - } - p.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentOption#ee79989b: field url: %w", err) - } - p.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentOption) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentOption#ee79989b as nil") - } - b.ObjStart() - b.PutID("paymentOption") - b.Comma() - b.FieldStart("title") - b.PutString(p.Title) - b.Comma() - b.FieldStart("url") - b.PutString(p.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentOption) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentOption#ee79989b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentOption"); err != nil { - return fmt.Errorf("unable to decode paymentOption#ee79989b: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentOption#ee79989b: field title: %w", err) - } - p.Title = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentOption#ee79989b: field url: %w", err) - } - p.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (p *PaymentOption) GetTitle() (value string) { - if p == nil { - return - } - return p.Title -} - -// GetURL returns value of URL field. -func (p *PaymentOption) GetURL() (value string) { - if p == nil { - return - } - return p.URL -} diff --git a/tdapi/tl_payment_provider_gen.go b/tdapi/tl_payment_provider_gen.go deleted file mode 100644 index 3b8b32137..000000000 --- a/tdapi/tl_payment_provider_gen.go +++ /dev/null @@ -1,818 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PaymentProviderSmartGlocal represents TL type `paymentProviderSmartGlocal#ba047774`. -type PaymentProviderSmartGlocal struct { - // Public payment token - PublicToken string - // URL for sending card tokenization requests - TokenizeURL string -} - -// PaymentProviderSmartGlocalTypeID is TL type id of PaymentProviderSmartGlocal. -const PaymentProviderSmartGlocalTypeID = 0xba047774 - -// construct implements constructor of PaymentProviderClass. -func (p PaymentProviderSmartGlocal) construct() PaymentProviderClass { return &p } - -// Ensuring interfaces in compile-time for PaymentProviderSmartGlocal. -var ( - _ bin.Encoder = &PaymentProviderSmartGlocal{} - _ bin.Decoder = &PaymentProviderSmartGlocal{} - _ bin.BareEncoder = &PaymentProviderSmartGlocal{} - _ bin.BareDecoder = &PaymentProviderSmartGlocal{} - - _ PaymentProviderClass = &PaymentProviderSmartGlocal{} -) - -func (p *PaymentProviderSmartGlocal) Zero() bool { - if p == nil { - return true - } - if !(p.PublicToken == "") { - return false - } - if !(p.TokenizeURL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentProviderSmartGlocal) String() string { - if p == nil { - return "PaymentProviderSmartGlocal(nil)" - } - type Alias PaymentProviderSmartGlocal - return fmt.Sprintf("PaymentProviderSmartGlocal%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentProviderSmartGlocal) TypeID() uint32 { - return PaymentProviderSmartGlocalTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentProviderSmartGlocal) TypeName() string { - return "paymentProviderSmartGlocal" -} - -// TypeInfo returns info about TL type. -func (p *PaymentProviderSmartGlocal) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentProviderSmartGlocal", - ID: PaymentProviderSmartGlocalTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PublicToken", - SchemaName: "public_token", - }, - { - Name: "TokenizeURL", - SchemaName: "tokenize_url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentProviderSmartGlocal) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentProviderSmartGlocal#ba047774 as nil") - } - b.PutID(PaymentProviderSmartGlocalTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentProviderSmartGlocal) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentProviderSmartGlocal#ba047774 as nil") - } - b.PutString(p.PublicToken) - b.PutString(p.TokenizeURL) - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentProviderSmartGlocal) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentProviderSmartGlocal#ba047774 to nil") - } - if err := b.ConsumeID(PaymentProviderSmartGlocalTypeID); err != nil { - return fmt.Errorf("unable to decode paymentProviderSmartGlocal#ba047774: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentProviderSmartGlocal) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentProviderSmartGlocal#ba047774 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderSmartGlocal#ba047774: field public_token: %w", err) - } - p.PublicToken = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderSmartGlocal#ba047774: field tokenize_url: %w", err) - } - p.TokenizeURL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentProviderSmartGlocal) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentProviderSmartGlocal#ba047774 as nil") - } - b.ObjStart() - b.PutID("paymentProviderSmartGlocal") - b.Comma() - b.FieldStart("public_token") - b.PutString(p.PublicToken) - b.Comma() - b.FieldStart("tokenize_url") - b.PutString(p.TokenizeURL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentProviderSmartGlocal) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentProviderSmartGlocal#ba047774 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentProviderSmartGlocal"); err != nil { - return fmt.Errorf("unable to decode paymentProviderSmartGlocal#ba047774: %w", err) - } - case "public_token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderSmartGlocal#ba047774: field public_token: %w", err) - } - p.PublicToken = value - case "tokenize_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderSmartGlocal#ba047774: field tokenize_url: %w", err) - } - p.TokenizeURL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPublicToken returns value of PublicToken field. -func (p *PaymentProviderSmartGlocal) GetPublicToken() (value string) { - if p == nil { - return - } - return p.PublicToken -} - -// GetTokenizeURL returns value of TokenizeURL field. -func (p *PaymentProviderSmartGlocal) GetTokenizeURL() (value string) { - if p == nil { - return - } - return p.TokenizeURL -} - -// PaymentProviderStripe represents TL type `paymentProviderStripe#1614e19b`. -type PaymentProviderStripe struct { - // Stripe API publishable key - PublishableKey string - // True, if the user country must be provided - NeedCountry bool - // True, if the user ZIP/postal code must be provided - NeedPostalCode bool - // True, if the cardholder name must be provided - NeedCardholderName bool -} - -// PaymentProviderStripeTypeID is TL type id of PaymentProviderStripe. -const PaymentProviderStripeTypeID = 0x1614e19b - -// construct implements constructor of PaymentProviderClass. -func (p PaymentProviderStripe) construct() PaymentProviderClass { return &p } - -// Ensuring interfaces in compile-time for PaymentProviderStripe. -var ( - _ bin.Encoder = &PaymentProviderStripe{} - _ bin.Decoder = &PaymentProviderStripe{} - _ bin.BareEncoder = &PaymentProviderStripe{} - _ bin.BareDecoder = &PaymentProviderStripe{} - - _ PaymentProviderClass = &PaymentProviderStripe{} -) - -func (p *PaymentProviderStripe) Zero() bool { - if p == nil { - return true - } - if !(p.PublishableKey == "") { - return false - } - if !(p.NeedCountry == false) { - return false - } - if !(p.NeedPostalCode == false) { - return false - } - if !(p.NeedCardholderName == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentProviderStripe) String() string { - if p == nil { - return "PaymentProviderStripe(nil)" - } - type Alias PaymentProviderStripe - return fmt.Sprintf("PaymentProviderStripe%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentProviderStripe) TypeID() uint32 { - return PaymentProviderStripeTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentProviderStripe) TypeName() string { - return "paymentProviderStripe" -} - -// TypeInfo returns info about TL type. -func (p *PaymentProviderStripe) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentProviderStripe", - ID: PaymentProviderStripeTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PublishableKey", - SchemaName: "publishable_key", - }, - { - Name: "NeedCountry", - SchemaName: "need_country", - }, - { - Name: "NeedPostalCode", - SchemaName: "need_postal_code", - }, - { - Name: "NeedCardholderName", - SchemaName: "need_cardholder_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentProviderStripe) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentProviderStripe#1614e19b as nil") - } - b.PutID(PaymentProviderStripeTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentProviderStripe) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentProviderStripe#1614e19b as nil") - } - b.PutString(p.PublishableKey) - b.PutBool(p.NeedCountry) - b.PutBool(p.NeedPostalCode) - b.PutBool(p.NeedCardholderName) - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentProviderStripe) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentProviderStripe#1614e19b to nil") - } - if err := b.ConsumeID(PaymentProviderStripeTypeID); err != nil { - return fmt.Errorf("unable to decode paymentProviderStripe#1614e19b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentProviderStripe) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentProviderStripe#1614e19b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderStripe#1614e19b: field publishable_key: %w", err) - } - p.PublishableKey = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderStripe#1614e19b: field need_country: %w", err) - } - p.NeedCountry = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderStripe#1614e19b: field need_postal_code: %w", err) - } - p.NeedPostalCode = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderStripe#1614e19b: field need_cardholder_name: %w", err) - } - p.NeedCardholderName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentProviderStripe) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentProviderStripe#1614e19b as nil") - } - b.ObjStart() - b.PutID("paymentProviderStripe") - b.Comma() - b.FieldStart("publishable_key") - b.PutString(p.PublishableKey) - b.Comma() - b.FieldStart("need_country") - b.PutBool(p.NeedCountry) - b.Comma() - b.FieldStart("need_postal_code") - b.PutBool(p.NeedPostalCode) - b.Comma() - b.FieldStart("need_cardholder_name") - b.PutBool(p.NeedCardholderName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentProviderStripe) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentProviderStripe#1614e19b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentProviderStripe"); err != nil { - return fmt.Errorf("unable to decode paymentProviderStripe#1614e19b: %w", err) - } - case "publishable_key": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderStripe#1614e19b: field publishable_key: %w", err) - } - p.PublishableKey = value - case "need_country": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderStripe#1614e19b: field need_country: %w", err) - } - p.NeedCountry = value - case "need_postal_code": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderStripe#1614e19b: field need_postal_code: %w", err) - } - p.NeedPostalCode = value - case "need_cardholder_name": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderStripe#1614e19b: field need_cardholder_name: %w", err) - } - p.NeedCardholderName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPublishableKey returns value of PublishableKey field. -func (p *PaymentProviderStripe) GetPublishableKey() (value string) { - if p == nil { - return - } - return p.PublishableKey -} - -// GetNeedCountry returns value of NeedCountry field. -func (p *PaymentProviderStripe) GetNeedCountry() (value bool) { - if p == nil { - return - } - return p.NeedCountry -} - -// GetNeedPostalCode returns value of NeedPostalCode field. -func (p *PaymentProviderStripe) GetNeedPostalCode() (value bool) { - if p == nil { - return - } - return p.NeedPostalCode -} - -// GetNeedCardholderName returns value of NeedCardholderName field. -func (p *PaymentProviderStripe) GetNeedCardholderName() (value bool) { - if p == nil { - return - } - return p.NeedCardholderName -} - -// PaymentProviderOther represents TL type `paymentProviderOther#b050e0e4`. -type PaymentProviderOther struct { - // Payment form URL - URL string -} - -// PaymentProviderOtherTypeID is TL type id of PaymentProviderOther. -const PaymentProviderOtherTypeID = 0xb050e0e4 - -// construct implements constructor of PaymentProviderClass. -func (p PaymentProviderOther) construct() PaymentProviderClass { return &p } - -// Ensuring interfaces in compile-time for PaymentProviderOther. -var ( - _ bin.Encoder = &PaymentProviderOther{} - _ bin.Decoder = &PaymentProviderOther{} - _ bin.BareEncoder = &PaymentProviderOther{} - _ bin.BareDecoder = &PaymentProviderOther{} - - _ PaymentProviderClass = &PaymentProviderOther{} -) - -func (p *PaymentProviderOther) Zero() bool { - if p == nil { - return true - } - if !(p.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentProviderOther) String() string { - if p == nil { - return "PaymentProviderOther(nil)" - } - type Alias PaymentProviderOther - return fmt.Sprintf("PaymentProviderOther%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentProviderOther) TypeID() uint32 { - return PaymentProviderOtherTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentProviderOther) TypeName() string { - return "paymentProviderOther" -} - -// TypeInfo returns info about TL type. -func (p *PaymentProviderOther) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentProviderOther", - ID: PaymentProviderOtherTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentProviderOther) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentProviderOther#b050e0e4 as nil") - } - b.PutID(PaymentProviderOtherTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentProviderOther) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentProviderOther#b050e0e4 as nil") - } - b.PutString(p.URL) - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentProviderOther) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentProviderOther#b050e0e4 to nil") - } - if err := b.ConsumeID(PaymentProviderOtherTypeID); err != nil { - return fmt.Errorf("unable to decode paymentProviderOther#b050e0e4: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentProviderOther) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentProviderOther#b050e0e4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderOther#b050e0e4: field url: %w", err) - } - p.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentProviderOther) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentProviderOther#b050e0e4 as nil") - } - b.ObjStart() - b.PutID("paymentProviderOther") - b.Comma() - b.FieldStart("url") - b.PutString(p.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentProviderOther) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentProviderOther#b050e0e4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentProviderOther"); err != nil { - return fmt.Errorf("unable to decode paymentProviderOther#b050e0e4: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentProviderOther#b050e0e4: field url: %w", err) - } - p.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (p *PaymentProviderOther) GetURL() (value string) { - if p == nil { - return - } - return p.URL -} - -// PaymentProviderClassName is schema name of PaymentProviderClass. -const PaymentProviderClassName = "PaymentProvider" - -// PaymentProviderClass represents PaymentProvider generic type. -// -// Example: -// -// g, err := tdapi.DecodePaymentProvider(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PaymentProviderSmartGlocal: // paymentProviderSmartGlocal#ba047774 -// case *tdapi.PaymentProviderStripe: // paymentProviderStripe#1614e19b -// case *tdapi.PaymentProviderOther: // paymentProviderOther#b050e0e4 -// default: panic(v) -// } -type PaymentProviderClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PaymentProviderClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePaymentProvider implements binary de-serialization for PaymentProviderClass. -func DecodePaymentProvider(buf *bin.Buffer) (PaymentProviderClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PaymentProviderSmartGlocalTypeID: - // Decoding paymentProviderSmartGlocal#ba047774. - v := PaymentProviderSmartGlocal{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentProviderClass: %w", err) - } - return &v, nil - case PaymentProviderStripeTypeID: - // Decoding paymentProviderStripe#1614e19b. - v := PaymentProviderStripe{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentProviderClass: %w", err) - } - return &v, nil - case PaymentProviderOtherTypeID: - // Decoding paymentProviderOther#b050e0e4. - v := PaymentProviderOther{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentProviderClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PaymentProviderClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPaymentProvider implements binary de-serialization for PaymentProviderClass. -func DecodeTDLibJSONPaymentProvider(buf tdjson.Decoder) (PaymentProviderClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "paymentProviderSmartGlocal": - // Decoding paymentProviderSmartGlocal#ba047774. - v := PaymentProviderSmartGlocal{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentProviderClass: %w", err) - } - return &v, nil - case "paymentProviderStripe": - // Decoding paymentProviderStripe#1614e19b. - v := PaymentProviderStripe{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentProviderClass: %w", err) - } - return &v, nil - case "paymentProviderOther": - // Decoding paymentProviderOther#b050e0e4. - v := PaymentProviderOther{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentProviderClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PaymentProviderClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PaymentProvider boxes the PaymentProviderClass providing a helper. -type PaymentProviderBox struct { - PaymentProvider PaymentProviderClass -} - -// Decode implements bin.Decoder for PaymentProviderBox. -func (b *PaymentProviderBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PaymentProviderBox to nil") - } - v, err := DecodePaymentProvider(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PaymentProvider = v - return nil -} - -// Encode implements bin.Encode for PaymentProviderBox. -func (b *PaymentProviderBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PaymentProvider == nil { - return fmt.Errorf("unable to encode PaymentProviderClass as nil") - } - return b.PaymentProvider.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PaymentProviderBox. -func (b *PaymentProviderBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PaymentProviderBox to nil") - } - v, err := DecodeTDLibJSONPaymentProvider(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PaymentProvider = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PaymentProviderBox. -func (b *PaymentProviderBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PaymentProvider == nil { - return fmt.Errorf("unable to encode PaymentProviderClass as nil") - } - return b.PaymentProvider.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_payment_receipt_gen.go b/tdapi/tl_payment_receipt_gen.go deleted file mode 100644 index 801b7912a..000000000 --- a/tdapi/tl_payment_receipt_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PaymentReceipt represents TL type `paymentReceipt#2d313392`. -type PaymentReceipt struct { - // Information about the product - ProductInfo ProductInfo - // Point in time (Unix timestamp) when the payment was made - Date int32 - // User identifier of the seller bot - SellerBotUserID int64 - // Type of the payment receipt - Type PaymentReceiptTypeClass -} - -// PaymentReceiptTypeID is TL type id of PaymentReceipt. -const PaymentReceiptTypeID = 0x2d313392 - -// Ensuring interfaces in compile-time for PaymentReceipt. -var ( - _ bin.Encoder = &PaymentReceipt{} - _ bin.Decoder = &PaymentReceipt{} - _ bin.BareEncoder = &PaymentReceipt{} - _ bin.BareDecoder = &PaymentReceipt{} -) - -func (p *PaymentReceipt) Zero() bool { - if p == nil { - return true - } - if !(p.ProductInfo.Zero()) { - return false - } - if !(p.Date == 0) { - return false - } - if !(p.SellerBotUserID == 0) { - return false - } - if !(p.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentReceipt) String() string { - if p == nil { - return "PaymentReceipt(nil)" - } - type Alias PaymentReceipt - return fmt.Sprintf("PaymentReceipt%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentReceipt) TypeID() uint32 { - return PaymentReceiptTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentReceipt) TypeName() string { - return "paymentReceipt" -} - -// TypeInfo returns info about TL type. -func (p *PaymentReceipt) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentReceipt", - ID: PaymentReceiptTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ProductInfo", - SchemaName: "product_info", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "SellerBotUserID", - SchemaName: "seller_bot_user_id", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentReceipt) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentReceipt#2d313392 as nil") - } - b.PutID(PaymentReceiptTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentReceipt) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentReceipt#2d313392 as nil") - } - if err := p.ProductInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode paymentReceipt#2d313392: field product_info: %w", err) - } - b.PutInt32(p.Date) - b.PutInt53(p.SellerBotUserID) - if p.Type == nil { - return fmt.Errorf("unable to encode paymentReceipt#2d313392: field type is nil") - } - if err := p.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode paymentReceipt#2d313392: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentReceipt) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentReceipt#2d313392 to nil") - } - if err := b.ConsumeID(PaymentReceiptTypeID); err != nil { - return fmt.Errorf("unable to decode paymentReceipt#2d313392: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentReceipt) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentReceipt#2d313392 to nil") - } - { - if err := p.ProductInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode paymentReceipt#2d313392: field product_info: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode paymentReceipt#2d313392: field date: %w", err) - } - p.Date = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentReceipt#2d313392: field seller_bot_user_id: %w", err) - } - p.SellerBotUserID = value - } - { - value, err := DecodePaymentReceiptType(b) - if err != nil { - return fmt.Errorf("unable to decode paymentReceipt#2d313392: field type: %w", err) - } - p.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentReceipt) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentReceipt#2d313392 as nil") - } - b.ObjStart() - b.PutID("paymentReceipt") - b.Comma() - b.FieldStart("product_info") - if err := p.ProductInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentReceipt#2d313392: field product_info: %w", err) - } - b.Comma() - b.FieldStart("date") - b.PutInt32(p.Date) - b.Comma() - b.FieldStart("seller_bot_user_id") - b.PutInt53(p.SellerBotUserID) - b.Comma() - b.FieldStart("type") - if p.Type == nil { - return fmt.Errorf("unable to encode paymentReceipt#2d313392: field type is nil") - } - if err := p.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentReceipt#2d313392: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentReceipt) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentReceipt#2d313392 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentReceipt"); err != nil { - return fmt.Errorf("unable to decode paymentReceipt#2d313392: %w", err) - } - case "product_info": - if err := p.ProductInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paymentReceipt#2d313392: field product_info: %w", err) - } - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode paymentReceipt#2d313392: field date: %w", err) - } - p.Date = value - case "seller_bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentReceipt#2d313392: field seller_bot_user_id: %w", err) - } - p.SellerBotUserID = value - case "type": - value, err := DecodeTDLibJSONPaymentReceiptType(b) - if err != nil { - return fmt.Errorf("unable to decode paymentReceipt#2d313392: field type: %w", err) - } - p.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProductInfo returns value of ProductInfo field. -func (p *PaymentReceipt) GetProductInfo() (value ProductInfo) { - if p == nil { - return - } - return p.ProductInfo -} - -// GetDate returns value of Date field. -func (p *PaymentReceipt) GetDate() (value int32) { - if p == nil { - return - } - return p.Date -} - -// GetSellerBotUserID returns value of SellerBotUserID field. -func (p *PaymentReceipt) GetSellerBotUserID() (value int64) { - if p == nil { - return - } - return p.SellerBotUserID -} - -// GetType returns value of Type field. -func (p *PaymentReceipt) GetType() (value PaymentReceiptTypeClass) { - if p == nil { - return - } - return p.Type -} diff --git a/tdapi/tl_payment_receipt_type_gen.go b/tdapi/tl_payment_receipt_type_gen.go deleted file mode 100644 index 08e418ead..000000000 --- a/tdapi/tl_payment_receipt_type_gen.go +++ /dev/null @@ -1,705 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PaymentReceiptTypeRegular represents TL type `paymentReceiptTypeRegular#9e7715b6`. -type PaymentReceiptTypeRegular struct { - // User identifier of the payment provider bot - PaymentProviderUserID int64 - // Information about the invoice - Invoice Invoice - // Order information; may be null - OrderInfo OrderInfo - // Chosen shipping option; may be null - ShippingOption ShippingOption - // Title of the saved credentials chosen by the buyer - CredentialsTitle string - // The amount of tip chosen by the buyer in the smallest units of the currency - TipAmount int64 -} - -// PaymentReceiptTypeRegularTypeID is TL type id of PaymentReceiptTypeRegular. -const PaymentReceiptTypeRegularTypeID = 0x9e7715b6 - -// construct implements constructor of PaymentReceiptTypeClass. -func (p PaymentReceiptTypeRegular) construct() PaymentReceiptTypeClass { return &p } - -// Ensuring interfaces in compile-time for PaymentReceiptTypeRegular. -var ( - _ bin.Encoder = &PaymentReceiptTypeRegular{} - _ bin.Decoder = &PaymentReceiptTypeRegular{} - _ bin.BareEncoder = &PaymentReceiptTypeRegular{} - _ bin.BareDecoder = &PaymentReceiptTypeRegular{} - - _ PaymentReceiptTypeClass = &PaymentReceiptTypeRegular{} -) - -func (p *PaymentReceiptTypeRegular) Zero() bool { - if p == nil { - return true - } - if !(p.PaymentProviderUserID == 0) { - return false - } - if !(p.Invoice.Zero()) { - return false - } - if !(p.OrderInfo.Zero()) { - return false - } - if !(p.ShippingOption.Zero()) { - return false - } - if !(p.CredentialsTitle == "") { - return false - } - if !(p.TipAmount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentReceiptTypeRegular) String() string { - if p == nil { - return "PaymentReceiptTypeRegular(nil)" - } - type Alias PaymentReceiptTypeRegular - return fmt.Sprintf("PaymentReceiptTypeRegular%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentReceiptTypeRegular) TypeID() uint32 { - return PaymentReceiptTypeRegularTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentReceiptTypeRegular) TypeName() string { - return "paymentReceiptTypeRegular" -} - -// TypeInfo returns info about TL type. -func (p *PaymentReceiptTypeRegular) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentReceiptTypeRegular", - ID: PaymentReceiptTypeRegularTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PaymentProviderUserID", - SchemaName: "payment_provider_user_id", - }, - { - Name: "Invoice", - SchemaName: "invoice", - }, - { - Name: "OrderInfo", - SchemaName: "order_info", - }, - { - Name: "ShippingOption", - SchemaName: "shipping_option", - }, - { - Name: "CredentialsTitle", - SchemaName: "credentials_title", - }, - { - Name: "TipAmount", - SchemaName: "tip_amount", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentReceiptTypeRegular) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentReceiptTypeRegular#9e7715b6 as nil") - } - b.PutID(PaymentReceiptTypeRegularTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentReceiptTypeRegular) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentReceiptTypeRegular#9e7715b6 as nil") - } - b.PutInt53(p.PaymentProviderUserID) - if err := p.Invoice.Encode(b); err != nil { - return fmt.Errorf("unable to encode paymentReceiptTypeRegular#9e7715b6: field invoice: %w", err) - } - if err := p.OrderInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode paymentReceiptTypeRegular#9e7715b6: field order_info: %w", err) - } - if err := p.ShippingOption.Encode(b); err != nil { - return fmt.Errorf("unable to encode paymentReceiptTypeRegular#9e7715b6: field shipping_option: %w", err) - } - b.PutString(p.CredentialsTitle) - b.PutInt53(p.TipAmount) - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentReceiptTypeRegular) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentReceiptTypeRegular#9e7715b6 to nil") - } - if err := b.ConsumeID(PaymentReceiptTypeRegularTypeID); err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentReceiptTypeRegular) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentReceiptTypeRegular#9e7715b6 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field payment_provider_user_id: %w", err) - } - p.PaymentProviderUserID = value - } - { - if err := p.Invoice.Decode(b); err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field invoice: %w", err) - } - } - { - if err := p.OrderInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field order_info: %w", err) - } - } - { - if err := p.ShippingOption.Decode(b); err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field shipping_option: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field credentials_title: %w", err) - } - p.CredentialsTitle = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field tip_amount: %w", err) - } - p.TipAmount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentReceiptTypeRegular) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentReceiptTypeRegular#9e7715b6 as nil") - } - b.ObjStart() - b.PutID("paymentReceiptTypeRegular") - b.Comma() - b.FieldStart("payment_provider_user_id") - b.PutInt53(p.PaymentProviderUserID) - b.Comma() - b.FieldStart("invoice") - if err := p.Invoice.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentReceiptTypeRegular#9e7715b6: field invoice: %w", err) - } - b.Comma() - b.FieldStart("order_info") - if err := p.OrderInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentReceiptTypeRegular#9e7715b6: field order_info: %w", err) - } - b.Comma() - b.FieldStart("shipping_option") - if err := p.ShippingOption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode paymentReceiptTypeRegular#9e7715b6: field shipping_option: %w", err) - } - b.Comma() - b.FieldStart("credentials_title") - b.PutString(p.CredentialsTitle) - b.Comma() - b.FieldStart("tip_amount") - b.PutInt53(p.TipAmount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentReceiptTypeRegular) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentReceiptTypeRegular#9e7715b6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentReceiptTypeRegular"); err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: %w", err) - } - case "payment_provider_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field payment_provider_user_id: %w", err) - } - p.PaymentProviderUserID = value - case "invoice": - if err := p.Invoice.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field invoice: %w", err) - } - case "order_info": - if err := p.OrderInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field order_info: %w", err) - } - case "shipping_option": - if err := p.ShippingOption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field shipping_option: %w", err) - } - case "credentials_title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field credentials_title: %w", err) - } - p.CredentialsTitle = value - case "tip_amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeRegular#9e7715b6: field tip_amount: %w", err) - } - p.TipAmount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPaymentProviderUserID returns value of PaymentProviderUserID field. -func (p *PaymentReceiptTypeRegular) GetPaymentProviderUserID() (value int64) { - if p == nil { - return - } - return p.PaymentProviderUserID -} - -// GetInvoice returns value of Invoice field. -func (p *PaymentReceiptTypeRegular) GetInvoice() (value Invoice) { - if p == nil { - return - } - return p.Invoice -} - -// GetOrderInfo returns value of OrderInfo field. -func (p *PaymentReceiptTypeRegular) GetOrderInfo() (value OrderInfo) { - if p == nil { - return - } - return p.OrderInfo -} - -// GetShippingOption returns value of ShippingOption field. -func (p *PaymentReceiptTypeRegular) GetShippingOption() (value ShippingOption) { - if p == nil { - return - } - return p.ShippingOption -} - -// GetCredentialsTitle returns value of CredentialsTitle field. -func (p *PaymentReceiptTypeRegular) GetCredentialsTitle() (value string) { - if p == nil { - return - } - return p.CredentialsTitle -} - -// GetTipAmount returns value of TipAmount field. -func (p *PaymentReceiptTypeRegular) GetTipAmount() (value int64) { - if p == nil { - return - } - return p.TipAmount -} - -// PaymentReceiptTypeStars represents TL type `paymentReceiptTypeStars#1194074c`. -type PaymentReceiptTypeStars struct { - // Number of Telegram Stars that were paid - StarCount int64 - // Unique identifier of the transaction that can be used to dispute it - TransactionID string -} - -// PaymentReceiptTypeStarsTypeID is TL type id of PaymentReceiptTypeStars. -const PaymentReceiptTypeStarsTypeID = 0x1194074c - -// construct implements constructor of PaymentReceiptTypeClass. -func (p PaymentReceiptTypeStars) construct() PaymentReceiptTypeClass { return &p } - -// Ensuring interfaces in compile-time for PaymentReceiptTypeStars. -var ( - _ bin.Encoder = &PaymentReceiptTypeStars{} - _ bin.Decoder = &PaymentReceiptTypeStars{} - _ bin.BareEncoder = &PaymentReceiptTypeStars{} - _ bin.BareDecoder = &PaymentReceiptTypeStars{} - - _ PaymentReceiptTypeClass = &PaymentReceiptTypeStars{} -) - -func (p *PaymentReceiptTypeStars) Zero() bool { - if p == nil { - return true - } - if !(p.StarCount == 0) { - return false - } - if !(p.TransactionID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentReceiptTypeStars) String() string { - if p == nil { - return "PaymentReceiptTypeStars(nil)" - } - type Alias PaymentReceiptTypeStars - return fmt.Sprintf("PaymentReceiptTypeStars%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentReceiptTypeStars) TypeID() uint32 { - return PaymentReceiptTypeStarsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentReceiptTypeStars) TypeName() string { - return "paymentReceiptTypeStars" -} - -// TypeInfo returns info about TL type. -func (p *PaymentReceiptTypeStars) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentReceiptTypeStars", - ID: PaymentReceiptTypeStarsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "TransactionID", - SchemaName: "transaction_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentReceiptTypeStars) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentReceiptTypeStars#1194074c as nil") - } - b.PutID(PaymentReceiptTypeStarsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentReceiptTypeStars) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentReceiptTypeStars#1194074c as nil") - } - b.PutInt53(p.StarCount) - b.PutString(p.TransactionID) - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentReceiptTypeStars) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentReceiptTypeStars#1194074c to nil") - } - if err := b.ConsumeID(PaymentReceiptTypeStarsTypeID); err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeStars#1194074c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentReceiptTypeStars) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentReceiptTypeStars#1194074c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeStars#1194074c: field star_count: %w", err) - } - p.StarCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeStars#1194074c: field transaction_id: %w", err) - } - p.TransactionID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentReceiptTypeStars) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentReceiptTypeStars#1194074c as nil") - } - b.ObjStart() - b.PutID("paymentReceiptTypeStars") - b.Comma() - b.FieldStart("star_count") - b.PutInt53(p.StarCount) - b.Comma() - b.FieldStart("transaction_id") - b.PutString(p.TransactionID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentReceiptTypeStars) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentReceiptTypeStars#1194074c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentReceiptTypeStars"); err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeStars#1194074c: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeStars#1194074c: field star_count: %w", err) - } - p.StarCount = value - case "transaction_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentReceiptTypeStars#1194074c: field transaction_id: %w", err) - } - p.TransactionID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarCount returns value of StarCount field. -func (p *PaymentReceiptTypeStars) GetStarCount() (value int64) { - if p == nil { - return - } - return p.StarCount -} - -// GetTransactionID returns value of TransactionID field. -func (p *PaymentReceiptTypeStars) GetTransactionID() (value string) { - if p == nil { - return - } - return p.TransactionID -} - -// PaymentReceiptTypeClassName is schema name of PaymentReceiptTypeClass. -const PaymentReceiptTypeClassName = "PaymentReceiptType" - -// PaymentReceiptTypeClass represents PaymentReceiptType generic type. -// -// Example: -// -// g, err := tdapi.DecodePaymentReceiptType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PaymentReceiptTypeRegular: // paymentReceiptTypeRegular#9e7715b6 -// case *tdapi.PaymentReceiptTypeStars: // paymentReceiptTypeStars#1194074c -// default: panic(v) -// } -type PaymentReceiptTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PaymentReceiptTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePaymentReceiptType implements binary de-serialization for PaymentReceiptTypeClass. -func DecodePaymentReceiptType(buf *bin.Buffer) (PaymentReceiptTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PaymentReceiptTypeRegularTypeID: - // Decoding paymentReceiptTypeRegular#9e7715b6. - v := PaymentReceiptTypeRegular{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentReceiptTypeClass: %w", err) - } - return &v, nil - case PaymentReceiptTypeStarsTypeID: - // Decoding paymentReceiptTypeStars#1194074c. - v := PaymentReceiptTypeStars{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentReceiptTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PaymentReceiptTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPaymentReceiptType implements binary de-serialization for PaymentReceiptTypeClass. -func DecodeTDLibJSONPaymentReceiptType(buf tdjson.Decoder) (PaymentReceiptTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "paymentReceiptTypeRegular": - // Decoding paymentReceiptTypeRegular#9e7715b6. - v := PaymentReceiptTypeRegular{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentReceiptTypeClass: %w", err) - } - return &v, nil - case "paymentReceiptTypeStars": - // Decoding paymentReceiptTypeStars#1194074c. - v := PaymentReceiptTypeStars{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PaymentReceiptTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PaymentReceiptTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PaymentReceiptType boxes the PaymentReceiptTypeClass providing a helper. -type PaymentReceiptTypeBox struct { - PaymentReceiptType PaymentReceiptTypeClass -} - -// Decode implements bin.Decoder for PaymentReceiptTypeBox. -func (b *PaymentReceiptTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PaymentReceiptTypeBox to nil") - } - v, err := DecodePaymentReceiptType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PaymentReceiptType = v - return nil -} - -// Encode implements bin.Encode for PaymentReceiptTypeBox. -func (b *PaymentReceiptTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PaymentReceiptType == nil { - return fmt.Errorf("unable to encode PaymentReceiptTypeClass as nil") - } - return b.PaymentReceiptType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PaymentReceiptTypeBox. -func (b *PaymentReceiptTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PaymentReceiptTypeBox to nil") - } - v, err := DecodeTDLibJSONPaymentReceiptType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PaymentReceiptType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PaymentReceiptTypeBox. -func (b *PaymentReceiptTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PaymentReceiptType == nil { - return fmt.Errorf("unable to encode PaymentReceiptTypeClass as nil") - } - return b.PaymentReceiptType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_payment_result_gen.go b/tdapi/tl_payment_result_gen.go deleted file mode 100644 index ad60ee12c..000000000 --- a/tdapi/tl_payment_result_gen.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PaymentResult represents TL type `paymentResult#d00fe85d`. -type PaymentResult struct { - // True, if the payment request was successful; otherwise, the verification_url will be - // non-empty - Success bool - // URL for additional payment credentials verification - VerificationURL string -} - -// PaymentResultTypeID is TL type id of PaymentResult. -const PaymentResultTypeID = 0xd00fe85d - -// Ensuring interfaces in compile-time for PaymentResult. -var ( - _ bin.Encoder = &PaymentResult{} - _ bin.Decoder = &PaymentResult{} - _ bin.BareEncoder = &PaymentResult{} - _ bin.BareDecoder = &PaymentResult{} -) - -func (p *PaymentResult) Zero() bool { - if p == nil { - return true - } - if !(p.Success == false) { - return false - } - if !(p.VerificationURL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PaymentResult) String() string { - if p == nil { - return "PaymentResult(nil)" - } - type Alias PaymentResult - return fmt.Sprintf("PaymentResult%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PaymentResult) TypeID() uint32 { - return PaymentResultTypeID -} - -// TypeName returns name of type in TL schema. -func (*PaymentResult) TypeName() string { - return "paymentResult" -} - -// TypeInfo returns info about TL type. -func (p *PaymentResult) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "paymentResult", - ID: PaymentResultTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Success", - SchemaName: "success", - }, - { - Name: "VerificationURL", - SchemaName: "verification_url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PaymentResult) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentResult#d00fe85d as nil") - } - b.PutID(PaymentResultTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PaymentResult) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode paymentResult#d00fe85d as nil") - } - b.PutBool(p.Success) - b.PutString(p.VerificationURL) - return nil -} - -// Decode implements bin.Decoder. -func (p *PaymentResult) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentResult#d00fe85d to nil") - } - if err := b.ConsumeID(PaymentResultTypeID); err != nil { - return fmt.Errorf("unable to decode paymentResult#d00fe85d: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PaymentResult) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode paymentResult#d00fe85d to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentResult#d00fe85d: field success: %w", err) - } - p.Success = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentResult#d00fe85d: field verification_url: %w", err) - } - p.VerificationURL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PaymentResult) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode paymentResult#d00fe85d as nil") - } - b.ObjStart() - b.PutID("paymentResult") - b.Comma() - b.FieldStart("success") - b.PutBool(p.Success) - b.Comma() - b.FieldStart("verification_url") - b.PutString(p.VerificationURL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PaymentResult) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode paymentResult#d00fe85d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("paymentResult"); err != nil { - return fmt.Errorf("unable to decode paymentResult#d00fe85d: %w", err) - } - case "success": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode paymentResult#d00fe85d: field success: %w", err) - } - p.Success = value - case "verification_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode paymentResult#d00fe85d: field verification_url: %w", err) - } - p.VerificationURL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSuccess returns value of Success field. -func (p *PaymentResult) GetSuccess() (value bool) { - if p == nil { - return - } - return p.Success -} - -// GetVerificationURL returns value of VerificationURL field. -func (p *PaymentResult) GetVerificationURL() (value string) { - if p == nil { - return - } - return p.VerificationURL -} diff --git a/tdapi/tl_personal_details_gen.go b/tdapi/tl_personal_details_gen.go deleted file mode 100644 index 84d288646..000000000 --- a/tdapi/tl_personal_details_gen.go +++ /dev/null @@ -1,499 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PersonalDetails represents TL type `personalDetails#c0b869b7`. -type PersonalDetails struct { - // First name of the user written in English; 1-255 characters - FirstName string - // Middle name of the user written in English; 0-255 characters - MiddleName string - // Last name of the user written in English; 1-255 characters - LastName string - // Native first name of the user; 1-255 characters - NativeFirstName string - // Native middle name of the user; 0-255 characters - NativeMiddleName string - // Native last name of the user; 1-255 characters - NativeLastName string - // Birthdate of the user - Birthdate Date - // Gender of the user, "male" or "female" - Gender string - // A two-letter ISO 3166-1 alpha-2 country code of the user's country - CountryCode string - // A two-letter ISO 3166-1 alpha-2 country code of the user's residence country - ResidenceCountryCode string -} - -// PersonalDetailsTypeID is TL type id of PersonalDetails. -const PersonalDetailsTypeID = 0xc0b869b7 - -// Ensuring interfaces in compile-time for PersonalDetails. -var ( - _ bin.Encoder = &PersonalDetails{} - _ bin.Decoder = &PersonalDetails{} - _ bin.BareEncoder = &PersonalDetails{} - _ bin.BareDecoder = &PersonalDetails{} -) - -func (p *PersonalDetails) Zero() bool { - if p == nil { - return true - } - if !(p.FirstName == "") { - return false - } - if !(p.MiddleName == "") { - return false - } - if !(p.LastName == "") { - return false - } - if !(p.NativeFirstName == "") { - return false - } - if !(p.NativeMiddleName == "") { - return false - } - if !(p.NativeLastName == "") { - return false - } - if !(p.Birthdate.Zero()) { - return false - } - if !(p.Gender == "") { - return false - } - if !(p.CountryCode == "") { - return false - } - if !(p.ResidenceCountryCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PersonalDetails) String() string { - if p == nil { - return "PersonalDetails(nil)" - } - type Alias PersonalDetails - return fmt.Sprintf("PersonalDetails%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PersonalDetails) TypeID() uint32 { - return PersonalDetailsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PersonalDetails) TypeName() string { - return "personalDetails" -} - -// TypeInfo returns info about TL type. -func (p *PersonalDetails) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "personalDetails", - ID: PersonalDetailsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FirstName", - SchemaName: "first_name", - }, - { - Name: "MiddleName", - SchemaName: "middle_name", - }, - { - Name: "LastName", - SchemaName: "last_name", - }, - { - Name: "NativeFirstName", - SchemaName: "native_first_name", - }, - { - Name: "NativeMiddleName", - SchemaName: "native_middle_name", - }, - { - Name: "NativeLastName", - SchemaName: "native_last_name", - }, - { - Name: "Birthdate", - SchemaName: "birthdate", - }, - { - Name: "Gender", - SchemaName: "gender", - }, - { - Name: "CountryCode", - SchemaName: "country_code", - }, - { - Name: "ResidenceCountryCode", - SchemaName: "residence_country_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PersonalDetails) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode personalDetails#c0b869b7 as nil") - } - b.PutID(PersonalDetailsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PersonalDetails) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode personalDetails#c0b869b7 as nil") - } - b.PutString(p.FirstName) - b.PutString(p.MiddleName) - b.PutString(p.LastName) - b.PutString(p.NativeFirstName) - b.PutString(p.NativeMiddleName) - b.PutString(p.NativeLastName) - if err := p.Birthdate.Encode(b); err != nil { - return fmt.Errorf("unable to encode personalDetails#c0b869b7: field birthdate: %w", err) - } - b.PutString(p.Gender) - b.PutString(p.CountryCode) - b.PutString(p.ResidenceCountryCode) - return nil -} - -// Decode implements bin.Decoder. -func (p *PersonalDetails) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode personalDetails#c0b869b7 to nil") - } - if err := b.ConsumeID(PersonalDetailsTypeID); err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PersonalDetails) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode personalDetails#c0b869b7 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field first_name: %w", err) - } - p.FirstName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field middle_name: %w", err) - } - p.MiddleName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field last_name: %w", err) - } - p.LastName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field native_first_name: %w", err) - } - p.NativeFirstName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field native_middle_name: %w", err) - } - p.NativeMiddleName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field native_last_name: %w", err) - } - p.NativeLastName = value - } - { - if err := p.Birthdate.Decode(b); err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field birthdate: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field gender: %w", err) - } - p.Gender = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field country_code: %w", err) - } - p.CountryCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field residence_country_code: %w", err) - } - p.ResidenceCountryCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PersonalDetails) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode personalDetails#c0b869b7 as nil") - } - b.ObjStart() - b.PutID("personalDetails") - b.Comma() - b.FieldStart("first_name") - b.PutString(p.FirstName) - b.Comma() - b.FieldStart("middle_name") - b.PutString(p.MiddleName) - b.Comma() - b.FieldStart("last_name") - b.PutString(p.LastName) - b.Comma() - b.FieldStart("native_first_name") - b.PutString(p.NativeFirstName) - b.Comma() - b.FieldStart("native_middle_name") - b.PutString(p.NativeMiddleName) - b.Comma() - b.FieldStart("native_last_name") - b.PutString(p.NativeLastName) - b.Comma() - b.FieldStart("birthdate") - if err := p.Birthdate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode personalDetails#c0b869b7: field birthdate: %w", err) - } - b.Comma() - b.FieldStart("gender") - b.PutString(p.Gender) - b.Comma() - b.FieldStart("country_code") - b.PutString(p.CountryCode) - b.Comma() - b.FieldStart("residence_country_code") - b.PutString(p.ResidenceCountryCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PersonalDetails) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode personalDetails#c0b869b7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("personalDetails"); err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: %w", err) - } - case "first_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field first_name: %w", err) - } - p.FirstName = value - case "middle_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field middle_name: %w", err) - } - p.MiddleName = value - case "last_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field last_name: %w", err) - } - p.LastName = value - case "native_first_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field native_first_name: %w", err) - } - p.NativeFirstName = value - case "native_middle_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field native_middle_name: %w", err) - } - p.NativeMiddleName = value - case "native_last_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field native_last_name: %w", err) - } - p.NativeLastName = value - case "birthdate": - if err := p.Birthdate.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field birthdate: %w", err) - } - case "gender": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field gender: %w", err) - } - p.Gender = value - case "country_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field country_code: %w", err) - } - p.CountryCode = value - case "residence_country_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode personalDetails#c0b869b7: field residence_country_code: %w", err) - } - p.ResidenceCountryCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFirstName returns value of FirstName field. -func (p *PersonalDetails) GetFirstName() (value string) { - if p == nil { - return - } - return p.FirstName -} - -// GetMiddleName returns value of MiddleName field. -func (p *PersonalDetails) GetMiddleName() (value string) { - if p == nil { - return - } - return p.MiddleName -} - -// GetLastName returns value of LastName field. -func (p *PersonalDetails) GetLastName() (value string) { - if p == nil { - return - } - return p.LastName -} - -// GetNativeFirstName returns value of NativeFirstName field. -func (p *PersonalDetails) GetNativeFirstName() (value string) { - if p == nil { - return - } - return p.NativeFirstName -} - -// GetNativeMiddleName returns value of NativeMiddleName field. -func (p *PersonalDetails) GetNativeMiddleName() (value string) { - if p == nil { - return - } - return p.NativeMiddleName -} - -// GetNativeLastName returns value of NativeLastName field. -func (p *PersonalDetails) GetNativeLastName() (value string) { - if p == nil { - return - } - return p.NativeLastName -} - -// GetBirthdate returns value of Birthdate field. -func (p *PersonalDetails) GetBirthdate() (value Date) { - if p == nil { - return - } - return p.Birthdate -} - -// GetGender returns value of Gender field. -func (p *PersonalDetails) GetGender() (value string) { - if p == nil { - return - } - return p.Gender -} - -// GetCountryCode returns value of CountryCode field. -func (p *PersonalDetails) GetCountryCode() (value string) { - if p == nil { - return - } - return p.CountryCode -} - -// GetResidenceCountryCode returns value of ResidenceCountryCode field. -func (p *PersonalDetails) GetResidenceCountryCode() (value string) { - if p == nil { - return - } - return p.ResidenceCountryCode -} diff --git a/tdapi/tl_personal_document_gen.go b/tdapi/tl_personal_document_gen.go deleted file mode 100644 index f52253d58..000000000 --- a/tdapi/tl_personal_document_gen.go +++ /dev/null @@ -1,283 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PersonalDocument represents TL type `personalDocument#a8357e38`. -type PersonalDocument struct { - // List of files containing the pages of the document - Files []DatedFile - // List of files containing a certified English translation of the document - Translation []DatedFile -} - -// PersonalDocumentTypeID is TL type id of PersonalDocument. -const PersonalDocumentTypeID = 0xa8357e38 - -// Ensuring interfaces in compile-time for PersonalDocument. -var ( - _ bin.Encoder = &PersonalDocument{} - _ bin.Decoder = &PersonalDocument{} - _ bin.BareEncoder = &PersonalDocument{} - _ bin.BareDecoder = &PersonalDocument{} -) - -func (p *PersonalDocument) Zero() bool { - if p == nil { - return true - } - if !(p.Files == nil) { - return false - } - if !(p.Translation == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PersonalDocument) String() string { - if p == nil { - return "PersonalDocument(nil)" - } - type Alias PersonalDocument - return fmt.Sprintf("PersonalDocument%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PersonalDocument) TypeID() uint32 { - return PersonalDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*PersonalDocument) TypeName() string { - return "personalDocument" -} - -// TypeInfo returns info about TL type. -func (p *PersonalDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "personalDocument", - ID: PersonalDocumentTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Files", - SchemaName: "files", - }, - { - Name: "Translation", - SchemaName: "translation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PersonalDocument) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode personalDocument#a8357e38 as nil") - } - b.PutID(PersonalDocumentTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PersonalDocument) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode personalDocument#a8357e38 as nil") - } - b.PutInt(len(p.Files)) - for idx, v := range p.Files { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare personalDocument#a8357e38: field files element with index %d: %w", idx, err) - } - } - b.PutInt(len(p.Translation)) - for idx, v := range p.Translation { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare personalDocument#a8357e38: field translation element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PersonalDocument) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode personalDocument#a8357e38 to nil") - } - if err := b.ConsumeID(PersonalDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode personalDocument#a8357e38: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PersonalDocument) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode personalDocument#a8357e38 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode personalDocument#a8357e38: field files: %w", err) - } - - if headerLen > 0 { - p.Files = make([]DatedFile, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value DatedFile - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare personalDocument#a8357e38: field files: %w", err) - } - p.Files = append(p.Files, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode personalDocument#a8357e38: field translation: %w", err) - } - - if headerLen > 0 { - p.Translation = make([]DatedFile, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value DatedFile - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare personalDocument#a8357e38: field translation: %w", err) - } - p.Translation = append(p.Translation, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PersonalDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode personalDocument#a8357e38 as nil") - } - b.ObjStart() - b.PutID("personalDocument") - b.Comma() - b.FieldStart("files") - b.ArrStart() - for idx, v := range p.Files { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode personalDocument#a8357e38: field files element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("translation") - b.ArrStart() - for idx, v := range p.Translation { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode personalDocument#a8357e38: field translation element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PersonalDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode personalDocument#a8357e38 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("personalDocument"); err != nil { - return fmt.Errorf("unable to decode personalDocument#a8357e38: %w", err) - } - case "files": - if err := b.Arr(func(b tdjson.Decoder) error { - var value DatedFile - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode personalDocument#a8357e38: field files: %w", err) - } - p.Files = append(p.Files, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode personalDocument#a8357e38: field files: %w", err) - } - case "translation": - if err := b.Arr(func(b tdjson.Decoder) error { - var value DatedFile - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode personalDocument#a8357e38: field translation: %w", err) - } - p.Translation = append(p.Translation, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode personalDocument#a8357e38: field translation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFiles returns value of Files field. -func (p *PersonalDocument) GetFiles() (value []DatedFile) { - if p == nil { - return - } - return p.Files -} - -// GetTranslation returns value of Translation field. -func (p *PersonalDocument) GetTranslation() (value []DatedFile) { - if p == nil { - return - } - return p.Translation -} diff --git a/tdapi/tl_phone_number_authentication_settings_gen.go b/tdapi/tl_phone_number_authentication_settings_gen.go deleted file mode 100644 index a478f2eba..000000000 --- a/tdapi/tl_phone_number_authentication_settings_gen.go +++ /dev/null @@ -1,439 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PhoneNumberAuthenticationSettings represents TL type `phoneNumberAuthenticationSettings#3e1183db`. -type PhoneNumberAuthenticationSettings struct { - // Pass true if the authentication code may be sent via a flash call to the specified - // phone number - AllowFlashCall bool - // Pass true if the authentication code may be sent via a missed call to the specified - // phone number - AllowMissedCall bool - // Pass true if the authenticated phone number is used on the current device - IsCurrentPhoneNumber bool - // Pass true if there is a SIM card in the current device, but it is not possible to - // check whether phone number matches - HasUnknownPhoneNumber bool - // For official applications only. True, if the application can use Android SMS Retriever - // API (requires Google Play Services >= 10.2) to automatically receive the - // authentication code from the SMS. See https://developers.google - // com/identity/sms-retriever/ for more details - AllowSMSRetrieverAPI bool - // For official Android and iOS applications only; pass null otherwise. Settings for - // Firebase Authentication - FirebaseAuthenticationSettings FirebaseAuthenticationSettingsClass - // List of up to 20 authentication tokens, recently received in - // updateOption("authentication_token") in previously logged out sessions - AuthenticationTokens []string -} - -// PhoneNumberAuthenticationSettingsTypeID is TL type id of PhoneNumberAuthenticationSettings. -const PhoneNumberAuthenticationSettingsTypeID = 0x3e1183db - -// Ensuring interfaces in compile-time for PhoneNumberAuthenticationSettings. -var ( - _ bin.Encoder = &PhoneNumberAuthenticationSettings{} - _ bin.Decoder = &PhoneNumberAuthenticationSettings{} - _ bin.BareEncoder = &PhoneNumberAuthenticationSettings{} - _ bin.BareDecoder = &PhoneNumberAuthenticationSettings{} -) - -func (p *PhoneNumberAuthenticationSettings) Zero() bool { - if p == nil { - return true - } - if !(p.AllowFlashCall == false) { - return false - } - if !(p.AllowMissedCall == false) { - return false - } - if !(p.IsCurrentPhoneNumber == false) { - return false - } - if !(p.HasUnknownPhoneNumber == false) { - return false - } - if !(p.AllowSMSRetrieverAPI == false) { - return false - } - if !(p.FirebaseAuthenticationSettings == nil) { - return false - } - if !(p.AuthenticationTokens == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PhoneNumberAuthenticationSettings) String() string { - if p == nil { - return "PhoneNumberAuthenticationSettings(nil)" - } - type Alias PhoneNumberAuthenticationSettings - return fmt.Sprintf("PhoneNumberAuthenticationSettings%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PhoneNumberAuthenticationSettings) TypeID() uint32 { - return PhoneNumberAuthenticationSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PhoneNumberAuthenticationSettings) TypeName() string { - return "phoneNumberAuthenticationSettings" -} - -// TypeInfo returns info about TL type. -func (p *PhoneNumberAuthenticationSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "phoneNumberAuthenticationSettings", - ID: PhoneNumberAuthenticationSettingsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AllowFlashCall", - SchemaName: "allow_flash_call", - }, - { - Name: "AllowMissedCall", - SchemaName: "allow_missed_call", - }, - { - Name: "IsCurrentPhoneNumber", - SchemaName: "is_current_phone_number", - }, - { - Name: "HasUnknownPhoneNumber", - SchemaName: "has_unknown_phone_number", - }, - { - Name: "AllowSMSRetrieverAPI", - SchemaName: "allow_sms_retriever_api", - }, - { - Name: "FirebaseAuthenticationSettings", - SchemaName: "firebase_authentication_settings", - }, - { - Name: "AuthenticationTokens", - SchemaName: "authentication_tokens", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PhoneNumberAuthenticationSettings) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberAuthenticationSettings#3e1183db as nil") - } - b.PutID(PhoneNumberAuthenticationSettingsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PhoneNumberAuthenticationSettings) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberAuthenticationSettings#3e1183db as nil") - } - b.PutBool(p.AllowFlashCall) - b.PutBool(p.AllowMissedCall) - b.PutBool(p.IsCurrentPhoneNumber) - b.PutBool(p.HasUnknownPhoneNumber) - b.PutBool(p.AllowSMSRetrieverAPI) - if p.FirebaseAuthenticationSettings == nil { - return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings is nil") - } - if err := p.FirebaseAuthenticationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings: %w", err) - } - b.PutInt(len(p.AuthenticationTokens)) - for _, v := range p.AuthenticationTokens { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PhoneNumberAuthenticationSettings) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberAuthenticationSettings#3e1183db to nil") - } - if err := b.ConsumeID(PhoneNumberAuthenticationSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PhoneNumberAuthenticationSettings) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberAuthenticationSettings#3e1183db to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_flash_call: %w", err) - } - p.AllowFlashCall = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_missed_call: %w", err) - } - p.AllowMissedCall = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field is_current_phone_number: %w", err) - } - p.IsCurrentPhoneNumber = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field has_unknown_phone_number: %w", err) - } - p.HasUnknownPhoneNumber = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_sms_retriever_api: %w", err) - } - p.AllowSMSRetrieverAPI = value - } - { - value, err := DecodeFirebaseAuthenticationSettings(b) - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings: %w", err) - } - p.FirebaseAuthenticationSettings = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field authentication_tokens: %w", err) - } - - if headerLen > 0 { - p.AuthenticationTokens = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field authentication_tokens: %w", err) - } - p.AuthenticationTokens = append(p.AuthenticationTokens, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PhoneNumberAuthenticationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberAuthenticationSettings#3e1183db as nil") - } - b.ObjStart() - b.PutID("phoneNumberAuthenticationSettings") - b.Comma() - b.FieldStart("allow_flash_call") - b.PutBool(p.AllowFlashCall) - b.Comma() - b.FieldStart("allow_missed_call") - b.PutBool(p.AllowMissedCall) - b.Comma() - b.FieldStart("is_current_phone_number") - b.PutBool(p.IsCurrentPhoneNumber) - b.Comma() - b.FieldStart("has_unknown_phone_number") - b.PutBool(p.HasUnknownPhoneNumber) - b.Comma() - b.FieldStart("allow_sms_retriever_api") - b.PutBool(p.AllowSMSRetrieverAPI) - b.Comma() - b.FieldStart("firebase_authentication_settings") - if p.FirebaseAuthenticationSettings == nil { - return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings is nil") - } - if err := p.FirebaseAuthenticationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings: %w", err) - } - b.Comma() - b.FieldStart("authentication_tokens") - b.ArrStart() - for _, v := range p.AuthenticationTokens { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PhoneNumberAuthenticationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberAuthenticationSettings#3e1183db to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("phoneNumberAuthenticationSettings"); err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: %w", err) - } - case "allow_flash_call": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_flash_call: %w", err) - } - p.AllowFlashCall = value - case "allow_missed_call": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_missed_call: %w", err) - } - p.AllowMissedCall = value - case "is_current_phone_number": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field is_current_phone_number: %w", err) - } - p.IsCurrentPhoneNumber = value - case "has_unknown_phone_number": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field has_unknown_phone_number: %w", err) - } - p.HasUnknownPhoneNumber = value - case "allow_sms_retriever_api": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field allow_sms_retriever_api: %w", err) - } - p.AllowSMSRetrieverAPI = value - case "firebase_authentication_settings": - value, err := DecodeTDLibJSONFirebaseAuthenticationSettings(b) - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field firebase_authentication_settings: %w", err) - } - p.FirebaseAuthenticationSettings = value - case "authentication_tokens": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field authentication_tokens: %w", err) - } - p.AuthenticationTokens = append(p.AuthenticationTokens, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode phoneNumberAuthenticationSettings#3e1183db: field authentication_tokens: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAllowFlashCall returns value of AllowFlashCall field. -func (p *PhoneNumberAuthenticationSettings) GetAllowFlashCall() (value bool) { - if p == nil { - return - } - return p.AllowFlashCall -} - -// GetAllowMissedCall returns value of AllowMissedCall field. -func (p *PhoneNumberAuthenticationSettings) GetAllowMissedCall() (value bool) { - if p == nil { - return - } - return p.AllowMissedCall -} - -// GetIsCurrentPhoneNumber returns value of IsCurrentPhoneNumber field. -func (p *PhoneNumberAuthenticationSettings) GetIsCurrentPhoneNumber() (value bool) { - if p == nil { - return - } - return p.IsCurrentPhoneNumber -} - -// GetHasUnknownPhoneNumber returns value of HasUnknownPhoneNumber field. -func (p *PhoneNumberAuthenticationSettings) GetHasUnknownPhoneNumber() (value bool) { - if p == nil { - return - } - return p.HasUnknownPhoneNumber -} - -// GetAllowSMSRetrieverAPI returns value of AllowSMSRetrieverAPI field. -func (p *PhoneNumberAuthenticationSettings) GetAllowSMSRetrieverAPI() (value bool) { - if p == nil { - return - } - return p.AllowSMSRetrieverAPI -} - -// GetFirebaseAuthenticationSettings returns value of FirebaseAuthenticationSettings field. -func (p *PhoneNumberAuthenticationSettings) GetFirebaseAuthenticationSettings() (value FirebaseAuthenticationSettingsClass) { - if p == nil { - return - } - return p.FirebaseAuthenticationSettings -} - -// GetAuthenticationTokens returns value of AuthenticationTokens field. -func (p *PhoneNumberAuthenticationSettings) GetAuthenticationTokens() (value []string) { - if p == nil { - return - } - return p.AuthenticationTokens -} diff --git a/tdapi/tl_phone_number_code_type_gen.go b/tdapi/tl_phone_number_code_type_gen.go deleted file mode 100644 index ac130f17e..000000000 --- a/tdapi/tl_phone_number_code_type_gen.go +++ /dev/null @@ -1,612 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PhoneNumberCodeTypeChange represents TL type `phoneNumberCodeTypeChange#531ba1a`. -type PhoneNumberCodeTypeChange struct { -} - -// PhoneNumberCodeTypeChangeTypeID is TL type id of PhoneNumberCodeTypeChange. -const PhoneNumberCodeTypeChangeTypeID = 0x531ba1a - -// construct implements constructor of PhoneNumberCodeTypeClass. -func (p PhoneNumberCodeTypeChange) construct() PhoneNumberCodeTypeClass { return &p } - -// Ensuring interfaces in compile-time for PhoneNumberCodeTypeChange. -var ( - _ bin.Encoder = &PhoneNumberCodeTypeChange{} - _ bin.Decoder = &PhoneNumberCodeTypeChange{} - _ bin.BareEncoder = &PhoneNumberCodeTypeChange{} - _ bin.BareDecoder = &PhoneNumberCodeTypeChange{} - - _ PhoneNumberCodeTypeClass = &PhoneNumberCodeTypeChange{} -) - -func (p *PhoneNumberCodeTypeChange) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PhoneNumberCodeTypeChange) String() string { - if p == nil { - return "PhoneNumberCodeTypeChange(nil)" - } - type Alias PhoneNumberCodeTypeChange - return fmt.Sprintf("PhoneNumberCodeTypeChange%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PhoneNumberCodeTypeChange) TypeID() uint32 { - return PhoneNumberCodeTypeChangeTypeID -} - -// TypeName returns name of type in TL schema. -func (*PhoneNumberCodeTypeChange) TypeName() string { - return "phoneNumberCodeTypeChange" -} - -// TypeInfo returns info about TL type. -func (p *PhoneNumberCodeTypeChange) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "phoneNumberCodeTypeChange", - ID: PhoneNumberCodeTypeChangeTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PhoneNumberCodeTypeChange) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberCodeTypeChange#531ba1a as nil") - } - b.PutID(PhoneNumberCodeTypeChangeTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PhoneNumberCodeTypeChange) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberCodeTypeChange#531ba1a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PhoneNumberCodeTypeChange) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberCodeTypeChange#531ba1a to nil") - } - if err := b.ConsumeID(PhoneNumberCodeTypeChangeTypeID); err != nil { - return fmt.Errorf("unable to decode phoneNumberCodeTypeChange#531ba1a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PhoneNumberCodeTypeChange) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberCodeTypeChange#531ba1a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PhoneNumberCodeTypeChange) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberCodeTypeChange#531ba1a as nil") - } - b.ObjStart() - b.PutID("phoneNumberCodeTypeChange") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PhoneNumberCodeTypeChange) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberCodeTypeChange#531ba1a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("phoneNumberCodeTypeChange"); err != nil { - return fmt.Errorf("unable to decode phoneNumberCodeTypeChange#531ba1a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PhoneNumberCodeTypeVerify represents TL type `phoneNumberCodeTypeVerify#c2a48fdb`. -type PhoneNumberCodeTypeVerify struct { -} - -// PhoneNumberCodeTypeVerifyTypeID is TL type id of PhoneNumberCodeTypeVerify. -const PhoneNumberCodeTypeVerifyTypeID = 0xc2a48fdb - -// construct implements constructor of PhoneNumberCodeTypeClass. -func (p PhoneNumberCodeTypeVerify) construct() PhoneNumberCodeTypeClass { return &p } - -// Ensuring interfaces in compile-time for PhoneNumberCodeTypeVerify. -var ( - _ bin.Encoder = &PhoneNumberCodeTypeVerify{} - _ bin.Decoder = &PhoneNumberCodeTypeVerify{} - _ bin.BareEncoder = &PhoneNumberCodeTypeVerify{} - _ bin.BareDecoder = &PhoneNumberCodeTypeVerify{} - - _ PhoneNumberCodeTypeClass = &PhoneNumberCodeTypeVerify{} -) - -func (p *PhoneNumberCodeTypeVerify) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PhoneNumberCodeTypeVerify) String() string { - if p == nil { - return "PhoneNumberCodeTypeVerify(nil)" - } - type Alias PhoneNumberCodeTypeVerify - return fmt.Sprintf("PhoneNumberCodeTypeVerify%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PhoneNumberCodeTypeVerify) TypeID() uint32 { - return PhoneNumberCodeTypeVerifyTypeID -} - -// TypeName returns name of type in TL schema. -func (*PhoneNumberCodeTypeVerify) TypeName() string { - return "phoneNumberCodeTypeVerify" -} - -// TypeInfo returns info about TL type. -func (p *PhoneNumberCodeTypeVerify) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "phoneNumberCodeTypeVerify", - ID: PhoneNumberCodeTypeVerifyTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PhoneNumberCodeTypeVerify) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberCodeTypeVerify#c2a48fdb as nil") - } - b.PutID(PhoneNumberCodeTypeVerifyTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PhoneNumberCodeTypeVerify) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberCodeTypeVerify#c2a48fdb as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PhoneNumberCodeTypeVerify) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberCodeTypeVerify#c2a48fdb to nil") - } - if err := b.ConsumeID(PhoneNumberCodeTypeVerifyTypeID); err != nil { - return fmt.Errorf("unable to decode phoneNumberCodeTypeVerify#c2a48fdb: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PhoneNumberCodeTypeVerify) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberCodeTypeVerify#c2a48fdb to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PhoneNumberCodeTypeVerify) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberCodeTypeVerify#c2a48fdb as nil") - } - b.ObjStart() - b.PutID("phoneNumberCodeTypeVerify") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PhoneNumberCodeTypeVerify) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberCodeTypeVerify#c2a48fdb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("phoneNumberCodeTypeVerify"); err != nil { - return fmt.Errorf("unable to decode phoneNumberCodeTypeVerify#c2a48fdb: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PhoneNumberCodeTypeConfirmOwnership represents TL type `phoneNumberCodeTypeConfirmOwnership#e3114fe8`. -type PhoneNumberCodeTypeConfirmOwnership struct { - // Hash value from the link - Hash string -} - -// PhoneNumberCodeTypeConfirmOwnershipTypeID is TL type id of PhoneNumberCodeTypeConfirmOwnership. -const PhoneNumberCodeTypeConfirmOwnershipTypeID = 0xe3114fe8 - -// construct implements constructor of PhoneNumberCodeTypeClass. -func (p PhoneNumberCodeTypeConfirmOwnership) construct() PhoneNumberCodeTypeClass { return &p } - -// Ensuring interfaces in compile-time for PhoneNumberCodeTypeConfirmOwnership. -var ( - _ bin.Encoder = &PhoneNumberCodeTypeConfirmOwnership{} - _ bin.Decoder = &PhoneNumberCodeTypeConfirmOwnership{} - _ bin.BareEncoder = &PhoneNumberCodeTypeConfirmOwnership{} - _ bin.BareDecoder = &PhoneNumberCodeTypeConfirmOwnership{} - - _ PhoneNumberCodeTypeClass = &PhoneNumberCodeTypeConfirmOwnership{} -) - -func (p *PhoneNumberCodeTypeConfirmOwnership) Zero() bool { - if p == nil { - return true - } - if !(p.Hash == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PhoneNumberCodeTypeConfirmOwnership) String() string { - if p == nil { - return "PhoneNumberCodeTypeConfirmOwnership(nil)" - } - type Alias PhoneNumberCodeTypeConfirmOwnership - return fmt.Sprintf("PhoneNumberCodeTypeConfirmOwnership%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PhoneNumberCodeTypeConfirmOwnership) TypeID() uint32 { - return PhoneNumberCodeTypeConfirmOwnershipTypeID -} - -// TypeName returns name of type in TL schema. -func (*PhoneNumberCodeTypeConfirmOwnership) TypeName() string { - return "phoneNumberCodeTypeConfirmOwnership" -} - -// TypeInfo returns info about TL type. -func (p *PhoneNumberCodeTypeConfirmOwnership) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "phoneNumberCodeTypeConfirmOwnership", - ID: PhoneNumberCodeTypeConfirmOwnershipTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Hash", - SchemaName: "hash", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PhoneNumberCodeTypeConfirmOwnership) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberCodeTypeConfirmOwnership#e3114fe8 as nil") - } - b.PutID(PhoneNumberCodeTypeConfirmOwnershipTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PhoneNumberCodeTypeConfirmOwnership) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberCodeTypeConfirmOwnership#e3114fe8 as nil") - } - b.PutString(p.Hash) - return nil -} - -// Decode implements bin.Decoder. -func (p *PhoneNumberCodeTypeConfirmOwnership) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberCodeTypeConfirmOwnership#e3114fe8 to nil") - } - if err := b.ConsumeID(PhoneNumberCodeTypeConfirmOwnershipTypeID); err != nil { - return fmt.Errorf("unable to decode phoneNumberCodeTypeConfirmOwnership#e3114fe8: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PhoneNumberCodeTypeConfirmOwnership) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberCodeTypeConfirmOwnership#e3114fe8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberCodeTypeConfirmOwnership#e3114fe8: field hash: %w", err) - } - p.Hash = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PhoneNumberCodeTypeConfirmOwnership) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberCodeTypeConfirmOwnership#e3114fe8 as nil") - } - b.ObjStart() - b.PutID("phoneNumberCodeTypeConfirmOwnership") - b.Comma() - b.FieldStart("hash") - b.PutString(p.Hash) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PhoneNumberCodeTypeConfirmOwnership) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberCodeTypeConfirmOwnership#e3114fe8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("phoneNumberCodeTypeConfirmOwnership"); err != nil { - return fmt.Errorf("unable to decode phoneNumberCodeTypeConfirmOwnership#e3114fe8: %w", err) - } - case "hash": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberCodeTypeConfirmOwnership#e3114fe8: field hash: %w", err) - } - p.Hash = value - default: - return b.Skip() - } - return nil - }) -} - -// GetHash returns value of Hash field. -func (p *PhoneNumberCodeTypeConfirmOwnership) GetHash() (value string) { - if p == nil { - return - } - return p.Hash -} - -// PhoneNumberCodeTypeClassName is schema name of PhoneNumberCodeTypeClass. -const PhoneNumberCodeTypeClassName = "PhoneNumberCodeType" - -// PhoneNumberCodeTypeClass represents PhoneNumberCodeType generic type. -// -// Example: -// -// g, err := tdapi.DecodePhoneNumberCodeType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PhoneNumberCodeTypeChange: // phoneNumberCodeTypeChange#531ba1a -// case *tdapi.PhoneNumberCodeTypeVerify: // phoneNumberCodeTypeVerify#c2a48fdb -// case *tdapi.PhoneNumberCodeTypeConfirmOwnership: // phoneNumberCodeTypeConfirmOwnership#e3114fe8 -// default: panic(v) -// } -type PhoneNumberCodeTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PhoneNumberCodeTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePhoneNumberCodeType implements binary de-serialization for PhoneNumberCodeTypeClass. -func DecodePhoneNumberCodeType(buf *bin.Buffer) (PhoneNumberCodeTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PhoneNumberCodeTypeChangeTypeID: - // Decoding phoneNumberCodeTypeChange#531ba1a. - v := PhoneNumberCodeTypeChange{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PhoneNumberCodeTypeClass: %w", err) - } - return &v, nil - case PhoneNumberCodeTypeVerifyTypeID: - // Decoding phoneNumberCodeTypeVerify#c2a48fdb. - v := PhoneNumberCodeTypeVerify{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PhoneNumberCodeTypeClass: %w", err) - } - return &v, nil - case PhoneNumberCodeTypeConfirmOwnershipTypeID: - // Decoding phoneNumberCodeTypeConfirmOwnership#e3114fe8. - v := PhoneNumberCodeTypeConfirmOwnership{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PhoneNumberCodeTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PhoneNumberCodeTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPhoneNumberCodeType implements binary de-serialization for PhoneNumberCodeTypeClass. -func DecodeTDLibJSONPhoneNumberCodeType(buf tdjson.Decoder) (PhoneNumberCodeTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "phoneNumberCodeTypeChange": - // Decoding phoneNumberCodeTypeChange#531ba1a. - v := PhoneNumberCodeTypeChange{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PhoneNumberCodeTypeClass: %w", err) - } - return &v, nil - case "phoneNumberCodeTypeVerify": - // Decoding phoneNumberCodeTypeVerify#c2a48fdb. - v := PhoneNumberCodeTypeVerify{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PhoneNumberCodeTypeClass: %w", err) - } - return &v, nil - case "phoneNumberCodeTypeConfirmOwnership": - // Decoding phoneNumberCodeTypeConfirmOwnership#e3114fe8. - v := PhoneNumberCodeTypeConfirmOwnership{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PhoneNumberCodeTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PhoneNumberCodeTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PhoneNumberCodeType boxes the PhoneNumberCodeTypeClass providing a helper. -type PhoneNumberCodeTypeBox struct { - PhoneNumberCodeType PhoneNumberCodeTypeClass -} - -// Decode implements bin.Decoder for PhoneNumberCodeTypeBox. -func (b *PhoneNumberCodeTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PhoneNumberCodeTypeBox to nil") - } - v, err := DecodePhoneNumberCodeType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PhoneNumberCodeType = v - return nil -} - -// Encode implements bin.Encode for PhoneNumberCodeTypeBox. -func (b *PhoneNumberCodeTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PhoneNumberCodeType == nil { - return fmt.Errorf("unable to encode PhoneNumberCodeTypeClass as nil") - } - return b.PhoneNumberCodeType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PhoneNumberCodeTypeBox. -func (b *PhoneNumberCodeTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PhoneNumberCodeTypeBox to nil") - } - v, err := DecodeTDLibJSONPhoneNumberCodeType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PhoneNumberCodeType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PhoneNumberCodeTypeBox. -func (b *PhoneNumberCodeTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PhoneNumberCodeType == nil { - return fmt.Errorf("unable to encode PhoneNumberCodeTypeClass as nil") - } - return b.PhoneNumberCodeType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_phone_number_info_gen.go b/tdapi/tl_phone_number_info_gen.go deleted file mode 100644 index d97db669c..000000000 --- a/tdapi/tl_phone_number_info_gen.go +++ /dev/null @@ -1,297 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PhoneNumberInfo represents TL type `phoneNumberInfo#d2c398a1`. -type PhoneNumberInfo struct { - // Information about the country to which the phone number belongs; may be null - Country CountryInfo - // The part of the phone number denoting country calling code or its part - CountryCallingCode string - // The phone number without country calling code formatted accordingly to local rules. - // Expected digits are returned as '-', but even more digits might be entered by the user - FormattedPhoneNumber string - // True, if the phone number was bought at https://fragment.com and isn't tied to a SIM - // card. Information about the phone number can be received using getCollectibleItemInfo - IsAnonymous bool -} - -// PhoneNumberInfoTypeID is TL type id of PhoneNumberInfo. -const PhoneNumberInfoTypeID = 0xd2c398a1 - -// Ensuring interfaces in compile-time for PhoneNumberInfo. -var ( - _ bin.Encoder = &PhoneNumberInfo{} - _ bin.Decoder = &PhoneNumberInfo{} - _ bin.BareEncoder = &PhoneNumberInfo{} - _ bin.BareDecoder = &PhoneNumberInfo{} -) - -func (p *PhoneNumberInfo) Zero() bool { - if p == nil { - return true - } - if !(p.Country.Zero()) { - return false - } - if !(p.CountryCallingCode == "") { - return false - } - if !(p.FormattedPhoneNumber == "") { - return false - } - if !(p.IsAnonymous == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PhoneNumberInfo) String() string { - if p == nil { - return "PhoneNumberInfo(nil)" - } - type Alias PhoneNumberInfo - return fmt.Sprintf("PhoneNumberInfo%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PhoneNumberInfo) TypeID() uint32 { - return PhoneNumberInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*PhoneNumberInfo) TypeName() string { - return "phoneNumberInfo" -} - -// TypeInfo returns info about TL type. -func (p *PhoneNumberInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "phoneNumberInfo", - ID: PhoneNumberInfoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Country", - SchemaName: "country", - }, - { - Name: "CountryCallingCode", - SchemaName: "country_calling_code", - }, - { - Name: "FormattedPhoneNumber", - SchemaName: "formatted_phone_number", - }, - { - Name: "IsAnonymous", - SchemaName: "is_anonymous", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PhoneNumberInfo) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberInfo#d2c398a1 as nil") - } - b.PutID(PhoneNumberInfoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PhoneNumberInfo) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberInfo#d2c398a1 as nil") - } - if err := p.Country.Encode(b); err != nil { - return fmt.Errorf("unable to encode phoneNumberInfo#d2c398a1: field country: %w", err) - } - b.PutString(p.CountryCallingCode) - b.PutString(p.FormattedPhoneNumber) - b.PutBool(p.IsAnonymous) - return nil -} - -// Decode implements bin.Decoder. -func (p *PhoneNumberInfo) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberInfo#d2c398a1 to nil") - } - if err := b.ConsumeID(PhoneNumberInfoTypeID); err != nil { - return fmt.Errorf("unable to decode phoneNumberInfo#d2c398a1: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PhoneNumberInfo) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberInfo#d2c398a1 to nil") - } - { - if err := p.Country.Decode(b); err != nil { - return fmt.Errorf("unable to decode phoneNumberInfo#d2c398a1: field country: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberInfo#d2c398a1: field country_calling_code: %w", err) - } - p.CountryCallingCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberInfo#d2c398a1: field formatted_phone_number: %w", err) - } - p.FormattedPhoneNumber = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberInfo#d2c398a1: field is_anonymous: %w", err) - } - p.IsAnonymous = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PhoneNumberInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode phoneNumberInfo#d2c398a1 as nil") - } - b.ObjStart() - b.PutID("phoneNumberInfo") - b.Comma() - b.FieldStart("country") - if err := p.Country.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode phoneNumberInfo#d2c398a1: field country: %w", err) - } - b.Comma() - b.FieldStart("country_calling_code") - b.PutString(p.CountryCallingCode) - b.Comma() - b.FieldStart("formatted_phone_number") - b.PutString(p.FormattedPhoneNumber) - b.Comma() - b.FieldStart("is_anonymous") - b.PutBool(p.IsAnonymous) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PhoneNumberInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode phoneNumberInfo#d2c398a1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("phoneNumberInfo"); err != nil { - return fmt.Errorf("unable to decode phoneNumberInfo#d2c398a1: %w", err) - } - case "country": - if err := p.Country.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode phoneNumberInfo#d2c398a1: field country: %w", err) - } - case "country_calling_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberInfo#d2c398a1: field country_calling_code: %w", err) - } - p.CountryCallingCode = value - case "formatted_phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberInfo#d2c398a1: field formatted_phone_number: %w", err) - } - p.FormattedPhoneNumber = value - case "is_anonymous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode phoneNumberInfo#d2c398a1: field is_anonymous: %w", err) - } - p.IsAnonymous = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCountry returns value of Country field. -func (p *PhoneNumberInfo) GetCountry() (value CountryInfo) { - if p == nil { - return - } - return p.Country -} - -// GetCountryCallingCode returns value of CountryCallingCode field. -func (p *PhoneNumberInfo) GetCountryCallingCode() (value string) { - if p == nil { - return - } - return p.CountryCallingCode -} - -// GetFormattedPhoneNumber returns value of FormattedPhoneNumber field. -func (p *PhoneNumberInfo) GetFormattedPhoneNumber() (value string) { - if p == nil { - return - } - return p.FormattedPhoneNumber -} - -// GetIsAnonymous returns value of IsAnonymous field. -func (p *PhoneNumberInfo) GetIsAnonymous() (value bool) { - if p == nil { - return - } - return p.IsAnonymous -} diff --git a/tdapi/tl_photo_gen.go b/tdapi/tl_photo_gen.go deleted file mode 100644 index df5682379..000000000 --- a/tdapi/tl_photo_gen.go +++ /dev/null @@ -1,290 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Photo represents TL type `photo#105a0689`. -type Photo struct { - // True, if stickers were added to the photo. The list of corresponding sticker sets can - // be received using getAttachedStickerSets - HasStickers bool - // Photo minithumbnail; may be null - Minithumbnail Minithumbnail - // Available variants of the photo, in different sizes - Sizes []PhotoSize -} - -// PhotoTypeID is TL type id of Photo. -const PhotoTypeID = 0x105a0689 - -// Ensuring interfaces in compile-time for Photo. -var ( - _ bin.Encoder = &Photo{} - _ bin.Decoder = &Photo{} - _ bin.BareEncoder = &Photo{} - _ bin.BareDecoder = &Photo{} -) - -func (p *Photo) Zero() bool { - if p == nil { - return true - } - if !(p.HasStickers == false) { - return false - } - if !(p.Minithumbnail.Zero()) { - return false - } - if !(p.Sizes == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *Photo) String() string { - if p == nil { - return "Photo(nil)" - } - type Alias Photo - return fmt.Sprintf("Photo%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Photo) TypeID() uint32 { - return PhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*Photo) TypeName() string { - return "photo" -} - -// TypeInfo returns info about TL type. -func (p *Photo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "photo", - ID: PhotoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "HasStickers", - SchemaName: "has_stickers", - }, - { - Name: "Minithumbnail", - SchemaName: "minithumbnail", - }, - { - Name: "Sizes", - SchemaName: "sizes", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *Photo) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode photo#105a0689 as nil") - } - b.PutID(PhotoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *Photo) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode photo#105a0689 as nil") - } - b.PutBool(p.HasStickers) - if err := p.Minithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode photo#105a0689: field minithumbnail: %w", err) - } - b.PutInt(len(p.Sizes)) - for idx, v := range p.Sizes { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare photo#105a0689: field sizes element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (p *Photo) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode photo#105a0689 to nil") - } - if err := b.ConsumeID(PhotoTypeID); err != nil { - return fmt.Errorf("unable to decode photo#105a0689: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *Photo) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode photo#105a0689 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode photo#105a0689: field has_stickers: %w", err) - } - p.HasStickers = value - } - { - if err := p.Minithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode photo#105a0689: field minithumbnail: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode photo#105a0689: field sizes: %w", err) - } - - if headerLen > 0 { - p.Sizes = make([]PhotoSize, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PhotoSize - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare photo#105a0689: field sizes: %w", err) - } - p.Sizes = append(p.Sizes, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *Photo) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode photo#105a0689 as nil") - } - b.ObjStart() - b.PutID("photo") - b.Comma() - b.FieldStart("has_stickers") - b.PutBool(p.HasStickers) - b.Comma() - b.FieldStart("minithumbnail") - if err := p.Minithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode photo#105a0689: field minithumbnail: %w", err) - } - b.Comma() - b.FieldStart("sizes") - b.ArrStart() - for idx, v := range p.Sizes { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode photo#105a0689: field sizes element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *Photo) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode photo#105a0689 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("photo"); err != nil { - return fmt.Errorf("unable to decode photo#105a0689: %w", err) - } - case "has_stickers": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode photo#105a0689: field has_stickers: %w", err) - } - p.HasStickers = value - case "minithumbnail": - if err := p.Minithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode photo#105a0689: field minithumbnail: %w", err) - } - case "sizes": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PhotoSize - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode photo#105a0689: field sizes: %w", err) - } - p.Sizes = append(p.Sizes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode photo#105a0689: field sizes: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetHasStickers returns value of HasStickers field. -func (p *Photo) GetHasStickers() (value bool) { - if p == nil { - return - } - return p.HasStickers -} - -// GetMinithumbnail returns value of Minithumbnail field. -func (p *Photo) GetMinithumbnail() (value Minithumbnail) { - if p == nil { - return - } - return p.Minithumbnail -} - -// GetSizes returns value of Sizes field. -func (p *Photo) GetSizes() (value []PhotoSize) { - if p == nil { - return - } - return p.Sizes -} diff --git a/tdapi/tl_photo_size_gen.go b/tdapi/tl_photo_size_gen.go deleted file mode 100644 index 89dfbc094..000000000 --- a/tdapi/tl_photo_size_gen.go +++ /dev/null @@ -1,354 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PhotoSize represents TL type `photoSize#18e56d39`. -type PhotoSize struct { - // Image type (see https://core.telegram.org/constructor/photoSize) - Type string - // Information about the image file - Photo File - // Image width - Width int32 - // Image height - Height int32 - // Sizes of progressive JPEG file prefixes, which can be used to preliminarily show the - // image; in bytes - ProgressiveSizes []int32 -} - -// PhotoSizeTypeID is TL type id of PhotoSize. -const PhotoSizeTypeID = 0x18e56d39 - -// Ensuring interfaces in compile-time for PhotoSize. -var ( - _ bin.Encoder = &PhotoSize{} - _ bin.Decoder = &PhotoSize{} - _ bin.BareEncoder = &PhotoSize{} - _ bin.BareDecoder = &PhotoSize{} -) - -func (p *PhotoSize) Zero() bool { - if p == nil { - return true - } - if !(p.Type == "") { - return false - } - if !(p.Photo.Zero()) { - return false - } - if !(p.Width == 0) { - return false - } - if !(p.Height == 0) { - return false - } - if !(p.ProgressiveSizes == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PhotoSize) String() string { - if p == nil { - return "PhotoSize(nil)" - } - type Alias PhotoSize - return fmt.Sprintf("PhotoSize%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PhotoSize) TypeID() uint32 { - return PhotoSizeTypeID -} - -// TypeName returns name of type in TL schema. -func (*PhotoSize) TypeName() string { - return "photoSize" -} - -// TypeInfo returns info about TL type. -func (p *PhotoSize) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "photoSize", - ID: PhotoSizeTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "ProgressiveSizes", - SchemaName: "progressive_sizes", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PhotoSize) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode photoSize#18e56d39 as nil") - } - b.PutID(PhotoSizeTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PhotoSize) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode photoSize#18e56d39 as nil") - } - b.PutString(p.Type) - if err := p.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode photoSize#18e56d39: field photo: %w", err) - } - b.PutInt32(p.Width) - b.PutInt32(p.Height) - b.PutInt(len(p.ProgressiveSizes)) - for _, v := range p.ProgressiveSizes { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PhotoSize) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode photoSize#18e56d39 to nil") - } - if err := b.ConsumeID(PhotoSizeTypeID); err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PhotoSize) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode photoSize#18e56d39 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field type: %w", err) - } - p.Type = value - } - { - if err := p.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field photo: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field width: %w", err) - } - p.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field height: %w", err) - } - p.Height = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field progressive_sizes: %w", err) - } - - if headerLen > 0 { - p.ProgressiveSizes = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field progressive_sizes: %w", err) - } - p.ProgressiveSizes = append(p.ProgressiveSizes, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PhotoSize) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode photoSize#18e56d39 as nil") - } - b.ObjStart() - b.PutID("photoSize") - b.Comma() - b.FieldStart("type") - b.PutString(p.Type) - b.Comma() - b.FieldStart("photo") - if err := p.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode photoSize#18e56d39: field photo: %w", err) - } - b.Comma() - b.FieldStart("width") - b.PutInt32(p.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(p.Height) - b.Comma() - b.FieldStart("progressive_sizes") - b.ArrStart() - for _, v := range p.ProgressiveSizes { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PhotoSize) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode photoSize#18e56d39 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("photoSize"); err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: %w", err) - } - case "type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field type: %w", err) - } - p.Type = value - case "photo": - if err := p.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field photo: %w", err) - } - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field width: %w", err) - } - p.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field height: %w", err) - } - p.Height = value - case "progressive_sizes": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field progressive_sizes: %w", err) - } - p.ProgressiveSizes = append(p.ProgressiveSizes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode photoSize#18e56d39: field progressive_sizes: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (p *PhotoSize) GetType() (value string) { - if p == nil { - return - } - return p.Type -} - -// GetPhoto returns value of Photo field. -func (p *PhotoSize) GetPhoto() (value File) { - if p == nil { - return - } - return p.Photo -} - -// GetWidth returns value of Width field. -func (p *PhotoSize) GetWidth() (value int32) { - if p == nil { - return - } - return p.Width -} - -// GetHeight returns value of Height field. -func (p *PhotoSize) GetHeight() (value int32) { - if p == nil { - return - } - return p.Height -} - -// GetProgressiveSizes returns value of ProgressiveSizes field. -func (p *PhotoSize) GetProgressiveSizes() (value []int32) { - if p == nil { - return - } - return p.ProgressiveSizes -} diff --git a/tdapi/tl_pin_chat_message_gen.go b/tdapi/tl_pin_chat_message_gen.go deleted file mode 100644 index 63cb635e7..000000000 --- a/tdapi/tl_pin_chat_message_gen.go +++ /dev/null @@ -1,306 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PinChatMessageRequest represents TL type `pinChatMessage#79475baf`. -type PinChatMessageRequest struct { - // Identifier of the chat - ChatID int64 - // Identifier of the new pinned message - MessageID int64 - // Pass true to disable notification about the pinned message. Notifications are always - // disabled in channels and private chats - DisableNotification bool - // Pass true to pin the message only for self; private chats only - OnlyForSelf bool -} - -// PinChatMessageRequestTypeID is TL type id of PinChatMessageRequest. -const PinChatMessageRequestTypeID = 0x79475baf - -// Ensuring interfaces in compile-time for PinChatMessageRequest. -var ( - _ bin.Encoder = &PinChatMessageRequest{} - _ bin.Decoder = &PinChatMessageRequest{} - _ bin.BareEncoder = &PinChatMessageRequest{} - _ bin.BareDecoder = &PinChatMessageRequest{} -) - -func (p *PinChatMessageRequest) Zero() bool { - if p == nil { - return true - } - if !(p.ChatID == 0) { - return false - } - if !(p.MessageID == 0) { - return false - } - if !(p.DisableNotification == false) { - return false - } - if !(p.OnlyForSelf == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PinChatMessageRequest) String() string { - if p == nil { - return "PinChatMessageRequest(nil)" - } - type Alias PinChatMessageRequest - return fmt.Sprintf("PinChatMessageRequest%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PinChatMessageRequest) TypeID() uint32 { - return PinChatMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*PinChatMessageRequest) TypeName() string { - return "pinChatMessage" -} - -// TypeInfo returns info about TL type. -func (p *PinChatMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pinChatMessage", - ID: PinChatMessageRequestTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "DisableNotification", - SchemaName: "disable_notification", - }, - { - Name: "OnlyForSelf", - SchemaName: "only_for_self", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PinChatMessageRequest) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pinChatMessage#79475baf as nil") - } - b.PutID(PinChatMessageRequestTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PinChatMessageRequest) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pinChatMessage#79475baf as nil") - } - b.PutInt53(p.ChatID) - b.PutInt53(p.MessageID) - b.PutBool(p.DisableNotification) - b.PutBool(p.OnlyForSelf) - return nil -} - -// Decode implements bin.Decoder. -func (p *PinChatMessageRequest) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pinChatMessage#79475baf to nil") - } - if err := b.ConsumeID(PinChatMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode pinChatMessage#79475baf: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PinChatMessageRequest) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pinChatMessage#79475baf to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode pinChatMessage#79475baf: field chat_id: %w", err) - } - p.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode pinChatMessage#79475baf: field message_id: %w", err) - } - p.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pinChatMessage#79475baf: field disable_notification: %w", err) - } - p.DisableNotification = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pinChatMessage#79475baf: field only_for_self: %w", err) - } - p.OnlyForSelf = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PinChatMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pinChatMessage#79475baf as nil") - } - b.ObjStart() - b.PutID("pinChatMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(p.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(p.MessageID) - b.Comma() - b.FieldStart("disable_notification") - b.PutBool(p.DisableNotification) - b.Comma() - b.FieldStart("only_for_self") - b.PutBool(p.OnlyForSelf) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PinChatMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pinChatMessage#79475baf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pinChatMessage"); err != nil { - return fmt.Errorf("unable to decode pinChatMessage#79475baf: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode pinChatMessage#79475baf: field chat_id: %w", err) - } - p.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode pinChatMessage#79475baf: field message_id: %w", err) - } - p.MessageID = value - case "disable_notification": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pinChatMessage#79475baf: field disable_notification: %w", err) - } - p.DisableNotification = value - case "only_for_self": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pinChatMessage#79475baf: field only_for_self: %w", err) - } - p.OnlyForSelf = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (p *PinChatMessageRequest) GetChatID() (value int64) { - if p == nil { - return - } - return p.ChatID -} - -// GetMessageID returns value of MessageID field. -func (p *PinChatMessageRequest) GetMessageID() (value int64) { - if p == nil { - return - } - return p.MessageID -} - -// GetDisableNotification returns value of DisableNotification field. -func (p *PinChatMessageRequest) GetDisableNotification() (value bool) { - if p == nil { - return - } - return p.DisableNotification -} - -// GetOnlyForSelf returns value of OnlyForSelf field. -func (p *PinChatMessageRequest) GetOnlyForSelf() (value bool) { - if p == nil { - return - } - return p.OnlyForSelf -} - -// PinChatMessage invokes method pinChatMessage#79475baf returning error if any. -func (c *Client) PinChatMessage(ctx context.Context, request *PinChatMessageRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_ping_proxy_gen.go b/tdapi/tl_ping_proxy_gen.go deleted file mode 100644 index 024475db3..000000000 --- a/tdapi/tl_ping_proxy_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PingProxyRequest represents TL type `pingProxy#c59b40b1`. -type PingProxyRequest struct { - // Proxy identifier. Use 0 to ping a Telegram server without a proxy - ProxyID int32 -} - -// PingProxyRequestTypeID is TL type id of PingProxyRequest. -const PingProxyRequestTypeID = 0xc59b40b1 - -// Ensuring interfaces in compile-time for PingProxyRequest. -var ( - _ bin.Encoder = &PingProxyRequest{} - _ bin.Decoder = &PingProxyRequest{} - _ bin.BareEncoder = &PingProxyRequest{} - _ bin.BareDecoder = &PingProxyRequest{} -) - -func (p *PingProxyRequest) Zero() bool { - if p == nil { - return true - } - if !(p.ProxyID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PingProxyRequest) String() string { - if p == nil { - return "PingProxyRequest(nil)" - } - type Alias PingProxyRequest - return fmt.Sprintf("PingProxyRequest%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PingProxyRequest) TypeID() uint32 { - return PingProxyRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*PingProxyRequest) TypeName() string { - return "pingProxy" -} - -// TypeInfo returns info about TL type. -func (p *PingProxyRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pingProxy", - ID: PingProxyRequestTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ProxyID", - SchemaName: "proxy_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PingProxyRequest) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pingProxy#c59b40b1 as nil") - } - b.PutID(PingProxyRequestTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PingProxyRequest) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pingProxy#c59b40b1 as nil") - } - b.PutInt32(p.ProxyID) - return nil -} - -// Decode implements bin.Decoder. -func (p *PingProxyRequest) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pingProxy#c59b40b1 to nil") - } - if err := b.ConsumeID(PingProxyRequestTypeID); err != nil { - return fmt.Errorf("unable to decode pingProxy#c59b40b1: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PingProxyRequest) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pingProxy#c59b40b1 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pingProxy#c59b40b1: field proxy_id: %w", err) - } - p.ProxyID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PingProxyRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pingProxy#c59b40b1 as nil") - } - b.ObjStart() - b.PutID("pingProxy") - b.Comma() - b.FieldStart("proxy_id") - b.PutInt32(p.ProxyID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PingProxyRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pingProxy#c59b40b1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pingProxy"); err != nil { - return fmt.Errorf("unable to decode pingProxy#c59b40b1: %w", err) - } - case "proxy_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pingProxy#c59b40b1: field proxy_id: %w", err) - } - p.ProxyID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProxyID returns value of ProxyID field. -func (p *PingProxyRequest) GetProxyID() (value int32) { - if p == nil { - return - } - return p.ProxyID -} - -// PingProxy invokes method pingProxy#c59b40b1 returning error if any. -func (c *Client) PingProxy(ctx context.Context, proxyid int32) (*Seconds, error) { - var result Seconds - - request := &PingProxyRequest{ - ProxyID: proxyid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_point_gen.go b/tdapi/tl_point_gen.go deleted file mode 100644 index e660451f6..000000000 --- a/tdapi/tl_point_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Point represents TL type `point#1a13f5b9`. -type Point struct { - // The point's first coordinate - X float64 - // The point's second coordinate - Y float64 -} - -// PointTypeID is TL type id of Point. -const PointTypeID = 0x1a13f5b9 - -// Ensuring interfaces in compile-time for Point. -var ( - _ bin.Encoder = &Point{} - _ bin.Decoder = &Point{} - _ bin.BareEncoder = &Point{} - _ bin.BareDecoder = &Point{} -) - -func (p *Point) Zero() bool { - if p == nil { - return true - } - if !(p.X == 0) { - return false - } - if !(p.Y == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *Point) String() string { - if p == nil { - return "Point(nil)" - } - type Alias Point - return fmt.Sprintf("Point%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Point) TypeID() uint32 { - return PointTypeID -} - -// TypeName returns name of type in TL schema. -func (*Point) TypeName() string { - return "point" -} - -// TypeInfo returns info about TL type. -func (p *Point) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "point", - ID: PointTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "X", - SchemaName: "x", - }, - { - Name: "Y", - SchemaName: "y", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *Point) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode point#1a13f5b9 as nil") - } - b.PutID(PointTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *Point) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode point#1a13f5b9 as nil") - } - b.PutDouble(p.X) - b.PutDouble(p.Y) - return nil -} - -// Decode implements bin.Decoder. -func (p *Point) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode point#1a13f5b9 to nil") - } - if err := b.ConsumeID(PointTypeID); err != nil { - return fmt.Errorf("unable to decode point#1a13f5b9: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *Point) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode point#1a13f5b9 to nil") - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode point#1a13f5b9: field x: %w", err) - } - p.X = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode point#1a13f5b9: field y: %w", err) - } - p.Y = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *Point) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode point#1a13f5b9 as nil") - } - b.ObjStart() - b.PutID("point") - b.Comma() - b.FieldStart("x") - b.PutDouble(p.X) - b.Comma() - b.FieldStart("y") - b.PutDouble(p.Y) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *Point) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode point#1a13f5b9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("point"); err != nil { - return fmt.Errorf("unable to decode point#1a13f5b9: %w", err) - } - case "x": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode point#1a13f5b9: field x: %w", err) - } - p.X = value - case "y": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode point#1a13f5b9: field y: %w", err) - } - p.Y = value - default: - return b.Skip() - } - return nil - }) -} - -// GetX returns value of X field. -func (p *Point) GetX() (value float64) { - if p == nil { - return - } - return p.X -} - -// GetY returns value of Y field. -func (p *Point) GetY() (value float64) { - if p == nil { - return - } - return p.Y -} diff --git a/tdapi/tl_poll_gen.go b/tdapi/tl_poll_gen.go deleted file mode 100644 index 5ba43f40a..000000000 --- a/tdapi/tl_poll_gen.go +++ /dev/null @@ -1,571 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Poll represents TL type `poll#71d4870c`. -type Poll struct { - // Unique poll identifier - ID int64 - // Poll question; 1-300 characters. Only custom emoji entities are allowed - Question FormattedText - // List of poll answer options - Options []PollOption - // Total number of voters, participating in the poll - TotalVoterCount int32 - // Identifiers of recent voters, if the poll is non-anonymous - RecentVoterIDs []MessageSenderClass - // True, if the poll is anonymous - IsAnonymous bool - // Type of the poll - Type PollTypeClass - // Amount of time the poll will be active after creation, in seconds - OpenPeriod int32 - // Point in time (Unix timestamp) when the poll will automatically be closed - CloseDate int32 - // True, if the poll is closed - IsClosed bool -} - -// PollTypeID is TL type id of Poll. -const PollTypeID = 0x71d4870c - -// Ensuring interfaces in compile-time for Poll. -var ( - _ bin.Encoder = &Poll{} - _ bin.Decoder = &Poll{} - _ bin.BareEncoder = &Poll{} - _ bin.BareDecoder = &Poll{} -) - -func (p *Poll) Zero() bool { - if p == nil { - return true - } - if !(p.ID == 0) { - return false - } - if !(p.Question.Zero()) { - return false - } - if !(p.Options == nil) { - return false - } - if !(p.TotalVoterCount == 0) { - return false - } - if !(p.RecentVoterIDs == nil) { - return false - } - if !(p.IsAnonymous == false) { - return false - } - if !(p.Type == nil) { - return false - } - if !(p.OpenPeriod == 0) { - return false - } - if !(p.CloseDate == 0) { - return false - } - if !(p.IsClosed == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *Poll) String() string { - if p == nil { - return "Poll(nil)" - } - type Alias Poll - return fmt.Sprintf("Poll%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Poll) TypeID() uint32 { - return PollTypeID -} - -// TypeName returns name of type in TL schema. -func (*Poll) TypeName() string { - return "poll" -} - -// TypeInfo returns info about TL type. -func (p *Poll) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "poll", - ID: PollTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Question", - SchemaName: "question", - }, - { - Name: "Options", - SchemaName: "options", - }, - { - Name: "TotalVoterCount", - SchemaName: "total_voter_count", - }, - { - Name: "RecentVoterIDs", - SchemaName: "recent_voter_ids", - }, - { - Name: "IsAnonymous", - SchemaName: "is_anonymous", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "OpenPeriod", - SchemaName: "open_period", - }, - { - Name: "CloseDate", - SchemaName: "close_date", - }, - { - Name: "IsClosed", - SchemaName: "is_closed", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *Poll) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode poll#71d4870c as nil") - } - b.PutID(PollTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *Poll) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode poll#71d4870c as nil") - } - b.PutLong(p.ID) - if err := p.Question.Encode(b); err != nil { - return fmt.Errorf("unable to encode poll#71d4870c: field question: %w", err) - } - b.PutInt(len(p.Options)) - for idx, v := range p.Options { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare poll#71d4870c: field options element with index %d: %w", idx, err) - } - } - b.PutInt32(p.TotalVoterCount) - b.PutInt(len(p.RecentVoterIDs)) - for idx, v := range p.RecentVoterIDs { - if v == nil { - return fmt.Errorf("unable to encode poll#71d4870c: field recent_voter_ids element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare poll#71d4870c: field recent_voter_ids element with index %d: %w", idx, err) - } - } - b.PutBool(p.IsAnonymous) - if p.Type == nil { - return fmt.Errorf("unable to encode poll#71d4870c: field type is nil") - } - if err := p.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode poll#71d4870c: field type: %w", err) - } - b.PutInt32(p.OpenPeriod) - b.PutInt32(p.CloseDate) - b.PutBool(p.IsClosed) - return nil -} - -// Decode implements bin.Decoder. -func (p *Poll) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode poll#71d4870c to nil") - } - if err := b.ConsumeID(PollTypeID); err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *Poll) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode poll#71d4870c to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field id: %w", err) - } - p.ID = value - } - { - if err := p.Question.Decode(b); err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field question: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field options: %w", err) - } - - if headerLen > 0 { - p.Options = make([]PollOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PollOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare poll#71d4870c: field options: %w", err) - } - p.Options = append(p.Options, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field total_voter_count: %w", err) - } - p.TotalVoterCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field recent_voter_ids: %w", err) - } - - if headerLen > 0 { - p.RecentVoterIDs = make([]MessageSenderClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field recent_voter_ids: %w", err) - } - p.RecentVoterIDs = append(p.RecentVoterIDs, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field is_anonymous: %w", err) - } - p.IsAnonymous = value - } - { - value, err := DecodePollType(b) - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field type: %w", err) - } - p.Type = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field open_period: %w", err) - } - p.OpenPeriod = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field close_date: %w", err) - } - p.CloseDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field is_closed: %w", err) - } - p.IsClosed = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *Poll) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode poll#71d4870c as nil") - } - b.ObjStart() - b.PutID("poll") - b.Comma() - b.FieldStart("id") - b.PutLong(p.ID) - b.Comma() - b.FieldStart("question") - if err := p.Question.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode poll#71d4870c: field question: %w", err) - } - b.Comma() - b.FieldStart("options") - b.ArrStart() - for idx, v := range p.Options { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode poll#71d4870c: field options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("total_voter_count") - b.PutInt32(p.TotalVoterCount) - b.Comma() - b.FieldStart("recent_voter_ids") - b.ArrStart() - for idx, v := range p.RecentVoterIDs { - if v == nil { - return fmt.Errorf("unable to encode poll#71d4870c: field recent_voter_ids element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode poll#71d4870c: field recent_voter_ids element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("is_anonymous") - b.PutBool(p.IsAnonymous) - b.Comma() - b.FieldStart("type") - if p.Type == nil { - return fmt.Errorf("unable to encode poll#71d4870c: field type is nil") - } - if err := p.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode poll#71d4870c: field type: %w", err) - } - b.Comma() - b.FieldStart("open_period") - b.PutInt32(p.OpenPeriod) - b.Comma() - b.FieldStart("close_date") - b.PutInt32(p.CloseDate) - b.Comma() - b.FieldStart("is_closed") - b.PutBool(p.IsClosed) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *Poll) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode poll#71d4870c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("poll"); err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field id: %w", err) - } - p.ID = value - case "question": - if err := p.Question.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field question: %w", err) - } - case "options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PollOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field options: %w", err) - } - p.Options = append(p.Options, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field options: %w", err) - } - case "total_voter_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field total_voter_count: %w", err) - } - p.TotalVoterCount = value - case "recent_voter_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field recent_voter_ids: %w", err) - } - p.RecentVoterIDs = append(p.RecentVoterIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field recent_voter_ids: %w", err) - } - case "is_anonymous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field is_anonymous: %w", err) - } - p.IsAnonymous = value - case "type": - value, err := DecodeTDLibJSONPollType(b) - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field type: %w", err) - } - p.Type = value - case "open_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field open_period: %w", err) - } - p.OpenPeriod = value - case "close_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field close_date: %w", err) - } - p.CloseDate = value - case "is_closed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode poll#71d4870c: field is_closed: %w", err) - } - p.IsClosed = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (p *Poll) GetID() (value int64) { - if p == nil { - return - } - return p.ID -} - -// GetQuestion returns value of Question field. -func (p *Poll) GetQuestion() (value FormattedText) { - if p == nil { - return - } - return p.Question -} - -// GetOptions returns value of Options field. -func (p *Poll) GetOptions() (value []PollOption) { - if p == nil { - return - } - return p.Options -} - -// GetTotalVoterCount returns value of TotalVoterCount field. -func (p *Poll) GetTotalVoterCount() (value int32) { - if p == nil { - return - } - return p.TotalVoterCount -} - -// GetRecentVoterIDs returns value of RecentVoterIDs field. -func (p *Poll) GetRecentVoterIDs() (value []MessageSenderClass) { - if p == nil { - return - } - return p.RecentVoterIDs -} - -// GetIsAnonymous returns value of IsAnonymous field. -func (p *Poll) GetIsAnonymous() (value bool) { - if p == nil { - return - } - return p.IsAnonymous -} - -// GetType returns value of Type field. -func (p *Poll) GetType() (value PollTypeClass) { - if p == nil { - return - } - return p.Type -} - -// GetOpenPeriod returns value of OpenPeriod field. -func (p *Poll) GetOpenPeriod() (value int32) { - if p == nil { - return - } - return p.OpenPeriod -} - -// GetCloseDate returns value of CloseDate field. -func (p *Poll) GetCloseDate() (value int32) { - if p == nil { - return - } - return p.CloseDate -} - -// GetIsClosed returns value of IsClosed field. -func (p *Poll) GetIsClosed() (value bool) { - if p == nil { - return - } - return p.IsClosed -} diff --git a/tdapi/tl_poll_option_gen.go b/tdapi/tl_poll_option_gen.go deleted file mode 100644 index f80dc5868..000000000 --- a/tdapi/tl_poll_option_gen.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PollOption represents TL type `pollOption#63e97090`. -type PollOption struct { - // Option text; 1-100 characters. Only custom emoji entities are allowed - Text FormattedText - // Number of voters for this option, available only for closed or voted polls - VoterCount int32 - // The percentage of votes for this option; 0-100 - VotePercentage int32 - // True, if the option was chosen by the user - IsChosen bool - // True, if the option is being chosen by a pending setPollAnswer request - IsBeingChosen bool -} - -// PollOptionTypeID is TL type id of PollOption. -const PollOptionTypeID = 0x63e97090 - -// Ensuring interfaces in compile-time for PollOption. -var ( - _ bin.Encoder = &PollOption{} - _ bin.Decoder = &PollOption{} - _ bin.BareEncoder = &PollOption{} - _ bin.BareDecoder = &PollOption{} -) - -func (p *PollOption) Zero() bool { - if p == nil { - return true - } - if !(p.Text.Zero()) { - return false - } - if !(p.VoterCount == 0) { - return false - } - if !(p.VotePercentage == 0) { - return false - } - if !(p.IsChosen == false) { - return false - } - if !(p.IsBeingChosen == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PollOption) String() string { - if p == nil { - return "PollOption(nil)" - } - type Alias PollOption - return fmt.Sprintf("PollOption%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PollOption) TypeID() uint32 { - return PollOptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*PollOption) TypeName() string { - return "pollOption" -} - -// TypeInfo returns info about TL type. -func (p *PollOption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pollOption", - ID: PollOptionTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "VoterCount", - SchemaName: "voter_count", - }, - { - Name: "VotePercentage", - SchemaName: "vote_percentage", - }, - { - Name: "IsChosen", - SchemaName: "is_chosen", - }, - { - Name: "IsBeingChosen", - SchemaName: "is_being_chosen", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PollOption) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pollOption#63e97090 as nil") - } - b.PutID(PollOptionTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PollOption) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pollOption#63e97090 as nil") - } - if err := p.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode pollOption#63e97090: field text: %w", err) - } - b.PutInt32(p.VoterCount) - b.PutInt32(p.VotePercentage) - b.PutBool(p.IsChosen) - b.PutBool(p.IsBeingChosen) - return nil -} - -// Decode implements bin.Decoder. -func (p *PollOption) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pollOption#63e97090 to nil") - } - if err := b.ConsumeID(PollOptionTypeID); err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PollOption) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pollOption#63e97090 to nil") - } - { - if err := p.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: field text: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: field voter_count: %w", err) - } - p.VoterCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: field vote_percentage: %w", err) - } - p.VotePercentage = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: field is_chosen: %w", err) - } - p.IsChosen = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: field is_being_chosen: %w", err) - } - p.IsBeingChosen = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PollOption) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pollOption#63e97090 as nil") - } - b.ObjStart() - b.PutID("pollOption") - b.Comma() - b.FieldStart("text") - if err := p.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pollOption#63e97090: field text: %w", err) - } - b.Comma() - b.FieldStart("voter_count") - b.PutInt32(p.VoterCount) - b.Comma() - b.FieldStart("vote_percentage") - b.PutInt32(p.VotePercentage) - b.Comma() - b.FieldStart("is_chosen") - b.PutBool(p.IsChosen) - b.Comma() - b.FieldStart("is_being_chosen") - b.PutBool(p.IsBeingChosen) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PollOption) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pollOption#63e97090 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pollOption"); err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: %w", err) - } - case "text": - if err := p.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: field text: %w", err) - } - case "voter_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: field voter_count: %w", err) - } - p.VoterCount = value - case "vote_percentage": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: field vote_percentage: %w", err) - } - p.VotePercentage = value - case "is_chosen": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: field is_chosen: %w", err) - } - p.IsChosen = value - case "is_being_chosen": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pollOption#63e97090: field is_being_chosen: %w", err) - } - p.IsBeingChosen = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (p *PollOption) GetText() (value FormattedText) { - if p == nil { - return - } - return p.Text -} - -// GetVoterCount returns value of VoterCount field. -func (p *PollOption) GetVoterCount() (value int32) { - if p == nil { - return - } - return p.VoterCount -} - -// GetVotePercentage returns value of VotePercentage field. -func (p *PollOption) GetVotePercentage() (value int32) { - if p == nil { - return - } - return p.VotePercentage -} - -// GetIsChosen returns value of IsChosen field. -func (p *PollOption) GetIsChosen() (value bool) { - if p == nil { - return - } - return p.IsChosen -} - -// GetIsBeingChosen returns value of IsBeingChosen field. -func (p *PollOption) GetIsBeingChosen() (value bool) { - if p == nil { - return - } - return p.IsBeingChosen -} diff --git a/tdapi/tl_poll_type_gen.go b/tdapi/tl_poll_type_gen.go deleted file mode 100644 index 85a15da29..000000000 --- a/tdapi/tl_poll_type_gen.go +++ /dev/null @@ -1,536 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PollTypeRegular represents TL type `pollTypeRegular#2638f022`. -type PollTypeRegular struct { - // True, if multiple answer options can be chosen simultaneously - AllowMultipleAnswers bool -} - -// PollTypeRegularTypeID is TL type id of PollTypeRegular. -const PollTypeRegularTypeID = 0x2638f022 - -// construct implements constructor of PollTypeClass. -func (p PollTypeRegular) construct() PollTypeClass { return &p } - -// Ensuring interfaces in compile-time for PollTypeRegular. -var ( - _ bin.Encoder = &PollTypeRegular{} - _ bin.Decoder = &PollTypeRegular{} - _ bin.BareEncoder = &PollTypeRegular{} - _ bin.BareDecoder = &PollTypeRegular{} - - _ PollTypeClass = &PollTypeRegular{} -) - -func (p *PollTypeRegular) Zero() bool { - if p == nil { - return true - } - if !(p.AllowMultipleAnswers == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PollTypeRegular) String() string { - if p == nil { - return "PollTypeRegular(nil)" - } - type Alias PollTypeRegular - return fmt.Sprintf("PollTypeRegular%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PollTypeRegular) TypeID() uint32 { - return PollTypeRegularTypeID -} - -// TypeName returns name of type in TL schema. -func (*PollTypeRegular) TypeName() string { - return "pollTypeRegular" -} - -// TypeInfo returns info about TL type. -func (p *PollTypeRegular) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pollTypeRegular", - ID: PollTypeRegularTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AllowMultipleAnswers", - SchemaName: "allow_multiple_answers", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PollTypeRegular) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pollTypeRegular#2638f022 as nil") - } - b.PutID(PollTypeRegularTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PollTypeRegular) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pollTypeRegular#2638f022 as nil") - } - b.PutBool(p.AllowMultipleAnswers) - return nil -} - -// Decode implements bin.Decoder. -func (p *PollTypeRegular) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pollTypeRegular#2638f022 to nil") - } - if err := b.ConsumeID(PollTypeRegularTypeID); err != nil { - return fmt.Errorf("unable to decode pollTypeRegular#2638f022: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PollTypeRegular) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pollTypeRegular#2638f022 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pollTypeRegular#2638f022: field allow_multiple_answers: %w", err) - } - p.AllowMultipleAnswers = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PollTypeRegular) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pollTypeRegular#2638f022 as nil") - } - b.ObjStart() - b.PutID("pollTypeRegular") - b.Comma() - b.FieldStart("allow_multiple_answers") - b.PutBool(p.AllowMultipleAnswers) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PollTypeRegular) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pollTypeRegular#2638f022 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pollTypeRegular"); err != nil { - return fmt.Errorf("unable to decode pollTypeRegular#2638f022: %w", err) - } - case "allow_multiple_answers": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pollTypeRegular#2638f022: field allow_multiple_answers: %w", err) - } - p.AllowMultipleAnswers = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAllowMultipleAnswers returns value of AllowMultipleAnswers field. -func (p *PollTypeRegular) GetAllowMultipleAnswers() (value bool) { - if p == nil { - return - } - return p.AllowMultipleAnswers -} - -// PollTypeQuiz represents TL type `pollTypeQuiz#27293c99`. -type PollTypeQuiz struct { - // 0-based identifier of the correct answer option; -1 for a yet unanswered poll - CorrectOptionID int32 - // Text that is shown when the user chooses an incorrect answer or taps on the lamp icon; - // 0-200 characters with at most 2 line feeds; empty for a yet unanswered poll - Explanation FormattedText -} - -// PollTypeQuizTypeID is TL type id of PollTypeQuiz. -const PollTypeQuizTypeID = 0x27293c99 - -// construct implements constructor of PollTypeClass. -func (p PollTypeQuiz) construct() PollTypeClass { return &p } - -// Ensuring interfaces in compile-time for PollTypeQuiz. -var ( - _ bin.Encoder = &PollTypeQuiz{} - _ bin.Decoder = &PollTypeQuiz{} - _ bin.BareEncoder = &PollTypeQuiz{} - _ bin.BareDecoder = &PollTypeQuiz{} - - _ PollTypeClass = &PollTypeQuiz{} -) - -func (p *PollTypeQuiz) Zero() bool { - if p == nil { - return true - } - if !(p.CorrectOptionID == 0) { - return false - } - if !(p.Explanation.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PollTypeQuiz) String() string { - if p == nil { - return "PollTypeQuiz(nil)" - } - type Alias PollTypeQuiz - return fmt.Sprintf("PollTypeQuiz%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PollTypeQuiz) TypeID() uint32 { - return PollTypeQuizTypeID -} - -// TypeName returns name of type in TL schema. -func (*PollTypeQuiz) TypeName() string { - return "pollTypeQuiz" -} - -// TypeInfo returns info about TL type. -func (p *PollTypeQuiz) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pollTypeQuiz", - ID: PollTypeQuizTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CorrectOptionID", - SchemaName: "correct_option_id", - }, - { - Name: "Explanation", - SchemaName: "explanation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PollTypeQuiz) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pollTypeQuiz#27293c99 as nil") - } - b.PutID(PollTypeQuizTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PollTypeQuiz) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pollTypeQuiz#27293c99 as nil") - } - b.PutInt32(p.CorrectOptionID) - if err := p.Explanation.Encode(b); err != nil { - return fmt.Errorf("unable to encode pollTypeQuiz#27293c99: field explanation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PollTypeQuiz) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pollTypeQuiz#27293c99 to nil") - } - if err := b.ConsumeID(PollTypeQuizTypeID); err != nil { - return fmt.Errorf("unable to decode pollTypeQuiz#27293c99: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PollTypeQuiz) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pollTypeQuiz#27293c99 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pollTypeQuiz#27293c99: field correct_option_id: %w", err) - } - p.CorrectOptionID = value - } - { - if err := p.Explanation.Decode(b); err != nil { - return fmt.Errorf("unable to decode pollTypeQuiz#27293c99: field explanation: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PollTypeQuiz) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pollTypeQuiz#27293c99 as nil") - } - b.ObjStart() - b.PutID("pollTypeQuiz") - b.Comma() - b.FieldStart("correct_option_id") - b.PutInt32(p.CorrectOptionID) - b.Comma() - b.FieldStart("explanation") - if err := p.Explanation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pollTypeQuiz#27293c99: field explanation: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PollTypeQuiz) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pollTypeQuiz#27293c99 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pollTypeQuiz"); err != nil { - return fmt.Errorf("unable to decode pollTypeQuiz#27293c99: %w", err) - } - case "correct_option_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pollTypeQuiz#27293c99: field correct_option_id: %w", err) - } - p.CorrectOptionID = value - case "explanation": - if err := p.Explanation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pollTypeQuiz#27293c99: field explanation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCorrectOptionID returns value of CorrectOptionID field. -func (p *PollTypeQuiz) GetCorrectOptionID() (value int32) { - if p == nil { - return - } - return p.CorrectOptionID -} - -// GetExplanation returns value of Explanation field. -func (p *PollTypeQuiz) GetExplanation() (value FormattedText) { - if p == nil { - return - } - return p.Explanation -} - -// PollTypeClassName is schema name of PollTypeClass. -const PollTypeClassName = "PollType" - -// PollTypeClass represents PollType generic type. -// -// Example: -// -// g, err := tdapi.DecodePollType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PollTypeRegular: // pollTypeRegular#2638f022 -// case *tdapi.PollTypeQuiz: // pollTypeQuiz#27293c99 -// default: panic(v) -// } -type PollTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PollTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePollType implements binary de-serialization for PollTypeClass. -func DecodePollType(buf *bin.Buffer) (PollTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PollTypeRegularTypeID: - // Decoding pollTypeRegular#2638f022. - v := PollTypeRegular{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PollTypeClass: %w", err) - } - return &v, nil - case PollTypeQuizTypeID: - // Decoding pollTypeQuiz#27293c99. - v := PollTypeQuiz{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PollTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PollTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPollType implements binary de-serialization for PollTypeClass. -func DecodeTDLibJSONPollType(buf tdjson.Decoder) (PollTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "pollTypeRegular": - // Decoding pollTypeRegular#2638f022. - v := PollTypeRegular{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PollTypeClass: %w", err) - } - return &v, nil - case "pollTypeQuiz": - // Decoding pollTypeQuiz#27293c99. - v := PollTypeQuiz{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PollTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PollTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PollType boxes the PollTypeClass providing a helper. -type PollTypeBox struct { - PollType PollTypeClass -} - -// Decode implements bin.Decoder for PollTypeBox. -func (b *PollTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PollTypeBox to nil") - } - v, err := DecodePollType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PollType = v - return nil -} - -// Encode implements bin.Encode for PollTypeBox. -func (b *PollTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PollType == nil { - return fmt.Errorf("unable to encode PollTypeClass as nil") - } - return b.PollType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PollTypeBox. -func (b *PollTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PollTypeBox to nil") - } - v, err := DecodeTDLibJSONPollType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PollType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PollTypeBox. -func (b *PollTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PollType == nil { - return fmt.Errorf("unable to encode PollTypeClass as nil") - } - return b.PollType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_preliminary_upload_file_gen.go b/tdapi/tl_preliminary_upload_file_gen.go deleted file mode 100644 index 00593675c..000000000 --- a/tdapi/tl_preliminary_upload_file_gen.go +++ /dev/null @@ -1,293 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PreliminaryUploadFileRequest represents TL type `preliminaryUploadFile#70e7cb99`. -type PreliminaryUploadFileRequest struct { - // File to upload - File InputFileClass - // File type; pass null if unknown - FileType FileTypeClass - // Priority of the upload (1-32). The higher the priority, the earlier the file will be - // uploaded. If the priorities of two files are equal, then the first one for which - // preliminaryUploadFile was called will be uploaded first - Priority int32 -} - -// PreliminaryUploadFileRequestTypeID is TL type id of PreliminaryUploadFileRequest. -const PreliminaryUploadFileRequestTypeID = 0x70e7cb99 - -// Ensuring interfaces in compile-time for PreliminaryUploadFileRequest. -var ( - _ bin.Encoder = &PreliminaryUploadFileRequest{} - _ bin.Decoder = &PreliminaryUploadFileRequest{} - _ bin.BareEncoder = &PreliminaryUploadFileRequest{} - _ bin.BareDecoder = &PreliminaryUploadFileRequest{} -) - -func (p *PreliminaryUploadFileRequest) Zero() bool { - if p == nil { - return true - } - if !(p.File == nil) { - return false - } - if !(p.FileType == nil) { - return false - } - if !(p.Priority == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PreliminaryUploadFileRequest) String() string { - if p == nil { - return "PreliminaryUploadFileRequest(nil)" - } - type Alias PreliminaryUploadFileRequest - return fmt.Sprintf("PreliminaryUploadFileRequest%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PreliminaryUploadFileRequest) TypeID() uint32 { - return PreliminaryUploadFileRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*PreliminaryUploadFileRequest) TypeName() string { - return "preliminaryUploadFile" -} - -// TypeInfo returns info about TL type. -func (p *PreliminaryUploadFileRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "preliminaryUploadFile", - ID: PreliminaryUploadFileRequestTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "File", - SchemaName: "file", - }, - { - Name: "FileType", - SchemaName: "file_type", - }, - { - Name: "Priority", - SchemaName: "priority", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PreliminaryUploadFileRequest) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode preliminaryUploadFile#70e7cb99 as nil") - } - b.PutID(PreliminaryUploadFileRequestTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PreliminaryUploadFileRequest) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode preliminaryUploadFile#70e7cb99 as nil") - } - if p.File == nil { - return fmt.Errorf("unable to encode preliminaryUploadFile#70e7cb99: field file is nil") - } - if err := p.File.Encode(b); err != nil { - return fmt.Errorf("unable to encode preliminaryUploadFile#70e7cb99: field file: %w", err) - } - if p.FileType == nil { - return fmt.Errorf("unable to encode preliminaryUploadFile#70e7cb99: field file_type is nil") - } - if err := p.FileType.Encode(b); err != nil { - return fmt.Errorf("unable to encode preliminaryUploadFile#70e7cb99: field file_type: %w", err) - } - b.PutInt32(p.Priority) - return nil -} - -// Decode implements bin.Decoder. -func (p *PreliminaryUploadFileRequest) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode preliminaryUploadFile#70e7cb99 to nil") - } - if err := b.ConsumeID(PreliminaryUploadFileRequestTypeID); err != nil { - return fmt.Errorf("unable to decode preliminaryUploadFile#70e7cb99: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PreliminaryUploadFileRequest) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode preliminaryUploadFile#70e7cb99 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode preliminaryUploadFile#70e7cb99: field file: %w", err) - } - p.File = value - } - { - value, err := DecodeFileType(b) - if err != nil { - return fmt.Errorf("unable to decode preliminaryUploadFile#70e7cb99: field file_type: %w", err) - } - p.FileType = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode preliminaryUploadFile#70e7cb99: field priority: %w", err) - } - p.Priority = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PreliminaryUploadFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode preliminaryUploadFile#70e7cb99 as nil") - } - b.ObjStart() - b.PutID("preliminaryUploadFile") - b.Comma() - b.FieldStart("file") - if p.File == nil { - return fmt.Errorf("unable to encode preliminaryUploadFile#70e7cb99: field file is nil") - } - if err := p.File.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode preliminaryUploadFile#70e7cb99: field file: %w", err) - } - b.Comma() - b.FieldStart("file_type") - if p.FileType == nil { - return fmt.Errorf("unable to encode preliminaryUploadFile#70e7cb99: field file_type is nil") - } - if err := p.FileType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode preliminaryUploadFile#70e7cb99: field file_type: %w", err) - } - b.Comma() - b.FieldStart("priority") - b.PutInt32(p.Priority) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PreliminaryUploadFileRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode preliminaryUploadFile#70e7cb99 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("preliminaryUploadFile"); err != nil { - return fmt.Errorf("unable to decode preliminaryUploadFile#70e7cb99: %w", err) - } - case "file": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode preliminaryUploadFile#70e7cb99: field file: %w", err) - } - p.File = value - case "file_type": - value, err := DecodeTDLibJSONFileType(b) - if err != nil { - return fmt.Errorf("unable to decode preliminaryUploadFile#70e7cb99: field file_type: %w", err) - } - p.FileType = value - case "priority": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode preliminaryUploadFile#70e7cb99: field priority: %w", err) - } - p.Priority = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFile returns value of File field. -func (p *PreliminaryUploadFileRequest) GetFile() (value InputFileClass) { - if p == nil { - return - } - return p.File -} - -// GetFileType returns value of FileType field. -func (p *PreliminaryUploadFileRequest) GetFileType() (value FileTypeClass) { - if p == nil { - return - } - return p.FileType -} - -// GetPriority returns value of Priority field. -func (p *PreliminaryUploadFileRequest) GetPriority() (value int32) { - if p == nil { - return - } - return p.Priority -} - -// PreliminaryUploadFile invokes method preliminaryUploadFile#70e7cb99 returning error if any. -func (c *Client) PreliminaryUploadFile(ctx context.Context, request *PreliminaryUploadFileRequest) (*File, error) { - var result File - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_premium_feature_gen.go b/tdapi/tl_premium_feature_gen.go deleted file mode 100644 index 37fdbb478..000000000 --- a/tdapi/tl_premium_feature_gen.go +++ /dev/null @@ -1,3643 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumFeatureIncreasedLimits represents TL type `premiumFeatureIncreasedLimits#6a6be1b7`. -type PremiumFeatureIncreasedLimits struct { -} - -// PremiumFeatureIncreasedLimitsTypeID is TL type id of PremiumFeatureIncreasedLimits. -const PremiumFeatureIncreasedLimitsTypeID = 0x6a6be1b7 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureIncreasedLimits) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureIncreasedLimits. -var ( - _ bin.Encoder = &PremiumFeatureIncreasedLimits{} - _ bin.Decoder = &PremiumFeatureIncreasedLimits{} - _ bin.BareEncoder = &PremiumFeatureIncreasedLimits{} - _ bin.BareDecoder = &PremiumFeatureIncreasedLimits{} - - _ PremiumFeatureClass = &PremiumFeatureIncreasedLimits{} -) - -func (p *PremiumFeatureIncreasedLimits) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureIncreasedLimits) String() string { - if p == nil { - return "PremiumFeatureIncreasedLimits(nil)" - } - type Alias PremiumFeatureIncreasedLimits - return fmt.Sprintf("PremiumFeatureIncreasedLimits%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureIncreasedLimits) TypeID() uint32 { - return PremiumFeatureIncreasedLimitsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureIncreasedLimits) TypeName() string { - return "premiumFeatureIncreasedLimits" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureIncreasedLimits) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureIncreasedLimits", - ID: PremiumFeatureIncreasedLimitsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureIncreasedLimits) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureIncreasedLimits#6a6be1b7 as nil") - } - b.PutID(PremiumFeatureIncreasedLimitsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureIncreasedLimits) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureIncreasedLimits#6a6be1b7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureIncreasedLimits) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureIncreasedLimits#6a6be1b7 to nil") - } - if err := b.ConsumeID(PremiumFeatureIncreasedLimitsTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureIncreasedLimits#6a6be1b7: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureIncreasedLimits) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureIncreasedLimits#6a6be1b7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureIncreasedLimits) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureIncreasedLimits#6a6be1b7 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureIncreasedLimits") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureIncreasedLimits) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureIncreasedLimits#6a6be1b7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureIncreasedLimits"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureIncreasedLimits#6a6be1b7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureIncreasedUploadFileSize represents TL type `premiumFeatureIncreasedUploadFileSize#6ccce473`. -type PremiumFeatureIncreasedUploadFileSize struct { -} - -// PremiumFeatureIncreasedUploadFileSizeTypeID is TL type id of PremiumFeatureIncreasedUploadFileSize. -const PremiumFeatureIncreasedUploadFileSizeTypeID = 0x6ccce473 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureIncreasedUploadFileSize) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureIncreasedUploadFileSize. -var ( - _ bin.Encoder = &PremiumFeatureIncreasedUploadFileSize{} - _ bin.Decoder = &PremiumFeatureIncreasedUploadFileSize{} - _ bin.BareEncoder = &PremiumFeatureIncreasedUploadFileSize{} - _ bin.BareDecoder = &PremiumFeatureIncreasedUploadFileSize{} - - _ PremiumFeatureClass = &PremiumFeatureIncreasedUploadFileSize{} -) - -func (p *PremiumFeatureIncreasedUploadFileSize) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureIncreasedUploadFileSize) String() string { - if p == nil { - return "PremiumFeatureIncreasedUploadFileSize(nil)" - } - type Alias PremiumFeatureIncreasedUploadFileSize - return fmt.Sprintf("PremiumFeatureIncreasedUploadFileSize%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureIncreasedUploadFileSize) TypeID() uint32 { - return PremiumFeatureIncreasedUploadFileSizeTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureIncreasedUploadFileSize) TypeName() string { - return "premiumFeatureIncreasedUploadFileSize" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureIncreasedUploadFileSize) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureIncreasedUploadFileSize", - ID: PremiumFeatureIncreasedUploadFileSizeTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureIncreasedUploadFileSize) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureIncreasedUploadFileSize#6ccce473 as nil") - } - b.PutID(PremiumFeatureIncreasedUploadFileSizeTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureIncreasedUploadFileSize) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureIncreasedUploadFileSize#6ccce473 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureIncreasedUploadFileSize) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureIncreasedUploadFileSize#6ccce473 to nil") - } - if err := b.ConsumeID(PremiumFeatureIncreasedUploadFileSizeTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureIncreasedUploadFileSize#6ccce473: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureIncreasedUploadFileSize) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureIncreasedUploadFileSize#6ccce473 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureIncreasedUploadFileSize) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureIncreasedUploadFileSize#6ccce473 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureIncreasedUploadFileSize") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureIncreasedUploadFileSize) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureIncreasedUploadFileSize#6ccce473 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureIncreasedUploadFileSize"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureIncreasedUploadFileSize#6ccce473: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureImprovedDownloadSpeed represents TL type `premiumFeatureImprovedDownloadSpeed#f00b4a3e`. -type PremiumFeatureImprovedDownloadSpeed struct { -} - -// PremiumFeatureImprovedDownloadSpeedTypeID is TL type id of PremiumFeatureImprovedDownloadSpeed. -const PremiumFeatureImprovedDownloadSpeedTypeID = 0xf00b4a3e - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureImprovedDownloadSpeed) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureImprovedDownloadSpeed. -var ( - _ bin.Encoder = &PremiumFeatureImprovedDownloadSpeed{} - _ bin.Decoder = &PremiumFeatureImprovedDownloadSpeed{} - _ bin.BareEncoder = &PremiumFeatureImprovedDownloadSpeed{} - _ bin.BareDecoder = &PremiumFeatureImprovedDownloadSpeed{} - - _ PremiumFeatureClass = &PremiumFeatureImprovedDownloadSpeed{} -) - -func (p *PremiumFeatureImprovedDownloadSpeed) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureImprovedDownloadSpeed) String() string { - if p == nil { - return "PremiumFeatureImprovedDownloadSpeed(nil)" - } - type Alias PremiumFeatureImprovedDownloadSpeed - return fmt.Sprintf("PremiumFeatureImprovedDownloadSpeed%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureImprovedDownloadSpeed) TypeID() uint32 { - return PremiumFeatureImprovedDownloadSpeedTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureImprovedDownloadSpeed) TypeName() string { - return "premiumFeatureImprovedDownloadSpeed" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureImprovedDownloadSpeed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureImprovedDownloadSpeed", - ID: PremiumFeatureImprovedDownloadSpeedTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureImprovedDownloadSpeed) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureImprovedDownloadSpeed#f00b4a3e as nil") - } - b.PutID(PremiumFeatureImprovedDownloadSpeedTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureImprovedDownloadSpeed) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureImprovedDownloadSpeed#f00b4a3e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureImprovedDownloadSpeed) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureImprovedDownloadSpeed#f00b4a3e to nil") - } - if err := b.ConsumeID(PremiumFeatureImprovedDownloadSpeedTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureImprovedDownloadSpeed#f00b4a3e: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureImprovedDownloadSpeed) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureImprovedDownloadSpeed#f00b4a3e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureImprovedDownloadSpeed) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureImprovedDownloadSpeed#f00b4a3e as nil") - } - b.ObjStart() - b.PutID("premiumFeatureImprovedDownloadSpeed") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureImprovedDownloadSpeed) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureImprovedDownloadSpeed#f00b4a3e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureImprovedDownloadSpeed"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureImprovedDownloadSpeed#f00b4a3e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureVoiceRecognition represents TL type `premiumFeatureVoiceRecognition#4cc89fde`. -type PremiumFeatureVoiceRecognition struct { -} - -// PremiumFeatureVoiceRecognitionTypeID is TL type id of PremiumFeatureVoiceRecognition. -const PremiumFeatureVoiceRecognitionTypeID = 0x4cc89fde - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureVoiceRecognition) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureVoiceRecognition. -var ( - _ bin.Encoder = &PremiumFeatureVoiceRecognition{} - _ bin.Decoder = &PremiumFeatureVoiceRecognition{} - _ bin.BareEncoder = &PremiumFeatureVoiceRecognition{} - _ bin.BareDecoder = &PremiumFeatureVoiceRecognition{} - - _ PremiumFeatureClass = &PremiumFeatureVoiceRecognition{} -) - -func (p *PremiumFeatureVoiceRecognition) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureVoiceRecognition) String() string { - if p == nil { - return "PremiumFeatureVoiceRecognition(nil)" - } - type Alias PremiumFeatureVoiceRecognition - return fmt.Sprintf("PremiumFeatureVoiceRecognition%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureVoiceRecognition) TypeID() uint32 { - return PremiumFeatureVoiceRecognitionTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureVoiceRecognition) TypeName() string { - return "premiumFeatureVoiceRecognition" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureVoiceRecognition) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureVoiceRecognition", - ID: PremiumFeatureVoiceRecognitionTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureVoiceRecognition) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureVoiceRecognition#4cc89fde as nil") - } - b.PutID(PremiumFeatureVoiceRecognitionTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureVoiceRecognition) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureVoiceRecognition#4cc89fde as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureVoiceRecognition) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureVoiceRecognition#4cc89fde to nil") - } - if err := b.ConsumeID(PremiumFeatureVoiceRecognitionTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureVoiceRecognition#4cc89fde: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureVoiceRecognition) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureVoiceRecognition#4cc89fde to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureVoiceRecognition) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureVoiceRecognition#4cc89fde as nil") - } - b.ObjStart() - b.PutID("premiumFeatureVoiceRecognition") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureVoiceRecognition) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureVoiceRecognition#4cc89fde to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureVoiceRecognition"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureVoiceRecognition#4cc89fde: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureDisabledAds represents TL type `premiumFeatureDisabledAds#8847624a`. -type PremiumFeatureDisabledAds struct { -} - -// PremiumFeatureDisabledAdsTypeID is TL type id of PremiumFeatureDisabledAds. -const PremiumFeatureDisabledAdsTypeID = 0x8847624a - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureDisabledAds) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureDisabledAds. -var ( - _ bin.Encoder = &PremiumFeatureDisabledAds{} - _ bin.Decoder = &PremiumFeatureDisabledAds{} - _ bin.BareEncoder = &PremiumFeatureDisabledAds{} - _ bin.BareDecoder = &PremiumFeatureDisabledAds{} - - _ PremiumFeatureClass = &PremiumFeatureDisabledAds{} -) - -func (p *PremiumFeatureDisabledAds) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureDisabledAds) String() string { - if p == nil { - return "PremiumFeatureDisabledAds(nil)" - } - type Alias PremiumFeatureDisabledAds - return fmt.Sprintf("PremiumFeatureDisabledAds%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureDisabledAds) TypeID() uint32 { - return PremiumFeatureDisabledAdsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureDisabledAds) TypeName() string { - return "premiumFeatureDisabledAds" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureDisabledAds) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureDisabledAds", - ID: PremiumFeatureDisabledAdsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureDisabledAds) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureDisabledAds#8847624a as nil") - } - b.PutID(PremiumFeatureDisabledAdsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureDisabledAds) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureDisabledAds#8847624a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureDisabledAds) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureDisabledAds#8847624a to nil") - } - if err := b.ConsumeID(PremiumFeatureDisabledAdsTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureDisabledAds#8847624a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureDisabledAds) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureDisabledAds#8847624a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureDisabledAds) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureDisabledAds#8847624a as nil") - } - b.ObjStart() - b.PutID("premiumFeatureDisabledAds") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureDisabledAds) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureDisabledAds#8847624a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureDisabledAds"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureDisabledAds#8847624a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureUniqueReactions represents TL type `premiumFeatureUniqueReactions#2db3b017`. -type PremiumFeatureUniqueReactions struct { -} - -// PremiumFeatureUniqueReactionsTypeID is TL type id of PremiumFeatureUniqueReactions. -const PremiumFeatureUniqueReactionsTypeID = 0x2db3b017 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureUniqueReactions) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureUniqueReactions. -var ( - _ bin.Encoder = &PremiumFeatureUniqueReactions{} - _ bin.Decoder = &PremiumFeatureUniqueReactions{} - _ bin.BareEncoder = &PremiumFeatureUniqueReactions{} - _ bin.BareDecoder = &PremiumFeatureUniqueReactions{} - - _ PremiumFeatureClass = &PremiumFeatureUniqueReactions{} -) - -func (p *PremiumFeatureUniqueReactions) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureUniqueReactions) String() string { - if p == nil { - return "PremiumFeatureUniqueReactions(nil)" - } - type Alias PremiumFeatureUniqueReactions - return fmt.Sprintf("PremiumFeatureUniqueReactions%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureUniqueReactions) TypeID() uint32 { - return PremiumFeatureUniqueReactionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureUniqueReactions) TypeName() string { - return "premiumFeatureUniqueReactions" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureUniqueReactions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureUniqueReactions", - ID: PremiumFeatureUniqueReactionsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureUniqueReactions) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureUniqueReactions#2db3b017 as nil") - } - b.PutID(PremiumFeatureUniqueReactionsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureUniqueReactions) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureUniqueReactions#2db3b017 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureUniqueReactions) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureUniqueReactions#2db3b017 to nil") - } - if err := b.ConsumeID(PremiumFeatureUniqueReactionsTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureUniqueReactions#2db3b017: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureUniqueReactions) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureUniqueReactions#2db3b017 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureUniqueReactions) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureUniqueReactions#2db3b017 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureUniqueReactions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureUniqueReactions) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureUniqueReactions#2db3b017 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureUniqueReactions"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureUniqueReactions#2db3b017: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureUniqueStickers represents TL type `premiumFeatureUniqueStickers#82b97c00`. -type PremiumFeatureUniqueStickers struct { -} - -// PremiumFeatureUniqueStickersTypeID is TL type id of PremiumFeatureUniqueStickers. -const PremiumFeatureUniqueStickersTypeID = 0x82b97c00 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureUniqueStickers) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureUniqueStickers. -var ( - _ bin.Encoder = &PremiumFeatureUniqueStickers{} - _ bin.Decoder = &PremiumFeatureUniqueStickers{} - _ bin.BareEncoder = &PremiumFeatureUniqueStickers{} - _ bin.BareDecoder = &PremiumFeatureUniqueStickers{} - - _ PremiumFeatureClass = &PremiumFeatureUniqueStickers{} -) - -func (p *PremiumFeatureUniqueStickers) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureUniqueStickers) String() string { - if p == nil { - return "PremiumFeatureUniqueStickers(nil)" - } - type Alias PremiumFeatureUniqueStickers - return fmt.Sprintf("PremiumFeatureUniqueStickers%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureUniqueStickers) TypeID() uint32 { - return PremiumFeatureUniqueStickersTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureUniqueStickers) TypeName() string { - return "premiumFeatureUniqueStickers" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureUniqueStickers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureUniqueStickers", - ID: PremiumFeatureUniqueStickersTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureUniqueStickers) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureUniqueStickers#82b97c00 as nil") - } - b.PutID(PremiumFeatureUniqueStickersTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureUniqueStickers) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureUniqueStickers#82b97c00 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureUniqueStickers) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureUniqueStickers#82b97c00 to nil") - } - if err := b.ConsumeID(PremiumFeatureUniqueStickersTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureUniqueStickers#82b97c00: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureUniqueStickers) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureUniqueStickers#82b97c00 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureUniqueStickers) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureUniqueStickers#82b97c00 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureUniqueStickers") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureUniqueStickers) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureUniqueStickers#82b97c00 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureUniqueStickers"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureUniqueStickers#82b97c00: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureCustomEmoji represents TL type `premiumFeatureCustomEmoji#4f6ddb4c`. -type PremiumFeatureCustomEmoji struct { -} - -// PremiumFeatureCustomEmojiTypeID is TL type id of PremiumFeatureCustomEmoji. -const PremiumFeatureCustomEmojiTypeID = 0x4f6ddb4c - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureCustomEmoji) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureCustomEmoji. -var ( - _ bin.Encoder = &PremiumFeatureCustomEmoji{} - _ bin.Decoder = &PremiumFeatureCustomEmoji{} - _ bin.BareEncoder = &PremiumFeatureCustomEmoji{} - _ bin.BareDecoder = &PremiumFeatureCustomEmoji{} - - _ PremiumFeatureClass = &PremiumFeatureCustomEmoji{} -) - -func (p *PremiumFeatureCustomEmoji) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureCustomEmoji) String() string { - if p == nil { - return "PremiumFeatureCustomEmoji(nil)" - } - type Alias PremiumFeatureCustomEmoji - return fmt.Sprintf("PremiumFeatureCustomEmoji%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureCustomEmoji) TypeID() uint32 { - return PremiumFeatureCustomEmojiTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureCustomEmoji) TypeName() string { - return "premiumFeatureCustomEmoji" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureCustomEmoji) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureCustomEmoji", - ID: PremiumFeatureCustomEmojiTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureCustomEmoji) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureCustomEmoji#4f6ddb4c as nil") - } - b.PutID(PremiumFeatureCustomEmojiTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureCustomEmoji) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureCustomEmoji#4f6ddb4c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureCustomEmoji) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureCustomEmoji#4f6ddb4c to nil") - } - if err := b.ConsumeID(PremiumFeatureCustomEmojiTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureCustomEmoji#4f6ddb4c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureCustomEmoji) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureCustomEmoji#4f6ddb4c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureCustomEmoji) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureCustomEmoji#4f6ddb4c as nil") - } - b.ObjStart() - b.PutID("premiumFeatureCustomEmoji") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureCustomEmoji) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureCustomEmoji#4f6ddb4c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureCustomEmoji"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureCustomEmoji#4f6ddb4c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureAdvancedChatManagement represents TL type `premiumFeatureAdvancedChatManagement#2f774d1a`. -type PremiumFeatureAdvancedChatManagement struct { -} - -// PremiumFeatureAdvancedChatManagementTypeID is TL type id of PremiumFeatureAdvancedChatManagement. -const PremiumFeatureAdvancedChatManagementTypeID = 0x2f774d1a - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureAdvancedChatManagement) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureAdvancedChatManagement. -var ( - _ bin.Encoder = &PremiumFeatureAdvancedChatManagement{} - _ bin.Decoder = &PremiumFeatureAdvancedChatManagement{} - _ bin.BareEncoder = &PremiumFeatureAdvancedChatManagement{} - _ bin.BareDecoder = &PremiumFeatureAdvancedChatManagement{} - - _ PremiumFeatureClass = &PremiumFeatureAdvancedChatManagement{} -) - -func (p *PremiumFeatureAdvancedChatManagement) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureAdvancedChatManagement) String() string { - if p == nil { - return "PremiumFeatureAdvancedChatManagement(nil)" - } - type Alias PremiumFeatureAdvancedChatManagement - return fmt.Sprintf("PremiumFeatureAdvancedChatManagement%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureAdvancedChatManagement) TypeID() uint32 { - return PremiumFeatureAdvancedChatManagementTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureAdvancedChatManagement) TypeName() string { - return "premiumFeatureAdvancedChatManagement" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureAdvancedChatManagement) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureAdvancedChatManagement", - ID: PremiumFeatureAdvancedChatManagementTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureAdvancedChatManagement) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAdvancedChatManagement#2f774d1a as nil") - } - b.PutID(PremiumFeatureAdvancedChatManagementTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureAdvancedChatManagement) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAdvancedChatManagement#2f774d1a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureAdvancedChatManagement) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAdvancedChatManagement#2f774d1a to nil") - } - if err := b.ConsumeID(PremiumFeatureAdvancedChatManagementTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureAdvancedChatManagement#2f774d1a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureAdvancedChatManagement) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAdvancedChatManagement#2f774d1a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureAdvancedChatManagement) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAdvancedChatManagement#2f774d1a as nil") - } - b.ObjStart() - b.PutID("premiumFeatureAdvancedChatManagement") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureAdvancedChatManagement) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAdvancedChatManagement#2f774d1a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureAdvancedChatManagement"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureAdvancedChatManagement#2f774d1a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureProfileBadge represents TL type `premiumFeatureProfileBadge#ded30c2`. -type PremiumFeatureProfileBadge struct { -} - -// PremiumFeatureProfileBadgeTypeID is TL type id of PremiumFeatureProfileBadge. -const PremiumFeatureProfileBadgeTypeID = 0xded30c2 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureProfileBadge) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureProfileBadge. -var ( - _ bin.Encoder = &PremiumFeatureProfileBadge{} - _ bin.Decoder = &PremiumFeatureProfileBadge{} - _ bin.BareEncoder = &PremiumFeatureProfileBadge{} - _ bin.BareDecoder = &PremiumFeatureProfileBadge{} - - _ PremiumFeatureClass = &PremiumFeatureProfileBadge{} -) - -func (p *PremiumFeatureProfileBadge) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureProfileBadge) String() string { - if p == nil { - return "PremiumFeatureProfileBadge(nil)" - } - type Alias PremiumFeatureProfileBadge - return fmt.Sprintf("PremiumFeatureProfileBadge%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureProfileBadge) TypeID() uint32 { - return PremiumFeatureProfileBadgeTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureProfileBadge) TypeName() string { - return "premiumFeatureProfileBadge" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureProfileBadge) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureProfileBadge", - ID: PremiumFeatureProfileBadgeTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureProfileBadge) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureProfileBadge#ded30c2 as nil") - } - b.PutID(PremiumFeatureProfileBadgeTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureProfileBadge) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureProfileBadge#ded30c2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureProfileBadge) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureProfileBadge#ded30c2 to nil") - } - if err := b.ConsumeID(PremiumFeatureProfileBadgeTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureProfileBadge#ded30c2: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureProfileBadge) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureProfileBadge#ded30c2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureProfileBadge) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureProfileBadge#ded30c2 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureProfileBadge") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureProfileBadge) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureProfileBadge#ded30c2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureProfileBadge"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureProfileBadge#ded30c2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureEmojiStatus represents TL type `premiumFeatureEmojiStatus#fdd2cce1`. -type PremiumFeatureEmojiStatus struct { -} - -// PremiumFeatureEmojiStatusTypeID is TL type id of PremiumFeatureEmojiStatus. -const PremiumFeatureEmojiStatusTypeID = 0xfdd2cce1 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureEmojiStatus) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureEmojiStatus. -var ( - _ bin.Encoder = &PremiumFeatureEmojiStatus{} - _ bin.Decoder = &PremiumFeatureEmojiStatus{} - _ bin.BareEncoder = &PremiumFeatureEmojiStatus{} - _ bin.BareDecoder = &PremiumFeatureEmojiStatus{} - - _ PremiumFeatureClass = &PremiumFeatureEmojiStatus{} -) - -func (p *PremiumFeatureEmojiStatus) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureEmojiStatus) String() string { - if p == nil { - return "PremiumFeatureEmojiStatus(nil)" - } - type Alias PremiumFeatureEmojiStatus - return fmt.Sprintf("PremiumFeatureEmojiStatus%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureEmojiStatus) TypeID() uint32 { - return PremiumFeatureEmojiStatusTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureEmojiStatus) TypeName() string { - return "premiumFeatureEmojiStatus" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureEmojiStatus) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureEmojiStatus", - ID: PremiumFeatureEmojiStatusTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureEmojiStatus) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureEmojiStatus#fdd2cce1 as nil") - } - b.PutID(PremiumFeatureEmojiStatusTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureEmojiStatus) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureEmojiStatus#fdd2cce1 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureEmojiStatus) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureEmojiStatus#fdd2cce1 to nil") - } - if err := b.ConsumeID(PremiumFeatureEmojiStatusTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureEmojiStatus#fdd2cce1: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureEmojiStatus) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureEmojiStatus#fdd2cce1 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureEmojiStatus) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureEmojiStatus#fdd2cce1 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureEmojiStatus") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureEmojiStatus) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureEmojiStatus#fdd2cce1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureEmojiStatus"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureEmojiStatus#fdd2cce1: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureAnimatedProfilePhoto represents TL type `premiumFeatureAnimatedProfilePhoto#f9fecce6`. -type PremiumFeatureAnimatedProfilePhoto struct { -} - -// PremiumFeatureAnimatedProfilePhotoTypeID is TL type id of PremiumFeatureAnimatedProfilePhoto. -const PremiumFeatureAnimatedProfilePhotoTypeID = 0xf9fecce6 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureAnimatedProfilePhoto) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureAnimatedProfilePhoto. -var ( - _ bin.Encoder = &PremiumFeatureAnimatedProfilePhoto{} - _ bin.Decoder = &PremiumFeatureAnimatedProfilePhoto{} - _ bin.BareEncoder = &PremiumFeatureAnimatedProfilePhoto{} - _ bin.BareDecoder = &PremiumFeatureAnimatedProfilePhoto{} - - _ PremiumFeatureClass = &PremiumFeatureAnimatedProfilePhoto{} -) - -func (p *PremiumFeatureAnimatedProfilePhoto) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureAnimatedProfilePhoto) String() string { - if p == nil { - return "PremiumFeatureAnimatedProfilePhoto(nil)" - } - type Alias PremiumFeatureAnimatedProfilePhoto - return fmt.Sprintf("PremiumFeatureAnimatedProfilePhoto%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureAnimatedProfilePhoto) TypeID() uint32 { - return PremiumFeatureAnimatedProfilePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureAnimatedProfilePhoto) TypeName() string { - return "premiumFeatureAnimatedProfilePhoto" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureAnimatedProfilePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureAnimatedProfilePhoto", - ID: PremiumFeatureAnimatedProfilePhotoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureAnimatedProfilePhoto) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAnimatedProfilePhoto#f9fecce6 as nil") - } - b.PutID(PremiumFeatureAnimatedProfilePhotoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureAnimatedProfilePhoto) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAnimatedProfilePhoto#f9fecce6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureAnimatedProfilePhoto) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAnimatedProfilePhoto#f9fecce6 to nil") - } - if err := b.ConsumeID(PremiumFeatureAnimatedProfilePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureAnimatedProfilePhoto#f9fecce6: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureAnimatedProfilePhoto) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAnimatedProfilePhoto#f9fecce6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureAnimatedProfilePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAnimatedProfilePhoto#f9fecce6 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureAnimatedProfilePhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureAnimatedProfilePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAnimatedProfilePhoto#f9fecce6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureAnimatedProfilePhoto"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureAnimatedProfilePhoto#f9fecce6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureForumTopicIcon represents TL type `premiumFeatureForumTopicIcon#ceef6342`. -type PremiumFeatureForumTopicIcon struct { -} - -// PremiumFeatureForumTopicIconTypeID is TL type id of PremiumFeatureForumTopicIcon. -const PremiumFeatureForumTopicIconTypeID = 0xceef6342 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureForumTopicIcon) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureForumTopicIcon. -var ( - _ bin.Encoder = &PremiumFeatureForumTopicIcon{} - _ bin.Decoder = &PremiumFeatureForumTopicIcon{} - _ bin.BareEncoder = &PremiumFeatureForumTopicIcon{} - _ bin.BareDecoder = &PremiumFeatureForumTopicIcon{} - - _ PremiumFeatureClass = &PremiumFeatureForumTopicIcon{} -) - -func (p *PremiumFeatureForumTopicIcon) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureForumTopicIcon) String() string { - if p == nil { - return "PremiumFeatureForumTopicIcon(nil)" - } - type Alias PremiumFeatureForumTopicIcon - return fmt.Sprintf("PremiumFeatureForumTopicIcon%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureForumTopicIcon) TypeID() uint32 { - return PremiumFeatureForumTopicIconTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureForumTopicIcon) TypeName() string { - return "premiumFeatureForumTopicIcon" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureForumTopicIcon) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureForumTopicIcon", - ID: PremiumFeatureForumTopicIconTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureForumTopicIcon) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureForumTopicIcon#ceef6342 as nil") - } - b.PutID(PremiumFeatureForumTopicIconTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureForumTopicIcon) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureForumTopicIcon#ceef6342 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureForumTopicIcon) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureForumTopicIcon#ceef6342 to nil") - } - if err := b.ConsumeID(PremiumFeatureForumTopicIconTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureForumTopicIcon#ceef6342: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureForumTopicIcon) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureForumTopicIcon#ceef6342 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureForumTopicIcon) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureForumTopicIcon#ceef6342 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureForumTopicIcon") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureForumTopicIcon) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureForumTopicIcon#ceef6342 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureForumTopicIcon"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureForumTopicIcon#ceef6342: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureAppIcons represents TL type `premiumFeatureAppIcons#5e79f489`. -type PremiumFeatureAppIcons struct { -} - -// PremiumFeatureAppIconsTypeID is TL type id of PremiumFeatureAppIcons. -const PremiumFeatureAppIconsTypeID = 0x5e79f489 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureAppIcons) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureAppIcons. -var ( - _ bin.Encoder = &PremiumFeatureAppIcons{} - _ bin.Decoder = &PremiumFeatureAppIcons{} - _ bin.BareEncoder = &PremiumFeatureAppIcons{} - _ bin.BareDecoder = &PremiumFeatureAppIcons{} - - _ PremiumFeatureClass = &PremiumFeatureAppIcons{} -) - -func (p *PremiumFeatureAppIcons) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureAppIcons) String() string { - if p == nil { - return "PremiumFeatureAppIcons(nil)" - } - type Alias PremiumFeatureAppIcons - return fmt.Sprintf("PremiumFeatureAppIcons%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureAppIcons) TypeID() uint32 { - return PremiumFeatureAppIconsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureAppIcons) TypeName() string { - return "premiumFeatureAppIcons" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureAppIcons) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureAppIcons", - ID: PremiumFeatureAppIconsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureAppIcons) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAppIcons#5e79f489 as nil") - } - b.PutID(PremiumFeatureAppIconsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureAppIcons) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAppIcons#5e79f489 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureAppIcons) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAppIcons#5e79f489 to nil") - } - if err := b.ConsumeID(PremiumFeatureAppIconsTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureAppIcons#5e79f489: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureAppIcons) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAppIcons#5e79f489 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureAppIcons) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAppIcons#5e79f489 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureAppIcons") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureAppIcons) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAppIcons#5e79f489 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureAppIcons"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureAppIcons#5e79f489: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureRealTimeChatTranslation represents TL type `premiumFeatureRealTimeChatTranslation#bbd80280`. -type PremiumFeatureRealTimeChatTranslation struct { -} - -// PremiumFeatureRealTimeChatTranslationTypeID is TL type id of PremiumFeatureRealTimeChatTranslation. -const PremiumFeatureRealTimeChatTranslationTypeID = 0xbbd80280 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureRealTimeChatTranslation) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureRealTimeChatTranslation. -var ( - _ bin.Encoder = &PremiumFeatureRealTimeChatTranslation{} - _ bin.Decoder = &PremiumFeatureRealTimeChatTranslation{} - _ bin.BareEncoder = &PremiumFeatureRealTimeChatTranslation{} - _ bin.BareDecoder = &PremiumFeatureRealTimeChatTranslation{} - - _ PremiumFeatureClass = &PremiumFeatureRealTimeChatTranslation{} -) - -func (p *PremiumFeatureRealTimeChatTranslation) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureRealTimeChatTranslation) String() string { - if p == nil { - return "PremiumFeatureRealTimeChatTranslation(nil)" - } - type Alias PremiumFeatureRealTimeChatTranslation - return fmt.Sprintf("PremiumFeatureRealTimeChatTranslation%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureRealTimeChatTranslation) TypeID() uint32 { - return PremiumFeatureRealTimeChatTranslationTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureRealTimeChatTranslation) TypeName() string { - return "premiumFeatureRealTimeChatTranslation" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureRealTimeChatTranslation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureRealTimeChatTranslation", - ID: PremiumFeatureRealTimeChatTranslationTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureRealTimeChatTranslation) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureRealTimeChatTranslation#bbd80280 as nil") - } - b.PutID(PremiumFeatureRealTimeChatTranslationTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureRealTimeChatTranslation) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureRealTimeChatTranslation#bbd80280 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureRealTimeChatTranslation) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureRealTimeChatTranslation#bbd80280 to nil") - } - if err := b.ConsumeID(PremiumFeatureRealTimeChatTranslationTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureRealTimeChatTranslation#bbd80280: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureRealTimeChatTranslation) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureRealTimeChatTranslation#bbd80280 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureRealTimeChatTranslation) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureRealTimeChatTranslation#bbd80280 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureRealTimeChatTranslation") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureRealTimeChatTranslation) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureRealTimeChatTranslation#bbd80280 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureRealTimeChatTranslation"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureRealTimeChatTranslation#bbd80280: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureUpgradedStories represents TL type `premiumFeatureUpgradedStories#9008051b`. -type PremiumFeatureUpgradedStories struct { -} - -// PremiumFeatureUpgradedStoriesTypeID is TL type id of PremiumFeatureUpgradedStories. -const PremiumFeatureUpgradedStoriesTypeID = 0x9008051b - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureUpgradedStories) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureUpgradedStories. -var ( - _ bin.Encoder = &PremiumFeatureUpgradedStories{} - _ bin.Decoder = &PremiumFeatureUpgradedStories{} - _ bin.BareEncoder = &PremiumFeatureUpgradedStories{} - _ bin.BareDecoder = &PremiumFeatureUpgradedStories{} - - _ PremiumFeatureClass = &PremiumFeatureUpgradedStories{} -) - -func (p *PremiumFeatureUpgradedStories) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureUpgradedStories) String() string { - if p == nil { - return "PremiumFeatureUpgradedStories(nil)" - } - type Alias PremiumFeatureUpgradedStories - return fmt.Sprintf("PremiumFeatureUpgradedStories%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureUpgradedStories) TypeID() uint32 { - return PremiumFeatureUpgradedStoriesTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureUpgradedStories) TypeName() string { - return "premiumFeatureUpgradedStories" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureUpgradedStories) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureUpgradedStories", - ID: PremiumFeatureUpgradedStoriesTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureUpgradedStories) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureUpgradedStories#9008051b as nil") - } - b.PutID(PremiumFeatureUpgradedStoriesTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureUpgradedStories) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureUpgradedStories#9008051b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureUpgradedStories) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureUpgradedStories#9008051b to nil") - } - if err := b.ConsumeID(PremiumFeatureUpgradedStoriesTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureUpgradedStories#9008051b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureUpgradedStories) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureUpgradedStories#9008051b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureUpgradedStories) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureUpgradedStories#9008051b as nil") - } - b.ObjStart() - b.PutID("premiumFeatureUpgradedStories") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureUpgradedStories) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureUpgradedStories#9008051b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureUpgradedStories"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureUpgradedStories#9008051b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureChatBoost represents TL type `premiumFeatureChatBoost#5df89f1b`. -type PremiumFeatureChatBoost struct { -} - -// PremiumFeatureChatBoostTypeID is TL type id of PremiumFeatureChatBoost. -const PremiumFeatureChatBoostTypeID = 0x5df89f1b - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureChatBoost) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureChatBoost. -var ( - _ bin.Encoder = &PremiumFeatureChatBoost{} - _ bin.Decoder = &PremiumFeatureChatBoost{} - _ bin.BareEncoder = &PremiumFeatureChatBoost{} - _ bin.BareDecoder = &PremiumFeatureChatBoost{} - - _ PremiumFeatureClass = &PremiumFeatureChatBoost{} -) - -func (p *PremiumFeatureChatBoost) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureChatBoost) String() string { - if p == nil { - return "PremiumFeatureChatBoost(nil)" - } - type Alias PremiumFeatureChatBoost - return fmt.Sprintf("PremiumFeatureChatBoost%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureChatBoost) TypeID() uint32 { - return PremiumFeatureChatBoostTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureChatBoost) TypeName() string { - return "premiumFeatureChatBoost" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureChatBoost) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureChatBoost", - ID: PremiumFeatureChatBoostTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureChatBoost) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureChatBoost#5df89f1b as nil") - } - b.PutID(PremiumFeatureChatBoostTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureChatBoost) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureChatBoost#5df89f1b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureChatBoost) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureChatBoost#5df89f1b to nil") - } - if err := b.ConsumeID(PremiumFeatureChatBoostTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureChatBoost#5df89f1b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureChatBoost) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureChatBoost#5df89f1b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureChatBoost) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureChatBoost#5df89f1b as nil") - } - b.ObjStart() - b.PutID("premiumFeatureChatBoost") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureChatBoost) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureChatBoost#5df89f1b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureChatBoost"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureChatBoost#5df89f1b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureAccentColor represents TL type `premiumFeatureAccentColor#361ac59e`. -type PremiumFeatureAccentColor struct { -} - -// PremiumFeatureAccentColorTypeID is TL type id of PremiumFeatureAccentColor. -const PremiumFeatureAccentColorTypeID = 0x361ac59e - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureAccentColor) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureAccentColor. -var ( - _ bin.Encoder = &PremiumFeatureAccentColor{} - _ bin.Decoder = &PremiumFeatureAccentColor{} - _ bin.BareEncoder = &PremiumFeatureAccentColor{} - _ bin.BareDecoder = &PremiumFeatureAccentColor{} - - _ PremiumFeatureClass = &PremiumFeatureAccentColor{} -) - -func (p *PremiumFeatureAccentColor) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureAccentColor) String() string { - if p == nil { - return "PremiumFeatureAccentColor(nil)" - } - type Alias PremiumFeatureAccentColor - return fmt.Sprintf("PremiumFeatureAccentColor%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureAccentColor) TypeID() uint32 { - return PremiumFeatureAccentColorTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureAccentColor) TypeName() string { - return "premiumFeatureAccentColor" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureAccentColor) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureAccentColor", - ID: PremiumFeatureAccentColorTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureAccentColor) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAccentColor#361ac59e as nil") - } - b.PutID(PremiumFeatureAccentColorTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureAccentColor) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAccentColor#361ac59e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureAccentColor) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAccentColor#361ac59e to nil") - } - if err := b.ConsumeID(PremiumFeatureAccentColorTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureAccentColor#361ac59e: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureAccentColor) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAccentColor#361ac59e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureAccentColor) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureAccentColor#361ac59e as nil") - } - b.ObjStart() - b.PutID("premiumFeatureAccentColor") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureAccentColor) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureAccentColor#361ac59e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureAccentColor"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureAccentColor#361ac59e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureBackgroundForBoth represents TL type `premiumFeatureBackgroundForBoth#2246eefa`. -type PremiumFeatureBackgroundForBoth struct { -} - -// PremiumFeatureBackgroundForBothTypeID is TL type id of PremiumFeatureBackgroundForBoth. -const PremiumFeatureBackgroundForBothTypeID = 0x2246eefa - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureBackgroundForBoth) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureBackgroundForBoth. -var ( - _ bin.Encoder = &PremiumFeatureBackgroundForBoth{} - _ bin.Decoder = &PremiumFeatureBackgroundForBoth{} - _ bin.BareEncoder = &PremiumFeatureBackgroundForBoth{} - _ bin.BareDecoder = &PremiumFeatureBackgroundForBoth{} - - _ PremiumFeatureClass = &PremiumFeatureBackgroundForBoth{} -) - -func (p *PremiumFeatureBackgroundForBoth) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureBackgroundForBoth) String() string { - if p == nil { - return "PremiumFeatureBackgroundForBoth(nil)" - } - type Alias PremiumFeatureBackgroundForBoth - return fmt.Sprintf("PremiumFeatureBackgroundForBoth%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureBackgroundForBoth) TypeID() uint32 { - return PremiumFeatureBackgroundForBothTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureBackgroundForBoth) TypeName() string { - return "premiumFeatureBackgroundForBoth" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureBackgroundForBoth) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureBackgroundForBoth", - ID: PremiumFeatureBackgroundForBothTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureBackgroundForBoth) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureBackgroundForBoth#2246eefa as nil") - } - b.PutID(PremiumFeatureBackgroundForBothTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureBackgroundForBoth) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureBackgroundForBoth#2246eefa as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureBackgroundForBoth) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureBackgroundForBoth#2246eefa to nil") - } - if err := b.ConsumeID(PremiumFeatureBackgroundForBothTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureBackgroundForBoth#2246eefa: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureBackgroundForBoth) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureBackgroundForBoth#2246eefa to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureBackgroundForBoth) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureBackgroundForBoth#2246eefa as nil") - } - b.ObjStart() - b.PutID("premiumFeatureBackgroundForBoth") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureBackgroundForBoth) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureBackgroundForBoth#2246eefa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureBackgroundForBoth"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureBackgroundForBoth#2246eefa: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureSavedMessagesTags represents TL type `premiumFeatureSavedMessagesTags#3bcbe986`. -type PremiumFeatureSavedMessagesTags struct { -} - -// PremiumFeatureSavedMessagesTagsTypeID is TL type id of PremiumFeatureSavedMessagesTags. -const PremiumFeatureSavedMessagesTagsTypeID = 0x3bcbe986 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureSavedMessagesTags) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureSavedMessagesTags. -var ( - _ bin.Encoder = &PremiumFeatureSavedMessagesTags{} - _ bin.Decoder = &PremiumFeatureSavedMessagesTags{} - _ bin.BareEncoder = &PremiumFeatureSavedMessagesTags{} - _ bin.BareDecoder = &PremiumFeatureSavedMessagesTags{} - - _ PremiumFeatureClass = &PremiumFeatureSavedMessagesTags{} -) - -func (p *PremiumFeatureSavedMessagesTags) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureSavedMessagesTags) String() string { - if p == nil { - return "PremiumFeatureSavedMessagesTags(nil)" - } - type Alias PremiumFeatureSavedMessagesTags - return fmt.Sprintf("PremiumFeatureSavedMessagesTags%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureSavedMessagesTags) TypeID() uint32 { - return PremiumFeatureSavedMessagesTagsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureSavedMessagesTags) TypeName() string { - return "premiumFeatureSavedMessagesTags" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureSavedMessagesTags) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureSavedMessagesTags", - ID: PremiumFeatureSavedMessagesTagsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureSavedMessagesTags) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureSavedMessagesTags#3bcbe986 as nil") - } - b.PutID(PremiumFeatureSavedMessagesTagsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureSavedMessagesTags) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureSavedMessagesTags#3bcbe986 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureSavedMessagesTags) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureSavedMessagesTags#3bcbe986 to nil") - } - if err := b.ConsumeID(PremiumFeatureSavedMessagesTagsTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureSavedMessagesTags#3bcbe986: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureSavedMessagesTags) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureSavedMessagesTags#3bcbe986 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureSavedMessagesTags) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureSavedMessagesTags#3bcbe986 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureSavedMessagesTags") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureSavedMessagesTags) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureSavedMessagesTags#3bcbe986 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureSavedMessagesTags"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureSavedMessagesTags#3bcbe986: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureMessagePrivacy represents TL type `premiumFeatureMessagePrivacy#2fd278f6`. -type PremiumFeatureMessagePrivacy struct { -} - -// PremiumFeatureMessagePrivacyTypeID is TL type id of PremiumFeatureMessagePrivacy. -const PremiumFeatureMessagePrivacyTypeID = 0x2fd278f6 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureMessagePrivacy) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureMessagePrivacy. -var ( - _ bin.Encoder = &PremiumFeatureMessagePrivacy{} - _ bin.Decoder = &PremiumFeatureMessagePrivacy{} - _ bin.BareEncoder = &PremiumFeatureMessagePrivacy{} - _ bin.BareDecoder = &PremiumFeatureMessagePrivacy{} - - _ PremiumFeatureClass = &PremiumFeatureMessagePrivacy{} -) - -func (p *PremiumFeatureMessagePrivacy) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureMessagePrivacy) String() string { - if p == nil { - return "PremiumFeatureMessagePrivacy(nil)" - } - type Alias PremiumFeatureMessagePrivacy - return fmt.Sprintf("PremiumFeatureMessagePrivacy%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureMessagePrivacy) TypeID() uint32 { - return PremiumFeatureMessagePrivacyTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureMessagePrivacy) TypeName() string { - return "premiumFeatureMessagePrivacy" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureMessagePrivacy) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureMessagePrivacy", - ID: PremiumFeatureMessagePrivacyTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureMessagePrivacy) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureMessagePrivacy#2fd278f6 as nil") - } - b.PutID(PremiumFeatureMessagePrivacyTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureMessagePrivacy) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureMessagePrivacy#2fd278f6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureMessagePrivacy) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureMessagePrivacy#2fd278f6 to nil") - } - if err := b.ConsumeID(PremiumFeatureMessagePrivacyTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureMessagePrivacy#2fd278f6: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureMessagePrivacy) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureMessagePrivacy#2fd278f6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureMessagePrivacy) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureMessagePrivacy#2fd278f6 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureMessagePrivacy") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureMessagePrivacy) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureMessagePrivacy#2fd278f6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureMessagePrivacy"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureMessagePrivacy#2fd278f6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureLastSeenTimes represents TL type `premiumFeatureLastSeenTimes#d2914a8f`. -type PremiumFeatureLastSeenTimes struct { -} - -// PremiumFeatureLastSeenTimesTypeID is TL type id of PremiumFeatureLastSeenTimes. -const PremiumFeatureLastSeenTimesTypeID = 0xd2914a8f - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureLastSeenTimes) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureLastSeenTimes. -var ( - _ bin.Encoder = &PremiumFeatureLastSeenTimes{} - _ bin.Decoder = &PremiumFeatureLastSeenTimes{} - _ bin.BareEncoder = &PremiumFeatureLastSeenTimes{} - _ bin.BareDecoder = &PremiumFeatureLastSeenTimes{} - - _ PremiumFeatureClass = &PremiumFeatureLastSeenTimes{} -) - -func (p *PremiumFeatureLastSeenTimes) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureLastSeenTimes) String() string { - if p == nil { - return "PremiumFeatureLastSeenTimes(nil)" - } - type Alias PremiumFeatureLastSeenTimes - return fmt.Sprintf("PremiumFeatureLastSeenTimes%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureLastSeenTimes) TypeID() uint32 { - return PremiumFeatureLastSeenTimesTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureLastSeenTimes) TypeName() string { - return "premiumFeatureLastSeenTimes" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureLastSeenTimes) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureLastSeenTimes", - ID: PremiumFeatureLastSeenTimesTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureLastSeenTimes) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureLastSeenTimes#d2914a8f as nil") - } - b.PutID(PremiumFeatureLastSeenTimesTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureLastSeenTimes) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureLastSeenTimes#d2914a8f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureLastSeenTimes) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureLastSeenTimes#d2914a8f to nil") - } - if err := b.ConsumeID(PremiumFeatureLastSeenTimesTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureLastSeenTimes#d2914a8f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureLastSeenTimes) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureLastSeenTimes#d2914a8f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureLastSeenTimes) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureLastSeenTimes#d2914a8f as nil") - } - b.ObjStart() - b.PutID("premiumFeatureLastSeenTimes") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureLastSeenTimes) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureLastSeenTimes#d2914a8f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureLastSeenTimes"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureLastSeenTimes#d2914a8f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureBusiness represents TL type `premiumFeatureBusiness#a6609704`. -type PremiumFeatureBusiness struct { -} - -// PremiumFeatureBusinessTypeID is TL type id of PremiumFeatureBusiness. -const PremiumFeatureBusinessTypeID = 0xa6609704 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureBusiness) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureBusiness. -var ( - _ bin.Encoder = &PremiumFeatureBusiness{} - _ bin.Decoder = &PremiumFeatureBusiness{} - _ bin.BareEncoder = &PremiumFeatureBusiness{} - _ bin.BareDecoder = &PremiumFeatureBusiness{} - - _ PremiumFeatureClass = &PremiumFeatureBusiness{} -) - -func (p *PremiumFeatureBusiness) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureBusiness) String() string { - if p == nil { - return "PremiumFeatureBusiness(nil)" - } - type Alias PremiumFeatureBusiness - return fmt.Sprintf("PremiumFeatureBusiness%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureBusiness) TypeID() uint32 { - return PremiumFeatureBusinessTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureBusiness) TypeName() string { - return "premiumFeatureBusiness" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureBusiness) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureBusiness", - ID: PremiumFeatureBusinessTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureBusiness) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureBusiness#a6609704 as nil") - } - b.PutID(PremiumFeatureBusinessTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureBusiness) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureBusiness#a6609704 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureBusiness) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureBusiness#a6609704 to nil") - } - if err := b.ConsumeID(PremiumFeatureBusinessTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureBusiness#a6609704: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureBusiness) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureBusiness#a6609704 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureBusiness) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureBusiness#a6609704 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureBusiness") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureBusiness) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureBusiness#a6609704 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureBusiness"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureBusiness#a6609704: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureMessageEffects represents TL type `premiumFeatureMessageEffects#d4e35061`. -type PremiumFeatureMessageEffects struct { -} - -// PremiumFeatureMessageEffectsTypeID is TL type id of PremiumFeatureMessageEffects. -const PremiumFeatureMessageEffectsTypeID = 0xd4e35061 - -// construct implements constructor of PremiumFeatureClass. -func (p PremiumFeatureMessageEffects) construct() PremiumFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumFeatureMessageEffects. -var ( - _ bin.Encoder = &PremiumFeatureMessageEffects{} - _ bin.Decoder = &PremiumFeatureMessageEffects{} - _ bin.BareEncoder = &PremiumFeatureMessageEffects{} - _ bin.BareDecoder = &PremiumFeatureMessageEffects{} - - _ PremiumFeatureClass = &PremiumFeatureMessageEffects{} -) - -func (p *PremiumFeatureMessageEffects) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatureMessageEffects) String() string { - if p == nil { - return "PremiumFeatureMessageEffects(nil)" - } - type Alias PremiumFeatureMessageEffects - return fmt.Sprintf("PremiumFeatureMessageEffects%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatureMessageEffects) TypeID() uint32 { - return PremiumFeatureMessageEffectsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatureMessageEffects) TypeName() string { - return "premiumFeatureMessageEffects" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatureMessageEffects) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatureMessageEffects", - ID: PremiumFeatureMessageEffectsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatureMessageEffects) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureMessageEffects#d4e35061 as nil") - } - b.PutID(PremiumFeatureMessageEffectsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatureMessageEffects) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureMessageEffects#d4e35061 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatureMessageEffects) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureMessageEffects#d4e35061 to nil") - } - if err := b.ConsumeID(PremiumFeatureMessageEffectsTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatureMessageEffects#d4e35061: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatureMessageEffects) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureMessageEffects#d4e35061 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatureMessageEffects) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatureMessageEffects#d4e35061 as nil") - } - b.ObjStart() - b.PutID("premiumFeatureMessageEffects") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatureMessageEffects) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatureMessageEffects#d4e35061 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatureMessageEffects"); err != nil { - return fmt.Errorf("unable to decode premiumFeatureMessageEffects#d4e35061: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumFeatureClassName is schema name of PremiumFeatureClass. -const PremiumFeatureClassName = "PremiumFeature" - -// PremiumFeatureClass represents PremiumFeature generic type. -// -// Example: -// -// g, err := tdapi.DecodePremiumFeature(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PremiumFeatureIncreasedLimits: // premiumFeatureIncreasedLimits#6a6be1b7 -// case *tdapi.PremiumFeatureIncreasedUploadFileSize: // premiumFeatureIncreasedUploadFileSize#6ccce473 -// case *tdapi.PremiumFeatureImprovedDownloadSpeed: // premiumFeatureImprovedDownloadSpeed#f00b4a3e -// case *tdapi.PremiumFeatureVoiceRecognition: // premiumFeatureVoiceRecognition#4cc89fde -// case *tdapi.PremiumFeatureDisabledAds: // premiumFeatureDisabledAds#8847624a -// case *tdapi.PremiumFeatureUniqueReactions: // premiumFeatureUniqueReactions#2db3b017 -// case *tdapi.PremiumFeatureUniqueStickers: // premiumFeatureUniqueStickers#82b97c00 -// case *tdapi.PremiumFeatureCustomEmoji: // premiumFeatureCustomEmoji#4f6ddb4c -// case *tdapi.PremiumFeatureAdvancedChatManagement: // premiumFeatureAdvancedChatManagement#2f774d1a -// case *tdapi.PremiumFeatureProfileBadge: // premiumFeatureProfileBadge#ded30c2 -// case *tdapi.PremiumFeatureEmojiStatus: // premiumFeatureEmojiStatus#fdd2cce1 -// case *tdapi.PremiumFeatureAnimatedProfilePhoto: // premiumFeatureAnimatedProfilePhoto#f9fecce6 -// case *tdapi.PremiumFeatureForumTopicIcon: // premiumFeatureForumTopicIcon#ceef6342 -// case *tdapi.PremiumFeatureAppIcons: // premiumFeatureAppIcons#5e79f489 -// case *tdapi.PremiumFeatureRealTimeChatTranslation: // premiumFeatureRealTimeChatTranslation#bbd80280 -// case *tdapi.PremiumFeatureUpgradedStories: // premiumFeatureUpgradedStories#9008051b -// case *tdapi.PremiumFeatureChatBoost: // premiumFeatureChatBoost#5df89f1b -// case *tdapi.PremiumFeatureAccentColor: // premiumFeatureAccentColor#361ac59e -// case *tdapi.PremiumFeatureBackgroundForBoth: // premiumFeatureBackgroundForBoth#2246eefa -// case *tdapi.PremiumFeatureSavedMessagesTags: // premiumFeatureSavedMessagesTags#3bcbe986 -// case *tdapi.PremiumFeatureMessagePrivacy: // premiumFeatureMessagePrivacy#2fd278f6 -// case *tdapi.PremiumFeatureLastSeenTimes: // premiumFeatureLastSeenTimes#d2914a8f -// case *tdapi.PremiumFeatureBusiness: // premiumFeatureBusiness#a6609704 -// case *tdapi.PremiumFeatureMessageEffects: // premiumFeatureMessageEffects#d4e35061 -// default: panic(v) -// } -type PremiumFeatureClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PremiumFeatureClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePremiumFeature implements binary de-serialization for PremiumFeatureClass. -func DecodePremiumFeature(buf *bin.Buffer) (PremiumFeatureClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PremiumFeatureIncreasedLimitsTypeID: - // Decoding premiumFeatureIncreasedLimits#6a6be1b7. - v := PremiumFeatureIncreasedLimits{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureIncreasedUploadFileSizeTypeID: - // Decoding premiumFeatureIncreasedUploadFileSize#6ccce473. - v := PremiumFeatureIncreasedUploadFileSize{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureImprovedDownloadSpeedTypeID: - // Decoding premiumFeatureImprovedDownloadSpeed#f00b4a3e. - v := PremiumFeatureImprovedDownloadSpeed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureVoiceRecognitionTypeID: - // Decoding premiumFeatureVoiceRecognition#4cc89fde. - v := PremiumFeatureVoiceRecognition{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureDisabledAdsTypeID: - // Decoding premiumFeatureDisabledAds#8847624a. - v := PremiumFeatureDisabledAds{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureUniqueReactionsTypeID: - // Decoding premiumFeatureUniqueReactions#2db3b017. - v := PremiumFeatureUniqueReactions{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureUniqueStickersTypeID: - // Decoding premiumFeatureUniqueStickers#82b97c00. - v := PremiumFeatureUniqueStickers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureCustomEmojiTypeID: - // Decoding premiumFeatureCustomEmoji#4f6ddb4c. - v := PremiumFeatureCustomEmoji{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureAdvancedChatManagementTypeID: - // Decoding premiumFeatureAdvancedChatManagement#2f774d1a. - v := PremiumFeatureAdvancedChatManagement{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureProfileBadgeTypeID: - // Decoding premiumFeatureProfileBadge#ded30c2. - v := PremiumFeatureProfileBadge{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureEmojiStatusTypeID: - // Decoding premiumFeatureEmojiStatus#fdd2cce1. - v := PremiumFeatureEmojiStatus{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureAnimatedProfilePhotoTypeID: - // Decoding premiumFeatureAnimatedProfilePhoto#f9fecce6. - v := PremiumFeatureAnimatedProfilePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureForumTopicIconTypeID: - // Decoding premiumFeatureForumTopicIcon#ceef6342. - v := PremiumFeatureForumTopicIcon{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureAppIconsTypeID: - // Decoding premiumFeatureAppIcons#5e79f489. - v := PremiumFeatureAppIcons{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureRealTimeChatTranslationTypeID: - // Decoding premiumFeatureRealTimeChatTranslation#bbd80280. - v := PremiumFeatureRealTimeChatTranslation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureUpgradedStoriesTypeID: - // Decoding premiumFeatureUpgradedStories#9008051b. - v := PremiumFeatureUpgradedStories{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureChatBoostTypeID: - // Decoding premiumFeatureChatBoost#5df89f1b. - v := PremiumFeatureChatBoost{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureAccentColorTypeID: - // Decoding premiumFeatureAccentColor#361ac59e. - v := PremiumFeatureAccentColor{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureBackgroundForBothTypeID: - // Decoding premiumFeatureBackgroundForBoth#2246eefa. - v := PremiumFeatureBackgroundForBoth{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureSavedMessagesTagsTypeID: - // Decoding premiumFeatureSavedMessagesTags#3bcbe986. - v := PremiumFeatureSavedMessagesTags{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureMessagePrivacyTypeID: - // Decoding premiumFeatureMessagePrivacy#2fd278f6. - v := PremiumFeatureMessagePrivacy{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureLastSeenTimesTypeID: - // Decoding premiumFeatureLastSeenTimes#d2914a8f. - v := PremiumFeatureLastSeenTimes{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureBusinessTypeID: - // Decoding premiumFeatureBusiness#a6609704. - v := PremiumFeatureBusiness{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case PremiumFeatureMessageEffectsTypeID: - // Decoding premiumFeatureMessageEffects#d4e35061. - v := PremiumFeatureMessageEffects{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPremiumFeature implements binary de-serialization for PremiumFeatureClass. -func DecodeTDLibJSONPremiumFeature(buf tdjson.Decoder) (PremiumFeatureClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "premiumFeatureIncreasedLimits": - // Decoding premiumFeatureIncreasedLimits#6a6be1b7. - v := PremiumFeatureIncreasedLimits{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureIncreasedUploadFileSize": - // Decoding premiumFeatureIncreasedUploadFileSize#6ccce473. - v := PremiumFeatureIncreasedUploadFileSize{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureImprovedDownloadSpeed": - // Decoding premiumFeatureImprovedDownloadSpeed#f00b4a3e. - v := PremiumFeatureImprovedDownloadSpeed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureVoiceRecognition": - // Decoding premiumFeatureVoiceRecognition#4cc89fde. - v := PremiumFeatureVoiceRecognition{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureDisabledAds": - // Decoding premiumFeatureDisabledAds#8847624a. - v := PremiumFeatureDisabledAds{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureUniqueReactions": - // Decoding premiumFeatureUniqueReactions#2db3b017. - v := PremiumFeatureUniqueReactions{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureUniqueStickers": - // Decoding premiumFeatureUniqueStickers#82b97c00. - v := PremiumFeatureUniqueStickers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureCustomEmoji": - // Decoding premiumFeatureCustomEmoji#4f6ddb4c. - v := PremiumFeatureCustomEmoji{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureAdvancedChatManagement": - // Decoding premiumFeatureAdvancedChatManagement#2f774d1a. - v := PremiumFeatureAdvancedChatManagement{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureProfileBadge": - // Decoding premiumFeatureProfileBadge#ded30c2. - v := PremiumFeatureProfileBadge{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureEmojiStatus": - // Decoding premiumFeatureEmojiStatus#fdd2cce1. - v := PremiumFeatureEmojiStatus{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureAnimatedProfilePhoto": - // Decoding premiumFeatureAnimatedProfilePhoto#f9fecce6. - v := PremiumFeatureAnimatedProfilePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureForumTopicIcon": - // Decoding premiumFeatureForumTopicIcon#ceef6342. - v := PremiumFeatureForumTopicIcon{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureAppIcons": - // Decoding premiumFeatureAppIcons#5e79f489. - v := PremiumFeatureAppIcons{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureRealTimeChatTranslation": - // Decoding premiumFeatureRealTimeChatTranslation#bbd80280. - v := PremiumFeatureRealTimeChatTranslation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureUpgradedStories": - // Decoding premiumFeatureUpgradedStories#9008051b. - v := PremiumFeatureUpgradedStories{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureChatBoost": - // Decoding premiumFeatureChatBoost#5df89f1b. - v := PremiumFeatureChatBoost{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureAccentColor": - // Decoding premiumFeatureAccentColor#361ac59e. - v := PremiumFeatureAccentColor{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureBackgroundForBoth": - // Decoding premiumFeatureBackgroundForBoth#2246eefa. - v := PremiumFeatureBackgroundForBoth{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureSavedMessagesTags": - // Decoding premiumFeatureSavedMessagesTags#3bcbe986. - v := PremiumFeatureSavedMessagesTags{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureMessagePrivacy": - // Decoding premiumFeatureMessagePrivacy#2fd278f6. - v := PremiumFeatureMessagePrivacy{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureLastSeenTimes": - // Decoding premiumFeatureLastSeenTimes#d2914a8f. - v := PremiumFeatureLastSeenTimes{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureBusiness": - // Decoding premiumFeatureBusiness#a6609704. - v := PremiumFeatureBusiness{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - case "premiumFeatureMessageEffects": - // Decoding premiumFeatureMessageEffects#d4e35061. - v := PremiumFeatureMessageEffects{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumFeatureClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PremiumFeature boxes the PremiumFeatureClass providing a helper. -type PremiumFeatureBox struct { - PremiumFeature PremiumFeatureClass -} - -// Decode implements bin.Decoder for PremiumFeatureBox. -func (b *PremiumFeatureBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumFeatureBox to nil") - } - v, err := DecodePremiumFeature(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumFeature = v - return nil -} - -// Encode implements bin.Encode for PremiumFeatureBox. -func (b *PremiumFeatureBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PremiumFeature == nil { - return fmt.Errorf("unable to encode PremiumFeatureClass as nil") - } - return b.PremiumFeature.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PremiumFeatureBox. -func (b *PremiumFeatureBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumFeatureBox to nil") - } - v, err := DecodeTDLibJSONPremiumFeature(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumFeature = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PremiumFeatureBox. -func (b *PremiumFeatureBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PremiumFeature == nil { - return fmt.Errorf("unable to encode PremiumFeatureClass as nil") - } - return b.PremiumFeature.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_premium_feature_promotion_animation_gen.go b/tdapi/tl_premium_feature_promotion_animation_gen.go deleted file mode 100644 index b7f171cfb..000000000 --- a/tdapi/tl_premium_feature_promotion_animation_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumFeaturePromotionAnimation represents TL type `premiumFeaturePromotionAnimation#899dab1c`. -type PremiumFeaturePromotionAnimation struct { - // Premium feature - Feature PremiumFeatureClass - // Promotion animation for the feature - Animation Animation -} - -// PremiumFeaturePromotionAnimationTypeID is TL type id of PremiumFeaturePromotionAnimation. -const PremiumFeaturePromotionAnimationTypeID = 0x899dab1c - -// Ensuring interfaces in compile-time for PremiumFeaturePromotionAnimation. -var ( - _ bin.Encoder = &PremiumFeaturePromotionAnimation{} - _ bin.Decoder = &PremiumFeaturePromotionAnimation{} - _ bin.BareEncoder = &PremiumFeaturePromotionAnimation{} - _ bin.BareDecoder = &PremiumFeaturePromotionAnimation{} -) - -func (p *PremiumFeaturePromotionAnimation) Zero() bool { - if p == nil { - return true - } - if !(p.Feature == nil) { - return false - } - if !(p.Animation.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeaturePromotionAnimation) String() string { - if p == nil { - return "PremiumFeaturePromotionAnimation(nil)" - } - type Alias PremiumFeaturePromotionAnimation - return fmt.Sprintf("PremiumFeaturePromotionAnimation%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeaturePromotionAnimation) TypeID() uint32 { - return PremiumFeaturePromotionAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeaturePromotionAnimation) TypeName() string { - return "premiumFeaturePromotionAnimation" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeaturePromotionAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeaturePromotionAnimation", - ID: PremiumFeaturePromotionAnimationTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Feature", - SchemaName: "feature", - }, - { - Name: "Animation", - SchemaName: "animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeaturePromotionAnimation) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeaturePromotionAnimation#899dab1c as nil") - } - b.PutID(PremiumFeaturePromotionAnimationTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeaturePromotionAnimation) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeaturePromotionAnimation#899dab1c as nil") - } - if p.Feature == nil { - return fmt.Errorf("unable to encode premiumFeaturePromotionAnimation#899dab1c: field feature is nil") - } - if err := p.Feature.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumFeaturePromotionAnimation#899dab1c: field feature: %w", err) - } - if err := p.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumFeaturePromotionAnimation#899dab1c: field animation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeaturePromotionAnimation) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeaturePromotionAnimation#899dab1c to nil") - } - if err := b.ConsumeID(PremiumFeaturePromotionAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeaturePromotionAnimation#899dab1c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeaturePromotionAnimation) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeaturePromotionAnimation#899dab1c to nil") - } - { - value, err := DecodePremiumFeature(b) - if err != nil { - return fmt.Errorf("unable to decode premiumFeaturePromotionAnimation#899dab1c: field feature: %w", err) - } - p.Feature = value - } - { - if err := p.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode premiumFeaturePromotionAnimation#899dab1c: field animation: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeaturePromotionAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeaturePromotionAnimation#899dab1c as nil") - } - b.ObjStart() - b.PutID("premiumFeaturePromotionAnimation") - b.Comma() - b.FieldStart("feature") - if p.Feature == nil { - return fmt.Errorf("unable to encode premiumFeaturePromotionAnimation#899dab1c: field feature is nil") - } - if err := p.Feature.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumFeaturePromotionAnimation#899dab1c: field feature: %w", err) - } - b.Comma() - b.FieldStart("animation") - if err := p.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumFeaturePromotionAnimation#899dab1c: field animation: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeaturePromotionAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeaturePromotionAnimation#899dab1c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeaturePromotionAnimation"); err != nil { - return fmt.Errorf("unable to decode premiumFeaturePromotionAnimation#899dab1c: %w", err) - } - case "feature": - value, err := DecodeTDLibJSONPremiumFeature(b) - if err != nil { - return fmt.Errorf("unable to decode premiumFeaturePromotionAnimation#899dab1c: field feature: %w", err) - } - p.Feature = value - case "animation": - if err := p.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode premiumFeaturePromotionAnimation#899dab1c: field animation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFeature returns value of Feature field. -func (p *PremiumFeaturePromotionAnimation) GetFeature() (value PremiumFeatureClass) { - if p == nil { - return - } - return p.Feature -} - -// GetAnimation returns value of Animation field. -func (p *PremiumFeaturePromotionAnimation) GetAnimation() (value Animation) { - if p == nil { - return - } - return p.Animation -} diff --git a/tdapi/tl_premium_features_gen.go b/tdapi/tl_premium_features_gen.go deleted file mode 100644 index 7addab8dd..000000000 --- a/tdapi/tl_premium_features_gen.go +++ /dev/null @@ -1,334 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumFeatures represents TL type `premiumFeatures#4cf10e82`. -type PremiumFeatures struct { - // The list of available features - Features []PremiumFeatureClass - // The list of limits, increased for Premium users - Limits []PremiumLimit - // An internal link to be opened to pay for Telegram Premium if store payment isn't - // possible; may be null if direct payment isn't available - PaymentLink InternalLinkTypeClass -} - -// PremiumFeaturesTypeID is TL type id of PremiumFeatures. -const PremiumFeaturesTypeID = 0x4cf10e82 - -// Ensuring interfaces in compile-time for PremiumFeatures. -var ( - _ bin.Encoder = &PremiumFeatures{} - _ bin.Decoder = &PremiumFeatures{} - _ bin.BareEncoder = &PremiumFeatures{} - _ bin.BareDecoder = &PremiumFeatures{} -) - -func (p *PremiumFeatures) Zero() bool { - if p == nil { - return true - } - if !(p.Features == nil) { - return false - } - if !(p.Limits == nil) { - return false - } - if !(p.PaymentLink == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumFeatures) String() string { - if p == nil { - return "PremiumFeatures(nil)" - } - type Alias PremiumFeatures - return fmt.Sprintf("PremiumFeatures%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumFeatures) TypeID() uint32 { - return PremiumFeaturesTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumFeatures) TypeName() string { - return "premiumFeatures" -} - -// TypeInfo returns info about TL type. -func (p *PremiumFeatures) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumFeatures", - ID: PremiumFeaturesTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Features", - SchemaName: "features", - }, - { - Name: "Limits", - SchemaName: "limits", - }, - { - Name: "PaymentLink", - SchemaName: "payment_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumFeatures) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatures#4cf10e82 as nil") - } - b.PutID(PremiumFeaturesTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumFeatures) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatures#4cf10e82 as nil") - } - b.PutInt(len(p.Features)) - for idx, v := range p.Features { - if v == nil { - return fmt.Errorf("unable to encode premiumFeatures#4cf10e82: field features element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare premiumFeatures#4cf10e82: field features element with index %d: %w", idx, err) - } - } - b.PutInt(len(p.Limits)) - for idx, v := range p.Limits { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare premiumFeatures#4cf10e82: field limits element with index %d: %w", idx, err) - } - } - if p.PaymentLink == nil { - return fmt.Errorf("unable to encode premiumFeatures#4cf10e82: field payment_link is nil") - } - if err := p.PaymentLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumFeatures#4cf10e82: field payment_link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumFeatures) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatures#4cf10e82 to nil") - } - if err := b.ConsumeID(PremiumFeaturesTypeID); err != nil { - return fmt.Errorf("unable to decode premiumFeatures#4cf10e82: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumFeatures) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatures#4cf10e82 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode premiumFeatures#4cf10e82: field features: %w", err) - } - - if headerLen > 0 { - p.Features = make([]PremiumFeatureClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePremiumFeature(b) - if err != nil { - return fmt.Errorf("unable to decode premiumFeatures#4cf10e82: field features: %w", err) - } - p.Features = append(p.Features, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode premiumFeatures#4cf10e82: field limits: %w", err) - } - - if headerLen > 0 { - p.Limits = make([]PremiumLimit, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PremiumLimit - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare premiumFeatures#4cf10e82: field limits: %w", err) - } - p.Limits = append(p.Limits, value) - } - } - { - value, err := DecodeInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode premiumFeatures#4cf10e82: field payment_link: %w", err) - } - p.PaymentLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumFeatures) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumFeatures#4cf10e82 as nil") - } - b.ObjStart() - b.PutID("premiumFeatures") - b.Comma() - b.FieldStart("features") - b.ArrStart() - for idx, v := range p.Features { - if v == nil { - return fmt.Errorf("unable to encode premiumFeatures#4cf10e82: field features element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumFeatures#4cf10e82: field features element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("limits") - b.ArrStart() - for idx, v := range p.Limits { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumFeatures#4cf10e82: field limits element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("payment_link") - if p.PaymentLink == nil { - return fmt.Errorf("unable to encode premiumFeatures#4cf10e82: field payment_link is nil") - } - if err := p.PaymentLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumFeatures#4cf10e82: field payment_link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumFeatures) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumFeatures#4cf10e82 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumFeatures"); err != nil { - return fmt.Errorf("unable to decode premiumFeatures#4cf10e82: %w", err) - } - case "features": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPremiumFeature(b) - if err != nil { - return fmt.Errorf("unable to decode premiumFeatures#4cf10e82: field features: %w", err) - } - p.Features = append(p.Features, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode premiumFeatures#4cf10e82: field features: %w", err) - } - case "limits": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PremiumLimit - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode premiumFeatures#4cf10e82: field limits: %w", err) - } - p.Limits = append(p.Limits, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode premiumFeatures#4cf10e82: field limits: %w", err) - } - case "payment_link": - value, err := DecodeTDLibJSONInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode premiumFeatures#4cf10e82: field payment_link: %w", err) - } - p.PaymentLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFeatures returns value of Features field. -func (p *PremiumFeatures) GetFeatures() (value []PremiumFeatureClass) { - if p == nil { - return - } - return p.Features -} - -// GetLimits returns value of Limits field. -func (p *PremiumFeatures) GetLimits() (value []PremiumLimit) { - if p == nil { - return - } - return p.Limits -} - -// GetPaymentLink returns value of PaymentLink field. -func (p *PremiumFeatures) GetPaymentLink() (value InternalLinkTypeClass) { - if p == nil { - return - } - return p.PaymentLink -} diff --git a/tdapi/tl_premium_gift_code_info_gen.go b/tdapi/tl_premium_gift_code_info_gen.go deleted file mode 100644 index d37958137..000000000 --- a/tdapi/tl_premium_gift_code_info_gen.go +++ /dev/null @@ -1,411 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumGiftCodeInfo represents TL type `premiumGiftCodeInfo#b88fa8de`. -type PremiumGiftCodeInfo struct { - // Identifier of a chat or a user that created the gift code; may be null if unknown. If - // null and the code is from messagePremiumGiftCode message, then creator_id from the - // message can be used - CreatorID MessageSenderClass - // Point in time (Unix timestamp) when the code was created - CreationDate int32 - // True, if the gift code was created for a giveaway - IsFromGiveaway bool - // Identifier of the corresponding giveaway message in the creator_id chat; can be 0 or - // an identifier of a deleted message - GiveawayMessageID int64 - // Number of months the Telegram Premium subscription will be active after code - // activation - MonthCount int32 - // Identifier of a user for which the code was created; 0 if none - UserID int64 - // Point in time (Unix timestamp) when the code was activated; 0 if none - UseDate int32 -} - -// PremiumGiftCodeInfoTypeID is TL type id of PremiumGiftCodeInfo. -const PremiumGiftCodeInfoTypeID = 0xb88fa8de - -// Ensuring interfaces in compile-time for PremiumGiftCodeInfo. -var ( - _ bin.Encoder = &PremiumGiftCodeInfo{} - _ bin.Decoder = &PremiumGiftCodeInfo{} - _ bin.BareEncoder = &PremiumGiftCodeInfo{} - _ bin.BareDecoder = &PremiumGiftCodeInfo{} -) - -func (p *PremiumGiftCodeInfo) Zero() bool { - if p == nil { - return true - } - if !(p.CreatorID == nil) { - return false - } - if !(p.CreationDate == 0) { - return false - } - if !(p.IsFromGiveaway == false) { - return false - } - if !(p.GiveawayMessageID == 0) { - return false - } - if !(p.MonthCount == 0) { - return false - } - if !(p.UserID == 0) { - return false - } - if !(p.UseDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumGiftCodeInfo) String() string { - if p == nil { - return "PremiumGiftCodeInfo(nil)" - } - type Alias PremiumGiftCodeInfo - return fmt.Sprintf("PremiumGiftCodeInfo%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumGiftCodeInfo) TypeID() uint32 { - return PremiumGiftCodeInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumGiftCodeInfo) TypeName() string { - return "premiumGiftCodeInfo" -} - -// TypeInfo returns info about TL type. -func (p *PremiumGiftCodeInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumGiftCodeInfo", - ID: PremiumGiftCodeInfoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CreatorID", - SchemaName: "creator_id", - }, - { - Name: "CreationDate", - SchemaName: "creation_date", - }, - { - Name: "IsFromGiveaway", - SchemaName: "is_from_giveaway", - }, - { - Name: "GiveawayMessageID", - SchemaName: "giveaway_message_id", - }, - { - Name: "MonthCount", - SchemaName: "month_count", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "UseDate", - SchemaName: "use_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumGiftCodeInfo) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiftCodeInfo#b88fa8de as nil") - } - b.PutID(PremiumGiftCodeInfoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumGiftCodeInfo) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiftCodeInfo#b88fa8de as nil") - } - if p.CreatorID == nil { - return fmt.Errorf("unable to encode premiumGiftCodeInfo#b88fa8de: field creator_id is nil") - } - if err := p.CreatorID.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumGiftCodeInfo#b88fa8de: field creator_id: %w", err) - } - b.PutInt32(p.CreationDate) - b.PutBool(p.IsFromGiveaway) - b.PutInt53(p.GiveawayMessageID) - b.PutInt32(p.MonthCount) - b.PutInt53(p.UserID) - b.PutInt32(p.UseDate) - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumGiftCodeInfo) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiftCodeInfo#b88fa8de to nil") - } - if err := b.ConsumeID(PremiumGiftCodeInfoTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumGiftCodeInfo) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiftCodeInfo#b88fa8de to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field creator_id: %w", err) - } - p.CreatorID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field creation_date: %w", err) - } - p.CreationDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field is_from_giveaway: %w", err) - } - p.IsFromGiveaway = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field giveaway_message_id: %w", err) - } - p.GiveawayMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field month_count: %w", err) - } - p.MonthCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field user_id: %w", err) - } - p.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field use_date: %w", err) - } - p.UseDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumGiftCodeInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiftCodeInfo#b88fa8de as nil") - } - b.ObjStart() - b.PutID("premiumGiftCodeInfo") - b.Comma() - b.FieldStart("creator_id") - if p.CreatorID == nil { - return fmt.Errorf("unable to encode premiumGiftCodeInfo#b88fa8de: field creator_id is nil") - } - if err := p.CreatorID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumGiftCodeInfo#b88fa8de: field creator_id: %w", err) - } - b.Comma() - b.FieldStart("creation_date") - b.PutInt32(p.CreationDate) - b.Comma() - b.FieldStart("is_from_giveaway") - b.PutBool(p.IsFromGiveaway) - b.Comma() - b.FieldStart("giveaway_message_id") - b.PutInt53(p.GiveawayMessageID) - b.Comma() - b.FieldStart("month_count") - b.PutInt32(p.MonthCount) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(p.UserID) - b.Comma() - b.FieldStart("use_date") - b.PutInt32(p.UseDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumGiftCodeInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiftCodeInfo#b88fa8de to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumGiftCodeInfo"); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: %w", err) - } - case "creator_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field creator_id: %w", err) - } - p.CreatorID = value - case "creation_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field creation_date: %w", err) - } - p.CreationDate = value - case "is_from_giveaway": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field is_from_giveaway: %w", err) - } - p.IsFromGiveaway = value - case "giveaway_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field giveaway_message_id: %w", err) - } - p.GiveawayMessageID = value - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field month_count: %w", err) - } - p.MonthCount = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field user_id: %w", err) - } - p.UserID = value - case "use_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodeInfo#b88fa8de: field use_date: %w", err) - } - p.UseDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCreatorID returns value of CreatorID field. -func (p *PremiumGiftCodeInfo) GetCreatorID() (value MessageSenderClass) { - if p == nil { - return - } - return p.CreatorID -} - -// GetCreationDate returns value of CreationDate field. -func (p *PremiumGiftCodeInfo) GetCreationDate() (value int32) { - if p == nil { - return - } - return p.CreationDate -} - -// GetIsFromGiveaway returns value of IsFromGiveaway field. -func (p *PremiumGiftCodeInfo) GetIsFromGiveaway() (value bool) { - if p == nil { - return - } - return p.IsFromGiveaway -} - -// GetGiveawayMessageID returns value of GiveawayMessageID field. -func (p *PremiumGiftCodeInfo) GetGiveawayMessageID() (value int64) { - if p == nil { - return - } - return p.GiveawayMessageID -} - -// GetMonthCount returns value of MonthCount field. -func (p *PremiumGiftCodeInfo) GetMonthCount() (value int32) { - if p == nil { - return - } - return p.MonthCount -} - -// GetUserID returns value of UserID field. -func (p *PremiumGiftCodeInfo) GetUserID() (value int64) { - if p == nil { - return - } - return p.UserID -} - -// GetUseDate returns value of UseDate field. -func (p *PremiumGiftCodeInfo) GetUseDate() (value int32) { - if p == nil { - return - } - return p.UseDate -} diff --git a/tdapi/tl_premium_gift_code_payment_option_gen.go b/tdapi/tl_premium_gift_code_payment_option_gen.go deleted file mode 100644 index 2a2f1ad51..000000000 --- a/tdapi/tl_premium_gift_code_payment_option_gen.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumGiftCodePaymentOption represents TL type `premiumGiftCodePaymentOption#d89959ed`. -type PremiumGiftCodePaymentOption struct { - // ISO 4217 currency code for Telegram Premium gift code payment - Currency string - // The amount to pay, in the smallest units of the currency - Amount int64 - // The discount associated with this option, as a percentage - DiscountPercentage int32 - // Number of users which will be able to activate the gift codes - WinnerCount int32 - // Number of months the Telegram Premium subscription will be active - MonthCount int32 - // Identifier of the store product associated with the option; may be empty if none - StoreProductID string - // Number of times the store product must be paid - StoreProductQuantity int32 - // A sticker to be shown along with the gift code; may be null if unknown - Sticker Sticker -} - -// PremiumGiftCodePaymentOptionTypeID is TL type id of PremiumGiftCodePaymentOption. -const PremiumGiftCodePaymentOptionTypeID = 0xd89959ed - -// Ensuring interfaces in compile-time for PremiumGiftCodePaymentOption. -var ( - _ bin.Encoder = &PremiumGiftCodePaymentOption{} - _ bin.Decoder = &PremiumGiftCodePaymentOption{} - _ bin.BareEncoder = &PremiumGiftCodePaymentOption{} - _ bin.BareDecoder = &PremiumGiftCodePaymentOption{} -) - -func (p *PremiumGiftCodePaymentOption) Zero() bool { - if p == nil { - return true - } - if !(p.Currency == "") { - return false - } - if !(p.Amount == 0) { - return false - } - if !(p.DiscountPercentage == 0) { - return false - } - if !(p.WinnerCount == 0) { - return false - } - if !(p.MonthCount == 0) { - return false - } - if !(p.StoreProductID == "") { - return false - } - if !(p.StoreProductQuantity == 0) { - return false - } - if !(p.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumGiftCodePaymentOption) String() string { - if p == nil { - return "PremiumGiftCodePaymentOption(nil)" - } - type Alias PremiumGiftCodePaymentOption - return fmt.Sprintf("PremiumGiftCodePaymentOption%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumGiftCodePaymentOption) TypeID() uint32 { - return PremiumGiftCodePaymentOptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumGiftCodePaymentOption) TypeName() string { - return "premiumGiftCodePaymentOption" -} - -// TypeInfo returns info about TL type. -func (p *PremiumGiftCodePaymentOption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumGiftCodePaymentOption", - ID: PremiumGiftCodePaymentOptionTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "DiscountPercentage", - SchemaName: "discount_percentage", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "MonthCount", - SchemaName: "month_count", - }, - { - Name: "StoreProductID", - SchemaName: "store_product_id", - }, - { - Name: "StoreProductQuantity", - SchemaName: "store_product_quantity", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumGiftCodePaymentOption) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiftCodePaymentOption#d89959ed as nil") - } - b.PutID(PremiumGiftCodePaymentOptionTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumGiftCodePaymentOption) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiftCodePaymentOption#d89959ed as nil") - } - b.PutString(p.Currency) - b.PutInt53(p.Amount) - b.PutInt32(p.DiscountPercentage) - b.PutInt32(p.WinnerCount) - b.PutInt32(p.MonthCount) - b.PutString(p.StoreProductID) - b.PutInt32(p.StoreProductQuantity) - if err := p.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumGiftCodePaymentOption#d89959ed: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumGiftCodePaymentOption) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiftCodePaymentOption#d89959ed to nil") - } - if err := b.ConsumeID(PremiumGiftCodePaymentOptionTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumGiftCodePaymentOption) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiftCodePaymentOption#d89959ed to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field currency: %w", err) - } - p.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field amount: %w", err) - } - p.Amount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field discount_percentage: %w", err) - } - p.DiscountPercentage = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field winner_count: %w", err) - } - p.WinnerCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field month_count: %w", err) - } - p.MonthCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field store_product_id: %w", err) - } - p.StoreProductID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field store_product_quantity: %w", err) - } - p.StoreProductQuantity = value - } - { - if err := p.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumGiftCodePaymentOption) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiftCodePaymentOption#d89959ed as nil") - } - b.ObjStart() - b.PutID("premiumGiftCodePaymentOption") - b.Comma() - b.FieldStart("currency") - b.PutString(p.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(p.Amount) - b.Comma() - b.FieldStart("discount_percentage") - b.PutInt32(p.DiscountPercentage) - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(p.WinnerCount) - b.Comma() - b.FieldStart("month_count") - b.PutInt32(p.MonthCount) - b.Comma() - b.FieldStart("store_product_id") - b.PutString(p.StoreProductID) - b.Comma() - b.FieldStart("store_product_quantity") - b.PutInt32(p.StoreProductQuantity) - b.Comma() - b.FieldStart("sticker") - if err := p.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumGiftCodePaymentOption#d89959ed: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumGiftCodePaymentOption) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiftCodePaymentOption#d89959ed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumGiftCodePaymentOption"); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field currency: %w", err) - } - p.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field amount: %w", err) - } - p.Amount = value - case "discount_percentage": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field discount_percentage: %w", err) - } - p.DiscountPercentage = value - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field winner_count: %w", err) - } - p.WinnerCount = value - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field month_count: %w", err) - } - p.MonthCount = value - case "store_product_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field store_product_id: %w", err) - } - p.StoreProductID = value - case "store_product_quantity": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field store_product_quantity: %w", err) - } - p.StoreProductQuantity = value - case "sticker": - if err := p.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOption#d89959ed: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCurrency returns value of Currency field. -func (p *PremiumGiftCodePaymentOption) GetCurrency() (value string) { - if p == nil { - return - } - return p.Currency -} - -// GetAmount returns value of Amount field. -func (p *PremiumGiftCodePaymentOption) GetAmount() (value int64) { - if p == nil { - return - } - return p.Amount -} - -// GetDiscountPercentage returns value of DiscountPercentage field. -func (p *PremiumGiftCodePaymentOption) GetDiscountPercentage() (value int32) { - if p == nil { - return - } - return p.DiscountPercentage -} - -// GetWinnerCount returns value of WinnerCount field. -func (p *PremiumGiftCodePaymentOption) GetWinnerCount() (value int32) { - if p == nil { - return - } - return p.WinnerCount -} - -// GetMonthCount returns value of MonthCount field. -func (p *PremiumGiftCodePaymentOption) GetMonthCount() (value int32) { - if p == nil { - return - } - return p.MonthCount -} - -// GetStoreProductID returns value of StoreProductID field. -func (p *PremiumGiftCodePaymentOption) GetStoreProductID() (value string) { - if p == nil { - return - } - return p.StoreProductID -} - -// GetStoreProductQuantity returns value of StoreProductQuantity field. -func (p *PremiumGiftCodePaymentOption) GetStoreProductQuantity() (value int32) { - if p == nil { - return - } - return p.StoreProductQuantity -} - -// GetSticker returns value of Sticker field. -func (p *PremiumGiftCodePaymentOption) GetSticker() (value Sticker) { - if p == nil { - return - } - return p.Sticker -} diff --git a/tdapi/tl_premium_gift_code_payment_options_gen.go b/tdapi/tl_premium_gift_code_payment_options_gen.go deleted file mode 100644 index 50989bdde..000000000 --- a/tdapi/tl_premium_gift_code_payment_options_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumGiftCodePaymentOptions represents TL type `premiumGiftCodePaymentOptions#97a8cf2e`. -type PremiumGiftCodePaymentOptions struct { - // The list of options - Options []PremiumGiftCodePaymentOption -} - -// PremiumGiftCodePaymentOptionsTypeID is TL type id of PremiumGiftCodePaymentOptions. -const PremiumGiftCodePaymentOptionsTypeID = 0x97a8cf2e - -// Ensuring interfaces in compile-time for PremiumGiftCodePaymentOptions. -var ( - _ bin.Encoder = &PremiumGiftCodePaymentOptions{} - _ bin.Decoder = &PremiumGiftCodePaymentOptions{} - _ bin.BareEncoder = &PremiumGiftCodePaymentOptions{} - _ bin.BareDecoder = &PremiumGiftCodePaymentOptions{} -) - -func (p *PremiumGiftCodePaymentOptions) Zero() bool { - if p == nil { - return true - } - if !(p.Options == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumGiftCodePaymentOptions) String() string { - if p == nil { - return "PremiumGiftCodePaymentOptions(nil)" - } - type Alias PremiumGiftCodePaymentOptions - return fmt.Sprintf("PremiumGiftCodePaymentOptions%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumGiftCodePaymentOptions) TypeID() uint32 { - return PremiumGiftCodePaymentOptionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumGiftCodePaymentOptions) TypeName() string { - return "premiumGiftCodePaymentOptions" -} - -// TypeInfo returns info about TL type. -func (p *PremiumGiftCodePaymentOptions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumGiftCodePaymentOptions", - ID: PremiumGiftCodePaymentOptionsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Options", - SchemaName: "options", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumGiftCodePaymentOptions) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiftCodePaymentOptions#97a8cf2e as nil") - } - b.PutID(PremiumGiftCodePaymentOptionsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumGiftCodePaymentOptions) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiftCodePaymentOptions#97a8cf2e as nil") - } - b.PutInt(len(p.Options)) - for idx, v := range p.Options { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare premiumGiftCodePaymentOptions#97a8cf2e: field options element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumGiftCodePaymentOptions) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiftCodePaymentOptions#97a8cf2e to nil") - } - if err := b.ConsumeID(PremiumGiftCodePaymentOptionsTypeID); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOptions#97a8cf2e: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumGiftCodePaymentOptions) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiftCodePaymentOptions#97a8cf2e to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOptions#97a8cf2e: field options: %w", err) - } - - if headerLen > 0 { - p.Options = make([]PremiumGiftCodePaymentOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PremiumGiftCodePaymentOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare premiumGiftCodePaymentOptions#97a8cf2e: field options: %w", err) - } - p.Options = append(p.Options, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumGiftCodePaymentOptions) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumGiftCodePaymentOptions#97a8cf2e as nil") - } - b.ObjStart() - b.PutID("premiumGiftCodePaymentOptions") - b.Comma() - b.FieldStart("options") - b.ArrStart() - for idx, v := range p.Options { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumGiftCodePaymentOptions#97a8cf2e: field options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumGiftCodePaymentOptions) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumGiftCodePaymentOptions#97a8cf2e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumGiftCodePaymentOptions"); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOptions#97a8cf2e: %w", err) - } - case "options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PremiumGiftCodePaymentOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOptions#97a8cf2e: field options: %w", err) - } - p.Options = append(p.Options, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode premiumGiftCodePaymentOptions#97a8cf2e: field options: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOptions returns value of Options field. -func (p *PremiumGiftCodePaymentOptions) GetOptions() (value []PremiumGiftCodePaymentOption) { - if p == nil { - return - } - return p.Options -} diff --git a/tdapi/tl_premium_limit_gen.go b/tdapi/tl_premium_limit_gen.go deleted file mode 100644 index 9215115c6..000000000 --- a/tdapi/tl_premium_limit_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumLimit represents TL type `premiumLimit#7ed372e6`. -type PremiumLimit struct { - // The type of the limit - Type PremiumLimitTypeClass - // Default value of the limit - DefaultValue int32 - // Value of the limit for Premium users - PremiumValue int32 -} - -// PremiumLimitTypeID is TL type id of PremiumLimit. -const PremiumLimitTypeID = 0x7ed372e6 - -// Ensuring interfaces in compile-time for PremiumLimit. -var ( - _ bin.Encoder = &PremiumLimit{} - _ bin.Decoder = &PremiumLimit{} - _ bin.BareEncoder = &PremiumLimit{} - _ bin.BareDecoder = &PremiumLimit{} -) - -func (p *PremiumLimit) Zero() bool { - if p == nil { - return true - } - if !(p.Type == nil) { - return false - } - if !(p.DefaultValue == 0) { - return false - } - if !(p.PremiumValue == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimit) String() string { - if p == nil { - return "PremiumLimit(nil)" - } - type Alias PremiumLimit - return fmt.Sprintf("PremiumLimit%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimit) TypeID() uint32 { - return PremiumLimitTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimit) TypeName() string { - return "premiumLimit" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimit) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimit", - ID: PremiumLimitTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "DefaultValue", - SchemaName: "default_value", - }, - { - Name: "PremiumValue", - SchemaName: "premium_value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimit) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimit#7ed372e6 as nil") - } - b.PutID(PremiumLimitTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimit) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimit#7ed372e6 as nil") - } - if p.Type == nil { - return fmt.Errorf("unable to encode premiumLimit#7ed372e6: field type is nil") - } - if err := p.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumLimit#7ed372e6: field type: %w", err) - } - b.PutInt32(p.DefaultValue) - b.PutInt32(p.PremiumValue) - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimit) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimit#7ed372e6 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimit#7ed372e6: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimit) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimit#7ed372e6 to nil") - } - { - value, err := DecodePremiumLimitType(b) - if err != nil { - return fmt.Errorf("unable to decode premiumLimit#7ed372e6: field type: %w", err) - } - p.Type = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumLimit#7ed372e6: field default_value: %w", err) - } - p.DefaultValue = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumLimit#7ed372e6: field premium_value: %w", err) - } - p.PremiumValue = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimit) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimit#7ed372e6 as nil") - } - b.ObjStart() - b.PutID("premiumLimit") - b.Comma() - b.FieldStart("type") - if p.Type == nil { - return fmt.Errorf("unable to encode premiumLimit#7ed372e6: field type is nil") - } - if err := p.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumLimit#7ed372e6: field type: %w", err) - } - b.Comma() - b.FieldStart("default_value") - b.PutInt32(p.DefaultValue) - b.Comma() - b.FieldStart("premium_value") - b.PutInt32(p.PremiumValue) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimit) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimit#7ed372e6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimit"); err != nil { - return fmt.Errorf("unable to decode premiumLimit#7ed372e6: %w", err) - } - case "type": - value, err := DecodeTDLibJSONPremiumLimitType(b) - if err != nil { - return fmt.Errorf("unable to decode premiumLimit#7ed372e6: field type: %w", err) - } - p.Type = value - case "default_value": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumLimit#7ed372e6: field default_value: %w", err) - } - p.DefaultValue = value - case "premium_value": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumLimit#7ed372e6: field premium_value: %w", err) - } - p.PremiumValue = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (p *PremiumLimit) GetType() (value PremiumLimitTypeClass) { - if p == nil { - return - } - return p.Type -} - -// GetDefaultValue returns value of DefaultValue field. -func (p *PremiumLimit) GetDefaultValue() (value int32) { - if p == nil { - return - } - return p.DefaultValue -} - -// GetPremiumValue returns value of PremiumValue field. -func (p *PremiumLimit) GetPremiumValue() (value int32) { - if p == nil { - return - } - return p.PremiumValue -} diff --git a/tdapi/tl_premium_limit_type_gen.go b/tdapi/tl_premium_limit_type_gen.go deleted file mode 100644 index e64907d15..000000000 --- a/tdapi/tl_premium_limit_type_gen.go +++ /dev/null @@ -1,2913 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumLimitTypeSupergroupCount represents TL type `premiumLimitTypeSupergroupCount#f13ff385`. -type PremiumLimitTypeSupergroupCount struct { -} - -// PremiumLimitTypeSupergroupCountTypeID is TL type id of PremiumLimitTypeSupergroupCount. -const PremiumLimitTypeSupergroupCountTypeID = 0xf13ff385 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeSupergroupCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeSupergroupCount. -var ( - _ bin.Encoder = &PremiumLimitTypeSupergroupCount{} - _ bin.Decoder = &PremiumLimitTypeSupergroupCount{} - _ bin.BareEncoder = &PremiumLimitTypeSupergroupCount{} - _ bin.BareDecoder = &PremiumLimitTypeSupergroupCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeSupergroupCount{} -) - -func (p *PremiumLimitTypeSupergroupCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeSupergroupCount) String() string { - if p == nil { - return "PremiumLimitTypeSupergroupCount(nil)" - } - type Alias PremiumLimitTypeSupergroupCount - return fmt.Sprintf("PremiumLimitTypeSupergroupCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeSupergroupCount) TypeID() uint32 { - return PremiumLimitTypeSupergroupCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeSupergroupCount) TypeName() string { - return "premiumLimitTypeSupergroupCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeSupergroupCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeSupergroupCount", - ID: PremiumLimitTypeSupergroupCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeSupergroupCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeSupergroupCount#f13ff385 as nil") - } - b.PutID(PremiumLimitTypeSupergroupCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeSupergroupCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeSupergroupCount#f13ff385 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeSupergroupCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeSupergroupCount#f13ff385 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeSupergroupCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeSupergroupCount#f13ff385: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeSupergroupCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeSupergroupCount#f13ff385 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeSupergroupCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeSupergroupCount#f13ff385 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeSupergroupCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeSupergroupCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeSupergroupCount#f13ff385 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeSupergroupCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeSupergroupCount#f13ff385: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypePinnedChatCount represents TL type `premiumLimitTypePinnedChatCount#c47543e1`. -type PremiumLimitTypePinnedChatCount struct { -} - -// PremiumLimitTypePinnedChatCountTypeID is TL type id of PremiumLimitTypePinnedChatCount. -const PremiumLimitTypePinnedChatCountTypeID = 0xc47543e1 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypePinnedChatCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypePinnedChatCount. -var ( - _ bin.Encoder = &PremiumLimitTypePinnedChatCount{} - _ bin.Decoder = &PremiumLimitTypePinnedChatCount{} - _ bin.BareEncoder = &PremiumLimitTypePinnedChatCount{} - _ bin.BareDecoder = &PremiumLimitTypePinnedChatCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypePinnedChatCount{} -) - -func (p *PremiumLimitTypePinnedChatCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypePinnedChatCount) String() string { - if p == nil { - return "PremiumLimitTypePinnedChatCount(nil)" - } - type Alias PremiumLimitTypePinnedChatCount - return fmt.Sprintf("PremiumLimitTypePinnedChatCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypePinnedChatCount) TypeID() uint32 { - return PremiumLimitTypePinnedChatCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypePinnedChatCount) TypeName() string { - return "premiumLimitTypePinnedChatCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypePinnedChatCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypePinnedChatCount", - ID: PremiumLimitTypePinnedChatCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypePinnedChatCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypePinnedChatCount#c47543e1 as nil") - } - b.PutID(PremiumLimitTypePinnedChatCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypePinnedChatCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypePinnedChatCount#c47543e1 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypePinnedChatCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypePinnedChatCount#c47543e1 to nil") - } - if err := b.ConsumeID(PremiumLimitTypePinnedChatCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypePinnedChatCount#c47543e1: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypePinnedChatCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypePinnedChatCount#c47543e1 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypePinnedChatCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypePinnedChatCount#c47543e1 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypePinnedChatCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypePinnedChatCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypePinnedChatCount#c47543e1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypePinnedChatCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypePinnedChatCount#c47543e1: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeCreatedPublicChatCount represents TL type `premiumLimitTypeCreatedPublicChatCount#1a96beb9`. -type PremiumLimitTypeCreatedPublicChatCount struct { -} - -// PremiumLimitTypeCreatedPublicChatCountTypeID is TL type id of PremiumLimitTypeCreatedPublicChatCount. -const PremiumLimitTypeCreatedPublicChatCountTypeID = 0x1a96beb9 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeCreatedPublicChatCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeCreatedPublicChatCount. -var ( - _ bin.Encoder = &PremiumLimitTypeCreatedPublicChatCount{} - _ bin.Decoder = &PremiumLimitTypeCreatedPublicChatCount{} - _ bin.BareEncoder = &PremiumLimitTypeCreatedPublicChatCount{} - _ bin.BareDecoder = &PremiumLimitTypeCreatedPublicChatCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeCreatedPublicChatCount{} -) - -func (p *PremiumLimitTypeCreatedPublicChatCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeCreatedPublicChatCount) String() string { - if p == nil { - return "PremiumLimitTypeCreatedPublicChatCount(nil)" - } - type Alias PremiumLimitTypeCreatedPublicChatCount - return fmt.Sprintf("PremiumLimitTypeCreatedPublicChatCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeCreatedPublicChatCount) TypeID() uint32 { - return PremiumLimitTypeCreatedPublicChatCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeCreatedPublicChatCount) TypeName() string { - return "premiumLimitTypeCreatedPublicChatCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeCreatedPublicChatCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeCreatedPublicChatCount", - ID: PremiumLimitTypeCreatedPublicChatCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeCreatedPublicChatCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeCreatedPublicChatCount#1a96beb9 as nil") - } - b.PutID(PremiumLimitTypeCreatedPublicChatCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeCreatedPublicChatCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeCreatedPublicChatCount#1a96beb9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeCreatedPublicChatCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeCreatedPublicChatCount#1a96beb9 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeCreatedPublicChatCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeCreatedPublicChatCount#1a96beb9: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeCreatedPublicChatCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeCreatedPublicChatCount#1a96beb9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeCreatedPublicChatCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeCreatedPublicChatCount#1a96beb9 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeCreatedPublicChatCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeCreatedPublicChatCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeCreatedPublicChatCount#1a96beb9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeCreatedPublicChatCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeCreatedPublicChatCount#1a96beb9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeSavedAnimationCount represents TL type `premiumLimitTypeSavedAnimationCount#fed27d89`. -type PremiumLimitTypeSavedAnimationCount struct { -} - -// PremiumLimitTypeSavedAnimationCountTypeID is TL type id of PremiumLimitTypeSavedAnimationCount. -const PremiumLimitTypeSavedAnimationCountTypeID = 0xfed27d89 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeSavedAnimationCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeSavedAnimationCount. -var ( - _ bin.Encoder = &PremiumLimitTypeSavedAnimationCount{} - _ bin.Decoder = &PremiumLimitTypeSavedAnimationCount{} - _ bin.BareEncoder = &PremiumLimitTypeSavedAnimationCount{} - _ bin.BareDecoder = &PremiumLimitTypeSavedAnimationCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeSavedAnimationCount{} -) - -func (p *PremiumLimitTypeSavedAnimationCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeSavedAnimationCount) String() string { - if p == nil { - return "PremiumLimitTypeSavedAnimationCount(nil)" - } - type Alias PremiumLimitTypeSavedAnimationCount - return fmt.Sprintf("PremiumLimitTypeSavedAnimationCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeSavedAnimationCount) TypeID() uint32 { - return PremiumLimitTypeSavedAnimationCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeSavedAnimationCount) TypeName() string { - return "premiumLimitTypeSavedAnimationCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeSavedAnimationCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeSavedAnimationCount", - ID: PremiumLimitTypeSavedAnimationCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeSavedAnimationCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeSavedAnimationCount#fed27d89 as nil") - } - b.PutID(PremiumLimitTypeSavedAnimationCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeSavedAnimationCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeSavedAnimationCount#fed27d89 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeSavedAnimationCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeSavedAnimationCount#fed27d89 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeSavedAnimationCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeSavedAnimationCount#fed27d89: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeSavedAnimationCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeSavedAnimationCount#fed27d89 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeSavedAnimationCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeSavedAnimationCount#fed27d89 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeSavedAnimationCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeSavedAnimationCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeSavedAnimationCount#fed27d89 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeSavedAnimationCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeSavedAnimationCount#fed27d89: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeFavoriteStickerCount represents TL type `premiumLimitTypeFavoriteStickerCount#2621e223`. -type PremiumLimitTypeFavoriteStickerCount struct { -} - -// PremiumLimitTypeFavoriteStickerCountTypeID is TL type id of PremiumLimitTypeFavoriteStickerCount. -const PremiumLimitTypeFavoriteStickerCountTypeID = 0x2621e223 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeFavoriteStickerCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeFavoriteStickerCount. -var ( - _ bin.Encoder = &PremiumLimitTypeFavoriteStickerCount{} - _ bin.Decoder = &PremiumLimitTypeFavoriteStickerCount{} - _ bin.BareEncoder = &PremiumLimitTypeFavoriteStickerCount{} - _ bin.BareDecoder = &PremiumLimitTypeFavoriteStickerCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeFavoriteStickerCount{} -) - -func (p *PremiumLimitTypeFavoriteStickerCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeFavoriteStickerCount) String() string { - if p == nil { - return "PremiumLimitTypeFavoriteStickerCount(nil)" - } - type Alias PremiumLimitTypeFavoriteStickerCount - return fmt.Sprintf("PremiumLimitTypeFavoriteStickerCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeFavoriteStickerCount) TypeID() uint32 { - return PremiumLimitTypeFavoriteStickerCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeFavoriteStickerCount) TypeName() string { - return "premiumLimitTypeFavoriteStickerCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeFavoriteStickerCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeFavoriteStickerCount", - ID: PremiumLimitTypeFavoriteStickerCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeFavoriteStickerCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeFavoriteStickerCount#2621e223 as nil") - } - b.PutID(PremiumLimitTypeFavoriteStickerCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeFavoriteStickerCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeFavoriteStickerCount#2621e223 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeFavoriteStickerCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeFavoriteStickerCount#2621e223 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeFavoriteStickerCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeFavoriteStickerCount#2621e223: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeFavoriteStickerCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeFavoriteStickerCount#2621e223 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeFavoriteStickerCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeFavoriteStickerCount#2621e223 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeFavoriteStickerCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeFavoriteStickerCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeFavoriteStickerCount#2621e223 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeFavoriteStickerCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeFavoriteStickerCount#2621e223: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeChatFolderCount represents TL type `premiumLimitTypeChatFolderCount#1680096e`. -type PremiumLimitTypeChatFolderCount struct { -} - -// PremiumLimitTypeChatFolderCountTypeID is TL type id of PremiumLimitTypeChatFolderCount. -const PremiumLimitTypeChatFolderCountTypeID = 0x1680096e - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeChatFolderCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeChatFolderCount. -var ( - _ bin.Encoder = &PremiumLimitTypeChatFolderCount{} - _ bin.Decoder = &PremiumLimitTypeChatFolderCount{} - _ bin.BareEncoder = &PremiumLimitTypeChatFolderCount{} - _ bin.BareDecoder = &PremiumLimitTypeChatFolderCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeChatFolderCount{} -) - -func (p *PremiumLimitTypeChatFolderCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeChatFolderCount) String() string { - if p == nil { - return "PremiumLimitTypeChatFolderCount(nil)" - } - type Alias PremiumLimitTypeChatFolderCount - return fmt.Sprintf("PremiumLimitTypeChatFolderCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeChatFolderCount) TypeID() uint32 { - return PremiumLimitTypeChatFolderCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeChatFolderCount) TypeName() string { - return "premiumLimitTypeChatFolderCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeChatFolderCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeChatFolderCount", - ID: PremiumLimitTypeChatFolderCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeChatFolderCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeChatFolderCount#1680096e as nil") - } - b.PutID(PremiumLimitTypeChatFolderCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeChatFolderCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeChatFolderCount#1680096e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeChatFolderCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeChatFolderCount#1680096e to nil") - } - if err := b.ConsumeID(PremiumLimitTypeChatFolderCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeChatFolderCount#1680096e: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeChatFolderCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeChatFolderCount#1680096e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeChatFolderCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeChatFolderCount#1680096e as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeChatFolderCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeChatFolderCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeChatFolderCount#1680096e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeChatFolderCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeChatFolderCount#1680096e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeChatFolderChosenChatCount represents TL type `premiumLimitTypeChatFolderChosenChatCount#64d14355`. -type PremiumLimitTypeChatFolderChosenChatCount struct { -} - -// PremiumLimitTypeChatFolderChosenChatCountTypeID is TL type id of PremiumLimitTypeChatFolderChosenChatCount. -const PremiumLimitTypeChatFolderChosenChatCountTypeID = 0x64d14355 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeChatFolderChosenChatCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeChatFolderChosenChatCount. -var ( - _ bin.Encoder = &PremiumLimitTypeChatFolderChosenChatCount{} - _ bin.Decoder = &PremiumLimitTypeChatFolderChosenChatCount{} - _ bin.BareEncoder = &PremiumLimitTypeChatFolderChosenChatCount{} - _ bin.BareDecoder = &PremiumLimitTypeChatFolderChosenChatCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeChatFolderChosenChatCount{} -) - -func (p *PremiumLimitTypeChatFolderChosenChatCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeChatFolderChosenChatCount) String() string { - if p == nil { - return "PremiumLimitTypeChatFolderChosenChatCount(nil)" - } - type Alias PremiumLimitTypeChatFolderChosenChatCount - return fmt.Sprintf("PremiumLimitTypeChatFolderChosenChatCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeChatFolderChosenChatCount) TypeID() uint32 { - return PremiumLimitTypeChatFolderChosenChatCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeChatFolderChosenChatCount) TypeName() string { - return "premiumLimitTypeChatFolderChosenChatCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeChatFolderChosenChatCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeChatFolderChosenChatCount", - ID: PremiumLimitTypeChatFolderChosenChatCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeChatFolderChosenChatCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeChatFolderChosenChatCount#64d14355 as nil") - } - b.PutID(PremiumLimitTypeChatFolderChosenChatCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeChatFolderChosenChatCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeChatFolderChosenChatCount#64d14355 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeChatFolderChosenChatCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeChatFolderChosenChatCount#64d14355 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeChatFolderChosenChatCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeChatFolderChosenChatCount#64d14355: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeChatFolderChosenChatCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeChatFolderChosenChatCount#64d14355 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeChatFolderChosenChatCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeChatFolderChosenChatCount#64d14355 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeChatFolderChosenChatCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeChatFolderChosenChatCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeChatFolderChosenChatCount#64d14355 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeChatFolderChosenChatCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeChatFolderChosenChatCount#64d14355: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypePinnedArchivedChatCount represents TL type `premiumLimitTypePinnedArchivedChatCount#588b2a0c`. -type PremiumLimitTypePinnedArchivedChatCount struct { -} - -// PremiumLimitTypePinnedArchivedChatCountTypeID is TL type id of PremiumLimitTypePinnedArchivedChatCount. -const PremiumLimitTypePinnedArchivedChatCountTypeID = 0x588b2a0c - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypePinnedArchivedChatCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypePinnedArchivedChatCount. -var ( - _ bin.Encoder = &PremiumLimitTypePinnedArchivedChatCount{} - _ bin.Decoder = &PremiumLimitTypePinnedArchivedChatCount{} - _ bin.BareEncoder = &PremiumLimitTypePinnedArchivedChatCount{} - _ bin.BareDecoder = &PremiumLimitTypePinnedArchivedChatCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypePinnedArchivedChatCount{} -) - -func (p *PremiumLimitTypePinnedArchivedChatCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypePinnedArchivedChatCount) String() string { - if p == nil { - return "PremiumLimitTypePinnedArchivedChatCount(nil)" - } - type Alias PremiumLimitTypePinnedArchivedChatCount - return fmt.Sprintf("PremiumLimitTypePinnedArchivedChatCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypePinnedArchivedChatCount) TypeID() uint32 { - return PremiumLimitTypePinnedArchivedChatCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypePinnedArchivedChatCount) TypeName() string { - return "premiumLimitTypePinnedArchivedChatCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypePinnedArchivedChatCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypePinnedArchivedChatCount", - ID: PremiumLimitTypePinnedArchivedChatCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypePinnedArchivedChatCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypePinnedArchivedChatCount#588b2a0c as nil") - } - b.PutID(PremiumLimitTypePinnedArchivedChatCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypePinnedArchivedChatCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypePinnedArchivedChatCount#588b2a0c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypePinnedArchivedChatCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypePinnedArchivedChatCount#588b2a0c to nil") - } - if err := b.ConsumeID(PremiumLimitTypePinnedArchivedChatCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypePinnedArchivedChatCount#588b2a0c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypePinnedArchivedChatCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypePinnedArchivedChatCount#588b2a0c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypePinnedArchivedChatCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypePinnedArchivedChatCount#588b2a0c as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypePinnedArchivedChatCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypePinnedArchivedChatCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypePinnedArchivedChatCount#588b2a0c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypePinnedArchivedChatCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypePinnedArchivedChatCount#588b2a0c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypePinnedSavedMessagesTopicCount represents TL type `premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df`. -type PremiumLimitTypePinnedSavedMessagesTopicCount struct { -} - -// PremiumLimitTypePinnedSavedMessagesTopicCountTypeID is TL type id of PremiumLimitTypePinnedSavedMessagesTopicCount. -const PremiumLimitTypePinnedSavedMessagesTopicCountTypeID = 0xa3eb64df - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypePinnedSavedMessagesTopicCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypePinnedSavedMessagesTopicCount. -var ( - _ bin.Encoder = &PremiumLimitTypePinnedSavedMessagesTopicCount{} - _ bin.Decoder = &PremiumLimitTypePinnedSavedMessagesTopicCount{} - _ bin.BareEncoder = &PremiumLimitTypePinnedSavedMessagesTopicCount{} - _ bin.BareDecoder = &PremiumLimitTypePinnedSavedMessagesTopicCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypePinnedSavedMessagesTopicCount{} -) - -func (p *PremiumLimitTypePinnedSavedMessagesTopicCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypePinnedSavedMessagesTopicCount) String() string { - if p == nil { - return "PremiumLimitTypePinnedSavedMessagesTopicCount(nil)" - } - type Alias PremiumLimitTypePinnedSavedMessagesTopicCount - return fmt.Sprintf("PremiumLimitTypePinnedSavedMessagesTopicCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypePinnedSavedMessagesTopicCount) TypeID() uint32 { - return PremiumLimitTypePinnedSavedMessagesTopicCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypePinnedSavedMessagesTopicCount) TypeName() string { - return "premiumLimitTypePinnedSavedMessagesTopicCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypePinnedSavedMessagesTopicCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypePinnedSavedMessagesTopicCount", - ID: PremiumLimitTypePinnedSavedMessagesTopicCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypePinnedSavedMessagesTopicCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df as nil") - } - b.PutID(PremiumLimitTypePinnedSavedMessagesTopicCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypePinnedSavedMessagesTopicCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypePinnedSavedMessagesTopicCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df to nil") - } - if err := b.ConsumeID(PremiumLimitTypePinnedSavedMessagesTopicCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypePinnedSavedMessagesTopicCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypePinnedSavedMessagesTopicCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypePinnedSavedMessagesTopicCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypePinnedSavedMessagesTopicCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypePinnedSavedMessagesTopicCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeCaptionLength represents TL type `premiumLimitTypeCaptionLength#1185d83a`. -type PremiumLimitTypeCaptionLength struct { -} - -// PremiumLimitTypeCaptionLengthTypeID is TL type id of PremiumLimitTypeCaptionLength. -const PremiumLimitTypeCaptionLengthTypeID = 0x1185d83a - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeCaptionLength) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeCaptionLength. -var ( - _ bin.Encoder = &PremiumLimitTypeCaptionLength{} - _ bin.Decoder = &PremiumLimitTypeCaptionLength{} - _ bin.BareEncoder = &PremiumLimitTypeCaptionLength{} - _ bin.BareDecoder = &PremiumLimitTypeCaptionLength{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeCaptionLength{} -) - -func (p *PremiumLimitTypeCaptionLength) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeCaptionLength) String() string { - if p == nil { - return "PremiumLimitTypeCaptionLength(nil)" - } - type Alias PremiumLimitTypeCaptionLength - return fmt.Sprintf("PremiumLimitTypeCaptionLength%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeCaptionLength) TypeID() uint32 { - return PremiumLimitTypeCaptionLengthTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeCaptionLength) TypeName() string { - return "premiumLimitTypeCaptionLength" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeCaptionLength) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeCaptionLength", - ID: PremiumLimitTypeCaptionLengthTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeCaptionLength) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeCaptionLength#1185d83a as nil") - } - b.PutID(PremiumLimitTypeCaptionLengthTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeCaptionLength) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeCaptionLength#1185d83a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeCaptionLength) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeCaptionLength#1185d83a to nil") - } - if err := b.ConsumeID(PremiumLimitTypeCaptionLengthTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeCaptionLength#1185d83a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeCaptionLength) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeCaptionLength#1185d83a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeCaptionLength) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeCaptionLength#1185d83a as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeCaptionLength") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeCaptionLength) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeCaptionLength#1185d83a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeCaptionLength"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeCaptionLength#1185d83a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeBioLength represents TL type `premiumLimitTypeBioLength#bba28603`. -type PremiumLimitTypeBioLength struct { -} - -// PremiumLimitTypeBioLengthTypeID is TL type id of PremiumLimitTypeBioLength. -const PremiumLimitTypeBioLengthTypeID = 0xbba28603 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeBioLength) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeBioLength. -var ( - _ bin.Encoder = &PremiumLimitTypeBioLength{} - _ bin.Decoder = &PremiumLimitTypeBioLength{} - _ bin.BareEncoder = &PremiumLimitTypeBioLength{} - _ bin.BareDecoder = &PremiumLimitTypeBioLength{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeBioLength{} -) - -func (p *PremiumLimitTypeBioLength) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeBioLength) String() string { - if p == nil { - return "PremiumLimitTypeBioLength(nil)" - } - type Alias PremiumLimitTypeBioLength - return fmt.Sprintf("PremiumLimitTypeBioLength%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeBioLength) TypeID() uint32 { - return PremiumLimitTypeBioLengthTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeBioLength) TypeName() string { - return "premiumLimitTypeBioLength" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeBioLength) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeBioLength", - ID: PremiumLimitTypeBioLengthTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeBioLength) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeBioLength#bba28603 as nil") - } - b.PutID(PremiumLimitTypeBioLengthTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeBioLength) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeBioLength#bba28603 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeBioLength) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeBioLength#bba28603 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeBioLengthTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeBioLength#bba28603: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeBioLength) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeBioLength#bba28603 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeBioLength) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeBioLength#bba28603 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeBioLength") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeBioLength) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeBioLength#bba28603 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeBioLength"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeBioLength#bba28603: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeChatFolderInviteLinkCount represents TL type `premiumLimitTypeChatFolderInviteLinkCount#f854261a`. -type PremiumLimitTypeChatFolderInviteLinkCount struct { -} - -// PremiumLimitTypeChatFolderInviteLinkCountTypeID is TL type id of PremiumLimitTypeChatFolderInviteLinkCount. -const PremiumLimitTypeChatFolderInviteLinkCountTypeID = 0xf854261a - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeChatFolderInviteLinkCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeChatFolderInviteLinkCount. -var ( - _ bin.Encoder = &PremiumLimitTypeChatFolderInviteLinkCount{} - _ bin.Decoder = &PremiumLimitTypeChatFolderInviteLinkCount{} - _ bin.BareEncoder = &PremiumLimitTypeChatFolderInviteLinkCount{} - _ bin.BareDecoder = &PremiumLimitTypeChatFolderInviteLinkCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeChatFolderInviteLinkCount{} -) - -func (p *PremiumLimitTypeChatFolderInviteLinkCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeChatFolderInviteLinkCount) String() string { - if p == nil { - return "PremiumLimitTypeChatFolderInviteLinkCount(nil)" - } - type Alias PremiumLimitTypeChatFolderInviteLinkCount - return fmt.Sprintf("PremiumLimitTypeChatFolderInviteLinkCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeChatFolderInviteLinkCount) TypeID() uint32 { - return PremiumLimitTypeChatFolderInviteLinkCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeChatFolderInviteLinkCount) TypeName() string { - return "premiumLimitTypeChatFolderInviteLinkCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeChatFolderInviteLinkCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeChatFolderInviteLinkCount", - ID: PremiumLimitTypeChatFolderInviteLinkCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeChatFolderInviteLinkCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeChatFolderInviteLinkCount#f854261a as nil") - } - b.PutID(PremiumLimitTypeChatFolderInviteLinkCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeChatFolderInviteLinkCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeChatFolderInviteLinkCount#f854261a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeChatFolderInviteLinkCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeChatFolderInviteLinkCount#f854261a to nil") - } - if err := b.ConsumeID(PremiumLimitTypeChatFolderInviteLinkCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeChatFolderInviteLinkCount#f854261a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeChatFolderInviteLinkCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeChatFolderInviteLinkCount#f854261a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeChatFolderInviteLinkCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeChatFolderInviteLinkCount#f854261a as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeChatFolderInviteLinkCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeChatFolderInviteLinkCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeChatFolderInviteLinkCount#f854261a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeChatFolderInviteLinkCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeChatFolderInviteLinkCount#f854261a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeShareableChatFolderCount represents TL type `premiumLimitTypeShareableChatFolderCount#601eb4c7`. -type PremiumLimitTypeShareableChatFolderCount struct { -} - -// PremiumLimitTypeShareableChatFolderCountTypeID is TL type id of PremiumLimitTypeShareableChatFolderCount. -const PremiumLimitTypeShareableChatFolderCountTypeID = 0x601eb4c7 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeShareableChatFolderCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeShareableChatFolderCount. -var ( - _ bin.Encoder = &PremiumLimitTypeShareableChatFolderCount{} - _ bin.Decoder = &PremiumLimitTypeShareableChatFolderCount{} - _ bin.BareEncoder = &PremiumLimitTypeShareableChatFolderCount{} - _ bin.BareDecoder = &PremiumLimitTypeShareableChatFolderCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeShareableChatFolderCount{} -) - -func (p *PremiumLimitTypeShareableChatFolderCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeShareableChatFolderCount) String() string { - if p == nil { - return "PremiumLimitTypeShareableChatFolderCount(nil)" - } - type Alias PremiumLimitTypeShareableChatFolderCount - return fmt.Sprintf("PremiumLimitTypeShareableChatFolderCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeShareableChatFolderCount) TypeID() uint32 { - return PremiumLimitTypeShareableChatFolderCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeShareableChatFolderCount) TypeName() string { - return "premiumLimitTypeShareableChatFolderCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeShareableChatFolderCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeShareableChatFolderCount", - ID: PremiumLimitTypeShareableChatFolderCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeShareableChatFolderCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeShareableChatFolderCount#601eb4c7 as nil") - } - b.PutID(PremiumLimitTypeShareableChatFolderCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeShareableChatFolderCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeShareableChatFolderCount#601eb4c7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeShareableChatFolderCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeShareableChatFolderCount#601eb4c7 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeShareableChatFolderCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeShareableChatFolderCount#601eb4c7: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeShareableChatFolderCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeShareableChatFolderCount#601eb4c7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeShareableChatFolderCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeShareableChatFolderCount#601eb4c7 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeShareableChatFolderCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeShareableChatFolderCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeShareableChatFolderCount#601eb4c7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeShareableChatFolderCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeShareableChatFolderCount#601eb4c7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeActiveStoryCount represents TL type `premiumLimitTypeActiveStoryCount#8d2c269c`. -type PremiumLimitTypeActiveStoryCount struct { -} - -// PremiumLimitTypeActiveStoryCountTypeID is TL type id of PremiumLimitTypeActiveStoryCount. -const PremiumLimitTypeActiveStoryCountTypeID = 0x8d2c269c - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeActiveStoryCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeActiveStoryCount. -var ( - _ bin.Encoder = &PremiumLimitTypeActiveStoryCount{} - _ bin.Decoder = &PremiumLimitTypeActiveStoryCount{} - _ bin.BareEncoder = &PremiumLimitTypeActiveStoryCount{} - _ bin.BareDecoder = &PremiumLimitTypeActiveStoryCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeActiveStoryCount{} -) - -func (p *PremiumLimitTypeActiveStoryCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeActiveStoryCount) String() string { - if p == nil { - return "PremiumLimitTypeActiveStoryCount(nil)" - } - type Alias PremiumLimitTypeActiveStoryCount - return fmt.Sprintf("PremiumLimitTypeActiveStoryCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeActiveStoryCount) TypeID() uint32 { - return PremiumLimitTypeActiveStoryCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeActiveStoryCount) TypeName() string { - return "premiumLimitTypeActiveStoryCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeActiveStoryCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeActiveStoryCount", - ID: PremiumLimitTypeActiveStoryCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeActiveStoryCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeActiveStoryCount#8d2c269c as nil") - } - b.PutID(PremiumLimitTypeActiveStoryCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeActiveStoryCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeActiveStoryCount#8d2c269c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeActiveStoryCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeActiveStoryCount#8d2c269c to nil") - } - if err := b.ConsumeID(PremiumLimitTypeActiveStoryCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeActiveStoryCount#8d2c269c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeActiveStoryCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeActiveStoryCount#8d2c269c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeActiveStoryCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeActiveStoryCount#8d2c269c as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeActiveStoryCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeActiveStoryCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeActiveStoryCount#8d2c269c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeActiveStoryCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeActiveStoryCount#8d2c269c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeWeeklySentStoryCount represents TL type `premiumLimitTypeWeeklySentStoryCount#269c34b`. -type PremiumLimitTypeWeeklySentStoryCount struct { -} - -// PremiumLimitTypeWeeklySentStoryCountTypeID is TL type id of PremiumLimitTypeWeeklySentStoryCount. -const PremiumLimitTypeWeeklySentStoryCountTypeID = 0x269c34b - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeWeeklySentStoryCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeWeeklySentStoryCount. -var ( - _ bin.Encoder = &PremiumLimitTypeWeeklySentStoryCount{} - _ bin.Decoder = &PremiumLimitTypeWeeklySentStoryCount{} - _ bin.BareEncoder = &PremiumLimitTypeWeeklySentStoryCount{} - _ bin.BareDecoder = &PremiumLimitTypeWeeklySentStoryCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeWeeklySentStoryCount{} -) - -func (p *PremiumLimitTypeWeeklySentStoryCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeWeeklySentStoryCount) String() string { - if p == nil { - return "PremiumLimitTypeWeeklySentStoryCount(nil)" - } - type Alias PremiumLimitTypeWeeklySentStoryCount - return fmt.Sprintf("PremiumLimitTypeWeeklySentStoryCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeWeeklySentStoryCount) TypeID() uint32 { - return PremiumLimitTypeWeeklySentStoryCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeWeeklySentStoryCount) TypeName() string { - return "premiumLimitTypeWeeklySentStoryCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeWeeklySentStoryCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeWeeklySentStoryCount", - ID: PremiumLimitTypeWeeklySentStoryCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeWeeklySentStoryCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeWeeklySentStoryCount#269c34b as nil") - } - b.PutID(PremiumLimitTypeWeeklySentStoryCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeWeeklySentStoryCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeWeeklySentStoryCount#269c34b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeWeeklySentStoryCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeWeeklySentStoryCount#269c34b to nil") - } - if err := b.ConsumeID(PremiumLimitTypeWeeklySentStoryCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeWeeklySentStoryCount#269c34b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeWeeklySentStoryCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeWeeklySentStoryCount#269c34b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeWeeklySentStoryCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeWeeklySentStoryCount#269c34b as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeWeeklySentStoryCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeWeeklySentStoryCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeWeeklySentStoryCount#269c34b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeWeeklySentStoryCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeWeeklySentStoryCount#269c34b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeMonthlySentStoryCount represents TL type `premiumLimitTypeMonthlySentStoryCount#30d84b83`. -type PremiumLimitTypeMonthlySentStoryCount struct { -} - -// PremiumLimitTypeMonthlySentStoryCountTypeID is TL type id of PremiumLimitTypeMonthlySentStoryCount. -const PremiumLimitTypeMonthlySentStoryCountTypeID = 0x30d84b83 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeMonthlySentStoryCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeMonthlySentStoryCount. -var ( - _ bin.Encoder = &PremiumLimitTypeMonthlySentStoryCount{} - _ bin.Decoder = &PremiumLimitTypeMonthlySentStoryCount{} - _ bin.BareEncoder = &PremiumLimitTypeMonthlySentStoryCount{} - _ bin.BareDecoder = &PremiumLimitTypeMonthlySentStoryCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeMonthlySentStoryCount{} -) - -func (p *PremiumLimitTypeMonthlySentStoryCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeMonthlySentStoryCount) String() string { - if p == nil { - return "PremiumLimitTypeMonthlySentStoryCount(nil)" - } - type Alias PremiumLimitTypeMonthlySentStoryCount - return fmt.Sprintf("PremiumLimitTypeMonthlySentStoryCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeMonthlySentStoryCount) TypeID() uint32 { - return PremiumLimitTypeMonthlySentStoryCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeMonthlySentStoryCount) TypeName() string { - return "premiumLimitTypeMonthlySentStoryCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeMonthlySentStoryCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeMonthlySentStoryCount", - ID: PremiumLimitTypeMonthlySentStoryCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeMonthlySentStoryCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeMonthlySentStoryCount#30d84b83 as nil") - } - b.PutID(PremiumLimitTypeMonthlySentStoryCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeMonthlySentStoryCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeMonthlySentStoryCount#30d84b83 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeMonthlySentStoryCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeMonthlySentStoryCount#30d84b83 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeMonthlySentStoryCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeMonthlySentStoryCount#30d84b83: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeMonthlySentStoryCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeMonthlySentStoryCount#30d84b83 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeMonthlySentStoryCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeMonthlySentStoryCount#30d84b83 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeMonthlySentStoryCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeMonthlySentStoryCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeMonthlySentStoryCount#30d84b83 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeMonthlySentStoryCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeMonthlySentStoryCount#30d84b83: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeStoryCaptionLength represents TL type `premiumLimitTypeStoryCaptionLength#bed53302`. -type PremiumLimitTypeStoryCaptionLength struct { -} - -// PremiumLimitTypeStoryCaptionLengthTypeID is TL type id of PremiumLimitTypeStoryCaptionLength. -const PremiumLimitTypeStoryCaptionLengthTypeID = 0xbed53302 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeStoryCaptionLength) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeStoryCaptionLength. -var ( - _ bin.Encoder = &PremiumLimitTypeStoryCaptionLength{} - _ bin.Decoder = &PremiumLimitTypeStoryCaptionLength{} - _ bin.BareEncoder = &PremiumLimitTypeStoryCaptionLength{} - _ bin.BareDecoder = &PremiumLimitTypeStoryCaptionLength{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeStoryCaptionLength{} -) - -func (p *PremiumLimitTypeStoryCaptionLength) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeStoryCaptionLength) String() string { - if p == nil { - return "PremiumLimitTypeStoryCaptionLength(nil)" - } - type Alias PremiumLimitTypeStoryCaptionLength - return fmt.Sprintf("PremiumLimitTypeStoryCaptionLength%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeStoryCaptionLength) TypeID() uint32 { - return PremiumLimitTypeStoryCaptionLengthTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeStoryCaptionLength) TypeName() string { - return "premiumLimitTypeStoryCaptionLength" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeStoryCaptionLength) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeStoryCaptionLength", - ID: PremiumLimitTypeStoryCaptionLengthTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeStoryCaptionLength) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeStoryCaptionLength#bed53302 as nil") - } - b.PutID(PremiumLimitTypeStoryCaptionLengthTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeStoryCaptionLength) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeStoryCaptionLength#bed53302 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeStoryCaptionLength) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeStoryCaptionLength#bed53302 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeStoryCaptionLengthTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeStoryCaptionLength#bed53302: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeStoryCaptionLength) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeStoryCaptionLength#bed53302 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeStoryCaptionLength) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeStoryCaptionLength#bed53302 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeStoryCaptionLength") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeStoryCaptionLength) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeStoryCaptionLength#bed53302 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeStoryCaptionLength"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeStoryCaptionLength#bed53302: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeStorySuggestedReactionAreaCount represents TL type `premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807`. -type PremiumLimitTypeStorySuggestedReactionAreaCount struct { -} - -// PremiumLimitTypeStorySuggestedReactionAreaCountTypeID is TL type id of PremiumLimitTypeStorySuggestedReactionAreaCount. -const PremiumLimitTypeStorySuggestedReactionAreaCountTypeID = 0xba42b807 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeStorySuggestedReactionAreaCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeStorySuggestedReactionAreaCount. -var ( - _ bin.Encoder = &PremiumLimitTypeStorySuggestedReactionAreaCount{} - _ bin.Decoder = &PremiumLimitTypeStorySuggestedReactionAreaCount{} - _ bin.BareEncoder = &PremiumLimitTypeStorySuggestedReactionAreaCount{} - _ bin.BareDecoder = &PremiumLimitTypeStorySuggestedReactionAreaCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeStorySuggestedReactionAreaCount{} -) - -func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) String() string { - if p == nil { - return "PremiumLimitTypeStorySuggestedReactionAreaCount(nil)" - } - type Alias PremiumLimitTypeStorySuggestedReactionAreaCount - return fmt.Sprintf("PremiumLimitTypeStorySuggestedReactionAreaCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeStorySuggestedReactionAreaCount) TypeID() uint32 { - return PremiumLimitTypeStorySuggestedReactionAreaCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeStorySuggestedReactionAreaCount) TypeName() string { - return "premiumLimitTypeStorySuggestedReactionAreaCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeStorySuggestedReactionAreaCount", - ID: PremiumLimitTypeStorySuggestedReactionAreaCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 as nil") - } - b.PutID(PremiumLimitTypeStorySuggestedReactionAreaCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeStorySuggestedReactionAreaCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeStorySuggestedReactionAreaCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeStorySuggestedReactionAreaCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeStorySuggestedReactionAreaCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeSimilarChatCount represents TL type `premiumLimitTypeSimilarChatCount#a2ce1f11`. -type PremiumLimitTypeSimilarChatCount struct { -} - -// PremiumLimitTypeSimilarChatCountTypeID is TL type id of PremiumLimitTypeSimilarChatCount. -const PremiumLimitTypeSimilarChatCountTypeID = 0xa2ce1f11 - -// construct implements constructor of PremiumLimitTypeClass. -func (p PremiumLimitTypeSimilarChatCount) construct() PremiumLimitTypeClass { return &p } - -// Ensuring interfaces in compile-time for PremiumLimitTypeSimilarChatCount. -var ( - _ bin.Encoder = &PremiumLimitTypeSimilarChatCount{} - _ bin.Decoder = &PremiumLimitTypeSimilarChatCount{} - _ bin.BareEncoder = &PremiumLimitTypeSimilarChatCount{} - _ bin.BareDecoder = &PremiumLimitTypeSimilarChatCount{} - - _ PremiumLimitTypeClass = &PremiumLimitTypeSimilarChatCount{} -) - -func (p *PremiumLimitTypeSimilarChatCount) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumLimitTypeSimilarChatCount) String() string { - if p == nil { - return "PremiumLimitTypeSimilarChatCount(nil)" - } - type Alias PremiumLimitTypeSimilarChatCount - return fmt.Sprintf("PremiumLimitTypeSimilarChatCount%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumLimitTypeSimilarChatCount) TypeID() uint32 { - return PremiumLimitTypeSimilarChatCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumLimitTypeSimilarChatCount) TypeName() string { - return "premiumLimitTypeSimilarChatCount" -} - -// TypeInfo returns info about TL type. -func (p *PremiumLimitTypeSimilarChatCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumLimitTypeSimilarChatCount", - ID: PremiumLimitTypeSimilarChatCountTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumLimitTypeSimilarChatCount) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeSimilarChatCount#a2ce1f11 as nil") - } - b.PutID(PremiumLimitTypeSimilarChatCountTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumLimitTypeSimilarChatCount) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeSimilarChatCount#a2ce1f11 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumLimitTypeSimilarChatCount) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeSimilarChatCount#a2ce1f11 to nil") - } - if err := b.ConsumeID(PremiumLimitTypeSimilarChatCountTypeID); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeSimilarChatCount#a2ce1f11: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumLimitTypeSimilarChatCount) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeSimilarChatCount#a2ce1f11 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumLimitTypeSimilarChatCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumLimitTypeSimilarChatCount#a2ce1f11 as nil") - } - b.ObjStart() - b.PutID("premiumLimitTypeSimilarChatCount") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumLimitTypeSimilarChatCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumLimitTypeSimilarChatCount#a2ce1f11 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumLimitTypeSimilarChatCount"); err != nil { - return fmt.Errorf("unable to decode premiumLimitTypeSimilarChatCount#a2ce1f11: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumLimitTypeClassName is schema name of PremiumLimitTypeClass. -const PremiumLimitTypeClassName = "PremiumLimitType" - -// PremiumLimitTypeClass represents PremiumLimitType generic type. -// -// Example: -// -// g, err := tdapi.DecodePremiumLimitType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PremiumLimitTypeSupergroupCount: // premiumLimitTypeSupergroupCount#f13ff385 -// case *tdapi.PremiumLimitTypePinnedChatCount: // premiumLimitTypePinnedChatCount#c47543e1 -// case *tdapi.PremiumLimitTypeCreatedPublicChatCount: // premiumLimitTypeCreatedPublicChatCount#1a96beb9 -// case *tdapi.PremiumLimitTypeSavedAnimationCount: // premiumLimitTypeSavedAnimationCount#fed27d89 -// case *tdapi.PremiumLimitTypeFavoriteStickerCount: // premiumLimitTypeFavoriteStickerCount#2621e223 -// case *tdapi.PremiumLimitTypeChatFolderCount: // premiumLimitTypeChatFolderCount#1680096e -// case *tdapi.PremiumLimitTypeChatFolderChosenChatCount: // premiumLimitTypeChatFolderChosenChatCount#64d14355 -// case *tdapi.PremiumLimitTypePinnedArchivedChatCount: // premiumLimitTypePinnedArchivedChatCount#588b2a0c -// case *tdapi.PremiumLimitTypePinnedSavedMessagesTopicCount: // premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df -// case *tdapi.PremiumLimitTypeCaptionLength: // premiumLimitTypeCaptionLength#1185d83a -// case *tdapi.PremiumLimitTypeBioLength: // premiumLimitTypeBioLength#bba28603 -// case *tdapi.PremiumLimitTypeChatFolderInviteLinkCount: // premiumLimitTypeChatFolderInviteLinkCount#f854261a -// case *tdapi.PremiumLimitTypeShareableChatFolderCount: // premiumLimitTypeShareableChatFolderCount#601eb4c7 -// case *tdapi.PremiumLimitTypeActiveStoryCount: // premiumLimitTypeActiveStoryCount#8d2c269c -// case *tdapi.PremiumLimitTypeWeeklySentStoryCount: // premiumLimitTypeWeeklySentStoryCount#269c34b -// case *tdapi.PremiumLimitTypeMonthlySentStoryCount: // premiumLimitTypeMonthlySentStoryCount#30d84b83 -// case *tdapi.PremiumLimitTypeStoryCaptionLength: // premiumLimitTypeStoryCaptionLength#bed53302 -// case *tdapi.PremiumLimitTypeStorySuggestedReactionAreaCount: // premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807 -// case *tdapi.PremiumLimitTypeSimilarChatCount: // premiumLimitTypeSimilarChatCount#a2ce1f11 -// default: panic(v) -// } -type PremiumLimitTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PremiumLimitTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePremiumLimitType implements binary de-serialization for PremiumLimitTypeClass. -func DecodePremiumLimitType(buf *bin.Buffer) (PremiumLimitTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PremiumLimitTypeSupergroupCountTypeID: - // Decoding premiumLimitTypeSupergroupCount#f13ff385. - v := PremiumLimitTypeSupergroupCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypePinnedChatCountTypeID: - // Decoding premiumLimitTypePinnedChatCount#c47543e1. - v := PremiumLimitTypePinnedChatCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeCreatedPublicChatCountTypeID: - // Decoding premiumLimitTypeCreatedPublicChatCount#1a96beb9. - v := PremiumLimitTypeCreatedPublicChatCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeSavedAnimationCountTypeID: - // Decoding premiumLimitTypeSavedAnimationCount#fed27d89. - v := PremiumLimitTypeSavedAnimationCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeFavoriteStickerCountTypeID: - // Decoding premiumLimitTypeFavoriteStickerCount#2621e223. - v := PremiumLimitTypeFavoriteStickerCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeChatFolderCountTypeID: - // Decoding premiumLimitTypeChatFolderCount#1680096e. - v := PremiumLimitTypeChatFolderCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeChatFolderChosenChatCountTypeID: - // Decoding premiumLimitTypeChatFolderChosenChatCount#64d14355. - v := PremiumLimitTypeChatFolderChosenChatCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypePinnedArchivedChatCountTypeID: - // Decoding premiumLimitTypePinnedArchivedChatCount#588b2a0c. - v := PremiumLimitTypePinnedArchivedChatCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypePinnedSavedMessagesTopicCountTypeID: - // Decoding premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df. - v := PremiumLimitTypePinnedSavedMessagesTopicCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeCaptionLengthTypeID: - // Decoding premiumLimitTypeCaptionLength#1185d83a. - v := PremiumLimitTypeCaptionLength{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeBioLengthTypeID: - // Decoding premiumLimitTypeBioLength#bba28603. - v := PremiumLimitTypeBioLength{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeChatFolderInviteLinkCountTypeID: - // Decoding premiumLimitTypeChatFolderInviteLinkCount#f854261a. - v := PremiumLimitTypeChatFolderInviteLinkCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeShareableChatFolderCountTypeID: - // Decoding premiumLimitTypeShareableChatFolderCount#601eb4c7. - v := PremiumLimitTypeShareableChatFolderCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeActiveStoryCountTypeID: - // Decoding premiumLimitTypeActiveStoryCount#8d2c269c. - v := PremiumLimitTypeActiveStoryCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeWeeklySentStoryCountTypeID: - // Decoding premiumLimitTypeWeeklySentStoryCount#269c34b. - v := PremiumLimitTypeWeeklySentStoryCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeMonthlySentStoryCountTypeID: - // Decoding premiumLimitTypeMonthlySentStoryCount#30d84b83. - v := PremiumLimitTypeMonthlySentStoryCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeStoryCaptionLengthTypeID: - // Decoding premiumLimitTypeStoryCaptionLength#bed53302. - v := PremiumLimitTypeStoryCaptionLength{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeStorySuggestedReactionAreaCountTypeID: - // Decoding premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807. - v := PremiumLimitTypeStorySuggestedReactionAreaCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case PremiumLimitTypeSimilarChatCountTypeID: - // Decoding premiumLimitTypeSimilarChatCount#a2ce1f11. - v := PremiumLimitTypeSimilarChatCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPremiumLimitType implements binary de-serialization for PremiumLimitTypeClass. -func DecodeTDLibJSONPremiumLimitType(buf tdjson.Decoder) (PremiumLimitTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "premiumLimitTypeSupergroupCount": - // Decoding premiumLimitTypeSupergroupCount#f13ff385. - v := PremiumLimitTypeSupergroupCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypePinnedChatCount": - // Decoding premiumLimitTypePinnedChatCount#c47543e1. - v := PremiumLimitTypePinnedChatCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeCreatedPublicChatCount": - // Decoding premiumLimitTypeCreatedPublicChatCount#1a96beb9. - v := PremiumLimitTypeCreatedPublicChatCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeSavedAnimationCount": - // Decoding premiumLimitTypeSavedAnimationCount#fed27d89. - v := PremiumLimitTypeSavedAnimationCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeFavoriteStickerCount": - // Decoding premiumLimitTypeFavoriteStickerCount#2621e223. - v := PremiumLimitTypeFavoriteStickerCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeChatFolderCount": - // Decoding premiumLimitTypeChatFolderCount#1680096e. - v := PremiumLimitTypeChatFolderCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeChatFolderChosenChatCount": - // Decoding premiumLimitTypeChatFolderChosenChatCount#64d14355. - v := PremiumLimitTypeChatFolderChosenChatCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypePinnedArchivedChatCount": - // Decoding premiumLimitTypePinnedArchivedChatCount#588b2a0c. - v := PremiumLimitTypePinnedArchivedChatCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypePinnedSavedMessagesTopicCount": - // Decoding premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df. - v := PremiumLimitTypePinnedSavedMessagesTopicCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeCaptionLength": - // Decoding premiumLimitTypeCaptionLength#1185d83a. - v := PremiumLimitTypeCaptionLength{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeBioLength": - // Decoding premiumLimitTypeBioLength#bba28603. - v := PremiumLimitTypeBioLength{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeChatFolderInviteLinkCount": - // Decoding premiumLimitTypeChatFolderInviteLinkCount#f854261a. - v := PremiumLimitTypeChatFolderInviteLinkCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeShareableChatFolderCount": - // Decoding premiumLimitTypeShareableChatFolderCount#601eb4c7. - v := PremiumLimitTypeShareableChatFolderCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeActiveStoryCount": - // Decoding premiumLimitTypeActiveStoryCount#8d2c269c. - v := PremiumLimitTypeActiveStoryCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeWeeklySentStoryCount": - // Decoding premiumLimitTypeWeeklySentStoryCount#269c34b. - v := PremiumLimitTypeWeeklySentStoryCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeMonthlySentStoryCount": - // Decoding premiumLimitTypeMonthlySentStoryCount#30d84b83. - v := PremiumLimitTypeMonthlySentStoryCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeStoryCaptionLength": - // Decoding premiumLimitTypeStoryCaptionLength#bed53302. - v := PremiumLimitTypeStoryCaptionLength{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeStorySuggestedReactionAreaCount": - // Decoding premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807. - v := PremiumLimitTypeStorySuggestedReactionAreaCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - case "premiumLimitTypeSimilarChatCount": - // Decoding premiumLimitTypeSimilarChatCount#a2ce1f11. - v := PremiumLimitTypeSimilarChatCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumLimitTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PremiumLimitType boxes the PremiumLimitTypeClass providing a helper. -type PremiumLimitTypeBox struct { - PremiumLimitType PremiumLimitTypeClass -} - -// Decode implements bin.Decoder for PremiumLimitTypeBox. -func (b *PremiumLimitTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumLimitTypeBox to nil") - } - v, err := DecodePremiumLimitType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumLimitType = v - return nil -} - -// Encode implements bin.Encode for PremiumLimitTypeBox. -func (b *PremiumLimitTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PremiumLimitType == nil { - return fmt.Errorf("unable to encode PremiumLimitTypeClass as nil") - } - return b.PremiumLimitType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PremiumLimitTypeBox. -func (b *PremiumLimitTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumLimitTypeBox to nil") - } - v, err := DecodeTDLibJSONPremiumLimitType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumLimitType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PremiumLimitTypeBox. -func (b *PremiumLimitTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PremiumLimitType == nil { - return fmt.Errorf("unable to encode PremiumLimitTypeClass as nil") - } - return b.PremiumLimitType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_premium_payment_option_gen.go b/tdapi/tl_premium_payment_option_gen.go deleted file mode 100644 index 1c68c4868..000000000 --- a/tdapi/tl_premium_payment_option_gen.go +++ /dev/null @@ -1,376 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumPaymentOption represents TL type `premiumPaymentOption#8c0c5fb2`. -type PremiumPaymentOption struct { - // ISO 4217 currency code for Telegram Premium subscription payment - Currency string - // The amount to pay, in the smallest units of the currency - Amount int64 - // The discount associated with this option, as a percentage - DiscountPercentage int32 - // Number of months the Telegram Premium subscription will be active. Use - // getPremiumInfoSticker to get the sticker to be used as representation of the Telegram - // Premium subscription - MonthCount int32 - // Identifier of the store product associated with the option - StoreProductID string - // An internal link to be opened for buying Telegram Premium to the user if store payment - // isn't possible; may be null if direct payment isn't available - PaymentLink InternalLinkTypeClass -} - -// PremiumPaymentOptionTypeID is TL type id of PremiumPaymentOption. -const PremiumPaymentOptionTypeID = 0x8c0c5fb2 - -// Ensuring interfaces in compile-time for PremiumPaymentOption. -var ( - _ bin.Encoder = &PremiumPaymentOption{} - _ bin.Decoder = &PremiumPaymentOption{} - _ bin.BareEncoder = &PremiumPaymentOption{} - _ bin.BareDecoder = &PremiumPaymentOption{} -) - -func (p *PremiumPaymentOption) Zero() bool { - if p == nil { - return true - } - if !(p.Currency == "") { - return false - } - if !(p.Amount == 0) { - return false - } - if !(p.DiscountPercentage == 0) { - return false - } - if !(p.MonthCount == 0) { - return false - } - if !(p.StoreProductID == "") { - return false - } - if !(p.PaymentLink == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumPaymentOption) String() string { - if p == nil { - return "PremiumPaymentOption(nil)" - } - type Alias PremiumPaymentOption - return fmt.Sprintf("PremiumPaymentOption%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumPaymentOption) TypeID() uint32 { - return PremiumPaymentOptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumPaymentOption) TypeName() string { - return "premiumPaymentOption" -} - -// TypeInfo returns info about TL type. -func (p *PremiumPaymentOption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumPaymentOption", - ID: PremiumPaymentOptionTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "DiscountPercentage", - SchemaName: "discount_percentage", - }, - { - Name: "MonthCount", - SchemaName: "month_count", - }, - { - Name: "StoreProductID", - SchemaName: "store_product_id", - }, - { - Name: "PaymentLink", - SchemaName: "payment_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumPaymentOption) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumPaymentOption#8c0c5fb2 as nil") - } - b.PutID(PremiumPaymentOptionTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumPaymentOption) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumPaymentOption#8c0c5fb2 as nil") - } - b.PutString(p.Currency) - b.PutInt53(p.Amount) - b.PutInt32(p.DiscountPercentage) - b.PutInt32(p.MonthCount) - b.PutString(p.StoreProductID) - if p.PaymentLink == nil { - return fmt.Errorf("unable to encode premiumPaymentOption#8c0c5fb2: field payment_link is nil") - } - if err := p.PaymentLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumPaymentOption#8c0c5fb2: field payment_link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumPaymentOption) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumPaymentOption#8c0c5fb2 to nil") - } - if err := b.ConsumeID(PremiumPaymentOptionTypeID); err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumPaymentOption) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumPaymentOption#8c0c5fb2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field currency: %w", err) - } - p.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field amount: %w", err) - } - p.Amount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field discount_percentage: %w", err) - } - p.DiscountPercentage = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field month_count: %w", err) - } - p.MonthCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field store_product_id: %w", err) - } - p.StoreProductID = value - } - { - value, err := DecodeInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field payment_link: %w", err) - } - p.PaymentLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumPaymentOption) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumPaymentOption#8c0c5fb2 as nil") - } - b.ObjStart() - b.PutID("premiumPaymentOption") - b.Comma() - b.FieldStart("currency") - b.PutString(p.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(p.Amount) - b.Comma() - b.FieldStart("discount_percentage") - b.PutInt32(p.DiscountPercentage) - b.Comma() - b.FieldStart("month_count") - b.PutInt32(p.MonthCount) - b.Comma() - b.FieldStart("store_product_id") - b.PutString(p.StoreProductID) - b.Comma() - b.FieldStart("payment_link") - if p.PaymentLink == nil { - return fmt.Errorf("unable to encode premiumPaymentOption#8c0c5fb2: field payment_link is nil") - } - if err := p.PaymentLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumPaymentOption#8c0c5fb2: field payment_link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumPaymentOption) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumPaymentOption#8c0c5fb2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumPaymentOption"); err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field currency: %w", err) - } - p.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field amount: %w", err) - } - p.Amount = value - case "discount_percentage": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field discount_percentage: %w", err) - } - p.DiscountPercentage = value - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field month_count: %w", err) - } - p.MonthCount = value - case "store_product_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field store_product_id: %w", err) - } - p.StoreProductID = value - case "payment_link": - value, err := DecodeTDLibJSONInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode premiumPaymentOption#8c0c5fb2: field payment_link: %w", err) - } - p.PaymentLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCurrency returns value of Currency field. -func (p *PremiumPaymentOption) GetCurrency() (value string) { - if p == nil { - return - } - return p.Currency -} - -// GetAmount returns value of Amount field. -func (p *PremiumPaymentOption) GetAmount() (value int64) { - if p == nil { - return - } - return p.Amount -} - -// GetDiscountPercentage returns value of DiscountPercentage field. -func (p *PremiumPaymentOption) GetDiscountPercentage() (value int32) { - if p == nil { - return - } - return p.DiscountPercentage -} - -// GetMonthCount returns value of MonthCount field. -func (p *PremiumPaymentOption) GetMonthCount() (value int32) { - if p == nil { - return - } - return p.MonthCount -} - -// GetStoreProductID returns value of StoreProductID field. -func (p *PremiumPaymentOption) GetStoreProductID() (value string) { - if p == nil { - return - } - return p.StoreProductID -} - -// GetPaymentLink returns value of PaymentLink field. -func (p *PremiumPaymentOption) GetPaymentLink() (value InternalLinkTypeClass) { - if p == nil { - return - } - return p.PaymentLink -} diff --git a/tdapi/tl_premium_source_gen.go b/tdapi/tl_premium_source_gen.go deleted file mode 100644 index 9ed8c5177..000000000 --- a/tdapi/tl_premium_source_gen.go +++ /dev/null @@ -1,1230 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumSourceLimitExceeded represents TL type `premiumSourceLimitExceeded#85ae8702`. -type PremiumSourceLimitExceeded struct { - // Type of the exceeded limit - LimitType PremiumLimitTypeClass -} - -// PremiumSourceLimitExceededTypeID is TL type id of PremiumSourceLimitExceeded. -const PremiumSourceLimitExceededTypeID = 0x85ae8702 - -// construct implements constructor of PremiumSourceClass. -func (p PremiumSourceLimitExceeded) construct() PremiumSourceClass { return &p } - -// Ensuring interfaces in compile-time for PremiumSourceLimitExceeded. -var ( - _ bin.Encoder = &PremiumSourceLimitExceeded{} - _ bin.Decoder = &PremiumSourceLimitExceeded{} - _ bin.BareEncoder = &PremiumSourceLimitExceeded{} - _ bin.BareDecoder = &PremiumSourceLimitExceeded{} - - _ PremiumSourceClass = &PremiumSourceLimitExceeded{} -) - -func (p *PremiumSourceLimitExceeded) Zero() bool { - if p == nil { - return true - } - if !(p.LimitType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumSourceLimitExceeded) String() string { - if p == nil { - return "PremiumSourceLimitExceeded(nil)" - } - type Alias PremiumSourceLimitExceeded - return fmt.Sprintf("PremiumSourceLimitExceeded%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumSourceLimitExceeded) TypeID() uint32 { - return PremiumSourceLimitExceededTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumSourceLimitExceeded) TypeName() string { - return "premiumSourceLimitExceeded" -} - -// TypeInfo returns info about TL type. -func (p *PremiumSourceLimitExceeded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumSourceLimitExceeded", - ID: PremiumSourceLimitExceededTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LimitType", - SchemaName: "limit_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumSourceLimitExceeded) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceLimitExceeded#85ae8702 as nil") - } - b.PutID(PremiumSourceLimitExceededTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumSourceLimitExceeded) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceLimitExceeded#85ae8702 as nil") - } - if p.LimitType == nil { - return fmt.Errorf("unable to encode premiumSourceLimitExceeded#85ae8702: field limit_type is nil") - } - if err := p.LimitType.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumSourceLimitExceeded#85ae8702: field limit_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumSourceLimitExceeded) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceLimitExceeded#85ae8702 to nil") - } - if err := b.ConsumeID(PremiumSourceLimitExceededTypeID); err != nil { - return fmt.Errorf("unable to decode premiumSourceLimitExceeded#85ae8702: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumSourceLimitExceeded) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceLimitExceeded#85ae8702 to nil") - } - { - value, err := DecodePremiumLimitType(b) - if err != nil { - return fmt.Errorf("unable to decode premiumSourceLimitExceeded#85ae8702: field limit_type: %w", err) - } - p.LimitType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumSourceLimitExceeded) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceLimitExceeded#85ae8702 as nil") - } - b.ObjStart() - b.PutID("premiumSourceLimitExceeded") - b.Comma() - b.FieldStart("limit_type") - if p.LimitType == nil { - return fmt.Errorf("unable to encode premiumSourceLimitExceeded#85ae8702: field limit_type is nil") - } - if err := p.LimitType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumSourceLimitExceeded#85ae8702: field limit_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumSourceLimitExceeded) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceLimitExceeded#85ae8702 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumSourceLimitExceeded"); err != nil { - return fmt.Errorf("unable to decode premiumSourceLimitExceeded#85ae8702: %w", err) - } - case "limit_type": - value, err := DecodeTDLibJSONPremiumLimitType(b) - if err != nil { - return fmt.Errorf("unable to decode premiumSourceLimitExceeded#85ae8702: field limit_type: %w", err) - } - p.LimitType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLimitType returns value of LimitType field. -func (p *PremiumSourceLimitExceeded) GetLimitType() (value PremiumLimitTypeClass) { - if p == nil { - return - } - return p.LimitType -} - -// PremiumSourceFeature represents TL type `premiumSourceFeature#1a929325`. -type PremiumSourceFeature struct { - // The used feature - Feature PremiumFeatureClass -} - -// PremiumSourceFeatureTypeID is TL type id of PremiumSourceFeature. -const PremiumSourceFeatureTypeID = 0x1a929325 - -// construct implements constructor of PremiumSourceClass. -func (p PremiumSourceFeature) construct() PremiumSourceClass { return &p } - -// Ensuring interfaces in compile-time for PremiumSourceFeature. -var ( - _ bin.Encoder = &PremiumSourceFeature{} - _ bin.Decoder = &PremiumSourceFeature{} - _ bin.BareEncoder = &PremiumSourceFeature{} - _ bin.BareDecoder = &PremiumSourceFeature{} - - _ PremiumSourceClass = &PremiumSourceFeature{} -) - -func (p *PremiumSourceFeature) Zero() bool { - if p == nil { - return true - } - if !(p.Feature == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumSourceFeature) String() string { - if p == nil { - return "PremiumSourceFeature(nil)" - } - type Alias PremiumSourceFeature - return fmt.Sprintf("PremiumSourceFeature%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumSourceFeature) TypeID() uint32 { - return PremiumSourceFeatureTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumSourceFeature) TypeName() string { - return "premiumSourceFeature" -} - -// TypeInfo returns info about TL type. -func (p *PremiumSourceFeature) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumSourceFeature", - ID: PremiumSourceFeatureTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Feature", - SchemaName: "feature", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumSourceFeature) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceFeature#1a929325 as nil") - } - b.PutID(PremiumSourceFeatureTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumSourceFeature) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceFeature#1a929325 as nil") - } - if p.Feature == nil { - return fmt.Errorf("unable to encode premiumSourceFeature#1a929325: field feature is nil") - } - if err := p.Feature.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumSourceFeature#1a929325: field feature: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumSourceFeature) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceFeature#1a929325 to nil") - } - if err := b.ConsumeID(PremiumSourceFeatureTypeID); err != nil { - return fmt.Errorf("unable to decode premiumSourceFeature#1a929325: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumSourceFeature) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceFeature#1a929325 to nil") - } - { - value, err := DecodePremiumFeature(b) - if err != nil { - return fmt.Errorf("unable to decode premiumSourceFeature#1a929325: field feature: %w", err) - } - p.Feature = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumSourceFeature) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceFeature#1a929325 as nil") - } - b.ObjStart() - b.PutID("premiumSourceFeature") - b.Comma() - b.FieldStart("feature") - if p.Feature == nil { - return fmt.Errorf("unable to encode premiumSourceFeature#1a929325: field feature is nil") - } - if err := p.Feature.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumSourceFeature#1a929325: field feature: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumSourceFeature) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceFeature#1a929325 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumSourceFeature"); err != nil { - return fmt.Errorf("unable to decode premiumSourceFeature#1a929325: %w", err) - } - case "feature": - value, err := DecodeTDLibJSONPremiumFeature(b) - if err != nil { - return fmt.Errorf("unable to decode premiumSourceFeature#1a929325: field feature: %w", err) - } - p.Feature = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFeature returns value of Feature field. -func (p *PremiumSourceFeature) GetFeature() (value PremiumFeatureClass) { - if p == nil { - return - } - return p.Feature -} - -// PremiumSourceBusinessFeature represents TL type `premiumSourceBusinessFeature#a703725c`. -type PremiumSourceBusinessFeature struct { - // The used feature; pass null if none specific feature was used - Feature BusinessFeatureClass -} - -// PremiumSourceBusinessFeatureTypeID is TL type id of PremiumSourceBusinessFeature. -const PremiumSourceBusinessFeatureTypeID = 0xa703725c - -// construct implements constructor of PremiumSourceClass. -func (p PremiumSourceBusinessFeature) construct() PremiumSourceClass { return &p } - -// Ensuring interfaces in compile-time for PremiumSourceBusinessFeature. -var ( - _ bin.Encoder = &PremiumSourceBusinessFeature{} - _ bin.Decoder = &PremiumSourceBusinessFeature{} - _ bin.BareEncoder = &PremiumSourceBusinessFeature{} - _ bin.BareDecoder = &PremiumSourceBusinessFeature{} - - _ PremiumSourceClass = &PremiumSourceBusinessFeature{} -) - -func (p *PremiumSourceBusinessFeature) Zero() bool { - if p == nil { - return true - } - if !(p.Feature == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumSourceBusinessFeature) String() string { - if p == nil { - return "PremiumSourceBusinessFeature(nil)" - } - type Alias PremiumSourceBusinessFeature - return fmt.Sprintf("PremiumSourceBusinessFeature%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumSourceBusinessFeature) TypeID() uint32 { - return PremiumSourceBusinessFeatureTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumSourceBusinessFeature) TypeName() string { - return "premiumSourceBusinessFeature" -} - -// TypeInfo returns info about TL type. -func (p *PremiumSourceBusinessFeature) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumSourceBusinessFeature", - ID: PremiumSourceBusinessFeatureTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Feature", - SchemaName: "feature", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumSourceBusinessFeature) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceBusinessFeature#a703725c as nil") - } - b.PutID(PremiumSourceBusinessFeatureTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumSourceBusinessFeature) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceBusinessFeature#a703725c as nil") - } - if p.Feature == nil { - return fmt.Errorf("unable to encode premiumSourceBusinessFeature#a703725c: field feature is nil") - } - if err := p.Feature.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumSourceBusinessFeature#a703725c: field feature: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumSourceBusinessFeature) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceBusinessFeature#a703725c to nil") - } - if err := b.ConsumeID(PremiumSourceBusinessFeatureTypeID); err != nil { - return fmt.Errorf("unable to decode premiumSourceBusinessFeature#a703725c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumSourceBusinessFeature) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceBusinessFeature#a703725c to nil") - } - { - value, err := DecodeBusinessFeature(b) - if err != nil { - return fmt.Errorf("unable to decode premiumSourceBusinessFeature#a703725c: field feature: %w", err) - } - p.Feature = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumSourceBusinessFeature) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceBusinessFeature#a703725c as nil") - } - b.ObjStart() - b.PutID("premiumSourceBusinessFeature") - b.Comma() - b.FieldStart("feature") - if p.Feature == nil { - return fmt.Errorf("unable to encode premiumSourceBusinessFeature#a703725c: field feature is nil") - } - if err := p.Feature.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumSourceBusinessFeature#a703725c: field feature: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumSourceBusinessFeature) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceBusinessFeature#a703725c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumSourceBusinessFeature"); err != nil { - return fmt.Errorf("unable to decode premiumSourceBusinessFeature#a703725c: %w", err) - } - case "feature": - value, err := DecodeTDLibJSONBusinessFeature(b) - if err != nil { - return fmt.Errorf("unable to decode premiumSourceBusinessFeature#a703725c: field feature: %w", err) - } - p.Feature = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFeature returns value of Feature field. -func (p *PremiumSourceBusinessFeature) GetFeature() (value BusinessFeatureClass) { - if p == nil { - return - } - return p.Feature -} - -// PremiumSourceStoryFeature represents TL type `premiumSourceStoryFeature#c290316c`. -type PremiumSourceStoryFeature struct { - // The used feature - Feature PremiumStoryFeatureClass -} - -// PremiumSourceStoryFeatureTypeID is TL type id of PremiumSourceStoryFeature. -const PremiumSourceStoryFeatureTypeID = 0xc290316c - -// construct implements constructor of PremiumSourceClass. -func (p PremiumSourceStoryFeature) construct() PremiumSourceClass { return &p } - -// Ensuring interfaces in compile-time for PremiumSourceStoryFeature. -var ( - _ bin.Encoder = &PremiumSourceStoryFeature{} - _ bin.Decoder = &PremiumSourceStoryFeature{} - _ bin.BareEncoder = &PremiumSourceStoryFeature{} - _ bin.BareDecoder = &PremiumSourceStoryFeature{} - - _ PremiumSourceClass = &PremiumSourceStoryFeature{} -) - -func (p *PremiumSourceStoryFeature) Zero() bool { - if p == nil { - return true - } - if !(p.Feature == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumSourceStoryFeature) String() string { - if p == nil { - return "PremiumSourceStoryFeature(nil)" - } - type Alias PremiumSourceStoryFeature - return fmt.Sprintf("PremiumSourceStoryFeature%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumSourceStoryFeature) TypeID() uint32 { - return PremiumSourceStoryFeatureTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumSourceStoryFeature) TypeName() string { - return "premiumSourceStoryFeature" -} - -// TypeInfo returns info about TL type. -func (p *PremiumSourceStoryFeature) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumSourceStoryFeature", - ID: PremiumSourceStoryFeatureTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Feature", - SchemaName: "feature", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumSourceStoryFeature) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceStoryFeature#c290316c as nil") - } - b.PutID(PremiumSourceStoryFeatureTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumSourceStoryFeature) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceStoryFeature#c290316c as nil") - } - if p.Feature == nil { - return fmt.Errorf("unable to encode premiumSourceStoryFeature#c290316c: field feature is nil") - } - if err := p.Feature.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumSourceStoryFeature#c290316c: field feature: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumSourceStoryFeature) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceStoryFeature#c290316c to nil") - } - if err := b.ConsumeID(PremiumSourceStoryFeatureTypeID); err != nil { - return fmt.Errorf("unable to decode premiumSourceStoryFeature#c290316c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumSourceStoryFeature) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceStoryFeature#c290316c to nil") - } - { - value, err := DecodePremiumStoryFeature(b) - if err != nil { - return fmt.Errorf("unable to decode premiumSourceStoryFeature#c290316c: field feature: %w", err) - } - p.Feature = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumSourceStoryFeature) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceStoryFeature#c290316c as nil") - } - b.ObjStart() - b.PutID("premiumSourceStoryFeature") - b.Comma() - b.FieldStart("feature") - if p.Feature == nil { - return fmt.Errorf("unable to encode premiumSourceStoryFeature#c290316c: field feature is nil") - } - if err := p.Feature.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumSourceStoryFeature#c290316c: field feature: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumSourceStoryFeature) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceStoryFeature#c290316c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumSourceStoryFeature"); err != nil { - return fmt.Errorf("unable to decode premiumSourceStoryFeature#c290316c: %w", err) - } - case "feature": - value, err := DecodeTDLibJSONPremiumStoryFeature(b) - if err != nil { - return fmt.Errorf("unable to decode premiumSourceStoryFeature#c290316c: field feature: %w", err) - } - p.Feature = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFeature returns value of Feature field. -func (p *PremiumSourceStoryFeature) GetFeature() (value PremiumStoryFeatureClass) { - if p == nil { - return - } - return p.Feature -} - -// PremiumSourceLink represents TL type `premiumSourceLink#7f42999c`. -type PremiumSourceLink struct { - // The referrer from the link - Referrer string -} - -// PremiumSourceLinkTypeID is TL type id of PremiumSourceLink. -const PremiumSourceLinkTypeID = 0x7f42999c - -// construct implements constructor of PremiumSourceClass. -func (p PremiumSourceLink) construct() PremiumSourceClass { return &p } - -// Ensuring interfaces in compile-time for PremiumSourceLink. -var ( - _ bin.Encoder = &PremiumSourceLink{} - _ bin.Decoder = &PremiumSourceLink{} - _ bin.BareEncoder = &PremiumSourceLink{} - _ bin.BareDecoder = &PremiumSourceLink{} - - _ PremiumSourceClass = &PremiumSourceLink{} -) - -func (p *PremiumSourceLink) Zero() bool { - if p == nil { - return true - } - if !(p.Referrer == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumSourceLink) String() string { - if p == nil { - return "PremiumSourceLink(nil)" - } - type Alias PremiumSourceLink - return fmt.Sprintf("PremiumSourceLink%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumSourceLink) TypeID() uint32 { - return PremiumSourceLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumSourceLink) TypeName() string { - return "premiumSourceLink" -} - -// TypeInfo returns info about TL type. -func (p *PremiumSourceLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumSourceLink", - ID: PremiumSourceLinkTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Referrer", - SchemaName: "referrer", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumSourceLink) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceLink#7f42999c as nil") - } - b.PutID(PremiumSourceLinkTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumSourceLink) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceLink#7f42999c as nil") - } - b.PutString(p.Referrer) - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumSourceLink) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceLink#7f42999c to nil") - } - if err := b.ConsumeID(PremiumSourceLinkTypeID); err != nil { - return fmt.Errorf("unable to decode premiumSourceLink#7f42999c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumSourceLink) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceLink#7f42999c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumSourceLink#7f42999c: field referrer: %w", err) - } - p.Referrer = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumSourceLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceLink#7f42999c as nil") - } - b.ObjStart() - b.PutID("premiumSourceLink") - b.Comma() - b.FieldStart("referrer") - b.PutString(p.Referrer) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumSourceLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceLink#7f42999c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumSourceLink"); err != nil { - return fmt.Errorf("unable to decode premiumSourceLink#7f42999c: %w", err) - } - case "referrer": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumSourceLink#7f42999c: field referrer: %w", err) - } - p.Referrer = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReferrer returns value of Referrer field. -func (p *PremiumSourceLink) GetReferrer() (value string) { - if p == nil { - return - } - return p.Referrer -} - -// PremiumSourceSettings represents TL type `premiumSourceSettings#eef88535`. -type PremiumSourceSettings struct { -} - -// PremiumSourceSettingsTypeID is TL type id of PremiumSourceSettings. -const PremiumSourceSettingsTypeID = 0xeef88535 - -// construct implements constructor of PremiumSourceClass. -func (p PremiumSourceSettings) construct() PremiumSourceClass { return &p } - -// Ensuring interfaces in compile-time for PremiumSourceSettings. -var ( - _ bin.Encoder = &PremiumSourceSettings{} - _ bin.Decoder = &PremiumSourceSettings{} - _ bin.BareEncoder = &PremiumSourceSettings{} - _ bin.BareDecoder = &PremiumSourceSettings{} - - _ PremiumSourceClass = &PremiumSourceSettings{} -) - -func (p *PremiumSourceSettings) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumSourceSettings) String() string { - if p == nil { - return "PremiumSourceSettings(nil)" - } - type Alias PremiumSourceSettings - return fmt.Sprintf("PremiumSourceSettings%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumSourceSettings) TypeID() uint32 { - return PremiumSourceSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumSourceSettings) TypeName() string { - return "premiumSourceSettings" -} - -// TypeInfo returns info about TL type. -func (p *PremiumSourceSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumSourceSettings", - ID: PremiumSourceSettingsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumSourceSettings) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceSettings#eef88535 as nil") - } - b.PutID(PremiumSourceSettingsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumSourceSettings) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceSettings#eef88535 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumSourceSettings) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceSettings#eef88535 to nil") - } - if err := b.ConsumeID(PremiumSourceSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode premiumSourceSettings#eef88535: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumSourceSettings) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceSettings#eef88535 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumSourceSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumSourceSettings#eef88535 as nil") - } - b.ObjStart() - b.PutID("premiumSourceSettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumSourceSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumSourceSettings#eef88535 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumSourceSettings"); err != nil { - return fmt.Errorf("unable to decode premiumSourceSettings#eef88535: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumSourceClassName is schema name of PremiumSourceClass. -const PremiumSourceClassName = "PremiumSource" - -// PremiumSourceClass represents PremiumSource generic type. -// -// Example: -// -// g, err := tdapi.DecodePremiumSource(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PremiumSourceLimitExceeded: // premiumSourceLimitExceeded#85ae8702 -// case *tdapi.PremiumSourceFeature: // premiumSourceFeature#1a929325 -// case *tdapi.PremiumSourceBusinessFeature: // premiumSourceBusinessFeature#a703725c -// case *tdapi.PremiumSourceStoryFeature: // premiumSourceStoryFeature#c290316c -// case *tdapi.PremiumSourceLink: // premiumSourceLink#7f42999c -// case *tdapi.PremiumSourceSettings: // premiumSourceSettings#eef88535 -// default: panic(v) -// } -type PremiumSourceClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PremiumSourceClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePremiumSource implements binary de-serialization for PremiumSourceClass. -func DecodePremiumSource(buf *bin.Buffer) (PremiumSourceClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PremiumSourceLimitExceededTypeID: - // Decoding premiumSourceLimitExceeded#85ae8702. - v := PremiumSourceLimitExceeded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - case PremiumSourceFeatureTypeID: - // Decoding premiumSourceFeature#1a929325. - v := PremiumSourceFeature{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - case PremiumSourceBusinessFeatureTypeID: - // Decoding premiumSourceBusinessFeature#a703725c. - v := PremiumSourceBusinessFeature{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - case PremiumSourceStoryFeatureTypeID: - // Decoding premiumSourceStoryFeature#c290316c. - v := PremiumSourceStoryFeature{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - case PremiumSourceLinkTypeID: - // Decoding premiumSourceLink#7f42999c. - v := PremiumSourceLink{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - case PremiumSourceSettingsTypeID: - // Decoding premiumSourceSettings#eef88535. - v := PremiumSourceSettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPremiumSource implements binary de-serialization for PremiumSourceClass. -func DecodeTDLibJSONPremiumSource(buf tdjson.Decoder) (PremiumSourceClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "premiumSourceLimitExceeded": - // Decoding premiumSourceLimitExceeded#85ae8702. - v := PremiumSourceLimitExceeded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - case "premiumSourceFeature": - // Decoding premiumSourceFeature#1a929325. - v := PremiumSourceFeature{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - case "premiumSourceBusinessFeature": - // Decoding premiumSourceBusinessFeature#a703725c. - v := PremiumSourceBusinessFeature{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - case "premiumSourceStoryFeature": - // Decoding premiumSourceStoryFeature#c290316c. - v := PremiumSourceStoryFeature{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - case "premiumSourceLink": - // Decoding premiumSourceLink#7f42999c. - v := PremiumSourceLink{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - case "premiumSourceSettings": - // Decoding premiumSourceSettings#eef88535. - v := PremiumSourceSettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumSourceClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PremiumSource boxes the PremiumSourceClass providing a helper. -type PremiumSourceBox struct { - PremiumSource PremiumSourceClass -} - -// Decode implements bin.Decoder for PremiumSourceBox. -func (b *PremiumSourceBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumSourceBox to nil") - } - v, err := DecodePremiumSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumSource = v - return nil -} - -// Encode implements bin.Encode for PremiumSourceBox. -func (b *PremiumSourceBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PremiumSource == nil { - return fmt.Errorf("unable to encode PremiumSourceClass as nil") - } - return b.PremiumSource.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PremiumSourceBox. -func (b *PremiumSourceBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumSourceBox to nil") - } - v, err := DecodeTDLibJSONPremiumSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumSource = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PremiumSourceBox. -func (b *PremiumSourceBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PremiumSource == nil { - return fmt.Errorf("unable to encode PremiumSourceClass as nil") - } - return b.PremiumSource.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_premium_state_gen.go b/tdapi/tl_premium_state_gen.go deleted file mode 100644 index caf177171..000000000 --- a/tdapi/tl_premium_state_gen.go +++ /dev/null @@ -1,380 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumState represents TL type `premiumState#91a8799`. -type PremiumState struct { - // Text description of the state of the current Premium subscription; may be empty if the - // current user has no Telegram Premium subscription - State FormattedText - // The list of available options for buying Telegram Premium - PaymentOptions []PremiumStatePaymentOption - // The list of available promotion animations for Premium features - Animations []PremiumFeaturePromotionAnimation - // The list of available promotion animations for Business features - BusinessAnimations []BusinessFeaturePromotionAnimation -} - -// PremiumStateTypeID is TL type id of PremiumState. -const PremiumStateTypeID = 0x91a8799 - -// Ensuring interfaces in compile-time for PremiumState. -var ( - _ bin.Encoder = &PremiumState{} - _ bin.Decoder = &PremiumState{} - _ bin.BareEncoder = &PremiumState{} - _ bin.BareDecoder = &PremiumState{} -) - -func (p *PremiumState) Zero() bool { - if p == nil { - return true - } - if !(p.State.Zero()) { - return false - } - if !(p.PaymentOptions == nil) { - return false - } - if !(p.Animations == nil) { - return false - } - if !(p.BusinessAnimations == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumState) String() string { - if p == nil { - return "PremiumState(nil)" - } - type Alias PremiumState - return fmt.Sprintf("PremiumState%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumState) TypeID() uint32 { - return PremiumStateTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumState) TypeName() string { - return "premiumState" -} - -// TypeInfo returns info about TL type. -func (p *PremiumState) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumState", - ID: PremiumStateTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "State", - SchemaName: "state", - }, - { - Name: "PaymentOptions", - SchemaName: "payment_options", - }, - { - Name: "Animations", - SchemaName: "animations", - }, - { - Name: "BusinessAnimations", - SchemaName: "business_animations", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumState) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumState#91a8799 as nil") - } - b.PutID(PremiumStateTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumState) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumState#91a8799 as nil") - } - if err := p.State.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumState#91a8799: field state: %w", err) - } - b.PutInt(len(p.PaymentOptions)) - for idx, v := range p.PaymentOptions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare premiumState#91a8799: field payment_options element with index %d: %w", idx, err) - } - } - b.PutInt(len(p.Animations)) - for idx, v := range p.Animations { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare premiumState#91a8799: field animations element with index %d: %w", idx, err) - } - } - b.PutInt(len(p.BusinessAnimations)) - for idx, v := range p.BusinessAnimations { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare premiumState#91a8799: field business_animations element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumState) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumState#91a8799 to nil") - } - if err := b.ConsumeID(PremiumStateTypeID); err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumState) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumState#91a8799 to nil") - } - { - if err := p.State.Decode(b); err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: field state: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: field payment_options: %w", err) - } - - if headerLen > 0 { - p.PaymentOptions = make([]PremiumStatePaymentOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PremiumStatePaymentOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare premiumState#91a8799: field payment_options: %w", err) - } - p.PaymentOptions = append(p.PaymentOptions, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: field animations: %w", err) - } - - if headerLen > 0 { - p.Animations = make([]PremiumFeaturePromotionAnimation, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value PremiumFeaturePromotionAnimation - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare premiumState#91a8799: field animations: %w", err) - } - p.Animations = append(p.Animations, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: field business_animations: %w", err) - } - - if headerLen > 0 { - p.BusinessAnimations = make([]BusinessFeaturePromotionAnimation, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BusinessFeaturePromotionAnimation - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare premiumState#91a8799: field business_animations: %w", err) - } - p.BusinessAnimations = append(p.BusinessAnimations, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumState) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumState#91a8799 as nil") - } - b.ObjStart() - b.PutID("premiumState") - b.Comma() - b.FieldStart("state") - if err := p.State.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumState#91a8799: field state: %w", err) - } - b.Comma() - b.FieldStart("payment_options") - b.ArrStart() - for idx, v := range p.PaymentOptions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumState#91a8799: field payment_options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("animations") - b.ArrStart() - for idx, v := range p.Animations { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumState#91a8799: field animations element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("business_animations") - b.ArrStart() - for idx, v := range p.BusinessAnimations { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumState#91a8799: field business_animations element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumState) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumState#91a8799 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumState"); err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: %w", err) - } - case "state": - if err := p.State.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: field state: %w", err) - } - case "payment_options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PremiumStatePaymentOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: field payment_options: %w", err) - } - p.PaymentOptions = append(p.PaymentOptions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: field payment_options: %w", err) - } - case "animations": - if err := b.Arr(func(b tdjson.Decoder) error { - var value PremiumFeaturePromotionAnimation - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: field animations: %w", err) - } - p.Animations = append(p.Animations, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: field animations: %w", err) - } - case "business_animations": - if err := b.Arr(func(b tdjson.Decoder) error { - var value BusinessFeaturePromotionAnimation - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: field business_animations: %w", err) - } - p.BusinessAnimations = append(p.BusinessAnimations, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode premiumState#91a8799: field business_animations: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetState returns value of State field. -func (p *PremiumState) GetState() (value FormattedText) { - if p == nil { - return - } - return p.State -} - -// GetPaymentOptions returns value of PaymentOptions field. -func (p *PremiumState) GetPaymentOptions() (value []PremiumStatePaymentOption) { - if p == nil { - return - } - return p.PaymentOptions -} - -// GetAnimations returns value of Animations field. -func (p *PremiumState) GetAnimations() (value []PremiumFeaturePromotionAnimation) { - if p == nil { - return - } - return p.Animations -} - -// GetBusinessAnimations returns value of BusinessAnimations field. -func (p *PremiumState) GetBusinessAnimations() (value []BusinessFeaturePromotionAnimation) { - if p == nil { - return - } - return p.BusinessAnimations -} diff --git a/tdapi/tl_premium_state_payment_option_gen.go b/tdapi/tl_premium_state_payment_option_gen.go deleted file mode 100644 index 72294e705..000000000 --- a/tdapi/tl_premium_state_payment_option_gen.go +++ /dev/null @@ -1,296 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumStatePaymentOption represents TL type `premiumStatePaymentOption#7d06b579`. -type PremiumStatePaymentOption struct { - // Information about the payment option - PaymentOption PremiumPaymentOption - // True, if this is the currently used Telegram Premium subscription option - IsCurrent bool - // True, if the payment option can be used to upgrade the existing Telegram Premium - // subscription - IsUpgrade bool - // Identifier of the last in-store transaction for the currently used option - LastTransactionID string -} - -// PremiumStatePaymentOptionTypeID is TL type id of PremiumStatePaymentOption. -const PremiumStatePaymentOptionTypeID = 0x7d06b579 - -// Ensuring interfaces in compile-time for PremiumStatePaymentOption. -var ( - _ bin.Encoder = &PremiumStatePaymentOption{} - _ bin.Decoder = &PremiumStatePaymentOption{} - _ bin.BareEncoder = &PremiumStatePaymentOption{} - _ bin.BareDecoder = &PremiumStatePaymentOption{} -) - -func (p *PremiumStatePaymentOption) Zero() bool { - if p == nil { - return true - } - if !(p.PaymentOption.Zero()) { - return false - } - if !(p.IsCurrent == false) { - return false - } - if !(p.IsUpgrade == false) { - return false - } - if !(p.LastTransactionID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumStatePaymentOption) String() string { - if p == nil { - return "PremiumStatePaymentOption(nil)" - } - type Alias PremiumStatePaymentOption - return fmt.Sprintf("PremiumStatePaymentOption%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumStatePaymentOption) TypeID() uint32 { - return PremiumStatePaymentOptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumStatePaymentOption) TypeName() string { - return "premiumStatePaymentOption" -} - -// TypeInfo returns info about TL type. -func (p *PremiumStatePaymentOption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumStatePaymentOption", - ID: PremiumStatePaymentOptionTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PaymentOption", - SchemaName: "payment_option", - }, - { - Name: "IsCurrent", - SchemaName: "is_current", - }, - { - Name: "IsUpgrade", - SchemaName: "is_upgrade", - }, - { - Name: "LastTransactionID", - SchemaName: "last_transaction_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumStatePaymentOption) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStatePaymentOption#7d06b579 as nil") - } - b.PutID(PremiumStatePaymentOptionTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumStatePaymentOption) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStatePaymentOption#7d06b579 as nil") - } - if err := p.PaymentOption.Encode(b); err != nil { - return fmt.Errorf("unable to encode premiumStatePaymentOption#7d06b579: field payment_option: %w", err) - } - b.PutBool(p.IsCurrent) - b.PutBool(p.IsUpgrade) - b.PutString(p.LastTransactionID) - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumStatePaymentOption) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStatePaymentOption#7d06b579 to nil") - } - if err := b.ConsumeID(PremiumStatePaymentOptionTypeID); err != nil { - return fmt.Errorf("unable to decode premiumStatePaymentOption#7d06b579: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumStatePaymentOption) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStatePaymentOption#7d06b579 to nil") - } - { - if err := p.PaymentOption.Decode(b); err != nil { - return fmt.Errorf("unable to decode premiumStatePaymentOption#7d06b579: field payment_option: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumStatePaymentOption#7d06b579: field is_current: %w", err) - } - p.IsCurrent = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumStatePaymentOption#7d06b579: field is_upgrade: %w", err) - } - p.IsUpgrade = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumStatePaymentOption#7d06b579: field last_transaction_id: %w", err) - } - p.LastTransactionID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumStatePaymentOption) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumStatePaymentOption#7d06b579 as nil") - } - b.ObjStart() - b.PutID("premiumStatePaymentOption") - b.Comma() - b.FieldStart("payment_option") - if err := p.PaymentOption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode premiumStatePaymentOption#7d06b579: field payment_option: %w", err) - } - b.Comma() - b.FieldStart("is_current") - b.PutBool(p.IsCurrent) - b.Comma() - b.FieldStart("is_upgrade") - b.PutBool(p.IsUpgrade) - b.Comma() - b.FieldStart("last_transaction_id") - b.PutString(p.LastTransactionID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumStatePaymentOption) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumStatePaymentOption#7d06b579 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumStatePaymentOption"); err != nil { - return fmt.Errorf("unable to decode premiumStatePaymentOption#7d06b579: %w", err) - } - case "payment_option": - if err := p.PaymentOption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode premiumStatePaymentOption#7d06b579: field payment_option: %w", err) - } - case "is_current": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumStatePaymentOption#7d06b579: field is_current: %w", err) - } - p.IsCurrent = value - case "is_upgrade": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode premiumStatePaymentOption#7d06b579: field is_upgrade: %w", err) - } - p.IsUpgrade = value - case "last_transaction_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode premiumStatePaymentOption#7d06b579: field last_transaction_id: %w", err) - } - p.LastTransactionID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPaymentOption returns value of PaymentOption field. -func (p *PremiumStatePaymentOption) GetPaymentOption() (value PremiumPaymentOption) { - if p == nil { - return - } - return p.PaymentOption -} - -// GetIsCurrent returns value of IsCurrent field. -func (p *PremiumStatePaymentOption) GetIsCurrent() (value bool) { - if p == nil { - return - } - return p.IsCurrent -} - -// GetIsUpgrade returns value of IsUpgrade field. -func (p *PremiumStatePaymentOption) GetIsUpgrade() (value bool) { - if p == nil { - return - } - return p.IsUpgrade -} - -// GetLastTransactionID returns value of LastTransactionID field. -func (p *PremiumStatePaymentOption) GetLastTransactionID() (value string) { - if p == nil { - return - } - return p.LastTransactionID -} diff --git a/tdapi/tl_premium_story_feature_gen.go b/tdapi/tl_premium_story_feature_gen.go deleted file mode 100644 index d3ffd1b05..000000000 --- a/tdapi/tl_premium_story_feature_gen.go +++ /dev/null @@ -1,1161 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PremiumStoryFeaturePriorityOrder represents TL type `premiumStoryFeaturePriorityOrder#8ff172c7`. -type PremiumStoryFeaturePriorityOrder struct { -} - -// PremiumStoryFeaturePriorityOrderTypeID is TL type id of PremiumStoryFeaturePriorityOrder. -const PremiumStoryFeaturePriorityOrderTypeID = 0x8ff172c7 - -// construct implements constructor of PremiumStoryFeatureClass. -func (p PremiumStoryFeaturePriorityOrder) construct() PremiumStoryFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumStoryFeaturePriorityOrder. -var ( - _ bin.Encoder = &PremiumStoryFeaturePriorityOrder{} - _ bin.Decoder = &PremiumStoryFeaturePriorityOrder{} - _ bin.BareEncoder = &PremiumStoryFeaturePriorityOrder{} - _ bin.BareDecoder = &PremiumStoryFeaturePriorityOrder{} - - _ PremiumStoryFeatureClass = &PremiumStoryFeaturePriorityOrder{} -) - -func (p *PremiumStoryFeaturePriorityOrder) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumStoryFeaturePriorityOrder) String() string { - if p == nil { - return "PremiumStoryFeaturePriorityOrder(nil)" - } - type Alias PremiumStoryFeaturePriorityOrder - return fmt.Sprintf("PremiumStoryFeaturePriorityOrder%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumStoryFeaturePriorityOrder) TypeID() uint32 { - return PremiumStoryFeaturePriorityOrderTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumStoryFeaturePriorityOrder) TypeName() string { - return "premiumStoryFeaturePriorityOrder" -} - -// TypeInfo returns info about TL type. -func (p *PremiumStoryFeaturePriorityOrder) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumStoryFeaturePriorityOrder", - ID: PremiumStoryFeaturePriorityOrderTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumStoryFeaturePriorityOrder) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeaturePriorityOrder#8ff172c7 as nil") - } - b.PutID(PremiumStoryFeaturePriorityOrderTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumStoryFeaturePriorityOrder) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeaturePriorityOrder#8ff172c7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumStoryFeaturePriorityOrder) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeaturePriorityOrder#8ff172c7 to nil") - } - if err := b.ConsumeID(PremiumStoryFeaturePriorityOrderTypeID); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeaturePriorityOrder#8ff172c7: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumStoryFeaturePriorityOrder) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeaturePriorityOrder#8ff172c7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumStoryFeaturePriorityOrder) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeaturePriorityOrder#8ff172c7 as nil") - } - b.ObjStart() - b.PutID("premiumStoryFeaturePriorityOrder") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumStoryFeaturePriorityOrder) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeaturePriorityOrder#8ff172c7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumStoryFeaturePriorityOrder"); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeaturePriorityOrder#8ff172c7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumStoryFeatureStealthMode represents TL type `premiumStoryFeatureStealthMode#47343da4`. -type PremiumStoryFeatureStealthMode struct { -} - -// PremiumStoryFeatureStealthModeTypeID is TL type id of PremiumStoryFeatureStealthMode. -const PremiumStoryFeatureStealthModeTypeID = 0x47343da4 - -// construct implements constructor of PremiumStoryFeatureClass. -func (p PremiumStoryFeatureStealthMode) construct() PremiumStoryFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumStoryFeatureStealthMode. -var ( - _ bin.Encoder = &PremiumStoryFeatureStealthMode{} - _ bin.Decoder = &PremiumStoryFeatureStealthMode{} - _ bin.BareEncoder = &PremiumStoryFeatureStealthMode{} - _ bin.BareDecoder = &PremiumStoryFeatureStealthMode{} - - _ PremiumStoryFeatureClass = &PremiumStoryFeatureStealthMode{} -) - -func (p *PremiumStoryFeatureStealthMode) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumStoryFeatureStealthMode) String() string { - if p == nil { - return "PremiumStoryFeatureStealthMode(nil)" - } - type Alias PremiumStoryFeatureStealthMode - return fmt.Sprintf("PremiumStoryFeatureStealthMode%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumStoryFeatureStealthMode) TypeID() uint32 { - return PremiumStoryFeatureStealthModeTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumStoryFeatureStealthMode) TypeName() string { - return "premiumStoryFeatureStealthMode" -} - -// TypeInfo returns info about TL type. -func (p *PremiumStoryFeatureStealthMode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumStoryFeatureStealthMode", - ID: PremiumStoryFeatureStealthModeTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumStoryFeatureStealthMode) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureStealthMode#47343da4 as nil") - } - b.PutID(PremiumStoryFeatureStealthModeTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumStoryFeatureStealthMode) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureStealthMode#47343da4 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumStoryFeatureStealthMode) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureStealthMode#47343da4 to nil") - } - if err := b.ConsumeID(PremiumStoryFeatureStealthModeTypeID); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeatureStealthMode#47343da4: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumStoryFeatureStealthMode) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureStealthMode#47343da4 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumStoryFeatureStealthMode) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureStealthMode#47343da4 as nil") - } - b.ObjStart() - b.PutID("premiumStoryFeatureStealthMode") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumStoryFeatureStealthMode) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureStealthMode#47343da4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumStoryFeatureStealthMode"); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeatureStealthMode#47343da4: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumStoryFeaturePermanentViewsHistory represents TL type `premiumStoryFeaturePermanentViewsHistory#c2a047a0`. -type PremiumStoryFeaturePermanentViewsHistory struct { -} - -// PremiumStoryFeaturePermanentViewsHistoryTypeID is TL type id of PremiumStoryFeaturePermanentViewsHistory. -const PremiumStoryFeaturePermanentViewsHistoryTypeID = 0xc2a047a0 - -// construct implements constructor of PremiumStoryFeatureClass. -func (p PremiumStoryFeaturePermanentViewsHistory) construct() PremiumStoryFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumStoryFeaturePermanentViewsHistory. -var ( - _ bin.Encoder = &PremiumStoryFeaturePermanentViewsHistory{} - _ bin.Decoder = &PremiumStoryFeaturePermanentViewsHistory{} - _ bin.BareEncoder = &PremiumStoryFeaturePermanentViewsHistory{} - _ bin.BareDecoder = &PremiumStoryFeaturePermanentViewsHistory{} - - _ PremiumStoryFeatureClass = &PremiumStoryFeaturePermanentViewsHistory{} -) - -func (p *PremiumStoryFeaturePermanentViewsHistory) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumStoryFeaturePermanentViewsHistory) String() string { - if p == nil { - return "PremiumStoryFeaturePermanentViewsHistory(nil)" - } - type Alias PremiumStoryFeaturePermanentViewsHistory - return fmt.Sprintf("PremiumStoryFeaturePermanentViewsHistory%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumStoryFeaturePermanentViewsHistory) TypeID() uint32 { - return PremiumStoryFeaturePermanentViewsHistoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumStoryFeaturePermanentViewsHistory) TypeName() string { - return "premiumStoryFeaturePermanentViewsHistory" -} - -// TypeInfo returns info about TL type. -func (p *PremiumStoryFeaturePermanentViewsHistory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumStoryFeaturePermanentViewsHistory", - ID: PremiumStoryFeaturePermanentViewsHistoryTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumStoryFeaturePermanentViewsHistory) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeaturePermanentViewsHistory#c2a047a0 as nil") - } - b.PutID(PremiumStoryFeaturePermanentViewsHistoryTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumStoryFeaturePermanentViewsHistory) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeaturePermanentViewsHistory#c2a047a0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumStoryFeaturePermanentViewsHistory) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeaturePermanentViewsHistory#c2a047a0 to nil") - } - if err := b.ConsumeID(PremiumStoryFeaturePermanentViewsHistoryTypeID); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeaturePermanentViewsHistory#c2a047a0: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumStoryFeaturePermanentViewsHistory) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeaturePermanentViewsHistory#c2a047a0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumStoryFeaturePermanentViewsHistory) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeaturePermanentViewsHistory#c2a047a0 as nil") - } - b.ObjStart() - b.PutID("premiumStoryFeaturePermanentViewsHistory") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumStoryFeaturePermanentViewsHistory) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeaturePermanentViewsHistory#c2a047a0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumStoryFeaturePermanentViewsHistory"); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeaturePermanentViewsHistory#c2a047a0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumStoryFeatureCustomExpirationDuration represents TL type `premiumStoryFeatureCustomExpirationDuration#dca40a96`. -type PremiumStoryFeatureCustomExpirationDuration struct { -} - -// PremiumStoryFeatureCustomExpirationDurationTypeID is TL type id of PremiumStoryFeatureCustomExpirationDuration. -const PremiumStoryFeatureCustomExpirationDurationTypeID = 0xdca40a96 - -// construct implements constructor of PremiumStoryFeatureClass. -func (p PremiumStoryFeatureCustomExpirationDuration) construct() PremiumStoryFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumStoryFeatureCustomExpirationDuration. -var ( - _ bin.Encoder = &PremiumStoryFeatureCustomExpirationDuration{} - _ bin.Decoder = &PremiumStoryFeatureCustomExpirationDuration{} - _ bin.BareEncoder = &PremiumStoryFeatureCustomExpirationDuration{} - _ bin.BareDecoder = &PremiumStoryFeatureCustomExpirationDuration{} - - _ PremiumStoryFeatureClass = &PremiumStoryFeatureCustomExpirationDuration{} -) - -func (p *PremiumStoryFeatureCustomExpirationDuration) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumStoryFeatureCustomExpirationDuration) String() string { - if p == nil { - return "PremiumStoryFeatureCustomExpirationDuration(nil)" - } - type Alias PremiumStoryFeatureCustomExpirationDuration - return fmt.Sprintf("PremiumStoryFeatureCustomExpirationDuration%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumStoryFeatureCustomExpirationDuration) TypeID() uint32 { - return PremiumStoryFeatureCustomExpirationDurationTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumStoryFeatureCustomExpirationDuration) TypeName() string { - return "premiumStoryFeatureCustomExpirationDuration" -} - -// TypeInfo returns info about TL type. -func (p *PremiumStoryFeatureCustomExpirationDuration) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumStoryFeatureCustomExpirationDuration", - ID: PremiumStoryFeatureCustomExpirationDurationTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumStoryFeatureCustomExpirationDuration) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureCustomExpirationDuration#dca40a96 as nil") - } - b.PutID(PremiumStoryFeatureCustomExpirationDurationTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumStoryFeatureCustomExpirationDuration) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureCustomExpirationDuration#dca40a96 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumStoryFeatureCustomExpirationDuration) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureCustomExpirationDuration#dca40a96 to nil") - } - if err := b.ConsumeID(PremiumStoryFeatureCustomExpirationDurationTypeID); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeatureCustomExpirationDuration#dca40a96: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumStoryFeatureCustomExpirationDuration) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureCustomExpirationDuration#dca40a96 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumStoryFeatureCustomExpirationDuration) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureCustomExpirationDuration#dca40a96 as nil") - } - b.ObjStart() - b.PutID("premiumStoryFeatureCustomExpirationDuration") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumStoryFeatureCustomExpirationDuration) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureCustomExpirationDuration#dca40a96 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumStoryFeatureCustomExpirationDuration"); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeatureCustomExpirationDuration#dca40a96: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumStoryFeatureSaveStories represents TL type `premiumStoryFeatureSaveStories#a6842fbd`. -type PremiumStoryFeatureSaveStories struct { -} - -// PremiumStoryFeatureSaveStoriesTypeID is TL type id of PremiumStoryFeatureSaveStories. -const PremiumStoryFeatureSaveStoriesTypeID = 0xa6842fbd - -// construct implements constructor of PremiumStoryFeatureClass. -func (p PremiumStoryFeatureSaveStories) construct() PremiumStoryFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumStoryFeatureSaveStories. -var ( - _ bin.Encoder = &PremiumStoryFeatureSaveStories{} - _ bin.Decoder = &PremiumStoryFeatureSaveStories{} - _ bin.BareEncoder = &PremiumStoryFeatureSaveStories{} - _ bin.BareDecoder = &PremiumStoryFeatureSaveStories{} - - _ PremiumStoryFeatureClass = &PremiumStoryFeatureSaveStories{} -) - -func (p *PremiumStoryFeatureSaveStories) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumStoryFeatureSaveStories) String() string { - if p == nil { - return "PremiumStoryFeatureSaveStories(nil)" - } - type Alias PremiumStoryFeatureSaveStories - return fmt.Sprintf("PremiumStoryFeatureSaveStories%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumStoryFeatureSaveStories) TypeID() uint32 { - return PremiumStoryFeatureSaveStoriesTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumStoryFeatureSaveStories) TypeName() string { - return "premiumStoryFeatureSaveStories" -} - -// TypeInfo returns info about TL type. -func (p *PremiumStoryFeatureSaveStories) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumStoryFeatureSaveStories", - ID: PremiumStoryFeatureSaveStoriesTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumStoryFeatureSaveStories) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureSaveStories#a6842fbd as nil") - } - b.PutID(PremiumStoryFeatureSaveStoriesTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumStoryFeatureSaveStories) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureSaveStories#a6842fbd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumStoryFeatureSaveStories) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureSaveStories#a6842fbd to nil") - } - if err := b.ConsumeID(PremiumStoryFeatureSaveStoriesTypeID); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeatureSaveStories#a6842fbd: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumStoryFeatureSaveStories) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureSaveStories#a6842fbd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumStoryFeatureSaveStories) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureSaveStories#a6842fbd as nil") - } - b.ObjStart() - b.PutID("premiumStoryFeatureSaveStories") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumStoryFeatureSaveStories) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureSaveStories#a6842fbd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumStoryFeatureSaveStories"); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeatureSaveStories#a6842fbd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumStoryFeatureLinksAndFormatting represents TL type `premiumStoryFeatureLinksAndFormatting#dae383f7`. -type PremiumStoryFeatureLinksAndFormatting struct { -} - -// PremiumStoryFeatureLinksAndFormattingTypeID is TL type id of PremiumStoryFeatureLinksAndFormatting. -const PremiumStoryFeatureLinksAndFormattingTypeID = 0xdae383f7 - -// construct implements constructor of PremiumStoryFeatureClass. -func (p PremiumStoryFeatureLinksAndFormatting) construct() PremiumStoryFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumStoryFeatureLinksAndFormatting. -var ( - _ bin.Encoder = &PremiumStoryFeatureLinksAndFormatting{} - _ bin.Decoder = &PremiumStoryFeatureLinksAndFormatting{} - _ bin.BareEncoder = &PremiumStoryFeatureLinksAndFormatting{} - _ bin.BareDecoder = &PremiumStoryFeatureLinksAndFormatting{} - - _ PremiumStoryFeatureClass = &PremiumStoryFeatureLinksAndFormatting{} -) - -func (p *PremiumStoryFeatureLinksAndFormatting) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumStoryFeatureLinksAndFormatting) String() string { - if p == nil { - return "PremiumStoryFeatureLinksAndFormatting(nil)" - } - type Alias PremiumStoryFeatureLinksAndFormatting - return fmt.Sprintf("PremiumStoryFeatureLinksAndFormatting%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumStoryFeatureLinksAndFormatting) TypeID() uint32 { - return PremiumStoryFeatureLinksAndFormattingTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumStoryFeatureLinksAndFormatting) TypeName() string { - return "premiumStoryFeatureLinksAndFormatting" -} - -// TypeInfo returns info about TL type. -func (p *PremiumStoryFeatureLinksAndFormatting) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumStoryFeatureLinksAndFormatting", - ID: PremiumStoryFeatureLinksAndFormattingTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumStoryFeatureLinksAndFormatting) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureLinksAndFormatting#dae383f7 as nil") - } - b.PutID(PremiumStoryFeatureLinksAndFormattingTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumStoryFeatureLinksAndFormatting) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureLinksAndFormatting#dae383f7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumStoryFeatureLinksAndFormatting) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureLinksAndFormatting#dae383f7 to nil") - } - if err := b.ConsumeID(PremiumStoryFeatureLinksAndFormattingTypeID); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeatureLinksAndFormatting#dae383f7: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumStoryFeatureLinksAndFormatting) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureLinksAndFormatting#dae383f7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumStoryFeatureLinksAndFormatting) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureLinksAndFormatting#dae383f7 as nil") - } - b.ObjStart() - b.PutID("premiumStoryFeatureLinksAndFormatting") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumStoryFeatureLinksAndFormatting) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureLinksAndFormatting#dae383f7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumStoryFeatureLinksAndFormatting"); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeatureLinksAndFormatting#dae383f7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumStoryFeatureVideoQuality represents TL type `premiumStoryFeatureVideoQuality#baafbea9`. -type PremiumStoryFeatureVideoQuality struct { -} - -// PremiumStoryFeatureVideoQualityTypeID is TL type id of PremiumStoryFeatureVideoQuality. -const PremiumStoryFeatureVideoQualityTypeID = 0xbaafbea9 - -// construct implements constructor of PremiumStoryFeatureClass. -func (p PremiumStoryFeatureVideoQuality) construct() PremiumStoryFeatureClass { return &p } - -// Ensuring interfaces in compile-time for PremiumStoryFeatureVideoQuality. -var ( - _ bin.Encoder = &PremiumStoryFeatureVideoQuality{} - _ bin.Decoder = &PremiumStoryFeatureVideoQuality{} - _ bin.BareEncoder = &PremiumStoryFeatureVideoQuality{} - _ bin.BareDecoder = &PremiumStoryFeatureVideoQuality{} - - _ PremiumStoryFeatureClass = &PremiumStoryFeatureVideoQuality{} -) - -func (p *PremiumStoryFeatureVideoQuality) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PremiumStoryFeatureVideoQuality) String() string { - if p == nil { - return "PremiumStoryFeatureVideoQuality(nil)" - } - type Alias PremiumStoryFeatureVideoQuality - return fmt.Sprintf("PremiumStoryFeatureVideoQuality%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PremiumStoryFeatureVideoQuality) TypeID() uint32 { - return PremiumStoryFeatureVideoQualityTypeID -} - -// TypeName returns name of type in TL schema. -func (*PremiumStoryFeatureVideoQuality) TypeName() string { - return "premiumStoryFeatureVideoQuality" -} - -// TypeInfo returns info about TL type. -func (p *PremiumStoryFeatureVideoQuality) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "premiumStoryFeatureVideoQuality", - ID: PremiumStoryFeatureVideoQualityTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PremiumStoryFeatureVideoQuality) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureVideoQuality#baafbea9 as nil") - } - b.PutID(PremiumStoryFeatureVideoQualityTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PremiumStoryFeatureVideoQuality) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureVideoQuality#baafbea9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PremiumStoryFeatureVideoQuality) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureVideoQuality#baafbea9 to nil") - } - if err := b.ConsumeID(PremiumStoryFeatureVideoQualityTypeID); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeatureVideoQuality#baafbea9: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PremiumStoryFeatureVideoQuality) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureVideoQuality#baafbea9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PremiumStoryFeatureVideoQuality) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode premiumStoryFeatureVideoQuality#baafbea9 as nil") - } - b.ObjStart() - b.PutID("premiumStoryFeatureVideoQuality") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PremiumStoryFeatureVideoQuality) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode premiumStoryFeatureVideoQuality#baafbea9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("premiumStoryFeatureVideoQuality"); err != nil { - return fmt.Errorf("unable to decode premiumStoryFeatureVideoQuality#baafbea9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PremiumStoryFeatureClassName is schema name of PremiumStoryFeatureClass. -const PremiumStoryFeatureClassName = "PremiumStoryFeature" - -// PremiumStoryFeatureClass represents PremiumStoryFeature generic type. -// -// Example: -// -// g, err := tdapi.DecodePremiumStoryFeature(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PremiumStoryFeaturePriorityOrder: // premiumStoryFeaturePriorityOrder#8ff172c7 -// case *tdapi.PremiumStoryFeatureStealthMode: // premiumStoryFeatureStealthMode#47343da4 -// case *tdapi.PremiumStoryFeaturePermanentViewsHistory: // premiumStoryFeaturePermanentViewsHistory#c2a047a0 -// case *tdapi.PremiumStoryFeatureCustomExpirationDuration: // premiumStoryFeatureCustomExpirationDuration#dca40a96 -// case *tdapi.PremiumStoryFeatureSaveStories: // premiumStoryFeatureSaveStories#a6842fbd -// case *tdapi.PremiumStoryFeatureLinksAndFormatting: // premiumStoryFeatureLinksAndFormatting#dae383f7 -// case *tdapi.PremiumStoryFeatureVideoQuality: // premiumStoryFeatureVideoQuality#baafbea9 -// default: panic(v) -// } -type PremiumStoryFeatureClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PremiumStoryFeatureClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePremiumStoryFeature implements binary de-serialization for PremiumStoryFeatureClass. -func DecodePremiumStoryFeature(buf *bin.Buffer) (PremiumStoryFeatureClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PremiumStoryFeaturePriorityOrderTypeID: - // Decoding premiumStoryFeaturePriorityOrder#8ff172c7. - v := PremiumStoryFeaturePriorityOrder{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case PremiumStoryFeatureStealthModeTypeID: - // Decoding premiumStoryFeatureStealthMode#47343da4. - v := PremiumStoryFeatureStealthMode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case PremiumStoryFeaturePermanentViewsHistoryTypeID: - // Decoding premiumStoryFeaturePermanentViewsHistory#c2a047a0. - v := PremiumStoryFeaturePermanentViewsHistory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case PremiumStoryFeatureCustomExpirationDurationTypeID: - // Decoding premiumStoryFeatureCustomExpirationDuration#dca40a96. - v := PremiumStoryFeatureCustomExpirationDuration{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case PremiumStoryFeatureSaveStoriesTypeID: - // Decoding premiumStoryFeatureSaveStories#a6842fbd. - v := PremiumStoryFeatureSaveStories{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case PremiumStoryFeatureLinksAndFormattingTypeID: - // Decoding premiumStoryFeatureLinksAndFormatting#dae383f7. - v := PremiumStoryFeatureLinksAndFormatting{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case PremiumStoryFeatureVideoQualityTypeID: - // Decoding premiumStoryFeatureVideoQuality#baafbea9. - v := PremiumStoryFeatureVideoQuality{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPremiumStoryFeature implements binary de-serialization for PremiumStoryFeatureClass. -func DecodeTDLibJSONPremiumStoryFeature(buf tdjson.Decoder) (PremiumStoryFeatureClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "premiumStoryFeaturePriorityOrder": - // Decoding premiumStoryFeaturePriorityOrder#8ff172c7. - v := PremiumStoryFeaturePriorityOrder{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case "premiumStoryFeatureStealthMode": - // Decoding premiumStoryFeatureStealthMode#47343da4. - v := PremiumStoryFeatureStealthMode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case "premiumStoryFeaturePermanentViewsHistory": - // Decoding premiumStoryFeaturePermanentViewsHistory#c2a047a0. - v := PremiumStoryFeaturePermanentViewsHistory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case "premiumStoryFeatureCustomExpirationDuration": - // Decoding premiumStoryFeatureCustomExpirationDuration#dca40a96. - v := PremiumStoryFeatureCustomExpirationDuration{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case "premiumStoryFeatureSaveStories": - // Decoding premiumStoryFeatureSaveStories#a6842fbd. - v := PremiumStoryFeatureSaveStories{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case "premiumStoryFeatureLinksAndFormatting": - // Decoding premiumStoryFeatureLinksAndFormatting#dae383f7. - v := PremiumStoryFeatureLinksAndFormatting{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - case "premiumStoryFeatureVideoQuality": - // Decoding premiumStoryFeatureVideoQuality#baafbea9. - v := PremiumStoryFeatureVideoQuality{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PremiumStoryFeatureClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PremiumStoryFeature boxes the PremiumStoryFeatureClass providing a helper. -type PremiumStoryFeatureBox struct { - PremiumStoryFeature PremiumStoryFeatureClass -} - -// Decode implements bin.Decoder for PremiumStoryFeatureBox. -func (b *PremiumStoryFeatureBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumStoryFeatureBox to nil") - } - v, err := DecodePremiumStoryFeature(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumStoryFeature = v - return nil -} - -// Encode implements bin.Encode for PremiumStoryFeatureBox. -func (b *PremiumStoryFeatureBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PremiumStoryFeature == nil { - return fmt.Errorf("unable to encode PremiumStoryFeatureClass as nil") - } - return b.PremiumStoryFeature.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PremiumStoryFeatureBox. -func (b *PremiumStoryFeatureBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PremiumStoryFeatureBox to nil") - } - v, err := DecodeTDLibJSONPremiumStoryFeature(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PremiumStoryFeature = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PremiumStoryFeatureBox. -func (b *PremiumStoryFeatureBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PremiumStoryFeature == nil { - return fmt.Errorf("unable to encode PremiumStoryFeatureClass as nil") - } - return b.PremiumStoryFeature.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_prepaid_giveaway_gen.go b/tdapi/tl_prepaid_giveaway_gen.go deleted file mode 100644 index 0d5064d0e..000000000 --- a/tdapi/tl_prepaid_giveaway_gen.go +++ /dev/null @@ -1,340 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PrepaidGiveaway represents TL type `prepaidGiveaway#ef70338f`. -type PrepaidGiveaway struct { - // Unique identifier of the prepaid giveaway - ID int64 - // Number of users which will receive giveaway prize - WinnerCount int32 - // Prize of the giveaway - Prize GiveawayPrizeClass - // The number of boosts received by the chat from the giveaway; for Telegram Star - // giveaways only - BoostCount int32 - // Point in time (Unix timestamp) when the giveaway was paid - PaymentDate int32 -} - -// PrepaidGiveawayTypeID is TL type id of PrepaidGiveaway. -const PrepaidGiveawayTypeID = 0xef70338f - -// Ensuring interfaces in compile-time for PrepaidGiveaway. -var ( - _ bin.Encoder = &PrepaidGiveaway{} - _ bin.Decoder = &PrepaidGiveaway{} - _ bin.BareEncoder = &PrepaidGiveaway{} - _ bin.BareDecoder = &PrepaidGiveaway{} -) - -func (p *PrepaidGiveaway) Zero() bool { - if p == nil { - return true - } - if !(p.ID == 0) { - return false - } - if !(p.WinnerCount == 0) { - return false - } - if !(p.Prize == nil) { - return false - } - if !(p.BoostCount == 0) { - return false - } - if !(p.PaymentDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PrepaidGiveaway) String() string { - if p == nil { - return "PrepaidGiveaway(nil)" - } - type Alias PrepaidGiveaway - return fmt.Sprintf("PrepaidGiveaway%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PrepaidGiveaway) TypeID() uint32 { - return PrepaidGiveawayTypeID -} - -// TypeName returns name of type in TL schema. -func (*PrepaidGiveaway) TypeName() string { - return "prepaidGiveaway" -} - -// TypeInfo returns info about TL type. -func (p *PrepaidGiveaway) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "prepaidGiveaway", - ID: PrepaidGiveawayTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "Prize", - SchemaName: "prize", - }, - { - Name: "BoostCount", - SchemaName: "boost_count", - }, - { - Name: "PaymentDate", - SchemaName: "payment_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PrepaidGiveaway) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode prepaidGiveaway#ef70338f as nil") - } - b.PutID(PrepaidGiveawayTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PrepaidGiveaway) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode prepaidGiveaway#ef70338f as nil") - } - b.PutLong(p.ID) - b.PutInt32(p.WinnerCount) - if p.Prize == nil { - return fmt.Errorf("unable to encode prepaidGiveaway#ef70338f: field prize is nil") - } - if err := p.Prize.Encode(b); err != nil { - return fmt.Errorf("unable to encode prepaidGiveaway#ef70338f: field prize: %w", err) - } - b.PutInt32(p.BoostCount) - b.PutInt32(p.PaymentDate) - return nil -} - -// Decode implements bin.Decoder. -func (p *PrepaidGiveaway) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode prepaidGiveaway#ef70338f to nil") - } - if err := b.ConsumeID(PrepaidGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PrepaidGiveaway) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode prepaidGiveaway#ef70338f to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field id: %w", err) - } - p.ID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field winner_count: %w", err) - } - p.WinnerCount = value - } - { - value, err := DecodeGiveawayPrize(b) - if err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field prize: %w", err) - } - p.Prize = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field boost_count: %w", err) - } - p.BoostCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field payment_date: %w", err) - } - p.PaymentDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PrepaidGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode prepaidGiveaway#ef70338f as nil") - } - b.ObjStart() - b.PutID("prepaidGiveaway") - b.Comma() - b.FieldStart("id") - b.PutLong(p.ID) - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(p.WinnerCount) - b.Comma() - b.FieldStart("prize") - if p.Prize == nil { - return fmt.Errorf("unable to encode prepaidGiveaway#ef70338f: field prize is nil") - } - if err := p.Prize.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode prepaidGiveaway#ef70338f: field prize: %w", err) - } - b.Comma() - b.FieldStart("boost_count") - b.PutInt32(p.BoostCount) - b.Comma() - b.FieldStart("payment_date") - b.PutInt32(p.PaymentDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PrepaidGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode prepaidGiveaway#ef70338f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("prepaidGiveaway"); err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field id: %w", err) - } - p.ID = value - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field winner_count: %w", err) - } - p.WinnerCount = value - case "prize": - value, err := DecodeTDLibJSONGiveawayPrize(b) - if err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field prize: %w", err) - } - p.Prize = value - case "boost_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field boost_count: %w", err) - } - p.BoostCount = value - case "payment_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode prepaidGiveaway#ef70338f: field payment_date: %w", err) - } - p.PaymentDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (p *PrepaidGiveaway) GetID() (value int64) { - if p == nil { - return - } - return p.ID -} - -// GetWinnerCount returns value of WinnerCount field. -func (p *PrepaidGiveaway) GetWinnerCount() (value int32) { - if p == nil { - return - } - return p.WinnerCount -} - -// GetPrize returns value of Prize field. -func (p *PrepaidGiveaway) GetPrize() (value GiveawayPrizeClass) { - if p == nil { - return - } - return p.Prize -} - -// GetBoostCount returns value of BoostCount field. -func (p *PrepaidGiveaway) GetBoostCount() (value int32) { - if p == nil { - return - } - return p.BoostCount -} - -// GetPaymentDate returns value of PaymentDate field. -func (p *PrepaidGiveaway) GetPaymentDate() (value int32) { - if p == nil { - return - } - return p.PaymentDate -} diff --git a/tdapi/tl_prepared_inline_message_gen.go b/tdapi/tl_prepared_inline_message_gen.go deleted file mode 100644 index 4f4911143..000000000 --- a/tdapi/tl_prepared_inline_message_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PreparedInlineMessage represents TL type `preparedInlineMessage#942e7cc2`. -type PreparedInlineMessage struct { - // Unique identifier of the inline query to pass to sendInlineQueryResultMessage - InlineQueryID int64 - // Resulted inline message of the query - Result InlineQueryResultClass - // Types of the chats to which the message can be sent - ChatTypes TargetChatTypes -} - -// PreparedInlineMessageTypeID is TL type id of PreparedInlineMessage. -const PreparedInlineMessageTypeID = 0x942e7cc2 - -// Ensuring interfaces in compile-time for PreparedInlineMessage. -var ( - _ bin.Encoder = &PreparedInlineMessage{} - _ bin.Decoder = &PreparedInlineMessage{} - _ bin.BareEncoder = &PreparedInlineMessage{} - _ bin.BareDecoder = &PreparedInlineMessage{} -) - -func (p *PreparedInlineMessage) Zero() bool { - if p == nil { - return true - } - if !(p.InlineQueryID == 0) { - return false - } - if !(p.Result == nil) { - return false - } - if !(p.ChatTypes.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PreparedInlineMessage) String() string { - if p == nil { - return "PreparedInlineMessage(nil)" - } - type Alias PreparedInlineMessage - return fmt.Sprintf("PreparedInlineMessage%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PreparedInlineMessage) TypeID() uint32 { - return PreparedInlineMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*PreparedInlineMessage) TypeName() string { - return "preparedInlineMessage" -} - -// TypeInfo returns info about TL type. -func (p *PreparedInlineMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "preparedInlineMessage", - ID: PreparedInlineMessageTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InlineQueryID", - SchemaName: "inline_query_id", - }, - { - Name: "Result", - SchemaName: "result", - }, - { - Name: "ChatTypes", - SchemaName: "chat_types", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PreparedInlineMessage) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode preparedInlineMessage#942e7cc2 as nil") - } - b.PutID(PreparedInlineMessageTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PreparedInlineMessage) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode preparedInlineMessage#942e7cc2 as nil") - } - b.PutLong(p.InlineQueryID) - if p.Result == nil { - return fmt.Errorf("unable to encode preparedInlineMessage#942e7cc2: field result is nil") - } - if err := p.Result.Encode(b); err != nil { - return fmt.Errorf("unable to encode preparedInlineMessage#942e7cc2: field result: %w", err) - } - if err := p.ChatTypes.Encode(b); err != nil { - return fmt.Errorf("unable to encode preparedInlineMessage#942e7cc2: field chat_types: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PreparedInlineMessage) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode preparedInlineMessage#942e7cc2 to nil") - } - if err := b.ConsumeID(PreparedInlineMessageTypeID); err != nil { - return fmt.Errorf("unable to decode preparedInlineMessage#942e7cc2: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PreparedInlineMessage) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode preparedInlineMessage#942e7cc2 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode preparedInlineMessage#942e7cc2: field inline_query_id: %w", err) - } - p.InlineQueryID = value - } - { - value, err := DecodeInlineQueryResult(b) - if err != nil { - return fmt.Errorf("unable to decode preparedInlineMessage#942e7cc2: field result: %w", err) - } - p.Result = value - } - { - if err := p.ChatTypes.Decode(b); err != nil { - return fmt.Errorf("unable to decode preparedInlineMessage#942e7cc2: field chat_types: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PreparedInlineMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode preparedInlineMessage#942e7cc2 as nil") - } - b.ObjStart() - b.PutID("preparedInlineMessage") - b.Comma() - b.FieldStart("inline_query_id") - b.PutLong(p.InlineQueryID) - b.Comma() - b.FieldStart("result") - if p.Result == nil { - return fmt.Errorf("unable to encode preparedInlineMessage#942e7cc2: field result is nil") - } - if err := p.Result.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode preparedInlineMessage#942e7cc2: field result: %w", err) - } - b.Comma() - b.FieldStart("chat_types") - if err := p.ChatTypes.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode preparedInlineMessage#942e7cc2: field chat_types: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PreparedInlineMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode preparedInlineMessage#942e7cc2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("preparedInlineMessage"); err != nil { - return fmt.Errorf("unable to decode preparedInlineMessage#942e7cc2: %w", err) - } - case "inline_query_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode preparedInlineMessage#942e7cc2: field inline_query_id: %w", err) - } - p.InlineQueryID = value - case "result": - value, err := DecodeTDLibJSONInlineQueryResult(b) - if err != nil { - return fmt.Errorf("unable to decode preparedInlineMessage#942e7cc2: field result: %w", err) - } - p.Result = value - case "chat_types": - if err := p.ChatTypes.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode preparedInlineMessage#942e7cc2: field chat_types: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInlineQueryID returns value of InlineQueryID field. -func (p *PreparedInlineMessage) GetInlineQueryID() (value int64) { - if p == nil { - return - } - return p.InlineQueryID -} - -// GetResult returns value of Result field. -func (p *PreparedInlineMessage) GetResult() (value InlineQueryResultClass) { - if p == nil { - return - } - return p.Result -} - -// GetChatTypes returns value of ChatTypes field. -func (p *PreparedInlineMessage) GetChatTypes() (value TargetChatTypes) { - if p == nil { - return - } - return p.ChatTypes -} diff --git a/tdapi/tl_prepared_inline_message_id_gen.go b/tdapi/tl_prepared_inline_message_id_gen.go deleted file mode 100644 index 478c281af..000000000 --- a/tdapi/tl_prepared_inline_message_id_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PreparedInlineMessageID represents TL type `preparedInlineMessageId#380d9be4`. -type PreparedInlineMessageID struct { - // Unique identifier for the message - ID string - // Point in time (Unix timestamp) when the message can't be used anymore - ExpirationDate int32 -} - -// PreparedInlineMessageIDTypeID is TL type id of PreparedInlineMessageID. -const PreparedInlineMessageIDTypeID = 0x380d9be4 - -// Ensuring interfaces in compile-time for PreparedInlineMessageID. -var ( - _ bin.Encoder = &PreparedInlineMessageID{} - _ bin.Decoder = &PreparedInlineMessageID{} - _ bin.BareEncoder = &PreparedInlineMessageID{} - _ bin.BareDecoder = &PreparedInlineMessageID{} -) - -func (p *PreparedInlineMessageID) Zero() bool { - if p == nil { - return true - } - if !(p.ID == "") { - return false - } - if !(p.ExpirationDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PreparedInlineMessageID) String() string { - if p == nil { - return "PreparedInlineMessageID(nil)" - } - type Alias PreparedInlineMessageID - return fmt.Sprintf("PreparedInlineMessageID%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PreparedInlineMessageID) TypeID() uint32 { - return PreparedInlineMessageIDTypeID -} - -// TypeName returns name of type in TL schema. -func (*PreparedInlineMessageID) TypeName() string { - return "preparedInlineMessageId" -} - -// TypeInfo returns info about TL type. -func (p *PreparedInlineMessageID) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "preparedInlineMessageId", - ID: PreparedInlineMessageIDTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "ExpirationDate", - SchemaName: "expiration_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PreparedInlineMessageID) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode preparedInlineMessageId#380d9be4 as nil") - } - b.PutID(PreparedInlineMessageIDTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PreparedInlineMessageID) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode preparedInlineMessageId#380d9be4 as nil") - } - b.PutString(p.ID) - b.PutInt32(p.ExpirationDate) - return nil -} - -// Decode implements bin.Decoder. -func (p *PreparedInlineMessageID) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode preparedInlineMessageId#380d9be4 to nil") - } - if err := b.ConsumeID(PreparedInlineMessageIDTypeID); err != nil { - return fmt.Errorf("unable to decode preparedInlineMessageId#380d9be4: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PreparedInlineMessageID) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode preparedInlineMessageId#380d9be4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode preparedInlineMessageId#380d9be4: field id: %w", err) - } - p.ID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode preparedInlineMessageId#380d9be4: field expiration_date: %w", err) - } - p.ExpirationDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PreparedInlineMessageID) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode preparedInlineMessageId#380d9be4 as nil") - } - b.ObjStart() - b.PutID("preparedInlineMessageId") - b.Comma() - b.FieldStart("id") - b.PutString(p.ID) - b.Comma() - b.FieldStart("expiration_date") - b.PutInt32(p.ExpirationDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PreparedInlineMessageID) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode preparedInlineMessageId#380d9be4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("preparedInlineMessageId"); err != nil { - return fmt.Errorf("unable to decode preparedInlineMessageId#380d9be4: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode preparedInlineMessageId#380d9be4: field id: %w", err) - } - p.ID = value - case "expiration_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode preparedInlineMessageId#380d9be4: field expiration_date: %w", err) - } - p.ExpirationDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (p *PreparedInlineMessageID) GetID() (value string) { - if p == nil { - return - } - return p.ID -} - -// GetExpirationDate returns value of ExpirationDate field. -func (p *PreparedInlineMessageID) GetExpirationDate() (value int32) { - if p == nil { - return - } - return p.ExpirationDate -} diff --git a/tdapi/tl_process_chat_folder_new_chats_gen.go b/tdapi/tl_process_chat_folder_new_chats_gen.go deleted file mode 100644 index 7fdf25ea1..000000000 --- a/tdapi/tl_process_chat_folder_new_chats_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ProcessChatFolderNewChatsRequest represents TL type `processChatFolderNewChats#109f8a8b`. -type ProcessChatFolderNewChatsRequest struct { - // Chat folder identifier - ChatFolderID int32 - // Identifiers of the new chats, which are added to the chat folder. The chats are - // automatically joined if they aren't joined yet - AddedChatIDs []int64 -} - -// ProcessChatFolderNewChatsRequestTypeID is TL type id of ProcessChatFolderNewChatsRequest. -const ProcessChatFolderNewChatsRequestTypeID = 0x109f8a8b - -// Ensuring interfaces in compile-time for ProcessChatFolderNewChatsRequest. -var ( - _ bin.Encoder = &ProcessChatFolderNewChatsRequest{} - _ bin.Decoder = &ProcessChatFolderNewChatsRequest{} - _ bin.BareEncoder = &ProcessChatFolderNewChatsRequest{} - _ bin.BareDecoder = &ProcessChatFolderNewChatsRequest{} -) - -func (p *ProcessChatFolderNewChatsRequest) Zero() bool { - if p == nil { - return true - } - if !(p.ChatFolderID == 0) { - return false - } - if !(p.AddedChatIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ProcessChatFolderNewChatsRequest) String() string { - if p == nil { - return "ProcessChatFolderNewChatsRequest(nil)" - } - type Alias ProcessChatFolderNewChatsRequest - return fmt.Sprintf("ProcessChatFolderNewChatsRequest%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ProcessChatFolderNewChatsRequest) TypeID() uint32 { - return ProcessChatFolderNewChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ProcessChatFolderNewChatsRequest) TypeName() string { - return "processChatFolderNewChats" -} - -// TypeInfo returns info about TL type. -func (p *ProcessChatFolderNewChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "processChatFolderNewChats", - ID: ProcessChatFolderNewChatsRequestTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderID", - SchemaName: "chat_folder_id", - }, - { - Name: "AddedChatIDs", - SchemaName: "added_chat_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ProcessChatFolderNewChatsRequest) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode processChatFolderNewChats#109f8a8b as nil") - } - b.PutID(ProcessChatFolderNewChatsRequestTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ProcessChatFolderNewChatsRequest) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode processChatFolderNewChats#109f8a8b as nil") - } - b.PutInt32(p.ChatFolderID) - b.PutInt(len(p.AddedChatIDs)) - for _, v := range p.AddedChatIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *ProcessChatFolderNewChatsRequest) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode processChatFolderNewChats#109f8a8b to nil") - } - if err := b.ConsumeID(ProcessChatFolderNewChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode processChatFolderNewChats#109f8a8b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ProcessChatFolderNewChatsRequest) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode processChatFolderNewChats#109f8a8b to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode processChatFolderNewChats#109f8a8b: field chat_folder_id: %w", err) - } - p.ChatFolderID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode processChatFolderNewChats#109f8a8b: field added_chat_ids: %w", err) - } - - if headerLen > 0 { - p.AddedChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode processChatFolderNewChats#109f8a8b: field added_chat_ids: %w", err) - } - p.AddedChatIDs = append(p.AddedChatIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ProcessChatFolderNewChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode processChatFolderNewChats#109f8a8b as nil") - } - b.ObjStart() - b.PutID("processChatFolderNewChats") - b.Comma() - b.FieldStart("chat_folder_id") - b.PutInt32(p.ChatFolderID) - b.Comma() - b.FieldStart("added_chat_ids") - b.ArrStart() - for _, v := range p.AddedChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ProcessChatFolderNewChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode processChatFolderNewChats#109f8a8b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("processChatFolderNewChats"); err != nil { - return fmt.Errorf("unable to decode processChatFolderNewChats#109f8a8b: %w", err) - } - case "chat_folder_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode processChatFolderNewChats#109f8a8b: field chat_folder_id: %w", err) - } - p.ChatFolderID = value - case "added_chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode processChatFolderNewChats#109f8a8b: field added_chat_ids: %w", err) - } - p.AddedChatIDs = append(p.AddedChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode processChatFolderNewChats#109f8a8b: field added_chat_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderID returns value of ChatFolderID field. -func (p *ProcessChatFolderNewChatsRequest) GetChatFolderID() (value int32) { - if p == nil { - return - } - return p.ChatFolderID -} - -// GetAddedChatIDs returns value of AddedChatIDs field. -func (p *ProcessChatFolderNewChatsRequest) GetAddedChatIDs() (value []int64) { - if p == nil { - return - } - return p.AddedChatIDs -} - -// ProcessChatFolderNewChats invokes method processChatFolderNewChats#109f8a8b returning error if any. -func (c *Client) ProcessChatFolderNewChats(ctx context.Context, request *ProcessChatFolderNewChatsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_process_chat_join_request_gen.go b/tdapi/tl_process_chat_join_request_gen.go deleted file mode 100644 index 97071994b..000000000 --- a/tdapi/tl_process_chat_join_request_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ProcessChatJoinRequestRequest represents TL type `processChatJoinRequest#3be534a3`. -type ProcessChatJoinRequestRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the user that sent the request - UserID int64 - // Pass true to approve the request; pass false to decline it - Approve bool -} - -// ProcessChatJoinRequestRequestTypeID is TL type id of ProcessChatJoinRequestRequest. -const ProcessChatJoinRequestRequestTypeID = 0x3be534a3 - -// Ensuring interfaces in compile-time for ProcessChatJoinRequestRequest. -var ( - _ bin.Encoder = &ProcessChatJoinRequestRequest{} - _ bin.Decoder = &ProcessChatJoinRequestRequest{} - _ bin.BareEncoder = &ProcessChatJoinRequestRequest{} - _ bin.BareDecoder = &ProcessChatJoinRequestRequest{} -) - -func (p *ProcessChatJoinRequestRequest) Zero() bool { - if p == nil { - return true - } - if !(p.ChatID == 0) { - return false - } - if !(p.UserID == 0) { - return false - } - if !(p.Approve == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ProcessChatJoinRequestRequest) String() string { - if p == nil { - return "ProcessChatJoinRequestRequest(nil)" - } - type Alias ProcessChatJoinRequestRequest - return fmt.Sprintf("ProcessChatJoinRequestRequest%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ProcessChatJoinRequestRequest) TypeID() uint32 { - return ProcessChatJoinRequestRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ProcessChatJoinRequestRequest) TypeName() string { - return "processChatJoinRequest" -} - -// TypeInfo returns info about TL type. -func (p *ProcessChatJoinRequestRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "processChatJoinRequest", - ID: ProcessChatJoinRequestRequestTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Approve", - SchemaName: "approve", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ProcessChatJoinRequestRequest) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode processChatJoinRequest#3be534a3 as nil") - } - b.PutID(ProcessChatJoinRequestRequestTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ProcessChatJoinRequestRequest) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode processChatJoinRequest#3be534a3 as nil") - } - b.PutInt53(p.ChatID) - b.PutInt53(p.UserID) - b.PutBool(p.Approve) - return nil -} - -// Decode implements bin.Decoder. -func (p *ProcessChatJoinRequestRequest) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode processChatJoinRequest#3be534a3 to nil") - } - if err := b.ConsumeID(ProcessChatJoinRequestRequestTypeID); err != nil { - return fmt.Errorf("unable to decode processChatJoinRequest#3be534a3: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ProcessChatJoinRequestRequest) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode processChatJoinRequest#3be534a3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequest#3be534a3: field chat_id: %w", err) - } - p.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequest#3be534a3: field user_id: %w", err) - } - p.UserID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequest#3be534a3: field approve: %w", err) - } - p.Approve = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ProcessChatJoinRequestRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode processChatJoinRequest#3be534a3 as nil") - } - b.ObjStart() - b.PutID("processChatJoinRequest") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(p.ChatID) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(p.UserID) - b.Comma() - b.FieldStart("approve") - b.PutBool(p.Approve) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ProcessChatJoinRequestRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode processChatJoinRequest#3be534a3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("processChatJoinRequest"); err != nil { - return fmt.Errorf("unable to decode processChatJoinRequest#3be534a3: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequest#3be534a3: field chat_id: %w", err) - } - p.ChatID = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequest#3be534a3: field user_id: %w", err) - } - p.UserID = value - case "approve": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequest#3be534a3: field approve: %w", err) - } - p.Approve = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (p *ProcessChatJoinRequestRequest) GetChatID() (value int64) { - if p == nil { - return - } - return p.ChatID -} - -// GetUserID returns value of UserID field. -func (p *ProcessChatJoinRequestRequest) GetUserID() (value int64) { - if p == nil { - return - } - return p.UserID -} - -// GetApprove returns value of Approve field. -func (p *ProcessChatJoinRequestRequest) GetApprove() (value bool) { - if p == nil { - return - } - return p.Approve -} - -// ProcessChatJoinRequest invokes method processChatJoinRequest#3be534a3 returning error if any. -func (c *Client) ProcessChatJoinRequest(ctx context.Context, request *ProcessChatJoinRequestRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_process_chat_join_requests_gen.go b/tdapi/tl_process_chat_join_requests_gen.go deleted file mode 100644 index 73e6fdab7..000000000 --- a/tdapi/tl_process_chat_join_requests_gen.go +++ /dev/null @@ -1,273 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ProcessChatJoinRequestsRequest represents TL type `processChatJoinRequests#3e823dce`. -type ProcessChatJoinRequestsRequest struct { - // Chat identifier - ChatID int64 - // Invite link for which to process join requests. If empty, all join requests will be - // processed. Requires administrator privileges and can_invite_users right in the chat - // for own links and owner privileges for other links - InviteLink string - // Pass true to approve all requests; pass false to decline them - Approve bool -} - -// ProcessChatJoinRequestsRequestTypeID is TL type id of ProcessChatJoinRequestsRequest. -const ProcessChatJoinRequestsRequestTypeID = 0x3e823dce - -// Ensuring interfaces in compile-time for ProcessChatJoinRequestsRequest. -var ( - _ bin.Encoder = &ProcessChatJoinRequestsRequest{} - _ bin.Decoder = &ProcessChatJoinRequestsRequest{} - _ bin.BareEncoder = &ProcessChatJoinRequestsRequest{} - _ bin.BareDecoder = &ProcessChatJoinRequestsRequest{} -) - -func (p *ProcessChatJoinRequestsRequest) Zero() bool { - if p == nil { - return true - } - if !(p.ChatID == 0) { - return false - } - if !(p.InviteLink == "") { - return false - } - if !(p.Approve == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ProcessChatJoinRequestsRequest) String() string { - if p == nil { - return "ProcessChatJoinRequestsRequest(nil)" - } - type Alias ProcessChatJoinRequestsRequest - return fmt.Sprintf("ProcessChatJoinRequestsRequest%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ProcessChatJoinRequestsRequest) TypeID() uint32 { - return ProcessChatJoinRequestsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ProcessChatJoinRequestsRequest) TypeName() string { - return "processChatJoinRequests" -} - -// TypeInfo returns info about TL type. -func (p *ProcessChatJoinRequestsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "processChatJoinRequests", - ID: ProcessChatJoinRequestsRequestTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "Approve", - SchemaName: "approve", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ProcessChatJoinRequestsRequest) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode processChatJoinRequests#3e823dce as nil") - } - b.PutID(ProcessChatJoinRequestsRequestTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ProcessChatJoinRequestsRequest) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode processChatJoinRequests#3e823dce as nil") - } - b.PutInt53(p.ChatID) - b.PutString(p.InviteLink) - b.PutBool(p.Approve) - return nil -} - -// Decode implements bin.Decoder. -func (p *ProcessChatJoinRequestsRequest) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode processChatJoinRequests#3e823dce to nil") - } - if err := b.ConsumeID(ProcessChatJoinRequestsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode processChatJoinRequests#3e823dce: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ProcessChatJoinRequestsRequest) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode processChatJoinRequests#3e823dce to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequests#3e823dce: field chat_id: %w", err) - } - p.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequests#3e823dce: field invite_link: %w", err) - } - p.InviteLink = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequests#3e823dce: field approve: %w", err) - } - p.Approve = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ProcessChatJoinRequestsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode processChatJoinRequests#3e823dce as nil") - } - b.ObjStart() - b.PutID("processChatJoinRequests") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(p.ChatID) - b.Comma() - b.FieldStart("invite_link") - b.PutString(p.InviteLink) - b.Comma() - b.FieldStart("approve") - b.PutBool(p.Approve) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ProcessChatJoinRequestsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode processChatJoinRequests#3e823dce to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("processChatJoinRequests"); err != nil { - return fmt.Errorf("unable to decode processChatJoinRequests#3e823dce: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequests#3e823dce: field chat_id: %w", err) - } - p.ChatID = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequests#3e823dce: field invite_link: %w", err) - } - p.InviteLink = value - case "approve": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode processChatJoinRequests#3e823dce: field approve: %w", err) - } - p.Approve = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (p *ProcessChatJoinRequestsRequest) GetChatID() (value int64) { - if p == nil { - return - } - return p.ChatID -} - -// GetInviteLink returns value of InviteLink field. -func (p *ProcessChatJoinRequestsRequest) GetInviteLink() (value string) { - if p == nil { - return - } - return p.InviteLink -} - -// GetApprove returns value of Approve field. -func (p *ProcessChatJoinRequestsRequest) GetApprove() (value bool) { - if p == nil { - return - } - return p.Approve -} - -// ProcessChatJoinRequests invokes method processChatJoinRequests#3e823dce returning error if any. -func (c *Client) ProcessChatJoinRequests(ctx context.Context, request *ProcessChatJoinRequestsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_process_push_notification_gen.go b/tdapi/tl_process_push_notification_gen.go deleted file mode 100644 index 8b28867c5..000000000 --- a/tdapi/tl_process_push_notification_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ProcessPushNotificationRequest represents TL type `processPushNotification#2ee3c890`. -type ProcessPushNotificationRequest struct { - // JSON-encoded push notification payload with all fields sent by the server, and "google - // sent_time" and "google.notification.sound" fields added - Payload string -} - -// ProcessPushNotificationRequestTypeID is TL type id of ProcessPushNotificationRequest. -const ProcessPushNotificationRequestTypeID = 0x2ee3c890 - -// Ensuring interfaces in compile-time for ProcessPushNotificationRequest. -var ( - _ bin.Encoder = &ProcessPushNotificationRequest{} - _ bin.Decoder = &ProcessPushNotificationRequest{} - _ bin.BareEncoder = &ProcessPushNotificationRequest{} - _ bin.BareDecoder = &ProcessPushNotificationRequest{} -) - -func (p *ProcessPushNotificationRequest) Zero() bool { - if p == nil { - return true - } - if !(p.Payload == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ProcessPushNotificationRequest) String() string { - if p == nil { - return "ProcessPushNotificationRequest(nil)" - } - type Alias ProcessPushNotificationRequest - return fmt.Sprintf("ProcessPushNotificationRequest%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ProcessPushNotificationRequest) TypeID() uint32 { - return ProcessPushNotificationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ProcessPushNotificationRequest) TypeName() string { - return "processPushNotification" -} - -// TypeInfo returns info about TL type. -func (p *ProcessPushNotificationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "processPushNotification", - ID: ProcessPushNotificationRequestTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Payload", - SchemaName: "payload", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ProcessPushNotificationRequest) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode processPushNotification#2ee3c890 as nil") - } - b.PutID(ProcessPushNotificationRequestTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ProcessPushNotificationRequest) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode processPushNotification#2ee3c890 as nil") - } - b.PutString(p.Payload) - return nil -} - -// Decode implements bin.Decoder. -func (p *ProcessPushNotificationRequest) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode processPushNotification#2ee3c890 to nil") - } - if err := b.ConsumeID(ProcessPushNotificationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode processPushNotification#2ee3c890: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ProcessPushNotificationRequest) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode processPushNotification#2ee3c890 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode processPushNotification#2ee3c890: field payload: %w", err) - } - p.Payload = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ProcessPushNotificationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode processPushNotification#2ee3c890 as nil") - } - b.ObjStart() - b.PutID("processPushNotification") - b.Comma() - b.FieldStart("payload") - b.PutString(p.Payload) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ProcessPushNotificationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode processPushNotification#2ee3c890 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("processPushNotification"); err != nil { - return fmt.Errorf("unable to decode processPushNotification#2ee3c890: %w", err) - } - case "payload": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode processPushNotification#2ee3c890: field payload: %w", err) - } - p.Payload = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPayload returns value of Payload field. -func (p *ProcessPushNotificationRequest) GetPayload() (value string) { - if p == nil { - return - } - return p.Payload -} - -// ProcessPushNotification invokes method processPushNotification#2ee3c890 returning error if any. -func (c *Client) ProcessPushNotification(ctx context.Context, payload string) error { - var ok Ok - - request := &ProcessPushNotificationRequest{ - Payload: payload, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_product_info_gen.go b/tdapi/tl_product_info_gen.go deleted file mode 100644 index 65326acaa..000000000 --- a/tdapi/tl_product_info_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ProductInfo represents TL type `productInfo#87e47ca4`. -type ProductInfo struct { - // Product title - Title string - // Contains information about a product that can be paid with invoice - Description FormattedText - // Product photo; may be null - Photo Photo -} - -// ProductInfoTypeID is TL type id of ProductInfo. -const ProductInfoTypeID = 0x87e47ca4 - -// Ensuring interfaces in compile-time for ProductInfo. -var ( - _ bin.Encoder = &ProductInfo{} - _ bin.Decoder = &ProductInfo{} - _ bin.BareEncoder = &ProductInfo{} - _ bin.BareDecoder = &ProductInfo{} -) - -func (p *ProductInfo) Zero() bool { - if p == nil { - return true - } - if !(p.Title == "") { - return false - } - if !(p.Description.Zero()) { - return false - } - if !(p.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ProductInfo) String() string { - if p == nil { - return "ProductInfo(nil)" - } - type Alias ProductInfo - return fmt.Sprintf("ProductInfo%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ProductInfo) TypeID() uint32 { - return ProductInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ProductInfo) TypeName() string { - return "productInfo" -} - -// TypeInfo returns info about TL type. -func (p *ProductInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "productInfo", - ID: ProductInfoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ProductInfo) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode productInfo#87e47ca4 as nil") - } - b.PutID(ProductInfoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ProductInfo) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode productInfo#87e47ca4 as nil") - } - b.PutString(p.Title) - if err := p.Description.Encode(b); err != nil { - return fmt.Errorf("unable to encode productInfo#87e47ca4: field description: %w", err) - } - if err := p.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode productInfo#87e47ca4: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *ProductInfo) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode productInfo#87e47ca4 to nil") - } - if err := b.ConsumeID(ProductInfoTypeID); err != nil { - return fmt.Errorf("unable to decode productInfo#87e47ca4: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ProductInfo) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode productInfo#87e47ca4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode productInfo#87e47ca4: field title: %w", err) - } - p.Title = value - } - { - if err := p.Description.Decode(b); err != nil { - return fmt.Errorf("unable to decode productInfo#87e47ca4: field description: %w", err) - } - } - { - if err := p.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode productInfo#87e47ca4: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ProductInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode productInfo#87e47ca4 as nil") - } - b.ObjStart() - b.PutID("productInfo") - b.Comma() - b.FieldStart("title") - b.PutString(p.Title) - b.Comma() - b.FieldStart("description") - if err := p.Description.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode productInfo#87e47ca4: field description: %w", err) - } - b.Comma() - b.FieldStart("photo") - if err := p.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode productInfo#87e47ca4: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ProductInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode productInfo#87e47ca4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("productInfo"); err != nil { - return fmt.Errorf("unable to decode productInfo#87e47ca4: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode productInfo#87e47ca4: field title: %w", err) - } - p.Title = value - case "description": - if err := p.Description.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode productInfo#87e47ca4: field description: %w", err) - } - case "photo": - if err := p.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode productInfo#87e47ca4: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (p *ProductInfo) GetTitle() (value string) { - if p == nil { - return - } - return p.Title -} - -// GetDescription returns value of Description field. -func (p *ProductInfo) GetDescription() (value FormattedText) { - if p == nil { - return - } - return p.Description -} - -// GetPhoto returns value of Photo field. -func (p *ProductInfo) GetPhoto() (value Photo) { - if p == nil { - return - } - return p.Photo -} diff --git a/tdapi/tl_profile_accent_color_gen.go b/tdapi/tl_profile_accent_color_gen.go deleted file mode 100644 index 3ed2d11eb..000000000 --- a/tdapi/tl_profile_accent_color_gen.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ProfileAccentColor represents TL type `profileAccentColor#213d8295`. -type ProfileAccentColor struct { - // Profile accent color identifier - ID int32 - // Accent colors expected to be used in light themes - LightThemeColors ProfileAccentColors - // Accent colors expected to be used in dark themes - DarkThemeColors ProfileAccentColors - // The minimum chat boost level required to use the color in a supergroup chat - MinSupergroupChatBoostLevel int32 - // The minimum chat boost level required to use the color in a channel chat - MinChannelChatBoostLevel int32 -} - -// ProfileAccentColorTypeID is TL type id of ProfileAccentColor. -const ProfileAccentColorTypeID = 0x213d8295 - -// Ensuring interfaces in compile-time for ProfileAccentColor. -var ( - _ bin.Encoder = &ProfileAccentColor{} - _ bin.Decoder = &ProfileAccentColor{} - _ bin.BareEncoder = &ProfileAccentColor{} - _ bin.BareDecoder = &ProfileAccentColor{} -) - -func (p *ProfileAccentColor) Zero() bool { - if p == nil { - return true - } - if !(p.ID == 0) { - return false - } - if !(p.LightThemeColors.Zero()) { - return false - } - if !(p.DarkThemeColors.Zero()) { - return false - } - if !(p.MinSupergroupChatBoostLevel == 0) { - return false - } - if !(p.MinChannelChatBoostLevel == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ProfileAccentColor) String() string { - if p == nil { - return "ProfileAccentColor(nil)" - } - type Alias ProfileAccentColor - return fmt.Sprintf("ProfileAccentColor%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ProfileAccentColor) TypeID() uint32 { - return ProfileAccentColorTypeID -} - -// TypeName returns name of type in TL schema. -func (*ProfileAccentColor) TypeName() string { - return "profileAccentColor" -} - -// TypeInfo returns info about TL type. -func (p *ProfileAccentColor) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "profileAccentColor", - ID: ProfileAccentColorTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "LightThemeColors", - SchemaName: "light_theme_colors", - }, - { - Name: "DarkThemeColors", - SchemaName: "dark_theme_colors", - }, - { - Name: "MinSupergroupChatBoostLevel", - SchemaName: "min_supergroup_chat_boost_level", - }, - { - Name: "MinChannelChatBoostLevel", - SchemaName: "min_channel_chat_boost_level", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ProfileAccentColor) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode profileAccentColor#213d8295 as nil") - } - b.PutID(ProfileAccentColorTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ProfileAccentColor) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode profileAccentColor#213d8295 as nil") - } - b.PutInt32(p.ID) - if err := p.LightThemeColors.Encode(b); err != nil { - return fmt.Errorf("unable to encode profileAccentColor#213d8295: field light_theme_colors: %w", err) - } - if err := p.DarkThemeColors.Encode(b); err != nil { - return fmt.Errorf("unable to encode profileAccentColor#213d8295: field dark_theme_colors: %w", err) - } - b.PutInt32(p.MinSupergroupChatBoostLevel) - b.PutInt32(p.MinChannelChatBoostLevel) - return nil -} - -// Decode implements bin.Decoder. -func (p *ProfileAccentColor) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode profileAccentColor#213d8295 to nil") - } - if err := b.ConsumeID(ProfileAccentColorTypeID); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ProfileAccentColor) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode profileAccentColor#213d8295 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: field id: %w", err) - } - p.ID = value - } - { - if err := p.LightThemeColors.Decode(b); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: field light_theme_colors: %w", err) - } - } - { - if err := p.DarkThemeColors.Decode(b); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: field dark_theme_colors: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: field min_supergroup_chat_boost_level: %w", err) - } - p.MinSupergroupChatBoostLevel = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: field min_channel_chat_boost_level: %w", err) - } - p.MinChannelChatBoostLevel = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ProfileAccentColor) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode profileAccentColor#213d8295 as nil") - } - b.ObjStart() - b.PutID("profileAccentColor") - b.Comma() - b.FieldStart("id") - b.PutInt32(p.ID) - b.Comma() - b.FieldStart("light_theme_colors") - if err := p.LightThemeColors.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode profileAccentColor#213d8295: field light_theme_colors: %w", err) - } - b.Comma() - b.FieldStart("dark_theme_colors") - if err := p.DarkThemeColors.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode profileAccentColor#213d8295: field dark_theme_colors: %w", err) - } - b.Comma() - b.FieldStart("min_supergroup_chat_boost_level") - b.PutInt32(p.MinSupergroupChatBoostLevel) - b.Comma() - b.FieldStart("min_channel_chat_boost_level") - b.PutInt32(p.MinChannelChatBoostLevel) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ProfileAccentColor) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode profileAccentColor#213d8295 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("profileAccentColor"); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: field id: %w", err) - } - p.ID = value - case "light_theme_colors": - if err := p.LightThemeColors.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: field light_theme_colors: %w", err) - } - case "dark_theme_colors": - if err := p.DarkThemeColors.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: field dark_theme_colors: %w", err) - } - case "min_supergroup_chat_boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: field min_supergroup_chat_boost_level: %w", err) - } - p.MinSupergroupChatBoostLevel = value - case "min_channel_chat_boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColor#213d8295: field min_channel_chat_boost_level: %w", err) - } - p.MinChannelChatBoostLevel = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (p *ProfileAccentColor) GetID() (value int32) { - if p == nil { - return - } - return p.ID -} - -// GetLightThemeColors returns value of LightThemeColors field. -func (p *ProfileAccentColor) GetLightThemeColors() (value ProfileAccentColors) { - if p == nil { - return - } - return p.LightThemeColors -} - -// GetDarkThemeColors returns value of DarkThemeColors field. -func (p *ProfileAccentColor) GetDarkThemeColors() (value ProfileAccentColors) { - if p == nil { - return - } - return p.DarkThemeColors -} - -// GetMinSupergroupChatBoostLevel returns value of MinSupergroupChatBoostLevel field. -func (p *ProfileAccentColor) GetMinSupergroupChatBoostLevel() (value int32) { - if p == nil { - return - } - return p.MinSupergroupChatBoostLevel -} - -// GetMinChannelChatBoostLevel returns value of MinChannelChatBoostLevel field. -func (p *ProfileAccentColor) GetMinChannelChatBoostLevel() (value int32) { - if p == nil { - return - } - return p.MinChannelChatBoostLevel -} diff --git a/tdapi/tl_profile_accent_colors_gen.go b/tdapi/tl_profile_accent_colors_gen.go deleted file mode 100644 index d0e860303..000000000 --- a/tdapi/tl_profile_accent_colors_gen.go +++ /dev/null @@ -1,336 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ProfileAccentColors represents TL type `profileAccentColors#218e9367`. -type ProfileAccentColors struct { - // The list of 1-2 colors in RGB format, describing the colors, as expected to be shown - // in the color palette settings - PaletteColors []int32 - // The list of 1-2 colors in RGB format, describing the colors, as expected to be used - // for the profile photo background - BackgroundColors []int32 - // The list of 2 colors in RGB format, describing the colors of the gradient to be used - // for the unread active story indicator around profile photo - StoryColors []int32 -} - -// ProfileAccentColorsTypeID is TL type id of ProfileAccentColors. -const ProfileAccentColorsTypeID = 0x218e9367 - -// Ensuring interfaces in compile-time for ProfileAccentColors. -var ( - _ bin.Encoder = &ProfileAccentColors{} - _ bin.Decoder = &ProfileAccentColors{} - _ bin.BareEncoder = &ProfileAccentColors{} - _ bin.BareDecoder = &ProfileAccentColors{} -) - -func (p *ProfileAccentColors) Zero() bool { - if p == nil { - return true - } - if !(p.PaletteColors == nil) { - return false - } - if !(p.BackgroundColors == nil) { - return false - } - if !(p.StoryColors == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ProfileAccentColors) String() string { - if p == nil { - return "ProfileAccentColors(nil)" - } - type Alias ProfileAccentColors - return fmt.Sprintf("ProfileAccentColors%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ProfileAccentColors) TypeID() uint32 { - return ProfileAccentColorsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ProfileAccentColors) TypeName() string { - return "profileAccentColors" -} - -// TypeInfo returns info about TL type. -func (p *ProfileAccentColors) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "profileAccentColors", - ID: ProfileAccentColorsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PaletteColors", - SchemaName: "palette_colors", - }, - { - Name: "BackgroundColors", - SchemaName: "background_colors", - }, - { - Name: "StoryColors", - SchemaName: "story_colors", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ProfileAccentColors) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode profileAccentColors#218e9367 as nil") - } - b.PutID(ProfileAccentColorsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ProfileAccentColors) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode profileAccentColors#218e9367 as nil") - } - b.PutInt(len(p.PaletteColors)) - for _, v := range p.PaletteColors { - b.PutInt32(v) - } - b.PutInt(len(p.BackgroundColors)) - for _, v := range p.BackgroundColors { - b.PutInt32(v) - } - b.PutInt(len(p.StoryColors)) - for _, v := range p.StoryColors { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *ProfileAccentColors) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode profileAccentColors#218e9367 to nil") - } - if err := b.ConsumeID(ProfileAccentColorsTypeID); err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ProfileAccentColors) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode profileAccentColors#218e9367 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field palette_colors: %w", err) - } - - if headerLen > 0 { - p.PaletteColors = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field palette_colors: %w", err) - } - p.PaletteColors = append(p.PaletteColors, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field background_colors: %w", err) - } - - if headerLen > 0 { - p.BackgroundColors = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field background_colors: %w", err) - } - p.BackgroundColors = append(p.BackgroundColors, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field story_colors: %w", err) - } - - if headerLen > 0 { - p.StoryColors = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field story_colors: %w", err) - } - p.StoryColors = append(p.StoryColors, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ProfileAccentColors) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode profileAccentColors#218e9367 as nil") - } - b.ObjStart() - b.PutID("profileAccentColors") - b.Comma() - b.FieldStart("palette_colors") - b.ArrStart() - for _, v := range p.PaletteColors { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("background_colors") - b.ArrStart() - for _, v := range p.BackgroundColors { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("story_colors") - b.ArrStart() - for _, v := range p.StoryColors { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ProfileAccentColors) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode profileAccentColors#218e9367 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("profileAccentColors"); err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: %w", err) - } - case "palette_colors": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field palette_colors: %w", err) - } - p.PaletteColors = append(p.PaletteColors, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field palette_colors: %w", err) - } - case "background_colors": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field background_colors: %w", err) - } - p.BackgroundColors = append(p.BackgroundColors, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field background_colors: %w", err) - } - case "story_colors": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field story_colors: %w", err) - } - p.StoryColors = append(p.StoryColors, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode profileAccentColors#218e9367: field story_colors: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPaletteColors returns value of PaletteColors field. -func (p *ProfileAccentColors) GetPaletteColors() (value []int32) { - if p == nil { - return - } - return p.PaletteColors -} - -// GetBackgroundColors returns value of BackgroundColors field. -func (p *ProfileAccentColors) GetBackgroundColors() (value []int32) { - if p == nil { - return - } - return p.BackgroundColors -} - -// GetStoryColors returns value of StoryColors field. -func (p *ProfileAccentColors) GetStoryColors() (value []int32) { - if p == nil { - return - } - return p.StoryColors -} diff --git a/tdapi/tl_profile_photo_gen.go b/tdapi/tl_profile_photo_gen.go deleted file mode 100644 index a85235272..000000000 --- a/tdapi/tl_profile_photo_gen.go +++ /dev/null @@ -1,366 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ProfilePhoto represents TL type `profilePhoto#c2dc3c5e`. -type ProfilePhoto struct { - // Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of user - // profile photos - ID int64 - // A small (160x160) user profile photo. The file can be downloaded only before the photo - // is changed - Small File - // A big (640x640) user profile photo. The file can be downloaded only before the photo - // is changed - Big File - // User profile photo minithumbnail; may be null - Minithumbnail Minithumbnail - // True, if the photo has animated variant - HasAnimation bool - // True, if the photo is visible only for the current user - IsPersonal bool -} - -// ProfilePhotoTypeID is TL type id of ProfilePhoto. -const ProfilePhotoTypeID = 0xc2dc3c5e - -// Ensuring interfaces in compile-time for ProfilePhoto. -var ( - _ bin.Encoder = &ProfilePhoto{} - _ bin.Decoder = &ProfilePhoto{} - _ bin.BareEncoder = &ProfilePhoto{} - _ bin.BareDecoder = &ProfilePhoto{} -) - -func (p *ProfilePhoto) Zero() bool { - if p == nil { - return true - } - if !(p.ID == 0) { - return false - } - if !(p.Small.Zero()) { - return false - } - if !(p.Big.Zero()) { - return false - } - if !(p.Minithumbnail.Zero()) { - return false - } - if !(p.HasAnimation == false) { - return false - } - if !(p.IsPersonal == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ProfilePhoto) String() string { - if p == nil { - return "ProfilePhoto(nil)" - } - type Alias ProfilePhoto - return fmt.Sprintf("ProfilePhoto%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ProfilePhoto) TypeID() uint32 { - return ProfilePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ProfilePhoto) TypeName() string { - return "profilePhoto" -} - -// TypeInfo returns info about TL type. -func (p *ProfilePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "profilePhoto", - ID: ProfilePhotoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Small", - SchemaName: "small", - }, - { - Name: "Big", - SchemaName: "big", - }, - { - Name: "Minithumbnail", - SchemaName: "minithumbnail", - }, - { - Name: "HasAnimation", - SchemaName: "has_animation", - }, - { - Name: "IsPersonal", - SchemaName: "is_personal", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ProfilePhoto) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode profilePhoto#c2dc3c5e as nil") - } - b.PutID(ProfilePhotoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ProfilePhoto) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode profilePhoto#c2dc3c5e as nil") - } - b.PutLong(p.ID) - if err := p.Small.Encode(b); err != nil { - return fmt.Errorf("unable to encode profilePhoto#c2dc3c5e: field small: %w", err) - } - if err := p.Big.Encode(b); err != nil { - return fmt.Errorf("unable to encode profilePhoto#c2dc3c5e: field big: %w", err) - } - if err := p.Minithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode profilePhoto#c2dc3c5e: field minithumbnail: %w", err) - } - b.PutBool(p.HasAnimation) - b.PutBool(p.IsPersonal) - return nil -} - -// Decode implements bin.Decoder. -func (p *ProfilePhoto) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode profilePhoto#c2dc3c5e to nil") - } - if err := b.ConsumeID(ProfilePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ProfilePhoto) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode profilePhoto#c2dc3c5e to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field id: %w", err) - } - p.ID = value - } - { - if err := p.Small.Decode(b); err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field small: %w", err) - } - } - { - if err := p.Big.Decode(b); err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field big: %w", err) - } - } - { - if err := p.Minithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field minithumbnail: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field has_animation: %w", err) - } - p.HasAnimation = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field is_personal: %w", err) - } - p.IsPersonal = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ProfilePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode profilePhoto#c2dc3c5e as nil") - } - b.ObjStart() - b.PutID("profilePhoto") - b.Comma() - b.FieldStart("id") - b.PutLong(p.ID) - b.Comma() - b.FieldStart("small") - if err := p.Small.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode profilePhoto#c2dc3c5e: field small: %w", err) - } - b.Comma() - b.FieldStart("big") - if err := p.Big.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode profilePhoto#c2dc3c5e: field big: %w", err) - } - b.Comma() - b.FieldStart("minithumbnail") - if err := p.Minithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode profilePhoto#c2dc3c5e: field minithumbnail: %w", err) - } - b.Comma() - b.FieldStart("has_animation") - b.PutBool(p.HasAnimation) - b.Comma() - b.FieldStart("is_personal") - b.PutBool(p.IsPersonal) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ProfilePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode profilePhoto#c2dc3c5e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("profilePhoto"); err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field id: %w", err) - } - p.ID = value - case "small": - if err := p.Small.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field small: %w", err) - } - case "big": - if err := p.Big.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field big: %w", err) - } - case "minithumbnail": - if err := p.Minithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field minithumbnail: %w", err) - } - case "has_animation": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field has_animation: %w", err) - } - p.HasAnimation = value - case "is_personal": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode profilePhoto#c2dc3c5e: field is_personal: %w", err) - } - p.IsPersonal = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (p *ProfilePhoto) GetID() (value int64) { - if p == nil { - return - } - return p.ID -} - -// GetSmall returns value of Small field. -func (p *ProfilePhoto) GetSmall() (value File) { - if p == nil { - return - } - return p.Small -} - -// GetBig returns value of Big field. -func (p *ProfilePhoto) GetBig() (value File) { - if p == nil { - return - } - return p.Big -} - -// GetMinithumbnail returns value of Minithumbnail field. -func (p *ProfilePhoto) GetMinithumbnail() (value Minithumbnail) { - if p == nil { - return - } - return p.Minithumbnail -} - -// GetHasAnimation returns value of HasAnimation field. -func (p *ProfilePhoto) GetHasAnimation() (value bool) { - if p == nil { - return - } - return p.HasAnimation -} - -// GetIsPersonal returns value of IsPersonal field. -func (p *ProfilePhoto) GetIsPersonal() (value bool) { - if p == nil { - return - } - return p.IsPersonal -} diff --git a/tdapi/tl_proxies_gen.go b/tdapi/tl_proxies_gen.go deleted file mode 100644 index 3328d67bc..000000000 --- a/tdapi/tl_proxies_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Proxies represents TL type `proxies#5ee27a86`. -type Proxies struct { - // List of proxy servers - Proxies []Proxy -} - -// ProxiesTypeID is TL type id of Proxies. -const ProxiesTypeID = 0x5ee27a86 - -// Ensuring interfaces in compile-time for Proxies. -var ( - _ bin.Encoder = &Proxies{} - _ bin.Decoder = &Proxies{} - _ bin.BareEncoder = &Proxies{} - _ bin.BareDecoder = &Proxies{} -) - -func (p *Proxies) Zero() bool { - if p == nil { - return true - } - if !(p.Proxies == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *Proxies) String() string { - if p == nil { - return "Proxies(nil)" - } - type Alias Proxies - return fmt.Sprintf("Proxies%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Proxies) TypeID() uint32 { - return ProxiesTypeID -} - -// TypeName returns name of type in TL schema. -func (*Proxies) TypeName() string { - return "proxies" -} - -// TypeInfo returns info about TL type. -func (p *Proxies) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "proxies", - ID: ProxiesTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Proxies", - SchemaName: "proxies", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *Proxies) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode proxies#5ee27a86 as nil") - } - b.PutID(ProxiesTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *Proxies) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode proxies#5ee27a86 as nil") - } - b.PutInt(len(p.Proxies)) - for idx, v := range p.Proxies { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare proxies#5ee27a86: field proxies element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (p *Proxies) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode proxies#5ee27a86 to nil") - } - if err := b.ConsumeID(ProxiesTypeID); err != nil { - return fmt.Errorf("unable to decode proxies#5ee27a86: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *Proxies) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode proxies#5ee27a86 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode proxies#5ee27a86: field proxies: %w", err) - } - - if headerLen > 0 { - p.Proxies = make([]Proxy, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Proxy - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare proxies#5ee27a86: field proxies: %w", err) - } - p.Proxies = append(p.Proxies, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *Proxies) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode proxies#5ee27a86 as nil") - } - b.ObjStart() - b.PutID("proxies") - b.Comma() - b.FieldStart("proxies") - b.ArrStart() - for idx, v := range p.Proxies { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode proxies#5ee27a86: field proxies element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *Proxies) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode proxies#5ee27a86 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("proxies"); err != nil { - return fmt.Errorf("unable to decode proxies#5ee27a86: %w", err) - } - case "proxies": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Proxy - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode proxies#5ee27a86: field proxies: %w", err) - } - p.Proxies = append(p.Proxies, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode proxies#5ee27a86: field proxies: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetProxies returns value of Proxies field. -func (p *Proxies) GetProxies() (value []Proxy) { - if p == nil { - return - } - return p.Proxies -} diff --git a/tdapi/tl_proxy_gen.go b/tdapi/tl_proxy_gen.go deleted file mode 100644 index 31963ff4e..000000000 --- a/tdapi/tl_proxy_gen.go +++ /dev/null @@ -1,373 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Proxy represents TL type `proxy#baf7b73`. -type Proxy struct { - // Unique identifier of the proxy - ID int32 - // Proxy server domain or IP address - Server string - // Proxy server port - Port int32 - // Point in time (Unix timestamp) when the proxy was last used; 0 if never - LastUsedDate int32 - // True, if the proxy is enabled now - IsEnabled bool - // Type of the proxy - Type ProxyTypeClass -} - -// ProxyTypeID is TL type id of Proxy. -const ProxyTypeID = 0xbaf7b73 - -// Ensuring interfaces in compile-time for Proxy. -var ( - _ bin.Encoder = &Proxy{} - _ bin.Decoder = &Proxy{} - _ bin.BareEncoder = &Proxy{} - _ bin.BareDecoder = &Proxy{} -) - -func (p *Proxy) Zero() bool { - if p == nil { - return true - } - if !(p.ID == 0) { - return false - } - if !(p.Server == "") { - return false - } - if !(p.Port == 0) { - return false - } - if !(p.LastUsedDate == 0) { - return false - } - if !(p.IsEnabled == false) { - return false - } - if !(p.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *Proxy) String() string { - if p == nil { - return "Proxy(nil)" - } - type Alias Proxy - return fmt.Sprintf("Proxy%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Proxy) TypeID() uint32 { - return ProxyTypeID -} - -// TypeName returns name of type in TL schema. -func (*Proxy) TypeName() string { - return "proxy" -} - -// TypeInfo returns info about TL type. -func (p *Proxy) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "proxy", - ID: ProxyTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Server", - SchemaName: "server", - }, - { - Name: "Port", - SchemaName: "port", - }, - { - Name: "LastUsedDate", - SchemaName: "last_used_date", - }, - { - Name: "IsEnabled", - SchemaName: "is_enabled", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *Proxy) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode proxy#baf7b73 as nil") - } - b.PutID(ProxyTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *Proxy) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode proxy#baf7b73 as nil") - } - b.PutInt32(p.ID) - b.PutString(p.Server) - b.PutInt32(p.Port) - b.PutInt32(p.LastUsedDate) - b.PutBool(p.IsEnabled) - if p.Type == nil { - return fmt.Errorf("unable to encode proxy#baf7b73: field type is nil") - } - if err := p.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode proxy#baf7b73: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *Proxy) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode proxy#baf7b73 to nil") - } - if err := b.ConsumeID(ProxyTypeID); err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *Proxy) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode proxy#baf7b73 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field id: %w", err) - } - p.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field server: %w", err) - } - p.Server = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field port: %w", err) - } - p.Port = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field last_used_date: %w", err) - } - p.LastUsedDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field is_enabled: %w", err) - } - p.IsEnabled = value - } - { - value, err := DecodeProxyType(b) - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field type: %w", err) - } - p.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *Proxy) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode proxy#baf7b73 as nil") - } - b.ObjStart() - b.PutID("proxy") - b.Comma() - b.FieldStart("id") - b.PutInt32(p.ID) - b.Comma() - b.FieldStart("server") - b.PutString(p.Server) - b.Comma() - b.FieldStart("port") - b.PutInt32(p.Port) - b.Comma() - b.FieldStart("last_used_date") - b.PutInt32(p.LastUsedDate) - b.Comma() - b.FieldStart("is_enabled") - b.PutBool(p.IsEnabled) - b.Comma() - b.FieldStart("type") - if p.Type == nil { - return fmt.Errorf("unable to encode proxy#baf7b73: field type is nil") - } - if err := p.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode proxy#baf7b73: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *Proxy) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode proxy#baf7b73 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("proxy"); err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field id: %w", err) - } - p.ID = value - case "server": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field server: %w", err) - } - p.Server = value - case "port": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field port: %w", err) - } - p.Port = value - case "last_used_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field last_used_date: %w", err) - } - p.LastUsedDate = value - case "is_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field is_enabled: %w", err) - } - p.IsEnabled = value - case "type": - value, err := DecodeTDLibJSONProxyType(b) - if err != nil { - return fmt.Errorf("unable to decode proxy#baf7b73: field type: %w", err) - } - p.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (p *Proxy) GetID() (value int32) { - if p == nil { - return - } - return p.ID -} - -// GetServer returns value of Server field. -func (p *Proxy) GetServer() (value string) { - if p == nil { - return - } - return p.Server -} - -// GetPort returns value of Port field. -func (p *Proxy) GetPort() (value int32) { - if p == nil { - return - } - return p.Port -} - -// GetLastUsedDate returns value of LastUsedDate field. -func (p *Proxy) GetLastUsedDate() (value int32) { - if p == nil { - return - } - return p.LastUsedDate -} - -// GetIsEnabled returns value of IsEnabled field. -func (p *Proxy) GetIsEnabled() (value bool) { - if p == nil { - return - } - return p.IsEnabled -} - -// GetType returns value of Type field. -func (p *Proxy) GetType() (value ProxyTypeClass) { - if p == nil { - return - } - return p.Type -} diff --git a/tdapi/tl_proxy_type_gen.go b/tdapi/tl_proxy_type_gen.go deleted file mode 100644 index a602057a3..000000000 --- a/tdapi/tl_proxy_type_gen.go +++ /dev/null @@ -1,785 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ProxyTypeSocks5 represents TL type `proxyTypeSocks5#caf342b3`. -type ProxyTypeSocks5 struct { - // Username for logging in; may be empty - Username string - // Password for logging in; may be empty - Password string -} - -// ProxyTypeSocks5TypeID is TL type id of ProxyTypeSocks5. -const ProxyTypeSocks5TypeID = 0xcaf342b3 - -// construct implements constructor of ProxyTypeClass. -func (p ProxyTypeSocks5) construct() ProxyTypeClass { return &p } - -// Ensuring interfaces in compile-time for ProxyTypeSocks5. -var ( - _ bin.Encoder = &ProxyTypeSocks5{} - _ bin.Decoder = &ProxyTypeSocks5{} - _ bin.BareEncoder = &ProxyTypeSocks5{} - _ bin.BareDecoder = &ProxyTypeSocks5{} - - _ ProxyTypeClass = &ProxyTypeSocks5{} -) - -func (p *ProxyTypeSocks5) Zero() bool { - if p == nil { - return true - } - if !(p.Username == "") { - return false - } - if !(p.Password == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ProxyTypeSocks5) String() string { - if p == nil { - return "ProxyTypeSocks5(nil)" - } - type Alias ProxyTypeSocks5 - return fmt.Sprintf("ProxyTypeSocks5%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ProxyTypeSocks5) TypeID() uint32 { - return ProxyTypeSocks5TypeID -} - -// TypeName returns name of type in TL schema. -func (*ProxyTypeSocks5) TypeName() string { - return "proxyTypeSocks5" -} - -// TypeInfo returns info about TL type. -func (p *ProxyTypeSocks5) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "proxyTypeSocks5", - ID: ProxyTypeSocks5TypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Username", - SchemaName: "username", - }, - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ProxyTypeSocks5) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode proxyTypeSocks5#caf342b3 as nil") - } - b.PutID(ProxyTypeSocks5TypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ProxyTypeSocks5) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode proxyTypeSocks5#caf342b3 as nil") - } - b.PutString(p.Username) - b.PutString(p.Password) - return nil -} - -// Decode implements bin.Decoder. -func (p *ProxyTypeSocks5) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode proxyTypeSocks5#caf342b3 to nil") - } - if err := b.ConsumeID(ProxyTypeSocks5TypeID); err != nil { - return fmt.Errorf("unable to decode proxyTypeSocks5#caf342b3: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ProxyTypeSocks5) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode proxyTypeSocks5#caf342b3 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeSocks5#caf342b3: field username: %w", err) - } - p.Username = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeSocks5#caf342b3: field password: %w", err) - } - p.Password = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ProxyTypeSocks5) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode proxyTypeSocks5#caf342b3 as nil") - } - b.ObjStart() - b.PutID("proxyTypeSocks5") - b.Comma() - b.FieldStart("username") - b.PutString(p.Username) - b.Comma() - b.FieldStart("password") - b.PutString(p.Password) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ProxyTypeSocks5) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode proxyTypeSocks5#caf342b3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("proxyTypeSocks5"); err != nil { - return fmt.Errorf("unable to decode proxyTypeSocks5#caf342b3: %w", err) - } - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeSocks5#caf342b3: field username: %w", err) - } - p.Username = value - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeSocks5#caf342b3: field password: %w", err) - } - p.Password = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUsername returns value of Username field. -func (p *ProxyTypeSocks5) GetUsername() (value string) { - if p == nil { - return - } - return p.Username -} - -// GetPassword returns value of Password field. -func (p *ProxyTypeSocks5) GetPassword() (value string) { - if p == nil { - return - } - return p.Password -} - -// ProxyTypeHTTP represents TL type `proxyTypeHttp#a3c7c777`. -type ProxyTypeHTTP struct { - // Username for logging in; may be empty - Username string - // Password for logging in; may be empty - Password string - // Pass true if the proxy supports only HTTP requests and doesn't support transparent TCP - // connections via HTTP CONNECT method - HTTPOnly bool -} - -// ProxyTypeHTTPTypeID is TL type id of ProxyTypeHTTP. -const ProxyTypeHTTPTypeID = 0xa3c7c777 - -// construct implements constructor of ProxyTypeClass. -func (p ProxyTypeHTTP) construct() ProxyTypeClass { return &p } - -// Ensuring interfaces in compile-time for ProxyTypeHTTP. -var ( - _ bin.Encoder = &ProxyTypeHTTP{} - _ bin.Decoder = &ProxyTypeHTTP{} - _ bin.BareEncoder = &ProxyTypeHTTP{} - _ bin.BareDecoder = &ProxyTypeHTTP{} - - _ ProxyTypeClass = &ProxyTypeHTTP{} -) - -func (p *ProxyTypeHTTP) Zero() bool { - if p == nil { - return true - } - if !(p.Username == "") { - return false - } - if !(p.Password == "") { - return false - } - if !(p.HTTPOnly == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ProxyTypeHTTP) String() string { - if p == nil { - return "ProxyTypeHTTP(nil)" - } - type Alias ProxyTypeHTTP - return fmt.Sprintf("ProxyTypeHTTP%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ProxyTypeHTTP) TypeID() uint32 { - return ProxyTypeHTTPTypeID -} - -// TypeName returns name of type in TL schema. -func (*ProxyTypeHTTP) TypeName() string { - return "proxyTypeHttp" -} - -// TypeInfo returns info about TL type. -func (p *ProxyTypeHTTP) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "proxyTypeHttp", - ID: ProxyTypeHTTPTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Username", - SchemaName: "username", - }, - { - Name: "Password", - SchemaName: "password", - }, - { - Name: "HTTPOnly", - SchemaName: "http_only", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ProxyTypeHTTP) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode proxyTypeHttp#a3c7c777 as nil") - } - b.PutID(ProxyTypeHTTPTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ProxyTypeHTTP) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode proxyTypeHttp#a3c7c777 as nil") - } - b.PutString(p.Username) - b.PutString(p.Password) - b.PutBool(p.HTTPOnly) - return nil -} - -// Decode implements bin.Decoder. -func (p *ProxyTypeHTTP) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode proxyTypeHttp#a3c7c777 to nil") - } - if err := b.ConsumeID(ProxyTypeHTTPTypeID); err != nil { - return fmt.Errorf("unable to decode proxyTypeHttp#a3c7c777: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ProxyTypeHTTP) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode proxyTypeHttp#a3c7c777 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeHttp#a3c7c777: field username: %w", err) - } - p.Username = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeHttp#a3c7c777: field password: %w", err) - } - p.Password = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeHttp#a3c7c777: field http_only: %w", err) - } - p.HTTPOnly = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ProxyTypeHTTP) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode proxyTypeHttp#a3c7c777 as nil") - } - b.ObjStart() - b.PutID("proxyTypeHttp") - b.Comma() - b.FieldStart("username") - b.PutString(p.Username) - b.Comma() - b.FieldStart("password") - b.PutString(p.Password) - b.Comma() - b.FieldStart("http_only") - b.PutBool(p.HTTPOnly) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ProxyTypeHTTP) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode proxyTypeHttp#a3c7c777 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("proxyTypeHttp"); err != nil { - return fmt.Errorf("unable to decode proxyTypeHttp#a3c7c777: %w", err) - } - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeHttp#a3c7c777: field username: %w", err) - } - p.Username = value - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeHttp#a3c7c777: field password: %w", err) - } - p.Password = value - case "http_only": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeHttp#a3c7c777: field http_only: %w", err) - } - p.HTTPOnly = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUsername returns value of Username field. -func (p *ProxyTypeHTTP) GetUsername() (value string) { - if p == nil { - return - } - return p.Username -} - -// GetPassword returns value of Password field. -func (p *ProxyTypeHTTP) GetPassword() (value string) { - if p == nil { - return - } - return p.Password -} - -// GetHTTPOnly returns value of HTTPOnly field. -func (p *ProxyTypeHTTP) GetHTTPOnly() (value bool) { - if p == nil { - return - } - return p.HTTPOnly -} - -// ProxyTypeMtproto represents TL type `proxyTypeMtproto#8ae31ffd`. -type ProxyTypeMtproto struct { - // The proxy's secret in hexadecimal encoding - Secret string -} - -// ProxyTypeMtprotoTypeID is TL type id of ProxyTypeMtproto. -const ProxyTypeMtprotoTypeID = 0x8ae31ffd - -// construct implements constructor of ProxyTypeClass. -func (p ProxyTypeMtproto) construct() ProxyTypeClass { return &p } - -// Ensuring interfaces in compile-time for ProxyTypeMtproto. -var ( - _ bin.Encoder = &ProxyTypeMtproto{} - _ bin.Decoder = &ProxyTypeMtproto{} - _ bin.BareEncoder = &ProxyTypeMtproto{} - _ bin.BareDecoder = &ProxyTypeMtproto{} - - _ ProxyTypeClass = &ProxyTypeMtproto{} -) - -func (p *ProxyTypeMtproto) Zero() bool { - if p == nil { - return true - } - if !(p.Secret == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *ProxyTypeMtproto) String() string { - if p == nil { - return "ProxyTypeMtproto(nil)" - } - type Alias ProxyTypeMtproto - return fmt.Sprintf("ProxyTypeMtproto%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ProxyTypeMtproto) TypeID() uint32 { - return ProxyTypeMtprotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ProxyTypeMtproto) TypeName() string { - return "proxyTypeMtproto" -} - -// TypeInfo returns info about TL type. -func (p *ProxyTypeMtproto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "proxyTypeMtproto", - ID: ProxyTypeMtprotoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Secret", - SchemaName: "secret", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *ProxyTypeMtproto) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode proxyTypeMtproto#8ae31ffd as nil") - } - b.PutID(ProxyTypeMtprotoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *ProxyTypeMtproto) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode proxyTypeMtproto#8ae31ffd as nil") - } - b.PutString(p.Secret) - return nil -} - -// Decode implements bin.Decoder. -func (p *ProxyTypeMtproto) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode proxyTypeMtproto#8ae31ffd to nil") - } - if err := b.ConsumeID(ProxyTypeMtprotoTypeID); err != nil { - return fmt.Errorf("unable to decode proxyTypeMtproto#8ae31ffd: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *ProxyTypeMtproto) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode proxyTypeMtproto#8ae31ffd to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeMtproto#8ae31ffd: field secret: %w", err) - } - p.Secret = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *ProxyTypeMtproto) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode proxyTypeMtproto#8ae31ffd as nil") - } - b.ObjStart() - b.PutID("proxyTypeMtproto") - b.Comma() - b.FieldStart("secret") - b.PutString(p.Secret) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *ProxyTypeMtproto) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode proxyTypeMtproto#8ae31ffd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("proxyTypeMtproto"); err != nil { - return fmt.Errorf("unable to decode proxyTypeMtproto#8ae31ffd: %w", err) - } - case "secret": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode proxyTypeMtproto#8ae31ffd: field secret: %w", err) - } - p.Secret = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSecret returns value of Secret field. -func (p *ProxyTypeMtproto) GetSecret() (value string) { - if p == nil { - return - } - return p.Secret -} - -// ProxyTypeClassName is schema name of ProxyTypeClass. -const ProxyTypeClassName = "ProxyType" - -// ProxyTypeClass represents ProxyType generic type. -// -// Example: -// -// g, err := tdapi.DecodeProxyType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ProxyTypeSocks5: // proxyTypeSocks5#caf342b3 -// case *tdapi.ProxyTypeHTTP: // proxyTypeHttp#a3c7c777 -// case *tdapi.ProxyTypeMtproto: // proxyTypeMtproto#8ae31ffd -// default: panic(v) -// } -type ProxyTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ProxyTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeProxyType implements binary de-serialization for ProxyTypeClass. -func DecodeProxyType(buf *bin.Buffer) (ProxyTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ProxyTypeSocks5TypeID: - // Decoding proxyTypeSocks5#caf342b3. - v := ProxyTypeSocks5{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ProxyTypeClass: %w", err) - } - return &v, nil - case ProxyTypeHTTPTypeID: - // Decoding proxyTypeHttp#a3c7c777. - v := ProxyTypeHTTP{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ProxyTypeClass: %w", err) - } - return &v, nil - case ProxyTypeMtprotoTypeID: - // Decoding proxyTypeMtproto#8ae31ffd. - v := ProxyTypeMtproto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ProxyTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ProxyTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONProxyType implements binary de-serialization for ProxyTypeClass. -func DecodeTDLibJSONProxyType(buf tdjson.Decoder) (ProxyTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "proxyTypeSocks5": - // Decoding proxyTypeSocks5#caf342b3. - v := ProxyTypeSocks5{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ProxyTypeClass: %w", err) - } - return &v, nil - case "proxyTypeHttp": - // Decoding proxyTypeHttp#a3c7c777. - v := ProxyTypeHTTP{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ProxyTypeClass: %w", err) - } - return &v, nil - case "proxyTypeMtproto": - // Decoding proxyTypeMtproto#8ae31ffd. - v := ProxyTypeMtproto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ProxyTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ProxyTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ProxyType boxes the ProxyTypeClass providing a helper. -type ProxyTypeBox struct { - ProxyType ProxyTypeClass -} - -// Decode implements bin.Decoder for ProxyTypeBox. -func (b *ProxyTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ProxyTypeBox to nil") - } - v, err := DecodeProxyType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ProxyType = v - return nil -} - -// Encode implements bin.Encode for ProxyTypeBox. -func (b *ProxyTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ProxyType == nil { - return fmt.Errorf("unable to encode ProxyTypeClass as nil") - } - return b.ProxyType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ProxyTypeBox. -func (b *ProxyTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ProxyTypeBox to nil") - } - v, err := DecodeTDLibJSONProxyType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ProxyType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ProxyTypeBox. -func (b *ProxyTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ProxyType == nil { - return fmt.Errorf("unable to encode ProxyTypeClass as nil") - } - return b.ProxyType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_public_chat_type_gen.go b/tdapi/tl_public_chat_type_gen.go deleted file mode 100644 index d29ac3ec4..000000000 --- a/tdapi/tl_public_chat_type_gen.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PublicChatTypeHasUsername represents TL type `publicChatTypeHasUsername#14e8a07e`. -type PublicChatTypeHasUsername struct { -} - -// PublicChatTypeHasUsernameTypeID is TL type id of PublicChatTypeHasUsername. -const PublicChatTypeHasUsernameTypeID = 0x14e8a07e - -// construct implements constructor of PublicChatTypeClass. -func (p PublicChatTypeHasUsername) construct() PublicChatTypeClass { return &p } - -// Ensuring interfaces in compile-time for PublicChatTypeHasUsername. -var ( - _ bin.Encoder = &PublicChatTypeHasUsername{} - _ bin.Decoder = &PublicChatTypeHasUsername{} - _ bin.BareEncoder = &PublicChatTypeHasUsername{} - _ bin.BareDecoder = &PublicChatTypeHasUsername{} - - _ PublicChatTypeClass = &PublicChatTypeHasUsername{} -) - -func (p *PublicChatTypeHasUsername) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PublicChatTypeHasUsername) String() string { - if p == nil { - return "PublicChatTypeHasUsername(nil)" - } - type Alias PublicChatTypeHasUsername - return fmt.Sprintf("PublicChatTypeHasUsername%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PublicChatTypeHasUsername) TypeID() uint32 { - return PublicChatTypeHasUsernameTypeID -} - -// TypeName returns name of type in TL schema. -func (*PublicChatTypeHasUsername) TypeName() string { - return "publicChatTypeHasUsername" -} - -// TypeInfo returns info about TL type. -func (p *PublicChatTypeHasUsername) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "publicChatTypeHasUsername", - ID: PublicChatTypeHasUsernameTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PublicChatTypeHasUsername) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode publicChatTypeHasUsername#14e8a07e as nil") - } - b.PutID(PublicChatTypeHasUsernameTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PublicChatTypeHasUsername) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode publicChatTypeHasUsername#14e8a07e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PublicChatTypeHasUsername) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode publicChatTypeHasUsername#14e8a07e to nil") - } - if err := b.ConsumeID(PublicChatTypeHasUsernameTypeID); err != nil { - return fmt.Errorf("unable to decode publicChatTypeHasUsername#14e8a07e: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PublicChatTypeHasUsername) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode publicChatTypeHasUsername#14e8a07e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PublicChatTypeHasUsername) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode publicChatTypeHasUsername#14e8a07e as nil") - } - b.ObjStart() - b.PutID("publicChatTypeHasUsername") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PublicChatTypeHasUsername) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode publicChatTypeHasUsername#14e8a07e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("publicChatTypeHasUsername"); err != nil { - return fmt.Errorf("unable to decode publicChatTypeHasUsername#14e8a07e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PublicChatTypeIsLocationBased represents TL type `publicChatTypeIsLocationBased#468e6090`. -type PublicChatTypeIsLocationBased struct { -} - -// PublicChatTypeIsLocationBasedTypeID is TL type id of PublicChatTypeIsLocationBased. -const PublicChatTypeIsLocationBasedTypeID = 0x468e6090 - -// construct implements constructor of PublicChatTypeClass. -func (p PublicChatTypeIsLocationBased) construct() PublicChatTypeClass { return &p } - -// Ensuring interfaces in compile-time for PublicChatTypeIsLocationBased. -var ( - _ bin.Encoder = &PublicChatTypeIsLocationBased{} - _ bin.Decoder = &PublicChatTypeIsLocationBased{} - _ bin.BareEncoder = &PublicChatTypeIsLocationBased{} - _ bin.BareDecoder = &PublicChatTypeIsLocationBased{} - - _ PublicChatTypeClass = &PublicChatTypeIsLocationBased{} -) - -func (p *PublicChatTypeIsLocationBased) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PublicChatTypeIsLocationBased) String() string { - if p == nil { - return "PublicChatTypeIsLocationBased(nil)" - } - type Alias PublicChatTypeIsLocationBased - return fmt.Sprintf("PublicChatTypeIsLocationBased%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PublicChatTypeIsLocationBased) TypeID() uint32 { - return PublicChatTypeIsLocationBasedTypeID -} - -// TypeName returns name of type in TL schema. -func (*PublicChatTypeIsLocationBased) TypeName() string { - return "publicChatTypeIsLocationBased" -} - -// TypeInfo returns info about TL type. -func (p *PublicChatTypeIsLocationBased) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "publicChatTypeIsLocationBased", - ID: PublicChatTypeIsLocationBasedTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PublicChatTypeIsLocationBased) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode publicChatTypeIsLocationBased#468e6090 as nil") - } - b.PutID(PublicChatTypeIsLocationBasedTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PublicChatTypeIsLocationBased) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode publicChatTypeIsLocationBased#468e6090 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PublicChatTypeIsLocationBased) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode publicChatTypeIsLocationBased#468e6090 to nil") - } - if err := b.ConsumeID(PublicChatTypeIsLocationBasedTypeID); err != nil { - return fmt.Errorf("unable to decode publicChatTypeIsLocationBased#468e6090: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PublicChatTypeIsLocationBased) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode publicChatTypeIsLocationBased#468e6090 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PublicChatTypeIsLocationBased) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode publicChatTypeIsLocationBased#468e6090 as nil") - } - b.ObjStart() - b.PutID("publicChatTypeIsLocationBased") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PublicChatTypeIsLocationBased) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode publicChatTypeIsLocationBased#468e6090 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("publicChatTypeIsLocationBased"); err != nil { - return fmt.Errorf("unable to decode publicChatTypeIsLocationBased#468e6090: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PublicChatTypeClassName is schema name of PublicChatTypeClass. -const PublicChatTypeClassName = "PublicChatType" - -// PublicChatTypeClass represents PublicChatType generic type. -// -// Example: -// -// g, err := tdapi.DecodePublicChatType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PublicChatTypeHasUsername: // publicChatTypeHasUsername#14e8a07e -// case *tdapi.PublicChatTypeIsLocationBased: // publicChatTypeIsLocationBased#468e6090 -// default: panic(v) -// } -type PublicChatTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PublicChatTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePublicChatType implements binary de-serialization for PublicChatTypeClass. -func DecodePublicChatType(buf *bin.Buffer) (PublicChatTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PublicChatTypeHasUsernameTypeID: - // Decoding publicChatTypeHasUsername#14e8a07e. - v := PublicChatTypeHasUsername{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PublicChatTypeClass: %w", err) - } - return &v, nil - case PublicChatTypeIsLocationBasedTypeID: - // Decoding publicChatTypeIsLocationBased#468e6090. - v := PublicChatTypeIsLocationBased{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PublicChatTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PublicChatTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPublicChatType implements binary de-serialization for PublicChatTypeClass. -func DecodeTDLibJSONPublicChatType(buf tdjson.Decoder) (PublicChatTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "publicChatTypeHasUsername": - // Decoding publicChatTypeHasUsername#14e8a07e. - v := PublicChatTypeHasUsername{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PublicChatTypeClass: %w", err) - } - return &v, nil - case "publicChatTypeIsLocationBased": - // Decoding publicChatTypeIsLocationBased#468e6090. - v := PublicChatTypeIsLocationBased{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PublicChatTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PublicChatTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PublicChatType boxes the PublicChatTypeClass providing a helper. -type PublicChatTypeBox struct { - PublicChatType PublicChatTypeClass -} - -// Decode implements bin.Decoder for PublicChatTypeBox. -func (b *PublicChatTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PublicChatTypeBox to nil") - } - v, err := DecodePublicChatType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PublicChatType = v - return nil -} - -// Encode implements bin.Encode for PublicChatTypeBox. -func (b *PublicChatTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PublicChatType == nil { - return fmt.Errorf("unable to encode PublicChatTypeClass as nil") - } - return b.PublicChatType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PublicChatTypeBox. -func (b *PublicChatTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PublicChatTypeBox to nil") - } - v, err := DecodeTDLibJSONPublicChatType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PublicChatType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PublicChatTypeBox. -func (b *PublicChatTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PublicChatType == nil { - return fmt.Errorf("unable to encode PublicChatTypeClass as nil") - } - return b.PublicChatType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_public_forward_gen.go b/tdapi/tl_public_forward_gen.go deleted file mode 100644 index 82bbf3ce7..000000000 --- a/tdapi/tl_public_forward_gen.go +++ /dev/null @@ -1,501 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PublicForwardMessage represents TL type `publicForwardMessage#317b3d2`. -type PublicForwardMessage struct { - // Information about the message - Message Message -} - -// PublicForwardMessageTypeID is TL type id of PublicForwardMessage. -const PublicForwardMessageTypeID = 0x317b3d2 - -// construct implements constructor of PublicForwardClass. -func (p PublicForwardMessage) construct() PublicForwardClass { return &p } - -// Ensuring interfaces in compile-time for PublicForwardMessage. -var ( - _ bin.Encoder = &PublicForwardMessage{} - _ bin.Decoder = &PublicForwardMessage{} - _ bin.BareEncoder = &PublicForwardMessage{} - _ bin.BareDecoder = &PublicForwardMessage{} - - _ PublicForwardClass = &PublicForwardMessage{} -) - -func (p *PublicForwardMessage) Zero() bool { - if p == nil { - return true - } - if !(p.Message.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PublicForwardMessage) String() string { - if p == nil { - return "PublicForwardMessage(nil)" - } - type Alias PublicForwardMessage - return fmt.Sprintf("PublicForwardMessage%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PublicForwardMessage) TypeID() uint32 { - return PublicForwardMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*PublicForwardMessage) TypeName() string { - return "publicForwardMessage" -} - -// TypeInfo returns info about TL type. -func (p *PublicForwardMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "publicForwardMessage", - ID: PublicForwardMessageTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PublicForwardMessage) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode publicForwardMessage#317b3d2 as nil") - } - b.PutID(PublicForwardMessageTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PublicForwardMessage) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode publicForwardMessage#317b3d2 as nil") - } - if err := p.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode publicForwardMessage#317b3d2: field message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PublicForwardMessage) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode publicForwardMessage#317b3d2 to nil") - } - if err := b.ConsumeID(PublicForwardMessageTypeID); err != nil { - return fmt.Errorf("unable to decode publicForwardMessage#317b3d2: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PublicForwardMessage) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode publicForwardMessage#317b3d2 to nil") - } - { - if err := p.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode publicForwardMessage#317b3d2: field message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PublicForwardMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode publicForwardMessage#317b3d2 as nil") - } - b.ObjStart() - b.PutID("publicForwardMessage") - b.Comma() - b.FieldStart("message") - if err := p.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode publicForwardMessage#317b3d2: field message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PublicForwardMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode publicForwardMessage#317b3d2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("publicForwardMessage"); err != nil { - return fmt.Errorf("unable to decode publicForwardMessage#317b3d2: %w", err) - } - case "message": - if err := p.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode publicForwardMessage#317b3d2: field message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (p *PublicForwardMessage) GetMessage() (value Message) { - if p == nil { - return - } - return p.Message -} - -// PublicForwardStory represents TL type `publicForwardStory#7fdf26af`. -type PublicForwardStory struct { - // Information about the story - Story Story -} - -// PublicForwardStoryTypeID is TL type id of PublicForwardStory. -const PublicForwardStoryTypeID = 0x7fdf26af - -// construct implements constructor of PublicForwardClass. -func (p PublicForwardStory) construct() PublicForwardClass { return &p } - -// Ensuring interfaces in compile-time for PublicForwardStory. -var ( - _ bin.Encoder = &PublicForwardStory{} - _ bin.Decoder = &PublicForwardStory{} - _ bin.BareEncoder = &PublicForwardStory{} - _ bin.BareDecoder = &PublicForwardStory{} - - _ PublicForwardClass = &PublicForwardStory{} -) - -func (p *PublicForwardStory) Zero() bool { - if p == nil { - return true - } - if !(p.Story.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PublicForwardStory) String() string { - if p == nil { - return "PublicForwardStory(nil)" - } - type Alias PublicForwardStory - return fmt.Sprintf("PublicForwardStory%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PublicForwardStory) TypeID() uint32 { - return PublicForwardStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*PublicForwardStory) TypeName() string { - return "publicForwardStory" -} - -// TypeInfo returns info about TL type. -func (p *PublicForwardStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "publicForwardStory", - ID: PublicForwardStoryTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Story", - SchemaName: "story", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PublicForwardStory) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode publicForwardStory#7fdf26af as nil") - } - b.PutID(PublicForwardStoryTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PublicForwardStory) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode publicForwardStory#7fdf26af as nil") - } - if err := p.Story.Encode(b); err != nil { - return fmt.Errorf("unable to encode publicForwardStory#7fdf26af: field story: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PublicForwardStory) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode publicForwardStory#7fdf26af to nil") - } - if err := b.ConsumeID(PublicForwardStoryTypeID); err != nil { - return fmt.Errorf("unable to decode publicForwardStory#7fdf26af: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PublicForwardStory) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode publicForwardStory#7fdf26af to nil") - } - { - if err := p.Story.Decode(b); err != nil { - return fmt.Errorf("unable to decode publicForwardStory#7fdf26af: field story: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PublicForwardStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode publicForwardStory#7fdf26af as nil") - } - b.ObjStart() - b.PutID("publicForwardStory") - b.Comma() - b.FieldStart("story") - if err := p.Story.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode publicForwardStory#7fdf26af: field story: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PublicForwardStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode publicForwardStory#7fdf26af to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("publicForwardStory"); err != nil { - return fmt.Errorf("unable to decode publicForwardStory#7fdf26af: %w", err) - } - case "story": - if err := p.Story.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode publicForwardStory#7fdf26af: field story: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStory returns value of Story field. -func (p *PublicForwardStory) GetStory() (value Story) { - if p == nil { - return - } - return p.Story -} - -// PublicForwardClassName is schema name of PublicForwardClass. -const PublicForwardClassName = "PublicForward" - -// PublicForwardClass represents PublicForward generic type. -// -// Example: -// -// g, err := tdapi.DecodePublicForward(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PublicForwardMessage: // publicForwardMessage#317b3d2 -// case *tdapi.PublicForwardStory: // publicForwardStory#7fdf26af -// default: panic(v) -// } -type PublicForwardClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PublicForwardClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePublicForward implements binary de-serialization for PublicForwardClass. -func DecodePublicForward(buf *bin.Buffer) (PublicForwardClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PublicForwardMessageTypeID: - // Decoding publicForwardMessage#317b3d2. - v := PublicForwardMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PublicForwardClass: %w", err) - } - return &v, nil - case PublicForwardStoryTypeID: - // Decoding publicForwardStory#7fdf26af. - v := PublicForwardStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PublicForwardClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PublicForwardClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPublicForward implements binary de-serialization for PublicForwardClass. -func DecodeTDLibJSONPublicForward(buf tdjson.Decoder) (PublicForwardClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "publicForwardMessage": - // Decoding publicForwardMessage#317b3d2. - v := PublicForwardMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PublicForwardClass: %w", err) - } - return &v, nil - case "publicForwardStory": - // Decoding publicForwardStory#7fdf26af. - v := PublicForwardStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PublicForwardClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PublicForwardClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PublicForward boxes the PublicForwardClass providing a helper. -type PublicForwardBox struct { - PublicForward PublicForwardClass -} - -// Decode implements bin.Decoder for PublicForwardBox. -func (b *PublicForwardBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PublicForwardBox to nil") - } - v, err := DecodePublicForward(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PublicForward = v - return nil -} - -// Encode implements bin.Encode for PublicForwardBox. -func (b *PublicForwardBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PublicForward == nil { - return fmt.Errorf("unable to encode PublicForwardClass as nil") - } - return b.PublicForward.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PublicForwardBox. -func (b *PublicForwardBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PublicForwardBox to nil") - } - v, err := DecodeTDLibJSONPublicForward(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PublicForward = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PublicForwardBox. -func (b *PublicForwardBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PublicForward == nil { - return fmt.Errorf("unable to encode PublicForwardClass as nil") - } - return b.PublicForward.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_public_forwards_gen.go b/tdapi/tl_public_forwards_gen.go deleted file mode 100644 index 8d24ce844..000000000 --- a/tdapi/tl_public_forwards_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PublicForwards represents TL type `publicForwards#3ed29447`. -type PublicForwards struct { - // Approximate total number of messages and stories found - TotalCount int32 - // List of found public forwards and reposts - Forwards []PublicForwardClass - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// PublicForwardsTypeID is TL type id of PublicForwards. -const PublicForwardsTypeID = 0x3ed29447 - -// Ensuring interfaces in compile-time for PublicForwards. -var ( - _ bin.Encoder = &PublicForwards{} - _ bin.Decoder = &PublicForwards{} - _ bin.BareEncoder = &PublicForwards{} - _ bin.BareDecoder = &PublicForwards{} -) - -func (p *PublicForwards) Zero() bool { - if p == nil { - return true - } - if !(p.TotalCount == 0) { - return false - } - if !(p.Forwards == nil) { - return false - } - if !(p.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PublicForwards) String() string { - if p == nil { - return "PublicForwards(nil)" - } - type Alias PublicForwards - return fmt.Sprintf("PublicForwards%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PublicForwards) TypeID() uint32 { - return PublicForwardsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PublicForwards) TypeName() string { - return "publicForwards" -} - -// TypeInfo returns info about TL type. -func (p *PublicForwards) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "publicForwards", - ID: PublicForwardsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Forwards", - SchemaName: "forwards", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PublicForwards) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode publicForwards#3ed29447 as nil") - } - b.PutID(PublicForwardsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PublicForwards) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode publicForwards#3ed29447 as nil") - } - b.PutInt32(p.TotalCount) - b.PutInt(len(p.Forwards)) - for idx, v := range p.Forwards { - if v == nil { - return fmt.Errorf("unable to encode publicForwards#3ed29447: field forwards element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare publicForwards#3ed29447: field forwards element with index %d: %w", idx, err) - } - } - b.PutString(p.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (p *PublicForwards) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode publicForwards#3ed29447 to nil") - } - if err := b.ConsumeID(PublicForwardsTypeID); err != nil { - return fmt.Errorf("unable to decode publicForwards#3ed29447: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PublicForwards) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode publicForwards#3ed29447 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode publicForwards#3ed29447: field total_count: %w", err) - } - p.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode publicForwards#3ed29447: field forwards: %w", err) - } - - if headerLen > 0 { - p.Forwards = make([]PublicForwardClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePublicForward(b) - if err != nil { - return fmt.Errorf("unable to decode publicForwards#3ed29447: field forwards: %w", err) - } - p.Forwards = append(p.Forwards, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode publicForwards#3ed29447: field next_offset: %w", err) - } - p.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PublicForwards) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode publicForwards#3ed29447 as nil") - } - b.ObjStart() - b.PutID("publicForwards") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(p.TotalCount) - b.Comma() - b.FieldStart("forwards") - b.ArrStart() - for idx, v := range p.Forwards { - if v == nil { - return fmt.Errorf("unable to encode publicForwards#3ed29447: field forwards element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode publicForwards#3ed29447: field forwards element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(p.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PublicForwards) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode publicForwards#3ed29447 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("publicForwards"); err != nil { - return fmt.Errorf("unable to decode publicForwards#3ed29447: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode publicForwards#3ed29447: field total_count: %w", err) - } - p.TotalCount = value - case "forwards": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPublicForward(b) - if err != nil { - return fmt.Errorf("unable to decode publicForwards#3ed29447: field forwards: %w", err) - } - p.Forwards = append(p.Forwards, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode publicForwards#3ed29447: field forwards: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode publicForwards#3ed29447: field next_offset: %w", err) - } - p.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (p *PublicForwards) GetTotalCount() (value int32) { - if p == nil { - return - } - return p.TotalCount -} - -// GetForwards returns value of Forwards field. -func (p *PublicForwards) GetForwards() (value []PublicForwardClass) { - if p == nil { - return - } - return p.Forwards -} - -// GetNextOffset returns value of NextOffset field. -func (p *PublicForwards) GetNextOffset() (value string) { - if p == nil { - return - } - return p.NextOffset -} diff --git a/tdapi/tl_push_message_content_gen.go b/tdapi/tl_push_message_content_gen.go deleted file mode 100644 index 0656d352f..000000000 --- a/tdapi/tl_push_message_content_gen.go +++ /dev/null @@ -1,7761 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PushMessageContentHidden represents TL type `pushMessageContentHidden#ed1bb85c`. -type PushMessageContentHidden struct { - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentHiddenTypeID is TL type id of PushMessageContentHidden. -const PushMessageContentHiddenTypeID = 0xed1bb85c - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentHidden) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentHidden. -var ( - _ bin.Encoder = &PushMessageContentHidden{} - _ bin.Decoder = &PushMessageContentHidden{} - _ bin.BareEncoder = &PushMessageContentHidden{} - _ bin.BareDecoder = &PushMessageContentHidden{} - - _ PushMessageContentClass = &PushMessageContentHidden{} -) - -func (p *PushMessageContentHidden) Zero() bool { - if p == nil { - return true - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentHidden) String() string { - if p == nil { - return "PushMessageContentHidden(nil)" - } - type Alias PushMessageContentHidden - return fmt.Sprintf("PushMessageContentHidden%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentHidden) TypeID() uint32 { - return PushMessageContentHiddenTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentHidden) TypeName() string { - return "pushMessageContentHidden" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentHidden) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentHidden", - ID: PushMessageContentHiddenTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentHidden) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentHidden#ed1bb85c as nil") - } - b.PutID(PushMessageContentHiddenTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentHidden) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentHidden#ed1bb85c as nil") - } - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentHidden) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentHidden#ed1bb85c to nil") - } - if err := b.ConsumeID(PushMessageContentHiddenTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentHidden#ed1bb85c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentHidden) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentHidden#ed1bb85c to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentHidden#ed1bb85c: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentHidden) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentHidden#ed1bb85c as nil") - } - b.ObjStart() - b.PutID("pushMessageContentHidden") - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentHidden) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentHidden#ed1bb85c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentHidden"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentHidden#ed1bb85c: %w", err) - } - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentHidden#ed1bb85c: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentHidden) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentAnimation represents TL type `pushMessageContentAnimation#3da4dfe4`. -type PushMessageContentAnimation struct { - // Message content; may be null - Animation Animation - // Animation caption - Caption string - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentAnimationTypeID is TL type id of PushMessageContentAnimation. -const PushMessageContentAnimationTypeID = 0x3da4dfe4 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentAnimation) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentAnimation. -var ( - _ bin.Encoder = &PushMessageContentAnimation{} - _ bin.Decoder = &PushMessageContentAnimation{} - _ bin.BareEncoder = &PushMessageContentAnimation{} - _ bin.BareDecoder = &PushMessageContentAnimation{} - - _ PushMessageContentClass = &PushMessageContentAnimation{} -) - -func (p *PushMessageContentAnimation) Zero() bool { - if p == nil { - return true - } - if !(p.Animation.Zero()) { - return false - } - if !(p.Caption == "") { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentAnimation) String() string { - if p == nil { - return "PushMessageContentAnimation(nil)" - } - type Alias PushMessageContentAnimation - return fmt.Sprintf("PushMessageContentAnimation%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentAnimation) TypeID() uint32 { - return PushMessageContentAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentAnimation) TypeName() string { - return "pushMessageContentAnimation" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentAnimation", - ID: PushMessageContentAnimationTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Animation", - SchemaName: "animation", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentAnimation) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentAnimation#3da4dfe4 as nil") - } - b.PutID(PushMessageContentAnimationTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentAnimation) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentAnimation#3da4dfe4 as nil") - } - if err := p.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentAnimation#3da4dfe4: field animation: %w", err) - } - b.PutString(p.Caption) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentAnimation) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentAnimation#3da4dfe4 to nil") - } - if err := b.ConsumeID(PushMessageContentAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentAnimation) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentAnimation#3da4dfe4 to nil") - } - { - if err := p.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field animation: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field caption: %w", err) - } - p.Caption = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentAnimation#3da4dfe4 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentAnimation") - b.Comma() - b.FieldStart("animation") - if err := p.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentAnimation#3da4dfe4: field animation: %w", err) - } - b.Comma() - b.FieldStart("caption") - b.PutString(p.Caption) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentAnimation#3da4dfe4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentAnimation"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: %w", err) - } - case "animation": - if err := p.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field animation: %w", err) - } - case "caption": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field caption: %w", err) - } - p.Caption = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentAnimation#3da4dfe4: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAnimation returns value of Animation field. -func (p *PushMessageContentAnimation) GetAnimation() (value Animation) { - if p == nil { - return - } - return p.Animation -} - -// GetCaption returns value of Caption field. -func (p *PushMessageContentAnimation) GetCaption() (value string) { - if p == nil { - return - } - return p.Caption -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentAnimation) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentAudio represents TL type `pushMessageContentAudio#16be7872`. -type PushMessageContentAudio struct { - // Message content; may be null - Audio Audio - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentAudioTypeID is TL type id of PushMessageContentAudio. -const PushMessageContentAudioTypeID = 0x16be7872 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentAudio) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentAudio. -var ( - _ bin.Encoder = &PushMessageContentAudio{} - _ bin.Decoder = &PushMessageContentAudio{} - _ bin.BareEncoder = &PushMessageContentAudio{} - _ bin.BareDecoder = &PushMessageContentAudio{} - - _ PushMessageContentClass = &PushMessageContentAudio{} -) - -func (p *PushMessageContentAudio) Zero() bool { - if p == nil { - return true - } - if !(p.Audio.Zero()) { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentAudio) String() string { - if p == nil { - return "PushMessageContentAudio(nil)" - } - type Alias PushMessageContentAudio - return fmt.Sprintf("PushMessageContentAudio%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentAudio) TypeID() uint32 { - return PushMessageContentAudioTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentAudio) TypeName() string { - return "pushMessageContentAudio" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentAudio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentAudio", - ID: PushMessageContentAudioTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Audio", - SchemaName: "audio", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentAudio) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentAudio#16be7872 as nil") - } - b.PutID(PushMessageContentAudioTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentAudio) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentAudio#16be7872 as nil") - } - if err := p.Audio.Encode(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentAudio#16be7872: field audio: %w", err) - } - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentAudio) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentAudio#16be7872 to nil") - } - if err := b.ConsumeID(PushMessageContentAudioTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentAudio) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentAudio#16be7872 to nil") - } - { - if err := p.Audio.Decode(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: field audio: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentAudio) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentAudio#16be7872 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentAudio") - b.Comma() - b.FieldStart("audio") - if err := p.Audio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentAudio#16be7872: field audio: %w", err) - } - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentAudio) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentAudio#16be7872 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentAudio"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: %w", err) - } - case "audio": - if err := p.Audio.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: field audio: %w", err) - } - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentAudio#16be7872: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAudio returns value of Audio field. -func (p *PushMessageContentAudio) GetAudio() (value Audio) { - if p == nil { - return - } - return p.Audio -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentAudio) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentContact represents TL type `pushMessageContentContact#ff458a54`. -type PushMessageContentContact struct { - // Contact's name - Name string - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentContactTypeID is TL type id of PushMessageContentContact. -const PushMessageContentContactTypeID = 0xff458a54 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentContact) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentContact. -var ( - _ bin.Encoder = &PushMessageContentContact{} - _ bin.Decoder = &PushMessageContentContact{} - _ bin.BareEncoder = &PushMessageContentContact{} - _ bin.BareDecoder = &PushMessageContentContact{} - - _ PushMessageContentClass = &PushMessageContentContact{} -) - -func (p *PushMessageContentContact) Zero() bool { - if p == nil { - return true - } - if !(p.Name == "") { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentContact) String() string { - if p == nil { - return "PushMessageContentContact(nil)" - } - type Alias PushMessageContentContact - return fmt.Sprintf("PushMessageContentContact%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentContact) TypeID() uint32 { - return PushMessageContentContactTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentContact) TypeName() string { - return "pushMessageContentContact" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentContact) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentContact", - ID: PushMessageContentContactTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentContact) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentContact#ff458a54 as nil") - } - b.PutID(PushMessageContentContactTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentContact) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentContact#ff458a54 as nil") - } - b.PutString(p.Name) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentContact) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentContact#ff458a54 to nil") - } - if err := b.ConsumeID(PushMessageContentContactTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentContact) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentContact#ff458a54 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: field name: %w", err) - } - p.Name = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentContact) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentContact#ff458a54 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentContact") - b.Comma() - b.FieldStart("name") - b.PutString(p.Name) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentContact) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentContact#ff458a54 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentContact"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: field name: %w", err) - } - p.Name = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentContact#ff458a54: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (p *PushMessageContentContact) GetName() (value string) { - if p == nil { - return - } - return p.Name -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentContact) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentContactRegistered represents TL type `pushMessageContentContactRegistered#ede1e5a0`. -type PushMessageContentContactRegistered struct { -} - -// PushMessageContentContactRegisteredTypeID is TL type id of PushMessageContentContactRegistered. -const PushMessageContentContactRegisteredTypeID = 0xede1e5a0 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentContactRegistered) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentContactRegistered. -var ( - _ bin.Encoder = &PushMessageContentContactRegistered{} - _ bin.Decoder = &PushMessageContentContactRegistered{} - _ bin.BareEncoder = &PushMessageContentContactRegistered{} - _ bin.BareDecoder = &PushMessageContentContactRegistered{} - - _ PushMessageContentClass = &PushMessageContentContactRegistered{} -) - -func (p *PushMessageContentContactRegistered) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentContactRegistered) String() string { - if p == nil { - return "PushMessageContentContactRegistered(nil)" - } - type Alias PushMessageContentContactRegistered - return fmt.Sprintf("PushMessageContentContactRegistered%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentContactRegistered) TypeID() uint32 { - return PushMessageContentContactRegisteredTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentContactRegistered) TypeName() string { - return "pushMessageContentContactRegistered" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentContactRegistered) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentContactRegistered", - ID: PushMessageContentContactRegisteredTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentContactRegistered) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentContactRegistered#ede1e5a0 as nil") - } - b.PutID(PushMessageContentContactRegisteredTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentContactRegistered) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentContactRegistered#ede1e5a0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentContactRegistered) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentContactRegistered#ede1e5a0 to nil") - } - if err := b.ConsumeID(PushMessageContentContactRegisteredTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentContactRegistered#ede1e5a0: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentContactRegistered) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentContactRegistered#ede1e5a0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentContactRegistered) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentContactRegistered#ede1e5a0 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentContactRegistered") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentContactRegistered) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentContactRegistered#ede1e5a0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentContactRegistered"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentContactRegistered#ede1e5a0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PushMessageContentDocument represents TL type `pushMessageContentDocument#e4adae01`. -type PushMessageContentDocument struct { - // Message content; may be null - Document Document - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentDocumentTypeID is TL type id of PushMessageContentDocument. -const PushMessageContentDocumentTypeID = 0xe4adae01 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentDocument) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentDocument. -var ( - _ bin.Encoder = &PushMessageContentDocument{} - _ bin.Decoder = &PushMessageContentDocument{} - _ bin.BareEncoder = &PushMessageContentDocument{} - _ bin.BareDecoder = &PushMessageContentDocument{} - - _ PushMessageContentClass = &PushMessageContentDocument{} -) - -func (p *PushMessageContentDocument) Zero() bool { - if p == nil { - return true - } - if !(p.Document.Zero()) { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentDocument) String() string { - if p == nil { - return "PushMessageContentDocument(nil)" - } - type Alias PushMessageContentDocument - return fmt.Sprintf("PushMessageContentDocument%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentDocument) TypeID() uint32 { - return PushMessageContentDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentDocument) TypeName() string { - return "pushMessageContentDocument" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentDocument", - ID: PushMessageContentDocumentTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Document", - SchemaName: "document", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentDocument) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentDocument#e4adae01 as nil") - } - b.PutID(PushMessageContentDocumentTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentDocument) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentDocument#e4adae01 as nil") - } - if err := p.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentDocument#e4adae01: field document: %w", err) - } - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentDocument) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentDocument#e4adae01 to nil") - } - if err := b.ConsumeID(PushMessageContentDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentDocument) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentDocument#e4adae01 to nil") - } - { - if err := p.Document.Decode(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: field document: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentDocument#e4adae01 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentDocument") - b.Comma() - b.FieldStart("document") - if err := p.Document.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentDocument#e4adae01: field document: %w", err) - } - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentDocument#e4adae01 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentDocument"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: %w", err) - } - case "document": - if err := p.Document.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: field document: %w", err) - } - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentDocument#e4adae01: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDocument returns value of Document field. -func (p *PushMessageContentDocument) GetDocument() (value Document) { - if p == nil { - return - } - return p.Document -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentDocument) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentGame represents TL type `pushMessageContentGame#e14bb91b`. -type PushMessageContentGame struct { - // Game title, empty for pinned game message - Title string - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentGameTypeID is TL type id of PushMessageContentGame. -const PushMessageContentGameTypeID = 0xe14bb91b - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentGame) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentGame. -var ( - _ bin.Encoder = &PushMessageContentGame{} - _ bin.Decoder = &PushMessageContentGame{} - _ bin.BareEncoder = &PushMessageContentGame{} - _ bin.BareDecoder = &PushMessageContentGame{} - - _ PushMessageContentClass = &PushMessageContentGame{} -) - -func (p *PushMessageContentGame) Zero() bool { - if p == nil { - return true - } - if !(p.Title == "") { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentGame) String() string { - if p == nil { - return "PushMessageContentGame(nil)" - } - type Alias PushMessageContentGame - return fmt.Sprintf("PushMessageContentGame%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentGame) TypeID() uint32 { - return PushMessageContentGameTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentGame) TypeName() string { - return "pushMessageContentGame" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentGame) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentGame", - ID: PushMessageContentGameTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentGame) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGame#e14bb91b as nil") - } - b.PutID(PushMessageContentGameTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentGame) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGame#e14bb91b as nil") - } - b.PutString(p.Title) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentGame) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGame#e14bb91b to nil") - } - if err := b.ConsumeID(PushMessageContentGameTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentGame) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGame#e14bb91b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: field title: %w", err) - } - p.Title = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentGame) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGame#e14bb91b as nil") - } - b.ObjStart() - b.PutID("pushMessageContentGame") - b.Comma() - b.FieldStart("title") - b.PutString(p.Title) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentGame) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGame#e14bb91b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentGame"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: field title: %w", err) - } - p.Title = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGame#e14bb91b: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (p *PushMessageContentGame) GetTitle() (value string) { - if p == nil { - return - } - return p.Title -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentGame) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentGameScore represents TL type `pushMessageContentGameScore#35b8cd88`. -type PushMessageContentGameScore struct { - // Game title, empty for pinned message - Title string - // New score, 0 for pinned message - Score int32 - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentGameScoreTypeID is TL type id of PushMessageContentGameScore. -const PushMessageContentGameScoreTypeID = 0x35b8cd88 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentGameScore) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentGameScore. -var ( - _ bin.Encoder = &PushMessageContentGameScore{} - _ bin.Decoder = &PushMessageContentGameScore{} - _ bin.BareEncoder = &PushMessageContentGameScore{} - _ bin.BareDecoder = &PushMessageContentGameScore{} - - _ PushMessageContentClass = &PushMessageContentGameScore{} -) - -func (p *PushMessageContentGameScore) Zero() bool { - if p == nil { - return true - } - if !(p.Title == "") { - return false - } - if !(p.Score == 0) { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentGameScore) String() string { - if p == nil { - return "PushMessageContentGameScore(nil)" - } - type Alias PushMessageContentGameScore - return fmt.Sprintf("PushMessageContentGameScore%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentGameScore) TypeID() uint32 { - return PushMessageContentGameScoreTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentGameScore) TypeName() string { - return "pushMessageContentGameScore" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentGameScore) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentGameScore", - ID: PushMessageContentGameScoreTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Score", - SchemaName: "score", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentGameScore) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGameScore#35b8cd88 as nil") - } - b.PutID(PushMessageContentGameScoreTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentGameScore) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGameScore#35b8cd88 as nil") - } - b.PutString(p.Title) - b.PutInt32(p.Score) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentGameScore) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGameScore#35b8cd88 to nil") - } - if err := b.ConsumeID(PushMessageContentGameScoreTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentGameScore) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGameScore#35b8cd88 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field title: %w", err) - } - p.Title = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field score: %w", err) - } - p.Score = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentGameScore) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGameScore#35b8cd88 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentGameScore") - b.Comma() - b.FieldStart("title") - b.PutString(p.Title) - b.Comma() - b.FieldStart("score") - b.PutInt32(p.Score) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentGameScore) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGameScore#35b8cd88 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentGameScore"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field title: %w", err) - } - p.Title = value - case "score": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field score: %w", err) - } - p.Score = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGameScore#35b8cd88: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (p *PushMessageContentGameScore) GetTitle() (value string) { - if p == nil { - return - } - return p.Title -} - -// GetScore returns value of Score field. -func (p *PushMessageContentGameScore) GetScore() (value int32) { - if p == nil { - return - } - return p.Score -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentGameScore) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentInvoice represents TL type `pushMessageContentInvoice#98c88bbc`. -type PushMessageContentInvoice struct { - // Product price - Price string - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentInvoiceTypeID is TL type id of PushMessageContentInvoice. -const PushMessageContentInvoiceTypeID = 0x98c88bbc - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentInvoice) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentInvoice. -var ( - _ bin.Encoder = &PushMessageContentInvoice{} - _ bin.Decoder = &PushMessageContentInvoice{} - _ bin.BareEncoder = &PushMessageContentInvoice{} - _ bin.BareDecoder = &PushMessageContentInvoice{} - - _ PushMessageContentClass = &PushMessageContentInvoice{} -) - -func (p *PushMessageContentInvoice) Zero() bool { - if p == nil { - return true - } - if !(p.Price == "") { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentInvoice) String() string { - if p == nil { - return "PushMessageContentInvoice(nil)" - } - type Alias PushMessageContentInvoice - return fmt.Sprintf("PushMessageContentInvoice%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentInvoice) TypeID() uint32 { - return PushMessageContentInvoiceTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentInvoice) TypeName() string { - return "pushMessageContentInvoice" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentInvoice) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentInvoice", - ID: PushMessageContentInvoiceTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Price", - SchemaName: "price", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentInvoice) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentInvoice#98c88bbc as nil") - } - b.PutID(PushMessageContentInvoiceTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentInvoice) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentInvoice#98c88bbc as nil") - } - b.PutString(p.Price) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentInvoice) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentInvoice#98c88bbc to nil") - } - if err := b.ConsumeID(PushMessageContentInvoiceTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentInvoice) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentInvoice#98c88bbc to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: field price: %w", err) - } - p.Price = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentInvoice) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentInvoice#98c88bbc as nil") - } - b.ObjStart() - b.PutID("pushMessageContentInvoice") - b.Comma() - b.FieldStart("price") - b.PutString(p.Price) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentInvoice) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentInvoice#98c88bbc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentInvoice"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: %w", err) - } - case "price": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: field price: %w", err) - } - p.Price = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentInvoice#98c88bbc: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPrice returns value of Price field. -func (p *PushMessageContentInvoice) GetPrice() (value string) { - if p == nil { - return - } - return p.Price -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentInvoice) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentLocation represents TL type `pushMessageContentLocation#b33a97b3`. -type PushMessageContentLocation struct { - // True, if the location is live - IsLive bool - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentLocationTypeID is TL type id of PushMessageContentLocation. -const PushMessageContentLocationTypeID = 0xb33a97b3 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentLocation) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentLocation. -var ( - _ bin.Encoder = &PushMessageContentLocation{} - _ bin.Decoder = &PushMessageContentLocation{} - _ bin.BareEncoder = &PushMessageContentLocation{} - _ bin.BareDecoder = &PushMessageContentLocation{} - - _ PushMessageContentClass = &PushMessageContentLocation{} -) - -func (p *PushMessageContentLocation) Zero() bool { - if p == nil { - return true - } - if !(p.IsLive == false) { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentLocation) String() string { - if p == nil { - return "PushMessageContentLocation(nil)" - } - type Alias PushMessageContentLocation - return fmt.Sprintf("PushMessageContentLocation%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentLocation) TypeID() uint32 { - return PushMessageContentLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentLocation) TypeName() string { - return "pushMessageContentLocation" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentLocation", - ID: PushMessageContentLocationTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsLive", - SchemaName: "is_live", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentLocation) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentLocation#b33a97b3 as nil") - } - b.PutID(PushMessageContentLocationTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentLocation) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentLocation#b33a97b3 as nil") - } - b.PutBool(p.IsLive) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentLocation) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentLocation#b33a97b3 to nil") - } - if err := b.ConsumeID(PushMessageContentLocationTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentLocation) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentLocation#b33a97b3 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: field is_live: %w", err) - } - p.IsLive = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentLocation) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentLocation#b33a97b3 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentLocation") - b.Comma() - b.FieldStart("is_live") - b.PutBool(p.IsLive) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentLocation) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentLocation#b33a97b3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentLocation"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: %w", err) - } - case "is_live": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: field is_live: %w", err) - } - p.IsLive = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentLocation#b33a97b3: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsLive returns value of IsLive field. -func (p *PushMessageContentLocation) GetIsLive() (value bool) { - if p == nil { - return - } - return p.IsLive -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentLocation) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentPaidMedia represents TL type `pushMessageContentPaidMedia#b556e74a`. -type PushMessageContentPaidMedia struct { - // Number of Telegram Stars needed to buy access to the media in the message; 0 for - // pinned message - StarCount int64 - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentPaidMediaTypeID is TL type id of PushMessageContentPaidMedia. -const PushMessageContentPaidMediaTypeID = 0xb556e74a - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentPaidMedia) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentPaidMedia. -var ( - _ bin.Encoder = &PushMessageContentPaidMedia{} - _ bin.Decoder = &PushMessageContentPaidMedia{} - _ bin.BareEncoder = &PushMessageContentPaidMedia{} - _ bin.BareDecoder = &PushMessageContentPaidMedia{} - - _ PushMessageContentClass = &PushMessageContentPaidMedia{} -) - -func (p *PushMessageContentPaidMedia) Zero() bool { - if p == nil { - return true - } - if !(p.StarCount == 0) { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentPaidMedia) String() string { - if p == nil { - return "PushMessageContentPaidMedia(nil)" - } - type Alias PushMessageContentPaidMedia - return fmt.Sprintf("PushMessageContentPaidMedia%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentPaidMedia) TypeID() uint32 { - return PushMessageContentPaidMediaTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentPaidMedia) TypeName() string { - return "pushMessageContentPaidMedia" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentPaidMedia) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentPaidMedia", - ID: PushMessageContentPaidMediaTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentPaidMedia) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPaidMedia#b556e74a as nil") - } - b.PutID(PushMessageContentPaidMediaTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentPaidMedia) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPaidMedia#b556e74a as nil") - } - b.PutInt53(p.StarCount) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentPaidMedia) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPaidMedia#b556e74a to nil") - } - if err := b.ConsumeID(PushMessageContentPaidMediaTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentPaidMedia) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPaidMedia#b556e74a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: field star_count: %w", err) - } - p.StarCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentPaidMedia) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPaidMedia#b556e74a as nil") - } - b.ObjStart() - b.PutID("pushMessageContentPaidMedia") - b.Comma() - b.FieldStart("star_count") - b.PutInt53(p.StarCount) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentPaidMedia) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPaidMedia#b556e74a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentPaidMedia"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: field star_count: %w", err) - } - p.StarCount = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPaidMedia#b556e74a: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarCount returns value of StarCount field. -func (p *PushMessageContentPaidMedia) GetStarCount() (value int64) { - if p == nil { - return - } - return p.StarCount -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentPaidMedia) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentPhoto represents TL type `pushMessageContentPhoto#861dc52`. -type PushMessageContentPhoto struct { - // Message content; may be null - Photo Photo - // Photo caption - Caption string - // True, if the photo is secret - IsSecret bool - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentPhotoTypeID is TL type id of PushMessageContentPhoto. -const PushMessageContentPhotoTypeID = 0x861dc52 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentPhoto) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentPhoto. -var ( - _ bin.Encoder = &PushMessageContentPhoto{} - _ bin.Decoder = &PushMessageContentPhoto{} - _ bin.BareEncoder = &PushMessageContentPhoto{} - _ bin.BareDecoder = &PushMessageContentPhoto{} - - _ PushMessageContentClass = &PushMessageContentPhoto{} -) - -func (p *PushMessageContentPhoto) Zero() bool { - if p == nil { - return true - } - if !(p.Photo.Zero()) { - return false - } - if !(p.Caption == "") { - return false - } - if !(p.IsSecret == false) { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentPhoto) String() string { - if p == nil { - return "PushMessageContentPhoto(nil)" - } - type Alias PushMessageContentPhoto - return fmt.Sprintf("PushMessageContentPhoto%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentPhoto) TypeID() uint32 { - return PushMessageContentPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentPhoto) TypeName() string { - return "pushMessageContentPhoto" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentPhoto", - ID: PushMessageContentPhotoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "IsSecret", - SchemaName: "is_secret", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentPhoto) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPhoto#861dc52 as nil") - } - b.PutID(PushMessageContentPhotoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentPhoto) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPhoto#861dc52 as nil") - } - if err := p.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentPhoto#861dc52: field photo: %w", err) - } - b.PutString(p.Caption) - b.PutBool(p.IsSecret) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentPhoto) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPhoto#861dc52 to nil") - } - if err := b.ConsumeID(PushMessageContentPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentPhoto) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPhoto#861dc52 to nil") - } - { - if err := p.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field photo: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field caption: %w", err) - } - p.Caption = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field is_secret: %w", err) - } - p.IsSecret = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPhoto#861dc52 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentPhoto") - b.Comma() - b.FieldStart("photo") - if err := p.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentPhoto#861dc52: field photo: %w", err) - } - b.Comma() - b.FieldStart("caption") - b.PutString(p.Caption) - b.Comma() - b.FieldStart("is_secret") - b.PutBool(p.IsSecret) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPhoto#861dc52 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentPhoto"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: %w", err) - } - case "photo": - if err := p.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field photo: %w", err) - } - case "caption": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field caption: %w", err) - } - p.Caption = value - case "is_secret": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field is_secret: %w", err) - } - p.IsSecret = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPhoto#861dc52: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (p *PushMessageContentPhoto) GetPhoto() (value Photo) { - if p == nil { - return - } - return p.Photo -} - -// GetCaption returns value of Caption field. -func (p *PushMessageContentPhoto) GetCaption() (value string) { - if p == nil { - return - } - return p.Caption -} - -// GetIsSecret returns value of IsSecret field. -func (p *PushMessageContentPhoto) GetIsSecret() (value bool) { - if p == nil { - return - } - return p.IsSecret -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentPhoto) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentPoll represents TL type `pushMessageContentPoll#fd5a743a`. -type PushMessageContentPoll struct { - // Poll question - Question string - // True, if the poll is regular and not in quiz mode - IsRegular bool - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentPollTypeID is TL type id of PushMessageContentPoll. -const PushMessageContentPollTypeID = 0xfd5a743a - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentPoll) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentPoll. -var ( - _ bin.Encoder = &PushMessageContentPoll{} - _ bin.Decoder = &PushMessageContentPoll{} - _ bin.BareEncoder = &PushMessageContentPoll{} - _ bin.BareDecoder = &PushMessageContentPoll{} - - _ PushMessageContentClass = &PushMessageContentPoll{} -) - -func (p *PushMessageContentPoll) Zero() bool { - if p == nil { - return true - } - if !(p.Question == "") { - return false - } - if !(p.IsRegular == false) { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentPoll) String() string { - if p == nil { - return "PushMessageContentPoll(nil)" - } - type Alias PushMessageContentPoll - return fmt.Sprintf("PushMessageContentPoll%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentPoll) TypeID() uint32 { - return PushMessageContentPollTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentPoll) TypeName() string { - return "pushMessageContentPoll" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentPoll) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentPoll", - ID: PushMessageContentPollTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Question", - SchemaName: "question", - }, - { - Name: "IsRegular", - SchemaName: "is_regular", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentPoll) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPoll#fd5a743a as nil") - } - b.PutID(PushMessageContentPollTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentPoll) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPoll#fd5a743a as nil") - } - b.PutString(p.Question) - b.PutBool(p.IsRegular) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentPoll) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPoll#fd5a743a to nil") - } - if err := b.ConsumeID(PushMessageContentPollTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentPoll) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPoll#fd5a743a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field question: %w", err) - } - p.Question = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field is_regular: %w", err) - } - p.IsRegular = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentPoll) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPoll#fd5a743a as nil") - } - b.ObjStart() - b.PutID("pushMessageContentPoll") - b.Comma() - b.FieldStart("question") - b.PutString(p.Question) - b.Comma() - b.FieldStart("is_regular") - b.PutBool(p.IsRegular) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentPoll) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPoll#fd5a743a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentPoll"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: %w", err) - } - case "question": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field question: %w", err) - } - p.Question = value - case "is_regular": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field is_regular: %w", err) - } - p.IsRegular = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPoll#fd5a743a: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuestion returns value of Question field. -func (p *PushMessageContentPoll) GetQuestion() (value string) { - if p == nil { - return - } - return p.Question -} - -// GetIsRegular returns value of IsRegular field. -func (p *PushMessageContentPoll) GetIsRegular() (value bool) { - if p == nil { - return - } - return p.IsRegular -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentPoll) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentPremiumGiftCode represents TL type `pushMessageContentPremiumGiftCode#18a15025`. -type PushMessageContentPremiumGiftCode struct { - // Number of months the Telegram Premium subscription will be active after code - // activation - MonthCount int32 -} - -// PushMessageContentPremiumGiftCodeTypeID is TL type id of PushMessageContentPremiumGiftCode. -const PushMessageContentPremiumGiftCodeTypeID = 0x18a15025 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentPremiumGiftCode) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentPremiumGiftCode. -var ( - _ bin.Encoder = &PushMessageContentPremiumGiftCode{} - _ bin.Decoder = &PushMessageContentPremiumGiftCode{} - _ bin.BareEncoder = &PushMessageContentPremiumGiftCode{} - _ bin.BareDecoder = &PushMessageContentPremiumGiftCode{} - - _ PushMessageContentClass = &PushMessageContentPremiumGiftCode{} -) - -func (p *PushMessageContentPremiumGiftCode) Zero() bool { - if p == nil { - return true - } - if !(p.MonthCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentPremiumGiftCode) String() string { - if p == nil { - return "PushMessageContentPremiumGiftCode(nil)" - } - type Alias PushMessageContentPremiumGiftCode - return fmt.Sprintf("PushMessageContentPremiumGiftCode%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentPremiumGiftCode) TypeID() uint32 { - return PushMessageContentPremiumGiftCodeTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentPremiumGiftCode) TypeName() string { - return "pushMessageContentPremiumGiftCode" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentPremiumGiftCode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentPremiumGiftCode", - ID: PushMessageContentPremiumGiftCodeTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MonthCount", - SchemaName: "month_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentPremiumGiftCode) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPremiumGiftCode#18a15025 as nil") - } - b.PutID(PushMessageContentPremiumGiftCodeTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentPremiumGiftCode) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPremiumGiftCode#18a15025 as nil") - } - b.PutInt32(p.MonthCount) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentPremiumGiftCode) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPremiumGiftCode#18a15025 to nil") - } - if err := b.ConsumeID(PushMessageContentPremiumGiftCodeTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiftCode#18a15025: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentPremiumGiftCode) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPremiumGiftCode#18a15025 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiftCode#18a15025: field month_count: %w", err) - } - p.MonthCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentPremiumGiftCode) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentPremiumGiftCode#18a15025 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentPremiumGiftCode") - b.Comma() - b.FieldStart("month_count") - b.PutInt32(p.MonthCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentPremiumGiftCode) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentPremiumGiftCode#18a15025 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentPremiumGiftCode"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiftCode#18a15025: %w", err) - } - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentPremiumGiftCode#18a15025: field month_count: %w", err) - } - p.MonthCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMonthCount returns value of MonthCount field. -func (p *PushMessageContentPremiumGiftCode) GetMonthCount() (value int32) { - if p == nil { - return - } - return p.MonthCount -} - -// PushMessageContentGiveaway represents TL type `pushMessageContentGiveaway#d63e7f8e`. -type PushMessageContentGiveaway struct { - // Number of users which will receive giveaway prizes; 0 for pinned message - WinnerCount int32 - // Prize of the giveaway; may be null for pinned message - Prize GiveawayPrizeClass - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentGiveawayTypeID is TL type id of PushMessageContentGiveaway. -const PushMessageContentGiveawayTypeID = 0xd63e7f8e - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentGiveaway) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentGiveaway. -var ( - _ bin.Encoder = &PushMessageContentGiveaway{} - _ bin.Decoder = &PushMessageContentGiveaway{} - _ bin.BareEncoder = &PushMessageContentGiveaway{} - _ bin.BareDecoder = &PushMessageContentGiveaway{} - - _ PushMessageContentClass = &PushMessageContentGiveaway{} -) - -func (p *PushMessageContentGiveaway) Zero() bool { - if p == nil { - return true - } - if !(p.WinnerCount == 0) { - return false - } - if !(p.Prize == nil) { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentGiveaway) String() string { - if p == nil { - return "PushMessageContentGiveaway(nil)" - } - type Alias PushMessageContentGiveaway - return fmt.Sprintf("PushMessageContentGiveaway%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentGiveaway) TypeID() uint32 { - return PushMessageContentGiveawayTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentGiveaway) TypeName() string { - return "pushMessageContentGiveaway" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentGiveaway) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentGiveaway", - ID: PushMessageContentGiveawayTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "Prize", - SchemaName: "prize", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentGiveaway) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGiveaway#d63e7f8e as nil") - } - b.PutID(PushMessageContentGiveawayTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentGiveaway) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGiveaway#d63e7f8e as nil") - } - b.PutInt32(p.WinnerCount) - if p.Prize == nil { - return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize is nil") - } - if err := p.Prize.Encode(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err) - } - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentGiveaway) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGiveaway#d63e7f8e to nil") - } - if err := b.ConsumeID(PushMessageContentGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentGiveaway) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGiveaway#d63e7f8e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field winner_count: %w", err) - } - p.WinnerCount = value - } - { - value, err := DecodeGiveawayPrize(b) - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err) - } - p.Prize = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGiveaway#d63e7f8e as nil") - } - b.ObjStart() - b.PutID("pushMessageContentGiveaway") - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(p.WinnerCount) - b.Comma() - b.FieldStart("prize") - if p.Prize == nil { - return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize is nil") - } - if err := p.Prize.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err) - } - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGiveaway#d63e7f8e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentGiveaway"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: %w", err) - } - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field winner_count: %w", err) - } - p.WinnerCount = value - case "prize": - value, err := DecodeTDLibJSONGiveawayPrize(b) - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field prize: %w", err) - } - p.Prize = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGiveaway#d63e7f8e: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWinnerCount returns value of WinnerCount field. -func (p *PushMessageContentGiveaway) GetWinnerCount() (value int32) { - if p == nil { - return - } - return p.WinnerCount -} - -// GetPrize returns value of Prize field. -func (p *PushMessageContentGiveaway) GetPrize() (value GiveawayPrizeClass) { - if p == nil { - return - } - return p.Prize -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentGiveaway) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentGift represents TL type `pushMessageContentGift#84a8cd0b`. -type PushMessageContentGift struct { - // Number of Telegram Stars that sender paid for the gift - StarCount int64 -} - -// PushMessageContentGiftTypeID is TL type id of PushMessageContentGift. -const PushMessageContentGiftTypeID = 0x84a8cd0b - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentGift) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentGift. -var ( - _ bin.Encoder = &PushMessageContentGift{} - _ bin.Decoder = &PushMessageContentGift{} - _ bin.BareEncoder = &PushMessageContentGift{} - _ bin.BareDecoder = &PushMessageContentGift{} - - _ PushMessageContentClass = &PushMessageContentGift{} -) - -func (p *PushMessageContentGift) Zero() bool { - if p == nil { - return true - } - if !(p.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentGift) String() string { - if p == nil { - return "PushMessageContentGift(nil)" - } - type Alias PushMessageContentGift - return fmt.Sprintf("PushMessageContentGift%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentGift) TypeID() uint32 { - return PushMessageContentGiftTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentGift) TypeName() string { - return "pushMessageContentGift" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentGift) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentGift", - ID: PushMessageContentGiftTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentGift) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGift#84a8cd0b as nil") - } - b.PutID(PushMessageContentGiftTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentGift) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGift#84a8cd0b as nil") - } - b.PutInt53(p.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentGift) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGift#84a8cd0b to nil") - } - if err := b.ConsumeID(PushMessageContentGiftTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentGift#84a8cd0b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentGift) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGift#84a8cd0b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGift#84a8cd0b: field star_count: %w", err) - } - p.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentGift) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentGift#84a8cd0b as nil") - } - b.ObjStart() - b.PutID("pushMessageContentGift") - b.Comma() - b.FieldStart("star_count") - b.PutInt53(p.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentGift) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentGift#84a8cd0b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentGift"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentGift#84a8cd0b: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentGift#84a8cd0b: field star_count: %w", err) - } - p.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarCount returns value of StarCount field. -func (p *PushMessageContentGift) GetStarCount() (value int64) { - if p == nil { - return - } - return p.StarCount -} - -// PushMessageContentUpgradedGift represents TL type `pushMessageContentUpgradedGift#99fa0ade`. -type PushMessageContentUpgradedGift struct { - // True, if the gift was obtained by upgrading of a previously received gift; otherwise, - // this is a transferred gift - IsUpgrade bool -} - -// PushMessageContentUpgradedGiftTypeID is TL type id of PushMessageContentUpgradedGift. -const PushMessageContentUpgradedGiftTypeID = 0x99fa0ade - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentUpgradedGift) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentUpgradedGift. -var ( - _ bin.Encoder = &PushMessageContentUpgradedGift{} - _ bin.Decoder = &PushMessageContentUpgradedGift{} - _ bin.BareEncoder = &PushMessageContentUpgradedGift{} - _ bin.BareDecoder = &PushMessageContentUpgradedGift{} - - _ PushMessageContentClass = &PushMessageContentUpgradedGift{} -) - -func (p *PushMessageContentUpgradedGift) Zero() bool { - if p == nil { - return true - } - if !(p.IsUpgrade == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentUpgradedGift) String() string { - if p == nil { - return "PushMessageContentUpgradedGift(nil)" - } - type Alias PushMessageContentUpgradedGift - return fmt.Sprintf("PushMessageContentUpgradedGift%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentUpgradedGift) TypeID() uint32 { - return PushMessageContentUpgradedGiftTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentUpgradedGift) TypeName() string { - return "pushMessageContentUpgradedGift" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentUpgradedGift) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentUpgradedGift", - ID: PushMessageContentUpgradedGiftTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsUpgrade", - SchemaName: "is_upgrade", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentUpgradedGift) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentUpgradedGift#99fa0ade as nil") - } - b.PutID(PushMessageContentUpgradedGiftTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentUpgradedGift) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentUpgradedGift#99fa0ade as nil") - } - b.PutBool(p.IsUpgrade) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentUpgradedGift) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentUpgradedGift#99fa0ade to nil") - } - if err := b.ConsumeID(PushMessageContentUpgradedGiftTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentUpgradedGift) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentUpgradedGift#99fa0ade to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: field is_upgrade: %w", err) - } - p.IsUpgrade = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentUpgradedGift) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentUpgradedGift#99fa0ade as nil") - } - b.ObjStart() - b.PutID("pushMessageContentUpgradedGift") - b.Comma() - b.FieldStart("is_upgrade") - b.PutBool(p.IsUpgrade) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentUpgradedGift) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentUpgradedGift#99fa0ade to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentUpgradedGift"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: %w", err) - } - case "is_upgrade": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentUpgradedGift#99fa0ade: field is_upgrade: %w", err) - } - p.IsUpgrade = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsUpgrade returns value of IsUpgrade field. -func (p *PushMessageContentUpgradedGift) GetIsUpgrade() (value bool) { - if p == nil { - return - } - return p.IsUpgrade -} - -// PushMessageContentScreenshotTaken represents TL type `pushMessageContentScreenshotTaken#cc51ff9`. -type PushMessageContentScreenshotTaken struct { -} - -// PushMessageContentScreenshotTakenTypeID is TL type id of PushMessageContentScreenshotTaken. -const PushMessageContentScreenshotTakenTypeID = 0xcc51ff9 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentScreenshotTaken) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentScreenshotTaken. -var ( - _ bin.Encoder = &PushMessageContentScreenshotTaken{} - _ bin.Decoder = &PushMessageContentScreenshotTaken{} - _ bin.BareEncoder = &PushMessageContentScreenshotTaken{} - _ bin.BareDecoder = &PushMessageContentScreenshotTaken{} - - _ PushMessageContentClass = &PushMessageContentScreenshotTaken{} -) - -func (p *PushMessageContentScreenshotTaken) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentScreenshotTaken) String() string { - if p == nil { - return "PushMessageContentScreenshotTaken(nil)" - } - type Alias PushMessageContentScreenshotTaken - return fmt.Sprintf("PushMessageContentScreenshotTaken%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentScreenshotTaken) TypeID() uint32 { - return PushMessageContentScreenshotTakenTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentScreenshotTaken) TypeName() string { - return "pushMessageContentScreenshotTaken" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentScreenshotTaken) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentScreenshotTaken", - ID: PushMessageContentScreenshotTakenTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentScreenshotTaken) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentScreenshotTaken#cc51ff9 as nil") - } - b.PutID(PushMessageContentScreenshotTakenTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentScreenshotTaken) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentScreenshotTaken#cc51ff9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentScreenshotTaken) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentScreenshotTaken#cc51ff9 to nil") - } - if err := b.ConsumeID(PushMessageContentScreenshotTakenTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentScreenshotTaken#cc51ff9: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentScreenshotTaken) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentScreenshotTaken#cc51ff9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentScreenshotTaken) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentScreenshotTaken#cc51ff9 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentScreenshotTaken") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentScreenshotTaken) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentScreenshotTaken#cc51ff9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentScreenshotTaken"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentScreenshotTaken#cc51ff9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PushMessageContentSticker represents TL type `pushMessageContentSticker#5c98bdd3`. -type PushMessageContentSticker struct { - // Message content; may be null - Sticker Sticker - // Emoji corresponding to the sticker; may be empty - Emoji string - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentStickerTypeID is TL type id of PushMessageContentSticker. -const PushMessageContentStickerTypeID = 0x5c98bdd3 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentSticker) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentSticker. -var ( - _ bin.Encoder = &PushMessageContentSticker{} - _ bin.Decoder = &PushMessageContentSticker{} - _ bin.BareEncoder = &PushMessageContentSticker{} - _ bin.BareDecoder = &PushMessageContentSticker{} - - _ PushMessageContentClass = &PushMessageContentSticker{} -) - -func (p *PushMessageContentSticker) Zero() bool { - if p == nil { - return true - } - if !(p.Sticker.Zero()) { - return false - } - if !(p.Emoji == "") { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentSticker) String() string { - if p == nil { - return "PushMessageContentSticker(nil)" - } - type Alias PushMessageContentSticker - return fmt.Sprintf("PushMessageContentSticker%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentSticker) TypeID() uint32 { - return PushMessageContentStickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentSticker) TypeName() string { - return "pushMessageContentSticker" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentSticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentSticker", - ID: PushMessageContentStickerTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "Emoji", - SchemaName: "emoji", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentSticker) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentSticker#5c98bdd3 as nil") - } - b.PutID(PushMessageContentStickerTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentSticker) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentSticker#5c98bdd3 as nil") - } - if err := p.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentSticker#5c98bdd3: field sticker: %w", err) - } - b.PutString(p.Emoji) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentSticker) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentSticker#5c98bdd3 to nil") - } - if err := b.ConsumeID(PushMessageContentStickerTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentSticker) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentSticker#5c98bdd3 to nil") - } - { - if err := p.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field sticker: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field emoji: %w", err) - } - p.Emoji = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentSticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentSticker#5c98bdd3 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentSticker") - b.Comma() - b.FieldStart("sticker") - if err := p.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentSticker#5c98bdd3: field sticker: %w", err) - } - b.Comma() - b.FieldStart("emoji") - b.PutString(p.Emoji) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentSticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentSticker#5c98bdd3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentSticker"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: %w", err) - } - case "sticker": - if err := p.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field sticker: %w", err) - } - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field emoji: %w", err) - } - p.Emoji = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentSticker#5c98bdd3: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (p *PushMessageContentSticker) GetSticker() (value Sticker) { - if p == nil { - return - } - return p.Sticker -} - -// GetEmoji returns value of Emoji field. -func (p *PushMessageContentSticker) GetEmoji() (value string) { - if p == nil { - return - } - return p.Emoji -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentSticker) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentStory represents TL type `pushMessageContentStory#996471c9`. -type PushMessageContentStory struct { - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentStoryTypeID is TL type id of PushMessageContentStory. -const PushMessageContentStoryTypeID = 0x996471c9 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentStory) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentStory. -var ( - _ bin.Encoder = &PushMessageContentStory{} - _ bin.Decoder = &PushMessageContentStory{} - _ bin.BareEncoder = &PushMessageContentStory{} - _ bin.BareDecoder = &PushMessageContentStory{} - - _ PushMessageContentClass = &PushMessageContentStory{} -) - -func (p *PushMessageContentStory) Zero() bool { - if p == nil { - return true - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentStory) String() string { - if p == nil { - return "PushMessageContentStory(nil)" - } - type Alias PushMessageContentStory - return fmt.Sprintf("PushMessageContentStory%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentStory) TypeID() uint32 { - return PushMessageContentStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentStory) TypeName() string { - return "pushMessageContentStory" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentStory", - ID: PushMessageContentStoryTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentStory) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentStory#996471c9 as nil") - } - b.PutID(PushMessageContentStoryTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentStory) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentStory#996471c9 as nil") - } - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentStory) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentStory#996471c9 to nil") - } - if err := b.ConsumeID(PushMessageContentStoryTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentStory#996471c9: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentStory) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentStory#996471c9 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentStory#996471c9: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentStory#996471c9 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentStory") - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentStory#996471c9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentStory"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentStory#996471c9: %w", err) - } - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentStory#996471c9: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentStory) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentText represents TL type `pushMessageContentText#105ddea9`. -type PushMessageContentText struct { - // Message text - Text string - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentTextTypeID is TL type id of PushMessageContentText. -const PushMessageContentTextTypeID = 0x105ddea9 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentText) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentText. -var ( - _ bin.Encoder = &PushMessageContentText{} - _ bin.Decoder = &PushMessageContentText{} - _ bin.BareEncoder = &PushMessageContentText{} - _ bin.BareDecoder = &PushMessageContentText{} - - _ PushMessageContentClass = &PushMessageContentText{} -) - -func (p *PushMessageContentText) Zero() bool { - if p == nil { - return true - } - if !(p.Text == "") { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentText) String() string { - if p == nil { - return "PushMessageContentText(nil)" - } - type Alias PushMessageContentText - return fmt.Sprintf("PushMessageContentText%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentText) TypeID() uint32 { - return PushMessageContentTextTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentText) TypeName() string { - return "pushMessageContentText" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentText) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentText", - ID: PushMessageContentTextTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentText) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentText#105ddea9 as nil") - } - b.PutID(PushMessageContentTextTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentText) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentText#105ddea9 as nil") - } - b.PutString(p.Text) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentText) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentText#105ddea9 to nil") - } - if err := b.ConsumeID(PushMessageContentTextTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentText) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentText#105ddea9 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: field text: %w", err) - } - p.Text = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentText) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentText#105ddea9 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentText") - b.Comma() - b.FieldStart("text") - b.PutString(p.Text) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentText) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentText#105ddea9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentText"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: field text: %w", err) - } - p.Text = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentText#105ddea9: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (p *PushMessageContentText) GetText() (value string) { - if p == nil { - return - } - return p.Text -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentText) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentVideo represents TL type `pushMessageContentVideo#127ad12f`. -type PushMessageContentVideo struct { - // Message content; may be null - Video Video - // Video caption - Caption string - // True, if the video is secret - IsSecret bool - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentVideoTypeID is TL type id of PushMessageContentVideo. -const PushMessageContentVideoTypeID = 0x127ad12f - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentVideo) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentVideo. -var ( - _ bin.Encoder = &PushMessageContentVideo{} - _ bin.Decoder = &PushMessageContentVideo{} - _ bin.BareEncoder = &PushMessageContentVideo{} - _ bin.BareDecoder = &PushMessageContentVideo{} - - _ PushMessageContentClass = &PushMessageContentVideo{} -) - -func (p *PushMessageContentVideo) Zero() bool { - if p == nil { - return true - } - if !(p.Video.Zero()) { - return false - } - if !(p.Caption == "") { - return false - } - if !(p.IsSecret == false) { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentVideo) String() string { - if p == nil { - return "PushMessageContentVideo(nil)" - } - type Alias PushMessageContentVideo - return fmt.Sprintf("PushMessageContentVideo%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentVideo) TypeID() uint32 { - return PushMessageContentVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentVideo) TypeName() string { - return "pushMessageContentVideo" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentVideo", - ID: PushMessageContentVideoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Video", - SchemaName: "video", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "IsSecret", - SchemaName: "is_secret", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentVideo) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentVideo#127ad12f as nil") - } - b.PutID(PushMessageContentVideoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentVideo) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentVideo#127ad12f as nil") - } - if err := p.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentVideo#127ad12f: field video: %w", err) - } - b.PutString(p.Caption) - b.PutBool(p.IsSecret) - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentVideo) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentVideo#127ad12f to nil") - } - if err := b.ConsumeID(PushMessageContentVideoTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentVideo) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentVideo#127ad12f to nil") - } - { - if err := p.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field video: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field caption: %w", err) - } - p.Caption = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field is_secret: %w", err) - } - p.IsSecret = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentVideo#127ad12f as nil") - } - b.ObjStart() - b.PutID("pushMessageContentVideo") - b.Comma() - b.FieldStart("video") - if err := p.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentVideo#127ad12f: field video: %w", err) - } - b.Comma() - b.FieldStart("caption") - b.PutString(p.Caption) - b.Comma() - b.FieldStart("is_secret") - b.PutBool(p.IsSecret) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentVideo#127ad12f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentVideo"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: %w", err) - } - case "video": - if err := p.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field video: %w", err) - } - case "caption": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field caption: %w", err) - } - p.Caption = value - case "is_secret": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field is_secret: %w", err) - } - p.IsSecret = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideo#127ad12f: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVideo returns value of Video field. -func (p *PushMessageContentVideo) GetVideo() (value Video) { - if p == nil { - return - } - return p.Video -} - -// GetCaption returns value of Caption field. -func (p *PushMessageContentVideo) GetCaption() (value string) { - if p == nil { - return - } - return p.Caption -} - -// GetIsSecret returns value of IsSecret field. -func (p *PushMessageContentVideo) GetIsSecret() (value bool) { - if p == nil { - return - } - return p.IsSecret -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentVideo) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentVideoNote represents TL type `pushMessageContentVideoNote#bd13f97f`. -type PushMessageContentVideoNote struct { - // Message content; may be null - VideoNote VideoNote - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentVideoNoteTypeID is TL type id of PushMessageContentVideoNote. -const PushMessageContentVideoNoteTypeID = 0xbd13f97f - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentVideoNote) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentVideoNote. -var ( - _ bin.Encoder = &PushMessageContentVideoNote{} - _ bin.Decoder = &PushMessageContentVideoNote{} - _ bin.BareEncoder = &PushMessageContentVideoNote{} - _ bin.BareDecoder = &PushMessageContentVideoNote{} - - _ PushMessageContentClass = &PushMessageContentVideoNote{} -) - -func (p *PushMessageContentVideoNote) Zero() bool { - if p == nil { - return true - } - if !(p.VideoNote.Zero()) { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentVideoNote) String() string { - if p == nil { - return "PushMessageContentVideoNote(nil)" - } - type Alias PushMessageContentVideoNote - return fmt.Sprintf("PushMessageContentVideoNote%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentVideoNote) TypeID() uint32 { - return PushMessageContentVideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentVideoNote) TypeName() string { - return "pushMessageContentVideoNote" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentVideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentVideoNote", - ID: PushMessageContentVideoNoteTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VideoNote", - SchemaName: "video_note", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentVideoNote) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentVideoNote#bd13f97f as nil") - } - b.PutID(PushMessageContentVideoNoteTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentVideoNote) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentVideoNote#bd13f97f as nil") - } - if err := p.VideoNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentVideoNote#bd13f97f: field video_note: %w", err) - } - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentVideoNote) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentVideoNote#bd13f97f to nil") - } - if err := b.ConsumeID(PushMessageContentVideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentVideoNote) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentVideoNote#bd13f97f to nil") - } - { - if err := p.VideoNote.Decode(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: field video_note: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentVideoNote#bd13f97f as nil") - } - b.ObjStart() - b.PutID("pushMessageContentVideoNote") - b.Comma() - b.FieldStart("video_note") - if err := p.VideoNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentVideoNote#bd13f97f: field video_note: %w", err) - } - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentVideoNote#bd13f97f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentVideoNote"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: %w", err) - } - case "video_note": - if err := p.VideoNote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: field video_note: %w", err) - } - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentVideoNote#bd13f97f: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVideoNote returns value of VideoNote field. -func (p *PushMessageContentVideoNote) GetVideoNote() (value VideoNote) { - if p == nil { - return - } - return p.VideoNote -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentVideoNote) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentVoiceNote represents TL type `pushMessageContentVoiceNote#54cac8b`. -type PushMessageContentVoiceNote struct { - // Message content; may be null - VoiceNote VoiceNote - // True, if the message is a pinned message with the specified content - IsPinned bool -} - -// PushMessageContentVoiceNoteTypeID is TL type id of PushMessageContentVoiceNote. -const PushMessageContentVoiceNoteTypeID = 0x54cac8b - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentVoiceNote) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentVoiceNote. -var ( - _ bin.Encoder = &PushMessageContentVoiceNote{} - _ bin.Decoder = &PushMessageContentVoiceNote{} - _ bin.BareEncoder = &PushMessageContentVoiceNote{} - _ bin.BareDecoder = &PushMessageContentVoiceNote{} - - _ PushMessageContentClass = &PushMessageContentVoiceNote{} -) - -func (p *PushMessageContentVoiceNote) Zero() bool { - if p == nil { - return true - } - if !(p.VoiceNote.Zero()) { - return false - } - if !(p.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentVoiceNote) String() string { - if p == nil { - return "PushMessageContentVoiceNote(nil)" - } - type Alias PushMessageContentVoiceNote - return fmt.Sprintf("PushMessageContentVoiceNote%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentVoiceNote) TypeID() uint32 { - return PushMessageContentVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentVoiceNote) TypeName() string { - return "pushMessageContentVoiceNote" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentVoiceNote", - ID: PushMessageContentVoiceNoteTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VoiceNote", - SchemaName: "voice_note", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentVoiceNote) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentVoiceNote#54cac8b as nil") - } - b.PutID(PushMessageContentVoiceNoteTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentVoiceNote) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentVoiceNote#54cac8b as nil") - } - if err := p.VoiceNote.Encode(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentVoiceNote#54cac8b: field voice_note: %w", err) - } - b.PutBool(p.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentVoiceNote) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentVoiceNote#54cac8b to nil") - } - if err := b.ConsumeID(PushMessageContentVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentVoiceNote) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentVoiceNote#54cac8b to nil") - } - { - if err := p.VoiceNote.Decode(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: field voice_note: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: field is_pinned: %w", err) - } - p.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentVoiceNote#54cac8b as nil") - } - b.ObjStart() - b.PutID("pushMessageContentVoiceNote") - b.Comma() - b.FieldStart("voice_note") - if err := p.VoiceNote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode pushMessageContentVoiceNote#54cac8b: field voice_note: %w", err) - } - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(p.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentVoiceNote#54cac8b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentVoiceNote"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: %w", err) - } - case "voice_note": - if err := p.VoiceNote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: field voice_note: %w", err) - } - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentVoiceNote#54cac8b: field is_pinned: %w", err) - } - p.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVoiceNote returns value of VoiceNote field. -func (p *PushMessageContentVoiceNote) GetVoiceNote() (value VoiceNote) { - if p == nil { - return - } - return p.VoiceNote -} - -// GetIsPinned returns value of IsPinned field. -func (p *PushMessageContentVoiceNote) GetIsPinned() (value bool) { - if p == nil { - return - } - return p.IsPinned -} - -// PushMessageContentBasicGroupChatCreate represents TL type `pushMessageContentBasicGroupChatCreate#81f1defc`. -type PushMessageContentBasicGroupChatCreate struct { -} - -// PushMessageContentBasicGroupChatCreateTypeID is TL type id of PushMessageContentBasicGroupChatCreate. -const PushMessageContentBasicGroupChatCreateTypeID = 0x81f1defc - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentBasicGroupChatCreate) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentBasicGroupChatCreate. -var ( - _ bin.Encoder = &PushMessageContentBasicGroupChatCreate{} - _ bin.Decoder = &PushMessageContentBasicGroupChatCreate{} - _ bin.BareEncoder = &PushMessageContentBasicGroupChatCreate{} - _ bin.BareDecoder = &PushMessageContentBasicGroupChatCreate{} - - _ PushMessageContentClass = &PushMessageContentBasicGroupChatCreate{} -) - -func (p *PushMessageContentBasicGroupChatCreate) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentBasicGroupChatCreate) String() string { - if p == nil { - return "PushMessageContentBasicGroupChatCreate(nil)" - } - type Alias PushMessageContentBasicGroupChatCreate - return fmt.Sprintf("PushMessageContentBasicGroupChatCreate%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentBasicGroupChatCreate) TypeID() uint32 { - return PushMessageContentBasicGroupChatCreateTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentBasicGroupChatCreate) TypeName() string { - return "pushMessageContentBasicGroupChatCreate" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentBasicGroupChatCreate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentBasicGroupChatCreate", - ID: PushMessageContentBasicGroupChatCreateTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentBasicGroupChatCreate) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentBasicGroupChatCreate#81f1defc as nil") - } - b.PutID(PushMessageContentBasicGroupChatCreateTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentBasicGroupChatCreate) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentBasicGroupChatCreate#81f1defc as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentBasicGroupChatCreate) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentBasicGroupChatCreate#81f1defc to nil") - } - if err := b.ConsumeID(PushMessageContentBasicGroupChatCreateTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentBasicGroupChatCreate#81f1defc: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentBasicGroupChatCreate) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentBasicGroupChatCreate#81f1defc to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentBasicGroupChatCreate) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentBasicGroupChatCreate#81f1defc as nil") - } - b.ObjStart() - b.PutID("pushMessageContentBasicGroupChatCreate") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentBasicGroupChatCreate) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentBasicGroupChatCreate#81f1defc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentBasicGroupChatCreate"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentBasicGroupChatCreate#81f1defc: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PushMessageContentChatAddMembers represents TL type `pushMessageContentChatAddMembers#bf337b3a`. -type PushMessageContentChatAddMembers struct { - // Name of the added member - MemberName string - // True, if the current user was added to the group - IsCurrentUser bool - // True, if the user has returned to the group themselves - IsReturned bool -} - -// PushMessageContentChatAddMembersTypeID is TL type id of PushMessageContentChatAddMembers. -const PushMessageContentChatAddMembersTypeID = 0xbf337b3a - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentChatAddMembers) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentChatAddMembers. -var ( - _ bin.Encoder = &PushMessageContentChatAddMembers{} - _ bin.Decoder = &PushMessageContentChatAddMembers{} - _ bin.BareEncoder = &PushMessageContentChatAddMembers{} - _ bin.BareDecoder = &PushMessageContentChatAddMembers{} - - _ PushMessageContentClass = &PushMessageContentChatAddMembers{} -) - -func (p *PushMessageContentChatAddMembers) Zero() bool { - if p == nil { - return true - } - if !(p.MemberName == "") { - return false - } - if !(p.IsCurrentUser == false) { - return false - } - if !(p.IsReturned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentChatAddMembers) String() string { - if p == nil { - return "PushMessageContentChatAddMembers(nil)" - } - type Alias PushMessageContentChatAddMembers - return fmt.Sprintf("PushMessageContentChatAddMembers%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentChatAddMembers) TypeID() uint32 { - return PushMessageContentChatAddMembersTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentChatAddMembers) TypeName() string { - return "pushMessageContentChatAddMembers" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentChatAddMembers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentChatAddMembers", - ID: PushMessageContentChatAddMembersTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MemberName", - SchemaName: "member_name", - }, - { - Name: "IsCurrentUser", - SchemaName: "is_current_user", - }, - { - Name: "IsReturned", - SchemaName: "is_returned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentChatAddMembers) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatAddMembers#bf337b3a as nil") - } - b.PutID(PushMessageContentChatAddMembersTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentChatAddMembers) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatAddMembers#bf337b3a as nil") - } - b.PutString(p.MemberName) - b.PutBool(p.IsCurrentUser) - b.PutBool(p.IsReturned) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentChatAddMembers) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatAddMembers#bf337b3a to nil") - } - if err := b.ConsumeID(PushMessageContentChatAddMembersTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentChatAddMembers) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatAddMembers#bf337b3a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field member_name: %w", err) - } - p.MemberName = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field is_current_user: %w", err) - } - p.IsCurrentUser = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field is_returned: %w", err) - } - p.IsReturned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentChatAddMembers) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatAddMembers#bf337b3a as nil") - } - b.ObjStart() - b.PutID("pushMessageContentChatAddMembers") - b.Comma() - b.FieldStart("member_name") - b.PutString(p.MemberName) - b.Comma() - b.FieldStart("is_current_user") - b.PutBool(p.IsCurrentUser) - b.Comma() - b.FieldStart("is_returned") - b.PutBool(p.IsReturned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentChatAddMembers) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatAddMembers#bf337b3a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentChatAddMembers"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: %w", err) - } - case "member_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field member_name: %w", err) - } - p.MemberName = value - case "is_current_user": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field is_current_user: %w", err) - } - p.IsCurrentUser = value - case "is_returned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatAddMembers#bf337b3a: field is_returned: %w", err) - } - p.IsReturned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMemberName returns value of MemberName field. -func (p *PushMessageContentChatAddMembers) GetMemberName() (value string) { - if p == nil { - return - } - return p.MemberName -} - -// GetIsCurrentUser returns value of IsCurrentUser field. -func (p *PushMessageContentChatAddMembers) GetIsCurrentUser() (value bool) { - if p == nil { - return - } - return p.IsCurrentUser -} - -// GetIsReturned returns value of IsReturned field. -func (p *PushMessageContentChatAddMembers) GetIsReturned() (value bool) { - if p == nil { - return - } - return p.IsReturned -} - -// PushMessageContentChatChangePhoto represents TL type `pushMessageContentChatChangePhoto#bd96521d`. -type PushMessageContentChatChangePhoto struct { -} - -// PushMessageContentChatChangePhotoTypeID is TL type id of PushMessageContentChatChangePhoto. -const PushMessageContentChatChangePhotoTypeID = 0xbd96521d - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentChatChangePhoto) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentChatChangePhoto. -var ( - _ bin.Encoder = &PushMessageContentChatChangePhoto{} - _ bin.Decoder = &PushMessageContentChatChangePhoto{} - _ bin.BareEncoder = &PushMessageContentChatChangePhoto{} - _ bin.BareDecoder = &PushMessageContentChatChangePhoto{} - - _ PushMessageContentClass = &PushMessageContentChatChangePhoto{} -) - -func (p *PushMessageContentChatChangePhoto) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentChatChangePhoto) String() string { - if p == nil { - return "PushMessageContentChatChangePhoto(nil)" - } - type Alias PushMessageContentChatChangePhoto - return fmt.Sprintf("PushMessageContentChatChangePhoto%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentChatChangePhoto) TypeID() uint32 { - return PushMessageContentChatChangePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentChatChangePhoto) TypeName() string { - return "pushMessageContentChatChangePhoto" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentChatChangePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentChatChangePhoto", - ID: PushMessageContentChatChangePhotoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentChatChangePhoto) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatChangePhoto#bd96521d as nil") - } - b.PutID(PushMessageContentChatChangePhotoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentChatChangePhoto) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatChangePhoto#bd96521d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentChatChangePhoto) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatChangePhoto#bd96521d to nil") - } - if err := b.ConsumeID(PushMessageContentChatChangePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatChangePhoto#bd96521d: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentChatChangePhoto) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatChangePhoto#bd96521d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentChatChangePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatChangePhoto#bd96521d as nil") - } - b.ObjStart() - b.PutID("pushMessageContentChatChangePhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentChatChangePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatChangePhoto#bd96521d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentChatChangePhoto"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatChangePhoto#bd96521d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PushMessageContentChatChangeTitle represents TL type `pushMessageContentChatChangeTitle#8ae1f6a3`. -type PushMessageContentChatChangeTitle struct { - // New chat title - Title string -} - -// PushMessageContentChatChangeTitleTypeID is TL type id of PushMessageContentChatChangeTitle. -const PushMessageContentChatChangeTitleTypeID = 0x8ae1f6a3 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentChatChangeTitle) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentChatChangeTitle. -var ( - _ bin.Encoder = &PushMessageContentChatChangeTitle{} - _ bin.Decoder = &PushMessageContentChatChangeTitle{} - _ bin.BareEncoder = &PushMessageContentChatChangeTitle{} - _ bin.BareDecoder = &PushMessageContentChatChangeTitle{} - - _ PushMessageContentClass = &PushMessageContentChatChangeTitle{} -) - -func (p *PushMessageContentChatChangeTitle) Zero() bool { - if p == nil { - return true - } - if !(p.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentChatChangeTitle) String() string { - if p == nil { - return "PushMessageContentChatChangeTitle(nil)" - } - type Alias PushMessageContentChatChangeTitle - return fmt.Sprintf("PushMessageContentChatChangeTitle%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentChatChangeTitle) TypeID() uint32 { - return PushMessageContentChatChangeTitleTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentChatChangeTitle) TypeName() string { - return "pushMessageContentChatChangeTitle" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentChatChangeTitle) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentChatChangeTitle", - ID: PushMessageContentChatChangeTitleTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentChatChangeTitle) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatChangeTitle#8ae1f6a3 as nil") - } - b.PutID(PushMessageContentChatChangeTitleTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentChatChangeTitle) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatChangeTitle#8ae1f6a3 as nil") - } - b.PutString(p.Title) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentChatChangeTitle) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatChangeTitle#8ae1f6a3 to nil") - } - if err := b.ConsumeID(PushMessageContentChatChangeTitleTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatChangeTitle#8ae1f6a3: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentChatChangeTitle) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatChangeTitle#8ae1f6a3 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatChangeTitle#8ae1f6a3: field title: %w", err) - } - p.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentChatChangeTitle) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatChangeTitle#8ae1f6a3 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentChatChangeTitle") - b.Comma() - b.FieldStart("title") - b.PutString(p.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentChatChangeTitle) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatChangeTitle#8ae1f6a3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentChatChangeTitle"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatChangeTitle#8ae1f6a3: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatChangeTitle#8ae1f6a3: field title: %w", err) - } - p.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (p *PushMessageContentChatChangeTitle) GetTitle() (value string) { - if p == nil { - return - } - return p.Title -} - -// PushMessageContentChatSetBackground represents TL type `pushMessageContentChatSetBackground#a72b56e3`. -type PushMessageContentChatSetBackground struct { - // True, if the set background is the same as the background of the current user - IsSame bool -} - -// PushMessageContentChatSetBackgroundTypeID is TL type id of PushMessageContentChatSetBackground. -const PushMessageContentChatSetBackgroundTypeID = 0xa72b56e3 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentChatSetBackground) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentChatSetBackground. -var ( - _ bin.Encoder = &PushMessageContentChatSetBackground{} - _ bin.Decoder = &PushMessageContentChatSetBackground{} - _ bin.BareEncoder = &PushMessageContentChatSetBackground{} - _ bin.BareDecoder = &PushMessageContentChatSetBackground{} - - _ PushMessageContentClass = &PushMessageContentChatSetBackground{} -) - -func (p *PushMessageContentChatSetBackground) Zero() bool { - if p == nil { - return true - } - if !(p.IsSame == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentChatSetBackground) String() string { - if p == nil { - return "PushMessageContentChatSetBackground(nil)" - } - type Alias PushMessageContentChatSetBackground - return fmt.Sprintf("PushMessageContentChatSetBackground%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentChatSetBackground) TypeID() uint32 { - return PushMessageContentChatSetBackgroundTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentChatSetBackground) TypeName() string { - return "pushMessageContentChatSetBackground" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentChatSetBackground) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentChatSetBackground", - ID: PushMessageContentChatSetBackgroundTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsSame", - SchemaName: "is_same", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentChatSetBackground) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatSetBackground#a72b56e3 as nil") - } - b.PutID(PushMessageContentChatSetBackgroundTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentChatSetBackground) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatSetBackground#a72b56e3 as nil") - } - b.PutBool(p.IsSame) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentChatSetBackground) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatSetBackground#a72b56e3 to nil") - } - if err := b.ConsumeID(PushMessageContentChatSetBackgroundTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatSetBackground#a72b56e3: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentChatSetBackground) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatSetBackground#a72b56e3 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatSetBackground#a72b56e3: field is_same: %w", err) - } - p.IsSame = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentChatSetBackground) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatSetBackground#a72b56e3 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentChatSetBackground") - b.Comma() - b.FieldStart("is_same") - b.PutBool(p.IsSame) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentChatSetBackground) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatSetBackground#a72b56e3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentChatSetBackground"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatSetBackground#a72b56e3: %w", err) - } - case "is_same": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatSetBackground#a72b56e3: field is_same: %w", err) - } - p.IsSame = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsSame returns value of IsSame field. -func (p *PushMessageContentChatSetBackground) GetIsSame() (value bool) { - if p == nil { - return - } - return p.IsSame -} - -// PushMessageContentChatSetTheme represents TL type `pushMessageContentChatSetTheme#a5d3b68`. -type PushMessageContentChatSetTheme struct { - // If non-empty, name of a new theme, set for the chat. Otherwise, the chat theme was - // reset to the default one - ThemeName string -} - -// PushMessageContentChatSetThemeTypeID is TL type id of PushMessageContentChatSetTheme. -const PushMessageContentChatSetThemeTypeID = 0xa5d3b68 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentChatSetTheme) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentChatSetTheme. -var ( - _ bin.Encoder = &PushMessageContentChatSetTheme{} - _ bin.Decoder = &PushMessageContentChatSetTheme{} - _ bin.BareEncoder = &PushMessageContentChatSetTheme{} - _ bin.BareDecoder = &PushMessageContentChatSetTheme{} - - _ PushMessageContentClass = &PushMessageContentChatSetTheme{} -) - -func (p *PushMessageContentChatSetTheme) Zero() bool { - if p == nil { - return true - } - if !(p.ThemeName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentChatSetTheme) String() string { - if p == nil { - return "PushMessageContentChatSetTheme(nil)" - } - type Alias PushMessageContentChatSetTheme - return fmt.Sprintf("PushMessageContentChatSetTheme%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentChatSetTheme) TypeID() uint32 { - return PushMessageContentChatSetThemeTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentChatSetTheme) TypeName() string { - return "pushMessageContentChatSetTheme" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentChatSetTheme) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentChatSetTheme", - ID: PushMessageContentChatSetThemeTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ThemeName", - SchemaName: "theme_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentChatSetTheme) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatSetTheme#a5d3b68 as nil") - } - b.PutID(PushMessageContentChatSetThemeTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentChatSetTheme) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatSetTheme#a5d3b68 as nil") - } - b.PutString(p.ThemeName) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentChatSetTheme) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatSetTheme#a5d3b68 to nil") - } - if err := b.ConsumeID(PushMessageContentChatSetThemeTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatSetTheme#a5d3b68: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentChatSetTheme) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatSetTheme#a5d3b68 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatSetTheme#a5d3b68: field theme_name: %w", err) - } - p.ThemeName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentChatSetTheme) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatSetTheme#a5d3b68 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentChatSetTheme") - b.Comma() - b.FieldStart("theme_name") - b.PutString(p.ThemeName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentChatSetTheme) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatSetTheme#a5d3b68 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentChatSetTheme"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatSetTheme#a5d3b68: %w", err) - } - case "theme_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatSetTheme#a5d3b68: field theme_name: %w", err) - } - p.ThemeName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetThemeName returns value of ThemeName field. -func (p *PushMessageContentChatSetTheme) GetThemeName() (value string) { - if p == nil { - return - } - return p.ThemeName -} - -// PushMessageContentChatDeleteMember represents TL type `pushMessageContentChatDeleteMember#23afa99f`. -type PushMessageContentChatDeleteMember struct { - // Name of the deleted member - MemberName string - // True, if the current user was deleted from the group - IsCurrentUser bool - // True, if the user has left the group themselves - IsLeft bool -} - -// PushMessageContentChatDeleteMemberTypeID is TL type id of PushMessageContentChatDeleteMember. -const PushMessageContentChatDeleteMemberTypeID = 0x23afa99f - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentChatDeleteMember) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentChatDeleteMember. -var ( - _ bin.Encoder = &PushMessageContentChatDeleteMember{} - _ bin.Decoder = &PushMessageContentChatDeleteMember{} - _ bin.BareEncoder = &PushMessageContentChatDeleteMember{} - _ bin.BareDecoder = &PushMessageContentChatDeleteMember{} - - _ PushMessageContentClass = &PushMessageContentChatDeleteMember{} -) - -func (p *PushMessageContentChatDeleteMember) Zero() bool { - if p == nil { - return true - } - if !(p.MemberName == "") { - return false - } - if !(p.IsCurrentUser == false) { - return false - } - if !(p.IsLeft == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentChatDeleteMember) String() string { - if p == nil { - return "PushMessageContentChatDeleteMember(nil)" - } - type Alias PushMessageContentChatDeleteMember - return fmt.Sprintf("PushMessageContentChatDeleteMember%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentChatDeleteMember) TypeID() uint32 { - return PushMessageContentChatDeleteMemberTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentChatDeleteMember) TypeName() string { - return "pushMessageContentChatDeleteMember" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentChatDeleteMember) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentChatDeleteMember", - ID: PushMessageContentChatDeleteMemberTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MemberName", - SchemaName: "member_name", - }, - { - Name: "IsCurrentUser", - SchemaName: "is_current_user", - }, - { - Name: "IsLeft", - SchemaName: "is_left", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentChatDeleteMember) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatDeleteMember#23afa99f as nil") - } - b.PutID(PushMessageContentChatDeleteMemberTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentChatDeleteMember) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatDeleteMember#23afa99f as nil") - } - b.PutString(p.MemberName) - b.PutBool(p.IsCurrentUser) - b.PutBool(p.IsLeft) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentChatDeleteMember) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatDeleteMember#23afa99f to nil") - } - if err := b.ConsumeID(PushMessageContentChatDeleteMemberTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentChatDeleteMember) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatDeleteMember#23afa99f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field member_name: %w", err) - } - p.MemberName = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field is_current_user: %w", err) - } - p.IsCurrentUser = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field is_left: %w", err) - } - p.IsLeft = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentChatDeleteMember) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatDeleteMember#23afa99f as nil") - } - b.ObjStart() - b.PutID("pushMessageContentChatDeleteMember") - b.Comma() - b.FieldStart("member_name") - b.PutString(p.MemberName) - b.Comma() - b.FieldStart("is_current_user") - b.PutBool(p.IsCurrentUser) - b.Comma() - b.FieldStart("is_left") - b.PutBool(p.IsLeft) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentChatDeleteMember) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatDeleteMember#23afa99f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentChatDeleteMember"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: %w", err) - } - case "member_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field member_name: %w", err) - } - p.MemberName = value - case "is_current_user": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field is_current_user: %w", err) - } - p.IsCurrentUser = value - case "is_left": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatDeleteMember#23afa99f: field is_left: %w", err) - } - p.IsLeft = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMemberName returns value of MemberName field. -func (p *PushMessageContentChatDeleteMember) GetMemberName() (value string) { - if p == nil { - return - } - return p.MemberName -} - -// GetIsCurrentUser returns value of IsCurrentUser field. -func (p *PushMessageContentChatDeleteMember) GetIsCurrentUser() (value bool) { - if p == nil { - return - } - return p.IsCurrentUser -} - -// GetIsLeft returns value of IsLeft field. -func (p *PushMessageContentChatDeleteMember) GetIsLeft() (value bool) { - if p == nil { - return - } - return p.IsLeft -} - -// PushMessageContentChatJoinByLink represents TL type `pushMessageContentChatJoinByLink#5c9bdf49`. -type PushMessageContentChatJoinByLink struct { -} - -// PushMessageContentChatJoinByLinkTypeID is TL type id of PushMessageContentChatJoinByLink. -const PushMessageContentChatJoinByLinkTypeID = 0x5c9bdf49 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentChatJoinByLink) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentChatJoinByLink. -var ( - _ bin.Encoder = &PushMessageContentChatJoinByLink{} - _ bin.Decoder = &PushMessageContentChatJoinByLink{} - _ bin.BareEncoder = &PushMessageContentChatJoinByLink{} - _ bin.BareDecoder = &PushMessageContentChatJoinByLink{} - - _ PushMessageContentClass = &PushMessageContentChatJoinByLink{} -) - -func (p *PushMessageContentChatJoinByLink) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentChatJoinByLink) String() string { - if p == nil { - return "PushMessageContentChatJoinByLink(nil)" - } - type Alias PushMessageContentChatJoinByLink - return fmt.Sprintf("PushMessageContentChatJoinByLink%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentChatJoinByLink) TypeID() uint32 { - return PushMessageContentChatJoinByLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentChatJoinByLink) TypeName() string { - return "pushMessageContentChatJoinByLink" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentChatJoinByLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentChatJoinByLink", - ID: PushMessageContentChatJoinByLinkTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentChatJoinByLink) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatJoinByLink#5c9bdf49 as nil") - } - b.PutID(PushMessageContentChatJoinByLinkTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentChatJoinByLink) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatJoinByLink#5c9bdf49 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentChatJoinByLink) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatJoinByLink#5c9bdf49 to nil") - } - if err := b.ConsumeID(PushMessageContentChatJoinByLinkTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatJoinByLink#5c9bdf49: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentChatJoinByLink) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatJoinByLink#5c9bdf49 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentChatJoinByLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatJoinByLink#5c9bdf49 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentChatJoinByLink") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentChatJoinByLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatJoinByLink#5c9bdf49 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentChatJoinByLink"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatJoinByLink#5c9bdf49: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PushMessageContentChatJoinByRequest represents TL type `pushMessageContentChatJoinByRequest#f3bb6175`. -type PushMessageContentChatJoinByRequest struct { -} - -// PushMessageContentChatJoinByRequestTypeID is TL type id of PushMessageContentChatJoinByRequest. -const PushMessageContentChatJoinByRequestTypeID = 0xf3bb6175 - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentChatJoinByRequest) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentChatJoinByRequest. -var ( - _ bin.Encoder = &PushMessageContentChatJoinByRequest{} - _ bin.Decoder = &PushMessageContentChatJoinByRequest{} - _ bin.BareEncoder = &PushMessageContentChatJoinByRequest{} - _ bin.BareDecoder = &PushMessageContentChatJoinByRequest{} - - _ PushMessageContentClass = &PushMessageContentChatJoinByRequest{} -) - -func (p *PushMessageContentChatJoinByRequest) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentChatJoinByRequest) String() string { - if p == nil { - return "PushMessageContentChatJoinByRequest(nil)" - } - type Alias PushMessageContentChatJoinByRequest - return fmt.Sprintf("PushMessageContentChatJoinByRequest%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentChatJoinByRequest) TypeID() uint32 { - return PushMessageContentChatJoinByRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentChatJoinByRequest) TypeName() string { - return "pushMessageContentChatJoinByRequest" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentChatJoinByRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentChatJoinByRequest", - ID: PushMessageContentChatJoinByRequestTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentChatJoinByRequest) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatJoinByRequest#f3bb6175 as nil") - } - b.PutID(PushMessageContentChatJoinByRequestTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentChatJoinByRequest) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatJoinByRequest#f3bb6175 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentChatJoinByRequest) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatJoinByRequest#f3bb6175 to nil") - } - if err := b.ConsumeID(PushMessageContentChatJoinByRequestTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatJoinByRequest#f3bb6175: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentChatJoinByRequest) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatJoinByRequest#f3bb6175 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentChatJoinByRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentChatJoinByRequest#f3bb6175 as nil") - } - b.ObjStart() - b.PutID("pushMessageContentChatJoinByRequest") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentChatJoinByRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentChatJoinByRequest#f3bb6175 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentChatJoinByRequest"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentChatJoinByRequest#f3bb6175: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PushMessageContentRecurringPayment represents TL type `pushMessageContentRecurringPayment#6083361a`. -type PushMessageContentRecurringPayment struct { - // The paid amount - Amount string -} - -// PushMessageContentRecurringPaymentTypeID is TL type id of PushMessageContentRecurringPayment. -const PushMessageContentRecurringPaymentTypeID = 0x6083361a - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentRecurringPayment) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentRecurringPayment. -var ( - _ bin.Encoder = &PushMessageContentRecurringPayment{} - _ bin.Decoder = &PushMessageContentRecurringPayment{} - _ bin.BareEncoder = &PushMessageContentRecurringPayment{} - _ bin.BareDecoder = &PushMessageContentRecurringPayment{} - - _ PushMessageContentClass = &PushMessageContentRecurringPayment{} -) - -func (p *PushMessageContentRecurringPayment) Zero() bool { - if p == nil { - return true - } - if !(p.Amount == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentRecurringPayment) String() string { - if p == nil { - return "PushMessageContentRecurringPayment(nil)" - } - type Alias PushMessageContentRecurringPayment - return fmt.Sprintf("PushMessageContentRecurringPayment%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentRecurringPayment) TypeID() uint32 { - return PushMessageContentRecurringPaymentTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentRecurringPayment) TypeName() string { - return "pushMessageContentRecurringPayment" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentRecurringPayment) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentRecurringPayment", - ID: PushMessageContentRecurringPaymentTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Amount", - SchemaName: "amount", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentRecurringPayment) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentRecurringPayment#6083361a as nil") - } - b.PutID(PushMessageContentRecurringPaymentTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentRecurringPayment) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentRecurringPayment#6083361a as nil") - } - b.PutString(p.Amount) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentRecurringPayment) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentRecurringPayment#6083361a to nil") - } - if err := b.ConsumeID(PushMessageContentRecurringPaymentTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentRecurringPayment#6083361a: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentRecurringPayment) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentRecurringPayment#6083361a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentRecurringPayment#6083361a: field amount: %w", err) - } - p.Amount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentRecurringPayment) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentRecurringPayment#6083361a as nil") - } - b.ObjStart() - b.PutID("pushMessageContentRecurringPayment") - b.Comma() - b.FieldStart("amount") - b.PutString(p.Amount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentRecurringPayment) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentRecurringPayment#6083361a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentRecurringPayment"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentRecurringPayment#6083361a: %w", err) - } - case "amount": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentRecurringPayment#6083361a: field amount: %w", err) - } - p.Amount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAmount returns value of Amount field. -func (p *PushMessageContentRecurringPayment) GetAmount() (value string) { - if p == nil { - return - } - return p.Amount -} - -// PushMessageContentSuggestProfilePhoto represents TL type `pushMessageContentSuggestProfilePhoto#7d6bf0ab`. -type PushMessageContentSuggestProfilePhoto struct { -} - -// PushMessageContentSuggestProfilePhotoTypeID is TL type id of PushMessageContentSuggestProfilePhoto. -const PushMessageContentSuggestProfilePhotoTypeID = 0x7d6bf0ab - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentSuggestProfilePhoto) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentSuggestProfilePhoto. -var ( - _ bin.Encoder = &PushMessageContentSuggestProfilePhoto{} - _ bin.Decoder = &PushMessageContentSuggestProfilePhoto{} - _ bin.BareEncoder = &PushMessageContentSuggestProfilePhoto{} - _ bin.BareDecoder = &PushMessageContentSuggestProfilePhoto{} - - _ PushMessageContentClass = &PushMessageContentSuggestProfilePhoto{} -) - -func (p *PushMessageContentSuggestProfilePhoto) Zero() bool { - if p == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentSuggestProfilePhoto) String() string { - if p == nil { - return "PushMessageContentSuggestProfilePhoto(nil)" - } - type Alias PushMessageContentSuggestProfilePhoto - return fmt.Sprintf("PushMessageContentSuggestProfilePhoto%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentSuggestProfilePhoto) TypeID() uint32 { - return PushMessageContentSuggestProfilePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentSuggestProfilePhoto) TypeName() string { - return "pushMessageContentSuggestProfilePhoto" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentSuggestProfilePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentSuggestProfilePhoto", - ID: PushMessageContentSuggestProfilePhotoTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentSuggestProfilePhoto) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentSuggestProfilePhoto#7d6bf0ab as nil") - } - b.PutID(PushMessageContentSuggestProfilePhotoTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentSuggestProfilePhoto) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentSuggestProfilePhoto#7d6bf0ab as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentSuggestProfilePhoto) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentSuggestProfilePhoto#7d6bf0ab to nil") - } - if err := b.ConsumeID(PushMessageContentSuggestProfilePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentSuggestProfilePhoto#7d6bf0ab: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentSuggestProfilePhoto) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentSuggestProfilePhoto#7d6bf0ab to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentSuggestProfilePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentSuggestProfilePhoto#7d6bf0ab as nil") - } - b.ObjStart() - b.PutID("pushMessageContentSuggestProfilePhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentSuggestProfilePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentSuggestProfilePhoto#7d6bf0ab to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentSuggestProfilePhoto"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentSuggestProfilePhoto#7d6bf0ab: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// PushMessageContentMessageForwards represents TL type `pushMessageContentMessageForwards#8df8a81c`. -type PushMessageContentMessageForwards struct { - // Number of forwarded messages - TotalCount int32 -} - -// PushMessageContentMessageForwardsTypeID is TL type id of PushMessageContentMessageForwards. -const PushMessageContentMessageForwardsTypeID = 0x8df8a81c - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentMessageForwards) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentMessageForwards. -var ( - _ bin.Encoder = &PushMessageContentMessageForwards{} - _ bin.Decoder = &PushMessageContentMessageForwards{} - _ bin.BareEncoder = &PushMessageContentMessageForwards{} - _ bin.BareDecoder = &PushMessageContentMessageForwards{} - - _ PushMessageContentClass = &PushMessageContentMessageForwards{} -) - -func (p *PushMessageContentMessageForwards) Zero() bool { - if p == nil { - return true - } - if !(p.TotalCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentMessageForwards) String() string { - if p == nil { - return "PushMessageContentMessageForwards(nil)" - } - type Alias PushMessageContentMessageForwards - return fmt.Sprintf("PushMessageContentMessageForwards%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentMessageForwards) TypeID() uint32 { - return PushMessageContentMessageForwardsTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentMessageForwards) TypeName() string { - return "pushMessageContentMessageForwards" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentMessageForwards) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentMessageForwards", - ID: PushMessageContentMessageForwardsTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentMessageForwards) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentMessageForwards#8df8a81c as nil") - } - b.PutID(PushMessageContentMessageForwardsTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentMessageForwards) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentMessageForwards#8df8a81c as nil") - } - b.PutInt32(p.TotalCount) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentMessageForwards) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentMessageForwards#8df8a81c to nil") - } - if err := b.ConsumeID(PushMessageContentMessageForwardsTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentMessageForwards#8df8a81c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentMessageForwards) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentMessageForwards#8df8a81c to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMessageForwards#8df8a81c: field total_count: %w", err) - } - p.TotalCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentMessageForwards) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentMessageForwards#8df8a81c as nil") - } - b.ObjStart() - b.PutID("pushMessageContentMessageForwards") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(p.TotalCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentMessageForwards) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentMessageForwards#8df8a81c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentMessageForwards"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentMessageForwards#8df8a81c: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMessageForwards#8df8a81c: field total_count: %w", err) - } - p.TotalCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (p *PushMessageContentMessageForwards) GetTotalCount() (value int32) { - if p == nil { - return - } - return p.TotalCount -} - -// PushMessageContentMediaAlbum represents TL type `pushMessageContentMediaAlbum#d363e96f`. -type PushMessageContentMediaAlbum struct { - // Number of messages in the album - TotalCount int32 - // True, if the album has at least one photo - HasPhotos bool - // True, if the album has at least one video file - HasVideos bool - // True, if the album has at least one audio file - HasAudios bool - // True, if the album has at least one document - HasDocuments bool -} - -// PushMessageContentMediaAlbumTypeID is TL type id of PushMessageContentMediaAlbum. -const PushMessageContentMediaAlbumTypeID = 0xd363e96f - -// construct implements constructor of PushMessageContentClass. -func (p PushMessageContentMediaAlbum) construct() PushMessageContentClass { return &p } - -// Ensuring interfaces in compile-time for PushMessageContentMediaAlbum. -var ( - _ bin.Encoder = &PushMessageContentMediaAlbum{} - _ bin.Decoder = &PushMessageContentMediaAlbum{} - _ bin.BareEncoder = &PushMessageContentMediaAlbum{} - _ bin.BareDecoder = &PushMessageContentMediaAlbum{} - - _ PushMessageContentClass = &PushMessageContentMediaAlbum{} -) - -func (p *PushMessageContentMediaAlbum) Zero() bool { - if p == nil { - return true - } - if !(p.TotalCount == 0) { - return false - } - if !(p.HasPhotos == false) { - return false - } - if !(p.HasVideos == false) { - return false - } - if !(p.HasAudios == false) { - return false - } - if !(p.HasDocuments == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushMessageContentMediaAlbum) String() string { - if p == nil { - return "PushMessageContentMediaAlbum(nil)" - } - type Alias PushMessageContentMediaAlbum - return fmt.Sprintf("PushMessageContentMediaAlbum%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushMessageContentMediaAlbum) TypeID() uint32 { - return PushMessageContentMediaAlbumTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushMessageContentMediaAlbum) TypeName() string { - return "pushMessageContentMediaAlbum" -} - -// TypeInfo returns info about TL type. -func (p *PushMessageContentMediaAlbum) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushMessageContentMediaAlbum", - ID: PushMessageContentMediaAlbumTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "HasPhotos", - SchemaName: "has_photos", - }, - { - Name: "HasVideos", - SchemaName: "has_videos", - }, - { - Name: "HasAudios", - SchemaName: "has_audios", - }, - { - Name: "HasDocuments", - SchemaName: "has_documents", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushMessageContentMediaAlbum) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentMediaAlbum#d363e96f as nil") - } - b.PutID(PushMessageContentMediaAlbumTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushMessageContentMediaAlbum) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentMediaAlbum#d363e96f as nil") - } - b.PutInt32(p.TotalCount) - b.PutBool(p.HasPhotos) - b.PutBool(p.HasVideos) - b.PutBool(p.HasAudios) - b.PutBool(p.HasDocuments) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushMessageContentMediaAlbum) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentMediaAlbum#d363e96f to nil") - } - if err := b.ConsumeID(PushMessageContentMediaAlbumTypeID); err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushMessageContentMediaAlbum) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentMediaAlbum#d363e96f to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field total_count: %w", err) - } - p.TotalCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_photos: %w", err) - } - p.HasPhotos = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_videos: %w", err) - } - p.HasVideos = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_audios: %w", err) - } - p.HasAudios = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_documents: %w", err) - } - p.HasDocuments = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushMessageContentMediaAlbum) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushMessageContentMediaAlbum#d363e96f as nil") - } - b.ObjStart() - b.PutID("pushMessageContentMediaAlbum") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(p.TotalCount) - b.Comma() - b.FieldStart("has_photos") - b.PutBool(p.HasPhotos) - b.Comma() - b.FieldStart("has_videos") - b.PutBool(p.HasVideos) - b.Comma() - b.FieldStart("has_audios") - b.PutBool(p.HasAudios) - b.Comma() - b.FieldStart("has_documents") - b.PutBool(p.HasDocuments) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushMessageContentMediaAlbum) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushMessageContentMediaAlbum#d363e96f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushMessageContentMediaAlbum"); err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field total_count: %w", err) - } - p.TotalCount = value - case "has_photos": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_photos: %w", err) - } - p.HasPhotos = value - case "has_videos": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_videos: %w", err) - } - p.HasVideos = value - case "has_audios": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_audios: %w", err) - } - p.HasAudios = value - case "has_documents": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode pushMessageContentMediaAlbum#d363e96f: field has_documents: %w", err) - } - p.HasDocuments = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (p *PushMessageContentMediaAlbum) GetTotalCount() (value int32) { - if p == nil { - return - } - return p.TotalCount -} - -// GetHasPhotos returns value of HasPhotos field. -func (p *PushMessageContentMediaAlbum) GetHasPhotos() (value bool) { - if p == nil { - return - } - return p.HasPhotos -} - -// GetHasVideos returns value of HasVideos field. -func (p *PushMessageContentMediaAlbum) GetHasVideos() (value bool) { - if p == nil { - return - } - return p.HasVideos -} - -// GetHasAudios returns value of HasAudios field. -func (p *PushMessageContentMediaAlbum) GetHasAudios() (value bool) { - if p == nil { - return - } - return p.HasAudios -} - -// GetHasDocuments returns value of HasDocuments field. -func (p *PushMessageContentMediaAlbum) GetHasDocuments() (value bool) { - if p == nil { - return - } - return p.HasDocuments -} - -// PushMessageContentClassName is schema name of PushMessageContentClass. -const PushMessageContentClassName = "PushMessageContent" - -// PushMessageContentClass represents PushMessageContent generic type. -// -// Example: -// -// g, err := tdapi.DecodePushMessageContent(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.PushMessageContentHidden: // pushMessageContentHidden#ed1bb85c -// case *tdapi.PushMessageContentAnimation: // pushMessageContentAnimation#3da4dfe4 -// case *tdapi.PushMessageContentAudio: // pushMessageContentAudio#16be7872 -// case *tdapi.PushMessageContentContact: // pushMessageContentContact#ff458a54 -// case *tdapi.PushMessageContentContactRegistered: // pushMessageContentContactRegistered#ede1e5a0 -// case *tdapi.PushMessageContentDocument: // pushMessageContentDocument#e4adae01 -// case *tdapi.PushMessageContentGame: // pushMessageContentGame#e14bb91b -// case *tdapi.PushMessageContentGameScore: // pushMessageContentGameScore#35b8cd88 -// case *tdapi.PushMessageContentInvoice: // pushMessageContentInvoice#98c88bbc -// case *tdapi.PushMessageContentLocation: // pushMessageContentLocation#b33a97b3 -// case *tdapi.PushMessageContentPaidMedia: // pushMessageContentPaidMedia#b556e74a -// case *tdapi.PushMessageContentPhoto: // pushMessageContentPhoto#861dc52 -// case *tdapi.PushMessageContentPoll: // pushMessageContentPoll#fd5a743a -// case *tdapi.PushMessageContentPremiumGiftCode: // pushMessageContentPremiumGiftCode#18a15025 -// case *tdapi.PushMessageContentGiveaway: // pushMessageContentGiveaway#d63e7f8e -// case *tdapi.PushMessageContentGift: // pushMessageContentGift#84a8cd0b -// case *tdapi.PushMessageContentUpgradedGift: // pushMessageContentUpgradedGift#99fa0ade -// case *tdapi.PushMessageContentScreenshotTaken: // pushMessageContentScreenshotTaken#cc51ff9 -// case *tdapi.PushMessageContentSticker: // pushMessageContentSticker#5c98bdd3 -// case *tdapi.PushMessageContentStory: // pushMessageContentStory#996471c9 -// case *tdapi.PushMessageContentText: // pushMessageContentText#105ddea9 -// case *tdapi.PushMessageContentVideo: // pushMessageContentVideo#127ad12f -// case *tdapi.PushMessageContentVideoNote: // pushMessageContentVideoNote#bd13f97f -// case *tdapi.PushMessageContentVoiceNote: // pushMessageContentVoiceNote#54cac8b -// case *tdapi.PushMessageContentBasicGroupChatCreate: // pushMessageContentBasicGroupChatCreate#81f1defc -// case *tdapi.PushMessageContentChatAddMembers: // pushMessageContentChatAddMembers#bf337b3a -// case *tdapi.PushMessageContentChatChangePhoto: // pushMessageContentChatChangePhoto#bd96521d -// case *tdapi.PushMessageContentChatChangeTitle: // pushMessageContentChatChangeTitle#8ae1f6a3 -// case *tdapi.PushMessageContentChatSetBackground: // pushMessageContentChatSetBackground#a72b56e3 -// case *tdapi.PushMessageContentChatSetTheme: // pushMessageContentChatSetTheme#a5d3b68 -// case *tdapi.PushMessageContentChatDeleteMember: // pushMessageContentChatDeleteMember#23afa99f -// case *tdapi.PushMessageContentChatJoinByLink: // pushMessageContentChatJoinByLink#5c9bdf49 -// case *tdapi.PushMessageContentChatJoinByRequest: // pushMessageContentChatJoinByRequest#f3bb6175 -// case *tdapi.PushMessageContentRecurringPayment: // pushMessageContentRecurringPayment#6083361a -// case *tdapi.PushMessageContentSuggestProfilePhoto: // pushMessageContentSuggestProfilePhoto#7d6bf0ab -// case *tdapi.PushMessageContentMessageForwards: // pushMessageContentMessageForwards#8df8a81c -// case *tdapi.PushMessageContentMediaAlbum: // pushMessageContentMediaAlbum#d363e96f -// default: panic(v) -// } -type PushMessageContentClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() PushMessageContentClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodePushMessageContent implements binary de-serialization for PushMessageContentClass. -func DecodePushMessageContent(buf *bin.Buffer) (PushMessageContentClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case PushMessageContentHiddenTypeID: - // Decoding pushMessageContentHidden#ed1bb85c. - v := PushMessageContentHidden{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentAnimationTypeID: - // Decoding pushMessageContentAnimation#3da4dfe4. - v := PushMessageContentAnimation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentAudioTypeID: - // Decoding pushMessageContentAudio#16be7872. - v := PushMessageContentAudio{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentContactTypeID: - // Decoding pushMessageContentContact#ff458a54. - v := PushMessageContentContact{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentContactRegisteredTypeID: - // Decoding pushMessageContentContactRegistered#ede1e5a0. - v := PushMessageContentContactRegistered{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentDocumentTypeID: - // Decoding pushMessageContentDocument#e4adae01. - v := PushMessageContentDocument{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentGameTypeID: - // Decoding pushMessageContentGame#e14bb91b. - v := PushMessageContentGame{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentGameScoreTypeID: - // Decoding pushMessageContentGameScore#35b8cd88. - v := PushMessageContentGameScore{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentInvoiceTypeID: - // Decoding pushMessageContentInvoice#98c88bbc. - v := PushMessageContentInvoice{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentLocationTypeID: - // Decoding pushMessageContentLocation#b33a97b3. - v := PushMessageContentLocation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentPaidMediaTypeID: - // Decoding pushMessageContentPaidMedia#b556e74a. - v := PushMessageContentPaidMedia{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentPhotoTypeID: - // Decoding pushMessageContentPhoto#861dc52. - v := PushMessageContentPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentPollTypeID: - // Decoding pushMessageContentPoll#fd5a743a. - v := PushMessageContentPoll{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentPremiumGiftCodeTypeID: - // Decoding pushMessageContentPremiumGiftCode#18a15025. - v := PushMessageContentPremiumGiftCode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentGiveawayTypeID: - // Decoding pushMessageContentGiveaway#d63e7f8e. - v := PushMessageContentGiveaway{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentGiftTypeID: - // Decoding pushMessageContentGift#84a8cd0b. - v := PushMessageContentGift{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentUpgradedGiftTypeID: - // Decoding pushMessageContentUpgradedGift#99fa0ade. - v := PushMessageContentUpgradedGift{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentScreenshotTakenTypeID: - // Decoding pushMessageContentScreenshotTaken#cc51ff9. - v := PushMessageContentScreenshotTaken{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentStickerTypeID: - // Decoding pushMessageContentSticker#5c98bdd3. - v := PushMessageContentSticker{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentStoryTypeID: - // Decoding pushMessageContentStory#996471c9. - v := PushMessageContentStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentTextTypeID: - // Decoding pushMessageContentText#105ddea9. - v := PushMessageContentText{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentVideoTypeID: - // Decoding pushMessageContentVideo#127ad12f. - v := PushMessageContentVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentVideoNoteTypeID: - // Decoding pushMessageContentVideoNote#bd13f97f. - v := PushMessageContentVideoNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentVoiceNoteTypeID: - // Decoding pushMessageContentVoiceNote#54cac8b. - v := PushMessageContentVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentBasicGroupChatCreateTypeID: - // Decoding pushMessageContentBasicGroupChatCreate#81f1defc. - v := PushMessageContentBasicGroupChatCreate{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentChatAddMembersTypeID: - // Decoding pushMessageContentChatAddMembers#bf337b3a. - v := PushMessageContentChatAddMembers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentChatChangePhotoTypeID: - // Decoding pushMessageContentChatChangePhoto#bd96521d. - v := PushMessageContentChatChangePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentChatChangeTitleTypeID: - // Decoding pushMessageContentChatChangeTitle#8ae1f6a3. - v := PushMessageContentChatChangeTitle{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentChatSetBackgroundTypeID: - // Decoding pushMessageContentChatSetBackground#a72b56e3. - v := PushMessageContentChatSetBackground{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentChatSetThemeTypeID: - // Decoding pushMessageContentChatSetTheme#a5d3b68. - v := PushMessageContentChatSetTheme{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentChatDeleteMemberTypeID: - // Decoding pushMessageContentChatDeleteMember#23afa99f. - v := PushMessageContentChatDeleteMember{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentChatJoinByLinkTypeID: - // Decoding pushMessageContentChatJoinByLink#5c9bdf49. - v := PushMessageContentChatJoinByLink{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentChatJoinByRequestTypeID: - // Decoding pushMessageContentChatJoinByRequest#f3bb6175. - v := PushMessageContentChatJoinByRequest{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentRecurringPaymentTypeID: - // Decoding pushMessageContentRecurringPayment#6083361a. - v := PushMessageContentRecurringPayment{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentSuggestProfilePhotoTypeID: - // Decoding pushMessageContentSuggestProfilePhoto#7d6bf0ab. - v := PushMessageContentSuggestProfilePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentMessageForwardsTypeID: - // Decoding pushMessageContentMessageForwards#8df8a81c. - v := PushMessageContentMessageForwards{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case PushMessageContentMediaAlbumTypeID: - // Decoding pushMessageContentMediaAlbum#d363e96f. - v := PushMessageContentMediaAlbum{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONPushMessageContent implements binary de-serialization for PushMessageContentClass. -func DecodeTDLibJSONPushMessageContent(buf tdjson.Decoder) (PushMessageContentClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "pushMessageContentHidden": - // Decoding pushMessageContentHidden#ed1bb85c. - v := PushMessageContentHidden{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentAnimation": - // Decoding pushMessageContentAnimation#3da4dfe4. - v := PushMessageContentAnimation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentAudio": - // Decoding pushMessageContentAudio#16be7872. - v := PushMessageContentAudio{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentContact": - // Decoding pushMessageContentContact#ff458a54. - v := PushMessageContentContact{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentContactRegistered": - // Decoding pushMessageContentContactRegistered#ede1e5a0. - v := PushMessageContentContactRegistered{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentDocument": - // Decoding pushMessageContentDocument#e4adae01. - v := PushMessageContentDocument{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentGame": - // Decoding pushMessageContentGame#e14bb91b. - v := PushMessageContentGame{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentGameScore": - // Decoding pushMessageContentGameScore#35b8cd88. - v := PushMessageContentGameScore{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentInvoice": - // Decoding pushMessageContentInvoice#98c88bbc. - v := PushMessageContentInvoice{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentLocation": - // Decoding pushMessageContentLocation#b33a97b3. - v := PushMessageContentLocation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentPaidMedia": - // Decoding pushMessageContentPaidMedia#b556e74a. - v := PushMessageContentPaidMedia{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentPhoto": - // Decoding pushMessageContentPhoto#861dc52. - v := PushMessageContentPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentPoll": - // Decoding pushMessageContentPoll#fd5a743a. - v := PushMessageContentPoll{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentPremiumGiftCode": - // Decoding pushMessageContentPremiumGiftCode#18a15025. - v := PushMessageContentPremiumGiftCode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentGiveaway": - // Decoding pushMessageContentGiveaway#d63e7f8e. - v := PushMessageContentGiveaway{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentGift": - // Decoding pushMessageContentGift#84a8cd0b. - v := PushMessageContentGift{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentUpgradedGift": - // Decoding pushMessageContentUpgradedGift#99fa0ade. - v := PushMessageContentUpgradedGift{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentScreenshotTaken": - // Decoding pushMessageContentScreenshotTaken#cc51ff9. - v := PushMessageContentScreenshotTaken{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentSticker": - // Decoding pushMessageContentSticker#5c98bdd3. - v := PushMessageContentSticker{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentStory": - // Decoding pushMessageContentStory#996471c9. - v := PushMessageContentStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentText": - // Decoding pushMessageContentText#105ddea9. - v := PushMessageContentText{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentVideo": - // Decoding pushMessageContentVideo#127ad12f. - v := PushMessageContentVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentVideoNote": - // Decoding pushMessageContentVideoNote#bd13f97f. - v := PushMessageContentVideoNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentVoiceNote": - // Decoding pushMessageContentVoiceNote#54cac8b. - v := PushMessageContentVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentBasicGroupChatCreate": - // Decoding pushMessageContentBasicGroupChatCreate#81f1defc. - v := PushMessageContentBasicGroupChatCreate{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentChatAddMembers": - // Decoding pushMessageContentChatAddMembers#bf337b3a. - v := PushMessageContentChatAddMembers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentChatChangePhoto": - // Decoding pushMessageContentChatChangePhoto#bd96521d. - v := PushMessageContentChatChangePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentChatChangeTitle": - // Decoding pushMessageContentChatChangeTitle#8ae1f6a3. - v := PushMessageContentChatChangeTitle{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentChatSetBackground": - // Decoding pushMessageContentChatSetBackground#a72b56e3. - v := PushMessageContentChatSetBackground{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentChatSetTheme": - // Decoding pushMessageContentChatSetTheme#a5d3b68. - v := PushMessageContentChatSetTheme{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentChatDeleteMember": - // Decoding pushMessageContentChatDeleteMember#23afa99f. - v := PushMessageContentChatDeleteMember{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentChatJoinByLink": - // Decoding pushMessageContentChatJoinByLink#5c9bdf49. - v := PushMessageContentChatJoinByLink{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentChatJoinByRequest": - // Decoding pushMessageContentChatJoinByRequest#f3bb6175. - v := PushMessageContentChatJoinByRequest{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentRecurringPayment": - // Decoding pushMessageContentRecurringPayment#6083361a. - v := PushMessageContentRecurringPayment{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentSuggestProfilePhoto": - // Decoding pushMessageContentSuggestProfilePhoto#7d6bf0ab. - v := PushMessageContentSuggestProfilePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentMessageForwards": - // Decoding pushMessageContentMessageForwards#8df8a81c. - v := PushMessageContentMessageForwards{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - case "pushMessageContentMediaAlbum": - // Decoding pushMessageContentMediaAlbum#d363e96f. - v := PushMessageContentMediaAlbum{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode PushMessageContentClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// PushMessageContent boxes the PushMessageContentClass providing a helper. -type PushMessageContentBox struct { - PushMessageContent PushMessageContentClass -} - -// Decode implements bin.Decoder for PushMessageContentBox. -func (b *PushMessageContentBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode PushMessageContentBox to nil") - } - v, err := DecodePushMessageContent(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PushMessageContent = v - return nil -} - -// Encode implements bin.Encode for PushMessageContentBox. -func (b *PushMessageContentBox) Encode(buf *bin.Buffer) error { - if b == nil || b.PushMessageContent == nil { - return fmt.Errorf("unable to encode PushMessageContentClass as nil") - } - return b.PushMessageContent.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for PushMessageContentBox. -func (b *PushMessageContentBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode PushMessageContentBox to nil") - } - v, err := DecodeTDLibJSONPushMessageContent(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.PushMessageContent = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for PushMessageContentBox. -func (b *PushMessageContentBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.PushMessageContent == nil { - return fmt.Errorf("unable to encode PushMessageContentClass as nil") - } - return b.PushMessageContent.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_push_receiver_id_gen.go b/tdapi/tl_push_receiver_id_gen.go deleted file mode 100644 index d47d3ac88..000000000 --- a/tdapi/tl_push_receiver_id_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// PushReceiverID represents TL type `pushReceiverId#161ddf2c`. -type PushReceiverID struct { - // The globally unique identifier of push notification subscription - ID int64 -} - -// PushReceiverIDTypeID is TL type id of PushReceiverID. -const PushReceiverIDTypeID = 0x161ddf2c - -// Ensuring interfaces in compile-time for PushReceiverID. -var ( - _ bin.Encoder = &PushReceiverID{} - _ bin.Decoder = &PushReceiverID{} - _ bin.BareEncoder = &PushReceiverID{} - _ bin.BareDecoder = &PushReceiverID{} -) - -func (p *PushReceiverID) Zero() bool { - if p == nil { - return true - } - if !(p.ID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (p *PushReceiverID) String() string { - if p == nil { - return "PushReceiverID(nil)" - } - type Alias PushReceiverID - return fmt.Sprintf("PushReceiverID%+v", Alias(*p)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*PushReceiverID) TypeID() uint32 { - return PushReceiverIDTypeID -} - -// TypeName returns name of type in TL schema. -func (*PushReceiverID) TypeName() string { - return "pushReceiverId" -} - -// TypeInfo returns info about TL type. -func (p *PushReceiverID) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "pushReceiverId", - ID: PushReceiverIDTypeID, - } - if p == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (p *PushReceiverID) Encode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushReceiverId#161ddf2c as nil") - } - b.PutID(PushReceiverIDTypeID) - return p.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (p *PushReceiverID) EncodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't encode pushReceiverId#161ddf2c as nil") - } - b.PutLong(p.ID) - return nil -} - -// Decode implements bin.Decoder. -func (p *PushReceiverID) Decode(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushReceiverId#161ddf2c to nil") - } - if err := b.ConsumeID(PushReceiverIDTypeID); err != nil { - return fmt.Errorf("unable to decode pushReceiverId#161ddf2c: %w", err) - } - return p.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (p *PushReceiverID) DecodeBare(b *bin.Buffer) error { - if p == nil { - return fmt.Errorf("can't decode pushReceiverId#161ddf2c to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode pushReceiverId#161ddf2c: field id: %w", err) - } - p.ID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (p *PushReceiverID) EncodeTDLibJSON(b tdjson.Encoder) error { - if p == nil { - return fmt.Errorf("can't encode pushReceiverId#161ddf2c as nil") - } - b.ObjStart() - b.PutID("pushReceiverId") - b.Comma() - b.FieldStart("id") - b.PutLong(p.ID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (p *PushReceiverID) DecodeTDLibJSON(b tdjson.Decoder) error { - if p == nil { - return fmt.Errorf("can't decode pushReceiverId#161ddf2c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("pushReceiverId"); err != nil { - return fmt.Errorf("unable to decode pushReceiverId#161ddf2c: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode pushReceiverId#161ddf2c: field id: %w", err) - } - p.ID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (p *PushReceiverID) GetID() (value int64) { - if p == nil { - return - } - return p.ID -} diff --git a/tdapi/tl_quick_reply_message_gen.go b/tdapi/tl_quick_reply_message_gen.go deleted file mode 100644 index 1d2d68c59..000000000 --- a/tdapi/tl_quick_reply_message_gen.go +++ /dev/null @@ -1,463 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// QuickReplyMessage represents TL type `quickReplyMessage#bef92f03`. -type QuickReplyMessage struct { - // Unique message identifier among all quick replies - ID int64 - // The sending state of the message; may be null if the message isn't being sent and - // didn't fail to be sent - SendingState MessageSendingStateClass - // True, if the message can be edited - CanBeEdited bool - // The identifier of the quick reply message to which the message replies; 0 if none - ReplyToMessageID int64 - // If non-zero, the user identifier of the bot through which this message was sent - ViaBotUserID int64 - // Unique identifier of an album this message belongs to; 0 if none. Only audios, - // documents, photos and videos can be grouped together in albums - MediaAlbumID int64 - // Content of the message - Content MessageContentClass - // Inline keyboard reply markup for the message; may be null if none - ReplyMarkup ReplyMarkupClass -} - -// QuickReplyMessageTypeID is TL type id of QuickReplyMessage. -const QuickReplyMessageTypeID = 0xbef92f03 - -// Ensuring interfaces in compile-time for QuickReplyMessage. -var ( - _ bin.Encoder = &QuickReplyMessage{} - _ bin.Decoder = &QuickReplyMessage{} - _ bin.BareEncoder = &QuickReplyMessage{} - _ bin.BareDecoder = &QuickReplyMessage{} -) - -func (q *QuickReplyMessage) Zero() bool { - if q == nil { - return true - } - if !(q.ID == 0) { - return false - } - if !(q.SendingState == nil) { - return false - } - if !(q.CanBeEdited == false) { - return false - } - if !(q.ReplyToMessageID == 0) { - return false - } - if !(q.ViaBotUserID == 0) { - return false - } - if !(q.MediaAlbumID == 0) { - return false - } - if !(q.Content == nil) { - return false - } - if !(q.ReplyMarkup == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (q *QuickReplyMessage) String() string { - if q == nil { - return "QuickReplyMessage(nil)" - } - type Alias QuickReplyMessage - return fmt.Sprintf("QuickReplyMessage%+v", Alias(*q)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*QuickReplyMessage) TypeID() uint32 { - return QuickReplyMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*QuickReplyMessage) TypeName() string { - return "quickReplyMessage" -} - -// TypeInfo returns info about TL type. -func (q *QuickReplyMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "quickReplyMessage", - ID: QuickReplyMessageTypeID, - } - if q == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "SendingState", - SchemaName: "sending_state", - }, - { - Name: "CanBeEdited", - SchemaName: "can_be_edited", - }, - { - Name: "ReplyToMessageID", - SchemaName: "reply_to_message_id", - }, - { - Name: "ViaBotUserID", - SchemaName: "via_bot_user_id", - }, - { - Name: "MediaAlbumID", - SchemaName: "media_album_id", - }, - { - Name: "Content", - SchemaName: "content", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (q *QuickReplyMessage) Encode(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't encode quickReplyMessage#bef92f03 as nil") - } - b.PutID(QuickReplyMessageTypeID) - return q.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (q *QuickReplyMessage) EncodeBare(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't encode quickReplyMessage#bef92f03 as nil") - } - b.PutInt53(q.ID) - if q.SendingState == nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state is nil") - } - if err := q.SendingState.Encode(b); err != nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state: %w", err) - } - b.PutBool(q.CanBeEdited) - b.PutInt53(q.ReplyToMessageID) - b.PutInt53(q.ViaBotUserID) - b.PutLong(q.MediaAlbumID) - if q.Content == nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content is nil") - } - if err := q.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content: %w", err) - } - if q.ReplyMarkup == nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup is nil") - } - if err := q.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (q *QuickReplyMessage) Decode(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't decode quickReplyMessage#bef92f03 to nil") - } - if err := b.ConsumeID(QuickReplyMessageTypeID); err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: %w", err) - } - return q.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (q *QuickReplyMessage) DecodeBare(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't decode quickReplyMessage#bef92f03 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field id: %w", err) - } - q.ID = value - } - { - value, err := DecodeMessageSendingState(b) - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field sending_state: %w", err) - } - q.SendingState = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field can_be_edited: %w", err) - } - q.CanBeEdited = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_to_message_id: %w", err) - } - q.ReplyToMessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field via_bot_user_id: %w", err) - } - q.ViaBotUserID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field media_album_id: %w", err) - } - q.MediaAlbumID = value - } - { - value, err := DecodeMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field content: %w", err) - } - q.Content = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_markup: %w", err) - } - q.ReplyMarkup = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (q *QuickReplyMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if q == nil { - return fmt.Errorf("can't encode quickReplyMessage#bef92f03 as nil") - } - b.ObjStart() - b.PutID("quickReplyMessage") - b.Comma() - b.FieldStart("id") - b.PutInt53(q.ID) - b.Comma() - b.FieldStart("sending_state") - if q.SendingState == nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state is nil") - } - if err := q.SendingState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field sending_state: %w", err) - } - b.Comma() - b.FieldStart("can_be_edited") - b.PutBool(q.CanBeEdited) - b.Comma() - b.FieldStart("reply_to_message_id") - b.PutInt53(q.ReplyToMessageID) - b.Comma() - b.FieldStart("via_bot_user_id") - b.PutInt53(q.ViaBotUserID) - b.Comma() - b.FieldStart("media_album_id") - b.PutLong(q.MediaAlbumID) - b.Comma() - b.FieldStart("content") - if q.Content == nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content is nil") - } - if err := q.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field content: %w", err) - } - b.Comma() - b.FieldStart("reply_markup") - if q.ReplyMarkup == nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup is nil") - } - if err := q.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode quickReplyMessage#bef92f03: field reply_markup: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (q *QuickReplyMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if q == nil { - return fmt.Errorf("can't decode quickReplyMessage#bef92f03 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("quickReplyMessage"); err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: %w", err) - } - case "id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field id: %w", err) - } - q.ID = value - case "sending_state": - value, err := DecodeTDLibJSONMessageSendingState(b) - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field sending_state: %w", err) - } - q.SendingState = value - case "can_be_edited": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field can_be_edited: %w", err) - } - q.CanBeEdited = value - case "reply_to_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_to_message_id: %w", err) - } - q.ReplyToMessageID = value - case "via_bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field via_bot_user_id: %w", err) - } - q.ViaBotUserID = value - case "media_album_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field media_album_id: %w", err) - } - q.MediaAlbumID = value - case "content": - value, err := DecodeTDLibJSONMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field content: %w", err) - } - q.Content = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessage#bef92f03: field reply_markup: %w", err) - } - q.ReplyMarkup = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (q *QuickReplyMessage) GetID() (value int64) { - if q == nil { - return - } - return q.ID -} - -// GetSendingState returns value of SendingState field. -func (q *QuickReplyMessage) GetSendingState() (value MessageSendingStateClass) { - if q == nil { - return - } - return q.SendingState -} - -// GetCanBeEdited returns value of CanBeEdited field. -func (q *QuickReplyMessage) GetCanBeEdited() (value bool) { - if q == nil { - return - } - return q.CanBeEdited -} - -// GetReplyToMessageID returns value of ReplyToMessageID field. -func (q *QuickReplyMessage) GetReplyToMessageID() (value int64) { - if q == nil { - return - } - return q.ReplyToMessageID -} - -// GetViaBotUserID returns value of ViaBotUserID field. -func (q *QuickReplyMessage) GetViaBotUserID() (value int64) { - if q == nil { - return - } - return q.ViaBotUserID -} - -// GetMediaAlbumID returns value of MediaAlbumID field. -func (q *QuickReplyMessage) GetMediaAlbumID() (value int64) { - if q == nil { - return - } - return q.MediaAlbumID -} - -// GetContent returns value of Content field. -func (q *QuickReplyMessage) GetContent() (value MessageContentClass) { - if q == nil { - return - } - return q.Content -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (q *QuickReplyMessage) GetReplyMarkup() (value ReplyMarkupClass) { - if q == nil { - return - } - return q.ReplyMarkup -} diff --git a/tdapi/tl_quick_reply_messages_gen.go b/tdapi/tl_quick_reply_messages_gen.go deleted file mode 100644 index b43d7fe24..000000000 --- a/tdapi/tl_quick_reply_messages_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// QuickReplyMessages represents TL type `quickReplyMessages#8426549b`. -type QuickReplyMessages struct { - // List of quick reply messages; messages may be null - Messages []QuickReplyMessage -} - -// QuickReplyMessagesTypeID is TL type id of QuickReplyMessages. -const QuickReplyMessagesTypeID = 0x8426549b - -// Ensuring interfaces in compile-time for QuickReplyMessages. -var ( - _ bin.Encoder = &QuickReplyMessages{} - _ bin.Decoder = &QuickReplyMessages{} - _ bin.BareEncoder = &QuickReplyMessages{} - _ bin.BareDecoder = &QuickReplyMessages{} -) - -func (q *QuickReplyMessages) Zero() bool { - if q == nil { - return true - } - if !(q.Messages == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (q *QuickReplyMessages) String() string { - if q == nil { - return "QuickReplyMessages(nil)" - } - type Alias QuickReplyMessages - return fmt.Sprintf("QuickReplyMessages%+v", Alias(*q)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*QuickReplyMessages) TypeID() uint32 { - return QuickReplyMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*QuickReplyMessages) TypeName() string { - return "quickReplyMessages" -} - -// TypeInfo returns info about TL type. -func (q *QuickReplyMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "quickReplyMessages", - ID: QuickReplyMessagesTypeID, - } - if q == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Messages", - SchemaName: "messages", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (q *QuickReplyMessages) Encode(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't encode quickReplyMessages#8426549b as nil") - } - b.PutID(QuickReplyMessagesTypeID) - return q.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (q *QuickReplyMessages) EncodeBare(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't encode quickReplyMessages#8426549b as nil") - } - b.PutInt(len(q.Messages)) - for idx, v := range q.Messages { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare quickReplyMessages#8426549b: field messages element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (q *QuickReplyMessages) Decode(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't decode quickReplyMessages#8426549b to nil") - } - if err := b.ConsumeID(QuickReplyMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode quickReplyMessages#8426549b: %w", err) - } - return q.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (q *QuickReplyMessages) DecodeBare(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't decode quickReplyMessages#8426549b to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode quickReplyMessages#8426549b: field messages: %w", err) - } - - if headerLen > 0 { - q.Messages = make([]QuickReplyMessage, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value QuickReplyMessage - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare quickReplyMessages#8426549b: field messages: %w", err) - } - q.Messages = append(q.Messages, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (q *QuickReplyMessages) EncodeTDLibJSON(b tdjson.Encoder) error { - if q == nil { - return fmt.Errorf("can't encode quickReplyMessages#8426549b as nil") - } - b.ObjStart() - b.PutID("quickReplyMessages") - b.Comma() - b.FieldStart("messages") - b.ArrStart() - for idx, v := range q.Messages { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode quickReplyMessages#8426549b: field messages element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (q *QuickReplyMessages) DecodeTDLibJSON(b tdjson.Decoder) error { - if q == nil { - return fmt.Errorf("can't decode quickReplyMessages#8426549b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("quickReplyMessages"); err != nil { - return fmt.Errorf("unable to decode quickReplyMessages#8426549b: %w", err) - } - case "messages": - if err := b.Arr(func(b tdjson.Decoder) error { - var value QuickReplyMessage - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode quickReplyMessages#8426549b: field messages: %w", err) - } - q.Messages = append(q.Messages, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode quickReplyMessages#8426549b: field messages: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessages returns value of Messages field. -func (q *QuickReplyMessages) GetMessages() (value []QuickReplyMessage) { - if q == nil { - return - } - return q.Messages -} diff --git a/tdapi/tl_quick_reply_shortcut_gen.go b/tdapi/tl_quick_reply_shortcut_gen.go deleted file mode 100644 index 30268c92f..000000000 --- a/tdapi/tl_quick_reply_shortcut_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// QuickReplyShortcut represents TL type `quickReplyShortcut#bdfd9a95`. -type QuickReplyShortcut struct { - // Unique shortcut identifier - ID int32 - // The name of the shortcut that can be used to use the shortcut - Name string - // The first shortcut message - FirstMessage QuickReplyMessage - // The total number of messages in the shortcut - MessageCount int32 -} - -// QuickReplyShortcutTypeID is TL type id of QuickReplyShortcut. -const QuickReplyShortcutTypeID = 0xbdfd9a95 - -// Ensuring interfaces in compile-time for QuickReplyShortcut. -var ( - _ bin.Encoder = &QuickReplyShortcut{} - _ bin.Decoder = &QuickReplyShortcut{} - _ bin.BareEncoder = &QuickReplyShortcut{} - _ bin.BareDecoder = &QuickReplyShortcut{} -) - -func (q *QuickReplyShortcut) Zero() bool { - if q == nil { - return true - } - if !(q.ID == 0) { - return false - } - if !(q.Name == "") { - return false - } - if !(q.FirstMessage.Zero()) { - return false - } - if !(q.MessageCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (q *QuickReplyShortcut) String() string { - if q == nil { - return "QuickReplyShortcut(nil)" - } - type Alias QuickReplyShortcut - return fmt.Sprintf("QuickReplyShortcut%+v", Alias(*q)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*QuickReplyShortcut) TypeID() uint32 { - return QuickReplyShortcutTypeID -} - -// TypeName returns name of type in TL schema. -func (*QuickReplyShortcut) TypeName() string { - return "quickReplyShortcut" -} - -// TypeInfo returns info about TL type. -func (q *QuickReplyShortcut) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "quickReplyShortcut", - ID: QuickReplyShortcutTypeID, - } - if q == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "FirstMessage", - SchemaName: "first_message", - }, - { - Name: "MessageCount", - SchemaName: "message_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (q *QuickReplyShortcut) Encode(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't encode quickReplyShortcut#bdfd9a95 as nil") - } - b.PutID(QuickReplyShortcutTypeID) - return q.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (q *QuickReplyShortcut) EncodeBare(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't encode quickReplyShortcut#bdfd9a95 as nil") - } - b.PutInt32(q.ID) - b.PutString(q.Name) - if err := q.FirstMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode quickReplyShortcut#bdfd9a95: field first_message: %w", err) - } - b.PutInt32(q.MessageCount) - return nil -} - -// Decode implements bin.Decoder. -func (q *QuickReplyShortcut) Decode(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't decode quickReplyShortcut#bdfd9a95 to nil") - } - if err := b.ConsumeID(QuickReplyShortcutTypeID); err != nil { - return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: %w", err) - } - return q.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (q *QuickReplyShortcut) DecodeBare(b *bin.Buffer) error { - if q == nil { - return fmt.Errorf("can't decode quickReplyShortcut#bdfd9a95 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field id: %w", err) - } - q.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field name: %w", err) - } - q.Name = value - } - { - if err := q.FirstMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field first_message: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field message_count: %w", err) - } - q.MessageCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (q *QuickReplyShortcut) EncodeTDLibJSON(b tdjson.Encoder) error { - if q == nil { - return fmt.Errorf("can't encode quickReplyShortcut#bdfd9a95 as nil") - } - b.ObjStart() - b.PutID("quickReplyShortcut") - b.Comma() - b.FieldStart("id") - b.PutInt32(q.ID) - b.Comma() - b.FieldStart("name") - b.PutString(q.Name) - b.Comma() - b.FieldStart("first_message") - if err := q.FirstMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode quickReplyShortcut#bdfd9a95: field first_message: %w", err) - } - b.Comma() - b.FieldStart("message_count") - b.PutInt32(q.MessageCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (q *QuickReplyShortcut) DecodeTDLibJSON(b tdjson.Decoder) error { - if q == nil { - return fmt.Errorf("can't decode quickReplyShortcut#bdfd9a95 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("quickReplyShortcut"); err != nil { - return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field id: %w", err) - } - q.ID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field name: %w", err) - } - q.Name = value - case "first_message": - if err := q.FirstMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field first_message: %w", err) - } - case "message_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode quickReplyShortcut#bdfd9a95: field message_count: %w", err) - } - q.MessageCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (q *QuickReplyShortcut) GetID() (value int32) { - if q == nil { - return - } - return q.ID -} - -// GetName returns value of Name field. -func (q *QuickReplyShortcut) GetName() (value string) { - if q == nil { - return - } - return q.Name -} - -// GetFirstMessage returns value of FirstMessage field. -func (q *QuickReplyShortcut) GetFirstMessage() (value QuickReplyMessage) { - if q == nil { - return - } - return q.FirstMessage -} - -// GetMessageCount returns value of MessageCount field. -func (q *QuickReplyShortcut) GetMessageCount() (value int32) { - if q == nil { - return - } - return q.MessageCount -} diff --git a/tdapi/tl_rate_speech_recognition_gen.go b/tdapi/tl_rate_speech_recognition_gen.go deleted file mode 100644 index 851e35c57..000000000 --- a/tdapi/tl_rate_speech_recognition_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RateSpeechRecognitionRequest represents TL type `rateSpeechRecognition#eedcc3b5`. -type RateSpeechRecognitionRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // Pass true if the speech recognition is good - IsGood bool -} - -// RateSpeechRecognitionRequestTypeID is TL type id of RateSpeechRecognitionRequest. -const RateSpeechRecognitionRequestTypeID = 0xeedcc3b5 - -// Ensuring interfaces in compile-time for RateSpeechRecognitionRequest. -var ( - _ bin.Encoder = &RateSpeechRecognitionRequest{} - _ bin.Decoder = &RateSpeechRecognitionRequest{} - _ bin.BareEncoder = &RateSpeechRecognitionRequest{} - _ bin.BareDecoder = &RateSpeechRecognitionRequest{} -) - -func (r *RateSpeechRecognitionRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.MessageID == 0) { - return false - } - if !(r.IsGood == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RateSpeechRecognitionRequest) String() string { - if r == nil { - return "RateSpeechRecognitionRequest(nil)" - } - type Alias RateSpeechRecognitionRequest - return fmt.Sprintf("RateSpeechRecognitionRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RateSpeechRecognitionRequest) TypeID() uint32 { - return RateSpeechRecognitionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RateSpeechRecognitionRequest) TypeName() string { - return "rateSpeechRecognition" -} - -// TypeInfo returns info about TL type. -func (r *RateSpeechRecognitionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "rateSpeechRecognition", - ID: RateSpeechRecognitionRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "IsGood", - SchemaName: "is_good", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RateSpeechRecognitionRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode rateSpeechRecognition#eedcc3b5 as nil") - } - b.PutID(RateSpeechRecognitionRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RateSpeechRecognitionRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode rateSpeechRecognition#eedcc3b5 as nil") - } - b.PutInt53(r.ChatID) - b.PutInt53(r.MessageID) - b.PutBool(r.IsGood) - return nil -} - -// Decode implements bin.Decoder. -func (r *RateSpeechRecognitionRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode rateSpeechRecognition#eedcc3b5 to nil") - } - if err := b.ConsumeID(RateSpeechRecognitionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode rateSpeechRecognition#eedcc3b5: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RateSpeechRecognitionRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode rateSpeechRecognition#eedcc3b5 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode rateSpeechRecognition#eedcc3b5: field chat_id: %w", err) - } - r.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode rateSpeechRecognition#eedcc3b5: field message_id: %w", err) - } - r.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode rateSpeechRecognition#eedcc3b5: field is_good: %w", err) - } - r.IsGood = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RateSpeechRecognitionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode rateSpeechRecognition#eedcc3b5 as nil") - } - b.ObjStart() - b.PutID("rateSpeechRecognition") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(r.MessageID) - b.Comma() - b.FieldStart("is_good") - b.PutBool(r.IsGood) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RateSpeechRecognitionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode rateSpeechRecognition#eedcc3b5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("rateSpeechRecognition"); err != nil { - return fmt.Errorf("unable to decode rateSpeechRecognition#eedcc3b5: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode rateSpeechRecognition#eedcc3b5: field chat_id: %w", err) - } - r.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode rateSpeechRecognition#eedcc3b5: field message_id: %w", err) - } - r.MessageID = value - case "is_good": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode rateSpeechRecognition#eedcc3b5: field is_good: %w", err) - } - r.IsGood = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *RateSpeechRecognitionRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetMessageID returns value of MessageID field. -func (r *RateSpeechRecognitionRequest) GetMessageID() (value int64) { - if r == nil { - return - } - return r.MessageID -} - -// GetIsGood returns value of IsGood field. -func (r *RateSpeechRecognitionRequest) GetIsGood() (value bool) { - if r == nil { - return - } - return r.IsGood -} - -// RateSpeechRecognition invokes method rateSpeechRecognition#eedcc3b5 returning error if any. -func (c *Client) RateSpeechRecognition(ctx context.Context, request *RateSpeechRecognitionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reaction_notification_settings_gen.go b/tdapi/tl_reaction_notification_settings_gen.go deleted file mode 100644 index e9f58498f..000000000 --- a/tdapi/tl_reaction_notification_settings_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReactionNotificationSettings represents TL type `reactionNotificationSettings#2bb0f654`. -type ReactionNotificationSettings struct { - // Source of message reactions for which notifications are shown - MessageReactionSource ReactionNotificationSourceClass - // Source of story reactions for which notifications are shown - StoryReactionSource ReactionNotificationSourceClass - // Identifier of the notification sound to be played; 0 if sound is disabled - SoundID int64 - // True, if reaction sender and emoji must be displayed in notifications - ShowPreview bool -} - -// ReactionNotificationSettingsTypeID is TL type id of ReactionNotificationSettings. -const ReactionNotificationSettingsTypeID = 0x2bb0f654 - -// Ensuring interfaces in compile-time for ReactionNotificationSettings. -var ( - _ bin.Encoder = &ReactionNotificationSettings{} - _ bin.Decoder = &ReactionNotificationSettings{} - _ bin.BareEncoder = &ReactionNotificationSettings{} - _ bin.BareDecoder = &ReactionNotificationSettings{} -) - -func (r *ReactionNotificationSettings) Zero() bool { - if r == nil { - return true - } - if !(r.MessageReactionSource == nil) { - return false - } - if !(r.StoryReactionSource == nil) { - return false - } - if !(r.SoundID == 0) { - return false - } - if !(r.ShowPreview == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReactionNotificationSettings) String() string { - if r == nil { - return "ReactionNotificationSettings(nil)" - } - type Alias ReactionNotificationSettings - return fmt.Sprintf("ReactionNotificationSettings%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReactionNotificationSettings) TypeID() uint32 { - return ReactionNotificationSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReactionNotificationSettings) TypeName() string { - return "reactionNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (r *ReactionNotificationSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reactionNotificationSettings", - ID: ReactionNotificationSettingsTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageReactionSource", - SchemaName: "message_reaction_source", - }, - { - Name: "StoryReactionSource", - SchemaName: "story_reaction_source", - }, - { - Name: "SoundID", - SchemaName: "sound_id", - }, - { - Name: "ShowPreview", - SchemaName: "show_preview", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReactionNotificationSettings) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSettings#2bb0f654 as nil") - } - b.PutID(ReactionNotificationSettingsTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReactionNotificationSettings) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSettings#2bb0f654 as nil") - } - if r.MessageReactionSource == nil { - return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field message_reaction_source is nil") - } - if err := r.MessageReactionSource.Encode(b); err != nil { - return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field message_reaction_source: %w", err) - } - if r.StoryReactionSource == nil { - return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field story_reaction_source is nil") - } - if err := r.StoryReactionSource.Encode(b); err != nil { - return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field story_reaction_source: %w", err) - } - b.PutLong(r.SoundID) - b.PutBool(r.ShowPreview) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReactionNotificationSettings) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSettings#2bb0f654 to nil") - } - if err := b.ConsumeID(ReactionNotificationSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReactionNotificationSettings) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSettings#2bb0f654 to nil") - } - { - value, err := DecodeReactionNotificationSource(b) - if err != nil { - return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field message_reaction_source: %w", err) - } - r.MessageReactionSource = value - } - { - value, err := DecodeReactionNotificationSource(b) - if err != nil { - return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field story_reaction_source: %w", err) - } - r.StoryReactionSource = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field sound_id: %w", err) - } - r.SoundID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field show_preview: %w", err) - } - r.ShowPreview = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReactionNotificationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSettings#2bb0f654 as nil") - } - b.ObjStart() - b.PutID("reactionNotificationSettings") - b.Comma() - b.FieldStart("message_reaction_source") - if r.MessageReactionSource == nil { - return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field message_reaction_source is nil") - } - if err := r.MessageReactionSource.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field message_reaction_source: %w", err) - } - b.Comma() - b.FieldStart("story_reaction_source") - if r.StoryReactionSource == nil { - return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field story_reaction_source is nil") - } - if err := r.StoryReactionSource.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode reactionNotificationSettings#2bb0f654: field story_reaction_source: %w", err) - } - b.Comma() - b.FieldStart("sound_id") - b.PutLong(r.SoundID) - b.Comma() - b.FieldStart("show_preview") - b.PutBool(r.ShowPreview) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReactionNotificationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSettings#2bb0f654 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reactionNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: %w", err) - } - case "message_reaction_source": - value, err := DecodeTDLibJSONReactionNotificationSource(b) - if err != nil { - return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field message_reaction_source: %w", err) - } - r.MessageReactionSource = value - case "story_reaction_source": - value, err := DecodeTDLibJSONReactionNotificationSource(b) - if err != nil { - return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field story_reaction_source: %w", err) - } - r.StoryReactionSource = value - case "sound_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field sound_id: %w", err) - } - r.SoundID = value - case "show_preview": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode reactionNotificationSettings#2bb0f654: field show_preview: %w", err) - } - r.ShowPreview = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageReactionSource returns value of MessageReactionSource field. -func (r *ReactionNotificationSettings) GetMessageReactionSource() (value ReactionNotificationSourceClass) { - if r == nil { - return - } - return r.MessageReactionSource -} - -// GetStoryReactionSource returns value of StoryReactionSource field. -func (r *ReactionNotificationSettings) GetStoryReactionSource() (value ReactionNotificationSourceClass) { - if r == nil { - return - } - return r.StoryReactionSource -} - -// GetSoundID returns value of SoundID field. -func (r *ReactionNotificationSettings) GetSoundID() (value int64) { - if r == nil { - return - } - return r.SoundID -} - -// GetShowPreview returns value of ShowPreview field. -func (r *ReactionNotificationSettings) GetShowPreview() (value bool) { - if r == nil { - return - } - return r.ShowPreview -} diff --git a/tdapi/tl_reaction_notification_source_gen.go b/tdapi/tl_reaction_notification_source_gen.go deleted file mode 100644 index b91503c9e..000000000 --- a/tdapi/tl_reaction_notification_source_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReactionNotificationSourceNone represents TL type `reactionNotificationSourceNone#15d6701c`. -type ReactionNotificationSourceNone struct { -} - -// ReactionNotificationSourceNoneTypeID is TL type id of ReactionNotificationSourceNone. -const ReactionNotificationSourceNoneTypeID = 0x15d6701c - -// construct implements constructor of ReactionNotificationSourceClass. -func (r ReactionNotificationSourceNone) construct() ReactionNotificationSourceClass { return &r } - -// Ensuring interfaces in compile-time for ReactionNotificationSourceNone. -var ( - _ bin.Encoder = &ReactionNotificationSourceNone{} - _ bin.Decoder = &ReactionNotificationSourceNone{} - _ bin.BareEncoder = &ReactionNotificationSourceNone{} - _ bin.BareDecoder = &ReactionNotificationSourceNone{} - - _ ReactionNotificationSourceClass = &ReactionNotificationSourceNone{} -) - -func (r *ReactionNotificationSourceNone) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReactionNotificationSourceNone) String() string { - if r == nil { - return "ReactionNotificationSourceNone(nil)" - } - type Alias ReactionNotificationSourceNone - return fmt.Sprintf("ReactionNotificationSourceNone%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReactionNotificationSourceNone) TypeID() uint32 { - return ReactionNotificationSourceNoneTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReactionNotificationSourceNone) TypeName() string { - return "reactionNotificationSourceNone" -} - -// TypeInfo returns info about TL type. -func (r *ReactionNotificationSourceNone) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reactionNotificationSourceNone", - ID: ReactionNotificationSourceNoneTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReactionNotificationSourceNone) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSourceNone#15d6701c as nil") - } - b.PutID(ReactionNotificationSourceNoneTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReactionNotificationSourceNone) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSourceNone#15d6701c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReactionNotificationSourceNone) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSourceNone#15d6701c to nil") - } - if err := b.ConsumeID(ReactionNotificationSourceNoneTypeID); err != nil { - return fmt.Errorf("unable to decode reactionNotificationSourceNone#15d6701c: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReactionNotificationSourceNone) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSourceNone#15d6701c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReactionNotificationSourceNone) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSourceNone#15d6701c as nil") - } - b.ObjStart() - b.PutID("reactionNotificationSourceNone") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReactionNotificationSourceNone) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSourceNone#15d6701c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reactionNotificationSourceNone"); err != nil { - return fmt.Errorf("unable to decode reactionNotificationSourceNone#15d6701c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReactionNotificationSourceContacts represents TL type `reactionNotificationSourceContacts#211c4835`. -type ReactionNotificationSourceContacts struct { -} - -// ReactionNotificationSourceContactsTypeID is TL type id of ReactionNotificationSourceContacts. -const ReactionNotificationSourceContactsTypeID = 0x211c4835 - -// construct implements constructor of ReactionNotificationSourceClass. -func (r ReactionNotificationSourceContacts) construct() ReactionNotificationSourceClass { return &r } - -// Ensuring interfaces in compile-time for ReactionNotificationSourceContacts. -var ( - _ bin.Encoder = &ReactionNotificationSourceContacts{} - _ bin.Decoder = &ReactionNotificationSourceContacts{} - _ bin.BareEncoder = &ReactionNotificationSourceContacts{} - _ bin.BareDecoder = &ReactionNotificationSourceContacts{} - - _ ReactionNotificationSourceClass = &ReactionNotificationSourceContacts{} -) - -func (r *ReactionNotificationSourceContacts) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReactionNotificationSourceContacts) String() string { - if r == nil { - return "ReactionNotificationSourceContacts(nil)" - } - type Alias ReactionNotificationSourceContacts - return fmt.Sprintf("ReactionNotificationSourceContacts%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReactionNotificationSourceContacts) TypeID() uint32 { - return ReactionNotificationSourceContactsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReactionNotificationSourceContacts) TypeName() string { - return "reactionNotificationSourceContacts" -} - -// TypeInfo returns info about TL type. -func (r *ReactionNotificationSourceContacts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reactionNotificationSourceContacts", - ID: ReactionNotificationSourceContactsTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReactionNotificationSourceContacts) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSourceContacts#211c4835 as nil") - } - b.PutID(ReactionNotificationSourceContactsTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReactionNotificationSourceContacts) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSourceContacts#211c4835 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReactionNotificationSourceContacts) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSourceContacts#211c4835 to nil") - } - if err := b.ConsumeID(ReactionNotificationSourceContactsTypeID); err != nil { - return fmt.Errorf("unable to decode reactionNotificationSourceContacts#211c4835: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReactionNotificationSourceContacts) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSourceContacts#211c4835 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReactionNotificationSourceContacts) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSourceContacts#211c4835 as nil") - } - b.ObjStart() - b.PutID("reactionNotificationSourceContacts") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReactionNotificationSourceContacts) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSourceContacts#211c4835 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reactionNotificationSourceContacts"); err != nil { - return fmt.Errorf("unable to decode reactionNotificationSourceContacts#211c4835: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReactionNotificationSourceAll represents TL type `reactionNotificationSourceAll#4a02ac92`. -type ReactionNotificationSourceAll struct { -} - -// ReactionNotificationSourceAllTypeID is TL type id of ReactionNotificationSourceAll. -const ReactionNotificationSourceAllTypeID = 0x4a02ac92 - -// construct implements constructor of ReactionNotificationSourceClass. -func (r ReactionNotificationSourceAll) construct() ReactionNotificationSourceClass { return &r } - -// Ensuring interfaces in compile-time for ReactionNotificationSourceAll. -var ( - _ bin.Encoder = &ReactionNotificationSourceAll{} - _ bin.Decoder = &ReactionNotificationSourceAll{} - _ bin.BareEncoder = &ReactionNotificationSourceAll{} - _ bin.BareDecoder = &ReactionNotificationSourceAll{} - - _ ReactionNotificationSourceClass = &ReactionNotificationSourceAll{} -) - -func (r *ReactionNotificationSourceAll) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReactionNotificationSourceAll) String() string { - if r == nil { - return "ReactionNotificationSourceAll(nil)" - } - type Alias ReactionNotificationSourceAll - return fmt.Sprintf("ReactionNotificationSourceAll%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReactionNotificationSourceAll) TypeID() uint32 { - return ReactionNotificationSourceAllTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReactionNotificationSourceAll) TypeName() string { - return "reactionNotificationSourceAll" -} - -// TypeInfo returns info about TL type. -func (r *ReactionNotificationSourceAll) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reactionNotificationSourceAll", - ID: ReactionNotificationSourceAllTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReactionNotificationSourceAll) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSourceAll#4a02ac92 as nil") - } - b.PutID(ReactionNotificationSourceAllTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReactionNotificationSourceAll) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSourceAll#4a02ac92 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReactionNotificationSourceAll) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSourceAll#4a02ac92 to nil") - } - if err := b.ConsumeID(ReactionNotificationSourceAllTypeID); err != nil { - return fmt.Errorf("unable to decode reactionNotificationSourceAll#4a02ac92: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReactionNotificationSourceAll) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSourceAll#4a02ac92 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReactionNotificationSourceAll) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reactionNotificationSourceAll#4a02ac92 as nil") - } - b.ObjStart() - b.PutID("reactionNotificationSourceAll") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReactionNotificationSourceAll) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reactionNotificationSourceAll#4a02ac92 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reactionNotificationSourceAll"); err != nil { - return fmt.Errorf("unable to decode reactionNotificationSourceAll#4a02ac92: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReactionNotificationSourceClassName is schema name of ReactionNotificationSourceClass. -const ReactionNotificationSourceClassName = "ReactionNotificationSource" - -// ReactionNotificationSourceClass represents ReactionNotificationSource generic type. -// -// Example: -// -// g, err := tdapi.DecodeReactionNotificationSource(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ReactionNotificationSourceNone: // reactionNotificationSourceNone#15d6701c -// case *tdapi.ReactionNotificationSourceContacts: // reactionNotificationSourceContacts#211c4835 -// case *tdapi.ReactionNotificationSourceAll: // reactionNotificationSourceAll#4a02ac92 -// default: panic(v) -// } -type ReactionNotificationSourceClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ReactionNotificationSourceClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeReactionNotificationSource implements binary de-serialization for ReactionNotificationSourceClass. -func DecodeReactionNotificationSource(buf *bin.Buffer) (ReactionNotificationSourceClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ReactionNotificationSourceNoneTypeID: - // Decoding reactionNotificationSourceNone#15d6701c. - v := ReactionNotificationSourceNone{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) - } - return &v, nil - case ReactionNotificationSourceContactsTypeID: - // Decoding reactionNotificationSourceContacts#211c4835. - v := ReactionNotificationSourceContacts{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) - } - return &v, nil - case ReactionNotificationSourceAllTypeID: - // Decoding reactionNotificationSourceAll#4a02ac92. - v := ReactionNotificationSourceAll{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONReactionNotificationSource implements binary de-serialization for ReactionNotificationSourceClass. -func DecodeTDLibJSONReactionNotificationSource(buf tdjson.Decoder) (ReactionNotificationSourceClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "reactionNotificationSourceNone": - // Decoding reactionNotificationSourceNone#15d6701c. - v := ReactionNotificationSourceNone{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) - } - return &v, nil - case "reactionNotificationSourceContacts": - // Decoding reactionNotificationSourceContacts#211c4835. - v := ReactionNotificationSourceContacts{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) - } - return &v, nil - case "reactionNotificationSourceAll": - // Decoding reactionNotificationSourceAll#4a02ac92. - v := ReactionNotificationSourceAll{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReactionNotificationSourceClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ReactionNotificationSource boxes the ReactionNotificationSourceClass providing a helper. -type ReactionNotificationSourceBox struct { - ReactionNotificationSource ReactionNotificationSourceClass -} - -// Decode implements bin.Decoder for ReactionNotificationSourceBox. -func (b *ReactionNotificationSourceBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ReactionNotificationSourceBox to nil") - } - v, err := DecodeReactionNotificationSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReactionNotificationSource = v - return nil -} - -// Encode implements bin.Encode for ReactionNotificationSourceBox. -func (b *ReactionNotificationSourceBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ReactionNotificationSource == nil { - return fmt.Errorf("unable to encode ReactionNotificationSourceClass as nil") - } - return b.ReactionNotificationSource.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ReactionNotificationSourceBox. -func (b *ReactionNotificationSourceBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ReactionNotificationSourceBox to nil") - } - v, err := DecodeTDLibJSONReactionNotificationSource(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReactionNotificationSource = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ReactionNotificationSourceBox. -func (b *ReactionNotificationSourceBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ReactionNotificationSource == nil { - return fmt.Errorf("unable to encode ReactionNotificationSourceClass as nil") - } - return b.ReactionNotificationSource.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_reaction_type_gen.go b/tdapi/tl_reaction_type_gen.go deleted file mode 100644 index 8367bb26f..000000000 --- a/tdapi/tl_reaction_type_gen.go +++ /dev/null @@ -1,647 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReactionTypeEmoji represents TL type `reactionTypeEmoji#8c3e22c8`. -type ReactionTypeEmoji struct { - // Text representation of the reaction - Emoji string -} - -// ReactionTypeEmojiTypeID is TL type id of ReactionTypeEmoji. -const ReactionTypeEmojiTypeID = 0x8c3e22c8 - -// construct implements constructor of ReactionTypeClass. -func (r ReactionTypeEmoji) construct() ReactionTypeClass { return &r } - -// Ensuring interfaces in compile-time for ReactionTypeEmoji. -var ( - _ bin.Encoder = &ReactionTypeEmoji{} - _ bin.Decoder = &ReactionTypeEmoji{} - _ bin.BareEncoder = &ReactionTypeEmoji{} - _ bin.BareDecoder = &ReactionTypeEmoji{} - - _ ReactionTypeClass = &ReactionTypeEmoji{} -) - -func (r *ReactionTypeEmoji) Zero() bool { - if r == nil { - return true - } - if !(r.Emoji == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReactionTypeEmoji) String() string { - if r == nil { - return "ReactionTypeEmoji(nil)" - } - type Alias ReactionTypeEmoji - return fmt.Sprintf("ReactionTypeEmoji%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReactionTypeEmoji) TypeID() uint32 { - return ReactionTypeEmojiTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReactionTypeEmoji) TypeName() string { - return "reactionTypeEmoji" -} - -// TypeInfo returns info about TL type. -func (r *ReactionTypeEmoji) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reactionTypeEmoji", - ID: ReactionTypeEmojiTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Emoji", - SchemaName: "emoji", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReactionTypeEmoji) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionTypeEmoji#8c3e22c8 as nil") - } - b.PutID(ReactionTypeEmojiTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReactionTypeEmoji) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionTypeEmoji#8c3e22c8 as nil") - } - b.PutString(r.Emoji) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReactionTypeEmoji) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionTypeEmoji#8c3e22c8 to nil") - } - if err := b.ConsumeID(ReactionTypeEmojiTypeID); err != nil { - return fmt.Errorf("unable to decode reactionTypeEmoji#8c3e22c8: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReactionTypeEmoji) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionTypeEmoji#8c3e22c8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reactionTypeEmoji#8c3e22c8: field emoji: %w", err) - } - r.Emoji = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReactionTypeEmoji) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reactionTypeEmoji#8c3e22c8 as nil") - } - b.ObjStart() - b.PutID("reactionTypeEmoji") - b.Comma() - b.FieldStart("emoji") - b.PutString(r.Emoji) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReactionTypeEmoji) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reactionTypeEmoji#8c3e22c8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reactionTypeEmoji"); err != nil { - return fmt.Errorf("unable to decode reactionTypeEmoji#8c3e22c8: %w", err) - } - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reactionTypeEmoji#8c3e22c8: field emoji: %w", err) - } - r.Emoji = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEmoji returns value of Emoji field. -func (r *ReactionTypeEmoji) GetEmoji() (value string) { - if r == nil { - return - } - return r.Emoji -} - -// ReactionTypeCustomEmoji represents TL type `reactionTypeCustomEmoji#c50b42f3`. -type ReactionTypeCustomEmoji struct { - // Unique identifier of the custom emoji - CustomEmojiID int64 -} - -// ReactionTypeCustomEmojiTypeID is TL type id of ReactionTypeCustomEmoji. -const ReactionTypeCustomEmojiTypeID = 0xc50b42f3 - -// construct implements constructor of ReactionTypeClass. -func (r ReactionTypeCustomEmoji) construct() ReactionTypeClass { return &r } - -// Ensuring interfaces in compile-time for ReactionTypeCustomEmoji. -var ( - _ bin.Encoder = &ReactionTypeCustomEmoji{} - _ bin.Decoder = &ReactionTypeCustomEmoji{} - _ bin.BareEncoder = &ReactionTypeCustomEmoji{} - _ bin.BareDecoder = &ReactionTypeCustomEmoji{} - - _ ReactionTypeClass = &ReactionTypeCustomEmoji{} -) - -func (r *ReactionTypeCustomEmoji) Zero() bool { - if r == nil { - return true - } - if !(r.CustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReactionTypeCustomEmoji) String() string { - if r == nil { - return "ReactionTypeCustomEmoji(nil)" - } - type Alias ReactionTypeCustomEmoji - return fmt.Sprintf("ReactionTypeCustomEmoji%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReactionTypeCustomEmoji) TypeID() uint32 { - return ReactionTypeCustomEmojiTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReactionTypeCustomEmoji) TypeName() string { - return "reactionTypeCustomEmoji" -} - -// TypeInfo returns info about TL type. -func (r *ReactionTypeCustomEmoji) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reactionTypeCustomEmoji", - ID: ReactionTypeCustomEmojiTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CustomEmojiID", - SchemaName: "custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReactionTypeCustomEmoji) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionTypeCustomEmoji#c50b42f3 as nil") - } - b.PutID(ReactionTypeCustomEmojiTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReactionTypeCustomEmoji) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionTypeCustomEmoji#c50b42f3 as nil") - } - b.PutLong(r.CustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReactionTypeCustomEmoji) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionTypeCustomEmoji#c50b42f3 to nil") - } - if err := b.ConsumeID(ReactionTypeCustomEmojiTypeID); err != nil { - return fmt.Errorf("unable to decode reactionTypeCustomEmoji#c50b42f3: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReactionTypeCustomEmoji) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionTypeCustomEmoji#c50b42f3 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode reactionTypeCustomEmoji#c50b42f3: field custom_emoji_id: %w", err) - } - r.CustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReactionTypeCustomEmoji) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reactionTypeCustomEmoji#c50b42f3 as nil") - } - b.ObjStart() - b.PutID("reactionTypeCustomEmoji") - b.Comma() - b.FieldStart("custom_emoji_id") - b.PutLong(r.CustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReactionTypeCustomEmoji) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reactionTypeCustomEmoji#c50b42f3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reactionTypeCustomEmoji"); err != nil { - return fmt.Errorf("unable to decode reactionTypeCustomEmoji#c50b42f3: %w", err) - } - case "custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode reactionTypeCustomEmoji#c50b42f3: field custom_emoji_id: %w", err) - } - r.CustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCustomEmojiID returns value of CustomEmojiID field. -func (r *ReactionTypeCustomEmoji) GetCustomEmojiID() (value int64) { - if r == nil { - return - } - return r.CustomEmojiID -} - -// ReactionTypePaid represents TL type `reactionTypePaid#1a0152ed`. -type ReactionTypePaid struct { -} - -// ReactionTypePaidTypeID is TL type id of ReactionTypePaid. -const ReactionTypePaidTypeID = 0x1a0152ed - -// construct implements constructor of ReactionTypeClass. -func (r ReactionTypePaid) construct() ReactionTypeClass { return &r } - -// Ensuring interfaces in compile-time for ReactionTypePaid. -var ( - _ bin.Encoder = &ReactionTypePaid{} - _ bin.Decoder = &ReactionTypePaid{} - _ bin.BareEncoder = &ReactionTypePaid{} - _ bin.BareDecoder = &ReactionTypePaid{} - - _ ReactionTypeClass = &ReactionTypePaid{} -) - -func (r *ReactionTypePaid) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReactionTypePaid) String() string { - if r == nil { - return "ReactionTypePaid(nil)" - } - type Alias ReactionTypePaid - return fmt.Sprintf("ReactionTypePaid%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReactionTypePaid) TypeID() uint32 { - return ReactionTypePaidTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReactionTypePaid) TypeName() string { - return "reactionTypePaid" -} - -// TypeInfo returns info about TL type. -func (r *ReactionTypePaid) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reactionTypePaid", - ID: ReactionTypePaidTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReactionTypePaid) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionTypePaid#1a0152ed as nil") - } - b.PutID(ReactionTypePaidTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReactionTypePaid) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionTypePaid#1a0152ed as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReactionTypePaid) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionTypePaid#1a0152ed to nil") - } - if err := b.ConsumeID(ReactionTypePaidTypeID); err != nil { - return fmt.Errorf("unable to decode reactionTypePaid#1a0152ed: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReactionTypePaid) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionTypePaid#1a0152ed to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReactionTypePaid) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reactionTypePaid#1a0152ed as nil") - } - b.ObjStart() - b.PutID("reactionTypePaid") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReactionTypePaid) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reactionTypePaid#1a0152ed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reactionTypePaid"); err != nil { - return fmt.Errorf("unable to decode reactionTypePaid#1a0152ed: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReactionTypeClassName is schema name of ReactionTypeClass. -const ReactionTypeClassName = "ReactionType" - -// ReactionTypeClass represents ReactionType generic type. -// -// Example: -// -// g, err := tdapi.DecodeReactionType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ReactionTypeEmoji: // reactionTypeEmoji#8c3e22c8 -// case *tdapi.ReactionTypeCustomEmoji: // reactionTypeCustomEmoji#c50b42f3 -// case *tdapi.ReactionTypePaid: // reactionTypePaid#1a0152ed -// default: panic(v) -// } -type ReactionTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ReactionTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeReactionType implements binary de-serialization for ReactionTypeClass. -func DecodeReactionType(buf *bin.Buffer) (ReactionTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ReactionTypeEmojiTypeID: - // Decoding reactionTypeEmoji#8c3e22c8. - v := ReactionTypeEmoji{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionTypeClass: %w", err) - } - return &v, nil - case ReactionTypeCustomEmojiTypeID: - // Decoding reactionTypeCustomEmoji#c50b42f3. - v := ReactionTypeCustomEmoji{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionTypeClass: %w", err) - } - return &v, nil - case ReactionTypePaidTypeID: - // Decoding reactionTypePaid#1a0152ed. - v := ReactionTypePaid{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReactionTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONReactionType implements binary de-serialization for ReactionTypeClass. -func DecodeTDLibJSONReactionType(buf tdjson.Decoder) (ReactionTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "reactionTypeEmoji": - // Decoding reactionTypeEmoji#8c3e22c8. - v := ReactionTypeEmoji{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionTypeClass: %w", err) - } - return &v, nil - case "reactionTypeCustomEmoji": - // Decoding reactionTypeCustomEmoji#c50b42f3. - v := ReactionTypeCustomEmoji{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionTypeClass: %w", err) - } - return &v, nil - case "reactionTypePaid": - // Decoding reactionTypePaid#1a0152ed. - v := ReactionTypePaid{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReactionTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ReactionType boxes the ReactionTypeClass providing a helper. -type ReactionTypeBox struct { - ReactionType ReactionTypeClass -} - -// Decode implements bin.Decoder for ReactionTypeBox. -func (b *ReactionTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ReactionTypeBox to nil") - } - v, err := DecodeReactionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReactionType = v - return nil -} - -// Encode implements bin.Encode for ReactionTypeBox. -func (b *ReactionTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ReactionType == nil { - return fmt.Errorf("unable to encode ReactionTypeClass as nil") - } - return b.ReactionType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ReactionTypeBox. -func (b *ReactionTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ReactionTypeBox to nil") - } - v, err := DecodeTDLibJSONReactionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReactionType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ReactionTypeBox. -func (b *ReactionTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ReactionType == nil { - return fmt.Errorf("unable to encode ReactionTypeClass as nil") - } - return b.ReactionType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_reaction_unavailability_reason_gen.go b/tdapi/tl_reaction_unavailability_reason_gen.go deleted file mode 100644 index 6975e53e7..000000000 --- a/tdapi/tl_reaction_unavailability_reason_gen.go +++ /dev/null @@ -1,433 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReactionUnavailabilityReasonAnonymousAdministrator represents TL type `reactionUnavailabilityReasonAnonymousAdministrator#e23883fb`. -type ReactionUnavailabilityReasonAnonymousAdministrator struct { -} - -// ReactionUnavailabilityReasonAnonymousAdministratorTypeID is TL type id of ReactionUnavailabilityReasonAnonymousAdministrator. -const ReactionUnavailabilityReasonAnonymousAdministratorTypeID = 0xe23883fb - -// construct implements constructor of ReactionUnavailabilityReasonClass. -func (r ReactionUnavailabilityReasonAnonymousAdministrator) construct() ReactionUnavailabilityReasonClass { - return &r -} - -// Ensuring interfaces in compile-time for ReactionUnavailabilityReasonAnonymousAdministrator. -var ( - _ bin.Encoder = &ReactionUnavailabilityReasonAnonymousAdministrator{} - _ bin.Decoder = &ReactionUnavailabilityReasonAnonymousAdministrator{} - _ bin.BareEncoder = &ReactionUnavailabilityReasonAnonymousAdministrator{} - _ bin.BareDecoder = &ReactionUnavailabilityReasonAnonymousAdministrator{} - - _ ReactionUnavailabilityReasonClass = &ReactionUnavailabilityReasonAnonymousAdministrator{} -) - -func (r *ReactionUnavailabilityReasonAnonymousAdministrator) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReactionUnavailabilityReasonAnonymousAdministrator) String() string { - if r == nil { - return "ReactionUnavailabilityReasonAnonymousAdministrator(nil)" - } - type Alias ReactionUnavailabilityReasonAnonymousAdministrator - return fmt.Sprintf("ReactionUnavailabilityReasonAnonymousAdministrator%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReactionUnavailabilityReasonAnonymousAdministrator) TypeID() uint32 { - return ReactionUnavailabilityReasonAnonymousAdministratorTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReactionUnavailabilityReasonAnonymousAdministrator) TypeName() string { - return "reactionUnavailabilityReasonAnonymousAdministrator" -} - -// TypeInfo returns info about TL type. -func (r *ReactionUnavailabilityReasonAnonymousAdministrator) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reactionUnavailabilityReasonAnonymousAdministrator", - ID: ReactionUnavailabilityReasonAnonymousAdministratorTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReactionUnavailabilityReasonAnonymousAdministrator) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionUnavailabilityReasonAnonymousAdministrator#e23883fb as nil") - } - b.PutID(ReactionUnavailabilityReasonAnonymousAdministratorTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReactionUnavailabilityReasonAnonymousAdministrator) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionUnavailabilityReasonAnonymousAdministrator#e23883fb as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReactionUnavailabilityReasonAnonymousAdministrator) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionUnavailabilityReasonAnonymousAdministrator#e23883fb to nil") - } - if err := b.ConsumeID(ReactionUnavailabilityReasonAnonymousAdministratorTypeID); err != nil { - return fmt.Errorf("unable to decode reactionUnavailabilityReasonAnonymousAdministrator#e23883fb: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReactionUnavailabilityReasonAnonymousAdministrator) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionUnavailabilityReasonAnonymousAdministrator#e23883fb to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReactionUnavailabilityReasonAnonymousAdministrator) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reactionUnavailabilityReasonAnonymousAdministrator#e23883fb as nil") - } - b.ObjStart() - b.PutID("reactionUnavailabilityReasonAnonymousAdministrator") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReactionUnavailabilityReasonAnonymousAdministrator) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reactionUnavailabilityReasonAnonymousAdministrator#e23883fb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reactionUnavailabilityReasonAnonymousAdministrator"); err != nil { - return fmt.Errorf("unable to decode reactionUnavailabilityReasonAnonymousAdministrator#e23883fb: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReactionUnavailabilityReasonGuest represents TL type `reactionUnavailabilityReasonGuest#50ef5244`. -type ReactionUnavailabilityReasonGuest struct { -} - -// ReactionUnavailabilityReasonGuestTypeID is TL type id of ReactionUnavailabilityReasonGuest. -const ReactionUnavailabilityReasonGuestTypeID = 0x50ef5244 - -// construct implements constructor of ReactionUnavailabilityReasonClass. -func (r ReactionUnavailabilityReasonGuest) construct() ReactionUnavailabilityReasonClass { return &r } - -// Ensuring interfaces in compile-time for ReactionUnavailabilityReasonGuest. -var ( - _ bin.Encoder = &ReactionUnavailabilityReasonGuest{} - _ bin.Decoder = &ReactionUnavailabilityReasonGuest{} - _ bin.BareEncoder = &ReactionUnavailabilityReasonGuest{} - _ bin.BareDecoder = &ReactionUnavailabilityReasonGuest{} - - _ ReactionUnavailabilityReasonClass = &ReactionUnavailabilityReasonGuest{} -) - -func (r *ReactionUnavailabilityReasonGuest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReactionUnavailabilityReasonGuest) String() string { - if r == nil { - return "ReactionUnavailabilityReasonGuest(nil)" - } - type Alias ReactionUnavailabilityReasonGuest - return fmt.Sprintf("ReactionUnavailabilityReasonGuest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReactionUnavailabilityReasonGuest) TypeID() uint32 { - return ReactionUnavailabilityReasonGuestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReactionUnavailabilityReasonGuest) TypeName() string { - return "reactionUnavailabilityReasonGuest" -} - -// TypeInfo returns info about TL type. -func (r *ReactionUnavailabilityReasonGuest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reactionUnavailabilityReasonGuest", - ID: ReactionUnavailabilityReasonGuestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReactionUnavailabilityReasonGuest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionUnavailabilityReasonGuest#50ef5244 as nil") - } - b.PutID(ReactionUnavailabilityReasonGuestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReactionUnavailabilityReasonGuest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reactionUnavailabilityReasonGuest#50ef5244 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReactionUnavailabilityReasonGuest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionUnavailabilityReasonGuest#50ef5244 to nil") - } - if err := b.ConsumeID(ReactionUnavailabilityReasonGuestTypeID); err != nil { - return fmt.Errorf("unable to decode reactionUnavailabilityReasonGuest#50ef5244: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReactionUnavailabilityReasonGuest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reactionUnavailabilityReasonGuest#50ef5244 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReactionUnavailabilityReasonGuest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reactionUnavailabilityReasonGuest#50ef5244 as nil") - } - b.ObjStart() - b.PutID("reactionUnavailabilityReasonGuest") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReactionUnavailabilityReasonGuest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reactionUnavailabilityReasonGuest#50ef5244 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reactionUnavailabilityReasonGuest"); err != nil { - return fmt.Errorf("unable to decode reactionUnavailabilityReasonGuest#50ef5244: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReactionUnavailabilityReasonClassName is schema name of ReactionUnavailabilityReasonClass. -const ReactionUnavailabilityReasonClassName = "ReactionUnavailabilityReason" - -// ReactionUnavailabilityReasonClass represents ReactionUnavailabilityReason generic type. -// -// Example: -// -// g, err := tdapi.DecodeReactionUnavailabilityReason(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ReactionUnavailabilityReasonAnonymousAdministrator: // reactionUnavailabilityReasonAnonymousAdministrator#e23883fb -// case *tdapi.ReactionUnavailabilityReasonGuest: // reactionUnavailabilityReasonGuest#50ef5244 -// default: panic(v) -// } -type ReactionUnavailabilityReasonClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ReactionUnavailabilityReasonClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeReactionUnavailabilityReason implements binary de-serialization for ReactionUnavailabilityReasonClass. -func DecodeReactionUnavailabilityReason(buf *bin.Buffer) (ReactionUnavailabilityReasonClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ReactionUnavailabilityReasonAnonymousAdministratorTypeID: - // Decoding reactionUnavailabilityReasonAnonymousAdministrator#e23883fb. - v := ReactionUnavailabilityReasonAnonymousAdministrator{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionUnavailabilityReasonClass: %w", err) - } - return &v, nil - case ReactionUnavailabilityReasonGuestTypeID: - // Decoding reactionUnavailabilityReasonGuest#50ef5244. - v := ReactionUnavailabilityReasonGuest{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionUnavailabilityReasonClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReactionUnavailabilityReasonClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONReactionUnavailabilityReason implements binary de-serialization for ReactionUnavailabilityReasonClass. -func DecodeTDLibJSONReactionUnavailabilityReason(buf tdjson.Decoder) (ReactionUnavailabilityReasonClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "reactionUnavailabilityReasonAnonymousAdministrator": - // Decoding reactionUnavailabilityReasonAnonymousAdministrator#e23883fb. - v := ReactionUnavailabilityReasonAnonymousAdministrator{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionUnavailabilityReasonClass: %w", err) - } - return &v, nil - case "reactionUnavailabilityReasonGuest": - // Decoding reactionUnavailabilityReasonGuest#50ef5244. - v := ReactionUnavailabilityReasonGuest{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReactionUnavailabilityReasonClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReactionUnavailabilityReasonClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ReactionUnavailabilityReason boxes the ReactionUnavailabilityReasonClass providing a helper. -type ReactionUnavailabilityReasonBox struct { - ReactionUnavailabilityReason ReactionUnavailabilityReasonClass -} - -// Decode implements bin.Decoder for ReactionUnavailabilityReasonBox. -func (b *ReactionUnavailabilityReasonBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ReactionUnavailabilityReasonBox to nil") - } - v, err := DecodeReactionUnavailabilityReason(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReactionUnavailabilityReason = v - return nil -} - -// Encode implements bin.Encode for ReactionUnavailabilityReasonBox. -func (b *ReactionUnavailabilityReasonBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ReactionUnavailabilityReason == nil { - return fmt.Errorf("unable to encode ReactionUnavailabilityReasonClass as nil") - } - return b.ReactionUnavailabilityReason.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ReactionUnavailabilityReasonBox. -func (b *ReactionUnavailabilityReasonBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ReactionUnavailabilityReasonBox to nil") - } - v, err := DecodeTDLibJSONReactionUnavailabilityReason(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReactionUnavailabilityReason = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ReactionUnavailabilityReasonBox. -func (b *ReactionUnavailabilityReasonBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ReactionUnavailabilityReason == nil { - return fmt.Errorf("unable to encode ReactionUnavailabilityReasonClass as nil") - } - return b.ReactionUnavailabilityReason.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_read_all_chat_mentions_gen.go b/tdapi/tl_read_all_chat_mentions_gen.go deleted file mode 100644 index e7a7b4f11..000000000 --- a/tdapi/tl_read_all_chat_mentions_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReadAllChatMentionsRequest represents TL type `readAllChatMentions#50eab2b5`. -type ReadAllChatMentionsRequest struct { - // Chat identifier - ChatID int64 -} - -// ReadAllChatMentionsRequestTypeID is TL type id of ReadAllChatMentionsRequest. -const ReadAllChatMentionsRequestTypeID = 0x50eab2b5 - -// Ensuring interfaces in compile-time for ReadAllChatMentionsRequest. -var ( - _ bin.Encoder = &ReadAllChatMentionsRequest{} - _ bin.Decoder = &ReadAllChatMentionsRequest{} - _ bin.BareEncoder = &ReadAllChatMentionsRequest{} - _ bin.BareDecoder = &ReadAllChatMentionsRequest{} -) - -func (r *ReadAllChatMentionsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReadAllChatMentionsRequest) String() string { - if r == nil { - return "ReadAllChatMentionsRequest(nil)" - } - type Alias ReadAllChatMentionsRequest - return fmt.Sprintf("ReadAllChatMentionsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReadAllChatMentionsRequest) TypeID() uint32 { - return ReadAllChatMentionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReadAllChatMentionsRequest) TypeName() string { - return "readAllChatMentions" -} - -// TypeInfo returns info about TL type. -func (r *ReadAllChatMentionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "readAllChatMentions", - ID: ReadAllChatMentionsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReadAllChatMentionsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readAllChatMentions#50eab2b5 as nil") - } - b.PutID(ReadAllChatMentionsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReadAllChatMentionsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readAllChatMentions#50eab2b5 as nil") - } - b.PutInt53(r.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReadAllChatMentionsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readAllChatMentions#50eab2b5 to nil") - } - if err := b.ConsumeID(ReadAllChatMentionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode readAllChatMentions#50eab2b5: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReadAllChatMentionsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readAllChatMentions#50eab2b5 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllChatMentions#50eab2b5: field chat_id: %w", err) - } - r.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReadAllChatMentionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode readAllChatMentions#50eab2b5 as nil") - } - b.ObjStart() - b.PutID("readAllChatMentions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReadAllChatMentionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode readAllChatMentions#50eab2b5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("readAllChatMentions"); err != nil { - return fmt.Errorf("unable to decode readAllChatMentions#50eab2b5: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllChatMentions#50eab2b5: field chat_id: %w", err) - } - r.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *ReadAllChatMentionsRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// ReadAllChatMentions invokes method readAllChatMentions#50eab2b5 returning error if any. -func (c *Client) ReadAllChatMentions(ctx context.Context, chatid int64) error { - var ok Ok - - request := &ReadAllChatMentionsRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_read_all_chat_reactions_gen.go b/tdapi/tl_read_all_chat_reactions_gen.go deleted file mode 100644 index acd16eb08..000000000 --- a/tdapi/tl_read_all_chat_reactions_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReadAllChatReactionsRequest represents TL type `readAllChatReactions#54c1976d`. -type ReadAllChatReactionsRequest struct { - // Chat identifier - ChatID int64 -} - -// ReadAllChatReactionsRequestTypeID is TL type id of ReadAllChatReactionsRequest. -const ReadAllChatReactionsRequestTypeID = 0x54c1976d - -// Ensuring interfaces in compile-time for ReadAllChatReactionsRequest. -var ( - _ bin.Encoder = &ReadAllChatReactionsRequest{} - _ bin.Decoder = &ReadAllChatReactionsRequest{} - _ bin.BareEncoder = &ReadAllChatReactionsRequest{} - _ bin.BareDecoder = &ReadAllChatReactionsRequest{} -) - -func (r *ReadAllChatReactionsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReadAllChatReactionsRequest) String() string { - if r == nil { - return "ReadAllChatReactionsRequest(nil)" - } - type Alias ReadAllChatReactionsRequest - return fmt.Sprintf("ReadAllChatReactionsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReadAllChatReactionsRequest) TypeID() uint32 { - return ReadAllChatReactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReadAllChatReactionsRequest) TypeName() string { - return "readAllChatReactions" -} - -// TypeInfo returns info about TL type. -func (r *ReadAllChatReactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "readAllChatReactions", - ID: ReadAllChatReactionsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReadAllChatReactionsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readAllChatReactions#54c1976d as nil") - } - b.PutID(ReadAllChatReactionsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReadAllChatReactionsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readAllChatReactions#54c1976d as nil") - } - b.PutInt53(r.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReadAllChatReactionsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readAllChatReactions#54c1976d to nil") - } - if err := b.ConsumeID(ReadAllChatReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode readAllChatReactions#54c1976d: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReadAllChatReactionsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readAllChatReactions#54c1976d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllChatReactions#54c1976d: field chat_id: %w", err) - } - r.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReadAllChatReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode readAllChatReactions#54c1976d as nil") - } - b.ObjStart() - b.PutID("readAllChatReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReadAllChatReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode readAllChatReactions#54c1976d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("readAllChatReactions"); err != nil { - return fmt.Errorf("unable to decode readAllChatReactions#54c1976d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllChatReactions#54c1976d: field chat_id: %w", err) - } - r.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *ReadAllChatReactionsRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// ReadAllChatReactions invokes method readAllChatReactions#54c1976d returning error if any. -func (c *Client) ReadAllChatReactions(ctx context.Context, chatid int64) error { - var ok Ok - - request := &ReadAllChatReactionsRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_read_all_message_thread_mentions_gen.go b/tdapi/tl_read_all_message_thread_mentions_gen.go deleted file mode 100644 index 207c44c92..000000000 --- a/tdapi/tl_read_all_message_thread_mentions_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReadAllMessageThreadMentionsRequest represents TL type `readAllMessageThreadMentions#4edd7555`. -type ReadAllMessageThreadMentionsRequest struct { - // Chat identifier - ChatID int64 - // Message thread identifier in which mentions are marked as read - MessageThreadID int64 -} - -// ReadAllMessageThreadMentionsRequestTypeID is TL type id of ReadAllMessageThreadMentionsRequest. -const ReadAllMessageThreadMentionsRequestTypeID = 0x4edd7555 - -// Ensuring interfaces in compile-time for ReadAllMessageThreadMentionsRequest. -var ( - _ bin.Encoder = &ReadAllMessageThreadMentionsRequest{} - _ bin.Decoder = &ReadAllMessageThreadMentionsRequest{} - _ bin.BareEncoder = &ReadAllMessageThreadMentionsRequest{} - _ bin.BareDecoder = &ReadAllMessageThreadMentionsRequest{} -) - -func (r *ReadAllMessageThreadMentionsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.MessageThreadID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReadAllMessageThreadMentionsRequest) String() string { - if r == nil { - return "ReadAllMessageThreadMentionsRequest(nil)" - } - type Alias ReadAllMessageThreadMentionsRequest - return fmt.Sprintf("ReadAllMessageThreadMentionsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReadAllMessageThreadMentionsRequest) TypeID() uint32 { - return ReadAllMessageThreadMentionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReadAllMessageThreadMentionsRequest) TypeName() string { - return "readAllMessageThreadMentions" -} - -// TypeInfo returns info about TL type. -func (r *ReadAllMessageThreadMentionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "readAllMessageThreadMentions", - ID: ReadAllMessageThreadMentionsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReadAllMessageThreadMentionsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readAllMessageThreadMentions#4edd7555 as nil") - } - b.PutID(ReadAllMessageThreadMentionsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReadAllMessageThreadMentionsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readAllMessageThreadMentions#4edd7555 as nil") - } - b.PutInt53(r.ChatID) - b.PutInt53(r.MessageThreadID) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReadAllMessageThreadMentionsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readAllMessageThreadMentions#4edd7555 to nil") - } - if err := b.ConsumeID(ReadAllMessageThreadMentionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadMentions#4edd7555: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReadAllMessageThreadMentionsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readAllMessageThreadMentions#4edd7555 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadMentions#4edd7555: field chat_id: %w", err) - } - r.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadMentions#4edd7555: field message_thread_id: %w", err) - } - r.MessageThreadID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReadAllMessageThreadMentionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode readAllMessageThreadMentions#4edd7555 as nil") - } - b.ObjStart() - b.PutID("readAllMessageThreadMentions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(r.MessageThreadID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReadAllMessageThreadMentionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode readAllMessageThreadMentions#4edd7555 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("readAllMessageThreadMentions"); err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadMentions#4edd7555: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadMentions#4edd7555: field chat_id: %w", err) - } - r.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadMentions#4edd7555: field message_thread_id: %w", err) - } - r.MessageThreadID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *ReadAllMessageThreadMentionsRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (r *ReadAllMessageThreadMentionsRequest) GetMessageThreadID() (value int64) { - if r == nil { - return - } - return r.MessageThreadID -} - -// ReadAllMessageThreadMentions invokes method readAllMessageThreadMentions#4edd7555 returning error if any. -func (c *Client) ReadAllMessageThreadMentions(ctx context.Context, request *ReadAllMessageThreadMentionsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_read_all_message_thread_reactions_gen.go b/tdapi/tl_read_all_message_thread_reactions_gen.go deleted file mode 100644 index 182fb5fb7..000000000 --- a/tdapi/tl_read_all_message_thread_reactions_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReadAllMessageThreadReactionsRequest represents TL type `readAllMessageThreadReactions#d0bc273e`. -type ReadAllMessageThreadReactionsRequest struct { - // Chat identifier - ChatID int64 - // Message thread identifier in which reactions are marked as read - MessageThreadID int64 -} - -// ReadAllMessageThreadReactionsRequestTypeID is TL type id of ReadAllMessageThreadReactionsRequest. -const ReadAllMessageThreadReactionsRequestTypeID = 0xd0bc273e - -// Ensuring interfaces in compile-time for ReadAllMessageThreadReactionsRequest. -var ( - _ bin.Encoder = &ReadAllMessageThreadReactionsRequest{} - _ bin.Decoder = &ReadAllMessageThreadReactionsRequest{} - _ bin.BareEncoder = &ReadAllMessageThreadReactionsRequest{} - _ bin.BareDecoder = &ReadAllMessageThreadReactionsRequest{} -) - -func (r *ReadAllMessageThreadReactionsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.MessageThreadID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReadAllMessageThreadReactionsRequest) String() string { - if r == nil { - return "ReadAllMessageThreadReactionsRequest(nil)" - } - type Alias ReadAllMessageThreadReactionsRequest - return fmt.Sprintf("ReadAllMessageThreadReactionsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReadAllMessageThreadReactionsRequest) TypeID() uint32 { - return ReadAllMessageThreadReactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReadAllMessageThreadReactionsRequest) TypeName() string { - return "readAllMessageThreadReactions" -} - -// TypeInfo returns info about TL type. -func (r *ReadAllMessageThreadReactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "readAllMessageThreadReactions", - ID: ReadAllMessageThreadReactionsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReadAllMessageThreadReactionsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readAllMessageThreadReactions#d0bc273e as nil") - } - b.PutID(ReadAllMessageThreadReactionsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReadAllMessageThreadReactionsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readAllMessageThreadReactions#d0bc273e as nil") - } - b.PutInt53(r.ChatID) - b.PutInt53(r.MessageThreadID) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReadAllMessageThreadReactionsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readAllMessageThreadReactions#d0bc273e to nil") - } - if err := b.ConsumeID(ReadAllMessageThreadReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadReactions#d0bc273e: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReadAllMessageThreadReactionsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readAllMessageThreadReactions#d0bc273e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadReactions#d0bc273e: field chat_id: %w", err) - } - r.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadReactions#d0bc273e: field message_thread_id: %w", err) - } - r.MessageThreadID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReadAllMessageThreadReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode readAllMessageThreadReactions#d0bc273e as nil") - } - b.ObjStart() - b.PutID("readAllMessageThreadReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(r.MessageThreadID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReadAllMessageThreadReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode readAllMessageThreadReactions#d0bc273e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("readAllMessageThreadReactions"); err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadReactions#d0bc273e: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadReactions#d0bc273e: field chat_id: %w", err) - } - r.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readAllMessageThreadReactions#d0bc273e: field message_thread_id: %w", err) - } - r.MessageThreadID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *ReadAllMessageThreadReactionsRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (r *ReadAllMessageThreadReactionsRequest) GetMessageThreadID() (value int64) { - if r == nil { - return - } - return r.MessageThreadID -} - -// ReadAllMessageThreadReactions invokes method readAllMessageThreadReactions#d0bc273e returning error if any. -func (c *Client) ReadAllMessageThreadReactions(ctx context.Context, request *ReadAllMessageThreadReactionsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_read_chat_list_gen.go b/tdapi/tl_read_chat_list_gen.go deleted file mode 100644 index 4cdf297f6..000000000 --- a/tdapi/tl_read_chat_list_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReadChatListRequest represents TL type `readChatList#bd6498aa`. -type ReadChatListRequest struct { - // Chat list in which to mark all chats as read - ChatList ChatListClass -} - -// ReadChatListRequestTypeID is TL type id of ReadChatListRequest. -const ReadChatListRequestTypeID = 0xbd6498aa - -// Ensuring interfaces in compile-time for ReadChatListRequest. -var ( - _ bin.Encoder = &ReadChatListRequest{} - _ bin.Decoder = &ReadChatListRequest{} - _ bin.BareEncoder = &ReadChatListRequest{} - _ bin.BareDecoder = &ReadChatListRequest{} -) - -func (r *ReadChatListRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatList == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReadChatListRequest) String() string { - if r == nil { - return "ReadChatListRequest(nil)" - } - type Alias ReadChatListRequest - return fmt.Sprintf("ReadChatListRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReadChatListRequest) TypeID() uint32 { - return ReadChatListRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReadChatListRequest) TypeName() string { - return "readChatList" -} - -// TypeInfo returns info about TL type. -func (r *ReadChatListRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "readChatList", - ID: ReadChatListRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatList", - SchemaName: "chat_list", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReadChatListRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readChatList#bd6498aa as nil") - } - b.PutID(ReadChatListRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReadChatListRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readChatList#bd6498aa as nil") - } - if r.ChatList == nil { - return fmt.Errorf("unable to encode readChatList#bd6498aa: field chat_list is nil") - } - if err := r.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode readChatList#bd6498aa: field chat_list: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReadChatListRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readChatList#bd6498aa to nil") - } - if err := b.ConsumeID(ReadChatListRequestTypeID); err != nil { - return fmt.Errorf("unable to decode readChatList#bd6498aa: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReadChatListRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readChatList#bd6498aa to nil") - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode readChatList#bd6498aa: field chat_list: %w", err) - } - r.ChatList = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReadChatListRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode readChatList#bd6498aa as nil") - } - b.ObjStart() - b.PutID("readChatList") - b.Comma() - b.FieldStart("chat_list") - if r.ChatList == nil { - return fmt.Errorf("unable to encode readChatList#bd6498aa: field chat_list is nil") - } - if err := r.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode readChatList#bd6498aa: field chat_list: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReadChatListRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode readChatList#bd6498aa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("readChatList"); err != nil { - return fmt.Errorf("unable to decode readChatList#bd6498aa: %w", err) - } - case "chat_list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode readChatList#bd6498aa: field chat_list: %w", err) - } - r.ChatList = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatList returns value of ChatList field. -func (r *ReadChatListRequest) GetChatList() (value ChatListClass) { - if r == nil { - return - } - return r.ChatList -} - -// ReadChatList invokes method readChatList#bd6498aa returning error if any. -func (c *Client) ReadChatList(ctx context.Context, chatlist ChatListClass) error { - var ok Ok - - request := &ReadChatListRequest{ - ChatList: chatlist, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_read_date_privacy_settings_gen.go b/tdapi/tl_read_date_privacy_settings_gen.go deleted file mode 100644 index 0af46abc3..000000000 --- a/tdapi/tl_read_date_privacy_settings_gen.go +++ /dev/null @@ -1,195 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReadDatePrivacySettings represents TL type `readDatePrivacySettings#62a2e628`. -type ReadDatePrivacySettings struct { - // True, if message read date is shown to other users in private chats. If false and the - // current user isn't a Telegram Premium user, then they will not be able to see other's - // message read date - ShowReadDate bool -} - -// ReadDatePrivacySettingsTypeID is TL type id of ReadDatePrivacySettings. -const ReadDatePrivacySettingsTypeID = 0x62a2e628 - -// Ensuring interfaces in compile-time for ReadDatePrivacySettings. -var ( - _ bin.Encoder = &ReadDatePrivacySettings{} - _ bin.Decoder = &ReadDatePrivacySettings{} - _ bin.BareEncoder = &ReadDatePrivacySettings{} - _ bin.BareDecoder = &ReadDatePrivacySettings{} -) - -func (r *ReadDatePrivacySettings) Zero() bool { - if r == nil { - return true - } - if !(r.ShowReadDate == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReadDatePrivacySettings) String() string { - if r == nil { - return "ReadDatePrivacySettings(nil)" - } - type Alias ReadDatePrivacySettings - return fmt.Sprintf("ReadDatePrivacySettings%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReadDatePrivacySettings) TypeID() uint32 { - return ReadDatePrivacySettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReadDatePrivacySettings) TypeName() string { - return "readDatePrivacySettings" -} - -// TypeInfo returns info about TL type. -func (r *ReadDatePrivacySettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "readDatePrivacySettings", - ID: ReadDatePrivacySettingsTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShowReadDate", - SchemaName: "show_read_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReadDatePrivacySettings) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readDatePrivacySettings#62a2e628 as nil") - } - b.PutID(ReadDatePrivacySettingsTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReadDatePrivacySettings) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readDatePrivacySettings#62a2e628 as nil") - } - b.PutBool(r.ShowReadDate) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReadDatePrivacySettings) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readDatePrivacySettings#62a2e628 to nil") - } - if err := b.ConsumeID(ReadDatePrivacySettingsTypeID); err != nil { - return fmt.Errorf("unable to decode readDatePrivacySettings#62a2e628: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReadDatePrivacySettings) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readDatePrivacySettings#62a2e628 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode readDatePrivacySettings#62a2e628: field show_read_date: %w", err) - } - r.ShowReadDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReadDatePrivacySettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode readDatePrivacySettings#62a2e628 as nil") - } - b.ObjStart() - b.PutID("readDatePrivacySettings") - b.Comma() - b.FieldStart("show_read_date") - b.PutBool(r.ShowReadDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReadDatePrivacySettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode readDatePrivacySettings#62a2e628 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("readDatePrivacySettings"); err != nil { - return fmt.Errorf("unable to decode readDatePrivacySettings#62a2e628: %w", err) - } - case "show_read_date": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode readDatePrivacySettings#62a2e628: field show_read_date: %w", err) - } - r.ShowReadDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetShowReadDate returns value of ShowReadDate field. -func (r *ReadDatePrivacySettings) GetShowReadDate() (value bool) { - if r == nil { - return - } - return r.ShowReadDate -} diff --git a/tdapi/tl_read_file_part_gen.go b/tdapi/tl_read_file_part_gen.go deleted file mode 100644 index 8af36a3d5..000000000 --- a/tdapi/tl_read_file_part_gen.go +++ /dev/null @@ -1,273 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReadFilePartRequest represents TL type `readFilePart#360ca70d`. -type ReadFilePartRequest struct { - // Identifier of the file. The file must be located in the TDLib file cache - FileID int32 - // The offset from which to read the file - Offset int64 - // Number of bytes to read. An error will be returned if there are not enough bytes - // available in the file from the specified position. Pass 0 to read all available data - // from the specified position - Count int64 -} - -// ReadFilePartRequestTypeID is TL type id of ReadFilePartRequest. -const ReadFilePartRequestTypeID = 0x360ca70d - -// Ensuring interfaces in compile-time for ReadFilePartRequest. -var ( - _ bin.Encoder = &ReadFilePartRequest{} - _ bin.Decoder = &ReadFilePartRequest{} - _ bin.BareEncoder = &ReadFilePartRequest{} - _ bin.BareDecoder = &ReadFilePartRequest{} -) - -func (r *ReadFilePartRequest) Zero() bool { - if r == nil { - return true - } - if !(r.FileID == 0) { - return false - } - if !(r.Offset == 0) { - return false - } - if !(r.Count == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReadFilePartRequest) String() string { - if r == nil { - return "ReadFilePartRequest(nil)" - } - type Alias ReadFilePartRequest - return fmt.Sprintf("ReadFilePartRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReadFilePartRequest) TypeID() uint32 { - return ReadFilePartRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReadFilePartRequest) TypeName() string { - return "readFilePart" -} - -// TypeInfo returns info about TL type. -func (r *ReadFilePartRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "readFilePart", - ID: ReadFilePartRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Count", - SchemaName: "count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReadFilePartRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readFilePart#360ca70d as nil") - } - b.PutID(ReadFilePartRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReadFilePartRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readFilePart#360ca70d as nil") - } - b.PutInt32(r.FileID) - b.PutInt53(r.Offset) - b.PutInt53(r.Count) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReadFilePartRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readFilePart#360ca70d to nil") - } - if err := b.ConsumeID(ReadFilePartRequestTypeID); err != nil { - return fmt.Errorf("unable to decode readFilePart#360ca70d: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReadFilePartRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readFilePart#360ca70d to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode readFilePart#360ca70d: field file_id: %w", err) - } - r.FileID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readFilePart#360ca70d: field offset: %w", err) - } - r.Offset = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readFilePart#360ca70d: field count: %w", err) - } - r.Count = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReadFilePartRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode readFilePart#360ca70d as nil") - } - b.ObjStart() - b.PutID("readFilePart") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(r.FileID) - b.Comma() - b.FieldStart("offset") - b.PutInt53(r.Offset) - b.Comma() - b.FieldStart("count") - b.PutInt53(r.Count) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReadFilePartRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode readFilePart#360ca70d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("readFilePart"); err != nil { - return fmt.Errorf("unable to decode readFilePart#360ca70d: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode readFilePart#360ca70d: field file_id: %w", err) - } - r.FileID = value - case "offset": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readFilePart#360ca70d: field offset: %w", err) - } - r.Offset = value - case "count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readFilePart#360ca70d: field count: %w", err) - } - r.Count = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (r *ReadFilePartRequest) GetFileID() (value int32) { - if r == nil { - return - } - return r.FileID -} - -// GetOffset returns value of Offset field. -func (r *ReadFilePartRequest) GetOffset() (value int64) { - if r == nil { - return - } - return r.Offset -} - -// GetCount returns value of Count field. -func (r *ReadFilePartRequest) GetCount() (value int64) { - if r == nil { - return - } - return r.Count -} - -// ReadFilePart invokes method readFilePart#360ca70d returning error if any. -func (c *Client) ReadFilePart(ctx context.Context, request *ReadFilePartRequest) (*FilePart, error) { - var result FilePart - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_readd_quick_reply_shortcut_messages_gen.go b/tdapi/tl_readd_quick_reply_shortcut_messages_gen.go deleted file mode 100644 index e0a0856a6..000000000 --- a/tdapi/tl_readd_quick_reply_shortcut_messages_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReaddQuickReplyShortcutMessagesRequest represents TL type `readdQuickReplyShortcutMessages#652518f7`. -type ReaddQuickReplyShortcutMessagesRequest struct { - // Name of the target shortcut - ShortcutName string - // Identifiers of the quick reply messages to readd. Message identifiers must be in a - // strictly increasing order - MessageIDs []int64 -} - -// ReaddQuickReplyShortcutMessagesRequestTypeID is TL type id of ReaddQuickReplyShortcutMessagesRequest. -const ReaddQuickReplyShortcutMessagesRequestTypeID = 0x652518f7 - -// Ensuring interfaces in compile-time for ReaddQuickReplyShortcutMessagesRequest. -var ( - _ bin.Encoder = &ReaddQuickReplyShortcutMessagesRequest{} - _ bin.Decoder = &ReaddQuickReplyShortcutMessagesRequest{} - _ bin.BareEncoder = &ReaddQuickReplyShortcutMessagesRequest{} - _ bin.BareDecoder = &ReaddQuickReplyShortcutMessagesRequest{} -) - -func (r *ReaddQuickReplyShortcutMessagesRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ShortcutName == "") { - return false - } - if !(r.MessageIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReaddQuickReplyShortcutMessagesRequest) String() string { - if r == nil { - return "ReaddQuickReplyShortcutMessagesRequest(nil)" - } - type Alias ReaddQuickReplyShortcutMessagesRequest - return fmt.Sprintf("ReaddQuickReplyShortcutMessagesRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReaddQuickReplyShortcutMessagesRequest) TypeID() uint32 { - return ReaddQuickReplyShortcutMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReaddQuickReplyShortcutMessagesRequest) TypeName() string { - return "readdQuickReplyShortcutMessages" -} - -// TypeInfo returns info about TL type. -func (r *ReaddQuickReplyShortcutMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "readdQuickReplyShortcutMessages", - ID: ReaddQuickReplyShortcutMessagesRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutName", - SchemaName: "shortcut_name", - }, - { - Name: "MessageIDs", - SchemaName: "message_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReaddQuickReplyShortcutMessagesRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readdQuickReplyShortcutMessages#652518f7 as nil") - } - b.PutID(ReaddQuickReplyShortcutMessagesRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReaddQuickReplyShortcutMessagesRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode readdQuickReplyShortcutMessages#652518f7 as nil") - } - b.PutString(r.ShortcutName) - b.PutInt(len(r.MessageIDs)) - for _, v := range r.MessageIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReaddQuickReplyShortcutMessagesRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readdQuickReplyShortcutMessages#652518f7 to nil") - } - if err := b.ConsumeID(ReaddQuickReplyShortcutMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode readdQuickReplyShortcutMessages#652518f7: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReaddQuickReplyShortcutMessagesRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode readdQuickReplyShortcutMessages#652518f7 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode readdQuickReplyShortcutMessages#652518f7: field shortcut_name: %w", err) - } - r.ShortcutName = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode readdQuickReplyShortcutMessages#652518f7: field message_ids: %w", err) - } - - if headerLen > 0 { - r.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readdQuickReplyShortcutMessages#652518f7: field message_ids: %w", err) - } - r.MessageIDs = append(r.MessageIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReaddQuickReplyShortcutMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode readdQuickReplyShortcutMessages#652518f7 as nil") - } - b.ObjStart() - b.PutID("readdQuickReplyShortcutMessages") - b.Comma() - b.FieldStart("shortcut_name") - b.PutString(r.ShortcutName) - b.Comma() - b.FieldStart("message_ids") - b.ArrStart() - for _, v := range r.MessageIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReaddQuickReplyShortcutMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode readdQuickReplyShortcutMessages#652518f7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("readdQuickReplyShortcutMessages"); err != nil { - return fmt.Errorf("unable to decode readdQuickReplyShortcutMessages#652518f7: %w", err) - } - case "shortcut_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode readdQuickReplyShortcutMessages#652518f7: field shortcut_name: %w", err) - } - r.ShortcutName = value - case "message_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode readdQuickReplyShortcutMessages#652518f7: field message_ids: %w", err) - } - r.MessageIDs = append(r.MessageIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode readdQuickReplyShortcutMessages#652518f7: field message_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutName returns value of ShortcutName field. -func (r *ReaddQuickReplyShortcutMessagesRequest) GetShortcutName() (value string) { - if r == nil { - return - } - return r.ShortcutName -} - -// GetMessageIDs returns value of MessageIDs field. -func (r *ReaddQuickReplyShortcutMessagesRequest) GetMessageIDs() (value []int64) { - if r == nil { - return - } - return r.MessageIDs -} - -// ReaddQuickReplyShortcutMessages invokes method readdQuickReplyShortcutMessages#652518f7 returning error if any. -func (c *Client) ReaddQuickReplyShortcutMessages(ctx context.Context, request *ReaddQuickReplyShortcutMessagesRequest) (*QuickReplyMessages, error) { - var result QuickReplyMessages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_recognize_speech_gen.go b/tdapi/tl_recognize_speech_gen.go deleted file mode 100644 index e1ca4ea0e..000000000 --- a/tdapi/tl_recognize_speech_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RecognizeSpeechRequest represents TL type `recognizeSpeech#67d402b9`. -type RecognizeSpeechRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message. Use messageProperties.can_recognize_speech to check whether - // the message is suitable - MessageID int64 -} - -// RecognizeSpeechRequestTypeID is TL type id of RecognizeSpeechRequest. -const RecognizeSpeechRequestTypeID = 0x67d402b9 - -// Ensuring interfaces in compile-time for RecognizeSpeechRequest. -var ( - _ bin.Encoder = &RecognizeSpeechRequest{} - _ bin.Decoder = &RecognizeSpeechRequest{} - _ bin.BareEncoder = &RecognizeSpeechRequest{} - _ bin.BareDecoder = &RecognizeSpeechRequest{} -) - -func (r *RecognizeSpeechRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RecognizeSpeechRequest) String() string { - if r == nil { - return "RecognizeSpeechRequest(nil)" - } - type Alias RecognizeSpeechRequest - return fmt.Sprintf("RecognizeSpeechRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RecognizeSpeechRequest) TypeID() uint32 { - return RecognizeSpeechRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RecognizeSpeechRequest) TypeName() string { - return "recognizeSpeech" -} - -// TypeInfo returns info about TL type. -func (r *RecognizeSpeechRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "recognizeSpeech", - ID: RecognizeSpeechRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RecognizeSpeechRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recognizeSpeech#67d402b9 as nil") - } - b.PutID(RecognizeSpeechRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RecognizeSpeechRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recognizeSpeech#67d402b9 as nil") - } - b.PutInt53(r.ChatID) - b.PutInt53(r.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RecognizeSpeechRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recognizeSpeech#67d402b9 to nil") - } - if err := b.ConsumeID(RecognizeSpeechRequestTypeID); err != nil { - return fmt.Errorf("unable to decode recognizeSpeech#67d402b9: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RecognizeSpeechRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recognizeSpeech#67d402b9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode recognizeSpeech#67d402b9: field chat_id: %w", err) - } - r.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode recognizeSpeech#67d402b9: field message_id: %w", err) - } - r.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RecognizeSpeechRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode recognizeSpeech#67d402b9 as nil") - } - b.ObjStart() - b.PutID("recognizeSpeech") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(r.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RecognizeSpeechRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode recognizeSpeech#67d402b9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("recognizeSpeech"); err != nil { - return fmt.Errorf("unable to decode recognizeSpeech#67d402b9: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode recognizeSpeech#67d402b9: field chat_id: %w", err) - } - r.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode recognizeSpeech#67d402b9: field message_id: %w", err) - } - r.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *RecognizeSpeechRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetMessageID returns value of MessageID field. -func (r *RecognizeSpeechRequest) GetMessageID() (value int64) { - if r == nil { - return - } - return r.MessageID -} - -// RecognizeSpeech invokes method recognizeSpeech#67d402b9 returning error if any. -func (c *Client) RecognizeSpeech(ctx context.Context, request *RecognizeSpeechRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_recommended_chat_folder_gen.go b/tdapi/tl_recommended_chat_folder_gen.go deleted file mode 100644 index 7932bd9fc..000000000 --- a/tdapi/tl_recommended_chat_folder_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RecommendedChatFolder represents TL type `recommendedChatFolder#81d7b4b6`. -type RecommendedChatFolder struct { - // The chat folder - Folder ChatFolder - // Describes a recommended chat folder - Description string -} - -// RecommendedChatFolderTypeID is TL type id of RecommendedChatFolder. -const RecommendedChatFolderTypeID = 0x81d7b4b6 - -// Ensuring interfaces in compile-time for RecommendedChatFolder. -var ( - _ bin.Encoder = &RecommendedChatFolder{} - _ bin.Decoder = &RecommendedChatFolder{} - _ bin.BareEncoder = &RecommendedChatFolder{} - _ bin.BareDecoder = &RecommendedChatFolder{} -) - -func (r *RecommendedChatFolder) Zero() bool { - if r == nil { - return true - } - if !(r.Folder.Zero()) { - return false - } - if !(r.Description == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RecommendedChatFolder) String() string { - if r == nil { - return "RecommendedChatFolder(nil)" - } - type Alias RecommendedChatFolder - return fmt.Sprintf("RecommendedChatFolder%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RecommendedChatFolder) TypeID() uint32 { - return RecommendedChatFolderTypeID -} - -// TypeName returns name of type in TL schema. -func (*RecommendedChatFolder) TypeName() string { - return "recommendedChatFolder" -} - -// TypeInfo returns info about TL type. -func (r *RecommendedChatFolder) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "recommendedChatFolder", - ID: RecommendedChatFolderTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Folder", - SchemaName: "folder", - }, - { - Name: "Description", - SchemaName: "description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RecommendedChatFolder) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recommendedChatFolder#81d7b4b6 as nil") - } - b.PutID(RecommendedChatFolderTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RecommendedChatFolder) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recommendedChatFolder#81d7b4b6 as nil") - } - if err := r.Folder.Encode(b); err != nil { - return fmt.Errorf("unable to encode recommendedChatFolder#81d7b4b6: field folder: %w", err) - } - b.PutString(r.Description) - return nil -} - -// Decode implements bin.Decoder. -func (r *RecommendedChatFolder) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recommendedChatFolder#81d7b4b6 to nil") - } - if err := b.ConsumeID(RecommendedChatFolderTypeID); err != nil { - return fmt.Errorf("unable to decode recommendedChatFolder#81d7b4b6: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RecommendedChatFolder) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recommendedChatFolder#81d7b4b6 to nil") - } - { - if err := r.Folder.Decode(b); err != nil { - return fmt.Errorf("unable to decode recommendedChatFolder#81d7b4b6: field folder: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recommendedChatFolder#81d7b4b6: field description: %w", err) - } - r.Description = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RecommendedChatFolder) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode recommendedChatFolder#81d7b4b6 as nil") - } - b.ObjStart() - b.PutID("recommendedChatFolder") - b.Comma() - b.FieldStart("folder") - if err := r.Folder.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode recommendedChatFolder#81d7b4b6: field folder: %w", err) - } - b.Comma() - b.FieldStart("description") - b.PutString(r.Description) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RecommendedChatFolder) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode recommendedChatFolder#81d7b4b6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("recommendedChatFolder"); err != nil { - return fmt.Errorf("unable to decode recommendedChatFolder#81d7b4b6: %w", err) - } - case "folder": - if err := r.Folder.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode recommendedChatFolder#81d7b4b6: field folder: %w", err) - } - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recommendedChatFolder#81d7b4b6: field description: %w", err) - } - r.Description = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFolder returns value of Folder field. -func (r *RecommendedChatFolder) GetFolder() (value ChatFolder) { - if r == nil { - return - } - return r.Folder -} - -// GetDescription returns value of Description field. -func (r *RecommendedChatFolder) GetDescription() (value string) { - if r == nil { - return - } - return r.Description -} diff --git a/tdapi/tl_recommended_chat_folders_gen.go b/tdapi/tl_recommended_chat_folders_gen.go deleted file mode 100644 index cae9d1242..000000000 --- a/tdapi/tl_recommended_chat_folders_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RecommendedChatFolders represents TL type `recommendedChatFolders#32208553`. -type RecommendedChatFolders struct { - // List of recommended chat folders - ChatFolders []RecommendedChatFolder -} - -// RecommendedChatFoldersTypeID is TL type id of RecommendedChatFolders. -const RecommendedChatFoldersTypeID = 0x32208553 - -// Ensuring interfaces in compile-time for RecommendedChatFolders. -var ( - _ bin.Encoder = &RecommendedChatFolders{} - _ bin.Decoder = &RecommendedChatFolders{} - _ bin.BareEncoder = &RecommendedChatFolders{} - _ bin.BareDecoder = &RecommendedChatFolders{} -) - -func (r *RecommendedChatFolders) Zero() bool { - if r == nil { - return true - } - if !(r.ChatFolders == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RecommendedChatFolders) String() string { - if r == nil { - return "RecommendedChatFolders(nil)" - } - type Alias RecommendedChatFolders - return fmt.Sprintf("RecommendedChatFolders%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RecommendedChatFolders) TypeID() uint32 { - return RecommendedChatFoldersTypeID -} - -// TypeName returns name of type in TL schema. -func (*RecommendedChatFolders) TypeName() string { - return "recommendedChatFolders" -} - -// TypeInfo returns info about TL type. -func (r *RecommendedChatFolders) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "recommendedChatFolders", - ID: RecommendedChatFoldersTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolders", - SchemaName: "chat_folders", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RecommendedChatFolders) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recommendedChatFolders#32208553 as nil") - } - b.PutID(RecommendedChatFoldersTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RecommendedChatFolders) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recommendedChatFolders#32208553 as nil") - } - b.PutInt(len(r.ChatFolders)) - for idx, v := range r.ChatFolders { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare recommendedChatFolders#32208553: field chat_folders element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RecommendedChatFolders) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recommendedChatFolders#32208553 to nil") - } - if err := b.ConsumeID(RecommendedChatFoldersTypeID); err != nil { - return fmt.Errorf("unable to decode recommendedChatFolders#32208553: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RecommendedChatFolders) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recommendedChatFolders#32208553 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode recommendedChatFolders#32208553: field chat_folders: %w", err) - } - - if headerLen > 0 { - r.ChatFolders = make([]RecommendedChatFolder, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value RecommendedChatFolder - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare recommendedChatFolders#32208553: field chat_folders: %w", err) - } - r.ChatFolders = append(r.ChatFolders, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RecommendedChatFolders) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode recommendedChatFolders#32208553 as nil") - } - b.ObjStart() - b.PutID("recommendedChatFolders") - b.Comma() - b.FieldStart("chat_folders") - b.ArrStart() - for idx, v := range r.ChatFolders { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode recommendedChatFolders#32208553: field chat_folders element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RecommendedChatFolders) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode recommendedChatFolders#32208553 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("recommendedChatFolders"); err != nil { - return fmt.Errorf("unable to decode recommendedChatFolders#32208553: %w", err) - } - case "chat_folders": - if err := b.Arr(func(b tdjson.Decoder) error { - var value RecommendedChatFolder - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode recommendedChatFolders#32208553: field chat_folders: %w", err) - } - r.ChatFolders = append(r.ChatFolders, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode recommendedChatFolders#32208553: field chat_folders: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolders returns value of ChatFolders field. -func (r *RecommendedChatFolders) GetChatFolders() (value []RecommendedChatFolder) { - if r == nil { - return - } - return r.ChatFolders -} diff --git a/tdapi/tl_recover_authentication_password_gen.go b/tdapi/tl_recover_authentication_password_gen.go deleted file mode 100644 index acc3b60b9..000000000 --- a/tdapi/tl_recover_authentication_password_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RecoverAuthenticationPasswordRequest represents TL type `recoverAuthenticationPassword#f8311523`. -type RecoverAuthenticationPasswordRequest struct { - // Recovery code to check - RecoveryCode string - // New 2-step verification password of the user; may be empty to remove the password - NewPassword string - // New password hint; may be empty - NewHint string -} - -// RecoverAuthenticationPasswordRequestTypeID is TL type id of RecoverAuthenticationPasswordRequest. -const RecoverAuthenticationPasswordRequestTypeID = 0xf8311523 - -// Ensuring interfaces in compile-time for RecoverAuthenticationPasswordRequest. -var ( - _ bin.Encoder = &RecoverAuthenticationPasswordRequest{} - _ bin.Decoder = &RecoverAuthenticationPasswordRequest{} - _ bin.BareEncoder = &RecoverAuthenticationPasswordRequest{} - _ bin.BareDecoder = &RecoverAuthenticationPasswordRequest{} -) - -func (r *RecoverAuthenticationPasswordRequest) Zero() bool { - if r == nil { - return true - } - if !(r.RecoveryCode == "") { - return false - } - if !(r.NewPassword == "") { - return false - } - if !(r.NewHint == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RecoverAuthenticationPasswordRequest) String() string { - if r == nil { - return "RecoverAuthenticationPasswordRequest(nil)" - } - type Alias RecoverAuthenticationPasswordRequest - return fmt.Sprintf("RecoverAuthenticationPasswordRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RecoverAuthenticationPasswordRequest) TypeID() uint32 { - return RecoverAuthenticationPasswordRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RecoverAuthenticationPasswordRequest) TypeName() string { - return "recoverAuthenticationPassword" -} - -// TypeInfo returns info about TL type. -func (r *RecoverAuthenticationPasswordRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "recoverAuthenticationPassword", - ID: RecoverAuthenticationPasswordRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RecoveryCode", - SchemaName: "recovery_code", - }, - { - Name: "NewPassword", - SchemaName: "new_password", - }, - { - Name: "NewHint", - SchemaName: "new_hint", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RecoverAuthenticationPasswordRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recoverAuthenticationPassword#f8311523 as nil") - } - b.PutID(RecoverAuthenticationPasswordRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RecoverAuthenticationPasswordRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recoverAuthenticationPassword#f8311523 as nil") - } - b.PutString(r.RecoveryCode) - b.PutString(r.NewPassword) - b.PutString(r.NewHint) - return nil -} - -// Decode implements bin.Decoder. -func (r *RecoverAuthenticationPasswordRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recoverAuthenticationPassword#f8311523 to nil") - } - if err := b.ConsumeID(RecoverAuthenticationPasswordRequestTypeID); err != nil { - return fmt.Errorf("unable to decode recoverAuthenticationPassword#f8311523: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RecoverAuthenticationPasswordRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recoverAuthenticationPassword#f8311523 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverAuthenticationPassword#f8311523: field recovery_code: %w", err) - } - r.RecoveryCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverAuthenticationPassword#f8311523: field new_password: %w", err) - } - r.NewPassword = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverAuthenticationPassword#f8311523: field new_hint: %w", err) - } - r.NewHint = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RecoverAuthenticationPasswordRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode recoverAuthenticationPassword#f8311523 as nil") - } - b.ObjStart() - b.PutID("recoverAuthenticationPassword") - b.Comma() - b.FieldStart("recovery_code") - b.PutString(r.RecoveryCode) - b.Comma() - b.FieldStart("new_password") - b.PutString(r.NewPassword) - b.Comma() - b.FieldStart("new_hint") - b.PutString(r.NewHint) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RecoverAuthenticationPasswordRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode recoverAuthenticationPassword#f8311523 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("recoverAuthenticationPassword"); err != nil { - return fmt.Errorf("unable to decode recoverAuthenticationPassword#f8311523: %w", err) - } - case "recovery_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverAuthenticationPassword#f8311523: field recovery_code: %w", err) - } - r.RecoveryCode = value - case "new_password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverAuthenticationPassword#f8311523: field new_password: %w", err) - } - r.NewPassword = value - case "new_hint": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverAuthenticationPassword#f8311523: field new_hint: %w", err) - } - r.NewHint = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRecoveryCode returns value of RecoveryCode field. -func (r *RecoverAuthenticationPasswordRequest) GetRecoveryCode() (value string) { - if r == nil { - return - } - return r.RecoveryCode -} - -// GetNewPassword returns value of NewPassword field. -func (r *RecoverAuthenticationPasswordRequest) GetNewPassword() (value string) { - if r == nil { - return - } - return r.NewPassword -} - -// GetNewHint returns value of NewHint field. -func (r *RecoverAuthenticationPasswordRequest) GetNewHint() (value string) { - if r == nil { - return - } - return r.NewHint -} - -// RecoverAuthenticationPassword invokes method recoverAuthenticationPassword#f8311523 returning error if any. -func (c *Client) RecoverAuthenticationPassword(ctx context.Context, request *RecoverAuthenticationPasswordRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_recover_password_gen.go b/tdapi/tl_recover_password_gen.go deleted file mode 100644 index 76fa729e2..000000000 --- a/tdapi/tl_recover_password_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RecoverPasswordRequest represents TL type `recoverPassword#a5259973`. -type RecoverPasswordRequest struct { - // Recovery code to check - RecoveryCode string - // New 2-step verification password of the user; may be empty to remove the password - NewPassword string - // New password hint; may be empty - NewHint string -} - -// RecoverPasswordRequestTypeID is TL type id of RecoverPasswordRequest. -const RecoverPasswordRequestTypeID = 0xa5259973 - -// Ensuring interfaces in compile-time for RecoverPasswordRequest. -var ( - _ bin.Encoder = &RecoverPasswordRequest{} - _ bin.Decoder = &RecoverPasswordRequest{} - _ bin.BareEncoder = &RecoverPasswordRequest{} - _ bin.BareDecoder = &RecoverPasswordRequest{} -) - -func (r *RecoverPasswordRequest) Zero() bool { - if r == nil { - return true - } - if !(r.RecoveryCode == "") { - return false - } - if !(r.NewPassword == "") { - return false - } - if !(r.NewHint == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RecoverPasswordRequest) String() string { - if r == nil { - return "RecoverPasswordRequest(nil)" - } - type Alias RecoverPasswordRequest - return fmt.Sprintf("RecoverPasswordRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RecoverPasswordRequest) TypeID() uint32 { - return RecoverPasswordRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RecoverPasswordRequest) TypeName() string { - return "recoverPassword" -} - -// TypeInfo returns info about TL type. -func (r *RecoverPasswordRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "recoverPassword", - ID: RecoverPasswordRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RecoveryCode", - SchemaName: "recovery_code", - }, - { - Name: "NewPassword", - SchemaName: "new_password", - }, - { - Name: "NewHint", - SchemaName: "new_hint", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RecoverPasswordRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recoverPassword#a5259973 as nil") - } - b.PutID(RecoverPasswordRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RecoverPasswordRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recoverPassword#a5259973 as nil") - } - b.PutString(r.RecoveryCode) - b.PutString(r.NewPassword) - b.PutString(r.NewHint) - return nil -} - -// Decode implements bin.Decoder. -func (r *RecoverPasswordRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recoverPassword#a5259973 to nil") - } - if err := b.ConsumeID(RecoverPasswordRequestTypeID); err != nil { - return fmt.Errorf("unable to decode recoverPassword#a5259973: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RecoverPasswordRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recoverPassword#a5259973 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverPassword#a5259973: field recovery_code: %w", err) - } - r.RecoveryCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverPassword#a5259973: field new_password: %w", err) - } - r.NewPassword = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverPassword#a5259973: field new_hint: %w", err) - } - r.NewHint = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RecoverPasswordRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode recoverPassword#a5259973 as nil") - } - b.ObjStart() - b.PutID("recoverPassword") - b.Comma() - b.FieldStart("recovery_code") - b.PutString(r.RecoveryCode) - b.Comma() - b.FieldStart("new_password") - b.PutString(r.NewPassword) - b.Comma() - b.FieldStart("new_hint") - b.PutString(r.NewHint) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RecoverPasswordRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode recoverPassword#a5259973 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("recoverPassword"); err != nil { - return fmt.Errorf("unable to decode recoverPassword#a5259973: %w", err) - } - case "recovery_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverPassword#a5259973: field recovery_code: %w", err) - } - r.RecoveryCode = value - case "new_password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverPassword#a5259973: field new_password: %w", err) - } - r.NewPassword = value - case "new_hint": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoverPassword#a5259973: field new_hint: %w", err) - } - r.NewHint = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRecoveryCode returns value of RecoveryCode field. -func (r *RecoverPasswordRequest) GetRecoveryCode() (value string) { - if r == nil { - return - } - return r.RecoveryCode -} - -// GetNewPassword returns value of NewPassword field. -func (r *RecoverPasswordRequest) GetNewPassword() (value string) { - if r == nil { - return - } - return r.NewPassword -} - -// GetNewHint returns value of NewHint field. -func (r *RecoverPasswordRequest) GetNewHint() (value string) { - if r == nil { - return - } - return r.NewHint -} - -// RecoverPassword invokes method recoverPassword#a5259973 returning error if any. -func (c *Client) RecoverPassword(ctx context.Context, request *RecoverPasswordRequest) (*PasswordState, error) { - var result PasswordState - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_recovery_email_address_gen.go b/tdapi/tl_recovery_email_address_gen.go deleted file mode 100644 index 6fb52dbdb..000000000 --- a/tdapi/tl_recovery_email_address_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RecoveryEmailAddress represents TL type `recoveryEmailAddress#4cebddeb`. -type RecoveryEmailAddress struct { - // Recovery email address - RecoveryEmailAddress string -} - -// RecoveryEmailAddressTypeID is TL type id of RecoveryEmailAddress. -const RecoveryEmailAddressTypeID = 0x4cebddeb - -// Ensuring interfaces in compile-time for RecoveryEmailAddress. -var ( - _ bin.Encoder = &RecoveryEmailAddress{} - _ bin.Decoder = &RecoveryEmailAddress{} - _ bin.BareEncoder = &RecoveryEmailAddress{} - _ bin.BareDecoder = &RecoveryEmailAddress{} -) - -func (r *RecoveryEmailAddress) Zero() bool { - if r == nil { - return true - } - if !(r.RecoveryEmailAddress == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RecoveryEmailAddress) String() string { - if r == nil { - return "RecoveryEmailAddress(nil)" - } - type Alias RecoveryEmailAddress - return fmt.Sprintf("RecoveryEmailAddress%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RecoveryEmailAddress) TypeID() uint32 { - return RecoveryEmailAddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*RecoveryEmailAddress) TypeName() string { - return "recoveryEmailAddress" -} - -// TypeInfo returns info about TL type. -func (r *RecoveryEmailAddress) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "recoveryEmailAddress", - ID: RecoveryEmailAddressTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RecoveryEmailAddress", - SchemaName: "recovery_email_address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RecoveryEmailAddress) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recoveryEmailAddress#4cebddeb as nil") - } - b.PutID(RecoveryEmailAddressTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RecoveryEmailAddress) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode recoveryEmailAddress#4cebddeb as nil") - } - b.PutString(r.RecoveryEmailAddress) - return nil -} - -// Decode implements bin.Decoder. -func (r *RecoveryEmailAddress) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recoveryEmailAddress#4cebddeb to nil") - } - if err := b.ConsumeID(RecoveryEmailAddressTypeID); err != nil { - return fmt.Errorf("unable to decode recoveryEmailAddress#4cebddeb: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RecoveryEmailAddress) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode recoveryEmailAddress#4cebddeb to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoveryEmailAddress#4cebddeb: field recovery_email_address: %w", err) - } - r.RecoveryEmailAddress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RecoveryEmailAddress) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode recoveryEmailAddress#4cebddeb as nil") - } - b.ObjStart() - b.PutID("recoveryEmailAddress") - b.Comma() - b.FieldStart("recovery_email_address") - b.PutString(r.RecoveryEmailAddress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RecoveryEmailAddress) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode recoveryEmailAddress#4cebddeb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("recoveryEmailAddress"); err != nil { - return fmt.Errorf("unable to decode recoveryEmailAddress#4cebddeb: %w", err) - } - case "recovery_email_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode recoveryEmailAddress#4cebddeb: field recovery_email_address: %w", err) - } - r.RecoveryEmailAddress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRecoveryEmailAddress returns value of RecoveryEmailAddress field. -func (r *RecoveryEmailAddress) GetRecoveryEmailAddress() (value string) { - if r == nil { - return - } - return r.RecoveryEmailAddress -} diff --git a/tdapi/tl_refund_star_payment_gen.go b/tdapi/tl_refund_star_payment_gen.go deleted file mode 100644 index 84ccec5d2..000000000 --- a/tdapi/tl_refund_star_payment_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RefundStarPaymentRequest represents TL type `refundStarPayment#9476a055`. -type RefundStarPaymentRequest struct { - // Identifier of the user that did the payment - UserID int64 - // Telegram payment identifier - TelegramPaymentChargeID string -} - -// RefundStarPaymentRequestTypeID is TL type id of RefundStarPaymentRequest. -const RefundStarPaymentRequestTypeID = 0x9476a055 - -// Ensuring interfaces in compile-time for RefundStarPaymentRequest. -var ( - _ bin.Encoder = &RefundStarPaymentRequest{} - _ bin.Decoder = &RefundStarPaymentRequest{} - _ bin.BareEncoder = &RefundStarPaymentRequest{} - _ bin.BareDecoder = &RefundStarPaymentRequest{} -) - -func (r *RefundStarPaymentRequest) Zero() bool { - if r == nil { - return true - } - if !(r.UserID == 0) { - return false - } - if !(r.TelegramPaymentChargeID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RefundStarPaymentRequest) String() string { - if r == nil { - return "RefundStarPaymentRequest(nil)" - } - type Alias RefundStarPaymentRequest - return fmt.Sprintf("RefundStarPaymentRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RefundStarPaymentRequest) TypeID() uint32 { - return RefundStarPaymentRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RefundStarPaymentRequest) TypeName() string { - return "refundStarPayment" -} - -// TypeInfo returns info about TL type. -func (r *RefundStarPaymentRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "refundStarPayment", - ID: RefundStarPaymentRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "TelegramPaymentChargeID", - SchemaName: "telegram_payment_charge_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RefundStarPaymentRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode refundStarPayment#9476a055 as nil") - } - b.PutID(RefundStarPaymentRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RefundStarPaymentRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode refundStarPayment#9476a055 as nil") - } - b.PutInt53(r.UserID) - b.PutString(r.TelegramPaymentChargeID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RefundStarPaymentRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode refundStarPayment#9476a055 to nil") - } - if err := b.ConsumeID(RefundStarPaymentRequestTypeID); err != nil { - return fmt.Errorf("unable to decode refundStarPayment#9476a055: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RefundStarPaymentRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode refundStarPayment#9476a055 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode refundStarPayment#9476a055: field user_id: %w", err) - } - r.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode refundStarPayment#9476a055: field telegram_payment_charge_id: %w", err) - } - r.TelegramPaymentChargeID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RefundStarPaymentRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode refundStarPayment#9476a055 as nil") - } - b.ObjStart() - b.PutID("refundStarPayment") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(r.UserID) - b.Comma() - b.FieldStart("telegram_payment_charge_id") - b.PutString(r.TelegramPaymentChargeID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RefundStarPaymentRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode refundStarPayment#9476a055 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("refundStarPayment"); err != nil { - return fmt.Errorf("unable to decode refundStarPayment#9476a055: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode refundStarPayment#9476a055: field user_id: %w", err) - } - r.UserID = value - case "telegram_payment_charge_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode refundStarPayment#9476a055: field telegram_payment_charge_id: %w", err) - } - r.TelegramPaymentChargeID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (r *RefundStarPaymentRequest) GetUserID() (value int64) { - if r == nil { - return - } - return r.UserID -} - -// GetTelegramPaymentChargeID returns value of TelegramPaymentChargeID field. -func (r *RefundStarPaymentRequest) GetTelegramPaymentChargeID() (value string) { - if r == nil { - return - } - return r.TelegramPaymentChargeID -} - -// RefundStarPayment invokes method refundStarPayment#9476a055 returning error if any. -func (c *Client) RefundStarPayment(ctx context.Context, request *RefundStarPaymentRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_register_device_gen.go b/tdapi/tl_register_device_gen.go deleted file mode 100644 index 70b23a658..000000000 --- a/tdapi/tl_register_device_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RegisterDeviceRequest represents TL type `registerDevice#ff140196`. -type RegisterDeviceRequest struct { - // Device token - DeviceToken DeviceTokenClass - // List of user identifiers of other users currently using the application - OtherUserIDs []int64 -} - -// RegisterDeviceRequestTypeID is TL type id of RegisterDeviceRequest. -const RegisterDeviceRequestTypeID = 0xff140196 - -// Ensuring interfaces in compile-time for RegisterDeviceRequest. -var ( - _ bin.Encoder = &RegisterDeviceRequest{} - _ bin.Decoder = &RegisterDeviceRequest{} - _ bin.BareEncoder = &RegisterDeviceRequest{} - _ bin.BareDecoder = &RegisterDeviceRequest{} -) - -func (r *RegisterDeviceRequest) Zero() bool { - if r == nil { - return true - } - if !(r.DeviceToken == nil) { - return false - } - if !(r.OtherUserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RegisterDeviceRequest) String() string { - if r == nil { - return "RegisterDeviceRequest(nil)" - } - type Alias RegisterDeviceRequest - return fmt.Sprintf("RegisterDeviceRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RegisterDeviceRequest) TypeID() uint32 { - return RegisterDeviceRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RegisterDeviceRequest) TypeName() string { - return "registerDevice" -} - -// TypeInfo returns info about TL type. -func (r *RegisterDeviceRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "registerDevice", - ID: RegisterDeviceRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DeviceToken", - SchemaName: "device_token", - }, - { - Name: "OtherUserIDs", - SchemaName: "other_user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RegisterDeviceRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode registerDevice#ff140196 as nil") - } - b.PutID(RegisterDeviceRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RegisterDeviceRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode registerDevice#ff140196 as nil") - } - if r.DeviceToken == nil { - return fmt.Errorf("unable to encode registerDevice#ff140196: field device_token is nil") - } - if err := r.DeviceToken.Encode(b); err != nil { - return fmt.Errorf("unable to encode registerDevice#ff140196: field device_token: %w", err) - } - b.PutInt(len(r.OtherUserIDs)) - for _, v := range r.OtherUserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RegisterDeviceRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode registerDevice#ff140196 to nil") - } - if err := b.ConsumeID(RegisterDeviceRequestTypeID); err != nil { - return fmt.Errorf("unable to decode registerDevice#ff140196: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RegisterDeviceRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode registerDevice#ff140196 to nil") - } - { - value, err := DecodeDeviceToken(b) - if err != nil { - return fmt.Errorf("unable to decode registerDevice#ff140196: field device_token: %w", err) - } - r.DeviceToken = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode registerDevice#ff140196: field other_user_ids: %w", err) - } - - if headerLen > 0 { - r.OtherUserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode registerDevice#ff140196: field other_user_ids: %w", err) - } - r.OtherUserIDs = append(r.OtherUserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RegisterDeviceRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode registerDevice#ff140196 as nil") - } - b.ObjStart() - b.PutID("registerDevice") - b.Comma() - b.FieldStart("device_token") - if r.DeviceToken == nil { - return fmt.Errorf("unable to encode registerDevice#ff140196: field device_token is nil") - } - if err := r.DeviceToken.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode registerDevice#ff140196: field device_token: %w", err) - } - b.Comma() - b.FieldStart("other_user_ids") - b.ArrStart() - for _, v := range r.OtherUserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RegisterDeviceRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode registerDevice#ff140196 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("registerDevice"); err != nil { - return fmt.Errorf("unable to decode registerDevice#ff140196: %w", err) - } - case "device_token": - value, err := DecodeTDLibJSONDeviceToken(b) - if err != nil { - return fmt.Errorf("unable to decode registerDevice#ff140196: field device_token: %w", err) - } - r.DeviceToken = value - case "other_user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode registerDevice#ff140196: field other_user_ids: %w", err) - } - r.OtherUserIDs = append(r.OtherUserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode registerDevice#ff140196: field other_user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDeviceToken returns value of DeviceToken field. -func (r *RegisterDeviceRequest) GetDeviceToken() (value DeviceTokenClass) { - if r == nil { - return - } - return r.DeviceToken -} - -// GetOtherUserIDs returns value of OtherUserIDs field. -func (r *RegisterDeviceRequest) GetOtherUserIDs() (value []int64) { - if r == nil { - return - } - return r.OtherUserIDs -} - -// RegisterDevice invokes method registerDevice#ff140196 returning error if any. -func (c *Client) RegisterDevice(ctx context.Context, request *RegisterDeviceRequest) (*PushReceiverID, error) { - var result PushReceiverID - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_register_user_gen.go b/tdapi/tl_register_user_gen.go deleted file mode 100644 index 98200b95e..000000000 --- a/tdapi/tl_register_user_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RegisterUserRequest represents TL type `registerUser#c3aa52ec`. -type RegisterUserRequest struct { - // The first name of the user; 1-64 characters - FirstName string - // The last name of the user; 0-64 characters - LastName string - // Pass true to disable notification about the current user joining Telegram for other - // users that added them to contact list - DisableNotification bool -} - -// RegisterUserRequestTypeID is TL type id of RegisterUserRequest. -const RegisterUserRequestTypeID = 0xc3aa52ec - -// Ensuring interfaces in compile-time for RegisterUserRequest. -var ( - _ bin.Encoder = &RegisterUserRequest{} - _ bin.Decoder = &RegisterUserRequest{} - _ bin.BareEncoder = &RegisterUserRequest{} - _ bin.BareDecoder = &RegisterUserRequest{} -) - -func (r *RegisterUserRequest) Zero() bool { - if r == nil { - return true - } - if !(r.FirstName == "") { - return false - } - if !(r.LastName == "") { - return false - } - if !(r.DisableNotification == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RegisterUserRequest) String() string { - if r == nil { - return "RegisterUserRequest(nil)" - } - type Alias RegisterUserRequest - return fmt.Sprintf("RegisterUserRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RegisterUserRequest) TypeID() uint32 { - return RegisterUserRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RegisterUserRequest) TypeName() string { - return "registerUser" -} - -// TypeInfo returns info about TL type. -func (r *RegisterUserRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "registerUser", - ID: RegisterUserRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FirstName", - SchemaName: "first_name", - }, - { - Name: "LastName", - SchemaName: "last_name", - }, - { - Name: "DisableNotification", - SchemaName: "disable_notification", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RegisterUserRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode registerUser#c3aa52ec as nil") - } - b.PutID(RegisterUserRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RegisterUserRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode registerUser#c3aa52ec as nil") - } - b.PutString(r.FirstName) - b.PutString(r.LastName) - b.PutBool(r.DisableNotification) - return nil -} - -// Decode implements bin.Decoder. -func (r *RegisterUserRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode registerUser#c3aa52ec to nil") - } - if err := b.ConsumeID(RegisterUserRequestTypeID); err != nil { - return fmt.Errorf("unable to decode registerUser#c3aa52ec: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RegisterUserRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode registerUser#c3aa52ec to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode registerUser#c3aa52ec: field first_name: %w", err) - } - r.FirstName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode registerUser#c3aa52ec: field last_name: %w", err) - } - r.LastName = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode registerUser#c3aa52ec: field disable_notification: %w", err) - } - r.DisableNotification = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RegisterUserRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode registerUser#c3aa52ec as nil") - } - b.ObjStart() - b.PutID("registerUser") - b.Comma() - b.FieldStart("first_name") - b.PutString(r.FirstName) - b.Comma() - b.FieldStart("last_name") - b.PutString(r.LastName) - b.Comma() - b.FieldStart("disable_notification") - b.PutBool(r.DisableNotification) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RegisterUserRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode registerUser#c3aa52ec to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("registerUser"); err != nil { - return fmt.Errorf("unable to decode registerUser#c3aa52ec: %w", err) - } - case "first_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode registerUser#c3aa52ec: field first_name: %w", err) - } - r.FirstName = value - case "last_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode registerUser#c3aa52ec: field last_name: %w", err) - } - r.LastName = value - case "disable_notification": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode registerUser#c3aa52ec: field disable_notification: %w", err) - } - r.DisableNotification = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFirstName returns value of FirstName field. -func (r *RegisterUserRequest) GetFirstName() (value string) { - if r == nil { - return - } - return r.FirstName -} - -// GetLastName returns value of LastName field. -func (r *RegisterUserRequest) GetLastName() (value string) { - if r == nil { - return - } - return r.LastName -} - -// GetDisableNotification returns value of DisableNotification field. -func (r *RegisterUserRequest) GetDisableNotification() (value bool) { - if r == nil { - return - } - return r.DisableNotification -} - -// RegisterUser invokes method registerUser#c3aa52ec returning error if any. -func (c *Client) RegisterUser(ctx context.Context, request *RegisterUserRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_registry_gen.go b/tdapi/tl_registry_gen.go deleted file mode 100644 index 7fd894fc0..000000000 --- a/tdapi/tl_registry_gen.go +++ /dev/null @@ -1,9193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TypesMap returns mapping from type ids to TL type names. -func TypesMap() map[uint32]string { - return map[uint32]string{ - DoubleTypeID: "double#2210c154", - StringTypeID: "string#b5286e24", - Int32TypeID: "int32#5cb934fa", - Int53TypeID: "int53#6781c7ee", - Int64TypeID: "int64#5d9ed744", - BytesTypeID: "bytes#e937bb82", - BoolFalseTypeID: "boolFalse#bc799737", - BoolTrueTypeID: "boolTrue#997275b5", - ErrorTypeID: "error#9bdd8f1a", - OkTypeID: "ok#d4edbe69", - AuthenticationCodeTypeTelegramMessageTypeID: "authenticationCodeTypeTelegramMessage#7bf49b2a", - AuthenticationCodeTypeSMSTypeID: "authenticationCodeTypeSms#3960e288", - AuthenticationCodeTypeSMSWordTypeID: "authenticationCodeTypeSmsWord#a6063c63", - AuthenticationCodeTypeSMSPhraseTypeID: "authenticationCodeTypeSmsPhrase#2ebc8cd1", - AuthenticationCodeTypeCallTypeID: "authenticationCodeTypeCall#61876c67", - AuthenticationCodeTypeFlashCallTypeID: "authenticationCodeTypeFlashCall#533379a2", - AuthenticationCodeTypeMissedCallTypeID: "authenticationCodeTypeMissedCall#29bb0a87", - AuthenticationCodeTypeFragmentTypeID: "authenticationCodeTypeFragment#810f74cd", - AuthenticationCodeTypeFirebaseAndroidTypeID: "authenticationCodeTypeFirebaseAndroid#6f9bb51e", - AuthenticationCodeTypeFirebaseIosTypeID: "authenticationCodeTypeFirebaseIos#ff55aa93", - AuthenticationCodeInfoTypeID: "authenticationCodeInfo#ccb82bb8", - EmailAddressAuthenticationCodeInfoTypeID: "emailAddressAuthenticationCodeInfo#449be223", - EmailAddressAuthenticationCodeTypeID: "emailAddressAuthenticationCode#c4cc19c2", - EmailAddressAuthenticationAppleIDTypeID: "emailAddressAuthenticationAppleId#25c94869", - EmailAddressAuthenticationGoogleIDTypeID: "emailAddressAuthenticationGoogleId#fedbe742", - EmailAddressResetStateAvailableTypeID: "emailAddressResetStateAvailable#8dba3100", - EmailAddressResetStatePendingTypeID: "emailAddressResetStatePending#8f966e2b", - TextEntityTypeID: "textEntity#8bab99a8", - TextEntitiesTypeID: "textEntities#cf89c258", - FormattedTextTypeID: "formattedText#a38d39ee", - TermsOfServiceTypeID: "termsOfService#2c12b185", - AuthorizationStateWaitTdlibParametersTypeID: "authorizationStateWaitTdlibParameters#35ecf25c", - AuthorizationStateWaitPhoneNumberTypeID: "authorizationStateWaitPhoneNumber#124354e3", - AuthorizationStateWaitEmailAddressTypeID: "authorizationStateWaitEmailAddress#3e0471c7", - AuthorizationStateWaitEmailCodeTypeID: "authorizationStateWaitEmailCode#909f025b", - AuthorizationStateWaitCodeTypeID: "authorizationStateWaitCode#3234501", - AuthorizationStateWaitOtherDeviceConfirmationTypeID: "authorizationStateWaitOtherDeviceConfirmation#334518ea", - AuthorizationStateWaitRegistrationTypeID: "authorizationStateWaitRegistration#20cdaeaf", - AuthorizationStateWaitPasswordTypeID: "authorizationStateWaitPassword#6b09dce", - AuthorizationStateReadyTypeID: "authorizationStateReady#92a21447", - AuthorizationStateLoggingOutTypeID: "authorizationStateLoggingOut#934b576", - AuthorizationStateClosingTypeID: "authorizationStateClosing#1a93364f", - AuthorizationStateClosedTypeID: "authorizationStateClosed#5af5a360", - FirebaseDeviceVerificationParametersSafetyNetTypeID: "firebaseDeviceVerificationParametersSafetyNet#2b96b2f1", - FirebaseDeviceVerificationParametersPlayIntegrityTypeID: "firebaseDeviceVerificationParametersPlayIntegrity#caf4a58a", - PasswordStateTypeID: "passwordState#1cd63828", - RecoveryEmailAddressTypeID: "recoveryEmailAddress#4cebddeb", - TemporaryPasswordStateTypeID: "temporaryPasswordState#3804c7e2", - LocalFileTypeID: "localFile#a2da9987", - RemoteFileTypeID: "remoteFile#2c917856", - FileTypeID: "file#4b4c4e34", - InputFileIDTypeID: "inputFileId#6aa08b0d", - InputFileRemoteTypeID: "inputFileRemote#f9968b3e", - InputFileLocalTypeID: "inputFileLocal#7a8c8ac7", - InputFileGeneratedTypeID: "inputFileGenerated#b0862800", - PhotoSizeTypeID: "photoSize#18e56d39", - MinithumbnailTypeID: "minithumbnail#ec6addaa", - ThumbnailFormatJpegTypeID: "thumbnailFormatJpeg#d90c5488", - ThumbnailFormatGifTypeID: "thumbnailFormatGif#4aa3258a", - ThumbnailFormatMpeg4TypeID: "thumbnailFormatMpeg4#109b57fe", - ThumbnailFormatPngTypeID: "thumbnailFormatPng#5e0697f5", - ThumbnailFormatTgsTypeID: "thumbnailFormatTgs#4e694852", - ThumbnailFormatWebmTypeID: "thumbnailFormatWebm#d8a7e727", - ThumbnailFormatWebpTypeID: "thumbnailFormatWebp#fcce4c12", - ThumbnailTypeID: "thumbnail#4a1ae06b", - MaskPointForeheadTypeID: "maskPointForehead#3d3e96c5", - MaskPointEyesTypeID: "maskPointEyes#68351b4d", - MaskPointMouthTypeID: "maskPointMouth#188b29de", - MaskPointChinTypeID: "maskPointChin#1fe36187", - MaskPositionTypeID: "maskPosition#82fbb63e", - StickerFormatWebpTypeID: "stickerFormatWebp#8174ef20", - StickerFormatTgsTypeID: "stickerFormatTgs#603caaf6", - StickerFormatWebmTypeID: "stickerFormatWebm#849bd54f", - StickerTypeRegularTypeID: "stickerTypeRegular#35bc575", - StickerTypeMaskTypeID: "stickerTypeMask#96c63694", - StickerTypeCustomEmojiTypeID: "stickerTypeCustomEmoji#f8cd7787", - StickerFullTypeRegularTypeID: "stickerFullTypeRegular#88685ef7", - StickerFullTypeMaskTypeID: "stickerFullTypeMask#26dfbf37", - StickerFullTypeCustomEmojiTypeID: "stickerFullTypeCustomEmoji#c37f05ab", - ClosedVectorPathTypeID: "closedVectorPath#2f9276b9", - OutlineTypeID: "outline#7d2ec0be", - PollOptionTypeID: "pollOption#63e97090", - PollTypeRegularTypeID: "pollTypeRegular#2638f022", - PollTypeQuizTypeID: "pollTypeQuiz#27293c99", - AnimationTypeID: "animation#cc00db3e", - AudioTypeID: "audio#a3769600", - DocumentTypeID: "document#af19afd8", - PhotoTypeID: "photo#105a0689", - StickerTypeID: "sticker#d96f5d3f", - VideoTypeID: "video#31a460cc", - VideoNoteTypeID: "videoNote#7ae918c5", - VoiceNoteTypeID: "voiceNote#b9f24cf5", - AnimatedEmojiTypeID: "animatedEmoji#52309ebf", - ContactTypeID: "contact#89285774", - LocationTypeID: "location#e5925f73", - VenueTypeID: "venue#3fcd1af9", - GameTypeID: "game#a2aedfc8", - WebAppTypeID: "webApp#605ba8f3", - PollTypeID: "poll#71d4870c", - AlternativeVideoTypeID: "alternativeVideo#bfda3bb3", - BackgroundTypeID: "background#e65f291c", - BackgroundsTypeID: "backgrounds#b4671319", - ChatBackgroundTypeID: "chatBackground#62891968", - ProfilePhotoTypeID: "profilePhoto#c2dc3c5e", - ChatPhotoInfoTypeID: "chatPhotoInfo#10c2b4a6", - UserTypeRegularTypeID: "userTypeRegular#dc51699b", - UserTypeDeletedTypeID: "userTypeDeleted#94403d24", - UserTypeBotTypeID: "userTypeBot#8ba3cc26", - UserTypeUnknownTypeID: "userTypeUnknown#d4d0613d", - BotCommandTypeID: "botCommand#c27ac8c7", - BotCommandsTypeID: "botCommands#4f9aa2c5", - BotMenuButtonTypeID: "botMenuButton#c7b57ce6", - BotVerificationParametersTypeID: "botVerificationParameters#d4dca55f", - BotVerificationTypeID: "botVerification#b160b6f2", - VerificationStatusTypeID: "verificationStatus#3ae6a18c", - ChatLocationTypeID: "chatLocation#a29b8f21", - BirthdateTypeID: "birthdate#61fe6d1e", - CloseBirthdayUserTypeID: "closeBirthdayUser#800659ee", - BusinessAwayMessageScheduleAlwaysTypeID: "businessAwayMessageScheduleAlways#c9b9e2b9", - BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID: "businessAwayMessageScheduleOutsideOfOpeningHours#c643df16", - BusinessAwayMessageScheduleCustomTypeID: "businessAwayMessageScheduleCustom#8ac04dd2", - BusinessLocationTypeID: "businessLocation#bf54af5a", - BusinessRecipientsTypeID: "businessRecipients#802011e2", - BusinessAwayMessageSettingsTypeID: "businessAwayMessageSettings#150ba2e9", - BusinessGreetingMessageSettingsTypeID: "businessGreetingMessageSettings#64ae3e12", - BusinessConnectedBotTypeID: "businessConnectedBot#ec50ead7", - BusinessStartPageTypeID: "businessStartPage#9fa2f7cf", - InputBusinessStartPageTypeID: "inputBusinessStartPage#ec7c87e0", - BusinessOpeningHoursIntervalTypeID: "businessOpeningHoursInterval#bdf05654", - BusinessOpeningHoursTypeID: "businessOpeningHours#a623e64a", - BusinessInfoTypeID: "businessInfo#5520498e", - BusinessChatLinkTypeID: "businessChatLink#8e998b83", - BusinessChatLinksTypeID: "businessChatLinks#1569924", - InputBusinessChatLinkTypeID: "inputBusinessChatLink#e2d6df8", - BusinessChatLinkInfoTypeID: "businessChatLinkInfo#cc7334af", - ChatPhotoStickerTypeRegularOrMaskTypeID: "chatPhotoStickerTypeRegularOrMask#e741599c", - ChatPhotoStickerTypeCustomEmojiTypeID: "chatPhotoStickerTypeCustomEmoji#f021bad1", - ChatPhotoStickerTypeID: "chatPhotoSticker#a90383a3", - AnimatedChatPhotoTypeID: "animatedChatPhoto#b719c2e", - ChatPhotoTypeID: "chatPhoto#96e90714", - ChatPhotosTypeID: "chatPhotos#89ec34e8", - InputChatPhotoPreviousTypeID: "inputChatPhotoPrevious#160e9d1", - InputChatPhotoStaticTypeID: "inputChatPhotoStatic#75f7e2b3", - InputChatPhotoAnimationTypeID: "inputChatPhotoAnimation#56a3422", - InputChatPhotoStickerTypeID: "inputChatPhotoSticker#4e6e735d", - ChatPermissionsTypeID: "chatPermissions#f8f25a79", - ChatAdministratorRightsTypeID: "chatAdministratorRights#5f4f9044", - StarAmountTypeID: "starAmount#6f0e6d80", - StarSubscriptionTypeChannelTypeID: "starSubscriptionTypeChannel#c29ab6f5", - StarSubscriptionTypeBotTypeID: "starSubscriptionTypeBot#d78ddd2", - StarSubscriptionPricingTypeID: "starSubscriptionPricing#96a28856", - StarSubscriptionTypeID: "starSubscription#3a3811f5", - StarSubscriptionsTypeID: "starSubscriptions#a2f27c8d", - AffiliateTypeCurrentUserTypeID: "affiliateTypeCurrentUser#56a701f5", - AffiliateTypeBotTypeID: "affiliateTypeBot#c273f840", - AffiliateTypeChannelTypeID: "affiliateTypeChannel#d73be869", - AffiliateProgramSortOrderProfitabilityTypeID: "affiliateProgramSortOrderProfitability#8afaaf67", - AffiliateProgramSortOrderCreationDateTypeID: "affiliateProgramSortOrderCreationDate#a319390d", - AffiliateProgramSortOrderRevenueTypeID: "affiliateProgramSortOrderRevenue#72a2c2b8", - AffiliateProgramParametersTypeID: "affiliateProgramParameters#61e90c54", - AffiliateProgramInfoTypeID: "affiliateProgramInfo#96fce8b5", - AffiliateInfoTypeID: "affiliateInfo#b1c1dcfa", - FoundAffiliateProgramTypeID: "foundAffiliateProgram#c6636286", - FoundAffiliateProgramsTypeID: "foundAffiliatePrograms#b6228108", - ConnectedAffiliateProgramTypeID: "connectedAffiliateProgram#58bf7415", - ConnectedAffiliateProgramsTypeID: "connectedAffiliatePrograms#59231e33", - ProductInfoTypeID: "productInfo#87e47ca4", - PremiumPaymentOptionTypeID: "premiumPaymentOption#8c0c5fb2", - PremiumStatePaymentOptionTypeID: "premiumStatePaymentOption#7d06b579", - PremiumGiftCodePaymentOptionTypeID: "premiumGiftCodePaymentOption#d89959ed", - PremiumGiftCodePaymentOptionsTypeID: "premiumGiftCodePaymentOptions#97a8cf2e", - PremiumGiftCodeInfoTypeID: "premiumGiftCodeInfo#b88fa8de", - StarPaymentOptionTypeID: "starPaymentOption#aeb22811", - StarPaymentOptionsTypeID: "starPaymentOptions#77c3bbad", - StarGiveawayWinnerOptionTypeID: "starGiveawayWinnerOption#cc639607", - StarGiveawayPaymentOptionTypeID: "starGiveawayPaymentOption#bca2d5e5", - StarGiveawayPaymentOptionsTypeID: "starGiveawayPaymentOptions#909fbf18", - UpgradedGiftModelTypeID: "upgradedGiftModel#5112584f", - UpgradedGiftSymbolTypeID: "upgradedGiftSymbol#4340c5af", - UpgradedGiftBackdropTypeID: "upgradedGiftBackdrop#fc371c7e", - UpgradedGiftOriginalDetailsTypeID: "upgradedGiftOriginalDetails#44d2b2dd", - GiftTypeID: "gift#7cf9442d", - GiftsTypeID: "gifts#7ea494b8", - UpgradedGiftTypeID: "upgradedGift#e5f50e98", - UpgradeGiftResultTypeID: "upgradeGiftResult#3d9e8331", - SentGiftRegularTypeID: "sentGiftRegular#2368ad19", - SentGiftUpgradedTypeID: "sentGiftUpgraded#25674480", - UserGiftTypeID: "userGift#a39db860", - UserGiftsTypeID: "userGifts#e274219f", - GiftUpgradePreviewTypeID: "giftUpgradePreview#4319deef", - StarTransactionDirectionIncomingTypeID: "starTransactionDirectionIncoming#b2cabe46", - StarTransactionDirectionOutgoingTypeID: "starTransactionDirectionOutgoing#6e83b5a0", - StarTransactionTypePremiumBotDepositTypeID: "starTransactionTypePremiumBotDeposit#d879090e", - StarTransactionTypeAppStoreDepositTypeID: "starTransactionTypeAppStoreDeposit#8283941", - StarTransactionTypeGooglePlayDepositTypeID: "starTransactionTypeGooglePlayDeposit#ecbdb656", - StarTransactionTypeFragmentDepositTypeID: "starTransactionTypeFragmentDeposit#7625e44", - StarTransactionTypeUserDepositTypeID: "starTransactionTypeUserDeposit#c2a18e9", - StarTransactionTypeGiveawayDepositTypeID: "starTransactionTypeGiveawayDeposit#b16200c6", - StarTransactionTypeFragmentWithdrawalTypeID: "starTransactionTypeFragmentWithdrawal#af3a2992", - StarTransactionTypeTelegramAdsWithdrawalTypeID: "starTransactionTypeTelegramAdsWithdrawal#a58e8469", - StarTransactionTypeTelegramAPIUsageTypeID: "starTransactionTypeTelegramApiUsage#27a82afe", - StarTransactionTypeBotPaidMediaPurchaseTypeID: "starTransactionTypeBotPaidMediaPurchase#7f48cc6a", - StarTransactionTypeBotPaidMediaSaleTypeID: "starTransactionTypeBotPaidMediaSale#6e07eeb2", - StarTransactionTypeChannelPaidMediaPurchaseTypeID: "starTransactionTypeChannelPaidMediaPurchase#9016d4f5", - StarTransactionTypeChannelPaidMediaSaleTypeID: "starTransactionTypeChannelPaidMediaSale#eace92ef", - StarTransactionTypeBotInvoicePurchaseTypeID: "starTransactionTypeBotInvoicePurchase#1dddac0c", - StarTransactionTypeBotInvoiceSaleTypeID: "starTransactionTypeBotInvoiceSale#5b7d8d2f", - StarTransactionTypeBotSubscriptionPurchaseTypeID: "starTransactionTypeBotSubscriptionPurchase#40bf1355", - StarTransactionTypeBotSubscriptionSaleTypeID: "starTransactionTypeBotSubscriptionSale#1f686889", - StarTransactionTypeChannelSubscriptionPurchaseTypeID: "starTransactionTypeChannelSubscriptionPurchase#380eb3d1", - StarTransactionTypeChannelSubscriptionSaleTypeID: "starTransactionTypeChannelSubscriptionSale#fe127c82", - StarTransactionTypeGiftPurchaseTypeID: "starTransactionTypeGiftPurchase#ef5f1d52", - StarTransactionTypeGiftTransferTypeID: "starTransactionTypeGiftTransfer#ef323c55", - StarTransactionTypeGiftSaleTypeID: "starTransactionTypeGiftSale#64d61157", - StarTransactionTypeGiftUpgradeTypeID: "starTransactionTypeGiftUpgrade#2697844b", - StarTransactionTypeChannelPaidReactionSendTypeID: "starTransactionTypeChannelPaidReactionSend#c02667c0", - StarTransactionTypeChannelPaidReactionReceiveTypeID: "starTransactionTypeChannelPaidReactionReceive#23d6f9eb", - StarTransactionTypeAffiliateProgramCommissionTypeID: "starTransactionTypeAffiliateProgramCommission#9a637573", - StarTransactionTypeUnsupportedTypeID: "starTransactionTypeUnsupported#76cfcab2", - StarTransactionTypeID: "starTransaction#7f820a90", - StarTransactionsTypeID: "starTransactions#b5f5820b", - GiveawayParticipantStatusEligibleTypeID: "giveawayParticipantStatusEligible#122ade97", - GiveawayParticipantStatusParticipatingTypeID: "giveawayParticipantStatusParticipating#1d53e36f", - GiveawayParticipantStatusAlreadyWasMemberTypeID: "giveawayParticipantStatusAlreadyWasMember#11f9b5a0", - GiveawayParticipantStatusAdministratorTypeID: "giveawayParticipantStatusAdministrator#c84b3a75", - GiveawayParticipantStatusDisallowedCountryTypeID: "giveawayParticipantStatusDisallowedCountry#700b645b", - GiveawayInfoOngoingTypeID: "giveawayInfoOngoing#624ee050", - GiveawayInfoCompletedTypeID: "giveawayInfoCompleted#328cc35c", - GiveawayPrizePremiumTypeID: "giveawayPrizePremium#1b12e978", - GiveawayPrizeStarsTypeID: "giveawayPrizeStars#954c1fa4", - AccentColorTypeID: "accentColor#53312690", - ProfileAccentColorsTypeID: "profileAccentColors#218e9367", - ProfileAccentColorTypeID: "profileAccentColor#213d8295", - EmojiStatusTypeID: "emojiStatus#dbd91636", - EmojiStatusesTypeID: "emojiStatuses#eaeb9bdc", - UsernamesTypeID: "usernames#bf343063", - UserTypeID: "user#598c3933", - BotInfoTypeID: "botInfo#d16edb85", - UserFullInfoTypeID: "userFullInfo#ae9201c2", - UsersTypeID: "users#9d955a12", - FoundUsersTypeID: "foundUsers#c531e854", - ChatAdministratorTypeID: "chatAdministrator#7277bd2c", - ChatAdministratorsTypeID: "chatAdministrators#5141ca21", - ChatMemberStatusCreatorTypeID: "chatMemberStatusCreator#f6764afe", - ChatMemberStatusAdministratorTypeID: "chatMemberStatusAdministrator#fbd3841d", - ChatMemberStatusMemberTypeID: "chatMemberStatusMember#fe0cec16", - ChatMemberStatusRestrictedTypeID: "chatMemberStatusRestricted#630774a6", - ChatMemberStatusLeftTypeID: "chatMemberStatusLeft#ffa74425", - ChatMemberStatusBannedTypeID: "chatMemberStatusBanned#9d714eb6", - ChatMemberTypeID: "chatMember#6d12e175", - ChatMembersTypeID: "chatMembers#8ecbb24", - ChatMembersFilterContactsTypeID: "chatMembersFilterContacts#69c480a7", - ChatMembersFilterAdministratorsTypeID: "chatMembersFilterAdministrators#b47cbc1c", - ChatMembersFilterMembersTypeID: "chatMembersFilterMembers#27f71596", - ChatMembersFilterMentionTypeID: "chatMembersFilterMention#330bedf7", - ChatMembersFilterRestrictedTypeID: "chatMembersFilterRestricted#4ae15abd", - ChatMembersFilterBannedTypeID: "chatMembersFilterBanned#90f34f48", - ChatMembersFilterBotsTypeID: "chatMembersFilterBots#ab355888", - SupergroupMembersFilterRecentTypeID: "supergroupMembersFilterRecent#4639e5d5", - SupergroupMembersFilterContactsTypeID: "supergroupMembersFilterContacts#b3885578", - SupergroupMembersFilterAdministratorsTypeID: "supergroupMembersFilterAdministrators#82fc8457", - SupergroupMembersFilterSearchTypeID: "supergroupMembersFilterSearch#9ae39fbb", - SupergroupMembersFilterRestrictedTypeID: "supergroupMembersFilterRestricted#bdf8501e", - SupergroupMembersFilterBannedTypeID: "supergroupMembersFilterBanned#b7d7610d", - SupergroupMembersFilterMentionTypeID: "supergroupMembersFilterMention#3880091c", - SupergroupMembersFilterBotsTypeID: "supergroupMembersFilterBots#1d5571a6", - ChatInviteLinkTypeID: "chatInviteLink#c6eb6530", - ChatInviteLinksTypeID: "chatInviteLinks#9b1eddfa", - ChatInviteLinkCountTypeID: "chatInviteLinkCount#c3158796", - ChatInviteLinkCountsTypeID: "chatInviteLinkCounts#c953d7f8", - ChatInviteLinkMemberTypeID: "chatInviteLinkMember#1bce5bb", - ChatInviteLinkMembersTypeID: "chatInviteLinkMembers#c2ca3a61", - InviteLinkChatTypeBasicGroupTypeID: "inviteLinkChatTypeBasicGroup#4d43c5ee", - InviteLinkChatTypeSupergroupTypeID: "inviteLinkChatTypeSupergroup#3de86758", - InviteLinkChatTypeChannelTypeID: "inviteLinkChatTypeChannel#3012ef0b", - ChatInviteLinkSubscriptionInfoTypeID: "chatInviteLinkSubscriptionInfo#38cf7368", - ChatInviteLinkInfoTypeID: "chatInviteLinkInfo#c3fe73a", - ChatJoinRequestTypeID: "chatJoinRequest#3897a68", - ChatJoinRequestsTypeID: "chatJoinRequests#b2c5fd31", - ChatJoinRequestsInfoTypeID: "chatJoinRequestsInfo#6aff5df5", - BasicGroupTypeID: "basicGroup#f464168f", - BasicGroupFullInfoTypeID: "basicGroupFullInfo#d62e521e", - SupergroupTypeID: "supergroup#9ebc0c42", - SupergroupFullInfoTypeID: "supergroupFullInfo#f763d79d", - SecretChatStatePendingTypeID: "secretChatStatePending#9e6c967c", - SecretChatStateReadyTypeID: "secretChatStateReady#9ff4b7e9", - SecretChatStateClosedTypeID: "secretChatStateClosed#8c1006ed", - SecretChatTypeID: "secretChat#d7a70bcb", - MessageSenderUserTypeID: "messageSenderUser#ebf760e3", - MessageSenderChatTypeID: "messageSenderChat#f1b71131", - MessageSendersTypeID: "messageSenders#f6929bcc", - ChatMessageSenderTypeID: "chatMessageSender#2d55aeba", - ChatMessageSendersTypeID: "chatMessageSenders#d80d336", - MessageReadDateReadTypeID: "messageReadDateRead#758d2e30", - MessageReadDateUnreadTypeID: "messageReadDateUnread#17b2212c", - MessageReadDateTooOldTypeID: "messageReadDateTooOld#b6761e20", - MessageReadDateUserPrivacyRestrictedTypeID: "messageReadDateUserPrivacyRestricted#b38d9426", - MessageReadDateMyPrivacyRestrictedTypeID: "messageReadDateMyPrivacyRestricted#d6a2d474", - MessageViewerTypeID: "messageViewer#56f111cd", - MessageViewersTypeID: "messageViewers#87c73f6c", - MessageOriginUserTypeID: "messageOriginUser#9c009043", - MessageOriginHiddenUserTypeID: "messageOriginHiddenUser#ed0c23da", - MessageOriginChatTypeID: "messageOriginChat#f3bb5eb4", - MessageOriginChannelTypeID: "messageOriginChannel#a97b51be", - ForwardSourceTypeID: "forwardSource#6b02aec9", - ReactionTypeEmojiTypeID: "reactionTypeEmoji#8c3e22c8", - ReactionTypeCustomEmojiTypeID: "reactionTypeCustomEmoji#c50b42f3", - ReactionTypePaidTypeID: "reactionTypePaid#1a0152ed", - PaidReactorTypeID: "paidReactor#9d379008", - MessageForwardInfoTypeID: "messageForwardInfo#cb877b7d", - MessageImportInfoTypeID: "messageImportInfo#e6dfabcf", - MessageReplyInfoTypeID: "messageReplyInfo#69240cb9", - MessageReactionTypeID: "messageReaction#7d9e9864", - MessageReactionsTypeID: "messageReactions#9d558cb", - MessageInteractionInfoTypeID: "messageInteractionInfo#2bbcde05", - UnreadReactionTypeID: "unreadReaction#8c5b3b82", - MessageEffectTypeEmojiReactionTypeID: "messageEffectTypeEmojiReaction#68aba63e", - MessageEffectTypePremiumStickerTypeID: "messageEffectTypePremiumSticker#61962bf9", - MessageEffectTypeID: "messageEffect#972a492f", - MessageSendingStatePendingTypeID: "messageSendingStatePending#f32b63b4", - MessageSendingStateFailedTypeID: "messageSendingStateFailed#ac81ee5e", - TextQuoteTypeID: "textQuote#8675b8b2", - InputTextQuoteTypeID: "inputTextQuote#b74a6d1c", - MessageReplyToMessageTypeID: "messageReplyToMessage#ee105987", - MessageReplyToStoryTypeID: "messageReplyToStory#708ca939", - InputMessageReplyToMessageTypeID: "inputMessageReplyToMessage#c25e9903", - InputMessageReplyToExternalMessageTypeID: "inputMessageReplyToExternalMessage#892d232a", - InputMessageReplyToStoryTypeID: "inputMessageReplyToStory#51aece78", - FactCheckTypeID: "factCheck#c185f918", - MessageTypeID: "message#a9c04bbc", - MessagesTypeID: "messages#b34c8c60", - FoundMessagesTypeID: "foundMessages#2515f708", - FoundChatMessagesTypeID: "foundChatMessages#4a25270c", - MessagePositionTypeID: "messagePosition#4d0540ef", - MessagePositionsTypeID: "messagePositions#912eab72", - MessageCalendarDayTypeID: "messageCalendarDay#e98f8f62", - MessageCalendarTypeID: "messageCalendar#2582bbd7", - BusinessMessageTypeID: "businessMessage#fa604646", - BusinessMessagesTypeID: "businessMessages#355963fa", - MessageSourceChatHistoryTypeID: "messageSourceChatHistory#bf02073c", - MessageSourceMessageThreadHistoryTypeID: "messageSourceMessageThreadHistory#114f9106", - MessageSourceForumTopicHistoryTypeID: "messageSourceForumTopicHistory#a5842cb7", - MessageSourceHistoryPreviewTypeID: "messageSourceHistoryPreview#3d0ce411", - MessageSourceChatListTypeID: "messageSourceChatList#85f70fea", - MessageSourceSearchTypeID: "messageSourceSearch#72853771", - MessageSourceChatEventLogTypeID: "messageSourceChatEventLog#c2ae19bc", - MessageSourceNotificationTypeID: "messageSourceNotification#c1a11bed", - MessageSourceScreenshotTypeID: "messageSourceScreenshot#1c035d0a", - MessageSourceOtherTypeID: "messageSourceOther#35c0a702", - MessageSponsorTypeID: "messageSponsor#77c251de", - SponsoredMessageTypeID: "sponsoredMessage#b78d4c25", - SponsoredMessagesTypeID: "sponsoredMessages#e402a0f", - ReportOptionTypeID: "reportOption#41f22c20", - ReportChatSponsoredMessageResultOkTypeID: "reportChatSponsoredMessageResultOk#754f721f", - ReportChatSponsoredMessageResultFailedTypeID: "reportChatSponsoredMessageResultFailed#7f1f9bc6", - ReportChatSponsoredMessageResultOptionRequiredTypeID: "reportChatSponsoredMessageResultOptionRequired#34fc24b2", - ReportChatSponsoredMessageResultAdsHiddenTypeID: "reportChatSponsoredMessageResultAdsHidden#e8eade1e", - ReportChatSponsoredMessageResultPremiumRequiredTypeID: "reportChatSponsoredMessageResultPremiumRequired#770c2ed0", - FileDownloadTypeID: "fileDownload#834d1354", - DownloadedFileCountsTypeID: "downloadedFileCounts#8a572842", - FoundFileDownloadsTypeID: "foundFileDownloads#c7db4128", - NotificationSettingsScopePrivateChatsTypeID: "notificationSettingsScopePrivateChats#37e04d67", - NotificationSettingsScopeGroupChatsTypeID: "notificationSettingsScopeGroupChats#483fd1f3", - NotificationSettingsScopeChannelChatsTypeID: "notificationSettingsScopeChannelChats#20aa0588", - ChatNotificationSettingsTypeID: "chatNotificationSettings#dddc12cf", - ScopeNotificationSettingsTypeID: "scopeNotificationSettings#dc4a615f", - ReactionNotificationSourceNoneTypeID: "reactionNotificationSourceNone#15d6701c", - ReactionNotificationSourceContactsTypeID: "reactionNotificationSourceContacts#211c4835", - ReactionNotificationSourceAllTypeID: "reactionNotificationSourceAll#4a02ac92", - ReactionNotificationSettingsTypeID: "reactionNotificationSettings#2bb0f654", - DraftMessageTypeID: "draftMessage#4313276d", - ChatTypePrivateTypeID: "chatTypePrivate#5e1e6374", - ChatTypeBasicGroupTypeID: "chatTypeBasicGroup#3a0c4c5c", - ChatTypeSupergroupTypeID: "chatTypeSupergroup#a83a5a6a", - ChatTypeSecretTypeID: "chatTypeSecret#3366ab31", - ChatFolderIconTypeID: "chatFolderIcon#f74aa0e6", - ChatFolderNameTypeID: "chatFolderName#ec4d3d9e", - ChatFolderTypeID: "chatFolder#a2e17d38", - ChatFolderInfoTypeID: "chatFolderInfo#309c140d", - ChatFolderInviteLinkTypeID: "chatFolderInviteLink#d33caf97", - ChatFolderInviteLinksTypeID: "chatFolderInviteLinks#6c135313", - ChatFolderInviteLinkInfoTypeID: "chatFolderInviteLinkInfo#776fe405", - RecommendedChatFolderTypeID: "recommendedChatFolder#81d7b4b6", - RecommendedChatFoldersTypeID: "recommendedChatFolders#32208553", - ArchiveChatListSettingsTypeID: "archiveChatListSettings#3f176aa4", - ChatListMainTypeID: "chatListMain#e8195bac", - ChatListArchiveTypeID: "chatListArchive#159f6ec3", - ChatListFolderTypeID: "chatListFolder#16fe3e58", - ChatListsTypeID: "chatLists#92c2d216", - ChatSourceMtprotoProxyTypeID: "chatSourceMtprotoProxy#177d1803", - ChatSourcePublicServiceAnnouncementTypeID: "chatSourcePublicServiceAnnouncement#ec6a6694", - ChatPositionTypeID: "chatPosition#dae48755", - ChatAvailableReactionsAllTypeID: "chatAvailableReactionsAll#29600b97", - ChatAvailableReactionsSomeTypeID: "chatAvailableReactionsSome#36b46b7d", - SavedMessagesTagTypeID: "savedMessagesTag#6a67bc61", - SavedMessagesTagsTypeID: "savedMessagesTags#ca94a1b3", - BusinessBotManageBarTypeID: "businessBotManageBar#ed706a82", - VideoChatTypeID: "videoChat#ae158d28", - ChatTypeID: "chat#e5bae2e4", - ChatsTypeID: "chats#9b93e3eb", - FailedToAddMemberTypeID: "failedToAddMember#ef236cc2", - FailedToAddMembersTypeID: "failedToAddMembers#98b4b04", - CreatedBasicGroupChatTypeID: "createdBasicGroupChat#fec875d4", - PublicChatTypeHasUsernameTypeID: "publicChatTypeHasUsername#14e8a07e", - PublicChatTypeIsLocationBasedTypeID: "publicChatTypeIsLocationBased#468e6090", - ChatActionBarReportSpamTypeID: "chatActionBarReportSpam#b1c0e61a", - ChatActionBarInviteMembersTypeID: "chatActionBarInviteMembers#76557c70", - ChatActionBarReportAddBlockTypeID: "chatActionBarReportAddBlock#a9748a2a", - ChatActionBarAddContactTypeID: "chatActionBarAddContact#d44a5811", - ChatActionBarSharePhoneNumberTypeID: "chatActionBarSharePhoneNumber#218efd9", - ChatActionBarJoinRequestTypeID: "chatActionBarJoinRequest#3dd18308", - KeyboardButtonTypeTextTypeID: "keyboardButtonTypeText#96519938", - KeyboardButtonTypeRequestPhoneNumberTypeID: "keyboardButtonTypeRequestPhoneNumber#a4d9b7b9", - KeyboardButtonTypeRequestLocationTypeID: "keyboardButtonTypeRequestLocation#f8828cfd", - KeyboardButtonTypeRequestPollTypeID: "keyboardButtonTypeRequestPoll#7164dcb8", - KeyboardButtonTypeRequestUsersTypeID: "keyboardButtonTypeRequestUsers#985c8bfd", - KeyboardButtonTypeRequestChatTypeID: "keyboardButtonTypeRequestChat#5a1224b5", - KeyboardButtonTypeWebAppTypeID: "keyboardButtonTypeWebApp#70c8ff62", - KeyboardButtonTypeID: "keyboardButton#84a0ce74", - InlineKeyboardButtonTypeURLTypeID: "inlineKeyboardButtonTypeUrl#4365beac", - InlineKeyboardButtonTypeLoginURLTypeID: "inlineKeyboardButtonTypeLoginUrl#b8455fa7", - InlineKeyboardButtonTypeWebAppTypeID: "inlineKeyboardButtonTypeWebApp#96a685c8", - InlineKeyboardButtonTypeCallbackTypeID: "inlineKeyboardButtonTypeCallback#bccb7bfd", - InlineKeyboardButtonTypeCallbackWithPasswordTypeID: "inlineKeyboardButtonTypeCallbackWithPassword#361f4248", - InlineKeyboardButtonTypeCallbackGameTypeID: "inlineKeyboardButtonTypeCallbackGame#e9255468", - InlineKeyboardButtonTypeSwitchInlineTypeID: "inlineKeyboardButtonTypeSwitchInline#207a9cf5", - InlineKeyboardButtonTypeBuyTypeID: "inlineKeyboardButtonTypeBuy#511b3c70", - InlineKeyboardButtonTypeUserTypeID: "inlineKeyboardButtonTypeUser#6d77e5a2", - InlineKeyboardButtonTypeCopyTextTypeID: "inlineKeyboardButtonTypeCopyText#41b1306", - InlineKeyboardButtonTypeID: "inlineKeyboardButton#e9d21e18", - ReplyMarkupRemoveKeyboardTypeID: "replyMarkupRemoveKeyboard#d6cc5171", - ReplyMarkupForceReplyTypeID: "replyMarkupForceReply#41a6f99f", - ReplyMarkupShowKeyboardTypeID: "replyMarkupShowKeyboard#802461d3", - ReplyMarkupInlineKeyboardTypeID: "replyMarkupInlineKeyboard#92ac0efb", - LoginURLInfoOpenTypeID: "loginUrlInfoOpen#31e7ea02", - LoginURLInfoRequestConfirmationTypeID: "loginUrlInfoRequestConfirmation#7edb242f", - ThemeParametersTypeID: "themeParameters#ef8395af", - WebAppOpenModeCompactTypeID: "webAppOpenModeCompact#6604ffdb", - WebAppOpenModeFullSizeTypeID: "webAppOpenModeFullSize#b48cd41", - WebAppOpenModeFullScreenTypeID: "webAppOpenModeFullScreen#6f8a019d", - FoundWebAppTypeID: "foundWebApp#eea8d01e", - WebAppInfoTypeID: "webAppInfo#2efdb2e8", - MainWebAppTypeID: "mainWebApp#73a7ac7a", - WebAppOpenParametersTypeID: "webAppOpenParameters#51fa466f", - MessageThreadInfoTypeID: "messageThreadInfo#683fd5ad", - SavedMessagesTopicTypeMyNotesTypeID: "savedMessagesTopicTypeMyNotes#b38a41f5", - SavedMessagesTopicTypeAuthorHiddenTypeID: "savedMessagesTopicTypeAuthorHidden#703c4195", - SavedMessagesTopicTypeSavedFromChatTypeID: "savedMessagesTopicTypeSavedFromChat#993fad58", - SavedMessagesTopicTypeID: "savedMessagesTopic#d2a8e1a4", - ForumTopicIconTypeID: "forumTopicIcon#cf32a193", - ForumTopicInfoTypeID: "forumTopicInfo#8ff3df9e", - ForumTopicTypeID: "forumTopic#1213ace6", - ForumTopicsTypeID: "forumTopics#2d99b4ae", - LinkPreviewOptionsTypeID: "linkPreviewOptions#3e61b3f3", - SharedUserTypeID: "sharedUser#117724f7", - SharedChatTypeID: "sharedChat#4a87b01a", - ThemeSettingsTypeID: "themeSettings#fc4c1c12", - RichTextPlainTypeID: "richTextPlain#1cc42966", - RichTextBoldTypeID: "richTextBold#63970f6c", - RichTextItalicTypeID: "richTextItalic#6e77f03f", - RichTextUnderlineTypeID: "richTextUnderline#e00cfd8c", - RichTextStrikethroughTypeID: "richTextStrikethrough#2b1e6a51", - RichTextFixedTypeID: "richTextFixed#b43681c7", - RichTextURLTypeID: "richTextUrl#500cf14", - RichTextEmailAddressTypeID: "richTextEmailAddress#262a2f7", - RichTextSubscriptTypeID: "richTextSubscript#cc405a4c", - RichTextSuperscriptTypeID: "richTextSuperscript#e9377563", - RichTextMarkedTypeID: "richTextMarked#b42ed382", - RichTextPhoneNumberTypeID: "richTextPhoneNumber#7a91543", - RichTextIconTypeID: "richTextIcon#a7c42b02", - RichTextReferenceTypeID: "richTextReference#bb9a1276", - RichTextAnchorTypeID: "richTextAnchor#4e7f1034", - RichTextAnchorLinkTypeID: "richTextAnchorLink#a41fd2d6", - RichTextsTypeID: "richTexts#94b21889", - PageBlockCaptionTypeID: "pageBlockCaption#b9a9a476", - PageBlockListItemTypeID: "pageBlockListItem#5f521776", - PageBlockHorizontalAlignmentLeftTypeID: "pageBlockHorizontalAlignmentLeft#329627e9", - PageBlockHorizontalAlignmentCenterTypeID: "pageBlockHorizontalAlignmentCenter#c3d8c4ea", - PageBlockHorizontalAlignmentRightTypeID: "pageBlockHorizontalAlignmentRight#51bd6efe", - PageBlockVerticalAlignmentTopTypeID: "pageBlockVerticalAlignmentTop#ba719a6", - PageBlockVerticalAlignmentMiddleTypeID: "pageBlockVerticalAlignmentMiddle#81741df5", - PageBlockVerticalAlignmentBottomTypeID: "pageBlockVerticalAlignmentBottom#7cb97dd6", - PageBlockTableCellTypeID: "pageBlockTableCell#547fbf66", - PageBlockRelatedArticleTypeID: "pageBlockRelatedArticle#1cae8493", - PageBlockTitleTypeID: "pageBlockTitle#6122b610", - PageBlockSubtitleTypeID: "pageBlockSubtitle#fc451e7", - PageBlockAuthorDateTypeID: "pageBlockAuthorDate#4d7ff410", - PageBlockHeaderTypeID: "pageBlockHeader#539ddd9b", - PageBlockSubheaderTypeID: "pageBlockSubheader#4b567326", - PageBlockKickerTypeID: "pageBlockKicker#5123864b", - PageBlockParagraphTypeID: "pageBlockParagraph#467a0766", - PageBlockPreformattedTypeID: "pageBlockPreformatted#c070d93e", - PageBlockFooterTypeID: "pageBlockFooter#34d5d728", - PageBlockDividerTypeID: "pageBlockDivider#db20b188", - PageBlockAnchorTypeID: "pageBlockAnchor#ce0d37b0", - PageBlockListTypeID: "pageBlockList#584af35a", - PageBlockBlockQuoteTypeID: "pageBlockBlockQuote#62d08a9e", - PageBlockPullQuoteTypeID: "pageBlockPullQuote#1d38810d", - PageBlockAnimationTypeID: "pageBlockAnimation#50cde009", - PageBlockAudioTypeID: "pageBlockAudio#fc390813", - PageBlockPhotoTypeID: "pageBlockPhoto#18e41684", - PageBlockVideoTypeID: "pageBlockVideo#1e669d32", - PageBlockVoiceNoteTypeID: "pageBlockVoiceNote#6cad827f", - PageBlockCoverTypeID: "pageBlockCover#39f23300", - PageBlockEmbeddedTypeID: "pageBlockEmbedded#8c369d9d", - PageBlockEmbeddedPostTypeID: "pageBlockEmbeddedPost#bc57cdf5", - PageBlockCollageTypeID: "pageBlockCollage#40bcaaf0", - PageBlockSlideshowTypeID: "pageBlockSlideshow#1107d496", - PageBlockChatLinkTypeID: "pageBlockChatLink#621ed8bb", - PageBlockTableTypeID: "pageBlockTable#cc6352c3", - PageBlockDetailsTypeID: "pageBlockDetails#990a0c0b", - PageBlockRelatedArticlesTypeID: "pageBlockRelatedArticles#936d81e6", - PageBlockMapTypeID: "pageBlockMap#5a0f7013", - WebPageInstantViewTypeID: "webPageInstantView#2c0ec99c", - LinkPreviewAlbumMediaPhotoTypeID: "linkPreviewAlbumMediaPhoto#c83db38e", - LinkPreviewAlbumMediaVideoTypeID: "linkPreviewAlbumMediaVideo#174856db", - LinkPreviewTypeAlbumTypeID: "linkPreviewTypeAlbum#186d97b4", - LinkPreviewTypeAnimationTypeID: "linkPreviewTypeAnimation#ad5cc534", - LinkPreviewTypeAppTypeID: "linkPreviewTypeApp#e3a68def", - LinkPreviewTypeArticleTypeID: "linkPreviewTypeArticle#7cce9bd9", - LinkPreviewTypeAudioTypeID: "linkPreviewTypeAudio#75e407d2", - LinkPreviewTypeBackgroundTypeID: "linkPreviewTypeBackground#3a48a1e0", - LinkPreviewTypeChannelBoostTypeID: "linkPreviewTypeChannelBoost#c6f40456", - LinkPreviewTypeChatTypeID: "linkPreviewTypeChat#ae2fa122", - LinkPreviewTypeDocumentTypeID: "linkPreviewTypeDocument#bf0169a2", - LinkPreviewTypeEmbeddedAnimationPlayerTypeID: "linkPreviewTypeEmbeddedAnimationPlayer#aa5ad605", - LinkPreviewTypeEmbeddedAudioPlayerTypeID: "linkPreviewTypeEmbeddedAudioPlayer#220b429c", - LinkPreviewTypeEmbeddedVideoPlayerTypeID: "linkPreviewTypeEmbeddedVideoPlayer#a7bfbb03", - LinkPreviewTypeExternalAudioTypeID: "linkPreviewTypeExternalAudio#8a82ffed", - LinkPreviewTypeExternalVideoTypeID: "linkPreviewTypeExternalVideo#517dcb98", - LinkPreviewTypeInvoiceTypeID: "linkPreviewTypeInvoice#d47f48da", - LinkPreviewTypeMessageTypeID: "linkPreviewTypeMessage#19f4c19e", - LinkPreviewTypePhotoTypeID: "linkPreviewTypePhoto#aecfaaac", - LinkPreviewTypePremiumGiftCodeTypeID: "linkPreviewTypePremiumGiftCode#4e0d80b1", - LinkPreviewTypeShareableChatFolderTypeID: "linkPreviewTypeShareableChatFolder#805ab33c", - LinkPreviewTypeStickerTypeID: "linkPreviewTypeSticker#245f4d25", - LinkPreviewTypeStickerSetTypeID: "linkPreviewTypeStickerSet#cb82a523", - LinkPreviewTypeStoryTypeID: "linkPreviewTypeStory#1e9c87ce", - LinkPreviewTypeSupergroupBoostTypeID: "linkPreviewTypeSupergroupBoost#90570476", - LinkPreviewTypeThemeTypeID: "linkPreviewTypeTheme#6b7a9ba5", - LinkPreviewTypeUnsupportedTypeID: "linkPreviewTypeUnsupported#72b92cb9", - LinkPreviewTypeUserTypeID: "linkPreviewTypeUser#a8ad817c", - LinkPreviewTypeVideoTypeID: "linkPreviewTypeVideo#10c9fc08", - LinkPreviewTypeVideoChatTypeID: "linkPreviewTypeVideoChat#1908ee13", - LinkPreviewTypeVideoNoteTypeID: "linkPreviewTypeVideoNote#cf70db61", - LinkPreviewTypeVoiceNoteTypeID: "linkPreviewTypeVoiceNote#d2d2cf2b", - LinkPreviewTypeWebAppTypeID: "linkPreviewTypeWebApp#a62eef8a", - LinkPreviewTypeID: "linkPreview#6714d1f2", - CountryInfoTypeID: "countryInfo#d9936dff", - CountriesTypeID: "countries#94b50e0f", - PhoneNumberInfoTypeID: "phoneNumberInfo#d2c398a1", - CollectibleItemTypeUsernameTypeID: "collectibleItemTypeUsername#1b56e7d1", - CollectibleItemTypePhoneNumberTypeID: "collectibleItemTypePhoneNumber#4ae0e142", - CollectibleItemInfoTypeID: "collectibleItemInfo#570f9bcd", - BankCardActionOpenURLTypeID: "bankCardActionOpenUrl#f44a5885", - BankCardInfoTypeID: "bankCardInfo#2bc7da9f", - AddressTypeID: "address#86304f3a", - LocationAddressTypeID: "locationAddress#a3dad322", - LabeledPricePartTypeID: "labeledPricePart#20f2e726", - InvoiceTypeID: "invoice#67dc0e89", - OrderInfoTypeID: "orderInfo#2ebad96e", - ShippingOptionTypeID: "shippingOption#731bffce", - SavedCredentialsTypeID: "savedCredentials#e9ee14dc", - InputCredentialsSavedTypeID: "inputCredentialsSaved#86bdbe2c", - InputCredentialsNewTypeID: "inputCredentialsNew#ce8bf12a", - InputCredentialsApplePayTypeID: "inputCredentialsApplePay#b5b2d6d1", - InputCredentialsGooglePayTypeID: "inputCredentialsGooglePay#32544764", - PaymentProviderSmartGlocalTypeID: "paymentProviderSmartGlocal#ba047774", - PaymentProviderStripeTypeID: "paymentProviderStripe#1614e19b", - PaymentProviderOtherTypeID: "paymentProviderOther#b050e0e4", - PaymentOptionTypeID: "paymentOption#ee79989b", - PaymentFormTypeRegularTypeID: "paymentFormTypeRegular#ba6d2f0f", - PaymentFormTypeStarsTypeID: "paymentFormTypeStars#56b9d3d", - PaymentFormTypeStarSubscriptionTypeID: "paymentFormTypeStarSubscription#102deb5b", - PaymentFormTypeID: "paymentForm#7720ffb3", - ValidatedOrderInfoTypeID: "validatedOrderInfo#ac585f14", - PaymentResultTypeID: "paymentResult#d00fe85d", - PaymentReceiptTypeRegularTypeID: "paymentReceiptTypeRegular#9e7715b6", - PaymentReceiptTypeStarsTypeID: "paymentReceiptTypeStars#1194074c", - PaymentReceiptTypeID: "paymentReceipt#2d313392", - InputInvoiceMessageTypeID: "inputInvoiceMessage#58dcea10", - InputInvoiceNameTypeID: "inputInvoiceName#b1ca16f3", - InputInvoiceTelegramTypeID: "inputInvoiceTelegram#96ecfeed", - PaidMediaPreviewTypeID: "paidMediaPreview#bcc1c474", - PaidMediaPhotoTypeID: "paidMediaPhoto#ba82551a", - PaidMediaVideoTypeID: "paidMediaVideo#1bb52e09", - PaidMediaUnsupportedTypeID: "paidMediaUnsupported#6bc3e26", - GiveawayParametersTypeID: "giveawayParameters#16f1de3d", - DatedFileTypeID: "datedFile#9247b09d", - PassportElementTypePersonalDetailsTypeID: "passportElementTypePersonalDetails#c27ad953", - PassportElementTypePassportTypeID: "passportElementTypePassport#e5fdab48", - PassportElementTypeDriverLicenseTypeID: "passportElementTypeDriverLicense#6cea5c4b", - PassportElementTypeIdentityCardTypeID: "passportElementTypeIdentityCard#e20ea75c", - PassportElementTypeInternalPassportTypeID: "passportElementTypeInternalPassport#d0afd939", - PassportElementTypeAddressTypeID: "passportElementTypeAddress#1d955cc2", - PassportElementTypeUtilityBillTypeID: "passportElementTypeUtilityBill#25608e6a", - PassportElementTypeBankStatementTypeID: "passportElementTypeBankStatement#22380133", - PassportElementTypeRentalAgreementTypeID: "passportElementTypeRentalAgreement#852dfe90", - PassportElementTypePassportRegistrationTypeID: "passportElementTypePassportRegistration#f67e8e3f", - PassportElementTypeTemporaryRegistrationTypeID: "passportElementTypeTemporaryRegistration#411e345f", - PassportElementTypePhoneNumberTypeID: "passportElementTypePhoneNumber#c4abfe6c", - PassportElementTypeEmailAddressTypeID: "passportElementTypeEmailAddress#fb45a6c3", - DateTypeID: "date#ef6eb6a0", - PersonalDetailsTypeID: "personalDetails#c0b869b7", - IdentityDocumentTypeID: "identityDocument#289299ff", - InputIdentityDocumentTypeID: "inputIdentityDocument#185f2052", - PersonalDocumentTypeID: "personalDocument#a8357e38", - InputPersonalDocumentTypeID: "inputPersonalDocument#bb343fae", - PassportElementPersonalDetailsTypeID: "passportElementPersonalDetails#4894fe83", - PassportElementPassportTypeID: "passportElementPassport#f043e723", - PassportElementDriverLicenseTypeID: "passportElementDriverLicense#61f70cad", - PassportElementIdentityCardTypeID: "passportElementIdentityCard#7c33e535", - PassportElementInternalPassportTypeID: "passportElementInternalPassport#228ad87", - PassportElementAddressTypeID: "passportElementAddress#d15a1630", - PassportElementUtilityBillTypeID: "passportElementUtilityBill#f2041dd2", - PassportElementBankStatementTypeID: "passportElementBankStatement#ea283268", - PassportElementRentalAgreementTypeID: "passportElementRentalAgreement#eeb4cb28", - PassportElementPassportRegistrationTypeID: "passportElementPassportRegistration#24dadc7f", - PassportElementTemporaryRegistrationTypeID: "passportElementTemporaryRegistration#49c4aff0", - PassportElementPhoneNumberTypeID: "passportElementPhoneNumber#b1509799", - PassportElementEmailAddressTypeID: "passportElementEmailAddress#a4ea9805", - InputPassportElementPersonalDetailsTypeID: "inputPassportElementPersonalDetails#9d2843f", - InputPassportElementPassportTypeID: "inputPassportElementPassport#e2603564", - InputPassportElementDriverLicenseTypeID: "inputPassportElementDriverLicense#122b14d0", - InputPassportElementIdentityCardTypeID: "inputPassportElementIdentityCard#ff67f882", - InputPassportElementInternalPassportTypeID: "inputPassportElementInternalPassport#2aa3872b", - InputPassportElementAddressTypeID: "inputPassportElementAddress#1b83ec10", - InputPassportElementUtilityBillTypeID: "inputPassportElementUtilityBill#52cd9181", - InputPassportElementBankStatementTypeID: "inputPassportElementBankStatement#fe6a5788", - InputPassportElementRentalAgreementTypeID: "inputPassportElementRentalAgreement#677b9c2b", - InputPassportElementPassportRegistrationTypeID: "inputPassportElementPassportRegistration#4e5aa050", - InputPassportElementTemporaryRegistrationTypeID: "inputPassportElementTemporaryRegistration#8df64de1", - InputPassportElementPhoneNumberTypeID: "inputPassportElementPhoneNumber#4ea3cc39", - InputPassportElementEmailAddressTypeID: "inputPassportElementEmailAddress#f12e9425", - PassportElementsTypeID: "passportElements#bd8eaceb", - PassportElementErrorSourceUnspecifiedTypeID: "passportElementErrorSourceUnspecified#e9734842", - PassportElementErrorSourceDataFieldTypeID: "passportElementErrorSourceDataField#ed9a5ce8", - PassportElementErrorSourceFrontSideTypeID: "passportElementErrorSourceFrontSide#70fd7334", - PassportElementErrorSourceReverseSideTypeID: "passportElementErrorSourceReverseSide#725bf9f7", - PassportElementErrorSourceSelfieTypeID: "passportElementErrorSourceSelfie#d07e1428", - PassportElementErrorSourceTranslationFileTypeID: "passportElementErrorSourceTranslationFile#d6e53714", - PassportElementErrorSourceTranslationFilesTypeID: "passportElementErrorSourceTranslationFiles#22a5a41c", - PassportElementErrorSourceFileTypeID: "passportElementErrorSourceFile#786c3b30", - PassportElementErrorSourceFilesTypeID: "passportElementErrorSourceFiles#70e6a6d2", - PassportElementErrorTypeID: "passportElementError#91059fc5", - PassportSuitableElementTypeID: "passportSuitableElement#d0f8831c", - PassportRequiredElementTypeID: "passportRequiredElement#f2ad05fd", - PassportAuthorizationFormTypeID: "passportAuthorizationForm#3fe28cb0", - PassportElementsWithErrorsTypeID: "passportElementsWithErrors#438d1abf", - EncryptedCredentialsTypeID: "encryptedCredentials#4f5713ce", - EncryptedPassportElementTypeID: "encryptedPassportElement#262d248", - InputPassportElementErrorSourceUnspecifiedTypeID: "inputPassportElementErrorSourceUnspecified#fed9c6f", - InputPassportElementErrorSourceDataFieldTypeID: "inputPassportElementErrorSourceDataField#e68fa006", - InputPassportElementErrorSourceFrontSideTypeID: "inputPassportElementErrorSourceFrontSide#230c87bd", - InputPassportElementErrorSourceReverseSideTypeID: "inputPassportElementErrorSourceReverseSide#189efdfb", - InputPassportElementErrorSourceSelfieTypeID: "inputPassportElementErrorSourceSelfie#d1e42c98", - InputPassportElementErrorSourceTranslationFileTypeID: "inputPassportElementErrorSourceTranslationFile#1e268a7b", - InputPassportElementErrorSourceTranslationFilesTypeID: "inputPassportElementErrorSourceTranslationFiles#ef54819b", - InputPassportElementErrorSourceFileTypeID: "inputPassportElementErrorSourceFile#ee355dcb", - InputPassportElementErrorSourceFilesTypeID: "inputPassportElementErrorSourceFiles#673401d6", - InputPassportElementErrorTypeID: "inputPassportElementError#11084de2", - MessageTextTypeID: "messageText#68654c84", - MessageAnimationTypeID: "messageAnimation#8ecb1128", - MessageAudioTypeID: "messageAudio#107e741c", - MessageDocumentTypeID: "messageDocument#2394ab77", - MessagePaidMediaTypeID: "messagePaidMedia#3e5fd7c2", - MessagePhotoTypeID: "messagePhoto#754c7e1f", - MessageStickerTypeID: "messageSticker#e5f0dcca", - MessageVideoTypeID: "messageVideo#fdcc35d5", - MessageVideoNoteTypeID: "messageVideoNote#396b2486", - MessageVoiceNoteTypeID: "messageVoiceNote#1f753ff5", - MessageExpiredPhotoTypeID: "messageExpiredPhoto#ac46ddf7", - MessageExpiredVideoTypeID: "messageExpiredVideo#b7bf24c3", - MessageExpiredVideoNoteTypeID: "messageExpiredVideoNote#23bc43e7", - MessageExpiredVoiceNoteTypeID: "messageExpiredVoiceNote#890757d", - MessageLocationTypeID: "messageLocation#121e4474", - MessageVenueTypeID: "messageVenue#800f2175", - MessageContactTypeID: "messageContact#e1710c5a", - MessageAnimatedEmojiTypeID: "messageAnimatedEmoji#3621f5e2", - MessageDiceTypeID: "messageDice#42817239", - MessageGameTypeID: "messageGame#fbdc6976", - MessagePollTypeID: "messagePoll#d888b24d", - MessageStoryTypeID: "messageStory#3329f2d4", - MessageInvoiceTypeID: "messageInvoice#fadfd46", - MessageCallTypeID: "messageCall#201ede00", - MessageVideoChatScheduledTypeID: "messageVideoChatScheduled#916c1db7", - MessageVideoChatStartedTypeID: "messageVideoChatStarted#1f114559", - MessageVideoChatEndedTypeID: "messageVideoChatEnded#79262c57", - MessageInviteVideoChatParticipantsTypeID: "messageInviteVideoChatParticipants#f58d603", - MessageBasicGroupChatCreateTypeID: "messageBasicGroupChatCreate#8b60f757", - MessageSupergroupChatCreateTypeID: "messageSupergroupChatCreate#e61cb71b", - MessageChatChangeTitleTypeID: "messageChatChangeTitle#2c99bb41", - MessageChatChangePhotoTypeID: "messageChatChangePhoto#cf84454b", - MessageChatDeletePhotoTypeID: "messageChatDeletePhoto#f502a9e7", - MessageChatAddMembersTypeID: "messageChatAddMembers#1e95b1cd", - MessageChatJoinByLinkTypeID: "messageChatJoinByLink#6e0f407f", - MessageChatJoinByRequestTypeID: "messageChatJoinByRequest#4740cb7c", - MessageChatDeleteMemberTypeID: "messageChatDeleteMember#37e931a9", - MessageChatUpgradeToTypeID: "messageChatUpgradeTo#63f549b", - MessageChatUpgradeFromTypeID: "messageChatUpgradeFrom#136daadc", - MessagePinMessageTypeID: "messagePinMessage#38d55039", - MessageScreenshotTakenTypeID: "messageScreenshotTaken#a2b86dab", - MessageChatSetBackgroundTypeID: "messageChatSetBackground#3d5d7c40", - MessageChatSetThemeTypeID: "messageChatSetTheme#99ae9408", - MessageChatSetMessageAutoDeleteTimeTypeID: "messageChatSetMessageAutoDeleteTime#619e052e", - MessageChatBoostTypeID: "messageChatBoost#5e5f658b", - MessageForumTopicCreatedTypeID: "messageForumTopicCreated#b8ce47d1", - MessageForumTopicEditedTypeID: "messageForumTopicEdited#c0b780", - MessageForumTopicIsClosedToggledTypeID: "messageForumTopicIsClosedToggled#4b578fe0", - MessageForumTopicIsHiddenToggledTypeID: "messageForumTopicIsHiddenToggled#979393fe", - MessageSuggestProfilePhotoTypeID: "messageSuggestProfilePhoto#b5611ee7", - MessageCustomServiceActionTypeID: "messageCustomServiceAction#5595c772", - MessageGameScoreTypeID: "messageGameScore#50299d7f", - MessagePaymentSuccessfulTypeID: "messagePaymentSuccessful#3e661911", - MessagePaymentSuccessfulBotTypeID: "messagePaymentSuccessfulBot#c7664dbf", - MessagePaymentRefundedTypeID: "messagePaymentRefunded#11bcb8f3", - MessageGiftedPremiumTypeID: "messageGiftedPremium#e4d0e07a", - MessagePremiumGiftCodeTypeID: "messagePremiumGiftCode#29d22e4e", - MessageGiveawayCreatedTypeID: "messageGiveawayCreated#39f3639f", - MessageGiveawayTypeID: "messageGiveaway#eb61daa8", - MessageGiveawayCompletedTypeID: "messageGiveawayCompleted#e424c8f7", - MessageGiveawayWinnersTypeID: "messageGiveawayWinners#1d99a27a", - MessageGiftedStarsTypeID: "messageGiftedStars#41bdbea7", - MessageGiveawayPrizeStarsTypeID: "messageGiveawayPrizeStars#aa0f5de3", - MessageGiftTypeID: "messageGift#621a3876", - MessageUpgradedGiftTypeID: "messageUpgradedGift#4932f215", - MessageRefundedUpgradedGiftTypeID: "messageRefundedUpgradedGift#d373886d", - MessageContactRegisteredTypeID: "messageContactRegistered#a678fcff", - MessageUsersSharedTypeID: "messageUsersShared#7f1f4a22", - MessageChatSharedTypeID: "messageChatShared#aec6d961", - MessageBotWriteAccessAllowedTypeID: "messageBotWriteAccessAllowed#9a8ab7b4", - MessageWebAppDataSentTypeID: "messageWebAppDataSent#fb033912", - MessageWebAppDataReceivedTypeID: "messageWebAppDataReceived#ff7d1a15", - MessagePassportDataSentTypeID: "messagePassportDataSent#26c5ed6b", - MessagePassportDataReceivedTypeID: "messagePassportDataReceived#e0b936b9", - MessageProximityAlertTriggeredTypeID: "messageProximityAlertTriggered#409f6d3", - MessageUnsupportedTypeID: "messageUnsupported#93b6f585", - TextEntityTypeMentionTypeID: "textEntityTypeMention#37b3df65", - TextEntityTypeHashtagTypeID: "textEntityTypeHashtag#c2f7a2dd", - TextEntityTypeCashtagTypeID: "textEntityTypeCashtag#48e4374b", - TextEntityTypeBotCommandTypeID: "textEntityTypeBotCommand#bb652bb3", - TextEntityTypeURLTypeID: "textEntityTypeUrl#b1c0d47c", - TextEntityTypeEmailAddressTypeID: "textEntityTypeEmailAddress#54f81821", - TextEntityTypePhoneNumberTypeID: "textEntityTypePhoneNumber#bad9aa2a", - TextEntityTypeBankCardNumberTypeID: "textEntityTypeBankCardNumber#6513910", - TextEntityTypeBoldTypeID: "textEntityTypeBold#bcc0e1b0", - TextEntityTypeItalicTypeID: "textEntityTypeItalic#f8f3965d", - TextEntityTypeUnderlineTypeID: "textEntityTypeUnderline#2f39cf92", - TextEntityTypeStrikethroughTypeID: "textEntityTypeStrikethrough#394fc4fa", - TextEntityTypeSpoilerTypeID: "textEntityTypeSpoiler#206d15bb", - TextEntityTypeCodeTypeID: "textEntityTypeCode#c5e9c94a", - TextEntityTypePreTypeID: "textEntityTypePre#62491c8e", - TextEntityTypePreCodeTypeID: "textEntityTypePreCode#c7a77aab", - TextEntityTypeBlockQuoteTypeID: "textEntityTypeBlockQuote#c42830c8", - TextEntityTypeExpandableBlockQuoteTypeID: "textEntityTypeExpandableBlockQuote#22e0c65", - TextEntityTypeTextURLTypeID: "textEntityTypeTextUrl#1a912463", - TextEntityTypeMentionNameTypeID: "textEntityTypeMentionName#a25cd5af", - TextEntityTypeCustomEmojiTypeID: "textEntityTypeCustomEmoji#66ceacc5", - TextEntityTypeMediaTimestampTypeID: "textEntityTypeMediaTimestamp#9236da10", - InputThumbnailTypeID: "inputThumbnail#5e515024", - InputPaidMediaTypePhotoTypeID: "inputPaidMediaTypePhoto#d299fd1a", - InputPaidMediaTypeVideoTypeID: "inputPaidMediaTypeVideo#b053f9fc", - InputPaidMediaTypeID: "inputPaidMedia#19f0fc79", - MessageSchedulingStateSendAtDateTypeID: "messageSchedulingStateSendAtDate#a773ffe7", - MessageSchedulingStateSendWhenOnlineTypeID: "messageSchedulingStateSendWhenOnline#7cbfd808", - MessageSchedulingStateSendWhenVideoProcessedTypeID: "messageSchedulingStateSendWhenVideoProcessed#7d438bee", - MessageSelfDestructTypeTimerTypeID: "messageSelfDestructTypeTimer#508d57cd", - MessageSelfDestructTypeImmediatelyTypeID: "messageSelfDestructTypeImmediately#c23c9005", - MessageSendOptionsTypeID: "messageSendOptions#2e463a4a", - MessageCopyOptionsTypeID: "messageCopyOptions#405c03ba", - InputMessageTextTypeID: "inputMessageText#f350d894", - InputMessageAnimationTypeID: "inputMessageAnimation#19fe563", - InputMessageAudioTypeID: "inputMessageAudio#daa400b2", - InputMessageDocumentTypeID: "inputMessageDocument#615b72b9", - InputMessagePaidMediaTypeID: "inputMessagePaidMedia#370c4490", - InputMessagePhotoTypeID: "inputMessagePhoto#bc78dbcc", - InputMessageStickerTypeID: "inputMessageSticker#3ff1b6f9", - InputMessageVideoTypeID: "inputMessageVideo#1a64cc26", - InputMessageVideoNoteTypeID: "inputMessageVideoNote#d56816dd", - InputMessageVoiceNoteTypeID: "inputMessageVoiceNote#5723ffac", - InputMessageLocationTypeID: "inputMessageLocation#26aae970", - InputMessageVenueTypeID: "inputMessageVenue#564d99fd", - InputMessageContactTypeID: "inputMessageContact#c5710cff", - InputMessageDiceTypeID: "inputMessageDice#322967a9", - InputMessageGameTypeID: "inputMessageGame#4aae6ae2", - InputMessageInvoiceTypeID: "inputMessageInvoice#babc8f71", - InputMessagePollTypeID: "inputMessagePoll#9046c716", - InputMessageStoryTypeID: "inputMessageStory#21099d63", - InputMessageForwardedTypeID: "inputMessageForwarded#651a73f8", - MessagePropertiesTypeID: "messageProperties#fe63ca01", - SearchMessagesFilterEmptyTypeID: "searchMessagesFilterEmpty#cc2e1337", - SearchMessagesFilterAnimationTypeID: "searchMessagesFilterAnimation#f6b800c5", - SearchMessagesFilterAudioTypeID: "searchMessagesFilterAudio#33b5147b", - SearchMessagesFilterDocumentTypeID: "searchMessagesFilterDocument#5af9f74f", - SearchMessagesFilterPhotoTypeID: "searchMessagesFilterPhoto#37309b05", - SearchMessagesFilterVideoTypeID: "searchMessagesFilterVideo#6e2f92e", - SearchMessagesFilterVoiceNoteTypeID: "searchMessagesFilterVoiceNote#6dc2227d", - SearchMessagesFilterPhotoAndVideoTypeID: "searchMessagesFilterPhotoAndVideo#5097e193", - SearchMessagesFilterURLTypeID: "searchMessagesFilterUrl#92ffe18b", - SearchMessagesFilterChatPhotoTypeID: "searchMessagesFilterChatPhoto#b5a0d35f", - SearchMessagesFilterVideoNoteTypeID: "searchMessagesFilterVideoNote#21a2e3f9", - SearchMessagesFilterVoiceAndVideoNoteTypeID: "searchMessagesFilterVoiceAndVideoNote#279680e3", - SearchMessagesFilterMentionTypeID: "searchMessagesFilterMention#7748c89c", - SearchMessagesFilterUnreadMentionTypeID: "searchMessagesFilterUnreadMention#fa4aadc3", - SearchMessagesFilterUnreadReactionTypeID: "searchMessagesFilterUnreadReaction#adc43100", - SearchMessagesFilterFailedToSendTypeID: "searchMessagesFilterFailedToSend#dc74d6fc", - SearchMessagesFilterPinnedTypeID: "searchMessagesFilterPinned#16294d48", - SearchMessagesChatTypeFilterPrivateTypeID: "searchMessagesChatTypeFilterPrivate#45b152cf", - SearchMessagesChatTypeFilterGroupTypeID: "searchMessagesChatTypeFilterGroup#853fa71a", - SearchMessagesChatTypeFilterChannelTypeID: "searchMessagesChatTypeFilterChannel#d1e4b6d5", - ChatActionTypingTypeID: "chatActionTyping#16a83437", - ChatActionRecordingVideoTypeID: "chatActionRecordingVideo#ce85792", - ChatActionUploadingVideoTypeID: "chatActionUploadingVideo#49902c36", - ChatActionRecordingVoiceNoteTypeID: "chatActionRecordingVoiceNote#cfc9ed76", - ChatActionUploadingVoiceNoteTypeID: "chatActionUploadingVoiceNote#db6c8a6e", - ChatActionUploadingPhotoTypeID: "chatActionUploadingPhoto#26feeb47", - ChatActionUploadingDocumentTypeID: "chatActionUploadingDocument#a01b64a", - ChatActionChoosingStickerTypeID: "chatActionChoosingSticker#1637c521", - ChatActionChoosingLocationTypeID: "chatActionChoosingLocation#87b96324", - ChatActionChoosingContactTypeID: "chatActionChoosingContact#b7220418", - ChatActionStartPlayingGameTypeID: "chatActionStartPlayingGame#cc63a7fc", - ChatActionRecordingVideoNoteTypeID: "chatActionRecordingVideoNote#fc2081", - ChatActionUploadingVideoNoteTypeID: "chatActionUploadingVideoNote#45e0de76", - ChatActionWatchingAnimationsTypeID: "chatActionWatchingAnimations#7a5e26b1", - ChatActionCancelTypeID: "chatActionCancel#452c30b6", - UserStatusEmptyTypeID: "userStatusEmpty#9d05049", - UserStatusOnlineTypeID: "userStatusOnline#a4d64774", - UserStatusOfflineTypeID: "userStatusOffline#d2b38d05", - UserStatusRecentlyTypeID: "userStatusRecently#faa60b5", - UserStatusLastWeekTypeID: "userStatusLastWeek#12801b57", - UserStatusLastMonthTypeID: "userStatusLastMonth#b8cb29fc", - EmojiKeywordTypeID: "emojiKeyword#821912df", - EmojiKeywordsTypeID: "emojiKeywords#de023f4", - StickersTypeID: "stickers#83491d00", - EmojisTypeID: "emojis#77274a16", - StickerSetTypeID: "stickerSet#e3b8a114", - StickerSetInfoTypeID: "stickerSetInfo#58991994", - StickerSetsTypeID: "stickerSets#b8a6490d", - TrendingStickerSetsTypeID: "trendingStickerSets#298f12cc", - EmojiCategorySourceSearchTypeID: "emojiCategorySourceSearch#5e126d32", - EmojiCategorySourcePremiumTypeID: "emojiCategorySourcePremium#8cd28d0c", - EmojiCategoryTypeID: "emojiCategory#220de4ef", - EmojiCategoriesTypeID: "emojiCategories#c680f27a", - EmojiCategoryTypeDefaultTypeID: "emojiCategoryTypeDefault#46db626b", - EmojiCategoryTypeRegularStickersTypeID: "emojiCategoryTypeRegularStickers#b04799d2", - EmojiCategoryTypeEmojiStatusTypeID: "emojiCategoryTypeEmojiStatus#5254b347", - EmojiCategoryTypeChatPhotoTypeID: "emojiCategoryTypeChatPhoto#3f200529", - CurrentWeatherTypeID: "currentWeather#eacea8c0", - StoryAreaPositionTypeID: "storyAreaPosition#a49fec6c", - StoryAreaTypeLocationTypeID: "storyAreaTypeLocation#a8b3caa3", - StoryAreaTypeVenueTypeID: "storyAreaTypeVenue#18ae4d06", - StoryAreaTypeSuggestedReactionTypeID: "storyAreaTypeSuggestedReaction#f95f927c", - StoryAreaTypeMessageTypeID: "storyAreaTypeMessage#bfef76b4", - StoryAreaTypeLinkTypeID: "storyAreaTypeLink#f8626185", - StoryAreaTypeWeatherTypeID: "storyAreaTypeWeather#a6587dbe", - StoryAreaTypeID: "storyArea#c9ff075e", - InputStoryAreaTypeLocationTypeID: "inputStoryAreaTypeLocation#aa8b3f39", - InputStoryAreaTypeFoundVenueTypeID: "inputStoryAreaTypeFoundVenue#accda496", - InputStoryAreaTypePreviousVenueTypeID: "inputStoryAreaTypePreviousVenue#6e124e0c", - InputStoryAreaTypeSuggestedReactionTypeID: "inputStoryAreaTypeSuggestedReaction#7d4751d3", - InputStoryAreaTypeMessageTypeID: "inputStoryAreaTypeMessage#f01be457", - InputStoryAreaTypeLinkTypeID: "inputStoryAreaTypeLink#53f31b48", - InputStoryAreaTypeWeatherTypeID: "inputStoryAreaTypeWeather#b7b7de9d", - InputStoryAreaTypeID: "inputStoryArea#752ae7f", - InputStoryAreasTypeID: "inputStoryAreas#b8ba29fe", - StoryVideoTypeID: "storyVideo#562b0a45", - StoryContentPhotoTypeID: "storyContentPhoto#d45f0050", - StoryContentVideoTypeID: "storyContentVideo#b30162a6", - StoryContentUnsupportedTypeID: "storyContentUnsupported#86c7f56e", - InputStoryContentPhotoTypeID: "inputStoryContentPhoto#3286fbe0", - InputStoryContentVideoTypeID: "inputStoryContentVideo#cc1e4239", - StoryListMainTypeID: "storyListMain#d7eeb3ff", - StoryListArchiveTypeID: "storyListArchive#fd80a741", - StoryOriginPublicStoryTypeID: "storyOriginPublicStory#2c379fbe", - StoryOriginHiddenUserTypeID: "storyOriginHiddenUser#5a1f89ec", - StoryRepostInfoTypeID: "storyRepostInfo#ff7fa440", - StoryInteractionInfoTypeID: "storyInteractionInfo#e1557fc7", - StoryTypeID: "story#84cdc9d1", - StoriesTypeID: "stories#b88ff8ff", - FoundStoriesTypeID: "foundStories#854b067c", - StoryFullIDTypeID: "storyFullId#701d31f5", - StoryInfoTypeID: "storyInfo#8997c352", - ChatActiveStoriesTypeID: "chatActiveStories#d923d773", - StoryInteractionTypeViewTypeID: "storyInteractionTypeView#53e337d0", - StoryInteractionTypeForwardTypeID: "storyInteractionTypeForward#27d23cff", - StoryInteractionTypeRepostTypeID: "storyInteractionTypeRepost#c32279c4", - StoryInteractionTypeID: "storyInteraction#d624d222", - StoryInteractionsTypeID: "storyInteractions#f9f5d50f", - QuickReplyMessageTypeID: "quickReplyMessage#bef92f03", - QuickReplyMessagesTypeID: "quickReplyMessages#8426549b", - QuickReplyShortcutTypeID: "quickReplyShortcut#bdfd9a95", - PublicForwardMessageTypeID: "publicForwardMessage#317b3d2", - PublicForwardStoryTypeID: "publicForwardStory#7fdf26af", - PublicForwardsTypeID: "publicForwards#3ed29447", - BotMediaPreviewTypeID: "botMediaPreview#9eb59ce8", - BotMediaPreviewsTypeID: "botMediaPreviews#f1b8f27d", - BotMediaPreviewInfoTypeID: "botMediaPreviewInfo#e49169db", - ChatBoostLevelFeaturesTypeID: "chatBoostLevelFeatures#f4b51914", - ChatBoostFeaturesTypeID: "chatBoostFeatures#803214be", - ChatBoostSourceGiftCodeTypeID: "chatBoostSourceGiftCode#fa2412ba", - ChatBoostSourceGiveawayTypeID: "chatBoostSourceGiveaway#7254949a", - ChatBoostSourcePremiumTypeID: "chatBoostSourcePremium#ed4eb", - PrepaidGiveawayTypeID: "prepaidGiveaway#ef70338f", - ChatBoostStatusTypeID: "chatBoostStatus#401e753c", - ChatBoostTypeID: "chatBoost#96bfccb2", - FoundChatBoostsTypeID: "foundChatBoosts#dc80d52e", - ChatBoostSlotTypeID: "chatBoostSlot#757fac7", - ChatBoostSlotsTypeID: "chatBoostSlots#6859c79", - ResendCodeReasonUserRequestTypeID: "resendCodeReasonUserRequest#e5a8c880", - ResendCodeReasonVerificationFailedTypeID: "resendCodeReasonVerificationFailed#1f952dc1", - CallDiscardReasonEmptyTypeID: "callDiscardReasonEmpty#b4f66fc3", - CallDiscardReasonMissedTypeID: "callDiscardReasonMissed#64283a7c", - CallDiscardReasonDeclinedTypeID: "callDiscardReasonDeclined#98e36c32", - CallDiscardReasonDisconnectedTypeID: "callDiscardReasonDisconnected#aff563a2", - CallDiscardReasonHungUpTypeID: "callDiscardReasonHungUp#1a1ea5e6", - CallDiscardReasonAllowGroupCallTypeID: "callDiscardReasonAllowGroupCall#af177fd5", - CallProtocolTypeID: "callProtocol#a9a037e", - CallServerTypeTelegramReflectorTypeID: "callServerTypeTelegramReflector#32af3515", - CallServerTypeWebrtcTypeID: "callServerTypeWebrtc#4a8afd65", - CallServerTypeID: "callServer#6f37df97", - CallIDTypeID: "callId#3eac609", - GroupCallIDTypeID: "groupCallId#14e4bb45", - CallStatePendingTypeID: "callStatePending#3ff56c2c", - CallStateExchangingKeysTypeID: "callStateExchangingKeys#91d77a65", - CallStateReadyTypeID: "callStateReady#17038381", - CallStateHangingUpTypeID: "callStateHangingUp#80d0f2aa", - CallStateDiscardedTypeID: "callStateDiscarded#531b7c45", - CallStateErrorTypeID: "callStateError#c5df6495", - GroupCallVideoQualityThumbnailTypeID: "groupCallVideoQualityThumbnail#e9661380", - GroupCallVideoQualityMediumTypeID: "groupCallVideoQualityMedium#178abcaa", - GroupCallVideoQualityFullTypeID: "groupCallVideoQualityFull#81491637", - GroupCallStreamTypeID: "groupCallStream#f03b0fc5", - GroupCallStreamsTypeID: "groupCallStreams#c89191b", - RtmpURLTypeID: "rtmpUrl#3c28bc55", - GroupCallRecentSpeakerTypeID: "groupCallRecentSpeaker#6c73a9cc", - GroupCallTypeID: "groupCall#9ac55fff", - GroupCallVideoSourceGroupTypeID: "groupCallVideoSourceGroup#4ef8a4af", - GroupCallParticipantVideoInfoTypeID: "groupCallParticipantVideoInfo#70f7eff6", - GroupCallParticipantTypeID: "groupCallParticipant#7abca1eb", - CallProblemEchoTypeID: "callProblemEcho#2fc01184", - CallProblemNoiseTypeID: "callProblemNoise#3ec4808f", - CallProblemInterruptionsTypeID: "callProblemInterruptions#42ba1c62", - CallProblemDistortedSpeechTypeID: "callProblemDistortedSpeech#16a5bd05", - CallProblemSilentLocalTypeID: "callProblemSilentLocal#f1e6f36", - CallProblemSilentRemoteTypeID: "callProblemSilentRemote#2230f89a", - CallProblemDroppedTypeID: "callProblemDropped#b809e381", - CallProblemDistortedVideoTypeID: "callProblemDistortedVideo#16f6620a", - CallProblemPixelatedVideoTypeID: "callProblemPixelatedVideo#7e1526d3", - CallTypeID: "call#9e0dd8aa", - FirebaseAuthenticationSettingsAndroidTypeID: "firebaseAuthenticationSettingsAndroid#966ef61c", - FirebaseAuthenticationSettingsIosTypeID: "firebaseAuthenticationSettingsIos#d49a4c4", - PhoneNumberAuthenticationSettingsTypeID: "phoneNumberAuthenticationSettings#3e1183db", - AddedReactionTypeID: "addedReaction#4b04819d", - AddedReactionsTypeID: "addedReactions#77bf7590", - AvailableReactionTypeID: "availableReaction#f9024387", - AvailableReactionsTypeID: "availableReactions#3596f453", - EmojiReactionTypeID: "emojiReaction#60532c5f", - ReactionUnavailabilityReasonAnonymousAdministratorTypeID: "reactionUnavailabilityReasonAnonymousAdministrator#e23883fb", - ReactionUnavailabilityReasonGuestTypeID: "reactionUnavailabilityReasonGuest#50ef5244", - AnimationsTypeID: "animations#2ce4157c", - DiceStickersRegularTypeID: "diceStickersRegular#d3dfecce", - DiceStickersSlotMachineTypeID: "diceStickersSlotMachine#e9a28cac", - ImportedContactsTypeID: "importedContacts#1119a03e", - SpeechRecognitionResultPendingTypeID: "speechRecognitionResultPending#9ebc8e00", - SpeechRecognitionResultTextTypeID: "speechRecognitionResultText#80e681dd", - SpeechRecognitionResultErrorTypeID: "speechRecognitionResultError#9d243fc", - BusinessConnectionTypeID: "businessConnection#4436e234", - AttachmentMenuBotColorTypeID: "attachmentMenuBotColor#64235ebc", - AttachmentMenuBotTypeID: "attachmentMenuBot#b96e1bbf", - SentWebAppMessageTypeID: "sentWebAppMessage#4a24eec0", - BotWriteAccessAllowReasonConnectedWebsiteTypeID: "botWriteAccessAllowReasonConnectedWebsite#782eafe3", - BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID: "botWriteAccessAllowReasonAddedToAttachmentMenu#828b5f9d", - BotWriteAccessAllowReasonLaunchedWebAppTypeID: "botWriteAccessAllowReasonLaunchedWebApp#f1a504d7", - BotWriteAccessAllowReasonAcceptedRequestTypeID: "botWriteAccessAllowReasonAcceptedRequest#89c63bfc", - HTTPURLTypeID: "httpUrl#87b775a6", - UserLinkTypeID: "userLink#1db0fef8", - TargetChatTypesTypeID: "targetChatTypes#5a300e51", - TargetChatCurrentTypeID: "targetChatCurrent#e729d110", - TargetChatChosenTypeID: "targetChatChosen#acf8d5a6", - TargetChatInternalLinkTypeID: "targetChatInternalLink#dd788fe0", - InputInlineQueryResultAnimationTypeID: "inputInlineQueryResultAnimation#a7335216", - InputInlineQueryResultArticleTypeID: "inputInlineQueryResultArticle#763583bc", - InputInlineQueryResultAudioTypeID: "inputInlineQueryResultAudio#4b1c35d4", - InputInlineQueryResultContactTypeID: "inputInlineQueryResultContact#6e08b5d2", - InputInlineQueryResultDocumentTypeID: "inputInlineQueryResultDocument#227fd0cd", - InputInlineQueryResultGameTypeID: "inputInlineQueryResultGame#39951fd7", - InputInlineQueryResultLocationTypeID: "inputInlineQueryResultLocation#8f7cbe56", - InputInlineQueryResultPhotoTypeID: "inputInlineQueryResultPhoto#bd0b361f", - InputInlineQueryResultStickerTypeID: "inputInlineQueryResultSticker#10550459", - InputInlineQueryResultVenueTypeID: "inputInlineQueryResultVenue#2049c13d", - InputInlineQueryResultVideoTypeID: "inputInlineQueryResultVideo#66c344e7", - InputInlineQueryResultVoiceNoteTypeID: "inputInlineQueryResultVoiceNote#954da949", - InlineQueryResultArticleTypeID: "inlineQueryResultArticle#1016d01a", - InlineQueryResultContactTypeID: "inlineQueryResultContact#f5278212", - InlineQueryResultLocationTypeID: "inlineQueryResultLocation#1bc6ab10", - InlineQueryResultVenueTypeID: "inlineQueryResultVenue#4c5b105e", - InlineQueryResultGameTypeID: "inlineQueryResultGame#65bd7c7b", - InlineQueryResultAnimationTypeID: "inlineQueryResultAnimation#77cded0b", - InlineQueryResultAudioTypeID: "inlineQueryResultAudio#3239d2f8", - InlineQueryResultDocumentTypeID: "inlineQueryResultDocument#a71d0c45", - InlineQueryResultPhotoTypeID: "inlineQueryResultPhoto#6e2b1dd0", - InlineQueryResultStickerTypeID: "inlineQueryResultSticker#91d6560b", - InlineQueryResultVideoTypeID: "inlineQueryResultVideo#ae2742e5", - InlineQueryResultVoiceNoteTypeID: "inlineQueryResultVoiceNote#8ee8142f", - InlineQueryResultsButtonTypeStartBotTypeID: "inlineQueryResultsButtonTypeStartBot#fe9af0d5", - InlineQueryResultsButtonTypeWebAppTypeID: "inlineQueryResultsButtonTypeWebApp#b8a16362", - InlineQueryResultsButtonTypeID: "inlineQueryResultsButton#d0df08ae", - InlineQueryResultsTypeID: "inlineQueryResults#ffd17579", - PreparedInlineMessageIDTypeID: "preparedInlineMessageId#380d9be4", - PreparedInlineMessageTypeID: "preparedInlineMessage#942e7cc2", - CallbackQueryPayloadDataTypeID: "callbackQueryPayloadData#8a1e3c66", - CallbackQueryPayloadDataWithPasswordTypeID: "callbackQueryPayloadDataWithPassword#4fe2d8f2", - CallbackQueryPayloadGameTypeID: "callbackQueryPayloadGame#4db2ec38", - CallbackQueryAnswerTypeID: "callbackQueryAnswer#1582685d", - CustomRequestResultTypeID: "customRequestResult#88326ffc", - GameHighScoreTypeID: "gameHighScore#146fcf1e", - GameHighScoresTypeID: "gameHighScores#6d4cd30d", - ChatEventMessageEditedTypeID: "chatEventMessageEdited#e64ff5f8", - ChatEventMessageDeletedTypeID: "chatEventMessageDeleted#37bfcd73", - ChatEventMessagePinnedTypeID: "chatEventMessagePinned#1a26ad1a", - ChatEventMessageUnpinnedTypeID: "chatEventMessageUnpinned#e9943b17", - ChatEventPollStoppedTypeID: "chatEventPollStopped#77cc8be5", - ChatEventMemberJoinedTypeID: "chatEventMemberJoined#f1f70924", - ChatEventMemberJoinedByInviteLinkTypeID: "chatEventMemberJoinedByInviteLink#a9d6dd7a", - ChatEventMemberJoinedByRequestTypeID: "chatEventMemberJoinedByRequest#9dc87e3f", - ChatEventMemberInvitedTypeID: "chatEventMemberInvited#38d7bfc9", - ChatEventMemberLeftTypeID: "chatEventMemberLeft#c778400f", - ChatEventMemberPromotedTypeID: "chatEventMemberPromoted#1f4f6861", - ChatEventMemberRestrictedTypeID: "chatEventMemberRestricted#5f951e05", - ChatEventMemberSubscriptionExtendedTypeID: "chatEventMemberSubscriptionExtended#bbfab002", - ChatEventAvailableReactionsChangedTypeID: "chatEventAvailableReactionsChanged#97b8e0bf", - ChatEventBackgroundChangedTypeID: "chatEventBackgroundChanged#b6ed6d38", - ChatEventDescriptionChangedTypeID: "chatEventDescriptionChanged#254cf1e", - ChatEventEmojiStatusChangedTypeID: "chatEventEmojiStatusChanged#83e97b1e", - ChatEventLinkedChatChangedTypeID: "chatEventLinkedChatChanged#6b2271af", - ChatEventLocationChangedTypeID: "chatEventLocationChanged#e7cdfd4e", - ChatEventMessageAutoDeleteTimeChangedTypeID: "chatEventMessageAutoDeleteTimeChanged#1083f24", - ChatEventPermissionsChangedTypeID: "chatEventPermissionsChanged#b1d337a8", - ChatEventPhotoChangedTypeID: "chatEventPhotoChanged#cfa062c3", - ChatEventSlowModeDelayChangedTypeID: "chatEventSlowModeDelayChanged#9d763c0b", - ChatEventStickerSetChangedTypeID: "chatEventStickerSetChanged#b5e7558f", - ChatEventCustomEmojiStickerSetChangedTypeID: "chatEventCustomEmojiStickerSetChanged#70c431b", - ChatEventTitleChangedTypeID: "chatEventTitleChanged#43990ad2", - ChatEventUsernameChangedTypeID: "chatEventUsernameChanged#6707b56b", - ChatEventActiveUsernamesChangedTypeID: "chatEventActiveUsernamesChanged#95e54656", - ChatEventAccentColorChangedTypeID: "chatEventAccentColorChanged#e6837733", - ChatEventProfileAccentColorChangedTypeID: "chatEventProfileAccentColorChanged#a5b8da64", - ChatEventHasProtectedContentToggledTypeID: "chatEventHasProtectedContentToggled#f5044201", - ChatEventInvitesToggledTypeID: "chatEventInvitesToggled#fc45966b", - ChatEventIsAllHistoryAvailableToggledTypeID: "chatEventIsAllHistoryAvailableToggled#a0b03c15", - ChatEventHasAggressiveAntiSpamEnabledToggledTypeID: "chatEventHasAggressiveAntiSpamEnabledToggled#f8875702", - ChatEventSignMessagesToggledTypeID: "chatEventSignMessagesToggled#b1b9281e", - ChatEventShowMessageSenderToggledTypeID: "chatEventShowMessageSenderToggled#d0a747e3", - ChatEventInviteLinkEditedTypeID: "chatEventInviteLinkEdited#e4920d62", - ChatEventInviteLinkRevokedTypeID: "chatEventInviteLinkRevoked#a1dbffe3", - ChatEventInviteLinkDeletedTypeID: "chatEventInviteLinkDeleted#acda6167", - ChatEventVideoChatCreatedTypeID: "chatEventVideoChatCreated#6ca68a7b", - ChatEventVideoChatEndedTypeID: "chatEventVideoChatEnded#61286c48", - ChatEventVideoChatMuteNewParticipantsToggledTypeID: "chatEventVideoChatMuteNewParticipantsToggled#f87507fe", - ChatEventVideoChatParticipantIsMutedToggledTypeID: "chatEventVideoChatParticipantIsMutedToggled#1f1058f7", - ChatEventVideoChatParticipantVolumeLevelChangedTypeID: "chatEventVideoChatParticipantVolumeLevelChanged#436f92be", - ChatEventIsForumToggledTypeID: "chatEventIsForumToggled#5a63d119", - ChatEventForumTopicCreatedTypeID: "chatEventForumTopicCreated#7785fb42", - ChatEventForumTopicEditedTypeID: "chatEventForumTopicEdited#60da2c0c", - ChatEventForumTopicToggleIsClosedTypeID: "chatEventForumTopicToggleIsClosed#c69e4d3a", - ChatEventForumTopicToggleIsHiddenTypeID: "chatEventForumTopicToggleIsHidden#a015ef2e", - ChatEventForumTopicDeletedTypeID: "chatEventForumTopicDeleted#b08f290d", - ChatEventForumTopicPinnedTypeID: "chatEventForumTopicPinned#7fc523ee", - ChatEventTypeID: "chatEvent#d921b3d0", - ChatEventsTypeID: "chatEvents#d73ecdc4", - ChatEventLogFiltersTypeID: "chatEventLogFilters#c26e31b1", - LanguagePackStringValueOrdinaryTypeID: "languagePackStringValueOrdinary#f124a660", - LanguagePackStringValuePluralizedTypeID: "languagePackStringValuePluralized#71a812c5", - LanguagePackStringValueDeletedTypeID: "languagePackStringValueDeleted#6d5cb6fa", - LanguagePackStringTypeID: "languagePackString#4df0e460", - LanguagePackStringsTypeID: "languagePackStrings#4aa681ef", - LanguagePackInfoTypeID: "languagePackInfo#20514f5a", - LocalizationTargetInfoTypeID: "localizationTargetInfo#2ca3903b", - PremiumLimitTypeSupergroupCountTypeID: "premiumLimitTypeSupergroupCount#f13ff385", - PremiumLimitTypePinnedChatCountTypeID: "premiumLimitTypePinnedChatCount#c47543e1", - PremiumLimitTypeCreatedPublicChatCountTypeID: "premiumLimitTypeCreatedPublicChatCount#1a96beb9", - PremiumLimitTypeSavedAnimationCountTypeID: "premiumLimitTypeSavedAnimationCount#fed27d89", - PremiumLimitTypeFavoriteStickerCountTypeID: "premiumLimitTypeFavoriteStickerCount#2621e223", - PremiumLimitTypeChatFolderCountTypeID: "premiumLimitTypeChatFolderCount#1680096e", - PremiumLimitTypeChatFolderChosenChatCountTypeID: "premiumLimitTypeChatFolderChosenChatCount#64d14355", - PremiumLimitTypePinnedArchivedChatCountTypeID: "premiumLimitTypePinnedArchivedChatCount#588b2a0c", - PremiumLimitTypePinnedSavedMessagesTopicCountTypeID: "premiumLimitTypePinnedSavedMessagesTopicCount#a3eb64df", - PremiumLimitTypeCaptionLengthTypeID: "premiumLimitTypeCaptionLength#1185d83a", - PremiumLimitTypeBioLengthTypeID: "premiumLimitTypeBioLength#bba28603", - PremiumLimitTypeChatFolderInviteLinkCountTypeID: "premiumLimitTypeChatFolderInviteLinkCount#f854261a", - PremiumLimitTypeShareableChatFolderCountTypeID: "premiumLimitTypeShareableChatFolderCount#601eb4c7", - PremiumLimitTypeActiveStoryCountTypeID: "premiumLimitTypeActiveStoryCount#8d2c269c", - PremiumLimitTypeWeeklySentStoryCountTypeID: "premiumLimitTypeWeeklySentStoryCount#269c34b", - PremiumLimitTypeMonthlySentStoryCountTypeID: "premiumLimitTypeMonthlySentStoryCount#30d84b83", - PremiumLimitTypeStoryCaptionLengthTypeID: "premiumLimitTypeStoryCaptionLength#bed53302", - PremiumLimitTypeStorySuggestedReactionAreaCountTypeID: "premiumLimitTypeStorySuggestedReactionAreaCount#ba42b807", - PremiumLimitTypeSimilarChatCountTypeID: "premiumLimitTypeSimilarChatCount#a2ce1f11", - PremiumFeatureIncreasedLimitsTypeID: "premiumFeatureIncreasedLimits#6a6be1b7", - PremiumFeatureIncreasedUploadFileSizeTypeID: "premiumFeatureIncreasedUploadFileSize#6ccce473", - PremiumFeatureImprovedDownloadSpeedTypeID: "premiumFeatureImprovedDownloadSpeed#f00b4a3e", - PremiumFeatureVoiceRecognitionTypeID: "premiumFeatureVoiceRecognition#4cc89fde", - PremiumFeatureDisabledAdsTypeID: "premiumFeatureDisabledAds#8847624a", - PremiumFeatureUniqueReactionsTypeID: "premiumFeatureUniqueReactions#2db3b017", - PremiumFeatureUniqueStickersTypeID: "premiumFeatureUniqueStickers#82b97c00", - PremiumFeatureCustomEmojiTypeID: "premiumFeatureCustomEmoji#4f6ddb4c", - PremiumFeatureAdvancedChatManagementTypeID: "premiumFeatureAdvancedChatManagement#2f774d1a", - PremiumFeatureProfileBadgeTypeID: "premiumFeatureProfileBadge#ded30c2", - PremiumFeatureEmojiStatusTypeID: "premiumFeatureEmojiStatus#fdd2cce1", - PremiumFeatureAnimatedProfilePhotoTypeID: "premiumFeatureAnimatedProfilePhoto#f9fecce6", - PremiumFeatureForumTopicIconTypeID: "premiumFeatureForumTopicIcon#ceef6342", - PremiumFeatureAppIconsTypeID: "premiumFeatureAppIcons#5e79f489", - PremiumFeatureRealTimeChatTranslationTypeID: "premiumFeatureRealTimeChatTranslation#bbd80280", - PremiumFeatureUpgradedStoriesTypeID: "premiumFeatureUpgradedStories#9008051b", - PremiumFeatureChatBoostTypeID: "premiumFeatureChatBoost#5df89f1b", - PremiumFeatureAccentColorTypeID: "premiumFeatureAccentColor#361ac59e", - PremiumFeatureBackgroundForBothTypeID: "premiumFeatureBackgroundForBoth#2246eefa", - PremiumFeatureSavedMessagesTagsTypeID: "premiumFeatureSavedMessagesTags#3bcbe986", - PremiumFeatureMessagePrivacyTypeID: "premiumFeatureMessagePrivacy#2fd278f6", - PremiumFeatureLastSeenTimesTypeID: "premiumFeatureLastSeenTimes#d2914a8f", - PremiumFeatureBusinessTypeID: "premiumFeatureBusiness#a6609704", - PremiumFeatureMessageEffectsTypeID: "premiumFeatureMessageEffects#d4e35061", - BusinessFeatureLocationTypeID: "businessFeatureLocation#c090027c", - BusinessFeatureOpeningHoursTypeID: "businessFeatureOpeningHours#1b7b22ed", - BusinessFeatureQuickRepliesTypeID: "businessFeatureQuickReplies#9c380a82", - BusinessFeatureGreetingMessageTypeID: "businessFeatureGreetingMessage#6aa87474", - BusinessFeatureAwayMessageTypeID: "businessFeatureAwayMessage#40f9e8dd", - BusinessFeatureAccountLinksTypeID: "businessFeatureAccountLinks#6ffa970e", - BusinessFeatureStartPageTypeID: "businessFeatureStartPage#17edf7e1", - BusinessFeatureBotsTypeID: "businessFeatureBots#106575e5", - BusinessFeatureEmojiStatusTypeID: "businessFeatureEmojiStatus#cd8ec0e5", - BusinessFeatureChatFolderTagsTypeID: "businessFeatureChatFolderTags#df95092a", - BusinessFeatureUpgradedStoriesTypeID: "businessFeatureUpgradedStories#93fb53d2", - PremiumStoryFeaturePriorityOrderTypeID: "premiumStoryFeaturePriorityOrder#8ff172c7", - PremiumStoryFeatureStealthModeTypeID: "premiumStoryFeatureStealthMode#47343da4", - PremiumStoryFeaturePermanentViewsHistoryTypeID: "premiumStoryFeaturePermanentViewsHistory#c2a047a0", - PremiumStoryFeatureCustomExpirationDurationTypeID: "premiumStoryFeatureCustomExpirationDuration#dca40a96", - PremiumStoryFeatureSaveStoriesTypeID: "premiumStoryFeatureSaveStories#a6842fbd", - PremiumStoryFeatureLinksAndFormattingTypeID: "premiumStoryFeatureLinksAndFormatting#dae383f7", - PremiumStoryFeatureVideoQualityTypeID: "premiumStoryFeatureVideoQuality#baafbea9", - PremiumLimitTypeID: "premiumLimit#7ed372e6", - PremiumFeaturesTypeID: "premiumFeatures#4cf10e82", - BusinessFeaturesTypeID: "businessFeatures#e1593e48", - PremiumSourceLimitExceededTypeID: "premiumSourceLimitExceeded#85ae8702", - PremiumSourceFeatureTypeID: "premiumSourceFeature#1a929325", - PremiumSourceBusinessFeatureTypeID: "premiumSourceBusinessFeature#a703725c", - PremiumSourceStoryFeatureTypeID: "premiumSourceStoryFeature#c290316c", - PremiumSourceLinkTypeID: "premiumSourceLink#7f42999c", - PremiumSourceSettingsTypeID: "premiumSourceSettings#eef88535", - PremiumFeaturePromotionAnimationTypeID: "premiumFeaturePromotionAnimation#899dab1c", - BusinessFeaturePromotionAnimationTypeID: "businessFeaturePromotionAnimation#7a05680a", - PremiumStateTypeID: "premiumState#91a8799", - StorePaymentPurposePremiumSubscriptionTypeID: "storePaymentPurposePremiumSubscription#4b558114", - StorePaymentPurposePremiumGiftCodesTypeID: "storePaymentPurposePremiumGiftCodes#1277b01d", - StorePaymentPurposePremiumGiveawayTypeID: "storePaymentPurposePremiumGiveaway#4da47aaa", - StorePaymentPurposeStarGiveawayTypeID: "storePaymentPurposeStarGiveaway#c96d899", - StorePaymentPurposeStarsTypeID: "storePaymentPurposeStars#9480cf14", - StorePaymentPurposeGiftedStarsTypeID: "storePaymentPurposeGiftedStars#3544a624", - TelegramPaymentPurposePremiumGiftCodesTypeID: "telegramPaymentPurposePremiumGiftCodes#b13f14a9", - TelegramPaymentPurposePremiumGiveawayTypeID: "telegramPaymentPurposePremiumGiveaway#d2a7c33f", - TelegramPaymentPurposeStarsTypeID: "telegramPaymentPurposeStars#e273ee52", - TelegramPaymentPurposeGiftedStarsTypeID: "telegramPaymentPurposeGiftedStars#91b68a36", - TelegramPaymentPurposeStarGiveawayTypeID: "telegramPaymentPurposeStarGiveaway#3c79a391", - TelegramPaymentPurposeJoinChatTypeID: "telegramPaymentPurposeJoinChat#8ddd6788", - DeviceTokenFirebaseCloudMessagingTypeID: "deviceTokenFirebaseCloudMessaging#d0714a07", - DeviceTokenApplePushTypeID: "deviceTokenApplePush#17196bc3", - DeviceTokenApplePushVoIPTypeID: "deviceTokenApplePushVoIP#2ff045e9", - DeviceTokenWindowsPushTypeID: "deviceTokenWindowsPush#abed428f", - DeviceTokenMicrosoftPushTypeID: "deviceTokenMicrosoftPush#48f8e04c", - DeviceTokenMicrosoftPushVoIPTypeID: "deviceTokenMicrosoftPushVoIP#d12ca351", - DeviceTokenWebPushTypeID: "deviceTokenWebPush#9affdef7", - DeviceTokenSimplePushTypeID: "deviceTokenSimplePush#2f49a60", - DeviceTokenUbuntuPushTypeID: "deviceTokenUbuntuPush#6a3c0d26", - DeviceTokenBlackBerryPushTypeID: "deviceTokenBlackBerryPush#5cef0102", - DeviceTokenTizenPushTypeID: "deviceTokenTizenPush#aef0da33", - DeviceTokenHuaweiPushTypeID: "deviceTokenHuaweiPush#768f4e26", - PushReceiverIDTypeID: "pushReceiverId#161ddf2c", - BackgroundFillSolidTypeID: "backgroundFillSolid#3c3dbc1d", - BackgroundFillGradientTypeID: "backgroundFillGradient#925ff17f", - BackgroundFillFreeformGradientTypeID: "backgroundFillFreeformGradient#fa31756a", - BackgroundTypeWallpaperTypeID: "backgroundTypeWallpaper#758c4c7b", - BackgroundTypePatternTypeID: "backgroundTypePattern#4ce716fd", - BackgroundTypeFillTypeID: "backgroundTypeFill#3b301c2c", - BackgroundTypeChatThemeTypeID: "backgroundTypeChatTheme#4d7a9752", - InputBackgroundLocalTypeID: "inputBackgroundLocal#97dd74a4", - InputBackgroundRemoteTypeID: "inputBackgroundRemote#ef9c3219", - InputBackgroundPreviousTypeID: "inputBackgroundPrevious#eb06575e", - ChatThemeTypeID: "chatTheme#f9406c39", - TimeZoneTypeID: "timeZone#b919f2dd", - TimeZonesTypeID: "timeZones#7c4881b9", - HashtagsTypeID: "hashtags#6c2c0ae1", - CanSendStoryResultOkTypeID: "canSendStoryResultOk#503cf0fd", - CanSendStoryResultPremiumNeededTypeID: "canSendStoryResultPremiumNeeded#567fde69", - CanSendStoryResultBoostNeededTypeID: "canSendStoryResultBoostNeeded#9e60e92f", - CanSendStoryResultActiveStoryLimitExceededTypeID: "canSendStoryResultActiveStoryLimitExceeded#afd9aad6", - CanSendStoryResultWeeklyLimitExceededTypeID: "canSendStoryResultWeeklyLimitExceeded#1341a0b8", - CanSendStoryResultMonthlyLimitExceededTypeID: "canSendStoryResultMonthlyLimitExceeded#dd8242d5", - CanTransferOwnershipResultOkTypeID: "canTransferOwnershipResultOk#faa48643", - CanTransferOwnershipResultPasswordNeededTypeID: "canTransferOwnershipResultPasswordNeeded#5c4a4adf", - CanTransferOwnershipResultPasswordTooFreshTypeID: "canTransferOwnershipResultPasswordTooFresh#305d9b11", - CanTransferOwnershipResultSessionTooFreshTypeID: "canTransferOwnershipResultSessionTooFresh#3ab0c8e1", - CheckChatUsernameResultOkTypeID: "checkChatUsernameResultOk#a6a7bb5c", - CheckChatUsernameResultUsernameInvalidTypeID: "checkChatUsernameResultUsernameInvalid#da087756", - CheckChatUsernameResultUsernameOccupiedTypeID: "checkChatUsernameResultUsernameOccupied#4ebb3729", - CheckChatUsernameResultUsernamePurchasableTypeID: "checkChatUsernameResultUsernamePurchasable#59ce59", - CheckChatUsernameResultPublicChatsTooManyTypeID: "checkChatUsernameResultPublicChatsTooMany#d8b46c7c", - CheckChatUsernameResultPublicGroupsUnavailableTypeID: "checkChatUsernameResultPublicGroupsUnavailable#fce914d7", - CheckStickerSetNameResultOkTypeID: "checkStickerSetNameResultOk#ac4bf258", - CheckStickerSetNameResultNameInvalidTypeID: "checkStickerSetNameResultNameInvalid#a9bf234", - CheckStickerSetNameResultNameOccupiedTypeID: "checkStickerSetNameResultNameOccupied#3c60dc88", - ResetPasswordResultOkTypeID: "resetPasswordResultOk#acb763f9", - ResetPasswordResultPendingTypeID: "resetPasswordResultPending#4729dc59", - ResetPasswordResultDeclinedTypeID: "resetPasswordResultDeclined#b857e0cb", - MessageFileTypePrivateTypeID: "messageFileTypePrivate#e0e44ed4", - MessageFileTypeGroupTypeID: "messageFileTypeGroup#f2e58f68", - MessageFileTypeUnknownTypeID: "messageFileTypeUnknown#461dbab2", - PushMessageContentHiddenTypeID: "pushMessageContentHidden#ed1bb85c", - PushMessageContentAnimationTypeID: "pushMessageContentAnimation#3da4dfe4", - PushMessageContentAudioTypeID: "pushMessageContentAudio#16be7872", - PushMessageContentContactTypeID: "pushMessageContentContact#ff458a54", - PushMessageContentContactRegisteredTypeID: "pushMessageContentContactRegistered#ede1e5a0", - PushMessageContentDocumentTypeID: "pushMessageContentDocument#e4adae01", - PushMessageContentGameTypeID: "pushMessageContentGame#e14bb91b", - PushMessageContentGameScoreTypeID: "pushMessageContentGameScore#35b8cd88", - PushMessageContentInvoiceTypeID: "pushMessageContentInvoice#98c88bbc", - PushMessageContentLocationTypeID: "pushMessageContentLocation#b33a97b3", - PushMessageContentPaidMediaTypeID: "pushMessageContentPaidMedia#b556e74a", - PushMessageContentPhotoTypeID: "pushMessageContentPhoto#861dc52", - PushMessageContentPollTypeID: "pushMessageContentPoll#fd5a743a", - PushMessageContentPremiumGiftCodeTypeID: "pushMessageContentPremiumGiftCode#18a15025", - PushMessageContentGiveawayTypeID: "pushMessageContentGiveaway#d63e7f8e", - PushMessageContentGiftTypeID: "pushMessageContentGift#84a8cd0b", - PushMessageContentUpgradedGiftTypeID: "pushMessageContentUpgradedGift#99fa0ade", - PushMessageContentScreenshotTakenTypeID: "pushMessageContentScreenshotTaken#cc51ff9", - PushMessageContentStickerTypeID: "pushMessageContentSticker#5c98bdd3", - PushMessageContentStoryTypeID: "pushMessageContentStory#996471c9", - PushMessageContentTextTypeID: "pushMessageContentText#105ddea9", - PushMessageContentVideoTypeID: "pushMessageContentVideo#127ad12f", - PushMessageContentVideoNoteTypeID: "pushMessageContentVideoNote#bd13f97f", - PushMessageContentVoiceNoteTypeID: "pushMessageContentVoiceNote#54cac8b", - PushMessageContentBasicGroupChatCreateTypeID: "pushMessageContentBasicGroupChatCreate#81f1defc", - PushMessageContentChatAddMembersTypeID: "pushMessageContentChatAddMembers#bf337b3a", - PushMessageContentChatChangePhotoTypeID: "pushMessageContentChatChangePhoto#bd96521d", - PushMessageContentChatChangeTitleTypeID: "pushMessageContentChatChangeTitle#8ae1f6a3", - PushMessageContentChatSetBackgroundTypeID: "pushMessageContentChatSetBackground#a72b56e3", - PushMessageContentChatSetThemeTypeID: "pushMessageContentChatSetTheme#a5d3b68", - PushMessageContentChatDeleteMemberTypeID: "pushMessageContentChatDeleteMember#23afa99f", - PushMessageContentChatJoinByLinkTypeID: "pushMessageContentChatJoinByLink#5c9bdf49", - PushMessageContentChatJoinByRequestTypeID: "pushMessageContentChatJoinByRequest#f3bb6175", - PushMessageContentRecurringPaymentTypeID: "pushMessageContentRecurringPayment#6083361a", - PushMessageContentSuggestProfilePhotoTypeID: "pushMessageContentSuggestProfilePhoto#7d6bf0ab", - PushMessageContentMessageForwardsTypeID: "pushMessageContentMessageForwards#8df8a81c", - PushMessageContentMediaAlbumTypeID: "pushMessageContentMediaAlbum#d363e96f", - NotificationTypeNewMessageTypeID: "notificationTypeNewMessage#f0d0e3f2", - NotificationTypeNewSecretChatTypeID: "notificationTypeNewSecretChat#4771c6b0", - NotificationTypeNewCallTypeID: "notificationTypeNewCall#66164179", - NotificationTypeNewPushMessageTypeID: "notificationTypeNewPushMessage#d5949e32", - NotificationGroupTypeMessagesTypeID: "notificationGroupTypeMessages#9a86331d", - NotificationGroupTypeMentionsTypeID: "notificationGroupTypeMentions#85ca89ad", - NotificationGroupTypeSecretChatTypeID: "notificationGroupTypeSecretChat#52e54e34", - NotificationGroupTypeCallsTypeID: "notificationGroupTypeCalls#5233c152", - NotificationSoundTypeID: "notificationSound#f4ef6137", - NotificationSoundsTypeID: "notificationSounds#7ba3c849", - NotificationTypeID: "notification#2f0343d0", - NotificationGroupTypeID: "notificationGroup#d02a41ba", - OptionValueBooleanTypeID: "optionValueBoolean#3c35f1e", - OptionValueEmptyTypeID: "optionValueEmpty#36c62493", - OptionValueIntegerTypeID: "optionValueInteger#f4dcc2e4", - OptionValueStringTypeID: "optionValueString#2d136e94", - JSONObjectMemberTypeID: "jsonObjectMember#9483ae96", - JSONValueNullTypeID: "jsonValueNull#fa76e0cd", - JSONValueBooleanTypeID: "jsonValueBoolean#8050d3b0", - JSONValueNumberTypeID: "jsonValueNumber#c3c0146f", - JSONValueStringTypeID: "jsonValueString#5f3ebdb1", - JSONValueArrayTypeID: "jsonValueArray#eccdb0d8", - JSONValueObjectTypeID: "jsonValueObject#c67bff40", - StoryPrivacySettingsEveryoneTypeID: "storyPrivacySettingsEveryone#22d1053a", - StoryPrivacySettingsContactsTypeID: "storyPrivacySettingsContacts#35515d71", - StoryPrivacySettingsCloseFriendsTypeID: "storyPrivacySettingsCloseFriends#7cff8b60", - StoryPrivacySettingsSelectedUsersTypeID: "storyPrivacySettingsSelectedUsers#84d7d27b", - UserPrivacySettingRuleAllowAllTypeID: "userPrivacySettingRuleAllowAll#8abf1c3f", - UserPrivacySettingRuleAllowContactsTypeID: "userPrivacySettingRuleAllowContacts#8f2f2d10", - UserPrivacySettingRuleAllowBotsTypeID: "userPrivacySettingRuleAllowBots#53b2871d", - UserPrivacySettingRuleAllowPremiumUsersTypeID: "userPrivacySettingRuleAllowPremiumUsers#60ce8541", - UserPrivacySettingRuleAllowUsersTypeID: "userPrivacySettingRuleAllowUsers#d1570b70", - UserPrivacySettingRuleAllowChatMembersTypeID: "userPrivacySettingRuleAllowChatMembers#f249b617", - UserPrivacySettingRuleRestrictAllTypeID: "userPrivacySettingRuleRestrictAll#ac2a9550", - UserPrivacySettingRuleRestrictContactsTypeID: "userPrivacySettingRuleRestrictContacts#3c1acd02", - UserPrivacySettingRuleRestrictBotsTypeID: "userPrivacySettingRuleRestrictBots#8e996e5d", - UserPrivacySettingRuleRestrictUsersTypeID: "userPrivacySettingRuleRestrictUsers#4d392a91", - UserPrivacySettingRuleRestrictChatMembersTypeID: "userPrivacySettingRuleRestrictChatMembers#fc00b920", - UserPrivacySettingRulesTypeID: "userPrivacySettingRules#425e6b37", - UserPrivacySettingShowStatusTypeID: "userPrivacySettingShowStatus#6f0884fe", - UserPrivacySettingShowProfilePhotoTypeID: "userPrivacySettingShowProfilePhoto#53f3c9f5", - UserPrivacySettingShowLinkInForwardedMessagesTypeID: "userPrivacySettingShowLinkInForwardedMessages#2353b6e6", - UserPrivacySettingShowPhoneNumberTypeID: "userPrivacySettingShowPhoneNumber#d0d1a229", - UserPrivacySettingShowBioTypeID: "userPrivacySettingShowBio#39382761", - UserPrivacySettingShowBirthdateTypeID: "userPrivacySettingShowBirthdate#4596b4df", - UserPrivacySettingAllowChatInvitesTypeID: "userPrivacySettingAllowChatInvites#4bcc1d27", - UserPrivacySettingAllowCallsTypeID: "userPrivacySettingAllowCalls#c9f0c705", - UserPrivacySettingAllowPeerToPeerCallsTypeID: "userPrivacySettingAllowPeerToPeerCalls#1502b940", - UserPrivacySettingAllowFindingByPhoneNumberTypeID: "userPrivacySettingAllowFindingByPhoneNumber#91ee6d51", - UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID: "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c", - UserPrivacySettingAutosaveGiftsTypeID: "userPrivacySettingAutosaveGifts#709a69cd", - ReadDatePrivacySettingsTypeID: "readDatePrivacySettings#62a2e628", - NewChatPrivacySettingsTypeID: "newChatPrivacySettings#5b15ca46", - CanSendMessageToUserResultOkTypeID: "canSendMessageToUserResultOk#5b3ad802", - CanSendMessageToUserResultUserIsDeletedTypeID: "canSendMessageToUserResultUserIsDeleted#8c172661", - CanSendMessageToUserResultUserRestrictsNewChatsTypeID: "canSendMessageToUserResultUserRestrictsNewChats#7304e1d5", - AccountTTLTypeID: "accountTtl#4ef23284", - MessageAutoDeleteTimeTypeID: "messageAutoDeleteTime#758b0715", - SessionTypeAndroidTypeID: "sessionTypeAndroid#84836098", - SessionTypeAppleTypeID: "sessionTypeApple#9399d24b", - SessionTypeBraveTypeID: "sessionTypeBrave#b778e9ed", - SessionTypeChromeTypeID: "sessionTypeChrome#5dc92969", - SessionTypeEdgeTypeID: "sessionTypeEdge#dfe0cb5b", - SessionTypeFirefoxTypeID: "sessionTypeFirefox#7e83fda4", - SessionTypeIpadTypeID: "sessionTypeIpad#4d2abeef", - SessionTypeIphoneTypeID: "sessionTypeIphone#5d182bd", - SessionTypeLinuxTypeID: "sessionTypeLinux#a757ba69", - SessionTypeMACTypeID: "sessionTypeMac#db81caa1", - SessionTypeOperaTypeID: "sessionTypeOpera#a8c21c7a", - SessionTypeSafariTypeID: "sessionTypeSafari#2a5b9c59", - SessionTypeUbuntuTypeID: "sessionTypeUbuntu#5d8f6ac5", - SessionTypeUnknownTypeID: "sessionTypeUnknown#df17030", - SessionTypeVivaldiTypeID: "sessionTypeVivaldi#42c985ef", - SessionTypeWindowsTypeID: "sessionTypeWindows#9c1272a8", - SessionTypeXboxTypeID: "sessionTypeXbox#6ea39dac", - SessionTypeID: "session#9759a3c", - SessionsTypeID: "sessions#997833aa", - UnconfirmedSessionTypeID: "unconfirmedSession#850d49f9", - ConnectedWebsiteTypeID: "connectedWebsite#75e7a78a", - ConnectedWebsitesTypeID: "connectedWebsites#f0c8b5ea", - ReportReasonSpamTypeID: "reportReasonSpam#b80e23bf", - ReportReasonViolenceTypeID: "reportReasonViolence#7983c739", - ReportReasonPornographyTypeID: "reportReasonPornography#4ddf1cf7", - ReportReasonChildAbuseTypeID: "reportReasonChildAbuse#2d5d42fe", - ReportReasonCopyrightTypeID: "reportReasonCopyright#57e22faf", - ReportReasonUnrelatedLocationTypeID: "reportReasonUnrelatedLocation#5381830", - ReportReasonFakeTypeID: "reportReasonFake#15083fe0", - ReportReasonIllegalDrugsTypeID: "reportReasonIllegalDrugs#fc541220", - ReportReasonPersonalDetailsTypeID: "reportReasonPersonalDetails#a14b9412", - ReportReasonCustomTypeID: "reportReasonCustom#adb7da73", - ReportChatResultOkTypeID: "reportChatResultOk#481a557d", - ReportChatResultOptionRequiredTypeID: "reportChatResultOptionRequired#2d89acaa", - ReportChatResultTextRequiredTypeID: "reportChatResultTextRequired#8bcc30c1", - ReportChatResultMessagesRequiredTypeID: "reportChatResultMessagesRequired#6521790", - ReportStoryResultOkTypeID: "reportStoryResultOk#ac3c63b3", - ReportStoryResultOptionRequiredTypeID: "reportStoryResultOptionRequired#bf79aa9b", - ReportStoryResultTextRequiredTypeID: "reportStoryResultTextRequired#13ed9d91", - InternalLinkTypeActiveSessionsTypeID: "internalLinkTypeActiveSessions#706bbbad", - InternalLinkTypeAttachmentMenuBotTypeID: "internalLinkTypeAttachmentMenuBot#644c4225", - InternalLinkTypeAuthenticationCodeTypeID: "internalLinkTypeAuthenticationCode#f3874ff2", - InternalLinkTypeBackgroundTypeID: "internalLinkTypeBackground#b0d2908", - InternalLinkTypeBotAddToChannelTypeID: "internalLinkTypeBotAddToChannel#538ac2c0", - InternalLinkTypeBotStartTypeID: "internalLinkTypeBotStart#3f985fed", - InternalLinkTypeBotStartInGroupTypeID: "internalLinkTypeBotStartInGroup#ca0d8cce", - InternalLinkTypeBusinessChatTypeID: "internalLinkTypeBusinessChat#a03ae9d7", - InternalLinkTypeBuyStarsTypeID: "internalLinkTypeBuyStars#a94cc347", - InternalLinkTypeChangePhoneNumberTypeID: "internalLinkTypeChangePhoneNumber#f0275b01", - InternalLinkTypeChatAffiliateProgramTypeID: "internalLinkTypeChatAffiliateProgram#25ac5024", - InternalLinkTypeChatBoostTypeID: "internalLinkTypeChatBoost#d549fd40", - InternalLinkTypeChatFolderInviteTypeID: "internalLinkTypeChatFolderInvite#89b2493e", - InternalLinkTypeChatFolderSettingsTypeID: "internalLinkTypeChatFolderSettings#bfff055c", - InternalLinkTypeChatInviteTypeID: "internalLinkTypeChatInvite#198c3cd9", - InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID: "internalLinkTypeDefaultMessageAutoDeleteTimerSettings#2baaf931", - InternalLinkTypeEditProfileSettingsTypeID: "internalLinkTypeEditProfileSettings#c30e5066", - InternalLinkTypeGameTypeID: "internalLinkTypeGame#f074adcd", - InternalLinkTypeInstantViewTypeID: "internalLinkTypeInstantView#69e4df3f", - InternalLinkTypeInvoiceTypeID: "internalLinkTypeInvoice#f34c6dac", - InternalLinkTypeLanguagePackTypeID: "internalLinkTypeLanguagePack#a9870d6c", - InternalLinkTypeLanguageSettingsTypeID: "internalLinkTypeLanguageSettings#b019e6e6", - InternalLinkTypeMainWebAppTypeID: "internalLinkTypeMainWebApp#5ddf72e9", - InternalLinkTypeMessageTypeID: "internalLinkTypeMessage#3a535c52", - InternalLinkTypeMessageDraftTypeID: "internalLinkTypeMessageDraft#276fbad5", - InternalLinkTypePassportDataRequestTypeID: "internalLinkTypePassportDataRequest#c50fce81", - InternalLinkTypePhoneNumberConfirmationTypeID: "internalLinkTypePhoneNumberConfirmation#68bf6b16", - InternalLinkTypePremiumFeaturesTypeID: "internalLinkTypePremiumFeatures#48884f49", - InternalLinkTypePremiumGiftTypeID: "internalLinkTypePremiumGift#5ad56d41", - InternalLinkTypePremiumGiftCodeTypeID: "internalLinkTypePremiumGiftCode#de5c9892", - InternalLinkTypePrivacyAndSecuritySettingsTypeID: "internalLinkTypePrivacyAndSecuritySettings#ad5f6acf", - InternalLinkTypeProxyTypeID: "internalLinkTypeProxy#b1b12cea", - InternalLinkTypePublicChatTypeID: "internalLinkTypePublicChat#697a2d00", - InternalLinkTypeQrCodeAuthenticationTypeID: "internalLinkTypeQrCodeAuthentication#bf121924", - InternalLinkTypeRestorePurchasesTypeID: "internalLinkTypeRestorePurchases#24203483", - InternalLinkTypeSettingsTypeID: "internalLinkTypeSettings#177545b4", - InternalLinkTypeStickerSetTypeID: "internalLinkTypeStickerSet#a1464fa2", - InternalLinkTypeStoryTypeID: "internalLinkTypeStory#57bce647", - InternalLinkTypeThemeTypeID: "internalLinkTypeTheme#f405f807", - InternalLinkTypeThemeSettingsTypeID: "internalLinkTypeThemeSettings#c14d3916", - InternalLinkTypeUnknownDeepLinkTypeID: "internalLinkTypeUnknownDeepLink#2549d7db", - InternalLinkTypeUnsupportedProxyTypeID: "internalLinkTypeUnsupportedProxy#de399f09", - InternalLinkTypeUserPhoneNumberTypeID: "internalLinkTypeUserPhoneNumber#104bbb08", - InternalLinkTypeUserTokenTypeID: "internalLinkTypeUserToken#a8d7db59", - InternalLinkTypeVideoChatTypeID: "internalLinkTypeVideoChat#8796f8b4", - InternalLinkTypeWebAppTypeID: "internalLinkTypeWebApp#7ae9552d", - MessageLinkTypeID: "messageLink#af4a3aa6", - MessageLinkInfoTypeID: "messageLinkInfo#2b96fb50", - ChatBoostLinkTypeID: "chatBoostLink#b5417c71", - ChatBoostLinkInfoTypeID: "chatBoostLinkInfo#dc123884", - BlockListMainTypeID: "blockListMain#50a4137c", - BlockListStoriesTypeID: "blockListStories#628965c", - FilePartTypeID: "filePart#36594c36", - FileTypeNoneTypeID: "fileTypeNone#77637ea5", - FileTypeAnimationTypeID: "fileTypeAnimation#eeaa7dba", - FileTypeAudioTypeID: "fileTypeAudio#d5bbcea0", - FileTypeDocumentTypeID: "fileTypeDocument#de57030f", - FileTypeNotificationSoundTypeID: "fileTypeNotificationSound#c32f9f09", - FileTypePhotoTypeID: "fileTypePhoto#998b71a5", - FileTypePhotoStoryTypeID: "fileTypePhotoStory#78576ef4", - FileTypeProfilePhotoTypeID: "fileTypeProfilePhoto#6afee3a3", - FileTypeSecretTypeID: "fileTypeSecret#906d14f7", - FileTypeSecretThumbnailTypeID: "fileTypeSecretThumbnail#ac797636", - FileTypeSecureTypeID: "fileTypeSecure#ab69bf26", - FileTypeSelfDestructingPhotoTypeID: "fileTypeSelfDestructingPhoto#7bcf329b", - FileTypeSelfDestructingVideoTypeID: "fileTypeSelfDestructingVideo#b70cc425", - FileTypeSelfDestructingVideoNoteTypeID: "fileTypeSelfDestructingVideoNote#592012c1", - FileTypeSelfDestructingVoiceNoteTypeID: "fileTypeSelfDestructingVoiceNote#64d0db1d", - FileTypeStickerTypeID: "fileTypeSticker#1c537c69", - FileTypeThumbnailTypeID: "fileTypeThumbnail#ff42215e", - FileTypeUnknownTypeID: "fileTypeUnknown#8819ed50", - FileTypeVideoTypeID: "fileTypeVideo#5548871b", - FileTypeVideoNoteTypeID: "fileTypeVideoNote#e119a79f", - FileTypeVideoStoryTypeID: "fileTypeVideoStory#800b21a1", - FileTypeVoiceNoteTypeID: "fileTypeVoiceNote#dce96e43", - FileTypeWallpaperTypeID: "fileTypeWallpaper#6e8ffc9c", - StorageStatisticsByFileTypeTypeID: "storageStatisticsByFileType#2a8ef8a8", - StorageStatisticsByChatTypeID: "storageStatisticsByChat#a5498fe4", - StorageStatisticsTypeID: "storageStatistics#69b98672", - StorageStatisticsFastTypeID: "storageStatisticsFast#cb412861", - DatabaseStatisticsTypeID: "databaseStatistics#bd027350", - NetworkTypeNoneTypeID: "networkTypeNone#8a7a5f11", - NetworkTypeMobileTypeID: "networkTypeMobile#30d46e4f", - NetworkTypeMobileRoamingTypeID: "networkTypeMobileRoaming#aa7496f0", - NetworkTypeWiFiTypeID: "networkTypeWiFi#da37e13a", - NetworkTypeOtherTypeID: "networkTypeOther#73c2879b", - NetworkStatisticsEntryFileTypeID: "networkStatisticsEntryFile#b3b8f62", - NetworkStatisticsEntryCallTypeID: "networkStatisticsEntryCall#2bedbbad", - NetworkStatisticsTypeID: "networkStatistics#d86acb3c", - AutoDownloadSettingsTypeID: "autoDownloadSettings#3b1813e0", - AutoDownloadSettingsPresetsTypeID: "autoDownloadSettingsPresets#d1621d22", - AutosaveSettingsScopePrivateChatsTypeID: "autosaveSettingsScopePrivateChats#5329797f", - AutosaveSettingsScopeGroupChatsTypeID: "autosaveSettingsScopeGroupChats#32e00e4e", - AutosaveSettingsScopeChannelChatsTypeID: "autosaveSettingsScopeChannelChats#e2391fd1", - AutosaveSettingsScopeChatTypeID: "autosaveSettingsScopeChat#9eb5c2e9", - ScopeAutosaveSettingsTypeID: "scopeAutosaveSettings#5c329f33", - AutosaveSettingsExceptionTypeID: "autosaveSettingsException#586bf5c8", - AutosaveSettingsTypeID: "autosaveSettings#c0d11a28", - ConnectionStateWaitingForNetworkTypeID: "connectionStateWaitingForNetwork#650dd758", - ConnectionStateConnectingToProxyTypeID: "connectionStateConnectingToProxy#fa721359", - ConnectionStateConnectingTypeID: "connectionStateConnecting#b29bfa62", - ConnectionStateUpdatingTypeID: "connectionStateUpdating#f4c9c2b7", - ConnectionStateReadyTypeID: "connectionStateReady#2e5b4ec", - TopChatCategoryUsersTypeID: "topChatCategoryUsers#3d324d80", - TopChatCategoryBotsTypeID: "topChatCategoryBots#a1feeb15", - TopChatCategoryGroupsTypeID: "topChatCategoryGroups#5b32d08e", - TopChatCategoryChannelsTypeID: "topChatCategoryChannels#e22600e3", - TopChatCategoryInlineBotsTypeID: "topChatCategoryInlineBots#1678eb7c", - TopChatCategoryWebAppBotsTypeID: "topChatCategoryWebAppBots#5f6d6fd", - TopChatCategoryCallsTypeID: "topChatCategoryCalls#153b50dd", - TopChatCategoryForwardChatsTypeID: "topChatCategoryForwardChats#6515b7d5", - FoundPositionTypeID: "foundPosition#8f8adf88", - FoundPositionsTypeID: "foundPositions#afab1f62", - TMeURLTypeUserTypeID: "tMeUrlTypeUser#7787c1a", - TMeURLTypeSupergroupTypeID: "tMeUrlTypeSupergroup#af5536a8", - TMeURLTypeChatInviteTypeID: "tMeUrlTypeChatInvite#12b5da49", - TMeURLTypeStickerSetTypeID: "tMeUrlTypeStickerSet#5f83ccec", - TMeURLTypeID: "tMeUrl#bc00fa42", - TMeURLsTypeID: "tMeUrls#655b1f52", - SuggestedActionEnableArchiveAndMuteNewChatsTypeID: "suggestedActionEnableArchiveAndMuteNewChats#7841ec4f", - SuggestedActionCheckPasswordTypeID: "suggestedActionCheckPassword#71e072b7", - SuggestedActionCheckPhoneNumberTypeID: "suggestedActionCheckPhoneNumber#26ab77eb", - SuggestedActionViewChecksHintTypeID: "suggestedActionViewChecksHint#35203547", - SuggestedActionConvertToBroadcastGroupTypeID: "suggestedActionConvertToBroadcastGroup#c67a2e38", - SuggestedActionSetPasswordTypeID: "suggestedActionSetPassword#6f147d98", - SuggestedActionUpgradePremiumTypeID: "suggestedActionUpgradePremium#70aa79fb", - SuggestedActionRestorePremiumTypeID: "suggestedActionRestorePremium#e909dd64", - SuggestedActionSubscribeToAnnualPremiumTypeID: "suggestedActionSubscribeToAnnualPremium#164978bb", - SuggestedActionGiftPremiumForChristmasTypeID: "suggestedActionGiftPremiumForChristmas#93b3ee6f", - SuggestedActionSetBirthdateTypeID: "suggestedActionSetBirthdate#eabd9b02", - SuggestedActionSetProfilePhotoTypeID: "suggestedActionSetProfilePhoto#9fe23d6b", - SuggestedActionExtendPremiumTypeID: "suggestedActionExtendPremium#de405cca", - SuggestedActionExtendStarSubscriptionsTypeID: "suggestedActionExtendStarSubscriptions#fd32d556", - CountTypeID: "count#4d38f104", - TextTypeID: "text#22765898", - SecondsTypeID: "seconds#3936e58e", - FileDownloadedPrefixSizeTypeID: "fileDownloadedPrefixSize#87e267fb", - DeepLinkInfoTypeID: "deepLinkInfo#6f1ba0fe", - TextParseModeMarkdownTypeID: "textParseModeMarkdown#157648bf", - TextParseModeHTMLTypeID: "textParseModeHTML#62f4c5f3", - ProxyTypeSocks5TypeID: "proxyTypeSocks5#caf342b3", - ProxyTypeHTTPTypeID: "proxyTypeHttp#a3c7c777", - ProxyTypeMtprotoTypeID: "proxyTypeMtproto#8ae31ffd", - ProxyTypeID: "proxy#baf7b73", - ProxiesTypeID: "proxies#5ee27a86", - InputStickerTypeID: "inputSticker#1f1d0998", - DateRangeTypeID: "dateRange#51150c66", - StatisticalValueTypeID: "statisticalValue#626d6a76", - StatisticalGraphDataTypeID: "statisticalGraphData#89732e2c", - StatisticalGraphAsyncTypeID: "statisticalGraphAsync#19fb2b9f", - StatisticalGraphErrorTypeID: "statisticalGraphError#c3fda052", - ChatStatisticsObjectTypeMessageTypeID: "chatStatisticsObjectTypeMessage#6f9f24f6", - ChatStatisticsObjectTypeStoryTypeID: "chatStatisticsObjectTypeStory#15baf9b0", - ChatStatisticsInteractionInfoTypeID: "chatStatisticsInteractionInfo#694a9a8d", - ChatStatisticsMessageSenderInfoTypeID: "chatStatisticsMessageSenderInfo#690a7e4b", - ChatStatisticsAdministratorActionsInfoTypeID: "chatStatisticsAdministratorActionsInfo#e7c5cd7e", - ChatStatisticsInviterInfoTypeID: "chatStatisticsInviterInfo#2583d48b", - ChatStatisticsSupergroupTypeID: "chatStatisticsSupergroup#c67549ef", - ChatStatisticsChannelTypeID: "chatStatisticsChannel#b8e95b4", - ChatRevenueAmountTypeID: "chatRevenueAmount#a648ce58", - ChatRevenueStatisticsTypeID: "chatRevenueStatistics#636318bb", - MessageStatisticsTypeID: "messageStatistics#a2ce4f07", - StoryStatisticsTypeID: "storyStatistics#46448b6b", - RevenueWithdrawalStatePendingTypeID: "revenueWithdrawalStatePending#5d314fa5", - RevenueWithdrawalStateSucceededTypeID: "revenueWithdrawalStateSucceeded#fd14e0a", - RevenueWithdrawalStateFailedTypeID: "revenueWithdrawalStateFailed#ff413089", - ChatRevenueTransactionTypeEarningsTypeID: "chatRevenueTransactionTypeEarnings#e81ca488", - ChatRevenueTransactionTypeWithdrawalTypeID: "chatRevenueTransactionTypeWithdrawal#f138deb", - ChatRevenueTransactionTypeRefundTypeID: "chatRevenueTransactionTypeRefund#1206b847", - ChatRevenueTransactionTypeID: "chatRevenueTransaction#4c7a4ff", - ChatRevenueTransactionsTypeID: "chatRevenueTransactions#95e61144", - StarRevenueStatusTypeID: "starRevenueStatus#779532e8", - StarRevenueStatisticsTypeID: "starRevenueStatistics#bd2d9257", - PointTypeID: "point#1a13f5b9", - VectorPathCommandLineTypeID: "vectorPathCommandLine#db663c8a", - VectorPathCommandCubicBezierCurveTypeID: "vectorPathCommandCubicBezierCurve#494c3e3a", - BotCommandScopeDefaultTypeID: "botCommandScopeDefault#2f6cb2ab", - BotCommandScopeAllPrivateChatsTypeID: "botCommandScopeAllPrivateChats#eb716739", - BotCommandScopeAllGroupChatsTypeID: "botCommandScopeAllGroupChats#c585c85e", - BotCommandScopeAllChatAdministratorsTypeID: "botCommandScopeAllChatAdministrators#771c1551", - BotCommandScopeChatTypeID: "botCommandScopeChat#e65b22a5", - BotCommandScopeChatAdministratorsTypeID: "botCommandScopeChatAdministrators#42bcfe4e", - BotCommandScopeChatMemberTypeID: "botCommandScopeChatMember#f36696f2", - PhoneNumberCodeTypeChangeTypeID: "phoneNumberCodeTypeChange#531ba1a", - PhoneNumberCodeTypeVerifyTypeID: "phoneNumberCodeTypeVerify#c2a48fdb", - PhoneNumberCodeTypeConfirmOwnershipTypeID: "phoneNumberCodeTypeConfirmOwnership#e3114fe8", - UpdateAuthorizationStateTypeID: "updateAuthorizationState#60b30ee2", - UpdateNewMessageTypeID: "updateNewMessage#de6fb20e", - UpdateMessageSendAcknowledgedTypeID: "updateMessageSendAcknowledged#4da7d239", - UpdateMessageSendSucceededTypeID: "updateMessageSendSucceeded#6c399d7d", - UpdateMessageSendFailedTypeID: "updateMessageSendFailed#da1bf8e7", - UpdateMessageContentTypeID: "updateMessageContent#1e36bb24", - UpdateMessageEditedTypeID: "updateMessageEdited#dea602e6", - UpdateMessageIsPinnedTypeID: "updateMessageIsPinned#41bc233d", - UpdateMessageInteractionInfoTypeID: "updateMessageInteractionInfo#ab803bfe", - UpdateMessageContentOpenedTypeID: "updateMessageContentOpened#a55ea885", - UpdateMessageMentionReadTypeID: "updateMessageMentionRead#f0f74d46", - UpdateMessageUnreadReactionsTypeID: "updateMessageUnreadReactions#12a7220a", - UpdateMessageFactCheckTypeID: "updateMessageFactCheck#3c78fb02", - UpdateMessageLiveLocationViewedTypeID: "updateMessageLiveLocationViewed#b2058595", - UpdateVideoPublishedTypeID: "updateVideoPublished#eafc2052", - UpdateNewChatTypeID: "updateNewChat#7bb98ccd", - UpdateChatTitleTypeID: "updateChatTitle#f58b85a4", - UpdateChatPhotoTypeID: "updateChatPhoto#eca5423f", - UpdateChatAccentColorsTypeID: "updateChatAccentColors#b7b8f8f9", - UpdateChatPermissionsTypeID: "updateChatPermissions#9f52176d", - UpdateChatLastMessageTypeID: "updateChatLastMessage#f10cab1d", - UpdateChatPositionTypeID: "updateChatPosition#ff76fa77", - UpdateChatAddedToListTypeID: "updateChatAddedToList#ab7004ec", - UpdateChatRemovedFromListTypeID: "updateChatRemovedFromList#4d2ac21c", - UpdateChatReadInboxTypeID: "updateChatReadInbox#d07036e7", - UpdateChatReadOutboxTypeID: "updateChatReadOutbox#2a385285", - UpdateChatActionBarTypeID: "updateChatActionBar#d9a258c2", - UpdateChatBusinessBotManageBarTypeID: "updateChatBusinessBotManageBar#be30e7f7", - UpdateChatAvailableReactionsTypeID: "updateChatAvailableReactions#8ab413f9", - UpdateChatDraftMessageTypeID: "updateChatDraftMessage#2bf257d4", - UpdateChatEmojiStatusTypeID: "updateChatEmojiStatus#77796510", - UpdateChatMessageSenderTypeID: "updateChatMessageSender#77705241", - UpdateChatMessageAutoDeleteTimeTypeID: "updateChatMessageAutoDeleteTime#71425de5", - UpdateChatNotificationSettingsTypeID: "updateChatNotificationSettings#d020b456", - UpdateChatPendingJoinRequestsTypeID: "updateChatPendingJoinRequests#14c6e3e1", - UpdateChatReplyMarkupTypeID: "updateChatReplyMarkup#4e0ba5a0", - UpdateChatBackgroundTypeID: "updateChatBackground#ff9d38b3", - UpdateChatThemeTypeID: "updateChatTheme#31f3d465", - UpdateChatUnreadMentionCountTypeID: "updateChatUnreadMentionCount#80f47b1c", - UpdateChatUnreadReactionCountTypeID: "updateChatUnreadReactionCount#81603cdd", - UpdateChatVideoChatTypeID: "updateChatVideoChat#25fb4ca6", - UpdateChatDefaultDisableNotificationTypeID: "updateChatDefaultDisableNotification#1ba96a9b", - UpdateChatHasProtectedContentTypeID: "updateChatHasProtectedContent#6b50071b", - UpdateChatIsTranslatableTypeID: "updateChatIsTranslatable#7b031617", - UpdateChatIsMarkedAsUnreadTypeID: "updateChatIsMarkedAsUnread#57853334", - UpdateChatViewAsTopicsTypeID: "updateChatViewAsTopics#5bff163d", - UpdateChatBlockListTypeID: "updateChatBlockList#872af48e", - UpdateChatHasScheduledMessagesTypeID: "updateChatHasScheduledMessages#7b14c2d7", - UpdateChatFoldersTypeID: "updateChatFolders#e110242a", - UpdateChatOnlineMemberCountTypeID: "updateChatOnlineMemberCount#1d0caa9d", - UpdateSavedMessagesTopicTypeID: "updateSavedMessagesTopic#9f823b30", - UpdateSavedMessagesTopicCountTypeID: "updateSavedMessagesTopicCount#fbd279d1", - UpdateQuickReplyShortcutTypeID: "updateQuickReplyShortcut#c69338cf", - UpdateQuickReplyShortcutDeletedTypeID: "updateQuickReplyShortcutDeleted#e8b9bc3a", - UpdateQuickReplyShortcutsTypeID: "updateQuickReplyShortcuts#77d31a6a", - UpdateQuickReplyShortcutMessagesTypeID: "updateQuickReplyShortcutMessages#8bb36b72", - UpdateForumTopicInfoTypeID: "updateForumTopicInfo#6b6f2cc9", - UpdateScopeNotificationSettingsTypeID: "updateScopeNotificationSettings#b83ccb73", - UpdateReactionNotificationSettingsTypeID: "updateReactionNotificationSettings#e54d17ec", - UpdateNotificationTypeID: "updateNotification#8ee67ed4", - UpdateNotificationGroupTypeID: "updateNotificationGroup#96cd9e06", - UpdateActiveNotificationsTypeID: "updateActiveNotifications#317d80f2", - UpdateHavePendingNotificationsTypeID: "updateHavePendingNotifications#aaee1db", - UpdateDeleteMessagesTypeID: "updateDeleteMessages#6a05bf9", - UpdateChatActionTypeID: "updateChatAction#9abfd628", - UpdateUserStatusTypeID: "updateUserStatus#39211211", - UpdateUserTypeID: "updateUser#468928f9", - UpdateBasicGroupTypeID: "updateBasicGroup#c433c763", - UpdateSupergroupTypeID: "updateSupergroup#fb6c6524", - UpdateSecretChatTypeID: "updateSecretChat#9ca5132b", - UpdateUserFullInfoTypeID: "updateUserFullInfo#fcf2cb17", - UpdateBasicGroupFullInfoTypeID: "updateBasicGroupFullInfo#52f66bbf", - UpdateSupergroupFullInfoTypeID: "updateSupergroupFullInfo#19f5cd0e", - UpdateServiceNotificationTypeID: "updateServiceNotification#4e9895ad", - UpdateFileTypeID: "updateFile#6cd875f", - UpdateFileGenerationStartTypeID: "updateFileGenerationStart#cec5eec", - UpdateFileGenerationStopTypeID: "updateFileGenerationStop#8f14fdeb", - UpdateFileDownloadsTypeID: "updateFileDownloads#e8cd12c7", - UpdateFileAddedToDownloadsTypeID: "updateFileAddedToDownloads#5ff5921a", - UpdateFileDownloadTypeID: "updateFileDownload#342f83ca", - UpdateFileRemovedFromDownloadsTypeID: "updateFileRemovedFromDownloads#6e7c14e8", - UpdateApplicationVerificationRequiredTypeID: "updateApplicationVerificationRequired#c59c61d7", - UpdateCallTypeID: "updateCall#4fb3d0dd", - UpdateGroupCallTypeID: "updateGroupCall#30324e00", - UpdateGroupCallParticipantTypeID: "updateGroupCallParticipant#d0213cf9", - UpdateNewCallSignalingDataTypeID: "updateNewCallSignalingData#22c98d8d", - UpdateUserPrivacySettingRulesTypeID: "updateUserPrivacySettingRules#c99552f6", - UpdateUnreadMessageCountTypeID: "updateUnreadMessageCount#4b541c9", - UpdateUnreadChatCountTypeID: "updateUnreadChatCount#76e19242", - UpdateStoryTypeID: "updateStory#1906572f", - UpdateStoryDeletedTypeID: "updateStoryDeleted#7007eb9d", - UpdateStorySendSucceededTypeID: "updateStorySendSucceeded#b9269e57", - UpdateStorySendFailedTypeID: "updateStorySendFailed#e046f199", - UpdateChatActiveStoriesTypeID: "updateChatActiveStories#79786c2c", - UpdateStoryListChatCountTypeID: "updateStoryListChatCount#8833cd3f", - UpdateStoryStealthModeTypeID: "updateStoryStealthMode#6ff7bd1a", - UpdateOptionTypeID: "updateOption#35b17404", - UpdateStickerSetTypeID: "updateStickerSet#70035dcc", - UpdateInstalledStickerSetsTypeID: "updateInstalledStickerSets#82cd5388", - UpdateTrendingStickerSetsTypeID: "updateTrendingStickerSets#4b7a50a7", - UpdateRecentStickersTypeID: "updateRecentStickers#aefdf8dc", - UpdateFavoriteStickersTypeID: "updateFavoriteStickers#113f2b6a", - UpdateSavedAnimationsTypeID: "updateSavedAnimations#1084a1c8", - UpdateSavedNotificationSoundsTypeID: "updateSavedNotificationSounds#5a6653b4", - UpdateDefaultBackgroundTypeID: "updateDefaultBackground#d550952f", - UpdateChatThemesTypeID: "updateChatThemes#98dc58d5", - UpdateAccentColorsTypeID: "updateAccentColors#1316555e", - UpdateProfileAccentColorsTypeID: "updateProfileAccentColors#bf8e7430", - UpdateLanguagePackStringsTypeID: "updateLanguagePackStrings#af87919f", - UpdateConnectionStateTypeID: "updateConnectionState#57939e2e", - UpdateTermsOfServiceTypeID: "updateTermsOfService#b23cc55e", - UpdateUnconfirmedSessionTypeID: "updateUnconfirmedSession#fea6088c", - UpdateAttachmentMenuBotsTypeID: "updateAttachmentMenuBots#b6b910c", - UpdateWebAppMessageSentTypeID: "updateWebAppMessageSent#58431229", - UpdateActiveEmojiReactionsTypeID: "updateActiveEmojiReactions#691ffcb7", - UpdateAvailableMessageEffectsTypeID: "updateAvailableMessageEffects#a1cb72b9", - UpdateDefaultReactionTypeTypeID: "updateDefaultReactionType#4b615105", - UpdateSavedMessagesTagsTypeID: "updateSavedMessagesTags#7386424a", - UpdateActiveLiveLocationMessagesTypeID: "updateActiveLiveLocationMessages#a20b9b1f", - UpdateOwnedStarCountTypeID: "updateOwnedStarCount#af7ebf88", - UpdateChatRevenueAmountTypeID: "updateChatRevenueAmount#c6c9bcc4", - UpdateStarRevenueStatusTypeID: "updateStarRevenueStatus#ef4bfccb", - UpdateSpeechRecognitionTrialTypeID: "updateSpeechRecognitionTrial#ff4efcc1", - UpdateDiceEmojisTypeID: "updateDiceEmojis#9d0f91df", - UpdateAnimatedEmojiMessageClickedTypeID: "updateAnimatedEmojiMessageClicked#a3167405", - UpdateAnimationSearchParametersTypeID: "updateAnimationSearchParameters#6016ef01", - UpdateSuggestedActionsTypeID: "updateSuggestedActions#c2e5cccb", - UpdateSpeedLimitNotificationTypeID: "updateSpeedLimitNotification#c683d868", - UpdateContactCloseBirthdaysTypeID: "updateContactCloseBirthdays#c88b98ce", - UpdateAutosaveSettingsTypeID: "updateAutosaveSettings#da274f0b", - UpdateBusinessConnectionTypeID: "updateBusinessConnection#8632f476", - UpdateNewBusinessMessageTypeID: "updateNewBusinessMessage#86be4644", - UpdateBusinessMessageEditedTypeID: "updateBusinessMessageEdited#81a66d89", - UpdateBusinessMessagesDeletedTypeID: "updateBusinessMessagesDeleted#e036d3ed", - UpdateNewInlineQueryTypeID: "updateNewInlineQuery#7171bf34", - UpdateNewChosenInlineResultTypeID: "updateNewChosenInlineResult#cb4c4f5d", - UpdateNewCallbackQueryTypeID: "updateNewCallbackQuery#8964d05e", - UpdateNewInlineCallbackQueryTypeID: "updateNewInlineCallbackQuery#ecf934ba", - UpdateNewBusinessCallbackQueryTypeID: "updateNewBusinessCallbackQuery#14125364", - UpdateNewShippingQueryTypeID: "updateNewShippingQuery#29584672", - UpdateNewPreCheckoutQueryTypeID: "updateNewPreCheckoutQuery#2a3871c9", - UpdateNewCustomEventTypeID: "updateNewCustomEvent#76dd6a0c", - UpdateNewCustomQueryTypeID: "updateNewCustomQuery#d702f9a6", - UpdatePollTypeID: "updatePoll#966b73ca", - UpdatePollAnswerTypeID: "updatePollAnswer#b67ac547", - UpdateChatMemberTypeID: "updateChatMember#98865bc7", - UpdateNewChatJoinRequestTypeID: "updateNewChatJoinRequest#7e48b843", - UpdateChatBoostTypeID: "updateChatBoost#50727e24", - UpdateMessageReactionTypeID: "updateMessageReaction#f46c854a", - UpdateMessageReactionsTypeID: "updateMessageReactions#bd5618e9", - UpdatePaidMediaPurchasedTypeID: "updatePaidMediaPurchased#a410e65b", - UpdatesTypeID: "updates#b9829222", - LogStreamDefaultTypeID: "logStreamDefault#52e296bc", - LogStreamFileTypeID: "logStreamFile#5b528de5", - LogStreamEmptyTypeID: "logStreamEmpty#e233f1cc", - LogVerbosityLevelTypeID: "logVerbosityLevel#676443ea", - LogTagsTypeID: "logTags#dc09ced4", - UserSupportInfoTypeID: "userSupportInfo#b50e1c29", - TestIntTypeID: "testInt#ddbd2c09", - TestStringTypeID: "testString#fe56688c", - TestBytesTypeID: "testBytes#a422c4de", - TestVectorIntTypeID: "testVectorInt#df9eb113", - TestVectorIntObjectTypeID: "testVectorIntObject#f152999b", - TestVectorStringTypeID: "testVectorString#5d6f85bc", - TestVectorStringObjectTypeID: "testVectorStringObject#e5ecc0d", - GetAuthorizationStateRequestTypeID: "getAuthorizationState#742dbe3d", - SetTdlibParametersRequestTypeID: "setTdlibParameters#d1c0f62e", - SetAuthenticationPhoneNumberRequestTypeID: "setAuthenticationPhoneNumber#33c0d823", - SetAuthenticationEmailAddressRequestTypeID: "setAuthenticationEmailAddress#69b2c502", - ResendAuthenticationCodeRequestTypeID: "resendAuthenticationCode#a630bbb8", - CheckAuthenticationEmailCodeRequestTypeID: "checkAuthenticationEmailCode#dd42c29f", - CheckAuthenticationCodeRequestTypeID: "checkAuthenticationCode#edfe44aa", - RequestQrCodeAuthenticationRequestTypeID: "requestQrCodeAuthentication#56fe3c4e", - RegisterUserRequestTypeID: "registerUser#c3aa52ec", - ResetAuthenticationEmailAddressRequestTypeID: "resetAuthenticationEmailAddress#e742722c", - CheckAuthenticationPasswordRequestTypeID: "checkAuthenticationPassword#87424ba0", - RequestAuthenticationPasswordRecoveryRequestTypeID: "requestAuthenticationPasswordRecovery#53152ab6", - CheckAuthenticationPasswordRecoveryCodeRequestTypeID: "checkAuthenticationPasswordRecoveryCode#dc0a3be5", - RecoverAuthenticationPasswordRequestTypeID: "recoverAuthenticationPassword#f8311523", - SendAuthenticationFirebaseSMSRequestTypeID: "sendAuthenticationFirebaseSms#15c15e3f", - ReportAuthenticationCodeMissingRequestTypeID: "reportAuthenticationCodeMissing#91efce48", - CheckAuthenticationBotTokenRequestTypeID: "checkAuthenticationBotToken#261b4476", - LogOutRequestTypeID: "logOut#a1b5c41b", - CloseRequestTypeID: "close#b933e17f", - DestroyRequestTypeID: "destroy#28d9534a", - ConfirmQrCodeAuthenticationRequestTypeID: "confirmQrCodeAuthentication#e993a72d", - GetCurrentStateRequestTypeID: "getCurrentState#b8fc6889", - SetDatabaseEncryptionKeyRequestTypeID: "setDatabaseEncryptionKey#b83345b5", - GetPasswordStateRequestTypeID: "getPasswordState#f5957b78", - SetPasswordRequestTypeID: "setPassword#b8db46dd", - SetLoginEmailAddressRequestTypeID: "setLoginEmailAddress#37bb43d4", - ResendLoginEmailAddressCodeRequestTypeID: "resendLoginEmailAddressCode#11765215", - CheckLoginEmailAddressCodeRequestTypeID: "checkLoginEmailAddressCode#a951fc62", - GetRecoveryEmailAddressRequestTypeID: "getRecoveryEmailAddress#a0f1b9fd", - SetRecoveryEmailAddressRequestTypeID: "setRecoveryEmailAddress#89df939f", - CheckRecoveryEmailAddressCodeRequestTypeID: "checkRecoveryEmailAddressCode#88f7981b", - ResendRecoveryEmailAddressCodeRequestTypeID: "resendRecoveryEmailAddressCode#19d66f1c", - CancelRecoveryEmailAddressVerificationRequestTypeID: "cancelRecoveryEmailAddressVerification#a5988e8d", - RequestPasswordRecoveryRequestTypeID: "requestPasswordRecovery#ff2dc552", - CheckPasswordRecoveryCodeRequestTypeID: "checkPasswordRecoveryCode#f4081e18", - RecoverPasswordRequestTypeID: "recoverPassword#a5259973", - ResetPasswordRequestTypeID: "resetPassword#dc9e8c9d", - CancelPasswordResetRequestTypeID: "cancelPasswordReset#38127462", - CreateTemporaryPasswordRequestTypeID: "createTemporaryPassword#9f0d6f86", - GetTemporaryPasswordStateRequestTypeID: "getTemporaryPasswordState#ff3ea892", - GetMeRequestTypeID: "getMe#f495b27f", - GetUserRequestTypeID: "getUser#42999c0b", - GetUserFullInfoRequestTypeID: "getUserFullInfo#d1b29c58", - GetBasicGroupRequestTypeID: "getBasicGroup#9e893654", - GetBasicGroupFullInfoRequestTypeID: "getBasicGroupFullInfo#9365e32b", - GetSupergroupRequestTypeID: "getSupergroup#3afd10e2", - GetSupergroupFullInfoRequestTypeID: "getSupergroupFullInfo#418d4038", - GetSecretChatRequestTypeID: "getSecretChat#26b7e81", - GetChatRequestTypeID: "getChat#6f421440", - GetMessageRequestTypeID: "getMessage#9372c080", - GetMessageLocallyRequestTypeID: "getMessageLocally#dc062b6c", - GetRepliedMessageRequestTypeID: "getRepliedMessage#d9bd19bd", - GetChatPinnedMessageRequestTypeID: "getChatPinnedMessage#15731ab0", - GetCallbackQueryMessageRequestTypeID: "getCallbackQueryMessage#bd209172", - GetMessagesRequestTypeID: "getMessages#d5dd28bf", - GetMessagePropertiesRequestTypeID: "getMessageProperties#2e18e1ab", - GetMessageThreadRequestTypeID: "getMessageThread#7af23e3e", - GetMessageReadDateRequestTypeID: "getMessageReadDate#a7850343", - GetMessageViewersRequestTypeID: "getMessageViewers#a18f1ace", - GetFileRequestTypeID: "getFile#5c9efd4e", - GetRemoteFileRequestTypeID: "getRemoteFile#7f632732", - LoadChatsRequestTypeID: "loadChats#8f9b7d7b", - GetChatsRequestTypeID: "getChats#c604bac2", - SearchPublicChatRequestTypeID: "searchPublicChat#3316d9ad", - SearchPublicChatsRequestTypeID: "searchPublicChats#39d6e7b9", - SearchChatsRequestTypeID: "searchChats#8ff4b9cc", - SearchChatsOnServerRequestTypeID: "searchChatsOnServer#baf42f74", - GetRecommendedChatsRequestTypeID: "getRecommendedChats#d9438d71", - GetChatSimilarChatsRequestTypeID: "getChatSimilarChats#bb508f83", - GetChatSimilarChatCountRequestTypeID: "getChatSimilarChatCount#463e968e", - OpenChatSimilarChatRequestTypeID: "openChatSimilarChat#8fa6f413", - GetTopChatsRequestTypeID: "getTopChats#e8d95221", - RemoveTopChatRequestTypeID: "removeTopChat#8e481e55", - SearchRecentlyFoundChatsRequestTypeID: "searchRecentlyFoundChats#62320591", - AddRecentlyFoundChatRequestTypeID: "addRecentlyFoundChat#97e8198d", - RemoveRecentlyFoundChatRequestTypeID: "removeRecentlyFoundChat#2ac1bf1c", - ClearRecentlyFoundChatsRequestTypeID: "clearRecentlyFoundChats#eefa5b32", - GetRecentlyOpenedChatsRequestTypeID: "getRecentlyOpenedChats#8d4fb223", - CheckChatUsernameRequestTypeID: "checkChatUsername#f8e66210", - GetCreatedPublicChatsRequestTypeID: "getCreatedPublicChats#2a5725ef", - CheckCreatedPublicChatsLimitRequestTypeID: "checkCreatedPublicChatsLimit#e5717fa1", - GetSuitableDiscussionChatsRequestTypeID: "getSuitableDiscussionChats#2ec5df6", - GetInactiveSupergroupChatsRequestTypeID: "getInactiveSupergroupChats#d8cbf9b5", - GetSuitablePersonalChatsRequestTypeID: "getSuitablePersonalChats#90849bf5", - LoadSavedMessagesTopicsRequestTypeID: "loadSavedMessagesTopics#1146d6b8", - GetSavedMessagesTopicHistoryRequestTypeID: "getSavedMessagesTopicHistory#77e5da68", - GetSavedMessagesTopicMessageByDateRequestTypeID: "getSavedMessagesTopicMessageByDate#c15e4680", - DeleteSavedMessagesTopicHistoryRequestTypeID: "deleteSavedMessagesTopicHistory#69df3d6a", - DeleteSavedMessagesTopicMessagesByDateRequestTypeID: "deleteSavedMessagesTopicMessagesByDate#160a25", - ToggleSavedMessagesTopicIsPinnedRequestTypeID: "toggleSavedMessagesTopicIsPinned#a15345cc", - SetPinnedSavedMessagesTopicsRequestTypeID: "setPinnedSavedMessagesTopics#475a1110", - GetGroupsInCommonRequestTypeID: "getGroupsInCommon#16bdd36a", - GetChatHistoryRequestTypeID: "getChatHistory#d051927d", - GetMessageThreadHistoryRequestTypeID: "getMessageThreadHistory#9435d428", - DeleteChatHistoryRequestTypeID: "deleteChatHistory#a841d09f", - DeleteChatRequestTypeID: "deleteChat#f5cae05e", - SearchChatMessagesRequestTypeID: "searchChatMessages#dfdeb5c6", - SearchMessagesRequestTypeID: "searchMessages#490addb5", - SearchSecretMessagesRequestTypeID: "searchSecretMessages#cd2a4c9c", - SearchSavedMessagesRequestTypeID: "searchSavedMessages#8a9b9f96", - SearchCallMessagesRequestTypeID: "searchCallMessages#8c3bef1b", - SearchOutgoingDocumentMessagesRequestTypeID: "searchOutgoingDocumentMessages#c023c47e", - SearchPublicMessagesByTagRequestTypeID: "searchPublicMessagesByTag#25976caa", - SearchPublicStoriesByTagRequestTypeID: "searchPublicStoriesByTag#a2ca6a03", - SearchPublicStoriesByLocationRequestTypeID: "searchPublicStoriesByLocation#5f2bd988", - SearchPublicStoriesByVenueRequestTypeID: "searchPublicStoriesByVenue#d71a622a", - GetSearchedForTagsRequestTypeID: "getSearchedForTags#9b1b30cd", - RemoveSearchedForTagRequestTypeID: "removeSearchedForTag#35216bca", - ClearSearchedForTagsRequestTypeID: "clearSearchedForTags#1e84c356", - DeleteAllCallMessagesRequestTypeID: "deleteAllCallMessages#a897d1f3", - SearchChatRecentLocationMessagesRequestTypeID: "searchChatRecentLocationMessages#38a37ee6", - GetChatMessageByDateRequestTypeID: "getChatMessageByDate#3f557136", - GetChatSparseMessagePositionsRequestTypeID: "getChatSparseMessagePositions#3b452efd", - GetChatMessageCalendarRequestTypeID: "getChatMessageCalendar#81af2db7", - GetChatMessageCountRequestTypeID: "getChatMessageCount#38f78909", - GetChatMessagePositionRequestTypeID: "getChatMessagePosition#81bfcc7", - GetChatScheduledMessagesRequestTypeID: "getChatScheduledMessages#df3d2ffb", - GetChatSponsoredMessagesRequestTypeID: "getChatSponsoredMessages#50a84098", - ClickChatSponsoredMessageRequestTypeID: "clickChatSponsoredMessage#39ef7a17", - ReportChatSponsoredMessageRequestTypeID: "reportChatSponsoredMessage#cc3e53be", - RemoveNotificationRequestTypeID: "removeNotification#336ab34e", - RemoveNotificationGroupRequestTypeID: "removeNotificationGroup#661a638e", - GetMessageLinkRequestTypeID: "getMessageLink#c556ef7a", - GetMessageEmbeddingCodeRequestTypeID: "getMessageEmbeddingCode#62a4cd09", - GetMessageLinkInfoRequestTypeID: "getMessageLinkInfo#d63eb458", - TranslateTextRequestTypeID: "translateText#252264f2", - TranslateMessageTextRequestTypeID: "translateMessageText#53c51ed2", - RecognizeSpeechRequestTypeID: "recognizeSpeech#67d402b9", - RateSpeechRecognitionRequestTypeID: "rateSpeechRecognition#eedcc3b5", - GetChatAvailableMessageSendersRequestTypeID: "getChatAvailableMessageSenders#450fe92b", - SetChatMessageSenderRequestTypeID: "setChatMessageSender#ab456b7e", - SendMessageRequestTypeID: "sendMessage#e02d01e9", - SendMessageAlbumRequestTypeID: "sendMessageAlbum#74bcdacf", - SendBotStartMessageRequestTypeID: "sendBotStartMessage#aa6a3eee", - SendInlineQueryResultMessageRequestTypeID: "sendInlineQueryResultMessage#467c5478", - ForwardMessagesRequestTypeID: "forwardMessages#34de5b20", - SendQuickReplyShortcutMessagesRequestTypeID: "sendQuickReplyShortcutMessages#dd5169d", - ResendMessagesRequestTypeID: "resendMessages#90e36776", - AddLocalMessageRequestTypeID: "addLocalMessage#f617b7a1", - DeleteMessagesRequestTypeID: "deleteMessages#c3ed9de2", - DeleteChatMessagesBySenderRequestTypeID: "deleteChatMessagesBySender#ba9b2e67", - DeleteChatMessagesByDateRequestTypeID: "deleteChatMessagesByDate#9e44e0bf", - EditMessageTextRequestTypeID: "editMessageText#bb2e1b7", - EditMessageLiveLocationRequestTypeID: "editMessageLiveLocation#8f511394", - EditMessageMediaRequestTypeID: "editMessageMedia#bb4b8713", - EditMessageCaptionRequestTypeID: "editMessageCaption#87977241", - EditMessageReplyMarkupRequestTypeID: "editMessageReplyMarkup#13cbde89", - EditInlineMessageTextRequestTypeID: "editInlineMessageText#cd02c1e5", - EditInlineMessageLiveLocationRequestTypeID: "editInlineMessageLiveLocation#7f37a0ac", - EditInlineMessageMediaRequestTypeID: "editInlineMessageMedia#1676781", - EditInlineMessageCaptionRequestTypeID: "editInlineMessageCaption#540744f8", - EditInlineMessageReplyMarkupRequestTypeID: "editInlineMessageReplyMarkup#fbf906de", - EditMessageSchedulingStateRequestTypeID: "editMessageSchedulingState#ae2a0bc0", - SetMessageFactCheckRequestTypeID: "setMessageFactCheck#ffbe3d08", - SendBusinessMessageRequestTypeID: "sendBusinessMessage#987b403", - SendBusinessMessageAlbumRequestTypeID: "sendBusinessMessageAlbum#70bd4e6f", - EditBusinessMessageTextRequestTypeID: "editBusinessMessageText#bb81119c", - EditBusinessMessageLiveLocationRequestTypeID: "editBusinessMessageLiveLocation#1d80ae1f", - EditBusinessMessageMediaRequestTypeID: "editBusinessMessageMedia#fc614778", - EditBusinessMessageCaptionRequestTypeID: "editBusinessMessageCaption#c02142c3", - EditBusinessMessageReplyMarkupRequestTypeID: "editBusinessMessageReplyMarkup#29d46c17", - StopBusinessPollRequestTypeID: "stopBusinessPoll#bbeb2160", - SetBusinessMessageIsPinnedRequestTypeID: "setBusinessMessageIsPinned#ff14f5f0", - CheckQuickReplyShortcutNameRequestTypeID: "checkQuickReplyShortcutName#7d3dd129", - LoadQuickReplyShortcutsRequestTypeID: "loadQuickReplyShortcuts#c367b29d", - SetQuickReplyShortcutNameRequestTypeID: "setQuickReplyShortcutName#b20f471", - DeleteQuickReplyShortcutRequestTypeID: "deleteQuickReplyShortcut#f1486c16", - ReorderQuickReplyShortcutsRequestTypeID: "reorderQuickReplyShortcuts#b04981c4", - LoadQuickReplyShortcutMessagesRequestTypeID: "loadQuickReplyShortcutMessages#fd40aed4", - DeleteQuickReplyShortcutMessagesRequestTypeID: "deleteQuickReplyShortcutMessages#e859fcbb", - AddQuickReplyShortcutMessageRequestTypeID: "addQuickReplyShortcutMessage#3f188b2a", - AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID: "addQuickReplyShortcutInlineQueryResultMessage#87c02a04", - AddQuickReplyShortcutMessageAlbumRequestTypeID: "addQuickReplyShortcutMessageAlbum#9647a3fd", - ReaddQuickReplyShortcutMessagesRequestTypeID: "readdQuickReplyShortcutMessages#652518f7", - EditQuickReplyMessageRequestTypeID: "editQuickReplyMessage#4cc978e", - GetForumTopicDefaultIconsRequestTypeID: "getForumTopicDefaultIcons#583574dc", - CreateForumTopicRequestTypeID: "createForumTopic#c1fa28e4", - EditForumTopicRequestTypeID: "editForumTopic#a7769060", - GetForumTopicRequestTypeID: "getForumTopic#e59bfe41", - GetForumTopicLinkRequestTypeID: "getForumTopicLink#c97b88cb", - GetForumTopicsRequestTypeID: "getForumTopics#fbab7d5a", - SetForumTopicNotificationSettingsRequestTypeID: "setForumTopicNotificationSettings#1f433467", - ToggleForumTopicIsClosedRequestTypeID: "toggleForumTopicIsClosed#c7648af3", - ToggleGeneralForumTopicIsHiddenRequestTypeID: "toggleGeneralForumTopicIsHidden#5f1d1448", - ToggleForumTopicIsPinnedRequestTypeID: "toggleForumTopicIsPinned#466ceab4", - SetPinnedForumTopicsRequestTypeID: "setPinnedForumTopics#ddf26f21", - DeleteForumTopicRequestTypeID: "deleteForumTopic#6f285cb8", - GetEmojiReactionRequestTypeID: "getEmojiReaction#e53411dc", - GetCustomEmojiReactionAnimationsRequestTypeID: "getCustomEmojiReactionAnimations#49748dd2", - GetMessageAvailableReactionsRequestTypeID: "getMessageAvailableReactions#76db86b2", - ClearRecentReactionsRequestTypeID: "clearRecentReactions#4d61c752", - AddMessageReactionRequestTypeID: "addMessageReaction#549855ed", - RemoveMessageReactionRequestTypeID: "removeMessageReaction#97474d7b", - AddPendingPaidMessageReactionRequestTypeID: "addPendingPaidMessageReaction#66548919", - CommitPendingPaidMessageReactionsRequestTypeID: "commitPendingPaidMessageReactions#f5c95606", - RemovePendingPaidMessageReactionsRequestTypeID: "removePendingPaidMessageReactions#41949cfb", - TogglePaidMessageReactionIsAnonymousRequestTypeID: "togglePaidMessageReactionIsAnonymous#9774db11", - SetMessageReactionsRequestTypeID: "setMessageReactions#71fa9e8f", - GetMessageAddedReactionsRequestTypeID: "getMessageAddedReactions#7dc6ae52", - SetDefaultReactionTypeRequestTypeID: "setDefaultReactionType#65038a3d", - GetSavedMessagesTagsRequestTypeID: "getSavedMessagesTags#8cd667a9", - SetSavedMessagesTagLabelRequestTypeID: "setSavedMessagesTagLabel#b03acd10", - GetMessageEffectRequestTypeID: "getMessageEffect#9e513d14", - SearchQuoteRequestTypeID: "searchQuote#6864011f", - GetTextEntitiesRequestTypeID: "getTextEntities#eba543fb", - ParseTextEntitiesRequestTypeID: "parseTextEntities#9a1fc29f", - ParseMarkdownRequestTypeID: "parseMarkdown#2d153aef", - GetMarkdownTextRequestTypeID: "getMarkdownText#9ce7228", - GetCountryFlagEmojiRequestTypeID: "getCountryFlagEmoji#3a8629fa", - GetFileMimeTypeRequestTypeID: "getFileMimeType#84631b89", - GetFileExtensionRequestTypeID: "getFileExtension#f9adb934", - CleanFileNameRequestTypeID: "cleanFileName#39b1f7fb", - GetLanguagePackStringRequestTypeID: "getLanguagePackString#8fcde73", - GetJSONValueRequestTypeID: "getJsonValue#92fa5a05", - GetJSONStringRequestTypeID: "getJsonString#278b9421", - GetThemeParametersJSONStringRequestTypeID: "getThemeParametersJsonString#91b905f8", - SetPollAnswerRequestTypeID: "setPollAnswer#5303b916", - GetPollVotersRequestTypeID: "getPollVoters#c45ba9ac", - StopPollRequestTypeID: "stopPoll#62e80aad", - HideSuggestedActionRequestTypeID: "hideSuggestedAction#a2ef2b7f", - HideContactCloseBirthdaysRequestTypeID: "hideContactCloseBirthdays#baad087b", - GetBusinessConnectionRequestTypeID: "getBusinessConnection#81f42420", - GetLoginURLInfoRequestTypeID: "getLoginUrlInfo#ccc99db3", - GetLoginURLRequestTypeID: "getLoginUrl#2f3295d1", - ShareUsersWithBotRequestTypeID: "shareUsersWithBot#58448550", - ShareChatWithBotRequestTypeID: "shareChatWithBot#a6530ae2", - GetInlineQueryResultsRequestTypeID: "getInlineQueryResults#79dcf86c", - AnswerInlineQueryRequestTypeID: "answerInlineQuery#ac7cc5e6", - SavePreparedInlineMessageRequestTypeID: "savePreparedInlineMessage#c71468d9", - GetPreparedInlineMessageRequestTypeID: "getPreparedInlineMessage#fb0ac74b", - GetGrossingWebAppBotsRequestTypeID: "getGrossingWebAppBots#6522ce1a", - SearchWebAppRequestTypeID: "searchWebApp#b5fc8a35", - GetWebAppPlaceholderRequestTypeID: "getWebAppPlaceholder#22c70d8f", - GetWebAppLinkURLRequestTypeID: "getWebAppLinkUrl#60fe62c1", - GetMainWebAppRequestTypeID: "getMainWebApp#23687ca6", - GetWebAppURLRequestTypeID: "getWebAppUrl#a4ff1f44", - SendWebAppDataRequestTypeID: "sendWebAppData#ab1fce0c", - OpenWebAppRequestTypeID: "openWebApp#278173a2", - CloseWebAppRequestTypeID: "closeWebApp#68a124c6", - AnswerWebAppQueryRequestTypeID: "answerWebAppQuery#a0b49cf1", - CheckWebAppFileDownloadRequestTypeID: "checkWebAppFileDownload#e8ca44e2", - GetCallbackQueryAnswerRequestTypeID: "getCallbackQueryAnswer#6ef7a5f", - AnswerCallbackQueryRequestTypeID: "answerCallbackQuery#bb462e76", - AnswerShippingQueryRequestTypeID: "answerShippingQuery#7a3c2432", - AnswerPreCheckoutQueryRequestTypeID: "answerPreCheckoutQuery#a76163eb", - SetGameScoreRequestTypeID: "setGameScore#7eccedc6", - SetInlineGameScoreRequestTypeID: "setInlineGameScore#c7715d8b", - GetGameHighScoresRequestTypeID: "getGameHighScores#f0459b", - GetInlineGameHighScoresRequestTypeID: "getInlineGameHighScores#e0396baa", - DeleteChatReplyMarkupRequestTypeID: "deleteChatReplyMarkup#5ff9b5b", - SendChatActionRequestTypeID: "sendChatAction#8823f29e", - OpenChatRequestTypeID: "openChat#ecb9be0b", - CloseChatRequestTypeID: "closeChat#25e86e9", - ViewMessagesRequestTypeID: "viewMessages#aa2f0438", - OpenMessageContentRequestTypeID: "openMessageContent#d3f2697b", - ClickAnimatedEmojiMessageRequestTypeID: "clickAnimatedEmojiMessage#bb17662", - GetInternalLinkRequestTypeID: "getInternalLink#3960f1b0", - GetInternalLinkTypeRequestTypeID: "getInternalLinkType#8bdd5709", - GetExternalLinkInfoRequestTypeID: "getExternalLinkInfo#460d7a3f", - GetExternalLinkRequestTypeID: "getExternalLink#5e92f0eb", - ReadAllChatMentionsRequestTypeID: "readAllChatMentions#50eab2b5", - ReadAllMessageThreadMentionsRequestTypeID: "readAllMessageThreadMentions#4edd7555", - ReadAllChatReactionsRequestTypeID: "readAllChatReactions#54c1976d", - ReadAllMessageThreadReactionsRequestTypeID: "readAllMessageThreadReactions#d0bc273e", - CreatePrivateChatRequestTypeID: "createPrivateChat#c7825b09", - CreateBasicGroupChatRequestTypeID: "createBasicGroupChat#758ab4e4", - CreateSupergroupChatRequestTypeID: "createSupergroupChat#46c770eb", - CreateSecretChatRequestTypeID: "createSecretChat#730dd22f", - CreateNewBasicGroupChatRequestTypeID: "createNewBasicGroupChat#8b9517af", - CreateNewSupergroupChatRequestTypeID: "createNewSupergroupChat#2fecf6c6", - CreateNewSecretChatRequestTypeID: "createNewSecretChat#db012265", - UpgradeBasicGroupChatToSupergroupChatRequestTypeID: "upgradeBasicGroupChatToSupergroupChat#11e915ba", - GetChatListsToAddChatRequestTypeID: "getChatListsToAddChat#2709d6a1", - AddChatToListRequestTypeID: "addChatToList#fb334eb5", - GetChatFolderRequestTypeID: "getChatFolder#5882a98", - CreateChatFolderRequestTypeID: "createChatFolder#3c85c500", - EditChatFolderRequestTypeID: "editChatFolder#332fb32", - DeleteChatFolderRequestTypeID: "deleteChatFolder#74260b87", - GetChatFolderChatsToLeaveRequestTypeID: "getChatFolderChatsToLeave#8dc1e6af", - GetChatFolderChatCountRequestTypeID: "getChatFolderChatCount#7dd4cbbe", - ReorderChatFoldersRequestTypeID: "reorderChatFolders#59544c32", - ToggleChatFolderTagsRequestTypeID: "toggleChatFolderTags#834b6c44", - GetRecommendedChatFoldersRequestTypeID: "getRecommendedChatFolders#f7533b87", - GetChatFolderDefaultIconNameRequestTypeID: "getChatFolderDefaultIconName#2cf7a067", - GetChatsForChatFolderInviteLinkRequestTypeID: "getChatsForChatFolderInviteLink#6fac4949", - CreateChatFolderInviteLinkRequestTypeID: "createChatFolderInviteLink#fba5e198", - GetChatFolderInviteLinksRequestTypeID: "getChatFolderInviteLinks#139d5be0", - EditChatFolderInviteLinkRequestTypeID: "editChatFolderInviteLink#5cc415a8", - DeleteChatFolderInviteLinkRequestTypeID: "deleteChatFolderInviteLink#c890717e", - CheckChatFolderInviteLinkRequestTypeID: "checkChatFolderInviteLink#1f25999b", - AddChatFolderByInviteLinkRequestTypeID: "addChatFolderByInviteLink#1ed19dae", - GetChatFolderNewChatsRequestTypeID: "getChatFolderNewChats#7e8d2ccc", - ProcessChatFolderNewChatsRequestTypeID: "processChatFolderNewChats#109f8a8b", - GetArchiveChatListSettingsRequestTypeID: "getArchiveChatListSettings#838d8e60", - SetArchiveChatListSettingsRequestTypeID: "setArchiveChatListSettings#cb454c0a", - SetChatTitleRequestTypeID: "setChatTitle#9cabebf", - SetChatPhotoRequestTypeID: "setChatPhoto#e97b8d03", - SetChatAccentColorRequestTypeID: "setChatAccentColor#349f57ca", - SetChatProfileAccentColorRequestTypeID: "setChatProfileAccentColor#4227ae7a", - SetChatMessageAutoDeleteTimeRequestTypeID: "setChatMessageAutoDeleteTime#a641b4ff", - SetChatEmojiStatusRequestTypeID: "setChatEmojiStatus#55881912", - SetChatPermissionsRequestTypeID: "setChatPermissions#7f7706fe", - SetChatBackgroundRequestTypeID: "setChatBackground#eb4c3fe", - DeleteChatBackgroundRequestTypeID: "deleteChatBackground#1316e678", - SetChatThemeRequestTypeID: "setChatTheme#8f090293", - SetChatDraftMessageRequestTypeID: "setChatDraftMessage#645e1f1a", - SetChatNotificationSettingsRequestTypeID: "setChatNotificationSettings#2e531ffe", - ToggleChatHasProtectedContentRequestTypeID: "toggleChatHasProtectedContent#3a20d94d", - ToggleChatViewAsTopicsRequestTypeID: "toggleChatViewAsTopics#2b2783dc", - ToggleChatIsTranslatableRequestTypeID: "toggleChatIsTranslatable#93f9cbdf", - ToggleChatIsMarkedAsUnreadRequestTypeID: "toggleChatIsMarkedAsUnread#c538dadf", - ToggleChatDefaultDisableNotificationRequestTypeID: "toggleChatDefaultDisableNotification#12c36012", - SetChatAvailableReactionsRequestTypeID: "setChatAvailableReactions#feb3e06", - SetChatClientDataRequestTypeID: "setChatClientData#ceb3273d", - SetChatDescriptionRequestTypeID: "setChatDescription#74a8b45d", - SetChatDiscussionGroupRequestTypeID: "setChatDiscussionGroup#c93c32b8", - SetChatLocationRequestTypeID: "setChatLocation#d2471daa", - SetChatSlowModeDelayRequestTypeID: "setChatSlowModeDelay#dfcae63e", - PinChatMessageRequestTypeID: "pinChatMessage#79475baf", - UnpinChatMessageRequestTypeID: "unpinChatMessage#7b1c3ede", - UnpinAllChatMessagesRequestTypeID: "unpinAllChatMessages#aa4cd4b7", - UnpinAllMessageThreadMessagesRequestTypeID: "unpinAllMessageThreadMessages#b7c69f00", - JoinChatRequestTypeID: "joinChat#137a1aa1", - LeaveChatRequestTypeID: "leaveChat#93377a61", - AddChatMemberRequestTypeID: "addChatMember#66875217", - AddChatMembersRequestTypeID: "addChatMembers#1a3232f", - SetChatMemberStatusRequestTypeID: "setChatMemberStatus#4e0171f", - BanChatMemberRequestTypeID: "banChatMember#cb107d7c", - CanTransferOwnershipRequestTypeID: "canTransferOwnership#25d3440c", - TransferChatOwnershipRequestTypeID: "transferChatOwnership#77a00a13", - GetChatMemberRequestTypeID: "getChatMember#d0c15272", - SearchChatMembersRequestTypeID: "searchChatMembers#e56d46c5", - GetChatAdministratorsRequestTypeID: "getChatAdministrators#5c0eb6bb", - ClearAllDraftMessagesRequestTypeID: "clearAllDraftMessages#fd3c74db", - GetSavedNotificationSoundRequestTypeID: "getSavedNotificationSound#1b647917", - GetSavedNotificationSoundsRequestTypeID: "getSavedNotificationSounds#c0346fa8", - AddSavedNotificationSoundRequestTypeID: "addSavedNotificationSound#3e3984ef", - RemoveSavedNotificationSoundRequestTypeID: "removeSavedNotificationSound#e363474e", - GetChatNotificationSettingsExceptionsRequestTypeID: "getChatNotificationSettingsExceptions#bfe0e11", - GetScopeNotificationSettingsRequestTypeID: "getScopeNotificationSettings#c4a8254f", - SetScopeNotificationSettingsRequestTypeID: "setScopeNotificationSettings#85cfb63a", - SetReactionNotificationSettingsRequestTypeID: "setReactionNotificationSettings#46b2d495", - ResetAllNotificationSettingsRequestTypeID: "resetAllNotificationSettings#f5a0a8f9", - ToggleChatIsPinnedRequestTypeID: "toggleChatIsPinned#a776263e", - SetPinnedChatsRequestTypeID: "setPinnedChats#c6c6edf1", - ReadChatListRequestTypeID: "readChatList#bd6498aa", - GetCurrentWeatherRequestTypeID: "getCurrentWeather#8ada9bc9", - GetStoryRequestTypeID: "getStory#717b1c78", - GetChatsToSendStoriesRequestTypeID: "getChatsToSendStories#22f9e3a4", - CanSendStoryRequestTypeID: "canSendStory#b6e0216b", - SendStoryRequestTypeID: "sendStory#e6ab3302", - EditStoryRequestTypeID: "editStory#5e6a21b1", - EditStoryCoverRequestTypeID: "editStoryCover#ab2a0c4b", - SetStoryPrivacySettingsRequestTypeID: "setStoryPrivacySettings#d8e94332", - ToggleStoryIsPostedToChatPageRequestTypeID: "toggleStoryIsPostedToChatPage#ee0f4aff", - DeleteStoryRequestTypeID: "deleteStory#9f35af16", - GetStoryNotificationSettingsExceptionsRequestTypeID: "getStoryNotificationSettingsExceptions#256a2eb0", - LoadActiveStoriesRequestTypeID: "loadActiveStories#7d8cf738", - SetChatActiveStoriesListRequestTypeID: "setChatActiveStoriesList#e0e35d11", - GetChatActiveStoriesRequestTypeID: "getChatActiveStories#2e4ffbf5", - GetChatPostedToChatPageStoriesRequestTypeID: "getChatPostedToChatPageStories#fd3bc72b", - GetChatArchivedStoriesRequestTypeID: "getChatArchivedStories#af1e9488", - SetChatPinnedStoriesRequestTypeID: "setChatPinnedStories#f5cb679f", - OpenStoryRequestTypeID: "openStory#ceda7c7d", - CloseStoryRequestTypeID: "closeStory#443d0f55", - GetStoryAvailableReactionsRequestTypeID: "getStoryAvailableReactions#23854d3b", - SetStoryReactionRequestTypeID: "setStoryReaction#ac8b4fa7", - GetStoryInteractionsRequestTypeID: "getStoryInteractions#1cd1400d", - GetChatStoryInteractionsRequestTypeID: "getChatStoryInteractions#c5ec7376", - ReportStoryRequestTypeID: "reportStory#78de7310", - ActivateStoryStealthModeRequestTypeID: "activateStoryStealthMode#c3db8491", - GetStoryPublicForwardsRequestTypeID: "getStoryPublicForwards#68f7dcbb", - GetChatBoostLevelFeaturesRequestTypeID: "getChatBoostLevelFeatures#45e63e8b", - GetChatBoostFeaturesRequestTypeID: "getChatBoostFeatures#e8c128a0", - GetAvailableChatBoostSlotsRequestTypeID: "getAvailableChatBoostSlots#7307ebd5", - GetChatBoostStatusRequestTypeID: "getChatBoostStatus#cfac8acf", - BoostChatRequestTypeID: "boostChat#890ccd68", - GetChatBoostLinkRequestTypeID: "getChatBoostLink#56f16c85", - GetChatBoostLinkInfoRequestTypeID: "getChatBoostLinkInfo#26fc4b5c", - GetChatBoostsRequestTypeID: "getChatBoosts#ab5eaa38", - GetUserChatBoostsRequestTypeID: "getUserChatBoosts#b90ee799", - GetAttachmentMenuBotRequestTypeID: "getAttachmentMenuBot#3da561fb", - ToggleBotIsAddedToAttachmentMenuRequestTypeID: "toggleBotIsAddedToAttachmentMenu#8e59de9a", - GetThemedEmojiStatusesRequestTypeID: "getThemedEmojiStatuses#6ac5c8c2", - GetRecentEmojiStatusesRequestTypeID: "getRecentEmojiStatuses#ae3a3d29", - GetDefaultEmojiStatusesRequestTypeID: "getDefaultEmojiStatuses#24e45ec3", - ClearRecentEmojiStatusesRequestTypeID: "clearRecentEmojiStatuses#e671cb5e", - GetThemedChatEmojiStatusesRequestTypeID: "getThemedChatEmojiStatuses#fb735cb5", - GetDefaultChatEmojiStatusesRequestTypeID: "getDefaultChatEmojiStatuses#a7aa86e6", - GetDisallowedChatEmojiStatusesRequestTypeID: "getDisallowedChatEmojiStatuses#d2144da0", - DownloadFileRequestTypeID: "downloadFile#3f253234", - GetFileDownloadedPrefixSizeRequestTypeID: "getFileDownloadedPrefixSize#3304bd2d", - CancelDownloadFileRequestTypeID: "cancelDownloadFile#8b8052de", - GetSuggestedFileNameRequestTypeID: "getSuggestedFileName#85d8a486", - PreliminaryUploadFileRequestTypeID: "preliminaryUploadFile#70e7cb99", - CancelPreliminaryUploadFileRequestTypeID: "cancelPreliminaryUploadFile#311446be", - WriteGeneratedFilePartRequestTypeID: "writeGeneratedFilePart#cc89e95", - SetFileGenerationProgressRequestTypeID: "setFileGenerationProgress#6d754b3e", - FinishFileGenerationRequestTypeID: "finishFileGeneration#c11d0c9d", - ReadFilePartRequestTypeID: "readFilePart#360ca70d", - DeleteFileRequestTypeID: "deleteFile#6bbe9b2c", - AddFileToDownloadsRequestTypeID: "addFileToDownloads#33b583b7", - ToggleDownloadIsPausedRequestTypeID: "toggleDownloadIsPaused#c7866715", - ToggleAllDownloadsArePausedRequestTypeID: "toggleAllDownloadsArePaused#4a989002", - RemoveFileFromDownloadsRequestTypeID: "removeFileFromDownloads#5706bfee", - RemoveAllFilesFromDownloadsRequestTypeID: "removeAllFilesFromDownloads#b9487686", - SearchFileDownloadsRequestTypeID: "searchFileDownloads#2a1e0856", - SetApplicationVerificationTokenRequestTypeID: "setApplicationVerificationToken#3744af85", - GetMessageFileTypeRequestTypeID: "getMessageFileType#e2c70fd4", - GetMessageImportConfirmationTextRequestTypeID: "getMessageImportConfirmationText#174881a8", - ImportMessagesRequestTypeID: "importMessages#7e98592b", - ReplacePrimaryChatInviteLinkRequestTypeID: "replacePrimaryChatInviteLink#3f9e7b9d", - CreateChatInviteLinkRequestTypeID: "createChatInviteLink#1126a341", - CreateChatSubscriptionInviteLinkRequestTypeID: "createChatSubscriptionInviteLink#226b65", - EditChatInviteLinkRequestTypeID: "editChatInviteLink#4eb23d7c", - EditChatSubscriptionInviteLinkRequestTypeID: "editChatSubscriptionInviteLink#c74445d3", - GetChatInviteLinkRequestTypeID: "getChatInviteLink#e36a41fd", - GetChatInviteLinkCountsRequestTypeID: "getChatInviteLinkCounts#3510e291", - GetChatInviteLinksRequestTypeID: "getChatInviteLinks#34a55cac", - GetChatInviteLinkMembersRequestTypeID: "getChatInviteLinkMembers#6704ed3c", - RevokeChatInviteLinkRequestTypeID: "revokeChatInviteLink#d1b755a9", - DeleteRevokedChatInviteLinkRequestTypeID: "deleteRevokedChatInviteLink#91270c7f", - DeleteAllRevokedChatInviteLinksRequestTypeID: "deleteAllRevokedChatInviteLinks#424816da", - CheckChatInviteLinkRequestTypeID: "checkChatInviteLink#e261483b", - JoinChatByInviteLinkRequestTypeID: "joinChatByInviteLink#c16aab86", - GetChatJoinRequestsRequestTypeID: "getChatJoinRequests#e8d90ea2", - ProcessChatJoinRequestRequestTypeID: "processChatJoinRequest#3be534a3", - ProcessChatJoinRequestsRequestTypeID: "processChatJoinRequests#3e823dce", - CreateCallRequestTypeID: "createCall#b4410c99", - AcceptCallRequestTypeID: "acceptCall#d97562d0", - SendCallSignalingDataRequestTypeID: "sendCallSignalingData#542db19c", - DiscardCallRequestTypeID: "discardCall#95a9a57e", - SendCallRatingRequestTypeID: "sendCallRating#d89b576c", - SendCallDebugInformationRequestTypeID: "sendCallDebugInformation#785b373f", - SendCallLogRequestTypeID: "sendCallLog#3f0a47d1", - GetVideoChatAvailableParticipantsRequestTypeID: "getVideoChatAvailableParticipants#c45da305", - SetVideoChatDefaultParticipantRequestTypeID: "setVideoChatDefaultParticipant#f1a672b3", - CreateVideoChatRequestTypeID: "createVideoChat#7ea4958d", - CreateGroupCallRequestTypeID: "createGroupCall#87b855fb", - GetVideoChatRtmpURLRequestTypeID: "getVideoChatRtmpUrl#482b1b1f", - ReplaceVideoChatRtmpURLRequestTypeID: "replaceVideoChatRtmpUrl#214f8fe0", - GetGroupCallRequestTypeID: "getGroupCall#5787668e", - StartScheduledGroupCallRequestTypeID: "startScheduledGroupCall#5a986d16", - ToggleGroupCallEnabledStartNotificationRequestTypeID: "toggleGroupCallEnabledStartNotification#2a30c752", - JoinGroupCallRequestTypeID: "joinGroupCall#c1c947e5", - StartGroupCallScreenSharingRequestTypeID: "startGroupCallScreenSharing#cb4e312d", - ToggleGroupCallScreenSharingIsPausedRequestTypeID: "toggleGroupCallScreenSharingIsPaused#a07b5360", - EndGroupCallScreenSharingRequestTypeID: "endGroupCallScreenSharing#85f41c4c", - SetGroupCallTitleRequestTypeID: "setGroupCallTitle#b6c19dcd", - ToggleGroupCallMuteNewParticipantsRequestTypeID: "toggleGroupCallMuteNewParticipants#10eec1c2", - InviteGroupCallParticipantsRequestTypeID: "inviteGroupCallParticipants#56c030a6", - GetGroupCallInviteLinkRequestTypeID: "getGroupCallInviteLink#2ae14924", - RevokeGroupCallInviteLinkRequestTypeID: "revokeGroupCallInviteLink#1de5a494", - StartGroupCallRecordingRequestTypeID: "startGroupCallRecording#68c5847b", - EndGroupCallRecordingRequestTypeID: "endGroupCallRecording#fb7b6289", - ToggleGroupCallIsMyVideoPausedRequestTypeID: "toggleGroupCallIsMyVideoPaused#e374f199", - ToggleGroupCallIsMyVideoEnabledRequestTypeID: "toggleGroupCallIsMyVideoEnabled#9f2f50fa", - SetGroupCallParticipantIsSpeakingRequestTypeID: "setGroupCallParticipantIsSpeaking#3748a1e5", - ToggleGroupCallParticipantIsMutedRequestTypeID: "toggleGroupCallParticipantIsMuted#b2081407", - SetGroupCallParticipantVolumeLevelRequestTypeID: "setGroupCallParticipantVolumeLevel#97779828", - ToggleGroupCallParticipantIsHandRaisedRequestTypeID: "toggleGroupCallParticipantIsHandRaised#8efb63e1", - LoadGroupCallParticipantsRequestTypeID: "loadGroupCallParticipants#37f3bece", - LeaveGroupCallRequestTypeID: "leaveGroupCall#3a6befa9", - EndGroupCallRequestTypeID: "endGroupCall#22294cb7", - GetGroupCallStreamsRequestTypeID: "getGroupCallStreams#9f7c9164", - GetGroupCallStreamSegmentRequestTypeID: "getGroupCallStreamSegment#8424daa5", - SetMessageSenderBlockListRequestTypeID: "setMessageSenderBlockList#898b5c91", - BlockMessageSenderFromRepliesRequestTypeID: "blockMessageSenderFromReplies#b79df58b", - GetBlockedMessageSendersRequestTypeID: "getBlockedMessageSenders#8ce52f16", - AddContactRequestTypeID: "addContact#6f707140", - ImportContactsRequestTypeID: "importContacts#77bdb718", - GetContactsRequestTypeID: "getContacts#ab7f4470", - SearchContactsRequestTypeID: "searchContacts#95073165", - RemoveContactsRequestTypeID: "removeContacts#b464dfff", - GetImportedContactCountRequestTypeID: "getImportedContactCount#d8e11a26", - ChangeImportedContactsRequestTypeID: "changeImportedContacts#24885905", - ClearImportedContactsRequestTypeID: "clearImportedContacts#33d39142", - SetCloseFriendsRequestTypeID: "setCloseFriends#7ff8f69f", - GetCloseFriendsRequestTypeID: "getCloseFriends#a9d574ce", - SetUserPersonalProfilePhotoRequestTypeID: "setUserPersonalProfilePhoto#1baa28f6", - SuggestUserProfilePhotoRequestTypeID: "suggestUserProfilePhoto#9561f463", - ToggleBotCanManageEmojiStatusRequestTypeID: "toggleBotCanManageEmojiStatus#251a881a", - SetUserEmojiStatusRequestTypeID: "setUserEmojiStatus#e5165bcb", - SearchUserByPhoneNumberRequestTypeID: "searchUserByPhoneNumber#eb82adc8", - SharePhoneNumberRequestTypeID: "sharePhoneNumber#4164e055", - GetUserProfilePhotosRequestTypeID: "getUserProfilePhotos#c9defe42", - GetStickerOutlineRequestTypeID: "getStickerOutline#a3952da5", - GetStickersRequestTypeID: "getStickers#45069343", - GetAllStickerEmojisRequestTypeID: "getAllStickerEmojis#11ad2e30", - SearchStickersRequestTypeID: "searchStickers#66428c3a", - GetGreetingStickersRequestTypeID: "getGreetingStickers#16581d1c", - GetPremiumStickersRequestTypeID: "getPremiumStickers#ef410a50", - GetInstalledStickerSetsRequestTypeID: "getInstalledStickerSets#612ef6f6", - GetArchivedStickerSetsRequestTypeID: "getArchivedStickerSets#3bb8424d", - GetTrendingStickerSetsRequestTypeID: "getTrendingStickerSets#e058455e", - GetAttachedStickerSetsRequestTypeID: "getAttachedStickerSets#4d9d930d", - GetStickerSetRequestTypeID: "getStickerSet#3eb91bc3", - GetStickerSetNameRequestTypeID: "getStickerSetName#3dfad681", - SearchStickerSetRequestTypeID: "searchStickerSet#63eec702", - SearchInstalledStickerSetsRequestTypeID: "searchInstalledStickerSets#7e5e7fa4", - SearchStickerSetsRequestTypeID: "searchStickerSets#faa066c", - ChangeStickerSetRequestTypeID: "changeStickerSet#1ac8a5ed", - ViewTrendingStickerSetsRequestTypeID: "viewTrendingStickerSets#36d6469", - ReorderInstalledStickerSetsRequestTypeID: "reorderInstalledStickerSets#4a830a78", - GetRecentStickersRequestTypeID: "getRecentStickers#dd73aa9f", - AddRecentStickerRequestTypeID: "addRecentSticker#a7e5d89e", - RemoveRecentStickerRequestTypeID: "removeRecentSticker#4a4d440d", - ClearRecentStickersRequestTypeID: "clearRecentStickers#ecda39c4", - GetFavoriteStickersRequestTypeID: "getFavoriteStickers#ebcbcf40", - AddFavoriteStickerRequestTypeID: "addFavoriteSticker#13578cdf", - RemoveFavoriteStickerRequestTypeID: "removeFavoriteSticker#44b88c70", - GetStickerEmojisRequestTypeID: "getStickerEmojis#8f04d547", - SearchEmojisRequestTypeID: "searchEmojis#d513cd61", - GetKeywordEmojisRequestTypeID: "getKeywordEmojis#7af81263", - GetEmojiCategoriesRequestTypeID: "getEmojiCategories#7f86c16e", - GetAnimatedEmojiRequestTypeID: "getAnimatedEmoji#3f844f76", - GetEmojiSuggestionsURLRequestTypeID: "getEmojiSuggestionsUrl#ac4f1b2f", - GetCustomEmojiStickersRequestTypeID: "getCustomEmojiStickers#a5156885", - GetDefaultChatPhotoCustomEmojiStickersRequestTypeID: "getDefaultChatPhotoCustomEmojiStickers#e9917765", - GetDefaultProfilePhotoCustomEmojiStickersRequestTypeID: "getDefaultProfilePhotoCustomEmojiStickers#4c4be2b7", - GetDefaultBackgroundCustomEmojiStickersRequestTypeID: "getDefaultBackgroundCustomEmojiStickers#1cf6680e", - GetSavedAnimationsRequestTypeID: "getSavedAnimations#6b9718", - AddSavedAnimationRequestTypeID: "addSavedAnimation#a44bf860", - RemoveSavedAnimationRequestTypeID: "removeSavedAnimation#e275a919", - GetRecentInlineBotsRequestTypeID: "getRecentInlineBots#55b3723c", - GetOwnedBotsRequestTypeID: "getOwnedBots#8b87c7fd", - SearchHashtagsRequestTypeID: "searchHashtags#3e34a571", - RemoveRecentHashtagRequestTypeID: "removeRecentHashtag#c393a0a4", - GetLinkPreviewRequestTypeID: "getLinkPreview#c2096321", - GetWebPageInstantViewRequestTypeID: "getWebPageInstantView#8b045689", - SetProfilePhotoRequestTypeID: "setProfilePhoto#85ea05ed", - DeleteProfilePhotoRequestTypeID: "deleteProfilePhoto#4eaa77c1", - SetAccentColorRequestTypeID: "setAccentColor#6389cb39", - SetProfileAccentColorRequestTypeID: "setProfileAccentColor#899bc168", - SetNameRequestTypeID: "setName#66065f10", - SetBioRequestTypeID: "setBio#9f772354", - SetUsernameRequestTypeID: "setUsername#1a385c1e", - ToggleUsernameIsActiveRequestTypeID: "toggleUsernameIsActive#4a276de3", - ReorderActiveUsernamesRequestTypeID: "reorderActiveUsernames#c659414f", - SetBirthdateRequestTypeID: "setBirthdate#4ea9dd98", - SetPersonalChatRequestTypeID: "setPersonalChat#c04babb4", - SetEmojiStatusRequestTypeID: "setEmojiStatus#92f83e5d", - ToggleHasSponsoredMessagesEnabledRequestTypeID: "toggleHasSponsoredMessagesEnabled#75055cec", - SetBusinessLocationRequestTypeID: "setBusinessLocation#eb740715", - SetBusinessOpeningHoursRequestTypeID: "setBusinessOpeningHours#e470a472", - SetBusinessGreetingMessageSettingsRequestTypeID: "setBusinessGreetingMessageSettings#cbf53c3d", - SetBusinessAwayMessageSettingsRequestTypeID: "setBusinessAwayMessageSettings#4974486c", - SetBusinessStartPageRequestTypeID: "setBusinessStartPage#9eed499e", - SendPhoneNumberCodeRequestTypeID: "sendPhoneNumberCode#409e3d10", - SendPhoneNumberFirebaseSMSRequestTypeID: "sendPhoneNumberFirebaseSms#f9c7084", - ReportPhoneNumberCodeMissingRequestTypeID: "reportPhoneNumberCodeMissing#caa4b553", - ResendPhoneNumberCodeRequestTypeID: "resendPhoneNumberCode#6bcea427", - CheckPhoneNumberCodeRequestTypeID: "checkPhoneNumberCode#dc0565a1", - GetBusinessConnectedBotRequestTypeID: "getBusinessConnectedBot#364da7c3", - SetBusinessConnectedBotRequestTypeID: "setBusinessConnectedBot#acf17ef0", - DeleteBusinessConnectedBotRequestTypeID: "deleteBusinessConnectedBot#9e9b7e55", - ToggleBusinessConnectedBotChatIsPausedRequestTypeID: "toggleBusinessConnectedBotChatIsPaused#4f364845", - RemoveBusinessConnectedBotFromChatRequestTypeID: "removeBusinessConnectedBotFromChat#787273f3", - GetBusinessChatLinksRequestTypeID: "getBusinessChatLinks#2a562157", - CreateBusinessChatLinkRequestTypeID: "createBusinessChatLink#91131d40", - EditBusinessChatLinkRequestTypeID: "editBusinessChatLink#5f10f626", - DeleteBusinessChatLinkRequestTypeID: "deleteBusinessChatLink#be526747", - GetBusinessChatLinkInfoRequestTypeID: "getBusinessChatLinkInfo#2f8b7e4a", - GetUserLinkRequestTypeID: "getUserLink#492014e6", - SearchUserByTokenRequestTypeID: "searchUserByToken#d841f436", - SetCommandsRequestTypeID: "setCommands#b0e0217a", - DeleteCommandsRequestTypeID: "deleteCommands#3bc47c2a", - GetCommandsRequestTypeID: "getCommands#58ba8ff7", - SetMenuButtonRequestTypeID: "setMenuButton#b44fc141", - GetMenuButtonRequestTypeID: "getMenuButton#e5eef440", - SetDefaultGroupAdministratorRightsRequestTypeID: "setDefaultGroupAdministratorRights#65577768", - SetDefaultChannelAdministratorRightsRequestTypeID: "setDefaultChannelAdministratorRights#f20d5e19", - CanBotSendMessagesRequestTypeID: "canBotSendMessages#206d948c", - AllowBotToSendMessagesRequestTypeID: "allowBotToSendMessages#69e9c58e", - SendWebAppCustomRequestRequestTypeID: "sendWebAppCustomRequest#36ff5dc8", - GetBotMediaPreviewsRequestTypeID: "getBotMediaPreviews#22665458", - GetBotMediaPreviewInfoRequestTypeID: "getBotMediaPreviewInfo#50f60136", - AddBotMediaPreviewRequestTypeID: "addBotMediaPreview#504b852b", - EditBotMediaPreviewRequestTypeID: "editBotMediaPreview#86955d62", - ReorderBotMediaPreviewsRequestTypeID: "reorderBotMediaPreviews#89ea0cc6", - DeleteBotMediaPreviewsRequestTypeID: "deleteBotMediaPreviews#f7d259db", - SetBotNameRequestTypeID: "setBotName#d295fa71", - GetBotNameRequestTypeID: "getBotName#9a3f722c", - SetBotProfilePhotoRequestTypeID: "setBotProfilePhoto#bd864b66", - ToggleBotUsernameIsActiveRequestTypeID: "toggleBotUsernameIsActive#79639409", - ReorderBotActiveUsernamesRequestTypeID: "reorderBotActiveUsernames#acadc444", - SetBotInfoDescriptionRequestTypeID: "setBotInfoDescription#29571d48", - GetBotInfoDescriptionRequestTypeID: "getBotInfoDescription#d287f835", - SetBotInfoShortDescriptionRequestTypeID: "setBotInfoShortDescription#3a96bae3", - GetBotInfoShortDescriptionRequestTypeID: "getBotInfoShortDescription#4a1c2614", - SetMessageSenderBotVerificationRequestTypeID: "setMessageSenderBotVerification#b4c1da4a", - RemoveMessageSenderBotVerificationRequestTypeID: "removeMessageSenderBotVerification#9a10cf5a", - GetActiveSessionsRequestTypeID: "getActiveSessions#42bd6d3e", - TerminateSessionRequestTypeID: "terminateSession#e7b7c92c", - TerminateAllOtherSessionsRequestTypeID: "terminateAllOtherSessions#6fba6113", - ConfirmSessionRequestTypeID: "confirmSession#d7c9b41f", - ToggleSessionCanAcceptCallsRequestTypeID: "toggleSessionCanAcceptCalls#6c6c2708", - ToggleSessionCanAcceptSecretChatsRequestTypeID: "toggleSessionCanAcceptSecretChats#3ba7a87e", - SetInactiveSessionTTLRequestTypeID: "setInactiveSessionTtl#5d9ca950", - GetConnectedWebsitesRequestTypeID: "getConnectedWebsites#f5d5d352", - DisconnectWebsiteRequestTypeID: "disconnectWebsite#d194f3dd", - DisconnectAllWebsitesRequestTypeID: "disconnectAllWebsites#bf72f203", - SetSupergroupUsernameRequestTypeID: "setSupergroupUsername#503f4b04", - ToggleSupergroupUsernameIsActiveRequestTypeID: "toggleSupergroupUsernameIsActive#a68b6dff", - DisableAllSupergroupUsernamesRequestTypeID: "disableAllSupergroupUsernames#3246f5b0", - ReorderSupergroupActiveUsernamesRequestTypeID: "reorderSupergroupActiveUsernames#663c7f3b", - SetSupergroupStickerSetRequestTypeID: "setSupergroupStickerSet#856ead69", - SetSupergroupCustomEmojiStickerSetRequestTypeID: "setSupergroupCustomEmojiStickerSet#4f3552af", - SetSupergroupUnrestrictBoostCountRequestTypeID: "setSupergroupUnrestrictBoostCount#39ce30a3", - ToggleSupergroupSignMessagesRequestTypeID: "toggleSupergroupSignMessages#221c1fcb", - ToggleSupergroupJoinToSendMessagesRequestTypeID: "toggleSupergroupJoinToSendMessages#f5268e0e", - ToggleSupergroupJoinByRequestRequestTypeID: "toggleSupergroupJoinByRequest#7ddf9fde", - ToggleSupergroupIsAllHistoryAvailableRequestTypeID: "toggleSupergroupIsAllHistoryAvailable#44d9964e", - ToggleSupergroupCanHaveSponsoredMessagesRequestTypeID: "toggleSupergroupCanHaveSponsoredMessages#be8abb72", - ToggleSupergroupHasHiddenMembersRequestTypeID: "toggleSupergroupHasHiddenMembers#a4559dca", - ToggleSupergroupHasAggressiveAntiSpamEnabledRequestTypeID: "toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f", - ToggleSupergroupIsForumRequestTypeID: "toggleSupergroupIsForum#966f960a", - ToggleSupergroupIsBroadcastGroupRequestTypeID: "toggleSupergroupIsBroadcastGroup#34b22215", - ReportSupergroupSpamRequestTypeID: "reportSupergroupSpam#383e26f2", - ReportSupergroupAntiSpamFalsePositiveRequestTypeID: "reportSupergroupAntiSpamFalsePositive#e13db048", - GetSupergroupMembersRequestTypeID: "getSupergroupMembers#ddf821c8", - CloseSecretChatRequestTypeID: "closeSecretChat#e3ed044b", - GetChatEventLogRequestTypeID: "getChatEventLog#f47b0a9b", - GetTimeZonesRequestTypeID: "getTimeZones#4fe2e058", - GetPaymentFormRequestTypeID: "getPaymentForm#8d4f76d4", - ValidateOrderInfoRequestTypeID: "validateOrderInfo#b5985fcf", - SendPaymentFormRequestTypeID: "sendPaymentForm#c66e388a", - GetPaymentReceiptRequestTypeID: "getPaymentReceipt#3c6cb956", - GetSavedOrderInfoRequestTypeID: "getSavedOrderInfo#bb559edd", - DeleteSavedOrderInfoRequestTypeID: "deleteSavedOrderInfo#61197474", - DeleteSavedCredentialsRequestTypeID: "deleteSavedCredentials#314056d2", - GetAvailableGiftsRequestTypeID: "getAvailableGifts#f6d565eb", - SendGiftRequestTypeID: "sendGift#13a97db", - SellGiftRequestTypeID: "sellGift#671b88b4", - ToggleGiftIsSavedRequestTypeID: "toggleGiftIsSaved#91c2f183", - GetGiftUpgradePreviewRequestTypeID: "getGiftUpgradePreview#bdcbc25d", - UpgradeGiftRequestTypeID: "upgradeGift#e0c0953e", - TransferGiftRequestTypeID: "transferGift#7f379a4e", - GetUserGiftsRequestTypeID: "getUserGifts#b7cdbc7c", - GetUserGiftRequestTypeID: "getUserGift#74e6a939", - CreateInvoiceLinkRequestTypeID: "createInvoiceLink#cf70c867", - RefundStarPaymentRequestTypeID: "refundStarPayment#9476a055", - GetSupportUserRequestTypeID: "getSupportUser#98acec9c", - GetBackgroundURLRequestTypeID: "getBackgroundUrl#2bbc6fd2", - SearchBackgroundRequestTypeID: "searchBackground#80fb9121", - SetDefaultBackgroundRequestTypeID: "setDefaultBackground#89d1a8a1", - DeleteDefaultBackgroundRequestTypeID: "deleteDefaultBackground#b2a4ed3e", - GetInstalledBackgroundsRequestTypeID: "getInstalledBackgrounds#c154d05f", - RemoveInstalledBackgroundRequestTypeID: "removeInstalledBackground#5041253c", - ResetInstalledBackgroundsRequestTypeID: "resetInstalledBackgrounds#70540157", - GetLocalizationTargetInfoRequestTypeID: "getLocalizationTargetInfo#6e3d1f86", - GetLanguagePackInfoRequestTypeID: "getLanguagePackInfo#7bd8daa8", - GetLanguagePackStringsRequestTypeID: "getLanguagePackStrings#b0b867bb", - SynchronizeLanguagePackRequestTypeID: "synchronizeLanguagePack#84e5e72e", - AddCustomServerLanguagePackRequestTypeID: "addCustomServerLanguagePack#448de3", - SetCustomLanguagePackRequestTypeID: "setCustomLanguagePack#234b0607", - EditCustomLanguagePackInfoRequestTypeID: "editCustomLanguagePackInfo#4eb91099", - SetCustomLanguagePackStringRequestTypeID: "setCustomLanguagePackString#4e762518", - DeleteLanguagePackRequestTypeID: "deleteLanguagePack#824edc3e", - RegisterDeviceRequestTypeID: "registerDevice#ff140196", - ProcessPushNotificationRequestTypeID: "processPushNotification#2ee3c890", - GetPushReceiverIDRequestTypeID: "getPushReceiverId#eeec46b2", - GetRecentlyVisitedTMeURLsRequestTypeID: "getRecentlyVisitedTMeUrls#30161a91", - SetUserPrivacySettingRulesRequestTypeID: "setUserPrivacySettingRules#e3c230fb", - GetUserPrivacySettingRulesRequestTypeID: "getUserPrivacySettingRules#84301671", - SetReadDatePrivacySettingsRequestTypeID: "setReadDatePrivacySettings#1d7086b6", - GetReadDatePrivacySettingsRequestTypeID: "getReadDatePrivacySettings#1ae85bbb", - SetNewChatPrivacySettingsRequestTypeID: "setNewChatPrivacySettings#69bf374f", - GetNewChatPrivacySettingsRequestTypeID: "getNewChatPrivacySettings#b2cb4bb7", - CanSendMessageToUserRequestTypeID: "canSendMessageToUser#5b2a2836", - GetOptionRequestTypeID: "getOption#a2459e7e", - SetOptionRequestTypeID: "setOption#7e0b4ef2", - SetAccountTTLRequestTypeID: "setAccountTtl#29ce58e8", - GetAccountTTLRequestTypeID: "getAccountTtl#e58a8b77", - DeleteAccountRequestTypeID: "deleteAccount#533276c6", - SetDefaultMessageAutoDeleteTimeRequestTypeID: "setDefaultMessageAutoDeleteTime#965cd36c", - GetDefaultMessageAutoDeleteTimeRequestTypeID: "getDefaultMessageAutoDeleteTime#e520759a", - RemoveChatActionBarRequestTypeID: "removeChatActionBar#9d9839fa", - ReportChatRequestTypeID: "reportChat#54f7972f", - ReportChatPhotoRequestTypeID: "reportChatPhoto#d9701288", - ReportMessageReactionsRequestTypeID: "reportMessageReactions#36c88827", - GetChatRevenueStatisticsRequestTypeID: "getChatRevenueStatistics#29d79b3c", - GetChatRevenueWithdrawalURLRequestTypeID: "getChatRevenueWithdrawalUrl#1e320720", - GetChatRevenueTransactionsRequestTypeID: "getChatRevenueTransactions#472f0715", - GetStarRevenueStatisticsRequestTypeID: "getStarRevenueStatistics#f07b4517", - GetStarWithdrawalURLRequestTypeID: "getStarWithdrawalUrl#a9d23712", - GetStarAdAccountURLRequestTypeID: "getStarAdAccountUrl#73a9455d", - GetChatStatisticsRequestTypeID: "getChatStatistics#137e8198", - GetMessageStatisticsRequestTypeID: "getMessageStatistics#4bb5a1d8", - GetMessagePublicForwardsRequestTypeID: "getMessagePublicForwards#519da4b4", - GetStoryStatisticsRequestTypeID: "getStoryStatistics#3a964342", - GetStatisticalGraphRequestTypeID: "getStatisticalGraph#419f8d9b", - GetStorageStatisticsRequestTypeID: "getStorageStatistics#cd254b37", - GetStorageStatisticsFastRequestTypeID: "getStorageStatisticsFast#3a86702", - GetDatabaseStatisticsRequestTypeID: "getDatabaseStatistics#8c33d4b9", - OptimizeStorageRequestTypeID: "optimizeStorage#ef73c8c5", - SetNetworkTypeRequestTypeID: "setNetworkType#d62de55e", - GetNetworkStatisticsRequestTypeID: "getNetworkStatistics#c537581e", - AddNetworkStatisticsRequestTypeID: "addNetworkStatistics#4b63b3d9", - ResetNetworkStatisticsRequestTypeID: "resetNetworkStatistics#6222dd86", - GetAutoDownloadSettingsPresetsRequestTypeID: "getAutoDownloadSettingsPresets#996a4737", - SetAutoDownloadSettingsRequestTypeID: "setAutoDownloadSettings#eaeb64f4", - GetAutosaveSettingsRequestTypeID: "getAutosaveSettings#7f53f22a", - SetAutosaveSettingsRequestTypeID: "setAutosaveSettings#6878c0", - ClearAutosaveSettingsExceptionsRequestTypeID: "clearAutosaveSettingsExceptions#57ec63f2", - GetBankCardInfoRequestTypeID: "getBankCardInfo#b1e31db0", - GetPassportElementRequestTypeID: "getPassportElement#8fcce17a", - GetAllPassportElementsRequestTypeID: "getAllPassportElements#86782aeb", - SetPassportElementRequestTypeID: "setPassportElement#7b45d19c", - DeletePassportElementRequestTypeID: "deletePassportElement#9981aa74", - SetPassportElementErrorsRequestTypeID: "setPassportElementErrors#80fa80bf", - GetPreferredCountryLanguageRequestTypeID: "getPreferredCountryLanguage#c862cbd6", - SendEmailAddressVerificationCodeRequestTypeID: "sendEmailAddressVerificationCode#f2ca537d", - ResendEmailAddressVerificationCodeRequestTypeID: "resendEmailAddressVerificationCode#90653024", - CheckEmailAddressVerificationCodeRequestTypeID: "checkEmailAddressVerificationCode#e695db03", - GetPassportAuthorizationFormRequestTypeID: "getPassportAuthorizationForm#61850486", - GetPassportAuthorizationFormAvailableElementsRequestTypeID: "getPassportAuthorizationFormAvailableElements#3fb314fc", - SendPassportAuthorizationFormRequestTypeID: "sendPassportAuthorizationForm#d9c77579", - SetBotUpdatesStatusRequestTypeID: "setBotUpdatesStatus#bb293991", - UploadStickerFileRequestTypeID: "uploadStickerFile#269650c3", - GetSuggestedStickerSetNameRequestTypeID: "getSuggestedStickerSetName#b0120840", - CheckStickerSetNameRequestTypeID: "checkStickerSetName#955808fe", - CreateNewStickerSetRequestTypeID: "createNewStickerSet#87fd8611", - AddStickerToSetRequestTypeID: "addStickerToSet#56dc1e3b", - ReplaceStickerInSetRequestTypeID: "replaceStickerInSet#e7c82e19", - SetStickerSetThumbnailRequestTypeID: "setStickerSetThumbnail#63fe6932", - SetCustomEmojiStickerSetThumbnailRequestTypeID: "setCustomEmojiStickerSetThumbnail#bd12e0ea", - SetStickerSetTitleRequestTypeID: "setStickerSetTitle#64e933a2", - DeleteStickerSetRequestTypeID: "deleteStickerSet#5e0a7bad", - SetStickerPositionInSetRequestTypeID: "setStickerPositionInSet#7bb24721", - RemoveStickerFromSetRequestTypeID: "removeStickerFromSet#61e1eea4", - SetStickerEmojisRequestTypeID: "setStickerEmojis#d9ec0431", - SetStickerKeywordsRequestTypeID: "setStickerKeywords#462481d", - SetStickerMaskPositionRequestTypeID: "setStickerMaskPosition#47a959d0", - GetOwnedStickerSetsRequestTypeID: "getOwnedStickerSets#58fe8120", - GetMapThumbnailFileRequestTypeID: "getMapThumbnailFile#f6e6979a", - GetPremiumLimitRequestTypeID: "getPremiumLimit#4017fcea", - GetPremiumFeaturesRequestTypeID: "getPremiumFeatures#b4dc2649", - GetPremiumStickerExamplesRequestTypeID: "getPremiumStickerExamples#5369cb98", - GetPremiumInfoStickerRequestTypeID: "getPremiumInfoSticker#79ce4a9b", - ViewPremiumFeatureRequestTypeID: "viewPremiumFeature#b8031b2", - ClickPremiumSubscriptionButtonRequestTypeID: "clickPremiumSubscriptionButton#e9fca306", - GetPremiumStateRequestTypeID: "getPremiumState#278e3ae2", - GetPremiumGiftCodePaymentOptionsRequestTypeID: "getPremiumGiftCodePaymentOptions#89523a2c", - CheckPremiumGiftCodeRequestTypeID: "checkPremiumGiftCode#958ad664", - ApplyPremiumGiftCodeRequestTypeID: "applyPremiumGiftCode#afb44c1e", - LaunchPrepaidGiveawayRequestTypeID: "launchPrepaidGiveaway#261d783a", - GetGiveawayInfoRequestTypeID: "getGiveawayInfo#b78790bb", - GetStarPaymentOptionsRequestTypeID: "getStarPaymentOptions#6d930644", - GetStarGiftPaymentOptionsRequestTypeID: "getStarGiftPaymentOptions#e22760e3", - GetStarGiveawayPaymentOptionsRequestTypeID: "getStarGiveawayPaymentOptions#cb5bdb1e", - GetStarTransactionsRequestTypeID: "getStarTransactions#f096f8f1", - GetStarSubscriptionsRequestTypeID: "getStarSubscriptions#d9c7b2ec", - CanPurchaseFromStoreRequestTypeID: "canPurchaseFromStore#3caa9368", - AssignAppStoreTransactionRequestTypeID: "assignAppStoreTransaction#86f30bb0", - AssignGooglePlayTransactionRequestTypeID: "assignGooglePlayTransaction#8939bca4", - EditStarSubscriptionRequestTypeID: "editStarSubscription#7a1a3918", - EditUserStarSubscriptionRequestTypeID: "editUserStarSubscription#51b16e89", - ReuseStarSubscriptionRequestTypeID: "reuseStarSubscription#2e677441", - SetChatAffiliateProgramRequestTypeID: "setChatAffiliateProgram#e00237", - SearchChatAffiliateProgramRequestTypeID: "searchChatAffiliateProgram#b02c09ba", - SearchAffiliateProgramsRequestTypeID: "searchAffiliatePrograms#2899a011", - ConnectAffiliateProgramRequestTypeID: "connectAffiliateProgram#6306d72c", - DisconnectAffiliateProgramRequestTypeID: "disconnectAffiliateProgram#f9b124fc", - GetConnectedAffiliateProgramRequestTypeID: "getConnectedAffiliateProgram#9761e770", - GetConnectedAffiliateProgramsRequestTypeID: "getConnectedAffiliatePrograms#8b2c5272", - GetBusinessFeaturesRequestTypeID: "getBusinessFeatures#c4906001", - AcceptTermsOfServiceRequestTypeID: "acceptTermsOfService#7efe03e4", - SearchStringsByPrefixRequestTypeID: "searchStringsByPrefix#a8145813", - SendCustomRequestRequestTypeID: "sendCustomRequest#10fd71a1", - AnswerCustomQueryRequestTypeID: "answerCustomQuery#b2e52d3f", - SetAlarmRequestTypeID: "setAlarm#cbef7e15", - GetCountriesRequestTypeID: "getCountries#fce8099e", - GetCountryCodeRequestTypeID: "getCountryCode#5bd398f2", - GetPhoneNumberInfoRequestTypeID: "getPhoneNumberInfo#a0229bf9", - GetPhoneNumberInfoSyncRequestTypeID: "getPhoneNumberInfoSync#209b7d38", - GetCollectibleItemInfoRequestTypeID: "getCollectibleItemInfo#f304ad8a", - GetDeepLinkInfoRequestTypeID: "getDeepLinkInfo#28923f7e", - GetApplicationConfigRequestTypeID: "getApplicationConfig#93550682", - SaveApplicationLogEventRequestTypeID: "saveApplicationLogEvent#cfa6c20e", - GetApplicationDownloadLinkRequestTypeID: "getApplicationDownloadLink#6ad2fc4", - AddProxyRequestTypeID: "addProxy#13c2bcd8", - EditProxyRequestTypeID: "editProxy#a0482853", - EnableProxyRequestTypeID: "enableProxy#59138296", - DisableProxyRequestTypeID: "disableProxy#82d31782", - RemoveProxyRequestTypeID: "removeProxy#519ca307", - GetProxiesRequestTypeID: "getProxies#fa560333", - GetProxyLinkRequestTypeID: "getProxyLink#c125ae78", - PingProxyRequestTypeID: "pingProxy#c59b40b1", - SetLogStreamRequestTypeID: "setLogStream#aeaff791", - GetLogStreamRequestTypeID: "getLogStream#45984b5b", - SetLogVerbosityLevelRequestTypeID: "setLogVerbosityLevel#edea07d2", - GetLogVerbosityLevelRequestTypeID: "getLogVerbosityLevel#23689ae4", - GetLogTagsRequestTypeID: "getLogTags#f0d569da", - SetLogTagVerbosityLevelRequestTypeID: "setLogTagVerbosityLevel#8317d696", - GetLogTagVerbosityLevelRequestTypeID: "getLogTagVerbosityLevel#38af2d83", - AddLogMessageRequestTypeID: "addLogMessage#5f36cfec", - GetUserSupportInfoRequestTypeID: "getUserSupportInfo#74a59305", - SetUserSupportInfoRequestTypeID: "setUserSupportInfo#837c9803", - GetSupportNameRequestTypeID: "getSupportName#4d9e1562", - TestCallEmptyRequestTypeID: "testCallEmpty#da9c4a16", - TestCallStringRequestTypeID: "testCallString#98b74a2f", - TestCallBytesRequestTypeID: "testCallBytes#d4215aa9", - TestCallVectorIntRequestTypeID: "testCallVectorInt#65ed7e72", - TestCallVectorIntObjectRequestTypeID: "testCallVectorIntObject#ca57f472", - TestCallVectorStringRequestTypeID: "testCallVectorString#8e5a6ed8", - TestCallVectorStringObjectRequestTypeID: "testCallVectorStringObject#96cd6de", - TestSquareIntRequestTypeID: "testSquareInt#fc6a6990", - TestNetworkRequestTypeID: "testNetwork#afe4344b", - TestProxyRequestTypeID: "testProxy#b8a1a29e", - TestGetDifferenceRequestTypeID: "testGetDifference#68226325", - TestUseUpdateRequestTypeID: "testUseUpdate#2abdff1e", - TestReturnErrorRequestTypeID: "testReturnError#1b217cf2", - } -} - -// NamesMap returns mapping from type names to TL type ids. -func NamesMap() map[string]uint32 { - return map[string]uint32{ - "double": DoubleTypeID, - "string": StringTypeID, - "int32": Int32TypeID, - "int53": Int53TypeID, - "int64": Int64TypeID, - "bytes": BytesTypeID, - "boolFalse": BoolFalseTypeID, - "boolTrue": BoolTrueTypeID, - "error": ErrorTypeID, - "ok": OkTypeID, - "authenticationCodeTypeTelegramMessage": AuthenticationCodeTypeTelegramMessageTypeID, - "authenticationCodeTypeSms": AuthenticationCodeTypeSMSTypeID, - "authenticationCodeTypeSmsWord": AuthenticationCodeTypeSMSWordTypeID, - "authenticationCodeTypeSmsPhrase": AuthenticationCodeTypeSMSPhraseTypeID, - "authenticationCodeTypeCall": AuthenticationCodeTypeCallTypeID, - "authenticationCodeTypeFlashCall": AuthenticationCodeTypeFlashCallTypeID, - "authenticationCodeTypeMissedCall": AuthenticationCodeTypeMissedCallTypeID, - "authenticationCodeTypeFragment": AuthenticationCodeTypeFragmentTypeID, - "authenticationCodeTypeFirebaseAndroid": AuthenticationCodeTypeFirebaseAndroidTypeID, - "authenticationCodeTypeFirebaseIos": AuthenticationCodeTypeFirebaseIosTypeID, - "authenticationCodeInfo": AuthenticationCodeInfoTypeID, - "emailAddressAuthenticationCodeInfo": EmailAddressAuthenticationCodeInfoTypeID, - "emailAddressAuthenticationCode": EmailAddressAuthenticationCodeTypeID, - "emailAddressAuthenticationAppleId": EmailAddressAuthenticationAppleIDTypeID, - "emailAddressAuthenticationGoogleId": EmailAddressAuthenticationGoogleIDTypeID, - "emailAddressResetStateAvailable": EmailAddressResetStateAvailableTypeID, - "emailAddressResetStatePending": EmailAddressResetStatePendingTypeID, - "textEntity": TextEntityTypeID, - "textEntities": TextEntitiesTypeID, - "formattedText": FormattedTextTypeID, - "termsOfService": TermsOfServiceTypeID, - "authorizationStateWaitTdlibParameters": AuthorizationStateWaitTdlibParametersTypeID, - "authorizationStateWaitPhoneNumber": AuthorizationStateWaitPhoneNumberTypeID, - "authorizationStateWaitEmailAddress": AuthorizationStateWaitEmailAddressTypeID, - "authorizationStateWaitEmailCode": AuthorizationStateWaitEmailCodeTypeID, - "authorizationStateWaitCode": AuthorizationStateWaitCodeTypeID, - "authorizationStateWaitOtherDeviceConfirmation": AuthorizationStateWaitOtherDeviceConfirmationTypeID, - "authorizationStateWaitRegistration": AuthorizationStateWaitRegistrationTypeID, - "authorizationStateWaitPassword": AuthorizationStateWaitPasswordTypeID, - "authorizationStateReady": AuthorizationStateReadyTypeID, - "authorizationStateLoggingOut": AuthorizationStateLoggingOutTypeID, - "authorizationStateClosing": AuthorizationStateClosingTypeID, - "authorizationStateClosed": AuthorizationStateClosedTypeID, - "firebaseDeviceVerificationParametersSafetyNet": FirebaseDeviceVerificationParametersSafetyNetTypeID, - "firebaseDeviceVerificationParametersPlayIntegrity": FirebaseDeviceVerificationParametersPlayIntegrityTypeID, - "passwordState": PasswordStateTypeID, - "recoveryEmailAddress": RecoveryEmailAddressTypeID, - "temporaryPasswordState": TemporaryPasswordStateTypeID, - "localFile": LocalFileTypeID, - "remoteFile": RemoteFileTypeID, - "file": FileTypeID, - "inputFileId": InputFileIDTypeID, - "inputFileRemote": InputFileRemoteTypeID, - "inputFileLocal": InputFileLocalTypeID, - "inputFileGenerated": InputFileGeneratedTypeID, - "photoSize": PhotoSizeTypeID, - "minithumbnail": MinithumbnailTypeID, - "thumbnailFormatJpeg": ThumbnailFormatJpegTypeID, - "thumbnailFormatGif": ThumbnailFormatGifTypeID, - "thumbnailFormatMpeg4": ThumbnailFormatMpeg4TypeID, - "thumbnailFormatPng": ThumbnailFormatPngTypeID, - "thumbnailFormatTgs": ThumbnailFormatTgsTypeID, - "thumbnailFormatWebm": ThumbnailFormatWebmTypeID, - "thumbnailFormatWebp": ThumbnailFormatWebpTypeID, - "thumbnail": ThumbnailTypeID, - "maskPointForehead": MaskPointForeheadTypeID, - "maskPointEyes": MaskPointEyesTypeID, - "maskPointMouth": MaskPointMouthTypeID, - "maskPointChin": MaskPointChinTypeID, - "maskPosition": MaskPositionTypeID, - "stickerFormatWebp": StickerFormatWebpTypeID, - "stickerFormatTgs": StickerFormatTgsTypeID, - "stickerFormatWebm": StickerFormatWebmTypeID, - "stickerTypeRegular": StickerTypeRegularTypeID, - "stickerTypeMask": StickerTypeMaskTypeID, - "stickerTypeCustomEmoji": StickerTypeCustomEmojiTypeID, - "stickerFullTypeRegular": StickerFullTypeRegularTypeID, - "stickerFullTypeMask": StickerFullTypeMaskTypeID, - "stickerFullTypeCustomEmoji": StickerFullTypeCustomEmojiTypeID, - "closedVectorPath": ClosedVectorPathTypeID, - "outline": OutlineTypeID, - "pollOption": PollOptionTypeID, - "pollTypeRegular": PollTypeRegularTypeID, - "pollTypeQuiz": PollTypeQuizTypeID, - "animation": AnimationTypeID, - "audio": AudioTypeID, - "document": DocumentTypeID, - "photo": PhotoTypeID, - "sticker": StickerTypeID, - "video": VideoTypeID, - "videoNote": VideoNoteTypeID, - "voiceNote": VoiceNoteTypeID, - "animatedEmoji": AnimatedEmojiTypeID, - "contact": ContactTypeID, - "location": LocationTypeID, - "venue": VenueTypeID, - "game": GameTypeID, - "webApp": WebAppTypeID, - "poll": PollTypeID, - "alternativeVideo": AlternativeVideoTypeID, - "background": BackgroundTypeID, - "backgrounds": BackgroundsTypeID, - "chatBackground": ChatBackgroundTypeID, - "profilePhoto": ProfilePhotoTypeID, - "chatPhotoInfo": ChatPhotoInfoTypeID, - "userTypeRegular": UserTypeRegularTypeID, - "userTypeDeleted": UserTypeDeletedTypeID, - "userTypeBot": UserTypeBotTypeID, - "userTypeUnknown": UserTypeUnknownTypeID, - "botCommand": BotCommandTypeID, - "botCommands": BotCommandsTypeID, - "botMenuButton": BotMenuButtonTypeID, - "botVerificationParameters": BotVerificationParametersTypeID, - "botVerification": BotVerificationTypeID, - "verificationStatus": VerificationStatusTypeID, - "chatLocation": ChatLocationTypeID, - "birthdate": BirthdateTypeID, - "closeBirthdayUser": CloseBirthdayUserTypeID, - "businessAwayMessageScheduleAlways": BusinessAwayMessageScheduleAlwaysTypeID, - "businessAwayMessageScheduleOutsideOfOpeningHours": BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID, - "businessAwayMessageScheduleCustom": BusinessAwayMessageScheduleCustomTypeID, - "businessLocation": BusinessLocationTypeID, - "businessRecipients": BusinessRecipientsTypeID, - "businessAwayMessageSettings": BusinessAwayMessageSettingsTypeID, - "businessGreetingMessageSettings": BusinessGreetingMessageSettingsTypeID, - "businessConnectedBot": BusinessConnectedBotTypeID, - "businessStartPage": BusinessStartPageTypeID, - "inputBusinessStartPage": InputBusinessStartPageTypeID, - "businessOpeningHoursInterval": BusinessOpeningHoursIntervalTypeID, - "businessOpeningHours": BusinessOpeningHoursTypeID, - "businessInfo": BusinessInfoTypeID, - "businessChatLink": BusinessChatLinkTypeID, - "businessChatLinks": BusinessChatLinksTypeID, - "inputBusinessChatLink": InputBusinessChatLinkTypeID, - "businessChatLinkInfo": BusinessChatLinkInfoTypeID, - "chatPhotoStickerTypeRegularOrMask": ChatPhotoStickerTypeRegularOrMaskTypeID, - "chatPhotoStickerTypeCustomEmoji": ChatPhotoStickerTypeCustomEmojiTypeID, - "chatPhotoSticker": ChatPhotoStickerTypeID, - "animatedChatPhoto": AnimatedChatPhotoTypeID, - "chatPhoto": ChatPhotoTypeID, - "chatPhotos": ChatPhotosTypeID, - "inputChatPhotoPrevious": InputChatPhotoPreviousTypeID, - "inputChatPhotoStatic": InputChatPhotoStaticTypeID, - "inputChatPhotoAnimation": InputChatPhotoAnimationTypeID, - "inputChatPhotoSticker": InputChatPhotoStickerTypeID, - "chatPermissions": ChatPermissionsTypeID, - "chatAdministratorRights": ChatAdministratorRightsTypeID, - "starAmount": StarAmountTypeID, - "starSubscriptionTypeChannel": StarSubscriptionTypeChannelTypeID, - "starSubscriptionTypeBot": StarSubscriptionTypeBotTypeID, - "starSubscriptionPricing": StarSubscriptionPricingTypeID, - "starSubscription": StarSubscriptionTypeID, - "starSubscriptions": StarSubscriptionsTypeID, - "affiliateTypeCurrentUser": AffiliateTypeCurrentUserTypeID, - "affiliateTypeBot": AffiliateTypeBotTypeID, - "affiliateTypeChannel": AffiliateTypeChannelTypeID, - "affiliateProgramSortOrderProfitability": AffiliateProgramSortOrderProfitabilityTypeID, - "affiliateProgramSortOrderCreationDate": AffiliateProgramSortOrderCreationDateTypeID, - "affiliateProgramSortOrderRevenue": AffiliateProgramSortOrderRevenueTypeID, - "affiliateProgramParameters": AffiliateProgramParametersTypeID, - "affiliateProgramInfo": AffiliateProgramInfoTypeID, - "affiliateInfo": AffiliateInfoTypeID, - "foundAffiliateProgram": FoundAffiliateProgramTypeID, - "foundAffiliatePrograms": FoundAffiliateProgramsTypeID, - "connectedAffiliateProgram": ConnectedAffiliateProgramTypeID, - "connectedAffiliatePrograms": ConnectedAffiliateProgramsTypeID, - "productInfo": ProductInfoTypeID, - "premiumPaymentOption": PremiumPaymentOptionTypeID, - "premiumStatePaymentOption": PremiumStatePaymentOptionTypeID, - "premiumGiftCodePaymentOption": PremiumGiftCodePaymentOptionTypeID, - "premiumGiftCodePaymentOptions": PremiumGiftCodePaymentOptionsTypeID, - "premiumGiftCodeInfo": PremiumGiftCodeInfoTypeID, - "starPaymentOption": StarPaymentOptionTypeID, - "starPaymentOptions": StarPaymentOptionsTypeID, - "starGiveawayWinnerOption": StarGiveawayWinnerOptionTypeID, - "starGiveawayPaymentOption": StarGiveawayPaymentOptionTypeID, - "starGiveawayPaymentOptions": StarGiveawayPaymentOptionsTypeID, - "upgradedGiftModel": UpgradedGiftModelTypeID, - "upgradedGiftSymbol": UpgradedGiftSymbolTypeID, - "upgradedGiftBackdrop": UpgradedGiftBackdropTypeID, - "upgradedGiftOriginalDetails": UpgradedGiftOriginalDetailsTypeID, - "gift": GiftTypeID, - "gifts": GiftsTypeID, - "upgradedGift": UpgradedGiftTypeID, - "upgradeGiftResult": UpgradeGiftResultTypeID, - "sentGiftRegular": SentGiftRegularTypeID, - "sentGiftUpgraded": SentGiftUpgradedTypeID, - "userGift": UserGiftTypeID, - "userGifts": UserGiftsTypeID, - "giftUpgradePreview": GiftUpgradePreviewTypeID, - "starTransactionDirectionIncoming": StarTransactionDirectionIncomingTypeID, - "starTransactionDirectionOutgoing": StarTransactionDirectionOutgoingTypeID, - "starTransactionTypePremiumBotDeposit": StarTransactionTypePremiumBotDepositTypeID, - "starTransactionTypeAppStoreDeposit": StarTransactionTypeAppStoreDepositTypeID, - "starTransactionTypeGooglePlayDeposit": StarTransactionTypeGooglePlayDepositTypeID, - "starTransactionTypeFragmentDeposit": StarTransactionTypeFragmentDepositTypeID, - "starTransactionTypeUserDeposit": StarTransactionTypeUserDepositTypeID, - "starTransactionTypeGiveawayDeposit": StarTransactionTypeGiveawayDepositTypeID, - "starTransactionTypeFragmentWithdrawal": StarTransactionTypeFragmentWithdrawalTypeID, - "starTransactionTypeTelegramAdsWithdrawal": StarTransactionTypeTelegramAdsWithdrawalTypeID, - "starTransactionTypeTelegramApiUsage": StarTransactionTypeTelegramAPIUsageTypeID, - "starTransactionTypeBotPaidMediaPurchase": StarTransactionTypeBotPaidMediaPurchaseTypeID, - "starTransactionTypeBotPaidMediaSale": StarTransactionTypeBotPaidMediaSaleTypeID, - "starTransactionTypeChannelPaidMediaPurchase": StarTransactionTypeChannelPaidMediaPurchaseTypeID, - "starTransactionTypeChannelPaidMediaSale": StarTransactionTypeChannelPaidMediaSaleTypeID, - "starTransactionTypeBotInvoicePurchase": StarTransactionTypeBotInvoicePurchaseTypeID, - "starTransactionTypeBotInvoiceSale": StarTransactionTypeBotInvoiceSaleTypeID, - "starTransactionTypeBotSubscriptionPurchase": StarTransactionTypeBotSubscriptionPurchaseTypeID, - "starTransactionTypeBotSubscriptionSale": StarTransactionTypeBotSubscriptionSaleTypeID, - "starTransactionTypeChannelSubscriptionPurchase": StarTransactionTypeChannelSubscriptionPurchaseTypeID, - "starTransactionTypeChannelSubscriptionSale": StarTransactionTypeChannelSubscriptionSaleTypeID, - "starTransactionTypeGiftPurchase": StarTransactionTypeGiftPurchaseTypeID, - "starTransactionTypeGiftTransfer": StarTransactionTypeGiftTransferTypeID, - "starTransactionTypeGiftSale": StarTransactionTypeGiftSaleTypeID, - "starTransactionTypeGiftUpgrade": StarTransactionTypeGiftUpgradeTypeID, - "starTransactionTypeChannelPaidReactionSend": StarTransactionTypeChannelPaidReactionSendTypeID, - "starTransactionTypeChannelPaidReactionReceive": StarTransactionTypeChannelPaidReactionReceiveTypeID, - "starTransactionTypeAffiliateProgramCommission": StarTransactionTypeAffiliateProgramCommissionTypeID, - "starTransactionTypeUnsupported": StarTransactionTypeUnsupportedTypeID, - "starTransaction": StarTransactionTypeID, - "starTransactions": StarTransactionsTypeID, - "giveawayParticipantStatusEligible": GiveawayParticipantStatusEligibleTypeID, - "giveawayParticipantStatusParticipating": GiveawayParticipantStatusParticipatingTypeID, - "giveawayParticipantStatusAlreadyWasMember": GiveawayParticipantStatusAlreadyWasMemberTypeID, - "giveawayParticipantStatusAdministrator": GiveawayParticipantStatusAdministratorTypeID, - "giveawayParticipantStatusDisallowedCountry": GiveawayParticipantStatusDisallowedCountryTypeID, - "giveawayInfoOngoing": GiveawayInfoOngoingTypeID, - "giveawayInfoCompleted": GiveawayInfoCompletedTypeID, - "giveawayPrizePremium": GiveawayPrizePremiumTypeID, - "giveawayPrizeStars": GiveawayPrizeStarsTypeID, - "accentColor": AccentColorTypeID, - "profileAccentColors": ProfileAccentColorsTypeID, - "profileAccentColor": ProfileAccentColorTypeID, - "emojiStatus": EmojiStatusTypeID, - "emojiStatuses": EmojiStatusesTypeID, - "usernames": UsernamesTypeID, - "user": UserTypeID, - "botInfo": BotInfoTypeID, - "userFullInfo": UserFullInfoTypeID, - "users": UsersTypeID, - "foundUsers": FoundUsersTypeID, - "chatAdministrator": ChatAdministratorTypeID, - "chatAdministrators": ChatAdministratorsTypeID, - "chatMemberStatusCreator": ChatMemberStatusCreatorTypeID, - "chatMemberStatusAdministrator": ChatMemberStatusAdministratorTypeID, - "chatMemberStatusMember": ChatMemberStatusMemberTypeID, - "chatMemberStatusRestricted": ChatMemberStatusRestrictedTypeID, - "chatMemberStatusLeft": ChatMemberStatusLeftTypeID, - "chatMemberStatusBanned": ChatMemberStatusBannedTypeID, - "chatMember": ChatMemberTypeID, - "chatMembers": ChatMembersTypeID, - "chatMembersFilterContacts": ChatMembersFilterContactsTypeID, - "chatMembersFilterAdministrators": ChatMembersFilterAdministratorsTypeID, - "chatMembersFilterMembers": ChatMembersFilterMembersTypeID, - "chatMembersFilterMention": ChatMembersFilterMentionTypeID, - "chatMembersFilterRestricted": ChatMembersFilterRestrictedTypeID, - "chatMembersFilterBanned": ChatMembersFilterBannedTypeID, - "chatMembersFilterBots": ChatMembersFilterBotsTypeID, - "supergroupMembersFilterRecent": SupergroupMembersFilterRecentTypeID, - "supergroupMembersFilterContacts": SupergroupMembersFilterContactsTypeID, - "supergroupMembersFilterAdministrators": SupergroupMembersFilterAdministratorsTypeID, - "supergroupMembersFilterSearch": SupergroupMembersFilterSearchTypeID, - "supergroupMembersFilterRestricted": SupergroupMembersFilterRestrictedTypeID, - "supergroupMembersFilterBanned": SupergroupMembersFilterBannedTypeID, - "supergroupMembersFilterMention": SupergroupMembersFilterMentionTypeID, - "supergroupMembersFilterBots": SupergroupMembersFilterBotsTypeID, - "chatInviteLink": ChatInviteLinkTypeID, - "chatInviteLinks": ChatInviteLinksTypeID, - "chatInviteLinkCount": ChatInviteLinkCountTypeID, - "chatInviteLinkCounts": ChatInviteLinkCountsTypeID, - "chatInviteLinkMember": ChatInviteLinkMemberTypeID, - "chatInviteLinkMembers": ChatInviteLinkMembersTypeID, - "inviteLinkChatTypeBasicGroup": InviteLinkChatTypeBasicGroupTypeID, - "inviteLinkChatTypeSupergroup": InviteLinkChatTypeSupergroupTypeID, - "inviteLinkChatTypeChannel": InviteLinkChatTypeChannelTypeID, - "chatInviteLinkSubscriptionInfo": ChatInviteLinkSubscriptionInfoTypeID, - "chatInviteLinkInfo": ChatInviteLinkInfoTypeID, - "chatJoinRequest": ChatJoinRequestTypeID, - "chatJoinRequests": ChatJoinRequestsTypeID, - "chatJoinRequestsInfo": ChatJoinRequestsInfoTypeID, - "basicGroup": BasicGroupTypeID, - "basicGroupFullInfo": BasicGroupFullInfoTypeID, - "supergroup": SupergroupTypeID, - "supergroupFullInfo": SupergroupFullInfoTypeID, - "secretChatStatePending": SecretChatStatePendingTypeID, - "secretChatStateReady": SecretChatStateReadyTypeID, - "secretChatStateClosed": SecretChatStateClosedTypeID, - "secretChat": SecretChatTypeID, - "messageSenderUser": MessageSenderUserTypeID, - "messageSenderChat": MessageSenderChatTypeID, - "messageSenders": MessageSendersTypeID, - "chatMessageSender": ChatMessageSenderTypeID, - "chatMessageSenders": ChatMessageSendersTypeID, - "messageReadDateRead": MessageReadDateReadTypeID, - "messageReadDateUnread": MessageReadDateUnreadTypeID, - "messageReadDateTooOld": MessageReadDateTooOldTypeID, - "messageReadDateUserPrivacyRestricted": MessageReadDateUserPrivacyRestrictedTypeID, - "messageReadDateMyPrivacyRestricted": MessageReadDateMyPrivacyRestrictedTypeID, - "messageViewer": MessageViewerTypeID, - "messageViewers": MessageViewersTypeID, - "messageOriginUser": MessageOriginUserTypeID, - "messageOriginHiddenUser": MessageOriginHiddenUserTypeID, - "messageOriginChat": MessageOriginChatTypeID, - "messageOriginChannel": MessageOriginChannelTypeID, - "forwardSource": ForwardSourceTypeID, - "reactionTypeEmoji": ReactionTypeEmojiTypeID, - "reactionTypeCustomEmoji": ReactionTypeCustomEmojiTypeID, - "reactionTypePaid": ReactionTypePaidTypeID, - "paidReactor": PaidReactorTypeID, - "messageForwardInfo": MessageForwardInfoTypeID, - "messageImportInfo": MessageImportInfoTypeID, - "messageReplyInfo": MessageReplyInfoTypeID, - "messageReaction": MessageReactionTypeID, - "messageReactions": MessageReactionsTypeID, - "messageInteractionInfo": MessageInteractionInfoTypeID, - "unreadReaction": UnreadReactionTypeID, - "messageEffectTypeEmojiReaction": MessageEffectTypeEmojiReactionTypeID, - "messageEffectTypePremiumSticker": MessageEffectTypePremiumStickerTypeID, - "messageEffect": MessageEffectTypeID, - "messageSendingStatePending": MessageSendingStatePendingTypeID, - "messageSendingStateFailed": MessageSendingStateFailedTypeID, - "textQuote": TextQuoteTypeID, - "inputTextQuote": InputTextQuoteTypeID, - "messageReplyToMessage": MessageReplyToMessageTypeID, - "messageReplyToStory": MessageReplyToStoryTypeID, - "inputMessageReplyToMessage": InputMessageReplyToMessageTypeID, - "inputMessageReplyToExternalMessage": InputMessageReplyToExternalMessageTypeID, - "inputMessageReplyToStory": InputMessageReplyToStoryTypeID, - "factCheck": FactCheckTypeID, - "message": MessageTypeID, - "messages": MessagesTypeID, - "foundMessages": FoundMessagesTypeID, - "foundChatMessages": FoundChatMessagesTypeID, - "messagePosition": MessagePositionTypeID, - "messagePositions": MessagePositionsTypeID, - "messageCalendarDay": MessageCalendarDayTypeID, - "messageCalendar": MessageCalendarTypeID, - "businessMessage": BusinessMessageTypeID, - "businessMessages": BusinessMessagesTypeID, - "messageSourceChatHistory": MessageSourceChatHistoryTypeID, - "messageSourceMessageThreadHistory": MessageSourceMessageThreadHistoryTypeID, - "messageSourceForumTopicHistory": MessageSourceForumTopicHistoryTypeID, - "messageSourceHistoryPreview": MessageSourceHistoryPreviewTypeID, - "messageSourceChatList": MessageSourceChatListTypeID, - "messageSourceSearch": MessageSourceSearchTypeID, - "messageSourceChatEventLog": MessageSourceChatEventLogTypeID, - "messageSourceNotification": MessageSourceNotificationTypeID, - "messageSourceScreenshot": MessageSourceScreenshotTypeID, - "messageSourceOther": MessageSourceOtherTypeID, - "messageSponsor": MessageSponsorTypeID, - "sponsoredMessage": SponsoredMessageTypeID, - "sponsoredMessages": SponsoredMessagesTypeID, - "reportOption": ReportOptionTypeID, - "reportChatSponsoredMessageResultOk": ReportChatSponsoredMessageResultOkTypeID, - "reportChatSponsoredMessageResultFailed": ReportChatSponsoredMessageResultFailedTypeID, - "reportChatSponsoredMessageResultOptionRequired": ReportChatSponsoredMessageResultOptionRequiredTypeID, - "reportChatSponsoredMessageResultAdsHidden": ReportChatSponsoredMessageResultAdsHiddenTypeID, - "reportChatSponsoredMessageResultPremiumRequired": ReportChatSponsoredMessageResultPremiumRequiredTypeID, - "fileDownload": FileDownloadTypeID, - "downloadedFileCounts": DownloadedFileCountsTypeID, - "foundFileDownloads": FoundFileDownloadsTypeID, - "notificationSettingsScopePrivateChats": NotificationSettingsScopePrivateChatsTypeID, - "notificationSettingsScopeGroupChats": NotificationSettingsScopeGroupChatsTypeID, - "notificationSettingsScopeChannelChats": NotificationSettingsScopeChannelChatsTypeID, - "chatNotificationSettings": ChatNotificationSettingsTypeID, - "scopeNotificationSettings": ScopeNotificationSettingsTypeID, - "reactionNotificationSourceNone": ReactionNotificationSourceNoneTypeID, - "reactionNotificationSourceContacts": ReactionNotificationSourceContactsTypeID, - "reactionNotificationSourceAll": ReactionNotificationSourceAllTypeID, - "reactionNotificationSettings": ReactionNotificationSettingsTypeID, - "draftMessage": DraftMessageTypeID, - "chatTypePrivate": ChatTypePrivateTypeID, - "chatTypeBasicGroup": ChatTypeBasicGroupTypeID, - "chatTypeSupergroup": ChatTypeSupergroupTypeID, - "chatTypeSecret": ChatTypeSecretTypeID, - "chatFolderIcon": ChatFolderIconTypeID, - "chatFolderName": ChatFolderNameTypeID, - "chatFolder": ChatFolderTypeID, - "chatFolderInfo": ChatFolderInfoTypeID, - "chatFolderInviteLink": ChatFolderInviteLinkTypeID, - "chatFolderInviteLinks": ChatFolderInviteLinksTypeID, - "chatFolderInviteLinkInfo": ChatFolderInviteLinkInfoTypeID, - "recommendedChatFolder": RecommendedChatFolderTypeID, - "recommendedChatFolders": RecommendedChatFoldersTypeID, - "archiveChatListSettings": ArchiveChatListSettingsTypeID, - "chatListMain": ChatListMainTypeID, - "chatListArchive": ChatListArchiveTypeID, - "chatListFolder": ChatListFolderTypeID, - "chatLists": ChatListsTypeID, - "chatSourceMtprotoProxy": ChatSourceMtprotoProxyTypeID, - "chatSourcePublicServiceAnnouncement": ChatSourcePublicServiceAnnouncementTypeID, - "chatPosition": ChatPositionTypeID, - "chatAvailableReactionsAll": ChatAvailableReactionsAllTypeID, - "chatAvailableReactionsSome": ChatAvailableReactionsSomeTypeID, - "savedMessagesTag": SavedMessagesTagTypeID, - "savedMessagesTags": SavedMessagesTagsTypeID, - "businessBotManageBar": BusinessBotManageBarTypeID, - "videoChat": VideoChatTypeID, - "chat": ChatTypeID, - "chats": ChatsTypeID, - "failedToAddMember": FailedToAddMemberTypeID, - "failedToAddMembers": FailedToAddMembersTypeID, - "createdBasicGroupChat": CreatedBasicGroupChatTypeID, - "publicChatTypeHasUsername": PublicChatTypeHasUsernameTypeID, - "publicChatTypeIsLocationBased": PublicChatTypeIsLocationBasedTypeID, - "chatActionBarReportSpam": ChatActionBarReportSpamTypeID, - "chatActionBarInviteMembers": ChatActionBarInviteMembersTypeID, - "chatActionBarReportAddBlock": ChatActionBarReportAddBlockTypeID, - "chatActionBarAddContact": ChatActionBarAddContactTypeID, - "chatActionBarSharePhoneNumber": ChatActionBarSharePhoneNumberTypeID, - "chatActionBarJoinRequest": ChatActionBarJoinRequestTypeID, - "keyboardButtonTypeText": KeyboardButtonTypeTextTypeID, - "keyboardButtonTypeRequestPhoneNumber": KeyboardButtonTypeRequestPhoneNumberTypeID, - "keyboardButtonTypeRequestLocation": KeyboardButtonTypeRequestLocationTypeID, - "keyboardButtonTypeRequestPoll": KeyboardButtonTypeRequestPollTypeID, - "keyboardButtonTypeRequestUsers": KeyboardButtonTypeRequestUsersTypeID, - "keyboardButtonTypeRequestChat": KeyboardButtonTypeRequestChatTypeID, - "keyboardButtonTypeWebApp": KeyboardButtonTypeWebAppTypeID, - "keyboardButton": KeyboardButtonTypeID, - "inlineKeyboardButtonTypeUrl": InlineKeyboardButtonTypeURLTypeID, - "inlineKeyboardButtonTypeLoginUrl": InlineKeyboardButtonTypeLoginURLTypeID, - "inlineKeyboardButtonTypeWebApp": InlineKeyboardButtonTypeWebAppTypeID, - "inlineKeyboardButtonTypeCallback": InlineKeyboardButtonTypeCallbackTypeID, - "inlineKeyboardButtonTypeCallbackWithPassword": InlineKeyboardButtonTypeCallbackWithPasswordTypeID, - "inlineKeyboardButtonTypeCallbackGame": InlineKeyboardButtonTypeCallbackGameTypeID, - "inlineKeyboardButtonTypeSwitchInline": InlineKeyboardButtonTypeSwitchInlineTypeID, - "inlineKeyboardButtonTypeBuy": InlineKeyboardButtonTypeBuyTypeID, - "inlineKeyboardButtonTypeUser": InlineKeyboardButtonTypeUserTypeID, - "inlineKeyboardButtonTypeCopyText": InlineKeyboardButtonTypeCopyTextTypeID, - "inlineKeyboardButton": InlineKeyboardButtonTypeID, - "replyMarkupRemoveKeyboard": ReplyMarkupRemoveKeyboardTypeID, - "replyMarkupForceReply": ReplyMarkupForceReplyTypeID, - "replyMarkupShowKeyboard": ReplyMarkupShowKeyboardTypeID, - "replyMarkupInlineKeyboard": ReplyMarkupInlineKeyboardTypeID, - "loginUrlInfoOpen": LoginURLInfoOpenTypeID, - "loginUrlInfoRequestConfirmation": LoginURLInfoRequestConfirmationTypeID, - "themeParameters": ThemeParametersTypeID, - "webAppOpenModeCompact": WebAppOpenModeCompactTypeID, - "webAppOpenModeFullSize": WebAppOpenModeFullSizeTypeID, - "webAppOpenModeFullScreen": WebAppOpenModeFullScreenTypeID, - "foundWebApp": FoundWebAppTypeID, - "webAppInfo": WebAppInfoTypeID, - "mainWebApp": MainWebAppTypeID, - "webAppOpenParameters": WebAppOpenParametersTypeID, - "messageThreadInfo": MessageThreadInfoTypeID, - "savedMessagesTopicTypeMyNotes": SavedMessagesTopicTypeMyNotesTypeID, - "savedMessagesTopicTypeAuthorHidden": SavedMessagesTopicTypeAuthorHiddenTypeID, - "savedMessagesTopicTypeSavedFromChat": SavedMessagesTopicTypeSavedFromChatTypeID, - "savedMessagesTopic": SavedMessagesTopicTypeID, - "forumTopicIcon": ForumTopicIconTypeID, - "forumTopicInfo": ForumTopicInfoTypeID, - "forumTopic": ForumTopicTypeID, - "forumTopics": ForumTopicsTypeID, - "linkPreviewOptions": LinkPreviewOptionsTypeID, - "sharedUser": SharedUserTypeID, - "sharedChat": SharedChatTypeID, - "themeSettings": ThemeSettingsTypeID, - "richTextPlain": RichTextPlainTypeID, - "richTextBold": RichTextBoldTypeID, - "richTextItalic": RichTextItalicTypeID, - "richTextUnderline": RichTextUnderlineTypeID, - "richTextStrikethrough": RichTextStrikethroughTypeID, - "richTextFixed": RichTextFixedTypeID, - "richTextUrl": RichTextURLTypeID, - "richTextEmailAddress": RichTextEmailAddressTypeID, - "richTextSubscript": RichTextSubscriptTypeID, - "richTextSuperscript": RichTextSuperscriptTypeID, - "richTextMarked": RichTextMarkedTypeID, - "richTextPhoneNumber": RichTextPhoneNumberTypeID, - "richTextIcon": RichTextIconTypeID, - "richTextReference": RichTextReferenceTypeID, - "richTextAnchor": RichTextAnchorTypeID, - "richTextAnchorLink": RichTextAnchorLinkTypeID, - "richTexts": RichTextsTypeID, - "pageBlockCaption": PageBlockCaptionTypeID, - "pageBlockListItem": PageBlockListItemTypeID, - "pageBlockHorizontalAlignmentLeft": PageBlockHorizontalAlignmentLeftTypeID, - "pageBlockHorizontalAlignmentCenter": PageBlockHorizontalAlignmentCenterTypeID, - "pageBlockHorizontalAlignmentRight": PageBlockHorizontalAlignmentRightTypeID, - "pageBlockVerticalAlignmentTop": PageBlockVerticalAlignmentTopTypeID, - "pageBlockVerticalAlignmentMiddle": PageBlockVerticalAlignmentMiddleTypeID, - "pageBlockVerticalAlignmentBottom": PageBlockVerticalAlignmentBottomTypeID, - "pageBlockTableCell": PageBlockTableCellTypeID, - "pageBlockRelatedArticle": PageBlockRelatedArticleTypeID, - "pageBlockTitle": PageBlockTitleTypeID, - "pageBlockSubtitle": PageBlockSubtitleTypeID, - "pageBlockAuthorDate": PageBlockAuthorDateTypeID, - "pageBlockHeader": PageBlockHeaderTypeID, - "pageBlockSubheader": PageBlockSubheaderTypeID, - "pageBlockKicker": PageBlockKickerTypeID, - "pageBlockParagraph": PageBlockParagraphTypeID, - "pageBlockPreformatted": PageBlockPreformattedTypeID, - "pageBlockFooter": PageBlockFooterTypeID, - "pageBlockDivider": PageBlockDividerTypeID, - "pageBlockAnchor": PageBlockAnchorTypeID, - "pageBlockList": PageBlockListTypeID, - "pageBlockBlockQuote": PageBlockBlockQuoteTypeID, - "pageBlockPullQuote": PageBlockPullQuoteTypeID, - "pageBlockAnimation": PageBlockAnimationTypeID, - "pageBlockAudio": PageBlockAudioTypeID, - "pageBlockPhoto": PageBlockPhotoTypeID, - "pageBlockVideo": PageBlockVideoTypeID, - "pageBlockVoiceNote": PageBlockVoiceNoteTypeID, - "pageBlockCover": PageBlockCoverTypeID, - "pageBlockEmbedded": PageBlockEmbeddedTypeID, - "pageBlockEmbeddedPost": PageBlockEmbeddedPostTypeID, - "pageBlockCollage": PageBlockCollageTypeID, - "pageBlockSlideshow": PageBlockSlideshowTypeID, - "pageBlockChatLink": PageBlockChatLinkTypeID, - "pageBlockTable": PageBlockTableTypeID, - "pageBlockDetails": PageBlockDetailsTypeID, - "pageBlockRelatedArticles": PageBlockRelatedArticlesTypeID, - "pageBlockMap": PageBlockMapTypeID, - "webPageInstantView": WebPageInstantViewTypeID, - "linkPreviewAlbumMediaPhoto": LinkPreviewAlbumMediaPhotoTypeID, - "linkPreviewAlbumMediaVideo": LinkPreviewAlbumMediaVideoTypeID, - "linkPreviewTypeAlbum": LinkPreviewTypeAlbumTypeID, - "linkPreviewTypeAnimation": LinkPreviewTypeAnimationTypeID, - "linkPreviewTypeApp": LinkPreviewTypeAppTypeID, - "linkPreviewTypeArticle": LinkPreviewTypeArticleTypeID, - "linkPreviewTypeAudio": LinkPreviewTypeAudioTypeID, - "linkPreviewTypeBackground": LinkPreviewTypeBackgroundTypeID, - "linkPreviewTypeChannelBoost": LinkPreviewTypeChannelBoostTypeID, - "linkPreviewTypeChat": LinkPreviewTypeChatTypeID, - "linkPreviewTypeDocument": LinkPreviewTypeDocumentTypeID, - "linkPreviewTypeEmbeddedAnimationPlayer": LinkPreviewTypeEmbeddedAnimationPlayerTypeID, - "linkPreviewTypeEmbeddedAudioPlayer": LinkPreviewTypeEmbeddedAudioPlayerTypeID, - "linkPreviewTypeEmbeddedVideoPlayer": LinkPreviewTypeEmbeddedVideoPlayerTypeID, - "linkPreviewTypeExternalAudio": LinkPreviewTypeExternalAudioTypeID, - "linkPreviewTypeExternalVideo": LinkPreviewTypeExternalVideoTypeID, - "linkPreviewTypeInvoice": LinkPreviewTypeInvoiceTypeID, - "linkPreviewTypeMessage": LinkPreviewTypeMessageTypeID, - "linkPreviewTypePhoto": LinkPreviewTypePhotoTypeID, - "linkPreviewTypePremiumGiftCode": LinkPreviewTypePremiumGiftCodeTypeID, - "linkPreviewTypeShareableChatFolder": LinkPreviewTypeShareableChatFolderTypeID, - "linkPreviewTypeSticker": LinkPreviewTypeStickerTypeID, - "linkPreviewTypeStickerSet": LinkPreviewTypeStickerSetTypeID, - "linkPreviewTypeStory": LinkPreviewTypeStoryTypeID, - "linkPreviewTypeSupergroupBoost": LinkPreviewTypeSupergroupBoostTypeID, - "linkPreviewTypeTheme": LinkPreviewTypeThemeTypeID, - "linkPreviewTypeUnsupported": LinkPreviewTypeUnsupportedTypeID, - "linkPreviewTypeUser": LinkPreviewTypeUserTypeID, - "linkPreviewTypeVideo": LinkPreviewTypeVideoTypeID, - "linkPreviewTypeVideoChat": LinkPreviewTypeVideoChatTypeID, - "linkPreviewTypeVideoNote": LinkPreviewTypeVideoNoteTypeID, - "linkPreviewTypeVoiceNote": LinkPreviewTypeVoiceNoteTypeID, - "linkPreviewTypeWebApp": LinkPreviewTypeWebAppTypeID, - "linkPreview": LinkPreviewTypeID, - "countryInfo": CountryInfoTypeID, - "countries": CountriesTypeID, - "phoneNumberInfo": PhoneNumberInfoTypeID, - "collectibleItemTypeUsername": CollectibleItemTypeUsernameTypeID, - "collectibleItemTypePhoneNumber": CollectibleItemTypePhoneNumberTypeID, - "collectibleItemInfo": CollectibleItemInfoTypeID, - "bankCardActionOpenUrl": BankCardActionOpenURLTypeID, - "bankCardInfo": BankCardInfoTypeID, - "address": AddressTypeID, - "locationAddress": LocationAddressTypeID, - "labeledPricePart": LabeledPricePartTypeID, - "invoice": InvoiceTypeID, - "orderInfo": OrderInfoTypeID, - "shippingOption": ShippingOptionTypeID, - "savedCredentials": SavedCredentialsTypeID, - "inputCredentialsSaved": InputCredentialsSavedTypeID, - "inputCredentialsNew": InputCredentialsNewTypeID, - "inputCredentialsApplePay": InputCredentialsApplePayTypeID, - "inputCredentialsGooglePay": InputCredentialsGooglePayTypeID, - "paymentProviderSmartGlocal": PaymentProviderSmartGlocalTypeID, - "paymentProviderStripe": PaymentProviderStripeTypeID, - "paymentProviderOther": PaymentProviderOtherTypeID, - "paymentOption": PaymentOptionTypeID, - "paymentFormTypeRegular": PaymentFormTypeRegularTypeID, - "paymentFormTypeStars": PaymentFormTypeStarsTypeID, - "paymentFormTypeStarSubscription": PaymentFormTypeStarSubscriptionTypeID, - "paymentForm": PaymentFormTypeID, - "validatedOrderInfo": ValidatedOrderInfoTypeID, - "paymentResult": PaymentResultTypeID, - "paymentReceiptTypeRegular": PaymentReceiptTypeRegularTypeID, - "paymentReceiptTypeStars": PaymentReceiptTypeStarsTypeID, - "paymentReceipt": PaymentReceiptTypeID, - "inputInvoiceMessage": InputInvoiceMessageTypeID, - "inputInvoiceName": InputInvoiceNameTypeID, - "inputInvoiceTelegram": InputInvoiceTelegramTypeID, - "paidMediaPreview": PaidMediaPreviewTypeID, - "paidMediaPhoto": PaidMediaPhotoTypeID, - "paidMediaVideo": PaidMediaVideoTypeID, - "paidMediaUnsupported": PaidMediaUnsupportedTypeID, - "giveawayParameters": GiveawayParametersTypeID, - "datedFile": DatedFileTypeID, - "passportElementTypePersonalDetails": PassportElementTypePersonalDetailsTypeID, - "passportElementTypePassport": PassportElementTypePassportTypeID, - "passportElementTypeDriverLicense": PassportElementTypeDriverLicenseTypeID, - "passportElementTypeIdentityCard": PassportElementTypeIdentityCardTypeID, - "passportElementTypeInternalPassport": PassportElementTypeInternalPassportTypeID, - "passportElementTypeAddress": PassportElementTypeAddressTypeID, - "passportElementTypeUtilityBill": PassportElementTypeUtilityBillTypeID, - "passportElementTypeBankStatement": PassportElementTypeBankStatementTypeID, - "passportElementTypeRentalAgreement": PassportElementTypeRentalAgreementTypeID, - "passportElementTypePassportRegistration": PassportElementTypePassportRegistrationTypeID, - "passportElementTypeTemporaryRegistration": PassportElementTypeTemporaryRegistrationTypeID, - "passportElementTypePhoneNumber": PassportElementTypePhoneNumberTypeID, - "passportElementTypeEmailAddress": PassportElementTypeEmailAddressTypeID, - "date": DateTypeID, - "personalDetails": PersonalDetailsTypeID, - "identityDocument": IdentityDocumentTypeID, - "inputIdentityDocument": InputIdentityDocumentTypeID, - "personalDocument": PersonalDocumentTypeID, - "inputPersonalDocument": InputPersonalDocumentTypeID, - "passportElementPersonalDetails": PassportElementPersonalDetailsTypeID, - "passportElementPassport": PassportElementPassportTypeID, - "passportElementDriverLicense": PassportElementDriverLicenseTypeID, - "passportElementIdentityCard": PassportElementIdentityCardTypeID, - "passportElementInternalPassport": PassportElementInternalPassportTypeID, - "passportElementAddress": PassportElementAddressTypeID, - "passportElementUtilityBill": PassportElementUtilityBillTypeID, - "passportElementBankStatement": PassportElementBankStatementTypeID, - "passportElementRentalAgreement": PassportElementRentalAgreementTypeID, - "passportElementPassportRegistration": PassportElementPassportRegistrationTypeID, - "passportElementTemporaryRegistration": PassportElementTemporaryRegistrationTypeID, - "passportElementPhoneNumber": PassportElementPhoneNumberTypeID, - "passportElementEmailAddress": PassportElementEmailAddressTypeID, - "inputPassportElementPersonalDetails": InputPassportElementPersonalDetailsTypeID, - "inputPassportElementPassport": InputPassportElementPassportTypeID, - "inputPassportElementDriverLicense": InputPassportElementDriverLicenseTypeID, - "inputPassportElementIdentityCard": InputPassportElementIdentityCardTypeID, - "inputPassportElementInternalPassport": InputPassportElementInternalPassportTypeID, - "inputPassportElementAddress": InputPassportElementAddressTypeID, - "inputPassportElementUtilityBill": InputPassportElementUtilityBillTypeID, - "inputPassportElementBankStatement": InputPassportElementBankStatementTypeID, - "inputPassportElementRentalAgreement": InputPassportElementRentalAgreementTypeID, - "inputPassportElementPassportRegistration": InputPassportElementPassportRegistrationTypeID, - "inputPassportElementTemporaryRegistration": InputPassportElementTemporaryRegistrationTypeID, - "inputPassportElementPhoneNumber": InputPassportElementPhoneNumberTypeID, - "inputPassportElementEmailAddress": InputPassportElementEmailAddressTypeID, - "passportElements": PassportElementsTypeID, - "passportElementErrorSourceUnspecified": PassportElementErrorSourceUnspecifiedTypeID, - "passportElementErrorSourceDataField": PassportElementErrorSourceDataFieldTypeID, - "passportElementErrorSourceFrontSide": PassportElementErrorSourceFrontSideTypeID, - "passportElementErrorSourceReverseSide": PassportElementErrorSourceReverseSideTypeID, - "passportElementErrorSourceSelfie": PassportElementErrorSourceSelfieTypeID, - "passportElementErrorSourceTranslationFile": PassportElementErrorSourceTranslationFileTypeID, - "passportElementErrorSourceTranslationFiles": PassportElementErrorSourceTranslationFilesTypeID, - "passportElementErrorSourceFile": PassportElementErrorSourceFileTypeID, - "passportElementErrorSourceFiles": PassportElementErrorSourceFilesTypeID, - "passportElementError": PassportElementErrorTypeID, - "passportSuitableElement": PassportSuitableElementTypeID, - "passportRequiredElement": PassportRequiredElementTypeID, - "passportAuthorizationForm": PassportAuthorizationFormTypeID, - "passportElementsWithErrors": PassportElementsWithErrorsTypeID, - "encryptedCredentials": EncryptedCredentialsTypeID, - "encryptedPassportElement": EncryptedPassportElementTypeID, - "inputPassportElementErrorSourceUnspecified": InputPassportElementErrorSourceUnspecifiedTypeID, - "inputPassportElementErrorSourceDataField": InputPassportElementErrorSourceDataFieldTypeID, - "inputPassportElementErrorSourceFrontSide": InputPassportElementErrorSourceFrontSideTypeID, - "inputPassportElementErrorSourceReverseSide": InputPassportElementErrorSourceReverseSideTypeID, - "inputPassportElementErrorSourceSelfie": InputPassportElementErrorSourceSelfieTypeID, - "inputPassportElementErrorSourceTranslationFile": InputPassportElementErrorSourceTranslationFileTypeID, - "inputPassportElementErrorSourceTranslationFiles": InputPassportElementErrorSourceTranslationFilesTypeID, - "inputPassportElementErrorSourceFile": InputPassportElementErrorSourceFileTypeID, - "inputPassportElementErrorSourceFiles": InputPassportElementErrorSourceFilesTypeID, - "inputPassportElementError": InputPassportElementErrorTypeID, - "messageText": MessageTextTypeID, - "messageAnimation": MessageAnimationTypeID, - "messageAudio": MessageAudioTypeID, - "messageDocument": MessageDocumentTypeID, - "messagePaidMedia": MessagePaidMediaTypeID, - "messagePhoto": MessagePhotoTypeID, - "messageSticker": MessageStickerTypeID, - "messageVideo": MessageVideoTypeID, - "messageVideoNote": MessageVideoNoteTypeID, - "messageVoiceNote": MessageVoiceNoteTypeID, - "messageExpiredPhoto": MessageExpiredPhotoTypeID, - "messageExpiredVideo": MessageExpiredVideoTypeID, - "messageExpiredVideoNote": MessageExpiredVideoNoteTypeID, - "messageExpiredVoiceNote": MessageExpiredVoiceNoteTypeID, - "messageLocation": MessageLocationTypeID, - "messageVenue": MessageVenueTypeID, - "messageContact": MessageContactTypeID, - "messageAnimatedEmoji": MessageAnimatedEmojiTypeID, - "messageDice": MessageDiceTypeID, - "messageGame": MessageGameTypeID, - "messagePoll": MessagePollTypeID, - "messageStory": MessageStoryTypeID, - "messageInvoice": MessageInvoiceTypeID, - "messageCall": MessageCallTypeID, - "messageVideoChatScheduled": MessageVideoChatScheduledTypeID, - "messageVideoChatStarted": MessageVideoChatStartedTypeID, - "messageVideoChatEnded": MessageVideoChatEndedTypeID, - "messageInviteVideoChatParticipants": MessageInviteVideoChatParticipantsTypeID, - "messageBasicGroupChatCreate": MessageBasicGroupChatCreateTypeID, - "messageSupergroupChatCreate": MessageSupergroupChatCreateTypeID, - "messageChatChangeTitle": MessageChatChangeTitleTypeID, - "messageChatChangePhoto": MessageChatChangePhotoTypeID, - "messageChatDeletePhoto": MessageChatDeletePhotoTypeID, - "messageChatAddMembers": MessageChatAddMembersTypeID, - "messageChatJoinByLink": MessageChatJoinByLinkTypeID, - "messageChatJoinByRequest": MessageChatJoinByRequestTypeID, - "messageChatDeleteMember": MessageChatDeleteMemberTypeID, - "messageChatUpgradeTo": MessageChatUpgradeToTypeID, - "messageChatUpgradeFrom": MessageChatUpgradeFromTypeID, - "messagePinMessage": MessagePinMessageTypeID, - "messageScreenshotTaken": MessageScreenshotTakenTypeID, - "messageChatSetBackground": MessageChatSetBackgroundTypeID, - "messageChatSetTheme": MessageChatSetThemeTypeID, - "messageChatSetMessageAutoDeleteTime": MessageChatSetMessageAutoDeleteTimeTypeID, - "messageChatBoost": MessageChatBoostTypeID, - "messageForumTopicCreated": MessageForumTopicCreatedTypeID, - "messageForumTopicEdited": MessageForumTopicEditedTypeID, - "messageForumTopicIsClosedToggled": MessageForumTopicIsClosedToggledTypeID, - "messageForumTopicIsHiddenToggled": MessageForumTopicIsHiddenToggledTypeID, - "messageSuggestProfilePhoto": MessageSuggestProfilePhotoTypeID, - "messageCustomServiceAction": MessageCustomServiceActionTypeID, - "messageGameScore": MessageGameScoreTypeID, - "messagePaymentSuccessful": MessagePaymentSuccessfulTypeID, - "messagePaymentSuccessfulBot": MessagePaymentSuccessfulBotTypeID, - "messagePaymentRefunded": MessagePaymentRefundedTypeID, - "messageGiftedPremium": MessageGiftedPremiumTypeID, - "messagePremiumGiftCode": MessagePremiumGiftCodeTypeID, - "messageGiveawayCreated": MessageGiveawayCreatedTypeID, - "messageGiveaway": MessageGiveawayTypeID, - "messageGiveawayCompleted": MessageGiveawayCompletedTypeID, - "messageGiveawayWinners": MessageGiveawayWinnersTypeID, - "messageGiftedStars": MessageGiftedStarsTypeID, - "messageGiveawayPrizeStars": MessageGiveawayPrizeStarsTypeID, - "messageGift": MessageGiftTypeID, - "messageUpgradedGift": MessageUpgradedGiftTypeID, - "messageRefundedUpgradedGift": MessageRefundedUpgradedGiftTypeID, - "messageContactRegistered": MessageContactRegisteredTypeID, - "messageUsersShared": MessageUsersSharedTypeID, - "messageChatShared": MessageChatSharedTypeID, - "messageBotWriteAccessAllowed": MessageBotWriteAccessAllowedTypeID, - "messageWebAppDataSent": MessageWebAppDataSentTypeID, - "messageWebAppDataReceived": MessageWebAppDataReceivedTypeID, - "messagePassportDataSent": MessagePassportDataSentTypeID, - "messagePassportDataReceived": MessagePassportDataReceivedTypeID, - "messageProximityAlertTriggered": MessageProximityAlertTriggeredTypeID, - "messageUnsupported": MessageUnsupportedTypeID, - "textEntityTypeMention": TextEntityTypeMentionTypeID, - "textEntityTypeHashtag": TextEntityTypeHashtagTypeID, - "textEntityTypeCashtag": TextEntityTypeCashtagTypeID, - "textEntityTypeBotCommand": TextEntityTypeBotCommandTypeID, - "textEntityTypeUrl": TextEntityTypeURLTypeID, - "textEntityTypeEmailAddress": TextEntityTypeEmailAddressTypeID, - "textEntityTypePhoneNumber": TextEntityTypePhoneNumberTypeID, - "textEntityTypeBankCardNumber": TextEntityTypeBankCardNumberTypeID, - "textEntityTypeBold": TextEntityTypeBoldTypeID, - "textEntityTypeItalic": TextEntityTypeItalicTypeID, - "textEntityTypeUnderline": TextEntityTypeUnderlineTypeID, - "textEntityTypeStrikethrough": TextEntityTypeStrikethroughTypeID, - "textEntityTypeSpoiler": TextEntityTypeSpoilerTypeID, - "textEntityTypeCode": TextEntityTypeCodeTypeID, - "textEntityTypePre": TextEntityTypePreTypeID, - "textEntityTypePreCode": TextEntityTypePreCodeTypeID, - "textEntityTypeBlockQuote": TextEntityTypeBlockQuoteTypeID, - "textEntityTypeExpandableBlockQuote": TextEntityTypeExpandableBlockQuoteTypeID, - "textEntityTypeTextUrl": TextEntityTypeTextURLTypeID, - "textEntityTypeMentionName": TextEntityTypeMentionNameTypeID, - "textEntityTypeCustomEmoji": TextEntityTypeCustomEmojiTypeID, - "textEntityTypeMediaTimestamp": TextEntityTypeMediaTimestampTypeID, - "inputThumbnail": InputThumbnailTypeID, - "inputPaidMediaTypePhoto": InputPaidMediaTypePhotoTypeID, - "inputPaidMediaTypeVideo": InputPaidMediaTypeVideoTypeID, - "inputPaidMedia": InputPaidMediaTypeID, - "messageSchedulingStateSendAtDate": MessageSchedulingStateSendAtDateTypeID, - "messageSchedulingStateSendWhenOnline": MessageSchedulingStateSendWhenOnlineTypeID, - "messageSchedulingStateSendWhenVideoProcessed": MessageSchedulingStateSendWhenVideoProcessedTypeID, - "messageSelfDestructTypeTimer": MessageSelfDestructTypeTimerTypeID, - "messageSelfDestructTypeImmediately": MessageSelfDestructTypeImmediatelyTypeID, - "messageSendOptions": MessageSendOptionsTypeID, - "messageCopyOptions": MessageCopyOptionsTypeID, - "inputMessageText": InputMessageTextTypeID, - "inputMessageAnimation": InputMessageAnimationTypeID, - "inputMessageAudio": InputMessageAudioTypeID, - "inputMessageDocument": InputMessageDocumentTypeID, - "inputMessagePaidMedia": InputMessagePaidMediaTypeID, - "inputMessagePhoto": InputMessagePhotoTypeID, - "inputMessageSticker": InputMessageStickerTypeID, - "inputMessageVideo": InputMessageVideoTypeID, - "inputMessageVideoNote": InputMessageVideoNoteTypeID, - "inputMessageVoiceNote": InputMessageVoiceNoteTypeID, - "inputMessageLocation": InputMessageLocationTypeID, - "inputMessageVenue": InputMessageVenueTypeID, - "inputMessageContact": InputMessageContactTypeID, - "inputMessageDice": InputMessageDiceTypeID, - "inputMessageGame": InputMessageGameTypeID, - "inputMessageInvoice": InputMessageInvoiceTypeID, - "inputMessagePoll": InputMessagePollTypeID, - "inputMessageStory": InputMessageStoryTypeID, - "inputMessageForwarded": InputMessageForwardedTypeID, - "messageProperties": MessagePropertiesTypeID, - "searchMessagesFilterEmpty": SearchMessagesFilterEmptyTypeID, - "searchMessagesFilterAnimation": SearchMessagesFilterAnimationTypeID, - "searchMessagesFilterAudio": SearchMessagesFilterAudioTypeID, - "searchMessagesFilterDocument": SearchMessagesFilterDocumentTypeID, - "searchMessagesFilterPhoto": SearchMessagesFilterPhotoTypeID, - "searchMessagesFilterVideo": SearchMessagesFilterVideoTypeID, - "searchMessagesFilterVoiceNote": SearchMessagesFilterVoiceNoteTypeID, - "searchMessagesFilterPhotoAndVideo": SearchMessagesFilterPhotoAndVideoTypeID, - "searchMessagesFilterUrl": SearchMessagesFilterURLTypeID, - "searchMessagesFilterChatPhoto": SearchMessagesFilterChatPhotoTypeID, - "searchMessagesFilterVideoNote": SearchMessagesFilterVideoNoteTypeID, - "searchMessagesFilterVoiceAndVideoNote": SearchMessagesFilterVoiceAndVideoNoteTypeID, - "searchMessagesFilterMention": SearchMessagesFilterMentionTypeID, - "searchMessagesFilterUnreadMention": SearchMessagesFilterUnreadMentionTypeID, - "searchMessagesFilterUnreadReaction": SearchMessagesFilterUnreadReactionTypeID, - "searchMessagesFilterFailedToSend": SearchMessagesFilterFailedToSendTypeID, - "searchMessagesFilterPinned": SearchMessagesFilterPinnedTypeID, - "searchMessagesChatTypeFilterPrivate": SearchMessagesChatTypeFilterPrivateTypeID, - "searchMessagesChatTypeFilterGroup": SearchMessagesChatTypeFilterGroupTypeID, - "searchMessagesChatTypeFilterChannel": SearchMessagesChatTypeFilterChannelTypeID, - "chatActionTyping": ChatActionTypingTypeID, - "chatActionRecordingVideo": ChatActionRecordingVideoTypeID, - "chatActionUploadingVideo": ChatActionUploadingVideoTypeID, - "chatActionRecordingVoiceNote": ChatActionRecordingVoiceNoteTypeID, - "chatActionUploadingVoiceNote": ChatActionUploadingVoiceNoteTypeID, - "chatActionUploadingPhoto": ChatActionUploadingPhotoTypeID, - "chatActionUploadingDocument": ChatActionUploadingDocumentTypeID, - "chatActionChoosingSticker": ChatActionChoosingStickerTypeID, - "chatActionChoosingLocation": ChatActionChoosingLocationTypeID, - "chatActionChoosingContact": ChatActionChoosingContactTypeID, - "chatActionStartPlayingGame": ChatActionStartPlayingGameTypeID, - "chatActionRecordingVideoNote": ChatActionRecordingVideoNoteTypeID, - "chatActionUploadingVideoNote": ChatActionUploadingVideoNoteTypeID, - "chatActionWatchingAnimations": ChatActionWatchingAnimationsTypeID, - "chatActionCancel": ChatActionCancelTypeID, - "userStatusEmpty": UserStatusEmptyTypeID, - "userStatusOnline": UserStatusOnlineTypeID, - "userStatusOffline": UserStatusOfflineTypeID, - "userStatusRecently": UserStatusRecentlyTypeID, - "userStatusLastWeek": UserStatusLastWeekTypeID, - "userStatusLastMonth": UserStatusLastMonthTypeID, - "emojiKeyword": EmojiKeywordTypeID, - "emojiKeywords": EmojiKeywordsTypeID, - "stickers": StickersTypeID, - "emojis": EmojisTypeID, - "stickerSet": StickerSetTypeID, - "stickerSetInfo": StickerSetInfoTypeID, - "stickerSets": StickerSetsTypeID, - "trendingStickerSets": TrendingStickerSetsTypeID, - "emojiCategorySourceSearch": EmojiCategorySourceSearchTypeID, - "emojiCategorySourcePremium": EmojiCategorySourcePremiumTypeID, - "emojiCategory": EmojiCategoryTypeID, - "emojiCategories": EmojiCategoriesTypeID, - "emojiCategoryTypeDefault": EmojiCategoryTypeDefaultTypeID, - "emojiCategoryTypeRegularStickers": EmojiCategoryTypeRegularStickersTypeID, - "emojiCategoryTypeEmojiStatus": EmojiCategoryTypeEmojiStatusTypeID, - "emojiCategoryTypeChatPhoto": EmojiCategoryTypeChatPhotoTypeID, - "currentWeather": CurrentWeatherTypeID, - "storyAreaPosition": StoryAreaPositionTypeID, - "storyAreaTypeLocation": StoryAreaTypeLocationTypeID, - "storyAreaTypeVenue": StoryAreaTypeVenueTypeID, - "storyAreaTypeSuggestedReaction": StoryAreaTypeSuggestedReactionTypeID, - "storyAreaTypeMessage": StoryAreaTypeMessageTypeID, - "storyAreaTypeLink": StoryAreaTypeLinkTypeID, - "storyAreaTypeWeather": StoryAreaTypeWeatherTypeID, - "storyArea": StoryAreaTypeID, - "inputStoryAreaTypeLocation": InputStoryAreaTypeLocationTypeID, - "inputStoryAreaTypeFoundVenue": InputStoryAreaTypeFoundVenueTypeID, - "inputStoryAreaTypePreviousVenue": InputStoryAreaTypePreviousVenueTypeID, - "inputStoryAreaTypeSuggestedReaction": InputStoryAreaTypeSuggestedReactionTypeID, - "inputStoryAreaTypeMessage": InputStoryAreaTypeMessageTypeID, - "inputStoryAreaTypeLink": InputStoryAreaTypeLinkTypeID, - "inputStoryAreaTypeWeather": InputStoryAreaTypeWeatherTypeID, - "inputStoryArea": InputStoryAreaTypeID, - "inputStoryAreas": InputStoryAreasTypeID, - "storyVideo": StoryVideoTypeID, - "storyContentPhoto": StoryContentPhotoTypeID, - "storyContentVideo": StoryContentVideoTypeID, - "storyContentUnsupported": StoryContentUnsupportedTypeID, - "inputStoryContentPhoto": InputStoryContentPhotoTypeID, - "inputStoryContentVideo": InputStoryContentVideoTypeID, - "storyListMain": StoryListMainTypeID, - "storyListArchive": StoryListArchiveTypeID, - "storyOriginPublicStory": StoryOriginPublicStoryTypeID, - "storyOriginHiddenUser": StoryOriginHiddenUserTypeID, - "storyRepostInfo": StoryRepostInfoTypeID, - "storyInteractionInfo": StoryInteractionInfoTypeID, - "story": StoryTypeID, - "stories": StoriesTypeID, - "foundStories": FoundStoriesTypeID, - "storyFullId": StoryFullIDTypeID, - "storyInfo": StoryInfoTypeID, - "chatActiveStories": ChatActiveStoriesTypeID, - "storyInteractionTypeView": StoryInteractionTypeViewTypeID, - "storyInteractionTypeForward": StoryInteractionTypeForwardTypeID, - "storyInteractionTypeRepost": StoryInteractionTypeRepostTypeID, - "storyInteraction": StoryInteractionTypeID, - "storyInteractions": StoryInteractionsTypeID, - "quickReplyMessage": QuickReplyMessageTypeID, - "quickReplyMessages": QuickReplyMessagesTypeID, - "quickReplyShortcut": QuickReplyShortcutTypeID, - "publicForwardMessage": PublicForwardMessageTypeID, - "publicForwardStory": PublicForwardStoryTypeID, - "publicForwards": PublicForwardsTypeID, - "botMediaPreview": BotMediaPreviewTypeID, - "botMediaPreviews": BotMediaPreviewsTypeID, - "botMediaPreviewInfo": BotMediaPreviewInfoTypeID, - "chatBoostLevelFeatures": ChatBoostLevelFeaturesTypeID, - "chatBoostFeatures": ChatBoostFeaturesTypeID, - "chatBoostSourceGiftCode": ChatBoostSourceGiftCodeTypeID, - "chatBoostSourceGiveaway": ChatBoostSourceGiveawayTypeID, - "chatBoostSourcePremium": ChatBoostSourcePremiumTypeID, - "prepaidGiveaway": PrepaidGiveawayTypeID, - "chatBoostStatus": ChatBoostStatusTypeID, - "chatBoost": ChatBoostTypeID, - "foundChatBoosts": FoundChatBoostsTypeID, - "chatBoostSlot": ChatBoostSlotTypeID, - "chatBoostSlots": ChatBoostSlotsTypeID, - "resendCodeReasonUserRequest": ResendCodeReasonUserRequestTypeID, - "resendCodeReasonVerificationFailed": ResendCodeReasonVerificationFailedTypeID, - "callDiscardReasonEmpty": CallDiscardReasonEmptyTypeID, - "callDiscardReasonMissed": CallDiscardReasonMissedTypeID, - "callDiscardReasonDeclined": CallDiscardReasonDeclinedTypeID, - "callDiscardReasonDisconnected": CallDiscardReasonDisconnectedTypeID, - "callDiscardReasonHungUp": CallDiscardReasonHungUpTypeID, - "callDiscardReasonAllowGroupCall": CallDiscardReasonAllowGroupCallTypeID, - "callProtocol": CallProtocolTypeID, - "callServerTypeTelegramReflector": CallServerTypeTelegramReflectorTypeID, - "callServerTypeWebrtc": CallServerTypeWebrtcTypeID, - "callServer": CallServerTypeID, - "callId": CallIDTypeID, - "groupCallId": GroupCallIDTypeID, - "callStatePending": CallStatePendingTypeID, - "callStateExchangingKeys": CallStateExchangingKeysTypeID, - "callStateReady": CallStateReadyTypeID, - "callStateHangingUp": CallStateHangingUpTypeID, - "callStateDiscarded": CallStateDiscardedTypeID, - "callStateError": CallStateErrorTypeID, - "groupCallVideoQualityThumbnail": GroupCallVideoQualityThumbnailTypeID, - "groupCallVideoQualityMedium": GroupCallVideoQualityMediumTypeID, - "groupCallVideoQualityFull": GroupCallVideoQualityFullTypeID, - "groupCallStream": GroupCallStreamTypeID, - "groupCallStreams": GroupCallStreamsTypeID, - "rtmpUrl": RtmpURLTypeID, - "groupCallRecentSpeaker": GroupCallRecentSpeakerTypeID, - "groupCall": GroupCallTypeID, - "groupCallVideoSourceGroup": GroupCallVideoSourceGroupTypeID, - "groupCallParticipantVideoInfo": GroupCallParticipantVideoInfoTypeID, - "groupCallParticipant": GroupCallParticipantTypeID, - "callProblemEcho": CallProblemEchoTypeID, - "callProblemNoise": CallProblemNoiseTypeID, - "callProblemInterruptions": CallProblemInterruptionsTypeID, - "callProblemDistortedSpeech": CallProblemDistortedSpeechTypeID, - "callProblemSilentLocal": CallProblemSilentLocalTypeID, - "callProblemSilentRemote": CallProblemSilentRemoteTypeID, - "callProblemDropped": CallProblemDroppedTypeID, - "callProblemDistortedVideo": CallProblemDistortedVideoTypeID, - "callProblemPixelatedVideo": CallProblemPixelatedVideoTypeID, - "call": CallTypeID, - "firebaseAuthenticationSettingsAndroid": FirebaseAuthenticationSettingsAndroidTypeID, - "firebaseAuthenticationSettingsIos": FirebaseAuthenticationSettingsIosTypeID, - "phoneNumberAuthenticationSettings": PhoneNumberAuthenticationSettingsTypeID, - "addedReaction": AddedReactionTypeID, - "addedReactions": AddedReactionsTypeID, - "availableReaction": AvailableReactionTypeID, - "availableReactions": AvailableReactionsTypeID, - "emojiReaction": EmojiReactionTypeID, - "reactionUnavailabilityReasonAnonymousAdministrator": ReactionUnavailabilityReasonAnonymousAdministratorTypeID, - "reactionUnavailabilityReasonGuest": ReactionUnavailabilityReasonGuestTypeID, - "animations": AnimationsTypeID, - "diceStickersRegular": DiceStickersRegularTypeID, - "diceStickersSlotMachine": DiceStickersSlotMachineTypeID, - "importedContacts": ImportedContactsTypeID, - "speechRecognitionResultPending": SpeechRecognitionResultPendingTypeID, - "speechRecognitionResultText": SpeechRecognitionResultTextTypeID, - "speechRecognitionResultError": SpeechRecognitionResultErrorTypeID, - "businessConnection": BusinessConnectionTypeID, - "attachmentMenuBotColor": AttachmentMenuBotColorTypeID, - "attachmentMenuBot": AttachmentMenuBotTypeID, - "sentWebAppMessage": SentWebAppMessageTypeID, - "botWriteAccessAllowReasonConnectedWebsite": BotWriteAccessAllowReasonConnectedWebsiteTypeID, - "botWriteAccessAllowReasonAddedToAttachmentMenu": BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID, - "botWriteAccessAllowReasonLaunchedWebApp": BotWriteAccessAllowReasonLaunchedWebAppTypeID, - "botWriteAccessAllowReasonAcceptedRequest": BotWriteAccessAllowReasonAcceptedRequestTypeID, - "httpUrl": HTTPURLTypeID, - "userLink": UserLinkTypeID, - "targetChatTypes": TargetChatTypesTypeID, - "targetChatCurrent": TargetChatCurrentTypeID, - "targetChatChosen": TargetChatChosenTypeID, - "targetChatInternalLink": TargetChatInternalLinkTypeID, - "inputInlineQueryResultAnimation": InputInlineQueryResultAnimationTypeID, - "inputInlineQueryResultArticle": InputInlineQueryResultArticleTypeID, - "inputInlineQueryResultAudio": InputInlineQueryResultAudioTypeID, - "inputInlineQueryResultContact": InputInlineQueryResultContactTypeID, - "inputInlineQueryResultDocument": InputInlineQueryResultDocumentTypeID, - "inputInlineQueryResultGame": InputInlineQueryResultGameTypeID, - "inputInlineQueryResultLocation": InputInlineQueryResultLocationTypeID, - "inputInlineQueryResultPhoto": InputInlineQueryResultPhotoTypeID, - "inputInlineQueryResultSticker": InputInlineQueryResultStickerTypeID, - "inputInlineQueryResultVenue": InputInlineQueryResultVenueTypeID, - "inputInlineQueryResultVideo": InputInlineQueryResultVideoTypeID, - "inputInlineQueryResultVoiceNote": InputInlineQueryResultVoiceNoteTypeID, - "inlineQueryResultArticle": InlineQueryResultArticleTypeID, - "inlineQueryResultContact": InlineQueryResultContactTypeID, - "inlineQueryResultLocation": InlineQueryResultLocationTypeID, - "inlineQueryResultVenue": InlineQueryResultVenueTypeID, - "inlineQueryResultGame": InlineQueryResultGameTypeID, - "inlineQueryResultAnimation": InlineQueryResultAnimationTypeID, - "inlineQueryResultAudio": InlineQueryResultAudioTypeID, - "inlineQueryResultDocument": InlineQueryResultDocumentTypeID, - "inlineQueryResultPhoto": InlineQueryResultPhotoTypeID, - "inlineQueryResultSticker": InlineQueryResultStickerTypeID, - "inlineQueryResultVideo": InlineQueryResultVideoTypeID, - "inlineQueryResultVoiceNote": InlineQueryResultVoiceNoteTypeID, - "inlineQueryResultsButtonTypeStartBot": InlineQueryResultsButtonTypeStartBotTypeID, - "inlineQueryResultsButtonTypeWebApp": InlineQueryResultsButtonTypeWebAppTypeID, - "inlineQueryResultsButton": InlineQueryResultsButtonTypeID, - "inlineQueryResults": InlineQueryResultsTypeID, - "preparedInlineMessageId": PreparedInlineMessageIDTypeID, - "preparedInlineMessage": PreparedInlineMessageTypeID, - "callbackQueryPayloadData": CallbackQueryPayloadDataTypeID, - "callbackQueryPayloadDataWithPassword": CallbackQueryPayloadDataWithPasswordTypeID, - "callbackQueryPayloadGame": CallbackQueryPayloadGameTypeID, - "callbackQueryAnswer": CallbackQueryAnswerTypeID, - "customRequestResult": CustomRequestResultTypeID, - "gameHighScore": GameHighScoreTypeID, - "gameHighScores": GameHighScoresTypeID, - "chatEventMessageEdited": ChatEventMessageEditedTypeID, - "chatEventMessageDeleted": ChatEventMessageDeletedTypeID, - "chatEventMessagePinned": ChatEventMessagePinnedTypeID, - "chatEventMessageUnpinned": ChatEventMessageUnpinnedTypeID, - "chatEventPollStopped": ChatEventPollStoppedTypeID, - "chatEventMemberJoined": ChatEventMemberJoinedTypeID, - "chatEventMemberJoinedByInviteLink": ChatEventMemberJoinedByInviteLinkTypeID, - "chatEventMemberJoinedByRequest": ChatEventMemberJoinedByRequestTypeID, - "chatEventMemberInvited": ChatEventMemberInvitedTypeID, - "chatEventMemberLeft": ChatEventMemberLeftTypeID, - "chatEventMemberPromoted": ChatEventMemberPromotedTypeID, - "chatEventMemberRestricted": ChatEventMemberRestrictedTypeID, - "chatEventMemberSubscriptionExtended": ChatEventMemberSubscriptionExtendedTypeID, - "chatEventAvailableReactionsChanged": ChatEventAvailableReactionsChangedTypeID, - "chatEventBackgroundChanged": ChatEventBackgroundChangedTypeID, - "chatEventDescriptionChanged": ChatEventDescriptionChangedTypeID, - "chatEventEmojiStatusChanged": ChatEventEmojiStatusChangedTypeID, - "chatEventLinkedChatChanged": ChatEventLinkedChatChangedTypeID, - "chatEventLocationChanged": ChatEventLocationChangedTypeID, - "chatEventMessageAutoDeleteTimeChanged": ChatEventMessageAutoDeleteTimeChangedTypeID, - "chatEventPermissionsChanged": ChatEventPermissionsChangedTypeID, - "chatEventPhotoChanged": ChatEventPhotoChangedTypeID, - "chatEventSlowModeDelayChanged": ChatEventSlowModeDelayChangedTypeID, - "chatEventStickerSetChanged": ChatEventStickerSetChangedTypeID, - "chatEventCustomEmojiStickerSetChanged": ChatEventCustomEmojiStickerSetChangedTypeID, - "chatEventTitleChanged": ChatEventTitleChangedTypeID, - "chatEventUsernameChanged": ChatEventUsernameChangedTypeID, - "chatEventActiveUsernamesChanged": ChatEventActiveUsernamesChangedTypeID, - "chatEventAccentColorChanged": ChatEventAccentColorChangedTypeID, - "chatEventProfileAccentColorChanged": ChatEventProfileAccentColorChangedTypeID, - "chatEventHasProtectedContentToggled": ChatEventHasProtectedContentToggledTypeID, - "chatEventInvitesToggled": ChatEventInvitesToggledTypeID, - "chatEventIsAllHistoryAvailableToggled": ChatEventIsAllHistoryAvailableToggledTypeID, - "chatEventHasAggressiveAntiSpamEnabledToggled": ChatEventHasAggressiveAntiSpamEnabledToggledTypeID, - "chatEventSignMessagesToggled": ChatEventSignMessagesToggledTypeID, - "chatEventShowMessageSenderToggled": ChatEventShowMessageSenderToggledTypeID, - "chatEventInviteLinkEdited": ChatEventInviteLinkEditedTypeID, - "chatEventInviteLinkRevoked": ChatEventInviteLinkRevokedTypeID, - "chatEventInviteLinkDeleted": ChatEventInviteLinkDeletedTypeID, - "chatEventVideoChatCreated": ChatEventVideoChatCreatedTypeID, - "chatEventVideoChatEnded": ChatEventVideoChatEndedTypeID, - "chatEventVideoChatMuteNewParticipantsToggled": ChatEventVideoChatMuteNewParticipantsToggledTypeID, - "chatEventVideoChatParticipantIsMutedToggled": ChatEventVideoChatParticipantIsMutedToggledTypeID, - "chatEventVideoChatParticipantVolumeLevelChanged": ChatEventVideoChatParticipantVolumeLevelChangedTypeID, - "chatEventIsForumToggled": ChatEventIsForumToggledTypeID, - "chatEventForumTopicCreated": ChatEventForumTopicCreatedTypeID, - "chatEventForumTopicEdited": ChatEventForumTopicEditedTypeID, - "chatEventForumTopicToggleIsClosed": ChatEventForumTopicToggleIsClosedTypeID, - "chatEventForumTopicToggleIsHidden": ChatEventForumTopicToggleIsHiddenTypeID, - "chatEventForumTopicDeleted": ChatEventForumTopicDeletedTypeID, - "chatEventForumTopicPinned": ChatEventForumTopicPinnedTypeID, - "chatEvent": ChatEventTypeID, - "chatEvents": ChatEventsTypeID, - "chatEventLogFilters": ChatEventLogFiltersTypeID, - "languagePackStringValueOrdinary": LanguagePackStringValueOrdinaryTypeID, - "languagePackStringValuePluralized": LanguagePackStringValuePluralizedTypeID, - "languagePackStringValueDeleted": LanguagePackStringValueDeletedTypeID, - "languagePackString": LanguagePackStringTypeID, - "languagePackStrings": LanguagePackStringsTypeID, - "languagePackInfo": LanguagePackInfoTypeID, - "localizationTargetInfo": LocalizationTargetInfoTypeID, - "premiumLimitTypeSupergroupCount": PremiumLimitTypeSupergroupCountTypeID, - "premiumLimitTypePinnedChatCount": PremiumLimitTypePinnedChatCountTypeID, - "premiumLimitTypeCreatedPublicChatCount": PremiumLimitTypeCreatedPublicChatCountTypeID, - "premiumLimitTypeSavedAnimationCount": PremiumLimitTypeSavedAnimationCountTypeID, - "premiumLimitTypeFavoriteStickerCount": PremiumLimitTypeFavoriteStickerCountTypeID, - "premiumLimitTypeChatFolderCount": PremiumLimitTypeChatFolderCountTypeID, - "premiumLimitTypeChatFolderChosenChatCount": PremiumLimitTypeChatFolderChosenChatCountTypeID, - "premiumLimitTypePinnedArchivedChatCount": PremiumLimitTypePinnedArchivedChatCountTypeID, - "premiumLimitTypePinnedSavedMessagesTopicCount": PremiumLimitTypePinnedSavedMessagesTopicCountTypeID, - "premiumLimitTypeCaptionLength": PremiumLimitTypeCaptionLengthTypeID, - "premiumLimitTypeBioLength": PremiumLimitTypeBioLengthTypeID, - "premiumLimitTypeChatFolderInviteLinkCount": PremiumLimitTypeChatFolderInviteLinkCountTypeID, - "premiumLimitTypeShareableChatFolderCount": PremiumLimitTypeShareableChatFolderCountTypeID, - "premiumLimitTypeActiveStoryCount": PremiumLimitTypeActiveStoryCountTypeID, - "premiumLimitTypeWeeklySentStoryCount": PremiumLimitTypeWeeklySentStoryCountTypeID, - "premiumLimitTypeMonthlySentStoryCount": PremiumLimitTypeMonthlySentStoryCountTypeID, - "premiumLimitTypeStoryCaptionLength": PremiumLimitTypeStoryCaptionLengthTypeID, - "premiumLimitTypeStorySuggestedReactionAreaCount": PremiumLimitTypeStorySuggestedReactionAreaCountTypeID, - "premiumLimitTypeSimilarChatCount": PremiumLimitTypeSimilarChatCountTypeID, - "premiumFeatureIncreasedLimits": PremiumFeatureIncreasedLimitsTypeID, - "premiumFeatureIncreasedUploadFileSize": PremiumFeatureIncreasedUploadFileSizeTypeID, - "premiumFeatureImprovedDownloadSpeed": PremiumFeatureImprovedDownloadSpeedTypeID, - "premiumFeatureVoiceRecognition": PremiumFeatureVoiceRecognitionTypeID, - "premiumFeatureDisabledAds": PremiumFeatureDisabledAdsTypeID, - "premiumFeatureUniqueReactions": PremiumFeatureUniqueReactionsTypeID, - "premiumFeatureUniqueStickers": PremiumFeatureUniqueStickersTypeID, - "premiumFeatureCustomEmoji": PremiumFeatureCustomEmojiTypeID, - "premiumFeatureAdvancedChatManagement": PremiumFeatureAdvancedChatManagementTypeID, - "premiumFeatureProfileBadge": PremiumFeatureProfileBadgeTypeID, - "premiumFeatureEmojiStatus": PremiumFeatureEmojiStatusTypeID, - "premiumFeatureAnimatedProfilePhoto": PremiumFeatureAnimatedProfilePhotoTypeID, - "premiumFeatureForumTopicIcon": PremiumFeatureForumTopicIconTypeID, - "premiumFeatureAppIcons": PremiumFeatureAppIconsTypeID, - "premiumFeatureRealTimeChatTranslation": PremiumFeatureRealTimeChatTranslationTypeID, - "premiumFeatureUpgradedStories": PremiumFeatureUpgradedStoriesTypeID, - "premiumFeatureChatBoost": PremiumFeatureChatBoostTypeID, - "premiumFeatureAccentColor": PremiumFeatureAccentColorTypeID, - "premiumFeatureBackgroundForBoth": PremiumFeatureBackgroundForBothTypeID, - "premiumFeatureSavedMessagesTags": PremiumFeatureSavedMessagesTagsTypeID, - "premiumFeatureMessagePrivacy": PremiumFeatureMessagePrivacyTypeID, - "premiumFeatureLastSeenTimes": PremiumFeatureLastSeenTimesTypeID, - "premiumFeatureBusiness": PremiumFeatureBusinessTypeID, - "premiumFeatureMessageEffects": PremiumFeatureMessageEffectsTypeID, - "businessFeatureLocation": BusinessFeatureLocationTypeID, - "businessFeatureOpeningHours": BusinessFeatureOpeningHoursTypeID, - "businessFeatureQuickReplies": BusinessFeatureQuickRepliesTypeID, - "businessFeatureGreetingMessage": BusinessFeatureGreetingMessageTypeID, - "businessFeatureAwayMessage": BusinessFeatureAwayMessageTypeID, - "businessFeatureAccountLinks": BusinessFeatureAccountLinksTypeID, - "businessFeatureStartPage": BusinessFeatureStartPageTypeID, - "businessFeatureBots": BusinessFeatureBotsTypeID, - "businessFeatureEmojiStatus": BusinessFeatureEmojiStatusTypeID, - "businessFeatureChatFolderTags": BusinessFeatureChatFolderTagsTypeID, - "businessFeatureUpgradedStories": BusinessFeatureUpgradedStoriesTypeID, - "premiumStoryFeaturePriorityOrder": PremiumStoryFeaturePriorityOrderTypeID, - "premiumStoryFeatureStealthMode": PremiumStoryFeatureStealthModeTypeID, - "premiumStoryFeaturePermanentViewsHistory": PremiumStoryFeaturePermanentViewsHistoryTypeID, - "premiumStoryFeatureCustomExpirationDuration": PremiumStoryFeatureCustomExpirationDurationTypeID, - "premiumStoryFeatureSaveStories": PremiumStoryFeatureSaveStoriesTypeID, - "premiumStoryFeatureLinksAndFormatting": PremiumStoryFeatureLinksAndFormattingTypeID, - "premiumStoryFeatureVideoQuality": PremiumStoryFeatureVideoQualityTypeID, - "premiumLimit": PremiumLimitTypeID, - "premiumFeatures": PremiumFeaturesTypeID, - "businessFeatures": BusinessFeaturesTypeID, - "premiumSourceLimitExceeded": PremiumSourceLimitExceededTypeID, - "premiumSourceFeature": PremiumSourceFeatureTypeID, - "premiumSourceBusinessFeature": PremiumSourceBusinessFeatureTypeID, - "premiumSourceStoryFeature": PremiumSourceStoryFeatureTypeID, - "premiumSourceLink": PremiumSourceLinkTypeID, - "premiumSourceSettings": PremiumSourceSettingsTypeID, - "premiumFeaturePromotionAnimation": PremiumFeaturePromotionAnimationTypeID, - "businessFeaturePromotionAnimation": BusinessFeaturePromotionAnimationTypeID, - "premiumState": PremiumStateTypeID, - "storePaymentPurposePremiumSubscription": StorePaymentPurposePremiumSubscriptionTypeID, - "storePaymentPurposePremiumGiftCodes": StorePaymentPurposePremiumGiftCodesTypeID, - "storePaymentPurposePremiumGiveaway": StorePaymentPurposePremiumGiveawayTypeID, - "storePaymentPurposeStarGiveaway": StorePaymentPurposeStarGiveawayTypeID, - "storePaymentPurposeStars": StorePaymentPurposeStarsTypeID, - "storePaymentPurposeGiftedStars": StorePaymentPurposeGiftedStarsTypeID, - "telegramPaymentPurposePremiumGiftCodes": TelegramPaymentPurposePremiumGiftCodesTypeID, - "telegramPaymentPurposePremiumGiveaway": TelegramPaymentPurposePremiumGiveawayTypeID, - "telegramPaymentPurposeStars": TelegramPaymentPurposeStarsTypeID, - "telegramPaymentPurposeGiftedStars": TelegramPaymentPurposeGiftedStarsTypeID, - "telegramPaymentPurposeStarGiveaway": TelegramPaymentPurposeStarGiveawayTypeID, - "telegramPaymentPurposeJoinChat": TelegramPaymentPurposeJoinChatTypeID, - "deviceTokenFirebaseCloudMessaging": DeviceTokenFirebaseCloudMessagingTypeID, - "deviceTokenApplePush": DeviceTokenApplePushTypeID, - "deviceTokenApplePushVoIP": DeviceTokenApplePushVoIPTypeID, - "deviceTokenWindowsPush": DeviceTokenWindowsPushTypeID, - "deviceTokenMicrosoftPush": DeviceTokenMicrosoftPushTypeID, - "deviceTokenMicrosoftPushVoIP": DeviceTokenMicrosoftPushVoIPTypeID, - "deviceTokenWebPush": DeviceTokenWebPushTypeID, - "deviceTokenSimplePush": DeviceTokenSimplePushTypeID, - "deviceTokenUbuntuPush": DeviceTokenUbuntuPushTypeID, - "deviceTokenBlackBerryPush": DeviceTokenBlackBerryPushTypeID, - "deviceTokenTizenPush": DeviceTokenTizenPushTypeID, - "deviceTokenHuaweiPush": DeviceTokenHuaweiPushTypeID, - "pushReceiverId": PushReceiverIDTypeID, - "backgroundFillSolid": BackgroundFillSolidTypeID, - "backgroundFillGradient": BackgroundFillGradientTypeID, - "backgroundFillFreeformGradient": BackgroundFillFreeformGradientTypeID, - "backgroundTypeWallpaper": BackgroundTypeWallpaperTypeID, - "backgroundTypePattern": BackgroundTypePatternTypeID, - "backgroundTypeFill": BackgroundTypeFillTypeID, - "backgroundTypeChatTheme": BackgroundTypeChatThemeTypeID, - "inputBackgroundLocal": InputBackgroundLocalTypeID, - "inputBackgroundRemote": InputBackgroundRemoteTypeID, - "inputBackgroundPrevious": InputBackgroundPreviousTypeID, - "chatTheme": ChatThemeTypeID, - "timeZone": TimeZoneTypeID, - "timeZones": TimeZonesTypeID, - "hashtags": HashtagsTypeID, - "canSendStoryResultOk": CanSendStoryResultOkTypeID, - "canSendStoryResultPremiumNeeded": CanSendStoryResultPremiumNeededTypeID, - "canSendStoryResultBoostNeeded": CanSendStoryResultBoostNeededTypeID, - "canSendStoryResultActiveStoryLimitExceeded": CanSendStoryResultActiveStoryLimitExceededTypeID, - "canSendStoryResultWeeklyLimitExceeded": CanSendStoryResultWeeklyLimitExceededTypeID, - "canSendStoryResultMonthlyLimitExceeded": CanSendStoryResultMonthlyLimitExceededTypeID, - "canTransferOwnershipResultOk": CanTransferOwnershipResultOkTypeID, - "canTransferOwnershipResultPasswordNeeded": CanTransferOwnershipResultPasswordNeededTypeID, - "canTransferOwnershipResultPasswordTooFresh": CanTransferOwnershipResultPasswordTooFreshTypeID, - "canTransferOwnershipResultSessionTooFresh": CanTransferOwnershipResultSessionTooFreshTypeID, - "checkChatUsernameResultOk": CheckChatUsernameResultOkTypeID, - "checkChatUsernameResultUsernameInvalid": CheckChatUsernameResultUsernameInvalidTypeID, - "checkChatUsernameResultUsernameOccupied": CheckChatUsernameResultUsernameOccupiedTypeID, - "checkChatUsernameResultUsernamePurchasable": CheckChatUsernameResultUsernamePurchasableTypeID, - "checkChatUsernameResultPublicChatsTooMany": CheckChatUsernameResultPublicChatsTooManyTypeID, - "checkChatUsernameResultPublicGroupsUnavailable": CheckChatUsernameResultPublicGroupsUnavailableTypeID, - "checkStickerSetNameResultOk": CheckStickerSetNameResultOkTypeID, - "checkStickerSetNameResultNameInvalid": CheckStickerSetNameResultNameInvalidTypeID, - "checkStickerSetNameResultNameOccupied": CheckStickerSetNameResultNameOccupiedTypeID, - "resetPasswordResultOk": ResetPasswordResultOkTypeID, - "resetPasswordResultPending": ResetPasswordResultPendingTypeID, - "resetPasswordResultDeclined": ResetPasswordResultDeclinedTypeID, - "messageFileTypePrivate": MessageFileTypePrivateTypeID, - "messageFileTypeGroup": MessageFileTypeGroupTypeID, - "messageFileTypeUnknown": MessageFileTypeUnknownTypeID, - "pushMessageContentHidden": PushMessageContentHiddenTypeID, - "pushMessageContentAnimation": PushMessageContentAnimationTypeID, - "pushMessageContentAudio": PushMessageContentAudioTypeID, - "pushMessageContentContact": PushMessageContentContactTypeID, - "pushMessageContentContactRegistered": PushMessageContentContactRegisteredTypeID, - "pushMessageContentDocument": PushMessageContentDocumentTypeID, - "pushMessageContentGame": PushMessageContentGameTypeID, - "pushMessageContentGameScore": PushMessageContentGameScoreTypeID, - "pushMessageContentInvoice": PushMessageContentInvoiceTypeID, - "pushMessageContentLocation": PushMessageContentLocationTypeID, - "pushMessageContentPaidMedia": PushMessageContentPaidMediaTypeID, - "pushMessageContentPhoto": PushMessageContentPhotoTypeID, - "pushMessageContentPoll": PushMessageContentPollTypeID, - "pushMessageContentPremiumGiftCode": PushMessageContentPremiumGiftCodeTypeID, - "pushMessageContentGiveaway": PushMessageContentGiveawayTypeID, - "pushMessageContentGift": PushMessageContentGiftTypeID, - "pushMessageContentUpgradedGift": PushMessageContentUpgradedGiftTypeID, - "pushMessageContentScreenshotTaken": PushMessageContentScreenshotTakenTypeID, - "pushMessageContentSticker": PushMessageContentStickerTypeID, - "pushMessageContentStory": PushMessageContentStoryTypeID, - "pushMessageContentText": PushMessageContentTextTypeID, - "pushMessageContentVideo": PushMessageContentVideoTypeID, - "pushMessageContentVideoNote": PushMessageContentVideoNoteTypeID, - "pushMessageContentVoiceNote": PushMessageContentVoiceNoteTypeID, - "pushMessageContentBasicGroupChatCreate": PushMessageContentBasicGroupChatCreateTypeID, - "pushMessageContentChatAddMembers": PushMessageContentChatAddMembersTypeID, - "pushMessageContentChatChangePhoto": PushMessageContentChatChangePhotoTypeID, - "pushMessageContentChatChangeTitle": PushMessageContentChatChangeTitleTypeID, - "pushMessageContentChatSetBackground": PushMessageContentChatSetBackgroundTypeID, - "pushMessageContentChatSetTheme": PushMessageContentChatSetThemeTypeID, - "pushMessageContentChatDeleteMember": PushMessageContentChatDeleteMemberTypeID, - "pushMessageContentChatJoinByLink": PushMessageContentChatJoinByLinkTypeID, - "pushMessageContentChatJoinByRequest": PushMessageContentChatJoinByRequestTypeID, - "pushMessageContentRecurringPayment": PushMessageContentRecurringPaymentTypeID, - "pushMessageContentSuggestProfilePhoto": PushMessageContentSuggestProfilePhotoTypeID, - "pushMessageContentMessageForwards": PushMessageContentMessageForwardsTypeID, - "pushMessageContentMediaAlbum": PushMessageContentMediaAlbumTypeID, - "notificationTypeNewMessage": NotificationTypeNewMessageTypeID, - "notificationTypeNewSecretChat": NotificationTypeNewSecretChatTypeID, - "notificationTypeNewCall": NotificationTypeNewCallTypeID, - "notificationTypeNewPushMessage": NotificationTypeNewPushMessageTypeID, - "notificationGroupTypeMessages": NotificationGroupTypeMessagesTypeID, - "notificationGroupTypeMentions": NotificationGroupTypeMentionsTypeID, - "notificationGroupTypeSecretChat": NotificationGroupTypeSecretChatTypeID, - "notificationGroupTypeCalls": NotificationGroupTypeCallsTypeID, - "notificationSound": NotificationSoundTypeID, - "notificationSounds": NotificationSoundsTypeID, - "notification": NotificationTypeID, - "notificationGroup": NotificationGroupTypeID, - "optionValueBoolean": OptionValueBooleanTypeID, - "optionValueEmpty": OptionValueEmptyTypeID, - "optionValueInteger": OptionValueIntegerTypeID, - "optionValueString": OptionValueStringTypeID, - "jsonObjectMember": JSONObjectMemberTypeID, - "jsonValueNull": JSONValueNullTypeID, - "jsonValueBoolean": JSONValueBooleanTypeID, - "jsonValueNumber": JSONValueNumberTypeID, - "jsonValueString": JSONValueStringTypeID, - "jsonValueArray": JSONValueArrayTypeID, - "jsonValueObject": JSONValueObjectTypeID, - "storyPrivacySettingsEveryone": StoryPrivacySettingsEveryoneTypeID, - "storyPrivacySettingsContacts": StoryPrivacySettingsContactsTypeID, - "storyPrivacySettingsCloseFriends": StoryPrivacySettingsCloseFriendsTypeID, - "storyPrivacySettingsSelectedUsers": StoryPrivacySettingsSelectedUsersTypeID, - "userPrivacySettingRuleAllowAll": UserPrivacySettingRuleAllowAllTypeID, - "userPrivacySettingRuleAllowContacts": UserPrivacySettingRuleAllowContactsTypeID, - "userPrivacySettingRuleAllowBots": UserPrivacySettingRuleAllowBotsTypeID, - "userPrivacySettingRuleAllowPremiumUsers": UserPrivacySettingRuleAllowPremiumUsersTypeID, - "userPrivacySettingRuleAllowUsers": UserPrivacySettingRuleAllowUsersTypeID, - "userPrivacySettingRuleAllowChatMembers": UserPrivacySettingRuleAllowChatMembersTypeID, - "userPrivacySettingRuleRestrictAll": UserPrivacySettingRuleRestrictAllTypeID, - "userPrivacySettingRuleRestrictContacts": UserPrivacySettingRuleRestrictContactsTypeID, - "userPrivacySettingRuleRestrictBots": UserPrivacySettingRuleRestrictBotsTypeID, - "userPrivacySettingRuleRestrictUsers": UserPrivacySettingRuleRestrictUsersTypeID, - "userPrivacySettingRuleRestrictChatMembers": UserPrivacySettingRuleRestrictChatMembersTypeID, - "userPrivacySettingRules": UserPrivacySettingRulesTypeID, - "userPrivacySettingShowStatus": UserPrivacySettingShowStatusTypeID, - "userPrivacySettingShowProfilePhoto": UserPrivacySettingShowProfilePhotoTypeID, - "userPrivacySettingShowLinkInForwardedMessages": UserPrivacySettingShowLinkInForwardedMessagesTypeID, - "userPrivacySettingShowPhoneNumber": UserPrivacySettingShowPhoneNumberTypeID, - "userPrivacySettingShowBio": UserPrivacySettingShowBioTypeID, - "userPrivacySettingShowBirthdate": UserPrivacySettingShowBirthdateTypeID, - "userPrivacySettingAllowChatInvites": UserPrivacySettingAllowChatInvitesTypeID, - "userPrivacySettingAllowCalls": UserPrivacySettingAllowCallsTypeID, - "userPrivacySettingAllowPeerToPeerCalls": UserPrivacySettingAllowPeerToPeerCallsTypeID, - "userPrivacySettingAllowFindingByPhoneNumber": UserPrivacySettingAllowFindingByPhoneNumberTypeID, - "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages": UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID, - "userPrivacySettingAutosaveGifts": UserPrivacySettingAutosaveGiftsTypeID, - "readDatePrivacySettings": ReadDatePrivacySettingsTypeID, - "newChatPrivacySettings": NewChatPrivacySettingsTypeID, - "canSendMessageToUserResultOk": CanSendMessageToUserResultOkTypeID, - "canSendMessageToUserResultUserIsDeleted": CanSendMessageToUserResultUserIsDeletedTypeID, - "canSendMessageToUserResultUserRestrictsNewChats": CanSendMessageToUserResultUserRestrictsNewChatsTypeID, - "accountTtl": AccountTTLTypeID, - "messageAutoDeleteTime": MessageAutoDeleteTimeTypeID, - "sessionTypeAndroid": SessionTypeAndroidTypeID, - "sessionTypeApple": SessionTypeAppleTypeID, - "sessionTypeBrave": SessionTypeBraveTypeID, - "sessionTypeChrome": SessionTypeChromeTypeID, - "sessionTypeEdge": SessionTypeEdgeTypeID, - "sessionTypeFirefox": SessionTypeFirefoxTypeID, - "sessionTypeIpad": SessionTypeIpadTypeID, - "sessionTypeIphone": SessionTypeIphoneTypeID, - "sessionTypeLinux": SessionTypeLinuxTypeID, - "sessionTypeMac": SessionTypeMACTypeID, - "sessionTypeOpera": SessionTypeOperaTypeID, - "sessionTypeSafari": SessionTypeSafariTypeID, - "sessionTypeUbuntu": SessionTypeUbuntuTypeID, - "sessionTypeUnknown": SessionTypeUnknownTypeID, - "sessionTypeVivaldi": SessionTypeVivaldiTypeID, - "sessionTypeWindows": SessionTypeWindowsTypeID, - "sessionTypeXbox": SessionTypeXboxTypeID, - "session": SessionTypeID, - "sessions": SessionsTypeID, - "unconfirmedSession": UnconfirmedSessionTypeID, - "connectedWebsite": ConnectedWebsiteTypeID, - "connectedWebsites": ConnectedWebsitesTypeID, - "reportReasonSpam": ReportReasonSpamTypeID, - "reportReasonViolence": ReportReasonViolenceTypeID, - "reportReasonPornography": ReportReasonPornographyTypeID, - "reportReasonChildAbuse": ReportReasonChildAbuseTypeID, - "reportReasonCopyright": ReportReasonCopyrightTypeID, - "reportReasonUnrelatedLocation": ReportReasonUnrelatedLocationTypeID, - "reportReasonFake": ReportReasonFakeTypeID, - "reportReasonIllegalDrugs": ReportReasonIllegalDrugsTypeID, - "reportReasonPersonalDetails": ReportReasonPersonalDetailsTypeID, - "reportReasonCustom": ReportReasonCustomTypeID, - "reportChatResultOk": ReportChatResultOkTypeID, - "reportChatResultOptionRequired": ReportChatResultOptionRequiredTypeID, - "reportChatResultTextRequired": ReportChatResultTextRequiredTypeID, - "reportChatResultMessagesRequired": ReportChatResultMessagesRequiredTypeID, - "reportStoryResultOk": ReportStoryResultOkTypeID, - "reportStoryResultOptionRequired": ReportStoryResultOptionRequiredTypeID, - "reportStoryResultTextRequired": ReportStoryResultTextRequiredTypeID, - "internalLinkTypeActiveSessions": InternalLinkTypeActiveSessionsTypeID, - "internalLinkTypeAttachmentMenuBot": InternalLinkTypeAttachmentMenuBotTypeID, - "internalLinkTypeAuthenticationCode": InternalLinkTypeAuthenticationCodeTypeID, - "internalLinkTypeBackground": InternalLinkTypeBackgroundTypeID, - "internalLinkTypeBotAddToChannel": InternalLinkTypeBotAddToChannelTypeID, - "internalLinkTypeBotStart": InternalLinkTypeBotStartTypeID, - "internalLinkTypeBotStartInGroup": InternalLinkTypeBotStartInGroupTypeID, - "internalLinkTypeBusinessChat": InternalLinkTypeBusinessChatTypeID, - "internalLinkTypeBuyStars": InternalLinkTypeBuyStarsTypeID, - "internalLinkTypeChangePhoneNumber": InternalLinkTypeChangePhoneNumberTypeID, - "internalLinkTypeChatAffiliateProgram": InternalLinkTypeChatAffiliateProgramTypeID, - "internalLinkTypeChatBoost": InternalLinkTypeChatBoostTypeID, - "internalLinkTypeChatFolderInvite": InternalLinkTypeChatFolderInviteTypeID, - "internalLinkTypeChatFolderSettings": InternalLinkTypeChatFolderSettingsTypeID, - "internalLinkTypeChatInvite": InternalLinkTypeChatInviteTypeID, - "internalLinkTypeDefaultMessageAutoDeleteTimerSettings": InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID, - "internalLinkTypeEditProfileSettings": InternalLinkTypeEditProfileSettingsTypeID, - "internalLinkTypeGame": InternalLinkTypeGameTypeID, - "internalLinkTypeInstantView": InternalLinkTypeInstantViewTypeID, - "internalLinkTypeInvoice": InternalLinkTypeInvoiceTypeID, - "internalLinkTypeLanguagePack": InternalLinkTypeLanguagePackTypeID, - "internalLinkTypeLanguageSettings": InternalLinkTypeLanguageSettingsTypeID, - "internalLinkTypeMainWebApp": InternalLinkTypeMainWebAppTypeID, - "internalLinkTypeMessage": InternalLinkTypeMessageTypeID, - "internalLinkTypeMessageDraft": InternalLinkTypeMessageDraftTypeID, - "internalLinkTypePassportDataRequest": InternalLinkTypePassportDataRequestTypeID, - "internalLinkTypePhoneNumberConfirmation": InternalLinkTypePhoneNumberConfirmationTypeID, - "internalLinkTypePremiumFeatures": InternalLinkTypePremiumFeaturesTypeID, - "internalLinkTypePremiumGift": InternalLinkTypePremiumGiftTypeID, - "internalLinkTypePremiumGiftCode": InternalLinkTypePremiumGiftCodeTypeID, - "internalLinkTypePrivacyAndSecuritySettings": InternalLinkTypePrivacyAndSecuritySettingsTypeID, - "internalLinkTypeProxy": InternalLinkTypeProxyTypeID, - "internalLinkTypePublicChat": InternalLinkTypePublicChatTypeID, - "internalLinkTypeQrCodeAuthentication": InternalLinkTypeQrCodeAuthenticationTypeID, - "internalLinkTypeRestorePurchases": InternalLinkTypeRestorePurchasesTypeID, - "internalLinkTypeSettings": InternalLinkTypeSettingsTypeID, - "internalLinkTypeStickerSet": InternalLinkTypeStickerSetTypeID, - "internalLinkTypeStory": InternalLinkTypeStoryTypeID, - "internalLinkTypeTheme": InternalLinkTypeThemeTypeID, - "internalLinkTypeThemeSettings": InternalLinkTypeThemeSettingsTypeID, - "internalLinkTypeUnknownDeepLink": InternalLinkTypeUnknownDeepLinkTypeID, - "internalLinkTypeUnsupportedProxy": InternalLinkTypeUnsupportedProxyTypeID, - "internalLinkTypeUserPhoneNumber": InternalLinkTypeUserPhoneNumberTypeID, - "internalLinkTypeUserToken": InternalLinkTypeUserTokenTypeID, - "internalLinkTypeVideoChat": InternalLinkTypeVideoChatTypeID, - "internalLinkTypeWebApp": InternalLinkTypeWebAppTypeID, - "messageLink": MessageLinkTypeID, - "messageLinkInfo": MessageLinkInfoTypeID, - "chatBoostLink": ChatBoostLinkTypeID, - "chatBoostLinkInfo": ChatBoostLinkInfoTypeID, - "blockListMain": BlockListMainTypeID, - "blockListStories": BlockListStoriesTypeID, - "filePart": FilePartTypeID, - "fileTypeNone": FileTypeNoneTypeID, - "fileTypeAnimation": FileTypeAnimationTypeID, - "fileTypeAudio": FileTypeAudioTypeID, - "fileTypeDocument": FileTypeDocumentTypeID, - "fileTypeNotificationSound": FileTypeNotificationSoundTypeID, - "fileTypePhoto": FileTypePhotoTypeID, - "fileTypePhotoStory": FileTypePhotoStoryTypeID, - "fileTypeProfilePhoto": FileTypeProfilePhotoTypeID, - "fileTypeSecret": FileTypeSecretTypeID, - "fileTypeSecretThumbnail": FileTypeSecretThumbnailTypeID, - "fileTypeSecure": FileTypeSecureTypeID, - "fileTypeSelfDestructingPhoto": FileTypeSelfDestructingPhotoTypeID, - "fileTypeSelfDestructingVideo": FileTypeSelfDestructingVideoTypeID, - "fileTypeSelfDestructingVideoNote": FileTypeSelfDestructingVideoNoteTypeID, - "fileTypeSelfDestructingVoiceNote": FileTypeSelfDestructingVoiceNoteTypeID, - "fileTypeSticker": FileTypeStickerTypeID, - "fileTypeThumbnail": FileTypeThumbnailTypeID, - "fileTypeUnknown": FileTypeUnknownTypeID, - "fileTypeVideo": FileTypeVideoTypeID, - "fileTypeVideoNote": FileTypeVideoNoteTypeID, - "fileTypeVideoStory": FileTypeVideoStoryTypeID, - "fileTypeVoiceNote": FileTypeVoiceNoteTypeID, - "fileTypeWallpaper": FileTypeWallpaperTypeID, - "storageStatisticsByFileType": StorageStatisticsByFileTypeTypeID, - "storageStatisticsByChat": StorageStatisticsByChatTypeID, - "storageStatistics": StorageStatisticsTypeID, - "storageStatisticsFast": StorageStatisticsFastTypeID, - "databaseStatistics": DatabaseStatisticsTypeID, - "networkTypeNone": NetworkTypeNoneTypeID, - "networkTypeMobile": NetworkTypeMobileTypeID, - "networkTypeMobileRoaming": NetworkTypeMobileRoamingTypeID, - "networkTypeWiFi": NetworkTypeWiFiTypeID, - "networkTypeOther": NetworkTypeOtherTypeID, - "networkStatisticsEntryFile": NetworkStatisticsEntryFileTypeID, - "networkStatisticsEntryCall": NetworkStatisticsEntryCallTypeID, - "networkStatistics": NetworkStatisticsTypeID, - "autoDownloadSettings": AutoDownloadSettingsTypeID, - "autoDownloadSettingsPresets": AutoDownloadSettingsPresetsTypeID, - "autosaveSettingsScopePrivateChats": AutosaveSettingsScopePrivateChatsTypeID, - "autosaveSettingsScopeGroupChats": AutosaveSettingsScopeGroupChatsTypeID, - "autosaveSettingsScopeChannelChats": AutosaveSettingsScopeChannelChatsTypeID, - "autosaveSettingsScopeChat": AutosaveSettingsScopeChatTypeID, - "scopeAutosaveSettings": ScopeAutosaveSettingsTypeID, - "autosaveSettingsException": AutosaveSettingsExceptionTypeID, - "autosaveSettings": AutosaveSettingsTypeID, - "connectionStateWaitingForNetwork": ConnectionStateWaitingForNetworkTypeID, - "connectionStateConnectingToProxy": ConnectionStateConnectingToProxyTypeID, - "connectionStateConnecting": ConnectionStateConnectingTypeID, - "connectionStateUpdating": ConnectionStateUpdatingTypeID, - "connectionStateReady": ConnectionStateReadyTypeID, - "topChatCategoryUsers": TopChatCategoryUsersTypeID, - "topChatCategoryBots": TopChatCategoryBotsTypeID, - "topChatCategoryGroups": TopChatCategoryGroupsTypeID, - "topChatCategoryChannels": TopChatCategoryChannelsTypeID, - "topChatCategoryInlineBots": TopChatCategoryInlineBotsTypeID, - "topChatCategoryWebAppBots": TopChatCategoryWebAppBotsTypeID, - "topChatCategoryCalls": TopChatCategoryCallsTypeID, - "topChatCategoryForwardChats": TopChatCategoryForwardChatsTypeID, - "foundPosition": FoundPositionTypeID, - "foundPositions": FoundPositionsTypeID, - "tMeUrlTypeUser": TMeURLTypeUserTypeID, - "tMeUrlTypeSupergroup": TMeURLTypeSupergroupTypeID, - "tMeUrlTypeChatInvite": TMeURLTypeChatInviteTypeID, - "tMeUrlTypeStickerSet": TMeURLTypeStickerSetTypeID, - "tMeUrl": TMeURLTypeID, - "tMeUrls": TMeURLsTypeID, - "suggestedActionEnableArchiveAndMuteNewChats": SuggestedActionEnableArchiveAndMuteNewChatsTypeID, - "suggestedActionCheckPassword": SuggestedActionCheckPasswordTypeID, - "suggestedActionCheckPhoneNumber": SuggestedActionCheckPhoneNumberTypeID, - "suggestedActionViewChecksHint": SuggestedActionViewChecksHintTypeID, - "suggestedActionConvertToBroadcastGroup": SuggestedActionConvertToBroadcastGroupTypeID, - "suggestedActionSetPassword": SuggestedActionSetPasswordTypeID, - "suggestedActionUpgradePremium": SuggestedActionUpgradePremiumTypeID, - "suggestedActionRestorePremium": SuggestedActionRestorePremiumTypeID, - "suggestedActionSubscribeToAnnualPremium": SuggestedActionSubscribeToAnnualPremiumTypeID, - "suggestedActionGiftPremiumForChristmas": SuggestedActionGiftPremiumForChristmasTypeID, - "suggestedActionSetBirthdate": SuggestedActionSetBirthdateTypeID, - "suggestedActionSetProfilePhoto": SuggestedActionSetProfilePhotoTypeID, - "suggestedActionExtendPremium": SuggestedActionExtendPremiumTypeID, - "suggestedActionExtendStarSubscriptions": SuggestedActionExtendStarSubscriptionsTypeID, - "count": CountTypeID, - "text": TextTypeID, - "seconds": SecondsTypeID, - "fileDownloadedPrefixSize": FileDownloadedPrefixSizeTypeID, - "deepLinkInfo": DeepLinkInfoTypeID, - "textParseModeMarkdown": TextParseModeMarkdownTypeID, - "textParseModeHTML": TextParseModeHTMLTypeID, - "proxyTypeSocks5": ProxyTypeSocks5TypeID, - "proxyTypeHttp": ProxyTypeHTTPTypeID, - "proxyTypeMtproto": ProxyTypeMtprotoTypeID, - "proxy": ProxyTypeID, - "proxies": ProxiesTypeID, - "inputSticker": InputStickerTypeID, - "dateRange": DateRangeTypeID, - "statisticalValue": StatisticalValueTypeID, - "statisticalGraphData": StatisticalGraphDataTypeID, - "statisticalGraphAsync": StatisticalGraphAsyncTypeID, - "statisticalGraphError": StatisticalGraphErrorTypeID, - "chatStatisticsObjectTypeMessage": ChatStatisticsObjectTypeMessageTypeID, - "chatStatisticsObjectTypeStory": ChatStatisticsObjectTypeStoryTypeID, - "chatStatisticsInteractionInfo": ChatStatisticsInteractionInfoTypeID, - "chatStatisticsMessageSenderInfo": ChatStatisticsMessageSenderInfoTypeID, - "chatStatisticsAdministratorActionsInfo": ChatStatisticsAdministratorActionsInfoTypeID, - "chatStatisticsInviterInfo": ChatStatisticsInviterInfoTypeID, - "chatStatisticsSupergroup": ChatStatisticsSupergroupTypeID, - "chatStatisticsChannel": ChatStatisticsChannelTypeID, - "chatRevenueAmount": ChatRevenueAmountTypeID, - "chatRevenueStatistics": ChatRevenueStatisticsTypeID, - "messageStatistics": MessageStatisticsTypeID, - "storyStatistics": StoryStatisticsTypeID, - "revenueWithdrawalStatePending": RevenueWithdrawalStatePendingTypeID, - "revenueWithdrawalStateSucceeded": RevenueWithdrawalStateSucceededTypeID, - "revenueWithdrawalStateFailed": RevenueWithdrawalStateFailedTypeID, - "chatRevenueTransactionTypeEarnings": ChatRevenueTransactionTypeEarningsTypeID, - "chatRevenueTransactionTypeWithdrawal": ChatRevenueTransactionTypeWithdrawalTypeID, - "chatRevenueTransactionTypeRefund": ChatRevenueTransactionTypeRefundTypeID, - "chatRevenueTransaction": ChatRevenueTransactionTypeID, - "chatRevenueTransactions": ChatRevenueTransactionsTypeID, - "starRevenueStatus": StarRevenueStatusTypeID, - "starRevenueStatistics": StarRevenueStatisticsTypeID, - "point": PointTypeID, - "vectorPathCommandLine": VectorPathCommandLineTypeID, - "vectorPathCommandCubicBezierCurve": VectorPathCommandCubicBezierCurveTypeID, - "botCommandScopeDefault": BotCommandScopeDefaultTypeID, - "botCommandScopeAllPrivateChats": BotCommandScopeAllPrivateChatsTypeID, - "botCommandScopeAllGroupChats": BotCommandScopeAllGroupChatsTypeID, - "botCommandScopeAllChatAdministrators": BotCommandScopeAllChatAdministratorsTypeID, - "botCommandScopeChat": BotCommandScopeChatTypeID, - "botCommandScopeChatAdministrators": BotCommandScopeChatAdministratorsTypeID, - "botCommandScopeChatMember": BotCommandScopeChatMemberTypeID, - "phoneNumberCodeTypeChange": PhoneNumberCodeTypeChangeTypeID, - "phoneNumberCodeTypeVerify": PhoneNumberCodeTypeVerifyTypeID, - "phoneNumberCodeTypeConfirmOwnership": PhoneNumberCodeTypeConfirmOwnershipTypeID, - "updateAuthorizationState": UpdateAuthorizationStateTypeID, - "updateNewMessage": UpdateNewMessageTypeID, - "updateMessageSendAcknowledged": UpdateMessageSendAcknowledgedTypeID, - "updateMessageSendSucceeded": UpdateMessageSendSucceededTypeID, - "updateMessageSendFailed": UpdateMessageSendFailedTypeID, - "updateMessageContent": UpdateMessageContentTypeID, - "updateMessageEdited": UpdateMessageEditedTypeID, - "updateMessageIsPinned": UpdateMessageIsPinnedTypeID, - "updateMessageInteractionInfo": UpdateMessageInteractionInfoTypeID, - "updateMessageContentOpened": UpdateMessageContentOpenedTypeID, - "updateMessageMentionRead": UpdateMessageMentionReadTypeID, - "updateMessageUnreadReactions": UpdateMessageUnreadReactionsTypeID, - "updateMessageFactCheck": UpdateMessageFactCheckTypeID, - "updateMessageLiveLocationViewed": UpdateMessageLiveLocationViewedTypeID, - "updateVideoPublished": UpdateVideoPublishedTypeID, - "updateNewChat": UpdateNewChatTypeID, - "updateChatTitle": UpdateChatTitleTypeID, - "updateChatPhoto": UpdateChatPhotoTypeID, - "updateChatAccentColors": UpdateChatAccentColorsTypeID, - "updateChatPermissions": UpdateChatPermissionsTypeID, - "updateChatLastMessage": UpdateChatLastMessageTypeID, - "updateChatPosition": UpdateChatPositionTypeID, - "updateChatAddedToList": UpdateChatAddedToListTypeID, - "updateChatRemovedFromList": UpdateChatRemovedFromListTypeID, - "updateChatReadInbox": UpdateChatReadInboxTypeID, - "updateChatReadOutbox": UpdateChatReadOutboxTypeID, - "updateChatActionBar": UpdateChatActionBarTypeID, - "updateChatBusinessBotManageBar": UpdateChatBusinessBotManageBarTypeID, - "updateChatAvailableReactions": UpdateChatAvailableReactionsTypeID, - "updateChatDraftMessage": UpdateChatDraftMessageTypeID, - "updateChatEmojiStatus": UpdateChatEmojiStatusTypeID, - "updateChatMessageSender": UpdateChatMessageSenderTypeID, - "updateChatMessageAutoDeleteTime": UpdateChatMessageAutoDeleteTimeTypeID, - "updateChatNotificationSettings": UpdateChatNotificationSettingsTypeID, - "updateChatPendingJoinRequests": UpdateChatPendingJoinRequestsTypeID, - "updateChatReplyMarkup": UpdateChatReplyMarkupTypeID, - "updateChatBackground": UpdateChatBackgroundTypeID, - "updateChatTheme": UpdateChatThemeTypeID, - "updateChatUnreadMentionCount": UpdateChatUnreadMentionCountTypeID, - "updateChatUnreadReactionCount": UpdateChatUnreadReactionCountTypeID, - "updateChatVideoChat": UpdateChatVideoChatTypeID, - "updateChatDefaultDisableNotification": UpdateChatDefaultDisableNotificationTypeID, - "updateChatHasProtectedContent": UpdateChatHasProtectedContentTypeID, - "updateChatIsTranslatable": UpdateChatIsTranslatableTypeID, - "updateChatIsMarkedAsUnread": UpdateChatIsMarkedAsUnreadTypeID, - "updateChatViewAsTopics": UpdateChatViewAsTopicsTypeID, - "updateChatBlockList": UpdateChatBlockListTypeID, - "updateChatHasScheduledMessages": UpdateChatHasScheduledMessagesTypeID, - "updateChatFolders": UpdateChatFoldersTypeID, - "updateChatOnlineMemberCount": UpdateChatOnlineMemberCountTypeID, - "updateSavedMessagesTopic": UpdateSavedMessagesTopicTypeID, - "updateSavedMessagesTopicCount": UpdateSavedMessagesTopicCountTypeID, - "updateQuickReplyShortcut": UpdateQuickReplyShortcutTypeID, - "updateQuickReplyShortcutDeleted": UpdateQuickReplyShortcutDeletedTypeID, - "updateQuickReplyShortcuts": UpdateQuickReplyShortcutsTypeID, - "updateQuickReplyShortcutMessages": UpdateQuickReplyShortcutMessagesTypeID, - "updateForumTopicInfo": UpdateForumTopicInfoTypeID, - "updateScopeNotificationSettings": UpdateScopeNotificationSettingsTypeID, - "updateReactionNotificationSettings": UpdateReactionNotificationSettingsTypeID, - "updateNotification": UpdateNotificationTypeID, - "updateNotificationGroup": UpdateNotificationGroupTypeID, - "updateActiveNotifications": UpdateActiveNotificationsTypeID, - "updateHavePendingNotifications": UpdateHavePendingNotificationsTypeID, - "updateDeleteMessages": UpdateDeleteMessagesTypeID, - "updateChatAction": UpdateChatActionTypeID, - "updateUserStatus": UpdateUserStatusTypeID, - "updateUser": UpdateUserTypeID, - "updateBasicGroup": UpdateBasicGroupTypeID, - "updateSupergroup": UpdateSupergroupTypeID, - "updateSecretChat": UpdateSecretChatTypeID, - "updateUserFullInfo": UpdateUserFullInfoTypeID, - "updateBasicGroupFullInfo": UpdateBasicGroupFullInfoTypeID, - "updateSupergroupFullInfo": UpdateSupergroupFullInfoTypeID, - "updateServiceNotification": UpdateServiceNotificationTypeID, - "updateFile": UpdateFileTypeID, - "updateFileGenerationStart": UpdateFileGenerationStartTypeID, - "updateFileGenerationStop": UpdateFileGenerationStopTypeID, - "updateFileDownloads": UpdateFileDownloadsTypeID, - "updateFileAddedToDownloads": UpdateFileAddedToDownloadsTypeID, - "updateFileDownload": UpdateFileDownloadTypeID, - "updateFileRemovedFromDownloads": UpdateFileRemovedFromDownloadsTypeID, - "updateApplicationVerificationRequired": UpdateApplicationVerificationRequiredTypeID, - "updateCall": UpdateCallTypeID, - "updateGroupCall": UpdateGroupCallTypeID, - "updateGroupCallParticipant": UpdateGroupCallParticipantTypeID, - "updateNewCallSignalingData": UpdateNewCallSignalingDataTypeID, - "updateUserPrivacySettingRules": UpdateUserPrivacySettingRulesTypeID, - "updateUnreadMessageCount": UpdateUnreadMessageCountTypeID, - "updateUnreadChatCount": UpdateUnreadChatCountTypeID, - "updateStory": UpdateStoryTypeID, - "updateStoryDeleted": UpdateStoryDeletedTypeID, - "updateStorySendSucceeded": UpdateStorySendSucceededTypeID, - "updateStorySendFailed": UpdateStorySendFailedTypeID, - "updateChatActiveStories": UpdateChatActiveStoriesTypeID, - "updateStoryListChatCount": UpdateStoryListChatCountTypeID, - "updateStoryStealthMode": UpdateStoryStealthModeTypeID, - "updateOption": UpdateOptionTypeID, - "updateStickerSet": UpdateStickerSetTypeID, - "updateInstalledStickerSets": UpdateInstalledStickerSetsTypeID, - "updateTrendingStickerSets": UpdateTrendingStickerSetsTypeID, - "updateRecentStickers": UpdateRecentStickersTypeID, - "updateFavoriteStickers": UpdateFavoriteStickersTypeID, - "updateSavedAnimations": UpdateSavedAnimationsTypeID, - "updateSavedNotificationSounds": UpdateSavedNotificationSoundsTypeID, - "updateDefaultBackground": UpdateDefaultBackgroundTypeID, - "updateChatThemes": UpdateChatThemesTypeID, - "updateAccentColors": UpdateAccentColorsTypeID, - "updateProfileAccentColors": UpdateProfileAccentColorsTypeID, - "updateLanguagePackStrings": UpdateLanguagePackStringsTypeID, - "updateConnectionState": UpdateConnectionStateTypeID, - "updateTermsOfService": UpdateTermsOfServiceTypeID, - "updateUnconfirmedSession": UpdateUnconfirmedSessionTypeID, - "updateAttachmentMenuBots": UpdateAttachmentMenuBotsTypeID, - "updateWebAppMessageSent": UpdateWebAppMessageSentTypeID, - "updateActiveEmojiReactions": UpdateActiveEmojiReactionsTypeID, - "updateAvailableMessageEffects": UpdateAvailableMessageEffectsTypeID, - "updateDefaultReactionType": UpdateDefaultReactionTypeTypeID, - "updateSavedMessagesTags": UpdateSavedMessagesTagsTypeID, - "updateActiveLiveLocationMessages": UpdateActiveLiveLocationMessagesTypeID, - "updateOwnedStarCount": UpdateOwnedStarCountTypeID, - "updateChatRevenueAmount": UpdateChatRevenueAmountTypeID, - "updateStarRevenueStatus": UpdateStarRevenueStatusTypeID, - "updateSpeechRecognitionTrial": UpdateSpeechRecognitionTrialTypeID, - "updateDiceEmojis": UpdateDiceEmojisTypeID, - "updateAnimatedEmojiMessageClicked": UpdateAnimatedEmojiMessageClickedTypeID, - "updateAnimationSearchParameters": UpdateAnimationSearchParametersTypeID, - "updateSuggestedActions": UpdateSuggestedActionsTypeID, - "updateSpeedLimitNotification": UpdateSpeedLimitNotificationTypeID, - "updateContactCloseBirthdays": UpdateContactCloseBirthdaysTypeID, - "updateAutosaveSettings": UpdateAutosaveSettingsTypeID, - "updateBusinessConnection": UpdateBusinessConnectionTypeID, - "updateNewBusinessMessage": UpdateNewBusinessMessageTypeID, - "updateBusinessMessageEdited": UpdateBusinessMessageEditedTypeID, - "updateBusinessMessagesDeleted": UpdateBusinessMessagesDeletedTypeID, - "updateNewInlineQuery": UpdateNewInlineQueryTypeID, - "updateNewChosenInlineResult": UpdateNewChosenInlineResultTypeID, - "updateNewCallbackQuery": UpdateNewCallbackQueryTypeID, - "updateNewInlineCallbackQuery": UpdateNewInlineCallbackQueryTypeID, - "updateNewBusinessCallbackQuery": UpdateNewBusinessCallbackQueryTypeID, - "updateNewShippingQuery": UpdateNewShippingQueryTypeID, - "updateNewPreCheckoutQuery": UpdateNewPreCheckoutQueryTypeID, - "updateNewCustomEvent": UpdateNewCustomEventTypeID, - "updateNewCustomQuery": UpdateNewCustomQueryTypeID, - "updatePoll": UpdatePollTypeID, - "updatePollAnswer": UpdatePollAnswerTypeID, - "updateChatMember": UpdateChatMemberTypeID, - "updateNewChatJoinRequest": UpdateNewChatJoinRequestTypeID, - "updateChatBoost": UpdateChatBoostTypeID, - "updateMessageReaction": UpdateMessageReactionTypeID, - "updateMessageReactions": UpdateMessageReactionsTypeID, - "updatePaidMediaPurchased": UpdatePaidMediaPurchasedTypeID, - "updates": UpdatesTypeID, - "logStreamDefault": LogStreamDefaultTypeID, - "logStreamFile": LogStreamFileTypeID, - "logStreamEmpty": LogStreamEmptyTypeID, - "logVerbosityLevel": LogVerbosityLevelTypeID, - "logTags": LogTagsTypeID, - "userSupportInfo": UserSupportInfoTypeID, - "testInt": TestIntTypeID, - "testString": TestStringTypeID, - "testBytes": TestBytesTypeID, - "testVectorInt": TestVectorIntTypeID, - "testVectorIntObject": TestVectorIntObjectTypeID, - "testVectorString": TestVectorStringTypeID, - "testVectorStringObject": TestVectorStringObjectTypeID, - "getAuthorizationState": GetAuthorizationStateRequestTypeID, - "setTdlibParameters": SetTdlibParametersRequestTypeID, - "setAuthenticationPhoneNumber": SetAuthenticationPhoneNumberRequestTypeID, - "setAuthenticationEmailAddress": SetAuthenticationEmailAddressRequestTypeID, - "resendAuthenticationCode": ResendAuthenticationCodeRequestTypeID, - "checkAuthenticationEmailCode": CheckAuthenticationEmailCodeRequestTypeID, - "checkAuthenticationCode": CheckAuthenticationCodeRequestTypeID, - "requestQrCodeAuthentication": RequestQrCodeAuthenticationRequestTypeID, - "registerUser": RegisterUserRequestTypeID, - "resetAuthenticationEmailAddress": ResetAuthenticationEmailAddressRequestTypeID, - "checkAuthenticationPassword": CheckAuthenticationPasswordRequestTypeID, - "requestAuthenticationPasswordRecovery": RequestAuthenticationPasswordRecoveryRequestTypeID, - "checkAuthenticationPasswordRecoveryCode": CheckAuthenticationPasswordRecoveryCodeRequestTypeID, - "recoverAuthenticationPassword": RecoverAuthenticationPasswordRequestTypeID, - "sendAuthenticationFirebaseSms": SendAuthenticationFirebaseSMSRequestTypeID, - "reportAuthenticationCodeMissing": ReportAuthenticationCodeMissingRequestTypeID, - "checkAuthenticationBotToken": CheckAuthenticationBotTokenRequestTypeID, - "logOut": LogOutRequestTypeID, - "close": CloseRequestTypeID, - "destroy": DestroyRequestTypeID, - "confirmQrCodeAuthentication": ConfirmQrCodeAuthenticationRequestTypeID, - "getCurrentState": GetCurrentStateRequestTypeID, - "setDatabaseEncryptionKey": SetDatabaseEncryptionKeyRequestTypeID, - "getPasswordState": GetPasswordStateRequestTypeID, - "setPassword": SetPasswordRequestTypeID, - "setLoginEmailAddress": SetLoginEmailAddressRequestTypeID, - "resendLoginEmailAddressCode": ResendLoginEmailAddressCodeRequestTypeID, - "checkLoginEmailAddressCode": CheckLoginEmailAddressCodeRequestTypeID, - "getRecoveryEmailAddress": GetRecoveryEmailAddressRequestTypeID, - "setRecoveryEmailAddress": SetRecoveryEmailAddressRequestTypeID, - "checkRecoveryEmailAddressCode": CheckRecoveryEmailAddressCodeRequestTypeID, - "resendRecoveryEmailAddressCode": ResendRecoveryEmailAddressCodeRequestTypeID, - "cancelRecoveryEmailAddressVerification": CancelRecoveryEmailAddressVerificationRequestTypeID, - "requestPasswordRecovery": RequestPasswordRecoveryRequestTypeID, - "checkPasswordRecoveryCode": CheckPasswordRecoveryCodeRequestTypeID, - "recoverPassword": RecoverPasswordRequestTypeID, - "resetPassword": ResetPasswordRequestTypeID, - "cancelPasswordReset": CancelPasswordResetRequestTypeID, - "createTemporaryPassword": CreateTemporaryPasswordRequestTypeID, - "getTemporaryPasswordState": GetTemporaryPasswordStateRequestTypeID, - "getMe": GetMeRequestTypeID, - "getUser": GetUserRequestTypeID, - "getUserFullInfo": GetUserFullInfoRequestTypeID, - "getBasicGroup": GetBasicGroupRequestTypeID, - "getBasicGroupFullInfo": GetBasicGroupFullInfoRequestTypeID, - "getSupergroup": GetSupergroupRequestTypeID, - "getSupergroupFullInfo": GetSupergroupFullInfoRequestTypeID, - "getSecretChat": GetSecretChatRequestTypeID, - "getChat": GetChatRequestTypeID, - "getMessage": GetMessageRequestTypeID, - "getMessageLocally": GetMessageLocallyRequestTypeID, - "getRepliedMessage": GetRepliedMessageRequestTypeID, - "getChatPinnedMessage": GetChatPinnedMessageRequestTypeID, - "getCallbackQueryMessage": GetCallbackQueryMessageRequestTypeID, - "getMessages": GetMessagesRequestTypeID, - "getMessageProperties": GetMessagePropertiesRequestTypeID, - "getMessageThread": GetMessageThreadRequestTypeID, - "getMessageReadDate": GetMessageReadDateRequestTypeID, - "getMessageViewers": GetMessageViewersRequestTypeID, - "getFile": GetFileRequestTypeID, - "getRemoteFile": GetRemoteFileRequestTypeID, - "loadChats": LoadChatsRequestTypeID, - "getChats": GetChatsRequestTypeID, - "searchPublicChat": SearchPublicChatRequestTypeID, - "searchPublicChats": SearchPublicChatsRequestTypeID, - "searchChats": SearchChatsRequestTypeID, - "searchChatsOnServer": SearchChatsOnServerRequestTypeID, - "getRecommendedChats": GetRecommendedChatsRequestTypeID, - "getChatSimilarChats": GetChatSimilarChatsRequestTypeID, - "getChatSimilarChatCount": GetChatSimilarChatCountRequestTypeID, - "openChatSimilarChat": OpenChatSimilarChatRequestTypeID, - "getTopChats": GetTopChatsRequestTypeID, - "removeTopChat": RemoveTopChatRequestTypeID, - "searchRecentlyFoundChats": SearchRecentlyFoundChatsRequestTypeID, - "addRecentlyFoundChat": AddRecentlyFoundChatRequestTypeID, - "removeRecentlyFoundChat": RemoveRecentlyFoundChatRequestTypeID, - "clearRecentlyFoundChats": ClearRecentlyFoundChatsRequestTypeID, - "getRecentlyOpenedChats": GetRecentlyOpenedChatsRequestTypeID, - "checkChatUsername": CheckChatUsernameRequestTypeID, - "getCreatedPublicChats": GetCreatedPublicChatsRequestTypeID, - "checkCreatedPublicChatsLimit": CheckCreatedPublicChatsLimitRequestTypeID, - "getSuitableDiscussionChats": GetSuitableDiscussionChatsRequestTypeID, - "getInactiveSupergroupChats": GetInactiveSupergroupChatsRequestTypeID, - "getSuitablePersonalChats": GetSuitablePersonalChatsRequestTypeID, - "loadSavedMessagesTopics": LoadSavedMessagesTopicsRequestTypeID, - "getSavedMessagesTopicHistory": GetSavedMessagesTopicHistoryRequestTypeID, - "getSavedMessagesTopicMessageByDate": GetSavedMessagesTopicMessageByDateRequestTypeID, - "deleteSavedMessagesTopicHistory": DeleteSavedMessagesTopicHistoryRequestTypeID, - "deleteSavedMessagesTopicMessagesByDate": DeleteSavedMessagesTopicMessagesByDateRequestTypeID, - "toggleSavedMessagesTopicIsPinned": ToggleSavedMessagesTopicIsPinnedRequestTypeID, - "setPinnedSavedMessagesTopics": SetPinnedSavedMessagesTopicsRequestTypeID, - "getGroupsInCommon": GetGroupsInCommonRequestTypeID, - "getChatHistory": GetChatHistoryRequestTypeID, - "getMessageThreadHistory": GetMessageThreadHistoryRequestTypeID, - "deleteChatHistory": DeleteChatHistoryRequestTypeID, - "deleteChat": DeleteChatRequestTypeID, - "searchChatMessages": SearchChatMessagesRequestTypeID, - "searchMessages": SearchMessagesRequestTypeID, - "searchSecretMessages": SearchSecretMessagesRequestTypeID, - "searchSavedMessages": SearchSavedMessagesRequestTypeID, - "searchCallMessages": SearchCallMessagesRequestTypeID, - "searchOutgoingDocumentMessages": SearchOutgoingDocumentMessagesRequestTypeID, - "searchPublicMessagesByTag": SearchPublicMessagesByTagRequestTypeID, - "searchPublicStoriesByTag": SearchPublicStoriesByTagRequestTypeID, - "searchPublicStoriesByLocation": SearchPublicStoriesByLocationRequestTypeID, - "searchPublicStoriesByVenue": SearchPublicStoriesByVenueRequestTypeID, - "getSearchedForTags": GetSearchedForTagsRequestTypeID, - "removeSearchedForTag": RemoveSearchedForTagRequestTypeID, - "clearSearchedForTags": ClearSearchedForTagsRequestTypeID, - "deleteAllCallMessages": DeleteAllCallMessagesRequestTypeID, - "searchChatRecentLocationMessages": SearchChatRecentLocationMessagesRequestTypeID, - "getChatMessageByDate": GetChatMessageByDateRequestTypeID, - "getChatSparseMessagePositions": GetChatSparseMessagePositionsRequestTypeID, - "getChatMessageCalendar": GetChatMessageCalendarRequestTypeID, - "getChatMessageCount": GetChatMessageCountRequestTypeID, - "getChatMessagePosition": GetChatMessagePositionRequestTypeID, - "getChatScheduledMessages": GetChatScheduledMessagesRequestTypeID, - "getChatSponsoredMessages": GetChatSponsoredMessagesRequestTypeID, - "clickChatSponsoredMessage": ClickChatSponsoredMessageRequestTypeID, - "reportChatSponsoredMessage": ReportChatSponsoredMessageRequestTypeID, - "removeNotification": RemoveNotificationRequestTypeID, - "removeNotificationGroup": RemoveNotificationGroupRequestTypeID, - "getMessageLink": GetMessageLinkRequestTypeID, - "getMessageEmbeddingCode": GetMessageEmbeddingCodeRequestTypeID, - "getMessageLinkInfo": GetMessageLinkInfoRequestTypeID, - "translateText": TranslateTextRequestTypeID, - "translateMessageText": TranslateMessageTextRequestTypeID, - "recognizeSpeech": RecognizeSpeechRequestTypeID, - "rateSpeechRecognition": RateSpeechRecognitionRequestTypeID, - "getChatAvailableMessageSenders": GetChatAvailableMessageSendersRequestTypeID, - "setChatMessageSender": SetChatMessageSenderRequestTypeID, - "sendMessage": SendMessageRequestTypeID, - "sendMessageAlbum": SendMessageAlbumRequestTypeID, - "sendBotStartMessage": SendBotStartMessageRequestTypeID, - "sendInlineQueryResultMessage": SendInlineQueryResultMessageRequestTypeID, - "forwardMessages": ForwardMessagesRequestTypeID, - "sendQuickReplyShortcutMessages": SendQuickReplyShortcutMessagesRequestTypeID, - "resendMessages": ResendMessagesRequestTypeID, - "addLocalMessage": AddLocalMessageRequestTypeID, - "deleteMessages": DeleteMessagesRequestTypeID, - "deleteChatMessagesBySender": DeleteChatMessagesBySenderRequestTypeID, - "deleteChatMessagesByDate": DeleteChatMessagesByDateRequestTypeID, - "editMessageText": EditMessageTextRequestTypeID, - "editMessageLiveLocation": EditMessageLiveLocationRequestTypeID, - "editMessageMedia": EditMessageMediaRequestTypeID, - "editMessageCaption": EditMessageCaptionRequestTypeID, - "editMessageReplyMarkup": EditMessageReplyMarkupRequestTypeID, - "editInlineMessageText": EditInlineMessageTextRequestTypeID, - "editInlineMessageLiveLocation": EditInlineMessageLiveLocationRequestTypeID, - "editInlineMessageMedia": EditInlineMessageMediaRequestTypeID, - "editInlineMessageCaption": EditInlineMessageCaptionRequestTypeID, - "editInlineMessageReplyMarkup": EditInlineMessageReplyMarkupRequestTypeID, - "editMessageSchedulingState": EditMessageSchedulingStateRequestTypeID, - "setMessageFactCheck": SetMessageFactCheckRequestTypeID, - "sendBusinessMessage": SendBusinessMessageRequestTypeID, - "sendBusinessMessageAlbum": SendBusinessMessageAlbumRequestTypeID, - "editBusinessMessageText": EditBusinessMessageTextRequestTypeID, - "editBusinessMessageLiveLocation": EditBusinessMessageLiveLocationRequestTypeID, - "editBusinessMessageMedia": EditBusinessMessageMediaRequestTypeID, - "editBusinessMessageCaption": EditBusinessMessageCaptionRequestTypeID, - "editBusinessMessageReplyMarkup": EditBusinessMessageReplyMarkupRequestTypeID, - "stopBusinessPoll": StopBusinessPollRequestTypeID, - "setBusinessMessageIsPinned": SetBusinessMessageIsPinnedRequestTypeID, - "checkQuickReplyShortcutName": CheckQuickReplyShortcutNameRequestTypeID, - "loadQuickReplyShortcuts": LoadQuickReplyShortcutsRequestTypeID, - "setQuickReplyShortcutName": SetQuickReplyShortcutNameRequestTypeID, - "deleteQuickReplyShortcut": DeleteQuickReplyShortcutRequestTypeID, - "reorderQuickReplyShortcuts": ReorderQuickReplyShortcutsRequestTypeID, - "loadQuickReplyShortcutMessages": LoadQuickReplyShortcutMessagesRequestTypeID, - "deleteQuickReplyShortcutMessages": DeleteQuickReplyShortcutMessagesRequestTypeID, - "addQuickReplyShortcutMessage": AddQuickReplyShortcutMessageRequestTypeID, - "addQuickReplyShortcutInlineQueryResultMessage": AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID, - "addQuickReplyShortcutMessageAlbum": AddQuickReplyShortcutMessageAlbumRequestTypeID, - "readdQuickReplyShortcutMessages": ReaddQuickReplyShortcutMessagesRequestTypeID, - "editQuickReplyMessage": EditQuickReplyMessageRequestTypeID, - "getForumTopicDefaultIcons": GetForumTopicDefaultIconsRequestTypeID, - "createForumTopic": CreateForumTopicRequestTypeID, - "editForumTopic": EditForumTopicRequestTypeID, - "getForumTopic": GetForumTopicRequestTypeID, - "getForumTopicLink": GetForumTopicLinkRequestTypeID, - "getForumTopics": GetForumTopicsRequestTypeID, - "setForumTopicNotificationSettings": SetForumTopicNotificationSettingsRequestTypeID, - "toggleForumTopicIsClosed": ToggleForumTopicIsClosedRequestTypeID, - "toggleGeneralForumTopicIsHidden": ToggleGeneralForumTopicIsHiddenRequestTypeID, - "toggleForumTopicIsPinned": ToggleForumTopicIsPinnedRequestTypeID, - "setPinnedForumTopics": SetPinnedForumTopicsRequestTypeID, - "deleteForumTopic": DeleteForumTopicRequestTypeID, - "getEmojiReaction": GetEmojiReactionRequestTypeID, - "getCustomEmojiReactionAnimations": GetCustomEmojiReactionAnimationsRequestTypeID, - "getMessageAvailableReactions": GetMessageAvailableReactionsRequestTypeID, - "clearRecentReactions": ClearRecentReactionsRequestTypeID, - "addMessageReaction": AddMessageReactionRequestTypeID, - "removeMessageReaction": RemoveMessageReactionRequestTypeID, - "addPendingPaidMessageReaction": AddPendingPaidMessageReactionRequestTypeID, - "commitPendingPaidMessageReactions": CommitPendingPaidMessageReactionsRequestTypeID, - "removePendingPaidMessageReactions": RemovePendingPaidMessageReactionsRequestTypeID, - "togglePaidMessageReactionIsAnonymous": TogglePaidMessageReactionIsAnonymousRequestTypeID, - "setMessageReactions": SetMessageReactionsRequestTypeID, - "getMessageAddedReactions": GetMessageAddedReactionsRequestTypeID, - "setDefaultReactionType": SetDefaultReactionTypeRequestTypeID, - "getSavedMessagesTags": GetSavedMessagesTagsRequestTypeID, - "setSavedMessagesTagLabel": SetSavedMessagesTagLabelRequestTypeID, - "getMessageEffect": GetMessageEffectRequestTypeID, - "searchQuote": SearchQuoteRequestTypeID, - "getTextEntities": GetTextEntitiesRequestTypeID, - "parseTextEntities": ParseTextEntitiesRequestTypeID, - "parseMarkdown": ParseMarkdownRequestTypeID, - "getMarkdownText": GetMarkdownTextRequestTypeID, - "getCountryFlagEmoji": GetCountryFlagEmojiRequestTypeID, - "getFileMimeType": GetFileMimeTypeRequestTypeID, - "getFileExtension": GetFileExtensionRequestTypeID, - "cleanFileName": CleanFileNameRequestTypeID, - "getLanguagePackString": GetLanguagePackStringRequestTypeID, - "getJsonValue": GetJSONValueRequestTypeID, - "getJsonString": GetJSONStringRequestTypeID, - "getThemeParametersJsonString": GetThemeParametersJSONStringRequestTypeID, - "setPollAnswer": SetPollAnswerRequestTypeID, - "getPollVoters": GetPollVotersRequestTypeID, - "stopPoll": StopPollRequestTypeID, - "hideSuggestedAction": HideSuggestedActionRequestTypeID, - "hideContactCloseBirthdays": HideContactCloseBirthdaysRequestTypeID, - "getBusinessConnection": GetBusinessConnectionRequestTypeID, - "getLoginUrlInfo": GetLoginURLInfoRequestTypeID, - "getLoginUrl": GetLoginURLRequestTypeID, - "shareUsersWithBot": ShareUsersWithBotRequestTypeID, - "shareChatWithBot": ShareChatWithBotRequestTypeID, - "getInlineQueryResults": GetInlineQueryResultsRequestTypeID, - "answerInlineQuery": AnswerInlineQueryRequestTypeID, - "savePreparedInlineMessage": SavePreparedInlineMessageRequestTypeID, - "getPreparedInlineMessage": GetPreparedInlineMessageRequestTypeID, - "getGrossingWebAppBots": GetGrossingWebAppBotsRequestTypeID, - "searchWebApp": SearchWebAppRequestTypeID, - "getWebAppPlaceholder": GetWebAppPlaceholderRequestTypeID, - "getWebAppLinkUrl": GetWebAppLinkURLRequestTypeID, - "getMainWebApp": GetMainWebAppRequestTypeID, - "getWebAppUrl": GetWebAppURLRequestTypeID, - "sendWebAppData": SendWebAppDataRequestTypeID, - "openWebApp": OpenWebAppRequestTypeID, - "closeWebApp": CloseWebAppRequestTypeID, - "answerWebAppQuery": AnswerWebAppQueryRequestTypeID, - "checkWebAppFileDownload": CheckWebAppFileDownloadRequestTypeID, - "getCallbackQueryAnswer": GetCallbackQueryAnswerRequestTypeID, - "answerCallbackQuery": AnswerCallbackQueryRequestTypeID, - "answerShippingQuery": AnswerShippingQueryRequestTypeID, - "answerPreCheckoutQuery": AnswerPreCheckoutQueryRequestTypeID, - "setGameScore": SetGameScoreRequestTypeID, - "setInlineGameScore": SetInlineGameScoreRequestTypeID, - "getGameHighScores": GetGameHighScoresRequestTypeID, - "getInlineGameHighScores": GetInlineGameHighScoresRequestTypeID, - "deleteChatReplyMarkup": DeleteChatReplyMarkupRequestTypeID, - "sendChatAction": SendChatActionRequestTypeID, - "openChat": OpenChatRequestTypeID, - "closeChat": CloseChatRequestTypeID, - "viewMessages": ViewMessagesRequestTypeID, - "openMessageContent": OpenMessageContentRequestTypeID, - "clickAnimatedEmojiMessage": ClickAnimatedEmojiMessageRequestTypeID, - "getInternalLink": GetInternalLinkRequestTypeID, - "getInternalLinkType": GetInternalLinkTypeRequestTypeID, - "getExternalLinkInfo": GetExternalLinkInfoRequestTypeID, - "getExternalLink": GetExternalLinkRequestTypeID, - "readAllChatMentions": ReadAllChatMentionsRequestTypeID, - "readAllMessageThreadMentions": ReadAllMessageThreadMentionsRequestTypeID, - "readAllChatReactions": ReadAllChatReactionsRequestTypeID, - "readAllMessageThreadReactions": ReadAllMessageThreadReactionsRequestTypeID, - "createPrivateChat": CreatePrivateChatRequestTypeID, - "createBasicGroupChat": CreateBasicGroupChatRequestTypeID, - "createSupergroupChat": CreateSupergroupChatRequestTypeID, - "createSecretChat": CreateSecretChatRequestTypeID, - "createNewBasicGroupChat": CreateNewBasicGroupChatRequestTypeID, - "createNewSupergroupChat": CreateNewSupergroupChatRequestTypeID, - "createNewSecretChat": CreateNewSecretChatRequestTypeID, - "upgradeBasicGroupChatToSupergroupChat": UpgradeBasicGroupChatToSupergroupChatRequestTypeID, - "getChatListsToAddChat": GetChatListsToAddChatRequestTypeID, - "addChatToList": AddChatToListRequestTypeID, - "getChatFolder": GetChatFolderRequestTypeID, - "createChatFolder": CreateChatFolderRequestTypeID, - "editChatFolder": EditChatFolderRequestTypeID, - "deleteChatFolder": DeleteChatFolderRequestTypeID, - "getChatFolderChatsToLeave": GetChatFolderChatsToLeaveRequestTypeID, - "getChatFolderChatCount": GetChatFolderChatCountRequestTypeID, - "reorderChatFolders": ReorderChatFoldersRequestTypeID, - "toggleChatFolderTags": ToggleChatFolderTagsRequestTypeID, - "getRecommendedChatFolders": GetRecommendedChatFoldersRequestTypeID, - "getChatFolderDefaultIconName": GetChatFolderDefaultIconNameRequestTypeID, - "getChatsForChatFolderInviteLink": GetChatsForChatFolderInviteLinkRequestTypeID, - "createChatFolderInviteLink": CreateChatFolderInviteLinkRequestTypeID, - "getChatFolderInviteLinks": GetChatFolderInviteLinksRequestTypeID, - "editChatFolderInviteLink": EditChatFolderInviteLinkRequestTypeID, - "deleteChatFolderInviteLink": DeleteChatFolderInviteLinkRequestTypeID, - "checkChatFolderInviteLink": CheckChatFolderInviteLinkRequestTypeID, - "addChatFolderByInviteLink": AddChatFolderByInviteLinkRequestTypeID, - "getChatFolderNewChats": GetChatFolderNewChatsRequestTypeID, - "processChatFolderNewChats": ProcessChatFolderNewChatsRequestTypeID, - "getArchiveChatListSettings": GetArchiveChatListSettingsRequestTypeID, - "setArchiveChatListSettings": SetArchiveChatListSettingsRequestTypeID, - "setChatTitle": SetChatTitleRequestTypeID, - "setChatPhoto": SetChatPhotoRequestTypeID, - "setChatAccentColor": SetChatAccentColorRequestTypeID, - "setChatProfileAccentColor": SetChatProfileAccentColorRequestTypeID, - "setChatMessageAutoDeleteTime": SetChatMessageAutoDeleteTimeRequestTypeID, - "setChatEmojiStatus": SetChatEmojiStatusRequestTypeID, - "setChatPermissions": SetChatPermissionsRequestTypeID, - "setChatBackground": SetChatBackgroundRequestTypeID, - "deleteChatBackground": DeleteChatBackgroundRequestTypeID, - "setChatTheme": SetChatThemeRequestTypeID, - "setChatDraftMessage": SetChatDraftMessageRequestTypeID, - "setChatNotificationSettings": SetChatNotificationSettingsRequestTypeID, - "toggleChatHasProtectedContent": ToggleChatHasProtectedContentRequestTypeID, - "toggleChatViewAsTopics": ToggleChatViewAsTopicsRequestTypeID, - "toggleChatIsTranslatable": ToggleChatIsTranslatableRequestTypeID, - "toggleChatIsMarkedAsUnread": ToggleChatIsMarkedAsUnreadRequestTypeID, - "toggleChatDefaultDisableNotification": ToggleChatDefaultDisableNotificationRequestTypeID, - "setChatAvailableReactions": SetChatAvailableReactionsRequestTypeID, - "setChatClientData": SetChatClientDataRequestTypeID, - "setChatDescription": SetChatDescriptionRequestTypeID, - "setChatDiscussionGroup": SetChatDiscussionGroupRequestTypeID, - "setChatLocation": SetChatLocationRequestTypeID, - "setChatSlowModeDelay": SetChatSlowModeDelayRequestTypeID, - "pinChatMessage": PinChatMessageRequestTypeID, - "unpinChatMessage": UnpinChatMessageRequestTypeID, - "unpinAllChatMessages": UnpinAllChatMessagesRequestTypeID, - "unpinAllMessageThreadMessages": UnpinAllMessageThreadMessagesRequestTypeID, - "joinChat": JoinChatRequestTypeID, - "leaveChat": LeaveChatRequestTypeID, - "addChatMember": AddChatMemberRequestTypeID, - "addChatMembers": AddChatMembersRequestTypeID, - "setChatMemberStatus": SetChatMemberStatusRequestTypeID, - "banChatMember": BanChatMemberRequestTypeID, - "canTransferOwnership": CanTransferOwnershipRequestTypeID, - "transferChatOwnership": TransferChatOwnershipRequestTypeID, - "getChatMember": GetChatMemberRequestTypeID, - "searchChatMembers": SearchChatMembersRequestTypeID, - "getChatAdministrators": GetChatAdministratorsRequestTypeID, - "clearAllDraftMessages": ClearAllDraftMessagesRequestTypeID, - "getSavedNotificationSound": GetSavedNotificationSoundRequestTypeID, - "getSavedNotificationSounds": GetSavedNotificationSoundsRequestTypeID, - "addSavedNotificationSound": AddSavedNotificationSoundRequestTypeID, - "removeSavedNotificationSound": RemoveSavedNotificationSoundRequestTypeID, - "getChatNotificationSettingsExceptions": GetChatNotificationSettingsExceptionsRequestTypeID, - "getScopeNotificationSettings": GetScopeNotificationSettingsRequestTypeID, - "setScopeNotificationSettings": SetScopeNotificationSettingsRequestTypeID, - "setReactionNotificationSettings": SetReactionNotificationSettingsRequestTypeID, - "resetAllNotificationSettings": ResetAllNotificationSettingsRequestTypeID, - "toggleChatIsPinned": ToggleChatIsPinnedRequestTypeID, - "setPinnedChats": SetPinnedChatsRequestTypeID, - "readChatList": ReadChatListRequestTypeID, - "getCurrentWeather": GetCurrentWeatherRequestTypeID, - "getStory": GetStoryRequestTypeID, - "getChatsToSendStories": GetChatsToSendStoriesRequestTypeID, - "canSendStory": CanSendStoryRequestTypeID, - "sendStory": SendStoryRequestTypeID, - "editStory": EditStoryRequestTypeID, - "editStoryCover": EditStoryCoverRequestTypeID, - "setStoryPrivacySettings": SetStoryPrivacySettingsRequestTypeID, - "toggleStoryIsPostedToChatPage": ToggleStoryIsPostedToChatPageRequestTypeID, - "deleteStory": DeleteStoryRequestTypeID, - "getStoryNotificationSettingsExceptions": GetStoryNotificationSettingsExceptionsRequestTypeID, - "loadActiveStories": LoadActiveStoriesRequestTypeID, - "setChatActiveStoriesList": SetChatActiveStoriesListRequestTypeID, - "getChatActiveStories": GetChatActiveStoriesRequestTypeID, - "getChatPostedToChatPageStories": GetChatPostedToChatPageStoriesRequestTypeID, - "getChatArchivedStories": GetChatArchivedStoriesRequestTypeID, - "setChatPinnedStories": SetChatPinnedStoriesRequestTypeID, - "openStory": OpenStoryRequestTypeID, - "closeStory": CloseStoryRequestTypeID, - "getStoryAvailableReactions": GetStoryAvailableReactionsRequestTypeID, - "setStoryReaction": SetStoryReactionRequestTypeID, - "getStoryInteractions": GetStoryInteractionsRequestTypeID, - "getChatStoryInteractions": GetChatStoryInteractionsRequestTypeID, - "reportStory": ReportStoryRequestTypeID, - "activateStoryStealthMode": ActivateStoryStealthModeRequestTypeID, - "getStoryPublicForwards": GetStoryPublicForwardsRequestTypeID, - "getChatBoostLevelFeatures": GetChatBoostLevelFeaturesRequestTypeID, - "getChatBoostFeatures": GetChatBoostFeaturesRequestTypeID, - "getAvailableChatBoostSlots": GetAvailableChatBoostSlotsRequestTypeID, - "getChatBoostStatus": GetChatBoostStatusRequestTypeID, - "boostChat": BoostChatRequestTypeID, - "getChatBoostLink": GetChatBoostLinkRequestTypeID, - "getChatBoostLinkInfo": GetChatBoostLinkInfoRequestTypeID, - "getChatBoosts": GetChatBoostsRequestTypeID, - "getUserChatBoosts": GetUserChatBoostsRequestTypeID, - "getAttachmentMenuBot": GetAttachmentMenuBotRequestTypeID, - "toggleBotIsAddedToAttachmentMenu": ToggleBotIsAddedToAttachmentMenuRequestTypeID, - "getThemedEmojiStatuses": GetThemedEmojiStatusesRequestTypeID, - "getRecentEmojiStatuses": GetRecentEmojiStatusesRequestTypeID, - "getDefaultEmojiStatuses": GetDefaultEmojiStatusesRequestTypeID, - "clearRecentEmojiStatuses": ClearRecentEmojiStatusesRequestTypeID, - "getThemedChatEmojiStatuses": GetThemedChatEmojiStatusesRequestTypeID, - "getDefaultChatEmojiStatuses": GetDefaultChatEmojiStatusesRequestTypeID, - "getDisallowedChatEmojiStatuses": GetDisallowedChatEmojiStatusesRequestTypeID, - "downloadFile": DownloadFileRequestTypeID, - "getFileDownloadedPrefixSize": GetFileDownloadedPrefixSizeRequestTypeID, - "cancelDownloadFile": CancelDownloadFileRequestTypeID, - "getSuggestedFileName": GetSuggestedFileNameRequestTypeID, - "preliminaryUploadFile": PreliminaryUploadFileRequestTypeID, - "cancelPreliminaryUploadFile": CancelPreliminaryUploadFileRequestTypeID, - "writeGeneratedFilePart": WriteGeneratedFilePartRequestTypeID, - "setFileGenerationProgress": SetFileGenerationProgressRequestTypeID, - "finishFileGeneration": FinishFileGenerationRequestTypeID, - "readFilePart": ReadFilePartRequestTypeID, - "deleteFile": DeleteFileRequestTypeID, - "addFileToDownloads": AddFileToDownloadsRequestTypeID, - "toggleDownloadIsPaused": ToggleDownloadIsPausedRequestTypeID, - "toggleAllDownloadsArePaused": ToggleAllDownloadsArePausedRequestTypeID, - "removeFileFromDownloads": RemoveFileFromDownloadsRequestTypeID, - "removeAllFilesFromDownloads": RemoveAllFilesFromDownloadsRequestTypeID, - "searchFileDownloads": SearchFileDownloadsRequestTypeID, - "setApplicationVerificationToken": SetApplicationVerificationTokenRequestTypeID, - "getMessageFileType": GetMessageFileTypeRequestTypeID, - "getMessageImportConfirmationText": GetMessageImportConfirmationTextRequestTypeID, - "importMessages": ImportMessagesRequestTypeID, - "replacePrimaryChatInviteLink": ReplacePrimaryChatInviteLinkRequestTypeID, - "createChatInviteLink": CreateChatInviteLinkRequestTypeID, - "createChatSubscriptionInviteLink": CreateChatSubscriptionInviteLinkRequestTypeID, - "editChatInviteLink": EditChatInviteLinkRequestTypeID, - "editChatSubscriptionInviteLink": EditChatSubscriptionInviteLinkRequestTypeID, - "getChatInviteLink": GetChatInviteLinkRequestTypeID, - "getChatInviteLinkCounts": GetChatInviteLinkCountsRequestTypeID, - "getChatInviteLinks": GetChatInviteLinksRequestTypeID, - "getChatInviteLinkMembers": GetChatInviteLinkMembersRequestTypeID, - "revokeChatInviteLink": RevokeChatInviteLinkRequestTypeID, - "deleteRevokedChatInviteLink": DeleteRevokedChatInviteLinkRequestTypeID, - "deleteAllRevokedChatInviteLinks": DeleteAllRevokedChatInviteLinksRequestTypeID, - "checkChatInviteLink": CheckChatInviteLinkRequestTypeID, - "joinChatByInviteLink": JoinChatByInviteLinkRequestTypeID, - "getChatJoinRequests": GetChatJoinRequestsRequestTypeID, - "processChatJoinRequest": ProcessChatJoinRequestRequestTypeID, - "processChatJoinRequests": ProcessChatJoinRequestsRequestTypeID, - "createCall": CreateCallRequestTypeID, - "acceptCall": AcceptCallRequestTypeID, - "sendCallSignalingData": SendCallSignalingDataRequestTypeID, - "discardCall": DiscardCallRequestTypeID, - "sendCallRating": SendCallRatingRequestTypeID, - "sendCallDebugInformation": SendCallDebugInformationRequestTypeID, - "sendCallLog": SendCallLogRequestTypeID, - "getVideoChatAvailableParticipants": GetVideoChatAvailableParticipantsRequestTypeID, - "setVideoChatDefaultParticipant": SetVideoChatDefaultParticipantRequestTypeID, - "createVideoChat": CreateVideoChatRequestTypeID, - "createGroupCall": CreateGroupCallRequestTypeID, - "getVideoChatRtmpUrl": GetVideoChatRtmpURLRequestTypeID, - "replaceVideoChatRtmpUrl": ReplaceVideoChatRtmpURLRequestTypeID, - "getGroupCall": GetGroupCallRequestTypeID, - "startScheduledGroupCall": StartScheduledGroupCallRequestTypeID, - "toggleGroupCallEnabledStartNotification": ToggleGroupCallEnabledStartNotificationRequestTypeID, - "joinGroupCall": JoinGroupCallRequestTypeID, - "startGroupCallScreenSharing": StartGroupCallScreenSharingRequestTypeID, - "toggleGroupCallScreenSharingIsPaused": ToggleGroupCallScreenSharingIsPausedRequestTypeID, - "endGroupCallScreenSharing": EndGroupCallScreenSharingRequestTypeID, - "setGroupCallTitle": SetGroupCallTitleRequestTypeID, - "toggleGroupCallMuteNewParticipants": ToggleGroupCallMuteNewParticipantsRequestTypeID, - "inviteGroupCallParticipants": InviteGroupCallParticipantsRequestTypeID, - "getGroupCallInviteLink": GetGroupCallInviteLinkRequestTypeID, - "revokeGroupCallInviteLink": RevokeGroupCallInviteLinkRequestTypeID, - "startGroupCallRecording": StartGroupCallRecordingRequestTypeID, - "endGroupCallRecording": EndGroupCallRecordingRequestTypeID, - "toggleGroupCallIsMyVideoPaused": ToggleGroupCallIsMyVideoPausedRequestTypeID, - "toggleGroupCallIsMyVideoEnabled": ToggleGroupCallIsMyVideoEnabledRequestTypeID, - "setGroupCallParticipantIsSpeaking": SetGroupCallParticipantIsSpeakingRequestTypeID, - "toggleGroupCallParticipantIsMuted": ToggleGroupCallParticipantIsMutedRequestTypeID, - "setGroupCallParticipantVolumeLevel": SetGroupCallParticipantVolumeLevelRequestTypeID, - "toggleGroupCallParticipantIsHandRaised": ToggleGroupCallParticipantIsHandRaisedRequestTypeID, - "loadGroupCallParticipants": LoadGroupCallParticipantsRequestTypeID, - "leaveGroupCall": LeaveGroupCallRequestTypeID, - "endGroupCall": EndGroupCallRequestTypeID, - "getGroupCallStreams": GetGroupCallStreamsRequestTypeID, - "getGroupCallStreamSegment": GetGroupCallStreamSegmentRequestTypeID, - "setMessageSenderBlockList": SetMessageSenderBlockListRequestTypeID, - "blockMessageSenderFromReplies": BlockMessageSenderFromRepliesRequestTypeID, - "getBlockedMessageSenders": GetBlockedMessageSendersRequestTypeID, - "addContact": AddContactRequestTypeID, - "importContacts": ImportContactsRequestTypeID, - "getContacts": GetContactsRequestTypeID, - "searchContacts": SearchContactsRequestTypeID, - "removeContacts": RemoveContactsRequestTypeID, - "getImportedContactCount": GetImportedContactCountRequestTypeID, - "changeImportedContacts": ChangeImportedContactsRequestTypeID, - "clearImportedContacts": ClearImportedContactsRequestTypeID, - "setCloseFriends": SetCloseFriendsRequestTypeID, - "getCloseFriends": GetCloseFriendsRequestTypeID, - "setUserPersonalProfilePhoto": SetUserPersonalProfilePhotoRequestTypeID, - "suggestUserProfilePhoto": SuggestUserProfilePhotoRequestTypeID, - "toggleBotCanManageEmojiStatus": ToggleBotCanManageEmojiStatusRequestTypeID, - "setUserEmojiStatus": SetUserEmojiStatusRequestTypeID, - "searchUserByPhoneNumber": SearchUserByPhoneNumberRequestTypeID, - "sharePhoneNumber": SharePhoneNumberRequestTypeID, - "getUserProfilePhotos": GetUserProfilePhotosRequestTypeID, - "getStickerOutline": GetStickerOutlineRequestTypeID, - "getStickers": GetStickersRequestTypeID, - "getAllStickerEmojis": GetAllStickerEmojisRequestTypeID, - "searchStickers": SearchStickersRequestTypeID, - "getGreetingStickers": GetGreetingStickersRequestTypeID, - "getPremiumStickers": GetPremiumStickersRequestTypeID, - "getInstalledStickerSets": GetInstalledStickerSetsRequestTypeID, - "getArchivedStickerSets": GetArchivedStickerSetsRequestTypeID, - "getTrendingStickerSets": GetTrendingStickerSetsRequestTypeID, - "getAttachedStickerSets": GetAttachedStickerSetsRequestTypeID, - "getStickerSet": GetStickerSetRequestTypeID, - "getStickerSetName": GetStickerSetNameRequestTypeID, - "searchStickerSet": SearchStickerSetRequestTypeID, - "searchInstalledStickerSets": SearchInstalledStickerSetsRequestTypeID, - "searchStickerSets": SearchStickerSetsRequestTypeID, - "changeStickerSet": ChangeStickerSetRequestTypeID, - "viewTrendingStickerSets": ViewTrendingStickerSetsRequestTypeID, - "reorderInstalledStickerSets": ReorderInstalledStickerSetsRequestTypeID, - "getRecentStickers": GetRecentStickersRequestTypeID, - "addRecentSticker": AddRecentStickerRequestTypeID, - "removeRecentSticker": RemoveRecentStickerRequestTypeID, - "clearRecentStickers": ClearRecentStickersRequestTypeID, - "getFavoriteStickers": GetFavoriteStickersRequestTypeID, - "addFavoriteSticker": AddFavoriteStickerRequestTypeID, - "removeFavoriteSticker": RemoveFavoriteStickerRequestTypeID, - "getStickerEmojis": GetStickerEmojisRequestTypeID, - "searchEmojis": SearchEmojisRequestTypeID, - "getKeywordEmojis": GetKeywordEmojisRequestTypeID, - "getEmojiCategories": GetEmojiCategoriesRequestTypeID, - "getAnimatedEmoji": GetAnimatedEmojiRequestTypeID, - "getEmojiSuggestionsUrl": GetEmojiSuggestionsURLRequestTypeID, - "getCustomEmojiStickers": GetCustomEmojiStickersRequestTypeID, - "getDefaultChatPhotoCustomEmojiStickers": GetDefaultChatPhotoCustomEmojiStickersRequestTypeID, - "getDefaultProfilePhotoCustomEmojiStickers": GetDefaultProfilePhotoCustomEmojiStickersRequestTypeID, - "getDefaultBackgroundCustomEmojiStickers": GetDefaultBackgroundCustomEmojiStickersRequestTypeID, - "getSavedAnimations": GetSavedAnimationsRequestTypeID, - "addSavedAnimation": AddSavedAnimationRequestTypeID, - "removeSavedAnimation": RemoveSavedAnimationRequestTypeID, - "getRecentInlineBots": GetRecentInlineBotsRequestTypeID, - "getOwnedBots": GetOwnedBotsRequestTypeID, - "searchHashtags": SearchHashtagsRequestTypeID, - "removeRecentHashtag": RemoveRecentHashtagRequestTypeID, - "getLinkPreview": GetLinkPreviewRequestTypeID, - "getWebPageInstantView": GetWebPageInstantViewRequestTypeID, - "setProfilePhoto": SetProfilePhotoRequestTypeID, - "deleteProfilePhoto": DeleteProfilePhotoRequestTypeID, - "setAccentColor": SetAccentColorRequestTypeID, - "setProfileAccentColor": SetProfileAccentColorRequestTypeID, - "setName": SetNameRequestTypeID, - "setBio": SetBioRequestTypeID, - "setUsername": SetUsernameRequestTypeID, - "toggleUsernameIsActive": ToggleUsernameIsActiveRequestTypeID, - "reorderActiveUsernames": ReorderActiveUsernamesRequestTypeID, - "setBirthdate": SetBirthdateRequestTypeID, - "setPersonalChat": SetPersonalChatRequestTypeID, - "setEmojiStatus": SetEmojiStatusRequestTypeID, - "toggleHasSponsoredMessagesEnabled": ToggleHasSponsoredMessagesEnabledRequestTypeID, - "setBusinessLocation": SetBusinessLocationRequestTypeID, - "setBusinessOpeningHours": SetBusinessOpeningHoursRequestTypeID, - "setBusinessGreetingMessageSettings": SetBusinessGreetingMessageSettingsRequestTypeID, - "setBusinessAwayMessageSettings": SetBusinessAwayMessageSettingsRequestTypeID, - "setBusinessStartPage": SetBusinessStartPageRequestTypeID, - "sendPhoneNumberCode": SendPhoneNumberCodeRequestTypeID, - "sendPhoneNumberFirebaseSms": SendPhoneNumberFirebaseSMSRequestTypeID, - "reportPhoneNumberCodeMissing": ReportPhoneNumberCodeMissingRequestTypeID, - "resendPhoneNumberCode": ResendPhoneNumberCodeRequestTypeID, - "checkPhoneNumberCode": CheckPhoneNumberCodeRequestTypeID, - "getBusinessConnectedBot": GetBusinessConnectedBotRequestTypeID, - "setBusinessConnectedBot": SetBusinessConnectedBotRequestTypeID, - "deleteBusinessConnectedBot": DeleteBusinessConnectedBotRequestTypeID, - "toggleBusinessConnectedBotChatIsPaused": ToggleBusinessConnectedBotChatIsPausedRequestTypeID, - "removeBusinessConnectedBotFromChat": RemoveBusinessConnectedBotFromChatRequestTypeID, - "getBusinessChatLinks": GetBusinessChatLinksRequestTypeID, - "createBusinessChatLink": CreateBusinessChatLinkRequestTypeID, - "editBusinessChatLink": EditBusinessChatLinkRequestTypeID, - "deleteBusinessChatLink": DeleteBusinessChatLinkRequestTypeID, - "getBusinessChatLinkInfo": GetBusinessChatLinkInfoRequestTypeID, - "getUserLink": GetUserLinkRequestTypeID, - "searchUserByToken": SearchUserByTokenRequestTypeID, - "setCommands": SetCommandsRequestTypeID, - "deleteCommands": DeleteCommandsRequestTypeID, - "getCommands": GetCommandsRequestTypeID, - "setMenuButton": SetMenuButtonRequestTypeID, - "getMenuButton": GetMenuButtonRequestTypeID, - "setDefaultGroupAdministratorRights": SetDefaultGroupAdministratorRightsRequestTypeID, - "setDefaultChannelAdministratorRights": SetDefaultChannelAdministratorRightsRequestTypeID, - "canBotSendMessages": CanBotSendMessagesRequestTypeID, - "allowBotToSendMessages": AllowBotToSendMessagesRequestTypeID, - "sendWebAppCustomRequest": SendWebAppCustomRequestRequestTypeID, - "getBotMediaPreviews": GetBotMediaPreviewsRequestTypeID, - "getBotMediaPreviewInfo": GetBotMediaPreviewInfoRequestTypeID, - "addBotMediaPreview": AddBotMediaPreviewRequestTypeID, - "editBotMediaPreview": EditBotMediaPreviewRequestTypeID, - "reorderBotMediaPreviews": ReorderBotMediaPreviewsRequestTypeID, - "deleteBotMediaPreviews": DeleteBotMediaPreviewsRequestTypeID, - "setBotName": SetBotNameRequestTypeID, - "getBotName": GetBotNameRequestTypeID, - "setBotProfilePhoto": SetBotProfilePhotoRequestTypeID, - "toggleBotUsernameIsActive": ToggleBotUsernameIsActiveRequestTypeID, - "reorderBotActiveUsernames": ReorderBotActiveUsernamesRequestTypeID, - "setBotInfoDescription": SetBotInfoDescriptionRequestTypeID, - "getBotInfoDescription": GetBotInfoDescriptionRequestTypeID, - "setBotInfoShortDescription": SetBotInfoShortDescriptionRequestTypeID, - "getBotInfoShortDescription": GetBotInfoShortDescriptionRequestTypeID, - "setMessageSenderBotVerification": SetMessageSenderBotVerificationRequestTypeID, - "removeMessageSenderBotVerification": RemoveMessageSenderBotVerificationRequestTypeID, - "getActiveSessions": GetActiveSessionsRequestTypeID, - "terminateSession": TerminateSessionRequestTypeID, - "terminateAllOtherSessions": TerminateAllOtherSessionsRequestTypeID, - "confirmSession": ConfirmSessionRequestTypeID, - "toggleSessionCanAcceptCalls": ToggleSessionCanAcceptCallsRequestTypeID, - "toggleSessionCanAcceptSecretChats": ToggleSessionCanAcceptSecretChatsRequestTypeID, - "setInactiveSessionTtl": SetInactiveSessionTTLRequestTypeID, - "getConnectedWebsites": GetConnectedWebsitesRequestTypeID, - "disconnectWebsite": DisconnectWebsiteRequestTypeID, - "disconnectAllWebsites": DisconnectAllWebsitesRequestTypeID, - "setSupergroupUsername": SetSupergroupUsernameRequestTypeID, - "toggleSupergroupUsernameIsActive": ToggleSupergroupUsernameIsActiveRequestTypeID, - "disableAllSupergroupUsernames": DisableAllSupergroupUsernamesRequestTypeID, - "reorderSupergroupActiveUsernames": ReorderSupergroupActiveUsernamesRequestTypeID, - "setSupergroupStickerSet": SetSupergroupStickerSetRequestTypeID, - "setSupergroupCustomEmojiStickerSet": SetSupergroupCustomEmojiStickerSetRequestTypeID, - "setSupergroupUnrestrictBoostCount": SetSupergroupUnrestrictBoostCountRequestTypeID, - "toggleSupergroupSignMessages": ToggleSupergroupSignMessagesRequestTypeID, - "toggleSupergroupJoinToSendMessages": ToggleSupergroupJoinToSendMessagesRequestTypeID, - "toggleSupergroupJoinByRequest": ToggleSupergroupJoinByRequestRequestTypeID, - "toggleSupergroupIsAllHistoryAvailable": ToggleSupergroupIsAllHistoryAvailableRequestTypeID, - "toggleSupergroupCanHaveSponsoredMessages": ToggleSupergroupCanHaveSponsoredMessagesRequestTypeID, - "toggleSupergroupHasHiddenMembers": ToggleSupergroupHasHiddenMembersRequestTypeID, - "toggleSupergroupHasAggressiveAntiSpamEnabled": ToggleSupergroupHasAggressiveAntiSpamEnabledRequestTypeID, - "toggleSupergroupIsForum": ToggleSupergroupIsForumRequestTypeID, - "toggleSupergroupIsBroadcastGroup": ToggleSupergroupIsBroadcastGroupRequestTypeID, - "reportSupergroupSpam": ReportSupergroupSpamRequestTypeID, - "reportSupergroupAntiSpamFalsePositive": ReportSupergroupAntiSpamFalsePositiveRequestTypeID, - "getSupergroupMembers": GetSupergroupMembersRequestTypeID, - "closeSecretChat": CloseSecretChatRequestTypeID, - "getChatEventLog": GetChatEventLogRequestTypeID, - "getTimeZones": GetTimeZonesRequestTypeID, - "getPaymentForm": GetPaymentFormRequestTypeID, - "validateOrderInfo": ValidateOrderInfoRequestTypeID, - "sendPaymentForm": SendPaymentFormRequestTypeID, - "getPaymentReceipt": GetPaymentReceiptRequestTypeID, - "getSavedOrderInfo": GetSavedOrderInfoRequestTypeID, - "deleteSavedOrderInfo": DeleteSavedOrderInfoRequestTypeID, - "deleteSavedCredentials": DeleteSavedCredentialsRequestTypeID, - "getAvailableGifts": GetAvailableGiftsRequestTypeID, - "sendGift": SendGiftRequestTypeID, - "sellGift": SellGiftRequestTypeID, - "toggleGiftIsSaved": ToggleGiftIsSavedRequestTypeID, - "getGiftUpgradePreview": GetGiftUpgradePreviewRequestTypeID, - "upgradeGift": UpgradeGiftRequestTypeID, - "transferGift": TransferGiftRequestTypeID, - "getUserGifts": GetUserGiftsRequestTypeID, - "getUserGift": GetUserGiftRequestTypeID, - "createInvoiceLink": CreateInvoiceLinkRequestTypeID, - "refundStarPayment": RefundStarPaymentRequestTypeID, - "getSupportUser": GetSupportUserRequestTypeID, - "getBackgroundUrl": GetBackgroundURLRequestTypeID, - "searchBackground": SearchBackgroundRequestTypeID, - "setDefaultBackground": SetDefaultBackgroundRequestTypeID, - "deleteDefaultBackground": DeleteDefaultBackgroundRequestTypeID, - "getInstalledBackgrounds": GetInstalledBackgroundsRequestTypeID, - "removeInstalledBackground": RemoveInstalledBackgroundRequestTypeID, - "resetInstalledBackgrounds": ResetInstalledBackgroundsRequestTypeID, - "getLocalizationTargetInfo": GetLocalizationTargetInfoRequestTypeID, - "getLanguagePackInfo": GetLanguagePackInfoRequestTypeID, - "getLanguagePackStrings": GetLanguagePackStringsRequestTypeID, - "synchronizeLanguagePack": SynchronizeLanguagePackRequestTypeID, - "addCustomServerLanguagePack": AddCustomServerLanguagePackRequestTypeID, - "setCustomLanguagePack": SetCustomLanguagePackRequestTypeID, - "editCustomLanguagePackInfo": EditCustomLanguagePackInfoRequestTypeID, - "setCustomLanguagePackString": SetCustomLanguagePackStringRequestTypeID, - "deleteLanguagePack": DeleteLanguagePackRequestTypeID, - "registerDevice": RegisterDeviceRequestTypeID, - "processPushNotification": ProcessPushNotificationRequestTypeID, - "getPushReceiverId": GetPushReceiverIDRequestTypeID, - "getRecentlyVisitedTMeUrls": GetRecentlyVisitedTMeURLsRequestTypeID, - "setUserPrivacySettingRules": SetUserPrivacySettingRulesRequestTypeID, - "getUserPrivacySettingRules": GetUserPrivacySettingRulesRequestTypeID, - "setReadDatePrivacySettings": SetReadDatePrivacySettingsRequestTypeID, - "getReadDatePrivacySettings": GetReadDatePrivacySettingsRequestTypeID, - "setNewChatPrivacySettings": SetNewChatPrivacySettingsRequestTypeID, - "getNewChatPrivacySettings": GetNewChatPrivacySettingsRequestTypeID, - "canSendMessageToUser": CanSendMessageToUserRequestTypeID, - "getOption": GetOptionRequestTypeID, - "setOption": SetOptionRequestTypeID, - "setAccountTtl": SetAccountTTLRequestTypeID, - "getAccountTtl": GetAccountTTLRequestTypeID, - "deleteAccount": DeleteAccountRequestTypeID, - "setDefaultMessageAutoDeleteTime": SetDefaultMessageAutoDeleteTimeRequestTypeID, - "getDefaultMessageAutoDeleteTime": GetDefaultMessageAutoDeleteTimeRequestTypeID, - "removeChatActionBar": RemoveChatActionBarRequestTypeID, - "reportChat": ReportChatRequestTypeID, - "reportChatPhoto": ReportChatPhotoRequestTypeID, - "reportMessageReactions": ReportMessageReactionsRequestTypeID, - "getChatRevenueStatistics": GetChatRevenueStatisticsRequestTypeID, - "getChatRevenueWithdrawalUrl": GetChatRevenueWithdrawalURLRequestTypeID, - "getChatRevenueTransactions": GetChatRevenueTransactionsRequestTypeID, - "getStarRevenueStatistics": GetStarRevenueStatisticsRequestTypeID, - "getStarWithdrawalUrl": GetStarWithdrawalURLRequestTypeID, - "getStarAdAccountUrl": GetStarAdAccountURLRequestTypeID, - "getChatStatistics": GetChatStatisticsRequestTypeID, - "getMessageStatistics": GetMessageStatisticsRequestTypeID, - "getMessagePublicForwards": GetMessagePublicForwardsRequestTypeID, - "getStoryStatistics": GetStoryStatisticsRequestTypeID, - "getStatisticalGraph": GetStatisticalGraphRequestTypeID, - "getStorageStatistics": GetStorageStatisticsRequestTypeID, - "getStorageStatisticsFast": GetStorageStatisticsFastRequestTypeID, - "getDatabaseStatistics": GetDatabaseStatisticsRequestTypeID, - "optimizeStorage": OptimizeStorageRequestTypeID, - "setNetworkType": SetNetworkTypeRequestTypeID, - "getNetworkStatistics": GetNetworkStatisticsRequestTypeID, - "addNetworkStatistics": AddNetworkStatisticsRequestTypeID, - "resetNetworkStatistics": ResetNetworkStatisticsRequestTypeID, - "getAutoDownloadSettingsPresets": GetAutoDownloadSettingsPresetsRequestTypeID, - "setAutoDownloadSettings": SetAutoDownloadSettingsRequestTypeID, - "getAutosaveSettings": GetAutosaveSettingsRequestTypeID, - "setAutosaveSettings": SetAutosaveSettingsRequestTypeID, - "clearAutosaveSettingsExceptions": ClearAutosaveSettingsExceptionsRequestTypeID, - "getBankCardInfo": GetBankCardInfoRequestTypeID, - "getPassportElement": GetPassportElementRequestTypeID, - "getAllPassportElements": GetAllPassportElementsRequestTypeID, - "setPassportElement": SetPassportElementRequestTypeID, - "deletePassportElement": DeletePassportElementRequestTypeID, - "setPassportElementErrors": SetPassportElementErrorsRequestTypeID, - "getPreferredCountryLanguage": GetPreferredCountryLanguageRequestTypeID, - "sendEmailAddressVerificationCode": SendEmailAddressVerificationCodeRequestTypeID, - "resendEmailAddressVerificationCode": ResendEmailAddressVerificationCodeRequestTypeID, - "checkEmailAddressVerificationCode": CheckEmailAddressVerificationCodeRequestTypeID, - "getPassportAuthorizationForm": GetPassportAuthorizationFormRequestTypeID, - "getPassportAuthorizationFormAvailableElements": GetPassportAuthorizationFormAvailableElementsRequestTypeID, - "sendPassportAuthorizationForm": SendPassportAuthorizationFormRequestTypeID, - "setBotUpdatesStatus": SetBotUpdatesStatusRequestTypeID, - "uploadStickerFile": UploadStickerFileRequestTypeID, - "getSuggestedStickerSetName": GetSuggestedStickerSetNameRequestTypeID, - "checkStickerSetName": CheckStickerSetNameRequestTypeID, - "createNewStickerSet": CreateNewStickerSetRequestTypeID, - "addStickerToSet": AddStickerToSetRequestTypeID, - "replaceStickerInSet": ReplaceStickerInSetRequestTypeID, - "setStickerSetThumbnail": SetStickerSetThumbnailRequestTypeID, - "setCustomEmojiStickerSetThumbnail": SetCustomEmojiStickerSetThumbnailRequestTypeID, - "setStickerSetTitle": SetStickerSetTitleRequestTypeID, - "deleteStickerSet": DeleteStickerSetRequestTypeID, - "setStickerPositionInSet": SetStickerPositionInSetRequestTypeID, - "removeStickerFromSet": RemoveStickerFromSetRequestTypeID, - "setStickerEmojis": SetStickerEmojisRequestTypeID, - "setStickerKeywords": SetStickerKeywordsRequestTypeID, - "setStickerMaskPosition": SetStickerMaskPositionRequestTypeID, - "getOwnedStickerSets": GetOwnedStickerSetsRequestTypeID, - "getMapThumbnailFile": GetMapThumbnailFileRequestTypeID, - "getPremiumLimit": GetPremiumLimitRequestTypeID, - "getPremiumFeatures": GetPremiumFeaturesRequestTypeID, - "getPremiumStickerExamples": GetPremiumStickerExamplesRequestTypeID, - "getPremiumInfoSticker": GetPremiumInfoStickerRequestTypeID, - "viewPremiumFeature": ViewPremiumFeatureRequestTypeID, - "clickPremiumSubscriptionButton": ClickPremiumSubscriptionButtonRequestTypeID, - "getPremiumState": GetPremiumStateRequestTypeID, - "getPremiumGiftCodePaymentOptions": GetPremiumGiftCodePaymentOptionsRequestTypeID, - "checkPremiumGiftCode": CheckPremiumGiftCodeRequestTypeID, - "applyPremiumGiftCode": ApplyPremiumGiftCodeRequestTypeID, - "launchPrepaidGiveaway": LaunchPrepaidGiveawayRequestTypeID, - "getGiveawayInfo": GetGiveawayInfoRequestTypeID, - "getStarPaymentOptions": GetStarPaymentOptionsRequestTypeID, - "getStarGiftPaymentOptions": GetStarGiftPaymentOptionsRequestTypeID, - "getStarGiveawayPaymentOptions": GetStarGiveawayPaymentOptionsRequestTypeID, - "getStarTransactions": GetStarTransactionsRequestTypeID, - "getStarSubscriptions": GetStarSubscriptionsRequestTypeID, - "canPurchaseFromStore": CanPurchaseFromStoreRequestTypeID, - "assignAppStoreTransaction": AssignAppStoreTransactionRequestTypeID, - "assignGooglePlayTransaction": AssignGooglePlayTransactionRequestTypeID, - "editStarSubscription": EditStarSubscriptionRequestTypeID, - "editUserStarSubscription": EditUserStarSubscriptionRequestTypeID, - "reuseStarSubscription": ReuseStarSubscriptionRequestTypeID, - "setChatAffiliateProgram": SetChatAffiliateProgramRequestTypeID, - "searchChatAffiliateProgram": SearchChatAffiliateProgramRequestTypeID, - "searchAffiliatePrograms": SearchAffiliateProgramsRequestTypeID, - "connectAffiliateProgram": ConnectAffiliateProgramRequestTypeID, - "disconnectAffiliateProgram": DisconnectAffiliateProgramRequestTypeID, - "getConnectedAffiliateProgram": GetConnectedAffiliateProgramRequestTypeID, - "getConnectedAffiliatePrograms": GetConnectedAffiliateProgramsRequestTypeID, - "getBusinessFeatures": GetBusinessFeaturesRequestTypeID, - "acceptTermsOfService": AcceptTermsOfServiceRequestTypeID, - "searchStringsByPrefix": SearchStringsByPrefixRequestTypeID, - "sendCustomRequest": SendCustomRequestRequestTypeID, - "answerCustomQuery": AnswerCustomQueryRequestTypeID, - "setAlarm": SetAlarmRequestTypeID, - "getCountries": GetCountriesRequestTypeID, - "getCountryCode": GetCountryCodeRequestTypeID, - "getPhoneNumberInfo": GetPhoneNumberInfoRequestTypeID, - "getPhoneNumberInfoSync": GetPhoneNumberInfoSyncRequestTypeID, - "getCollectibleItemInfo": GetCollectibleItemInfoRequestTypeID, - "getDeepLinkInfo": GetDeepLinkInfoRequestTypeID, - "getApplicationConfig": GetApplicationConfigRequestTypeID, - "saveApplicationLogEvent": SaveApplicationLogEventRequestTypeID, - "getApplicationDownloadLink": GetApplicationDownloadLinkRequestTypeID, - "addProxy": AddProxyRequestTypeID, - "editProxy": EditProxyRequestTypeID, - "enableProxy": EnableProxyRequestTypeID, - "disableProxy": DisableProxyRequestTypeID, - "removeProxy": RemoveProxyRequestTypeID, - "getProxies": GetProxiesRequestTypeID, - "getProxyLink": GetProxyLinkRequestTypeID, - "pingProxy": PingProxyRequestTypeID, - "setLogStream": SetLogStreamRequestTypeID, - "getLogStream": GetLogStreamRequestTypeID, - "setLogVerbosityLevel": SetLogVerbosityLevelRequestTypeID, - "getLogVerbosityLevel": GetLogVerbosityLevelRequestTypeID, - "getLogTags": GetLogTagsRequestTypeID, - "setLogTagVerbosityLevel": SetLogTagVerbosityLevelRequestTypeID, - "getLogTagVerbosityLevel": GetLogTagVerbosityLevelRequestTypeID, - "addLogMessage": AddLogMessageRequestTypeID, - "getUserSupportInfo": GetUserSupportInfoRequestTypeID, - "setUserSupportInfo": SetUserSupportInfoRequestTypeID, - "getSupportName": GetSupportNameRequestTypeID, - "testCallEmpty": TestCallEmptyRequestTypeID, - "testCallString": TestCallStringRequestTypeID, - "testCallBytes": TestCallBytesRequestTypeID, - "testCallVectorInt": TestCallVectorIntRequestTypeID, - "testCallVectorIntObject": TestCallVectorIntObjectRequestTypeID, - "testCallVectorString": TestCallVectorStringRequestTypeID, - "testCallVectorStringObject": TestCallVectorStringObjectRequestTypeID, - "testSquareInt": TestSquareIntRequestTypeID, - "testNetwork": TestNetworkRequestTypeID, - "testProxy": TestProxyRequestTypeID, - "testGetDifference": TestGetDifferenceRequestTypeID, - "testUseUpdate": TestUseUpdateRequestTypeID, - "testReturnError": TestReturnErrorRequestTypeID, - } -} - -// TypesConstructorMap maps type ids to constructors. -func TypesConstructorMap() map[uint32]func() bin.Object { - return map[uint32]func() bin.Object{ - DoubleTypeID: func() bin.Object { return &Double{} }, - StringTypeID: func() bin.Object { return &String{} }, - Int32TypeID: func() bin.Object { return &Int32{} }, - Int53TypeID: func() bin.Object { return &Int53{} }, - Int64TypeID: func() bin.Object { return &Int64{} }, - BytesTypeID: func() bin.Object { return &Bytes{} }, - BoolFalseTypeID: func() bin.Object { return &BoolFalse{} }, - BoolTrueTypeID: func() bin.Object { return &BoolTrue{} }, - ErrorTypeID: func() bin.Object { return &Error{} }, - OkTypeID: func() bin.Object { return &Ok{} }, - AuthenticationCodeTypeTelegramMessageTypeID: func() bin.Object { return &AuthenticationCodeTypeTelegramMessage{} }, - AuthenticationCodeTypeSMSTypeID: func() bin.Object { return &AuthenticationCodeTypeSMS{} }, - AuthenticationCodeTypeSMSWordTypeID: func() bin.Object { return &AuthenticationCodeTypeSMSWord{} }, - AuthenticationCodeTypeSMSPhraseTypeID: func() bin.Object { return &AuthenticationCodeTypeSMSPhrase{} }, - AuthenticationCodeTypeCallTypeID: func() bin.Object { return &AuthenticationCodeTypeCall{} }, - AuthenticationCodeTypeFlashCallTypeID: func() bin.Object { return &AuthenticationCodeTypeFlashCall{} }, - AuthenticationCodeTypeMissedCallTypeID: func() bin.Object { return &AuthenticationCodeTypeMissedCall{} }, - AuthenticationCodeTypeFragmentTypeID: func() bin.Object { return &AuthenticationCodeTypeFragment{} }, - AuthenticationCodeTypeFirebaseAndroidTypeID: func() bin.Object { return &AuthenticationCodeTypeFirebaseAndroid{} }, - AuthenticationCodeTypeFirebaseIosTypeID: func() bin.Object { return &AuthenticationCodeTypeFirebaseIos{} }, - AuthenticationCodeInfoTypeID: func() bin.Object { return &AuthenticationCodeInfo{} }, - EmailAddressAuthenticationCodeInfoTypeID: func() bin.Object { return &EmailAddressAuthenticationCodeInfo{} }, - EmailAddressAuthenticationCodeTypeID: func() bin.Object { return &EmailAddressAuthenticationCode{} }, - EmailAddressAuthenticationAppleIDTypeID: func() bin.Object { return &EmailAddressAuthenticationAppleID{} }, - EmailAddressAuthenticationGoogleIDTypeID: func() bin.Object { return &EmailAddressAuthenticationGoogleID{} }, - EmailAddressResetStateAvailableTypeID: func() bin.Object { return &EmailAddressResetStateAvailable{} }, - EmailAddressResetStatePendingTypeID: func() bin.Object { return &EmailAddressResetStatePending{} }, - TextEntityTypeID: func() bin.Object { return &TextEntity{} }, - TextEntitiesTypeID: func() bin.Object { return &TextEntities{} }, - FormattedTextTypeID: func() bin.Object { return &FormattedText{} }, - TermsOfServiceTypeID: func() bin.Object { return &TermsOfService{} }, - AuthorizationStateWaitTdlibParametersTypeID: func() bin.Object { return &AuthorizationStateWaitTdlibParameters{} }, - AuthorizationStateWaitPhoneNumberTypeID: func() bin.Object { return &AuthorizationStateWaitPhoneNumber{} }, - AuthorizationStateWaitEmailAddressTypeID: func() bin.Object { return &AuthorizationStateWaitEmailAddress{} }, - AuthorizationStateWaitEmailCodeTypeID: func() bin.Object { return &AuthorizationStateWaitEmailCode{} }, - AuthorizationStateWaitCodeTypeID: func() bin.Object { return &AuthorizationStateWaitCode{} }, - AuthorizationStateWaitOtherDeviceConfirmationTypeID: func() bin.Object { return &AuthorizationStateWaitOtherDeviceConfirmation{} }, - AuthorizationStateWaitRegistrationTypeID: func() bin.Object { return &AuthorizationStateWaitRegistration{} }, - AuthorizationStateWaitPasswordTypeID: func() bin.Object { return &AuthorizationStateWaitPassword{} }, - AuthorizationStateReadyTypeID: func() bin.Object { return &AuthorizationStateReady{} }, - AuthorizationStateLoggingOutTypeID: func() bin.Object { return &AuthorizationStateLoggingOut{} }, - AuthorizationStateClosingTypeID: func() bin.Object { return &AuthorizationStateClosing{} }, - AuthorizationStateClosedTypeID: func() bin.Object { return &AuthorizationStateClosed{} }, - FirebaseDeviceVerificationParametersSafetyNetTypeID: func() bin.Object { return &FirebaseDeviceVerificationParametersSafetyNet{} }, - FirebaseDeviceVerificationParametersPlayIntegrityTypeID: func() bin.Object { return &FirebaseDeviceVerificationParametersPlayIntegrity{} }, - PasswordStateTypeID: func() bin.Object { return &PasswordState{} }, - RecoveryEmailAddressTypeID: func() bin.Object { return &RecoveryEmailAddress{} }, - TemporaryPasswordStateTypeID: func() bin.Object { return &TemporaryPasswordState{} }, - LocalFileTypeID: func() bin.Object { return &LocalFile{} }, - RemoteFileTypeID: func() bin.Object { return &RemoteFile{} }, - FileTypeID: func() bin.Object { return &File{} }, - InputFileIDTypeID: func() bin.Object { return &InputFileID{} }, - InputFileRemoteTypeID: func() bin.Object { return &InputFileRemote{} }, - InputFileLocalTypeID: func() bin.Object { return &InputFileLocal{} }, - InputFileGeneratedTypeID: func() bin.Object { return &InputFileGenerated{} }, - PhotoSizeTypeID: func() bin.Object { return &PhotoSize{} }, - MinithumbnailTypeID: func() bin.Object { return &Minithumbnail{} }, - ThumbnailFormatJpegTypeID: func() bin.Object { return &ThumbnailFormatJpeg{} }, - ThumbnailFormatGifTypeID: func() bin.Object { return &ThumbnailFormatGif{} }, - ThumbnailFormatMpeg4TypeID: func() bin.Object { return &ThumbnailFormatMpeg4{} }, - ThumbnailFormatPngTypeID: func() bin.Object { return &ThumbnailFormatPng{} }, - ThumbnailFormatTgsTypeID: func() bin.Object { return &ThumbnailFormatTgs{} }, - ThumbnailFormatWebmTypeID: func() bin.Object { return &ThumbnailFormatWebm{} }, - ThumbnailFormatWebpTypeID: func() bin.Object { return &ThumbnailFormatWebp{} }, - ThumbnailTypeID: func() bin.Object { return &Thumbnail{} }, - MaskPointForeheadTypeID: func() bin.Object { return &MaskPointForehead{} }, - MaskPointEyesTypeID: func() bin.Object { return &MaskPointEyes{} }, - MaskPointMouthTypeID: func() bin.Object { return &MaskPointMouth{} }, - MaskPointChinTypeID: func() bin.Object { return &MaskPointChin{} }, - MaskPositionTypeID: func() bin.Object { return &MaskPosition{} }, - StickerFormatWebpTypeID: func() bin.Object { return &StickerFormatWebp{} }, - StickerFormatTgsTypeID: func() bin.Object { return &StickerFormatTgs{} }, - StickerFormatWebmTypeID: func() bin.Object { return &StickerFormatWebm{} }, - StickerTypeRegularTypeID: func() bin.Object { return &StickerTypeRegular{} }, - StickerTypeMaskTypeID: func() bin.Object { return &StickerTypeMask{} }, - StickerTypeCustomEmojiTypeID: func() bin.Object { return &StickerTypeCustomEmoji{} }, - StickerFullTypeRegularTypeID: func() bin.Object { return &StickerFullTypeRegular{} }, - StickerFullTypeMaskTypeID: func() bin.Object { return &StickerFullTypeMask{} }, - StickerFullTypeCustomEmojiTypeID: func() bin.Object { return &StickerFullTypeCustomEmoji{} }, - ClosedVectorPathTypeID: func() bin.Object { return &ClosedVectorPath{} }, - OutlineTypeID: func() bin.Object { return &Outline{} }, - PollOptionTypeID: func() bin.Object { return &PollOption{} }, - PollTypeRegularTypeID: func() bin.Object { return &PollTypeRegular{} }, - PollTypeQuizTypeID: func() bin.Object { return &PollTypeQuiz{} }, - AnimationTypeID: func() bin.Object { return &Animation{} }, - AudioTypeID: func() bin.Object { return &Audio{} }, - DocumentTypeID: func() bin.Object { return &Document{} }, - PhotoTypeID: func() bin.Object { return &Photo{} }, - StickerTypeID: func() bin.Object { return &Sticker{} }, - VideoTypeID: func() bin.Object { return &Video{} }, - VideoNoteTypeID: func() bin.Object { return &VideoNote{} }, - VoiceNoteTypeID: func() bin.Object { return &VoiceNote{} }, - AnimatedEmojiTypeID: func() bin.Object { return &AnimatedEmoji{} }, - ContactTypeID: func() bin.Object { return &Contact{} }, - LocationTypeID: func() bin.Object { return &Location{} }, - VenueTypeID: func() bin.Object { return &Venue{} }, - GameTypeID: func() bin.Object { return &Game{} }, - WebAppTypeID: func() bin.Object { return &WebApp{} }, - PollTypeID: func() bin.Object { return &Poll{} }, - AlternativeVideoTypeID: func() bin.Object { return &AlternativeVideo{} }, - BackgroundTypeID: func() bin.Object { return &Background{} }, - BackgroundsTypeID: func() bin.Object { return &Backgrounds{} }, - ChatBackgroundTypeID: func() bin.Object { return &ChatBackground{} }, - ProfilePhotoTypeID: func() bin.Object { return &ProfilePhoto{} }, - ChatPhotoInfoTypeID: func() bin.Object { return &ChatPhotoInfo{} }, - UserTypeRegularTypeID: func() bin.Object { return &UserTypeRegular{} }, - UserTypeDeletedTypeID: func() bin.Object { return &UserTypeDeleted{} }, - UserTypeBotTypeID: func() bin.Object { return &UserTypeBot{} }, - UserTypeUnknownTypeID: func() bin.Object { return &UserTypeUnknown{} }, - BotCommandTypeID: func() bin.Object { return &BotCommand{} }, - BotCommandsTypeID: func() bin.Object { return &BotCommands{} }, - BotMenuButtonTypeID: func() bin.Object { return &BotMenuButton{} }, - BotVerificationParametersTypeID: func() bin.Object { return &BotVerificationParameters{} }, - BotVerificationTypeID: func() bin.Object { return &BotVerification{} }, - VerificationStatusTypeID: func() bin.Object { return &VerificationStatus{} }, - ChatLocationTypeID: func() bin.Object { return &ChatLocation{} }, - BirthdateTypeID: func() bin.Object { return &Birthdate{} }, - CloseBirthdayUserTypeID: func() bin.Object { return &CloseBirthdayUser{} }, - BusinessAwayMessageScheduleAlwaysTypeID: func() bin.Object { return &BusinessAwayMessageScheduleAlways{} }, - BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID: func() bin.Object { return &BusinessAwayMessageScheduleOutsideOfOpeningHours{} }, - BusinessAwayMessageScheduleCustomTypeID: func() bin.Object { return &BusinessAwayMessageScheduleCustom{} }, - BusinessLocationTypeID: func() bin.Object { return &BusinessLocation{} }, - BusinessRecipientsTypeID: func() bin.Object { return &BusinessRecipients{} }, - BusinessAwayMessageSettingsTypeID: func() bin.Object { return &BusinessAwayMessageSettings{} }, - BusinessGreetingMessageSettingsTypeID: func() bin.Object { return &BusinessGreetingMessageSettings{} }, - BusinessConnectedBotTypeID: func() bin.Object { return &BusinessConnectedBot{} }, - BusinessStartPageTypeID: func() bin.Object { return &BusinessStartPage{} }, - InputBusinessStartPageTypeID: func() bin.Object { return &InputBusinessStartPage{} }, - BusinessOpeningHoursIntervalTypeID: func() bin.Object { return &BusinessOpeningHoursInterval{} }, - BusinessOpeningHoursTypeID: func() bin.Object { return &BusinessOpeningHours{} }, - BusinessInfoTypeID: func() bin.Object { return &BusinessInfo{} }, - BusinessChatLinkTypeID: func() bin.Object { return &BusinessChatLink{} }, - BusinessChatLinksTypeID: func() bin.Object { return &BusinessChatLinks{} }, - InputBusinessChatLinkTypeID: func() bin.Object { return &InputBusinessChatLink{} }, - BusinessChatLinkInfoTypeID: func() bin.Object { return &BusinessChatLinkInfo{} }, - ChatPhotoStickerTypeRegularOrMaskTypeID: func() bin.Object { return &ChatPhotoStickerTypeRegularOrMask{} }, - ChatPhotoStickerTypeCustomEmojiTypeID: func() bin.Object { return &ChatPhotoStickerTypeCustomEmoji{} }, - ChatPhotoStickerTypeID: func() bin.Object { return &ChatPhotoSticker{} }, - AnimatedChatPhotoTypeID: func() bin.Object { return &AnimatedChatPhoto{} }, - ChatPhotoTypeID: func() bin.Object { return &ChatPhoto{} }, - ChatPhotosTypeID: func() bin.Object { return &ChatPhotos{} }, - InputChatPhotoPreviousTypeID: func() bin.Object { return &InputChatPhotoPrevious{} }, - InputChatPhotoStaticTypeID: func() bin.Object { return &InputChatPhotoStatic{} }, - InputChatPhotoAnimationTypeID: func() bin.Object { return &InputChatPhotoAnimation{} }, - InputChatPhotoStickerTypeID: func() bin.Object { return &InputChatPhotoSticker{} }, - ChatPermissionsTypeID: func() bin.Object { return &ChatPermissions{} }, - ChatAdministratorRightsTypeID: func() bin.Object { return &ChatAdministratorRights{} }, - StarAmountTypeID: func() bin.Object { return &StarAmount{} }, - StarSubscriptionTypeChannelTypeID: func() bin.Object { return &StarSubscriptionTypeChannel{} }, - StarSubscriptionTypeBotTypeID: func() bin.Object { return &StarSubscriptionTypeBot{} }, - StarSubscriptionPricingTypeID: func() bin.Object { return &StarSubscriptionPricing{} }, - StarSubscriptionTypeID: func() bin.Object { return &StarSubscription{} }, - StarSubscriptionsTypeID: func() bin.Object { return &StarSubscriptions{} }, - AffiliateTypeCurrentUserTypeID: func() bin.Object { return &AffiliateTypeCurrentUser{} }, - AffiliateTypeBotTypeID: func() bin.Object { return &AffiliateTypeBot{} }, - AffiliateTypeChannelTypeID: func() bin.Object { return &AffiliateTypeChannel{} }, - AffiliateProgramSortOrderProfitabilityTypeID: func() bin.Object { return &AffiliateProgramSortOrderProfitability{} }, - AffiliateProgramSortOrderCreationDateTypeID: func() bin.Object { return &AffiliateProgramSortOrderCreationDate{} }, - AffiliateProgramSortOrderRevenueTypeID: func() bin.Object { return &AffiliateProgramSortOrderRevenue{} }, - AffiliateProgramParametersTypeID: func() bin.Object { return &AffiliateProgramParameters{} }, - AffiliateProgramInfoTypeID: func() bin.Object { return &AffiliateProgramInfo{} }, - AffiliateInfoTypeID: func() bin.Object { return &AffiliateInfo{} }, - FoundAffiliateProgramTypeID: func() bin.Object { return &FoundAffiliateProgram{} }, - FoundAffiliateProgramsTypeID: func() bin.Object { return &FoundAffiliatePrograms{} }, - ConnectedAffiliateProgramTypeID: func() bin.Object { return &ConnectedAffiliateProgram{} }, - ConnectedAffiliateProgramsTypeID: func() bin.Object { return &ConnectedAffiliatePrograms{} }, - ProductInfoTypeID: func() bin.Object { return &ProductInfo{} }, - PremiumPaymentOptionTypeID: func() bin.Object { return &PremiumPaymentOption{} }, - PremiumStatePaymentOptionTypeID: func() bin.Object { return &PremiumStatePaymentOption{} }, - PremiumGiftCodePaymentOptionTypeID: func() bin.Object { return &PremiumGiftCodePaymentOption{} }, - PremiumGiftCodePaymentOptionsTypeID: func() bin.Object { return &PremiumGiftCodePaymentOptions{} }, - PremiumGiftCodeInfoTypeID: func() bin.Object { return &PremiumGiftCodeInfo{} }, - StarPaymentOptionTypeID: func() bin.Object { return &StarPaymentOption{} }, - StarPaymentOptionsTypeID: func() bin.Object { return &StarPaymentOptions{} }, - StarGiveawayWinnerOptionTypeID: func() bin.Object { return &StarGiveawayWinnerOption{} }, - StarGiveawayPaymentOptionTypeID: func() bin.Object { return &StarGiveawayPaymentOption{} }, - StarGiveawayPaymentOptionsTypeID: func() bin.Object { return &StarGiveawayPaymentOptions{} }, - UpgradedGiftModelTypeID: func() bin.Object { return &UpgradedGiftModel{} }, - UpgradedGiftSymbolTypeID: func() bin.Object { return &UpgradedGiftSymbol{} }, - UpgradedGiftBackdropTypeID: func() bin.Object { return &UpgradedGiftBackdrop{} }, - UpgradedGiftOriginalDetailsTypeID: func() bin.Object { return &UpgradedGiftOriginalDetails{} }, - GiftTypeID: func() bin.Object { return &Gift{} }, - GiftsTypeID: func() bin.Object { return &Gifts{} }, - UpgradedGiftTypeID: func() bin.Object { return &UpgradedGift{} }, - UpgradeGiftResultTypeID: func() bin.Object { return &UpgradeGiftResult{} }, - SentGiftRegularTypeID: func() bin.Object { return &SentGiftRegular{} }, - SentGiftUpgradedTypeID: func() bin.Object { return &SentGiftUpgraded{} }, - UserGiftTypeID: func() bin.Object { return &UserGift{} }, - UserGiftsTypeID: func() bin.Object { return &UserGifts{} }, - GiftUpgradePreviewTypeID: func() bin.Object { return &GiftUpgradePreview{} }, - StarTransactionDirectionIncomingTypeID: func() bin.Object { return &StarTransactionDirectionIncoming{} }, - StarTransactionDirectionOutgoingTypeID: func() bin.Object { return &StarTransactionDirectionOutgoing{} }, - StarTransactionTypePremiumBotDepositTypeID: func() bin.Object { return &StarTransactionTypePremiumBotDeposit{} }, - StarTransactionTypeAppStoreDepositTypeID: func() bin.Object { return &StarTransactionTypeAppStoreDeposit{} }, - StarTransactionTypeGooglePlayDepositTypeID: func() bin.Object { return &StarTransactionTypeGooglePlayDeposit{} }, - StarTransactionTypeFragmentDepositTypeID: func() bin.Object { return &StarTransactionTypeFragmentDeposit{} }, - StarTransactionTypeUserDepositTypeID: func() bin.Object { return &StarTransactionTypeUserDeposit{} }, - StarTransactionTypeGiveawayDepositTypeID: func() bin.Object { return &StarTransactionTypeGiveawayDeposit{} }, - StarTransactionTypeFragmentWithdrawalTypeID: func() bin.Object { return &StarTransactionTypeFragmentWithdrawal{} }, - StarTransactionTypeTelegramAdsWithdrawalTypeID: func() bin.Object { return &StarTransactionTypeTelegramAdsWithdrawal{} }, - StarTransactionTypeTelegramAPIUsageTypeID: func() bin.Object { return &StarTransactionTypeTelegramAPIUsage{} }, - StarTransactionTypeBotPaidMediaPurchaseTypeID: func() bin.Object { return &StarTransactionTypeBotPaidMediaPurchase{} }, - StarTransactionTypeBotPaidMediaSaleTypeID: func() bin.Object { return &StarTransactionTypeBotPaidMediaSale{} }, - StarTransactionTypeChannelPaidMediaPurchaseTypeID: func() bin.Object { return &StarTransactionTypeChannelPaidMediaPurchase{} }, - StarTransactionTypeChannelPaidMediaSaleTypeID: func() bin.Object { return &StarTransactionTypeChannelPaidMediaSale{} }, - StarTransactionTypeBotInvoicePurchaseTypeID: func() bin.Object { return &StarTransactionTypeBotInvoicePurchase{} }, - StarTransactionTypeBotInvoiceSaleTypeID: func() bin.Object { return &StarTransactionTypeBotInvoiceSale{} }, - StarTransactionTypeBotSubscriptionPurchaseTypeID: func() bin.Object { return &StarTransactionTypeBotSubscriptionPurchase{} }, - StarTransactionTypeBotSubscriptionSaleTypeID: func() bin.Object { return &StarTransactionTypeBotSubscriptionSale{} }, - StarTransactionTypeChannelSubscriptionPurchaseTypeID: func() bin.Object { return &StarTransactionTypeChannelSubscriptionPurchase{} }, - StarTransactionTypeChannelSubscriptionSaleTypeID: func() bin.Object { return &StarTransactionTypeChannelSubscriptionSale{} }, - StarTransactionTypeGiftPurchaseTypeID: func() bin.Object { return &StarTransactionTypeGiftPurchase{} }, - StarTransactionTypeGiftTransferTypeID: func() bin.Object { return &StarTransactionTypeGiftTransfer{} }, - StarTransactionTypeGiftSaleTypeID: func() bin.Object { return &StarTransactionTypeGiftSale{} }, - StarTransactionTypeGiftUpgradeTypeID: func() bin.Object { return &StarTransactionTypeGiftUpgrade{} }, - StarTransactionTypeChannelPaidReactionSendTypeID: func() bin.Object { return &StarTransactionTypeChannelPaidReactionSend{} }, - StarTransactionTypeChannelPaidReactionReceiveTypeID: func() bin.Object { return &StarTransactionTypeChannelPaidReactionReceive{} }, - StarTransactionTypeAffiliateProgramCommissionTypeID: func() bin.Object { return &StarTransactionTypeAffiliateProgramCommission{} }, - StarTransactionTypeUnsupportedTypeID: func() bin.Object { return &StarTransactionTypeUnsupported{} }, - StarTransactionTypeID: func() bin.Object { return &StarTransaction{} }, - StarTransactionsTypeID: func() bin.Object { return &StarTransactions{} }, - GiveawayParticipantStatusEligibleTypeID: func() bin.Object { return &GiveawayParticipantStatusEligible{} }, - GiveawayParticipantStatusParticipatingTypeID: func() bin.Object { return &GiveawayParticipantStatusParticipating{} }, - GiveawayParticipantStatusAlreadyWasMemberTypeID: func() bin.Object { return &GiveawayParticipantStatusAlreadyWasMember{} }, - GiveawayParticipantStatusAdministratorTypeID: func() bin.Object { return &GiveawayParticipantStatusAdministrator{} }, - GiveawayParticipantStatusDisallowedCountryTypeID: func() bin.Object { return &GiveawayParticipantStatusDisallowedCountry{} }, - GiveawayInfoOngoingTypeID: func() bin.Object { return &GiveawayInfoOngoing{} }, - GiveawayInfoCompletedTypeID: func() bin.Object { return &GiveawayInfoCompleted{} }, - GiveawayPrizePremiumTypeID: func() bin.Object { return &GiveawayPrizePremium{} }, - GiveawayPrizeStarsTypeID: func() bin.Object { return &GiveawayPrizeStars{} }, - AccentColorTypeID: func() bin.Object { return &AccentColor{} }, - ProfileAccentColorsTypeID: func() bin.Object { return &ProfileAccentColors{} }, - ProfileAccentColorTypeID: func() bin.Object { return &ProfileAccentColor{} }, - EmojiStatusTypeID: func() bin.Object { return &EmojiStatus{} }, - EmojiStatusesTypeID: func() bin.Object { return &EmojiStatuses{} }, - UsernamesTypeID: func() bin.Object { return &Usernames{} }, - UserTypeID: func() bin.Object { return &User{} }, - BotInfoTypeID: func() bin.Object { return &BotInfo{} }, - UserFullInfoTypeID: func() bin.Object { return &UserFullInfo{} }, - UsersTypeID: func() bin.Object { return &Users{} }, - FoundUsersTypeID: func() bin.Object { return &FoundUsers{} }, - ChatAdministratorTypeID: func() bin.Object { return &ChatAdministrator{} }, - ChatAdministratorsTypeID: func() bin.Object { return &ChatAdministrators{} }, - ChatMemberStatusCreatorTypeID: func() bin.Object { return &ChatMemberStatusCreator{} }, - ChatMemberStatusAdministratorTypeID: func() bin.Object { return &ChatMemberStatusAdministrator{} }, - ChatMemberStatusMemberTypeID: func() bin.Object { return &ChatMemberStatusMember{} }, - ChatMemberStatusRestrictedTypeID: func() bin.Object { return &ChatMemberStatusRestricted{} }, - ChatMemberStatusLeftTypeID: func() bin.Object { return &ChatMemberStatusLeft{} }, - ChatMemberStatusBannedTypeID: func() bin.Object { return &ChatMemberStatusBanned{} }, - ChatMemberTypeID: func() bin.Object { return &ChatMember{} }, - ChatMembersTypeID: func() bin.Object { return &ChatMembers{} }, - ChatMembersFilterContactsTypeID: func() bin.Object { return &ChatMembersFilterContacts{} }, - ChatMembersFilterAdministratorsTypeID: func() bin.Object { return &ChatMembersFilterAdministrators{} }, - ChatMembersFilterMembersTypeID: func() bin.Object { return &ChatMembersFilterMembers{} }, - ChatMembersFilterMentionTypeID: func() bin.Object { return &ChatMembersFilterMention{} }, - ChatMembersFilterRestrictedTypeID: func() bin.Object { return &ChatMembersFilterRestricted{} }, - ChatMembersFilterBannedTypeID: func() bin.Object { return &ChatMembersFilterBanned{} }, - ChatMembersFilterBotsTypeID: func() bin.Object { return &ChatMembersFilterBots{} }, - SupergroupMembersFilterRecentTypeID: func() bin.Object { return &SupergroupMembersFilterRecent{} }, - SupergroupMembersFilterContactsTypeID: func() bin.Object { return &SupergroupMembersFilterContacts{} }, - SupergroupMembersFilterAdministratorsTypeID: func() bin.Object { return &SupergroupMembersFilterAdministrators{} }, - SupergroupMembersFilterSearchTypeID: func() bin.Object { return &SupergroupMembersFilterSearch{} }, - SupergroupMembersFilterRestrictedTypeID: func() bin.Object { return &SupergroupMembersFilterRestricted{} }, - SupergroupMembersFilterBannedTypeID: func() bin.Object { return &SupergroupMembersFilterBanned{} }, - SupergroupMembersFilterMentionTypeID: func() bin.Object { return &SupergroupMembersFilterMention{} }, - SupergroupMembersFilterBotsTypeID: func() bin.Object { return &SupergroupMembersFilterBots{} }, - ChatInviteLinkTypeID: func() bin.Object { return &ChatInviteLink{} }, - ChatInviteLinksTypeID: func() bin.Object { return &ChatInviteLinks{} }, - ChatInviteLinkCountTypeID: func() bin.Object { return &ChatInviteLinkCount{} }, - ChatInviteLinkCountsTypeID: func() bin.Object { return &ChatInviteLinkCounts{} }, - ChatInviteLinkMemberTypeID: func() bin.Object { return &ChatInviteLinkMember{} }, - ChatInviteLinkMembersTypeID: func() bin.Object { return &ChatInviteLinkMembers{} }, - InviteLinkChatTypeBasicGroupTypeID: func() bin.Object { return &InviteLinkChatTypeBasicGroup{} }, - InviteLinkChatTypeSupergroupTypeID: func() bin.Object { return &InviteLinkChatTypeSupergroup{} }, - InviteLinkChatTypeChannelTypeID: func() bin.Object { return &InviteLinkChatTypeChannel{} }, - ChatInviteLinkSubscriptionInfoTypeID: func() bin.Object { return &ChatInviteLinkSubscriptionInfo{} }, - ChatInviteLinkInfoTypeID: func() bin.Object { return &ChatInviteLinkInfo{} }, - ChatJoinRequestTypeID: func() bin.Object { return &ChatJoinRequest{} }, - ChatJoinRequestsTypeID: func() bin.Object { return &ChatJoinRequests{} }, - ChatJoinRequestsInfoTypeID: func() bin.Object { return &ChatJoinRequestsInfo{} }, - BasicGroupTypeID: func() bin.Object { return &BasicGroup{} }, - BasicGroupFullInfoTypeID: func() bin.Object { return &BasicGroupFullInfo{} }, - SupergroupTypeID: func() bin.Object { return &Supergroup{} }, - SupergroupFullInfoTypeID: func() bin.Object { return &SupergroupFullInfo{} }, - SecretChatStatePendingTypeID: func() bin.Object { return &SecretChatStatePending{} }, - SecretChatStateReadyTypeID: func() bin.Object { return &SecretChatStateReady{} }, - SecretChatStateClosedTypeID: func() bin.Object { return &SecretChatStateClosed{} }, - SecretChatTypeID: func() bin.Object { return &SecretChat{} }, - MessageSenderUserTypeID: func() bin.Object { return &MessageSenderUser{} }, - MessageSenderChatTypeID: func() bin.Object { return &MessageSenderChat{} }, - MessageSendersTypeID: func() bin.Object { return &MessageSenders{} }, - ChatMessageSenderTypeID: func() bin.Object { return &ChatMessageSender{} }, - ChatMessageSendersTypeID: func() bin.Object { return &ChatMessageSenders{} }, - MessageReadDateReadTypeID: func() bin.Object { return &MessageReadDateRead{} }, - MessageReadDateUnreadTypeID: func() bin.Object { return &MessageReadDateUnread{} }, - MessageReadDateTooOldTypeID: func() bin.Object { return &MessageReadDateTooOld{} }, - MessageReadDateUserPrivacyRestrictedTypeID: func() bin.Object { return &MessageReadDateUserPrivacyRestricted{} }, - MessageReadDateMyPrivacyRestrictedTypeID: func() bin.Object { return &MessageReadDateMyPrivacyRestricted{} }, - MessageViewerTypeID: func() bin.Object { return &MessageViewer{} }, - MessageViewersTypeID: func() bin.Object { return &MessageViewers{} }, - MessageOriginUserTypeID: func() bin.Object { return &MessageOriginUser{} }, - MessageOriginHiddenUserTypeID: func() bin.Object { return &MessageOriginHiddenUser{} }, - MessageOriginChatTypeID: func() bin.Object { return &MessageOriginChat{} }, - MessageOriginChannelTypeID: func() bin.Object { return &MessageOriginChannel{} }, - ForwardSourceTypeID: func() bin.Object { return &ForwardSource{} }, - ReactionTypeEmojiTypeID: func() bin.Object { return &ReactionTypeEmoji{} }, - ReactionTypeCustomEmojiTypeID: func() bin.Object { return &ReactionTypeCustomEmoji{} }, - ReactionTypePaidTypeID: func() bin.Object { return &ReactionTypePaid{} }, - PaidReactorTypeID: func() bin.Object { return &PaidReactor{} }, - MessageForwardInfoTypeID: func() bin.Object { return &MessageForwardInfo{} }, - MessageImportInfoTypeID: func() bin.Object { return &MessageImportInfo{} }, - MessageReplyInfoTypeID: func() bin.Object { return &MessageReplyInfo{} }, - MessageReactionTypeID: func() bin.Object { return &MessageReaction{} }, - MessageReactionsTypeID: func() bin.Object { return &MessageReactions{} }, - MessageInteractionInfoTypeID: func() bin.Object { return &MessageInteractionInfo{} }, - UnreadReactionTypeID: func() bin.Object { return &UnreadReaction{} }, - MessageEffectTypeEmojiReactionTypeID: func() bin.Object { return &MessageEffectTypeEmojiReaction{} }, - MessageEffectTypePremiumStickerTypeID: func() bin.Object { return &MessageEffectTypePremiumSticker{} }, - MessageEffectTypeID: func() bin.Object { return &MessageEffect{} }, - MessageSendingStatePendingTypeID: func() bin.Object { return &MessageSendingStatePending{} }, - MessageSendingStateFailedTypeID: func() bin.Object { return &MessageSendingStateFailed{} }, - TextQuoteTypeID: func() bin.Object { return &TextQuote{} }, - InputTextQuoteTypeID: func() bin.Object { return &InputTextQuote{} }, - MessageReplyToMessageTypeID: func() bin.Object { return &MessageReplyToMessage{} }, - MessageReplyToStoryTypeID: func() bin.Object { return &MessageReplyToStory{} }, - InputMessageReplyToMessageTypeID: func() bin.Object { return &InputMessageReplyToMessage{} }, - InputMessageReplyToExternalMessageTypeID: func() bin.Object { return &InputMessageReplyToExternalMessage{} }, - InputMessageReplyToStoryTypeID: func() bin.Object { return &InputMessageReplyToStory{} }, - FactCheckTypeID: func() bin.Object { return &FactCheck{} }, - MessageTypeID: func() bin.Object { return &Message{} }, - MessagesTypeID: func() bin.Object { return &Messages{} }, - FoundMessagesTypeID: func() bin.Object { return &FoundMessages{} }, - FoundChatMessagesTypeID: func() bin.Object { return &FoundChatMessages{} }, - MessagePositionTypeID: func() bin.Object { return &MessagePosition{} }, - MessagePositionsTypeID: func() bin.Object { return &MessagePositions{} }, - MessageCalendarDayTypeID: func() bin.Object { return &MessageCalendarDay{} }, - MessageCalendarTypeID: func() bin.Object { return &MessageCalendar{} }, - BusinessMessageTypeID: func() bin.Object { return &BusinessMessage{} }, - BusinessMessagesTypeID: func() bin.Object { return &BusinessMessages{} }, - MessageSourceChatHistoryTypeID: func() bin.Object { return &MessageSourceChatHistory{} }, - MessageSourceMessageThreadHistoryTypeID: func() bin.Object { return &MessageSourceMessageThreadHistory{} }, - MessageSourceForumTopicHistoryTypeID: func() bin.Object { return &MessageSourceForumTopicHistory{} }, - MessageSourceHistoryPreviewTypeID: func() bin.Object { return &MessageSourceHistoryPreview{} }, - MessageSourceChatListTypeID: func() bin.Object { return &MessageSourceChatList{} }, - MessageSourceSearchTypeID: func() bin.Object { return &MessageSourceSearch{} }, - MessageSourceChatEventLogTypeID: func() bin.Object { return &MessageSourceChatEventLog{} }, - MessageSourceNotificationTypeID: func() bin.Object { return &MessageSourceNotification{} }, - MessageSourceScreenshotTypeID: func() bin.Object { return &MessageSourceScreenshot{} }, - MessageSourceOtherTypeID: func() bin.Object { return &MessageSourceOther{} }, - MessageSponsorTypeID: func() bin.Object { return &MessageSponsor{} }, - SponsoredMessageTypeID: func() bin.Object { return &SponsoredMessage{} }, - SponsoredMessagesTypeID: func() bin.Object { return &SponsoredMessages{} }, - ReportOptionTypeID: func() bin.Object { return &ReportOption{} }, - ReportChatSponsoredMessageResultOkTypeID: func() bin.Object { return &ReportChatSponsoredMessageResultOk{} }, - ReportChatSponsoredMessageResultFailedTypeID: func() bin.Object { return &ReportChatSponsoredMessageResultFailed{} }, - ReportChatSponsoredMessageResultOptionRequiredTypeID: func() bin.Object { return &ReportChatSponsoredMessageResultOptionRequired{} }, - ReportChatSponsoredMessageResultAdsHiddenTypeID: func() bin.Object { return &ReportChatSponsoredMessageResultAdsHidden{} }, - ReportChatSponsoredMessageResultPremiumRequiredTypeID: func() bin.Object { return &ReportChatSponsoredMessageResultPremiumRequired{} }, - FileDownloadTypeID: func() bin.Object { return &FileDownload{} }, - DownloadedFileCountsTypeID: func() bin.Object { return &DownloadedFileCounts{} }, - FoundFileDownloadsTypeID: func() bin.Object { return &FoundFileDownloads{} }, - NotificationSettingsScopePrivateChatsTypeID: func() bin.Object { return &NotificationSettingsScopePrivateChats{} }, - NotificationSettingsScopeGroupChatsTypeID: func() bin.Object { return &NotificationSettingsScopeGroupChats{} }, - NotificationSettingsScopeChannelChatsTypeID: func() bin.Object { return &NotificationSettingsScopeChannelChats{} }, - ChatNotificationSettingsTypeID: func() bin.Object { return &ChatNotificationSettings{} }, - ScopeNotificationSettingsTypeID: func() bin.Object { return &ScopeNotificationSettings{} }, - ReactionNotificationSourceNoneTypeID: func() bin.Object { return &ReactionNotificationSourceNone{} }, - ReactionNotificationSourceContactsTypeID: func() bin.Object { return &ReactionNotificationSourceContacts{} }, - ReactionNotificationSourceAllTypeID: func() bin.Object { return &ReactionNotificationSourceAll{} }, - ReactionNotificationSettingsTypeID: func() bin.Object { return &ReactionNotificationSettings{} }, - DraftMessageTypeID: func() bin.Object { return &DraftMessage{} }, - ChatTypePrivateTypeID: func() bin.Object { return &ChatTypePrivate{} }, - ChatTypeBasicGroupTypeID: func() bin.Object { return &ChatTypeBasicGroup{} }, - ChatTypeSupergroupTypeID: func() bin.Object { return &ChatTypeSupergroup{} }, - ChatTypeSecretTypeID: func() bin.Object { return &ChatTypeSecret{} }, - ChatFolderIconTypeID: func() bin.Object { return &ChatFolderIcon{} }, - ChatFolderNameTypeID: func() bin.Object { return &ChatFolderName{} }, - ChatFolderTypeID: func() bin.Object { return &ChatFolder{} }, - ChatFolderInfoTypeID: func() bin.Object { return &ChatFolderInfo{} }, - ChatFolderInviteLinkTypeID: func() bin.Object { return &ChatFolderInviteLink{} }, - ChatFolderInviteLinksTypeID: func() bin.Object { return &ChatFolderInviteLinks{} }, - ChatFolderInviteLinkInfoTypeID: func() bin.Object { return &ChatFolderInviteLinkInfo{} }, - RecommendedChatFolderTypeID: func() bin.Object { return &RecommendedChatFolder{} }, - RecommendedChatFoldersTypeID: func() bin.Object { return &RecommendedChatFolders{} }, - ArchiveChatListSettingsTypeID: func() bin.Object { return &ArchiveChatListSettings{} }, - ChatListMainTypeID: func() bin.Object { return &ChatListMain{} }, - ChatListArchiveTypeID: func() bin.Object { return &ChatListArchive{} }, - ChatListFolderTypeID: func() bin.Object { return &ChatListFolder{} }, - ChatListsTypeID: func() bin.Object { return &ChatLists{} }, - ChatSourceMtprotoProxyTypeID: func() bin.Object { return &ChatSourceMtprotoProxy{} }, - ChatSourcePublicServiceAnnouncementTypeID: func() bin.Object { return &ChatSourcePublicServiceAnnouncement{} }, - ChatPositionTypeID: func() bin.Object { return &ChatPosition{} }, - ChatAvailableReactionsAllTypeID: func() bin.Object { return &ChatAvailableReactionsAll{} }, - ChatAvailableReactionsSomeTypeID: func() bin.Object { return &ChatAvailableReactionsSome{} }, - SavedMessagesTagTypeID: func() bin.Object { return &SavedMessagesTag{} }, - SavedMessagesTagsTypeID: func() bin.Object { return &SavedMessagesTags{} }, - BusinessBotManageBarTypeID: func() bin.Object { return &BusinessBotManageBar{} }, - VideoChatTypeID: func() bin.Object { return &VideoChat{} }, - ChatTypeID: func() bin.Object { return &Chat{} }, - ChatsTypeID: func() bin.Object { return &Chats{} }, - FailedToAddMemberTypeID: func() bin.Object { return &FailedToAddMember{} }, - FailedToAddMembersTypeID: func() bin.Object { return &FailedToAddMembers{} }, - CreatedBasicGroupChatTypeID: func() bin.Object { return &CreatedBasicGroupChat{} }, - PublicChatTypeHasUsernameTypeID: func() bin.Object { return &PublicChatTypeHasUsername{} }, - PublicChatTypeIsLocationBasedTypeID: func() bin.Object { return &PublicChatTypeIsLocationBased{} }, - ChatActionBarReportSpamTypeID: func() bin.Object { return &ChatActionBarReportSpam{} }, - ChatActionBarInviteMembersTypeID: func() bin.Object { return &ChatActionBarInviteMembers{} }, - ChatActionBarReportAddBlockTypeID: func() bin.Object { return &ChatActionBarReportAddBlock{} }, - ChatActionBarAddContactTypeID: func() bin.Object { return &ChatActionBarAddContact{} }, - ChatActionBarSharePhoneNumberTypeID: func() bin.Object { return &ChatActionBarSharePhoneNumber{} }, - ChatActionBarJoinRequestTypeID: func() bin.Object { return &ChatActionBarJoinRequest{} }, - KeyboardButtonTypeTextTypeID: func() bin.Object { return &KeyboardButtonTypeText{} }, - KeyboardButtonTypeRequestPhoneNumberTypeID: func() bin.Object { return &KeyboardButtonTypeRequestPhoneNumber{} }, - KeyboardButtonTypeRequestLocationTypeID: func() bin.Object { return &KeyboardButtonTypeRequestLocation{} }, - KeyboardButtonTypeRequestPollTypeID: func() bin.Object { return &KeyboardButtonTypeRequestPoll{} }, - KeyboardButtonTypeRequestUsersTypeID: func() bin.Object { return &KeyboardButtonTypeRequestUsers{} }, - KeyboardButtonTypeRequestChatTypeID: func() bin.Object { return &KeyboardButtonTypeRequestChat{} }, - KeyboardButtonTypeWebAppTypeID: func() bin.Object { return &KeyboardButtonTypeWebApp{} }, - KeyboardButtonTypeID: func() bin.Object { return &KeyboardButton{} }, - InlineKeyboardButtonTypeURLTypeID: func() bin.Object { return &InlineKeyboardButtonTypeURL{} }, - InlineKeyboardButtonTypeLoginURLTypeID: func() bin.Object { return &InlineKeyboardButtonTypeLoginURL{} }, - InlineKeyboardButtonTypeWebAppTypeID: func() bin.Object { return &InlineKeyboardButtonTypeWebApp{} }, - InlineKeyboardButtonTypeCallbackTypeID: func() bin.Object { return &InlineKeyboardButtonTypeCallback{} }, - InlineKeyboardButtonTypeCallbackWithPasswordTypeID: func() bin.Object { return &InlineKeyboardButtonTypeCallbackWithPassword{} }, - InlineKeyboardButtonTypeCallbackGameTypeID: func() bin.Object { return &InlineKeyboardButtonTypeCallbackGame{} }, - InlineKeyboardButtonTypeSwitchInlineTypeID: func() bin.Object { return &InlineKeyboardButtonTypeSwitchInline{} }, - InlineKeyboardButtonTypeBuyTypeID: func() bin.Object { return &InlineKeyboardButtonTypeBuy{} }, - InlineKeyboardButtonTypeUserTypeID: func() bin.Object { return &InlineKeyboardButtonTypeUser{} }, - InlineKeyboardButtonTypeCopyTextTypeID: func() bin.Object { return &InlineKeyboardButtonTypeCopyText{} }, - InlineKeyboardButtonTypeID: func() bin.Object { return &InlineKeyboardButton{} }, - ReplyMarkupRemoveKeyboardTypeID: func() bin.Object { return &ReplyMarkupRemoveKeyboard{} }, - ReplyMarkupForceReplyTypeID: func() bin.Object { return &ReplyMarkupForceReply{} }, - ReplyMarkupShowKeyboardTypeID: func() bin.Object { return &ReplyMarkupShowKeyboard{} }, - ReplyMarkupInlineKeyboardTypeID: func() bin.Object { return &ReplyMarkupInlineKeyboard{} }, - LoginURLInfoOpenTypeID: func() bin.Object { return &LoginURLInfoOpen{} }, - LoginURLInfoRequestConfirmationTypeID: func() bin.Object { return &LoginURLInfoRequestConfirmation{} }, - ThemeParametersTypeID: func() bin.Object { return &ThemeParameters{} }, - WebAppOpenModeCompactTypeID: func() bin.Object { return &WebAppOpenModeCompact{} }, - WebAppOpenModeFullSizeTypeID: func() bin.Object { return &WebAppOpenModeFullSize{} }, - WebAppOpenModeFullScreenTypeID: func() bin.Object { return &WebAppOpenModeFullScreen{} }, - FoundWebAppTypeID: func() bin.Object { return &FoundWebApp{} }, - WebAppInfoTypeID: func() bin.Object { return &WebAppInfo{} }, - MainWebAppTypeID: func() bin.Object { return &MainWebApp{} }, - WebAppOpenParametersTypeID: func() bin.Object { return &WebAppOpenParameters{} }, - MessageThreadInfoTypeID: func() bin.Object { return &MessageThreadInfo{} }, - SavedMessagesTopicTypeMyNotesTypeID: func() bin.Object { return &SavedMessagesTopicTypeMyNotes{} }, - SavedMessagesTopicTypeAuthorHiddenTypeID: func() bin.Object { return &SavedMessagesTopicTypeAuthorHidden{} }, - SavedMessagesTopicTypeSavedFromChatTypeID: func() bin.Object { return &SavedMessagesTopicTypeSavedFromChat{} }, - SavedMessagesTopicTypeID: func() bin.Object { return &SavedMessagesTopic{} }, - ForumTopicIconTypeID: func() bin.Object { return &ForumTopicIcon{} }, - ForumTopicInfoTypeID: func() bin.Object { return &ForumTopicInfo{} }, - ForumTopicTypeID: func() bin.Object { return &ForumTopic{} }, - ForumTopicsTypeID: func() bin.Object { return &ForumTopics{} }, - LinkPreviewOptionsTypeID: func() bin.Object { return &LinkPreviewOptions{} }, - SharedUserTypeID: func() bin.Object { return &SharedUser{} }, - SharedChatTypeID: func() bin.Object { return &SharedChat{} }, - ThemeSettingsTypeID: func() bin.Object { return &ThemeSettings{} }, - RichTextPlainTypeID: func() bin.Object { return &RichTextPlain{} }, - RichTextBoldTypeID: func() bin.Object { return &RichTextBold{} }, - RichTextItalicTypeID: func() bin.Object { return &RichTextItalic{} }, - RichTextUnderlineTypeID: func() bin.Object { return &RichTextUnderline{} }, - RichTextStrikethroughTypeID: func() bin.Object { return &RichTextStrikethrough{} }, - RichTextFixedTypeID: func() bin.Object { return &RichTextFixed{} }, - RichTextURLTypeID: func() bin.Object { return &RichTextURL{} }, - RichTextEmailAddressTypeID: func() bin.Object { return &RichTextEmailAddress{} }, - RichTextSubscriptTypeID: func() bin.Object { return &RichTextSubscript{} }, - RichTextSuperscriptTypeID: func() bin.Object { return &RichTextSuperscript{} }, - RichTextMarkedTypeID: func() bin.Object { return &RichTextMarked{} }, - RichTextPhoneNumberTypeID: func() bin.Object { return &RichTextPhoneNumber{} }, - RichTextIconTypeID: func() bin.Object { return &RichTextIcon{} }, - RichTextReferenceTypeID: func() bin.Object { return &RichTextReference{} }, - RichTextAnchorTypeID: func() bin.Object { return &RichTextAnchor{} }, - RichTextAnchorLinkTypeID: func() bin.Object { return &RichTextAnchorLink{} }, - RichTextsTypeID: func() bin.Object { return &RichTexts{} }, - PageBlockCaptionTypeID: func() bin.Object { return &PageBlockCaption{} }, - PageBlockListItemTypeID: func() bin.Object { return &PageBlockListItem{} }, - PageBlockHorizontalAlignmentLeftTypeID: func() bin.Object { return &PageBlockHorizontalAlignmentLeft{} }, - PageBlockHorizontalAlignmentCenterTypeID: func() bin.Object { return &PageBlockHorizontalAlignmentCenter{} }, - PageBlockHorizontalAlignmentRightTypeID: func() bin.Object { return &PageBlockHorizontalAlignmentRight{} }, - PageBlockVerticalAlignmentTopTypeID: func() bin.Object { return &PageBlockVerticalAlignmentTop{} }, - PageBlockVerticalAlignmentMiddleTypeID: func() bin.Object { return &PageBlockVerticalAlignmentMiddle{} }, - PageBlockVerticalAlignmentBottomTypeID: func() bin.Object { return &PageBlockVerticalAlignmentBottom{} }, - PageBlockTableCellTypeID: func() bin.Object { return &PageBlockTableCell{} }, - PageBlockRelatedArticleTypeID: func() bin.Object { return &PageBlockRelatedArticle{} }, - PageBlockTitleTypeID: func() bin.Object { return &PageBlockTitle{} }, - PageBlockSubtitleTypeID: func() bin.Object { return &PageBlockSubtitle{} }, - PageBlockAuthorDateTypeID: func() bin.Object { return &PageBlockAuthorDate{} }, - PageBlockHeaderTypeID: func() bin.Object { return &PageBlockHeader{} }, - PageBlockSubheaderTypeID: func() bin.Object { return &PageBlockSubheader{} }, - PageBlockKickerTypeID: func() bin.Object { return &PageBlockKicker{} }, - PageBlockParagraphTypeID: func() bin.Object { return &PageBlockParagraph{} }, - PageBlockPreformattedTypeID: func() bin.Object { return &PageBlockPreformatted{} }, - PageBlockFooterTypeID: func() bin.Object { return &PageBlockFooter{} }, - PageBlockDividerTypeID: func() bin.Object { return &PageBlockDivider{} }, - PageBlockAnchorTypeID: func() bin.Object { return &PageBlockAnchor{} }, - PageBlockListTypeID: func() bin.Object { return &PageBlockList{} }, - PageBlockBlockQuoteTypeID: func() bin.Object { return &PageBlockBlockQuote{} }, - PageBlockPullQuoteTypeID: func() bin.Object { return &PageBlockPullQuote{} }, - PageBlockAnimationTypeID: func() bin.Object { return &PageBlockAnimation{} }, - PageBlockAudioTypeID: func() bin.Object { return &PageBlockAudio{} }, - PageBlockPhotoTypeID: func() bin.Object { return &PageBlockPhoto{} }, - PageBlockVideoTypeID: func() bin.Object { return &PageBlockVideo{} }, - PageBlockVoiceNoteTypeID: func() bin.Object { return &PageBlockVoiceNote{} }, - PageBlockCoverTypeID: func() bin.Object { return &PageBlockCover{} }, - PageBlockEmbeddedTypeID: func() bin.Object { return &PageBlockEmbedded{} }, - PageBlockEmbeddedPostTypeID: func() bin.Object { return &PageBlockEmbeddedPost{} }, - PageBlockCollageTypeID: func() bin.Object { return &PageBlockCollage{} }, - PageBlockSlideshowTypeID: func() bin.Object { return &PageBlockSlideshow{} }, - PageBlockChatLinkTypeID: func() bin.Object { return &PageBlockChatLink{} }, - PageBlockTableTypeID: func() bin.Object { return &PageBlockTable{} }, - PageBlockDetailsTypeID: func() bin.Object { return &PageBlockDetails{} }, - PageBlockRelatedArticlesTypeID: func() bin.Object { return &PageBlockRelatedArticles{} }, - PageBlockMapTypeID: func() bin.Object { return &PageBlockMap{} }, - WebPageInstantViewTypeID: func() bin.Object { return &WebPageInstantView{} }, - LinkPreviewAlbumMediaPhotoTypeID: func() bin.Object { return &LinkPreviewAlbumMediaPhoto{} }, - LinkPreviewAlbumMediaVideoTypeID: func() bin.Object { return &LinkPreviewAlbumMediaVideo{} }, - LinkPreviewTypeAlbumTypeID: func() bin.Object { return &LinkPreviewTypeAlbum{} }, - LinkPreviewTypeAnimationTypeID: func() bin.Object { return &LinkPreviewTypeAnimation{} }, - LinkPreviewTypeAppTypeID: func() bin.Object { return &LinkPreviewTypeApp{} }, - LinkPreviewTypeArticleTypeID: func() bin.Object { return &LinkPreviewTypeArticle{} }, - LinkPreviewTypeAudioTypeID: func() bin.Object { return &LinkPreviewTypeAudio{} }, - LinkPreviewTypeBackgroundTypeID: func() bin.Object { return &LinkPreviewTypeBackground{} }, - LinkPreviewTypeChannelBoostTypeID: func() bin.Object { return &LinkPreviewTypeChannelBoost{} }, - LinkPreviewTypeChatTypeID: func() bin.Object { return &LinkPreviewTypeChat{} }, - LinkPreviewTypeDocumentTypeID: func() bin.Object { return &LinkPreviewTypeDocument{} }, - LinkPreviewTypeEmbeddedAnimationPlayerTypeID: func() bin.Object { return &LinkPreviewTypeEmbeddedAnimationPlayer{} }, - LinkPreviewTypeEmbeddedAudioPlayerTypeID: func() bin.Object { return &LinkPreviewTypeEmbeddedAudioPlayer{} }, - LinkPreviewTypeEmbeddedVideoPlayerTypeID: func() bin.Object { return &LinkPreviewTypeEmbeddedVideoPlayer{} }, - LinkPreviewTypeExternalAudioTypeID: func() bin.Object { return &LinkPreviewTypeExternalAudio{} }, - LinkPreviewTypeExternalVideoTypeID: func() bin.Object { return &LinkPreviewTypeExternalVideo{} }, - LinkPreviewTypeInvoiceTypeID: func() bin.Object { return &LinkPreviewTypeInvoice{} }, - LinkPreviewTypeMessageTypeID: func() bin.Object { return &LinkPreviewTypeMessage{} }, - LinkPreviewTypePhotoTypeID: func() bin.Object { return &LinkPreviewTypePhoto{} }, - LinkPreviewTypePremiumGiftCodeTypeID: func() bin.Object { return &LinkPreviewTypePremiumGiftCode{} }, - LinkPreviewTypeShareableChatFolderTypeID: func() bin.Object { return &LinkPreviewTypeShareableChatFolder{} }, - LinkPreviewTypeStickerTypeID: func() bin.Object { return &LinkPreviewTypeSticker{} }, - LinkPreviewTypeStickerSetTypeID: func() bin.Object { return &LinkPreviewTypeStickerSet{} }, - LinkPreviewTypeStoryTypeID: func() bin.Object { return &LinkPreviewTypeStory{} }, - LinkPreviewTypeSupergroupBoostTypeID: func() bin.Object { return &LinkPreviewTypeSupergroupBoost{} }, - LinkPreviewTypeThemeTypeID: func() bin.Object { return &LinkPreviewTypeTheme{} }, - LinkPreviewTypeUnsupportedTypeID: func() bin.Object { return &LinkPreviewTypeUnsupported{} }, - LinkPreviewTypeUserTypeID: func() bin.Object { return &LinkPreviewTypeUser{} }, - LinkPreviewTypeVideoTypeID: func() bin.Object { return &LinkPreviewTypeVideo{} }, - LinkPreviewTypeVideoChatTypeID: func() bin.Object { return &LinkPreviewTypeVideoChat{} }, - LinkPreviewTypeVideoNoteTypeID: func() bin.Object { return &LinkPreviewTypeVideoNote{} }, - LinkPreviewTypeVoiceNoteTypeID: func() bin.Object { return &LinkPreviewTypeVoiceNote{} }, - LinkPreviewTypeWebAppTypeID: func() bin.Object { return &LinkPreviewTypeWebApp{} }, - LinkPreviewTypeID: func() bin.Object { return &LinkPreview{} }, - CountryInfoTypeID: func() bin.Object { return &CountryInfo{} }, - CountriesTypeID: func() bin.Object { return &Countries{} }, - PhoneNumberInfoTypeID: func() bin.Object { return &PhoneNumberInfo{} }, - CollectibleItemTypeUsernameTypeID: func() bin.Object { return &CollectibleItemTypeUsername{} }, - CollectibleItemTypePhoneNumberTypeID: func() bin.Object { return &CollectibleItemTypePhoneNumber{} }, - CollectibleItemInfoTypeID: func() bin.Object { return &CollectibleItemInfo{} }, - BankCardActionOpenURLTypeID: func() bin.Object { return &BankCardActionOpenURL{} }, - BankCardInfoTypeID: func() bin.Object { return &BankCardInfo{} }, - AddressTypeID: func() bin.Object { return &Address{} }, - LocationAddressTypeID: func() bin.Object { return &LocationAddress{} }, - LabeledPricePartTypeID: func() bin.Object { return &LabeledPricePart{} }, - InvoiceTypeID: func() bin.Object { return &Invoice{} }, - OrderInfoTypeID: func() bin.Object { return &OrderInfo{} }, - ShippingOptionTypeID: func() bin.Object { return &ShippingOption{} }, - SavedCredentialsTypeID: func() bin.Object { return &SavedCredentials{} }, - InputCredentialsSavedTypeID: func() bin.Object { return &InputCredentialsSaved{} }, - InputCredentialsNewTypeID: func() bin.Object { return &InputCredentialsNew{} }, - InputCredentialsApplePayTypeID: func() bin.Object { return &InputCredentialsApplePay{} }, - InputCredentialsGooglePayTypeID: func() bin.Object { return &InputCredentialsGooglePay{} }, - PaymentProviderSmartGlocalTypeID: func() bin.Object { return &PaymentProviderSmartGlocal{} }, - PaymentProviderStripeTypeID: func() bin.Object { return &PaymentProviderStripe{} }, - PaymentProviderOtherTypeID: func() bin.Object { return &PaymentProviderOther{} }, - PaymentOptionTypeID: func() bin.Object { return &PaymentOption{} }, - PaymentFormTypeRegularTypeID: func() bin.Object { return &PaymentFormTypeRegular{} }, - PaymentFormTypeStarsTypeID: func() bin.Object { return &PaymentFormTypeStars{} }, - PaymentFormTypeStarSubscriptionTypeID: func() bin.Object { return &PaymentFormTypeStarSubscription{} }, - PaymentFormTypeID: func() bin.Object { return &PaymentForm{} }, - ValidatedOrderInfoTypeID: func() bin.Object { return &ValidatedOrderInfo{} }, - PaymentResultTypeID: func() bin.Object { return &PaymentResult{} }, - PaymentReceiptTypeRegularTypeID: func() bin.Object { return &PaymentReceiptTypeRegular{} }, - PaymentReceiptTypeStarsTypeID: func() bin.Object { return &PaymentReceiptTypeStars{} }, - PaymentReceiptTypeID: func() bin.Object { return &PaymentReceipt{} }, - InputInvoiceMessageTypeID: func() bin.Object { return &InputInvoiceMessage{} }, - InputInvoiceNameTypeID: func() bin.Object { return &InputInvoiceName{} }, - InputInvoiceTelegramTypeID: func() bin.Object { return &InputInvoiceTelegram{} }, - PaidMediaPreviewTypeID: func() bin.Object { return &PaidMediaPreview{} }, - PaidMediaPhotoTypeID: func() bin.Object { return &PaidMediaPhoto{} }, - PaidMediaVideoTypeID: func() bin.Object { return &PaidMediaVideo{} }, - PaidMediaUnsupportedTypeID: func() bin.Object { return &PaidMediaUnsupported{} }, - GiveawayParametersTypeID: func() bin.Object { return &GiveawayParameters{} }, - DatedFileTypeID: func() bin.Object { return &DatedFile{} }, - PassportElementTypePersonalDetailsTypeID: func() bin.Object { return &PassportElementTypePersonalDetails{} }, - PassportElementTypePassportTypeID: func() bin.Object { return &PassportElementTypePassport{} }, - PassportElementTypeDriverLicenseTypeID: func() bin.Object { return &PassportElementTypeDriverLicense{} }, - PassportElementTypeIdentityCardTypeID: func() bin.Object { return &PassportElementTypeIdentityCard{} }, - PassportElementTypeInternalPassportTypeID: func() bin.Object { return &PassportElementTypeInternalPassport{} }, - PassportElementTypeAddressTypeID: func() bin.Object { return &PassportElementTypeAddress{} }, - PassportElementTypeUtilityBillTypeID: func() bin.Object { return &PassportElementTypeUtilityBill{} }, - PassportElementTypeBankStatementTypeID: func() bin.Object { return &PassportElementTypeBankStatement{} }, - PassportElementTypeRentalAgreementTypeID: func() bin.Object { return &PassportElementTypeRentalAgreement{} }, - PassportElementTypePassportRegistrationTypeID: func() bin.Object { return &PassportElementTypePassportRegistration{} }, - PassportElementTypeTemporaryRegistrationTypeID: func() bin.Object { return &PassportElementTypeTemporaryRegistration{} }, - PassportElementTypePhoneNumberTypeID: func() bin.Object { return &PassportElementTypePhoneNumber{} }, - PassportElementTypeEmailAddressTypeID: func() bin.Object { return &PassportElementTypeEmailAddress{} }, - DateTypeID: func() bin.Object { return &Date{} }, - PersonalDetailsTypeID: func() bin.Object { return &PersonalDetails{} }, - IdentityDocumentTypeID: func() bin.Object { return &IdentityDocument{} }, - InputIdentityDocumentTypeID: func() bin.Object { return &InputIdentityDocument{} }, - PersonalDocumentTypeID: func() bin.Object { return &PersonalDocument{} }, - InputPersonalDocumentTypeID: func() bin.Object { return &InputPersonalDocument{} }, - PassportElementPersonalDetailsTypeID: func() bin.Object { return &PassportElementPersonalDetails{} }, - PassportElementPassportTypeID: func() bin.Object { return &PassportElementPassport{} }, - PassportElementDriverLicenseTypeID: func() bin.Object { return &PassportElementDriverLicense{} }, - PassportElementIdentityCardTypeID: func() bin.Object { return &PassportElementIdentityCard{} }, - PassportElementInternalPassportTypeID: func() bin.Object { return &PassportElementInternalPassport{} }, - PassportElementAddressTypeID: func() bin.Object { return &PassportElementAddress{} }, - PassportElementUtilityBillTypeID: func() bin.Object { return &PassportElementUtilityBill{} }, - PassportElementBankStatementTypeID: func() bin.Object { return &PassportElementBankStatement{} }, - PassportElementRentalAgreementTypeID: func() bin.Object { return &PassportElementRentalAgreement{} }, - PassportElementPassportRegistrationTypeID: func() bin.Object { return &PassportElementPassportRegistration{} }, - PassportElementTemporaryRegistrationTypeID: func() bin.Object { return &PassportElementTemporaryRegistration{} }, - PassportElementPhoneNumberTypeID: func() bin.Object { return &PassportElementPhoneNumber{} }, - PassportElementEmailAddressTypeID: func() bin.Object { return &PassportElementEmailAddress{} }, - InputPassportElementPersonalDetailsTypeID: func() bin.Object { return &InputPassportElementPersonalDetails{} }, - InputPassportElementPassportTypeID: func() bin.Object { return &InputPassportElementPassport{} }, - InputPassportElementDriverLicenseTypeID: func() bin.Object { return &InputPassportElementDriverLicense{} }, - InputPassportElementIdentityCardTypeID: func() bin.Object { return &InputPassportElementIdentityCard{} }, - InputPassportElementInternalPassportTypeID: func() bin.Object { return &InputPassportElementInternalPassport{} }, - InputPassportElementAddressTypeID: func() bin.Object { return &InputPassportElementAddress{} }, - InputPassportElementUtilityBillTypeID: func() bin.Object { return &InputPassportElementUtilityBill{} }, - InputPassportElementBankStatementTypeID: func() bin.Object { return &InputPassportElementBankStatement{} }, - InputPassportElementRentalAgreementTypeID: func() bin.Object { return &InputPassportElementRentalAgreement{} }, - InputPassportElementPassportRegistrationTypeID: func() bin.Object { return &InputPassportElementPassportRegistration{} }, - InputPassportElementTemporaryRegistrationTypeID: func() bin.Object { return &InputPassportElementTemporaryRegistration{} }, - InputPassportElementPhoneNumberTypeID: func() bin.Object { return &InputPassportElementPhoneNumber{} }, - InputPassportElementEmailAddressTypeID: func() bin.Object { return &InputPassportElementEmailAddress{} }, - PassportElementsTypeID: func() bin.Object { return &PassportElements{} }, - PassportElementErrorSourceUnspecifiedTypeID: func() bin.Object { return &PassportElementErrorSourceUnspecified{} }, - PassportElementErrorSourceDataFieldTypeID: func() bin.Object { return &PassportElementErrorSourceDataField{} }, - PassportElementErrorSourceFrontSideTypeID: func() bin.Object { return &PassportElementErrorSourceFrontSide{} }, - PassportElementErrorSourceReverseSideTypeID: func() bin.Object { return &PassportElementErrorSourceReverseSide{} }, - PassportElementErrorSourceSelfieTypeID: func() bin.Object { return &PassportElementErrorSourceSelfie{} }, - PassportElementErrorSourceTranslationFileTypeID: func() bin.Object { return &PassportElementErrorSourceTranslationFile{} }, - PassportElementErrorSourceTranslationFilesTypeID: func() bin.Object { return &PassportElementErrorSourceTranslationFiles{} }, - PassportElementErrorSourceFileTypeID: func() bin.Object { return &PassportElementErrorSourceFile{} }, - PassportElementErrorSourceFilesTypeID: func() bin.Object { return &PassportElementErrorSourceFiles{} }, - PassportElementErrorTypeID: func() bin.Object { return &PassportElementError{} }, - PassportSuitableElementTypeID: func() bin.Object { return &PassportSuitableElement{} }, - PassportRequiredElementTypeID: func() bin.Object { return &PassportRequiredElement{} }, - PassportAuthorizationFormTypeID: func() bin.Object { return &PassportAuthorizationForm{} }, - PassportElementsWithErrorsTypeID: func() bin.Object { return &PassportElementsWithErrors{} }, - EncryptedCredentialsTypeID: func() bin.Object { return &EncryptedCredentials{} }, - EncryptedPassportElementTypeID: func() bin.Object { return &EncryptedPassportElement{} }, - InputPassportElementErrorSourceUnspecifiedTypeID: func() bin.Object { return &InputPassportElementErrorSourceUnspecified{} }, - InputPassportElementErrorSourceDataFieldTypeID: func() bin.Object { return &InputPassportElementErrorSourceDataField{} }, - InputPassportElementErrorSourceFrontSideTypeID: func() bin.Object { return &InputPassportElementErrorSourceFrontSide{} }, - InputPassportElementErrorSourceReverseSideTypeID: func() bin.Object { return &InputPassportElementErrorSourceReverseSide{} }, - InputPassportElementErrorSourceSelfieTypeID: func() bin.Object { return &InputPassportElementErrorSourceSelfie{} }, - InputPassportElementErrorSourceTranslationFileTypeID: func() bin.Object { return &InputPassportElementErrorSourceTranslationFile{} }, - InputPassportElementErrorSourceTranslationFilesTypeID: func() bin.Object { return &InputPassportElementErrorSourceTranslationFiles{} }, - InputPassportElementErrorSourceFileTypeID: func() bin.Object { return &InputPassportElementErrorSourceFile{} }, - InputPassportElementErrorSourceFilesTypeID: func() bin.Object { return &InputPassportElementErrorSourceFiles{} }, - InputPassportElementErrorTypeID: func() bin.Object { return &InputPassportElementError{} }, - MessageTextTypeID: func() bin.Object { return &MessageText{} }, - MessageAnimationTypeID: func() bin.Object { return &MessageAnimation{} }, - MessageAudioTypeID: func() bin.Object { return &MessageAudio{} }, - MessageDocumentTypeID: func() bin.Object { return &MessageDocument{} }, - MessagePaidMediaTypeID: func() bin.Object { return &MessagePaidMedia{} }, - MessagePhotoTypeID: func() bin.Object { return &MessagePhoto{} }, - MessageStickerTypeID: func() bin.Object { return &MessageSticker{} }, - MessageVideoTypeID: func() bin.Object { return &MessageVideo{} }, - MessageVideoNoteTypeID: func() bin.Object { return &MessageVideoNote{} }, - MessageVoiceNoteTypeID: func() bin.Object { return &MessageVoiceNote{} }, - MessageExpiredPhotoTypeID: func() bin.Object { return &MessageExpiredPhoto{} }, - MessageExpiredVideoTypeID: func() bin.Object { return &MessageExpiredVideo{} }, - MessageExpiredVideoNoteTypeID: func() bin.Object { return &MessageExpiredVideoNote{} }, - MessageExpiredVoiceNoteTypeID: func() bin.Object { return &MessageExpiredVoiceNote{} }, - MessageLocationTypeID: func() bin.Object { return &MessageLocation{} }, - MessageVenueTypeID: func() bin.Object { return &MessageVenue{} }, - MessageContactTypeID: func() bin.Object { return &MessageContact{} }, - MessageAnimatedEmojiTypeID: func() bin.Object { return &MessageAnimatedEmoji{} }, - MessageDiceTypeID: func() bin.Object { return &MessageDice{} }, - MessageGameTypeID: func() bin.Object { return &MessageGame{} }, - MessagePollTypeID: func() bin.Object { return &MessagePoll{} }, - MessageStoryTypeID: func() bin.Object { return &MessageStory{} }, - MessageInvoiceTypeID: func() bin.Object { return &MessageInvoice{} }, - MessageCallTypeID: func() bin.Object { return &MessageCall{} }, - MessageVideoChatScheduledTypeID: func() bin.Object { return &MessageVideoChatScheduled{} }, - MessageVideoChatStartedTypeID: func() bin.Object { return &MessageVideoChatStarted{} }, - MessageVideoChatEndedTypeID: func() bin.Object { return &MessageVideoChatEnded{} }, - MessageInviteVideoChatParticipantsTypeID: func() bin.Object { return &MessageInviteVideoChatParticipants{} }, - MessageBasicGroupChatCreateTypeID: func() bin.Object { return &MessageBasicGroupChatCreate{} }, - MessageSupergroupChatCreateTypeID: func() bin.Object { return &MessageSupergroupChatCreate{} }, - MessageChatChangeTitleTypeID: func() bin.Object { return &MessageChatChangeTitle{} }, - MessageChatChangePhotoTypeID: func() bin.Object { return &MessageChatChangePhoto{} }, - MessageChatDeletePhotoTypeID: func() bin.Object { return &MessageChatDeletePhoto{} }, - MessageChatAddMembersTypeID: func() bin.Object { return &MessageChatAddMembers{} }, - MessageChatJoinByLinkTypeID: func() bin.Object { return &MessageChatJoinByLink{} }, - MessageChatJoinByRequestTypeID: func() bin.Object { return &MessageChatJoinByRequest{} }, - MessageChatDeleteMemberTypeID: func() bin.Object { return &MessageChatDeleteMember{} }, - MessageChatUpgradeToTypeID: func() bin.Object { return &MessageChatUpgradeTo{} }, - MessageChatUpgradeFromTypeID: func() bin.Object { return &MessageChatUpgradeFrom{} }, - MessagePinMessageTypeID: func() bin.Object { return &MessagePinMessage{} }, - MessageScreenshotTakenTypeID: func() bin.Object { return &MessageScreenshotTaken{} }, - MessageChatSetBackgroundTypeID: func() bin.Object { return &MessageChatSetBackground{} }, - MessageChatSetThemeTypeID: func() bin.Object { return &MessageChatSetTheme{} }, - MessageChatSetMessageAutoDeleteTimeTypeID: func() bin.Object { return &MessageChatSetMessageAutoDeleteTime{} }, - MessageChatBoostTypeID: func() bin.Object { return &MessageChatBoost{} }, - MessageForumTopicCreatedTypeID: func() bin.Object { return &MessageForumTopicCreated{} }, - MessageForumTopicEditedTypeID: func() bin.Object { return &MessageForumTopicEdited{} }, - MessageForumTopicIsClosedToggledTypeID: func() bin.Object { return &MessageForumTopicIsClosedToggled{} }, - MessageForumTopicIsHiddenToggledTypeID: func() bin.Object { return &MessageForumTopicIsHiddenToggled{} }, - MessageSuggestProfilePhotoTypeID: func() bin.Object { return &MessageSuggestProfilePhoto{} }, - MessageCustomServiceActionTypeID: func() bin.Object { return &MessageCustomServiceAction{} }, - MessageGameScoreTypeID: func() bin.Object { return &MessageGameScore{} }, - MessagePaymentSuccessfulTypeID: func() bin.Object { return &MessagePaymentSuccessful{} }, - MessagePaymentSuccessfulBotTypeID: func() bin.Object { return &MessagePaymentSuccessfulBot{} }, - MessagePaymentRefundedTypeID: func() bin.Object { return &MessagePaymentRefunded{} }, - MessageGiftedPremiumTypeID: func() bin.Object { return &MessageGiftedPremium{} }, - MessagePremiumGiftCodeTypeID: func() bin.Object { return &MessagePremiumGiftCode{} }, - MessageGiveawayCreatedTypeID: func() bin.Object { return &MessageGiveawayCreated{} }, - MessageGiveawayTypeID: func() bin.Object { return &MessageGiveaway{} }, - MessageGiveawayCompletedTypeID: func() bin.Object { return &MessageGiveawayCompleted{} }, - MessageGiveawayWinnersTypeID: func() bin.Object { return &MessageGiveawayWinners{} }, - MessageGiftedStarsTypeID: func() bin.Object { return &MessageGiftedStars{} }, - MessageGiveawayPrizeStarsTypeID: func() bin.Object { return &MessageGiveawayPrizeStars{} }, - MessageGiftTypeID: func() bin.Object { return &MessageGift{} }, - MessageUpgradedGiftTypeID: func() bin.Object { return &MessageUpgradedGift{} }, - MessageRefundedUpgradedGiftTypeID: func() bin.Object { return &MessageRefundedUpgradedGift{} }, - MessageContactRegisteredTypeID: func() bin.Object { return &MessageContactRegistered{} }, - MessageUsersSharedTypeID: func() bin.Object { return &MessageUsersShared{} }, - MessageChatSharedTypeID: func() bin.Object { return &MessageChatShared{} }, - MessageBotWriteAccessAllowedTypeID: func() bin.Object { return &MessageBotWriteAccessAllowed{} }, - MessageWebAppDataSentTypeID: func() bin.Object { return &MessageWebAppDataSent{} }, - MessageWebAppDataReceivedTypeID: func() bin.Object { return &MessageWebAppDataReceived{} }, - MessagePassportDataSentTypeID: func() bin.Object { return &MessagePassportDataSent{} }, - MessagePassportDataReceivedTypeID: func() bin.Object { return &MessagePassportDataReceived{} }, - MessageProximityAlertTriggeredTypeID: func() bin.Object { return &MessageProximityAlertTriggered{} }, - MessageUnsupportedTypeID: func() bin.Object { return &MessageUnsupported{} }, - TextEntityTypeMentionTypeID: func() bin.Object { return &TextEntityTypeMention{} }, - TextEntityTypeHashtagTypeID: func() bin.Object { return &TextEntityTypeHashtag{} }, - TextEntityTypeCashtagTypeID: func() bin.Object { return &TextEntityTypeCashtag{} }, - TextEntityTypeBotCommandTypeID: func() bin.Object { return &TextEntityTypeBotCommand{} }, - TextEntityTypeURLTypeID: func() bin.Object { return &TextEntityTypeURL{} }, - TextEntityTypeEmailAddressTypeID: func() bin.Object { return &TextEntityTypeEmailAddress{} }, - TextEntityTypePhoneNumberTypeID: func() bin.Object { return &TextEntityTypePhoneNumber{} }, - TextEntityTypeBankCardNumberTypeID: func() bin.Object { return &TextEntityTypeBankCardNumber{} }, - TextEntityTypeBoldTypeID: func() bin.Object { return &TextEntityTypeBold{} }, - TextEntityTypeItalicTypeID: func() bin.Object { return &TextEntityTypeItalic{} }, - TextEntityTypeUnderlineTypeID: func() bin.Object { return &TextEntityTypeUnderline{} }, - TextEntityTypeStrikethroughTypeID: func() bin.Object { return &TextEntityTypeStrikethrough{} }, - TextEntityTypeSpoilerTypeID: func() bin.Object { return &TextEntityTypeSpoiler{} }, - TextEntityTypeCodeTypeID: func() bin.Object { return &TextEntityTypeCode{} }, - TextEntityTypePreTypeID: func() bin.Object { return &TextEntityTypePre{} }, - TextEntityTypePreCodeTypeID: func() bin.Object { return &TextEntityTypePreCode{} }, - TextEntityTypeBlockQuoteTypeID: func() bin.Object { return &TextEntityTypeBlockQuote{} }, - TextEntityTypeExpandableBlockQuoteTypeID: func() bin.Object { return &TextEntityTypeExpandableBlockQuote{} }, - TextEntityTypeTextURLTypeID: func() bin.Object { return &TextEntityTypeTextURL{} }, - TextEntityTypeMentionNameTypeID: func() bin.Object { return &TextEntityTypeMentionName{} }, - TextEntityTypeCustomEmojiTypeID: func() bin.Object { return &TextEntityTypeCustomEmoji{} }, - TextEntityTypeMediaTimestampTypeID: func() bin.Object { return &TextEntityTypeMediaTimestamp{} }, - InputThumbnailTypeID: func() bin.Object { return &InputThumbnail{} }, - InputPaidMediaTypePhotoTypeID: func() bin.Object { return &InputPaidMediaTypePhoto{} }, - InputPaidMediaTypeVideoTypeID: func() bin.Object { return &InputPaidMediaTypeVideo{} }, - InputPaidMediaTypeID: func() bin.Object { return &InputPaidMedia{} }, - MessageSchedulingStateSendAtDateTypeID: func() bin.Object { return &MessageSchedulingStateSendAtDate{} }, - MessageSchedulingStateSendWhenOnlineTypeID: func() bin.Object { return &MessageSchedulingStateSendWhenOnline{} }, - MessageSchedulingStateSendWhenVideoProcessedTypeID: func() bin.Object { return &MessageSchedulingStateSendWhenVideoProcessed{} }, - MessageSelfDestructTypeTimerTypeID: func() bin.Object { return &MessageSelfDestructTypeTimer{} }, - MessageSelfDestructTypeImmediatelyTypeID: func() bin.Object { return &MessageSelfDestructTypeImmediately{} }, - MessageSendOptionsTypeID: func() bin.Object { return &MessageSendOptions{} }, - MessageCopyOptionsTypeID: func() bin.Object { return &MessageCopyOptions{} }, - InputMessageTextTypeID: func() bin.Object { return &InputMessageText{} }, - InputMessageAnimationTypeID: func() bin.Object { return &InputMessageAnimation{} }, - InputMessageAudioTypeID: func() bin.Object { return &InputMessageAudio{} }, - InputMessageDocumentTypeID: func() bin.Object { return &InputMessageDocument{} }, - InputMessagePaidMediaTypeID: func() bin.Object { return &InputMessagePaidMedia{} }, - InputMessagePhotoTypeID: func() bin.Object { return &InputMessagePhoto{} }, - InputMessageStickerTypeID: func() bin.Object { return &InputMessageSticker{} }, - InputMessageVideoTypeID: func() bin.Object { return &InputMessageVideo{} }, - InputMessageVideoNoteTypeID: func() bin.Object { return &InputMessageVideoNote{} }, - InputMessageVoiceNoteTypeID: func() bin.Object { return &InputMessageVoiceNote{} }, - InputMessageLocationTypeID: func() bin.Object { return &InputMessageLocation{} }, - InputMessageVenueTypeID: func() bin.Object { return &InputMessageVenue{} }, - InputMessageContactTypeID: func() bin.Object { return &InputMessageContact{} }, - InputMessageDiceTypeID: func() bin.Object { return &InputMessageDice{} }, - InputMessageGameTypeID: func() bin.Object { return &InputMessageGame{} }, - InputMessageInvoiceTypeID: func() bin.Object { return &InputMessageInvoice{} }, - InputMessagePollTypeID: func() bin.Object { return &InputMessagePoll{} }, - InputMessageStoryTypeID: func() bin.Object { return &InputMessageStory{} }, - InputMessageForwardedTypeID: func() bin.Object { return &InputMessageForwarded{} }, - MessagePropertiesTypeID: func() bin.Object { return &MessageProperties{} }, - SearchMessagesFilterEmptyTypeID: func() bin.Object { return &SearchMessagesFilterEmpty{} }, - SearchMessagesFilterAnimationTypeID: func() bin.Object { return &SearchMessagesFilterAnimation{} }, - SearchMessagesFilterAudioTypeID: func() bin.Object { return &SearchMessagesFilterAudio{} }, - SearchMessagesFilterDocumentTypeID: func() bin.Object { return &SearchMessagesFilterDocument{} }, - SearchMessagesFilterPhotoTypeID: func() bin.Object { return &SearchMessagesFilterPhoto{} }, - SearchMessagesFilterVideoTypeID: func() bin.Object { return &SearchMessagesFilterVideo{} }, - SearchMessagesFilterVoiceNoteTypeID: func() bin.Object { return &SearchMessagesFilterVoiceNote{} }, - SearchMessagesFilterPhotoAndVideoTypeID: func() bin.Object { return &SearchMessagesFilterPhotoAndVideo{} }, - SearchMessagesFilterURLTypeID: func() bin.Object { return &SearchMessagesFilterURL{} }, - SearchMessagesFilterChatPhotoTypeID: func() bin.Object { return &SearchMessagesFilterChatPhoto{} }, - SearchMessagesFilterVideoNoteTypeID: func() bin.Object { return &SearchMessagesFilterVideoNote{} }, - SearchMessagesFilterVoiceAndVideoNoteTypeID: func() bin.Object { return &SearchMessagesFilterVoiceAndVideoNote{} }, - SearchMessagesFilterMentionTypeID: func() bin.Object { return &SearchMessagesFilterMention{} }, - SearchMessagesFilterUnreadMentionTypeID: func() bin.Object { return &SearchMessagesFilterUnreadMention{} }, - SearchMessagesFilterUnreadReactionTypeID: func() bin.Object { return &SearchMessagesFilterUnreadReaction{} }, - SearchMessagesFilterFailedToSendTypeID: func() bin.Object { return &SearchMessagesFilterFailedToSend{} }, - SearchMessagesFilterPinnedTypeID: func() bin.Object { return &SearchMessagesFilterPinned{} }, - SearchMessagesChatTypeFilterPrivateTypeID: func() bin.Object { return &SearchMessagesChatTypeFilterPrivate{} }, - SearchMessagesChatTypeFilterGroupTypeID: func() bin.Object { return &SearchMessagesChatTypeFilterGroup{} }, - SearchMessagesChatTypeFilterChannelTypeID: func() bin.Object { return &SearchMessagesChatTypeFilterChannel{} }, - ChatActionTypingTypeID: func() bin.Object { return &ChatActionTyping{} }, - ChatActionRecordingVideoTypeID: func() bin.Object { return &ChatActionRecordingVideo{} }, - ChatActionUploadingVideoTypeID: func() bin.Object { return &ChatActionUploadingVideo{} }, - ChatActionRecordingVoiceNoteTypeID: func() bin.Object { return &ChatActionRecordingVoiceNote{} }, - ChatActionUploadingVoiceNoteTypeID: func() bin.Object { return &ChatActionUploadingVoiceNote{} }, - ChatActionUploadingPhotoTypeID: func() bin.Object { return &ChatActionUploadingPhoto{} }, - ChatActionUploadingDocumentTypeID: func() bin.Object { return &ChatActionUploadingDocument{} }, - ChatActionChoosingStickerTypeID: func() bin.Object { return &ChatActionChoosingSticker{} }, - ChatActionChoosingLocationTypeID: func() bin.Object { return &ChatActionChoosingLocation{} }, - ChatActionChoosingContactTypeID: func() bin.Object { return &ChatActionChoosingContact{} }, - ChatActionStartPlayingGameTypeID: func() bin.Object { return &ChatActionStartPlayingGame{} }, - ChatActionRecordingVideoNoteTypeID: func() bin.Object { return &ChatActionRecordingVideoNote{} }, - ChatActionUploadingVideoNoteTypeID: func() bin.Object { return &ChatActionUploadingVideoNote{} }, - ChatActionWatchingAnimationsTypeID: func() bin.Object { return &ChatActionWatchingAnimations{} }, - ChatActionCancelTypeID: func() bin.Object { return &ChatActionCancel{} }, - UserStatusEmptyTypeID: func() bin.Object { return &UserStatusEmpty{} }, - UserStatusOnlineTypeID: func() bin.Object { return &UserStatusOnline{} }, - UserStatusOfflineTypeID: func() bin.Object { return &UserStatusOffline{} }, - UserStatusRecentlyTypeID: func() bin.Object { return &UserStatusRecently{} }, - UserStatusLastWeekTypeID: func() bin.Object { return &UserStatusLastWeek{} }, - UserStatusLastMonthTypeID: func() bin.Object { return &UserStatusLastMonth{} }, - EmojiKeywordTypeID: func() bin.Object { return &EmojiKeyword{} }, - EmojiKeywordsTypeID: func() bin.Object { return &EmojiKeywords{} }, - StickersTypeID: func() bin.Object { return &Stickers{} }, - EmojisTypeID: func() bin.Object { return &Emojis{} }, - StickerSetTypeID: func() bin.Object { return &StickerSet{} }, - StickerSetInfoTypeID: func() bin.Object { return &StickerSetInfo{} }, - StickerSetsTypeID: func() bin.Object { return &StickerSets{} }, - TrendingStickerSetsTypeID: func() bin.Object { return &TrendingStickerSets{} }, - EmojiCategorySourceSearchTypeID: func() bin.Object { return &EmojiCategorySourceSearch{} }, - EmojiCategorySourcePremiumTypeID: func() bin.Object { return &EmojiCategorySourcePremium{} }, - EmojiCategoryTypeID: func() bin.Object { return &EmojiCategory{} }, - EmojiCategoriesTypeID: func() bin.Object { return &EmojiCategories{} }, - EmojiCategoryTypeDefaultTypeID: func() bin.Object { return &EmojiCategoryTypeDefault{} }, - EmojiCategoryTypeRegularStickersTypeID: func() bin.Object { return &EmojiCategoryTypeRegularStickers{} }, - EmojiCategoryTypeEmojiStatusTypeID: func() bin.Object { return &EmojiCategoryTypeEmojiStatus{} }, - EmojiCategoryTypeChatPhotoTypeID: func() bin.Object { return &EmojiCategoryTypeChatPhoto{} }, - CurrentWeatherTypeID: func() bin.Object { return &CurrentWeather{} }, - StoryAreaPositionTypeID: func() bin.Object { return &StoryAreaPosition{} }, - StoryAreaTypeLocationTypeID: func() bin.Object { return &StoryAreaTypeLocation{} }, - StoryAreaTypeVenueTypeID: func() bin.Object { return &StoryAreaTypeVenue{} }, - StoryAreaTypeSuggestedReactionTypeID: func() bin.Object { return &StoryAreaTypeSuggestedReaction{} }, - StoryAreaTypeMessageTypeID: func() bin.Object { return &StoryAreaTypeMessage{} }, - StoryAreaTypeLinkTypeID: func() bin.Object { return &StoryAreaTypeLink{} }, - StoryAreaTypeWeatherTypeID: func() bin.Object { return &StoryAreaTypeWeather{} }, - StoryAreaTypeID: func() bin.Object { return &StoryArea{} }, - InputStoryAreaTypeLocationTypeID: func() bin.Object { return &InputStoryAreaTypeLocation{} }, - InputStoryAreaTypeFoundVenueTypeID: func() bin.Object { return &InputStoryAreaTypeFoundVenue{} }, - InputStoryAreaTypePreviousVenueTypeID: func() bin.Object { return &InputStoryAreaTypePreviousVenue{} }, - InputStoryAreaTypeSuggestedReactionTypeID: func() bin.Object { return &InputStoryAreaTypeSuggestedReaction{} }, - InputStoryAreaTypeMessageTypeID: func() bin.Object { return &InputStoryAreaTypeMessage{} }, - InputStoryAreaTypeLinkTypeID: func() bin.Object { return &InputStoryAreaTypeLink{} }, - InputStoryAreaTypeWeatherTypeID: func() bin.Object { return &InputStoryAreaTypeWeather{} }, - InputStoryAreaTypeID: func() bin.Object { return &InputStoryArea{} }, - InputStoryAreasTypeID: func() bin.Object { return &InputStoryAreas{} }, - StoryVideoTypeID: func() bin.Object { return &StoryVideo{} }, - StoryContentPhotoTypeID: func() bin.Object { return &StoryContentPhoto{} }, - StoryContentVideoTypeID: func() bin.Object { return &StoryContentVideo{} }, - StoryContentUnsupportedTypeID: func() bin.Object { return &StoryContentUnsupported{} }, - InputStoryContentPhotoTypeID: func() bin.Object { return &InputStoryContentPhoto{} }, - InputStoryContentVideoTypeID: func() bin.Object { return &InputStoryContentVideo{} }, - StoryListMainTypeID: func() bin.Object { return &StoryListMain{} }, - StoryListArchiveTypeID: func() bin.Object { return &StoryListArchive{} }, - StoryOriginPublicStoryTypeID: func() bin.Object { return &StoryOriginPublicStory{} }, - StoryOriginHiddenUserTypeID: func() bin.Object { return &StoryOriginHiddenUser{} }, - StoryRepostInfoTypeID: func() bin.Object { return &StoryRepostInfo{} }, - StoryInteractionInfoTypeID: func() bin.Object { return &StoryInteractionInfo{} }, - StoryTypeID: func() bin.Object { return &Story{} }, - StoriesTypeID: func() bin.Object { return &Stories{} }, - FoundStoriesTypeID: func() bin.Object { return &FoundStories{} }, - StoryFullIDTypeID: func() bin.Object { return &StoryFullID{} }, - StoryInfoTypeID: func() bin.Object { return &StoryInfo{} }, - ChatActiveStoriesTypeID: func() bin.Object { return &ChatActiveStories{} }, - StoryInteractionTypeViewTypeID: func() bin.Object { return &StoryInteractionTypeView{} }, - StoryInteractionTypeForwardTypeID: func() bin.Object { return &StoryInteractionTypeForward{} }, - StoryInteractionTypeRepostTypeID: func() bin.Object { return &StoryInteractionTypeRepost{} }, - StoryInteractionTypeID: func() bin.Object { return &StoryInteraction{} }, - StoryInteractionsTypeID: func() bin.Object { return &StoryInteractions{} }, - QuickReplyMessageTypeID: func() bin.Object { return &QuickReplyMessage{} }, - QuickReplyMessagesTypeID: func() bin.Object { return &QuickReplyMessages{} }, - QuickReplyShortcutTypeID: func() bin.Object { return &QuickReplyShortcut{} }, - PublicForwardMessageTypeID: func() bin.Object { return &PublicForwardMessage{} }, - PublicForwardStoryTypeID: func() bin.Object { return &PublicForwardStory{} }, - PublicForwardsTypeID: func() bin.Object { return &PublicForwards{} }, - BotMediaPreviewTypeID: func() bin.Object { return &BotMediaPreview{} }, - BotMediaPreviewsTypeID: func() bin.Object { return &BotMediaPreviews{} }, - BotMediaPreviewInfoTypeID: func() bin.Object { return &BotMediaPreviewInfo{} }, - ChatBoostLevelFeaturesTypeID: func() bin.Object { return &ChatBoostLevelFeatures{} }, - ChatBoostFeaturesTypeID: func() bin.Object { return &ChatBoostFeatures{} }, - ChatBoostSourceGiftCodeTypeID: func() bin.Object { return &ChatBoostSourceGiftCode{} }, - ChatBoostSourceGiveawayTypeID: func() bin.Object { return &ChatBoostSourceGiveaway{} }, - ChatBoostSourcePremiumTypeID: func() bin.Object { return &ChatBoostSourcePremium{} }, - PrepaidGiveawayTypeID: func() bin.Object { return &PrepaidGiveaway{} }, - ChatBoostStatusTypeID: func() bin.Object { return &ChatBoostStatus{} }, - ChatBoostTypeID: func() bin.Object { return &ChatBoost{} }, - FoundChatBoostsTypeID: func() bin.Object { return &FoundChatBoosts{} }, - ChatBoostSlotTypeID: func() bin.Object { return &ChatBoostSlot{} }, - ChatBoostSlotsTypeID: func() bin.Object { return &ChatBoostSlots{} }, - ResendCodeReasonUserRequestTypeID: func() bin.Object { return &ResendCodeReasonUserRequest{} }, - ResendCodeReasonVerificationFailedTypeID: func() bin.Object { return &ResendCodeReasonVerificationFailed{} }, - CallDiscardReasonEmptyTypeID: func() bin.Object { return &CallDiscardReasonEmpty{} }, - CallDiscardReasonMissedTypeID: func() bin.Object { return &CallDiscardReasonMissed{} }, - CallDiscardReasonDeclinedTypeID: func() bin.Object { return &CallDiscardReasonDeclined{} }, - CallDiscardReasonDisconnectedTypeID: func() bin.Object { return &CallDiscardReasonDisconnected{} }, - CallDiscardReasonHungUpTypeID: func() bin.Object { return &CallDiscardReasonHungUp{} }, - CallDiscardReasonAllowGroupCallTypeID: func() bin.Object { return &CallDiscardReasonAllowGroupCall{} }, - CallProtocolTypeID: func() bin.Object { return &CallProtocol{} }, - CallServerTypeTelegramReflectorTypeID: func() bin.Object { return &CallServerTypeTelegramReflector{} }, - CallServerTypeWebrtcTypeID: func() bin.Object { return &CallServerTypeWebrtc{} }, - CallServerTypeID: func() bin.Object { return &CallServer{} }, - CallIDTypeID: func() bin.Object { return &CallID{} }, - GroupCallIDTypeID: func() bin.Object { return &GroupCallID{} }, - CallStatePendingTypeID: func() bin.Object { return &CallStatePending{} }, - CallStateExchangingKeysTypeID: func() bin.Object { return &CallStateExchangingKeys{} }, - CallStateReadyTypeID: func() bin.Object { return &CallStateReady{} }, - CallStateHangingUpTypeID: func() bin.Object { return &CallStateHangingUp{} }, - CallStateDiscardedTypeID: func() bin.Object { return &CallStateDiscarded{} }, - CallStateErrorTypeID: func() bin.Object { return &CallStateError{} }, - GroupCallVideoQualityThumbnailTypeID: func() bin.Object { return &GroupCallVideoQualityThumbnail{} }, - GroupCallVideoQualityMediumTypeID: func() bin.Object { return &GroupCallVideoQualityMedium{} }, - GroupCallVideoQualityFullTypeID: func() bin.Object { return &GroupCallVideoQualityFull{} }, - GroupCallStreamTypeID: func() bin.Object { return &GroupCallStream{} }, - GroupCallStreamsTypeID: func() bin.Object { return &GroupCallStreams{} }, - RtmpURLTypeID: func() bin.Object { return &RtmpURL{} }, - GroupCallRecentSpeakerTypeID: func() bin.Object { return &GroupCallRecentSpeaker{} }, - GroupCallTypeID: func() bin.Object { return &GroupCall{} }, - GroupCallVideoSourceGroupTypeID: func() bin.Object { return &GroupCallVideoSourceGroup{} }, - GroupCallParticipantVideoInfoTypeID: func() bin.Object { return &GroupCallParticipantVideoInfo{} }, - GroupCallParticipantTypeID: func() bin.Object { return &GroupCallParticipant{} }, - CallProblemEchoTypeID: func() bin.Object { return &CallProblemEcho{} }, - CallProblemNoiseTypeID: func() bin.Object { return &CallProblemNoise{} }, - CallProblemInterruptionsTypeID: func() bin.Object { return &CallProblemInterruptions{} }, - CallProblemDistortedSpeechTypeID: func() bin.Object { return &CallProblemDistortedSpeech{} }, - CallProblemSilentLocalTypeID: func() bin.Object { return &CallProblemSilentLocal{} }, - CallProblemSilentRemoteTypeID: func() bin.Object { return &CallProblemSilentRemote{} }, - CallProblemDroppedTypeID: func() bin.Object { return &CallProblemDropped{} }, - CallProblemDistortedVideoTypeID: func() bin.Object { return &CallProblemDistortedVideo{} }, - CallProblemPixelatedVideoTypeID: func() bin.Object { return &CallProblemPixelatedVideo{} }, - CallTypeID: func() bin.Object { return &Call{} }, - FirebaseAuthenticationSettingsAndroidTypeID: func() bin.Object { return &FirebaseAuthenticationSettingsAndroid{} }, - FirebaseAuthenticationSettingsIosTypeID: func() bin.Object { return &FirebaseAuthenticationSettingsIos{} }, - PhoneNumberAuthenticationSettingsTypeID: func() bin.Object { return &PhoneNumberAuthenticationSettings{} }, - AddedReactionTypeID: func() bin.Object { return &AddedReaction{} }, - AddedReactionsTypeID: func() bin.Object { return &AddedReactions{} }, - AvailableReactionTypeID: func() bin.Object { return &AvailableReaction{} }, - AvailableReactionsTypeID: func() bin.Object { return &AvailableReactions{} }, - EmojiReactionTypeID: func() bin.Object { return &EmojiReaction{} }, - ReactionUnavailabilityReasonAnonymousAdministratorTypeID: func() bin.Object { return &ReactionUnavailabilityReasonAnonymousAdministrator{} }, - ReactionUnavailabilityReasonGuestTypeID: func() bin.Object { return &ReactionUnavailabilityReasonGuest{} }, - AnimationsTypeID: func() bin.Object { return &Animations{} }, - DiceStickersRegularTypeID: func() bin.Object { return &DiceStickersRegular{} }, - DiceStickersSlotMachineTypeID: func() bin.Object { return &DiceStickersSlotMachine{} }, - ImportedContactsTypeID: func() bin.Object { return &ImportedContacts{} }, - SpeechRecognitionResultPendingTypeID: func() bin.Object { return &SpeechRecognitionResultPending{} }, - SpeechRecognitionResultTextTypeID: func() bin.Object { return &SpeechRecognitionResultText{} }, - SpeechRecognitionResultErrorTypeID: func() bin.Object { return &SpeechRecognitionResultError{} }, - BusinessConnectionTypeID: func() bin.Object { return &BusinessConnection{} }, - AttachmentMenuBotColorTypeID: func() bin.Object { return &AttachmentMenuBotColor{} }, - AttachmentMenuBotTypeID: func() bin.Object { return &AttachmentMenuBot{} }, - SentWebAppMessageTypeID: func() bin.Object { return &SentWebAppMessage{} }, - BotWriteAccessAllowReasonConnectedWebsiteTypeID: func() bin.Object { return &BotWriteAccessAllowReasonConnectedWebsite{} }, - BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID: func() bin.Object { return &BotWriteAccessAllowReasonAddedToAttachmentMenu{} }, - BotWriteAccessAllowReasonLaunchedWebAppTypeID: func() bin.Object { return &BotWriteAccessAllowReasonLaunchedWebApp{} }, - BotWriteAccessAllowReasonAcceptedRequestTypeID: func() bin.Object { return &BotWriteAccessAllowReasonAcceptedRequest{} }, - HTTPURLTypeID: func() bin.Object { return &HTTPURL{} }, - UserLinkTypeID: func() bin.Object { return &UserLink{} }, - TargetChatTypesTypeID: func() bin.Object { return &TargetChatTypes{} }, - TargetChatCurrentTypeID: func() bin.Object { return &TargetChatCurrent{} }, - TargetChatChosenTypeID: func() bin.Object { return &TargetChatChosen{} }, - TargetChatInternalLinkTypeID: func() bin.Object { return &TargetChatInternalLink{} }, - InputInlineQueryResultAnimationTypeID: func() bin.Object { return &InputInlineQueryResultAnimation{} }, - InputInlineQueryResultArticleTypeID: func() bin.Object { return &InputInlineQueryResultArticle{} }, - InputInlineQueryResultAudioTypeID: func() bin.Object { return &InputInlineQueryResultAudio{} }, - InputInlineQueryResultContactTypeID: func() bin.Object { return &InputInlineQueryResultContact{} }, - InputInlineQueryResultDocumentTypeID: func() bin.Object { return &InputInlineQueryResultDocument{} }, - InputInlineQueryResultGameTypeID: func() bin.Object { return &InputInlineQueryResultGame{} }, - InputInlineQueryResultLocationTypeID: func() bin.Object { return &InputInlineQueryResultLocation{} }, - InputInlineQueryResultPhotoTypeID: func() bin.Object { return &InputInlineQueryResultPhoto{} }, - InputInlineQueryResultStickerTypeID: func() bin.Object { return &InputInlineQueryResultSticker{} }, - InputInlineQueryResultVenueTypeID: func() bin.Object { return &InputInlineQueryResultVenue{} }, - InputInlineQueryResultVideoTypeID: func() bin.Object { return &InputInlineQueryResultVideo{} }, - InputInlineQueryResultVoiceNoteTypeID: func() bin.Object { return &InputInlineQueryResultVoiceNote{} }, - InlineQueryResultArticleTypeID: func() bin.Object { return &InlineQueryResultArticle{} }, - InlineQueryResultContactTypeID: func() bin.Object { return &InlineQueryResultContact{} }, - InlineQueryResultLocationTypeID: func() bin.Object { return &InlineQueryResultLocation{} }, - InlineQueryResultVenueTypeID: func() bin.Object { return &InlineQueryResultVenue{} }, - InlineQueryResultGameTypeID: func() bin.Object { return &InlineQueryResultGame{} }, - InlineQueryResultAnimationTypeID: func() bin.Object { return &InlineQueryResultAnimation{} }, - InlineQueryResultAudioTypeID: func() bin.Object { return &InlineQueryResultAudio{} }, - InlineQueryResultDocumentTypeID: func() bin.Object { return &InlineQueryResultDocument{} }, - InlineQueryResultPhotoTypeID: func() bin.Object { return &InlineQueryResultPhoto{} }, - InlineQueryResultStickerTypeID: func() bin.Object { return &InlineQueryResultSticker{} }, - InlineQueryResultVideoTypeID: func() bin.Object { return &InlineQueryResultVideo{} }, - InlineQueryResultVoiceNoteTypeID: func() bin.Object { return &InlineQueryResultVoiceNote{} }, - InlineQueryResultsButtonTypeStartBotTypeID: func() bin.Object { return &InlineQueryResultsButtonTypeStartBot{} }, - InlineQueryResultsButtonTypeWebAppTypeID: func() bin.Object { return &InlineQueryResultsButtonTypeWebApp{} }, - InlineQueryResultsButtonTypeID: func() bin.Object { return &InlineQueryResultsButton{} }, - InlineQueryResultsTypeID: func() bin.Object { return &InlineQueryResults{} }, - PreparedInlineMessageIDTypeID: func() bin.Object { return &PreparedInlineMessageID{} }, - PreparedInlineMessageTypeID: func() bin.Object { return &PreparedInlineMessage{} }, - CallbackQueryPayloadDataTypeID: func() bin.Object { return &CallbackQueryPayloadData{} }, - CallbackQueryPayloadDataWithPasswordTypeID: func() bin.Object { return &CallbackQueryPayloadDataWithPassword{} }, - CallbackQueryPayloadGameTypeID: func() bin.Object { return &CallbackQueryPayloadGame{} }, - CallbackQueryAnswerTypeID: func() bin.Object { return &CallbackQueryAnswer{} }, - CustomRequestResultTypeID: func() bin.Object { return &CustomRequestResult{} }, - GameHighScoreTypeID: func() bin.Object { return &GameHighScore{} }, - GameHighScoresTypeID: func() bin.Object { return &GameHighScores{} }, - ChatEventMessageEditedTypeID: func() bin.Object { return &ChatEventMessageEdited{} }, - ChatEventMessageDeletedTypeID: func() bin.Object { return &ChatEventMessageDeleted{} }, - ChatEventMessagePinnedTypeID: func() bin.Object { return &ChatEventMessagePinned{} }, - ChatEventMessageUnpinnedTypeID: func() bin.Object { return &ChatEventMessageUnpinned{} }, - ChatEventPollStoppedTypeID: func() bin.Object { return &ChatEventPollStopped{} }, - ChatEventMemberJoinedTypeID: func() bin.Object { return &ChatEventMemberJoined{} }, - ChatEventMemberJoinedByInviteLinkTypeID: func() bin.Object { return &ChatEventMemberJoinedByInviteLink{} }, - ChatEventMemberJoinedByRequestTypeID: func() bin.Object { return &ChatEventMemberJoinedByRequest{} }, - ChatEventMemberInvitedTypeID: func() bin.Object { return &ChatEventMemberInvited{} }, - ChatEventMemberLeftTypeID: func() bin.Object { return &ChatEventMemberLeft{} }, - ChatEventMemberPromotedTypeID: func() bin.Object { return &ChatEventMemberPromoted{} }, - ChatEventMemberRestrictedTypeID: func() bin.Object { return &ChatEventMemberRestricted{} }, - ChatEventMemberSubscriptionExtendedTypeID: func() bin.Object { return &ChatEventMemberSubscriptionExtended{} }, - ChatEventAvailableReactionsChangedTypeID: func() bin.Object { return &ChatEventAvailableReactionsChanged{} }, - ChatEventBackgroundChangedTypeID: func() bin.Object { return &ChatEventBackgroundChanged{} }, - ChatEventDescriptionChangedTypeID: func() bin.Object { return &ChatEventDescriptionChanged{} }, - ChatEventEmojiStatusChangedTypeID: func() bin.Object { return &ChatEventEmojiStatusChanged{} }, - ChatEventLinkedChatChangedTypeID: func() bin.Object { return &ChatEventLinkedChatChanged{} }, - ChatEventLocationChangedTypeID: func() bin.Object { return &ChatEventLocationChanged{} }, - ChatEventMessageAutoDeleteTimeChangedTypeID: func() bin.Object { return &ChatEventMessageAutoDeleteTimeChanged{} }, - ChatEventPermissionsChangedTypeID: func() bin.Object { return &ChatEventPermissionsChanged{} }, - ChatEventPhotoChangedTypeID: func() bin.Object { return &ChatEventPhotoChanged{} }, - ChatEventSlowModeDelayChangedTypeID: func() bin.Object { return &ChatEventSlowModeDelayChanged{} }, - ChatEventStickerSetChangedTypeID: func() bin.Object { return &ChatEventStickerSetChanged{} }, - ChatEventCustomEmojiStickerSetChangedTypeID: func() bin.Object { return &ChatEventCustomEmojiStickerSetChanged{} }, - ChatEventTitleChangedTypeID: func() bin.Object { return &ChatEventTitleChanged{} }, - ChatEventUsernameChangedTypeID: func() bin.Object { return &ChatEventUsernameChanged{} }, - ChatEventActiveUsernamesChangedTypeID: func() bin.Object { return &ChatEventActiveUsernamesChanged{} }, - ChatEventAccentColorChangedTypeID: func() bin.Object { return &ChatEventAccentColorChanged{} }, - ChatEventProfileAccentColorChangedTypeID: func() bin.Object { return &ChatEventProfileAccentColorChanged{} }, - ChatEventHasProtectedContentToggledTypeID: func() bin.Object { return &ChatEventHasProtectedContentToggled{} }, - ChatEventInvitesToggledTypeID: func() bin.Object { return &ChatEventInvitesToggled{} }, - ChatEventIsAllHistoryAvailableToggledTypeID: func() bin.Object { return &ChatEventIsAllHistoryAvailableToggled{} }, - ChatEventHasAggressiveAntiSpamEnabledToggledTypeID: func() bin.Object { return &ChatEventHasAggressiveAntiSpamEnabledToggled{} }, - ChatEventSignMessagesToggledTypeID: func() bin.Object { return &ChatEventSignMessagesToggled{} }, - ChatEventShowMessageSenderToggledTypeID: func() bin.Object { return &ChatEventShowMessageSenderToggled{} }, - ChatEventInviteLinkEditedTypeID: func() bin.Object { return &ChatEventInviteLinkEdited{} }, - ChatEventInviteLinkRevokedTypeID: func() bin.Object { return &ChatEventInviteLinkRevoked{} }, - ChatEventInviteLinkDeletedTypeID: func() bin.Object { return &ChatEventInviteLinkDeleted{} }, - ChatEventVideoChatCreatedTypeID: func() bin.Object { return &ChatEventVideoChatCreated{} }, - ChatEventVideoChatEndedTypeID: func() bin.Object { return &ChatEventVideoChatEnded{} }, - ChatEventVideoChatMuteNewParticipantsToggledTypeID: func() bin.Object { return &ChatEventVideoChatMuteNewParticipantsToggled{} }, - ChatEventVideoChatParticipantIsMutedToggledTypeID: func() bin.Object { return &ChatEventVideoChatParticipantIsMutedToggled{} }, - ChatEventVideoChatParticipantVolumeLevelChangedTypeID: func() bin.Object { return &ChatEventVideoChatParticipantVolumeLevelChanged{} }, - ChatEventIsForumToggledTypeID: func() bin.Object { return &ChatEventIsForumToggled{} }, - ChatEventForumTopicCreatedTypeID: func() bin.Object { return &ChatEventForumTopicCreated{} }, - ChatEventForumTopicEditedTypeID: func() bin.Object { return &ChatEventForumTopicEdited{} }, - ChatEventForumTopicToggleIsClosedTypeID: func() bin.Object { return &ChatEventForumTopicToggleIsClosed{} }, - ChatEventForumTopicToggleIsHiddenTypeID: func() bin.Object { return &ChatEventForumTopicToggleIsHidden{} }, - ChatEventForumTopicDeletedTypeID: func() bin.Object { return &ChatEventForumTopicDeleted{} }, - ChatEventForumTopicPinnedTypeID: func() bin.Object { return &ChatEventForumTopicPinned{} }, - ChatEventTypeID: func() bin.Object { return &ChatEvent{} }, - ChatEventsTypeID: func() bin.Object { return &ChatEvents{} }, - ChatEventLogFiltersTypeID: func() bin.Object { return &ChatEventLogFilters{} }, - LanguagePackStringValueOrdinaryTypeID: func() bin.Object { return &LanguagePackStringValueOrdinary{} }, - LanguagePackStringValuePluralizedTypeID: func() bin.Object { return &LanguagePackStringValuePluralized{} }, - LanguagePackStringValueDeletedTypeID: func() bin.Object { return &LanguagePackStringValueDeleted{} }, - LanguagePackStringTypeID: func() bin.Object { return &LanguagePackString{} }, - LanguagePackStringsTypeID: func() bin.Object { return &LanguagePackStrings{} }, - LanguagePackInfoTypeID: func() bin.Object { return &LanguagePackInfo{} }, - LocalizationTargetInfoTypeID: func() bin.Object { return &LocalizationTargetInfo{} }, - PremiumLimitTypeSupergroupCountTypeID: func() bin.Object { return &PremiumLimitTypeSupergroupCount{} }, - PremiumLimitTypePinnedChatCountTypeID: func() bin.Object { return &PremiumLimitTypePinnedChatCount{} }, - PremiumLimitTypeCreatedPublicChatCountTypeID: func() bin.Object { return &PremiumLimitTypeCreatedPublicChatCount{} }, - PremiumLimitTypeSavedAnimationCountTypeID: func() bin.Object { return &PremiumLimitTypeSavedAnimationCount{} }, - PremiumLimitTypeFavoriteStickerCountTypeID: func() bin.Object { return &PremiumLimitTypeFavoriteStickerCount{} }, - PremiumLimitTypeChatFolderCountTypeID: func() bin.Object { return &PremiumLimitTypeChatFolderCount{} }, - PremiumLimitTypeChatFolderChosenChatCountTypeID: func() bin.Object { return &PremiumLimitTypeChatFolderChosenChatCount{} }, - PremiumLimitTypePinnedArchivedChatCountTypeID: func() bin.Object { return &PremiumLimitTypePinnedArchivedChatCount{} }, - PremiumLimitTypePinnedSavedMessagesTopicCountTypeID: func() bin.Object { return &PremiumLimitTypePinnedSavedMessagesTopicCount{} }, - PremiumLimitTypeCaptionLengthTypeID: func() bin.Object { return &PremiumLimitTypeCaptionLength{} }, - PremiumLimitTypeBioLengthTypeID: func() bin.Object { return &PremiumLimitTypeBioLength{} }, - PremiumLimitTypeChatFolderInviteLinkCountTypeID: func() bin.Object { return &PremiumLimitTypeChatFolderInviteLinkCount{} }, - PremiumLimitTypeShareableChatFolderCountTypeID: func() bin.Object { return &PremiumLimitTypeShareableChatFolderCount{} }, - PremiumLimitTypeActiveStoryCountTypeID: func() bin.Object { return &PremiumLimitTypeActiveStoryCount{} }, - PremiumLimitTypeWeeklySentStoryCountTypeID: func() bin.Object { return &PremiumLimitTypeWeeklySentStoryCount{} }, - PremiumLimitTypeMonthlySentStoryCountTypeID: func() bin.Object { return &PremiumLimitTypeMonthlySentStoryCount{} }, - PremiumLimitTypeStoryCaptionLengthTypeID: func() bin.Object { return &PremiumLimitTypeStoryCaptionLength{} }, - PremiumLimitTypeStorySuggestedReactionAreaCountTypeID: func() bin.Object { return &PremiumLimitTypeStorySuggestedReactionAreaCount{} }, - PremiumLimitTypeSimilarChatCountTypeID: func() bin.Object { return &PremiumLimitTypeSimilarChatCount{} }, - PremiumFeatureIncreasedLimitsTypeID: func() bin.Object { return &PremiumFeatureIncreasedLimits{} }, - PremiumFeatureIncreasedUploadFileSizeTypeID: func() bin.Object { return &PremiumFeatureIncreasedUploadFileSize{} }, - PremiumFeatureImprovedDownloadSpeedTypeID: func() bin.Object { return &PremiumFeatureImprovedDownloadSpeed{} }, - PremiumFeatureVoiceRecognitionTypeID: func() bin.Object { return &PremiumFeatureVoiceRecognition{} }, - PremiumFeatureDisabledAdsTypeID: func() bin.Object { return &PremiumFeatureDisabledAds{} }, - PremiumFeatureUniqueReactionsTypeID: func() bin.Object { return &PremiumFeatureUniqueReactions{} }, - PremiumFeatureUniqueStickersTypeID: func() bin.Object { return &PremiumFeatureUniqueStickers{} }, - PremiumFeatureCustomEmojiTypeID: func() bin.Object { return &PremiumFeatureCustomEmoji{} }, - PremiumFeatureAdvancedChatManagementTypeID: func() bin.Object { return &PremiumFeatureAdvancedChatManagement{} }, - PremiumFeatureProfileBadgeTypeID: func() bin.Object { return &PremiumFeatureProfileBadge{} }, - PremiumFeatureEmojiStatusTypeID: func() bin.Object { return &PremiumFeatureEmojiStatus{} }, - PremiumFeatureAnimatedProfilePhotoTypeID: func() bin.Object { return &PremiumFeatureAnimatedProfilePhoto{} }, - PremiumFeatureForumTopicIconTypeID: func() bin.Object { return &PremiumFeatureForumTopicIcon{} }, - PremiumFeatureAppIconsTypeID: func() bin.Object { return &PremiumFeatureAppIcons{} }, - PremiumFeatureRealTimeChatTranslationTypeID: func() bin.Object { return &PremiumFeatureRealTimeChatTranslation{} }, - PremiumFeatureUpgradedStoriesTypeID: func() bin.Object { return &PremiumFeatureUpgradedStories{} }, - PremiumFeatureChatBoostTypeID: func() bin.Object { return &PremiumFeatureChatBoost{} }, - PremiumFeatureAccentColorTypeID: func() bin.Object { return &PremiumFeatureAccentColor{} }, - PremiumFeatureBackgroundForBothTypeID: func() bin.Object { return &PremiumFeatureBackgroundForBoth{} }, - PremiumFeatureSavedMessagesTagsTypeID: func() bin.Object { return &PremiumFeatureSavedMessagesTags{} }, - PremiumFeatureMessagePrivacyTypeID: func() bin.Object { return &PremiumFeatureMessagePrivacy{} }, - PremiumFeatureLastSeenTimesTypeID: func() bin.Object { return &PremiumFeatureLastSeenTimes{} }, - PremiumFeatureBusinessTypeID: func() bin.Object { return &PremiumFeatureBusiness{} }, - PremiumFeatureMessageEffectsTypeID: func() bin.Object { return &PremiumFeatureMessageEffects{} }, - BusinessFeatureLocationTypeID: func() bin.Object { return &BusinessFeatureLocation{} }, - BusinessFeatureOpeningHoursTypeID: func() bin.Object { return &BusinessFeatureOpeningHours{} }, - BusinessFeatureQuickRepliesTypeID: func() bin.Object { return &BusinessFeatureQuickReplies{} }, - BusinessFeatureGreetingMessageTypeID: func() bin.Object { return &BusinessFeatureGreetingMessage{} }, - BusinessFeatureAwayMessageTypeID: func() bin.Object { return &BusinessFeatureAwayMessage{} }, - BusinessFeatureAccountLinksTypeID: func() bin.Object { return &BusinessFeatureAccountLinks{} }, - BusinessFeatureStartPageTypeID: func() bin.Object { return &BusinessFeatureStartPage{} }, - BusinessFeatureBotsTypeID: func() bin.Object { return &BusinessFeatureBots{} }, - BusinessFeatureEmojiStatusTypeID: func() bin.Object { return &BusinessFeatureEmojiStatus{} }, - BusinessFeatureChatFolderTagsTypeID: func() bin.Object { return &BusinessFeatureChatFolderTags{} }, - BusinessFeatureUpgradedStoriesTypeID: func() bin.Object { return &BusinessFeatureUpgradedStories{} }, - PremiumStoryFeaturePriorityOrderTypeID: func() bin.Object { return &PremiumStoryFeaturePriorityOrder{} }, - PremiumStoryFeatureStealthModeTypeID: func() bin.Object { return &PremiumStoryFeatureStealthMode{} }, - PremiumStoryFeaturePermanentViewsHistoryTypeID: func() bin.Object { return &PremiumStoryFeaturePermanentViewsHistory{} }, - PremiumStoryFeatureCustomExpirationDurationTypeID: func() bin.Object { return &PremiumStoryFeatureCustomExpirationDuration{} }, - PremiumStoryFeatureSaveStoriesTypeID: func() bin.Object { return &PremiumStoryFeatureSaveStories{} }, - PremiumStoryFeatureLinksAndFormattingTypeID: func() bin.Object { return &PremiumStoryFeatureLinksAndFormatting{} }, - PremiumStoryFeatureVideoQualityTypeID: func() bin.Object { return &PremiumStoryFeatureVideoQuality{} }, - PremiumLimitTypeID: func() bin.Object { return &PremiumLimit{} }, - PremiumFeaturesTypeID: func() bin.Object { return &PremiumFeatures{} }, - BusinessFeaturesTypeID: func() bin.Object { return &BusinessFeatures{} }, - PremiumSourceLimitExceededTypeID: func() bin.Object { return &PremiumSourceLimitExceeded{} }, - PremiumSourceFeatureTypeID: func() bin.Object { return &PremiumSourceFeature{} }, - PremiumSourceBusinessFeatureTypeID: func() bin.Object { return &PremiumSourceBusinessFeature{} }, - PremiumSourceStoryFeatureTypeID: func() bin.Object { return &PremiumSourceStoryFeature{} }, - PremiumSourceLinkTypeID: func() bin.Object { return &PremiumSourceLink{} }, - PremiumSourceSettingsTypeID: func() bin.Object { return &PremiumSourceSettings{} }, - PremiumFeaturePromotionAnimationTypeID: func() bin.Object { return &PremiumFeaturePromotionAnimation{} }, - BusinessFeaturePromotionAnimationTypeID: func() bin.Object { return &BusinessFeaturePromotionAnimation{} }, - PremiumStateTypeID: func() bin.Object { return &PremiumState{} }, - StorePaymentPurposePremiumSubscriptionTypeID: func() bin.Object { return &StorePaymentPurposePremiumSubscription{} }, - StorePaymentPurposePremiumGiftCodesTypeID: func() bin.Object { return &StorePaymentPurposePremiumGiftCodes{} }, - StorePaymentPurposePremiumGiveawayTypeID: func() bin.Object { return &StorePaymentPurposePremiumGiveaway{} }, - StorePaymentPurposeStarGiveawayTypeID: func() bin.Object { return &StorePaymentPurposeStarGiveaway{} }, - StorePaymentPurposeStarsTypeID: func() bin.Object { return &StorePaymentPurposeStars{} }, - StorePaymentPurposeGiftedStarsTypeID: func() bin.Object { return &StorePaymentPurposeGiftedStars{} }, - TelegramPaymentPurposePremiumGiftCodesTypeID: func() bin.Object { return &TelegramPaymentPurposePremiumGiftCodes{} }, - TelegramPaymentPurposePremiumGiveawayTypeID: func() bin.Object { return &TelegramPaymentPurposePremiumGiveaway{} }, - TelegramPaymentPurposeStarsTypeID: func() bin.Object { return &TelegramPaymentPurposeStars{} }, - TelegramPaymentPurposeGiftedStarsTypeID: func() bin.Object { return &TelegramPaymentPurposeGiftedStars{} }, - TelegramPaymentPurposeStarGiveawayTypeID: func() bin.Object { return &TelegramPaymentPurposeStarGiveaway{} }, - TelegramPaymentPurposeJoinChatTypeID: func() bin.Object { return &TelegramPaymentPurposeJoinChat{} }, - DeviceTokenFirebaseCloudMessagingTypeID: func() bin.Object { return &DeviceTokenFirebaseCloudMessaging{} }, - DeviceTokenApplePushTypeID: func() bin.Object { return &DeviceTokenApplePush{} }, - DeviceTokenApplePushVoIPTypeID: func() bin.Object { return &DeviceTokenApplePushVoIP{} }, - DeviceTokenWindowsPushTypeID: func() bin.Object { return &DeviceTokenWindowsPush{} }, - DeviceTokenMicrosoftPushTypeID: func() bin.Object { return &DeviceTokenMicrosoftPush{} }, - DeviceTokenMicrosoftPushVoIPTypeID: func() bin.Object { return &DeviceTokenMicrosoftPushVoIP{} }, - DeviceTokenWebPushTypeID: func() bin.Object { return &DeviceTokenWebPush{} }, - DeviceTokenSimplePushTypeID: func() bin.Object { return &DeviceTokenSimplePush{} }, - DeviceTokenUbuntuPushTypeID: func() bin.Object { return &DeviceTokenUbuntuPush{} }, - DeviceTokenBlackBerryPushTypeID: func() bin.Object { return &DeviceTokenBlackBerryPush{} }, - DeviceTokenTizenPushTypeID: func() bin.Object { return &DeviceTokenTizenPush{} }, - DeviceTokenHuaweiPushTypeID: func() bin.Object { return &DeviceTokenHuaweiPush{} }, - PushReceiverIDTypeID: func() bin.Object { return &PushReceiverID{} }, - BackgroundFillSolidTypeID: func() bin.Object { return &BackgroundFillSolid{} }, - BackgroundFillGradientTypeID: func() bin.Object { return &BackgroundFillGradient{} }, - BackgroundFillFreeformGradientTypeID: func() bin.Object { return &BackgroundFillFreeformGradient{} }, - BackgroundTypeWallpaperTypeID: func() bin.Object { return &BackgroundTypeWallpaper{} }, - BackgroundTypePatternTypeID: func() bin.Object { return &BackgroundTypePattern{} }, - BackgroundTypeFillTypeID: func() bin.Object { return &BackgroundTypeFill{} }, - BackgroundTypeChatThemeTypeID: func() bin.Object { return &BackgroundTypeChatTheme{} }, - InputBackgroundLocalTypeID: func() bin.Object { return &InputBackgroundLocal{} }, - InputBackgroundRemoteTypeID: func() bin.Object { return &InputBackgroundRemote{} }, - InputBackgroundPreviousTypeID: func() bin.Object { return &InputBackgroundPrevious{} }, - ChatThemeTypeID: func() bin.Object { return &ChatTheme{} }, - TimeZoneTypeID: func() bin.Object { return &TimeZone{} }, - TimeZonesTypeID: func() bin.Object { return &TimeZones{} }, - HashtagsTypeID: func() bin.Object { return &Hashtags{} }, - CanSendStoryResultOkTypeID: func() bin.Object { return &CanSendStoryResultOk{} }, - CanSendStoryResultPremiumNeededTypeID: func() bin.Object { return &CanSendStoryResultPremiumNeeded{} }, - CanSendStoryResultBoostNeededTypeID: func() bin.Object { return &CanSendStoryResultBoostNeeded{} }, - CanSendStoryResultActiveStoryLimitExceededTypeID: func() bin.Object { return &CanSendStoryResultActiveStoryLimitExceeded{} }, - CanSendStoryResultWeeklyLimitExceededTypeID: func() bin.Object { return &CanSendStoryResultWeeklyLimitExceeded{} }, - CanSendStoryResultMonthlyLimitExceededTypeID: func() bin.Object { return &CanSendStoryResultMonthlyLimitExceeded{} }, - CanTransferOwnershipResultOkTypeID: func() bin.Object { return &CanTransferOwnershipResultOk{} }, - CanTransferOwnershipResultPasswordNeededTypeID: func() bin.Object { return &CanTransferOwnershipResultPasswordNeeded{} }, - CanTransferOwnershipResultPasswordTooFreshTypeID: func() bin.Object { return &CanTransferOwnershipResultPasswordTooFresh{} }, - CanTransferOwnershipResultSessionTooFreshTypeID: func() bin.Object { return &CanTransferOwnershipResultSessionTooFresh{} }, - CheckChatUsernameResultOkTypeID: func() bin.Object { return &CheckChatUsernameResultOk{} }, - CheckChatUsernameResultUsernameInvalidTypeID: func() bin.Object { return &CheckChatUsernameResultUsernameInvalid{} }, - CheckChatUsernameResultUsernameOccupiedTypeID: func() bin.Object { return &CheckChatUsernameResultUsernameOccupied{} }, - CheckChatUsernameResultUsernamePurchasableTypeID: func() bin.Object { return &CheckChatUsernameResultUsernamePurchasable{} }, - CheckChatUsernameResultPublicChatsTooManyTypeID: func() bin.Object { return &CheckChatUsernameResultPublicChatsTooMany{} }, - CheckChatUsernameResultPublicGroupsUnavailableTypeID: func() bin.Object { return &CheckChatUsernameResultPublicGroupsUnavailable{} }, - CheckStickerSetNameResultOkTypeID: func() bin.Object { return &CheckStickerSetNameResultOk{} }, - CheckStickerSetNameResultNameInvalidTypeID: func() bin.Object { return &CheckStickerSetNameResultNameInvalid{} }, - CheckStickerSetNameResultNameOccupiedTypeID: func() bin.Object { return &CheckStickerSetNameResultNameOccupied{} }, - ResetPasswordResultOkTypeID: func() bin.Object { return &ResetPasswordResultOk{} }, - ResetPasswordResultPendingTypeID: func() bin.Object { return &ResetPasswordResultPending{} }, - ResetPasswordResultDeclinedTypeID: func() bin.Object { return &ResetPasswordResultDeclined{} }, - MessageFileTypePrivateTypeID: func() bin.Object { return &MessageFileTypePrivate{} }, - MessageFileTypeGroupTypeID: func() bin.Object { return &MessageFileTypeGroup{} }, - MessageFileTypeUnknownTypeID: func() bin.Object { return &MessageFileTypeUnknown{} }, - PushMessageContentHiddenTypeID: func() bin.Object { return &PushMessageContentHidden{} }, - PushMessageContentAnimationTypeID: func() bin.Object { return &PushMessageContentAnimation{} }, - PushMessageContentAudioTypeID: func() bin.Object { return &PushMessageContentAudio{} }, - PushMessageContentContactTypeID: func() bin.Object { return &PushMessageContentContact{} }, - PushMessageContentContactRegisteredTypeID: func() bin.Object { return &PushMessageContentContactRegistered{} }, - PushMessageContentDocumentTypeID: func() bin.Object { return &PushMessageContentDocument{} }, - PushMessageContentGameTypeID: func() bin.Object { return &PushMessageContentGame{} }, - PushMessageContentGameScoreTypeID: func() bin.Object { return &PushMessageContentGameScore{} }, - PushMessageContentInvoiceTypeID: func() bin.Object { return &PushMessageContentInvoice{} }, - PushMessageContentLocationTypeID: func() bin.Object { return &PushMessageContentLocation{} }, - PushMessageContentPaidMediaTypeID: func() bin.Object { return &PushMessageContentPaidMedia{} }, - PushMessageContentPhotoTypeID: func() bin.Object { return &PushMessageContentPhoto{} }, - PushMessageContentPollTypeID: func() bin.Object { return &PushMessageContentPoll{} }, - PushMessageContentPremiumGiftCodeTypeID: func() bin.Object { return &PushMessageContentPremiumGiftCode{} }, - PushMessageContentGiveawayTypeID: func() bin.Object { return &PushMessageContentGiveaway{} }, - PushMessageContentGiftTypeID: func() bin.Object { return &PushMessageContentGift{} }, - PushMessageContentUpgradedGiftTypeID: func() bin.Object { return &PushMessageContentUpgradedGift{} }, - PushMessageContentScreenshotTakenTypeID: func() bin.Object { return &PushMessageContentScreenshotTaken{} }, - PushMessageContentStickerTypeID: func() bin.Object { return &PushMessageContentSticker{} }, - PushMessageContentStoryTypeID: func() bin.Object { return &PushMessageContentStory{} }, - PushMessageContentTextTypeID: func() bin.Object { return &PushMessageContentText{} }, - PushMessageContentVideoTypeID: func() bin.Object { return &PushMessageContentVideo{} }, - PushMessageContentVideoNoteTypeID: func() bin.Object { return &PushMessageContentVideoNote{} }, - PushMessageContentVoiceNoteTypeID: func() bin.Object { return &PushMessageContentVoiceNote{} }, - PushMessageContentBasicGroupChatCreateTypeID: func() bin.Object { return &PushMessageContentBasicGroupChatCreate{} }, - PushMessageContentChatAddMembersTypeID: func() bin.Object { return &PushMessageContentChatAddMembers{} }, - PushMessageContentChatChangePhotoTypeID: func() bin.Object { return &PushMessageContentChatChangePhoto{} }, - PushMessageContentChatChangeTitleTypeID: func() bin.Object { return &PushMessageContentChatChangeTitle{} }, - PushMessageContentChatSetBackgroundTypeID: func() bin.Object { return &PushMessageContentChatSetBackground{} }, - PushMessageContentChatSetThemeTypeID: func() bin.Object { return &PushMessageContentChatSetTheme{} }, - PushMessageContentChatDeleteMemberTypeID: func() bin.Object { return &PushMessageContentChatDeleteMember{} }, - PushMessageContentChatJoinByLinkTypeID: func() bin.Object { return &PushMessageContentChatJoinByLink{} }, - PushMessageContentChatJoinByRequestTypeID: func() bin.Object { return &PushMessageContentChatJoinByRequest{} }, - PushMessageContentRecurringPaymentTypeID: func() bin.Object { return &PushMessageContentRecurringPayment{} }, - PushMessageContentSuggestProfilePhotoTypeID: func() bin.Object { return &PushMessageContentSuggestProfilePhoto{} }, - PushMessageContentMessageForwardsTypeID: func() bin.Object { return &PushMessageContentMessageForwards{} }, - PushMessageContentMediaAlbumTypeID: func() bin.Object { return &PushMessageContentMediaAlbum{} }, - NotificationTypeNewMessageTypeID: func() bin.Object { return &NotificationTypeNewMessage{} }, - NotificationTypeNewSecretChatTypeID: func() bin.Object { return &NotificationTypeNewSecretChat{} }, - NotificationTypeNewCallTypeID: func() bin.Object { return &NotificationTypeNewCall{} }, - NotificationTypeNewPushMessageTypeID: func() bin.Object { return &NotificationTypeNewPushMessage{} }, - NotificationGroupTypeMessagesTypeID: func() bin.Object { return &NotificationGroupTypeMessages{} }, - NotificationGroupTypeMentionsTypeID: func() bin.Object { return &NotificationGroupTypeMentions{} }, - NotificationGroupTypeSecretChatTypeID: func() bin.Object { return &NotificationGroupTypeSecretChat{} }, - NotificationGroupTypeCallsTypeID: func() bin.Object { return &NotificationGroupTypeCalls{} }, - NotificationSoundTypeID: func() bin.Object { return &NotificationSound{} }, - NotificationSoundsTypeID: func() bin.Object { return &NotificationSounds{} }, - NotificationTypeID: func() bin.Object { return &Notification{} }, - NotificationGroupTypeID: func() bin.Object { return &NotificationGroup{} }, - OptionValueBooleanTypeID: func() bin.Object { return &OptionValueBoolean{} }, - OptionValueEmptyTypeID: func() bin.Object { return &OptionValueEmpty{} }, - OptionValueIntegerTypeID: func() bin.Object { return &OptionValueInteger{} }, - OptionValueStringTypeID: func() bin.Object { return &OptionValueString{} }, - JSONObjectMemberTypeID: func() bin.Object { return &JSONObjectMember{} }, - JSONValueNullTypeID: func() bin.Object { return &JSONValueNull{} }, - JSONValueBooleanTypeID: func() bin.Object { return &JSONValueBoolean{} }, - JSONValueNumberTypeID: func() bin.Object { return &JSONValueNumber{} }, - JSONValueStringTypeID: func() bin.Object { return &JSONValueString{} }, - JSONValueArrayTypeID: func() bin.Object { return &JSONValueArray{} }, - JSONValueObjectTypeID: func() bin.Object { return &JSONValueObject{} }, - StoryPrivacySettingsEveryoneTypeID: func() bin.Object { return &StoryPrivacySettingsEveryone{} }, - StoryPrivacySettingsContactsTypeID: func() bin.Object { return &StoryPrivacySettingsContacts{} }, - StoryPrivacySettingsCloseFriendsTypeID: func() bin.Object { return &StoryPrivacySettingsCloseFriends{} }, - StoryPrivacySettingsSelectedUsersTypeID: func() bin.Object { return &StoryPrivacySettingsSelectedUsers{} }, - UserPrivacySettingRuleAllowAllTypeID: func() bin.Object { return &UserPrivacySettingRuleAllowAll{} }, - UserPrivacySettingRuleAllowContactsTypeID: func() bin.Object { return &UserPrivacySettingRuleAllowContacts{} }, - UserPrivacySettingRuleAllowBotsTypeID: func() bin.Object { return &UserPrivacySettingRuleAllowBots{} }, - UserPrivacySettingRuleAllowPremiumUsersTypeID: func() bin.Object { return &UserPrivacySettingRuleAllowPremiumUsers{} }, - UserPrivacySettingRuleAllowUsersTypeID: func() bin.Object { return &UserPrivacySettingRuleAllowUsers{} }, - UserPrivacySettingRuleAllowChatMembersTypeID: func() bin.Object { return &UserPrivacySettingRuleAllowChatMembers{} }, - UserPrivacySettingRuleRestrictAllTypeID: func() bin.Object { return &UserPrivacySettingRuleRestrictAll{} }, - UserPrivacySettingRuleRestrictContactsTypeID: func() bin.Object { return &UserPrivacySettingRuleRestrictContacts{} }, - UserPrivacySettingRuleRestrictBotsTypeID: func() bin.Object { return &UserPrivacySettingRuleRestrictBots{} }, - UserPrivacySettingRuleRestrictUsersTypeID: func() bin.Object { return &UserPrivacySettingRuleRestrictUsers{} }, - UserPrivacySettingRuleRestrictChatMembersTypeID: func() bin.Object { return &UserPrivacySettingRuleRestrictChatMembers{} }, - UserPrivacySettingRulesTypeID: func() bin.Object { return &UserPrivacySettingRules{} }, - UserPrivacySettingShowStatusTypeID: func() bin.Object { return &UserPrivacySettingShowStatus{} }, - UserPrivacySettingShowProfilePhotoTypeID: func() bin.Object { return &UserPrivacySettingShowProfilePhoto{} }, - UserPrivacySettingShowLinkInForwardedMessagesTypeID: func() bin.Object { return &UserPrivacySettingShowLinkInForwardedMessages{} }, - UserPrivacySettingShowPhoneNumberTypeID: func() bin.Object { return &UserPrivacySettingShowPhoneNumber{} }, - UserPrivacySettingShowBioTypeID: func() bin.Object { return &UserPrivacySettingShowBio{} }, - UserPrivacySettingShowBirthdateTypeID: func() bin.Object { return &UserPrivacySettingShowBirthdate{} }, - UserPrivacySettingAllowChatInvitesTypeID: func() bin.Object { return &UserPrivacySettingAllowChatInvites{} }, - UserPrivacySettingAllowCallsTypeID: func() bin.Object { return &UserPrivacySettingAllowCalls{} }, - UserPrivacySettingAllowPeerToPeerCallsTypeID: func() bin.Object { return &UserPrivacySettingAllowPeerToPeerCalls{} }, - UserPrivacySettingAllowFindingByPhoneNumberTypeID: func() bin.Object { return &UserPrivacySettingAllowFindingByPhoneNumber{} }, - UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID: func() bin.Object { return &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} }, - UserPrivacySettingAutosaveGiftsTypeID: func() bin.Object { return &UserPrivacySettingAutosaveGifts{} }, - ReadDatePrivacySettingsTypeID: func() bin.Object { return &ReadDatePrivacySettings{} }, - NewChatPrivacySettingsTypeID: func() bin.Object { return &NewChatPrivacySettings{} }, - CanSendMessageToUserResultOkTypeID: func() bin.Object { return &CanSendMessageToUserResultOk{} }, - CanSendMessageToUserResultUserIsDeletedTypeID: func() bin.Object { return &CanSendMessageToUserResultUserIsDeleted{} }, - CanSendMessageToUserResultUserRestrictsNewChatsTypeID: func() bin.Object { return &CanSendMessageToUserResultUserRestrictsNewChats{} }, - AccountTTLTypeID: func() bin.Object { return &AccountTTL{} }, - MessageAutoDeleteTimeTypeID: func() bin.Object { return &MessageAutoDeleteTime{} }, - SessionTypeAndroidTypeID: func() bin.Object { return &SessionTypeAndroid{} }, - SessionTypeAppleTypeID: func() bin.Object { return &SessionTypeApple{} }, - SessionTypeBraveTypeID: func() bin.Object { return &SessionTypeBrave{} }, - SessionTypeChromeTypeID: func() bin.Object { return &SessionTypeChrome{} }, - SessionTypeEdgeTypeID: func() bin.Object { return &SessionTypeEdge{} }, - SessionTypeFirefoxTypeID: func() bin.Object { return &SessionTypeFirefox{} }, - SessionTypeIpadTypeID: func() bin.Object { return &SessionTypeIpad{} }, - SessionTypeIphoneTypeID: func() bin.Object { return &SessionTypeIphone{} }, - SessionTypeLinuxTypeID: func() bin.Object { return &SessionTypeLinux{} }, - SessionTypeMACTypeID: func() bin.Object { return &SessionTypeMAC{} }, - SessionTypeOperaTypeID: func() bin.Object { return &SessionTypeOpera{} }, - SessionTypeSafariTypeID: func() bin.Object { return &SessionTypeSafari{} }, - SessionTypeUbuntuTypeID: func() bin.Object { return &SessionTypeUbuntu{} }, - SessionTypeUnknownTypeID: func() bin.Object { return &SessionTypeUnknown{} }, - SessionTypeVivaldiTypeID: func() bin.Object { return &SessionTypeVivaldi{} }, - SessionTypeWindowsTypeID: func() bin.Object { return &SessionTypeWindows{} }, - SessionTypeXboxTypeID: func() bin.Object { return &SessionTypeXbox{} }, - SessionTypeID: func() bin.Object { return &Session{} }, - SessionsTypeID: func() bin.Object { return &Sessions{} }, - UnconfirmedSessionTypeID: func() bin.Object { return &UnconfirmedSession{} }, - ConnectedWebsiteTypeID: func() bin.Object { return &ConnectedWebsite{} }, - ConnectedWebsitesTypeID: func() bin.Object { return &ConnectedWebsites{} }, - ReportReasonSpamTypeID: func() bin.Object { return &ReportReasonSpam{} }, - ReportReasonViolenceTypeID: func() bin.Object { return &ReportReasonViolence{} }, - ReportReasonPornographyTypeID: func() bin.Object { return &ReportReasonPornography{} }, - ReportReasonChildAbuseTypeID: func() bin.Object { return &ReportReasonChildAbuse{} }, - ReportReasonCopyrightTypeID: func() bin.Object { return &ReportReasonCopyright{} }, - ReportReasonUnrelatedLocationTypeID: func() bin.Object { return &ReportReasonUnrelatedLocation{} }, - ReportReasonFakeTypeID: func() bin.Object { return &ReportReasonFake{} }, - ReportReasonIllegalDrugsTypeID: func() bin.Object { return &ReportReasonIllegalDrugs{} }, - ReportReasonPersonalDetailsTypeID: func() bin.Object { return &ReportReasonPersonalDetails{} }, - ReportReasonCustomTypeID: func() bin.Object { return &ReportReasonCustom{} }, - ReportChatResultOkTypeID: func() bin.Object { return &ReportChatResultOk{} }, - ReportChatResultOptionRequiredTypeID: func() bin.Object { return &ReportChatResultOptionRequired{} }, - ReportChatResultTextRequiredTypeID: func() bin.Object { return &ReportChatResultTextRequired{} }, - ReportChatResultMessagesRequiredTypeID: func() bin.Object { return &ReportChatResultMessagesRequired{} }, - ReportStoryResultOkTypeID: func() bin.Object { return &ReportStoryResultOk{} }, - ReportStoryResultOptionRequiredTypeID: func() bin.Object { return &ReportStoryResultOptionRequired{} }, - ReportStoryResultTextRequiredTypeID: func() bin.Object { return &ReportStoryResultTextRequired{} }, - InternalLinkTypeActiveSessionsTypeID: func() bin.Object { return &InternalLinkTypeActiveSessions{} }, - InternalLinkTypeAttachmentMenuBotTypeID: func() bin.Object { return &InternalLinkTypeAttachmentMenuBot{} }, - InternalLinkTypeAuthenticationCodeTypeID: func() bin.Object { return &InternalLinkTypeAuthenticationCode{} }, - InternalLinkTypeBackgroundTypeID: func() bin.Object { return &InternalLinkTypeBackground{} }, - InternalLinkTypeBotAddToChannelTypeID: func() bin.Object { return &InternalLinkTypeBotAddToChannel{} }, - InternalLinkTypeBotStartTypeID: func() bin.Object { return &InternalLinkTypeBotStart{} }, - InternalLinkTypeBotStartInGroupTypeID: func() bin.Object { return &InternalLinkTypeBotStartInGroup{} }, - InternalLinkTypeBusinessChatTypeID: func() bin.Object { return &InternalLinkTypeBusinessChat{} }, - InternalLinkTypeBuyStarsTypeID: func() bin.Object { return &InternalLinkTypeBuyStars{} }, - InternalLinkTypeChangePhoneNumberTypeID: func() bin.Object { return &InternalLinkTypeChangePhoneNumber{} }, - InternalLinkTypeChatAffiliateProgramTypeID: func() bin.Object { return &InternalLinkTypeChatAffiliateProgram{} }, - InternalLinkTypeChatBoostTypeID: func() bin.Object { return &InternalLinkTypeChatBoost{} }, - InternalLinkTypeChatFolderInviteTypeID: func() bin.Object { return &InternalLinkTypeChatFolderInvite{} }, - InternalLinkTypeChatFolderSettingsTypeID: func() bin.Object { return &InternalLinkTypeChatFolderSettings{} }, - InternalLinkTypeChatInviteTypeID: func() bin.Object { return &InternalLinkTypeChatInvite{} }, - InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID: func() bin.Object { return &InternalLinkTypeDefaultMessageAutoDeleteTimerSettings{} }, - InternalLinkTypeEditProfileSettingsTypeID: func() bin.Object { return &InternalLinkTypeEditProfileSettings{} }, - InternalLinkTypeGameTypeID: func() bin.Object { return &InternalLinkTypeGame{} }, - InternalLinkTypeInstantViewTypeID: func() bin.Object { return &InternalLinkTypeInstantView{} }, - InternalLinkTypeInvoiceTypeID: func() bin.Object { return &InternalLinkTypeInvoice{} }, - InternalLinkTypeLanguagePackTypeID: func() bin.Object { return &InternalLinkTypeLanguagePack{} }, - InternalLinkTypeLanguageSettingsTypeID: func() bin.Object { return &InternalLinkTypeLanguageSettings{} }, - InternalLinkTypeMainWebAppTypeID: func() bin.Object { return &InternalLinkTypeMainWebApp{} }, - InternalLinkTypeMessageTypeID: func() bin.Object { return &InternalLinkTypeMessage{} }, - InternalLinkTypeMessageDraftTypeID: func() bin.Object { return &InternalLinkTypeMessageDraft{} }, - InternalLinkTypePassportDataRequestTypeID: func() bin.Object { return &InternalLinkTypePassportDataRequest{} }, - InternalLinkTypePhoneNumberConfirmationTypeID: func() bin.Object { return &InternalLinkTypePhoneNumberConfirmation{} }, - InternalLinkTypePremiumFeaturesTypeID: func() bin.Object { return &InternalLinkTypePremiumFeatures{} }, - InternalLinkTypePremiumGiftTypeID: func() bin.Object { return &InternalLinkTypePremiumGift{} }, - InternalLinkTypePremiumGiftCodeTypeID: func() bin.Object { return &InternalLinkTypePremiumGiftCode{} }, - InternalLinkTypePrivacyAndSecuritySettingsTypeID: func() bin.Object { return &InternalLinkTypePrivacyAndSecuritySettings{} }, - InternalLinkTypeProxyTypeID: func() bin.Object { return &InternalLinkTypeProxy{} }, - InternalLinkTypePublicChatTypeID: func() bin.Object { return &InternalLinkTypePublicChat{} }, - InternalLinkTypeQrCodeAuthenticationTypeID: func() bin.Object { return &InternalLinkTypeQrCodeAuthentication{} }, - InternalLinkTypeRestorePurchasesTypeID: func() bin.Object { return &InternalLinkTypeRestorePurchases{} }, - InternalLinkTypeSettingsTypeID: func() bin.Object { return &InternalLinkTypeSettings{} }, - InternalLinkTypeStickerSetTypeID: func() bin.Object { return &InternalLinkTypeStickerSet{} }, - InternalLinkTypeStoryTypeID: func() bin.Object { return &InternalLinkTypeStory{} }, - InternalLinkTypeThemeTypeID: func() bin.Object { return &InternalLinkTypeTheme{} }, - InternalLinkTypeThemeSettingsTypeID: func() bin.Object { return &InternalLinkTypeThemeSettings{} }, - InternalLinkTypeUnknownDeepLinkTypeID: func() bin.Object { return &InternalLinkTypeUnknownDeepLink{} }, - InternalLinkTypeUnsupportedProxyTypeID: func() bin.Object { return &InternalLinkTypeUnsupportedProxy{} }, - InternalLinkTypeUserPhoneNumberTypeID: func() bin.Object { return &InternalLinkTypeUserPhoneNumber{} }, - InternalLinkTypeUserTokenTypeID: func() bin.Object { return &InternalLinkTypeUserToken{} }, - InternalLinkTypeVideoChatTypeID: func() bin.Object { return &InternalLinkTypeVideoChat{} }, - InternalLinkTypeWebAppTypeID: func() bin.Object { return &InternalLinkTypeWebApp{} }, - MessageLinkTypeID: func() bin.Object { return &MessageLink{} }, - MessageLinkInfoTypeID: func() bin.Object { return &MessageLinkInfo{} }, - ChatBoostLinkTypeID: func() bin.Object { return &ChatBoostLink{} }, - ChatBoostLinkInfoTypeID: func() bin.Object { return &ChatBoostLinkInfo{} }, - BlockListMainTypeID: func() bin.Object { return &BlockListMain{} }, - BlockListStoriesTypeID: func() bin.Object { return &BlockListStories{} }, - FilePartTypeID: func() bin.Object { return &FilePart{} }, - FileTypeNoneTypeID: func() bin.Object { return &FileTypeNone{} }, - FileTypeAnimationTypeID: func() bin.Object { return &FileTypeAnimation{} }, - FileTypeAudioTypeID: func() bin.Object { return &FileTypeAudio{} }, - FileTypeDocumentTypeID: func() bin.Object { return &FileTypeDocument{} }, - FileTypeNotificationSoundTypeID: func() bin.Object { return &FileTypeNotificationSound{} }, - FileTypePhotoTypeID: func() bin.Object { return &FileTypePhoto{} }, - FileTypePhotoStoryTypeID: func() bin.Object { return &FileTypePhotoStory{} }, - FileTypeProfilePhotoTypeID: func() bin.Object { return &FileTypeProfilePhoto{} }, - FileTypeSecretTypeID: func() bin.Object { return &FileTypeSecret{} }, - FileTypeSecretThumbnailTypeID: func() bin.Object { return &FileTypeSecretThumbnail{} }, - FileTypeSecureTypeID: func() bin.Object { return &FileTypeSecure{} }, - FileTypeSelfDestructingPhotoTypeID: func() bin.Object { return &FileTypeSelfDestructingPhoto{} }, - FileTypeSelfDestructingVideoTypeID: func() bin.Object { return &FileTypeSelfDestructingVideo{} }, - FileTypeSelfDestructingVideoNoteTypeID: func() bin.Object { return &FileTypeSelfDestructingVideoNote{} }, - FileTypeSelfDestructingVoiceNoteTypeID: func() bin.Object { return &FileTypeSelfDestructingVoiceNote{} }, - FileTypeStickerTypeID: func() bin.Object { return &FileTypeSticker{} }, - FileTypeThumbnailTypeID: func() bin.Object { return &FileTypeThumbnail{} }, - FileTypeUnknownTypeID: func() bin.Object { return &FileTypeUnknown{} }, - FileTypeVideoTypeID: func() bin.Object { return &FileTypeVideo{} }, - FileTypeVideoNoteTypeID: func() bin.Object { return &FileTypeVideoNote{} }, - FileTypeVideoStoryTypeID: func() bin.Object { return &FileTypeVideoStory{} }, - FileTypeVoiceNoteTypeID: func() bin.Object { return &FileTypeVoiceNote{} }, - FileTypeWallpaperTypeID: func() bin.Object { return &FileTypeWallpaper{} }, - StorageStatisticsByFileTypeTypeID: func() bin.Object { return &StorageStatisticsByFileType{} }, - StorageStatisticsByChatTypeID: func() bin.Object { return &StorageStatisticsByChat{} }, - StorageStatisticsTypeID: func() bin.Object { return &StorageStatistics{} }, - StorageStatisticsFastTypeID: func() bin.Object { return &StorageStatisticsFast{} }, - DatabaseStatisticsTypeID: func() bin.Object { return &DatabaseStatistics{} }, - NetworkTypeNoneTypeID: func() bin.Object { return &NetworkTypeNone{} }, - NetworkTypeMobileTypeID: func() bin.Object { return &NetworkTypeMobile{} }, - NetworkTypeMobileRoamingTypeID: func() bin.Object { return &NetworkTypeMobileRoaming{} }, - NetworkTypeWiFiTypeID: func() bin.Object { return &NetworkTypeWiFi{} }, - NetworkTypeOtherTypeID: func() bin.Object { return &NetworkTypeOther{} }, - NetworkStatisticsEntryFileTypeID: func() bin.Object { return &NetworkStatisticsEntryFile{} }, - NetworkStatisticsEntryCallTypeID: func() bin.Object { return &NetworkStatisticsEntryCall{} }, - NetworkStatisticsTypeID: func() bin.Object { return &NetworkStatistics{} }, - AutoDownloadSettingsTypeID: func() bin.Object { return &AutoDownloadSettings{} }, - AutoDownloadSettingsPresetsTypeID: func() bin.Object { return &AutoDownloadSettingsPresets{} }, - AutosaveSettingsScopePrivateChatsTypeID: func() bin.Object { return &AutosaveSettingsScopePrivateChats{} }, - AutosaveSettingsScopeGroupChatsTypeID: func() bin.Object { return &AutosaveSettingsScopeGroupChats{} }, - AutosaveSettingsScopeChannelChatsTypeID: func() bin.Object { return &AutosaveSettingsScopeChannelChats{} }, - AutosaveSettingsScopeChatTypeID: func() bin.Object { return &AutosaveSettingsScopeChat{} }, - ScopeAutosaveSettingsTypeID: func() bin.Object { return &ScopeAutosaveSettings{} }, - AutosaveSettingsExceptionTypeID: func() bin.Object { return &AutosaveSettingsException{} }, - AutosaveSettingsTypeID: func() bin.Object { return &AutosaveSettings{} }, - ConnectionStateWaitingForNetworkTypeID: func() bin.Object { return &ConnectionStateWaitingForNetwork{} }, - ConnectionStateConnectingToProxyTypeID: func() bin.Object { return &ConnectionStateConnectingToProxy{} }, - ConnectionStateConnectingTypeID: func() bin.Object { return &ConnectionStateConnecting{} }, - ConnectionStateUpdatingTypeID: func() bin.Object { return &ConnectionStateUpdating{} }, - ConnectionStateReadyTypeID: func() bin.Object { return &ConnectionStateReady{} }, - TopChatCategoryUsersTypeID: func() bin.Object { return &TopChatCategoryUsers{} }, - TopChatCategoryBotsTypeID: func() bin.Object { return &TopChatCategoryBots{} }, - TopChatCategoryGroupsTypeID: func() bin.Object { return &TopChatCategoryGroups{} }, - TopChatCategoryChannelsTypeID: func() bin.Object { return &TopChatCategoryChannels{} }, - TopChatCategoryInlineBotsTypeID: func() bin.Object { return &TopChatCategoryInlineBots{} }, - TopChatCategoryWebAppBotsTypeID: func() bin.Object { return &TopChatCategoryWebAppBots{} }, - TopChatCategoryCallsTypeID: func() bin.Object { return &TopChatCategoryCalls{} }, - TopChatCategoryForwardChatsTypeID: func() bin.Object { return &TopChatCategoryForwardChats{} }, - FoundPositionTypeID: func() bin.Object { return &FoundPosition{} }, - FoundPositionsTypeID: func() bin.Object { return &FoundPositions{} }, - TMeURLTypeUserTypeID: func() bin.Object { return &TMeURLTypeUser{} }, - TMeURLTypeSupergroupTypeID: func() bin.Object { return &TMeURLTypeSupergroup{} }, - TMeURLTypeChatInviteTypeID: func() bin.Object { return &TMeURLTypeChatInvite{} }, - TMeURLTypeStickerSetTypeID: func() bin.Object { return &TMeURLTypeStickerSet{} }, - TMeURLTypeID: func() bin.Object { return &TMeURL{} }, - TMeURLsTypeID: func() bin.Object { return &TMeURLs{} }, - SuggestedActionEnableArchiveAndMuteNewChatsTypeID: func() bin.Object { return &SuggestedActionEnableArchiveAndMuteNewChats{} }, - SuggestedActionCheckPasswordTypeID: func() bin.Object { return &SuggestedActionCheckPassword{} }, - SuggestedActionCheckPhoneNumberTypeID: func() bin.Object { return &SuggestedActionCheckPhoneNumber{} }, - SuggestedActionViewChecksHintTypeID: func() bin.Object { return &SuggestedActionViewChecksHint{} }, - SuggestedActionConvertToBroadcastGroupTypeID: func() bin.Object { return &SuggestedActionConvertToBroadcastGroup{} }, - SuggestedActionSetPasswordTypeID: func() bin.Object { return &SuggestedActionSetPassword{} }, - SuggestedActionUpgradePremiumTypeID: func() bin.Object { return &SuggestedActionUpgradePremium{} }, - SuggestedActionRestorePremiumTypeID: func() bin.Object { return &SuggestedActionRestorePremium{} }, - SuggestedActionSubscribeToAnnualPremiumTypeID: func() bin.Object { return &SuggestedActionSubscribeToAnnualPremium{} }, - SuggestedActionGiftPremiumForChristmasTypeID: func() bin.Object { return &SuggestedActionGiftPremiumForChristmas{} }, - SuggestedActionSetBirthdateTypeID: func() bin.Object { return &SuggestedActionSetBirthdate{} }, - SuggestedActionSetProfilePhotoTypeID: func() bin.Object { return &SuggestedActionSetProfilePhoto{} }, - SuggestedActionExtendPremiumTypeID: func() bin.Object { return &SuggestedActionExtendPremium{} }, - SuggestedActionExtendStarSubscriptionsTypeID: func() bin.Object { return &SuggestedActionExtendStarSubscriptions{} }, - CountTypeID: func() bin.Object { return &Count{} }, - TextTypeID: func() bin.Object { return &Text{} }, - SecondsTypeID: func() bin.Object { return &Seconds{} }, - FileDownloadedPrefixSizeTypeID: func() bin.Object { return &FileDownloadedPrefixSize{} }, - DeepLinkInfoTypeID: func() bin.Object { return &DeepLinkInfo{} }, - TextParseModeMarkdownTypeID: func() bin.Object { return &TextParseModeMarkdown{} }, - TextParseModeHTMLTypeID: func() bin.Object { return &TextParseModeHTML{} }, - ProxyTypeSocks5TypeID: func() bin.Object { return &ProxyTypeSocks5{} }, - ProxyTypeHTTPTypeID: func() bin.Object { return &ProxyTypeHTTP{} }, - ProxyTypeMtprotoTypeID: func() bin.Object { return &ProxyTypeMtproto{} }, - ProxyTypeID: func() bin.Object { return &Proxy{} }, - ProxiesTypeID: func() bin.Object { return &Proxies{} }, - InputStickerTypeID: func() bin.Object { return &InputSticker{} }, - DateRangeTypeID: func() bin.Object { return &DateRange{} }, - StatisticalValueTypeID: func() bin.Object { return &StatisticalValue{} }, - StatisticalGraphDataTypeID: func() bin.Object { return &StatisticalGraphData{} }, - StatisticalGraphAsyncTypeID: func() bin.Object { return &StatisticalGraphAsync{} }, - StatisticalGraphErrorTypeID: func() bin.Object { return &StatisticalGraphError{} }, - ChatStatisticsObjectTypeMessageTypeID: func() bin.Object { return &ChatStatisticsObjectTypeMessage{} }, - ChatStatisticsObjectTypeStoryTypeID: func() bin.Object { return &ChatStatisticsObjectTypeStory{} }, - ChatStatisticsInteractionInfoTypeID: func() bin.Object { return &ChatStatisticsInteractionInfo{} }, - ChatStatisticsMessageSenderInfoTypeID: func() bin.Object { return &ChatStatisticsMessageSenderInfo{} }, - ChatStatisticsAdministratorActionsInfoTypeID: func() bin.Object { return &ChatStatisticsAdministratorActionsInfo{} }, - ChatStatisticsInviterInfoTypeID: func() bin.Object { return &ChatStatisticsInviterInfo{} }, - ChatStatisticsSupergroupTypeID: func() bin.Object { return &ChatStatisticsSupergroup{} }, - ChatStatisticsChannelTypeID: func() bin.Object { return &ChatStatisticsChannel{} }, - ChatRevenueAmountTypeID: func() bin.Object { return &ChatRevenueAmount{} }, - ChatRevenueStatisticsTypeID: func() bin.Object { return &ChatRevenueStatistics{} }, - MessageStatisticsTypeID: func() bin.Object { return &MessageStatistics{} }, - StoryStatisticsTypeID: func() bin.Object { return &StoryStatistics{} }, - RevenueWithdrawalStatePendingTypeID: func() bin.Object { return &RevenueWithdrawalStatePending{} }, - RevenueWithdrawalStateSucceededTypeID: func() bin.Object { return &RevenueWithdrawalStateSucceeded{} }, - RevenueWithdrawalStateFailedTypeID: func() bin.Object { return &RevenueWithdrawalStateFailed{} }, - ChatRevenueTransactionTypeEarningsTypeID: func() bin.Object { return &ChatRevenueTransactionTypeEarnings{} }, - ChatRevenueTransactionTypeWithdrawalTypeID: func() bin.Object { return &ChatRevenueTransactionTypeWithdrawal{} }, - ChatRevenueTransactionTypeRefundTypeID: func() bin.Object { return &ChatRevenueTransactionTypeRefund{} }, - ChatRevenueTransactionTypeID: func() bin.Object { return &ChatRevenueTransaction{} }, - ChatRevenueTransactionsTypeID: func() bin.Object { return &ChatRevenueTransactions{} }, - StarRevenueStatusTypeID: func() bin.Object { return &StarRevenueStatus{} }, - StarRevenueStatisticsTypeID: func() bin.Object { return &StarRevenueStatistics{} }, - PointTypeID: func() bin.Object { return &Point{} }, - VectorPathCommandLineTypeID: func() bin.Object { return &VectorPathCommandLine{} }, - VectorPathCommandCubicBezierCurveTypeID: func() bin.Object { return &VectorPathCommandCubicBezierCurve{} }, - BotCommandScopeDefaultTypeID: func() bin.Object { return &BotCommandScopeDefault{} }, - BotCommandScopeAllPrivateChatsTypeID: func() bin.Object { return &BotCommandScopeAllPrivateChats{} }, - BotCommandScopeAllGroupChatsTypeID: func() bin.Object { return &BotCommandScopeAllGroupChats{} }, - BotCommandScopeAllChatAdministratorsTypeID: func() bin.Object { return &BotCommandScopeAllChatAdministrators{} }, - BotCommandScopeChatTypeID: func() bin.Object { return &BotCommandScopeChat{} }, - BotCommandScopeChatAdministratorsTypeID: func() bin.Object { return &BotCommandScopeChatAdministrators{} }, - BotCommandScopeChatMemberTypeID: func() bin.Object { return &BotCommandScopeChatMember{} }, - PhoneNumberCodeTypeChangeTypeID: func() bin.Object { return &PhoneNumberCodeTypeChange{} }, - PhoneNumberCodeTypeVerifyTypeID: func() bin.Object { return &PhoneNumberCodeTypeVerify{} }, - PhoneNumberCodeTypeConfirmOwnershipTypeID: func() bin.Object { return &PhoneNumberCodeTypeConfirmOwnership{} }, - UpdateAuthorizationStateTypeID: func() bin.Object { return &UpdateAuthorizationState{} }, - UpdateNewMessageTypeID: func() bin.Object { return &UpdateNewMessage{} }, - UpdateMessageSendAcknowledgedTypeID: func() bin.Object { return &UpdateMessageSendAcknowledged{} }, - UpdateMessageSendSucceededTypeID: func() bin.Object { return &UpdateMessageSendSucceeded{} }, - UpdateMessageSendFailedTypeID: func() bin.Object { return &UpdateMessageSendFailed{} }, - UpdateMessageContentTypeID: func() bin.Object { return &UpdateMessageContent{} }, - UpdateMessageEditedTypeID: func() bin.Object { return &UpdateMessageEdited{} }, - UpdateMessageIsPinnedTypeID: func() bin.Object { return &UpdateMessageIsPinned{} }, - UpdateMessageInteractionInfoTypeID: func() bin.Object { return &UpdateMessageInteractionInfo{} }, - UpdateMessageContentOpenedTypeID: func() bin.Object { return &UpdateMessageContentOpened{} }, - UpdateMessageMentionReadTypeID: func() bin.Object { return &UpdateMessageMentionRead{} }, - UpdateMessageUnreadReactionsTypeID: func() bin.Object { return &UpdateMessageUnreadReactions{} }, - UpdateMessageFactCheckTypeID: func() bin.Object { return &UpdateMessageFactCheck{} }, - UpdateMessageLiveLocationViewedTypeID: func() bin.Object { return &UpdateMessageLiveLocationViewed{} }, - UpdateVideoPublishedTypeID: func() bin.Object { return &UpdateVideoPublished{} }, - UpdateNewChatTypeID: func() bin.Object { return &UpdateNewChat{} }, - UpdateChatTitleTypeID: func() bin.Object { return &UpdateChatTitle{} }, - UpdateChatPhotoTypeID: func() bin.Object { return &UpdateChatPhoto{} }, - UpdateChatAccentColorsTypeID: func() bin.Object { return &UpdateChatAccentColors{} }, - UpdateChatPermissionsTypeID: func() bin.Object { return &UpdateChatPermissions{} }, - UpdateChatLastMessageTypeID: func() bin.Object { return &UpdateChatLastMessage{} }, - UpdateChatPositionTypeID: func() bin.Object { return &UpdateChatPosition{} }, - UpdateChatAddedToListTypeID: func() bin.Object { return &UpdateChatAddedToList{} }, - UpdateChatRemovedFromListTypeID: func() bin.Object { return &UpdateChatRemovedFromList{} }, - UpdateChatReadInboxTypeID: func() bin.Object { return &UpdateChatReadInbox{} }, - UpdateChatReadOutboxTypeID: func() bin.Object { return &UpdateChatReadOutbox{} }, - UpdateChatActionBarTypeID: func() bin.Object { return &UpdateChatActionBar{} }, - UpdateChatBusinessBotManageBarTypeID: func() bin.Object { return &UpdateChatBusinessBotManageBar{} }, - UpdateChatAvailableReactionsTypeID: func() bin.Object { return &UpdateChatAvailableReactions{} }, - UpdateChatDraftMessageTypeID: func() bin.Object { return &UpdateChatDraftMessage{} }, - UpdateChatEmojiStatusTypeID: func() bin.Object { return &UpdateChatEmojiStatus{} }, - UpdateChatMessageSenderTypeID: func() bin.Object { return &UpdateChatMessageSender{} }, - UpdateChatMessageAutoDeleteTimeTypeID: func() bin.Object { return &UpdateChatMessageAutoDeleteTime{} }, - UpdateChatNotificationSettingsTypeID: func() bin.Object { return &UpdateChatNotificationSettings{} }, - UpdateChatPendingJoinRequestsTypeID: func() bin.Object { return &UpdateChatPendingJoinRequests{} }, - UpdateChatReplyMarkupTypeID: func() bin.Object { return &UpdateChatReplyMarkup{} }, - UpdateChatBackgroundTypeID: func() bin.Object { return &UpdateChatBackground{} }, - UpdateChatThemeTypeID: func() bin.Object { return &UpdateChatTheme{} }, - UpdateChatUnreadMentionCountTypeID: func() bin.Object { return &UpdateChatUnreadMentionCount{} }, - UpdateChatUnreadReactionCountTypeID: func() bin.Object { return &UpdateChatUnreadReactionCount{} }, - UpdateChatVideoChatTypeID: func() bin.Object { return &UpdateChatVideoChat{} }, - UpdateChatDefaultDisableNotificationTypeID: func() bin.Object { return &UpdateChatDefaultDisableNotification{} }, - UpdateChatHasProtectedContentTypeID: func() bin.Object { return &UpdateChatHasProtectedContent{} }, - UpdateChatIsTranslatableTypeID: func() bin.Object { return &UpdateChatIsTranslatable{} }, - UpdateChatIsMarkedAsUnreadTypeID: func() bin.Object { return &UpdateChatIsMarkedAsUnread{} }, - UpdateChatViewAsTopicsTypeID: func() bin.Object { return &UpdateChatViewAsTopics{} }, - UpdateChatBlockListTypeID: func() bin.Object { return &UpdateChatBlockList{} }, - UpdateChatHasScheduledMessagesTypeID: func() bin.Object { return &UpdateChatHasScheduledMessages{} }, - UpdateChatFoldersTypeID: func() bin.Object { return &UpdateChatFolders{} }, - UpdateChatOnlineMemberCountTypeID: func() bin.Object { return &UpdateChatOnlineMemberCount{} }, - UpdateSavedMessagesTopicTypeID: func() bin.Object { return &UpdateSavedMessagesTopic{} }, - UpdateSavedMessagesTopicCountTypeID: func() bin.Object { return &UpdateSavedMessagesTopicCount{} }, - UpdateQuickReplyShortcutTypeID: func() bin.Object { return &UpdateQuickReplyShortcut{} }, - UpdateQuickReplyShortcutDeletedTypeID: func() bin.Object { return &UpdateQuickReplyShortcutDeleted{} }, - UpdateQuickReplyShortcutsTypeID: func() bin.Object { return &UpdateQuickReplyShortcuts{} }, - UpdateQuickReplyShortcutMessagesTypeID: func() bin.Object { return &UpdateQuickReplyShortcutMessages{} }, - UpdateForumTopicInfoTypeID: func() bin.Object { return &UpdateForumTopicInfo{} }, - UpdateScopeNotificationSettingsTypeID: func() bin.Object { return &UpdateScopeNotificationSettings{} }, - UpdateReactionNotificationSettingsTypeID: func() bin.Object { return &UpdateReactionNotificationSettings{} }, - UpdateNotificationTypeID: func() bin.Object { return &UpdateNotification{} }, - UpdateNotificationGroupTypeID: func() bin.Object { return &UpdateNotificationGroup{} }, - UpdateActiveNotificationsTypeID: func() bin.Object { return &UpdateActiveNotifications{} }, - UpdateHavePendingNotificationsTypeID: func() bin.Object { return &UpdateHavePendingNotifications{} }, - UpdateDeleteMessagesTypeID: func() bin.Object { return &UpdateDeleteMessages{} }, - UpdateChatActionTypeID: func() bin.Object { return &UpdateChatAction{} }, - UpdateUserStatusTypeID: func() bin.Object { return &UpdateUserStatus{} }, - UpdateUserTypeID: func() bin.Object { return &UpdateUser{} }, - UpdateBasicGroupTypeID: func() bin.Object { return &UpdateBasicGroup{} }, - UpdateSupergroupTypeID: func() bin.Object { return &UpdateSupergroup{} }, - UpdateSecretChatTypeID: func() bin.Object { return &UpdateSecretChat{} }, - UpdateUserFullInfoTypeID: func() bin.Object { return &UpdateUserFullInfo{} }, - UpdateBasicGroupFullInfoTypeID: func() bin.Object { return &UpdateBasicGroupFullInfo{} }, - UpdateSupergroupFullInfoTypeID: func() bin.Object { return &UpdateSupergroupFullInfo{} }, - UpdateServiceNotificationTypeID: func() bin.Object { return &UpdateServiceNotification{} }, - UpdateFileTypeID: func() bin.Object { return &UpdateFile{} }, - UpdateFileGenerationStartTypeID: func() bin.Object { return &UpdateFileGenerationStart{} }, - UpdateFileGenerationStopTypeID: func() bin.Object { return &UpdateFileGenerationStop{} }, - UpdateFileDownloadsTypeID: func() bin.Object { return &UpdateFileDownloads{} }, - UpdateFileAddedToDownloadsTypeID: func() bin.Object { return &UpdateFileAddedToDownloads{} }, - UpdateFileDownloadTypeID: func() bin.Object { return &UpdateFileDownload{} }, - UpdateFileRemovedFromDownloadsTypeID: func() bin.Object { return &UpdateFileRemovedFromDownloads{} }, - UpdateApplicationVerificationRequiredTypeID: func() bin.Object { return &UpdateApplicationVerificationRequired{} }, - UpdateCallTypeID: func() bin.Object { return &UpdateCall{} }, - UpdateGroupCallTypeID: func() bin.Object { return &UpdateGroupCall{} }, - UpdateGroupCallParticipantTypeID: func() bin.Object { return &UpdateGroupCallParticipant{} }, - UpdateNewCallSignalingDataTypeID: func() bin.Object { return &UpdateNewCallSignalingData{} }, - UpdateUserPrivacySettingRulesTypeID: func() bin.Object { return &UpdateUserPrivacySettingRules{} }, - UpdateUnreadMessageCountTypeID: func() bin.Object { return &UpdateUnreadMessageCount{} }, - UpdateUnreadChatCountTypeID: func() bin.Object { return &UpdateUnreadChatCount{} }, - UpdateStoryTypeID: func() bin.Object { return &UpdateStory{} }, - UpdateStoryDeletedTypeID: func() bin.Object { return &UpdateStoryDeleted{} }, - UpdateStorySendSucceededTypeID: func() bin.Object { return &UpdateStorySendSucceeded{} }, - UpdateStorySendFailedTypeID: func() bin.Object { return &UpdateStorySendFailed{} }, - UpdateChatActiveStoriesTypeID: func() bin.Object { return &UpdateChatActiveStories{} }, - UpdateStoryListChatCountTypeID: func() bin.Object { return &UpdateStoryListChatCount{} }, - UpdateStoryStealthModeTypeID: func() bin.Object { return &UpdateStoryStealthMode{} }, - UpdateOptionTypeID: func() bin.Object { return &UpdateOption{} }, - UpdateStickerSetTypeID: func() bin.Object { return &UpdateStickerSet{} }, - UpdateInstalledStickerSetsTypeID: func() bin.Object { return &UpdateInstalledStickerSets{} }, - UpdateTrendingStickerSetsTypeID: func() bin.Object { return &UpdateTrendingStickerSets{} }, - UpdateRecentStickersTypeID: func() bin.Object { return &UpdateRecentStickers{} }, - UpdateFavoriteStickersTypeID: func() bin.Object { return &UpdateFavoriteStickers{} }, - UpdateSavedAnimationsTypeID: func() bin.Object { return &UpdateSavedAnimations{} }, - UpdateSavedNotificationSoundsTypeID: func() bin.Object { return &UpdateSavedNotificationSounds{} }, - UpdateDefaultBackgroundTypeID: func() bin.Object { return &UpdateDefaultBackground{} }, - UpdateChatThemesTypeID: func() bin.Object { return &UpdateChatThemes{} }, - UpdateAccentColorsTypeID: func() bin.Object { return &UpdateAccentColors{} }, - UpdateProfileAccentColorsTypeID: func() bin.Object { return &UpdateProfileAccentColors{} }, - UpdateLanguagePackStringsTypeID: func() bin.Object { return &UpdateLanguagePackStrings{} }, - UpdateConnectionStateTypeID: func() bin.Object { return &UpdateConnectionState{} }, - UpdateTermsOfServiceTypeID: func() bin.Object { return &UpdateTermsOfService{} }, - UpdateUnconfirmedSessionTypeID: func() bin.Object { return &UpdateUnconfirmedSession{} }, - UpdateAttachmentMenuBotsTypeID: func() bin.Object { return &UpdateAttachmentMenuBots{} }, - UpdateWebAppMessageSentTypeID: func() bin.Object { return &UpdateWebAppMessageSent{} }, - UpdateActiveEmojiReactionsTypeID: func() bin.Object { return &UpdateActiveEmojiReactions{} }, - UpdateAvailableMessageEffectsTypeID: func() bin.Object { return &UpdateAvailableMessageEffects{} }, - UpdateDefaultReactionTypeTypeID: func() bin.Object { return &UpdateDefaultReactionType{} }, - UpdateSavedMessagesTagsTypeID: func() bin.Object { return &UpdateSavedMessagesTags{} }, - UpdateActiveLiveLocationMessagesTypeID: func() bin.Object { return &UpdateActiveLiveLocationMessages{} }, - UpdateOwnedStarCountTypeID: func() bin.Object { return &UpdateOwnedStarCount{} }, - UpdateChatRevenueAmountTypeID: func() bin.Object { return &UpdateChatRevenueAmount{} }, - UpdateStarRevenueStatusTypeID: func() bin.Object { return &UpdateStarRevenueStatus{} }, - UpdateSpeechRecognitionTrialTypeID: func() bin.Object { return &UpdateSpeechRecognitionTrial{} }, - UpdateDiceEmojisTypeID: func() bin.Object { return &UpdateDiceEmojis{} }, - UpdateAnimatedEmojiMessageClickedTypeID: func() bin.Object { return &UpdateAnimatedEmojiMessageClicked{} }, - UpdateAnimationSearchParametersTypeID: func() bin.Object { return &UpdateAnimationSearchParameters{} }, - UpdateSuggestedActionsTypeID: func() bin.Object { return &UpdateSuggestedActions{} }, - UpdateSpeedLimitNotificationTypeID: func() bin.Object { return &UpdateSpeedLimitNotification{} }, - UpdateContactCloseBirthdaysTypeID: func() bin.Object { return &UpdateContactCloseBirthdays{} }, - UpdateAutosaveSettingsTypeID: func() bin.Object { return &UpdateAutosaveSettings{} }, - UpdateBusinessConnectionTypeID: func() bin.Object { return &UpdateBusinessConnection{} }, - UpdateNewBusinessMessageTypeID: func() bin.Object { return &UpdateNewBusinessMessage{} }, - UpdateBusinessMessageEditedTypeID: func() bin.Object { return &UpdateBusinessMessageEdited{} }, - UpdateBusinessMessagesDeletedTypeID: func() bin.Object { return &UpdateBusinessMessagesDeleted{} }, - UpdateNewInlineQueryTypeID: func() bin.Object { return &UpdateNewInlineQuery{} }, - UpdateNewChosenInlineResultTypeID: func() bin.Object { return &UpdateNewChosenInlineResult{} }, - UpdateNewCallbackQueryTypeID: func() bin.Object { return &UpdateNewCallbackQuery{} }, - UpdateNewInlineCallbackQueryTypeID: func() bin.Object { return &UpdateNewInlineCallbackQuery{} }, - UpdateNewBusinessCallbackQueryTypeID: func() bin.Object { return &UpdateNewBusinessCallbackQuery{} }, - UpdateNewShippingQueryTypeID: func() bin.Object { return &UpdateNewShippingQuery{} }, - UpdateNewPreCheckoutQueryTypeID: func() bin.Object { return &UpdateNewPreCheckoutQuery{} }, - UpdateNewCustomEventTypeID: func() bin.Object { return &UpdateNewCustomEvent{} }, - UpdateNewCustomQueryTypeID: func() bin.Object { return &UpdateNewCustomQuery{} }, - UpdatePollTypeID: func() bin.Object { return &UpdatePoll{} }, - UpdatePollAnswerTypeID: func() bin.Object { return &UpdatePollAnswer{} }, - UpdateChatMemberTypeID: func() bin.Object { return &UpdateChatMember{} }, - UpdateNewChatJoinRequestTypeID: func() bin.Object { return &UpdateNewChatJoinRequest{} }, - UpdateChatBoostTypeID: func() bin.Object { return &UpdateChatBoost{} }, - UpdateMessageReactionTypeID: func() bin.Object { return &UpdateMessageReaction{} }, - UpdateMessageReactionsTypeID: func() bin.Object { return &UpdateMessageReactions{} }, - UpdatePaidMediaPurchasedTypeID: func() bin.Object { return &UpdatePaidMediaPurchased{} }, - UpdatesTypeID: func() bin.Object { return &Updates{} }, - LogStreamDefaultTypeID: func() bin.Object { return &LogStreamDefault{} }, - LogStreamFileTypeID: func() bin.Object { return &LogStreamFile{} }, - LogStreamEmptyTypeID: func() bin.Object { return &LogStreamEmpty{} }, - LogVerbosityLevelTypeID: func() bin.Object { return &LogVerbosityLevel{} }, - LogTagsTypeID: func() bin.Object { return &LogTags{} }, - UserSupportInfoTypeID: func() bin.Object { return &UserSupportInfo{} }, - TestIntTypeID: func() bin.Object { return &TestInt{} }, - TestStringTypeID: func() bin.Object { return &TestString{} }, - TestBytesTypeID: func() bin.Object { return &TestBytes{} }, - TestVectorIntTypeID: func() bin.Object { return &TestVectorInt{} }, - TestVectorIntObjectTypeID: func() bin.Object { return &TestVectorIntObject{} }, - TestVectorStringTypeID: func() bin.Object { return &TestVectorString{} }, - TestVectorStringObjectTypeID: func() bin.Object { return &TestVectorStringObject{} }, - GetAuthorizationStateRequestTypeID: func() bin.Object { return &GetAuthorizationStateRequest{} }, - SetTdlibParametersRequestTypeID: func() bin.Object { return &SetTdlibParametersRequest{} }, - SetAuthenticationPhoneNumberRequestTypeID: func() bin.Object { return &SetAuthenticationPhoneNumberRequest{} }, - SetAuthenticationEmailAddressRequestTypeID: func() bin.Object { return &SetAuthenticationEmailAddressRequest{} }, - ResendAuthenticationCodeRequestTypeID: func() bin.Object { return &ResendAuthenticationCodeRequest{} }, - CheckAuthenticationEmailCodeRequestTypeID: func() bin.Object { return &CheckAuthenticationEmailCodeRequest{} }, - CheckAuthenticationCodeRequestTypeID: func() bin.Object { return &CheckAuthenticationCodeRequest{} }, - RequestQrCodeAuthenticationRequestTypeID: func() bin.Object { return &RequestQrCodeAuthenticationRequest{} }, - RegisterUserRequestTypeID: func() bin.Object { return &RegisterUserRequest{} }, - ResetAuthenticationEmailAddressRequestTypeID: func() bin.Object { return &ResetAuthenticationEmailAddressRequest{} }, - CheckAuthenticationPasswordRequestTypeID: func() bin.Object { return &CheckAuthenticationPasswordRequest{} }, - RequestAuthenticationPasswordRecoveryRequestTypeID: func() bin.Object { return &RequestAuthenticationPasswordRecoveryRequest{} }, - CheckAuthenticationPasswordRecoveryCodeRequestTypeID: func() bin.Object { return &CheckAuthenticationPasswordRecoveryCodeRequest{} }, - RecoverAuthenticationPasswordRequestTypeID: func() bin.Object { return &RecoverAuthenticationPasswordRequest{} }, - SendAuthenticationFirebaseSMSRequestTypeID: func() bin.Object { return &SendAuthenticationFirebaseSMSRequest{} }, - ReportAuthenticationCodeMissingRequestTypeID: func() bin.Object { return &ReportAuthenticationCodeMissingRequest{} }, - CheckAuthenticationBotTokenRequestTypeID: func() bin.Object { return &CheckAuthenticationBotTokenRequest{} }, - LogOutRequestTypeID: func() bin.Object { return &LogOutRequest{} }, - CloseRequestTypeID: func() bin.Object { return &CloseRequest{} }, - DestroyRequestTypeID: func() bin.Object { return &DestroyRequest{} }, - ConfirmQrCodeAuthenticationRequestTypeID: func() bin.Object { return &ConfirmQrCodeAuthenticationRequest{} }, - GetCurrentStateRequestTypeID: func() bin.Object { return &GetCurrentStateRequest{} }, - SetDatabaseEncryptionKeyRequestTypeID: func() bin.Object { return &SetDatabaseEncryptionKeyRequest{} }, - GetPasswordStateRequestTypeID: func() bin.Object { return &GetPasswordStateRequest{} }, - SetPasswordRequestTypeID: func() bin.Object { return &SetPasswordRequest{} }, - SetLoginEmailAddressRequestTypeID: func() bin.Object { return &SetLoginEmailAddressRequest{} }, - ResendLoginEmailAddressCodeRequestTypeID: func() bin.Object { return &ResendLoginEmailAddressCodeRequest{} }, - CheckLoginEmailAddressCodeRequestTypeID: func() bin.Object { return &CheckLoginEmailAddressCodeRequest{} }, - GetRecoveryEmailAddressRequestTypeID: func() bin.Object { return &GetRecoveryEmailAddressRequest{} }, - SetRecoveryEmailAddressRequestTypeID: func() bin.Object { return &SetRecoveryEmailAddressRequest{} }, - CheckRecoveryEmailAddressCodeRequestTypeID: func() bin.Object { return &CheckRecoveryEmailAddressCodeRequest{} }, - ResendRecoveryEmailAddressCodeRequestTypeID: func() bin.Object { return &ResendRecoveryEmailAddressCodeRequest{} }, - CancelRecoveryEmailAddressVerificationRequestTypeID: func() bin.Object { return &CancelRecoveryEmailAddressVerificationRequest{} }, - RequestPasswordRecoveryRequestTypeID: func() bin.Object { return &RequestPasswordRecoveryRequest{} }, - CheckPasswordRecoveryCodeRequestTypeID: func() bin.Object { return &CheckPasswordRecoveryCodeRequest{} }, - RecoverPasswordRequestTypeID: func() bin.Object { return &RecoverPasswordRequest{} }, - ResetPasswordRequestTypeID: func() bin.Object { return &ResetPasswordRequest{} }, - CancelPasswordResetRequestTypeID: func() bin.Object { return &CancelPasswordResetRequest{} }, - CreateTemporaryPasswordRequestTypeID: func() bin.Object { return &CreateTemporaryPasswordRequest{} }, - GetTemporaryPasswordStateRequestTypeID: func() bin.Object { return &GetTemporaryPasswordStateRequest{} }, - GetMeRequestTypeID: func() bin.Object { return &GetMeRequest{} }, - GetUserRequestTypeID: func() bin.Object { return &GetUserRequest{} }, - GetUserFullInfoRequestTypeID: func() bin.Object { return &GetUserFullInfoRequest{} }, - GetBasicGroupRequestTypeID: func() bin.Object { return &GetBasicGroupRequest{} }, - GetBasicGroupFullInfoRequestTypeID: func() bin.Object { return &GetBasicGroupFullInfoRequest{} }, - GetSupergroupRequestTypeID: func() bin.Object { return &GetSupergroupRequest{} }, - GetSupergroupFullInfoRequestTypeID: func() bin.Object { return &GetSupergroupFullInfoRequest{} }, - GetSecretChatRequestTypeID: func() bin.Object { return &GetSecretChatRequest{} }, - GetChatRequestTypeID: func() bin.Object { return &GetChatRequest{} }, - GetMessageRequestTypeID: func() bin.Object { return &GetMessageRequest{} }, - GetMessageLocallyRequestTypeID: func() bin.Object { return &GetMessageLocallyRequest{} }, - GetRepliedMessageRequestTypeID: func() bin.Object { return &GetRepliedMessageRequest{} }, - GetChatPinnedMessageRequestTypeID: func() bin.Object { return &GetChatPinnedMessageRequest{} }, - GetCallbackQueryMessageRequestTypeID: func() bin.Object { return &GetCallbackQueryMessageRequest{} }, - GetMessagesRequestTypeID: func() bin.Object { return &GetMessagesRequest{} }, - GetMessagePropertiesRequestTypeID: func() bin.Object { return &GetMessagePropertiesRequest{} }, - GetMessageThreadRequestTypeID: func() bin.Object { return &GetMessageThreadRequest{} }, - GetMessageReadDateRequestTypeID: func() bin.Object { return &GetMessageReadDateRequest{} }, - GetMessageViewersRequestTypeID: func() bin.Object { return &GetMessageViewersRequest{} }, - GetFileRequestTypeID: func() bin.Object { return &GetFileRequest{} }, - GetRemoteFileRequestTypeID: func() bin.Object { return &GetRemoteFileRequest{} }, - LoadChatsRequestTypeID: func() bin.Object { return &LoadChatsRequest{} }, - GetChatsRequestTypeID: func() bin.Object { return &GetChatsRequest{} }, - SearchPublicChatRequestTypeID: func() bin.Object { return &SearchPublicChatRequest{} }, - SearchPublicChatsRequestTypeID: func() bin.Object { return &SearchPublicChatsRequest{} }, - SearchChatsRequestTypeID: func() bin.Object { return &SearchChatsRequest{} }, - SearchChatsOnServerRequestTypeID: func() bin.Object { return &SearchChatsOnServerRequest{} }, - GetRecommendedChatsRequestTypeID: func() bin.Object { return &GetRecommendedChatsRequest{} }, - GetChatSimilarChatsRequestTypeID: func() bin.Object { return &GetChatSimilarChatsRequest{} }, - GetChatSimilarChatCountRequestTypeID: func() bin.Object { return &GetChatSimilarChatCountRequest{} }, - OpenChatSimilarChatRequestTypeID: func() bin.Object { return &OpenChatSimilarChatRequest{} }, - GetTopChatsRequestTypeID: func() bin.Object { return &GetTopChatsRequest{} }, - RemoveTopChatRequestTypeID: func() bin.Object { return &RemoveTopChatRequest{} }, - SearchRecentlyFoundChatsRequestTypeID: func() bin.Object { return &SearchRecentlyFoundChatsRequest{} }, - AddRecentlyFoundChatRequestTypeID: func() bin.Object { return &AddRecentlyFoundChatRequest{} }, - RemoveRecentlyFoundChatRequestTypeID: func() bin.Object { return &RemoveRecentlyFoundChatRequest{} }, - ClearRecentlyFoundChatsRequestTypeID: func() bin.Object { return &ClearRecentlyFoundChatsRequest{} }, - GetRecentlyOpenedChatsRequestTypeID: func() bin.Object { return &GetRecentlyOpenedChatsRequest{} }, - CheckChatUsernameRequestTypeID: func() bin.Object { return &CheckChatUsernameRequest{} }, - GetCreatedPublicChatsRequestTypeID: func() bin.Object { return &GetCreatedPublicChatsRequest{} }, - CheckCreatedPublicChatsLimitRequestTypeID: func() bin.Object { return &CheckCreatedPublicChatsLimitRequest{} }, - GetSuitableDiscussionChatsRequestTypeID: func() bin.Object { return &GetSuitableDiscussionChatsRequest{} }, - GetInactiveSupergroupChatsRequestTypeID: func() bin.Object { return &GetInactiveSupergroupChatsRequest{} }, - GetSuitablePersonalChatsRequestTypeID: func() bin.Object { return &GetSuitablePersonalChatsRequest{} }, - LoadSavedMessagesTopicsRequestTypeID: func() bin.Object { return &LoadSavedMessagesTopicsRequest{} }, - GetSavedMessagesTopicHistoryRequestTypeID: func() bin.Object { return &GetSavedMessagesTopicHistoryRequest{} }, - GetSavedMessagesTopicMessageByDateRequestTypeID: func() bin.Object { return &GetSavedMessagesTopicMessageByDateRequest{} }, - DeleteSavedMessagesTopicHistoryRequestTypeID: func() bin.Object { return &DeleteSavedMessagesTopicHistoryRequest{} }, - DeleteSavedMessagesTopicMessagesByDateRequestTypeID: func() bin.Object { return &DeleteSavedMessagesTopicMessagesByDateRequest{} }, - ToggleSavedMessagesTopicIsPinnedRequestTypeID: func() bin.Object { return &ToggleSavedMessagesTopicIsPinnedRequest{} }, - SetPinnedSavedMessagesTopicsRequestTypeID: func() bin.Object { return &SetPinnedSavedMessagesTopicsRequest{} }, - GetGroupsInCommonRequestTypeID: func() bin.Object { return &GetGroupsInCommonRequest{} }, - GetChatHistoryRequestTypeID: func() bin.Object { return &GetChatHistoryRequest{} }, - GetMessageThreadHistoryRequestTypeID: func() bin.Object { return &GetMessageThreadHistoryRequest{} }, - DeleteChatHistoryRequestTypeID: func() bin.Object { return &DeleteChatHistoryRequest{} }, - DeleteChatRequestTypeID: func() bin.Object { return &DeleteChatRequest{} }, - SearchChatMessagesRequestTypeID: func() bin.Object { return &SearchChatMessagesRequest{} }, - SearchMessagesRequestTypeID: func() bin.Object { return &SearchMessagesRequest{} }, - SearchSecretMessagesRequestTypeID: func() bin.Object { return &SearchSecretMessagesRequest{} }, - SearchSavedMessagesRequestTypeID: func() bin.Object { return &SearchSavedMessagesRequest{} }, - SearchCallMessagesRequestTypeID: func() bin.Object { return &SearchCallMessagesRequest{} }, - SearchOutgoingDocumentMessagesRequestTypeID: func() bin.Object { return &SearchOutgoingDocumentMessagesRequest{} }, - SearchPublicMessagesByTagRequestTypeID: func() bin.Object { return &SearchPublicMessagesByTagRequest{} }, - SearchPublicStoriesByTagRequestTypeID: func() bin.Object { return &SearchPublicStoriesByTagRequest{} }, - SearchPublicStoriesByLocationRequestTypeID: func() bin.Object { return &SearchPublicStoriesByLocationRequest{} }, - SearchPublicStoriesByVenueRequestTypeID: func() bin.Object { return &SearchPublicStoriesByVenueRequest{} }, - GetSearchedForTagsRequestTypeID: func() bin.Object { return &GetSearchedForTagsRequest{} }, - RemoveSearchedForTagRequestTypeID: func() bin.Object { return &RemoveSearchedForTagRequest{} }, - ClearSearchedForTagsRequestTypeID: func() bin.Object { return &ClearSearchedForTagsRequest{} }, - DeleteAllCallMessagesRequestTypeID: func() bin.Object { return &DeleteAllCallMessagesRequest{} }, - SearchChatRecentLocationMessagesRequestTypeID: func() bin.Object { return &SearchChatRecentLocationMessagesRequest{} }, - GetChatMessageByDateRequestTypeID: func() bin.Object { return &GetChatMessageByDateRequest{} }, - GetChatSparseMessagePositionsRequestTypeID: func() bin.Object { return &GetChatSparseMessagePositionsRequest{} }, - GetChatMessageCalendarRequestTypeID: func() bin.Object { return &GetChatMessageCalendarRequest{} }, - GetChatMessageCountRequestTypeID: func() bin.Object { return &GetChatMessageCountRequest{} }, - GetChatMessagePositionRequestTypeID: func() bin.Object { return &GetChatMessagePositionRequest{} }, - GetChatScheduledMessagesRequestTypeID: func() bin.Object { return &GetChatScheduledMessagesRequest{} }, - GetChatSponsoredMessagesRequestTypeID: func() bin.Object { return &GetChatSponsoredMessagesRequest{} }, - ClickChatSponsoredMessageRequestTypeID: func() bin.Object { return &ClickChatSponsoredMessageRequest{} }, - ReportChatSponsoredMessageRequestTypeID: func() bin.Object { return &ReportChatSponsoredMessageRequest{} }, - RemoveNotificationRequestTypeID: func() bin.Object { return &RemoveNotificationRequest{} }, - RemoveNotificationGroupRequestTypeID: func() bin.Object { return &RemoveNotificationGroupRequest{} }, - GetMessageLinkRequestTypeID: func() bin.Object { return &GetMessageLinkRequest{} }, - GetMessageEmbeddingCodeRequestTypeID: func() bin.Object { return &GetMessageEmbeddingCodeRequest{} }, - GetMessageLinkInfoRequestTypeID: func() bin.Object { return &GetMessageLinkInfoRequest{} }, - TranslateTextRequestTypeID: func() bin.Object { return &TranslateTextRequest{} }, - TranslateMessageTextRequestTypeID: func() bin.Object { return &TranslateMessageTextRequest{} }, - RecognizeSpeechRequestTypeID: func() bin.Object { return &RecognizeSpeechRequest{} }, - RateSpeechRecognitionRequestTypeID: func() bin.Object { return &RateSpeechRecognitionRequest{} }, - GetChatAvailableMessageSendersRequestTypeID: func() bin.Object { return &GetChatAvailableMessageSendersRequest{} }, - SetChatMessageSenderRequestTypeID: func() bin.Object { return &SetChatMessageSenderRequest{} }, - SendMessageRequestTypeID: func() bin.Object { return &SendMessageRequest{} }, - SendMessageAlbumRequestTypeID: func() bin.Object { return &SendMessageAlbumRequest{} }, - SendBotStartMessageRequestTypeID: func() bin.Object { return &SendBotStartMessageRequest{} }, - SendInlineQueryResultMessageRequestTypeID: func() bin.Object { return &SendInlineQueryResultMessageRequest{} }, - ForwardMessagesRequestTypeID: func() bin.Object { return &ForwardMessagesRequest{} }, - SendQuickReplyShortcutMessagesRequestTypeID: func() bin.Object { return &SendQuickReplyShortcutMessagesRequest{} }, - ResendMessagesRequestTypeID: func() bin.Object { return &ResendMessagesRequest{} }, - AddLocalMessageRequestTypeID: func() bin.Object { return &AddLocalMessageRequest{} }, - DeleteMessagesRequestTypeID: func() bin.Object { return &DeleteMessagesRequest{} }, - DeleteChatMessagesBySenderRequestTypeID: func() bin.Object { return &DeleteChatMessagesBySenderRequest{} }, - DeleteChatMessagesByDateRequestTypeID: func() bin.Object { return &DeleteChatMessagesByDateRequest{} }, - EditMessageTextRequestTypeID: func() bin.Object { return &EditMessageTextRequest{} }, - EditMessageLiveLocationRequestTypeID: func() bin.Object { return &EditMessageLiveLocationRequest{} }, - EditMessageMediaRequestTypeID: func() bin.Object { return &EditMessageMediaRequest{} }, - EditMessageCaptionRequestTypeID: func() bin.Object { return &EditMessageCaptionRequest{} }, - EditMessageReplyMarkupRequestTypeID: func() bin.Object { return &EditMessageReplyMarkupRequest{} }, - EditInlineMessageTextRequestTypeID: func() bin.Object { return &EditInlineMessageTextRequest{} }, - EditInlineMessageLiveLocationRequestTypeID: func() bin.Object { return &EditInlineMessageLiveLocationRequest{} }, - EditInlineMessageMediaRequestTypeID: func() bin.Object { return &EditInlineMessageMediaRequest{} }, - EditInlineMessageCaptionRequestTypeID: func() bin.Object { return &EditInlineMessageCaptionRequest{} }, - EditInlineMessageReplyMarkupRequestTypeID: func() bin.Object { return &EditInlineMessageReplyMarkupRequest{} }, - EditMessageSchedulingStateRequestTypeID: func() bin.Object { return &EditMessageSchedulingStateRequest{} }, - SetMessageFactCheckRequestTypeID: func() bin.Object { return &SetMessageFactCheckRequest{} }, - SendBusinessMessageRequestTypeID: func() bin.Object { return &SendBusinessMessageRequest{} }, - SendBusinessMessageAlbumRequestTypeID: func() bin.Object { return &SendBusinessMessageAlbumRequest{} }, - EditBusinessMessageTextRequestTypeID: func() bin.Object { return &EditBusinessMessageTextRequest{} }, - EditBusinessMessageLiveLocationRequestTypeID: func() bin.Object { return &EditBusinessMessageLiveLocationRequest{} }, - EditBusinessMessageMediaRequestTypeID: func() bin.Object { return &EditBusinessMessageMediaRequest{} }, - EditBusinessMessageCaptionRequestTypeID: func() bin.Object { return &EditBusinessMessageCaptionRequest{} }, - EditBusinessMessageReplyMarkupRequestTypeID: func() bin.Object { return &EditBusinessMessageReplyMarkupRequest{} }, - StopBusinessPollRequestTypeID: func() bin.Object { return &StopBusinessPollRequest{} }, - SetBusinessMessageIsPinnedRequestTypeID: func() bin.Object { return &SetBusinessMessageIsPinnedRequest{} }, - CheckQuickReplyShortcutNameRequestTypeID: func() bin.Object { return &CheckQuickReplyShortcutNameRequest{} }, - LoadQuickReplyShortcutsRequestTypeID: func() bin.Object { return &LoadQuickReplyShortcutsRequest{} }, - SetQuickReplyShortcutNameRequestTypeID: func() bin.Object { return &SetQuickReplyShortcutNameRequest{} }, - DeleteQuickReplyShortcutRequestTypeID: func() bin.Object { return &DeleteQuickReplyShortcutRequest{} }, - ReorderQuickReplyShortcutsRequestTypeID: func() bin.Object { return &ReorderQuickReplyShortcutsRequest{} }, - LoadQuickReplyShortcutMessagesRequestTypeID: func() bin.Object { return &LoadQuickReplyShortcutMessagesRequest{} }, - DeleteQuickReplyShortcutMessagesRequestTypeID: func() bin.Object { return &DeleteQuickReplyShortcutMessagesRequest{} }, - AddQuickReplyShortcutMessageRequestTypeID: func() bin.Object { return &AddQuickReplyShortcutMessageRequest{} }, - AddQuickReplyShortcutInlineQueryResultMessageRequestTypeID: func() bin.Object { return &AddQuickReplyShortcutInlineQueryResultMessageRequest{} }, - AddQuickReplyShortcutMessageAlbumRequestTypeID: func() bin.Object { return &AddQuickReplyShortcutMessageAlbumRequest{} }, - ReaddQuickReplyShortcutMessagesRequestTypeID: func() bin.Object { return &ReaddQuickReplyShortcutMessagesRequest{} }, - EditQuickReplyMessageRequestTypeID: func() bin.Object { return &EditQuickReplyMessageRequest{} }, - GetForumTopicDefaultIconsRequestTypeID: func() bin.Object { return &GetForumTopicDefaultIconsRequest{} }, - CreateForumTopicRequestTypeID: func() bin.Object { return &CreateForumTopicRequest{} }, - EditForumTopicRequestTypeID: func() bin.Object { return &EditForumTopicRequest{} }, - GetForumTopicRequestTypeID: func() bin.Object { return &GetForumTopicRequest{} }, - GetForumTopicLinkRequestTypeID: func() bin.Object { return &GetForumTopicLinkRequest{} }, - GetForumTopicsRequestTypeID: func() bin.Object { return &GetForumTopicsRequest{} }, - SetForumTopicNotificationSettingsRequestTypeID: func() bin.Object { return &SetForumTopicNotificationSettingsRequest{} }, - ToggleForumTopicIsClosedRequestTypeID: func() bin.Object { return &ToggleForumTopicIsClosedRequest{} }, - ToggleGeneralForumTopicIsHiddenRequestTypeID: func() bin.Object { return &ToggleGeneralForumTopicIsHiddenRequest{} }, - ToggleForumTopicIsPinnedRequestTypeID: func() bin.Object { return &ToggleForumTopicIsPinnedRequest{} }, - SetPinnedForumTopicsRequestTypeID: func() bin.Object { return &SetPinnedForumTopicsRequest{} }, - DeleteForumTopicRequestTypeID: func() bin.Object { return &DeleteForumTopicRequest{} }, - GetEmojiReactionRequestTypeID: func() bin.Object { return &GetEmojiReactionRequest{} }, - GetCustomEmojiReactionAnimationsRequestTypeID: func() bin.Object { return &GetCustomEmojiReactionAnimationsRequest{} }, - GetMessageAvailableReactionsRequestTypeID: func() bin.Object { return &GetMessageAvailableReactionsRequest{} }, - ClearRecentReactionsRequestTypeID: func() bin.Object { return &ClearRecentReactionsRequest{} }, - AddMessageReactionRequestTypeID: func() bin.Object { return &AddMessageReactionRequest{} }, - RemoveMessageReactionRequestTypeID: func() bin.Object { return &RemoveMessageReactionRequest{} }, - AddPendingPaidMessageReactionRequestTypeID: func() bin.Object { return &AddPendingPaidMessageReactionRequest{} }, - CommitPendingPaidMessageReactionsRequestTypeID: func() bin.Object { return &CommitPendingPaidMessageReactionsRequest{} }, - RemovePendingPaidMessageReactionsRequestTypeID: func() bin.Object { return &RemovePendingPaidMessageReactionsRequest{} }, - TogglePaidMessageReactionIsAnonymousRequestTypeID: func() bin.Object { return &TogglePaidMessageReactionIsAnonymousRequest{} }, - SetMessageReactionsRequestTypeID: func() bin.Object { return &SetMessageReactionsRequest{} }, - GetMessageAddedReactionsRequestTypeID: func() bin.Object { return &GetMessageAddedReactionsRequest{} }, - SetDefaultReactionTypeRequestTypeID: func() bin.Object { return &SetDefaultReactionTypeRequest{} }, - GetSavedMessagesTagsRequestTypeID: func() bin.Object { return &GetSavedMessagesTagsRequest{} }, - SetSavedMessagesTagLabelRequestTypeID: func() bin.Object { return &SetSavedMessagesTagLabelRequest{} }, - GetMessageEffectRequestTypeID: func() bin.Object { return &GetMessageEffectRequest{} }, - SearchQuoteRequestTypeID: func() bin.Object { return &SearchQuoteRequest{} }, - GetTextEntitiesRequestTypeID: func() bin.Object { return &GetTextEntitiesRequest{} }, - ParseTextEntitiesRequestTypeID: func() bin.Object { return &ParseTextEntitiesRequest{} }, - ParseMarkdownRequestTypeID: func() bin.Object { return &ParseMarkdownRequest{} }, - GetMarkdownTextRequestTypeID: func() bin.Object { return &GetMarkdownTextRequest{} }, - GetCountryFlagEmojiRequestTypeID: func() bin.Object { return &GetCountryFlagEmojiRequest{} }, - GetFileMimeTypeRequestTypeID: func() bin.Object { return &GetFileMimeTypeRequest{} }, - GetFileExtensionRequestTypeID: func() bin.Object { return &GetFileExtensionRequest{} }, - CleanFileNameRequestTypeID: func() bin.Object { return &CleanFileNameRequest{} }, - GetLanguagePackStringRequestTypeID: func() bin.Object { return &GetLanguagePackStringRequest{} }, - GetJSONValueRequestTypeID: func() bin.Object { return &GetJSONValueRequest{} }, - GetJSONStringRequestTypeID: func() bin.Object { return &GetJSONStringRequest{} }, - GetThemeParametersJSONStringRequestTypeID: func() bin.Object { return &GetThemeParametersJSONStringRequest{} }, - SetPollAnswerRequestTypeID: func() bin.Object { return &SetPollAnswerRequest{} }, - GetPollVotersRequestTypeID: func() bin.Object { return &GetPollVotersRequest{} }, - StopPollRequestTypeID: func() bin.Object { return &StopPollRequest{} }, - HideSuggestedActionRequestTypeID: func() bin.Object { return &HideSuggestedActionRequest{} }, - HideContactCloseBirthdaysRequestTypeID: func() bin.Object { return &HideContactCloseBirthdaysRequest{} }, - GetBusinessConnectionRequestTypeID: func() bin.Object { return &GetBusinessConnectionRequest{} }, - GetLoginURLInfoRequestTypeID: func() bin.Object { return &GetLoginURLInfoRequest{} }, - GetLoginURLRequestTypeID: func() bin.Object { return &GetLoginURLRequest{} }, - ShareUsersWithBotRequestTypeID: func() bin.Object { return &ShareUsersWithBotRequest{} }, - ShareChatWithBotRequestTypeID: func() bin.Object { return &ShareChatWithBotRequest{} }, - GetInlineQueryResultsRequestTypeID: func() bin.Object { return &GetInlineQueryResultsRequest{} }, - AnswerInlineQueryRequestTypeID: func() bin.Object { return &AnswerInlineQueryRequest{} }, - SavePreparedInlineMessageRequestTypeID: func() bin.Object { return &SavePreparedInlineMessageRequest{} }, - GetPreparedInlineMessageRequestTypeID: func() bin.Object { return &GetPreparedInlineMessageRequest{} }, - GetGrossingWebAppBotsRequestTypeID: func() bin.Object { return &GetGrossingWebAppBotsRequest{} }, - SearchWebAppRequestTypeID: func() bin.Object { return &SearchWebAppRequest{} }, - GetWebAppPlaceholderRequestTypeID: func() bin.Object { return &GetWebAppPlaceholderRequest{} }, - GetWebAppLinkURLRequestTypeID: func() bin.Object { return &GetWebAppLinkURLRequest{} }, - GetMainWebAppRequestTypeID: func() bin.Object { return &GetMainWebAppRequest{} }, - GetWebAppURLRequestTypeID: func() bin.Object { return &GetWebAppURLRequest{} }, - SendWebAppDataRequestTypeID: func() bin.Object { return &SendWebAppDataRequest{} }, - OpenWebAppRequestTypeID: func() bin.Object { return &OpenWebAppRequest{} }, - CloseWebAppRequestTypeID: func() bin.Object { return &CloseWebAppRequest{} }, - AnswerWebAppQueryRequestTypeID: func() bin.Object { return &AnswerWebAppQueryRequest{} }, - CheckWebAppFileDownloadRequestTypeID: func() bin.Object { return &CheckWebAppFileDownloadRequest{} }, - GetCallbackQueryAnswerRequestTypeID: func() bin.Object { return &GetCallbackQueryAnswerRequest{} }, - AnswerCallbackQueryRequestTypeID: func() bin.Object { return &AnswerCallbackQueryRequest{} }, - AnswerShippingQueryRequestTypeID: func() bin.Object { return &AnswerShippingQueryRequest{} }, - AnswerPreCheckoutQueryRequestTypeID: func() bin.Object { return &AnswerPreCheckoutQueryRequest{} }, - SetGameScoreRequestTypeID: func() bin.Object { return &SetGameScoreRequest{} }, - SetInlineGameScoreRequestTypeID: func() bin.Object { return &SetInlineGameScoreRequest{} }, - GetGameHighScoresRequestTypeID: func() bin.Object { return &GetGameHighScoresRequest{} }, - GetInlineGameHighScoresRequestTypeID: func() bin.Object { return &GetInlineGameHighScoresRequest{} }, - DeleteChatReplyMarkupRequestTypeID: func() bin.Object { return &DeleteChatReplyMarkupRequest{} }, - SendChatActionRequestTypeID: func() bin.Object { return &SendChatActionRequest{} }, - OpenChatRequestTypeID: func() bin.Object { return &OpenChatRequest{} }, - CloseChatRequestTypeID: func() bin.Object { return &CloseChatRequest{} }, - ViewMessagesRequestTypeID: func() bin.Object { return &ViewMessagesRequest{} }, - OpenMessageContentRequestTypeID: func() bin.Object { return &OpenMessageContentRequest{} }, - ClickAnimatedEmojiMessageRequestTypeID: func() bin.Object { return &ClickAnimatedEmojiMessageRequest{} }, - GetInternalLinkRequestTypeID: func() bin.Object { return &GetInternalLinkRequest{} }, - GetInternalLinkTypeRequestTypeID: func() bin.Object { return &GetInternalLinkTypeRequest{} }, - GetExternalLinkInfoRequestTypeID: func() bin.Object { return &GetExternalLinkInfoRequest{} }, - GetExternalLinkRequestTypeID: func() bin.Object { return &GetExternalLinkRequest{} }, - ReadAllChatMentionsRequestTypeID: func() bin.Object { return &ReadAllChatMentionsRequest{} }, - ReadAllMessageThreadMentionsRequestTypeID: func() bin.Object { return &ReadAllMessageThreadMentionsRequest{} }, - ReadAllChatReactionsRequestTypeID: func() bin.Object { return &ReadAllChatReactionsRequest{} }, - ReadAllMessageThreadReactionsRequestTypeID: func() bin.Object { return &ReadAllMessageThreadReactionsRequest{} }, - CreatePrivateChatRequestTypeID: func() bin.Object { return &CreatePrivateChatRequest{} }, - CreateBasicGroupChatRequestTypeID: func() bin.Object { return &CreateBasicGroupChatRequest{} }, - CreateSupergroupChatRequestTypeID: func() bin.Object { return &CreateSupergroupChatRequest{} }, - CreateSecretChatRequestTypeID: func() bin.Object { return &CreateSecretChatRequest{} }, - CreateNewBasicGroupChatRequestTypeID: func() bin.Object { return &CreateNewBasicGroupChatRequest{} }, - CreateNewSupergroupChatRequestTypeID: func() bin.Object { return &CreateNewSupergroupChatRequest{} }, - CreateNewSecretChatRequestTypeID: func() bin.Object { return &CreateNewSecretChatRequest{} }, - UpgradeBasicGroupChatToSupergroupChatRequestTypeID: func() bin.Object { return &UpgradeBasicGroupChatToSupergroupChatRequest{} }, - GetChatListsToAddChatRequestTypeID: func() bin.Object { return &GetChatListsToAddChatRequest{} }, - AddChatToListRequestTypeID: func() bin.Object { return &AddChatToListRequest{} }, - GetChatFolderRequestTypeID: func() bin.Object { return &GetChatFolderRequest{} }, - CreateChatFolderRequestTypeID: func() bin.Object { return &CreateChatFolderRequest{} }, - EditChatFolderRequestTypeID: func() bin.Object { return &EditChatFolderRequest{} }, - DeleteChatFolderRequestTypeID: func() bin.Object { return &DeleteChatFolderRequest{} }, - GetChatFolderChatsToLeaveRequestTypeID: func() bin.Object { return &GetChatFolderChatsToLeaveRequest{} }, - GetChatFolderChatCountRequestTypeID: func() bin.Object { return &GetChatFolderChatCountRequest{} }, - ReorderChatFoldersRequestTypeID: func() bin.Object { return &ReorderChatFoldersRequest{} }, - ToggleChatFolderTagsRequestTypeID: func() bin.Object { return &ToggleChatFolderTagsRequest{} }, - GetRecommendedChatFoldersRequestTypeID: func() bin.Object { return &GetRecommendedChatFoldersRequest{} }, - GetChatFolderDefaultIconNameRequestTypeID: func() bin.Object { return &GetChatFolderDefaultIconNameRequest{} }, - GetChatsForChatFolderInviteLinkRequestTypeID: func() bin.Object { return &GetChatsForChatFolderInviteLinkRequest{} }, - CreateChatFolderInviteLinkRequestTypeID: func() bin.Object { return &CreateChatFolderInviteLinkRequest{} }, - GetChatFolderInviteLinksRequestTypeID: func() bin.Object { return &GetChatFolderInviteLinksRequest{} }, - EditChatFolderInviteLinkRequestTypeID: func() bin.Object { return &EditChatFolderInviteLinkRequest{} }, - DeleteChatFolderInviteLinkRequestTypeID: func() bin.Object { return &DeleteChatFolderInviteLinkRequest{} }, - CheckChatFolderInviteLinkRequestTypeID: func() bin.Object { return &CheckChatFolderInviteLinkRequest{} }, - AddChatFolderByInviteLinkRequestTypeID: func() bin.Object { return &AddChatFolderByInviteLinkRequest{} }, - GetChatFolderNewChatsRequestTypeID: func() bin.Object { return &GetChatFolderNewChatsRequest{} }, - ProcessChatFolderNewChatsRequestTypeID: func() bin.Object { return &ProcessChatFolderNewChatsRequest{} }, - GetArchiveChatListSettingsRequestTypeID: func() bin.Object { return &GetArchiveChatListSettingsRequest{} }, - SetArchiveChatListSettingsRequestTypeID: func() bin.Object { return &SetArchiveChatListSettingsRequest{} }, - SetChatTitleRequestTypeID: func() bin.Object { return &SetChatTitleRequest{} }, - SetChatPhotoRequestTypeID: func() bin.Object { return &SetChatPhotoRequest{} }, - SetChatAccentColorRequestTypeID: func() bin.Object { return &SetChatAccentColorRequest{} }, - SetChatProfileAccentColorRequestTypeID: func() bin.Object { return &SetChatProfileAccentColorRequest{} }, - SetChatMessageAutoDeleteTimeRequestTypeID: func() bin.Object { return &SetChatMessageAutoDeleteTimeRequest{} }, - SetChatEmojiStatusRequestTypeID: func() bin.Object { return &SetChatEmojiStatusRequest{} }, - SetChatPermissionsRequestTypeID: func() bin.Object { return &SetChatPermissionsRequest{} }, - SetChatBackgroundRequestTypeID: func() bin.Object { return &SetChatBackgroundRequest{} }, - DeleteChatBackgroundRequestTypeID: func() bin.Object { return &DeleteChatBackgroundRequest{} }, - SetChatThemeRequestTypeID: func() bin.Object { return &SetChatThemeRequest{} }, - SetChatDraftMessageRequestTypeID: func() bin.Object { return &SetChatDraftMessageRequest{} }, - SetChatNotificationSettingsRequestTypeID: func() bin.Object { return &SetChatNotificationSettingsRequest{} }, - ToggleChatHasProtectedContentRequestTypeID: func() bin.Object { return &ToggleChatHasProtectedContentRequest{} }, - ToggleChatViewAsTopicsRequestTypeID: func() bin.Object { return &ToggleChatViewAsTopicsRequest{} }, - ToggleChatIsTranslatableRequestTypeID: func() bin.Object { return &ToggleChatIsTranslatableRequest{} }, - ToggleChatIsMarkedAsUnreadRequestTypeID: func() bin.Object { return &ToggleChatIsMarkedAsUnreadRequest{} }, - ToggleChatDefaultDisableNotificationRequestTypeID: func() bin.Object { return &ToggleChatDefaultDisableNotificationRequest{} }, - SetChatAvailableReactionsRequestTypeID: func() bin.Object { return &SetChatAvailableReactionsRequest{} }, - SetChatClientDataRequestTypeID: func() bin.Object { return &SetChatClientDataRequest{} }, - SetChatDescriptionRequestTypeID: func() bin.Object { return &SetChatDescriptionRequest{} }, - SetChatDiscussionGroupRequestTypeID: func() bin.Object { return &SetChatDiscussionGroupRequest{} }, - SetChatLocationRequestTypeID: func() bin.Object { return &SetChatLocationRequest{} }, - SetChatSlowModeDelayRequestTypeID: func() bin.Object { return &SetChatSlowModeDelayRequest{} }, - PinChatMessageRequestTypeID: func() bin.Object { return &PinChatMessageRequest{} }, - UnpinChatMessageRequestTypeID: func() bin.Object { return &UnpinChatMessageRequest{} }, - UnpinAllChatMessagesRequestTypeID: func() bin.Object { return &UnpinAllChatMessagesRequest{} }, - UnpinAllMessageThreadMessagesRequestTypeID: func() bin.Object { return &UnpinAllMessageThreadMessagesRequest{} }, - JoinChatRequestTypeID: func() bin.Object { return &JoinChatRequest{} }, - LeaveChatRequestTypeID: func() bin.Object { return &LeaveChatRequest{} }, - AddChatMemberRequestTypeID: func() bin.Object { return &AddChatMemberRequest{} }, - AddChatMembersRequestTypeID: func() bin.Object { return &AddChatMembersRequest{} }, - SetChatMemberStatusRequestTypeID: func() bin.Object { return &SetChatMemberStatusRequest{} }, - BanChatMemberRequestTypeID: func() bin.Object { return &BanChatMemberRequest{} }, - CanTransferOwnershipRequestTypeID: func() bin.Object { return &CanTransferOwnershipRequest{} }, - TransferChatOwnershipRequestTypeID: func() bin.Object { return &TransferChatOwnershipRequest{} }, - GetChatMemberRequestTypeID: func() bin.Object { return &GetChatMemberRequest{} }, - SearchChatMembersRequestTypeID: func() bin.Object { return &SearchChatMembersRequest{} }, - GetChatAdministratorsRequestTypeID: func() bin.Object { return &GetChatAdministratorsRequest{} }, - ClearAllDraftMessagesRequestTypeID: func() bin.Object { return &ClearAllDraftMessagesRequest{} }, - GetSavedNotificationSoundRequestTypeID: func() bin.Object { return &GetSavedNotificationSoundRequest{} }, - GetSavedNotificationSoundsRequestTypeID: func() bin.Object { return &GetSavedNotificationSoundsRequest{} }, - AddSavedNotificationSoundRequestTypeID: func() bin.Object { return &AddSavedNotificationSoundRequest{} }, - RemoveSavedNotificationSoundRequestTypeID: func() bin.Object { return &RemoveSavedNotificationSoundRequest{} }, - GetChatNotificationSettingsExceptionsRequestTypeID: func() bin.Object { return &GetChatNotificationSettingsExceptionsRequest{} }, - GetScopeNotificationSettingsRequestTypeID: func() bin.Object { return &GetScopeNotificationSettingsRequest{} }, - SetScopeNotificationSettingsRequestTypeID: func() bin.Object { return &SetScopeNotificationSettingsRequest{} }, - SetReactionNotificationSettingsRequestTypeID: func() bin.Object { return &SetReactionNotificationSettingsRequest{} }, - ResetAllNotificationSettingsRequestTypeID: func() bin.Object { return &ResetAllNotificationSettingsRequest{} }, - ToggleChatIsPinnedRequestTypeID: func() bin.Object { return &ToggleChatIsPinnedRequest{} }, - SetPinnedChatsRequestTypeID: func() bin.Object { return &SetPinnedChatsRequest{} }, - ReadChatListRequestTypeID: func() bin.Object { return &ReadChatListRequest{} }, - GetCurrentWeatherRequestTypeID: func() bin.Object { return &GetCurrentWeatherRequest{} }, - GetStoryRequestTypeID: func() bin.Object { return &GetStoryRequest{} }, - GetChatsToSendStoriesRequestTypeID: func() bin.Object { return &GetChatsToSendStoriesRequest{} }, - CanSendStoryRequestTypeID: func() bin.Object { return &CanSendStoryRequest{} }, - SendStoryRequestTypeID: func() bin.Object { return &SendStoryRequest{} }, - EditStoryRequestTypeID: func() bin.Object { return &EditStoryRequest{} }, - EditStoryCoverRequestTypeID: func() bin.Object { return &EditStoryCoverRequest{} }, - SetStoryPrivacySettingsRequestTypeID: func() bin.Object { return &SetStoryPrivacySettingsRequest{} }, - ToggleStoryIsPostedToChatPageRequestTypeID: func() bin.Object { return &ToggleStoryIsPostedToChatPageRequest{} }, - DeleteStoryRequestTypeID: func() bin.Object { return &DeleteStoryRequest{} }, - GetStoryNotificationSettingsExceptionsRequestTypeID: func() bin.Object { return &GetStoryNotificationSettingsExceptionsRequest{} }, - LoadActiveStoriesRequestTypeID: func() bin.Object { return &LoadActiveStoriesRequest{} }, - SetChatActiveStoriesListRequestTypeID: func() bin.Object { return &SetChatActiveStoriesListRequest{} }, - GetChatActiveStoriesRequestTypeID: func() bin.Object { return &GetChatActiveStoriesRequest{} }, - GetChatPostedToChatPageStoriesRequestTypeID: func() bin.Object { return &GetChatPostedToChatPageStoriesRequest{} }, - GetChatArchivedStoriesRequestTypeID: func() bin.Object { return &GetChatArchivedStoriesRequest{} }, - SetChatPinnedStoriesRequestTypeID: func() bin.Object { return &SetChatPinnedStoriesRequest{} }, - OpenStoryRequestTypeID: func() bin.Object { return &OpenStoryRequest{} }, - CloseStoryRequestTypeID: func() bin.Object { return &CloseStoryRequest{} }, - GetStoryAvailableReactionsRequestTypeID: func() bin.Object { return &GetStoryAvailableReactionsRequest{} }, - SetStoryReactionRequestTypeID: func() bin.Object { return &SetStoryReactionRequest{} }, - GetStoryInteractionsRequestTypeID: func() bin.Object { return &GetStoryInteractionsRequest{} }, - GetChatStoryInteractionsRequestTypeID: func() bin.Object { return &GetChatStoryInteractionsRequest{} }, - ReportStoryRequestTypeID: func() bin.Object { return &ReportStoryRequest{} }, - ActivateStoryStealthModeRequestTypeID: func() bin.Object { return &ActivateStoryStealthModeRequest{} }, - GetStoryPublicForwardsRequestTypeID: func() bin.Object { return &GetStoryPublicForwardsRequest{} }, - GetChatBoostLevelFeaturesRequestTypeID: func() bin.Object { return &GetChatBoostLevelFeaturesRequest{} }, - GetChatBoostFeaturesRequestTypeID: func() bin.Object { return &GetChatBoostFeaturesRequest{} }, - GetAvailableChatBoostSlotsRequestTypeID: func() bin.Object { return &GetAvailableChatBoostSlotsRequest{} }, - GetChatBoostStatusRequestTypeID: func() bin.Object { return &GetChatBoostStatusRequest{} }, - BoostChatRequestTypeID: func() bin.Object { return &BoostChatRequest{} }, - GetChatBoostLinkRequestTypeID: func() bin.Object { return &GetChatBoostLinkRequest{} }, - GetChatBoostLinkInfoRequestTypeID: func() bin.Object { return &GetChatBoostLinkInfoRequest{} }, - GetChatBoostsRequestTypeID: func() bin.Object { return &GetChatBoostsRequest{} }, - GetUserChatBoostsRequestTypeID: func() bin.Object { return &GetUserChatBoostsRequest{} }, - GetAttachmentMenuBotRequestTypeID: func() bin.Object { return &GetAttachmentMenuBotRequest{} }, - ToggleBotIsAddedToAttachmentMenuRequestTypeID: func() bin.Object { return &ToggleBotIsAddedToAttachmentMenuRequest{} }, - GetThemedEmojiStatusesRequestTypeID: func() bin.Object { return &GetThemedEmojiStatusesRequest{} }, - GetRecentEmojiStatusesRequestTypeID: func() bin.Object { return &GetRecentEmojiStatusesRequest{} }, - GetDefaultEmojiStatusesRequestTypeID: func() bin.Object { return &GetDefaultEmojiStatusesRequest{} }, - ClearRecentEmojiStatusesRequestTypeID: func() bin.Object { return &ClearRecentEmojiStatusesRequest{} }, - GetThemedChatEmojiStatusesRequestTypeID: func() bin.Object { return &GetThemedChatEmojiStatusesRequest{} }, - GetDefaultChatEmojiStatusesRequestTypeID: func() bin.Object { return &GetDefaultChatEmojiStatusesRequest{} }, - GetDisallowedChatEmojiStatusesRequestTypeID: func() bin.Object { return &GetDisallowedChatEmojiStatusesRequest{} }, - DownloadFileRequestTypeID: func() bin.Object { return &DownloadFileRequest{} }, - GetFileDownloadedPrefixSizeRequestTypeID: func() bin.Object { return &GetFileDownloadedPrefixSizeRequest{} }, - CancelDownloadFileRequestTypeID: func() bin.Object { return &CancelDownloadFileRequest{} }, - GetSuggestedFileNameRequestTypeID: func() bin.Object { return &GetSuggestedFileNameRequest{} }, - PreliminaryUploadFileRequestTypeID: func() bin.Object { return &PreliminaryUploadFileRequest{} }, - CancelPreliminaryUploadFileRequestTypeID: func() bin.Object { return &CancelPreliminaryUploadFileRequest{} }, - WriteGeneratedFilePartRequestTypeID: func() bin.Object { return &WriteGeneratedFilePartRequest{} }, - SetFileGenerationProgressRequestTypeID: func() bin.Object { return &SetFileGenerationProgressRequest{} }, - FinishFileGenerationRequestTypeID: func() bin.Object { return &FinishFileGenerationRequest{} }, - ReadFilePartRequestTypeID: func() bin.Object { return &ReadFilePartRequest{} }, - DeleteFileRequestTypeID: func() bin.Object { return &DeleteFileRequest{} }, - AddFileToDownloadsRequestTypeID: func() bin.Object { return &AddFileToDownloadsRequest{} }, - ToggleDownloadIsPausedRequestTypeID: func() bin.Object { return &ToggleDownloadIsPausedRequest{} }, - ToggleAllDownloadsArePausedRequestTypeID: func() bin.Object { return &ToggleAllDownloadsArePausedRequest{} }, - RemoveFileFromDownloadsRequestTypeID: func() bin.Object { return &RemoveFileFromDownloadsRequest{} }, - RemoveAllFilesFromDownloadsRequestTypeID: func() bin.Object { return &RemoveAllFilesFromDownloadsRequest{} }, - SearchFileDownloadsRequestTypeID: func() bin.Object { return &SearchFileDownloadsRequest{} }, - SetApplicationVerificationTokenRequestTypeID: func() bin.Object { return &SetApplicationVerificationTokenRequest{} }, - GetMessageFileTypeRequestTypeID: func() bin.Object { return &GetMessageFileTypeRequest{} }, - GetMessageImportConfirmationTextRequestTypeID: func() bin.Object { return &GetMessageImportConfirmationTextRequest{} }, - ImportMessagesRequestTypeID: func() bin.Object { return &ImportMessagesRequest{} }, - ReplacePrimaryChatInviteLinkRequestTypeID: func() bin.Object { return &ReplacePrimaryChatInviteLinkRequest{} }, - CreateChatInviteLinkRequestTypeID: func() bin.Object { return &CreateChatInviteLinkRequest{} }, - CreateChatSubscriptionInviteLinkRequestTypeID: func() bin.Object { return &CreateChatSubscriptionInviteLinkRequest{} }, - EditChatInviteLinkRequestTypeID: func() bin.Object { return &EditChatInviteLinkRequest{} }, - EditChatSubscriptionInviteLinkRequestTypeID: func() bin.Object { return &EditChatSubscriptionInviteLinkRequest{} }, - GetChatInviteLinkRequestTypeID: func() bin.Object { return &GetChatInviteLinkRequest{} }, - GetChatInviteLinkCountsRequestTypeID: func() bin.Object { return &GetChatInviteLinkCountsRequest{} }, - GetChatInviteLinksRequestTypeID: func() bin.Object { return &GetChatInviteLinksRequest{} }, - GetChatInviteLinkMembersRequestTypeID: func() bin.Object { return &GetChatInviteLinkMembersRequest{} }, - RevokeChatInviteLinkRequestTypeID: func() bin.Object { return &RevokeChatInviteLinkRequest{} }, - DeleteRevokedChatInviteLinkRequestTypeID: func() bin.Object { return &DeleteRevokedChatInviteLinkRequest{} }, - DeleteAllRevokedChatInviteLinksRequestTypeID: func() bin.Object { return &DeleteAllRevokedChatInviteLinksRequest{} }, - CheckChatInviteLinkRequestTypeID: func() bin.Object { return &CheckChatInviteLinkRequest{} }, - JoinChatByInviteLinkRequestTypeID: func() bin.Object { return &JoinChatByInviteLinkRequest{} }, - GetChatJoinRequestsRequestTypeID: func() bin.Object { return &GetChatJoinRequestsRequest{} }, - ProcessChatJoinRequestRequestTypeID: func() bin.Object { return &ProcessChatJoinRequestRequest{} }, - ProcessChatJoinRequestsRequestTypeID: func() bin.Object { return &ProcessChatJoinRequestsRequest{} }, - CreateCallRequestTypeID: func() bin.Object { return &CreateCallRequest{} }, - AcceptCallRequestTypeID: func() bin.Object { return &AcceptCallRequest{} }, - SendCallSignalingDataRequestTypeID: func() bin.Object { return &SendCallSignalingDataRequest{} }, - DiscardCallRequestTypeID: func() bin.Object { return &DiscardCallRequest{} }, - SendCallRatingRequestTypeID: func() bin.Object { return &SendCallRatingRequest{} }, - SendCallDebugInformationRequestTypeID: func() bin.Object { return &SendCallDebugInformationRequest{} }, - SendCallLogRequestTypeID: func() bin.Object { return &SendCallLogRequest{} }, - GetVideoChatAvailableParticipantsRequestTypeID: func() bin.Object { return &GetVideoChatAvailableParticipantsRequest{} }, - SetVideoChatDefaultParticipantRequestTypeID: func() bin.Object { return &SetVideoChatDefaultParticipantRequest{} }, - CreateVideoChatRequestTypeID: func() bin.Object { return &CreateVideoChatRequest{} }, - CreateGroupCallRequestTypeID: func() bin.Object { return &CreateGroupCallRequest{} }, - GetVideoChatRtmpURLRequestTypeID: func() bin.Object { return &GetVideoChatRtmpURLRequest{} }, - ReplaceVideoChatRtmpURLRequestTypeID: func() bin.Object { return &ReplaceVideoChatRtmpURLRequest{} }, - GetGroupCallRequestTypeID: func() bin.Object { return &GetGroupCallRequest{} }, - StartScheduledGroupCallRequestTypeID: func() bin.Object { return &StartScheduledGroupCallRequest{} }, - ToggleGroupCallEnabledStartNotificationRequestTypeID: func() bin.Object { return &ToggleGroupCallEnabledStartNotificationRequest{} }, - JoinGroupCallRequestTypeID: func() bin.Object { return &JoinGroupCallRequest{} }, - StartGroupCallScreenSharingRequestTypeID: func() bin.Object { return &StartGroupCallScreenSharingRequest{} }, - ToggleGroupCallScreenSharingIsPausedRequestTypeID: func() bin.Object { return &ToggleGroupCallScreenSharingIsPausedRequest{} }, - EndGroupCallScreenSharingRequestTypeID: func() bin.Object { return &EndGroupCallScreenSharingRequest{} }, - SetGroupCallTitleRequestTypeID: func() bin.Object { return &SetGroupCallTitleRequest{} }, - ToggleGroupCallMuteNewParticipantsRequestTypeID: func() bin.Object { return &ToggleGroupCallMuteNewParticipantsRequest{} }, - InviteGroupCallParticipantsRequestTypeID: func() bin.Object { return &InviteGroupCallParticipantsRequest{} }, - GetGroupCallInviteLinkRequestTypeID: func() bin.Object { return &GetGroupCallInviteLinkRequest{} }, - RevokeGroupCallInviteLinkRequestTypeID: func() bin.Object { return &RevokeGroupCallInviteLinkRequest{} }, - StartGroupCallRecordingRequestTypeID: func() bin.Object { return &StartGroupCallRecordingRequest{} }, - EndGroupCallRecordingRequestTypeID: func() bin.Object { return &EndGroupCallRecordingRequest{} }, - ToggleGroupCallIsMyVideoPausedRequestTypeID: func() bin.Object { return &ToggleGroupCallIsMyVideoPausedRequest{} }, - ToggleGroupCallIsMyVideoEnabledRequestTypeID: func() bin.Object { return &ToggleGroupCallIsMyVideoEnabledRequest{} }, - SetGroupCallParticipantIsSpeakingRequestTypeID: func() bin.Object { return &SetGroupCallParticipantIsSpeakingRequest{} }, - ToggleGroupCallParticipantIsMutedRequestTypeID: func() bin.Object { return &ToggleGroupCallParticipantIsMutedRequest{} }, - SetGroupCallParticipantVolumeLevelRequestTypeID: func() bin.Object { return &SetGroupCallParticipantVolumeLevelRequest{} }, - ToggleGroupCallParticipantIsHandRaisedRequestTypeID: func() bin.Object { return &ToggleGroupCallParticipantIsHandRaisedRequest{} }, - LoadGroupCallParticipantsRequestTypeID: func() bin.Object { return &LoadGroupCallParticipantsRequest{} }, - LeaveGroupCallRequestTypeID: func() bin.Object { return &LeaveGroupCallRequest{} }, - EndGroupCallRequestTypeID: func() bin.Object { return &EndGroupCallRequest{} }, - GetGroupCallStreamsRequestTypeID: func() bin.Object { return &GetGroupCallStreamsRequest{} }, - GetGroupCallStreamSegmentRequestTypeID: func() bin.Object { return &GetGroupCallStreamSegmentRequest{} }, - SetMessageSenderBlockListRequestTypeID: func() bin.Object { return &SetMessageSenderBlockListRequest{} }, - BlockMessageSenderFromRepliesRequestTypeID: func() bin.Object { return &BlockMessageSenderFromRepliesRequest{} }, - GetBlockedMessageSendersRequestTypeID: func() bin.Object { return &GetBlockedMessageSendersRequest{} }, - AddContactRequestTypeID: func() bin.Object { return &AddContactRequest{} }, - ImportContactsRequestTypeID: func() bin.Object { return &ImportContactsRequest{} }, - GetContactsRequestTypeID: func() bin.Object { return &GetContactsRequest{} }, - SearchContactsRequestTypeID: func() bin.Object { return &SearchContactsRequest{} }, - RemoveContactsRequestTypeID: func() bin.Object { return &RemoveContactsRequest{} }, - GetImportedContactCountRequestTypeID: func() bin.Object { return &GetImportedContactCountRequest{} }, - ChangeImportedContactsRequestTypeID: func() bin.Object { return &ChangeImportedContactsRequest{} }, - ClearImportedContactsRequestTypeID: func() bin.Object { return &ClearImportedContactsRequest{} }, - SetCloseFriendsRequestTypeID: func() bin.Object { return &SetCloseFriendsRequest{} }, - GetCloseFriendsRequestTypeID: func() bin.Object { return &GetCloseFriendsRequest{} }, - SetUserPersonalProfilePhotoRequestTypeID: func() bin.Object { return &SetUserPersonalProfilePhotoRequest{} }, - SuggestUserProfilePhotoRequestTypeID: func() bin.Object { return &SuggestUserProfilePhotoRequest{} }, - ToggleBotCanManageEmojiStatusRequestTypeID: func() bin.Object { return &ToggleBotCanManageEmojiStatusRequest{} }, - SetUserEmojiStatusRequestTypeID: func() bin.Object { return &SetUserEmojiStatusRequest{} }, - SearchUserByPhoneNumberRequestTypeID: func() bin.Object { return &SearchUserByPhoneNumberRequest{} }, - SharePhoneNumberRequestTypeID: func() bin.Object { return &SharePhoneNumberRequest{} }, - GetUserProfilePhotosRequestTypeID: func() bin.Object { return &GetUserProfilePhotosRequest{} }, - GetStickerOutlineRequestTypeID: func() bin.Object { return &GetStickerOutlineRequest{} }, - GetStickersRequestTypeID: func() bin.Object { return &GetStickersRequest{} }, - GetAllStickerEmojisRequestTypeID: func() bin.Object { return &GetAllStickerEmojisRequest{} }, - SearchStickersRequestTypeID: func() bin.Object { return &SearchStickersRequest{} }, - GetGreetingStickersRequestTypeID: func() bin.Object { return &GetGreetingStickersRequest{} }, - GetPremiumStickersRequestTypeID: func() bin.Object { return &GetPremiumStickersRequest{} }, - GetInstalledStickerSetsRequestTypeID: func() bin.Object { return &GetInstalledStickerSetsRequest{} }, - GetArchivedStickerSetsRequestTypeID: func() bin.Object { return &GetArchivedStickerSetsRequest{} }, - GetTrendingStickerSetsRequestTypeID: func() bin.Object { return &GetTrendingStickerSetsRequest{} }, - GetAttachedStickerSetsRequestTypeID: func() bin.Object { return &GetAttachedStickerSetsRequest{} }, - GetStickerSetRequestTypeID: func() bin.Object { return &GetStickerSetRequest{} }, - GetStickerSetNameRequestTypeID: func() bin.Object { return &GetStickerSetNameRequest{} }, - SearchStickerSetRequestTypeID: func() bin.Object { return &SearchStickerSetRequest{} }, - SearchInstalledStickerSetsRequestTypeID: func() bin.Object { return &SearchInstalledStickerSetsRequest{} }, - SearchStickerSetsRequestTypeID: func() bin.Object { return &SearchStickerSetsRequest{} }, - ChangeStickerSetRequestTypeID: func() bin.Object { return &ChangeStickerSetRequest{} }, - ViewTrendingStickerSetsRequestTypeID: func() bin.Object { return &ViewTrendingStickerSetsRequest{} }, - ReorderInstalledStickerSetsRequestTypeID: func() bin.Object { return &ReorderInstalledStickerSetsRequest{} }, - GetRecentStickersRequestTypeID: func() bin.Object { return &GetRecentStickersRequest{} }, - AddRecentStickerRequestTypeID: func() bin.Object { return &AddRecentStickerRequest{} }, - RemoveRecentStickerRequestTypeID: func() bin.Object { return &RemoveRecentStickerRequest{} }, - ClearRecentStickersRequestTypeID: func() bin.Object { return &ClearRecentStickersRequest{} }, - GetFavoriteStickersRequestTypeID: func() bin.Object { return &GetFavoriteStickersRequest{} }, - AddFavoriteStickerRequestTypeID: func() bin.Object { return &AddFavoriteStickerRequest{} }, - RemoveFavoriteStickerRequestTypeID: func() bin.Object { return &RemoveFavoriteStickerRequest{} }, - GetStickerEmojisRequestTypeID: func() bin.Object { return &GetStickerEmojisRequest{} }, - SearchEmojisRequestTypeID: func() bin.Object { return &SearchEmojisRequest{} }, - GetKeywordEmojisRequestTypeID: func() bin.Object { return &GetKeywordEmojisRequest{} }, - GetEmojiCategoriesRequestTypeID: func() bin.Object { return &GetEmojiCategoriesRequest{} }, - GetAnimatedEmojiRequestTypeID: func() bin.Object { return &GetAnimatedEmojiRequest{} }, - GetEmojiSuggestionsURLRequestTypeID: func() bin.Object { return &GetEmojiSuggestionsURLRequest{} }, - GetCustomEmojiStickersRequestTypeID: func() bin.Object { return &GetCustomEmojiStickersRequest{} }, - GetDefaultChatPhotoCustomEmojiStickersRequestTypeID: func() bin.Object { return &GetDefaultChatPhotoCustomEmojiStickersRequest{} }, - GetDefaultProfilePhotoCustomEmojiStickersRequestTypeID: func() bin.Object { return &GetDefaultProfilePhotoCustomEmojiStickersRequest{} }, - GetDefaultBackgroundCustomEmojiStickersRequestTypeID: func() bin.Object { return &GetDefaultBackgroundCustomEmojiStickersRequest{} }, - GetSavedAnimationsRequestTypeID: func() bin.Object { return &GetSavedAnimationsRequest{} }, - AddSavedAnimationRequestTypeID: func() bin.Object { return &AddSavedAnimationRequest{} }, - RemoveSavedAnimationRequestTypeID: func() bin.Object { return &RemoveSavedAnimationRequest{} }, - GetRecentInlineBotsRequestTypeID: func() bin.Object { return &GetRecentInlineBotsRequest{} }, - GetOwnedBotsRequestTypeID: func() bin.Object { return &GetOwnedBotsRequest{} }, - SearchHashtagsRequestTypeID: func() bin.Object { return &SearchHashtagsRequest{} }, - RemoveRecentHashtagRequestTypeID: func() bin.Object { return &RemoveRecentHashtagRequest{} }, - GetLinkPreviewRequestTypeID: func() bin.Object { return &GetLinkPreviewRequest{} }, - GetWebPageInstantViewRequestTypeID: func() bin.Object { return &GetWebPageInstantViewRequest{} }, - SetProfilePhotoRequestTypeID: func() bin.Object { return &SetProfilePhotoRequest{} }, - DeleteProfilePhotoRequestTypeID: func() bin.Object { return &DeleteProfilePhotoRequest{} }, - SetAccentColorRequestTypeID: func() bin.Object { return &SetAccentColorRequest{} }, - SetProfileAccentColorRequestTypeID: func() bin.Object { return &SetProfileAccentColorRequest{} }, - SetNameRequestTypeID: func() bin.Object { return &SetNameRequest{} }, - SetBioRequestTypeID: func() bin.Object { return &SetBioRequest{} }, - SetUsernameRequestTypeID: func() bin.Object { return &SetUsernameRequest{} }, - ToggleUsernameIsActiveRequestTypeID: func() bin.Object { return &ToggleUsernameIsActiveRequest{} }, - ReorderActiveUsernamesRequestTypeID: func() bin.Object { return &ReorderActiveUsernamesRequest{} }, - SetBirthdateRequestTypeID: func() bin.Object { return &SetBirthdateRequest{} }, - SetPersonalChatRequestTypeID: func() bin.Object { return &SetPersonalChatRequest{} }, - SetEmojiStatusRequestTypeID: func() bin.Object { return &SetEmojiStatusRequest{} }, - ToggleHasSponsoredMessagesEnabledRequestTypeID: func() bin.Object { return &ToggleHasSponsoredMessagesEnabledRequest{} }, - SetBusinessLocationRequestTypeID: func() bin.Object { return &SetBusinessLocationRequest{} }, - SetBusinessOpeningHoursRequestTypeID: func() bin.Object { return &SetBusinessOpeningHoursRequest{} }, - SetBusinessGreetingMessageSettingsRequestTypeID: func() bin.Object { return &SetBusinessGreetingMessageSettingsRequest{} }, - SetBusinessAwayMessageSettingsRequestTypeID: func() bin.Object { return &SetBusinessAwayMessageSettingsRequest{} }, - SetBusinessStartPageRequestTypeID: func() bin.Object { return &SetBusinessStartPageRequest{} }, - SendPhoneNumberCodeRequestTypeID: func() bin.Object { return &SendPhoneNumberCodeRequest{} }, - SendPhoneNumberFirebaseSMSRequestTypeID: func() bin.Object { return &SendPhoneNumberFirebaseSMSRequest{} }, - ReportPhoneNumberCodeMissingRequestTypeID: func() bin.Object { return &ReportPhoneNumberCodeMissingRequest{} }, - ResendPhoneNumberCodeRequestTypeID: func() bin.Object { return &ResendPhoneNumberCodeRequest{} }, - CheckPhoneNumberCodeRequestTypeID: func() bin.Object { return &CheckPhoneNumberCodeRequest{} }, - GetBusinessConnectedBotRequestTypeID: func() bin.Object { return &GetBusinessConnectedBotRequest{} }, - SetBusinessConnectedBotRequestTypeID: func() bin.Object { return &SetBusinessConnectedBotRequest{} }, - DeleteBusinessConnectedBotRequestTypeID: func() bin.Object { return &DeleteBusinessConnectedBotRequest{} }, - ToggleBusinessConnectedBotChatIsPausedRequestTypeID: func() bin.Object { return &ToggleBusinessConnectedBotChatIsPausedRequest{} }, - RemoveBusinessConnectedBotFromChatRequestTypeID: func() bin.Object { return &RemoveBusinessConnectedBotFromChatRequest{} }, - GetBusinessChatLinksRequestTypeID: func() bin.Object { return &GetBusinessChatLinksRequest{} }, - CreateBusinessChatLinkRequestTypeID: func() bin.Object { return &CreateBusinessChatLinkRequest{} }, - EditBusinessChatLinkRequestTypeID: func() bin.Object { return &EditBusinessChatLinkRequest{} }, - DeleteBusinessChatLinkRequestTypeID: func() bin.Object { return &DeleteBusinessChatLinkRequest{} }, - GetBusinessChatLinkInfoRequestTypeID: func() bin.Object { return &GetBusinessChatLinkInfoRequest{} }, - GetUserLinkRequestTypeID: func() bin.Object { return &GetUserLinkRequest{} }, - SearchUserByTokenRequestTypeID: func() bin.Object { return &SearchUserByTokenRequest{} }, - SetCommandsRequestTypeID: func() bin.Object { return &SetCommandsRequest{} }, - DeleteCommandsRequestTypeID: func() bin.Object { return &DeleteCommandsRequest{} }, - GetCommandsRequestTypeID: func() bin.Object { return &GetCommandsRequest{} }, - SetMenuButtonRequestTypeID: func() bin.Object { return &SetMenuButtonRequest{} }, - GetMenuButtonRequestTypeID: func() bin.Object { return &GetMenuButtonRequest{} }, - SetDefaultGroupAdministratorRightsRequestTypeID: func() bin.Object { return &SetDefaultGroupAdministratorRightsRequest{} }, - SetDefaultChannelAdministratorRightsRequestTypeID: func() bin.Object { return &SetDefaultChannelAdministratorRightsRequest{} }, - CanBotSendMessagesRequestTypeID: func() bin.Object { return &CanBotSendMessagesRequest{} }, - AllowBotToSendMessagesRequestTypeID: func() bin.Object { return &AllowBotToSendMessagesRequest{} }, - SendWebAppCustomRequestRequestTypeID: func() bin.Object { return &SendWebAppCustomRequestRequest{} }, - GetBotMediaPreviewsRequestTypeID: func() bin.Object { return &GetBotMediaPreviewsRequest{} }, - GetBotMediaPreviewInfoRequestTypeID: func() bin.Object { return &GetBotMediaPreviewInfoRequest{} }, - AddBotMediaPreviewRequestTypeID: func() bin.Object { return &AddBotMediaPreviewRequest{} }, - EditBotMediaPreviewRequestTypeID: func() bin.Object { return &EditBotMediaPreviewRequest{} }, - ReorderBotMediaPreviewsRequestTypeID: func() bin.Object { return &ReorderBotMediaPreviewsRequest{} }, - DeleteBotMediaPreviewsRequestTypeID: func() bin.Object { return &DeleteBotMediaPreviewsRequest{} }, - SetBotNameRequestTypeID: func() bin.Object { return &SetBotNameRequest{} }, - GetBotNameRequestTypeID: func() bin.Object { return &GetBotNameRequest{} }, - SetBotProfilePhotoRequestTypeID: func() bin.Object { return &SetBotProfilePhotoRequest{} }, - ToggleBotUsernameIsActiveRequestTypeID: func() bin.Object { return &ToggleBotUsernameIsActiveRequest{} }, - ReorderBotActiveUsernamesRequestTypeID: func() bin.Object { return &ReorderBotActiveUsernamesRequest{} }, - SetBotInfoDescriptionRequestTypeID: func() bin.Object { return &SetBotInfoDescriptionRequest{} }, - GetBotInfoDescriptionRequestTypeID: func() bin.Object { return &GetBotInfoDescriptionRequest{} }, - SetBotInfoShortDescriptionRequestTypeID: func() bin.Object { return &SetBotInfoShortDescriptionRequest{} }, - GetBotInfoShortDescriptionRequestTypeID: func() bin.Object { return &GetBotInfoShortDescriptionRequest{} }, - SetMessageSenderBotVerificationRequestTypeID: func() bin.Object { return &SetMessageSenderBotVerificationRequest{} }, - RemoveMessageSenderBotVerificationRequestTypeID: func() bin.Object { return &RemoveMessageSenderBotVerificationRequest{} }, - GetActiveSessionsRequestTypeID: func() bin.Object { return &GetActiveSessionsRequest{} }, - TerminateSessionRequestTypeID: func() bin.Object { return &TerminateSessionRequest{} }, - TerminateAllOtherSessionsRequestTypeID: func() bin.Object { return &TerminateAllOtherSessionsRequest{} }, - ConfirmSessionRequestTypeID: func() bin.Object { return &ConfirmSessionRequest{} }, - ToggleSessionCanAcceptCallsRequestTypeID: func() bin.Object { return &ToggleSessionCanAcceptCallsRequest{} }, - ToggleSessionCanAcceptSecretChatsRequestTypeID: func() bin.Object { return &ToggleSessionCanAcceptSecretChatsRequest{} }, - SetInactiveSessionTTLRequestTypeID: func() bin.Object { return &SetInactiveSessionTTLRequest{} }, - GetConnectedWebsitesRequestTypeID: func() bin.Object { return &GetConnectedWebsitesRequest{} }, - DisconnectWebsiteRequestTypeID: func() bin.Object { return &DisconnectWebsiteRequest{} }, - DisconnectAllWebsitesRequestTypeID: func() bin.Object { return &DisconnectAllWebsitesRequest{} }, - SetSupergroupUsernameRequestTypeID: func() bin.Object { return &SetSupergroupUsernameRequest{} }, - ToggleSupergroupUsernameIsActiveRequestTypeID: func() bin.Object { return &ToggleSupergroupUsernameIsActiveRequest{} }, - DisableAllSupergroupUsernamesRequestTypeID: func() bin.Object { return &DisableAllSupergroupUsernamesRequest{} }, - ReorderSupergroupActiveUsernamesRequestTypeID: func() bin.Object { return &ReorderSupergroupActiveUsernamesRequest{} }, - SetSupergroupStickerSetRequestTypeID: func() bin.Object { return &SetSupergroupStickerSetRequest{} }, - SetSupergroupCustomEmojiStickerSetRequestTypeID: func() bin.Object { return &SetSupergroupCustomEmojiStickerSetRequest{} }, - SetSupergroupUnrestrictBoostCountRequestTypeID: func() bin.Object { return &SetSupergroupUnrestrictBoostCountRequest{} }, - ToggleSupergroupSignMessagesRequestTypeID: func() bin.Object { return &ToggleSupergroupSignMessagesRequest{} }, - ToggleSupergroupJoinToSendMessagesRequestTypeID: func() bin.Object { return &ToggleSupergroupJoinToSendMessagesRequest{} }, - ToggleSupergroupJoinByRequestRequestTypeID: func() bin.Object { return &ToggleSupergroupJoinByRequestRequest{} }, - ToggleSupergroupIsAllHistoryAvailableRequestTypeID: func() bin.Object { return &ToggleSupergroupIsAllHistoryAvailableRequest{} }, - ToggleSupergroupCanHaveSponsoredMessagesRequestTypeID: func() bin.Object { return &ToggleSupergroupCanHaveSponsoredMessagesRequest{} }, - ToggleSupergroupHasHiddenMembersRequestTypeID: func() bin.Object { return &ToggleSupergroupHasHiddenMembersRequest{} }, - ToggleSupergroupHasAggressiveAntiSpamEnabledRequestTypeID: func() bin.Object { return &ToggleSupergroupHasAggressiveAntiSpamEnabledRequest{} }, - ToggleSupergroupIsForumRequestTypeID: func() bin.Object { return &ToggleSupergroupIsForumRequest{} }, - ToggleSupergroupIsBroadcastGroupRequestTypeID: func() bin.Object { return &ToggleSupergroupIsBroadcastGroupRequest{} }, - ReportSupergroupSpamRequestTypeID: func() bin.Object { return &ReportSupergroupSpamRequest{} }, - ReportSupergroupAntiSpamFalsePositiveRequestTypeID: func() bin.Object { return &ReportSupergroupAntiSpamFalsePositiveRequest{} }, - GetSupergroupMembersRequestTypeID: func() bin.Object { return &GetSupergroupMembersRequest{} }, - CloseSecretChatRequestTypeID: func() bin.Object { return &CloseSecretChatRequest{} }, - GetChatEventLogRequestTypeID: func() bin.Object { return &GetChatEventLogRequest{} }, - GetTimeZonesRequestTypeID: func() bin.Object { return &GetTimeZonesRequest{} }, - GetPaymentFormRequestTypeID: func() bin.Object { return &GetPaymentFormRequest{} }, - ValidateOrderInfoRequestTypeID: func() bin.Object { return &ValidateOrderInfoRequest{} }, - SendPaymentFormRequestTypeID: func() bin.Object { return &SendPaymentFormRequest{} }, - GetPaymentReceiptRequestTypeID: func() bin.Object { return &GetPaymentReceiptRequest{} }, - GetSavedOrderInfoRequestTypeID: func() bin.Object { return &GetSavedOrderInfoRequest{} }, - DeleteSavedOrderInfoRequestTypeID: func() bin.Object { return &DeleteSavedOrderInfoRequest{} }, - DeleteSavedCredentialsRequestTypeID: func() bin.Object { return &DeleteSavedCredentialsRequest{} }, - GetAvailableGiftsRequestTypeID: func() bin.Object { return &GetAvailableGiftsRequest{} }, - SendGiftRequestTypeID: func() bin.Object { return &SendGiftRequest{} }, - SellGiftRequestTypeID: func() bin.Object { return &SellGiftRequest{} }, - ToggleGiftIsSavedRequestTypeID: func() bin.Object { return &ToggleGiftIsSavedRequest{} }, - GetGiftUpgradePreviewRequestTypeID: func() bin.Object { return &GetGiftUpgradePreviewRequest{} }, - UpgradeGiftRequestTypeID: func() bin.Object { return &UpgradeGiftRequest{} }, - TransferGiftRequestTypeID: func() bin.Object { return &TransferGiftRequest{} }, - GetUserGiftsRequestTypeID: func() bin.Object { return &GetUserGiftsRequest{} }, - GetUserGiftRequestTypeID: func() bin.Object { return &GetUserGiftRequest{} }, - CreateInvoiceLinkRequestTypeID: func() bin.Object { return &CreateInvoiceLinkRequest{} }, - RefundStarPaymentRequestTypeID: func() bin.Object { return &RefundStarPaymentRequest{} }, - GetSupportUserRequestTypeID: func() bin.Object { return &GetSupportUserRequest{} }, - GetBackgroundURLRequestTypeID: func() bin.Object { return &GetBackgroundURLRequest{} }, - SearchBackgroundRequestTypeID: func() bin.Object { return &SearchBackgroundRequest{} }, - SetDefaultBackgroundRequestTypeID: func() bin.Object { return &SetDefaultBackgroundRequest{} }, - DeleteDefaultBackgroundRequestTypeID: func() bin.Object { return &DeleteDefaultBackgroundRequest{} }, - GetInstalledBackgroundsRequestTypeID: func() bin.Object { return &GetInstalledBackgroundsRequest{} }, - RemoveInstalledBackgroundRequestTypeID: func() bin.Object { return &RemoveInstalledBackgroundRequest{} }, - ResetInstalledBackgroundsRequestTypeID: func() bin.Object { return &ResetInstalledBackgroundsRequest{} }, - GetLocalizationTargetInfoRequestTypeID: func() bin.Object { return &GetLocalizationTargetInfoRequest{} }, - GetLanguagePackInfoRequestTypeID: func() bin.Object { return &GetLanguagePackInfoRequest{} }, - GetLanguagePackStringsRequestTypeID: func() bin.Object { return &GetLanguagePackStringsRequest{} }, - SynchronizeLanguagePackRequestTypeID: func() bin.Object { return &SynchronizeLanguagePackRequest{} }, - AddCustomServerLanguagePackRequestTypeID: func() bin.Object { return &AddCustomServerLanguagePackRequest{} }, - SetCustomLanguagePackRequestTypeID: func() bin.Object { return &SetCustomLanguagePackRequest{} }, - EditCustomLanguagePackInfoRequestTypeID: func() bin.Object { return &EditCustomLanguagePackInfoRequest{} }, - SetCustomLanguagePackStringRequestTypeID: func() bin.Object { return &SetCustomLanguagePackStringRequest{} }, - DeleteLanguagePackRequestTypeID: func() bin.Object { return &DeleteLanguagePackRequest{} }, - RegisterDeviceRequestTypeID: func() bin.Object { return &RegisterDeviceRequest{} }, - ProcessPushNotificationRequestTypeID: func() bin.Object { return &ProcessPushNotificationRequest{} }, - GetPushReceiverIDRequestTypeID: func() bin.Object { return &GetPushReceiverIDRequest{} }, - GetRecentlyVisitedTMeURLsRequestTypeID: func() bin.Object { return &GetRecentlyVisitedTMeURLsRequest{} }, - SetUserPrivacySettingRulesRequestTypeID: func() bin.Object { return &SetUserPrivacySettingRulesRequest{} }, - GetUserPrivacySettingRulesRequestTypeID: func() bin.Object { return &GetUserPrivacySettingRulesRequest{} }, - SetReadDatePrivacySettingsRequestTypeID: func() bin.Object { return &SetReadDatePrivacySettingsRequest{} }, - GetReadDatePrivacySettingsRequestTypeID: func() bin.Object { return &GetReadDatePrivacySettingsRequest{} }, - SetNewChatPrivacySettingsRequestTypeID: func() bin.Object { return &SetNewChatPrivacySettingsRequest{} }, - GetNewChatPrivacySettingsRequestTypeID: func() bin.Object { return &GetNewChatPrivacySettingsRequest{} }, - CanSendMessageToUserRequestTypeID: func() bin.Object { return &CanSendMessageToUserRequest{} }, - GetOptionRequestTypeID: func() bin.Object { return &GetOptionRequest{} }, - SetOptionRequestTypeID: func() bin.Object { return &SetOptionRequest{} }, - SetAccountTTLRequestTypeID: func() bin.Object { return &SetAccountTTLRequest{} }, - GetAccountTTLRequestTypeID: func() bin.Object { return &GetAccountTTLRequest{} }, - DeleteAccountRequestTypeID: func() bin.Object { return &DeleteAccountRequest{} }, - SetDefaultMessageAutoDeleteTimeRequestTypeID: func() bin.Object { return &SetDefaultMessageAutoDeleteTimeRequest{} }, - GetDefaultMessageAutoDeleteTimeRequestTypeID: func() bin.Object { return &GetDefaultMessageAutoDeleteTimeRequest{} }, - RemoveChatActionBarRequestTypeID: func() bin.Object { return &RemoveChatActionBarRequest{} }, - ReportChatRequestTypeID: func() bin.Object { return &ReportChatRequest{} }, - ReportChatPhotoRequestTypeID: func() bin.Object { return &ReportChatPhotoRequest{} }, - ReportMessageReactionsRequestTypeID: func() bin.Object { return &ReportMessageReactionsRequest{} }, - GetChatRevenueStatisticsRequestTypeID: func() bin.Object { return &GetChatRevenueStatisticsRequest{} }, - GetChatRevenueWithdrawalURLRequestTypeID: func() bin.Object { return &GetChatRevenueWithdrawalURLRequest{} }, - GetChatRevenueTransactionsRequestTypeID: func() bin.Object { return &GetChatRevenueTransactionsRequest{} }, - GetStarRevenueStatisticsRequestTypeID: func() bin.Object { return &GetStarRevenueStatisticsRequest{} }, - GetStarWithdrawalURLRequestTypeID: func() bin.Object { return &GetStarWithdrawalURLRequest{} }, - GetStarAdAccountURLRequestTypeID: func() bin.Object { return &GetStarAdAccountURLRequest{} }, - GetChatStatisticsRequestTypeID: func() bin.Object { return &GetChatStatisticsRequest{} }, - GetMessageStatisticsRequestTypeID: func() bin.Object { return &GetMessageStatisticsRequest{} }, - GetMessagePublicForwardsRequestTypeID: func() bin.Object { return &GetMessagePublicForwardsRequest{} }, - GetStoryStatisticsRequestTypeID: func() bin.Object { return &GetStoryStatisticsRequest{} }, - GetStatisticalGraphRequestTypeID: func() bin.Object { return &GetStatisticalGraphRequest{} }, - GetStorageStatisticsRequestTypeID: func() bin.Object { return &GetStorageStatisticsRequest{} }, - GetStorageStatisticsFastRequestTypeID: func() bin.Object { return &GetStorageStatisticsFastRequest{} }, - GetDatabaseStatisticsRequestTypeID: func() bin.Object { return &GetDatabaseStatisticsRequest{} }, - OptimizeStorageRequestTypeID: func() bin.Object { return &OptimizeStorageRequest{} }, - SetNetworkTypeRequestTypeID: func() bin.Object { return &SetNetworkTypeRequest{} }, - GetNetworkStatisticsRequestTypeID: func() bin.Object { return &GetNetworkStatisticsRequest{} }, - AddNetworkStatisticsRequestTypeID: func() bin.Object { return &AddNetworkStatisticsRequest{} }, - ResetNetworkStatisticsRequestTypeID: func() bin.Object { return &ResetNetworkStatisticsRequest{} }, - GetAutoDownloadSettingsPresetsRequestTypeID: func() bin.Object { return &GetAutoDownloadSettingsPresetsRequest{} }, - SetAutoDownloadSettingsRequestTypeID: func() bin.Object { return &SetAutoDownloadSettingsRequest{} }, - GetAutosaveSettingsRequestTypeID: func() bin.Object { return &GetAutosaveSettingsRequest{} }, - SetAutosaveSettingsRequestTypeID: func() bin.Object { return &SetAutosaveSettingsRequest{} }, - ClearAutosaveSettingsExceptionsRequestTypeID: func() bin.Object { return &ClearAutosaveSettingsExceptionsRequest{} }, - GetBankCardInfoRequestTypeID: func() bin.Object { return &GetBankCardInfoRequest{} }, - GetPassportElementRequestTypeID: func() bin.Object { return &GetPassportElementRequest{} }, - GetAllPassportElementsRequestTypeID: func() bin.Object { return &GetAllPassportElementsRequest{} }, - SetPassportElementRequestTypeID: func() bin.Object { return &SetPassportElementRequest{} }, - DeletePassportElementRequestTypeID: func() bin.Object { return &DeletePassportElementRequest{} }, - SetPassportElementErrorsRequestTypeID: func() bin.Object { return &SetPassportElementErrorsRequest{} }, - GetPreferredCountryLanguageRequestTypeID: func() bin.Object { return &GetPreferredCountryLanguageRequest{} }, - SendEmailAddressVerificationCodeRequestTypeID: func() bin.Object { return &SendEmailAddressVerificationCodeRequest{} }, - ResendEmailAddressVerificationCodeRequestTypeID: func() bin.Object { return &ResendEmailAddressVerificationCodeRequest{} }, - CheckEmailAddressVerificationCodeRequestTypeID: func() bin.Object { return &CheckEmailAddressVerificationCodeRequest{} }, - GetPassportAuthorizationFormRequestTypeID: func() bin.Object { return &GetPassportAuthorizationFormRequest{} }, - GetPassportAuthorizationFormAvailableElementsRequestTypeID: func() bin.Object { return &GetPassportAuthorizationFormAvailableElementsRequest{} }, - SendPassportAuthorizationFormRequestTypeID: func() bin.Object { return &SendPassportAuthorizationFormRequest{} }, - SetBotUpdatesStatusRequestTypeID: func() bin.Object { return &SetBotUpdatesStatusRequest{} }, - UploadStickerFileRequestTypeID: func() bin.Object { return &UploadStickerFileRequest{} }, - GetSuggestedStickerSetNameRequestTypeID: func() bin.Object { return &GetSuggestedStickerSetNameRequest{} }, - CheckStickerSetNameRequestTypeID: func() bin.Object { return &CheckStickerSetNameRequest{} }, - CreateNewStickerSetRequestTypeID: func() bin.Object { return &CreateNewStickerSetRequest{} }, - AddStickerToSetRequestTypeID: func() bin.Object { return &AddStickerToSetRequest{} }, - ReplaceStickerInSetRequestTypeID: func() bin.Object { return &ReplaceStickerInSetRequest{} }, - SetStickerSetThumbnailRequestTypeID: func() bin.Object { return &SetStickerSetThumbnailRequest{} }, - SetCustomEmojiStickerSetThumbnailRequestTypeID: func() bin.Object { return &SetCustomEmojiStickerSetThumbnailRequest{} }, - SetStickerSetTitleRequestTypeID: func() bin.Object { return &SetStickerSetTitleRequest{} }, - DeleteStickerSetRequestTypeID: func() bin.Object { return &DeleteStickerSetRequest{} }, - SetStickerPositionInSetRequestTypeID: func() bin.Object { return &SetStickerPositionInSetRequest{} }, - RemoveStickerFromSetRequestTypeID: func() bin.Object { return &RemoveStickerFromSetRequest{} }, - SetStickerEmojisRequestTypeID: func() bin.Object { return &SetStickerEmojisRequest{} }, - SetStickerKeywordsRequestTypeID: func() bin.Object { return &SetStickerKeywordsRequest{} }, - SetStickerMaskPositionRequestTypeID: func() bin.Object { return &SetStickerMaskPositionRequest{} }, - GetOwnedStickerSetsRequestTypeID: func() bin.Object { return &GetOwnedStickerSetsRequest{} }, - GetMapThumbnailFileRequestTypeID: func() bin.Object { return &GetMapThumbnailFileRequest{} }, - GetPremiumLimitRequestTypeID: func() bin.Object { return &GetPremiumLimitRequest{} }, - GetPremiumFeaturesRequestTypeID: func() bin.Object { return &GetPremiumFeaturesRequest{} }, - GetPremiumStickerExamplesRequestTypeID: func() bin.Object { return &GetPremiumStickerExamplesRequest{} }, - GetPremiumInfoStickerRequestTypeID: func() bin.Object { return &GetPremiumInfoStickerRequest{} }, - ViewPremiumFeatureRequestTypeID: func() bin.Object { return &ViewPremiumFeatureRequest{} }, - ClickPremiumSubscriptionButtonRequestTypeID: func() bin.Object { return &ClickPremiumSubscriptionButtonRequest{} }, - GetPremiumStateRequestTypeID: func() bin.Object { return &GetPremiumStateRequest{} }, - GetPremiumGiftCodePaymentOptionsRequestTypeID: func() bin.Object { return &GetPremiumGiftCodePaymentOptionsRequest{} }, - CheckPremiumGiftCodeRequestTypeID: func() bin.Object { return &CheckPremiumGiftCodeRequest{} }, - ApplyPremiumGiftCodeRequestTypeID: func() bin.Object { return &ApplyPremiumGiftCodeRequest{} }, - LaunchPrepaidGiveawayRequestTypeID: func() bin.Object { return &LaunchPrepaidGiveawayRequest{} }, - GetGiveawayInfoRequestTypeID: func() bin.Object { return &GetGiveawayInfoRequest{} }, - GetStarPaymentOptionsRequestTypeID: func() bin.Object { return &GetStarPaymentOptionsRequest{} }, - GetStarGiftPaymentOptionsRequestTypeID: func() bin.Object { return &GetStarGiftPaymentOptionsRequest{} }, - GetStarGiveawayPaymentOptionsRequestTypeID: func() bin.Object { return &GetStarGiveawayPaymentOptionsRequest{} }, - GetStarTransactionsRequestTypeID: func() bin.Object { return &GetStarTransactionsRequest{} }, - GetStarSubscriptionsRequestTypeID: func() bin.Object { return &GetStarSubscriptionsRequest{} }, - CanPurchaseFromStoreRequestTypeID: func() bin.Object { return &CanPurchaseFromStoreRequest{} }, - AssignAppStoreTransactionRequestTypeID: func() bin.Object { return &AssignAppStoreTransactionRequest{} }, - AssignGooglePlayTransactionRequestTypeID: func() bin.Object { return &AssignGooglePlayTransactionRequest{} }, - EditStarSubscriptionRequestTypeID: func() bin.Object { return &EditStarSubscriptionRequest{} }, - EditUserStarSubscriptionRequestTypeID: func() bin.Object { return &EditUserStarSubscriptionRequest{} }, - ReuseStarSubscriptionRequestTypeID: func() bin.Object { return &ReuseStarSubscriptionRequest{} }, - SetChatAffiliateProgramRequestTypeID: func() bin.Object { return &SetChatAffiliateProgramRequest{} }, - SearchChatAffiliateProgramRequestTypeID: func() bin.Object { return &SearchChatAffiliateProgramRequest{} }, - SearchAffiliateProgramsRequestTypeID: func() bin.Object { return &SearchAffiliateProgramsRequest{} }, - ConnectAffiliateProgramRequestTypeID: func() bin.Object { return &ConnectAffiliateProgramRequest{} }, - DisconnectAffiliateProgramRequestTypeID: func() bin.Object { return &DisconnectAffiliateProgramRequest{} }, - GetConnectedAffiliateProgramRequestTypeID: func() bin.Object { return &GetConnectedAffiliateProgramRequest{} }, - GetConnectedAffiliateProgramsRequestTypeID: func() bin.Object { return &GetConnectedAffiliateProgramsRequest{} }, - GetBusinessFeaturesRequestTypeID: func() bin.Object { return &GetBusinessFeaturesRequest{} }, - AcceptTermsOfServiceRequestTypeID: func() bin.Object { return &AcceptTermsOfServiceRequest{} }, - SearchStringsByPrefixRequestTypeID: func() bin.Object { return &SearchStringsByPrefixRequest{} }, - SendCustomRequestRequestTypeID: func() bin.Object { return &SendCustomRequestRequest{} }, - AnswerCustomQueryRequestTypeID: func() bin.Object { return &AnswerCustomQueryRequest{} }, - SetAlarmRequestTypeID: func() bin.Object { return &SetAlarmRequest{} }, - GetCountriesRequestTypeID: func() bin.Object { return &GetCountriesRequest{} }, - GetCountryCodeRequestTypeID: func() bin.Object { return &GetCountryCodeRequest{} }, - GetPhoneNumberInfoRequestTypeID: func() bin.Object { return &GetPhoneNumberInfoRequest{} }, - GetPhoneNumberInfoSyncRequestTypeID: func() bin.Object { return &GetPhoneNumberInfoSyncRequest{} }, - GetCollectibleItemInfoRequestTypeID: func() bin.Object { return &GetCollectibleItemInfoRequest{} }, - GetDeepLinkInfoRequestTypeID: func() bin.Object { return &GetDeepLinkInfoRequest{} }, - GetApplicationConfigRequestTypeID: func() bin.Object { return &GetApplicationConfigRequest{} }, - SaveApplicationLogEventRequestTypeID: func() bin.Object { return &SaveApplicationLogEventRequest{} }, - GetApplicationDownloadLinkRequestTypeID: func() bin.Object { return &GetApplicationDownloadLinkRequest{} }, - AddProxyRequestTypeID: func() bin.Object { return &AddProxyRequest{} }, - EditProxyRequestTypeID: func() bin.Object { return &EditProxyRequest{} }, - EnableProxyRequestTypeID: func() bin.Object { return &EnableProxyRequest{} }, - DisableProxyRequestTypeID: func() bin.Object { return &DisableProxyRequest{} }, - RemoveProxyRequestTypeID: func() bin.Object { return &RemoveProxyRequest{} }, - GetProxiesRequestTypeID: func() bin.Object { return &GetProxiesRequest{} }, - GetProxyLinkRequestTypeID: func() bin.Object { return &GetProxyLinkRequest{} }, - PingProxyRequestTypeID: func() bin.Object { return &PingProxyRequest{} }, - SetLogStreamRequestTypeID: func() bin.Object { return &SetLogStreamRequest{} }, - GetLogStreamRequestTypeID: func() bin.Object { return &GetLogStreamRequest{} }, - SetLogVerbosityLevelRequestTypeID: func() bin.Object { return &SetLogVerbosityLevelRequest{} }, - GetLogVerbosityLevelRequestTypeID: func() bin.Object { return &GetLogVerbosityLevelRequest{} }, - GetLogTagsRequestTypeID: func() bin.Object { return &GetLogTagsRequest{} }, - SetLogTagVerbosityLevelRequestTypeID: func() bin.Object { return &SetLogTagVerbosityLevelRequest{} }, - GetLogTagVerbosityLevelRequestTypeID: func() bin.Object { return &GetLogTagVerbosityLevelRequest{} }, - AddLogMessageRequestTypeID: func() bin.Object { return &AddLogMessageRequest{} }, - GetUserSupportInfoRequestTypeID: func() bin.Object { return &GetUserSupportInfoRequest{} }, - SetUserSupportInfoRequestTypeID: func() bin.Object { return &SetUserSupportInfoRequest{} }, - GetSupportNameRequestTypeID: func() bin.Object { return &GetSupportNameRequest{} }, - TestCallEmptyRequestTypeID: func() bin.Object { return &TestCallEmptyRequest{} }, - TestCallStringRequestTypeID: func() bin.Object { return &TestCallStringRequest{} }, - TestCallBytesRequestTypeID: func() bin.Object { return &TestCallBytesRequest{} }, - TestCallVectorIntRequestTypeID: func() bin.Object { return &TestCallVectorIntRequest{} }, - TestCallVectorIntObjectRequestTypeID: func() bin.Object { return &TestCallVectorIntObjectRequest{} }, - TestCallVectorStringRequestTypeID: func() bin.Object { return &TestCallVectorStringRequest{} }, - TestCallVectorStringObjectRequestTypeID: func() bin.Object { return &TestCallVectorStringObjectRequest{} }, - TestSquareIntRequestTypeID: func() bin.Object { return &TestSquareIntRequest{} }, - TestNetworkRequestTypeID: func() bin.Object { return &TestNetworkRequest{} }, - TestProxyRequestTypeID: func() bin.Object { return &TestProxyRequest{} }, - TestGetDifferenceRequestTypeID: func() bin.Object { return &TestGetDifferenceRequest{} }, - TestUseUpdateRequestTypeID: func() bin.Object { return &TestUseUpdateRequest{} }, - TestReturnErrorRequestTypeID: func() bin.Object { return &TestReturnErrorRequest{} }, - } -} - -// ClassConstructorsMap maps class schema name to constructors type ids. -func ClassConstructorsMap() map[string][]uint32 { - return map[string][]uint32{ - AffiliateProgramSortOrderClassName: { - AffiliateProgramSortOrderProfitabilityTypeID, - AffiliateProgramSortOrderCreationDateTypeID, - AffiliateProgramSortOrderRevenueTypeID, - }, - AffiliateTypeClassName: { - AffiliateTypeCurrentUserTypeID, - AffiliateTypeBotTypeID, - AffiliateTypeChannelTypeID, - }, - AuthenticationCodeTypeClassName: { - AuthenticationCodeTypeTelegramMessageTypeID, - AuthenticationCodeTypeSMSTypeID, - AuthenticationCodeTypeSMSWordTypeID, - AuthenticationCodeTypeSMSPhraseTypeID, - AuthenticationCodeTypeCallTypeID, - AuthenticationCodeTypeFlashCallTypeID, - AuthenticationCodeTypeMissedCallTypeID, - AuthenticationCodeTypeFragmentTypeID, - AuthenticationCodeTypeFirebaseAndroidTypeID, - AuthenticationCodeTypeFirebaseIosTypeID, - }, - AuthorizationStateClassName: { - AuthorizationStateWaitTdlibParametersTypeID, - AuthorizationStateWaitPhoneNumberTypeID, - AuthorizationStateWaitEmailAddressTypeID, - AuthorizationStateWaitEmailCodeTypeID, - AuthorizationStateWaitCodeTypeID, - AuthorizationStateWaitOtherDeviceConfirmationTypeID, - AuthorizationStateWaitRegistrationTypeID, - AuthorizationStateWaitPasswordTypeID, - AuthorizationStateReadyTypeID, - AuthorizationStateLoggingOutTypeID, - AuthorizationStateClosingTypeID, - AuthorizationStateClosedTypeID, - }, - AutosaveSettingsScopeClassName: { - AutosaveSettingsScopePrivateChatsTypeID, - AutosaveSettingsScopeGroupChatsTypeID, - AutosaveSettingsScopeChannelChatsTypeID, - AutosaveSettingsScopeChatTypeID, - }, - BackgroundFillClassName: { - BackgroundFillSolidTypeID, - BackgroundFillGradientTypeID, - BackgroundFillFreeformGradientTypeID, - }, - BackgroundTypeClassName: { - BackgroundTypeWallpaperTypeID, - BackgroundTypePatternTypeID, - BackgroundTypeFillTypeID, - BackgroundTypeChatThemeTypeID, - }, - BlockListClassName: { - BlockListMainTypeID, - BlockListStoriesTypeID, - }, - BoolClassName: { - BoolFalseTypeID, - BoolTrueTypeID, - }, - BotCommandScopeClassName: { - BotCommandScopeDefaultTypeID, - BotCommandScopeAllPrivateChatsTypeID, - BotCommandScopeAllGroupChatsTypeID, - BotCommandScopeAllChatAdministratorsTypeID, - BotCommandScopeChatTypeID, - BotCommandScopeChatAdministratorsTypeID, - BotCommandScopeChatMemberTypeID, - }, - BotWriteAccessAllowReasonClassName: { - BotWriteAccessAllowReasonConnectedWebsiteTypeID, - BotWriteAccessAllowReasonAddedToAttachmentMenuTypeID, - BotWriteAccessAllowReasonLaunchedWebAppTypeID, - BotWriteAccessAllowReasonAcceptedRequestTypeID, - }, - BusinessAwayMessageScheduleClassName: { - BusinessAwayMessageScheduleAlwaysTypeID, - BusinessAwayMessageScheduleOutsideOfOpeningHoursTypeID, - BusinessAwayMessageScheduleCustomTypeID, - }, - BusinessFeatureClassName: { - BusinessFeatureLocationTypeID, - BusinessFeatureOpeningHoursTypeID, - BusinessFeatureQuickRepliesTypeID, - BusinessFeatureGreetingMessageTypeID, - BusinessFeatureAwayMessageTypeID, - BusinessFeatureAccountLinksTypeID, - BusinessFeatureStartPageTypeID, - BusinessFeatureBotsTypeID, - BusinessFeatureEmojiStatusTypeID, - BusinessFeatureChatFolderTagsTypeID, - BusinessFeatureUpgradedStoriesTypeID, - }, - CallDiscardReasonClassName: { - CallDiscardReasonEmptyTypeID, - CallDiscardReasonMissedTypeID, - CallDiscardReasonDeclinedTypeID, - CallDiscardReasonDisconnectedTypeID, - CallDiscardReasonHungUpTypeID, - CallDiscardReasonAllowGroupCallTypeID, - }, - CallProblemClassName: { - CallProblemEchoTypeID, - CallProblemNoiseTypeID, - CallProblemInterruptionsTypeID, - CallProblemDistortedSpeechTypeID, - CallProblemSilentLocalTypeID, - CallProblemSilentRemoteTypeID, - CallProblemDroppedTypeID, - CallProblemDistortedVideoTypeID, - CallProblemPixelatedVideoTypeID, - }, - CallServerTypeClassName: { - CallServerTypeTelegramReflectorTypeID, - CallServerTypeWebrtcTypeID, - }, - CallStateClassName: { - CallStatePendingTypeID, - CallStateExchangingKeysTypeID, - CallStateReadyTypeID, - CallStateHangingUpTypeID, - CallStateDiscardedTypeID, - CallStateErrorTypeID, - }, - CallbackQueryPayloadClassName: { - CallbackQueryPayloadDataTypeID, - CallbackQueryPayloadDataWithPasswordTypeID, - CallbackQueryPayloadGameTypeID, - }, - CanSendMessageToUserResultClassName: { - CanSendMessageToUserResultOkTypeID, - CanSendMessageToUserResultUserIsDeletedTypeID, - CanSendMessageToUserResultUserRestrictsNewChatsTypeID, - }, - CanSendStoryResultClassName: { - CanSendStoryResultOkTypeID, - CanSendStoryResultPremiumNeededTypeID, - CanSendStoryResultBoostNeededTypeID, - CanSendStoryResultActiveStoryLimitExceededTypeID, - CanSendStoryResultWeeklyLimitExceededTypeID, - CanSendStoryResultMonthlyLimitExceededTypeID, - }, - CanTransferOwnershipResultClassName: { - CanTransferOwnershipResultOkTypeID, - CanTransferOwnershipResultPasswordNeededTypeID, - CanTransferOwnershipResultPasswordTooFreshTypeID, - CanTransferOwnershipResultSessionTooFreshTypeID, - }, - ChatActionBarClassName: { - ChatActionBarReportSpamTypeID, - ChatActionBarInviteMembersTypeID, - ChatActionBarReportAddBlockTypeID, - ChatActionBarAddContactTypeID, - ChatActionBarSharePhoneNumberTypeID, - ChatActionBarJoinRequestTypeID, - }, - ChatActionClassName: { - ChatActionTypingTypeID, - ChatActionRecordingVideoTypeID, - ChatActionUploadingVideoTypeID, - ChatActionRecordingVoiceNoteTypeID, - ChatActionUploadingVoiceNoteTypeID, - ChatActionUploadingPhotoTypeID, - ChatActionUploadingDocumentTypeID, - ChatActionChoosingStickerTypeID, - ChatActionChoosingLocationTypeID, - ChatActionChoosingContactTypeID, - ChatActionStartPlayingGameTypeID, - ChatActionRecordingVideoNoteTypeID, - ChatActionUploadingVideoNoteTypeID, - ChatActionWatchingAnimationsTypeID, - ChatActionCancelTypeID, - }, - ChatAvailableReactionsClassName: { - ChatAvailableReactionsAllTypeID, - ChatAvailableReactionsSomeTypeID, - }, - ChatBoostSourceClassName: { - ChatBoostSourceGiftCodeTypeID, - ChatBoostSourceGiveawayTypeID, - ChatBoostSourcePremiumTypeID, - }, - ChatEventActionClassName: { - ChatEventMessageEditedTypeID, - ChatEventMessageDeletedTypeID, - ChatEventMessagePinnedTypeID, - ChatEventMessageUnpinnedTypeID, - ChatEventPollStoppedTypeID, - ChatEventMemberJoinedTypeID, - ChatEventMemberJoinedByInviteLinkTypeID, - ChatEventMemberJoinedByRequestTypeID, - ChatEventMemberInvitedTypeID, - ChatEventMemberLeftTypeID, - ChatEventMemberPromotedTypeID, - ChatEventMemberRestrictedTypeID, - ChatEventMemberSubscriptionExtendedTypeID, - ChatEventAvailableReactionsChangedTypeID, - ChatEventBackgroundChangedTypeID, - ChatEventDescriptionChangedTypeID, - ChatEventEmojiStatusChangedTypeID, - ChatEventLinkedChatChangedTypeID, - ChatEventLocationChangedTypeID, - ChatEventMessageAutoDeleteTimeChangedTypeID, - ChatEventPermissionsChangedTypeID, - ChatEventPhotoChangedTypeID, - ChatEventSlowModeDelayChangedTypeID, - ChatEventStickerSetChangedTypeID, - ChatEventCustomEmojiStickerSetChangedTypeID, - ChatEventTitleChangedTypeID, - ChatEventUsernameChangedTypeID, - ChatEventActiveUsernamesChangedTypeID, - ChatEventAccentColorChangedTypeID, - ChatEventProfileAccentColorChangedTypeID, - ChatEventHasProtectedContentToggledTypeID, - ChatEventInvitesToggledTypeID, - ChatEventIsAllHistoryAvailableToggledTypeID, - ChatEventHasAggressiveAntiSpamEnabledToggledTypeID, - ChatEventSignMessagesToggledTypeID, - ChatEventShowMessageSenderToggledTypeID, - ChatEventInviteLinkEditedTypeID, - ChatEventInviteLinkRevokedTypeID, - ChatEventInviteLinkDeletedTypeID, - ChatEventVideoChatCreatedTypeID, - ChatEventVideoChatEndedTypeID, - ChatEventVideoChatMuteNewParticipantsToggledTypeID, - ChatEventVideoChatParticipantIsMutedToggledTypeID, - ChatEventVideoChatParticipantVolumeLevelChangedTypeID, - ChatEventIsForumToggledTypeID, - ChatEventForumTopicCreatedTypeID, - ChatEventForumTopicEditedTypeID, - ChatEventForumTopicToggleIsClosedTypeID, - ChatEventForumTopicToggleIsHiddenTypeID, - ChatEventForumTopicDeletedTypeID, - ChatEventForumTopicPinnedTypeID, - }, - ChatListClassName: { - ChatListMainTypeID, - ChatListArchiveTypeID, - ChatListFolderTypeID, - }, - ChatMemberStatusClassName: { - ChatMemberStatusCreatorTypeID, - ChatMemberStatusAdministratorTypeID, - ChatMemberStatusMemberTypeID, - ChatMemberStatusRestrictedTypeID, - ChatMemberStatusLeftTypeID, - ChatMemberStatusBannedTypeID, - }, - ChatMembersFilterClassName: { - ChatMembersFilterContactsTypeID, - ChatMembersFilterAdministratorsTypeID, - ChatMembersFilterMembersTypeID, - ChatMembersFilterMentionTypeID, - ChatMembersFilterRestrictedTypeID, - ChatMembersFilterBannedTypeID, - ChatMembersFilterBotsTypeID, - }, - ChatPhotoStickerTypeClassName: { - ChatPhotoStickerTypeRegularOrMaskTypeID, - ChatPhotoStickerTypeCustomEmojiTypeID, - }, - ChatRevenueTransactionTypeClassName: { - ChatRevenueTransactionTypeEarningsTypeID, - ChatRevenueTransactionTypeWithdrawalTypeID, - ChatRevenueTransactionTypeRefundTypeID, - }, - ChatSourceClassName: { - ChatSourceMtprotoProxyTypeID, - ChatSourcePublicServiceAnnouncementTypeID, - }, - ChatStatisticsClassName: { - ChatStatisticsSupergroupTypeID, - ChatStatisticsChannelTypeID, - }, - ChatStatisticsObjectTypeClassName: { - ChatStatisticsObjectTypeMessageTypeID, - ChatStatisticsObjectTypeStoryTypeID, - }, - ChatTypeClassName: { - ChatTypePrivateTypeID, - ChatTypeBasicGroupTypeID, - ChatTypeSupergroupTypeID, - ChatTypeSecretTypeID, - }, - CheckChatUsernameResultClassName: { - CheckChatUsernameResultOkTypeID, - CheckChatUsernameResultUsernameInvalidTypeID, - CheckChatUsernameResultUsernameOccupiedTypeID, - CheckChatUsernameResultUsernamePurchasableTypeID, - CheckChatUsernameResultPublicChatsTooManyTypeID, - CheckChatUsernameResultPublicGroupsUnavailableTypeID, - }, - CheckStickerSetNameResultClassName: { - CheckStickerSetNameResultOkTypeID, - CheckStickerSetNameResultNameInvalidTypeID, - CheckStickerSetNameResultNameOccupiedTypeID, - }, - CollectibleItemTypeClassName: { - CollectibleItemTypeUsernameTypeID, - CollectibleItemTypePhoneNumberTypeID, - }, - ConnectionStateClassName: { - ConnectionStateWaitingForNetworkTypeID, - ConnectionStateConnectingToProxyTypeID, - ConnectionStateConnectingTypeID, - ConnectionStateUpdatingTypeID, - ConnectionStateReadyTypeID, - }, - DeviceTokenClassName: { - DeviceTokenFirebaseCloudMessagingTypeID, - DeviceTokenApplePushTypeID, - DeviceTokenApplePushVoIPTypeID, - DeviceTokenWindowsPushTypeID, - DeviceTokenMicrosoftPushTypeID, - DeviceTokenMicrosoftPushVoIPTypeID, - DeviceTokenWebPushTypeID, - DeviceTokenSimplePushTypeID, - DeviceTokenUbuntuPushTypeID, - DeviceTokenBlackBerryPushTypeID, - DeviceTokenTizenPushTypeID, - DeviceTokenHuaweiPushTypeID, - }, - DiceStickersClassName: { - DiceStickersRegularTypeID, - DiceStickersSlotMachineTypeID, - }, - EmailAddressAuthenticationClassName: { - EmailAddressAuthenticationCodeTypeID, - EmailAddressAuthenticationAppleIDTypeID, - EmailAddressAuthenticationGoogleIDTypeID, - }, - EmailAddressResetStateClassName: { - EmailAddressResetStateAvailableTypeID, - EmailAddressResetStatePendingTypeID, - }, - EmojiCategorySourceClassName: { - EmojiCategorySourceSearchTypeID, - EmojiCategorySourcePremiumTypeID, - }, - EmojiCategoryTypeClassName: { - EmojiCategoryTypeDefaultTypeID, - EmojiCategoryTypeRegularStickersTypeID, - EmojiCategoryTypeEmojiStatusTypeID, - EmojiCategoryTypeChatPhotoTypeID, - }, - FileTypeClassName: { - FileTypeNoneTypeID, - FileTypeAnimationTypeID, - FileTypeAudioTypeID, - FileTypeDocumentTypeID, - FileTypeNotificationSoundTypeID, - FileTypePhotoTypeID, - FileTypePhotoStoryTypeID, - FileTypeProfilePhotoTypeID, - FileTypeSecretTypeID, - FileTypeSecretThumbnailTypeID, - FileTypeSecureTypeID, - FileTypeSelfDestructingPhotoTypeID, - FileTypeSelfDestructingVideoTypeID, - FileTypeSelfDestructingVideoNoteTypeID, - FileTypeSelfDestructingVoiceNoteTypeID, - FileTypeStickerTypeID, - FileTypeThumbnailTypeID, - FileTypeUnknownTypeID, - FileTypeVideoTypeID, - FileTypeVideoNoteTypeID, - FileTypeVideoStoryTypeID, - FileTypeVoiceNoteTypeID, - FileTypeWallpaperTypeID, - }, - FirebaseAuthenticationSettingsClassName: { - FirebaseAuthenticationSettingsAndroidTypeID, - FirebaseAuthenticationSettingsIosTypeID, - }, - FirebaseDeviceVerificationParametersClassName: { - FirebaseDeviceVerificationParametersSafetyNetTypeID, - FirebaseDeviceVerificationParametersPlayIntegrityTypeID, - }, - GiveawayInfoClassName: { - GiveawayInfoOngoingTypeID, - GiveawayInfoCompletedTypeID, - }, - GiveawayParticipantStatusClassName: { - GiveawayParticipantStatusEligibleTypeID, - GiveawayParticipantStatusParticipatingTypeID, - GiveawayParticipantStatusAlreadyWasMemberTypeID, - GiveawayParticipantStatusAdministratorTypeID, - GiveawayParticipantStatusDisallowedCountryTypeID, - }, - GiveawayPrizeClassName: { - GiveawayPrizePremiumTypeID, - GiveawayPrizeStarsTypeID, - }, - GroupCallVideoQualityClassName: { - GroupCallVideoQualityThumbnailTypeID, - GroupCallVideoQualityMediumTypeID, - GroupCallVideoQualityFullTypeID, - }, - InlineKeyboardButtonTypeClassName: { - InlineKeyboardButtonTypeURLTypeID, - InlineKeyboardButtonTypeLoginURLTypeID, - InlineKeyboardButtonTypeWebAppTypeID, - InlineKeyboardButtonTypeCallbackTypeID, - InlineKeyboardButtonTypeCallbackWithPasswordTypeID, - InlineKeyboardButtonTypeCallbackGameTypeID, - InlineKeyboardButtonTypeSwitchInlineTypeID, - InlineKeyboardButtonTypeBuyTypeID, - InlineKeyboardButtonTypeUserTypeID, - InlineKeyboardButtonTypeCopyTextTypeID, - }, - InlineQueryResultClassName: { - InlineQueryResultArticleTypeID, - InlineQueryResultContactTypeID, - InlineQueryResultLocationTypeID, - InlineQueryResultVenueTypeID, - InlineQueryResultGameTypeID, - InlineQueryResultAnimationTypeID, - InlineQueryResultAudioTypeID, - InlineQueryResultDocumentTypeID, - InlineQueryResultPhotoTypeID, - InlineQueryResultStickerTypeID, - InlineQueryResultVideoTypeID, - InlineQueryResultVoiceNoteTypeID, - }, - InlineQueryResultsButtonTypeClassName: { - InlineQueryResultsButtonTypeStartBotTypeID, - InlineQueryResultsButtonTypeWebAppTypeID, - }, - InputBackgroundClassName: { - InputBackgroundLocalTypeID, - InputBackgroundRemoteTypeID, - InputBackgroundPreviousTypeID, - }, - InputChatPhotoClassName: { - InputChatPhotoPreviousTypeID, - InputChatPhotoStaticTypeID, - InputChatPhotoAnimationTypeID, - InputChatPhotoStickerTypeID, - }, - InputCredentialsClassName: { - InputCredentialsSavedTypeID, - InputCredentialsNewTypeID, - InputCredentialsApplePayTypeID, - InputCredentialsGooglePayTypeID, - }, - InputFileClassName: { - InputFileIDTypeID, - InputFileRemoteTypeID, - InputFileLocalTypeID, - InputFileGeneratedTypeID, - }, - InputInlineQueryResultClassName: { - InputInlineQueryResultAnimationTypeID, - InputInlineQueryResultArticleTypeID, - InputInlineQueryResultAudioTypeID, - InputInlineQueryResultContactTypeID, - InputInlineQueryResultDocumentTypeID, - InputInlineQueryResultGameTypeID, - InputInlineQueryResultLocationTypeID, - InputInlineQueryResultPhotoTypeID, - InputInlineQueryResultStickerTypeID, - InputInlineQueryResultVenueTypeID, - InputInlineQueryResultVideoTypeID, - InputInlineQueryResultVoiceNoteTypeID, - }, - InputInvoiceClassName: { - InputInvoiceMessageTypeID, - InputInvoiceNameTypeID, - InputInvoiceTelegramTypeID, - }, - InputMessageContentClassName: { - InputMessageTextTypeID, - InputMessageAnimationTypeID, - InputMessageAudioTypeID, - InputMessageDocumentTypeID, - InputMessagePaidMediaTypeID, - InputMessagePhotoTypeID, - InputMessageStickerTypeID, - InputMessageVideoTypeID, - InputMessageVideoNoteTypeID, - InputMessageVoiceNoteTypeID, - InputMessageLocationTypeID, - InputMessageVenueTypeID, - InputMessageContactTypeID, - InputMessageDiceTypeID, - InputMessageGameTypeID, - InputMessageInvoiceTypeID, - InputMessagePollTypeID, - InputMessageStoryTypeID, - InputMessageForwardedTypeID, - }, - InputMessageReplyToClassName: { - InputMessageReplyToMessageTypeID, - InputMessageReplyToExternalMessageTypeID, - InputMessageReplyToStoryTypeID, - }, - InputPaidMediaTypeClassName: { - InputPaidMediaTypePhotoTypeID, - InputPaidMediaTypeVideoTypeID, - }, - InputPassportElementClassName: { - InputPassportElementPersonalDetailsTypeID, - InputPassportElementPassportTypeID, - InputPassportElementDriverLicenseTypeID, - InputPassportElementIdentityCardTypeID, - InputPassportElementInternalPassportTypeID, - InputPassportElementAddressTypeID, - InputPassportElementUtilityBillTypeID, - InputPassportElementBankStatementTypeID, - InputPassportElementRentalAgreementTypeID, - InputPassportElementPassportRegistrationTypeID, - InputPassportElementTemporaryRegistrationTypeID, - InputPassportElementPhoneNumberTypeID, - InputPassportElementEmailAddressTypeID, - }, - InputPassportElementErrorSourceClassName: { - InputPassportElementErrorSourceUnspecifiedTypeID, - InputPassportElementErrorSourceDataFieldTypeID, - InputPassportElementErrorSourceFrontSideTypeID, - InputPassportElementErrorSourceReverseSideTypeID, - InputPassportElementErrorSourceSelfieTypeID, - InputPassportElementErrorSourceTranslationFileTypeID, - InputPassportElementErrorSourceTranslationFilesTypeID, - InputPassportElementErrorSourceFileTypeID, - InputPassportElementErrorSourceFilesTypeID, - }, - InputStoryAreaTypeClassName: { - InputStoryAreaTypeLocationTypeID, - InputStoryAreaTypeFoundVenueTypeID, - InputStoryAreaTypePreviousVenueTypeID, - InputStoryAreaTypeSuggestedReactionTypeID, - InputStoryAreaTypeMessageTypeID, - InputStoryAreaTypeLinkTypeID, - InputStoryAreaTypeWeatherTypeID, - }, - InputStoryContentClassName: { - InputStoryContentPhotoTypeID, - InputStoryContentVideoTypeID, - }, - InternalLinkTypeClassName: { - InternalLinkTypeActiveSessionsTypeID, - InternalLinkTypeAttachmentMenuBotTypeID, - InternalLinkTypeAuthenticationCodeTypeID, - InternalLinkTypeBackgroundTypeID, - InternalLinkTypeBotAddToChannelTypeID, - InternalLinkTypeBotStartTypeID, - InternalLinkTypeBotStartInGroupTypeID, - InternalLinkTypeBusinessChatTypeID, - InternalLinkTypeBuyStarsTypeID, - InternalLinkTypeChangePhoneNumberTypeID, - InternalLinkTypeChatAffiliateProgramTypeID, - InternalLinkTypeChatBoostTypeID, - InternalLinkTypeChatFolderInviteTypeID, - InternalLinkTypeChatFolderSettingsTypeID, - InternalLinkTypeChatInviteTypeID, - InternalLinkTypeDefaultMessageAutoDeleteTimerSettingsTypeID, - InternalLinkTypeEditProfileSettingsTypeID, - InternalLinkTypeGameTypeID, - InternalLinkTypeInstantViewTypeID, - InternalLinkTypeInvoiceTypeID, - InternalLinkTypeLanguagePackTypeID, - InternalLinkTypeLanguageSettingsTypeID, - InternalLinkTypeMainWebAppTypeID, - InternalLinkTypeMessageTypeID, - InternalLinkTypeMessageDraftTypeID, - InternalLinkTypePassportDataRequestTypeID, - InternalLinkTypePhoneNumberConfirmationTypeID, - InternalLinkTypePremiumFeaturesTypeID, - InternalLinkTypePremiumGiftTypeID, - InternalLinkTypePremiumGiftCodeTypeID, - InternalLinkTypePrivacyAndSecuritySettingsTypeID, - InternalLinkTypeProxyTypeID, - InternalLinkTypePublicChatTypeID, - InternalLinkTypeQrCodeAuthenticationTypeID, - InternalLinkTypeRestorePurchasesTypeID, - InternalLinkTypeSettingsTypeID, - InternalLinkTypeStickerSetTypeID, - InternalLinkTypeStoryTypeID, - InternalLinkTypeThemeTypeID, - InternalLinkTypeThemeSettingsTypeID, - InternalLinkTypeUnknownDeepLinkTypeID, - InternalLinkTypeUnsupportedProxyTypeID, - InternalLinkTypeUserPhoneNumberTypeID, - InternalLinkTypeUserTokenTypeID, - InternalLinkTypeVideoChatTypeID, - InternalLinkTypeWebAppTypeID, - }, - InviteLinkChatTypeClassName: { - InviteLinkChatTypeBasicGroupTypeID, - InviteLinkChatTypeSupergroupTypeID, - InviteLinkChatTypeChannelTypeID, - }, - JSONValueClassName: { - JSONValueNullTypeID, - JSONValueBooleanTypeID, - JSONValueNumberTypeID, - JSONValueStringTypeID, - JSONValueArrayTypeID, - JSONValueObjectTypeID, - }, - KeyboardButtonTypeClassName: { - KeyboardButtonTypeTextTypeID, - KeyboardButtonTypeRequestPhoneNumberTypeID, - KeyboardButtonTypeRequestLocationTypeID, - KeyboardButtonTypeRequestPollTypeID, - KeyboardButtonTypeRequestUsersTypeID, - KeyboardButtonTypeRequestChatTypeID, - KeyboardButtonTypeWebAppTypeID, - }, - LanguagePackStringValueClassName: { - LanguagePackStringValueOrdinaryTypeID, - LanguagePackStringValuePluralizedTypeID, - LanguagePackStringValueDeletedTypeID, - }, - LinkPreviewAlbumMediaClassName: { - LinkPreviewAlbumMediaPhotoTypeID, - LinkPreviewAlbumMediaVideoTypeID, - }, - LinkPreviewTypeClassName: { - LinkPreviewTypeAlbumTypeID, - LinkPreviewTypeAnimationTypeID, - LinkPreviewTypeAppTypeID, - LinkPreviewTypeArticleTypeID, - LinkPreviewTypeAudioTypeID, - LinkPreviewTypeBackgroundTypeID, - LinkPreviewTypeChannelBoostTypeID, - LinkPreviewTypeChatTypeID, - LinkPreviewTypeDocumentTypeID, - LinkPreviewTypeEmbeddedAnimationPlayerTypeID, - LinkPreviewTypeEmbeddedAudioPlayerTypeID, - LinkPreviewTypeEmbeddedVideoPlayerTypeID, - LinkPreviewTypeExternalAudioTypeID, - LinkPreviewTypeExternalVideoTypeID, - LinkPreviewTypeInvoiceTypeID, - LinkPreviewTypeMessageTypeID, - LinkPreviewTypePhotoTypeID, - LinkPreviewTypePremiumGiftCodeTypeID, - LinkPreviewTypeShareableChatFolderTypeID, - LinkPreviewTypeStickerTypeID, - LinkPreviewTypeStickerSetTypeID, - LinkPreviewTypeStoryTypeID, - LinkPreviewTypeSupergroupBoostTypeID, - LinkPreviewTypeThemeTypeID, - LinkPreviewTypeUnsupportedTypeID, - LinkPreviewTypeUserTypeID, - LinkPreviewTypeVideoTypeID, - LinkPreviewTypeVideoChatTypeID, - LinkPreviewTypeVideoNoteTypeID, - LinkPreviewTypeVoiceNoteTypeID, - LinkPreviewTypeWebAppTypeID, - }, - LogStreamClassName: { - LogStreamDefaultTypeID, - LogStreamFileTypeID, - LogStreamEmptyTypeID, - }, - LoginURLInfoClassName: { - LoginURLInfoOpenTypeID, - LoginURLInfoRequestConfirmationTypeID, - }, - MaskPointClassName: { - MaskPointForeheadTypeID, - MaskPointEyesTypeID, - MaskPointMouthTypeID, - MaskPointChinTypeID, - }, - MessageContentClassName: { - MessageTextTypeID, - MessageAnimationTypeID, - MessageAudioTypeID, - MessageDocumentTypeID, - MessagePaidMediaTypeID, - MessagePhotoTypeID, - MessageStickerTypeID, - MessageVideoTypeID, - MessageVideoNoteTypeID, - MessageVoiceNoteTypeID, - MessageExpiredPhotoTypeID, - MessageExpiredVideoTypeID, - MessageExpiredVideoNoteTypeID, - MessageExpiredVoiceNoteTypeID, - MessageLocationTypeID, - MessageVenueTypeID, - MessageContactTypeID, - MessageAnimatedEmojiTypeID, - MessageDiceTypeID, - MessageGameTypeID, - MessagePollTypeID, - MessageStoryTypeID, - MessageInvoiceTypeID, - MessageCallTypeID, - MessageVideoChatScheduledTypeID, - MessageVideoChatStartedTypeID, - MessageVideoChatEndedTypeID, - MessageInviteVideoChatParticipantsTypeID, - MessageBasicGroupChatCreateTypeID, - MessageSupergroupChatCreateTypeID, - MessageChatChangeTitleTypeID, - MessageChatChangePhotoTypeID, - MessageChatDeletePhotoTypeID, - MessageChatAddMembersTypeID, - MessageChatJoinByLinkTypeID, - MessageChatJoinByRequestTypeID, - MessageChatDeleteMemberTypeID, - MessageChatUpgradeToTypeID, - MessageChatUpgradeFromTypeID, - MessagePinMessageTypeID, - MessageScreenshotTakenTypeID, - MessageChatSetBackgroundTypeID, - MessageChatSetThemeTypeID, - MessageChatSetMessageAutoDeleteTimeTypeID, - MessageChatBoostTypeID, - MessageForumTopicCreatedTypeID, - MessageForumTopicEditedTypeID, - MessageForumTopicIsClosedToggledTypeID, - MessageForumTopicIsHiddenToggledTypeID, - MessageSuggestProfilePhotoTypeID, - MessageCustomServiceActionTypeID, - MessageGameScoreTypeID, - MessagePaymentSuccessfulTypeID, - MessagePaymentSuccessfulBotTypeID, - MessagePaymentRefundedTypeID, - MessageGiftedPremiumTypeID, - MessagePremiumGiftCodeTypeID, - MessageGiveawayCreatedTypeID, - MessageGiveawayTypeID, - MessageGiveawayCompletedTypeID, - MessageGiveawayWinnersTypeID, - MessageGiftedStarsTypeID, - MessageGiveawayPrizeStarsTypeID, - MessageGiftTypeID, - MessageUpgradedGiftTypeID, - MessageRefundedUpgradedGiftTypeID, - MessageContactRegisteredTypeID, - MessageUsersSharedTypeID, - MessageChatSharedTypeID, - MessageBotWriteAccessAllowedTypeID, - MessageWebAppDataSentTypeID, - MessageWebAppDataReceivedTypeID, - MessagePassportDataSentTypeID, - MessagePassportDataReceivedTypeID, - MessageProximityAlertTriggeredTypeID, - MessageUnsupportedTypeID, - }, - MessageEffectTypeClassName: { - MessageEffectTypeEmojiReactionTypeID, - MessageEffectTypePremiumStickerTypeID, - }, - MessageFileTypeClassName: { - MessageFileTypePrivateTypeID, - MessageFileTypeGroupTypeID, - MessageFileTypeUnknownTypeID, - }, - MessageOriginClassName: { - MessageOriginUserTypeID, - MessageOriginHiddenUserTypeID, - MessageOriginChatTypeID, - MessageOriginChannelTypeID, - }, - MessageReadDateClassName: { - MessageReadDateReadTypeID, - MessageReadDateUnreadTypeID, - MessageReadDateTooOldTypeID, - MessageReadDateUserPrivacyRestrictedTypeID, - MessageReadDateMyPrivacyRestrictedTypeID, - }, - MessageReplyToClassName: { - MessageReplyToMessageTypeID, - MessageReplyToStoryTypeID, - }, - MessageSchedulingStateClassName: { - MessageSchedulingStateSendAtDateTypeID, - MessageSchedulingStateSendWhenOnlineTypeID, - MessageSchedulingStateSendWhenVideoProcessedTypeID, - }, - MessageSelfDestructTypeClassName: { - MessageSelfDestructTypeTimerTypeID, - MessageSelfDestructTypeImmediatelyTypeID, - }, - MessageSenderClassName: { - MessageSenderUserTypeID, - MessageSenderChatTypeID, - }, - MessageSendingStateClassName: { - MessageSendingStatePendingTypeID, - MessageSendingStateFailedTypeID, - }, - MessageSourceClassName: { - MessageSourceChatHistoryTypeID, - MessageSourceMessageThreadHistoryTypeID, - MessageSourceForumTopicHistoryTypeID, - MessageSourceHistoryPreviewTypeID, - MessageSourceChatListTypeID, - MessageSourceSearchTypeID, - MessageSourceChatEventLogTypeID, - MessageSourceNotificationTypeID, - MessageSourceScreenshotTypeID, - MessageSourceOtherTypeID, - }, - NetworkStatisticsEntryClassName: { - NetworkStatisticsEntryFileTypeID, - NetworkStatisticsEntryCallTypeID, - }, - NetworkTypeClassName: { - NetworkTypeNoneTypeID, - NetworkTypeMobileTypeID, - NetworkTypeMobileRoamingTypeID, - NetworkTypeWiFiTypeID, - NetworkTypeOtherTypeID, - }, - NotificationGroupTypeClassName: { - NotificationGroupTypeMessagesTypeID, - NotificationGroupTypeMentionsTypeID, - NotificationGroupTypeSecretChatTypeID, - NotificationGroupTypeCallsTypeID, - }, - NotificationSettingsScopeClassName: { - NotificationSettingsScopePrivateChatsTypeID, - NotificationSettingsScopeGroupChatsTypeID, - NotificationSettingsScopeChannelChatsTypeID, - }, - NotificationTypeClassName: { - NotificationTypeNewMessageTypeID, - NotificationTypeNewSecretChatTypeID, - NotificationTypeNewCallTypeID, - NotificationTypeNewPushMessageTypeID, - }, - OptionValueClassName: { - OptionValueBooleanTypeID, - OptionValueEmptyTypeID, - OptionValueIntegerTypeID, - OptionValueStringTypeID, - }, - PageBlockClassName: { - PageBlockTitleTypeID, - PageBlockSubtitleTypeID, - PageBlockAuthorDateTypeID, - PageBlockHeaderTypeID, - PageBlockSubheaderTypeID, - PageBlockKickerTypeID, - PageBlockParagraphTypeID, - PageBlockPreformattedTypeID, - PageBlockFooterTypeID, - PageBlockDividerTypeID, - PageBlockAnchorTypeID, - PageBlockListTypeID, - PageBlockBlockQuoteTypeID, - PageBlockPullQuoteTypeID, - PageBlockAnimationTypeID, - PageBlockAudioTypeID, - PageBlockPhotoTypeID, - PageBlockVideoTypeID, - PageBlockVoiceNoteTypeID, - PageBlockCoverTypeID, - PageBlockEmbeddedTypeID, - PageBlockEmbeddedPostTypeID, - PageBlockCollageTypeID, - PageBlockSlideshowTypeID, - PageBlockChatLinkTypeID, - PageBlockTableTypeID, - PageBlockDetailsTypeID, - PageBlockRelatedArticlesTypeID, - PageBlockMapTypeID, - }, - PageBlockHorizontalAlignmentClassName: { - PageBlockHorizontalAlignmentLeftTypeID, - PageBlockHorizontalAlignmentCenterTypeID, - PageBlockHorizontalAlignmentRightTypeID, - }, - PageBlockVerticalAlignmentClassName: { - PageBlockVerticalAlignmentTopTypeID, - PageBlockVerticalAlignmentMiddleTypeID, - PageBlockVerticalAlignmentBottomTypeID, - }, - PaidMediaClassName: { - PaidMediaPreviewTypeID, - PaidMediaPhotoTypeID, - PaidMediaVideoTypeID, - PaidMediaUnsupportedTypeID, - }, - PassportElementClassName: { - PassportElementPersonalDetailsTypeID, - PassportElementPassportTypeID, - PassportElementDriverLicenseTypeID, - PassportElementIdentityCardTypeID, - PassportElementInternalPassportTypeID, - PassportElementAddressTypeID, - PassportElementUtilityBillTypeID, - PassportElementBankStatementTypeID, - PassportElementRentalAgreementTypeID, - PassportElementPassportRegistrationTypeID, - PassportElementTemporaryRegistrationTypeID, - PassportElementPhoneNumberTypeID, - PassportElementEmailAddressTypeID, - }, - PassportElementErrorSourceClassName: { - PassportElementErrorSourceUnspecifiedTypeID, - PassportElementErrorSourceDataFieldTypeID, - PassportElementErrorSourceFrontSideTypeID, - PassportElementErrorSourceReverseSideTypeID, - PassportElementErrorSourceSelfieTypeID, - PassportElementErrorSourceTranslationFileTypeID, - PassportElementErrorSourceTranslationFilesTypeID, - PassportElementErrorSourceFileTypeID, - PassportElementErrorSourceFilesTypeID, - }, - PassportElementTypeClassName: { - PassportElementTypePersonalDetailsTypeID, - PassportElementTypePassportTypeID, - PassportElementTypeDriverLicenseTypeID, - PassportElementTypeIdentityCardTypeID, - PassportElementTypeInternalPassportTypeID, - PassportElementTypeAddressTypeID, - PassportElementTypeUtilityBillTypeID, - PassportElementTypeBankStatementTypeID, - PassportElementTypeRentalAgreementTypeID, - PassportElementTypePassportRegistrationTypeID, - PassportElementTypeTemporaryRegistrationTypeID, - PassportElementTypePhoneNumberTypeID, - PassportElementTypeEmailAddressTypeID, - }, - PaymentFormTypeClassName: { - PaymentFormTypeRegularTypeID, - PaymentFormTypeStarsTypeID, - PaymentFormTypeStarSubscriptionTypeID, - }, - PaymentProviderClassName: { - PaymentProviderSmartGlocalTypeID, - PaymentProviderStripeTypeID, - PaymentProviderOtherTypeID, - }, - PaymentReceiptTypeClassName: { - PaymentReceiptTypeRegularTypeID, - PaymentReceiptTypeStarsTypeID, - }, - PhoneNumberCodeTypeClassName: { - PhoneNumberCodeTypeChangeTypeID, - PhoneNumberCodeTypeVerifyTypeID, - PhoneNumberCodeTypeConfirmOwnershipTypeID, - }, - PollTypeClassName: { - PollTypeRegularTypeID, - PollTypeQuizTypeID, - }, - PremiumFeatureClassName: { - PremiumFeatureIncreasedLimitsTypeID, - PremiumFeatureIncreasedUploadFileSizeTypeID, - PremiumFeatureImprovedDownloadSpeedTypeID, - PremiumFeatureVoiceRecognitionTypeID, - PremiumFeatureDisabledAdsTypeID, - PremiumFeatureUniqueReactionsTypeID, - PremiumFeatureUniqueStickersTypeID, - PremiumFeatureCustomEmojiTypeID, - PremiumFeatureAdvancedChatManagementTypeID, - PremiumFeatureProfileBadgeTypeID, - PremiumFeatureEmojiStatusTypeID, - PremiumFeatureAnimatedProfilePhotoTypeID, - PremiumFeatureForumTopicIconTypeID, - PremiumFeatureAppIconsTypeID, - PremiumFeatureRealTimeChatTranslationTypeID, - PremiumFeatureUpgradedStoriesTypeID, - PremiumFeatureChatBoostTypeID, - PremiumFeatureAccentColorTypeID, - PremiumFeatureBackgroundForBothTypeID, - PremiumFeatureSavedMessagesTagsTypeID, - PremiumFeatureMessagePrivacyTypeID, - PremiumFeatureLastSeenTimesTypeID, - PremiumFeatureBusinessTypeID, - PremiumFeatureMessageEffectsTypeID, - }, - PremiumLimitTypeClassName: { - PremiumLimitTypeSupergroupCountTypeID, - PremiumLimitTypePinnedChatCountTypeID, - PremiumLimitTypeCreatedPublicChatCountTypeID, - PremiumLimitTypeSavedAnimationCountTypeID, - PremiumLimitTypeFavoriteStickerCountTypeID, - PremiumLimitTypeChatFolderCountTypeID, - PremiumLimitTypeChatFolderChosenChatCountTypeID, - PremiumLimitTypePinnedArchivedChatCountTypeID, - PremiumLimitTypePinnedSavedMessagesTopicCountTypeID, - PremiumLimitTypeCaptionLengthTypeID, - PremiumLimitTypeBioLengthTypeID, - PremiumLimitTypeChatFolderInviteLinkCountTypeID, - PremiumLimitTypeShareableChatFolderCountTypeID, - PremiumLimitTypeActiveStoryCountTypeID, - PremiumLimitTypeWeeklySentStoryCountTypeID, - PremiumLimitTypeMonthlySentStoryCountTypeID, - PremiumLimitTypeStoryCaptionLengthTypeID, - PremiumLimitTypeStorySuggestedReactionAreaCountTypeID, - PremiumLimitTypeSimilarChatCountTypeID, - }, - PremiumSourceClassName: { - PremiumSourceLimitExceededTypeID, - PremiumSourceFeatureTypeID, - PremiumSourceBusinessFeatureTypeID, - PremiumSourceStoryFeatureTypeID, - PremiumSourceLinkTypeID, - PremiumSourceSettingsTypeID, - }, - PremiumStoryFeatureClassName: { - PremiumStoryFeaturePriorityOrderTypeID, - PremiumStoryFeatureStealthModeTypeID, - PremiumStoryFeaturePermanentViewsHistoryTypeID, - PremiumStoryFeatureCustomExpirationDurationTypeID, - PremiumStoryFeatureSaveStoriesTypeID, - PremiumStoryFeatureLinksAndFormattingTypeID, - PremiumStoryFeatureVideoQualityTypeID, - }, - ProxyTypeClassName: { - ProxyTypeSocks5TypeID, - ProxyTypeHTTPTypeID, - ProxyTypeMtprotoTypeID, - }, - PublicChatTypeClassName: { - PublicChatTypeHasUsernameTypeID, - PublicChatTypeIsLocationBasedTypeID, - }, - PublicForwardClassName: { - PublicForwardMessageTypeID, - PublicForwardStoryTypeID, - }, - PushMessageContentClassName: { - PushMessageContentHiddenTypeID, - PushMessageContentAnimationTypeID, - PushMessageContentAudioTypeID, - PushMessageContentContactTypeID, - PushMessageContentContactRegisteredTypeID, - PushMessageContentDocumentTypeID, - PushMessageContentGameTypeID, - PushMessageContentGameScoreTypeID, - PushMessageContentInvoiceTypeID, - PushMessageContentLocationTypeID, - PushMessageContentPaidMediaTypeID, - PushMessageContentPhotoTypeID, - PushMessageContentPollTypeID, - PushMessageContentPremiumGiftCodeTypeID, - PushMessageContentGiveawayTypeID, - PushMessageContentGiftTypeID, - PushMessageContentUpgradedGiftTypeID, - PushMessageContentScreenshotTakenTypeID, - PushMessageContentStickerTypeID, - PushMessageContentStoryTypeID, - PushMessageContentTextTypeID, - PushMessageContentVideoTypeID, - PushMessageContentVideoNoteTypeID, - PushMessageContentVoiceNoteTypeID, - PushMessageContentBasicGroupChatCreateTypeID, - PushMessageContentChatAddMembersTypeID, - PushMessageContentChatChangePhotoTypeID, - PushMessageContentChatChangeTitleTypeID, - PushMessageContentChatSetBackgroundTypeID, - PushMessageContentChatSetThemeTypeID, - PushMessageContentChatDeleteMemberTypeID, - PushMessageContentChatJoinByLinkTypeID, - PushMessageContentChatJoinByRequestTypeID, - PushMessageContentRecurringPaymentTypeID, - PushMessageContentSuggestProfilePhotoTypeID, - PushMessageContentMessageForwardsTypeID, - PushMessageContentMediaAlbumTypeID, - }, - ReactionNotificationSourceClassName: { - ReactionNotificationSourceNoneTypeID, - ReactionNotificationSourceContactsTypeID, - ReactionNotificationSourceAllTypeID, - }, - ReactionTypeClassName: { - ReactionTypeEmojiTypeID, - ReactionTypeCustomEmojiTypeID, - ReactionTypePaidTypeID, - }, - ReactionUnavailabilityReasonClassName: { - ReactionUnavailabilityReasonAnonymousAdministratorTypeID, - ReactionUnavailabilityReasonGuestTypeID, - }, - ReplyMarkupClassName: { - ReplyMarkupRemoveKeyboardTypeID, - ReplyMarkupForceReplyTypeID, - ReplyMarkupShowKeyboardTypeID, - ReplyMarkupInlineKeyboardTypeID, - }, - ReportChatResultClassName: { - ReportChatResultOkTypeID, - ReportChatResultOptionRequiredTypeID, - ReportChatResultTextRequiredTypeID, - ReportChatResultMessagesRequiredTypeID, - }, - ReportChatSponsoredMessageResultClassName: { - ReportChatSponsoredMessageResultOkTypeID, - ReportChatSponsoredMessageResultFailedTypeID, - ReportChatSponsoredMessageResultOptionRequiredTypeID, - ReportChatSponsoredMessageResultAdsHiddenTypeID, - ReportChatSponsoredMessageResultPremiumRequiredTypeID, - }, - ReportReasonClassName: { - ReportReasonSpamTypeID, - ReportReasonViolenceTypeID, - ReportReasonPornographyTypeID, - ReportReasonChildAbuseTypeID, - ReportReasonCopyrightTypeID, - ReportReasonUnrelatedLocationTypeID, - ReportReasonFakeTypeID, - ReportReasonIllegalDrugsTypeID, - ReportReasonPersonalDetailsTypeID, - ReportReasonCustomTypeID, - }, - ReportStoryResultClassName: { - ReportStoryResultOkTypeID, - ReportStoryResultOptionRequiredTypeID, - ReportStoryResultTextRequiredTypeID, - }, - ResendCodeReasonClassName: { - ResendCodeReasonUserRequestTypeID, - ResendCodeReasonVerificationFailedTypeID, - }, - ResetPasswordResultClassName: { - ResetPasswordResultOkTypeID, - ResetPasswordResultPendingTypeID, - ResetPasswordResultDeclinedTypeID, - }, - RevenueWithdrawalStateClassName: { - RevenueWithdrawalStatePendingTypeID, - RevenueWithdrawalStateSucceededTypeID, - RevenueWithdrawalStateFailedTypeID, - }, - RichTextClassName: { - RichTextPlainTypeID, - RichTextBoldTypeID, - RichTextItalicTypeID, - RichTextUnderlineTypeID, - RichTextStrikethroughTypeID, - RichTextFixedTypeID, - RichTextURLTypeID, - RichTextEmailAddressTypeID, - RichTextSubscriptTypeID, - RichTextSuperscriptTypeID, - RichTextMarkedTypeID, - RichTextPhoneNumberTypeID, - RichTextIconTypeID, - RichTextReferenceTypeID, - RichTextAnchorTypeID, - RichTextAnchorLinkTypeID, - RichTextsTypeID, - }, - SavedMessagesTopicTypeClassName: { - SavedMessagesTopicTypeMyNotesTypeID, - SavedMessagesTopicTypeAuthorHiddenTypeID, - SavedMessagesTopicTypeSavedFromChatTypeID, - }, - SearchMessagesChatTypeFilterClassName: { - SearchMessagesChatTypeFilterPrivateTypeID, - SearchMessagesChatTypeFilterGroupTypeID, - SearchMessagesChatTypeFilterChannelTypeID, - }, - SearchMessagesFilterClassName: { - SearchMessagesFilterEmptyTypeID, - SearchMessagesFilterAnimationTypeID, - SearchMessagesFilterAudioTypeID, - SearchMessagesFilterDocumentTypeID, - SearchMessagesFilterPhotoTypeID, - SearchMessagesFilterVideoTypeID, - SearchMessagesFilterVoiceNoteTypeID, - SearchMessagesFilterPhotoAndVideoTypeID, - SearchMessagesFilterURLTypeID, - SearchMessagesFilterChatPhotoTypeID, - SearchMessagesFilterVideoNoteTypeID, - SearchMessagesFilterVoiceAndVideoNoteTypeID, - SearchMessagesFilterMentionTypeID, - SearchMessagesFilterUnreadMentionTypeID, - SearchMessagesFilterUnreadReactionTypeID, - SearchMessagesFilterFailedToSendTypeID, - SearchMessagesFilterPinnedTypeID, - }, - SecretChatStateClassName: { - SecretChatStatePendingTypeID, - SecretChatStateReadyTypeID, - SecretChatStateClosedTypeID, - }, - SentGiftClassName: { - SentGiftRegularTypeID, - SentGiftUpgradedTypeID, - }, - SessionTypeClassName: { - SessionTypeAndroidTypeID, - SessionTypeAppleTypeID, - SessionTypeBraveTypeID, - SessionTypeChromeTypeID, - SessionTypeEdgeTypeID, - SessionTypeFirefoxTypeID, - SessionTypeIpadTypeID, - SessionTypeIphoneTypeID, - SessionTypeLinuxTypeID, - SessionTypeMACTypeID, - SessionTypeOperaTypeID, - SessionTypeSafariTypeID, - SessionTypeUbuntuTypeID, - SessionTypeUnknownTypeID, - SessionTypeVivaldiTypeID, - SessionTypeWindowsTypeID, - SessionTypeXboxTypeID, - }, - SpeechRecognitionResultClassName: { - SpeechRecognitionResultPendingTypeID, - SpeechRecognitionResultTextTypeID, - SpeechRecognitionResultErrorTypeID, - }, - StarSubscriptionTypeClassName: { - StarSubscriptionTypeChannelTypeID, - StarSubscriptionTypeBotTypeID, - }, - StarTransactionDirectionClassName: { - StarTransactionDirectionIncomingTypeID, - StarTransactionDirectionOutgoingTypeID, - }, - StarTransactionTypeClassName: { - StarTransactionTypePremiumBotDepositTypeID, - StarTransactionTypeAppStoreDepositTypeID, - StarTransactionTypeGooglePlayDepositTypeID, - StarTransactionTypeFragmentDepositTypeID, - StarTransactionTypeUserDepositTypeID, - StarTransactionTypeGiveawayDepositTypeID, - StarTransactionTypeFragmentWithdrawalTypeID, - StarTransactionTypeTelegramAdsWithdrawalTypeID, - StarTransactionTypeTelegramAPIUsageTypeID, - StarTransactionTypeBotPaidMediaPurchaseTypeID, - StarTransactionTypeBotPaidMediaSaleTypeID, - StarTransactionTypeChannelPaidMediaPurchaseTypeID, - StarTransactionTypeChannelPaidMediaSaleTypeID, - StarTransactionTypeBotInvoicePurchaseTypeID, - StarTransactionTypeBotInvoiceSaleTypeID, - StarTransactionTypeBotSubscriptionPurchaseTypeID, - StarTransactionTypeBotSubscriptionSaleTypeID, - StarTransactionTypeChannelSubscriptionPurchaseTypeID, - StarTransactionTypeChannelSubscriptionSaleTypeID, - StarTransactionTypeGiftPurchaseTypeID, - StarTransactionTypeGiftTransferTypeID, - StarTransactionTypeGiftSaleTypeID, - StarTransactionTypeGiftUpgradeTypeID, - StarTransactionTypeChannelPaidReactionSendTypeID, - StarTransactionTypeChannelPaidReactionReceiveTypeID, - StarTransactionTypeAffiliateProgramCommissionTypeID, - StarTransactionTypeUnsupportedTypeID, - }, - StatisticalGraphClassName: { - StatisticalGraphDataTypeID, - StatisticalGraphAsyncTypeID, - StatisticalGraphErrorTypeID, - }, - StickerFormatClassName: { - StickerFormatWebpTypeID, - StickerFormatTgsTypeID, - StickerFormatWebmTypeID, - }, - StickerFullTypeClassName: { - StickerFullTypeRegularTypeID, - StickerFullTypeMaskTypeID, - StickerFullTypeCustomEmojiTypeID, - }, - StickerTypeClassName: { - StickerTypeRegularTypeID, - StickerTypeMaskTypeID, - StickerTypeCustomEmojiTypeID, - }, - StorePaymentPurposeClassName: { - StorePaymentPurposePremiumSubscriptionTypeID, - StorePaymentPurposePremiumGiftCodesTypeID, - StorePaymentPurposePremiumGiveawayTypeID, - StorePaymentPurposeStarGiveawayTypeID, - StorePaymentPurposeStarsTypeID, - StorePaymentPurposeGiftedStarsTypeID, - }, - StoryAreaTypeClassName: { - StoryAreaTypeLocationTypeID, - StoryAreaTypeVenueTypeID, - StoryAreaTypeSuggestedReactionTypeID, - StoryAreaTypeMessageTypeID, - StoryAreaTypeLinkTypeID, - StoryAreaTypeWeatherTypeID, - }, - StoryContentClassName: { - StoryContentPhotoTypeID, - StoryContentVideoTypeID, - StoryContentUnsupportedTypeID, - }, - StoryInteractionTypeClassName: { - StoryInteractionTypeViewTypeID, - StoryInteractionTypeForwardTypeID, - StoryInteractionTypeRepostTypeID, - }, - StoryListClassName: { - StoryListMainTypeID, - StoryListArchiveTypeID, - }, - StoryOriginClassName: { - StoryOriginPublicStoryTypeID, - StoryOriginHiddenUserTypeID, - }, - StoryPrivacySettingsClassName: { - StoryPrivacySettingsEveryoneTypeID, - StoryPrivacySettingsContactsTypeID, - StoryPrivacySettingsCloseFriendsTypeID, - StoryPrivacySettingsSelectedUsersTypeID, - }, - SuggestedActionClassName: { - SuggestedActionEnableArchiveAndMuteNewChatsTypeID, - SuggestedActionCheckPasswordTypeID, - SuggestedActionCheckPhoneNumberTypeID, - SuggestedActionViewChecksHintTypeID, - SuggestedActionConvertToBroadcastGroupTypeID, - SuggestedActionSetPasswordTypeID, - SuggestedActionUpgradePremiumTypeID, - SuggestedActionRestorePremiumTypeID, - SuggestedActionSubscribeToAnnualPremiumTypeID, - SuggestedActionGiftPremiumForChristmasTypeID, - SuggestedActionSetBirthdateTypeID, - SuggestedActionSetProfilePhotoTypeID, - SuggestedActionExtendPremiumTypeID, - SuggestedActionExtendStarSubscriptionsTypeID, - }, - SupergroupMembersFilterClassName: { - SupergroupMembersFilterRecentTypeID, - SupergroupMembersFilterContactsTypeID, - SupergroupMembersFilterAdministratorsTypeID, - SupergroupMembersFilterSearchTypeID, - SupergroupMembersFilterRestrictedTypeID, - SupergroupMembersFilterBannedTypeID, - SupergroupMembersFilterMentionTypeID, - SupergroupMembersFilterBotsTypeID, - }, - TMeURLTypeClassName: { - TMeURLTypeUserTypeID, - TMeURLTypeSupergroupTypeID, - TMeURLTypeChatInviteTypeID, - TMeURLTypeStickerSetTypeID, - }, - TargetChatClassName: { - TargetChatCurrentTypeID, - TargetChatChosenTypeID, - TargetChatInternalLinkTypeID, - }, - TelegramPaymentPurposeClassName: { - TelegramPaymentPurposePremiumGiftCodesTypeID, - TelegramPaymentPurposePremiumGiveawayTypeID, - TelegramPaymentPurposeStarsTypeID, - TelegramPaymentPurposeGiftedStarsTypeID, - TelegramPaymentPurposeStarGiveawayTypeID, - TelegramPaymentPurposeJoinChatTypeID, - }, - TextEntityTypeClassName: { - TextEntityTypeMentionTypeID, - TextEntityTypeHashtagTypeID, - TextEntityTypeCashtagTypeID, - TextEntityTypeBotCommandTypeID, - TextEntityTypeURLTypeID, - TextEntityTypeEmailAddressTypeID, - TextEntityTypePhoneNumberTypeID, - TextEntityTypeBankCardNumberTypeID, - TextEntityTypeBoldTypeID, - TextEntityTypeItalicTypeID, - TextEntityTypeUnderlineTypeID, - TextEntityTypeStrikethroughTypeID, - TextEntityTypeSpoilerTypeID, - TextEntityTypeCodeTypeID, - TextEntityTypePreTypeID, - TextEntityTypePreCodeTypeID, - TextEntityTypeBlockQuoteTypeID, - TextEntityTypeExpandableBlockQuoteTypeID, - TextEntityTypeTextURLTypeID, - TextEntityTypeMentionNameTypeID, - TextEntityTypeCustomEmojiTypeID, - TextEntityTypeMediaTimestampTypeID, - }, - TextParseModeClassName: { - TextParseModeMarkdownTypeID, - TextParseModeHTMLTypeID, - }, - ThumbnailFormatClassName: { - ThumbnailFormatJpegTypeID, - ThumbnailFormatGifTypeID, - ThumbnailFormatMpeg4TypeID, - ThumbnailFormatPngTypeID, - ThumbnailFormatTgsTypeID, - ThumbnailFormatWebmTypeID, - ThumbnailFormatWebpTypeID, - }, - TopChatCategoryClassName: { - TopChatCategoryUsersTypeID, - TopChatCategoryBotsTypeID, - TopChatCategoryGroupsTypeID, - TopChatCategoryChannelsTypeID, - TopChatCategoryInlineBotsTypeID, - TopChatCategoryWebAppBotsTypeID, - TopChatCategoryCallsTypeID, - TopChatCategoryForwardChatsTypeID, - }, - UpdateClassName: { - UpdateAuthorizationStateTypeID, - UpdateNewMessageTypeID, - UpdateMessageSendAcknowledgedTypeID, - UpdateMessageSendSucceededTypeID, - UpdateMessageSendFailedTypeID, - UpdateMessageContentTypeID, - UpdateMessageEditedTypeID, - UpdateMessageIsPinnedTypeID, - UpdateMessageInteractionInfoTypeID, - UpdateMessageContentOpenedTypeID, - UpdateMessageMentionReadTypeID, - UpdateMessageUnreadReactionsTypeID, - UpdateMessageFactCheckTypeID, - UpdateMessageLiveLocationViewedTypeID, - UpdateVideoPublishedTypeID, - UpdateNewChatTypeID, - UpdateChatTitleTypeID, - UpdateChatPhotoTypeID, - UpdateChatAccentColorsTypeID, - UpdateChatPermissionsTypeID, - UpdateChatLastMessageTypeID, - UpdateChatPositionTypeID, - UpdateChatAddedToListTypeID, - UpdateChatRemovedFromListTypeID, - UpdateChatReadInboxTypeID, - UpdateChatReadOutboxTypeID, - UpdateChatActionBarTypeID, - UpdateChatBusinessBotManageBarTypeID, - UpdateChatAvailableReactionsTypeID, - UpdateChatDraftMessageTypeID, - UpdateChatEmojiStatusTypeID, - UpdateChatMessageSenderTypeID, - UpdateChatMessageAutoDeleteTimeTypeID, - UpdateChatNotificationSettingsTypeID, - UpdateChatPendingJoinRequestsTypeID, - UpdateChatReplyMarkupTypeID, - UpdateChatBackgroundTypeID, - UpdateChatThemeTypeID, - UpdateChatUnreadMentionCountTypeID, - UpdateChatUnreadReactionCountTypeID, - UpdateChatVideoChatTypeID, - UpdateChatDefaultDisableNotificationTypeID, - UpdateChatHasProtectedContentTypeID, - UpdateChatIsTranslatableTypeID, - UpdateChatIsMarkedAsUnreadTypeID, - UpdateChatViewAsTopicsTypeID, - UpdateChatBlockListTypeID, - UpdateChatHasScheduledMessagesTypeID, - UpdateChatFoldersTypeID, - UpdateChatOnlineMemberCountTypeID, - UpdateSavedMessagesTopicTypeID, - UpdateSavedMessagesTopicCountTypeID, - UpdateQuickReplyShortcutTypeID, - UpdateQuickReplyShortcutDeletedTypeID, - UpdateQuickReplyShortcutsTypeID, - UpdateQuickReplyShortcutMessagesTypeID, - UpdateForumTopicInfoTypeID, - UpdateScopeNotificationSettingsTypeID, - UpdateReactionNotificationSettingsTypeID, - UpdateNotificationTypeID, - UpdateNotificationGroupTypeID, - UpdateActiveNotificationsTypeID, - UpdateHavePendingNotificationsTypeID, - UpdateDeleteMessagesTypeID, - UpdateChatActionTypeID, - UpdateUserStatusTypeID, - UpdateUserTypeID, - UpdateBasicGroupTypeID, - UpdateSupergroupTypeID, - UpdateSecretChatTypeID, - UpdateUserFullInfoTypeID, - UpdateBasicGroupFullInfoTypeID, - UpdateSupergroupFullInfoTypeID, - UpdateServiceNotificationTypeID, - UpdateFileTypeID, - UpdateFileGenerationStartTypeID, - UpdateFileGenerationStopTypeID, - UpdateFileDownloadsTypeID, - UpdateFileAddedToDownloadsTypeID, - UpdateFileDownloadTypeID, - UpdateFileRemovedFromDownloadsTypeID, - UpdateApplicationVerificationRequiredTypeID, - UpdateCallTypeID, - UpdateGroupCallTypeID, - UpdateGroupCallParticipantTypeID, - UpdateNewCallSignalingDataTypeID, - UpdateUserPrivacySettingRulesTypeID, - UpdateUnreadMessageCountTypeID, - UpdateUnreadChatCountTypeID, - UpdateStoryTypeID, - UpdateStoryDeletedTypeID, - UpdateStorySendSucceededTypeID, - UpdateStorySendFailedTypeID, - UpdateChatActiveStoriesTypeID, - UpdateStoryListChatCountTypeID, - UpdateStoryStealthModeTypeID, - UpdateOptionTypeID, - UpdateStickerSetTypeID, - UpdateInstalledStickerSetsTypeID, - UpdateTrendingStickerSetsTypeID, - UpdateRecentStickersTypeID, - UpdateFavoriteStickersTypeID, - UpdateSavedAnimationsTypeID, - UpdateSavedNotificationSoundsTypeID, - UpdateDefaultBackgroundTypeID, - UpdateChatThemesTypeID, - UpdateAccentColorsTypeID, - UpdateProfileAccentColorsTypeID, - UpdateLanguagePackStringsTypeID, - UpdateConnectionStateTypeID, - UpdateTermsOfServiceTypeID, - UpdateUnconfirmedSessionTypeID, - UpdateAttachmentMenuBotsTypeID, - UpdateWebAppMessageSentTypeID, - UpdateActiveEmojiReactionsTypeID, - UpdateAvailableMessageEffectsTypeID, - UpdateDefaultReactionTypeTypeID, - UpdateSavedMessagesTagsTypeID, - UpdateActiveLiveLocationMessagesTypeID, - UpdateOwnedStarCountTypeID, - UpdateChatRevenueAmountTypeID, - UpdateStarRevenueStatusTypeID, - UpdateSpeechRecognitionTrialTypeID, - UpdateDiceEmojisTypeID, - UpdateAnimatedEmojiMessageClickedTypeID, - UpdateAnimationSearchParametersTypeID, - UpdateSuggestedActionsTypeID, - UpdateSpeedLimitNotificationTypeID, - UpdateContactCloseBirthdaysTypeID, - UpdateAutosaveSettingsTypeID, - UpdateBusinessConnectionTypeID, - UpdateNewBusinessMessageTypeID, - UpdateBusinessMessageEditedTypeID, - UpdateBusinessMessagesDeletedTypeID, - UpdateNewInlineQueryTypeID, - UpdateNewChosenInlineResultTypeID, - UpdateNewCallbackQueryTypeID, - UpdateNewInlineCallbackQueryTypeID, - UpdateNewBusinessCallbackQueryTypeID, - UpdateNewShippingQueryTypeID, - UpdateNewPreCheckoutQueryTypeID, - UpdateNewCustomEventTypeID, - UpdateNewCustomQueryTypeID, - UpdatePollTypeID, - UpdatePollAnswerTypeID, - UpdateChatMemberTypeID, - UpdateNewChatJoinRequestTypeID, - UpdateChatBoostTypeID, - UpdateMessageReactionTypeID, - UpdateMessageReactionsTypeID, - UpdatePaidMediaPurchasedTypeID, - }, - UserPrivacySettingClassName: { - UserPrivacySettingShowStatusTypeID, - UserPrivacySettingShowProfilePhotoTypeID, - UserPrivacySettingShowLinkInForwardedMessagesTypeID, - UserPrivacySettingShowPhoneNumberTypeID, - UserPrivacySettingShowBioTypeID, - UserPrivacySettingShowBirthdateTypeID, - UserPrivacySettingAllowChatInvitesTypeID, - UserPrivacySettingAllowCallsTypeID, - UserPrivacySettingAllowPeerToPeerCallsTypeID, - UserPrivacySettingAllowFindingByPhoneNumberTypeID, - UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID, - UserPrivacySettingAutosaveGiftsTypeID, - }, - UserPrivacySettingRuleClassName: { - UserPrivacySettingRuleAllowAllTypeID, - UserPrivacySettingRuleAllowContactsTypeID, - UserPrivacySettingRuleAllowBotsTypeID, - UserPrivacySettingRuleAllowPremiumUsersTypeID, - UserPrivacySettingRuleAllowUsersTypeID, - UserPrivacySettingRuleAllowChatMembersTypeID, - UserPrivacySettingRuleRestrictAllTypeID, - UserPrivacySettingRuleRestrictContactsTypeID, - UserPrivacySettingRuleRestrictBotsTypeID, - UserPrivacySettingRuleRestrictUsersTypeID, - UserPrivacySettingRuleRestrictChatMembersTypeID, - }, - UserStatusClassName: { - UserStatusEmptyTypeID, - UserStatusOnlineTypeID, - UserStatusOfflineTypeID, - UserStatusRecentlyTypeID, - UserStatusLastWeekTypeID, - UserStatusLastMonthTypeID, - }, - UserTypeClassName: { - UserTypeRegularTypeID, - UserTypeDeletedTypeID, - UserTypeBotTypeID, - UserTypeUnknownTypeID, - }, - VectorPathCommandClassName: { - VectorPathCommandLineTypeID, - VectorPathCommandCubicBezierCurveTypeID, - }, - WebAppOpenModeClassName: { - WebAppOpenModeCompactTypeID, - WebAppOpenModeFullSizeTypeID, - WebAppOpenModeFullScreenTypeID, - }, - } -} diff --git a/tdapi/tl_remote_file_gen.go b/tdapi/tl_remote_file_gen.go deleted file mode 100644 index e532cbfcd..000000000 --- a/tdapi/tl_remote_file_gen.go +++ /dev/null @@ -1,333 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoteFile represents TL type `remoteFile#2c917856`. -type RemoteFile struct { - // Remote file identifier; may be empty. Can be used by the current user across - // application restarts or even from other devices. Uniquely identifies a file, but a - // file can have a lot of different valid identifiers. - ID string - // Unique file identifier; may be empty if unknown. The unique file identifier which is - // the same for the same file even for different users and is persistent over time - UniqueID string - // True, if the file is currently being uploaded (or a remote copy is being generated by - // some other means) - IsUploadingActive bool - // True, if a remote copy is fully available - IsUploadingCompleted bool - // Size of the remote available part of the file, in bytes; 0 if unknown - UploadedSize int64 -} - -// RemoteFileTypeID is TL type id of RemoteFile. -const RemoteFileTypeID = 0x2c917856 - -// Ensuring interfaces in compile-time for RemoteFile. -var ( - _ bin.Encoder = &RemoteFile{} - _ bin.Decoder = &RemoteFile{} - _ bin.BareEncoder = &RemoteFile{} - _ bin.BareDecoder = &RemoteFile{} -) - -func (r *RemoteFile) Zero() bool { - if r == nil { - return true - } - if !(r.ID == "") { - return false - } - if !(r.UniqueID == "") { - return false - } - if !(r.IsUploadingActive == false) { - return false - } - if !(r.IsUploadingCompleted == false) { - return false - } - if !(r.UploadedSize == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoteFile) String() string { - if r == nil { - return "RemoteFile(nil)" - } - type Alias RemoteFile - return fmt.Sprintf("RemoteFile%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoteFile) TypeID() uint32 { - return RemoteFileTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoteFile) TypeName() string { - return "remoteFile" -} - -// TypeInfo returns info about TL type. -func (r *RemoteFile) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "remoteFile", - ID: RemoteFileTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "UniqueID", - SchemaName: "unique_id", - }, - { - Name: "IsUploadingActive", - SchemaName: "is_uploading_active", - }, - { - Name: "IsUploadingCompleted", - SchemaName: "is_uploading_completed", - }, - { - Name: "UploadedSize", - SchemaName: "uploaded_size", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoteFile) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode remoteFile#2c917856 as nil") - } - b.PutID(RemoteFileTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoteFile) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode remoteFile#2c917856 as nil") - } - b.PutString(r.ID) - b.PutString(r.UniqueID) - b.PutBool(r.IsUploadingActive) - b.PutBool(r.IsUploadingCompleted) - b.PutInt53(r.UploadedSize) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoteFile) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode remoteFile#2c917856 to nil") - } - if err := b.ConsumeID(RemoteFileTypeID); err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoteFile) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode remoteFile#2c917856 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: field id: %w", err) - } - r.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: field unique_id: %w", err) - } - r.UniqueID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: field is_uploading_active: %w", err) - } - r.IsUploadingActive = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: field is_uploading_completed: %w", err) - } - r.IsUploadingCompleted = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: field uploaded_size: %w", err) - } - r.UploadedSize = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoteFile) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode remoteFile#2c917856 as nil") - } - b.ObjStart() - b.PutID("remoteFile") - b.Comma() - b.FieldStart("id") - b.PutString(r.ID) - b.Comma() - b.FieldStart("unique_id") - b.PutString(r.UniqueID) - b.Comma() - b.FieldStart("is_uploading_active") - b.PutBool(r.IsUploadingActive) - b.Comma() - b.FieldStart("is_uploading_completed") - b.PutBool(r.IsUploadingCompleted) - b.Comma() - b.FieldStart("uploaded_size") - b.PutInt53(r.UploadedSize) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoteFile) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode remoteFile#2c917856 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("remoteFile"); err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: field id: %w", err) - } - r.ID = value - case "unique_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: field unique_id: %w", err) - } - r.UniqueID = value - case "is_uploading_active": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: field is_uploading_active: %w", err) - } - r.IsUploadingActive = value - case "is_uploading_completed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: field is_uploading_completed: %w", err) - } - r.IsUploadingCompleted = value - case "uploaded_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode remoteFile#2c917856: field uploaded_size: %w", err) - } - r.UploadedSize = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (r *RemoteFile) GetID() (value string) { - if r == nil { - return - } - return r.ID -} - -// GetUniqueID returns value of UniqueID field. -func (r *RemoteFile) GetUniqueID() (value string) { - if r == nil { - return - } - return r.UniqueID -} - -// GetIsUploadingActive returns value of IsUploadingActive field. -func (r *RemoteFile) GetIsUploadingActive() (value bool) { - if r == nil { - return - } - return r.IsUploadingActive -} - -// GetIsUploadingCompleted returns value of IsUploadingCompleted field. -func (r *RemoteFile) GetIsUploadingCompleted() (value bool) { - if r == nil { - return - } - return r.IsUploadingCompleted -} - -// GetUploadedSize returns value of UploadedSize field. -func (r *RemoteFile) GetUploadedSize() (value int64) { - if r == nil { - return - } - return r.UploadedSize -} diff --git a/tdapi/tl_remove_all_files_from_downloads_gen.go b/tdapi/tl_remove_all_files_from_downloads_gen.go deleted file mode 100644 index 7da9c90b7..000000000 --- a/tdapi/tl_remove_all_files_from_downloads_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveAllFilesFromDownloadsRequest represents TL type `removeAllFilesFromDownloads#b9487686`. -type RemoveAllFilesFromDownloadsRequest struct { - // Pass true to remove only active downloads, including paused - OnlyActive bool - // Pass true to remove only completed downloads - OnlyCompleted bool - // Pass true to delete the file from the TDLib file cache - DeleteFromCache bool -} - -// RemoveAllFilesFromDownloadsRequestTypeID is TL type id of RemoveAllFilesFromDownloadsRequest. -const RemoveAllFilesFromDownloadsRequestTypeID = 0xb9487686 - -// Ensuring interfaces in compile-time for RemoveAllFilesFromDownloadsRequest. -var ( - _ bin.Encoder = &RemoveAllFilesFromDownloadsRequest{} - _ bin.Decoder = &RemoveAllFilesFromDownloadsRequest{} - _ bin.BareEncoder = &RemoveAllFilesFromDownloadsRequest{} - _ bin.BareDecoder = &RemoveAllFilesFromDownloadsRequest{} -) - -func (r *RemoveAllFilesFromDownloadsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.OnlyActive == false) { - return false - } - if !(r.OnlyCompleted == false) { - return false - } - if !(r.DeleteFromCache == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveAllFilesFromDownloadsRequest) String() string { - if r == nil { - return "RemoveAllFilesFromDownloadsRequest(nil)" - } - type Alias RemoveAllFilesFromDownloadsRequest - return fmt.Sprintf("RemoveAllFilesFromDownloadsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveAllFilesFromDownloadsRequest) TypeID() uint32 { - return RemoveAllFilesFromDownloadsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveAllFilesFromDownloadsRequest) TypeName() string { - return "removeAllFilesFromDownloads" -} - -// TypeInfo returns info about TL type. -func (r *RemoveAllFilesFromDownloadsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeAllFilesFromDownloads", - ID: RemoveAllFilesFromDownloadsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OnlyActive", - SchemaName: "only_active", - }, - { - Name: "OnlyCompleted", - SchemaName: "only_completed", - }, - { - Name: "DeleteFromCache", - SchemaName: "delete_from_cache", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveAllFilesFromDownloadsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeAllFilesFromDownloads#b9487686 as nil") - } - b.PutID(RemoveAllFilesFromDownloadsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveAllFilesFromDownloadsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeAllFilesFromDownloads#b9487686 as nil") - } - b.PutBool(r.OnlyActive) - b.PutBool(r.OnlyCompleted) - b.PutBool(r.DeleteFromCache) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveAllFilesFromDownloadsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeAllFilesFromDownloads#b9487686 to nil") - } - if err := b.ConsumeID(RemoveAllFilesFromDownloadsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeAllFilesFromDownloads#b9487686: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveAllFilesFromDownloadsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeAllFilesFromDownloads#b9487686 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode removeAllFilesFromDownloads#b9487686: field only_active: %w", err) - } - r.OnlyActive = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode removeAllFilesFromDownloads#b9487686: field only_completed: %w", err) - } - r.OnlyCompleted = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode removeAllFilesFromDownloads#b9487686: field delete_from_cache: %w", err) - } - r.DeleteFromCache = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveAllFilesFromDownloadsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeAllFilesFromDownloads#b9487686 as nil") - } - b.ObjStart() - b.PutID("removeAllFilesFromDownloads") - b.Comma() - b.FieldStart("only_active") - b.PutBool(r.OnlyActive) - b.Comma() - b.FieldStart("only_completed") - b.PutBool(r.OnlyCompleted) - b.Comma() - b.FieldStart("delete_from_cache") - b.PutBool(r.DeleteFromCache) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveAllFilesFromDownloadsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeAllFilesFromDownloads#b9487686 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeAllFilesFromDownloads"); err != nil { - return fmt.Errorf("unable to decode removeAllFilesFromDownloads#b9487686: %w", err) - } - case "only_active": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode removeAllFilesFromDownloads#b9487686: field only_active: %w", err) - } - r.OnlyActive = value - case "only_completed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode removeAllFilesFromDownloads#b9487686: field only_completed: %w", err) - } - r.OnlyCompleted = value - case "delete_from_cache": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode removeAllFilesFromDownloads#b9487686: field delete_from_cache: %w", err) - } - r.DeleteFromCache = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOnlyActive returns value of OnlyActive field. -func (r *RemoveAllFilesFromDownloadsRequest) GetOnlyActive() (value bool) { - if r == nil { - return - } - return r.OnlyActive -} - -// GetOnlyCompleted returns value of OnlyCompleted field. -func (r *RemoveAllFilesFromDownloadsRequest) GetOnlyCompleted() (value bool) { - if r == nil { - return - } - return r.OnlyCompleted -} - -// GetDeleteFromCache returns value of DeleteFromCache field. -func (r *RemoveAllFilesFromDownloadsRequest) GetDeleteFromCache() (value bool) { - if r == nil { - return - } - return r.DeleteFromCache -} - -// RemoveAllFilesFromDownloads invokes method removeAllFilesFromDownloads#b9487686 returning error if any. -func (c *Client) RemoveAllFilesFromDownloads(ctx context.Context, request *RemoveAllFilesFromDownloadsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_business_connected_bot_from_chat_gen.go b/tdapi/tl_remove_business_connected_bot_from_chat_gen.go deleted file mode 100644 index 7832b915f..000000000 --- a/tdapi/tl_remove_business_connected_bot_from_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveBusinessConnectedBotFromChatRequest represents TL type `removeBusinessConnectedBotFromChat#787273f3`. -type RemoveBusinessConnectedBotFromChatRequest struct { - // Chat identifier - ChatID int64 -} - -// RemoveBusinessConnectedBotFromChatRequestTypeID is TL type id of RemoveBusinessConnectedBotFromChatRequest. -const RemoveBusinessConnectedBotFromChatRequestTypeID = 0x787273f3 - -// Ensuring interfaces in compile-time for RemoveBusinessConnectedBotFromChatRequest. -var ( - _ bin.Encoder = &RemoveBusinessConnectedBotFromChatRequest{} - _ bin.Decoder = &RemoveBusinessConnectedBotFromChatRequest{} - _ bin.BareEncoder = &RemoveBusinessConnectedBotFromChatRequest{} - _ bin.BareDecoder = &RemoveBusinessConnectedBotFromChatRequest{} -) - -func (r *RemoveBusinessConnectedBotFromChatRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveBusinessConnectedBotFromChatRequest) String() string { - if r == nil { - return "RemoveBusinessConnectedBotFromChatRequest(nil)" - } - type Alias RemoveBusinessConnectedBotFromChatRequest - return fmt.Sprintf("RemoveBusinessConnectedBotFromChatRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveBusinessConnectedBotFromChatRequest) TypeID() uint32 { - return RemoveBusinessConnectedBotFromChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveBusinessConnectedBotFromChatRequest) TypeName() string { - return "removeBusinessConnectedBotFromChat" -} - -// TypeInfo returns info about TL type. -func (r *RemoveBusinessConnectedBotFromChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeBusinessConnectedBotFromChat", - ID: RemoveBusinessConnectedBotFromChatRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveBusinessConnectedBotFromChatRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeBusinessConnectedBotFromChat#787273f3 as nil") - } - b.PutID(RemoveBusinessConnectedBotFromChatRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveBusinessConnectedBotFromChatRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeBusinessConnectedBotFromChat#787273f3 as nil") - } - b.PutInt53(r.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveBusinessConnectedBotFromChatRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeBusinessConnectedBotFromChat#787273f3 to nil") - } - if err := b.ConsumeID(RemoveBusinessConnectedBotFromChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeBusinessConnectedBotFromChat#787273f3: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveBusinessConnectedBotFromChatRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeBusinessConnectedBotFromChat#787273f3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeBusinessConnectedBotFromChat#787273f3: field chat_id: %w", err) - } - r.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveBusinessConnectedBotFromChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeBusinessConnectedBotFromChat#787273f3 as nil") - } - b.ObjStart() - b.PutID("removeBusinessConnectedBotFromChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveBusinessConnectedBotFromChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeBusinessConnectedBotFromChat#787273f3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeBusinessConnectedBotFromChat"); err != nil { - return fmt.Errorf("unable to decode removeBusinessConnectedBotFromChat#787273f3: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeBusinessConnectedBotFromChat#787273f3: field chat_id: %w", err) - } - r.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *RemoveBusinessConnectedBotFromChatRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// RemoveBusinessConnectedBotFromChat invokes method removeBusinessConnectedBotFromChat#787273f3 returning error if any. -func (c *Client) RemoveBusinessConnectedBotFromChat(ctx context.Context, chatid int64) error { - var ok Ok - - request := &RemoveBusinessConnectedBotFromChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_chat_action_bar_gen.go b/tdapi/tl_remove_chat_action_bar_gen.go deleted file mode 100644 index 0a1e02a5d..000000000 --- a/tdapi/tl_remove_chat_action_bar_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveChatActionBarRequest represents TL type `removeChatActionBar#9d9839fa`. -type RemoveChatActionBarRequest struct { - // Chat identifier - ChatID int64 -} - -// RemoveChatActionBarRequestTypeID is TL type id of RemoveChatActionBarRequest. -const RemoveChatActionBarRequestTypeID = 0x9d9839fa - -// Ensuring interfaces in compile-time for RemoveChatActionBarRequest. -var ( - _ bin.Encoder = &RemoveChatActionBarRequest{} - _ bin.Decoder = &RemoveChatActionBarRequest{} - _ bin.BareEncoder = &RemoveChatActionBarRequest{} - _ bin.BareDecoder = &RemoveChatActionBarRequest{} -) - -func (r *RemoveChatActionBarRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveChatActionBarRequest) String() string { - if r == nil { - return "RemoveChatActionBarRequest(nil)" - } - type Alias RemoveChatActionBarRequest - return fmt.Sprintf("RemoveChatActionBarRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveChatActionBarRequest) TypeID() uint32 { - return RemoveChatActionBarRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveChatActionBarRequest) TypeName() string { - return "removeChatActionBar" -} - -// TypeInfo returns info about TL type. -func (r *RemoveChatActionBarRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeChatActionBar", - ID: RemoveChatActionBarRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveChatActionBarRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeChatActionBar#9d9839fa as nil") - } - b.PutID(RemoveChatActionBarRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveChatActionBarRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeChatActionBar#9d9839fa as nil") - } - b.PutInt53(r.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveChatActionBarRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeChatActionBar#9d9839fa to nil") - } - if err := b.ConsumeID(RemoveChatActionBarRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeChatActionBar#9d9839fa: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveChatActionBarRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeChatActionBar#9d9839fa to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeChatActionBar#9d9839fa: field chat_id: %w", err) - } - r.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveChatActionBarRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeChatActionBar#9d9839fa as nil") - } - b.ObjStart() - b.PutID("removeChatActionBar") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveChatActionBarRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeChatActionBar#9d9839fa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeChatActionBar"); err != nil { - return fmt.Errorf("unable to decode removeChatActionBar#9d9839fa: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeChatActionBar#9d9839fa: field chat_id: %w", err) - } - r.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *RemoveChatActionBarRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// RemoveChatActionBar invokes method removeChatActionBar#9d9839fa returning error if any. -func (c *Client) RemoveChatActionBar(ctx context.Context, chatid int64) error { - var ok Ok - - request := &RemoveChatActionBarRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_contacts_gen.go b/tdapi/tl_remove_contacts_gen.go deleted file mode 100644 index 1749211f2..000000000 --- a/tdapi/tl_remove_contacts_gen.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveContactsRequest represents TL type `removeContacts#b464dfff`. -type RemoveContactsRequest struct { - // Identifiers of users to be deleted - UserIDs []int64 -} - -// RemoveContactsRequestTypeID is TL type id of RemoveContactsRequest. -const RemoveContactsRequestTypeID = 0xb464dfff - -// Ensuring interfaces in compile-time for RemoveContactsRequest. -var ( - _ bin.Encoder = &RemoveContactsRequest{} - _ bin.Decoder = &RemoveContactsRequest{} - _ bin.BareEncoder = &RemoveContactsRequest{} - _ bin.BareDecoder = &RemoveContactsRequest{} -) - -func (r *RemoveContactsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.UserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveContactsRequest) String() string { - if r == nil { - return "RemoveContactsRequest(nil)" - } - type Alias RemoveContactsRequest - return fmt.Sprintf("RemoveContactsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveContactsRequest) TypeID() uint32 { - return RemoveContactsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveContactsRequest) TypeName() string { - return "removeContacts" -} - -// TypeInfo returns info about TL type. -func (r *RemoveContactsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeContacts", - ID: RemoveContactsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveContactsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeContacts#b464dfff as nil") - } - b.PutID(RemoveContactsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveContactsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeContacts#b464dfff as nil") - } - b.PutInt(len(r.UserIDs)) - for _, v := range r.UserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveContactsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeContacts#b464dfff to nil") - } - if err := b.ConsumeID(RemoveContactsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeContacts#b464dfff: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveContactsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeContacts#b464dfff to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode removeContacts#b464dfff: field user_ids: %w", err) - } - - if headerLen > 0 { - r.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeContacts#b464dfff: field user_ids: %w", err) - } - r.UserIDs = append(r.UserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveContactsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeContacts#b464dfff as nil") - } - b.ObjStart() - b.PutID("removeContacts") - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range r.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveContactsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeContacts#b464dfff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeContacts"); err != nil { - return fmt.Errorf("unable to decode removeContacts#b464dfff: %w", err) - } - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeContacts#b464dfff: field user_ids: %w", err) - } - r.UserIDs = append(r.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode removeContacts#b464dfff: field user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserIDs returns value of UserIDs field. -func (r *RemoveContactsRequest) GetUserIDs() (value []int64) { - if r == nil { - return - } - return r.UserIDs -} - -// RemoveContacts invokes method removeContacts#b464dfff returning error if any. -func (c *Client) RemoveContacts(ctx context.Context, userids []int64) error { - var ok Ok - - request := &RemoveContactsRequest{ - UserIDs: userids, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_favorite_sticker_gen.go b/tdapi/tl_remove_favorite_sticker_gen.go deleted file mode 100644 index 68e74e34d..000000000 --- a/tdapi/tl_remove_favorite_sticker_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveFavoriteStickerRequest represents TL type `removeFavoriteSticker#44b88c70`. -type RemoveFavoriteStickerRequest struct { - // Sticker file to delete from the list - Sticker InputFileClass -} - -// RemoveFavoriteStickerRequestTypeID is TL type id of RemoveFavoriteStickerRequest. -const RemoveFavoriteStickerRequestTypeID = 0x44b88c70 - -// Ensuring interfaces in compile-time for RemoveFavoriteStickerRequest. -var ( - _ bin.Encoder = &RemoveFavoriteStickerRequest{} - _ bin.Decoder = &RemoveFavoriteStickerRequest{} - _ bin.BareEncoder = &RemoveFavoriteStickerRequest{} - _ bin.BareDecoder = &RemoveFavoriteStickerRequest{} -) - -func (r *RemoveFavoriteStickerRequest) Zero() bool { - if r == nil { - return true - } - if !(r.Sticker == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveFavoriteStickerRequest) String() string { - if r == nil { - return "RemoveFavoriteStickerRequest(nil)" - } - type Alias RemoveFavoriteStickerRequest - return fmt.Sprintf("RemoveFavoriteStickerRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveFavoriteStickerRequest) TypeID() uint32 { - return RemoveFavoriteStickerRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveFavoriteStickerRequest) TypeName() string { - return "removeFavoriteSticker" -} - -// TypeInfo returns info about TL type. -func (r *RemoveFavoriteStickerRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeFavoriteSticker", - ID: RemoveFavoriteStickerRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveFavoriteStickerRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeFavoriteSticker#44b88c70 as nil") - } - b.PutID(RemoveFavoriteStickerRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveFavoriteStickerRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeFavoriteSticker#44b88c70 as nil") - } - if r.Sticker == nil { - return fmt.Errorf("unable to encode removeFavoriteSticker#44b88c70: field sticker is nil") - } - if err := r.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode removeFavoriteSticker#44b88c70: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveFavoriteStickerRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeFavoriteSticker#44b88c70 to nil") - } - if err := b.ConsumeID(RemoveFavoriteStickerRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeFavoriteSticker#44b88c70: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveFavoriteStickerRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeFavoriteSticker#44b88c70 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode removeFavoriteSticker#44b88c70: field sticker: %w", err) - } - r.Sticker = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveFavoriteStickerRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeFavoriteSticker#44b88c70 as nil") - } - b.ObjStart() - b.PutID("removeFavoriteSticker") - b.Comma() - b.FieldStart("sticker") - if r.Sticker == nil { - return fmt.Errorf("unable to encode removeFavoriteSticker#44b88c70: field sticker is nil") - } - if err := r.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode removeFavoriteSticker#44b88c70: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveFavoriteStickerRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeFavoriteSticker#44b88c70 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeFavoriteSticker"); err != nil { - return fmt.Errorf("unable to decode removeFavoriteSticker#44b88c70: %w", err) - } - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode removeFavoriteSticker#44b88c70: field sticker: %w", err) - } - r.Sticker = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (r *RemoveFavoriteStickerRequest) GetSticker() (value InputFileClass) { - if r == nil { - return - } - return r.Sticker -} - -// RemoveFavoriteSticker invokes method removeFavoriteSticker#44b88c70 returning error if any. -func (c *Client) RemoveFavoriteSticker(ctx context.Context, sticker InputFileClass) error { - var ok Ok - - request := &RemoveFavoriteStickerRequest{ - Sticker: sticker, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_file_from_downloads_gen.go b/tdapi/tl_remove_file_from_downloads_gen.go deleted file mode 100644 index 01bd3f0ab..000000000 --- a/tdapi/tl_remove_file_from_downloads_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveFileFromDownloadsRequest represents TL type `removeFileFromDownloads#5706bfee`. -type RemoveFileFromDownloadsRequest struct { - // Identifier of the downloaded file - FileID int32 - // Pass true to delete the file from the TDLib file cache - DeleteFromCache bool -} - -// RemoveFileFromDownloadsRequestTypeID is TL type id of RemoveFileFromDownloadsRequest. -const RemoveFileFromDownloadsRequestTypeID = 0x5706bfee - -// Ensuring interfaces in compile-time for RemoveFileFromDownloadsRequest. -var ( - _ bin.Encoder = &RemoveFileFromDownloadsRequest{} - _ bin.Decoder = &RemoveFileFromDownloadsRequest{} - _ bin.BareEncoder = &RemoveFileFromDownloadsRequest{} - _ bin.BareDecoder = &RemoveFileFromDownloadsRequest{} -) - -func (r *RemoveFileFromDownloadsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.FileID == 0) { - return false - } - if !(r.DeleteFromCache == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveFileFromDownloadsRequest) String() string { - if r == nil { - return "RemoveFileFromDownloadsRequest(nil)" - } - type Alias RemoveFileFromDownloadsRequest - return fmt.Sprintf("RemoveFileFromDownloadsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveFileFromDownloadsRequest) TypeID() uint32 { - return RemoveFileFromDownloadsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveFileFromDownloadsRequest) TypeName() string { - return "removeFileFromDownloads" -} - -// TypeInfo returns info about TL type. -func (r *RemoveFileFromDownloadsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeFileFromDownloads", - ID: RemoveFileFromDownloadsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "DeleteFromCache", - SchemaName: "delete_from_cache", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveFileFromDownloadsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeFileFromDownloads#5706bfee as nil") - } - b.PutID(RemoveFileFromDownloadsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveFileFromDownloadsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeFileFromDownloads#5706bfee as nil") - } - b.PutInt32(r.FileID) - b.PutBool(r.DeleteFromCache) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveFileFromDownloadsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeFileFromDownloads#5706bfee to nil") - } - if err := b.ConsumeID(RemoveFileFromDownloadsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeFileFromDownloads#5706bfee: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveFileFromDownloadsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeFileFromDownloads#5706bfee to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeFileFromDownloads#5706bfee: field file_id: %w", err) - } - r.FileID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode removeFileFromDownloads#5706bfee: field delete_from_cache: %w", err) - } - r.DeleteFromCache = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveFileFromDownloadsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeFileFromDownloads#5706bfee as nil") - } - b.ObjStart() - b.PutID("removeFileFromDownloads") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(r.FileID) - b.Comma() - b.FieldStart("delete_from_cache") - b.PutBool(r.DeleteFromCache) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveFileFromDownloadsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeFileFromDownloads#5706bfee to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeFileFromDownloads"); err != nil { - return fmt.Errorf("unable to decode removeFileFromDownloads#5706bfee: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeFileFromDownloads#5706bfee: field file_id: %w", err) - } - r.FileID = value - case "delete_from_cache": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode removeFileFromDownloads#5706bfee: field delete_from_cache: %w", err) - } - r.DeleteFromCache = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (r *RemoveFileFromDownloadsRequest) GetFileID() (value int32) { - if r == nil { - return - } - return r.FileID -} - -// GetDeleteFromCache returns value of DeleteFromCache field. -func (r *RemoveFileFromDownloadsRequest) GetDeleteFromCache() (value bool) { - if r == nil { - return - } - return r.DeleteFromCache -} - -// RemoveFileFromDownloads invokes method removeFileFromDownloads#5706bfee returning error if any. -func (c *Client) RemoveFileFromDownloads(ctx context.Context, request *RemoveFileFromDownloadsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_installed_background_gen.go b/tdapi/tl_remove_installed_background_gen.go deleted file mode 100644 index cba40662a..000000000 --- a/tdapi/tl_remove_installed_background_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveInstalledBackgroundRequest represents TL type `removeInstalledBackground#5041253c`. -type RemoveInstalledBackgroundRequest struct { - // The background identifier - BackgroundID int64 -} - -// RemoveInstalledBackgroundRequestTypeID is TL type id of RemoveInstalledBackgroundRequest. -const RemoveInstalledBackgroundRequestTypeID = 0x5041253c - -// Ensuring interfaces in compile-time for RemoveInstalledBackgroundRequest. -var ( - _ bin.Encoder = &RemoveInstalledBackgroundRequest{} - _ bin.Decoder = &RemoveInstalledBackgroundRequest{} - _ bin.BareEncoder = &RemoveInstalledBackgroundRequest{} - _ bin.BareDecoder = &RemoveInstalledBackgroundRequest{} -) - -func (r *RemoveInstalledBackgroundRequest) Zero() bool { - if r == nil { - return true - } - if !(r.BackgroundID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveInstalledBackgroundRequest) String() string { - if r == nil { - return "RemoveInstalledBackgroundRequest(nil)" - } - type Alias RemoveInstalledBackgroundRequest - return fmt.Sprintf("RemoveInstalledBackgroundRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveInstalledBackgroundRequest) TypeID() uint32 { - return RemoveInstalledBackgroundRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveInstalledBackgroundRequest) TypeName() string { - return "removeInstalledBackground" -} - -// TypeInfo returns info about TL type. -func (r *RemoveInstalledBackgroundRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeInstalledBackground", - ID: RemoveInstalledBackgroundRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BackgroundID", - SchemaName: "background_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveInstalledBackgroundRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeInstalledBackground#5041253c as nil") - } - b.PutID(RemoveInstalledBackgroundRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveInstalledBackgroundRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeInstalledBackground#5041253c as nil") - } - b.PutLong(r.BackgroundID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveInstalledBackgroundRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeInstalledBackground#5041253c to nil") - } - if err := b.ConsumeID(RemoveInstalledBackgroundRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeInstalledBackground#5041253c: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveInstalledBackgroundRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeInstalledBackground#5041253c to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode removeInstalledBackground#5041253c: field background_id: %w", err) - } - r.BackgroundID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveInstalledBackgroundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeInstalledBackground#5041253c as nil") - } - b.ObjStart() - b.PutID("removeInstalledBackground") - b.Comma() - b.FieldStart("background_id") - b.PutLong(r.BackgroundID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveInstalledBackgroundRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeInstalledBackground#5041253c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeInstalledBackground"); err != nil { - return fmt.Errorf("unable to decode removeInstalledBackground#5041253c: %w", err) - } - case "background_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode removeInstalledBackground#5041253c: field background_id: %w", err) - } - r.BackgroundID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBackgroundID returns value of BackgroundID field. -func (r *RemoveInstalledBackgroundRequest) GetBackgroundID() (value int64) { - if r == nil { - return - } - return r.BackgroundID -} - -// RemoveInstalledBackground invokes method removeInstalledBackground#5041253c returning error if any. -func (c *Client) RemoveInstalledBackground(ctx context.Context, backgroundid int64) error { - var ok Ok - - request := &RemoveInstalledBackgroundRequest{ - BackgroundID: backgroundid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_message_reaction_gen.go b/tdapi/tl_remove_message_reaction_gen.go deleted file mode 100644 index a60e4cfc4..000000000 --- a/tdapi/tl_remove_message_reaction_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveMessageReactionRequest represents TL type `removeMessageReaction#97474d7b`. -type RemoveMessageReactionRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // Type of the reaction to remove. The paid reaction can't be removed - ReactionType ReactionTypeClass -} - -// RemoveMessageReactionRequestTypeID is TL type id of RemoveMessageReactionRequest. -const RemoveMessageReactionRequestTypeID = 0x97474d7b - -// Ensuring interfaces in compile-time for RemoveMessageReactionRequest. -var ( - _ bin.Encoder = &RemoveMessageReactionRequest{} - _ bin.Decoder = &RemoveMessageReactionRequest{} - _ bin.BareEncoder = &RemoveMessageReactionRequest{} - _ bin.BareDecoder = &RemoveMessageReactionRequest{} -) - -func (r *RemoveMessageReactionRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.MessageID == 0) { - return false - } - if !(r.ReactionType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveMessageReactionRequest) String() string { - if r == nil { - return "RemoveMessageReactionRequest(nil)" - } - type Alias RemoveMessageReactionRequest - return fmt.Sprintf("RemoveMessageReactionRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveMessageReactionRequest) TypeID() uint32 { - return RemoveMessageReactionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveMessageReactionRequest) TypeName() string { - return "removeMessageReaction" -} - -// TypeInfo returns info about TL type. -func (r *RemoveMessageReactionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeMessageReaction", - ID: RemoveMessageReactionRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReactionType", - SchemaName: "reaction_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveMessageReactionRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeMessageReaction#97474d7b as nil") - } - b.PutID(RemoveMessageReactionRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveMessageReactionRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeMessageReaction#97474d7b as nil") - } - b.PutInt53(r.ChatID) - b.PutInt53(r.MessageID) - if r.ReactionType == nil { - return fmt.Errorf("unable to encode removeMessageReaction#97474d7b: field reaction_type is nil") - } - if err := r.ReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode removeMessageReaction#97474d7b: field reaction_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveMessageReactionRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeMessageReaction#97474d7b to nil") - } - if err := b.ConsumeID(RemoveMessageReactionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeMessageReaction#97474d7b: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveMessageReactionRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeMessageReaction#97474d7b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeMessageReaction#97474d7b: field chat_id: %w", err) - } - r.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeMessageReaction#97474d7b: field message_id: %w", err) - } - r.MessageID = value - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode removeMessageReaction#97474d7b: field reaction_type: %w", err) - } - r.ReactionType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveMessageReactionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeMessageReaction#97474d7b as nil") - } - b.ObjStart() - b.PutID("removeMessageReaction") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(r.MessageID) - b.Comma() - b.FieldStart("reaction_type") - if r.ReactionType == nil { - return fmt.Errorf("unable to encode removeMessageReaction#97474d7b: field reaction_type is nil") - } - if err := r.ReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode removeMessageReaction#97474d7b: field reaction_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveMessageReactionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeMessageReaction#97474d7b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeMessageReaction"); err != nil { - return fmt.Errorf("unable to decode removeMessageReaction#97474d7b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeMessageReaction#97474d7b: field chat_id: %w", err) - } - r.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeMessageReaction#97474d7b: field message_id: %w", err) - } - r.MessageID = value - case "reaction_type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode removeMessageReaction#97474d7b: field reaction_type: %w", err) - } - r.ReactionType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *RemoveMessageReactionRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetMessageID returns value of MessageID field. -func (r *RemoveMessageReactionRequest) GetMessageID() (value int64) { - if r == nil { - return - } - return r.MessageID -} - -// GetReactionType returns value of ReactionType field. -func (r *RemoveMessageReactionRequest) GetReactionType() (value ReactionTypeClass) { - if r == nil { - return - } - return r.ReactionType -} - -// RemoveMessageReaction invokes method removeMessageReaction#97474d7b returning error if any. -func (c *Client) RemoveMessageReaction(ctx context.Context, request *RemoveMessageReactionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_message_sender_bot_verification_gen.go b/tdapi/tl_remove_message_sender_bot_verification_gen.go deleted file mode 100644 index 23eb2c389..000000000 --- a/tdapi/tl_remove_message_sender_bot_verification_gen.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveMessageSenderBotVerificationRequest represents TL type `removeMessageSenderBotVerification#9a10cf5a`. -type RemoveMessageSenderBotVerificationRequest struct { - // Identifier of the owned bot, which verified the user or the chat - BotUserID int64 - // Identifier of the user or the supergroup or channel chat, which verification is - // removed - VerifiedID MessageSenderClass -} - -// RemoveMessageSenderBotVerificationRequestTypeID is TL type id of RemoveMessageSenderBotVerificationRequest. -const RemoveMessageSenderBotVerificationRequestTypeID = 0x9a10cf5a - -// Ensuring interfaces in compile-time for RemoveMessageSenderBotVerificationRequest. -var ( - _ bin.Encoder = &RemoveMessageSenderBotVerificationRequest{} - _ bin.Decoder = &RemoveMessageSenderBotVerificationRequest{} - _ bin.BareEncoder = &RemoveMessageSenderBotVerificationRequest{} - _ bin.BareDecoder = &RemoveMessageSenderBotVerificationRequest{} -) - -func (r *RemoveMessageSenderBotVerificationRequest) Zero() bool { - if r == nil { - return true - } - if !(r.BotUserID == 0) { - return false - } - if !(r.VerifiedID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveMessageSenderBotVerificationRequest) String() string { - if r == nil { - return "RemoveMessageSenderBotVerificationRequest(nil)" - } - type Alias RemoveMessageSenderBotVerificationRequest - return fmt.Sprintf("RemoveMessageSenderBotVerificationRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveMessageSenderBotVerificationRequest) TypeID() uint32 { - return RemoveMessageSenderBotVerificationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveMessageSenderBotVerificationRequest) TypeName() string { - return "removeMessageSenderBotVerification" -} - -// TypeInfo returns info about TL type. -func (r *RemoveMessageSenderBotVerificationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeMessageSenderBotVerification", - ID: RemoveMessageSenderBotVerificationRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "VerifiedID", - SchemaName: "verified_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveMessageSenderBotVerificationRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeMessageSenderBotVerification#9a10cf5a as nil") - } - b.PutID(RemoveMessageSenderBotVerificationRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveMessageSenderBotVerificationRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeMessageSenderBotVerification#9a10cf5a as nil") - } - b.PutInt53(r.BotUserID) - if r.VerifiedID == nil { - return fmt.Errorf("unable to encode removeMessageSenderBotVerification#9a10cf5a: field verified_id is nil") - } - if err := r.VerifiedID.Encode(b); err != nil { - return fmt.Errorf("unable to encode removeMessageSenderBotVerification#9a10cf5a: field verified_id: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveMessageSenderBotVerificationRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeMessageSenderBotVerification#9a10cf5a to nil") - } - if err := b.ConsumeID(RemoveMessageSenderBotVerificationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveMessageSenderBotVerificationRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeMessageSenderBotVerification#9a10cf5a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: field bot_user_id: %w", err) - } - r.BotUserID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: field verified_id: %w", err) - } - r.VerifiedID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveMessageSenderBotVerificationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeMessageSenderBotVerification#9a10cf5a as nil") - } - b.ObjStart() - b.PutID("removeMessageSenderBotVerification") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(r.BotUserID) - b.Comma() - b.FieldStart("verified_id") - if r.VerifiedID == nil { - return fmt.Errorf("unable to encode removeMessageSenderBotVerification#9a10cf5a: field verified_id is nil") - } - if err := r.VerifiedID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode removeMessageSenderBotVerification#9a10cf5a: field verified_id: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveMessageSenderBotVerificationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeMessageSenderBotVerification#9a10cf5a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeMessageSenderBotVerification"); err != nil { - return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: field bot_user_id: %w", err) - } - r.BotUserID = value - case "verified_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode removeMessageSenderBotVerification#9a10cf5a: field verified_id: %w", err) - } - r.VerifiedID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (r *RemoveMessageSenderBotVerificationRequest) GetBotUserID() (value int64) { - if r == nil { - return - } - return r.BotUserID -} - -// GetVerifiedID returns value of VerifiedID field. -func (r *RemoveMessageSenderBotVerificationRequest) GetVerifiedID() (value MessageSenderClass) { - if r == nil { - return - } - return r.VerifiedID -} - -// RemoveMessageSenderBotVerification invokes method removeMessageSenderBotVerification#9a10cf5a returning error if any. -func (c *Client) RemoveMessageSenderBotVerification(ctx context.Context, request *RemoveMessageSenderBotVerificationRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_notification_gen.go b/tdapi/tl_remove_notification_gen.go deleted file mode 100644 index 5dd53f8b0..000000000 --- a/tdapi/tl_remove_notification_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveNotificationRequest represents TL type `removeNotification#336ab34e`. -type RemoveNotificationRequest struct { - // Identifier of notification group to which the notification belongs - NotificationGroupID int32 - // Identifier of removed notification - NotificationID int32 -} - -// RemoveNotificationRequestTypeID is TL type id of RemoveNotificationRequest. -const RemoveNotificationRequestTypeID = 0x336ab34e - -// Ensuring interfaces in compile-time for RemoveNotificationRequest. -var ( - _ bin.Encoder = &RemoveNotificationRequest{} - _ bin.Decoder = &RemoveNotificationRequest{} - _ bin.BareEncoder = &RemoveNotificationRequest{} - _ bin.BareDecoder = &RemoveNotificationRequest{} -) - -func (r *RemoveNotificationRequest) Zero() bool { - if r == nil { - return true - } - if !(r.NotificationGroupID == 0) { - return false - } - if !(r.NotificationID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveNotificationRequest) String() string { - if r == nil { - return "RemoveNotificationRequest(nil)" - } - type Alias RemoveNotificationRequest - return fmt.Sprintf("RemoveNotificationRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveNotificationRequest) TypeID() uint32 { - return RemoveNotificationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveNotificationRequest) TypeName() string { - return "removeNotification" -} - -// TypeInfo returns info about TL type. -func (r *RemoveNotificationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeNotification", - ID: RemoveNotificationRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NotificationGroupID", - SchemaName: "notification_group_id", - }, - { - Name: "NotificationID", - SchemaName: "notification_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveNotificationRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeNotification#336ab34e as nil") - } - b.PutID(RemoveNotificationRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveNotificationRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeNotification#336ab34e as nil") - } - b.PutInt32(r.NotificationGroupID) - b.PutInt32(r.NotificationID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveNotificationRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeNotification#336ab34e to nil") - } - if err := b.ConsumeID(RemoveNotificationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeNotification#336ab34e: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveNotificationRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeNotification#336ab34e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeNotification#336ab34e: field notification_group_id: %w", err) - } - r.NotificationGroupID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeNotification#336ab34e: field notification_id: %w", err) - } - r.NotificationID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveNotificationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeNotification#336ab34e as nil") - } - b.ObjStart() - b.PutID("removeNotification") - b.Comma() - b.FieldStart("notification_group_id") - b.PutInt32(r.NotificationGroupID) - b.Comma() - b.FieldStart("notification_id") - b.PutInt32(r.NotificationID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveNotificationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeNotification#336ab34e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeNotification"); err != nil { - return fmt.Errorf("unable to decode removeNotification#336ab34e: %w", err) - } - case "notification_group_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeNotification#336ab34e: field notification_group_id: %w", err) - } - r.NotificationGroupID = value - case "notification_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeNotification#336ab34e: field notification_id: %w", err) - } - r.NotificationID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetNotificationGroupID returns value of NotificationGroupID field. -func (r *RemoveNotificationRequest) GetNotificationGroupID() (value int32) { - if r == nil { - return - } - return r.NotificationGroupID -} - -// GetNotificationID returns value of NotificationID field. -func (r *RemoveNotificationRequest) GetNotificationID() (value int32) { - if r == nil { - return - } - return r.NotificationID -} - -// RemoveNotification invokes method removeNotification#336ab34e returning error if any. -func (c *Client) RemoveNotification(ctx context.Context, request *RemoveNotificationRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_notification_group_gen.go b/tdapi/tl_remove_notification_group_gen.go deleted file mode 100644 index 2680cb285..000000000 --- a/tdapi/tl_remove_notification_group_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveNotificationGroupRequest represents TL type `removeNotificationGroup#661a638e`. -type RemoveNotificationGroupRequest struct { - // Notification group identifier - NotificationGroupID int32 - // The maximum identifier of removed notifications - MaxNotificationID int32 -} - -// RemoveNotificationGroupRequestTypeID is TL type id of RemoveNotificationGroupRequest. -const RemoveNotificationGroupRequestTypeID = 0x661a638e - -// Ensuring interfaces in compile-time for RemoveNotificationGroupRequest. -var ( - _ bin.Encoder = &RemoveNotificationGroupRequest{} - _ bin.Decoder = &RemoveNotificationGroupRequest{} - _ bin.BareEncoder = &RemoveNotificationGroupRequest{} - _ bin.BareDecoder = &RemoveNotificationGroupRequest{} -) - -func (r *RemoveNotificationGroupRequest) Zero() bool { - if r == nil { - return true - } - if !(r.NotificationGroupID == 0) { - return false - } - if !(r.MaxNotificationID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveNotificationGroupRequest) String() string { - if r == nil { - return "RemoveNotificationGroupRequest(nil)" - } - type Alias RemoveNotificationGroupRequest - return fmt.Sprintf("RemoveNotificationGroupRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveNotificationGroupRequest) TypeID() uint32 { - return RemoveNotificationGroupRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveNotificationGroupRequest) TypeName() string { - return "removeNotificationGroup" -} - -// TypeInfo returns info about TL type. -func (r *RemoveNotificationGroupRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeNotificationGroup", - ID: RemoveNotificationGroupRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NotificationGroupID", - SchemaName: "notification_group_id", - }, - { - Name: "MaxNotificationID", - SchemaName: "max_notification_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveNotificationGroupRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeNotificationGroup#661a638e as nil") - } - b.PutID(RemoveNotificationGroupRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveNotificationGroupRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeNotificationGroup#661a638e as nil") - } - b.PutInt32(r.NotificationGroupID) - b.PutInt32(r.MaxNotificationID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveNotificationGroupRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeNotificationGroup#661a638e to nil") - } - if err := b.ConsumeID(RemoveNotificationGroupRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveNotificationGroupRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeNotificationGroup#661a638e to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: field notification_group_id: %w", err) - } - r.NotificationGroupID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: field max_notification_id: %w", err) - } - r.MaxNotificationID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveNotificationGroupRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeNotificationGroup#661a638e as nil") - } - b.ObjStart() - b.PutID("removeNotificationGroup") - b.Comma() - b.FieldStart("notification_group_id") - b.PutInt32(r.NotificationGroupID) - b.Comma() - b.FieldStart("max_notification_id") - b.PutInt32(r.MaxNotificationID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveNotificationGroupRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeNotificationGroup#661a638e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeNotificationGroup"); err != nil { - return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: %w", err) - } - case "notification_group_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: field notification_group_id: %w", err) - } - r.NotificationGroupID = value - case "max_notification_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeNotificationGroup#661a638e: field max_notification_id: %w", err) - } - r.MaxNotificationID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetNotificationGroupID returns value of NotificationGroupID field. -func (r *RemoveNotificationGroupRequest) GetNotificationGroupID() (value int32) { - if r == nil { - return - } - return r.NotificationGroupID -} - -// GetMaxNotificationID returns value of MaxNotificationID field. -func (r *RemoveNotificationGroupRequest) GetMaxNotificationID() (value int32) { - if r == nil { - return - } - return r.MaxNotificationID -} - -// RemoveNotificationGroup invokes method removeNotificationGroup#661a638e returning error if any. -func (c *Client) RemoveNotificationGroup(ctx context.Context, request *RemoveNotificationGroupRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_pending_paid_message_reactions_gen.go b/tdapi/tl_remove_pending_paid_message_reactions_gen.go deleted file mode 100644 index b6916b2fd..000000000 --- a/tdapi/tl_remove_pending_paid_message_reactions_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemovePendingPaidMessageReactionsRequest represents TL type `removePendingPaidMessageReactions#41949cfb`. -type RemovePendingPaidMessageReactionsRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 -} - -// RemovePendingPaidMessageReactionsRequestTypeID is TL type id of RemovePendingPaidMessageReactionsRequest. -const RemovePendingPaidMessageReactionsRequestTypeID = 0x41949cfb - -// Ensuring interfaces in compile-time for RemovePendingPaidMessageReactionsRequest. -var ( - _ bin.Encoder = &RemovePendingPaidMessageReactionsRequest{} - _ bin.Decoder = &RemovePendingPaidMessageReactionsRequest{} - _ bin.BareEncoder = &RemovePendingPaidMessageReactionsRequest{} - _ bin.BareDecoder = &RemovePendingPaidMessageReactionsRequest{} -) - -func (r *RemovePendingPaidMessageReactionsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemovePendingPaidMessageReactionsRequest) String() string { - if r == nil { - return "RemovePendingPaidMessageReactionsRequest(nil)" - } - type Alias RemovePendingPaidMessageReactionsRequest - return fmt.Sprintf("RemovePendingPaidMessageReactionsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemovePendingPaidMessageReactionsRequest) TypeID() uint32 { - return RemovePendingPaidMessageReactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemovePendingPaidMessageReactionsRequest) TypeName() string { - return "removePendingPaidMessageReactions" -} - -// TypeInfo returns info about TL type. -func (r *RemovePendingPaidMessageReactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removePendingPaidMessageReactions", - ID: RemovePendingPaidMessageReactionsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemovePendingPaidMessageReactionsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removePendingPaidMessageReactions#41949cfb as nil") - } - b.PutID(RemovePendingPaidMessageReactionsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemovePendingPaidMessageReactionsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removePendingPaidMessageReactions#41949cfb as nil") - } - b.PutInt53(r.ChatID) - b.PutInt53(r.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemovePendingPaidMessageReactionsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removePendingPaidMessageReactions#41949cfb to nil") - } - if err := b.ConsumeID(RemovePendingPaidMessageReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removePendingPaidMessageReactions#41949cfb: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemovePendingPaidMessageReactionsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removePendingPaidMessageReactions#41949cfb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removePendingPaidMessageReactions#41949cfb: field chat_id: %w", err) - } - r.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removePendingPaidMessageReactions#41949cfb: field message_id: %w", err) - } - r.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemovePendingPaidMessageReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removePendingPaidMessageReactions#41949cfb as nil") - } - b.ObjStart() - b.PutID("removePendingPaidMessageReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(r.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemovePendingPaidMessageReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removePendingPaidMessageReactions#41949cfb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removePendingPaidMessageReactions"); err != nil { - return fmt.Errorf("unable to decode removePendingPaidMessageReactions#41949cfb: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removePendingPaidMessageReactions#41949cfb: field chat_id: %w", err) - } - r.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removePendingPaidMessageReactions#41949cfb: field message_id: %w", err) - } - r.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *RemovePendingPaidMessageReactionsRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetMessageID returns value of MessageID field. -func (r *RemovePendingPaidMessageReactionsRequest) GetMessageID() (value int64) { - if r == nil { - return - } - return r.MessageID -} - -// RemovePendingPaidMessageReactions invokes method removePendingPaidMessageReactions#41949cfb returning error if any. -func (c *Client) RemovePendingPaidMessageReactions(ctx context.Context, request *RemovePendingPaidMessageReactionsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_proxy_gen.go b/tdapi/tl_remove_proxy_gen.go deleted file mode 100644 index 933854163..000000000 --- a/tdapi/tl_remove_proxy_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveProxyRequest represents TL type `removeProxy#519ca307`. -type RemoveProxyRequest struct { - // Proxy identifier - ProxyID int32 -} - -// RemoveProxyRequestTypeID is TL type id of RemoveProxyRequest. -const RemoveProxyRequestTypeID = 0x519ca307 - -// Ensuring interfaces in compile-time for RemoveProxyRequest. -var ( - _ bin.Encoder = &RemoveProxyRequest{} - _ bin.Decoder = &RemoveProxyRequest{} - _ bin.BareEncoder = &RemoveProxyRequest{} - _ bin.BareDecoder = &RemoveProxyRequest{} -) - -func (r *RemoveProxyRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ProxyID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveProxyRequest) String() string { - if r == nil { - return "RemoveProxyRequest(nil)" - } - type Alias RemoveProxyRequest - return fmt.Sprintf("RemoveProxyRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveProxyRequest) TypeID() uint32 { - return RemoveProxyRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveProxyRequest) TypeName() string { - return "removeProxy" -} - -// TypeInfo returns info about TL type. -func (r *RemoveProxyRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeProxy", - ID: RemoveProxyRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ProxyID", - SchemaName: "proxy_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveProxyRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeProxy#519ca307 as nil") - } - b.PutID(RemoveProxyRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveProxyRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeProxy#519ca307 as nil") - } - b.PutInt32(r.ProxyID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveProxyRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeProxy#519ca307 to nil") - } - if err := b.ConsumeID(RemoveProxyRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeProxy#519ca307: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveProxyRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeProxy#519ca307 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeProxy#519ca307: field proxy_id: %w", err) - } - r.ProxyID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveProxyRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeProxy#519ca307 as nil") - } - b.ObjStart() - b.PutID("removeProxy") - b.Comma() - b.FieldStart("proxy_id") - b.PutInt32(r.ProxyID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveProxyRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeProxy#519ca307 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeProxy"); err != nil { - return fmt.Errorf("unable to decode removeProxy#519ca307: %w", err) - } - case "proxy_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode removeProxy#519ca307: field proxy_id: %w", err) - } - r.ProxyID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProxyID returns value of ProxyID field. -func (r *RemoveProxyRequest) GetProxyID() (value int32) { - if r == nil { - return - } - return r.ProxyID -} - -// RemoveProxy invokes method removeProxy#519ca307 returning error if any. -func (c *Client) RemoveProxy(ctx context.Context, proxyid int32) error { - var ok Ok - - request := &RemoveProxyRequest{ - ProxyID: proxyid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_recent_hashtag_gen.go b/tdapi/tl_remove_recent_hashtag_gen.go deleted file mode 100644 index b7df84b17..000000000 --- a/tdapi/tl_remove_recent_hashtag_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveRecentHashtagRequest represents TL type `removeRecentHashtag#c393a0a4`. -type RemoveRecentHashtagRequest struct { - // Hashtag to delete - Hashtag string -} - -// RemoveRecentHashtagRequestTypeID is TL type id of RemoveRecentHashtagRequest. -const RemoveRecentHashtagRequestTypeID = 0xc393a0a4 - -// Ensuring interfaces in compile-time for RemoveRecentHashtagRequest. -var ( - _ bin.Encoder = &RemoveRecentHashtagRequest{} - _ bin.Decoder = &RemoveRecentHashtagRequest{} - _ bin.BareEncoder = &RemoveRecentHashtagRequest{} - _ bin.BareDecoder = &RemoveRecentHashtagRequest{} -) - -func (r *RemoveRecentHashtagRequest) Zero() bool { - if r == nil { - return true - } - if !(r.Hashtag == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveRecentHashtagRequest) String() string { - if r == nil { - return "RemoveRecentHashtagRequest(nil)" - } - type Alias RemoveRecentHashtagRequest - return fmt.Sprintf("RemoveRecentHashtagRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveRecentHashtagRequest) TypeID() uint32 { - return RemoveRecentHashtagRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveRecentHashtagRequest) TypeName() string { - return "removeRecentHashtag" -} - -// TypeInfo returns info about TL type. -func (r *RemoveRecentHashtagRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeRecentHashtag", - ID: RemoveRecentHashtagRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Hashtag", - SchemaName: "hashtag", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveRecentHashtagRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeRecentHashtag#c393a0a4 as nil") - } - b.PutID(RemoveRecentHashtagRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveRecentHashtagRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeRecentHashtag#c393a0a4 as nil") - } - b.PutString(r.Hashtag) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveRecentHashtagRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeRecentHashtag#c393a0a4 to nil") - } - if err := b.ConsumeID(RemoveRecentHashtagRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeRecentHashtag#c393a0a4: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveRecentHashtagRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeRecentHashtag#c393a0a4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode removeRecentHashtag#c393a0a4: field hashtag: %w", err) - } - r.Hashtag = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveRecentHashtagRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeRecentHashtag#c393a0a4 as nil") - } - b.ObjStart() - b.PutID("removeRecentHashtag") - b.Comma() - b.FieldStart("hashtag") - b.PutString(r.Hashtag) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveRecentHashtagRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeRecentHashtag#c393a0a4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeRecentHashtag"); err != nil { - return fmt.Errorf("unable to decode removeRecentHashtag#c393a0a4: %w", err) - } - case "hashtag": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode removeRecentHashtag#c393a0a4: field hashtag: %w", err) - } - r.Hashtag = value - default: - return b.Skip() - } - return nil - }) -} - -// GetHashtag returns value of Hashtag field. -func (r *RemoveRecentHashtagRequest) GetHashtag() (value string) { - if r == nil { - return - } - return r.Hashtag -} - -// RemoveRecentHashtag invokes method removeRecentHashtag#c393a0a4 returning error if any. -func (c *Client) RemoveRecentHashtag(ctx context.Context, hashtag string) error { - var ok Ok - - request := &RemoveRecentHashtagRequest{ - Hashtag: hashtag, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_recent_sticker_gen.go b/tdapi/tl_remove_recent_sticker_gen.go deleted file mode 100644 index 3262bdf84..000000000 --- a/tdapi/tl_remove_recent_sticker_gen.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveRecentStickerRequest represents TL type `removeRecentSticker#4a4d440d`. -type RemoveRecentStickerRequest struct { - // Pass true to remove the sticker from the list of stickers recently attached to photo - // or video files; pass false to remove the sticker from the list of recently sent - // stickers - IsAttached bool - // Sticker file to delete - Sticker InputFileClass -} - -// RemoveRecentStickerRequestTypeID is TL type id of RemoveRecentStickerRequest. -const RemoveRecentStickerRequestTypeID = 0x4a4d440d - -// Ensuring interfaces in compile-time for RemoveRecentStickerRequest. -var ( - _ bin.Encoder = &RemoveRecentStickerRequest{} - _ bin.Decoder = &RemoveRecentStickerRequest{} - _ bin.BareEncoder = &RemoveRecentStickerRequest{} - _ bin.BareDecoder = &RemoveRecentStickerRequest{} -) - -func (r *RemoveRecentStickerRequest) Zero() bool { - if r == nil { - return true - } - if !(r.IsAttached == false) { - return false - } - if !(r.Sticker == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveRecentStickerRequest) String() string { - if r == nil { - return "RemoveRecentStickerRequest(nil)" - } - type Alias RemoveRecentStickerRequest - return fmt.Sprintf("RemoveRecentStickerRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveRecentStickerRequest) TypeID() uint32 { - return RemoveRecentStickerRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveRecentStickerRequest) TypeName() string { - return "removeRecentSticker" -} - -// TypeInfo returns info about TL type. -func (r *RemoveRecentStickerRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeRecentSticker", - ID: RemoveRecentStickerRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsAttached", - SchemaName: "is_attached", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveRecentStickerRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeRecentSticker#4a4d440d as nil") - } - b.PutID(RemoveRecentStickerRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveRecentStickerRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeRecentSticker#4a4d440d as nil") - } - b.PutBool(r.IsAttached) - if r.Sticker == nil { - return fmt.Errorf("unable to encode removeRecentSticker#4a4d440d: field sticker is nil") - } - if err := r.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode removeRecentSticker#4a4d440d: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveRecentStickerRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeRecentSticker#4a4d440d to nil") - } - if err := b.ConsumeID(RemoveRecentStickerRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeRecentSticker#4a4d440d: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveRecentStickerRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeRecentSticker#4a4d440d to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode removeRecentSticker#4a4d440d: field is_attached: %w", err) - } - r.IsAttached = value - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode removeRecentSticker#4a4d440d: field sticker: %w", err) - } - r.Sticker = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveRecentStickerRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeRecentSticker#4a4d440d as nil") - } - b.ObjStart() - b.PutID("removeRecentSticker") - b.Comma() - b.FieldStart("is_attached") - b.PutBool(r.IsAttached) - b.Comma() - b.FieldStart("sticker") - if r.Sticker == nil { - return fmt.Errorf("unable to encode removeRecentSticker#4a4d440d: field sticker is nil") - } - if err := r.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode removeRecentSticker#4a4d440d: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveRecentStickerRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeRecentSticker#4a4d440d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeRecentSticker"); err != nil { - return fmt.Errorf("unable to decode removeRecentSticker#4a4d440d: %w", err) - } - case "is_attached": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode removeRecentSticker#4a4d440d: field is_attached: %w", err) - } - r.IsAttached = value - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode removeRecentSticker#4a4d440d: field sticker: %w", err) - } - r.Sticker = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsAttached returns value of IsAttached field. -func (r *RemoveRecentStickerRequest) GetIsAttached() (value bool) { - if r == nil { - return - } - return r.IsAttached -} - -// GetSticker returns value of Sticker field. -func (r *RemoveRecentStickerRequest) GetSticker() (value InputFileClass) { - if r == nil { - return - } - return r.Sticker -} - -// RemoveRecentSticker invokes method removeRecentSticker#4a4d440d returning error if any. -func (c *Client) RemoveRecentSticker(ctx context.Context, request *RemoveRecentStickerRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_recently_found_chat_gen.go b/tdapi/tl_remove_recently_found_chat_gen.go deleted file mode 100644 index da67829f3..000000000 --- a/tdapi/tl_remove_recently_found_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveRecentlyFoundChatRequest represents TL type `removeRecentlyFoundChat#2ac1bf1c`. -type RemoveRecentlyFoundChatRequest struct { - // Identifier of the chat to be removed - ChatID int64 -} - -// RemoveRecentlyFoundChatRequestTypeID is TL type id of RemoveRecentlyFoundChatRequest. -const RemoveRecentlyFoundChatRequestTypeID = 0x2ac1bf1c - -// Ensuring interfaces in compile-time for RemoveRecentlyFoundChatRequest. -var ( - _ bin.Encoder = &RemoveRecentlyFoundChatRequest{} - _ bin.Decoder = &RemoveRecentlyFoundChatRequest{} - _ bin.BareEncoder = &RemoveRecentlyFoundChatRequest{} - _ bin.BareDecoder = &RemoveRecentlyFoundChatRequest{} -) - -func (r *RemoveRecentlyFoundChatRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveRecentlyFoundChatRequest) String() string { - if r == nil { - return "RemoveRecentlyFoundChatRequest(nil)" - } - type Alias RemoveRecentlyFoundChatRequest - return fmt.Sprintf("RemoveRecentlyFoundChatRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveRecentlyFoundChatRequest) TypeID() uint32 { - return RemoveRecentlyFoundChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveRecentlyFoundChatRequest) TypeName() string { - return "removeRecentlyFoundChat" -} - -// TypeInfo returns info about TL type. -func (r *RemoveRecentlyFoundChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeRecentlyFoundChat", - ID: RemoveRecentlyFoundChatRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveRecentlyFoundChatRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeRecentlyFoundChat#2ac1bf1c as nil") - } - b.PutID(RemoveRecentlyFoundChatRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveRecentlyFoundChatRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeRecentlyFoundChat#2ac1bf1c as nil") - } - b.PutInt53(r.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveRecentlyFoundChatRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeRecentlyFoundChat#2ac1bf1c to nil") - } - if err := b.ConsumeID(RemoveRecentlyFoundChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeRecentlyFoundChat#2ac1bf1c: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveRecentlyFoundChatRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeRecentlyFoundChat#2ac1bf1c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeRecentlyFoundChat#2ac1bf1c: field chat_id: %w", err) - } - r.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveRecentlyFoundChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeRecentlyFoundChat#2ac1bf1c as nil") - } - b.ObjStart() - b.PutID("removeRecentlyFoundChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveRecentlyFoundChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeRecentlyFoundChat#2ac1bf1c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeRecentlyFoundChat"); err != nil { - return fmt.Errorf("unable to decode removeRecentlyFoundChat#2ac1bf1c: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeRecentlyFoundChat#2ac1bf1c: field chat_id: %w", err) - } - r.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *RemoveRecentlyFoundChatRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// RemoveRecentlyFoundChat invokes method removeRecentlyFoundChat#2ac1bf1c returning error if any. -func (c *Client) RemoveRecentlyFoundChat(ctx context.Context, chatid int64) error { - var ok Ok - - request := &RemoveRecentlyFoundChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_saved_animation_gen.go b/tdapi/tl_remove_saved_animation_gen.go deleted file mode 100644 index 86bf18423..000000000 --- a/tdapi/tl_remove_saved_animation_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveSavedAnimationRequest represents TL type `removeSavedAnimation#e275a919`. -type RemoveSavedAnimationRequest struct { - // Animation file to be removed - Animation InputFileClass -} - -// RemoveSavedAnimationRequestTypeID is TL type id of RemoveSavedAnimationRequest. -const RemoveSavedAnimationRequestTypeID = 0xe275a919 - -// Ensuring interfaces in compile-time for RemoveSavedAnimationRequest. -var ( - _ bin.Encoder = &RemoveSavedAnimationRequest{} - _ bin.Decoder = &RemoveSavedAnimationRequest{} - _ bin.BareEncoder = &RemoveSavedAnimationRequest{} - _ bin.BareDecoder = &RemoveSavedAnimationRequest{} -) - -func (r *RemoveSavedAnimationRequest) Zero() bool { - if r == nil { - return true - } - if !(r.Animation == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveSavedAnimationRequest) String() string { - if r == nil { - return "RemoveSavedAnimationRequest(nil)" - } - type Alias RemoveSavedAnimationRequest - return fmt.Sprintf("RemoveSavedAnimationRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveSavedAnimationRequest) TypeID() uint32 { - return RemoveSavedAnimationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveSavedAnimationRequest) TypeName() string { - return "removeSavedAnimation" -} - -// TypeInfo returns info about TL type. -func (r *RemoveSavedAnimationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeSavedAnimation", - ID: RemoveSavedAnimationRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Animation", - SchemaName: "animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveSavedAnimationRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeSavedAnimation#e275a919 as nil") - } - b.PutID(RemoveSavedAnimationRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveSavedAnimationRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeSavedAnimation#e275a919 as nil") - } - if r.Animation == nil { - return fmt.Errorf("unable to encode removeSavedAnimation#e275a919: field animation is nil") - } - if err := r.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode removeSavedAnimation#e275a919: field animation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveSavedAnimationRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeSavedAnimation#e275a919 to nil") - } - if err := b.ConsumeID(RemoveSavedAnimationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeSavedAnimation#e275a919: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveSavedAnimationRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeSavedAnimation#e275a919 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode removeSavedAnimation#e275a919: field animation: %w", err) - } - r.Animation = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveSavedAnimationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeSavedAnimation#e275a919 as nil") - } - b.ObjStart() - b.PutID("removeSavedAnimation") - b.Comma() - b.FieldStart("animation") - if r.Animation == nil { - return fmt.Errorf("unable to encode removeSavedAnimation#e275a919: field animation is nil") - } - if err := r.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode removeSavedAnimation#e275a919: field animation: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveSavedAnimationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeSavedAnimation#e275a919 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeSavedAnimation"); err != nil { - return fmt.Errorf("unable to decode removeSavedAnimation#e275a919: %w", err) - } - case "animation": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode removeSavedAnimation#e275a919: field animation: %w", err) - } - r.Animation = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAnimation returns value of Animation field. -func (r *RemoveSavedAnimationRequest) GetAnimation() (value InputFileClass) { - if r == nil { - return - } - return r.Animation -} - -// RemoveSavedAnimation invokes method removeSavedAnimation#e275a919 returning error if any. -func (c *Client) RemoveSavedAnimation(ctx context.Context, animation InputFileClass) error { - var ok Ok - - request := &RemoveSavedAnimationRequest{ - Animation: animation, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_saved_notification_sound_gen.go b/tdapi/tl_remove_saved_notification_sound_gen.go deleted file mode 100644 index 180aade97..000000000 --- a/tdapi/tl_remove_saved_notification_sound_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveSavedNotificationSoundRequest represents TL type `removeSavedNotificationSound#e363474e`. -type RemoveSavedNotificationSoundRequest struct { - // Identifier of the notification sound - NotificationSoundID int64 -} - -// RemoveSavedNotificationSoundRequestTypeID is TL type id of RemoveSavedNotificationSoundRequest. -const RemoveSavedNotificationSoundRequestTypeID = 0xe363474e - -// Ensuring interfaces in compile-time for RemoveSavedNotificationSoundRequest. -var ( - _ bin.Encoder = &RemoveSavedNotificationSoundRequest{} - _ bin.Decoder = &RemoveSavedNotificationSoundRequest{} - _ bin.BareEncoder = &RemoveSavedNotificationSoundRequest{} - _ bin.BareDecoder = &RemoveSavedNotificationSoundRequest{} -) - -func (r *RemoveSavedNotificationSoundRequest) Zero() bool { - if r == nil { - return true - } - if !(r.NotificationSoundID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveSavedNotificationSoundRequest) String() string { - if r == nil { - return "RemoveSavedNotificationSoundRequest(nil)" - } - type Alias RemoveSavedNotificationSoundRequest - return fmt.Sprintf("RemoveSavedNotificationSoundRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveSavedNotificationSoundRequest) TypeID() uint32 { - return RemoveSavedNotificationSoundRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveSavedNotificationSoundRequest) TypeName() string { - return "removeSavedNotificationSound" -} - -// TypeInfo returns info about TL type. -func (r *RemoveSavedNotificationSoundRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeSavedNotificationSound", - ID: RemoveSavedNotificationSoundRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NotificationSoundID", - SchemaName: "notification_sound_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveSavedNotificationSoundRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeSavedNotificationSound#e363474e as nil") - } - b.PutID(RemoveSavedNotificationSoundRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveSavedNotificationSoundRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeSavedNotificationSound#e363474e as nil") - } - b.PutLong(r.NotificationSoundID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveSavedNotificationSoundRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeSavedNotificationSound#e363474e to nil") - } - if err := b.ConsumeID(RemoveSavedNotificationSoundRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeSavedNotificationSound#e363474e: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveSavedNotificationSoundRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeSavedNotificationSound#e363474e to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode removeSavedNotificationSound#e363474e: field notification_sound_id: %w", err) - } - r.NotificationSoundID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveSavedNotificationSoundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeSavedNotificationSound#e363474e as nil") - } - b.ObjStart() - b.PutID("removeSavedNotificationSound") - b.Comma() - b.FieldStart("notification_sound_id") - b.PutLong(r.NotificationSoundID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveSavedNotificationSoundRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeSavedNotificationSound#e363474e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeSavedNotificationSound"); err != nil { - return fmt.Errorf("unable to decode removeSavedNotificationSound#e363474e: %w", err) - } - case "notification_sound_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode removeSavedNotificationSound#e363474e: field notification_sound_id: %w", err) - } - r.NotificationSoundID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetNotificationSoundID returns value of NotificationSoundID field. -func (r *RemoveSavedNotificationSoundRequest) GetNotificationSoundID() (value int64) { - if r == nil { - return - } - return r.NotificationSoundID -} - -// RemoveSavedNotificationSound invokes method removeSavedNotificationSound#e363474e returning error if any. -func (c *Client) RemoveSavedNotificationSound(ctx context.Context, notificationsoundid int64) error { - var ok Ok - - request := &RemoveSavedNotificationSoundRequest{ - NotificationSoundID: notificationsoundid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_searched_for_tag_gen.go b/tdapi/tl_remove_searched_for_tag_gen.go deleted file mode 100644 index fc11a6b78..000000000 --- a/tdapi/tl_remove_searched_for_tag_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveSearchedForTagRequest represents TL type `removeSearchedForTag#35216bca`. -type RemoveSearchedForTagRequest struct { - // Hashtag or cashtag to delete - Tag string -} - -// RemoveSearchedForTagRequestTypeID is TL type id of RemoveSearchedForTagRequest. -const RemoveSearchedForTagRequestTypeID = 0x35216bca - -// Ensuring interfaces in compile-time for RemoveSearchedForTagRequest. -var ( - _ bin.Encoder = &RemoveSearchedForTagRequest{} - _ bin.Decoder = &RemoveSearchedForTagRequest{} - _ bin.BareEncoder = &RemoveSearchedForTagRequest{} - _ bin.BareDecoder = &RemoveSearchedForTagRequest{} -) - -func (r *RemoveSearchedForTagRequest) Zero() bool { - if r == nil { - return true - } - if !(r.Tag == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveSearchedForTagRequest) String() string { - if r == nil { - return "RemoveSearchedForTagRequest(nil)" - } - type Alias RemoveSearchedForTagRequest - return fmt.Sprintf("RemoveSearchedForTagRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveSearchedForTagRequest) TypeID() uint32 { - return RemoveSearchedForTagRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveSearchedForTagRequest) TypeName() string { - return "removeSearchedForTag" -} - -// TypeInfo returns info about TL type. -func (r *RemoveSearchedForTagRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeSearchedForTag", - ID: RemoveSearchedForTagRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Tag", - SchemaName: "tag", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveSearchedForTagRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeSearchedForTag#35216bca as nil") - } - b.PutID(RemoveSearchedForTagRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveSearchedForTagRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeSearchedForTag#35216bca as nil") - } - b.PutString(r.Tag) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveSearchedForTagRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeSearchedForTag#35216bca to nil") - } - if err := b.ConsumeID(RemoveSearchedForTagRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeSearchedForTag#35216bca: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveSearchedForTagRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeSearchedForTag#35216bca to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode removeSearchedForTag#35216bca: field tag: %w", err) - } - r.Tag = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveSearchedForTagRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeSearchedForTag#35216bca as nil") - } - b.ObjStart() - b.PutID("removeSearchedForTag") - b.Comma() - b.FieldStart("tag") - b.PutString(r.Tag) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveSearchedForTagRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeSearchedForTag#35216bca to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeSearchedForTag"); err != nil { - return fmt.Errorf("unable to decode removeSearchedForTag#35216bca: %w", err) - } - case "tag": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode removeSearchedForTag#35216bca: field tag: %w", err) - } - r.Tag = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTag returns value of Tag field. -func (r *RemoveSearchedForTagRequest) GetTag() (value string) { - if r == nil { - return - } - return r.Tag -} - -// RemoveSearchedForTag invokes method removeSearchedForTag#35216bca returning error if any. -func (c *Client) RemoveSearchedForTag(ctx context.Context, tag string) error { - var ok Ok - - request := &RemoveSearchedForTagRequest{ - Tag: tag, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_sticker_from_set_gen.go b/tdapi/tl_remove_sticker_from_set_gen.go deleted file mode 100644 index 3d6a0bce1..000000000 --- a/tdapi/tl_remove_sticker_from_set_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveStickerFromSetRequest represents TL type `removeStickerFromSet#61e1eea4`. -type RemoveStickerFromSetRequest struct { - // Sticker to remove from the set - Sticker InputFileClass -} - -// RemoveStickerFromSetRequestTypeID is TL type id of RemoveStickerFromSetRequest. -const RemoveStickerFromSetRequestTypeID = 0x61e1eea4 - -// Ensuring interfaces in compile-time for RemoveStickerFromSetRequest. -var ( - _ bin.Encoder = &RemoveStickerFromSetRequest{} - _ bin.Decoder = &RemoveStickerFromSetRequest{} - _ bin.BareEncoder = &RemoveStickerFromSetRequest{} - _ bin.BareDecoder = &RemoveStickerFromSetRequest{} -) - -func (r *RemoveStickerFromSetRequest) Zero() bool { - if r == nil { - return true - } - if !(r.Sticker == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveStickerFromSetRequest) String() string { - if r == nil { - return "RemoveStickerFromSetRequest(nil)" - } - type Alias RemoveStickerFromSetRequest - return fmt.Sprintf("RemoveStickerFromSetRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveStickerFromSetRequest) TypeID() uint32 { - return RemoveStickerFromSetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveStickerFromSetRequest) TypeName() string { - return "removeStickerFromSet" -} - -// TypeInfo returns info about TL type. -func (r *RemoveStickerFromSetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeStickerFromSet", - ID: RemoveStickerFromSetRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveStickerFromSetRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeStickerFromSet#61e1eea4 as nil") - } - b.PutID(RemoveStickerFromSetRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveStickerFromSetRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeStickerFromSet#61e1eea4 as nil") - } - if r.Sticker == nil { - return fmt.Errorf("unable to encode removeStickerFromSet#61e1eea4: field sticker is nil") - } - if err := r.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode removeStickerFromSet#61e1eea4: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveStickerFromSetRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeStickerFromSet#61e1eea4 to nil") - } - if err := b.ConsumeID(RemoveStickerFromSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeStickerFromSet#61e1eea4: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveStickerFromSetRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeStickerFromSet#61e1eea4 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode removeStickerFromSet#61e1eea4: field sticker: %w", err) - } - r.Sticker = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveStickerFromSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeStickerFromSet#61e1eea4 as nil") - } - b.ObjStart() - b.PutID("removeStickerFromSet") - b.Comma() - b.FieldStart("sticker") - if r.Sticker == nil { - return fmt.Errorf("unable to encode removeStickerFromSet#61e1eea4: field sticker is nil") - } - if err := r.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode removeStickerFromSet#61e1eea4: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveStickerFromSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeStickerFromSet#61e1eea4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeStickerFromSet"); err != nil { - return fmt.Errorf("unable to decode removeStickerFromSet#61e1eea4: %w", err) - } - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode removeStickerFromSet#61e1eea4: field sticker: %w", err) - } - r.Sticker = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (r *RemoveStickerFromSetRequest) GetSticker() (value InputFileClass) { - if r == nil { - return - } - return r.Sticker -} - -// RemoveStickerFromSet invokes method removeStickerFromSet#61e1eea4 returning error if any. -func (c *Client) RemoveStickerFromSet(ctx context.Context, sticker InputFileClass) error { - var ok Ok - - request := &RemoveStickerFromSetRequest{ - Sticker: sticker, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_remove_top_chat_gen.go b/tdapi/tl_remove_top_chat_gen.go deleted file mode 100644 index 402cce26e..000000000 --- a/tdapi/tl_remove_top_chat_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RemoveTopChatRequest represents TL type `removeTopChat#8e481e55`. -type RemoveTopChatRequest struct { - // Category of frequently used chats - Category TopChatCategoryClass - // Chat identifier - ChatID int64 -} - -// RemoveTopChatRequestTypeID is TL type id of RemoveTopChatRequest. -const RemoveTopChatRequestTypeID = 0x8e481e55 - -// Ensuring interfaces in compile-time for RemoveTopChatRequest. -var ( - _ bin.Encoder = &RemoveTopChatRequest{} - _ bin.Decoder = &RemoveTopChatRequest{} - _ bin.BareEncoder = &RemoveTopChatRequest{} - _ bin.BareDecoder = &RemoveTopChatRequest{} -) - -func (r *RemoveTopChatRequest) Zero() bool { - if r == nil { - return true - } - if !(r.Category == nil) { - return false - } - if !(r.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RemoveTopChatRequest) String() string { - if r == nil { - return "RemoveTopChatRequest(nil)" - } - type Alias RemoveTopChatRequest - return fmt.Sprintf("RemoveTopChatRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RemoveTopChatRequest) TypeID() uint32 { - return RemoveTopChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RemoveTopChatRequest) TypeName() string { - return "removeTopChat" -} - -// TypeInfo returns info about TL type. -func (r *RemoveTopChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "removeTopChat", - ID: RemoveTopChatRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Category", - SchemaName: "category", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RemoveTopChatRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeTopChat#8e481e55 as nil") - } - b.PutID(RemoveTopChatRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RemoveTopChatRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode removeTopChat#8e481e55 as nil") - } - if r.Category == nil { - return fmt.Errorf("unable to encode removeTopChat#8e481e55: field category is nil") - } - if err := r.Category.Encode(b); err != nil { - return fmt.Errorf("unable to encode removeTopChat#8e481e55: field category: %w", err) - } - b.PutInt53(r.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RemoveTopChatRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeTopChat#8e481e55 to nil") - } - if err := b.ConsumeID(RemoveTopChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode removeTopChat#8e481e55: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RemoveTopChatRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode removeTopChat#8e481e55 to nil") - } - { - value, err := DecodeTopChatCategory(b) - if err != nil { - return fmt.Errorf("unable to decode removeTopChat#8e481e55: field category: %w", err) - } - r.Category = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeTopChat#8e481e55: field chat_id: %w", err) - } - r.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RemoveTopChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode removeTopChat#8e481e55 as nil") - } - b.ObjStart() - b.PutID("removeTopChat") - b.Comma() - b.FieldStart("category") - if r.Category == nil { - return fmt.Errorf("unable to encode removeTopChat#8e481e55: field category is nil") - } - if err := r.Category.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode removeTopChat#8e481e55: field category: %w", err) - } - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RemoveTopChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode removeTopChat#8e481e55 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("removeTopChat"); err != nil { - return fmt.Errorf("unable to decode removeTopChat#8e481e55: %w", err) - } - case "category": - value, err := DecodeTDLibJSONTopChatCategory(b) - if err != nil { - return fmt.Errorf("unable to decode removeTopChat#8e481e55: field category: %w", err) - } - r.Category = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode removeTopChat#8e481e55: field chat_id: %w", err) - } - r.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCategory returns value of Category field. -func (r *RemoveTopChatRequest) GetCategory() (value TopChatCategoryClass) { - if r == nil { - return - } - return r.Category -} - -// GetChatID returns value of ChatID field. -func (r *RemoveTopChatRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// RemoveTopChat invokes method removeTopChat#8e481e55 returning error if any. -func (c *Client) RemoveTopChat(ctx context.Context, request *RemoveTopChatRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reorder_active_usernames_gen.go b/tdapi/tl_reorder_active_usernames_gen.go deleted file mode 100644 index 7f05532f1..000000000 --- a/tdapi/tl_reorder_active_usernames_gen.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReorderActiveUsernamesRequest represents TL type `reorderActiveUsernames#c659414f`. -type ReorderActiveUsernamesRequest struct { - // The new order of active usernames. All currently active usernames must be specified - Usernames []string -} - -// ReorderActiveUsernamesRequestTypeID is TL type id of ReorderActiveUsernamesRequest. -const ReorderActiveUsernamesRequestTypeID = 0xc659414f - -// Ensuring interfaces in compile-time for ReorderActiveUsernamesRequest. -var ( - _ bin.Encoder = &ReorderActiveUsernamesRequest{} - _ bin.Decoder = &ReorderActiveUsernamesRequest{} - _ bin.BareEncoder = &ReorderActiveUsernamesRequest{} - _ bin.BareDecoder = &ReorderActiveUsernamesRequest{} -) - -func (r *ReorderActiveUsernamesRequest) Zero() bool { - if r == nil { - return true - } - if !(r.Usernames == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReorderActiveUsernamesRequest) String() string { - if r == nil { - return "ReorderActiveUsernamesRequest(nil)" - } - type Alias ReorderActiveUsernamesRequest - return fmt.Sprintf("ReorderActiveUsernamesRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReorderActiveUsernamesRequest) TypeID() uint32 { - return ReorderActiveUsernamesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReorderActiveUsernamesRequest) TypeName() string { - return "reorderActiveUsernames" -} - -// TypeInfo returns info about TL type. -func (r *ReorderActiveUsernamesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reorderActiveUsernames", - ID: ReorderActiveUsernamesRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Usernames", - SchemaName: "usernames", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReorderActiveUsernamesRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderActiveUsernames#c659414f as nil") - } - b.PutID(ReorderActiveUsernamesRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReorderActiveUsernamesRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderActiveUsernames#c659414f as nil") - } - b.PutInt(len(r.Usernames)) - for _, v := range r.Usernames { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReorderActiveUsernamesRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderActiveUsernames#c659414f to nil") - } - if err := b.ConsumeID(ReorderActiveUsernamesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reorderActiveUsernames#c659414f: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReorderActiveUsernamesRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderActiveUsernames#c659414f to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reorderActiveUsernames#c659414f: field usernames: %w", err) - } - - if headerLen > 0 { - r.Usernames = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reorderActiveUsernames#c659414f: field usernames: %w", err) - } - r.Usernames = append(r.Usernames, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReorderActiveUsernamesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reorderActiveUsernames#c659414f as nil") - } - b.ObjStart() - b.PutID("reorderActiveUsernames") - b.Comma() - b.FieldStart("usernames") - b.ArrStart() - for _, v := range r.Usernames { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReorderActiveUsernamesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reorderActiveUsernames#c659414f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reorderActiveUsernames"); err != nil { - return fmt.Errorf("unable to decode reorderActiveUsernames#c659414f: %w", err) - } - case "usernames": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reorderActiveUsernames#c659414f: field usernames: %w", err) - } - r.Usernames = append(r.Usernames, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reorderActiveUsernames#c659414f: field usernames: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUsernames returns value of Usernames field. -func (r *ReorderActiveUsernamesRequest) GetUsernames() (value []string) { - if r == nil { - return - } - return r.Usernames -} - -// ReorderActiveUsernames invokes method reorderActiveUsernames#c659414f returning error if any. -func (c *Client) ReorderActiveUsernames(ctx context.Context, usernames []string) error { - var ok Ok - - request := &ReorderActiveUsernamesRequest{ - Usernames: usernames, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reorder_bot_active_usernames_gen.go b/tdapi/tl_reorder_bot_active_usernames_gen.go deleted file mode 100644 index ec599c7f0..000000000 --- a/tdapi/tl_reorder_bot_active_usernames_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReorderBotActiveUsernamesRequest represents TL type `reorderBotActiveUsernames#acadc444`. -type ReorderBotActiveUsernamesRequest struct { - // Identifier of the target bot - BotUserID int64 - // The new order of active usernames. All currently active usernames must be specified - Usernames []string -} - -// ReorderBotActiveUsernamesRequestTypeID is TL type id of ReorderBotActiveUsernamesRequest. -const ReorderBotActiveUsernamesRequestTypeID = 0xacadc444 - -// Ensuring interfaces in compile-time for ReorderBotActiveUsernamesRequest. -var ( - _ bin.Encoder = &ReorderBotActiveUsernamesRequest{} - _ bin.Decoder = &ReorderBotActiveUsernamesRequest{} - _ bin.BareEncoder = &ReorderBotActiveUsernamesRequest{} - _ bin.BareDecoder = &ReorderBotActiveUsernamesRequest{} -) - -func (r *ReorderBotActiveUsernamesRequest) Zero() bool { - if r == nil { - return true - } - if !(r.BotUserID == 0) { - return false - } - if !(r.Usernames == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReorderBotActiveUsernamesRequest) String() string { - if r == nil { - return "ReorderBotActiveUsernamesRequest(nil)" - } - type Alias ReorderBotActiveUsernamesRequest - return fmt.Sprintf("ReorderBotActiveUsernamesRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReorderBotActiveUsernamesRequest) TypeID() uint32 { - return ReorderBotActiveUsernamesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReorderBotActiveUsernamesRequest) TypeName() string { - return "reorderBotActiveUsernames" -} - -// TypeInfo returns info about TL type. -func (r *ReorderBotActiveUsernamesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reorderBotActiveUsernames", - ID: ReorderBotActiveUsernamesRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Usernames", - SchemaName: "usernames", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReorderBotActiveUsernamesRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderBotActiveUsernames#acadc444 as nil") - } - b.PutID(ReorderBotActiveUsernamesRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReorderBotActiveUsernamesRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderBotActiveUsernames#acadc444 as nil") - } - b.PutInt53(r.BotUserID) - b.PutInt(len(r.Usernames)) - for _, v := range r.Usernames { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReorderBotActiveUsernamesRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderBotActiveUsernames#acadc444 to nil") - } - if err := b.ConsumeID(ReorderBotActiveUsernamesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reorderBotActiveUsernames#acadc444: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReorderBotActiveUsernamesRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderBotActiveUsernames#acadc444 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reorderBotActiveUsernames#acadc444: field bot_user_id: %w", err) - } - r.BotUserID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reorderBotActiveUsernames#acadc444: field usernames: %w", err) - } - - if headerLen > 0 { - r.Usernames = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reorderBotActiveUsernames#acadc444: field usernames: %w", err) - } - r.Usernames = append(r.Usernames, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReorderBotActiveUsernamesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reorderBotActiveUsernames#acadc444 as nil") - } - b.ObjStart() - b.PutID("reorderBotActiveUsernames") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(r.BotUserID) - b.Comma() - b.FieldStart("usernames") - b.ArrStart() - for _, v := range r.Usernames { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReorderBotActiveUsernamesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reorderBotActiveUsernames#acadc444 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reorderBotActiveUsernames"); err != nil { - return fmt.Errorf("unable to decode reorderBotActiveUsernames#acadc444: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reorderBotActiveUsernames#acadc444: field bot_user_id: %w", err) - } - r.BotUserID = value - case "usernames": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reorderBotActiveUsernames#acadc444: field usernames: %w", err) - } - r.Usernames = append(r.Usernames, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reorderBotActiveUsernames#acadc444: field usernames: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (r *ReorderBotActiveUsernamesRequest) GetBotUserID() (value int64) { - if r == nil { - return - } - return r.BotUserID -} - -// GetUsernames returns value of Usernames field. -func (r *ReorderBotActiveUsernamesRequest) GetUsernames() (value []string) { - if r == nil { - return - } - return r.Usernames -} - -// ReorderBotActiveUsernames invokes method reorderBotActiveUsernames#acadc444 returning error if any. -func (c *Client) ReorderBotActiveUsernames(ctx context.Context, request *ReorderBotActiveUsernamesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reorder_bot_media_previews_gen.go b/tdapi/tl_reorder_bot_media_previews_gen.go deleted file mode 100644 index b5cba55a2..000000000 --- a/tdapi/tl_reorder_bot_media_previews_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReorderBotMediaPreviewsRequest represents TL type `reorderBotMediaPreviews#89ea0cc6`. -type ReorderBotMediaPreviewsRequest struct { - // Identifier of the target bot. The bot must be owned and must have the main Web App - BotUserID int64 - // Language code of the media previews to reorder - LanguageCode string - // File identifiers of the media in the new order - FileIDs []int32 -} - -// ReorderBotMediaPreviewsRequestTypeID is TL type id of ReorderBotMediaPreviewsRequest. -const ReorderBotMediaPreviewsRequestTypeID = 0x89ea0cc6 - -// Ensuring interfaces in compile-time for ReorderBotMediaPreviewsRequest. -var ( - _ bin.Encoder = &ReorderBotMediaPreviewsRequest{} - _ bin.Decoder = &ReorderBotMediaPreviewsRequest{} - _ bin.BareEncoder = &ReorderBotMediaPreviewsRequest{} - _ bin.BareDecoder = &ReorderBotMediaPreviewsRequest{} -) - -func (r *ReorderBotMediaPreviewsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.BotUserID == 0) { - return false - } - if !(r.LanguageCode == "") { - return false - } - if !(r.FileIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReorderBotMediaPreviewsRequest) String() string { - if r == nil { - return "ReorderBotMediaPreviewsRequest(nil)" - } - type Alias ReorderBotMediaPreviewsRequest - return fmt.Sprintf("ReorderBotMediaPreviewsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReorderBotMediaPreviewsRequest) TypeID() uint32 { - return ReorderBotMediaPreviewsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReorderBotMediaPreviewsRequest) TypeName() string { - return "reorderBotMediaPreviews" -} - -// TypeInfo returns info about TL type. -func (r *ReorderBotMediaPreviewsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reorderBotMediaPreviews", - ID: ReorderBotMediaPreviewsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - { - Name: "FileIDs", - SchemaName: "file_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReorderBotMediaPreviewsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderBotMediaPreviews#89ea0cc6 as nil") - } - b.PutID(ReorderBotMediaPreviewsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReorderBotMediaPreviewsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderBotMediaPreviews#89ea0cc6 as nil") - } - b.PutInt53(r.BotUserID) - b.PutString(r.LanguageCode) - b.PutInt(len(r.FileIDs)) - for _, v := range r.FileIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReorderBotMediaPreviewsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderBotMediaPreviews#89ea0cc6 to nil") - } - if err := b.ConsumeID(ReorderBotMediaPreviewsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReorderBotMediaPreviewsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderBotMediaPreviews#89ea0cc6 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field bot_user_id: %w", err) - } - r.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field language_code: %w", err) - } - r.LanguageCode = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field file_ids: %w", err) - } - - if headerLen > 0 { - r.FileIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field file_ids: %w", err) - } - r.FileIDs = append(r.FileIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReorderBotMediaPreviewsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reorderBotMediaPreviews#89ea0cc6 as nil") - } - b.ObjStart() - b.PutID("reorderBotMediaPreviews") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(r.BotUserID) - b.Comma() - b.FieldStart("language_code") - b.PutString(r.LanguageCode) - b.Comma() - b.FieldStart("file_ids") - b.ArrStart() - for _, v := range r.FileIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReorderBotMediaPreviewsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reorderBotMediaPreviews#89ea0cc6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reorderBotMediaPreviews"); err != nil { - return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field bot_user_id: %w", err) - } - r.BotUserID = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field language_code: %w", err) - } - r.LanguageCode = value - case "file_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field file_ids: %w", err) - } - r.FileIDs = append(r.FileIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reorderBotMediaPreviews#89ea0cc6: field file_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (r *ReorderBotMediaPreviewsRequest) GetBotUserID() (value int64) { - if r == nil { - return - } - return r.BotUserID -} - -// GetLanguageCode returns value of LanguageCode field. -func (r *ReorderBotMediaPreviewsRequest) GetLanguageCode() (value string) { - if r == nil { - return - } - return r.LanguageCode -} - -// GetFileIDs returns value of FileIDs field. -func (r *ReorderBotMediaPreviewsRequest) GetFileIDs() (value []int32) { - if r == nil { - return - } - return r.FileIDs -} - -// ReorderBotMediaPreviews invokes method reorderBotMediaPreviews#89ea0cc6 returning error if any. -func (c *Client) ReorderBotMediaPreviews(ctx context.Context, request *ReorderBotMediaPreviewsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reorder_chat_folders_gen.go b/tdapi/tl_reorder_chat_folders_gen.go deleted file mode 100644 index bd91f4bb4..000000000 --- a/tdapi/tl_reorder_chat_folders_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReorderChatFoldersRequest represents TL type `reorderChatFolders#59544c32`. -type ReorderChatFoldersRequest struct { - // Identifiers of chat folders in the new correct order - ChatFolderIDs []int32 - // Position of the main chat list among chat folders, 0-based. Can be non-zero only for - // Premium users - MainChatListPosition int32 -} - -// ReorderChatFoldersRequestTypeID is TL type id of ReorderChatFoldersRequest. -const ReorderChatFoldersRequestTypeID = 0x59544c32 - -// Ensuring interfaces in compile-time for ReorderChatFoldersRequest. -var ( - _ bin.Encoder = &ReorderChatFoldersRequest{} - _ bin.Decoder = &ReorderChatFoldersRequest{} - _ bin.BareEncoder = &ReorderChatFoldersRequest{} - _ bin.BareDecoder = &ReorderChatFoldersRequest{} -) - -func (r *ReorderChatFoldersRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatFolderIDs == nil) { - return false - } - if !(r.MainChatListPosition == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReorderChatFoldersRequest) String() string { - if r == nil { - return "ReorderChatFoldersRequest(nil)" - } - type Alias ReorderChatFoldersRequest - return fmt.Sprintf("ReorderChatFoldersRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReorderChatFoldersRequest) TypeID() uint32 { - return ReorderChatFoldersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReorderChatFoldersRequest) TypeName() string { - return "reorderChatFolders" -} - -// TypeInfo returns info about TL type. -func (r *ReorderChatFoldersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reorderChatFolders", - ID: ReorderChatFoldersRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolderIDs", - SchemaName: "chat_folder_ids", - }, - { - Name: "MainChatListPosition", - SchemaName: "main_chat_list_position", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReorderChatFoldersRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderChatFolders#59544c32 as nil") - } - b.PutID(ReorderChatFoldersRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReorderChatFoldersRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderChatFolders#59544c32 as nil") - } - b.PutInt(len(r.ChatFolderIDs)) - for _, v := range r.ChatFolderIDs { - b.PutInt32(v) - } - b.PutInt32(r.MainChatListPosition) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReorderChatFoldersRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderChatFolders#59544c32 to nil") - } - if err := b.ConsumeID(ReorderChatFoldersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reorderChatFolders#59544c32: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReorderChatFoldersRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderChatFolders#59544c32 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reorderChatFolders#59544c32: field chat_folder_ids: %w", err) - } - - if headerLen > 0 { - r.ChatFolderIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reorderChatFolders#59544c32: field chat_folder_ids: %w", err) - } - r.ChatFolderIDs = append(r.ChatFolderIDs, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reorderChatFolders#59544c32: field main_chat_list_position: %w", err) - } - r.MainChatListPosition = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReorderChatFoldersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reorderChatFolders#59544c32 as nil") - } - b.ObjStart() - b.PutID("reorderChatFolders") - b.Comma() - b.FieldStart("chat_folder_ids") - b.ArrStart() - for _, v := range r.ChatFolderIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("main_chat_list_position") - b.PutInt32(r.MainChatListPosition) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReorderChatFoldersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reorderChatFolders#59544c32 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reorderChatFolders"); err != nil { - return fmt.Errorf("unable to decode reorderChatFolders#59544c32: %w", err) - } - case "chat_folder_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reorderChatFolders#59544c32: field chat_folder_ids: %w", err) - } - r.ChatFolderIDs = append(r.ChatFolderIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reorderChatFolders#59544c32: field chat_folder_ids: %w", err) - } - case "main_chat_list_position": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reorderChatFolders#59544c32: field main_chat_list_position: %w", err) - } - r.MainChatListPosition = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolderIDs returns value of ChatFolderIDs field. -func (r *ReorderChatFoldersRequest) GetChatFolderIDs() (value []int32) { - if r == nil { - return - } - return r.ChatFolderIDs -} - -// GetMainChatListPosition returns value of MainChatListPosition field. -func (r *ReorderChatFoldersRequest) GetMainChatListPosition() (value int32) { - if r == nil { - return - } - return r.MainChatListPosition -} - -// ReorderChatFolders invokes method reorderChatFolders#59544c32 returning error if any. -func (c *Client) ReorderChatFolders(ctx context.Context, request *ReorderChatFoldersRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reorder_installed_sticker_sets_gen.go b/tdapi/tl_reorder_installed_sticker_sets_gen.go deleted file mode 100644 index e0753604f..000000000 --- a/tdapi/tl_reorder_installed_sticker_sets_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReorderInstalledStickerSetsRequest represents TL type `reorderInstalledStickerSets#4a830a78`. -type ReorderInstalledStickerSetsRequest struct { - // Type of the sticker sets to reorder - StickerType StickerTypeClass - // Identifiers of installed sticker sets in the new correct order - StickerSetIDs []int64 -} - -// ReorderInstalledStickerSetsRequestTypeID is TL type id of ReorderInstalledStickerSetsRequest. -const ReorderInstalledStickerSetsRequestTypeID = 0x4a830a78 - -// Ensuring interfaces in compile-time for ReorderInstalledStickerSetsRequest. -var ( - _ bin.Encoder = &ReorderInstalledStickerSetsRequest{} - _ bin.Decoder = &ReorderInstalledStickerSetsRequest{} - _ bin.BareEncoder = &ReorderInstalledStickerSetsRequest{} - _ bin.BareDecoder = &ReorderInstalledStickerSetsRequest{} -) - -func (r *ReorderInstalledStickerSetsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.StickerType == nil) { - return false - } - if !(r.StickerSetIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReorderInstalledStickerSetsRequest) String() string { - if r == nil { - return "ReorderInstalledStickerSetsRequest(nil)" - } - type Alias ReorderInstalledStickerSetsRequest - return fmt.Sprintf("ReorderInstalledStickerSetsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReorderInstalledStickerSetsRequest) TypeID() uint32 { - return ReorderInstalledStickerSetsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReorderInstalledStickerSetsRequest) TypeName() string { - return "reorderInstalledStickerSets" -} - -// TypeInfo returns info about TL type. -func (r *ReorderInstalledStickerSetsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reorderInstalledStickerSets", - ID: ReorderInstalledStickerSetsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "StickerSetIDs", - SchemaName: "sticker_set_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReorderInstalledStickerSetsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderInstalledStickerSets#4a830a78 as nil") - } - b.PutID(ReorderInstalledStickerSetsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReorderInstalledStickerSetsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderInstalledStickerSets#4a830a78 as nil") - } - if r.StickerType == nil { - return fmt.Errorf("unable to encode reorderInstalledStickerSets#4a830a78: field sticker_type is nil") - } - if err := r.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode reorderInstalledStickerSets#4a830a78: field sticker_type: %w", err) - } - b.PutInt(len(r.StickerSetIDs)) - for _, v := range r.StickerSetIDs { - b.PutLong(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReorderInstalledStickerSetsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderInstalledStickerSets#4a830a78 to nil") - } - if err := b.ConsumeID(ReorderInstalledStickerSetsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reorderInstalledStickerSets#4a830a78: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReorderInstalledStickerSetsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderInstalledStickerSets#4a830a78 to nil") - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode reorderInstalledStickerSets#4a830a78: field sticker_type: %w", err) - } - r.StickerType = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reorderInstalledStickerSets#4a830a78: field sticker_set_ids: %w", err) - } - - if headerLen > 0 { - r.StickerSetIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode reorderInstalledStickerSets#4a830a78: field sticker_set_ids: %w", err) - } - r.StickerSetIDs = append(r.StickerSetIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReorderInstalledStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reorderInstalledStickerSets#4a830a78 as nil") - } - b.ObjStart() - b.PutID("reorderInstalledStickerSets") - b.Comma() - b.FieldStart("sticker_type") - if r.StickerType == nil { - return fmt.Errorf("unable to encode reorderInstalledStickerSets#4a830a78: field sticker_type is nil") - } - if err := r.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode reorderInstalledStickerSets#4a830a78: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("sticker_set_ids") - b.ArrStart() - for _, v := range r.StickerSetIDs { - b.PutLong(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReorderInstalledStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reorderInstalledStickerSets#4a830a78 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reorderInstalledStickerSets"); err != nil { - return fmt.Errorf("unable to decode reorderInstalledStickerSets#4a830a78: %w", err) - } - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode reorderInstalledStickerSets#4a830a78: field sticker_type: %w", err) - } - r.StickerType = value - case "sticker_set_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode reorderInstalledStickerSets#4a830a78: field sticker_set_ids: %w", err) - } - r.StickerSetIDs = append(r.StickerSetIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reorderInstalledStickerSets#4a830a78: field sticker_set_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerType returns value of StickerType field. -func (r *ReorderInstalledStickerSetsRequest) GetStickerType() (value StickerTypeClass) { - if r == nil { - return - } - return r.StickerType -} - -// GetStickerSetIDs returns value of StickerSetIDs field. -func (r *ReorderInstalledStickerSetsRequest) GetStickerSetIDs() (value []int64) { - if r == nil { - return - } - return r.StickerSetIDs -} - -// ReorderInstalledStickerSets invokes method reorderInstalledStickerSets#4a830a78 returning error if any. -func (c *Client) ReorderInstalledStickerSets(ctx context.Context, request *ReorderInstalledStickerSetsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reorder_quick_reply_shortcuts_gen.go b/tdapi/tl_reorder_quick_reply_shortcuts_gen.go deleted file mode 100644 index 38f71b23a..000000000 --- a/tdapi/tl_reorder_quick_reply_shortcuts_gen.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReorderQuickReplyShortcutsRequest represents TL type `reorderQuickReplyShortcuts#b04981c4`. -type ReorderQuickReplyShortcutsRequest struct { - // The new order of quick reply shortcuts - ShortcutIDs []int32 -} - -// ReorderQuickReplyShortcutsRequestTypeID is TL type id of ReorderQuickReplyShortcutsRequest. -const ReorderQuickReplyShortcutsRequestTypeID = 0xb04981c4 - -// Ensuring interfaces in compile-time for ReorderQuickReplyShortcutsRequest. -var ( - _ bin.Encoder = &ReorderQuickReplyShortcutsRequest{} - _ bin.Decoder = &ReorderQuickReplyShortcutsRequest{} - _ bin.BareEncoder = &ReorderQuickReplyShortcutsRequest{} - _ bin.BareDecoder = &ReorderQuickReplyShortcutsRequest{} -) - -func (r *ReorderQuickReplyShortcutsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ShortcutIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReorderQuickReplyShortcutsRequest) String() string { - if r == nil { - return "ReorderQuickReplyShortcutsRequest(nil)" - } - type Alias ReorderQuickReplyShortcutsRequest - return fmt.Sprintf("ReorderQuickReplyShortcutsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReorderQuickReplyShortcutsRequest) TypeID() uint32 { - return ReorderQuickReplyShortcutsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReorderQuickReplyShortcutsRequest) TypeName() string { - return "reorderQuickReplyShortcuts" -} - -// TypeInfo returns info about TL type. -func (r *ReorderQuickReplyShortcutsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reorderQuickReplyShortcuts", - ID: ReorderQuickReplyShortcutsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutIDs", - SchemaName: "shortcut_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReorderQuickReplyShortcutsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderQuickReplyShortcuts#b04981c4 as nil") - } - b.PutID(ReorderQuickReplyShortcutsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReorderQuickReplyShortcutsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderQuickReplyShortcuts#b04981c4 as nil") - } - b.PutInt(len(r.ShortcutIDs)) - for _, v := range r.ShortcutIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReorderQuickReplyShortcutsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderQuickReplyShortcuts#b04981c4 to nil") - } - if err := b.ConsumeID(ReorderQuickReplyShortcutsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reorderQuickReplyShortcuts#b04981c4: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReorderQuickReplyShortcutsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderQuickReplyShortcuts#b04981c4 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reorderQuickReplyShortcuts#b04981c4: field shortcut_ids: %w", err) - } - - if headerLen > 0 { - r.ShortcutIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reorderQuickReplyShortcuts#b04981c4: field shortcut_ids: %w", err) - } - r.ShortcutIDs = append(r.ShortcutIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReorderQuickReplyShortcutsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reorderQuickReplyShortcuts#b04981c4 as nil") - } - b.ObjStart() - b.PutID("reorderQuickReplyShortcuts") - b.Comma() - b.FieldStart("shortcut_ids") - b.ArrStart() - for _, v := range r.ShortcutIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReorderQuickReplyShortcutsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reorderQuickReplyShortcuts#b04981c4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reorderQuickReplyShortcuts"); err != nil { - return fmt.Errorf("unable to decode reorderQuickReplyShortcuts#b04981c4: %w", err) - } - case "shortcut_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reorderQuickReplyShortcuts#b04981c4: field shortcut_ids: %w", err) - } - r.ShortcutIDs = append(r.ShortcutIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reorderQuickReplyShortcuts#b04981c4: field shortcut_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutIDs returns value of ShortcutIDs field. -func (r *ReorderQuickReplyShortcutsRequest) GetShortcutIDs() (value []int32) { - if r == nil { - return - } - return r.ShortcutIDs -} - -// ReorderQuickReplyShortcuts invokes method reorderQuickReplyShortcuts#b04981c4 returning error if any. -func (c *Client) ReorderQuickReplyShortcuts(ctx context.Context, shortcutids []int32) error { - var ok Ok - - request := &ReorderQuickReplyShortcutsRequest{ - ShortcutIDs: shortcutids, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reorder_supergroup_active_usernames_gen.go b/tdapi/tl_reorder_supergroup_active_usernames_gen.go deleted file mode 100644 index 8bf3fbd96..000000000 --- a/tdapi/tl_reorder_supergroup_active_usernames_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReorderSupergroupActiveUsernamesRequest represents TL type `reorderSupergroupActiveUsernames#663c7f3b`. -type ReorderSupergroupActiveUsernamesRequest struct { - // Identifier of the supergroup or channel - SupergroupID int64 - // The new order of active usernames. All currently active usernames must be specified - Usernames []string -} - -// ReorderSupergroupActiveUsernamesRequestTypeID is TL type id of ReorderSupergroupActiveUsernamesRequest. -const ReorderSupergroupActiveUsernamesRequestTypeID = 0x663c7f3b - -// Ensuring interfaces in compile-time for ReorderSupergroupActiveUsernamesRequest. -var ( - _ bin.Encoder = &ReorderSupergroupActiveUsernamesRequest{} - _ bin.Decoder = &ReorderSupergroupActiveUsernamesRequest{} - _ bin.BareEncoder = &ReorderSupergroupActiveUsernamesRequest{} - _ bin.BareDecoder = &ReorderSupergroupActiveUsernamesRequest{} -) - -func (r *ReorderSupergroupActiveUsernamesRequest) Zero() bool { - if r == nil { - return true - } - if !(r.SupergroupID == 0) { - return false - } - if !(r.Usernames == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReorderSupergroupActiveUsernamesRequest) String() string { - if r == nil { - return "ReorderSupergroupActiveUsernamesRequest(nil)" - } - type Alias ReorderSupergroupActiveUsernamesRequest - return fmt.Sprintf("ReorderSupergroupActiveUsernamesRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReorderSupergroupActiveUsernamesRequest) TypeID() uint32 { - return ReorderSupergroupActiveUsernamesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReorderSupergroupActiveUsernamesRequest) TypeName() string { - return "reorderSupergroupActiveUsernames" -} - -// TypeInfo returns info about TL type. -func (r *ReorderSupergroupActiveUsernamesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reorderSupergroupActiveUsernames", - ID: ReorderSupergroupActiveUsernamesRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "Usernames", - SchemaName: "usernames", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReorderSupergroupActiveUsernamesRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderSupergroupActiveUsernames#663c7f3b as nil") - } - b.PutID(ReorderSupergroupActiveUsernamesRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReorderSupergroupActiveUsernamesRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reorderSupergroupActiveUsernames#663c7f3b as nil") - } - b.PutInt53(r.SupergroupID) - b.PutInt(len(r.Usernames)) - for _, v := range r.Usernames { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReorderSupergroupActiveUsernamesRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderSupergroupActiveUsernames#663c7f3b to nil") - } - if err := b.ConsumeID(ReorderSupergroupActiveUsernamesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reorderSupergroupActiveUsernames#663c7f3b: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReorderSupergroupActiveUsernamesRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reorderSupergroupActiveUsernames#663c7f3b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reorderSupergroupActiveUsernames#663c7f3b: field supergroup_id: %w", err) - } - r.SupergroupID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reorderSupergroupActiveUsernames#663c7f3b: field usernames: %w", err) - } - - if headerLen > 0 { - r.Usernames = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reorderSupergroupActiveUsernames#663c7f3b: field usernames: %w", err) - } - r.Usernames = append(r.Usernames, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReorderSupergroupActiveUsernamesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reorderSupergroupActiveUsernames#663c7f3b as nil") - } - b.ObjStart() - b.PutID("reorderSupergroupActiveUsernames") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(r.SupergroupID) - b.Comma() - b.FieldStart("usernames") - b.ArrStart() - for _, v := range r.Usernames { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReorderSupergroupActiveUsernamesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reorderSupergroupActiveUsernames#663c7f3b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reorderSupergroupActiveUsernames"); err != nil { - return fmt.Errorf("unable to decode reorderSupergroupActiveUsernames#663c7f3b: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reorderSupergroupActiveUsernames#663c7f3b: field supergroup_id: %w", err) - } - r.SupergroupID = value - case "usernames": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reorderSupergroupActiveUsernames#663c7f3b: field usernames: %w", err) - } - r.Usernames = append(r.Usernames, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reorderSupergroupActiveUsernames#663c7f3b: field usernames: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (r *ReorderSupergroupActiveUsernamesRequest) GetSupergroupID() (value int64) { - if r == nil { - return - } - return r.SupergroupID -} - -// GetUsernames returns value of Usernames field. -func (r *ReorderSupergroupActiveUsernamesRequest) GetUsernames() (value []string) { - if r == nil { - return - } - return r.Usernames -} - -// ReorderSupergroupActiveUsernames invokes method reorderSupergroupActiveUsernames#663c7f3b returning error if any. -func (c *Client) ReorderSupergroupActiveUsernames(ctx context.Context, request *ReorderSupergroupActiveUsernamesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_replace_primary_chat_invite_link_gen.go b/tdapi/tl_replace_primary_chat_invite_link_gen.go deleted file mode 100644 index 96aeb2570..000000000 --- a/tdapi/tl_replace_primary_chat_invite_link_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReplacePrimaryChatInviteLinkRequest represents TL type `replacePrimaryChatInviteLink#3f9e7b9d`. -type ReplacePrimaryChatInviteLinkRequest struct { - // Chat identifier - ChatID int64 -} - -// ReplacePrimaryChatInviteLinkRequestTypeID is TL type id of ReplacePrimaryChatInviteLinkRequest. -const ReplacePrimaryChatInviteLinkRequestTypeID = 0x3f9e7b9d - -// Ensuring interfaces in compile-time for ReplacePrimaryChatInviteLinkRequest. -var ( - _ bin.Encoder = &ReplacePrimaryChatInviteLinkRequest{} - _ bin.Decoder = &ReplacePrimaryChatInviteLinkRequest{} - _ bin.BareEncoder = &ReplacePrimaryChatInviteLinkRequest{} - _ bin.BareDecoder = &ReplacePrimaryChatInviteLinkRequest{} -) - -func (r *ReplacePrimaryChatInviteLinkRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReplacePrimaryChatInviteLinkRequest) String() string { - if r == nil { - return "ReplacePrimaryChatInviteLinkRequest(nil)" - } - type Alias ReplacePrimaryChatInviteLinkRequest - return fmt.Sprintf("ReplacePrimaryChatInviteLinkRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReplacePrimaryChatInviteLinkRequest) TypeID() uint32 { - return ReplacePrimaryChatInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReplacePrimaryChatInviteLinkRequest) TypeName() string { - return "replacePrimaryChatInviteLink" -} - -// TypeInfo returns info about TL type. -func (r *ReplacePrimaryChatInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "replacePrimaryChatInviteLink", - ID: ReplacePrimaryChatInviteLinkRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReplacePrimaryChatInviteLinkRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replacePrimaryChatInviteLink#3f9e7b9d as nil") - } - b.PutID(ReplacePrimaryChatInviteLinkRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReplacePrimaryChatInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replacePrimaryChatInviteLink#3f9e7b9d as nil") - } - b.PutInt53(r.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReplacePrimaryChatInviteLinkRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replacePrimaryChatInviteLink#3f9e7b9d to nil") - } - if err := b.ConsumeID(ReplacePrimaryChatInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode replacePrimaryChatInviteLink#3f9e7b9d: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReplacePrimaryChatInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replacePrimaryChatInviteLink#3f9e7b9d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode replacePrimaryChatInviteLink#3f9e7b9d: field chat_id: %w", err) - } - r.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReplacePrimaryChatInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode replacePrimaryChatInviteLink#3f9e7b9d as nil") - } - b.ObjStart() - b.PutID("replacePrimaryChatInviteLink") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReplacePrimaryChatInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode replacePrimaryChatInviteLink#3f9e7b9d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("replacePrimaryChatInviteLink"); err != nil { - return fmt.Errorf("unable to decode replacePrimaryChatInviteLink#3f9e7b9d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode replacePrimaryChatInviteLink#3f9e7b9d: field chat_id: %w", err) - } - r.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *ReplacePrimaryChatInviteLinkRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// ReplacePrimaryChatInviteLink invokes method replacePrimaryChatInviteLink#3f9e7b9d returning error if any. -func (c *Client) ReplacePrimaryChatInviteLink(ctx context.Context, chatid int64) (*ChatInviteLink, error) { - var result ChatInviteLink - - request := &ReplacePrimaryChatInviteLinkRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_replace_sticker_in_set_gen.go b/tdapi/tl_replace_sticker_in_set_gen.go deleted file mode 100644 index 7c023cb1e..000000000 --- a/tdapi/tl_replace_sticker_in_set_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReplaceStickerInSetRequest represents TL type `replaceStickerInSet#e7c82e19`. -type ReplaceStickerInSetRequest struct { - // Sticker set owner; ignored for regular users - UserID int64 - // Sticker set name. The sticker set must be owned by the current user - Name string - // Sticker to remove from the set - OldSticker InputFileClass - // Sticker to add to the set - NewSticker InputSticker -} - -// ReplaceStickerInSetRequestTypeID is TL type id of ReplaceStickerInSetRequest. -const ReplaceStickerInSetRequestTypeID = 0xe7c82e19 - -// Ensuring interfaces in compile-time for ReplaceStickerInSetRequest. -var ( - _ bin.Encoder = &ReplaceStickerInSetRequest{} - _ bin.Decoder = &ReplaceStickerInSetRequest{} - _ bin.BareEncoder = &ReplaceStickerInSetRequest{} - _ bin.BareDecoder = &ReplaceStickerInSetRequest{} -) - -func (r *ReplaceStickerInSetRequest) Zero() bool { - if r == nil { - return true - } - if !(r.UserID == 0) { - return false - } - if !(r.Name == "") { - return false - } - if !(r.OldSticker == nil) { - return false - } - if !(r.NewSticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReplaceStickerInSetRequest) String() string { - if r == nil { - return "ReplaceStickerInSetRequest(nil)" - } - type Alias ReplaceStickerInSetRequest - return fmt.Sprintf("ReplaceStickerInSetRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReplaceStickerInSetRequest) TypeID() uint32 { - return ReplaceStickerInSetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReplaceStickerInSetRequest) TypeName() string { - return "replaceStickerInSet" -} - -// TypeInfo returns info about TL type. -func (r *ReplaceStickerInSetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "replaceStickerInSet", - ID: ReplaceStickerInSetRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "OldSticker", - SchemaName: "old_sticker", - }, - { - Name: "NewSticker", - SchemaName: "new_sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReplaceStickerInSetRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replaceStickerInSet#e7c82e19 as nil") - } - b.PutID(ReplaceStickerInSetRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReplaceStickerInSetRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replaceStickerInSet#e7c82e19 as nil") - } - b.PutInt53(r.UserID) - b.PutString(r.Name) - if r.OldSticker == nil { - return fmt.Errorf("unable to encode replaceStickerInSet#e7c82e19: field old_sticker is nil") - } - if err := r.OldSticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode replaceStickerInSet#e7c82e19: field old_sticker: %w", err) - } - if err := r.NewSticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode replaceStickerInSet#e7c82e19: field new_sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReplaceStickerInSetRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replaceStickerInSet#e7c82e19 to nil") - } - if err := b.ConsumeID(ReplaceStickerInSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode replaceStickerInSet#e7c82e19: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReplaceStickerInSetRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replaceStickerInSet#e7c82e19 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode replaceStickerInSet#e7c82e19: field user_id: %w", err) - } - r.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode replaceStickerInSet#e7c82e19: field name: %w", err) - } - r.Name = value - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode replaceStickerInSet#e7c82e19: field old_sticker: %w", err) - } - r.OldSticker = value - } - { - if err := r.NewSticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode replaceStickerInSet#e7c82e19: field new_sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReplaceStickerInSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode replaceStickerInSet#e7c82e19 as nil") - } - b.ObjStart() - b.PutID("replaceStickerInSet") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(r.UserID) - b.Comma() - b.FieldStart("name") - b.PutString(r.Name) - b.Comma() - b.FieldStart("old_sticker") - if r.OldSticker == nil { - return fmt.Errorf("unable to encode replaceStickerInSet#e7c82e19: field old_sticker is nil") - } - if err := r.OldSticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode replaceStickerInSet#e7c82e19: field old_sticker: %w", err) - } - b.Comma() - b.FieldStart("new_sticker") - if err := r.NewSticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode replaceStickerInSet#e7c82e19: field new_sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReplaceStickerInSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode replaceStickerInSet#e7c82e19 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("replaceStickerInSet"); err != nil { - return fmt.Errorf("unable to decode replaceStickerInSet#e7c82e19: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode replaceStickerInSet#e7c82e19: field user_id: %w", err) - } - r.UserID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode replaceStickerInSet#e7c82e19: field name: %w", err) - } - r.Name = value - case "old_sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode replaceStickerInSet#e7c82e19: field old_sticker: %w", err) - } - r.OldSticker = value - case "new_sticker": - if err := r.NewSticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode replaceStickerInSet#e7c82e19: field new_sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (r *ReplaceStickerInSetRequest) GetUserID() (value int64) { - if r == nil { - return - } - return r.UserID -} - -// GetName returns value of Name field. -func (r *ReplaceStickerInSetRequest) GetName() (value string) { - if r == nil { - return - } - return r.Name -} - -// GetOldSticker returns value of OldSticker field. -func (r *ReplaceStickerInSetRequest) GetOldSticker() (value InputFileClass) { - if r == nil { - return - } - return r.OldSticker -} - -// GetNewSticker returns value of NewSticker field. -func (r *ReplaceStickerInSetRequest) GetNewSticker() (value InputSticker) { - if r == nil { - return - } - return r.NewSticker -} - -// ReplaceStickerInSet invokes method replaceStickerInSet#e7c82e19 returning error if any. -func (c *Client) ReplaceStickerInSet(ctx context.Context, request *ReplaceStickerInSetRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_replace_video_chat_rtmp_url_gen.go b/tdapi/tl_replace_video_chat_rtmp_url_gen.go deleted file mode 100644 index 577f53459..000000000 --- a/tdapi/tl_replace_video_chat_rtmp_url_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReplaceVideoChatRtmpURLRequest represents TL type `replaceVideoChatRtmpUrl#214f8fe0`. -type ReplaceVideoChatRtmpURLRequest struct { - // Chat identifier - ChatID int64 -} - -// ReplaceVideoChatRtmpURLRequestTypeID is TL type id of ReplaceVideoChatRtmpURLRequest. -const ReplaceVideoChatRtmpURLRequestTypeID = 0x214f8fe0 - -// Ensuring interfaces in compile-time for ReplaceVideoChatRtmpURLRequest. -var ( - _ bin.Encoder = &ReplaceVideoChatRtmpURLRequest{} - _ bin.Decoder = &ReplaceVideoChatRtmpURLRequest{} - _ bin.BareEncoder = &ReplaceVideoChatRtmpURLRequest{} - _ bin.BareDecoder = &ReplaceVideoChatRtmpURLRequest{} -) - -func (r *ReplaceVideoChatRtmpURLRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReplaceVideoChatRtmpURLRequest) String() string { - if r == nil { - return "ReplaceVideoChatRtmpURLRequest(nil)" - } - type Alias ReplaceVideoChatRtmpURLRequest - return fmt.Sprintf("ReplaceVideoChatRtmpURLRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReplaceVideoChatRtmpURLRequest) TypeID() uint32 { - return ReplaceVideoChatRtmpURLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReplaceVideoChatRtmpURLRequest) TypeName() string { - return "replaceVideoChatRtmpUrl" -} - -// TypeInfo returns info about TL type. -func (r *ReplaceVideoChatRtmpURLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "replaceVideoChatRtmpUrl", - ID: ReplaceVideoChatRtmpURLRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReplaceVideoChatRtmpURLRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replaceVideoChatRtmpUrl#214f8fe0 as nil") - } - b.PutID(ReplaceVideoChatRtmpURLRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReplaceVideoChatRtmpURLRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replaceVideoChatRtmpUrl#214f8fe0 as nil") - } - b.PutInt53(r.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReplaceVideoChatRtmpURLRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replaceVideoChatRtmpUrl#214f8fe0 to nil") - } - if err := b.ConsumeID(ReplaceVideoChatRtmpURLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode replaceVideoChatRtmpUrl#214f8fe0: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReplaceVideoChatRtmpURLRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replaceVideoChatRtmpUrl#214f8fe0 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode replaceVideoChatRtmpUrl#214f8fe0: field chat_id: %w", err) - } - r.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReplaceVideoChatRtmpURLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode replaceVideoChatRtmpUrl#214f8fe0 as nil") - } - b.ObjStart() - b.PutID("replaceVideoChatRtmpUrl") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReplaceVideoChatRtmpURLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode replaceVideoChatRtmpUrl#214f8fe0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("replaceVideoChatRtmpUrl"); err != nil { - return fmt.Errorf("unable to decode replaceVideoChatRtmpUrl#214f8fe0: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode replaceVideoChatRtmpUrl#214f8fe0: field chat_id: %w", err) - } - r.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *ReplaceVideoChatRtmpURLRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// ReplaceVideoChatRtmpURL invokes method replaceVideoChatRtmpUrl#214f8fe0 returning error if any. -func (c *Client) ReplaceVideoChatRtmpURL(ctx context.Context, chatid int64) (*RtmpURL, error) { - var result RtmpURL - - request := &ReplaceVideoChatRtmpURLRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_reply_markup_gen.go b/tdapi/tl_reply_markup_gen.go deleted file mode 100644 index 2d5197c28..000000000 --- a/tdapi/tl_reply_markup_gen.go +++ /dev/null @@ -1,1187 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReplyMarkupRemoveKeyboard represents TL type `replyMarkupRemoveKeyboard#d6cc5171`. -type ReplyMarkupRemoveKeyboard struct { - // True, if the keyboard is removed only for the mentioned users or the target user of a - // reply - IsPersonal bool -} - -// ReplyMarkupRemoveKeyboardTypeID is TL type id of ReplyMarkupRemoveKeyboard. -const ReplyMarkupRemoveKeyboardTypeID = 0xd6cc5171 - -// construct implements constructor of ReplyMarkupClass. -func (r ReplyMarkupRemoveKeyboard) construct() ReplyMarkupClass { return &r } - -// Ensuring interfaces in compile-time for ReplyMarkupRemoveKeyboard. -var ( - _ bin.Encoder = &ReplyMarkupRemoveKeyboard{} - _ bin.Decoder = &ReplyMarkupRemoveKeyboard{} - _ bin.BareEncoder = &ReplyMarkupRemoveKeyboard{} - _ bin.BareDecoder = &ReplyMarkupRemoveKeyboard{} - - _ ReplyMarkupClass = &ReplyMarkupRemoveKeyboard{} -) - -func (r *ReplyMarkupRemoveKeyboard) Zero() bool { - if r == nil { - return true - } - if !(r.IsPersonal == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReplyMarkupRemoveKeyboard) String() string { - if r == nil { - return "ReplyMarkupRemoveKeyboard(nil)" - } - type Alias ReplyMarkupRemoveKeyboard - return fmt.Sprintf("ReplyMarkupRemoveKeyboard%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReplyMarkupRemoveKeyboard) TypeID() uint32 { - return ReplyMarkupRemoveKeyboardTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReplyMarkupRemoveKeyboard) TypeName() string { - return "replyMarkupRemoveKeyboard" -} - -// TypeInfo returns info about TL type. -func (r *ReplyMarkupRemoveKeyboard) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "replyMarkupRemoveKeyboard", - ID: ReplyMarkupRemoveKeyboardTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsPersonal", - SchemaName: "is_personal", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReplyMarkupRemoveKeyboard) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupRemoveKeyboard#d6cc5171 as nil") - } - b.PutID(ReplyMarkupRemoveKeyboardTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReplyMarkupRemoveKeyboard) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupRemoveKeyboard#d6cc5171 as nil") - } - b.PutBool(r.IsPersonal) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReplyMarkupRemoveKeyboard) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupRemoveKeyboard#d6cc5171 to nil") - } - if err := b.ConsumeID(ReplyMarkupRemoveKeyboardTypeID); err != nil { - return fmt.Errorf("unable to decode replyMarkupRemoveKeyboard#d6cc5171: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReplyMarkupRemoveKeyboard) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupRemoveKeyboard#d6cc5171 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupRemoveKeyboard#d6cc5171: field is_personal: %w", err) - } - r.IsPersonal = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReplyMarkupRemoveKeyboard) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupRemoveKeyboard#d6cc5171 as nil") - } - b.ObjStart() - b.PutID("replyMarkupRemoveKeyboard") - b.Comma() - b.FieldStart("is_personal") - b.PutBool(r.IsPersonal) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReplyMarkupRemoveKeyboard) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupRemoveKeyboard#d6cc5171 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("replyMarkupRemoveKeyboard"); err != nil { - return fmt.Errorf("unable to decode replyMarkupRemoveKeyboard#d6cc5171: %w", err) - } - case "is_personal": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupRemoveKeyboard#d6cc5171: field is_personal: %w", err) - } - r.IsPersonal = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsPersonal returns value of IsPersonal field. -func (r *ReplyMarkupRemoveKeyboard) GetIsPersonal() (value bool) { - if r == nil { - return - } - return r.IsPersonal -} - -// ReplyMarkupForceReply represents TL type `replyMarkupForceReply#41a6f99f`. -type ReplyMarkupForceReply struct { - // True, if a forced reply must automatically be shown to the current user. For outgoing - // messages, specify true to show the forced reply only for the mentioned users and for - // the target user of a reply - IsPersonal bool - // If non-empty, the placeholder to be shown in the input field when the reply is active; - // 0-64 characters - InputFieldPlaceholder string -} - -// ReplyMarkupForceReplyTypeID is TL type id of ReplyMarkupForceReply. -const ReplyMarkupForceReplyTypeID = 0x41a6f99f - -// construct implements constructor of ReplyMarkupClass. -func (r ReplyMarkupForceReply) construct() ReplyMarkupClass { return &r } - -// Ensuring interfaces in compile-time for ReplyMarkupForceReply. -var ( - _ bin.Encoder = &ReplyMarkupForceReply{} - _ bin.Decoder = &ReplyMarkupForceReply{} - _ bin.BareEncoder = &ReplyMarkupForceReply{} - _ bin.BareDecoder = &ReplyMarkupForceReply{} - - _ ReplyMarkupClass = &ReplyMarkupForceReply{} -) - -func (r *ReplyMarkupForceReply) Zero() bool { - if r == nil { - return true - } - if !(r.IsPersonal == false) { - return false - } - if !(r.InputFieldPlaceholder == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReplyMarkupForceReply) String() string { - if r == nil { - return "ReplyMarkupForceReply(nil)" - } - type Alias ReplyMarkupForceReply - return fmt.Sprintf("ReplyMarkupForceReply%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReplyMarkupForceReply) TypeID() uint32 { - return ReplyMarkupForceReplyTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReplyMarkupForceReply) TypeName() string { - return "replyMarkupForceReply" -} - -// TypeInfo returns info about TL type. -func (r *ReplyMarkupForceReply) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "replyMarkupForceReply", - ID: ReplyMarkupForceReplyTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsPersonal", - SchemaName: "is_personal", - }, - { - Name: "InputFieldPlaceholder", - SchemaName: "input_field_placeholder", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReplyMarkupForceReply) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupForceReply#41a6f99f as nil") - } - b.PutID(ReplyMarkupForceReplyTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReplyMarkupForceReply) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupForceReply#41a6f99f as nil") - } - b.PutBool(r.IsPersonal) - b.PutString(r.InputFieldPlaceholder) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReplyMarkupForceReply) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupForceReply#41a6f99f to nil") - } - if err := b.ConsumeID(ReplyMarkupForceReplyTypeID); err != nil { - return fmt.Errorf("unable to decode replyMarkupForceReply#41a6f99f: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReplyMarkupForceReply) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupForceReply#41a6f99f to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupForceReply#41a6f99f: field is_personal: %w", err) - } - r.IsPersonal = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupForceReply#41a6f99f: field input_field_placeholder: %w", err) - } - r.InputFieldPlaceholder = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReplyMarkupForceReply) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupForceReply#41a6f99f as nil") - } - b.ObjStart() - b.PutID("replyMarkupForceReply") - b.Comma() - b.FieldStart("is_personal") - b.PutBool(r.IsPersonal) - b.Comma() - b.FieldStart("input_field_placeholder") - b.PutString(r.InputFieldPlaceholder) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReplyMarkupForceReply) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupForceReply#41a6f99f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("replyMarkupForceReply"); err != nil { - return fmt.Errorf("unable to decode replyMarkupForceReply#41a6f99f: %w", err) - } - case "is_personal": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupForceReply#41a6f99f: field is_personal: %w", err) - } - r.IsPersonal = value - case "input_field_placeholder": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupForceReply#41a6f99f: field input_field_placeholder: %w", err) - } - r.InputFieldPlaceholder = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsPersonal returns value of IsPersonal field. -func (r *ReplyMarkupForceReply) GetIsPersonal() (value bool) { - if r == nil { - return - } - return r.IsPersonal -} - -// GetInputFieldPlaceholder returns value of InputFieldPlaceholder field. -func (r *ReplyMarkupForceReply) GetInputFieldPlaceholder() (value string) { - if r == nil { - return - } - return r.InputFieldPlaceholder -} - -// ReplyMarkupShowKeyboard represents TL type `replyMarkupShowKeyboard#802461d3`. -type ReplyMarkupShowKeyboard struct { - // A list of rows of bot keyboard buttons - Rows [][]KeyboardButton - // True, if the keyboard is expected to always be shown when the ordinary keyboard is - // hidden - IsPersistent bool - // True, if the application needs to resize the keyboard vertically - ResizeKeyboard bool - // True, if the application needs to hide the keyboard after use - OneTime bool - // True, if the keyboard must automatically be shown to the current user. For outgoing - // messages, specify true to show the keyboard only for the mentioned users and for the - // target user of a reply - IsPersonal bool - // If non-empty, the placeholder to be shown in the input field when the keyboard is - // active; 0-64 characters - InputFieldPlaceholder string -} - -// ReplyMarkupShowKeyboardTypeID is TL type id of ReplyMarkupShowKeyboard. -const ReplyMarkupShowKeyboardTypeID = 0x802461d3 - -// construct implements constructor of ReplyMarkupClass. -func (r ReplyMarkupShowKeyboard) construct() ReplyMarkupClass { return &r } - -// Ensuring interfaces in compile-time for ReplyMarkupShowKeyboard. -var ( - _ bin.Encoder = &ReplyMarkupShowKeyboard{} - _ bin.Decoder = &ReplyMarkupShowKeyboard{} - _ bin.BareEncoder = &ReplyMarkupShowKeyboard{} - _ bin.BareDecoder = &ReplyMarkupShowKeyboard{} - - _ ReplyMarkupClass = &ReplyMarkupShowKeyboard{} -) - -func (r *ReplyMarkupShowKeyboard) Zero() bool { - if r == nil { - return true - } - if !(r.Rows == nil) { - return false - } - if !(r.IsPersistent == false) { - return false - } - if !(r.ResizeKeyboard == false) { - return false - } - if !(r.OneTime == false) { - return false - } - if !(r.IsPersonal == false) { - return false - } - if !(r.InputFieldPlaceholder == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReplyMarkupShowKeyboard) String() string { - if r == nil { - return "ReplyMarkupShowKeyboard(nil)" - } - type Alias ReplyMarkupShowKeyboard - return fmt.Sprintf("ReplyMarkupShowKeyboard%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReplyMarkupShowKeyboard) TypeID() uint32 { - return ReplyMarkupShowKeyboardTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReplyMarkupShowKeyboard) TypeName() string { - return "replyMarkupShowKeyboard" -} - -// TypeInfo returns info about TL type. -func (r *ReplyMarkupShowKeyboard) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "replyMarkupShowKeyboard", - ID: ReplyMarkupShowKeyboardTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Rows", - SchemaName: "rows", - }, - { - Name: "IsPersistent", - SchemaName: "is_persistent", - }, - { - Name: "ResizeKeyboard", - SchemaName: "resize_keyboard", - }, - { - Name: "OneTime", - SchemaName: "one_time", - }, - { - Name: "IsPersonal", - SchemaName: "is_personal", - }, - { - Name: "InputFieldPlaceholder", - SchemaName: "input_field_placeholder", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReplyMarkupShowKeyboard) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupShowKeyboard#802461d3 as nil") - } - b.PutID(ReplyMarkupShowKeyboardTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReplyMarkupShowKeyboard) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupShowKeyboard#802461d3 as nil") - } - b.PutInt(len(r.Rows)) - for idx, row := range r.Rows { - b.PutVectorHeader(len(row)) - for _, v := range row { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare replyMarkupShowKeyboard#802461d3: field rows element with index %d: %w", idx, err) - } - } - } - b.PutBool(r.IsPersistent) - b.PutBool(r.ResizeKeyboard) - b.PutBool(r.OneTime) - b.PutBool(r.IsPersonal) - b.PutString(r.InputFieldPlaceholder) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReplyMarkupShowKeyboard) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupShowKeyboard#802461d3 to nil") - } - if err := b.ConsumeID(ReplyMarkupShowKeyboardTypeID); err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReplyMarkupShowKeyboard) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupShowKeyboard#802461d3 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field rows: %w", err) - } - - if headerLen > 0 { - r.Rows = make([][]KeyboardButton, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - innerLen, err := b.VectorHeader() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field rows: %w", err) - } - - var row []KeyboardButton - if innerLen > 0 { - row = make([]KeyboardButton, 0, innerLen%bin.PreallocateLimit) - } - for innerIndex := 0; innerIndex < innerLen; innerLen++ { - var value KeyboardButton - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare replyMarkupShowKeyboard#802461d3: field rows: %w", err) - } - row = append(row, value) - } - r.Rows = append(r.Rows, row) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field is_persistent: %w", err) - } - r.IsPersistent = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field resize_keyboard: %w", err) - } - r.ResizeKeyboard = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field one_time: %w", err) - } - r.OneTime = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field is_personal: %w", err) - } - r.IsPersonal = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field input_field_placeholder: %w", err) - } - r.InputFieldPlaceholder = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReplyMarkupShowKeyboard) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupShowKeyboard#802461d3 as nil") - } - b.ObjStart() - b.PutID("replyMarkupShowKeyboard") - b.Comma() - b.FieldStart("rows") - b.ArrStart() - for idx, row := range r.Rows { - b.ArrStart() - for _, v := range row { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode replyMarkupShowKeyboard#802461d3: field rows element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("is_persistent") - b.PutBool(r.IsPersistent) - b.Comma() - b.FieldStart("resize_keyboard") - b.PutBool(r.ResizeKeyboard) - b.Comma() - b.FieldStart("one_time") - b.PutBool(r.OneTime) - b.Comma() - b.FieldStart("is_personal") - b.PutBool(r.IsPersonal) - b.Comma() - b.FieldStart("input_field_placeholder") - b.PutString(r.InputFieldPlaceholder) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReplyMarkupShowKeyboard) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupShowKeyboard#802461d3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("replyMarkupShowKeyboard"); err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: %w", err) - } - case "rows": - if err := b.Arr(func(b tdjson.Decoder) error { - var row []KeyboardButton - if err := b.Arr(func(b tdjson.Decoder) error { - var value KeyboardButton - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field rows: %w", err) - } - row = append(row, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field rows: %w", err) - } - r.Rows = append(r.Rows, row) - return nil - }); err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field rows: %w", err) - } - case "is_persistent": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field is_persistent: %w", err) - } - r.IsPersistent = value - case "resize_keyboard": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field resize_keyboard: %w", err) - } - r.ResizeKeyboard = value - case "one_time": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field one_time: %w", err) - } - r.OneTime = value - case "is_personal": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field is_personal: %w", err) - } - r.IsPersonal = value - case "input_field_placeholder": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupShowKeyboard#802461d3: field input_field_placeholder: %w", err) - } - r.InputFieldPlaceholder = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRows returns value of Rows field. -func (r *ReplyMarkupShowKeyboard) GetRows() (value [][]KeyboardButton) { - if r == nil { - return - } - return r.Rows -} - -// GetIsPersistent returns value of IsPersistent field. -func (r *ReplyMarkupShowKeyboard) GetIsPersistent() (value bool) { - if r == nil { - return - } - return r.IsPersistent -} - -// GetResizeKeyboard returns value of ResizeKeyboard field. -func (r *ReplyMarkupShowKeyboard) GetResizeKeyboard() (value bool) { - if r == nil { - return - } - return r.ResizeKeyboard -} - -// GetOneTime returns value of OneTime field. -func (r *ReplyMarkupShowKeyboard) GetOneTime() (value bool) { - if r == nil { - return - } - return r.OneTime -} - -// GetIsPersonal returns value of IsPersonal field. -func (r *ReplyMarkupShowKeyboard) GetIsPersonal() (value bool) { - if r == nil { - return - } - return r.IsPersonal -} - -// GetInputFieldPlaceholder returns value of InputFieldPlaceholder field. -func (r *ReplyMarkupShowKeyboard) GetInputFieldPlaceholder() (value string) { - if r == nil { - return - } - return r.InputFieldPlaceholder -} - -// ReplyMarkupInlineKeyboard represents TL type `replyMarkupInlineKeyboard#92ac0efb`. -type ReplyMarkupInlineKeyboard struct { - // A list of rows of inline keyboard buttons - Rows [][]InlineKeyboardButton -} - -// ReplyMarkupInlineKeyboardTypeID is TL type id of ReplyMarkupInlineKeyboard. -const ReplyMarkupInlineKeyboardTypeID = 0x92ac0efb - -// construct implements constructor of ReplyMarkupClass. -func (r ReplyMarkupInlineKeyboard) construct() ReplyMarkupClass { return &r } - -// Ensuring interfaces in compile-time for ReplyMarkupInlineKeyboard. -var ( - _ bin.Encoder = &ReplyMarkupInlineKeyboard{} - _ bin.Decoder = &ReplyMarkupInlineKeyboard{} - _ bin.BareEncoder = &ReplyMarkupInlineKeyboard{} - _ bin.BareDecoder = &ReplyMarkupInlineKeyboard{} - - _ ReplyMarkupClass = &ReplyMarkupInlineKeyboard{} -) - -func (r *ReplyMarkupInlineKeyboard) Zero() bool { - if r == nil { - return true - } - if !(r.Rows == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReplyMarkupInlineKeyboard) String() string { - if r == nil { - return "ReplyMarkupInlineKeyboard(nil)" - } - type Alias ReplyMarkupInlineKeyboard - return fmt.Sprintf("ReplyMarkupInlineKeyboard%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReplyMarkupInlineKeyboard) TypeID() uint32 { - return ReplyMarkupInlineKeyboardTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReplyMarkupInlineKeyboard) TypeName() string { - return "replyMarkupInlineKeyboard" -} - -// TypeInfo returns info about TL type. -func (r *ReplyMarkupInlineKeyboard) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "replyMarkupInlineKeyboard", - ID: ReplyMarkupInlineKeyboardTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Rows", - SchemaName: "rows", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReplyMarkupInlineKeyboard) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupInlineKeyboard#92ac0efb as nil") - } - b.PutID(ReplyMarkupInlineKeyboardTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReplyMarkupInlineKeyboard) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupInlineKeyboard#92ac0efb as nil") - } - b.PutInt(len(r.Rows)) - for idx, row := range r.Rows { - b.PutVectorHeader(len(row)) - for _, v := range row { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare replyMarkupInlineKeyboard#92ac0efb: field rows element with index %d: %w", idx, err) - } - } - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReplyMarkupInlineKeyboard) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupInlineKeyboard#92ac0efb to nil") - } - if err := b.ConsumeID(ReplyMarkupInlineKeyboardTypeID); err != nil { - return fmt.Errorf("unable to decode replyMarkupInlineKeyboard#92ac0efb: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReplyMarkupInlineKeyboard) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupInlineKeyboard#92ac0efb to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupInlineKeyboard#92ac0efb: field rows: %w", err) - } - - if headerLen > 0 { - r.Rows = make([][]InlineKeyboardButton, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - innerLen, err := b.VectorHeader() - if err != nil { - return fmt.Errorf("unable to decode replyMarkupInlineKeyboard#92ac0efb: field rows: %w", err) - } - - var row []InlineKeyboardButton - if innerLen > 0 { - row = make([]InlineKeyboardButton, 0, innerLen%bin.PreallocateLimit) - } - for innerIndex := 0; innerIndex < innerLen; innerLen++ { - var value InlineKeyboardButton - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare replyMarkupInlineKeyboard#92ac0efb: field rows: %w", err) - } - row = append(row, value) - } - r.Rows = append(r.Rows, row) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReplyMarkupInlineKeyboard) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode replyMarkupInlineKeyboard#92ac0efb as nil") - } - b.ObjStart() - b.PutID("replyMarkupInlineKeyboard") - b.Comma() - b.FieldStart("rows") - b.ArrStart() - for idx, row := range r.Rows { - b.ArrStart() - for _, v := range row { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode replyMarkupInlineKeyboard#92ac0efb: field rows element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReplyMarkupInlineKeyboard) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode replyMarkupInlineKeyboard#92ac0efb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("replyMarkupInlineKeyboard"); err != nil { - return fmt.Errorf("unable to decode replyMarkupInlineKeyboard#92ac0efb: %w", err) - } - case "rows": - if err := b.Arr(func(b tdjson.Decoder) error { - var row []InlineKeyboardButton - if err := b.Arr(func(b tdjson.Decoder) error { - var value InlineKeyboardButton - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode replyMarkupInlineKeyboard#92ac0efb: field rows: %w", err) - } - row = append(row, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode replyMarkupInlineKeyboard#92ac0efb: field rows: %w", err) - } - r.Rows = append(r.Rows, row) - return nil - }); err != nil { - return fmt.Errorf("unable to decode replyMarkupInlineKeyboard#92ac0efb: field rows: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetRows returns value of Rows field. -func (r *ReplyMarkupInlineKeyboard) GetRows() (value [][]InlineKeyboardButton) { - if r == nil { - return - } - return r.Rows -} - -// ReplyMarkupClassName is schema name of ReplyMarkupClass. -const ReplyMarkupClassName = "ReplyMarkup" - -// ReplyMarkupClass represents ReplyMarkup generic type. -// -// Example: -// -// g, err := tdapi.DecodeReplyMarkup(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ReplyMarkupRemoveKeyboard: // replyMarkupRemoveKeyboard#d6cc5171 -// case *tdapi.ReplyMarkupForceReply: // replyMarkupForceReply#41a6f99f -// case *tdapi.ReplyMarkupShowKeyboard: // replyMarkupShowKeyboard#802461d3 -// case *tdapi.ReplyMarkupInlineKeyboard: // replyMarkupInlineKeyboard#92ac0efb -// default: panic(v) -// } -type ReplyMarkupClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ReplyMarkupClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeReplyMarkup implements binary de-serialization for ReplyMarkupClass. -func DecodeReplyMarkup(buf *bin.Buffer) (ReplyMarkupClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ReplyMarkupRemoveKeyboardTypeID: - // Decoding replyMarkupRemoveKeyboard#d6cc5171. - v := ReplyMarkupRemoveKeyboard{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReplyMarkupClass: %w", err) - } - return &v, nil - case ReplyMarkupForceReplyTypeID: - // Decoding replyMarkupForceReply#41a6f99f. - v := ReplyMarkupForceReply{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReplyMarkupClass: %w", err) - } - return &v, nil - case ReplyMarkupShowKeyboardTypeID: - // Decoding replyMarkupShowKeyboard#802461d3. - v := ReplyMarkupShowKeyboard{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReplyMarkupClass: %w", err) - } - return &v, nil - case ReplyMarkupInlineKeyboardTypeID: - // Decoding replyMarkupInlineKeyboard#92ac0efb. - v := ReplyMarkupInlineKeyboard{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReplyMarkupClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReplyMarkupClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONReplyMarkup implements binary de-serialization for ReplyMarkupClass. -func DecodeTDLibJSONReplyMarkup(buf tdjson.Decoder) (ReplyMarkupClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "replyMarkupRemoveKeyboard": - // Decoding replyMarkupRemoveKeyboard#d6cc5171. - v := ReplyMarkupRemoveKeyboard{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReplyMarkupClass: %w", err) - } - return &v, nil - case "replyMarkupForceReply": - // Decoding replyMarkupForceReply#41a6f99f. - v := ReplyMarkupForceReply{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReplyMarkupClass: %w", err) - } - return &v, nil - case "replyMarkupShowKeyboard": - // Decoding replyMarkupShowKeyboard#802461d3. - v := ReplyMarkupShowKeyboard{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReplyMarkupClass: %w", err) - } - return &v, nil - case "replyMarkupInlineKeyboard": - // Decoding replyMarkupInlineKeyboard#92ac0efb. - v := ReplyMarkupInlineKeyboard{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReplyMarkupClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReplyMarkupClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ReplyMarkup boxes the ReplyMarkupClass providing a helper. -type ReplyMarkupBox struct { - ReplyMarkup ReplyMarkupClass -} - -// Decode implements bin.Decoder for ReplyMarkupBox. -func (b *ReplyMarkupBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ReplyMarkupBox to nil") - } - v, err := DecodeReplyMarkup(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReplyMarkup = v - return nil -} - -// Encode implements bin.Encode for ReplyMarkupBox. -func (b *ReplyMarkupBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ReplyMarkup == nil { - return fmt.Errorf("unable to encode ReplyMarkupClass as nil") - } - return b.ReplyMarkup.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ReplyMarkupBox. -func (b *ReplyMarkupBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ReplyMarkupBox to nil") - } - v, err := DecodeTDLibJSONReplyMarkup(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReplyMarkup = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ReplyMarkupBox. -func (b *ReplyMarkupBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ReplyMarkup == nil { - return fmt.Errorf("unable to encode ReplyMarkupClass as nil") - } - return b.ReplyMarkup.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_report_authentication_code_missing_gen.go b/tdapi/tl_report_authentication_code_missing_gen.go deleted file mode 100644 index 1da718d81..000000000 --- a/tdapi/tl_report_authentication_code_missing_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportAuthenticationCodeMissingRequest represents TL type `reportAuthenticationCodeMissing#91efce48`. -type ReportAuthenticationCodeMissingRequest struct { - // Current mobile network code - MobileNetworkCode string -} - -// ReportAuthenticationCodeMissingRequestTypeID is TL type id of ReportAuthenticationCodeMissingRequest. -const ReportAuthenticationCodeMissingRequestTypeID = 0x91efce48 - -// Ensuring interfaces in compile-time for ReportAuthenticationCodeMissingRequest. -var ( - _ bin.Encoder = &ReportAuthenticationCodeMissingRequest{} - _ bin.Decoder = &ReportAuthenticationCodeMissingRequest{} - _ bin.BareEncoder = &ReportAuthenticationCodeMissingRequest{} - _ bin.BareDecoder = &ReportAuthenticationCodeMissingRequest{} -) - -func (r *ReportAuthenticationCodeMissingRequest) Zero() bool { - if r == nil { - return true - } - if !(r.MobileNetworkCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportAuthenticationCodeMissingRequest) String() string { - if r == nil { - return "ReportAuthenticationCodeMissingRequest(nil)" - } - type Alias ReportAuthenticationCodeMissingRequest - return fmt.Sprintf("ReportAuthenticationCodeMissingRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportAuthenticationCodeMissingRequest) TypeID() uint32 { - return ReportAuthenticationCodeMissingRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportAuthenticationCodeMissingRequest) TypeName() string { - return "reportAuthenticationCodeMissing" -} - -// TypeInfo returns info about TL type. -func (r *ReportAuthenticationCodeMissingRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportAuthenticationCodeMissing", - ID: ReportAuthenticationCodeMissingRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MobileNetworkCode", - SchemaName: "mobile_network_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportAuthenticationCodeMissingRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportAuthenticationCodeMissing#91efce48 as nil") - } - b.PutID(ReportAuthenticationCodeMissingRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportAuthenticationCodeMissingRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportAuthenticationCodeMissing#91efce48 as nil") - } - b.PutString(r.MobileNetworkCode) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportAuthenticationCodeMissingRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportAuthenticationCodeMissing#91efce48 to nil") - } - if err := b.ConsumeID(ReportAuthenticationCodeMissingRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reportAuthenticationCodeMissing#91efce48: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportAuthenticationCodeMissingRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportAuthenticationCodeMissing#91efce48 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportAuthenticationCodeMissing#91efce48: field mobile_network_code: %w", err) - } - r.MobileNetworkCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportAuthenticationCodeMissingRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportAuthenticationCodeMissing#91efce48 as nil") - } - b.ObjStart() - b.PutID("reportAuthenticationCodeMissing") - b.Comma() - b.FieldStart("mobile_network_code") - b.PutString(r.MobileNetworkCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportAuthenticationCodeMissingRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportAuthenticationCodeMissing#91efce48 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportAuthenticationCodeMissing"); err != nil { - return fmt.Errorf("unable to decode reportAuthenticationCodeMissing#91efce48: %w", err) - } - case "mobile_network_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportAuthenticationCodeMissing#91efce48: field mobile_network_code: %w", err) - } - r.MobileNetworkCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMobileNetworkCode returns value of MobileNetworkCode field. -func (r *ReportAuthenticationCodeMissingRequest) GetMobileNetworkCode() (value string) { - if r == nil { - return - } - return r.MobileNetworkCode -} - -// ReportAuthenticationCodeMissing invokes method reportAuthenticationCodeMissing#91efce48 returning error if any. -func (c *Client) ReportAuthenticationCodeMissing(ctx context.Context, mobilenetworkcode string) error { - var ok Ok - - request := &ReportAuthenticationCodeMissingRequest{ - MobileNetworkCode: mobilenetworkcode, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_report_chat_gen.go b/tdapi/tl_report_chat_gen.go deleted file mode 100644 index 8ad50e863..000000000 --- a/tdapi/tl_report_chat_gen.go +++ /dev/null @@ -1,331 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportChatRequest represents TL type `reportChat#54f7972f`. -type ReportChatRequest struct { - // Chat identifier - ChatID int64 - // Option identifier chosen by the user; leave empty for the initial request - OptionID []byte - // Identifiers of reported messages. Use messageProperties.can_report_chat to check - // whether the message can be reported - MessageIDs []int64 - // Additional report details if asked by the server; 0-1024 characters; leave empty for - // the initial request - Text string -} - -// ReportChatRequestTypeID is TL type id of ReportChatRequest. -const ReportChatRequestTypeID = 0x54f7972f - -// Ensuring interfaces in compile-time for ReportChatRequest. -var ( - _ bin.Encoder = &ReportChatRequest{} - _ bin.Decoder = &ReportChatRequest{} - _ bin.BareEncoder = &ReportChatRequest{} - _ bin.BareDecoder = &ReportChatRequest{} -) - -func (r *ReportChatRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.OptionID == nil) { - return false - } - if !(r.MessageIDs == nil) { - return false - } - if !(r.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatRequest) String() string { - if r == nil { - return "ReportChatRequest(nil)" - } - type Alias ReportChatRequest - return fmt.Sprintf("ReportChatRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatRequest) TypeID() uint32 { - return ReportChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatRequest) TypeName() string { - return "reportChat" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChat", - ID: ReportChatRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "OptionID", - SchemaName: "option_id", - }, - { - Name: "MessageIDs", - SchemaName: "message_ids", - }, - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChat#54f7972f as nil") - } - b.PutID(ReportChatRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChat#54f7972f as nil") - } - b.PutInt53(r.ChatID) - b.PutBytes(r.OptionID) - b.PutInt(len(r.MessageIDs)) - for _, v := range r.MessageIDs { - b.PutInt53(v) - } - b.PutString(r.Text) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChat#54f7972f to nil") - } - if err := b.ConsumeID(ReportChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChat#54f7972f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: field chat_id: %w", err) - } - r.ChatID = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: field option_id: %w", err) - } - r.OptionID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: field message_ids: %w", err) - } - - if headerLen > 0 { - r.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: field message_ids: %w", err) - } - r.MessageIDs = append(r.MessageIDs, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChat#54f7972f as nil") - } - b.ObjStart() - b.PutID("reportChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("option_id") - b.PutBytes(r.OptionID) - b.Comma() - b.FieldStart("message_ids") - b.ArrStart() - for _, v := range r.MessageIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("text") - b.PutString(r.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChat#54f7972f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChat"); err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: field chat_id: %w", err) - } - r.ChatID = value - case "option_id": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: field option_id: %w", err) - } - r.OptionID = value - case "message_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: field message_ids: %w", err) - } - r.MessageIDs = append(r.MessageIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: field message_ids: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportChat#54f7972f: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *ReportChatRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetOptionID returns value of OptionID field. -func (r *ReportChatRequest) GetOptionID() (value []byte) { - if r == nil { - return - } - return r.OptionID -} - -// GetMessageIDs returns value of MessageIDs field. -func (r *ReportChatRequest) GetMessageIDs() (value []int64) { - if r == nil { - return - } - return r.MessageIDs -} - -// GetText returns value of Text field. -func (r *ReportChatRequest) GetText() (value string) { - if r == nil { - return - } - return r.Text -} - -// ReportChat invokes method reportChat#54f7972f returning error if any. -func (c *Client) ReportChat(ctx context.Context, request *ReportChatRequest) (ReportChatResultClass, error) { - var result ReportChatResultBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.ReportChatResult, nil -} diff --git a/tdapi/tl_report_chat_photo_gen.go b/tdapi/tl_report_chat_photo_gen.go deleted file mode 100644 index 137ddfd44..000000000 --- a/tdapi/tl_report_chat_photo_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportChatPhotoRequest represents TL type `reportChatPhoto#d9701288`. -type ReportChatPhotoRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the photo to report. Only full photos from chatPhoto can be reported - FileID int32 - // The reason for reporting the chat photo - Reason ReportReasonClass - // Additional report details; 0-1024 characters - Text string -} - -// ReportChatPhotoRequestTypeID is TL type id of ReportChatPhotoRequest. -const ReportChatPhotoRequestTypeID = 0xd9701288 - -// Ensuring interfaces in compile-time for ReportChatPhotoRequest. -var ( - _ bin.Encoder = &ReportChatPhotoRequest{} - _ bin.Decoder = &ReportChatPhotoRequest{} - _ bin.BareEncoder = &ReportChatPhotoRequest{} - _ bin.BareDecoder = &ReportChatPhotoRequest{} -) - -func (r *ReportChatPhotoRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.FileID == 0) { - return false - } - if !(r.Reason == nil) { - return false - } - if !(r.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatPhotoRequest) String() string { - if r == nil { - return "ReportChatPhotoRequest(nil)" - } - type Alias ReportChatPhotoRequest - return fmt.Sprintf("ReportChatPhotoRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatPhotoRequest) TypeID() uint32 { - return ReportChatPhotoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatPhotoRequest) TypeName() string { - return "reportChatPhoto" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatPhotoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChatPhoto", - ID: ReportChatPhotoRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "Reason", - SchemaName: "reason", - }, - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatPhotoRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatPhoto#d9701288 as nil") - } - b.PutID(ReportChatPhotoRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatPhotoRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatPhoto#d9701288 as nil") - } - b.PutInt53(r.ChatID) - b.PutInt32(r.FileID) - if r.Reason == nil { - return fmt.Errorf("unable to encode reportChatPhoto#d9701288: field reason is nil") - } - if err := r.Reason.Encode(b); err != nil { - return fmt.Errorf("unable to encode reportChatPhoto#d9701288: field reason: %w", err) - } - b.PutString(r.Text) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatPhotoRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatPhoto#d9701288 to nil") - } - if err := b.ConsumeID(ReportChatPhotoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reportChatPhoto#d9701288: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatPhotoRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatPhoto#d9701288 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportChatPhoto#d9701288: field chat_id: %w", err) - } - r.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reportChatPhoto#d9701288: field file_id: %w", err) - } - r.FileID = value - } - { - value, err := DecodeReportReason(b) - if err != nil { - return fmt.Errorf("unable to decode reportChatPhoto#d9701288: field reason: %w", err) - } - r.Reason = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportChatPhoto#d9701288: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatPhotoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChatPhoto#d9701288 as nil") - } - b.ObjStart() - b.PutID("reportChatPhoto") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("file_id") - b.PutInt32(r.FileID) - b.Comma() - b.FieldStart("reason") - if r.Reason == nil { - return fmt.Errorf("unable to encode reportChatPhoto#d9701288: field reason is nil") - } - if err := r.Reason.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode reportChatPhoto#d9701288: field reason: %w", err) - } - b.Comma() - b.FieldStart("text") - b.PutString(r.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatPhotoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChatPhoto#d9701288 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChatPhoto"); err != nil { - return fmt.Errorf("unable to decode reportChatPhoto#d9701288: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportChatPhoto#d9701288: field chat_id: %w", err) - } - r.ChatID = value - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reportChatPhoto#d9701288: field file_id: %w", err) - } - r.FileID = value - case "reason": - value, err := DecodeTDLibJSONReportReason(b) - if err != nil { - return fmt.Errorf("unable to decode reportChatPhoto#d9701288: field reason: %w", err) - } - r.Reason = value - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportChatPhoto#d9701288: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *ReportChatPhotoRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetFileID returns value of FileID field. -func (r *ReportChatPhotoRequest) GetFileID() (value int32) { - if r == nil { - return - } - return r.FileID -} - -// GetReason returns value of Reason field. -func (r *ReportChatPhotoRequest) GetReason() (value ReportReasonClass) { - if r == nil { - return - } - return r.Reason -} - -// GetText returns value of Text field. -func (r *ReportChatPhotoRequest) GetText() (value string) { - if r == nil { - return - } - return r.Text -} - -// ReportChatPhoto invokes method reportChatPhoto#d9701288 returning error if any. -func (c *Client) ReportChatPhoto(ctx context.Context, request *ReportChatPhotoRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_report_chat_result_gen.go b/tdapi/tl_report_chat_result_gen.go deleted file mode 100644 index a6d5571b6..000000000 --- a/tdapi/tl_report_chat_result_gen.go +++ /dev/null @@ -1,889 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportChatResultOk represents TL type `reportChatResultOk#481a557d`. -type ReportChatResultOk struct { -} - -// ReportChatResultOkTypeID is TL type id of ReportChatResultOk. -const ReportChatResultOkTypeID = 0x481a557d - -// construct implements constructor of ReportChatResultClass. -func (r ReportChatResultOk) construct() ReportChatResultClass { return &r } - -// Ensuring interfaces in compile-time for ReportChatResultOk. -var ( - _ bin.Encoder = &ReportChatResultOk{} - _ bin.Decoder = &ReportChatResultOk{} - _ bin.BareEncoder = &ReportChatResultOk{} - _ bin.BareDecoder = &ReportChatResultOk{} - - _ ReportChatResultClass = &ReportChatResultOk{} -) - -func (r *ReportChatResultOk) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatResultOk) String() string { - if r == nil { - return "ReportChatResultOk(nil)" - } - type Alias ReportChatResultOk - return fmt.Sprintf("ReportChatResultOk%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatResultOk) TypeID() uint32 { - return ReportChatResultOkTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatResultOk) TypeName() string { - return "reportChatResultOk" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatResultOk) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChatResultOk", - ID: ReportChatResultOkTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatResultOk) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultOk#481a557d as nil") - } - b.PutID(ReportChatResultOkTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatResultOk) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultOk#481a557d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatResultOk) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultOk#481a557d to nil") - } - if err := b.ConsumeID(ReportChatResultOkTypeID); err != nil { - return fmt.Errorf("unable to decode reportChatResultOk#481a557d: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatResultOk) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultOk#481a557d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatResultOk) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultOk#481a557d as nil") - } - b.ObjStart() - b.PutID("reportChatResultOk") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatResultOk) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultOk#481a557d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChatResultOk"); err != nil { - return fmt.Errorf("unable to decode reportChatResultOk#481a557d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportChatResultOptionRequired represents TL type `reportChatResultOptionRequired#2d89acaa`. -type ReportChatResultOptionRequired struct { - // Title for the option choice - Title string - // List of available options - Options []ReportOption -} - -// ReportChatResultOptionRequiredTypeID is TL type id of ReportChatResultOptionRequired. -const ReportChatResultOptionRequiredTypeID = 0x2d89acaa - -// construct implements constructor of ReportChatResultClass. -func (r ReportChatResultOptionRequired) construct() ReportChatResultClass { return &r } - -// Ensuring interfaces in compile-time for ReportChatResultOptionRequired. -var ( - _ bin.Encoder = &ReportChatResultOptionRequired{} - _ bin.Decoder = &ReportChatResultOptionRequired{} - _ bin.BareEncoder = &ReportChatResultOptionRequired{} - _ bin.BareDecoder = &ReportChatResultOptionRequired{} - - _ ReportChatResultClass = &ReportChatResultOptionRequired{} -) - -func (r *ReportChatResultOptionRequired) Zero() bool { - if r == nil { - return true - } - if !(r.Title == "") { - return false - } - if !(r.Options == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatResultOptionRequired) String() string { - if r == nil { - return "ReportChatResultOptionRequired(nil)" - } - type Alias ReportChatResultOptionRequired - return fmt.Sprintf("ReportChatResultOptionRequired%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatResultOptionRequired) TypeID() uint32 { - return ReportChatResultOptionRequiredTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatResultOptionRequired) TypeName() string { - return "reportChatResultOptionRequired" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatResultOptionRequired) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChatResultOptionRequired", - ID: ReportChatResultOptionRequiredTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Options", - SchemaName: "options", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatResultOptionRequired) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultOptionRequired#2d89acaa as nil") - } - b.PutID(ReportChatResultOptionRequiredTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatResultOptionRequired) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultOptionRequired#2d89acaa as nil") - } - b.PutString(r.Title) - b.PutInt(len(r.Options)) - for idx, v := range r.Options { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare reportChatResultOptionRequired#2d89acaa: field options element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatResultOptionRequired) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultOptionRequired#2d89acaa to nil") - } - if err := b.ConsumeID(ReportChatResultOptionRequiredTypeID); err != nil { - return fmt.Errorf("unable to decode reportChatResultOptionRequired#2d89acaa: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatResultOptionRequired) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultOptionRequired#2d89acaa to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportChatResultOptionRequired#2d89acaa: field title: %w", err) - } - r.Title = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reportChatResultOptionRequired#2d89acaa: field options: %w", err) - } - - if headerLen > 0 { - r.Options = make([]ReportOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ReportOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare reportChatResultOptionRequired#2d89acaa: field options: %w", err) - } - r.Options = append(r.Options, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatResultOptionRequired) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultOptionRequired#2d89acaa as nil") - } - b.ObjStart() - b.PutID("reportChatResultOptionRequired") - b.Comma() - b.FieldStart("title") - b.PutString(r.Title) - b.Comma() - b.FieldStart("options") - b.ArrStart() - for idx, v := range r.Options { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode reportChatResultOptionRequired#2d89acaa: field options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatResultOptionRequired) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultOptionRequired#2d89acaa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChatResultOptionRequired"); err != nil { - return fmt.Errorf("unable to decode reportChatResultOptionRequired#2d89acaa: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportChatResultOptionRequired#2d89acaa: field title: %w", err) - } - r.Title = value - case "options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ReportOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode reportChatResultOptionRequired#2d89acaa: field options: %w", err) - } - r.Options = append(r.Options, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reportChatResultOptionRequired#2d89acaa: field options: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (r *ReportChatResultOptionRequired) GetTitle() (value string) { - if r == nil { - return - } - return r.Title -} - -// GetOptions returns value of Options field. -func (r *ReportChatResultOptionRequired) GetOptions() (value []ReportOption) { - if r == nil { - return - } - return r.Options -} - -// ReportChatResultTextRequired represents TL type `reportChatResultTextRequired#8bcc30c1`. -type ReportChatResultTextRequired struct { - // Option identifier for the next reportChat request - OptionID []byte - // True, if the user can skip text adding - IsOptional bool -} - -// ReportChatResultTextRequiredTypeID is TL type id of ReportChatResultTextRequired. -const ReportChatResultTextRequiredTypeID = 0x8bcc30c1 - -// construct implements constructor of ReportChatResultClass. -func (r ReportChatResultTextRequired) construct() ReportChatResultClass { return &r } - -// Ensuring interfaces in compile-time for ReportChatResultTextRequired. -var ( - _ bin.Encoder = &ReportChatResultTextRequired{} - _ bin.Decoder = &ReportChatResultTextRequired{} - _ bin.BareEncoder = &ReportChatResultTextRequired{} - _ bin.BareDecoder = &ReportChatResultTextRequired{} - - _ ReportChatResultClass = &ReportChatResultTextRequired{} -) - -func (r *ReportChatResultTextRequired) Zero() bool { - if r == nil { - return true - } - if !(r.OptionID == nil) { - return false - } - if !(r.IsOptional == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatResultTextRequired) String() string { - if r == nil { - return "ReportChatResultTextRequired(nil)" - } - type Alias ReportChatResultTextRequired - return fmt.Sprintf("ReportChatResultTextRequired%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatResultTextRequired) TypeID() uint32 { - return ReportChatResultTextRequiredTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatResultTextRequired) TypeName() string { - return "reportChatResultTextRequired" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatResultTextRequired) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChatResultTextRequired", - ID: ReportChatResultTextRequiredTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OptionID", - SchemaName: "option_id", - }, - { - Name: "IsOptional", - SchemaName: "is_optional", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatResultTextRequired) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultTextRequired#8bcc30c1 as nil") - } - b.PutID(ReportChatResultTextRequiredTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatResultTextRequired) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultTextRequired#8bcc30c1 as nil") - } - b.PutBytes(r.OptionID) - b.PutBool(r.IsOptional) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatResultTextRequired) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultTextRequired#8bcc30c1 to nil") - } - if err := b.ConsumeID(ReportChatResultTextRequiredTypeID); err != nil { - return fmt.Errorf("unable to decode reportChatResultTextRequired#8bcc30c1: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatResultTextRequired) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultTextRequired#8bcc30c1 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportChatResultTextRequired#8bcc30c1: field option_id: %w", err) - } - r.OptionID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode reportChatResultTextRequired#8bcc30c1: field is_optional: %w", err) - } - r.IsOptional = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatResultTextRequired) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultTextRequired#8bcc30c1 as nil") - } - b.ObjStart() - b.PutID("reportChatResultTextRequired") - b.Comma() - b.FieldStart("option_id") - b.PutBytes(r.OptionID) - b.Comma() - b.FieldStart("is_optional") - b.PutBool(r.IsOptional) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatResultTextRequired) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultTextRequired#8bcc30c1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChatResultTextRequired"); err != nil { - return fmt.Errorf("unable to decode reportChatResultTextRequired#8bcc30c1: %w", err) - } - case "option_id": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportChatResultTextRequired#8bcc30c1: field option_id: %w", err) - } - r.OptionID = value - case "is_optional": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode reportChatResultTextRequired#8bcc30c1: field is_optional: %w", err) - } - r.IsOptional = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOptionID returns value of OptionID field. -func (r *ReportChatResultTextRequired) GetOptionID() (value []byte) { - if r == nil { - return - } - return r.OptionID -} - -// GetIsOptional returns value of IsOptional field. -func (r *ReportChatResultTextRequired) GetIsOptional() (value bool) { - if r == nil { - return - } - return r.IsOptional -} - -// ReportChatResultMessagesRequired represents TL type `reportChatResultMessagesRequired#6521790`. -type ReportChatResultMessagesRequired struct { -} - -// ReportChatResultMessagesRequiredTypeID is TL type id of ReportChatResultMessagesRequired. -const ReportChatResultMessagesRequiredTypeID = 0x6521790 - -// construct implements constructor of ReportChatResultClass. -func (r ReportChatResultMessagesRequired) construct() ReportChatResultClass { return &r } - -// Ensuring interfaces in compile-time for ReportChatResultMessagesRequired. -var ( - _ bin.Encoder = &ReportChatResultMessagesRequired{} - _ bin.Decoder = &ReportChatResultMessagesRequired{} - _ bin.BareEncoder = &ReportChatResultMessagesRequired{} - _ bin.BareDecoder = &ReportChatResultMessagesRequired{} - - _ ReportChatResultClass = &ReportChatResultMessagesRequired{} -) - -func (r *ReportChatResultMessagesRequired) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatResultMessagesRequired) String() string { - if r == nil { - return "ReportChatResultMessagesRequired(nil)" - } - type Alias ReportChatResultMessagesRequired - return fmt.Sprintf("ReportChatResultMessagesRequired%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatResultMessagesRequired) TypeID() uint32 { - return ReportChatResultMessagesRequiredTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatResultMessagesRequired) TypeName() string { - return "reportChatResultMessagesRequired" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatResultMessagesRequired) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChatResultMessagesRequired", - ID: ReportChatResultMessagesRequiredTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatResultMessagesRequired) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultMessagesRequired#6521790 as nil") - } - b.PutID(ReportChatResultMessagesRequiredTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatResultMessagesRequired) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultMessagesRequired#6521790 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatResultMessagesRequired) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultMessagesRequired#6521790 to nil") - } - if err := b.ConsumeID(ReportChatResultMessagesRequiredTypeID); err != nil { - return fmt.Errorf("unable to decode reportChatResultMessagesRequired#6521790: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatResultMessagesRequired) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultMessagesRequired#6521790 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatResultMessagesRequired) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChatResultMessagesRequired#6521790 as nil") - } - b.ObjStart() - b.PutID("reportChatResultMessagesRequired") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatResultMessagesRequired) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChatResultMessagesRequired#6521790 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChatResultMessagesRequired"); err != nil { - return fmt.Errorf("unable to decode reportChatResultMessagesRequired#6521790: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportChatResultClassName is schema name of ReportChatResultClass. -const ReportChatResultClassName = "ReportChatResult" - -// ReportChatResultClass represents ReportChatResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeReportChatResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ReportChatResultOk: // reportChatResultOk#481a557d -// case *tdapi.ReportChatResultOptionRequired: // reportChatResultOptionRequired#2d89acaa -// case *tdapi.ReportChatResultTextRequired: // reportChatResultTextRequired#8bcc30c1 -// case *tdapi.ReportChatResultMessagesRequired: // reportChatResultMessagesRequired#6521790 -// default: panic(v) -// } -type ReportChatResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ReportChatResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeReportChatResult implements binary de-serialization for ReportChatResultClass. -func DecodeReportChatResult(buf *bin.Buffer) (ReportChatResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ReportChatResultOkTypeID: - // Decoding reportChatResultOk#481a557d. - v := ReportChatResultOk{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatResultClass: %w", err) - } - return &v, nil - case ReportChatResultOptionRequiredTypeID: - // Decoding reportChatResultOptionRequired#2d89acaa. - v := ReportChatResultOptionRequired{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatResultClass: %w", err) - } - return &v, nil - case ReportChatResultTextRequiredTypeID: - // Decoding reportChatResultTextRequired#8bcc30c1. - v := ReportChatResultTextRequired{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatResultClass: %w", err) - } - return &v, nil - case ReportChatResultMessagesRequiredTypeID: - // Decoding reportChatResultMessagesRequired#6521790. - v := ReportChatResultMessagesRequired{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReportChatResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONReportChatResult implements binary de-serialization for ReportChatResultClass. -func DecodeTDLibJSONReportChatResult(buf tdjson.Decoder) (ReportChatResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "reportChatResultOk": - // Decoding reportChatResultOk#481a557d. - v := ReportChatResultOk{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatResultClass: %w", err) - } - return &v, nil - case "reportChatResultOptionRequired": - // Decoding reportChatResultOptionRequired#2d89acaa. - v := ReportChatResultOptionRequired{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatResultClass: %w", err) - } - return &v, nil - case "reportChatResultTextRequired": - // Decoding reportChatResultTextRequired#8bcc30c1. - v := ReportChatResultTextRequired{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatResultClass: %w", err) - } - return &v, nil - case "reportChatResultMessagesRequired": - // Decoding reportChatResultMessagesRequired#6521790. - v := ReportChatResultMessagesRequired{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReportChatResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ReportChatResult boxes the ReportChatResultClass providing a helper. -type ReportChatResultBox struct { - ReportChatResult ReportChatResultClass -} - -// Decode implements bin.Decoder for ReportChatResultBox. -func (b *ReportChatResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ReportChatResultBox to nil") - } - v, err := DecodeReportChatResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReportChatResult = v - return nil -} - -// Encode implements bin.Encode for ReportChatResultBox. -func (b *ReportChatResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ReportChatResult == nil { - return fmt.Errorf("unable to encode ReportChatResultClass as nil") - } - return b.ReportChatResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ReportChatResultBox. -func (b *ReportChatResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ReportChatResultBox to nil") - } - v, err := DecodeTDLibJSONReportChatResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReportChatResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ReportChatResultBox. -func (b *ReportChatResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ReportChatResult == nil { - return fmt.Errorf("unable to encode ReportChatResultClass as nil") - } - return b.ReportChatResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_report_chat_sponsored_message_gen.go b/tdapi/tl_report_chat_sponsored_message_gen.go deleted file mode 100644 index 4ac58bb36..000000000 --- a/tdapi/tl_report_chat_sponsored_message_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportChatSponsoredMessageRequest represents TL type `reportChatSponsoredMessage#cc3e53be`. -type ReportChatSponsoredMessageRequest struct { - // Chat identifier of the sponsored message - ChatID int64 - // Identifier of the sponsored message - MessageID int64 - // Option identifier chosen by the user; leave empty for the initial request - OptionID []byte -} - -// ReportChatSponsoredMessageRequestTypeID is TL type id of ReportChatSponsoredMessageRequest. -const ReportChatSponsoredMessageRequestTypeID = 0xcc3e53be - -// Ensuring interfaces in compile-time for ReportChatSponsoredMessageRequest. -var ( - _ bin.Encoder = &ReportChatSponsoredMessageRequest{} - _ bin.Decoder = &ReportChatSponsoredMessageRequest{} - _ bin.BareEncoder = &ReportChatSponsoredMessageRequest{} - _ bin.BareDecoder = &ReportChatSponsoredMessageRequest{} -) - -func (r *ReportChatSponsoredMessageRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.MessageID == 0) { - return false - } - if !(r.OptionID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatSponsoredMessageRequest) String() string { - if r == nil { - return "ReportChatSponsoredMessageRequest(nil)" - } - type Alias ReportChatSponsoredMessageRequest - return fmt.Sprintf("ReportChatSponsoredMessageRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatSponsoredMessageRequest) TypeID() uint32 { - return ReportChatSponsoredMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatSponsoredMessageRequest) TypeName() string { - return "reportChatSponsoredMessage" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatSponsoredMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChatSponsoredMessage", - ID: ReportChatSponsoredMessageRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "OptionID", - SchemaName: "option_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatSponsoredMessageRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessage#cc3e53be as nil") - } - b.PutID(ReportChatSponsoredMessageRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatSponsoredMessageRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessage#cc3e53be as nil") - } - b.PutInt53(r.ChatID) - b.PutInt53(r.MessageID) - b.PutBytes(r.OptionID) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatSponsoredMessageRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessage#cc3e53be to nil") - } - if err := b.ConsumeID(ReportChatSponsoredMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessage#cc3e53be: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatSponsoredMessageRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessage#cc3e53be to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessage#cc3e53be: field chat_id: %w", err) - } - r.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessage#cc3e53be: field message_id: %w", err) - } - r.MessageID = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessage#cc3e53be: field option_id: %w", err) - } - r.OptionID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatSponsoredMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessage#cc3e53be as nil") - } - b.ObjStart() - b.PutID("reportChatSponsoredMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(r.MessageID) - b.Comma() - b.FieldStart("option_id") - b.PutBytes(r.OptionID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatSponsoredMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessage#cc3e53be to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChatSponsoredMessage"); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessage#cc3e53be: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessage#cc3e53be: field chat_id: %w", err) - } - r.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessage#cc3e53be: field message_id: %w", err) - } - r.MessageID = value - case "option_id": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessage#cc3e53be: field option_id: %w", err) - } - r.OptionID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *ReportChatSponsoredMessageRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetMessageID returns value of MessageID field. -func (r *ReportChatSponsoredMessageRequest) GetMessageID() (value int64) { - if r == nil { - return - } - return r.MessageID -} - -// GetOptionID returns value of OptionID field. -func (r *ReportChatSponsoredMessageRequest) GetOptionID() (value []byte) { - if r == nil { - return - } - return r.OptionID -} - -// ReportChatSponsoredMessage invokes method reportChatSponsoredMessage#cc3e53be returning error if any. -func (c *Client) ReportChatSponsoredMessage(ctx context.Context, request *ReportChatSponsoredMessageRequest) (ReportChatSponsoredMessageResultClass, error) { - var result ReportChatSponsoredMessageResultBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.ReportChatSponsoredMessageResult, nil -} diff --git a/tdapi/tl_report_chat_sponsored_message_result_gen.go b/tdapi/tl_report_chat_sponsored_message_result_gen.go deleted file mode 100644 index d26b849cb..000000000 --- a/tdapi/tl_report_chat_sponsored_message_result_gen.go +++ /dev/null @@ -1,976 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportChatSponsoredMessageResultOk represents TL type `reportChatSponsoredMessageResultOk#754f721f`. -type ReportChatSponsoredMessageResultOk struct { -} - -// ReportChatSponsoredMessageResultOkTypeID is TL type id of ReportChatSponsoredMessageResultOk. -const ReportChatSponsoredMessageResultOkTypeID = 0x754f721f - -// construct implements constructor of ReportChatSponsoredMessageResultClass. -func (r ReportChatSponsoredMessageResultOk) construct() ReportChatSponsoredMessageResultClass { - return &r -} - -// Ensuring interfaces in compile-time for ReportChatSponsoredMessageResultOk. -var ( - _ bin.Encoder = &ReportChatSponsoredMessageResultOk{} - _ bin.Decoder = &ReportChatSponsoredMessageResultOk{} - _ bin.BareEncoder = &ReportChatSponsoredMessageResultOk{} - _ bin.BareDecoder = &ReportChatSponsoredMessageResultOk{} - - _ ReportChatSponsoredMessageResultClass = &ReportChatSponsoredMessageResultOk{} -) - -func (r *ReportChatSponsoredMessageResultOk) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatSponsoredMessageResultOk) String() string { - if r == nil { - return "ReportChatSponsoredMessageResultOk(nil)" - } - type Alias ReportChatSponsoredMessageResultOk - return fmt.Sprintf("ReportChatSponsoredMessageResultOk%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatSponsoredMessageResultOk) TypeID() uint32 { - return ReportChatSponsoredMessageResultOkTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatSponsoredMessageResultOk) TypeName() string { - return "reportChatSponsoredMessageResultOk" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatSponsoredMessageResultOk) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChatSponsoredMessageResultOk", - ID: ReportChatSponsoredMessageResultOkTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatSponsoredMessageResultOk) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultOk#754f721f as nil") - } - b.PutID(ReportChatSponsoredMessageResultOkTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatSponsoredMessageResultOk) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultOk#754f721f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatSponsoredMessageResultOk) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultOk#754f721f to nil") - } - if err := b.ConsumeID(ReportChatSponsoredMessageResultOkTypeID); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultOk#754f721f: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatSponsoredMessageResultOk) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultOk#754f721f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatSponsoredMessageResultOk) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultOk#754f721f as nil") - } - b.ObjStart() - b.PutID("reportChatSponsoredMessageResultOk") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatSponsoredMessageResultOk) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultOk#754f721f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChatSponsoredMessageResultOk"); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultOk#754f721f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportChatSponsoredMessageResultFailed represents TL type `reportChatSponsoredMessageResultFailed#7f1f9bc6`. -type ReportChatSponsoredMessageResultFailed struct { -} - -// ReportChatSponsoredMessageResultFailedTypeID is TL type id of ReportChatSponsoredMessageResultFailed. -const ReportChatSponsoredMessageResultFailedTypeID = 0x7f1f9bc6 - -// construct implements constructor of ReportChatSponsoredMessageResultClass. -func (r ReportChatSponsoredMessageResultFailed) construct() ReportChatSponsoredMessageResultClass { - return &r -} - -// Ensuring interfaces in compile-time for ReportChatSponsoredMessageResultFailed. -var ( - _ bin.Encoder = &ReportChatSponsoredMessageResultFailed{} - _ bin.Decoder = &ReportChatSponsoredMessageResultFailed{} - _ bin.BareEncoder = &ReportChatSponsoredMessageResultFailed{} - _ bin.BareDecoder = &ReportChatSponsoredMessageResultFailed{} - - _ ReportChatSponsoredMessageResultClass = &ReportChatSponsoredMessageResultFailed{} -) - -func (r *ReportChatSponsoredMessageResultFailed) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatSponsoredMessageResultFailed) String() string { - if r == nil { - return "ReportChatSponsoredMessageResultFailed(nil)" - } - type Alias ReportChatSponsoredMessageResultFailed - return fmt.Sprintf("ReportChatSponsoredMessageResultFailed%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatSponsoredMessageResultFailed) TypeID() uint32 { - return ReportChatSponsoredMessageResultFailedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatSponsoredMessageResultFailed) TypeName() string { - return "reportChatSponsoredMessageResultFailed" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatSponsoredMessageResultFailed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChatSponsoredMessageResultFailed", - ID: ReportChatSponsoredMessageResultFailedTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatSponsoredMessageResultFailed) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultFailed#7f1f9bc6 as nil") - } - b.PutID(ReportChatSponsoredMessageResultFailedTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatSponsoredMessageResultFailed) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultFailed#7f1f9bc6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatSponsoredMessageResultFailed) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultFailed#7f1f9bc6 to nil") - } - if err := b.ConsumeID(ReportChatSponsoredMessageResultFailedTypeID); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultFailed#7f1f9bc6: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatSponsoredMessageResultFailed) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultFailed#7f1f9bc6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatSponsoredMessageResultFailed) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultFailed#7f1f9bc6 as nil") - } - b.ObjStart() - b.PutID("reportChatSponsoredMessageResultFailed") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatSponsoredMessageResultFailed) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultFailed#7f1f9bc6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChatSponsoredMessageResultFailed"); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultFailed#7f1f9bc6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportChatSponsoredMessageResultOptionRequired represents TL type `reportChatSponsoredMessageResultOptionRequired#34fc24b2`. -type ReportChatSponsoredMessageResultOptionRequired struct { - // Title for the option choice - Title string - // List of available options - Options []ReportOption -} - -// ReportChatSponsoredMessageResultOptionRequiredTypeID is TL type id of ReportChatSponsoredMessageResultOptionRequired. -const ReportChatSponsoredMessageResultOptionRequiredTypeID = 0x34fc24b2 - -// construct implements constructor of ReportChatSponsoredMessageResultClass. -func (r ReportChatSponsoredMessageResultOptionRequired) construct() ReportChatSponsoredMessageResultClass { - return &r -} - -// Ensuring interfaces in compile-time for ReportChatSponsoredMessageResultOptionRequired. -var ( - _ bin.Encoder = &ReportChatSponsoredMessageResultOptionRequired{} - _ bin.Decoder = &ReportChatSponsoredMessageResultOptionRequired{} - _ bin.BareEncoder = &ReportChatSponsoredMessageResultOptionRequired{} - _ bin.BareDecoder = &ReportChatSponsoredMessageResultOptionRequired{} - - _ ReportChatSponsoredMessageResultClass = &ReportChatSponsoredMessageResultOptionRequired{} -) - -func (r *ReportChatSponsoredMessageResultOptionRequired) Zero() bool { - if r == nil { - return true - } - if !(r.Title == "") { - return false - } - if !(r.Options == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatSponsoredMessageResultOptionRequired) String() string { - if r == nil { - return "ReportChatSponsoredMessageResultOptionRequired(nil)" - } - type Alias ReportChatSponsoredMessageResultOptionRequired - return fmt.Sprintf("ReportChatSponsoredMessageResultOptionRequired%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatSponsoredMessageResultOptionRequired) TypeID() uint32 { - return ReportChatSponsoredMessageResultOptionRequiredTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatSponsoredMessageResultOptionRequired) TypeName() string { - return "reportChatSponsoredMessageResultOptionRequired" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatSponsoredMessageResultOptionRequired) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChatSponsoredMessageResultOptionRequired", - ID: ReportChatSponsoredMessageResultOptionRequiredTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Options", - SchemaName: "options", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatSponsoredMessageResultOptionRequired) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultOptionRequired#34fc24b2 as nil") - } - b.PutID(ReportChatSponsoredMessageResultOptionRequiredTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatSponsoredMessageResultOptionRequired) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultOptionRequired#34fc24b2 as nil") - } - b.PutString(r.Title) - b.PutInt(len(r.Options)) - for idx, v := range r.Options { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare reportChatSponsoredMessageResultOptionRequired#34fc24b2: field options element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatSponsoredMessageResultOptionRequired) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultOptionRequired#34fc24b2 to nil") - } - if err := b.ConsumeID(ReportChatSponsoredMessageResultOptionRequiredTypeID); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultOptionRequired#34fc24b2: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatSponsoredMessageResultOptionRequired) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultOptionRequired#34fc24b2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultOptionRequired#34fc24b2: field title: %w", err) - } - r.Title = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultOptionRequired#34fc24b2: field options: %w", err) - } - - if headerLen > 0 { - r.Options = make([]ReportOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ReportOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare reportChatSponsoredMessageResultOptionRequired#34fc24b2: field options: %w", err) - } - r.Options = append(r.Options, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatSponsoredMessageResultOptionRequired) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultOptionRequired#34fc24b2 as nil") - } - b.ObjStart() - b.PutID("reportChatSponsoredMessageResultOptionRequired") - b.Comma() - b.FieldStart("title") - b.PutString(r.Title) - b.Comma() - b.FieldStart("options") - b.ArrStart() - for idx, v := range r.Options { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode reportChatSponsoredMessageResultOptionRequired#34fc24b2: field options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatSponsoredMessageResultOptionRequired) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultOptionRequired#34fc24b2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChatSponsoredMessageResultOptionRequired"); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultOptionRequired#34fc24b2: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultOptionRequired#34fc24b2: field title: %w", err) - } - r.Title = value - case "options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ReportOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultOptionRequired#34fc24b2: field options: %w", err) - } - r.Options = append(r.Options, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultOptionRequired#34fc24b2: field options: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (r *ReportChatSponsoredMessageResultOptionRequired) GetTitle() (value string) { - if r == nil { - return - } - return r.Title -} - -// GetOptions returns value of Options field. -func (r *ReportChatSponsoredMessageResultOptionRequired) GetOptions() (value []ReportOption) { - if r == nil { - return - } - return r.Options -} - -// ReportChatSponsoredMessageResultAdsHidden represents TL type `reportChatSponsoredMessageResultAdsHidden#e8eade1e`. -type ReportChatSponsoredMessageResultAdsHidden struct { -} - -// ReportChatSponsoredMessageResultAdsHiddenTypeID is TL type id of ReportChatSponsoredMessageResultAdsHidden. -const ReportChatSponsoredMessageResultAdsHiddenTypeID = 0xe8eade1e - -// construct implements constructor of ReportChatSponsoredMessageResultClass. -func (r ReportChatSponsoredMessageResultAdsHidden) construct() ReportChatSponsoredMessageResultClass { - return &r -} - -// Ensuring interfaces in compile-time for ReportChatSponsoredMessageResultAdsHidden. -var ( - _ bin.Encoder = &ReportChatSponsoredMessageResultAdsHidden{} - _ bin.Decoder = &ReportChatSponsoredMessageResultAdsHidden{} - _ bin.BareEncoder = &ReportChatSponsoredMessageResultAdsHidden{} - _ bin.BareDecoder = &ReportChatSponsoredMessageResultAdsHidden{} - - _ ReportChatSponsoredMessageResultClass = &ReportChatSponsoredMessageResultAdsHidden{} -) - -func (r *ReportChatSponsoredMessageResultAdsHidden) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatSponsoredMessageResultAdsHidden) String() string { - if r == nil { - return "ReportChatSponsoredMessageResultAdsHidden(nil)" - } - type Alias ReportChatSponsoredMessageResultAdsHidden - return fmt.Sprintf("ReportChatSponsoredMessageResultAdsHidden%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatSponsoredMessageResultAdsHidden) TypeID() uint32 { - return ReportChatSponsoredMessageResultAdsHiddenTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatSponsoredMessageResultAdsHidden) TypeName() string { - return "reportChatSponsoredMessageResultAdsHidden" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatSponsoredMessageResultAdsHidden) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChatSponsoredMessageResultAdsHidden", - ID: ReportChatSponsoredMessageResultAdsHiddenTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatSponsoredMessageResultAdsHidden) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultAdsHidden#e8eade1e as nil") - } - b.PutID(ReportChatSponsoredMessageResultAdsHiddenTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatSponsoredMessageResultAdsHidden) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultAdsHidden#e8eade1e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatSponsoredMessageResultAdsHidden) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultAdsHidden#e8eade1e to nil") - } - if err := b.ConsumeID(ReportChatSponsoredMessageResultAdsHiddenTypeID); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultAdsHidden#e8eade1e: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatSponsoredMessageResultAdsHidden) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultAdsHidden#e8eade1e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatSponsoredMessageResultAdsHidden) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultAdsHidden#e8eade1e as nil") - } - b.ObjStart() - b.PutID("reportChatSponsoredMessageResultAdsHidden") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatSponsoredMessageResultAdsHidden) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultAdsHidden#e8eade1e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChatSponsoredMessageResultAdsHidden"); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultAdsHidden#e8eade1e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportChatSponsoredMessageResultPremiumRequired represents TL type `reportChatSponsoredMessageResultPremiumRequired#770c2ed0`. -type ReportChatSponsoredMessageResultPremiumRequired struct { -} - -// ReportChatSponsoredMessageResultPremiumRequiredTypeID is TL type id of ReportChatSponsoredMessageResultPremiumRequired. -const ReportChatSponsoredMessageResultPremiumRequiredTypeID = 0x770c2ed0 - -// construct implements constructor of ReportChatSponsoredMessageResultClass. -func (r ReportChatSponsoredMessageResultPremiumRequired) construct() ReportChatSponsoredMessageResultClass { - return &r -} - -// Ensuring interfaces in compile-time for ReportChatSponsoredMessageResultPremiumRequired. -var ( - _ bin.Encoder = &ReportChatSponsoredMessageResultPremiumRequired{} - _ bin.Decoder = &ReportChatSponsoredMessageResultPremiumRequired{} - _ bin.BareEncoder = &ReportChatSponsoredMessageResultPremiumRequired{} - _ bin.BareDecoder = &ReportChatSponsoredMessageResultPremiumRequired{} - - _ ReportChatSponsoredMessageResultClass = &ReportChatSponsoredMessageResultPremiumRequired{} -) - -func (r *ReportChatSponsoredMessageResultPremiumRequired) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportChatSponsoredMessageResultPremiumRequired) String() string { - if r == nil { - return "ReportChatSponsoredMessageResultPremiumRequired(nil)" - } - type Alias ReportChatSponsoredMessageResultPremiumRequired - return fmt.Sprintf("ReportChatSponsoredMessageResultPremiumRequired%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportChatSponsoredMessageResultPremiumRequired) TypeID() uint32 { - return ReportChatSponsoredMessageResultPremiumRequiredTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportChatSponsoredMessageResultPremiumRequired) TypeName() string { - return "reportChatSponsoredMessageResultPremiumRequired" -} - -// TypeInfo returns info about TL type. -func (r *ReportChatSponsoredMessageResultPremiumRequired) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportChatSponsoredMessageResultPremiumRequired", - ID: ReportChatSponsoredMessageResultPremiumRequiredTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportChatSponsoredMessageResultPremiumRequired) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultPremiumRequired#770c2ed0 as nil") - } - b.PutID(ReportChatSponsoredMessageResultPremiumRequiredTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportChatSponsoredMessageResultPremiumRequired) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultPremiumRequired#770c2ed0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportChatSponsoredMessageResultPremiumRequired) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultPremiumRequired#770c2ed0 to nil") - } - if err := b.ConsumeID(ReportChatSponsoredMessageResultPremiumRequiredTypeID); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultPremiumRequired#770c2ed0: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportChatSponsoredMessageResultPremiumRequired) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultPremiumRequired#770c2ed0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportChatSponsoredMessageResultPremiumRequired) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportChatSponsoredMessageResultPremiumRequired#770c2ed0 as nil") - } - b.ObjStart() - b.PutID("reportChatSponsoredMessageResultPremiumRequired") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportChatSponsoredMessageResultPremiumRequired) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportChatSponsoredMessageResultPremiumRequired#770c2ed0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportChatSponsoredMessageResultPremiumRequired"); err != nil { - return fmt.Errorf("unable to decode reportChatSponsoredMessageResultPremiumRequired#770c2ed0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportChatSponsoredMessageResultClassName is schema name of ReportChatSponsoredMessageResultClass. -const ReportChatSponsoredMessageResultClassName = "ReportChatSponsoredMessageResult" - -// ReportChatSponsoredMessageResultClass represents ReportChatSponsoredMessageResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeReportChatSponsoredMessageResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ReportChatSponsoredMessageResultOk: // reportChatSponsoredMessageResultOk#754f721f -// case *tdapi.ReportChatSponsoredMessageResultFailed: // reportChatSponsoredMessageResultFailed#7f1f9bc6 -// case *tdapi.ReportChatSponsoredMessageResultOptionRequired: // reportChatSponsoredMessageResultOptionRequired#34fc24b2 -// case *tdapi.ReportChatSponsoredMessageResultAdsHidden: // reportChatSponsoredMessageResultAdsHidden#e8eade1e -// case *tdapi.ReportChatSponsoredMessageResultPremiumRequired: // reportChatSponsoredMessageResultPremiumRequired#770c2ed0 -// default: panic(v) -// } -type ReportChatSponsoredMessageResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ReportChatSponsoredMessageResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeReportChatSponsoredMessageResult implements binary de-serialization for ReportChatSponsoredMessageResultClass. -func DecodeReportChatSponsoredMessageResult(buf *bin.Buffer) (ReportChatSponsoredMessageResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ReportChatSponsoredMessageResultOkTypeID: - // Decoding reportChatSponsoredMessageResultOk#754f721f. - v := ReportChatSponsoredMessageResultOk{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", err) - } - return &v, nil - case ReportChatSponsoredMessageResultFailedTypeID: - // Decoding reportChatSponsoredMessageResultFailed#7f1f9bc6. - v := ReportChatSponsoredMessageResultFailed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", err) - } - return &v, nil - case ReportChatSponsoredMessageResultOptionRequiredTypeID: - // Decoding reportChatSponsoredMessageResultOptionRequired#34fc24b2. - v := ReportChatSponsoredMessageResultOptionRequired{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", err) - } - return &v, nil - case ReportChatSponsoredMessageResultAdsHiddenTypeID: - // Decoding reportChatSponsoredMessageResultAdsHidden#e8eade1e. - v := ReportChatSponsoredMessageResultAdsHidden{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", err) - } - return &v, nil - case ReportChatSponsoredMessageResultPremiumRequiredTypeID: - // Decoding reportChatSponsoredMessageResultPremiumRequired#770c2ed0. - v := ReportChatSponsoredMessageResultPremiumRequired{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONReportChatSponsoredMessageResult implements binary de-serialization for ReportChatSponsoredMessageResultClass. -func DecodeTDLibJSONReportChatSponsoredMessageResult(buf tdjson.Decoder) (ReportChatSponsoredMessageResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "reportChatSponsoredMessageResultOk": - // Decoding reportChatSponsoredMessageResultOk#754f721f. - v := ReportChatSponsoredMessageResultOk{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", err) - } - return &v, nil - case "reportChatSponsoredMessageResultFailed": - // Decoding reportChatSponsoredMessageResultFailed#7f1f9bc6. - v := ReportChatSponsoredMessageResultFailed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", err) - } - return &v, nil - case "reportChatSponsoredMessageResultOptionRequired": - // Decoding reportChatSponsoredMessageResultOptionRequired#34fc24b2. - v := ReportChatSponsoredMessageResultOptionRequired{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", err) - } - return &v, nil - case "reportChatSponsoredMessageResultAdsHidden": - // Decoding reportChatSponsoredMessageResultAdsHidden#e8eade1e. - v := ReportChatSponsoredMessageResultAdsHidden{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", err) - } - return &v, nil - case "reportChatSponsoredMessageResultPremiumRequired": - // Decoding reportChatSponsoredMessageResultPremiumRequired#770c2ed0. - v := ReportChatSponsoredMessageResultPremiumRequired{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReportChatSponsoredMessageResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ReportChatSponsoredMessageResult boxes the ReportChatSponsoredMessageResultClass providing a helper. -type ReportChatSponsoredMessageResultBox struct { - ReportChatSponsoredMessageResult ReportChatSponsoredMessageResultClass -} - -// Decode implements bin.Decoder for ReportChatSponsoredMessageResultBox. -func (b *ReportChatSponsoredMessageResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ReportChatSponsoredMessageResultBox to nil") - } - v, err := DecodeReportChatSponsoredMessageResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReportChatSponsoredMessageResult = v - return nil -} - -// Encode implements bin.Encode for ReportChatSponsoredMessageResultBox. -func (b *ReportChatSponsoredMessageResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ReportChatSponsoredMessageResult == nil { - return fmt.Errorf("unable to encode ReportChatSponsoredMessageResultClass as nil") - } - return b.ReportChatSponsoredMessageResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ReportChatSponsoredMessageResultBox. -func (b *ReportChatSponsoredMessageResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ReportChatSponsoredMessageResultBox to nil") - } - v, err := DecodeTDLibJSONReportChatSponsoredMessageResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReportChatSponsoredMessageResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ReportChatSponsoredMessageResultBox. -func (b *ReportChatSponsoredMessageResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ReportChatSponsoredMessageResult == nil { - return fmt.Errorf("unable to encode ReportChatSponsoredMessageResultClass as nil") - } - return b.ReportChatSponsoredMessageResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_report_message_reactions_gen.go b/tdapi/tl_report_message_reactions_gen.go deleted file mode 100644 index 63794eba1..000000000 --- a/tdapi/tl_report_message_reactions_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportMessageReactionsRequest represents TL type `reportMessageReactions#36c88827`. -type ReportMessageReactionsRequest struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 - // Identifier of the sender, which added the reaction - SenderID MessageSenderClass -} - -// ReportMessageReactionsRequestTypeID is TL type id of ReportMessageReactionsRequest. -const ReportMessageReactionsRequestTypeID = 0x36c88827 - -// Ensuring interfaces in compile-time for ReportMessageReactionsRequest. -var ( - _ bin.Encoder = &ReportMessageReactionsRequest{} - _ bin.Decoder = &ReportMessageReactionsRequest{} - _ bin.BareEncoder = &ReportMessageReactionsRequest{} - _ bin.BareDecoder = &ReportMessageReactionsRequest{} -) - -func (r *ReportMessageReactionsRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.MessageID == 0) { - return false - } - if !(r.SenderID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportMessageReactionsRequest) String() string { - if r == nil { - return "ReportMessageReactionsRequest(nil)" - } - type Alias ReportMessageReactionsRequest - return fmt.Sprintf("ReportMessageReactionsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportMessageReactionsRequest) TypeID() uint32 { - return ReportMessageReactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportMessageReactionsRequest) TypeName() string { - return "reportMessageReactions" -} - -// TypeInfo returns info about TL type. -func (r *ReportMessageReactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportMessageReactions", - ID: ReportMessageReactionsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "SenderID", - SchemaName: "sender_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportMessageReactionsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportMessageReactions#36c88827 as nil") - } - b.PutID(ReportMessageReactionsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportMessageReactionsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportMessageReactions#36c88827 as nil") - } - b.PutInt53(r.ChatID) - b.PutInt53(r.MessageID) - if r.SenderID == nil { - return fmt.Errorf("unable to encode reportMessageReactions#36c88827: field sender_id is nil") - } - if err := r.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode reportMessageReactions#36c88827: field sender_id: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportMessageReactionsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportMessageReactions#36c88827 to nil") - } - if err := b.ConsumeID(ReportMessageReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reportMessageReactions#36c88827: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportMessageReactionsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportMessageReactions#36c88827 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportMessageReactions#36c88827: field chat_id: %w", err) - } - r.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportMessageReactions#36c88827: field message_id: %w", err) - } - r.MessageID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode reportMessageReactions#36c88827: field sender_id: %w", err) - } - r.SenderID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportMessageReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportMessageReactions#36c88827 as nil") - } - b.ObjStart() - b.PutID("reportMessageReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(r.MessageID) - b.Comma() - b.FieldStart("sender_id") - if r.SenderID == nil { - return fmt.Errorf("unable to encode reportMessageReactions#36c88827: field sender_id is nil") - } - if err := r.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode reportMessageReactions#36c88827: field sender_id: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportMessageReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportMessageReactions#36c88827 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportMessageReactions"); err != nil { - return fmt.Errorf("unable to decode reportMessageReactions#36c88827: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportMessageReactions#36c88827: field chat_id: %w", err) - } - r.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportMessageReactions#36c88827: field message_id: %w", err) - } - r.MessageID = value - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode reportMessageReactions#36c88827: field sender_id: %w", err) - } - r.SenderID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *ReportMessageReactionsRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetMessageID returns value of MessageID field. -func (r *ReportMessageReactionsRequest) GetMessageID() (value int64) { - if r == nil { - return - } - return r.MessageID -} - -// GetSenderID returns value of SenderID field. -func (r *ReportMessageReactionsRequest) GetSenderID() (value MessageSenderClass) { - if r == nil { - return - } - return r.SenderID -} - -// ReportMessageReactions invokes method reportMessageReactions#36c88827 returning error if any. -func (c *Client) ReportMessageReactions(ctx context.Context, request *ReportMessageReactionsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_report_option_gen.go b/tdapi/tl_report_option_gen.go deleted file mode 100644 index 231f91dfc..000000000 --- a/tdapi/tl_report_option_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportOption represents TL type `reportOption#41f22c20`. -type ReportOption struct { - // Unique identifier of the option - ID []byte - // Text of the option - Text string -} - -// ReportOptionTypeID is TL type id of ReportOption. -const ReportOptionTypeID = 0x41f22c20 - -// Ensuring interfaces in compile-time for ReportOption. -var ( - _ bin.Encoder = &ReportOption{} - _ bin.Decoder = &ReportOption{} - _ bin.BareEncoder = &ReportOption{} - _ bin.BareDecoder = &ReportOption{} -) - -func (r *ReportOption) Zero() bool { - if r == nil { - return true - } - if !(r.ID == nil) { - return false - } - if !(r.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportOption) String() string { - if r == nil { - return "ReportOption(nil)" - } - type Alias ReportOption - return fmt.Sprintf("ReportOption%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportOption) TypeID() uint32 { - return ReportOptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportOption) TypeName() string { - return "reportOption" -} - -// TypeInfo returns info about TL type. -func (r *ReportOption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportOption", - ID: ReportOptionTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportOption) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportOption#41f22c20 as nil") - } - b.PutID(ReportOptionTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportOption) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportOption#41f22c20 as nil") - } - b.PutBytes(r.ID) - b.PutString(r.Text) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportOption) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportOption#41f22c20 to nil") - } - if err := b.ConsumeID(ReportOptionTypeID); err != nil { - return fmt.Errorf("unable to decode reportOption#41f22c20: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportOption) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportOption#41f22c20 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportOption#41f22c20: field id: %w", err) - } - r.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportOption#41f22c20: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportOption) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportOption#41f22c20 as nil") - } - b.ObjStart() - b.PutID("reportOption") - b.Comma() - b.FieldStart("id") - b.PutBytes(r.ID) - b.Comma() - b.FieldStart("text") - b.PutString(r.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportOption) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportOption#41f22c20 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportOption"); err != nil { - return fmt.Errorf("unable to decode reportOption#41f22c20: %w", err) - } - case "id": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportOption#41f22c20: field id: %w", err) - } - r.ID = value - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportOption#41f22c20: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (r *ReportOption) GetID() (value []byte) { - if r == nil { - return - } - return r.ID -} - -// GetText returns value of Text field. -func (r *ReportOption) GetText() (value string) { - if r == nil { - return - } - return r.Text -} diff --git a/tdapi/tl_report_phone_number_code_missing_gen.go b/tdapi/tl_report_phone_number_code_missing_gen.go deleted file mode 100644 index 1f35daceb..000000000 --- a/tdapi/tl_report_phone_number_code_missing_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportPhoneNumberCodeMissingRequest represents TL type `reportPhoneNumberCodeMissing#caa4b553`. -type ReportPhoneNumberCodeMissingRequest struct { - // Current mobile network code - MobileNetworkCode string -} - -// ReportPhoneNumberCodeMissingRequestTypeID is TL type id of ReportPhoneNumberCodeMissingRequest. -const ReportPhoneNumberCodeMissingRequestTypeID = 0xcaa4b553 - -// Ensuring interfaces in compile-time for ReportPhoneNumberCodeMissingRequest. -var ( - _ bin.Encoder = &ReportPhoneNumberCodeMissingRequest{} - _ bin.Decoder = &ReportPhoneNumberCodeMissingRequest{} - _ bin.BareEncoder = &ReportPhoneNumberCodeMissingRequest{} - _ bin.BareDecoder = &ReportPhoneNumberCodeMissingRequest{} -) - -func (r *ReportPhoneNumberCodeMissingRequest) Zero() bool { - if r == nil { - return true - } - if !(r.MobileNetworkCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportPhoneNumberCodeMissingRequest) String() string { - if r == nil { - return "ReportPhoneNumberCodeMissingRequest(nil)" - } - type Alias ReportPhoneNumberCodeMissingRequest - return fmt.Sprintf("ReportPhoneNumberCodeMissingRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportPhoneNumberCodeMissingRequest) TypeID() uint32 { - return ReportPhoneNumberCodeMissingRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportPhoneNumberCodeMissingRequest) TypeName() string { - return "reportPhoneNumberCodeMissing" -} - -// TypeInfo returns info about TL type. -func (r *ReportPhoneNumberCodeMissingRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportPhoneNumberCodeMissing", - ID: ReportPhoneNumberCodeMissingRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MobileNetworkCode", - SchemaName: "mobile_network_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportPhoneNumberCodeMissingRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportPhoneNumberCodeMissing#caa4b553 as nil") - } - b.PutID(ReportPhoneNumberCodeMissingRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportPhoneNumberCodeMissingRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportPhoneNumberCodeMissing#caa4b553 as nil") - } - b.PutString(r.MobileNetworkCode) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportPhoneNumberCodeMissingRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportPhoneNumberCodeMissing#caa4b553 to nil") - } - if err := b.ConsumeID(ReportPhoneNumberCodeMissingRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reportPhoneNumberCodeMissing#caa4b553: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportPhoneNumberCodeMissingRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportPhoneNumberCodeMissing#caa4b553 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportPhoneNumberCodeMissing#caa4b553: field mobile_network_code: %w", err) - } - r.MobileNetworkCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportPhoneNumberCodeMissingRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportPhoneNumberCodeMissing#caa4b553 as nil") - } - b.ObjStart() - b.PutID("reportPhoneNumberCodeMissing") - b.Comma() - b.FieldStart("mobile_network_code") - b.PutString(r.MobileNetworkCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportPhoneNumberCodeMissingRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportPhoneNumberCodeMissing#caa4b553 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportPhoneNumberCodeMissing"); err != nil { - return fmt.Errorf("unable to decode reportPhoneNumberCodeMissing#caa4b553: %w", err) - } - case "mobile_network_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportPhoneNumberCodeMissing#caa4b553: field mobile_network_code: %w", err) - } - r.MobileNetworkCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMobileNetworkCode returns value of MobileNetworkCode field. -func (r *ReportPhoneNumberCodeMissingRequest) GetMobileNetworkCode() (value string) { - if r == nil { - return - } - return r.MobileNetworkCode -} - -// ReportPhoneNumberCodeMissing invokes method reportPhoneNumberCodeMissing#caa4b553 returning error if any. -func (c *Client) ReportPhoneNumberCodeMissing(ctx context.Context, mobilenetworkcode string) error { - var ok Ok - - request := &ReportPhoneNumberCodeMissingRequest{ - MobileNetworkCode: mobilenetworkcode, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_report_reason_gen.go b/tdapi/tl_report_reason_gen.go deleted file mode 100644 index 602da1639..000000000 --- a/tdapi/tl_report_reason_gen.go +++ /dev/null @@ -1,1599 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportReasonSpam represents TL type `reportReasonSpam#b80e23bf`. -type ReportReasonSpam struct { -} - -// ReportReasonSpamTypeID is TL type id of ReportReasonSpam. -const ReportReasonSpamTypeID = 0xb80e23bf - -// construct implements constructor of ReportReasonClass. -func (r ReportReasonSpam) construct() ReportReasonClass { return &r } - -// Ensuring interfaces in compile-time for ReportReasonSpam. -var ( - _ bin.Encoder = &ReportReasonSpam{} - _ bin.Decoder = &ReportReasonSpam{} - _ bin.BareEncoder = &ReportReasonSpam{} - _ bin.BareDecoder = &ReportReasonSpam{} - - _ ReportReasonClass = &ReportReasonSpam{} -) - -func (r *ReportReasonSpam) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportReasonSpam) String() string { - if r == nil { - return "ReportReasonSpam(nil)" - } - type Alias ReportReasonSpam - return fmt.Sprintf("ReportReasonSpam%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportReasonSpam) TypeID() uint32 { - return ReportReasonSpamTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportReasonSpam) TypeName() string { - return "reportReasonSpam" -} - -// TypeInfo returns info about TL type. -func (r *ReportReasonSpam) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportReasonSpam", - ID: ReportReasonSpamTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportReasonSpam) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonSpam#b80e23bf as nil") - } - b.PutID(ReportReasonSpamTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportReasonSpam) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonSpam#b80e23bf as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportReasonSpam) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonSpam#b80e23bf to nil") - } - if err := b.ConsumeID(ReportReasonSpamTypeID); err != nil { - return fmt.Errorf("unable to decode reportReasonSpam#b80e23bf: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportReasonSpam) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonSpam#b80e23bf to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportReasonSpam) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonSpam#b80e23bf as nil") - } - b.ObjStart() - b.PutID("reportReasonSpam") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportReasonSpam) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonSpam#b80e23bf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportReasonSpam"); err != nil { - return fmt.Errorf("unable to decode reportReasonSpam#b80e23bf: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportReasonViolence represents TL type `reportReasonViolence#7983c739`. -type ReportReasonViolence struct { -} - -// ReportReasonViolenceTypeID is TL type id of ReportReasonViolence. -const ReportReasonViolenceTypeID = 0x7983c739 - -// construct implements constructor of ReportReasonClass. -func (r ReportReasonViolence) construct() ReportReasonClass { return &r } - -// Ensuring interfaces in compile-time for ReportReasonViolence. -var ( - _ bin.Encoder = &ReportReasonViolence{} - _ bin.Decoder = &ReportReasonViolence{} - _ bin.BareEncoder = &ReportReasonViolence{} - _ bin.BareDecoder = &ReportReasonViolence{} - - _ ReportReasonClass = &ReportReasonViolence{} -) - -func (r *ReportReasonViolence) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportReasonViolence) String() string { - if r == nil { - return "ReportReasonViolence(nil)" - } - type Alias ReportReasonViolence - return fmt.Sprintf("ReportReasonViolence%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportReasonViolence) TypeID() uint32 { - return ReportReasonViolenceTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportReasonViolence) TypeName() string { - return "reportReasonViolence" -} - -// TypeInfo returns info about TL type. -func (r *ReportReasonViolence) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportReasonViolence", - ID: ReportReasonViolenceTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportReasonViolence) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonViolence#7983c739 as nil") - } - b.PutID(ReportReasonViolenceTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportReasonViolence) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonViolence#7983c739 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportReasonViolence) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonViolence#7983c739 to nil") - } - if err := b.ConsumeID(ReportReasonViolenceTypeID); err != nil { - return fmt.Errorf("unable to decode reportReasonViolence#7983c739: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportReasonViolence) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonViolence#7983c739 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportReasonViolence) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonViolence#7983c739 as nil") - } - b.ObjStart() - b.PutID("reportReasonViolence") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportReasonViolence) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonViolence#7983c739 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportReasonViolence"); err != nil { - return fmt.Errorf("unable to decode reportReasonViolence#7983c739: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportReasonPornography represents TL type `reportReasonPornography#4ddf1cf7`. -type ReportReasonPornography struct { -} - -// ReportReasonPornographyTypeID is TL type id of ReportReasonPornography. -const ReportReasonPornographyTypeID = 0x4ddf1cf7 - -// construct implements constructor of ReportReasonClass. -func (r ReportReasonPornography) construct() ReportReasonClass { return &r } - -// Ensuring interfaces in compile-time for ReportReasonPornography. -var ( - _ bin.Encoder = &ReportReasonPornography{} - _ bin.Decoder = &ReportReasonPornography{} - _ bin.BareEncoder = &ReportReasonPornography{} - _ bin.BareDecoder = &ReportReasonPornography{} - - _ ReportReasonClass = &ReportReasonPornography{} -) - -func (r *ReportReasonPornography) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportReasonPornography) String() string { - if r == nil { - return "ReportReasonPornography(nil)" - } - type Alias ReportReasonPornography - return fmt.Sprintf("ReportReasonPornography%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportReasonPornography) TypeID() uint32 { - return ReportReasonPornographyTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportReasonPornography) TypeName() string { - return "reportReasonPornography" -} - -// TypeInfo returns info about TL type. -func (r *ReportReasonPornography) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportReasonPornography", - ID: ReportReasonPornographyTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportReasonPornography) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonPornography#4ddf1cf7 as nil") - } - b.PutID(ReportReasonPornographyTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportReasonPornography) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonPornography#4ddf1cf7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportReasonPornography) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonPornography#4ddf1cf7 to nil") - } - if err := b.ConsumeID(ReportReasonPornographyTypeID); err != nil { - return fmt.Errorf("unable to decode reportReasonPornography#4ddf1cf7: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportReasonPornography) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonPornography#4ddf1cf7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportReasonPornography) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonPornography#4ddf1cf7 as nil") - } - b.ObjStart() - b.PutID("reportReasonPornography") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportReasonPornography) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonPornography#4ddf1cf7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportReasonPornography"); err != nil { - return fmt.Errorf("unable to decode reportReasonPornography#4ddf1cf7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportReasonChildAbuse represents TL type `reportReasonChildAbuse#2d5d42fe`. -type ReportReasonChildAbuse struct { -} - -// ReportReasonChildAbuseTypeID is TL type id of ReportReasonChildAbuse. -const ReportReasonChildAbuseTypeID = 0x2d5d42fe - -// construct implements constructor of ReportReasonClass. -func (r ReportReasonChildAbuse) construct() ReportReasonClass { return &r } - -// Ensuring interfaces in compile-time for ReportReasonChildAbuse. -var ( - _ bin.Encoder = &ReportReasonChildAbuse{} - _ bin.Decoder = &ReportReasonChildAbuse{} - _ bin.BareEncoder = &ReportReasonChildAbuse{} - _ bin.BareDecoder = &ReportReasonChildAbuse{} - - _ ReportReasonClass = &ReportReasonChildAbuse{} -) - -func (r *ReportReasonChildAbuse) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportReasonChildAbuse) String() string { - if r == nil { - return "ReportReasonChildAbuse(nil)" - } - type Alias ReportReasonChildAbuse - return fmt.Sprintf("ReportReasonChildAbuse%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportReasonChildAbuse) TypeID() uint32 { - return ReportReasonChildAbuseTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportReasonChildAbuse) TypeName() string { - return "reportReasonChildAbuse" -} - -// TypeInfo returns info about TL type. -func (r *ReportReasonChildAbuse) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportReasonChildAbuse", - ID: ReportReasonChildAbuseTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportReasonChildAbuse) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonChildAbuse#2d5d42fe as nil") - } - b.PutID(ReportReasonChildAbuseTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportReasonChildAbuse) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonChildAbuse#2d5d42fe as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportReasonChildAbuse) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonChildAbuse#2d5d42fe to nil") - } - if err := b.ConsumeID(ReportReasonChildAbuseTypeID); err != nil { - return fmt.Errorf("unable to decode reportReasonChildAbuse#2d5d42fe: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportReasonChildAbuse) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonChildAbuse#2d5d42fe to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportReasonChildAbuse) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonChildAbuse#2d5d42fe as nil") - } - b.ObjStart() - b.PutID("reportReasonChildAbuse") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportReasonChildAbuse) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonChildAbuse#2d5d42fe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportReasonChildAbuse"); err != nil { - return fmt.Errorf("unable to decode reportReasonChildAbuse#2d5d42fe: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportReasonCopyright represents TL type `reportReasonCopyright#57e22faf`. -type ReportReasonCopyright struct { -} - -// ReportReasonCopyrightTypeID is TL type id of ReportReasonCopyright. -const ReportReasonCopyrightTypeID = 0x57e22faf - -// construct implements constructor of ReportReasonClass. -func (r ReportReasonCopyright) construct() ReportReasonClass { return &r } - -// Ensuring interfaces in compile-time for ReportReasonCopyright. -var ( - _ bin.Encoder = &ReportReasonCopyright{} - _ bin.Decoder = &ReportReasonCopyright{} - _ bin.BareEncoder = &ReportReasonCopyright{} - _ bin.BareDecoder = &ReportReasonCopyright{} - - _ ReportReasonClass = &ReportReasonCopyright{} -) - -func (r *ReportReasonCopyright) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportReasonCopyright) String() string { - if r == nil { - return "ReportReasonCopyright(nil)" - } - type Alias ReportReasonCopyright - return fmt.Sprintf("ReportReasonCopyright%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportReasonCopyright) TypeID() uint32 { - return ReportReasonCopyrightTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportReasonCopyright) TypeName() string { - return "reportReasonCopyright" -} - -// TypeInfo returns info about TL type. -func (r *ReportReasonCopyright) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportReasonCopyright", - ID: ReportReasonCopyrightTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportReasonCopyright) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonCopyright#57e22faf as nil") - } - b.PutID(ReportReasonCopyrightTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportReasonCopyright) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonCopyright#57e22faf as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportReasonCopyright) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonCopyright#57e22faf to nil") - } - if err := b.ConsumeID(ReportReasonCopyrightTypeID); err != nil { - return fmt.Errorf("unable to decode reportReasonCopyright#57e22faf: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportReasonCopyright) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonCopyright#57e22faf to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportReasonCopyright) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonCopyright#57e22faf as nil") - } - b.ObjStart() - b.PutID("reportReasonCopyright") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportReasonCopyright) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonCopyright#57e22faf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportReasonCopyright"); err != nil { - return fmt.Errorf("unable to decode reportReasonCopyright#57e22faf: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportReasonUnrelatedLocation represents TL type `reportReasonUnrelatedLocation#5381830`. -type ReportReasonUnrelatedLocation struct { -} - -// ReportReasonUnrelatedLocationTypeID is TL type id of ReportReasonUnrelatedLocation. -const ReportReasonUnrelatedLocationTypeID = 0x5381830 - -// construct implements constructor of ReportReasonClass. -func (r ReportReasonUnrelatedLocation) construct() ReportReasonClass { return &r } - -// Ensuring interfaces in compile-time for ReportReasonUnrelatedLocation. -var ( - _ bin.Encoder = &ReportReasonUnrelatedLocation{} - _ bin.Decoder = &ReportReasonUnrelatedLocation{} - _ bin.BareEncoder = &ReportReasonUnrelatedLocation{} - _ bin.BareDecoder = &ReportReasonUnrelatedLocation{} - - _ ReportReasonClass = &ReportReasonUnrelatedLocation{} -) - -func (r *ReportReasonUnrelatedLocation) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportReasonUnrelatedLocation) String() string { - if r == nil { - return "ReportReasonUnrelatedLocation(nil)" - } - type Alias ReportReasonUnrelatedLocation - return fmt.Sprintf("ReportReasonUnrelatedLocation%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportReasonUnrelatedLocation) TypeID() uint32 { - return ReportReasonUnrelatedLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportReasonUnrelatedLocation) TypeName() string { - return "reportReasonUnrelatedLocation" -} - -// TypeInfo returns info about TL type. -func (r *ReportReasonUnrelatedLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportReasonUnrelatedLocation", - ID: ReportReasonUnrelatedLocationTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportReasonUnrelatedLocation) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonUnrelatedLocation#5381830 as nil") - } - b.PutID(ReportReasonUnrelatedLocationTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportReasonUnrelatedLocation) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonUnrelatedLocation#5381830 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportReasonUnrelatedLocation) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonUnrelatedLocation#5381830 to nil") - } - if err := b.ConsumeID(ReportReasonUnrelatedLocationTypeID); err != nil { - return fmt.Errorf("unable to decode reportReasonUnrelatedLocation#5381830: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportReasonUnrelatedLocation) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonUnrelatedLocation#5381830 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportReasonUnrelatedLocation) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonUnrelatedLocation#5381830 as nil") - } - b.ObjStart() - b.PutID("reportReasonUnrelatedLocation") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportReasonUnrelatedLocation) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonUnrelatedLocation#5381830 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportReasonUnrelatedLocation"); err != nil { - return fmt.Errorf("unable to decode reportReasonUnrelatedLocation#5381830: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportReasonFake represents TL type `reportReasonFake#15083fe0`. -type ReportReasonFake struct { -} - -// ReportReasonFakeTypeID is TL type id of ReportReasonFake. -const ReportReasonFakeTypeID = 0x15083fe0 - -// construct implements constructor of ReportReasonClass. -func (r ReportReasonFake) construct() ReportReasonClass { return &r } - -// Ensuring interfaces in compile-time for ReportReasonFake. -var ( - _ bin.Encoder = &ReportReasonFake{} - _ bin.Decoder = &ReportReasonFake{} - _ bin.BareEncoder = &ReportReasonFake{} - _ bin.BareDecoder = &ReportReasonFake{} - - _ ReportReasonClass = &ReportReasonFake{} -) - -func (r *ReportReasonFake) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportReasonFake) String() string { - if r == nil { - return "ReportReasonFake(nil)" - } - type Alias ReportReasonFake - return fmt.Sprintf("ReportReasonFake%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportReasonFake) TypeID() uint32 { - return ReportReasonFakeTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportReasonFake) TypeName() string { - return "reportReasonFake" -} - -// TypeInfo returns info about TL type. -func (r *ReportReasonFake) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportReasonFake", - ID: ReportReasonFakeTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportReasonFake) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonFake#15083fe0 as nil") - } - b.PutID(ReportReasonFakeTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportReasonFake) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonFake#15083fe0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportReasonFake) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonFake#15083fe0 to nil") - } - if err := b.ConsumeID(ReportReasonFakeTypeID); err != nil { - return fmt.Errorf("unable to decode reportReasonFake#15083fe0: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportReasonFake) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonFake#15083fe0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportReasonFake) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonFake#15083fe0 as nil") - } - b.ObjStart() - b.PutID("reportReasonFake") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportReasonFake) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonFake#15083fe0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportReasonFake"); err != nil { - return fmt.Errorf("unable to decode reportReasonFake#15083fe0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportReasonIllegalDrugs represents TL type `reportReasonIllegalDrugs#fc541220`. -type ReportReasonIllegalDrugs struct { -} - -// ReportReasonIllegalDrugsTypeID is TL type id of ReportReasonIllegalDrugs. -const ReportReasonIllegalDrugsTypeID = 0xfc541220 - -// construct implements constructor of ReportReasonClass. -func (r ReportReasonIllegalDrugs) construct() ReportReasonClass { return &r } - -// Ensuring interfaces in compile-time for ReportReasonIllegalDrugs. -var ( - _ bin.Encoder = &ReportReasonIllegalDrugs{} - _ bin.Decoder = &ReportReasonIllegalDrugs{} - _ bin.BareEncoder = &ReportReasonIllegalDrugs{} - _ bin.BareDecoder = &ReportReasonIllegalDrugs{} - - _ ReportReasonClass = &ReportReasonIllegalDrugs{} -) - -func (r *ReportReasonIllegalDrugs) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportReasonIllegalDrugs) String() string { - if r == nil { - return "ReportReasonIllegalDrugs(nil)" - } - type Alias ReportReasonIllegalDrugs - return fmt.Sprintf("ReportReasonIllegalDrugs%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportReasonIllegalDrugs) TypeID() uint32 { - return ReportReasonIllegalDrugsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportReasonIllegalDrugs) TypeName() string { - return "reportReasonIllegalDrugs" -} - -// TypeInfo returns info about TL type. -func (r *ReportReasonIllegalDrugs) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportReasonIllegalDrugs", - ID: ReportReasonIllegalDrugsTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportReasonIllegalDrugs) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonIllegalDrugs#fc541220 as nil") - } - b.PutID(ReportReasonIllegalDrugsTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportReasonIllegalDrugs) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonIllegalDrugs#fc541220 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportReasonIllegalDrugs) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonIllegalDrugs#fc541220 to nil") - } - if err := b.ConsumeID(ReportReasonIllegalDrugsTypeID); err != nil { - return fmt.Errorf("unable to decode reportReasonIllegalDrugs#fc541220: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportReasonIllegalDrugs) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonIllegalDrugs#fc541220 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportReasonIllegalDrugs) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonIllegalDrugs#fc541220 as nil") - } - b.ObjStart() - b.PutID("reportReasonIllegalDrugs") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportReasonIllegalDrugs) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonIllegalDrugs#fc541220 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportReasonIllegalDrugs"); err != nil { - return fmt.Errorf("unable to decode reportReasonIllegalDrugs#fc541220: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportReasonPersonalDetails represents TL type `reportReasonPersonalDetails#a14b9412`. -type ReportReasonPersonalDetails struct { -} - -// ReportReasonPersonalDetailsTypeID is TL type id of ReportReasonPersonalDetails. -const ReportReasonPersonalDetailsTypeID = 0xa14b9412 - -// construct implements constructor of ReportReasonClass. -func (r ReportReasonPersonalDetails) construct() ReportReasonClass { return &r } - -// Ensuring interfaces in compile-time for ReportReasonPersonalDetails. -var ( - _ bin.Encoder = &ReportReasonPersonalDetails{} - _ bin.Decoder = &ReportReasonPersonalDetails{} - _ bin.BareEncoder = &ReportReasonPersonalDetails{} - _ bin.BareDecoder = &ReportReasonPersonalDetails{} - - _ ReportReasonClass = &ReportReasonPersonalDetails{} -) - -func (r *ReportReasonPersonalDetails) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportReasonPersonalDetails) String() string { - if r == nil { - return "ReportReasonPersonalDetails(nil)" - } - type Alias ReportReasonPersonalDetails - return fmt.Sprintf("ReportReasonPersonalDetails%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportReasonPersonalDetails) TypeID() uint32 { - return ReportReasonPersonalDetailsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportReasonPersonalDetails) TypeName() string { - return "reportReasonPersonalDetails" -} - -// TypeInfo returns info about TL type. -func (r *ReportReasonPersonalDetails) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportReasonPersonalDetails", - ID: ReportReasonPersonalDetailsTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportReasonPersonalDetails) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonPersonalDetails#a14b9412 as nil") - } - b.PutID(ReportReasonPersonalDetailsTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportReasonPersonalDetails) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonPersonalDetails#a14b9412 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportReasonPersonalDetails) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonPersonalDetails#a14b9412 to nil") - } - if err := b.ConsumeID(ReportReasonPersonalDetailsTypeID); err != nil { - return fmt.Errorf("unable to decode reportReasonPersonalDetails#a14b9412: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportReasonPersonalDetails) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonPersonalDetails#a14b9412 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportReasonPersonalDetails) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonPersonalDetails#a14b9412 as nil") - } - b.ObjStart() - b.PutID("reportReasonPersonalDetails") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportReasonPersonalDetails) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonPersonalDetails#a14b9412 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportReasonPersonalDetails"); err != nil { - return fmt.Errorf("unable to decode reportReasonPersonalDetails#a14b9412: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportReasonCustom represents TL type `reportReasonCustom#adb7da73`. -type ReportReasonCustom struct { -} - -// ReportReasonCustomTypeID is TL type id of ReportReasonCustom. -const ReportReasonCustomTypeID = 0xadb7da73 - -// construct implements constructor of ReportReasonClass. -func (r ReportReasonCustom) construct() ReportReasonClass { return &r } - -// Ensuring interfaces in compile-time for ReportReasonCustom. -var ( - _ bin.Encoder = &ReportReasonCustom{} - _ bin.Decoder = &ReportReasonCustom{} - _ bin.BareEncoder = &ReportReasonCustom{} - _ bin.BareDecoder = &ReportReasonCustom{} - - _ ReportReasonClass = &ReportReasonCustom{} -) - -func (r *ReportReasonCustom) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportReasonCustom) String() string { - if r == nil { - return "ReportReasonCustom(nil)" - } - type Alias ReportReasonCustom - return fmt.Sprintf("ReportReasonCustom%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportReasonCustom) TypeID() uint32 { - return ReportReasonCustomTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportReasonCustom) TypeName() string { - return "reportReasonCustom" -} - -// TypeInfo returns info about TL type. -func (r *ReportReasonCustom) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportReasonCustom", - ID: ReportReasonCustomTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportReasonCustom) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonCustom#adb7da73 as nil") - } - b.PutID(ReportReasonCustomTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportReasonCustom) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonCustom#adb7da73 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportReasonCustom) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonCustom#adb7da73 to nil") - } - if err := b.ConsumeID(ReportReasonCustomTypeID); err != nil { - return fmt.Errorf("unable to decode reportReasonCustom#adb7da73: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportReasonCustom) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonCustom#adb7da73 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportReasonCustom) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportReasonCustom#adb7da73 as nil") - } - b.ObjStart() - b.PutID("reportReasonCustom") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportReasonCustom) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportReasonCustom#adb7da73 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportReasonCustom"); err != nil { - return fmt.Errorf("unable to decode reportReasonCustom#adb7da73: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportReasonClassName is schema name of ReportReasonClass. -const ReportReasonClassName = "ReportReason" - -// ReportReasonClass represents ReportReason generic type. -// -// Example: -// -// g, err := tdapi.DecodeReportReason(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ReportReasonSpam: // reportReasonSpam#b80e23bf -// case *tdapi.ReportReasonViolence: // reportReasonViolence#7983c739 -// case *tdapi.ReportReasonPornography: // reportReasonPornography#4ddf1cf7 -// case *tdapi.ReportReasonChildAbuse: // reportReasonChildAbuse#2d5d42fe -// case *tdapi.ReportReasonCopyright: // reportReasonCopyright#57e22faf -// case *tdapi.ReportReasonUnrelatedLocation: // reportReasonUnrelatedLocation#5381830 -// case *tdapi.ReportReasonFake: // reportReasonFake#15083fe0 -// case *tdapi.ReportReasonIllegalDrugs: // reportReasonIllegalDrugs#fc541220 -// case *tdapi.ReportReasonPersonalDetails: // reportReasonPersonalDetails#a14b9412 -// case *tdapi.ReportReasonCustom: // reportReasonCustom#adb7da73 -// default: panic(v) -// } -type ReportReasonClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ReportReasonClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeReportReason implements binary de-serialization for ReportReasonClass. -func DecodeReportReason(buf *bin.Buffer) (ReportReasonClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ReportReasonSpamTypeID: - // Decoding reportReasonSpam#b80e23bf. - v := ReportReasonSpam{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case ReportReasonViolenceTypeID: - // Decoding reportReasonViolence#7983c739. - v := ReportReasonViolence{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case ReportReasonPornographyTypeID: - // Decoding reportReasonPornography#4ddf1cf7. - v := ReportReasonPornography{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case ReportReasonChildAbuseTypeID: - // Decoding reportReasonChildAbuse#2d5d42fe. - v := ReportReasonChildAbuse{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case ReportReasonCopyrightTypeID: - // Decoding reportReasonCopyright#57e22faf. - v := ReportReasonCopyright{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case ReportReasonUnrelatedLocationTypeID: - // Decoding reportReasonUnrelatedLocation#5381830. - v := ReportReasonUnrelatedLocation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case ReportReasonFakeTypeID: - // Decoding reportReasonFake#15083fe0. - v := ReportReasonFake{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case ReportReasonIllegalDrugsTypeID: - // Decoding reportReasonIllegalDrugs#fc541220. - v := ReportReasonIllegalDrugs{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case ReportReasonPersonalDetailsTypeID: - // Decoding reportReasonPersonalDetails#a14b9412. - v := ReportReasonPersonalDetails{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case ReportReasonCustomTypeID: - // Decoding reportReasonCustom#adb7da73. - v := ReportReasonCustom{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONReportReason implements binary de-serialization for ReportReasonClass. -func DecodeTDLibJSONReportReason(buf tdjson.Decoder) (ReportReasonClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "reportReasonSpam": - // Decoding reportReasonSpam#b80e23bf. - v := ReportReasonSpam{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case "reportReasonViolence": - // Decoding reportReasonViolence#7983c739. - v := ReportReasonViolence{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case "reportReasonPornography": - // Decoding reportReasonPornography#4ddf1cf7. - v := ReportReasonPornography{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case "reportReasonChildAbuse": - // Decoding reportReasonChildAbuse#2d5d42fe. - v := ReportReasonChildAbuse{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case "reportReasonCopyright": - // Decoding reportReasonCopyright#57e22faf. - v := ReportReasonCopyright{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case "reportReasonUnrelatedLocation": - // Decoding reportReasonUnrelatedLocation#5381830. - v := ReportReasonUnrelatedLocation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case "reportReasonFake": - // Decoding reportReasonFake#15083fe0. - v := ReportReasonFake{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case "reportReasonIllegalDrugs": - // Decoding reportReasonIllegalDrugs#fc541220. - v := ReportReasonIllegalDrugs{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case "reportReasonPersonalDetails": - // Decoding reportReasonPersonalDetails#a14b9412. - v := ReportReasonPersonalDetails{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - case "reportReasonCustom": - // Decoding reportReasonCustom#adb7da73. - v := ReportReasonCustom{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReportReasonClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ReportReason boxes the ReportReasonClass providing a helper. -type ReportReasonBox struct { - ReportReason ReportReasonClass -} - -// Decode implements bin.Decoder for ReportReasonBox. -func (b *ReportReasonBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ReportReasonBox to nil") - } - v, err := DecodeReportReason(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReportReason = v - return nil -} - -// Encode implements bin.Encode for ReportReasonBox. -func (b *ReportReasonBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ReportReason == nil { - return fmt.Errorf("unable to encode ReportReasonClass as nil") - } - return b.ReportReason.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ReportReasonBox. -func (b *ReportReasonBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ReportReasonBox to nil") - } - v, err := DecodeTDLibJSONReportReason(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReportReason = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ReportReasonBox. -func (b *ReportReasonBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ReportReason == nil { - return fmt.Errorf("unable to encode ReportReasonClass as nil") - } - return b.ReportReason.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_report_story_gen.go b/tdapi/tl_report_story_gen.go deleted file mode 100644 index 80e127abe..000000000 --- a/tdapi/tl_report_story_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportStoryRequest represents TL type `reportStory#78de7310`. -type ReportStoryRequest struct { - // The identifier of the sender of the story to report - StorySenderChatID int64 - // The identifier of the story to report - StoryID int32 - // Option identifier chosen by the user; leave empty for the initial request - OptionID []byte - // Additional report details; 0-1024 characters; leave empty for the initial request - Text string -} - -// ReportStoryRequestTypeID is TL type id of ReportStoryRequest. -const ReportStoryRequestTypeID = 0x78de7310 - -// Ensuring interfaces in compile-time for ReportStoryRequest. -var ( - _ bin.Encoder = &ReportStoryRequest{} - _ bin.Decoder = &ReportStoryRequest{} - _ bin.BareEncoder = &ReportStoryRequest{} - _ bin.BareDecoder = &ReportStoryRequest{} -) - -func (r *ReportStoryRequest) Zero() bool { - if r == nil { - return true - } - if !(r.StorySenderChatID == 0) { - return false - } - if !(r.StoryID == 0) { - return false - } - if !(r.OptionID == nil) { - return false - } - if !(r.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportStoryRequest) String() string { - if r == nil { - return "ReportStoryRequest(nil)" - } - type Alias ReportStoryRequest - return fmt.Sprintf("ReportStoryRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportStoryRequest) TypeID() uint32 { - return ReportStoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportStoryRequest) TypeName() string { - return "reportStory" -} - -// TypeInfo returns info about TL type. -func (r *ReportStoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportStory", - ID: ReportStoryRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "OptionID", - SchemaName: "option_id", - }, - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportStoryRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportStory#78de7310 as nil") - } - b.PutID(ReportStoryRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportStoryRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportStory#78de7310 as nil") - } - b.PutInt53(r.StorySenderChatID) - b.PutInt32(r.StoryID) - b.PutBytes(r.OptionID) - b.PutString(r.Text) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportStoryRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportStory#78de7310 to nil") - } - if err := b.ConsumeID(ReportStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reportStory#78de7310: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportStoryRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportStory#78de7310 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportStory#78de7310: field story_sender_chat_id: %w", err) - } - r.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reportStory#78de7310: field story_id: %w", err) - } - r.StoryID = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportStory#78de7310: field option_id: %w", err) - } - r.OptionID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportStory#78de7310: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportStory#78de7310 as nil") - } - b.ObjStart() - b.PutID("reportStory") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(r.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(r.StoryID) - b.Comma() - b.FieldStart("option_id") - b.PutBytes(r.OptionID) - b.Comma() - b.FieldStart("text") - b.PutString(r.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportStory#78de7310 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportStory"); err != nil { - return fmt.Errorf("unable to decode reportStory#78de7310: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportStory#78de7310: field story_sender_chat_id: %w", err) - } - r.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode reportStory#78de7310: field story_id: %w", err) - } - r.StoryID = value - case "option_id": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportStory#78de7310: field option_id: %w", err) - } - r.OptionID = value - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportStory#78de7310: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (r *ReportStoryRequest) GetStorySenderChatID() (value int64) { - if r == nil { - return - } - return r.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (r *ReportStoryRequest) GetStoryID() (value int32) { - if r == nil { - return - } - return r.StoryID -} - -// GetOptionID returns value of OptionID field. -func (r *ReportStoryRequest) GetOptionID() (value []byte) { - if r == nil { - return - } - return r.OptionID -} - -// GetText returns value of Text field. -func (r *ReportStoryRequest) GetText() (value string) { - if r == nil { - return - } - return r.Text -} - -// ReportStory invokes method reportStory#78de7310 returning error if any. -func (c *Client) ReportStory(ctx context.Context, request *ReportStoryRequest) (ReportStoryResultClass, error) { - var result ReportStoryResultBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.ReportStoryResult, nil -} diff --git a/tdapi/tl_report_story_result_gen.go b/tdapi/tl_report_story_result_gen.go deleted file mode 100644 index 1192e1301..000000000 --- a/tdapi/tl_report_story_result_gen.go +++ /dev/null @@ -1,743 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportStoryResultOk represents TL type `reportStoryResultOk#ac3c63b3`. -type ReportStoryResultOk struct { -} - -// ReportStoryResultOkTypeID is TL type id of ReportStoryResultOk. -const ReportStoryResultOkTypeID = 0xac3c63b3 - -// construct implements constructor of ReportStoryResultClass. -func (r ReportStoryResultOk) construct() ReportStoryResultClass { return &r } - -// Ensuring interfaces in compile-time for ReportStoryResultOk. -var ( - _ bin.Encoder = &ReportStoryResultOk{} - _ bin.Decoder = &ReportStoryResultOk{} - _ bin.BareEncoder = &ReportStoryResultOk{} - _ bin.BareDecoder = &ReportStoryResultOk{} - - _ ReportStoryResultClass = &ReportStoryResultOk{} -) - -func (r *ReportStoryResultOk) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportStoryResultOk) String() string { - if r == nil { - return "ReportStoryResultOk(nil)" - } - type Alias ReportStoryResultOk - return fmt.Sprintf("ReportStoryResultOk%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportStoryResultOk) TypeID() uint32 { - return ReportStoryResultOkTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportStoryResultOk) TypeName() string { - return "reportStoryResultOk" -} - -// TypeInfo returns info about TL type. -func (r *ReportStoryResultOk) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportStoryResultOk", - ID: ReportStoryResultOkTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportStoryResultOk) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportStoryResultOk#ac3c63b3 as nil") - } - b.PutID(ReportStoryResultOkTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportStoryResultOk) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportStoryResultOk#ac3c63b3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportStoryResultOk) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportStoryResultOk#ac3c63b3 to nil") - } - if err := b.ConsumeID(ReportStoryResultOkTypeID); err != nil { - return fmt.Errorf("unable to decode reportStoryResultOk#ac3c63b3: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportStoryResultOk) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportStoryResultOk#ac3c63b3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportStoryResultOk) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportStoryResultOk#ac3c63b3 as nil") - } - b.ObjStart() - b.PutID("reportStoryResultOk") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportStoryResultOk) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportStoryResultOk#ac3c63b3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportStoryResultOk"); err != nil { - return fmt.Errorf("unable to decode reportStoryResultOk#ac3c63b3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ReportStoryResultOptionRequired represents TL type `reportStoryResultOptionRequired#bf79aa9b`. -type ReportStoryResultOptionRequired struct { - // Title for the option choice - Title string - // List of available options - Options []ReportOption -} - -// ReportStoryResultOptionRequiredTypeID is TL type id of ReportStoryResultOptionRequired. -const ReportStoryResultOptionRequiredTypeID = 0xbf79aa9b - -// construct implements constructor of ReportStoryResultClass. -func (r ReportStoryResultOptionRequired) construct() ReportStoryResultClass { return &r } - -// Ensuring interfaces in compile-time for ReportStoryResultOptionRequired. -var ( - _ bin.Encoder = &ReportStoryResultOptionRequired{} - _ bin.Decoder = &ReportStoryResultOptionRequired{} - _ bin.BareEncoder = &ReportStoryResultOptionRequired{} - _ bin.BareDecoder = &ReportStoryResultOptionRequired{} - - _ ReportStoryResultClass = &ReportStoryResultOptionRequired{} -) - -func (r *ReportStoryResultOptionRequired) Zero() bool { - if r == nil { - return true - } - if !(r.Title == "") { - return false - } - if !(r.Options == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportStoryResultOptionRequired) String() string { - if r == nil { - return "ReportStoryResultOptionRequired(nil)" - } - type Alias ReportStoryResultOptionRequired - return fmt.Sprintf("ReportStoryResultOptionRequired%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportStoryResultOptionRequired) TypeID() uint32 { - return ReportStoryResultOptionRequiredTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportStoryResultOptionRequired) TypeName() string { - return "reportStoryResultOptionRequired" -} - -// TypeInfo returns info about TL type. -func (r *ReportStoryResultOptionRequired) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportStoryResultOptionRequired", - ID: ReportStoryResultOptionRequiredTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Options", - SchemaName: "options", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportStoryResultOptionRequired) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportStoryResultOptionRequired#bf79aa9b as nil") - } - b.PutID(ReportStoryResultOptionRequiredTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportStoryResultOptionRequired) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportStoryResultOptionRequired#bf79aa9b as nil") - } - b.PutString(r.Title) - b.PutInt(len(r.Options)) - for idx, v := range r.Options { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare reportStoryResultOptionRequired#bf79aa9b: field options element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportStoryResultOptionRequired) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportStoryResultOptionRequired#bf79aa9b to nil") - } - if err := b.ConsumeID(ReportStoryResultOptionRequiredTypeID); err != nil { - return fmt.Errorf("unable to decode reportStoryResultOptionRequired#bf79aa9b: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportStoryResultOptionRequired) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportStoryResultOptionRequired#bf79aa9b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportStoryResultOptionRequired#bf79aa9b: field title: %w", err) - } - r.Title = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reportStoryResultOptionRequired#bf79aa9b: field options: %w", err) - } - - if headerLen > 0 { - r.Options = make([]ReportOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ReportOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare reportStoryResultOptionRequired#bf79aa9b: field options: %w", err) - } - r.Options = append(r.Options, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportStoryResultOptionRequired) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportStoryResultOptionRequired#bf79aa9b as nil") - } - b.ObjStart() - b.PutID("reportStoryResultOptionRequired") - b.Comma() - b.FieldStart("title") - b.PutString(r.Title) - b.Comma() - b.FieldStart("options") - b.ArrStart() - for idx, v := range r.Options { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode reportStoryResultOptionRequired#bf79aa9b: field options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportStoryResultOptionRequired) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportStoryResultOptionRequired#bf79aa9b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportStoryResultOptionRequired"); err != nil { - return fmt.Errorf("unable to decode reportStoryResultOptionRequired#bf79aa9b: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reportStoryResultOptionRequired#bf79aa9b: field title: %w", err) - } - r.Title = value - case "options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ReportOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode reportStoryResultOptionRequired#bf79aa9b: field options: %w", err) - } - r.Options = append(r.Options, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reportStoryResultOptionRequired#bf79aa9b: field options: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTitle returns value of Title field. -func (r *ReportStoryResultOptionRequired) GetTitle() (value string) { - if r == nil { - return - } - return r.Title -} - -// GetOptions returns value of Options field. -func (r *ReportStoryResultOptionRequired) GetOptions() (value []ReportOption) { - if r == nil { - return - } - return r.Options -} - -// ReportStoryResultTextRequired represents TL type `reportStoryResultTextRequired#13ed9d91`. -type ReportStoryResultTextRequired struct { - // Option identifier for the next reportStory request - OptionID []byte - // True, if the user can skip text adding - IsOptional bool -} - -// ReportStoryResultTextRequiredTypeID is TL type id of ReportStoryResultTextRequired. -const ReportStoryResultTextRequiredTypeID = 0x13ed9d91 - -// construct implements constructor of ReportStoryResultClass. -func (r ReportStoryResultTextRequired) construct() ReportStoryResultClass { return &r } - -// Ensuring interfaces in compile-time for ReportStoryResultTextRequired. -var ( - _ bin.Encoder = &ReportStoryResultTextRequired{} - _ bin.Decoder = &ReportStoryResultTextRequired{} - _ bin.BareEncoder = &ReportStoryResultTextRequired{} - _ bin.BareDecoder = &ReportStoryResultTextRequired{} - - _ ReportStoryResultClass = &ReportStoryResultTextRequired{} -) - -func (r *ReportStoryResultTextRequired) Zero() bool { - if r == nil { - return true - } - if !(r.OptionID == nil) { - return false - } - if !(r.IsOptional == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportStoryResultTextRequired) String() string { - if r == nil { - return "ReportStoryResultTextRequired(nil)" - } - type Alias ReportStoryResultTextRequired - return fmt.Sprintf("ReportStoryResultTextRequired%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportStoryResultTextRequired) TypeID() uint32 { - return ReportStoryResultTextRequiredTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportStoryResultTextRequired) TypeName() string { - return "reportStoryResultTextRequired" -} - -// TypeInfo returns info about TL type. -func (r *ReportStoryResultTextRequired) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportStoryResultTextRequired", - ID: ReportStoryResultTextRequiredTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OptionID", - SchemaName: "option_id", - }, - { - Name: "IsOptional", - SchemaName: "is_optional", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportStoryResultTextRequired) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportStoryResultTextRequired#13ed9d91 as nil") - } - b.PutID(ReportStoryResultTextRequiredTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportStoryResultTextRequired) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportStoryResultTextRequired#13ed9d91 as nil") - } - b.PutBytes(r.OptionID) - b.PutBool(r.IsOptional) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportStoryResultTextRequired) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportStoryResultTextRequired#13ed9d91 to nil") - } - if err := b.ConsumeID(ReportStoryResultTextRequiredTypeID); err != nil { - return fmt.Errorf("unable to decode reportStoryResultTextRequired#13ed9d91: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportStoryResultTextRequired) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportStoryResultTextRequired#13ed9d91 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportStoryResultTextRequired#13ed9d91: field option_id: %w", err) - } - r.OptionID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode reportStoryResultTextRequired#13ed9d91: field is_optional: %w", err) - } - r.IsOptional = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportStoryResultTextRequired) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportStoryResultTextRequired#13ed9d91 as nil") - } - b.ObjStart() - b.PutID("reportStoryResultTextRequired") - b.Comma() - b.FieldStart("option_id") - b.PutBytes(r.OptionID) - b.Comma() - b.FieldStart("is_optional") - b.PutBool(r.IsOptional) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportStoryResultTextRequired) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportStoryResultTextRequired#13ed9d91 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportStoryResultTextRequired"); err != nil { - return fmt.Errorf("unable to decode reportStoryResultTextRequired#13ed9d91: %w", err) - } - case "option_id": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode reportStoryResultTextRequired#13ed9d91: field option_id: %w", err) - } - r.OptionID = value - case "is_optional": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode reportStoryResultTextRequired#13ed9d91: field is_optional: %w", err) - } - r.IsOptional = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOptionID returns value of OptionID field. -func (r *ReportStoryResultTextRequired) GetOptionID() (value []byte) { - if r == nil { - return - } - return r.OptionID -} - -// GetIsOptional returns value of IsOptional field. -func (r *ReportStoryResultTextRequired) GetIsOptional() (value bool) { - if r == nil { - return - } - return r.IsOptional -} - -// ReportStoryResultClassName is schema name of ReportStoryResultClass. -const ReportStoryResultClassName = "ReportStoryResult" - -// ReportStoryResultClass represents ReportStoryResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeReportStoryResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ReportStoryResultOk: // reportStoryResultOk#ac3c63b3 -// case *tdapi.ReportStoryResultOptionRequired: // reportStoryResultOptionRequired#bf79aa9b -// case *tdapi.ReportStoryResultTextRequired: // reportStoryResultTextRequired#13ed9d91 -// default: panic(v) -// } -type ReportStoryResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ReportStoryResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeReportStoryResult implements binary de-serialization for ReportStoryResultClass. -func DecodeReportStoryResult(buf *bin.Buffer) (ReportStoryResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ReportStoryResultOkTypeID: - // Decoding reportStoryResultOk#ac3c63b3. - v := ReportStoryResultOk{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportStoryResultClass: %w", err) - } - return &v, nil - case ReportStoryResultOptionRequiredTypeID: - // Decoding reportStoryResultOptionRequired#bf79aa9b. - v := ReportStoryResultOptionRequired{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportStoryResultClass: %w", err) - } - return &v, nil - case ReportStoryResultTextRequiredTypeID: - // Decoding reportStoryResultTextRequired#13ed9d91. - v := ReportStoryResultTextRequired{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportStoryResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReportStoryResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONReportStoryResult implements binary de-serialization for ReportStoryResultClass. -func DecodeTDLibJSONReportStoryResult(buf tdjson.Decoder) (ReportStoryResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "reportStoryResultOk": - // Decoding reportStoryResultOk#ac3c63b3. - v := ReportStoryResultOk{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportStoryResultClass: %w", err) - } - return &v, nil - case "reportStoryResultOptionRequired": - // Decoding reportStoryResultOptionRequired#bf79aa9b. - v := ReportStoryResultOptionRequired{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportStoryResultClass: %w", err) - } - return &v, nil - case "reportStoryResultTextRequired": - // Decoding reportStoryResultTextRequired#13ed9d91. - v := ReportStoryResultTextRequired{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ReportStoryResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ReportStoryResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ReportStoryResult boxes the ReportStoryResultClass providing a helper. -type ReportStoryResultBox struct { - ReportStoryResult ReportStoryResultClass -} - -// Decode implements bin.Decoder for ReportStoryResultBox. -func (b *ReportStoryResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ReportStoryResultBox to nil") - } - v, err := DecodeReportStoryResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReportStoryResult = v - return nil -} - -// Encode implements bin.Encode for ReportStoryResultBox. -func (b *ReportStoryResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ReportStoryResult == nil { - return fmt.Errorf("unable to encode ReportStoryResultClass as nil") - } - return b.ReportStoryResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ReportStoryResultBox. -func (b *ReportStoryResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ReportStoryResultBox to nil") - } - v, err := DecodeTDLibJSONReportStoryResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ReportStoryResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ReportStoryResultBox. -func (b *ReportStoryResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ReportStoryResult == nil { - return fmt.Errorf("unable to encode ReportStoryResultClass as nil") - } - return b.ReportStoryResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go b/tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go deleted file mode 100644 index 4757c74d2..000000000 --- a/tdapi/tl_report_supergroup_anti_spam_false_positive_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportSupergroupAntiSpamFalsePositiveRequest represents TL type `reportSupergroupAntiSpamFalsePositive#e13db048`. -type ReportSupergroupAntiSpamFalsePositiveRequest struct { - // Supergroup identifier - SupergroupID int64 - // Identifier of the erroneously deleted message from chatEventMessageDeleted - MessageID int64 -} - -// ReportSupergroupAntiSpamFalsePositiveRequestTypeID is TL type id of ReportSupergroupAntiSpamFalsePositiveRequest. -const ReportSupergroupAntiSpamFalsePositiveRequestTypeID = 0xe13db048 - -// Ensuring interfaces in compile-time for ReportSupergroupAntiSpamFalsePositiveRequest. -var ( - _ bin.Encoder = &ReportSupergroupAntiSpamFalsePositiveRequest{} - _ bin.Decoder = &ReportSupergroupAntiSpamFalsePositiveRequest{} - _ bin.BareEncoder = &ReportSupergroupAntiSpamFalsePositiveRequest{} - _ bin.BareDecoder = &ReportSupergroupAntiSpamFalsePositiveRequest{} -) - -func (r *ReportSupergroupAntiSpamFalsePositiveRequest) Zero() bool { - if r == nil { - return true - } - if !(r.SupergroupID == 0) { - return false - } - if !(r.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportSupergroupAntiSpamFalsePositiveRequest) String() string { - if r == nil { - return "ReportSupergroupAntiSpamFalsePositiveRequest(nil)" - } - type Alias ReportSupergroupAntiSpamFalsePositiveRequest - return fmt.Sprintf("ReportSupergroupAntiSpamFalsePositiveRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportSupergroupAntiSpamFalsePositiveRequest) TypeID() uint32 { - return ReportSupergroupAntiSpamFalsePositiveRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportSupergroupAntiSpamFalsePositiveRequest) TypeName() string { - return "reportSupergroupAntiSpamFalsePositive" -} - -// TypeInfo returns info about TL type. -func (r *ReportSupergroupAntiSpamFalsePositiveRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportSupergroupAntiSpamFalsePositive", - ID: ReportSupergroupAntiSpamFalsePositiveRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportSupergroupAntiSpamFalsePositiveRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportSupergroupAntiSpamFalsePositive#e13db048 as nil") - } - b.PutID(ReportSupergroupAntiSpamFalsePositiveRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportSupergroupAntiSpamFalsePositiveRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportSupergroupAntiSpamFalsePositive#e13db048 as nil") - } - b.PutInt53(r.SupergroupID) - b.PutInt53(r.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportSupergroupAntiSpamFalsePositiveRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportSupergroupAntiSpamFalsePositive#e13db048 to nil") - } - if err := b.ConsumeID(ReportSupergroupAntiSpamFalsePositiveRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportSupergroupAntiSpamFalsePositiveRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportSupergroupAntiSpamFalsePositive#e13db048 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: field supergroup_id: %w", err) - } - r.SupergroupID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: field message_id: %w", err) - } - r.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportSupergroupAntiSpamFalsePositiveRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportSupergroupAntiSpamFalsePositive#e13db048 as nil") - } - b.ObjStart() - b.PutID("reportSupergroupAntiSpamFalsePositive") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(r.SupergroupID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(r.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportSupergroupAntiSpamFalsePositiveRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportSupergroupAntiSpamFalsePositive#e13db048 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportSupergroupAntiSpamFalsePositive"); err != nil { - return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: field supergroup_id: %w", err) - } - r.SupergroupID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportSupergroupAntiSpamFalsePositive#e13db048: field message_id: %w", err) - } - r.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (r *ReportSupergroupAntiSpamFalsePositiveRequest) GetSupergroupID() (value int64) { - if r == nil { - return - } - return r.SupergroupID -} - -// GetMessageID returns value of MessageID field. -func (r *ReportSupergroupAntiSpamFalsePositiveRequest) GetMessageID() (value int64) { - if r == nil { - return - } - return r.MessageID -} - -// ReportSupergroupAntiSpamFalsePositive invokes method reportSupergroupAntiSpamFalsePositive#e13db048 returning error if any. -func (c *Client) ReportSupergroupAntiSpamFalsePositive(ctx context.Context, request *ReportSupergroupAntiSpamFalsePositiveRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_report_supergroup_spam_gen.go b/tdapi/tl_report_supergroup_spam_gen.go deleted file mode 100644 index 36a6f8a16..000000000 --- a/tdapi/tl_report_supergroup_spam_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReportSupergroupSpamRequest represents TL type `reportSupergroupSpam#383e26f2`. -type ReportSupergroupSpamRequest struct { - // Supergroup identifier - SupergroupID int64 - // Identifiers of messages to report. Use messageProperties.can_report_supergroup_spam to - // check whether the message can be reported - MessageIDs []int64 -} - -// ReportSupergroupSpamRequestTypeID is TL type id of ReportSupergroupSpamRequest. -const ReportSupergroupSpamRequestTypeID = 0x383e26f2 - -// Ensuring interfaces in compile-time for ReportSupergroupSpamRequest. -var ( - _ bin.Encoder = &ReportSupergroupSpamRequest{} - _ bin.Decoder = &ReportSupergroupSpamRequest{} - _ bin.BareEncoder = &ReportSupergroupSpamRequest{} - _ bin.BareDecoder = &ReportSupergroupSpamRequest{} -) - -func (r *ReportSupergroupSpamRequest) Zero() bool { - if r == nil { - return true - } - if !(r.SupergroupID == 0) { - return false - } - if !(r.MessageIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReportSupergroupSpamRequest) String() string { - if r == nil { - return "ReportSupergroupSpamRequest(nil)" - } - type Alias ReportSupergroupSpamRequest - return fmt.Sprintf("ReportSupergroupSpamRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReportSupergroupSpamRequest) TypeID() uint32 { - return ReportSupergroupSpamRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReportSupergroupSpamRequest) TypeName() string { - return "reportSupergroupSpam" -} - -// TypeInfo returns info about TL type. -func (r *ReportSupergroupSpamRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reportSupergroupSpam", - ID: ReportSupergroupSpamRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "MessageIDs", - SchemaName: "message_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReportSupergroupSpamRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportSupergroupSpam#383e26f2 as nil") - } - b.PutID(ReportSupergroupSpamRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReportSupergroupSpamRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reportSupergroupSpam#383e26f2 as nil") - } - b.PutInt53(r.SupergroupID) - b.PutInt(len(r.MessageIDs)) - for _, v := range r.MessageIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ReportSupergroupSpamRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportSupergroupSpam#383e26f2 to nil") - } - if err := b.ConsumeID(ReportSupergroupSpamRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReportSupergroupSpamRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reportSupergroupSpam#383e26f2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field supergroup_id: %w", err) - } - r.SupergroupID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field message_ids: %w", err) - } - - if headerLen > 0 { - r.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field message_ids: %w", err) - } - r.MessageIDs = append(r.MessageIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReportSupergroupSpamRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reportSupergroupSpam#383e26f2 as nil") - } - b.ObjStart() - b.PutID("reportSupergroupSpam") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(r.SupergroupID) - b.Comma() - b.FieldStart("message_ids") - b.ArrStart() - for _, v := range r.MessageIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReportSupergroupSpamRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reportSupergroupSpam#383e26f2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reportSupergroupSpam"); err != nil { - return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field supergroup_id: %w", err) - } - r.SupergroupID = value - case "message_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field message_ids: %w", err) - } - r.MessageIDs = append(r.MessageIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode reportSupergroupSpam#383e26f2: field message_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (r *ReportSupergroupSpamRequest) GetSupergroupID() (value int64) { - if r == nil { - return - } - return r.SupergroupID -} - -// GetMessageIDs returns value of MessageIDs field. -func (r *ReportSupergroupSpamRequest) GetMessageIDs() (value []int64) { - if r == nil { - return - } - return r.MessageIDs -} - -// ReportSupergroupSpam invokes method reportSupergroupSpam#383e26f2 returning error if any. -func (c *Client) ReportSupergroupSpam(ctx context.Context, request *ReportSupergroupSpamRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_request_authentication_password_recovery_gen.go b/tdapi/tl_request_authentication_password_recovery_gen.go deleted file mode 100644 index b55d48c2f..000000000 --- a/tdapi/tl_request_authentication_password_recovery_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RequestAuthenticationPasswordRecoveryRequest represents TL type `requestAuthenticationPasswordRecovery#53152ab6`. -type RequestAuthenticationPasswordRecoveryRequest struct { -} - -// RequestAuthenticationPasswordRecoveryRequestTypeID is TL type id of RequestAuthenticationPasswordRecoveryRequest. -const RequestAuthenticationPasswordRecoveryRequestTypeID = 0x53152ab6 - -// Ensuring interfaces in compile-time for RequestAuthenticationPasswordRecoveryRequest. -var ( - _ bin.Encoder = &RequestAuthenticationPasswordRecoveryRequest{} - _ bin.Decoder = &RequestAuthenticationPasswordRecoveryRequest{} - _ bin.BareEncoder = &RequestAuthenticationPasswordRecoveryRequest{} - _ bin.BareDecoder = &RequestAuthenticationPasswordRecoveryRequest{} -) - -func (r *RequestAuthenticationPasswordRecoveryRequest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *RequestAuthenticationPasswordRecoveryRequest) String() string { - if r == nil { - return "RequestAuthenticationPasswordRecoveryRequest(nil)" - } - type Alias RequestAuthenticationPasswordRecoveryRequest - return fmt.Sprintf("RequestAuthenticationPasswordRecoveryRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RequestAuthenticationPasswordRecoveryRequest) TypeID() uint32 { - return RequestAuthenticationPasswordRecoveryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RequestAuthenticationPasswordRecoveryRequest) TypeName() string { - return "requestAuthenticationPasswordRecovery" -} - -// TypeInfo returns info about TL type. -func (r *RequestAuthenticationPasswordRecoveryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "requestAuthenticationPasswordRecovery", - ID: RequestAuthenticationPasswordRecoveryRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *RequestAuthenticationPasswordRecoveryRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode requestAuthenticationPasswordRecovery#53152ab6 as nil") - } - b.PutID(RequestAuthenticationPasswordRecoveryRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RequestAuthenticationPasswordRecoveryRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode requestAuthenticationPasswordRecovery#53152ab6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RequestAuthenticationPasswordRecoveryRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode requestAuthenticationPasswordRecovery#53152ab6 to nil") - } - if err := b.ConsumeID(RequestAuthenticationPasswordRecoveryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode requestAuthenticationPasswordRecovery#53152ab6: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RequestAuthenticationPasswordRecoveryRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode requestAuthenticationPasswordRecovery#53152ab6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RequestAuthenticationPasswordRecoveryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode requestAuthenticationPasswordRecovery#53152ab6 as nil") - } - b.ObjStart() - b.PutID("requestAuthenticationPasswordRecovery") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RequestAuthenticationPasswordRecoveryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode requestAuthenticationPasswordRecovery#53152ab6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("requestAuthenticationPasswordRecovery"); err != nil { - return fmt.Errorf("unable to decode requestAuthenticationPasswordRecovery#53152ab6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// RequestAuthenticationPasswordRecovery invokes method requestAuthenticationPasswordRecovery#53152ab6 returning error if any. -func (c *Client) RequestAuthenticationPasswordRecovery(ctx context.Context) error { - var ok Ok - - request := &RequestAuthenticationPasswordRecoveryRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_request_password_recovery_gen.go b/tdapi/tl_request_password_recovery_gen.go deleted file mode 100644 index b044dc709..000000000 --- a/tdapi/tl_request_password_recovery_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RequestPasswordRecoveryRequest represents TL type `requestPasswordRecovery#ff2dc552`. -type RequestPasswordRecoveryRequest struct { -} - -// RequestPasswordRecoveryRequestTypeID is TL type id of RequestPasswordRecoveryRequest. -const RequestPasswordRecoveryRequestTypeID = 0xff2dc552 - -// Ensuring interfaces in compile-time for RequestPasswordRecoveryRequest. -var ( - _ bin.Encoder = &RequestPasswordRecoveryRequest{} - _ bin.Decoder = &RequestPasswordRecoveryRequest{} - _ bin.BareEncoder = &RequestPasswordRecoveryRequest{} - _ bin.BareDecoder = &RequestPasswordRecoveryRequest{} -) - -func (r *RequestPasswordRecoveryRequest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *RequestPasswordRecoveryRequest) String() string { - if r == nil { - return "RequestPasswordRecoveryRequest(nil)" - } - type Alias RequestPasswordRecoveryRequest - return fmt.Sprintf("RequestPasswordRecoveryRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RequestPasswordRecoveryRequest) TypeID() uint32 { - return RequestPasswordRecoveryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RequestPasswordRecoveryRequest) TypeName() string { - return "requestPasswordRecovery" -} - -// TypeInfo returns info about TL type. -func (r *RequestPasswordRecoveryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "requestPasswordRecovery", - ID: RequestPasswordRecoveryRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *RequestPasswordRecoveryRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode requestPasswordRecovery#ff2dc552 as nil") - } - b.PutID(RequestPasswordRecoveryRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RequestPasswordRecoveryRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode requestPasswordRecovery#ff2dc552 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RequestPasswordRecoveryRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode requestPasswordRecovery#ff2dc552 to nil") - } - if err := b.ConsumeID(RequestPasswordRecoveryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode requestPasswordRecovery#ff2dc552: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RequestPasswordRecoveryRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode requestPasswordRecovery#ff2dc552 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RequestPasswordRecoveryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode requestPasswordRecovery#ff2dc552 as nil") - } - b.ObjStart() - b.PutID("requestPasswordRecovery") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RequestPasswordRecoveryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode requestPasswordRecovery#ff2dc552 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("requestPasswordRecovery"); err != nil { - return fmt.Errorf("unable to decode requestPasswordRecovery#ff2dc552: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// RequestPasswordRecovery invokes method requestPasswordRecovery#ff2dc552 returning error if any. -func (c *Client) RequestPasswordRecovery(ctx context.Context) (*EmailAddressAuthenticationCodeInfo, error) { - var result EmailAddressAuthenticationCodeInfo - - request := &RequestPasswordRecoveryRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_request_qr_code_authentication_gen.go b/tdapi/tl_request_qr_code_authentication_gen.go deleted file mode 100644 index 3e6d0b6a4..000000000 --- a/tdapi/tl_request_qr_code_authentication_gen.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RequestQrCodeAuthenticationRequest represents TL type `requestQrCodeAuthentication#56fe3c4e`. -type RequestQrCodeAuthenticationRequest struct { - // List of user identifiers of other users currently using the application - OtherUserIDs []int64 -} - -// RequestQrCodeAuthenticationRequestTypeID is TL type id of RequestQrCodeAuthenticationRequest. -const RequestQrCodeAuthenticationRequestTypeID = 0x56fe3c4e - -// Ensuring interfaces in compile-time for RequestQrCodeAuthenticationRequest. -var ( - _ bin.Encoder = &RequestQrCodeAuthenticationRequest{} - _ bin.Decoder = &RequestQrCodeAuthenticationRequest{} - _ bin.BareEncoder = &RequestQrCodeAuthenticationRequest{} - _ bin.BareDecoder = &RequestQrCodeAuthenticationRequest{} -) - -func (r *RequestQrCodeAuthenticationRequest) Zero() bool { - if r == nil { - return true - } - if !(r.OtherUserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RequestQrCodeAuthenticationRequest) String() string { - if r == nil { - return "RequestQrCodeAuthenticationRequest(nil)" - } - type Alias RequestQrCodeAuthenticationRequest - return fmt.Sprintf("RequestQrCodeAuthenticationRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RequestQrCodeAuthenticationRequest) TypeID() uint32 { - return RequestQrCodeAuthenticationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RequestQrCodeAuthenticationRequest) TypeName() string { - return "requestQrCodeAuthentication" -} - -// TypeInfo returns info about TL type. -func (r *RequestQrCodeAuthenticationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "requestQrCodeAuthentication", - ID: RequestQrCodeAuthenticationRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OtherUserIDs", - SchemaName: "other_user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RequestQrCodeAuthenticationRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode requestQrCodeAuthentication#56fe3c4e as nil") - } - b.PutID(RequestQrCodeAuthenticationRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RequestQrCodeAuthenticationRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode requestQrCodeAuthentication#56fe3c4e as nil") - } - b.PutInt(len(r.OtherUserIDs)) - for _, v := range r.OtherUserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RequestQrCodeAuthenticationRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode requestQrCodeAuthentication#56fe3c4e to nil") - } - if err := b.ConsumeID(RequestQrCodeAuthenticationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode requestQrCodeAuthentication#56fe3c4e: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RequestQrCodeAuthenticationRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode requestQrCodeAuthentication#56fe3c4e to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode requestQrCodeAuthentication#56fe3c4e: field other_user_ids: %w", err) - } - - if headerLen > 0 { - r.OtherUserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode requestQrCodeAuthentication#56fe3c4e: field other_user_ids: %w", err) - } - r.OtherUserIDs = append(r.OtherUserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RequestQrCodeAuthenticationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode requestQrCodeAuthentication#56fe3c4e as nil") - } - b.ObjStart() - b.PutID("requestQrCodeAuthentication") - b.Comma() - b.FieldStart("other_user_ids") - b.ArrStart() - for _, v := range r.OtherUserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RequestQrCodeAuthenticationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode requestQrCodeAuthentication#56fe3c4e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("requestQrCodeAuthentication"); err != nil { - return fmt.Errorf("unable to decode requestQrCodeAuthentication#56fe3c4e: %w", err) - } - case "other_user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode requestQrCodeAuthentication#56fe3c4e: field other_user_ids: %w", err) - } - r.OtherUserIDs = append(r.OtherUserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode requestQrCodeAuthentication#56fe3c4e: field other_user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOtherUserIDs returns value of OtherUserIDs field. -func (r *RequestQrCodeAuthenticationRequest) GetOtherUserIDs() (value []int64) { - if r == nil { - return - } - return r.OtherUserIDs -} - -// RequestQrCodeAuthentication invokes method requestQrCodeAuthentication#56fe3c4e returning error if any. -func (c *Client) RequestQrCodeAuthentication(ctx context.Context, otheruserids []int64) error { - var ok Ok - - request := &RequestQrCodeAuthenticationRequest{ - OtherUserIDs: otheruserids, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_resend_authentication_code_gen.go b/tdapi/tl_resend_authentication_code_gen.go deleted file mode 100644 index 7c1fe05c9..000000000 --- a/tdapi/tl_resend_authentication_code_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResendAuthenticationCodeRequest represents TL type `resendAuthenticationCode#a630bbb8`. -type ResendAuthenticationCodeRequest struct { - // Reason of code resending; pass null if unknown - Reason ResendCodeReasonClass -} - -// ResendAuthenticationCodeRequestTypeID is TL type id of ResendAuthenticationCodeRequest. -const ResendAuthenticationCodeRequestTypeID = 0xa630bbb8 - -// Ensuring interfaces in compile-time for ResendAuthenticationCodeRequest. -var ( - _ bin.Encoder = &ResendAuthenticationCodeRequest{} - _ bin.Decoder = &ResendAuthenticationCodeRequest{} - _ bin.BareEncoder = &ResendAuthenticationCodeRequest{} - _ bin.BareDecoder = &ResendAuthenticationCodeRequest{} -) - -func (r *ResendAuthenticationCodeRequest) Zero() bool { - if r == nil { - return true - } - if !(r.Reason == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResendAuthenticationCodeRequest) String() string { - if r == nil { - return "ResendAuthenticationCodeRequest(nil)" - } - type Alias ResendAuthenticationCodeRequest - return fmt.Sprintf("ResendAuthenticationCodeRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResendAuthenticationCodeRequest) TypeID() uint32 { - return ResendAuthenticationCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResendAuthenticationCodeRequest) TypeName() string { - return "resendAuthenticationCode" -} - -// TypeInfo returns info about TL type. -func (r *ResendAuthenticationCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resendAuthenticationCode", - ID: ResendAuthenticationCodeRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Reason", - SchemaName: "reason", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ResendAuthenticationCodeRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendAuthenticationCode#a630bbb8 as nil") - } - b.PutID(ResendAuthenticationCodeRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResendAuthenticationCodeRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendAuthenticationCode#a630bbb8 as nil") - } - if r.Reason == nil { - return fmt.Errorf("unable to encode resendAuthenticationCode#a630bbb8: field reason is nil") - } - if err := r.Reason.Encode(b); err != nil { - return fmt.Errorf("unable to encode resendAuthenticationCode#a630bbb8: field reason: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResendAuthenticationCodeRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendAuthenticationCode#a630bbb8 to nil") - } - if err := b.ConsumeID(ResendAuthenticationCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resendAuthenticationCode#a630bbb8: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResendAuthenticationCodeRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendAuthenticationCode#a630bbb8 to nil") - } - { - value, err := DecodeResendCodeReason(b) - if err != nil { - return fmt.Errorf("unable to decode resendAuthenticationCode#a630bbb8: field reason: %w", err) - } - r.Reason = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResendAuthenticationCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resendAuthenticationCode#a630bbb8 as nil") - } - b.ObjStart() - b.PutID("resendAuthenticationCode") - b.Comma() - b.FieldStart("reason") - if r.Reason == nil { - return fmt.Errorf("unable to encode resendAuthenticationCode#a630bbb8: field reason is nil") - } - if err := r.Reason.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode resendAuthenticationCode#a630bbb8: field reason: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResendAuthenticationCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resendAuthenticationCode#a630bbb8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resendAuthenticationCode"); err != nil { - return fmt.Errorf("unable to decode resendAuthenticationCode#a630bbb8: %w", err) - } - case "reason": - value, err := DecodeTDLibJSONResendCodeReason(b) - if err != nil { - return fmt.Errorf("unable to decode resendAuthenticationCode#a630bbb8: field reason: %w", err) - } - r.Reason = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReason returns value of Reason field. -func (r *ResendAuthenticationCodeRequest) GetReason() (value ResendCodeReasonClass) { - if r == nil { - return - } - return r.Reason -} - -// ResendAuthenticationCode invokes method resendAuthenticationCode#a630bbb8 returning error if any. -func (c *Client) ResendAuthenticationCode(ctx context.Context, reason ResendCodeReasonClass) error { - var ok Ok - - request := &ResendAuthenticationCodeRequest{ - Reason: reason, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_resend_code_reason_gen.go b/tdapi/tl_resend_code_reason_gen.go deleted file mode 100644 index 99869107c..000000000 --- a/tdapi/tl_resend_code_reason_gen.go +++ /dev/null @@ -1,467 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResendCodeReasonUserRequest represents TL type `resendCodeReasonUserRequest#e5a8c880`. -type ResendCodeReasonUserRequest struct { -} - -// ResendCodeReasonUserRequestTypeID is TL type id of ResendCodeReasonUserRequest. -const ResendCodeReasonUserRequestTypeID = 0xe5a8c880 - -// construct implements constructor of ResendCodeReasonClass. -func (r ResendCodeReasonUserRequest) construct() ResendCodeReasonClass { return &r } - -// Ensuring interfaces in compile-time for ResendCodeReasonUserRequest. -var ( - _ bin.Encoder = &ResendCodeReasonUserRequest{} - _ bin.Decoder = &ResendCodeReasonUserRequest{} - _ bin.BareEncoder = &ResendCodeReasonUserRequest{} - _ bin.BareDecoder = &ResendCodeReasonUserRequest{} - - _ ResendCodeReasonClass = &ResendCodeReasonUserRequest{} -) - -func (r *ResendCodeReasonUserRequest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResendCodeReasonUserRequest) String() string { - if r == nil { - return "ResendCodeReasonUserRequest(nil)" - } - type Alias ResendCodeReasonUserRequest - return fmt.Sprintf("ResendCodeReasonUserRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResendCodeReasonUserRequest) TypeID() uint32 { - return ResendCodeReasonUserRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResendCodeReasonUserRequest) TypeName() string { - return "resendCodeReasonUserRequest" -} - -// TypeInfo returns info about TL type. -func (r *ResendCodeReasonUserRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resendCodeReasonUserRequest", - ID: ResendCodeReasonUserRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ResendCodeReasonUserRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendCodeReasonUserRequest#e5a8c880 as nil") - } - b.PutID(ResendCodeReasonUserRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResendCodeReasonUserRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendCodeReasonUserRequest#e5a8c880 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResendCodeReasonUserRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendCodeReasonUserRequest#e5a8c880 to nil") - } - if err := b.ConsumeID(ResendCodeReasonUserRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resendCodeReasonUserRequest#e5a8c880: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResendCodeReasonUserRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendCodeReasonUserRequest#e5a8c880 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResendCodeReasonUserRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resendCodeReasonUserRequest#e5a8c880 as nil") - } - b.ObjStart() - b.PutID("resendCodeReasonUserRequest") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResendCodeReasonUserRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resendCodeReasonUserRequest#e5a8c880 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resendCodeReasonUserRequest"); err != nil { - return fmt.Errorf("unable to decode resendCodeReasonUserRequest#e5a8c880: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ResendCodeReasonVerificationFailed represents TL type `resendCodeReasonVerificationFailed#1f952dc1`. -type ResendCodeReasonVerificationFailed struct { - // Cause of the verification failure, for example, PLAY_SERVICES_NOT_AVAILABLE, - // APNS_RECEIVE_TIMEOUT, or APNS_INIT_FAILED - ErrorMessage string -} - -// ResendCodeReasonVerificationFailedTypeID is TL type id of ResendCodeReasonVerificationFailed. -const ResendCodeReasonVerificationFailedTypeID = 0x1f952dc1 - -// construct implements constructor of ResendCodeReasonClass. -func (r ResendCodeReasonVerificationFailed) construct() ResendCodeReasonClass { return &r } - -// Ensuring interfaces in compile-time for ResendCodeReasonVerificationFailed. -var ( - _ bin.Encoder = &ResendCodeReasonVerificationFailed{} - _ bin.Decoder = &ResendCodeReasonVerificationFailed{} - _ bin.BareEncoder = &ResendCodeReasonVerificationFailed{} - _ bin.BareDecoder = &ResendCodeReasonVerificationFailed{} - - _ ResendCodeReasonClass = &ResendCodeReasonVerificationFailed{} -) - -func (r *ResendCodeReasonVerificationFailed) Zero() bool { - if r == nil { - return true - } - if !(r.ErrorMessage == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResendCodeReasonVerificationFailed) String() string { - if r == nil { - return "ResendCodeReasonVerificationFailed(nil)" - } - type Alias ResendCodeReasonVerificationFailed - return fmt.Sprintf("ResendCodeReasonVerificationFailed%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResendCodeReasonVerificationFailed) TypeID() uint32 { - return ResendCodeReasonVerificationFailedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResendCodeReasonVerificationFailed) TypeName() string { - return "resendCodeReasonVerificationFailed" -} - -// TypeInfo returns info about TL type. -func (r *ResendCodeReasonVerificationFailed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resendCodeReasonVerificationFailed", - ID: ResendCodeReasonVerificationFailedTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ErrorMessage", - SchemaName: "error_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ResendCodeReasonVerificationFailed) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendCodeReasonVerificationFailed#1f952dc1 as nil") - } - b.PutID(ResendCodeReasonVerificationFailedTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResendCodeReasonVerificationFailed) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendCodeReasonVerificationFailed#1f952dc1 as nil") - } - b.PutString(r.ErrorMessage) - return nil -} - -// Decode implements bin.Decoder. -func (r *ResendCodeReasonVerificationFailed) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendCodeReasonVerificationFailed#1f952dc1 to nil") - } - if err := b.ConsumeID(ResendCodeReasonVerificationFailedTypeID); err != nil { - return fmt.Errorf("unable to decode resendCodeReasonVerificationFailed#1f952dc1: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResendCodeReasonVerificationFailed) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendCodeReasonVerificationFailed#1f952dc1 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode resendCodeReasonVerificationFailed#1f952dc1: field error_message: %w", err) - } - r.ErrorMessage = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResendCodeReasonVerificationFailed) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resendCodeReasonVerificationFailed#1f952dc1 as nil") - } - b.ObjStart() - b.PutID("resendCodeReasonVerificationFailed") - b.Comma() - b.FieldStart("error_message") - b.PutString(r.ErrorMessage) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResendCodeReasonVerificationFailed) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resendCodeReasonVerificationFailed#1f952dc1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resendCodeReasonVerificationFailed"); err != nil { - return fmt.Errorf("unable to decode resendCodeReasonVerificationFailed#1f952dc1: %w", err) - } - case "error_message": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode resendCodeReasonVerificationFailed#1f952dc1: field error_message: %w", err) - } - r.ErrorMessage = value - default: - return b.Skip() - } - return nil - }) -} - -// GetErrorMessage returns value of ErrorMessage field. -func (r *ResendCodeReasonVerificationFailed) GetErrorMessage() (value string) { - if r == nil { - return - } - return r.ErrorMessage -} - -// ResendCodeReasonClassName is schema name of ResendCodeReasonClass. -const ResendCodeReasonClassName = "ResendCodeReason" - -// ResendCodeReasonClass represents ResendCodeReason generic type. -// -// Example: -// -// g, err := tdapi.DecodeResendCodeReason(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ResendCodeReasonUserRequest: // resendCodeReasonUserRequest#e5a8c880 -// case *tdapi.ResendCodeReasonVerificationFailed: // resendCodeReasonVerificationFailed#1f952dc1 -// default: panic(v) -// } -type ResendCodeReasonClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ResendCodeReasonClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeResendCodeReason implements binary de-serialization for ResendCodeReasonClass. -func DecodeResendCodeReason(buf *bin.Buffer) (ResendCodeReasonClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ResendCodeReasonUserRequestTypeID: - // Decoding resendCodeReasonUserRequest#e5a8c880. - v := ResendCodeReasonUserRequest{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ResendCodeReasonClass: %w", err) - } - return &v, nil - case ResendCodeReasonVerificationFailedTypeID: - // Decoding resendCodeReasonVerificationFailed#1f952dc1. - v := ResendCodeReasonVerificationFailed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ResendCodeReasonClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ResendCodeReasonClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONResendCodeReason implements binary de-serialization for ResendCodeReasonClass. -func DecodeTDLibJSONResendCodeReason(buf tdjson.Decoder) (ResendCodeReasonClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "resendCodeReasonUserRequest": - // Decoding resendCodeReasonUserRequest#e5a8c880. - v := ResendCodeReasonUserRequest{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ResendCodeReasonClass: %w", err) - } - return &v, nil - case "resendCodeReasonVerificationFailed": - // Decoding resendCodeReasonVerificationFailed#1f952dc1. - v := ResendCodeReasonVerificationFailed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ResendCodeReasonClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ResendCodeReasonClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ResendCodeReason boxes the ResendCodeReasonClass providing a helper. -type ResendCodeReasonBox struct { - ResendCodeReason ResendCodeReasonClass -} - -// Decode implements bin.Decoder for ResendCodeReasonBox. -func (b *ResendCodeReasonBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ResendCodeReasonBox to nil") - } - v, err := DecodeResendCodeReason(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ResendCodeReason = v - return nil -} - -// Encode implements bin.Encode for ResendCodeReasonBox. -func (b *ResendCodeReasonBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ResendCodeReason == nil { - return fmt.Errorf("unable to encode ResendCodeReasonClass as nil") - } - return b.ResendCodeReason.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ResendCodeReasonBox. -func (b *ResendCodeReasonBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ResendCodeReasonBox to nil") - } - v, err := DecodeTDLibJSONResendCodeReason(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ResendCodeReason = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ResendCodeReasonBox. -func (b *ResendCodeReasonBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ResendCodeReason == nil { - return fmt.Errorf("unable to encode ResendCodeReasonClass as nil") - } - return b.ResendCodeReason.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_resend_email_address_verification_code_gen.go b/tdapi/tl_resend_email_address_verification_code_gen.go deleted file mode 100644 index 79d5beaf4..000000000 --- a/tdapi/tl_resend_email_address_verification_code_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResendEmailAddressVerificationCodeRequest represents TL type `resendEmailAddressVerificationCode#90653024`. -type ResendEmailAddressVerificationCodeRequest struct { -} - -// ResendEmailAddressVerificationCodeRequestTypeID is TL type id of ResendEmailAddressVerificationCodeRequest. -const ResendEmailAddressVerificationCodeRequestTypeID = 0x90653024 - -// Ensuring interfaces in compile-time for ResendEmailAddressVerificationCodeRequest. -var ( - _ bin.Encoder = &ResendEmailAddressVerificationCodeRequest{} - _ bin.Decoder = &ResendEmailAddressVerificationCodeRequest{} - _ bin.BareEncoder = &ResendEmailAddressVerificationCodeRequest{} - _ bin.BareDecoder = &ResendEmailAddressVerificationCodeRequest{} -) - -func (r *ResendEmailAddressVerificationCodeRequest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResendEmailAddressVerificationCodeRequest) String() string { - if r == nil { - return "ResendEmailAddressVerificationCodeRequest(nil)" - } - type Alias ResendEmailAddressVerificationCodeRequest - return fmt.Sprintf("ResendEmailAddressVerificationCodeRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResendEmailAddressVerificationCodeRequest) TypeID() uint32 { - return ResendEmailAddressVerificationCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResendEmailAddressVerificationCodeRequest) TypeName() string { - return "resendEmailAddressVerificationCode" -} - -// TypeInfo returns info about TL type. -func (r *ResendEmailAddressVerificationCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resendEmailAddressVerificationCode", - ID: ResendEmailAddressVerificationCodeRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ResendEmailAddressVerificationCodeRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendEmailAddressVerificationCode#90653024 as nil") - } - b.PutID(ResendEmailAddressVerificationCodeRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResendEmailAddressVerificationCodeRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendEmailAddressVerificationCode#90653024 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResendEmailAddressVerificationCodeRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendEmailAddressVerificationCode#90653024 to nil") - } - if err := b.ConsumeID(ResendEmailAddressVerificationCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resendEmailAddressVerificationCode#90653024: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResendEmailAddressVerificationCodeRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendEmailAddressVerificationCode#90653024 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResendEmailAddressVerificationCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resendEmailAddressVerificationCode#90653024 as nil") - } - b.ObjStart() - b.PutID("resendEmailAddressVerificationCode") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResendEmailAddressVerificationCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resendEmailAddressVerificationCode#90653024 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resendEmailAddressVerificationCode"); err != nil { - return fmt.Errorf("unable to decode resendEmailAddressVerificationCode#90653024: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ResendEmailAddressVerificationCode invokes method resendEmailAddressVerificationCode#90653024 returning error if any. -func (c *Client) ResendEmailAddressVerificationCode(ctx context.Context) (*EmailAddressAuthenticationCodeInfo, error) { - var result EmailAddressAuthenticationCodeInfo - - request := &ResendEmailAddressVerificationCodeRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_resend_login_email_address_code_gen.go b/tdapi/tl_resend_login_email_address_code_gen.go deleted file mode 100644 index 4a15131bb..000000000 --- a/tdapi/tl_resend_login_email_address_code_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResendLoginEmailAddressCodeRequest represents TL type `resendLoginEmailAddressCode#11765215`. -type ResendLoginEmailAddressCodeRequest struct { -} - -// ResendLoginEmailAddressCodeRequestTypeID is TL type id of ResendLoginEmailAddressCodeRequest. -const ResendLoginEmailAddressCodeRequestTypeID = 0x11765215 - -// Ensuring interfaces in compile-time for ResendLoginEmailAddressCodeRequest. -var ( - _ bin.Encoder = &ResendLoginEmailAddressCodeRequest{} - _ bin.Decoder = &ResendLoginEmailAddressCodeRequest{} - _ bin.BareEncoder = &ResendLoginEmailAddressCodeRequest{} - _ bin.BareDecoder = &ResendLoginEmailAddressCodeRequest{} -) - -func (r *ResendLoginEmailAddressCodeRequest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResendLoginEmailAddressCodeRequest) String() string { - if r == nil { - return "ResendLoginEmailAddressCodeRequest(nil)" - } - type Alias ResendLoginEmailAddressCodeRequest - return fmt.Sprintf("ResendLoginEmailAddressCodeRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResendLoginEmailAddressCodeRequest) TypeID() uint32 { - return ResendLoginEmailAddressCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResendLoginEmailAddressCodeRequest) TypeName() string { - return "resendLoginEmailAddressCode" -} - -// TypeInfo returns info about TL type. -func (r *ResendLoginEmailAddressCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resendLoginEmailAddressCode", - ID: ResendLoginEmailAddressCodeRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ResendLoginEmailAddressCodeRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendLoginEmailAddressCode#11765215 as nil") - } - b.PutID(ResendLoginEmailAddressCodeRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResendLoginEmailAddressCodeRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendLoginEmailAddressCode#11765215 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResendLoginEmailAddressCodeRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendLoginEmailAddressCode#11765215 to nil") - } - if err := b.ConsumeID(ResendLoginEmailAddressCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resendLoginEmailAddressCode#11765215: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResendLoginEmailAddressCodeRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendLoginEmailAddressCode#11765215 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResendLoginEmailAddressCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resendLoginEmailAddressCode#11765215 as nil") - } - b.ObjStart() - b.PutID("resendLoginEmailAddressCode") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResendLoginEmailAddressCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resendLoginEmailAddressCode#11765215 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resendLoginEmailAddressCode"); err != nil { - return fmt.Errorf("unable to decode resendLoginEmailAddressCode#11765215: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ResendLoginEmailAddressCode invokes method resendLoginEmailAddressCode#11765215 returning error if any. -func (c *Client) ResendLoginEmailAddressCode(ctx context.Context) (*EmailAddressAuthenticationCodeInfo, error) { - var result EmailAddressAuthenticationCodeInfo - - request := &ResendLoginEmailAddressCodeRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_resend_messages_gen.go b/tdapi/tl_resend_messages_gen.go deleted file mode 100644 index 00505c945..000000000 --- a/tdapi/tl_resend_messages_gen.go +++ /dev/null @@ -1,298 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResendMessagesRequest represents TL type `resendMessages#90e36776`. -type ResendMessagesRequest struct { - // Identifier of the chat to send messages - ChatID int64 - // Identifiers of the messages to resend. Message identifiers must be in a strictly - // increasing order - MessageIDs []int64 - // New manually chosen quote from the message to be replied; pass null if none. Ignored - // if more than one message is re-sent, or if messageSendingStateFailed - // need_another_reply_quote == false - Quote InputTextQuote -} - -// ResendMessagesRequestTypeID is TL type id of ResendMessagesRequest. -const ResendMessagesRequestTypeID = 0x90e36776 - -// Ensuring interfaces in compile-time for ResendMessagesRequest. -var ( - _ bin.Encoder = &ResendMessagesRequest{} - _ bin.Decoder = &ResendMessagesRequest{} - _ bin.BareEncoder = &ResendMessagesRequest{} - _ bin.BareDecoder = &ResendMessagesRequest{} -) - -func (r *ResendMessagesRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.MessageIDs == nil) { - return false - } - if !(r.Quote.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResendMessagesRequest) String() string { - if r == nil { - return "ResendMessagesRequest(nil)" - } - type Alias ResendMessagesRequest - return fmt.Sprintf("ResendMessagesRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResendMessagesRequest) TypeID() uint32 { - return ResendMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResendMessagesRequest) TypeName() string { - return "resendMessages" -} - -// TypeInfo returns info about TL type. -func (r *ResendMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resendMessages", - ID: ResendMessagesRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageIDs", - SchemaName: "message_ids", - }, - { - Name: "Quote", - SchemaName: "quote", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ResendMessagesRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendMessages#90e36776 as nil") - } - b.PutID(ResendMessagesRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResendMessagesRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendMessages#90e36776 as nil") - } - b.PutInt53(r.ChatID) - b.PutInt(len(r.MessageIDs)) - for _, v := range r.MessageIDs { - b.PutInt53(v) - } - if err := r.Quote.Encode(b); err != nil { - return fmt.Errorf("unable to encode resendMessages#90e36776: field quote: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResendMessagesRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendMessages#90e36776 to nil") - } - if err := b.ConsumeID(ResendMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resendMessages#90e36776: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResendMessagesRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendMessages#90e36776 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode resendMessages#90e36776: field chat_id: %w", err) - } - r.ChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode resendMessages#90e36776: field message_ids: %w", err) - } - - if headerLen > 0 { - r.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode resendMessages#90e36776: field message_ids: %w", err) - } - r.MessageIDs = append(r.MessageIDs, value) - } - } - { - if err := r.Quote.Decode(b); err != nil { - return fmt.Errorf("unable to decode resendMessages#90e36776: field quote: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResendMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resendMessages#90e36776 as nil") - } - b.ObjStart() - b.PutID("resendMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("message_ids") - b.ArrStart() - for _, v := range r.MessageIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("quote") - if err := r.Quote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode resendMessages#90e36776: field quote: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResendMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resendMessages#90e36776 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resendMessages"); err != nil { - return fmt.Errorf("unable to decode resendMessages#90e36776: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode resendMessages#90e36776: field chat_id: %w", err) - } - r.ChatID = value - case "message_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode resendMessages#90e36776: field message_ids: %w", err) - } - r.MessageIDs = append(r.MessageIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode resendMessages#90e36776: field message_ids: %w", err) - } - case "quote": - if err := r.Quote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode resendMessages#90e36776: field quote: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *ResendMessagesRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetMessageIDs returns value of MessageIDs field. -func (r *ResendMessagesRequest) GetMessageIDs() (value []int64) { - if r == nil { - return - } - return r.MessageIDs -} - -// GetQuote returns value of Quote field. -func (r *ResendMessagesRequest) GetQuote() (value InputTextQuote) { - if r == nil { - return - } - return r.Quote -} - -// ResendMessages invokes method resendMessages#90e36776 returning error if any. -func (c *Client) ResendMessages(ctx context.Context, request *ResendMessagesRequest) (*Messages, error) { - var result Messages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_resend_phone_number_code_gen.go b/tdapi/tl_resend_phone_number_code_gen.go deleted file mode 100644 index 23f7e0f1c..000000000 --- a/tdapi/tl_resend_phone_number_code_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResendPhoneNumberCodeRequest represents TL type `resendPhoneNumberCode#6bcea427`. -type ResendPhoneNumberCodeRequest struct { - // Reason of code resending; pass null if unknown - Reason ResendCodeReasonClass -} - -// ResendPhoneNumberCodeRequestTypeID is TL type id of ResendPhoneNumberCodeRequest. -const ResendPhoneNumberCodeRequestTypeID = 0x6bcea427 - -// Ensuring interfaces in compile-time for ResendPhoneNumberCodeRequest. -var ( - _ bin.Encoder = &ResendPhoneNumberCodeRequest{} - _ bin.Decoder = &ResendPhoneNumberCodeRequest{} - _ bin.BareEncoder = &ResendPhoneNumberCodeRequest{} - _ bin.BareDecoder = &ResendPhoneNumberCodeRequest{} -) - -func (r *ResendPhoneNumberCodeRequest) Zero() bool { - if r == nil { - return true - } - if !(r.Reason == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResendPhoneNumberCodeRequest) String() string { - if r == nil { - return "ResendPhoneNumberCodeRequest(nil)" - } - type Alias ResendPhoneNumberCodeRequest - return fmt.Sprintf("ResendPhoneNumberCodeRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResendPhoneNumberCodeRequest) TypeID() uint32 { - return ResendPhoneNumberCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResendPhoneNumberCodeRequest) TypeName() string { - return "resendPhoneNumberCode" -} - -// TypeInfo returns info about TL type. -func (r *ResendPhoneNumberCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resendPhoneNumberCode", - ID: ResendPhoneNumberCodeRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Reason", - SchemaName: "reason", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ResendPhoneNumberCodeRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendPhoneNumberCode#6bcea427 as nil") - } - b.PutID(ResendPhoneNumberCodeRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResendPhoneNumberCodeRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendPhoneNumberCode#6bcea427 as nil") - } - if r.Reason == nil { - return fmt.Errorf("unable to encode resendPhoneNumberCode#6bcea427: field reason is nil") - } - if err := r.Reason.Encode(b); err != nil { - return fmt.Errorf("unable to encode resendPhoneNumberCode#6bcea427: field reason: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResendPhoneNumberCodeRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendPhoneNumberCode#6bcea427 to nil") - } - if err := b.ConsumeID(ResendPhoneNumberCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resendPhoneNumberCode#6bcea427: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResendPhoneNumberCodeRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendPhoneNumberCode#6bcea427 to nil") - } - { - value, err := DecodeResendCodeReason(b) - if err != nil { - return fmt.Errorf("unable to decode resendPhoneNumberCode#6bcea427: field reason: %w", err) - } - r.Reason = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResendPhoneNumberCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resendPhoneNumberCode#6bcea427 as nil") - } - b.ObjStart() - b.PutID("resendPhoneNumberCode") - b.Comma() - b.FieldStart("reason") - if r.Reason == nil { - return fmt.Errorf("unable to encode resendPhoneNumberCode#6bcea427: field reason is nil") - } - if err := r.Reason.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode resendPhoneNumberCode#6bcea427: field reason: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResendPhoneNumberCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resendPhoneNumberCode#6bcea427 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resendPhoneNumberCode"); err != nil { - return fmt.Errorf("unable to decode resendPhoneNumberCode#6bcea427: %w", err) - } - case "reason": - value, err := DecodeTDLibJSONResendCodeReason(b) - if err != nil { - return fmt.Errorf("unable to decode resendPhoneNumberCode#6bcea427: field reason: %w", err) - } - r.Reason = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReason returns value of Reason field. -func (r *ResendPhoneNumberCodeRequest) GetReason() (value ResendCodeReasonClass) { - if r == nil { - return - } - return r.Reason -} - -// ResendPhoneNumberCode invokes method resendPhoneNumberCode#6bcea427 returning error if any. -func (c *Client) ResendPhoneNumberCode(ctx context.Context, reason ResendCodeReasonClass) (*AuthenticationCodeInfo, error) { - var result AuthenticationCodeInfo - - request := &ResendPhoneNumberCodeRequest{ - Reason: reason, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_resend_recovery_email_address_code_gen.go b/tdapi/tl_resend_recovery_email_address_code_gen.go deleted file mode 100644 index dbf54bdab..000000000 --- a/tdapi/tl_resend_recovery_email_address_code_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResendRecoveryEmailAddressCodeRequest represents TL type `resendRecoveryEmailAddressCode#19d66f1c`. -type ResendRecoveryEmailAddressCodeRequest struct { -} - -// ResendRecoveryEmailAddressCodeRequestTypeID is TL type id of ResendRecoveryEmailAddressCodeRequest. -const ResendRecoveryEmailAddressCodeRequestTypeID = 0x19d66f1c - -// Ensuring interfaces in compile-time for ResendRecoveryEmailAddressCodeRequest. -var ( - _ bin.Encoder = &ResendRecoveryEmailAddressCodeRequest{} - _ bin.Decoder = &ResendRecoveryEmailAddressCodeRequest{} - _ bin.BareEncoder = &ResendRecoveryEmailAddressCodeRequest{} - _ bin.BareDecoder = &ResendRecoveryEmailAddressCodeRequest{} -) - -func (r *ResendRecoveryEmailAddressCodeRequest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResendRecoveryEmailAddressCodeRequest) String() string { - if r == nil { - return "ResendRecoveryEmailAddressCodeRequest(nil)" - } - type Alias ResendRecoveryEmailAddressCodeRequest - return fmt.Sprintf("ResendRecoveryEmailAddressCodeRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResendRecoveryEmailAddressCodeRequest) TypeID() uint32 { - return ResendRecoveryEmailAddressCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResendRecoveryEmailAddressCodeRequest) TypeName() string { - return "resendRecoveryEmailAddressCode" -} - -// TypeInfo returns info about TL type. -func (r *ResendRecoveryEmailAddressCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resendRecoveryEmailAddressCode", - ID: ResendRecoveryEmailAddressCodeRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ResendRecoveryEmailAddressCodeRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendRecoveryEmailAddressCode#19d66f1c as nil") - } - b.PutID(ResendRecoveryEmailAddressCodeRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResendRecoveryEmailAddressCodeRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resendRecoveryEmailAddressCode#19d66f1c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResendRecoveryEmailAddressCodeRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendRecoveryEmailAddressCode#19d66f1c to nil") - } - if err := b.ConsumeID(ResendRecoveryEmailAddressCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resendRecoveryEmailAddressCode#19d66f1c: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResendRecoveryEmailAddressCodeRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resendRecoveryEmailAddressCode#19d66f1c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResendRecoveryEmailAddressCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resendRecoveryEmailAddressCode#19d66f1c as nil") - } - b.ObjStart() - b.PutID("resendRecoveryEmailAddressCode") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResendRecoveryEmailAddressCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resendRecoveryEmailAddressCode#19d66f1c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resendRecoveryEmailAddressCode"); err != nil { - return fmt.Errorf("unable to decode resendRecoveryEmailAddressCode#19d66f1c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ResendRecoveryEmailAddressCode invokes method resendRecoveryEmailAddressCode#19d66f1c returning error if any. -func (c *Client) ResendRecoveryEmailAddressCode(ctx context.Context) (*PasswordState, error) { - var result PasswordState - - request := &ResendRecoveryEmailAddressCodeRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_reset_all_notification_settings_gen.go b/tdapi/tl_reset_all_notification_settings_gen.go deleted file mode 100644 index 0d183548f..000000000 --- a/tdapi/tl_reset_all_notification_settings_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResetAllNotificationSettingsRequest represents TL type `resetAllNotificationSettings#f5a0a8f9`. -type ResetAllNotificationSettingsRequest struct { -} - -// ResetAllNotificationSettingsRequestTypeID is TL type id of ResetAllNotificationSettingsRequest. -const ResetAllNotificationSettingsRequestTypeID = 0xf5a0a8f9 - -// Ensuring interfaces in compile-time for ResetAllNotificationSettingsRequest. -var ( - _ bin.Encoder = &ResetAllNotificationSettingsRequest{} - _ bin.Decoder = &ResetAllNotificationSettingsRequest{} - _ bin.BareEncoder = &ResetAllNotificationSettingsRequest{} - _ bin.BareDecoder = &ResetAllNotificationSettingsRequest{} -) - -func (r *ResetAllNotificationSettingsRequest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResetAllNotificationSettingsRequest) String() string { - if r == nil { - return "ResetAllNotificationSettingsRequest(nil)" - } - type Alias ResetAllNotificationSettingsRequest - return fmt.Sprintf("ResetAllNotificationSettingsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResetAllNotificationSettingsRequest) TypeID() uint32 { - return ResetAllNotificationSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResetAllNotificationSettingsRequest) TypeName() string { - return "resetAllNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (r *ResetAllNotificationSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resetAllNotificationSettings", - ID: ResetAllNotificationSettingsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ResetAllNotificationSettingsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetAllNotificationSettings#f5a0a8f9 as nil") - } - b.PutID(ResetAllNotificationSettingsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResetAllNotificationSettingsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetAllNotificationSettings#f5a0a8f9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResetAllNotificationSettingsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetAllNotificationSettings#f5a0a8f9 to nil") - } - if err := b.ConsumeID(ResetAllNotificationSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resetAllNotificationSettings#f5a0a8f9: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResetAllNotificationSettingsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetAllNotificationSettings#f5a0a8f9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResetAllNotificationSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resetAllNotificationSettings#f5a0a8f9 as nil") - } - b.ObjStart() - b.PutID("resetAllNotificationSettings") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResetAllNotificationSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resetAllNotificationSettings#f5a0a8f9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resetAllNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode resetAllNotificationSettings#f5a0a8f9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ResetAllNotificationSettings invokes method resetAllNotificationSettings#f5a0a8f9 returning error if any. -func (c *Client) ResetAllNotificationSettings(ctx context.Context) error { - var ok Ok - - request := &ResetAllNotificationSettingsRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reset_authentication_email_address_gen.go b/tdapi/tl_reset_authentication_email_address_gen.go deleted file mode 100644 index 499e176f3..000000000 --- a/tdapi/tl_reset_authentication_email_address_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResetAuthenticationEmailAddressRequest represents TL type `resetAuthenticationEmailAddress#e742722c`. -type ResetAuthenticationEmailAddressRequest struct { -} - -// ResetAuthenticationEmailAddressRequestTypeID is TL type id of ResetAuthenticationEmailAddressRequest. -const ResetAuthenticationEmailAddressRequestTypeID = 0xe742722c - -// Ensuring interfaces in compile-time for ResetAuthenticationEmailAddressRequest. -var ( - _ bin.Encoder = &ResetAuthenticationEmailAddressRequest{} - _ bin.Decoder = &ResetAuthenticationEmailAddressRequest{} - _ bin.BareEncoder = &ResetAuthenticationEmailAddressRequest{} - _ bin.BareDecoder = &ResetAuthenticationEmailAddressRequest{} -) - -func (r *ResetAuthenticationEmailAddressRequest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResetAuthenticationEmailAddressRequest) String() string { - if r == nil { - return "ResetAuthenticationEmailAddressRequest(nil)" - } - type Alias ResetAuthenticationEmailAddressRequest - return fmt.Sprintf("ResetAuthenticationEmailAddressRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResetAuthenticationEmailAddressRequest) TypeID() uint32 { - return ResetAuthenticationEmailAddressRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResetAuthenticationEmailAddressRequest) TypeName() string { - return "resetAuthenticationEmailAddress" -} - -// TypeInfo returns info about TL type. -func (r *ResetAuthenticationEmailAddressRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resetAuthenticationEmailAddress", - ID: ResetAuthenticationEmailAddressRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ResetAuthenticationEmailAddressRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetAuthenticationEmailAddress#e742722c as nil") - } - b.PutID(ResetAuthenticationEmailAddressRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResetAuthenticationEmailAddressRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetAuthenticationEmailAddress#e742722c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResetAuthenticationEmailAddressRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetAuthenticationEmailAddress#e742722c to nil") - } - if err := b.ConsumeID(ResetAuthenticationEmailAddressRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resetAuthenticationEmailAddress#e742722c: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResetAuthenticationEmailAddressRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetAuthenticationEmailAddress#e742722c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResetAuthenticationEmailAddressRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resetAuthenticationEmailAddress#e742722c as nil") - } - b.ObjStart() - b.PutID("resetAuthenticationEmailAddress") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResetAuthenticationEmailAddressRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resetAuthenticationEmailAddress#e742722c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resetAuthenticationEmailAddress"); err != nil { - return fmt.Errorf("unable to decode resetAuthenticationEmailAddress#e742722c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ResetAuthenticationEmailAddress invokes method resetAuthenticationEmailAddress#e742722c returning error if any. -func (c *Client) ResetAuthenticationEmailAddress(ctx context.Context) error { - var ok Ok - - request := &ResetAuthenticationEmailAddressRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reset_installed_backgrounds_gen.go b/tdapi/tl_reset_installed_backgrounds_gen.go deleted file mode 100644 index 9950b366e..000000000 --- a/tdapi/tl_reset_installed_backgrounds_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResetInstalledBackgroundsRequest represents TL type `resetInstalledBackgrounds#70540157`. -type ResetInstalledBackgroundsRequest struct { -} - -// ResetInstalledBackgroundsRequestTypeID is TL type id of ResetInstalledBackgroundsRequest. -const ResetInstalledBackgroundsRequestTypeID = 0x70540157 - -// Ensuring interfaces in compile-time for ResetInstalledBackgroundsRequest. -var ( - _ bin.Encoder = &ResetInstalledBackgroundsRequest{} - _ bin.Decoder = &ResetInstalledBackgroundsRequest{} - _ bin.BareEncoder = &ResetInstalledBackgroundsRequest{} - _ bin.BareDecoder = &ResetInstalledBackgroundsRequest{} -) - -func (r *ResetInstalledBackgroundsRequest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResetInstalledBackgroundsRequest) String() string { - if r == nil { - return "ResetInstalledBackgroundsRequest(nil)" - } - type Alias ResetInstalledBackgroundsRequest - return fmt.Sprintf("ResetInstalledBackgroundsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResetInstalledBackgroundsRequest) TypeID() uint32 { - return ResetInstalledBackgroundsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResetInstalledBackgroundsRequest) TypeName() string { - return "resetInstalledBackgrounds" -} - -// TypeInfo returns info about TL type. -func (r *ResetInstalledBackgroundsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resetInstalledBackgrounds", - ID: ResetInstalledBackgroundsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ResetInstalledBackgroundsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetInstalledBackgrounds#70540157 as nil") - } - b.PutID(ResetInstalledBackgroundsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResetInstalledBackgroundsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetInstalledBackgrounds#70540157 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResetInstalledBackgroundsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetInstalledBackgrounds#70540157 to nil") - } - if err := b.ConsumeID(ResetInstalledBackgroundsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resetInstalledBackgrounds#70540157: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResetInstalledBackgroundsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetInstalledBackgrounds#70540157 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResetInstalledBackgroundsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resetInstalledBackgrounds#70540157 as nil") - } - b.ObjStart() - b.PutID("resetInstalledBackgrounds") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResetInstalledBackgroundsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resetInstalledBackgrounds#70540157 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resetInstalledBackgrounds"); err != nil { - return fmt.Errorf("unable to decode resetInstalledBackgrounds#70540157: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ResetInstalledBackgrounds invokes method resetInstalledBackgrounds#70540157 returning error if any. -func (c *Client) ResetInstalledBackgrounds(ctx context.Context) error { - var ok Ok - - request := &ResetInstalledBackgroundsRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reset_network_statistics_gen.go b/tdapi/tl_reset_network_statistics_gen.go deleted file mode 100644 index 7d9fb593f..000000000 --- a/tdapi/tl_reset_network_statistics_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResetNetworkStatisticsRequest represents TL type `resetNetworkStatistics#6222dd86`. -type ResetNetworkStatisticsRequest struct { -} - -// ResetNetworkStatisticsRequestTypeID is TL type id of ResetNetworkStatisticsRequest. -const ResetNetworkStatisticsRequestTypeID = 0x6222dd86 - -// Ensuring interfaces in compile-time for ResetNetworkStatisticsRequest. -var ( - _ bin.Encoder = &ResetNetworkStatisticsRequest{} - _ bin.Decoder = &ResetNetworkStatisticsRequest{} - _ bin.BareEncoder = &ResetNetworkStatisticsRequest{} - _ bin.BareDecoder = &ResetNetworkStatisticsRequest{} -) - -func (r *ResetNetworkStatisticsRequest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResetNetworkStatisticsRequest) String() string { - if r == nil { - return "ResetNetworkStatisticsRequest(nil)" - } - type Alias ResetNetworkStatisticsRequest - return fmt.Sprintf("ResetNetworkStatisticsRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResetNetworkStatisticsRequest) TypeID() uint32 { - return ResetNetworkStatisticsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResetNetworkStatisticsRequest) TypeName() string { - return "resetNetworkStatistics" -} - -// TypeInfo returns info about TL type. -func (r *ResetNetworkStatisticsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resetNetworkStatistics", - ID: ResetNetworkStatisticsRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ResetNetworkStatisticsRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetNetworkStatistics#6222dd86 as nil") - } - b.PutID(ResetNetworkStatisticsRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResetNetworkStatisticsRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetNetworkStatistics#6222dd86 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResetNetworkStatisticsRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetNetworkStatistics#6222dd86 to nil") - } - if err := b.ConsumeID(ResetNetworkStatisticsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resetNetworkStatistics#6222dd86: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResetNetworkStatisticsRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetNetworkStatistics#6222dd86 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResetNetworkStatisticsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resetNetworkStatistics#6222dd86 as nil") - } - b.ObjStart() - b.PutID("resetNetworkStatistics") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResetNetworkStatisticsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resetNetworkStatistics#6222dd86 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resetNetworkStatistics"); err != nil { - return fmt.Errorf("unable to decode resetNetworkStatistics#6222dd86: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ResetNetworkStatistics invokes method resetNetworkStatistics#6222dd86 returning error if any. -func (c *Client) ResetNetworkStatistics(ctx context.Context) error { - var ok Ok - - request := &ResetNetworkStatisticsRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_reset_password_gen.go b/tdapi/tl_reset_password_gen.go deleted file mode 100644 index 8cd9a07d9..000000000 --- a/tdapi/tl_reset_password_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResetPasswordRequest represents TL type `resetPassword#dc9e8c9d`. -type ResetPasswordRequest struct { -} - -// ResetPasswordRequestTypeID is TL type id of ResetPasswordRequest. -const ResetPasswordRequestTypeID = 0xdc9e8c9d - -// Ensuring interfaces in compile-time for ResetPasswordRequest. -var ( - _ bin.Encoder = &ResetPasswordRequest{} - _ bin.Decoder = &ResetPasswordRequest{} - _ bin.BareEncoder = &ResetPasswordRequest{} - _ bin.BareDecoder = &ResetPasswordRequest{} -) - -func (r *ResetPasswordRequest) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResetPasswordRequest) String() string { - if r == nil { - return "ResetPasswordRequest(nil)" - } - type Alias ResetPasswordRequest - return fmt.Sprintf("ResetPasswordRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResetPasswordRequest) TypeID() uint32 { - return ResetPasswordRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResetPasswordRequest) TypeName() string { - return "resetPassword" -} - -// TypeInfo returns info about TL type. -func (r *ResetPasswordRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resetPassword", - ID: ResetPasswordRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ResetPasswordRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetPassword#dc9e8c9d as nil") - } - b.PutID(ResetPasswordRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResetPasswordRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetPassword#dc9e8c9d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResetPasswordRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetPassword#dc9e8c9d to nil") - } - if err := b.ConsumeID(ResetPasswordRequestTypeID); err != nil { - return fmt.Errorf("unable to decode resetPassword#dc9e8c9d: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResetPasswordRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetPassword#dc9e8c9d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResetPasswordRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resetPassword#dc9e8c9d as nil") - } - b.ObjStart() - b.PutID("resetPassword") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResetPasswordRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resetPassword#dc9e8c9d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resetPassword"); err != nil { - return fmt.Errorf("unable to decode resetPassword#dc9e8c9d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ResetPassword invokes method resetPassword#dc9e8c9d returning error if any. -func (c *Client) ResetPassword(ctx context.Context) (ResetPasswordResultClass, error) { - var result ResetPasswordResultBox - - request := &ResetPasswordRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.ResetPasswordResult, nil -} diff --git a/tdapi/tl_reset_password_result_gen.go b/tdapi/tl_reset_password_result_gen.go deleted file mode 100644 index 347ef2867..000000000 --- a/tdapi/tl_reset_password_result_gen.go +++ /dev/null @@ -1,648 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ResetPasswordResultOk represents TL type `resetPasswordResultOk#acb763f9`. -type ResetPasswordResultOk struct { -} - -// ResetPasswordResultOkTypeID is TL type id of ResetPasswordResultOk. -const ResetPasswordResultOkTypeID = 0xacb763f9 - -// construct implements constructor of ResetPasswordResultClass. -func (r ResetPasswordResultOk) construct() ResetPasswordResultClass { return &r } - -// Ensuring interfaces in compile-time for ResetPasswordResultOk. -var ( - _ bin.Encoder = &ResetPasswordResultOk{} - _ bin.Decoder = &ResetPasswordResultOk{} - _ bin.BareEncoder = &ResetPasswordResultOk{} - _ bin.BareDecoder = &ResetPasswordResultOk{} - - _ ResetPasswordResultClass = &ResetPasswordResultOk{} -) - -func (r *ResetPasswordResultOk) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResetPasswordResultOk) String() string { - if r == nil { - return "ResetPasswordResultOk(nil)" - } - type Alias ResetPasswordResultOk - return fmt.Sprintf("ResetPasswordResultOk%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResetPasswordResultOk) TypeID() uint32 { - return ResetPasswordResultOkTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResetPasswordResultOk) TypeName() string { - return "resetPasswordResultOk" -} - -// TypeInfo returns info about TL type. -func (r *ResetPasswordResultOk) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resetPasswordResultOk", - ID: ResetPasswordResultOkTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *ResetPasswordResultOk) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetPasswordResultOk#acb763f9 as nil") - } - b.PutID(ResetPasswordResultOkTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResetPasswordResultOk) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetPasswordResultOk#acb763f9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *ResetPasswordResultOk) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetPasswordResultOk#acb763f9 to nil") - } - if err := b.ConsumeID(ResetPasswordResultOkTypeID); err != nil { - return fmt.Errorf("unable to decode resetPasswordResultOk#acb763f9: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResetPasswordResultOk) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetPasswordResultOk#acb763f9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResetPasswordResultOk) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resetPasswordResultOk#acb763f9 as nil") - } - b.ObjStart() - b.PutID("resetPasswordResultOk") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResetPasswordResultOk) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resetPasswordResultOk#acb763f9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resetPasswordResultOk"); err != nil { - return fmt.Errorf("unable to decode resetPasswordResultOk#acb763f9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ResetPasswordResultPending represents TL type `resetPasswordResultPending#4729dc59`. -type ResetPasswordResultPending struct { - // Point in time (Unix timestamp) after which the password can be reset immediately using - // resetPassword - PendingResetDate int32 -} - -// ResetPasswordResultPendingTypeID is TL type id of ResetPasswordResultPending. -const ResetPasswordResultPendingTypeID = 0x4729dc59 - -// construct implements constructor of ResetPasswordResultClass. -func (r ResetPasswordResultPending) construct() ResetPasswordResultClass { return &r } - -// Ensuring interfaces in compile-time for ResetPasswordResultPending. -var ( - _ bin.Encoder = &ResetPasswordResultPending{} - _ bin.Decoder = &ResetPasswordResultPending{} - _ bin.BareEncoder = &ResetPasswordResultPending{} - _ bin.BareDecoder = &ResetPasswordResultPending{} - - _ ResetPasswordResultClass = &ResetPasswordResultPending{} -) - -func (r *ResetPasswordResultPending) Zero() bool { - if r == nil { - return true - } - if !(r.PendingResetDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResetPasswordResultPending) String() string { - if r == nil { - return "ResetPasswordResultPending(nil)" - } - type Alias ResetPasswordResultPending - return fmt.Sprintf("ResetPasswordResultPending%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResetPasswordResultPending) TypeID() uint32 { - return ResetPasswordResultPendingTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResetPasswordResultPending) TypeName() string { - return "resetPasswordResultPending" -} - -// TypeInfo returns info about TL type. -func (r *ResetPasswordResultPending) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resetPasswordResultPending", - ID: ResetPasswordResultPendingTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PendingResetDate", - SchemaName: "pending_reset_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ResetPasswordResultPending) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetPasswordResultPending#4729dc59 as nil") - } - b.PutID(ResetPasswordResultPendingTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResetPasswordResultPending) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetPasswordResultPending#4729dc59 as nil") - } - b.PutInt32(r.PendingResetDate) - return nil -} - -// Decode implements bin.Decoder. -func (r *ResetPasswordResultPending) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetPasswordResultPending#4729dc59 to nil") - } - if err := b.ConsumeID(ResetPasswordResultPendingTypeID); err != nil { - return fmt.Errorf("unable to decode resetPasswordResultPending#4729dc59: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResetPasswordResultPending) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetPasswordResultPending#4729dc59 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode resetPasswordResultPending#4729dc59: field pending_reset_date: %w", err) - } - r.PendingResetDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResetPasswordResultPending) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resetPasswordResultPending#4729dc59 as nil") - } - b.ObjStart() - b.PutID("resetPasswordResultPending") - b.Comma() - b.FieldStart("pending_reset_date") - b.PutInt32(r.PendingResetDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResetPasswordResultPending) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resetPasswordResultPending#4729dc59 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resetPasswordResultPending"); err != nil { - return fmt.Errorf("unable to decode resetPasswordResultPending#4729dc59: %w", err) - } - case "pending_reset_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode resetPasswordResultPending#4729dc59: field pending_reset_date: %w", err) - } - r.PendingResetDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPendingResetDate returns value of PendingResetDate field. -func (r *ResetPasswordResultPending) GetPendingResetDate() (value int32) { - if r == nil { - return - } - return r.PendingResetDate -} - -// ResetPasswordResultDeclined represents TL type `resetPasswordResultDeclined#b857e0cb`. -type ResetPasswordResultDeclined struct { - // Point in time (Unix timestamp) when the password reset can be retried - RetryDate int32 -} - -// ResetPasswordResultDeclinedTypeID is TL type id of ResetPasswordResultDeclined. -const ResetPasswordResultDeclinedTypeID = 0xb857e0cb - -// construct implements constructor of ResetPasswordResultClass. -func (r ResetPasswordResultDeclined) construct() ResetPasswordResultClass { return &r } - -// Ensuring interfaces in compile-time for ResetPasswordResultDeclined. -var ( - _ bin.Encoder = &ResetPasswordResultDeclined{} - _ bin.Decoder = &ResetPasswordResultDeclined{} - _ bin.BareEncoder = &ResetPasswordResultDeclined{} - _ bin.BareDecoder = &ResetPasswordResultDeclined{} - - _ ResetPasswordResultClass = &ResetPasswordResultDeclined{} -) - -func (r *ResetPasswordResultDeclined) Zero() bool { - if r == nil { - return true - } - if !(r.RetryDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ResetPasswordResultDeclined) String() string { - if r == nil { - return "ResetPasswordResultDeclined(nil)" - } - type Alias ResetPasswordResultDeclined - return fmt.Sprintf("ResetPasswordResultDeclined%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ResetPasswordResultDeclined) TypeID() uint32 { - return ResetPasswordResultDeclinedTypeID -} - -// TypeName returns name of type in TL schema. -func (*ResetPasswordResultDeclined) TypeName() string { - return "resetPasswordResultDeclined" -} - -// TypeInfo returns info about TL type. -func (r *ResetPasswordResultDeclined) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "resetPasswordResultDeclined", - ID: ResetPasswordResultDeclinedTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RetryDate", - SchemaName: "retry_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ResetPasswordResultDeclined) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetPasswordResultDeclined#b857e0cb as nil") - } - b.PutID(ResetPasswordResultDeclinedTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ResetPasswordResultDeclined) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode resetPasswordResultDeclined#b857e0cb as nil") - } - b.PutInt32(r.RetryDate) - return nil -} - -// Decode implements bin.Decoder. -func (r *ResetPasswordResultDeclined) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetPasswordResultDeclined#b857e0cb to nil") - } - if err := b.ConsumeID(ResetPasswordResultDeclinedTypeID); err != nil { - return fmt.Errorf("unable to decode resetPasswordResultDeclined#b857e0cb: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ResetPasswordResultDeclined) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode resetPasswordResultDeclined#b857e0cb to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode resetPasswordResultDeclined#b857e0cb: field retry_date: %w", err) - } - r.RetryDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ResetPasswordResultDeclined) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode resetPasswordResultDeclined#b857e0cb as nil") - } - b.ObjStart() - b.PutID("resetPasswordResultDeclined") - b.Comma() - b.FieldStart("retry_date") - b.PutInt32(r.RetryDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ResetPasswordResultDeclined) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode resetPasswordResultDeclined#b857e0cb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("resetPasswordResultDeclined"); err != nil { - return fmt.Errorf("unable to decode resetPasswordResultDeclined#b857e0cb: %w", err) - } - case "retry_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode resetPasswordResultDeclined#b857e0cb: field retry_date: %w", err) - } - r.RetryDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRetryDate returns value of RetryDate field. -func (r *ResetPasswordResultDeclined) GetRetryDate() (value int32) { - if r == nil { - return - } - return r.RetryDate -} - -// ResetPasswordResultClassName is schema name of ResetPasswordResultClass. -const ResetPasswordResultClassName = "ResetPasswordResult" - -// ResetPasswordResultClass represents ResetPasswordResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeResetPasswordResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ResetPasswordResultOk: // resetPasswordResultOk#acb763f9 -// case *tdapi.ResetPasswordResultPending: // resetPasswordResultPending#4729dc59 -// case *tdapi.ResetPasswordResultDeclined: // resetPasswordResultDeclined#b857e0cb -// default: panic(v) -// } -type ResetPasswordResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ResetPasswordResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeResetPasswordResult implements binary de-serialization for ResetPasswordResultClass. -func DecodeResetPasswordResult(buf *bin.Buffer) (ResetPasswordResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ResetPasswordResultOkTypeID: - // Decoding resetPasswordResultOk#acb763f9. - v := ResetPasswordResultOk{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ResetPasswordResultClass: %w", err) - } - return &v, nil - case ResetPasswordResultPendingTypeID: - // Decoding resetPasswordResultPending#4729dc59. - v := ResetPasswordResultPending{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ResetPasswordResultClass: %w", err) - } - return &v, nil - case ResetPasswordResultDeclinedTypeID: - // Decoding resetPasswordResultDeclined#b857e0cb. - v := ResetPasswordResultDeclined{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ResetPasswordResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ResetPasswordResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONResetPasswordResult implements binary de-serialization for ResetPasswordResultClass. -func DecodeTDLibJSONResetPasswordResult(buf tdjson.Decoder) (ResetPasswordResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "resetPasswordResultOk": - // Decoding resetPasswordResultOk#acb763f9. - v := ResetPasswordResultOk{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ResetPasswordResultClass: %w", err) - } - return &v, nil - case "resetPasswordResultPending": - // Decoding resetPasswordResultPending#4729dc59. - v := ResetPasswordResultPending{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ResetPasswordResultClass: %w", err) - } - return &v, nil - case "resetPasswordResultDeclined": - // Decoding resetPasswordResultDeclined#b857e0cb. - v := ResetPasswordResultDeclined{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ResetPasswordResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ResetPasswordResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ResetPasswordResult boxes the ResetPasswordResultClass providing a helper. -type ResetPasswordResultBox struct { - ResetPasswordResult ResetPasswordResultClass -} - -// Decode implements bin.Decoder for ResetPasswordResultBox. -func (b *ResetPasswordResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ResetPasswordResultBox to nil") - } - v, err := DecodeResetPasswordResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ResetPasswordResult = v - return nil -} - -// Encode implements bin.Encode for ResetPasswordResultBox. -func (b *ResetPasswordResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ResetPasswordResult == nil { - return fmt.Errorf("unable to encode ResetPasswordResultClass as nil") - } - return b.ResetPasswordResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ResetPasswordResultBox. -func (b *ResetPasswordResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ResetPasswordResultBox to nil") - } - v, err := DecodeTDLibJSONResetPasswordResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ResetPasswordResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ResetPasswordResultBox. -func (b *ResetPasswordResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ResetPasswordResult == nil { - return fmt.Errorf("unable to encode ResetPasswordResultClass as nil") - } - return b.ResetPasswordResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_reuse_star_subscription_gen.go b/tdapi/tl_reuse_star_subscription_gen.go deleted file mode 100644 index eabeb2bc1..000000000 --- a/tdapi/tl_reuse_star_subscription_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ReuseStarSubscriptionRequest represents TL type `reuseStarSubscription#2e677441`. -type ReuseStarSubscriptionRequest struct { - // Identifier of the subscription - SubscriptionID string -} - -// ReuseStarSubscriptionRequestTypeID is TL type id of ReuseStarSubscriptionRequest. -const ReuseStarSubscriptionRequestTypeID = 0x2e677441 - -// Ensuring interfaces in compile-time for ReuseStarSubscriptionRequest. -var ( - _ bin.Encoder = &ReuseStarSubscriptionRequest{} - _ bin.Decoder = &ReuseStarSubscriptionRequest{} - _ bin.BareEncoder = &ReuseStarSubscriptionRequest{} - _ bin.BareDecoder = &ReuseStarSubscriptionRequest{} -) - -func (r *ReuseStarSubscriptionRequest) Zero() bool { - if r == nil { - return true - } - if !(r.SubscriptionID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *ReuseStarSubscriptionRequest) String() string { - if r == nil { - return "ReuseStarSubscriptionRequest(nil)" - } - type Alias ReuseStarSubscriptionRequest - return fmt.Sprintf("ReuseStarSubscriptionRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ReuseStarSubscriptionRequest) TypeID() uint32 { - return ReuseStarSubscriptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ReuseStarSubscriptionRequest) TypeName() string { - return "reuseStarSubscription" -} - -// TypeInfo returns info about TL type. -func (r *ReuseStarSubscriptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "reuseStarSubscription", - ID: ReuseStarSubscriptionRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SubscriptionID", - SchemaName: "subscription_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *ReuseStarSubscriptionRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reuseStarSubscription#2e677441 as nil") - } - b.PutID(ReuseStarSubscriptionRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *ReuseStarSubscriptionRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode reuseStarSubscription#2e677441 as nil") - } - b.PutString(r.SubscriptionID) - return nil -} - -// Decode implements bin.Decoder. -func (r *ReuseStarSubscriptionRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reuseStarSubscription#2e677441 to nil") - } - if err := b.ConsumeID(ReuseStarSubscriptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode reuseStarSubscription#2e677441: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *ReuseStarSubscriptionRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode reuseStarSubscription#2e677441 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reuseStarSubscription#2e677441: field subscription_id: %w", err) - } - r.SubscriptionID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *ReuseStarSubscriptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode reuseStarSubscription#2e677441 as nil") - } - b.ObjStart() - b.PutID("reuseStarSubscription") - b.Comma() - b.FieldStart("subscription_id") - b.PutString(r.SubscriptionID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *ReuseStarSubscriptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode reuseStarSubscription#2e677441 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("reuseStarSubscription"); err != nil { - return fmt.Errorf("unable to decode reuseStarSubscription#2e677441: %w", err) - } - case "subscription_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode reuseStarSubscription#2e677441: field subscription_id: %w", err) - } - r.SubscriptionID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSubscriptionID returns value of SubscriptionID field. -func (r *ReuseStarSubscriptionRequest) GetSubscriptionID() (value string) { - if r == nil { - return - } - return r.SubscriptionID -} - -// ReuseStarSubscription invokes method reuseStarSubscription#2e677441 returning error if any. -func (c *Client) ReuseStarSubscription(ctx context.Context, subscriptionid string) error { - var ok Ok - - request := &ReuseStarSubscriptionRequest{ - SubscriptionID: subscriptionid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_revenue_withdrawal_state_gen.go b/tdapi/tl_revenue_withdrawal_state_gen.go deleted file mode 100644 index 9e70511a7..000000000 --- a/tdapi/tl_revenue_withdrawal_state_gen.go +++ /dev/null @@ -1,646 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RevenueWithdrawalStatePending represents TL type `revenueWithdrawalStatePending#5d314fa5`. -type RevenueWithdrawalStatePending struct { -} - -// RevenueWithdrawalStatePendingTypeID is TL type id of RevenueWithdrawalStatePending. -const RevenueWithdrawalStatePendingTypeID = 0x5d314fa5 - -// construct implements constructor of RevenueWithdrawalStateClass. -func (r RevenueWithdrawalStatePending) construct() RevenueWithdrawalStateClass { return &r } - -// Ensuring interfaces in compile-time for RevenueWithdrawalStatePending. -var ( - _ bin.Encoder = &RevenueWithdrawalStatePending{} - _ bin.Decoder = &RevenueWithdrawalStatePending{} - _ bin.BareEncoder = &RevenueWithdrawalStatePending{} - _ bin.BareDecoder = &RevenueWithdrawalStatePending{} - - _ RevenueWithdrawalStateClass = &RevenueWithdrawalStatePending{} -) - -func (r *RevenueWithdrawalStatePending) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *RevenueWithdrawalStatePending) String() string { - if r == nil { - return "RevenueWithdrawalStatePending(nil)" - } - type Alias RevenueWithdrawalStatePending - return fmt.Sprintf("RevenueWithdrawalStatePending%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RevenueWithdrawalStatePending) TypeID() uint32 { - return RevenueWithdrawalStatePendingTypeID -} - -// TypeName returns name of type in TL schema. -func (*RevenueWithdrawalStatePending) TypeName() string { - return "revenueWithdrawalStatePending" -} - -// TypeInfo returns info about TL type. -func (r *RevenueWithdrawalStatePending) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "revenueWithdrawalStatePending", - ID: RevenueWithdrawalStatePendingTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *RevenueWithdrawalStatePending) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode revenueWithdrawalStatePending#5d314fa5 as nil") - } - b.PutID(RevenueWithdrawalStatePendingTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RevenueWithdrawalStatePending) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode revenueWithdrawalStatePending#5d314fa5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RevenueWithdrawalStatePending) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode revenueWithdrawalStatePending#5d314fa5 to nil") - } - if err := b.ConsumeID(RevenueWithdrawalStatePendingTypeID); err != nil { - return fmt.Errorf("unable to decode revenueWithdrawalStatePending#5d314fa5: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RevenueWithdrawalStatePending) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode revenueWithdrawalStatePending#5d314fa5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RevenueWithdrawalStatePending) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode revenueWithdrawalStatePending#5d314fa5 as nil") - } - b.ObjStart() - b.PutID("revenueWithdrawalStatePending") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RevenueWithdrawalStatePending) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode revenueWithdrawalStatePending#5d314fa5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("revenueWithdrawalStatePending"); err != nil { - return fmt.Errorf("unable to decode revenueWithdrawalStatePending#5d314fa5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// RevenueWithdrawalStateSucceeded represents TL type `revenueWithdrawalStateSucceeded#fd14e0a`. -type RevenueWithdrawalStateSucceeded struct { - // Point in time (Unix timestamp) when the withdrawal was completed - Date int32 - // The URL where the withdrawal transaction can be viewed - URL string -} - -// RevenueWithdrawalStateSucceededTypeID is TL type id of RevenueWithdrawalStateSucceeded. -const RevenueWithdrawalStateSucceededTypeID = 0xfd14e0a - -// construct implements constructor of RevenueWithdrawalStateClass. -func (r RevenueWithdrawalStateSucceeded) construct() RevenueWithdrawalStateClass { return &r } - -// Ensuring interfaces in compile-time for RevenueWithdrawalStateSucceeded. -var ( - _ bin.Encoder = &RevenueWithdrawalStateSucceeded{} - _ bin.Decoder = &RevenueWithdrawalStateSucceeded{} - _ bin.BareEncoder = &RevenueWithdrawalStateSucceeded{} - _ bin.BareDecoder = &RevenueWithdrawalStateSucceeded{} - - _ RevenueWithdrawalStateClass = &RevenueWithdrawalStateSucceeded{} -) - -func (r *RevenueWithdrawalStateSucceeded) Zero() bool { - if r == nil { - return true - } - if !(r.Date == 0) { - return false - } - if !(r.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RevenueWithdrawalStateSucceeded) String() string { - if r == nil { - return "RevenueWithdrawalStateSucceeded(nil)" - } - type Alias RevenueWithdrawalStateSucceeded - return fmt.Sprintf("RevenueWithdrawalStateSucceeded%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RevenueWithdrawalStateSucceeded) TypeID() uint32 { - return RevenueWithdrawalStateSucceededTypeID -} - -// TypeName returns name of type in TL schema. -func (*RevenueWithdrawalStateSucceeded) TypeName() string { - return "revenueWithdrawalStateSucceeded" -} - -// TypeInfo returns info about TL type. -func (r *RevenueWithdrawalStateSucceeded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "revenueWithdrawalStateSucceeded", - ID: RevenueWithdrawalStateSucceededTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RevenueWithdrawalStateSucceeded) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode revenueWithdrawalStateSucceeded#fd14e0a as nil") - } - b.PutID(RevenueWithdrawalStateSucceededTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RevenueWithdrawalStateSucceeded) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode revenueWithdrawalStateSucceeded#fd14e0a as nil") - } - b.PutInt32(r.Date) - b.PutString(r.URL) - return nil -} - -// Decode implements bin.Decoder. -func (r *RevenueWithdrawalStateSucceeded) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode revenueWithdrawalStateSucceeded#fd14e0a to nil") - } - if err := b.ConsumeID(RevenueWithdrawalStateSucceededTypeID); err != nil { - return fmt.Errorf("unable to decode revenueWithdrawalStateSucceeded#fd14e0a: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RevenueWithdrawalStateSucceeded) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode revenueWithdrawalStateSucceeded#fd14e0a to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode revenueWithdrawalStateSucceeded#fd14e0a: field date: %w", err) - } - r.Date = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode revenueWithdrawalStateSucceeded#fd14e0a: field url: %w", err) - } - r.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RevenueWithdrawalStateSucceeded) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode revenueWithdrawalStateSucceeded#fd14e0a as nil") - } - b.ObjStart() - b.PutID("revenueWithdrawalStateSucceeded") - b.Comma() - b.FieldStart("date") - b.PutInt32(r.Date) - b.Comma() - b.FieldStart("url") - b.PutString(r.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RevenueWithdrawalStateSucceeded) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode revenueWithdrawalStateSucceeded#fd14e0a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("revenueWithdrawalStateSucceeded"); err != nil { - return fmt.Errorf("unable to decode revenueWithdrawalStateSucceeded#fd14e0a: %w", err) - } - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode revenueWithdrawalStateSucceeded#fd14e0a: field date: %w", err) - } - r.Date = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode revenueWithdrawalStateSucceeded#fd14e0a: field url: %w", err) - } - r.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDate returns value of Date field. -func (r *RevenueWithdrawalStateSucceeded) GetDate() (value int32) { - if r == nil { - return - } - return r.Date -} - -// GetURL returns value of URL field. -func (r *RevenueWithdrawalStateSucceeded) GetURL() (value string) { - if r == nil { - return - } - return r.URL -} - -// RevenueWithdrawalStateFailed represents TL type `revenueWithdrawalStateFailed#ff413089`. -type RevenueWithdrawalStateFailed struct { -} - -// RevenueWithdrawalStateFailedTypeID is TL type id of RevenueWithdrawalStateFailed. -const RevenueWithdrawalStateFailedTypeID = 0xff413089 - -// construct implements constructor of RevenueWithdrawalStateClass. -func (r RevenueWithdrawalStateFailed) construct() RevenueWithdrawalStateClass { return &r } - -// Ensuring interfaces in compile-time for RevenueWithdrawalStateFailed. -var ( - _ bin.Encoder = &RevenueWithdrawalStateFailed{} - _ bin.Decoder = &RevenueWithdrawalStateFailed{} - _ bin.BareEncoder = &RevenueWithdrawalStateFailed{} - _ bin.BareDecoder = &RevenueWithdrawalStateFailed{} - - _ RevenueWithdrawalStateClass = &RevenueWithdrawalStateFailed{} -) - -func (r *RevenueWithdrawalStateFailed) Zero() bool { - if r == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (r *RevenueWithdrawalStateFailed) String() string { - if r == nil { - return "RevenueWithdrawalStateFailed(nil)" - } - type Alias RevenueWithdrawalStateFailed - return fmt.Sprintf("RevenueWithdrawalStateFailed%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RevenueWithdrawalStateFailed) TypeID() uint32 { - return RevenueWithdrawalStateFailedTypeID -} - -// TypeName returns name of type in TL schema. -func (*RevenueWithdrawalStateFailed) TypeName() string { - return "revenueWithdrawalStateFailed" -} - -// TypeInfo returns info about TL type. -func (r *RevenueWithdrawalStateFailed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "revenueWithdrawalStateFailed", - ID: RevenueWithdrawalStateFailedTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (r *RevenueWithdrawalStateFailed) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode revenueWithdrawalStateFailed#ff413089 as nil") - } - b.PutID(RevenueWithdrawalStateFailedTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RevenueWithdrawalStateFailed) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode revenueWithdrawalStateFailed#ff413089 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RevenueWithdrawalStateFailed) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode revenueWithdrawalStateFailed#ff413089 to nil") - } - if err := b.ConsumeID(RevenueWithdrawalStateFailedTypeID); err != nil { - return fmt.Errorf("unable to decode revenueWithdrawalStateFailed#ff413089: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RevenueWithdrawalStateFailed) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode revenueWithdrawalStateFailed#ff413089 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RevenueWithdrawalStateFailed) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode revenueWithdrawalStateFailed#ff413089 as nil") - } - b.ObjStart() - b.PutID("revenueWithdrawalStateFailed") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RevenueWithdrawalStateFailed) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode revenueWithdrawalStateFailed#ff413089 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("revenueWithdrawalStateFailed"); err != nil { - return fmt.Errorf("unable to decode revenueWithdrawalStateFailed#ff413089: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// RevenueWithdrawalStateClassName is schema name of RevenueWithdrawalStateClass. -const RevenueWithdrawalStateClassName = "RevenueWithdrawalState" - -// RevenueWithdrawalStateClass represents RevenueWithdrawalState generic type. -// -// Example: -// -// g, err := tdapi.DecodeRevenueWithdrawalState(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.RevenueWithdrawalStatePending: // revenueWithdrawalStatePending#5d314fa5 -// case *tdapi.RevenueWithdrawalStateSucceeded: // revenueWithdrawalStateSucceeded#fd14e0a -// case *tdapi.RevenueWithdrawalStateFailed: // revenueWithdrawalStateFailed#ff413089 -// default: panic(v) -// } -type RevenueWithdrawalStateClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() RevenueWithdrawalStateClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeRevenueWithdrawalState implements binary de-serialization for RevenueWithdrawalStateClass. -func DecodeRevenueWithdrawalState(buf *bin.Buffer) (RevenueWithdrawalStateClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case RevenueWithdrawalStatePendingTypeID: - // Decoding revenueWithdrawalStatePending#5d314fa5. - v := RevenueWithdrawalStatePending{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RevenueWithdrawalStateClass: %w", err) - } - return &v, nil - case RevenueWithdrawalStateSucceededTypeID: - // Decoding revenueWithdrawalStateSucceeded#fd14e0a. - v := RevenueWithdrawalStateSucceeded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RevenueWithdrawalStateClass: %w", err) - } - return &v, nil - case RevenueWithdrawalStateFailedTypeID: - // Decoding revenueWithdrawalStateFailed#ff413089. - v := RevenueWithdrawalStateFailed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RevenueWithdrawalStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode RevenueWithdrawalStateClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONRevenueWithdrawalState implements binary de-serialization for RevenueWithdrawalStateClass. -func DecodeTDLibJSONRevenueWithdrawalState(buf tdjson.Decoder) (RevenueWithdrawalStateClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "revenueWithdrawalStatePending": - // Decoding revenueWithdrawalStatePending#5d314fa5. - v := RevenueWithdrawalStatePending{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RevenueWithdrawalStateClass: %w", err) - } - return &v, nil - case "revenueWithdrawalStateSucceeded": - // Decoding revenueWithdrawalStateSucceeded#fd14e0a. - v := RevenueWithdrawalStateSucceeded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RevenueWithdrawalStateClass: %w", err) - } - return &v, nil - case "revenueWithdrawalStateFailed": - // Decoding revenueWithdrawalStateFailed#ff413089. - v := RevenueWithdrawalStateFailed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RevenueWithdrawalStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode RevenueWithdrawalStateClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// RevenueWithdrawalState boxes the RevenueWithdrawalStateClass providing a helper. -type RevenueWithdrawalStateBox struct { - RevenueWithdrawalState RevenueWithdrawalStateClass -} - -// Decode implements bin.Decoder for RevenueWithdrawalStateBox. -func (b *RevenueWithdrawalStateBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode RevenueWithdrawalStateBox to nil") - } - v, err := DecodeRevenueWithdrawalState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.RevenueWithdrawalState = v - return nil -} - -// Encode implements bin.Encode for RevenueWithdrawalStateBox. -func (b *RevenueWithdrawalStateBox) Encode(buf *bin.Buffer) error { - if b == nil || b.RevenueWithdrawalState == nil { - return fmt.Errorf("unable to encode RevenueWithdrawalStateClass as nil") - } - return b.RevenueWithdrawalState.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for RevenueWithdrawalStateBox. -func (b *RevenueWithdrawalStateBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode RevenueWithdrawalStateBox to nil") - } - v, err := DecodeTDLibJSONRevenueWithdrawalState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.RevenueWithdrawalState = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for RevenueWithdrawalStateBox. -func (b *RevenueWithdrawalStateBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.RevenueWithdrawalState == nil { - return fmt.Errorf("unable to encode RevenueWithdrawalStateClass as nil") - } - return b.RevenueWithdrawalState.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_revoke_chat_invite_link_gen.go b/tdapi/tl_revoke_chat_invite_link_gen.go deleted file mode 100644 index b04ea3a88..000000000 --- a/tdapi/tl_revoke_chat_invite_link_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RevokeChatInviteLinkRequest represents TL type `revokeChatInviteLink#d1b755a9`. -type RevokeChatInviteLinkRequest struct { - // Chat identifier - ChatID int64 - // Invite link to be revoked - InviteLink string -} - -// RevokeChatInviteLinkRequestTypeID is TL type id of RevokeChatInviteLinkRequest. -const RevokeChatInviteLinkRequestTypeID = 0xd1b755a9 - -// Ensuring interfaces in compile-time for RevokeChatInviteLinkRequest. -var ( - _ bin.Encoder = &RevokeChatInviteLinkRequest{} - _ bin.Decoder = &RevokeChatInviteLinkRequest{} - _ bin.BareEncoder = &RevokeChatInviteLinkRequest{} - _ bin.BareDecoder = &RevokeChatInviteLinkRequest{} -) - -func (r *RevokeChatInviteLinkRequest) Zero() bool { - if r == nil { - return true - } - if !(r.ChatID == 0) { - return false - } - if !(r.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RevokeChatInviteLinkRequest) String() string { - if r == nil { - return "RevokeChatInviteLinkRequest(nil)" - } - type Alias RevokeChatInviteLinkRequest - return fmt.Sprintf("RevokeChatInviteLinkRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RevokeChatInviteLinkRequest) TypeID() uint32 { - return RevokeChatInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RevokeChatInviteLinkRequest) TypeName() string { - return "revokeChatInviteLink" -} - -// TypeInfo returns info about TL type. -func (r *RevokeChatInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "revokeChatInviteLink", - ID: RevokeChatInviteLinkRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RevokeChatInviteLinkRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode revokeChatInviteLink#d1b755a9 as nil") - } - b.PutID(RevokeChatInviteLinkRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RevokeChatInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode revokeChatInviteLink#d1b755a9 as nil") - } - b.PutInt53(r.ChatID) - b.PutString(r.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (r *RevokeChatInviteLinkRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode revokeChatInviteLink#d1b755a9 to nil") - } - if err := b.ConsumeID(RevokeChatInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode revokeChatInviteLink#d1b755a9: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RevokeChatInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode revokeChatInviteLink#d1b755a9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode revokeChatInviteLink#d1b755a9: field chat_id: %w", err) - } - r.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode revokeChatInviteLink#d1b755a9: field invite_link: %w", err) - } - r.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RevokeChatInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode revokeChatInviteLink#d1b755a9 as nil") - } - b.ObjStart() - b.PutID("revokeChatInviteLink") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(r.ChatID) - b.Comma() - b.FieldStart("invite_link") - b.PutString(r.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RevokeChatInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode revokeChatInviteLink#d1b755a9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("revokeChatInviteLink"); err != nil { - return fmt.Errorf("unable to decode revokeChatInviteLink#d1b755a9: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode revokeChatInviteLink#d1b755a9: field chat_id: %w", err) - } - r.ChatID = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode revokeChatInviteLink#d1b755a9: field invite_link: %w", err) - } - r.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (r *RevokeChatInviteLinkRequest) GetChatID() (value int64) { - if r == nil { - return - } - return r.ChatID -} - -// GetInviteLink returns value of InviteLink field. -func (r *RevokeChatInviteLinkRequest) GetInviteLink() (value string) { - if r == nil { - return - } - return r.InviteLink -} - -// RevokeChatInviteLink invokes method revokeChatInviteLink#d1b755a9 returning error if any. -func (c *Client) RevokeChatInviteLink(ctx context.Context, request *RevokeChatInviteLinkRequest) (*ChatInviteLinks, error) { - var result ChatInviteLinks - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_revoke_group_call_invite_link_gen.go b/tdapi/tl_revoke_group_call_invite_link_gen.go deleted file mode 100644 index 847382a7b..000000000 --- a/tdapi/tl_revoke_group_call_invite_link_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RevokeGroupCallInviteLinkRequest represents TL type `revokeGroupCallInviteLink#1de5a494`. -type RevokeGroupCallInviteLinkRequest struct { - // Group call identifier - GroupCallID int32 -} - -// RevokeGroupCallInviteLinkRequestTypeID is TL type id of RevokeGroupCallInviteLinkRequest. -const RevokeGroupCallInviteLinkRequestTypeID = 0x1de5a494 - -// Ensuring interfaces in compile-time for RevokeGroupCallInviteLinkRequest. -var ( - _ bin.Encoder = &RevokeGroupCallInviteLinkRequest{} - _ bin.Decoder = &RevokeGroupCallInviteLinkRequest{} - _ bin.BareEncoder = &RevokeGroupCallInviteLinkRequest{} - _ bin.BareDecoder = &RevokeGroupCallInviteLinkRequest{} -) - -func (r *RevokeGroupCallInviteLinkRequest) Zero() bool { - if r == nil { - return true - } - if !(r.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RevokeGroupCallInviteLinkRequest) String() string { - if r == nil { - return "RevokeGroupCallInviteLinkRequest(nil)" - } - type Alias RevokeGroupCallInviteLinkRequest - return fmt.Sprintf("RevokeGroupCallInviteLinkRequest%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RevokeGroupCallInviteLinkRequest) TypeID() uint32 { - return RevokeGroupCallInviteLinkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*RevokeGroupCallInviteLinkRequest) TypeName() string { - return "revokeGroupCallInviteLink" -} - -// TypeInfo returns info about TL type. -func (r *RevokeGroupCallInviteLinkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "revokeGroupCallInviteLink", - ID: RevokeGroupCallInviteLinkRequestTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RevokeGroupCallInviteLinkRequest) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode revokeGroupCallInviteLink#1de5a494 as nil") - } - b.PutID(RevokeGroupCallInviteLinkRequestTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RevokeGroupCallInviteLinkRequest) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode revokeGroupCallInviteLink#1de5a494 as nil") - } - b.PutInt32(r.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (r *RevokeGroupCallInviteLinkRequest) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode revokeGroupCallInviteLink#1de5a494 to nil") - } - if err := b.ConsumeID(RevokeGroupCallInviteLinkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode revokeGroupCallInviteLink#1de5a494: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RevokeGroupCallInviteLinkRequest) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode revokeGroupCallInviteLink#1de5a494 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode revokeGroupCallInviteLink#1de5a494: field group_call_id: %w", err) - } - r.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RevokeGroupCallInviteLinkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode revokeGroupCallInviteLink#1de5a494 as nil") - } - b.ObjStart() - b.PutID("revokeGroupCallInviteLink") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(r.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RevokeGroupCallInviteLinkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode revokeGroupCallInviteLink#1de5a494 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("revokeGroupCallInviteLink"); err != nil { - return fmt.Errorf("unable to decode revokeGroupCallInviteLink#1de5a494: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode revokeGroupCallInviteLink#1de5a494: field group_call_id: %w", err) - } - r.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (r *RevokeGroupCallInviteLinkRequest) GetGroupCallID() (value int32) { - if r == nil { - return - } - return r.GroupCallID -} - -// RevokeGroupCallInviteLink invokes method revokeGroupCallInviteLink#1de5a494 returning error if any. -func (c *Client) RevokeGroupCallInviteLink(ctx context.Context, groupcallid int32) error { - var ok Ok - - request := &RevokeGroupCallInviteLinkRequest{ - GroupCallID: groupcallid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_rich_text_gen.go b/tdapi/tl_rich_text_gen.go deleted file mode 100644 index a5592e9ff..000000000 --- a/tdapi/tl_rich_text_gen.go +++ /dev/null @@ -1,3721 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RichTextPlain represents TL type `richTextPlain#1cc42966`. -type RichTextPlain struct { - // Text - Text string -} - -// RichTextPlainTypeID is TL type id of RichTextPlain. -const RichTextPlainTypeID = 0x1cc42966 - -// construct implements constructor of RichTextClass. -func (r RichTextPlain) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextPlain. -var ( - _ bin.Encoder = &RichTextPlain{} - _ bin.Decoder = &RichTextPlain{} - _ bin.BareEncoder = &RichTextPlain{} - _ bin.BareDecoder = &RichTextPlain{} - - _ RichTextClass = &RichTextPlain{} -) - -func (r *RichTextPlain) Zero() bool { - if r == nil { - return true - } - if !(r.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextPlain) String() string { - if r == nil { - return "RichTextPlain(nil)" - } - type Alias RichTextPlain - return fmt.Sprintf("RichTextPlain%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextPlain) TypeID() uint32 { - return RichTextPlainTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextPlain) TypeName() string { - return "richTextPlain" -} - -// TypeInfo returns info about TL type. -func (r *RichTextPlain) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextPlain", - ID: RichTextPlainTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextPlain) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextPlain#1cc42966 as nil") - } - b.PutID(RichTextPlainTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextPlain) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextPlain#1cc42966 as nil") - } - b.PutString(r.Text) - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextPlain) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextPlain#1cc42966 to nil") - } - if err := b.ConsumeID(RichTextPlainTypeID); err != nil { - return fmt.Errorf("unable to decode richTextPlain#1cc42966: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextPlain) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextPlain#1cc42966 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextPlain#1cc42966: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextPlain) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextPlain#1cc42966 as nil") - } - b.ObjStart() - b.PutID("richTextPlain") - b.Comma() - b.FieldStart("text") - b.PutString(r.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextPlain) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextPlain#1cc42966 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextPlain"); err != nil { - return fmt.Errorf("unable to decode richTextPlain#1cc42966: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextPlain#1cc42966: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextPlain) GetText() (value string) { - if r == nil { - return - } - return r.Text -} - -// RichTextBold represents TL type `richTextBold#63970f6c`. -type RichTextBold struct { - // Text - Text RichTextClass -} - -// RichTextBoldTypeID is TL type id of RichTextBold. -const RichTextBoldTypeID = 0x63970f6c - -// construct implements constructor of RichTextClass. -func (r RichTextBold) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextBold. -var ( - _ bin.Encoder = &RichTextBold{} - _ bin.Decoder = &RichTextBold{} - _ bin.BareEncoder = &RichTextBold{} - _ bin.BareDecoder = &RichTextBold{} - - _ RichTextClass = &RichTextBold{} -) - -func (r *RichTextBold) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextBold) String() string { - if r == nil { - return "RichTextBold(nil)" - } - type Alias RichTextBold - return fmt.Sprintf("RichTextBold%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextBold) TypeID() uint32 { - return RichTextBoldTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextBold) TypeName() string { - return "richTextBold" -} - -// TypeInfo returns info about TL type. -func (r *RichTextBold) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextBold", - ID: RichTextBoldTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextBold) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextBold#63970f6c as nil") - } - b.PutID(RichTextBoldTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextBold) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextBold#63970f6c as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextBold#63970f6c: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextBold#63970f6c: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextBold) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextBold#63970f6c to nil") - } - if err := b.ConsumeID(RichTextBoldTypeID); err != nil { - return fmt.Errorf("unable to decode richTextBold#63970f6c: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextBold) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextBold#63970f6c to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextBold#63970f6c: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextBold) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextBold#63970f6c as nil") - } - b.ObjStart() - b.PutID("richTextBold") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextBold#63970f6c: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextBold#63970f6c: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextBold) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextBold#63970f6c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextBold"); err != nil { - return fmt.Errorf("unable to decode richTextBold#63970f6c: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextBold#63970f6c: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextBold) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// RichTextItalic represents TL type `richTextItalic#6e77f03f`. -type RichTextItalic struct { - // Text - Text RichTextClass -} - -// RichTextItalicTypeID is TL type id of RichTextItalic. -const RichTextItalicTypeID = 0x6e77f03f - -// construct implements constructor of RichTextClass. -func (r RichTextItalic) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextItalic. -var ( - _ bin.Encoder = &RichTextItalic{} - _ bin.Decoder = &RichTextItalic{} - _ bin.BareEncoder = &RichTextItalic{} - _ bin.BareDecoder = &RichTextItalic{} - - _ RichTextClass = &RichTextItalic{} -) - -func (r *RichTextItalic) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextItalic) String() string { - if r == nil { - return "RichTextItalic(nil)" - } - type Alias RichTextItalic - return fmt.Sprintf("RichTextItalic%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextItalic) TypeID() uint32 { - return RichTextItalicTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextItalic) TypeName() string { - return "richTextItalic" -} - -// TypeInfo returns info about TL type. -func (r *RichTextItalic) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextItalic", - ID: RichTextItalicTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextItalic) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextItalic#6e77f03f as nil") - } - b.PutID(RichTextItalicTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextItalic) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextItalic#6e77f03f as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextItalic#6e77f03f: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextItalic#6e77f03f: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextItalic) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextItalic#6e77f03f to nil") - } - if err := b.ConsumeID(RichTextItalicTypeID); err != nil { - return fmt.Errorf("unable to decode richTextItalic#6e77f03f: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextItalic) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextItalic#6e77f03f to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextItalic#6e77f03f: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextItalic) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextItalic#6e77f03f as nil") - } - b.ObjStart() - b.PutID("richTextItalic") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextItalic#6e77f03f: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextItalic#6e77f03f: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextItalic) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextItalic#6e77f03f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextItalic"); err != nil { - return fmt.Errorf("unable to decode richTextItalic#6e77f03f: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextItalic#6e77f03f: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextItalic) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// RichTextUnderline represents TL type `richTextUnderline#e00cfd8c`. -type RichTextUnderline struct { - // Text - Text RichTextClass -} - -// RichTextUnderlineTypeID is TL type id of RichTextUnderline. -const RichTextUnderlineTypeID = 0xe00cfd8c - -// construct implements constructor of RichTextClass. -func (r RichTextUnderline) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextUnderline. -var ( - _ bin.Encoder = &RichTextUnderline{} - _ bin.Decoder = &RichTextUnderline{} - _ bin.BareEncoder = &RichTextUnderline{} - _ bin.BareDecoder = &RichTextUnderline{} - - _ RichTextClass = &RichTextUnderline{} -) - -func (r *RichTextUnderline) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextUnderline) String() string { - if r == nil { - return "RichTextUnderline(nil)" - } - type Alias RichTextUnderline - return fmt.Sprintf("RichTextUnderline%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextUnderline) TypeID() uint32 { - return RichTextUnderlineTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextUnderline) TypeName() string { - return "richTextUnderline" -} - -// TypeInfo returns info about TL type. -func (r *RichTextUnderline) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextUnderline", - ID: RichTextUnderlineTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextUnderline) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextUnderline#e00cfd8c as nil") - } - b.PutID(RichTextUnderlineTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextUnderline) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextUnderline#e00cfd8c as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextUnderline#e00cfd8c: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextUnderline#e00cfd8c: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextUnderline) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextUnderline#e00cfd8c to nil") - } - if err := b.ConsumeID(RichTextUnderlineTypeID); err != nil { - return fmt.Errorf("unable to decode richTextUnderline#e00cfd8c: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextUnderline) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextUnderline#e00cfd8c to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextUnderline#e00cfd8c: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextUnderline) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextUnderline#e00cfd8c as nil") - } - b.ObjStart() - b.PutID("richTextUnderline") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextUnderline#e00cfd8c: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextUnderline#e00cfd8c: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextUnderline) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextUnderline#e00cfd8c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextUnderline"); err != nil { - return fmt.Errorf("unable to decode richTextUnderline#e00cfd8c: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextUnderline#e00cfd8c: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextUnderline) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// RichTextStrikethrough represents TL type `richTextStrikethrough#2b1e6a51`. -type RichTextStrikethrough struct { - // Text - Text RichTextClass -} - -// RichTextStrikethroughTypeID is TL type id of RichTextStrikethrough. -const RichTextStrikethroughTypeID = 0x2b1e6a51 - -// construct implements constructor of RichTextClass. -func (r RichTextStrikethrough) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextStrikethrough. -var ( - _ bin.Encoder = &RichTextStrikethrough{} - _ bin.Decoder = &RichTextStrikethrough{} - _ bin.BareEncoder = &RichTextStrikethrough{} - _ bin.BareDecoder = &RichTextStrikethrough{} - - _ RichTextClass = &RichTextStrikethrough{} -) - -func (r *RichTextStrikethrough) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextStrikethrough) String() string { - if r == nil { - return "RichTextStrikethrough(nil)" - } - type Alias RichTextStrikethrough - return fmt.Sprintf("RichTextStrikethrough%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextStrikethrough) TypeID() uint32 { - return RichTextStrikethroughTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextStrikethrough) TypeName() string { - return "richTextStrikethrough" -} - -// TypeInfo returns info about TL type. -func (r *RichTextStrikethrough) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextStrikethrough", - ID: RichTextStrikethroughTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextStrikethrough) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextStrikethrough#2b1e6a51 as nil") - } - b.PutID(RichTextStrikethroughTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextStrikethrough) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextStrikethrough#2b1e6a51 as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextStrikethrough#2b1e6a51: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextStrikethrough#2b1e6a51: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextStrikethrough) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextStrikethrough#2b1e6a51 to nil") - } - if err := b.ConsumeID(RichTextStrikethroughTypeID); err != nil { - return fmt.Errorf("unable to decode richTextStrikethrough#2b1e6a51: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextStrikethrough) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextStrikethrough#2b1e6a51 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextStrikethrough#2b1e6a51: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextStrikethrough) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextStrikethrough#2b1e6a51 as nil") - } - b.ObjStart() - b.PutID("richTextStrikethrough") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextStrikethrough#2b1e6a51: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextStrikethrough#2b1e6a51: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextStrikethrough) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextStrikethrough#2b1e6a51 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextStrikethrough"); err != nil { - return fmt.Errorf("unable to decode richTextStrikethrough#2b1e6a51: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextStrikethrough#2b1e6a51: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextStrikethrough) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// RichTextFixed represents TL type `richTextFixed#b43681c7`. -type RichTextFixed struct { - // Text - Text RichTextClass -} - -// RichTextFixedTypeID is TL type id of RichTextFixed. -const RichTextFixedTypeID = 0xb43681c7 - -// construct implements constructor of RichTextClass. -func (r RichTextFixed) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextFixed. -var ( - _ bin.Encoder = &RichTextFixed{} - _ bin.Decoder = &RichTextFixed{} - _ bin.BareEncoder = &RichTextFixed{} - _ bin.BareDecoder = &RichTextFixed{} - - _ RichTextClass = &RichTextFixed{} -) - -func (r *RichTextFixed) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextFixed) String() string { - if r == nil { - return "RichTextFixed(nil)" - } - type Alias RichTextFixed - return fmt.Sprintf("RichTextFixed%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextFixed) TypeID() uint32 { - return RichTextFixedTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextFixed) TypeName() string { - return "richTextFixed" -} - -// TypeInfo returns info about TL type. -func (r *RichTextFixed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextFixed", - ID: RichTextFixedTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextFixed) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextFixed#b43681c7 as nil") - } - b.PutID(RichTextFixedTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextFixed) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextFixed#b43681c7 as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextFixed#b43681c7: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextFixed#b43681c7: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextFixed) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextFixed#b43681c7 to nil") - } - if err := b.ConsumeID(RichTextFixedTypeID); err != nil { - return fmt.Errorf("unable to decode richTextFixed#b43681c7: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextFixed) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextFixed#b43681c7 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextFixed#b43681c7: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextFixed) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextFixed#b43681c7 as nil") - } - b.ObjStart() - b.PutID("richTextFixed") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextFixed#b43681c7: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextFixed#b43681c7: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextFixed) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextFixed#b43681c7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextFixed"); err != nil { - return fmt.Errorf("unable to decode richTextFixed#b43681c7: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextFixed#b43681c7: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextFixed) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// RichTextURL represents TL type `richTextUrl#500cf14`. -type RichTextURL struct { - // Text - Text RichTextClass - // URL - URL string - // True, if the URL has cached instant view server-side - IsCached bool -} - -// RichTextURLTypeID is TL type id of RichTextURL. -const RichTextURLTypeID = 0x500cf14 - -// construct implements constructor of RichTextClass. -func (r RichTextURL) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextURL. -var ( - _ bin.Encoder = &RichTextURL{} - _ bin.Decoder = &RichTextURL{} - _ bin.BareEncoder = &RichTextURL{} - _ bin.BareDecoder = &RichTextURL{} - - _ RichTextClass = &RichTextURL{} -) - -func (r *RichTextURL) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - if !(r.URL == "") { - return false - } - if !(r.IsCached == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextURL) String() string { - if r == nil { - return "RichTextURL(nil)" - } - type Alias RichTextURL - return fmt.Sprintf("RichTextURL%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextURL) TypeID() uint32 { - return RichTextURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextURL) TypeName() string { - return "richTextUrl" -} - -// TypeInfo returns info about TL type. -func (r *RichTextURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextUrl", - ID: RichTextURLTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "IsCached", - SchemaName: "is_cached", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextURL) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextUrl#500cf14 as nil") - } - b.PutID(RichTextURLTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextURL) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextUrl#500cf14 as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextUrl#500cf14: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextUrl#500cf14: field text: %w", err) - } - b.PutString(r.URL) - b.PutBool(r.IsCached) - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextURL) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextUrl#500cf14 to nil") - } - if err := b.ConsumeID(RichTextURLTypeID); err != nil { - return fmt.Errorf("unable to decode richTextUrl#500cf14: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextURL) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextUrl#500cf14 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextUrl#500cf14: field text: %w", err) - } - r.Text = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextUrl#500cf14: field url: %w", err) - } - r.URL = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode richTextUrl#500cf14: field is_cached: %w", err) - } - r.IsCached = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextURL) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextUrl#500cf14 as nil") - } - b.ObjStart() - b.PutID("richTextUrl") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextUrl#500cf14: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextUrl#500cf14: field text: %w", err) - } - b.Comma() - b.FieldStart("url") - b.PutString(r.URL) - b.Comma() - b.FieldStart("is_cached") - b.PutBool(r.IsCached) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextURL) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextUrl#500cf14 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextUrl"); err != nil { - return fmt.Errorf("unable to decode richTextUrl#500cf14: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextUrl#500cf14: field text: %w", err) - } - r.Text = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextUrl#500cf14: field url: %w", err) - } - r.URL = value - case "is_cached": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode richTextUrl#500cf14: field is_cached: %w", err) - } - r.IsCached = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextURL) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// GetURL returns value of URL field. -func (r *RichTextURL) GetURL() (value string) { - if r == nil { - return - } - return r.URL -} - -// GetIsCached returns value of IsCached field. -func (r *RichTextURL) GetIsCached() (value bool) { - if r == nil { - return - } - return r.IsCached -} - -// RichTextEmailAddress represents TL type `richTextEmailAddress#262a2f7`. -type RichTextEmailAddress struct { - // Text - Text RichTextClass - // Email address - EmailAddress string -} - -// RichTextEmailAddressTypeID is TL type id of RichTextEmailAddress. -const RichTextEmailAddressTypeID = 0x262a2f7 - -// construct implements constructor of RichTextClass. -func (r RichTextEmailAddress) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextEmailAddress. -var ( - _ bin.Encoder = &RichTextEmailAddress{} - _ bin.Decoder = &RichTextEmailAddress{} - _ bin.BareEncoder = &RichTextEmailAddress{} - _ bin.BareDecoder = &RichTextEmailAddress{} - - _ RichTextClass = &RichTextEmailAddress{} -) - -func (r *RichTextEmailAddress) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - if !(r.EmailAddress == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextEmailAddress) String() string { - if r == nil { - return "RichTextEmailAddress(nil)" - } - type Alias RichTextEmailAddress - return fmt.Sprintf("RichTextEmailAddress%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextEmailAddress) TypeID() uint32 { - return RichTextEmailAddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextEmailAddress) TypeName() string { - return "richTextEmailAddress" -} - -// TypeInfo returns info about TL type. -func (r *RichTextEmailAddress) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextEmailAddress", - ID: RichTextEmailAddressTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "EmailAddress", - SchemaName: "email_address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextEmailAddress) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextEmailAddress#262a2f7 as nil") - } - b.PutID(RichTextEmailAddressTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextEmailAddress) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextEmailAddress#262a2f7 as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextEmailAddress#262a2f7: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextEmailAddress#262a2f7: field text: %w", err) - } - b.PutString(r.EmailAddress) - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextEmailAddress) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextEmailAddress#262a2f7 to nil") - } - if err := b.ConsumeID(RichTextEmailAddressTypeID); err != nil { - return fmt.Errorf("unable to decode richTextEmailAddress#262a2f7: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextEmailAddress) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextEmailAddress#262a2f7 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextEmailAddress#262a2f7: field text: %w", err) - } - r.Text = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextEmailAddress#262a2f7: field email_address: %w", err) - } - r.EmailAddress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextEmailAddress) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextEmailAddress#262a2f7 as nil") - } - b.ObjStart() - b.PutID("richTextEmailAddress") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextEmailAddress#262a2f7: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextEmailAddress#262a2f7: field text: %w", err) - } - b.Comma() - b.FieldStart("email_address") - b.PutString(r.EmailAddress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextEmailAddress) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextEmailAddress#262a2f7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextEmailAddress"); err != nil { - return fmt.Errorf("unable to decode richTextEmailAddress#262a2f7: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextEmailAddress#262a2f7: field text: %w", err) - } - r.Text = value - case "email_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextEmailAddress#262a2f7: field email_address: %w", err) - } - r.EmailAddress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextEmailAddress) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// GetEmailAddress returns value of EmailAddress field. -func (r *RichTextEmailAddress) GetEmailAddress() (value string) { - if r == nil { - return - } - return r.EmailAddress -} - -// RichTextSubscript represents TL type `richTextSubscript#cc405a4c`. -type RichTextSubscript struct { - // Text - Text RichTextClass -} - -// RichTextSubscriptTypeID is TL type id of RichTextSubscript. -const RichTextSubscriptTypeID = 0xcc405a4c - -// construct implements constructor of RichTextClass. -func (r RichTextSubscript) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextSubscript. -var ( - _ bin.Encoder = &RichTextSubscript{} - _ bin.Decoder = &RichTextSubscript{} - _ bin.BareEncoder = &RichTextSubscript{} - _ bin.BareDecoder = &RichTextSubscript{} - - _ RichTextClass = &RichTextSubscript{} -) - -func (r *RichTextSubscript) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextSubscript) String() string { - if r == nil { - return "RichTextSubscript(nil)" - } - type Alias RichTextSubscript - return fmt.Sprintf("RichTextSubscript%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextSubscript) TypeID() uint32 { - return RichTextSubscriptTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextSubscript) TypeName() string { - return "richTextSubscript" -} - -// TypeInfo returns info about TL type. -func (r *RichTextSubscript) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextSubscript", - ID: RichTextSubscriptTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextSubscript) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextSubscript#cc405a4c as nil") - } - b.PutID(RichTextSubscriptTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextSubscript) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextSubscript#cc405a4c as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextSubscript#cc405a4c: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextSubscript#cc405a4c: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextSubscript) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextSubscript#cc405a4c to nil") - } - if err := b.ConsumeID(RichTextSubscriptTypeID); err != nil { - return fmt.Errorf("unable to decode richTextSubscript#cc405a4c: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextSubscript) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextSubscript#cc405a4c to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextSubscript#cc405a4c: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextSubscript) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextSubscript#cc405a4c as nil") - } - b.ObjStart() - b.PutID("richTextSubscript") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextSubscript#cc405a4c: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextSubscript#cc405a4c: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextSubscript) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextSubscript#cc405a4c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextSubscript"); err != nil { - return fmt.Errorf("unable to decode richTextSubscript#cc405a4c: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextSubscript#cc405a4c: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextSubscript) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// RichTextSuperscript represents TL type `richTextSuperscript#e9377563`. -type RichTextSuperscript struct { - // Text - Text RichTextClass -} - -// RichTextSuperscriptTypeID is TL type id of RichTextSuperscript. -const RichTextSuperscriptTypeID = 0xe9377563 - -// construct implements constructor of RichTextClass. -func (r RichTextSuperscript) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextSuperscript. -var ( - _ bin.Encoder = &RichTextSuperscript{} - _ bin.Decoder = &RichTextSuperscript{} - _ bin.BareEncoder = &RichTextSuperscript{} - _ bin.BareDecoder = &RichTextSuperscript{} - - _ RichTextClass = &RichTextSuperscript{} -) - -func (r *RichTextSuperscript) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextSuperscript) String() string { - if r == nil { - return "RichTextSuperscript(nil)" - } - type Alias RichTextSuperscript - return fmt.Sprintf("RichTextSuperscript%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextSuperscript) TypeID() uint32 { - return RichTextSuperscriptTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextSuperscript) TypeName() string { - return "richTextSuperscript" -} - -// TypeInfo returns info about TL type. -func (r *RichTextSuperscript) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextSuperscript", - ID: RichTextSuperscriptTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextSuperscript) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextSuperscript#e9377563 as nil") - } - b.PutID(RichTextSuperscriptTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextSuperscript) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextSuperscript#e9377563 as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextSuperscript#e9377563: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextSuperscript#e9377563: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextSuperscript) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextSuperscript#e9377563 to nil") - } - if err := b.ConsumeID(RichTextSuperscriptTypeID); err != nil { - return fmt.Errorf("unable to decode richTextSuperscript#e9377563: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextSuperscript) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextSuperscript#e9377563 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextSuperscript#e9377563: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextSuperscript) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextSuperscript#e9377563 as nil") - } - b.ObjStart() - b.PutID("richTextSuperscript") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextSuperscript#e9377563: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextSuperscript#e9377563: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextSuperscript) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextSuperscript#e9377563 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextSuperscript"); err != nil { - return fmt.Errorf("unable to decode richTextSuperscript#e9377563: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextSuperscript#e9377563: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextSuperscript) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// RichTextMarked represents TL type `richTextMarked#b42ed382`. -type RichTextMarked struct { - // Text - Text RichTextClass -} - -// RichTextMarkedTypeID is TL type id of RichTextMarked. -const RichTextMarkedTypeID = 0xb42ed382 - -// construct implements constructor of RichTextClass. -func (r RichTextMarked) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextMarked. -var ( - _ bin.Encoder = &RichTextMarked{} - _ bin.Decoder = &RichTextMarked{} - _ bin.BareEncoder = &RichTextMarked{} - _ bin.BareDecoder = &RichTextMarked{} - - _ RichTextClass = &RichTextMarked{} -) - -func (r *RichTextMarked) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextMarked) String() string { - if r == nil { - return "RichTextMarked(nil)" - } - type Alias RichTextMarked - return fmt.Sprintf("RichTextMarked%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextMarked) TypeID() uint32 { - return RichTextMarkedTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextMarked) TypeName() string { - return "richTextMarked" -} - -// TypeInfo returns info about TL type. -func (r *RichTextMarked) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextMarked", - ID: RichTextMarkedTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextMarked) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextMarked#b42ed382 as nil") - } - b.PutID(RichTextMarkedTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextMarked) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextMarked#b42ed382 as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextMarked#b42ed382: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextMarked#b42ed382: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextMarked) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextMarked#b42ed382 to nil") - } - if err := b.ConsumeID(RichTextMarkedTypeID); err != nil { - return fmt.Errorf("unable to decode richTextMarked#b42ed382: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextMarked) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextMarked#b42ed382 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextMarked#b42ed382: field text: %w", err) - } - r.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextMarked) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextMarked#b42ed382 as nil") - } - b.ObjStart() - b.PutID("richTextMarked") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextMarked#b42ed382: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextMarked#b42ed382: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextMarked) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextMarked#b42ed382 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextMarked"); err != nil { - return fmt.Errorf("unable to decode richTextMarked#b42ed382: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextMarked#b42ed382: field text: %w", err) - } - r.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextMarked) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// RichTextPhoneNumber represents TL type `richTextPhoneNumber#7a91543`. -type RichTextPhoneNumber struct { - // Text - Text RichTextClass - // Phone number - PhoneNumber string -} - -// RichTextPhoneNumberTypeID is TL type id of RichTextPhoneNumber. -const RichTextPhoneNumberTypeID = 0x7a91543 - -// construct implements constructor of RichTextClass. -func (r RichTextPhoneNumber) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextPhoneNumber. -var ( - _ bin.Encoder = &RichTextPhoneNumber{} - _ bin.Decoder = &RichTextPhoneNumber{} - _ bin.BareEncoder = &RichTextPhoneNumber{} - _ bin.BareDecoder = &RichTextPhoneNumber{} - - _ RichTextClass = &RichTextPhoneNumber{} -) - -func (r *RichTextPhoneNumber) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - if !(r.PhoneNumber == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextPhoneNumber) String() string { - if r == nil { - return "RichTextPhoneNumber(nil)" - } - type Alias RichTextPhoneNumber - return fmt.Sprintf("RichTextPhoneNumber%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextPhoneNumber) TypeID() uint32 { - return RichTextPhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextPhoneNumber) TypeName() string { - return "richTextPhoneNumber" -} - -// TypeInfo returns info about TL type. -func (r *RichTextPhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextPhoneNumber", - ID: RichTextPhoneNumberTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextPhoneNumber) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextPhoneNumber#7a91543 as nil") - } - b.PutID(RichTextPhoneNumberTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextPhoneNumber) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextPhoneNumber#7a91543 as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextPhoneNumber#7a91543: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextPhoneNumber#7a91543: field text: %w", err) - } - b.PutString(r.PhoneNumber) - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextPhoneNumber) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextPhoneNumber#7a91543 to nil") - } - if err := b.ConsumeID(RichTextPhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode richTextPhoneNumber#7a91543: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextPhoneNumber) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextPhoneNumber#7a91543 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextPhoneNumber#7a91543: field text: %w", err) - } - r.Text = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextPhoneNumber#7a91543: field phone_number: %w", err) - } - r.PhoneNumber = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextPhoneNumber#7a91543 as nil") - } - b.ObjStart() - b.PutID("richTextPhoneNumber") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextPhoneNumber#7a91543: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextPhoneNumber#7a91543: field text: %w", err) - } - b.Comma() - b.FieldStart("phone_number") - b.PutString(r.PhoneNumber) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextPhoneNumber#7a91543 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode richTextPhoneNumber#7a91543: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextPhoneNumber#7a91543: field text: %w", err) - } - r.Text = value - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextPhoneNumber#7a91543: field phone_number: %w", err) - } - r.PhoneNumber = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextPhoneNumber) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (r *RichTextPhoneNumber) GetPhoneNumber() (value string) { - if r == nil { - return - } - return r.PhoneNumber -} - -// RichTextIcon represents TL type `richTextIcon#a7c42b02`. -type RichTextIcon struct { - // The image represented as a document. The image can be in GIF, JPEG or PNG format - Document Document - // Width of a bounding box in which the image must be shown; 0 if unknown - Width int32 - // Height of a bounding box in which the image must be shown; 0 if unknown - Height int32 -} - -// RichTextIconTypeID is TL type id of RichTextIcon. -const RichTextIconTypeID = 0xa7c42b02 - -// construct implements constructor of RichTextClass. -func (r RichTextIcon) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextIcon. -var ( - _ bin.Encoder = &RichTextIcon{} - _ bin.Decoder = &RichTextIcon{} - _ bin.BareEncoder = &RichTextIcon{} - _ bin.BareDecoder = &RichTextIcon{} - - _ RichTextClass = &RichTextIcon{} -) - -func (r *RichTextIcon) Zero() bool { - if r == nil { - return true - } - if !(r.Document.Zero()) { - return false - } - if !(r.Width == 0) { - return false - } - if !(r.Height == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextIcon) String() string { - if r == nil { - return "RichTextIcon(nil)" - } - type Alias RichTextIcon - return fmt.Sprintf("RichTextIcon%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextIcon) TypeID() uint32 { - return RichTextIconTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextIcon) TypeName() string { - return "richTextIcon" -} - -// TypeInfo returns info about TL type. -func (r *RichTextIcon) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextIcon", - ID: RichTextIconTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Document", - SchemaName: "document", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextIcon) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextIcon#a7c42b02 as nil") - } - b.PutID(RichTextIconTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextIcon) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextIcon#a7c42b02 as nil") - } - if err := r.Document.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextIcon#a7c42b02: field document: %w", err) - } - b.PutInt32(r.Width) - b.PutInt32(r.Height) - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextIcon) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextIcon#a7c42b02 to nil") - } - if err := b.ConsumeID(RichTextIconTypeID); err != nil { - return fmt.Errorf("unable to decode richTextIcon#a7c42b02: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextIcon) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextIcon#a7c42b02 to nil") - } - { - if err := r.Document.Decode(b); err != nil { - return fmt.Errorf("unable to decode richTextIcon#a7c42b02: field document: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode richTextIcon#a7c42b02: field width: %w", err) - } - r.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode richTextIcon#a7c42b02: field height: %w", err) - } - r.Height = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextIcon) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextIcon#a7c42b02 as nil") - } - b.ObjStart() - b.PutID("richTextIcon") - b.Comma() - b.FieldStart("document") - if err := r.Document.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextIcon#a7c42b02: field document: %w", err) - } - b.Comma() - b.FieldStart("width") - b.PutInt32(r.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(r.Height) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextIcon) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextIcon#a7c42b02 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextIcon"); err != nil { - return fmt.Errorf("unable to decode richTextIcon#a7c42b02: %w", err) - } - case "document": - if err := r.Document.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode richTextIcon#a7c42b02: field document: %w", err) - } - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode richTextIcon#a7c42b02: field width: %w", err) - } - r.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode richTextIcon#a7c42b02: field height: %w", err) - } - r.Height = value - default: - return b.Skip() - } - return nil - }) -} - -// GetDocument returns value of Document field. -func (r *RichTextIcon) GetDocument() (value Document) { - if r == nil { - return - } - return r.Document -} - -// GetWidth returns value of Width field. -func (r *RichTextIcon) GetWidth() (value int32) { - if r == nil { - return - } - return r.Width -} - -// GetHeight returns value of Height field. -func (r *RichTextIcon) GetHeight() (value int32) { - if r == nil { - return - } - return r.Height -} - -// RichTextReference represents TL type `richTextReference#bb9a1276`. -type RichTextReference struct { - // The text - Text RichTextClass - // The name of a richTextAnchor object, which is the first element of the target - // richTexts object - AnchorName string - // An HTTP URL, opening the reference - URL string -} - -// RichTextReferenceTypeID is TL type id of RichTextReference. -const RichTextReferenceTypeID = 0xbb9a1276 - -// construct implements constructor of RichTextClass. -func (r RichTextReference) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextReference. -var ( - _ bin.Encoder = &RichTextReference{} - _ bin.Decoder = &RichTextReference{} - _ bin.BareEncoder = &RichTextReference{} - _ bin.BareDecoder = &RichTextReference{} - - _ RichTextClass = &RichTextReference{} -) - -func (r *RichTextReference) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - if !(r.AnchorName == "") { - return false - } - if !(r.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextReference) String() string { - if r == nil { - return "RichTextReference(nil)" - } - type Alias RichTextReference - return fmt.Sprintf("RichTextReference%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextReference) TypeID() uint32 { - return RichTextReferenceTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextReference) TypeName() string { - return "richTextReference" -} - -// TypeInfo returns info about TL type. -func (r *RichTextReference) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextReference", - ID: RichTextReferenceTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "AnchorName", - SchemaName: "anchor_name", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextReference) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextReference#bb9a1276 as nil") - } - b.PutID(RichTextReferenceTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextReference) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextReference#bb9a1276 as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextReference#bb9a1276: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextReference#bb9a1276: field text: %w", err) - } - b.PutString(r.AnchorName) - b.PutString(r.URL) - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextReference) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextReference#bb9a1276 to nil") - } - if err := b.ConsumeID(RichTextReferenceTypeID); err != nil { - return fmt.Errorf("unable to decode richTextReference#bb9a1276: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextReference) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextReference#bb9a1276 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextReference#bb9a1276: field text: %w", err) - } - r.Text = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextReference#bb9a1276: field anchor_name: %w", err) - } - r.AnchorName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextReference#bb9a1276: field url: %w", err) - } - r.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextReference) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextReference#bb9a1276 as nil") - } - b.ObjStart() - b.PutID("richTextReference") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextReference#bb9a1276: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextReference#bb9a1276: field text: %w", err) - } - b.Comma() - b.FieldStart("anchor_name") - b.PutString(r.AnchorName) - b.Comma() - b.FieldStart("url") - b.PutString(r.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextReference) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextReference#bb9a1276 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextReference"); err != nil { - return fmt.Errorf("unable to decode richTextReference#bb9a1276: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextReference#bb9a1276: field text: %w", err) - } - r.Text = value - case "anchor_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextReference#bb9a1276: field anchor_name: %w", err) - } - r.AnchorName = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextReference#bb9a1276: field url: %w", err) - } - r.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextReference) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// GetAnchorName returns value of AnchorName field. -func (r *RichTextReference) GetAnchorName() (value string) { - if r == nil { - return - } - return r.AnchorName -} - -// GetURL returns value of URL field. -func (r *RichTextReference) GetURL() (value string) { - if r == nil { - return - } - return r.URL -} - -// RichTextAnchor represents TL type `richTextAnchor#4e7f1034`. -type RichTextAnchor struct { - // Anchor name - Name string -} - -// RichTextAnchorTypeID is TL type id of RichTextAnchor. -const RichTextAnchorTypeID = 0x4e7f1034 - -// construct implements constructor of RichTextClass. -func (r RichTextAnchor) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextAnchor. -var ( - _ bin.Encoder = &RichTextAnchor{} - _ bin.Decoder = &RichTextAnchor{} - _ bin.BareEncoder = &RichTextAnchor{} - _ bin.BareDecoder = &RichTextAnchor{} - - _ RichTextClass = &RichTextAnchor{} -) - -func (r *RichTextAnchor) Zero() bool { - if r == nil { - return true - } - if !(r.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextAnchor) String() string { - if r == nil { - return "RichTextAnchor(nil)" - } - type Alias RichTextAnchor - return fmt.Sprintf("RichTextAnchor%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextAnchor) TypeID() uint32 { - return RichTextAnchorTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextAnchor) TypeName() string { - return "richTextAnchor" -} - -// TypeInfo returns info about TL type. -func (r *RichTextAnchor) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextAnchor", - ID: RichTextAnchorTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextAnchor) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextAnchor#4e7f1034 as nil") - } - b.PutID(RichTextAnchorTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextAnchor) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextAnchor#4e7f1034 as nil") - } - b.PutString(r.Name) - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextAnchor) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextAnchor#4e7f1034 to nil") - } - if err := b.ConsumeID(RichTextAnchorTypeID); err != nil { - return fmt.Errorf("unable to decode richTextAnchor#4e7f1034: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextAnchor) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextAnchor#4e7f1034 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextAnchor#4e7f1034: field name: %w", err) - } - r.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextAnchor) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextAnchor#4e7f1034 as nil") - } - b.ObjStart() - b.PutID("richTextAnchor") - b.Comma() - b.FieldStart("name") - b.PutString(r.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextAnchor) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextAnchor#4e7f1034 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextAnchor"); err != nil { - return fmt.Errorf("unable to decode richTextAnchor#4e7f1034: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextAnchor#4e7f1034: field name: %w", err) - } - r.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (r *RichTextAnchor) GetName() (value string) { - if r == nil { - return - } - return r.Name -} - -// RichTextAnchorLink represents TL type `richTextAnchorLink#a41fd2d6`. -type RichTextAnchorLink struct { - // The link text - Text RichTextClass - // The anchor name. If the name is empty, the link must bring back to top - AnchorName string - // An HTTP URL, opening the anchor - URL string -} - -// RichTextAnchorLinkTypeID is TL type id of RichTextAnchorLink. -const RichTextAnchorLinkTypeID = 0xa41fd2d6 - -// construct implements constructor of RichTextClass. -func (r RichTextAnchorLink) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTextAnchorLink. -var ( - _ bin.Encoder = &RichTextAnchorLink{} - _ bin.Decoder = &RichTextAnchorLink{} - _ bin.BareEncoder = &RichTextAnchorLink{} - _ bin.BareDecoder = &RichTextAnchorLink{} - - _ RichTextClass = &RichTextAnchorLink{} -) - -func (r *RichTextAnchorLink) Zero() bool { - if r == nil { - return true - } - if !(r.Text == nil) { - return false - } - if !(r.AnchorName == "") { - return false - } - if !(r.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTextAnchorLink) String() string { - if r == nil { - return "RichTextAnchorLink(nil)" - } - type Alias RichTextAnchorLink - return fmt.Sprintf("RichTextAnchorLink%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTextAnchorLink) TypeID() uint32 { - return RichTextAnchorLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTextAnchorLink) TypeName() string { - return "richTextAnchorLink" -} - -// TypeInfo returns info about TL type. -func (r *RichTextAnchorLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTextAnchorLink", - ID: RichTextAnchorLinkTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "AnchorName", - SchemaName: "anchor_name", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTextAnchorLink) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextAnchorLink#a41fd2d6 as nil") - } - b.PutID(RichTextAnchorLinkTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTextAnchorLink) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTextAnchorLink#a41fd2d6 as nil") - } - if r.Text == nil { - return fmt.Errorf("unable to encode richTextAnchorLink#a41fd2d6: field text is nil") - } - if err := r.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode richTextAnchorLink#a41fd2d6: field text: %w", err) - } - b.PutString(r.AnchorName) - b.PutString(r.URL) - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTextAnchorLink) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextAnchorLink#a41fd2d6 to nil") - } - if err := b.ConsumeID(RichTextAnchorLinkTypeID); err != nil { - return fmt.Errorf("unable to decode richTextAnchorLink#a41fd2d6: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTextAnchorLink) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTextAnchorLink#a41fd2d6 to nil") - } - { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextAnchorLink#a41fd2d6: field text: %w", err) - } - r.Text = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextAnchorLink#a41fd2d6: field anchor_name: %w", err) - } - r.AnchorName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextAnchorLink#a41fd2d6: field url: %w", err) - } - r.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTextAnchorLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTextAnchorLink#a41fd2d6 as nil") - } - b.ObjStart() - b.PutID("richTextAnchorLink") - b.Comma() - b.FieldStart("text") - if r.Text == nil { - return fmt.Errorf("unable to encode richTextAnchorLink#a41fd2d6: field text is nil") - } - if err := r.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTextAnchorLink#a41fd2d6: field text: %w", err) - } - b.Comma() - b.FieldStart("anchor_name") - b.PutString(r.AnchorName) - b.Comma() - b.FieldStart("url") - b.PutString(r.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTextAnchorLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTextAnchorLink#a41fd2d6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTextAnchorLink"); err != nil { - return fmt.Errorf("unable to decode richTextAnchorLink#a41fd2d6: %w", err) - } - case "text": - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTextAnchorLink#a41fd2d6: field text: %w", err) - } - r.Text = value - case "anchor_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextAnchorLink#a41fd2d6: field anchor_name: %w", err) - } - r.AnchorName = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode richTextAnchorLink#a41fd2d6: field url: %w", err) - } - r.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (r *RichTextAnchorLink) GetText() (value RichTextClass) { - if r == nil { - return - } - return r.Text -} - -// GetAnchorName returns value of AnchorName field. -func (r *RichTextAnchorLink) GetAnchorName() (value string) { - if r == nil { - return - } - return r.AnchorName -} - -// GetURL returns value of URL field. -func (r *RichTextAnchorLink) GetURL() (value string) { - if r == nil { - return - } - return r.URL -} - -// RichTexts represents TL type `richTexts#94b21889`. -type RichTexts struct { - // Texts - Texts []RichTextClass -} - -// RichTextsTypeID is TL type id of RichTexts. -const RichTextsTypeID = 0x94b21889 - -// construct implements constructor of RichTextClass. -func (r RichTexts) construct() RichTextClass { return &r } - -// Ensuring interfaces in compile-time for RichTexts. -var ( - _ bin.Encoder = &RichTexts{} - _ bin.Decoder = &RichTexts{} - _ bin.BareEncoder = &RichTexts{} - _ bin.BareDecoder = &RichTexts{} - - _ RichTextClass = &RichTexts{} -) - -func (r *RichTexts) Zero() bool { - if r == nil { - return true - } - if !(r.Texts == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RichTexts) String() string { - if r == nil { - return "RichTexts(nil)" - } - type Alias RichTexts - return fmt.Sprintf("RichTexts%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RichTexts) TypeID() uint32 { - return RichTextsTypeID -} - -// TypeName returns name of type in TL schema. -func (*RichTexts) TypeName() string { - return "richTexts" -} - -// TypeInfo returns info about TL type. -func (r *RichTexts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "richTexts", - ID: RichTextsTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Texts", - SchemaName: "texts", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RichTexts) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTexts#94b21889 as nil") - } - b.PutID(RichTextsTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RichTexts) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode richTexts#94b21889 as nil") - } - b.PutInt(len(r.Texts)) - for idx, v := range r.Texts { - if v == nil { - return fmt.Errorf("unable to encode richTexts#94b21889: field texts element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare richTexts#94b21889: field texts element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (r *RichTexts) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTexts#94b21889 to nil") - } - if err := b.ConsumeID(RichTextsTypeID); err != nil { - return fmt.Errorf("unable to decode richTexts#94b21889: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RichTexts) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode richTexts#94b21889 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode richTexts#94b21889: field texts: %w", err) - } - - if headerLen > 0 { - r.Texts = make([]RichTextClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTexts#94b21889: field texts: %w", err) - } - r.Texts = append(r.Texts, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RichTexts) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode richTexts#94b21889 as nil") - } - b.ObjStart() - b.PutID("richTexts") - b.Comma() - b.FieldStart("texts") - b.ArrStart() - for idx, v := range r.Texts { - if v == nil { - return fmt.Errorf("unable to encode richTexts#94b21889: field texts element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode richTexts#94b21889: field texts element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RichTexts) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode richTexts#94b21889 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("richTexts"); err != nil { - return fmt.Errorf("unable to decode richTexts#94b21889: %w", err) - } - case "texts": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONRichText(b) - if err != nil { - return fmt.Errorf("unable to decode richTexts#94b21889: field texts: %w", err) - } - r.Texts = append(r.Texts, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode richTexts#94b21889: field texts: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTexts returns value of Texts field. -func (r *RichTexts) GetTexts() (value []RichTextClass) { - if r == nil { - return - } - return r.Texts -} - -// RichTextClassName is schema name of RichTextClass. -const RichTextClassName = "RichText" - -// RichTextClass represents RichText generic type. -// -// Example: -// -// g, err := tdapi.DecodeRichText(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.RichTextPlain: // richTextPlain#1cc42966 -// case *tdapi.RichTextBold: // richTextBold#63970f6c -// case *tdapi.RichTextItalic: // richTextItalic#6e77f03f -// case *tdapi.RichTextUnderline: // richTextUnderline#e00cfd8c -// case *tdapi.RichTextStrikethrough: // richTextStrikethrough#2b1e6a51 -// case *tdapi.RichTextFixed: // richTextFixed#b43681c7 -// case *tdapi.RichTextURL: // richTextUrl#500cf14 -// case *tdapi.RichTextEmailAddress: // richTextEmailAddress#262a2f7 -// case *tdapi.RichTextSubscript: // richTextSubscript#cc405a4c -// case *tdapi.RichTextSuperscript: // richTextSuperscript#e9377563 -// case *tdapi.RichTextMarked: // richTextMarked#b42ed382 -// case *tdapi.RichTextPhoneNumber: // richTextPhoneNumber#7a91543 -// case *tdapi.RichTextIcon: // richTextIcon#a7c42b02 -// case *tdapi.RichTextReference: // richTextReference#bb9a1276 -// case *tdapi.RichTextAnchor: // richTextAnchor#4e7f1034 -// case *tdapi.RichTextAnchorLink: // richTextAnchorLink#a41fd2d6 -// case *tdapi.RichTexts: // richTexts#94b21889 -// default: panic(v) -// } -type RichTextClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() RichTextClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeRichText implements binary de-serialization for RichTextClass. -func DecodeRichText(buf *bin.Buffer) (RichTextClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case RichTextPlainTypeID: - // Decoding richTextPlain#1cc42966. - v := RichTextPlain{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextBoldTypeID: - // Decoding richTextBold#63970f6c. - v := RichTextBold{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextItalicTypeID: - // Decoding richTextItalic#6e77f03f. - v := RichTextItalic{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextUnderlineTypeID: - // Decoding richTextUnderline#e00cfd8c. - v := RichTextUnderline{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextStrikethroughTypeID: - // Decoding richTextStrikethrough#2b1e6a51. - v := RichTextStrikethrough{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextFixedTypeID: - // Decoding richTextFixed#b43681c7. - v := RichTextFixed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextURLTypeID: - // Decoding richTextUrl#500cf14. - v := RichTextURL{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextEmailAddressTypeID: - // Decoding richTextEmailAddress#262a2f7. - v := RichTextEmailAddress{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextSubscriptTypeID: - // Decoding richTextSubscript#cc405a4c. - v := RichTextSubscript{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextSuperscriptTypeID: - // Decoding richTextSuperscript#e9377563. - v := RichTextSuperscript{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextMarkedTypeID: - // Decoding richTextMarked#b42ed382. - v := RichTextMarked{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextPhoneNumberTypeID: - // Decoding richTextPhoneNumber#7a91543. - v := RichTextPhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextIconTypeID: - // Decoding richTextIcon#a7c42b02. - v := RichTextIcon{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextReferenceTypeID: - // Decoding richTextReference#bb9a1276. - v := RichTextReference{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextAnchorTypeID: - // Decoding richTextAnchor#4e7f1034. - v := RichTextAnchor{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextAnchorLinkTypeID: - // Decoding richTextAnchorLink#a41fd2d6. - v := RichTextAnchorLink{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case RichTextsTypeID: - // Decoding richTexts#94b21889. - v := RichTexts{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode RichTextClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONRichText implements binary de-serialization for RichTextClass. -func DecodeTDLibJSONRichText(buf tdjson.Decoder) (RichTextClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "richTextPlain": - // Decoding richTextPlain#1cc42966. - v := RichTextPlain{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextBold": - // Decoding richTextBold#63970f6c. - v := RichTextBold{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextItalic": - // Decoding richTextItalic#6e77f03f. - v := RichTextItalic{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextUnderline": - // Decoding richTextUnderline#e00cfd8c. - v := RichTextUnderline{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextStrikethrough": - // Decoding richTextStrikethrough#2b1e6a51. - v := RichTextStrikethrough{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextFixed": - // Decoding richTextFixed#b43681c7. - v := RichTextFixed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextUrl": - // Decoding richTextUrl#500cf14. - v := RichTextURL{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextEmailAddress": - // Decoding richTextEmailAddress#262a2f7. - v := RichTextEmailAddress{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextSubscript": - // Decoding richTextSubscript#cc405a4c. - v := RichTextSubscript{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextSuperscript": - // Decoding richTextSuperscript#e9377563. - v := RichTextSuperscript{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextMarked": - // Decoding richTextMarked#b42ed382. - v := RichTextMarked{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextPhoneNumber": - // Decoding richTextPhoneNumber#7a91543. - v := RichTextPhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextIcon": - // Decoding richTextIcon#a7c42b02. - v := RichTextIcon{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextReference": - // Decoding richTextReference#bb9a1276. - v := RichTextReference{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextAnchor": - // Decoding richTextAnchor#4e7f1034. - v := RichTextAnchor{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTextAnchorLink": - // Decoding richTextAnchorLink#a41fd2d6. - v := RichTextAnchorLink{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - case "richTexts": - // Decoding richTexts#94b21889. - v := RichTexts{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode RichTextClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode RichTextClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// RichText boxes the RichTextClass providing a helper. -type RichTextBox struct { - RichText RichTextClass -} - -// Decode implements bin.Decoder for RichTextBox. -func (b *RichTextBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode RichTextBox to nil") - } - v, err := DecodeRichText(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.RichText = v - return nil -} - -// Encode implements bin.Encode for RichTextBox. -func (b *RichTextBox) Encode(buf *bin.Buffer) error { - if b == nil || b.RichText == nil { - return fmt.Errorf("unable to encode RichTextClass as nil") - } - return b.RichText.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for RichTextBox. -func (b *RichTextBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode RichTextBox to nil") - } - v, err := DecodeTDLibJSONRichText(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.RichText = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for RichTextBox. -func (b *RichTextBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.RichText == nil { - return fmt.Errorf("unable to encode RichTextClass as nil") - } - return b.RichText.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_rtmp_url_gen.go b/tdapi/tl_rtmp_url_gen.go deleted file mode 100644 index 4c805c7e8..000000000 --- a/tdapi/tl_rtmp_url_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// RtmpURL represents TL type `rtmpUrl#3c28bc55`. -type RtmpURL struct { - // The URL - URL string - // Stream key - StreamKey string -} - -// RtmpURLTypeID is TL type id of RtmpURL. -const RtmpURLTypeID = 0x3c28bc55 - -// Ensuring interfaces in compile-time for RtmpURL. -var ( - _ bin.Encoder = &RtmpURL{} - _ bin.Decoder = &RtmpURL{} - _ bin.BareEncoder = &RtmpURL{} - _ bin.BareDecoder = &RtmpURL{} -) - -func (r *RtmpURL) Zero() bool { - if r == nil { - return true - } - if !(r.URL == "") { - return false - } - if !(r.StreamKey == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (r *RtmpURL) String() string { - if r == nil { - return "RtmpURL(nil)" - } - type Alias RtmpURL - return fmt.Sprintf("RtmpURL%+v", Alias(*r)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*RtmpURL) TypeID() uint32 { - return RtmpURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*RtmpURL) TypeName() string { - return "rtmpUrl" -} - -// TypeInfo returns info about TL type. -func (r *RtmpURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "rtmpUrl", - ID: RtmpURLTypeID, - } - if r == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "StreamKey", - SchemaName: "stream_key", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (r *RtmpURL) Encode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode rtmpUrl#3c28bc55 as nil") - } - b.PutID(RtmpURLTypeID) - return r.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (r *RtmpURL) EncodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't encode rtmpUrl#3c28bc55 as nil") - } - b.PutString(r.URL) - b.PutString(r.StreamKey) - return nil -} - -// Decode implements bin.Decoder. -func (r *RtmpURL) Decode(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode rtmpUrl#3c28bc55 to nil") - } - if err := b.ConsumeID(RtmpURLTypeID); err != nil { - return fmt.Errorf("unable to decode rtmpUrl#3c28bc55: %w", err) - } - return r.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (r *RtmpURL) DecodeBare(b *bin.Buffer) error { - if r == nil { - return fmt.Errorf("can't decode rtmpUrl#3c28bc55 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode rtmpUrl#3c28bc55: field url: %w", err) - } - r.URL = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode rtmpUrl#3c28bc55: field stream_key: %w", err) - } - r.StreamKey = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (r *RtmpURL) EncodeTDLibJSON(b tdjson.Encoder) error { - if r == nil { - return fmt.Errorf("can't encode rtmpUrl#3c28bc55 as nil") - } - b.ObjStart() - b.PutID("rtmpUrl") - b.Comma() - b.FieldStart("url") - b.PutString(r.URL) - b.Comma() - b.FieldStart("stream_key") - b.PutString(r.StreamKey) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (r *RtmpURL) DecodeTDLibJSON(b tdjson.Decoder) error { - if r == nil { - return fmt.Errorf("can't decode rtmpUrl#3c28bc55 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("rtmpUrl"); err != nil { - return fmt.Errorf("unable to decode rtmpUrl#3c28bc55: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode rtmpUrl#3c28bc55: field url: %w", err) - } - r.URL = value - case "stream_key": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode rtmpUrl#3c28bc55: field stream_key: %w", err) - } - r.StreamKey = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (r *RtmpURL) GetURL() (value string) { - if r == nil { - return - } - return r.URL -} - -// GetStreamKey returns value of StreamKey field. -func (r *RtmpURL) GetStreamKey() (value string) { - if r == nil { - return - } - return r.StreamKey -} diff --git a/tdapi/tl_save_application_log_event_gen.go b/tdapi/tl_save_application_log_event_gen.go deleted file mode 100644 index ecdf5d5eb..000000000 --- a/tdapi/tl_save_application_log_event_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SaveApplicationLogEventRequest represents TL type `saveApplicationLogEvent#cfa6c20e`. -type SaveApplicationLogEventRequest struct { - // Event type - Type string - // Optional chat identifier, associated with the event - ChatID int64 - // The log event data - Data JSONValueClass -} - -// SaveApplicationLogEventRequestTypeID is TL type id of SaveApplicationLogEventRequest. -const SaveApplicationLogEventRequestTypeID = 0xcfa6c20e - -// Ensuring interfaces in compile-time for SaveApplicationLogEventRequest. -var ( - _ bin.Encoder = &SaveApplicationLogEventRequest{} - _ bin.Decoder = &SaveApplicationLogEventRequest{} - _ bin.BareEncoder = &SaveApplicationLogEventRequest{} - _ bin.BareDecoder = &SaveApplicationLogEventRequest{} -) - -func (s *SaveApplicationLogEventRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Type == "") { - return false - } - if !(s.ChatID == 0) { - return false - } - if !(s.Data == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SaveApplicationLogEventRequest) String() string { - if s == nil { - return "SaveApplicationLogEventRequest(nil)" - } - type Alias SaveApplicationLogEventRequest - return fmt.Sprintf("SaveApplicationLogEventRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SaveApplicationLogEventRequest) TypeID() uint32 { - return SaveApplicationLogEventRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SaveApplicationLogEventRequest) TypeName() string { - return "saveApplicationLogEvent" -} - -// TypeInfo returns info about TL type. -func (s *SaveApplicationLogEventRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "saveApplicationLogEvent", - ID: SaveApplicationLogEventRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SaveApplicationLogEventRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode saveApplicationLogEvent#cfa6c20e as nil") - } - b.PutID(SaveApplicationLogEventRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SaveApplicationLogEventRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode saveApplicationLogEvent#cfa6c20e as nil") - } - b.PutString(s.Type) - b.PutInt53(s.ChatID) - if s.Data == nil { - return fmt.Errorf("unable to encode saveApplicationLogEvent#cfa6c20e: field data is nil") - } - if err := s.Data.Encode(b); err != nil { - return fmt.Errorf("unable to encode saveApplicationLogEvent#cfa6c20e: field data: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SaveApplicationLogEventRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode saveApplicationLogEvent#cfa6c20e to nil") - } - if err := b.ConsumeID(SaveApplicationLogEventRequestTypeID); err != nil { - return fmt.Errorf("unable to decode saveApplicationLogEvent#cfa6c20e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SaveApplicationLogEventRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode saveApplicationLogEvent#cfa6c20e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode saveApplicationLogEvent#cfa6c20e: field type: %w", err) - } - s.Type = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode saveApplicationLogEvent#cfa6c20e: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := DecodeJSONValue(b) - if err != nil { - return fmt.Errorf("unable to decode saveApplicationLogEvent#cfa6c20e: field data: %w", err) - } - s.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SaveApplicationLogEventRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode saveApplicationLogEvent#cfa6c20e as nil") - } - b.ObjStart() - b.PutID("saveApplicationLogEvent") - b.Comma() - b.FieldStart("type") - b.PutString(s.Type) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("data") - if s.Data == nil { - return fmt.Errorf("unable to encode saveApplicationLogEvent#cfa6c20e: field data is nil") - } - if err := s.Data.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode saveApplicationLogEvent#cfa6c20e: field data: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SaveApplicationLogEventRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode saveApplicationLogEvent#cfa6c20e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("saveApplicationLogEvent"); err != nil { - return fmt.Errorf("unable to decode saveApplicationLogEvent#cfa6c20e: %w", err) - } - case "type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode saveApplicationLogEvent#cfa6c20e: field type: %w", err) - } - s.Type = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode saveApplicationLogEvent#cfa6c20e: field chat_id: %w", err) - } - s.ChatID = value - case "data": - value, err := DecodeTDLibJSONJSONValue(b) - if err != nil { - return fmt.Errorf("unable to decode saveApplicationLogEvent#cfa6c20e: field data: %w", err) - } - s.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (s *SaveApplicationLogEventRequest) GetType() (value string) { - if s == nil { - return - } - return s.Type -} - -// GetChatID returns value of ChatID field. -func (s *SaveApplicationLogEventRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetData returns value of Data field. -func (s *SaveApplicationLogEventRequest) GetData() (value JSONValueClass) { - if s == nil { - return - } - return s.Data -} - -// SaveApplicationLogEvent invokes method saveApplicationLogEvent#cfa6c20e returning error if any. -func (c *Client) SaveApplicationLogEvent(ctx context.Context, request *SaveApplicationLogEventRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_save_prepared_inline_message_gen.go b/tdapi/tl_save_prepared_inline_message_gen.go deleted file mode 100644 index 714c4d989..000000000 --- a/tdapi/tl_save_prepared_inline_message_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SavePreparedInlineMessageRequest represents TL type `savePreparedInlineMessage#c71468d9`. -type SavePreparedInlineMessageRequest struct { - // Identifier of the user - UserID int64 - // The description of the message - Result InputInlineQueryResultClass - // Types of the chats to which the message can be sent - ChatTypes TargetChatTypes -} - -// SavePreparedInlineMessageRequestTypeID is TL type id of SavePreparedInlineMessageRequest. -const SavePreparedInlineMessageRequestTypeID = 0xc71468d9 - -// Ensuring interfaces in compile-time for SavePreparedInlineMessageRequest. -var ( - _ bin.Encoder = &SavePreparedInlineMessageRequest{} - _ bin.Decoder = &SavePreparedInlineMessageRequest{} - _ bin.BareEncoder = &SavePreparedInlineMessageRequest{} - _ bin.BareDecoder = &SavePreparedInlineMessageRequest{} -) - -func (s *SavePreparedInlineMessageRequest) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Result == nil) { - return false - } - if !(s.ChatTypes.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SavePreparedInlineMessageRequest) String() string { - if s == nil { - return "SavePreparedInlineMessageRequest(nil)" - } - type Alias SavePreparedInlineMessageRequest - return fmt.Sprintf("SavePreparedInlineMessageRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SavePreparedInlineMessageRequest) TypeID() uint32 { - return SavePreparedInlineMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SavePreparedInlineMessageRequest) TypeName() string { - return "savePreparedInlineMessage" -} - -// TypeInfo returns info about TL type. -func (s *SavePreparedInlineMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "savePreparedInlineMessage", - ID: SavePreparedInlineMessageRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Result", - SchemaName: "result", - }, - { - Name: "ChatTypes", - SchemaName: "chat_types", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SavePreparedInlineMessageRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savePreparedInlineMessage#c71468d9 as nil") - } - b.PutID(SavePreparedInlineMessageRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SavePreparedInlineMessageRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savePreparedInlineMessage#c71468d9 as nil") - } - b.PutInt53(s.UserID) - if s.Result == nil { - return fmt.Errorf("unable to encode savePreparedInlineMessage#c71468d9: field result is nil") - } - if err := s.Result.Encode(b); err != nil { - return fmt.Errorf("unable to encode savePreparedInlineMessage#c71468d9: field result: %w", err) - } - if err := s.ChatTypes.Encode(b); err != nil { - return fmt.Errorf("unable to encode savePreparedInlineMessage#c71468d9: field chat_types: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SavePreparedInlineMessageRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savePreparedInlineMessage#c71468d9 to nil") - } - if err := b.ConsumeID(SavePreparedInlineMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode savePreparedInlineMessage#c71468d9: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SavePreparedInlineMessageRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savePreparedInlineMessage#c71468d9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode savePreparedInlineMessage#c71468d9: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := DecodeInputInlineQueryResult(b) - if err != nil { - return fmt.Errorf("unable to decode savePreparedInlineMessage#c71468d9: field result: %w", err) - } - s.Result = value - } - { - if err := s.ChatTypes.Decode(b); err != nil { - return fmt.Errorf("unable to decode savePreparedInlineMessage#c71468d9: field chat_types: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SavePreparedInlineMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode savePreparedInlineMessage#c71468d9 as nil") - } - b.ObjStart() - b.PutID("savePreparedInlineMessage") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("result") - if s.Result == nil { - return fmt.Errorf("unable to encode savePreparedInlineMessage#c71468d9: field result is nil") - } - if err := s.Result.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode savePreparedInlineMessage#c71468d9: field result: %w", err) - } - b.Comma() - b.FieldStart("chat_types") - if err := s.ChatTypes.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode savePreparedInlineMessage#c71468d9: field chat_types: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SavePreparedInlineMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode savePreparedInlineMessage#c71468d9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("savePreparedInlineMessage"); err != nil { - return fmt.Errorf("unable to decode savePreparedInlineMessage#c71468d9: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode savePreparedInlineMessage#c71468d9: field user_id: %w", err) - } - s.UserID = value - case "result": - value, err := DecodeTDLibJSONInputInlineQueryResult(b) - if err != nil { - return fmt.Errorf("unable to decode savePreparedInlineMessage#c71468d9: field result: %w", err) - } - s.Result = value - case "chat_types": - if err := s.ChatTypes.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode savePreparedInlineMessage#c71468d9: field chat_types: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *SavePreparedInlineMessageRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetResult returns value of Result field. -func (s *SavePreparedInlineMessageRequest) GetResult() (value InputInlineQueryResultClass) { - if s == nil { - return - } - return s.Result -} - -// GetChatTypes returns value of ChatTypes field. -func (s *SavePreparedInlineMessageRequest) GetChatTypes() (value TargetChatTypes) { - if s == nil { - return - } - return s.ChatTypes -} - -// SavePreparedInlineMessage invokes method savePreparedInlineMessage#c71468d9 returning error if any. -func (c *Client) SavePreparedInlineMessage(ctx context.Context, request *SavePreparedInlineMessageRequest) (*PreparedInlineMessageID, error) { - var result PreparedInlineMessageID - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_saved_credentials_gen.go b/tdapi/tl_saved_credentials_gen.go deleted file mode 100644 index 21cb52123..000000000 --- a/tdapi/tl_saved_credentials_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SavedCredentials represents TL type `savedCredentials#e9ee14dc`. -type SavedCredentials struct { - // Unique identifier of the saved credentials - ID string - // Title of the saved credentials - Title string -} - -// SavedCredentialsTypeID is TL type id of SavedCredentials. -const SavedCredentialsTypeID = 0xe9ee14dc - -// Ensuring interfaces in compile-time for SavedCredentials. -var ( - _ bin.Encoder = &SavedCredentials{} - _ bin.Decoder = &SavedCredentials{} - _ bin.BareEncoder = &SavedCredentials{} - _ bin.BareDecoder = &SavedCredentials{} -) - -func (s *SavedCredentials) Zero() bool { - if s == nil { - return true - } - if !(s.ID == "") { - return false - } - if !(s.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SavedCredentials) String() string { - if s == nil { - return "SavedCredentials(nil)" - } - type Alias SavedCredentials - return fmt.Sprintf("SavedCredentials%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SavedCredentials) TypeID() uint32 { - return SavedCredentialsTypeID -} - -// TypeName returns name of type in TL schema. -func (*SavedCredentials) TypeName() string { - return "savedCredentials" -} - -// TypeInfo returns info about TL type. -func (s *SavedCredentials) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "savedCredentials", - ID: SavedCredentialsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SavedCredentials) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedCredentials#e9ee14dc as nil") - } - b.PutID(SavedCredentialsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SavedCredentials) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedCredentials#e9ee14dc as nil") - } - b.PutString(s.ID) - b.PutString(s.Title) - return nil -} - -// Decode implements bin.Decoder. -func (s *SavedCredentials) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedCredentials#e9ee14dc to nil") - } - if err := b.ConsumeID(SavedCredentialsTypeID); err != nil { - return fmt.Errorf("unable to decode savedCredentials#e9ee14dc: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SavedCredentials) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedCredentials#e9ee14dc to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode savedCredentials#e9ee14dc: field id: %w", err) - } - s.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode savedCredentials#e9ee14dc: field title: %w", err) - } - s.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SavedCredentials) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode savedCredentials#e9ee14dc as nil") - } - b.ObjStart() - b.PutID("savedCredentials") - b.Comma() - b.FieldStart("id") - b.PutString(s.ID) - b.Comma() - b.FieldStart("title") - b.PutString(s.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SavedCredentials) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode savedCredentials#e9ee14dc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("savedCredentials"); err != nil { - return fmt.Errorf("unable to decode savedCredentials#e9ee14dc: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode savedCredentials#e9ee14dc: field id: %w", err) - } - s.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode savedCredentials#e9ee14dc: field title: %w", err) - } - s.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *SavedCredentials) GetID() (value string) { - if s == nil { - return - } - return s.ID -} - -// GetTitle returns value of Title field. -func (s *SavedCredentials) GetTitle() (value string) { - if s == nil { - return - } - return s.Title -} diff --git a/tdapi/tl_saved_messages_tag_gen.go b/tdapi/tl_saved_messages_tag_gen.go deleted file mode 100644 index 54eb74ab6..000000000 --- a/tdapi/tl_saved_messages_tag_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SavedMessagesTag represents TL type `savedMessagesTag#6a67bc61`. -type SavedMessagesTag struct { - // The tag - Tag ReactionTypeClass - // Label of the tag; 0-12 characters. Always empty if the tag is returned for a Saved - // Messages topic - Label string - // Number of times the tag was used; may be 0 if the tag has non-empty label - Count int32 -} - -// SavedMessagesTagTypeID is TL type id of SavedMessagesTag. -const SavedMessagesTagTypeID = 0x6a67bc61 - -// Ensuring interfaces in compile-time for SavedMessagesTag. -var ( - _ bin.Encoder = &SavedMessagesTag{} - _ bin.Decoder = &SavedMessagesTag{} - _ bin.BareEncoder = &SavedMessagesTag{} - _ bin.BareDecoder = &SavedMessagesTag{} -) - -func (s *SavedMessagesTag) Zero() bool { - if s == nil { - return true - } - if !(s.Tag == nil) { - return false - } - if !(s.Label == "") { - return false - } - if !(s.Count == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SavedMessagesTag) String() string { - if s == nil { - return "SavedMessagesTag(nil)" - } - type Alias SavedMessagesTag - return fmt.Sprintf("SavedMessagesTag%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SavedMessagesTag) TypeID() uint32 { - return SavedMessagesTagTypeID -} - -// TypeName returns name of type in TL schema. -func (*SavedMessagesTag) TypeName() string { - return "savedMessagesTag" -} - -// TypeInfo returns info about TL type. -func (s *SavedMessagesTag) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "savedMessagesTag", - ID: SavedMessagesTagTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Tag", - SchemaName: "tag", - }, - { - Name: "Label", - SchemaName: "label", - }, - { - Name: "Count", - SchemaName: "count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SavedMessagesTag) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTag#6a67bc61 as nil") - } - b.PutID(SavedMessagesTagTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SavedMessagesTag) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTag#6a67bc61 as nil") - } - if s.Tag == nil { - return fmt.Errorf("unable to encode savedMessagesTag#6a67bc61: field tag is nil") - } - if err := s.Tag.Encode(b); err != nil { - return fmt.Errorf("unable to encode savedMessagesTag#6a67bc61: field tag: %w", err) - } - b.PutString(s.Label) - b.PutInt32(s.Count) - return nil -} - -// Decode implements bin.Decoder. -func (s *SavedMessagesTag) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTag#6a67bc61 to nil") - } - if err := b.ConsumeID(SavedMessagesTagTypeID); err != nil { - return fmt.Errorf("unable to decode savedMessagesTag#6a67bc61: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SavedMessagesTag) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTag#6a67bc61 to nil") - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTag#6a67bc61: field tag: %w", err) - } - s.Tag = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTag#6a67bc61: field label: %w", err) - } - s.Label = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTag#6a67bc61: field count: %w", err) - } - s.Count = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SavedMessagesTag) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTag#6a67bc61 as nil") - } - b.ObjStart() - b.PutID("savedMessagesTag") - b.Comma() - b.FieldStart("tag") - if s.Tag == nil { - return fmt.Errorf("unable to encode savedMessagesTag#6a67bc61: field tag is nil") - } - if err := s.Tag.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode savedMessagesTag#6a67bc61: field tag: %w", err) - } - b.Comma() - b.FieldStart("label") - b.PutString(s.Label) - b.Comma() - b.FieldStart("count") - b.PutInt32(s.Count) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SavedMessagesTag) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTag#6a67bc61 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("savedMessagesTag"); err != nil { - return fmt.Errorf("unable to decode savedMessagesTag#6a67bc61: %w", err) - } - case "tag": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTag#6a67bc61: field tag: %w", err) - } - s.Tag = value - case "label": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTag#6a67bc61: field label: %w", err) - } - s.Label = value - case "count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTag#6a67bc61: field count: %w", err) - } - s.Count = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTag returns value of Tag field. -func (s *SavedMessagesTag) GetTag() (value ReactionTypeClass) { - if s == nil { - return - } - return s.Tag -} - -// GetLabel returns value of Label field. -func (s *SavedMessagesTag) GetLabel() (value string) { - if s == nil { - return - } - return s.Label -} - -// GetCount returns value of Count field. -func (s *SavedMessagesTag) GetCount() (value int32) { - if s == nil { - return - } - return s.Count -} diff --git a/tdapi/tl_saved_messages_tags_gen.go b/tdapi/tl_saved_messages_tags_gen.go deleted file mode 100644 index f68c9b5ba..000000000 --- a/tdapi/tl_saved_messages_tags_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SavedMessagesTags represents TL type `savedMessagesTags#ca94a1b3`. -type SavedMessagesTags struct { - // List of tags - Tags []SavedMessagesTag -} - -// SavedMessagesTagsTypeID is TL type id of SavedMessagesTags. -const SavedMessagesTagsTypeID = 0xca94a1b3 - -// Ensuring interfaces in compile-time for SavedMessagesTags. -var ( - _ bin.Encoder = &SavedMessagesTags{} - _ bin.Decoder = &SavedMessagesTags{} - _ bin.BareEncoder = &SavedMessagesTags{} - _ bin.BareDecoder = &SavedMessagesTags{} -) - -func (s *SavedMessagesTags) Zero() bool { - if s == nil { - return true - } - if !(s.Tags == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SavedMessagesTags) String() string { - if s == nil { - return "SavedMessagesTags(nil)" - } - type Alias SavedMessagesTags - return fmt.Sprintf("SavedMessagesTags%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SavedMessagesTags) TypeID() uint32 { - return SavedMessagesTagsTypeID -} - -// TypeName returns name of type in TL schema. -func (*SavedMessagesTags) TypeName() string { - return "savedMessagesTags" -} - -// TypeInfo returns info about TL type. -func (s *SavedMessagesTags) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "savedMessagesTags", - ID: SavedMessagesTagsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Tags", - SchemaName: "tags", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SavedMessagesTags) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTags#ca94a1b3 as nil") - } - b.PutID(SavedMessagesTagsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SavedMessagesTags) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTags#ca94a1b3 as nil") - } - b.PutInt(len(s.Tags)) - for idx, v := range s.Tags { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare savedMessagesTags#ca94a1b3: field tags element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SavedMessagesTags) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTags#ca94a1b3 to nil") - } - if err := b.ConsumeID(SavedMessagesTagsTypeID); err != nil { - return fmt.Errorf("unable to decode savedMessagesTags#ca94a1b3: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SavedMessagesTags) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTags#ca94a1b3 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTags#ca94a1b3: field tags: %w", err) - } - - if headerLen > 0 { - s.Tags = make([]SavedMessagesTag, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value SavedMessagesTag - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare savedMessagesTags#ca94a1b3: field tags: %w", err) - } - s.Tags = append(s.Tags, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SavedMessagesTags) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTags#ca94a1b3 as nil") - } - b.ObjStart() - b.PutID("savedMessagesTags") - b.Comma() - b.FieldStart("tags") - b.ArrStart() - for idx, v := range s.Tags { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode savedMessagesTags#ca94a1b3: field tags element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SavedMessagesTags) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTags#ca94a1b3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("savedMessagesTags"); err != nil { - return fmt.Errorf("unable to decode savedMessagesTags#ca94a1b3: %w", err) - } - case "tags": - if err := b.Arr(func(b tdjson.Decoder) error { - var value SavedMessagesTag - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode savedMessagesTags#ca94a1b3: field tags: %w", err) - } - s.Tags = append(s.Tags, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode savedMessagesTags#ca94a1b3: field tags: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTags returns value of Tags field. -func (s *SavedMessagesTags) GetTags() (value []SavedMessagesTag) { - if s == nil { - return - } - return s.Tags -} diff --git a/tdapi/tl_saved_messages_topic_gen.go b/tdapi/tl_saved_messages_topic_gen.go deleted file mode 100644 index ecb84e7ee..000000000 --- a/tdapi/tl_saved_messages_topic_gen.go +++ /dev/null @@ -1,374 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SavedMessagesTopic represents TL type `savedMessagesTopic#d2a8e1a4`. -type SavedMessagesTopic struct { - // Unique topic identifier - ID int64 - // Type of the topic - Type SavedMessagesTopicTypeClass - // True, if the topic is pinned - IsPinned bool - // A parameter used to determine order of the topic in the topic list. Topics must be - // sorted by the order in descending order - Order int64 - // Last message in the topic; may be null if none or unknown - LastMessage Message - // A draft of a message in the topic; may be null if none - DraftMessage DraftMessage -} - -// SavedMessagesTopicTypeID is TL type id of SavedMessagesTopic. -const SavedMessagesTopicTypeID = 0xd2a8e1a4 - -// Ensuring interfaces in compile-time for SavedMessagesTopic. -var ( - _ bin.Encoder = &SavedMessagesTopic{} - _ bin.Decoder = &SavedMessagesTopic{} - _ bin.BareEncoder = &SavedMessagesTopic{} - _ bin.BareDecoder = &SavedMessagesTopic{} -) - -func (s *SavedMessagesTopic) Zero() bool { - if s == nil { - return true - } - if !(s.ID == 0) { - return false - } - if !(s.Type == nil) { - return false - } - if !(s.IsPinned == false) { - return false - } - if !(s.Order == 0) { - return false - } - if !(s.LastMessage.Zero()) { - return false - } - if !(s.DraftMessage.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SavedMessagesTopic) String() string { - if s == nil { - return "SavedMessagesTopic(nil)" - } - type Alias SavedMessagesTopic - return fmt.Sprintf("SavedMessagesTopic%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SavedMessagesTopic) TypeID() uint32 { - return SavedMessagesTopicTypeID -} - -// TypeName returns name of type in TL schema. -func (*SavedMessagesTopic) TypeName() string { - return "savedMessagesTopic" -} - -// TypeInfo returns info about TL type. -func (s *SavedMessagesTopic) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "savedMessagesTopic", - ID: SavedMessagesTopicTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - { - Name: "Order", - SchemaName: "order", - }, - { - Name: "LastMessage", - SchemaName: "last_message", - }, - { - Name: "DraftMessage", - SchemaName: "draft_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SavedMessagesTopic) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopic#d2a8e1a4 as nil") - } - b.PutID(SavedMessagesTopicTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SavedMessagesTopic) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopic#d2a8e1a4 as nil") - } - b.PutInt53(s.ID) - if s.Type == nil { - return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field type is nil") - } - if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field type: %w", err) - } - b.PutBool(s.IsPinned) - b.PutLong(s.Order) - if err := s.LastMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field last_message: %w", err) - } - if err := s.DraftMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field draft_message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SavedMessagesTopic) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopic#d2a8e1a4 to nil") - } - if err := b.ConsumeID(SavedMessagesTopicTypeID); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SavedMessagesTopic) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopic#d2a8e1a4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field id: %w", err) - } - s.ID = value - } - { - value, err := DecodeSavedMessagesTopicType(b) - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field type: %w", err) - } - s.Type = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field is_pinned: %w", err) - } - s.IsPinned = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field order: %w", err) - } - s.Order = value - } - { - if err := s.LastMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field last_message: %w", err) - } - } - { - if err := s.DraftMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field draft_message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SavedMessagesTopic) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopic#d2a8e1a4 as nil") - } - b.ObjStart() - b.PutID("savedMessagesTopic") - b.Comma() - b.FieldStart("id") - b.PutInt53(s.ID) - b.Comma() - b.FieldStart("type") - if s.Type == nil { - return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field type is nil") - } - if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field type: %w", err) - } - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(s.IsPinned) - b.Comma() - b.FieldStart("order") - b.PutLong(s.Order) - b.Comma() - b.FieldStart("last_message") - if err := s.LastMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field last_message: %w", err) - } - b.Comma() - b.FieldStart("draft_message") - if err := s.DraftMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode savedMessagesTopic#d2a8e1a4: field draft_message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SavedMessagesTopic) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopic#d2a8e1a4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("savedMessagesTopic"); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: %w", err) - } - case "id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field id: %w", err) - } - s.ID = value - case "type": - value, err := DecodeTDLibJSONSavedMessagesTopicType(b) - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field type: %w", err) - } - s.Type = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field is_pinned: %w", err) - } - s.IsPinned = value - case "order": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field order: %w", err) - } - s.Order = value - case "last_message": - if err := s.LastMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field last_message: %w", err) - } - case "draft_message": - if err := s.DraftMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopic#d2a8e1a4: field draft_message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *SavedMessagesTopic) GetID() (value int64) { - if s == nil { - return - } - return s.ID -} - -// GetType returns value of Type field. -func (s *SavedMessagesTopic) GetType() (value SavedMessagesTopicTypeClass) { - if s == nil { - return - } - return s.Type -} - -// GetIsPinned returns value of IsPinned field. -func (s *SavedMessagesTopic) GetIsPinned() (value bool) { - if s == nil { - return - } - return s.IsPinned -} - -// GetOrder returns value of Order field. -func (s *SavedMessagesTopic) GetOrder() (value int64) { - if s == nil { - return - } - return s.Order -} - -// GetLastMessage returns value of LastMessage field. -func (s *SavedMessagesTopic) GetLastMessage() (value Message) { - if s == nil { - return - } - return s.LastMessage -} - -// GetDraftMessage returns value of DraftMessage field. -func (s *SavedMessagesTopic) GetDraftMessage() (value DraftMessage) { - if s == nil { - return - } - return s.DraftMessage -} diff --git a/tdapi/tl_saved_messages_topic_type_gen.go b/tdapi/tl_saved_messages_topic_type_gen.go deleted file mode 100644 index 94eab9b27..000000000 --- a/tdapi/tl_saved_messages_topic_type_gen.go +++ /dev/null @@ -1,612 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SavedMessagesTopicTypeMyNotes represents TL type `savedMessagesTopicTypeMyNotes#b38a41f5`. -type SavedMessagesTopicTypeMyNotes struct { -} - -// SavedMessagesTopicTypeMyNotesTypeID is TL type id of SavedMessagesTopicTypeMyNotes. -const SavedMessagesTopicTypeMyNotesTypeID = 0xb38a41f5 - -// construct implements constructor of SavedMessagesTopicTypeClass. -func (s SavedMessagesTopicTypeMyNotes) construct() SavedMessagesTopicTypeClass { return &s } - -// Ensuring interfaces in compile-time for SavedMessagesTopicTypeMyNotes. -var ( - _ bin.Encoder = &SavedMessagesTopicTypeMyNotes{} - _ bin.Decoder = &SavedMessagesTopicTypeMyNotes{} - _ bin.BareEncoder = &SavedMessagesTopicTypeMyNotes{} - _ bin.BareDecoder = &SavedMessagesTopicTypeMyNotes{} - - _ SavedMessagesTopicTypeClass = &SavedMessagesTopicTypeMyNotes{} -) - -func (s *SavedMessagesTopicTypeMyNotes) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SavedMessagesTopicTypeMyNotes) String() string { - if s == nil { - return "SavedMessagesTopicTypeMyNotes(nil)" - } - type Alias SavedMessagesTopicTypeMyNotes - return fmt.Sprintf("SavedMessagesTopicTypeMyNotes%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SavedMessagesTopicTypeMyNotes) TypeID() uint32 { - return SavedMessagesTopicTypeMyNotesTypeID -} - -// TypeName returns name of type in TL schema. -func (*SavedMessagesTopicTypeMyNotes) TypeName() string { - return "savedMessagesTopicTypeMyNotes" -} - -// TypeInfo returns info about TL type. -func (s *SavedMessagesTopicTypeMyNotes) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "savedMessagesTopicTypeMyNotes", - ID: SavedMessagesTopicTypeMyNotesTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SavedMessagesTopicTypeMyNotes) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicTypeMyNotes#b38a41f5 as nil") - } - b.PutID(SavedMessagesTopicTypeMyNotesTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SavedMessagesTopicTypeMyNotes) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicTypeMyNotes#b38a41f5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SavedMessagesTopicTypeMyNotes) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicTypeMyNotes#b38a41f5 to nil") - } - if err := b.ConsumeID(SavedMessagesTopicTypeMyNotesTypeID); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicTypeMyNotes#b38a41f5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SavedMessagesTopicTypeMyNotes) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicTypeMyNotes#b38a41f5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SavedMessagesTopicTypeMyNotes) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicTypeMyNotes#b38a41f5 as nil") - } - b.ObjStart() - b.PutID("savedMessagesTopicTypeMyNotes") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SavedMessagesTopicTypeMyNotes) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicTypeMyNotes#b38a41f5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("savedMessagesTopicTypeMyNotes"); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicTypeMyNotes#b38a41f5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SavedMessagesTopicTypeAuthorHidden represents TL type `savedMessagesTopicTypeAuthorHidden#703c4195`. -type SavedMessagesTopicTypeAuthorHidden struct { -} - -// SavedMessagesTopicTypeAuthorHiddenTypeID is TL type id of SavedMessagesTopicTypeAuthorHidden. -const SavedMessagesTopicTypeAuthorHiddenTypeID = 0x703c4195 - -// construct implements constructor of SavedMessagesTopicTypeClass. -func (s SavedMessagesTopicTypeAuthorHidden) construct() SavedMessagesTopicTypeClass { return &s } - -// Ensuring interfaces in compile-time for SavedMessagesTopicTypeAuthorHidden. -var ( - _ bin.Encoder = &SavedMessagesTopicTypeAuthorHidden{} - _ bin.Decoder = &SavedMessagesTopicTypeAuthorHidden{} - _ bin.BareEncoder = &SavedMessagesTopicTypeAuthorHidden{} - _ bin.BareDecoder = &SavedMessagesTopicTypeAuthorHidden{} - - _ SavedMessagesTopicTypeClass = &SavedMessagesTopicTypeAuthorHidden{} -) - -func (s *SavedMessagesTopicTypeAuthorHidden) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SavedMessagesTopicTypeAuthorHidden) String() string { - if s == nil { - return "SavedMessagesTopicTypeAuthorHidden(nil)" - } - type Alias SavedMessagesTopicTypeAuthorHidden - return fmt.Sprintf("SavedMessagesTopicTypeAuthorHidden%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SavedMessagesTopicTypeAuthorHidden) TypeID() uint32 { - return SavedMessagesTopicTypeAuthorHiddenTypeID -} - -// TypeName returns name of type in TL schema. -func (*SavedMessagesTopicTypeAuthorHidden) TypeName() string { - return "savedMessagesTopicTypeAuthorHidden" -} - -// TypeInfo returns info about TL type. -func (s *SavedMessagesTopicTypeAuthorHidden) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "savedMessagesTopicTypeAuthorHidden", - ID: SavedMessagesTopicTypeAuthorHiddenTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SavedMessagesTopicTypeAuthorHidden) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicTypeAuthorHidden#703c4195 as nil") - } - b.PutID(SavedMessagesTopicTypeAuthorHiddenTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SavedMessagesTopicTypeAuthorHidden) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicTypeAuthorHidden#703c4195 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SavedMessagesTopicTypeAuthorHidden) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicTypeAuthorHidden#703c4195 to nil") - } - if err := b.ConsumeID(SavedMessagesTopicTypeAuthorHiddenTypeID); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicTypeAuthorHidden#703c4195: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SavedMessagesTopicTypeAuthorHidden) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicTypeAuthorHidden#703c4195 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SavedMessagesTopicTypeAuthorHidden) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicTypeAuthorHidden#703c4195 as nil") - } - b.ObjStart() - b.PutID("savedMessagesTopicTypeAuthorHidden") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SavedMessagesTopicTypeAuthorHidden) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicTypeAuthorHidden#703c4195 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("savedMessagesTopicTypeAuthorHidden"); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicTypeAuthorHidden#703c4195: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SavedMessagesTopicTypeSavedFromChat represents TL type `savedMessagesTopicTypeSavedFromChat#993fad58`. -type SavedMessagesTopicTypeSavedFromChat struct { - // Identifier of the chat - ChatID int64 -} - -// SavedMessagesTopicTypeSavedFromChatTypeID is TL type id of SavedMessagesTopicTypeSavedFromChat. -const SavedMessagesTopicTypeSavedFromChatTypeID = 0x993fad58 - -// construct implements constructor of SavedMessagesTopicTypeClass. -func (s SavedMessagesTopicTypeSavedFromChat) construct() SavedMessagesTopicTypeClass { return &s } - -// Ensuring interfaces in compile-time for SavedMessagesTopicTypeSavedFromChat. -var ( - _ bin.Encoder = &SavedMessagesTopicTypeSavedFromChat{} - _ bin.Decoder = &SavedMessagesTopicTypeSavedFromChat{} - _ bin.BareEncoder = &SavedMessagesTopicTypeSavedFromChat{} - _ bin.BareDecoder = &SavedMessagesTopicTypeSavedFromChat{} - - _ SavedMessagesTopicTypeClass = &SavedMessagesTopicTypeSavedFromChat{} -) - -func (s *SavedMessagesTopicTypeSavedFromChat) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SavedMessagesTopicTypeSavedFromChat) String() string { - if s == nil { - return "SavedMessagesTopicTypeSavedFromChat(nil)" - } - type Alias SavedMessagesTopicTypeSavedFromChat - return fmt.Sprintf("SavedMessagesTopicTypeSavedFromChat%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SavedMessagesTopicTypeSavedFromChat) TypeID() uint32 { - return SavedMessagesTopicTypeSavedFromChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*SavedMessagesTopicTypeSavedFromChat) TypeName() string { - return "savedMessagesTopicTypeSavedFromChat" -} - -// TypeInfo returns info about TL type. -func (s *SavedMessagesTopicTypeSavedFromChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "savedMessagesTopicTypeSavedFromChat", - ID: SavedMessagesTopicTypeSavedFromChatTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SavedMessagesTopicTypeSavedFromChat) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicTypeSavedFromChat#993fad58 as nil") - } - b.PutID(SavedMessagesTopicTypeSavedFromChatTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SavedMessagesTopicTypeSavedFromChat) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicTypeSavedFromChat#993fad58 as nil") - } - b.PutInt53(s.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SavedMessagesTopicTypeSavedFromChat) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicTypeSavedFromChat#993fad58 to nil") - } - if err := b.ConsumeID(SavedMessagesTopicTypeSavedFromChatTypeID); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicTypeSavedFromChat#993fad58: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SavedMessagesTopicTypeSavedFromChat) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicTypeSavedFromChat#993fad58 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicTypeSavedFromChat#993fad58: field chat_id: %w", err) - } - s.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SavedMessagesTopicTypeSavedFromChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode savedMessagesTopicTypeSavedFromChat#993fad58 as nil") - } - b.ObjStart() - b.PutID("savedMessagesTopicTypeSavedFromChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SavedMessagesTopicTypeSavedFromChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode savedMessagesTopicTypeSavedFromChat#993fad58 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("savedMessagesTopicTypeSavedFromChat"); err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicTypeSavedFromChat#993fad58: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode savedMessagesTopicTypeSavedFromChat#993fad58: field chat_id: %w", err) - } - s.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SavedMessagesTopicTypeSavedFromChat) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// SavedMessagesTopicTypeClassName is schema name of SavedMessagesTopicTypeClass. -const SavedMessagesTopicTypeClassName = "SavedMessagesTopicType" - -// SavedMessagesTopicTypeClass represents SavedMessagesTopicType generic type. -// -// Example: -// -// g, err := tdapi.DecodeSavedMessagesTopicType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.SavedMessagesTopicTypeMyNotes: // savedMessagesTopicTypeMyNotes#b38a41f5 -// case *tdapi.SavedMessagesTopicTypeAuthorHidden: // savedMessagesTopicTypeAuthorHidden#703c4195 -// case *tdapi.SavedMessagesTopicTypeSavedFromChat: // savedMessagesTopicTypeSavedFromChat#993fad58 -// default: panic(v) -// } -type SavedMessagesTopicTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() SavedMessagesTopicTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeSavedMessagesTopicType implements binary de-serialization for SavedMessagesTopicTypeClass. -func DecodeSavedMessagesTopicType(buf *bin.Buffer) (SavedMessagesTopicTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case SavedMessagesTopicTypeMyNotesTypeID: - // Decoding savedMessagesTopicTypeMyNotes#b38a41f5. - v := SavedMessagesTopicTypeMyNotes{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) - } - return &v, nil - case SavedMessagesTopicTypeAuthorHiddenTypeID: - // Decoding savedMessagesTopicTypeAuthorHidden#703c4195. - v := SavedMessagesTopicTypeAuthorHidden{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) - } - return &v, nil - case SavedMessagesTopicTypeSavedFromChatTypeID: - // Decoding savedMessagesTopicTypeSavedFromChat#993fad58. - v := SavedMessagesTopicTypeSavedFromChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONSavedMessagesTopicType implements binary de-serialization for SavedMessagesTopicTypeClass. -func DecodeTDLibJSONSavedMessagesTopicType(buf tdjson.Decoder) (SavedMessagesTopicTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "savedMessagesTopicTypeMyNotes": - // Decoding savedMessagesTopicTypeMyNotes#b38a41f5. - v := SavedMessagesTopicTypeMyNotes{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) - } - return &v, nil - case "savedMessagesTopicTypeAuthorHidden": - // Decoding savedMessagesTopicTypeAuthorHidden#703c4195. - v := SavedMessagesTopicTypeAuthorHidden{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) - } - return &v, nil - case "savedMessagesTopicTypeSavedFromChat": - // Decoding savedMessagesTopicTypeSavedFromChat#993fad58. - v := SavedMessagesTopicTypeSavedFromChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SavedMessagesTopicTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// SavedMessagesTopicType boxes the SavedMessagesTopicTypeClass providing a helper. -type SavedMessagesTopicTypeBox struct { - SavedMessagesTopicType SavedMessagesTopicTypeClass -} - -// Decode implements bin.Decoder for SavedMessagesTopicTypeBox. -func (b *SavedMessagesTopicTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode SavedMessagesTopicTypeBox to nil") - } - v, err := DecodeSavedMessagesTopicType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SavedMessagesTopicType = v - return nil -} - -// Encode implements bin.Encode for SavedMessagesTopicTypeBox. -func (b *SavedMessagesTopicTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.SavedMessagesTopicType == nil { - return fmt.Errorf("unable to encode SavedMessagesTopicTypeClass as nil") - } - return b.SavedMessagesTopicType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for SavedMessagesTopicTypeBox. -func (b *SavedMessagesTopicTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode SavedMessagesTopicTypeBox to nil") - } - v, err := DecodeTDLibJSONSavedMessagesTopicType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SavedMessagesTopicType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for SavedMessagesTopicTypeBox. -func (b *SavedMessagesTopicTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.SavedMessagesTopicType == nil { - return fmt.Errorf("unable to encode SavedMessagesTopicTypeClass as nil") - } - return b.SavedMessagesTopicType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_scope_autosave_settings_gen.go b/tdapi/tl_scope_autosave_settings_gen.go deleted file mode 100644 index 08eeb4f3e..000000000 --- a/tdapi/tl_scope_autosave_settings_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ScopeAutosaveSettings represents TL type `scopeAutosaveSettings#5c329f33`. -type ScopeAutosaveSettings struct { - // True, if photo autosave is enabled - AutosavePhotos bool - // True, if video autosave is enabled - AutosaveVideos bool - // The maximum size of a video file to be autosaved, in bytes; 512 KB - 4000 MB - MaxVideoFileSize int64 -} - -// ScopeAutosaveSettingsTypeID is TL type id of ScopeAutosaveSettings. -const ScopeAutosaveSettingsTypeID = 0x5c329f33 - -// Ensuring interfaces in compile-time for ScopeAutosaveSettings. -var ( - _ bin.Encoder = &ScopeAutosaveSettings{} - _ bin.Decoder = &ScopeAutosaveSettings{} - _ bin.BareEncoder = &ScopeAutosaveSettings{} - _ bin.BareDecoder = &ScopeAutosaveSettings{} -) - -func (s *ScopeAutosaveSettings) Zero() bool { - if s == nil { - return true - } - if !(s.AutosavePhotos == false) { - return false - } - if !(s.AutosaveVideos == false) { - return false - } - if !(s.MaxVideoFileSize == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *ScopeAutosaveSettings) String() string { - if s == nil { - return "ScopeAutosaveSettings(nil)" - } - type Alias ScopeAutosaveSettings - return fmt.Sprintf("ScopeAutosaveSettings%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ScopeAutosaveSettings) TypeID() uint32 { - return ScopeAutosaveSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ScopeAutosaveSettings) TypeName() string { - return "scopeAutosaveSettings" -} - -// TypeInfo returns info about TL type. -func (s *ScopeAutosaveSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "scopeAutosaveSettings", - ID: ScopeAutosaveSettingsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AutosavePhotos", - SchemaName: "autosave_photos", - }, - { - Name: "AutosaveVideos", - SchemaName: "autosave_videos", - }, - { - Name: "MaxVideoFileSize", - SchemaName: "max_video_file_size", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *ScopeAutosaveSettings) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode scopeAutosaveSettings#5c329f33 as nil") - } - b.PutID(ScopeAutosaveSettingsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *ScopeAutosaveSettings) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode scopeAutosaveSettings#5c329f33 as nil") - } - b.PutBool(s.AutosavePhotos) - b.PutBool(s.AutosaveVideos) - b.PutInt53(s.MaxVideoFileSize) - return nil -} - -// Decode implements bin.Decoder. -func (s *ScopeAutosaveSettings) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode scopeAutosaveSettings#5c329f33 to nil") - } - if err := b.ConsumeID(ScopeAutosaveSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode scopeAutosaveSettings#5c329f33: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *ScopeAutosaveSettings) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode scopeAutosaveSettings#5c329f33 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeAutosaveSettings#5c329f33: field autosave_photos: %w", err) - } - s.AutosavePhotos = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeAutosaveSettings#5c329f33: field autosave_videos: %w", err) - } - s.AutosaveVideos = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode scopeAutosaveSettings#5c329f33: field max_video_file_size: %w", err) - } - s.MaxVideoFileSize = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *ScopeAutosaveSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode scopeAutosaveSettings#5c329f33 as nil") - } - b.ObjStart() - b.PutID("scopeAutosaveSettings") - b.Comma() - b.FieldStart("autosave_photos") - b.PutBool(s.AutosavePhotos) - b.Comma() - b.FieldStart("autosave_videos") - b.PutBool(s.AutosaveVideos) - b.Comma() - b.FieldStart("max_video_file_size") - b.PutInt53(s.MaxVideoFileSize) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *ScopeAutosaveSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode scopeAutosaveSettings#5c329f33 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("scopeAutosaveSettings"); err != nil { - return fmt.Errorf("unable to decode scopeAutosaveSettings#5c329f33: %w", err) - } - case "autosave_photos": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeAutosaveSettings#5c329f33: field autosave_photos: %w", err) - } - s.AutosavePhotos = value - case "autosave_videos": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeAutosaveSettings#5c329f33: field autosave_videos: %w", err) - } - s.AutosaveVideos = value - case "max_video_file_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode scopeAutosaveSettings#5c329f33: field max_video_file_size: %w", err) - } - s.MaxVideoFileSize = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAutosavePhotos returns value of AutosavePhotos field. -func (s *ScopeAutosaveSettings) GetAutosavePhotos() (value bool) { - if s == nil { - return - } - return s.AutosavePhotos -} - -// GetAutosaveVideos returns value of AutosaveVideos field. -func (s *ScopeAutosaveSettings) GetAutosaveVideos() (value bool) { - if s == nil { - return - } - return s.AutosaveVideos -} - -// GetMaxVideoFileSize returns value of MaxVideoFileSize field. -func (s *ScopeAutosaveSettings) GetMaxVideoFileSize() (value int64) { - if s == nil { - return - } - return s.MaxVideoFileSize -} diff --git a/tdapi/tl_scope_notification_settings_gen.go b/tdapi/tl_scope_notification_settings_gen.go deleted file mode 100644 index b91c7d033..000000000 --- a/tdapi/tl_scope_notification_settings_gen.go +++ /dev/null @@ -1,468 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ScopeNotificationSettings represents TL type `scopeNotificationSettings#dc4a615f`. -type ScopeNotificationSettings struct { - // Time left before notifications will be unmuted, in seconds - MuteFor int32 - // Identifier of the notification sound to be played; 0 if sound is disabled - SoundID int64 - // True, if message content must be displayed in notifications - ShowPreview bool - // If true, story notifications are received only for the first 5 chats from - // topChatCategoryUsers regardless of the value of mute_stories - UseDefaultMuteStories bool - // True, if story notifications are disabled - MuteStories bool - // Identifier of the notification sound to be played for stories; 0 if sound is disabled - StorySoundID int64 - // True, if the sender of stories must be displayed in notifications - ShowStorySender bool - // True, if notifications for incoming pinned messages will be created as for an ordinary - // unread message - DisablePinnedMessageNotifications bool - // True, if notifications for messages with mentions will be created as for an ordinary - // unread message - DisableMentionNotifications bool -} - -// ScopeNotificationSettingsTypeID is TL type id of ScopeNotificationSettings. -const ScopeNotificationSettingsTypeID = 0xdc4a615f - -// Ensuring interfaces in compile-time for ScopeNotificationSettings. -var ( - _ bin.Encoder = &ScopeNotificationSettings{} - _ bin.Decoder = &ScopeNotificationSettings{} - _ bin.BareEncoder = &ScopeNotificationSettings{} - _ bin.BareDecoder = &ScopeNotificationSettings{} -) - -func (s *ScopeNotificationSettings) Zero() bool { - if s == nil { - return true - } - if !(s.MuteFor == 0) { - return false - } - if !(s.SoundID == 0) { - return false - } - if !(s.ShowPreview == false) { - return false - } - if !(s.UseDefaultMuteStories == false) { - return false - } - if !(s.MuteStories == false) { - return false - } - if !(s.StorySoundID == 0) { - return false - } - if !(s.ShowStorySender == false) { - return false - } - if !(s.DisablePinnedMessageNotifications == false) { - return false - } - if !(s.DisableMentionNotifications == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *ScopeNotificationSettings) String() string { - if s == nil { - return "ScopeNotificationSettings(nil)" - } - type Alias ScopeNotificationSettings - return fmt.Sprintf("ScopeNotificationSettings%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ScopeNotificationSettings) TypeID() uint32 { - return ScopeNotificationSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ScopeNotificationSettings) TypeName() string { - return "scopeNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (s *ScopeNotificationSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "scopeNotificationSettings", - ID: ScopeNotificationSettingsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MuteFor", - SchemaName: "mute_for", - }, - { - Name: "SoundID", - SchemaName: "sound_id", - }, - { - Name: "ShowPreview", - SchemaName: "show_preview", - }, - { - Name: "UseDefaultMuteStories", - SchemaName: "use_default_mute_stories", - }, - { - Name: "MuteStories", - SchemaName: "mute_stories", - }, - { - Name: "StorySoundID", - SchemaName: "story_sound_id", - }, - { - Name: "ShowStorySender", - SchemaName: "show_story_sender", - }, - { - Name: "DisablePinnedMessageNotifications", - SchemaName: "disable_pinned_message_notifications", - }, - { - Name: "DisableMentionNotifications", - SchemaName: "disable_mention_notifications", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *ScopeNotificationSettings) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode scopeNotificationSettings#dc4a615f as nil") - } - b.PutID(ScopeNotificationSettingsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *ScopeNotificationSettings) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode scopeNotificationSettings#dc4a615f as nil") - } - b.PutInt32(s.MuteFor) - b.PutLong(s.SoundID) - b.PutBool(s.ShowPreview) - b.PutBool(s.UseDefaultMuteStories) - b.PutBool(s.MuteStories) - b.PutLong(s.StorySoundID) - b.PutBool(s.ShowStorySender) - b.PutBool(s.DisablePinnedMessageNotifications) - b.PutBool(s.DisableMentionNotifications) - return nil -} - -// Decode implements bin.Decoder. -func (s *ScopeNotificationSettings) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode scopeNotificationSettings#dc4a615f to nil") - } - if err := b.ConsumeID(ScopeNotificationSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *ScopeNotificationSettings) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode scopeNotificationSettings#dc4a615f to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field mute_for: %w", err) - } - s.MuteFor = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field sound_id: %w", err) - } - s.SoundID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field show_preview: %w", err) - } - s.ShowPreview = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field use_default_mute_stories: %w", err) - } - s.UseDefaultMuteStories = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field mute_stories: %w", err) - } - s.MuteStories = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field story_sound_id: %w", err) - } - s.StorySoundID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field show_story_sender: %w", err) - } - s.ShowStorySender = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field disable_pinned_message_notifications: %w", err) - } - s.DisablePinnedMessageNotifications = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field disable_mention_notifications: %w", err) - } - s.DisableMentionNotifications = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *ScopeNotificationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode scopeNotificationSettings#dc4a615f as nil") - } - b.ObjStart() - b.PutID("scopeNotificationSettings") - b.Comma() - b.FieldStart("mute_for") - b.PutInt32(s.MuteFor) - b.Comma() - b.FieldStart("sound_id") - b.PutLong(s.SoundID) - b.Comma() - b.FieldStart("show_preview") - b.PutBool(s.ShowPreview) - b.Comma() - b.FieldStart("use_default_mute_stories") - b.PutBool(s.UseDefaultMuteStories) - b.Comma() - b.FieldStart("mute_stories") - b.PutBool(s.MuteStories) - b.Comma() - b.FieldStart("story_sound_id") - b.PutLong(s.StorySoundID) - b.Comma() - b.FieldStart("show_story_sender") - b.PutBool(s.ShowStorySender) - b.Comma() - b.FieldStart("disable_pinned_message_notifications") - b.PutBool(s.DisablePinnedMessageNotifications) - b.Comma() - b.FieldStart("disable_mention_notifications") - b.PutBool(s.DisableMentionNotifications) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *ScopeNotificationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode scopeNotificationSettings#dc4a615f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("scopeNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: %w", err) - } - case "mute_for": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field mute_for: %w", err) - } - s.MuteFor = value - case "sound_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field sound_id: %w", err) - } - s.SoundID = value - case "show_preview": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field show_preview: %w", err) - } - s.ShowPreview = value - case "use_default_mute_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field use_default_mute_stories: %w", err) - } - s.UseDefaultMuteStories = value - case "mute_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field mute_stories: %w", err) - } - s.MuteStories = value - case "story_sound_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field story_sound_id: %w", err) - } - s.StorySoundID = value - case "show_story_sender": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field show_story_sender: %w", err) - } - s.ShowStorySender = value - case "disable_pinned_message_notifications": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field disable_pinned_message_notifications: %w", err) - } - s.DisablePinnedMessageNotifications = value - case "disable_mention_notifications": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode scopeNotificationSettings#dc4a615f: field disable_mention_notifications: %w", err) - } - s.DisableMentionNotifications = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMuteFor returns value of MuteFor field. -func (s *ScopeNotificationSettings) GetMuteFor() (value int32) { - if s == nil { - return - } - return s.MuteFor -} - -// GetSoundID returns value of SoundID field. -func (s *ScopeNotificationSettings) GetSoundID() (value int64) { - if s == nil { - return - } - return s.SoundID -} - -// GetShowPreview returns value of ShowPreview field. -func (s *ScopeNotificationSettings) GetShowPreview() (value bool) { - if s == nil { - return - } - return s.ShowPreview -} - -// GetUseDefaultMuteStories returns value of UseDefaultMuteStories field. -func (s *ScopeNotificationSettings) GetUseDefaultMuteStories() (value bool) { - if s == nil { - return - } - return s.UseDefaultMuteStories -} - -// GetMuteStories returns value of MuteStories field. -func (s *ScopeNotificationSettings) GetMuteStories() (value bool) { - if s == nil { - return - } - return s.MuteStories -} - -// GetStorySoundID returns value of StorySoundID field. -func (s *ScopeNotificationSettings) GetStorySoundID() (value int64) { - if s == nil { - return - } - return s.StorySoundID -} - -// GetShowStorySender returns value of ShowStorySender field. -func (s *ScopeNotificationSettings) GetShowStorySender() (value bool) { - if s == nil { - return - } - return s.ShowStorySender -} - -// GetDisablePinnedMessageNotifications returns value of DisablePinnedMessageNotifications field. -func (s *ScopeNotificationSettings) GetDisablePinnedMessageNotifications() (value bool) { - if s == nil { - return - } - return s.DisablePinnedMessageNotifications -} - -// GetDisableMentionNotifications returns value of DisableMentionNotifications field. -func (s *ScopeNotificationSettings) GetDisableMentionNotifications() (value bool) { - if s == nil { - return - } - return s.DisableMentionNotifications -} diff --git a/tdapi/tl_search_affiliate_programs_gen.go b/tdapi/tl_search_affiliate_programs_gen.go deleted file mode 100644 index 4bb416684..000000000 --- a/tdapi/tl_search_affiliate_programs_gen.go +++ /dev/null @@ -1,326 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchAffiliateProgramsRequest represents TL type `searchAffiliatePrograms#2899a011`. -type SearchAffiliateProgramsRequest struct { - // The affiliate for which affiliate programs are searched for - Affiliate AffiliateTypeClass - // Sort order for the results - SortOrder AffiliateProgramSortOrderClass - // Offset of the first affiliate program to return as received from the previous request; - // use empty string to get the first chunk of results - Offset string - // The maximum number of affiliate programs to return - Limit int32 -} - -// SearchAffiliateProgramsRequestTypeID is TL type id of SearchAffiliateProgramsRequest. -const SearchAffiliateProgramsRequestTypeID = 0x2899a011 - -// Ensuring interfaces in compile-time for SearchAffiliateProgramsRequest. -var ( - _ bin.Encoder = &SearchAffiliateProgramsRequest{} - _ bin.Decoder = &SearchAffiliateProgramsRequest{} - _ bin.BareEncoder = &SearchAffiliateProgramsRequest{} - _ bin.BareDecoder = &SearchAffiliateProgramsRequest{} -) - -func (s *SearchAffiliateProgramsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Affiliate == nil) { - return false - } - if !(s.SortOrder == nil) { - return false - } - if !(s.Offset == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchAffiliateProgramsRequest) String() string { - if s == nil { - return "SearchAffiliateProgramsRequest(nil)" - } - type Alias SearchAffiliateProgramsRequest - return fmt.Sprintf("SearchAffiliateProgramsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchAffiliateProgramsRequest) TypeID() uint32 { - return SearchAffiliateProgramsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchAffiliateProgramsRequest) TypeName() string { - return "searchAffiliatePrograms" -} - -// TypeInfo returns info about TL type. -func (s *SearchAffiliateProgramsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchAffiliatePrograms", - ID: SearchAffiliateProgramsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Affiliate", - SchemaName: "affiliate", - }, - { - Name: "SortOrder", - SchemaName: "sort_order", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchAffiliateProgramsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchAffiliatePrograms#2899a011 as nil") - } - b.PutID(SearchAffiliateProgramsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchAffiliateProgramsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchAffiliatePrograms#2899a011 as nil") - } - if s.Affiliate == nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field affiliate is nil") - } - if err := s.Affiliate.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field affiliate: %w", err) - } - if s.SortOrder == nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field sort_order is nil") - } - if err := s.SortOrder.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field sort_order: %w", err) - } - b.PutString(s.Offset) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchAffiliateProgramsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchAffiliatePrograms#2899a011 to nil") - } - if err := b.ConsumeID(SearchAffiliateProgramsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchAffiliateProgramsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchAffiliatePrograms#2899a011 to nil") - } - { - value, err := DecodeAffiliateType(b) - if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field affiliate: %w", err) - } - s.Affiliate = value - } - { - value, err := DecodeAffiliateProgramSortOrder(b) - if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field sort_order: %w", err) - } - s.SortOrder = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchAffiliateProgramsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchAffiliatePrograms#2899a011 as nil") - } - b.ObjStart() - b.PutID("searchAffiliatePrograms") - b.Comma() - b.FieldStart("affiliate") - if s.Affiliate == nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field affiliate is nil") - } - if err := s.Affiliate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field affiliate: %w", err) - } - b.Comma() - b.FieldStart("sort_order") - if s.SortOrder == nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field sort_order is nil") - } - if err := s.SortOrder.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchAffiliatePrograms#2899a011: field sort_order: %w", err) - } - b.Comma() - b.FieldStart("offset") - b.PutString(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchAffiliateProgramsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchAffiliatePrograms#2899a011 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchAffiliatePrograms"); err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: %w", err) - } - case "affiliate": - value, err := DecodeTDLibJSONAffiliateType(b) - if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field affiliate: %w", err) - } - s.Affiliate = value - case "sort_order": - value, err := DecodeTDLibJSONAffiliateProgramSortOrder(b) - if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field sort_order: %w", err) - } - s.SortOrder = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchAffiliatePrograms#2899a011: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAffiliate returns value of Affiliate field. -func (s *SearchAffiliateProgramsRequest) GetAffiliate() (value AffiliateTypeClass) { - if s == nil { - return - } - return s.Affiliate -} - -// GetSortOrder returns value of SortOrder field. -func (s *SearchAffiliateProgramsRequest) GetSortOrder() (value AffiliateProgramSortOrderClass) { - if s == nil { - return - } - return s.SortOrder -} - -// GetOffset returns value of Offset field. -func (s *SearchAffiliateProgramsRequest) GetOffset() (value string) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchAffiliateProgramsRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchAffiliatePrograms invokes method searchAffiliatePrograms#2899a011 returning error if any. -func (c *Client) SearchAffiliatePrograms(ctx context.Context, request *SearchAffiliateProgramsRequest) (*FoundAffiliatePrograms, error) { - var result FoundAffiliatePrograms - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_background_gen.go b/tdapi/tl_search_background_gen.go deleted file mode 100644 index 3b4edf74c..000000000 --- a/tdapi/tl_search_background_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchBackgroundRequest represents TL type `searchBackground#80fb9121`. -type SearchBackgroundRequest struct { - // The name of the background - Name string -} - -// SearchBackgroundRequestTypeID is TL type id of SearchBackgroundRequest. -const SearchBackgroundRequestTypeID = 0x80fb9121 - -// Ensuring interfaces in compile-time for SearchBackgroundRequest. -var ( - _ bin.Encoder = &SearchBackgroundRequest{} - _ bin.Decoder = &SearchBackgroundRequest{} - _ bin.BareEncoder = &SearchBackgroundRequest{} - _ bin.BareDecoder = &SearchBackgroundRequest{} -) - -func (s *SearchBackgroundRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchBackgroundRequest) String() string { - if s == nil { - return "SearchBackgroundRequest(nil)" - } - type Alias SearchBackgroundRequest - return fmt.Sprintf("SearchBackgroundRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchBackgroundRequest) TypeID() uint32 { - return SearchBackgroundRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchBackgroundRequest) TypeName() string { - return "searchBackground" -} - -// TypeInfo returns info about TL type. -func (s *SearchBackgroundRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchBackground", - ID: SearchBackgroundRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchBackgroundRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchBackground#80fb9121 as nil") - } - b.PutID(SearchBackgroundRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchBackgroundRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchBackground#80fb9121 as nil") - } - b.PutString(s.Name) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchBackgroundRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchBackground#80fb9121 to nil") - } - if err := b.ConsumeID(SearchBackgroundRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchBackground#80fb9121: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchBackgroundRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchBackground#80fb9121 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchBackground#80fb9121: field name: %w", err) - } - s.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchBackgroundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchBackground#80fb9121 as nil") - } - b.ObjStart() - b.PutID("searchBackground") - b.Comma() - b.FieldStart("name") - b.PutString(s.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchBackgroundRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchBackground#80fb9121 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchBackground"); err != nil { - return fmt.Errorf("unable to decode searchBackground#80fb9121: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchBackground#80fb9121: field name: %w", err) - } - s.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (s *SearchBackgroundRequest) GetName() (value string) { - if s == nil { - return - } - return s.Name -} - -// SearchBackground invokes method searchBackground#80fb9121 returning error if any. -func (c *Client) SearchBackground(ctx context.Context, name string) (*Background, error) { - var result Background - - request := &SearchBackgroundRequest{ - Name: name, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_call_messages_gen.go b/tdapi/tl_search_call_messages_gen.go deleted file mode 100644 index c70bb2ac4..000000000 --- a/tdapi/tl_search_call_messages_gen.go +++ /dev/null @@ -1,274 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchCallMessagesRequest represents TL type `searchCallMessages#8c3bef1b`. -type SearchCallMessagesRequest struct { - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of messages to be returned; up to 100. For optimal performance, the - // number of returned messages is chosen by TDLib and can be smaller than the specified - // limit - Limit int32 - // Pass true to search only for messages with missed/declined calls - OnlyMissed bool -} - -// SearchCallMessagesRequestTypeID is TL type id of SearchCallMessagesRequest. -const SearchCallMessagesRequestTypeID = 0x8c3bef1b - -// Ensuring interfaces in compile-time for SearchCallMessagesRequest. -var ( - _ bin.Encoder = &SearchCallMessagesRequest{} - _ bin.Decoder = &SearchCallMessagesRequest{} - _ bin.BareEncoder = &SearchCallMessagesRequest{} - _ bin.BareDecoder = &SearchCallMessagesRequest{} -) - -func (s *SearchCallMessagesRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Offset == "") { - return false - } - if !(s.Limit == 0) { - return false - } - if !(s.OnlyMissed == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchCallMessagesRequest) String() string { - if s == nil { - return "SearchCallMessagesRequest(nil)" - } - type Alias SearchCallMessagesRequest - return fmt.Sprintf("SearchCallMessagesRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchCallMessagesRequest) TypeID() uint32 { - return SearchCallMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchCallMessagesRequest) TypeName() string { - return "searchCallMessages" -} - -// TypeInfo returns info about TL type. -func (s *SearchCallMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchCallMessages", - ID: SearchCallMessagesRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - { - Name: "OnlyMissed", - SchemaName: "only_missed", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchCallMessagesRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchCallMessages#8c3bef1b as nil") - } - b.PutID(SearchCallMessagesRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchCallMessagesRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchCallMessages#8c3bef1b as nil") - } - b.PutString(s.Offset) - b.PutInt32(s.Limit) - b.PutBool(s.OnlyMissed) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchCallMessagesRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchCallMessages#8c3bef1b to nil") - } - if err := b.ConsumeID(SearchCallMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchCallMessages#8c3bef1b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchCallMessagesRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchCallMessages#8c3bef1b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchCallMessages#8c3bef1b: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchCallMessages#8c3bef1b: field limit: %w", err) - } - s.Limit = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchCallMessages#8c3bef1b: field only_missed: %w", err) - } - s.OnlyMissed = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchCallMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchCallMessages#8c3bef1b as nil") - } - b.ObjStart() - b.PutID("searchCallMessages") - b.Comma() - b.FieldStart("offset") - b.PutString(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.FieldStart("only_missed") - b.PutBool(s.OnlyMissed) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchCallMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchCallMessages#8c3bef1b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchCallMessages"); err != nil { - return fmt.Errorf("unable to decode searchCallMessages#8c3bef1b: %w", err) - } - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchCallMessages#8c3bef1b: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchCallMessages#8c3bef1b: field limit: %w", err) - } - s.Limit = value - case "only_missed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchCallMessages#8c3bef1b: field only_missed: %w", err) - } - s.OnlyMissed = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOffset returns value of Offset field. -func (s *SearchCallMessagesRequest) GetOffset() (value string) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchCallMessagesRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// GetOnlyMissed returns value of OnlyMissed field. -func (s *SearchCallMessagesRequest) GetOnlyMissed() (value bool) { - if s == nil { - return - } - return s.OnlyMissed -} - -// SearchCallMessages invokes method searchCallMessages#8c3bef1b returning error if any. -func (c *Client) SearchCallMessages(ctx context.Context, request *SearchCallMessagesRequest) (*FoundMessages, error) { - var result FoundMessages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_chat_affiliate_program_gen.go b/tdapi/tl_search_chat_affiliate_program_gen.go deleted file mode 100644 index c42b3ea6d..000000000 --- a/tdapi/tl_search_chat_affiliate_program_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchChatAffiliateProgramRequest represents TL type `searchChatAffiliateProgram#b02c09ba`. -type SearchChatAffiliateProgramRequest struct { - // Username of the chat - Username string - // The referrer from an internalLinkTypeChatAffiliateProgram link - Referrer string -} - -// SearchChatAffiliateProgramRequestTypeID is TL type id of SearchChatAffiliateProgramRequest. -const SearchChatAffiliateProgramRequestTypeID = 0xb02c09ba - -// Ensuring interfaces in compile-time for SearchChatAffiliateProgramRequest. -var ( - _ bin.Encoder = &SearchChatAffiliateProgramRequest{} - _ bin.Decoder = &SearchChatAffiliateProgramRequest{} - _ bin.BareEncoder = &SearchChatAffiliateProgramRequest{} - _ bin.BareDecoder = &SearchChatAffiliateProgramRequest{} -) - -func (s *SearchChatAffiliateProgramRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Username == "") { - return false - } - if !(s.Referrer == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchChatAffiliateProgramRequest) String() string { - if s == nil { - return "SearchChatAffiliateProgramRequest(nil)" - } - type Alias SearchChatAffiliateProgramRequest - return fmt.Sprintf("SearchChatAffiliateProgramRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchChatAffiliateProgramRequest) TypeID() uint32 { - return SearchChatAffiliateProgramRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchChatAffiliateProgramRequest) TypeName() string { - return "searchChatAffiliateProgram" -} - -// TypeInfo returns info about TL type. -func (s *SearchChatAffiliateProgramRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchChatAffiliateProgram", - ID: SearchChatAffiliateProgramRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Username", - SchemaName: "username", - }, - { - Name: "Referrer", - SchemaName: "referrer", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchChatAffiliateProgramRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChatAffiliateProgram#b02c09ba as nil") - } - b.PutID(SearchChatAffiliateProgramRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchChatAffiliateProgramRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChatAffiliateProgram#b02c09ba as nil") - } - b.PutString(s.Username) - b.PutString(s.Referrer) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchChatAffiliateProgramRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChatAffiliateProgram#b02c09ba to nil") - } - if err := b.ConsumeID(SearchChatAffiliateProgramRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchChatAffiliateProgram#b02c09ba: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchChatAffiliateProgramRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChatAffiliateProgram#b02c09ba to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChatAffiliateProgram#b02c09ba: field username: %w", err) - } - s.Username = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChatAffiliateProgram#b02c09ba: field referrer: %w", err) - } - s.Referrer = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchChatAffiliateProgramRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchChatAffiliateProgram#b02c09ba as nil") - } - b.ObjStart() - b.PutID("searchChatAffiliateProgram") - b.Comma() - b.FieldStart("username") - b.PutString(s.Username) - b.Comma() - b.FieldStart("referrer") - b.PutString(s.Referrer) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchChatAffiliateProgramRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchChatAffiliateProgram#b02c09ba to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchChatAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode searchChatAffiliateProgram#b02c09ba: %w", err) - } - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChatAffiliateProgram#b02c09ba: field username: %w", err) - } - s.Username = value - case "referrer": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChatAffiliateProgram#b02c09ba: field referrer: %w", err) - } - s.Referrer = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUsername returns value of Username field. -func (s *SearchChatAffiliateProgramRequest) GetUsername() (value string) { - if s == nil { - return - } - return s.Username -} - -// GetReferrer returns value of Referrer field. -func (s *SearchChatAffiliateProgramRequest) GetReferrer() (value string) { - if s == nil { - return - } - return s.Referrer -} - -// SearchChatAffiliateProgram invokes method searchChatAffiliateProgram#b02c09ba returning error if any. -func (c *Client) SearchChatAffiliateProgram(ctx context.Context, request *SearchChatAffiliateProgramRequest) (*Chat, error) { - var result Chat - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_chat_members_gen.go b/tdapi/tl_search_chat_members_gen.go deleted file mode 100644 index f090f2c15..000000000 --- a/tdapi/tl_search_chat_members_gen.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchChatMembersRequest represents TL type `searchChatMembers#e56d46c5`. -type SearchChatMembersRequest struct { - // Chat identifier - ChatID int64 - // Query to search for - Query string - // The maximum number of users to be returned; up to 200 - Limit int32 - // The type of users to search for; pass null to search among all chat members - Filter ChatMembersFilterClass -} - -// SearchChatMembersRequestTypeID is TL type id of SearchChatMembersRequest. -const SearchChatMembersRequestTypeID = 0xe56d46c5 - -// Ensuring interfaces in compile-time for SearchChatMembersRequest. -var ( - _ bin.Encoder = &SearchChatMembersRequest{} - _ bin.Decoder = &SearchChatMembersRequest{} - _ bin.BareEncoder = &SearchChatMembersRequest{} - _ bin.BareDecoder = &SearchChatMembersRequest{} -) - -func (s *SearchChatMembersRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Query == "") { - return false - } - if !(s.Limit == 0) { - return false - } - if !(s.Filter == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchChatMembersRequest) String() string { - if s == nil { - return "SearchChatMembersRequest(nil)" - } - type Alias SearchChatMembersRequest - return fmt.Sprintf("SearchChatMembersRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchChatMembersRequest) TypeID() uint32 { - return SearchChatMembersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchChatMembersRequest) TypeName() string { - return "searchChatMembers" -} - -// TypeInfo returns info about TL type. -func (s *SearchChatMembersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchChatMembers", - ID: SearchChatMembersRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - { - Name: "Filter", - SchemaName: "filter", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchChatMembersRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChatMembers#e56d46c5 as nil") - } - b.PutID(SearchChatMembersRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchChatMembersRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChatMembers#e56d46c5 as nil") - } - b.PutInt53(s.ChatID) - b.PutString(s.Query) - b.PutInt32(s.Limit) - if s.Filter == nil { - return fmt.Errorf("unable to encode searchChatMembers#e56d46c5: field filter is nil") - } - if err := s.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchChatMembers#e56d46c5: field filter: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchChatMembersRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChatMembers#e56d46c5 to nil") - } - if err := b.ConsumeID(SearchChatMembersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchChatMembers#e56d46c5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchChatMembersRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChatMembers#e56d46c5 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatMembers#e56d46c5: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChatMembers#e56d46c5: field query: %w", err) - } - s.Query = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChatMembers#e56d46c5: field limit: %w", err) - } - s.Limit = value - } - { - value, err := DecodeChatMembersFilter(b) - if err != nil { - return fmt.Errorf("unable to decode searchChatMembers#e56d46c5: field filter: %w", err) - } - s.Filter = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchChatMembersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchChatMembers#e56d46c5 as nil") - } - b.ObjStart() - b.PutID("searchChatMembers") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.FieldStart("filter") - if s.Filter == nil { - return fmt.Errorf("unable to encode searchChatMembers#e56d46c5: field filter is nil") - } - if err := s.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchChatMembers#e56d46c5: field filter: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchChatMembersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchChatMembers#e56d46c5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchChatMembers"); err != nil { - return fmt.Errorf("unable to decode searchChatMembers#e56d46c5: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatMembers#e56d46c5: field chat_id: %w", err) - } - s.ChatID = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChatMembers#e56d46c5: field query: %w", err) - } - s.Query = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChatMembers#e56d46c5: field limit: %w", err) - } - s.Limit = value - case "filter": - value, err := DecodeTDLibJSONChatMembersFilter(b) - if err != nil { - return fmt.Errorf("unable to decode searchChatMembers#e56d46c5: field filter: %w", err) - } - s.Filter = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SearchChatMembersRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetQuery returns value of Query field. -func (s *SearchChatMembersRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetLimit returns value of Limit field. -func (s *SearchChatMembersRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// GetFilter returns value of Filter field. -func (s *SearchChatMembersRequest) GetFilter() (value ChatMembersFilterClass) { - if s == nil { - return - } - return s.Filter -} - -// SearchChatMembers invokes method searchChatMembers#e56d46c5 returning error if any. -func (c *Client) SearchChatMembers(ctx context.Context, request *SearchChatMembersRequest) (*ChatMembers, error) { - var result ChatMembers - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_chat_messages_gen.go b/tdapi/tl_search_chat_messages_gen.go deleted file mode 100644 index 08e133030..000000000 --- a/tdapi/tl_search_chat_messages_gen.go +++ /dev/null @@ -1,500 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchChatMessagesRequest represents TL type `searchChatMessages#dfdeb5c6`. -type SearchChatMessagesRequest struct { - // Identifier of the chat in which to search messages - ChatID int64 - // Query to search for - Query string - // Identifier of the sender of messages to search for; pass null to search for messages - // from any sender. Not supported in secret chats - SenderID MessageSenderClass - // Identifier of the message starting from which history must be fetched; use 0 to get - // results from the last message - FromMessageID int64 - // Specify 0 to get results from exactly the message from_message_id or a negative offset - // to get the specified message and some newer messages - Offset int32 - // The maximum number of messages to be returned; must be positive and can't be greater - // than 100. If the offset is negative, the limit must be greater than -offset. - Limit int32 - // Additional filter for messages to search; pass null to search for all messages - Filter SearchMessagesFilterClass - // If not 0, only messages in the specified thread will be returned; supergroups only - MessageThreadID int64 - // If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 - // to return all messages, or for chats other than Saved Messages - SavedMessagesTopicID int64 -} - -// SearchChatMessagesRequestTypeID is TL type id of SearchChatMessagesRequest. -const SearchChatMessagesRequestTypeID = 0xdfdeb5c6 - -// Ensuring interfaces in compile-time for SearchChatMessagesRequest. -var ( - _ bin.Encoder = &SearchChatMessagesRequest{} - _ bin.Decoder = &SearchChatMessagesRequest{} - _ bin.BareEncoder = &SearchChatMessagesRequest{} - _ bin.BareDecoder = &SearchChatMessagesRequest{} -) - -func (s *SearchChatMessagesRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Query == "") { - return false - } - if !(s.SenderID == nil) { - return false - } - if !(s.FromMessageID == 0) { - return false - } - if !(s.Offset == 0) { - return false - } - if !(s.Limit == 0) { - return false - } - if !(s.Filter == nil) { - return false - } - if !(s.MessageThreadID == 0) { - return false - } - if !(s.SavedMessagesTopicID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchChatMessagesRequest) String() string { - if s == nil { - return "SearchChatMessagesRequest(nil)" - } - type Alias SearchChatMessagesRequest - return fmt.Sprintf("SearchChatMessagesRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchChatMessagesRequest) TypeID() uint32 { - return SearchChatMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchChatMessagesRequest) TypeName() string { - return "searchChatMessages" -} - -// TypeInfo returns info about TL type. -func (s *SearchChatMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchChatMessages", - ID: SearchChatMessagesRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "SenderID", - SchemaName: "sender_id", - }, - { - Name: "FromMessageID", - SchemaName: "from_message_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - { - Name: "Filter", - SchemaName: "filter", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchChatMessagesRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChatMessages#dfdeb5c6 as nil") - } - b.PutID(SearchChatMessagesRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchChatMessagesRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChatMessages#dfdeb5c6 as nil") - } - b.PutInt53(s.ChatID) - b.PutString(s.Query) - if s.SenderID == nil { - return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field sender_id is nil") - } - if err := s.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field sender_id: %w", err) - } - b.PutInt53(s.FromMessageID) - b.PutInt32(s.Offset) - b.PutInt32(s.Limit) - if s.Filter == nil { - return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field filter is nil") - } - if err := s.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field filter: %w", err) - } - b.PutInt53(s.MessageThreadID) - b.PutInt53(s.SavedMessagesTopicID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchChatMessagesRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChatMessages#dfdeb5c6 to nil") - } - if err := b.ConsumeID(SearchChatMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchChatMessagesRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChatMessages#dfdeb5c6 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field query: %w", err) - } - s.Query = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field sender_id: %w", err) - } - s.SenderID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field from_message_id: %w", err) - } - s.FromMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field limit: %w", err) - } - s.Limit = value - } - { - value, err := DecodeSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field filter: %w", err) - } - s.Filter = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field message_thread_id: %w", err) - } - s.MessageThreadID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field saved_messages_topic_id: %w", err) - } - s.SavedMessagesTopicID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchChatMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchChatMessages#dfdeb5c6 as nil") - } - b.ObjStart() - b.PutID("searchChatMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("sender_id") - if s.SenderID == nil { - return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field sender_id is nil") - } - if err := s.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field sender_id: %w", err) - } - b.Comma() - b.FieldStart("from_message_id") - b.PutInt53(s.FromMessageID) - b.Comma() - b.FieldStart("offset") - b.PutInt32(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.FieldStart("filter") - if s.Filter == nil { - return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field filter is nil") - } - if err := s.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchChatMessages#dfdeb5c6: field filter: %w", err) - } - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(s.MessageThreadID) - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(s.SavedMessagesTopicID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchChatMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchChatMessages#dfdeb5c6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchChatMessages"); err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field chat_id: %w", err) - } - s.ChatID = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field query: %w", err) - } - s.Query = value - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field sender_id: %w", err) - } - s.SenderID = value - case "from_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field from_message_id: %w", err) - } - s.FromMessageID = value - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field limit: %w", err) - } - s.Limit = value - case "filter": - value, err := DecodeTDLibJSONSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field filter: %w", err) - } - s.Filter = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field message_thread_id: %w", err) - } - s.MessageThreadID = value - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatMessages#dfdeb5c6: field saved_messages_topic_id: %w", err) - } - s.SavedMessagesTopicID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SearchChatMessagesRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetQuery returns value of Query field. -func (s *SearchChatMessagesRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetSenderID returns value of SenderID field. -func (s *SearchChatMessagesRequest) GetSenderID() (value MessageSenderClass) { - if s == nil { - return - } - return s.SenderID -} - -// GetFromMessageID returns value of FromMessageID field. -func (s *SearchChatMessagesRequest) GetFromMessageID() (value int64) { - if s == nil { - return - } - return s.FromMessageID -} - -// GetOffset returns value of Offset field. -func (s *SearchChatMessagesRequest) GetOffset() (value int32) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchChatMessagesRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// GetFilter returns value of Filter field. -func (s *SearchChatMessagesRequest) GetFilter() (value SearchMessagesFilterClass) { - if s == nil { - return - } - return s.Filter -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (s *SearchChatMessagesRequest) GetMessageThreadID() (value int64) { - if s == nil { - return - } - return s.MessageThreadID -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (s *SearchChatMessagesRequest) GetSavedMessagesTopicID() (value int64) { - if s == nil { - return - } - return s.SavedMessagesTopicID -} - -// SearchChatMessages invokes method searchChatMessages#dfdeb5c6 returning error if any. -func (c *Client) SearchChatMessages(ctx context.Context, request *SearchChatMessagesRequest) (*FoundChatMessages, error) { - var result FoundChatMessages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_chat_recent_location_messages_gen.go b/tdapi/tl_search_chat_recent_location_messages_gen.go deleted file mode 100644 index e310ccc0d..000000000 --- a/tdapi/tl_search_chat_recent_location_messages_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchChatRecentLocationMessagesRequest represents TL type `searchChatRecentLocationMessages#38a37ee6`. -type SearchChatRecentLocationMessagesRequest struct { - // Chat identifier - ChatID int64 - // The maximum number of messages to be returned - Limit int32 -} - -// SearchChatRecentLocationMessagesRequestTypeID is TL type id of SearchChatRecentLocationMessagesRequest. -const SearchChatRecentLocationMessagesRequestTypeID = 0x38a37ee6 - -// Ensuring interfaces in compile-time for SearchChatRecentLocationMessagesRequest. -var ( - _ bin.Encoder = &SearchChatRecentLocationMessagesRequest{} - _ bin.Decoder = &SearchChatRecentLocationMessagesRequest{} - _ bin.BareEncoder = &SearchChatRecentLocationMessagesRequest{} - _ bin.BareDecoder = &SearchChatRecentLocationMessagesRequest{} -) - -func (s *SearchChatRecentLocationMessagesRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchChatRecentLocationMessagesRequest) String() string { - if s == nil { - return "SearchChatRecentLocationMessagesRequest(nil)" - } - type Alias SearchChatRecentLocationMessagesRequest - return fmt.Sprintf("SearchChatRecentLocationMessagesRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchChatRecentLocationMessagesRequest) TypeID() uint32 { - return SearchChatRecentLocationMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchChatRecentLocationMessagesRequest) TypeName() string { - return "searchChatRecentLocationMessages" -} - -// TypeInfo returns info about TL type. -func (s *SearchChatRecentLocationMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchChatRecentLocationMessages", - ID: SearchChatRecentLocationMessagesRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchChatRecentLocationMessagesRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChatRecentLocationMessages#38a37ee6 as nil") - } - b.PutID(SearchChatRecentLocationMessagesRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchChatRecentLocationMessagesRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChatRecentLocationMessages#38a37ee6 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchChatRecentLocationMessagesRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChatRecentLocationMessages#38a37ee6 to nil") - } - if err := b.ConsumeID(SearchChatRecentLocationMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchChatRecentLocationMessages#38a37ee6: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchChatRecentLocationMessagesRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChatRecentLocationMessages#38a37ee6 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatRecentLocationMessages#38a37ee6: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChatRecentLocationMessages#38a37ee6: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchChatRecentLocationMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchChatRecentLocationMessages#38a37ee6 as nil") - } - b.ObjStart() - b.PutID("searchChatRecentLocationMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchChatRecentLocationMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchChatRecentLocationMessages#38a37ee6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchChatRecentLocationMessages"); err != nil { - return fmt.Errorf("unable to decode searchChatRecentLocationMessages#38a37ee6: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchChatRecentLocationMessages#38a37ee6: field chat_id: %w", err) - } - s.ChatID = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChatRecentLocationMessages#38a37ee6: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SearchChatRecentLocationMessagesRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetLimit returns value of Limit field. -func (s *SearchChatRecentLocationMessagesRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchChatRecentLocationMessages invokes method searchChatRecentLocationMessages#38a37ee6 returning error if any. -func (c *Client) SearchChatRecentLocationMessages(ctx context.Context, request *SearchChatRecentLocationMessagesRequest) (*Messages, error) { - var result Messages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_chats_gen.go b/tdapi/tl_search_chats_gen.go deleted file mode 100644 index 456d18b40..000000000 --- a/tdapi/tl_search_chats_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchChatsRequest represents TL type `searchChats#8ff4b9cc`. -type SearchChatsRequest struct { - // Query to search for. If the query is empty, returns up to 50 recently found chats - Query string - // The maximum number of chats to be returned - Limit int32 -} - -// SearchChatsRequestTypeID is TL type id of SearchChatsRequest. -const SearchChatsRequestTypeID = 0x8ff4b9cc - -// Ensuring interfaces in compile-time for SearchChatsRequest. -var ( - _ bin.Encoder = &SearchChatsRequest{} - _ bin.Decoder = &SearchChatsRequest{} - _ bin.BareEncoder = &SearchChatsRequest{} - _ bin.BareDecoder = &SearchChatsRequest{} -) - -func (s *SearchChatsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchChatsRequest) String() string { - if s == nil { - return "SearchChatsRequest(nil)" - } - type Alias SearchChatsRequest - return fmt.Sprintf("SearchChatsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchChatsRequest) TypeID() uint32 { - return SearchChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchChatsRequest) TypeName() string { - return "searchChats" -} - -// TypeInfo returns info about TL type. -func (s *SearchChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchChats", - ID: SearchChatsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchChatsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChats#8ff4b9cc as nil") - } - b.PutID(SearchChatsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchChatsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChats#8ff4b9cc as nil") - } - b.PutString(s.Query) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchChatsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChats#8ff4b9cc to nil") - } - if err := b.ConsumeID(SearchChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchChats#8ff4b9cc: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchChatsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChats#8ff4b9cc to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChats#8ff4b9cc: field query: %w", err) - } - s.Query = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChats#8ff4b9cc: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchChats#8ff4b9cc as nil") - } - b.ObjStart() - b.PutID("searchChats") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchChats#8ff4b9cc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchChats"); err != nil { - return fmt.Errorf("unable to decode searchChats#8ff4b9cc: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChats#8ff4b9cc: field query: %w", err) - } - s.Query = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChats#8ff4b9cc: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SearchChatsRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetLimit returns value of Limit field. -func (s *SearchChatsRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchChats invokes method searchChats#8ff4b9cc returning error if any. -func (c *Client) SearchChats(ctx context.Context, request *SearchChatsRequest) (*Chats, error) { - var result Chats - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_chats_on_server_gen.go b/tdapi/tl_search_chats_on_server_gen.go deleted file mode 100644 index d3682a337..000000000 --- a/tdapi/tl_search_chats_on_server_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchChatsOnServerRequest represents TL type `searchChatsOnServer#baf42f74`. -type SearchChatsOnServerRequest struct { - // Query to search for - Query string - // The maximum number of chats to be returned - Limit int32 -} - -// SearchChatsOnServerRequestTypeID is TL type id of SearchChatsOnServerRequest. -const SearchChatsOnServerRequestTypeID = 0xbaf42f74 - -// Ensuring interfaces in compile-time for SearchChatsOnServerRequest. -var ( - _ bin.Encoder = &SearchChatsOnServerRequest{} - _ bin.Decoder = &SearchChatsOnServerRequest{} - _ bin.BareEncoder = &SearchChatsOnServerRequest{} - _ bin.BareDecoder = &SearchChatsOnServerRequest{} -) - -func (s *SearchChatsOnServerRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchChatsOnServerRequest) String() string { - if s == nil { - return "SearchChatsOnServerRequest(nil)" - } - type Alias SearchChatsOnServerRequest - return fmt.Sprintf("SearchChatsOnServerRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchChatsOnServerRequest) TypeID() uint32 { - return SearchChatsOnServerRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchChatsOnServerRequest) TypeName() string { - return "searchChatsOnServer" -} - -// TypeInfo returns info about TL type. -func (s *SearchChatsOnServerRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchChatsOnServer", - ID: SearchChatsOnServerRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchChatsOnServerRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChatsOnServer#baf42f74 as nil") - } - b.PutID(SearchChatsOnServerRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchChatsOnServerRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchChatsOnServer#baf42f74 as nil") - } - b.PutString(s.Query) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchChatsOnServerRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChatsOnServer#baf42f74 to nil") - } - if err := b.ConsumeID(SearchChatsOnServerRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchChatsOnServer#baf42f74: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchChatsOnServerRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchChatsOnServer#baf42f74 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChatsOnServer#baf42f74: field query: %w", err) - } - s.Query = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChatsOnServer#baf42f74: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchChatsOnServerRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchChatsOnServer#baf42f74 as nil") - } - b.ObjStart() - b.PutID("searchChatsOnServer") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchChatsOnServerRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchChatsOnServer#baf42f74 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchChatsOnServer"); err != nil { - return fmt.Errorf("unable to decode searchChatsOnServer#baf42f74: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchChatsOnServer#baf42f74: field query: %w", err) - } - s.Query = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchChatsOnServer#baf42f74: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SearchChatsOnServerRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetLimit returns value of Limit field. -func (s *SearchChatsOnServerRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchChatsOnServer invokes method searchChatsOnServer#baf42f74 returning error if any. -func (c *Client) SearchChatsOnServer(ctx context.Context, request *SearchChatsOnServerRequest) (*Chats, error) { - var result Chats - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_contacts_gen.go b/tdapi/tl_search_contacts_gen.go deleted file mode 100644 index a64dd96cb..000000000 --- a/tdapi/tl_search_contacts_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchContactsRequest represents TL type `searchContacts#95073165`. -type SearchContactsRequest struct { - // Query to search for; may be empty to return all contacts - Query string - // The maximum number of users to be returned - Limit int32 -} - -// SearchContactsRequestTypeID is TL type id of SearchContactsRequest. -const SearchContactsRequestTypeID = 0x95073165 - -// Ensuring interfaces in compile-time for SearchContactsRequest. -var ( - _ bin.Encoder = &SearchContactsRequest{} - _ bin.Decoder = &SearchContactsRequest{} - _ bin.BareEncoder = &SearchContactsRequest{} - _ bin.BareDecoder = &SearchContactsRequest{} -) - -func (s *SearchContactsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchContactsRequest) String() string { - if s == nil { - return "SearchContactsRequest(nil)" - } - type Alias SearchContactsRequest - return fmt.Sprintf("SearchContactsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchContactsRequest) TypeID() uint32 { - return SearchContactsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchContactsRequest) TypeName() string { - return "searchContacts" -} - -// TypeInfo returns info about TL type. -func (s *SearchContactsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchContacts", - ID: SearchContactsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchContactsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchContacts#95073165 as nil") - } - b.PutID(SearchContactsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchContactsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchContacts#95073165 as nil") - } - b.PutString(s.Query) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchContactsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchContacts#95073165 to nil") - } - if err := b.ConsumeID(SearchContactsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchContacts#95073165: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchContactsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchContacts#95073165 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchContacts#95073165: field query: %w", err) - } - s.Query = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchContacts#95073165: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchContactsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchContacts#95073165 as nil") - } - b.ObjStart() - b.PutID("searchContacts") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchContactsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchContacts#95073165 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchContacts"); err != nil { - return fmt.Errorf("unable to decode searchContacts#95073165: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchContacts#95073165: field query: %w", err) - } - s.Query = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchContacts#95073165: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SearchContactsRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetLimit returns value of Limit field. -func (s *SearchContactsRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchContacts invokes method searchContacts#95073165 returning error if any. -func (c *Client) SearchContacts(ctx context.Context, request *SearchContactsRequest) (*Users, error) { - var result Users - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_emojis_gen.go b/tdapi/tl_search_emojis_gen.go deleted file mode 100644 index 4d4627b63..000000000 --- a/tdapi/tl_search_emojis_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchEmojisRequest represents TL type `searchEmojis#d513cd61`. -type SearchEmojisRequest struct { - // Text to search for - Text string - // List of possible IETF language tags of the user's input language; may be empty if - // unknown - InputLanguageCodes []string -} - -// SearchEmojisRequestTypeID is TL type id of SearchEmojisRequest. -const SearchEmojisRequestTypeID = 0xd513cd61 - -// Ensuring interfaces in compile-time for SearchEmojisRequest. -var ( - _ bin.Encoder = &SearchEmojisRequest{} - _ bin.Decoder = &SearchEmojisRequest{} - _ bin.BareEncoder = &SearchEmojisRequest{} - _ bin.BareDecoder = &SearchEmojisRequest{} -) - -func (s *SearchEmojisRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Text == "") { - return false - } - if !(s.InputLanguageCodes == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchEmojisRequest) String() string { - if s == nil { - return "SearchEmojisRequest(nil)" - } - type Alias SearchEmojisRequest - return fmt.Sprintf("SearchEmojisRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchEmojisRequest) TypeID() uint32 { - return SearchEmojisRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchEmojisRequest) TypeName() string { - return "searchEmojis" -} - -// TypeInfo returns info about TL type. -func (s *SearchEmojisRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchEmojis", - ID: SearchEmojisRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "InputLanguageCodes", - SchemaName: "input_language_codes", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchEmojisRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchEmojis#d513cd61 as nil") - } - b.PutID(SearchEmojisRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchEmojisRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchEmojis#d513cd61 as nil") - } - b.PutString(s.Text) - b.PutInt(len(s.InputLanguageCodes)) - for _, v := range s.InputLanguageCodes { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchEmojisRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchEmojis#d513cd61 to nil") - } - if err := b.ConsumeID(SearchEmojisRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchEmojis#d513cd61: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchEmojisRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchEmojis#d513cd61 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchEmojis#d513cd61: field text: %w", err) - } - s.Text = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode searchEmojis#d513cd61: field input_language_codes: %w", err) - } - - if headerLen > 0 { - s.InputLanguageCodes = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchEmojis#d513cd61: field input_language_codes: %w", err) - } - s.InputLanguageCodes = append(s.InputLanguageCodes, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchEmojisRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchEmojis#d513cd61 as nil") - } - b.ObjStart() - b.PutID("searchEmojis") - b.Comma() - b.FieldStart("text") - b.PutString(s.Text) - b.Comma() - b.FieldStart("input_language_codes") - b.ArrStart() - for _, v := range s.InputLanguageCodes { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchEmojisRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchEmojis#d513cd61 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchEmojis"); err != nil { - return fmt.Errorf("unable to decode searchEmojis#d513cd61: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchEmojis#d513cd61: field text: %w", err) - } - s.Text = value - case "input_language_codes": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchEmojis#d513cd61: field input_language_codes: %w", err) - } - s.InputLanguageCodes = append(s.InputLanguageCodes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode searchEmojis#d513cd61: field input_language_codes: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (s *SearchEmojisRequest) GetText() (value string) { - if s == nil { - return - } - return s.Text -} - -// GetInputLanguageCodes returns value of InputLanguageCodes field. -func (s *SearchEmojisRequest) GetInputLanguageCodes() (value []string) { - if s == nil { - return - } - return s.InputLanguageCodes -} - -// SearchEmojis invokes method searchEmojis#d513cd61 returning error if any. -func (c *Client) SearchEmojis(ctx context.Context, request *SearchEmojisRequest) (*EmojiKeywords, error) { - var result EmojiKeywords - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_file_downloads_gen.go b/tdapi/tl_search_file_downloads_gen.go deleted file mode 100644 index 4f040d802..000000000 --- a/tdapi/tl_search_file_downloads_gen.go +++ /dev/null @@ -1,340 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchFileDownloadsRequest represents TL type `searchFileDownloads#2a1e0856`. -type SearchFileDownloadsRequest struct { - // Query to search for; may be empty to return all downloaded files - Query string - // Pass true to search only for active downloads, including paused - OnlyActive bool - // Pass true to search only for completed downloads - OnlyCompleted bool - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of files to be returned - Limit int32 -} - -// SearchFileDownloadsRequestTypeID is TL type id of SearchFileDownloadsRequest. -const SearchFileDownloadsRequestTypeID = 0x2a1e0856 - -// Ensuring interfaces in compile-time for SearchFileDownloadsRequest. -var ( - _ bin.Encoder = &SearchFileDownloadsRequest{} - _ bin.Decoder = &SearchFileDownloadsRequest{} - _ bin.BareEncoder = &SearchFileDownloadsRequest{} - _ bin.BareDecoder = &SearchFileDownloadsRequest{} -) - -func (s *SearchFileDownloadsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - if !(s.OnlyActive == false) { - return false - } - if !(s.OnlyCompleted == false) { - return false - } - if !(s.Offset == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchFileDownloadsRequest) String() string { - if s == nil { - return "SearchFileDownloadsRequest(nil)" - } - type Alias SearchFileDownloadsRequest - return fmt.Sprintf("SearchFileDownloadsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchFileDownloadsRequest) TypeID() uint32 { - return SearchFileDownloadsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchFileDownloadsRequest) TypeName() string { - return "searchFileDownloads" -} - -// TypeInfo returns info about TL type. -func (s *SearchFileDownloadsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchFileDownloads", - ID: SearchFileDownloadsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "OnlyActive", - SchemaName: "only_active", - }, - { - Name: "OnlyCompleted", - SchemaName: "only_completed", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchFileDownloadsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchFileDownloads#2a1e0856 as nil") - } - b.PutID(SearchFileDownloadsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchFileDownloadsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchFileDownloads#2a1e0856 as nil") - } - b.PutString(s.Query) - b.PutBool(s.OnlyActive) - b.PutBool(s.OnlyCompleted) - b.PutString(s.Offset) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchFileDownloadsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchFileDownloads#2a1e0856 to nil") - } - if err := b.ConsumeID(SearchFileDownloadsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchFileDownloadsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchFileDownloads#2a1e0856 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: field query: %w", err) - } - s.Query = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: field only_active: %w", err) - } - s.OnlyActive = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: field only_completed: %w", err) - } - s.OnlyCompleted = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchFileDownloadsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchFileDownloads#2a1e0856 as nil") - } - b.ObjStart() - b.PutID("searchFileDownloads") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("only_active") - b.PutBool(s.OnlyActive) - b.Comma() - b.FieldStart("only_completed") - b.PutBool(s.OnlyCompleted) - b.Comma() - b.FieldStart("offset") - b.PutString(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchFileDownloadsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchFileDownloads#2a1e0856 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchFileDownloads"); err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: field query: %w", err) - } - s.Query = value - case "only_active": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: field only_active: %w", err) - } - s.OnlyActive = value - case "only_completed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: field only_completed: %w", err) - } - s.OnlyCompleted = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchFileDownloads#2a1e0856: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SearchFileDownloadsRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetOnlyActive returns value of OnlyActive field. -func (s *SearchFileDownloadsRequest) GetOnlyActive() (value bool) { - if s == nil { - return - } - return s.OnlyActive -} - -// GetOnlyCompleted returns value of OnlyCompleted field. -func (s *SearchFileDownloadsRequest) GetOnlyCompleted() (value bool) { - if s == nil { - return - } - return s.OnlyCompleted -} - -// GetOffset returns value of Offset field. -func (s *SearchFileDownloadsRequest) GetOffset() (value string) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchFileDownloadsRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchFileDownloads invokes method searchFileDownloads#2a1e0856 returning error if any. -func (c *Client) SearchFileDownloads(ctx context.Context, request *SearchFileDownloadsRequest) (*FoundFileDownloads, error) { - var result FoundFileDownloads - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_hashtags_gen.go b/tdapi/tl_search_hashtags_gen.go deleted file mode 100644 index 6bdb18aef..000000000 --- a/tdapi/tl_search_hashtags_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchHashtagsRequest represents TL type `searchHashtags#3e34a571`. -type SearchHashtagsRequest struct { - // Hashtag prefix to search for - Prefix string - // The maximum number of hashtags to be returned - Limit int32 -} - -// SearchHashtagsRequestTypeID is TL type id of SearchHashtagsRequest. -const SearchHashtagsRequestTypeID = 0x3e34a571 - -// Ensuring interfaces in compile-time for SearchHashtagsRequest. -var ( - _ bin.Encoder = &SearchHashtagsRequest{} - _ bin.Decoder = &SearchHashtagsRequest{} - _ bin.BareEncoder = &SearchHashtagsRequest{} - _ bin.BareDecoder = &SearchHashtagsRequest{} -) - -func (s *SearchHashtagsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Prefix == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchHashtagsRequest) String() string { - if s == nil { - return "SearchHashtagsRequest(nil)" - } - type Alias SearchHashtagsRequest - return fmt.Sprintf("SearchHashtagsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchHashtagsRequest) TypeID() uint32 { - return SearchHashtagsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchHashtagsRequest) TypeName() string { - return "searchHashtags" -} - -// TypeInfo returns info about TL type. -func (s *SearchHashtagsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchHashtags", - ID: SearchHashtagsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Prefix", - SchemaName: "prefix", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchHashtagsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchHashtags#3e34a571 as nil") - } - b.PutID(SearchHashtagsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchHashtagsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchHashtags#3e34a571 as nil") - } - b.PutString(s.Prefix) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchHashtagsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchHashtags#3e34a571 to nil") - } - if err := b.ConsumeID(SearchHashtagsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchHashtags#3e34a571: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchHashtagsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchHashtags#3e34a571 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchHashtags#3e34a571: field prefix: %w", err) - } - s.Prefix = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchHashtags#3e34a571: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchHashtagsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchHashtags#3e34a571 as nil") - } - b.ObjStart() - b.PutID("searchHashtags") - b.Comma() - b.FieldStart("prefix") - b.PutString(s.Prefix) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchHashtagsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchHashtags#3e34a571 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchHashtags"); err != nil { - return fmt.Errorf("unable to decode searchHashtags#3e34a571: %w", err) - } - case "prefix": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchHashtags#3e34a571: field prefix: %w", err) - } - s.Prefix = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchHashtags#3e34a571: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPrefix returns value of Prefix field. -func (s *SearchHashtagsRequest) GetPrefix() (value string) { - if s == nil { - return - } - return s.Prefix -} - -// GetLimit returns value of Limit field. -func (s *SearchHashtagsRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchHashtags invokes method searchHashtags#3e34a571 returning error if any. -func (c *Client) SearchHashtags(ctx context.Context, request *SearchHashtagsRequest) (*Hashtags, error) { - var result Hashtags - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_installed_sticker_sets_gen.go b/tdapi/tl_search_installed_sticker_sets_gen.go deleted file mode 100644 index 6f8d631ea..000000000 --- a/tdapi/tl_search_installed_sticker_sets_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchInstalledStickerSetsRequest represents TL type `searchInstalledStickerSets#7e5e7fa4`. -type SearchInstalledStickerSetsRequest struct { - // Type of the sticker sets to search for - StickerType StickerTypeClass - // Query to search for - Query string - // The maximum number of sticker sets to return - Limit int32 -} - -// SearchInstalledStickerSetsRequestTypeID is TL type id of SearchInstalledStickerSetsRequest. -const SearchInstalledStickerSetsRequestTypeID = 0x7e5e7fa4 - -// Ensuring interfaces in compile-time for SearchInstalledStickerSetsRequest. -var ( - _ bin.Encoder = &SearchInstalledStickerSetsRequest{} - _ bin.Decoder = &SearchInstalledStickerSetsRequest{} - _ bin.BareEncoder = &SearchInstalledStickerSetsRequest{} - _ bin.BareDecoder = &SearchInstalledStickerSetsRequest{} -) - -func (s *SearchInstalledStickerSetsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.StickerType == nil) { - return false - } - if !(s.Query == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchInstalledStickerSetsRequest) String() string { - if s == nil { - return "SearchInstalledStickerSetsRequest(nil)" - } - type Alias SearchInstalledStickerSetsRequest - return fmt.Sprintf("SearchInstalledStickerSetsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchInstalledStickerSetsRequest) TypeID() uint32 { - return SearchInstalledStickerSetsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchInstalledStickerSetsRequest) TypeName() string { - return "searchInstalledStickerSets" -} - -// TypeInfo returns info about TL type. -func (s *SearchInstalledStickerSetsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchInstalledStickerSets", - ID: SearchInstalledStickerSetsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchInstalledStickerSetsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchInstalledStickerSets#7e5e7fa4 as nil") - } - b.PutID(SearchInstalledStickerSetsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchInstalledStickerSetsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchInstalledStickerSets#7e5e7fa4 as nil") - } - if s.StickerType == nil { - return fmt.Errorf("unable to encode searchInstalledStickerSets#7e5e7fa4: field sticker_type is nil") - } - if err := s.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchInstalledStickerSets#7e5e7fa4: field sticker_type: %w", err) - } - b.PutString(s.Query) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchInstalledStickerSetsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchInstalledStickerSets#7e5e7fa4 to nil") - } - if err := b.ConsumeID(SearchInstalledStickerSetsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchInstalledStickerSets#7e5e7fa4: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchInstalledStickerSetsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchInstalledStickerSets#7e5e7fa4 to nil") - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode searchInstalledStickerSets#7e5e7fa4: field sticker_type: %w", err) - } - s.StickerType = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchInstalledStickerSets#7e5e7fa4: field query: %w", err) - } - s.Query = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchInstalledStickerSets#7e5e7fa4: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchInstalledStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchInstalledStickerSets#7e5e7fa4 as nil") - } - b.ObjStart() - b.PutID("searchInstalledStickerSets") - b.Comma() - b.FieldStart("sticker_type") - if s.StickerType == nil { - return fmt.Errorf("unable to encode searchInstalledStickerSets#7e5e7fa4: field sticker_type is nil") - } - if err := s.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchInstalledStickerSets#7e5e7fa4: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchInstalledStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchInstalledStickerSets#7e5e7fa4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchInstalledStickerSets"); err != nil { - return fmt.Errorf("unable to decode searchInstalledStickerSets#7e5e7fa4: %w", err) - } - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode searchInstalledStickerSets#7e5e7fa4: field sticker_type: %w", err) - } - s.StickerType = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchInstalledStickerSets#7e5e7fa4: field query: %w", err) - } - s.Query = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchInstalledStickerSets#7e5e7fa4: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerType returns value of StickerType field. -func (s *SearchInstalledStickerSetsRequest) GetStickerType() (value StickerTypeClass) { - if s == nil { - return - } - return s.StickerType -} - -// GetQuery returns value of Query field. -func (s *SearchInstalledStickerSetsRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetLimit returns value of Limit field. -func (s *SearchInstalledStickerSetsRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchInstalledStickerSets invokes method searchInstalledStickerSets#7e5e7fa4 returning error if any. -func (c *Client) SearchInstalledStickerSets(ctx context.Context, request *SearchInstalledStickerSetsRequest) (*StickerSets, error) { - var result StickerSets - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_messages_chat_type_filter_gen.go b/tdapi/tl_search_messages_chat_type_filter_gen.go deleted file mode 100644 index 19d0d8a71..000000000 --- a/tdapi/tl_search_messages_chat_type_filter_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchMessagesChatTypeFilterPrivate represents TL type `searchMessagesChatTypeFilterPrivate#45b152cf`. -type SearchMessagesChatTypeFilterPrivate struct { -} - -// SearchMessagesChatTypeFilterPrivateTypeID is TL type id of SearchMessagesChatTypeFilterPrivate. -const SearchMessagesChatTypeFilterPrivateTypeID = 0x45b152cf - -// construct implements constructor of SearchMessagesChatTypeFilterClass. -func (s SearchMessagesChatTypeFilterPrivate) construct() SearchMessagesChatTypeFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesChatTypeFilterPrivate. -var ( - _ bin.Encoder = &SearchMessagesChatTypeFilterPrivate{} - _ bin.Decoder = &SearchMessagesChatTypeFilterPrivate{} - _ bin.BareEncoder = &SearchMessagesChatTypeFilterPrivate{} - _ bin.BareDecoder = &SearchMessagesChatTypeFilterPrivate{} - - _ SearchMessagesChatTypeFilterClass = &SearchMessagesChatTypeFilterPrivate{} -) - -func (s *SearchMessagesChatTypeFilterPrivate) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesChatTypeFilterPrivate) String() string { - if s == nil { - return "SearchMessagesChatTypeFilterPrivate(nil)" - } - type Alias SearchMessagesChatTypeFilterPrivate - return fmt.Sprintf("SearchMessagesChatTypeFilterPrivate%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesChatTypeFilterPrivate) TypeID() uint32 { - return SearchMessagesChatTypeFilterPrivateTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesChatTypeFilterPrivate) TypeName() string { - return "searchMessagesChatTypeFilterPrivate" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesChatTypeFilterPrivate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesChatTypeFilterPrivate", - ID: SearchMessagesChatTypeFilterPrivateTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesChatTypeFilterPrivate) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesChatTypeFilterPrivate#45b152cf as nil") - } - b.PutID(SearchMessagesChatTypeFilterPrivateTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesChatTypeFilterPrivate) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesChatTypeFilterPrivate#45b152cf as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesChatTypeFilterPrivate) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesChatTypeFilterPrivate#45b152cf to nil") - } - if err := b.ConsumeID(SearchMessagesChatTypeFilterPrivateTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesChatTypeFilterPrivate#45b152cf: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesChatTypeFilterPrivate) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesChatTypeFilterPrivate#45b152cf to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesChatTypeFilterPrivate) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesChatTypeFilterPrivate#45b152cf as nil") - } - b.ObjStart() - b.PutID("searchMessagesChatTypeFilterPrivate") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesChatTypeFilterPrivate) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesChatTypeFilterPrivate#45b152cf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesChatTypeFilterPrivate"); err != nil { - return fmt.Errorf("unable to decode searchMessagesChatTypeFilterPrivate#45b152cf: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesChatTypeFilterGroup represents TL type `searchMessagesChatTypeFilterGroup#853fa71a`. -type SearchMessagesChatTypeFilterGroup struct { -} - -// SearchMessagesChatTypeFilterGroupTypeID is TL type id of SearchMessagesChatTypeFilterGroup. -const SearchMessagesChatTypeFilterGroupTypeID = 0x853fa71a - -// construct implements constructor of SearchMessagesChatTypeFilterClass. -func (s SearchMessagesChatTypeFilterGroup) construct() SearchMessagesChatTypeFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesChatTypeFilterGroup. -var ( - _ bin.Encoder = &SearchMessagesChatTypeFilterGroup{} - _ bin.Decoder = &SearchMessagesChatTypeFilterGroup{} - _ bin.BareEncoder = &SearchMessagesChatTypeFilterGroup{} - _ bin.BareDecoder = &SearchMessagesChatTypeFilterGroup{} - - _ SearchMessagesChatTypeFilterClass = &SearchMessagesChatTypeFilterGroup{} -) - -func (s *SearchMessagesChatTypeFilterGroup) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesChatTypeFilterGroup) String() string { - if s == nil { - return "SearchMessagesChatTypeFilterGroup(nil)" - } - type Alias SearchMessagesChatTypeFilterGroup - return fmt.Sprintf("SearchMessagesChatTypeFilterGroup%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesChatTypeFilterGroup) TypeID() uint32 { - return SearchMessagesChatTypeFilterGroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesChatTypeFilterGroup) TypeName() string { - return "searchMessagesChatTypeFilterGroup" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesChatTypeFilterGroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesChatTypeFilterGroup", - ID: SearchMessagesChatTypeFilterGroupTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesChatTypeFilterGroup) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesChatTypeFilterGroup#853fa71a as nil") - } - b.PutID(SearchMessagesChatTypeFilterGroupTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesChatTypeFilterGroup) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesChatTypeFilterGroup#853fa71a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesChatTypeFilterGroup) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesChatTypeFilterGroup#853fa71a to nil") - } - if err := b.ConsumeID(SearchMessagesChatTypeFilterGroupTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesChatTypeFilterGroup#853fa71a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesChatTypeFilterGroup) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesChatTypeFilterGroup#853fa71a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesChatTypeFilterGroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesChatTypeFilterGroup#853fa71a as nil") - } - b.ObjStart() - b.PutID("searchMessagesChatTypeFilterGroup") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesChatTypeFilterGroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesChatTypeFilterGroup#853fa71a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesChatTypeFilterGroup"); err != nil { - return fmt.Errorf("unable to decode searchMessagesChatTypeFilterGroup#853fa71a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesChatTypeFilterChannel represents TL type `searchMessagesChatTypeFilterChannel#d1e4b6d5`. -type SearchMessagesChatTypeFilterChannel struct { -} - -// SearchMessagesChatTypeFilterChannelTypeID is TL type id of SearchMessagesChatTypeFilterChannel. -const SearchMessagesChatTypeFilterChannelTypeID = 0xd1e4b6d5 - -// construct implements constructor of SearchMessagesChatTypeFilterClass. -func (s SearchMessagesChatTypeFilterChannel) construct() SearchMessagesChatTypeFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesChatTypeFilterChannel. -var ( - _ bin.Encoder = &SearchMessagesChatTypeFilterChannel{} - _ bin.Decoder = &SearchMessagesChatTypeFilterChannel{} - _ bin.BareEncoder = &SearchMessagesChatTypeFilterChannel{} - _ bin.BareDecoder = &SearchMessagesChatTypeFilterChannel{} - - _ SearchMessagesChatTypeFilterClass = &SearchMessagesChatTypeFilterChannel{} -) - -func (s *SearchMessagesChatTypeFilterChannel) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesChatTypeFilterChannel) String() string { - if s == nil { - return "SearchMessagesChatTypeFilterChannel(nil)" - } - type Alias SearchMessagesChatTypeFilterChannel - return fmt.Sprintf("SearchMessagesChatTypeFilterChannel%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesChatTypeFilterChannel) TypeID() uint32 { - return SearchMessagesChatTypeFilterChannelTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesChatTypeFilterChannel) TypeName() string { - return "searchMessagesChatTypeFilterChannel" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesChatTypeFilterChannel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesChatTypeFilterChannel", - ID: SearchMessagesChatTypeFilterChannelTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesChatTypeFilterChannel) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesChatTypeFilterChannel#d1e4b6d5 as nil") - } - b.PutID(SearchMessagesChatTypeFilterChannelTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesChatTypeFilterChannel) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesChatTypeFilterChannel#d1e4b6d5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesChatTypeFilterChannel) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesChatTypeFilterChannel#d1e4b6d5 to nil") - } - if err := b.ConsumeID(SearchMessagesChatTypeFilterChannelTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesChatTypeFilterChannel#d1e4b6d5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesChatTypeFilterChannel) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesChatTypeFilterChannel#d1e4b6d5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesChatTypeFilterChannel) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesChatTypeFilterChannel#d1e4b6d5 as nil") - } - b.ObjStart() - b.PutID("searchMessagesChatTypeFilterChannel") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesChatTypeFilterChannel) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesChatTypeFilterChannel#d1e4b6d5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesChatTypeFilterChannel"); err != nil { - return fmt.Errorf("unable to decode searchMessagesChatTypeFilterChannel#d1e4b6d5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesChatTypeFilterClassName is schema name of SearchMessagesChatTypeFilterClass. -const SearchMessagesChatTypeFilterClassName = "SearchMessagesChatTypeFilter" - -// SearchMessagesChatTypeFilterClass represents SearchMessagesChatTypeFilter generic type. -// -// Example: -// -// g, err := tdapi.DecodeSearchMessagesChatTypeFilter(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.SearchMessagesChatTypeFilterPrivate: // searchMessagesChatTypeFilterPrivate#45b152cf -// case *tdapi.SearchMessagesChatTypeFilterGroup: // searchMessagesChatTypeFilterGroup#853fa71a -// case *tdapi.SearchMessagesChatTypeFilterChannel: // searchMessagesChatTypeFilterChannel#d1e4b6d5 -// default: panic(v) -// } -type SearchMessagesChatTypeFilterClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() SearchMessagesChatTypeFilterClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeSearchMessagesChatTypeFilter implements binary de-serialization for SearchMessagesChatTypeFilterClass. -func DecodeSearchMessagesChatTypeFilter(buf *bin.Buffer) (SearchMessagesChatTypeFilterClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case SearchMessagesChatTypeFilterPrivateTypeID: - // Decoding searchMessagesChatTypeFilterPrivate#45b152cf. - v := SearchMessagesChatTypeFilterPrivate{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) - } - return &v, nil - case SearchMessagesChatTypeFilterGroupTypeID: - // Decoding searchMessagesChatTypeFilterGroup#853fa71a. - v := SearchMessagesChatTypeFilterGroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) - } - return &v, nil - case SearchMessagesChatTypeFilterChannelTypeID: - // Decoding searchMessagesChatTypeFilterChannel#d1e4b6d5. - v := SearchMessagesChatTypeFilterChannel{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONSearchMessagesChatTypeFilter implements binary de-serialization for SearchMessagesChatTypeFilterClass. -func DecodeTDLibJSONSearchMessagesChatTypeFilter(buf tdjson.Decoder) (SearchMessagesChatTypeFilterClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "searchMessagesChatTypeFilterPrivate": - // Decoding searchMessagesChatTypeFilterPrivate#45b152cf. - v := SearchMessagesChatTypeFilterPrivate{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) - } - return &v, nil - case "searchMessagesChatTypeFilterGroup": - // Decoding searchMessagesChatTypeFilterGroup#853fa71a. - v := SearchMessagesChatTypeFilterGroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) - } - return &v, nil - case "searchMessagesChatTypeFilterChannel": - // Decoding searchMessagesChatTypeFilterChannel#d1e4b6d5. - v := SearchMessagesChatTypeFilterChannel{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SearchMessagesChatTypeFilterClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// SearchMessagesChatTypeFilter boxes the SearchMessagesChatTypeFilterClass providing a helper. -type SearchMessagesChatTypeFilterBox struct { - SearchMessagesChatTypeFilter SearchMessagesChatTypeFilterClass -} - -// Decode implements bin.Decoder for SearchMessagesChatTypeFilterBox. -func (b *SearchMessagesChatTypeFilterBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode SearchMessagesChatTypeFilterBox to nil") - } - v, err := DecodeSearchMessagesChatTypeFilter(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SearchMessagesChatTypeFilter = v - return nil -} - -// Encode implements bin.Encode for SearchMessagesChatTypeFilterBox. -func (b *SearchMessagesChatTypeFilterBox) Encode(buf *bin.Buffer) error { - if b == nil || b.SearchMessagesChatTypeFilter == nil { - return fmt.Errorf("unable to encode SearchMessagesChatTypeFilterClass as nil") - } - return b.SearchMessagesChatTypeFilter.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for SearchMessagesChatTypeFilterBox. -func (b *SearchMessagesChatTypeFilterBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode SearchMessagesChatTypeFilterBox to nil") - } - v, err := DecodeTDLibJSONSearchMessagesChatTypeFilter(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SearchMessagesChatTypeFilter = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for SearchMessagesChatTypeFilterBox. -func (b *SearchMessagesChatTypeFilterBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.SearchMessagesChatTypeFilter == nil { - return fmt.Errorf("unable to encode SearchMessagesChatTypeFilterClass as nil") - } - return b.SearchMessagesChatTypeFilter.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_search_messages_filter_gen.go b/tdapi/tl_search_messages_filter_gen.go deleted file mode 100644 index 8ce308a7e..000000000 --- a/tdapi/tl_search_messages_filter_gen.go +++ /dev/null @@ -1,2621 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchMessagesFilterEmpty represents TL type `searchMessagesFilterEmpty#cc2e1337`. -type SearchMessagesFilterEmpty struct { -} - -// SearchMessagesFilterEmptyTypeID is TL type id of SearchMessagesFilterEmpty. -const SearchMessagesFilterEmptyTypeID = 0xcc2e1337 - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterEmpty) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterEmpty. -var ( - _ bin.Encoder = &SearchMessagesFilterEmpty{} - _ bin.Decoder = &SearchMessagesFilterEmpty{} - _ bin.BareEncoder = &SearchMessagesFilterEmpty{} - _ bin.BareDecoder = &SearchMessagesFilterEmpty{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterEmpty{} -) - -func (s *SearchMessagesFilterEmpty) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterEmpty) String() string { - if s == nil { - return "SearchMessagesFilterEmpty(nil)" - } - type Alias SearchMessagesFilterEmpty - return fmt.Sprintf("SearchMessagesFilterEmpty%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterEmpty) TypeID() uint32 { - return SearchMessagesFilterEmptyTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterEmpty) TypeName() string { - return "searchMessagesFilterEmpty" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterEmpty) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterEmpty", - ID: SearchMessagesFilterEmptyTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterEmpty) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterEmpty#cc2e1337 as nil") - } - b.PutID(SearchMessagesFilterEmptyTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterEmpty) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterEmpty#cc2e1337 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterEmpty) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterEmpty#cc2e1337 to nil") - } - if err := b.ConsumeID(SearchMessagesFilterEmptyTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterEmpty#cc2e1337: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterEmpty) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterEmpty#cc2e1337 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterEmpty) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterEmpty#cc2e1337 as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterEmpty") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterEmpty) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterEmpty#cc2e1337 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterEmpty"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterEmpty#cc2e1337: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterAnimation represents TL type `searchMessagesFilterAnimation#f6b800c5`. -type SearchMessagesFilterAnimation struct { -} - -// SearchMessagesFilterAnimationTypeID is TL type id of SearchMessagesFilterAnimation. -const SearchMessagesFilterAnimationTypeID = 0xf6b800c5 - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterAnimation) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterAnimation. -var ( - _ bin.Encoder = &SearchMessagesFilterAnimation{} - _ bin.Decoder = &SearchMessagesFilterAnimation{} - _ bin.BareEncoder = &SearchMessagesFilterAnimation{} - _ bin.BareDecoder = &SearchMessagesFilterAnimation{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterAnimation{} -) - -func (s *SearchMessagesFilterAnimation) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterAnimation) String() string { - if s == nil { - return "SearchMessagesFilterAnimation(nil)" - } - type Alias SearchMessagesFilterAnimation - return fmt.Sprintf("SearchMessagesFilterAnimation%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterAnimation) TypeID() uint32 { - return SearchMessagesFilterAnimationTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterAnimation) TypeName() string { - return "searchMessagesFilterAnimation" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterAnimation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterAnimation", - ID: SearchMessagesFilterAnimationTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterAnimation) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterAnimation#f6b800c5 as nil") - } - b.PutID(SearchMessagesFilterAnimationTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterAnimation) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterAnimation#f6b800c5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterAnimation) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterAnimation#f6b800c5 to nil") - } - if err := b.ConsumeID(SearchMessagesFilterAnimationTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterAnimation#f6b800c5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterAnimation) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterAnimation#f6b800c5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterAnimation) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterAnimation#f6b800c5 as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterAnimation") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterAnimation) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterAnimation#f6b800c5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterAnimation"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterAnimation#f6b800c5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterAudio represents TL type `searchMessagesFilterAudio#33b5147b`. -type SearchMessagesFilterAudio struct { -} - -// SearchMessagesFilterAudioTypeID is TL type id of SearchMessagesFilterAudio. -const SearchMessagesFilterAudioTypeID = 0x33b5147b - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterAudio) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterAudio. -var ( - _ bin.Encoder = &SearchMessagesFilterAudio{} - _ bin.Decoder = &SearchMessagesFilterAudio{} - _ bin.BareEncoder = &SearchMessagesFilterAudio{} - _ bin.BareDecoder = &SearchMessagesFilterAudio{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterAudio{} -) - -func (s *SearchMessagesFilterAudio) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterAudio) String() string { - if s == nil { - return "SearchMessagesFilterAudio(nil)" - } - type Alias SearchMessagesFilterAudio - return fmt.Sprintf("SearchMessagesFilterAudio%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterAudio) TypeID() uint32 { - return SearchMessagesFilterAudioTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterAudio) TypeName() string { - return "searchMessagesFilterAudio" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterAudio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterAudio", - ID: SearchMessagesFilterAudioTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterAudio) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterAudio#33b5147b as nil") - } - b.PutID(SearchMessagesFilterAudioTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterAudio) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterAudio#33b5147b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterAudio) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterAudio#33b5147b to nil") - } - if err := b.ConsumeID(SearchMessagesFilterAudioTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterAudio#33b5147b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterAudio) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterAudio#33b5147b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterAudio) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterAudio#33b5147b as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterAudio") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterAudio) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterAudio#33b5147b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterAudio"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterAudio#33b5147b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterDocument represents TL type `searchMessagesFilterDocument#5af9f74f`. -type SearchMessagesFilterDocument struct { -} - -// SearchMessagesFilterDocumentTypeID is TL type id of SearchMessagesFilterDocument. -const SearchMessagesFilterDocumentTypeID = 0x5af9f74f - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterDocument) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterDocument. -var ( - _ bin.Encoder = &SearchMessagesFilterDocument{} - _ bin.Decoder = &SearchMessagesFilterDocument{} - _ bin.BareEncoder = &SearchMessagesFilterDocument{} - _ bin.BareDecoder = &SearchMessagesFilterDocument{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterDocument{} -) - -func (s *SearchMessagesFilterDocument) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterDocument) String() string { - if s == nil { - return "SearchMessagesFilterDocument(nil)" - } - type Alias SearchMessagesFilterDocument - return fmt.Sprintf("SearchMessagesFilterDocument%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterDocument) TypeID() uint32 { - return SearchMessagesFilterDocumentTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterDocument) TypeName() string { - return "searchMessagesFilterDocument" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterDocument) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterDocument", - ID: SearchMessagesFilterDocumentTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterDocument) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterDocument#5af9f74f as nil") - } - b.PutID(SearchMessagesFilterDocumentTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterDocument) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterDocument#5af9f74f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterDocument) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterDocument#5af9f74f to nil") - } - if err := b.ConsumeID(SearchMessagesFilterDocumentTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterDocument#5af9f74f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterDocument) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterDocument#5af9f74f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterDocument) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterDocument#5af9f74f as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterDocument") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterDocument) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterDocument#5af9f74f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterDocument"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterDocument#5af9f74f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterPhoto represents TL type `searchMessagesFilterPhoto#37309b05`. -type SearchMessagesFilterPhoto struct { -} - -// SearchMessagesFilterPhotoTypeID is TL type id of SearchMessagesFilterPhoto. -const SearchMessagesFilterPhotoTypeID = 0x37309b05 - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterPhoto) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterPhoto. -var ( - _ bin.Encoder = &SearchMessagesFilterPhoto{} - _ bin.Decoder = &SearchMessagesFilterPhoto{} - _ bin.BareEncoder = &SearchMessagesFilterPhoto{} - _ bin.BareDecoder = &SearchMessagesFilterPhoto{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterPhoto{} -) - -func (s *SearchMessagesFilterPhoto) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterPhoto) String() string { - if s == nil { - return "SearchMessagesFilterPhoto(nil)" - } - type Alias SearchMessagesFilterPhoto - return fmt.Sprintf("SearchMessagesFilterPhoto%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterPhoto) TypeID() uint32 { - return SearchMessagesFilterPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterPhoto) TypeName() string { - return "searchMessagesFilterPhoto" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterPhoto", - ID: SearchMessagesFilterPhotoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterPhoto) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterPhoto#37309b05 as nil") - } - b.PutID(SearchMessagesFilterPhotoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterPhoto) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterPhoto#37309b05 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterPhoto) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterPhoto#37309b05 to nil") - } - if err := b.ConsumeID(SearchMessagesFilterPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterPhoto#37309b05: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterPhoto) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterPhoto#37309b05 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterPhoto#37309b05 as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterPhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterPhoto#37309b05 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterPhoto"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterPhoto#37309b05: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterVideo represents TL type `searchMessagesFilterVideo#6e2f92e`. -type SearchMessagesFilterVideo struct { -} - -// SearchMessagesFilterVideoTypeID is TL type id of SearchMessagesFilterVideo. -const SearchMessagesFilterVideoTypeID = 0x6e2f92e - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterVideo) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterVideo. -var ( - _ bin.Encoder = &SearchMessagesFilterVideo{} - _ bin.Decoder = &SearchMessagesFilterVideo{} - _ bin.BareEncoder = &SearchMessagesFilterVideo{} - _ bin.BareDecoder = &SearchMessagesFilterVideo{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterVideo{} -) - -func (s *SearchMessagesFilterVideo) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterVideo) String() string { - if s == nil { - return "SearchMessagesFilterVideo(nil)" - } - type Alias SearchMessagesFilterVideo - return fmt.Sprintf("SearchMessagesFilterVideo%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterVideo) TypeID() uint32 { - return SearchMessagesFilterVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterVideo) TypeName() string { - return "searchMessagesFilterVideo" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterVideo", - ID: SearchMessagesFilterVideoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterVideo) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVideo#6e2f92e as nil") - } - b.PutID(SearchMessagesFilterVideoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterVideo) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVideo#6e2f92e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterVideo) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVideo#6e2f92e to nil") - } - if err := b.ConsumeID(SearchMessagesFilterVideoTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterVideo#6e2f92e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterVideo) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVideo#6e2f92e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVideo#6e2f92e as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterVideo") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVideo#6e2f92e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterVideo"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterVideo#6e2f92e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterVoiceNote represents TL type `searchMessagesFilterVoiceNote#6dc2227d`. -type SearchMessagesFilterVoiceNote struct { -} - -// SearchMessagesFilterVoiceNoteTypeID is TL type id of SearchMessagesFilterVoiceNote. -const SearchMessagesFilterVoiceNoteTypeID = 0x6dc2227d - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterVoiceNote) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterVoiceNote. -var ( - _ bin.Encoder = &SearchMessagesFilterVoiceNote{} - _ bin.Decoder = &SearchMessagesFilterVoiceNote{} - _ bin.BareEncoder = &SearchMessagesFilterVoiceNote{} - _ bin.BareDecoder = &SearchMessagesFilterVoiceNote{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterVoiceNote{} -) - -func (s *SearchMessagesFilterVoiceNote) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterVoiceNote) String() string { - if s == nil { - return "SearchMessagesFilterVoiceNote(nil)" - } - type Alias SearchMessagesFilterVoiceNote - return fmt.Sprintf("SearchMessagesFilterVoiceNote%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterVoiceNote) TypeID() uint32 { - return SearchMessagesFilterVoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterVoiceNote) TypeName() string { - return "searchMessagesFilterVoiceNote" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterVoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterVoiceNote", - ID: SearchMessagesFilterVoiceNoteTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterVoiceNote) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVoiceNote#6dc2227d as nil") - } - b.PutID(SearchMessagesFilterVoiceNoteTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterVoiceNote) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVoiceNote#6dc2227d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterVoiceNote) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVoiceNote#6dc2227d to nil") - } - if err := b.ConsumeID(SearchMessagesFilterVoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterVoiceNote#6dc2227d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterVoiceNote) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVoiceNote#6dc2227d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterVoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVoiceNote#6dc2227d as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterVoiceNote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterVoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVoiceNote#6dc2227d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterVoiceNote"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterVoiceNote#6dc2227d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterPhotoAndVideo represents TL type `searchMessagesFilterPhotoAndVideo#5097e193`. -type SearchMessagesFilterPhotoAndVideo struct { -} - -// SearchMessagesFilterPhotoAndVideoTypeID is TL type id of SearchMessagesFilterPhotoAndVideo. -const SearchMessagesFilterPhotoAndVideoTypeID = 0x5097e193 - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterPhotoAndVideo) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterPhotoAndVideo. -var ( - _ bin.Encoder = &SearchMessagesFilterPhotoAndVideo{} - _ bin.Decoder = &SearchMessagesFilterPhotoAndVideo{} - _ bin.BareEncoder = &SearchMessagesFilterPhotoAndVideo{} - _ bin.BareDecoder = &SearchMessagesFilterPhotoAndVideo{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterPhotoAndVideo{} -) - -func (s *SearchMessagesFilterPhotoAndVideo) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterPhotoAndVideo) String() string { - if s == nil { - return "SearchMessagesFilterPhotoAndVideo(nil)" - } - type Alias SearchMessagesFilterPhotoAndVideo - return fmt.Sprintf("SearchMessagesFilterPhotoAndVideo%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterPhotoAndVideo) TypeID() uint32 { - return SearchMessagesFilterPhotoAndVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterPhotoAndVideo) TypeName() string { - return "searchMessagesFilterPhotoAndVideo" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterPhotoAndVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterPhotoAndVideo", - ID: SearchMessagesFilterPhotoAndVideoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterPhotoAndVideo) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterPhotoAndVideo#5097e193 as nil") - } - b.PutID(SearchMessagesFilterPhotoAndVideoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterPhotoAndVideo) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterPhotoAndVideo#5097e193 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterPhotoAndVideo) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterPhotoAndVideo#5097e193 to nil") - } - if err := b.ConsumeID(SearchMessagesFilterPhotoAndVideoTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterPhotoAndVideo#5097e193: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterPhotoAndVideo) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterPhotoAndVideo#5097e193 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterPhotoAndVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterPhotoAndVideo#5097e193 as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterPhotoAndVideo") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterPhotoAndVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterPhotoAndVideo#5097e193 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterPhotoAndVideo"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterPhotoAndVideo#5097e193: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterURL represents TL type `searchMessagesFilterUrl#92ffe18b`. -type SearchMessagesFilterURL struct { -} - -// SearchMessagesFilterURLTypeID is TL type id of SearchMessagesFilterURL. -const SearchMessagesFilterURLTypeID = 0x92ffe18b - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterURL) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterURL. -var ( - _ bin.Encoder = &SearchMessagesFilterURL{} - _ bin.Decoder = &SearchMessagesFilterURL{} - _ bin.BareEncoder = &SearchMessagesFilterURL{} - _ bin.BareDecoder = &SearchMessagesFilterURL{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterURL{} -) - -func (s *SearchMessagesFilterURL) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterURL) String() string { - if s == nil { - return "SearchMessagesFilterURL(nil)" - } - type Alias SearchMessagesFilterURL - return fmt.Sprintf("SearchMessagesFilterURL%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterURL) TypeID() uint32 { - return SearchMessagesFilterURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterURL) TypeName() string { - return "searchMessagesFilterUrl" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterUrl", - ID: SearchMessagesFilterURLTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterURL) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterUrl#92ffe18b as nil") - } - b.PutID(SearchMessagesFilterURLTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterURL) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterUrl#92ffe18b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterURL) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterUrl#92ffe18b to nil") - } - if err := b.ConsumeID(SearchMessagesFilterURLTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterUrl#92ffe18b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterURL) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterUrl#92ffe18b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterURL) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterUrl#92ffe18b as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterUrl") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterURL) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterUrl#92ffe18b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterUrl"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterUrl#92ffe18b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterChatPhoto represents TL type `searchMessagesFilterChatPhoto#b5a0d35f`. -type SearchMessagesFilterChatPhoto struct { -} - -// SearchMessagesFilterChatPhotoTypeID is TL type id of SearchMessagesFilterChatPhoto. -const SearchMessagesFilterChatPhotoTypeID = 0xb5a0d35f - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterChatPhoto) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterChatPhoto. -var ( - _ bin.Encoder = &SearchMessagesFilterChatPhoto{} - _ bin.Decoder = &SearchMessagesFilterChatPhoto{} - _ bin.BareEncoder = &SearchMessagesFilterChatPhoto{} - _ bin.BareDecoder = &SearchMessagesFilterChatPhoto{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterChatPhoto{} -) - -func (s *SearchMessagesFilterChatPhoto) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterChatPhoto) String() string { - if s == nil { - return "SearchMessagesFilterChatPhoto(nil)" - } - type Alias SearchMessagesFilterChatPhoto - return fmt.Sprintf("SearchMessagesFilterChatPhoto%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterChatPhoto) TypeID() uint32 { - return SearchMessagesFilterChatPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterChatPhoto) TypeName() string { - return "searchMessagesFilterChatPhoto" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterChatPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterChatPhoto", - ID: SearchMessagesFilterChatPhotoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterChatPhoto) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterChatPhoto#b5a0d35f as nil") - } - b.PutID(SearchMessagesFilterChatPhotoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterChatPhoto) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterChatPhoto#b5a0d35f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterChatPhoto) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterChatPhoto#b5a0d35f to nil") - } - if err := b.ConsumeID(SearchMessagesFilterChatPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterChatPhoto#b5a0d35f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterChatPhoto) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterChatPhoto#b5a0d35f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterChatPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterChatPhoto#b5a0d35f as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterChatPhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterChatPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterChatPhoto#b5a0d35f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterChatPhoto"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterChatPhoto#b5a0d35f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterVideoNote represents TL type `searchMessagesFilterVideoNote#21a2e3f9`. -type SearchMessagesFilterVideoNote struct { -} - -// SearchMessagesFilterVideoNoteTypeID is TL type id of SearchMessagesFilterVideoNote. -const SearchMessagesFilterVideoNoteTypeID = 0x21a2e3f9 - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterVideoNote) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterVideoNote. -var ( - _ bin.Encoder = &SearchMessagesFilterVideoNote{} - _ bin.Decoder = &SearchMessagesFilterVideoNote{} - _ bin.BareEncoder = &SearchMessagesFilterVideoNote{} - _ bin.BareDecoder = &SearchMessagesFilterVideoNote{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterVideoNote{} -) - -func (s *SearchMessagesFilterVideoNote) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterVideoNote) String() string { - if s == nil { - return "SearchMessagesFilterVideoNote(nil)" - } - type Alias SearchMessagesFilterVideoNote - return fmt.Sprintf("SearchMessagesFilterVideoNote%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterVideoNote) TypeID() uint32 { - return SearchMessagesFilterVideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterVideoNote) TypeName() string { - return "searchMessagesFilterVideoNote" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterVideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterVideoNote", - ID: SearchMessagesFilterVideoNoteTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterVideoNote) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVideoNote#21a2e3f9 as nil") - } - b.PutID(SearchMessagesFilterVideoNoteTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterVideoNote) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVideoNote#21a2e3f9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterVideoNote) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVideoNote#21a2e3f9 to nil") - } - if err := b.ConsumeID(SearchMessagesFilterVideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterVideoNote#21a2e3f9: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterVideoNote) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVideoNote#21a2e3f9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVideoNote#21a2e3f9 as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterVideoNote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVideoNote#21a2e3f9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterVideoNote"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterVideoNote#21a2e3f9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterVoiceAndVideoNote represents TL type `searchMessagesFilterVoiceAndVideoNote#279680e3`. -type SearchMessagesFilterVoiceAndVideoNote struct { -} - -// SearchMessagesFilterVoiceAndVideoNoteTypeID is TL type id of SearchMessagesFilterVoiceAndVideoNote. -const SearchMessagesFilterVoiceAndVideoNoteTypeID = 0x279680e3 - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterVoiceAndVideoNote) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterVoiceAndVideoNote. -var ( - _ bin.Encoder = &SearchMessagesFilterVoiceAndVideoNote{} - _ bin.Decoder = &SearchMessagesFilterVoiceAndVideoNote{} - _ bin.BareEncoder = &SearchMessagesFilterVoiceAndVideoNote{} - _ bin.BareDecoder = &SearchMessagesFilterVoiceAndVideoNote{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterVoiceAndVideoNote{} -) - -func (s *SearchMessagesFilterVoiceAndVideoNote) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterVoiceAndVideoNote) String() string { - if s == nil { - return "SearchMessagesFilterVoiceAndVideoNote(nil)" - } - type Alias SearchMessagesFilterVoiceAndVideoNote - return fmt.Sprintf("SearchMessagesFilterVoiceAndVideoNote%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterVoiceAndVideoNote) TypeID() uint32 { - return SearchMessagesFilterVoiceAndVideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterVoiceAndVideoNote) TypeName() string { - return "searchMessagesFilterVoiceAndVideoNote" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterVoiceAndVideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterVoiceAndVideoNote", - ID: SearchMessagesFilterVoiceAndVideoNoteTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterVoiceAndVideoNote) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVoiceAndVideoNote#279680e3 as nil") - } - b.PutID(SearchMessagesFilterVoiceAndVideoNoteTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterVoiceAndVideoNote) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVoiceAndVideoNote#279680e3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterVoiceAndVideoNote) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVoiceAndVideoNote#279680e3 to nil") - } - if err := b.ConsumeID(SearchMessagesFilterVoiceAndVideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterVoiceAndVideoNote#279680e3: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterVoiceAndVideoNote) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVoiceAndVideoNote#279680e3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterVoiceAndVideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterVoiceAndVideoNote#279680e3 as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterVoiceAndVideoNote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterVoiceAndVideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterVoiceAndVideoNote#279680e3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterVoiceAndVideoNote"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterVoiceAndVideoNote#279680e3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterMention represents TL type `searchMessagesFilterMention#7748c89c`. -type SearchMessagesFilterMention struct { -} - -// SearchMessagesFilterMentionTypeID is TL type id of SearchMessagesFilterMention. -const SearchMessagesFilterMentionTypeID = 0x7748c89c - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterMention) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterMention. -var ( - _ bin.Encoder = &SearchMessagesFilterMention{} - _ bin.Decoder = &SearchMessagesFilterMention{} - _ bin.BareEncoder = &SearchMessagesFilterMention{} - _ bin.BareDecoder = &SearchMessagesFilterMention{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterMention{} -) - -func (s *SearchMessagesFilterMention) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterMention) String() string { - if s == nil { - return "SearchMessagesFilterMention(nil)" - } - type Alias SearchMessagesFilterMention - return fmt.Sprintf("SearchMessagesFilterMention%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterMention) TypeID() uint32 { - return SearchMessagesFilterMentionTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterMention) TypeName() string { - return "searchMessagesFilterMention" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterMention) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterMention", - ID: SearchMessagesFilterMentionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterMention) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterMention#7748c89c as nil") - } - b.PutID(SearchMessagesFilterMentionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterMention) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterMention#7748c89c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterMention) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterMention#7748c89c to nil") - } - if err := b.ConsumeID(SearchMessagesFilterMentionTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterMention#7748c89c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterMention) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterMention#7748c89c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterMention) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterMention#7748c89c as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterMention") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterMention) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterMention#7748c89c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterMention"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterMention#7748c89c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterUnreadMention represents TL type `searchMessagesFilterUnreadMention#fa4aadc3`. -type SearchMessagesFilterUnreadMention struct { -} - -// SearchMessagesFilterUnreadMentionTypeID is TL type id of SearchMessagesFilterUnreadMention. -const SearchMessagesFilterUnreadMentionTypeID = 0xfa4aadc3 - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterUnreadMention) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterUnreadMention. -var ( - _ bin.Encoder = &SearchMessagesFilterUnreadMention{} - _ bin.Decoder = &SearchMessagesFilterUnreadMention{} - _ bin.BareEncoder = &SearchMessagesFilterUnreadMention{} - _ bin.BareDecoder = &SearchMessagesFilterUnreadMention{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterUnreadMention{} -) - -func (s *SearchMessagesFilterUnreadMention) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterUnreadMention) String() string { - if s == nil { - return "SearchMessagesFilterUnreadMention(nil)" - } - type Alias SearchMessagesFilterUnreadMention - return fmt.Sprintf("SearchMessagesFilterUnreadMention%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterUnreadMention) TypeID() uint32 { - return SearchMessagesFilterUnreadMentionTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterUnreadMention) TypeName() string { - return "searchMessagesFilterUnreadMention" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterUnreadMention) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterUnreadMention", - ID: SearchMessagesFilterUnreadMentionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterUnreadMention) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterUnreadMention#fa4aadc3 as nil") - } - b.PutID(SearchMessagesFilterUnreadMentionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterUnreadMention) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterUnreadMention#fa4aadc3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterUnreadMention) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterUnreadMention#fa4aadc3 to nil") - } - if err := b.ConsumeID(SearchMessagesFilterUnreadMentionTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterUnreadMention#fa4aadc3: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterUnreadMention) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterUnreadMention#fa4aadc3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterUnreadMention) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterUnreadMention#fa4aadc3 as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterUnreadMention") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterUnreadMention) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterUnreadMention#fa4aadc3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterUnreadMention"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterUnreadMention#fa4aadc3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterUnreadReaction represents TL type `searchMessagesFilterUnreadReaction#adc43100`. -type SearchMessagesFilterUnreadReaction struct { -} - -// SearchMessagesFilterUnreadReactionTypeID is TL type id of SearchMessagesFilterUnreadReaction. -const SearchMessagesFilterUnreadReactionTypeID = 0xadc43100 - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterUnreadReaction) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterUnreadReaction. -var ( - _ bin.Encoder = &SearchMessagesFilterUnreadReaction{} - _ bin.Decoder = &SearchMessagesFilterUnreadReaction{} - _ bin.BareEncoder = &SearchMessagesFilterUnreadReaction{} - _ bin.BareDecoder = &SearchMessagesFilterUnreadReaction{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterUnreadReaction{} -) - -func (s *SearchMessagesFilterUnreadReaction) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterUnreadReaction) String() string { - if s == nil { - return "SearchMessagesFilterUnreadReaction(nil)" - } - type Alias SearchMessagesFilterUnreadReaction - return fmt.Sprintf("SearchMessagesFilterUnreadReaction%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterUnreadReaction) TypeID() uint32 { - return SearchMessagesFilterUnreadReactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterUnreadReaction) TypeName() string { - return "searchMessagesFilterUnreadReaction" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterUnreadReaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterUnreadReaction", - ID: SearchMessagesFilterUnreadReactionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterUnreadReaction) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterUnreadReaction#adc43100 as nil") - } - b.PutID(SearchMessagesFilterUnreadReactionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterUnreadReaction) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterUnreadReaction#adc43100 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterUnreadReaction) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterUnreadReaction#adc43100 to nil") - } - if err := b.ConsumeID(SearchMessagesFilterUnreadReactionTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterUnreadReaction#adc43100: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterUnreadReaction) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterUnreadReaction#adc43100 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterUnreadReaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterUnreadReaction#adc43100 as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterUnreadReaction") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterUnreadReaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterUnreadReaction#adc43100 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterUnreadReaction"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterUnreadReaction#adc43100: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterFailedToSend represents TL type `searchMessagesFilterFailedToSend#dc74d6fc`. -type SearchMessagesFilterFailedToSend struct { -} - -// SearchMessagesFilterFailedToSendTypeID is TL type id of SearchMessagesFilterFailedToSend. -const SearchMessagesFilterFailedToSendTypeID = 0xdc74d6fc - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterFailedToSend) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterFailedToSend. -var ( - _ bin.Encoder = &SearchMessagesFilterFailedToSend{} - _ bin.Decoder = &SearchMessagesFilterFailedToSend{} - _ bin.BareEncoder = &SearchMessagesFilterFailedToSend{} - _ bin.BareDecoder = &SearchMessagesFilterFailedToSend{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterFailedToSend{} -) - -func (s *SearchMessagesFilterFailedToSend) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterFailedToSend) String() string { - if s == nil { - return "SearchMessagesFilterFailedToSend(nil)" - } - type Alias SearchMessagesFilterFailedToSend - return fmt.Sprintf("SearchMessagesFilterFailedToSend%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterFailedToSend) TypeID() uint32 { - return SearchMessagesFilterFailedToSendTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterFailedToSend) TypeName() string { - return "searchMessagesFilterFailedToSend" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterFailedToSend) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterFailedToSend", - ID: SearchMessagesFilterFailedToSendTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterFailedToSend) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterFailedToSend#dc74d6fc as nil") - } - b.PutID(SearchMessagesFilterFailedToSendTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterFailedToSend) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterFailedToSend#dc74d6fc as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterFailedToSend) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterFailedToSend#dc74d6fc to nil") - } - if err := b.ConsumeID(SearchMessagesFilterFailedToSendTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterFailedToSend#dc74d6fc: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterFailedToSend) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterFailedToSend#dc74d6fc to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterFailedToSend) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterFailedToSend#dc74d6fc as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterFailedToSend") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterFailedToSend) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterFailedToSend#dc74d6fc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterFailedToSend"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterFailedToSend#dc74d6fc: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterPinned represents TL type `searchMessagesFilterPinned#16294d48`. -type SearchMessagesFilterPinned struct { -} - -// SearchMessagesFilterPinnedTypeID is TL type id of SearchMessagesFilterPinned. -const SearchMessagesFilterPinnedTypeID = 0x16294d48 - -// construct implements constructor of SearchMessagesFilterClass. -func (s SearchMessagesFilterPinned) construct() SearchMessagesFilterClass { return &s } - -// Ensuring interfaces in compile-time for SearchMessagesFilterPinned. -var ( - _ bin.Encoder = &SearchMessagesFilterPinned{} - _ bin.Decoder = &SearchMessagesFilterPinned{} - _ bin.BareEncoder = &SearchMessagesFilterPinned{} - _ bin.BareDecoder = &SearchMessagesFilterPinned{} - - _ SearchMessagesFilterClass = &SearchMessagesFilterPinned{} -) - -func (s *SearchMessagesFilterPinned) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesFilterPinned) String() string { - if s == nil { - return "SearchMessagesFilterPinned(nil)" - } - type Alias SearchMessagesFilterPinned - return fmt.Sprintf("SearchMessagesFilterPinned%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesFilterPinned) TypeID() uint32 { - return SearchMessagesFilterPinnedTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesFilterPinned) TypeName() string { - return "searchMessagesFilterPinned" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesFilterPinned) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessagesFilterPinned", - ID: SearchMessagesFilterPinnedTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesFilterPinned) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterPinned#16294d48 as nil") - } - b.PutID(SearchMessagesFilterPinnedTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesFilterPinned) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterPinned#16294d48 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesFilterPinned) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterPinned#16294d48 to nil") - } - if err := b.ConsumeID(SearchMessagesFilterPinnedTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterPinned#16294d48: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesFilterPinned) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterPinned#16294d48 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesFilterPinned) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessagesFilterPinned#16294d48 as nil") - } - b.ObjStart() - b.PutID("searchMessagesFilterPinned") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesFilterPinned) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessagesFilterPinned#16294d48 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessagesFilterPinned"); err != nil { - return fmt.Errorf("unable to decode searchMessagesFilterPinned#16294d48: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SearchMessagesFilterClassName is schema name of SearchMessagesFilterClass. -const SearchMessagesFilterClassName = "SearchMessagesFilter" - -// SearchMessagesFilterClass represents SearchMessagesFilter generic type. -// -// Example: -// -// g, err := tdapi.DecodeSearchMessagesFilter(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.SearchMessagesFilterEmpty: // searchMessagesFilterEmpty#cc2e1337 -// case *tdapi.SearchMessagesFilterAnimation: // searchMessagesFilterAnimation#f6b800c5 -// case *tdapi.SearchMessagesFilterAudio: // searchMessagesFilterAudio#33b5147b -// case *tdapi.SearchMessagesFilterDocument: // searchMessagesFilterDocument#5af9f74f -// case *tdapi.SearchMessagesFilterPhoto: // searchMessagesFilterPhoto#37309b05 -// case *tdapi.SearchMessagesFilterVideo: // searchMessagesFilterVideo#6e2f92e -// case *tdapi.SearchMessagesFilterVoiceNote: // searchMessagesFilterVoiceNote#6dc2227d -// case *tdapi.SearchMessagesFilterPhotoAndVideo: // searchMessagesFilterPhotoAndVideo#5097e193 -// case *tdapi.SearchMessagesFilterURL: // searchMessagesFilterUrl#92ffe18b -// case *tdapi.SearchMessagesFilterChatPhoto: // searchMessagesFilterChatPhoto#b5a0d35f -// case *tdapi.SearchMessagesFilterVideoNote: // searchMessagesFilterVideoNote#21a2e3f9 -// case *tdapi.SearchMessagesFilterVoiceAndVideoNote: // searchMessagesFilterVoiceAndVideoNote#279680e3 -// case *tdapi.SearchMessagesFilterMention: // searchMessagesFilterMention#7748c89c -// case *tdapi.SearchMessagesFilterUnreadMention: // searchMessagesFilterUnreadMention#fa4aadc3 -// case *tdapi.SearchMessagesFilterUnreadReaction: // searchMessagesFilterUnreadReaction#adc43100 -// case *tdapi.SearchMessagesFilterFailedToSend: // searchMessagesFilterFailedToSend#dc74d6fc -// case *tdapi.SearchMessagesFilterPinned: // searchMessagesFilterPinned#16294d48 -// default: panic(v) -// } -type SearchMessagesFilterClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() SearchMessagesFilterClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeSearchMessagesFilter implements binary de-serialization for SearchMessagesFilterClass. -func DecodeSearchMessagesFilter(buf *bin.Buffer) (SearchMessagesFilterClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case SearchMessagesFilterEmptyTypeID: - // Decoding searchMessagesFilterEmpty#cc2e1337. - v := SearchMessagesFilterEmpty{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterAnimationTypeID: - // Decoding searchMessagesFilterAnimation#f6b800c5. - v := SearchMessagesFilterAnimation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterAudioTypeID: - // Decoding searchMessagesFilterAudio#33b5147b. - v := SearchMessagesFilterAudio{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterDocumentTypeID: - // Decoding searchMessagesFilterDocument#5af9f74f. - v := SearchMessagesFilterDocument{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterPhotoTypeID: - // Decoding searchMessagesFilterPhoto#37309b05. - v := SearchMessagesFilterPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterVideoTypeID: - // Decoding searchMessagesFilterVideo#6e2f92e. - v := SearchMessagesFilterVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterVoiceNoteTypeID: - // Decoding searchMessagesFilterVoiceNote#6dc2227d. - v := SearchMessagesFilterVoiceNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterPhotoAndVideoTypeID: - // Decoding searchMessagesFilterPhotoAndVideo#5097e193. - v := SearchMessagesFilterPhotoAndVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterURLTypeID: - // Decoding searchMessagesFilterUrl#92ffe18b. - v := SearchMessagesFilterURL{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterChatPhotoTypeID: - // Decoding searchMessagesFilterChatPhoto#b5a0d35f. - v := SearchMessagesFilterChatPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterVideoNoteTypeID: - // Decoding searchMessagesFilterVideoNote#21a2e3f9. - v := SearchMessagesFilterVideoNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterVoiceAndVideoNoteTypeID: - // Decoding searchMessagesFilterVoiceAndVideoNote#279680e3. - v := SearchMessagesFilterVoiceAndVideoNote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterMentionTypeID: - // Decoding searchMessagesFilterMention#7748c89c. - v := SearchMessagesFilterMention{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterUnreadMentionTypeID: - // Decoding searchMessagesFilterUnreadMention#fa4aadc3. - v := SearchMessagesFilterUnreadMention{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterUnreadReactionTypeID: - // Decoding searchMessagesFilterUnreadReaction#adc43100. - v := SearchMessagesFilterUnreadReaction{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterFailedToSendTypeID: - // Decoding searchMessagesFilterFailedToSend#dc74d6fc. - v := SearchMessagesFilterFailedToSend{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case SearchMessagesFilterPinnedTypeID: - // Decoding searchMessagesFilterPinned#16294d48. - v := SearchMessagesFilterPinned{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONSearchMessagesFilter implements binary de-serialization for SearchMessagesFilterClass. -func DecodeTDLibJSONSearchMessagesFilter(buf tdjson.Decoder) (SearchMessagesFilterClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "searchMessagesFilterEmpty": - // Decoding searchMessagesFilterEmpty#cc2e1337. - v := SearchMessagesFilterEmpty{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterAnimation": - // Decoding searchMessagesFilterAnimation#f6b800c5. - v := SearchMessagesFilterAnimation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterAudio": - // Decoding searchMessagesFilterAudio#33b5147b. - v := SearchMessagesFilterAudio{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterDocument": - // Decoding searchMessagesFilterDocument#5af9f74f. - v := SearchMessagesFilterDocument{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterPhoto": - // Decoding searchMessagesFilterPhoto#37309b05. - v := SearchMessagesFilterPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterVideo": - // Decoding searchMessagesFilterVideo#6e2f92e. - v := SearchMessagesFilterVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterVoiceNote": - // Decoding searchMessagesFilterVoiceNote#6dc2227d. - v := SearchMessagesFilterVoiceNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterPhotoAndVideo": - // Decoding searchMessagesFilterPhotoAndVideo#5097e193. - v := SearchMessagesFilterPhotoAndVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterUrl": - // Decoding searchMessagesFilterUrl#92ffe18b. - v := SearchMessagesFilterURL{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterChatPhoto": - // Decoding searchMessagesFilterChatPhoto#b5a0d35f. - v := SearchMessagesFilterChatPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterVideoNote": - // Decoding searchMessagesFilterVideoNote#21a2e3f9. - v := SearchMessagesFilterVideoNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterVoiceAndVideoNote": - // Decoding searchMessagesFilterVoiceAndVideoNote#279680e3. - v := SearchMessagesFilterVoiceAndVideoNote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterMention": - // Decoding searchMessagesFilterMention#7748c89c. - v := SearchMessagesFilterMention{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterUnreadMention": - // Decoding searchMessagesFilterUnreadMention#fa4aadc3. - v := SearchMessagesFilterUnreadMention{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterUnreadReaction": - // Decoding searchMessagesFilterUnreadReaction#adc43100. - v := SearchMessagesFilterUnreadReaction{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterFailedToSend": - // Decoding searchMessagesFilterFailedToSend#dc74d6fc. - v := SearchMessagesFilterFailedToSend{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - case "searchMessagesFilterPinned": - // Decoding searchMessagesFilterPinned#16294d48. - v := SearchMessagesFilterPinned{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SearchMessagesFilterClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// SearchMessagesFilter boxes the SearchMessagesFilterClass providing a helper. -type SearchMessagesFilterBox struct { - SearchMessagesFilter SearchMessagesFilterClass -} - -// Decode implements bin.Decoder for SearchMessagesFilterBox. -func (b *SearchMessagesFilterBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode SearchMessagesFilterBox to nil") - } - v, err := DecodeSearchMessagesFilter(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SearchMessagesFilter = v - return nil -} - -// Encode implements bin.Encode for SearchMessagesFilterBox. -func (b *SearchMessagesFilterBox) Encode(buf *bin.Buffer) error { - if b == nil || b.SearchMessagesFilter == nil { - return fmt.Errorf("unable to encode SearchMessagesFilterClass as nil") - } - return b.SearchMessagesFilter.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for SearchMessagesFilterBox. -func (b *SearchMessagesFilterBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode SearchMessagesFilterBox to nil") - } - v, err := DecodeTDLibJSONSearchMessagesFilter(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SearchMessagesFilter = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for SearchMessagesFilterBox. -func (b *SearchMessagesFilterBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.SearchMessagesFilter == nil { - return fmt.Errorf("unable to encode SearchMessagesFilterClass as nil") - } - return b.SearchMessagesFilter.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_search_messages_gen.go b/tdapi/tl_search_messages_gen.go deleted file mode 100644 index 289e05d95..000000000 --- a/tdapi/tl_search_messages_gen.go +++ /dev/null @@ -1,479 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchMessagesRequest represents TL type `searchMessages#490addb5`. -type SearchMessagesRequest struct { - // Chat list in which to search messages; pass null to search in all chats regardless of - // their chat list. Only Main and Archive chat lists are supported - ChatList ChatListClass - // Query to search for - Query string - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of messages to be returned; up to 100. For optimal performance, the - // number of returned messages is chosen by TDLib and can be smaller than the specified - // limit - Limit int32 - // Additional filter for messages to search; pass null to search for all messages. - // Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, - // searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and - // searchMessagesFilterPinned are unsupported in this function - Filter SearchMessagesFilterClass - // Additional filter for type of the chat of the searched messages; pass null to search - // for messages in all chats - ChatTypeFilter SearchMessagesChatTypeFilterClass - // If not 0, the minimum date of the messages to return - MinDate int32 - // If not 0, the maximum date of the messages to return - MaxDate int32 -} - -// SearchMessagesRequestTypeID is TL type id of SearchMessagesRequest. -const SearchMessagesRequestTypeID = 0x490addb5 - -// Ensuring interfaces in compile-time for SearchMessagesRequest. -var ( - _ bin.Encoder = &SearchMessagesRequest{} - _ bin.Decoder = &SearchMessagesRequest{} - _ bin.BareEncoder = &SearchMessagesRequest{} - _ bin.BareDecoder = &SearchMessagesRequest{} -) - -func (s *SearchMessagesRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatList == nil) { - return false - } - if !(s.Query == "") { - return false - } - if !(s.Offset == "") { - return false - } - if !(s.Limit == 0) { - return false - } - if !(s.Filter == nil) { - return false - } - if !(s.ChatTypeFilter == nil) { - return false - } - if !(s.MinDate == 0) { - return false - } - if !(s.MaxDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchMessagesRequest) String() string { - if s == nil { - return "SearchMessagesRequest(nil)" - } - type Alias SearchMessagesRequest - return fmt.Sprintf("SearchMessagesRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchMessagesRequest) TypeID() uint32 { - return SearchMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchMessagesRequest) TypeName() string { - return "searchMessages" -} - -// TypeInfo returns info about TL type. -func (s *SearchMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchMessages", - ID: SearchMessagesRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatList", - SchemaName: "chat_list", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - { - Name: "Filter", - SchemaName: "filter", - }, - { - Name: "ChatTypeFilter", - SchemaName: "chat_type_filter", - }, - { - Name: "MinDate", - SchemaName: "min_date", - }, - { - Name: "MaxDate", - SchemaName: "max_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchMessagesRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessages#490addb5 as nil") - } - b.PutID(SearchMessagesRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchMessagesRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchMessages#490addb5 as nil") - } - if s.ChatList == nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_list is nil") - } - if err := s.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_list: %w", err) - } - b.PutString(s.Query) - b.PutString(s.Offset) - b.PutInt32(s.Limit) - if s.Filter == nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field filter is nil") - } - if err := s.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field filter: %w", err) - } - if s.ChatTypeFilter == nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_type_filter is nil") - } - if err := s.ChatTypeFilter.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_type_filter: %w", err) - } - b.PutInt32(s.MinDate) - b.PutInt32(s.MaxDate) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchMessagesRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessages#490addb5 to nil") - } - if err := b.ConsumeID(SearchMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchMessagesRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchMessages#490addb5 to nil") - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field chat_list: %w", err) - } - s.ChatList = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field query: %w", err) - } - s.Query = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field limit: %w", err) - } - s.Limit = value - } - { - value, err := DecodeSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field filter: %w", err) - } - s.Filter = value - } - { - value, err := DecodeSearchMessagesChatTypeFilter(b) - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field chat_type_filter: %w", err) - } - s.ChatTypeFilter = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field min_date: %w", err) - } - s.MinDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field max_date: %w", err) - } - s.MaxDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchMessages#490addb5 as nil") - } - b.ObjStart() - b.PutID("searchMessages") - b.Comma() - b.FieldStart("chat_list") - if s.ChatList == nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_list is nil") - } - if err := s.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_list: %w", err) - } - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("offset") - b.PutString(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.FieldStart("filter") - if s.Filter == nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field filter is nil") - } - if err := s.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field filter: %w", err) - } - b.Comma() - b.FieldStart("chat_type_filter") - if s.ChatTypeFilter == nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_type_filter is nil") - } - if err := s.ChatTypeFilter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchMessages#490addb5: field chat_type_filter: %w", err) - } - b.Comma() - b.FieldStart("min_date") - b.PutInt32(s.MinDate) - b.Comma() - b.FieldStart("max_date") - b.PutInt32(s.MaxDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchMessages#490addb5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchMessages"); err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: %w", err) - } - case "chat_list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field chat_list: %w", err) - } - s.ChatList = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field query: %w", err) - } - s.Query = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field limit: %w", err) - } - s.Limit = value - case "filter": - value, err := DecodeTDLibJSONSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field filter: %w", err) - } - s.Filter = value - case "chat_type_filter": - value, err := DecodeTDLibJSONSearchMessagesChatTypeFilter(b) - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field chat_type_filter: %w", err) - } - s.ChatTypeFilter = value - case "min_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field min_date: %w", err) - } - s.MinDate = value - case "max_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchMessages#490addb5: field max_date: %w", err) - } - s.MaxDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatList returns value of ChatList field. -func (s *SearchMessagesRequest) GetChatList() (value ChatListClass) { - if s == nil { - return - } - return s.ChatList -} - -// GetQuery returns value of Query field. -func (s *SearchMessagesRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetOffset returns value of Offset field. -func (s *SearchMessagesRequest) GetOffset() (value string) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchMessagesRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// GetFilter returns value of Filter field. -func (s *SearchMessagesRequest) GetFilter() (value SearchMessagesFilterClass) { - if s == nil { - return - } - return s.Filter -} - -// GetChatTypeFilter returns value of ChatTypeFilter field. -func (s *SearchMessagesRequest) GetChatTypeFilter() (value SearchMessagesChatTypeFilterClass) { - if s == nil { - return - } - return s.ChatTypeFilter -} - -// GetMinDate returns value of MinDate field. -func (s *SearchMessagesRequest) GetMinDate() (value int32) { - if s == nil { - return - } - return s.MinDate -} - -// GetMaxDate returns value of MaxDate field. -func (s *SearchMessagesRequest) GetMaxDate() (value int32) { - if s == nil { - return - } - return s.MaxDate -} - -// SearchMessages invokes method searchMessages#490addb5 returning error if any. -func (c *Client) SearchMessages(ctx context.Context, request *SearchMessagesRequest) (*FoundMessages, error) { - var result FoundMessages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_outgoing_document_messages_gen.go b/tdapi/tl_search_outgoing_document_messages_gen.go deleted file mode 100644 index a2c955159..000000000 --- a/tdapi/tl_search_outgoing_document_messages_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchOutgoingDocumentMessagesRequest represents TL type `searchOutgoingDocumentMessages#c023c47e`. -type SearchOutgoingDocumentMessagesRequest struct { - // Query to search for in document file name and message caption - Query string - // The maximum number of messages to be returned; up to 100 - Limit int32 -} - -// SearchOutgoingDocumentMessagesRequestTypeID is TL type id of SearchOutgoingDocumentMessagesRequest. -const SearchOutgoingDocumentMessagesRequestTypeID = 0xc023c47e - -// Ensuring interfaces in compile-time for SearchOutgoingDocumentMessagesRequest. -var ( - _ bin.Encoder = &SearchOutgoingDocumentMessagesRequest{} - _ bin.Decoder = &SearchOutgoingDocumentMessagesRequest{} - _ bin.BareEncoder = &SearchOutgoingDocumentMessagesRequest{} - _ bin.BareDecoder = &SearchOutgoingDocumentMessagesRequest{} -) - -func (s *SearchOutgoingDocumentMessagesRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchOutgoingDocumentMessagesRequest) String() string { - if s == nil { - return "SearchOutgoingDocumentMessagesRequest(nil)" - } - type Alias SearchOutgoingDocumentMessagesRequest - return fmt.Sprintf("SearchOutgoingDocumentMessagesRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchOutgoingDocumentMessagesRequest) TypeID() uint32 { - return SearchOutgoingDocumentMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchOutgoingDocumentMessagesRequest) TypeName() string { - return "searchOutgoingDocumentMessages" -} - -// TypeInfo returns info about TL type. -func (s *SearchOutgoingDocumentMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchOutgoingDocumentMessages", - ID: SearchOutgoingDocumentMessagesRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchOutgoingDocumentMessagesRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchOutgoingDocumentMessages#c023c47e as nil") - } - b.PutID(SearchOutgoingDocumentMessagesRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchOutgoingDocumentMessagesRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchOutgoingDocumentMessages#c023c47e as nil") - } - b.PutString(s.Query) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchOutgoingDocumentMessagesRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchOutgoingDocumentMessages#c023c47e to nil") - } - if err := b.ConsumeID(SearchOutgoingDocumentMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchOutgoingDocumentMessages#c023c47e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchOutgoingDocumentMessagesRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchOutgoingDocumentMessages#c023c47e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchOutgoingDocumentMessages#c023c47e: field query: %w", err) - } - s.Query = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchOutgoingDocumentMessages#c023c47e: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchOutgoingDocumentMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchOutgoingDocumentMessages#c023c47e as nil") - } - b.ObjStart() - b.PutID("searchOutgoingDocumentMessages") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchOutgoingDocumentMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchOutgoingDocumentMessages#c023c47e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchOutgoingDocumentMessages"); err != nil { - return fmt.Errorf("unable to decode searchOutgoingDocumentMessages#c023c47e: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchOutgoingDocumentMessages#c023c47e: field query: %w", err) - } - s.Query = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchOutgoingDocumentMessages#c023c47e: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SearchOutgoingDocumentMessagesRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetLimit returns value of Limit field. -func (s *SearchOutgoingDocumentMessagesRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchOutgoingDocumentMessages invokes method searchOutgoingDocumentMessages#c023c47e returning error if any. -func (c *Client) SearchOutgoingDocumentMessages(ctx context.Context, request *SearchOutgoingDocumentMessagesRequest) (*FoundMessages, error) { - var result FoundMessages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_public_chat_gen.go b/tdapi/tl_search_public_chat_gen.go deleted file mode 100644 index c48484030..000000000 --- a/tdapi/tl_search_public_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchPublicChatRequest represents TL type `searchPublicChat#3316d9ad`. -type SearchPublicChatRequest struct { - // Username to be resolved - Username string -} - -// SearchPublicChatRequestTypeID is TL type id of SearchPublicChatRequest. -const SearchPublicChatRequestTypeID = 0x3316d9ad - -// Ensuring interfaces in compile-time for SearchPublicChatRequest. -var ( - _ bin.Encoder = &SearchPublicChatRequest{} - _ bin.Decoder = &SearchPublicChatRequest{} - _ bin.BareEncoder = &SearchPublicChatRequest{} - _ bin.BareDecoder = &SearchPublicChatRequest{} -) - -func (s *SearchPublicChatRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Username == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchPublicChatRequest) String() string { - if s == nil { - return "SearchPublicChatRequest(nil)" - } - type Alias SearchPublicChatRequest - return fmt.Sprintf("SearchPublicChatRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchPublicChatRequest) TypeID() uint32 { - return SearchPublicChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchPublicChatRequest) TypeName() string { - return "searchPublicChat" -} - -// TypeInfo returns info about TL type. -func (s *SearchPublicChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchPublicChat", - ID: SearchPublicChatRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Username", - SchemaName: "username", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchPublicChatRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicChat#3316d9ad as nil") - } - b.PutID(SearchPublicChatRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchPublicChatRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicChat#3316d9ad as nil") - } - b.PutString(s.Username) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchPublicChatRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicChat#3316d9ad to nil") - } - if err := b.ConsumeID(SearchPublicChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchPublicChat#3316d9ad: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchPublicChatRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicChat#3316d9ad to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicChat#3316d9ad: field username: %w", err) - } - s.Username = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchPublicChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicChat#3316d9ad as nil") - } - b.ObjStart() - b.PutID("searchPublicChat") - b.Comma() - b.FieldStart("username") - b.PutString(s.Username) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchPublicChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicChat#3316d9ad to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchPublicChat"); err != nil { - return fmt.Errorf("unable to decode searchPublicChat#3316d9ad: %w", err) - } - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicChat#3316d9ad: field username: %w", err) - } - s.Username = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUsername returns value of Username field. -func (s *SearchPublicChatRequest) GetUsername() (value string) { - if s == nil { - return - } - return s.Username -} - -// SearchPublicChat invokes method searchPublicChat#3316d9ad returning error if any. -func (c *Client) SearchPublicChat(ctx context.Context, username string) (*Chat, error) { - var result Chat - - request := &SearchPublicChatRequest{ - Username: username, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_public_chats_gen.go b/tdapi/tl_search_public_chats_gen.go deleted file mode 100644 index 097331b9b..000000000 --- a/tdapi/tl_search_public_chats_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchPublicChatsRequest represents TL type `searchPublicChats#39d6e7b9`. -type SearchPublicChatsRequest struct { - // Query to search for - Query string -} - -// SearchPublicChatsRequestTypeID is TL type id of SearchPublicChatsRequest. -const SearchPublicChatsRequestTypeID = 0x39d6e7b9 - -// Ensuring interfaces in compile-time for SearchPublicChatsRequest. -var ( - _ bin.Encoder = &SearchPublicChatsRequest{} - _ bin.Decoder = &SearchPublicChatsRequest{} - _ bin.BareEncoder = &SearchPublicChatsRequest{} - _ bin.BareDecoder = &SearchPublicChatsRequest{} -) - -func (s *SearchPublicChatsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchPublicChatsRequest) String() string { - if s == nil { - return "SearchPublicChatsRequest(nil)" - } - type Alias SearchPublicChatsRequest - return fmt.Sprintf("SearchPublicChatsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchPublicChatsRequest) TypeID() uint32 { - return SearchPublicChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchPublicChatsRequest) TypeName() string { - return "searchPublicChats" -} - -// TypeInfo returns info about TL type. -func (s *SearchPublicChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchPublicChats", - ID: SearchPublicChatsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchPublicChatsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicChats#39d6e7b9 as nil") - } - b.PutID(SearchPublicChatsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchPublicChatsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicChats#39d6e7b9 as nil") - } - b.PutString(s.Query) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchPublicChatsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicChats#39d6e7b9 to nil") - } - if err := b.ConsumeID(SearchPublicChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchPublicChats#39d6e7b9: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchPublicChatsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicChats#39d6e7b9 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicChats#39d6e7b9: field query: %w", err) - } - s.Query = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchPublicChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicChats#39d6e7b9 as nil") - } - b.ObjStart() - b.PutID("searchPublicChats") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchPublicChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicChats#39d6e7b9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchPublicChats"); err != nil { - return fmt.Errorf("unable to decode searchPublicChats#39d6e7b9: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicChats#39d6e7b9: field query: %w", err) - } - s.Query = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SearchPublicChatsRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// SearchPublicChats invokes method searchPublicChats#39d6e7b9 returning error if any. -func (c *Client) SearchPublicChats(ctx context.Context, query string) (*Chats, error) { - var result Chats - - request := &SearchPublicChatsRequest{ - Query: query, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_public_messages_by_tag_gen.go b/tdapi/tl_search_public_messages_by_tag_gen.go deleted file mode 100644 index c57578c86..000000000 --- a/tdapi/tl_search_public_messages_by_tag_gen.go +++ /dev/null @@ -1,274 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchPublicMessagesByTagRequest represents TL type `searchPublicMessagesByTag#25976caa`. -type SearchPublicMessagesByTagRequest struct { - // Hashtag or cashtag to search for - Tag string - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of messages to be returned; up to 100. For optimal performance, the - // number of returned messages is chosen by TDLib and can be smaller than the specified - // limit - Limit int32 -} - -// SearchPublicMessagesByTagRequestTypeID is TL type id of SearchPublicMessagesByTagRequest. -const SearchPublicMessagesByTagRequestTypeID = 0x25976caa - -// Ensuring interfaces in compile-time for SearchPublicMessagesByTagRequest. -var ( - _ bin.Encoder = &SearchPublicMessagesByTagRequest{} - _ bin.Decoder = &SearchPublicMessagesByTagRequest{} - _ bin.BareEncoder = &SearchPublicMessagesByTagRequest{} - _ bin.BareDecoder = &SearchPublicMessagesByTagRequest{} -) - -func (s *SearchPublicMessagesByTagRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Tag == "") { - return false - } - if !(s.Offset == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchPublicMessagesByTagRequest) String() string { - if s == nil { - return "SearchPublicMessagesByTagRequest(nil)" - } - type Alias SearchPublicMessagesByTagRequest - return fmt.Sprintf("SearchPublicMessagesByTagRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchPublicMessagesByTagRequest) TypeID() uint32 { - return SearchPublicMessagesByTagRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchPublicMessagesByTagRequest) TypeName() string { - return "searchPublicMessagesByTag" -} - -// TypeInfo returns info about TL type. -func (s *SearchPublicMessagesByTagRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchPublicMessagesByTag", - ID: SearchPublicMessagesByTagRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Tag", - SchemaName: "tag", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchPublicMessagesByTagRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicMessagesByTag#25976caa as nil") - } - b.PutID(SearchPublicMessagesByTagRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchPublicMessagesByTagRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicMessagesByTag#25976caa as nil") - } - b.PutString(s.Tag) - b.PutString(s.Offset) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchPublicMessagesByTagRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicMessagesByTag#25976caa to nil") - } - if err := b.ConsumeID(SearchPublicMessagesByTagRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchPublicMessagesByTag#25976caa: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchPublicMessagesByTagRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicMessagesByTag#25976caa to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicMessagesByTag#25976caa: field tag: %w", err) - } - s.Tag = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicMessagesByTag#25976caa: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchPublicMessagesByTag#25976caa: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchPublicMessagesByTagRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicMessagesByTag#25976caa as nil") - } - b.ObjStart() - b.PutID("searchPublicMessagesByTag") - b.Comma() - b.FieldStart("tag") - b.PutString(s.Tag) - b.Comma() - b.FieldStart("offset") - b.PutString(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchPublicMessagesByTagRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicMessagesByTag#25976caa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchPublicMessagesByTag"); err != nil { - return fmt.Errorf("unable to decode searchPublicMessagesByTag#25976caa: %w", err) - } - case "tag": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicMessagesByTag#25976caa: field tag: %w", err) - } - s.Tag = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicMessagesByTag#25976caa: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchPublicMessagesByTag#25976caa: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTag returns value of Tag field. -func (s *SearchPublicMessagesByTagRequest) GetTag() (value string) { - if s == nil { - return - } - return s.Tag -} - -// GetOffset returns value of Offset field. -func (s *SearchPublicMessagesByTagRequest) GetOffset() (value string) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchPublicMessagesByTagRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchPublicMessagesByTag invokes method searchPublicMessagesByTag#25976caa returning error if any. -func (c *Client) SearchPublicMessagesByTag(ctx context.Context, request *SearchPublicMessagesByTagRequest) (*FoundMessages, error) { - var result FoundMessages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_public_stories_by_location_gen.go b/tdapi/tl_search_public_stories_by_location_gen.go deleted file mode 100644 index fb5435e82..000000000 --- a/tdapi/tl_search_public_stories_by_location_gen.go +++ /dev/null @@ -1,274 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchPublicStoriesByLocationRequest represents TL type `searchPublicStoriesByLocation#5f2bd988`. -type SearchPublicStoriesByLocationRequest struct { - // Address of the location - Address LocationAddress - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of stories to be returned; up to 100. For optimal performance, the - // number of returned stories is chosen by TDLib and can be smaller than the specified - // limit - Limit int32 -} - -// SearchPublicStoriesByLocationRequestTypeID is TL type id of SearchPublicStoriesByLocationRequest. -const SearchPublicStoriesByLocationRequestTypeID = 0x5f2bd988 - -// Ensuring interfaces in compile-time for SearchPublicStoriesByLocationRequest. -var ( - _ bin.Encoder = &SearchPublicStoriesByLocationRequest{} - _ bin.Decoder = &SearchPublicStoriesByLocationRequest{} - _ bin.BareEncoder = &SearchPublicStoriesByLocationRequest{} - _ bin.BareDecoder = &SearchPublicStoriesByLocationRequest{} -) - -func (s *SearchPublicStoriesByLocationRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Address.Zero()) { - return false - } - if !(s.Offset == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchPublicStoriesByLocationRequest) String() string { - if s == nil { - return "SearchPublicStoriesByLocationRequest(nil)" - } - type Alias SearchPublicStoriesByLocationRequest - return fmt.Sprintf("SearchPublicStoriesByLocationRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchPublicStoriesByLocationRequest) TypeID() uint32 { - return SearchPublicStoriesByLocationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchPublicStoriesByLocationRequest) TypeName() string { - return "searchPublicStoriesByLocation" -} - -// TypeInfo returns info about TL type. -func (s *SearchPublicStoriesByLocationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchPublicStoriesByLocation", - ID: SearchPublicStoriesByLocationRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Address", - SchemaName: "address", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchPublicStoriesByLocationRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicStoriesByLocation#5f2bd988 as nil") - } - b.PutID(SearchPublicStoriesByLocationRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchPublicStoriesByLocationRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicStoriesByLocation#5f2bd988 as nil") - } - if err := s.Address.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchPublicStoriesByLocation#5f2bd988: field address: %w", err) - } - b.PutString(s.Offset) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchPublicStoriesByLocationRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicStoriesByLocation#5f2bd988 to nil") - } - if err := b.ConsumeID(SearchPublicStoriesByLocationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByLocation#5f2bd988: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchPublicStoriesByLocationRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicStoriesByLocation#5f2bd988 to nil") - } - { - if err := s.Address.Decode(b); err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByLocation#5f2bd988: field address: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByLocation#5f2bd988: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByLocation#5f2bd988: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchPublicStoriesByLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicStoriesByLocation#5f2bd988 as nil") - } - b.ObjStart() - b.PutID("searchPublicStoriesByLocation") - b.Comma() - b.FieldStart("address") - if err := s.Address.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchPublicStoriesByLocation#5f2bd988: field address: %w", err) - } - b.Comma() - b.FieldStart("offset") - b.PutString(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchPublicStoriesByLocationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicStoriesByLocation#5f2bd988 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchPublicStoriesByLocation"); err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByLocation#5f2bd988: %w", err) - } - case "address": - if err := s.Address.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByLocation#5f2bd988: field address: %w", err) - } - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByLocation#5f2bd988: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByLocation#5f2bd988: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAddress returns value of Address field. -func (s *SearchPublicStoriesByLocationRequest) GetAddress() (value LocationAddress) { - if s == nil { - return - } - return s.Address -} - -// GetOffset returns value of Offset field. -func (s *SearchPublicStoriesByLocationRequest) GetOffset() (value string) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchPublicStoriesByLocationRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchPublicStoriesByLocation invokes method searchPublicStoriesByLocation#5f2bd988 returning error if any. -func (c *Client) SearchPublicStoriesByLocation(ctx context.Context, request *SearchPublicStoriesByLocationRequest) (*FoundStories, error) { - var result FoundStories - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_public_stories_by_tag_gen.go b/tdapi/tl_search_public_stories_by_tag_gen.go deleted file mode 100644 index 534442e5a..000000000 --- a/tdapi/tl_search_public_stories_by_tag_gen.go +++ /dev/null @@ -1,309 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchPublicStoriesByTagRequest represents TL type `searchPublicStoriesByTag#a2ca6a03`. -type SearchPublicStoriesByTagRequest struct { - // Identifier of the chat that posted the stories to search for; pass 0 to search stories - // in all chats - StorySenderChatID int64 - // Hashtag or cashtag to search for - Tag string - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of stories to be returned; up to 100. For optimal performance, the - // number of returned stories is chosen by TDLib and can be smaller than the specified - // limit - Limit int32 -} - -// SearchPublicStoriesByTagRequestTypeID is TL type id of SearchPublicStoriesByTagRequest. -const SearchPublicStoriesByTagRequestTypeID = 0xa2ca6a03 - -// Ensuring interfaces in compile-time for SearchPublicStoriesByTagRequest. -var ( - _ bin.Encoder = &SearchPublicStoriesByTagRequest{} - _ bin.Decoder = &SearchPublicStoriesByTagRequest{} - _ bin.BareEncoder = &SearchPublicStoriesByTagRequest{} - _ bin.BareDecoder = &SearchPublicStoriesByTagRequest{} -) - -func (s *SearchPublicStoriesByTagRequest) Zero() bool { - if s == nil { - return true - } - if !(s.StorySenderChatID == 0) { - return false - } - if !(s.Tag == "") { - return false - } - if !(s.Offset == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchPublicStoriesByTagRequest) String() string { - if s == nil { - return "SearchPublicStoriesByTagRequest(nil)" - } - type Alias SearchPublicStoriesByTagRequest - return fmt.Sprintf("SearchPublicStoriesByTagRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchPublicStoriesByTagRequest) TypeID() uint32 { - return SearchPublicStoriesByTagRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchPublicStoriesByTagRequest) TypeName() string { - return "searchPublicStoriesByTag" -} - -// TypeInfo returns info about TL type. -func (s *SearchPublicStoriesByTagRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchPublicStoriesByTag", - ID: SearchPublicStoriesByTagRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "Tag", - SchemaName: "tag", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchPublicStoriesByTagRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicStoriesByTag#a2ca6a03 as nil") - } - b.PutID(SearchPublicStoriesByTagRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchPublicStoriesByTagRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicStoriesByTag#a2ca6a03 as nil") - } - b.PutInt53(s.StorySenderChatID) - b.PutString(s.Tag) - b.PutString(s.Offset) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchPublicStoriesByTagRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicStoriesByTag#a2ca6a03 to nil") - } - if err := b.ConsumeID(SearchPublicStoriesByTagRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByTag#a2ca6a03: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchPublicStoriesByTagRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicStoriesByTag#a2ca6a03 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByTag#a2ca6a03: field story_sender_chat_id: %w", err) - } - s.StorySenderChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByTag#a2ca6a03: field tag: %w", err) - } - s.Tag = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByTag#a2ca6a03: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByTag#a2ca6a03: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchPublicStoriesByTagRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicStoriesByTag#a2ca6a03 as nil") - } - b.ObjStart() - b.PutID("searchPublicStoriesByTag") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(s.StorySenderChatID) - b.Comma() - b.FieldStart("tag") - b.PutString(s.Tag) - b.Comma() - b.FieldStart("offset") - b.PutString(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchPublicStoriesByTagRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicStoriesByTag#a2ca6a03 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchPublicStoriesByTag"); err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByTag#a2ca6a03: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByTag#a2ca6a03: field story_sender_chat_id: %w", err) - } - s.StorySenderChatID = value - case "tag": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByTag#a2ca6a03: field tag: %w", err) - } - s.Tag = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByTag#a2ca6a03: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByTag#a2ca6a03: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (s *SearchPublicStoriesByTagRequest) GetStorySenderChatID() (value int64) { - if s == nil { - return - } - return s.StorySenderChatID -} - -// GetTag returns value of Tag field. -func (s *SearchPublicStoriesByTagRequest) GetTag() (value string) { - if s == nil { - return - } - return s.Tag -} - -// GetOffset returns value of Offset field. -func (s *SearchPublicStoriesByTagRequest) GetOffset() (value string) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchPublicStoriesByTagRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchPublicStoriesByTag invokes method searchPublicStoriesByTag#a2ca6a03 returning error if any. -func (c *Client) SearchPublicStoriesByTag(ctx context.Context, request *SearchPublicStoriesByTagRequest) (*FoundStories, error) { - var result FoundStories - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_public_stories_by_venue_gen.go b/tdapi/tl_search_public_stories_by_venue_gen.go deleted file mode 100644 index 184e89085..000000000 --- a/tdapi/tl_search_public_stories_by_venue_gen.go +++ /dev/null @@ -1,308 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchPublicStoriesByVenueRequest represents TL type `searchPublicStoriesByVenue#d71a622a`. -type SearchPublicStoriesByVenueRequest struct { - // Provider of the venue - VenueProvider string - // Identifier of the venue in the provider database - VenueID string - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of stories to be returned; up to 100. For optimal performance, the - // number of returned stories is chosen by TDLib and can be smaller than the specified - // limit - Limit int32 -} - -// SearchPublicStoriesByVenueRequestTypeID is TL type id of SearchPublicStoriesByVenueRequest. -const SearchPublicStoriesByVenueRequestTypeID = 0xd71a622a - -// Ensuring interfaces in compile-time for SearchPublicStoriesByVenueRequest. -var ( - _ bin.Encoder = &SearchPublicStoriesByVenueRequest{} - _ bin.Decoder = &SearchPublicStoriesByVenueRequest{} - _ bin.BareEncoder = &SearchPublicStoriesByVenueRequest{} - _ bin.BareDecoder = &SearchPublicStoriesByVenueRequest{} -) - -func (s *SearchPublicStoriesByVenueRequest) Zero() bool { - if s == nil { - return true - } - if !(s.VenueProvider == "") { - return false - } - if !(s.VenueID == "") { - return false - } - if !(s.Offset == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchPublicStoriesByVenueRequest) String() string { - if s == nil { - return "SearchPublicStoriesByVenueRequest(nil)" - } - type Alias SearchPublicStoriesByVenueRequest - return fmt.Sprintf("SearchPublicStoriesByVenueRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchPublicStoriesByVenueRequest) TypeID() uint32 { - return SearchPublicStoriesByVenueRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchPublicStoriesByVenueRequest) TypeName() string { - return "searchPublicStoriesByVenue" -} - -// TypeInfo returns info about TL type. -func (s *SearchPublicStoriesByVenueRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchPublicStoriesByVenue", - ID: SearchPublicStoriesByVenueRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VenueProvider", - SchemaName: "venue_provider", - }, - { - Name: "VenueID", - SchemaName: "venue_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchPublicStoriesByVenueRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicStoriesByVenue#d71a622a as nil") - } - b.PutID(SearchPublicStoriesByVenueRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchPublicStoriesByVenueRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicStoriesByVenue#d71a622a as nil") - } - b.PutString(s.VenueProvider) - b.PutString(s.VenueID) - b.PutString(s.Offset) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchPublicStoriesByVenueRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicStoriesByVenue#d71a622a to nil") - } - if err := b.ConsumeID(SearchPublicStoriesByVenueRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByVenue#d71a622a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchPublicStoriesByVenueRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicStoriesByVenue#d71a622a to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByVenue#d71a622a: field venue_provider: %w", err) - } - s.VenueProvider = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByVenue#d71a622a: field venue_id: %w", err) - } - s.VenueID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByVenue#d71a622a: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByVenue#d71a622a: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchPublicStoriesByVenueRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchPublicStoriesByVenue#d71a622a as nil") - } - b.ObjStart() - b.PutID("searchPublicStoriesByVenue") - b.Comma() - b.FieldStart("venue_provider") - b.PutString(s.VenueProvider) - b.Comma() - b.FieldStart("venue_id") - b.PutString(s.VenueID) - b.Comma() - b.FieldStart("offset") - b.PutString(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchPublicStoriesByVenueRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchPublicStoriesByVenue#d71a622a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchPublicStoriesByVenue"); err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByVenue#d71a622a: %w", err) - } - case "venue_provider": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByVenue#d71a622a: field venue_provider: %w", err) - } - s.VenueProvider = value - case "venue_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByVenue#d71a622a: field venue_id: %w", err) - } - s.VenueID = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByVenue#d71a622a: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchPublicStoriesByVenue#d71a622a: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVenueProvider returns value of VenueProvider field. -func (s *SearchPublicStoriesByVenueRequest) GetVenueProvider() (value string) { - if s == nil { - return - } - return s.VenueProvider -} - -// GetVenueID returns value of VenueID field. -func (s *SearchPublicStoriesByVenueRequest) GetVenueID() (value string) { - if s == nil { - return - } - return s.VenueID -} - -// GetOffset returns value of Offset field. -func (s *SearchPublicStoriesByVenueRequest) GetOffset() (value string) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchPublicStoriesByVenueRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchPublicStoriesByVenue invokes method searchPublicStoriesByVenue#d71a622a returning error if any. -func (c *Client) SearchPublicStoriesByVenue(ctx context.Context, request *SearchPublicStoriesByVenueRequest) (*FoundStories, error) { - var result FoundStories - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_quote_gen.go b/tdapi/tl_search_quote_gen.go deleted file mode 100644 index db0523069..000000000 --- a/tdapi/tl_search_quote_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchQuoteRequest represents TL type `searchQuote#6864011f`. -type SearchQuoteRequest struct { - // Text in which to search for the quote - Text FormattedText - // Quote to search for - Quote FormattedText - // Approximate quote position in UTF-16 code units - QuotePosition int32 -} - -// SearchQuoteRequestTypeID is TL type id of SearchQuoteRequest. -const SearchQuoteRequestTypeID = 0x6864011f - -// Ensuring interfaces in compile-time for SearchQuoteRequest. -var ( - _ bin.Encoder = &SearchQuoteRequest{} - _ bin.Decoder = &SearchQuoteRequest{} - _ bin.BareEncoder = &SearchQuoteRequest{} - _ bin.BareDecoder = &SearchQuoteRequest{} -) - -func (s *SearchQuoteRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Text.Zero()) { - return false - } - if !(s.Quote.Zero()) { - return false - } - if !(s.QuotePosition == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchQuoteRequest) String() string { - if s == nil { - return "SearchQuoteRequest(nil)" - } - type Alias SearchQuoteRequest - return fmt.Sprintf("SearchQuoteRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchQuoteRequest) TypeID() uint32 { - return SearchQuoteRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchQuoteRequest) TypeName() string { - return "searchQuote" -} - -// TypeInfo returns info about TL type. -func (s *SearchQuoteRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchQuote", - ID: SearchQuoteRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Quote", - SchemaName: "quote", - }, - { - Name: "QuotePosition", - SchemaName: "quote_position", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchQuoteRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchQuote#6864011f as nil") - } - b.PutID(SearchQuoteRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchQuoteRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchQuote#6864011f as nil") - } - if err := s.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchQuote#6864011f: field text: %w", err) - } - if err := s.Quote.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchQuote#6864011f: field quote: %w", err) - } - b.PutInt32(s.QuotePosition) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchQuoteRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchQuote#6864011f to nil") - } - if err := b.ConsumeID(SearchQuoteRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchQuote#6864011f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchQuoteRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchQuote#6864011f to nil") - } - { - if err := s.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode searchQuote#6864011f: field text: %w", err) - } - } - { - if err := s.Quote.Decode(b); err != nil { - return fmt.Errorf("unable to decode searchQuote#6864011f: field quote: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchQuote#6864011f: field quote_position: %w", err) - } - s.QuotePosition = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchQuoteRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchQuote#6864011f as nil") - } - b.ObjStart() - b.PutID("searchQuote") - b.Comma() - b.FieldStart("text") - if err := s.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchQuote#6864011f: field text: %w", err) - } - b.Comma() - b.FieldStart("quote") - if err := s.Quote.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchQuote#6864011f: field quote: %w", err) - } - b.Comma() - b.FieldStart("quote_position") - b.PutInt32(s.QuotePosition) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchQuoteRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchQuote#6864011f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchQuote"); err != nil { - return fmt.Errorf("unable to decode searchQuote#6864011f: %w", err) - } - case "text": - if err := s.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode searchQuote#6864011f: field text: %w", err) - } - case "quote": - if err := s.Quote.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode searchQuote#6864011f: field quote: %w", err) - } - case "quote_position": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchQuote#6864011f: field quote_position: %w", err) - } - s.QuotePosition = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (s *SearchQuoteRequest) GetText() (value FormattedText) { - if s == nil { - return - } - return s.Text -} - -// GetQuote returns value of Quote field. -func (s *SearchQuoteRequest) GetQuote() (value FormattedText) { - if s == nil { - return - } - return s.Quote -} - -// GetQuotePosition returns value of QuotePosition field. -func (s *SearchQuoteRequest) GetQuotePosition() (value int32) { - if s == nil { - return - } - return s.QuotePosition -} - -// SearchQuote invokes method searchQuote#6864011f returning error if any. -func (c *Client) SearchQuote(ctx context.Context, request *SearchQuoteRequest) (*FoundPosition, error) { - var result FoundPosition - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_recently_found_chats_gen.go b/tdapi/tl_search_recently_found_chats_gen.go deleted file mode 100644 index 2d1e8b42b..000000000 --- a/tdapi/tl_search_recently_found_chats_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchRecentlyFoundChatsRequest represents TL type `searchRecentlyFoundChats#62320591`. -type SearchRecentlyFoundChatsRequest struct { - // Query to search for - Query string - // The maximum number of chats to be returned - Limit int32 -} - -// SearchRecentlyFoundChatsRequestTypeID is TL type id of SearchRecentlyFoundChatsRequest. -const SearchRecentlyFoundChatsRequestTypeID = 0x62320591 - -// Ensuring interfaces in compile-time for SearchRecentlyFoundChatsRequest. -var ( - _ bin.Encoder = &SearchRecentlyFoundChatsRequest{} - _ bin.Decoder = &SearchRecentlyFoundChatsRequest{} - _ bin.BareEncoder = &SearchRecentlyFoundChatsRequest{} - _ bin.BareDecoder = &SearchRecentlyFoundChatsRequest{} -) - -func (s *SearchRecentlyFoundChatsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchRecentlyFoundChatsRequest) String() string { - if s == nil { - return "SearchRecentlyFoundChatsRequest(nil)" - } - type Alias SearchRecentlyFoundChatsRequest - return fmt.Sprintf("SearchRecentlyFoundChatsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchRecentlyFoundChatsRequest) TypeID() uint32 { - return SearchRecentlyFoundChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchRecentlyFoundChatsRequest) TypeName() string { - return "searchRecentlyFoundChats" -} - -// TypeInfo returns info about TL type. -func (s *SearchRecentlyFoundChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchRecentlyFoundChats", - ID: SearchRecentlyFoundChatsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchRecentlyFoundChatsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchRecentlyFoundChats#62320591 as nil") - } - b.PutID(SearchRecentlyFoundChatsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchRecentlyFoundChatsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchRecentlyFoundChats#62320591 as nil") - } - b.PutString(s.Query) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchRecentlyFoundChatsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchRecentlyFoundChats#62320591 to nil") - } - if err := b.ConsumeID(SearchRecentlyFoundChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchRecentlyFoundChats#62320591: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchRecentlyFoundChatsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchRecentlyFoundChats#62320591 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchRecentlyFoundChats#62320591: field query: %w", err) - } - s.Query = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchRecentlyFoundChats#62320591: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchRecentlyFoundChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchRecentlyFoundChats#62320591 as nil") - } - b.ObjStart() - b.PutID("searchRecentlyFoundChats") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchRecentlyFoundChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchRecentlyFoundChats#62320591 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchRecentlyFoundChats"); err != nil { - return fmt.Errorf("unable to decode searchRecentlyFoundChats#62320591: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchRecentlyFoundChats#62320591: field query: %w", err) - } - s.Query = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchRecentlyFoundChats#62320591: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SearchRecentlyFoundChatsRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetLimit returns value of Limit field. -func (s *SearchRecentlyFoundChatsRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchRecentlyFoundChats invokes method searchRecentlyFoundChats#62320591 returning error if any. -func (c *Client) SearchRecentlyFoundChats(ctx context.Context, request *SearchRecentlyFoundChatsRequest) (*Chats, error) { - var result Chats - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_saved_messages_gen.go b/tdapi/tl_search_saved_messages_gen.go deleted file mode 100644 index 84c5a6654..000000000 --- a/tdapi/tl_search_saved_messages_gen.go +++ /dev/null @@ -1,387 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchSavedMessagesRequest represents TL type `searchSavedMessages#8a9b9f96`. -type SearchSavedMessagesRequest struct { - // If not 0, only messages in the specified Saved Messages topic will be considered; pass - // 0 to consider all messages - SavedMessagesTopicID int64 - // Tag to search for; pass null to return all suitable messages - Tag ReactionTypeClass - // Query to search for - Query string - // Identifier of the message starting from which messages must be fetched; use 0 to get - // results from the last message - FromMessageID int64 - // Specify 0 to get results from exactly the message from_message_id or a negative offset - // to get the specified message and some newer messages - Offset int32 - // The maximum number of messages to be returned; must be positive and can't be greater - // than 100. If the offset is negative, the limit must be greater than -offset. - Limit int32 -} - -// SearchSavedMessagesRequestTypeID is TL type id of SearchSavedMessagesRequest. -const SearchSavedMessagesRequestTypeID = 0x8a9b9f96 - -// Ensuring interfaces in compile-time for SearchSavedMessagesRequest. -var ( - _ bin.Encoder = &SearchSavedMessagesRequest{} - _ bin.Decoder = &SearchSavedMessagesRequest{} - _ bin.BareEncoder = &SearchSavedMessagesRequest{} - _ bin.BareDecoder = &SearchSavedMessagesRequest{} -) - -func (s *SearchSavedMessagesRequest) Zero() bool { - if s == nil { - return true - } - if !(s.SavedMessagesTopicID == 0) { - return false - } - if !(s.Tag == nil) { - return false - } - if !(s.Query == "") { - return false - } - if !(s.FromMessageID == 0) { - return false - } - if !(s.Offset == 0) { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchSavedMessagesRequest) String() string { - if s == nil { - return "SearchSavedMessagesRequest(nil)" - } - type Alias SearchSavedMessagesRequest - return fmt.Sprintf("SearchSavedMessagesRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchSavedMessagesRequest) TypeID() uint32 { - return SearchSavedMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchSavedMessagesRequest) TypeName() string { - return "searchSavedMessages" -} - -// TypeInfo returns info about TL type. -func (s *SearchSavedMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchSavedMessages", - ID: SearchSavedMessagesRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - { - Name: "Tag", - SchemaName: "tag", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "FromMessageID", - SchemaName: "from_message_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchSavedMessagesRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchSavedMessages#8a9b9f96 as nil") - } - b.PutID(SearchSavedMessagesRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchSavedMessagesRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchSavedMessages#8a9b9f96 as nil") - } - b.PutInt53(s.SavedMessagesTopicID) - if s.Tag == nil { - return fmt.Errorf("unable to encode searchSavedMessages#8a9b9f96: field tag is nil") - } - if err := s.Tag.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchSavedMessages#8a9b9f96: field tag: %w", err) - } - b.PutString(s.Query) - b.PutInt53(s.FromMessageID) - b.PutInt32(s.Offset) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchSavedMessagesRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchSavedMessages#8a9b9f96 to nil") - } - if err := b.ConsumeID(SearchSavedMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchSavedMessagesRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchSavedMessages#8a9b9f96 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field saved_messages_topic_id: %w", err) - } - s.SavedMessagesTopicID = value - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field tag: %w", err) - } - s.Tag = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field query: %w", err) - } - s.Query = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field from_message_id: %w", err) - } - s.FromMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchSavedMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchSavedMessages#8a9b9f96 as nil") - } - b.ObjStart() - b.PutID("searchSavedMessages") - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(s.SavedMessagesTopicID) - b.Comma() - b.FieldStart("tag") - if s.Tag == nil { - return fmt.Errorf("unable to encode searchSavedMessages#8a9b9f96: field tag is nil") - } - if err := s.Tag.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchSavedMessages#8a9b9f96: field tag: %w", err) - } - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("from_message_id") - b.PutInt53(s.FromMessageID) - b.Comma() - b.FieldStart("offset") - b.PutInt32(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchSavedMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchSavedMessages#8a9b9f96 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchSavedMessages"); err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: %w", err) - } - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field saved_messages_topic_id: %w", err) - } - s.SavedMessagesTopicID = value - case "tag": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field tag: %w", err) - } - s.Tag = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field query: %w", err) - } - s.Query = value - case "from_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field from_message_id: %w", err) - } - s.FromMessageID = value - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchSavedMessages#8a9b9f96: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (s *SearchSavedMessagesRequest) GetSavedMessagesTopicID() (value int64) { - if s == nil { - return - } - return s.SavedMessagesTopicID -} - -// GetTag returns value of Tag field. -func (s *SearchSavedMessagesRequest) GetTag() (value ReactionTypeClass) { - if s == nil { - return - } - return s.Tag -} - -// GetQuery returns value of Query field. -func (s *SearchSavedMessagesRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetFromMessageID returns value of FromMessageID field. -func (s *SearchSavedMessagesRequest) GetFromMessageID() (value int64) { - if s == nil { - return - } - return s.FromMessageID -} - -// GetOffset returns value of Offset field. -func (s *SearchSavedMessagesRequest) GetOffset() (value int32) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchSavedMessagesRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchSavedMessages invokes method searchSavedMessages#8a9b9f96 returning error if any. -func (c *Client) SearchSavedMessages(ctx context.Context, request *SearchSavedMessagesRequest) (*FoundChatMessages, error) { - var result FoundChatMessages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_secret_messages_gen.go b/tdapi/tl_search_secret_messages_gen.go deleted file mode 100644 index 33a14a47d..000000000 --- a/tdapi/tl_search_secret_messages_gen.go +++ /dev/null @@ -1,352 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchSecretMessagesRequest represents TL type `searchSecretMessages#cd2a4c9c`. -type SearchSecretMessagesRequest struct { - // Identifier of the chat in which to search. Specify 0 to search in all secret chats - ChatID int64 - // Query to search for. If empty, searchChatMessages must be used instead - Query string - // Offset of the first entry to return as received from the previous request; use empty - // string to get the first chunk of results - Offset string - // The maximum number of messages to be returned; up to 100. For optimal performance, the - // number of returned messages is chosen by TDLib and can be smaller than the specified - // limit - Limit int32 - // Additional filter for messages to search; pass null to search for all messages - Filter SearchMessagesFilterClass -} - -// SearchSecretMessagesRequestTypeID is TL type id of SearchSecretMessagesRequest. -const SearchSecretMessagesRequestTypeID = 0xcd2a4c9c - -// Ensuring interfaces in compile-time for SearchSecretMessagesRequest. -var ( - _ bin.Encoder = &SearchSecretMessagesRequest{} - _ bin.Decoder = &SearchSecretMessagesRequest{} - _ bin.BareEncoder = &SearchSecretMessagesRequest{} - _ bin.BareDecoder = &SearchSecretMessagesRequest{} -) - -func (s *SearchSecretMessagesRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Query == "") { - return false - } - if !(s.Offset == "") { - return false - } - if !(s.Limit == 0) { - return false - } - if !(s.Filter == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchSecretMessagesRequest) String() string { - if s == nil { - return "SearchSecretMessagesRequest(nil)" - } - type Alias SearchSecretMessagesRequest - return fmt.Sprintf("SearchSecretMessagesRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchSecretMessagesRequest) TypeID() uint32 { - return SearchSecretMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchSecretMessagesRequest) TypeName() string { - return "searchSecretMessages" -} - -// TypeInfo returns info about TL type. -func (s *SearchSecretMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchSecretMessages", - ID: SearchSecretMessagesRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - { - Name: "Filter", - SchemaName: "filter", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchSecretMessagesRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchSecretMessages#cd2a4c9c as nil") - } - b.PutID(SearchSecretMessagesRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchSecretMessagesRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchSecretMessages#cd2a4c9c as nil") - } - b.PutInt53(s.ChatID) - b.PutString(s.Query) - b.PutString(s.Offset) - b.PutInt32(s.Limit) - if s.Filter == nil { - return fmt.Errorf("unable to encode searchSecretMessages#cd2a4c9c: field filter is nil") - } - if err := s.Filter.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchSecretMessages#cd2a4c9c: field filter: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchSecretMessagesRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchSecretMessages#cd2a4c9c to nil") - } - if err := b.ConsumeID(SearchSecretMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchSecretMessagesRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchSecretMessages#cd2a4c9c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: field query: %w", err) - } - s.Query = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: field limit: %w", err) - } - s.Limit = value - } - { - value, err := DecodeSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: field filter: %w", err) - } - s.Filter = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchSecretMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchSecretMessages#cd2a4c9c as nil") - } - b.ObjStart() - b.PutID("searchSecretMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("offset") - b.PutString(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.FieldStart("filter") - if s.Filter == nil { - return fmt.Errorf("unable to encode searchSecretMessages#cd2a4c9c: field filter is nil") - } - if err := s.Filter.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchSecretMessages#cd2a4c9c: field filter: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchSecretMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchSecretMessages#cd2a4c9c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchSecretMessages"); err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: field chat_id: %w", err) - } - s.ChatID = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: field query: %w", err) - } - s.Query = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: field limit: %w", err) - } - s.Limit = value - case "filter": - value, err := DecodeTDLibJSONSearchMessagesFilter(b) - if err != nil { - return fmt.Errorf("unable to decode searchSecretMessages#cd2a4c9c: field filter: %w", err) - } - s.Filter = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SearchSecretMessagesRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetQuery returns value of Query field. -func (s *SearchSecretMessagesRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetOffset returns value of Offset field. -func (s *SearchSecretMessagesRequest) GetOffset() (value string) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchSecretMessagesRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// GetFilter returns value of Filter field. -func (s *SearchSecretMessagesRequest) GetFilter() (value SearchMessagesFilterClass) { - if s == nil { - return - } - return s.Filter -} - -// SearchSecretMessages invokes method searchSecretMessages#cd2a4c9c returning error if any. -func (c *Client) SearchSecretMessages(ctx context.Context, request *SearchSecretMessagesRequest) (*FoundMessages, error) { - var result FoundMessages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_sticker_set_gen.go b/tdapi/tl_search_sticker_set_gen.go deleted file mode 100644 index 7a72d535f..000000000 --- a/tdapi/tl_search_sticker_set_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchStickerSetRequest represents TL type `searchStickerSet#63eec702`. -type SearchStickerSetRequest struct { - // Name of the sticker set - Name string - // Pass true to ignore local cache of sticker sets and always send a network request - IgnoreCache bool -} - -// SearchStickerSetRequestTypeID is TL type id of SearchStickerSetRequest. -const SearchStickerSetRequestTypeID = 0x63eec702 - -// Ensuring interfaces in compile-time for SearchStickerSetRequest. -var ( - _ bin.Encoder = &SearchStickerSetRequest{} - _ bin.Decoder = &SearchStickerSetRequest{} - _ bin.BareEncoder = &SearchStickerSetRequest{} - _ bin.BareDecoder = &SearchStickerSetRequest{} -) - -func (s *SearchStickerSetRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Name == "") { - return false - } - if !(s.IgnoreCache == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchStickerSetRequest) String() string { - if s == nil { - return "SearchStickerSetRequest(nil)" - } - type Alias SearchStickerSetRequest - return fmt.Sprintf("SearchStickerSetRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchStickerSetRequest) TypeID() uint32 { - return SearchStickerSetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchStickerSetRequest) TypeName() string { - return "searchStickerSet" -} - -// TypeInfo returns info about TL type. -func (s *SearchStickerSetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchStickerSet", - ID: SearchStickerSetRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "IgnoreCache", - SchemaName: "ignore_cache", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchStickerSetRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchStickerSet#63eec702 as nil") - } - b.PutID(SearchStickerSetRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchStickerSetRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchStickerSet#63eec702 as nil") - } - b.PutString(s.Name) - b.PutBool(s.IgnoreCache) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchStickerSetRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchStickerSet#63eec702 to nil") - } - if err := b.ConsumeID(SearchStickerSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchStickerSet#63eec702: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchStickerSetRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchStickerSet#63eec702 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStickerSet#63eec702: field name: %w", err) - } - s.Name = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchStickerSet#63eec702: field ignore_cache: %w", err) - } - s.IgnoreCache = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchStickerSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchStickerSet#63eec702 as nil") - } - b.ObjStart() - b.PutID("searchStickerSet") - b.Comma() - b.FieldStart("name") - b.PutString(s.Name) - b.Comma() - b.FieldStart("ignore_cache") - b.PutBool(s.IgnoreCache) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchStickerSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchStickerSet#63eec702 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchStickerSet"); err != nil { - return fmt.Errorf("unable to decode searchStickerSet#63eec702: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStickerSet#63eec702: field name: %w", err) - } - s.Name = value - case "ignore_cache": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchStickerSet#63eec702: field ignore_cache: %w", err) - } - s.IgnoreCache = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (s *SearchStickerSetRequest) GetName() (value string) { - if s == nil { - return - } - return s.Name -} - -// GetIgnoreCache returns value of IgnoreCache field. -func (s *SearchStickerSetRequest) GetIgnoreCache() (value bool) { - if s == nil { - return - } - return s.IgnoreCache -} - -// SearchStickerSet invokes method searchStickerSet#63eec702 returning error if any. -func (c *Client) SearchStickerSet(ctx context.Context, request *SearchStickerSetRequest) (*StickerSet, error) { - var result StickerSet - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_sticker_sets_gen.go b/tdapi/tl_search_sticker_sets_gen.go deleted file mode 100644 index 0823e4207..000000000 --- a/tdapi/tl_search_sticker_sets_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchStickerSetsRequest represents TL type `searchStickerSets#faa066c`. -type SearchStickerSetsRequest struct { - // Type of the sticker sets to return - StickerType StickerTypeClass - // Query to search for - Query string -} - -// SearchStickerSetsRequestTypeID is TL type id of SearchStickerSetsRequest. -const SearchStickerSetsRequestTypeID = 0xfaa066c - -// Ensuring interfaces in compile-time for SearchStickerSetsRequest. -var ( - _ bin.Encoder = &SearchStickerSetsRequest{} - _ bin.Decoder = &SearchStickerSetsRequest{} - _ bin.BareEncoder = &SearchStickerSetsRequest{} - _ bin.BareDecoder = &SearchStickerSetsRequest{} -) - -func (s *SearchStickerSetsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.StickerType == nil) { - return false - } - if !(s.Query == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchStickerSetsRequest) String() string { - if s == nil { - return "SearchStickerSetsRequest(nil)" - } - type Alias SearchStickerSetsRequest - return fmt.Sprintf("SearchStickerSetsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchStickerSetsRequest) TypeID() uint32 { - return SearchStickerSetsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchStickerSetsRequest) TypeName() string { - return "searchStickerSets" -} - -// TypeInfo returns info about TL type. -func (s *SearchStickerSetsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchStickerSets", - ID: SearchStickerSetsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "Query", - SchemaName: "query", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchStickerSetsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchStickerSets#faa066c as nil") - } - b.PutID(SearchStickerSetsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchStickerSetsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchStickerSets#faa066c as nil") - } - if s.StickerType == nil { - return fmt.Errorf("unable to encode searchStickerSets#faa066c: field sticker_type is nil") - } - if err := s.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchStickerSets#faa066c: field sticker_type: %w", err) - } - b.PutString(s.Query) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchStickerSetsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchStickerSets#faa066c to nil") - } - if err := b.ConsumeID(SearchStickerSetsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchStickerSets#faa066c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchStickerSetsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchStickerSets#faa066c to nil") - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode searchStickerSets#faa066c: field sticker_type: %w", err) - } - s.StickerType = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStickerSets#faa066c: field query: %w", err) - } - s.Query = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchStickerSets#faa066c as nil") - } - b.ObjStart() - b.PutID("searchStickerSets") - b.Comma() - b.FieldStart("sticker_type") - if s.StickerType == nil { - return fmt.Errorf("unable to encode searchStickerSets#faa066c: field sticker_type is nil") - } - if err := s.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchStickerSets#faa066c: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchStickerSets#faa066c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchStickerSets"); err != nil { - return fmt.Errorf("unable to decode searchStickerSets#faa066c: %w", err) - } - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode searchStickerSets#faa066c: field sticker_type: %w", err) - } - s.StickerType = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStickerSets#faa066c: field query: %w", err) - } - s.Query = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerType returns value of StickerType field. -func (s *SearchStickerSetsRequest) GetStickerType() (value StickerTypeClass) { - if s == nil { - return - } - return s.StickerType -} - -// GetQuery returns value of Query field. -func (s *SearchStickerSetsRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// SearchStickerSets invokes method searchStickerSets#faa066c returning error if any. -func (c *Client) SearchStickerSets(ctx context.Context, request *SearchStickerSetsRequest) (*StickerSets, error) { - var result StickerSets - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_stickers_gen.go b/tdapi/tl_search_stickers_gen.go deleted file mode 100644 index d96a5a71e..000000000 --- a/tdapi/tl_search_stickers_gen.go +++ /dev/null @@ -1,408 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchStickersRequest represents TL type `searchStickers#66428c3a`. -type SearchStickersRequest struct { - // Type of the stickers to return - StickerType StickerTypeClass - // Space-separated list of emojis to search for - Emojis string - // Query to search for; may be empty to search for emoji only - Query string - // List of possible IETF language tags of the user's input language; may be empty if - // unknown - InputLanguageCodes []string - // The offset from which to return the stickers; must be non-negative - Offset int32 - // The maximum number of stickers to be returned; 0-100 - Limit int32 -} - -// SearchStickersRequestTypeID is TL type id of SearchStickersRequest. -const SearchStickersRequestTypeID = 0x66428c3a - -// Ensuring interfaces in compile-time for SearchStickersRequest. -var ( - _ bin.Encoder = &SearchStickersRequest{} - _ bin.Decoder = &SearchStickersRequest{} - _ bin.BareEncoder = &SearchStickersRequest{} - _ bin.BareDecoder = &SearchStickersRequest{} -) - -func (s *SearchStickersRequest) Zero() bool { - if s == nil { - return true - } - if !(s.StickerType == nil) { - return false - } - if !(s.Emojis == "") { - return false - } - if !(s.Query == "") { - return false - } - if !(s.InputLanguageCodes == nil) { - return false - } - if !(s.Offset == 0) { - return false - } - if !(s.Limit == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchStickersRequest) String() string { - if s == nil { - return "SearchStickersRequest(nil)" - } - type Alias SearchStickersRequest - return fmt.Sprintf("SearchStickersRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchStickersRequest) TypeID() uint32 { - return SearchStickersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchStickersRequest) TypeName() string { - return "searchStickers" -} - -// TypeInfo returns info about TL type. -func (s *SearchStickersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchStickers", - ID: SearchStickersRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "Emojis", - SchemaName: "emojis", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "InputLanguageCodes", - SchemaName: "input_language_codes", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchStickersRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchStickers#66428c3a as nil") - } - b.PutID(SearchStickersRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchStickersRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchStickers#66428c3a as nil") - } - if s.StickerType == nil { - return fmt.Errorf("unable to encode searchStickers#66428c3a: field sticker_type is nil") - } - if err := s.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode searchStickers#66428c3a: field sticker_type: %w", err) - } - b.PutString(s.Emojis) - b.PutString(s.Query) - b.PutInt(len(s.InputLanguageCodes)) - for _, v := range s.InputLanguageCodes { - b.PutString(v) - } - b.PutInt32(s.Offset) - b.PutInt32(s.Limit) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchStickersRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchStickers#66428c3a to nil") - } - if err := b.ConsumeID(SearchStickersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchStickersRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchStickers#66428c3a to nil") - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field sticker_type: %w", err) - } - s.StickerType = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field emojis: %w", err) - } - s.Emojis = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field query: %w", err) - } - s.Query = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field input_language_codes: %w", err) - } - - if headerLen > 0 { - s.InputLanguageCodes = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field input_language_codes: %w", err) - } - s.InputLanguageCodes = append(s.InputLanguageCodes, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field offset: %w", err) - } - s.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field limit: %w", err) - } - s.Limit = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchStickersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchStickers#66428c3a as nil") - } - b.ObjStart() - b.PutID("searchStickers") - b.Comma() - b.FieldStart("sticker_type") - if s.StickerType == nil { - return fmt.Errorf("unable to encode searchStickers#66428c3a: field sticker_type is nil") - } - if err := s.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode searchStickers#66428c3a: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("emojis") - b.PutString(s.Emojis) - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("input_language_codes") - b.ArrStart() - for _, v := range s.InputLanguageCodes { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("offset") - b.PutInt32(s.Offset) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchStickersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchStickers#66428c3a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchStickers"); err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: %w", err) - } - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field sticker_type: %w", err) - } - s.StickerType = value - case "emojis": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field emojis: %w", err) - } - s.Emojis = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field query: %w", err) - } - s.Query = value - case "input_language_codes": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field input_language_codes: %w", err) - } - s.InputLanguageCodes = append(s.InputLanguageCodes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field input_language_codes: %w", err) - } - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field offset: %w", err) - } - s.Offset = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchStickers#66428c3a: field limit: %w", err) - } - s.Limit = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerType returns value of StickerType field. -func (s *SearchStickersRequest) GetStickerType() (value StickerTypeClass) { - if s == nil { - return - } - return s.StickerType -} - -// GetEmojis returns value of Emojis field. -func (s *SearchStickersRequest) GetEmojis() (value string) { - if s == nil { - return - } - return s.Emojis -} - -// GetQuery returns value of Query field. -func (s *SearchStickersRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetInputLanguageCodes returns value of InputLanguageCodes field. -func (s *SearchStickersRequest) GetInputLanguageCodes() (value []string) { - if s == nil { - return - } - return s.InputLanguageCodes -} - -// GetOffset returns value of Offset field. -func (s *SearchStickersRequest) GetOffset() (value int32) { - if s == nil { - return - } - return s.Offset -} - -// GetLimit returns value of Limit field. -func (s *SearchStickersRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// SearchStickers invokes method searchStickers#66428c3a returning error if any. -func (c *Client) SearchStickers(ctx context.Context, request *SearchStickersRequest) (*Stickers, error) { - var result Stickers - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_strings_by_prefix_gen.go b/tdapi/tl_search_strings_by_prefix_gen.go deleted file mode 100644 index 9731eee6c..000000000 --- a/tdapi/tl_search_strings_by_prefix_gen.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchStringsByPrefixRequest represents TL type `searchStringsByPrefix#a8145813`. -type SearchStringsByPrefixRequest struct { - // The strings to search in for the query - Strings []string - // Query to search for - Query string - // The maximum number of objects to return - Limit int32 - // Pass true to receive no results for an empty query - ReturnNoneForEmptyQuery bool -} - -// SearchStringsByPrefixRequestTypeID is TL type id of SearchStringsByPrefixRequest. -const SearchStringsByPrefixRequestTypeID = 0xa8145813 - -// Ensuring interfaces in compile-time for SearchStringsByPrefixRequest. -var ( - _ bin.Encoder = &SearchStringsByPrefixRequest{} - _ bin.Decoder = &SearchStringsByPrefixRequest{} - _ bin.BareEncoder = &SearchStringsByPrefixRequest{} - _ bin.BareDecoder = &SearchStringsByPrefixRequest{} -) - -func (s *SearchStringsByPrefixRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Strings == nil) { - return false - } - if !(s.Query == "") { - return false - } - if !(s.Limit == 0) { - return false - } - if !(s.ReturnNoneForEmptyQuery == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchStringsByPrefixRequest) String() string { - if s == nil { - return "SearchStringsByPrefixRequest(nil)" - } - type Alias SearchStringsByPrefixRequest - return fmt.Sprintf("SearchStringsByPrefixRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchStringsByPrefixRequest) TypeID() uint32 { - return SearchStringsByPrefixRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchStringsByPrefixRequest) TypeName() string { - return "searchStringsByPrefix" -} - -// TypeInfo returns info about TL type. -func (s *SearchStringsByPrefixRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchStringsByPrefix", - ID: SearchStringsByPrefixRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Strings", - SchemaName: "strings", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Limit", - SchemaName: "limit", - }, - { - Name: "ReturnNoneForEmptyQuery", - SchemaName: "return_none_for_empty_query", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchStringsByPrefixRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchStringsByPrefix#a8145813 as nil") - } - b.PutID(SearchStringsByPrefixRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchStringsByPrefixRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchStringsByPrefix#a8145813 as nil") - } - b.PutInt(len(s.Strings)) - for _, v := range s.Strings { - b.PutString(v) - } - b.PutString(s.Query) - b.PutInt32(s.Limit) - b.PutBool(s.ReturnNoneForEmptyQuery) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchStringsByPrefixRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchStringsByPrefix#a8145813 to nil") - } - if err := b.ConsumeID(SearchStringsByPrefixRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchStringsByPrefixRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchStringsByPrefix#a8145813 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: field strings: %w", err) - } - - if headerLen > 0 { - s.Strings = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: field strings: %w", err) - } - s.Strings = append(s.Strings, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: field query: %w", err) - } - s.Query = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: field limit: %w", err) - } - s.Limit = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: field return_none_for_empty_query: %w", err) - } - s.ReturnNoneForEmptyQuery = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchStringsByPrefixRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchStringsByPrefix#a8145813 as nil") - } - b.ObjStart() - b.PutID("searchStringsByPrefix") - b.Comma() - b.FieldStart("strings") - b.ArrStart() - for _, v := range s.Strings { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("limit") - b.PutInt32(s.Limit) - b.Comma() - b.FieldStart("return_none_for_empty_query") - b.PutBool(s.ReturnNoneForEmptyQuery) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchStringsByPrefixRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchStringsByPrefix#a8145813 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchStringsByPrefix"); err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: %w", err) - } - case "strings": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: field strings: %w", err) - } - s.Strings = append(s.Strings, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: field strings: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: field query: %w", err) - } - s.Query = value - case "limit": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: field limit: %w", err) - } - s.Limit = value - case "return_none_for_empty_query": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchStringsByPrefix#a8145813: field return_none_for_empty_query: %w", err) - } - s.ReturnNoneForEmptyQuery = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStrings returns value of Strings field. -func (s *SearchStringsByPrefixRequest) GetStrings() (value []string) { - if s == nil { - return - } - return s.Strings -} - -// GetQuery returns value of Query field. -func (s *SearchStringsByPrefixRequest) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetLimit returns value of Limit field. -func (s *SearchStringsByPrefixRequest) GetLimit() (value int32) { - if s == nil { - return - } - return s.Limit -} - -// GetReturnNoneForEmptyQuery returns value of ReturnNoneForEmptyQuery field. -func (s *SearchStringsByPrefixRequest) GetReturnNoneForEmptyQuery() (value bool) { - if s == nil { - return - } - return s.ReturnNoneForEmptyQuery -} - -// SearchStringsByPrefix invokes method searchStringsByPrefix#a8145813 returning error if any. -func (c *Client) SearchStringsByPrefix(ctx context.Context, request *SearchStringsByPrefixRequest) (*FoundPositions, error) { - var result FoundPositions - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_user_by_phone_number_gen.go b/tdapi/tl_search_user_by_phone_number_gen.go deleted file mode 100644 index 26e83d446..000000000 --- a/tdapi/tl_search_user_by_phone_number_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchUserByPhoneNumberRequest represents TL type `searchUserByPhoneNumber#eb82adc8`. -type SearchUserByPhoneNumberRequest struct { - // Phone number to search for - PhoneNumber string - // Pass true to get only locally available information without sending network requests - OnlyLocal bool -} - -// SearchUserByPhoneNumberRequestTypeID is TL type id of SearchUserByPhoneNumberRequest. -const SearchUserByPhoneNumberRequestTypeID = 0xeb82adc8 - -// Ensuring interfaces in compile-time for SearchUserByPhoneNumberRequest. -var ( - _ bin.Encoder = &SearchUserByPhoneNumberRequest{} - _ bin.Decoder = &SearchUserByPhoneNumberRequest{} - _ bin.BareEncoder = &SearchUserByPhoneNumberRequest{} - _ bin.BareDecoder = &SearchUserByPhoneNumberRequest{} -) - -func (s *SearchUserByPhoneNumberRequest) Zero() bool { - if s == nil { - return true - } - if !(s.PhoneNumber == "") { - return false - } - if !(s.OnlyLocal == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchUserByPhoneNumberRequest) String() string { - if s == nil { - return "SearchUserByPhoneNumberRequest(nil)" - } - type Alias SearchUserByPhoneNumberRequest - return fmt.Sprintf("SearchUserByPhoneNumberRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchUserByPhoneNumberRequest) TypeID() uint32 { - return SearchUserByPhoneNumberRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchUserByPhoneNumberRequest) TypeName() string { - return "searchUserByPhoneNumber" -} - -// TypeInfo returns info about TL type. -func (s *SearchUserByPhoneNumberRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchUserByPhoneNumber", - ID: SearchUserByPhoneNumberRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - { - Name: "OnlyLocal", - SchemaName: "only_local", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchUserByPhoneNumberRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchUserByPhoneNumber#eb82adc8 as nil") - } - b.PutID(SearchUserByPhoneNumberRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchUserByPhoneNumberRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchUserByPhoneNumber#eb82adc8 as nil") - } - b.PutString(s.PhoneNumber) - b.PutBool(s.OnlyLocal) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchUserByPhoneNumberRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchUserByPhoneNumber#eb82adc8 to nil") - } - if err := b.ConsumeID(SearchUserByPhoneNumberRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchUserByPhoneNumber#eb82adc8: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchUserByPhoneNumberRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchUserByPhoneNumber#eb82adc8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchUserByPhoneNumber#eb82adc8: field phone_number: %w", err) - } - s.PhoneNumber = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchUserByPhoneNumber#eb82adc8: field only_local: %w", err) - } - s.OnlyLocal = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchUserByPhoneNumberRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchUserByPhoneNumber#eb82adc8 as nil") - } - b.ObjStart() - b.PutID("searchUserByPhoneNumber") - b.Comma() - b.FieldStart("phone_number") - b.PutString(s.PhoneNumber) - b.Comma() - b.FieldStart("only_local") - b.PutBool(s.OnlyLocal) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchUserByPhoneNumberRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchUserByPhoneNumber#eb82adc8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchUserByPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode searchUserByPhoneNumber#eb82adc8: %w", err) - } - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchUserByPhoneNumber#eb82adc8: field phone_number: %w", err) - } - s.PhoneNumber = value - case "only_local": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode searchUserByPhoneNumber#eb82adc8: field only_local: %w", err) - } - s.OnlyLocal = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (s *SearchUserByPhoneNumberRequest) GetPhoneNumber() (value string) { - if s == nil { - return - } - return s.PhoneNumber -} - -// GetOnlyLocal returns value of OnlyLocal field. -func (s *SearchUserByPhoneNumberRequest) GetOnlyLocal() (value bool) { - if s == nil { - return - } - return s.OnlyLocal -} - -// SearchUserByPhoneNumber invokes method searchUserByPhoneNumber#eb82adc8 returning error if any. -func (c *Client) SearchUserByPhoneNumber(ctx context.Context, request *SearchUserByPhoneNumberRequest) (*User, error) { - var result User - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_user_by_token_gen.go b/tdapi/tl_search_user_by_token_gen.go deleted file mode 100644 index 931752b57..000000000 --- a/tdapi/tl_search_user_by_token_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchUserByTokenRequest represents TL type `searchUserByToken#d841f436`. -type SearchUserByTokenRequest struct { - // Token to search for - Token string -} - -// SearchUserByTokenRequestTypeID is TL type id of SearchUserByTokenRequest. -const SearchUserByTokenRequestTypeID = 0xd841f436 - -// Ensuring interfaces in compile-time for SearchUserByTokenRequest. -var ( - _ bin.Encoder = &SearchUserByTokenRequest{} - _ bin.Decoder = &SearchUserByTokenRequest{} - _ bin.BareEncoder = &SearchUserByTokenRequest{} - _ bin.BareDecoder = &SearchUserByTokenRequest{} -) - -func (s *SearchUserByTokenRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Token == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchUserByTokenRequest) String() string { - if s == nil { - return "SearchUserByTokenRequest(nil)" - } - type Alias SearchUserByTokenRequest - return fmt.Sprintf("SearchUserByTokenRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchUserByTokenRequest) TypeID() uint32 { - return SearchUserByTokenRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchUserByTokenRequest) TypeName() string { - return "searchUserByToken" -} - -// TypeInfo returns info about TL type. -func (s *SearchUserByTokenRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchUserByToken", - ID: SearchUserByTokenRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchUserByTokenRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchUserByToken#d841f436 as nil") - } - b.PutID(SearchUserByTokenRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchUserByTokenRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchUserByToken#d841f436 as nil") - } - b.PutString(s.Token) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchUserByTokenRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchUserByToken#d841f436 to nil") - } - if err := b.ConsumeID(SearchUserByTokenRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchUserByToken#d841f436: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchUserByTokenRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchUserByToken#d841f436 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchUserByToken#d841f436: field token: %w", err) - } - s.Token = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchUserByTokenRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchUserByToken#d841f436 as nil") - } - b.ObjStart() - b.PutID("searchUserByToken") - b.Comma() - b.FieldStart("token") - b.PutString(s.Token) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchUserByTokenRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchUserByToken#d841f436 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchUserByToken"); err != nil { - return fmt.Errorf("unable to decode searchUserByToken#d841f436: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchUserByToken#d841f436: field token: %w", err) - } - s.Token = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (s *SearchUserByTokenRequest) GetToken() (value string) { - if s == nil { - return - } - return s.Token -} - -// SearchUserByToken invokes method searchUserByToken#d841f436 returning error if any. -func (c *Client) SearchUserByToken(ctx context.Context, token string) (*User, error) { - var result User - - request := &SearchUserByTokenRequest{ - Token: token, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_search_web_app_gen.go b/tdapi/tl_search_web_app_gen.go deleted file mode 100644 index 595fe121b..000000000 --- a/tdapi/tl_search_web_app_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SearchWebAppRequest represents TL type `searchWebApp#b5fc8a35`. -type SearchWebAppRequest struct { - // Identifier of the target bot - BotUserID int64 - // Short name of the Web App - WebAppShortName string -} - -// SearchWebAppRequestTypeID is TL type id of SearchWebAppRequest. -const SearchWebAppRequestTypeID = 0xb5fc8a35 - -// Ensuring interfaces in compile-time for SearchWebAppRequest. -var ( - _ bin.Encoder = &SearchWebAppRequest{} - _ bin.Decoder = &SearchWebAppRequest{} - _ bin.BareEncoder = &SearchWebAppRequest{} - _ bin.BareDecoder = &SearchWebAppRequest{} -) - -func (s *SearchWebAppRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BotUserID == 0) { - return false - } - if !(s.WebAppShortName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SearchWebAppRequest) String() string { - if s == nil { - return "SearchWebAppRequest(nil)" - } - type Alias SearchWebAppRequest - return fmt.Sprintf("SearchWebAppRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SearchWebAppRequest) TypeID() uint32 { - return SearchWebAppRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SearchWebAppRequest) TypeName() string { - return "searchWebApp" -} - -// TypeInfo returns info about TL type. -func (s *SearchWebAppRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "searchWebApp", - ID: SearchWebAppRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "WebAppShortName", - SchemaName: "web_app_short_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SearchWebAppRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchWebApp#b5fc8a35 as nil") - } - b.PutID(SearchWebAppRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SearchWebAppRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode searchWebApp#b5fc8a35 as nil") - } - b.PutInt53(s.BotUserID) - b.PutString(s.WebAppShortName) - return nil -} - -// Decode implements bin.Decoder. -func (s *SearchWebAppRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchWebApp#b5fc8a35 to nil") - } - if err := b.ConsumeID(SearchWebAppRequestTypeID); err != nil { - return fmt.Errorf("unable to decode searchWebApp#b5fc8a35: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SearchWebAppRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode searchWebApp#b5fc8a35 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchWebApp#b5fc8a35: field bot_user_id: %w", err) - } - s.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchWebApp#b5fc8a35: field web_app_short_name: %w", err) - } - s.WebAppShortName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SearchWebAppRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode searchWebApp#b5fc8a35 as nil") - } - b.ObjStart() - b.PutID("searchWebApp") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(s.BotUserID) - b.Comma() - b.FieldStart("web_app_short_name") - b.PutString(s.WebAppShortName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SearchWebAppRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode searchWebApp#b5fc8a35 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("searchWebApp"); err != nil { - return fmt.Errorf("unable to decode searchWebApp#b5fc8a35: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode searchWebApp#b5fc8a35: field bot_user_id: %w", err) - } - s.BotUserID = value - case "web_app_short_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode searchWebApp#b5fc8a35: field web_app_short_name: %w", err) - } - s.WebAppShortName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (s *SearchWebAppRequest) GetBotUserID() (value int64) { - if s == nil { - return - } - return s.BotUserID -} - -// GetWebAppShortName returns value of WebAppShortName field. -func (s *SearchWebAppRequest) GetWebAppShortName() (value string) { - if s == nil { - return - } - return s.WebAppShortName -} - -// SearchWebApp invokes method searchWebApp#b5fc8a35 returning error if any. -func (c *Client) SearchWebApp(ctx context.Context, request *SearchWebAppRequest) (*FoundWebApp, error) { - var result FoundWebApp - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_seconds_gen.go b/tdapi/tl_seconds_gen.go deleted file mode 100644 index d1d0352cc..000000000 --- a/tdapi/tl_seconds_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Seconds represents TL type `seconds#3936e58e`. -type Seconds struct { - // Number of seconds - Seconds float64 -} - -// SecondsTypeID is TL type id of Seconds. -const SecondsTypeID = 0x3936e58e - -// Ensuring interfaces in compile-time for Seconds. -var ( - _ bin.Encoder = &Seconds{} - _ bin.Decoder = &Seconds{} - _ bin.BareEncoder = &Seconds{} - _ bin.BareDecoder = &Seconds{} -) - -func (s *Seconds) Zero() bool { - if s == nil { - return true - } - if !(s.Seconds == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *Seconds) String() string { - if s == nil { - return "Seconds(nil)" - } - type Alias Seconds - return fmt.Sprintf("Seconds%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Seconds) TypeID() uint32 { - return SecondsTypeID -} - -// TypeName returns name of type in TL schema. -func (*Seconds) TypeName() string { - return "seconds" -} - -// TypeInfo returns info about TL type. -func (s *Seconds) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "seconds", - ID: SecondsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Seconds", - SchemaName: "seconds", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *Seconds) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode seconds#3936e58e as nil") - } - b.PutID(SecondsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *Seconds) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode seconds#3936e58e as nil") - } - b.PutDouble(s.Seconds) - return nil -} - -// Decode implements bin.Decoder. -func (s *Seconds) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode seconds#3936e58e to nil") - } - if err := b.ConsumeID(SecondsTypeID); err != nil { - return fmt.Errorf("unable to decode seconds#3936e58e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *Seconds) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode seconds#3936e58e to nil") - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode seconds#3936e58e: field seconds: %w", err) - } - s.Seconds = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *Seconds) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode seconds#3936e58e as nil") - } - b.ObjStart() - b.PutID("seconds") - b.Comma() - b.FieldStart("seconds") - b.PutDouble(s.Seconds) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *Seconds) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode seconds#3936e58e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("seconds"); err != nil { - return fmt.Errorf("unable to decode seconds#3936e58e: %w", err) - } - case "seconds": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode seconds#3936e58e: field seconds: %w", err) - } - s.Seconds = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSeconds returns value of Seconds field. -func (s *Seconds) GetSeconds() (value float64) { - if s == nil { - return - } - return s.Seconds -} diff --git a/tdapi/tl_secret_chat_gen.go b/tdapi/tl_secret_chat_gen.go deleted file mode 100644 index 0d921111c..000000000 --- a/tdapi/tl_secret_chat_gen.go +++ /dev/null @@ -1,377 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SecretChat represents TL type `secretChat#d7a70bcb`. -type SecretChat struct { - // Secret chat identifier - ID int32 - // Identifier of the chat partner - UserID int64 - // State of the secret chat - State SecretChatStateClass - // True, if the chat was created by the current user; false otherwise - IsOutbound bool - // Hash of the currently used key for comparison with the hash of the chat partner's key. - // This is a string of 36 little-endian bytes, which must be split into groups of 2 bits, - // each denoting a pixel of one of 4 colors FFFFFF, D5E6F3, 2D5775, and 2F99C9. - KeyHash []byte - // Secret chat layer; determines features supported by the chat partner's application. - // Nested text entities and underline and strikethrough entities are supported if the - // layer >= 101, - Layer int32 -} - -// SecretChatTypeID is TL type id of SecretChat. -const SecretChatTypeID = 0xd7a70bcb - -// Ensuring interfaces in compile-time for SecretChat. -var ( - _ bin.Encoder = &SecretChat{} - _ bin.Decoder = &SecretChat{} - _ bin.BareEncoder = &SecretChat{} - _ bin.BareDecoder = &SecretChat{} -) - -func (s *SecretChat) Zero() bool { - if s == nil { - return true - } - if !(s.ID == 0) { - return false - } - if !(s.UserID == 0) { - return false - } - if !(s.State == nil) { - return false - } - if !(s.IsOutbound == false) { - return false - } - if !(s.KeyHash == nil) { - return false - } - if !(s.Layer == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SecretChat) String() string { - if s == nil { - return "SecretChat(nil)" - } - type Alias SecretChat - return fmt.Sprintf("SecretChat%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SecretChat) TypeID() uint32 { - return SecretChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*SecretChat) TypeName() string { - return "secretChat" -} - -// TypeInfo returns info about TL type. -func (s *SecretChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "secretChat", - ID: SecretChatTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "State", - SchemaName: "state", - }, - { - Name: "IsOutbound", - SchemaName: "is_outbound", - }, - { - Name: "KeyHash", - SchemaName: "key_hash", - }, - { - Name: "Layer", - SchemaName: "layer", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SecretChat) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode secretChat#d7a70bcb as nil") - } - b.PutID(SecretChatTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SecretChat) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode secretChat#d7a70bcb as nil") - } - b.PutInt32(s.ID) - b.PutInt53(s.UserID) - if s.State == nil { - return fmt.Errorf("unable to encode secretChat#d7a70bcb: field state is nil") - } - if err := s.State.Encode(b); err != nil { - return fmt.Errorf("unable to encode secretChat#d7a70bcb: field state: %w", err) - } - b.PutBool(s.IsOutbound) - b.PutBytes(s.KeyHash) - b.PutInt32(s.Layer) - return nil -} - -// Decode implements bin.Decoder. -func (s *SecretChat) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode secretChat#d7a70bcb to nil") - } - if err := b.ConsumeID(SecretChatTypeID); err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SecretChat) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode secretChat#d7a70bcb to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field id: %w", err) - } - s.ID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := DecodeSecretChatState(b) - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field state: %w", err) - } - s.State = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field is_outbound: %w", err) - } - s.IsOutbound = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field key_hash: %w", err) - } - s.KeyHash = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field layer: %w", err) - } - s.Layer = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SecretChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode secretChat#d7a70bcb as nil") - } - b.ObjStart() - b.PutID("secretChat") - b.Comma() - b.FieldStart("id") - b.PutInt32(s.ID) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("state") - if s.State == nil { - return fmt.Errorf("unable to encode secretChat#d7a70bcb: field state is nil") - } - if err := s.State.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode secretChat#d7a70bcb: field state: %w", err) - } - b.Comma() - b.FieldStart("is_outbound") - b.PutBool(s.IsOutbound) - b.Comma() - b.FieldStart("key_hash") - b.PutBytes(s.KeyHash) - b.Comma() - b.FieldStart("layer") - b.PutInt32(s.Layer) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SecretChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode secretChat#d7a70bcb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("secretChat"); err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field id: %w", err) - } - s.ID = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field user_id: %w", err) - } - s.UserID = value - case "state": - value, err := DecodeTDLibJSONSecretChatState(b) - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field state: %w", err) - } - s.State = value - case "is_outbound": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field is_outbound: %w", err) - } - s.IsOutbound = value - case "key_hash": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field key_hash: %w", err) - } - s.KeyHash = value - case "layer": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode secretChat#d7a70bcb: field layer: %w", err) - } - s.Layer = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *SecretChat) GetID() (value int32) { - if s == nil { - return - } - return s.ID -} - -// GetUserID returns value of UserID field. -func (s *SecretChat) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetState returns value of State field. -func (s *SecretChat) GetState() (value SecretChatStateClass) { - if s == nil { - return - } - return s.State -} - -// GetIsOutbound returns value of IsOutbound field. -func (s *SecretChat) GetIsOutbound() (value bool) { - if s == nil { - return - } - return s.IsOutbound -} - -// GetKeyHash returns value of KeyHash field. -func (s *SecretChat) GetKeyHash() (value []byte) { - if s == nil { - return - } - return s.KeyHash -} - -// GetLayer returns value of Layer field. -func (s *SecretChat) GetLayer() (value int32) { - if s == nil { - return - } - return s.Layer -} diff --git a/tdapi/tl_secret_chat_state_gen.go b/tdapi/tl_secret_chat_state_gen.go deleted file mode 100644 index 435721672..000000000 --- a/tdapi/tl_secret_chat_state_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SecretChatStatePending represents TL type `secretChatStatePending#9e6c967c`. -type SecretChatStatePending struct { -} - -// SecretChatStatePendingTypeID is TL type id of SecretChatStatePending. -const SecretChatStatePendingTypeID = 0x9e6c967c - -// construct implements constructor of SecretChatStateClass. -func (s SecretChatStatePending) construct() SecretChatStateClass { return &s } - -// Ensuring interfaces in compile-time for SecretChatStatePending. -var ( - _ bin.Encoder = &SecretChatStatePending{} - _ bin.Decoder = &SecretChatStatePending{} - _ bin.BareEncoder = &SecretChatStatePending{} - _ bin.BareDecoder = &SecretChatStatePending{} - - _ SecretChatStateClass = &SecretChatStatePending{} -) - -func (s *SecretChatStatePending) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SecretChatStatePending) String() string { - if s == nil { - return "SecretChatStatePending(nil)" - } - type Alias SecretChatStatePending - return fmt.Sprintf("SecretChatStatePending%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SecretChatStatePending) TypeID() uint32 { - return SecretChatStatePendingTypeID -} - -// TypeName returns name of type in TL schema. -func (*SecretChatStatePending) TypeName() string { - return "secretChatStatePending" -} - -// TypeInfo returns info about TL type. -func (s *SecretChatStatePending) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "secretChatStatePending", - ID: SecretChatStatePendingTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SecretChatStatePending) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode secretChatStatePending#9e6c967c as nil") - } - b.PutID(SecretChatStatePendingTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SecretChatStatePending) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode secretChatStatePending#9e6c967c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SecretChatStatePending) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode secretChatStatePending#9e6c967c to nil") - } - if err := b.ConsumeID(SecretChatStatePendingTypeID); err != nil { - return fmt.Errorf("unable to decode secretChatStatePending#9e6c967c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SecretChatStatePending) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode secretChatStatePending#9e6c967c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SecretChatStatePending) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode secretChatStatePending#9e6c967c as nil") - } - b.ObjStart() - b.PutID("secretChatStatePending") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SecretChatStatePending) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode secretChatStatePending#9e6c967c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("secretChatStatePending"); err != nil { - return fmt.Errorf("unable to decode secretChatStatePending#9e6c967c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SecretChatStateReady represents TL type `secretChatStateReady#9ff4b7e9`. -type SecretChatStateReady struct { -} - -// SecretChatStateReadyTypeID is TL type id of SecretChatStateReady. -const SecretChatStateReadyTypeID = 0x9ff4b7e9 - -// construct implements constructor of SecretChatStateClass. -func (s SecretChatStateReady) construct() SecretChatStateClass { return &s } - -// Ensuring interfaces in compile-time for SecretChatStateReady. -var ( - _ bin.Encoder = &SecretChatStateReady{} - _ bin.Decoder = &SecretChatStateReady{} - _ bin.BareEncoder = &SecretChatStateReady{} - _ bin.BareDecoder = &SecretChatStateReady{} - - _ SecretChatStateClass = &SecretChatStateReady{} -) - -func (s *SecretChatStateReady) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SecretChatStateReady) String() string { - if s == nil { - return "SecretChatStateReady(nil)" - } - type Alias SecretChatStateReady - return fmt.Sprintf("SecretChatStateReady%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SecretChatStateReady) TypeID() uint32 { - return SecretChatStateReadyTypeID -} - -// TypeName returns name of type in TL schema. -func (*SecretChatStateReady) TypeName() string { - return "secretChatStateReady" -} - -// TypeInfo returns info about TL type. -func (s *SecretChatStateReady) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "secretChatStateReady", - ID: SecretChatStateReadyTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SecretChatStateReady) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode secretChatStateReady#9ff4b7e9 as nil") - } - b.PutID(SecretChatStateReadyTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SecretChatStateReady) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode secretChatStateReady#9ff4b7e9 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SecretChatStateReady) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode secretChatStateReady#9ff4b7e9 to nil") - } - if err := b.ConsumeID(SecretChatStateReadyTypeID); err != nil { - return fmt.Errorf("unable to decode secretChatStateReady#9ff4b7e9: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SecretChatStateReady) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode secretChatStateReady#9ff4b7e9 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SecretChatStateReady) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode secretChatStateReady#9ff4b7e9 as nil") - } - b.ObjStart() - b.PutID("secretChatStateReady") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SecretChatStateReady) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode secretChatStateReady#9ff4b7e9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("secretChatStateReady"); err != nil { - return fmt.Errorf("unable to decode secretChatStateReady#9ff4b7e9: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SecretChatStateClosed represents TL type `secretChatStateClosed#8c1006ed`. -type SecretChatStateClosed struct { -} - -// SecretChatStateClosedTypeID is TL type id of SecretChatStateClosed. -const SecretChatStateClosedTypeID = 0x8c1006ed - -// construct implements constructor of SecretChatStateClass. -func (s SecretChatStateClosed) construct() SecretChatStateClass { return &s } - -// Ensuring interfaces in compile-time for SecretChatStateClosed. -var ( - _ bin.Encoder = &SecretChatStateClosed{} - _ bin.Decoder = &SecretChatStateClosed{} - _ bin.BareEncoder = &SecretChatStateClosed{} - _ bin.BareDecoder = &SecretChatStateClosed{} - - _ SecretChatStateClass = &SecretChatStateClosed{} -) - -func (s *SecretChatStateClosed) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SecretChatStateClosed) String() string { - if s == nil { - return "SecretChatStateClosed(nil)" - } - type Alias SecretChatStateClosed - return fmt.Sprintf("SecretChatStateClosed%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SecretChatStateClosed) TypeID() uint32 { - return SecretChatStateClosedTypeID -} - -// TypeName returns name of type in TL schema. -func (*SecretChatStateClosed) TypeName() string { - return "secretChatStateClosed" -} - -// TypeInfo returns info about TL type. -func (s *SecretChatStateClosed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "secretChatStateClosed", - ID: SecretChatStateClosedTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SecretChatStateClosed) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode secretChatStateClosed#8c1006ed as nil") - } - b.PutID(SecretChatStateClosedTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SecretChatStateClosed) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode secretChatStateClosed#8c1006ed as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SecretChatStateClosed) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode secretChatStateClosed#8c1006ed to nil") - } - if err := b.ConsumeID(SecretChatStateClosedTypeID); err != nil { - return fmt.Errorf("unable to decode secretChatStateClosed#8c1006ed: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SecretChatStateClosed) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode secretChatStateClosed#8c1006ed to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SecretChatStateClosed) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode secretChatStateClosed#8c1006ed as nil") - } - b.ObjStart() - b.PutID("secretChatStateClosed") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SecretChatStateClosed) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode secretChatStateClosed#8c1006ed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("secretChatStateClosed"); err != nil { - return fmt.Errorf("unable to decode secretChatStateClosed#8c1006ed: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SecretChatStateClassName is schema name of SecretChatStateClass. -const SecretChatStateClassName = "SecretChatState" - -// SecretChatStateClass represents SecretChatState generic type. -// -// Example: -// -// g, err := tdapi.DecodeSecretChatState(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.SecretChatStatePending: // secretChatStatePending#9e6c967c -// case *tdapi.SecretChatStateReady: // secretChatStateReady#9ff4b7e9 -// case *tdapi.SecretChatStateClosed: // secretChatStateClosed#8c1006ed -// default: panic(v) -// } -type SecretChatStateClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() SecretChatStateClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeSecretChatState implements binary de-serialization for SecretChatStateClass. -func DecodeSecretChatState(buf *bin.Buffer) (SecretChatStateClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case SecretChatStatePendingTypeID: - // Decoding secretChatStatePending#9e6c967c. - v := SecretChatStatePending{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SecretChatStateClass: %w", err) - } - return &v, nil - case SecretChatStateReadyTypeID: - // Decoding secretChatStateReady#9ff4b7e9. - v := SecretChatStateReady{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SecretChatStateClass: %w", err) - } - return &v, nil - case SecretChatStateClosedTypeID: - // Decoding secretChatStateClosed#8c1006ed. - v := SecretChatStateClosed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SecretChatStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SecretChatStateClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONSecretChatState implements binary de-serialization for SecretChatStateClass. -func DecodeTDLibJSONSecretChatState(buf tdjson.Decoder) (SecretChatStateClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "secretChatStatePending": - // Decoding secretChatStatePending#9e6c967c. - v := SecretChatStatePending{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SecretChatStateClass: %w", err) - } - return &v, nil - case "secretChatStateReady": - // Decoding secretChatStateReady#9ff4b7e9. - v := SecretChatStateReady{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SecretChatStateClass: %w", err) - } - return &v, nil - case "secretChatStateClosed": - // Decoding secretChatStateClosed#8c1006ed. - v := SecretChatStateClosed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SecretChatStateClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SecretChatStateClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// SecretChatState boxes the SecretChatStateClass providing a helper. -type SecretChatStateBox struct { - SecretChatState SecretChatStateClass -} - -// Decode implements bin.Decoder for SecretChatStateBox. -func (b *SecretChatStateBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode SecretChatStateBox to nil") - } - v, err := DecodeSecretChatState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SecretChatState = v - return nil -} - -// Encode implements bin.Encode for SecretChatStateBox. -func (b *SecretChatStateBox) Encode(buf *bin.Buffer) error { - if b == nil || b.SecretChatState == nil { - return fmt.Errorf("unable to encode SecretChatStateClass as nil") - } - return b.SecretChatState.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for SecretChatStateBox. -func (b *SecretChatStateBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode SecretChatStateBox to nil") - } - v, err := DecodeTDLibJSONSecretChatState(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SecretChatState = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for SecretChatStateBox. -func (b *SecretChatStateBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.SecretChatState == nil { - return fmt.Errorf("unable to encode SecretChatStateClass as nil") - } - return b.SecretChatState.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_sell_gift_gen.go b/tdapi/tl_sell_gift_gen.go deleted file mode 100644 index aff2beee9..000000000 --- a/tdapi/tl_sell_gift_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SellGiftRequest represents TL type `sellGift#671b88b4`. -type SellGiftRequest struct { - // Identifier of the user that sent the gift - SenderUserID int64 - // Identifier of the message with the gift in the chat with the user - MessageID int64 -} - -// SellGiftRequestTypeID is TL type id of SellGiftRequest. -const SellGiftRequestTypeID = 0x671b88b4 - -// Ensuring interfaces in compile-time for SellGiftRequest. -var ( - _ bin.Encoder = &SellGiftRequest{} - _ bin.Decoder = &SellGiftRequest{} - _ bin.BareEncoder = &SellGiftRequest{} - _ bin.BareDecoder = &SellGiftRequest{} -) - -func (s *SellGiftRequest) Zero() bool { - if s == nil { - return true - } - if !(s.SenderUserID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SellGiftRequest) String() string { - if s == nil { - return "SellGiftRequest(nil)" - } - type Alias SellGiftRequest - return fmt.Sprintf("SellGiftRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SellGiftRequest) TypeID() uint32 { - return SellGiftRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SellGiftRequest) TypeName() string { - return "sellGift" -} - -// TypeInfo returns info about TL type. -func (s *SellGiftRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sellGift", - ID: SellGiftRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SellGiftRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sellGift#671b88b4 as nil") - } - b.PutID(SellGiftRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SellGiftRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sellGift#671b88b4 as nil") - } - b.PutInt53(s.SenderUserID) - b.PutInt53(s.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SellGiftRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sellGift#671b88b4 to nil") - } - if err := b.ConsumeID(SellGiftRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sellGift#671b88b4: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SellGiftRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sellGift#671b88b4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sellGift#671b88b4: field sender_user_id: %w", err) - } - s.SenderUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sellGift#671b88b4: field message_id: %w", err) - } - s.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SellGiftRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sellGift#671b88b4 as nil") - } - b.ObjStart() - b.PutID("sellGift") - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(s.SenderUserID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SellGiftRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sellGift#671b88b4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sellGift"); err != nil { - return fmt.Errorf("unable to decode sellGift#671b88b4: %w", err) - } - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sellGift#671b88b4: field sender_user_id: %w", err) - } - s.SenderUserID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sellGift#671b88b4: field message_id: %w", err) - } - s.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderUserID returns value of SenderUserID field. -func (s *SellGiftRequest) GetSenderUserID() (value int64) { - if s == nil { - return - } - return s.SenderUserID -} - -// GetMessageID returns value of MessageID field. -func (s *SellGiftRequest) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// SellGift invokes method sellGift#671b88b4 returning error if any. -func (c *Client) SellGift(ctx context.Context, request *SellGiftRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_send_authentication_firebase_sms_gen.go b/tdapi/tl_send_authentication_firebase_sms_gen.go deleted file mode 100644 index b82556465..000000000 --- a/tdapi/tl_send_authentication_firebase_sms_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendAuthenticationFirebaseSMSRequest represents TL type `sendAuthenticationFirebaseSms#15c15e3f`. -type SendAuthenticationFirebaseSMSRequest struct { - // Play Integrity API or SafetyNet Attestation API token for the Android application, or - // secret from push notification for the iOS application - Token string -} - -// SendAuthenticationFirebaseSMSRequestTypeID is TL type id of SendAuthenticationFirebaseSMSRequest. -const SendAuthenticationFirebaseSMSRequestTypeID = 0x15c15e3f - -// Ensuring interfaces in compile-time for SendAuthenticationFirebaseSMSRequest. -var ( - _ bin.Encoder = &SendAuthenticationFirebaseSMSRequest{} - _ bin.Decoder = &SendAuthenticationFirebaseSMSRequest{} - _ bin.BareEncoder = &SendAuthenticationFirebaseSMSRequest{} - _ bin.BareDecoder = &SendAuthenticationFirebaseSMSRequest{} -) - -func (s *SendAuthenticationFirebaseSMSRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Token == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendAuthenticationFirebaseSMSRequest) String() string { - if s == nil { - return "SendAuthenticationFirebaseSMSRequest(nil)" - } - type Alias SendAuthenticationFirebaseSMSRequest - return fmt.Sprintf("SendAuthenticationFirebaseSMSRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendAuthenticationFirebaseSMSRequest) TypeID() uint32 { - return SendAuthenticationFirebaseSMSRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendAuthenticationFirebaseSMSRequest) TypeName() string { - return "sendAuthenticationFirebaseSms" -} - -// TypeInfo returns info about TL type. -func (s *SendAuthenticationFirebaseSMSRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendAuthenticationFirebaseSms", - ID: SendAuthenticationFirebaseSMSRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendAuthenticationFirebaseSMSRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendAuthenticationFirebaseSms#15c15e3f as nil") - } - b.PutID(SendAuthenticationFirebaseSMSRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendAuthenticationFirebaseSMSRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendAuthenticationFirebaseSms#15c15e3f as nil") - } - b.PutString(s.Token) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendAuthenticationFirebaseSMSRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendAuthenticationFirebaseSms#15c15e3f to nil") - } - if err := b.ConsumeID(SendAuthenticationFirebaseSMSRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendAuthenticationFirebaseSms#15c15e3f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendAuthenticationFirebaseSMSRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendAuthenticationFirebaseSms#15c15e3f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendAuthenticationFirebaseSms#15c15e3f: field token: %w", err) - } - s.Token = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendAuthenticationFirebaseSMSRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendAuthenticationFirebaseSms#15c15e3f as nil") - } - b.ObjStart() - b.PutID("sendAuthenticationFirebaseSms") - b.Comma() - b.FieldStart("token") - b.PutString(s.Token) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendAuthenticationFirebaseSMSRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendAuthenticationFirebaseSms#15c15e3f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendAuthenticationFirebaseSms"); err != nil { - return fmt.Errorf("unable to decode sendAuthenticationFirebaseSms#15c15e3f: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendAuthenticationFirebaseSms#15c15e3f: field token: %w", err) - } - s.Token = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (s *SendAuthenticationFirebaseSMSRequest) GetToken() (value string) { - if s == nil { - return - } - return s.Token -} - -// SendAuthenticationFirebaseSMS invokes method sendAuthenticationFirebaseSms#15c15e3f returning error if any. -func (c *Client) SendAuthenticationFirebaseSMS(ctx context.Context, token string) error { - var ok Ok - - request := &SendAuthenticationFirebaseSMSRequest{ - Token: token, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_send_bot_start_message_gen.go b/tdapi/tl_send_bot_start_message_gen.go deleted file mode 100644 index 707138aa1..000000000 --- a/tdapi/tl_send_bot_start_message_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendBotStartMessageRequest represents TL type `sendBotStartMessage#aa6a3eee`. -type SendBotStartMessageRequest struct { - // Identifier of the bot - BotUserID int64 - // Identifier of the target chat - ChatID int64 - // A hidden parameter sent to the bot for deep linking purposes (https://core.telegram - // org/bots#deep-linking) - Parameter string -} - -// SendBotStartMessageRequestTypeID is TL type id of SendBotStartMessageRequest. -const SendBotStartMessageRequestTypeID = 0xaa6a3eee - -// Ensuring interfaces in compile-time for SendBotStartMessageRequest. -var ( - _ bin.Encoder = &SendBotStartMessageRequest{} - _ bin.Decoder = &SendBotStartMessageRequest{} - _ bin.BareEncoder = &SendBotStartMessageRequest{} - _ bin.BareDecoder = &SendBotStartMessageRequest{} -) - -func (s *SendBotStartMessageRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BotUserID == 0) { - return false - } - if !(s.ChatID == 0) { - return false - } - if !(s.Parameter == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendBotStartMessageRequest) String() string { - if s == nil { - return "SendBotStartMessageRequest(nil)" - } - type Alias SendBotStartMessageRequest - return fmt.Sprintf("SendBotStartMessageRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendBotStartMessageRequest) TypeID() uint32 { - return SendBotStartMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendBotStartMessageRequest) TypeName() string { - return "sendBotStartMessage" -} - -// TypeInfo returns info about TL type. -func (s *SendBotStartMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendBotStartMessage", - ID: SendBotStartMessageRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Parameter", - SchemaName: "parameter", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendBotStartMessageRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendBotStartMessage#aa6a3eee as nil") - } - b.PutID(SendBotStartMessageRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendBotStartMessageRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendBotStartMessage#aa6a3eee as nil") - } - b.PutInt53(s.BotUserID) - b.PutInt53(s.ChatID) - b.PutString(s.Parameter) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendBotStartMessageRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendBotStartMessage#aa6a3eee to nil") - } - if err := b.ConsumeID(SendBotStartMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendBotStartMessage#aa6a3eee: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendBotStartMessageRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendBotStartMessage#aa6a3eee to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendBotStartMessage#aa6a3eee: field bot_user_id: %w", err) - } - s.BotUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendBotStartMessage#aa6a3eee: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendBotStartMessage#aa6a3eee: field parameter: %w", err) - } - s.Parameter = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendBotStartMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendBotStartMessage#aa6a3eee as nil") - } - b.ObjStart() - b.PutID("sendBotStartMessage") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(s.BotUserID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("parameter") - b.PutString(s.Parameter) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendBotStartMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendBotStartMessage#aa6a3eee to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendBotStartMessage"); err != nil { - return fmt.Errorf("unable to decode sendBotStartMessage#aa6a3eee: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendBotStartMessage#aa6a3eee: field bot_user_id: %w", err) - } - s.BotUserID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendBotStartMessage#aa6a3eee: field chat_id: %w", err) - } - s.ChatID = value - case "parameter": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendBotStartMessage#aa6a3eee: field parameter: %w", err) - } - s.Parameter = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (s *SendBotStartMessageRequest) GetBotUserID() (value int64) { - if s == nil { - return - } - return s.BotUserID -} - -// GetChatID returns value of ChatID field. -func (s *SendBotStartMessageRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetParameter returns value of Parameter field. -func (s *SendBotStartMessageRequest) GetParameter() (value string) { - if s == nil { - return - } - return s.Parameter -} - -// SendBotStartMessage invokes method sendBotStartMessage#aa6a3eee returning error if any. -func (c *Client) SendBotStartMessage(ctx context.Context, request *SendBotStartMessageRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_business_message_album_gen.go b/tdapi/tl_send_business_message_album_gen.go deleted file mode 100644 index 958d75eff..000000000 --- a/tdapi/tl_send_business_message_album_gen.go +++ /dev/null @@ -1,452 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendBusinessMessageAlbumRequest represents TL type `sendBusinessMessageAlbum#70bd4e6f`. -type SendBusinessMessageAlbumRequest struct { - // Unique identifier of business connection on behalf of which to send the request - BusinessConnectionID string - // Target chat - ChatID int64 - // Information about the message to be replied; pass null if none - ReplyTo InputMessageReplyToClass - // Pass true to disable notification for the message - DisableNotification bool - // Pass true if the content of the message must be protected from forwarding and saving - ProtectContent bool - // Identifier of the effect to apply to the message - EffectID int64 - // Contents of messages to be sent. At most 10 messages can be added to an album. All - // messages must have the same value of show_caption_above_media - InputMessageContents []InputMessageContentClass -} - -// SendBusinessMessageAlbumRequestTypeID is TL type id of SendBusinessMessageAlbumRequest. -const SendBusinessMessageAlbumRequestTypeID = 0x70bd4e6f - -// Ensuring interfaces in compile-time for SendBusinessMessageAlbumRequest. -var ( - _ bin.Encoder = &SendBusinessMessageAlbumRequest{} - _ bin.Decoder = &SendBusinessMessageAlbumRequest{} - _ bin.BareEncoder = &SendBusinessMessageAlbumRequest{} - _ bin.BareDecoder = &SendBusinessMessageAlbumRequest{} -) - -func (s *SendBusinessMessageAlbumRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BusinessConnectionID == "") { - return false - } - if !(s.ChatID == 0) { - return false - } - if !(s.ReplyTo == nil) { - return false - } - if !(s.DisableNotification == false) { - return false - } - if !(s.ProtectContent == false) { - return false - } - if !(s.EffectID == 0) { - return false - } - if !(s.InputMessageContents == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendBusinessMessageAlbumRequest) String() string { - if s == nil { - return "SendBusinessMessageAlbumRequest(nil)" - } - type Alias SendBusinessMessageAlbumRequest - return fmt.Sprintf("SendBusinessMessageAlbumRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendBusinessMessageAlbumRequest) TypeID() uint32 { - return SendBusinessMessageAlbumRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendBusinessMessageAlbumRequest) TypeName() string { - return "sendBusinessMessageAlbum" -} - -// TypeInfo returns info about TL type. -func (s *SendBusinessMessageAlbumRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendBusinessMessageAlbum", - ID: SendBusinessMessageAlbumRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BusinessConnectionID", - SchemaName: "business_connection_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ReplyTo", - SchemaName: "reply_to", - }, - { - Name: "DisableNotification", - SchemaName: "disable_notification", - }, - { - Name: "ProtectContent", - SchemaName: "protect_content", - }, - { - Name: "EffectID", - SchemaName: "effect_id", - }, - { - Name: "InputMessageContents", - SchemaName: "input_message_contents", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendBusinessMessageAlbumRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendBusinessMessageAlbum#70bd4e6f as nil") - } - b.PutID(SendBusinessMessageAlbumRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendBusinessMessageAlbumRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendBusinessMessageAlbum#70bd4e6f as nil") - } - b.PutString(s.BusinessConnectionID) - b.PutInt53(s.ChatID) - if s.ReplyTo == nil { - return fmt.Errorf("unable to encode sendBusinessMessageAlbum#70bd4e6f: field reply_to is nil") - } - if err := s.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendBusinessMessageAlbum#70bd4e6f: field reply_to: %w", err) - } - b.PutBool(s.DisableNotification) - b.PutBool(s.ProtectContent) - b.PutLong(s.EffectID) - b.PutInt(len(s.InputMessageContents)) - for idx, v := range s.InputMessageContents { - if v == nil { - return fmt.Errorf("unable to encode sendBusinessMessageAlbum#70bd4e6f: field input_message_contents element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare sendBusinessMessageAlbum#70bd4e6f: field input_message_contents element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SendBusinessMessageAlbumRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendBusinessMessageAlbum#70bd4e6f to nil") - } - if err := b.ConsumeID(SendBusinessMessageAlbumRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendBusinessMessageAlbumRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendBusinessMessageAlbum#70bd4e6f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field business_connection_id: %w", err) - } - s.BusinessConnectionID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := DecodeInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field reply_to: %w", err) - } - s.ReplyTo = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field disable_notification: %w", err) - } - s.DisableNotification = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field protect_content: %w", err) - } - s.ProtectContent = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field effect_id: %w", err) - } - s.EffectID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field input_message_contents: %w", err) - } - - if headerLen > 0 { - s.InputMessageContents = make([]InputMessageContentClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field input_message_contents: %w", err) - } - s.InputMessageContents = append(s.InputMessageContents, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendBusinessMessageAlbumRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendBusinessMessageAlbum#70bd4e6f as nil") - } - b.ObjStart() - b.PutID("sendBusinessMessageAlbum") - b.Comma() - b.FieldStart("business_connection_id") - b.PutString(s.BusinessConnectionID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("reply_to") - if s.ReplyTo == nil { - return fmt.Errorf("unable to encode sendBusinessMessageAlbum#70bd4e6f: field reply_to is nil") - } - if err := s.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendBusinessMessageAlbum#70bd4e6f: field reply_to: %w", err) - } - b.Comma() - b.FieldStart("disable_notification") - b.PutBool(s.DisableNotification) - b.Comma() - b.FieldStart("protect_content") - b.PutBool(s.ProtectContent) - b.Comma() - b.FieldStart("effect_id") - b.PutLong(s.EffectID) - b.Comma() - b.FieldStart("input_message_contents") - b.ArrStart() - for idx, v := range s.InputMessageContents { - if v == nil { - return fmt.Errorf("unable to encode sendBusinessMessageAlbum#70bd4e6f: field input_message_contents element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendBusinessMessageAlbum#70bd4e6f: field input_message_contents element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendBusinessMessageAlbumRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendBusinessMessageAlbum#70bd4e6f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendBusinessMessageAlbum"); err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: %w", err) - } - case "business_connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field business_connection_id: %w", err) - } - s.BusinessConnectionID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field chat_id: %w", err) - } - s.ChatID = value - case "reply_to": - value, err := DecodeTDLibJSONInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field reply_to: %w", err) - } - s.ReplyTo = value - case "disable_notification": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field disable_notification: %w", err) - } - s.DisableNotification = value - case "protect_content": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field protect_content: %w", err) - } - s.ProtectContent = value - case "effect_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field effect_id: %w", err) - } - s.EffectID = value - case "input_message_contents": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field input_message_contents: %w", err) - } - s.InputMessageContents = append(s.InputMessageContents, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode sendBusinessMessageAlbum#70bd4e6f: field input_message_contents: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessConnectionID returns value of BusinessConnectionID field. -func (s *SendBusinessMessageAlbumRequest) GetBusinessConnectionID() (value string) { - if s == nil { - return - } - return s.BusinessConnectionID -} - -// GetChatID returns value of ChatID field. -func (s *SendBusinessMessageAlbumRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetReplyTo returns value of ReplyTo field. -func (s *SendBusinessMessageAlbumRequest) GetReplyTo() (value InputMessageReplyToClass) { - if s == nil { - return - } - return s.ReplyTo -} - -// GetDisableNotification returns value of DisableNotification field. -func (s *SendBusinessMessageAlbumRequest) GetDisableNotification() (value bool) { - if s == nil { - return - } - return s.DisableNotification -} - -// GetProtectContent returns value of ProtectContent field. -func (s *SendBusinessMessageAlbumRequest) GetProtectContent() (value bool) { - if s == nil { - return - } - return s.ProtectContent -} - -// GetEffectID returns value of EffectID field. -func (s *SendBusinessMessageAlbumRequest) GetEffectID() (value int64) { - if s == nil { - return - } - return s.EffectID -} - -// GetInputMessageContents returns value of InputMessageContents field. -func (s *SendBusinessMessageAlbumRequest) GetInputMessageContents() (value []InputMessageContentClass) { - if s == nil { - return - } - return s.InputMessageContents -} - -// SendBusinessMessageAlbum invokes method sendBusinessMessageAlbum#70bd4e6f returning error if any. -func (c *Client) SendBusinessMessageAlbum(ctx context.Context, request *SendBusinessMessageAlbumRequest) (*BusinessMessages, error) { - var result BusinessMessages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_business_message_gen.go b/tdapi/tl_send_business_message_gen.go deleted file mode 100644 index 10ea3f00b..000000000 --- a/tdapi/tl_send_business_message_gen.go +++ /dev/null @@ -1,471 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendBusinessMessageRequest represents TL type `sendBusinessMessage#987b403`. -type SendBusinessMessageRequest struct { - // Unique identifier of business connection on behalf of which to send the request - BusinessConnectionID string - // Target chat - ChatID int64 - // Information about the message to be replied; pass null if none - ReplyTo InputMessageReplyToClass - // Pass true to disable notification for the message - DisableNotification bool - // Pass true if the content of the message must be protected from forwarding and saving - ProtectContent bool - // Identifier of the effect to apply to the message - EffectID int64 - // Markup for replying to the message; pass null if none - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent - InputMessageContent InputMessageContentClass -} - -// SendBusinessMessageRequestTypeID is TL type id of SendBusinessMessageRequest. -const SendBusinessMessageRequestTypeID = 0x987b403 - -// Ensuring interfaces in compile-time for SendBusinessMessageRequest. -var ( - _ bin.Encoder = &SendBusinessMessageRequest{} - _ bin.Decoder = &SendBusinessMessageRequest{} - _ bin.BareEncoder = &SendBusinessMessageRequest{} - _ bin.BareDecoder = &SendBusinessMessageRequest{} -) - -func (s *SendBusinessMessageRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BusinessConnectionID == "") { - return false - } - if !(s.ChatID == 0) { - return false - } - if !(s.ReplyTo == nil) { - return false - } - if !(s.DisableNotification == false) { - return false - } - if !(s.ProtectContent == false) { - return false - } - if !(s.EffectID == 0) { - return false - } - if !(s.ReplyMarkup == nil) { - return false - } - if !(s.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendBusinessMessageRequest) String() string { - if s == nil { - return "SendBusinessMessageRequest(nil)" - } - type Alias SendBusinessMessageRequest - return fmt.Sprintf("SendBusinessMessageRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendBusinessMessageRequest) TypeID() uint32 { - return SendBusinessMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendBusinessMessageRequest) TypeName() string { - return "sendBusinessMessage" -} - -// TypeInfo returns info about TL type. -func (s *SendBusinessMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendBusinessMessage", - ID: SendBusinessMessageRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BusinessConnectionID", - SchemaName: "business_connection_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ReplyTo", - SchemaName: "reply_to", - }, - { - Name: "DisableNotification", - SchemaName: "disable_notification", - }, - { - Name: "ProtectContent", - SchemaName: "protect_content", - }, - { - Name: "EffectID", - SchemaName: "effect_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendBusinessMessageRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendBusinessMessage#987b403 as nil") - } - b.PutID(SendBusinessMessageRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendBusinessMessageRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendBusinessMessage#987b403 as nil") - } - b.PutString(s.BusinessConnectionID) - b.PutInt53(s.ChatID) - if s.ReplyTo == nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field reply_to is nil") - } - if err := s.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field reply_to: %w", err) - } - b.PutBool(s.DisableNotification) - b.PutBool(s.ProtectContent) - b.PutLong(s.EffectID) - if s.ReplyMarkup == nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field reply_markup is nil") - } - if err := s.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field reply_markup: %w", err) - } - if s.InputMessageContent == nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field input_message_content is nil") - } - if err := s.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SendBusinessMessageRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendBusinessMessage#987b403 to nil") - } - if err := b.ConsumeID(SendBusinessMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendBusinessMessageRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendBusinessMessage#987b403 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field business_connection_id: %w", err) - } - s.BusinessConnectionID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := DecodeInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field reply_to: %w", err) - } - s.ReplyTo = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field disable_notification: %w", err) - } - s.DisableNotification = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field protect_content: %w", err) - } - s.ProtectContent = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field effect_id: %w", err) - } - s.EffectID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field reply_markup: %w", err) - } - s.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field input_message_content: %w", err) - } - s.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendBusinessMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendBusinessMessage#987b403 as nil") - } - b.ObjStart() - b.PutID("sendBusinessMessage") - b.Comma() - b.FieldStart("business_connection_id") - b.PutString(s.BusinessConnectionID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("reply_to") - if s.ReplyTo == nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field reply_to is nil") - } - if err := s.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field reply_to: %w", err) - } - b.Comma() - b.FieldStart("disable_notification") - b.PutBool(s.DisableNotification) - b.Comma() - b.FieldStart("protect_content") - b.PutBool(s.ProtectContent) - b.Comma() - b.FieldStart("effect_id") - b.PutLong(s.EffectID) - b.Comma() - b.FieldStart("reply_markup") - if s.ReplyMarkup == nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field reply_markup is nil") - } - if err := s.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if s.InputMessageContent == nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field input_message_content is nil") - } - if err := s.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendBusinessMessage#987b403: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendBusinessMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendBusinessMessage#987b403 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendBusinessMessage"); err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: %w", err) - } - case "business_connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field business_connection_id: %w", err) - } - s.BusinessConnectionID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field chat_id: %w", err) - } - s.ChatID = value - case "reply_to": - value, err := DecodeTDLibJSONInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field reply_to: %w", err) - } - s.ReplyTo = value - case "disable_notification": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field disable_notification: %w", err) - } - s.DisableNotification = value - case "protect_content": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field protect_content: %w", err) - } - s.ProtectContent = value - case "effect_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field effect_id: %w", err) - } - s.EffectID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field reply_markup: %w", err) - } - s.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode sendBusinessMessage#987b403: field input_message_content: %w", err) - } - s.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessConnectionID returns value of BusinessConnectionID field. -func (s *SendBusinessMessageRequest) GetBusinessConnectionID() (value string) { - if s == nil { - return - } - return s.BusinessConnectionID -} - -// GetChatID returns value of ChatID field. -func (s *SendBusinessMessageRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetReplyTo returns value of ReplyTo field. -func (s *SendBusinessMessageRequest) GetReplyTo() (value InputMessageReplyToClass) { - if s == nil { - return - } - return s.ReplyTo -} - -// GetDisableNotification returns value of DisableNotification field. -func (s *SendBusinessMessageRequest) GetDisableNotification() (value bool) { - if s == nil { - return - } - return s.DisableNotification -} - -// GetProtectContent returns value of ProtectContent field. -func (s *SendBusinessMessageRequest) GetProtectContent() (value bool) { - if s == nil { - return - } - return s.ProtectContent -} - -// GetEffectID returns value of EffectID field. -func (s *SendBusinessMessageRequest) GetEffectID() (value int64) { - if s == nil { - return - } - return s.EffectID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (s *SendBusinessMessageRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if s == nil { - return - } - return s.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (s *SendBusinessMessageRequest) GetInputMessageContent() (value InputMessageContentClass) { - if s == nil { - return - } - return s.InputMessageContent -} - -// SendBusinessMessage invokes method sendBusinessMessage#987b403 returning error if any. -func (c *Client) SendBusinessMessage(ctx context.Context, request *SendBusinessMessageRequest) (*BusinessMessage, error) { - var result BusinessMessage - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_call_debug_information_gen.go b/tdapi/tl_send_call_debug_information_gen.go deleted file mode 100644 index 453738212..000000000 --- a/tdapi/tl_send_call_debug_information_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendCallDebugInformationRequest represents TL type `sendCallDebugInformation#785b373f`. -type SendCallDebugInformationRequest struct { - // Call identifier - CallID int32 - // Debug information in application-specific format - DebugInformation string -} - -// SendCallDebugInformationRequestTypeID is TL type id of SendCallDebugInformationRequest. -const SendCallDebugInformationRequestTypeID = 0x785b373f - -// Ensuring interfaces in compile-time for SendCallDebugInformationRequest. -var ( - _ bin.Encoder = &SendCallDebugInformationRequest{} - _ bin.Decoder = &SendCallDebugInformationRequest{} - _ bin.BareEncoder = &SendCallDebugInformationRequest{} - _ bin.BareDecoder = &SendCallDebugInformationRequest{} -) - -func (s *SendCallDebugInformationRequest) Zero() bool { - if s == nil { - return true - } - if !(s.CallID == 0) { - return false - } - if !(s.DebugInformation == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendCallDebugInformationRequest) String() string { - if s == nil { - return "SendCallDebugInformationRequest(nil)" - } - type Alias SendCallDebugInformationRequest - return fmt.Sprintf("SendCallDebugInformationRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendCallDebugInformationRequest) TypeID() uint32 { - return SendCallDebugInformationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendCallDebugInformationRequest) TypeName() string { - return "sendCallDebugInformation" -} - -// TypeInfo returns info about TL type. -func (s *SendCallDebugInformationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendCallDebugInformation", - ID: SendCallDebugInformationRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CallID", - SchemaName: "call_id", - }, - { - Name: "DebugInformation", - SchemaName: "debug_information", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendCallDebugInformationRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendCallDebugInformation#785b373f as nil") - } - b.PutID(SendCallDebugInformationRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendCallDebugInformationRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendCallDebugInformation#785b373f as nil") - } - b.PutInt32(s.CallID) - b.PutString(s.DebugInformation) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendCallDebugInformationRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendCallDebugInformation#785b373f to nil") - } - if err := b.ConsumeID(SendCallDebugInformationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendCallDebugInformation#785b373f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendCallDebugInformationRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendCallDebugInformation#785b373f to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendCallDebugInformation#785b373f: field call_id: %w", err) - } - s.CallID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendCallDebugInformation#785b373f: field debug_information: %w", err) - } - s.DebugInformation = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendCallDebugInformationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendCallDebugInformation#785b373f as nil") - } - b.ObjStart() - b.PutID("sendCallDebugInformation") - b.Comma() - b.FieldStart("call_id") - b.PutInt32(s.CallID) - b.Comma() - b.FieldStart("debug_information") - b.PutString(s.DebugInformation) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendCallDebugInformationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendCallDebugInformation#785b373f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendCallDebugInformation"); err != nil { - return fmt.Errorf("unable to decode sendCallDebugInformation#785b373f: %w", err) - } - case "call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendCallDebugInformation#785b373f: field call_id: %w", err) - } - s.CallID = value - case "debug_information": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendCallDebugInformation#785b373f: field debug_information: %w", err) - } - s.DebugInformation = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCallID returns value of CallID field. -func (s *SendCallDebugInformationRequest) GetCallID() (value int32) { - if s == nil { - return - } - return s.CallID -} - -// GetDebugInformation returns value of DebugInformation field. -func (s *SendCallDebugInformationRequest) GetDebugInformation() (value string) { - if s == nil { - return - } - return s.DebugInformation -} - -// SendCallDebugInformation invokes method sendCallDebugInformation#785b373f returning error if any. -func (c *Client) SendCallDebugInformation(ctx context.Context, request *SendCallDebugInformationRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_send_call_log_gen.go b/tdapi/tl_send_call_log_gen.go deleted file mode 100644 index ee0bf4482..000000000 --- a/tdapi/tl_send_call_log_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendCallLogRequest represents TL type `sendCallLog#3f0a47d1`. -type SendCallLogRequest struct { - // Call identifier - CallID int32 - // Call log file. Only inputFileLocal and inputFileGenerated are supported - LogFile InputFileClass -} - -// SendCallLogRequestTypeID is TL type id of SendCallLogRequest. -const SendCallLogRequestTypeID = 0x3f0a47d1 - -// Ensuring interfaces in compile-time for SendCallLogRequest. -var ( - _ bin.Encoder = &SendCallLogRequest{} - _ bin.Decoder = &SendCallLogRequest{} - _ bin.BareEncoder = &SendCallLogRequest{} - _ bin.BareDecoder = &SendCallLogRequest{} -) - -func (s *SendCallLogRequest) Zero() bool { - if s == nil { - return true - } - if !(s.CallID == 0) { - return false - } - if !(s.LogFile == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendCallLogRequest) String() string { - if s == nil { - return "SendCallLogRequest(nil)" - } - type Alias SendCallLogRequest - return fmt.Sprintf("SendCallLogRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendCallLogRequest) TypeID() uint32 { - return SendCallLogRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendCallLogRequest) TypeName() string { - return "sendCallLog" -} - -// TypeInfo returns info about TL type. -func (s *SendCallLogRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendCallLog", - ID: SendCallLogRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CallID", - SchemaName: "call_id", - }, - { - Name: "LogFile", - SchemaName: "log_file", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendCallLogRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendCallLog#3f0a47d1 as nil") - } - b.PutID(SendCallLogRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendCallLogRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendCallLog#3f0a47d1 as nil") - } - b.PutInt32(s.CallID) - if s.LogFile == nil { - return fmt.Errorf("unable to encode sendCallLog#3f0a47d1: field log_file is nil") - } - if err := s.LogFile.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendCallLog#3f0a47d1: field log_file: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SendCallLogRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendCallLog#3f0a47d1 to nil") - } - if err := b.ConsumeID(SendCallLogRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendCallLogRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendCallLog#3f0a47d1 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: field call_id: %w", err) - } - s.CallID = value - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: field log_file: %w", err) - } - s.LogFile = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendCallLogRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendCallLog#3f0a47d1 as nil") - } - b.ObjStart() - b.PutID("sendCallLog") - b.Comma() - b.FieldStart("call_id") - b.PutInt32(s.CallID) - b.Comma() - b.FieldStart("log_file") - if s.LogFile == nil { - return fmt.Errorf("unable to encode sendCallLog#3f0a47d1: field log_file is nil") - } - if err := s.LogFile.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendCallLog#3f0a47d1: field log_file: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendCallLogRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendCallLog#3f0a47d1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendCallLog"); err != nil { - return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: %w", err) - } - case "call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: field call_id: %w", err) - } - s.CallID = value - case "log_file": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode sendCallLog#3f0a47d1: field log_file: %w", err) - } - s.LogFile = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCallID returns value of CallID field. -func (s *SendCallLogRequest) GetCallID() (value int32) { - if s == nil { - return - } - return s.CallID -} - -// GetLogFile returns value of LogFile field. -func (s *SendCallLogRequest) GetLogFile() (value InputFileClass) { - if s == nil { - return - } - return s.LogFile -} - -// SendCallLog invokes method sendCallLog#3f0a47d1 returning error if any. -func (c *Client) SendCallLog(ctx context.Context, request *SendCallLogRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_send_call_rating_gen.go b/tdapi/tl_send_call_rating_gen.go deleted file mode 100644 index fbb80a5b6..000000000 --- a/tdapi/tl_send_call_rating_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendCallRatingRequest represents TL type `sendCallRating#d89b576c`. -type SendCallRatingRequest struct { - // Call identifier - CallID int32 - // Call rating; 1-5 - Rating int32 - // An optional user comment if the rating is less than 5 - Comment string - // List of the exact types of problems with the call, specified by the user - Problems []CallProblemClass -} - -// SendCallRatingRequestTypeID is TL type id of SendCallRatingRequest. -const SendCallRatingRequestTypeID = 0xd89b576c - -// Ensuring interfaces in compile-time for SendCallRatingRequest. -var ( - _ bin.Encoder = &SendCallRatingRequest{} - _ bin.Decoder = &SendCallRatingRequest{} - _ bin.BareEncoder = &SendCallRatingRequest{} - _ bin.BareDecoder = &SendCallRatingRequest{} -) - -func (s *SendCallRatingRequest) Zero() bool { - if s == nil { - return true - } - if !(s.CallID == 0) { - return false - } - if !(s.Rating == 0) { - return false - } - if !(s.Comment == "") { - return false - } - if !(s.Problems == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendCallRatingRequest) String() string { - if s == nil { - return "SendCallRatingRequest(nil)" - } - type Alias SendCallRatingRequest - return fmt.Sprintf("SendCallRatingRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendCallRatingRequest) TypeID() uint32 { - return SendCallRatingRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendCallRatingRequest) TypeName() string { - return "sendCallRating" -} - -// TypeInfo returns info about TL type. -func (s *SendCallRatingRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendCallRating", - ID: SendCallRatingRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CallID", - SchemaName: "call_id", - }, - { - Name: "Rating", - SchemaName: "rating", - }, - { - Name: "Comment", - SchemaName: "comment", - }, - { - Name: "Problems", - SchemaName: "problems", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendCallRatingRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendCallRating#d89b576c as nil") - } - b.PutID(SendCallRatingRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendCallRatingRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendCallRating#d89b576c as nil") - } - b.PutInt32(s.CallID) - b.PutInt32(s.Rating) - b.PutString(s.Comment) - b.PutInt(len(s.Problems)) - for idx, v := range s.Problems { - if v == nil { - return fmt.Errorf("unable to encode sendCallRating#d89b576c: field problems element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare sendCallRating#d89b576c: field problems element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SendCallRatingRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendCallRating#d89b576c to nil") - } - if err := b.ConsumeID(SendCallRatingRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendCallRatingRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendCallRating#d89b576c to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: field call_id: %w", err) - } - s.CallID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: field rating: %w", err) - } - s.Rating = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: field comment: %w", err) - } - s.Comment = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: field problems: %w", err) - } - - if headerLen > 0 { - s.Problems = make([]CallProblemClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeCallProblem(b) - if err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: field problems: %w", err) - } - s.Problems = append(s.Problems, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendCallRatingRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendCallRating#d89b576c as nil") - } - b.ObjStart() - b.PutID("sendCallRating") - b.Comma() - b.FieldStart("call_id") - b.PutInt32(s.CallID) - b.Comma() - b.FieldStart("rating") - b.PutInt32(s.Rating) - b.Comma() - b.FieldStart("comment") - b.PutString(s.Comment) - b.Comma() - b.FieldStart("problems") - b.ArrStart() - for idx, v := range s.Problems { - if v == nil { - return fmt.Errorf("unable to encode sendCallRating#d89b576c: field problems element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendCallRating#d89b576c: field problems element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendCallRatingRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendCallRating#d89b576c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendCallRating"); err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: %w", err) - } - case "call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: field call_id: %w", err) - } - s.CallID = value - case "rating": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: field rating: %w", err) - } - s.Rating = value - case "comment": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: field comment: %w", err) - } - s.Comment = value - case "problems": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONCallProblem(b) - if err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: field problems: %w", err) - } - s.Problems = append(s.Problems, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode sendCallRating#d89b576c: field problems: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCallID returns value of CallID field. -func (s *SendCallRatingRequest) GetCallID() (value int32) { - if s == nil { - return - } - return s.CallID -} - -// GetRating returns value of Rating field. -func (s *SendCallRatingRequest) GetRating() (value int32) { - if s == nil { - return - } - return s.Rating -} - -// GetComment returns value of Comment field. -func (s *SendCallRatingRequest) GetComment() (value string) { - if s == nil { - return - } - return s.Comment -} - -// GetProblems returns value of Problems field. -func (s *SendCallRatingRequest) GetProblems() (value []CallProblemClass) { - if s == nil { - return - } - return s.Problems -} - -// SendCallRating invokes method sendCallRating#d89b576c returning error if any. -func (c *Client) SendCallRating(ctx context.Context, request *SendCallRatingRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_send_call_signaling_data_gen.go b/tdapi/tl_send_call_signaling_data_gen.go deleted file mode 100644 index 02919d5d7..000000000 --- a/tdapi/tl_send_call_signaling_data_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendCallSignalingDataRequest represents TL type `sendCallSignalingData#542db19c`. -type SendCallSignalingDataRequest struct { - // Call identifier - CallID int32 - // The data - Data []byte -} - -// SendCallSignalingDataRequestTypeID is TL type id of SendCallSignalingDataRequest. -const SendCallSignalingDataRequestTypeID = 0x542db19c - -// Ensuring interfaces in compile-time for SendCallSignalingDataRequest. -var ( - _ bin.Encoder = &SendCallSignalingDataRequest{} - _ bin.Decoder = &SendCallSignalingDataRequest{} - _ bin.BareEncoder = &SendCallSignalingDataRequest{} - _ bin.BareDecoder = &SendCallSignalingDataRequest{} -) - -func (s *SendCallSignalingDataRequest) Zero() bool { - if s == nil { - return true - } - if !(s.CallID == 0) { - return false - } - if !(s.Data == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendCallSignalingDataRequest) String() string { - if s == nil { - return "SendCallSignalingDataRequest(nil)" - } - type Alias SendCallSignalingDataRequest - return fmt.Sprintf("SendCallSignalingDataRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendCallSignalingDataRequest) TypeID() uint32 { - return SendCallSignalingDataRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendCallSignalingDataRequest) TypeName() string { - return "sendCallSignalingData" -} - -// TypeInfo returns info about TL type. -func (s *SendCallSignalingDataRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendCallSignalingData", - ID: SendCallSignalingDataRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CallID", - SchemaName: "call_id", - }, - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendCallSignalingDataRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendCallSignalingData#542db19c as nil") - } - b.PutID(SendCallSignalingDataRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendCallSignalingDataRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendCallSignalingData#542db19c as nil") - } - b.PutInt32(s.CallID) - b.PutBytes(s.Data) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendCallSignalingDataRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendCallSignalingData#542db19c to nil") - } - if err := b.ConsumeID(SendCallSignalingDataRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendCallSignalingData#542db19c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendCallSignalingDataRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendCallSignalingData#542db19c to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendCallSignalingData#542db19c: field call_id: %w", err) - } - s.CallID = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode sendCallSignalingData#542db19c: field data: %w", err) - } - s.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendCallSignalingDataRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendCallSignalingData#542db19c as nil") - } - b.ObjStart() - b.PutID("sendCallSignalingData") - b.Comma() - b.FieldStart("call_id") - b.PutInt32(s.CallID) - b.Comma() - b.FieldStart("data") - b.PutBytes(s.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendCallSignalingDataRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendCallSignalingData#542db19c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendCallSignalingData"); err != nil { - return fmt.Errorf("unable to decode sendCallSignalingData#542db19c: %w", err) - } - case "call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendCallSignalingData#542db19c: field call_id: %w", err) - } - s.CallID = value - case "data": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode sendCallSignalingData#542db19c: field data: %w", err) - } - s.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCallID returns value of CallID field. -func (s *SendCallSignalingDataRequest) GetCallID() (value int32) { - if s == nil { - return - } - return s.CallID -} - -// GetData returns value of Data field. -func (s *SendCallSignalingDataRequest) GetData() (value []byte) { - if s == nil { - return - } - return s.Data -} - -// SendCallSignalingData invokes method sendCallSignalingData#542db19c returning error if any. -func (c *Client) SendCallSignalingData(ctx context.Context, request *SendCallSignalingDataRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_send_chat_action_gen.go b/tdapi/tl_send_chat_action_gen.go deleted file mode 100644 index 9737cb3b1..000000000 --- a/tdapi/tl_send_chat_action_gen.go +++ /dev/null @@ -1,316 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendChatActionRequest represents TL type `sendChatAction#8823f29e`. -type SendChatActionRequest struct { - // Chat identifier - ChatID int64 - // If not 0, the message thread identifier in which the action was performed - MessageThreadID int64 - // Unique identifier of business connection on behalf of which to send the request; for - // bots only - BusinessConnectionID string - // The action description; pass null to cancel the currently active action - Action ChatActionClass -} - -// SendChatActionRequestTypeID is TL type id of SendChatActionRequest. -const SendChatActionRequestTypeID = 0x8823f29e - -// Ensuring interfaces in compile-time for SendChatActionRequest. -var ( - _ bin.Encoder = &SendChatActionRequest{} - _ bin.Decoder = &SendChatActionRequest{} - _ bin.BareEncoder = &SendChatActionRequest{} - _ bin.BareDecoder = &SendChatActionRequest{} -) - -func (s *SendChatActionRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageThreadID == 0) { - return false - } - if !(s.BusinessConnectionID == "") { - return false - } - if !(s.Action == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendChatActionRequest) String() string { - if s == nil { - return "SendChatActionRequest(nil)" - } - type Alias SendChatActionRequest - return fmt.Sprintf("SendChatActionRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendChatActionRequest) TypeID() uint32 { - return SendChatActionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendChatActionRequest) TypeName() string { - return "sendChatAction" -} - -// TypeInfo returns info about TL type. -func (s *SendChatActionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendChatAction", - ID: SendChatActionRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "BusinessConnectionID", - SchemaName: "business_connection_id", - }, - { - Name: "Action", - SchemaName: "action", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendChatActionRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendChatAction#8823f29e as nil") - } - b.PutID(SendChatActionRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendChatActionRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendChatAction#8823f29e as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageThreadID) - b.PutString(s.BusinessConnectionID) - if s.Action == nil { - return fmt.Errorf("unable to encode sendChatAction#8823f29e: field action is nil") - } - if err := s.Action.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendChatAction#8823f29e: field action: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SendChatActionRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendChatAction#8823f29e to nil") - } - if err := b.ConsumeID(SendChatActionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendChatAction#8823f29e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendChatActionRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendChatAction#8823f29e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendChatAction#8823f29e: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendChatAction#8823f29e: field message_thread_id: %w", err) - } - s.MessageThreadID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendChatAction#8823f29e: field business_connection_id: %w", err) - } - s.BusinessConnectionID = value - } - { - value, err := DecodeChatAction(b) - if err != nil { - return fmt.Errorf("unable to decode sendChatAction#8823f29e: field action: %w", err) - } - s.Action = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendChatActionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendChatAction#8823f29e as nil") - } - b.ObjStart() - b.PutID("sendChatAction") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(s.MessageThreadID) - b.Comma() - b.FieldStart("business_connection_id") - b.PutString(s.BusinessConnectionID) - b.Comma() - b.FieldStart("action") - if s.Action == nil { - return fmt.Errorf("unable to encode sendChatAction#8823f29e: field action is nil") - } - if err := s.Action.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendChatAction#8823f29e: field action: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendChatActionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendChatAction#8823f29e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendChatAction"); err != nil { - return fmt.Errorf("unable to decode sendChatAction#8823f29e: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendChatAction#8823f29e: field chat_id: %w", err) - } - s.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendChatAction#8823f29e: field message_thread_id: %w", err) - } - s.MessageThreadID = value - case "business_connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendChatAction#8823f29e: field business_connection_id: %w", err) - } - s.BusinessConnectionID = value - case "action": - value, err := DecodeTDLibJSONChatAction(b) - if err != nil { - return fmt.Errorf("unable to decode sendChatAction#8823f29e: field action: %w", err) - } - s.Action = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SendChatActionRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (s *SendChatActionRequest) GetMessageThreadID() (value int64) { - if s == nil { - return - } - return s.MessageThreadID -} - -// GetBusinessConnectionID returns value of BusinessConnectionID field. -func (s *SendChatActionRequest) GetBusinessConnectionID() (value string) { - if s == nil { - return - } - return s.BusinessConnectionID -} - -// GetAction returns value of Action field. -func (s *SendChatActionRequest) GetAction() (value ChatActionClass) { - if s == nil { - return - } - return s.Action -} - -// SendChatAction invokes method sendChatAction#8823f29e returning error if any. -func (c *Client) SendChatAction(ctx context.Context, request *SendChatActionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_send_custom_request_gen.go b/tdapi/tl_send_custom_request_gen.go deleted file mode 100644 index eb07c846f..000000000 --- a/tdapi/tl_send_custom_request_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendCustomRequestRequest represents TL type `sendCustomRequest#10fd71a1`. -type SendCustomRequestRequest struct { - // The method name - Method string - // JSON-serialized method parameters - Parameters string -} - -// SendCustomRequestRequestTypeID is TL type id of SendCustomRequestRequest. -const SendCustomRequestRequestTypeID = 0x10fd71a1 - -// Ensuring interfaces in compile-time for SendCustomRequestRequest. -var ( - _ bin.Encoder = &SendCustomRequestRequest{} - _ bin.Decoder = &SendCustomRequestRequest{} - _ bin.BareEncoder = &SendCustomRequestRequest{} - _ bin.BareDecoder = &SendCustomRequestRequest{} -) - -func (s *SendCustomRequestRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Method == "") { - return false - } - if !(s.Parameters == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendCustomRequestRequest) String() string { - if s == nil { - return "SendCustomRequestRequest(nil)" - } - type Alias SendCustomRequestRequest - return fmt.Sprintf("SendCustomRequestRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendCustomRequestRequest) TypeID() uint32 { - return SendCustomRequestRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendCustomRequestRequest) TypeName() string { - return "sendCustomRequest" -} - -// TypeInfo returns info about TL type. -func (s *SendCustomRequestRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendCustomRequest", - ID: SendCustomRequestRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Method", - SchemaName: "method", - }, - { - Name: "Parameters", - SchemaName: "parameters", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendCustomRequestRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendCustomRequest#10fd71a1 as nil") - } - b.PutID(SendCustomRequestRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendCustomRequestRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendCustomRequest#10fd71a1 as nil") - } - b.PutString(s.Method) - b.PutString(s.Parameters) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendCustomRequestRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendCustomRequest#10fd71a1 to nil") - } - if err := b.ConsumeID(SendCustomRequestRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendCustomRequest#10fd71a1: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendCustomRequestRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendCustomRequest#10fd71a1 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendCustomRequest#10fd71a1: field method: %w", err) - } - s.Method = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendCustomRequest#10fd71a1: field parameters: %w", err) - } - s.Parameters = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendCustomRequestRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendCustomRequest#10fd71a1 as nil") - } - b.ObjStart() - b.PutID("sendCustomRequest") - b.Comma() - b.FieldStart("method") - b.PutString(s.Method) - b.Comma() - b.FieldStart("parameters") - b.PutString(s.Parameters) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendCustomRequestRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendCustomRequest#10fd71a1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendCustomRequest"); err != nil { - return fmt.Errorf("unable to decode sendCustomRequest#10fd71a1: %w", err) - } - case "method": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendCustomRequest#10fd71a1: field method: %w", err) - } - s.Method = value - case "parameters": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendCustomRequest#10fd71a1: field parameters: %w", err) - } - s.Parameters = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMethod returns value of Method field. -func (s *SendCustomRequestRequest) GetMethod() (value string) { - if s == nil { - return - } - return s.Method -} - -// GetParameters returns value of Parameters field. -func (s *SendCustomRequestRequest) GetParameters() (value string) { - if s == nil { - return - } - return s.Parameters -} - -// SendCustomRequest invokes method sendCustomRequest#10fd71a1 returning error if any. -func (c *Client) SendCustomRequest(ctx context.Context, request *SendCustomRequestRequest) (*CustomRequestResult, error) { - var result CustomRequestResult - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_email_address_verification_code_gen.go b/tdapi/tl_send_email_address_verification_code_gen.go deleted file mode 100644 index 859234c4a..000000000 --- a/tdapi/tl_send_email_address_verification_code_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendEmailAddressVerificationCodeRequest represents TL type `sendEmailAddressVerificationCode#f2ca537d`. -type SendEmailAddressVerificationCodeRequest struct { - // Email address - EmailAddress string -} - -// SendEmailAddressVerificationCodeRequestTypeID is TL type id of SendEmailAddressVerificationCodeRequest. -const SendEmailAddressVerificationCodeRequestTypeID = 0xf2ca537d - -// Ensuring interfaces in compile-time for SendEmailAddressVerificationCodeRequest. -var ( - _ bin.Encoder = &SendEmailAddressVerificationCodeRequest{} - _ bin.Decoder = &SendEmailAddressVerificationCodeRequest{} - _ bin.BareEncoder = &SendEmailAddressVerificationCodeRequest{} - _ bin.BareDecoder = &SendEmailAddressVerificationCodeRequest{} -) - -func (s *SendEmailAddressVerificationCodeRequest) Zero() bool { - if s == nil { - return true - } - if !(s.EmailAddress == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendEmailAddressVerificationCodeRequest) String() string { - if s == nil { - return "SendEmailAddressVerificationCodeRequest(nil)" - } - type Alias SendEmailAddressVerificationCodeRequest - return fmt.Sprintf("SendEmailAddressVerificationCodeRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendEmailAddressVerificationCodeRequest) TypeID() uint32 { - return SendEmailAddressVerificationCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendEmailAddressVerificationCodeRequest) TypeName() string { - return "sendEmailAddressVerificationCode" -} - -// TypeInfo returns info about TL type. -func (s *SendEmailAddressVerificationCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendEmailAddressVerificationCode", - ID: SendEmailAddressVerificationCodeRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "EmailAddress", - SchemaName: "email_address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendEmailAddressVerificationCodeRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendEmailAddressVerificationCode#f2ca537d as nil") - } - b.PutID(SendEmailAddressVerificationCodeRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendEmailAddressVerificationCodeRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendEmailAddressVerificationCode#f2ca537d as nil") - } - b.PutString(s.EmailAddress) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendEmailAddressVerificationCodeRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendEmailAddressVerificationCode#f2ca537d to nil") - } - if err := b.ConsumeID(SendEmailAddressVerificationCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendEmailAddressVerificationCode#f2ca537d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendEmailAddressVerificationCodeRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendEmailAddressVerificationCode#f2ca537d to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendEmailAddressVerificationCode#f2ca537d: field email_address: %w", err) - } - s.EmailAddress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendEmailAddressVerificationCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendEmailAddressVerificationCode#f2ca537d as nil") - } - b.ObjStart() - b.PutID("sendEmailAddressVerificationCode") - b.Comma() - b.FieldStart("email_address") - b.PutString(s.EmailAddress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendEmailAddressVerificationCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendEmailAddressVerificationCode#f2ca537d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendEmailAddressVerificationCode"); err != nil { - return fmt.Errorf("unable to decode sendEmailAddressVerificationCode#f2ca537d: %w", err) - } - case "email_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendEmailAddressVerificationCode#f2ca537d: field email_address: %w", err) - } - s.EmailAddress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEmailAddress returns value of EmailAddress field. -func (s *SendEmailAddressVerificationCodeRequest) GetEmailAddress() (value string) { - if s == nil { - return - } - return s.EmailAddress -} - -// SendEmailAddressVerificationCode invokes method sendEmailAddressVerificationCode#f2ca537d returning error if any. -func (c *Client) SendEmailAddressVerificationCode(ctx context.Context, emailaddress string) (*EmailAddressAuthenticationCodeInfo, error) { - var result EmailAddressAuthenticationCodeInfo - - request := &SendEmailAddressVerificationCodeRequest{ - EmailAddress: emailaddress, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_gift_gen.go b/tdapi/tl_send_gift_gen.go deleted file mode 100644 index 3bc5944c5..000000000 --- a/tdapi/tl_send_gift_gen.go +++ /dev/null @@ -1,342 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendGiftRequest represents TL type `sendGift#13a97db`. -type SendGiftRequest struct { - // Identifier of the gift to send - GiftID int64 - // Identifier of the user that will receive the gift - UserID int64 - // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only - // Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed - Text FormattedText - // Pass true to show the current user as sender and gift text only to the gift receiver; - // otherwise, everyone will be able to see them - IsPrivate bool - // Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade - // it for free - PayForUpgrade bool -} - -// SendGiftRequestTypeID is TL type id of SendGiftRequest. -const SendGiftRequestTypeID = 0x13a97db - -// Ensuring interfaces in compile-time for SendGiftRequest. -var ( - _ bin.Encoder = &SendGiftRequest{} - _ bin.Decoder = &SendGiftRequest{} - _ bin.BareEncoder = &SendGiftRequest{} - _ bin.BareDecoder = &SendGiftRequest{} -) - -func (s *SendGiftRequest) Zero() bool { - if s == nil { - return true - } - if !(s.GiftID == 0) { - return false - } - if !(s.UserID == 0) { - return false - } - if !(s.Text.Zero()) { - return false - } - if !(s.IsPrivate == false) { - return false - } - if !(s.PayForUpgrade == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendGiftRequest) String() string { - if s == nil { - return "SendGiftRequest(nil)" - } - type Alias SendGiftRequest - return fmt.Sprintf("SendGiftRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendGiftRequest) TypeID() uint32 { - return SendGiftRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendGiftRequest) TypeName() string { - return "sendGift" -} - -// TypeInfo returns info about TL type. -func (s *SendGiftRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendGift", - ID: SendGiftRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GiftID", - SchemaName: "gift_id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "IsPrivate", - SchemaName: "is_private", - }, - { - Name: "PayForUpgrade", - SchemaName: "pay_for_upgrade", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendGiftRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendGift#13a97db as nil") - } - b.PutID(SendGiftRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendGiftRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendGift#13a97db as nil") - } - b.PutLong(s.GiftID) - b.PutInt53(s.UserID) - if err := s.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendGift#13a97db: field text: %w", err) - } - b.PutBool(s.IsPrivate) - b.PutBool(s.PayForUpgrade) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendGiftRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendGift#13a97db to nil") - } - if err := b.ConsumeID(SendGiftRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendGiftRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendGift#13a97db to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: field gift_id: %w", err) - } - s.GiftID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: field user_id: %w", err) - } - s.UserID = value - } - { - if err := s.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: field text: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: field is_private: %w", err) - } - s.IsPrivate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: field pay_for_upgrade: %w", err) - } - s.PayForUpgrade = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendGiftRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendGift#13a97db as nil") - } - b.ObjStart() - b.PutID("sendGift") - b.Comma() - b.FieldStart("gift_id") - b.PutLong(s.GiftID) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("text") - if err := s.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendGift#13a97db: field text: %w", err) - } - b.Comma() - b.FieldStart("is_private") - b.PutBool(s.IsPrivate) - b.Comma() - b.FieldStart("pay_for_upgrade") - b.PutBool(s.PayForUpgrade) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendGiftRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendGift#13a97db to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendGift"); err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: %w", err) - } - case "gift_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: field gift_id: %w", err) - } - s.GiftID = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: field user_id: %w", err) - } - s.UserID = value - case "text": - if err := s.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: field text: %w", err) - } - case "is_private": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: field is_private: %w", err) - } - s.IsPrivate = value - case "pay_for_upgrade": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendGift#13a97db: field pay_for_upgrade: %w", err) - } - s.PayForUpgrade = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGiftID returns value of GiftID field. -func (s *SendGiftRequest) GetGiftID() (value int64) { - if s == nil { - return - } - return s.GiftID -} - -// GetUserID returns value of UserID field. -func (s *SendGiftRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetText returns value of Text field. -func (s *SendGiftRequest) GetText() (value FormattedText) { - if s == nil { - return - } - return s.Text -} - -// GetIsPrivate returns value of IsPrivate field. -func (s *SendGiftRequest) GetIsPrivate() (value bool) { - if s == nil { - return - } - return s.IsPrivate -} - -// GetPayForUpgrade returns value of PayForUpgrade field. -func (s *SendGiftRequest) GetPayForUpgrade() (value bool) { - if s == nil { - return - } - return s.PayForUpgrade -} - -// SendGift invokes method sendGift#13a97db returning error if any. -func (c *Client) SendGift(ctx context.Context, request *SendGiftRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_send_inline_query_result_message_gen.go b/tdapi/tl_send_inline_query_result_message_gen.go deleted file mode 100644 index b6bc302e2..000000000 --- a/tdapi/tl_send_inline_query_result_message_gen.go +++ /dev/null @@ -1,419 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendInlineQueryResultMessageRequest represents TL type `sendInlineQueryResultMessage#467c5478`. -type SendInlineQueryResultMessageRequest struct { - // Target chat - ChatID int64 - // If not 0, the message thread identifier in which the message will be sent - MessageThreadID int64 - // Information about the message or story to be replied; pass null if none - ReplyTo InputMessageReplyToClass - // Options to be used to send the message; pass null to use default options - Options MessageSendOptions - // Identifier of the inline query - QueryID int64 - // Identifier of the inline query result - ResultID string - // Pass true to hide the bot, via which the message is sent. Can be used only for bots - // getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), - // and getOption("venue_search_bot_username") - HideViaBot bool -} - -// SendInlineQueryResultMessageRequestTypeID is TL type id of SendInlineQueryResultMessageRequest. -const SendInlineQueryResultMessageRequestTypeID = 0x467c5478 - -// Ensuring interfaces in compile-time for SendInlineQueryResultMessageRequest. -var ( - _ bin.Encoder = &SendInlineQueryResultMessageRequest{} - _ bin.Decoder = &SendInlineQueryResultMessageRequest{} - _ bin.BareEncoder = &SendInlineQueryResultMessageRequest{} - _ bin.BareDecoder = &SendInlineQueryResultMessageRequest{} -) - -func (s *SendInlineQueryResultMessageRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageThreadID == 0) { - return false - } - if !(s.ReplyTo == nil) { - return false - } - if !(s.Options.Zero()) { - return false - } - if !(s.QueryID == 0) { - return false - } - if !(s.ResultID == "") { - return false - } - if !(s.HideViaBot == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendInlineQueryResultMessageRequest) String() string { - if s == nil { - return "SendInlineQueryResultMessageRequest(nil)" - } - type Alias SendInlineQueryResultMessageRequest - return fmt.Sprintf("SendInlineQueryResultMessageRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendInlineQueryResultMessageRequest) TypeID() uint32 { - return SendInlineQueryResultMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendInlineQueryResultMessageRequest) TypeName() string { - return "sendInlineQueryResultMessage" -} - -// TypeInfo returns info about TL type. -func (s *SendInlineQueryResultMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendInlineQueryResultMessage", - ID: SendInlineQueryResultMessageRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "ReplyTo", - SchemaName: "reply_to", - }, - { - Name: "Options", - SchemaName: "options", - }, - { - Name: "QueryID", - SchemaName: "query_id", - }, - { - Name: "ResultID", - SchemaName: "result_id", - }, - { - Name: "HideViaBot", - SchemaName: "hide_via_bot", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendInlineQueryResultMessageRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendInlineQueryResultMessage#467c5478 as nil") - } - b.PutID(SendInlineQueryResultMessageRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendInlineQueryResultMessageRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendInlineQueryResultMessage#467c5478 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageThreadID) - if s.ReplyTo == nil { - return fmt.Errorf("unable to encode sendInlineQueryResultMessage#467c5478: field reply_to is nil") - } - if err := s.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendInlineQueryResultMessage#467c5478: field reply_to: %w", err) - } - if err := s.Options.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendInlineQueryResultMessage#467c5478: field options: %w", err) - } - b.PutLong(s.QueryID) - b.PutString(s.ResultID) - b.PutBool(s.HideViaBot) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendInlineQueryResultMessageRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendInlineQueryResultMessage#467c5478 to nil") - } - if err := b.ConsumeID(SendInlineQueryResultMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendInlineQueryResultMessageRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendInlineQueryResultMessage#467c5478 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field message_thread_id: %w", err) - } - s.MessageThreadID = value - } - { - value, err := DecodeInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field reply_to: %w", err) - } - s.ReplyTo = value - } - { - if err := s.Options.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field options: %w", err) - } - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field query_id: %w", err) - } - s.QueryID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field result_id: %w", err) - } - s.ResultID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field hide_via_bot: %w", err) - } - s.HideViaBot = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendInlineQueryResultMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendInlineQueryResultMessage#467c5478 as nil") - } - b.ObjStart() - b.PutID("sendInlineQueryResultMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(s.MessageThreadID) - b.Comma() - b.FieldStart("reply_to") - if s.ReplyTo == nil { - return fmt.Errorf("unable to encode sendInlineQueryResultMessage#467c5478: field reply_to is nil") - } - if err := s.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendInlineQueryResultMessage#467c5478: field reply_to: %w", err) - } - b.Comma() - b.FieldStart("options") - if err := s.Options.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendInlineQueryResultMessage#467c5478: field options: %w", err) - } - b.Comma() - b.FieldStart("query_id") - b.PutLong(s.QueryID) - b.Comma() - b.FieldStart("result_id") - b.PutString(s.ResultID) - b.Comma() - b.FieldStart("hide_via_bot") - b.PutBool(s.HideViaBot) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendInlineQueryResultMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendInlineQueryResultMessage#467c5478 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendInlineQueryResultMessage"); err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field chat_id: %w", err) - } - s.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field message_thread_id: %w", err) - } - s.MessageThreadID = value - case "reply_to": - value, err := DecodeTDLibJSONInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field reply_to: %w", err) - } - s.ReplyTo = value - case "options": - if err := s.Options.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field options: %w", err) - } - case "query_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field query_id: %w", err) - } - s.QueryID = value - case "result_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field result_id: %w", err) - } - s.ResultID = value - case "hide_via_bot": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendInlineQueryResultMessage#467c5478: field hide_via_bot: %w", err) - } - s.HideViaBot = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SendInlineQueryResultMessageRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (s *SendInlineQueryResultMessageRequest) GetMessageThreadID() (value int64) { - if s == nil { - return - } - return s.MessageThreadID -} - -// GetReplyTo returns value of ReplyTo field. -func (s *SendInlineQueryResultMessageRequest) GetReplyTo() (value InputMessageReplyToClass) { - if s == nil { - return - } - return s.ReplyTo -} - -// GetOptions returns value of Options field. -func (s *SendInlineQueryResultMessageRequest) GetOptions() (value MessageSendOptions) { - if s == nil { - return - } - return s.Options -} - -// GetQueryID returns value of QueryID field. -func (s *SendInlineQueryResultMessageRequest) GetQueryID() (value int64) { - if s == nil { - return - } - return s.QueryID -} - -// GetResultID returns value of ResultID field. -func (s *SendInlineQueryResultMessageRequest) GetResultID() (value string) { - if s == nil { - return - } - return s.ResultID -} - -// GetHideViaBot returns value of HideViaBot field. -func (s *SendInlineQueryResultMessageRequest) GetHideViaBot() (value bool) { - if s == nil { - return - } - return s.HideViaBot -} - -// SendInlineQueryResultMessage invokes method sendInlineQueryResultMessage#467c5478 returning error if any. -func (c *Client) SendInlineQueryResultMessage(ctx context.Context, request *SendInlineQueryResultMessageRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_message_album_gen.go b/tdapi/tl_send_message_album_gen.go deleted file mode 100644 index d95c000fb..000000000 --- a/tdapi/tl_send_message_album_gen.go +++ /dev/null @@ -1,384 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendMessageAlbumRequest represents TL type `sendMessageAlbum#74bcdacf`. -type SendMessageAlbumRequest struct { - // Target chat - ChatID int64 - // If not 0, the message thread identifier in which the messages will be sent - MessageThreadID int64 - // Information about the message or story to be replied; pass null if none - ReplyTo InputMessageReplyToClass - // Options to be used to send the messages; pass null to use default options - Options MessageSendOptions - // Contents of messages to be sent. At most 10 messages can be added to an album. All - // messages must have the same value of show_caption_above_media - InputMessageContents []InputMessageContentClass -} - -// SendMessageAlbumRequestTypeID is TL type id of SendMessageAlbumRequest. -const SendMessageAlbumRequestTypeID = 0x74bcdacf - -// Ensuring interfaces in compile-time for SendMessageAlbumRequest. -var ( - _ bin.Encoder = &SendMessageAlbumRequest{} - _ bin.Decoder = &SendMessageAlbumRequest{} - _ bin.BareEncoder = &SendMessageAlbumRequest{} - _ bin.BareDecoder = &SendMessageAlbumRequest{} -) - -func (s *SendMessageAlbumRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageThreadID == 0) { - return false - } - if !(s.ReplyTo == nil) { - return false - } - if !(s.Options.Zero()) { - return false - } - if !(s.InputMessageContents == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendMessageAlbumRequest) String() string { - if s == nil { - return "SendMessageAlbumRequest(nil)" - } - type Alias SendMessageAlbumRequest - return fmt.Sprintf("SendMessageAlbumRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendMessageAlbumRequest) TypeID() uint32 { - return SendMessageAlbumRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendMessageAlbumRequest) TypeName() string { - return "sendMessageAlbum" -} - -// TypeInfo returns info about TL type. -func (s *SendMessageAlbumRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendMessageAlbum", - ID: SendMessageAlbumRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "ReplyTo", - SchemaName: "reply_to", - }, - { - Name: "Options", - SchemaName: "options", - }, - { - Name: "InputMessageContents", - SchemaName: "input_message_contents", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendMessageAlbumRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendMessageAlbum#74bcdacf as nil") - } - b.PutID(SendMessageAlbumRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendMessageAlbumRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendMessageAlbum#74bcdacf as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageThreadID) - if s.ReplyTo == nil { - return fmt.Errorf("unable to encode sendMessageAlbum#74bcdacf: field reply_to is nil") - } - if err := s.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendMessageAlbum#74bcdacf: field reply_to: %w", err) - } - if err := s.Options.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendMessageAlbum#74bcdacf: field options: %w", err) - } - b.PutInt(len(s.InputMessageContents)) - for idx, v := range s.InputMessageContents { - if v == nil { - return fmt.Errorf("unable to encode sendMessageAlbum#74bcdacf: field input_message_contents element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare sendMessageAlbum#74bcdacf: field input_message_contents element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SendMessageAlbumRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendMessageAlbum#74bcdacf to nil") - } - if err := b.ConsumeID(SendMessageAlbumRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendMessageAlbumRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendMessageAlbum#74bcdacf to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field message_thread_id: %w", err) - } - s.MessageThreadID = value - } - { - value, err := DecodeInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field reply_to: %w", err) - } - s.ReplyTo = value - } - { - if err := s.Options.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field options: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field input_message_contents: %w", err) - } - - if headerLen > 0 { - s.InputMessageContents = make([]InputMessageContentClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field input_message_contents: %w", err) - } - s.InputMessageContents = append(s.InputMessageContents, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendMessageAlbumRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendMessageAlbum#74bcdacf as nil") - } - b.ObjStart() - b.PutID("sendMessageAlbum") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(s.MessageThreadID) - b.Comma() - b.FieldStart("reply_to") - if s.ReplyTo == nil { - return fmt.Errorf("unable to encode sendMessageAlbum#74bcdacf: field reply_to is nil") - } - if err := s.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendMessageAlbum#74bcdacf: field reply_to: %w", err) - } - b.Comma() - b.FieldStart("options") - if err := s.Options.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendMessageAlbum#74bcdacf: field options: %w", err) - } - b.Comma() - b.FieldStart("input_message_contents") - b.ArrStart() - for idx, v := range s.InputMessageContents { - if v == nil { - return fmt.Errorf("unable to encode sendMessageAlbum#74bcdacf: field input_message_contents element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendMessageAlbum#74bcdacf: field input_message_contents element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendMessageAlbumRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendMessageAlbum#74bcdacf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendMessageAlbum"); err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field chat_id: %w", err) - } - s.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field message_thread_id: %w", err) - } - s.MessageThreadID = value - case "reply_to": - value, err := DecodeTDLibJSONInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field reply_to: %w", err) - } - s.ReplyTo = value - case "options": - if err := s.Options.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field options: %w", err) - } - case "input_message_contents": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field input_message_contents: %w", err) - } - s.InputMessageContents = append(s.InputMessageContents, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode sendMessageAlbum#74bcdacf: field input_message_contents: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SendMessageAlbumRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (s *SendMessageAlbumRequest) GetMessageThreadID() (value int64) { - if s == nil { - return - } - return s.MessageThreadID -} - -// GetReplyTo returns value of ReplyTo field. -func (s *SendMessageAlbumRequest) GetReplyTo() (value InputMessageReplyToClass) { - if s == nil { - return - } - return s.ReplyTo -} - -// GetOptions returns value of Options field. -func (s *SendMessageAlbumRequest) GetOptions() (value MessageSendOptions) { - if s == nil { - return - } - return s.Options -} - -// GetInputMessageContents returns value of InputMessageContents field. -func (s *SendMessageAlbumRequest) GetInputMessageContents() (value []InputMessageContentClass) { - if s == nil { - return - } - return s.InputMessageContents -} - -// SendMessageAlbum invokes method sendMessageAlbum#74bcdacf returning error if any. -func (c *Client) SendMessageAlbum(ctx context.Context, request *SendMessageAlbumRequest) (*Messages, error) { - var result Messages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_message_gen.go b/tdapi/tl_send_message_gen.go deleted file mode 100644 index e1ab95588..000000000 --- a/tdapi/tl_send_message_gen.go +++ /dev/null @@ -1,403 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendMessageRequest represents TL type `sendMessage#e02d01e9`. -type SendMessageRequest struct { - // Target chat - ChatID int64 - // If not 0, the message thread identifier in which the message will be sent - MessageThreadID int64 - // Information about the message or story to be replied; pass null if none - ReplyTo InputMessageReplyToClass - // Options to be used to send the message; pass null to use default options - Options MessageSendOptions - // Markup for replying to the message; pass null if none; for bots only - ReplyMarkup ReplyMarkupClass - // The content of the message to be sent - InputMessageContent InputMessageContentClass -} - -// SendMessageRequestTypeID is TL type id of SendMessageRequest. -const SendMessageRequestTypeID = 0xe02d01e9 - -// Ensuring interfaces in compile-time for SendMessageRequest. -var ( - _ bin.Encoder = &SendMessageRequest{} - _ bin.Decoder = &SendMessageRequest{} - _ bin.BareEncoder = &SendMessageRequest{} - _ bin.BareDecoder = &SendMessageRequest{} -) - -func (s *SendMessageRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageThreadID == 0) { - return false - } - if !(s.ReplyTo == nil) { - return false - } - if !(s.Options.Zero()) { - return false - } - if !(s.ReplyMarkup == nil) { - return false - } - if !(s.InputMessageContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendMessageRequest) String() string { - if s == nil { - return "SendMessageRequest(nil)" - } - type Alias SendMessageRequest - return fmt.Sprintf("SendMessageRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendMessageRequest) TypeID() uint32 { - return SendMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendMessageRequest) TypeName() string { - return "sendMessage" -} - -// TypeInfo returns info about TL type. -func (s *SendMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendMessage", - ID: SendMessageRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "ReplyTo", - SchemaName: "reply_to", - }, - { - Name: "Options", - SchemaName: "options", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - { - Name: "InputMessageContent", - SchemaName: "input_message_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendMessageRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendMessage#e02d01e9 as nil") - } - b.PutID(SendMessageRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendMessageRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendMessage#e02d01e9 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageThreadID) - if s.ReplyTo == nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field reply_to is nil") - } - if err := s.ReplyTo.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field reply_to: %w", err) - } - if err := s.Options.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field options: %w", err) - } - if s.ReplyMarkup == nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field reply_markup is nil") - } - if err := s.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field reply_markup: %w", err) - } - if s.InputMessageContent == nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field input_message_content is nil") - } - if err := s.InputMessageContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field input_message_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SendMessageRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendMessage#e02d01e9 to nil") - } - if err := b.ConsumeID(SendMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendMessageRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendMessage#e02d01e9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field message_thread_id: %w", err) - } - s.MessageThreadID = value - } - { - value, err := DecodeInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field reply_to: %w", err) - } - s.ReplyTo = value - } - { - if err := s.Options.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field options: %w", err) - } - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field reply_markup: %w", err) - } - s.ReplyMarkup = value - } - { - value, err := DecodeInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field input_message_content: %w", err) - } - s.InputMessageContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendMessage#e02d01e9 as nil") - } - b.ObjStart() - b.PutID("sendMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(s.MessageThreadID) - b.Comma() - b.FieldStart("reply_to") - if s.ReplyTo == nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field reply_to is nil") - } - if err := s.ReplyTo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field reply_to: %w", err) - } - b.Comma() - b.FieldStart("options") - if err := s.Options.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field options: %w", err) - } - b.Comma() - b.FieldStart("reply_markup") - if s.ReplyMarkup == nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field reply_markup is nil") - } - if err := s.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field reply_markup: %w", err) - } - b.Comma() - b.FieldStart("input_message_content") - if s.InputMessageContent == nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field input_message_content is nil") - } - if err := s.InputMessageContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendMessage#e02d01e9: field input_message_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendMessage#e02d01e9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendMessage"); err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field chat_id: %w", err) - } - s.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field message_thread_id: %w", err) - } - s.MessageThreadID = value - case "reply_to": - value, err := DecodeTDLibJSONInputMessageReplyTo(b) - if err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field reply_to: %w", err) - } - s.ReplyTo = value - case "options": - if err := s.Options.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field options: %w", err) - } - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field reply_markup: %w", err) - } - s.ReplyMarkup = value - case "input_message_content": - value, err := DecodeTDLibJSONInputMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode sendMessage#e02d01e9: field input_message_content: %w", err) - } - s.InputMessageContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SendMessageRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (s *SendMessageRequest) GetMessageThreadID() (value int64) { - if s == nil { - return - } - return s.MessageThreadID -} - -// GetReplyTo returns value of ReplyTo field. -func (s *SendMessageRequest) GetReplyTo() (value InputMessageReplyToClass) { - if s == nil { - return - } - return s.ReplyTo -} - -// GetOptions returns value of Options field. -func (s *SendMessageRequest) GetOptions() (value MessageSendOptions) { - if s == nil { - return - } - return s.Options -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (s *SendMessageRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if s == nil { - return - } - return s.ReplyMarkup -} - -// GetInputMessageContent returns value of InputMessageContent field. -func (s *SendMessageRequest) GetInputMessageContent() (value InputMessageContentClass) { - if s == nil { - return - } - return s.InputMessageContent -} - -// SendMessage invokes method sendMessage#e02d01e9 returning error if any. -func (c *Client) SendMessage(ctx context.Context, request *SendMessageRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_passport_authorization_form_gen.go b/tdapi/tl_send_passport_authorization_form_gen.go deleted file mode 100644 index 78fbe3386..000000000 --- a/tdapi/tl_send_passport_authorization_form_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendPassportAuthorizationFormRequest represents TL type `sendPassportAuthorizationForm#d9c77579`. -type SendPassportAuthorizationFormRequest struct { - // Authorization form identifier - AuthorizationFormID int32 - // Types of Telegram Passport elements chosen by user to complete the authorization form - Types []PassportElementTypeClass -} - -// SendPassportAuthorizationFormRequestTypeID is TL type id of SendPassportAuthorizationFormRequest. -const SendPassportAuthorizationFormRequestTypeID = 0xd9c77579 - -// Ensuring interfaces in compile-time for SendPassportAuthorizationFormRequest. -var ( - _ bin.Encoder = &SendPassportAuthorizationFormRequest{} - _ bin.Decoder = &SendPassportAuthorizationFormRequest{} - _ bin.BareEncoder = &SendPassportAuthorizationFormRequest{} - _ bin.BareDecoder = &SendPassportAuthorizationFormRequest{} -) - -func (s *SendPassportAuthorizationFormRequest) Zero() bool { - if s == nil { - return true - } - if !(s.AuthorizationFormID == 0) { - return false - } - if !(s.Types == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendPassportAuthorizationFormRequest) String() string { - if s == nil { - return "SendPassportAuthorizationFormRequest(nil)" - } - type Alias SendPassportAuthorizationFormRequest - return fmt.Sprintf("SendPassportAuthorizationFormRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendPassportAuthorizationFormRequest) TypeID() uint32 { - return SendPassportAuthorizationFormRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendPassportAuthorizationFormRequest) TypeName() string { - return "sendPassportAuthorizationForm" -} - -// TypeInfo returns info about TL type. -func (s *SendPassportAuthorizationFormRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendPassportAuthorizationForm", - ID: SendPassportAuthorizationFormRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AuthorizationFormID", - SchemaName: "authorization_form_id", - }, - { - Name: "Types", - SchemaName: "types", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendPassportAuthorizationFormRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendPassportAuthorizationForm#d9c77579 as nil") - } - b.PutID(SendPassportAuthorizationFormRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendPassportAuthorizationFormRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendPassportAuthorizationForm#d9c77579 as nil") - } - b.PutInt32(s.AuthorizationFormID) - b.PutInt(len(s.Types)) - for idx, v := range s.Types { - if v == nil { - return fmt.Errorf("unable to encode sendPassportAuthorizationForm#d9c77579: field types element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare sendPassportAuthorizationForm#d9c77579: field types element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SendPassportAuthorizationFormRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendPassportAuthorizationForm#d9c77579 to nil") - } - if err := b.ConsumeID(SendPassportAuthorizationFormRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendPassportAuthorizationForm#d9c77579: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendPassportAuthorizationFormRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendPassportAuthorizationForm#d9c77579 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendPassportAuthorizationForm#d9c77579: field authorization_form_id: %w", err) - } - s.AuthorizationFormID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode sendPassportAuthorizationForm#d9c77579: field types: %w", err) - } - - if headerLen > 0 { - s.Types = make([]PassportElementTypeClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode sendPassportAuthorizationForm#d9c77579: field types: %w", err) - } - s.Types = append(s.Types, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendPassportAuthorizationFormRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendPassportAuthorizationForm#d9c77579 as nil") - } - b.ObjStart() - b.PutID("sendPassportAuthorizationForm") - b.Comma() - b.FieldStart("authorization_form_id") - b.PutInt32(s.AuthorizationFormID) - b.Comma() - b.FieldStart("types") - b.ArrStart() - for idx, v := range s.Types { - if v == nil { - return fmt.Errorf("unable to encode sendPassportAuthorizationForm#d9c77579: field types element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendPassportAuthorizationForm#d9c77579: field types element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendPassportAuthorizationFormRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendPassportAuthorizationForm#d9c77579 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendPassportAuthorizationForm"); err != nil { - return fmt.Errorf("unable to decode sendPassportAuthorizationForm#d9c77579: %w", err) - } - case "authorization_form_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendPassportAuthorizationForm#d9c77579: field authorization_form_id: %w", err) - } - s.AuthorizationFormID = value - case "types": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPassportElementType(b) - if err != nil { - return fmt.Errorf("unable to decode sendPassportAuthorizationForm#d9c77579: field types: %w", err) - } - s.Types = append(s.Types, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode sendPassportAuthorizationForm#d9c77579: field types: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAuthorizationFormID returns value of AuthorizationFormID field. -func (s *SendPassportAuthorizationFormRequest) GetAuthorizationFormID() (value int32) { - if s == nil { - return - } - return s.AuthorizationFormID -} - -// GetTypes returns value of Types field. -func (s *SendPassportAuthorizationFormRequest) GetTypes() (value []PassportElementTypeClass) { - if s == nil { - return - } - return s.Types -} - -// SendPassportAuthorizationForm invokes method sendPassportAuthorizationForm#d9c77579 returning error if any. -func (c *Client) SendPassportAuthorizationForm(ctx context.Context, request *SendPassportAuthorizationFormRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_send_payment_form_gen.go b/tdapi/tl_send_payment_form_gen.go deleted file mode 100644 index ded748dd7..000000000 --- a/tdapi/tl_send_payment_form_gen.go +++ /dev/null @@ -1,393 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendPaymentFormRequest represents TL type `sendPaymentForm#c66e388a`. -type SendPaymentFormRequest struct { - // The invoice - InputInvoice InputInvoiceClass - // Payment form identifier returned by getPaymentForm - PaymentFormID int64 - // Identifier returned by validateOrderInfo, or an empty string - OrderInfoID string - // Identifier of a chosen shipping option, if applicable - ShippingOptionID string - // The credentials chosen by user for payment; pass null for a payment in Telegram Stars - Credentials InputCredentialsClass - // Chosen by the user amount of tip in the smallest units of the currency - TipAmount int64 -} - -// SendPaymentFormRequestTypeID is TL type id of SendPaymentFormRequest. -const SendPaymentFormRequestTypeID = 0xc66e388a - -// Ensuring interfaces in compile-time for SendPaymentFormRequest. -var ( - _ bin.Encoder = &SendPaymentFormRequest{} - _ bin.Decoder = &SendPaymentFormRequest{} - _ bin.BareEncoder = &SendPaymentFormRequest{} - _ bin.BareDecoder = &SendPaymentFormRequest{} -) - -func (s *SendPaymentFormRequest) Zero() bool { - if s == nil { - return true - } - if !(s.InputInvoice == nil) { - return false - } - if !(s.PaymentFormID == 0) { - return false - } - if !(s.OrderInfoID == "") { - return false - } - if !(s.ShippingOptionID == "") { - return false - } - if !(s.Credentials == nil) { - return false - } - if !(s.TipAmount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendPaymentFormRequest) String() string { - if s == nil { - return "SendPaymentFormRequest(nil)" - } - type Alias SendPaymentFormRequest - return fmt.Sprintf("SendPaymentFormRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendPaymentFormRequest) TypeID() uint32 { - return SendPaymentFormRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendPaymentFormRequest) TypeName() string { - return "sendPaymentForm" -} - -// TypeInfo returns info about TL type. -func (s *SendPaymentFormRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendPaymentForm", - ID: SendPaymentFormRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InputInvoice", - SchemaName: "input_invoice", - }, - { - Name: "PaymentFormID", - SchemaName: "payment_form_id", - }, - { - Name: "OrderInfoID", - SchemaName: "order_info_id", - }, - { - Name: "ShippingOptionID", - SchemaName: "shipping_option_id", - }, - { - Name: "Credentials", - SchemaName: "credentials", - }, - { - Name: "TipAmount", - SchemaName: "tip_amount", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendPaymentFormRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendPaymentForm#c66e388a as nil") - } - b.PutID(SendPaymentFormRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendPaymentFormRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendPaymentForm#c66e388a as nil") - } - if s.InputInvoice == nil { - return fmt.Errorf("unable to encode sendPaymentForm#c66e388a: field input_invoice is nil") - } - if err := s.InputInvoice.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendPaymentForm#c66e388a: field input_invoice: %w", err) - } - b.PutLong(s.PaymentFormID) - b.PutString(s.OrderInfoID) - b.PutString(s.ShippingOptionID) - if s.Credentials == nil { - return fmt.Errorf("unable to encode sendPaymentForm#c66e388a: field credentials is nil") - } - if err := s.Credentials.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendPaymentForm#c66e388a: field credentials: %w", err) - } - b.PutInt53(s.TipAmount) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendPaymentFormRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendPaymentForm#c66e388a to nil") - } - if err := b.ConsumeID(SendPaymentFormRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendPaymentFormRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendPaymentForm#c66e388a to nil") - } - { - value, err := DecodeInputInvoice(b) - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field input_invoice: %w", err) - } - s.InputInvoice = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field payment_form_id: %w", err) - } - s.PaymentFormID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field order_info_id: %w", err) - } - s.OrderInfoID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field shipping_option_id: %w", err) - } - s.ShippingOptionID = value - } - { - value, err := DecodeInputCredentials(b) - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field credentials: %w", err) - } - s.Credentials = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field tip_amount: %w", err) - } - s.TipAmount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendPaymentFormRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendPaymentForm#c66e388a as nil") - } - b.ObjStart() - b.PutID("sendPaymentForm") - b.Comma() - b.FieldStart("input_invoice") - if s.InputInvoice == nil { - return fmt.Errorf("unable to encode sendPaymentForm#c66e388a: field input_invoice is nil") - } - if err := s.InputInvoice.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendPaymentForm#c66e388a: field input_invoice: %w", err) - } - b.Comma() - b.FieldStart("payment_form_id") - b.PutLong(s.PaymentFormID) - b.Comma() - b.FieldStart("order_info_id") - b.PutString(s.OrderInfoID) - b.Comma() - b.FieldStart("shipping_option_id") - b.PutString(s.ShippingOptionID) - b.Comma() - b.FieldStart("credentials") - if s.Credentials == nil { - return fmt.Errorf("unable to encode sendPaymentForm#c66e388a: field credentials is nil") - } - if err := s.Credentials.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendPaymentForm#c66e388a: field credentials: %w", err) - } - b.Comma() - b.FieldStart("tip_amount") - b.PutInt53(s.TipAmount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendPaymentFormRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendPaymentForm#c66e388a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendPaymentForm"); err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: %w", err) - } - case "input_invoice": - value, err := DecodeTDLibJSONInputInvoice(b) - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field input_invoice: %w", err) - } - s.InputInvoice = value - case "payment_form_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field payment_form_id: %w", err) - } - s.PaymentFormID = value - case "order_info_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field order_info_id: %w", err) - } - s.OrderInfoID = value - case "shipping_option_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field shipping_option_id: %w", err) - } - s.ShippingOptionID = value - case "credentials": - value, err := DecodeTDLibJSONInputCredentials(b) - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field credentials: %w", err) - } - s.Credentials = value - case "tip_amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendPaymentForm#c66e388a: field tip_amount: %w", err) - } - s.TipAmount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInputInvoice returns value of InputInvoice field. -func (s *SendPaymentFormRequest) GetInputInvoice() (value InputInvoiceClass) { - if s == nil { - return - } - return s.InputInvoice -} - -// GetPaymentFormID returns value of PaymentFormID field. -func (s *SendPaymentFormRequest) GetPaymentFormID() (value int64) { - if s == nil { - return - } - return s.PaymentFormID -} - -// GetOrderInfoID returns value of OrderInfoID field. -func (s *SendPaymentFormRequest) GetOrderInfoID() (value string) { - if s == nil { - return - } - return s.OrderInfoID -} - -// GetShippingOptionID returns value of ShippingOptionID field. -func (s *SendPaymentFormRequest) GetShippingOptionID() (value string) { - if s == nil { - return - } - return s.ShippingOptionID -} - -// GetCredentials returns value of Credentials field. -func (s *SendPaymentFormRequest) GetCredentials() (value InputCredentialsClass) { - if s == nil { - return - } - return s.Credentials -} - -// GetTipAmount returns value of TipAmount field. -func (s *SendPaymentFormRequest) GetTipAmount() (value int64) { - if s == nil { - return - } - return s.TipAmount -} - -// SendPaymentForm invokes method sendPaymentForm#c66e388a returning error if any. -func (c *Client) SendPaymentForm(ctx context.Context, request *SendPaymentFormRequest) (*PaymentResult, error) { - var result PaymentResult - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_phone_number_code_gen.go b/tdapi/tl_send_phone_number_code_gen.go deleted file mode 100644 index bb968ca31..000000000 --- a/tdapi/tl_send_phone_number_code_gen.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendPhoneNumberCodeRequest represents TL type `sendPhoneNumberCode#409e3d10`. -type SendPhoneNumberCodeRequest struct { - // The phone number, in international format - PhoneNumber string - // Settings for the authentication of the user's phone number; pass null to use default - // settings - Settings PhoneNumberAuthenticationSettings - // Type of the request for which the code is sent - Type PhoneNumberCodeTypeClass -} - -// SendPhoneNumberCodeRequestTypeID is TL type id of SendPhoneNumberCodeRequest. -const SendPhoneNumberCodeRequestTypeID = 0x409e3d10 - -// Ensuring interfaces in compile-time for SendPhoneNumberCodeRequest. -var ( - _ bin.Encoder = &SendPhoneNumberCodeRequest{} - _ bin.Decoder = &SendPhoneNumberCodeRequest{} - _ bin.BareEncoder = &SendPhoneNumberCodeRequest{} - _ bin.BareDecoder = &SendPhoneNumberCodeRequest{} -) - -func (s *SendPhoneNumberCodeRequest) Zero() bool { - if s == nil { - return true - } - if !(s.PhoneNumber == "") { - return false - } - if !(s.Settings.Zero()) { - return false - } - if !(s.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendPhoneNumberCodeRequest) String() string { - if s == nil { - return "SendPhoneNumberCodeRequest(nil)" - } - type Alias SendPhoneNumberCodeRequest - return fmt.Sprintf("SendPhoneNumberCodeRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendPhoneNumberCodeRequest) TypeID() uint32 { - return SendPhoneNumberCodeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendPhoneNumberCodeRequest) TypeName() string { - return "sendPhoneNumberCode" -} - -// TypeInfo returns info about TL type. -func (s *SendPhoneNumberCodeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendPhoneNumberCode", - ID: SendPhoneNumberCodeRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - { - Name: "Settings", - SchemaName: "settings", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendPhoneNumberCodeRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendPhoneNumberCode#409e3d10 as nil") - } - b.PutID(SendPhoneNumberCodeRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendPhoneNumberCodeRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendPhoneNumberCode#409e3d10 as nil") - } - b.PutString(s.PhoneNumber) - if err := s.Settings.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendPhoneNumberCode#409e3d10: field settings: %w", err) - } - if s.Type == nil { - return fmt.Errorf("unable to encode sendPhoneNumberCode#409e3d10: field type is nil") - } - if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendPhoneNumberCode#409e3d10: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SendPhoneNumberCodeRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendPhoneNumberCode#409e3d10 to nil") - } - if err := b.ConsumeID(SendPhoneNumberCodeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberCode#409e3d10: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendPhoneNumberCodeRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendPhoneNumberCode#409e3d10 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberCode#409e3d10: field phone_number: %w", err) - } - s.PhoneNumber = value - } - { - if err := s.Settings.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberCode#409e3d10: field settings: %w", err) - } - } - { - value, err := DecodePhoneNumberCodeType(b) - if err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberCode#409e3d10: field type: %w", err) - } - s.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendPhoneNumberCodeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendPhoneNumberCode#409e3d10 as nil") - } - b.ObjStart() - b.PutID("sendPhoneNumberCode") - b.Comma() - b.FieldStart("phone_number") - b.PutString(s.PhoneNumber) - b.Comma() - b.FieldStart("settings") - if err := s.Settings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendPhoneNumberCode#409e3d10: field settings: %w", err) - } - b.Comma() - b.FieldStart("type") - if s.Type == nil { - return fmt.Errorf("unable to encode sendPhoneNumberCode#409e3d10: field type is nil") - } - if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendPhoneNumberCode#409e3d10: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendPhoneNumberCodeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendPhoneNumberCode#409e3d10 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendPhoneNumberCode"); err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberCode#409e3d10: %w", err) - } - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberCode#409e3d10: field phone_number: %w", err) - } - s.PhoneNumber = value - case "settings": - if err := s.Settings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberCode#409e3d10: field settings: %w", err) - } - case "type": - value, err := DecodeTDLibJSONPhoneNumberCodeType(b) - if err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberCode#409e3d10: field type: %w", err) - } - s.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (s *SendPhoneNumberCodeRequest) GetPhoneNumber() (value string) { - if s == nil { - return - } - return s.PhoneNumber -} - -// GetSettings returns value of Settings field. -func (s *SendPhoneNumberCodeRequest) GetSettings() (value PhoneNumberAuthenticationSettings) { - if s == nil { - return - } - return s.Settings -} - -// GetType returns value of Type field. -func (s *SendPhoneNumberCodeRequest) GetType() (value PhoneNumberCodeTypeClass) { - if s == nil { - return - } - return s.Type -} - -// SendPhoneNumberCode invokes method sendPhoneNumberCode#409e3d10 returning error if any. -func (c *Client) SendPhoneNumberCode(ctx context.Context, request *SendPhoneNumberCodeRequest) (*AuthenticationCodeInfo, error) { - var result AuthenticationCodeInfo - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_phone_number_firebase_sms_gen.go b/tdapi/tl_send_phone_number_firebase_sms_gen.go deleted file mode 100644 index 9a2d1c43e..000000000 --- a/tdapi/tl_send_phone_number_firebase_sms_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendPhoneNumberFirebaseSMSRequest represents TL type `sendPhoneNumberFirebaseSms#f9c7084`. -type SendPhoneNumberFirebaseSMSRequest struct { - // Play Integrity API or SafetyNet Attestation API token for the Android application, or - // secret from push notification for the iOS application - Token string -} - -// SendPhoneNumberFirebaseSMSRequestTypeID is TL type id of SendPhoneNumberFirebaseSMSRequest. -const SendPhoneNumberFirebaseSMSRequestTypeID = 0xf9c7084 - -// Ensuring interfaces in compile-time for SendPhoneNumberFirebaseSMSRequest. -var ( - _ bin.Encoder = &SendPhoneNumberFirebaseSMSRequest{} - _ bin.Decoder = &SendPhoneNumberFirebaseSMSRequest{} - _ bin.BareEncoder = &SendPhoneNumberFirebaseSMSRequest{} - _ bin.BareDecoder = &SendPhoneNumberFirebaseSMSRequest{} -) - -func (s *SendPhoneNumberFirebaseSMSRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Token == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendPhoneNumberFirebaseSMSRequest) String() string { - if s == nil { - return "SendPhoneNumberFirebaseSMSRequest(nil)" - } - type Alias SendPhoneNumberFirebaseSMSRequest - return fmt.Sprintf("SendPhoneNumberFirebaseSMSRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendPhoneNumberFirebaseSMSRequest) TypeID() uint32 { - return SendPhoneNumberFirebaseSMSRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendPhoneNumberFirebaseSMSRequest) TypeName() string { - return "sendPhoneNumberFirebaseSms" -} - -// TypeInfo returns info about TL type. -func (s *SendPhoneNumberFirebaseSMSRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendPhoneNumberFirebaseSms", - ID: SendPhoneNumberFirebaseSMSRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendPhoneNumberFirebaseSMSRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendPhoneNumberFirebaseSms#f9c7084 as nil") - } - b.PutID(SendPhoneNumberFirebaseSMSRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendPhoneNumberFirebaseSMSRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendPhoneNumberFirebaseSms#f9c7084 as nil") - } - b.PutString(s.Token) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendPhoneNumberFirebaseSMSRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendPhoneNumberFirebaseSms#f9c7084 to nil") - } - if err := b.ConsumeID(SendPhoneNumberFirebaseSMSRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberFirebaseSms#f9c7084: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendPhoneNumberFirebaseSMSRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendPhoneNumberFirebaseSms#f9c7084 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberFirebaseSms#f9c7084: field token: %w", err) - } - s.Token = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendPhoneNumberFirebaseSMSRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendPhoneNumberFirebaseSms#f9c7084 as nil") - } - b.ObjStart() - b.PutID("sendPhoneNumberFirebaseSms") - b.Comma() - b.FieldStart("token") - b.PutString(s.Token) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendPhoneNumberFirebaseSMSRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendPhoneNumberFirebaseSms#f9c7084 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendPhoneNumberFirebaseSms"); err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberFirebaseSms#f9c7084: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendPhoneNumberFirebaseSms#f9c7084: field token: %w", err) - } - s.Token = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (s *SendPhoneNumberFirebaseSMSRequest) GetToken() (value string) { - if s == nil { - return - } - return s.Token -} - -// SendPhoneNumberFirebaseSMS invokes method sendPhoneNumberFirebaseSms#f9c7084 returning error if any. -func (c *Client) SendPhoneNumberFirebaseSMS(ctx context.Context, token string) error { - var ok Ok - - request := &SendPhoneNumberFirebaseSMSRequest{ - Token: token, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_send_quick_reply_shortcut_messages_gen.go b/tdapi/tl_send_quick_reply_shortcut_messages_gen.go deleted file mode 100644 index 1702a4ed6..000000000 --- a/tdapi/tl_send_quick_reply_shortcut_messages_gen.go +++ /dev/null @@ -1,274 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendQuickReplyShortcutMessagesRequest represents TL type `sendQuickReplyShortcutMessages#dd5169d`. -type SendQuickReplyShortcutMessagesRequest struct { - // Identifier of the chat to which to send messages. The chat must be a private chat with - // a regular user - ChatID int64 - // Unique identifier of the quick reply shortcut - ShortcutID int32 - // Non-persistent identifier, which will be returned back in messageSendingStatePending - // object and can be used to match sent messages and corresponding updateNewMessage - // updates - SendingID int32 -} - -// SendQuickReplyShortcutMessagesRequestTypeID is TL type id of SendQuickReplyShortcutMessagesRequest. -const SendQuickReplyShortcutMessagesRequestTypeID = 0xdd5169d - -// Ensuring interfaces in compile-time for SendQuickReplyShortcutMessagesRequest. -var ( - _ bin.Encoder = &SendQuickReplyShortcutMessagesRequest{} - _ bin.Decoder = &SendQuickReplyShortcutMessagesRequest{} - _ bin.BareEncoder = &SendQuickReplyShortcutMessagesRequest{} - _ bin.BareDecoder = &SendQuickReplyShortcutMessagesRequest{} -) - -func (s *SendQuickReplyShortcutMessagesRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.ShortcutID == 0) { - return false - } - if !(s.SendingID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendQuickReplyShortcutMessagesRequest) String() string { - if s == nil { - return "SendQuickReplyShortcutMessagesRequest(nil)" - } - type Alias SendQuickReplyShortcutMessagesRequest - return fmt.Sprintf("SendQuickReplyShortcutMessagesRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendQuickReplyShortcutMessagesRequest) TypeID() uint32 { - return SendQuickReplyShortcutMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendQuickReplyShortcutMessagesRequest) TypeName() string { - return "sendQuickReplyShortcutMessages" -} - -// TypeInfo returns info about TL type. -func (s *SendQuickReplyShortcutMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendQuickReplyShortcutMessages", - ID: SendQuickReplyShortcutMessagesRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ShortcutID", - SchemaName: "shortcut_id", - }, - { - Name: "SendingID", - SchemaName: "sending_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendQuickReplyShortcutMessagesRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendQuickReplyShortcutMessages#dd5169d as nil") - } - b.PutID(SendQuickReplyShortcutMessagesRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendQuickReplyShortcutMessagesRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendQuickReplyShortcutMessages#dd5169d as nil") - } - b.PutInt53(s.ChatID) - b.PutInt32(s.ShortcutID) - b.PutInt32(s.SendingID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendQuickReplyShortcutMessagesRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendQuickReplyShortcutMessages#dd5169d to nil") - } - if err := b.ConsumeID(SendQuickReplyShortcutMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendQuickReplyShortcutMessagesRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendQuickReplyShortcutMessages#dd5169d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field shortcut_id: %w", err) - } - s.ShortcutID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field sending_id: %w", err) - } - s.SendingID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendQuickReplyShortcutMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendQuickReplyShortcutMessages#dd5169d as nil") - } - b.ObjStart() - b.PutID("sendQuickReplyShortcutMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("shortcut_id") - b.PutInt32(s.ShortcutID) - b.Comma() - b.FieldStart("sending_id") - b.PutInt32(s.SendingID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendQuickReplyShortcutMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendQuickReplyShortcutMessages#dd5169d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendQuickReplyShortcutMessages"); err != nil { - return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field chat_id: %w", err) - } - s.ChatID = value - case "shortcut_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field shortcut_id: %w", err) - } - s.ShortcutID = value - case "sending_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendQuickReplyShortcutMessages#dd5169d: field sending_id: %w", err) - } - s.SendingID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SendQuickReplyShortcutMessagesRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetShortcutID returns value of ShortcutID field. -func (s *SendQuickReplyShortcutMessagesRequest) GetShortcutID() (value int32) { - if s == nil { - return - } - return s.ShortcutID -} - -// GetSendingID returns value of SendingID field. -func (s *SendQuickReplyShortcutMessagesRequest) GetSendingID() (value int32) { - if s == nil { - return - } - return s.SendingID -} - -// SendQuickReplyShortcutMessages invokes method sendQuickReplyShortcutMessages#dd5169d returning error if any. -func (c *Client) SendQuickReplyShortcutMessages(ctx context.Context, request *SendQuickReplyShortcutMessagesRequest) (*Messages, error) { - var result Messages - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_story_gen.go b/tdapi/tl_send_story_gen.go deleted file mode 100644 index e40f65af3..000000000 --- a/tdapi/tl_send_story_gen.go +++ /dev/null @@ -1,502 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendStoryRequest represents TL type `sendStory#e6ab3302`. -type SendStoryRequest struct { - // Identifier of the chat that will post the story. Pass Saved Messages chat identifier - // when posting a story on behalf of the current user - ChatID int64 - // Content of the story - Content InputStoryContentClass - // Clickable rectangle areas to be shown on the story media; pass null if none - Areas InputStoryAreas - // Story caption; pass null to use an empty caption; - // 0-getOption("story_caption_length_max") characters; can have entities only if - // getOption("can_use_text_entities_in_story_caption") - Caption FormattedText - // The privacy settings for the story; ignored for stories sent to supergroup and channel - // chats - PrivacySettings StoryPrivacySettingsClass - // Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, - // 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise - ActivePeriod int32 - // Full identifier of the original story, which content was used to create the story; - // pass null if the story isn't repost of another story - FromStoryFullID StoryFullID - // Pass true to keep the story accessible after expiration - IsPostedToChatPage bool - // Pass true if the content of the story must be protected from forwarding and - // screenshotting - ProtectContent bool -} - -// SendStoryRequestTypeID is TL type id of SendStoryRequest. -const SendStoryRequestTypeID = 0xe6ab3302 - -// Ensuring interfaces in compile-time for SendStoryRequest. -var ( - _ bin.Encoder = &SendStoryRequest{} - _ bin.Decoder = &SendStoryRequest{} - _ bin.BareEncoder = &SendStoryRequest{} - _ bin.BareDecoder = &SendStoryRequest{} -) - -func (s *SendStoryRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Content == nil) { - return false - } - if !(s.Areas.Zero()) { - return false - } - if !(s.Caption.Zero()) { - return false - } - if !(s.PrivacySettings == nil) { - return false - } - if !(s.ActivePeriod == 0) { - return false - } - if !(s.FromStoryFullID.Zero()) { - return false - } - if !(s.IsPostedToChatPage == false) { - return false - } - if !(s.ProtectContent == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendStoryRequest) String() string { - if s == nil { - return "SendStoryRequest(nil)" - } - type Alias SendStoryRequest - return fmt.Sprintf("SendStoryRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendStoryRequest) TypeID() uint32 { - return SendStoryRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendStoryRequest) TypeName() string { - return "sendStory" -} - -// TypeInfo returns info about TL type. -func (s *SendStoryRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendStory", - ID: SendStoryRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Content", - SchemaName: "content", - }, - { - Name: "Areas", - SchemaName: "areas", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - { - Name: "PrivacySettings", - SchemaName: "privacy_settings", - }, - { - Name: "ActivePeriod", - SchemaName: "active_period", - }, - { - Name: "FromStoryFullID", - SchemaName: "from_story_full_id", - }, - { - Name: "IsPostedToChatPage", - SchemaName: "is_posted_to_chat_page", - }, - { - Name: "ProtectContent", - SchemaName: "protect_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendStoryRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendStory#e6ab3302 as nil") - } - b.PutID(SendStoryRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendStoryRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendStory#e6ab3302 as nil") - } - b.PutInt53(s.ChatID) - if s.Content == nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field content is nil") - } - if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field content: %w", err) - } - if err := s.Areas.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field areas: %w", err) - } - if err := s.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field caption: %w", err) - } - if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field privacy_settings is nil") - } - if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field privacy_settings: %w", err) - } - b.PutInt32(s.ActivePeriod) - if err := s.FromStoryFullID.Encode(b); err != nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field from_story_full_id: %w", err) - } - b.PutBool(s.IsPostedToChatPage) - b.PutBool(s.ProtectContent) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendStoryRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendStory#e6ab3302 to nil") - } - if err := b.ConsumeID(SendStoryRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendStoryRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendStory#e6ab3302 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := DecodeInputStoryContent(b) - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field content: %w", err) - } - s.Content = value - } - { - if err := s.Areas.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field areas: %w", err) - } - } - { - if err := s.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field caption: %w", err) - } - } - { - value, err := DecodeStoryPrivacySettings(b) - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field privacy_settings: %w", err) - } - s.PrivacySettings = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field active_period: %w", err) - } - s.ActivePeriod = value - } - { - if err := s.FromStoryFullID.Decode(b); err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field from_story_full_id: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field is_posted_to_chat_page: %w", err) - } - s.IsPostedToChatPage = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field protect_content: %w", err) - } - s.ProtectContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendStoryRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendStory#e6ab3302 as nil") - } - b.ObjStart() - b.PutID("sendStory") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("content") - if s.Content == nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field content is nil") - } - if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field content: %w", err) - } - b.Comma() - b.FieldStart("areas") - if err := s.Areas.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field areas: %w", err) - } - b.Comma() - b.FieldStart("caption") - if err := s.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field caption: %w", err) - } - b.Comma() - b.FieldStart("privacy_settings") - if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field privacy_settings is nil") - } - if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field privacy_settings: %w", err) - } - b.Comma() - b.FieldStart("active_period") - b.PutInt32(s.ActivePeriod) - b.Comma() - b.FieldStart("from_story_full_id") - if err := s.FromStoryFullID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sendStory#e6ab3302: field from_story_full_id: %w", err) - } - b.Comma() - b.FieldStart("is_posted_to_chat_page") - b.PutBool(s.IsPostedToChatPage) - b.Comma() - b.FieldStart("protect_content") - b.PutBool(s.ProtectContent) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendStoryRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendStory#e6ab3302 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendStory"); err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field chat_id: %w", err) - } - s.ChatID = value - case "content": - value, err := DecodeTDLibJSONInputStoryContent(b) - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field content: %w", err) - } - s.Content = value - case "areas": - if err := s.Areas.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field areas: %w", err) - } - case "caption": - if err := s.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field caption: %w", err) - } - case "privacy_settings": - value, err := DecodeTDLibJSONStoryPrivacySettings(b) - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field privacy_settings: %w", err) - } - s.PrivacySettings = value - case "active_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field active_period: %w", err) - } - s.ActivePeriod = value - case "from_story_full_id": - if err := s.FromStoryFullID.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field from_story_full_id: %w", err) - } - case "is_posted_to_chat_page": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field is_posted_to_chat_page: %w", err) - } - s.IsPostedToChatPage = value - case "protect_content": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sendStory#e6ab3302: field protect_content: %w", err) - } - s.ProtectContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SendStoryRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetContent returns value of Content field. -func (s *SendStoryRequest) GetContent() (value InputStoryContentClass) { - if s == nil { - return - } - return s.Content -} - -// GetAreas returns value of Areas field. -func (s *SendStoryRequest) GetAreas() (value InputStoryAreas) { - if s == nil { - return - } - return s.Areas -} - -// GetCaption returns value of Caption field. -func (s *SendStoryRequest) GetCaption() (value FormattedText) { - if s == nil { - return - } - return s.Caption -} - -// GetPrivacySettings returns value of PrivacySettings field. -func (s *SendStoryRequest) GetPrivacySettings() (value StoryPrivacySettingsClass) { - if s == nil { - return - } - return s.PrivacySettings -} - -// GetActivePeriod returns value of ActivePeriod field. -func (s *SendStoryRequest) GetActivePeriod() (value int32) { - if s == nil { - return - } - return s.ActivePeriod -} - -// GetFromStoryFullID returns value of FromStoryFullID field. -func (s *SendStoryRequest) GetFromStoryFullID() (value StoryFullID) { - if s == nil { - return - } - return s.FromStoryFullID -} - -// GetIsPostedToChatPage returns value of IsPostedToChatPage field. -func (s *SendStoryRequest) GetIsPostedToChatPage() (value bool) { - if s == nil { - return - } - return s.IsPostedToChatPage -} - -// GetProtectContent returns value of ProtectContent field. -func (s *SendStoryRequest) GetProtectContent() (value bool) { - if s == nil { - return - } - return s.ProtectContent -} - -// SendStory invokes method sendStory#e6ab3302 returning error if any. -func (c *Client) SendStory(ctx context.Context, request *SendStoryRequest) (*Story, error) { - var result Story - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_web_app_custom_request_gen.go b/tdapi/tl_send_web_app_custom_request_gen.go deleted file mode 100644 index 08b206792..000000000 --- a/tdapi/tl_send_web_app_custom_request_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendWebAppCustomRequestRequest represents TL type `sendWebAppCustomRequest#36ff5dc8`. -type SendWebAppCustomRequestRequest struct { - // Identifier of the bot - BotUserID int64 - // The method name - Method string - // JSON-serialized method parameters - Parameters string -} - -// SendWebAppCustomRequestRequestTypeID is TL type id of SendWebAppCustomRequestRequest. -const SendWebAppCustomRequestRequestTypeID = 0x36ff5dc8 - -// Ensuring interfaces in compile-time for SendWebAppCustomRequestRequest. -var ( - _ bin.Encoder = &SendWebAppCustomRequestRequest{} - _ bin.Decoder = &SendWebAppCustomRequestRequest{} - _ bin.BareEncoder = &SendWebAppCustomRequestRequest{} - _ bin.BareDecoder = &SendWebAppCustomRequestRequest{} -) - -func (s *SendWebAppCustomRequestRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BotUserID == 0) { - return false - } - if !(s.Method == "") { - return false - } - if !(s.Parameters == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendWebAppCustomRequestRequest) String() string { - if s == nil { - return "SendWebAppCustomRequestRequest(nil)" - } - type Alias SendWebAppCustomRequestRequest - return fmt.Sprintf("SendWebAppCustomRequestRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendWebAppCustomRequestRequest) TypeID() uint32 { - return SendWebAppCustomRequestRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendWebAppCustomRequestRequest) TypeName() string { - return "sendWebAppCustomRequest" -} - -// TypeInfo returns info about TL type. -func (s *SendWebAppCustomRequestRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendWebAppCustomRequest", - ID: SendWebAppCustomRequestRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Method", - SchemaName: "method", - }, - { - Name: "Parameters", - SchemaName: "parameters", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendWebAppCustomRequestRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendWebAppCustomRequest#36ff5dc8 as nil") - } - b.PutID(SendWebAppCustomRequestRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendWebAppCustomRequestRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendWebAppCustomRequest#36ff5dc8 as nil") - } - b.PutInt53(s.BotUserID) - b.PutString(s.Method) - b.PutString(s.Parameters) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendWebAppCustomRequestRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendWebAppCustomRequest#36ff5dc8 to nil") - } - if err := b.ConsumeID(SendWebAppCustomRequestRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendWebAppCustomRequest#36ff5dc8: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendWebAppCustomRequestRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendWebAppCustomRequest#36ff5dc8 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppCustomRequest#36ff5dc8: field bot_user_id: %w", err) - } - s.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppCustomRequest#36ff5dc8: field method: %w", err) - } - s.Method = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppCustomRequest#36ff5dc8: field parameters: %w", err) - } - s.Parameters = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendWebAppCustomRequestRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendWebAppCustomRequest#36ff5dc8 as nil") - } - b.ObjStart() - b.PutID("sendWebAppCustomRequest") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(s.BotUserID) - b.Comma() - b.FieldStart("method") - b.PutString(s.Method) - b.Comma() - b.FieldStart("parameters") - b.PutString(s.Parameters) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendWebAppCustomRequestRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendWebAppCustomRequest#36ff5dc8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendWebAppCustomRequest"); err != nil { - return fmt.Errorf("unable to decode sendWebAppCustomRequest#36ff5dc8: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppCustomRequest#36ff5dc8: field bot_user_id: %w", err) - } - s.BotUserID = value - case "method": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppCustomRequest#36ff5dc8: field method: %w", err) - } - s.Method = value - case "parameters": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppCustomRequest#36ff5dc8: field parameters: %w", err) - } - s.Parameters = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (s *SendWebAppCustomRequestRequest) GetBotUserID() (value int64) { - if s == nil { - return - } - return s.BotUserID -} - -// GetMethod returns value of Method field. -func (s *SendWebAppCustomRequestRequest) GetMethod() (value string) { - if s == nil { - return - } - return s.Method -} - -// GetParameters returns value of Parameters field. -func (s *SendWebAppCustomRequestRequest) GetParameters() (value string) { - if s == nil { - return - } - return s.Parameters -} - -// SendWebAppCustomRequest invokes method sendWebAppCustomRequest#36ff5dc8 returning error if any. -func (c *Client) SendWebAppCustomRequest(ctx context.Context, request *SendWebAppCustomRequestRequest) (*CustomRequestResult, error) { - var result CustomRequestResult - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_send_web_app_data_gen.go b/tdapi/tl_send_web_app_data_gen.go deleted file mode 100644 index 95a9165f0..000000000 --- a/tdapi/tl_send_web_app_data_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SendWebAppDataRequest represents TL type `sendWebAppData#ab1fce0c`. -type SendWebAppDataRequest struct { - // Identifier of the target bot - BotUserID int64 - // Text of the keyboardButtonTypeWebApp button, which opened the Web App - ButtonText string - // The data - Data string -} - -// SendWebAppDataRequestTypeID is TL type id of SendWebAppDataRequest. -const SendWebAppDataRequestTypeID = 0xab1fce0c - -// Ensuring interfaces in compile-time for SendWebAppDataRequest. -var ( - _ bin.Encoder = &SendWebAppDataRequest{} - _ bin.Decoder = &SendWebAppDataRequest{} - _ bin.BareEncoder = &SendWebAppDataRequest{} - _ bin.BareDecoder = &SendWebAppDataRequest{} -) - -func (s *SendWebAppDataRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BotUserID == 0) { - return false - } - if !(s.ButtonText == "") { - return false - } - if !(s.Data == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SendWebAppDataRequest) String() string { - if s == nil { - return "SendWebAppDataRequest(nil)" - } - type Alias SendWebAppDataRequest - return fmt.Sprintf("SendWebAppDataRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SendWebAppDataRequest) TypeID() uint32 { - return SendWebAppDataRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SendWebAppDataRequest) TypeName() string { - return "sendWebAppData" -} - -// TypeInfo returns info about TL type. -func (s *SendWebAppDataRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sendWebAppData", - ID: SendWebAppDataRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "ButtonText", - SchemaName: "button_text", - }, - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SendWebAppDataRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendWebAppData#ab1fce0c as nil") - } - b.PutID(SendWebAppDataRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SendWebAppDataRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sendWebAppData#ab1fce0c as nil") - } - b.PutInt53(s.BotUserID) - b.PutString(s.ButtonText) - b.PutString(s.Data) - return nil -} - -// Decode implements bin.Decoder. -func (s *SendWebAppDataRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendWebAppData#ab1fce0c to nil") - } - if err := b.ConsumeID(SendWebAppDataRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sendWebAppData#ab1fce0c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SendWebAppDataRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sendWebAppData#ab1fce0c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppData#ab1fce0c: field bot_user_id: %w", err) - } - s.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppData#ab1fce0c: field button_text: %w", err) - } - s.ButtonText = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppData#ab1fce0c: field data: %w", err) - } - s.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SendWebAppDataRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sendWebAppData#ab1fce0c as nil") - } - b.ObjStart() - b.PutID("sendWebAppData") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(s.BotUserID) - b.Comma() - b.FieldStart("button_text") - b.PutString(s.ButtonText) - b.Comma() - b.FieldStart("data") - b.PutString(s.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SendWebAppDataRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sendWebAppData#ab1fce0c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sendWebAppData"); err != nil { - return fmt.Errorf("unable to decode sendWebAppData#ab1fce0c: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppData#ab1fce0c: field bot_user_id: %w", err) - } - s.BotUserID = value - case "button_text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppData#ab1fce0c: field button_text: %w", err) - } - s.ButtonText = value - case "data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sendWebAppData#ab1fce0c: field data: %w", err) - } - s.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (s *SendWebAppDataRequest) GetBotUserID() (value int64) { - if s == nil { - return - } - return s.BotUserID -} - -// GetButtonText returns value of ButtonText field. -func (s *SendWebAppDataRequest) GetButtonText() (value string) { - if s == nil { - return - } - return s.ButtonText -} - -// GetData returns value of Data field. -func (s *SendWebAppDataRequest) GetData() (value string) { - if s == nil { - return - } - return s.Data -} - -// SendWebAppData invokes method sendWebAppData#ab1fce0c returning error if any. -func (c *Client) SendWebAppData(ctx context.Context, request *SendWebAppDataRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_sent_gift_gen.go b/tdapi/tl_sent_gift_gen.go deleted file mode 100644 index bfbe27186..000000000 --- a/tdapi/tl_sent_gift_gen.go +++ /dev/null @@ -1,501 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SentGiftRegular represents TL type `sentGiftRegular#2368ad19`. -type SentGiftRegular struct { - // The gift - Gift Gift -} - -// SentGiftRegularTypeID is TL type id of SentGiftRegular. -const SentGiftRegularTypeID = 0x2368ad19 - -// construct implements constructor of SentGiftClass. -func (s SentGiftRegular) construct() SentGiftClass { return &s } - -// Ensuring interfaces in compile-time for SentGiftRegular. -var ( - _ bin.Encoder = &SentGiftRegular{} - _ bin.Decoder = &SentGiftRegular{} - _ bin.BareEncoder = &SentGiftRegular{} - _ bin.BareDecoder = &SentGiftRegular{} - - _ SentGiftClass = &SentGiftRegular{} -) - -func (s *SentGiftRegular) Zero() bool { - if s == nil { - return true - } - if !(s.Gift.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SentGiftRegular) String() string { - if s == nil { - return "SentGiftRegular(nil)" - } - type Alias SentGiftRegular - return fmt.Sprintf("SentGiftRegular%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SentGiftRegular) TypeID() uint32 { - return SentGiftRegularTypeID -} - -// TypeName returns name of type in TL schema. -func (*SentGiftRegular) TypeName() string { - return "sentGiftRegular" -} - -// TypeInfo returns info about TL type. -func (s *SentGiftRegular) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sentGiftRegular", - ID: SentGiftRegularTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Gift", - SchemaName: "gift", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SentGiftRegular) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sentGiftRegular#2368ad19 as nil") - } - b.PutID(SentGiftRegularTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SentGiftRegular) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sentGiftRegular#2368ad19 as nil") - } - if err := s.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode sentGiftRegular#2368ad19: field gift: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SentGiftRegular) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sentGiftRegular#2368ad19 to nil") - } - if err := b.ConsumeID(SentGiftRegularTypeID); err != nil { - return fmt.Errorf("unable to decode sentGiftRegular#2368ad19: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SentGiftRegular) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sentGiftRegular#2368ad19 to nil") - } - { - if err := s.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode sentGiftRegular#2368ad19: field gift: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SentGiftRegular) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sentGiftRegular#2368ad19 as nil") - } - b.ObjStart() - b.PutID("sentGiftRegular") - b.Comma() - b.FieldStart("gift") - if err := s.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sentGiftRegular#2368ad19: field gift: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SentGiftRegular) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sentGiftRegular#2368ad19 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sentGiftRegular"); err != nil { - return fmt.Errorf("unable to decode sentGiftRegular#2368ad19: %w", err) - } - case "gift": - if err := s.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sentGiftRegular#2368ad19: field gift: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGift returns value of Gift field. -func (s *SentGiftRegular) GetGift() (value Gift) { - if s == nil { - return - } - return s.Gift -} - -// SentGiftUpgraded represents TL type `sentGiftUpgraded#25674480`. -type SentGiftUpgraded struct { - // The gift - Gift UpgradedGift -} - -// SentGiftUpgradedTypeID is TL type id of SentGiftUpgraded. -const SentGiftUpgradedTypeID = 0x25674480 - -// construct implements constructor of SentGiftClass. -func (s SentGiftUpgraded) construct() SentGiftClass { return &s } - -// Ensuring interfaces in compile-time for SentGiftUpgraded. -var ( - _ bin.Encoder = &SentGiftUpgraded{} - _ bin.Decoder = &SentGiftUpgraded{} - _ bin.BareEncoder = &SentGiftUpgraded{} - _ bin.BareDecoder = &SentGiftUpgraded{} - - _ SentGiftClass = &SentGiftUpgraded{} -) - -func (s *SentGiftUpgraded) Zero() bool { - if s == nil { - return true - } - if !(s.Gift.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SentGiftUpgraded) String() string { - if s == nil { - return "SentGiftUpgraded(nil)" - } - type Alias SentGiftUpgraded - return fmt.Sprintf("SentGiftUpgraded%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SentGiftUpgraded) TypeID() uint32 { - return SentGiftUpgradedTypeID -} - -// TypeName returns name of type in TL schema. -func (*SentGiftUpgraded) TypeName() string { - return "sentGiftUpgraded" -} - -// TypeInfo returns info about TL type. -func (s *SentGiftUpgraded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sentGiftUpgraded", - ID: SentGiftUpgradedTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Gift", - SchemaName: "gift", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SentGiftUpgraded) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sentGiftUpgraded#25674480 as nil") - } - b.PutID(SentGiftUpgradedTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SentGiftUpgraded) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sentGiftUpgraded#25674480 as nil") - } - if err := s.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode sentGiftUpgraded#25674480: field gift: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SentGiftUpgraded) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sentGiftUpgraded#25674480 to nil") - } - if err := b.ConsumeID(SentGiftUpgradedTypeID); err != nil { - return fmt.Errorf("unable to decode sentGiftUpgraded#25674480: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SentGiftUpgraded) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sentGiftUpgraded#25674480 to nil") - } - { - if err := s.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode sentGiftUpgraded#25674480: field gift: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SentGiftUpgraded) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sentGiftUpgraded#25674480 as nil") - } - b.ObjStart() - b.PutID("sentGiftUpgraded") - b.Comma() - b.FieldStart("gift") - if err := s.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sentGiftUpgraded#25674480: field gift: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SentGiftUpgraded) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sentGiftUpgraded#25674480 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sentGiftUpgraded"); err != nil { - return fmt.Errorf("unable to decode sentGiftUpgraded#25674480: %w", err) - } - case "gift": - if err := s.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sentGiftUpgraded#25674480: field gift: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGift returns value of Gift field. -func (s *SentGiftUpgraded) GetGift() (value UpgradedGift) { - if s == nil { - return - } - return s.Gift -} - -// SentGiftClassName is schema name of SentGiftClass. -const SentGiftClassName = "SentGift" - -// SentGiftClass represents SentGift generic type. -// -// Example: -// -// g, err := tdapi.DecodeSentGift(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.SentGiftRegular: // sentGiftRegular#2368ad19 -// case *tdapi.SentGiftUpgraded: // sentGiftUpgraded#25674480 -// default: panic(v) -// } -type SentGiftClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() SentGiftClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeSentGift implements binary de-serialization for SentGiftClass. -func DecodeSentGift(buf *bin.Buffer) (SentGiftClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case SentGiftRegularTypeID: - // Decoding sentGiftRegular#2368ad19. - v := SentGiftRegular{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SentGiftClass: %w", err) - } - return &v, nil - case SentGiftUpgradedTypeID: - // Decoding sentGiftUpgraded#25674480. - v := SentGiftUpgraded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SentGiftClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SentGiftClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONSentGift implements binary de-serialization for SentGiftClass. -func DecodeTDLibJSONSentGift(buf tdjson.Decoder) (SentGiftClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "sentGiftRegular": - // Decoding sentGiftRegular#2368ad19. - v := SentGiftRegular{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SentGiftClass: %w", err) - } - return &v, nil - case "sentGiftUpgraded": - // Decoding sentGiftUpgraded#25674480. - v := SentGiftUpgraded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SentGiftClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SentGiftClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// SentGift boxes the SentGiftClass providing a helper. -type SentGiftBox struct { - SentGift SentGiftClass -} - -// Decode implements bin.Decoder for SentGiftBox. -func (b *SentGiftBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode SentGiftBox to nil") - } - v, err := DecodeSentGift(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SentGift = v - return nil -} - -// Encode implements bin.Encode for SentGiftBox. -func (b *SentGiftBox) Encode(buf *bin.Buffer) error { - if b == nil || b.SentGift == nil { - return fmt.Errorf("unable to encode SentGiftClass as nil") - } - return b.SentGift.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for SentGiftBox. -func (b *SentGiftBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode SentGiftBox to nil") - } - v, err := DecodeTDLibJSONSentGift(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SentGift = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for SentGiftBox. -func (b *SentGiftBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.SentGift == nil { - return fmt.Errorf("unable to encode SentGiftClass as nil") - } - return b.SentGift.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_sent_web_app_message_gen.go b/tdapi/tl_sent_web_app_message_gen.go deleted file mode 100644 index 122ea35d3..000000000 --- a/tdapi/tl_sent_web_app_message_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SentWebAppMessage represents TL type `sentWebAppMessage#4a24eec0`. -type SentWebAppMessage struct { - // Identifier of the sent inline message, if known - InlineMessageID string -} - -// SentWebAppMessageTypeID is TL type id of SentWebAppMessage. -const SentWebAppMessageTypeID = 0x4a24eec0 - -// Ensuring interfaces in compile-time for SentWebAppMessage. -var ( - _ bin.Encoder = &SentWebAppMessage{} - _ bin.Decoder = &SentWebAppMessage{} - _ bin.BareEncoder = &SentWebAppMessage{} - _ bin.BareDecoder = &SentWebAppMessage{} -) - -func (s *SentWebAppMessage) Zero() bool { - if s == nil { - return true - } - if !(s.InlineMessageID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SentWebAppMessage) String() string { - if s == nil { - return "SentWebAppMessage(nil)" - } - type Alias SentWebAppMessage - return fmt.Sprintf("SentWebAppMessage%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SentWebAppMessage) TypeID() uint32 { - return SentWebAppMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*SentWebAppMessage) TypeName() string { - return "sentWebAppMessage" -} - -// TypeInfo returns info about TL type. -func (s *SentWebAppMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sentWebAppMessage", - ID: SentWebAppMessageTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InlineMessageID", - SchemaName: "inline_message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SentWebAppMessage) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sentWebAppMessage#4a24eec0 as nil") - } - b.PutID(SentWebAppMessageTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SentWebAppMessage) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sentWebAppMessage#4a24eec0 as nil") - } - b.PutString(s.InlineMessageID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SentWebAppMessage) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sentWebAppMessage#4a24eec0 to nil") - } - if err := b.ConsumeID(SentWebAppMessageTypeID); err != nil { - return fmt.Errorf("unable to decode sentWebAppMessage#4a24eec0: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SentWebAppMessage) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sentWebAppMessage#4a24eec0 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sentWebAppMessage#4a24eec0: field inline_message_id: %w", err) - } - s.InlineMessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SentWebAppMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sentWebAppMessage#4a24eec0 as nil") - } - b.ObjStart() - b.PutID("sentWebAppMessage") - b.Comma() - b.FieldStart("inline_message_id") - b.PutString(s.InlineMessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SentWebAppMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sentWebAppMessage#4a24eec0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sentWebAppMessage"); err != nil { - return fmt.Errorf("unable to decode sentWebAppMessage#4a24eec0: %w", err) - } - case "inline_message_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sentWebAppMessage#4a24eec0: field inline_message_id: %w", err) - } - s.InlineMessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInlineMessageID returns value of InlineMessageID field. -func (s *SentWebAppMessage) GetInlineMessageID() (value string) { - if s == nil { - return - } - return s.InlineMessageID -} diff --git a/tdapi/tl_session_gen.go b/tdapi/tl_session_gen.go deleted file mode 100644 index 6e4891b98..000000000 --- a/tdapi/tl_session_gen.go +++ /dev/null @@ -1,788 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Session represents TL type `session#9759a3c`. -type Session struct { - // Session identifier - ID int64 - // True, if this session is the current session - IsCurrent bool - // True, if a 2-step verification password is needed to complete authorization of the - // session - IsPasswordPending bool - // True, if the session wasn't confirmed from another session - IsUnconfirmed bool - // True, if incoming secret chats can be accepted by the session - CanAcceptSecretChats bool - // True, if incoming calls can be accepted by the session - CanAcceptCalls bool - // Session type based on the system and application version, which can be used to display - // a corresponding icon - Type SessionTypeClass - // Telegram API identifier, as provided by the application - APIID int32 - // Name of the application, as provided by the application - ApplicationName string - // The version of the application, as provided by the application - ApplicationVersion string - // True, if the application is an official application or uses the api_id of an official - // application - IsOfficialApplication bool - // Model of the device the application has been run or is running on, as provided by the - // application - DeviceModel string - // Operating system the application has been run or is running on, as provided by the - // application - Platform string - // Version of the operating system the application has been run or is running on, as - // provided by the application - SystemVersion string - // Point in time (Unix timestamp) when the user has logged in - LogInDate int32 - // Point in time (Unix timestamp) when the session was last used - LastActiveDate int32 - // IP address from which the session was created, in human-readable format - IPAddress string - // A human-readable description of the location from which the session was created, based - // on the IP address - Location string -} - -// SessionTypeID is TL type id of Session. -const SessionTypeID = 0x9759a3c - -// Ensuring interfaces in compile-time for Session. -var ( - _ bin.Encoder = &Session{} - _ bin.Decoder = &Session{} - _ bin.BareEncoder = &Session{} - _ bin.BareDecoder = &Session{} -) - -func (s *Session) Zero() bool { - if s == nil { - return true - } - if !(s.ID == 0) { - return false - } - if !(s.IsCurrent == false) { - return false - } - if !(s.IsPasswordPending == false) { - return false - } - if !(s.IsUnconfirmed == false) { - return false - } - if !(s.CanAcceptSecretChats == false) { - return false - } - if !(s.CanAcceptCalls == false) { - return false - } - if !(s.Type == nil) { - return false - } - if !(s.APIID == 0) { - return false - } - if !(s.ApplicationName == "") { - return false - } - if !(s.ApplicationVersion == "") { - return false - } - if !(s.IsOfficialApplication == false) { - return false - } - if !(s.DeviceModel == "") { - return false - } - if !(s.Platform == "") { - return false - } - if !(s.SystemVersion == "") { - return false - } - if !(s.LogInDate == 0) { - return false - } - if !(s.LastActiveDate == 0) { - return false - } - if !(s.IPAddress == "") { - return false - } - if !(s.Location == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *Session) String() string { - if s == nil { - return "Session(nil)" - } - type Alias Session - return fmt.Sprintf("Session%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Session) TypeID() uint32 { - return SessionTypeID -} - -// TypeName returns name of type in TL schema. -func (*Session) TypeName() string { - return "session" -} - -// TypeInfo returns info about TL type. -func (s *Session) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "session", - ID: SessionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "IsCurrent", - SchemaName: "is_current", - }, - { - Name: "IsPasswordPending", - SchemaName: "is_password_pending", - }, - { - Name: "IsUnconfirmed", - SchemaName: "is_unconfirmed", - }, - { - Name: "CanAcceptSecretChats", - SchemaName: "can_accept_secret_chats", - }, - { - Name: "CanAcceptCalls", - SchemaName: "can_accept_calls", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "APIID", - SchemaName: "api_id", - }, - { - Name: "ApplicationName", - SchemaName: "application_name", - }, - { - Name: "ApplicationVersion", - SchemaName: "application_version", - }, - { - Name: "IsOfficialApplication", - SchemaName: "is_official_application", - }, - { - Name: "DeviceModel", - SchemaName: "device_model", - }, - { - Name: "Platform", - SchemaName: "platform", - }, - { - Name: "SystemVersion", - SchemaName: "system_version", - }, - { - Name: "LogInDate", - SchemaName: "log_in_date", - }, - { - Name: "LastActiveDate", - SchemaName: "last_active_date", - }, - { - Name: "IPAddress", - SchemaName: "ip_address", - }, - { - Name: "Location", - SchemaName: "location", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *Session) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode session#9759a3c as nil") - } - b.PutID(SessionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *Session) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode session#9759a3c as nil") - } - b.PutLong(s.ID) - b.PutBool(s.IsCurrent) - b.PutBool(s.IsPasswordPending) - b.PutBool(s.IsUnconfirmed) - b.PutBool(s.CanAcceptSecretChats) - b.PutBool(s.CanAcceptCalls) - if s.Type == nil { - return fmt.Errorf("unable to encode session#9759a3c: field type is nil") - } - if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode session#9759a3c: field type: %w", err) - } - b.PutInt32(s.APIID) - b.PutString(s.ApplicationName) - b.PutString(s.ApplicationVersion) - b.PutBool(s.IsOfficialApplication) - b.PutString(s.DeviceModel) - b.PutString(s.Platform) - b.PutString(s.SystemVersion) - b.PutInt32(s.LogInDate) - b.PutInt32(s.LastActiveDate) - b.PutString(s.IPAddress) - b.PutString(s.Location) - return nil -} - -// Decode implements bin.Decoder. -func (s *Session) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode session#9759a3c to nil") - } - if err := b.ConsumeID(SessionTypeID); err != nil { - return fmt.Errorf("unable to decode session#9759a3c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *Session) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode session#9759a3c to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field id: %w", err) - } - s.ID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field is_current: %w", err) - } - s.IsCurrent = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field is_password_pending: %w", err) - } - s.IsPasswordPending = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field is_unconfirmed: %w", err) - } - s.IsUnconfirmed = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field can_accept_secret_chats: %w", err) - } - s.CanAcceptSecretChats = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field can_accept_calls: %w", err) - } - s.CanAcceptCalls = value - } - { - value, err := DecodeSessionType(b) - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field type: %w", err) - } - s.Type = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field api_id: %w", err) - } - s.APIID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field application_name: %w", err) - } - s.ApplicationName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field application_version: %w", err) - } - s.ApplicationVersion = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field is_official_application: %w", err) - } - s.IsOfficialApplication = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field device_model: %w", err) - } - s.DeviceModel = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field platform: %w", err) - } - s.Platform = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field system_version: %w", err) - } - s.SystemVersion = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field log_in_date: %w", err) - } - s.LogInDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field last_active_date: %w", err) - } - s.LastActiveDate = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field ip_address: %w", err) - } - s.IPAddress = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field location: %w", err) - } - s.Location = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *Session) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode session#9759a3c as nil") - } - b.ObjStart() - b.PutID("session") - b.Comma() - b.FieldStart("id") - b.PutLong(s.ID) - b.Comma() - b.FieldStart("is_current") - b.PutBool(s.IsCurrent) - b.Comma() - b.FieldStart("is_password_pending") - b.PutBool(s.IsPasswordPending) - b.Comma() - b.FieldStart("is_unconfirmed") - b.PutBool(s.IsUnconfirmed) - b.Comma() - b.FieldStart("can_accept_secret_chats") - b.PutBool(s.CanAcceptSecretChats) - b.Comma() - b.FieldStart("can_accept_calls") - b.PutBool(s.CanAcceptCalls) - b.Comma() - b.FieldStart("type") - if s.Type == nil { - return fmt.Errorf("unable to encode session#9759a3c: field type is nil") - } - if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode session#9759a3c: field type: %w", err) - } - b.Comma() - b.FieldStart("api_id") - b.PutInt32(s.APIID) - b.Comma() - b.FieldStart("application_name") - b.PutString(s.ApplicationName) - b.Comma() - b.FieldStart("application_version") - b.PutString(s.ApplicationVersion) - b.Comma() - b.FieldStart("is_official_application") - b.PutBool(s.IsOfficialApplication) - b.Comma() - b.FieldStart("device_model") - b.PutString(s.DeviceModel) - b.Comma() - b.FieldStart("platform") - b.PutString(s.Platform) - b.Comma() - b.FieldStart("system_version") - b.PutString(s.SystemVersion) - b.Comma() - b.FieldStart("log_in_date") - b.PutInt32(s.LogInDate) - b.Comma() - b.FieldStart("last_active_date") - b.PutInt32(s.LastActiveDate) - b.Comma() - b.FieldStart("ip_address") - b.PutString(s.IPAddress) - b.Comma() - b.FieldStart("location") - b.PutString(s.Location) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *Session) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode session#9759a3c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("session"); err != nil { - return fmt.Errorf("unable to decode session#9759a3c: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field id: %w", err) - } - s.ID = value - case "is_current": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field is_current: %w", err) - } - s.IsCurrent = value - case "is_password_pending": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field is_password_pending: %w", err) - } - s.IsPasswordPending = value - case "is_unconfirmed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field is_unconfirmed: %w", err) - } - s.IsUnconfirmed = value - case "can_accept_secret_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field can_accept_secret_chats: %w", err) - } - s.CanAcceptSecretChats = value - case "can_accept_calls": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field can_accept_calls: %w", err) - } - s.CanAcceptCalls = value - case "type": - value, err := DecodeTDLibJSONSessionType(b) - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field type: %w", err) - } - s.Type = value - case "api_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field api_id: %w", err) - } - s.APIID = value - case "application_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field application_name: %w", err) - } - s.ApplicationName = value - case "application_version": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field application_version: %w", err) - } - s.ApplicationVersion = value - case "is_official_application": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field is_official_application: %w", err) - } - s.IsOfficialApplication = value - case "device_model": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field device_model: %w", err) - } - s.DeviceModel = value - case "platform": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field platform: %w", err) - } - s.Platform = value - case "system_version": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field system_version: %w", err) - } - s.SystemVersion = value - case "log_in_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field log_in_date: %w", err) - } - s.LogInDate = value - case "last_active_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field last_active_date: %w", err) - } - s.LastActiveDate = value - case "ip_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field ip_address: %w", err) - } - s.IPAddress = value - case "location": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode session#9759a3c: field location: %w", err) - } - s.Location = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *Session) GetID() (value int64) { - if s == nil { - return - } - return s.ID -} - -// GetIsCurrent returns value of IsCurrent field. -func (s *Session) GetIsCurrent() (value bool) { - if s == nil { - return - } - return s.IsCurrent -} - -// GetIsPasswordPending returns value of IsPasswordPending field. -func (s *Session) GetIsPasswordPending() (value bool) { - if s == nil { - return - } - return s.IsPasswordPending -} - -// GetIsUnconfirmed returns value of IsUnconfirmed field. -func (s *Session) GetIsUnconfirmed() (value bool) { - if s == nil { - return - } - return s.IsUnconfirmed -} - -// GetCanAcceptSecretChats returns value of CanAcceptSecretChats field. -func (s *Session) GetCanAcceptSecretChats() (value bool) { - if s == nil { - return - } - return s.CanAcceptSecretChats -} - -// GetCanAcceptCalls returns value of CanAcceptCalls field. -func (s *Session) GetCanAcceptCalls() (value bool) { - if s == nil { - return - } - return s.CanAcceptCalls -} - -// GetType returns value of Type field. -func (s *Session) GetType() (value SessionTypeClass) { - if s == nil { - return - } - return s.Type -} - -// GetAPIID returns value of APIID field. -func (s *Session) GetAPIID() (value int32) { - if s == nil { - return - } - return s.APIID -} - -// GetApplicationName returns value of ApplicationName field. -func (s *Session) GetApplicationName() (value string) { - if s == nil { - return - } - return s.ApplicationName -} - -// GetApplicationVersion returns value of ApplicationVersion field. -func (s *Session) GetApplicationVersion() (value string) { - if s == nil { - return - } - return s.ApplicationVersion -} - -// GetIsOfficialApplication returns value of IsOfficialApplication field. -func (s *Session) GetIsOfficialApplication() (value bool) { - if s == nil { - return - } - return s.IsOfficialApplication -} - -// GetDeviceModel returns value of DeviceModel field. -func (s *Session) GetDeviceModel() (value string) { - if s == nil { - return - } - return s.DeviceModel -} - -// GetPlatform returns value of Platform field. -func (s *Session) GetPlatform() (value string) { - if s == nil { - return - } - return s.Platform -} - -// GetSystemVersion returns value of SystemVersion field. -func (s *Session) GetSystemVersion() (value string) { - if s == nil { - return - } - return s.SystemVersion -} - -// GetLogInDate returns value of LogInDate field. -func (s *Session) GetLogInDate() (value int32) { - if s == nil { - return - } - return s.LogInDate -} - -// GetLastActiveDate returns value of LastActiveDate field. -func (s *Session) GetLastActiveDate() (value int32) { - if s == nil { - return - } - return s.LastActiveDate -} - -// GetIPAddress returns value of IPAddress field. -func (s *Session) GetIPAddress() (value string) { - if s == nil { - return - } - return s.IPAddress -} - -// GetLocation returns value of Location field. -func (s *Session) GetLocation() (value string) { - if s == nil { - return - } - return s.Location -} diff --git a/tdapi/tl_session_type_gen.go b/tdapi/tl_session_type_gen.go deleted file mode 100644 index ac13a2f42..000000000 --- a/tdapi/tl_session_type_gen.go +++ /dev/null @@ -1,2621 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SessionTypeAndroid represents TL type `sessionTypeAndroid#84836098`. -type SessionTypeAndroid struct { -} - -// SessionTypeAndroidTypeID is TL type id of SessionTypeAndroid. -const SessionTypeAndroidTypeID = 0x84836098 - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeAndroid) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeAndroid. -var ( - _ bin.Encoder = &SessionTypeAndroid{} - _ bin.Decoder = &SessionTypeAndroid{} - _ bin.BareEncoder = &SessionTypeAndroid{} - _ bin.BareDecoder = &SessionTypeAndroid{} - - _ SessionTypeClass = &SessionTypeAndroid{} -) - -func (s *SessionTypeAndroid) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeAndroid) String() string { - if s == nil { - return "SessionTypeAndroid(nil)" - } - type Alias SessionTypeAndroid - return fmt.Sprintf("SessionTypeAndroid%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeAndroid) TypeID() uint32 { - return SessionTypeAndroidTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeAndroid) TypeName() string { - return "sessionTypeAndroid" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeAndroid) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeAndroid", - ID: SessionTypeAndroidTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeAndroid) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeAndroid#84836098 as nil") - } - b.PutID(SessionTypeAndroidTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeAndroid) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeAndroid#84836098 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeAndroid) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeAndroid#84836098 to nil") - } - if err := b.ConsumeID(SessionTypeAndroidTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeAndroid#84836098: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeAndroid) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeAndroid#84836098 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeAndroid) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeAndroid#84836098 as nil") - } - b.ObjStart() - b.PutID("sessionTypeAndroid") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeAndroid) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeAndroid#84836098 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeAndroid"); err != nil { - return fmt.Errorf("unable to decode sessionTypeAndroid#84836098: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeApple represents TL type `sessionTypeApple#9399d24b`. -type SessionTypeApple struct { -} - -// SessionTypeAppleTypeID is TL type id of SessionTypeApple. -const SessionTypeAppleTypeID = 0x9399d24b - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeApple) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeApple. -var ( - _ bin.Encoder = &SessionTypeApple{} - _ bin.Decoder = &SessionTypeApple{} - _ bin.BareEncoder = &SessionTypeApple{} - _ bin.BareDecoder = &SessionTypeApple{} - - _ SessionTypeClass = &SessionTypeApple{} -) - -func (s *SessionTypeApple) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeApple) String() string { - if s == nil { - return "SessionTypeApple(nil)" - } - type Alias SessionTypeApple - return fmt.Sprintf("SessionTypeApple%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeApple) TypeID() uint32 { - return SessionTypeAppleTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeApple) TypeName() string { - return "sessionTypeApple" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeApple) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeApple", - ID: SessionTypeAppleTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeApple) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeApple#9399d24b as nil") - } - b.PutID(SessionTypeAppleTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeApple) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeApple#9399d24b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeApple) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeApple#9399d24b to nil") - } - if err := b.ConsumeID(SessionTypeAppleTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeApple#9399d24b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeApple) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeApple#9399d24b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeApple) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeApple#9399d24b as nil") - } - b.ObjStart() - b.PutID("sessionTypeApple") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeApple) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeApple#9399d24b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeApple"); err != nil { - return fmt.Errorf("unable to decode sessionTypeApple#9399d24b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeBrave represents TL type `sessionTypeBrave#b778e9ed`. -type SessionTypeBrave struct { -} - -// SessionTypeBraveTypeID is TL type id of SessionTypeBrave. -const SessionTypeBraveTypeID = 0xb778e9ed - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeBrave) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeBrave. -var ( - _ bin.Encoder = &SessionTypeBrave{} - _ bin.Decoder = &SessionTypeBrave{} - _ bin.BareEncoder = &SessionTypeBrave{} - _ bin.BareDecoder = &SessionTypeBrave{} - - _ SessionTypeClass = &SessionTypeBrave{} -) - -func (s *SessionTypeBrave) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeBrave) String() string { - if s == nil { - return "SessionTypeBrave(nil)" - } - type Alias SessionTypeBrave - return fmt.Sprintf("SessionTypeBrave%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeBrave) TypeID() uint32 { - return SessionTypeBraveTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeBrave) TypeName() string { - return "sessionTypeBrave" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeBrave) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeBrave", - ID: SessionTypeBraveTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeBrave) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeBrave#b778e9ed as nil") - } - b.PutID(SessionTypeBraveTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeBrave) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeBrave#b778e9ed as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeBrave) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeBrave#b778e9ed to nil") - } - if err := b.ConsumeID(SessionTypeBraveTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeBrave#b778e9ed: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeBrave) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeBrave#b778e9ed to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeBrave) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeBrave#b778e9ed as nil") - } - b.ObjStart() - b.PutID("sessionTypeBrave") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeBrave) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeBrave#b778e9ed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeBrave"); err != nil { - return fmt.Errorf("unable to decode sessionTypeBrave#b778e9ed: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeChrome represents TL type `sessionTypeChrome#5dc92969`. -type SessionTypeChrome struct { -} - -// SessionTypeChromeTypeID is TL type id of SessionTypeChrome. -const SessionTypeChromeTypeID = 0x5dc92969 - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeChrome) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeChrome. -var ( - _ bin.Encoder = &SessionTypeChrome{} - _ bin.Decoder = &SessionTypeChrome{} - _ bin.BareEncoder = &SessionTypeChrome{} - _ bin.BareDecoder = &SessionTypeChrome{} - - _ SessionTypeClass = &SessionTypeChrome{} -) - -func (s *SessionTypeChrome) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeChrome) String() string { - if s == nil { - return "SessionTypeChrome(nil)" - } - type Alias SessionTypeChrome - return fmt.Sprintf("SessionTypeChrome%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeChrome) TypeID() uint32 { - return SessionTypeChromeTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeChrome) TypeName() string { - return "sessionTypeChrome" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeChrome) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeChrome", - ID: SessionTypeChromeTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeChrome) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeChrome#5dc92969 as nil") - } - b.PutID(SessionTypeChromeTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeChrome) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeChrome#5dc92969 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeChrome) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeChrome#5dc92969 to nil") - } - if err := b.ConsumeID(SessionTypeChromeTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeChrome#5dc92969: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeChrome) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeChrome#5dc92969 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeChrome) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeChrome#5dc92969 as nil") - } - b.ObjStart() - b.PutID("sessionTypeChrome") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeChrome) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeChrome#5dc92969 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeChrome"); err != nil { - return fmt.Errorf("unable to decode sessionTypeChrome#5dc92969: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeEdge represents TL type `sessionTypeEdge#dfe0cb5b`. -type SessionTypeEdge struct { -} - -// SessionTypeEdgeTypeID is TL type id of SessionTypeEdge. -const SessionTypeEdgeTypeID = 0xdfe0cb5b - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeEdge) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeEdge. -var ( - _ bin.Encoder = &SessionTypeEdge{} - _ bin.Decoder = &SessionTypeEdge{} - _ bin.BareEncoder = &SessionTypeEdge{} - _ bin.BareDecoder = &SessionTypeEdge{} - - _ SessionTypeClass = &SessionTypeEdge{} -) - -func (s *SessionTypeEdge) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeEdge) String() string { - if s == nil { - return "SessionTypeEdge(nil)" - } - type Alias SessionTypeEdge - return fmt.Sprintf("SessionTypeEdge%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeEdge) TypeID() uint32 { - return SessionTypeEdgeTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeEdge) TypeName() string { - return "sessionTypeEdge" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeEdge) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeEdge", - ID: SessionTypeEdgeTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeEdge) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeEdge#dfe0cb5b as nil") - } - b.PutID(SessionTypeEdgeTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeEdge) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeEdge#dfe0cb5b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeEdge) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeEdge#dfe0cb5b to nil") - } - if err := b.ConsumeID(SessionTypeEdgeTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeEdge#dfe0cb5b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeEdge) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeEdge#dfe0cb5b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeEdge) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeEdge#dfe0cb5b as nil") - } - b.ObjStart() - b.PutID("sessionTypeEdge") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeEdge) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeEdge#dfe0cb5b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeEdge"); err != nil { - return fmt.Errorf("unable to decode sessionTypeEdge#dfe0cb5b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeFirefox represents TL type `sessionTypeFirefox#7e83fda4`. -type SessionTypeFirefox struct { -} - -// SessionTypeFirefoxTypeID is TL type id of SessionTypeFirefox. -const SessionTypeFirefoxTypeID = 0x7e83fda4 - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeFirefox) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeFirefox. -var ( - _ bin.Encoder = &SessionTypeFirefox{} - _ bin.Decoder = &SessionTypeFirefox{} - _ bin.BareEncoder = &SessionTypeFirefox{} - _ bin.BareDecoder = &SessionTypeFirefox{} - - _ SessionTypeClass = &SessionTypeFirefox{} -) - -func (s *SessionTypeFirefox) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeFirefox) String() string { - if s == nil { - return "SessionTypeFirefox(nil)" - } - type Alias SessionTypeFirefox - return fmt.Sprintf("SessionTypeFirefox%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeFirefox) TypeID() uint32 { - return SessionTypeFirefoxTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeFirefox) TypeName() string { - return "sessionTypeFirefox" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeFirefox) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeFirefox", - ID: SessionTypeFirefoxTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeFirefox) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeFirefox#7e83fda4 as nil") - } - b.PutID(SessionTypeFirefoxTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeFirefox) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeFirefox#7e83fda4 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeFirefox) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeFirefox#7e83fda4 to nil") - } - if err := b.ConsumeID(SessionTypeFirefoxTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeFirefox#7e83fda4: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeFirefox) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeFirefox#7e83fda4 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeFirefox) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeFirefox#7e83fda4 as nil") - } - b.ObjStart() - b.PutID("sessionTypeFirefox") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeFirefox) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeFirefox#7e83fda4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeFirefox"); err != nil { - return fmt.Errorf("unable to decode sessionTypeFirefox#7e83fda4: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeIpad represents TL type `sessionTypeIpad#4d2abeef`. -type SessionTypeIpad struct { -} - -// SessionTypeIpadTypeID is TL type id of SessionTypeIpad. -const SessionTypeIpadTypeID = 0x4d2abeef - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeIpad) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeIpad. -var ( - _ bin.Encoder = &SessionTypeIpad{} - _ bin.Decoder = &SessionTypeIpad{} - _ bin.BareEncoder = &SessionTypeIpad{} - _ bin.BareDecoder = &SessionTypeIpad{} - - _ SessionTypeClass = &SessionTypeIpad{} -) - -func (s *SessionTypeIpad) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeIpad) String() string { - if s == nil { - return "SessionTypeIpad(nil)" - } - type Alias SessionTypeIpad - return fmt.Sprintf("SessionTypeIpad%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeIpad) TypeID() uint32 { - return SessionTypeIpadTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeIpad) TypeName() string { - return "sessionTypeIpad" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeIpad) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeIpad", - ID: SessionTypeIpadTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeIpad) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeIpad#4d2abeef as nil") - } - b.PutID(SessionTypeIpadTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeIpad) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeIpad#4d2abeef as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeIpad) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeIpad#4d2abeef to nil") - } - if err := b.ConsumeID(SessionTypeIpadTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeIpad#4d2abeef: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeIpad) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeIpad#4d2abeef to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeIpad) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeIpad#4d2abeef as nil") - } - b.ObjStart() - b.PutID("sessionTypeIpad") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeIpad) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeIpad#4d2abeef to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeIpad"); err != nil { - return fmt.Errorf("unable to decode sessionTypeIpad#4d2abeef: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeIphone represents TL type `sessionTypeIphone#5d182bd`. -type SessionTypeIphone struct { -} - -// SessionTypeIphoneTypeID is TL type id of SessionTypeIphone. -const SessionTypeIphoneTypeID = 0x5d182bd - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeIphone) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeIphone. -var ( - _ bin.Encoder = &SessionTypeIphone{} - _ bin.Decoder = &SessionTypeIphone{} - _ bin.BareEncoder = &SessionTypeIphone{} - _ bin.BareDecoder = &SessionTypeIphone{} - - _ SessionTypeClass = &SessionTypeIphone{} -) - -func (s *SessionTypeIphone) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeIphone) String() string { - if s == nil { - return "SessionTypeIphone(nil)" - } - type Alias SessionTypeIphone - return fmt.Sprintf("SessionTypeIphone%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeIphone) TypeID() uint32 { - return SessionTypeIphoneTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeIphone) TypeName() string { - return "sessionTypeIphone" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeIphone) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeIphone", - ID: SessionTypeIphoneTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeIphone) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeIphone#5d182bd as nil") - } - b.PutID(SessionTypeIphoneTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeIphone) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeIphone#5d182bd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeIphone) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeIphone#5d182bd to nil") - } - if err := b.ConsumeID(SessionTypeIphoneTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeIphone#5d182bd: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeIphone) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeIphone#5d182bd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeIphone) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeIphone#5d182bd as nil") - } - b.ObjStart() - b.PutID("sessionTypeIphone") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeIphone) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeIphone#5d182bd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeIphone"); err != nil { - return fmt.Errorf("unable to decode sessionTypeIphone#5d182bd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeLinux represents TL type `sessionTypeLinux#a757ba69`. -type SessionTypeLinux struct { -} - -// SessionTypeLinuxTypeID is TL type id of SessionTypeLinux. -const SessionTypeLinuxTypeID = 0xa757ba69 - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeLinux) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeLinux. -var ( - _ bin.Encoder = &SessionTypeLinux{} - _ bin.Decoder = &SessionTypeLinux{} - _ bin.BareEncoder = &SessionTypeLinux{} - _ bin.BareDecoder = &SessionTypeLinux{} - - _ SessionTypeClass = &SessionTypeLinux{} -) - -func (s *SessionTypeLinux) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeLinux) String() string { - if s == nil { - return "SessionTypeLinux(nil)" - } - type Alias SessionTypeLinux - return fmt.Sprintf("SessionTypeLinux%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeLinux) TypeID() uint32 { - return SessionTypeLinuxTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeLinux) TypeName() string { - return "sessionTypeLinux" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeLinux) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeLinux", - ID: SessionTypeLinuxTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeLinux) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeLinux#a757ba69 as nil") - } - b.PutID(SessionTypeLinuxTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeLinux) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeLinux#a757ba69 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeLinux) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeLinux#a757ba69 to nil") - } - if err := b.ConsumeID(SessionTypeLinuxTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeLinux#a757ba69: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeLinux) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeLinux#a757ba69 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeLinux) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeLinux#a757ba69 as nil") - } - b.ObjStart() - b.PutID("sessionTypeLinux") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeLinux) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeLinux#a757ba69 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeLinux"); err != nil { - return fmt.Errorf("unable to decode sessionTypeLinux#a757ba69: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeMAC represents TL type `sessionTypeMac#db81caa1`. -type SessionTypeMAC struct { -} - -// SessionTypeMACTypeID is TL type id of SessionTypeMAC. -const SessionTypeMACTypeID = 0xdb81caa1 - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeMAC) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeMAC. -var ( - _ bin.Encoder = &SessionTypeMAC{} - _ bin.Decoder = &SessionTypeMAC{} - _ bin.BareEncoder = &SessionTypeMAC{} - _ bin.BareDecoder = &SessionTypeMAC{} - - _ SessionTypeClass = &SessionTypeMAC{} -) - -func (s *SessionTypeMAC) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeMAC) String() string { - if s == nil { - return "SessionTypeMAC(nil)" - } - type Alias SessionTypeMAC - return fmt.Sprintf("SessionTypeMAC%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeMAC) TypeID() uint32 { - return SessionTypeMACTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeMAC) TypeName() string { - return "sessionTypeMac" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeMAC) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeMac", - ID: SessionTypeMACTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeMAC) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeMac#db81caa1 as nil") - } - b.PutID(SessionTypeMACTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeMAC) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeMac#db81caa1 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeMAC) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeMac#db81caa1 to nil") - } - if err := b.ConsumeID(SessionTypeMACTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeMac#db81caa1: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeMAC) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeMac#db81caa1 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeMAC) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeMac#db81caa1 as nil") - } - b.ObjStart() - b.PutID("sessionTypeMac") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeMAC) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeMac#db81caa1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeMac"); err != nil { - return fmt.Errorf("unable to decode sessionTypeMac#db81caa1: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeOpera represents TL type `sessionTypeOpera#a8c21c7a`. -type SessionTypeOpera struct { -} - -// SessionTypeOperaTypeID is TL type id of SessionTypeOpera. -const SessionTypeOperaTypeID = 0xa8c21c7a - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeOpera) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeOpera. -var ( - _ bin.Encoder = &SessionTypeOpera{} - _ bin.Decoder = &SessionTypeOpera{} - _ bin.BareEncoder = &SessionTypeOpera{} - _ bin.BareDecoder = &SessionTypeOpera{} - - _ SessionTypeClass = &SessionTypeOpera{} -) - -func (s *SessionTypeOpera) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeOpera) String() string { - if s == nil { - return "SessionTypeOpera(nil)" - } - type Alias SessionTypeOpera - return fmt.Sprintf("SessionTypeOpera%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeOpera) TypeID() uint32 { - return SessionTypeOperaTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeOpera) TypeName() string { - return "sessionTypeOpera" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeOpera) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeOpera", - ID: SessionTypeOperaTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeOpera) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeOpera#a8c21c7a as nil") - } - b.PutID(SessionTypeOperaTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeOpera) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeOpera#a8c21c7a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeOpera) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeOpera#a8c21c7a to nil") - } - if err := b.ConsumeID(SessionTypeOperaTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeOpera#a8c21c7a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeOpera) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeOpera#a8c21c7a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeOpera) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeOpera#a8c21c7a as nil") - } - b.ObjStart() - b.PutID("sessionTypeOpera") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeOpera) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeOpera#a8c21c7a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeOpera"); err != nil { - return fmt.Errorf("unable to decode sessionTypeOpera#a8c21c7a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeSafari represents TL type `sessionTypeSafari#2a5b9c59`. -type SessionTypeSafari struct { -} - -// SessionTypeSafariTypeID is TL type id of SessionTypeSafari. -const SessionTypeSafariTypeID = 0x2a5b9c59 - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeSafari) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeSafari. -var ( - _ bin.Encoder = &SessionTypeSafari{} - _ bin.Decoder = &SessionTypeSafari{} - _ bin.BareEncoder = &SessionTypeSafari{} - _ bin.BareDecoder = &SessionTypeSafari{} - - _ SessionTypeClass = &SessionTypeSafari{} -) - -func (s *SessionTypeSafari) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeSafari) String() string { - if s == nil { - return "SessionTypeSafari(nil)" - } - type Alias SessionTypeSafari - return fmt.Sprintf("SessionTypeSafari%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeSafari) TypeID() uint32 { - return SessionTypeSafariTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeSafari) TypeName() string { - return "sessionTypeSafari" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeSafari) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeSafari", - ID: SessionTypeSafariTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeSafari) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeSafari#2a5b9c59 as nil") - } - b.PutID(SessionTypeSafariTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeSafari) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeSafari#2a5b9c59 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeSafari) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeSafari#2a5b9c59 to nil") - } - if err := b.ConsumeID(SessionTypeSafariTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeSafari#2a5b9c59: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeSafari) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeSafari#2a5b9c59 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeSafari) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeSafari#2a5b9c59 as nil") - } - b.ObjStart() - b.PutID("sessionTypeSafari") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeSafari) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeSafari#2a5b9c59 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeSafari"); err != nil { - return fmt.Errorf("unable to decode sessionTypeSafari#2a5b9c59: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeUbuntu represents TL type `sessionTypeUbuntu#5d8f6ac5`. -type SessionTypeUbuntu struct { -} - -// SessionTypeUbuntuTypeID is TL type id of SessionTypeUbuntu. -const SessionTypeUbuntuTypeID = 0x5d8f6ac5 - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeUbuntu) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeUbuntu. -var ( - _ bin.Encoder = &SessionTypeUbuntu{} - _ bin.Decoder = &SessionTypeUbuntu{} - _ bin.BareEncoder = &SessionTypeUbuntu{} - _ bin.BareDecoder = &SessionTypeUbuntu{} - - _ SessionTypeClass = &SessionTypeUbuntu{} -) - -func (s *SessionTypeUbuntu) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeUbuntu) String() string { - if s == nil { - return "SessionTypeUbuntu(nil)" - } - type Alias SessionTypeUbuntu - return fmt.Sprintf("SessionTypeUbuntu%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeUbuntu) TypeID() uint32 { - return SessionTypeUbuntuTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeUbuntu) TypeName() string { - return "sessionTypeUbuntu" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeUbuntu) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeUbuntu", - ID: SessionTypeUbuntuTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeUbuntu) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeUbuntu#5d8f6ac5 as nil") - } - b.PutID(SessionTypeUbuntuTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeUbuntu) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeUbuntu#5d8f6ac5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeUbuntu) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeUbuntu#5d8f6ac5 to nil") - } - if err := b.ConsumeID(SessionTypeUbuntuTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeUbuntu#5d8f6ac5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeUbuntu) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeUbuntu#5d8f6ac5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeUbuntu) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeUbuntu#5d8f6ac5 as nil") - } - b.ObjStart() - b.PutID("sessionTypeUbuntu") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeUbuntu) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeUbuntu#5d8f6ac5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeUbuntu"); err != nil { - return fmt.Errorf("unable to decode sessionTypeUbuntu#5d8f6ac5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeUnknown represents TL type `sessionTypeUnknown#df17030`. -type SessionTypeUnknown struct { -} - -// SessionTypeUnknownTypeID is TL type id of SessionTypeUnknown. -const SessionTypeUnknownTypeID = 0xdf17030 - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeUnknown) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeUnknown. -var ( - _ bin.Encoder = &SessionTypeUnknown{} - _ bin.Decoder = &SessionTypeUnknown{} - _ bin.BareEncoder = &SessionTypeUnknown{} - _ bin.BareDecoder = &SessionTypeUnknown{} - - _ SessionTypeClass = &SessionTypeUnknown{} -) - -func (s *SessionTypeUnknown) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeUnknown) String() string { - if s == nil { - return "SessionTypeUnknown(nil)" - } - type Alias SessionTypeUnknown - return fmt.Sprintf("SessionTypeUnknown%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeUnknown) TypeID() uint32 { - return SessionTypeUnknownTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeUnknown) TypeName() string { - return "sessionTypeUnknown" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeUnknown) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeUnknown", - ID: SessionTypeUnknownTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeUnknown) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeUnknown#df17030 as nil") - } - b.PutID(SessionTypeUnknownTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeUnknown) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeUnknown#df17030 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeUnknown) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeUnknown#df17030 to nil") - } - if err := b.ConsumeID(SessionTypeUnknownTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeUnknown#df17030: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeUnknown) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeUnknown#df17030 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeUnknown) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeUnknown#df17030 as nil") - } - b.ObjStart() - b.PutID("sessionTypeUnknown") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeUnknown) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeUnknown#df17030 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeUnknown"); err != nil { - return fmt.Errorf("unable to decode sessionTypeUnknown#df17030: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeVivaldi represents TL type `sessionTypeVivaldi#42c985ef`. -type SessionTypeVivaldi struct { -} - -// SessionTypeVivaldiTypeID is TL type id of SessionTypeVivaldi. -const SessionTypeVivaldiTypeID = 0x42c985ef - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeVivaldi) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeVivaldi. -var ( - _ bin.Encoder = &SessionTypeVivaldi{} - _ bin.Decoder = &SessionTypeVivaldi{} - _ bin.BareEncoder = &SessionTypeVivaldi{} - _ bin.BareDecoder = &SessionTypeVivaldi{} - - _ SessionTypeClass = &SessionTypeVivaldi{} -) - -func (s *SessionTypeVivaldi) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeVivaldi) String() string { - if s == nil { - return "SessionTypeVivaldi(nil)" - } - type Alias SessionTypeVivaldi - return fmt.Sprintf("SessionTypeVivaldi%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeVivaldi) TypeID() uint32 { - return SessionTypeVivaldiTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeVivaldi) TypeName() string { - return "sessionTypeVivaldi" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeVivaldi) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeVivaldi", - ID: SessionTypeVivaldiTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeVivaldi) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeVivaldi#42c985ef as nil") - } - b.PutID(SessionTypeVivaldiTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeVivaldi) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeVivaldi#42c985ef as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeVivaldi) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeVivaldi#42c985ef to nil") - } - if err := b.ConsumeID(SessionTypeVivaldiTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeVivaldi#42c985ef: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeVivaldi) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeVivaldi#42c985ef to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeVivaldi) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeVivaldi#42c985ef as nil") - } - b.ObjStart() - b.PutID("sessionTypeVivaldi") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeVivaldi) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeVivaldi#42c985ef to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeVivaldi"); err != nil { - return fmt.Errorf("unable to decode sessionTypeVivaldi#42c985ef: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeWindows represents TL type `sessionTypeWindows#9c1272a8`. -type SessionTypeWindows struct { -} - -// SessionTypeWindowsTypeID is TL type id of SessionTypeWindows. -const SessionTypeWindowsTypeID = 0x9c1272a8 - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeWindows) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeWindows. -var ( - _ bin.Encoder = &SessionTypeWindows{} - _ bin.Decoder = &SessionTypeWindows{} - _ bin.BareEncoder = &SessionTypeWindows{} - _ bin.BareDecoder = &SessionTypeWindows{} - - _ SessionTypeClass = &SessionTypeWindows{} -) - -func (s *SessionTypeWindows) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeWindows) String() string { - if s == nil { - return "SessionTypeWindows(nil)" - } - type Alias SessionTypeWindows - return fmt.Sprintf("SessionTypeWindows%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeWindows) TypeID() uint32 { - return SessionTypeWindowsTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeWindows) TypeName() string { - return "sessionTypeWindows" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeWindows) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeWindows", - ID: SessionTypeWindowsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeWindows) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeWindows#9c1272a8 as nil") - } - b.PutID(SessionTypeWindowsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeWindows) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeWindows#9c1272a8 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeWindows) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeWindows#9c1272a8 to nil") - } - if err := b.ConsumeID(SessionTypeWindowsTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeWindows#9c1272a8: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeWindows) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeWindows#9c1272a8 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeWindows) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeWindows#9c1272a8 as nil") - } - b.ObjStart() - b.PutID("sessionTypeWindows") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeWindows) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeWindows#9c1272a8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeWindows"); err != nil { - return fmt.Errorf("unable to decode sessionTypeWindows#9c1272a8: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeXbox represents TL type `sessionTypeXbox#6ea39dac`. -type SessionTypeXbox struct { -} - -// SessionTypeXboxTypeID is TL type id of SessionTypeXbox. -const SessionTypeXboxTypeID = 0x6ea39dac - -// construct implements constructor of SessionTypeClass. -func (s SessionTypeXbox) construct() SessionTypeClass { return &s } - -// Ensuring interfaces in compile-time for SessionTypeXbox. -var ( - _ bin.Encoder = &SessionTypeXbox{} - _ bin.Decoder = &SessionTypeXbox{} - _ bin.BareEncoder = &SessionTypeXbox{} - _ bin.BareDecoder = &SessionTypeXbox{} - - _ SessionTypeClass = &SessionTypeXbox{} -) - -func (s *SessionTypeXbox) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SessionTypeXbox) String() string { - if s == nil { - return "SessionTypeXbox(nil)" - } - type Alias SessionTypeXbox - return fmt.Sprintf("SessionTypeXbox%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SessionTypeXbox) TypeID() uint32 { - return SessionTypeXboxTypeID -} - -// TypeName returns name of type in TL schema. -func (*SessionTypeXbox) TypeName() string { - return "sessionTypeXbox" -} - -// TypeInfo returns info about TL type. -func (s *SessionTypeXbox) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessionTypeXbox", - ID: SessionTypeXboxTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SessionTypeXbox) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeXbox#6ea39dac as nil") - } - b.PutID(SessionTypeXboxTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SessionTypeXbox) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeXbox#6ea39dac as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SessionTypeXbox) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeXbox#6ea39dac to nil") - } - if err := b.ConsumeID(SessionTypeXboxTypeID); err != nil { - return fmt.Errorf("unable to decode sessionTypeXbox#6ea39dac: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SessionTypeXbox) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeXbox#6ea39dac to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SessionTypeXbox) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessionTypeXbox#6ea39dac as nil") - } - b.ObjStart() - b.PutID("sessionTypeXbox") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SessionTypeXbox) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessionTypeXbox#6ea39dac to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessionTypeXbox"); err != nil { - return fmt.Errorf("unable to decode sessionTypeXbox#6ea39dac: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SessionTypeClassName is schema name of SessionTypeClass. -const SessionTypeClassName = "SessionType" - -// SessionTypeClass represents SessionType generic type. -// -// Example: -// -// g, err := tdapi.DecodeSessionType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.SessionTypeAndroid: // sessionTypeAndroid#84836098 -// case *tdapi.SessionTypeApple: // sessionTypeApple#9399d24b -// case *tdapi.SessionTypeBrave: // sessionTypeBrave#b778e9ed -// case *tdapi.SessionTypeChrome: // sessionTypeChrome#5dc92969 -// case *tdapi.SessionTypeEdge: // sessionTypeEdge#dfe0cb5b -// case *tdapi.SessionTypeFirefox: // sessionTypeFirefox#7e83fda4 -// case *tdapi.SessionTypeIpad: // sessionTypeIpad#4d2abeef -// case *tdapi.SessionTypeIphone: // sessionTypeIphone#5d182bd -// case *tdapi.SessionTypeLinux: // sessionTypeLinux#a757ba69 -// case *tdapi.SessionTypeMAC: // sessionTypeMac#db81caa1 -// case *tdapi.SessionTypeOpera: // sessionTypeOpera#a8c21c7a -// case *tdapi.SessionTypeSafari: // sessionTypeSafari#2a5b9c59 -// case *tdapi.SessionTypeUbuntu: // sessionTypeUbuntu#5d8f6ac5 -// case *tdapi.SessionTypeUnknown: // sessionTypeUnknown#df17030 -// case *tdapi.SessionTypeVivaldi: // sessionTypeVivaldi#42c985ef -// case *tdapi.SessionTypeWindows: // sessionTypeWindows#9c1272a8 -// case *tdapi.SessionTypeXbox: // sessionTypeXbox#6ea39dac -// default: panic(v) -// } -type SessionTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() SessionTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeSessionType implements binary de-serialization for SessionTypeClass. -func DecodeSessionType(buf *bin.Buffer) (SessionTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case SessionTypeAndroidTypeID: - // Decoding sessionTypeAndroid#84836098. - v := SessionTypeAndroid{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeAppleTypeID: - // Decoding sessionTypeApple#9399d24b. - v := SessionTypeApple{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeBraveTypeID: - // Decoding sessionTypeBrave#b778e9ed. - v := SessionTypeBrave{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeChromeTypeID: - // Decoding sessionTypeChrome#5dc92969. - v := SessionTypeChrome{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeEdgeTypeID: - // Decoding sessionTypeEdge#dfe0cb5b. - v := SessionTypeEdge{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeFirefoxTypeID: - // Decoding sessionTypeFirefox#7e83fda4. - v := SessionTypeFirefox{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeIpadTypeID: - // Decoding sessionTypeIpad#4d2abeef. - v := SessionTypeIpad{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeIphoneTypeID: - // Decoding sessionTypeIphone#5d182bd. - v := SessionTypeIphone{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeLinuxTypeID: - // Decoding sessionTypeLinux#a757ba69. - v := SessionTypeLinux{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeMACTypeID: - // Decoding sessionTypeMac#db81caa1. - v := SessionTypeMAC{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeOperaTypeID: - // Decoding sessionTypeOpera#a8c21c7a. - v := SessionTypeOpera{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeSafariTypeID: - // Decoding sessionTypeSafari#2a5b9c59. - v := SessionTypeSafari{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeUbuntuTypeID: - // Decoding sessionTypeUbuntu#5d8f6ac5. - v := SessionTypeUbuntu{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeUnknownTypeID: - // Decoding sessionTypeUnknown#df17030. - v := SessionTypeUnknown{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeVivaldiTypeID: - // Decoding sessionTypeVivaldi#42c985ef. - v := SessionTypeVivaldi{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeWindowsTypeID: - // Decoding sessionTypeWindows#9c1272a8. - v := SessionTypeWindows{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case SessionTypeXboxTypeID: - // Decoding sessionTypeXbox#6ea39dac. - v := SessionTypeXbox{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONSessionType implements binary de-serialization for SessionTypeClass. -func DecodeTDLibJSONSessionType(buf tdjson.Decoder) (SessionTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "sessionTypeAndroid": - // Decoding sessionTypeAndroid#84836098. - v := SessionTypeAndroid{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeApple": - // Decoding sessionTypeApple#9399d24b. - v := SessionTypeApple{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeBrave": - // Decoding sessionTypeBrave#b778e9ed. - v := SessionTypeBrave{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeChrome": - // Decoding sessionTypeChrome#5dc92969. - v := SessionTypeChrome{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeEdge": - // Decoding sessionTypeEdge#dfe0cb5b. - v := SessionTypeEdge{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeFirefox": - // Decoding sessionTypeFirefox#7e83fda4. - v := SessionTypeFirefox{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeIpad": - // Decoding sessionTypeIpad#4d2abeef. - v := SessionTypeIpad{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeIphone": - // Decoding sessionTypeIphone#5d182bd. - v := SessionTypeIphone{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeLinux": - // Decoding sessionTypeLinux#a757ba69. - v := SessionTypeLinux{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeMac": - // Decoding sessionTypeMac#db81caa1. - v := SessionTypeMAC{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeOpera": - // Decoding sessionTypeOpera#a8c21c7a. - v := SessionTypeOpera{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeSafari": - // Decoding sessionTypeSafari#2a5b9c59. - v := SessionTypeSafari{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeUbuntu": - // Decoding sessionTypeUbuntu#5d8f6ac5. - v := SessionTypeUbuntu{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeUnknown": - // Decoding sessionTypeUnknown#df17030. - v := SessionTypeUnknown{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeVivaldi": - // Decoding sessionTypeVivaldi#42c985ef. - v := SessionTypeVivaldi{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeWindows": - // Decoding sessionTypeWindows#9c1272a8. - v := SessionTypeWindows{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - case "sessionTypeXbox": - // Decoding sessionTypeXbox#6ea39dac. - v := SessionTypeXbox{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SessionTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// SessionType boxes the SessionTypeClass providing a helper. -type SessionTypeBox struct { - SessionType SessionTypeClass -} - -// Decode implements bin.Decoder for SessionTypeBox. -func (b *SessionTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode SessionTypeBox to nil") - } - v, err := DecodeSessionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SessionType = v - return nil -} - -// Encode implements bin.Encode for SessionTypeBox. -func (b *SessionTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.SessionType == nil { - return fmt.Errorf("unable to encode SessionTypeClass as nil") - } - return b.SessionType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for SessionTypeBox. -func (b *SessionTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode SessionTypeBox to nil") - } - v, err := DecodeTDLibJSONSessionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SessionType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for SessionTypeBox. -func (b *SessionTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.SessionType == nil { - return fmt.Errorf("unable to encode SessionTypeClass as nil") - } - return b.SessionType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_sessions_gen.go b/tdapi/tl_sessions_gen.go deleted file mode 100644 index 545e016b4..000000000 --- a/tdapi/tl_sessions_gen.go +++ /dev/null @@ -1,256 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Sessions represents TL type `sessions#997833aa`. -type Sessions struct { - // List of sessions - Sessions []Session - // Number of days of inactivity before sessions will automatically be terminated; 1-366 - // days - InactiveSessionTTLDays int32 -} - -// SessionsTypeID is TL type id of Sessions. -const SessionsTypeID = 0x997833aa - -// Ensuring interfaces in compile-time for Sessions. -var ( - _ bin.Encoder = &Sessions{} - _ bin.Decoder = &Sessions{} - _ bin.BareEncoder = &Sessions{} - _ bin.BareDecoder = &Sessions{} -) - -func (s *Sessions) Zero() bool { - if s == nil { - return true - } - if !(s.Sessions == nil) { - return false - } - if !(s.InactiveSessionTTLDays == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *Sessions) String() string { - if s == nil { - return "Sessions(nil)" - } - type Alias Sessions - return fmt.Sprintf("Sessions%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Sessions) TypeID() uint32 { - return SessionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*Sessions) TypeName() string { - return "sessions" -} - -// TypeInfo returns info about TL type. -func (s *Sessions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sessions", - ID: SessionsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sessions", - SchemaName: "sessions", - }, - { - Name: "InactiveSessionTTLDays", - SchemaName: "inactive_session_ttl_days", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *Sessions) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessions#997833aa as nil") - } - b.PutID(SessionsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *Sessions) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sessions#997833aa as nil") - } - b.PutInt(len(s.Sessions)) - for idx, v := range s.Sessions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare sessions#997833aa: field sessions element with index %d: %w", idx, err) - } - } - b.PutInt32(s.InactiveSessionTTLDays) - return nil -} - -// Decode implements bin.Decoder. -func (s *Sessions) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessions#997833aa to nil") - } - if err := b.ConsumeID(SessionsTypeID); err != nil { - return fmt.Errorf("unable to decode sessions#997833aa: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *Sessions) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sessions#997833aa to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode sessions#997833aa: field sessions: %w", err) - } - - if headerLen > 0 { - s.Sessions = make([]Session, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Session - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare sessions#997833aa: field sessions: %w", err) - } - s.Sessions = append(s.Sessions, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sessions#997833aa: field inactive_session_ttl_days: %w", err) - } - s.InactiveSessionTTLDays = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *Sessions) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sessions#997833aa as nil") - } - b.ObjStart() - b.PutID("sessions") - b.Comma() - b.FieldStart("sessions") - b.ArrStart() - for idx, v := range s.Sessions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sessions#997833aa: field sessions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("inactive_session_ttl_days") - b.PutInt32(s.InactiveSessionTTLDays) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *Sessions) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sessions#997833aa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sessions"); err != nil { - return fmt.Errorf("unable to decode sessions#997833aa: %w", err) - } - case "sessions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Session - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sessions#997833aa: field sessions: %w", err) - } - s.Sessions = append(s.Sessions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode sessions#997833aa: field sessions: %w", err) - } - case "inactive_session_ttl_days": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sessions#997833aa: field inactive_session_ttl_days: %w", err) - } - s.InactiveSessionTTLDays = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSessions returns value of Sessions field. -func (s *Sessions) GetSessions() (value []Session) { - if s == nil { - return - } - return s.Sessions -} - -// GetInactiveSessionTTLDays returns value of InactiveSessionTTLDays field. -func (s *Sessions) GetInactiveSessionTTLDays() (value int32) { - if s == nil { - return - } - return s.InactiveSessionTTLDays -} diff --git a/tdapi/tl_set_accent_color_gen.go b/tdapi/tl_set_accent_color_gen.go deleted file mode 100644 index 85e1186ad..000000000 --- a/tdapi/tl_set_accent_color_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetAccentColorRequest represents TL type `setAccentColor#6389cb39`. -type SetAccentColorRequest struct { - // Identifier of the accent color to use - AccentColorID int32 - // Identifier of a custom emoji to be shown on the reply header and link preview - // background; 0 if none - BackgroundCustomEmojiID int64 -} - -// SetAccentColorRequestTypeID is TL type id of SetAccentColorRequest. -const SetAccentColorRequestTypeID = 0x6389cb39 - -// Ensuring interfaces in compile-time for SetAccentColorRequest. -var ( - _ bin.Encoder = &SetAccentColorRequest{} - _ bin.Decoder = &SetAccentColorRequest{} - _ bin.BareEncoder = &SetAccentColorRequest{} - _ bin.BareDecoder = &SetAccentColorRequest{} -) - -func (s *SetAccentColorRequest) Zero() bool { - if s == nil { - return true - } - if !(s.AccentColorID == 0) { - return false - } - if !(s.BackgroundCustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetAccentColorRequest) String() string { - if s == nil { - return "SetAccentColorRequest(nil)" - } - type Alias SetAccentColorRequest - return fmt.Sprintf("SetAccentColorRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetAccentColorRequest) TypeID() uint32 { - return SetAccentColorRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetAccentColorRequest) TypeName() string { - return "setAccentColor" -} - -// TypeInfo returns info about TL type. -func (s *SetAccentColorRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setAccentColor", - ID: SetAccentColorRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AccentColorID", - SchemaName: "accent_color_id", - }, - { - Name: "BackgroundCustomEmojiID", - SchemaName: "background_custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetAccentColorRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAccentColor#6389cb39 as nil") - } - b.PutID(SetAccentColorRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetAccentColorRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAccentColor#6389cb39 as nil") - } - b.PutInt32(s.AccentColorID) - b.PutLong(s.BackgroundCustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetAccentColorRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAccentColor#6389cb39 to nil") - } - if err := b.ConsumeID(SetAccentColorRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setAccentColor#6389cb39: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetAccentColorRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAccentColor#6389cb39 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setAccentColor#6389cb39: field accent_color_id: %w", err) - } - s.AccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setAccentColor#6389cb39: field background_custom_emoji_id: %w", err) - } - s.BackgroundCustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetAccentColorRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setAccentColor#6389cb39 as nil") - } - b.ObjStart() - b.PutID("setAccentColor") - b.Comma() - b.FieldStart("accent_color_id") - b.PutInt32(s.AccentColorID) - b.Comma() - b.FieldStart("background_custom_emoji_id") - b.PutLong(s.BackgroundCustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetAccentColorRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setAccentColor#6389cb39 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setAccentColor"); err != nil { - return fmt.Errorf("unable to decode setAccentColor#6389cb39: %w", err) - } - case "accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setAccentColor#6389cb39: field accent_color_id: %w", err) - } - s.AccentColorID = value - case "background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setAccentColor#6389cb39: field background_custom_emoji_id: %w", err) - } - s.BackgroundCustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAccentColorID returns value of AccentColorID field. -func (s *SetAccentColorRequest) GetAccentColorID() (value int32) { - if s == nil { - return - } - return s.AccentColorID -} - -// GetBackgroundCustomEmojiID returns value of BackgroundCustomEmojiID field. -func (s *SetAccentColorRequest) GetBackgroundCustomEmojiID() (value int64) { - if s == nil { - return - } - return s.BackgroundCustomEmojiID -} - -// SetAccentColor invokes method setAccentColor#6389cb39 returning error if any. -func (c *Client) SetAccentColor(ctx context.Context, request *SetAccentColorRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_account_ttl_gen.go b/tdapi/tl_set_account_ttl_gen.go deleted file mode 100644 index 37e5ecf65..000000000 --- a/tdapi/tl_set_account_ttl_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetAccountTTLRequest represents TL type `setAccountTtl#29ce58e8`. -type SetAccountTTLRequest struct { - // New account TTL - TTL AccountTTL -} - -// SetAccountTTLRequestTypeID is TL type id of SetAccountTTLRequest. -const SetAccountTTLRequestTypeID = 0x29ce58e8 - -// Ensuring interfaces in compile-time for SetAccountTTLRequest. -var ( - _ bin.Encoder = &SetAccountTTLRequest{} - _ bin.Decoder = &SetAccountTTLRequest{} - _ bin.BareEncoder = &SetAccountTTLRequest{} - _ bin.BareDecoder = &SetAccountTTLRequest{} -) - -func (s *SetAccountTTLRequest) Zero() bool { - if s == nil { - return true - } - if !(s.TTL.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetAccountTTLRequest) String() string { - if s == nil { - return "SetAccountTTLRequest(nil)" - } - type Alias SetAccountTTLRequest - return fmt.Sprintf("SetAccountTTLRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetAccountTTLRequest) TypeID() uint32 { - return SetAccountTTLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetAccountTTLRequest) TypeName() string { - return "setAccountTtl" -} - -// TypeInfo returns info about TL type. -func (s *SetAccountTTLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setAccountTtl", - ID: SetAccountTTLRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TTL", - SchemaName: "ttl", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetAccountTTLRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAccountTtl#29ce58e8 as nil") - } - b.PutID(SetAccountTTLRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetAccountTTLRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAccountTtl#29ce58e8 as nil") - } - if err := s.TTL.Encode(b); err != nil { - return fmt.Errorf("unable to encode setAccountTtl#29ce58e8: field ttl: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetAccountTTLRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAccountTtl#29ce58e8 to nil") - } - if err := b.ConsumeID(SetAccountTTLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setAccountTtl#29ce58e8: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetAccountTTLRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAccountTtl#29ce58e8 to nil") - } - { - if err := s.TTL.Decode(b); err != nil { - return fmt.Errorf("unable to decode setAccountTtl#29ce58e8: field ttl: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetAccountTTLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setAccountTtl#29ce58e8 as nil") - } - b.ObjStart() - b.PutID("setAccountTtl") - b.Comma() - b.FieldStart("ttl") - if err := s.TTL.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setAccountTtl#29ce58e8: field ttl: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetAccountTTLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setAccountTtl#29ce58e8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setAccountTtl"); err != nil { - return fmt.Errorf("unable to decode setAccountTtl#29ce58e8: %w", err) - } - case "ttl": - if err := s.TTL.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setAccountTtl#29ce58e8: field ttl: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTTL returns value of TTL field. -func (s *SetAccountTTLRequest) GetTTL() (value AccountTTL) { - if s == nil { - return - } - return s.TTL -} - -// SetAccountTTL invokes method setAccountTtl#29ce58e8 returning error if any. -func (c *Client) SetAccountTTL(ctx context.Context, ttl AccountTTL) error { - var ok Ok - - request := &SetAccountTTLRequest{ - TTL: ttl, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_alarm_gen.go b/tdapi/tl_set_alarm_gen.go deleted file mode 100644 index 879e3b3d1..000000000 --- a/tdapi/tl_set_alarm_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetAlarmRequest represents TL type `setAlarm#cbef7e15`. -type SetAlarmRequest struct { - // Number of seconds before the function returns - Seconds float64 -} - -// SetAlarmRequestTypeID is TL type id of SetAlarmRequest. -const SetAlarmRequestTypeID = 0xcbef7e15 - -// Ensuring interfaces in compile-time for SetAlarmRequest. -var ( - _ bin.Encoder = &SetAlarmRequest{} - _ bin.Decoder = &SetAlarmRequest{} - _ bin.BareEncoder = &SetAlarmRequest{} - _ bin.BareDecoder = &SetAlarmRequest{} -) - -func (s *SetAlarmRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Seconds == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetAlarmRequest) String() string { - if s == nil { - return "SetAlarmRequest(nil)" - } - type Alias SetAlarmRequest - return fmt.Sprintf("SetAlarmRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetAlarmRequest) TypeID() uint32 { - return SetAlarmRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetAlarmRequest) TypeName() string { - return "setAlarm" -} - -// TypeInfo returns info about TL type. -func (s *SetAlarmRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setAlarm", - ID: SetAlarmRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Seconds", - SchemaName: "seconds", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetAlarmRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAlarm#cbef7e15 as nil") - } - b.PutID(SetAlarmRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetAlarmRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAlarm#cbef7e15 as nil") - } - b.PutDouble(s.Seconds) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetAlarmRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAlarm#cbef7e15 to nil") - } - if err := b.ConsumeID(SetAlarmRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setAlarm#cbef7e15: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetAlarmRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAlarm#cbef7e15 to nil") - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode setAlarm#cbef7e15: field seconds: %w", err) - } - s.Seconds = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetAlarmRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setAlarm#cbef7e15 as nil") - } - b.ObjStart() - b.PutID("setAlarm") - b.Comma() - b.FieldStart("seconds") - b.PutDouble(s.Seconds) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetAlarmRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setAlarm#cbef7e15 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setAlarm"); err != nil { - return fmt.Errorf("unable to decode setAlarm#cbef7e15: %w", err) - } - case "seconds": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode setAlarm#cbef7e15: field seconds: %w", err) - } - s.Seconds = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSeconds returns value of Seconds field. -func (s *SetAlarmRequest) GetSeconds() (value float64) { - if s == nil { - return - } - return s.Seconds -} - -// SetAlarm invokes method setAlarm#cbef7e15 returning error if any. -func (c *Client) SetAlarm(ctx context.Context, seconds float64) error { - var ok Ok - - request := &SetAlarmRequest{ - Seconds: seconds, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_application_verification_token_gen.go b/tdapi/tl_set_application_verification_token_gen.go deleted file mode 100644 index 29c255efa..000000000 --- a/tdapi/tl_set_application_verification_token_gen.go +++ /dev/null @@ -1,239 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetApplicationVerificationTokenRequest represents TL type `setApplicationVerificationToken#3744af85`. -type SetApplicationVerificationTokenRequest struct { - // Unique identifier for the verification process as received from - // updateApplicationVerificationRequired - VerificationID int64 - // Play Integrity API token for the Android application, or secret from push notification - // for the iOS application; - Token string -} - -// SetApplicationVerificationTokenRequestTypeID is TL type id of SetApplicationVerificationTokenRequest. -const SetApplicationVerificationTokenRequestTypeID = 0x3744af85 - -// Ensuring interfaces in compile-time for SetApplicationVerificationTokenRequest. -var ( - _ bin.Encoder = &SetApplicationVerificationTokenRequest{} - _ bin.Decoder = &SetApplicationVerificationTokenRequest{} - _ bin.BareEncoder = &SetApplicationVerificationTokenRequest{} - _ bin.BareDecoder = &SetApplicationVerificationTokenRequest{} -) - -func (s *SetApplicationVerificationTokenRequest) Zero() bool { - if s == nil { - return true - } - if !(s.VerificationID == 0) { - return false - } - if !(s.Token == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetApplicationVerificationTokenRequest) String() string { - if s == nil { - return "SetApplicationVerificationTokenRequest(nil)" - } - type Alias SetApplicationVerificationTokenRequest - return fmt.Sprintf("SetApplicationVerificationTokenRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetApplicationVerificationTokenRequest) TypeID() uint32 { - return SetApplicationVerificationTokenRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetApplicationVerificationTokenRequest) TypeName() string { - return "setApplicationVerificationToken" -} - -// TypeInfo returns info about TL type. -func (s *SetApplicationVerificationTokenRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setApplicationVerificationToken", - ID: SetApplicationVerificationTokenRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VerificationID", - SchemaName: "verification_id", - }, - { - Name: "Token", - SchemaName: "token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetApplicationVerificationTokenRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setApplicationVerificationToken#3744af85 as nil") - } - b.PutID(SetApplicationVerificationTokenRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetApplicationVerificationTokenRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setApplicationVerificationToken#3744af85 as nil") - } - b.PutInt53(s.VerificationID) - b.PutString(s.Token) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetApplicationVerificationTokenRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setApplicationVerificationToken#3744af85 to nil") - } - if err := b.ConsumeID(SetApplicationVerificationTokenRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetApplicationVerificationTokenRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setApplicationVerificationToken#3744af85 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: field verification_id: %w", err) - } - s.VerificationID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: field token: %w", err) - } - s.Token = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetApplicationVerificationTokenRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setApplicationVerificationToken#3744af85 as nil") - } - b.ObjStart() - b.PutID("setApplicationVerificationToken") - b.Comma() - b.FieldStart("verification_id") - b.PutInt53(s.VerificationID) - b.Comma() - b.FieldStart("token") - b.PutString(s.Token) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetApplicationVerificationTokenRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setApplicationVerificationToken#3744af85 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setApplicationVerificationToken"); err != nil { - return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: %w", err) - } - case "verification_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: field verification_id: %w", err) - } - s.VerificationID = value - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setApplicationVerificationToken#3744af85: field token: %w", err) - } - s.Token = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVerificationID returns value of VerificationID field. -func (s *SetApplicationVerificationTokenRequest) GetVerificationID() (value int64) { - if s == nil { - return - } - return s.VerificationID -} - -// GetToken returns value of Token field. -func (s *SetApplicationVerificationTokenRequest) GetToken() (value string) { - if s == nil { - return - } - return s.Token -} - -// SetApplicationVerificationToken invokes method setApplicationVerificationToken#3744af85 returning error if any. -func (c *Client) SetApplicationVerificationToken(ctx context.Context, request *SetApplicationVerificationTokenRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_archive_chat_list_settings_gen.go b/tdapi/tl_set_archive_chat_list_settings_gen.go deleted file mode 100644 index 32d3aa789..000000000 --- a/tdapi/tl_set_archive_chat_list_settings_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetArchiveChatListSettingsRequest represents TL type `setArchiveChatListSettings#cb454c0a`. -type SetArchiveChatListSettingsRequest struct { - // New settings - Settings ArchiveChatListSettings -} - -// SetArchiveChatListSettingsRequestTypeID is TL type id of SetArchiveChatListSettingsRequest. -const SetArchiveChatListSettingsRequestTypeID = 0xcb454c0a - -// Ensuring interfaces in compile-time for SetArchiveChatListSettingsRequest. -var ( - _ bin.Encoder = &SetArchiveChatListSettingsRequest{} - _ bin.Decoder = &SetArchiveChatListSettingsRequest{} - _ bin.BareEncoder = &SetArchiveChatListSettingsRequest{} - _ bin.BareDecoder = &SetArchiveChatListSettingsRequest{} -) - -func (s *SetArchiveChatListSettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Settings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetArchiveChatListSettingsRequest) String() string { - if s == nil { - return "SetArchiveChatListSettingsRequest(nil)" - } - type Alias SetArchiveChatListSettingsRequest - return fmt.Sprintf("SetArchiveChatListSettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetArchiveChatListSettingsRequest) TypeID() uint32 { - return SetArchiveChatListSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetArchiveChatListSettingsRequest) TypeName() string { - return "setArchiveChatListSettings" -} - -// TypeInfo returns info about TL type. -func (s *SetArchiveChatListSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setArchiveChatListSettings", - ID: SetArchiveChatListSettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Settings", - SchemaName: "settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetArchiveChatListSettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setArchiveChatListSettings#cb454c0a as nil") - } - b.PutID(SetArchiveChatListSettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetArchiveChatListSettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setArchiveChatListSettings#cb454c0a as nil") - } - if err := s.Settings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setArchiveChatListSettings#cb454c0a: field settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetArchiveChatListSettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setArchiveChatListSettings#cb454c0a to nil") - } - if err := b.ConsumeID(SetArchiveChatListSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setArchiveChatListSettings#cb454c0a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetArchiveChatListSettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setArchiveChatListSettings#cb454c0a to nil") - } - { - if err := s.Settings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setArchiveChatListSettings#cb454c0a: field settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetArchiveChatListSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setArchiveChatListSettings#cb454c0a as nil") - } - b.ObjStart() - b.PutID("setArchiveChatListSettings") - b.Comma() - b.FieldStart("settings") - if err := s.Settings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setArchiveChatListSettings#cb454c0a: field settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetArchiveChatListSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setArchiveChatListSettings#cb454c0a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setArchiveChatListSettings"); err != nil { - return fmt.Errorf("unable to decode setArchiveChatListSettings#cb454c0a: %w", err) - } - case "settings": - if err := s.Settings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setArchiveChatListSettings#cb454c0a: field settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSettings returns value of Settings field. -func (s *SetArchiveChatListSettingsRequest) GetSettings() (value ArchiveChatListSettings) { - if s == nil { - return - } - return s.Settings -} - -// SetArchiveChatListSettings invokes method setArchiveChatListSettings#cb454c0a returning error if any. -func (c *Client) SetArchiveChatListSettings(ctx context.Context, settings ArchiveChatListSettings) error { - var ok Ok - - request := &SetArchiveChatListSettingsRequest{ - Settings: settings, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_authentication_email_address_gen.go b/tdapi/tl_set_authentication_email_address_gen.go deleted file mode 100644 index 9b1436f70..000000000 --- a/tdapi/tl_set_authentication_email_address_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetAuthenticationEmailAddressRequest represents TL type `setAuthenticationEmailAddress#69b2c502`. -type SetAuthenticationEmailAddressRequest struct { - // The email address of the user - EmailAddress string -} - -// SetAuthenticationEmailAddressRequestTypeID is TL type id of SetAuthenticationEmailAddressRequest. -const SetAuthenticationEmailAddressRequestTypeID = 0x69b2c502 - -// Ensuring interfaces in compile-time for SetAuthenticationEmailAddressRequest. -var ( - _ bin.Encoder = &SetAuthenticationEmailAddressRequest{} - _ bin.Decoder = &SetAuthenticationEmailAddressRequest{} - _ bin.BareEncoder = &SetAuthenticationEmailAddressRequest{} - _ bin.BareDecoder = &SetAuthenticationEmailAddressRequest{} -) - -func (s *SetAuthenticationEmailAddressRequest) Zero() bool { - if s == nil { - return true - } - if !(s.EmailAddress == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetAuthenticationEmailAddressRequest) String() string { - if s == nil { - return "SetAuthenticationEmailAddressRequest(nil)" - } - type Alias SetAuthenticationEmailAddressRequest - return fmt.Sprintf("SetAuthenticationEmailAddressRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetAuthenticationEmailAddressRequest) TypeID() uint32 { - return SetAuthenticationEmailAddressRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetAuthenticationEmailAddressRequest) TypeName() string { - return "setAuthenticationEmailAddress" -} - -// TypeInfo returns info about TL type. -func (s *SetAuthenticationEmailAddressRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setAuthenticationEmailAddress", - ID: SetAuthenticationEmailAddressRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "EmailAddress", - SchemaName: "email_address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetAuthenticationEmailAddressRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAuthenticationEmailAddress#69b2c502 as nil") - } - b.PutID(SetAuthenticationEmailAddressRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetAuthenticationEmailAddressRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAuthenticationEmailAddress#69b2c502 as nil") - } - b.PutString(s.EmailAddress) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetAuthenticationEmailAddressRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAuthenticationEmailAddress#69b2c502 to nil") - } - if err := b.ConsumeID(SetAuthenticationEmailAddressRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setAuthenticationEmailAddress#69b2c502: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetAuthenticationEmailAddressRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAuthenticationEmailAddress#69b2c502 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setAuthenticationEmailAddress#69b2c502: field email_address: %w", err) - } - s.EmailAddress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetAuthenticationEmailAddressRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setAuthenticationEmailAddress#69b2c502 as nil") - } - b.ObjStart() - b.PutID("setAuthenticationEmailAddress") - b.Comma() - b.FieldStart("email_address") - b.PutString(s.EmailAddress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetAuthenticationEmailAddressRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setAuthenticationEmailAddress#69b2c502 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setAuthenticationEmailAddress"); err != nil { - return fmt.Errorf("unable to decode setAuthenticationEmailAddress#69b2c502: %w", err) - } - case "email_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setAuthenticationEmailAddress#69b2c502: field email_address: %w", err) - } - s.EmailAddress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEmailAddress returns value of EmailAddress field. -func (s *SetAuthenticationEmailAddressRequest) GetEmailAddress() (value string) { - if s == nil { - return - } - return s.EmailAddress -} - -// SetAuthenticationEmailAddress invokes method setAuthenticationEmailAddress#69b2c502 returning error if any. -func (c *Client) SetAuthenticationEmailAddress(ctx context.Context, emailaddress string) error { - var ok Ok - - request := &SetAuthenticationEmailAddressRequest{ - EmailAddress: emailaddress, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_authentication_phone_number_gen.go b/tdapi/tl_set_authentication_phone_number_gen.go deleted file mode 100644 index 49c5f6f4c..000000000 --- a/tdapi/tl_set_authentication_phone_number_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetAuthenticationPhoneNumberRequest represents TL type `setAuthenticationPhoneNumber#33c0d823`. -type SetAuthenticationPhoneNumberRequest struct { - // The phone number of the user, in international format - PhoneNumber string - // Settings for the authentication of the user's phone number; pass null to use default - // settings - Settings PhoneNumberAuthenticationSettings -} - -// SetAuthenticationPhoneNumberRequestTypeID is TL type id of SetAuthenticationPhoneNumberRequest. -const SetAuthenticationPhoneNumberRequestTypeID = 0x33c0d823 - -// Ensuring interfaces in compile-time for SetAuthenticationPhoneNumberRequest. -var ( - _ bin.Encoder = &SetAuthenticationPhoneNumberRequest{} - _ bin.Decoder = &SetAuthenticationPhoneNumberRequest{} - _ bin.BareEncoder = &SetAuthenticationPhoneNumberRequest{} - _ bin.BareDecoder = &SetAuthenticationPhoneNumberRequest{} -) - -func (s *SetAuthenticationPhoneNumberRequest) Zero() bool { - if s == nil { - return true - } - if !(s.PhoneNumber == "") { - return false - } - if !(s.Settings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetAuthenticationPhoneNumberRequest) String() string { - if s == nil { - return "SetAuthenticationPhoneNumberRequest(nil)" - } - type Alias SetAuthenticationPhoneNumberRequest - return fmt.Sprintf("SetAuthenticationPhoneNumberRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetAuthenticationPhoneNumberRequest) TypeID() uint32 { - return SetAuthenticationPhoneNumberRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetAuthenticationPhoneNumberRequest) TypeName() string { - return "setAuthenticationPhoneNumber" -} - -// TypeInfo returns info about TL type. -func (s *SetAuthenticationPhoneNumberRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setAuthenticationPhoneNumber", - ID: SetAuthenticationPhoneNumberRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - { - Name: "Settings", - SchemaName: "settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetAuthenticationPhoneNumberRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAuthenticationPhoneNumber#33c0d823 as nil") - } - b.PutID(SetAuthenticationPhoneNumberRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetAuthenticationPhoneNumberRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAuthenticationPhoneNumber#33c0d823 as nil") - } - b.PutString(s.PhoneNumber) - if err := s.Settings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setAuthenticationPhoneNumber#33c0d823: field settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetAuthenticationPhoneNumberRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAuthenticationPhoneNumber#33c0d823 to nil") - } - if err := b.ConsumeID(SetAuthenticationPhoneNumberRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setAuthenticationPhoneNumber#33c0d823: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetAuthenticationPhoneNumberRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAuthenticationPhoneNumber#33c0d823 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setAuthenticationPhoneNumber#33c0d823: field phone_number: %w", err) - } - s.PhoneNumber = value - } - { - if err := s.Settings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setAuthenticationPhoneNumber#33c0d823: field settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetAuthenticationPhoneNumberRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setAuthenticationPhoneNumber#33c0d823 as nil") - } - b.ObjStart() - b.PutID("setAuthenticationPhoneNumber") - b.Comma() - b.FieldStart("phone_number") - b.PutString(s.PhoneNumber) - b.Comma() - b.FieldStart("settings") - if err := s.Settings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setAuthenticationPhoneNumber#33c0d823: field settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetAuthenticationPhoneNumberRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setAuthenticationPhoneNumber#33c0d823 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setAuthenticationPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode setAuthenticationPhoneNumber#33c0d823: %w", err) - } - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setAuthenticationPhoneNumber#33c0d823: field phone_number: %w", err) - } - s.PhoneNumber = value - case "settings": - if err := s.Settings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setAuthenticationPhoneNumber#33c0d823: field settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (s *SetAuthenticationPhoneNumberRequest) GetPhoneNumber() (value string) { - if s == nil { - return - } - return s.PhoneNumber -} - -// GetSettings returns value of Settings field. -func (s *SetAuthenticationPhoneNumberRequest) GetSettings() (value PhoneNumberAuthenticationSettings) { - if s == nil { - return - } - return s.Settings -} - -// SetAuthenticationPhoneNumber invokes method setAuthenticationPhoneNumber#33c0d823 returning error if any. -func (c *Client) SetAuthenticationPhoneNumber(ctx context.Context, request *SetAuthenticationPhoneNumberRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_auto_download_settings_gen.go b/tdapi/tl_set_auto_download_settings_gen.go deleted file mode 100644 index 6e5ac2953..000000000 --- a/tdapi/tl_set_auto_download_settings_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetAutoDownloadSettingsRequest represents TL type `setAutoDownloadSettings#eaeb64f4`. -type SetAutoDownloadSettingsRequest struct { - // New user auto-download settings - Settings AutoDownloadSettings - // Type of the network for which the new settings are relevant - Type NetworkTypeClass -} - -// SetAutoDownloadSettingsRequestTypeID is TL type id of SetAutoDownloadSettingsRequest. -const SetAutoDownloadSettingsRequestTypeID = 0xeaeb64f4 - -// Ensuring interfaces in compile-time for SetAutoDownloadSettingsRequest. -var ( - _ bin.Encoder = &SetAutoDownloadSettingsRequest{} - _ bin.Decoder = &SetAutoDownloadSettingsRequest{} - _ bin.BareEncoder = &SetAutoDownloadSettingsRequest{} - _ bin.BareDecoder = &SetAutoDownloadSettingsRequest{} -) - -func (s *SetAutoDownloadSettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Settings.Zero()) { - return false - } - if !(s.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetAutoDownloadSettingsRequest) String() string { - if s == nil { - return "SetAutoDownloadSettingsRequest(nil)" - } - type Alias SetAutoDownloadSettingsRequest - return fmt.Sprintf("SetAutoDownloadSettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetAutoDownloadSettingsRequest) TypeID() uint32 { - return SetAutoDownloadSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetAutoDownloadSettingsRequest) TypeName() string { - return "setAutoDownloadSettings" -} - -// TypeInfo returns info about TL type. -func (s *SetAutoDownloadSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setAutoDownloadSettings", - ID: SetAutoDownloadSettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Settings", - SchemaName: "settings", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetAutoDownloadSettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAutoDownloadSettings#eaeb64f4 as nil") - } - b.PutID(SetAutoDownloadSettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetAutoDownloadSettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAutoDownloadSettings#eaeb64f4 as nil") - } - if err := s.Settings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setAutoDownloadSettings#eaeb64f4: field settings: %w", err) - } - if s.Type == nil { - return fmt.Errorf("unable to encode setAutoDownloadSettings#eaeb64f4: field type is nil") - } - if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode setAutoDownloadSettings#eaeb64f4: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetAutoDownloadSettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAutoDownloadSettings#eaeb64f4 to nil") - } - if err := b.ConsumeID(SetAutoDownloadSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setAutoDownloadSettings#eaeb64f4: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetAutoDownloadSettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAutoDownloadSettings#eaeb64f4 to nil") - } - { - if err := s.Settings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setAutoDownloadSettings#eaeb64f4: field settings: %w", err) - } - } - { - value, err := DecodeNetworkType(b) - if err != nil { - return fmt.Errorf("unable to decode setAutoDownloadSettings#eaeb64f4: field type: %w", err) - } - s.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetAutoDownloadSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setAutoDownloadSettings#eaeb64f4 as nil") - } - b.ObjStart() - b.PutID("setAutoDownloadSettings") - b.Comma() - b.FieldStart("settings") - if err := s.Settings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setAutoDownloadSettings#eaeb64f4: field settings: %w", err) - } - b.Comma() - b.FieldStart("type") - if s.Type == nil { - return fmt.Errorf("unable to encode setAutoDownloadSettings#eaeb64f4: field type is nil") - } - if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setAutoDownloadSettings#eaeb64f4: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetAutoDownloadSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setAutoDownloadSettings#eaeb64f4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setAutoDownloadSettings"); err != nil { - return fmt.Errorf("unable to decode setAutoDownloadSettings#eaeb64f4: %w", err) - } - case "settings": - if err := s.Settings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setAutoDownloadSettings#eaeb64f4: field settings: %w", err) - } - case "type": - value, err := DecodeTDLibJSONNetworkType(b) - if err != nil { - return fmt.Errorf("unable to decode setAutoDownloadSettings#eaeb64f4: field type: %w", err) - } - s.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSettings returns value of Settings field. -func (s *SetAutoDownloadSettingsRequest) GetSettings() (value AutoDownloadSettings) { - if s == nil { - return - } - return s.Settings -} - -// GetType returns value of Type field. -func (s *SetAutoDownloadSettingsRequest) GetType() (value NetworkTypeClass) { - if s == nil { - return - } - return s.Type -} - -// SetAutoDownloadSettings invokes method setAutoDownloadSettings#eaeb64f4 returning error if any. -func (c *Client) SetAutoDownloadSettings(ctx context.Context, request *SetAutoDownloadSettingsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_autosave_settings_gen.go b/tdapi/tl_set_autosave_settings_gen.go deleted file mode 100644 index 19a970ebf..000000000 --- a/tdapi/tl_set_autosave_settings_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetAutosaveSettingsRequest represents TL type `setAutosaveSettings#6878c0`. -type SetAutosaveSettingsRequest struct { - // Autosave settings scope - Scope AutosaveSettingsScopeClass - // New autosave settings for the scope; pass null to set autosave settings to default - Settings ScopeAutosaveSettings -} - -// SetAutosaveSettingsRequestTypeID is TL type id of SetAutosaveSettingsRequest. -const SetAutosaveSettingsRequestTypeID = 0x6878c0 - -// Ensuring interfaces in compile-time for SetAutosaveSettingsRequest. -var ( - _ bin.Encoder = &SetAutosaveSettingsRequest{} - _ bin.Decoder = &SetAutosaveSettingsRequest{} - _ bin.BareEncoder = &SetAutosaveSettingsRequest{} - _ bin.BareDecoder = &SetAutosaveSettingsRequest{} -) - -func (s *SetAutosaveSettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Scope == nil) { - return false - } - if !(s.Settings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetAutosaveSettingsRequest) String() string { - if s == nil { - return "SetAutosaveSettingsRequest(nil)" - } - type Alias SetAutosaveSettingsRequest - return fmt.Sprintf("SetAutosaveSettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetAutosaveSettingsRequest) TypeID() uint32 { - return SetAutosaveSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetAutosaveSettingsRequest) TypeName() string { - return "setAutosaveSettings" -} - -// TypeInfo returns info about TL type. -func (s *SetAutosaveSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setAutosaveSettings", - ID: SetAutosaveSettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Scope", - SchemaName: "scope", - }, - { - Name: "Settings", - SchemaName: "settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetAutosaveSettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAutosaveSettings#6878c0 as nil") - } - b.PutID(SetAutosaveSettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetAutosaveSettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setAutosaveSettings#6878c0 as nil") - } - if s.Scope == nil { - return fmt.Errorf("unable to encode setAutosaveSettings#6878c0: field scope is nil") - } - if err := s.Scope.Encode(b); err != nil { - return fmt.Errorf("unable to encode setAutosaveSettings#6878c0: field scope: %w", err) - } - if err := s.Settings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setAutosaveSettings#6878c0: field settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetAutosaveSettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAutosaveSettings#6878c0 to nil") - } - if err := b.ConsumeID(SetAutosaveSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setAutosaveSettings#6878c0: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetAutosaveSettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setAutosaveSettings#6878c0 to nil") - } - { - value, err := DecodeAutosaveSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode setAutosaveSettings#6878c0: field scope: %w", err) - } - s.Scope = value - } - { - if err := s.Settings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setAutosaveSettings#6878c0: field settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetAutosaveSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setAutosaveSettings#6878c0 as nil") - } - b.ObjStart() - b.PutID("setAutosaveSettings") - b.Comma() - b.FieldStart("scope") - if s.Scope == nil { - return fmt.Errorf("unable to encode setAutosaveSettings#6878c0: field scope is nil") - } - if err := s.Scope.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setAutosaveSettings#6878c0: field scope: %w", err) - } - b.Comma() - b.FieldStart("settings") - if err := s.Settings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setAutosaveSettings#6878c0: field settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetAutosaveSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setAutosaveSettings#6878c0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setAutosaveSettings"); err != nil { - return fmt.Errorf("unable to decode setAutosaveSettings#6878c0: %w", err) - } - case "scope": - value, err := DecodeTDLibJSONAutosaveSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode setAutosaveSettings#6878c0: field scope: %w", err) - } - s.Scope = value - case "settings": - if err := s.Settings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setAutosaveSettings#6878c0: field settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetScope returns value of Scope field. -func (s *SetAutosaveSettingsRequest) GetScope() (value AutosaveSettingsScopeClass) { - if s == nil { - return - } - return s.Scope -} - -// GetSettings returns value of Settings field. -func (s *SetAutosaveSettingsRequest) GetSettings() (value ScopeAutosaveSettings) { - if s == nil { - return - } - return s.Settings -} - -// SetAutosaveSettings invokes method setAutosaveSettings#6878c0 returning error if any. -func (c *Client) SetAutosaveSettings(ctx context.Context, request *SetAutosaveSettingsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_bio_gen.go b/tdapi/tl_set_bio_gen.go deleted file mode 100644 index 1c0ea761f..000000000 --- a/tdapi/tl_set_bio_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBioRequest represents TL type `setBio#9f772354`. -type SetBioRequest struct { - // The new value of the user bio; 0-getOption("bio_length_max") characters without line - // feeds - Bio string -} - -// SetBioRequestTypeID is TL type id of SetBioRequest. -const SetBioRequestTypeID = 0x9f772354 - -// Ensuring interfaces in compile-time for SetBioRequest. -var ( - _ bin.Encoder = &SetBioRequest{} - _ bin.Decoder = &SetBioRequest{} - _ bin.BareEncoder = &SetBioRequest{} - _ bin.BareDecoder = &SetBioRequest{} -) - -func (s *SetBioRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Bio == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBioRequest) String() string { - if s == nil { - return "SetBioRequest(nil)" - } - type Alias SetBioRequest - return fmt.Sprintf("SetBioRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBioRequest) TypeID() uint32 { - return SetBioRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBioRequest) TypeName() string { - return "setBio" -} - -// TypeInfo returns info about TL type. -func (s *SetBioRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBio", - ID: SetBioRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Bio", - SchemaName: "bio", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBioRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBio#9f772354 as nil") - } - b.PutID(SetBioRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBioRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBio#9f772354 as nil") - } - b.PutString(s.Bio) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBioRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBio#9f772354 to nil") - } - if err := b.ConsumeID(SetBioRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBio#9f772354: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBioRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBio#9f772354 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBio#9f772354: field bio: %w", err) - } - s.Bio = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBioRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBio#9f772354 as nil") - } - b.ObjStart() - b.PutID("setBio") - b.Comma() - b.FieldStart("bio") - b.PutString(s.Bio) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBioRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBio#9f772354 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBio"); err != nil { - return fmt.Errorf("unable to decode setBio#9f772354: %w", err) - } - case "bio": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBio#9f772354: field bio: %w", err) - } - s.Bio = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBio returns value of Bio field. -func (s *SetBioRequest) GetBio() (value string) { - if s == nil { - return - } - return s.Bio -} - -// SetBio invokes method setBio#9f772354 returning error if any. -func (c *Client) SetBio(ctx context.Context, bio string) error { - var ok Ok - - request := &SetBioRequest{ - Bio: bio, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_birthdate_gen.go b/tdapi/tl_set_birthdate_gen.go deleted file mode 100644 index 579ecea94..000000000 --- a/tdapi/tl_set_birthdate_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBirthdateRequest represents TL type `setBirthdate#4ea9dd98`. -type SetBirthdateRequest struct { - // The new value of the current user's birthdate; pass null to remove the birthdate - Birthdate Birthdate -} - -// SetBirthdateRequestTypeID is TL type id of SetBirthdateRequest. -const SetBirthdateRequestTypeID = 0x4ea9dd98 - -// Ensuring interfaces in compile-time for SetBirthdateRequest. -var ( - _ bin.Encoder = &SetBirthdateRequest{} - _ bin.Decoder = &SetBirthdateRequest{} - _ bin.BareEncoder = &SetBirthdateRequest{} - _ bin.BareDecoder = &SetBirthdateRequest{} -) - -func (s *SetBirthdateRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Birthdate.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBirthdateRequest) String() string { - if s == nil { - return "SetBirthdateRequest(nil)" - } - type Alias SetBirthdateRequest - return fmt.Sprintf("SetBirthdateRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBirthdateRequest) TypeID() uint32 { - return SetBirthdateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBirthdateRequest) TypeName() string { - return "setBirthdate" -} - -// TypeInfo returns info about TL type. -func (s *SetBirthdateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBirthdate", - ID: SetBirthdateRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Birthdate", - SchemaName: "birthdate", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBirthdateRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBirthdate#4ea9dd98 as nil") - } - b.PutID(SetBirthdateRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBirthdateRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBirthdate#4ea9dd98 as nil") - } - if err := s.Birthdate.Encode(b); err != nil { - return fmt.Errorf("unable to encode setBirthdate#4ea9dd98: field birthdate: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBirthdateRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBirthdate#4ea9dd98 to nil") - } - if err := b.ConsumeID(SetBirthdateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBirthdate#4ea9dd98: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBirthdateRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBirthdate#4ea9dd98 to nil") - } - { - if err := s.Birthdate.Decode(b); err != nil { - return fmt.Errorf("unable to decode setBirthdate#4ea9dd98: field birthdate: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBirthdateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBirthdate#4ea9dd98 as nil") - } - b.ObjStart() - b.PutID("setBirthdate") - b.Comma() - b.FieldStart("birthdate") - if err := s.Birthdate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setBirthdate#4ea9dd98: field birthdate: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBirthdateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBirthdate#4ea9dd98 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBirthdate"); err != nil { - return fmt.Errorf("unable to decode setBirthdate#4ea9dd98: %w", err) - } - case "birthdate": - if err := s.Birthdate.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setBirthdate#4ea9dd98: field birthdate: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBirthdate returns value of Birthdate field. -func (s *SetBirthdateRequest) GetBirthdate() (value Birthdate) { - if s == nil { - return - } - return s.Birthdate -} - -// SetBirthdate invokes method setBirthdate#4ea9dd98 returning error if any. -func (c *Client) SetBirthdate(ctx context.Context, birthdate Birthdate) error { - var ok Ok - - request := &SetBirthdateRequest{ - Birthdate: birthdate, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_bot_info_description_gen.go b/tdapi/tl_set_bot_info_description_gen.go deleted file mode 100644 index 485ec0fbd..000000000 --- a/tdapi/tl_set_bot_info_description_gen.go +++ /dev/null @@ -1,273 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBotInfoDescriptionRequest represents TL type `setBotInfoDescription#29571d48`. -type SetBotInfoDescriptionRequest struct { - // Identifier of the target bot - BotUserID int64 - // A two-letter ISO 639-1 language code. If empty, the description will be shown to all - // users for whose languages there is no dedicated description - LanguageCode string - // Sets the text shown in the chat with a bot if the chat is empty. Can be called only if - // userTypeBot.can_be_edited == true - Description string -} - -// SetBotInfoDescriptionRequestTypeID is TL type id of SetBotInfoDescriptionRequest. -const SetBotInfoDescriptionRequestTypeID = 0x29571d48 - -// Ensuring interfaces in compile-time for SetBotInfoDescriptionRequest. -var ( - _ bin.Encoder = &SetBotInfoDescriptionRequest{} - _ bin.Decoder = &SetBotInfoDescriptionRequest{} - _ bin.BareEncoder = &SetBotInfoDescriptionRequest{} - _ bin.BareDecoder = &SetBotInfoDescriptionRequest{} -) - -func (s *SetBotInfoDescriptionRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BotUserID == 0) { - return false - } - if !(s.LanguageCode == "") { - return false - } - if !(s.Description == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBotInfoDescriptionRequest) String() string { - if s == nil { - return "SetBotInfoDescriptionRequest(nil)" - } - type Alias SetBotInfoDescriptionRequest - return fmt.Sprintf("SetBotInfoDescriptionRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBotInfoDescriptionRequest) TypeID() uint32 { - return SetBotInfoDescriptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBotInfoDescriptionRequest) TypeName() string { - return "setBotInfoDescription" -} - -// TypeInfo returns info about TL type. -func (s *SetBotInfoDescriptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBotInfoDescription", - ID: SetBotInfoDescriptionRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - { - Name: "Description", - SchemaName: "description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBotInfoDescriptionRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBotInfoDescription#29571d48 as nil") - } - b.PutID(SetBotInfoDescriptionRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBotInfoDescriptionRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBotInfoDescription#29571d48 as nil") - } - b.PutInt53(s.BotUserID) - b.PutString(s.LanguageCode) - b.PutString(s.Description) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBotInfoDescriptionRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBotInfoDescription#29571d48 to nil") - } - if err := b.ConsumeID(SetBotInfoDescriptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBotInfoDescription#29571d48: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBotInfoDescriptionRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBotInfoDescription#29571d48 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoDescription#29571d48: field bot_user_id: %w", err) - } - s.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoDescription#29571d48: field language_code: %w", err) - } - s.LanguageCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoDescription#29571d48: field description: %w", err) - } - s.Description = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBotInfoDescriptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBotInfoDescription#29571d48 as nil") - } - b.ObjStart() - b.PutID("setBotInfoDescription") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(s.BotUserID) - b.Comma() - b.FieldStart("language_code") - b.PutString(s.LanguageCode) - b.Comma() - b.FieldStart("description") - b.PutString(s.Description) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBotInfoDescriptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBotInfoDescription#29571d48 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBotInfoDescription"); err != nil { - return fmt.Errorf("unable to decode setBotInfoDescription#29571d48: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoDescription#29571d48: field bot_user_id: %w", err) - } - s.BotUserID = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoDescription#29571d48: field language_code: %w", err) - } - s.LanguageCode = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoDescription#29571d48: field description: %w", err) - } - s.Description = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (s *SetBotInfoDescriptionRequest) GetBotUserID() (value int64) { - if s == nil { - return - } - return s.BotUserID -} - -// GetLanguageCode returns value of LanguageCode field. -func (s *SetBotInfoDescriptionRequest) GetLanguageCode() (value string) { - if s == nil { - return - } - return s.LanguageCode -} - -// GetDescription returns value of Description field. -func (s *SetBotInfoDescriptionRequest) GetDescription() (value string) { - if s == nil { - return - } - return s.Description -} - -// SetBotInfoDescription invokes method setBotInfoDescription#29571d48 returning error if any. -func (c *Client) SetBotInfoDescription(ctx context.Context, request *SetBotInfoDescriptionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_bot_info_short_description_gen.go b/tdapi/tl_set_bot_info_short_description_gen.go deleted file mode 100644 index bae1773f9..000000000 --- a/tdapi/tl_set_bot_info_short_description_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBotInfoShortDescriptionRequest represents TL type `setBotInfoShortDescription#3a96bae3`. -type SetBotInfoShortDescriptionRequest struct { - // Identifier of the target bot - BotUserID int64 - // A two-letter ISO 639-1 language code. If empty, the short description will be shown to - // all users for whose languages there is no dedicated description - LanguageCode string - // New bot's short description on the specified language - ShortDescription string -} - -// SetBotInfoShortDescriptionRequestTypeID is TL type id of SetBotInfoShortDescriptionRequest. -const SetBotInfoShortDescriptionRequestTypeID = 0x3a96bae3 - -// Ensuring interfaces in compile-time for SetBotInfoShortDescriptionRequest. -var ( - _ bin.Encoder = &SetBotInfoShortDescriptionRequest{} - _ bin.Decoder = &SetBotInfoShortDescriptionRequest{} - _ bin.BareEncoder = &SetBotInfoShortDescriptionRequest{} - _ bin.BareDecoder = &SetBotInfoShortDescriptionRequest{} -) - -func (s *SetBotInfoShortDescriptionRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BotUserID == 0) { - return false - } - if !(s.LanguageCode == "") { - return false - } - if !(s.ShortDescription == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBotInfoShortDescriptionRequest) String() string { - if s == nil { - return "SetBotInfoShortDescriptionRequest(nil)" - } - type Alias SetBotInfoShortDescriptionRequest - return fmt.Sprintf("SetBotInfoShortDescriptionRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBotInfoShortDescriptionRequest) TypeID() uint32 { - return SetBotInfoShortDescriptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBotInfoShortDescriptionRequest) TypeName() string { - return "setBotInfoShortDescription" -} - -// TypeInfo returns info about TL type. -func (s *SetBotInfoShortDescriptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBotInfoShortDescription", - ID: SetBotInfoShortDescriptionRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - { - Name: "ShortDescription", - SchemaName: "short_description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBotInfoShortDescriptionRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBotInfoShortDescription#3a96bae3 as nil") - } - b.PutID(SetBotInfoShortDescriptionRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBotInfoShortDescriptionRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBotInfoShortDescription#3a96bae3 as nil") - } - b.PutInt53(s.BotUserID) - b.PutString(s.LanguageCode) - b.PutString(s.ShortDescription) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBotInfoShortDescriptionRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBotInfoShortDescription#3a96bae3 to nil") - } - if err := b.ConsumeID(SetBotInfoShortDescriptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBotInfoShortDescription#3a96bae3: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBotInfoShortDescriptionRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBotInfoShortDescription#3a96bae3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoShortDescription#3a96bae3: field bot_user_id: %w", err) - } - s.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoShortDescription#3a96bae3: field language_code: %w", err) - } - s.LanguageCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoShortDescription#3a96bae3: field short_description: %w", err) - } - s.ShortDescription = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBotInfoShortDescriptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBotInfoShortDescription#3a96bae3 as nil") - } - b.ObjStart() - b.PutID("setBotInfoShortDescription") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(s.BotUserID) - b.Comma() - b.FieldStart("language_code") - b.PutString(s.LanguageCode) - b.Comma() - b.FieldStart("short_description") - b.PutString(s.ShortDescription) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBotInfoShortDescriptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBotInfoShortDescription#3a96bae3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBotInfoShortDescription"); err != nil { - return fmt.Errorf("unable to decode setBotInfoShortDescription#3a96bae3: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoShortDescription#3a96bae3: field bot_user_id: %w", err) - } - s.BotUserID = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoShortDescription#3a96bae3: field language_code: %w", err) - } - s.LanguageCode = value - case "short_description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotInfoShortDescription#3a96bae3: field short_description: %w", err) - } - s.ShortDescription = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (s *SetBotInfoShortDescriptionRequest) GetBotUserID() (value int64) { - if s == nil { - return - } - return s.BotUserID -} - -// GetLanguageCode returns value of LanguageCode field. -func (s *SetBotInfoShortDescriptionRequest) GetLanguageCode() (value string) { - if s == nil { - return - } - return s.LanguageCode -} - -// GetShortDescription returns value of ShortDescription field. -func (s *SetBotInfoShortDescriptionRequest) GetShortDescription() (value string) { - if s == nil { - return - } - return s.ShortDescription -} - -// SetBotInfoShortDescription invokes method setBotInfoShortDescription#3a96bae3 returning error if any. -func (c *Client) SetBotInfoShortDescription(ctx context.Context, request *SetBotInfoShortDescriptionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_bot_name_gen.go b/tdapi/tl_set_bot_name_gen.go deleted file mode 100644 index fd2c321d0..000000000 --- a/tdapi/tl_set_bot_name_gen.go +++ /dev/null @@ -1,273 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBotNameRequest represents TL type `setBotName#d295fa71`. -type SetBotNameRequest struct { - // Identifier of the target bot - BotUserID int64 - // A two-letter ISO 639-1 language code. If empty, the name will be shown to all users - // for whose languages there is no dedicated name - LanguageCode string - // New bot's name on the specified language; 0-64 characters; must be non-empty if - // language code is empty - Name string -} - -// SetBotNameRequestTypeID is TL type id of SetBotNameRequest. -const SetBotNameRequestTypeID = 0xd295fa71 - -// Ensuring interfaces in compile-time for SetBotNameRequest. -var ( - _ bin.Encoder = &SetBotNameRequest{} - _ bin.Decoder = &SetBotNameRequest{} - _ bin.BareEncoder = &SetBotNameRequest{} - _ bin.BareDecoder = &SetBotNameRequest{} -) - -func (s *SetBotNameRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BotUserID == 0) { - return false - } - if !(s.LanguageCode == "") { - return false - } - if !(s.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBotNameRequest) String() string { - if s == nil { - return "SetBotNameRequest(nil)" - } - type Alias SetBotNameRequest - return fmt.Sprintf("SetBotNameRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBotNameRequest) TypeID() uint32 { - return SetBotNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBotNameRequest) TypeName() string { - return "setBotName" -} - -// TypeInfo returns info about TL type. -func (s *SetBotNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBotName", - ID: SetBotNameRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBotNameRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBotName#d295fa71 as nil") - } - b.PutID(SetBotNameRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBotNameRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBotName#d295fa71 as nil") - } - b.PutInt53(s.BotUserID) - b.PutString(s.LanguageCode) - b.PutString(s.Name) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBotNameRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBotName#d295fa71 to nil") - } - if err := b.ConsumeID(SetBotNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBotName#d295fa71: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBotNameRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBotName#d295fa71 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBotName#d295fa71: field bot_user_id: %w", err) - } - s.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotName#d295fa71: field language_code: %w", err) - } - s.LanguageCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotName#d295fa71: field name: %w", err) - } - s.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBotNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBotName#d295fa71 as nil") - } - b.ObjStart() - b.PutID("setBotName") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(s.BotUserID) - b.Comma() - b.FieldStart("language_code") - b.PutString(s.LanguageCode) - b.Comma() - b.FieldStart("name") - b.PutString(s.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBotNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBotName#d295fa71 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBotName"); err != nil { - return fmt.Errorf("unable to decode setBotName#d295fa71: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBotName#d295fa71: field bot_user_id: %w", err) - } - s.BotUserID = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotName#d295fa71: field language_code: %w", err) - } - s.LanguageCode = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotName#d295fa71: field name: %w", err) - } - s.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (s *SetBotNameRequest) GetBotUserID() (value int64) { - if s == nil { - return - } - return s.BotUserID -} - -// GetLanguageCode returns value of LanguageCode field. -func (s *SetBotNameRequest) GetLanguageCode() (value string) { - if s == nil { - return - } - return s.LanguageCode -} - -// GetName returns value of Name field. -func (s *SetBotNameRequest) GetName() (value string) { - if s == nil { - return - } - return s.Name -} - -// SetBotName invokes method setBotName#d295fa71 returning error if any. -func (c *Client) SetBotName(ctx context.Context, request *SetBotNameRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_bot_profile_photo_gen.go b/tdapi/tl_set_bot_profile_photo_gen.go deleted file mode 100644 index 4868cbc0c..000000000 --- a/tdapi/tl_set_bot_profile_photo_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBotProfilePhotoRequest represents TL type `setBotProfilePhoto#bd864b66`. -type SetBotProfilePhotoRequest struct { - // Identifier of the target bot - BotUserID int64 - // Profile photo to set; pass null to delete the chat photo - Photo InputChatPhotoClass -} - -// SetBotProfilePhotoRequestTypeID is TL type id of SetBotProfilePhotoRequest. -const SetBotProfilePhotoRequestTypeID = 0xbd864b66 - -// Ensuring interfaces in compile-time for SetBotProfilePhotoRequest. -var ( - _ bin.Encoder = &SetBotProfilePhotoRequest{} - _ bin.Decoder = &SetBotProfilePhotoRequest{} - _ bin.BareEncoder = &SetBotProfilePhotoRequest{} - _ bin.BareDecoder = &SetBotProfilePhotoRequest{} -) - -func (s *SetBotProfilePhotoRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BotUserID == 0) { - return false - } - if !(s.Photo == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBotProfilePhotoRequest) String() string { - if s == nil { - return "SetBotProfilePhotoRequest(nil)" - } - type Alias SetBotProfilePhotoRequest - return fmt.Sprintf("SetBotProfilePhotoRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBotProfilePhotoRequest) TypeID() uint32 { - return SetBotProfilePhotoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBotProfilePhotoRequest) TypeName() string { - return "setBotProfilePhoto" -} - -// TypeInfo returns info about TL type. -func (s *SetBotProfilePhotoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBotProfilePhoto", - ID: SetBotProfilePhotoRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBotProfilePhotoRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBotProfilePhoto#bd864b66 as nil") - } - b.PutID(SetBotProfilePhotoRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBotProfilePhotoRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBotProfilePhoto#bd864b66 as nil") - } - b.PutInt53(s.BotUserID) - if s.Photo == nil { - return fmt.Errorf("unable to encode setBotProfilePhoto#bd864b66: field photo is nil") - } - if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode setBotProfilePhoto#bd864b66: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBotProfilePhotoRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBotProfilePhoto#bd864b66 to nil") - } - if err := b.ConsumeID(SetBotProfilePhotoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBotProfilePhoto#bd864b66: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBotProfilePhotoRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBotProfilePhoto#bd864b66 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBotProfilePhoto#bd864b66: field bot_user_id: %w", err) - } - s.BotUserID = value - } - { - value, err := DecodeInputChatPhoto(b) - if err != nil { - return fmt.Errorf("unable to decode setBotProfilePhoto#bd864b66: field photo: %w", err) - } - s.Photo = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBotProfilePhotoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBotProfilePhoto#bd864b66 as nil") - } - b.ObjStart() - b.PutID("setBotProfilePhoto") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(s.BotUserID) - b.Comma() - b.FieldStart("photo") - if s.Photo == nil { - return fmt.Errorf("unable to encode setBotProfilePhoto#bd864b66: field photo is nil") - } - if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setBotProfilePhoto#bd864b66: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBotProfilePhotoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBotProfilePhoto#bd864b66 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBotProfilePhoto"); err != nil { - return fmt.Errorf("unable to decode setBotProfilePhoto#bd864b66: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBotProfilePhoto#bd864b66: field bot_user_id: %w", err) - } - s.BotUserID = value - case "photo": - value, err := DecodeTDLibJSONInputChatPhoto(b) - if err != nil { - return fmt.Errorf("unable to decode setBotProfilePhoto#bd864b66: field photo: %w", err) - } - s.Photo = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (s *SetBotProfilePhotoRequest) GetBotUserID() (value int64) { - if s == nil { - return - } - return s.BotUserID -} - -// GetPhoto returns value of Photo field. -func (s *SetBotProfilePhotoRequest) GetPhoto() (value InputChatPhotoClass) { - if s == nil { - return - } - return s.Photo -} - -// SetBotProfilePhoto invokes method setBotProfilePhoto#bd864b66 returning error if any. -func (c *Client) SetBotProfilePhoto(ctx context.Context, request *SetBotProfilePhotoRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_bot_updates_status_gen.go b/tdapi/tl_set_bot_updates_status_gen.go deleted file mode 100644 index 6c6f2eb67..000000000 --- a/tdapi/tl_set_bot_updates_status_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBotUpdatesStatusRequest represents TL type `setBotUpdatesStatus#bb293991`. -type SetBotUpdatesStatusRequest struct { - // The number of pending updates - PendingUpdateCount int32 - // The last error message - ErrorMessage string -} - -// SetBotUpdatesStatusRequestTypeID is TL type id of SetBotUpdatesStatusRequest. -const SetBotUpdatesStatusRequestTypeID = 0xbb293991 - -// Ensuring interfaces in compile-time for SetBotUpdatesStatusRequest. -var ( - _ bin.Encoder = &SetBotUpdatesStatusRequest{} - _ bin.Decoder = &SetBotUpdatesStatusRequest{} - _ bin.BareEncoder = &SetBotUpdatesStatusRequest{} - _ bin.BareDecoder = &SetBotUpdatesStatusRequest{} -) - -func (s *SetBotUpdatesStatusRequest) Zero() bool { - if s == nil { - return true - } - if !(s.PendingUpdateCount == 0) { - return false - } - if !(s.ErrorMessage == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBotUpdatesStatusRequest) String() string { - if s == nil { - return "SetBotUpdatesStatusRequest(nil)" - } - type Alias SetBotUpdatesStatusRequest - return fmt.Sprintf("SetBotUpdatesStatusRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBotUpdatesStatusRequest) TypeID() uint32 { - return SetBotUpdatesStatusRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBotUpdatesStatusRequest) TypeName() string { - return "setBotUpdatesStatus" -} - -// TypeInfo returns info about TL type. -func (s *SetBotUpdatesStatusRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBotUpdatesStatus", - ID: SetBotUpdatesStatusRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PendingUpdateCount", - SchemaName: "pending_update_count", - }, - { - Name: "ErrorMessage", - SchemaName: "error_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBotUpdatesStatusRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBotUpdatesStatus#bb293991 as nil") - } - b.PutID(SetBotUpdatesStatusRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBotUpdatesStatusRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBotUpdatesStatus#bb293991 as nil") - } - b.PutInt32(s.PendingUpdateCount) - b.PutString(s.ErrorMessage) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBotUpdatesStatusRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBotUpdatesStatus#bb293991 to nil") - } - if err := b.ConsumeID(SetBotUpdatesStatusRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBotUpdatesStatus#bb293991: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBotUpdatesStatusRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBotUpdatesStatus#bb293991 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setBotUpdatesStatus#bb293991: field pending_update_count: %w", err) - } - s.PendingUpdateCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotUpdatesStatus#bb293991: field error_message: %w", err) - } - s.ErrorMessage = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBotUpdatesStatusRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBotUpdatesStatus#bb293991 as nil") - } - b.ObjStart() - b.PutID("setBotUpdatesStatus") - b.Comma() - b.FieldStart("pending_update_count") - b.PutInt32(s.PendingUpdateCount) - b.Comma() - b.FieldStart("error_message") - b.PutString(s.ErrorMessage) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBotUpdatesStatusRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBotUpdatesStatus#bb293991 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBotUpdatesStatus"); err != nil { - return fmt.Errorf("unable to decode setBotUpdatesStatus#bb293991: %w", err) - } - case "pending_update_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setBotUpdatesStatus#bb293991: field pending_update_count: %w", err) - } - s.PendingUpdateCount = value - case "error_message": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBotUpdatesStatus#bb293991: field error_message: %w", err) - } - s.ErrorMessage = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPendingUpdateCount returns value of PendingUpdateCount field. -func (s *SetBotUpdatesStatusRequest) GetPendingUpdateCount() (value int32) { - if s == nil { - return - } - return s.PendingUpdateCount -} - -// GetErrorMessage returns value of ErrorMessage field. -func (s *SetBotUpdatesStatusRequest) GetErrorMessage() (value string) { - if s == nil { - return - } - return s.ErrorMessage -} - -// SetBotUpdatesStatus invokes method setBotUpdatesStatus#bb293991 returning error if any. -func (c *Client) SetBotUpdatesStatus(ctx context.Context, request *SetBotUpdatesStatusRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_business_away_message_settings_gen.go b/tdapi/tl_set_business_away_message_settings_gen.go deleted file mode 100644 index 56935fe07..000000000 --- a/tdapi/tl_set_business_away_message_settings_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBusinessAwayMessageSettingsRequest represents TL type `setBusinessAwayMessageSettings#4974486c`. -type SetBusinessAwayMessageSettingsRequest struct { - // The new settings for the away message of the business; pass null to disable the away - // message - AwayMessageSettings BusinessAwayMessageSettings -} - -// SetBusinessAwayMessageSettingsRequestTypeID is TL type id of SetBusinessAwayMessageSettingsRequest. -const SetBusinessAwayMessageSettingsRequestTypeID = 0x4974486c - -// Ensuring interfaces in compile-time for SetBusinessAwayMessageSettingsRequest. -var ( - _ bin.Encoder = &SetBusinessAwayMessageSettingsRequest{} - _ bin.Decoder = &SetBusinessAwayMessageSettingsRequest{} - _ bin.BareEncoder = &SetBusinessAwayMessageSettingsRequest{} - _ bin.BareDecoder = &SetBusinessAwayMessageSettingsRequest{} -) - -func (s *SetBusinessAwayMessageSettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.AwayMessageSettings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBusinessAwayMessageSettingsRequest) String() string { - if s == nil { - return "SetBusinessAwayMessageSettingsRequest(nil)" - } - type Alias SetBusinessAwayMessageSettingsRequest - return fmt.Sprintf("SetBusinessAwayMessageSettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBusinessAwayMessageSettingsRequest) TypeID() uint32 { - return SetBusinessAwayMessageSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBusinessAwayMessageSettingsRequest) TypeName() string { - return "setBusinessAwayMessageSettings" -} - -// TypeInfo returns info about TL type. -func (s *SetBusinessAwayMessageSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBusinessAwayMessageSettings", - ID: SetBusinessAwayMessageSettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AwayMessageSettings", - SchemaName: "away_message_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBusinessAwayMessageSettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessAwayMessageSettings#4974486c as nil") - } - b.PutID(SetBusinessAwayMessageSettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBusinessAwayMessageSettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessAwayMessageSettings#4974486c as nil") - } - if err := s.AwayMessageSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setBusinessAwayMessageSettings#4974486c: field away_message_settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBusinessAwayMessageSettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessAwayMessageSettings#4974486c to nil") - } - if err := b.ConsumeID(SetBusinessAwayMessageSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBusinessAwayMessageSettings#4974486c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBusinessAwayMessageSettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessAwayMessageSettings#4974486c to nil") - } - { - if err := s.AwayMessageSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setBusinessAwayMessageSettings#4974486c: field away_message_settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBusinessAwayMessageSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessAwayMessageSettings#4974486c as nil") - } - b.ObjStart() - b.PutID("setBusinessAwayMessageSettings") - b.Comma() - b.FieldStart("away_message_settings") - if err := s.AwayMessageSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setBusinessAwayMessageSettings#4974486c: field away_message_settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBusinessAwayMessageSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessAwayMessageSettings#4974486c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBusinessAwayMessageSettings"); err != nil { - return fmt.Errorf("unable to decode setBusinessAwayMessageSettings#4974486c: %w", err) - } - case "away_message_settings": - if err := s.AwayMessageSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setBusinessAwayMessageSettings#4974486c: field away_message_settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAwayMessageSettings returns value of AwayMessageSettings field. -func (s *SetBusinessAwayMessageSettingsRequest) GetAwayMessageSettings() (value BusinessAwayMessageSettings) { - if s == nil { - return - } - return s.AwayMessageSettings -} - -// SetBusinessAwayMessageSettings invokes method setBusinessAwayMessageSettings#4974486c returning error if any. -func (c *Client) SetBusinessAwayMessageSettings(ctx context.Context, awaymessagesettings BusinessAwayMessageSettings) error { - var ok Ok - - request := &SetBusinessAwayMessageSettingsRequest{ - AwayMessageSettings: awaymessagesettings, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_business_connected_bot_gen.go b/tdapi/tl_set_business_connected_bot_gen.go deleted file mode 100644 index 160a81c82..000000000 --- a/tdapi/tl_set_business_connected_bot_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBusinessConnectedBotRequest represents TL type `setBusinessConnectedBot#acf17ef0`. -type SetBusinessConnectedBotRequest struct { - // Connection settings for the bot - Bot BusinessConnectedBot -} - -// SetBusinessConnectedBotRequestTypeID is TL type id of SetBusinessConnectedBotRequest. -const SetBusinessConnectedBotRequestTypeID = 0xacf17ef0 - -// Ensuring interfaces in compile-time for SetBusinessConnectedBotRequest. -var ( - _ bin.Encoder = &SetBusinessConnectedBotRequest{} - _ bin.Decoder = &SetBusinessConnectedBotRequest{} - _ bin.BareEncoder = &SetBusinessConnectedBotRequest{} - _ bin.BareDecoder = &SetBusinessConnectedBotRequest{} -) - -func (s *SetBusinessConnectedBotRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Bot.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBusinessConnectedBotRequest) String() string { - if s == nil { - return "SetBusinessConnectedBotRequest(nil)" - } - type Alias SetBusinessConnectedBotRequest - return fmt.Sprintf("SetBusinessConnectedBotRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBusinessConnectedBotRequest) TypeID() uint32 { - return SetBusinessConnectedBotRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBusinessConnectedBotRequest) TypeName() string { - return "setBusinessConnectedBot" -} - -// TypeInfo returns info about TL type. -func (s *SetBusinessConnectedBotRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBusinessConnectedBot", - ID: SetBusinessConnectedBotRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Bot", - SchemaName: "bot", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBusinessConnectedBotRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessConnectedBot#acf17ef0 as nil") - } - b.PutID(SetBusinessConnectedBotRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBusinessConnectedBotRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessConnectedBot#acf17ef0 as nil") - } - if err := s.Bot.Encode(b); err != nil { - return fmt.Errorf("unable to encode setBusinessConnectedBot#acf17ef0: field bot: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBusinessConnectedBotRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessConnectedBot#acf17ef0 to nil") - } - if err := b.ConsumeID(SetBusinessConnectedBotRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBusinessConnectedBot#acf17ef0: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBusinessConnectedBotRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessConnectedBot#acf17ef0 to nil") - } - { - if err := s.Bot.Decode(b); err != nil { - return fmt.Errorf("unable to decode setBusinessConnectedBot#acf17ef0: field bot: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBusinessConnectedBotRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessConnectedBot#acf17ef0 as nil") - } - b.ObjStart() - b.PutID("setBusinessConnectedBot") - b.Comma() - b.FieldStart("bot") - if err := s.Bot.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setBusinessConnectedBot#acf17ef0: field bot: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBusinessConnectedBotRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessConnectedBot#acf17ef0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBusinessConnectedBot"); err != nil { - return fmt.Errorf("unable to decode setBusinessConnectedBot#acf17ef0: %w", err) - } - case "bot": - if err := s.Bot.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setBusinessConnectedBot#acf17ef0: field bot: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBot returns value of Bot field. -func (s *SetBusinessConnectedBotRequest) GetBot() (value BusinessConnectedBot) { - if s == nil { - return - } - return s.Bot -} - -// SetBusinessConnectedBot invokes method setBusinessConnectedBot#acf17ef0 returning error if any. -func (c *Client) SetBusinessConnectedBot(ctx context.Context, bot BusinessConnectedBot) error { - var ok Ok - - request := &SetBusinessConnectedBotRequest{ - Bot: bot, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_business_greeting_message_settings_gen.go b/tdapi/tl_set_business_greeting_message_settings_gen.go deleted file mode 100644 index 6a62003b9..000000000 --- a/tdapi/tl_set_business_greeting_message_settings_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBusinessGreetingMessageSettingsRequest represents TL type `setBusinessGreetingMessageSettings#cbf53c3d`. -type SetBusinessGreetingMessageSettingsRequest struct { - // The new settings for the greeting message of the business; pass null to disable the - // greeting message - GreetingMessageSettings BusinessGreetingMessageSettings -} - -// SetBusinessGreetingMessageSettingsRequestTypeID is TL type id of SetBusinessGreetingMessageSettingsRequest. -const SetBusinessGreetingMessageSettingsRequestTypeID = 0xcbf53c3d - -// Ensuring interfaces in compile-time for SetBusinessGreetingMessageSettingsRequest. -var ( - _ bin.Encoder = &SetBusinessGreetingMessageSettingsRequest{} - _ bin.Decoder = &SetBusinessGreetingMessageSettingsRequest{} - _ bin.BareEncoder = &SetBusinessGreetingMessageSettingsRequest{} - _ bin.BareDecoder = &SetBusinessGreetingMessageSettingsRequest{} -) - -func (s *SetBusinessGreetingMessageSettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.GreetingMessageSettings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBusinessGreetingMessageSettingsRequest) String() string { - if s == nil { - return "SetBusinessGreetingMessageSettingsRequest(nil)" - } - type Alias SetBusinessGreetingMessageSettingsRequest - return fmt.Sprintf("SetBusinessGreetingMessageSettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBusinessGreetingMessageSettingsRequest) TypeID() uint32 { - return SetBusinessGreetingMessageSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBusinessGreetingMessageSettingsRequest) TypeName() string { - return "setBusinessGreetingMessageSettings" -} - -// TypeInfo returns info about TL type. -func (s *SetBusinessGreetingMessageSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBusinessGreetingMessageSettings", - ID: SetBusinessGreetingMessageSettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GreetingMessageSettings", - SchemaName: "greeting_message_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBusinessGreetingMessageSettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessGreetingMessageSettings#cbf53c3d as nil") - } - b.PutID(SetBusinessGreetingMessageSettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBusinessGreetingMessageSettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessGreetingMessageSettings#cbf53c3d as nil") - } - if err := s.GreetingMessageSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setBusinessGreetingMessageSettings#cbf53c3d: field greeting_message_settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBusinessGreetingMessageSettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessGreetingMessageSettings#cbf53c3d to nil") - } - if err := b.ConsumeID(SetBusinessGreetingMessageSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBusinessGreetingMessageSettings#cbf53c3d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBusinessGreetingMessageSettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessGreetingMessageSettings#cbf53c3d to nil") - } - { - if err := s.GreetingMessageSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setBusinessGreetingMessageSettings#cbf53c3d: field greeting_message_settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBusinessGreetingMessageSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessGreetingMessageSettings#cbf53c3d as nil") - } - b.ObjStart() - b.PutID("setBusinessGreetingMessageSettings") - b.Comma() - b.FieldStart("greeting_message_settings") - if err := s.GreetingMessageSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setBusinessGreetingMessageSettings#cbf53c3d: field greeting_message_settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBusinessGreetingMessageSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessGreetingMessageSettings#cbf53c3d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBusinessGreetingMessageSettings"); err != nil { - return fmt.Errorf("unable to decode setBusinessGreetingMessageSettings#cbf53c3d: %w", err) - } - case "greeting_message_settings": - if err := s.GreetingMessageSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setBusinessGreetingMessageSettings#cbf53c3d: field greeting_message_settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGreetingMessageSettings returns value of GreetingMessageSettings field. -func (s *SetBusinessGreetingMessageSettingsRequest) GetGreetingMessageSettings() (value BusinessGreetingMessageSettings) { - if s == nil { - return - } - return s.GreetingMessageSettings -} - -// SetBusinessGreetingMessageSettings invokes method setBusinessGreetingMessageSettings#cbf53c3d returning error if any. -func (c *Client) SetBusinessGreetingMessageSettings(ctx context.Context, greetingmessagesettings BusinessGreetingMessageSettings) error { - var ok Ok - - request := &SetBusinessGreetingMessageSettingsRequest{ - GreetingMessageSettings: greetingmessagesettings, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_business_location_gen.go b/tdapi/tl_set_business_location_gen.go deleted file mode 100644 index 8ead2b27c..000000000 --- a/tdapi/tl_set_business_location_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBusinessLocationRequest represents TL type `setBusinessLocation#eb740715`. -type SetBusinessLocationRequest struct { - // The new location of the business; pass null to remove the location - Location BusinessLocation -} - -// SetBusinessLocationRequestTypeID is TL type id of SetBusinessLocationRequest. -const SetBusinessLocationRequestTypeID = 0xeb740715 - -// Ensuring interfaces in compile-time for SetBusinessLocationRequest. -var ( - _ bin.Encoder = &SetBusinessLocationRequest{} - _ bin.Decoder = &SetBusinessLocationRequest{} - _ bin.BareEncoder = &SetBusinessLocationRequest{} - _ bin.BareDecoder = &SetBusinessLocationRequest{} -) - -func (s *SetBusinessLocationRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Location.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBusinessLocationRequest) String() string { - if s == nil { - return "SetBusinessLocationRequest(nil)" - } - type Alias SetBusinessLocationRequest - return fmt.Sprintf("SetBusinessLocationRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBusinessLocationRequest) TypeID() uint32 { - return SetBusinessLocationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBusinessLocationRequest) TypeName() string { - return "setBusinessLocation" -} - -// TypeInfo returns info about TL type. -func (s *SetBusinessLocationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBusinessLocation", - ID: SetBusinessLocationRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Location", - SchemaName: "location", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBusinessLocationRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessLocation#eb740715 as nil") - } - b.PutID(SetBusinessLocationRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBusinessLocationRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessLocation#eb740715 as nil") - } - if err := s.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode setBusinessLocation#eb740715: field location: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBusinessLocationRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessLocation#eb740715 to nil") - } - if err := b.ConsumeID(SetBusinessLocationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBusinessLocation#eb740715: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBusinessLocationRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessLocation#eb740715 to nil") - } - { - if err := s.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode setBusinessLocation#eb740715: field location: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBusinessLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessLocation#eb740715 as nil") - } - b.ObjStart() - b.PutID("setBusinessLocation") - b.Comma() - b.FieldStart("location") - if err := s.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setBusinessLocation#eb740715: field location: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBusinessLocationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessLocation#eb740715 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBusinessLocation"); err != nil { - return fmt.Errorf("unable to decode setBusinessLocation#eb740715: %w", err) - } - case "location": - if err := s.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setBusinessLocation#eb740715: field location: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (s *SetBusinessLocationRequest) GetLocation() (value BusinessLocation) { - if s == nil { - return - } - return s.Location -} - -// SetBusinessLocation invokes method setBusinessLocation#eb740715 returning error if any. -func (c *Client) SetBusinessLocation(ctx context.Context, location BusinessLocation) error { - var ok Ok - - request := &SetBusinessLocationRequest{ - Location: location, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_business_message_is_pinned_gen.go b/tdapi/tl_set_business_message_is_pinned_gen.go deleted file mode 100644 index a7e4fa457..000000000 --- a/tdapi/tl_set_business_message_is_pinned_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBusinessMessageIsPinnedRequest represents TL type `setBusinessMessageIsPinned#ff14f5f0`. -type SetBusinessMessageIsPinnedRequest struct { - // Unique identifier of business connection on behalf of which the message was sent - BusinessConnectionID string - // The chat the message belongs to - ChatID int64 - // Identifier of the message - MessageID int64 - // Pass true to pin the message, pass false to unpin it - IsPinned bool -} - -// SetBusinessMessageIsPinnedRequestTypeID is TL type id of SetBusinessMessageIsPinnedRequest. -const SetBusinessMessageIsPinnedRequestTypeID = 0xff14f5f0 - -// Ensuring interfaces in compile-time for SetBusinessMessageIsPinnedRequest. -var ( - _ bin.Encoder = &SetBusinessMessageIsPinnedRequest{} - _ bin.Decoder = &SetBusinessMessageIsPinnedRequest{} - _ bin.BareEncoder = &SetBusinessMessageIsPinnedRequest{} - _ bin.BareDecoder = &SetBusinessMessageIsPinnedRequest{} -) - -func (s *SetBusinessMessageIsPinnedRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BusinessConnectionID == "") { - return false - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - if !(s.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBusinessMessageIsPinnedRequest) String() string { - if s == nil { - return "SetBusinessMessageIsPinnedRequest(nil)" - } - type Alias SetBusinessMessageIsPinnedRequest - return fmt.Sprintf("SetBusinessMessageIsPinnedRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBusinessMessageIsPinnedRequest) TypeID() uint32 { - return SetBusinessMessageIsPinnedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBusinessMessageIsPinnedRequest) TypeName() string { - return "setBusinessMessageIsPinned" -} - -// TypeInfo returns info about TL type. -func (s *SetBusinessMessageIsPinnedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBusinessMessageIsPinned", - ID: SetBusinessMessageIsPinnedRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BusinessConnectionID", - SchemaName: "business_connection_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBusinessMessageIsPinnedRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessMessageIsPinned#ff14f5f0 as nil") - } - b.PutID(SetBusinessMessageIsPinnedRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBusinessMessageIsPinnedRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessMessageIsPinned#ff14f5f0 as nil") - } - b.PutString(s.BusinessConnectionID) - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - b.PutBool(s.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBusinessMessageIsPinnedRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessMessageIsPinned#ff14f5f0 to nil") - } - if err := b.ConsumeID(SetBusinessMessageIsPinnedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBusinessMessageIsPinnedRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessMessageIsPinned#ff14f5f0 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field business_connection_id: %w", err) - } - s.BusinessConnectionID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field message_id: %w", err) - } - s.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field is_pinned: %w", err) - } - s.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBusinessMessageIsPinnedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessMessageIsPinned#ff14f5f0 as nil") - } - b.ObjStart() - b.PutID("setBusinessMessageIsPinned") - b.Comma() - b.FieldStart("business_connection_id") - b.PutString(s.BusinessConnectionID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(s.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBusinessMessageIsPinnedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessMessageIsPinned#ff14f5f0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBusinessMessageIsPinned"); err != nil { - return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: %w", err) - } - case "business_connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field business_connection_id: %w", err) - } - s.BusinessConnectionID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field message_id: %w", err) - } - s.MessageID = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setBusinessMessageIsPinned#ff14f5f0: field is_pinned: %w", err) - } - s.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessConnectionID returns value of BusinessConnectionID field. -func (s *SetBusinessMessageIsPinnedRequest) GetBusinessConnectionID() (value string) { - if s == nil { - return - } - return s.BusinessConnectionID -} - -// GetChatID returns value of ChatID field. -func (s *SetBusinessMessageIsPinnedRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *SetBusinessMessageIsPinnedRequest) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetIsPinned returns value of IsPinned field. -func (s *SetBusinessMessageIsPinnedRequest) GetIsPinned() (value bool) { - if s == nil { - return - } - return s.IsPinned -} - -// SetBusinessMessageIsPinned invokes method setBusinessMessageIsPinned#ff14f5f0 returning error if any. -func (c *Client) SetBusinessMessageIsPinned(ctx context.Context, request *SetBusinessMessageIsPinnedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_business_opening_hours_gen.go b/tdapi/tl_set_business_opening_hours_gen.go deleted file mode 100644 index 2eb28db47..000000000 --- a/tdapi/tl_set_business_opening_hours_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBusinessOpeningHoursRequest represents TL type `setBusinessOpeningHours#e470a472`. -type SetBusinessOpeningHoursRequest struct { - // The new opening hours of the business; pass null to remove the opening hours; up to 28 - // time intervals can be specified - OpeningHours BusinessOpeningHours -} - -// SetBusinessOpeningHoursRequestTypeID is TL type id of SetBusinessOpeningHoursRequest. -const SetBusinessOpeningHoursRequestTypeID = 0xe470a472 - -// Ensuring interfaces in compile-time for SetBusinessOpeningHoursRequest. -var ( - _ bin.Encoder = &SetBusinessOpeningHoursRequest{} - _ bin.Decoder = &SetBusinessOpeningHoursRequest{} - _ bin.BareEncoder = &SetBusinessOpeningHoursRequest{} - _ bin.BareDecoder = &SetBusinessOpeningHoursRequest{} -) - -func (s *SetBusinessOpeningHoursRequest) Zero() bool { - if s == nil { - return true - } - if !(s.OpeningHours.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBusinessOpeningHoursRequest) String() string { - if s == nil { - return "SetBusinessOpeningHoursRequest(nil)" - } - type Alias SetBusinessOpeningHoursRequest - return fmt.Sprintf("SetBusinessOpeningHoursRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBusinessOpeningHoursRequest) TypeID() uint32 { - return SetBusinessOpeningHoursRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBusinessOpeningHoursRequest) TypeName() string { - return "setBusinessOpeningHours" -} - -// TypeInfo returns info about TL type. -func (s *SetBusinessOpeningHoursRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBusinessOpeningHours", - ID: SetBusinessOpeningHoursRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OpeningHours", - SchemaName: "opening_hours", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBusinessOpeningHoursRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessOpeningHours#e470a472 as nil") - } - b.PutID(SetBusinessOpeningHoursRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBusinessOpeningHoursRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessOpeningHours#e470a472 as nil") - } - if err := s.OpeningHours.Encode(b); err != nil { - return fmt.Errorf("unable to encode setBusinessOpeningHours#e470a472: field opening_hours: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBusinessOpeningHoursRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessOpeningHours#e470a472 to nil") - } - if err := b.ConsumeID(SetBusinessOpeningHoursRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBusinessOpeningHours#e470a472: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBusinessOpeningHoursRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessOpeningHours#e470a472 to nil") - } - { - if err := s.OpeningHours.Decode(b); err != nil { - return fmt.Errorf("unable to decode setBusinessOpeningHours#e470a472: field opening_hours: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBusinessOpeningHoursRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessOpeningHours#e470a472 as nil") - } - b.ObjStart() - b.PutID("setBusinessOpeningHours") - b.Comma() - b.FieldStart("opening_hours") - if err := s.OpeningHours.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setBusinessOpeningHours#e470a472: field opening_hours: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBusinessOpeningHoursRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessOpeningHours#e470a472 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBusinessOpeningHours"); err != nil { - return fmt.Errorf("unable to decode setBusinessOpeningHours#e470a472: %w", err) - } - case "opening_hours": - if err := s.OpeningHours.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setBusinessOpeningHours#e470a472: field opening_hours: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOpeningHours returns value of OpeningHours field. -func (s *SetBusinessOpeningHoursRequest) GetOpeningHours() (value BusinessOpeningHours) { - if s == nil { - return - } - return s.OpeningHours -} - -// SetBusinessOpeningHours invokes method setBusinessOpeningHours#e470a472 returning error if any. -func (c *Client) SetBusinessOpeningHours(ctx context.Context, openinghours BusinessOpeningHours) error { - var ok Ok - - request := &SetBusinessOpeningHoursRequest{ - OpeningHours: openinghours, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_business_start_page_gen.go b/tdapi/tl_set_business_start_page_gen.go deleted file mode 100644 index 0adae643f..000000000 --- a/tdapi/tl_set_business_start_page_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetBusinessStartPageRequest represents TL type `setBusinessStartPage#9eed499e`. -type SetBusinessStartPageRequest struct { - // The new start page of the business; pass null to remove custom start page - StartPage InputBusinessStartPage -} - -// SetBusinessStartPageRequestTypeID is TL type id of SetBusinessStartPageRequest. -const SetBusinessStartPageRequestTypeID = 0x9eed499e - -// Ensuring interfaces in compile-time for SetBusinessStartPageRequest. -var ( - _ bin.Encoder = &SetBusinessStartPageRequest{} - _ bin.Decoder = &SetBusinessStartPageRequest{} - _ bin.BareEncoder = &SetBusinessStartPageRequest{} - _ bin.BareDecoder = &SetBusinessStartPageRequest{} -) - -func (s *SetBusinessStartPageRequest) Zero() bool { - if s == nil { - return true - } - if !(s.StartPage.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetBusinessStartPageRequest) String() string { - if s == nil { - return "SetBusinessStartPageRequest(nil)" - } - type Alias SetBusinessStartPageRequest - return fmt.Sprintf("SetBusinessStartPageRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetBusinessStartPageRequest) TypeID() uint32 { - return SetBusinessStartPageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetBusinessStartPageRequest) TypeName() string { - return "setBusinessStartPage" -} - -// TypeInfo returns info about TL type. -func (s *SetBusinessStartPageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setBusinessStartPage", - ID: SetBusinessStartPageRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StartPage", - SchemaName: "start_page", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetBusinessStartPageRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessStartPage#9eed499e as nil") - } - b.PutID(SetBusinessStartPageRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetBusinessStartPageRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessStartPage#9eed499e as nil") - } - if err := s.StartPage.Encode(b); err != nil { - return fmt.Errorf("unable to encode setBusinessStartPage#9eed499e: field start_page: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetBusinessStartPageRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessStartPage#9eed499e to nil") - } - if err := b.ConsumeID(SetBusinessStartPageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setBusinessStartPage#9eed499e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetBusinessStartPageRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessStartPage#9eed499e to nil") - } - { - if err := s.StartPage.Decode(b); err != nil { - return fmt.Errorf("unable to decode setBusinessStartPage#9eed499e: field start_page: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetBusinessStartPageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setBusinessStartPage#9eed499e as nil") - } - b.ObjStart() - b.PutID("setBusinessStartPage") - b.Comma() - b.FieldStart("start_page") - if err := s.StartPage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setBusinessStartPage#9eed499e: field start_page: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetBusinessStartPageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setBusinessStartPage#9eed499e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setBusinessStartPage"); err != nil { - return fmt.Errorf("unable to decode setBusinessStartPage#9eed499e: %w", err) - } - case "start_page": - if err := s.StartPage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setBusinessStartPage#9eed499e: field start_page: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStartPage returns value of StartPage field. -func (s *SetBusinessStartPageRequest) GetStartPage() (value InputBusinessStartPage) { - if s == nil { - return - } - return s.StartPage -} - -// SetBusinessStartPage invokes method setBusinessStartPage#9eed499e returning error if any. -func (c *Client) SetBusinessStartPage(ctx context.Context, startpage InputBusinessStartPage) error { - var ok Ok - - request := &SetBusinessStartPageRequest{ - StartPage: startpage, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_accent_color_gen.go b/tdapi/tl_set_chat_accent_color_gen.go deleted file mode 100644 index 0c9f2ef86..000000000 --- a/tdapi/tl_set_chat_accent_color_gen.go +++ /dev/null @@ -1,274 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatAccentColorRequest represents TL type `setChatAccentColor#349f57ca`. -type SetChatAccentColorRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the accent color to use. The chat must have at least accentColor - // min_channel_chat_boost_level boost level to pass the corresponding color - AccentColorID int32 - // Identifier of a custom emoji to be shown on the reply header and link preview - // background; 0 if none. Use chatBoostLevelFeatures.can_set_background_custom_emoji to - // check whether a custom emoji can be set - BackgroundCustomEmojiID int64 -} - -// SetChatAccentColorRequestTypeID is TL type id of SetChatAccentColorRequest. -const SetChatAccentColorRequestTypeID = 0x349f57ca - -// Ensuring interfaces in compile-time for SetChatAccentColorRequest. -var ( - _ bin.Encoder = &SetChatAccentColorRequest{} - _ bin.Decoder = &SetChatAccentColorRequest{} - _ bin.BareEncoder = &SetChatAccentColorRequest{} - _ bin.BareDecoder = &SetChatAccentColorRequest{} -) - -func (s *SetChatAccentColorRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.AccentColorID == 0) { - return false - } - if !(s.BackgroundCustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatAccentColorRequest) String() string { - if s == nil { - return "SetChatAccentColorRequest(nil)" - } - type Alias SetChatAccentColorRequest - return fmt.Sprintf("SetChatAccentColorRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatAccentColorRequest) TypeID() uint32 { - return SetChatAccentColorRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatAccentColorRequest) TypeName() string { - return "setChatAccentColor" -} - -// TypeInfo returns info about TL type. -func (s *SetChatAccentColorRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatAccentColor", - ID: SetChatAccentColorRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "AccentColorID", - SchemaName: "accent_color_id", - }, - { - Name: "BackgroundCustomEmojiID", - SchemaName: "background_custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatAccentColorRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatAccentColor#349f57ca as nil") - } - b.PutID(SetChatAccentColorRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatAccentColorRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatAccentColor#349f57ca as nil") - } - b.PutInt53(s.ChatID) - b.PutInt32(s.AccentColorID) - b.PutLong(s.BackgroundCustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatAccentColorRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatAccentColor#349f57ca to nil") - } - if err := b.ConsumeID(SetChatAccentColorRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatAccentColor#349f57ca: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatAccentColorRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatAccentColor#349f57ca to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatAccentColor#349f57ca: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatAccentColor#349f57ca: field accent_color_id: %w", err) - } - s.AccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setChatAccentColor#349f57ca: field background_custom_emoji_id: %w", err) - } - s.BackgroundCustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatAccentColorRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatAccentColor#349f57ca as nil") - } - b.ObjStart() - b.PutID("setChatAccentColor") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("accent_color_id") - b.PutInt32(s.AccentColorID) - b.Comma() - b.FieldStart("background_custom_emoji_id") - b.PutLong(s.BackgroundCustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatAccentColorRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatAccentColor#349f57ca to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatAccentColor"); err != nil { - return fmt.Errorf("unable to decode setChatAccentColor#349f57ca: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatAccentColor#349f57ca: field chat_id: %w", err) - } - s.ChatID = value - case "accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatAccentColor#349f57ca: field accent_color_id: %w", err) - } - s.AccentColorID = value - case "background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setChatAccentColor#349f57ca: field background_custom_emoji_id: %w", err) - } - s.BackgroundCustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatAccentColorRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetAccentColorID returns value of AccentColorID field. -func (s *SetChatAccentColorRequest) GetAccentColorID() (value int32) { - if s == nil { - return - } - return s.AccentColorID -} - -// GetBackgroundCustomEmojiID returns value of BackgroundCustomEmojiID field. -func (s *SetChatAccentColorRequest) GetBackgroundCustomEmojiID() (value int64) { - if s == nil { - return - } - return s.BackgroundCustomEmojiID -} - -// SetChatAccentColor invokes method setChatAccentColor#349f57ca returning error if any. -func (c *Client) SetChatAccentColor(ctx context.Context, request *SetChatAccentColorRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_active_stories_list_gen.go b/tdapi/tl_set_chat_active_stories_list_gen.go deleted file mode 100644 index 4aa2d7cb0..000000000 --- a/tdapi/tl_set_chat_active_stories_list_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatActiveStoriesListRequest represents TL type `setChatActiveStoriesList#e0e35d11`. -type SetChatActiveStoriesListRequest struct { - // Identifier of the chat that posted stories - ChatID int64 - // New list for active stories posted by the chat - StoryList StoryListClass -} - -// SetChatActiveStoriesListRequestTypeID is TL type id of SetChatActiveStoriesListRequest. -const SetChatActiveStoriesListRequestTypeID = 0xe0e35d11 - -// Ensuring interfaces in compile-time for SetChatActiveStoriesListRequest. -var ( - _ bin.Encoder = &SetChatActiveStoriesListRequest{} - _ bin.Decoder = &SetChatActiveStoriesListRequest{} - _ bin.BareEncoder = &SetChatActiveStoriesListRequest{} - _ bin.BareDecoder = &SetChatActiveStoriesListRequest{} -) - -func (s *SetChatActiveStoriesListRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.StoryList == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatActiveStoriesListRequest) String() string { - if s == nil { - return "SetChatActiveStoriesListRequest(nil)" - } - type Alias SetChatActiveStoriesListRequest - return fmt.Sprintf("SetChatActiveStoriesListRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatActiveStoriesListRequest) TypeID() uint32 { - return SetChatActiveStoriesListRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatActiveStoriesListRequest) TypeName() string { - return "setChatActiveStoriesList" -} - -// TypeInfo returns info about TL type. -func (s *SetChatActiveStoriesListRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatActiveStoriesList", - ID: SetChatActiveStoriesListRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "StoryList", - SchemaName: "story_list", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatActiveStoriesListRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatActiveStoriesList#e0e35d11 as nil") - } - b.PutID(SetChatActiveStoriesListRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatActiveStoriesListRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatActiveStoriesList#e0e35d11 as nil") - } - b.PutInt53(s.ChatID) - if s.StoryList == nil { - return fmt.Errorf("unable to encode setChatActiveStoriesList#e0e35d11: field story_list is nil") - } - if err := s.StoryList.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatActiveStoriesList#e0e35d11: field story_list: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatActiveStoriesListRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatActiveStoriesList#e0e35d11 to nil") - } - if err := b.ConsumeID(SetChatActiveStoriesListRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatActiveStoriesList#e0e35d11: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatActiveStoriesListRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatActiveStoriesList#e0e35d11 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatActiveStoriesList#e0e35d11: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := DecodeStoryList(b) - if err != nil { - return fmt.Errorf("unable to decode setChatActiveStoriesList#e0e35d11: field story_list: %w", err) - } - s.StoryList = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatActiveStoriesListRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatActiveStoriesList#e0e35d11 as nil") - } - b.ObjStart() - b.PutID("setChatActiveStoriesList") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("story_list") - if s.StoryList == nil { - return fmt.Errorf("unable to encode setChatActiveStoriesList#e0e35d11: field story_list is nil") - } - if err := s.StoryList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatActiveStoriesList#e0e35d11: field story_list: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatActiveStoriesListRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatActiveStoriesList#e0e35d11 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatActiveStoriesList"); err != nil { - return fmt.Errorf("unable to decode setChatActiveStoriesList#e0e35d11: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatActiveStoriesList#e0e35d11: field chat_id: %w", err) - } - s.ChatID = value - case "story_list": - value, err := DecodeTDLibJSONStoryList(b) - if err != nil { - return fmt.Errorf("unable to decode setChatActiveStoriesList#e0e35d11: field story_list: %w", err) - } - s.StoryList = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatActiveStoriesListRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetStoryList returns value of StoryList field. -func (s *SetChatActiveStoriesListRequest) GetStoryList() (value StoryListClass) { - if s == nil { - return - } - return s.StoryList -} - -// SetChatActiveStoriesList invokes method setChatActiveStoriesList#e0e35d11 returning error if any. -func (c *Client) SetChatActiveStoriesList(ctx context.Context, request *SetChatActiveStoriesListRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_affiliate_program_gen.go b/tdapi/tl_set_chat_affiliate_program_gen.go deleted file mode 100644 index f6bc6f0dd..000000000 --- a/tdapi/tl_set_chat_affiliate_program_gen.go +++ /dev/null @@ -1,239 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatAffiliateProgramRequest represents TL type `setChatAffiliateProgram#e00237`. -type SetChatAffiliateProgramRequest struct { - // Identifier of the chat with an owned bot for which affiliate program is changed - ChatID int64 - // Parameters of the affiliate program; pass null to close the currently active program. - // If there is an active program, then commission and program duration can only be - // increased. - Parameters AffiliateProgramParameters -} - -// SetChatAffiliateProgramRequestTypeID is TL type id of SetChatAffiliateProgramRequest. -const SetChatAffiliateProgramRequestTypeID = 0xe00237 - -// Ensuring interfaces in compile-time for SetChatAffiliateProgramRequest. -var ( - _ bin.Encoder = &SetChatAffiliateProgramRequest{} - _ bin.Decoder = &SetChatAffiliateProgramRequest{} - _ bin.BareEncoder = &SetChatAffiliateProgramRequest{} - _ bin.BareDecoder = &SetChatAffiliateProgramRequest{} -) - -func (s *SetChatAffiliateProgramRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Parameters.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatAffiliateProgramRequest) String() string { - if s == nil { - return "SetChatAffiliateProgramRequest(nil)" - } - type Alias SetChatAffiliateProgramRequest - return fmt.Sprintf("SetChatAffiliateProgramRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatAffiliateProgramRequest) TypeID() uint32 { - return SetChatAffiliateProgramRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatAffiliateProgramRequest) TypeName() string { - return "setChatAffiliateProgram" -} - -// TypeInfo returns info about TL type. -func (s *SetChatAffiliateProgramRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatAffiliateProgram", - ID: SetChatAffiliateProgramRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Parameters", - SchemaName: "parameters", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatAffiliateProgramRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatAffiliateProgram#e00237 as nil") - } - b.PutID(SetChatAffiliateProgramRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatAffiliateProgramRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatAffiliateProgram#e00237 as nil") - } - b.PutInt53(s.ChatID) - if err := s.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatAffiliateProgram#e00237: field parameters: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatAffiliateProgramRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatAffiliateProgram#e00237 to nil") - } - if err := b.ConsumeID(SetChatAffiliateProgramRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatAffiliateProgram#e00237: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatAffiliateProgramRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatAffiliateProgram#e00237 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatAffiliateProgram#e00237: field chat_id: %w", err) - } - s.ChatID = value - } - { - if err := s.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode setChatAffiliateProgram#e00237: field parameters: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatAffiliateProgramRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatAffiliateProgram#e00237 as nil") - } - b.ObjStart() - b.PutID("setChatAffiliateProgram") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("parameters") - if err := s.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatAffiliateProgram#e00237: field parameters: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatAffiliateProgramRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatAffiliateProgram#e00237 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatAffiliateProgram"); err != nil { - return fmt.Errorf("unable to decode setChatAffiliateProgram#e00237: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatAffiliateProgram#e00237: field chat_id: %w", err) - } - s.ChatID = value - case "parameters": - if err := s.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setChatAffiliateProgram#e00237: field parameters: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatAffiliateProgramRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetParameters returns value of Parameters field. -func (s *SetChatAffiliateProgramRequest) GetParameters() (value AffiliateProgramParameters) { - if s == nil { - return - } - return s.Parameters -} - -// SetChatAffiliateProgram invokes method setChatAffiliateProgram#e00237 returning error if any. -func (c *Client) SetChatAffiliateProgram(ctx context.Context, request *SetChatAffiliateProgramRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_available_reactions_gen.go b/tdapi/tl_set_chat_available_reactions_gen.go deleted file mode 100644 index bbd527942..000000000 --- a/tdapi/tl_set_chat_available_reactions_gen.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatAvailableReactionsRequest represents TL type `setChatAvailableReactions#feb3e06`. -type SetChatAvailableReactionsRequest struct { - // Identifier of the chat - ChatID int64 - // Reactions available in the chat. All explicitly specified emoji reactions must be - // active. In channel chats up to the chat's boost level custom emoji reactions can be - // explicitly specified - AvailableReactions ChatAvailableReactionsClass -} - -// SetChatAvailableReactionsRequestTypeID is TL type id of SetChatAvailableReactionsRequest. -const SetChatAvailableReactionsRequestTypeID = 0xfeb3e06 - -// Ensuring interfaces in compile-time for SetChatAvailableReactionsRequest. -var ( - _ bin.Encoder = &SetChatAvailableReactionsRequest{} - _ bin.Decoder = &SetChatAvailableReactionsRequest{} - _ bin.BareEncoder = &SetChatAvailableReactionsRequest{} - _ bin.BareDecoder = &SetChatAvailableReactionsRequest{} -) - -func (s *SetChatAvailableReactionsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.AvailableReactions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatAvailableReactionsRequest) String() string { - if s == nil { - return "SetChatAvailableReactionsRequest(nil)" - } - type Alias SetChatAvailableReactionsRequest - return fmt.Sprintf("SetChatAvailableReactionsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatAvailableReactionsRequest) TypeID() uint32 { - return SetChatAvailableReactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatAvailableReactionsRequest) TypeName() string { - return "setChatAvailableReactions" -} - -// TypeInfo returns info about TL type. -func (s *SetChatAvailableReactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatAvailableReactions", - ID: SetChatAvailableReactionsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "AvailableReactions", - SchemaName: "available_reactions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatAvailableReactionsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatAvailableReactions#feb3e06 as nil") - } - b.PutID(SetChatAvailableReactionsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatAvailableReactionsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatAvailableReactions#feb3e06 as nil") - } - b.PutInt53(s.ChatID) - if s.AvailableReactions == nil { - return fmt.Errorf("unable to encode setChatAvailableReactions#feb3e06: field available_reactions is nil") - } - if err := s.AvailableReactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatAvailableReactions#feb3e06: field available_reactions: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatAvailableReactionsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatAvailableReactions#feb3e06 to nil") - } - if err := b.ConsumeID(SetChatAvailableReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatAvailableReactions#feb3e06: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatAvailableReactionsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatAvailableReactions#feb3e06 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatAvailableReactions#feb3e06: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := DecodeChatAvailableReactions(b) - if err != nil { - return fmt.Errorf("unable to decode setChatAvailableReactions#feb3e06: field available_reactions: %w", err) - } - s.AvailableReactions = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatAvailableReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatAvailableReactions#feb3e06 as nil") - } - b.ObjStart() - b.PutID("setChatAvailableReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("available_reactions") - if s.AvailableReactions == nil { - return fmt.Errorf("unable to encode setChatAvailableReactions#feb3e06: field available_reactions is nil") - } - if err := s.AvailableReactions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatAvailableReactions#feb3e06: field available_reactions: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatAvailableReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatAvailableReactions#feb3e06 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatAvailableReactions"); err != nil { - return fmt.Errorf("unable to decode setChatAvailableReactions#feb3e06: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatAvailableReactions#feb3e06: field chat_id: %w", err) - } - s.ChatID = value - case "available_reactions": - value, err := DecodeTDLibJSONChatAvailableReactions(b) - if err != nil { - return fmt.Errorf("unable to decode setChatAvailableReactions#feb3e06: field available_reactions: %w", err) - } - s.AvailableReactions = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatAvailableReactionsRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetAvailableReactions returns value of AvailableReactions field. -func (s *SetChatAvailableReactionsRequest) GetAvailableReactions() (value ChatAvailableReactionsClass) { - if s == nil { - return - } - return s.AvailableReactions -} - -// SetChatAvailableReactions invokes method setChatAvailableReactions#feb3e06 returning error if any. -func (c *Client) SetChatAvailableReactions(ctx context.Context, request *SetChatAvailableReactionsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_background_gen.go b/tdapi/tl_set_chat_background_gen.go deleted file mode 100644 index e46b4f64d..000000000 --- a/tdapi/tl_set_chat_background_gen.go +++ /dev/null @@ -1,364 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatBackgroundRequest represents TL type `setChatBackground#eb4c3fe`. -type SetChatBackgroundRequest struct { - // Chat identifier - ChatID int64 - // The input background to use; pass null to create a new filled or chat theme background - Background InputBackgroundClass - // Background type; pass null to use default background type for the chosen background; - // backgroundTypeChatTheme isn't supported for private and secret chats. - Type BackgroundTypeClass - // Dimming of the background in dark themes, as a percentage; 0-100. Applied only to - // Wallpaper and Fill types of background - DarkThemeDimming int32 - // Pass true to set background only for self; pass false to set background for all chat - // users. Always false for backgrounds set in boosted chats. Background can be set for - // both users only by Telegram Premium users and if set background isn't of the type - // inputBackgroundPrevious - OnlyForSelf bool -} - -// SetChatBackgroundRequestTypeID is TL type id of SetChatBackgroundRequest. -const SetChatBackgroundRequestTypeID = 0xeb4c3fe - -// Ensuring interfaces in compile-time for SetChatBackgroundRequest. -var ( - _ bin.Encoder = &SetChatBackgroundRequest{} - _ bin.Decoder = &SetChatBackgroundRequest{} - _ bin.BareEncoder = &SetChatBackgroundRequest{} - _ bin.BareDecoder = &SetChatBackgroundRequest{} -) - -func (s *SetChatBackgroundRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Background == nil) { - return false - } - if !(s.Type == nil) { - return false - } - if !(s.DarkThemeDimming == 0) { - return false - } - if !(s.OnlyForSelf == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatBackgroundRequest) String() string { - if s == nil { - return "SetChatBackgroundRequest(nil)" - } - type Alias SetChatBackgroundRequest - return fmt.Sprintf("SetChatBackgroundRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatBackgroundRequest) TypeID() uint32 { - return SetChatBackgroundRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatBackgroundRequest) TypeName() string { - return "setChatBackground" -} - -// TypeInfo returns info about TL type. -func (s *SetChatBackgroundRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatBackground", - ID: SetChatBackgroundRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Background", - SchemaName: "background", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "DarkThemeDimming", - SchemaName: "dark_theme_dimming", - }, - { - Name: "OnlyForSelf", - SchemaName: "only_for_self", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatBackgroundRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatBackground#eb4c3fe as nil") - } - b.PutID(SetChatBackgroundRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatBackgroundRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatBackground#eb4c3fe as nil") - } - b.PutInt53(s.ChatID) - if s.Background == nil { - return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field background is nil") - } - if err := s.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field background: %w", err) - } - if s.Type == nil { - return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field type is nil") - } - if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field type: %w", err) - } - b.PutInt32(s.DarkThemeDimming) - b.PutBool(s.OnlyForSelf) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatBackgroundRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatBackground#eb4c3fe to nil") - } - if err := b.ConsumeID(SetChatBackgroundRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatBackgroundRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatBackground#eb4c3fe to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := DecodeInputBackground(b) - if err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field background: %w", err) - } - s.Background = value - } - { - value, err := DecodeBackgroundType(b) - if err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field type: %w", err) - } - s.Type = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field dark_theme_dimming: %w", err) - } - s.DarkThemeDimming = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field only_for_self: %w", err) - } - s.OnlyForSelf = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatBackgroundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatBackground#eb4c3fe as nil") - } - b.ObjStart() - b.PutID("setChatBackground") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("background") - if s.Background == nil { - return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field background is nil") - } - if err := s.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field background: %w", err) - } - b.Comma() - b.FieldStart("type") - if s.Type == nil { - return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field type is nil") - } - if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatBackground#eb4c3fe: field type: %w", err) - } - b.Comma() - b.FieldStart("dark_theme_dimming") - b.PutInt32(s.DarkThemeDimming) - b.Comma() - b.FieldStart("only_for_self") - b.PutBool(s.OnlyForSelf) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatBackgroundRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatBackground#eb4c3fe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatBackground"); err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field chat_id: %w", err) - } - s.ChatID = value - case "background": - value, err := DecodeTDLibJSONInputBackground(b) - if err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field background: %w", err) - } - s.Background = value - case "type": - value, err := DecodeTDLibJSONBackgroundType(b) - if err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field type: %w", err) - } - s.Type = value - case "dark_theme_dimming": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field dark_theme_dimming: %w", err) - } - s.DarkThemeDimming = value - case "only_for_self": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setChatBackground#eb4c3fe: field only_for_self: %w", err) - } - s.OnlyForSelf = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatBackgroundRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetBackground returns value of Background field. -func (s *SetChatBackgroundRequest) GetBackground() (value InputBackgroundClass) { - if s == nil { - return - } - return s.Background -} - -// GetType returns value of Type field. -func (s *SetChatBackgroundRequest) GetType() (value BackgroundTypeClass) { - if s == nil { - return - } - return s.Type -} - -// GetDarkThemeDimming returns value of DarkThemeDimming field. -func (s *SetChatBackgroundRequest) GetDarkThemeDimming() (value int32) { - if s == nil { - return - } - return s.DarkThemeDimming -} - -// GetOnlyForSelf returns value of OnlyForSelf field. -func (s *SetChatBackgroundRequest) GetOnlyForSelf() (value bool) { - if s == nil { - return - } - return s.OnlyForSelf -} - -// SetChatBackground invokes method setChatBackground#eb4c3fe returning error if any. -func (c *Client) SetChatBackground(ctx context.Context, request *SetChatBackgroundRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_client_data_gen.go b/tdapi/tl_set_chat_client_data_gen.go deleted file mode 100644 index 6c072254d..000000000 --- a/tdapi/tl_set_chat_client_data_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatClientDataRequest represents TL type `setChatClientData#ceb3273d`. -type SetChatClientDataRequest struct { - // Chat identifier - ChatID int64 - // New value of client_data - ClientData string -} - -// SetChatClientDataRequestTypeID is TL type id of SetChatClientDataRequest. -const SetChatClientDataRequestTypeID = 0xceb3273d - -// Ensuring interfaces in compile-time for SetChatClientDataRequest. -var ( - _ bin.Encoder = &SetChatClientDataRequest{} - _ bin.Decoder = &SetChatClientDataRequest{} - _ bin.BareEncoder = &SetChatClientDataRequest{} - _ bin.BareDecoder = &SetChatClientDataRequest{} -) - -func (s *SetChatClientDataRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.ClientData == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatClientDataRequest) String() string { - if s == nil { - return "SetChatClientDataRequest(nil)" - } - type Alias SetChatClientDataRequest - return fmt.Sprintf("SetChatClientDataRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatClientDataRequest) TypeID() uint32 { - return SetChatClientDataRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatClientDataRequest) TypeName() string { - return "setChatClientData" -} - -// TypeInfo returns info about TL type. -func (s *SetChatClientDataRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatClientData", - ID: SetChatClientDataRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ClientData", - SchemaName: "client_data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatClientDataRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatClientData#ceb3273d as nil") - } - b.PutID(SetChatClientDataRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatClientDataRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatClientData#ceb3273d as nil") - } - b.PutInt53(s.ChatID) - b.PutString(s.ClientData) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatClientDataRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatClientData#ceb3273d to nil") - } - if err := b.ConsumeID(SetChatClientDataRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatClientData#ceb3273d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatClientDataRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatClientData#ceb3273d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatClientData#ceb3273d: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setChatClientData#ceb3273d: field client_data: %w", err) - } - s.ClientData = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatClientDataRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatClientData#ceb3273d as nil") - } - b.ObjStart() - b.PutID("setChatClientData") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("client_data") - b.PutString(s.ClientData) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatClientDataRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatClientData#ceb3273d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatClientData"); err != nil { - return fmt.Errorf("unable to decode setChatClientData#ceb3273d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatClientData#ceb3273d: field chat_id: %w", err) - } - s.ChatID = value - case "client_data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setChatClientData#ceb3273d: field client_data: %w", err) - } - s.ClientData = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatClientDataRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetClientData returns value of ClientData field. -func (s *SetChatClientDataRequest) GetClientData() (value string) { - if s == nil { - return - } - return s.ClientData -} - -// SetChatClientData invokes method setChatClientData#ceb3273d returning error if any. -func (c *Client) SetChatClientData(ctx context.Context, request *SetChatClientDataRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_description_gen.go b/tdapi/tl_set_chat_description_gen.go deleted file mode 100644 index 4616e506e..000000000 --- a/tdapi/tl_set_chat_description_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatDescriptionRequest represents TL type `setChatDescription#74a8b45d`. -type SetChatDescriptionRequest struct { - // Identifier of the chat - ChatID int64 - // Changes information about a chat. Available for basic groups, supergroups, and - // channels. Requires can_change_info member right - Description string -} - -// SetChatDescriptionRequestTypeID is TL type id of SetChatDescriptionRequest. -const SetChatDescriptionRequestTypeID = 0x74a8b45d - -// Ensuring interfaces in compile-time for SetChatDescriptionRequest. -var ( - _ bin.Encoder = &SetChatDescriptionRequest{} - _ bin.Decoder = &SetChatDescriptionRequest{} - _ bin.BareEncoder = &SetChatDescriptionRequest{} - _ bin.BareDecoder = &SetChatDescriptionRequest{} -) - -func (s *SetChatDescriptionRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Description == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatDescriptionRequest) String() string { - if s == nil { - return "SetChatDescriptionRequest(nil)" - } - type Alias SetChatDescriptionRequest - return fmt.Sprintf("SetChatDescriptionRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatDescriptionRequest) TypeID() uint32 { - return SetChatDescriptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatDescriptionRequest) TypeName() string { - return "setChatDescription" -} - -// TypeInfo returns info about TL type. -func (s *SetChatDescriptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatDescription", - ID: SetChatDescriptionRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Description", - SchemaName: "description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatDescriptionRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatDescription#74a8b45d as nil") - } - b.PutID(SetChatDescriptionRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatDescriptionRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatDescription#74a8b45d as nil") - } - b.PutInt53(s.ChatID) - b.PutString(s.Description) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatDescriptionRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatDescription#74a8b45d to nil") - } - if err := b.ConsumeID(SetChatDescriptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatDescription#74a8b45d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatDescriptionRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatDescription#74a8b45d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatDescription#74a8b45d: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setChatDescription#74a8b45d: field description: %w", err) - } - s.Description = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatDescriptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatDescription#74a8b45d as nil") - } - b.ObjStart() - b.PutID("setChatDescription") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("description") - b.PutString(s.Description) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatDescriptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatDescription#74a8b45d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatDescription"); err != nil { - return fmt.Errorf("unable to decode setChatDescription#74a8b45d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatDescription#74a8b45d: field chat_id: %w", err) - } - s.ChatID = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setChatDescription#74a8b45d: field description: %w", err) - } - s.Description = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatDescriptionRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetDescription returns value of Description field. -func (s *SetChatDescriptionRequest) GetDescription() (value string) { - if s == nil { - return - } - return s.Description -} - -// SetChatDescription invokes method setChatDescription#74a8b45d returning error if any. -func (c *Client) SetChatDescription(ctx context.Context, request *SetChatDescriptionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_discussion_group_gen.go b/tdapi/tl_set_chat_discussion_group_gen.go deleted file mode 100644 index 8b984e1b8..000000000 --- a/tdapi/tl_set_chat_discussion_group_gen.go +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatDiscussionGroupRequest represents TL type `setChatDiscussionGroup#c93c32b8`. -type SetChatDiscussionGroupRequest struct { - // Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in - // the second argument to a linked channel chat (requires can_pin_messages member right - // in the supergroup) - ChatID int64 - // Identifier of a new channel's discussion group. Use 0 to remove the discussion group. - // Use the method getSuitableDiscussionChats to find all suitable groups. - DiscussionChatID int64 -} - -// SetChatDiscussionGroupRequestTypeID is TL type id of SetChatDiscussionGroupRequest. -const SetChatDiscussionGroupRequestTypeID = 0xc93c32b8 - -// Ensuring interfaces in compile-time for SetChatDiscussionGroupRequest. -var ( - _ bin.Encoder = &SetChatDiscussionGroupRequest{} - _ bin.Decoder = &SetChatDiscussionGroupRequest{} - _ bin.BareEncoder = &SetChatDiscussionGroupRequest{} - _ bin.BareDecoder = &SetChatDiscussionGroupRequest{} -) - -func (s *SetChatDiscussionGroupRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.DiscussionChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatDiscussionGroupRequest) String() string { - if s == nil { - return "SetChatDiscussionGroupRequest(nil)" - } - type Alias SetChatDiscussionGroupRequest - return fmt.Sprintf("SetChatDiscussionGroupRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatDiscussionGroupRequest) TypeID() uint32 { - return SetChatDiscussionGroupRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatDiscussionGroupRequest) TypeName() string { - return "setChatDiscussionGroup" -} - -// TypeInfo returns info about TL type. -func (s *SetChatDiscussionGroupRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatDiscussionGroup", - ID: SetChatDiscussionGroupRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "DiscussionChatID", - SchemaName: "discussion_chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatDiscussionGroupRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatDiscussionGroup#c93c32b8 as nil") - } - b.PutID(SetChatDiscussionGroupRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatDiscussionGroupRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatDiscussionGroup#c93c32b8 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.DiscussionChatID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatDiscussionGroupRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatDiscussionGroup#c93c32b8 to nil") - } - if err := b.ConsumeID(SetChatDiscussionGroupRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatDiscussionGroup#c93c32b8: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatDiscussionGroupRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatDiscussionGroup#c93c32b8 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatDiscussionGroup#c93c32b8: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatDiscussionGroup#c93c32b8: field discussion_chat_id: %w", err) - } - s.DiscussionChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatDiscussionGroupRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatDiscussionGroup#c93c32b8 as nil") - } - b.ObjStart() - b.PutID("setChatDiscussionGroup") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("discussion_chat_id") - b.PutInt53(s.DiscussionChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatDiscussionGroupRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatDiscussionGroup#c93c32b8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatDiscussionGroup"); err != nil { - return fmt.Errorf("unable to decode setChatDiscussionGroup#c93c32b8: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatDiscussionGroup#c93c32b8: field chat_id: %w", err) - } - s.ChatID = value - case "discussion_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatDiscussionGroup#c93c32b8: field discussion_chat_id: %w", err) - } - s.DiscussionChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatDiscussionGroupRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetDiscussionChatID returns value of DiscussionChatID field. -func (s *SetChatDiscussionGroupRequest) GetDiscussionChatID() (value int64) { - if s == nil { - return - } - return s.DiscussionChatID -} - -// SetChatDiscussionGroup invokes method setChatDiscussionGroup#c93c32b8 returning error if any. -func (c *Client) SetChatDiscussionGroup(ctx context.Context, request *SetChatDiscussionGroupRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_draft_message_gen.go b/tdapi/tl_set_chat_draft_message_gen.go deleted file mode 100644 index 3fb1ca3a9..000000000 --- a/tdapi/tl_set_chat_draft_message_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatDraftMessageRequest represents TL type `setChatDraftMessage#645e1f1a`. -type SetChatDraftMessageRequest struct { - // Chat identifier - ChatID int64 - // If not 0, the message thread identifier in which the draft was changed - MessageThreadID int64 - // New draft message; pass null to remove the draft. All files in draft message content - // must be of the type inputFileLocal. Media thumbnails and captions are ignored - DraftMessage DraftMessage -} - -// SetChatDraftMessageRequestTypeID is TL type id of SetChatDraftMessageRequest. -const SetChatDraftMessageRequestTypeID = 0x645e1f1a - -// Ensuring interfaces in compile-time for SetChatDraftMessageRequest. -var ( - _ bin.Encoder = &SetChatDraftMessageRequest{} - _ bin.Decoder = &SetChatDraftMessageRequest{} - _ bin.BareEncoder = &SetChatDraftMessageRequest{} - _ bin.BareDecoder = &SetChatDraftMessageRequest{} -) - -func (s *SetChatDraftMessageRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageThreadID == 0) { - return false - } - if !(s.DraftMessage.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatDraftMessageRequest) String() string { - if s == nil { - return "SetChatDraftMessageRequest(nil)" - } - type Alias SetChatDraftMessageRequest - return fmt.Sprintf("SetChatDraftMessageRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatDraftMessageRequest) TypeID() uint32 { - return SetChatDraftMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatDraftMessageRequest) TypeName() string { - return "setChatDraftMessage" -} - -// TypeInfo returns info about TL type. -func (s *SetChatDraftMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatDraftMessage", - ID: SetChatDraftMessageRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "DraftMessage", - SchemaName: "draft_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatDraftMessageRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatDraftMessage#645e1f1a as nil") - } - b.PutID(SetChatDraftMessageRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatDraftMessageRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatDraftMessage#645e1f1a as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageThreadID) - if err := s.DraftMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatDraftMessage#645e1f1a: field draft_message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatDraftMessageRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatDraftMessage#645e1f1a to nil") - } - if err := b.ConsumeID(SetChatDraftMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatDraftMessage#645e1f1a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatDraftMessageRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatDraftMessage#645e1f1a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatDraftMessage#645e1f1a: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatDraftMessage#645e1f1a: field message_thread_id: %w", err) - } - s.MessageThreadID = value - } - { - if err := s.DraftMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode setChatDraftMessage#645e1f1a: field draft_message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatDraftMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatDraftMessage#645e1f1a as nil") - } - b.ObjStart() - b.PutID("setChatDraftMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(s.MessageThreadID) - b.Comma() - b.FieldStart("draft_message") - if err := s.DraftMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatDraftMessage#645e1f1a: field draft_message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatDraftMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatDraftMessage#645e1f1a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatDraftMessage"); err != nil { - return fmt.Errorf("unable to decode setChatDraftMessage#645e1f1a: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatDraftMessage#645e1f1a: field chat_id: %w", err) - } - s.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatDraftMessage#645e1f1a: field message_thread_id: %w", err) - } - s.MessageThreadID = value - case "draft_message": - if err := s.DraftMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setChatDraftMessage#645e1f1a: field draft_message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatDraftMessageRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (s *SetChatDraftMessageRequest) GetMessageThreadID() (value int64) { - if s == nil { - return - } - return s.MessageThreadID -} - -// GetDraftMessage returns value of DraftMessage field. -func (s *SetChatDraftMessageRequest) GetDraftMessage() (value DraftMessage) { - if s == nil { - return - } - return s.DraftMessage -} - -// SetChatDraftMessage invokes method setChatDraftMessage#645e1f1a returning error if any. -func (c *Client) SetChatDraftMessage(ctx context.Context, request *SetChatDraftMessageRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_emoji_status_gen.go b/tdapi/tl_set_chat_emoji_status_gen.go deleted file mode 100644 index 19d05dec3..000000000 --- a/tdapi/tl_set_chat_emoji_status_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatEmojiStatusRequest represents TL type `setChatEmojiStatus#55881912`. -type SetChatEmojiStatusRequest struct { - // Chat identifier - ChatID int64 - // New emoji status; pass null to remove emoji status - EmojiStatus EmojiStatus -} - -// SetChatEmojiStatusRequestTypeID is TL type id of SetChatEmojiStatusRequest. -const SetChatEmojiStatusRequestTypeID = 0x55881912 - -// Ensuring interfaces in compile-time for SetChatEmojiStatusRequest. -var ( - _ bin.Encoder = &SetChatEmojiStatusRequest{} - _ bin.Decoder = &SetChatEmojiStatusRequest{} - _ bin.BareEncoder = &SetChatEmojiStatusRequest{} - _ bin.BareDecoder = &SetChatEmojiStatusRequest{} -) - -func (s *SetChatEmojiStatusRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.EmojiStatus.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatEmojiStatusRequest) String() string { - if s == nil { - return "SetChatEmojiStatusRequest(nil)" - } - type Alias SetChatEmojiStatusRequest - return fmt.Sprintf("SetChatEmojiStatusRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatEmojiStatusRequest) TypeID() uint32 { - return SetChatEmojiStatusRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatEmojiStatusRequest) TypeName() string { - return "setChatEmojiStatus" -} - -// TypeInfo returns info about TL type. -func (s *SetChatEmojiStatusRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatEmojiStatus", - ID: SetChatEmojiStatusRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "EmojiStatus", - SchemaName: "emoji_status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatEmojiStatusRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatEmojiStatus#55881912 as nil") - } - b.PutID(SetChatEmojiStatusRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatEmojiStatusRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatEmojiStatus#55881912 as nil") - } - b.PutInt53(s.ChatID) - if err := s.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatEmojiStatus#55881912: field emoji_status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatEmojiStatusRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatEmojiStatus#55881912 to nil") - } - if err := b.ConsumeID(SetChatEmojiStatusRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatEmojiStatus#55881912: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatEmojiStatusRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatEmojiStatus#55881912 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatEmojiStatus#55881912: field chat_id: %w", err) - } - s.ChatID = value - } - { - if err := s.EmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode setChatEmojiStatus#55881912: field emoji_status: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatEmojiStatusRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatEmojiStatus#55881912 as nil") - } - b.ObjStart() - b.PutID("setChatEmojiStatus") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("emoji_status") - if err := s.EmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatEmojiStatus#55881912: field emoji_status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatEmojiStatusRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatEmojiStatus#55881912 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatEmojiStatus"); err != nil { - return fmt.Errorf("unable to decode setChatEmojiStatus#55881912: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatEmojiStatus#55881912: field chat_id: %w", err) - } - s.ChatID = value - case "emoji_status": - if err := s.EmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setChatEmojiStatus#55881912: field emoji_status: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatEmojiStatusRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetEmojiStatus returns value of EmojiStatus field. -func (s *SetChatEmojiStatusRequest) GetEmojiStatus() (value EmojiStatus) { - if s == nil { - return - } - return s.EmojiStatus -} - -// SetChatEmojiStatus invokes method setChatEmojiStatus#55881912 returning error if any. -func (c *Client) SetChatEmojiStatus(ctx context.Context, request *SetChatEmojiStatusRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_location_gen.go b/tdapi/tl_set_chat_location_gen.go deleted file mode 100644 index 52de05166..000000000 --- a/tdapi/tl_set_chat_location_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatLocationRequest represents TL type `setChatLocation#d2471daa`. -type SetChatLocationRequest struct { - // Chat identifier - ChatID int64 - // New location for the chat; must be valid and not null - Location ChatLocation -} - -// SetChatLocationRequestTypeID is TL type id of SetChatLocationRequest. -const SetChatLocationRequestTypeID = 0xd2471daa - -// Ensuring interfaces in compile-time for SetChatLocationRequest. -var ( - _ bin.Encoder = &SetChatLocationRequest{} - _ bin.Decoder = &SetChatLocationRequest{} - _ bin.BareEncoder = &SetChatLocationRequest{} - _ bin.BareDecoder = &SetChatLocationRequest{} -) - -func (s *SetChatLocationRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Location.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatLocationRequest) String() string { - if s == nil { - return "SetChatLocationRequest(nil)" - } - type Alias SetChatLocationRequest - return fmt.Sprintf("SetChatLocationRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatLocationRequest) TypeID() uint32 { - return SetChatLocationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatLocationRequest) TypeName() string { - return "setChatLocation" -} - -// TypeInfo returns info about TL type. -func (s *SetChatLocationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatLocation", - ID: SetChatLocationRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Location", - SchemaName: "location", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatLocationRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatLocation#d2471daa as nil") - } - b.PutID(SetChatLocationRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatLocationRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatLocation#d2471daa as nil") - } - b.PutInt53(s.ChatID) - if err := s.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatLocation#d2471daa: field location: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatLocationRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatLocation#d2471daa to nil") - } - if err := b.ConsumeID(SetChatLocationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatLocation#d2471daa: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatLocationRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatLocation#d2471daa to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatLocation#d2471daa: field chat_id: %w", err) - } - s.ChatID = value - } - { - if err := s.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode setChatLocation#d2471daa: field location: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatLocationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatLocation#d2471daa as nil") - } - b.ObjStart() - b.PutID("setChatLocation") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("location") - if err := s.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatLocation#d2471daa: field location: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatLocationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatLocation#d2471daa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatLocation"); err != nil { - return fmt.Errorf("unable to decode setChatLocation#d2471daa: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatLocation#d2471daa: field chat_id: %w", err) - } - s.ChatID = value - case "location": - if err := s.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setChatLocation#d2471daa: field location: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatLocationRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetLocation returns value of Location field. -func (s *SetChatLocationRequest) GetLocation() (value ChatLocation) { - if s == nil { - return - } - return s.Location -} - -// SetChatLocation invokes method setChatLocation#d2471daa returning error if any. -func (c *Client) SetChatLocation(ctx context.Context, request *SetChatLocationRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_member_status_gen.go b/tdapi/tl_set_chat_member_status_gen.go deleted file mode 100644 index a4af4ef09..000000000 --- a/tdapi/tl_set_chat_member_status_gen.go +++ /dev/null @@ -1,291 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatMemberStatusRequest represents TL type `setChatMemberStatus#4e0171f`. -type SetChatMemberStatusRequest struct { - // Chat identifier - ChatID int64 - // Member identifier. Chats can be only banned and unbanned in supergroups and channels - MemberID MessageSenderClass - // The new status of the member in the chat - Status ChatMemberStatusClass -} - -// SetChatMemberStatusRequestTypeID is TL type id of SetChatMemberStatusRequest. -const SetChatMemberStatusRequestTypeID = 0x4e0171f - -// Ensuring interfaces in compile-time for SetChatMemberStatusRequest. -var ( - _ bin.Encoder = &SetChatMemberStatusRequest{} - _ bin.Decoder = &SetChatMemberStatusRequest{} - _ bin.BareEncoder = &SetChatMemberStatusRequest{} - _ bin.BareDecoder = &SetChatMemberStatusRequest{} -) - -func (s *SetChatMemberStatusRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MemberID == nil) { - return false - } - if !(s.Status == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatMemberStatusRequest) String() string { - if s == nil { - return "SetChatMemberStatusRequest(nil)" - } - type Alias SetChatMemberStatusRequest - return fmt.Sprintf("SetChatMemberStatusRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatMemberStatusRequest) TypeID() uint32 { - return SetChatMemberStatusRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatMemberStatusRequest) TypeName() string { - return "setChatMemberStatus" -} - -// TypeInfo returns info about TL type. -func (s *SetChatMemberStatusRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatMemberStatus", - ID: SetChatMemberStatusRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MemberID", - SchemaName: "member_id", - }, - { - Name: "Status", - SchemaName: "status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatMemberStatusRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatMemberStatus#4e0171f as nil") - } - b.PutID(SetChatMemberStatusRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatMemberStatusRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatMemberStatus#4e0171f as nil") - } - b.PutInt53(s.ChatID) - if s.MemberID == nil { - return fmt.Errorf("unable to encode setChatMemberStatus#4e0171f: field member_id is nil") - } - if err := s.MemberID.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatMemberStatus#4e0171f: field member_id: %w", err) - } - if s.Status == nil { - return fmt.Errorf("unable to encode setChatMemberStatus#4e0171f: field status is nil") - } - if err := s.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatMemberStatus#4e0171f: field status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatMemberStatusRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatMemberStatus#4e0171f to nil") - } - if err := b.ConsumeID(SetChatMemberStatusRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatMemberStatus#4e0171f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatMemberStatusRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatMemberStatus#4e0171f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatMemberStatus#4e0171f: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setChatMemberStatus#4e0171f: field member_id: %w", err) - } - s.MemberID = value - } - { - value, err := DecodeChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode setChatMemberStatus#4e0171f: field status: %w", err) - } - s.Status = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatMemberStatusRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatMemberStatus#4e0171f as nil") - } - b.ObjStart() - b.PutID("setChatMemberStatus") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("member_id") - if s.MemberID == nil { - return fmt.Errorf("unable to encode setChatMemberStatus#4e0171f: field member_id is nil") - } - if err := s.MemberID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatMemberStatus#4e0171f: field member_id: %w", err) - } - b.Comma() - b.FieldStart("status") - if s.Status == nil { - return fmt.Errorf("unable to encode setChatMemberStatus#4e0171f: field status is nil") - } - if err := s.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatMemberStatus#4e0171f: field status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatMemberStatusRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatMemberStatus#4e0171f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatMemberStatus"); err != nil { - return fmt.Errorf("unable to decode setChatMemberStatus#4e0171f: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatMemberStatus#4e0171f: field chat_id: %w", err) - } - s.ChatID = value - case "member_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setChatMemberStatus#4e0171f: field member_id: %w", err) - } - s.MemberID = value - case "status": - value, err := DecodeTDLibJSONChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode setChatMemberStatus#4e0171f: field status: %w", err) - } - s.Status = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatMemberStatusRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMemberID returns value of MemberID field. -func (s *SetChatMemberStatusRequest) GetMemberID() (value MessageSenderClass) { - if s == nil { - return - } - return s.MemberID -} - -// GetStatus returns value of Status field. -func (s *SetChatMemberStatusRequest) GetStatus() (value ChatMemberStatusClass) { - if s == nil { - return - } - return s.Status -} - -// SetChatMemberStatus invokes method setChatMemberStatus#4e0171f returning error if any. -func (c *Client) SetChatMemberStatus(ctx context.Context, request *SetChatMemberStatusRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_message_auto_delete_time_gen.go b/tdapi/tl_set_chat_message_auto_delete_time_gen.go deleted file mode 100644 index 5e74c0c64..000000000 --- a/tdapi/tl_set_chat_message_auto_delete_time_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatMessageAutoDeleteTimeRequest represents TL type `setChatMessageAutoDeleteTime#a641b4ff`. -type SetChatMessageAutoDeleteTimeRequest struct { - // Chat identifier - ChatID int64 - // New time value, in seconds; unless the chat is secret, it must be from 0 up to 365 * - // 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically - MessageAutoDeleteTime int32 -} - -// SetChatMessageAutoDeleteTimeRequestTypeID is TL type id of SetChatMessageAutoDeleteTimeRequest. -const SetChatMessageAutoDeleteTimeRequestTypeID = 0xa641b4ff - -// Ensuring interfaces in compile-time for SetChatMessageAutoDeleteTimeRequest. -var ( - _ bin.Encoder = &SetChatMessageAutoDeleteTimeRequest{} - _ bin.Decoder = &SetChatMessageAutoDeleteTimeRequest{} - _ bin.BareEncoder = &SetChatMessageAutoDeleteTimeRequest{} - _ bin.BareDecoder = &SetChatMessageAutoDeleteTimeRequest{} -) - -func (s *SetChatMessageAutoDeleteTimeRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageAutoDeleteTime == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatMessageAutoDeleteTimeRequest) String() string { - if s == nil { - return "SetChatMessageAutoDeleteTimeRequest(nil)" - } - type Alias SetChatMessageAutoDeleteTimeRequest - return fmt.Sprintf("SetChatMessageAutoDeleteTimeRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatMessageAutoDeleteTimeRequest) TypeID() uint32 { - return SetChatMessageAutoDeleteTimeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatMessageAutoDeleteTimeRequest) TypeName() string { - return "setChatMessageAutoDeleteTime" -} - -// TypeInfo returns info about TL type. -func (s *SetChatMessageAutoDeleteTimeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatMessageAutoDeleteTime", - ID: SetChatMessageAutoDeleteTimeRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageAutoDeleteTime", - SchemaName: "message_auto_delete_time", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatMessageAutoDeleteTimeRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatMessageAutoDeleteTime#a641b4ff as nil") - } - b.PutID(SetChatMessageAutoDeleteTimeRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatMessageAutoDeleteTimeRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatMessageAutoDeleteTime#a641b4ff as nil") - } - b.PutInt53(s.ChatID) - b.PutInt32(s.MessageAutoDeleteTime) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatMessageAutoDeleteTimeRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatMessageAutoDeleteTime#a641b4ff to nil") - } - if err := b.ConsumeID(SetChatMessageAutoDeleteTimeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatMessageAutoDeleteTime#a641b4ff: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatMessageAutoDeleteTimeRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatMessageAutoDeleteTime#a641b4ff to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatMessageAutoDeleteTime#a641b4ff: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatMessageAutoDeleteTime#a641b4ff: field message_auto_delete_time: %w", err) - } - s.MessageAutoDeleteTime = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatMessageAutoDeleteTimeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatMessageAutoDeleteTime#a641b4ff as nil") - } - b.ObjStart() - b.PutID("setChatMessageAutoDeleteTime") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_auto_delete_time") - b.PutInt32(s.MessageAutoDeleteTime) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatMessageAutoDeleteTimeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatMessageAutoDeleteTime#a641b4ff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatMessageAutoDeleteTime"); err != nil { - return fmt.Errorf("unable to decode setChatMessageAutoDeleteTime#a641b4ff: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatMessageAutoDeleteTime#a641b4ff: field chat_id: %w", err) - } - s.ChatID = value - case "message_auto_delete_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatMessageAutoDeleteTime#a641b4ff: field message_auto_delete_time: %w", err) - } - s.MessageAutoDeleteTime = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatMessageAutoDeleteTimeRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageAutoDeleteTime returns value of MessageAutoDeleteTime field. -func (s *SetChatMessageAutoDeleteTimeRequest) GetMessageAutoDeleteTime() (value int32) { - if s == nil { - return - } - return s.MessageAutoDeleteTime -} - -// SetChatMessageAutoDeleteTime invokes method setChatMessageAutoDeleteTime#a641b4ff returning error if any. -func (c *Client) SetChatMessageAutoDeleteTime(ctx context.Context, request *SetChatMessageAutoDeleteTimeRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_message_sender_gen.go b/tdapi/tl_set_chat_message_sender_gen.go deleted file mode 100644 index eede8e84f..000000000 --- a/tdapi/tl_set_chat_message_sender_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatMessageSenderRequest represents TL type `setChatMessageSender#ab456b7e`. -type SetChatMessageSenderRequest struct { - // Chat identifier - ChatID int64 - // New message sender for the chat - MessageSenderID MessageSenderClass -} - -// SetChatMessageSenderRequestTypeID is TL type id of SetChatMessageSenderRequest. -const SetChatMessageSenderRequestTypeID = 0xab456b7e - -// Ensuring interfaces in compile-time for SetChatMessageSenderRequest. -var ( - _ bin.Encoder = &SetChatMessageSenderRequest{} - _ bin.Decoder = &SetChatMessageSenderRequest{} - _ bin.BareEncoder = &SetChatMessageSenderRequest{} - _ bin.BareDecoder = &SetChatMessageSenderRequest{} -) - -func (s *SetChatMessageSenderRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageSenderID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatMessageSenderRequest) String() string { - if s == nil { - return "SetChatMessageSenderRequest(nil)" - } - type Alias SetChatMessageSenderRequest - return fmt.Sprintf("SetChatMessageSenderRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatMessageSenderRequest) TypeID() uint32 { - return SetChatMessageSenderRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatMessageSenderRequest) TypeName() string { - return "setChatMessageSender" -} - -// TypeInfo returns info about TL type. -func (s *SetChatMessageSenderRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatMessageSender", - ID: SetChatMessageSenderRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageSenderID", - SchemaName: "message_sender_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatMessageSenderRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatMessageSender#ab456b7e as nil") - } - b.PutID(SetChatMessageSenderRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatMessageSenderRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatMessageSender#ab456b7e as nil") - } - b.PutInt53(s.ChatID) - if s.MessageSenderID == nil { - return fmt.Errorf("unable to encode setChatMessageSender#ab456b7e: field message_sender_id is nil") - } - if err := s.MessageSenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatMessageSender#ab456b7e: field message_sender_id: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatMessageSenderRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatMessageSender#ab456b7e to nil") - } - if err := b.ConsumeID(SetChatMessageSenderRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatMessageSender#ab456b7e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatMessageSenderRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatMessageSender#ab456b7e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatMessageSender#ab456b7e: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setChatMessageSender#ab456b7e: field message_sender_id: %w", err) - } - s.MessageSenderID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatMessageSenderRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatMessageSender#ab456b7e as nil") - } - b.ObjStart() - b.PutID("setChatMessageSender") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_sender_id") - if s.MessageSenderID == nil { - return fmt.Errorf("unable to encode setChatMessageSender#ab456b7e: field message_sender_id is nil") - } - if err := s.MessageSenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatMessageSender#ab456b7e: field message_sender_id: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatMessageSenderRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatMessageSender#ab456b7e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatMessageSender"); err != nil { - return fmt.Errorf("unable to decode setChatMessageSender#ab456b7e: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatMessageSender#ab456b7e: field chat_id: %w", err) - } - s.ChatID = value - case "message_sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setChatMessageSender#ab456b7e: field message_sender_id: %w", err) - } - s.MessageSenderID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatMessageSenderRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageSenderID returns value of MessageSenderID field. -func (s *SetChatMessageSenderRequest) GetMessageSenderID() (value MessageSenderClass) { - if s == nil { - return - } - return s.MessageSenderID -} - -// SetChatMessageSender invokes method setChatMessageSender#ab456b7e returning error if any. -func (c *Client) SetChatMessageSender(ctx context.Context, request *SetChatMessageSenderRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_notification_settings_gen.go b/tdapi/tl_set_chat_notification_settings_gen.go deleted file mode 100644 index d937b307d..000000000 --- a/tdapi/tl_set_chat_notification_settings_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatNotificationSettingsRequest represents TL type `setChatNotificationSettings#2e531ffe`. -type SetChatNotificationSettingsRequest struct { - // Chat identifier - ChatID int64 - // New notification settings for the chat. If the chat is muted for more than 366 days, - // it is considered to be muted forever - NotificationSettings ChatNotificationSettings -} - -// SetChatNotificationSettingsRequestTypeID is TL type id of SetChatNotificationSettingsRequest. -const SetChatNotificationSettingsRequestTypeID = 0x2e531ffe - -// Ensuring interfaces in compile-time for SetChatNotificationSettingsRequest. -var ( - _ bin.Encoder = &SetChatNotificationSettingsRequest{} - _ bin.Decoder = &SetChatNotificationSettingsRequest{} - _ bin.BareEncoder = &SetChatNotificationSettingsRequest{} - _ bin.BareDecoder = &SetChatNotificationSettingsRequest{} -) - -func (s *SetChatNotificationSettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.NotificationSettings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatNotificationSettingsRequest) String() string { - if s == nil { - return "SetChatNotificationSettingsRequest(nil)" - } - type Alias SetChatNotificationSettingsRequest - return fmt.Sprintf("SetChatNotificationSettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatNotificationSettingsRequest) TypeID() uint32 { - return SetChatNotificationSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatNotificationSettingsRequest) TypeName() string { - return "setChatNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (s *SetChatNotificationSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatNotificationSettings", - ID: SetChatNotificationSettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "NotificationSettings", - SchemaName: "notification_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatNotificationSettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatNotificationSettings#2e531ffe as nil") - } - b.PutID(SetChatNotificationSettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatNotificationSettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatNotificationSettings#2e531ffe as nil") - } - b.PutInt53(s.ChatID) - if err := s.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatNotificationSettings#2e531ffe: field notification_settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatNotificationSettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatNotificationSettings#2e531ffe to nil") - } - if err := b.ConsumeID(SetChatNotificationSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatNotificationSettings#2e531ffe: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatNotificationSettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatNotificationSettings#2e531ffe to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatNotificationSettings#2e531ffe: field chat_id: %w", err) - } - s.ChatID = value - } - { - if err := s.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setChatNotificationSettings#2e531ffe: field notification_settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatNotificationSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatNotificationSettings#2e531ffe as nil") - } - b.ObjStart() - b.PutID("setChatNotificationSettings") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("notification_settings") - if err := s.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatNotificationSettings#2e531ffe: field notification_settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatNotificationSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatNotificationSettings#2e531ffe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode setChatNotificationSettings#2e531ffe: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatNotificationSettings#2e531ffe: field chat_id: %w", err) - } - s.ChatID = value - case "notification_settings": - if err := s.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setChatNotificationSettings#2e531ffe: field notification_settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatNotificationSettingsRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetNotificationSettings returns value of NotificationSettings field. -func (s *SetChatNotificationSettingsRequest) GetNotificationSettings() (value ChatNotificationSettings) { - if s == nil { - return - } - return s.NotificationSettings -} - -// SetChatNotificationSettings invokes method setChatNotificationSettings#2e531ffe returning error if any. -func (c *Client) SetChatNotificationSettings(ctx context.Context, request *SetChatNotificationSettingsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_permissions_gen.go b/tdapi/tl_set_chat_permissions_gen.go deleted file mode 100644 index 5a44e4e0a..000000000 --- a/tdapi/tl_set_chat_permissions_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatPermissionsRequest represents TL type `setChatPermissions#7f7706fe`. -type SetChatPermissionsRequest struct { - // Chat identifier - ChatID int64 - // New non-administrator members permissions in the chat - Permissions ChatPermissions -} - -// SetChatPermissionsRequestTypeID is TL type id of SetChatPermissionsRequest. -const SetChatPermissionsRequestTypeID = 0x7f7706fe - -// Ensuring interfaces in compile-time for SetChatPermissionsRequest. -var ( - _ bin.Encoder = &SetChatPermissionsRequest{} - _ bin.Decoder = &SetChatPermissionsRequest{} - _ bin.BareEncoder = &SetChatPermissionsRequest{} - _ bin.BareDecoder = &SetChatPermissionsRequest{} -) - -func (s *SetChatPermissionsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Permissions.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatPermissionsRequest) String() string { - if s == nil { - return "SetChatPermissionsRequest(nil)" - } - type Alias SetChatPermissionsRequest - return fmt.Sprintf("SetChatPermissionsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatPermissionsRequest) TypeID() uint32 { - return SetChatPermissionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatPermissionsRequest) TypeName() string { - return "setChatPermissions" -} - -// TypeInfo returns info about TL type. -func (s *SetChatPermissionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatPermissions", - ID: SetChatPermissionsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Permissions", - SchemaName: "permissions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatPermissionsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatPermissions#7f7706fe as nil") - } - b.PutID(SetChatPermissionsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatPermissionsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatPermissions#7f7706fe as nil") - } - b.PutInt53(s.ChatID) - if err := s.Permissions.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatPermissions#7f7706fe: field permissions: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatPermissionsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatPermissions#7f7706fe to nil") - } - if err := b.ConsumeID(SetChatPermissionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatPermissions#7f7706fe: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatPermissionsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatPermissions#7f7706fe to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatPermissions#7f7706fe: field chat_id: %w", err) - } - s.ChatID = value - } - { - if err := s.Permissions.Decode(b); err != nil { - return fmt.Errorf("unable to decode setChatPermissions#7f7706fe: field permissions: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatPermissionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatPermissions#7f7706fe as nil") - } - b.ObjStart() - b.PutID("setChatPermissions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("permissions") - if err := s.Permissions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatPermissions#7f7706fe: field permissions: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatPermissionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatPermissions#7f7706fe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatPermissions"); err != nil { - return fmt.Errorf("unable to decode setChatPermissions#7f7706fe: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatPermissions#7f7706fe: field chat_id: %w", err) - } - s.ChatID = value - case "permissions": - if err := s.Permissions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setChatPermissions#7f7706fe: field permissions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatPermissionsRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetPermissions returns value of Permissions field. -func (s *SetChatPermissionsRequest) GetPermissions() (value ChatPermissions) { - if s == nil { - return - } - return s.Permissions -} - -// SetChatPermissions invokes method setChatPermissions#7f7706fe returning error if any. -func (c *Client) SetChatPermissions(ctx context.Context, request *SetChatPermissionsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_photo_gen.go b/tdapi/tl_set_chat_photo_gen.go deleted file mode 100644 index 87a1e9834..000000000 --- a/tdapi/tl_set_chat_photo_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatPhotoRequest represents TL type `setChatPhoto#e97b8d03`. -type SetChatPhotoRequest struct { - // Chat identifier - ChatID int64 - // New chat photo; pass null to delete the chat photo - Photo InputChatPhotoClass -} - -// SetChatPhotoRequestTypeID is TL type id of SetChatPhotoRequest. -const SetChatPhotoRequestTypeID = 0xe97b8d03 - -// Ensuring interfaces in compile-time for SetChatPhotoRequest. -var ( - _ bin.Encoder = &SetChatPhotoRequest{} - _ bin.Decoder = &SetChatPhotoRequest{} - _ bin.BareEncoder = &SetChatPhotoRequest{} - _ bin.BareDecoder = &SetChatPhotoRequest{} -) - -func (s *SetChatPhotoRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Photo == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatPhotoRequest) String() string { - if s == nil { - return "SetChatPhotoRequest(nil)" - } - type Alias SetChatPhotoRequest - return fmt.Sprintf("SetChatPhotoRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatPhotoRequest) TypeID() uint32 { - return SetChatPhotoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatPhotoRequest) TypeName() string { - return "setChatPhoto" -} - -// TypeInfo returns info about TL type. -func (s *SetChatPhotoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatPhoto", - ID: SetChatPhotoRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatPhotoRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatPhoto#e97b8d03 as nil") - } - b.PutID(SetChatPhotoRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatPhotoRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatPhoto#e97b8d03 as nil") - } - b.PutInt53(s.ChatID) - if s.Photo == nil { - return fmt.Errorf("unable to encode setChatPhoto#e97b8d03: field photo is nil") - } - if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode setChatPhoto#e97b8d03: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatPhotoRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatPhoto#e97b8d03 to nil") - } - if err := b.ConsumeID(SetChatPhotoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatPhoto#e97b8d03: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatPhotoRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatPhoto#e97b8d03 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatPhoto#e97b8d03: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := DecodeInputChatPhoto(b) - if err != nil { - return fmt.Errorf("unable to decode setChatPhoto#e97b8d03: field photo: %w", err) - } - s.Photo = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatPhotoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatPhoto#e97b8d03 as nil") - } - b.ObjStart() - b.PutID("setChatPhoto") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("photo") - if s.Photo == nil { - return fmt.Errorf("unable to encode setChatPhoto#e97b8d03: field photo is nil") - } - if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setChatPhoto#e97b8d03: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatPhotoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatPhoto#e97b8d03 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatPhoto"); err != nil { - return fmt.Errorf("unable to decode setChatPhoto#e97b8d03: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatPhoto#e97b8d03: field chat_id: %w", err) - } - s.ChatID = value - case "photo": - value, err := DecodeTDLibJSONInputChatPhoto(b) - if err != nil { - return fmt.Errorf("unable to decode setChatPhoto#e97b8d03: field photo: %w", err) - } - s.Photo = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatPhotoRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetPhoto returns value of Photo field. -func (s *SetChatPhotoRequest) GetPhoto() (value InputChatPhotoClass) { - if s == nil { - return - } - return s.Photo -} - -// SetChatPhoto invokes method setChatPhoto#e97b8d03 returning error if any. -func (c *Client) SetChatPhoto(ctx context.Context, request *SetChatPhotoRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_pinned_stories_gen.go b/tdapi/tl_set_chat_pinned_stories_gen.go deleted file mode 100644 index ae19b5313..000000000 --- a/tdapi/tl_set_chat_pinned_stories_gen.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatPinnedStoriesRequest represents TL type `setChatPinnedStories#f5cb679f`. -type SetChatPinnedStoriesRequest struct { - // Identifier of the chat that posted the stories - ChatID int64 - // New list of pinned stories. All stories must be posted to the chat page first. There - // can be up to getOption("pinned_story_count_max") pinned stories on a chat page - StoryIDs []int32 -} - -// SetChatPinnedStoriesRequestTypeID is TL type id of SetChatPinnedStoriesRequest. -const SetChatPinnedStoriesRequestTypeID = 0xf5cb679f - -// Ensuring interfaces in compile-time for SetChatPinnedStoriesRequest. -var ( - _ bin.Encoder = &SetChatPinnedStoriesRequest{} - _ bin.Decoder = &SetChatPinnedStoriesRequest{} - _ bin.BareEncoder = &SetChatPinnedStoriesRequest{} - _ bin.BareDecoder = &SetChatPinnedStoriesRequest{} -) - -func (s *SetChatPinnedStoriesRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.StoryIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatPinnedStoriesRequest) String() string { - if s == nil { - return "SetChatPinnedStoriesRequest(nil)" - } - type Alias SetChatPinnedStoriesRequest - return fmt.Sprintf("SetChatPinnedStoriesRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatPinnedStoriesRequest) TypeID() uint32 { - return SetChatPinnedStoriesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatPinnedStoriesRequest) TypeName() string { - return "setChatPinnedStories" -} - -// TypeInfo returns info about TL type. -func (s *SetChatPinnedStoriesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatPinnedStories", - ID: SetChatPinnedStoriesRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "StoryIDs", - SchemaName: "story_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatPinnedStoriesRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatPinnedStories#f5cb679f as nil") - } - b.PutID(SetChatPinnedStoriesRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatPinnedStoriesRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatPinnedStories#f5cb679f as nil") - } - b.PutInt53(s.ChatID) - b.PutInt(len(s.StoryIDs)) - for _, v := range s.StoryIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatPinnedStoriesRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatPinnedStories#f5cb679f to nil") - } - if err := b.ConsumeID(SetChatPinnedStoriesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatPinnedStoriesRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatPinnedStories#f5cb679f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: field chat_id: %w", err) - } - s.ChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: field story_ids: %w", err) - } - - if headerLen > 0 { - s.StoryIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: field story_ids: %w", err) - } - s.StoryIDs = append(s.StoryIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatPinnedStoriesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatPinnedStories#f5cb679f as nil") - } - b.ObjStart() - b.PutID("setChatPinnedStories") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("story_ids") - b.ArrStart() - for _, v := range s.StoryIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatPinnedStoriesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatPinnedStories#f5cb679f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatPinnedStories"); err != nil { - return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: field chat_id: %w", err) - } - s.ChatID = value - case "story_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: field story_ids: %w", err) - } - s.StoryIDs = append(s.StoryIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode setChatPinnedStories#f5cb679f: field story_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatPinnedStoriesRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetStoryIDs returns value of StoryIDs field. -func (s *SetChatPinnedStoriesRequest) GetStoryIDs() (value []int32) { - if s == nil { - return - } - return s.StoryIDs -} - -// SetChatPinnedStories invokes method setChatPinnedStories#f5cb679f returning error if any. -func (c *Client) SetChatPinnedStories(ctx context.Context, request *SetChatPinnedStoriesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_profile_accent_color_gen.go b/tdapi/tl_set_chat_profile_accent_color_gen.go deleted file mode 100644 index 153486d58..000000000 --- a/tdapi/tl_set_chat_profile_accent_color_gen.go +++ /dev/null @@ -1,274 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatProfileAccentColorRequest represents TL type `setChatProfileAccentColor#4227ae7a`. -type SetChatProfileAccentColorRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the accent color to use for profile; pass -1 if none. The chat must have - // at least profileAccentColor.min_supergroup_chat_boost_level for supergroups - ProfileAccentColorID int32 - // Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if - // none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check - // whether a custom emoji can be set - ProfileBackgroundCustomEmojiID int64 -} - -// SetChatProfileAccentColorRequestTypeID is TL type id of SetChatProfileAccentColorRequest. -const SetChatProfileAccentColorRequestTypeID = 0x4227ae7a - -// Ensuring interfaces in compile-time for SetChatProfileAccentColorRequest. -var ( - _ bin.Encoder = &SetChatProfileAccentColorRequest{} - _ bin.Decoder = &SetChatProfileAccentColorRequest{} - _ bin.BareEncoder = &SetChatProfileAccentColorRequest{} - _ bin.BareDecoder = &SetChatProfileAccentColorRequest{} -) - -func (s *SetChatProfileAccentColorRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.ProfileAccentColorID == 0) { - return false - } - if !(s.ProfileBackgroundCustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatProfileAccentColorRequest) String() string { - if s == nil { - return "SetChatProfileAccentColorRequest(nil)" - } - type Alias SetChatProfileAccentColorRequest - return fmt.Sprintf("SetChatProfileAccentColorRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatProfileAccentColorRequest) TypeID() uint32 { - return SetChatProfileAccentColorRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatProfileAccentColorRequest) TypeName() string { - return "setChatProfileAccentColor" -} - -// TypeInfo returns info about TL type. -func (s *SetChatProfileAccentColorRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatProfileAccentColor", - ID: SetChatProfileAccentColorRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ProfileAccentColorID", - SchemaName: "profile_accent_color_id", - }, - { - Name: "ProfileBackgroundCustomEmojiID", - SchemaName: "profile_background_custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatProfileAccentColorRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatProfileAccentColor#4227ae7a as nil") - } - b.PutID(SetChatProfileAccentColorRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatProfileAccentColorRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatProfileAccentColor#4227ae7a as nil") - } - b.PutInt53(s.ChatID) - b.PutInt32(s.ProfileAccentColorID) - b.PutLong(s.ProfileBackgroundCustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatProfileAccentColorRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatProfileAccentColor#4227ae7a to nil") - } - if err := b.ConsumeID(SetChatProfileAccentColorRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatProfileAccentColor#4227ae7a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatProfileAccentColorRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatProfileAccentColor#4227ae7a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatProfileAccentColor#4227ae7a: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatProfileAccentColor#4227ae7a: field profile_accent_color_id: %w", err) - } - s.ProfileAccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setChatProfileAccentColor#4227ae7a: field profile_background_custom_emoji_id: %w", err) - } - s.ProfileBackgroundCustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatProfileAccentColorRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatProfileAccentColor#4227ae7a as nil") - } - b.ObjStart() - b.PutID("setChatProfileAccentColor") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("profile_accent_color_id") - b.PutInt32(s.ProfileAccentColorID) - b.Comma() - b.FieldStart("profile_background_custom_emoji_id") - b.PutLong(s.ProfileBackgroundCustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatProfileAccentColorRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatProfileAccentColor#4227ae7a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatProfileAccentColor"); err != nil { - return fmt.Errorf("unable to decode setChatProfileAccentColor#4227ae7a: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatProfileAccentColor#4227ae7a: field chat_id: %w", err) - } - s.ChatID = value - case "profile_accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatProfileAccentColor#4227ae7a: field profile_accent_color_id: %w", err) - } - s.ProfileAccentColorID = value - case "profile_background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setChatProfileAccentColor#4227ae7a: field profile_background_custom_emoji_id: %w", err) - } - s.ProfileBackgroundCustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatProfileAccentColorRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetProfileAccentColorID returns value of ProfileAccentColorID field. -func (s *SetChatProfileAccentColorRequest) GetProfileAccentColorID() (value int32) { - if s == nil { - return - } - return s.ProfileAccentColorID -} - -// GetProfileBackgroundCustomEmojiID returns value of ProfileBackgroundCustomEmojiID field. -func (s *SetChatProfileAccentColorRequest) GetProfileBackgroundCustomEmojiID() (value int64) { - if s == nil { - return - } - return s.ProfileBackgroundCustomEmojiID -} - -// SetChatProfileAccentColor invokes method setChatProfileAccentColor#4227ae7a returning error if any. -func (c *Client) SetChatProfileAccentColor(ctx context.Context, request *SetChatProfileAccentColorRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_slow_mode_delay_gen.go b/tdapi/tl_set_chat_slow_mode_delay_gen.go deleted file mode 100644 index 305a66d09..000000000 --- a/tdapi/tl_set_chat_slow_mode_delay_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatSlowModeDelayRequest represents TL type `setChatSlowModeDelay#dfcae63e`. -type SetChatSlowModeDelayRequest struct { - // Chat identifier - ChatID int64 - // New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, - // 3600 - SlowModeDelay int32 -} - -// SetChatSlowModeDelayRequestTypeID is TL type id of SetChatSlowModeDelayRequest. -const SetChatSlowModeDelayRequestTypeID = 0xdfcae63e - -// Ensuring interfaces in compile-time for SetChatSlowModeDelayRequest. -var ( - _ bin.Encoder = &SetChatSlowModeDelayRequest{} - _ bin.Decoder = &SetChatSlowModeDelayRequest{} - _ bin.BareEncoder = &SetChatSlowModeDelayRequest{} - _ bin.BareDecoder = &SetChatSlowModeDelayRequest{} -) - -func (s *SetChatSlowModeDelayRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.SlowModeDelay == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatSlowModeDelayRequest) String() string { - if s == nil { - return "SetChatSlowModeDelayRequest(nil)" - } - type Alias SetChatSlowModeDelayRequest - return fmt.Sprintf("SetChatSlowModeDelayRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatSlowModeDelayRequest) TypeID() uint32 { - return SetChatSlowModeDelayRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatSlowModeDelayRequest) TypeName() string { - return "setChatSlowModeDelay" -} - -// TypeInfo returns info about TL type. -func (s *SetChatSlowModeDelayRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatSlowModeDelay", - ID: SetChatSlowModeDelayRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "SlowModeDelay", - SchemaName: "slow_mode_delay", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatSlowModeDelayRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatSlowModeDelay#dfcae63e as nil") - } - b.PutID(SetChatSlowModeDelayRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatSlowModeDelayRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatSlowModeDelay#dfcae63e as nil") - } - b.PutInt53(s.ChatID) - b.PutInt32(s.SlowModeDelay) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatSlowModeDelayRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatSlowModeDelay#dfcae63e to nil") - } - if err := b.ConsumeID(SetChatSlowModeDelayRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatSlowModeDelay#dfcae63e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatSlowModeDelayRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatSlowModeDelay#dfcae63e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatSlowModeDelay#dfcae63e: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatSlowModeDelay#dfcae63e: field slow_mode_delay: %w", err) - } - s.SlowModeDelay = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatSlowModeDelayRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatSlowModeDelay#dfcae63e as nil") - } - b.ObjStart() - b.PutID("setChatSlowModeDelay") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("slow_mode_delay") - b.PutInt32(s.SlowModeDelay) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatSlowModeDelayRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatSlowModeDelay#dfcae63e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatSlowModeDelay"); err != nil { - return fmt.Errorf("unable to decode setChatSlowModeDelay#dfcae63e: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatSlowModeDelay#dfcae63e: field chat_id: %w", err) - } - s.ChatID = value - case "slow_mode_delay": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setChatSlowModeDelay#dfcae63e: field slow_mode_delay: %w", err) - } - s.SlowModeDelay = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatSlowModeDelayRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetSlowModeDelay returns value of SlowModeDelay field. -func (s *SetChatSlowModeDelayRequest) GetSlowModeDelay() (value int32) { - if s == nil { - return - } - return s.SlowModeDelay -} - -// SetChatSlowModeDelay invokes method setChatSlowModeDelay#dfcae63e returning error if any. -func (c *Client) SetChatSlowModeDelay(ctx context.Context, request *SetChatSlowModeDelayRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_theme_gen.go b/tdapi/tl_set_chat_theme_gen.go deleted file mode 100644 index 94545a794..000000000 --- a/tdapi/tl_set_chat_theme_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatThemeRequest represents TL type `setChatTheme#8f090293`. -type SetChatThemeRequest struct { - // Chat identifier - ChatID int64 - // Name of the new chat theme; pass an empty string to return the default theme - ThemeName string -} - -// SetChatThemeRequestTypeID is TL type id of SetChatThemeRequest. -const SetChatThemeRequestTypeID = 0x8f090293 - -// Ensuring interfaces in compile-time for SetChatThemeRequest. -var ( - _ bin.Encoder = &SetChatThemeRequest{} - _ bin.Decoder = &SetChatThemeRequest{} - _ bin.BareEncoder = &SetChatThemeRequest{} - _ bin.BareDecoder = &SetChatThemeRequest{} -) - -func (s *SetChatThemeRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.ThemeName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatThemeRequest) String() string { - if s == nil { - return "SetChatThemeRequest(nil)" - } - type Alias SetChatThemeRequest - return fmt.Sprintf("SetChatThemeRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatThemeRequest) TypeID() uint32 { - return SetChatThemeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatThemeRequest) TypeName() string { - return "setChatTheme" -} - -// TypeInfo returns info about TL type. -func (s *SetChatThemeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatTheme", - ID: SetChatThemeRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ThemeName", - SchemaName: "theme_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatThemeRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatTheme#8f090293 as nil") - } - b.PutID(SetChatThemeRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatThemeRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatTheme#8f090293 as nil") - } - b.PutInt53(s.ChatID) - b.PutString(s.ThemeName) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatThemeRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatTheme#8f090293 to nil") - } - if err := b.ConsumeID(SetChatThemeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatTheme#8f090293: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatThemeRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatTheme#8f090293 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatTheme#8f090293: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setChatTheme#8f090293: field theme_name: %w", err) - } - s.ThemeName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatThemeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatTheme#8f090293 as nil") - } - b.ObjStart() - b.PutID("setChatTheme") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("theme_name") - b.PutString(s.ThemeName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatThemeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatTheme#8f090293 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatTheme"); err != nil { - return fmt.Errorf("unable to decode setChatTheme#8f090293: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatTheme#8f090293: field chat_id: %w", err) - } - s.ChatID = value - case "theme_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setChatTheme#8f090293: field theme_name: %w", err) - } - s.ThemeName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatThemeRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetThemeName returns value of ThemeName field. -func (s *SetChatThemeRequest) GetThemeName() (value string) { - if s == nil { - return - } - return s.ThemeName -} - -// SetChatTheme invokes method setChatTheme#8f090293 returning error if any. -func (c *Client) SetChatTheme(ctx context.Context, request *SetChatThemeRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_chat_title_gen.go b/tdapi/tl_set_chat_title_gen.go deleted file mode 100644 index 77b9ec9ee..000000000 --- a/tdapi/tl_set_chat_title_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetChatTitleRequest represents TL type `setChatTitle#9cabebf`. -type SetChatTitleRequest struct { - // Chat identifier - ChatID int64 - // New title of the chat; 1-128 characters - Title string -} - -// SetChatTitleRequestTypeID is TL type id of SetChatTitleRequest. -const SetChatTitleRequestTypeID = 0x9cabebf - -// Ensuring interfaces in compile-time for SetChatTitleRequest. -var ( - _ bin.Encoder = &SetChatTitleRequest{} - _ bin.Decoder = &SetChatTitleRequest{} - _ bin.BareEncoder = &SetChatTitleRequest{} - _ bin.BareDecoder = &SetChatTitleRequest{} -) - -func (s *SetChatTitleRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetChatTitleRequest) String() string { - if s == nil { - return "SetChatTitleRequest(nil)" - } - type Alias SetChatTitleRequest - return fmt.Sprintf("SetChatTitleRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetChatTitleRequest) TypeID() uint32 { - return SetChatTitleRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetChatTitleRequest) TypeName() string { - return "setChatTitle" -} - -// TypeInfo returns info about TL type. -func (s *SetChatTitleRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setChatTitle", - ID: SetChatTitleRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetChatTitleRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatTitle#9cabebf as nil") - } - b.PutID(SetChatTitleRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetChatTitleRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setChatTitle#9cabebf as nil") - } - b.PutInt53(s.ChatID) - b.PutString(s.Title) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetChatTitleRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatTitle#9cabebf to nil") - } - if err := b.ConsumeID(SetChatTitleRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setChatTitle#9cabebf: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetChatTitleRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setChatTitle#9cabebf to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatTitle#9cabebf: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setChatTitle#9cabebf: field title: %w", err) - } - s.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetChatTitleRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setChatTitle#9cabebf as nil") - } - b.ObjStart() - b.PutID("setChatTitle") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("title") - b.PutString(s.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetChatTitleRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setChatTitle#9cabebf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setChatTitle"); err != nil { - return fmt.Errorf("unable to decode setChatTitle#9cabebf: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setChatTitle#9cabebf: field chat_id: %w", err) - } - s.ChatID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setChatTitle#9cabebf: field title: %w", err) - } - s.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetChatTitleRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetTitle returns value of Title field. -func (s *SetChatTitleRequest) GetTitle() (value string) { - if s == nil { - return - } - return s.Title -} - -// SetChatTitle invokes method setChatTitle#9cabebf returning error if any. -func (c *Client) SetChatTitle(ctx context.Context, request *SetChatTitleRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_close_friends_gen.go b/tdapi/tl_set_close_friends_gen.go deleted file mode 100644 index 7c72a75c1..000000000 --- a/tdapi/tl_set_close_friends_gen.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetCloseFriendsRequest represents TL type `setCloseFriends#7ff8f69f`. -type SetCloseFriendsRequest struct { - // User identifiers of close friends; the users must be contacts of the current user - UserIDs []int64 -} - -// SetCloseFriendsRequestTypeID is TL type id of SetCloseFriendsRequest. -const SetCloseFriendsRequestTypeID = 0x7ff8f69f - -// Ensuring interfaces in compile-time for SetCloseFriendsRequest. -var ( - _ bin.Encoder = &SetCloseFriendsRequest{} - _ bin.Decoder = &SetCloseFriendsRequest{} - _ bin.BareEncoder = &SetCloseFriendsRequest{} - _ bin.BareDecoder = &SetCloseFriendsRequest{} -) - -func (s *SetCloseFriendsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.UserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetCloseFriendsRequest) String() string { - if s == nil { - return "SetCloseFriendsRequest(nil)" - } - type Alias SetCloseFriendsRequest - return fmt.Sprintf("SetCloseFriendsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetCloseFriendsRequest) TypeID() uint32 { - return SetCloseFriendsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetCloseFriendsRequest) TypeName() string { - return "setCloseFriends" -} - -// TypeInfo returns info about TL type. -func (s *SetCloseFriendsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setCloseFriends", - ID: SetCloseFriendsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetCloseFriendsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setCloseFriends#7ff8f69f as nil") - } - b.PutID(SetCloseFriendsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetCloseFriendsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setCloseFriends#7ff8f69f as nil") - } - b.PutInt(len(s.UserIDs)) - for _, v := range s.UserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetCloseFriendsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setCloseFriends#7ff8f69f to nil") - } - if err := b.ConsumeID(SetCloseFriendsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setCloseFriends#7ff8f69f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetCloseFriendsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setCloseFriends#7ff8f69f to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode setCloseFriends#7ff8f69f: field user_ids: %w", err) - } - - if headerLen > 0 { - s.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setCloseFriends#7ff8f69f: field user_ids: %w", err) - } - s.UserIDs = append(s.UserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetCloseFriendsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setCloseFriends#7ff8f69f as nil") - } - b.ObjStart() - b.PutID("setCloseFriends") - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range s.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetCloseFriendsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setCloseFriends#7ff8f69f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setCloseFriends"); err != nil { - return fmt.Errorf("unable to decode setCloseFriends#7ff8f69f: %w", err) - } - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setCloseFriends#7ff8f69f: field user_ids: %w", err) - } - s.UserIDs = append(s.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode setCloseFriends#7ff8f69f: field user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserIDs returns value of UserIDs field. -func (s *SetCloseFriendsRequest) GetUserIDs() (value []int64) { - if s == nil { - return - } - return s.UserIDs -} - -// SetCloseFriends invokes method setCloseFriends#7ff8f69f returning error if any. -func (c *Client) SetCloseFriends(ctx context.Context, userids []int64) error { - var ok Ok - - request := &SetCloseFriendsRequest{ - UserIDs: userids, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_commands_gen.go b/tdapi/tl_set_commands_gen.go deleted file mode 100644 index 64fe6ac09..000000000 --- a/tdapi/tl_set_commands_gen.go +++ /dev/null @@ -1,311 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetCommandsRequest represents TL type `setCommands#b0e0217a`. -type SetCommandsRequest struct { - // The scope to which the commands are relevant; pass null to change commands in the - // default bot command scope - Scope BotCommandScopeClass - // A two-letter ISO 639-1 language code. If empty, the commands will be applied to all - // users from the given scope, for which language there are no dedicated commands - LanguageCode string - // List of the bot's commands - Commands []BotCommand -} - -// SetCommandsRequestTypeID is TL type id of SetCommandsRequest. -const SetCommandsRequestTypeID = 0xb0e0217a - -// Ensuring interfaces in compile-time for SetCommandsRequest. -var ( - _ bin.Encoder = &SetCommandsRequest{} - _ bin.Decoder = &SetCommandsRequest{} - _ bin.BareEncoder = &SetCommandsRequest{} - _ bin.BareDecoder = &SetCommandsRequest{} -) - -func (s *SetCommandsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Scope == nil) { - return false - } - if !(s.LanguageCode == "") { - return false - } - if !(s.Commands == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetCommandsRequest) String() string { - if s == nil { - return "SetCommandsRequest(nil)" - } - type Alias SetCommandsRequest - return fmt.Sprintf("SetCommandsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetCommandsRequest) TypeID() uint32 { - return SetCommandsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetCommandsRequest) TypeName() string { - return "setCommands" -} - -// TypeInfo returns info about TL type. -func (s *SetCommandsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setCommands", - ID: SetCommandsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Scope", - SchemaName: "scope", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - { - Name: "Commands", - SchemaName: "commands", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetCommandsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setCommands#b0e0217a as nil") - } - b.PutID(SetCommandsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetCommandsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setCommands#b0e0217a as nil") - } - if s.Scope == nil { - return fmt.Errorf("unable to encode setCommands#b0e0217a: field scope is nil") - } - if err := s.Scope.Encode(b); err != nil { - return fmt.Errorf("unable to encode setCommands#b0e0217a: field scope: %w", err) - } - b.PutString(s.LanguageCode) - b.PutInt(len(s.Commands)) - for idx, v := range s.Commands { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare setCommands#b0e0217a: field commands element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetCommandsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setCommands#b0e0217a to nil") - } - if err := b.ConsumeID(SetCommandsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setCommands#b0e0217a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetCommandsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setCommands#b0e0217a to nil") - } - { - value, err := DecodeBotCommandScope(b) - if err != nil { - return fmt.Errorf("unable to decode setCommands#b0e0217a: field scope: %w", err) - } - s.Scope = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setCommands#b0e0217a: field language_code: %w", err) - } - s.LanguageCode = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode setCommands#b0e0217a: field commands: %w", err) - } - - if headerLen > 0 { - s.Commands = make([]BotCommand, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BotCommand - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare setCommands#b0e0217a: field commands: %w", err) - } - s.Commands = append(s.Commands, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetCommandsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setCommands#b0e0217a as nil") - } - b.ObjStart() - b.PutID("setCommands") - b.Comma() - b.FieldStart("scope") - if s.Scope == nil { - return fmt.Errorf("unable to encode setCommands#b0e0217a: field scope is nil") - } - if err := s.Scope.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setCommands#b0e0217a: field scope: %w", err) - } - b.Comma() - b.FieldStart("language_code") - b.PutString(s.LanguageCode) - b.Comma() - b.FieldStart("commands") - b.ArrStart() - for idx, v := range s.Commands { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setCommands#b0e0217a: field commands element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetCommandsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setCommands#b0e0217a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setCommands"); err != nil { - return fmt.Errorf("unable to decode setCommands#b0e0217a: %w", err) - } - case "scope": - value, err := DecodeTDLibJSONBotCommandScope(b) - if err != nil { - return fmt.Errorf("unable to decode setCommands#b0e0217a: field scope: %w", err) - } - s.Scope = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setCommands#b0e0217a: field language_code: %w", err) - } - s.LanguageCode = value - case "commands": - if err := b.Arr(func(b tdjson.Decoder) error { - var value BotCommand - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setCommands#b0e0217a: field commands: %w", err) - } - s.Commands = append(s.Commands, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode setCommands#b0e0217a: field commands: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetScope returns value of Scope field. -func (s *SetCommandsRequest) GetScope() (value BotCommandScopeClass) { - if s == nil { - return - } - return s.Scope -} - -// GetLanguageCode returns value of LanguageCode field. -func (s *SetCommandsRequest) GetLanguageCode() (value string) { - if s == nil { - return - } - return s.LanguageCode -} - -// GetCommands returns value of Commands field. -func (s *SetCommandsRequest) GetCommands() (value []BotCommand) { - if s == nil { - return - } - return s.Commands -} - -// SetCommands invokes method setCommands#b0e0217a returning error if any. -func (c *Client) SetCommands(ctx context.Context, request *SetCommandsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_custom_emoji_sticker_set_thumbnail_gen.go b/tdapi/tl_set_custom_emoji_sticker_set_thumbnail_gen.go deleted file mode 100644 index eba3bfab2..000000000 --- a/tdapi/tl_set_custom_emoji_sticker_set_thumbnail_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetCustomEmojiStickerSetThumbnailRequest represents TL type `setCustomEmojiStickerSetThumbnail#bd12e0ea`. -type SetCustomEmojiStickerSetThumbnailRequest struct { - // Sticker set name. The sticker set must be owned by the current user - Name string - // Identifier of the custom emoji from the sticker set, which will be set as sticker set - // thumbnail; pass 0 to remove the sticker set thumbnail - CustomEmojiID int64 -} - -// SetCustomEmojiStickerSetThumbnailRequestTypeID is TL type id of SetCustomEmojiStickerSetThumbnailRequest. -const SetCustomEmojiStickerSetThumbnailRequestTypeID = 0xbd12e0ea - -// Ensuring interfaces in compile-time for SetCustomEmojiStickerSetThumbnailRequest. -var ( - _ bin.Encoder = &SetCustomEmojiStickerSetThumbnailRequest{} - _ bin.Decoder = &SetCustomEmojiStickerSetThumbnailRequest{} - _ bin.BareEncoder = &SetCustomEmojiStickerSetThumbnailRequest{} - _ bin.BareDecoder = &SetCustomEmojiStickerSetThumbnailRequest{} -) - -func (s *SetCustomEmojiStickerSetThumbnailRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Name == "") { - return false - } - if !(s.CustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetCustomEmojiStickerSetThumbnailRequest) String() string { - if s == nil { - return "SetCustomEmojiStickerSetThumbnailRequest(nil)" - } - type Alias SetCustomEmojiStickerSetThumbnailRequest - return fmt.Sprintf("SetCustomEmojiStickerSetThumbnailRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetCustomEmojiStickerSetThumbnailRequest) TypeID() uint32 { - return SetCustomEmojiStickerSetThumbnailRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetCustomEmojiStickerSetThumbnailRequest) TypeName() string { - return "setCustomEmojiStickerSetThumbnail" -} - -// TypeInfo returns info about TL type. -func (s *SetCustomEmojiStickerSetThumbnailRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setCustomEmojiStickerSetThumbnail", - ID: SetCustomEmojiStickerSetThumbnailRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "CustomEmojiID", - SchemaName: "custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetCustomEmojiStickerSetThumbnailRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setCustomEmojiStickerSetThumbnail#bd12e0ea as nil") - } - b.PutID(SetCustomEmojiStickerSetThumbnailRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetCustomEmojiStickerSetThumbnailRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setCustomEmojiStickerSetThumbnail#bd12e0ea as nil") - } - b.PutString(s.Name) - b.PutLong(s.CustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetCustomEmojiStickerSetThumbnailRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setCustomEmojiStickerSetThumbnail#bd12e0ea to nil") - } - if err := b.ConsumeID(SetCustomEmojiStickerSetThumbnailRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setCustomEmojiStickerSetThumbnail#bd12e0ea: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetCustomEmojiStickerSetThumbnailRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setCustomEmojiStickerSetThumbnail#bd12e0ea to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setCustomEmojiStickerSetThumbnail#bd12e0ea: field name: %w", err) - } - s.Name = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setCustomEmojiStickerSetThumbnail#bd12e0ea: field custom_emoji_id: %w", err) - } - s.CustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetCustomEmojiStickerSetThumbnailRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setCustomEmojiStickerSetThumbnail#bd12e0ea as nil") - } - b.ObjStart() - b.PutID("setCustomEmojiStickerSetThumbnail") - b.Comma() - b.FieldStart("name") - b.PutString(s.Name) - b.Comma() - b.FieldStart("custom_emoji_id") - b.PutLong(s.CustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetCustomEmojiStickerSetThumbnailRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setCustomEmojiStickerSetThumbnail#bd12e0ea to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setCustomEmojiStickerSetThumbnail"); err != nil { - return fmt.Errorf("unable to decode setCustomEmojiStickerSetThumbnail#bd12e0ea: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setCustomEmojiStickerSetThumbnail#bd12e0ea: field name: %w", err) - } - s.Name = value - case "custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setCustomEmojiStickerSetThumbnail#bd12e0ea: field custom_emoji_id: %w", err) - } - s.CustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (s *SetCustomEmojiStickerSetThumbnailRequest) GetName() (value string) { - if s == nil { - return - } - return s.Name -} - -// GetCustomEmojiID returns value of CustomEmojiID field. -func (s *SetCustomEmojiStickerSetThumbnailRequest) GetCustomEmojiID() (value int64) { - if s == nil { - return - } - return s.CustomEmojiID -} - -// SetCustomEmojiStickerSetThumbnail invokes method setCustomEmojiStickerSetThumbnail#bd12e0ea returning error if any. -func (c *Client) SetCustomEmojiStickerSetThumbnail(ctx context.Context, request *SetCustomEmojiStickerSetThumbnailRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_custom_language_pack_gen.go b/tdapi/tl_set_custom_language_pack_gen.go deleted file mode 100644 index 48cfb6b20..000000000 --- a/tdapi/tl_set_custom_language_pack_gen.go +++ /dev/null @@ -1,267 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetCustomLanguagePackRequest represents TL type `setCustomLanguagePack#234b0607`. -type SetCustomLanguagePackRequest struct { - // Information about the language pack. Language pack identifier must start with 'X', - // consist only of English letters, digits and hyphens, and must not exceed 64 characters - // Can be called before authorization - Info LanguagePackInfo - // Strings of the new language pack - Strings []LanguagePackString -} - -// SetCustomLanguagePackRequestTypeID is TL type id of SetCustomLanguagePackRequest. -const SetCustomLanguagePackRequestTypeID = 0x234b0607 - -// Ensuring interfaces in compile-time for SetCustomLanguagePackRequest. -var ( - _ bin.Encoder = &SetCustomLanguagePackRequest{} - _ bin.Decoder = &SetCustomLanguagePackRequest{} - _ bin.BareEncoder = &SetCustomLanguagePackRequest{} - _ bin.BareDecoder = &SetCustomLanguagePackRequest{} -) - -func (s *SetCustomLanguagePackRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Info.Zero()) { - return false - } - if !(s.Strings == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetCustomLanguagePackRequest) String() string { - if s == nil { - return "SetCustomLanguagePackRequest(nil)" - } - type Alias SetCustomLanguagePackRequest - return fmt.Sprintf("SetCustomLanguagePackRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetCustomLanguagePackRequest) TypeID() uint32 { - return SetCustomLanguagePackRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetCustomLanguagePackRequest) TypeName() string { - return "setCustomLanguagePack" -} - -// TypeInfo returns info about TL type. -func (s *SetCustomLanguagePackRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setCustomLanguagePack", - ID: SetCustomLanguagePackRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Info", - SchemaName: "info", - }, - { - Name: "Strings", - SchemaName: "strings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetCustomLanguagePackRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setCustomLanguagePack#234b0607 as nil") - } - b.PutID(SetCustomLanguagePackRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetCustomLanguagePackRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setCustomLanguagePack#234b0607 as nil") - } - if err := s.Info.Encode(b); err != nil { - return fmt.Errorf("unable to encode setCustomLanguagePack#234b0607: field info: %w", err) - } - b.PutInt(len(s.Strings)) - for idx, v := range s.Strings { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare setCustomLanguagePack#234b0607: field strings element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetCustomLanguagePackRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setCustomLanguagePack#234b0607 to nil") - } - if err := b.ConsumeID(SetCustomLanguagePackRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePack#234b0607: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetCustomLanguagePackRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setCustomLanguagePack#234b0607 to nil") - } - { - if err := s.Info.Decode(b); err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePack#234b0607: field info: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePack#234b0607: field strings: %w", err) - } - - if headerLen > 0 { - s.Strings = make([]LanguagePackString, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value LanguagePackString - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare setCustomLanguagePack#234b0607: field strings: %w", err) - } - s.Strings = append(s.Strings, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetCustomLanguagePackRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setCustomLanguagePack#234b0607 as nil") - } - b.ObjStart() - b.PutID("setCustomLanguagePack") - b.Comma() - b.FieldStart("info") - if err := s.Info.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setCustomLanguagePack#234b0607: field info: %w", err) - } - b.Comma() - b.FieldStart("strings") - b.ArrStart() - for idx, v := range s.Strings { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setCustomLanguagePack#234b0607: field strings element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetCustomLanguagePackRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setCustomLanguagePack#234b0607 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setCustomLanguagePack"); err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePack#234b0607: %w", err) - } - case "info": - if err := s.Info.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePack#234b0607: field info: %w", err) - } - case "strings": - if err := b.Arr(func(b tdjson.Decoder) error { - var value LanguagePackString - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePack#234b0607: field strings: %w", err) - } - s.Strings = append(s.Strings, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePack#234b0607: field strings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInfo returns value of Info field. -func (s *SetCustomLanguagePackRequest) GetInfo() (value LanguagePackInfo) { - if s == nil { - return - } - return s.Info -} - -// GetStrings returns value of Strings field. -func (s *SetCustomLanguagePackRequest) GetStrings() (value []LanguagePackString) { - if s == nil { - return - } - return s.Strings -} - -// SetCustomLanguagePack invokes method setCustomLanguagePack#234b0607 returning error if any. -func (c *Client) SetCustomLanguagePack(ctx context.Context, request *SetCustomLanguagePackRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_custom_language_pack_string_gen.go b/tdapi/tl_set_custom_language_pack_string_gen.go deleted file mode 100644 index 15ad0fce9..000000000 --- a/tdapi/tl_set_custom_language_pack_string_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetCustomLanguagePackStringRequest represents TL type `setCustomLanguagePackString#4e762518`. -type SetCustomLanguagePackStringRequest struct { - // Identifier of a previously added custom local language pack in the current - // localization target - LanguagePackID string - // New language pack string - NewString LanguagePackString -} - -// SetCustomLanguagePackStringRequestTypeID is TL type id of SetCustomLanguagePackStringRequest. -const SetCustomLanguagePackStringRequestTypeID = 0x4e762518 - -// Ensuring interfaces in compile-time for SetCustomLanguagePackStringRequest. -var ( - _ bin.Encoder = &SetCustomLanguagePackStringRequest{} - _ bin.Decoder = &SetCustomLanguagePackStringRequest{} - _ bin.BareEncoder = &SetCustomLanguagePackStringRequest{} - _ bin.BareDecoder = &SetCustomLanguagePackStringRequest{} -) - -func (s *SetCustomLanguagePackStringRequest) Zero() bool { - if s == nil { - return true - } - if !(s.LanguagePackID == "") { - return false - } - if !(s.NewString.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetCustomLanguagePackStringRequest) String() string { - if s == nil { - return "SetCustomLanguagePackStringRequest(nil)" - } - type Alias SetCustomLanguagePackStringRequest - return fmt.Sprintf("SetCustomLanguagePackStringRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetCustomLanguagePackStringRequest) TypeID() uint32 { - return SetCustomLanguagePackStringRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetCustomLanguagePackStringRequest) TypeName() string { - return "setCustomLanguagePackString" -} - -// TypeInfo returns info about TL type. -func (s *SetCustomLanguagePackStringRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setCustomLanguagePackString", - ID: SetCustomLanguagePackStringRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LanguagePackID", - SchemaName: "language_pack_id", - }, - { - Name: "NewString", - SchemaName: "new_string", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetCustomLanguagePackStringRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setCustomLanguagePackString#4e762518 as nil") - } - b.PutID(SetCustomLanguagePackStringRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetCustomLanguagePackStringRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setCustomLanguagePackString#4e762518 as nil") - } - b.PutString(s.LanguagePackID) - if err := s.NewString.Encode(b); err != nil { - return fmt.Errorf("unable to encode setCustomLanguagePackString#4e762518: field new_string: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetCustomLanguagePackStringRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setCustomLanguagePackString#4e762518 to nil") - } - if err := b.ConsumeID(SetCustomLanguagePackStringRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePackString#4e762518: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetCustomLanguagePackStringRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setCustomLanguagePackString#4e762518 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePackString#4e762518: field language_pack_id: %w", err) - } - s.LanguagePackID = value - } - { - if err := s.NewString.Decode(b); err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePackString#4e762518: field new_string: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetCustomLanguagePackStringRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setCustomLanguagePackString#4e762518 as nil") - } - b.ObjStart() - b.PutID("setCustomLanguagePackString") - b.Comma() - b.FieldStart("language_pack_id") - b.PutString(s.LanguagePackID) - b.Comma() - b.FieldStart("new_string") - if err := s.NewString.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setCustomLanguagePackString#4e762518: field new_string: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetCustomLanguagePackStringRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setCustomLanguagePackString#4e762518 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setCustomLanguagePackString"); err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePackString#4e762518: %w", err) - } - case "language_pack_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePackString#4e762518: field language_pack_id: %w", err) - } - s.LanguagePackID = value - case "new_string": - if err := s.NewString.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setCustomLanguagePackString#4e762518: field new_string: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguagePackID returns value of LanguagePackID field. -func (s *SetCustomLanguagePackStringRequest) GetLanguagePackID() (value string) { - if s == nil { - return - } - return s.LanguagePackID -} - -// GetNewString returns value of NewString field. -func (s *SetCustomLanguagePackStringRequest) GetNewString() (value LanguagePackString) { - if s == nil { - return - } - return s.NewString -} - -// SetCustomLanguagePackString invokes method setCustomLanguagePackString#4e762518 returning error if any. -func (c *Client) SetCustomLanguagePackString(ctx context.Context, request *SetCustomLanguagePackStringRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_database_encryption_key_gen.go b/tdapi/tl_set_database_encryption_key_gen.go deleted file mode 100644 index 083c51f03..000000000 --- a/tdapi/tl_set_database_encryption_key_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetDatabaseEncryptionKeyRequest represents TL type `setDatabaseEncryptionKey#b83345b5`. -type SetDatabaseEncryptionKeyRequest struct { - // New encryption key - NewEncryptionKey []byte -} - -// SetDatabaseEncryptionKeyRequestTypeID is TL type id of SetDatabaseEncryptionKeyRequest. -const SetDatabaseEncryptionKeyRequestTypeID = 0xb83345b5 - -// Ensuring interfaces in compile-time for SetDatabaseEncryptionKeyRequest. -var ( - _ bin.Encoder = &SetDatabaseEncryptionKeyRequest{} - _ bin.Decoder = &SetDatabaseEncryptionKeyRequest{} - _ bin.BareEncoder = &SetDatabaseEncryptionKeyRequest{} - _ bin.BareDecoder = &SetDatabaseEncryptionKeyRequest{} -) - -func (s *SetDatabaseEncryptionKeyRequest) Zero() bool { - if s == nil { - return true - } - if !(s.NewEncryptionKey == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetDatabaseEncryptionKeyRequest) String() string { - if s == nil { - return "SetDatabaseEncryptionKeyRequest(nil)" - } - type Alias SetDatabaseEncryptionKeyRequest - return fmt.Sprintf("SetDatabaseEncryptionKeyRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetDatabaseEncryptionKeyRequest) TypeID() uint32 { - return SetDatabaseEncryptionKeyRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetDatabaseEncryptionKeyRequest) TypeName() string { - return "setDatabaseEncryptionKey" -} - -// TypeInfo returns info about TL type. -func (s *SetDatabaseEncryptionKeyRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setDatabaseEncryptionKey", - ID: SetDatabaseEncryptionKeyRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NewEncryptionKey", - SchemaName: "new_encryption_key", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetDatabaseEncryptionKeyRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDatabaseEncryptionKey#b83345b5 as nil") - } - b.PutID(SetDatabaseEncryptionKeyRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetDatabaseEncryptionKeyRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDatabaseEncryptionKey#b83345b5 as nil") - } - b.PutBytes(s.NewEncryptionKey) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetDatabaseEncryptionKeyRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDatabaseEncryptionKey#b83345b5 to nil") - } - if err := b.ConsumeID(SetDatabaseEncryptionKeyRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setDatabaseEncryptionKey#b83345b5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetDatabaseEncryptionKeyRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDatabaseEncryptionKey#b83345b5 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode setDatabaseEncryptionKey#b83345b5: field new_encryption_key: %w", err) - } - s.NewEncryptionKey = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetDatabaseEncryptionKeyRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setDatabaseEncryptionKey#b83345b5 as nil") - } - b.ObjStart() - b.PutID("setDatabaseEncryptionKey") - b.Comma() - b.FieldStart("new_encryption_key") - b.PutBytes(s.NewEncryptionKey) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetDatabaseEncryptionKeyRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setDatabaseEncryptionKey#b83345b5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setDatabaseEncryptionKey"); err != nil { - return fmt.Errorf("unable to decode setDatabaseEncryptionKey#b83345b5: %w", err) - } - case "new_encryption_key": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode setDatabaseEncryptionKey#b83345b5: field new_encryption_key: %w", err) - } - s.NewEncryptionKey = value - default: - return b.Skip() - } - return nil - }) -} - -// GetNewEncryptionKey returns value of NewEncryptionKey field. -func (s *SetDatabaseEncryptionKeyRequest) GetNewEncryptionKey() (value []byte) { - if s == nil { - return - } - return s.NewEncryptionKey -} - -// SetDatabaseEncryptionKey invokes method setDatabaseEncryptionKey#b83345b5 returning error if any. -func (c *Client) SetDatabaseEncryptionKey(ctx context.Context, newencryptionkey []byte) error { - var ok Ok - - request := &SetDatabaseEncryptionKeyRequest{ - NewEncryptionKey: newencryptionkey, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_default_background_gen.go b/tdapi/tl_set_default_background_gen.go deleted file mode 100644 index 57a485300..000000000 --- a/tdapi/tl_set_default_background_gen.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetDefaultBackgroundRequest represents TL type `setDefaultBackground#89d1a8a1`. -type SetDefaultBackgroundRequest struct { - // The input background to use; pass null to create a new filled background - Background InputBackgroundClass - // Background type; pass null to use the default type of the remote background; - // backgroundTypeChatTheme isn't supported - Type BackgroundTypeClass - // Pass true if the background is set for a dark theme - ForDarkTheme bool -} - -// SetDefaultBackgroundRequestTypeID is TL type id of SetDefaultBackgroundRequest. -const SetDefaultBackgroundRequestTypeID = 0x89d1a8a1 - -// Ensuring interfaces in compile-time for SetDefaultBackgroundRequest. -var ( - _ bin.Encoder = &SetDefaultBackgroundRequest{} - _ bin.Decoder = &SetDefaultBackgroundRequest{} - _ bin.BareEncoder = &SetDefaultBackgroundRequest{} - _ bin.BareDecoder = &SetDefaultBackgroundRequest{} -) - -func (s *SetDefaultBackgroundRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Background == nil) { - return false - } - if !(s.Type == nil) { - return false - } - if !(s.ForDarkTheme == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetDefaultBackgroundRequest) String() string { - if s == nil { - return "SetDefaultBackgroundRequest(nil)" - } - type Alias SetDefaultBackgroundRequest - return fmt.Sprintf("SetDefaultBackgroundRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetDefaultBackgroundRequest) TypeID() uint32 { - return SetDefaultBackgroundRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetDefaultBackgroundRequest) TypeName() string { - return "setDefaultBackground" -} - -// TypeInfo returns info about TL type. -func (s *SetDefaultBackgroundRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setDefaultBackground", - ID: SetDefaultBackgroundRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Background", - SchemaName: "background", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "ForDarkTheme", - SchemaName: "for_dark_theme", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetDefaultBackgroundRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultBackground#89d1a8a1 as nil") - } - b.PutID(SetDefaultBackgroundRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetDefaultBackgroundRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultBackground#89d1a8a1 as nil") - } - if s.Background == nil { - return fmt.Errorf("unable to encode setDefaultBackground#89d1a8a1: field background is nil") - } - if err := s.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode setDefaultBackground#89d1a8a1: field background: %w", err) - } - if s.Type == nil { - return fmt.Errorf("unable to encode setDefaultBackground#89d1a8a1: field type is nil") - } - if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode setDefaultBackground#89d1a8a1: field type: %w", err) - } - b.PutBool(s.ForDarkTheme) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetDefaultBackgroundRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultBackground#89d1a8a1 to nil") - } - if err := b.ConsumeID(SetDefaultBackgroundRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setDefaultBackground#89d1a8a1: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetDefaultBackgroundRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultBackground#89d1a8a1 to nil") - } - { - value, err := DecodeInputBackground(b) - if err != nil { - return fmt.Errorf("unable to decode setDefaultBackground#89d1a8a1: field background: %w", err) - } - s.Background = value - } - { - value, err := DecodeBackgroundType(b) - if err != nil { - return fmt.Errorf("unable to decode setDefaultBackground#89d1a8a1: field type: %w", err) - } - s.Type = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setDefaultBackground#89d1a8a1: field for_dark_theme: %w", err) - } - s.ForDarkTheme = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetDefaultBackgroundRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultBackground#89d1a8a1 as nil") - } - b.ObjStart() - b.PutID("setDefaultBackground") - b.Comma() - b.FieldStart("background") - if s.Background == nil { - return fmt.Errorf("unable to encode setDefaultBackground#89d1a8a1: field background is nil") - } - if err := s.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setDefaultBackground#89d1a8a1: field background: %w", err) - } - b.Comma() - b.FieldStart("type") - if s.Type == nil { - return fmt.Errorf("unable to encode setDefaultBackground#89d1a8a1: field type is nil") - } - if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setDefaultBackground#89d1a8a1: field type: %w", err) - } - b.Comma() - b.FieldStart("for_dark_theme") - b.PutBool(s.ForDarkTheme) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetDefaultBackgroundRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultBackground#89d1a8a1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setDefaultBackground"); err != nil { - return fmt.Errorf("unable to decode setDefaultBackground#89d1a8a1: %w", err) - } - case "background": - value, err := DecodeTDLibJSONInputBackground(b) - if err != nil { - return fmt.Errorf("unable to decode setDefaultBackground#89d1a8a1: field background: %w", err) - } - s.Background = value - case "type": - value, err := DecodeTDLibJSONBackgroundType(b) - if err != nil { - return fmt.Errorf("unable to decode setDefaultBackground#89d1a8a1: field type: %w", err) - } - s.Type = value - case "for_dark_theme": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setDefaultBackground#89d1a8a1: field for_dark_theme: %w", err) - } - s.ForDarkTheme = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBackground returns value of Background field. -func (s *SetDefaultBackgroundRequest) GetBackground() (value InputBackgroundClass) { - if s == nil { - return - } - return s.Background -} - -// GetType returns value of Type field. -func (s *SetDefaultBackgroundRequest) GetType() (value BackgroundTypeClass) { - if s == nil { - return - } - return s.Type -} - -// GetForDarkTheme returns value of ForDarkTheme field. -func (s *SetDefaultBackgroundRequest) GetForDarkTheme() (value bool) { - if s == nil { - return - } - return s.ForDarkTheme -} - -// SetDefaultBackground invokes method setDefaultBackground#89d1a8a1 returning error if any. -func (c *Client) SetDefaultBackground(ctx context.Context, request *SetDefaultBackgroundRequest) (*Background, error) { - var result Background - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_set_default_channel_administrator_rights_gen.go b/tdapi/tl_set_default_channel_administrator_rights_gen.go deleted file mode 100644 index 94429c976..000000000 --- a/tdapi/tl_set_default_channel_administrator_rights_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetDefaultChannelAdministratorRightsRequest represents TL type `setDefaultChannelAdministratorRights#f20d5e19`. -type SetDefaultChannelAdministratorRightsRequest struct { - // Default administrator rights for adding the bot to channels; pass null to remove - // default rights - DefaultChannelAdministratorRights ChatAdministratorRights -} - -// SetDefaultChannelAdministratorRightsRequestTypeID is TL type id of SetDefaultChannelAdministratorRightsRequest. -const SetDefaultChannelAdministratorRightsRequestTypeID = 0xf20d5e19 - -// Ensuring interfaces in compile-time for SetDefaultChannelAdministratorRightsRequest. -var ( - _ bin.Encoder = &SetDefaultChannelAdministratorRightsRequest{} - _ bin.Decoder = &SetDefaultChannelAdministratorRightsRequest{} - _ bin.BareEncoder = &SetDefaultChannelAdministratorRightsRequest{} - _ bin.BareDecoder = &SetDefaultChannelAdministratorRightsRequest{} -) - -func (s *SetDefaultChannelAdministratorRightsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.DefaultChannelAdministratorRights.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetDefaultChannelAdministratorRightsRequest) String() string { - if s == nil { - return "SetDefaultChannelAdministratorRightsRequest(nil)" - } - type Alias SetDefaultChannelAdministratorRightsRequest - return fmt.Sprintf("SetDefaultChannelAdministratorRightsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetDefaultChannelAdministratorRightsRequest) TypeID() uint32 { - return SetDefaultChannelAdministratorRightsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetDefaultChannelAdministratorRightsRequest) TypeName() string { - return "setDefaultChannelAdministratorRights" -} - -// TypeInfo returns info about TL type. -func (s *SetDefaultChannelAdministratorRightsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setDefaultChannelAdministratorRights", - ID: SetDefaultChannelAdministratorRightsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DefaultChannelAdministratorRights", - SchemaName: "default_channel_administrator_rights", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetDefaultChannelAdministratorRightsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultChannelAdministratorRights#f20d5e19 as nil") - } - b.PutID(SetDefaultChannelAdministratorRightsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetDefaultChannelAdministratorRightsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultChannelAdministratorRights#f20d5e19 as nil") - } - if err := s.DefaultChannelAdministratorRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode setDefaultChannelAdministratorRights#f20d5e19: field default_channel_administrator_rights: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetDefaultChannelAdministratorRightsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultChannelAdministratorRights#f20d5e19 to nil") - } - if err := b.ConsumeID(SetDefaultChannelAdministratorRightsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setDefaultChannelAdministratorRights#f20d5e19: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetDefaultChannelAdministratorRightsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultChannelAdministratorRights#f20d5e19 to nil") - } - { - if err := s.DefaultChannelAdministratorRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode setDefaultChannelAdministratorRights#f20d5e19: field default_channel_administrator_rights: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetDefaultChannelAdministratorRightsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultChannelAdministratorRights#f20d5e19 as nil") - } - b.ObjStart() - b.PutID("setDefaultChannelAdministratorRights") - b.Comma() - b.FieldStart("default_channel_administrator_rights") - if err := s.DefaultChannelAdministratorRights.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setDefaultChannelAdministratorRights#f20d5e19: field default_channel_administrator_rights: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetDefaultChannelAdministratorRightsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultChannelAdministratorRights#f20d5e19 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setDefaultChannelAdministratorRights"); err != nil { - return fmt.Errorf("unable to decode setDefaultChannelAdministratorRights#f20d5e19: %w", err) - } - case "default_channel_administrator_rights": - if err := s.DefaultChannelAdministratorRights.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setDefaultChannelAdministratorRights#f20d5e19: field default_channel_administrator_rights: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDefaultChannelAdministratorRights returns value of DefaultChannelAdministratorRights field. -func (s *SetDefaultChannelAdministratorRightsRequest) GetDefaultChannelAdministratorRights() (value ChatAdministratorRights) { - if s == nil { - return - } - return s.DefaultChannelAdministratorRights -} - -// SetDefaultChannelAdministratorRights invokes method setDefaultChannelAdministratorRights#f20d5e19 returning error if any. -func (c *Client) SetDefaultChannelAdministratorRights(ctx context.Context, defaultchanneladministratorrights ChatAdministratorRights) error { - var ok Ok - - request := &SetDefaultChannelAdministratorRightsRequest{ - DefaultChannelAdministratorRights: defaultchanneladministratorrights, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_default_group_administrator_rights_gen.go b/tdapi/tl_set_default_group_administrator_rights_gen.go deleted file mode 100644 index 98fa80924..000000000 --- a/tdapi/tl_set_default_group_administrator_rights_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetDefaultGroupAdministratorRightsRequest represents TL type `setDefaultGroupAdministratorRights#65577768`. -type SetDefaultGroupAdministratorRightsRequest struct { - // Default administrator rights for adding the bot to basic group and supergroup chats; - // pass null to remove default rights - DefaultGroupAdministratorRights ChatAdministratorRights -} - -// SetDefaultGroupAdministratorRightsRequestTypeID is TL type id of SetDefaultGroupAdministratorRightsRequest. -const SetDefaultGroupAdministratorRightsRequestTypeID = 0x65577768 - -// Ensuring interfaces in compile-time for SetDefaultGroupAdministratorRightsRequest. -var ( - _ bin.Encoder = &SetDefaultGroupAdministratorRightsRequest{} - _ bin.Decoder = &SetDefaultGroupAdministratorRightsRequest{} - _ bin.BareEncoder = &SetDefaultGroupAdministratorRightsRequest{} - _ bin.BareDecoder = &SetDefaultGroupAdministratorRightsRequest{} -) - -func (s *SetDefaultGroupAdministratorRightsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.DefaultGroupAdministratorRights.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetDefaultGroupAdministratorRightsRequest) String() string { - if s == nil { - return "SetDefaultGroupAdministratorRightsRequest(nil)" - } - type Alias SetDefaultGroupAdministratorRightsRequest - return fmt.Sprintf("SetDefaultGroupAdministratorRightsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetDefaultGroupAdministratorRightsRequest) TypeID() uint32 { - return SetDefaultGroupAdministratorRightsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetDefaultGroupAdministratorRightsRequest) TypeName() string { - return "setDefaultGroupAdministratorRights" -} - -// TypeInfo returns info about TL type. -func (s *SetDefaultGroupAdministratorRightsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setDefaultGroupAdministratorRights", - ID: SetDefaultGroupAdministratorRightsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "DefaultGroupAdministratorRights", - SchemaName: "default_group_administrator_rights", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetDefaultGroupAdministratorRightsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultGroupAdministratorRights#65577768 as nil") - } - b.PutID(SetDefaultGroupAdministratorRightsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetDefaultGroupAdministratorRightsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultGroupAdministratorRights#65577768 as nil") - } - if err := s.DefaultGroupAdministratorRights.Encode(b); err != nil { - return fmt.Errorf("unable to encode setDefaultGroupAdministratorRights#65577768: field default_group_administrator_rights: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetDefaultGroupAdministratorRightsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultGroupAdministratorRights#65577768 to nil") - } - if err := b.ConsumeID(SetDefaultGroupAdministratorRightsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setDefaultGroupAdministratorRights#65577768: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetDefaultGroupAdministratorRightsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultGroupAdministratorRights#65577768 to nil") - } - { - if err := s.DefaultGroupAdministratorRights.Decode(b); err != nil { - return fmt.Errorf("unable to decode setDefaultGroupAdministratorRights#65577768: field default_group_administrator_rights: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetDefaultGroupAdministratorRightsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultGroupAdministratorRights#65577768 as nil") - } - b.ObjStart() - b.PutID("setDefaultGroupAdministratorRights") - b.Comma() - b.FieldStart("default_group_administrator_rights") - if err := s.DefaultGroupAdministratorRights.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setDefaultGroupAdministratorRights#65577768: field default_group_administrator_rights: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetDefaultGroupAdministratorRightsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultGroupAdministratorRights#65577768 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setDefaultGroupAdministratorRights"); err != nil { - return fmt.Errorf("unable to decode setDefaultGroupAdministratorRights#65577768: %w", err) - } - case "default_group_administrator_rights": - if err := s.DefaultGroupAdministratorRights.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setDefaultGroupAdministratorRights#65577768: field default_group_administrator_rights: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDefaultGroupAdministratorRights returns value of DefaultGroupAdministratorRights field. -func (s *SetDefaultGroupAdministratorRightsRequest) GetDefaultGroupAdministratorRights() (value ChatAdministratorRights) { - if s == nil { - return - } - return s.DefaultGroupAdministratorRights -} - -// SetDefaultGroupAdministratorRights invokes method setDefaultGroupAdministratorRights#65577768 returning error if any. -func (c *Client) SetDefaultGroupAdministratorRights(ctx context.Context, defaultgroupadministratorrights ChatAdministratorRights) error { - var ok Ok - - request := &SetDefaultGroupAdministratorRightsRequest{ - DefaultGroupAdministratorRights: defaultgroupadministratorrights, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_default_message_auto_delete_time_gen.go b/tdapi/tl_set_default_message_auto_delete_time_gen.go deleted file mode 100644 index 31cd279bf..000000000 --- a/tdapi/tl_set_default_message_auto_delete_time_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetDefaultMessageAutoDeleteTimeRequest represents TL type `setDefaultMessageAutoDeleteTime#965cd36c`. -type SetDefaultMessageAutoDeleteTimeRequest struct { - // New default message auto-delete time; must be from 0 up to 365 * 86400 and be - // divisible by 86400. If 0, then messages aren't deleted automatically - MessageAutoDeleteTime MessageAutoDeleteTime -} - -// SetDefaultMessageAutoDeleteTimeRequestTypeID is TL type id of SetDefaultMessageAutoDeleteTimeRequest. -const SetDefaultMessageAutoDeleteTimeRequestTypeID = 0x965cd36c - -// Ensuring interfaces in compile-time for SetDefaultMessageAutoDeleteTimeRequest. -var ( - _ bin.Encoder = &SetDefaultMessageAutoDeleteTimeRequest{} - _ bin.Decoder = &SetDefaultMessageAutoDeleteTimeRequest{} - _ bin.BareEncoder = &SetDefaultMessageAutoDeleteTimeRequest{} - _ bin.BareDecoder = &SetDefaultMessageAutoDeleteTimeRequest{} -) - -func (s *SetDefaultMessageAutoDeleteTimeRequest) Zero() bool { - if s == nil { - return true - } - if !(s.MessageAutoDeleteTime.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetDefaultMessageAutoDeleteTimeRequest) String() string { - if s == nil { - return "SetDefaultMessageAutoDeleteTimeRequest(nil)" - } - type Alias SetDefaultMessageAutoDeleteTimeRequest - return fmt.Sprintf("SetDefaultMessageAutoDeleteTimeRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetDefaultMessageAutoDeleteTimeRequest) TypeID() uint32 { - return SetDefaultMessageAutoDeleteTimeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetDefaultMessageAutoDeleteTimeRequest) TypeName() string { - return "setDefaultMessageAutoDeleteTime" -} - -// TypeInfo returns info about TL type. -func (s *SetDefaultMessageAutoDeleteTimeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setDefaultMessageAutoDeleteTime", - ID: SetDefaultMessageAutoDeleteTimeRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageAutoDeleteTime", - SchemaName: "message_auto_delete_time", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetDefaultMessageAutoDeleteTimeRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultMessageAutoDeleteTime#965cd36c as nil") - } - b.PutID(SetDefaultMessageAutoDeleteTimeRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetDefaultMessageAutoDeleteTimeRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultMessageAutoDeleteTime#965cd36c as nil") - } - if err := s.MessageAutoDeleteTime.Encode(b); err != nil { - return fmt.Errorf("unable to encode setDefaultMessageAutoDeleteTime#965cd36c: field message_auto_delete_time: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetDefaultMessageAutoDeleteTimeRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultMessageAutoDeleteTime#965cd36c to nil") - } - if err := b.ConsumeID(SetDefaultMessageAutoDeleteTimeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setDefaultMessageAutoDeleteTime#965cd36c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetDefaultMessageAutoDeleteTimeRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultMessageAutoDeleteTime#965cd36c to nil") - } - { - if err := s.MessageAutoDeleteTime.Decode(b); err != nil { - return fmt.Errorf("unable to decode setDefaultMessageAutoDeleteTime#965cd36c: field message_auto_delete_time: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetDefaultMessageAutoDeleteTimeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultMessageAutoDeleteTime#965cd36c as nil") - } - b.ObjStart() - b.PutID("setDefaultMessageAutoDeleteTime") - b.Comma() - b.FieldStart("message_auto_delete_time") - if err := s.MessageAutoDeleteTime.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setDefaultMessageAutoDeleteTime#965cd36c: field message_auto_delete_time: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetDefaultMessageAutoDeleteTimeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultMessageAutoDeleteTime#965cd36c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setDefaultMessageAutoDeleteTime"); err != nil { - return fmt.Errorf("unable to decode setDefaultMessageAutoDeleteTime#965cd36c: %w", err) - } - case "message_auto_delete_time": - if err := s.MessageAutoDeleteTime.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setDefaultMessageAutoDeleteTime#965cd36c: field message_auto_delete_time: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageAutoDeleteTime returns value of MessageAutoDeleteTime field. -func (s *SetDefaultMessageAutoDeleteTimeRequest) GetMessageAutoDeleteTime() (value MessageAutoDeleteTime) { - if s == nil { - return - } - return s.MessageAutoDeleteTime -} - -// SetDefaultMessageAutoDeleteTime invokes method setDefaultMessageAutoDeleteTime#965cd36c returning error if any. -func (c *Client) SetDefaultMessageAutoDeleteTime(ctx context.Context, messageautodeletetime MessageAutoDeleteTime) error { - var ok Ok - - request := &SetDefaultMessageAutoDeleteTimeRequest{ - MessageAutoDeleteTime: messageautodeletetime, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_default_reaction_type_gen.go b/tdapi/tl_set_default_reaction_type_gen.go deleted file mode 100644 index 90e2e3019..000000000 --- a/tdapi/tl_set_default_reaction_type_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetDefaultReactionTypeRequest represents TL type `setDefaultReactionType#65038a3d`. -type SetDefaultReactionTypeRequest struct { - // New type of the default reaction. The paid reaction can't be set as default - ReactionType ReactionTypeClass -} - -// SetDefaultReactionTypeRequestTypeID is TL type id of SetDefaultReactionTypeRequest. -const SetDefaultReactionTypeRequestTypeID = 0x65038a3d - -// Ensuring interfaces in compile-time for SetDefaultReactionTypeRequest. -var ( - _ bin.Encoder = &SetDefaultReactionTypeRequest{} - _ bin.Decoder = &SetDefaultReactionTypeRequest{} - _ bin.BareEncoder = &SetDefaultReactionTypeRequest{} - _ bin.BareDecoder = &SetDefaultReactionTypeRequest{} -) - -func (s *SetDefaultReactionTypeRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ReactionType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetDefaultReactionTypeRequest) String() string { - if s == nil { - return "SetDefaultReactionTypeRequest(nil)" - } - type Alias SetDefaultReactionTypeRequest - return fmt.Sprintf("SetDefaultReactionTypeRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetDefaultReactionTypeRequest) TypeID() uint32 { - return SetDefaultReactionTypeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetDefaultReactionTypeRequest) TypeName() string { - return "setDefaultReactionType" -} - -// TypeInfo returns info about TL type. -func (s *SetDefaultReactionTypeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setDefaultReactionType", - ID: SetDefaultReactionTypeRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ReactionType", - SchemaName: "reaction_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetDefaultReactionTypeRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultReactionType#65038a3d as nil") - } - b.PutID(SetDefaultReactionTypeRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetDefaultReactionTypeRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultReactionType#65038a3d as nil") - } - if s.ReactionType == nil { - return fmt.Errorf("unable to encode setDefaultReactionType#65038a3d: field reaction_type is nil") - } - if err := s.ReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode setDefaultReactionType#65038a3d: field reaction_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetDefaultReactionTypeRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultReactionType#65038a3d to nil") - } - if err := b.ConsumeID(SetDefaultReactionTypeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setDefaultReactionType#65038a3d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetDefaultReactionTypeRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultReactionType#65038a3d to nil") - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode setDefaultReactionType#65038a3d: field reaction_type: %w", err) - } - s.ReactionType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetDefaultReactionTypeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setDefaultReactionType#65038a3d as nil") - } - b.ObjStart() - b.PutID("setDefaultReactionType") - b.Comma() - b.FieldStart("reaction_type") - if s.ReactionType == nil { - return fmt.Errorf("unable to encode setDefaultReactionType#65038a3d: field reaction_type is nil") - } - if err := s.ReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setDefaultReactionType#65038a3d: field reaction_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetDefaultReactionTypeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setDefaultReactionType#65038a3d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setDefaultReactionType"); err != nil { - return fmt.Errorf("unable to decode setDefaultReactionType#65038a3d: %w", err) - } - case "reaction_type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode setDefaultReactionType#65038a3d: field reaction_type: %w", err) - } - s.ReactionType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReactionType returns value of ReactionType field. -func (s *SetDefaultReactionTypeRequest) GetReactionType() (value ReactionTypeClass) { - if s == nil { - return - } - return s.ReactionType -} - -// SetDefaultReactionType invokes method setDefaultReactionType#65038a3d returning error if any. -func (c *Client) SetDefaultReactionType(ctx context.Context, reactiontype ReactionTypeClass) error { - var ok Ok - - request := &SetDefaultReactionTypeRequest{ - ReactionType: reactiontype, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_emoji_status_gen.go b/tdapi/tl_set_emoji_status_gen.go deleted file mode 100644 index 99e76c83b..000000000 --- a/tdapi/tl_set_emoji_status_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetEmojiStatusRequest represents TL type `setEmojiStatus#92f83e5d`. -type SetEmojiStatusRequest struct { - // New emoji status; pass null to switch to the default badge - EmojiStatus EmojiStatus -} - -// SetEmojiStatusRequestTypeID is TL type id of SetEmojiStatusRequest. -const SetEmojiStatusRequestTypeID = 0x92f83e5d - -// Ensuring interfaces in compile-time for SetEmojiStatusRequest. -var ( - _ bin.Encoder = &SetEmojiStatusRequest{} - _ bin.Decoder = &SetEmojiStatusRequest{} - _ bin.BareEncoder = &SetEmojiStatusRequest{} - _ bin.BareDecoder = &SetEmojiStatusRequest{} -) - -func (s *SetEmojiStatusRequest) Zero() bool { - if s == nil { - return true - } - if !(s.EmojiStatus.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetEmojiStatusRequest) String() string { - if s == nil { - return "SetEmojiStatusRequest(nil)" - } - type Alias SetEmojiStatusRequest - return fmt.Sprintf("SetEmojiStatusRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetEmojiStatusRequest) TypeID() uint32 { - return SetEmojiStatusRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetEmojiStatusRequest) TypeName() string { - return "setEmojiStatus" -} - -// TypeInfo returns info about TL type. -func (s *SetEmojiStatusRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setEmojiStatus", - ID: SetEmojiStatusRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "EmojiStatus", - SchemaName: "emoji_status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetEmojiStatusRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setEmojiStatus#92f83e5d as nil") - } - b.PutID(SetEmojiStatusRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetEmojiStatusRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setEmojiStatus#92f83e5d as nil") - } - if err := s.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode setEmojiStatus#92f83e5d: field emoji_status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetEmojiStatusRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setEmojiStatus#92f83e5d to nil") - } - if err := b.ConsumeID(SetEmojiStatusRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setEmojiStatus#92f83e5d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetEmojiStatusRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setEmojiStatus#92f83e5d to nil") - } - { - if err := s.EmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode setEmojiStatus#92f83e5d: field emoji_status: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetEmojiStatusRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setEmojiStatus#92f83e5d as nil") - } - b.ObjStart() - b.PutID("setEmojiStatus") - b.Comma() - b.FieldStart("emoji_status") - if err := s.EmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setEmojiStatus#92f83e5d: field emoji_status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetEmojiStatusRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setEmojiStatus#92f83e5d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setEmojiStatus"); err != nil { - return fmt.Errorf("unable to decode setEmojiStatus#92f83e5d: %w", err) - } - case "emoji_status": - if err := s.EmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setEmojiStatus#92f83e5d: field emoji_status: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetEmojiStatus returns value of EmojiStatus field. -func (s *SetEmojiStatusRequest) GetEmojiStatus() (value EmojiStatus) { - if s == nil { - return - } - return s.EmojiStatus -} - -// SetEmojiStatus invokes method setEmojiStatus#92f83e5d returning error if any. -func (c *Client) SetEmojiStatus(ctx context.Context, emojistatus EmojiStatus) error { - var ok Ok - - request := &SetEmojiStatusRequest{ - EmojiStatus: emojistatus, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_file_generation_progress_gen.go b/tdapi/tl_set_file_generation_progress_gen.go deleted file mode 100644 index 113f6f8c1..000000000 --- a/tdapi/tl_set_file_generation_progress_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetFileGenerationProgressRequest represents TL type `setFileGenerationProgress#6d754b3e`. -type SetFileGenerationProgressRequest struct { - // The identifier of the generation process - GenerationID int64 - // Expected size of the generated file, in bytes; 0 if unknown - ExpectedSize int64 - // The number of bytes already generated - LocalPrefixSize int64 -} - -// SetFileGenerationProgressRequestTypeID is TL type id of SetFileGenerationProgressRequest. -const SetFileGenerationProgressRequestTypeID = 0x6d754b3e - -// Ensuring interfaces in compile-time for SetFileGenerationProgressRequest. -var ( - _ bin.Encoder = &SetFileGenerationProgressRequest{} - _ bin.Decoder = &SetFileGenerationProgressRequest{} - _ bin.BareEncoder = &SetFileGenerationProgressRequest{} - _ bin.BareDecoder = &SetFileGenerationProgressRequest{} -) - -func (s *SetFileGenerationProgressRequest) Zero() bool { - if s == nil { - return true - } - if !(s.GenerationID == 0) { - return false - } - if !(s.ExpectedSize == 0) { - return false - } - if !(s.LocalPrefixSize == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetFileGenerationProgressRequest) String() string { - if s == nil { - return "SetFileGenerationProgressRequest(nil)" - } - type Alias SetFileGenerationProgressRequest - return fmt.Sprintf("SetFileGenerationProgressRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetFileGenerationProgressRequest) TypeID() uint32 { - return SetFileGenerationProgressRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetFileGenerationProgressRequest) TypeName() string { - return "setFileGenerationProgress" -} - -// TypeInfo returns info about TL type. -func (s *SetFileGenerationProgressRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setFileGenerationProgress", - ID: SetFileGenerationProgressRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GenerationID", - SchemaName: "generation_id", - }, - { - Name: "ExpectedSize", - SchemaName: "expected_size", - }, - { - Name: "LocalPrefixSize", - SchemaName: "local_prefix_size", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetFileGenerationProgressRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setFileGenerationProgress#6d754b3e as nil") - } - b.PutID(SetFileGenerationProgressRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetFileGenerationProgressRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setFileGenerationProgress#6d754b3e as nil") - } - b.PutLong(s.GenerationID) - b.PutInt53(s.ExpectedSize) - b.PutInt53(s.LocalPrefixSize) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetFileGenerationProgressRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setFileGenerationProgress#6d754b3e to nil") - } - if err := b.ConsumeID(SetFileGenerationProgressRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setFileGenerationProgress#6d754b3e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetFileGenerationProgressRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setFileGenerationProgress#6d754b3e to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setFileGenerationProgress#6d754b3e: field generation_id: %w", err) - } - s.GenerationID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setFileGenerationProgress#6d754b3e: field expected_size: %w", err) - } - s.ExpectedSize = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setFileGenerationProgress#6d754b3e: field local_prefix_size: %w", err) - } - s.LocalPrefixSize = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetFileGenerationProgressRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setFileGenerationProgress#6d754b3e as nil") - } - b.ObjStart() - b.PutID("setFileGenerationProgress") - b.Comma() - b.FieldStart("generation_id") - b.PutLong(s.GenerationID) - b.Comma() - b.FieldStart("expected_size") - b.PutInt53(s.ExpectedSize) - b.Comma() - b.FieldStart("local_prefix_size") - b.PutInt53(s.LocalPrefixSize) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetFileGenerationProgressRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setFileGenerationProgress#6d754b3e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setFileGenerationProgress"); err != nil { - return fmt.Errorf("unable to decode setFileGenerationProgress#6d754b3e: %w", err) - } - case "generation_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setFileGenerationProgress#6d754b3e: field generation_id: %w", err) - } - s.GenerationID = value - case "expected_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setFileGenerationProgress#6d754b3e: field expected_size: %w", err) - } - s.ExpectedSize = value - case "local_prefix_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setFileGenerationProgress#6d754b3e: field local_prefix_size: %w", err) - } - s.LocalPrefixSize = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGenerationID returns value of GenerationID field. -func (s *SetFileGenerationProgressRequest) GetGenerationID() (value int64) { - if s == nil { - return - } - return s.GenerationID -} - -// GetExpectedSize returns value of ExpectedSize field. -func (s *SetFileGenerationProgressRequest) GetExpectedSize() (value int64) { - if s == nil { - return - } - return s.ExpectedSize -} - -// GetLocalPrefixSize returns value of LocalPrefixSize field. -func (s *SetFileGenerationProgressRequest) GetLocalPrefixSize() (value int64) { - if s == nil { - return - } - return s.LocalPrefixSize -} - -// SetFileGenerationProgress invokes method setFileGenerationProgress#6d754b3e returning error if any. -func (c *Client) SetFileGenerationProgress(ctx context.Context, request *SetFileGenerationProgressRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_forum_topic_notification_settings_gen.go b/tdapi/tl_set_forum_topic_notification_settings_gen.go deleted file mode 100644 index 385922274..000000000 --- a/tdapi/tl_set_forum_topic_notification_settings_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetForumTopicNotificationSettingsRequest represents TL type `setForumTopicNotificationSettings#1f433467`. -type SetForumTopicNotificationSettingsRequest struct { - // Chat identifier - ChatID int64 - // Message thread identifier of the forum topic - MessageThreadID int64 - // New notification settings for the forum topic. If the topic is muted for more than 366 - // days, it is considered to be muted forever - NotificationSettings ChatNotificationSettings -} - -// SetForumTopicNotificationSettingsRequestTypeID is TL type id of SetForumTopicNotificationSettingsRequest. -const SetForumTopicNotificationSettingsRequestTypeID = 0x1f433467 - -// Ensuring interfaces in compile-time for SetForumTopicNotificationSettingsRequest. -var ( - _ bin.Encoder = &SetForumTopicNotificationSettingsRequest{} - _ bin.Decoder = &SetForumTopicNotificationSettingsRequest{} - _ bin.BareEncoder = &SetForumTopicNotificationSettingsRequest{} - _ bin.BareDecoder = &SetForumTopicNotificationSettingsRequest{} -) - -func (s *SetForumTopicNotificationSettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageThreadID == 0) { - return false - } - if !(s.NotificationSettings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetForumTopicNotificationSettingsRequest) String() string { - if s == nil { - return "SetForumTopicNotificationSettingsRequest(nil)" - } - type Alias SetForumTopicNotificationSettingsRequest - return fmt.Sprintf("SetForumTopicNotificationSettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetForumTopicNotificationSettingsRequest) TypeID() uint32 { - return SetForumTopicNotificationSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetForumTopicNotificationSettingsRequest) TypeName() string { - return "setForumTopicNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (s *SetForumTopicNotificationSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setForumTopicNotificationSettings", - ID: SetForumTopicNotificationSettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "NotificationSettings", - SchemaName: "notification_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetForumTopicNotificationSettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setForumTopicNotificationSettings#1f433467 as nil") - } - b.PutID(SetForumTopicNotificationSettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetForumTopicNotificationSettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setForumTopicNotificationSettings#1f433467 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageThreadID) - if err := s.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setForumTopicNotificationSettings#1f433467: field notification_settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetForumTopicNotificationSettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setForumTopicNotificationSettings#1f433467 to nil") - } - if err := b.ConsumeID(SetForumTopicNotificationSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetForumTopicNotificationSettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setForumTopicNotificationSettings#1f433467 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field message_thread_id: %w", err) - } - s.MessageThreadID = value - } - { - if err := s.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field notification_settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetForumTopicNotificationSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setForumTopicNotificationSettings#1f433467 as nil") - } - b.ObjStart() - b.PutID("setForumTopicNotificationSettings") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(s.MessageThreadID) - b.Comma() - b.FieldStart("notification_settings") - if err := s.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setForumTopicNotificationSettings#1f433467: field notification_settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetForumTopicNotificationSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setForumTopicNotificationSettings#1f433467 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setForumTopicNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field chat_id: %w", err) - } - s.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field message_thread_id: %w", err) - } - s.MessageThreadID = value - case "notification_settings": - if err := s.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setForumTopicNotificationSettings#1f433467: field notification_settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetForumTopicNotificationSettingsRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (s *SetForumTopicNotificationSettingsRequest) GetMessageThreadID() (value int64) { - if s == nil { - return - } - return s.MessageThreadID -} - -// GetNotificationSettings returns value of NotificationSettings field. -func (s *SetForumTopicNotificationSettingsRequest) GetNotificationSettings() (value ChatNotificationSettings) { - if s == nil { - return - } - return s.NotificationSettings -} - -// SetForumTopicNotificationSettings invokes method setForumTopicNotificationSettings#1f433467 returning error if any. -func (c *Client) SetForumTopicNotificationSettings(ctx context.Context, request *SetForumTopicNotificationSettingsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_game_score_gen.go b/tdapi/tl_set_game_score_gen.go deleted file mode 100644 index 3dc049dde..000000000 --- a/tdapi/tl_set_game_score_gen.go +++ /dev/null @@ -1,374 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetGameScoreRequest represents TL type `setGameScore#7eccedc6`. -type SetGameScoreRequest struct { - // The chat to which the message with the game belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // Pass true to edit the game message to include the current scoreboard - EditMessage bool - // User identifier - UserID int64 - // The new score - Score int32 - // Pass true to update the score even if it decreases. If the score is 0, the user will - // be deleted from the high score table - Force bool -} - -// SetGameScoreRequestTypeID is TL type id of SetGameScoreRequest. -const SetGameScoreRequestTypeID = 0x7eccedc6 - -// Ensuring interfaces in compile-time for SetGameScoreRequest. -var ( - _ bin.Encoder = &SetGameScoreRequest{} - _ bin.Decoder = &SetGameScoreRequest{} - _ bin.BareEncoder = &SetGameScoreRequest{} - _ bin.BareDecoder = &SetGameScoreRequest{} -) - -func (s *SetGameScoreRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - if !(s.EditMessage == false) { - return false - } - if !(s.UserID == 0) { - return false - } - if !(s.Score == 0) { - return false - } - if !(s.Force == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetGameScoreRequest) String() string { - if s == nil { - return "SetGameScoreRequest(nil)" - } - type Alias SetGameScoreRequest - return fmt.Sprintf("SetGameScoreRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetGameScoreRequest) TypeID() uint32 { - return SetGameScoreRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetGameScoreRequest) TypeName() string { - return "setGameScore" -} - -// TypeInfo returns info about TL type. -func (s *SetGameScoreRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setGameScore", - ID: SetGameScoreRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "EditMessage", - SchemaName: "edit_message", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Score", - SchemaName: "score", - }, - { - Name: "Force", - SchemaName: "force", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetGameScoreRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setGameScore#7eccedc6 as nil") - } - b.PutID(SetGameScoreRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetGameScoreRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setGameScore#7eccedc6 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - b.PutBool(s.EditMessage) - b.PutInt53(s.UserID) - b.PutInt32(s.Score) - b.PutBool(s.Force) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetGameScoreRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setGameScore#7eccedc6 to nil") - } - if err := b.ConsumeID(SetGameScoreRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetGameScoreRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setGameScore#7eccedc6 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field message_id: %w", err) - } - s.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field edit_message: %w", err) - } - s.EditMessage = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field score: %w", err) - } - s.Score = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field force: %w", err) - } - s.Force = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetGameScoreRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setGameScore#7eccedc6 as nil") - } - b.ObjStart() - b.PutID("setGameScore") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("edit_message") - b.PutBool(s.EditMessage) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("score") - b.PutInt32(s.Score) - b.Comma() - b.FieldStart("force") - b.PutBool(s.Force) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetGameScoreRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setGameScore#7eccedc6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setGameScore"); err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field message_id: %w", err) - } - s.MessageID = value - case "edit_message": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field edit_message: %w", err) - } - s.EditMessage = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field user_id: %w", err) - } - s.UserID = value - case "score": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field score: %w", err) - } - s.Score = value - case "force": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setGameScore#7eccedc6: field force: %w", err) - } - s.Force = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetGameScoreRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *SetGameScoreRequest) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetEditMessage returns value of EditMessage field. -func (s *SetGameScoreRequest) GetEditMessage() (value bool) { - if s == nil { - return - } - return s.EditMessage -} - -// GetUserID returns value of UserID field. -func (s *SetGameScoreRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetScore returns value of Score field. -func (s *SetGameScoreRequest) GetScore() (value int32) { - if s == nil { - return - } - return s.Score -} - -// GetForce returns value of Force field. -func (s *SetGameScoreRequest) GetForce() (value bool) { - if s == nil { - return - } - return s.Force -} - -// SetGameScore invokes method setGameScore#7eccedc6 returning error if any. -func (c *Client) SetGameScore(ctx context.Context, request *SetGameScoreRequest) (*Message, error) { - var result Message - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_set_group_call_participant_is_speaking_gen.go b/tdapi/tl_set_group_call_participant_is_speaking_gen.go deleted file mode 100644 index 330cd8307..000000000 --- a/tdapi/tl_set_group_call_participant_is_speaking_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetGroupCallParticipantIsSpeakingRequest represents TL type `setGroupCallParticipantIsSpeaking#3748a1e5`. -type SetGroupCallParticipantIsSpeakingRequest struct { - // Group call identifier - GroupCallID int32 - // Group call participant's synchronization audio source identifier, or 0 for the current - // user - AudioSource int32 - // Pass true if the user is speaking - IsSpeaking bool -} - -// SetGroupCallParticipantIsSpeakingRequestTypeID is TL type id of SetGroupCallParticipantIsSpeakingRequest. -const SetGroupCallParticipantIsSpeakingRequestTypeID = 0x3748a1e5 - -// Ensuring interfaces in compile-time for SetGroupCallParticipantIsSpeakingRequest. -var ( - _ bin.Encoder = &SetGroupCallParticipantIsSpeakingRequest{} - _ bin.Decoder = &SetGroupCallParticipantIsSpeakingRequest{} - _ bin.BareEncoder = &SetGroupCallParticipantIsSpeakingRequest{} - _ bin.BareDecoder = &SetGroupCallParticipantIsSpeakingRequest{} -) - -func (s *SetGroupCallParticipantIsSpeakingRequest) Zero() bool { - if s == nil { - return true - } - if !(s.GroupCallID == 0) { - return false - } - if !(s.AudioSource == 0) { - return false - } - if !(s.IsSpeaking == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetGroupCallParticipantIsSpeakingRequest) String() string { - if s == nil { - return "SetGroupCallParticipantIsSpeakingRequest(nil)" - } - type Alias SetGroupCallParticipantIsSpeakingRequest - return fmt.Sprintf("SetGroupCallParticipantIsSpeakingRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetGroupCallParticipantIsSpeakingRequest) TypeID() uint32 { - return SetGroupCallParticipantIsSpeakingRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetGroupCallParticipantIsSpeakingRequest) TypeName() string { - return "setGroupCallParticipantIsSpeaking" -} - -// TypeInfo returns info about TL type. -func (s *SetGroupCallParticipantIsSpeakingRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setGroupCallParticipantIsSpeaking", - ID: SetGroupCallParticipantIsSpeakingRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "AudioSource", - SchemaName: "audio_source", - }, - { - Name: "IsSpeaking", - SchemaName: "is_speaking", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetGroupCallParticipantIsSpeakingRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setGroupCallParticipantIsSpeaking#3748a1e5 as nil") - } - b.PutID(SetGroupCallParticipantIsSpeakingRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetGroupCallParticipantIsSpeakingRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setGroupCallParticipantIsSpeaking#3748a1e5 as nil") - } - b.PutInt32(s.GroupCallID) - b.PutInt32(s.AudioSource) - b.PutBool(s.IsSpeaking) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetGroupCallParticipantIsSpeakingRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setGroupCallParticipantIsSpeaking#3748a1e5 to nil") - } - if err := b.ConsumeID(SetGroupCallParticipantIsSpeakingRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantIsSpeaking#3748a1e5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetGroupCallParticipantIsSpeakingRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setGroupCallParticipantIsSpeaking#3748a1e5 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantIsSpeaking#3748a1e5: field group_call_id: %w", err) - } - s.GroupCallID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantIsSpeaking#3748a1e5: field audio_source: %w", err) - } - s.AudioSource = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantIsSpeaking#3748a1e5: field is_speaking: %w", err) - } - s.IsSpeaking = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetGroupCallParticipantIsSpeakingRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setGroupCallParticipantIsSpeaking#3748a1e5 as nil") - } - b.ObjStart() - b.PutID("setGroupCallParticipantIsSpeaking") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(s.GroupCallID) - b.Comma() - b.FieldStart("audio_source") - b.PutInt32(s.AudioSource) - b.Comma() - b.FieldStart("is_speaking") - b.PutBool(s.IsSpeaking) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetGroupCallParticipantIsSpeakingRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setGroupCallParticipantIsSpeaking#3748a1e5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setGroupCallParticipantIsSpeaking"); err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantIsSpeaking#3748a1e5: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantIsSpeaking#3748a1e5: field group_call_id: %w", err) - } - s.GroupCallID = value - case "audio_source": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantIsSpeaking#3748a1e5: field audio_source: %w", err) - } - s.AudioSource = value - case "is_speaking": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantIsSpeaking#3748a1e5: field is_speaking: %w", err) - } - s.IsSpeaking = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (s *SetGroupCallParticipantIsSpeakingRequest) GetGroupCallID() (value int32) { - if s == nil { - return - } - return s.GroupCallID -} - -// GetAudioSource returns value of AudioSource field. -func (s *SetGroupCallParticipantIsSpeakingRequest) GetAudioSource() (value int32) { - if s == nil { - return - } - return s.AudioSource -} - -// GetIsSpeaking returns value of IsSpeaking field. -func (s *SetGroupCallParticipantIsSpeakingRequest) GetIsSpeaking() (value bool) { - if s == nil { - return - } - return s.IsSpeaking -} - -// SetGroupCallParticipantIsSpeaking invokes method setGroupCallParticipantIsSpeaking#3748a1e5 returning error if any. -func (c *Client) SetGroupCallParticipantIsSpeaking(ctx context.Context, request *SetGroupCallParticipantIsSpeakingRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_group_call_participant_volume_level_gen.go b/tdapi/tl_set_group_call_participant_volume_level_gen.go deleted file mode 100644 index 66a1522d2..000000000 --- a/tdapi/tl_set_group_call_participant_volume_level_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetGroupCallParticipantVolumeLevelRequest represents TL type `setGroupCallParticipantVolumeLevel#97779828`. -type SetGroupCallParticipantVolumeLevelRequest struct { - // Group call identifier - GroupCallID int32 - // Participant identifier - ParticipantID MessageSenderClass - // New participant's volume level; 1-20000 in hundreds of percents - VolumeLevel int32 -} - -// SetGroupCallParticipantVolumeLevelRequestTypeID is TL type id of SetGroupCallParticipantVolumeLevelRequest. -const SetGroupCallParticipantVolumeLevelRequestTypeID = 0x97779828 - -// Ensuring interfaces in compile-time for SetGroupCallParticipantVolumeLevelRequest. -var ( - _ bin.Encoder = &SetGroupCallParticipantVolumeLevelRequest{} - _ bin.Decoder = &SetGroupCallParticipantVolumeLevelRequest{} - _ bin.BareEncoder = &SetGroupCallParticipantVolumeLevelRequest{} - _ bin.BareDecoder = &SetGroupCallParticipantVolumeLevelRequest{} -) - -func (s *SetGroupCallParticipantVolumeLevelRequest) Zero() bool { - if s == nil { - return true - } - if !(s.GroupCallID == 0) { - return false - } - if !(s.ParticipantID == nil) { - return false - } - if !(s.VolumeLevel == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetGroupCallParticipantVolumeLevelRequest) String() string { - if s == nil { - return "SetGroupCallParticipantVolumeLevelRequest(nil)" - } - type Alias SetGroupCallParticipantVolumeLevelRequest - return fmt.Sprintf("SetGroupCallParticipantVolumeLevelRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetGroupCallParticipantVolumeLevelRequest) TypeID() uint32 { - return SetGroupCallParticipantVolumeLevelRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetGroupCallParticipantVolumeLevelRequest) TypeName() string { - return "setGroupCallParticipantVolumeLevel" -} - -// TypeInfo returns info about TL type. -func (s *SetGroupCallParticipantVolumeLevelRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setGroupCallParticipantVolumeLevel", - ID: SetGroupCallParticipantVolumeLevelRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "ParticipantID", - SchemaName: "participant_id", - }, - { - Name: "VolumeLevel", - SchemaName: "volume_level", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetGroupCallParticipantVolumeLevelRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setGroupCallParticipantVolumeLevel#97779828 as nil") - } - b.PutID(SetGroupCallParticipantVolumeLevelRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetGroupCallParticipantVolumeLevelRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setGroupCallParticipantVolumeLevel#97779828 as nil") - } - b.PutInt32(s.GroupCallID) - if s.ParticipantID == nil { - return fmt.Errorf("unable to encode setGroupCallParticipantVolumeLevel#97779828: field participant_id is nil") - } - if err := s.ParticipantID.Encode(b); err != nil { - return fmt.Errorf("unable to encode setGroupCallParticipantVolumeLevel#97779828: field participant_id: %w", err) - } - b.PutInt32(s.VolumeLevel) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetGroupCallParticipantVolumeLevelRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setGroupCallParticipantVolumeLevel#97779828 to nil") - } - if err := b.ConsumeID(SetGroupCallParticipantVolumeLevelRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantVolumeLevel#97779828: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetGroupCallParticipantVolumeLevelRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setGroupCallParticipantVolumeLevel#97779828 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantVolumeLevel#97779828: field group_call_id: %w", err) - } - s.GroupCallID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantVolumeLevel#97779828: field participant_id: %w", err) - } - s.ParticipantID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantVolumeLevel#97779828: field volume_level: %w", err) - } - s.VolumeLevel = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetGroupCallParticipantVolumeLevelRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setGroupCallParticipantVolumeLevel#97779828 as nil") - } - b.ObjStart() - b.PutID("setGroupCallParticipantVolumeLevel") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(s.GroupCallID) - b.Comma() - b.FieldStart("participant_id") - if s.ParticipantID == nil { - return fmt.Errorf("unable to encode setGroupCallParticipantVolumeLevel#97779828: field participant_id is nil") - } - if err := s.ParticipantID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setGroupCallParticipantVolumeLevel#97779828: field participant_id: %w", err) - } - b.Comma() - b.FieldStart("volume_level") - b.PutInt32(s.VolumeLevel) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetGroupCallParticipantVolumeLevelRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setGroupCallParticipantVolumeLevel#97779828 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setGroupCallParticipantVolumeLevel"); err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantVolumeLevel#97779828: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantVolumeLevel#97779828: field group_call_id: %w", err) - } - s.GroupCallID = value - case "participant_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantVolumeLevel#97779828: field participant_id: %w", err) - } - s.ParticipantID = value - case "volume_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallParticipantVolumeLevel#97779828: field volume_level: %w", err) - } - s.VolumeLevel = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (s *SetGroupCallParticipantVolumeLevelRequest) GetGroupCallID() (value int32) { - if s == nil { - return - } - return s.GroupCallID -} - -// GetParticipantID returns value of ParticipantID field. -func (s *SetGroupCallParticipantVolumeLevelRequest) GetParticipantID() (value MessageSenderClass) { - if s == nil { - return - } - return s.ParticipantID -} - -// GetVolumeLevel returns value of VolumeLevel field. -func (s *SetGroupCallParticipantVolumeLevelRequest) GetVolumeLevel() (value int32) { - if s == nil { - return - } - return s.VolumeLevel -} - -// SetGroupCallParticipantVolumeLevel invokes method setGroupCallParticipantVolumeLevel#97779828 returning error if any. -func (c *Client) SetGroupCallParticipantVolumeLevel(ctx context.Context, request *SetGroupCallParticipantVolumeLevelRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_group_call_title_gen.go b/tdapi/tl_set_group_call_title_gen.go deleted file mode 100644 index 145d6ec9b..000000000 --- a/tdapi/tl_set_group_call_title_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetGroupCallTitleRequest represents TL type `setGroupCallTitle#b6c19dcd`. -type SetGroupCallTitleRequest struct { - // Group call identifier - GroupCallID int32 - // New group call title; 1-64 characters - Title string -} - -// SetGroupCallTitleRequestTypeID is TL type id of SetGroupCallTitleRequest. -const SetGroupCallTitleRequestTypeID = 0xb6c19dcd - -// Ensuring interfaces in compile-time for SetGroupCallTitleRequest. -var ( - _ bin.Encoder = &SetGroupCallTitleRequest{} - _ bin.Decoder = &SetGroupCallTitleRequest{} - _ bin.BareEncoder = &SetGroupCallTitleRequest{} - _ bin.BareDecoder = &SetGroupCallTitleRequest{} -) - -func (s *SetGroupCallTitleRequest) Zero() bool { - if s == nil { - return true - } - if !(s.GroupCallID == 0) { - return false - } - if !(s.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetGroupCallTitleRequest) String() string { - if s == nil { - return "SetGroupCallTitleRequest(nil)" - } - type Alias SetGroupCallTitleRequest - return fmt.Sprintf("SetGroupCallTitleRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetGroupCallTitleRequest) TypeID() uint32 { - return SetGroupCallTitleRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetGroupCallTitleRequest) TypeName() string { - return "setGroupCallTitle" -} - -// TypeInfo returns info about TL type. -func (s *SetGroupCallTitleRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setGroupCallTitle", - ID: SetGroupCallTitleRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetGroupCallTitleRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setGroupCallTitle#b6c19dcd as nil") - } - b.PutID(SetGroupCallTitleRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetGroupCallTitleRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setGroupCallTitle#b6c19dcd as nil") - } - b.PutInt32(s.GroupCallID) - b.PutString(s.Title) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetGroupCallTitleRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setGroupCallTitle#b6c19dcd to nil") - } - if err := b.ConsumeID(SetGroupCallTitleRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setGroupCallTitle#b6c19dcd: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetGroupCallTitleRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setGroupCallTitle#b6c19dcd to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallTitle#b6c19dcd: field group_call_id: %w", err) - } - s.GroupCallID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallTitle#b6c19dcd: field title: %w", err) - } - s.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetGroupCallTitleRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setGroupCallTitle#b6c19dcd as nil") - } - b.ObjStart() - b.PutID("setGroupCallTitle") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(s.GroupCallID) - b.Comma() - b.FieldStart("title") - b.PutString(s.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetGroupCallTitleRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setGroupCallTitle#b6c19dcd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setGroupCallTitle"); err != nil { - return fmt.Errorf("unable to decode setGroupCallTitle#b6c19dcd: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallTitle#b6c19dcd: field group_call_id: %w", err) - } - s.GroupCallID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setGroupCallTitle#b6c19dcd: field title: %w", err) - } - s.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (s *SetGroupCallTitleRequest) GetGroupCallID() (value int32) { - if s == nil { - return - } - return s.GroupCallID -} - -// GetTitle returns value of Title field. -func (s *SetGroupCallTitleRequest) GetTitle() (value string) { - if s == nil { - return - } - return s.Title -} - -// SetGroupCallTitle invokes method setGroupCallTitle#b6c19dcd returning error if any. -func (c *Client) SetGroupCallTitle(ctx context.Context, request *SetGroupCallTitleRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_inactive_session_ttl_gen.go b/tdapi/tl_set_inactive_session_ttl_gen.go deleted file mode 100644 index 8ee9a3d3b..000000000 --- a/tdapi/tl_set_inactive_session_ttl_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetInactiveSessionTTLRequest represents TL type `setInactiveSessionTtl#5d9ca950`. -type SetInactiveSessionTTLRequest struct { - // New number of days of inactivity before sessions will be automatically terminated; - // 1-366 days - InactiveSessionTTLDays int32 -} - -// SetInactiveSessionTTLRequestTypeID is TL type id of SetInactiveSessionTTLRequest. -const SetInactiveSessionTTLRequestTypeID = 0x5d9ca950 - -// Ensuring interfaces in compile-time for SetInactiveSessionTTLRequest. -var ( - _ bin.Encoder = &SetInactiveSessionTTLRequest{} - _ bin.Decoder = &SetInactiveSessionTTLRequest{} - _ bin.BareEncoder = &SetInactiveSessionTTLRequest{} - _ bin.BareDecoder = &SetInactiveSessionTTLRequest{} -) - -func (s *SetInactiveSessionTTLRequest) Zero() bool { - if s == nil { - return true - } - if !(s.InactiveSessionTTLDays == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetInactiveSessionTTLRequest) String() string { - if s == nil { - return "SetInactiveSessionTTLRequest(nil)" - } - type Alias SetInactiveSessionTTLRequest - return fmt.Sprintf("SetInactiveSessionTTLRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetInactiveSessionTTLRequest) TypeID() uint32 { - return SetInactiveSessionTTLRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetInactiveSessionTTLRequest) TypeName() string { - return "setInactiveSessionTtl" -} - -// TypeInfo returns info about TL type. -func (s *SetInactiveSessionTTLRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setInactiveSessionTtl", - ID: SetInactiveSessionTTLRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InactiveSessionTTLDays", - SchemaName: "inactive_session_ttl_days", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetInactiveSessionTTLRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setInactiveSessionTtl#5d9ca950 as nil") - } - b.PutID(SetInactiveSessionTTLRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetInactiveSessionTTLRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setInactiveSessionTtl#5d9ca950 as nil") - } - b.PutInt32(s.InactiveSessionTTLDays) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetInactiveSessionTTLRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setInactiveSessionTtl#5d9ca950 to nil") - } - if err := b.ConsumeID(SetInactiveSessionTTLRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setInactiveSessionTtl#5d9ca950: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetInactiveSessionTTLRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setInactiveSessionTtl#5d9ca950 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setInactiveSessionTtl#5d9ca950: field inactive_session_ttl_days: %w", err) - } - s.InactiveSessionTTLDays = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetInactiveSessionTTLRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setInactiveSessionTtl#5d9ca950 as nil") - } - b.ObjStart() - b.PutID("setInactiveSessionTtl") - b.Comma() - b.FieldStart("inactive_session_ttl_days") - b.PutInt32(s.InactiveSessionTTLDays) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetInactiveSessionTTLRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setInactiveSessionTtl#5d9ca950 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setInactiveSessionTtl"); err != nil { - return fmt.Errorf("unable to decode setInactiveSessionTtl#5d9ca950: %w", err) - } - case "inactive_session_ttl_days": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setInactiveSessionTtl#5d9ca950: field inactive_session_ttl_days: %w", err) - } - s.InactiveSessionTTLDays = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInactiveSessionTTLDays returns value of InactiveSessionTTLDays field. -func (s *SetInactiveSessionTTLRequest) GetInactiveSessionTTLDays() (value int32) { - if s == nil { - return - } - return s.InactiveSessionTTLDays -} - -// SetInactiveSessionTTL invokes method setInactiveSessionTtl#5d9ca950 returning error if any. -func (c *Client) SetInactiveSessionTTL(ctx context.Context, inactivesessionttldays int32) error { - var ok Ok - - request := &SetInactiveSessionTTLRequest{ - InactiveSessionTTLDays: inactivesessionttldays, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_inline_game_score_gen.go b/tdapi/tl_set_inline_game_score_gen.go deleted file mode 100644 index e83c87821..000000000 --- a/tdapi/tl_set_inline_game_score_gen.go +++ /dev/null @@ -1,340 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetInlineGameScoreRequest represents TL type `setInlineGameScore#c7715d8b`. -type SetInlineGameScoreRequest struct { - // Inline message identifier - InlineMessageID string - // Pass true to edit the game message to include the current scoreboard - EditMessage bool - // User identifier - UserID int64 - // The new score - Score int32 - // Pass true to update the score even if it decreases. If the score is 0, the user will - // be deleted from the high score table - Force bool -} - -// SetInlineGameScoreRequestTypeID is TL type id of SetInlineGameScoreRequest. -const SetInlineGameScoreRequestTypeID = 0xc7715d8b - -// Ensuring interfaces in compile-time for SetInlineGameScoreRequest. -var ( - _ bin.Encoder = &SetInlineGameScoreRequest{} - _ bin.Decoder = &SetInlineGameScoreRequest{} - _ bin.BareEncoder = &SetInlineGameScoreRequest{} - _ bin.BareDecoder = &SetInlineGameScoreRequest{} -) - -func (s *SetInlineGameScoreRequest) Zero() bool { - if s == nil { - return true - } - if !(s.InlineMessageID == "") { - return false - } - if !(s.EditMessage == false) { - return false - } - if !(s.UserID == 0) { - return false - } - if !(s.Score == 0) { - return false - } - if !(s.Force == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetInlineGameScoreRequest) String() string { - if s == nil { - return "SetInlineGameScoreRequest(nil)" - } - type Alias SetInlineGameScoreRequest - return fmt.Sprintf("SetInlineGameScoreRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetInlineGameScoreRequest) TypeID() uint32 { - return SetInlineGameScoreRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetInlineGameScoreRequest) TypeName() string { - return "setInlineGameScore" -} - -// TypeInfo returns info about TL type. -func (s *SetInlineGameScoreRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setInlineGameScore", - ID: SetInlineGameScoreRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InlineMessageID", - SchemaName: "inline_message_id", - }, - { - Name: "EditMessage", - SchemaName: "edit_message", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Score", - SchemaName: "score", - }, - { - Name: "Force", - SchemaName: "force", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetInlineGameScoreRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setInlineGameScore#c7715d8b as nil") - } - b.PutID(SetInlineGameScoreRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetInlineGameScoreRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setInlineGameScore#c7715d8b as nil") - } - b.PutString(s.InlineMessageID) - b.PutBool(s.EditMessage) - b.PutInt53(s.UserID) - b.PutInt32(s.Score) - b.PutBool(s.Force) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetInlineGameScoreRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setInlineGameScore#c7715d8b to nil") - } - if err := b.ConsumeID(SetInlineGameScoreRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetInlineGameScoreRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setInlineGameScore#c7715d8b to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: field inline_message_id: %w", err) - } - s.InlineMessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: field edit_message: %w", err) - } - s.EditMessage = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: field score: %w", err) - } - s.Score = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: field force: %w", err) - } - s.Force = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetInlineGameScoreRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setInlineGameScore#c7715d8b as nil") - } - b.ObjStart() - b.PutID("setInlineGameScore") - b.Comma() - b.FieldStart("inline_message_id") - b.PutString(s.InlineMessageID) - b.Comma() - b.FieldStart("edit_message") - b.PutBool(s.EditMessage) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("score") - b.PutInt32(s.Score) - b.Comma() - b.FieldStart("force") - b.PutBool(s.Force) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetInlineGameScoreRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setInlineGameScore#c7715d8b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setInlineGameScore"); err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: %w", err) - } - case "inline_message_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: field inline_message_id: %w", err) - } - s.InlineMessageID = value - case "edit_message": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: field edit_message: %w", err) - } - s.EditMessage = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: field user_id: %w", err) - } - s.UserID = value - case "score": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: field score: %w", err) - } - s.Score = value - case "force": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setInlineGameScore#c7715d8b: field force: %w", err) - } - s.Force = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInlineMessageID returns value of InlineMessageID field. -func (s *SetInlineGameScoreRequest) GetInlineMessageID() (value string) { - if s == nil { - return - } - return s.InlineMessageID -} - -// GetEditMessage returns value of EditMessage field. -func (s *SetInlineGameScoreRequest) GetEditMessage() (value bool) { - if s == nil { - return - } - return s.EditMessage -} - -// GetUserID returns value of UserID field. -func (s *SetInlineGameScoreRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetScore returns value of Score field. -func (s *SetInlineGameScoreRequest) GetScore() (value int32) { - if s == nil { - return - } - return s.Score -} - -// GetForce returns value of Force field. -func (s *SetInlineGameScoreRequest) GetForce() (value bool) { - if s == nil { - return - } - return s.Force -} - -// SetInlineGameScore invokes method setInlineGameScore#c7715d8b returning error if any. -func (c *Client) SetInlineGameScore(ctx context.Context, request *SetInlineGameScoreRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_log_stream_gen.go b/tdapi/tl_set_log_stream_gen.go deleted file mode 100644 index 6f7fc622f..000000000 --- a/tdapi/tl_set_log_stream_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetLogStreamRequest represents TL type `setLogStream#aeaff791`. -type SetLogStreamRequest struct { - // New log stream - LogStream LogStreamClass -} - -// SetLogStreamRequestTypeID is TL type id of SetLogStreamRequest. -const SetLogStreamRequestTypeID = 0xaeaff791 - -// Ensuring interfaces in compile-time for SetLogStreamRequest. -var ( - _ bin.Encoder = &SetLogStreamRequest{} - _ bin.Decoder = &SetLogStreamRequest{} - _ bin.BareEncoder = &SetLogStreamRequest{} - _ bin.BareDecoder = &SetLogStreamRequest{} -) - -func (s *SetLogStreamRequest) Zero() bool { - if s == nil { - return true - } - if !(s.LogStream == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetLogStreamRequest) String() string { - if s == nil { - return "SetLogStreamRequest(nil)" - } - type Alias SetLogStreamRequest - return fmt.Sprintf("SetLogStreamRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetLogStreamRequest) TypeID() uint32 { - return SetLogStreamRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetLogStreamRequest) TypeName() string { - return "setLogStream" -} - -// TypeInfo returns info about TL type. -func (s *SetLogStreamRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setLogStream", - ID: SetLogStreamRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LogStream", - SchemaName: "log_stream", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetLogStreamRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setLogStream#aeaff791 as nil") - } - b.PutID(SetLogStreamRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetLogStreamRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setLogStream#aeaff791 as nil") - } - if s.LogStream == nil { - return fmt.Errorf("unable to encode setLogStream#aeaff791: field log_stream is nil") - } - if err := s.LogStream.Encode(b); err != nil { - return fmt.Errorf("unable to encode setLogStream#aeaff791: field log_stream: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetLogStreamRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setLogStream#aeaff791 to nil") - } - if err := b.ConsumeID(SetLogStreamRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setLogStream#aeaff791: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetLogStreamRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setLogStream#aeaff791 to nil") - } - { - value, err := DecodeLogStream(b) - if err != nil { - return fmt.Errorf("unable to decode setLogStream#aeaff791: field log_stream: %w", err) - } - s.LogStream = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetLogStreamRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setLogStream#aeaff791 as nil") - } - b.ObjStart() - b.PutID("setLogStream") - b.Comma() - b.FieldStart("log_stream") - if s.LogStream == nil { - return fmt.Errorf("unable to encode setLogStream#aeaff791: field log_stream is nil") - } - if err := s.LogStream.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setLogStream#aeaff791: field log_stream: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetLogStreamRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setLogStream#aeaff791 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setLogStream"); err != nil { - return fmt.Errorf("unable to decode setLogStream#aeaff791: %w", err) - } - case "log_stream": - value, err := DecodeTDLibJSONLogStream(b) - if err != nil { - return fmt.Errorf("unable to decode setLogStream#aeaff791: field log_stream: %w", err) - } - s.LogStream = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLogStream returns value of LogStream field. -func (s *SetLogStreamRequest) GetLogStream() (value LogStreamClass) { - if s == nil { - return - } - return s.LogStream -} - -// SetLogStream invokes method setLogStream#aeaff791 returning error if any. -func (c *Client) SetLogStream(ctx context.Context, logstream LogStreamClass) error { - var ok Ok - - request := &SetLogStreamRequest{ - LogStream: logstream, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_log_tag_verbosity_level_gen.go b/tdapi/tl_set_log_tag_verbosity_level_gen.go deleted file mode 100644 index d14619c9d..000000000 --- a/tdapi/tl_set_log_tag_verbosity_level_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetLogTagVerbosityLevelRequest represents TL type `setLogTagVerbosityLevel#8317d696`. -type SetLogTagVerbosityLevelRequest struct { - // Logging tag to change verbosity level - Tag string - // New verbosity level; 1-1024 - NewVerbosityLevel int32 -} - -// SetLogTagVerbosityLevelRequestTypeID is TL type id of SetLogTagVerbosityLevelRequest. -const SetLogTagVerbosityLevelRequestTypeID = 0x8317d696 - -// Ensuring interfaces in compile-time for SetLogTagVerbosityLevelRequest. -var ( - _ bin.Encoder = &SetLogTagVerbosityLevelRequest{} - _ bin.Decoder = &SetLogTagVerbosityLevelRequest{} - _ bin.BareEncoder = &SetLogTagVerbosityLevelRequest{} - _ bin.BareDecoder = &SetLogTagVerbosityLevelRequest{} -) - -func (s *SetLogTagVerbosityLevelRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Tag == "") { - return false - } - if !(s.NewVerbosityLevel == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetLogTagVerbosityLevelRequest) String() string { - if s == nil { - return "SetLogTagVerbosityLevelRequest(nil)" - } - type Alias SetLogTagVerbosityLevelRequest - return fmt.Sprintf("SetLogTagVerbosityLevelRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetLogTagVerbosityLevelRequest) TypeID() uint32 { - return SetLogTagVerbosityLevelRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetLogTagVerbosityLevelRequest) TypeName() string { - return "setLogTagVerbosityLevel" -} - -// TypeInfo returns info about TL type. -func (s *SetLogTagVerbosityLevelRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setLogTagVerbosityLevel", - ID: SetLogTagVerbosityLevelRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Tag", - SchemaName: "tag", - }, - { - Name: "NewVerbosityLevel", - SchemaName: "new_verbosity_level", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetLogTagVerbosityLevelRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setLogTagVerbosityLevel#8317d696 as nil") - } - b.PutID(SetLogTagVerbosityLevelRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetLogTagVerbosityLevelRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setLogTagVerbosityLevel#8317d696 as nil") - } - b.PutString(s.Tag) - b.PutInt32(s.NewVerbosityLevel) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetLogTagVerbosityLevelRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setLogTagVerbosityLevel#8317d696 to nil") - } - if err := b.ConsumeID(SetLogTagVerbosityLevelRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setLogTagVerbosityLevel#8317d696: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetLogTagVerbosityLevelRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setLogTagVerbosityLevel#8317d696 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setLogTagVerbosityLevel#8317d696: field tag: %w", err) - } - s.Tag = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setLogTagVerbosityLevel#8317d696: field new_verbosity_level: %w", err) - } - s.NewVerbosityLevel = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetLogTagVerbosityLevelRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setLogTagVerbosityLevel#8317d696 as nil") - } - b.ObjStart() - b.PutID("setLogTagVerbosityLevel") - b.Comma() - b.FieldStart("tag") - b.PutString(s.Tag) - b.Comma() - b.FieldStart("new_verbosity_level") - b.PutInt32(s.NewVerbosityLevel) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetLogTagVerbosityLevelRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setLogTagVerbosityLevel#8317d696 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setLogTagVerbosityLevel"); err != nil { - return fmt.Errorf("unable to decode setLogTagVerbosityLevel#8317d696: %w", err) - } - case "tag": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setLogTagVerbosityLevel#8317d696: field tag: %w", err) - } - s.Tag = value - case "new_verbosity_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setLogTagVerbosityLevel#8317d696: field new_verbosity_level: %w", err) - } - s.NewVerbosityLevel = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTag returns value of Tag field. -func (s *SetLogTagVerbosityLevelRequest) GetTag() (value string) { - if s == nil { - return - } - return s.Tag -} - -// GetNewVerbosityLevel returns value of NewVerbosityLevel field. -func (s *SetLogTagVerbosityLevelRequest) GetNewVerbosityLevel() (value int32) { - if s == nil { - return - } - return s.NewVerbosityLevel -} - -// SetLogTagVerbosityLevel invokes method setLogTagVerbosityLevel#8317d696 returning error if any. -func (c *Client) SetLogTagVerbosityLevel(ctx context.Context, request *SetLogTagVerbosityLevelRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_log_verbosity_level_gen.go b/tdapi/tl_set_log_verbosity_level_gen.go deleted file mode 100644 index 3ca791476..000000000 --- a/tdapi/tl_set_log_verbosity_level_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetLogVerbosityLevelRequest represents TL type `setLogVerbosityLevel#edea07d2`. -type SetLogVerbosityLevelRequest struct { - // New value of the verbosity level for logging. Value 0 corresponds to fatal errors, - // value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, - NewVerbosityLevel int32 -} - -// SetLogVerbosityLevelRequestTypeID is TL type id of SetLogVerbosityLevelRequest. -const SetLogVerbosityLevelRequestTypeID = 0xedea07d2 - -// Ensuring interfaces in compile-time for SetLogVerbosityLevelRequest. -var ( - _ bin.Encoder = &SetLogVerbosityLevelRequest{} - _ bin.Decoder = &SetLogVerbosityLevelRequest{} - _ bin.BareEncoder = &SetLogVerbosityLevelRequest{} - _ bin.BareDecoder = &SetLogVerbosityLevelRequest{} -) - -func (s *SetLogVerbosityLevelRequest) Zero() bool { - if s == nil { - return true - } - if !(s.NewVerbosityLevel == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetLogVerbosityLevelRequest) String() string { - if s == nil { - return "SetLogVerbosityLevelRequest(nil)" - } - type Alias SetLogVerbosityLevelRequest - return fmt.Sprintf("SetLogVerbosityLevelRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetLogVerbosityLevelRequest) TypeID() uint32 { - return SetLogVerbosityLevelRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetLogVerbosityLevelRequest) TypeName() string { - return "setLogVerbosityLevel" -} - -// TypeInfo returns info about TL type. -func (s *SetLogVerbosityLevelRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setLogVerbosityLevel", - ID: SetLogVerbosityLevelRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NewVerbosityLevel", - SchemaName: "new_verbosity_level", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetLogVerbosityLevelRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setLogVerbosityLevel#edea07d2 as nil") - } - b.PutID(SetLogVerbosityLevelRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetLogVerbosityLevelRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setLogVerbosityLevel#edea07d2 as nil") - } - b.PutInt32(s.NewVerbosityLevel) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetLogVerbosityLevelRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setLogVerbosityLevel#edea07d2 to nil") - } - if err := b.ConsumeID(SetLogVerbosityLevelRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setLogVerbosityLevel#edea07d2: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetLogVerbosityLevelRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setLogVerbosityLevel#edea07d2 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setLogVerbosityLevel#edea07d2: field new_verbosity_level: %w", err) - } - s.NewVerbosityLevel = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetLogVerbosityLevelRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setLogVerbosityLevel#edea07d2 as nil") - } - b.ObjStart() - b.PutID("setLogVerbosityLevel") - b.Comma() - b.FieldStart("new_verbosity_level") - b.PutInt32(s.NewVerbosityLevel) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetLogVerbosityLevelRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setLogVerbosityLevel#edea07d2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setLogVerbosityLevel"); err != nil { - return fmt.Errorf("unable to decode setLogVerbosityLevel#edea07d2: %w", err) - } - case "new_verbosity_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setLogVerbosityLevel#edea07d2: field new_verbosity_level: %w", err) - } - s.NewVerbosityLevel = value - default: - return b.Skip() - } - return nil - }) -} - -// GetNewVerbosityLevel returns value of NewVerbosityLevel field. -func (s *SetLogVerbosityLevelRequest) GetNewVerbosityLevel() (value int32) { - if s == nil { - return - } - return s.NewVerbosityLevel -} - -// SetLogVerbosityLevel invokes method setLogVerbosityLevel#edea07d2 returning error if any. -func (c *Client) SetLogVerbosityLevel(ctx context.Context, newverbositylevel int32) error { - var ok Ok - - request := &SetLogVerbosityLevelRequest{ - NewVerbosityLevel: newverbositylevel, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_login_email_address_gen.go b/tdapi/tl_set_login_email_address_gen.go deleted file mode 100644 index 080ce5a74..000000000 --- a/tdapi/tl_set_login_email_address_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetLoginEmailAddressRequest represents TL type `setLoginEmailAddress#37bb43d4`. -type SetLoginEmailAddressRequest struct { - // New login email address - NewLoginEmailAddress string -} - -// SetLoginEmailAddressRequestTypeID is TL type id of SetLoginEmailAddressRequest. -const SetLoginEmailAddressRequestTypeID = 0x37bb43d4 - -// Ensuring interfaces in compile-time for SetLoginEmailAddressRequest. -var ( - _ bin.Encoder = &SetLoginEmailAddressRequest{} - _ bin.Decoder = &SetLoginEmailAddressRequest{} - _ bin.BareEncoder = &SetLoginEmailAddressRequest{} - _ bin.BareDecoder = &SetLoginEmailAddressRequest{} -) - -func (s *SetLoginEmailAddressRequest) Zero() bool { - if s == nil { - return true - } - if !(s.NewLoginEmailAddress == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetLoginEmailAddressRequest) String() string { - if s == nil { - return "SetLoginEmailAddressRequest(nil)" - } - type Alias SetLoginEmailAddressRequest - return fmt.Sprintf("SetLoginEmailAddressRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetLoginEmailAddressRequest) TypeID() uint32 { - return SetLoginEmailAddressRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetLoginEmailAddressRequest) TypeName() string { - return "setLoginEmailAddress" -} - -// TypeInfo returns info about TL type. -func (s *SetLoginEmailAddressRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setLoginEmailAddress", - ID: SetLoginEmailAddressRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NewLoginEmailAddress", - SchemaName: "new_login_email_address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetLoginEmailAddressRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setLoginEmailAddress#37bb43d4 as nil") - } - b.PutID(SetLoginEmailAddressRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetLoginEmailAddressRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setLoginEmailAddress#37bb43d4 as nil") - } - b.PutString(s.NewLoginEmailAddress) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetLoginEmailAddressRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setLoginEmailAddress#37bb43d4 to nil") - } - if err := b.ConsumeID(SetLoginEmailAddressRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setLoginEmailAddress#37bb43d4: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetLoginEmailAddressRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setLoginEmailAddress#37bb43d4 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setLoginEmailAddress#37bb43d4: field new_login_email_address: %w", err) - } - s.NewLoginEmailAddress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetLoginEmailAddressRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setLoginEmailAddress#37bb43d4 as nil") - } - b.ObjStart() - b.PutID("setLoginEmailAddress") - b.Comma() - b.FieldStart("new_login_email_address") - b.PutString(s.NewLoginEmailAddress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetLoginEmailAddressRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setLoginEmailAddress#37bb43d4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setLoginEmailAddress"); err != nil { - return fmt.Errorf("unable to decode setLoginEmailAddress#37bb43d4: %w", err) - } - case "new_login_email_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setLoginEmailAddress#37bb43d4: field new_login_email_address: %w", err) - } - s.NewLoginEmailAddress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetNewLoginEmailAddress returns value of NewLoginEmailAddress field. -func (s *SetLoginEmailAddressRequest) GetNewLoginEmailAddress() (value string) { - if s == nil { - return - } - return s.NewLoginEmailAddress -} - -// SetLoginEmailAddress invokes method setLoginEmailAddress#37bb43d4 returning error if any. -func (c *Client) SetLoginEmailAddress(ctx context.Context, newloginemailaddress string) (*EmailAddressAuthenticationCodeInfo, error) { - var result EmailAddressAuthenticationCodeInfo - - request := &SetLoginEmailAddressRequest{ - NewLoginEmailAddress: newloginemailaddress, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_set_menu_button_gen.go b/tdapi/tl_set_menu_button_gen.go deleted file mode 100644 index 5ac5a4629..000000000 --- a/tdapi/tl_set_menu_button_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetMenuButtonRequest represents TL type `setMenuButton#b44fc141`. -type SetMenuButtonRequest struct { - // Identifier of the user or 0 to set menu button for all users - UserID int64 - // New menu button - MenuButton BotMenuButton -} - -// SetMenuButtonRequestTypeID is TL type id of SetMenuButtonRequest. -const SetMenuButtonRequestTypeID = 0xb44fc141 - -// Ensuring interfaces in compile-time for SetMenuButtonRequest. -var ( - _ bin.Encoder = &SetMenuButtonRequest{} - _ bin.Decoder = &SetMenuButtonRequest{} - _ bin.BareEncoder = &SetMenuButtonRequest{} - _ bin.BareDecoder = &SetMenuButtonRequest{} -) - -func (s *SetMenuButtonRequest) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.MenuButton.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetMenuButtonRequest) String() string { - if s == nil { - return "SetMenuButtonRequest(nil)" - } - type Alias SetMenuButtonRequest - return fmt.Sprintf("SetMenuButtonRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetMenuButtonRequest) TypeID() uint32 { - return SetMenuButtonRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetMenuButtonRequest) TypeName() string { - return "setMenuButton" -} - -// TypeInfo returns info about TL type. -func (s *SetMenuButtonRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setMenuButton", - ID: SetMenuButtonRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "MenuButton", - SchemaName: "menu_button", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetMenuButtonRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setMenuButton#b44fc141 as nil") - } - b.PutID(SetMenuButtonRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetMenuButtonRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setMenuButton#b44fc141 as nil") - } - b.PutInt53(s.UserID) - if err := s.MenuButton.Encode(b); err != nil { - return fmt.Errorf("unable to encode setMenuButton#b44fc141: field menu_button: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetMenuButtonRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setMenuButton#b44fc141 to nil") - } - if err := b.ConsumeID(SetMenuButtonRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setMenuButton#b44fc141: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetMenuButtonRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setMenuButton#b44fc141 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMenuButton#b44fc141: field user_id: %w", err) - } - s.UserID = value - } - { - if err := s.MenuButton.Decode(b); err != nil { - return fmt.Errorf("unable to decode setMenuButton#b44fc141: field menu_button: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetMenuButtonRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setMenuButton#b44fc141 as nil") - } - b.ObjStart() - b.PutID("setMenuButton") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("menu_button") - if err := s.MenuButton.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setMenuButton#b44fc141: field menu_button: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetMenuButtonRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setMenuButton#b44fc141 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setMenuButton"); err != nil { - return fmt.Errorf("unable to decode setMenuButton#b44fc141: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMenuButton#b44fc141: field user_id: %w", err) - } - s.UserID = value - case "menu_button": - if err := s.MenuButton.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setMenuButton#b44fc141: field menu_button: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *SetMenuButtonRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetMenuButton returns value of MenuButton field. -func (s *SetMenuButtonRequest) GetMenuButton() (value BotMenuButton) { - if s == nil { - return - } - return s.MenuButton -} - -// SetMenuButton invokes method setMenuButton#b44fc141 returning error if any. -func (c *Client) SetMenuButton(ctx context.Context, request *SetMenuButtonRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_message_fact_check_gen.go b/tdapi/tl_set_message_fact_check_gen.go deleted file mode 100644 index 9bb8ac1c8..000000000 --- a/tdapi/tl_set_message_fact_check_gen.go +++ /dev/null @@ -1,273 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetMessageFactCheckRequest represents TL type `setMessageFactCheck#ffbe3d08`. -type SetMessageFactCheckRequest struct { - // The channel chat the message belongs to - ChatID int64 - // Identifier of the message - MessageID int64 - // New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null - // to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are - // supported - Text FormattedText -} - -// SetMessageFactCheckRequestTypeID is TL type id of SetMessageFactCheckRequest. -const SetMessageFactCheckRequestTypeID = 0xffbe3d08 - -// Ensuring interfaces in compile-time for SetMessageFactCheckRequest. -var ( - _ bin.Encoder = &SetMessageFactCheckRequest{} - _ bin.Decoder = &SetMessageFactCheckRequest{} - _ bin.BareEncoder = &SetMessageFactCheckRequest{} - _ bin.BareDecoder = &SetMessageFactCheckRequest{} -) - -func (s *SetMessageFactCheckRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - if !(s.Text.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetMessageFactCheckRequest) String() string { - if s == nil { - return "SetMessageFactCheckRequest(nil)" - } - type Alias SetMessageFactCheckRequest - return fmt.Sprintf("SetMessageFactCheckRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetMessageFactCheckRequest) TypeID() uint32 { - return SetMessageFactCheckRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetMessageFactCheckRequest) TypeName() string { - return "setMessageFactCheck" -} - -// TypeInfo returns info about TL type. -func (s *SetMessageFactCheckRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setMessageFactCheck", - ID: SetMessageFactCheckRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetMessageFactCheckRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setMessageFactCheck#ffbe3d08 as nil") - } - b.PutID(SetMessageFactCheckRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetMessageFactCheckRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setMessageFactCheck#ffbe3d08 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - if err := s.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode setMessageFactCheck#ffbe3d08: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetMessageFactCheckRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setMessageFactCheck#ffbe3d08 to nil") - } - if err := b.ConsumeID(SetMessageFactCheckRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setMessageFactCheck#ffbe3d08: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetMessageFactCheckRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setMessageFactCheck#ffbe3d08 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMessageFactCheck#ffbe3d08: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMessageFactCheck#ffbe3d08: field message_id: %w", err) - } - s.MessageID = value - } - { - if err := s.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode setMessageFactCheck#ffbe3d08: field text: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetMessageFactCheckRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setMessageFactCheck#ffbe3d08 as nil") - } - b.ObjStart() - b.PutID("setMessageFactCheck") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("text") - if err := s.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setMessageFactCheck#ffbe3d08: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetMessageFactCheckRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setMessageFactCheck#ffbe3d08 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setMessageFactCheck"); err != nil { - return fmt.Errorf("unable to decode setMessageFactCheck#ffbe3d08: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMessageFactCheck#ffbe3d08: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMessageFactCheck#ffbe3d08: field message_id: %w", err) - } - s.MessageID = value - case "text": - if err := s.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setMessageFactCheck#ffbe3d08: field text: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetMessageFactCheckRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *SetMessageFactCheckRequest) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetText returns value of Text field. -func (s *SetMessageFactCheckRequest) GetText() (value FormattedText) { - if s == nil { - return - } - return s.Text -} - -// SetMessageFactCheck invokes method setMessageFactCheck#ffbe3d08 returning error if any. -func (c *Client) SetMessageFactCheck(ctx context.Context, request *SetMessageFactCheckRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_message_reactions_gen.go b/tdapi/tl_set_message_reactions_gen.go deleted file mode 100644 index 628532b2e..000000000 --- a/tdapi/tl_set_message_reactions_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetMessageReactionsRequest represents TL type `setMessageReactions#71fa9e8f`. -type SetMessageReactionsRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // Types of the reaction to set; pass an empty list to remove the reactions - ReactionTypes []ReactionTypeClass - // Pass true if the reactions are added with a big animation - IsBig bool -} - -// SetMessageReactionsRequestTypeID is TL type id of SetMessageReactionsRequest. -const SetMessageReactionsRequestTypeID = 0x71fa9e8f - -// Ensuring interfaces in compile-time for SetMessageReactionsRequest. -var ( - _ bin.Encoder = &SetMessageReactionsRequest{} - _ bin.Decoder = &SetMessageReactionsRequest{} - _ bin.BareEncoder = &SetMessageReactionsRequest{} - _ bin.BareDecoder = &SetMessageReactionsRequest{} -) - -func (s *SetMessageReactionsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - if !(s.ReactionTypes == nil) { - return false - } - if !(s.IsBig == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetMessageReactionsRequest) String() string { - if s == nil { - return "SetMessageReactionsRequest(nil)" - } - type Alias SetMessageReactionsRequest - return fmt.Sprintf("SetMessageReactionsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetMessageReactionsRequest) TypeID() uint32 { - return SetMessageReactionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetMessageReactionsRequest) TypeName() string { - return "setMessageReactions" -} - -// TypeInfo returns info about TL type. -func (s *SetMessageReactionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setMessageReactions", - ID: SetMessageReactionsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReactionTypes", - SchemaName: "reaction_types", - }, - { - Name: "IsBig", - SchemaName: "is_big", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetMessageReactionsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setMessageReactions#71fa9e8f as nil") - } - b.PutID(SetMessageReactionsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetMessageReactionsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setMessageReactions#71fa9e8f as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - b.PutInt(len(s.ReactionTypes)) - for idx, v := range s.ReactionTypes { - if v == nil { - return fmt.Errorf("unable to encode setMessageReactions#71fa9e8f: field reaction_types element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare setMessageReactions#71fa9e8f: field reaction_types element with index %d: %w", idx, err) - } - } - b.PutBool(s.IsBig) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetMessageReactionsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setMessageReactions#71fa9e8f to nil") - } - if err := b.ConsumeID(SetMessageReactionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetMessageReactionsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setMessageReactions#71fa9e8f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: field message_id: %w", err) - } - s.MessageID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: field reaction_types: %w", err) - } - - if headerLen > 0 { - s.ReactionTypes = make([]ReactionTypeClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: field reaction_types: %w", err) - } - s.ReactionTypes = append(s.ReactionTypes, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: field is_big: %w", err) - } - s.IsBig = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetMessageReactionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setMessageReactions#71fa9e8f as nil") - } - b.ObjStart() - b.PutID("setMessageReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("reaction_types") - b.ArrStart() - for idx, v := range s.ReactionTypes { - if v == nil { - return fmt.Errorf("unable to encode setMessageReactions#71fa9e8f: field reaction_types element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setMessageReactions#71fa9e8f: field reaction_types element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("is_big") - b.PutBool(s.IsBig) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetMessageReactionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setMessageReactions#71fa9e8f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setMessageReactions"); err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: field message_id: %w", err) - } - s.MessageID = value - case "reaction_types": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: field reaction_types: %w", err) - } - s.ReactionTypes = append(s.ReactionTypes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: field reaction_types: %w", err) - } - case "is_big": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setMessageReactions#71fa9e8f: field is_big: %w", err) - } - s.IsBig = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetMessageReactionsRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *SetMessageReactionsRequest) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetReactionTypes returns value of ReactionTypes field. -func (s *SetMessageReactionsRequest) GetReactionTypes() (value []ReactionTypeClass) { - if s == nil { - return - } - return s.ReactionTypes -} - -// GetIsBig returns value of IsBig field. -func (s *SetMessageReactionsRequest) GetIsBig() (value bool) { - if s == nil { - return - } - return s.IsBig -} - -// SetMessageReactions invokes method setMessageReactions#71fa9e8f returning error if any. -func (c *Client) SetMessageReactions(ctx context.Context, request *SetMessageReactionsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_message_sender_block_list_gen.go b/tdapi/tl_set_message_sender_block_list_gen.go deleted file mode 100644 index 70aea03f5..000000000 --- a/tdapi/tl_set_message_sender_block_list_gen.go +++ /dev/null @@ -1,257 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetMessageSenderBlockListRequest represents TL type `setMessageSenderBlockList#898b5c91`. -type SetMessageSenderBlockListRequest struct { - // Identifier of a message sender to block/unblock - SenderID MessageSenderClass - // New block list for the message sender; pass null to unblock the message sender - BlockList BlockListClass -} - -// SetMessageSenderBlockListRequestTypeID is TL type id of SetMessageSenderBlockListRequest. -const SetMessageSenderBlockListRequestTypeID = 0x898b5c91 - -// Ensuring interfaces in compile-time for SetMessageSenderBlockListRequest. -var ( - _ bin.Encoder = &SetMessageSenderBlockListRequest{} - _ bin.Decoder = &SetMessageSenderBlockListRequest{} - _ bin.BareEncoder = &SetMessageSenderBlockListRequest{} - _ bin.BareDecoder = &SetMessageSenderBlockListRequest{} -) - -func (s *SetMessageSenderBlockListRequest) Zero() bool { - if s == nil { - return true - } - if !(s.SenderID == nil) { - return false - } - if !(s.BlockList == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetMessageSenderBlockListRequest) String() string { - if s == nil { - return "SetMessageSenderBlockListRequest(nil)" - } - type Alias SetMessageSenderBlockListRequest - return fmt.Sprintf("SetMessageSenderBlockListRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetMessageSenderBlockListRequest) TypeID() uint32 { - return SetMessageSenderBlockListRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetMessageSenderBlockListRequest) TypeName() string { - return "setMessageSenderBlockList" -} - -// TypeInfo returns info about TL type. -func (s *SetMessageSenderBlockListRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setMessageSenderBlockList", - ID: SetMessageSenderBlockListRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderID", - SchemaName: "sender_id", - }, - { - Name: "BlockList", - SchemaName: "block_list", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetMessageSenderBlockListRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setMessageSenderBlockList#898b5c91 as nil") - } - b.PutID(SetMessageSenderBlockListRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetMessageSenderBlockListRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setMessageSenderBlockList#898b5c91 as nil") - } - if s.SenderID == nil { - return fmt.Errorf("unable to encode setMessageSenderBlockList#898b5c91: field sender_id is nil") - } - if err := s.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode setMessageSenderBlockList#898b5c91: field sender_id: %w", err) - } - if s.BlockList == nil { - return fmt.Errorf("unable to encode setMessageSenderBlockList#898b5c91: field block_list is nil") - } - if err := s.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode setMessageSenderBlockList#898b5c91: field block_list: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetMessageSenderBlockListRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setMessageSenderBlockList#898b5c91 to nil") - } - if err := b.ConsumeID(SetMessageSenderBlockListRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setMessageSenderBlockList#898b5c91: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetMessageSenderBlockListRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setMessageSenderBlockList#898b5c91 to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setMessageSenderBlockList#898b5c91: field sender_id: %w", err) - } - s.SenderID = value - } - { - value, err := DecodeBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode setMessageSenderBlockList#898b5c91: field block_list: %w", err) - } - s.BlockList = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetMessageSenderBlockListRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setMessageSenderBlockList#898b5c91 as nil") - } - b.ObjStart() - b.PutID("setMessageSenderBlockList") - b.Comma() - b.FieldStart("sender_id") - if s.SenderID == nil { - return fmt.Errorf("unable to encode setMessageSenderBlockList#898b5c91: field sender_id is nil") - } - if err := s.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setMessageSenderBlockList#898b5c91: field sender_id: %w", err) - } - b.Comma() - b.FieldStart("block_list") - if s.BlockList == nil { - return fmt.Errorf("unable to encode setMessageSenderBlockList#898b5c91: field block_list is nil") - } - if err := s.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setMessageSenderBlockList#898b5c91: field block_list: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetMessageSenderBlockListRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setMessageSenderBlockList#898b5c91 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setMessageSenderBlockList"); err != nil { - return fmt.Errorf("unable to decode setMessageSenderBlockList#898b5c91: %w", err) - } - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setMessageSenderBlockList#898b5c91: field sender_id: %w", err) - } - s.SenderID = value - case "block_list": - value, err := DecodeTDLibJSONBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode setMessageSenderBlockList#898b5c91: field block_list: %w", err) - } - s.BlockList = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderID returns value of SenderID field. -func (s *SetMessageSenderBlockListRequest) GetSenderID() (value MessageSenderClass) { - if s == nil { - return - } - return s.SenderID -} - -// GetBlockList returns value of BlockList field. -func (s *SetMessageSenderBlockListRequest) GetBlockList() (value BlockListClass) { - if s == nil { - return - } - return s.BlockList -} - -// SetMessageSenderBlockList invokes method setMessageSenderBlockList#898b5c91 returning error if any. -func (c *Client) SetMessageSenderBlockList(ctx context.Context, request *SetMessageSenderBlockListRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_message_sender_bot_verification_gen.go b/tdapi/tl_set_message_sender_bot_verification_gen.go deleted file mode 100644 index 2f5bfb873..000000000 --- a/tdapi/tl_set_message_sender_bot_verification_gen.go +++ /dev/null @@ -1,283 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetMessageSenderBotVerificationRequest represents TL type `setMessageSenderBotVerification#b4c1da4a`. -type SetMessageSenderBotVerificationRequest struct { - // Identifier of the owned bot, which will verify the user or the chat - BotUserID int64 - // Identifier of the user or the supergroup or channel chat, which will be verified by - // the bot - VerifiedID MessageSenderClass - // Custom description of verification reason; - // 0-getOption("bot_verification_custom_description_length_max"). - CustomDescription string -} - -// SetMessageSenderBotVerificationRequestTypeID is TL type id of SetMessageSenderBotVerificationRequest. -const SetMessageSenderBotVerificationRequestTypeID = 0xb4c1da4a - -// Ensuring interfaces in compile-time for SetMessageSenderBotVerificationRequest. -var ( - _ bin.Encoder = &SetMessageSenderBotVerificationRequest{} - _ bin.Decoder = &SetMessageSenderBotVerificationRequest{} - _ bin.BareEncoder = &SetMessageSenderBotVerificationRequest{} - _ bin.BareDecoder = &SetMessageSenderBotVerificationRequest{} -) - -func (s *SetMessageSenderBotVerificationRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BotUserID == 0) { - return false - } - if !(s.VerifiedID == nil) { - return false - } - if !(s.CustomDescription == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetMessageSenderBotVerificationRequest) String() string { - if s == nil { - return "SetMessageSenderBotVerificationRequest(nil)" - } - type Alias SetMessageSenderBotVerificationRequest - return fmt.Sprintf("SetMessageSenderBotVerificationRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetMessageSenderBotVerificationRequest) TypeID() uint32 { - return SetMessageSenderBotVerificationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetMessageSenderBotVerificationRequest) TypeName() string { - return "setMessageSenderBotVerification" -} - -// TypeInfo returns info about TL type. -func (s *SetMessageSenderBotVerificationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setMessageSenderBotVerification", - ID: SetMessageSenderBotVerificationRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "VerifiedID", - SchemaName: "verified_id", - }, - { - Name: "CustomDescription", - SchemaName: "custom_description", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetMessageSenderBotVerificationRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setMessageSenderBotVerification#b4c1da4a as nil") - } - b.PutID(SetMessageSenderBotVerificationRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetMessageSenderBotVerificationRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setMessageSenderBotVerification#b4c1da4a as nil") - } - b.PutInt53(s.BotUserID) - if s.VerifiedID == nil { - return fmt.Errorf("unable to encode setMessageSenderBotVerification#b4c1da4a: field verified_id is nil") - } - if err := s.VerifiedID.Encode(b); err != nil { - return fmt.Errorf("unable to encode setMessageSenderBotVerification#b4c1da4a: field verified_id: %w", err) - } - b.PutString(s.CustomDescription) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetMessageSenderBotVerificationRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setMessageSenderBotVerification#b4c1da4a to nil") - } - if err := b.ConsumeID(SetMessageSenderBotVerificationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetMessageSenderBotVerificationRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setMessageSenderBotVerification#b4c1da4a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field bot_user_id: %w", err) - } - s.BotUserID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field verified_id: %w", err) - } - s.VerifiedID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field custom_description: %w", err) - } - s.CustomDescription = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetMessageSenderBotVerificationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setMessageSenderBotVerification#b4c1da4a as nil") - } - b.ObjStart() - b.PutID("setMessageSenderBotVerification") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(s.BotUserID) - b.Comma() - b.FieldStart("verified_id") - if s.VerifiedID == nil { - return fmt.Errorf("unable to encode setMessageSenderBotVerification#b4c1da4a: field verified_id is nil") - } - if err := s.VerifiedID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setMessageSenderBotVerification#b4c1da4a: field verified_id: %w", err) - } - b.Comma() - b.FieldStart("custom_description") - b.PutString(s.CustomDescription) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetMessageSenderBotVerificationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setMessageSenderBotVerification#b4c1da4a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setMessageSenderBotVerification"); err != nil { - return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field bot_user_id: %w", err) - } - s.BotUserID = value - case "verified_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field verified_id: %w", err) - } - s.VerifiedID = value - case "custom_description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setMessageSenderBotVerification#b4c1da4a: field custom_description: %w", err) - } - s.CustomDescription = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (s *SetMessageSenderBotVerificationRequest) GetBotUserID() (value int64) { - if s == nil { - return - } - return s.BotUserID -} - -// GetVerifiedID returns value of VerifiedID field. -func (s *SetMessageSenderBotVerificationRequest) GetVerifiedID() (value MessageSenderClass) { - if s == nil { - return - } - return s.VerifiedID -} - -// GetCustomDescription returns value of CustomDescription field. -func (s *SetMessageSenderBotVerificationRequest) GetCustomDescription() (value string) { - if s == nil { - return - } - return s.CustomDescription -} - -// SetMessageSenderBotVerification invokes method setMessageSenderBotVerification#b4c1da4a returning error if any. -func (c *Client) SetMessageSenderBotVerification(ctx context.Context, request *SetMessageSenderBotVerificationRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_name_gen.go b/tdapi/tl_set_name_gen.go deleted file mode 100644 index 79f09c8c3..000000000 --- a/tdapi/tl_set_name_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetNameRequest represents TL type `setName#66065f10`. -type SetNameRequest struct { - // The new value of the first name for the current user; 1-64 characters - FirstName string - // The new value of the optional last name for the current user; 0-64 characters - LastName string -} - -// SetNameRequestTypeID is TL type id of SetNameRequest. -const SetNameRequestTypeID = 0x66065f10 - -// Ensuring interfaces in compile-time for SetNameRequest. -var ( - _ bin.Encoder = &SetNameRequest{} - _ bin.Decoder = &SetNameRequest{} - _ bin.BareEncoder = &SetNameRequest{} - _ bin.BareDecoder = &SetNameRequest{} -) - -func (s *SetNameRequest) Zero() bool { - if s == nil { - return true - } - if !(s.FirstName == "") { - return false - } - if !(s.LastName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetNameRequest) String() string { - if s == nil { - return "SetNameRequest(nil)" - } - type Alias SetNameRequest - return fmt.Sprintf("SetNameRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetNameRequest) TypeID() uint32 { - return SetNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetNameRequest) TypeName() string { - return "setName" -} - -// TypeInfo returns info about TL type. -func (s *SetNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setName", - ID: SetNameRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FirstName", - SchemaName: "first_name", - }, - { - Name: "LastName", - SchemaName: "last_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetNameRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setName#66065f10 as nil") - } - b.PutID(SetNameRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetNameRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setName#66065f10 as nil") - } - b.PutString(s.FirstName) - b.PutString(s.LastName) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetNameRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setName#66065f10 to nil") - } - if err := b.ConsumeID(SetNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setName#66065f10: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetNameRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setName#66065f10 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setName#66065f10: field first_name: %w", err) - } - s.FirstName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setName#66065f10: field last_name: %w", err) - } - s.LastName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setName#66065f10 as nil") - } - b.ObjStart() - b.PutID("setName") - b.Comma() - b.FieldStart("first_name") - b.PutString(s.FirstName) - b.Comma() - b.FieldStart("last_name") - b.PutString(s.LastName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setName#66065f10 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setName"); err != nil { - return fmt.Errorf("unable to decode setName#66065f10: %w", err) - } - case "first_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setName#66065f10: field first_name: %w", err) - } - s.FirstName = value - case "last_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setName#66065f10: field last_name: %w", err) - } - s.LastName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFirstName returns value of FirstName field. -func (s *SetNameRequest) GetFirstName() (value string) { - if s == nil { - return - } - return s.FirstName -} - -// GetLastName returns value of LastName field. -func (s *SetNameRequest) GetLastName() (value string) { - if s == nil { - return - } - return s.LastName -} - -// SetName invokes method setName#66065f10 returning error if any. -func (c *Client) SetName(ctx context.Context, request *SetNameRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_network_type_gen.go b/tdapi/tl_set_network_type_gen.go deleted file mode 100644 index 2456d862b..000000000 --- a/tdapi/tl_set_network_type_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetNetworkTypeRequest represents TL type `setNetworkType#d62de55e`. -type SetNetworkTypeRequest struct { - // The new network type; pass null to set network type to networkTypeOther - Type NetworkTypeClass -} - -// SetNetworkTypeRequestTypeID is TL type id of SetNetworkTypeRequest. -const SetNetworkTypeRequestTypeID = 0xd62de55e - -// Ensuring interfaces in compile-time for SetNetworkTypeRequest. -var ( - _ bin.Encoder = &SetNetworkTypeRequest{} - _ bin.Decoder = &SetNetworkTypeRequest{} - _ bin.BareEncoder = &SetNetworkTypeRequest{} - _ bin.BareDecoder = &SetNetworkTypeRequest{} -) - -func (s *SetNetworkTypeRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetNetworkTypeRequest) String() string { - if s == nil { - return "SetNetworkTypeRequest(nil)" - } - type Alias SetNetworkTypeRequest - return fmt.Sprintf("SetNetworkTypeRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetNetworkTypeRequest) TypeID() uint32 { - return SetNetworkTypeRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetNetworkTypeRequest) TypeName() string { - return "setNetworkType" -} - -// TypeInfo returns info about TL type. -func (s *SetNetworkTypeRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setNetworkType", - ID: SetNetworkTypeRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetNetworkTypeRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setNetworkType#d62de55e as nil") - } - b.PutID(SetNetworkTypeRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetNetworkTypeRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setNetworkType#d62de55e as nil") - } - if s.Type == nil { - return fmt.Errorf("unable to encode setNetworkType#d62de55e: field type is nil") - } - if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode setNetworkType#d62de55e: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetNetworkTypeRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setNetworkType#d62de55e to nil") - } - if err := b.ConsumeID(SetNetworkTypeRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setNetworkType#d62de55e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetNetworkTypeRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setNetworkType#d62de55e to nil") - } - { - value, err := DecodeNetworkType(b) - if err != nil { - return fmt.Errorf("unable to decode setNetworkType#d62de55e: field type: %w", err) - } - s.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetNetworkTypeRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setNetworkType#d62de55e as nil") - } - b.ObjStart() - b.PutID("setNetworkType") - b.Comma() - b.FieldStart("type") - if s.Type == nil { - return fmt.Errorf("unable to encode setNetworkType#d62de55e: field type is nil") - } - if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setNetworkType#d62de55e: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetNetworkTypeRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setNetworkType#d62de55e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setNetworkType"); err != nil { - return fmt.Errorf("unable to decode setNetworkType#d62de55e: %w", err) - } - case "type": - value, err := DecodeTDLibJSONNetworkType(b) - if err != nil { - return fmt.Errorf("unable to decode setNetworkType#d62de55e: field type: %w", err) - } - s.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (s *SetNetworkTypeRequest) GetType() (value NetworkTypeClass) { - if s == nil { - return - } - return s.Type -} - -// SetNetworkType invokes method setNetworkType#d62de55e returning error if any. -func (c *Client) SetNetworkType(ctx context.Context, type_ NetworkTypeClass) error { - var ok Ok - - request := &SetNetworkTypeRequest{ - Type: type_, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_new_chat_privacy_settings_gen.go b/tdapi/tl_set_new_chat_privacy_settings_gen.go deleted file mode 100644 index 32c0fa8ab..000000000 --- a/tdapi/tl_set_new_chat_privacy_settings_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetNewChatPrivacySettingsRequest represents TL type `setNewChatPrivacySettings#69bf374f`. -type SetNewChatPrivacySettingsRequest struct { - // New settings - Settings NewChatPrivacySettings -} - -// SetNewChatPrivacySettingsRequestTypeID is TL type id of SetNewChatPrivacySettingsRequest. -const SetNewChatPrivacySettingsRequestTypeID = 0x69bf374f - -// Ensuring interfaces in compile-time for SetNewChatPrivacySettingsRequest. -var ( - _ bin.Encoder = &SetNewChatPrivacySettingsRequest{} - _ bin.Decoder = &SetNewChatPrivacySettingsRequest{} - _ bin.BareEncoder = &SetNewChatPrivacySettingsRequest{} - _ bin.BareDecoder = &SetNewChatPrivacySettingsRequest{} -) - -func (s *SetNewChatPrivacySettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Settings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetNewChatPrivacySettingsRequest) String() string { - if s == nil { - return "SetNewChatPrivacySettingsRequest(nil)" - } - type Alias SetNewChatPrivacySettingsRequest - return fmt.Sprintf("SetNewChatPrivacySettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetNewChatPrivacySettingsRequest) TypeID() uint32 { - return SetNewChatPrivacySettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetNewChatPrivacySettingsRequest) TypeName() string { - return "setNewChatPrivacySettings" -} - -// TypeInfo returns info about TL type. -func (s *SetNewChatPrivacySettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setNewChatPrivacySettings", - ID: SetNewChatPrivacySettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Settings", - SchemaName: "settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetNewChatPrivacySettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setNewChatPrivacySettings#69bf374f as nil") - } - b.PutID(SetNewChatPrivacySettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetNewChatPrivacySettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setNewChatPrivacySettings#69bf374f as nil") - } - if err := s.Settings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setNewChatPrivacySettings#69bf374f: field settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetNewChatPrivacySettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setNewChatPrivacySettings#69bf374f to nil") - } - if err := b.ConsumeID(SetNewChatPrivacySettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setNewChatPrivacySettings#69bf374f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetNewChatPrivacySettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setNewChatPrivacySettings#69bf374f to nil") - } - { - if err := s.Settings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setNewChatPrivacySettings#69bf374f: field settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetNewChatPrivacySettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setNewChatPrivacySettings#69bf374f as nil") - } - b.ObjStart() - b.PutID("setNewChatPrivacySettings") - b.Comma() - b.FieldStart("settings") - if err := s.Settings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setNewChatPrivacySettings#69bf374f: field settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetNewChatPrivacySettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setNewChatPrivacySettings#69bf374f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setNewChatPrivacySettings"); err != nil { - return fmt.Errorf("unable to decode setNewChatPrivacySettings#69bf374f: %w", err) - } - case "settings": - if err := s.Settings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setNewChatPrivacySettings#69bf374f: field settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSettings returns value of Settings field. -func (s *SetNewChatPrivacySettingsRequest) GetSettings() (value NewChatPrivacySettings) { - if s == nil { - return - } - return s.Settings -} - -// SetNewChatPrivacySettings invokes method setNewChatPrivacySettings#69bf374f returning error if any. -func (c *Client) SetNewChatPrivacySettings(ctx context.Context, settings NewChatPrivacySettings) error { - var ok Ok - - request := &SetNewChatPrivacySettingsRequest{ - Settings: settings, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_option_gen.go b/tdapi/tl_set_option_gen.go deleted file mode 100644 index b7d5b0a20..000000000 --- a/tdapi/tl_set_option_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetOptionRequest represents TL type `setOption#7e0b4ef2`. -type SetOptionRequest struct { - // The name of the option - Name string - // The new value of the option; pass null to reset option value to a default value - Value OptionValueClass -} - -// SetOptionRequestTypeID is TL type id of SetOptionRequest. -const SetOptionRequestTypeID = 0x7e0b4ef2 - -// Ensuring interfaces in compile-time for SetOptionRequest. -var ( - _ bin.Encoder = &SetOptionRequest{} - _ bin.Decoder = &SetOptionRequest{} - _ bin.BareEncoder = &SetOptionRequest{} - _ bin.BareDecoder = &SetOptionRequest{} -) - -func (s *SetOptionRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Name == "") { - return false - } - if !(s.Value == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetOptionRequest) String() string { - if s == nil { - return "SetOptionRequest(nil)" - } - type Alias SetOptionRequest - return fmt.Sprintf("SetOptionRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetOptionRequest) TypeID() uint32 { - return SetOptionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetOptionRequest) TypeName() string { - return "setOption" -} - -// TypeInfo returns info about TL type. -func (s *SetOptionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setOption", - ID: SetOptionRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetOptionRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setOption#7e0b4ef2 as nil") - } - b.PutID(SetOptionRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetOptionRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setOption#7e0b4ef2 as nil") - } - b.PutString(s.Name) - if s.Value == nil { - return fmt.Errorf("unable to encode setOption#7e0b4ef2: field value is nil") - } - if err := s.Value.Encode(b); err != nil { - return fmt.Errorf("unable to encode setOption#7e0b4ef2: field value: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetOptionRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setOption#7e0b4ef2 to nil") - } - if err := b.ConsumeID(SetOptionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setOption#7e0b4ef2: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetOptionRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setOption#7e0b4ef2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setOption#7e0b4ef2: field name: %w", err) - } - s.Name = value - } - { - value, err := DecodeOptionValue(b) - if err != nil { - return fmt.Errorf("unable to decode setOption#7e0b4ef2: field value: %w", err) - } - s.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetOptionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setOption#7e0b4ef2 as nil") - } - b.ObjStart() - b.PutID("setOption") - b.Comma() - b.FieldStart("name") - b.PutString(s.Name) - b.Comma() - b.FieldStart("value") - if s.Value == nil { - return fmt.Errorf("unable to encode setOption#7e0b4ef2: field value is nil") - } - if err := s.Value.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setOption#7e0b4ef2: field value: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetOptionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setOption#7e0b4ef2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setOption"); err != nil { - return fmt.Errorf("unable to decode setOption#7e0b4ef2: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setOption#7e0b4ef2: field name: %w", err) - } - s.Name = value - case "value": - value, err := DecodeTDLibJSONOptionValue(b) - if err != nil { - return fmt.Errorf("unable to decode setOption#7e0b4ef2: field value: %w", err) - } - s.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (s *SetOptionRequest) GetName() (value string) { - if s == nil { - return - } - return s.Name -} - -// GetValue returns value of Value field. -func (s *SetOptionRequest) GetValue() (value OptionValueClass) { - if s == nil { - return - } - return s.Value -} - -// SetOption invokes method setOption#7e0b4ef2 returning error if any. -func (c *Client) SetOption(ctx context.Context, request *SetOptionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_passport_element_errors_gen.go b/tdapi/tl_set_passport_element_errors_gen.go deleted file mode 100644 index c81b5cce9..000000000 --- a/tdapi/tl_set_passport_element_errors_gen.go +++ /dev/null @@ -1,265 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetPassportElementErrorsRequest represents TL type `setPassportElementErrors#80fa80bf`. -type SetPassportElementErrorsRequest struct { - // User identifier - UserID int64 - // The errors - Errors []InputPassportElementError -} - -// SetPassportElementErrorsRequestTypeID is TL type id of SetPassportElementErrorsRequest. -const SetPassportElementErrorsRequestTypeID = 0x80fa80bf - -// Ensuring interfaces in compile-time for SetPassportElementErrorsRequest. -var ( - _ bin.Encoder = &SetPassportElementErrorsRequest{} - _ bin.Decoder = &SetPassportElementErrorsRequest{} - _ bin.BareEncoder = &SetPassportElementErrorsRequest{} - _ bin.BareDecoder = &SetPassportElementErrorsRequest{} -) - -func (s *SetPassportElementErrorsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Errors == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetPassportElementErrorsRequest) String() string { - if s == nil { - return "SetPassportElementErrorsRequest(nil)" - } - type Alias SetPassportElementErrorsRequest - return fmt.Sprintf("SetPassportElementErrorsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetPassportElementErrorsRequest) TypeID() uint32 { - return SetPassportElementErrorsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetPassportElementErrorsRequest) TypeName() string { - return "setPassportElementErrors" -} - -// TypeInfo returns info about TL type. -func (s *SetPassportElementErrorsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setPassportElementErrors", - ID: SetPassportElementErrorsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Errors", - SchemaName: "errors", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetPassportElementErrorsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPassportElementErrors#80fa80bf as nil") - } - b.PutID(SetPassportElementErrorsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetPassportElementErrorsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPassportElementErrors#80fa80bf as nil") - } - b.PutInt53(s.UserID) - b.PutInt(len(s.Errors)) - for idx, v := range s.Errors { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare setPassportElementErrors#80fa80bf: field errors element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetPassportElementErrorsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPassportElementErrors#80fa80bf to nil") - } - if err := b.ConsumeID(SetPassportElementErrorsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setPassportElementErrors#80fa80bf: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetPassportElementErrorsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPassportElementErrors#80fa80bf to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPassportElementErrors#80fa80bf: field user_id: %w", err) - } - s.UserID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode setPassportElementErrors#80fa80bf: field errors: %w", err) - } - - if headerLen > 0 { - s.Errors = make([]InputPassportElementError, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value InputPassportElementError - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare setPassportElementErrors#80fa80bf: field errors: %w", err) - } - s.Errors = append(s.Errors, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetPassportElementErrorsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setPassportElementErrors#80fa80bf as nil") - } - b.ObjStart() - b.PutID("setPassportElementErrors") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("errors") - b.ArrStart() - for idx, v := range s.Errors { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setPassportElementErrors#80fa80bf: field errors element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetPassportElementErrorsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setPassportElementErrors#80fa80bf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setPassportElementErrors"); err != nil { - return fmt.Errorf("unable to decode setPassportElementErrors#80fa80bf: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPassportElementErrors#80fa80bf: field user_id: %w", err) - } - s.UserID = value - case "errors": - if err := b.Arr(func(b tdjson.Decoder) error { - var value InputPassportElementError - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setPassportElementErrors#80fa80bf: field errors: %w", err) - } - s.Errors = append(s.Errors, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode setPassportElementErrors#80fa80bf: field errors: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *SetPassportElementErrorsRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetErrors returns value of Errors field. -func (s *SetPassportElementErrorsRequest) GetErrors() (value []InputPassportElementError) { - if s == nil { - return - } - return s.Errors -} - -// SetPassportElementErrors invokes method setPassportElementErrors#80fa80bf returning error if any. -func (c *Client) SetPassportElementErrors(ctx context.Context, request *SetPassportElementErrorsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_passport_element_gen.go b/tdapi/tl_set_passport_element_gen.go deleted file mode 100644 index 41955c422..000000000 --- a/tdapi/tl_set_passport_element_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetPassportElementRequest represents TL type `setPassportElement#7b45d19c`. -type SetPassportElementRequest struct { - // Input Telegram Passport element - Element InputPassportElementClass - // The 2-step verification password of the current user - Password string -} - -// SetPassportElementRequestTypeID is TL type id of SetPassportElementRequest. -const SetPassportElementRequestTypeID = 0x7b45d19c - -// Ensuring interfaces in compile-time for SetPassportElementRequest. -var ( - _ bin.Encoder = &SetPassportElementRequest{} - _ bin.Decoder = &SetPassportElementRequest{} - _ bin.BareEncoder = &SetPassportElementRequest{} - _ bin.BareDecoder = &SetPassportElementRequest{} -) - -func (s *SetPassportElementRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Element == nil) { - return false - } - if !(s.Password == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetPassportElementRequest) String() string { - if s == nil { - return "SetPassportElementRequest(nil)" - } - type Alias SetPassportElementRequest - return fmt.Sprintf("SetPassportElementRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetPassportElementRequest) TypeID() uint32 { - return SetPassportElementRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetPassportElementRequest) TypeName() string { - return "setPassportElement" -} - -// TypeInfo returns info about TL type. -func (s *SetPassportElementRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setPassportElement", - ID: SetPassportElementRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Element", - SchemaName: "element", - }, - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetPassportElementRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPassportElement#7b45d19c as nil") - } - b.PutID(SetPassportElementRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetPassportElementRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPassportElement#7b45d19c as nil") - } - if s.Element == nil { - return fmt.Errorf("unable to encode setPassportElement#7b45d19c: field element is nil") - } - if err := s.Element.Encode(b); err != nil { - return fmt.Errorf("unable to encode setPassportElement#7b45d19c: field element: %w", err) - } - b.PutString(s.Password) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetPassportElementRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPassportElement#7b45d19c to nil") - } - if err := b.ConsumeID(SetPassportElementRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setPassportElement#7b45d19c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetPassportElementRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPassportElement#7b45d19c to nil") - } - { - value, err := DecodeInputPassportElement(b) - if err != nil { - return fmt.Errorf("unable to decode setPassportElement#7b45d19c: field element: %w", err) - } - s.Element = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setPassportElement#7b45d19c: field password: %w", err) - } - s.Password = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetPassportElementRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setPassportElement#7b45d19c as nil") - } - b.ObjStart() - b.PutID("setPassportElement") - b.Comma() - b.FieldStart("element") - if s.Element == nil { - return fmt.Errorf("unable to encode setPassportElement#7b45d19c: field element is nil") - } - if err := s.Element.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setPassportElement#7b45d19c: field element: %w", err) - } - b.Comma() - b.FieldStart("password") - b.PutString(s.Password) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetPassportElementRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setPassportElement#7b45d19c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setPassportElement"); err != nil { - return fmt.Errorf("unable to decode setPassportElement#7b45d19c: %w", err) - } - case "element": - value, err := DecodeTDLibJSONInputPassportElement(b) - if err != nil { - return fmt.Errorf("unable to decode setPassportElement#7b45d19c: field element: %w", err) - } - s.Element = value - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setPassportElement#7b45d19c: field password: %w", err) - } - s.Password = value - default: - return b.Skip() - } - return nil - }) -} - -// GetElement returns value of Element field. -func (s *SetPassportElementRequest) GetElement() (value InputPassportElementClass) { - if s == nil { - return - } - return s.Element -} - -// GetPassword returns value of Password field. -func (s *SetPassportElementRequest) GetPassword() (value string) { - if s == nil { - return - } - return s.Password -} - -// SetPassportElement invokes method setPassportElement#7b45d19c returning error if any. -func (c *Client) SetPassportElement(ctx context.Context, request *SetPassportElementRequest) (PassportElementClass, error) { - var result PassportElementBox - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.PassportElement, nil -} diff --git a/tdapi/tl_set_password_gen.go b/tdapi/tl_set_password_gen.go deleted file mode 100644 index a6ad3bac6..000000000 --- a/tdapi/tl_set_password_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetPasswordRequest represents TL type `setPassword#b8db46dd`. -type SetPasswordRequest struct { - // Previous 2-step verification password of the user - OldPassword string - // New 2-step verification password of the user; may be empty to remove the password - NewPassword string - // New password hint; may be empty - NewHint string - // Pass true to change also the recovery email address - SetRecoveryEmailAddress bool - // New recovery email address; may be empty - NewRecoveryEmailAddress string -} - -// SetPasswordRequestTypeID is TL type id of SetPasswordRequest. -const SetPasswordRequestTypeID = 0xb8db46dd - -// Ensuring interfaces in compile-time for SetPasswordRequest. -var ( - _ bin.Encoder = &SetPasswordRequest{} - _ bin.Decoder = &SetPasswordRequest{} - _ bin.BareEncoder = &SetPasswordRequest{} - _ bin.BareDecoder = &SetPasswordRequest{} -) - -func (s *SetPasswordRequest) Zero() bool { - if s == nil { - return true - } - if !(s.OldPassword == "") { - return false - } - if !(s.NewPassword == "") { - return false - } - if !(s.NewHint == "") { - return false - } - if !(s.SetRecoveryEmailAddress == false) { - return false - } - if !(s.NewRecoveryEmailAddress == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetPasswordRequest) String() string { - if s == nil { - return "SetPasswordRequest(nil)" - } - type Alias SetPasswordRequest - return fmt.Sprintf("SetPasswordRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetPasswordRequest) TypeID() uint32 { - return SetPasswordRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetPasswordRequest) TypeName() string { - return "setPassword" -} - -// TypeInfo returns info about TL type. -func (s *SetPasswordRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setPassword", - ID: SetPasswordRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OldPassword", - SchemaName: "old_password", - }, - { - Name: "NewPassword", - SchemaName: "new_password", - }, - { - Name: "NewHint", - SchemaName: "new_hint", - }, - { - Name: "SetRecoveryEmailAddress", - SchemaName: "set_recovery_email_address", - }, - { - Name: "NewRecoveryEmailAddress", - SchemaName: "new_recovery_email_address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetPasswordRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPassword#b8db46dd as nil") - } - b.PutID(SetPasswordRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetPasswordRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPassword#b8db46dd as nil") - } - b.PutString(s.OldPassword) - b.PutString(s.NewPassword) - b.PutString(s.NewHint) - b.PutBool(s.SetRecoveryEmailAddress) - b.PutString(s.NewRecoveryEmailAddress) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetPasswordRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPassword#b8db46dd to nil") - } - if err := b.ConsumeID(SetPasswordRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetPasswordRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPassword#b8db46dd to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: field old_password: %w", err) - } - s.OldPassword = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: field new_password: %w", err) - } - s.NewPassword = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: field new_hint: %w", err) - } - s.NewHint = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: field set_recovery_email_address: %w", err) - } - s.SetRecoveryEmailAddress = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: field new_recovery_email_address: %w", err) - } - s.NewRecoveryEmailAddress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetPasswordRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setPassword#b8db46dd as nil") - } - b.ObjStart() - b.PutID("setPassword") - b.Comma() - b.FieldStart("old_password") - b.PutString(s.OldPassword) - b.Comma() - b.FieldStart("new_password") - b.PutString(s.NewPassword) - b.Comma() - b.FieldStart("new_hint") - b.PutString(s.NewHint) - b.Comma() - b.FieldStart("set_recovery_email_address") - b.PutBool(s.SetRecoveryEmailAddress) - b.Comma() - b.FieldStart("new_recovery_email_address") - b.PutString(s.NewRecoveryEmailAddress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetPasswordRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setPassword#b8db46dd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setPassword"); err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: %w", err) - } - case "old_password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: field old_password: %w", err) - } - s.OldPassword = value - case "new_password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: field new_password: %w", err) - } - s.NewPassword = value - case "new_hint": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: field new_hint: %w", err) - } - s.NewHint = value - case "set_recovery_email_address": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: field set_recovery_email_address: %w", err) - } - s.SetRecoveryEmailAddress = value - case "new_recovery_email_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setPassword#b8db46dd: field new_recovery_email_address: %w", err) - } - s.NewRecoveryEmailAddress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOldPassword returns value of OldPassword field. -func (s *SetPasswordRequest) GetOldPassword() (value string) { - if s == nil { - return - } - return s.OldPassword -} - -// GetNewPassword returns value of NewPassword field. -func (s *SetPasswordRequest) GetNewPassword() (value string) { - if s == nil { - return - } - return s.NewPassword -} - -// GetNewHint returns value of NewHint field. -func (s *SetPasswordRequest) GetNewHint() (value string) { - if s == nil { - return - } - return s.NewHint -} - -// GetSetRecoveryEmailAddress returns value of SetRecoveryEmailAddress field. -func (s *SetPasswordRequest) GetSetRecoveryEmailAddress() (value bool) { - if s == nil { - return - } - return s.SetRecoveryEmailAddress -} - -// GetNewRecoveryEmailAddress returns value of NewRecoveryEmailAddress field. -func (s *SetPasswordRequest) GetNewRecoveryEmailAddress() (value string) { - if s == nil { - return - } - return s.NewRecoveryEmailAddress -} - -// SetPassword invokes method setPassword#b8db46dd returning error if any. -func (c *Client) SetPassword(ctx context.Context, request *SetPasswordRequest) (*PasswordState, error) { - var result PasswordState - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_set_personal_chat_gen.go b/tdapi/tl_set_personal_chat_gen.go deleted file mode 100644 index 13ca70fa7..000000000 --- a/tdapi/tl_set_personal_chat_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetPersonalChatRequest represents TL type `setPersonalChat#c04babb4`. -type SetPersonalChatRequest struct { - // Identifier of the new personal chat; pass 0 to remove the chat. Use - // getSuitablePersonalChats to get suitable chats - ChatID int64 -} - -// SetPersonalChatRequestTypeID is TL type id of SetPersonalChatRequest. -const SetPersonalChatRequestTypeID = 0xc04babb4 - -// Ensuring interfaces in compile-time for SetPersonalChatRequest. -var ( - _ bin.Encoder = &SetPersonalChatRequest{} - _ bin.Decoder = &SetPersonalChatRequest{} - _ bin.BareEncoder = &SetPersonalChatRequest{} - _ bin.BareDecoder = &SetPersonalChatRequest{} -) - -func (s *SetPersonalChatRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetPersonalChatRequest) String() string { - if s == nil { - return "SetPersonalChatRequest(nil)" - } - type Alias SetPersonalChatRequest - return fmt.Sprintf("SetPersonalChatRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetPersonalChatRequest) TypeID() uint32 { - return SetPersonalChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetPersonalChatRequest) TypeName() string { - return "setPersonalChat" -} - -// TypeInfo returns info about TL type. -func (s *SetPersonalChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setPersonalChat", - ID: SetPersonalChatRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetPersonalChatRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPersonalChat#c04babb4 as nil") - } - b.PutID(SetPersonalChatRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetPersonalChatRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPersonalChat#c04babb4 as nil") - } - b.PutInt53(s.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetPersonalChatRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPersonalChat#c04babb4 to nil") - } - if err := b.ConsumeID(SetPersonalChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setPersonalChat#c04babb4: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetPersonalChatRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPersonalChat#c04babb4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPersonalChat#c04babb4: field chat_id: %w", err) - } - s.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetPersonalChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setPersonalChat#c04babb4 as nil") - } - b.ObjStart() - b.PutID("setPersonalChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetPersonalChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setPersonalChat#c04babb4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setPersonalChat"); err != nil { - return fmt.Errorf("unable to decode setPersonalChat#c04babb4: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPersonalChat#c04babb4: field chat_id: %w", err) - } - s.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetPersonalChatRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// SetPersonalChat invokes method setPersonalChat#c04babb4 returning error if any. -func (c *Client) SetPersonalChat(ctx context.Context, chatid int64) error { - var ok Ok - - request := &SetPersonalChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_pinned_chats_gen.go b/tdapi/tl_set_pinned_chats_gen.go deleted file mode 100644 index cb1219d10..000000000 --- a/tdapi/tl_set_pinned_chats_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetPinnedChatsRequest represents TL type `setPinnedChats#c6c6edf1`. -type SetPinnedChatsRequest struct { - // Chat list in which to change the order of pinned chats - ChatList ChatListClass - // The new list of pinned chats - ChatIDs []int64 -} - -// SetPinnedChatsRequestTypeID is TL type id of SetPinnedChatsRequest. -const SetPinnedChatsRequestTypeID = 0xc6c6edf1 - -// Ensuring interfaces in compile-time for SetPinnedChatsRequest. -var ( - _ bin.Encoder = &SetPinnedChatsRequest{} - _ bin.Decoder = &SetPinnedChatsRequest{} - _ bin.BareEncoder = &SetPinnedChatsRequest{} - _ bin.BareDecoder = &SetPinnedChatsRequest{} -) - -func (s *SetPinnedChatsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatList == nil) { - return false - } - if !(s.ChatIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetPinnedChatsRequest) String() string { - if s == nil { - return "SetPinnedChatsRequest(nil)" - } - type Alias SetPinnedChatsRequest - return fmt.Sprintf("SetPinnedChatsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetPinnedChatsRequest) TypeID() uint32 { - return SetPinnedChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetPinnedChatsRequest) TypeName() string { - return "setPinnedChats" -} - -// TypeInfo returns info about TL type. -func (s *SetPinnedChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setPinnedChats", - ID: SetPinnedChatsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatList", - SchemaName: "chat_list", - }, - { - Name: "ChatIDs", - SchemaName: "chat_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetPinnedChatsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPinnedChats#c6c6edf1 as nil") - } - b.PutID(SetPinnedChatsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetPinnedChatsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPinnedChats#c6c6edf1 as nil") - } - if s.ChatList == nil { - return fmt.Errorf("unable to encode setPinnedChats#c6c6edf1: field chat_list is nil") - } - if err := s.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode setPinnedChats#c6c6edf1: field chat_list: %w", err) - } - b.PutInt(len(s.ChatIDs)) - for _, v := range s.ChatIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetPinnedChatsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPinnedChats#c6c6edf1 to nil") - } - if err := b.ConsumeID(SetPinnedChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setPinnedChats#c6c6edf1: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetPinnedChatsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPinnedChats#c6c6edf1 to nil") - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode setPinnedChats#c6c6edf1: field chat_list: %w", err) - } - s.ChatList = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode setPinnedChats#c6c6edf1: field chat_ids: %w", err) - } - - if headerLen > 0 { - s.ChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPinnedChats#c6c6edf1: field chat_ids: %w", err) - } - s.ChatIDs = append(s.ChatIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetPinnedChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setPinnedChats#c6c6edf1 as nil") - } - b.ObjStart() - b.PutID("setPinnedChats") - b.Comma() - b.FieldStart("chat_list") - if s.ChatList == nil { - return fmt.Errorf("unable to encode setPinnedChats#c6c6edf1: field chat_list is nil") - } - if err := s.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setPinnedChats#c6c6edf1: field chat_list: %w", err) - } - b.Comma() - b.FieldStart("chat_ids") - b.ArrStart() - for _, v := range s.ChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetPinnedChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setPinnedChats#c6c6edf1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setPinnedChats"); err != nil { - return fmt.Errorf("unable to decode setPinnedChats#c6c6edf1: %w", err) - } - case "chat_list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode setPinnedChats#c6c6edf1: field chat_list: %w", err) - } - s.ChatList = value - case "chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPinnedChats#c6c6edf1: field chat_ids: %w", err) - } - s.ChatIDs = append(s.ChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode setPinnedChats#c6c6edf1: field chat_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatList returns value of ChatList field. -func (s *SetPinnedChatsRequest) GetChatList() (value ChatListClass) { - if s == nil { - return - } - return s.ChatList -} - -// GetChatIDs returns value of ChatIDs field. -func (s *SetPinnedChatsRequest) GetChatIDs() (value []int64) { - if s == nil { - return - } - return s.ChatIDs -} - -// SetPinnedChats invokes method setPinnedChats#c6c6edf1 returning error if any. -func (c *Client) SetPinnedChats(ctx context.Context, request *SetPinnedChatsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_pinned_forum_topics_gen.go b/tdapi/tl_set_pinned_forum_topics_gen.go deleted file mode 100644 index c1fe64f4d..000000000 --- a/tdapi/tl_set_pinned_forum_topics_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetPinnedForumTopicsRequest represents TL type `setPinnedForumTopics#ddf26f21`. -type SetPinnedForumTopicsRequest struct { - // Chat identifier - ChatID int64 - // The new list of pinned forum topics - MessageThreadIDs []int64 -} - -// SetPinnedForumTopicsRequestTypeID is TL type id of SetPinnedForumTopicsRequest. -const SetPinnedForumTopicsRequestTypeID = 0xddf26f21 - -// Ensuring interfaces in compile-time for SetPinnedForumTopicsRequest. -var ( - _ bin.Encoder = &SetPinnedForumTopicsRequest{} - _ bin.Decoder = &SetPinnedForumTopicsRequest{} - _ bin.BareEncoder = &SetPinnedForumTopicsRequest{} - _ bin.BareDecoder = &SetPinnedForumTopicsRequest{} -) - -func (s *SetPinnedForumTopicsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageThreadIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetPinnedForumTopicsRequest) String() string { - if s == nil { - return "SetPinnedForumTopicsRequest(nil)" - } - type Alias SetPinnedForumTopicsRequest - return fmt.Sprintf("SetPinnedForumTopicsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetPinnedForumTopicsRequest) TypeID() uint32 { - return SetPinnedForumTopicsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetPinnedForumTopicsRequest) TypeName() string { - return "setPinnedForumTopics" -} - -// TypeInfo returns info about TL type. -func (s *SetPinnedForumTopicsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setPinnedForumTopics", - ID: SetPinnedForumTopicsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadIDs", - SchemaName: "message_thread_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetPinnedForumTopicsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPinnedForumTopics#ddf26f21 as nil") - } - b.PutID(SetPinnedForumTopicsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetPinnedForumTopicsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPinnedForumTopics#ddf26f21 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt(len(s.MessageThreadIDs)) - for _, v := range s.MessageThreadIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetPinnedForumTopicsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPinnedForumTopics#ddf26f21 to nil") - } - if err := b.ConsumeID(SetPinnedForumTopicsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setPinnedForumTopics#ddf26f21: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetPinnedForumTopicsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPinnedForumTopics#ddf26f21 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPinnedForumTopics#ddf26f21: field chat_id: %w", err) - } - s.ChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode setPinnedForumTopics#ddf26f21: field message_thread_ids: %w", err) - } - - if headerLen > 0 { - s.MessageThreadIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPinnedForumTopics#ddf26f21: field message_thread_ids: %w", err) - } - s.MessageThreadIDs = append(s.MessageThreadIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetPinnedForumTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setPinnedForumTopics#ddf26f21 as nil") - } - b.ObjStart() - b.PutID("setPinnedForumTopics") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_thread_ids") - b.ArrStart() - for _, v := range s.MessageThreadIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetPinnedForumTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setPinnedForumTopics#ddf26f21 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setPinnedForumTopics"); err != nil { - return fmt.Errorf("unable to decode setPinnedForumTopics#ddf26f21: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPinnedForumTopics#ddf26f21: field chat_id: %w", err) - } - s.ChatID = value - case "message_thread_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPinnedForumTopics#ddf26f21: field message_thread_ids: %w", err) - } - s.MessageThreadIDs = append(s.MessageThreadIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode setPinnedForumTopics#ddf26f21: field message_thread_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetPinnedForumTopicsRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageThreadIDs returns value of MessageThreadIDs field. -func (s *SetPinnedForumTopicsRequest) GetMessageThreadIDs() (value []int64) { - if s == nil { - return - } - return s.MessageThreadIDs -} - -// SetPinnedForumTopics invokes method setPinnedForumTopics#ddf26f21 returning error if any. -func (c *Client) SetPinnedForumTopics(ctx context.Context, request *SetPinnedForumTopicsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_pinned_saved_messages_topics_gen.go b/tdapi/tl_set_pinned_saved_messages_topics_gen.go deleted file mode 100644 index 55f28297f..000000000 --- a/tdapi/tl_set_pinned_saved_messages_topics_gen.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetPinnedSavedMessagesTopicsRequest represents TL type `setPinnedSavedMessagesTopics#475a1110`. -type SetPinnedSavedMessagesTopicsRequest struct { - // Identifiers of the new pinned Saved Messages topics - SavedMessagesTopicIDs []int64 -} - -// SetPinnedSavedMessagesTopicsRequestTypeID is TL type id of SetPinnedSavedMessagesTopicsRequest. -const SetPinnedSavedMessagesTopicsRequestTypeID = 0x475a1110 - -// Ensuring interfaces in compile-time for SetPinnedSavedMessagesTopicsRequest. -var ( - _ bin.Encoder = &SetPinnedSavedMessagesTopicsRequest{} - _ bin.Decoder = &SetPinnedSavedMessagesTopicsRequest{} - _ bin.BareEncoder = &SetPinnedSavedMessagesTopicsRequest{} - _ bin.BareDecoder = &SetPinnedSavedMessagesTopicsRequest{} -) - -func (s *SetPinnedSavedMessagesTopicsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.SavedMessagesTopicIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetPinnedSavedMessagesTopicsRequest) String() string { - if s == nil { - return "SetPinnedSavedMessagesTopicsRequest(nil)" - } - type Alias SetPinnedSavedMessagesTopicsRequest - return fmt.Sprintf("SetPinnedSavedMessagesTopicsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetPinnedSavedMessagesTopicsRequest) TypeID() uint32 { - return SetPinnedSavedMessagesTopicsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetPinnedSavedMessagesTopicsRequest) TypeName() string { - return "setPinnedSavedMessagesTopics" -} - -// TypeInfo returns info about TL type. -func (s *SetPinnedSavedMessagesTopicsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setPinnedSavedMessagesTopics", - ID: SetPinnedSavedMessagesTopicsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SavedMessagesTopicIDs", - SchemaName: "saved_messages_topic_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetPinnedSavedMessagesTopicsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPinnedSavedMessagesTopics#475a1110 as nil") - } - b.PutID(SetPinnedSavedMessagesTopicsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetPinnedSavedMessagesTopicsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPinnedSavedMessagesTopics#475a1110 as nil") - } - b.PutInt(len(s.SavedMessagesTopicIDs)) - for _, v := range s.SavedMessagesTopicIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetPinnedSavedMessagesTopicsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPinnedSavedMessagesTopics#475a1110 to nil") - } - if err := b.ConsumeID(SetPinnedSavedMessagesTopicsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetPinnedSavedMessagesTopicsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPinnedSavedMessagesTopics#475a1110 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: field saved_messages_topic_ids: %w", err) - } - - if headerLen > 0 { - s.SavedMessagesTopicIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: field saved_messages_topic_ids: %w", err) - } - s.SavedMessagesTopicIDs = append(s.SavedMessagesTopicIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetPinnedSavedMessagesTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setPinnedSavedMessagesTopics#475a1110 as nil") - } - b.ObjStart() - b.PutID("setPinnedSavedMessagesTopics") - b.Comma() - b.FieldStart("saved_messages_topic_ids") - b.ArrStart() - for _, v := range s.SavedMessagesTopicIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetPinnedSavedMessagesTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setPinnedSavedMessagesTopics#475a1110 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setPinnedSavedMessagesTopics"); err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: %w", err) - } - case "saved_messages_topic_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: field saved_messages_topic_ids: %w", err) - } - s.SavedMessagesTopicIDs = append(s.SavedMessagesTopicIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode setPinnedSavedMessagesTopics#475a1110: field saved_messages_topic_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedMessagesTopicIDs returns value of SavedMessagesTopicIDs field. -func (s *SetPinnedSavedMessagesTopicsRequest) GetSavedMessagesTopicIDs() (value []int64) { - if s == nil { - return - } - return s.SavedMessagesTopicIDs -} - -// SetPinnedSavedMessagesTopics invokes method setPinnedSavedMessagesTopics#475a1110 returning error if any. -func (c *Client) SetPinnedSavedMessagesTopics(ctx context.Context, savedmessagestopicids []int64) error { - var ok Ok - - request := &SetPinnedSavedMessagesTopicsRequest{ - SavedMessagesTopicIDs: savedmessagestopicids, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_poll_answer_gen.go b/tdapi/tl_set_poll_answer_gen.go deleted file mode 100644 index 375de6cea..000000000 --- a/tdapi/tl_set_poll_answer_gen.go +++ /dev/null @@ -1,296 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetPollAnswerRequest represents TL type `setPollAnswer#5303b916`. -type SetPollAnswerRequest struct { - // Identifier of the chat to which the poll belongs - ChatID int64 - // Identifier of the message containing the poll - MessageID int64 - // 0-based identifiers of answer options, chosen by the user. User can choose more than 1 - // answer option only is the poll allows multiple answers - OptionIDs []int32 -} - -// SetPollAnswerRequestTypeID is TL type id of SetPollAnswerRequest. -const SetPollAnswerRequestTypeID = 0x5303b916 - -// Ensuring interfaces in compile-time for SetPollAnswerRequest. -var ( - _ bin.Encoder = &SetPollAnswerRequest{} - _ bin.Decoder = &SetPollAnswerRequest{} - _ bin.BareEncoder = &SetPollAnswerRequest{} - _ bin.BareDecoder = &SetPollAnswerRequest{} -) - -func (s *SetPollAnswerRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - if !(s.OptionIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetPollAnswerRequest) String() string { - if s == nil { - return "SetPollAnswerRequest(nil)" - } - type Alias SetPollAnswerRequest - return fmt.Sprintf("SetPollAnswerRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetPollAnswerRequest) TypeID() uint32 { - return SetPollAnswerRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetPollAnswerRequest) TypeName() string { - return "setPollAnswer" -} - -// TypeInfo returns info about TL type. -func (s *SetPollAnswerRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setPollAnswer", - ID: SetPollAnswerRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "OptionIDs", - SchemaName: "option_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetPollAnswerRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPollAnswer#5303b916 as nil") - } - b.PutID(SetPollAnswerRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetPollAnswerRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setPollAnswer#5303b916 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - b.PutInt(len(s.OptionIDs)) - for _, v := range s.OptionIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetPollAnswerRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPollAnswer#5303b916 to nil") - } - if err := b.ConsumeID(SetPollAnswerRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setPollAnswer#5303b916: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetPollAnswerRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setPollAnswer#5303b916 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPollAnswer#5303b916: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPollAnswer#5303b916: field message_id: %w", err) - } - s.MessageID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode setPollAnswer#5303b916: field option_ids: %w", err) - } - - if headerLen > 0 { - s.OptionIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setPollAnswer#5303b916: field option_ids: %w", err) - } - s.OptionIDs = append(s.OptionIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetPollAnswerRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setPollAnswer#5303b916 as nil") - } - b.ObjStart() - b.PutID("setPollAnswer") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("option_ids") - b.ArrStart() - for _, v := range s.OptionIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetPollAnswerRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setPollAnswer#5303b916 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setPollAnswer"); err != nil { - return fmt.Errorf("unable to decode setPollAnswer#5303b916: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPollAnswer#5303b916: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setPollAnswer#5303b916: field message_id: %w", err) - } - s.MessageID = value - case "option_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setPollAnswer#5303b916: field option_ids: %w", err) - } - s.OptionIDs = append(s.OptionIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode setPollAnswer#5303b916: field option_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetPollAnswerRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *SetPollAnswerRequest) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetOptionIDs returns value of OptionIDs field. -func (s *SetPollAnswerRequest) GetOptionIDs() (value []int32) { - if s == nil { - return - } - return s.OptionIDs -} - -// SetPollAnswer invokes method setPollAnswer#5303b916 returning error if any. -func (c *Client) SetPollAnswer(ctx context.Context, request *SetPollAnswerRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_profile_accent_color_gen.go b/tdapi/tl_set_profile_accent_color_gen.go deleted file mode 100644 index d5cc0217b..000000000 --- a/tdapi/tl_set_profile_accent_color_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetProfileAccentColorRequest represents TL type `setProfileAccentColor#899bc168`. -type SetProfileAccentColorRequest struct { - // Identifier of the accent color to use for profile; pass -1 if none - ProfileAccentColorID int32 - // Identifier of a custom emoji to be shown on the user's profile photo background; 0 if - // none - ProfileBackgroundCustomEmojiID int64 -} - -// SetProfileAccentColorRequestTypeID is TL type id of SetProfileAccentColorRequest. -const SetProfileAccentColorRequestTypeID = 0x899bc168 - -// Ensuring interfaces in compile-time for SetProfileAccentColorRequest. -var ( - _ bin.Encoder = &SetProfileAccentColorRequest{} - _ bin.Decoder = &SetProfileAccentColorRequest{} - _ bin.BareEncoder = &SetProfileAccentColorRequest{} - _ bin.BareDecoder = &SetProfileAccentColorRequest{} -) - -func (s *SetProfileAccentColorRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ProfileAccentColorID == 0) { - return false - } - if !(s.ProfileBackgroundCustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetProfileAccentColorRequest) String() string { - if s == nil { - return "SetProfileAccentColorRequest(nil)" - } - type Alias SetProfileAccentColorRequest - return fmt.Sprintf("SetProfileAccentColorRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetProfileAccentColorRequest) TypeID() uint32 { - return SetProfileAccentColorRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetProfileAccentColorRequest) TypeName() string { - return "setProfileAccentColor" -} - -// TypeInfo returns info about TL type. -func (s *SetProfileAccentColorRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setProfileAccentColor", - ID: SetProfileAccentColorRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ProfileAccentColorID", - SchemaName: "profile_accent_color_id", - }, - { - Name: "ProfileBackgroundCustomEmojiID", - SchemaName: "profile_background_custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetProfileAccentColorRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setProfileAccentColor#899bc168 as nil") - } - b.PutID(SetProfileAccentColorRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetProfileAccentColorRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setProfileAccentColor#899bc168 as nil") - } - b.PutInt32(s.ProfileAccentColorID) - b.PutLong(s.ProfileBackgroundCustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetProfileAccentColorRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setProfileAccentColor#899bc168 to nil") - } - if err := b.ConsumeID(SetProfileAccentColorRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetProfileAccentColorRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setProfileAccentColor#899bc168 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: field profile_accent_color_id: %w", err) - } - s.ProfileAccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: field profile_background_custom_emoji_id: %w", err) - } - s.ProfileBackgroundCustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetProfileAccentColorRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setProfileAccentColor#899bc168 as nil") - } - b.ObjStart() - b.PutID("setProfileAccentColor") - b.Comma() - b.FieldStart("profile_accent_color_id") - b.PutInt32(s.ProfileAccentColorID) - b.Comma() - b.FieldStart("profile_background_custom_emoji_id") - b.PutLong(s.ProfileBackgroundCustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetProfileAccentColorRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setProfileAccentColor#899bc168 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setProfileAccentColor"); err != nil { - return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: %w", err) - } - case "profile_accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: field profile_accent_color_id: %w", err) - } - s.ProfileAccentColorID = value - case "profile_background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setProfileAccentColor#899bc168: field profile_background_custom_emoji_id: %w", err) - } - s.ProfileBackgroundCustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetProfileAccentColorID returns value of ProfileAccentColorID field. -func (s *SetProfileAccentColorRequest) GetProfileAccentColorID() (value int32) { - if s == nil { - return - } - return s.ProfileAccentColorID -} - -// GetProfileBackgroundCustomEmojiID returns value of ProfileBackgroundCustomEmojiID field. -func (s *SetProfileAccentColorRequest) GetProfileBackgroundCustomEmojiID() (value int64) { - if s == nil { - return - } - return s.ProfileBackgroundCustomEmojiID -} - -// SetProfileAccentColor invokes method setProfileAccentColor#899bc168 returning error if any. -func (c *Client) SetProfileAccentColor(ctx context.Context, request *SetProfileAccentColorRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_profile_photo_gen.go b/tdapi/tl_set_profile_photo_gen.go deleted file mode 100644 index 5515e7903..000000000 --- a/tdapi/tl_set_profile_photo_gen.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetProfilePhotoRequest represents TL type `setProfilePhoto#85ea05ed`. -type SetProfilePhotoRequest struct { - // Profile photo to set - Photo InputChatPhotoClass - // Pass true to set a public photo, which will be visible even the main photo is hidden - // by privacy settings - IsPublic bool -} - -// SetProfilePhotoRequestTypeID is TL type id of SetProfilePhotoRequest. -const SetProfilePhotoRequestTypeID = 0x85ea05ed - -// Ensuring interfaces in compile-time for SetProfilePhotoRequest. -var ( - _ bin.Encoder = &SetProfilePhotoRequest{} - _ bin.Decoder = &SetProfilePhotoRequest{} - _ bin.BareEncoder = &SetProfilePhotoRequest{} - _ bin.BareDecoder = &SetProfilePhotoRequest{} -) - -func (s *SetProfilePhotoRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Photo == nil) { - return false - } - if !(s.IsPublic == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetProfilePhotoRequest) String() string { - if s == nil { - return "SetProfilePhotoRequest(nil)" - } - type Alias SetProfilePhotoRequest - return fmt.Sprintf("SetProfilePhotoRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetProfilePhotoRequest) TypeID() uint32 { - return SetProfilePhotoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetProfilePhotoRequest) TypeName() string { - return "setProfilePhoto" -} - -// TypeInfo returns info about TL type. -func (s *SetProfilePhotoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setProfilePhoto", - ID: SetProfilePhotoRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "IsPublic", - SchemaName: "is_public", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetProfilePhotoRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setProfilePhoto#85ea05ed as nil") - } - b.PutID(SetProfilePhotoRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetProfilePhotoRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setProfilePhoto#85ea05ed as nil") - } - if s.Photo == nil { - return fmt.Errorf("unable to encode setProfilePhoto#85ea05ed: field photo is nil") - } - if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode setProfilePhoto#85ea05ed: field photo: %w", err) - } - b.PutBool(s.IsPublic) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetProfilePhotoRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setProfilePhoto#85ea05ed to nil") - } - if err := b.ConsumeID(SetProfilePhotoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setProfilePhoto#85ea05ed: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetProfilePhotoRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setProfilePhoto#85ea05ed to nil") - } - { - value, err := DecodeInputChatPhoto(b) - if err != nil { - return fmt.Errorf("unable to decode setProfilePhoto#85ea05ed: field photo: %w", err) - } - s.Photo = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setProfilePhoto#85ea05ed: field is_public: %w", err) - } - s.IsPublic = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetProfilePhotoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setProfilePhoto#85ea05ed as nil") - } - b.ObjStart() - b.PutID("setProfilePhoto") - b.Comma() - b.FieldStart("photo") - if s.Photo == nil { - return fmt.Errorf("unable to encode setProfilePhoto#85ea05ed: field photo is nil") - } - if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setProfilePhoto#85ea05ed: field photo: %w", err) - } - b.Comma() - b.FieldStart("is_public") - b.PutBool(s.IsPublic) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetProfilePhotoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setProfilePhoto#85ea05ed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setProfilePhoto"); err != nil { - return fmt.Errorf("unable to decode setProfilePhoto#85ea05ed: %w", err) - } - case "photo": - value, err := DecodeTDLibJSONInputChatPhoto(b) - if err != nil { - return fmt.Errorf("unable to decode setProfilePhoto#85ea05ed: field photo: %w", err) - } - s.Photo = value - case "is_public": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setProfilePhoto#85ea05ed: field is_public: %w", err) - } - s.IsPublic = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (s *SetProfilePhotoRequest) GetPhoto() (value InputChatPhotoClass) { - if s == nil { - return - } - return s.Photo -} - -// GetIsPublic returns value of IsPublic field. -func (s *SetProfilePhotoRequest) GetIsPublic() (value bool) { - if s == nil { - return - } - return s.IsPublic -} - -// SetProfilePhoto invokes method setProfilePhoto#85ea05ed returning error if any. -func (c *Client) SetProfilePhoto(ctx context.Context, request *SetProfilePhotoRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_quick_reply_shortcut_name_gen.go b/tdapi/tl_set_quick_reply_shortcut_name_gen.go deleted file mode 100644 index 803fc5fbe..000000000 --- a/tdapi/tl_set_quick_reply_shortcut_name_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetQuickReplyShortcutNameRequest represents TL type `setQuickReplyShortcutName#b20f471`. -type SetQuickReplyShortcutNameRequest struct { - // Unique identifier of the quick reply shortcut - ShortcutID int32 - // New name for the shortcut. Use checkQuickReplyShortcutName to check its validness - Name string -} - -// SetQuickReplyShortcutNameRequestTypeID is TL type id of SetQuickReplyShortcutNameRequest. -const SetQuickReplyShortcutNameRequestTypeID = 0xb20f471 - -// Ensuring interfaces in compile-time for SetQuickReplyShortcutNameRequest. -var ( - _ bin.Encoder = &SetQuickReplyShortcutNameRequest{} - _ bin.Decoder = &SetQuickReplyShortcutNameRequest{} - _ bin.BareEncoder = &SetQuickReplyShortcutNameRequest{} - _ bin.BareDecoder = &SetQuickReplyShortcutNameRequest{} -) - -func (s *SetQuickReplyShortcutNameRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ShortcutID == 0) { - return false - } - if !(s.Name == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetQuickReplyShortcutNameRequest) String() string { - if s == nil { - return "SetQuickReplyShortcutNameRequest(nil)" - } - type Alias SetQuickReplyShortcutNameRequest - return fmt.Sprintf("SetQuickReplyShortcutNameRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetQuickReplyShortcutNameRequest) TypeID() uint32 { - return SetQuickReplyShortcutNameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetQuickReplyShortcutNameRequest) TypeName() string { - return "setQuickReplyShortcutName" -} - -// TypeInfo returns info about TL type. -func (s *SetQuickReplyShortcutNameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setQuickReplyShortcutName", - ID: SetQuickReplyShortcutNameRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutID", - SchemaName: "shortcut_id", - }, - { - Name: "Name", - SchemaName: "name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetQuickReplyShortcutNameRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setQuickReplyShortcutName#b20f471 as nil") - } - b.PutID(SetQuickReplyShortcutNameRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetQuickReplyShortcutNameRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setQuickReplyShortcutName#b20f471 as nil") - } - b.PutInt32(s.ShortcutID) - b.PutString(s.Name) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetQuickReplyShortcutNameRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setQuickReplyShortcutName#b20f471 to nil") - } - if err := b.ConsumeID(SetQuickReplyShortcutNameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetQuickReplyShortcutNameRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setQuickReplyShortcutName#b20f471 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: field shortcut_id: %w", err) - } - s.ShortcutID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: field name: %w", err) - } - s.Name = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetQuickReplyShortcutNameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setQuickReplyShortcutName#b20f471 as nil") - } - b.ObjStart() - b.PutID("setQuickReplyShortcutName") - b.Comma() - b.FieldStart("shortcut_id") - b.PutInt32(s.ShortcutID) - b.Comma() - b.FieldStart("name") - b.PutString(s.Name) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetQuickReplyShortcutNameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setQuickReplyShortcutName#b20f471 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setQuickReplyShortcutName"); err != nil { - return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: %w", err) - } - case "shortcut_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: field shortcut_id: %w", err) - } - s.ShortcutID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setQuickReplyShortcutName#b20f471: field name: %w", err) - } - s.Name = value - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutID returns value of ShortcutID field. -func (s *SetQuickReplyShortcutNameRequest) GetShortcutID() (value int32) { - if s == nil { - return - } - return s.ShortcutID -} - -// GetName returns value of Name field. -func (s *SetQuickReplyShortcutNameRequest) GetName() (value string) { - if s == nil { - return - } - return s.Name -} - -// SetQuickReplyShortcutName invokes method setQuickReplyShortcutName#b20f471 returning error if any. -func (c *Client) SetQuickReplyShortcutName(ctx context.Context, request *SetQuickReplyShortcutNameRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_reaction_notification_settings_gen.go b/tdapi/tl_set_reaction_notification_settings_gen.go deleted file mode 100644 index c75619608..000000000 --- a/tdapi/tl_set_reaction_notification_settings_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetReactionNotificationSettingsRequest represents TL type `setReactionNotificationSettings#46b2d495`. -type SetReactionNotificationSettingsRequest struct { - // The new notification settings for reactions - NotificationSettings ReactionNotificationSettings -} - -// SetReactionNotificationSettingsRequestTypeID is TL type id of SetReactionNotificationSettingsRequest. -const SetReactionNotificationSettingsRequestTypeID = 0x46b2d495 - -// Ensuring interfaces in compile-time for SetReactionNotificationSettingsRequest. -var ( - _ bin.Encoder = &SetReactionNotificationSettingsRequest{} - _ bin.Decoder = &SetReactionNotificationSettingsRequest{} - _ bin.BareEncoder = &SetReactionNotificationSettingsRequest{} - _ bin.BareDecoder = &SetReactionNotificationSettingsRequest{} -) - -func (s *SetReactionNotificationSettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.NotificationSettings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetReactionNotificationSettingsRequest) String() string { - if s == nil { - return "SetReactionNotificationSettingsRequest(nil)" - } - type Alias SetReactionNotificationSettingsRequest - return fmt.Sprintf("SetReactionNotificationSettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetReactionNotificationSettingsRequest) TypeID() uint32 { - return SetReactionNotificationSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetReactionNotificationSettingsRequest) TypeName() string { - return "setReactionNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (s *SetReactionNotificationSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setReactionNotificationSettings", - ID: SetReactionNotificationSettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NotificationSettings", - SchemaName: "notification_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetReactionNotificationSettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setReactionNotificationSettings#46b2d495 as nil") - } - b.PutID(SetReactionNotificationSettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetReactionNotificationSettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setReactionNotificationSettings#46b2d495 as nil") - } - if err := s.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setReactionNotificationSettings#46b2d495: field notification_settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetReactionNotificationSettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setReactionNotificationSettings#46b2d495 to nil") - } - if err := b.ConsumeID(SetReactionNotificationSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setReactionNotificationSettings#46b2d495: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetReactionNotificationSettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setReactionNotificationSettings#46b2d495 to nil") - } - { - if err := s.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setReactionNotificationSettings#46b2d495: field notification_settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetReactionNotificationSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setReactionNotificationSettings#46b2d495 as nil") - } - b.ObjStart() - b.PutID("setReactionNotificationSettings") - b.Comma() - b.FieldStart("notification_settings") - if err := s.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setReactionNotificationSettings#46b2d495: field notification_settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetReactionNotificationSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setReactionNotificationSettings#46b2d495 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setReactionNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode setReactionNotificationSettings#46b2d495: %w", err) - } - case "notification_settings": - if err := s.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setReactionNotificationSettings#46b2d495: field notification_settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetNotificationSettings returns value of NotificationSettings field. -func (s *SetReactionNotificationSettingsRequest) GetNotificationSettings() (value ReactionNotificationSettings) { - if s == nil { - return - } - return s.NotificationSettings -} - -// SetReactionNotificationSettings invokes method setReactionNotificationSettings#46b2d495 returning error if any. -func (c *Client) SetReactionNotificationSettings(ctx context.Context, notificationsettings ReactionNotificationSettings) error { - var ok Ok - - request := &SetReactionNotificationSettingsRequest{ - NotificationSettings: notificationsettings, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_read_date_privacy_settings_gen.go b/tdapi/tl_set_read_date_privacy_settings_gen.go deleted file mode 100644 index a4f556407..000000000 --- a/tdapi/tl_set_read_date_privacy_settings_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetReadDatePrivacySettingsRequest represents TL type `setReadDatePrivacySettings#1d7086b6`. -type SetReadDatePrivacySettingsRequest struct { - // New settings - Settings ReadDatePrivacySettings -} - -// SetReadDatePrivacySettingsRequestTypeID is TL type id of SetReadDatePrivacySettingsRequest. -const SetReadDatePrivacySettingsRequestTypeID = 0x1d7086b6 - -// Ensuring interfaces in compile-time for SetReadDatePrivacySettingsRequest. -var ( - _ bin.Encoder = &SetReadDatePrivacySettingsRequest{} - _ bin.Decoder = &SetReadDatePrivacySettingsRequest{} - _ bin.BareEncoder = &SetReadDatePrivacySettingsRequest{} - _ bin.BareDecoder = &SetReadDatePrivacySettingsRequest{} -) - -func (s *SetReadDatePrivacySettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Settings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetReadDatePrivacySettingsRequest) String() string { - if s == nil { - return "SetReadDatePrivacySettingsRequest(nil)" - } - type Alias SetReadDatePrivacySettingsRequest - return fmt.Sprintf("SetReadDatePrivacySettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetReadDatePrivacySettingsRequest) TypeID() uint32 { - return SetReadDatePrivacySettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetReadDatePrivacySettingsRequest) TypeName() string { - return "setReadDatePrivacySettings" -} - -// TypeInfo returns info about TL type. -func (s *SetReadDatePrivacySettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setReadDatePrivacySettings", - ID: SetReadDatePrivacySettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Settings", - SchemaName: "settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetReadDatePrivacySettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setReadDatePrivacySettings#1d7086b6 as nil") - } - b.PutID(SetReadDatePrivacySettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetReadDatePrivacySettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setReadDatePrivacySettings#1d7086b6 as nil") - } - if err := s.Settings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setReadDatePrivacySettings#1d7086b6: field settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetReadDatePrivacySettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setReadDatePrivacySettings#1d7086b6 to nil") - } - if err := b.ConsumeID(SetReadDatePrivacySettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setReadDatePrivacySettings#1d7086b6: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetReadDatePrivacySettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setReadDatePrivacySettings#1d7086b6 to nil") - } - { - if err := s.Settings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setReadDatePrivacySettings#1d7086b6: field settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetReadDatePrivacySettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setReadDatePrivacySettings#1d7086b6 as nil") - } - b.ObjStart() - b.PutID("setReadDatePrivacySettings") - b.Comma() - b.FieldStart("settings") - if err := s.Settings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setReadDatePrivacySettings#1d7086b6: field settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetReadDatePrivacySettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setReadDatePrivacySettings#1d7086b6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setReadDatePrivacySettings"); err != nil { - return fmt.Errorf("unable to decode setReadDatePrivacySettings#1d7086b6: %w", err) - } - case "settings": - if err := s.Settings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setReadDatePrivacySettings#1d7086b6: field settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSettings returns value of Settings field. -func (s *SetReadDatePrivacySettingsRequest) GetSettings() (value ReadDatePrivacySettings) { - if s == nil { - return - } - return s.Settings -} - -// SetReadDatePrivacySettings invokes method setReadDatePrivacySettings#1d7086b6 returning error if any. -func (c *Client) SetReadDatePrivacySettings(ctx context.Context, settings ReadDatePrivacySettings) error { - var ok Ok - - request := &SetReadDatePrivacySettingsRequest{ - Settings: settings, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_recovery_email_address_gen.go b/tdapi/tl_set_recovery_email_address_gen.go deleted file mode 100644 index cfe0e06fa..000000000 --- a/tdapi/tl_set_recovery_email_address_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetRecoveryEmailAddressRequest represents TL type `setRecoveryEmailAddress#89df939f`. -type SetRecoveryEmailAddressRequest struct { - // The 2-step verification password of the current user - Password string - // New recovery email address - NewRecoveryEmailAddress string -} - -// SetRecoveryEmailAddressRequestTypeID is TL type id of SetRecoveryEmailAddressRequest. -const SetRecoveryEmailAddressRequestTypeID = 0x89df939f - -// Ensuring interfaces in compile-time for SetRecoveryEmailAddressRequest. -var ( - _ bin.Encoder = &SetRecoveryEmailAddressRequest{} - _ bin.Decoder = &SetRecoveryEmailAddressRequest{} - _ bin.BareEncoder = &SetRecoveryEmailAddressRequest{} - _ bin.BareDecoder = &SetRecoveryEmailAddressRequest{} -) - -func (s *SetRecoveryEmailAddressRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Password == "") { - return false - } - if !(s.NewRecoveryEmailAddress == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetRecoveryEmailAddressRequest) String() string { - if s == nil { - return "SetRecoveryEmailAddressRequest(nil)" - } - type Alias SetRecoveryEmailAddressRequest - return fmt.Sprintf("SetRecoveryEmailAddressRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetRecoveryEmailAddressRequest) TypeID() uint32 { - return SetRecoveryEmailAddressRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetRecoveryEmailAddressRequest) TypeName() string { - return "setRecoveryEmailAddress" -} - -// TypeInfo returns info about TL type. -func (s *SetRecoveryEmailAddressRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setRecoveryEmailAddress", - ID: SetRecoveryEmailAddressRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Password", - SchemaName: "password", - }, - { - Name: "NewRecoveryEmailAddress", - SchemaName: "new_recovery_email_address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetRecoveryEmailAddressRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setRecoveryEmailAddress#89df939f as nil") - } - b.PutID(SetRecoveryEmailAddressRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetRecoveryEmailAddressRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setRecoveryEmailAddress#89df939f as nil") - } - b.PutString(s.Password) - b.PutString(s.NewRecoveryEmailAddress) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetRecoveryEmailAddressRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setRecoveryEmailAddress#89df939f to nil") - } - if err := b.ConsumeID(SetRecoveryEmailAddressRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setRecoveryEmailAddress#89df939f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetRecoveryEmailAddressRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setRecoveryEmailAddress#89df939f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setRecoveryEmailAddress#89df939f: field password: %w", err) - } - s.Password = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setRecoveryEmailAddress#89df939f: field new_recovery_email_address: %w", err) - } - s.NewRecoveryEmailAddress = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetRecoveryEmailAddressRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setRecoveryEmailAddress#89df939f as nil") - } - b.ObjStart() - b.PutID("setRecoveryEmailAddress") - b.Comma() - b.FieldStart("password") - b.PutString(s.Password) - b.Comma() - b.FieldStart("new_recovery_email_address") - b.PutString(s.NewRecoveryEmailAddress) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetRecoveryEmailAddressRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setRecoveryEmailAddress#89df939f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setRecoveryEmailAddress"); err != nil { - return fmt.Errorf("unable to decode setRecoveryEmailAddress#89df939f: %w", err) - } - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setRecoveryEmailAddress#89df939f: field password: %w", err) - } - s.Password = value - case "new_recovery_email_address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setRecoveryEmailAddress#89df939f: field new_recovery_email_address: %w", err) - } - s.NewRecoveryEmailAddress = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPassword returns value of Password field. -func (s *SetRecoveryEmailAddressRequest) GetPassword() (value string) { - if s == nil { - return - } - return s.Password -} - -// GetNewRecoveryEmailAddress returns value of NewRecoveryEmailAddress field. -func (s *SetRecoveryEmailAddressRequest) GetNewRecoveryEmailAddress() (value string) { - if s == nil { - return - } - return s.NewRecoveryEmailAddress -} - -// SetRecoveryEmailAddress invokes method setRecoveryEmailAddress#89df939f returning error if any. -func (c *Client) SetRecoveryEmailAddress(ctx context.Context, request *SetRecoveryEmailAddressRequest) (*PasswordState, error) { - var result PasswordState - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_set_saved_messages_tag_label_gen.go b/tdapi/tl_set_saved_messages_tag_label_gen.go deleted file mode 100644 index c32418fee..000000000 --- a/tdapi/tl_set_saved_messages_tag_label_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetSavedMessagesTagLabelRequest represents TL type `setSavedMessagesTagLabel#b03acd10`. -type SetSavedMessagesTagLabelRequest struct { - // The tag which label will be changed - Tag ReactionTypeClass - // New label for the tag; 0-12 characters - Label string -} - -// SetSavedMessagesTagLabelRequestTypeID is TL type id of SetSavedMessagesTagLabelRequest. -const SetSavedMessagesTagLabelRequestTypeID = 0xb03acd10 - -// Ensuring interfaces in compile-time for SetSavedMessagesTagLabelRequest. -var ( - _ bin.Encoder = &SetSavedMessagesTagLabelRequest{} - _ bin.Decoder = &SetSavedMessagesTagLabelRequest{} - _ bin.BareEncoder = &SetSavedMessagesTagLabelRequest{} - _ bin.BareDecoder = &SetSavedMessagesTagLabelRequest{} -) - -func (s *SetSavedMessagesTagLabelRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Tag == nil) { - return false - } - if !(s.Label == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetSavedMessagesTagLabelRequest) String() string { - if s == nil { - return "SetSavedMessagesTagLabelRequest(nil)" - } - type Alias SetSavedMessagesTagLabelRequest - return fmt.Sprintf("SetSavedMessagesTagLabelRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetSavedMessagesTagLabelRequest) TypeID() uint32 { - return SetSavedMessagesTagLabelRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetSavedMessagesTagLabelRequest) TypeName() string { - return "setSavedMessagesTagLabel" -} - -// TypeInfo returns info about TL type. -func (s *SetSavedMessagesTagLabelRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setSavedMessagesTagLabel", - ID: SetSavedMessagesTagLabelRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Tag", - SchemaName: "tag", - }, - { - Name: "Label", - SchemaName: "label", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetSavedMessagesTagLabelRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setSavedMessagesTagLabel#b03acd10 as nil") - } - b.PutID(SetSavedMessagesTagLabelRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetSavedMessagesTagLabelRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setSavedMessagesTagLabel#b03acd10 as nil") - } - if s.Tag == nil { - return fmt.Errorf("unable to encode setSavedMessagesTagLabel#b03acd10: field tag is nil") - } - if err := s.Tag.Encode(b); err != nil { - return fmt.Errorf("unable to encode setSavedMessagesTagLabel#b03acd10: field tag: %w", err) - } - b.PutString(s.Label) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetSavedMessagesTagLabelRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setSavedMessagesTagLabel#b03acd10 to nil") - } - if err := b.ConsumeID(SetSavedMessagesTagLabelRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setSavedMessagesTagLabel#b03acd10: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetSavedMessagesTagLabelRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setSavedMessagesTagLabel#b03acd10 to nil") - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode setSavedMessagesTagLabel#b03acd10: field tag: %w", err) - } - s.Tag = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setSavedMessagesTagLabel#b03acd10: field label: %w", err) - } - s.Label = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetSavedMessagesTagLabelRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setSavedMessagesTagLabel#b03acd10 as nil") - } - b.ObjStart() - b.PutID("setSavedMessagesTagLabel") - b.Comma() - b.FieldStart("tag") - if s.Tag == nil { - return fmt.Errorf("unable to encode setSavedMessagesTagLabel#b03acd10: field tag is nil") - } - if err := s.Tag.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setSavedMessagesTagLabel#b03acd10: field tag: %w", err) - } - b.Comma() - b.FieldStart("label") - b.PutString(s.Label) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetSavedMessagesTagLabelRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setSavedMessagesTagLabel#b03acd10 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setSavedMessagesTagLabel"); err != nil { - return fmt.Errorf("unable to decode setSavedMessagesTagLabel#b03acd10: %w", err) - } - case "tag": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode setSavedMessagesTagLabel#b03acd10: field tag: %w", err) - } - s.Tag = value - case "label": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setSavedMessagesTagLabel#b03acd10: field label: %w", err) - } - s.Label = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTag returns value of Tag field. -func (s *SetSavedMessagesTagLabelRequest) GetTag() (value ReactionTypeClass) { - if s == nil { - return - } - return s.Tag -} - -// GetLabel returns value of Label field. -func (s *SetSavedMessagesTagLabelRequest) GetLabel() (value string) { - if s == nil { - return - } - return s.Label -} - -// SetSavedMessagesTagLabel invokes method setSavedMessagesTagLabel#b03acd10 returning error if any. -func (c *Client) SetSavedMessagesTagLabel(ctx context.Context, request *SetSavedMessagesTagLabelRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_scope_notification_settings_gen.go b/tdapi/tl_set_scope_notification_settings_gen.go deleted file mode 100644 index 430c3fea7..000000000 --- a/tdapi/tl_set_scope_notification_settings_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetScopeNotificationSettingsRequest represents TL type `setScopeNotificationSettings#85cfb63a`. -type SetScopeNotificationSettingsRequest struct { - // Types of chats for which to change the notification settings - Scope NotificationSettingsScopeClass - // The new notification settings for the given scope - NotificationSettings ScopeNotificationSettings -} - -// SetScopeNotificationSettingsRequestTypeID is TL type id of SetScopeNotificationSettingsRequest. -const SetScopeNotificationSettingsRequestTypeID = 0x85cfb63a - -// Ensuring interfaces in compile-time for SetScopeNotificationSettingsRequest. -var ( - _ bin.Encoder = &SetScopeNotificationSettingsRequest{} - _ bin.Decoder = &SetScopeNotificationSettingsRequest{} - _ bin.BareEncoder = &SetScopeNotificationSettingsRequest{} - _ bin.BareDecoder = &SetScopeNotificationSettingsRequest{} -) - -func (s *SetScopeNotificationSettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Scope == nil) { - return false - } - if !(s.NotificationSettings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetScopeNotificationSettingsRequest) String() string { - if s == nil { - return "SetScopeNotificationSettingsRequest(nil)" - } - type Alias SetScopeNotificationSettingsRequest - return fmt.Sprintf("SetScopeNotificationSettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetScopeNotificationSettingsRequest) TypeID() uint32 { - return SetScopeNotificationSettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetScopeNotificationSettingsRequest) TypeName() string { - return "setScopeNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (s *SetScopeNotificationSettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setScopeNotificationSettings", - ID: SetScopeNotificationSettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Scope", - SchemaName: "scope", - }, - { - Name: "NotificationSettings", - SchemaName: "notification_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetScopeNotificationSettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setScopeNotificationSettings#85cfb63a as nil") - } - b.PutID(SetScopeNotificationSettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetScopeNotificationSettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setScopeNotificationSettings#85cfb63a as nil") - } - if s.Scope == nil { - return fmt.Errorf("unable to encode setScopeNotificationSettings#85cfb63a: field scope is nil") - } - if err := s.Scope.Encode(b); err != nil { - return fmt.Errorf("unable to encode setScopeNotificationSettings#85cfb63a: field scope: %w", err) - } - if err := s.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setScopeNotificationSettings#85cfb63a: field notification_settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetScopeNotificationSettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setScopeNotificationSettings#85cfb63a to nil") - } - if err := b.ConsumeID(SetScopeNotificationSettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setScopeNotificationSettings#85cfb63a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetScopeNotificationSettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setScopeNotificationSettings#85cfb63a to nil") - } - { - value, err := DecodeNotificationSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode setScopeNotificationSettings#85cfb63a: field scope: %w", err) - } - s.Scope = value - } - { - if err := s.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode setScopeNotificationSettings#85cfb63a: field notification_settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetScopeNotificationSettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setScopeNotificationSettings#85cfb63a as nil") - } - b.ObjStart() - b.PutID("setScopeNotificationSettings") - b.Comma() - b.FieldStart("scope") - if s.Scope == nil { - return fmt.Errorf("unable to encode setScopeNotificationSettings#85cfb63a: field scope is nil") - } - if err := s.Scope.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setScopeNotificationSettings#85cfb63a: field scope: %w", err) - } - b.Comma() - b.FieldStart("notification_settings") - if err := s.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setScopeNotificationSettings#85cfb63a: field notification_settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetScopeNotificationSettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setScopeNotificationSettings#85cfb63a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setScopeNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode setScopeNotificationSettings#85cfb63a: %w", err) - } - case "scope": - value, err := DecodeTDLibJSONNotificationSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode setScopeNotificationSettings#85cfb63a: field scope: %w", err) - } - s.Scope = value - case "notification_settings": - if err := s.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setScopeNotificationSettings#85cfb63a: field notification_settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetScope returns value of Scope field. -func (s *SetScopeNotificationSettingsRequest) GetScope() (value NotificationSettingsScopeClass) { - if s == nil { - return - } - return s.Scope -} - -// GetNotificationSettings returns value of NotificationSettings field. -func (s *SetScopeNotificationSettingsRequest) GetNotificationSettings() (value ScopeNotificationSettings) { - if s == nil { - return - } - return s.NotificationSettings -} - -// SetScopeNotificationSettings invokes method setScopeNotificationSettings#85cfb63a returning error if any. -func (c *Client) SetScopeNotificationSettings(ctx context.Context, request *SetScopeNotificationSettingsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_sticker_emojis_gen.go b/tdapi/tl_set_sticker_emojis_gen.go deleted file mode 100644 index 0bd107fc8..000000000 --- a/tdapi/tl_set_sticker_emojis_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetStickerEmojisRequest represents TL type `setStickerEmojis#d9ec0431`. -type SetStickerEmojisRequest struct { - // Sticker - Sticker InputFileClass - // New string with 1-20 emoji corresponding to the sticker - Emojis string -} - -// SetStickerEmojisRequestTypeID is TL type id of SetStickerEmojisRequest. -const SetStickerEmojisRequestTypeID = 0xd9ec0431 - -// Ensuring interfaces in compile-time for SetStickerEmojisRequest. -var ( - _ bin.Encoder = &SetStickerEmojisRequest{} - _ bin.Decoder = &SetStickerEmojisRequest{} - _ bin.BareEncoder = &SetStickerEmojisRequest{} - _ bin.BareDecoder = &SetStickerEmojisRequest{} -) - -func (s *SetStickerEmojisRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Sticker == nil) { - return false - } - if !(s.Emojis == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetStickerEmojisRequest) String() string { - if s == nil { - return "SetStickerEmojisRequest(nil)" - } - type Alias SetStickerEmojisRequest - return fmt.Sprintf("SetStickerEmojisRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetStickerEmojisRequest) TypeID() uint32 { - return SetStickerEmojisRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetStickerEmojisRequest) TypeName() string { - return "setStickerEmojis" -} - -// TypeInfo returns info about TL type. -func (s *SetStickerEmojisRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setStickerEmojis", - ID: SetStickerEmojisRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "Emojis", - SchemaName: "emojis", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetStickerEmojisRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerEmojis#d9ec0431 as nil") - } - b.PutID(SetStickerEmojisRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetStickerEmojisRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerEmojis#d9ec0431 as nil") - } - if s.Sticker == nil { - return fmt.Errorf("unable to encode setStickerEmojis#d9ec0431: field sticker is nil") - } - if err := s.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode setStickerEmojis#d9ec0431: field sticker: %w", err) - } - b.PutString(s.Emojis) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetStickerEmojisRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerEmojis#d9ec0431 to nil") - } - if err := b.ConsumeID(SetStickerEmojisRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setStickerEmojis#d9ec0431: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetStickerEmojisRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerEmojis#d9ec0431 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerEmojis#d9ec0431: field sticker: %w", err) - } - s.Sticker = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setStickerEmojis#d9ec0431: field emojis: %w", err) - } - s.Emojis = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetStickerEmojisRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setStickerEmojis#d9ec0431 as nil") - } - b.ObjStart() - b.PutID("setStickerEmojis") - b.Comma() - b.FieldStart("sticker") - if s.Sticker == nil { - return fmt.Errorf("unable to encode setStickerEmojis#d9ec0431: field sticker is nil") - } - if err := s.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setStickerEmojis#d9ec0431: field sticker: %w", err) - } - b.Comma() - b.FieldStart("emojis") - b.PutString(s.Emojis) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetStickerEmojisRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setStickerEmojis#d9ec0431 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setStickerEmojis"); err != nil { - return fmt.Errorf("unable to decode setStickerEmojis#d9ec0431: %w", err) - } - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerEmojis#d9ec0431: field sticker: %w", err) - } - s.Sticker = value - case "emojis": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setStickerEmojis#d9ec0431: field emojis: %w", err) - } - s.Emojis = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (s *SetStickerEmojisRequest) GetSticker() (value InputFileClass) { - if s == nil { - return - } - return s.Sticker -} - -// GetEmojis returns value of Emojis field. -func (s *SetStickerEmojisRequest) GetEmojis() (value string) { - if s == nil { - return - } - return s.Emojis -} - -// SetStickerEmojis invokes method setStickerEmojis#d9ec0431 returning error if any. -func (c *Client) SetStickerEmojis(ctx context.Context, request *SetStickerEmojisRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_sticker_keywords_gen.go b/tdapi/tl_set_sticker_keywords_gen.go deleted file mode 100644 index 84ab8a481..000000000 --- a/tdapi/tl_set_sticker_keywords_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetStickerKeywordsRequest represents TL type `setStickerKeywords#462481d`. -type SetStickerKeywordsRequest struct { - // Sticker - Sticker InputFileClass - // List of up to 20 keywords with total length up to 64 characters, which can be used to - // find the sticker - Keywords []string -} - -// SetStickerKeywordsRequestTypeID is TL type id of SetStickerKeywordsRequest. -const SetStickerKeywordsRequestTypeID = 0x462481d - -// Ensuring interfaces in compile-time for SetStickerKeywordsRequest. -var ( - _ bin.Encoder = &SetStickerKeywordsRequest{} - _ bin.Decoder = &SetStickerKeywordsRequest{} - _ bin.BareEncoder = &SetStickerKeywordsRequest{} - _ bin.BareDecoder = &SetStickerKeywordsRequest{} -) - -func (s *SetStickerKeywordsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Sticker == nil) { - return false - } - if !(s.Keywords == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetStickerKeywordsRequest) String() string { - if s == nil { - return "SetStickerKeywordsRequest(nil)" - } - type Alias SetStickerKeywordsRequest - return fmt.Sprintf("SetStickerKeywordsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetStickerKeywordsRequest) TypeID() uint32 { - return SetStickerKeywordsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetStickerKeywordsRequest) TypeName() string { - return "setStickerKeywords" -} - -// TypeInfo returns info about TL type. -func (s *SetStickerKeywordsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setStickerKeywords", - ID: SetStickerKeywordsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "Keywords", - SchemaName: "keywords", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetStickerKeywordsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerKeywords#462481d as nil") - } - b.PutID(SetStickerKeywordsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetStickerKeywordsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerKeywords#462481d as nil") - } - if s.Sticker == nil { - return fmt.Errorf("unable to encode setStickerKeywords#462481d: field sticker is nil") - } - if err := s.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode setStickerKeywords#462481d: field sticker: %w", err) - } - b.PutInt(len(s.Keywords)) - for _, v := range s.Keywords { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetStickerKeywordsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerKeywords#462481d to nil") - } - if err := b.ConsumeID(SetStickerKeywordsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setStickerKeywords#462481d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetStickerKeywordsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerKeywords#462481d to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerKeywords#462481d: field sticker: %w", err) - } - s.Sticker = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode setStickerKeywords#462481d: field keywords: %w", err) - } - - if headerLen > 0 { - s.Keywords = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setStickerKeywords#462481d: field keywords: %w", err) - } - s.Keywords = append(s.Keywords, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetStickerKeywordsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setStickerKeywords#462481d as nil") - } - b.ObjStart() - b.PutID("setStickerKeywords") - b.Comma() - b.FieldStart("sticker") - if s.Sticker == nil { - return fmt.Errorf("unable to encode setStickerKeywords#462481d: field sticker is nil") - } - if err := s.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setStickerKeywords#462481d: field sticker: %w", err) - } - b.Comma() - b.FieldStart("keywords") - b.ArrStart() - for _, v := range s.Keywords { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetStickerKeywordsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setStickerKeywords#462481d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setStickerKeywords"); err != nil { - return fmt.Errorf("unable to decode setStickerKeywords#462481d: %w", err) - } - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerKeywords#462481d: field sticker: %w", err) - } - s.Sticker = value - case "keywords": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setStickerKeywords#462481d: field keywords: %w", err) - } - s.Keywords = append(s.Keywords, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode setStickerKeywords#462481d: field keywords: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (s *SetStickerKeywordsRequest) GetSticker() (value InputFileClass) { - if s == nil { - return - } - return s.Sticker -} - -// GetKeywords returns value of Keywords field. -func (s *SetStickerKeywordsRequest) GetKeywords() (value []string) { - if s == nil { - return - } - return s.Keywords -} - -// SetStickerKeywords invokes method setStickerKeywords#462481d returning error if any. -func (c *Client) SetStickerKeywords(ctx context.Context, request *SetStickerKeywordsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_sticker_mask_position_gen.go b/tdapi/tl_set_sticker_mask_position_gen.go deleted file mode 100644 index ae4444a5b..000000000 --- a/tdapi/tl_set_sticker_mask_position_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetStickerMaskPositionRequest represents TL type `setStickerMaskPosition#47a959d0`. -type SetStickerMaskPositionRequest struct { - // Sticker - Sticker InputFileClass - // Position where the mask is placed; pass null to remove mask position - MaskPosition MaskPosition -} - -// SetStickerMaskPositionRequestTypeID is TL type id of SetStickerMaskPositionRequest. -const SetStickerMaskPositionRequestTypeID = 0x47a959d0 - -// Ensuring interfaces in compile-time for SetStickerMaskPositionRequest. -var ( - _ bin.Encoder = &SetStickerMaskPositionRequest{} - _ bin.Decoder = &SetStickerMaskPositionRequest{} - _ bin.BareEncoder = &SetStickerMaskPositionRequest{} - _ bin.BareDecoder = &SetStickerMaskPositionRequest{} -) - -func (s *SetStickerMaskPositionRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Sticker == nil) { - return false - } - if !(s.MaskPosition.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetStickerMaskPositionRequest) String() string { - if s == nil { - return "SetStickerMaskPositionRequest(nil)" - } - type Alias SetStickerMaskPositionRequest - return fmt.Sprintf("SetStickerMaskPositionRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetStickerMaskPositionRequest) TypeID() uint32 { - return SetStickerMaskPositionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetStickerMaskPositionRequest) TypeName() string { - return "setStickerMaskPosition" -} - -// TypeInfo returns info about TL type. -func (s *SetStickerMaskPositionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setStickerMaskPosition", - ID: SetStickerMaskPositionRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "MaskPosition", - SchemaName: "mask_position", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetStickerMaskPositionRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerMaskPosition#47a959d0 as nil") - } - b.PutID(SetStickerMaskPositionRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetStickerMaskPositionRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerMaskPosition#47a959d0 as nil") - } - if s.Sticker == nil { - return fmt.Errorf("unable to encode setStickerMaskPosition#47a959d0: field sticker is nil") - } - if err := s.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode setStickerMaskPosition#47a959d0: field sticker: %w", err) - } - if err := s.MaskPosition.Encode(b); err != nil { - return fmt.Errorf("unable to encode setStickerMaskPosition#47a959d0: field mask_position: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetStickerMaskPositionRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerMaskPosition#47a959d0 to nil") - } - if err := b.ConsumeID(SetStickerMaskPositionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setStickerMaskPosition#47a959d0: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetStickerMaskPositionRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerMaskPosition#47a959d0 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerMaskPosition#47a959d0: field sticker: %w", err) - } - s.Sticker = value - } - { - if err := s.MaskPosition.Decode(b); err != nil { - return fmt.Errorf("unable to decode setStickerMaskPosition#47a959d0: field mask_position: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetStickerMaskPositionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setStickerMaskPosition#47a959d0 as nil") - } - b.ObjStart() - b.PutID("setStickerMaskPosition") - b.Comma() - b.FieldStart("sticker") - if s.Sticker == nil { - return fmt.Errorf("unable to encode setStickerMaskPosition#47a959d0: field sticker is nil") - } - if err := s.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setStickerMaskPosition#47a959d0: field sticker: %w", err) - } - b.Comma() - b.FieldStart("mask_position") - if err := s.MaskPosition.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setStickerMaskPosition#47a959d0: field mask_position: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetStickerMaskPositionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setStickerMaskPosition#47a959d0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setStickerMaskPosition"); err != nil { - return fmt.Errorf("unable to decode setStickerMaskPosition#47a959d0: %w", err) - } - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerMaskPosition#47a959d0: field sticker: %w", err) - } - s.Sticker = value - case "mask_position": - if err := s.MaskPosition.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setStickerMaskPosition#47a959d0: field mask_position: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (s *SetStickerMaskPositionRequest) GetSticker() (value InputFileClass) { - if s == nil { - return - } - return s.Sticker -} - -// GetMaskPosition returns value of MaskPosition field. -func (s *SetStickerMaskPositionRequest) GetMaskPosition() (value MaskPosition) { - if s == nil { - return - } - return s.MaskPosition -} - -// SetStickerMaskPosition invokes method setStickerMaskPosition#47a959d0 returning error if any. -func (c *Client) SetStickerMaskPosition(ctx context.Context, request *SetStickerMaskPositionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_sticker_position_in_set_gen.go b/tdapi/tl_set_sticker_position_in_set_gen.go deleted file mode 100644 index aa03b8f08..000000000 --- a/tdapi/tl_set_sticker_position_in_set_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetStickerPositionInSetRequest represents TL type `setStickerPositionInSet#7bb24721`. -type SetStickerPositionInSetRequest struct { - // Sticker - Sticker InputFileClass - // New position of the sticker in the set, 0-based - Position int32 -} - -// SetStickerPositionInSetRequestTypeID is TL type id of SetStickerPositionInSetRequest. -const SetStickerPositionInSetRequestTypeID = 0x7bb24721 - -// Ensuring interfaces in compile-time for SetStickerPositionInSetRequest. -var ( - _ bin.Encoder = &SetStickerPositionInSetRequest{} - _ bin.Decoder = &SetStickerPositionInSetRequest{} - _ bin.BareEncoder = &SetStickerPositionInSetRequest{} - _ bin.BareDecoder = &SetStickerPositionInSetRequest{} -) - -func (s *SetStickerPositionInSetRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Sticker == nil) { - return false - } - if !(s.Position == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetStickerPositionInSetRequest) String() string { - if s == nil { - return "SetStickerPositionInSetRequest(nil)" - } - type Alias SetStickerPositionInSetRequest - return fmt.Sprintf("SetStickerPositionInSetRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetStickerPositionInSetRequest) TypeID() uint32 { - return SetStickerPositionInSetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetStickerPositionInSetRequest) TypeName() string { - return "setStickerPositionInSet" -} - -// TypeInfo returns info about TL type. -func (s *SetStickerPositionInSetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setStickerPositionInSet", - ID: SetStickerPositionInSetRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "Position", - SchemaName: "position", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetStickerPositionInSetRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerPositionInSet#7bb24721 as nil") - } - b.PutID(SetStickerPositionInSetRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetStickerPositionInSetRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerPositionInSet#7bb24721 as nil") - } - if s.Sticker == nil { - return fmt.Errorf("unable to encode setStickerPositionInSet#7bb24721: field sticker is nil") - } - if err := s.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode setStickerPositionInSet#7bb24721: field sticker: %w", err) - } - b.PutInt32(s.Position) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetStickerPositionInSetRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerPositionInSet#7bb24721 to nil") - } - if err := b.ConsumeID(SetStickerPositionInSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setStickerPositionInSet#7bb24721: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetStickerPositionInSetRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerPositionInSet#7bb24721 to nil") - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerPositionInSet#7bb24721: field sticker: %w", err) - } - s.Sticker = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setStickerPositionInSet#7bb24721: field position: %w", err) - } - s.Position = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetStickerPositionInSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setStickerPositionInSet#7bb24721 as nil") - } - b.ObjStart() - b.PutID("setStickerPositionInSet") - b.Comma() - b.FieldStart("sticker") - if s.Sticker == nil { - return fmt.Errorf("unable to encode setStickerPositionInSet#7bb24721: field sticker is nil") - } - if err := s.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setStickerPositionInSet#7bb24721: field sticker: %w", err) - } - b.Comma() - b.FieldStart("position") - b.PutInt32(s.Position) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetStickerPositionInSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setStickerPositionInSet#7bb24721 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setStickerPositionInSet"); err != nil { - return fmt.Errorf("unable to decode setStickerPositionInSet#7bb24721: %w", err) - } - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerPositionInSet#7bb24721: field sticker: %w", err) - } - s.Sticker = value - case "position": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setStickerPositionInSet#7bb24721: field position: %w", err) - } - s.Position = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSticker returns value of Sticker field. -func (s *SetStickerPositionInSetRequest) GetSticker() (value InputFileClass) { - if s == nil { - return - } - return s.Sticker -} - -// GetPosition returns value of Position field. -func (s *SetStickerPositionInSetRequest) GetPosition() (value int32) { - if s == nil { - return - } - return s.Position -} - -// SetStickerPositionInSet invokes method setStickerPositionInSet#7bb24721 returning error if any. -func (c *Client) SetStickerPositionInSet(ctx context.Context, request *SetStickerPositionInSetRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_sticker_set_thumbnail_gen.go b/tdapi/tl_set_sticker_set_thumbnail_gen.go deleted file mode 100644 index 14c15ebe9..000000000 --- a/tdapi/tl_set_sticker_set_thumbnail_gen.go +++ /dev/null @@ -1,325 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetStickerSetThumbnailRequest represents TL type `setStickerSetThumbnail#63fe6932`. -type SetStickerSetThumbnailRequest struct { - // Sticker set owner; ignored for regular users - UserID int64 - // Sticker set name. The sticker set must be owned by the current user - Name string - // Thumbnail to set; pass null to remove the sticker set thumbnail - Thumbnail InputFileClass - // Format of the thumbnail; pass null if thumbnail is removed - Format StickerFormatClass -} - -// SetStickerSetThumbnailRequestTypeID is TL type id of SetStickerSetThumbnailRequest. -const SetStickerSetThumbnailRequestTypeID = 0x63fe6932 - -// Ensuring interfaces in compile-time for SetStickerSetThumbnailRequest. -var ( - _ bin.Encoder = &SetStickerSetThumbnailRequest{} - _ bin.Decoder = &SetStickerSetThumbnailRequest{} - _ bin.BareEncoder = &SetStickerSetThumbnailRequest{} - _ bin.BareDecoder = &SetStickerSetThumbnailRequest{} -) - -func (s *SetStickerSetThumbnailRequest) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Name == "") { - return false - } - if !(s.Thumbnail == nil) { - return false - } - if !(s.Format == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetStickerSetThumbnailRequest) String() string { - if s == nil { - return "SetStickerSetThumbnailRequest(nil)" - } - type Alias SetStickerSetThumbnailRequest - return fmt.Sprintf("SetStickerSetThumbnailRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetStickerSetThumbnailRequest) TypeID() uint32 { - return SetStickerSetThumbnailRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetStickerSetThumbnailRequest) TypeName() string { - return "setStickerSetThumbnail" -} - -// TypeInfo returns info about TL type. -func (s *SetStickerSetThumbnailRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setStickerSetThumbnail", - ID: SetStickerSetThumbnailRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "Format", - SchemaName: "format", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetStickerSetThumbnailRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerSetThumbnail#63fe6932 as nil") - } - b.PutID(SetStickerSetThumbnailRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetStickerSetThumbnailRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerSetThumbnail#63fe6932 as nil") - } - b.PutInt53(s.UserID) - b.PutString(s.Name) - if s.Thumbnail == nil { - return fmt.Errorf("unable to encode setStickerSetThumbnail#63fe6932: field thumbnail is nil") - } - if err := s.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode setStickerSetThumbnail#63fe6932: field thumbnail: %w", err) - } - if s.Format == nil { - return fmt.Errorf("unable to encode setStickerSetThumbnail#63fe6932: field format is nil") - } - if err := s.Format.Encode(b); err != nil { - return fmt.Errorf("unable to encode setStickerSetThumbnail#63fe6932: field format: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetStickerSetThumbnailRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerSetThumbnail#63fe6932 to nil") - } - if err := b.ConsumeID(SetStickerSetThumbnailRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setStickerSetThumbnail#63fe6932: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetStickerSetThumbnailRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerSetThumbnail#63fe6932 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setStickerSetThumbnail#63fe6932: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setStickerSetThumbnail#63fe6932: field name: %w", err) - } - s.Name = value - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerSetThumbnail#63fe6932: field thumbnail: %w", err) - } - s.Thumbnail = value - } - { - value, err := DecodeStickerFormat(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerSetThumbnail#63fe6932: field format: %w", err) - } - s.Format = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetStickerSetThumbnailRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setStickerSetThumbnail#63fe6932 as nil") - } - b.ObjStart() - b.PutID("setStickerSetThumbnail") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("name") - b.PutString(s.Name) - b.Comma() - b.FieldStart("thumbnail") - if s.Thumbnail == nil { - return fmt.Errorf("unable to encode setStickerSetThumbnail#63fe6932: field thumbnail is nil") - } - if err := s.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setStickerSetThumbnail#63fe6932: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("format") - if s.Format == nil { - return fmt.Errorf("unable to encode setStickerSetThumbnail#63fe6932: field format is nil") - } - if err := s.Format.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setStickerSetThumbnail#63fe6932: field format: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetStickerSetThumbnailRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setStickerSetThumbnail#63fe6932 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setStickerSetThumbnail"); err != nil { - return fmt.Errorf("unable to decode setStickerSetThumbnail#63fe6932: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setStickerSetThumbnail#63fe6932: field user_id: %w", err) - } - s.UserID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setStickerSetThumbnail#63fe6932: field name: %w", err) - } - s.Name = value - case "thumbnail": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerSetThumbnail#63fe6932: field thumbnail: %w", err) - } - s.Thumbnail = value - case "format": - value, err := DecodeTDLibJSONStickerFormat(b) - if err != nil { - return fmt.Errorf("unable to decode setStickerSetThumbnail#63fe6932: field format: %w", err) - } - s.Format = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *SetStickerSetThumbnailRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetName returns value of Name field. -func (s *SetStickerSetThumbnailRequest) GetName() (value string) { - if s == nil { - return - } - return s.Name -} - -// GetThumbnail returns value of Thumbnail field. -func (s *SetStickerSetThumbnailRequest) GetThumbnail() (value InputFileClass) { - if s == nil { - return - } - return s.Thumbnail -} - -// GetFormat returns value of Format field. -func (s *SetStickerSetThumbnailRequest) GetFormat() (value StickerFormatClass) { - if s == nil { - return - } - return s.Format -} - -// SetStickerSetThumbnail invokes method setStickerSetThumbnail#63fe6932 returning error if any. -func (c *Client) SetStickerSetThumbnail(ctx context.Context, request *SetStickerSetThumbnailRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_sticker_set_title_gen.go b/tdapi/tl_set_sticker_set_title_gen.go deleted file mode 100644 index 65ab68fc7..000000000 --- a/tdapi/tl_set_sticker_set_title_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetStickerSetTitleRequest represents TL type `setStickerSetTitle#64e933a2`. -type SetStickerSetTitleRequest struct { - // Sticker set name. The sticker set must be owned by the current user - Name string - // New sticker set title - Title string -} - -// SetStickerSetTitleRequestTypeID is TL type id of SetStickerSetTitleRequest. -const SetStickerSetTitleRequestTypeID = 0x64e933a2 - -// Ensuring interfaces in compile-time for SetStickerSetTitleRequest. -var ( - _ bin.Encoder = &SetStickerSetTitleRequest{} - _ bin.Decoder = &SetStickerSetTitleRequest{} - _ bin.BareEncoder = &SetStickerSetTitleRequest{} - _ bin.BareDecoder = &SetStickerSetTitleRequest{} -) - -func (s *SetStickerSetTitleRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Name == "") { - return false - } - if !(s.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetStickerSetTitleRequest) String() string { - if s == nil { - return "SetStickerSetTitleRequest(nil)" - } - type Alias SetStickerSetTitleRequest - return fmt.Sprintf("SetStickerSetTitleRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetStickerSetTitleRequest) TypeID() uint32 { - return SetStickerSetTitleRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetStickerSetTitleRequest) TypeName() string { - return "setStickerSetTitle" -} - -// TypeInfo returns info about TL type. -func (s *SetStickerSetTitleRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setStickerSetTitle", - ID: SetStickerSetTitleRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetStickerSetTitleRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerSetTitle#64e933a2 as nil") - } - b.PutID(SetStickerSetTitleRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetStickerSetTitleRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStickerSetTitle#64e933a2 as nil") - } - b.PutString(s.Name) - b.PutString(s.Title) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetStickerSetTitleRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerSetTitle#64e933a2 to nil") - } - if err := b.ConsumeID(SetStickerSetTitleRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetStickerSetTitleRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStickerSetTitle#64e933a2 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: field name: %w", err) - } - s.Name = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: field title: %w", err) - } - s.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetStickerSetTitleRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setStickerSetTitle#64e933a2 as nil") - } - b.ObjStart() - b.PutID("setStickerSetTitle") - b.Comma() - b.FieldStart("name") - b.PutString(s.Name) - b.Comma() - b.FieldStart("title") - b.PutString(s.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetStickerSetTitleRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setStickerSetTitle#64e933a2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setStickerSetTitle"); err != nil { - return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: field name: %w", err) - } - s.Name = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setStickerSetTitle#64e933a2: field title: %w", err) - } - s.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (s *SetStickerSetTitleRequest) GetName() (value string) { - if s == nil { - return - } - return s.Name -} - -// GetTitle returns value of Title field. -func (s *SetStickerSetTitleRequest) GetTitle() (value string) { - if s == nil { - return - } - return s.Title -} - -// SetStickerSetTitle invokes method setStickerSetTitle#64e933a2 returning error if any. -func (c *Client) SetStickerSetTitle(ctx context.Context, request *SetStickerSetTitleRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_story_privacy_settings_gen.go b/tdapi/tl_set_story_privacy_settings_gen.go deleted file mode 100644 index ba37b3379..000000000 --- a/tdapi/tl_set_story_privacy_settings_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetStoryPrivacySettingsRequest represents TL type `setStoryPrivacySettings#d8e94332`. -type SetStoryPrivacySettingsRequest struct { - // Identifier of the story - StoryID int32 - // The new privacy settings for the story - PrivacySettings StoryPrivacySettingsClass -} - -// SetStoryPrivacySettingsRequestTypeID is TL type id of SetStoryPrivacySettingsRequest. -const SetStoryPrivacySettingsRequestTypeID = 0xd8e94332 - -// Ensuring interfaces in compile-time for SetStoryPrivacySettingsRequest. -var ( - _ bin.Encoder = &SetStoryPrivacySettingsRequest{} - _ bin.Decoder = &SetStoryPrivacySettingsRequest{} - _ bin.BareEncoder = &SetStoryPrivacySettingsRequest{} - _ bin.BareDecoder = &SetStoryPrivacySettingsRequest{} -) - -func (s *SetStoryPrivacySettingsRequest) Zero() bool { - if s == nil { - return true - } - if !(s.StoryID == 0) { - return false - } - if !(s.PrivacySettings == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetStoryPrivacySettingsRequest) String() string { - if s == nil { - return "SetStoryPrivacySettingsRequest(nil)" - } - type Alias SetStoryPrivacySettingsRequest - return fmt.Sprintf("SetStoryPrivacySettingsRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetStoryPrivacySettingsRequest) TypeID() uint32 { - return SetStoryPrivacySettingsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetStoryPrivacySettingsRequest) TypeName() string { - return "setStoryPrivacySettings" -} - -// TypeInfo returns info about TL type. -func (s *SetStoryPrivacySettingsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setStoryPrivacySettings", - ID: SetStoryPrivacySettingsRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "PrivacySettings", - SchemaName: "privacy_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetStoryPrivacySettingsRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStoryPrivacySettings#d8e94332 as nil") - } - b.PutID(SetStoryPrivacySettingsRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetStoryPrivacySettingsRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStoryPrivacySettings#d8e94332 as nil") - } - b.PutInt32(s.StoryID) - if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings is nil") - } - if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetStoryPrivacySettingsRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStoryPrivacySettings#d8e94332 to nil") - } - if err := b.ConsumeID(SetStoryPrivacySettingsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetStoryPrivacySettingsRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStoryPrivacySettings#d8e94332 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field story_id: %w", err) - } - s.StoryID = value - } - { - value, err := DecodeStoryPrivacySettings(b) - if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) - } - s.PrivacySettings = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetStoryPrivacySettingsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setStoryPrivacySettings#d8e94332 as nil") - } - b.ObjStart() - b.PutID("setStoryPrivacySettings") - b.Comma() - b.FieldStart("story_id") - b.PutInt32(s.StoryID) - b.Comma() - b.FieldStart("privacy_settings") - if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings is nil") - } - if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetStoryPrivacySettingsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setStoryPrivacySettings#d8e94332 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setStoryPrivacySettings"); err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: %w", err) - } - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field story_id: %w", err) - } - s.StoryID = value - case "privacy_settings": - value, err := DecodeTDLibJSONStoryPrivacySettings(b) - if err != nil { - return fmt.Errorf("unable to decode setStoryPrivacySettings#d8e94332: field privacy_settings: %w", err) - } - s.PrivacySettings = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStoryID returns value of StoryID field. -func (s *SetStoryPrivacySettingsRequest) GetStoryID() (value int32) { - if s == nil { - return - } - return s.StoryID -} - -// GetPrivacySettings returns value of PrivacySettings field. -func (s *SetStoryPrivacySettingsRequest) GetPrivacySettings() (value StoryPrivacySettingsClass) { - if s == nil { - return - } - return s.PrivacySettings -} - -// SetStoryPrivacySettings invokes method setStoryPrivacySettings#d8e94332 returning error if any. -func (c *Client) SetStoryPrivacySettings(ctx context.Context, request *SetStoryPrivacySettingsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_story_reaction_gen.go b/tdapi/tl_set_story_reaction_gen.go deleted file mode 100644 index 5f81b3070..000000000 --- a/tdapi/tl_set_story_reaction_gen.go +++ /dev/null @@ -1,316 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetStoryReactionRequest represents TL type `setStoryReaction#ac8b4fa7`. -type SetStoryReactionRequest struct { - // The identifier of the sender of the story - StorySenderChatID int64 - // The identifier of the story - StoryID int32 - // Type of the reaction to set; pass null to remove the reaction. Custom emoji reactions - // can be used only by Telegram Premium users. Paid reactions can't be set - ReactionType ReactionTypeClass - // Pass true if the reaction needs to be added to recent reactions - UpdateRecentReactions bool -} - -// SetStoryReactionRequestTypeID is TL type id of SetStoryReactionRequest. -const SetStoryReactionRequestTypeID = 0xac8b4fa7 - -// Ensuring interfaces in compile-time for SetStoryReactionRequest. -var ( - _ bin.Encoder = &SetStoryReactionRequest{} - _ bin.Decoder = &SetStoryReactionRequest{} - _ bin.BareEncoder = &SetStoryReactionRequest{} - _ bin.BareDecoder = &SetStoryReactionRequest{} -) - -func (s *SetStoryReactionRequest) Zero() bool { - if s == nil { - return true - } - if !(s.StorySenderChatID == 0) { - return false - } - if !(s.StoryID == 0) { - return false - } - if !(s.ReactionType == nil) { - return false - } - if !(s.UpdateRecentReactions == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetStoryReactionRequest) String() string { - if s == nil { - return "SetStoryReactionRequest(nil)" - } - type Alias SetStoryReactionRequest - return fmt.Sprintf("SetStoryReactionRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetStoryReactionRequest) TypeID() uint32 { - return SetStoryReactionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetStoryReactionRequest) TypeName() string { - return "setStoryReaction" -} - -// TypeInfo returns info about TL type. -func (s *SetStoryReactionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setStoryReaction", - ID: SetStoryReactionRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "ReactionType", - SchemaName: "reaction_type", - }, - { - Name: "UpdateRecentReactions", - SchemaName: "update_recent_reactions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetStoryReactionRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStoryReaction#ac8b4fa7 as nil") - } - b.PutID(SetStoryReactionRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetStoryReactionRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setStoryReaction#ac8b4fa7 as nil") - } - b.PutInt53(s.StorySenderChatID) - b.PutInt32(s.StoryID) - if s.ReactionType == nil { - return fmt.Errorf("unable to encode setStoryReaction#ac8b4fa7: field reaction_type is nil") - } - if err := s.ReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode setStoryReaction#ac8b4fa7: field reaction_type: %w", err) - } - b.PutBool(s.UpdateRecentReactions) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetStoryReactionRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStoryReaction#ac8b4fa7 to nil") - } - if err := b.ConsumeID(SetStoryReactionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setStoryReaction#ac8b4fa7: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetStoryReactionRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setStoryReaction#ac8b4fa7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setStoryReaction#ac8b4fa7: field story_sender_chat_id: %w", err) - } - s.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setStoryReaction#ac8b4fa7: field story_id: %w", err) - } - s.StoryID = value - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode setStoryReaction#ac8b4fa7: field reaction_type: %w", err) - } - s.ReactionType = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setStoryReaction#ac8b4fa7: field update_recent_reactions: %w", err) - } - s.UpdateRecentReactions = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetStoryReactionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setStoryReaction#ac8b4fa7 as nil") - } - b.ObjStart() - b.PutID("setStoryReaction") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(s.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(s.StoryID) - b.Comma() - b.FieldStart("reaction_type") - if s.ReactionType == nil { - return fmt.Errorf("unable to encode setStoryReaction#ac8b4fa7: field reaction_type is nil") - } - if err := s.ReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setStoryReaction#ac8b4fa7: field reaction_type: %w", err) - } - b.Comma() - b.FieldStart("update_recent_reactions") - b.PutBool(s.UpdateRecentReactions) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetStoryReactionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setStoryReaction#ac8b4fa7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setStoryReaction"); err != nil { - return fmt.Errorf("unable to decode setStoryReaction#ac8b4fa7: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setStoryReaction#ac8b4fa7: field story_sender_chat_id: %w", err) - } - s.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setStoryReaction#ac8b4fa7: field story_id: %w", err) - } - s.StoryID = value - case "reaction_type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode setStoryReaction#ac8b4fa7: field reaction_type: %w", err) - } - s.ReactionType = value - case "update_recent_reactions": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setStoryReaction#ac8b4fa7: field update_recent_reactions: %w", err) - } - s.UpdateRecentReactions = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (s *SetStoryReactionRequest) GetStorySenderChatID() (value int64) { - if s == nil { - return - } - return s.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (s *SetStoryReactionRequest) GetStoryID() (value int32) { - if s == nil { - return - } - return s.StoryID -} - -// GetReactionType returns value of ReactionType field. -func (s *SetStoryReactionRequest) GetReactionType() (value ReactionTypeClass) { - if s == nil { - return - } - return s.ReactionType -} - -// GetUpdateRecentReactions returns value of UpdateRecentReactions field. -func (s *SetStoryReactionRequest) GetUpdateRecentReactions() (value bool) { - if s == nil { - return - } - return s.UpdateRecentReactions -} - -// SetStoryReaction invokes method setStoryReaction#ac8b4fa7 returning error if any. -func (c *Client) SetStoryReaction(ctx context.Context, request *SetStoryReactionRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_supergroup_custom_emoji_sticker_set_gen.go b/tdapi/tl_set_supergroup_custom_emoji_sticker_set_gen.go deleted file mode 100644 index 2648c909c..000000000 --- a/tdapi/tl_set_supergroup_custom_emoji_sticker_set_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetSupergroupCustomEmojiStickerSetRequest represents TL type `setSupergroupCustomEmojiStickerSet#4f3552af`. -type SetSupergroupCustomEmojiStickerSetRequest struct { - // Identifier of the supergroup - SupergroupID int64 - // New value of the custom emoji sticker set identifier for the supergroup. Use 0 to - // remove the custom emoji sticker set in the supergroup - CustomEmojiStickerSetID int64 -} - -// SetSupergroupCustomEmojiStickerSetRequestTypeID is TL type id of SetSupergroupCustomEmojiStickerSetRequest. -const SetSupergroupCustomEmojiStickerSetRequestTypeID = 0x4f3552af - -// Ensuring interfaces in compile-time for SetSupergroupCustomEmojiStickerSetRequest. -var ( - _ bin.Encoder = &SetSupergroupCustomEmojiStickerSetRequest{} - _ bin.Decoder = &SetSupergroupCustomEmojiStickerSetRequest{} - _ bin.BareEncoder = &SetSupergroupCustomEmojiStickerSetRequest{} - _ bin.BareDecoder = &SetSupergroupCustomEmojiStickerSetRequest{} -) - -func (s *SetSupergroupCustomEmojiStickerSetRequest) Zero() bool { - if s == nil { - return true - } - if !(s.SupergroupID == 0) { - return false - } - if !(s.CustomEmojiStickerSetID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetSupergroupCustomEmojiStickerSetRequest) String() string { - if s == nil { - return "SetSupergroupCustomEmojiStickerSetRequest(nil)" - } - type Alias SetSupergroupCustomEmojiStickerSetRequest - return fmt.Sprintf("SetSupergroupCustomEmojiStickerSetRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetSupergroupCustomEmojiStickerSetRequest) TypeID() uint32 { - return SetSupergroupCustomEmojiStickerSetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetSupergroupCustomEmojiStickerSetRequest) TypeName() string { - return "setSupergroupCustomEmojiStickerSet" -} - -// TypeInfo returns info about TL type. -func (s *SetSupergroupCustomEmojiStickerSetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setSupergroupCustomEmojiStickerSet", - ID: SetSupergroupCustomEmojiStickerSetRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "CustomEmojiStickerSetID", - SchemaName: "custom_emoji_sticker_set_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetSupergroupCustomEmojiStickerSetRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupCustomEmojiStickerSet#4f3552af as nil") - } - b.PutID(SetSupergroupCustomEmojiStickerSetRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetSupergroupCustomEmojiStickerSetRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupCustomEmojiStickerSet#4f3552af as nil") - } - b.PutInt53(s.SupergroupID) - b.PutLong(s.CustomEmojiStickerSetID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetSupergroupCustomEmojiStickerSetRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupCustomEmojiStickerSet#4f3552af to nil") - } - if err := b.ConsumeID(SetSupergroupCustomEmojiStickerSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetSupergroupCustomEmojiStickerSetRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupCustomEmojiStickerSet#4f3552af to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: field supergroup_id: %w", err) - } - s.SupergroupID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: field custom_emoji_sticker_set_id: %w", err) - } - s.CustomEmojiStickerSetID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetSupergroupCustomEmojiStickerSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupCustomEmojiStickerSet#4f3552af as nil") - } - b.ObjStart() - b.PutID("setSupergroupCustomEmojiStickerSet") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(s.SupergroupID) - b.Comma() - b.FieldStart("custom_emoji_sticker_set_id") - b.PutLong(s.CustomEmojiStickerSetID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetSupergroupCustomEmojiStickerSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupCustomEmojiStickerSet#4f3552af to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setSupergroupCustomEmojiStickerSet"); err != nil { - return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: field supergroup_id: %w", err) - } - s.SupergroupID = value - case "custom_emoji_sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupCustomEmojiStickerSet#4f3552af: field custom_emoji_sticker_set_id: %w", err) - } - s.CustomEmojiStickerSetID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (s *SetSupergroupCustomEmojiStickerSetRequest) GetSupergroupID() (value int64) { - if s == nil { - return - } - return s.SupergroupID -} - -// GetCustomEmojiStickerSetID returns value of CustomEmojiStickerSetID field. -func (s *SetSupergroupCustomEmojiStickerSetRequest) GetCustomEmojiStickerSetID() (value int64) { - if s == nil { - return - } - return s.CustomEmojiStickerSetID -} - -// SetSupergroupCustomEmojiStickerSet invokes method setSupergroupCustomEmojiStickerSet#4f3552af returning error if any. -func (c *Client) SetSupergroupCustomEmojiStickerSet(ctx context.Context, request *SetSupergroupCustomEmojiStickerSetRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_supergroup_sticker_set_gen.go b/tdapi/tl_set_supergroup_sticker_set_gen.go deleted file mode 100644 index b1c28a80e..000000000 --- a/tdapi/tl_set_supergroup_sticker_set_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetSupergroupStickerSetRequest represents TL type `setSupergroupStickerSet#856ead69`. -type SetSupergroupStickerSetRequest struct { - // Identifier of the supergroup - SupergroupID int64 - // New value of the supergroup sticker set identifier. Use 0 to remove the supergroup - // sticker set - StickerSetID int64 -} - -// SetSupergroupStickerSetRequestTypeID is TL type id of SetSupergroupStickerSetRequest. -const SetSupergroupStickerSetRequestTypeID = 0x856ead69 - -// Ensuring interfaces in compile-time for SetSupergroupStickerSetRequest. -var ( - _ bin.Encoder = &SetSupergroupStickerSetRequest{} - _ bin.Decoder = &SetSupergroupStickerSetRequest{} - _ bin.BareEncoder = &SetSupergroupStickerSetRequest{} - _ bin.BareDecoder = &SetSupergroupStickerSetRequest{} -) - -func (s *SetSupergroupStickerSetRequest) Zero() bool { - if s == nil { - return true - } - if !(s.SupergroupID == 0) { - return false - } - if !(s.StickerSetID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetSupergroupStickerSetRequest) String() string { - if s == nil { - return "SetSupergroupStickerSetRequest(nil)" - } - type Alias SetSupergroupStickerSetRequest - return fmt.Sprintf("SetSupergroupStickerSetRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetSupergroupStickerSetRequest) TypeID() uint32 { - return SetSupergroupStickerSetRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetSupergroupStickerSetRequest) TypeName() string { - return "setSupergroupStickerSet" -} - -// TypeInfo returns info about TL type. -func (s *SetSupergroupStickerSetRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setSupergroupStickerSet", - ID: SetSupergroupStickerSetRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "StickerSetID", - SchemaName: "sticker_set_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetSupergroupStickerSetRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupStickerSet#856ead69 as nil") - } - b.PutID(SetSupergroupStickerSetRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetSupergroupStickerSetRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupStickerSet#856ead69 as nil") - } - b.PutInt53(s.SupergroupID) - b.PutLong(s.StickerSetID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetSupergroupStickerSetRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupStickerSet#856ead69 to nil") - } - if err := b.ConsumeID(SetSupergroupStickerSetRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setSupergroupStickerSet#856ead69: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetSupergroupStickerSetRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupStickerSet#856ead69 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupStickerSet#856ead69: field supergroup_id: %w", err) - } - s.SupergroupID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupStickerSet#856ead69: field sticker_set_id: %w", err) - } - s.StickerSetID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetSupergroupStickerSetRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupStickerSet#856ead69 as nil") - } - b.ObjStart() - b.PutID("setSupergroupStickerSet") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(s.SupergroupID) - b.Comma() - b.FieldStart("sticker_set_id") - b.PutLong(s.StickerSetID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetSupergroupStickerSetRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupStickerSet#856ead69 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setSupergroupStickerSet"); err != nil { - return fmt.Errorf("unable to decode setSupergroupStickerSet#856ead69: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupStickerSet#856ead69: field supergroup_id: %w", err) - } - s.SupergroupID = value - case "sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupStickerSet#856ead69: field sticker_set_id: %w", err) - } - s.StickerSetID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (s *SetSupergroupStickerSetRequest) GetSupergroupID() (value int64) { - if s == nil { - return - } - return s.SupergroupID -} - -// GetStickerSetID returns value of StickerSetID field. -func (s *SetSupergroupStickerSetRequest) GetStickerSetID() (value int64) { - if s == nil { - return - } - return s.StickerSetID -} - -// SetSupergroupStickerSet invokes method setSupergroupStickerSet#856ead69 returning error if any. -func (c *Client) SetSupergroupStickerSet(ctx context.Context, request *SetSupergroupStickerSetRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_supergroup_unrestrict_boost_count_gen.go b/tdapi/tl_set_supergroup_unrestrict_boost_count_gen.go deleted file mode 100644 index 55e9c9543..000000000 --- a/tdapi/tl_set_supergroup_unrestrict_boost_count_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetSupergroupUnrestrictBoostCountRequest represents TL type `setSupergroupUnrestrictBoostCount#39ce30a3`. -type SetSupergroupUnrestrictBoostCountRequest struct { - // Identifier of the supergroup - SupergroupID int64 - // New value of the unrestrict_boost_count supergroup setting; 0-8. Use 0 to remove the - // setting - UnrestrictBoostCount int32 -} - -// SetSupergroupUnrestrictBoostCountRequestTypeID is TL type id of SetSupergroupUnrestrictBoostCountRequest. -const SetSupergroupUnrestrictBoostCountRequestTypeID = 0x39ce30a3 - -// Ensuring interfaces in compile-time for SetSupergroupUnrestrictBoostCountRequest. -var ( - _ bin.Encoder = &SetSupergroupUnrestrictBoostCountRequest{} - _ bin.Decoder = &SetSupergroupUnrestrictBoostCountRequest{} - _ bin.BareEncoder = &SetSupergroupUnrestrictBoostCountRequest{} - _ bin.BareDecoder = &SetSupergroupUnrestrictBoostCountRequest{} -) - -func (s *SetSupergroupUnrestrictBoostCountRequest) Zero() bool { - if s == nil { - return true - } - if !(s.SupergroupID == 0) { - return false - } - if !(s.UnrestrictBoostCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetSupergroupUnrestrictBoostCountRequest) String() string { - if s == nil { - return "SetSupergroupUnrestrictBoostCountRequest(nil)" - } - type Alias SetSupergroupUnrestrictBoostCountRequest - return fmt.Sprintf("SetSupergroupUnrestrictBoostCountRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetSupergroupUnrestrictBoostCountRequest) TypeID() uint32 { - return SetSupergroupUnrestrictBoostCountRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetSupergroupUnrestrictBoostCountRequest) TypeName() string { - return "setSupergroupUnrestrictBoostCount" -} - -// TypeInfo returns info about TL type. -func (s *SetSupergroupUnrestrictBoostCountRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setSupergroupUnrestrictBoostCount", - ID: SetSupergroupUnrestrictBoostCountRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "UnrestrictBoostCount", - SchemaName: "unrestrict_boost_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetSupergroupUnrestrictBoostCountRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupUnrestrictBoostCount#39ce30a3 as nil") - } - b.PutID(SetSupergroupUnrestrictBoostCountRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetSupergroupUnrestrictBoostCountRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupUnrestrictBoostCount#39ce30a3 as nil") - } - b.PutInt53(s.SupergroupID) - b.PutInt32(s.UnrestrictBoostCount) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetSupergroupUnrestrictBoostCountRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupUnrestrictBoostCount#39ce30a3 to nil") - } - if err := b.ConsumeID(SetSupergroupUnrestrictBoostCountRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetSupergroupUnrestrictBoostCountRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupUnrestrictBoostCount#39ce30a3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: field supergroup_id: %w", err) - } - s.SupergroupID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: field unrestrict_boost_count: %w", err) - } - s.UnrestrictBoostCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetSupergroupUnrestrictBoostCountRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupUnrestrictBoostCount#39ce30a3 as nil") - } - b.ObjStart() - b.PutID("setSupergroupUnrestrictBoostCount") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(s.SupergroupID) - b.Comma() - b.FieldStart("unrestrict_boost_count") - b.PutInt32(s.UnrestrictBoostCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetSupergroupUnrestrictBoostCountRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupUnrestrictBoostCount#39ce30a3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setSupergroupUnrestrictBoostCount"); err != nil { - return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: field supergroup_id: %w", err) - } - s.SupergroupID = value - case "unrestrict_boost_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupUnrestrictBoostCount#39ce30a3: field unrestrict_boost_count: %w", err) - } - s.UnrestrictBoostCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (s *SetSupergroupUnrestrictBoostCountRequest) GetSupergroupID() (value int64) { - if s == nil { - return - } - return s.SupergroupID -} - -// GetUnrestrictBoostCount returns value of UnrestrictBoostCount field. -func (s *SetSupergroupUnrestrictBoostCountRequest) GetUnrestrictBoostCount() (value int32) { - if s == nil { - return - } - return s.UnrestrictBoostCount -} - -// SetSupergroupUnrestrictBoostCount invokes method setSupergroupUnrestrictBoostCount#39ce30a3 returning error if any. -func (c *Client) SetSupergroupUnrestrictBoostCount(ctx context.Context, request *SetSupergroupUnrestrictBoostCountRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_supergroup_username_gen.go b/tdapi/tl_set_supergroup_username_gen.go deleted file mode 100644 index 22a693aec..000000000 --- a/tdapi/tl_set_supergroup_username_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetSupergroupUsernameRequest represents TL type `setSupergroupUsername#503f4b04`. -type SetSupergroupUsernameRequest struct { - // Identifier of the supergroup or channel - SupergroupID int64 - // New value of the username. Use an empty string to remove the username. The username - // can't be completely removed if there is another active or disabled username - Username string -} - -// SetSupergroupUsernameRequestTypeID is TL type id of SetSupergroupUsernameRequest. -const SetSupergroupUsernameRequestTypeID = 0x503f4b04 - -// Ensuring interfaces in compile-time for SetSupergroupUsernameRequest. -var ( - _ bin.Encoder = &SetSupergroupUsernameRequest{} - _ bin.Decoder = &SetSupergroupUsernameRequest{} - _ bin.BareEncoder = &SetSupergroupUsernameRequest{} - _ bin.BareDecoder = &SetSupergroupUsernameRequest{} -) - -func (s *SetSupergroupUsernameRequest) Zero() bool { - if s == nil { - return true - } - if !(s.SupergroupID == 0) { - return false - } - if !(s.Username == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetSupergroupUsernameRequest) String() string { - if s == nil { - return "SetSupergroupUsernameRequest(nil)" - } - type Alias SetSupergroupUsernameRequest - return fmt.Sprintf("SetSupergroupUsernameRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetSupergroupUsernameRequest) TypeID() uint32 { - return SetSupergroupUsernameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetSupergroupUsernameRequest) TypeName() string { - return "setSupergroupUsername" -} - -// TypeInfo returns info about TL type. -func (s *SetSupergroupUsernameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setSupergroupUsername", - ID: SetSupergroupUsernameRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "Username", - SchemaName: "username", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetSupergroupUsernameRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupUsername#503f4b04 as nil") - } - b.PutID(SetSupergroupUsernameRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetSupergroupUsernameRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupUsername#503f4b04 as nil") - } - b.PutInt53(s.SupergroupID) - b.PutString(s.Username) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetSupergroupUsernameRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupUsername#503f4b04 to nil") - } - if err := b.ConsumeID(SetSupergroupUsernameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setSupergroupUsername#503f4b04: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetSupergroupUsernameRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupUsername#503f4b04 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupUsername#503f4b04: field supergroup_id: %w", err) - } - s.SupergroupID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupUsername#503f4b04: field username: %w", err) - } - s.Username = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetSupergroupUsernameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setSupergroupUsername#503f4b04 as nil") - } - b.ObjStart() - b.PutID("setSupergroupUsername") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(s.SupergroupID) - b.Comma() - b.FieldStart("username") - b.PutString(s.Username) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetSupergroupUsernameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setSupergroupUsername#503f4b04 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setSupergroupUsername"); err != nil { - return fmt.Errorf("unable to decode setSupergroupUsername#503f4b04: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupUsername#503f4b04: field supergroup_id: %w", err) - } - s.SupergroupID = value - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setSupergroupUsername#503f4b04: field username: %w", err) - } - s.Username = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (s *SetSupergroupUsernameRequest) GetSupergroupID() (value int64) { - if s == nil { - return - } - return s.SupergroupID -} - -// GetUsername returns value of Username field. -func (s *SetSupergroupUsernameRequest) GetUsername() (value string) { - if s == nil { - return - } - return s.Username -} - -// SetSupergroupUsername invokes method setSupergroupUsername#503f4b04 returning error if any. -func (c *Client) SetSupergroupUsername(ctx context.Context, request *SetSupergroupUsernameRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_tdlib_parameters_gen.go b/tdapi/tl_set_tdlib_parameters_gen.go deleted file mode 100644 index adc1c0899..000000000 --- a/tdapi/tl_set_tdlib_parameters_gen.go +++ /dev/null @@ -1,653 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetTdlibParametersRequest represents TL type `setTdlibParameters#d1c0f62e`. -type SetTdlibParametersRequest struct { - // Pass true to use Telegram test environment instead of the production environment - UseTestDC bool - // The path to the directory for the persistent database; if empty, the current working - // directory will be used - DatabaseDirectory string - // The path to the directory for storing files; if empty, database_directory will be used - FilesDirectory string - // Encryption key for the database. If the encryption key is invalid, then an error with - // code 401 will be returned - DatabaseEncryptionKey []byte - // Pass true to keep information about downloaded and uploaded files between application - // restarts - UseFileDatabase bool - // Pass true to keep cache of users, basic groups, supergroups, channels and secret chats - // between restarts. Implies use_file_database - UseChatInfoDatabase bool - // Pass true to keep cache of chats and messages between restarts. Implies - // use_chat_info_database - UseMessageDatabase bool - // Pass true to enable support for secret chats - UseSecretChats bool - // Application identifier for Telegram API access, which can be obtained at https://my - // telegram.org - APIID int32 - // Application identifier hash for Telegram API access, which can be obtained at - // https://my.telegram.org - APIHash string - // IETF language tag of the user's operating system language; must be non-empty - SystemLanguageCode string - // Model of the device the application is being run on; must be non-empty - DeviceModel string - // Version of the operating system the application is being run on. If empty, the version - // is automatically detected by TDLib - SystemVersion string - // Application version; must be non-empty - ApplicationVersion string -} - -// SetTdlibParametersRequestTypeID is TL type id of SetTdlibParametersRequest. -const SetTdlibParametersRequestTypeID = 0xd1c0f62e - -// Ensuring interfaces in compile-time for SetTdlibParametersRequest. -var ( - _ bin.Encoder = &SetTdlibParametersRequest{} - _ bin.Decoder = &SetTdlibParametersRequest{} - _ bin.BareEncoder = &SetTdlibParametersRequest{} - _ bin.BareDecoder = &SetTdlibParametersRequest{} -) - -func (s *SetTdlibParametersRequest) Zero() bool { - if s == nil { - return true - } - if !(s.UseTestDC == false) { - return false - } - if !(s.DatabaseDirectory == "") { - return false - } - if !(s.FilesDirectory == "") { - return false - } - if !(s.DatabaseEncryptionKey == nil) { - return false - } - if !(s.UseFileDatabase == false) { - return false - } - if !(s.UseChatInfoDatabase == false) { - return false - } - if !(s.UseMessageDatabase == false) { - return false - } - if !(s.UseSecretChats == false) { - return false - } - if !(s.APIID == 0) { - return false - } - if !(s.APIHash == "") { - return false - } - if !(s.SystemLanguageCode == "") { - return false - } - if !(s.DeviceModel == "") { - return false - } - if !(s.SystemVersion == "") { - return false - } - if !(s.ApplicationVersion == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetTdlibParametersRequest) String() string { - if s == nil { - return "SetTdlibParametersRequest(nil)" - } - type Alias SetTdlibParametersRequest - return fmt.Sprintf("SetTdlibParametersRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetTdlibParametersRequest) TypeID() uint32 { - return SetTdlibParametersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetTdlibParametersRequest) TypeName() string { - return "setTdlibParameters" -} - -// TypeInfo returns info about TL type. -func (s *SetTdlibParametersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setTdlibParameters", - ID: SetTdlibParametersRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UseTestDC", - SchemaName: "use_test_dc", - }, - { - Name: "DatabaseDirectory", - SchemaName: "database_directory", - }, - { - Name: "FilesDirectory", - SchemaName: "files_directory", - }, - { - Name: "DatabaseEncryptionKey", - SchemaName: "database_encryption_key", - }, - { - Name: "UseFileDatabase", - SchemaName: "use_file_database", - }, - { - Name: "UseChatInfoDatabase", - SchemaName: "use_chat_info_database", - }, - { - Name: "UseMessageDatabase", - SchemaName: "use_message_database", - }, - { - Name: "UseSecretChats", - SchemaName: "use_secret_chats", - }, - { - Name: "APIID", - SchemaName: "api_id", - }, - { - Name: "APIHash", - SchemaName: "api_hash", - }, - { - Name: "SystemLanguageCode", - SchemaName: "system_language_code", - }, - { - Name: "DeviceModel", - SchemaName: "device_model", - }, - { - Name: "SystemVersion", - SchemaName: "system_version", - }, - { - Name: "ApplicationVersion", - SchemaName: "application_version", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetTdlibParametersRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setTdlibParameters#d1c0f62e as nil") - } - b.PutID(SetTdlibParametersRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetTdlibParametersRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setTdlibParameters#d1c0f62e as nil") - } - b.PutBool(s.UseTestDC) - b.PutString(s.DatabaseDirectory) - b.PutString(s.FilesDirectory) - b.PutBytes(s.DatabaseEncryptionKey) - b.PutBool(s.UseFileDatabase) - b.PutBool(s.UseChatInfoDatabase) - b.PutBool(s.UseMessageDatabase) - b.PutBool(s.UseSecretChats) - b.PutInt32(s.APIID) - b.PutString(s.APIHash) - b.PutString(s.SystemLanguageCode) - b.PutString(s.DeviceModel) - b.PutString(s.SystemVersion) - b.PutString(s.ApplicationVersion) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetTdlibParametersRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setTdlibParameters#d1c0f62e to nil") - } - if err := b.ConsumeID(SetTdlibParametersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetTdlibParametersRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setTdlibParameters#d1c0f62e to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field use_test_dc: %w", err) - } - s.UseTestDC = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field database_directory: %w", err) - } - s.DatabaseDirectory = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field files_directory: %w", err) - } - s.FilesDirectory = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field database_encryption_key: %w", err) - } - s.DatabaseEncryptionKey = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field use_file_database: %w", err) - } - s.UseFileDatabase = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field use_chat_info_database: %w", err) - } - s.UseChatInfoDatabase = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field use_message_database: %w", err) - } - s.UseMessageDatabase = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field use_secret_chats: %w", err) - } - s.UseSecretChats = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field api_id: %w", err) - } - s.APIID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field api_hash: %w", err) - } - s.APIHash = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field system_language_code: %w", err) - } - s.SystemLanguageCode = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field device_model: %w", err) - } - s.DeviceModel = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field system_version: %w", err) - } - s.SystemVersion = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field application_version: %w", err) - } - s.ApplicationVersion = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetTdlibParametersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setTdlibParameters#d1c0f62e as nil") - } - b.ObjStart() - b.PutID("setTdlibParameters") - b.Comma() - b.FieldStart("use_test_dc") - b.PutBool(s.UseTestDC) - b.Comma() - b.FieldStart("database_directory") - b.PutString(s.DatabaseDirectory) - b.Comma() - b.FieldStart("files_directory") - b.PutString(s.FilesDirectory) - b.Comma() - b.FieldStart("database_encryption_key") - b.PutBytes(s.DatabaseEncryptionKey) - b.Comma() - b.FieldStart("use_file_database") - b.PutBool(s.UseFileDatabase) - b.Comma() - b.FieldStart("use_chat_info_database") - b.PutBool(s.UseChatInfoDatabase) - b.Comma() - b.FieldStart("use_message_database") - b.PutBool(s.UseMessageDatabase) - b.Comma() - b.FieldStart("use_secret_chats") - b.PutBool(s.UseSecretChats) - b.Comma() - b.FieldStart("api_id") - b.PutInt32(s.APIID) - b.Comma() - b.FieldStart("api_hash") - b.PutString(s.APIHash) - b.Comma() - b.FieldStart("system_language_code") - b.PutString(s.SystemLanguageCode) - b.Comma() - b.FieldStart("device_model") - b.PutString(s.DeviceModel) - b.Comma() - b.FieldStart("system_version") - b.PutString(s.SystemVersion) - b.Comma() - b.FieldStart("application_version") - b.PutString(s.ApplicationVersion) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetTdlibParametersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setTdlibParameters#d1c0f62e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setTdlibParameters"); err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: %w", err) - } - case "use_test_dc": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field use_test_dc: %w", err) - } - s.UseTestDC = value - case "database_directory": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field database_directory: %w", err) - } - s.DatabaseDirectory = value - case "files_directory": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field files_directory: %w", err) - } - s.FilesDirectory = value - case "database_encryption_key": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field database_encryption_key: %w", err) - } - s.DatabaseEncryptionKey = value - case "use_file_database": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field use_file_database: %w", err) - } - s.UseFileDatabase = value - case "use_chat_info_database": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field use_chat_info_database: %w", err) - } - s.UseChatInfoDatabase = value - case "use_message_database": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field use_message_database: %w", err) - } - s.UseMessageDatabase = value - case "use_secret_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field use_secret_chats: %w", err) - } - s.UseSecretChats = value - case "api_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field api_id: %w", err) - } - s.APIID = value - case "api_hash": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field api_hash: %w", err) - } - s.APIHash = value - case "system_language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field system_language_code: %w", err) - } - s.SystemLanguageCode = value - case "device_model": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field device_model: %w", err) - } - s.DeviceModel = value - case "system_version": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field system_version: %w", err) - } - s.SystemVersion = value - case "application_version": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setTdlibParameters#d1c0f62e: field application_version: %w", err) - } - s.ApplicationVersion = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUseTestDC returns value of UseTestDC field. -func (s *SetTdlibParametersRequest) GetUseTestDC() (value bool) { - if s == nil { - return - } - return s.UseTestDC -} - -// GetDatabaseDirectory returns value of DatabaseDirectory field. -func (s *SetTdlibParametersRequest) GetDatabaseDirectory() (value string) { - if s == nil { - return - } - return s.DatabaseDirectory -} - -// GetFilesDirectory returns value of FilesDirectory field. -func (s *SetTdlibParametersRequest) GetFilesDirectory() (value string) { - if s == nil { - return - } - return s.FilesDirectory -} - -// GetDatabaseEncryptionKey returns value of DatabaseEncryptionKey field. -func (s *SetTdlibParametersRequest) GetDatabaseEncryptionKey() (value []byte) { - if s == nil { - return - } - return s.DatabaseEncryptionKey -} - -// GetUseFileDatabase returns value of UseFileDatabase field. -func (s *SetTdlibParametersRequest) GetUseFileDatabase() (value bool) { - if s == nil { - return - } - return s.UseFileDatabase -} - -// GetUseChatInfoDatabase returns value of UseChatInfoDatabase field. -func (s *SetTdlibParametersRequest) GetUseChatInfoDatabase() (value bool) { - if s == nil { - return - } - return s.UseChatInfoDatabase -} - -// GetUseMessageDatabase returns value of UseMessageDatabase field. -func (s *SetTdlibParametersRequest) GetUseMessageDatabase() (value bool) { - if s == nil { - return - } - return s.UseMessageDatabase -} - -// GetUseSecretChats returns value of UseSecretChats field. -func (s *SetTdlibParametersRequest) GetUseSecretChats() (value bool) { - if s == nil { - return - } - return s.UseSecretChats -} - -// GetAPIID returns value of APIID field. -func (s *SetTdlibParametersRequest) GetAPIID() (value int32) { - if s == nil { - return - } - return s.APIID -} - -// GetAPIHash returns value of APIHash field. -func (s *SetTdlibParametersRequest) GetAPIHash() (value string) { - if s == nil { - return - } - return s.APIHash -} - -// GetSystemLanguageCode returns value of SystemLanguageCode field. -func (s *SetTdlibParametersRequest) GetSystemLanguageCode() (value string) { - if s == nil { - return - } - return s.SystemLanguageCode -} - -// GetDeviceModel returns value of DeviceModel field. -func (s *SetTdlibParametersRequest) GetDeviceModel() (value string) { - if s == nil { - return - } - return s.DeviceModel -} - -// GetSystemVersion returns value of SystemVersion field. -func (s *SetTdlibParametersRequest) GetSystemVersion() (value string) { - if s == nil { - return - } - return s.SystemVersion -} - -// GetApplicationVersion returns value of ApplicationVersion field. -func (s *SetTdlibParametersRequest) GetApplicationVersion() (value string) { - if s == nil { - return - } - return s.ApplicationVersion -} - -// SetTdlibParameters invokes method setTdlibParameters#d1c0f62e returning error if any. -func (c *Client) SetTdlibParameters(ctx context.Context, request *SetTdlibParametersRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_user_emoji_status_gen.go b/tdapi/tl_set_user_emoji_status_gen.go deleted file mode 100644 index a433d92a3..000000000 --- a/tdapi/tl_set_user_emoji_status_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetUserEmojiStatusRequest represents TL type `setUserEmojiStatus#e5165bcb`. -type SetUserEmojiStatusRequest struct { - // Identifier of the user - UserID int64 - // New emoji status; pass null to switch to the default badge - EmojiStatus EmojiStatus -} - -// SetUserEmojiStatusRequestTypeID is TL type id of SetUserEmojiStatusRequest. -const SetUserEmojiStatusRequestTypeID = 0xe5165bcb - -// Ensuring interfaces in compile-time for SetUserEmojiStatusRequest. -var ( - _ bin.Encoder = &SetUserEmojiStatusRequest{} - _ bin.Decoder = &SetUserEmojiStatusRequest{} - _ bin.BareEncoder = &SetUserEmojiStatusRequest{} - _ bin.BareDecoder = &SetUserEmojiStatusRequest{} -) - -func (s *SetUserEmojiStatusRequest) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.EmojiStatus.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetUserEmojiStatusRequest) String() string { - if s == nil { - return "SetUserEmojiStatusRequest(nil)" - } - type Alias SetUserEmojiStatusRequest - return fmt.Sprintf("SetUserEmojiStatusRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetUserEmojiStatusRequest) TypeID() uint32 { - return SetUserEmojiStatusRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetUserEmojiStatusRequest) TypeName() string { - return "setUserEmojiStatus" -} - -// TypeInfo returns info about TL type. -func (s *SetUserEmojiStatusRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setUserEmojiStatus", - ID: SetUserEmojiStatusRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "EmojiStatus", - SchemaName: "emoji_status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetUserEmojiStatusRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setUserEmojiStatus#e5165bcb as nil") - } - b.PutID(SetUserEmojiStatusRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetUserEmojiStatusRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setUserEmojiStatus#e5165bcb as nil") - } - b.PutInt53(s.UserID) - if err := s.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode setUserEmojiStatus#e5165bcb: field emoji_status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetUserEmojiStatusRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setUserEmojiStatus#e5165bcb to nil") - } - if err := b.ConsumeID(SetUserEmojiStatusRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetUserEmojiStatusRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setUserEmojiStatus#e5165bcb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: field user_id: %w", err) - } - s.UserID = value - } - { - if err := s.EmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: field emoji_status: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetUserEmojiStatusRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setUserEmojiStatus#e5165bcb as nil") - } - b.ObjStart() - b.PutID("setUserEmojiStatus") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("emoji_status") - if err := s.EmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setUserEmojiStatus#e5165bcb: field emoji_status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetUserEmojiStatusRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setUserEmojiStatus#e5165bcb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setUserEmojiStatus"); err != nil { - return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: field user_id: %w", err) - } - s.UserID = value - case "emoji_status": - if err := s.EmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setUserEmojiStatus#e5165bcb: field emoji_status: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *SetUserEmojiStatusRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetEmojiStatus returns value of EmojiStatus field. -func (s *SetUserEmojiStatusRequest) GetEmojiStatus() (value EmojiStatus) { - if s == nil { - return - } - return s.EmojiStatus -} - -// SetUserEmojiStatus invokes method setUserEmojiStatus#e5165bcb returning error if any. -func (c *Client) SetUserEmojiStatus(ctx context.Context, request *SetUserEmojiStatusRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_user_personal_profile_photo_gen.go b/tdapi/tl_set_user_personal_profile_photo_gen.go deleted file mode 100644 index 962228701..000000000 --- a/tdapi/tl_set_user_personal_profile_photo_gen.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetUserPersonalProfilePhotoRequest represents TL type `setUserPersonalProfilePhoto#1baa28f6`. -type SetUserPersonalProfilePhotoRequest struct { - // User identifier - UserID int64 - // Profile photo to set; pass null to delete the photo; inputChatPhotoPrevious isn't - // supported in this function - Photo InputChatPhotoClass -} - -// SetUserPersonalProfilePhotoRequestTypeID is TL type id of SetUserPersonalProfilePhotoRequest. -const SetUserPersonalProfilePhotoRequestTypeID = 0x1baa28f6 - -// Ensuring interfaces in compile-time for SetUserPersonalProfilePhotoRequest. -var ( - _ bin.Encoder = &SetUserPersonalProfilePhotoRequest{} - _ bin.Decoder = &SetUserPersonalProfilePhotoRequest{} - _ bin.BareEncoder = &SetUserPersonalProfilePhotoRequest{} - _ bin.BareDecoder = &SetUserPersonalProfilePhotoRequest{} -) - -func (s *SetUserPersonalProfilePhotoRequest) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Photo == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetUserPersonalProfilePhotoRequest) String() string { - if s == nil { - return "SetUserPersonalProfilePhotoRequest(nil)" - } - type Alias SetUserPersonalProfilePhotoRequest - return fmt.Sprintf("SetUserPersonalProfilePhotoRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetUserPersonalProfilePhotoRequest) TypeID() uint32 { - return SetUserPersonalProfilePhotoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetUserPersonalProfilePhotoRequest) TypeName() string { - return "setUserPersonalProfilePhoto" -} - -// TypeInfo returns info about TL type. -func (s *SetUserPersonalProfilePhotoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setUserPersonalProfilePhoto", - ID: SetUserPersonalProfilePhotoRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetUserPersonalProfilePhotoRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setUserPersonalProfilePhoto#1baa28f6 as nil") - } - b.PutID(SetUserPersonalProfilePhotoRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetUserPersonalProfilePhotoRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setUserPersonalProfilePhoto#1baa28f6 as nil") - } - b.PutInt53(s.UserID) - if s.Photo == nil { - return fmt.Errorf("unable to encode setUserPersonalProfilePhoto#1baa28f6: field photo is nil") - } - if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode setUserPersonalProfilePhoto#1baa28f6: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetUserPersonalProfilePhotoRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setUserPersonalProfilePhoto#1baa28f6 to nil") - } - if err := b.ConsumeID(SetUserPersonalProfilePhotoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setUserPersonalProfilePhoto#1baa28f6: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetUserPersonalProfilePhotoRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setUserPersonalProfilePhoto#1baa28f6 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setUserPersonalProfilePhoto#1baa28f6: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := DecodeInputChatPhoto(b) - if err != nil { - return fmt.Errorf("unable to decode setUserPersonalProfilePhoto#1baa28f6: field photo: %w", err) - } - s.Photo = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetUserPersonalProfilePhotoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setUserPersonalProfilePhoto#1baa28f6 as nil") - } - b.ObjStart() - b.PutID("setUserPersonalProfilePhoto") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("photo") - if s.Photo == nil { - return fmt.Errorf("unable to encode setUserPersonalProfilePhoto#1baa28f6: field photo is nil") - } - if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setUserPersonalProfilePhoto#1baa28f6: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetUserPersonalProfilePhotoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setUserPersonalProfilePhoto#1baa28f6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setUserPersonalProfilePhoto"); err != nil { - return fmt.Errorf("unable to decode setUserPersonalProfilePhoto#1baa28f6: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setUserPersonalProfilePhoto#1baa28f6: field user_id: %w", err) - } - s.UserID = value - case "photo": - value, err := DecodeTDLibJSONInputChatPhoto(b) - if err != nil { - return fmt.Errorf("unable to decode setUserPersonalProfilePhoto#1baa28f6: field photo: %w", err) - } - s.Photo = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *SetUserPersonalProfilePhotoRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetPhoto returns value of Photo field. -func (s *SetUserPersonalProfilePhotoRequest) GetPhoto() (value InputChatPhotoClass) { - if s == nil { - return - } - return s.Photo -} - -// SetUserPersonalProfilePhoto invokes method setUserPersonalProfilePhoto#1baa28f6 returning error if any. -func (c *Client) SetUserPersonalProfilePhoto(ctx context.Context, request *SetUserPersonalProfilePhotoRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_user_privacy_setting_rules_gen.go b/tdapi/tl_set_user_privacy_setting_rules_gen.go deleted file mode 100644 index 920c93ac5..000000000 --- a/tdapi/tl_set_user_privacy_setting_rules_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetUserPrivacySettingRulesRequest represents TL type `setUserPrivacySettingRules#e3c230fb`. -type SetUserPrivacySettingRulesRequest struct { - // The privacy setting - Setting UserPrivacySettingClass - // The new privacy rules - Rules UserPrivacySettingRules -} - -// SetUserPrivacySettingRulesRequestTypeID is TL type id of SetUserPrivacySettingRulesRequest. -const SetUserPrivacySettingRulesRequestTypeID = 0xe3c230fb - -// Ensuring interfaces in compile-time for SetUserPrivacySettingRulesRequest. -var ( - _ bin.Encoder = &SetUserPrivacySettingRulesRequest{} - _ bin.Decoder = &SetUserPrivacySettingRulesRequest{} - _ bin.BareEncoder = &SetUserPrivacySettingRulesRequest{} - _ bin.BareDecoder = &SetUserPrivacySettingRulesRequest{} -) - -func (s *SetUserPrivacySettingRulesRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Setting == nil) { - return false - } - if !(s.Rules.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetUserPrivacySettingRulesRequest) String() string { - if s == nil { - return "SetUserPrivacySettingRulesRequest(nil)" - } - type Alias SetUserPrivacySettingRulesRequest - return fmt.Sprintf("SetUserPrivacySettingRulesRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetUserPrivacySettingRulesRequest) TypeID() uint32 { - return SetUserPrivacySettingRulesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetUserPrivacySettingRulesRequest) TypeName() string { - return "setUserPrivacySettingRules" -} - -// TypeInfo returns info about TL type. -func (s *SetUserPrivacySettingRulesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setUserPrivacySettingRules", - ID: SetUserPrivacySettingRulesRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Setting", - SchemaName: "setting", - }, - { - Name: "Rules", - SchemaName: "rules", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetUserPrivacySettingRulesRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setUserPrivacySettingRules#e3c230fb as nil") - } - b.PutID(SetUserPrivacySettingRulesRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetUserPrivacySettingRulesRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setUserPrivacySettingRules#e3c230fb as nil") - } - if s.Setting == nil { - return fmt.Errorf("unable to encode setUserPrivacySettingRules#e3c230fb: field setting is nil") - } - if err := s.Setting.Encode(b); err != nil { - return fmt.Errorf("unable to encode setUserPrivacySettingRules#e3c230fb: field setting: %w", err) - } - if err := s.Rules.Encode(b); err != nil { - return fmt.Errorf("unable to encode setUserPrivacySettingRules#e3c230fb: field rules: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetUserPrivacySettingRulesRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setUserPrivacySettingRules#e3c230fb to nil") - } - if err := b.ConsumeID(SetUserPrivacySettingRulesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setUserPrivacySettingRules#e3c230fb: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetUserPrivacySettingRulesRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setUserPrivacySettingRules#e3c230fb to nil") - } - { - value, err := DecodeUserPrivacySetting(b) - if err != nil { - return fmt.Errorf("unable to decode setUserPrivacySettingRules#e3c230fb: field setting: %w", err) - } - s.Setting = value - } - { - if err := s.Rules.Decode(b); err != nil { - return fmt.Errorf("unable to decode setUserPrivacySettingRules#e3c230fb: field rules: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetUserPrivacySettingRulesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setUserPrivacySettingRules#e3c230fb as nil") - } - b.ObjStart() - b.PutID("setUserPrivacySettingRules") - b.Comma() - b.FieldStart("setting") - if s.Setting == nil { - return fmt.Errorf("unable to encode setUserPrivacySettingRules#e3c230fb: field setting is nil") - } - if err := s.Setting.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setUserPrivacySettingRules#e3c230fb: field setting: %w", err) - } - b.Comma() - b.FieldStart("rules") - if err := s.Rules.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setUserPrivacySettingRules#e3c230fb: field rules: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetUserPrivacySettingRulesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setUserPrivacySettingRules#e3c230fb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setUserPrivacySettingRules"); err != nil { - return fmt.Errorf("unable to decode setUserPrivacySettingRules#e3c230fb: %w", err) - } - case "setting": - value, err := DecodeTDLibJSONUserPrivacySetting(b) - if err != nil { - return fmt.Errorf("unable to decode setUserPrivacySettingRules#e3c230fb: field setting: %w", err) - } - s.Setting = value - case "rules": - if err := s.Rules.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setUserPrivacySettingRules#e3c230fb: field rules: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSetting returns value of Setting field. -func (s *SetUserPrivacySettingRulesRequest) GetSetting() (value UserPrivacySettingClass) { - if s == nil { - return - } - return s.Setting -} - -// GetRules returns value of Rules field. -func (s *SetUserPrivacySettingRulesRequest) GetRules() (value UserPrivacySettingRules) { - if s == nil { - return - } - return s.Rules -} - -// SetUserPrivacySettingRules invokes method setUserPrivacySettingRules#e3c230fb returning error if any. -func (c *Client) SetUserPrivacySettingRules(ctx context.Context, request *SetUserPrivacySettingRulesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_user_support_info_gen.go b/tdapi/tl_set_user_support_info_gen.go deleted file mode 100644 index 3d9014b3f..000000000 --- a/tdapi/tl_set_user_support_info_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetUserSupportInfoRequest represents TL type `setUserSupportInfo#837c9803`. -type SetUserSupportInfoRequest struct { - // User identifier - UserID int64 - // New information message - Message FormattedText -} - -// SetUserSupportInfoRequestTypeID is TL type id of SetUserSupportInfoRequest. -const SetUserSupportInfoRequestTypeID = 0x837c9803 - -// Ensuring interfaces in compile-time for SetUserSupportInfoRequest. -var ( - _ bin.Encoder = &SetUserSupportInfoRequest{} - _ bin.Decoder = &SetUserSupportInfoRequest{} - _ bin.BareEncoder = &SetUserSupportInfoRequest{} - _ bin.BareDecoder = &SetUserSupportInfoRequest{} -) - -func (s *SetUserSupportInfoRequest) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Message.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetUserSupportInfoRequest) String() string { - if s == nil { - return "SetUserSupportInfoRequest(nil)" - } - type Alias SetUserSupportInfoRequest - return fmt.Sprintf("SetUserSupportInfoRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetUserSupportInfoRequest) TypeID() uint32 { - return SetUserSupportInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetUserSupportInfoRequest) TypeName() string { - return "setUserSupportInfo" -} - -// TypeInfo returns info about TL type. -func (s *SetUserSupportInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setUserSupportInfo", - ID: SetUserSupportInfoRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetUserSupportInfoRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setUserSupportInfo#837c9803 as nil") - } - b.PutID(SetUserSupportInfoRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetUserSupportInfoRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setUserSupportInfo#837c9803 as nil") - } - b.PutInt53(s.UserID) - if err := s.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode setUserSupportInfo#837c9803: field message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetUserSupportInfoRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setUserSupportInfo#837c9803 to nil") - } - if err := b.ConsumeID(SetUserSupportInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setUserSupportInfo#837c9803: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetUserSupportInfoRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setUserSupportInfo#837c9803 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setUserSupportInfo#837c9803: field user_id: %w", err) - } - s.UserID = value - } - { - if err := s.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode setUserSupportInfo#837c9803: field message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetUserSupportInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setUserSupportInfo#837c9803 as nil") - } - b.ObjStart() - b.PutID("setUserSupportInfo") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("message") - if err := s.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setUserSupportInfo#837c9803: field message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetUserSupportInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setUserSupportInfo#837c9803 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setUserSupportInfo"); err != nil { - return fmt.Errorf("unable to decode setUserSupportInfo#837c9803: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setUserSupportInfo#837c9803: field user_id: %w", err) - } - s.UserID = value - case "message": - if err := s.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode setUserSupportInfo#837c9803: field message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *SetUserSupportInfoRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetMessage returns value of Message field. -func (s *SetUserSupportInfoRequest) GetMessage() (value FormattedText) { - if s == nil { - return - } - return s.Message -} - -// SetUserSupportInfo invokes method setUserSupportInfo#837c9803 returning error if any. -func (c *Client) SetUserSupportInfo(ctx context.Context, request *SetUserSupportInfoRequest) (*UserSupportInfo, error) { - var result UserSupportInfo - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_set_username_gen.go b/tdapi/tl_set_username_gen.go deleted file mode 100644 index 4c9b80f30..000000000 --- a/tdapi/tl_set_username_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetUsernameRequest represents TL type `setUsername#1a385c1e`. -type SetUsernameRequest struct { - // The new value of the username. Use an empty string to remove the username. The - // username can't be completely removed if there is another active or disabled username - Username string -} - -// SetUsernameRequestTypeID is TL type id of SetUsernameRequest. -const SetUsernameRequestTypeID = 0x1a385c1e - -// Ensuring interfaces in compile-time for SetUsernameRequest. -var ( - _ bin.Encoder = &SetUsernameRequest{} - _ bin.Decoder = &SetUsernameRequest{} - _ bin.BareEncoder = &SetUsernameRequest{} - _ bin.BareDecoder = &SetUsernameRequest{} -) - -func (s *SetUsernameRequest) Zero() bool { - if s == nil { - return true - } - if !(s.Username == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetUsernameRequest) String() string { - if s == nil { - return "SetUsernameRequest(nil)" - } - type Alias SetUsernameRequest - return fmt.Sprintf("SetUsernameRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetUsernameRequest) TypeID() uint32 { - return SetUsernameRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetUsernameRequest) TypeName() string { - return "setUsername" -} - -// TypeInfo returns info about TL type. -func (s *SetUsernameRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setUsername", - ID: SetUsernameRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Username", - SchemaName: "username", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetUsernameRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setUsername#1a385c1e as nil") - } - b.PutID(SetUsernameRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetUsernameRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setUsername#1a385c1e as nil") - } - b.PutString(s.Username) - return nil -} - -// Decode implements bin.Decoder. -func (s *SetUsernameRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setUsername#1a385c1e to nil") - } - if err := b.ConsumeID(SetUsernameRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setUsername#1a385c1e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetUsernameRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setUsername#1a385c1e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setUsername#1a385c1e: field username: %w", err) - } - s.Username = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetUsernameRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setUsername#1a385c1e as nil") - } - b.ObjStart() - b.PutID("setUsername") - b.Comma() - b.FieldStart("username") - b.PutString(s.Username) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetUsernameRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setUsername#1a385c1e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setUsername"); err != nil { - return fmt.Errorf("unable to decode setUsername#1a385c1e: %w", err) - } - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode setUsername#1a385c1e: field username: %w", err) - } - s.Username = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUsername returns value of Username field. -func (s *SetUsernameRequest) GetUsername() (value string) { - if s == nil { - return - } - return s.Username -} - -// SetUsername invokes method setUsername#1a385c1e returning error if any. -func (c *Client) SetUsername(ctx context.Context, username string) error { - var ok Ok - - request := &SetUsernameRequest{ - Username: username, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_set_video_chat_default_participant_gen.go b/tdapi/tl_set_video_chat_default_participant_gen.go deleted file mode 100644 index 05c7a717f..000000000 --- a/tdapi/tl_set_video_chat_default_participant_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SetVideoChatDefaultParticipantRequest represents TL type `setVideoChatDefaultParticipant#f1a672b3`. -type SetVideoChatDefaultParticipantRequest struct { - // Chat identifier - ChatID int64 - // Default group call participant identifier to join the video chats - DefaultParticipantID MessageSenderClass -} - -// SetVideoChatDefaultParticipantRequestTypeID is TL type id of SetVideoChatDefaultParticipantRequest. -const SetVideoChatDefaultParticipantRequestTypeID = 0xf1a672b3 - -// Ensuring interfaces in compile-time for SetVideoChatDefaultParticipantRequest. -var ( - _ bin.Encoder = &SetVideoChatDefaultParticipantRequest{} - _ bin.Decoder = &SetVideoChatDefaultParticipantRequest{} - _ bin.BareEncoder = &SetVideoChatDefaultParticipantRequest{} - _ bin.BareDecoder = &SetVideoChatDefaultParticipantRequest{} -) - -func (s *SetVideoChatDefaultParticipantRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.DefaultParticipantID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SetVideoChatDefaultParticipantRequest) String() string { - if s == nil { - return "SetVideoChatDefaultParticipantRequest(nil)" - } - type Alias SetVideoChatDefaultParticipantRequest - return fmt.Sprintf("SetVideoChatDefaultParticipantRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SetVideoChatDefaultParticipantRequest) TypeID() uint32 { - return SetVideoChatDefaultParticipantRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SetVideoChatDefaultParticipantRequest) TypeName() string { - return "setVideoChatDefaultParticipant" -} - -// TypeInfo returns info about TL type. -func (s *SetVideoChatDefaultParticipantRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "setVideoChatDefaultParticipant", - ID: SetVideoChatDefaultParticipantRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "DefaultParticipantID", - SchemaName: "default_participant_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SetVideoChatDefaultParticipantRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setVideoChatDefaultParticipant#f1a672b3 as nil") - } - b.PutID(SetVideoChatDefaultParticipantRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SetVideoChatDefaultParticipantRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode setVideoChatDefaultParticipant#f1a672b3 as nil") - } - b.PutInt53(s.ChatID) - if s.DefaultParticipantID == nil { - return fmt.Errorf("unable to encode setVideoChatDefaultParticipant#f1a672b3: field default_participant_id is nil") - } - if err := s.DefaultParticipantID.Encode(b); err != nil { - return fmt.Errorf("unable to encode setVideoChatDefaultParticipant#f1a672b3: field default_participant_id: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SetVideoChatDefaultParticipantRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setVideoChatDefaultParticipant#f1a672b3 to nil") - } - if err := b.ConsumeID(SetVideoChatDefaultParticipantRequestTypeID); err != nil { - return fmt.Errorf("unable to decode setVideoChatDefaultParticipant#f1a672b3: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SetVideoChatDefaultParticipantRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode setVideoChatDefaultParticipant#f1a672b3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setVideoChatDefaultParticipant#f1a672b3: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setVideoChatDefaultParticipant#f1a672b3: field default_participant_id: %w", err) - } - s.DefaultParticipantID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SetVideoChatDefaultParticipantRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode setVideoChatDefaultParticipant#f1a672b3 as nil") - } - b.ObjStart() - b.PutID("setVideoChatDefaultParticipant") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("default_participant_id") - if s.DefaultParticipantID == nil { - return fmt.Errorf("unable to encode setVideoChatDefaultParticipant#f1a672b3: field default_participant_id is nil") - } - if err := s.DefaultParticipantID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode setVideoChatDefaultParticipant#f1a672b3: field default_participant_id: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SetVideoChatDefaultParticipantRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode setVideoChatDefaultParticipant#f1a672b3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("setVideoChatDefaultParticipant"); err != nil { - return fmt.Errorf("unable to decode setVideoChatDefaultParticipant#f1a672b3: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode setVideoChatDefaultParticipant#f1a672b3: field chat_id: %w", err) - } - s.ChatID = value - case "default_participant_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode setVideoChatDefaultParticipant#f1a672b3: field default_participant_id: %w", err) - } - s.DefaultParticipantID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SetVideoChatDefaultParticipantRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetDefaultParticipantID returns value of DefaultParticipantID field. -func (s *SetVideoChatDefaultParticipantRequest) GetDefaultParticipantID() (value MessageSenderClass) { - if s == nil { - return - } - return s.DefaultParticipantID -} - -// SetVideoChatDefaultParticipant invokes method setVideoChatDefaultParticipant#f1a672b3 returning error if any. -func (c *Client) SetVideoChatDefaultParticipant(ctx context.Context, request *SetVideoChatDefaultParticipantRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_share_chat_with_bot_gen.go b/tdapi/tl_share_chat_with_bot_gen.go deleted file mode 100644 index 5a6c8235c..000000000 --- a/tdapi/tl_share_chat_with_bot_gen.go +++ /dev/null @@ -1,340 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ShareChatWithBotRequest represents TL type `shareChatWithBot#a6530ae2`. -type ShareChatWithBotRequest struct { - // Identifier of the chat with the bot - ChatID int64 - // Identifier of the message with the button - MessageID int64 - // Identifier of the button - ButtonID int32 - // Identifier of the shared chat - SharedChatID int64 - // Pass true to check that the chat can be shared by the button instead of actually - // sharing it. Doesn't check bot_is_member and bot_administrator_rights restrictions. - OnlyCheck bool -} - -// ShareChatWithBotRequestTypeID is TL type id of ShareChatWithBotRequest. -const ShareChatWithBotRequestTypeID = 0xa6530ae2 - -// Ensuring interfaces in compile-time for ShareChatWithBotRequest. -var ( - _ bin.Encoder = &ShareChatWithBotRequest{} - _ bin.Decoder = &ShareChatWithBotRequest{} - _ bin.BareEncoder = &ShareChatWithBotRequest{} - _ bin.BareDecoder = &ShareChatWithBotRequest{} -) - -func (s *ShareChatWithBotRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - if !(s.ButtonID == 0) { - return false - } - if !(s.SharedChatID == 0) { - return false - } - if !(s.OnlyCheck == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *ShareChatWithBotRequest) String() string { - if s == nil { - return "ShareChatWithBotRequest(nil)" - } - type Alias ShareChatWithBotRequest - return fmt.Sprintf("ShareChatWithBotRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ShareChatWithBotRequest) TypeID() uint32 { - return ShareChatWithBotRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ShareChatWithBotRequest) TypeName() string { - return "shareChatWithBot" -} - -// TypeInfo returns info about TL type. -func (s *ShareChatWithBotRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "shareChatWithBot", - ID: ShareChatWithBotRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ButtonID", - SchemaName: "button_id", - }, - { - Name: "SharedChatID", - SchemaName: "shared_chat_id", - }, - { - Name: "OnlyCheck", - SchemaName: "only_check", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *ShareChatWithBotRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode shareChatWithBot#a6530ae2 as nil") - } - b.PutID(ShareChatWithBotRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *ShareChatWithBotRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode shareChatWithBot#a6530ae2 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - b.PutInt32(s.ButtonID) - b.PutInt53(s.SharedChatID) - b.PutBool(s.OnlyCheck) - return nil -} - -// Decode implements bin.Decoder. -func (s *ShareChatWithBotRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode shareChatWithBot#a6530ae2 to nil") - } - if err := b.ConsumeID(ShareChatWithBotRequestTypeID); err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *ShareChatWithBotRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode shareChatWithBot#a6530ae2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: field message_id: %w", err) - } - s.MessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: field button_id: %w", err) - } - s.ButtonID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: field shared_chat_id: %w", err) - } - s.SharedChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: field only_check: %w", err) - } - s.OnlyCheck = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *ShareChatWithBotRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode shareChatWithBot#a6530ae2 as nil") - } - b.ObjStart() - b.PutID("shareChatWithBot") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("button_id") - b.PutInt32(s.ButtonID) - b.Comma() - b.FieldStart("shared_chat_id") - b.PutInt53(s.SharedChatID) - b.Comma() - b.FieldStart("only_check") - b.PutBool(s.OnlyCheck) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *ShareChatWithBotRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode shareChatWithBot#a6530ae2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("shareChatWithBot"); err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: field message_id: %w", err) - } - s.MessageID = value - case "button_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: field button_id: %w", err) - } - s.ButtonID = value - case "shared_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: field shared_chat_id: %w", err) - } - s.SharedChatID = value - case "only_check": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode shareChatWithBot#a6530ae2: field only_check: %w", err) - } - s.OnlyCheck = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *ShareChatWithBotRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *ShareChatWithBotRequest) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetButtonID returns value of ButtonID field. -func (s *ShareChatWithBotRequest) GetButtonID() (value int32) { - if s == nil { - return - } - return s.ButtonID -} - -// GetSharedChatID returns value of SharedChatID field. -func (s *ShareChatWithBotRequest) GetSharedChatID() (value int64) { - if s == nil { - return - } - return s.SharedChatID -} - -// GetOnlyCheck returns value of OnlyCheck field. -func (s *ShareChatWithBotRequest) GetOnlyCheck() (value bool) { - if s == nil { - return - } - return s.OnlyCheck -} - -// ShareChatWithBot invokes method shareChatWithBot#a6530ae2 returning error if any. -func (c *Client) ShareChatWithBot(ctx context.Context, request *ShareChatWithBotRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_share_phone_number_gen.go b/tdapi/tl_share_phone_number_gen.go deleted file mode 100644 index bec943fef..000000000 --- a/tdapi/tl_share_phone_number_gen.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SharePhoneNumberRequest represents TL type `sharePhoneNumber#4164e055`. -type SharePhoneNumberRequest struct { - // Identifier of the user with whom to share the phone number. The user must be a mutual - // contact - UserID int64 -} - -// SharePhoneNumberRequestTypeID is TL type id of SharePhoneNumberRequest. -const SharePhoneNumberRequestTypeID = 0x4164e055 - -// Ensuring interfaces in compile-time for SharePhoneNumberRequest. -var ( - _ bin.Encoder = &SharePhoneNumberRequest{} - _ bin.Decoder = &SharePhoneNumberRequest{} - _ bin.BareEncoder = &SharePhoneNumberRequest{} - _ bin.BareDecoder = &SharePhoneNumberRequest{} -) - -func (s *SharePhoneNumberRequest) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SharePhoneNumberRequest) String() string { - if s == nil { - return "SharePhoneNumberRequest(nil)" - } - type Alias SharePhoneNumberRequest - return fmt.Sprintf("SharePhoneNumberRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SharePhoneNumberRequest) TypeID() uint32 { - return SharePhoneNumberRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SharePhoneNumberRequest) TypeName() string { - return "sharePhoneNumber" -} - -// TypeInfo returns info about TL type. -func (s *SharePhoneNumberRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sharePhoneNumber", - ID: SharePhoneNumberRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SharePhoneNumberRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sharePhoneNumber#4164e055 as nil") - } - b.PutID(SharePhoneNumberRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SharePhoneNumberRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sharePhoneNumber#4164e055 as nil") - } - b.PutInt53(s.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SharePhoneNumberRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sharePhoneNumber#4164e055 to nil") - } - if err := b.ConsumeID(SharePhoneNumberRequestTypeID); err != nil { - return fmt.Errorf("unable to decode sharePhoneNumber#4164e055: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SharePhoneNumberRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sharePhoneNumber#4164e055 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sharePhoneNumber#4164e055: field user_id: %w", err) - } - s.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SharePhoneNumberRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sharePhoneNumber#4164e055 as nil") - } - b.ObjStart() - b.PutID("sharePhoneNumber") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SharePhoneNumberRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sharePhoneNumber#4164e055 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sharePhoneNumber"); err != nil { - return fmt.Errorf("unable to decode sharePhoneNumber#4164e055: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sharePhoneNumber#4164e055: field user_id: %w", err) - } - s.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *SharePhoneNumberRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// SharePhoneNumber invokes method sharePhoneNumber#4164e055 returning error if any. -func (c *Client) SharePhoneNumber(ctx context.Context, userid int64) error { - var ok Ok - - request := &SharePhoneNumberRequest{ - UserID: userid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_share_users_with_bot_gen.go b/tdapi/tl_share_users_with_bot_gen.go deleted file mode 100644 index 0d4deafde..000000000 --- a/tdapi/tl_share_users_with_bot_gen.go +++ /dev/null @@ -1,364 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ShareUsersWithBotRequest represents TL type `shareUsersWithBot#58448550`. -type ShareUsersWithBotRequest struct { - // Identifier of the chat with the bot - ChatID int64 - // Identifier of the message with the button - MessageID int64 - // Identifier of the button - ButtonID int32 - // Identifiers of the shared users - SharedUserIDs []int64 - // Pass true to check that the users can be shared by the button instead of actually - // sharing them - OnlyCheck bool -} - -// ShareUsersWithBotRequestTypeID is TL type id of ShareUsersWithBotRequest. -const ShareUsersWithBotRequestTypeID = 0x58448550 - -// Ensuring interfaces in compile-time for ShareUsersWithBotRequest. -var ( - _ bin.Encoder = &ShareUsersWithBotRequest{} - _ bin.Decoder = &ShareUsersWithBotRequest{} - _ bin.BareEncoder = &ShareUsersWithBotRequest{} - _ bin.BareDecoder = &ShareUsersWithBotRequest{} -) - -func (s *ShareUsersWithBotRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - if !(s.ButtonID == 0) { - return false - } - if !(s.SharedUserIDs == nil) { - return false - } - if !(s.OnlyCheck == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *ShareUsersWithBotRequest) String() string { - if s == nil { - return "ShareUsersWithBotRequest(nil)" - } - type Alias ShareUsersWithBotRequest - return fmt.Sprintf("ShareUsersWithBotRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ShareUsersWithBotRequest) TypeID() uint32 { - return ShareUsersWithBotRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ShareUsersWithBotRequest) TypeName() string { - return "shareUsersWithBot" -} - -// TypeInfo returns info about TL type. -func (s *ShareUsersWithBotRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "shareUsersWithBot", - ID: ShareUsersWithBotRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ButtonID", - SchemaName: "button_id", - }, - { - Name: "SharedUserIDs", - SchemaName: "shared_user_ids", - }, - { - Name: "OnlyCheck", - SchemaName: "only_check", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *ShareUsersWithBotRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode shareUsersWithBot#58448550 as nil") - } - b.PutID(ShareUsersWithBotRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *ShareUsersWithBotRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode shareUsersWithBot#58448550 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - b.PutInt32(s.ButtonID) - b.PutInt(len(s.SharedUserIDs)) - for _, v := range s.SharedUserIDs { - b.PutInt53(v) - } - b.PutBool(s.OnlyCheck) - return nil -} - -// Decode implements bin.Decoder. -func (s *ShareUsersWithBotRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode shareUsersWithBot#58448550 to nil") - } - if err := b.ConsumeID(ShareUsersWithBotRequestTypeID); err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *ShareUsersWithBotRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode shareUsersWithBot#58448550 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field message_id: %w", err) - } - s.MessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field button_id: %w", err) - } - s.ButtonID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field shared_user_ids: %w", err) - } - - if headerLen > 0 { - s.SharedUserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field shared_user_ids: %w", err) - } - s.SharedUserIDs = append(s.SharedUserIDs, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field only_check: %w", err) - } - s.OnlyCheck = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *ShareUsersWithBotRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode shareUsersWithBot#58448550 as nil") - } - b.ObjStart() - b.PutID("shareUsersWithBot") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("button_id") - b.PutInt32(s.ButtonID) - b.Comma() - b.FieldStart("shared_user_ids") - b.ArrStart() - for _, v := range s.SharedUserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("only_check") - b.PutBool(s.OnlyCheck) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *ShareUsersWithBotRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode shareUsersWithBot#58448550 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("shareUsersWithBot"); err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field message_id: %w", err) - } - s.MessageID = value - case "button_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field button_id: %w", err) - } - s.ButtonID = value - case "shared_user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field shared_user_ids: %w", err) - } - s.SharedUserIDs = append(s.SharedUserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field shared_user_ids: %w", err) - } - case "only_check": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode shareUsersWithBot#58448550: field only_check: %w", err) - } - s.OnlyCheck = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *ShareUsersWithBotRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *ShareUsersWithBotRequest) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetButtonID returns value of ButtonID field. -func (s *ShareUsersWithBotRequest) GetButtonID() (value int32) { - if s == nil { - return - } - return s.ButtonID -} - -// GetSharedUserIDs returns value of SharedUserIDs field. -func (s *ShareUsersWithBotRequest) GetSharedUserIDs() (value []int64) { - if s == nil { - return - } - return s.SharedUserIDs -} - -// GetOnlyCheck returns value of OnlyCheck field. -func (s *ShareUsersWithBotRequest) GetOnlyCheck() (value bool) { - if s == nil { - return - } - return s.OnlyCheck -} - -// ShareUsersWithBot invokes method shareUsersWithBot#58448550 returning error if any. -func (c *Client) ShareUsersWithBot(ctx context.Context, request *ShareUsersWithBotRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_shared_chat_gen.go b/tdapi/tl_shared_chat_gen.go deleted file mode 100644 index 652911e94..000000000 --- a/tdapi/tl_shared_chat_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SharedChat represents TL type `sharedChat#4a87b01a`. -type SharedChat struct { - // Chat identifier - ChatID int64 - // Title of the chat; for bots only - Title string - // Username of the chat; for bots only - Username string - // Photo of the chat; for bots only; may be null - Photo Photo -} - -// SharedChatTypeID is TL type id of SharedChat. -const SharedChatTypeID = 0x4a87b01a - -// Ensuring interfaces in compile-time for SharedChat. -var ( - _ bin.Encoder = &SharedChat{} - _ bin.Decoder = &SharedChat{} - _ bin.BareEncoder = &SharedChat{} - _ bin.BareDecoder = &SharedChat{} -) - -func (s *SharedChat) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Title == "") { - return false - } - if !(s.Username == "") { - return false - } - if !(s.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SharedChat) String() string { - if s == nil { - return "SharedChat(nil)" - } - type Alias SharedChat - return fmt.Sprintf("SharedChat%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SharedChat) TypeID() uint32 { - return SharedChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*SharedChat) TypeName() string { - return "sharedChat" -} - -// TypeInfo returns info about TL type. -func (s *SharedChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sharedChat", - ID: SharedChatTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Username", - SchemaName: "username", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SharedChat) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sharedChat#4a87b01a as nil") - } - b.PutID(SharedChatTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SharedChat) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sharedChat#4a87b01a as nil") - } - b.PutInt53(s.ChatID) - b.PutString(s.Title) - b.PutString(s.Username) - if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode sharedChat#4a87b01a: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SharedChat) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sharedChat#4a87b01a to nil") - } - if err := b.ConsumeID(SharedChatTypeID); err != nil { - return fmt.Errorf("unable to decode sharedChat#4a87b01a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SharedChat) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sharedChat#4a87b01a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sharedChat#4a87b01a: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sharedChat#4a87b01a: field title: %w", err) - } - s.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sharedChat#4a87b01a: field username: %w", err) - } - s.Username = value - } - { - if err := s.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode sharedChat#4a87b01a: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SharedChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sharedChat#4a87b01a as nil") - } - b.ObjStart() - b.PutID("sharedChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("title") - b.PutString(s.Title) - b.Comma() - b.FieldStart("username") - b.PutString(s.Username) - b.Comma() - b.FieldStart("photo") - if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sharedChat#4a87b01a: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SharedChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sharedChat#4a87b01a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sharedChat"); err != nil { - return fmt.Errorf("unable to decode sharedChat#4a87b01a: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sharedChat#4a87b01a: field chat_id: %w", err) - } - s.ChatID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sharedChat#4a87b01a: field title: %w", err) - } - s.Title = value - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sharedChat#4a87b01a: field username: %w", err) - } - s.Username = value - case "photo": - if err := s.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sharedChat#4a87b01a: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *SharedChat) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetTitle returns value of Title field. -func (s *SharedChat) GetTitle() (value string) { - if s == nil { - return - } - return s.Title -} - -// GetUsername returns value of Username field. -func (s *SharedChat) GetUsername() (value string) { - if s == nil { - return - } - return s.Username -} - -// GetPhoto returns value of Photo field. -func (s *SharedChat) GetPhoto() (value Photo) { - if s == nil { - return - } - return s.Photo -} diff --git a/tdapi/tl_shared_user_gen.go b/tdapi/tl_shared_user_gen.go deleted file mode 100644 index 95a8d889c..000000000 --- a/tdapi/tl_shared_user_gen.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SharedUser represents TL type `sharedUser#117724f7`. -type SharedUser struct { - // User identifier - UserID int64 - // First name of the user; for bots only - FirstName string - // Last name of the user; for bots only - LastName string - // Username of the user; for bots only - Username string - // Profile photo of the user; for bots only; may be null - Photo Photo -} - -// SharedUserTypeID is TL type id of SharedUser. -const SharedUserTypeID = 0x117724f7 - -// Ensuring interfaces in compile-time for SharedUser. -var ( - _ bin.Encoder = &SharedUser{} - _ bin.Decoder = &SharedUser{} - _ bin.BareEncoder = &SharedUser{} - _ bin.BareDecoder = &SharedUser{} -) - -func (s *SharedUser) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.FirstName == "") { - return false - } - if !(s.LastName == "") { - return false - } - if !(s.Username == "") { - return false - } - if !(s.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SharedUser) String() string { - if s == nil { - return "SharedUser(nil)" - } - type Alias SharedUser - return fmt.Sprintf("SharedUser%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SharedUser) TypeID() uint32 { - return SharedUserTypeID -} - -// TypeName returns name of type in TL schema. -func (*SharedUser) TypeName() string { - return "sharedUser" -} - -// TypeInfo returns info about TL type. -func (s *SharedUser) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sharedUser", - ID: SharedUserTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "FirstName", - SchemaName: "first_name", - }, - { - Name: "LastName", - SchemaName: "last_name", - }, - { - Name: "Username", - SchemaName: "username", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SharedUser) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sharedUser#117724f7 as nil") - } - b.PutID(SharedUserTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SharedUser) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sharedUser#117724f7 as nil") - } - b.PutInt53(s.UserID) - b.PutString(s.FirstName) - b.PutString(s.LastName) - b.PutString(s.Username) - if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode sharedUser#117724f7: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SharedUser) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sharedUser#117724f7 to nil") - } - if err := b.ConsumeID(SharedUserTypeID); err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SharedUser) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sharedUser#117724f7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: field first_name: %w", err) - } - s.FirstName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: field last_name: %w", err) - } - s.LastName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: field username: %w", err) - } - s.Username = value - } - { - if err := s.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SharedUser) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sharedUser#117724f7 as nil") - } - b.ObjStart() - b.PutID("sharedUser") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("first_name") - b.PutString(s.FirstName) - b.Comma() - b.FieldStart("last_name") - b.PutString(s.LastName) - b.Comma() - b.FieldStart("username") - b.PutString(s.Username) - b.Comma() - b.FieldStart("photo") - if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sharedUser#117724f7: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SharedUser) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sharedUser#117724f7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sharedUser"); err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: field user_id: %w", err) - } - s.UserID = value - case "first_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: field first_name: %w", err) - } - s.FirstName = value - case "last_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: field last_name: %w", err) - } - s.LastName = value - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: field username: %w", err) - } - s.Username = value - case "photo": - if err := s.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sharedUser#117724f7: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *SharedUser) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetFirstName returns value of FirstName field. -func (s *SharedUser) GetFirstName() (value string) { - if s == nil { - return - } - return s.FirstName -} - -// GetLastName returns value of LastName field. -func (s *SharedUser) GetLastName() (value string) { - if s == nil { - return - } - return s.LastName -} - -// GetUsername returns value of Username field. -func (s *SharedUser) GetUsername() (value string) { - if s == nil { - return - } - return s.Username -} - -// GetPhoto returns value of Photo field. -func (s *SharedUser) GetPhoto() (value Photo) { - if s == nil { - return - } - return s.Photo -} diff --git a/tdapi/tl_shipping_option_gen.go b/tdapi/tl_shipping_option_gen.go deleted file mode 100644 index d8ebfa9c2..000000000 --- a/tdapi/tl_shipping_option_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ShippingOption represents TL type `shippingOption#731bffce`. -type ShippingOption struct { - // Shipping option identifier - ID string - // Option title - Title string - // A list of objects used to calculate the total shipping costs - PriceParts []LabeledPricePart -} - -// ShippingOptionTypeID is TL type id of ShippingOption. -const ShippingOptionTypeID = 0x731bffce - -// Ensuring interfaces in compile-time for ShippingOption. -var ( - _ bin.Encoder = &ShippingOption{} - _ bin.Decoder = &ShippingOption{} - _ bin.BareEncoder = &ShippingOption{} - _ bin.BareDecoder = &ShippingOption{} -) - -func (s *ShippingOption) Zero() bool { - if s == nil { - return true - } - if !(s.ID == "") { - return false - } - if !(s.Title == "") { - return false - } - if !(s.PriceParts == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *ShippingOption) String() string { - if s == nil { - return "ShippingOption(nil)" - } - type Alias ShippingOption - return fmt.Sprintf("ShippingOption%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ShippingOption) TypeID() uint32 { - return ShippingOptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*ShippingOption) TypeName() string { - return "shippingOption" -} - -// TypeInfo returns info about TL type. -func (s *ShippingOption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "shippingOption", - ID: ShippingOptionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "PriceParts", - SchemaName: "price_parts", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *ShippingOption) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode shippingOption#731bffce as nil") - } - b.PutID(ShippingOptionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *ShippingOption) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode shippingOption#731bffce as nil") - } - b.PutString(s.ID) - b.PutString(s.Title) - b.PutInt(len(s.PriceParts)) - for idx, v := range s.PriceParts { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare shippingOption#731bffce: field price_parts element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *ShippingOption) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode shippingOption#731bffce to nil") - } - if err := b.ConsumeID(ShippingOptionTypeID); err != nil { - return fmt.Errorf("unable to decode shippingOption#731bffce: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *ShippingOption) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode shippingOption#731bffce to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode shippingOption#731bffce: field id: %w", err) - } - s.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode shippingOption#731bffce: field title: %w", err) - } - s.Title = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode shippingOption#731bffce: field price_parts: %w", err) - } - - if headerLen > 0 { - s.PriceParts = make([]LabeledPricePart, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value LabeledPricePart - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare shippingOption#731bffce: field price_parts: %w", err) - } - s.PriceParts = append(s.PriceParts, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *ShippingOption) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode shippingOption#731bffce as nil") - } - b.ObjStart() - b.PutID("shippingOption") - b.Comma() - b.FieldStart("id") - b.PutString(s.ID) - b.Comma() - b.FieldStart("title") - b.PutString(s.Title) - b.Comma() - b.FieldStart("price_parts") - b.ArrStart() - for idx, v := range s.PriceParts { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode shippingOption#731bffce: field price_parts element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *ShippingOption) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode shippingOption#731bffce to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("shippingOption"); err != nil { - return fmt.Errorf("unable to decode shippingOption#731bffce: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode shippingOption#731bffce: field id: %w", err) - } - s.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode shippingOption#731bffce: field title: %w", err) - } - s.Title = value - case "price_parts": - if err := b.Arr(func(b tdjson.Decoder) error { - var value LabeledPricePart - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode shippingOption#731bffce: field price_parts: %w", err) - } - s.PriceParts = append(s.PriceParts, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode shippingOption#731bffce: field price_parts: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *ShippingOption) GetID() (value string) { - if s == nil { - return - } - return s.ID -} - -// GetTitle returns value of Title field. -func (s *ShippingOption) GetTitle() (value string) { - if s == nil { - return - } - return s.Title -} - -// GetPriceParts returns value of PriceParts field. -func (s *ShippingOption) GetPriceParts() (value []LabeledPricePart) { - if s == nil { - return - } - return s.PriceParts -} diff --git a/tdapi/tl_speech_recognition_result_gen.go b/tdapi/tl_speech_recognition_result_gen.go deleted file mode 100644 index 5d7a7e93e..000000000 --- a/tdapi/tl_speech_recognition_result_gen.go +++ /dev/null @@ -1,683 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SpeechRecognitionResultPending represents TL type `speechRecognitionResultPending#9ebc8e00`. -type SpeechRecognitionResultPending struct { - // Partially recognized text - PartialText string -} - -// SpeechRecognitionResultPendingTypeID is TL type id of SpeechRecognitionResultPending. -const SpeechRecognitionResultPendingTypeID = 0x9ebc8e00 - -// construct implements constructor of SpeechRecognitionResultClass. -func (s SpeechRecognitionResultPending) construct() SpeechRecognitionResultClass { return &s } - -// Ensuring interfaces in compile-time for SpeechRecognitionResultPending. -var ( - _ bin.Encoder = &SpeechRecognitionResultPending{} - _ bin.Decoder = &SpeechRecognitionResultPending{} - _ bin.BareEncoder = &SpeechRecognitionResultPending{} - _ bin.BareDecoder = &SpeechRecognitionResultPending{} - - _ SpeechRecognitionResultClass = &SpeechRecognitionResultPending{} -) - -func (s *SpeechRecognitionResultPending) Zero() bool { - if s == nil { - return true - } - if !(s.PartialText == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SpeechRecognitionResultPending) String() string { - if s == nil { - return "SpeechRecognitionResultPending(nil)" - } - type Alias SpeechRecognitionResultPending - return fmt.Sprintf("SpeechRecognitionResultPending%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SpeechRecognitionResultPending) TypeID() uint32 { - return SpeechRecognitionResultPendingTypeID -} - -// TypeName returns name of type in TL schema. -func (*SpeechRecognitionResultPending) TypeName() string { - return "speechRecognitionResultPending" -} - -// TypeInfo returns info about TL type. -func (s *SpeechRecognitionResultPending) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "speechRecognitionResultPending", - ID: SpeechRecognitionResultPendingTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PartialText", - SchemaName: "partial_text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SpeechRecognitionResultPending) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode speechRecognitionResultPending#9ebc8e00 as nil") - } - b.PutID(SpeechRecognitionResultPendingTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SpeechRecognitionResultPending) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode speechRecognitionResultPending#9ebc8e00 as nil") - } - b.PutString(s.PartialText) - return nil -} - -// Decode implements bin.Decoder. -func (s *SpeechRecognitionResultPending) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode speechRecognitionResultPending#9ebc8e00 to nil") - } - if err := b.ConsumeID(SpeechRecognitionResultPendingTypeID); err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultPending#9ebc8e00: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SpeechRecognitionResultPending) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode speechRecognitionResultPending#9ebc8e00 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultPending#9ebc8e00: field partial_text: %w", err) - } - s.PartialText = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SpeechRecognitionResultPending) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode speechRecognitionResultPending#9ebc8e00 as nil") - } - b.ObjStart() - b.PutID("speechRecognitionResultPending") - b.Comma() - b.FieldStart("partial_text") - b.PutString(s.PartialText) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SpeechRecognitionResultPending) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode speechRecognitionResultPending#9ebc8e00 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("speechRecognitionResultPending"); err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultPending#9ebc8e00: %w", err) - } - case "partial_text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultPending#9ebc8e00: field partial_text: %w", err) - } - s.PartialText = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPartialText returns value of PartialText field. -func (s *SpeechRecognitionResultPending) GetPartialText() (value string) { - if s == nil { - return - } - return s.PartialText -} - -// SpeechRecognitionResultText represents TL type `speechRecognitionResultText#80e681dd`. -type SpeechRecognitionResultText struct { - // Recognized text - Text string -} - -// SpeechRecognitionResultTextTypeID is TL type id of SpeechRecognitionResultText. -const SpeechRecognitionResultTextTypeID = 0x80e681dd - -// construct implements constructor of SpeechRecognitionResultClass. -func (s SpeechRecognitionResultText) construct() SpeechRecognitionResultClass { return &s } - -// Ensuring interfaces in compile-time for SpeechRecognitionResultText. -var ( - _ bin.Encoder = &SpeechRecognitionResultText{} - _ bin.Decoder = &SpeechRecognitionResultText{} - _ bin.BareEncoder = &SpeechRecognitionResultText{} - _ bin.BareDecoder = &SpeechRecognitionResultText{} - - _ SpeechRecognitionResultClass = &SpeechRecognitionResultText{} -) - -func (s *SpeechRecognitionResultText) Zero() bool { - if s == nil { - return true - } - if !(s.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SpeechRecognitionResultText) String() string { - if s == nil { - return "SpeechRecognitionResultText(nil)" - } - type Alias SpeechRecognitionResultText - return fmt.Sprintf("SpeechRecognitionResultText%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SpeechRecognitionResultText) TypeID() uint32 { - return SpeechRecognitionResultTextTypeID -} - -// TypeName returns name of type in TL schema. -func (*SpeechRecognitionResultText) TypeName() string { - return "speechRecognitionResultText" -} - -// TypeInfo returns info about TL type. -func (s *SpeechRecognitionResultText) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "speechRecognitionResultText", - ID: SpeechRecognitionResultTextTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SpeechRecognitionResultText) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode speechRecognitionResultText#80e681dd as nil") - } - b.PutID(SpeechRecognitionResultTextTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SpeechRecognitionResultText) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode speechRecognitionResultText#80e681dd as nil") - } - b.PutString(s.Text) - return nil -} - -// Decode implements bin.Decoder. -func (s *SpeechRecognitionResultText) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode speechRecognitionResultText#80e681dd to nil") - } - if err := b.ConsumeID(SpeechRecognitionResultTextTypeID); err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultText#80e681dd: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SpeechRecognitionResultText) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode speechRecognitionResultText#80e681dd to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultText#80e681dd: field text: %w", err) - } - s.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SpeechRecognitionResultText) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode speechRecognitionResultText#80e681dd as nil") - } - b.ObjStart() - b.PutID("speechRecognitionResultText") - b.Comma() - b.FieldStart("text") - b.PutString(s.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SpeechRecognitionResultText) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode speechRecognitionResultText#80e681dd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("speechRecognitionResultText"); err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultText#80e681dd: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultText#80e681dd: field text: %w", err) - } - s.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (s *SpeechRecognitionResultText) GetText() (value string) { - if s == nil { - return - } - return s.Text -} - -// SpeechRecognitionResultError represents TL type `speechRecognitionResultError#9d243fc`. -type SpeechRecognitionResultError struct { - // Recognition error. An error with a message "MSG_VOICE_TOO_LONG" is returned when media - // duration is too big to be recognized - Error Error -} - -// SpeechRecognitionResultErrorTypeID is TL type id of SpeechRecognitionResultError. -const SpeechRecognitionResultErrorTypeID = 0x9d243fc - -// construct implements constructor of SpeechRecognitionResultClass. -func (s SpeechRecognitionResultError) construct() SpeechRecognitionResultClass { return &s } - -// Ensuring interfaces in compile-time for SpeechRecognitionResultError. -var ( - _ bin.Encoder = &SpeechRecognitionResultError{} - _ bin.Decoder = &SpeechRecognitionResultError{} - _ bin.BareEncoder = &SpeechRecognitionResultError{} - _ bin.BareDecoder = &SpeechRecognitionResultError{} - - _ SpeechRecognitionResultClass = &SpeechRecognitionResultError{} -) - -func (s *SpeechRecognitionResultError) Zero() bool { - if s == nil { - return true - } - if !(s.Error.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SpeechRecognitionResultError) String() string { - if s == nil { - return "SpeechRecognitionResultError(nil)" - } - type Alias SpeechRecognitionResultError - return fmt.Sprintf("SpeechRecognitionResultError%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SpeechRecognitionResultError) TypeID() uint32 { - return SpeechRecognitionResultErrorTypeID -} - -// TypeName returns name of type in TL schema. -func (*SpeechRecognitionResultError) TypeName() string { - return "speechRecognitionResultError" -} - -// TypeInfo returns info about TL type. -func (s *SpeechRecognitionResultError) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "speechRecognitionResultError", - ID: SpeechRecognitionResultErrorTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Error", - SchemaName: "error", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SpeechRecognitionResultError) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode speechRecognitionResultError#9d243fc as nil") - } - b.PutID(SpeechRecognitionResultErrorTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SpeechRecognitionResultError) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode speechRecognitionResultError#9d243fc as nil") - } - if err := s.Error.Encode(b); err != nil { - return fmt.Errorf("unable to encode speechRecognitionResultError#9d243fc: field error: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SpeechRecognitionResultError) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode speechRecognitionResultError#9d243fc to nil") - } - if err := b.ConsumeID(SpeechRecognitionResultErrorTypeID); err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultError#9d243fc: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SpeechRecognitionResultError) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode speechRecognitionResultError#9d243fc to nil") - } - { - if err := s.Error.Decode(b); err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultError#9d243fc: field error: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SpeechRecognitionResultError) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode speechRecognitionResultError#9d243fc as nil") - } - b.ObjStart() - b.PutID("speechRecognitionResultError") - b.Comma() - b.FieldStart("error") - if err := s.Error.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode speechRecognitionResultError#9d243fc: field error: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SpeechRecognitionResultError) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode speechRecognitionResultError#9d243fc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("speechRecognitionResultError"); err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultError#9d243fc: %w", err) - } - case "error": - if err := s.Error.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode speechRecognitionResultError#9d243fc: field error: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetError returns value of Error field. -func (s *SpeechRecognitionResultError) GetError() (value Error) { - if s == nil { - return - } - return s.Error -} - -// SpeechRecognitionResultClassName is schema name of SpeechRecognitionResultClass. -const SpeechRecognitionResultClassName = "SpeechRecognitionResult" - -// SpeechRecognitionResultClass represents SpeechRecognitionResult generic type. -// -// Example: -// -// g, err := tdapi.DecodeSpeechRecognitionResult(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.SpeechRecognitionResultPending: // speechRecognitionResultPending#9ebc8e00 -// case *tdapi.SpeechRecognitionResultText: // speechRecognitionResultText#80e681dd -// case *tdapi.SpeechRecognitionResultError: // speechRecognitionResultError#9d243fc -// default: panic(v) -// } -type SpeechRecognitionResultClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() SpeechRecognitionResultClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeSpeechRecognitionResult implements binary de-serialization for SpeechRecognitionResultClass. -func DecodeSpeechRecognitionResult(buf *bin.Buffer) (SpeechRecognitionResultClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case SpeechRecognitionResultPendingTypeID: - // Decoding speechRecognitionResultPending#9ebc8e00. - v := SpeechRecognitionResultPending{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SpeechRecognitionResultClass: %w", err) - } - return &v, nil - case SpeechRecognitionResultTextTypeID: - // Decoding speechRecognitionResultText#80e681dd. - v := SpeechRecognitionResultText{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SpeechRecognitionResultClass: %w", err) - } - return &v, nil - case SpeechRecognitionResultErrorTypeID: - // Decoding speechRecognitionResultError#9d243fc. - v := SpeechRecognitionResultError{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SpeechRecognitionResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SpeechRecognitionResultClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONSpeechRecognitionResult implements binary de-serialization for SpeechRecognitionResultClass. -func DecodeTDLibJSONSpeechRecognitionResult(buf tdjson.Decoder) (SpeechRecognitionResultClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "speechRecognitionResultPending": - // Decoding speechRecognitionResultPending#9ebc8e00. - v := SpeechRecognitionResultPending{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SpeechRecognitionResultClass: %w", err) - } - return &v, nil - case "speechRecognitionResultText": - // Decoding speechRecognitionResultText#80e681dd. - v := SpeechRecognitionResultText{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SpeechRecognitionResultClass: %w", err) - } - return &v, nil - case "speechRecognitionResultError": - // Decoding speechRecognitionResultError#9d243fc. - v := SpeechRecognitionResultError{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SpeechRecognitionResultClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SpeechRecognitionResultClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// SpeechRecognitionResult boxes the SpeechRecognitionResultClass providing a helper. -type SpeechRecognitionResultBox struct { - SpeechRecognitionResult SpeechRecognitionResultClass -} - -// Decode implements bin.Decoder for SpeechRecognitionResultBox. -func (b *SpeechRecognitionResultBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode SpeechRecognitionResultBox to nil") - } - v, err := DecodeSpeechRecognitionResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SpeechRecognitionResult = v - return nil -} - -// Encode implements bin.Encode for SpeechRecognitionResultBox. -func (b *SpeechRecognitionResultBox) Encode(buf *bin.Buffer) error { - if b == nil || b.SpeechRecognitionResult == nil { - return fmt.Errorf("unable to encode SpeechRecognitionResultClass as nil") - } - return b.SpeechRecognitionResult.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for SpeechRecognitionResultBox. -func (b *SpeechRecognitionResultBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode SpeechRecognitionResultBox to nil") - } - v, err := DecodeTDLibJSONSpeechRecognitionResult(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SpeechRecognitionResult = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for SpeechRecognitionResultBox. -func (b *SpeechRecognitionResultBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.SpeechRecognitionResult == nil { - return fmt.Errorf("unable to encode SpeechRecognitionResultClass as nil") - } - return b.SpeechRecognitionResult.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_sponsored_message_gen.go b/tdapi/tl_sponsored_message_gen.go deleted file mode 100644 index 695d3b2f9..000000000 --- a/tdapi/tl_sponsored_message_gen.go +++ /dev/null @@ -1,514 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SponsoredMessage represents TL type `sponsoredMessage#b78d4c25`. -type SponsoredMessage struct { - // Message identifier; unique for the chat to which the sponsored message belongs among - // both ordinary and sponsored messages - MessageID int64 - // True, if the message needs to be labeled as "recommended" instead of "sponsored" - IsRecommended bool - // True, if the message can be reported to Telegram moderators through - // reportChatSponsoredMessage - CanBeReported bool - // Content of the message. Currently, can be only of the types messageText, - // messageAnimation, messagePhoto, or messageVideo. Video messages can be viewed - // fullscreen - Content MessageContentClass - // Information about the sponsor of the message - Sponsor MessageSponsor - // Title of the sponsored message - Title string - // Text for the message action button - ButtonText string - // Identifier of the accent color for title, button text and message background - AccentColorID int32 - // Identifier of a custom emoji to be shown on the message background; 0 if none - BackgroundCustomEmojiID int64 - // If non-empty, additional information about the sponsored message to be shown along - // with the message - AdditionalInfo string -} - -// SponsoredMessageTypeID is TL type id of SponsoredMessage. -const SponsoredMessageTypeID = 0xb78d4c25 - -// Ensuring interfaces in compile-time for SponsoredMessage. -var ( - _ bin.Encoder = &SponsoredMessage{} - _ bin.Decoder = &SponsoredMessage{} - _ bin.BareEncoder = &SponsoredMessage{} - _ bin.BareDecoder = &SponsoredMessage{} -) - -func (s *SponsoredMessage) Zero() bool { - if s == nil { - return true - } - if !(s.MessageID == 0) { - return false - } - if !(s.IsRecommended == false) { - return false - } - if !(s.CanBeReported == false) { - return false - } - if !(s.Content == nil) { - return false - } - if !(s.Sponsor.Zero()) { - return false - } - if !(s.Title == "") { - return false - } - if !(s.ButtonText == "") { - return false - } - if !(s.AccentColorID == 0) { - return false - } - if !(s.BackgroundCustomEmojiID == 0) { - return false - } - if !(s.AdditionalInfo == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SponsoredMessage) String() string { - if s == nil { - return "SponsoredMessage(nil)" - } - type Alias SponsoredMessage - return fmt.Sprintf("SponsoredMessage%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SponsoredMessage) TypeID() uint32 { - return SponsoredMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*SponsoredMessage) TypeName() string { - return "sponsoredMessage" -} - -// TypeInfo returns info about TL type. -func (s *SponsoredMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sponsoredMessage", - ID: SponsoredMessageTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "IsRecommended", - SchemaName: "is_recommended", - }, - { - Name: "CanBeReported", - SchemaName: "can_be_reported", - }, - { - Name: "Content", - SchemaName: "content", - }, - { - Name: "Sponsor", - SchemaName: "sponsor", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "ButtonText", - SchemaName: "button_text", - }, - { - Name: "AccentColorID", - SchemaName: "accent_color_id", - }, - { - Name: "BackgroundCustomEmojiID", - SchemaName: "background_custom_emoji_id", - }, - { - Name: "AdditionalInfo", - SchemaName: "additional_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SponsoredMessage) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#b78d4c25 as nil") - } - b.PutID(SponsoredMessageTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SponsoredMessage) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#b78d4c25 as nil") - } - b.PutInt53(s.MessageID) - b.PutBool(s.IsRecommended) - b.PutBool(s.CanBeReported) - if s.Content == nil { - return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field content is nil") - } - if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field content: %w", err) - } - if err := s.Sponsor.Encode(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field sponsor: %w", err) - } - b.PutString(s.Title) - b.PutString(s.ButtonText) - b.PutInt32(s.AccentColorID) - b.PutLong(s.BackgroundCustomEmojiID) - b.PutString(s.AdditionalInfo) - return nil -} - -// Decode implements bin.Decoder. -func (s *SponsoredMessage) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#b78d4c25 to nil") - } - if err := b.ConsumeID(SponsoredMessageTypeID); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SponsoredMessage) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#b78d4c25 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field message_id: %w", err) - } - s.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field is_recommended: %w", err) - } - s.IsRecommended = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field can_be_reported: %w", err) - } - s.CanBeReported = value - } - { - value, err := DecodeMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field content: %w", err) - } - s.Content = value - } - { - if err := s.Sponsor.Decode(b); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field sponsor: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field title: %w", err) - } - s.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field button_text: %w", err) - } - s.ButtonText = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field accent_color_id: %w", err) - } - s.AccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field background_custom_emoji_id: %w", err) - } - s.BackgroundCustomEmojiID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field additional_info: %w", err) - } - s.AdditionalInfo = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SponsoredMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sponsoredMessage#b78d4c25 as nil") - } - b.ObjStart() - b.PutID("sponsoredMessage") - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("is_recommended") - b.PutBool(s.IsRecommended) - b.Comma() - b.FieldStart("can_be_reported") - b.PutBool(s.CanBeReported) - b.Comma() - b.FieldStart("content") - if s.Content == nil { - return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field content is nil") - } - if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field content: %w", err) - } - b.Comma() - b.FieldStart("sponsor") - if err := s.Sponsor.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessage#b78d4c25: field sponsor: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(s.Title) - b.Comma() - b.FieldStart("button_text") - b.PutString(s.ButtonText) - b.Comma() - b.FieldStart("accent_color_id") - b.PutInt32(s.AccentColorID) - b.Comma() - b.FieldStart("background_custom_emoji_id") - b.PutLong(s.BackgroundCustomEmojiID) - b.Comma() - b.FieldStart("additional_info") - b.PutString(s.AdditionalInfo) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SponsoredMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sponsoredMessage#b78d4c25 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sponsoredMessage"); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: %w", err) - } - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field message_id: %w", err) - } - s.MessageID = value - case "is_recommended": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field is_recommended: %w", err) - } - s.IsRecommended = value - case "can_be_reported": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field can_be_reported: %w", err) - } - s.CanBeReported = value - case "content": - value, err := DecodeTDLibJSONMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field content: %w", err) - } - s.Content = value - case "sponsor": - if err := s.Sponsor.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field sponsor: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field title: %w", err) - } - s.Title = value - case "button_text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field button_text: %w", err) - } - s.ButtonText = value - case "accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field accent_color_id: %w", err) - } - s.AccentColorID = value - case "background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field background_custom_emoji_id: %w", err) - } - s.BackgroundCustomEmojiID = value - case "additional_info": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessage#b78d4c25: field additional_info: %w", err) - } - s.AdditionalInfo = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessageID returns value of MessageID field. -func (s *SponsoredMessage) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetIsRecommended returns value of IsRecommended field. -func (s *SponsoredMessage) GetIsRecommended() (value bool) { - if s == nil { - return - } - return s.IsRecommended -} - -// GetCanBeReported returns value of CanBeReported field. -func (s *SponsoredMessage) GetCanBeReported() (value bool) { - if s == nil { - return - } - return s.CanBeReported -} - -// GetContent returns value of Content field. -func (s *SponsoredMessage) GetContent() (value MessageContentClass) { - if s == nil { - return - } - return s.Content -} - -// GetSponsor returns value of Sponsor field. -func (s *SponsoredMessage) GetSponsor() (value MessageSponsor) { - if s == nil { - return - } - return s.Sponsor -} - -// GetTitle returns value of Title field. -func (s *SponsoredMessage) GetTitle() (value string) { - if s == nil { - return - } - return s.Title -} - -// GetButtonText returns value of ButtonText field. -func (s *SponsoredMessage) GetButtonText() (value string) { - if s == nil { - return - } - return s.ButtonText -} - -// GetAccentColorID returns value of AccentColorID field. -func (s *SponsoredMessage) GetAccentColorID() (value int32) { - if s == nil { - return - } - return s.AccentColorID -} - -// GetBackgroundCustomEmojiID returns value of BackgroundCustomEmojiID field. -func (s *SponsoredMessage) GetBackgroundCustomEmojiID() (value int64) { - if s == nil { - return - } - return s.BackgroundCustomEmojiID -} - -// GetAdditionalInfo returns value of AdditionalInfo field. -func (s *SponsoredMessage) GetAdditionalInfo() (value string) { - if s == nil { - return - } - return s.AdditionalInfo -} diff --git a/tdapi/tl_sponsored_messages_gen.go b/tdapi/tl_sponsored_messages_gen.go deleted file mode 100644 index 9daa76305..000000000 --- a/tdapi/tl_sponsored_messages_gen.go +++ /dev/null @@ -1,256 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SponsoredMessages represents TL type `sponsoredMessages#e402a0f`. -type SponsoredMessages struct { - // List of sponsored messages - Messages []SponsoredMessage - // The minimum number of messages between shown sponsored messages, or 0 if only one - // sponsored message must be shown after all ordinary messages - MessagesBetween int32 -} - -// SponsoredMessagesTypeID is TL type id of SponsoredMessages. -const SponsoredMessagesTypeID = 0xe402a0f - -// Ensuring interfaces in compile-time for SponsoredMessages. -var ( - _ bin.Encoder = &SponsoredMessages{} - _ bin.Decoder = &SponsoredMessages{} - _ bin.BareEncoder = &SponsoredMessages{} - _ bin.BareDecoder = &SponsoredMessages{} -) - -func (s *SponsoredMessages) Zero() bool { - if s == nil { - return true - } - if !(s.Messages == nil) { - return false - } - if !(s.MessagesBetween == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SponsoredMessages) String() string { - if s == nil { - return "SponsoredMessages(nil)" - } - type Alias SponsoredMessages - return fmt.Sprintf("SponsoredMessages%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SponsoredMessages) TypeID() uint32 { - return SponsoredMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*SponsoredMessages) TypeName() string { - return "sponsoredMessages" -} - -// TypeInfo returns info about TL type. -func (s *SponsoredMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sponsoredMessages", - ID: SponsoredMessagesTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Messages", - SchemaName: "messages", - }, - { - Name: "MessagesBetween", - SchemaName: "messages_between", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SponsoredMessages) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sponsoredMessages#e402a0f as nil") - } - b.PutID(SponsoredMessagesTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SponsoredMessages) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sponsoredMessages#e402a0f as nil") - } - b.PutInt(len(s.Messages)) - for idx, v := range s.Messages { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare sponsoredMessages#e402a0f: field messages element with index %d: %w", idx, err) - } - } - b.PutInt32(s.MessagesBetween) - return nil -} - -// Decode implements bin.Decoder. -func (s *SponsoredMessages) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sponsoredMessages#e402a0f to nil") - } - if err := b.ConsumeID(SponsoredMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode sponsoredMessages#e402a0f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SponsoredMessages) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sponsoredMessages#e402a0f to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessages#e402a0f: field messages: %w", err) - } - - if headerLen > 0 { - s.Messages = make([]SponsoredMessage, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value SponsoredMessage - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare sponsoredMessages#e402a0f: field messages: %w", err) - } - s.Messages = append(s.Messages, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessages#e402a0f: field messages_between: %w", err) - } - s.MessagesBetween = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SponsoredMessages) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sponsoredMessages#e402a0f as nil") - } - b.ObjStart() - b.PutID("sponsoredMessages") - b.Comma() - b.FieldStart("messages") - b.ArrStart() - for idx, v := range s.Messages { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sponsoredMessages#e402a0f: field messages element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("messages_between") - b.PutInt32(s.MessagesBetween) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SponsoredMessages) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sponsoredMessages#e402a0f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sponsoredMessages"); err != nil { - return fmt.Errorf("unable to decode sponsoredMessages#e402a0f: %w", err) - } - case "messages": - if err := b.Arr(func(b tdjson.Decoder) error { - var value SponsoredMessage - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sponsoredMessages#e402a0f: field messages: %w", err) - } - s.Messages = append(s.Messages, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode sponsoredMessages#e402a0f: field messages: %w", err) - } - case "messages_between": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sponsoredMessages#e402a0f: field messages_between: %w", err) - } - s.MessagesBetween = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessages returns value of Messages field. -func (s *SponsoredMessages) GetMessages() (value []SponsoredMessage) { - if s == nil { - return - } - return s.Messages -} - -// GetMessagesBetween returns value of MessagesBetween field. -func (s *SponsoredMessages) GetMessagesBetween() (value int32) { - if s == nil { - return - } - return s.MessagesBetween -} diff --git a/tdapi/tl_star_amount_gen.go b/tdapi/tl_star_amount_gen.go deleted file mode 100644 index 5d431f143..000000000 --- a/tdapi/tl_star_amount_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarAmount represents TL type `starAmount#6f0e6d80`. -type StarAmount struct { - // The integer amount of Telegram Stars rounded to 0 - StarCount int64 - // The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999 - NanostarCount int32 -} - -// StarAmountTypeID is TL type id of StarAmount. -const StarAmountTypeID = 0x6f0e6d80 - -// Ensuring interfaces in compile-time for StarAmount. -var ( - _ bin.Encoder = &StarAmount{} - _ bin.Decoder = &StarAmount{} - _ bin.BareEncoder = &StarAmount{} - _ bin.BareDecoder = &StarAmount{} -) - -func (s *StarAmount) Zero() bool { - if s == nil { - return true - } - if !(s.StarCount == 0) { - return false - } - if !(s.NanostarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarAmount) String() string { - if s == nil { - return "StarAmount(nil)" - } - type Alias StarAmount - return fmt.Sprintf("StarAmount%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarAmount) TypeID() uint32 { - return StarAmountTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarAmount) TypeName() string { - return "starAmount" -} - -// TypeInfo returns info about TL type. -func (s *StarAmount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starAmount", - ID: StarAmountTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "NanostarCount", - SchemaName: "nanostar_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarAmount) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starAmount#6f0e6d80 as nil") - } - b.PutID(StarAmountTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarAmount) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starAmount#6f0e6d80 as nil") - } - b.PutInt53(s.StarCount) - b.PutInt32(s.NanostarCount) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarAmount) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starAmount#6f0e6d80 to nil") - } - if err := b.ConsumeID(StarAmountTypeID); err != nil { - return fmt.Errorf("unable to decode starAmount#6f0e6d80: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarAmount) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starAmount#6f0e6d80 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starAmount#6f0e6d80: field star_count: %w", err) - } - s.StarCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starAmount#6f0e6d80: field nanostar_count: %w", err) - } - s.NanostarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarAmount) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starAmount#6f0e6d80 as nil") - } - b.ObjStart() - b.PutID("starAmount") - b.Comma() - b.FieldStart("star_count") - b.PutInt53(s.StarCount) - b.Comma() - b.FieldStart("nanostar_count") - b.PutInt32(s.NanostarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarAmount) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starAmount#6f0e6d80 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starAmount"); err != nil { - return fmt.Errorf("unable to decode starAmount#6f0e6d80: %w", err) - } - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starAmount#6f0e6d80: field star_count: %w", err) - } - s.StarCount = value - case "nanostar_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starAmount#6f0e6d80: field nanostar_count: %w", err) - } - s.NanostarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarCount returns value of StarCount field. -func (s *StarAmount) GetStarCount() (value int64) { - if s == nil { - return - } - return s.StarCount -} - -// GetNanostarCount returns value of NanostarCount field. -func (s *StarAmount) GetNanostarCount() (value int32) { - if s == nil { - return - } - return s.NanostarCount -} diff --git a/tdapi/tl_star_giveaway_payment_option_gen.go b/tdapi/tl_star_giveaway_payment_option_gen.go deleted file mode 100644 index 548d181c7..000000000 --- a/tdapi/tl_star_giveaway_payment_option_gen.go +++ /dev/null @@ -1,459 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarGiveawayPaymentOption represents TL type `starGiveawayPaymentOption#bca2d5e5`. -type StarGiveawayPaymentOption struct { - // ISO 4217 currency code for the payment - Currency string - // The amount to pay, in the smallest units of the currency - Amount int64 - // Number of Telegram Stars that will be distributed among winners - StarCount int64 - // Identifier of the store product associated with the option; may be empty if none - StoreProductID string - // Number of times the chat will be boosted for one year if the option is chosen - YearlyBoostCount int32 - // Allowed options for the number of giveaway winners - WinnerOptions []StarGiveawayWinnerOption - // True, if the option must be chosen by default - IsDefault bool - // True, if the option must be shown only in the full list of payment options - IsAdditional bool -} - -// StarGiveawayPaymentOptionTypeID is TL type id of StarGiveawayPaymentOption. -const StarGiveawayPaymentOptionTypeID = 0xbca2d5e5 - -// Ensuring interfaces in compile-time for StarGiveawayPaymentOption. -var ( - _ bin.Encoder = &StarGiveawayPaymentOption{} - _ bin.Decoder = &StarGiveawayPaymentOption{} - _ bin.BareEncoder = &StarGiveawayPaymentOption{} - _ bin.BareDecoder = &StarGiveawayPaymentOption{} -) - -func (s *StarGiveawayPaymentOption) Zero() bool { - if s == nil { - return true - } - if !(s.Currency == "") { - return false - } - if !(s.Amount == 0) { - return false - } - if !(s.StarCount == 0) { - return false - } - if !(s.StoreProductID == "") { - return false - } - if !(s.YearlyBoostCount == 0) { - return false - } - if !(s.WinnerOptions == nil) { - return false - } - if !(s.IsDefault == false) { - return false - } - if !(s.IsAdditional == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarGiveawayPaymentOption) String() string { - if s == nil { - return "StarGiveawayPaymentOption(nil)" - } - type Alias StarGiveawayPaymentOption - return fmt.Sprintf("StarGiveawayPaymentOption%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarGiveawayPaymentOption) TypeID() uint32 { - return StarGiveawayPaymentOptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarGiveawayPaymentOption) TypeName() string { - return "starGiveawayPaymentOption" -} - -// TypeInfo returns info about TL type. -func (s *StarGiveawayPaymentOption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starGiveawayPaymentOption", - ID: StarGiveawayPaymentOptionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "StoreProductID", - SchemaName: "store_product_id", - }, - { - Name: "YearlyBoostCount", - SchemaName: "yearly_boost_count", - }, - { - Name: "WinnerOptions", - SchemaName: "winner_options", - }, - { - Name: "IsDefault", - SchemaName: "is_default", - }, - { - Name: "IsAdditional", - SchemaName: "is_additional", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarGiveawayPaymentOption) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starGiveawayPaymentOption#bca2d5e5 as nil") - } - b.PutID(StarGiveawayPaymentOptionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarGiveawayPaymentOption) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starGiveawayPaymentOption#bca2d5e5 as nil") - } - b.PutString(s.Currency) - b.PutInt53(s.Amount) - b.PutInt53(s.StarCount) - b.PutString(s.StoreProductID) - b.PutInt32(s.YearlyBoostCount) - b.PutInt(len(s.WinnerOptions)) - for idx, v := range s.WinnerOptions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare starGiveawayPaymentOption#bca2d5e5: field winner_options element with index %d: %w", idx, err) - } - } - b.PutBool(s.IsDefault) - b.PutBool(s.IsAdditional) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarGiveawayPaymentOption) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starGiveawayPaymentOption#bca2d5e5 to nil") - } - if err := b.ConsumeID(StarGiveawayPaymentOptionTypeID); err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarGiveawayPaymentOption) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starGiveawayPaymentOption#bca2d5e5 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field currency: %w", err) - } - s.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field amount: %w", err) - } - s.Amount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field star_count: %w", err) - } - s.StarCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field store_product_id: %w", err) - } - s.StoreProductID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field yearly_boost_count: %w", err) - } - s.YearlyBoostCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field winner_options: %w", err) - } - - if headerLen > 0 { - s.WinnerOptions = make([]StarGiveawayWinnerOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StarGiveawayWinnerOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare starGiveawayPaymentOption#bca2d5e5: field winner_options: %w", err) - } - s.WinnerOptions = append(s.WinnerOptions, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field is_default: %w", err) - } - s.IsDefault = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field is_additional: %w", err) - } - s.IsAdditional = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarGiveawayPaymentOption) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starGiveawayPaymentOption#bca2d5e5 as nil") - } - b.ObjStart() - b.PutID("starGiveawayPaymentOption") - b.Comma() - b.FieldStart("currency") - b.PutString(s.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(s.Amount) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(s.StarCount) - b.Comma() - b.FieldStart("store_product_id") - b.PutString(s.StoreProductID) - b.Comma() - b.FieldStart("yearly_boost_count") - b.PutInt32(s.YearlyBoostCount) - b.Comma() - b.FieldStart("winner_options") - b.ArrStart() - for idx, v := range s.WinnerOptions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starGiveawayPaymentOption#bca2d5e5: field winner_options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("is_default") - b.PutBool(s.IsDefault) - b.Comma() - b.FieldStart("is_additional") - b.PutBool(s.IsAdditional) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarGiveawayPaymentOption) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starGiveawayPaymentOption#bca2d5e5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starGiveawayPaymentOption"); err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field currency: %w", err) - } - s.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field amount: %w", err) - } - s.Amount = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field star_count: %w", err) - } - s.StarCount = value - case "store_product_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field store_product_id: %w", err) - } - s.StoreProductID = value - case "yearly_boost_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field yearly_boost_count: %w", err) - } - s.YearlyBoostCount = value - case "winner_options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StarGiveawayWinnerOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field winner_options: %w", err) - } - s.WinnerOptions = append(s.WinnerOptions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field winner_options: %w", err) - } - case "is_default": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field is_default: %w", err) - } - s.IsDefault = value - case "is_additional": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOption#bca2d5e5: field is_additional: %w", err) - } - s.IsAdditional = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCurrency returns value of Currency field. -func (s *StarGiveawayPaymentOption) GetCurrency() (value string) { - if s == nil { - return - } - return s.Currency -} - -// GetAmount returns value of Amount field. -func (s *StarGiveawayPaymentOption) GetAmount() (value int64) { - if s == nil { - return - } - return s.Amount -} - -// GetStarCount returns value of StarCount field. -func (s *StarGiveawayPaymentOption) GetStarCount() (value int64) { - if s == nil { - return - } - return s.StarCount -} - -// GetStoreProductID returns value of StoreProductID field. -func (s *StarGiveawayPaymentOption) GetStoreProductID() (value string) { - if s == nil { - return - } - return s.StoreProductID -} - -// GetYearlyBoostCount returns value of YearlyBoostCount field. -func (s *StarGiveawayPaymentOption) GetYearlyBoostCount() (value int32) { - if s == nil { - return - } - return s.YearlyBoostCount -} - -// GetWinnerOptions returns value of WinnerOptions field. -func (s *StarGiveawayPaymentOption) GetWinnerOptions() (value []StarGiveawayWinnerOption) { - if s == nil { - return - } - return s.WinnerOptions -} - -// GetIsDefault returns value of IsDefault field. -func (s *StarGiveawayPaymentOption) GetIsDefault() (value bool) { - if s == nil { - return - } - return s.IsDefault -} - -// GetIsAdditional returns value of IsAdditional field. -func (s *StarGiveawayPaymentOption) GetIsAdditional() (value bool) { - if s == nil { - return - } - return s.IsAdditional -} diff --git a/tdapi/tl_star_giveaway_payment_options_gen.go b/tdapi/tl_star_giveaway_payment_options_gen.go deleted file mode 100644 index d5370a28a..000000000 --- a/tdapi/tl_star_giveaway_payment_options_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarGiveawayPaymentOptions represents TL type `starGiveawayPaymentOptions#909fbf18`. -type StarGiveawayPaymentOptions struct { - // The list of options - Options []StarGiveawayPaymentOption -} - -// StarGiveawayPaymentOptionsTypeID is TL type id of StarGiveawayPaymentOptions. -const StarGiveawayPaymentOptionsTypeID = 0x909fbf18 - -// Ensuring interfaces in compile-time for StarGiveawayPaymentOptions. -var ( - _ bin.Encoder = &StarGiveawayPaymentOptions{} - _ bin.Decoder = &StarGiveawayPaymentOptions{} - _ bin.BareEncoder = &StarGiveawayPaymentOptions{} - _ bin.BareDecoder = &StarGiveawayPaymentOptions{} -) - -func (s *StarGiveawayPaymentOptions) Zero() bool { - if s == nil { - return true - } - if !(s.Options == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarGiveawayPaymentOptions) String() string { - if s == nil { - return "StarGiveawayPaymentOptions(nil)" - } - type Alias StarGiveawayPaymentOptions - return fmt.Sprintf("StarGiveawayPaymentOptions%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarGiveawayPaymentOptions) TypeID() uint32 { - return StarGiveawayPaymentOptionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarGiveawayPaymentOptions) TypeName() string { - return "starGiveawayPaymentOptions" -} - -// TypeInfo returns info about TL type. -func (s *StarGiveawayPaymentOptions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starGiveawayPaymentOptions", - ID: StarGiveawayPaymentOptionsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Options", - SchemaName: "options", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarGiveawayPaymentOptions) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starGiveawayPaymentOptions#909fbf18 as nil") - } - b.PutID(StarGiveawayPaymentOptionsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarGiveawayPaymentOptions) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starGiveawayPaymentOptions#909fbf18 as nil") - } - b.PutInt(len(s.Options)) - for idx, v := range s.Options { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare starGiveawayPaymentOptions#909fbf18: field options element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarGiveawayPaymentOptions) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starGiveawayPaymentOptions#909fbf18 to nil") - } - if err := b.ConsumeID(StarGiveawayPaymentOptionsTypeID); err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOptions#909fbf18: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarGiveawayPaymentOptions) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starGiveawayPaymentOptions#909fbf18 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOptions#909fbf18: field options: %w", err) - } - - if headerLen > 0 { - s.Options = make([]StarGiveawayPaymentOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StarGiveawayPaymentOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare starGiveawayPaymentOptions#909fbf18: field options: %w", err) - } - s.Options = append(s.Options, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarGiveawayPaymentOptions) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starGiveawayPaymentOptions#909fbf18 as nil") - } - b.ObjStart() - b.PutID("starGiveawayPaymentOptions") - b.Comma() - b.FieldStart("options") - b.ArrStart() - for idx, v := range s.Options { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starGiveawayPaymentOptions#909fbf18: field options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarGiveawayPaymentOptions) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starGiveawayPaymentOptions#909fbf18 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starGiveawayPaymentOptions"); err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOptions#909fbf18: %w", err) - } - case "options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StarGiveawayPaymentOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOptions#909fbf18: field options: %w", err) - } - s.Options = append(s.Options, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode starGiveawayPaymentOptions#909fbf18: field options: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOptions returns value of Options field. -func (s *StarGiveawayPaymentOptions) GetOptions() (value []StarGiveawayPaymentOption) { - if s == nil { - return - } - return s.Options -} diff --git a/tdapi/tl_star_giveaway_winner_option_gen.go b/tdapi/tl_star_giveaway_winner_option_gen.go deleted file mode 100644 index 5caddadd0..000000000 --- a/tdapi/tl_star_giveaway_winner_option_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarGiveawayWinnerOption represents TL type `starGiveawayWinnerOption#cc639607`. -type StarGiveawayWinnerOption struct { - // The number of users that will be chosen as winners - WinnerCount int32 - // The number of Telegram Stars that will be won by the winners of the giveaway - WonStarCount int64 - // True, if the option must be chosen by default - IsDefault bool -} - -// StarGiveawayWinnerOptionTypeID is TL type id of StarGiveawayWinnerOption. -const StarGiveawayWinnerOptionTypeID = 0xcc639607 - -// Ensuring interfaces in compile-time for StarGiveawayWinnerOption. -var ( - _ bin.Encoder = &StarGiveawayWinnerOption{} - _ bin.Decoder = &StarGiveawayWinnerOption{} - _ bin.BareEncoder = &StarGiveawayWinnerOption{} - _ bin.BareDecoder = &StarGiveawayWinnerOption{} -) - -func (s *StarGiveawayWinnerOption) Zero() bool { - if s == nil { - return true - } - if !(s.WinnerCount == 0) { - return false - } - if !(s.WonStarCount == 0) { - return false - } - if !(s.IsDefault == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarGiveawayWinnerOption) String() string { - if s == nil { - return "StarGiveawayWinnerOption(nil)" - } - type Alias StarGiveawayWinnerOption - return fmt.Sprintf("StarGiveawayWinnerOption%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarGiveawayWinnerOption) TypeID() uint32 { - return StarGiveawayWinnerOptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarGiveawayWinnerOption) TypeName() string { - return "starGiveawayWinnerOption" -} - -// TypeInfo returns info about TL type. -func (s *StarGiveawayWinnerOption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starGiveawayWinnerOption", - ID: StarGiveawayWinnerOptionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "WonStarCount", - SchemaName: "won_star_count", - }, - { - Name: "IsDefault", - SchemaName: "is_default", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarGiveawayWinnerOption) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starGiveawayWinnerOption#cc639607 as nil") - } - b.PutID(StarGiveawayWinnerOptionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarGiveawayWinnerOption) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starGiveawayWinnerOption#cc639607 as nil") - } - b.PutInt32(s.WinnerCount) - b.PutInt53(s.WonStarCount) - b.PutBool(s.IsDefault) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarGiveawayWinnerOption) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starGiveawayWinnerOption#cc639607 to nil") - } - if err := b.ConsumeID(StarGiveawayWinnerOptionTypeID); err != nil { - return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarGiveawayWinnerOption) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starGiveawayWinnerOption#cc639607 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field winner_count: %w", err) - } - s.WinnerCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field won_star_count: %w", err) - } - s.WonStarCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field is_default: %w", err) - } - s.IsDefault = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarGiveawayWinnerOption) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starGiveawayWinnerOption#cc639607 as nil") - } - b.ObjStart() - b.PutID("starGiveawayWinnerOption") - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(s.WinnerCount) - b.Comma() - b.FieldStart("won_star_count") - b.PutInt53(s.WonStarCount) - b.Comma() - b.FieldStart("is_default") - b.PutBool(s.IsDefault) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarGiveawayWinnerOption) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starGiveawayWinnerOption#cc639607 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starGiveawayWinnerOption"); err != nil { - return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: %w", err) - } - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field winner_count: %w", err) - } - s.WinnerCount = value - case "won_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field won_star_count: %w", err) - } - s.WonStarCount = value - case "is_default": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starGiveawayWinnerOption#cc639607: field is_default: %w", err) - } - s.IsDefault = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWinnerCount returns value of WinnerCount field. -func (s *StarGiveawayWinnerOption) GetWinnerCount() (value int32) { - if s == nil { - return - } - return s.WinnerCount -} - -// GetWonStarCount returns value of WonStarCount field. -func (s *StarGiveawayWinnerOption) GetWonStarCount() (value int64) { - if s == nil { - return - } - return s.WonStarCount -} - -// GetIsDefault returns value of IsDefault field. -func (s *StarGiveawayWinnerOption) GetIsDefault() (value bool) { - if s == nil { - return - } - return s.IsDefault -} diff --git a/tdapi/tl_star_payment_option_gen.go b/tdapi/tl_star_payment_option_gen.go deleted file mode 100644 index 9f1062a3b..000000000 --- a/tdapi/tl_star_payment_option_gen.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarPaymentOption represents TL type `starPaymentOption#aeb22811`. -type StarPaymentOption struct { - // ISO 4217 currency code for the payment - Currency string - // The amount to pay, in the smallest units of the currency - Amount int64 - // Number of Telegram Stars that will be purchased - StarCount int64 - // Identifier of the store product associated with the option; may be empty if none - StoreProductID string - // True, if the option must be shown only in the full list of payment options - IsAdditional bool -} - -// StarPaymentOptionTypeID is TL type id of StarPaymentOption. -const StarPaymentOptionTypeID = 0xaeb22811 - -// Ensuring interfaces in compile-time for StarPaymentOption. -var ( - _ bin.Encoder = &StarPaymentOption{} - _ bin.Decoder = &StarPaymentOption{} - _ bin.BareEncoder = &StarPaymentOption{} - _ bin.BareDecoder = &StarPaymentOption{} -) - -func (s *StarPaymentOption) Zero() bool { - if s == nil { - return true - } - if !(s.Currency == "") { - return false - } - if !(s.Amount == 0) { - return false - } - if !(s.StarCount == 0) { - return false - } - if !(s.StoreProductID == "") { - return false - } - if !(s.IsAdditional == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarPaymentOption) String() string { - if s == nil { - return "StarPaymentOption(nil)" - } - type Alias StarPaymentOption - return fmt.Sprintf("StarPaymentOption%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarPaymentOption) TypeID() uint32 { - return StarPaymentOptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarPaymentOption) TypeName() string { - return "starPaymentOption" -} - -// TypeInfo returns info about TL type. -func (s *StarPaymentOption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starPaymentOption", - ID: StarPaymentOptionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - { - Name: "StoreProductID", - SchemaName: "store_product_id", - }, - { - Name: "IsAdditional", - SchemaName: "is_additional", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarPaymentOption) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starPaymentOption#aeb22811 as nil") - } - b.PutID(StarPaymentOptionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarPaymentOption) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starPaymentOption#aeb22811 as nil") - } - b.PutString(s.Currency) - b.PutInt53(s.Amount) - b.PutInt53(s.StarCount) - b.PutString(s.StoreProductID) - b.PutBool(s.IsAdditional) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarPaymentOption) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starPaymentOption#aeb22811 to nil") - } - if err := b.ConsumeID(StarPaymentOptionTypeID); err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarPaymentOption) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starPaymentOption#aeb22811 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: field currency: %w", err) - } - s.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: field amount: %w", err) - } - s.Amount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: field star_count: %w", err) - } - s.StarCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: field store_product_id: %w", err) - } - s.StoreProductID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: field is_additional: %w", err) - } - s.IsAdditional = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarPaymentOption) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starPaymentOption#aeb22811 as nil") - } - b.ObjStart() - b.PutID("starPaymentOption") - b.Comma() - b.FieldStart("currency") - b.PutString(s.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(s.Amount) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(s.StarCount) - b.Comma() - b.FieldStart("store_product_id") - b.PutString(s.StoreProductID) - b.Comma() - b.FieldStart("is_additional") - b.PutBool(s.IsAdditional) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarPaymentOption) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starPaymentOption#aeb22811 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starPaymentOption"); err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: field currency: %w", err) - } - s.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: field amount: %w", err) - } - s.Amount = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: field star_count: %w", err) - } - s.StarCount = value - case "store_product_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: field store_product_id: %w", err) - } - s.StoreProductID = value - case "is_additional": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starPaymentOption#aeb22811: field is_additional: %w", err) - } - s.IsAdditional = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCurrency returns value of Currency field. -func (s *StarPaymentOption) GetCurrency() (value string) { - if s == nil { - return - } - return s.Currency -} - -// GetAmount returns value of Amount field. -func (s *StarPaymentOption) GetAmount() (value int64) { - if s == nil { - return - } - return s.Amount -} - -// GetStarCount returns value of StarCount field. -func (s *StarPaymentOption) GetStarCount() (value int64) { - if s == nil { - return - } - return s.StarCount -} - -// GetStoreProductID returns value of StoreProductID field. -func (s *StarPaymentOption) GetStoreProductID() (value string) { - if s == nil { - return - } - return s.StoreProductID -} - -// GetIsAdditional returns value of IsAdditional field. -func (s *StarPaymentOption) GetIsAdditional() (value bool) { - if s == nil { - return - } - return s.IsAdditional -} diff --git a/tdapi/tl_star_payment_options_gen.go b/tdapi/tl_star_payment_options_gen.go deleted file mode 100644 index 7520930a9..000000000 --- a/tdapi/tl_star_payment_options_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarPaymentOptions represents TL type `starPaymentOptions#77c3bbad`. -type StarPaymentOptions struct { - // The list of options - Options []StarPaymentOption -} - -// StarPaymentOptionsTypeID is TL type id of StarPaymentOptions. -const StarPaymentOptionsTypeID = 0x77c3bbad - -// Ensuring interfaces in compile-time for StarPaymentOptions. -var ( - _ bin.Encoder = &StarPaymentOptions{} - _ bin.Decoder = &StarPaymentOptions{} - _ bin.BareEncoder = &StarPaymentOptions{} - _ bin.BareDecoder = &StarPaymentOptions{} -) - -func (s *StarPaymentOptions) Zero() bool { - if s == nil { - return true - } - if !(s.Options == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarPaymentOptions) String() string { - if s == nil { - return "StarPaymentOptions(nil)" - } - type Alias StarPaymentOptions - return fmt.Sprintf("StarPaymentOptions%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarPaymentOptions) TypeID() uint32 { - return StarPaymentOptionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarPaymentOptions) TypeName() string { - return "starPaymentOptions" -} - -// TypeInfo returns info about TL type. -func (s *StarPaymentOptions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starPaymentOptions", - ID: StarPaymentOptionsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Options", - SchemaName: "options", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarPaymentOptions) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starPaymentOptions#77c3bbad as nil") - } - b.PutID(StarPaymentOptionsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarPaymentOptions) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starPaymentOptions#77c3bbad as nil") - } - b.PutInt(len(s.Options)) - for idx, v := range s.Options { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare starPaymentOptions#77c3bbad: field options element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarPaymentOptions) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starPaymentOptions#77c3bbad to nil") - } - if err := b.ConsumeID(StarPaymentOptionsTypeID); err != nil { - return fmt.Errorf("unable to decode starPaymentOptions#77c3bbad: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarPaymentOptions) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starPaymentOptions#77c3bbad to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode starPaymentOptions#77c3bbad: field options: %w", err) - } - - if headerLen > 0 { - s.Options = make([]StarPaymentOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StarPaymentOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare starPaymentOptions#77c3bbad: field options: %w", err) - } - s.Options = append(s.Options, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarPaymentOptions) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starPaymentOptions#77c3bbad as nil") - } - b.ObjStart() - b.PutID("starPaymentOptions") - b.Comma() - b.FieldStart("options") - b.ArrStart() - for idx, v := range s.Options { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starPaymentOptions#77c3bbad: field options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarPaymentOptions) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starPaymentOptions#77c3bbad to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starPaymentOptions"); err != nil { - return fmt.Errorf("unable to decode starPaymentOptions#77c3bbad: %w", err) - } - case "options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StarPaymentOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starPaymentOptions#77c3bbad: field options: %w", err) - } - s.Options = append(s.Options, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode starPaymentOptions#77c3bbad: field options: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOptions returns value of Options field. -func (s *StarPaymentOptions) GetOptions() (value []StarPaymentOption) { - if s == nil { - return - } - return s.Options -} diff --git a/tdapi/tl_star_revenue_statistics_gen.go b/tdapi/tl_star_revenue_statistics_gen.go deleted file mode 100644 index fc0f9e9dd..000000000 --- a/tdapi/tl_star_revenue_statistics_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarRevenueStatistics represents TL type `starRevenueStatistics#bd2d9257`. -type StarRevenueStatistics struct { - // A graph containing amount of revenue in a given day - RevenueByDayGraph StatisticalGraphClass - // Telegram Star revenue status - Status StarRevenueStatus - // Current conversion rate of a Telegram Star to USD - UsdRate float64 -} - -// StarRevenueStatisticsTypeID is TL type id of StarRevenueStatistics. -const StarRevenueStatisticsTypeID = 0xbd2d9257 - -// Ensuring interfaces in compile-time for StarRevenueStatistics. -var ( - _ bin.Encoder = &StarRevenueStatistics{} - _ bin.Decoder = &StarRevenueStatistics{} - _ bin.BareEncoder = &StarRevenueStatistics{} - _ bin.BareDecoder = &StarRevenueStatistics{} -) - -func (s *StarRevenueStatistics) Zero() bool { - if s == nil { - return true - } - if !(s.RevenueByDayGraph == nil) { - return false - } - if !(s.Status.Zero()) { - return false - } - if !(s.UsdRate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarRevenueStatistics) String() string { - if s == nil { - return "StarRevenueStatistics(nil)" - } - type Alias StarRevenueStatistics - return fmt.Sprintf("StarRevenueStatistics%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarRevenueStatistics) TypeID() uint32 { - return StarRevenueStatisticsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarRevenueStatistics) TypeName() string { - return "starRevenueStatistics" -} - -// TypeInfo returns info about TL type. -func (s *StarRevenueStatistics) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starRevenueStatistics", - ID: StarRevenueStatisticsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RevenueByDayGraph", - SchemaName: "revenue_by_day_graph", - }, - { - Name: "Status", - SchemaName: "status", - }, - { - Name: "UsdRate", - SchemaName: "usd_rate", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarRevenueStatistics) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starRevenueStatistics#bd2d9257 as nil") - } - b.PutID(StarRevenueStatisticsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarRevenueStatistics) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starRevenueStatistics#bd2d9257 as nil") - } - if s.RevenueByDayGraph == nil { - return fmt.Errorf("unable to encode starRevenueStatistics#bd2d9257: field revenue_by_day_graph is nil") - } - if err := s.RevenueByDayGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode starRevenueStatistics#bd2d9257: field revenue_by_day_graph: %w", err) - } - if err := s.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode starRevenueStatistics#bd2d9257: field status: %w", err) - } - b.PutDouble(s.UsdRate) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarRevenueStatistics) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starRevenueStatistics#bd2d9257 to nil") - } - if err := b.ConsumeID(StarRevenueStatisticsTypeID); err != nil { - return fmt.Errorf("unable to decode starRevenueStatistics#bd2d9257: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarRevenueStatistics) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starRevenueStatistics#bd2d9257 to nil") - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode starRevenueStatistics#bd2d9257: field revenue_by_day_graph: %w", err) - } - s.RevenueByDayGraph = value - } - { - if err := s.Status.Decode(b); err != nil { - return fmt.Errorf("unable to decode starRevenueStatistics#bd2d9257: field status: %w", err) - } - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode starRevenueStatistics#bd2d9257: field usd_rate: %w", err) - } - s.UsdRate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarRevenueStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starRevenueStatistics#bd2d9257 as nil") - } - b.ObjStart() - b.PutID("starRevenueStatistics") - b.Comma() - b.FieldStart("revenue_by_day_graph") - if s.RevenueByDayGraph == nil { - return fmt.Errorf("unable to encode starRevenueStatistics#bd2d9257: field revenue_by_day_graph is nil") - } - if err := s.RevenueByDayGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starRevenueStatistics#bd2d9257: field revenue_by_day_graph: %w", err) - } - b.Comma() - b.FieldStart("status") - if err := s.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starRevenueStatistics#bd2d9257: field status: %w", err) - } - b.Comma() - b.FieldStart("usd_rate") - b.PutDouble(s.UsdRate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarRevenueStatistics) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starRevenueStatistics#bd2d9257 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starRevenueStatistics"); err != nil { - return fmt.Errorf("unable to decode starRevenueStatistics#bd2d9257: %w", err) - } - case "revenue_by_day_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode starRevenueStatistics#bd2d9257: field revenue_by_day_graph: %w", err) - } - s.RevenueByDayGraph = value - case "status": - if err := s.Status.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starRevenueStatistics#bd2d9257: field status: %w", err) - } - case "usd_rate": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode starRevenueStatistics#bd2d9257: field usd_rate: %w", err) - } - s.UsdRate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRevenueByDayGraph returns value of RevenueByDayGraph field. -func (s *StarRevenueStatistics) GetRevenueByDayGraph() (value StatisticalGraphClass) { - if s == nil { - return - } - return s.RevenueByDayGraph -} - -// GetStatus returns value of Status field. -func (s *StarRevenueStatistics) GetStatus() (value StarRevenueStatus) { - if s == nil { - return - } - return s.Status -} - -// GetUsdRate returns value of UsdRate field. -func (s *StarRevenueStatistics) GetUsdRate() (value float64) { - if s == nil { - return - } - return s.UsdRate -} diff --git a/tdapi/tl_star_revenue_status_gen.go b/tdapi/tl_star_revenue_status_gen.go deleted file mode 100644 index d730d5c17..000000000 --- a/tdapi/tl_star_revenue_status_gen.go +++ /dev/null @@ -1,330 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarRevenueStatus represents TL type `starRevenueStatus#779532e8`. -type StarRevenueStatus struct { - // Total amount of Telegram Stars earned - TotalAmount StarAmount - // The amount of Telegram Stars that aren't withdrawn yet - CurrentAmount StarAmount - // The amount of Telegram Stars that are available for withdrawal - AvailableAmount StarAmount - // True, if Telegram Stars can be withdrawn now or later - WithdrawalEnabled bool - // Time left before the next withdrawal can be started, in seconds; 0 if withdrawal can - // be started now - NextWithdrawalIn int32 -} - -// StarRevenueStatusTypeID is TL type id of StarRevenueStatus. -const StarRevenueStatusTypeID = 0x779532e8 - -// Ensuring interfaces in compile-time for StarRevenueStatus. -var ( - _ bin.Encoder = &StarRevenueStatus{} - _ bin.Decoder = &StarRevenueStatus{} - _ bin.BareEncoder = &StarRevenueStatus{} - _ bin.BareDecoder = &StarRevenueStatus{} -) - -func (s *StarRevenueStatus) Zero() bool { - if s == nil { - return true - } - if !(s.TotalAmount.Zero()) { - return false - } - if !(s.CurrentAmount.Zero()) { - return false - } - if !(s.AvailableAmount.Zero()) { - return false - } - if !(s.WithdrawalEnabled == false) { - return false - } - if !(s.NextWithdrawalIn == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarRevenueStatus) String() string { - if s == nil { - return "StarRevenueStatus(nil)" - } - type Alias StarRevenueStatus - return fmt.Sprintf("StarRevenueStatus%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarRevenueStatus) TypeID() uint32 { - return StarRevenueStatusTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarRevenueStatus) TypeName() string { - return "starRevenueStatus" -} - -// TypeInfo returns info about TL type. -func (s *StarRevenueStatus) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starRevenueStatus", - ID: StarRevenueStatusTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalAmount", - SchemaName: "total_amount", - }, - { - Name: "CurrentAmount", - SchemaName: "current_amount", - }, - { - Name: "AvailableAmount", - SchemaName: "available_amount", - }, - { - Name: "WithdrawalEnabled", - SchemaName: "withdrawal_enabled", - }, - { - Name: "NextWithdrawalIn", - SchemaName: "next_withdrawal_in", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarRevenueStatus) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starRevenueStatus#779532e8 as nil") - } - b.PutID(StarRevenueStatusTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarRevenueStatus) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starRevenueStatus#779532e8 as nil") - } - if err := s.TotalAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode starRevenueStatus#779532e8: field total_amount: %w", err) - } - if err := s.CurrentAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode starRevenueStatus#779532e8: field current_amount: %w", err) - } - if err := s.AvailableAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode starRevenueStatus#779532e8: field available_amount: %w", err) - } - b.PutBool(s.WithdrawalEnabled) - b.PutInt32(s.NextWithdrawalIn) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarRevenueStatus) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starRevenueStatus#779532e8 to nil") - } - if err := b.ConsumeID(StarRevenueStatusTypeID); err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarRevenueStatus) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starRevenueStatus#779532e8 to nil") - } - { - if err := s.TotalAmount.Decode(b); err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: field total_amount: %w", err) - } - } - { - if err := s.CurrentAmount.Decode(b); err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: field current_amount: %w", err) - } - } - { - if err := s.AvailableAmount.Decode(b); err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: field available_amount: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: field withdrawal_enabled: %w", err) - } - s.WithdrawalEnabled = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: field next_withdrawal_in: %w", err) - } - s.NextWithdrawalIn = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarRevenueStatus) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starRevenueStatus#779532e8 as nil") - } - b.ObjStart() - b.PutID("starRevenueStatus") - b.Comma() - b.FieldStart("total_amount") - if err := s.TotalAmount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starRevenueStatus#779532e8: field total_amount: %w", err) - } - b.Comma() - b.FieldStart("current_amount") - if err := s.CurrentAmount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starRevenueStatus#779532e8: field current_amount: %w", err) - } - b.Comma() - b.FieldStart("available_amount") - if err := s.AvailableAmount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starRevenueStatus#779532e8: field available_amount: %w", err) - } - b.Comma() - b.FieldStart("withdrawal_enabled") - b.PutBool(s.WithdrawalEnabled) - b.Comma() - b.FieldStart("next_withdrawal_in") - b.PutInt32(s.NextWithdrawalIn) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarRevenueStatus) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starRevenueStatus#779532e8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starRevenueStatus"); err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: %w", err) - } - case "total_amount": - if err := s.TotalAmount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: field total_amount: %w", err) - } - case "current_amount": - if err := s.CurrentAmount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: field current_amount: %w", err) - } - case "available_amount": - if err := s.AvailableAmount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: field available_amount: %w", err) - } - case "withdrawal_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: field withdrawal_enabled: %w", err) - } - s.WithdrawalEnabled = value - case "next_withdrawal_in": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starRevenueStatus#779532e8: field next_withdrawal_in: %w", err) - } - s.NextWithdrawalIn = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalAmount returns value of TotalAmount field. -func (s *StarRevenueStatus) GetTotalAmount() (value StarAmount) { - if s == nil { - return - } - return s.TotalAmount -} - -// GetCurrentAmount returns value of CurrentAmount field. -func (s *StarRevenueStatus) GetCurrentAmount() (value StarAmount) { - if s == nil { - return - } - return s.CurrentAmount -} - -// GetAvailableAmount returns value of AvailableAmount field. -func (s *StarRevenueStatus) GetAvailableAmount() (value StarAmount) { - if s == nil { - return - } - return s.AvailableAmount -} - -// GetWithdrawalEnabled returns value of WithdrawalEnabled field. -func (s *StarRevenueStatus) GetWithdrawalEnabled() (value bool) { - if s == nil { - return - } - return s.WithdrawalEnabled -} - -// GetNextWithdrawalIn returns value of NextWithdrawalIn field. -func (s *StarRevenueStatus) GetNextWithdrawalIn() (value int32) { - if s == nil { - return - } - return s.NextWithdrawalIn -} diff --git a/tdapi/tl_star_subscription_gen.go b/tdapi/tl_star_subscription_gen.go deleted file mode 100644 index 9d9e6058e..000000000 --- a/tdapi/tl_star_subscription_gen.go +++ /dev/null @@ -1,408 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarSubscription represents TL type `starSubscription#3a3811f5`. -type StarSubscription struct { - // Unique identifier of the subscription - ID string - // Identifier of the chat that is subscribed - ChatID int64 - // Point in time (Unix timestamp) when the subscription will expire or expired - ExpirationDate int32 - // True, if the subscription was canceled - IsCanceled bool - // True, if the subscription expires soon and there are no enough Telegram Stars on the - // user's balance to extend it - IsExpiring bool - // The subscription plan - Pricing StarSubscriptionPricing - // Type of the subscription - Type StarSubscriptionTypeClass -} - -// StarSubscriptionTypeID is TL type id of StarSubscription. -const StarSubscriptionTypeID = 0x3a3811f5 - -// Ensuring interfaces in compile-time for StarSubscription. -var ( - _ bin.Encoder = &StarSubscription{} - _ bin.Decoder = &StarSubscription{} - _ bin.BareEncoder = &StarSubscription{} - _ bin.BareDecoder = &StarSubscription{} -) - -func (s *StarSubscription) Zero() bool { - if s == nil { - return true - } - if !(s.ID == "") { - return false - } - if !(s.ChatID == 0) { - return false - } - if !(s.ExpirationDate == 0) { - return false - } - if !(s.IsCanceled == false) { - return false - } - if !(s.IsExpiring == false) { - return false - } - if !(s.Pricing.Zero()) { - return false - } - if !(s.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarSubscription) String() string { - if s == nil { - return "StarSubscription(nil)" - } - type Alias StarSubscription - return fmt.Sprintf("StarSubscription%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarSubscription) TypeID() uint32 { - return StarSubscriptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarSubscription) TypeName() string { - return "starSubscription" -} - -// TypeInfo returns info about TL type. -func (s *StarSubscription) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starSubscription", - ID: StarSubscriptionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ExpirationDate", - SchemaName: "expiration_date", - }, - { - Name: "IsCanceled", - SchemaName: "is_canceled", - }, - { - Name: "IsExpiring", - SchemaName: "is_expiring", - }, - { - Name: "Pricing", - SchemaName: "pricing", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarSubscription) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starSubscription#3a3811f5 as nil") - } - b.PutID(StarSubscriptionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarSubscription) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starSubscription#3a3811f5 as nil") - } - b.PutString(s.ID) - b.PutInt53(s.ChatID) - b.PutInt32(s.ExpirationDate) - b.PutBool(s.IsCanceled) - b.PutBool(s.IsExpiring) - if err := s.Pricing.Encode(b); err != nil { - return fmt.Errorf("unable to encode starSubscription#3a3811f5: field pricing: %w", err) - } - if s.Type == nil { - return fmt.Errorf("unable to encode starSubscription#3a3811f5: field type is nil") - } - if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode starSubscription#3a3811f5: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarSubscription) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starSubscription#3a3811f5 to nil") - } - if err := b.ConsumeID(StarSubscriptionTypeID); err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarSubscription) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starSubscription#3a3811f5 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field id: %w", err) - } - s.ID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field expiration_date: %w", err) - } - s.ExpirationDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field is_canceled: %w", err) - } - s.IsCanceled = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field is_expiring: %w", err) - } - s.IsExpiring = value - } - { - if err := s.Pricing.Decode(b); err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field pricing: %w", err) - } - } - { - value, err := DecodeStarSubscriptionType(b) - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field type: %w", err) - } - s.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarSubscription) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starSubscription#3a3811f5 as nil") - } - b.ObjStart() - b.PutID("starSubscription") - b.Comma() - b.FieldStart("id") - b.PutString(s.ID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("expiration_date") - b.PutInt32(s.ExpirationDate) - b.Comma() - b.FieldStart("is_canceled") - b.PutBool(s.IsCanceled) - b.Comma() - b.FieldStart("is_expiring") - b.PutBool(s.IsExpiring) - b.Comma() - b.FieldStart("pricing") - if err := s.Pricing.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starSubscription#3a3811f5: field pricing: %w", err) - } - b.Comma() - b.FieldStart("type") - if s.Type == nil { - return fmt.Errorf("unable to encode starSubscription#3a3811f5: field type is nil") - } - if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starSubscription#3a3811f5: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarSubscription) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starSubscription#3a3811f5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starSubscription"); err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field id: %w", err) - } - s.ID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field chat_id: %w", err) - } - s.ChatID = value - case "expiration_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field expiration_date: %w", err) - } - s.ExpirationDate = value - case "is_canceled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field is_canceled: %w", err) - } - s.IsCanceled = value - case "is_expiring": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field is_expiring: %w", err) - } - s.IsExpiring = value - case "pricing": - if err := s.Pricing.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field pricing: %w", err) - } - case "type": - value, err := DecodeTDLibJSONStarSubscriptionType(b) - if err != nil { - return fmt.Errorf("unable to decode starSubscription#3a3811f5: field type: %w", err) - } - s.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *StarSubscription) GetID() (value string) { - if s == nil { - return - } - return s.ID -} - -// GetChatID returns value of ChatID field. -func (s *StarSubscription) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetExpirationDate returns value of ExpirationDate field. -func (s *StarSubscription) GetExpirationDate() (value int32) { - if s == nil { - return - } - return s.ExpirationDate -} - -// GetIsCanceled returns value of IsCanceled field. -func (s *StarSubscription) GetIsCanceled() (value bool) { - if s == nil { - return - } - return s.IsCanceled -} - -// GetIsExpiring returns value of IsExpiring field. -func (s *StarSubscription) GetIsExpiring() (value bool) { - if s == nil { - return - } - return s.IsExpiring -} - -// GetPricing returns value of Pricing field. -func (s *StarSubscription) GetPricing() (value StarSubscriptionPricing) { - if s == nil { - return - } - return s.Pricing -} - -// GetType returns value of Type field. -func (s *StarSubscription) GetType() (value StarSubscriptionTypeClass) { - if s == nil { - return - } - return s.Type -} diff --git a/tdapi/tl_star_subscription_pricing_gen.go b/tdapi/tl_star_subscription_pricing_gen.go deleted file mode 100644 index 4e239a17b..000000000 --- a/tdapi/tl_star_subscription_pricing_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarSubscriptionPricing represents TL type `starSubscriptionPricing#96a28856`. -type StarSubscriptionPricing struct { - // The number of seconds between consecutive Telegram Star debiting - Period int32 - // The amount of Telegram Stars that must be paid for each period - StarCount int64 -} - -// StarSubscriptionPricingTypeID is TL type id of StarSubscriptionPricing. -const StarSubscriptionPricingTypeID = 0x96a28856 - -// Ensuring interfaces in compile-time for StarSubscriptionPricing. -var ( - _ bin.Encoder = &StarSubscriptionPricing{} - _ bin.Decoder = &StarSubscriptionPricing{} - _ bin.BareEncoder = &StarSubscriptionPricing{} - _ bin.BareDecoder = &StarSubscriptionPricing{} -) - -func (s *StarSubscriptionPricing) Zero() bool { - if s == nil { - return true - } - if !(s.Period == 0) { - return false - } - if !(s.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarSubscriptionPricing) String() string { - if s == nil { - return "StarSubscriptionPricing(nil)" - } - type Alias StarSubscriptionPricing - return fmt.Sprintf("StarSubscriptionPricing%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarSubscriptionPricing) TypeID() uint32 { - return StarSubscriptionPricingTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarSubscriptionPricing) TypeName() string { - return "starSubscriptionPricing" -} - -// TypeInfo returns info about TL type. -func (s *StarSubscriptionPricing) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starSubscriptionPricing", - ID: StarSubscriptionPricingTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Period", - SchemaName: "period", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarSubscriptionPricing) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptionPricing#96a28856 as nil") - } - b.PutID(StarSubscriptionPricingTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarSubscriptionPricing) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptionPricing#96a28856 as nil") - } - b.PutInt32(s.Period) - b.PutInt53(s.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarSubscriptionPricing) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptionPricing#96a28856 to nil") - } - if err := b.ConsumeID(StarSubscriptionPricingTypeID); err != nil { - return fmt.Errorf("unable to decode starSubscriptionPricing#96a28856: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarSubscriptionPricing) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptionPricing#96a28856 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionPricing#96a28856: field period: %w", err) - } - s.Period = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionPricing#96a28856: field star_count: %w", err) - } - s.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarSubscriptionPricing) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptionPricing#96a28856 as nil") - } - b.ObjStart() - b.PutID("starSubscriptionPricing") - b.Comma() - b.FieldStart("period") - b.PutInt32(s.Period) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(s.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarSubscriptionPricing) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptionPricing#96a28856 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starSubscriptionPricing"); err != nil { - return fmt.Errorf("unable to decode starSubscriptionPricing#96a28856: %w", err) - } - case "period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionPricing#96a28856: field period: %w", err) - } - s.Period = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionPricing#96a28856: field star_count: %w", err) - } - s.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPeriod returns value of Period field. -func (s *StarSubscriptionPricing) GetPeriod() (value int32) { - if s == nil { - return - } - return s.Period -} - -// GetStarCount returns value of StarCount field. -func (s *StarSubscriptionPricing) GetStarCount() (value int64) { - if s == nil { - return - } - return s.StarCount -} diff --git a/tdapi/tl_star_subscription_type_gen.go b/tdapi/tl_star_subscription_type_gen.go deleted file mode 100644 index 4f6fabb0d..000000000 --- a/tdapi/tl_star_subscription_type_gen.go +++ /dev/null @@ -1,639 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarSubscriptionTypeChannel represents TL type `starSubscriptionTypeChannel#c29ab6f5`. -type StarSubscriptionTypeChannel struct { - // True, if the subscription is active and the user can use the method - // reuseStarSubscription to join the subscribed chat again - CanReuse bool - // The invite link that can be used to renew the subscription if it has been expired; may - // be empty, if the link isn't available anymore - InviteLink string -} - -// StarSubscriptionTypeChannelTypeID is TL type id of StarSubscriptionTypeChannel. -const StarSubscriptionTypeChannelTypeID = 0xc29ab6f5 - -// construct implements constructor of StarSubscriptionTypeClass. -func (s StarSubscriptionTypeChannel) construct() StarSubscriptionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarSubscriptionTypeChannel. -var ( - _ bin.Encoder = &StarSubscriptionTypeChannel{} - _ bin.Decoder = &StarSubscriptionTypeChannel{} - _ bin.BareEncoder = &StarSubscriptionTypeChannel{} - _ bin.BareDecoder = &StarSubscriptionTypeChannel{} - - _ StarSubscriptionTypeClass = &StarSubscriptionTypeChannel{} -) - -func (s *StarSubscriptionTypeChannel) Zero() bool { - if s == nil { - return true - } - if !(s.CanReuse == false) { - return false - } - if !(s.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarSubscriptionTypeChannel) String() string { - if s == nil { - return "StarSubscriptionTypeChannel(nil)" - } - type Alias StarSubscriptionTypeChannel - return fmt.Sprintf("StarSubscriptionTypeChannel%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarSubscriptionTypeChannel) TypeID() uint32 { - return StarSubscriptionTypeChannelTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarSubscriptionTypeChannel) TypeName() string { - return "starSubscriptionTypeChannel" -} - -// TypeInfo returns info about TL type. -func (s *StarSubscriptionTypeChannel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starSubscriptionTypeChannel", - ID: StarSubscriptionTypeChannelTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CanReuse", - SchemaName: "can_reuse", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarSubscriptionTypeChannel) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptionTypeChannel#c29ab6f5 as nil") - } - b.PutID(StarSubscriptionTypeChannelTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarSubscriptionTypeChannel) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptionTypeChannel#c29ab6f5 as nil") - } - b.PutBool(s.CanReuse) - b.PutString(s.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarSubscriptionTypeChannel) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptionTypeChannel#c29ab6f5 to nil") - } - if err := b.ConsumeID(StarSubscriptionTypeChannelTypeID); err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeChannel#c29ab6f5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarSubscriptionTypeChannel) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptionTypeChannel#c29ab6f5 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeChannel#c29ab6f5: field can_reuse: %w", err) - } - s.CanReuse = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeChannel#c29ab6f5: field invite_link: %w", err) - } - s.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarSubscriptionTypeChannel) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptionTypeChannel#c29ab6f5 as nil") - } - b.ObjStart() - b.PutID("starSubscriptionTypeChannel") - b.Comma() - b.FieldStart("can_reuse") - b.PutBool(s.CanReuse) - b.Comma() - b.FieldStart("invite_link") - b.PutString(s.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarSubscriptionTypeChannel) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptionTypeChannel#c29ab6f5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starSubscriptionTypeChannel"); err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeChannel#c29ab6f5: %w", err) - } - case "can_reuse": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeChannel#c29ab6f5: field can_reuse: %w", err) - } - s.CanReuse = value - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeChannel#c29ab6f5: field invite_link: %w", err) - } - s.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCanReuse returns value of CanReuse field. -func (s *StarSubscriptionTypeChannel) GetCanReuse() (value bool) { - if s == nil { - return - } - return s.CanReuse -} - -// GetInviteLink returns value of InviteLink field. -func (s *StarSubscriptionTypeChannel) GetInviteLink() (value string) { - if s == nil { - return - } - return s.InviteLink -} - -// StarSubscriptionTypeBot represents TL type `starSubscriptionTypeBot#d78ddd2`. -type StarSubscriptionTypeBot struct { - // True, if the subscription was canceled by the bot and can't be extended - IsCanceledByBot bool - // Subscription invoice title - Title string - // Subscription invoice photo - Photo Photo - // The link to the subscription invoice - InvoiceLink string -} - -// StarSubscriptionTypeBotTypeID is TL type id of StarSubscriptionTypeBot. -const StarSubscriptionTypeBotTypeID = 0xd78ddd2 - -// construct implements constructor of StarSubscriptionTypeClass. -func (s StarSubscriptionTypeBot) construct() StarSubscriptionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarSubscriptionTypeBot. -var ( - _ bin.Encoder = &StarSubscriptionTypeBot{} - _ bin.Decoder = &StarSubscriptionTypeBot{} - _ bin.BareEncoder = &StarSubscriptionTypeBot{} - _ bin.BareDecoder = &StarSubscriptionTypeBot{} - - _ StarSubscriptionTypeClass = &StarSubscriptionTypeBot{} -) - -func (s *StarSubscriptionTypeBot) Zero() bool { - if s == nil { - return true - } - if !(s.IsCanceledByBot == false) { - return false - } - if !(s.Title == "") { - return false - } - if !(s.Photo.Zero()) { - return false - } - if !(s.InvoiceLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarSubscriptionTypeBot) String() string { - if s == nil { - return "StarSubscriptionTypeBot(nil)" - } - type Alias StarSubscriptionTypeBot - return fmt.Sprintf("StarSubscriptionTypeBot%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarSubscriptionTypeBot) TypeID() uint32 { - return StarSubscriptionTypeBotTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarSubscriptionTypeBot) TypeName() string { - return "starSubscriptionTypeBot" -} - -// TypeInfo returns info about TL type. -func (s *StarSubscriptionTypeBot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starSubscriptionTypeBot", - ID: StarSubscriptionTypeBotTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsCanceledByBot", - SchemaName: "is_canceled_by_bot", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "InvoiceLink", - SchemaName: "invoice_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarSubscriptionTypeBot) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptionTypeBot#d78ddd2 as nil") - } - b.PutID(StarSubscriptionTypeBotTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarSubscriptionTypeBot) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptionTypeBot#d78ddd2 as nil") - } - b.PutBool(s.IsCanceledByBot) - b.PutString(s.Title) - if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode starSubscriptionTypeBot#d78ddd2: field photo: %w", err) - } - b.PutString(s.InvoiceLink) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarSubscriptionTypeBot) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptionTypeBot#d78ddd2 to nil") - } - if err := b.ConsumeID(StarSubscriptionTypeBotTypeID); err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeBot#d78ddd2: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarSubscriptionTypeBot) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptionTypeBot#d78ddd2 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeBot#d78ddd2: field is_canceled_by_bot: %w", err) - } - s.IsCanceledByBot = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeBot#d78ddd2: field title: %w", err) - } - s.Title = value - } - { - if err := s.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeBot#d78ddd2: field photo: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeBot#d78ddd2: field invoice_link: %w", err) - } - s.InvoiceLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarSubscriptionTypeBot) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptionTypeBot#d78ddd2 as nil") - } - b.ObjStart() - b.PutID("starSubscriptionTypeBot") - b.Comma() - b.FieldStart("is_canceled_by_bot") - b.PutBool(s.IsCanceledByBot) - b.Comma() - b.FieldStart("title") - b.PutString(s.Title) - b.Comma() - b.FieldStart("photo") - if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starSubscriptionTypeBot#d78ddd2: field photo: %w", err) - } - b.Comma() - b.FieldStart("invoice_link") - b.PutString(s.InvoiceLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarSubscriptionTypeBot) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptionTypeBot#d78ddd2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starSubscriptionTypeBot"); err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeBot#d78ddd2: %w", err) - } - case "is_canceled_by_bot": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeBot#d78ddd2: field is_canceled_by_bot: %w", err) - } - s.IsCanceledByBot = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeBot#d78ddd2: field title: %w", err) - } - s.Title = value - case "photo": - if err := s.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeBot#d78ddd2: field photo: %w", err) - } - case "invoice_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptionTypeBot#d78ddd2: field invoice_link: %w", err) - } - s.InvoiceLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsCanceledByBot returns value of IsCanceledByBot field. -func (s *StarSubscriptionTypeBot) GetIsCanceledByBot() (value bool) { - if s == nil { - return - } - return s.IsCanceledByBot -} - -// GetTitle returns value of Title field. -func (s *StarSubscriptionTypeBot) GetTitle() (value string) { - if s == nil { - return - } - return s.Title -} - -// GetPhoto returns value of Photo field. -func (s *StarSubscriptionTypeBot) GetPhoto() (value Photo) { - if s == nil { - return - } - return s.Photo -} - -// GetInvoiceLink returns value of InvoiceLink field. -func (s *StarSubscriptionTypeBot) GetInvoiceLink() (value string) { - if s == nil { - return - } - return s.InvoiceLink -} - -// StarSubscriptionTypeClassName is schema name of StarSubscriptionTypeClass. -const StarSubscriptionTypeClassName = "StarSubscriptionType" - -// StarSubscriptionTypeClass represents StarSubscriptionType generic type. -// -// Example: -// -// g, err := tdapi.DecodeStarSubscriptionType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StarSubscriptionTypeChannel: // starSubscriptionTypeChannel#c29ab6f5 -// case *tdapi.StarSubscriptionTypeBot: // starSubscriptionTypeBot#d78ddd2 -// default: panic(v) -// } -type StarSubscriptionTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StarSubscriptionTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStarSubscriptionType implements binary de-serialization for StarSubscriptionTypeClass. -func DecodeStarSubscriptionType(buf *bin.Buffer) (StarSubscriptionTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StarSubscriptionTypeChannelTypeID: - // Decoding starSubscriptionTypeChannel#c29ab6f5. - v := StarSubscriptionTypeChannel{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarSubscriptionTypeClass: %w", err) - } - return &v, nil - case StarSubscriptionTypeBotTypeID: - // Decoding starSubscriptionTypeBot#d78ddd2. - v := StarSubscriptionTypeBot{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarSubscriptionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StarSubscriptionTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStarSubscriptionType implements binary de-serialization for StarSubscriptionTypeClass. -func DecodeTDLibJSONStarSubscriptionType(buf tdjson.Decoder) (StarSubscriptionTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "starSubscriptionTypeChannel": - // Decoding starSubscriptionTypeChannel#c29ab6f5. - v := StarSubscriptionTypeChannel{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarSubscriptionTypeClass: %w", err) - } - return &v, nil - case "starSubscriptionTypeBot": - // Decoding starSubscriptionTypeBot#d78ddd2. - v := StarSubscriptionTypeBot{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarSubscriptionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StarSubscriptionTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StarSubscriptionType boxes the StarSubscriptionTypeClass providing a helper. -type StarSubscriptionTypeBox struct { - StarSubscriptionType StarSubscriptionTypeClass -} - -// Decode implements bin.Decoder for StarSubscriptionTypeBox. -func (b *StarSubscriptionTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StarSubscriptionTypeBox to nil") - } - v, err := DecodeStarSubscriptionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StarSubscriptionType = v - return nil -} - -// Encode implements bin.Encode for StarSubscriptionTypeBox. -func (b *StarSubscriptionTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StarSubscriptionType == nil { - return fmt.Errorf("unable to encode StarSubscriptionTypeClass as nil") - } - return b.StarSubscriptionType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StarSubscriptionTypeBox. -func (b *StarSubscriptionTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StarSubscriptionTypeBox to nil") - } - v, err := DecodeTDLibJSONStarSubscriptionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StarSubscriptionType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StarSubscriptionTypeBox. -func (b *StarSubscriptionTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StarSubscriptionType == nil { - return fmt.Errorf("unable to encode StarSubscriptionTypeClass as nil") - } - return b.StarSubscriptionType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_star_subscriptions_gen.go b/tdapi/tl_star_subscriptions_gen.go deleted file mode 100644 index f55715619..000000000 --- a/tdapi/tl_star_subscriptions_gen.go +++ /dev/null @@ -1,323 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarSubscriptions represents TL type `starSubscriptions#a2f27c8d`. -type StarSubscriptions struct { - // The amount of owned Telegram Stars - StarAmount StarAmount - // List of subscriptions for Telegram Stars - Subscriptions []StarSubscription - // The number of Telegram Stars required to buy to extend subscriptions expiring soon - RequiredStarCount int64 - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// StarSubscriptionsTypeID is TL type id of StarSubscriptions. -const StarSubscriptionsTypeID = 0xa2f27c8d - -// Ensuring interfaces in compile-time for StarSubscriptions. -var ( - _ bin.Encoder = &StarSubscriptions{} - _ bin.Decoder = &StarSubscriptions{} - _ bin.BareEncoder = &StarSubscriptions{} - _ bin.BareDecoder = &StarSubscriptions{} -) - -func (s *StarSubscriptions) Zero() bool { - if s == nil { - return true - } - if !(s.StarAmount.Zero()) { - return false - } - if !(s.Subscriptions == nil) { - return false - } - if !(s.RequiredStarCount == 0) { - return false - } - if !(s.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarSubscriptions) String() string { - if s == nil { - return "StarSubscriptions(nil)" - } - type Alias StarSubscriptions - return fmt.Sprintf("StarSubscriptions%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarSubscriptions) TypeID() uint32 { - return StarSubscriptionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarSubscriptions) TypeName() string { - return "starSubscriptions" -} - -// TypeInfo returns info about TL type. -func (s *StarSubscriptions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starSubscriptions", - ID: StarSubscriptionsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarAmount", - SchemaName: "star_amount", - }, - { - Name: "Subscriptions", - SchemaName: "subscriptions", - }, - { - Name: "RequiredStarCount", - SchemaName: "required_star_count", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarSubscriptions) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptions#a2f27c8d as nil") - } - b.PutID(StarSubscriptionsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarSubscriptions) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptions#a2f27c8d as nil") - } - if err := s.StarAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode starSubscriptions#a2f27c8d: field star_amount: %w", err) - } - b.PutInt(len(s.Subscriptions)) - for idx, v := range s.Subscriptions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare starSubscriptions#a2f27c8d: field subscriptions element with index %d: %w", idx, err) - } - } - b.PutInt53(s.RequiredStarCount) - b.PutString(s.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarSubscriptions) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptions#a2f27c8d to nil") - } - if err := b.ConsumeID(StarSubscriptionsTypeID); err != nil { - return fmt.Errorf("unable to decode starSubscriptions#a2f27c8d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarSubscriptions) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptions#a2f27c8d to nil") - } - { - if err := s.StarAmount.Decode(b); err != nil { - return fmt.Errorf("unable to decode starSubscriptions#a2f27c8d: field star_amount: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptions#a2f27c8d: field subscriptions: %w", err) - } - - if headerLen > 0 { - s.Subscriptions = make([]StarSubscription, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StarSubscription - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare starSubscriptions#a2f27c8d: field subscriptions: %w", err) - } - s.Subscriptions = append(s.Subscriptions, value) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptions#a2f27c8d: field required_star_count: %w", err) - } - s.RequiredStarCount = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptions#a2f27c8d: field next_offset: %w", err) - } - s.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarSubscriptions) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starSubscriptions#a2f27c8d as nil") - } - b.ObjStart() - b.PutID("starSubscriptions") - b.Comma() - b.FieldStart("star_amount") - if err := s.StarAmount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starSubscriptions#a2f27c8d: field star_amount: %w", err) - } - b.Comma() - b.FieldStart("subscriptions") - b.ArrStart() - for idx, v := range s.Subscriptions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starSubscriptions#a2f27c8d: field subscriptions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("required_star_count") - b.PutInt53(s.RequiredStarCount) - b.Comma() - b.FieldStart("next_offset") - b.PutString(s.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarSubscriptions) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starSubscriptions#a2f27c8d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starSubscriptions"); err != nil { - return fmt.Errorf("unable to decode starSubscriptions#a2f27c8d: %w", err) - } - case "star_amount": - if err := s.StarAmount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starSubscriptions#a2f27c8d: field star_amount: %w", err) - } - case "subscriptions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StarSubscription - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starSubscriptions#a2f27c8d: field subscriptions: %w", err) - } - s.Subscriptions = append(s.Subscriptions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode starSubscriptions#a2f27c8d: field subscriptions: %w", err) - } - case "required_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptions#a2f27c8d: field required_star_count: %w", err) - } - s.RequiredStarCount = value - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starSubscriptions#a2f27c8d: field next_offset: %w", err) - } - s.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarAmount returns value of StarAmount field. -func (s *StarSubscriptions) GetStarAmount() (value StarAmount) { - if s == nil { - return - } - return s.StarAmount -} - -// GetSubscriptions returns value of Subscriptions field. -func (s *StarSubscriptions) GetSubscriptions() (value []StarSubscription) { - if s == nil { - return - } - return s.Subscriptions -} - -// GetRequiredStarCount returns value of RequiredStarCount field. -func (s *StarSubscriptions) GetRequiredStarCount() (value int64) { - if s == nil { - return - } - return s.RequiredStarCount -} - -// GetNextOffset returns value of NextOffset field. -func (s *StarSubscriptions) GetNextOffset() (value string) { - if s == nil { - return - } - return s.NextOffset -} diff --git a/tdapi/tl_star_transaction_direction_gen.go b/tdapi/tl_star_transaction_direction_gen.go deleted file mode 100644 index 107efba87..000000000 --- a/tdapi/tl_star_transaction_direction_gen.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarTransactionDirectionIncoming represents TL type `starTransactionDirectionIncoming#b2cabe46`. -type StarTransactionDirectionIncoming struct { -} - -// StarTransactionDirectionIncomingTypeID is TL type id of StarTransactionDirectionIncoming. -const StarTransactionDirectionIncomingTypeID = 0xb2cabe46 - -// construct implements constructor of StarTransactionDirectionClass. -func (s StarTransactionDirectionIncoming) construct() StarTransactionDirectionClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionDirectionIncoming. -var ( - _ bin.Encoder = &StarTransactionDirectionIncoming{} - _ bin.Decoder = &StarTransactionDirectionIncoming{} - _ bin.BareEncoder = &StarTransactionDirectionIncoming{} - _ bin.BareDecoder = &StarTransactionDirectionIncoming{} - - _ StarTransactionDirectionClass = &StarTransactionDirectionIncoming{} -) - -func (s *StarTransactionDirectionIncoming) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionDirectionIncoming) String() string { - if s == nil { - return "StarTransactionDirectionIncoming(nil)" - } - type Alias StarTransactionDirectionIncoming - return fmt.Sprintf("StarTransactionDirectionIncoming%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionDirectionIncoming) TypeID() uint32 { - return StarTransactionDirectionIncomingTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionDirectionIncoming) TypeName() string { - return "starTransactionDirectionIncoming" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionDirectionIncoming) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionDirectionIncoming", - ID: StarTransactionDirectionIncomingTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionDirectionIncoming) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionDirectionIncoming#b2cabe46 as nil") - } - b.PutID(StarTransactionDirectionIncomingTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionDirectionIncoming) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionDirectionIncoming#b2cabe46 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionDirectionIncoming) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionDirectionIncoming#b2cabe46 to nil") - } - if err := b.ConsumeID(StarTransactionDirectionIncomingTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionDirectionIncoming#b2cabe46: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionDirectionIncoming) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionDirectionIncoming#b2cabe46 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionDirectionIncoming) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionDirectionIncoming#b2cabe46 as nil") - } - b.ObjStart() - b.PutID("starTransactionDirectionIncoming") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionDirectionIncoming) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionDirectionIncoming#b2cabe46 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionDirectionIncoming"); err != nil { - return fmt.Errorf("unable to decode starTransactionDirectionIncoming#b2cabe46: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StarTransactionDirectionOutgoing represents TL type `starTransactionDirectionOutgoing#6e83b5a0`. -type StarTransactionDirectionOutgoing struct { -} - -// StarTransactionDirectionOutgoingTypeID is TL type id of StarTransactionDirectionOutgoing. -const StarTransactionDirectionOutgoingTypeID = 0x6e83b5a0 - -// construct implements constructor of StarTransactionDirectionClass. -func (s StarTransactionDirectionOutgoing) construct() StarTransactionDirectionClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionDirectionOutgoing. -var ( - _ bin.Encoder = &StarTransactionDirectionOutgoing{} - _ bin.Decoder = &StarTransactionDirectionOutgoing{} - _ bin.BareEncoder = &StarTransactionDirectionOutgoing{} - _ bin.BareDecoder = &StarTransactionDirectionOutgoing{} - - _ StarTransactionDirectionClass = &StarTransactionDirectionOutgoing{} -) - -func (s *StarTransactionDirectionOutgoing) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionDirectionOutgoing) String() string { - if s == nil { - return "StarTransactionDirectionOutgoing(nil)" - } - type Alias StarTransactionDirectionOutgoing - return fmt.Sprintf("StarTransactionDirectionOutgoing%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionDirectionOutgoing) TypeID() uint32 { - return StarTransactionDirectionOutgoingTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionDirectionOutgoing) TypeName() string { - return "starTransactionDirectionOutgoing" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionDirectionOutgoing) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionDirectionOutgoing", - ID: StarTransactionDirectionOutgoingTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionDirectionOutgoing) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionDirectionOutgoing#6e83b5a0 as nil") - } - b.PutID(StarTransactionDirectionOutgoingTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionDirectionOutgoing) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionDirectionOutgoing#6e83b5a0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionDirectionOutgoing) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionDirectionOutgoing#6e83b5a0 to nil") - } - if err := b.ConsumeID(StarTransactionDirectionOutgoingTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionDirectionOutgoing#6e83b5a0: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionDirectionOutgoing) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionDirectionOutgoing#6e83b5a0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionDirectionOutgoing) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionDirectionOutgoing#6e83b5a0 as nil") - } - b.ObjStart() - b.PutID("starTransactionDirectionOutgoing") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionDirectionOutgoing) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionDirectionOutgoing#6e83b5a0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionDirectionOutgoing"); err != nil { - return fmt.Errorf("unable to decode starTransactionDirectionOutgoing#6e83b5a0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StarTransactionDirectionClassName is schema name of StarTransactionDirectionClass. -const StarTransactionDirectionClassName = "StarTransactionDirection" - -// StarTransactionDirectionClass represents StarTransactionDirection generic type. -// -// Example: -// -// g, err := tdapi.DecodeStarTransactionDirection(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StarTransactionDirectionIncoming: // starTransactionDirectionIncoming#b2cabe46 -// case *tdapi.StarTransactionDirectionOutgoing: // starTransactionDirectionOutgoing#6e83b5a0 -// default: panic(v) -// } -type StarTransactionDirectionClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StarTransactionDirectionClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStarTransactionDirection implements binary de-serialization for StarTransactionDirectionClass. -func DecodeStarTransactionDirection(buf *bin.Buffer) (StarTransactionDirectionClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StarTransactionDirectionIncomingTypeID: - // Decoding starTransactionDirectionIncoming#b2cabe46. - v := StarTransactionDirectionIncoming{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", err) - } - return &v, nil - case StarTransactionDirectionOutgoingTypeID: - // Decoding starTransactionDirectionOutgoing#6e83b5a0. - v := StarTransactionDirectionOutgoing{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStarTransactionDirection implements binary de-serialization for StarTransactionDirectionClass. -func DecodeTDLibJSONStarTransactionDirection(buf tdjson.Decoder) (StarTransactionDirectionClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "starTransactionDirectionIncoming": - // Decoding starTransactionDirectionIncoming#b2cabe46. - v := StarTransactionDirectionIncoming{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", err) - } - return &v, nil - case "starTransactionDirectionOutgoing": - // Decoding starTransactionDirectionOutgoing#6e83b5a0. - v := StarTransactionDirectionOutgoing{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StarTransactionDirectionClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StarTransactionDirection boxes the StarTransactionDirectionClass providing a helper. -type StarTransactionDirectionBox struct { - StarTransactionDirection StarTransactionDirectionClass -} - -// Decode implements bin.Decoder for StarTransactionDirectionBox. -func (b *StarTransactionDirectionBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StarTransactionDirectionBox to nil") - } - v, err := DecodeStarTransactionDirection(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StarTransactionDirection = v - return nil -} - -// Encode implements bin.Encode for StarTransactionDirectionBox. -func (b *StarTransactionDirectionBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StarTransactionDirection == nil { - return fmt.Errorf("unable to encode StarTransactionDirectionClass as nil") - } - return b.StarTransactionDirection.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StarTransactionDirectionBox. -func (b *StarTransactionDirectionBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StarTransactionDirectionBox to nil") - } - v, err := DecodeTDLibJSONStarTransactionDirection(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StarTransactionDirection = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StarTransactionDirectionBox. -func (b *StarTransactionDirectionBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StarTransactionDirection == nil { - return fmt.Errorf("unable to encode StarTransactionDirectionClass as nil") - } - return b.StarTransactionDirection.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_star_transaction_gen.go b/tdapi/tl_star_transaction_gen.go deleted file mode 100644 index bcba514ff..000000000 --- a/tdapi/tl_star_transaction_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarTransaction represents TL type `starTransaction#7f820a90`. -type StarTransaction struct { - // Unique identifier of the transaction - ID string - // The amount of added owned Telegram Stars; negative for outgoing transactions - StarAmount StarAmount - // True, if the transaction is a refund of a previous transaction - IsRefund bool - // Point in time (Unix timestamp) when the transaction was completed - Date int32 - // Type of the transaction - Type StarTransactionTypeClass -} - -// StarTransactionTypeID is TL type id of StarTransaction. -const StarTransactionTypeID = 0x7f820a90 - -// Ensuring interfaces in compile-time for StarTransaction. -var ( - _ bin.Encoder = &StarTransaction{} - _ bin.Decoder = &StarTransaction{} - _ bin.BareEncoder = &StarTransaction{} - _ bin.BareDecoder = &StarTransaction{} -) - -func (s *StarTransaction) Zero() bool { - if s == nil { - return true - } - if !(s.ID == "") { - return false - } - if !(s.StarAmount.Zero()) { - return false - } - if !(s.IsRefund == false) { - return false - } - if !(s.Date == 0) { - return false - } - if !(s.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransaction) String() string { - if s == nil { - return "StarTransaction(nil)" - } - type Alias StarTransaction - return fmt.Sprintf("StarTransaction%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransaction) TypeID() uint32 { - return StarTransactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransaction) TypeName() string { - return "starTransaction" -} - -// TypeInfo returns info about TL type. -func (s *StarTransaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransaction", - ID: StarTransactionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "StarAmount", - SchemaName: "star_amount", - }, - { - Name: "IsRefund", - SchemaName: "is_refund", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransaction) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransaction#7f820a90 as nil") - } - b.PutID(StarTransactionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransaction) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransaction#7f820a90 as nil") - } - b.PutString(s.ID) - if err := s.StarAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransaction#7f820a90: field star_amount: %w", err) - } - b.PutBool(s.IsRefund) - b.PutInt32(s.Date) - if s.Type == nil { - return fmt.Errorf("unable to encode starTransaction#7f820a90: field type is nil") - } - if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransaction#7f820a90: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransaction) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransaction#7f820a90 to nil") - } - if err := b.ConsumeID(StarTransactionTypeID); err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransaction) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransaction#7f820a90 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: field id: %w", err) - } - s.ID = value - } - { - if err := s.StarAmount.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: field star_amount: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: field is_refund: %w", err) - } - s.IsRefund = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: field date: %w", err) - } - s.Date = value - } - { - value, err := DecodeStarTransactionType(b) - if err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: field type: %w", err) - } - s.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransaction#7f820a90 as nil") - } - b.ObjStart() - b.PutID("starTransaction") - b.Comma() - b.FieldStart("id") - b.PutString(s.ID) - b.Comma() - b.FieldStart("star_amount") - if err := s.StarAmount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransaction#7f820a90: field star_amount: %w", err) - } - b.Comma() - b.FieldStart("is_refund") - b.PutBool(s.IsRefund) - b.Comma() - b.FieldStart("date") - b.PutInt32(s.Date) - b.Comma() - b.FieldStart("type") - if s.Type == nil { - return fmt.Errorf("unable to encode starTransaction#7f820a90: field type is nil") - } - if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransaction#7f820a90: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransaction#7f820a90 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransaction"); err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: field id: %w", err) - } - s.ID = value - case "star_amount": - if err := s.StarAmount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: field star_amount: %w", err) - } - case "is_refund": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: field is_refund: %w", err) - } - s.IsRefund = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: field date: %w", err) - } - s.Date = value - case "type": - value, err := DecodeTDLibJSONStarTransactionType(b) - if err != nil { - return fmt.Errorf("unable to decode starTransaction#7f820a90: field type: %w", err) - } - s.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *StarTransaction) GetID() (value string) { - if s == nil { - return - } - return s.ID -} - -// GetStarAmount returns value of StarAmount field. -func (s *StarTransaction) GetStarAmount() (value StarAmount) { - if s == nil { - return - } - return s.StarAmount -} - -// GetIsRefund returns value of IsRefund field. -func (s *StarTransaction) GetIsRefund() (value bool) { - if s == nil { - return - } - return s.IsRefund -} - -// GetDate returns value of Date field. -func (s *StarTransaction) GetDate() (value int32) { - if s == nil { - return - } - return s.Date -} - -// GetType returns value of Type field. -func (s *StarTransaction) GetType() (value StarTransactionTypeClass) { - if s == nil { - return - } - return s.Type -} diff --git a/tdapi/tl_star_transaction_type_gen.go b/tdapi/tl_star_transaction_type_gen.go deleted file mode 100644 index be4aa1eb1..000000000 --- a/tdapi/tl_star_transaction_type_gen.go +++ /dev/null @@ -1,5927 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarTransactionTypePremiumBotDeposit represents TL type `starTransactionTypePremiumBotDeposit#d879090e`. -type StarTransactionTypePremiumBotDeposit struct { -} - -// StarTransactionTypePremiumBotDepositTypeID is TL type id of StarTransactionTypePremiumBotDeposit. -const StarTransactionTypePremiumBotDepositTypeID = 0xd879090e - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypePremiumBotDeposit) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypePremiumBotDeposit. -var ( - _ bin.Encoder = &StarTransactionTypePremiumBotDeposit{} - _ bin.Decoder = &StarTransactionTypePremiumBotDeposit{} - _ bin.BareEncoder = &StarTransactionTypePremiumBotDeposit{} - _ bin.BareDecoder = &StarTransactionTypePremiumBotDeposit{} - - _ StarTransactionTypeClass = &StarTransactionTypePremiumBotDeposit{} -) - -func (s *StarTransactionTypePremiumBotDeposit) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypePremiumBotDeposit) String() string { - if s == nil { - return "StarTransactionTypePremiumBotDeposit(nil)" - } - type Alias StarTransactionTypePremiumBotDeposit - return fmt.Sprintf("StarTransactionTypePremiumBotDeposit%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypePremiumBotDeposit) TypeID() uint32 { - return StarTransactionTypePremiumBotDepositTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypePremiumBotDeposit) TypeName() string { - return "starTransactionTypePremiumBotDeposit" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypePremiumBotDeposit) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypePremiumBotDeposit", - ID: StarTransactionTypePremiumBotDepositTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypePremiumBotDeposit) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypePremiumBotDeposit#d879090e as nil") - } - b.PutID(StarTransactionTypePremiumBotDepositTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypePremiumBotDeposit) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypePremiumBotDeposit#d879090e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypePremiumBotDeposit) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypePremiumBotDeposit#d879090e to nil") - } - if err := b.ConsumeID(StarTransactionTypePremiumBotDepositTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypePremiumBotDeposit#d879090e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypePremiumBotDeposit) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypePremiumBotDeposit#d879090e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypePremiumBotDeposit) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypePremiumBotDeposit#d879090e as nil") - } - b.ObjStart() - b.PutID("starTransactionTypePremiumBotDeposit") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypePremiumBotDeposit) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypePremiumBotDeposit#d879090e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypePremiumBotDeposit"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypePremiumBotDeposit#d879090e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StarTransactionTypeAppStoreDeposit represents TL type `starTransactionTypeAppStoreDeposit#8283941`. -type StarTransactionTypeAppStoreDeposit struct { -} - -// StarTransactionTypeAppStoreDepositTypeID is TL type id of StarTransactionTypeAppStoreDeposit. -const StarTransactionTypeAppStoreDepositTypeID = 0x8283941 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeAppStoreDeposit) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeAppStoreDeposit. -var ( - _ bin.Encoder = &StarTransactionTypeAppStoreDeposit{} - _ bin.Decoder = &StarTransactionTypeAppStoreDeposit{} - _ bin.BareEncoder = &StarTransactionTypeAppStoreDeposit{} - _ bin.BareDecoder = &StarTransactionTypeAppStoreDeposit{} - - _ StarTransactionTypeClass = &StarTransactionTypeAppStoreDeposit{} -) - -func (s *StarTransactionTypeAppStoreDeposit) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeAppStoreDeposit) String() string { - if s == nil { - return "StarTransactionTypeAppStoreDeposit(nil)" - } - type Alias StarTransactionTypeAppStoreDeposit - return fmt.Sprintf("StarTransactionTypeAppStoreDeposit%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeAppStoreDeposit) TypeID() uint32 { - return StarTransactionTypeAppStoreDepositTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeAppStoreDeposit) TypeName() string { - return "starTransactionTypeAppStoreDeposit" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeAppStoreDeposit) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeAppStoreDeposit", - ID: StarTransactionTypeAppStoreDepositTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeAppStoreDeposit) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeAppStoreDeposit#8283941 as nil") - } - b.PutID(StarTransactionTypeAppStoreDepositTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeAppStoreDeposit) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeAppStoreDeposit#8283941 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeAppStoreDeposit) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeAppStoreDeposit#8283941 to nil") - } - if err := b.ConsumeID(StarTransactionTypeAppStoreDepositTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeAppStoreDeposit#8283941: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeAppStoreDeposit) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeAppStoreDeposit#8283941 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeAppStoreDeposit) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeAppStoreDeposit#8283941 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeAppStoreDeposit") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeAppStoreDeposit) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeAppStoreDeposit#8283941 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeAppStoreDeposit"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeAppStoreDeposit#8283941: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StarTransactionTypeGooglePlayDeposit represents TL type `starTransactionTypeGooglePlayDeposit#ecbdb656`. -type StarTransactionTypeGooglePlayDeposit struct { -} - -// StarTransactionTypeGooglePlayDepositTypeID is TL type id of StarTransactionTypeGooglePlayDeposit. -const StarTransactionTypeGooglePlayDepositTypeID = 0xecbdb656 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeGooglePlayDeposit) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeGooglePlayDeposit. -var ( - _ bin.Encoder = &StarTransactionTypeGooglePlayDeposit{} - _ bin.Decoder = &StarTransactionTypeGooglePlayDeposit{} - _ bin.BareEncoder = &StarTransactionTypeGooglePlayDeposit{} - _ bin.BareDecoder = &StarTransactionTypeGooglePlayDeposit{} - - _ StarTransactionTypeClass = &StarTransactionTypeGooglePlayDeposit{} -) - -func (s *StarTransactionTypeGooglePlayDeposit) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeGooglePlayDeposit) String() string { - if s == nil { - return "StarTransactionTypeGooglePlayDeposit(nil)" - } - type Alias StarTransactionTypeGooglePlayDeposit - return fmt.Sprintf("StarTransactionTypeGooglePlayDeposit%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeGooglePlayDeposit) TypeID() uint32 { - return StarTransactionTypeGooglePlayDepositTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeGooglePlayDeposit) TypeName() string { - return "starTransactionTypeGooglePlayDeposit" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeGooglePlayDeposit) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeGooglePlayDeposit", - ID: StarTransactionTypeGooglePlayDepositTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeGooglePlayDeposit) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGooglePlayDeposit#ecbdb656 as nil") - } - b.PutID(StarTransactionTypeGooglePlayDepositTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeGooglePlayDeposit) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGooglePlayDeposit#ecbdb656 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeGooglePlayDeposit) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGooglePlayDeposit#ecbdb656 to nil") - } - if err := b.ConsumeID(StarTransactionTypeGooglePlayDepositTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGooglePlayDeposit#ecbdb656: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeGooglePlayDeposit) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGooglePlayDeposit#ecbdb656 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeGooglePlayDeposit) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGooglePlayDeposit#ecbdb656 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeGooglePlayDeposit") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeGooglePlayDeposit) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGooglePlayDeposit#ecbdb656 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeGooglePlayDeposit"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGooglePlayDeposit#ecbdb656: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StarTransactionTypeFragmentDeposit represents TL type `starTransactionTypeFragmentDeposit#7625e44`. -type StarTransactionTypeFragmentDeposit struct { -} - -// StarTransactionTypeFragmentDepositTypeID is TL type id of StarTransactionTypeFragmentDeposit. -const StarTransactionTypeFragmentDepositTypeID = 0x7625e44 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeFragmentDeposit) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeFragmentDeposit. -var ( - _ bin.Encoder = &StarTransactionTypeFragmentDeposit{} - _ bin.Decoder = &StarTransactionTypeFragmentDeposit{} - _ bin.BareEncoder = &StarTransactionTypeFragmentDeposit{} - _ bin.BareDecoder = &StarTransactionTypeFragmentDeposit{} - - _ StarTransactionTypeClass = &StarTransactionTypeFragmentDeposit{} -) - -func (s *StarTransactionTypeFragmentDeposit) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeFragmentDeposit) String() string { - if s == nil { - return "StarTransactionTypeFragmentDeposit(nil)" - } - type Alias StarTransactionTypeFragmentDeposit - return fmt.Sprintf("StarTransactionTypeFragmentDeposit%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeFragmentDeposit) TypeID() uint32 { - return StarTransactionTypeFragmentDepositTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeFragmentDeposit) TypeName() string { - return "starTransactionTypeFragmentDeposit" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeFragmentDeposit) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeFragmentDeposit", - ID: StarTransactionTypeFragmentDepositTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeFragmentDeposit) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeFragmentDeposit#7625e44 as nil") - } - b.PutID(StarTransactionTypeFragmentDepositTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeFragmentDeposit) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeFragmentDeposit#7625e44 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeFragmentDeposit) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeFragmentDeposit#7625e44 to nil") - } - if err := b.ConsumeID(StarTransactionTypeFragmentDepositTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeFragmentDeposit#7625e44: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeFragmentDeposit) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeFragmentDeposit#7625e44 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeFragmentDeposit) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeFragmentDeposit#7625e44 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeFragmentDeposit") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeFragmentDeposit) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeFragmentDeposit#7625e44 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeFragmentDeposit"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeFragmentDeposit#7625e44: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StarTransactionTypeUserDeposit represents TL type `starTransactionTypeUserDeposit#c2a18e9`. -type StarTransactionTypeUserDeposit struct { - // Identifier of the user that gifted Telegram Stars; 0 if the user was anonymous - UserID int64 - // The sticker to be shown in the transaction information; may be null if unknown - Sticker Sticker -} - -// StarTransactionTypeUserDepositTypeID is TL type id of StarTransactionTypeUserDeposit. -const StarTransactionTypeUserDepositTypeID = 0xc2a18e9 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeUserDeposit) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeUserDeposit. -var ( - _ bin.Encoder = &StarTransactionTypeUserDeposit{} - _ bin.Decoder = &StarTransactionTypeUserDeposit{} - _ bin.BareEncoder = &StarTransactionTypeUserDeposit{} - _ bin.BareDecoder = &StarTransactionTypeUserDeposit{} - - _ StarTransactionTypeClass = &StarTransactionTypeUserDeposit{} -) - -func (s *StarTransactionTypeUserDeposit) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeUserDeposit) String() string { - if s == nil { - return "StarTransactionTypeUserDeposit(nil)" - } - type Alias StarTransactionTypeUserDeposit - return fmt.Sprintf("StarTransactionTypeUserDeposit%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeUserDeposit) TypeID() uint32 { - return StarTransactionTypeUserDepositTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeUserDeposit) TypeName() string { - return "starTransactionTypeUserDeposit" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeUserDeposit) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeUserDeposit", - ID: StarTransactionTypeUserDepositTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeUserDeposit) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeUserDeposit#c2a18e9 as nil") - } - b.PutID(StarTransactionTypeUserDepositTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeUserDeposit) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeUserDeposit#c2a18e9 as nil") - } - b.PutInt53(s.UserID) - if err := s.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeUserDeposit#c2a18e9: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeUserDeposit) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeUserDeposit#c2a18e9 to nil") - } - if err := b.ConsumeID(StarTransactionTypeUserDepositTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeUserDeposit#c2a18e9: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeUserDeposit) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeUserDeposit#c2a18e9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeUserDeposit#c2a18e9: field user_id: %w", err) - } - s.UserID = value - } - { - if err := s.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeUserDeposit#c2a18e9: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeUserDeposit) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeUserDeposit#c2a18e9 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeUserDeposit") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("sticker") - if err := s.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeUserDeposit#c2a18e9: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeUserDeposit) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeUserDeposit#c2a18e9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeUserDeposit"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeUserDeposit#c2a18e9: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeUserDeposit#c2a18e9: field user_id: %w", err) - } - s.UserID = value - case "sticker": - if err := s.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeUserDeposit#c2a18e9: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeUserDeposit) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetSticker returns value of Sticker field. -func (s *StarTransactionTypeUserDeposit) GetSticker() (value Sticker) { - if s == nil { - return - } - return s.Sticker -} - -// StarTransactionTypeGiveawayDeposit represents TL type `starTransactionTypeGiveawayDeposit#b16200c6`. -type StarTransactionTypeGiveawayDeposit struct { - // Identifier of a supergroup or a channel chat that created the giveaway - ChatID int64 - // Identifier of the message with the giveaway; can be 0 or an identifier of a deleted - // message - GiveawayMessageID int64 -} - -// StarTransactionTypeGiveawayDepositTypeID is TL type id of StarTransactionTypeGiveawayDeposit. -const StarTransactionTypeGiveawayDepositTypeID = 0xb16200c6 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeGiveawayDeposit) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeGiveawayDeposit. -var ( - _ bin.Encoder = &StarTransactionTypeGiveawayDeposit{} - _ bin.Decoder = &StarTransactionTypeGiveawayDeposit{} - _ bin.BareEncoder = &StarTransactionTypeGiveawayDeposit{} - _ bin.BareDecoder = &StarTransactionTypeGiveawayDeposit{} - - _ StarTransactionTypeClass = &StarTransactionTypeGiveawayDeposit{} -) - -func (s *StarTransactionTypeGiveawayDeposit) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.GiveawayMessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeGiveawayDeposit) String() string { - if s == nil { - return "StarTransactionTypeGiveawayDeposit(nil)" - } - type Alias StarTransactionTypeGiveawayDeposit - return fmt.Sprintf("StarTransactionTypeGiveawayDeposit%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeGiveawayDeposit) TypeID() uint32 { - return StarTransactionTypeGiveawayDepositTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeGiveawayDeposit) TypeName() string { - return "starTransactionTypeGiveawayDeposit" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeGiveawayDeposit) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeGiveawayDeposit", - ID: StarTransactionTypeGiveawayDepositTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "GiveawayMessageID", - SchemaName: "giveaway_message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeGiveawayDeposit) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiveawayDeposit#b16200c6 as nil") - } - b.PutID(StarTransactionTypeGiveawayDepositTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeGiveawayDeposit) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiveawayDeposit#b16200c6 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.GiveawayMessageID) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeGiveawayDeposit) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiveawayDeposit#b16200c6 to nil") - } - if err := b.ConsumeID(StarTransactionTypeGiveawayDepositTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiveawayDeposit#b16200c6: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeGiveawayDeposit) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiveawayDeposit#b16200c6 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiveawayDeposit#b16200c6: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiveawayDeposit#b16200c6: field giveaway_message_id: %w", err) - } - s.GiveawayMessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeGiveawayDeposit) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiveawayDeposit#b16200c6 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeGiveawayDeposit") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("giveaway_message_id") - b.PutInt53(s.GiveawayMessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeGiveawayDeposit) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiveawayDeposit#b16200c6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeGiveawayDeposit"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiveawayDeposit#b16200c6: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiveawayDeposit#b16200c6: field chat_id: %w", err) - } - s.ChatID = value - case "giveaway_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiveawayDeposit#b16200c6: field giveaway_message_id: %w", err) - } - s.GiveawayMessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *StarTransactionTypeGiveawayDeposit) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetGiveawayMessageID returns value of GiveawayMessageID field. -func (s *StarTransactionTypeGiveawayDeposit) GetGiveawayMessageID() (value int64) { - if s == nil { - return - } - return s.GiveawayMessageID -} - -// StarTransactionTypeFragmentWithdrawal represents TL type `starTransactionTypeFragmentWithdrawal#af3a2992`. -type StarTransactionTypeFragmentWithdrawal struct { - // State of the withdrawal; may be null for refunds from Fragment - WithdrawalState RevenueWithdrawalStateClass -} - -// StarTransactionTypeFragmentWithdrawalTypeID is TL type id of StarTransactionTypeFragmentWithdrawal. -const StarTransactionTypeFragmentWithdrawalTypeID = 0xaf3a2992 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeFragmentWithdrawal) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeFragmentWithdrawal. -var ( - _ bin.Encoder = &StarTransactionTypeFragmentWithdrawal{} - _ bin.Decoder = &StarTransactionTypeFragmentWithdrawal{} - _ bin.BareEncoder = &StarTransactionTypeFragmentWithdrawal{} - _ bin.BareDecoder = &StarTransactionTypeFragmentWithdrawal{} - - _ StarTransactionTypeClass = &StarTransactionTypeFragmentWithdrawal{} -) - -func (s *StarTransactionTypeFragmentWithdrawal) Zero() bool { - if s == nil { - return true - } - if !(s.WithdrawalState == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeFragmentWithdrawal) String() string { - if s == nil { - return "StarTransactionTypeFragmentWithdrawal(nil)" - } - type Alias StarTransactionTypeFragmentWithdrawal - return fmt.Sprintf("StarTransactionTypeFragmentWithdrawal%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeFragmentWithdrawal) TypeID() uint32 { - return StarTransactionTypeFragmentWithdrawalTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeFragmentWithdrawal) TypeName() string { - return "starTransactionTypeFragmentWithdrawal" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeFragmentWithdrawal) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeFragmentWithdrawal", - ID: StarTransactionTypeFragmentWithdrawalTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WithdrawalState", - SchemaName: "withdrawal_state", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeFragmentWithdrawal) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeFragmentWithdrawal#af3a2992 as nil") - } - b.PutID(StarTransactionTypeFragmentWithdrawalTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeFragmentWithdrawal) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeFragmentWithdrawal#af3a2992 as nil") - } - if s.WithdrawalState == nil { - return fmt.Errorf("unable to encode starTransactionTypeFragmentWithdrawal#af3a2992: field withdrawal_state is nil") - } - if err := s.WithdrawalState.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeFragmentWithdrawal#af3a2992: field withdrawal_state: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeFragmentWithdrawal) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeFragmentWithdrawal#af3a2992 to nil") - } - if err := b.ConsumeID(StarTransactionTypeFragmentWithdrawalTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeFragmentWithdrawal#af3a2992: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeFragmentWithdrawal) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeFragmentWithdrawal#af3a2992 to nil") - } - { - value, err := DecodeRevenueWithdrawalState(b) - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeFragmentWithdrawal#af3a2992: field withdrawal_state: %w", err) - } - s.WithdrawalState = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeFragmentWithdrawal) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeFragmentWithdrawal#af3a2992 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeFragmentWithdrawal") - b.Comma() - b.FieldStart("withdrawal_state") - if s.WithdrawalState == nil { - return fmt.Errorf("unable to encode starTransactionTypeFragmentWithdrawal#af3a2992: field withdrawal_state is nil") - } - if err := s.WithdrawalState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeFragmentWithdrawal#af3a2992: field withdrawal_state: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeFragmentWithdrawal) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeFragmentWithdrawal#af3a2992 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeFragmentWithdrawal"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeFragmentWithdrawal#af3a2992: %w", err) - } - case "withdrawal_state": - value, err := DecodeTDLibJSONRevenueWithdrawalState(b) - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeFragmentWithdrawal#af3a2992: field withdrawal_state: %w", err) - } - s.WithdrawalState = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWithdrawalState returns value of WithdrawalState field. -func (s *StarTransactionTypeFragmentWithdrawal) GetWithdrawalState() (value RevenueWithdrawalStateClass) { - if s == nil { - return - } - return s.WithdrawalState -} - -// StarTransactionTypeTelegramAdsWithdrawal represents TL type `starTransactionTypeTelegramAdsWithdrawal#a58e8469`. -type StarTransactionTypeTelegramAdsWithdrawal struct { -} - -// StarTransactionTypeTelegramAdsWithdrawalTypeID is TL type id of StarTransactionTypeTelegramAdsWithdrawal. -const StarTransactionTypeTelegramAdsWithdrawalTypeID = 0xa58e8469 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeTelegramAdsWithdrawal) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeTelegramAdsWithdrawal. -var ( - _ bin.Encoder = &StarTransactionTypeTelegramAdsWithdrawal{} - _ bin.Decoder = &StarTransactionTypeTelegramAdsWithdrawal{} - _ bin.BareEncoder = &StarTransactionTypeTelegramAdsWithdrawal{} - _ bin.BareDecoder = &StarTransactionTypeTelegramAdsWithdrawal{} - - _ StarTransactionTypeClass = &StarTransactionTypeTelegramAdsWithdrawal{} -) - -func (s *StarTransactionTypeTelegramAdsWithdrawal) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeTelegramAdsWithdrawal) String() string { - if s == nil { - return "StarTransactionTypeTelegramAdsWithdrawal(nil)" - } - type Alias StarTransactionTypeTelegramAdsWithdrawal - return fmt.Sprintf("StarTransactionTypeTelegramAdsWithdrawal%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeTelegramAdsWithdrawal) TypeID() uint32 { - return StarTransactionTypeTelegramAdsWithdrawalTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeTelegramAdsWithdrawal) TypeName() string { - return "starTransactionTypeTelegramAdsWithdrawal" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeTelegramAdsWithdrawal) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeTelegramAdsWithdrawal", - ID: StarTransactionTypeTelegramAdsWithdrawalTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeTelegramAdsWithdrawal) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeTelegramAdsWithdrawal#a58e8469 as nil") - } - b.PutID(StarTransactionTypeTelegramAdsWithdrawalTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeTelegramAdsWithdrawal) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeTelegramAdsWithdrawal#a58e8469 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeTelegramAdsWithdrawal) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeTelegramAdsWithdrawal#a58e8469 to nil") - } - if err := b.ConsumeID(StarTransactionTypeTelegramAdsWithdrawalTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeTelegramAdsWithdrawal#a58e8469: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeTelegramAdsWithdrawal) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeTelegramAdsWithdrawal#a58e8469 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeTelegramAdsWithdrawal) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeTelegramAdsWithdrawal#a58e8469 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeTelegramAdsWithdrawal") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeTelegramAdsWithdrawal) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeTelegramAdsWithdrawal#a58e8469 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeTelegramAdsWithdrawal"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeTelegramAdsWithdrawal#a58e8469: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StarTransactionTypeTelegramAPIUsage represents TL type `starTransactionTypeTelegramApiUsage#27a82afe`. -type StarTransactionTypeTelegramAPIUsage struct { - // The number of billed requests - RequestCount int32 -} - -// StarTransactionTypeTelegramAPIUsageTypeID is TL type id of StarTransactionTypeTelegramAPIUsage. -const StarTransactionTypeTelegramAPIUsageTypeID = 0x27a82afe - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeTelegramAPIUsage) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeTelegramAPIUsage. -var ( - _ bin.Encoder = &StarTransactionTypeTelegramAPIUsage{} - _ bin.Decoder = &StarTransactionTypeTelegramAPIUsage{} - _ bin.BareEncoder = &StarTransactionTypeTelegramAPIUsage{} - _ bin.BareDecoder = &StarTransactionTypeTelegramAPIUsage{} - - _ StarTransactionTypeClass = &StarTransactionTypeTelegramAPIUsage{} -) - -func (s *StarTransactionTypeTelegramAPIUsage) Zero() bool { - if s == nil { - return true - } - if !(s.RequestCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeTelegramAPIUsage) String() string { - if s == nil { - return "StarTransactionTypeTelegramAPIUsage(nil)" - } - type Alias StarTransactionTypeTelegramAPIUsage - return fmt.Sprintf("StarTransactionTypeTelegramAPIUsage%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeTelegramAPIUsage) TypeID() uint32 { - return StarTransactionTypeTelegramAPIUsageTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeTelegramAPIUsage) TypeName() string { - return "starTransactionTypeTelegramApiUsage" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeTelegramAPIUsage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeTelegramApiUsage", - ID: StarTransactionTypeTelegramAPIUsageTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "RequestCount", - SchemaName: "request_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeTelegramAPIUsage) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeTelegramApiUsage#27a82afe as nil") - } - b.PutID(StarTransactionTypeTelegramAPIUsageTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeTelegramAPIUsage) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeTelegramApiUsage#27a82afe as nil") - } - b.PutInt32(s.RequestCount) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeTelegramAPIUsage) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeTelegramApiUsage#27a82afe to nil") - } - if err := b.ConsumeID(StarTransactionTypeTelegramAPIUsageTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeTelegramApiUsage#27a82afe: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeTelegramAPIUsage) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeTelegramApiUsage#27a82afe to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeTelegramApiUsage#27a82afe: field request_count: %w", err) - } - s.RequestCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeTelegramAPIUsage) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeTelegramApiUsage#27a82afe as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeTelegramApiUsage") - b.Comma() - b.FieldStart("request_count") - b.PutInt32(s.RequestCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeTelegramAPIUsage) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeTelegramApiUsage#27a82afe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeTelegramApiUsage"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeTelegramApiUsage#27a82afe: %w", err) - } - case "request_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeTelegramApiUsage#27a82afe: field request_count: %w", err) - } - s.RequestCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetRequestCount returns value of RequestCount field. -func (s *StarTransactionTypeTelegramAPIUsage) GetRequestCount() (value int32) { - if s == nil { - return - } - return s.RequestCount -} - -// StarTransactionTypeBotPaidMediaPurchase represents TL type `starTransactionTypeBotPaidMediaPurchase#7f48cc6a`. -type StarTransactionTypeBotPaidMediaPurchase struct { - // Identifier of the bot or the business account user that sent the paid media - UserID int64 - // The bought media if the transaction wasn't refunded - Media []PaidMediaClass -} - -// StarTransactionTypeBotPaidMediaPurchaseTypeID is TL type id of StarTransactionTypeBotPaidMediaPurchase. -const StarTransactionTypeBotPaidMediaPurchaseTypeID = 0x7f48cc6a - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeBotPaidMediaPurchase) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeBotPaidMediaPurchase. -var ( - _ bin.Encoder = &StarTransactionTypeBotPaidMediaPurchase{} - _ bin.Decoder = &StarTransactionTypeBotPaidMediaPurchase{} - _ bin.BareEncoder = &StarTransactionTypeBotPaidMediaPurchase{} - _ bin.BareDecoder = &StarTransactionTypeBotPaidMediaPurchase{} - - _ StarTransactionTypeClass = &StarTransactionTypeBotPaidMediaPurchase{} -) - -func (s *StarTransactionTypeBotPaidMediaPurchase) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Media == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeBotPaidMediaPurchase) String() string { - if s == nil { - return "StarTransactionTypeBotPaidMediaPurchase(nil)" - } - type Alias StarTransactionTypeBotPaidMediaPurchase - return fmt.Sprintf("StarTransactionTypeBotPaidMediaPurchase%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeBotPaidMediaPurchase) TypeID() uint32 { - return StarTransactionTypeBotPaidMediaPurchaseTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeBotPaidMediaPurchase) TypeName() string { - return "starTransactionTypeBotPaidMediaPurchase" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeBotPaidMediaPurchase) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeBotPaidMediaPurchase", - ID: StarTransactionTypeBotPaidMediaPurchaseTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Media", - SchemaName: "media", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeBotPaidMediaPurchase) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotPaidMediaPurchase#7f48cc6a as nil") - } - b.PutID(StarTransactionTypeBotPaidMediaPurchaseTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeBotPaidMediaPurchase) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotPaidMediaPurchase#7f48cc6a as nil") - } - b.PutInt53(s.UserID) - b.PutInt(len(s.Media)) - for idx, v := range s.Media { - if v == nil { - return fmt.Errorf("unable to encode starTransactionTypeBotPaidMediaPurchase#7f48cc6a: field media element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare starTransactionTypeBotPaidMediaPurchase#7f48cc6a: field media element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeBotPaidMediaPurchase) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotPaidMediaPurchase#7f48cc6a to nil") - } - if err := b.ConsumeID(StarTransactionTypeBotPaidMediaPurchaseTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaPurchase#7f48cc6a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeBotPaidMediaPurchase) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotPaidMediaPurchase#7f48cc6a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaPurchase#7f48cc6a: field user_id: %w", err) - } - s.UserID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaPurchase#7f48cc6a: field media: %w", err) - } - - if headerLen > 0 { - s.Media = make([]PaidMediaClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaPurchase#7f48cc6a: field media: %w", err) - } - s.Media = append(s.Media, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeBotPaidMediaPurchase) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotPaidMediaPurchase#7f48cc6a as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeBotPaidMediaPurchase") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("media") - b.ArrStart() - for idx, v := range s.Media { - if v == nil { - return fmt.Errorf("unable to encode starTransactionTypeBotPaidMediaPurchase#7f48cc6a: field media element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotPaidMediaPurchase#7f48cc6a: field media element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeBotPaidMediaPurchase) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotPaidMediaPurchase#7f48cc6a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeBotPaidMediaPurchase"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaPurchase#7f48cc6a: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaPurchase#7f48cc6a: field user_id: %w", err) - } - s.UserID = value - case "media": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaPurchase#7f48cc6a: field media: %w", err) - } - s.Media = append(s.Media, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaPurchase#7f48cc6a: field media: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeBotPaidMediaPurchase) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetMedia returns value of Media field. -func (s *StarTransactionTypeBotPaidMediaPurchase) GetMedia() (value []PaidMediaClass) { - if s == nil { - return - } - return s.Media -} - -// StarTransactionTypeBotPaidMediaSale represents TL type `starTransactionTypeBotPaidMediaSale#6e07eeb2`. -type StarTransactionTypeBotPaidMediaSale struct { - // Identifier of the user that bought the media - UserID int64 - // The bought media - Media []PaidMediaClass - // Bot-provided payload - Payload string - // Information about the affiliate which received commission from the transaction; may be - // null if none - Affiliate AffiliateInfo -} - -// StarTransactionTypeBotPaidMediaSaleTypeID is TL type id of StarTransactionTypeBotPaidMediaSale. -const StarTransactionTypeBotPaidMediaSaleTypeID = 0x6e07eeb2 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeBotPaidMediaSale) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeBotPaidMediaSale. -var ( - _ bin.Encoder = &StarTransactionTypeBotPaidMediaSale{} - _ bin.Decoder = &StarTransactionTypeBotPaidMediaSale{} - _ bin.BareEncoder = &StarTransactionTypeBotPaidMediaSale{} - _ bin.BareDecoder = &StarTransactionTypeBotPaidMediaSale{} - - _ StarTransactionTypeClass = &StarTransactionTypeBotPaidMediaSale{} -) - -func (s *StarTransactionTypeBotPaidMediaSale) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Media == nil) { - return false - } - if !(s.Payload == "") { - return false - } - if !(s.Affiliate.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeBotPaidMediaSale) String() string { - if s == nil { - return "StarTransactionTypeBotPaidMediaSale(nil)" - } - type Alias StarTransactionTypeBotPaidMediaSale - return fmt.Sprintf("StarTransactionTypeBotPaidMediaSale%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeBotPaidMediaSale) TypeID() uint32 { - return StarTransactionTypeBotPaidMediaSaleTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeBotPaidMediaSale) TypeName() string { - return "starTransactionTypeBotPaidMediaSale" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeBotPaidMediaSale) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeBotPaidMediaSale", - ID: StarTransactionTypeBotPaidMediaSaleTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Media", - SchemaName: "media", - }, - { - Name: "Payload", - SchemaName: "payload", - }, - { - Name: "Affiliate", - SchemaName: "affiliate", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeBotPaidMediaSale) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotPaidMediaSale#6e07eeb2 as nil") - } - b.PutID(StarTransactionTypeBotPaidMediaSaleTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeBotPaidMediaSale) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotPaidMediaSale#6e07eeb2 as nil") - } - b.PutInt53(s.UserID) - b.PutInt(len(s.Media)) - for idx, v := range s.Media { - if v == nil { - return fmt.Errorf("unable to encode starTransactionTypeBotPaidMediaSale#6e07eeb2: field media element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare starTransactionTypeBotPaidMediaSale#6e07eeb2: field media element with index %d: %w", idx, err) - } - } - b.PutString(s.Payload) - if err := s.Affiliate.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotPaidMediaSale#6e07eeb2: field affiliate: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeBotPaidMediaSale) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotPaidMediaSale#6e07eeb2 to nil") - } - if err := b.ConsumeID(StarTransactionTypeBotPaidMediaSaleTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeBotPaidMediaSale) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotPaidMediaSale#6e07eeb2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: field user_id: %w", err) - } - s.UserID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: field media: %w", err) - } - - if headerLen > 0 { - s.Media = make([]PaidMediaClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: field media: %w", err) - } - s.Media = append(s.Media, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: field payload: %w", err) - } - s.Payload = value - } - { - if err := s.Affiliate.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: field affiliate: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeBotPaidMediaSale) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotPaidMediaSale#6e07eeb2 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeBotPaidMediaSale") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("media") - b.ArrStart() - for idx, v := range s.Media { - if v == nil { - return fmt.Errorf("unable to encode starTransactionTypeBotPaidMediaSale#6e07eeb2: field media element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotPaidMediaSale#6e07eeb2: field media element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("payload") - b.PutString(s.Payload) - b.Comma() - b.FieldStart("affiliate") - if err := s.Affiliate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotPaidMediaSale#6e07eeb2: field affiliate: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeBotPaidMediaSale) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotPaidMediaSale#6e07eeb2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeBotPaidMediaSale"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: field user_id: %w", err) - } - s.UserID = value - case "media": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: field media: %w", err) - } - s.Media = append(s.Media, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: field media: %w", err) - } - case "payload": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: field payload: %w", err) - } - s.Payload = value - case "affiliate": - if err := s.Affiliate.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotPaidMediaSale#6e07eeb2: field affiliate: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeBotPaidMediaSale) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetMedia returns value of Media field. -func (s *StarTransactionTypeBotPaidMediaSale) GetMedia() (value []PaidMediaClass) { - if s == nil { - return - } - return s.Media -} - -// GetPayload returns value of Payload field. -func (s *StarTransactionTypeBotPaidMediaSale) GetPayload() (value string) { - if s == nil { - return - } - return s.Payload -} - -// GetAffiliate returns value of Affiliate field. -func (s *StarTransactionTypeBotPaidMediaSale) GetAffiliate() (value AffiliateInfo) { - if s == nil { - return - } - return s.Affiliate -} - -// StarTransactionTypeChannelPaidMediaPurchase represents TL type `starTransactionTypeChannelPaidMediaPurchase#9016d4f5`. -type StarTransactionTypeChannelPaidMediaPurchase struct { - // Identifier of the channel chat that sent the paid media - ChatID int64 - // Identifier of the corresponding message with paid media; can be 0 or an identifier of - // a deleted message - MessageID int64 - // The bought media if the transaction wasn't refunded - Media []PaidMediaClass -} - -// StarTransactionTypeChannelPaidMediaPurchaseTypeID is TL type id of StarTransactionTypeChannelPaidMediaPurchase. -const StarTransactionTypeChannelPaidMediaPurchaseTypeID = 0x9016d4f5 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeChannelPaidMediaPurchase) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeChannelPaidMediaPurchase. -var ( - _ bin.Encoder = &StarTransactionTypeChannelPaidMediaPurchase{} - _ bin.Decoder = &StarTransactionTypeChannelPaidMediaPurchase{} - _ bin.BareEncoder = &StarTransactionTypeChannelPaidMediaPurchase{} - _ bin.BareDecoder = &StarTransactionTypeChannelPaidMediaPurchase{} - - _ StarTransactionTypeClass = &StarTransactionTypeChannelPaidMediaPurchase{} -) - -func (s *StarTransactionTypeChannelPaidMediaPurchase) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - if !(s.Media == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeChannelPaidMediaPurchase) String() string { - if s == nil { - return "StarTransactionTypeChannelPaidMediaPurchase(nil)" - } - type Alias StarTransactionTypeChannelPaidMediaPurchase - return fmt.Sprintf("StarTransactionTypeChannelPaidMediaPurchase%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeChannelPaidMediaPurchase) TypeID() uint32 { - return StarTransactionTypeChannelPaidMediaPurchaseTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeChannelPaidMediaPurchase) TypeName() string { - return "starTransactionTypeChannelPaidMediaPurchase" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeChannelPaidMediaPurchase) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeChannelPaidMediaPurchase", - ID: StarTransactionTypeChannelPaidMediaPurchaseTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Media", - SchemaName: "media", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeChannelPaidMediaPurchase) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidMediaPurchase#9016d4f5 as nil") - } - b.PutID(StarTransactionTypeChannelPaidMediaPurchaseTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeChannelPaidMediaPurchase) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidMediaPurchase#9016d4f5 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - b.PutInt(len(s.Media)) - for idx, v := range s.Media { - if v == nil { - return fmt.Errorf("unable to encode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field media element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field media element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeChannelPaidMediaPurchase) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5 to nil") - } - if err := b.ConsumeID(StarTransactionTypeChannelPaidMediaPurchaseTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeChannelPaidMediaPurchase) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field message_id: %w", err) - } - s.MessageID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field media: %w", err) - } - - if headerLen > 0 { - s.Media = make([]PaidMediaClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field media: %w", err) - } - s.Media = append(s.Media, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeChannelPaidMediaPurchase) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidMediaPurchase#9016d4f5 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeChannelPaidMediaPurchase") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("media") - b.ArrStart() - for idx, v := range s.Media { - if v == nil { - return fmt.Errorf("unable to encode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field media element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field media element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeChannelPaidMediaPurchase) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeChannelPaidMediaPurchase"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field message_id: %w", err) - } - s.MessageID = value - case "media": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field media: %w", err) - } - s.Media = append(s.Media, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaPurchase#9016d4f5: field media: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *StarTransactionTypeChannelPaidMediaPurchase) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *StarTransactionTypeChannelPaidMediaPurchase) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetMedia returns value of Media field. -func (s *StarTransactionTypeChannelPaidMediaPurchase) GetMedia() (value []PaidMediaClass) { - if s == nil { - return - } - return s.Media -} - -// StarTransactionTypeChannelPaidMediaSale represents TL type `starTransactionTypeChannelPaidMediaSale#eace92ef`. -type StarTransactionTypeChannelPaidMediaSale struct { - // Identifier of the user that bought the media - UserID int64 - // Identifier of the corresponding message with paid media; can be 0 or an identifier of - // a deleted message - MessageID int64 - // The bought media - Media []PaidMediaClass -} - -// StarTransactionTypeChannelPaidMediaSaleTypeID is TL type id of StarTransactionTypeChannelPaidMediaSale. -const StarTransactionTypeChannelPaidMediaSaleTypeID = 0xeace92ef - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeChannelPaidMediaSale) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeChannelPaidMediaSale. -var ( - _ bin.Encoder = &StarTransactionTypeChannelPaidMediaSale{} - _ bin.Decoder = &StarTransactionTypeChannelPaidMediaSale{} - _ bin.BareEncoder = &StarTransactionTypeChannelPaidMediaSale{} - _ bin.BareDecoder = &StarTransactionTypeChannelPaidMediaSale{} - - _ StarTransactionTypeClass = &StarTransactionTypeChannelPaidMediaSale{} -) - -func (s *StarTransactionTypeChannelPaidMediaSale) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - if !(s.Media == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeChannelPaidMediaSale) String() string { - if s == nil { - return "StarTransactionTypeChannelPaidMediaSale(nil)" - } - type Alias StarTransactionTypeChannelPaidMediaSale - return fmt.Sprintf("StarTransactionTypeChannelPaidMediaSale%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeChannelPaidMediaSale) TypeID() uint32 { - return StarTransactionTypeChannelPaidMediaSaleTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeChannelPaidMediaSale) TypeName() string { - return "starTransactionTypeChannelPaidMediaSale" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeChannelPaidMediaSale) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeChannelPaidMediaSale", - ID: StarTransactionTypeChannelPaidMediaSaleTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Media", - SchemaName: "media", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeChannelPaidMediaSale) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidMediaSale#eace92ef as nil") - } - b.PutID(StarTransactionTypeChannelPaidMediaSaleTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeChannelPaidMediaSale) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidMediaSale#eace92ef as nil") - } - b.PutInt53(s.UserID) - b.PutInt53(s.MessageID) - b.PutInt(len(s.Media)) - for idx, v := range s.Media { - if v == nil { - return fmt.Errorf("unable to encode starTransactionTypeChannelPaidMediaSale#eace92ef: field media element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare starTransactionTypeChannelPaidMediaSale#eace92ef: field media element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeChannelPaidMediaSale) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidMediaSale#eace92ef to nil") - } - if err := b.ConsumeID(StarTransactionTypeChannelPaidMediaSaleTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaSale#eace92ef: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeChannelPaidMediaSale) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidMediaSale#eace92ef to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaSale#eace92ef: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaSale#eace92ef: field message_id: %w", err) - } - s.MessageID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaSale#eace92ef: field media: %w", err) - } - - if headerLen > 0 { - s.Media = make([]PaidMediaClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaSale#eace92ef: field media: %w", err) - } - s.Media = append(s.Media, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeChannelPaidMediaSale) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidMediaSale#eace92ef as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeChannelPaidMediaSale") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("media") - b.ArrStart() - for idx, v := range s.Media { - if v == nil { - return fmt.Errorf("unable to encode starTransactionTypeChannelPaidMediaSale#eace92ef: field media element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeChannelPaidMediaSale#eace92ef: field media element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeChannelPaidMediaSale) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidMediaSale#eace92ef to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeChannelPaidMediaSale"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaSale#eace92ef: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaSale#eace92ef: field user_id: %w", err) - } - s.UserID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaSale#eace92ef: field message_id: %w", err) - } - s.MessageID = value - case "media": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPaidMedia(b) - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaSale#eace92ef: field media: %w", err) - } - s.Media = append(s.Media, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidMediaSale#eace92ef: field media: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeChannelPaidMediaSale) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetMessageID returns value of MessageID field. -func (s *StarTransactionTypeChannelPaidMediaSale) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetMedia returns value of Media field. -func (s *StarTransactionTypeChannelPaidMediaSale) GetMedia() (value []PaidMediaClass) { - if s == nil { - return - } - return s.Media -} - -// StarTransactionTypeBotInvoicePurchase represents TL type `starTransactionTypeBotInvoicePurchase#1dddac0c`. -type StarTransactionTypeBotInvoicePurchase struct { - // Identifier of the bot or the business account user that created the invoice - UserID int64 - // Information about the bought product - ProductInfo ProductInfo -} - -// StarTransactionTypeBotInvoicePurchaseTypeID is TL type id of StarTransactionTypeBotInvoicePurchase. -const StarTransactionTypeBotInvoicePurchaseTypeID = 0x1dddac0c - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeBotInvoicePurchase) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeBotInvoicePurchase. -var ( - _ bin.Encoder = &StarTransactionTypeBotInvoicePurchase{} - _ bin.Decoder = &StarTransactionTypeBotInvoicePurchase{} - _ bin.BareEncoder = &StarTransactionTypeBotInvoicePurchase{} - _ bin.BareDecoder = &StarTransactionTypeBotInvoicePurchase{} - - _ StarTransactionTypeClass = &StarTransactionTypeBotInvoicePurchase{} -) - -func (s *StarTransactionTypeBotInvoicePurchase) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.ProductInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeBotInvoicePurchase) String() string { - if s == nil { - return "StarTransactionTypeBotInvoicePurchase(nil)" - } - type Alias StarTransactionTypeBotInvoicePurchase - return fmt.Sprintf("StarTransactionTypeBotInvoicePurchase%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeBotInvoicePurchase) TypeID() uint32 { - return StarTransactionTypeBotInvoicePurchaseTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeBotInvoicePurchase) TypeName() string { - return "starTransactionTypeBotInvoicePurchase" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeBotInvoicePurchase) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeBotInvoicePurchase", - ID: StarTransactionTypeBotInvoicePurchaseTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "ProductInfo", - SchemaName: "product_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeBotInvoicePurchase) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotInvoicePurchase#1dddac0c as nil") - } - b.PutID(StarTransactionTypeBotInvoicePurchaseTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeBotInvoicePurchase) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotInvoicePurchase#1dddac0c as nil") - } - b.PutInt53(s.UserID) - if err := s.ProductInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotInvoicePurchase#1dddac0c: field product_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeBotInvoicePurchase) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotInvoicePurchase#1dddac0c to nil") - } - if err := b.ConsumeID(StarTransactionTypeBotInvoicePurchaseTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoicePurchase#1dddac0c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeBotInvoicePurchase) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotInvoicePurchase#1dddac0c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoicePurchase#1dddac0c: field user_id: %w", err) - } - s.UserID = value - } - { - if err := s.ProductInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoicePurchase#1dddac0c: field product_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeBotInvoicePurchase) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotInvoicePurchase#1dddac0c as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeBotInvoicePurchase") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("product_info") - if err := s.ProductInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotInvoicePurchase#1dddac0c: field product_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeBotInvoicePurchase) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotInvoicePurchase#1dddac0c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeBotInvoicePurchase"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoicePurchase#1dddac0c: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoicePurchase#1dddac0c: field user_id: %w", err) - } - s.UserID = value - case "product_info": - if err := s.ProductInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoicePurchase#1dddac0c: field product_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeBotInvoicePurchase) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetProductInfo returns value of ProductInfo field. -func (s *StarTransactionTypeBotInvoicePurchase) GetProductInfo() (value ProductInfo) { - if s == nil { - return - } - return s.ProductInfo -} - -// StarTransactionTypeBotInvoiceSale represents TL type `starTransactionTypeBotInvoiceSale#5b7d8d2f`. -type StarTransactionTypeBotInvoiceSale struct { - // Identifier of the user that bought the product - UserID int64 - // Information about the bought product - ProductInfo ProductInfo - // Invoice payload - InvoicePayload []byte - // Information about the affiliate which received commission from the transaction; may be - // null if none - Affiliate AffiliateInfo -} - -// StarTransactionTypeBotInvoiceSaleTypeID is TL type id of StarTransactionTypeBotInvoiceSale. -const StarTransactionTypeBotInvoiceSaleTypeID = 0x5b7d8d2f - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeBotInvoiceSale) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeBotInvoiceSale. -var ( - _ bin.Encoder = &StarTransactionTypeBotInvoiceSale{} - _ bin.Decoder = &StarTransactionTypeBotInvoiceSale{} - _ bin.BareEncoder = &StarTransactionTypeBotInvoiceSale{} - _ bin.BareDecoder = &StarTransactionTypeBotInvoiceSale{} - - _ StarTransactionTypeClass = &StarTransactionTypeBotInvoiceSale{} -) - -func (s *StarTransactionTypeBotInvoiceSale) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.ProductInfo.Zero()) { - return false - } - if !(s.InvoicePayload == nil) { - return false - } - if !(s.Affiliate.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeBotInvoiceSale) String() string { - if s == nil { - return "StarTransactionTypeBotInvoiceSale(nil)" - } - type Alias StarTransactionTypeBotInvoiceSale - return fmt.Sprintf("StarTransactionTypeBotInvoiceSale%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeBotInvoiceSale) TypeID() uint32 { - return StarTransactionTypeBotInvoiceSaleTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeBotInvoiceSale) TypeName() string { - return "starTransactionTypeBotInvoiceSale" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeBotInvoiceSale) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeBotInvoiceSale", - ID: StarTransactionTypeBotInvoiceSaleTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "ProductInfo", - SchemaName: "product_info", - }, - { - Name: "InvoicePayload", - SchemaName: "invoice_payload", - }, - { - Name: "Affiliate", - SchemaName: "affiliate", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeBotInvoiceSale) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotInvoiceSale#5b7d8d2f as nil") - } - b.PutID(StarTransactionTypeBotInvoiceSaleTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeBotInvoiceSale) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotInvoiceSale#5b7d8d2f as nil") - } - b.PutInt53(s.UserID) - if err := s.ProductInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotInvoiceSale#5b7d8d2f: field product_info: %w", err) - } - b.PutBytes(s.InvoicePayload) - if err := s.Affiliate.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotInvoiceSale#5b7d8d2f: field affiliate: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeBotInvoiceSale) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotInvoiceSale#5b7d8d2f to nil") - } - if err := b.ConsumeID(StarTransactionTypeBotInvoiceSaleTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoiceSale#5b7d8d2f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeBotInvoiceSale) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotInvoiceSale#5b7d8d2f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoiceSale#5b7d8d2f: field user_id: %w", err) - } - s.UserID = value - } - { - if err := s.ProductInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoiceSale#5b7d8d2f: field product_info: %w", err) - } - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoiceSale#5b7d8d2f: field invoice_payload: %w", err) - } - s.InvoicePayload = value - } - { - if err := s.Affiliate.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoiceSale#5b7d8d2f: field affiliate: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeBotInvoiceSale) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotInvoiceSale#5b7d8d2f as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeBotInvoiceSale") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("product_info") - if err := s.ProductInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotInvoiceSale#5b7d8d2f: field product_info: %w", err) - } - b.Comma() - b.FieldStart("invoice_payload") - b.PutBytes(s.InvoicePayload) - b.Comma() - b.FieldStart("affiliate") - if err := s.Affiliate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotInvoiceSale#5b7d8d2f: field affiliate: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeBotInvoiceSale) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotInvoiceSale#5b7d8d2f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeBotInvoiceSale"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoiceSale#5b7d8d2f: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoiceSale#5b7d8d2f: field user_id: %w", err) - } - s.UserID = value - case "product_info": - if err := s.ProductInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoiceSale#5b7d8d2f: field product_info: %w", err) - } - case "invoice_payload": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoiceSale#5b7d8d2f: field invoice_payload: %w", err) - } - s.InvoicePayload = value - case "affiliate": - if err := s.Affiliate.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotInvoiceSale#5b7d8d2f: field affiliate: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeBotInvoiceSale) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetProductInfo returns value of ProductInfo field. -func (s *StarTransactionTypeBotInvoiceSale) GetProductInfo() (value ProductInfo) { - if s == nil { - return - } - return s.ProductInfo -} - -// GetInvoicePayload returns value of InvoicePayload field. -func (s *StarTransactionTypeBotInvoiceSale) GetInvoicePayload() (value []byte) { - if s == nil { - return - } - return s.InvoicePayload -} - -// GetAffiliate returns value of Affiliate field. -func (s *StarTransactionTypeBotInvoiceSale) GetAffiliate() (value AffiliateInfo) { - if s == nil { - return - } - return s.Affiliate -} - -// StarTransactionTypeBotSubscriptionPurchase represents TL type `starTransactionTypeBotSubscriptionPurchase#40bf1355`. -type StarTransactionTypeBotSubscriptionPurchase struct { - // Identifier of the bot or the business account user that created the subscription link - UserID int64 - // The number of seconds between consecutive Telegram Star debitings - SubscriptionPeriod int32 - // Information about the bought subscription - ProductInfo ProductInfo -} - -// StarTransactionTypeBotSubscriptionPurchaseTypeID is TL type id of StarTransactionTypeBotSubscriptionPurchase. -const StarTransactionTypeBotSubscriptionPurchaseTypeID = 0x40bf1355 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeBotSubscriptionPurchase) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeBotSubscriptionPurchase. -var ( - _ bin.Encoder = &StarTransactionTypeBotSubscriptionPurchase{} - _ bin.Decoder = &StarTransactionTypeBotSubscriptionPurchase{} - _ bin.BareEncoder = &StarTransactionTypeBotSubscriptionPurchase{} - _ bin.BareDecoder = &StarTransactionTypeBotSubscriptionPurchase{} - - _ StarTransactionTypeClass = &StarTransactionTypeBotSubscriptionPurchase{} -) - -func (s *StarTransactionTypeBotSubscriptionPurchase) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.SubscriptionPeriod == 0) { - return false - } - if !(s.ProductInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeBotSubscriptionPurchase) String() string { - if s == nil { - return "StarTransactionTypeBotSubscriptionPurchase(nil)" - } - type Alias StarTransactionTypeBotSubscriptionPurchase - return fmt.Sprintf("StarTransactionTypeBotSubscriptionPurchase%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeBotSubscriptionPurchase) TypeID() uint32 { - return StarTransactionTypeBotSubscriptionPurchaseTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeBotSubscriptionPurchase) TypeName() string { - return "starTransactionTypeBotSubscriptionPurchase" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeBotSubscriptionPurchase) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeBotSubscriptionPurchase", - ID: StarTransactionTypeBotSubscriptionPurchaseTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "SubscriptionPeriod", - SchemaName: "subscription_period", - }, - { - Name: "ProductInfo", - SchemaName: "product_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeBotSubscriptionPurchase) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotSubscriptionPurchase#40bf1355 as nil") - } - b.PutID(StarTransactionTypeBotSubscriptionPurchaseTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeBotSubscriptionPurchase) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotSubscriptionPurchase#40bf1355 as nil") - } - b.PutInt53(s.UserID) - b.PutInt32(s.SubscriptionPeriod) - if err := s.ProductInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotSubscriptionPurchase#40bf1355: field product_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeBotSubscriptionPurchase) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotSubscriptionPurchase#40bf1355 to nil") - } - if err := b.ConsumeID(StarTransactionTypeBotSubscriptionPurchaseTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionPurchase#40bf1355: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeBotSubscriptionPurchase) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotSubscriptionPurchase#40bf1355 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionPurchase#40bf1355: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionPurchase#40bf1355: field subscription_period: %w", err) - } - s.SubscriptionPeriod = value - } - { - if err := s.ProductInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionPurchase#40bf1355: field product_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeBotSubscriptionPurchase) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotSubscriptionPurchase#40bf1355 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeBotSubscriptionPurchase") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("subscription_period") - b.PutInt32(s.SubscriptionPeriod) - b.Comma() - b.FieldStart("product_info") - if err := s.ProductInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotSubscriptionPurchase#40bf1355: field product_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeBotSubscriptionPurchase) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotSubscriptionPurchase#40bf1355 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeBotSubscriptionPurchase"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionPurchase#40bf1355: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionPurchase#40bf1355: field user_id: %w", err) - } - s.UserID = value - case "subscription_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionPurchase#40bf1355: field subscription_period: %w", err) - } - s.SubscriptionPeriod = value - case "product_info": - if err := s.ProductInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionPurchase#40bf1355: field product_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeBotSubscriptionPurchase) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetSubscriptionPeriod returns value of SubscriptionPeriod field. -func (s *StarTransactionTypeBotSubscriptionPurchase) GetSubscriptionPeriod() (value int32) { - if s == nil { - return - } - return s.SubscriptionPeriod -} - -// GetProductInfo returns value of ProductInfo field. -func (s *StarTransactionTypeBotSubscriptionPurchase) GetProductInfo() (value ProductInfo) { - if s == nil { - return - } - return s.ProductInfo -} - -// StarTransactionTypeBotSubscriptionSale represents TL type `starTransactionTypeBotSubscriptionSale#1f686889`. -type StarTransactionTypeBotSubscriptionSale struct { - // Identifier of the user that bought the subscription - UserID int64 - // The number of seconds between consecutive Telegram Star debitings - SubscriptionPeriod int32 - // Information about the bought subscription - ProductInfo ProductInfo - // Invoice payload - InvoicePayload []byte - // Information about the affiliate which received commission from the transaction; may be - // null if none - Affiliate AffiliateInfo -} - -// StarTransactionTypeBotSubscriptionSaleTypeID is TL type id of StarTransactionTypeBotSubscriptionSale. -const StarTransactionTypeBotSubscriptionSaleTypeID = 0x1f686889 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeBotSubscriptionSale) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeBotSubscriptionSale. -var ( - _ bin.Encoder = &StarTransactionTypeBotSubscriptionSale{} - _ bin.Decoder = &StarTransactionTypeBotSubscriptionSale{} - _ bin.BareEncoder = &StarTransactionTypeBotSubscriptionSale{} - _ bin.BareDecoder = &StarTransactionTypeBotSubscriptionSale{} - - _ StarTransactionTypeClass = &StarTransactionTypeBotSubscriptionSale{} -) - -func (s *StarTransactionTypeBotSubscriptionSale) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.SubscriptionPeriod == 0) { - return false - } - if !(s.ProductInfo.Zero()) { - return false - } - if !(s.InvoicePayload == nil) { - return false - } - if !(s.Affiliate.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeBotSubscriptionSale) String() string { - if s == nil { - return "StarTransactionTypeBotSubscriptionSale(nil)" - } - type Alias StarTransactionTypeBotSubscriptionSale - return fmt.Sprintf("StarTransactionTypeBotSubscriptionSale%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeBotSubscriptionSale) TypeID() uint32 { - return StarTransactionTypeBotSubscriptionSaleTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeBotSubscriptionSale) TypeName() string { - return "starTransactionTypeBotSubscriptionSale" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeBotSubscriptionSale) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeBotSubscriptionSale", - ID: StarTransactionTypeBotSubscriptionSaleTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "SubscriptionPeriod", - SchemaName: "subscription_period", - }, - { - Name: "ProductInfo", - SchemaName: "product_info", - }, - { - Name: "InvoicePayload", - SchemaName: "invoice_payload", - }, - { - Name: "Affiliate", - SchemaName: "affiliate", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeBotSubscriptionSale) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotSubscriptionSale#1f686889 as nil") - } - b.PutID(StarTransactionTypeBotSubscriptionSaleTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeBotSubscriptionSale) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotSubscriptionSale#1f686889 as nil") - } - b.PutInt53(s.UserID) - b.PutInt32(s.SubscriptionPeriod) - if err := s.ProductInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotSubscriptionSale#1f686889: field product_info: %w", err) - } - b.PutBytes(s.InvoicePayload) - if err := s.Affiliate.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotSubscriptionSale#1f686889: field affiliate: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeBotSubscriptionSale) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotSubscriptionSale#1f686889 to nil") - } - if err := b.ConsumeID(StarTransactionTypeBotSubscriptionSaleTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeBotSubscriptionSale) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotSubscriptionSale#1f686889 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: field subscription_period: %w", err) - } - s.SubscriptionPeriod = value - } - { - if err := s.ProductInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: field product_info: %w", err) - } - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: field invoice_payload: %w", err) - } - s.InvoicePayload = value - } - { - if err := s.Affiliate.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: field affiliate: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeBotSubscriptionSale) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeBotSubscriptionSale#1f686889 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeBotSubscriptionSale") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("subscription_period") - b.PutInt32(s.SubscriptionPeriod) - b.Comma() - b.FieldStart("product_info") - if err := s.ProductInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotSubscriptionSale#1f686889: field product_info: %w", err) - } - b.Comma() - b.FieldStart("invoice_payload") - b.PutBytes(s.InvoicePayload) - b.Comma() - b.FieldStart("affiliate") - if err := s.Affiliate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeBotSubscriptionSale#1f686889: field affiliate: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeBotSubscriptionSale) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeBotSubscriptionSale#1f686889 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeBotSubscriptionSale"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: field user_id: %w", err) - } - s.UserID = value - case "subscription_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: field subscription_period: %w", err) - } - s.SubscriptionPeriod = value - case "product_info": - if err := s.ProductInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: field product_info: %w", err) - } - case "invoice_payload": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: field invoice_payload: %w", err) - } - s.InvoicePayload = value - case "affiliate": - if err := s.Affiliate.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeBotSubscriptionSale#1f686889: field affiliate: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeBotSubscriptionSale) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetSubscriptionPeriod returns value of SubscriptionPeriod field. -func (s *StarTransactionTypeBotSubscriptionSale) GetSubscriptionPeriod() (value int32) { - if s == nil { - return - } - return s.SubscriptionPeriod -} - -// GetProductInfo returns value of ProductInfo field. -func (s *StarTransactionTypeBotSubscriptionSale) GetProductInfo() (value ProductInfo) { - if s == nil { - return - } - return s.ProductInfo -} - -// GetInvoicePayload returns value of InvoicePayload field. -func (s *StarTransactionTypeBotSubscriptionSale) GetInvoicePayload() (value []byte) { - if s == nil { - return - } - return s.InvoicePayload -} - -// GetAffiliate returns value of Affiliate field. -func (s *StarTransactionTypeBotSubscriptionSale) GetAffiliate() (value AffiliateInfo) { - if s == nil { - return - } - return s.Affiliate -} - -// StarTransactionTypeChannelSubscriptionPurchase represents TL type `starTransactionTypeChannelSubscriptionPurchase#380eb3d1`. -type StarTransactionTypeChannelSubscriptionPurchase struct { - // Identifier of the channel chat that created the subscription - ChatID int64 - // The number of seconds between consecutive Telegram Star debitings - SubscriptionPeriod int32 -} - -// StarTransactionTypeChannelSubscriptionPurchaseTypeID is TL type id of StarTransactionTypeChannelSubscriptionPurchase. -const StarTransactionTypeChannelSubscriptionPurchaseTypeID = 0x380eb3d1 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeChannelSubscriptionPurchase) construct() StarTransactionTypeClass { - return &s -} - -// Ensuring interfaces in compile-time for StarTransactionTypeChannelSubscriptionPurchase. -var ( - _ bin.Encoder = &StarTransactionTypeChannelSubscriptionPurchase{} - _ bin.Decoder = &StarTransactionTypeChannelSubscriptionPurchase{} - _ bin.BareEncoder = &StarTransactionTypeChannelSubscriptionPurchase{} - _ bin.BareDecoder = &StarTransactionTypeChannelSubscriptionPurchase{} - - _ StarTransactionTypeClass = &StarTransactionTypeChannelSubscriptionPurchase{} -) - -func (s *StarTransactionTypeChannelSubscriptionPurchase) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.SubscriptionPeriod == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeChannelSubscriptionPurchase) String() string { - if s == nil { - return "StarTransactionTypeChannelSubscriptionPurchase(nil)" - } - type Alias StarTransactionTypeChannelSubscriptionPurchase - return fmt.Sprintf("StarTransactionTypeChannelSubscriptionPurchase%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeChannelSubscriptionPurchase) TypeID() uint32 { - return StarTransactionTypeChannelSubscriptionPurchaseTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeChannelSubscriptionPurchase) TypeName() string { - return "starTransactionTypeChannelSubscriptionPurchase" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeChannelSubscriptionPurchase) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeChannelSubscriptionPurchase", - ID: StarTransactionTypeChannelSubscriptionPurchaseTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "SubscriptionPeriod", - SchemaName: "subscription_period", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeChannelSubscriptionPurchase) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelSubscriptionPurchase#380eb3d1 as nil") - } - b.PutID(StarTransactionTypeChannelSubscriptionPurchaseTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeChannelSubscriptionPurchase) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelSubscriptionPurchase#380eb3d1 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt32(s.SubscriptionPeriod) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeChannelSubscriptionPurchase) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelSubscriptionPurchase#380eb3d1 to nil") - } - if err := b.ConsumeID(StarTransactionTypeChannelSubscriptionPurchaseTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionPurchase#380eb3d1: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeChannelSubscriptionPurchase) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelSubscriptionPurchase#380eb3d1 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionPurchase#380eb3d1: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionPurchase#380eb3d1: field subscription_period: %w", err) - } - s.SubscriptionPeriod = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeChannelSubscriptionPurchase) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelSubscriptionPurchase#380eb3d1 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeChannelSubscriptionPurchase") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("subscription_period") - b.PutInt32(s.SubscriptionPeriod) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeChannelSubscriptionPurchase) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelSubscriptionPurchase#380eb3d1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeChannelSubscriptionPurchase"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionPurchase#380eb3d1: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionPurchase#380eb3d1: field chat_id: %w", err) - } - s.ChatID = value - case "subscription_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionPurchase#380eb3d1: field subscription_period: %w", err) - } - s.SubscriptionPeriod = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *StarTransactionTypeChannelSubscriptionPurchase) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetSubscriptionPeriod returns value of SubscriptionPeriod field. -func (s *StarTransactionTypeChannelSubscriptionPurchase) GetSubscriptionPeriod() (value int32) { - if s == nil { - return - } - return s.SubscriptionPeriod -} - -// StarTransactionTypeChannelSubscriptionSale represents TL type `starTransactionTypeChannelSubscriptionSale#fe127c82`. -type StarTransactionTypeChannelSubscriptionSale struct { - // Identifier of the user that bought the subscription - UserID int64 - // The number of seconds between consecutive Telegram Star debitings - SubscriptionPeriod int32 -} - -// StarTransactionTypeChannelSubscriptionSaleTypeID is TL type id of StarTransactionTypeChannelSubscriptionSale. -const StarTransactionTypeChannelSubscriptionSaleTypeID = 0xfe127c82 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeChannelSubscriptionSale) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeChannelSubscriptionSale. -var ( - _ bin.Encoder = &StarTransactionTypeChannelSubscriptionSale{} - _ bin.Decoder = &StarTransactionTypeChannelSubscriptionSale{} - _ bin.BareEncoder = &StarTransactionTypeChannelSubscriptionSale{} - _ bin.BareDecoder = &StarTransactionTypeChannelSubscriptionSale{} - - _ StarTransactionTypeClass = &StarTransactionTypeChannelSubscriptionSale{} -) - -func (s *StarTransactionTypeChannelSubscriptionSale) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.SubscriptionPeriod == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeChannelSubscriptionSale) String() string { - if s == nil { - return "StarTransactionTypeChannelSubscriptionSale(nil)" - } - type Alias StarTransactionTypeChannelSubscriptionSale - return fmt.Sprintf("StarTransactionTypeChannelSubscriptionSale%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeChannelSubscriptionSale) TypeID() uint32 { - return StarTransactionTypeChannelSubscriptionSaleTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeChannelSubscriptionSale) TypeName() string { - return "starTransactionTypeChannelSubscriptionSale" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeChannelSubscriptionSale) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeChannelSubscriptionSale", - ID: StarTransactionTypeChannelSubscriptionSaleTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "SubscriptionPeriod", - SchemaName: "subscription_period", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeChannelSubscriptionSale) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelSubscriptionSale#fe127c82 as nil") - } - b.PutID(StarTransactionTypeChannelSubscriptionSaleTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeChannelSubscriptionSale) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelSubscriptionSale#fe127c82 as nil") - } - b.PutInt53(s.UserID) - b.PutInt32(s.SubscriptionPeriod) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeChannelSubscriptionSale) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelSubscriptionSale#fe127c82 to nil") - } - if err := b.ConsumeID(StarTransactionTypeChannelSubscriptionSaleTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionSale#fe127c82: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeChannelSubscriptionSale) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelSubscriptionSale#fe127c82 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionSale#fe127c82: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionSale#fe127c82: field subscription_period: %w", err) - } - s.SubscriptionPeriod = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeChannelSubscriptionSale) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelSubscriptionSale#fe127c82 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeChannelSubscriptionSale") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("subscription_period") - b.PutInt32(s.SubscriptionPeriod) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeChannelSubscriptionSale) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelSubscriptionSale#fe127c82 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeChannelSubscriptionSale"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionSale#fe127c82: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionSale#fe127c82: field user_id: %w", err) - } - s.UserID = value - case "subscription_period": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelSubscriptionSale#fe127c82: field subscription_period: %w", err) - } - s.SubscriptionPeriod = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeChannelSubscriptionSale) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetSubscriptionPeriod returns value of SubscriptionPeriod field. -func (s *StarTransactionTypeChannelSubscriptionSale) GetSubscriptionPeriod() (value int32) { - if s == nil { - return - } - return s.SubscriptionPeriod -} - -// StarTransactionTypeGiftPurchase represents TL type `starTransactionTypeGiftPurchase#ef5f1d52`. -type StarTransactionTypeGiftPurchase struct { - // Identifier of the user that received the gift - UserID int64 - // The gift - Gift Gift -} - -// StarTransactionTypeGiftPurchaseTypeID is TL type id of StarTransactionTypeGiftPurchase. -const StarTransactionTypeGiftPurchaseTypeID = 0xef5f1d52 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeGiftPurchase) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeGiftPurchase. -var ( - _ bin.Encoder = &StarTransactionTypeGiftPurchase{} - _ bin.Decoder = &StarTransactionTypeGiftPurchase{} - _ bin.BareEncoder = &StarTransactionTypeGiftPurchase{} - _ bin.BareDecoder = &StarTransactionTypeGiftPurchase{} - - _ StarTransactionTypeClass = &StarTransactionTypeGiftPurchase{} -) - -func (s *StarTransactionTypeGiftPurchase) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Gift.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeGiftPurchase) String() string { - if s == nil { - return "StarTransactionTypeGiftPurchase(nil)" - } - type Alias StarTransactionTypeGiftPurchase - return fmt.Sprintf("StarTransactionTypeGiftPurchase%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeGiftPurchase) TypeID() uint32 { - return StarTransactionTypeGiftPurchaseTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeGiftPurchase) TypeName() string { - return "starTransactionTypeGiftPurchase" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeGiftPurchase) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeGiftPurchase", - ID: StarTransactionTypeGiftPurchaseTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Gift", - SchemaName: "gift", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeGiftPurchase) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftPurchase#ef5f1d52 as nil") - } - b.PutID(StarTransactionTypeGiftPurchaseTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeGiftPurchase) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftPurchase#ef5f1d52 as nil") - } - b.PutInt53(s.UserID) - if err := s.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeGiftPurchase#ef5f1d52: field gift: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeGiftPurchase) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftPurchase#ef5f1d52 to nil") - } - if err := b.ConsumeID(StarTransactionTypeGiftPurchaseTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftPurchase#ef5f1d52: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeGiftPurchase) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftPurchase#ef5f1d52 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftPurchase#ef5f1d52: field user_id: %w", err) - } - s.UserID = value - } - { - if err := s.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftPurchase#ef5f1d52: field gift: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeGiftPurchase) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftPurchase#ef5f1d52 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeGiftPurchase") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("gift") - if err := s.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeGiftPurchase#ef5f1d52: field gift: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeGiftPurchase) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftPurchase#ef5f1d52 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeGiftPurchase"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftPurchase#ef5f1d52: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftPurchase#ef5f1d52: field user_id: %w", err) - } - s.UserID = value - case "gift": - if err := s.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftPurchase#ef5f1d52: field gift: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeGiftPurchase) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetGift returns value of Gift field. -func (s *StarTransactionTypeGiftPurchase) GetGift() (value Gift) { - if s == nil { - return - } - return s.Gift -} - -// StarTransactionTypeGiftTransfer represents TL type `starTransactionTypeGiftTransfer#ef323c55`. -type StarTransactionTypeGiftTransfer struct { - // Identifier of the user that received the gift - UserID int64 - // The gift - Gift UpgradedGift -} - -// StarTransactionTypeGiftTransferTypeID is TL type id of StarTransactionTypeGiftTransfer. -const StarTransactionTypeGiftTransferTypeID = 0xef323c55 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeGiftTransfer) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeGiftTransfer. -var ( - _ bin.Encoder = &StarTransactionTypeGiftTransfer{} - _ bin.Decoder = &StarTransactionTypeGiftTransfer{} - _ bin.BareEncoder = &StarTransactionTypeGiftTransfer{} - _ bin.BareDecoder = &StarTransactionTypeGiftTransfer{} - - _ StarTransactionTypeClass = &StarTransactionTypeGiftTransfer{} -) - -func (s *StarTransactionTypeGiftTransfer) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Gift.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeGiftTransfer) String() string { - if s == nil { - return "StarTransactionTypeGiftTransfer(nil)" - } - type Alias StarTransactionTypeGiftTransfer - return fmt.Sprintf("StarTransactionTypeGiftTransfer%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeGiftTransfer) TypeID() uint32 { - return StarTransactionTypeGiftTransferTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeGiftTransfer) TypeName() string { - return "starTransactionTypeGiftTransfer" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeGiftTransfer) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeGiftTransfer", - ID: StarTransactionTypeGiftTransferTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Gift", - SchemaName: "gift", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeGiftTransfer) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftTransfer#ef323c55 as nil") - } - b.PutID(StarTransactionTypeGiftTransferTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeGiftTransfer) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftTransfer#ef323c55 as nil") - } - b.PutInt53(s.UserID) - if err := s.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeGiftTransfer#ef323c55: field gift: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeGiftTransfer) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftTransfer#ef323c55 to nil") - } - if err := b.ConsumeID(StarTransactionTypeGiftTransferTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeGiftTransfer) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftTransfer#ef323c55 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: field user_id: %w", err) - } - s.UserID = value - } - { - if err := s.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: field gift: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeGiftTransfer) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftTransfer#ef323c55 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeGiftTransfer") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("gift") - if err := s.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeGiftTransfer#ef323c55: field gift: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeGiftTransfer) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftTransfer#ef323c55 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeGiftTransfer"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: field user_id: %w", err) - } - s.UserID = value - case "gift": - if err := s.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftTransfer#ef323c55: field gift: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeGiftTransfer) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetGift returns value of Gift field. -func (s *StarTransactionTypeGiftTransfer) GetGift() (value UpgradedGift) { - if s == nil { - return - } - return s.Gift -} - -// StarTransactionTypeGiftSale represents TL type `starTransactionTypeGiftSale#64d61157`. -type StarTransactionTypeGiftSale struct { - // Identifier of the user that sent the gift - UserID int64 - // The gift - Gift Gift -} - -// StarTransactionTypeGiftSaleTypeID is TL type id of StarTransactionTypeGiftSale. -const StarTransactionTypeGiftSaleTypeID = 0x64d61157 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeGiftSale) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeGiftSale. -var ( - _ bin.Encoder = &StarTransactionTypeGiftSale{} - _ bin.Decoder = &StarTransactionTypeGiftSale{} - _ bin.BareEncoder = &StarTransactionTypeGiftSale{} - _ bin.BareDecoder = &StarTransactionTypeGiftSale{} - - _ StarTransactionTypeClass = &StarTransactionTypeGiftSale{} -) - -func (s *StarTransactionTypeGiftSale) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Gift.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeGiftSale) String() string { - if s == nil { - return "StarTransactionTypeGiftSale(nil)" - } - type Alias StarTransactionTypeGiftSale - return fmt.Sprintf("StarTransactionTypeGiftSale%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeGiftSale) TypeID() uint32 { - return StarTransactionTypeGiftSaleTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeGiftSale) TypeName() string { - return "starTransactionTypeGiftSale" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeGiftSale) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeGiftSale", - ID: StarTransactionTypeGiftSaleTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Gift", - SchemaName: "gift", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeGiftSale) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftSale#64d61157 as nil") - } - b.PutID(StarTransactionTypeGiftSaleTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeGiftSale) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftSale#64d61157 as nil") - } - b.PutInt53(s.UserID) - if err := s.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeGiftSale#64d61157: field gift: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeGiftSale) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftSale#64d61157 to nil") - } - if err := b.ConsumeID(StarTransactionTypeGiftSaleTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftSale#64d61157: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeGiftSale) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftSale#64d61157 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftSale#64d61157: field user_id: %w", err) - } - s.UserID = value - } - { - if err := s.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftSale#64d61157: field gift: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeGiftSale) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftSale#64d61157 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeGiftSale") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("gift") - if err := s.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeGiftSale#64d61157: field gift: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeGiftSale) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftSale#64d61157 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeGiftSale"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftSale#64d61157: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftSale#64d61157: field user_id: %w", err) - } - s.UserID = value - case "gift": - if err := s.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftSale#64d61157: field gift: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeGiftSale) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetGift returns value of Gift field. -func (s *StarTransactionTypeGiftSale) GetGift() (value Gift) { - if s == nil { - return - } - return s.Gift -} - -// StarTransactionTypeGiftUpgrade represents TL type `starTransactionTypeGiftUpgrade#2697844b`. -type StarTransactionTypeGiftUpgrade struct { - // The upgraded gift - Gift UpgradedGift -} - -// StarTransactionTypeGiftUpgradeTypeID is TL type id of StarTransactionTypeGiftUpgrade. -const StarTransactionTypeGiftUpgradeTypeID = 0x2697844b - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeGiftUpgrade) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeGiftUpgrade. -var ( - _ bin.Encoder = &StarTransactionTypeGiftUpgrade{} - _ bin.Decoder = &StarTransactionTypeGiftUpgrade{} - _ bin.BareEncoder = &StarTransactionTypeGiftUpgrade{} - _ bin.BareDecoder = &StarTransactionTypeGiftUpgrade{} - - _ StarTransactionTypeClass = &StarTransactionTypeGiftUpgrade{} -) - -func (s *StarTransactionTypeGiftUpgrade) Zero() bool { - if s == nil { - return true - } - if !(s.Gift.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeGiftUpgrade) String() string { - if s == nil { - return "StarTransactionTypeGiftUpgrade(nil)" - } - type Alias StarTransactionTypeGiftUpgrade - return fmt.Sprintf("StarTransactionTypeGiftUpgrade%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeGiftUpgrade) TypeID() uint32 { - return StarTransactionTypeGiftUpgradeTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeGiftUpgrade) TypeName() string { - return "starTransactionTypeGiftUpgrade" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeGiftUpgrade) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeGiftUpgrade", - ID: StarTransactionTypeGiftUpgradeTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Gift", - SchemaName: "gift", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeGiftUpgrade) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftUpgrade#2697844b as nil") - } - b.PutID(StarTransactionTypeGiftUpgradeTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeGiftUpgrade) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftUpgrade#2697844b as nil") - } - if err := s.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeGiftUpgrade#2697844b: field gift: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeGiftUpgrade) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftUpgrade#2697844b to nil") - } - if err := b.ConsumeID(StarTransactionTypeGiftUpgradeTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftUpgrade#2697844b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeGiftUpgrade) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftUpgrade#2697844b to nil") - } - { - if err := s.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftUpgrade#2697844b: field gift: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeGiftUpgrade) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeGiftUpgrade#2697844b as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeGiftUpgrade") - b.Comma() - b.FieldStart("gift") - if err := s.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactionTypeGiftUpgrade#2697844b: field gift: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeGiftUpgrade) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeGiftUpgrade#2697844b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeGiftUpgrade"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftUpgrade#2697844b: %w", err) - } - case "gift": - if err := s.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeGiftUpgrade#2697844b: field gift: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGift returns value of Gift field. -func (s *StarTransactionTypeGiftUpgrade) GetGift() (value UpgradedGift) { - if s == nil { - return - } - return s.Gift -} - -// StarTransactionTypeChannelPaidReactionSend represents TL type `starTransactionTypeChannelPaidReactionSend#c02667c0`. -type StarTransactionTypeChannelPaidReactionSend struct { - // Identifier of the channel chat - ChatID int64 - // Identifier of the reacted message; can be 0 or an identifier of a deleted message - MessageID int64 -} - -// StarTransactionTypeChannelPaidReactionSendTypeID is TL type id of StarTransactionTypeChannelPaidReactionSend. -const StarTransactionTypeChannelPaidReactionSendTypeID = 0xc02667c0 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeChannelPaidReactionSend) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeChannelPaidReactionSend. -var ( - _ bin.Encoder = &StarTransactionTypeChannelPaidReactionSend{} - _ bin.Decoder = &StarTransactionTypeChannelPaidReactionSend{} - _ bin.BareEncoder = &StarTransactionTypeChannelPaidReactionSend{} - _ bin.BareDecoder = &StarTransactionTypeChannelPaidReactionSend{} - - _ StarTransactionTypeClass = &StarTransactionTypeChannelPaidReactionSend{} -) - -func (s *StarTransactionTypeChannelPaidReactionSend) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeChannelPaidReactionSend) String() string { - if s == nil { - return "StarTransactionTypeChannelPaidReactionSend(nil)" - } - type Alias StarTransactionTypeChannelPaidReactionSend - return fmt.Sprintf("StarTransactionTypeChannelPaidReactionSend%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeChannelPaidReactionSend) TypeID() uint32 { - return StarTransactionTypeChannelPaidReactionSendTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeChannelPaidReactionSend) TypeName() string { - return "starTransactionTypeChannelPaidReactionSend" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeChannelPaidReactionSend) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeChannelPaidReactionSend", - ID: StarTransactionTypeChannelPaidReactionSendTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeChannelPaidReactionSend) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidReactionSend#c02667c0 as nil") - } - b.PutID(StarTransactionTypeChannelPaidReactionSendTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeChannelPaidReactionSend) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidReactionSend#c02667c0 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeChannelPaidReactionSend) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidReactionSend#c02667c0 to nil") - } - if err := b.ConsumeID(StarTransactionTypeChannelPaidReactionSendTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionSend#c02667c0: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeChannelPaidReactionSend) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidReactionSend#c02667c0 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionSend#c02667c0: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionSend#c02667c0: field message_id: %w", err) - } - s.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeChannelPaidReactionSend) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidReactionSend#c02667c0 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeChannelPaidReactionSend") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeChannelPaidReactionSend) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidReactionSend#c02667c0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeChannelPaidReactionSend"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionSend#c02667c0: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionSend#c02667c0: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionSend#c02667c0: field message_id: %w", err) - } - s.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *StarTransactionTypeChannelPaidReactionSend) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *StarTransactionTypeChannelPaidReactionSend) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// StarTransactionTypeChannelPaidReactionReceive represents TL type `starTransactionTypeChannelPaidReactionReceive#23d6f9eb`. -type StarTransactionTypeChannelPaidReactionReceive struct { - // Identifier of the user that added the paid reaction - UserID int64 - // Identifier of the reacted message; can be 0 or an identifier of a deleted message - MessageID int64 -} - -// StarTransactionTypeChannelPaidReactionReceiveTypeID is TL type id of StarTransactionTypeChannelPaidReactionReceive. -const StarTransactionTypeChannelPaidReactionReceiveTypeID = 0x23d6f9eb - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeChannelPaidReactionReceive) construct() StarTransactionTypeClass { - return &s -} - -// Ensuring interfaces in compile-time for StarTransactionTypeChannelPaidReactionReceive. -var ( - _ bin.Encoder = &StarTransactionTypeChannelPaidReactionReceive{} - _ bin.Decoder = &StarTransactionTypeChannelPaidReactionReceive{} - _ bin.BareEncoder = &StarTransactionTypeChannelPaidReactionReceive{} - _ bin.BareDecoder = &StarTransactionTypeChannelPaidReactionReceive{} - - _ StarTransactionTypeClass = &StarTransactionTypeChannelPaidReactionReceive{} -) - -func (s *StarTransactionTypeChannelPaidReactionReceive) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeChannelPaidReactionReceive) String() string { - if s == nil { - return "StarTransactionTypeChannelPaidReactionReceive(nil)" - } - type Alias StarTransactionTypeChannelPaidReactionReceive - return fmt.Sprintf("StarTransactionTypeChannelPaidReactionReceive%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeChannelPaidReactionReceive) TypeID() uint32 { - return StarTransactionTypeChannelPaidReactionReceiveTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeChannelPaidReactionReceive) TypeName() string { - return "starTransactionTypeChannelPaidReactionReceive" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeChannelPaidReactionReceive) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeChannelPaidReactionReceive", - ID: StarTransactionTypeChannelPaidReactionReceiveTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeChannelPaidReactionReceive) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidReactionReceive#23d6f9eb as nil") - } - b.PutID(StarTransactionTypeChannelPaidReactionReceiveTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeChannelPaidReactionReceive) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidReactionReceive#23d6f9eb as nil") - } - b.PutInt53(s.UserID) - b.PutInt53(s.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeChannelPaidReactionReceive) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidReactionReceive#23d6f9eb to nil") - } - if err := b.ConsumeID(StarTransactionTypeChannelPaidReactionReceiveTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionReceive#23d6f9eb: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeChannelPaidReactionReceive) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidReactionReceive#23d6f9eb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionReceive#23d6f9eb: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionReceive#23d6f9eb: field message_id: %w", err) - } - s.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeChannelPaidReactionReceive) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeChannelPaidReactionReceive#23d6f9eb as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeChannelPaidReactionReceive") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeChannelPaidReactionReceive) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeChannelPaidReactionReceive#23d6f9eb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeChannelPaidReactionReceive"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionReceive#23d6f9eb: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionReceive#23d6f9eb: field user_id: %w", err) - } - s.UserID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeChannelPaidReactionReceive#23d6f9eb: field message_id: %w", err) - } - s.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StarTransactionTypeChannelPaidReactionReceive) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetMessageID returns value of MessageID field. -func (s *StarTransactionTypeChannelPaidReactionReceive) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// StarTransactionTypeAffiliateProgramCommission represents TL type `starTransactionTypeAffiliateProgramCommission#9a637573`. -type StarTransactionTypeAffiliateProgramCommission struct { - // Identifier of the chat that created the affiliate program - ChatID int64 - // The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars - // received by the program owner - CommissionPerMille int32 -} - -// StarTransactionTypeAffiliateProgramCommissionTypeID is TL type id of StarTransactionTypeAffiliateProgramCommission. -const StarTransactionTypeAffiliateProgramCommissionTypeID = 0x9a637573 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeAffiliateProgramCommission) construct() StarTransactionTypeClass { - return &s -} - -// Ensuring interfaces in compile-time for StarTransactionTypeAffiliateProgramCommission. -var ( - _ bin.Encoder = &StarTransactionTypeAffiliateProgramCommission{} - _ bin.Decoder = &StarTransactionTypeAffiliateProgramCommission{} - _ bin.BareEncoder = &StarTransactionTypeAffiliateProgramCommission{} - _ bin.BareDecoder = &StarTransactionTypeAffiliateProgramCommission{} - - _ StarTransactionTypeClass = &StarTransactionTypeAffiliateProgramCommission{} -) - -func (s *StarTransactionTypeAffiliateProgramCommission) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.CommissionPerMille == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeAffiliateProgramCommission) String() string { - if s == nil { - return "StarTransactionTypeAffiliateProgramCommission(nil)" - } - type Alias StarTransactionTypeAffiliateProgramCommission - return fmt.Sprintf("StarTransactionTypeAffiliateProgramCommission%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeAffiliateProgramCommission) TypeID() uint32 { - return StarTransactionTypeAffiliateProgramCommissionTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeAffiliateProgramCommission) TypeName() string { - return "starTransactionTypeAffiliateProgramCommission" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeAffiliateProgramCommission) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeAffiliateProgramCommission", - ID: StarTransactionTypeAffiliateProgramCommissionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "CommissionPerMille", - SchemaName: "commission_per_mille", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeAffiliateProgramCommission) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeAffiliateProgramCommission#9a637573 as nil") - } - b.PutID(StarTransactionTypeAffiliateProgramCommissionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeAffiliateProgramCommission) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeAffiliateProgramCommission#9a637573 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt32(s.CommissionPerMille) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeAffiliateProgramCommission) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeAffiliateProgramCommission#9a637573 to nil") - } - if err := b.ConsumeID(StarTransactionTypeAffiliateProgramCommissionTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeAffiliateProgramCommission#9a637573: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeAffiliateProgramCommission) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeAffiliateProgramCommission#9a637573 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeAffiliateProgramCommission#9a637573: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeAffiliateProgramCommission#9a637573: field commission_per_mille: %w", err) - } - s.CommissionPerMille = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeAffiliateProgramCommission) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeAffiliateProgramCommission#9a637573 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeAffiliateProgramCommission") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("commission_per_mille") - b.PutInt32(s.CommissionPerMille) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeAffiliateProgramCommission) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeAffiliateProgramCommission#9a637573 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeAffiliateProgramCommission"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeAffiliateProgramCommission#9a637573: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeAffiliateProgramCommission#9a637573: field chat_id: %w", err) - } - s.ChatID = value - case "commission_per_mille": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode starTransactionTypeAffiliateProgramCommission#9a637573: field commission_per_mille: %w", err) - } - s.CommissionPerMille = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *StarTransactionTypeAffiliateProgramCommission) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetCommissionPerMille returns value of CommissionPerMille field. -func (s *StarTransactionTypeAffiliateProgramCommission) GetCommissionPerMille() (value int32) { - if s == nil { - return - } - return s.CommissionPerMille -} - -// StarTransactionTypeUnsupported represents TL type `starTransactionTypeUnsupported#76cfcab2`. -type StarTransactionTypeUnsupported struct { -} - -// StarTransactionTypeUnsupportedTypeID is TL type id of StarTransactionTypeUnsupported. -const StarTransactionTypeUnsupportedTypeID = 0x76cfcab2 - -// construct implements constructor of StarTransactionTypeClass. -func (s StarTransactionTypeUnsupported) construct() StarTransactionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StarTransactionTypeUnsupported. -var ( - _ bin.Encoder = &StarTransactionTypeUnsupported{} - _ bin.Decoder = &StarTransactionTypeUnsupported{} - _ bin.BareEncoder = &StarTransactionTypeUnsupported{} - _ bin.BareDecoder = &StarTransactionTypeUnsupported{} - - _ StarTransactionTypeClass = &StarTransactionTypeUnsupported{} -) - -func (s *StarTransactionTypeUnsupported) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactionTypeUnsupported) String() string { - if s == nil { - return "StarTransactionTypeUnsupported(nil)" - } - type Alias StarTransactionTypeUnsupported - return fmt.Sprintf("StarTransactionTypeUnsupported%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactionTypeUnsupported) TypeID() uint32 { - return StarTransactionTypeUnsupportedTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactionTypeUnsupported) TypeName() string { - return "starTransactionTypeUnsupported" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactionTypeUnsupported) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactionTypeUnsupported", - ID: StarTransactionTypeUnsupportedTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactionTypeUnsupported) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeUnsupported#76cfcab2 as nil") - } - b.PutID(StarTransactionTypeUnsupportedTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactionTypeUnsupported) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeUnsupported#76cfcab2 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactionTypeUnsupported) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeUnsupported#76cfcab2 to nil") - } - if err := b.ConsumeID(StarTransactionTypeUnsupportedTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeUnsupported#76cfcab2: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactionTypeUnsupported) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeUnsupported#76cfcab2 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactionTypeUnsupported) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactionTypeUnsupported#76cfcab2 as nil") - } - b.ObjStart() - b.PutID("starTransactionTypeUnsupported") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactionTypeUnsupported) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactionTypeUnsupported#76cfcab2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactionTypeUnsupported"); err != nil { - return fmt.Errorf("unable to decode starTransactionTypeUnsupported#76cfcab2: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StarTransactionTypeClassName is schema name of StarTransactionTypeClass. -const StarTransactionTypeClassName = "StarTransactionType" - -// StarTransactionTypeClass represents StarTransactionType generic type. -// -// Example: -// -// g, err := tdapi.DecodeStarTransactionType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StarTransactionTypePremiumBotDeposit: // starTransactionTypePremiumBotDeposit#d879090e -// case *tdapi.StarTransactionTypeAppStoreDeposit: // starTransactionTypeAppStoreDeposit#8283941 -// case *tdapi.StarTransactionTypeGooglePlayDeposit: // starTransactionTypeGooglePlayDeposit#ecbdb656 -// case *tdapi.StarTransactionTypeFragmentDeposit: // starTransactionTypeFragmentDeposit#7625e44 -// case *tdapi.StarTransactionTypeUserDeposit: // starTransactionTypeUserDeposit#c2a18e9 -// case *tdapi.StarTransactionTypeGiveawayDeposit: // starTransactionTypeGiveawayDeposit#b16200c6 -// case *tdapi.StarTransactionTypeFragmentWithdrawal: // starTransactionTypeFragmentWithdrawal#af3a2992 -// case *tdapi.StarTransactionTypeTelegramAdsWithdrawal: // starTransactionTypeTelegramAdsWithdrawal#a58e8469 -// case *tdapi.StarTransactionTypeTelegramAPIUsage: // starTransactionTypeTelegramApiUsage#27a82afe -// case *tdapi.StarTransactionTypeBotPaidMediaPurchase: // starTransactionTypeBotPaidMediaPurchase#7f48cc6a -// case *tdapi.StarTransactionTypeBotPaidMediaSale: // starTransactionTypeBotPaidMediaSale#6e07eeb2 -// case *tdapi.StarTransactionTypeChannelPaidMediaPurchase: // starTransactionTypeChannelPaidMediaPurchase#9016d4f5 -// case *tdapi.StarTransactionTypeChannelPaidMediaSale: // starTransactionTypeChannelPaidMediaSale#eace92ef -// case *tdapi.StarTransactionTypeBotInvoicePurchase: // starTransactionTypeBotInvoicePurchase#1dddac0c -// case *tdapi.StarTransactionTypeBotInvoiceSale: // starTransactionTypeBotInvoiceSale#5b7d8d2f -// case *tdapi.StarTransactionTypeBotSubscriptionPurchase: // starTransactionTypeBotSubscriptionPurchase#40bf1355 -// case *tdapi.StarTransactionTypeBotSubscriptionSale: // starTransactionTypeBotSubscriptionSale#1f686889 -// case *tdapi.StarTransactionTypeChannelSubscriptionPurchase: // starTransactionTypeChannelSubscriptionPurchase#380eb3d1 -// case *tdapi.StarTransactionTypeChannelSubscriptionSale: // starTransactionTypeChannelSubscriptionSale#fe127c82 -// case *tdapi.StarTransactionTypeGiftPurchase: // starTransactionTypeGiftPurchase#ef5f1d52 -// case *tdapi.StarTransactionTypeGiftTransfer: // starTransactionTypeGiftTransfer#ef323c55 -// case *tdapi.StarTransactionTypeGiftSale: // starTransactionTypeGiftSale#64d61157 -// case *tdapi.StarTransactionTypeGiftUpgrade: // starTransactionTypeGiftUpgrade#2697844b -// case *tdapi.StarTransactionTypeChannelPaidReactionSend: // starTransactionTypeChannelPaidReactionSend#c02667c0 -// case *tdapi.StarTransactionTypeChannelPaidReactionReceive: // starTransactionTypeChannelPaidReactionReceive#23d6f9eb -// case *tdapi.StarTransactionTypeAffiliateProgramCommission: // starTransactionTypeAffiliateProgramCommission#9a637573 -// case *tdapi.StarTransactionTypeUnsupported: // starTransactionTypeUnsupported#76cfcab2 -// default: panic(v) -// } -type StarTransactionTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StarTransactionTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStarTransactionType implements binary de-serialization for StarTransactionTypeClass. -func DecodeStarTransactionType(buf *bin.Buffer) (StarTransactionTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StarTransactionTypePremiumBotDepositTypeID: - // Decoding starTransactionTypePremiumBotDeposit#d879090e. - v := StarTransactionTypePremiumBotDeposit{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeAppStoreDepositTypeID: - // Decoding starTransactionTypeAppStoreDeposit#8283941. - v := StarTransactionTypeAppStoreDeposit{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeGooglePlayDepositTypeID: - // Decoding starTransactionTypeGooglePlayDeposit#ecbdb656. - v := StarTransactionTypeGooglePlayDeposit{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeFragmentDepositTypeID: - // Decoding starTransactionTypeFragmentDeposit#7625e44. - v := StarTransactionTypeFragmentDeposit{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeUserDepositTypeID: - // Decoding starTransactionTypeUserDeposit#c2a18e9. - v := StarTransactionTypeUserDeposit{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeGiveawayDepositTypeID: - // Decoding starTransactionTypeGiveawayDeposit#b16200c6. - v := StarTransactionTypeGiveawayDeposit{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeFragmentWithdrawalTypeID: - // Decoding starTransactionTypeFragmentWithdrawal#af3a2992. - v := StarTransactionTypeFragmentWithdrawal{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeTelegramAdsWithdrawalTypeID: - // Decoding starTransactionTypeTelegramAdsWithdrawal#a58e8469. - v := StarTransactionTypeTelegramAdsWithdrawal{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeTelegramAPIUsageTypeID: - // Decoding starTransactionTypeTelegramApiUsage#27a82afe. - v := StarTransactionTypeTelegramAPIUsage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeBotPaidMediaPurchaseTypeID: - // Decoding starTransactionTypeBotPaidMediaPurchase#7f48cc6a. - v := StarTransactionTypeBotPaidMediaPurchase{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeBotPaidMediaSaleTypeID: - // Decoding starTransactionTypeBotPaidMediaSale#6e07eeb2. - v := StarTransactionTypeBotPaidMediaSale{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeChannelPaidMediaPurchaseTypeID: - // Decoding starTransactionTypeChannelPaidMediaPurchase#9016d4f5. - v := StarTransactionTypeChannelPaidMediaPurchase{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeChannelPaidMediaSaleTypeID: - // Decoding starTransactionTypeChannelPaidMediaSale#eace92ef. - v := StarTransactionTypeChannelPaidMediaSale{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeBotInvoicePurchaseTypeID: - // Decoding starTransactionTypeBotInvoicePurchase#1dddac0c. - v := StarTransactionTypeBotInvoicePurchase{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeBotInvoiceSaleTypeID: - // Decoding starTransactionTypeBotInvoiceSale#5b7d8d2f. - v := StarTransactionTypeBotInvoiceSale{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeBotSubscriptionPurchaseTypeID: - // Decoding starTransactionTypeBotSubscriptionPurchase#40bf1355. - v := StarTransactionTypeBotSubscriptionPurchase{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeBotSubscriptionSaleTypeID: - // Decoding starTransactionTypeBotSubscriptionSale#1f686889. - v := StarTransactionTypeBotSubscriptionSale{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeChannelSubscriptionPurchaseTypeID: - // Decoding starTransactionTypeChannelSubscriptionPurchase#380eb3d1. - v := StarTransactionTypeChannelSubscriptionPurchase{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeChannelSubscriptionSaleTypeID: - // Decoding starTransactionTypeChannelSubscriptionSale#fe127c82. - v := StarTransactionTypeChannelSubscriptionSale{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeGiftPurchaseTypeID: - // Decoding starTransactionTypeGiftPurchase#ef5f1d52. - v := StarTransactionTypeGiftPurchase{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeGiftTransferTypeID: - // Decoding starTransactionTypeGiftTransfer#ef323c55. - v := StarTransactionTypeGiftTransfer{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeGiftSaleTypeID: - // Decoding starTransactionTypeGiftSale#64d61157. - v := StarTransactionTypeGiftSale{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeGiftUpgradeTypeID: - // Decoding starTransactionTypeGiftUpgrade#2697844b. - v := StarTransactionTypeGiftUpgrade{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeChannelPaidReactionSendTypeID: - // Decoding starTransactionTypeChannelPaidReactionSend#c02667c0. - v := StarTransactionTypeChannelPaidReactionSend{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeChannelPaidReactionReceiveTypeID: - // Decoding starTransactionTypeChannelPaidReactionReceive#23d6f9eb. - v := StarTransactionTypeChannelPaidReactionReceive{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeAffiliateProgramCommissionTypeID: - // Decoding starTransactionTypeAffiliateProgramCommission#9a637573. - v := StarTransactionTypeAffiliateProgramCommission{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case StarTransactionTypeUnsupportedTypeID: - // Decoding starTransactionTypeUnsupported#76cfcab2. - v := StarTransactionTypeUnsupported{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStarTransactionType implements binary de-serialization for StarTransactionTypeClass. -func DecodeTDLibJSONStarTransactionType(buf tdjson.Decoder) (StarTransactionTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "starTransactionTypePremiumBotDeposit": - // Decoding starTransactionTypePremiumBotDeposit#d879090e. - v := StarTransactionTypePremiumBotDeposit{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeAppStoreDeposit": - // Decoding starTransactionTypeAppStoreDeposit#8283941. - v := StarTransactionTypeAppStoreDeposit{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeGooglePlayDeposit": - // Decoding starTransactionTypeGooglePlayDeposit#ecbdb656. - v := StarTransactionTypeGooglePlayDeposit{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeFragmentDeposit": - // Decoding starTransactionTypeFragmentDeposit#7625e44. - v := StarTransactionTypeFragmentDeposit{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeUserDeposit": - // Decoding starTransactionTypeUserDeposit#c2a18e9. - v := StarTransactionTypeUserDeposit{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeGiveawayDeposit": - // Decoding starTransactionTypeGiveawayDeposit#b16200c6. - v := StarTransactionTypeGiveawayDeposit{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeFragmentWithdrawal": - // Decoding starTransactionTypeFragmentWithdrawal#af3a2992. - v := StarTransactionTypeFragmentWithdrawal{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeTelegramAdsWithdrawal": - // Decoding starTransactionTypeTelegramAdsWithdrawal#a58e8469. - v := StarTransactionTypeTelegramAdsWithdrawal{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeTelegramApiUsage": - // Decoding starTransactionTypeTelegramApiUsage#27a82afe. - v := StarTransactionTypeTelegramAPIUsage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeBotPaidMediaPurchase": - // Decoding starTransactionTypeBotPaidMediaPurchase#7f48cc6a. - v := StarTransactionTypeBotPaidMediaPurchase{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeBotPaidMediaSale": - // Decoding starTransactionTypeBotPaidMediaSale#6e07eeb2. - v := StarTransactionTypeBotPaidMediaSale{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeChannelPaidMediaPurchase": - // Decoding starTransactionTypeChannelPaidMediaPurchase#9016d4f5. - v := StarTransactionTypeChannelPaidMediaPurchase{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeChannelPaidMediaSale": - // Decoding starTransactionTypeChannelPaidMediaSale#eace92ef. - v := StarTransactionTypeChannelPaidMediaSale{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeBotInvoicePurchase": - // Decoding starTransactionTypeBotInvoicePurchase#1dddac0c. - v := StarTransactionTypeBotInvoicePurchase{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeBotInvoiceSale": - // Decoding starTransactionTypeBotInvoiceSale#5b7d8d2f. - v := StarTransactionTypeBotInvoiceSale{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeBotSubscriptionPurchase": - // Decoding starTransactionTypeBotSubscriptionPurchase#40bf1355. - v := StarTransactionTypeBotSubscriptionPurchase{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeBotSubscriptionSale": - // Decoding starTransactionTypeBotSubscriptionSale#1f686889. - v := StarTransactionTypeBotSubscriptionSale{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeChannelSubscriptionPurchase": - // Decoding starTransactionTypeChannelSubscriptionPurchase#380eb3d1. - v := StarTransactionTypeChannelSubscriptionPurchase{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeChannelSubscriptionSale": - // Decoding starTransactionTypeChannelSubscriptionSale#fe127c82. - v := StarTransactionTypeChannelSubscriptionSale{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeGiftPurchase": - // Decoding starTransactionTypeGiftPurchase#ef5f1d52. - v := StarTransactionTypeGiftPurchase{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeGiftTransfer": - // Decoding starTransactionTypeGiftTransfer#ef323c55. - v := StarTransactionTypeGiftTransfer{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeGiftSale": - // Decoding starTransactionTypeGiftSale#64d61157. - v := StarTransactionTypeGiftSale{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeGiftUpgrade": - // Decoding starTransactionTypeGiftUpgrade#2697844b. - v := StarTransactionTypeGiftUpgrade{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeChannelPaidReactionSend": - // Decoding starTransactionTypeChannelPaidReactionSend#c02667c0. - v := StarTransactionTypeChannelPaidReactionSend{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeChannelPaidReactionReceive": - // Decoding starTransactionTypeChannelPaidReactionReceive#23d6f9eb. - v := StarTransactionTypeChannelPaidReactionReceive{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeAffiliateProgramCommission": - // Decoding starTransactionTypeAffiliateProgramCommission#9a637573. - v := StarTransactionTypeAffiliateProgramCommission{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - case "starTransactionTypeUnsupported": - // Decoding starTransactionTypeUnsupported#76cfcab2. - v := StarTransactionTypeUnsupported{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StarTransactionTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StarTransactionType boxes the StarTransactionTypeClass providing a helper. -type StarTransactionTypeBox struct { - StarTransactionType StarTransactionTypeClass -} - -// Decode implements bin.Decoder for StarTransactionTypeBox. -func (b *StarTransactionTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StarTransactionTypeBox to nil") - } - v, err := DecodeStarTransactionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StarTransactionType = v - return nil -} - -// Encode implements bin.Encode for StarTransactionTypeBox. -func (b *StarTransactionTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StarTransactionType == nil { - return fmt.Errorf("unable to encode StarTransactionTypeClass as nil") - } - return b.StarTransactionType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StarTransactionTypeBox. -func (b *StarTransactionTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StarTransactionTypeBox to nil") - } - v, err := DecodeTDLibJSONStarTransactionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StarTransactionType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StarTransactionTypeBox. -func (b *StarTransactionTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StarTransactionType == nil { - return fmt.Errorf("unable to encode StarTransactionTypeClass as nil") - } - return b.StarTransactionType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_star_transactions_gen.go b/tdapi/tl_star_transactions_gen.go deleted file mode 100644 index 79d265adf..000000000 --- a/tdapi/tl_star_transactions_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StarTransactions represents TL type `starTransactions#b5f5820b`. -type StarTransactions struct { - // The amount of owned Telegram Stars - StarAmount StarAmount - // List of transactions with Telegram Stars - Transactions []StarTransaction - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// StarTransactionsTypeID is TL type id of StarTransactions. -const StarTransactionsTypeID = 0xb5f5820b - -// Ensuring interfaces in compile-time for StarTransactions. -var ( - _ bin.Encoder = &StarTransactions{} - _ bin.Decoder = &StarTransactions{} - _ bin.BareEncoder = &StarTransactions{} - _ bin.BareDecoder = &StarTransactions{} -) - -func (s *StarTransactions) Zero() bool { - if s == nil { - return true - } - if !(s.StarAmount.Zero()) { - return false - } - if !(s.Transactions == nil) { - return false - } - if !(s.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StarTransactions) String() string { - if s == nil { - return "StarTransactions(nil)" - } - type Alias StarTransactions - return fmt.Sprintf("StarTransactions%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StarTransactions) TypeID() uint32 { - return StarTransactionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StarTransactions) TypeName() string { - return "starTransactions" -} - -// TypeInfo returns info about TL type. -func (s *StarTransactions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "starTransactions", - ID: StarTransactionsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarAmount", - SchemaName: "star_amount", - }, - { - Name: "Transactions", - SchemaName: "transactions", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StarTransactions) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactions#b5f5820b as nil") - } - b.PutID(StarTransactionsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StarTransactions) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode starTransactions#b5f5820b as nil") - } - if err := s.StarAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode starTransactions#b5f5820b: field star_amount: %w", err) - } - b.PutInt(len(s.Transactions)) - for idx, v := range s.Transactions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare starTransactions#b5f5820b: field transactions element with index %d: %w", idx, err) - } - } - b.PutString(s.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (s *StarTransactions) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactions#b5f5820b to nil") - } - if err := b.ConsumeID(StarTransactionsTypeID); err != nil { - return fmt.Errorf("unable to decode starTransactions#b5f5820b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StarTransactions) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode starTransactions#b5f5820b to nil") - } - { - if err := s.StarAmount.Decode(b); err != nil { - return fmt.Errorf("unable to decode starTransactions#b5f5820b: field star_amount: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode starTransactions#b5f5820b: field transactions: %w", err) - } - - if headerLen > 0 { - s.Transactions = make([]StarTransaction, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StarTransaction - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare starTransactions#b5f5820b: field transactions: %w", err) - } - s.Transactions = append(s.Transactions, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starTransactions#b5f5820b: field next_offset: %w", err) - } - s.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StarTransactions) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode starTransactions#b5f5820b as nil") - } - b.ObjStart() - b.PutID("starTransactions") - b.Comma() - b.FieldStart("star_amount") - if err := s.StarAmount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactions#b5f5820b: field star_amount: %w", err) - } - b.Comma() - b.FieldStart("transactions") - b.ArrStart() - for idx, v := range s.Transactions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode starTransactions#b5f5820b: field transactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(s.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StarTransactions) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode starTransactions#b5f5820b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("starTransactions"); err != nil { - return fmt.Errorf("unable to decode starTransactions#b5f5820b: %w", err) - } - case "star_amount": - if err := s.StarAmount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactions#b5f5820b: field star_amount: %w", err) - } - case "transactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StarTransaction - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode starTransactions#b5f5820b: field transactions: %w", err) - } - s.Transactions = append(s.Transactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode starTransactions#b5f5820b: field transactions: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode starTransactions#b5f5820b: field next_offset: %w", err) - } - s.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStarAmount returns value of StarAmount field. -func (s *StarTransactions) GetStarAmount() (value StarAmount) { - if s == nil { - return - } - return s.StarAmount -} - -// GetTransactions returns value of Transactions field. -func (s *StarTransactions) GetTransactions() (value []StarTransaction) { - if s == nil { - return - } - return s.Transactions -} - -// GetNextOffset returns value of NextOffset field. -func (s *StarTransactions) GetNextOffset() (value string) { - if s == nil { - return - } - return s.NextOffset -} diff --git a/tdapi/tl_start_group_call_recording_gen.go b/tdapi/tl_start_group_call_recording_gen.go deleted file mode 100644 index 78ad9a597..000000000 --- a/tdapi/tl_start_group_call_recording_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StartGroupCallRecordingRequest represents TL type `startGroupCallRecording#68c5847b`. -type StartGroupCallRecordingRequest struct { - // Group call identifier - GroupCallID int32 - // Group call recording title; 0-64 characters - Title string - // Pass true to record a video file instead of an audio file - RecordVideo bool - // Pass true to use portrait orientation for video instead of landscape one - UsePortraitOrientation bool -} - -// StartGroupCallRecordingRequestTypeID is TL type id of StartGroupCallRecordingRequest. -const StartGroupCallRecordingRequestTypeID = 0x68c5847b - -// Ensuring interfaces in compile-time for StartGroupCallRecordingRequest. -var ( - _ bin.Encoder = &StartGroupCallRecordingRequest{} - _ bin.Decoder = &StartGroupCallRecordingRequest{} - _ bin.BareEncoder = &StartGroupCallRecordingRequest{} - _ bin.BareDecoder = &StartGroupCallRecordingRequest{} -) - -func (s *StartGroupCallRecordingRequest) Zero() bool { - if s == nil { - return true - } - if !(s.GroupCallID == 0) { - return false - } - if !(s.Title == "") { - return false - } - if !(s.RecordVideo == false) { - return false - } - if !(s.UsePortraitOrientation == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StartGroupCallRecordingRequest) String() string { - if s == nil { - return "StartGroupCallRecordingRequest(nil)" - } - type Alias StartGroupCallRecordingRequest - return fmt.Sprintf("StartGroupCallRecordingRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StartGroupCallRecordingRequest) TypeID() uint32 { - return StartGroupCallRecordingRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*StartGroupCallRecordingRequest) TypeName() string { - return "startGroupCallRecording" -} - -// TypeInfo returns info about TL type. -func (s *StartGroupCallRecordingRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "startGroupCallRecording", - ID: StartGroupCallRecordingRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "RecordVideo", - SchemaName: "record_video", - }, - { - Name: "UsePortraitOrientation", - SchemaName: "use_portrait_orientation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StartGroupCallRecordingRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode startGroupCallRecording#68c5847b as nil") - } - b.PutID(StartGroupCallRecordingRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StartGroupCallRecordingRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode startGroupCallRecording#68c5847b as nil") - } - b.PutInt32(s.GroupCallID) - b.PutString(s.Title) - b.PutBool(s.RecordVideo) - b.PutBool(s.UsePortraitOrientation) - return nil -} - -// Decode implements bin.Decoder. -func (s *StartGroupCallRecordingRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode startGroupCallRecording#68c5847b to nil") - } - if err := b.ConsumeID(StartGroupCallRecordingRequestTypeID); err != nil { - return fmt.Errorf("unable to decode startGroupCallRecording#68c5847b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StartGroupCallRecordingRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode startGroupCallRecording#68c5847b to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallRecording#68c5847b: field group_call_id: %w", err) - } - s.GroupCallID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallRecording#68c5847b: field title: %w", err) - } - s.Title = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallRecording#68c5847b: field record_video: %w", err) - } - s.RecordVideo = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallRecording#68c5847b: field use_portrait_orientation: %w", err) - } - s.UsePortraitOrientation = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StartGroupCallRecordingRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode startGroupCallRecording#68c5847b as nil") - } - b.ObjStart() - b.PutID("startGroupCallRecording") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(s.GroupCallID) - b.Comma() - b.FieldStart("title") - b.PutString(s.Title) - b.Comma() - b.FieldStart("record_video") - b.PutBool(s.RecordVideo) - b.Comma() - b.FieldStart("use_portrait_orientation") - b.PutBool(s.UsePortraitOrientation) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StartGroupCallRecordingRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode startGroupCallRecording#68c5847b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("startGroupCallRecording"); err != nil { - return fmt.Errorf("unable to decode startGroupCallRecording#68c5847b: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallRecording#68c5847b: field group_call_id: %w", err) - } - s.GroupCallID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallRecording#68c5847b: field title: %w", err) - } - s.Title = value - case "record_video": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallRecording#68c5847b: field record_video: %w", err) - } - s.RecordVideo = value - case "use_portrait_orientation": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallRecording#68c5847b: field use_portrait_orientation: %w", err) - } - s.UsePortraitOrientation = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (s *StartGroupCallRecordingRequest) GetGroupCallID() (value int32) { - if s == nil { - return - } - return s.GroupCallID -} - -// GetTitle returns value of Title field. -func (s *StartGroupCallRecordingRequest) GetTitle() (value string) { - if s == nil { - return - } - return s.Title -} - -// GetRecordVideo returns value of RecordVideo field. -func (s *StartGroupCallRecordingRequest) GetRecordVideo() (value bool) { - if s == nil { - return - } - return s.RecordVideo -} - -// GetUsePortraitOrientation returns value of UsePortraitOrientation field. -func (s *StartGroupCallRecordingRequest) GetUsePortraitOrientation() (value bool) { - if s == nil { - return - } - return s.UsePortraitOrientation -} - -// StartGroupCallRecording invokes method startGroupCallRecording#68c5847b returning error if any. -func (c *Client) StartGroupCallRecording(ctx context.Context, request *StartGroupCallRecordingRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_start_group_call_screen_sharing_gen.go b/tdapi/tl_start_group_call_screen_sharing_gen.go deleted file mode 100644 index be638d96b..000000000 --- a/tdapi/tl_start_group_call_screen_sharing_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StartGroupCallScreenSharingRequest represents TL type `startGroupCallScreenSharing#cb4e312d`. -type StartGroupCallScreenSharingRequest struct { - // Group call identifier - GroupCallID int32 - // Screen sharing audio channel synchronization source identifier; received from tgcalls - AudioSourceID int32 - // Group call join payload; received from tgcalls - Payload string -} - -// StartGroupCallScreenSharingRequestTypeID is TL type id of StartGroupCallScreenSharingRequest. -const StartGroupCallScreenSharingRequestTypeID = 0xcb4e312d - -// Ensuring interfaces in compile-time for StartGroupCallScreenSharingRequest. -var ( - _ bin.Encoder = &StartGroupCallScreenSharingRequest{} - _ bin.Decoder = &StartGroupCallScreenSharingRequest{} - _ bin.BareEncoder = &StartGroupCallScreenSharingRequest{} - _ bin.BareDecoder = &StartGroupCallScreenSharingRequest{} -) - -func (s *StartGroupCallScreenSharingRequest) Zero() bool { - if s == nil { - return true - } - if !(s.GroupCallID == 0) { - return false - } - if !(s.AudioSourceID == 0) { - return false - } - if !(s.Payload == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StartGroupCallScreenSharingRequest) String() string { - if s == nil { - return "StartGroupCallScreenSharingRequest(nil)" - } - type Alias StartGroupCallScreenSharingRequest - return fmt.Sprintf("StartGroupCallScreenSharingRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StartGroupCallScreenSharingRequest) TypeID() uint32 { - return StartGroupCallScreenSharingRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*StartGroupCallScreenSharingRequest) TypeName() string { - return "startGroupCallScreenSharing" -} - -// TypeInfo returns info about TL type. -func (s *StartGroupCallScreenSharingRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "startGroupCallScreenSharing", - ID: StartGroupCallScreenSharingRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "AudioSourceID", - SchemaName: "audio_source_id", - }, - { - Name: "Payload", - SchemaName: "payload", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StartGroupCallScreenSharingRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode startGroupCallScreenSharing#cb4e312d as nil") - } - b.PutID(StartGroupCallScreenSharingRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StartGroupCallScreenSharingRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode startGroupCallScreenSharing#cb4e312d as nil") - } - b.PutInt32(s.GroupCallID) - b.PutInt32(s.AudioSourceID) - b.PutString(s.Payload) - return nil -} - -// Decode implements bin.Decoder. -func (s *StartGroupCallScreenSharingRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode startGroupCallScreenSharing#cb4e312d to nil") - } - if err := b.ConsumeID(StartGroupCallScreenSharingRequestTypeID); err != nil { - return fmt.Errorf("unable to decode startGroupCallScreenSharing#cb4e312d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StartGroupCallScreenSharingRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode startGroupCallScreenSharing#cb4e312d to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallScreenSharing#cb4e312d: field group_call_id: %w", err) - } - s.GroupCallID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallScreenSharing#cb4e312d: field audio_source_id: %w", err) - } - s.AudioSourceID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallScreenSharing#cb4e312d: field payload: %w", err) - } - s.Payload = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StartGroupCallScreenSharingRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode startGroupCallScreenSharing#cb4e312d as nil") - } - b.ObjStart() - b.PutID("startGroupCallScreenSharing") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(s.GroupCallID) - b.Comma() - b.FieldStart("audio_source_id") - b.PutInt32(s.AudioSourceID) - b.Comma() - b.FieldStart("payload") - b.PutString(s.Payload) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StartGroupCallScreenSharingRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode startGroupCallScreenSharing#cb4e312d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("startGroupCallScreenSharing"); err != nil { - return fmt.Errorf("unable to decode startGroupCallScreenSharing#cb4e312d: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallScreenSharing#cb4e312d: field group_call_id: %w", err) - } - s.GroupCallID = value - case "audio_source_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallScreenSharing#cb4e312d: field audio_source_id: %w", err) - } - s.AudioSourceID = value - case "payload": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode startGroupCallScreenSharing#cb4e312d: field payload: %w", err) - } - s.Payload = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (s *StartGroupCallScreenSharingRequest) GetGroupCallID() (value int32) { - if s == nil { - return - } - return s.GroupCallID -} - -// GetAudioSourceID returns value of AudioSourceID field. -func (s *StartGroupCallScreenSharingRequest) GetAudioSourceID() (value int32) { - if s == nil { - return - } - return s.AudioSourceID -} - -// GetPayload returns value of Payload field. -func (s *StartGroupCallScreenSharingRequest) GetPayload() (value string) { - if s == nil { - return - } - return s.Payload -} - -// StartGroupCallScreenSharing invokes method startGroupCallScreenSharing#cb4e312d returning error if any. -func (c *Client) StartGroupCallScreenSharing(ctx context.Context, request *StartGroupCallScreenSharingRequest) (*Text, error) { - var result Text - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_start_scheduled_group_call_gen.go b/tdapi/tl_start_scheduled_group_call_gen.go deleted file mode 100644 index a5e221faa..000000000 --- a/tdapi/tl_start_scheduled_group_call_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StartScheduledGroupCallRequest represents TL type `startScheduledGroupCall#5a986d16`. -type StartScheduledGroupCallRequest struct { - // Group call identifier - GroupCallID int32 -} - -// StartScheduledGroupCallRequestTypeID is TL type id of StartScheduledGroupCallRequest. -const StartScheduledGroupCallRequestTypeID = 0x5a986d16 - -// Ensuring interfaces in compile-time for StartScheduledGroupCallRequest. -var ( - _ bin.Encoder = &StartScheduledGroupCallRequest{} - _ bin.Decoder = &StartScheduledGroupCallRequest{} - _ bin.BareEncoder = &StartScheduledGroupCallRequest{} - _ bin.BareDecoder = &StartScheduledGroupCallRequest{} -) - -func (s *StartScheduledGroupCallRequest) Zero() bool { - if s == nil { - return true - } - if !(s.GroupCallID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StartScheduledGroupCallRequest) String() string { - if s == nil { - return "StartScheduledGroupCallRequest(nil)" - } - type Alias StartScheduledGroupCallRequest - return fmt.Sprintf("StartScheduledGroupCallRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StartScheduledGroupCallRequest) TypeID() uint32 { - return StartScheduledGroupCallRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*StartScheduledGroupCallRequest) TypeName() string { - return "startScheduledGroupCall" -} - -// TypeInfo returns info about TL type. -func (s *StartScheduledGroupCallRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "startScheduledGroupCall", - ID: StartScheduledGroupCallRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StartScheduledGroupCallRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode startScheduledGroupCall#5a986d16 as nil") - } - b.PutID(StartScheduledGroupCallRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StartScheduledGroupCallRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode startScheduledGroupCall#5a986d16 as nil") - } - b.PutInt32(s.GroupCallID) - return nil -} - -// Decode implements bin.Decoder. -func (s *StartScheduledGroupCallRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode startScheduledGroupCall#5a986d16 to nil") - } - if err := b.ConsumeID(StartScheduledGroupCallRequestTypeID); err != nil { - return fmt.Errorf("unable to decode startScheduledGroupCall#5a986d16: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StartScheduledGroupCallRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode startScheduledGroupCall#5a986d16 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode startScheduledGroupCall#5a986d16: field group_call_id: %w", err) - } - s.GroupCallID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StartScheduledGroupCallRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode startScheduledGroupCall#5a986d16 as nil") - } - b.ObjStart() - b.PutID("startScheduledGroupCall") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(s.GroupCallID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StartScheduledGroupCallRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode startScheduledGroupCall#5a986d16 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("startScheduledGroupCall"); err != nil { - return fmt.Errorf("unable to decode startScheduledGroupCall#5a986d16: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode startScheduledGroupCall#5a986d16: field group_call_id: %w", err) - } - s.GroupCallID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (s *StartScheduledGroupCallRequest) GetGroupCallID() (value int32) { - if s == nil { - return - } - return s.GroupCallID -} - -// StartScheduledGroupCall invokes method startScheduledGroupCall#5a986d16 returning error if any. -func (c *Client) StartScheduledGroupCall(ctx context.Context, groupcallid int32) error { - var ok Ok - - request := &StartScheduledGroupCallRequest{ - GroupCallID: groupcallid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_statistical_graph_gen.go b/tdapi/tl_statistical_graph_gen.go deleted file mode 100644 index 59d502446..000000000 --- a/tdapi/tl_statistical_graph_gen.go +++ /dev/null @@ -1,716 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StatisticalGraphData represents TL type `statisticalGraphData#89732e2c`. -type StatisticalGraphData struct { - // Graph data in JSON format - JSONData string - // If non-empty, a token which can be used to receive a zoomed in graph - ZoomToken string -} - -// StatisticalGraphDataTypeID is TL type id of StatisticalGraphData. -const StatisticalGraphDataTypeID = 0x89732e2c - -// construct implements constructor of StatisticalGraphClass. -func (s StatisticalGraphData) construct() StatisticalGraphClass { return &s } - -// Ensuring interfaces in compile-time for StatisticalGraphData. -var ( - _ bin.Encoder = &StatisticalGraphData{} - _ bin.Decoder = &StatisticalGraphData{} - _ bin.BareEncoder = &StatisticalGraphData{} - _ bin.BareDecoder = &StatisticalGraphData{} - - _ StatisticalGraphClass = &StatisticalGraphData{} -) - -func (s *StatisticalGraphData) Zero() bool { - if s == nil { - return true - } - if !(s.JSONData == "") { - return false - } - if !(s.ZoomToken == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StatisticalGraphData) String() string { - if s == nil { - return "StatisticalGraphData(nil)" - } - type Alias StatisticalGraphData - return fmt.Sprintf("StatisticalGraphData%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StatisticalGraphData) TypeID() uint32 { - return StatisticalGraphDataTypeID -} - -// TypeName returns name of type in TL schema. -func (*StatisticalGraphData) TypeName() string { - return "statisticalGraphData" -} - -// TypeInfo returns info about TL type. -func (s *StatisticalGraphData) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "statisticalGraphData", - ID: StatisticalGraphDataTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "JSONData", - SchemaName: "json_data", - }, - { - Name: "ZoomToken", - SchemaName: "zoom_token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StatisticalGraphData) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode statisticalGraphData#89732e2c as nil") - } - b.PutID(StatisticalGraphDataTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StatisticalGraphData) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode statisticalGraphData#89732e2c as nil") - } - b.PutString(s.JSONData) - b.PutString(s.ZoomToken) - return nil -} - -// Decode implements bin.Decoder. -func (s *StatisticalGraphData) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode statisticalGraphData#89732e2c to nil") - } - if err := b.ConsumeID(StatisticalGraphDataTypeID); err != nil { - return fmt.Errorf("unable to decode statisticalGraphData#89732e2c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StatisticalGraphData) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode statisticalGraphData#89732e2c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode statisticalGraphData#89732e2c: field json_data: %w", err) - } - s.JSONData = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode statisticalGraphData#89732e2c: field zoom_token: %w", err) - } - s.ZoomToken = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StatisticalGraphData) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode statisticalGraphData#89732e2c as nil") - } - b.ObjStart() - b.PutID("statisticalGraphData") - b.Comma() - b.FieldStart("json_data") - b.PutString(s.JSONData) - b.Comma() - b.FieldStart("zoom_token") - b.PutString(s.ZoomToken) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StatisticalGraphData) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode statisticalGraphData#89732e2c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("statisticalGraphData"); err != nil { - return fmt.Errorf("unable to decode statisticalGraphData#89732e2c: %w", err) - } - case "json_data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode statisticalGraphData#89732e2c: field json_data: %w", err) - } - s.JSONData = value - case "zoom_token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode statisticalGraphData#89732e2c: field zoom_token: %w", err) - } - s.ZoomToken = value - default: - return b.Skip() - } - return nil - }) -} - -// GetJSONData returns value of JSONData field. -func (s *StatisticalGraphData) GetJSONData() (value string) { - if s == nil { - return - } - return s.JSONData -} - -// GetZoomToken returns value of ZoomToken field. -func (s *StatisticalGraphData) GetZoomToken() (value string) { - if s == nil { - return - } - return s.ZoomToken -} - -// StatisticalGraphAsync represents TL type `statisticalGraphAsync#19fb2b9f`. -type StatisticalGraphAsync struct { - // The token to use for data loading - Token string -} - -// StatisticalGraphAsyncTypeID is TL type id of StatisticalGraphAsync. -const StatisticalGraphAsyncTypeID = 0x19fb2b9f - -// construct implements constructor of StatisticalGraphClass. -func (s StatisticalGraphAsync) construct() StatisticalGraphClass { return &s } - -// Ensuring interfaces in compile-time for StatisticalGraphAsync. -var ( - _ bin.Encoder = &StatisticalGraphAsync{} - _ bin.Decoder = &StatisticalGraphAsync{} - _ bin.BareEncoder = &StatisticalGraphAsync{} - _ bin.BareDecoder = &StatisticalGraphAsync{} - - _ StatisticalGraphClass = &StatisticalGraphAsync{} -) - -func (s *StatisticalGraphAsync) Zero() bool { - if s == nil { - return true - } - if !(s.Token == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StatisticalGraphAsync) String() string { - if s == nil { - return "StatisticalGraphAsync(nil)" - } - type Alias StatisticalGraphAsync - return fmt.Sprintf("StatisticalGraphAsync%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StatisticalGraphAsync) TypeID() uint32 { - return StatisticalGraphAsyncTypeID -} - -// TypeName returns name of type in TL schema. -func (*StatisticalGraphAsync) TypeName() string { - return "statisticalGraphAsync" -} - -// TypeInfo returns info about TL type. -func (s *StatisticalGraphAsync) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "statisticalGraphAsync", - ID: StatisticalGraphAsyncTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Token", - SchemaName: "token", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StatisticalGraphAsync) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode statisticalGraphAsync#19fb2b9f as nil") - } - b.PutID(StatisticalGraphAsyncTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StatisticalGraphAsync) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode statisticalGraphAsync#19fb2b9f as nil") - } - b.PutString(s.Token) - return nil -} - -// Decode implements bin.Decoder. -func (s *StatisticalGraphAsync) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode statisticalGraphAsync#19fb2b9f to nil") - } - if err := b.ConsumeID(StatisticalGraphAsyncTypeID); err != nil { - return fmt.Errorf("unable to decode statisticalGraphAsync#19fb2b9f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StatisticalGraphAsync) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode statisticalGraphAsync#19fb2b9f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode statisticalGraphAsync#19fb2b9f: field token: %w", err) - } - s.Token = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StatisticalGraphAsync) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode statisticalGraphAsync#19fb2b9f as nil") - } - b.ObjStart() - b.PutID("statisticalGraphAsync") - b.Comma() - b.FieldStart("token") - b.PutString(s.Token) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StatisticalGraphAsync) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode statisticalGraphAsync#19fb2b9f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("statisticalGraphAsync"); err != nil { - return fmt.Errorf("unable to decode statisticalGraphAsync#19fb2b9f: %w", err) - } - case "token": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode statisticalGraphAsync#19fb2b9f: field token: %w", err) - } - s.Token = value - default: - return b.Skip() - } - return nil - }) -} - -// GetToken returns value of Token field. -func (s *StatisticalGraphAsync) GetToken() (value string) { - if s == nil { - return - } - return s.Token -} - -// StatisticalGraphError represents TL type `statisticalGraphError#c3fda052`. -type StatisticalGraphError struct { - // The error message - ErrorMessage string -} - -// StatisticalGraphErrorTypeID is TL type id of StatisticalGraphError. -const StatisticalGraphErrorTypeID = 0xc3fda052 - -// construct implements constructor of StatisticalGraphClass. -func (s StatisticalGraphError) construct() StatisticalGraphClass { return &s } - -// Ensuring interfaces in compile-time for StatisticalGraphError. -var ( - _ bin.Encoder = &StatisticalGraphError{} - _ bin.Decoder = &StatisticalGraphError{} - _ bin.BareEncoder = &StatisticalGraphError{} - _ bin.BareDecoder = &StatisticalGraphError{} - - _ StatisticalGraphClass = &StatisticalGraphError{} -) - -func (s *StatisticalGraphError) Zero() bool { - if s == nil { - return true - } - if !(s.ErrorMessage == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StatisticalGraphError) String() string { - if s == nil { - return "StatisticalGraphError(nil)" - } - type Alias StatisticalGraphError - return fmt.Sprintf("StatisticalGraphError%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StatisticalGraphError) TypeID() uint32 { - return StatisticalGraphErrorTypeID -} - -// TypeName returns name of type in TL schema. -func (*StatisticalGraphError) TypeName() string { - return "statisticalGraphError" -} - -// TypeInfo returns info about TL type. -func (s *StatisticalGraphError) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "statisticalGraphError", - ID: StatisticalGraphErrorTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ErrorMessage", - SchemaName: "error_message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StatisticalGraphError) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode statisticalGraphError#c3fda052 as nil") - } - b.PutID(StatisticalGraphErrorTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StatisticalGraphError) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode statisticalGraphError#c3fda052 as nil") - } - b.PutString(s.ErrorMessage) - return nil -} - -// Decode implements bin.Decoder. -func (s *StatisticalGraphError) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode statisticalGraphError#c3fda052 to nil") - } - if err := b.ConsumeID(StatisticalGraphErrorTypeID); err != nil { - return fmt.Errorf("unable to decode statisticalGraphError#c3fda052: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StatisticalGraphError) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode statisticalGraphError#c3fda052 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode statisticalGraphError#c3fda052: field error_message: %w", err) - } - s.ErrorMessage = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StatisticalGraphError) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode statisticalGraphError#c3fda052 as nil") - } - b.ObjStart() - b.PutID("statisticalGraphError") - b.Comma() - b.FieldStart("error_message") - b.PutString(s.ErrorMessage) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StatisticalGraphError) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode statisticalGraphError#c3fda052 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("statisticalGraphError"); err != nil { - return fmt.Errorf("unable to decode statisticalGraphError#c3fda052: %w", err) - } - case "error_message": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode statisticalGraphError#c3fda052: field error_message: %w", err) - } - s.ErrorMessage = value - default: - return b.Skip() - } - return nil - }) -} - -// GetErrorMessage returns value of ErrorMessage field. -func (s *StatisticalGraphError) GetErrorMessage() (value string) { - if s == nil { - return - } - return s.ErrorMessage -} - -// StatisticalGraphClassName is schema name of StatisticalGraphClass. -const StatisticalGraphClassName = "StatisticalGraph" - -// StatisticalGraphClass represents StatisticalGraph generic type. -// -// Example: -// -// g, err := tdapi.DecodeStatisticalGraph(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StatisticalGraphData: // statisticalGraphData#89732e2c -// case *tdapi.StatisticalGraphAsync: // statisticalGraphAsync#19fb2b9f -// case *tdapi.StatisticalGraphError: // statisticalGraphError#c3fda052 -// default: panic(v) -// } -type StatisticalGraphClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StatisticalGraphClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStatisticalGraph implements binary de-serialization for StatisticalGraphClass. -func DecodeStatisticalGraph(buf *bin.Buffer) (StatisticalGraphClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StatisticalGraphDataTypeID: - // Decoding statisticalGraphData#89732e2c. - v := StatisticalGraphData{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StatisticalGraphClass: %w", err) - } - return &v, nil - case StatisticalGraphAsyncTypeID: - // Decoding statisticalGraphAsync#19fb2b9f. - v := StatisticalGraphAsync{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StatisticalGraphClass: %w", err) - } - return &v, nil - case StatisticalGraphErrorTypeID: - // Decoding statisticalGraphError#c3fda052. - v := StatisticalGraphError{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StatisticalGraphClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StatisticalGraphClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStatisticalGraph implements binary de-serialization for StatisticalGraphClass. -func DecodeTDLibJSONStatisticalGraph(buf tdjson.Decoder) (StatisticalGraphClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "statisticalGraphData": - // Decoding statisticalGraphData#89732e2c. - v := StatisticalGraphData{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StatisticalGraphClass: %w", err) - } - return &v, nil - case "statisticalGraphAsync": - // Decoding statisticalGraphAsync#19fb2b9f. - v := StatisticalGraphAsync{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StatisticalGraphClass: %w", err) - } - return &v, nil - case "statisticalGraphError": - // Decoding statisticalGraphError#c3fda052. - v := StatisticalGraphError{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StatisticalGraphClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StatisticalGraphClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StatisticalGraph boxes the StatisticalGraphClass providing a helper. -type StatisticalGraphBox struct { - StatisticalGraph StatisticalGraphClass -} - -// Decode implements bin.Decoder for StatisticalGraphBox. -func (b *StatisticalGraphBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StatisticalGraphBox to nil") - } - v, err := DecodeStatisticalGraph(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StatisticalGraph = v - return nil -} - -// Encode implements bin.Encode for StatisticalGraphBox. -func (b *StatisticalGraphBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StatisticalGraph == nil { - return fmt.Errorf("unable to encode StatisticalGraphClass as nil") - } - return b.StatisticalGraph.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StatisticalGraphBox. -func (b *StatisticalGraphBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StatisticalGraphBox to nil") - } - v, err := DecodeTDLibJSONStatisticalGraph(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StatisticalGraph = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StatisticalGraphBox. -func (b *StatisticalGraphBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StatisticalGraph == nil { - return fmt.Errorf("unable to encode StatisticalGraphClass as nil") - } - return b.StatisticalGraph.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_statistical_value_gen.go b/tdapi/tl_statistical_value_gen.go deleted file mode 100644 index b9711abaf..000000000 --- a/tdapi/tl_statistical_value_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StatisticalValue represents TL type `statisticalValue#626d6a76`. -type StatisticalValue struct { - // The current value - Value float64 - // The value for the previous day - PreviousValue float64 - // The growth rate of the value, as a percentage - GrowthRatePercentage float64 -} - -// StatisticalValueTypeID is TL type id of StatisticalValue. -const StatisticalValueTypeID = 0x626d6a76 - -// Ensuring interfaces in compile-time for StatisticalValue. -var ( - _ bin.Encoder = &StatisticalValue{} - _ bin.Decoder = &StatisticalValue{} - _ bin.BareEncoder = &StatisticalValue{} - _ bin.BareDecoder = &StatisticalValue{} -) - -func (s *StatisticalValue) Zero() bool { - if s == nil { - return true - } - if !(s.Value == 0) { - return false - } - if !(s.PreviousValue == 0) { - return false - } - if !(s.GrowthRatePercentage == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StatisticalValue) String() string { - if s == nil { - return "StatisticalValue(nil)" - } - type Alias StatisticalValue - return fmt.Sprintf("StatisticalValue%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StatisticalValue) TypeID() uint32 { - return StatisticalValueTypeID -} - -// TypeName returns name of type in TL schema. -func (*StatisticalValue) TypeName() string { - return "statisticalValue" -} - -// TypeInfo returns info about TL type. -func (s *StatisticalValue) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "statisticalValue", - ID: StatisticalValueTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - { - Name: "PreviousValue", - SchemaName: "previous_value", - }, - { - Name: "GrowthRatePercentage", - SchemaName: "growth_rate_percentage", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StatisticalValue) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode statisticalValue#626d6a76 as nil") - } - b.PutID(StatisticalValueTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StatisticalValue) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode statisticalValue#626d6a76 as nil") - } - b.PutDouble(s.Value) - b.PutDouble(s.PreviousValue) - b.PutDouble(s.GrowthRatePercentage) - return nil -} - -// Decode implements bin.Decoder. -func (s *StatisticalValue) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode statisticalValue#626d6a76 to nil") - } - if err := b.ConsumeID(StatisticalValueTypeID); err != nil { - return fmt.Errorf("unable to decode statisticalValue#626d6a76: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StatisticalValue) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode statisticalValue#626d6a76 to nil") - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode statisticalValue#626d6a76: field value: %w", err) - } - s.Value = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode statisticalValue#626d6a76: field previous_value: %w", err) - } - s.PreviousValue = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode statisticalValue#626d6a76: field growth_rate_percentage: %w", err) - } - s.GrowthRatePercentage = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StatisticalValue) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode statisticalValue#626d6a76 as nil") - } - b.ObjStart() - b.PutID("statisticalValue") - b.Comma() - b.FieldStart("value") - b.PutDouble(s.Value) - b.Comma() - b.FieldStart("previous_value") - b.PutDouble(s.PreviousValue) - b.Comma() - b.FieldStart("growth_rate_percentage") - b.PutDouble(s.GrowthRatePercentage) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StatisticalValue) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode statisticalValue#626d6a76 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("statisticalValue"); err != nil { - return fmt.Errorf("unable to decode statisticalValue#626d6a76: %w", err) - } - case "value": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode statisticalValue#626d6a76: field value: %w", err) - } - s.Value = value - case "previous_value": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode statisticalValue#626d6a76: field previous_value: %w", err) - } - s.PreviousValue = value - case "growth_rate_percentage": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode statisticalValue#626d6a76: field growth_rate_percentage: %w", err) - } - s.GrowthRatePercentage = value - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (s *StatisticalValue) GetValue() (value float64) { - if s == nil { - return - } - return s.Value -} - -// GetPreviousValue returns value of PreviousValue field. -func (s *StatisticalValue) GetPreviousValue() (value float64) { - if s == nil { - return - } - return s.PreviousValue -} - -// GetGrowthRatePercentage returns value of GrowthRatePercentage field. -func (s *StatisticalValue) GetGrowthRatePercentage() (value float64) { - if s == nil { - return - } - return s.GrowthRatePercentage -} diff --git a/tdapi/tl_sticker_format_gen.go b/tdapi/tl_sticker_format_gen.go deleted file mode 100644 index 7be955599..000000000 --- a/tdapi/tl_sticker_format_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StickerFormatWebp represents TL type `stickerFormatWebp#8174ef20`. -type StickerFormatWebp struct { -} - -// StickerFormatWebpTypeID is TL type id of StickerFormatWebp. -const StickerFormatWebpTypeID = 0x8174ef20 - -// construct implements constructor of StickerFormatClass. -func (s StickerFormatWebp) construct() StickerFormatClass { return &s } - -// Ensuring interfaces in compile-time for StickerFormatWebp. -var ( - _ bin.Encoder = &StickerFormatWebp{} - _ bin.Decoder = &StickerFormatWebp{} - _ bin.BareEncoder = &StickerFormatWebp{} - _ bin.BareDecoder = &StickerFormatWebp{} - - _ StickerFormatClass = &StickerFormatWebp{} -) - -func (s *StickerFormatWebp) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerFormatWebp) String() string { - if s == nil { - return "StickerFormatWebp(nil)" - } - type Alias StickerFormatWebp - return fmt.Sprintf("StickerFormatWebp%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerFormatWebp) TypeID() uint32 { - return StickerFormatWebpTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerFormatWebp) TypeName() string { - return "stickerFormatWebp" -} - -// TypeInfo returns info about TL type. -func (s *StickerFormatWebp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerFormatWebp", - ID: StickerFormatWebpTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerFormatWebp) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFormatWebp#8174ef20 as nil") - } - b.PutID(StickerFormatWebpTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerFormatWebp) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFormatWebp#8174ef20 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerFormatWebp) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFormatWebp#8174ef20 to nil") - } - if err := b.ConsumeID(StickerFormatWebpTypeID); err != nil { - return fmt.Errorf("unable to decode stickerFormatWebp#8174ef20: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerFormatWebp) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFormatWebp#8174ef20 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerFormatWebp) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerFormatWebp#8174ef20 as nil") - } - b.ObjStart() - b.PutID("stickerFormatWebp") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerFormatWebp) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerFormatWebp#8174ef20 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerFormatWebp"); err != nil { - return fmt.Errorf("unable to decode stickerFormatWebp#8174ef20: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StickerFormatTgs represents TL type `stickerFormatTgs#603caaf6`. -type StickerFormatTgs struct { -} - -// StickerFormatTgsTypeID is TL type id of StickerFormatTgs. -const StickerFormatTgsTypeID = 0x603caaf6 - -// construct implements constructor of StickerFormatClass. -func (s StickerFormatTgs) construct() StickerFormatClass { return &s } - -// Ensuring interfaces in compile-time for StickerFormatTgs. -var ( - _ bin.Encoder = &StickerFormatTgs{} - _ bin.Decoder = &StickerFormatTgs{} - _ bin.BareEncoder = &StickerFormatTgs{} - _ bin.BareDecoder = &StickerFormatTgs{} - - _ StickerFormatClass = &StickerFormatTgs{} -) - -func (s *StickerFormatTgs) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerFormatTgs) String() string { - if s == nil { - return "StickerFormatTgs(nil)" - } - type Alias StickerFormatTgs - return fmt.Sprintf("StickerFormatTgs%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerFormatTgs) TypeID() uint32 { - return StickerFormatTgsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerFormatTgs) TypeName() string { - return "stickerFormatTgs" -} - -// TypeInfo returns info about TL type. -func (s *StickerFormatTgs) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerFormatTgs", - ID: StickerFormatTgsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerFormatTgs) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFormatTgs#603caaf6 as nil") - } - b.PutID(StickerFormatTgsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerFormatTgs) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFormatTgs#603caaf6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerFormatTgs) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFormatTgs#603caaf6 to nil") - } - if err := b.ConsumeID(StickerFormatTgsTypeID); err != nil { - return fmt.Errorf("unable to decode stickerFormatTgs#603caaf6: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerFormatTgs) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFormatTgs#603caaf6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerFormatTgs) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerFormatTgs#603caaf6 as nil") - } - b.ObjStart() - b.PutID("stickerFormatTgs") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerFormatTgs) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerFormatTgs#603caaf6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerFormatTgs"); err != nil { - return fmt.Errorf("unable to decode stickerFormatTgs#603caaf6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StickerFormatWebm represents TL type `stickerFormatWebm#849bd54f`. -type StickerFormatWebm struct { -} - -// StickerFormatWebmTypeID is TL type id of StickerFormatWebm. -const StickerFormatWebmTypeID = 0x849bd54f - -// construct implements constructor of StickerFormatClass. -func (s StickerFormatWebm) construct() StickerFormatClass { return &s } - -// Ensuring interfaces in compile-time for StickerFormatWebm. -var ( - _ bin.Encoder = &StickerFormatWebm{} - _ bin.Decoder = &StickerFormatWebm{} - _ bin.BareEncoder = &StickerFormatWebm{} - _ bin.BareDecoder = &StickerFormatWebm{} - - _ StickerFormatClass = &StickerFormatWebm{} -) - -func (s *StickerFormatWebm) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerFormatWebm) String() string { - if s == nil { - return "StickerFormatWebm(nil)" - } - type Alias StickerFormatWebm - return fmt.Sprintf("StickerFormatWebm%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerFormatWebm) TypeID() uint32 { - return StickerFormatWebmTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerFormatWebm) TypeName() string { - return "stickerFormatWebm" -} - -// TypeInfo returns info about TL type. -func (s *StickerFormatWebm) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerFormatWebm", - ID: StickerFormatWebmTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerFormatWebm) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFormatWebm#849bd54f as nil") - } - b.PutID(StickerFormatWebmTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerFormatWebm) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFormatWebm#849bd54f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerFormatWebm) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFormatWebm#849bd54f to nil") - } - if err := b.ConsumeID(StickerFormatWebmTypeID); err != nil { - return fmt.Errorf("unable to decode stickerFormatWebm#849bd54f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerFormatWebm) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFormatWebm#849bd54f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerFormatWebm) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerFormatWebm#849bd54f as nil") - } - b.ObjStart() - b.PutID("stickerFormatWebm") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerFormatWebm) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerFormatWebm#849bd54f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerFormatWebm"); err != nil { - return fmt.Errorf("unable to decode stickerFormatWebm#849bd54f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StickerFormatClassName is schema name of StickerFormatClass. -const StickerFormatClassName = "StickerFormat" - -// StickerFormatClass represents StickerFormat generic type. -// -// Example: -// -// g, err := tdapi.DecodeStickerFormat(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StickerFormatWebp: // stickerFormatWebp#8174ef20 -// case *tdapi.StickerFormatTgs: // stickerFormatTgs#603caaf6 -// case *tdapi.StickerFormatWebm: // stickerFormatWebm#849bd54f -// default: panic(v) -// } -type StickerFormatClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StickerFormatClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStickerFormat implements binary de-serialization for StickerFormatClass. -func DecodeStickerFormat(buf *bin.Buffer) (StickerFormatClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StickerFormatWebpTypeID: - // Decoding stickerFormatWebp#8174ef20. - v := StickerFormatWebp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFormatClass: %w", err) - } - return &v, nil - case StickerFormatTgsTypeID: - // Decoding stickerFormatTgs#603caaf6. - v := StickerFormatTgs{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFormatClass: %w", err) - } - return &v, nil - case StickerFormatWebmTypeID: - // Decoding stickerFormatWebm#849bd54f. - v := StickerFormatWebm{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFormatClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StickerFormatClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStickerFormat implements binary de-serialization for StickerFormatClass. -func DecodeTDLibJSONStickerFormat(buf tdjson.Decoder) (StickerFormatClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "stickerFormatWebp": - // Decoding stickerFormatWebp#8174ef20. - v := StickerFormatWebp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFormatClass: %w", err) - } - return &v, nil - case "stickerFormatTgs": - // Decoding stickerFormatTgs#603caaf6. - v := StickerFormatTgs{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFormatClass: %w", err) - } - return &v, nil - case "stickerFormatWebm": - // Decoding stickerFormatWebm#849bd54f. - v := StickerFormatWebm{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFormatClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StickerFormatClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StickerFormat boxes the StickerFormatClass providing a helper. -type StickerFormatBox struct { - StickerFormat StickerFormatClass -} - -// Decode implements bin.Decoder for StickerFormatBox. -func (b *StickerFormatBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StickerFormatBox to nil") - } - v, err := DecodeStickerFormat(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StickerFormat = v - return nil -} - -// Encode implements bin.Encode for StickerFormatBox. -func (b *StickerFormatBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StickerFormat == nil { - return fmt.Errorf("unable to encode StickerFormatClass as nil") - } - return b.StickerFormat.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StickerFormatBox. -func (b *StickerFormatBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StickerFormatBox to nil") - } - v, err := DecodeTDLibJSONStickerFormat(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StickerFormat = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StickerFormatBox. -func (b *StickerFormatBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StickerFormat == nil { - return fmt.Errorf("unable to encode StickerFormatClass as nil") - } - return b.StickerFormat.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_sticker_full_type_gen.go b/tdapi/tl_sticker_full_type_gen.go deleted file mode 100644 index bd807cb4c..000000000 --- a/tdapi/tl_sticker_full_type_gen.go +++ /dev/null @@ -1,719 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StickerFullTypeRegular represents TL type `stickerFullTypeRegular#88685ef7`. -type StickerFullTypeRegular struct { - // Premium animation of the sticker; may be null. If present, only Telegram Premium users - // can use the sticker - PremiumAnimation File -} - -// StickerFullTypeRegularTypeID is TL type id of StickerFullTypeRegular. -const StickerFullTypeRegularTypeID = 0x88685ef7 - -// construct implements constructor of StickerFullTypeClass. -func (s StickerFullTypeRegular) construct() StickerFullTypeClass { return &s } - -// Ensuring interfaces in compile-time for StickerFullTypeRegular. -var ( - _ bin.Encoder = &StickerFullTypeRegular{} - _ bin.Decoder = &StickerFullTypeRegular{} - _ bin.BareEncoder = &StickerFullTypeRegular{} - _ bin.BareDecoder = &StickerFullTypeRegular{} - - _ StickerFullTypeClass = &StickerFullTypeRegular{} -) - -func (s *StickerFullTypeRegular) Zero() bool { - if s == nil { - return true - } - if !(s.PremiumAnimation.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerFullTypeRegular) String() string { - if s == nil { - return "StickerFullTypeRegular(nil)" - } - type Alias StickerFullTypeRegular - return fmt.Sprintf("StickerFullTypeRegular%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerFullTypeRegular) TypeID() uint32 { - return StickerFullTypeRegularTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerFullTypeRegular) TypeName() string { - return "stickerFullTypeRegular" -} - -// TypeInfo returns info about TL type. -func (s *StickerFullTypeRegular) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerFullTypeRegular", - ID: StickerFullTypeRegularTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PremiumAnimation", - SchemaName: "premium_animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerFullTypeRegular) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFullTypeRegular#88685ef7 as nil") - } - b.PutID(StickerFullTypeRegularTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerFullTypeRegular) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFullTypeRegular#88685ef7 as nil") - } - if err := s.PremiumAnimation.Encode(b); err != nil { - return fmt.Errorf("unable to encode stickerFullTypeRegular#88685ef7: field premium_animation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerFullTypeRegular) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFullTypeRegular#88685ef7 to nil") - } - if err := b.ConsumeID(StickerFullTypeRegularTypeID); err != nil { - return fmt.Errorf("unable to decode stickerFullTypeRegular#88685ef7: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerFullTypeRegular) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFullTypeRegular#88685ef7 to nil") - } - { - if err := s.PremiumAnimation.Decode(b); err != nil { - return fmt.Errorf("unable to decode stickerFullTypeRegular#88685ef7: field premium_animation: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerFullTypeRegular) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerFullTypeRegular#88685ef7 as nil") - } - b.ObjStart() - b.PutID("stickerFullTypeRegular") - b.Comma() - b.FieldStart("premium_animation") - if err := s.PremiumAnimation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerFullTypeRegular#88685ef7: field premium_animation: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerFullTypeRegular) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerFullTypeRegular#88685ef7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerFullTypeRegular"); err != nil { - return fmt.Errorf("unable to decode stickerFullTypeRegular#88685ef7: %w", err) - } - case "premium_animation": - if err := s.PremiumAnimation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerFullTypeRegular#88685ef7: field premium_animation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPremiumAnimation returns value of PremiumAnimation field. -func (s *StickerFullTypeRegular) GetPremiumAnimation() (value File) { - if s == nil { - return - } - return s.PremiumAnimation -} - -// StickerFullTypeMask represents TL type `stickerFullTypeMask#26dfbf37`. -type StickerFullTypeMask struct { - // Position where the mask is placed; may be null - MaskPosition MaskPosition -} - -// StickerFullTypeMaskTypeID is TL type id of StickerFullTypeMask. -const StickerFullTypeMaskTypeID = 0x26dfbf37 - -// construct implements constructor of StickerFullTypeClass. -func (s StickerFullTypeMask) construct() StickerFullTypeClass { return &s } - -// Ensuring interfaces in compile-time for StickerFullTypeMask. -var ( - _ bin.Encoder = &StickerFullTypeMask{} - _ bin.Decoder = &StickerFullTypeMask{} - _ bin.BareEncoder = &StickerFullTypeMask{} - _ bin.BareDecoder = &StickerFullTypeMask{} - - _ StickerFullTypeClass = &StickerFullTypeMask{} -) - -func (s *StickerFullTypeMask) Zero() bool { - if s == nil { - return true - } - if !(s.MaskPosition.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerFullTypeMask) String() string { - if s == nil { - return "StickerFullTypeMask(nil)" - } - type Alias StickerFullTypeMask - return fmt.Sprintf("StickerFullTypeMask%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerFullTypeMask) TypeID() uint32 { - return StickerFullTypeMaskTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerFullTypeMask) TypeName() string { - return "stickerFullTypeMask" -} - -// TypeInfo returns info about TL type. -func (s *StickerFullTypeMask) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerFullTypeMask", - ID: StickerFullTypeMaskTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MaskPosition", - SchemaName: "mask_position", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerFullTypeMask) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFullTypeMask#26dfbf37 as nil") - } - b.PutID(StickerFullTypeMaskTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerFullTypeMask) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFullTypeMask#26dfbf37 as nil") - } - if err := s.MaskPosition.Encode(b); err != nil { - return fmt.Errorf("unable to encode stickerFullTypeMask#26dfbf37: field mask_position: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerFullTypeMask) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFullTypeMask#26dfbf37 to nil") - } - if err := b.ConsumeID(StickerFullTypeMaskTypeID); err != nil { - return fmt.Errorf("unable to decode stickerFullTypeMask#26dfbf37: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerFullTypeMask) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFullTypeMask#26dfbf37 to nil") - } - { - if err := s.MaskPosition.Decode(b); err != nil { - return fmt.Errorf("unable to decode stickerFullTypeMask#26dfbf37: field mask_position: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerFullTypeMask) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerFullTypeMask#26dfbf37 as nil") - } - b.ObjStart() - b.PutID("stickerFullTypeMask") - b.Comma() - b.FieldStart("mask_position") - if err := s.MaskPosition.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerFullTypeMask#26dfbf37: field mask_position: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerFullTypeMask) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerFullTypeMask#26dfbf37 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerFullTypeMask"); err != nil { - return fmt.Errorf("unable to decode stickerFullTypeMask#26dfbf37: %w", err) - } - case "mask_position": - if err := s.MaskPosition.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerFullTypeMask#26dfbf37: field mask_position: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMaskPosition returns value of MaskPosition field. -func (s *StickerFullTypeMask) GetMaskPosition() (value MaskPosition) { - if s == nil { - return - } - return s.MaskPosition -} - -// StickerFullTypeCustomEmoji represents TL type `stickerFullTypeCustomEmoji#c37f05ab`. -type StickerFullTypeCustomEmoji struct { - // Identifier of the custom emoji - CustomEmojiID int64 - // True, if the sticker must be repainted to a text color in messages, the color of the - // Telegram Premium badge in emoji status, white color on chat photos, or another - // appropriate color in other places - NeedsRepainting bool -} - -// StickerFullTypeCustomEmojiTypeID is TL type id of StickerFullTypeCustomEmoji. -const StickerFullTypeCustomEmojiTypeID = 0xc37f05ab - -// construct implements constructor of StickerFullTypeClass. -func (s StickerFullTypeCustomEmoji) construct() StickerFullTypeClass { return &s } - -// Ensuring interfaces in compile-time for StickerFullTypeCustomEmoji. -var ( - _ bin.Encoder = &StickerFullTypeCustomEmoji{} - _ bin.Decoder = &StickerFullTypeCustomEmoji{} - _ bin.BareEncoder = &StickerFullTypeCustomEmoji{} - _ bin.BareDecoder = &StickerFullTypeCustomEmoji{} - - _ StickerFullTypeClass = &StickerFullTypeCustomEmoji{} -) - -func (s *StickerFullTypeCustomEmoji) Zero() bool { - if s == nil { - return true - } - if !(s.CustomEmojiID == 0) { - return false - } - if !(s.NeedsRepainting == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerFullTypeCustomEmoji) String() string { - if s == nil { - return "StickerFullTypeCustomEmoji(nil)" - } - type Alias StickerFullTypeCustomEmoji - return fmt.Sprintf("StickerFullTypeCustomEmoji%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerFullTypeCustomEmoji) TypeID() uint32 { - return StickerFullTypeCustomEmojiTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerFullTypeCustomEmoji) TypeName() string { - return "stickerFullTypeCustomEmoji" -} - -// TypeInfo returns info about TL type. -func (s *StickerFullTypeCustomEmoji) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerFullTypeCustomEmoji", - ID: StickerFullTypeCustomEmojiTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CustomEmojiID", - SchemaName: "custom_emoji_id", - }, - { - Name: "NeedsRepainting", - SchemaName: "needs_repainting", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerFullTypeCustomEmoji) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFullTypeCustomEmoji#c37f05ab as nil") - } - b.PutID(StickerFullTypeCustomEmojiTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerFullTypeCustomEmoji) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerFullTypeCustomEmoji#c37f05ab as nil") - } - b.PutLong(s.CustomEmojiID) - b.PutBool(s.NeedsRepainting) - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerFullTypeCustomEmoji) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFullTypeCustomEmoji#c37f05ab to nil") - } - if err := b.ConsumeID(StickerFullTypeCustomEmojiTypeID); err != nil { - return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerFullTypeCustomEmoji) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerFullTypeCustomEmoji#c37f05ab to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: field custom_emoji_id: %w", err) - } - s.CustomEmojiID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: field needs_repainting: %w", err) - } - s.NeedsRepainting = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerFullTypeCustomEmoji) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerFullTypeCustomEmoji#c37f05ab as nil") - } - b.ObjStart() - b.PutID("stickerFullTypeCustomEmoji") - b.Comma() - b.FieldStart("custom_emoji_id") - b.PutLong(s.CustomEmojiID) - b.Comma() - b.FieldStart("needs_repainting") - b.PutBool(s.NeedsRepainting) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerFullTypeCustomEmoji) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerFullTypeCustomEmoji#c37f05ab to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerFullTypeCustomEmoji"); err != nil { - return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: %w", err) - } - case "custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: field custom_emoji_id: %w", err) - } - s.CustomEmojiID = value - case "needs_repainting": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerFullTypeCustomEmoji#c37f05ab: field needs_repainting: %w", err) - } - s.NeedsRepainting = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCustomEmojiID returns value of CustomEmojiID field. -func (s *StickerFullTypeCustomEmoji) GetCustomEmojiID() (value int64) { - if s == nil { - return - } - return s.CustomEmojiID -} - -// GetNeedsRepainting returns value of NeedsRepainting field. -func (s *StickerFullTypeCustomEmoji) GetNeedsRepainting() (value bool) { - if s == nil { - return - } - return s.NeedsRepainting -} - -// StickerFullTypeClassName is schema name of StickerFullTypeClass. -const StickerFullTypeClassName = "StickerFullType" - -// StickerFullTypeClass represents StickerFullType generic type. -// -// Example: -// -// g, err := tdapi.DecodeStickerFullType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StickerFullTypeRegular: // stickerFullTypeRegular#88685ef7 -// case *tdapi.StickerFullTypeMask: // stickerFullTypeMask#26dfbf37 -// case *tdapi.StickerFullTypeCustomEmoji: // stickerFullTypeCustomEmoji#c37f05ab -// default: panic(v) -// } -type StickerFullTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StickerFullTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStickerFullType implements binary de-serialization for StickerFullTypeClass. -func DecodeStickerFullType(buf *bin.Buffer) (StickerFullTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StickerFullTypeRegularTypeID: - // Decoding stickerFullTypeRegular#88685ef7. - v := StickerFullTypeRegular{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err) - } - return &v, nil - case StickerFullTypeMaskTypeID: - // Decoding stickerFullTypeMask#26dfbf37. - v := StickerFullTypeMask{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err) - } - return &v, nil - case StickerFullTypeCustomEmojiTypeID: - // Decoding stickerFullTypeCustomEmoji#c37f05ab. - v := StickerFullTypeCustomEmoji{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStickerFullType implements binary de-serialization for StickerFullTypeClass. -func DecodeTDLibJSONStickerFullType(buf tdjson.Decoder) (StickerFullTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "stickerFullTypeRegular": - // Decoding stickerFullTypeRegular#88685ef7. - v := StickerFullTypeRegular{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err) - } - return &v, nil - case "stickerFullTypeMask": - // Decoding stickerFullTypeMask#26dfbf37. - v := StickerFullTypeMask{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err) - } - return &v, nil - case "stickerFullTypeCustomEmoji": - // Decoding stickerFullTypeCustomEmoji#c37f05ab. - v := StickerFullTypeCustomEmoji{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StickerFullTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StickerFullType boxes the StickerFullTypeClass providing a helper. -type StickerFullTypeBox struct { - StickerFullType StickerFullTypeClass -} - -// Decode implements bin.Decoder for StickerFullTypeBox. -func (b *StickerFullTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StickerFullTypeBox to nil") - } - v, err := DecodeStickerFullType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StickerFullType = v - return nil -} - -// Encode implements bin.Encode for StickerFullTypeBox. -func (b *StickerFullTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StickerFullType == nil { - return fmt.Errorf("unable to encode StickerFullTypeClass as nil") - } - return b.StickerFullType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StickerFullTypeBox. -func (b *StickerFullTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StickerFullTypeBox to nil") - } - v, err := DecodeTDLibJSONStickerFullType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StickerFullType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StickerFullTypeBox. -func (b *StickerFullTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StickerFullType == nil { - return fmt.Errorf("unable to encode StickerFullTypeClass as nil") - } - return b.StickerFullType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_sticker_gen.go b/tdapi/tl_sticker_gen.go deleted file mode 100644 index 53937c617..000000000 --- a/tdapi/tl_sticker_gen.go +++ /dev/null @@ -1,485 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Sticker represents TL type `sticker#d96f5d3f`. -type Sticker struct { - // Unique sticker identifier within the set; 0 if none - ID int64 - // Identifier of the sticker set to which the sticker belongs; 0 if none - SetID int64 - // Sticker width; as defined by the sender - Width int32 - // Sticker height; as defined by the sender - Height int32 - // Emoji corresponding to the sticker - Emoji string - // Sticker format - Format StickerFormatClass - // Sticker's full type - FullType StickerFullTypeClass - // Sticker thumbnail in WEBP or JPEG format; may be null - Thumbnail Thumbnail - // File containing the sticker - Sticker File -} - -// StickerTypeID is TL type id of Sticker. -const StickerTypeID = 0xd96f5d3f - -// Ensuring interfaces in compile-time for Sticker. -var ( - _ bin.Encoder = &Sticker{} - _ bin.Decoder = &Sticker{} - _ bin.BareEncoder = &Sticker{} - _ bin.BareDecoder = &Sticker{} -) - -func (s *Sticker) Zero() bool { - if s == nil { - return true - } - if !(s.ID == 0) { - return false - } - if !(s.SetID == 0) { - return false - } - if !(s.Width == 0) { - return false - } - if !(s.Height == 0) { - return false - } - if !(s.Emoji == "") { - return false - } - if !(s.Format == nil) { - return false - } - if !(s.FullType == nil) { - return false - } - if !(s.Thumbnail.Zero()) { - return false - } - if !(s.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *Sticker) String() string { - if s == nil { - return "Sticker(nil)" - } - type Alias Sticker - return fmt.Sprintf("Sticker%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Sticker) TypeID() uint32 { - return StickerTypeID -} - -// TypeName returns name of type in TL schema. -func (*Sticker) TypeName() string { - return "sticker" -} - -// TypeInfo returns info about TL type. -func (s *Sticker) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "sticker", - ID: StickerTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "SetID", - SchemaName: "set_id", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "Emoji", - SchemaName: "emoji", - }, - { - Name: "Format", - SchemaName: "format", - }, - { - Name: "FullType", - SchemaName: "full_type", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *Sticker) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sticker#d96f5d3f as nil") - } - b.PutID(StickerTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *Sticker) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode sticker#d96f5d3f as nil") - } - b.PutLong(s.ID) - b.PutLong(s.SetID) - b.PutInt32(s.Width) - b.PutInt32(s.Height) - b.PutString(s.Emoji) - if s.Format == nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field format is nil") - } - if err := s.Format.Encode(b); err != nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field format: %w", err) - } - if s.FullType == nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field full_type is nil") - } - if err := s.FullType.Encode(b); err != nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field full_type: %w", err) - } - if err := s.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field thumbnail: %w", err) - } - if err := s.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *Sticker) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sticker#d96f5d3f to nil") - } - if err := b.ConsumeID(StickerTypeID); err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *Sticker) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode sticker#d96f5d3f to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field id: %w", err) - } - s.ID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field set_id: %w", err) - } - s.SetID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field width: %w", err) - } - s.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field height: %w", err) - } - s.Height = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field emoji: %w", err) - } - s.Emoji = value - } - { - value, err := DecodeStickerFormat(b) - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field format: %w", err) - } - s.Format = value - } - { - value, err := DecodeStickerFullType(b) - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field full_type: %w", err) - } - s.FullType = value - } - { - if err := s.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field thumbnail: %w", err) - } - } - { - if err := s.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *Sticker) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode sticker#d96f5d3f as nil") - } - b.ObjStart() - b.PutID("sticker") - b.Comma() - b.FieldStart("id") - b.PutLong(s.ID) - b.Comma() - b.FieldStart("set_id") - b.PutLong(s.SetID) - b.Comma() - b.FieldStart("width") - b.PutInt32(s.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(s.Height) - b.Comma() - b.FieldStart("emoji") - b.PutString(s.Emoji) - b.Comma() - b.FieldStart("format") - if s.Format == nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field format is nil") - } - if err := s.Format.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field format: %w", err) - } - b.Comma() - b.FieldStart("full_type") - if s.FullType == nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field full_type is nil") - } - if err := s.FullType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field full_type: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := s.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("sticker") - if err := s.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode sticker#d96f5d3f: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *Sticker) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode sticker#d96f5d3f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("sticker"); err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field id: %w", err) - } - s.ID = value - case "set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field set_id: %w", err) - } - s.SetID = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field width: %w", err) - } - s.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field height: %w", err) - } - s.Height = value - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field emoji: %w", err) - } - s.Emoji = value - case "format": - value, err := DecodeTDLibJSONStickerFormat(b) - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field format: %w", err) - } - s.Format = value - case "full_type": - value, err := DecodeTDLibJSONStickerFullType(b) - if err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field full_type: %w", err) - } - s.FullType = value - case "thumbnail": - if err := s.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field thumbnail: %w", err) - } - case "sticker": - if err := s.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode sticker#d96f5d3f: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *Sticker) GetID() (value int64) { - if s == nil { - return - } - return s.ID -} - -// GetSetID returns value of SetID field. -func (s *Sticker) GetSetID() (value int64) { - if s == nil { - return - } - return s.SetID -} - -// GetWidth returns value of Width field. -func (s *Sticker) GetWidth() (value int32) { - if s == nil { - return - } - return s.Width -} - -// GetHeight returns value of Height field. -func (s *Sticker) GetHeight() (value int32) { - if s == nil { - return - } - return s.Height -} - -// GetEmoji returns value of Emoji field. -func (s *Sticker) GetEmoji() (value string) { - if s == nil { - return - } - return s.Emoji -} - -// GetFormat returns value of Format field. -func (s *Sticker) GetFormat() (value StickerFormatClass) { - if s == nil { - return - } - return s.Format -} - -// GetFullType returns value of FullType field. -func (s *Sticker) GetFullType() (value StickerFullTypeClass) { - if s == nil { - return - } - return s.FullType -} - -// GetThumbnail returns value of Thumbnail field. -func (s *Sticker) GetThumbnail() (value Thumbnail) { - if s == nil { - return - } - return s.Thumbnail -} - -// GetSticker returns value of Sticker field. -func (s *Sticker) GetSticker() (value File) { - if s == nil { - return - } - return s.Sticker -} diff --git a/tdapi/tl_sticker_set_gen.go b/tdapi/tl_sticker_set_gen.go deleted file mode 100644 index d85e22952..000000000 --- a/tdapi/tl_sticker_set_gen.go +++ /dev/null @@ -1,741 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StickerSet represents TL type `stickerSet#e3b8a114`. -type StickerSet struct { - // Identifier of the sticker set - ID int64 - // Title of the sticker set - Title string - // Name of the sticker set - Name string - // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be - // null. The file can be downloaded only before the thumbnail is changed - Thumbnail Thumbnail - // Sticker set thumbnail's outline; may be null if unknown - ThumbnailOutline Outline - // True, if the sticker set is owned by the current user - IsOwned bool - // True, if the sticker set has been installed by the current user - IsInstalled bool - // True, if the sticker set has been archived. A sticker set can't be installed and - // archived simultaneously - IsArchived bool - // True, if the sticker set is official - IsOfficial bool - // Type of the stickers in the set - StickerType StickerTypeClass - // True, if stickers in the sticker set are custom emoji that must be repainted; for - // custom emoji sticker sets only - NeedsRepainting bool - // True, if stickers in the sticker set are custom emoji that can be used as chat emoji - // status; for custom emoji sticker sets only - IsAllowedAsChatEmojiStatus bool - // True for already viewed trending sticker sets - IsViewed bool - // List of stickers in this set - Stickers []Sticker - // A list of emojis corresponding to the stickers in the same order. The list is only for - // informational purposes, because a sticker is always sent with a fixed emoji from the - // corresponding Sticker object - Emojis []Emojis -} - -// StickerSetTypeID is TL type id of StickerSet. -const StickerSetTypeID = 0xe3b8a114 - -// Ensuring interfaces in compile-time for StickerSet. -var ( - _ bin.Encoder = &StickerSet{} - _ bin.Decoder = &StickerSet{} - _ bin.BareEncoder = &StickerSet{} - _ bin.BareDecoder = &StickerSet{} -) - -func (s *StickerSet) Zero() bool { - if s == nil { - return true - } - if !(s.ID == 0) { - return false - } - if !(s.Title == "") { - return false - } - if !(s.Name == "") { - return false - } - if !(s.Thumbnail.Zero()) { - return false - } - if !(s.ThumbnailOutline.Zero()) { - return false - } - if !(s.IsOwned == false) { - return false - } - if !(s.IsInstalled == false) { - return false - } - if !(s.IsArchived == false) { - return false - } - if !(s.IsOfficial == false) { - return false - } - if !(s.StickerType == nil) { - return false - } - if !(s.NeedsRepainting == false) { - return false - } - if !(s.IsAllowedAsChatEmojiStatus == false) { - return false - } - if !(s.IsViewed == false) { - return false - } - if !(s.Stickers == nil) { - return false - } - if !(s.Emojis == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerSet) String() string { - if s == nil { - return "StickerSet(nil)" - } - type Alias StickerSet - return fmt.Sprintf("StickerSet%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerSet) TypeID() uint32 { - return StickerSetTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerSet) TypeName() string { - return "stickerSet" -} - -// TypeInfo returns info about TL type. -func (s *StickerSet) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerSet", - ID: StickerSetTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "ThumbnailOutline", - SchemaName: "thumbnail_outline", - }, - { - Name: "IsOwned", - SchemaName: "is_owned", - }, - { - Name: "IsInstalled", - SchemaName: "is_installed", - }, - { - Name: "IsArchived", - SchemaName: "is_archived", - }, - { - Name: "IsOfficial", - SchemaName: "is_official", - }, - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "NeedsRepainting", - SchemaName: "needs_repainting", - }, - { - Name: "IsAllowedAsChatEmojiStatus", - SchemaName: "is_allowed_as_chat_emoji_status", - }, - { - Name: "IsViewed", - SchemaName: "is_viewed", - }, - { - Name: "Stickers", - SchemaName: "stickers", - }, - { - Name: "Emojis", - SchemaName: "emojis", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerSet) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerSet#e3b8a114 as nil") - } - b.PutID(StickerSetTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerSet) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerSet#e3b8a114 as nil") - } - b.PutLong(s.ID) - b.PutString(s.Title) - b.PutString(s.Name) - if err := s.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#e3b8a114: field thumbnail: %w", err) - } - if err := s.ThumbnailOutline.Encode(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#e3b8a114: field thumbnail_outline: %w", err) - } - b.PutBool(s.IsOwned) - b.PutBool(s.IsInstalled) - b.PutBool(s.IsArchived) - b.PutBool(s.IsOfficial) - if s.StickerType == nil { - return fmt.Errorf("unable to encode stickerSet#e3b8a114: field sticker_type is nil") - } - if err := s.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#e3b8a114: field sticker_type: %w", err) - } - b.PutBool(s.NeedsRepainting) - b.PutBool(s.IsAllowedAsChatEmojiStatus) - b.PutBool(s.IsViewed) - b.PutInt(len(s.Stickers)) - for idx, v := range s.Stickers { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stickerSet#e3b8a114: field stickers element with index %d: %w", idx, err) - } - } - b.PutInt(len(s.Emojis)) - for idx, v := range s.Emojis { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stickerSet#e3b8a114: field emojis element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerSet) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerSet#e3b8a114 to nil") - } - if err := b.ConsumeID(StickerSetTypeID); err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerSet) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerSet#e3b8a114 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field id: %w", err) - } - s.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field title: %w", err) - } - s.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field name: %w", err) - } - s.Name = value - } - { - if err := s.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field thumbnail: %w", err) - } - } - { - if err := s.ThumbnailOutline.Decode(b); err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field thumbnail_outline: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_owned: %w", err) - } - s.IsOwned = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_installed: %w", err) - } - s.IsInstalled = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_archived: %w", err) - } - s.IsArchived = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_official: %w", err) - } - s.IsOfficial = value - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field sticker_type: %w", err) - } - s.StickerType = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field needs_repainting: %w", err) - } - s.NeedsRepainting = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_allowed_as_chat_emoji_status: %w", err) - } - s.IsAllowedAsChatEmojiStatus = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_viewed: %w", err) - } - s.IsViewed = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field stickers: %w", err) - } - - if headerLen > 0 { - s.Stickers = make([]Sticker, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Sticker - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stickerSet#e3b8a114: field stickers: %w", err) - } - s.Stickers = append(s.Stickers, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field emojis: %w", err) - } - - if headerLen > 0 { - s.Emojis = make([]Emojis, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Emojis - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stickerSet#e3b8a114: field emojis: %w", err) - } - s.Emojis = append(s.Emojis, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerSet) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerSet#e3b8a114 as nil") - } - b.ObjStart() - b.PutID("stickerSet") - b.Comma() - b.FieldStart("id") - b.PutLong(s.ID) - b.Comma() - b.FieldStart("title") - b.PutString(s.Title) - b.Comma() - b.FieldStart("name") - b.PutString(s.Name) - b.Comma() - b.FieldStart("thumbnail") - if err := s.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#e3b8a114: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("thumbnail_outline") - if err := s.ThumbnailOutline.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#e3b8a114: field thumbnail_outline: %w", err) - } - b.Comma() - b.FieldStart("is_owned") - b.PutBool(s.IsOwned) - b.Comma() - b.FieldStart("is_installed") - b.PutBool(s.IsInstalled) - b.Comma() - b.FieldStart("is_archived") - b.PutBool(s.IsArchived) - b.Comma() - b.FieldStart("is_official") - b.PutBool(s.IsOfficial) - b.Comma() - b.FieldStart("sticker_type") - if s.StickerType == nil { - return fmt.Errorf("unable to encode stickerSet#e3b8a114: field sticker_type is nil") - } - if err := s.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#e3b8a114: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("needs_repainting") - b.PutBool(s.NeedsRepainting) - b.Comma() - b.FieldStart("is_allowed_as_chat_emoji_status") - b.PutBool(s.IsAllowedAsChatEmojiStatus) - b.Comma() - b.FieldStart("is_viewed") - b.PutBool(s.IsViewed) - b.Comma() - b.FieldStart("stickers") - b.ArrStart() - for idx, v := range s.Stickers { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#e3b8a114: field stickers element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("emojis") - b.ArrStart() - for idx, v := range s.Emojis { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSet#e3b8a114: field emojis element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerSet) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerSet#e3b8a114 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerSet"); err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field id: %w", err) - } - s.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field title: %w", err) - } - s.Title = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field name: %w", err) - } - s.Name = value - case "thumbnail": - if err := s.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field thumbnail: %w", err) - } - case "thumbnail_outline": - if err := s.ThumbnailOutline.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field thumbnail_outline: %w", err) - } - case "is_owned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_owned: %w", err) - } - s.IsOwned = value - case "is_installed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_installed: %w", err) - } - s.IsInstalled = value - case "is_archived": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_archived: %w", err) - } - s.IsArchived = value - case "is_official": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_official: %w", err) - } - s.IsOfficial = value - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field sticker_type: %w", err) - } - s.StickerType = value - case "needs_repainting": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field needs_repainting: %w", err) - } - s.NeedsRepainting = value - case "is_allowed_as_chat_emoji_status": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_allowed_as_chat_emoji_status: %w", err) - } - s.IsAllowedAsChatEmojiStatus = value - case "is_viewed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field is_viewed: %w", err) - } - s.IsViewed = value - case "stickers": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Sticker - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field stickers: %w", err) - } - s.Stickers = append(s.Stickers, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field stickers: %w", err) - } - case "emojis": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Emojis - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field emojis: %w", err) - } - s.Emojis = append(s.Emojis, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode stickerSet#e3b8a114: field emojis: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *StickerSet) GetID() (value int64) { - if s == nil { - return - } - return s.ID -} - -// GetTitle returns value of Title field. -func (s *StickerSet) GetTitle() (value string) { - if s == nil { - return - } - return s.Title -} - -// GetName returns value of Name field. -func (s *StickerSet) GetName() (value string) { - if s == nil { - return - } - return s.Name -} - -// GetThumbnail returns value of Thumbnail field. -func (s *StickerSet) GetThumbnail() (value Thumbnail) { - if s == nil { - return - } - return s.Thumbnail -} - -// GetThumbnailOutline returns value of ThumbnailOutline field. -func (s *StickerSet) GetThumbnailOutline() (value Outline) { - if s == nil { - return - } - return s.ThumbnailOutline -} - -// GetIsOwned returns value of IsOwned field. -func (s *StickerSet) GetIsOwned() (value bool) { - if s == nil { - return - } - return s.IsOwned -} - -// GetIsInstalled returns value of IsInstalled field. -func (s *StickerSet) GetIsInstalled() (value bool) { - if s == nil { - return - } - return s.IsInstalled -} - -// GetIsArchived returns value of IsArchived field. -func (s *StickerSet) GetIsArchived() (value bool) { - if s == nil { - return - } - return s.IsArchived -} - -// GetIsOfficial returns value of IsOfficial field. -func (s *StickerSet) GetIsOfficial() (value bool) { - if s == nil { - return - } - return s.IsOfficial -} - -// GetStickerType returns value of StickerType field. -func (s *StickerSet) GetStickerType() (value StickerTypeClass) { - if s == nil { - return - } - return s.StickerType -} - -// GetNeedsRepainting returns value of NeedsRepainting field. -func (s *StickerSet) GetNeedsRepainting() (value bool) { - if s == nil { - return - } - return s.NeedsRepainting -} - -// GetIsAllowedAsChatEmojiStatus returns value of IsAllowedAsChatEmojiStatus field. -func (s *StickerSet) GetIsAllowedAsChatEmojiStatus() (value bool) { - if s == nil { - return - } - return s.IsAllowedAsChatEmojiStatus -} - -// GetIsViewed returns value of IsViewed field. -func (s *StickerSet) GetIsViewed() (value bool) { - if s == nil { - return - } - return s.IsViewed -} - -// GetStickers returns value of Stickers field. -func (s *StickerSet) GetStickers() (value []Sticker) { - if s == nil { - return - } - return s.Stickers -} - -// GetEmojis returns value of Emojis field. -func (s *StickerSet) GetEmojis() (value []Emojis) { - if s == nil { - return - } - return s.Emojis -} diff --git a/tdapi/tl_sticker_set_info_gen.go b/tdapi/tl_sticker_set_info_gen.go deleted file mode 100644 index 95d4dd9fc..000000000 --- a/tdapi/tl_sticker_set_info_gen.go +++ /dev/null @@ -1,712 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StickerSetInfo represents TL type `stickerSetInfo#58991994`. -type StickerSetInfo struct { - // Identifier of the sticker set - ID int64 - // Title of the sticker set - Title string - // Name of the sticker set - Name string - // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be - // null. The file can be downloaded only before the thumbnail is changed - Thumbnail Thumbnail - // Sticker set thumbnail's outline; may be null if unknown - ThumbnailOutline Outline - // True, if the sticker set is owned by the current user - IsOwned bool - // True, if the sticker set has been installed by the current user - IsInstalled bool - // True, if the sticker set has been archived. A sticker set can't be installed and - // archived simultaneously - IsArchived bool - // True, if the sticker set is official - IsOfficial bool - // Type of the stickers in the set - StickerType StickerTypeClass - // True, if stickers in the sticker set are custom emoji that must be repainted; for - // custom emoji sticker sets only - NeedsRepainting bool - // True, if stickers in the sticker set are custom emoji that can be used as chat emoji - // status; for custom emoji sticker sets only - IsAllowedAsChatEmojiStatus bool - // True for already viewed trending sticker sets - IsViewed bool - // Total number of stickers in the set - Size int32 - // Up to the first 5 stickers from the set, depending on the context. If the application - // needs more stickers the full sticker set needs to be requested - Covers []Sticker -} - -// StickerSetInfoTypeID is TL type id of StickerSetInfo. -const StickerSetInfoTypeID = 0x58991994 - -// Ensuring interfaces in compile-time for StickerSetInfo. -var ( - _ bin.Encoder = &StickerSetInfo{} - _ bin.Decoder = &StickerSetInfo{} - _ bin.BareEncoder = &StickerSetInfo{} - _ bin.BareDecoder = &StickerSetInfo{} -) - -func (s *StickerSetInfo) Zero() bool { - if s == nil { - return true - } - if !(s.ID == 0) { - return false - } - if !(s.Title == "") { - return false - } - if !(s.Name == "") { - return false - } - if !(s.Thumbnail.Zero()) { - return false - } - if !(s.ThumbnailOutline.Zero()) { - return false - } - if !(s.IsOwned == false) { - return false - } - if !(s.IsInstalled == false) { - return false - } - if !(s.IsArchived == false) { - return false - } - if !(s.IsOfficial == false) { - return false - } - if !(s.StickerType == nil) { - return false - } - if !(s.NeedsRepainting == false) { - return false - } - if !(s.IsAllowedAsChatEmojiStatus == false) { - return false - } - if !(s.IsViewed == false) { - return false - } - if !(s.Size == 0) { - return false - } - if !(s.Covers == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerSetInfo) String() string { - if s == nil { - return "StickerSetInfo(nil)" - } - type Alias StickerSetInfo - return fmt.Sprintf("StickerSetInfo%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerSetInfo) TypeID() uint32 { - return StickerSetInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerSetInfo) TypeName() string { - return "stickerSetInfo" -} - -// TypeInfo returns info about TL type. -func (s *StickerSetInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerSetInfo", - ID: StickerSetInfoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "ThumbnailOutline", - SchemaName: "thumbnail_outline", - }, - { - Name: "IsOwned", - SchemaName: "is_owned", - }, - { - Name: "IsInstalled", - SchemaName: "is_installed", - }, - { - Name: "IsArchived", - SchemaName: "is_archived", - }, - { - Name: "IsOfficial", - SchemaName: "is_official", - }, - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "NeedsRepainting", - SchemaName: "needs_repainting", - }, - { - Name: "IsAllowedAsChatEmojiStatus", - SchemaName: "is_allowed_as_chat_emoji_status", - }, - { - Name: "IsViewed", - SchemaName: "is_viewed", - }, - { - Name: "Size", - SchemaName: "size", - }, - { - Name: "Covers", - SchemaName: "covers", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerSetInfo) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerSetInfo#58991994 as nil") - } - b.PutID(StickerSetInfoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerSetInfo) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerSetInfo#58991994 as nil") - } - b.PutLong(s.ID) - b.PutString(s.Title) - b.PutString(s.Name) - if err := s.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode stickerSetInfo#58991994: field thumbnail: %w", err) - } - if err := s.ThumbnailOutline.Encode(b); err != nil { - return fmt.Errorf("unable to encode stickerSetInfo#58991994: field thumbnail_outline: %w", err) - } - b.PutBool(s.IsOwned) - b.PutBool(s.IsInstalled) - b.PutBool(s.IsArchived) - b.PutBool(s.IsOfficial) - if s.StickerType == nil { - return fmt.Errorf("unable to encode stickerSetInfo#58991994: field sticker_type is nil") - } - if err := s.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode stickerSetInfo#58991994: field sticker_type: %w", err) - } - b.PutBool(s.NeedsRepainting) - b.PutBool(s.IsAllowedAsChatEmojiStatus) - b.PutBool(s.IsViewed) - b.PutInt32(s.Size) - b.PutInt(len(s.Covers)) - for idx, v := range s.Covers { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stickerSetInfo#58991994: field covers element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerSetInfo) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerSetInfo#58991994 to nil") - } - if err := b.ConsumeID(StickerSetInfoTypeID); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerSetInfo) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerSetInfo#58991994 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field id: %w", err) - } - s.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field title: %w", err) - } - s.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field name: %w", err) - } - s.Name = value - } - { - if err := s.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field thumbnail: %w", err) - } - } - { - if err := s.ThumbnailOutline.Decode(b); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field thumbnail_outline: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_owned: %w", err) - } - s.IsOwned = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_installed: %w", err) - } - s.IsInstalled = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_archived: %w", err) - } - s.IsArchived = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_official: %w", err) - } - s.IsOfficial = value - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field sticker_type: %w", err) - } - s.StickerType = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field needs_repainting: %w", err) - } - s.NeedsRepainting = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_allowed_as_chat_emoji_status: %w", err) - } - s.IsAllowedAsChatEmojiStatus = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_viewed: %w", err) - } - s.IsViewed = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field size: %w", err) - } - s.Size = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field covers: %w", err) - } - - if headerLen > 0 { - s.Covers = make([]Sticker, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Sticker - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stickerSetInfo#58991994: field covers: %w", err) - } - s.Covers = append(s.Covers, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerSetInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerSetInfo#58991994 as nil") - } - b.ObjStart() - b.PutID("stickerSetInfo") - b.Comma() - b.FieldStart("id") - b.PutLong(s.ID) - b.Comma() - b.FieldStart("title") - b.PutString(s.Title) - b.Comma() - b.FieldStart("name") - b.PutString(s.Name) - b.Comma() - b.FieldStart("thumbnail") - if err := s.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSetInfo#58991994: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("thumbnail_outline") - if err := s.ThumbnailOutline.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSetInfo#58991994: field thumbnail_outline: %w", err) - } - b.Comma() - b.FieldStart("is_owned") - b.PutBool(s.IsOwned) - b.Comma() - b.FieldStart("is_installed") - b.PutBool(s.IsInstalled) - b.Comma() - b.FieldStart("is_archived") - b.PutBool(s.IsArchived) - b.Comma() - b.FieldStart("is_official") - b.PutBool(s.IsOfficial) - b.Comma() - b.FieldStart("sticker_type") - if s.StickerType == nil { - return fmt.Errorf("unable to encode stickerSetInfo#58991994: field sticker_type is nil") - } - if err := s.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSetInfo#58991994: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("needs_repainting") - b.PutBool(s.NeedsRepainting) - b.Comma() - b.FieldStart("is_allowed_as_chat_emoji_status") - b.PutBool(s.IsAllowedAsChatEmojiStatus) - b.Comma() - b.FieldStart("is_viewed") - b.PutBool(s.IsViewed) - b.Comma() - b.FieldStart("size") - b.PutInt32(s.Size) - b.Comma() - b.FieldStart("covers") - b.ArrStart() - for idx, v := range s.Covers { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSetInfo#58991994: field covers element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerSetInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerSetInfo#58991994 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerSetInfo"); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field id: %w", err) - } - s.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field title: %w", err) - } - s.Title = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field name: %w", err) - } - s.Name = value - case "thumbnail": - if err := s.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field thumbnail: %w", err) - } - case "thumbnail_outline": - if err := s.ThumbnailOutline.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field thumbnail_outline: %w", err) - } - case "is_owned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_owned: %w", err) - } - s.IsOwned = value - case "is_installed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_installed: %w", err) - } - s.IsInstalled = value - case "is_archived": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_archived: %w", err) - } - s.IsArchived = value - case "is_official": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_official: %w", err) - } - s.IsOfficial = value - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field sticker_type: %w", err) - } - s.StickerType = value - case "needs_repainting": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field needs_repainting: %w", err) - } - s.NeedsRepainting = value - case "is_allowed_as_chat_emoji_status": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_allowed_as_chat_emoji_status: %w", err) - } - s.IsAllowedAsChatEmojiStatus = value - case "is_viewed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field is_viewed: %w", err) - } - s.IsViewed = value - case "size": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field size: %w", err) - } - s.Size = value - case "covers": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Sticker - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field covers: %w", err) - } - s.Covers = append(s.Covers, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode stickerSetInfo#58991994: field covers: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *StickerSetInfo) GetID() (value int64) { - if s == nil { - return - } - return s.ID -} - -// GetTitle returns value of Title field. -func (s *StickerSetInfo) GetTitle() (value string) { - if s == nil { - return - } - return s.Title -} - -// GetName returns value of Name field. -func (s *StickerSetInfo) GetName() (value string) { - if s == nil { - return - } - return s.Name -} - -// GetThumbnail returns value of Thumbnail field. -func (s *StickerSetInfo) GetThumbnail() (value Thumbnail) { - if s == nil { - return - } - return s.Thumbnail -} - -// GetThumbnailOutline returns value of ThumbnailOutline field. -func (s *StickerSetInfo) GetThumbnailOutline() (value Outline) { - if s == nil { - return - } - return s.ThumbnailOutline -} - -// GetIsOwned returns value of IsOwned field. -func (s *StickerSetInfo) GetIsOwned() (value bool) { - if s == nil { - return - } - return s.IsOwned -} - -// GetIsInstalled returns value of IsInstalled field. -func (s *StickerSetInfo) GetIsInstalled() (value bool) { - if s == nil { - return - } - return s.IsInstalled -} - -// GetIsArchived returns value of IsArchived field. -func (s *StickerSetInfo) GetIsArchived() (value bool) { - if s == nil { - return - } - return s.IsArchived -} - -// GetIsOfficial returns value of IsOfficial field. -func (s *StickerSetInfo) GetIsOfficial() (value bool) { - if s == nil { - return - } - return s.IsOfficial -} - -// GetStickerType returns value of StickerType field. -func (s *StickerSetInfo) GetStickerType() (value StickerTypeClass) { - if s == nil { - return - } - return s.StickerType -} - -// GetNeedsRepainting returns value of NeedsRepainting field. -func (s *StickerSetInfo) GetNeedsRepainting() (value bool) { - if s == nil { - return - } - return s.NeedsRepainting -} - -// GetIsAllowedAsChatEmojiStatus returns value of IsAllowedAsChatEmojiStatus field. -func (s *StickerSetInfo) GetIsAllowedAsChatEmojiStatus() (value bool) { - if s == nil { - return - } - return s.IsAllowedAsChatEmojiStatus -} - -// GetIsViewed returns value of IsViewed field. -func (s *StickerSetInfo) GetIsViewed() (value bool) { - if s == nil { - return - } - return s.IsViewed -} - -// GetSize returns value of Size field. -func (s *StickerSetInfo) GetSize() (value int32) { - if s == nil { - return - } - return s.Size -} - -// GetCovers returns value of Covers field. -func (s *StickerSetInfo) GetCovers() (value []Sticker) { - if s == nil { - return - } - return s.Covers -} diff --git a/tdapi/tl_sticker_sets_gen.go b/tdapi/tl_sticker_sets_gen.go deleted file mode 100644 index 37f6df37b..000000000 --- a/tdapi/tl_sticker_sets_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StickerSets represents TL type `stickerSets#b8a6490d`. -type StickerSets struct { - // Approximate total number of sticker sets found - TotalCount int32 - // List of sticker sets - Sets []StickerSetInfo -} - -// StickerSetsTypeID is TL type id of StickerSets. -const StickerSetsTypeID = 0xb8a6490d - -// Ensuring interfaces in compile-time for StickerSets. -var ( - _ bin.Encoder = &StickerSets{} - _ bin.Decoder = &StickerSets{} - _ bin.BareEncoder = &StickerSets{} - _ bin.BareDecoder = &StickerSets{} -) - -func (s *StickerSets) Zero() bool { - if s == nil { - return true - } - if !(s.TotalCount == 0) { - return false - } - if !(s.Sets == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerSets) String() string { - if s == nil { - return "StickerSets(nil)" - } - type Alias StickerSets - return fmt.Sprintf("StickerSets%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerSets) TypeID() uint32 { - return StickerSetsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerSets) TypeName() string { - return "stickerSets" -} - -// TypeInfo returns info about TL type. -func (s *StickerSets) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerSets", - ID: StickerSetsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Sets", - SchemaName: "sets", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerSets) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerSets#b8a6490d as nil") - } - b.PutID(StickerSetsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerSets) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerSets#b8a6490d as nil") - } - b.PutInt32(s.TotalCount) - b.PutInt(len(s.Sets)) - for idx, v := range s.Sets { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stickerSets#b8a6490d: field sets element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerSets) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerSets#b8a6490d to nil") - } - if err := b.ConsumeID(StickerSetsTypeID); err != nil { - return fmt.Errorf("unable to decode stickerSets#b8a6490d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerSets) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerSets#b8a6490d to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode stickerSets#b8a6490d: field total_count: %w", err) - } - s.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode stickerSets#b8a6490d: field sets: %w", err) - } - - if headerLen > 0 { - s.Sets = make([]StickerSetInfo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StickerSetInfo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stickerSets#b8a6490d: field sets: %w", err) - } - s.Sets = append(s.Sets, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerSets) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerSets#b8a6490d as nil") - } - b.ObjStart() - b.PutID("stickerSets") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(s.TotalCount) - b.Comma() - b.FieldStart("sets") - b.ArrStart() - for idx, v := range s.Sets { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickerSets#b8a6490d: field sets element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerSets) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerSets#b8a6490d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerSets"); err != nil { - return fmt.Errorf("unable to decode stickerSets#b8a6490d: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode stickerSets#b8a6490d: field total_count: %w", err) - } - s.TotalCount = value - case "sets": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StickerSetInfo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickerSets#b8a6490d: field sets: %w", err) - } - s.Sets = append(s.Sets, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode stickerSets#b8a6490d: field sets: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (s *StickerSets) GetTotalCount() (value int32) { - if s == nil { - return - } - return s.TotalCount -} - -// GetSets returns value of Sets field. -func (s *StickerSets) GetSets() (value []StickerSetInfo) { - if s == nil { - return - } - return s.Sets -} diff --git a/tdapi/tl_sticker_type_gen.go b/tdapi/tl_sticker_type_gen.go deleted file mode 100644 index eed936eed..000000000 --- a/tdapi/tl_sticker_type_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StickerTypeRegular represents TL type `stickerTypeRegular#35bc575`. -type StickerTypeRegular struct { -} - -// StickerTypeRegularTypeID is TL type id of StickerTypeRegular. -const StickerTypeRegularTypeID = 0x35bc575 - -// construct implements constructor of StickerTypeClass. -func (s StickerTypeRegular) construct() StickerTypeClass { return &s } - -// Ensuring interfaces in compile-time for StickerTypeRegular. -var ( - _ bin.Encoder = &StickerTypeRegular{} - _ bin.Decoder = &StickerTypeRegular{} - _ bin.BareEncoder = &StickerTypeRegular{} - _ bin.BareDecoder = &StickerTypeRegular{} - - _ StickerTypeClass = &StickerTypeRegular{} -) - -func (s *StickerTypeRegular) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerTypeRegular) String() string { - if s == nil { - return "StickerTypeRegular(nil)" - } - type Alias StickerTypeRegular - return fmt.Sprintf("StickerTypeRegular%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerTypeRegular) TypeID() uint32 { - return StickerTypeRegularTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerTypeRegular) TypeName() string { - return "stickerTypeRegular" -} - -// TypeInfo returns info about TL type. -func (s *StickerTypeRegular) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerTypeRegular", - ID: StickerTypeRegularTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerTypeRegular) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerTypeRegular#35bc575 as nil") - } - b.PutID(StickerTypeRegularTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerTypeRegular) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerTypeRegular#35bc575 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerTypeRegular) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerTypeRegular#35bc575 to nil") - } - if err := b.ConsumeID(StickerTypeRegularTypeID); err != nil { - return fmt.Errorf("unable to decode stickerTypeRegular#35bc575: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerTypeRegular) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerTypeRegular#35bc575 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerTypeRegular) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerTypeRegular#35bc575 as nil") - } - b.ObjStart() - b.PutID("stickerTypeRegular") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerTypeRegular) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerTypeRegular#35bc575 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerTypeRegular"); err != nil { - return fmt.Errorf("unable to decode stickerTypeRegular#35bc575: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StickerTypeMask represents TL type `stickerTypeMask#96c63694`. -type StickerTypeMask struct { -} - -// StickerTypeMaskTypeID is TL type id of StickerTypeMask. -const StickerTypeMaskTypeID = 0x96c63694 - -// construct implements constructor of StickerTypeClass. -func (s StickerTypeMask) construct() StickerTypeClass { return &s } - -// Ensuring interfaces in compile-time for StickerTypeMask. -var ( - _ bin.Encoder = &StickerTypeMask{} - _ bin.Decoder = &StickerTypeMask{} - _ bin.BareEncoder = &StickerTypeMask{} - _ bin.BareDecoder = &StickerTypeMask{} - - _ StickerTypeClass = &StickerTypeMask{} -) - -func (s *StickerTypeMask) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerTypeMask) String() string { - if s == nil { - return "StickerTypeMask(nil)" - } - type Alias StickerTypeMask - return fmt.Sprintf("StickerTypeMask%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerTypeMask) TypeID() uint32 { - return StickerTypeMaskTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerTypeMask) TypeName() string { - return "stickerTypeMask" -} - -// TypeInfo returns info about TL type. -func (s *StickerTypeMask) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerTypeMask", - ID: StickerTypeMaskTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerTypeMask) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerTypeMask#96c63694 as nil") - } - b.PutID(StickerTypeMaskTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerTypeMask) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerTypeMask#96c63694 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerTypeMask) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerTypeMask#96c63694 to nil") - } - if err := b.ConsumeID(StickerTypeMaskTypeID); err != nil { - return fmt.Errorf("unable to decode stickerTypeMask#96c63694: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerTypeMask) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerTypeMask#96c63694 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerTypeMask) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerTypeMask#96c63694 as nil") - } - b.ObjStart() - b.PutID("stickerTypeMask") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerTypeMask) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerTypeMask#96c63694 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerTypeMask"); err != nil { - return fmt.Errorf("unable to decode stickerTypeMask#96c63694: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StickerTypeCustomEmoji represents TL type `stickerTypeCustomEmoji#f8cd7787`. -type StickerTypeCustomEmoji struct { -} - -// StickerTypeCustomEmojiTypeID is TL type id of StickerTypeCustomEmoji. -const StickerTypeCustomEmojiTypeID = 0xf8cd7787 - -// construct implements constructor of StickerTypeClass. -func (s StickerTypeCustomEmoji) construct() StickerTypeClass { return &s } - -// Ensuring interfaces in compile-time for StickerTypeCustomEmoji. -var ( - _ bin.Encoder = &StickerTypeCustomEmoji{} - _ bin.Decoder = &StickerTypeCustomEmoji{} - _ bin.BareEncoder = &StickerTypeCustomEmoji{} - _ bin.BareDecoder = &StickerTypeCustomEmoji{} - - _ StickerTypeClass = &StickerTypeCustomEmoji{} -) - -func (s *StickerTypeCustomEmoji) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StickerTypeCustomEmoji) String() string { - if s == nil { - return "StickerTypeCustomEmoji(nil)" - } - type Alias StickerTypeCustomEmoji - return fmt.Sprintf("StickerTypeCustomEmoji%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StickerTypeCustomEmoji) TypeID() uint32 { - return StickerTypeCustomEmojiTypeID -} - -// TypeName returns name of type in TL schema. -func (*StickerTypeCustomEmoji) TypeName() string { - return "stickerTypeCustomEmoji" -} - -// TypeInfo returns info about TL type. -func (s *StickerTypeCustomEmoji) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickerTypeCustomEmoji", - ID: StickerTypeCustomEmojiTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StickerTypeCustomEmoji) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerTypeCustomEmoji#f8cd7787 as nil") - } - b.PutID(StickerTypeCustomEmojiTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StickerTypeCustomEmoji) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickerTypeCustomEmoji#f8cd7787 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StickerTypeCustomEmoji) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerTypeCustomEmoji#f8cd7787 to nil") - } - if err := b.ConsumeID(StickerTypeCustomEmojiTypeID); err != nil { - return fmt.Errorf("unable to decode stickerTypeCustomEmoji#f8cd7787: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StickerTypeCustomEmoji) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickerTypeCustomEmoji#f8cd7787 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StickerTypeCustomEmoji) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickerTypeCustomEmoji#f8cd7787 as nil") - } - b.ObjStart() - b.PutID("stickerTypeCustomEmoji") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StickerTypeCustomEmoji) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickerTypeCustomEmoji#f8cd7787 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickerTypeCustomEmoji"); err != nil { - return fmt.Errorf("unable to decode stickerTypeCustomEmoji#f8cd7787: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StickerTypeClassName is schema name of StickerTypeClass. -const StickerTypeClassName = "StickerType" - -// StickerTypeClass represents StickerType generic type. -// -// Example: -// -// g, err := tdapi.DecodeStickerType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StickerTypeRegular: // stickerTypeRegular#35bc575 -// case *tdapi.StickerTypeMask: // stickerTypeMask#96c63694 -// case *tdapi.StickerTypeCustomEmoji: // stickerTypeCustomEmoji#f8cd7787 -// default: panic(v) -// } -type StickerTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StickerTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStickerType implements binary de-serialization for StickerTypeClass. -func DecodeStickerType(buf *bin.Buffer) (StickerTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StickerTypeRegularTypeID: - // Decoding stickerTypeRegular#35bc575. - v := StickerTypeRegular{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) - } - return &v, nil - case StickerTypeMaskTypeID: - // Decoding stickerTypeMask#96c63694. - v := StickerTypeMask{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) - } - return &v, nil - case StickerTypeCustomEmojiTypeID: - // Decoding stickerTypeCustomEmoji#f8cd7787. - v := StickerTypeCustomEmoji{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStickerType implements binary de-serialization for StickerTypeClass. -func DecodeTDLibJSONStickerType(buf tdjson.Decoder) (StickerTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "stickerTypeRegular": - // Decoding stickerTypeRegular#35bc575. - v := StickerTypeRegular{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) - } - return &v, nil - case "stickerTypeMask": - // Decoding stickerTypeMask#96c63694. - v := StickerTypeMask{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) - } - return &v, nil - case "stickerTypeCustomEmoji": - // Decoding stickerTypeCustomEmoji#f8cd7787. - v := StickerTypeCustomEmoji{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StickerTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StickerType boxes the StickerTypeClass providing a helper. -type StickerTypeBox struct { - StickerType StickerTypeClass -} - -// Decode implements bin.Decoder for StickerTypeBox. -func (b *StickerTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StickerTypeBox to nil") - } - v, err := DecodeStickerType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StickerType = v - return nil -} - -// Encode implements bin.Encode for StickerTypeBox. -func (b *StickerTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StickerType == nil { - return fmt.Errorf("unable to encode StickerTypeClass as nil") - } - return b.StickerType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StickerTypeBox. -func (b *StickerTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StickerTypeBox to nil") - } - v, err := DecodeTDLibJSONStickerType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StickerType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StickerTypeBox. -func (b *StickerTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StickerType == nil { - return fmt.Errorf("unable to encode StickerTypeClass as nil") - } - return b.StickerType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_stickers_gen.go b/tdapi/tl_stickers_gen.go deleted file mode 100644 index 55d88b216..000000000 --- a/tdapi/tl_stickers_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Stickers represents TL type `stickers#83491d00`. -type Stickers struct { - // List of stickers - Stickers []Sticker -} - -// StickersTypeID is TL type id of Stickers. -const StickersTypeID = 0x83491d00 - -// Ensuring interfaces in compile-time for Stickers. -var ( - _ bin.Encoder = &Stickers{} - _ bin.Decoder = &Stickers{} - _ bin.BareEncoder = &Stickers{} - _ bin.BareDecoder = &Stickers{} -) - -func (s *Stickers) Zero() bool { - if s == nil { - return true - } - if !(s.Stickers == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *Stickers) String() string { - if s == nil { - return "Stickers(nil)" - } - type Alias Stickers - return fmt.Sprintf("Stickers%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Stickers) TypeID() uint32 { - return StickersTypeID -} - -// TypeName returns name of type in TL schema. -func (*Stickers) TypeName() string { - return "stickers" -} - -// TypeInfo returns info about TL type. -func (s *Stickers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stickers", - ID: StickersTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Stickers", - SchemaName: "stickers", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *Stickers) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickers#83491d00 as nil") - } - b.PutID(StickersTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *Stickers) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stickers#83491d00 as nil") - } - b.PutInt(len(s.Stickers)) - for idx, v := range s.Stickers { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stickers#83491d00: field stickers element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *Stickers) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickers#83491d00 to nil") - } - if err := b.ConsumeID(StickersTypeID); err != nil { - return fmt.Errorf("unable to decode stickers#83491d00: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *Stickers) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stickers#83491d00 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode stickers#83491d00: field stickers: %w", err) - } - - if headerLen > 0 { - s.Stickers = make([]Sticker, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Sticker - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stickers#83491d00: field stickers: %w", err) - } - s.Stickers = append(s.Stickers, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *Stickers) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stickers#83491d00 as nil") - } - b.ObjStart() - b.PutID("stickers") - b.Comma() - b.FieldStart("stickers") - b.ArrStart() - for idx, v := range s.Stickers { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stickers#83491d00: field stickers element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *Stickers) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stickers#83491d00 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stickers"); err != nil { - return fmt.Errorf("unable to decode stickers#83491d00: %w", err) - } - case "stickers": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Sticker - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stickers#83491d00: field stickers: %w", err) - } - s.Stickers = append(s.Stickers, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode stickers#83491d00: field stickers: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStickers returns value of Stickers field. -func (s *Stickers) GetStickers() (value []Sticker) { - if s == nil { - return - } - return s.Stickers -} diff --git a/tdapi/tl_stop_business_poll_gen.go b/tdapi/tl_stop_business_poll_gen.go deleted file mode 100644 index 8d1a0aa8a..000000000 --- a/tdapi/tl_stop_business_poll_gen.go +++ /dev/null @@ -1,316 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StopBusinessPollRequest represents TL type `stopBusinessPoll#bbeb2160`. -type StopBusinessPollRequest struct { - // Unique identifier of business connection on behalf of which the message with the poll - // was sent - BusinessConnectionID string - // The chat the message belongs to - ChatID int64 - // Identifier of the message containing the poll - MessageID int64 - // The new message reply markup; pass null if none - ReplyMarkup ReplyMarkupClass -} - -// StopBusinessPollRequestTypeID is TL type id of StopBusinessPollRequest. -const StopBusinessPollRequestTypeID = 0xbbeb2160 - -// Ensuring interfaces in compile-time for StopBusinessPollRequest. -var ( - _ bin.Encoder = &StopBusinessPollRequest{} - _ bin.Decoder = &StopBusinessPollRequest{} - _ bin.BareEncoder = &StopBusinessPollRequest{} - _ bin.BareDecoder = &StopBusinessPollRequest{} -) - -func (s *StopBusinessPollRequest) Zero() bool { - if s == nil { - return true - } - if !(s.BusinessConnectionID == "") { - return false - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - if !(s.ReplyMarkup == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StopBusinessPollRequest) String() string { - if s == nil { - return "StopBusinessPollRequest(nil)" - } - type Alias StopBusinessPollRequest - return fmt.Sprintf("StopBusinessPollRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StopBusinessPollRequest) TypeID() uint32 { - return StopBusinessPollRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*StopBusinessPollRequest) TypeName() string { - return "stopBusinessPoll" -} - -// TypeInfo returns info about TL type. -func (s *StopBusinessPollRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stopBusinessPoll", - ID: StopBusinessPollRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BusinessConnectionID", - SchemaName: "business_connection_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StopBusinessPollRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stopBusinessPoll#bbeb2160 as nil") - } - b.PutID(StopBusinessPollRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StopBusinessPollRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stopBusinessPoll#bbeb2160 as nil") - } - b.PutString(s.BusinessConnectionID) - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - if s.ReplyMarkup == nil { - return fmt.Errorf("unable to encode stopBusinessPoll#bbeb2160: field reply_markup is nil") - } - if err := s.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode stopBusinessPoll#bbeb2160: field reply_markup: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StopBusinessPollRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stopBusinessPoll#bbeb2160 to nil") - } - if err := b.ConsumeID(StopBusinessPollRequestTypeID); err != nil { - return fmt.Errorf("unable to decode stopBusinessPoll#bbeb2160: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StopBusinessPollRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stopBusinessPoll#bbeb2160 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode stopBusinessPoll#bbeb2160: field business_connection_id: %w", err) - } - s.BusinessConnectionID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode stopBusinessPoll#bbeb2160: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode stopBusinessPoll#bbeb2160: field message_id: %w", err) - } - s.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode stopBusinessPoll#bbeb2160: field reply_markup: %w", err) - } - s.ReplyMarkup = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StopBusinessPollRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stopBusinessPoll#bbeb2160 as nil") - } - b.ObjStart() - b.PutID("stopBusinessPoll") - b.Comma() - b.FieldStart("business_connection_id") - b.PutString(s.BusinessConnectionID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if s.ReplyMarkup == nil { - return fmt.Errorf("unable to encode stopBusinessPoll#bbeb2160: field reply_markup is nil") - } - if err := s.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stopBusinessPoll#bbeb2160: field reply_markup: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StopBusinessPollRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stopBusinessPoll#bbeb2160 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stopBusinessPoll"); err != nil { - return fmt.Errorf("unable to decode stopBusinessPoll#bbeb2160: %w", err) - } - case "business_connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode stopBusinessPoll#bbeb2160: field business_connection_id: %w", err) - } - s.BusinessConnectionID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode stopBusinessPoll#bbeb2160: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode stopBusinessPoll#bbeb2160: field message_id: %w", err) - } - s.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode stopBusinessPoll#bbeb2160: field reply_markup: %w", err) - } - s.ReplyMarkup = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBusinessConnectionID returns value of BusinessConnectionID field. -func (s *StopBusinessPollRequest) GetBusinessConnectionID() (value string) { - if s == nil { - return - } - return s.BusinessConnectionID -} - -// GetChatID returns value of ChatID field. -func (s *StopBusinessPollRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *StopBusinessPollRequest) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (s *StopBusinessPollRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if s == nil { - return - } - return s.ReplyMarkup -} - -// StopBusinessPoll invokes method stopBusinessPoll#bbeb2160 returning error if any. -func (c *Client) StopBusinessPoll(ctx context.Context, request *StopBusinessPollRequest) (*BusinessMessage, error) { - var result BusinessMessage - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_stop_poll_gen.go b/tdapi/tl_stop_poll_gen.go deleted file mode 100644 index 91de2c820..000000000 --- a/tdapi/tl_stop_poll_gen.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StopPollRequest represents TL type `stopPoll#62e80aad`. -type StopPollRequest struct { - // Identifier of the chat to which the poll belongs - ChatID int64 - // Identifier of the message containing the poll. Use messageProperties.can_be_edited to - // check whether the poll can be stopped - MessageID int64 - // The new message reply markup; pass null if none; for bots only - ReplyMarkup ReplyMarkupClass -} - -// StopPollRequestTypeID is TL type id of StopPollRequest. -const StopPollRequestTypeID = 0x62e80aad - -// Ensuring interfaces in compile-time for StopPollRequest. -var ( - _ bin.Encoder = &StopPollRequest{} - _ bin.Decoder = &StopPollRequest{} - _ bin.BareEncoder = &StopPollRequest{} - _ bin.BareDecoder = &StopPollRequest{} -) - -func (s *StopPollRequest) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - if !(s.ReplyMarkup == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StopPollRequest) String() string { - if s == nil { - return "StopPollRequest(nil)" - } - type Alias StopPollRequest - return fmt.Sprintf("StopPollRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StopPollRequest) TypeID() uint32 { - return StopPollRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*StopPollRequest) TypeName() string { - return "stopPoll" -} - -// TypeInfo returns info about TL type. -func (s *StopPollRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stopPoll", - ID: StopPollRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StopPollRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stopPoll#62e80aad as nil") - } - b.PutID(StopPollRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StopPollRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stopPoll#62e80aad as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - if s.ReplyMarkup == nil { - return fmt.Errorf("unable to encode stopPoll#62e80aad: field reply_markup is nil") - } - if err := s.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode stopPoll#62e80aad: field reply_markup: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StopPollRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stopPoll#62e80aad to nil") - } - if err := b.ConsumeID(StopPollRequestTypeID); err != nil { - return fmt.Errorf("unable to decode stopPoll#62e80aad: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StopPollRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stopPoll#62e80aad to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode stopPoll#62e80aad: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode stopPoll#62e80aad: field message_id: %w", err) - } - s.MessageID = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode stopPoll#62e80aad: field reply_markup: %w", err) - } - s.ReplyMarkup = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StopPollRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stopPoll#62e80aad as nil") - } - b.ObjStart() - b.PutID("stopPoll") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.FieldStart("reply_markup") - if s.ReplyMarkup == nil { - return fmt.Errorf("unable to encode stopPoll#62e80aad: field reply_markup is nil") - } - if err := s.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stopPoll#62e80aad: field reply_markup: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StopPollRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stopPoll#62e80aad to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stopPoll"); err != nil { - return fmt.Errorf("unable to decode stopPoll#62e80aad: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode stopPoll#62e80aad: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode stopPoll#62e80aad: field message_id: %w", err) - } - s.MessageID = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode stopPoll#62e80aad: field reply_markup: %w", err) - } - s.ReplyMarkup = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *StopPollRequest) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *StopPollRequest) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (s *StopPollRequest) GetReplyMarkup() (value ReplyMarkupClass) { - if s == nil { - return - } - return s.ReplyMarkup -} - -// StopPoll invokes method stopPoll#62e80aad returning error if any. -func (c *Client) StopPoll(ctx context.Context, request *StopPollRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_storage_statistics_by_chat_gen.go b/tdapi/tl_storage_statistics_by_chat_gen.go deleted file mode 100644 index 6b021b617..000000000 --- a/tdapi/tl_storage_statistics_by_chat_gen.go +++ /dev/null @@ -1,323 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StorageStatisticsByChat represents TL type `storageStatisticsByChat#a5498fe4`. -type StorageStatisticsByChat struct { - // Chat identifier; 0 if none - ChatID int64 - // Total size of the files in the chat, in bytes - Size int64 - // Total number of files in the chat - Count int32 - // Statistics split by file types - ByFileType []StorageStatisticsByFileType -} - -// StorageStatisticsByChatTypeID is TL type id of StorageStatisticsByChat. -const StorageStatisticsByChatTypeID = 0xa5498fe4 - -// Ensuring interfaces in compile-time for StorageStatisticsByChat. -var ( - _ bin.Encoder = &StorageStatisticsByChat{} - _ bin.Decoder = &StorageStatisticsByChat{} - _ bin.BareEncoder = &StorageStatisticsByChat{} - _ bin.BareDecoder = &StorageStatisticsByChat{} -) - -func (s *StorageStatisticsByChat) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.Size == 0) { - return false - } - if !(s.Count == 0) { - return false - } - if !(s.ByFileType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StorageStatisticsByChat) String() string { - if s == nil { - return "StorageStatisticsByChat(nil)" - } - type Alias StorageStatisticsByChat - return fmt.Sprintf("StorageStatisticsByChat%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StorageStatisticsByChat) TypeID() uint32 { - return StorageStatisticsByChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*StorageStatisticsByChat) TypeName() string { - return "storageStatisticsByChat" -} - -// TypeInfo returns info about TL type. -func (s *StorageStatisticsByChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storageStatisticsByChat", - ID: StorageStatisticsByChatTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Size", - SchemaName: "size", - }, - { - Name: "Count", - SchemaName: "count", - }, - { - Name: "ByFileType", - SchemaName: "by_file_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StorageStatisticsByChat) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storageStatisticsByChat#a5498fe4 as nil") - } - b.PutID(StorageStatisticsByChatTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StorageStatisticsByChat) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storageStatisticsByChat#a5498fe4 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.Size) - b.PutInt32(s.Count) - b.PutInt(len(s.ByFileType)) - for idx, v := range s.ByFileType { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare storageStatisticsByChat#a5498fe4: field by_file_type element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StorageStatisticsByChat) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storageStatisticsByChat#a5498fe4 to nil") - } - if err := b.ConsumeID(StorageStatisticsByChatTypeID); err != nil { - return fmt.Errorf("unable to decode storageStatisticsByChat#a5498fe4: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StorageStatisticsByChat) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storageStatisticsByChat#a5498fe4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByChat#a5498fe4: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByChat#a5498fe4: field size: %w", err) - } - s.Size = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByChat#a5498fe4: field count: %w", err) - } - s.Count = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByChat#a5498fe4: field by_file_type: %w", err) - } - - if headerLen > 0 { - s.ByFileType = make([]StorageStatisticsByFileType, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StorageStatisticsByFileType - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare storageStatisticsByChat#a5498fe4: field by_file_type: %w", err) - } - s.ByFileType = append(s.ByFileType, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StorageStatisticsByChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storageStatisticsByChat#a5498fe4 as nil") - } - b.ObjStart() - b.PutID("storageStatisticsByChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("size") - b.PutInt53(s.Size) - b.Comma() - b.FieldStart("count") - b.PutInt32(s.Count) - b.Comma() - b.FieldStart("by_file_type") - b.ArrStart() - for idx, v := range s.ByFileType { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storageStatisticsByChat#a5498fe4: field by_file_type element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StorageStatisticsByChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storageStatisticsByChat#a5498fe4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storageStatisticsByChat"); err != nil { - return fmt.Errorf("unable to decode storageStatisticsByChat#a5498fe4: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByChat#a5498fe4: field chat_id: %w", err) - } - s.ChatID = value - case "size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByChat#a5498fe4: field size: %w", err) - } - s.Size = value - case "count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByChat#a5498fe4: field count: %w", err) - } - s.Count = value - case "by_file_type": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StorageStatisticsByFileType - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storageStatisticsByChat#a5498fe4: field by_file_type: %w", err) - } - s.ByFileType = append(s.ByFileType, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode storageStatisticsByChat#a5498fe4: field by_file_type: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *StorageStatisticsByChat) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetSize returns value of Size field. -func (s *StorageStatisticsByChat) GetSize() (value int64) { - if s == nil { - return - } - return s.Size -} - -// GetCount returns value of Count field. -func (s *StorageStatisticsByChat) GetCount() (value int32) { - if s == nil { - return - } - return s.Count -} - -// GetByFileType returns value of ByFileType field. -func (s *StorageStatisticsByChat) GetByFileType() (value []StorageStatisticsByFileType) { - if s == nil { - return - } - return s.ByFileType -} diff --git a/tdapi/tl_storage_statistics_by_file_type_gen.go b/tdapi/tl_storage_statistics_by_file_type_gen.go deleted file mode 100644 index fa4f66ece..000000000 --- a/tdapi/tl_storage_statistics_by_file_type_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StorageStatisticsByFileType represents TL type `storageStatisticsByFileType#2a8ef8a8`. -type StorageStatisticsByFileType struct { - // File type - FileType FileTypeClass - // Total size of the files, in bytes - Size int64 - // Total number of files - Count int32 -} - -// StorageStatisticsByFileTypeTypeID is TL type id of StorageStatisticsByFileType. -const StorageStatisticsByFileTypeTypeID = 0x2a8ef8a8 - -// Ensuring interfaces in compile-time for StorageStatisticsByFileType. -var ( - _ bin.Encoder = &StorageStatisticsByFileType{} - _ bin.Decoder = &StorageStatisticsByFileType{} - _ bin.BareEncoder = &StorageStatisticsByFileType{} - _ bin.BareDecoder = &StorageStatisticsByFileType{} -) - -func (s *StorageStatisticsByFileType) Zero() bool { - if s == nil { - return true - } - if !(s.FileType == nil) { - return false - } - if !(s.Size == 0) { - return false - } - if !(s.Count == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StorageStatisticsByFileType) String() string { - if s == nil { - return "StorageStatisticsByFileType(nil)" - } - type Alias StorageStatisticsByFileType - return fmt.Sprintf("StorageStatisticsByFileType%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StorageStatisticsByFileType) TypeID() uint32 { - return StorageStatisticsByFileTypeTypeID -} - -// TypeName returns name of type in TL schema. -func (*StorageStatisticsByFileType) TypeName() string { - return "storageStatisticsByFileType" -} - -// TypeInfo returns info about TL type. -func (s *StorageStatisticsByFileType) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storageStatisticsByFileType", - ID: StorageStatisticsByFileTypeTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileType", - SchemaName: "file_type", - }, - { - Name: "Size", - SchemaName: "size", - }, - { - Name: "Count", - SchemaName: "count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StorageStatisticsByFileType) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storageStatisticsByFileType#2a8ef8a8 as nil") - } - b.PutID(StorageStatisticsByFileTypeTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StorageStatisticsByFileType) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storageStatisticsByFileType#2a8ef8a8 as nil") - } - if s.FileType == nil { - return fmt.Errorf("unable to encode storageStatisticsByFileType#2a8ef8a8: field file_type is nil") - } - if err := s.FileType.Encode(b); err != nil { - return fmt.Errorf("unable to encode storageStatisticsByFileType#2a8ef8a8: field file_type: %w", err) - } - b.PutInt53(s.Size) - b.PutInt32(s.Count) - return nil -} - -// Decode implements bin.Decoder. -func (s *StorageStatisticsByFileType) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storageStatisticsByFileType#2a8ef8a8 to nil") - } - if err := b.ConsumeID(StorageStatisticsByFileTypeTypeID); err != nil { - return fmt.Errorf("unable to decode storageStatisticsByFileType#2a8ef8a8: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StorageStatisticsByFileType) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storageStatisticsByFileType#2a8ef8a8 to nil") - } - { - value, err := DecodeFileType(b) - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByFileType#2a8ef8a8: field file_type: %w", err) - } - s.FileType = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByFileType#2a8ef8a8: field size: %w", err) - } - s.Size = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByFileType#2a8ef8a8: field count: %w", err) - } - s.Count = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StorageStatisticsByFileType) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storageStatisticsByFileType#2a8ef8a8 as nil") - } - b.ObjStart() - b.PutID("storageStatisticsByFileType") - b.Comma() - b.FieldStart("file_type") - if s.FileType == nil { - return fmt.Errorf("unable to encode storageStatisticsByFileType#2a8ef8a8: field file_type is nil") - } - if err := s.FileType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storageStatisticsByFileType#2a8ef8a8: field file_type: %w", err) - } - b.Comma() - b.FieldStart("size") - b.PutInt53(s.Size) - b.Comma() - b.FieldStart("count") - b.PutInt32(s.Count) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StorageStatisticsByFileType) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storageStatisticsByFileType#2a8ef8a8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storageStatisticsByFileType"); err != nil { - return fmt.Errorf("unable to decode storageStatisticsByFileType#2a8ef8a8: %w", err) - } - case "file_type": - value, err := DecodeTDLibJSONFileType(b) - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByFileType#2a8ef8a8: field file_type: %w", err) - } - s.FileType = value - case "size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByFileType#2a8ef8a8: field size: %w", err) - } - s.Size = value - case "count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsByFileType#2a8ef8a8: field count: %w", err) - } - s.Count = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileType returns value of FileType field. -func (s *StorageStatisticsByFileType) GetFileType() (value FileTypeClass) { - if s == nil { - return - } - return s.FileType -} - -// GetSize returns value of Size field. -func (s *StorageStatisticsByFileType) GetSize() (value int64) { - if s == nil { - return - } - return s.Size -} - -// GetCount returns value of Count field. -func (s *StorageStatisticsByFileType) GetCount() (value int32) { - if s == nil { - return - } - return s.Count -} diff --git a/tdapi/tl_storage_statistics_fast_gen.go b/tdapi/tl_storage_statistics_fast_gen.go deleted file mode 100644 index d24396032..000000000 --- a/tdapi/tl_storage_statistics_fast_gen.go +++ /dev/null @@ -1,329 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StorageStatisticsFast represents TL type `storageStatisticsFast#cb412861`. -type StorageStatisticsFast struct { - // Approximate total size of files, in bytes - FilesSize int64 - // Approximate number of files - FileCount int32 - // Size of the database - DatabaseSize int64 - // Size of the language pack database - LanguagePackDatabaseSize int64 - // Size of the TDLib internal log - LogSize int64 -} - -// StorageStatisticsFastTypeID is TL type id of StorageStatisticsFast. -const StorageStatisticsFastTypeID = 0xcb412861 - -// Ensuring interfaces in compile-time for StorageStatisticsFast. -var ( - _ bin.Encoder = &StorageStatisticsFast{} - _ bin.Decoder = &StorageStatisticsFast{} - _ bin.BareEncoder = &StorageStatisticsFast{} - _ bin.BareDecoder = &StorageStatisticsFast{} -) - -func (s *StorageStatisticsFast) Zero() bool { - if s == nil { - return true - } - if !(s.FilesSize == 0) { - return false - } - if !(s.FileCount == 0) { - return false - } - if !(s.DatabaseSize == 0) { - return false - } - if !(s.LanguagePackDatabaseSize == 0) { - return false - } - if !(s.LogSize == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StorageStatisticsFast) String() string { - if s == nil { - return "StorageStatisticsFast(nil)" - } - type Alias StorageStatisticsFast - return fmt.Sprintf("StorageStatisticsFast%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StorageStatisticsFast) TypeID() uint32 { - return StorageStatisticsFastTypeID -} - -// TypeName returns name of type in TL schema. -func (*StorageStatisticsFast) TypeName() string { - return "storageStatisticsFast" -} - -// TypeInfo returns info about TL type. -func (s *StorageStatisticsFast) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storageStatisticsFast", - ID: StorageStatisticsFastTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FilesSize", - SchemaName: "files_size", - }, - { - Name: "FileCount", - SchemaName: "file_count", - }, - { - Name: "DatabaseSize", - SchemaName: "database_size", - }, - { - Name: "LanguagePackDatabaseSize", - SchemaName: "language_pack_database_size", - }, - { - Name: "LogSize", - SchemaName: "log_size", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StorageStatisticsFast) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storageStatisticsFast#cb412861 as nil") - } - b.PutID(StorageStatisticsFastTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StorageStatisticsFast) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storageStatisticsFast#cb412861 as nil") - } - b.PutInt53(s.FilesSize) - b.PutInt32(s.FileCount) - b.PutInt53(s.DatabaseSize) - b.PutInt53(s.LanguagePackDatabaseSize) - b.PutInt53(s.LogSize) - return nil -} - -// Decode implements bin.Decoder. -func (s *StorageStatisticsFast) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storageStatisticsFast#cb412861 to nil") - } - if err := b.ConsumeID(StorageStatisticsFastTypeID); err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StorageStatisticsFast) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storageStatisticsFast#cb412861 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: field files_size: %w", err) - } - s.FilesSize = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: field file_count: %w", err) - } - s.FileCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: field database_size: %w", err) - } - s.DatabaseSize = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: field language_pack_database_size: %w", err) - } - s.LanguagePackDatabaseSize = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: field log_size: %w", err) - } - s.LogSize = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StorageStatisticsFast) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storageStatisticsFast#cb412861 as nil") - } - b.ObjStart() - b.PutID("storageStatisticsFast") - b.Comma() - b.FieldStart("files_size") - b.PutInt53(s.FilesSize) - b.Comma() - b.FieldStart("file_count") - b.PutInt32(s.FileCount) - b.Comma() - b.FieldStart("database_size") - b.PutInt53(s.DatabaseSize) - b.Comma() - b.FieldStart("language_pack_database_size") - b.PutInt53(s.LanguagePackDatabaseSize) - b.Comma() - b.FieldStart("log_size") - b.PutInt53(s.LogSize) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StorageStatisticsFast) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storageStatisticsFast#cb412861 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storageStatisticsFast"); err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: %w", err) - } - case "files_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: field files_size: %w", err) - } - s.FilesSize = value - case "file_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: field file_count: %w", err) - } - s.FileCount = value - case "database_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: field database_size: %w", err) - } - s.DatabaseSize = value - case "language_pack_database_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: field language_pack_database_size: %w", err) - } - s.LanguagePackDatabaseSize = value - case "log_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatisticsFast#cb412861: field log_size: %w", err) - } - s.LogSize = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFilesSize returns value of FilesSize field. -func (s *StorageStatisticsFast) GetFilesSize() (value int64) { - if s == nil { - return - } - return s.FilesSize -} - -// GetFileCount returns value of FileCount field. -func (s *StorageStatisticsFast) GetFileCount() (value int32) { - if s == nil { - return - } - return s.FileCount -} - -// GetDatabaseSize returns value of DatabaseSize field. -func (s *StorageStatisticsFast) GetDatabaseSize() (value int64) { - if s == nil { - return - } - return s.DatabaseSize -} - -// GetLanguagePackDatabaseSize returns value of LanguagePackDatabaseSize field. -func (s *StorageStatisticsFast) GetLanguagePackDatabaseSize() (value int64) { - if s == nil { - return - } - return s.LanguagePackDatabaseSize -} - -// GetLogSize returns value of LogSize field. -func (s *StorageStatisticsFast) GetLogSize() (value int64) { - if s == nil { - return - } - return s.LogSize -} diff --git a/tdapi/tl_storage_statistics_gen.go b/tdapi/tl_storage_statistics_gen.go deleted file mode 100644 index 4163667fb..000000000 --- a/tdapi/tl_storage_statistics_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StorageStatistics represents TL type `storageStatistics#69b98672`. -type StorageStatistics struct { - // Total size of files, in bytes - Size int64 - // Total number of files - Count int32 - // Statistics split by chats - ByChat []StorageStatisticsByChat -} - -// StorageStatisticsTypeID is TL type id of StorageStatistics. -const StorageStatisticsTypeID = 0x69b98672 - -// Ensuring interfaces in compile-time for StorageStatistics. -var ( - _ bin.Encoder = &StorageStatistics{} - _ bin.Decoder = &StorageStatistics{} - _ bin.BareEncoder = &StorageStatistics{} - _ bin.BareDecoder = &StorageStatistics{} -) - -func (s *StorageStatistics) Zero() bool { - if s == nil { - return true - } - if !(s.Size == 0) { - return false - } - if !(s.Count == 0) { - return false - } - if !(s.ByChat == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StorageStatistics) String() string { - if s == nil { - return "StorageStatistics(nil)" - } - type Alias StorageStatistics - return fmt.Sprintf("StorageStatistics%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StorageStatistics) TypeID() uint32 { - return StorageStatisticsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StorageStatistics) TypeName() string { - return "storageStatistics" -} - -// TypeInfo returns info about TL type. -func (s *StorageStatistics) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storageStatistics", - ID: StorageStatisticsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Size", - SchemaName: "size", - }, - { - Name: "Count", - SchemaName: "count", - }, - { - Name: "ByChat", - SchemaName: "by_chat", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StorageStatistics) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storageStatistics#69b98672 as nil") - } - b.PutID(StorageStatisticsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StorageStatistics) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storageStatistics#69b98672 as nil") - } - b.PutInt53(s.Size) - b.PutInt32(s.Count) - b.PutInt(len(s.ByChat)) - for idx, v := range s.ByChat { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare storageStatistics#69b98672: field by_chat element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StorageStatistics) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storageStatistics#69b98672 to nil") - } - if err := b.ConsumeID(StorageStatisticsTypeID); err != nil { - return fmt.Errorf("unable to decode storageStatistics#69b98672: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StorageStatistics) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storageStatistics#69b98672 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatistics#69b98672: field size: %w", err) - } - s.Size = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storageStatistics#69b98672: field count: %w", err) - } - s.Count = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode storageStatistics#69b98672: field by_chat: %w", err) - } - - if headerLen > 0 { - s.ByChat = make([]StorageStatisticsByChat, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StorageStatisticsByChat - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare storageStatistics#69b98672: field by_chat: %w", err) - } - s.ByChat = append(s.ByChat, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StorageStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storageStatistics#69b98672 as nil") - } - b.ObjStart() - b.PutID("storageStatistics") - b.Comma() - b.FieldStart("size") - b.PutInt53(s.Size) - b.Comma() - b.FieldStart("count") - b.PutInt32(s.Count) - b.Comma() - b.FieldStart("by_chat") - b.ArrStart() - for idx, v := range s.ByChat { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storageStatistics#69b98672: field by_chat element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StorageStatistics) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storageStatistics#69b98672 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storageStatistics"); err != nil { - return fmt.Errorf("unable to decode storageStatistics#69b98672: %w", err) - } - case "size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storageStatistics#69b98672: field size: %w", err) - } - s.Size = value - case "count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storageStatistics#69b98672: field count: %w", err) - } - s.Count = value - case "by_chat": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StorageStatisticsByChat - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storageStatistics#69b98672: field by_chat: %w", err) - } - s.ByChat = append(s.ByChat, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode storageStatistics#69b98672: field by_chat: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSize returns value of Size field. -func (s *StorageStatistics) GetSize() (value int64) { - if s == nil { - return - } - return s.Size -} - -// GetCount returns value of Count field. -func (s *StorageStatistics) GetCount() (value int32) { - if s == nil { - return - } - return s.Count -} - -// GetByChat returns value of ByChat field. -func (s *StorageStatistics) GetByChat() (value []StorageStatisticsByChat) { - if s == nil { - return - } - return s.ByChat -} diff --git a/tdapi/tl_store_payment_purpose_gen.go b/tdapi/tl_store_payment_purpose_gen.go deleted file mode 100644 index 242abcc79..000000000 --- a/tdapi/tl_store_payment_purpose_gen.go +++ /dev/null @@ -1,1798 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StorePaymentPurposePremiumSubscription represents TL type `storePaymentPurposePremiumSubscription#4b558114`. -type StorePaymentPurposePremiumSubscription struct { - // Pass true if this is a restore of a Telegram Premium purchase; only for App Store - IsRestore bool - // Pass true if this is an upgrade from a monthly subscription to early subscription; - // only for App Store - IsUpgrade bool -} - -// StorePaymentPurposePremiumSubscriptionTypeID is TL type id of StorePaymentPurposePremiumSubscription. -const StorePaymentPurposePremiumSubscriptionTypeID = 0x4b558114 - -// construct implements constructor of StorePaymentPurposeClass. -func (s StorePaymentPurposePremiumSubscription) construct() StorePaymentPurposeClass { return &s } - -// Ensuring interfaces in compile-time for StorePaymentPurposePremiumSubscription. -var ( - _ bin.Encoder = &StorePaymentPurposePremiumSubscription{} - _ bin.Decoder = &StorePaymentPurposePremiumSubscription{} - _ bin.BareEncoder = &StorePaymentPurposePremiumSubscription{} - _ bin.BareDecoder = &StorePaymentPurposePremiumSubscription{} - - _ StorePaymentPurposeClass = &StorePaymentPurposePremiumSubscription{} -) - -func (s *StorePaymentPurposePremiumSubscription) Zero() bool { - if s == nil { - return true - } - if !(s.IsRestore == false) { - return false - } - if !(s.IsUpgrade == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StorePaymentPurposePremiumSubscription) String() string { - if s == nil { - return "StorePaymentPurposePremiumSubscription(nil)" - } - type Alias StorePaymentPurposePremiumSubscription - return fmt.Sprintf("StorePaymentPurposePremiumSubscription%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StorePaymentPurposePremiumSubscription) TypeID() uint32 { - return StorePaymentPurposePremiumSubscriptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*StorePaymentPurposePremiumSubscription) TypeName() string { - return "storePaymentPurposePremiumSubscription" -} - -// TypeInfo returns info about TL type. -func (s *StorePaymentPurposePremiumSubscription) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storePaymentPurposePremiumSubscription", - ID: StorePaymentPurposePremiumSubscriptionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsRestore", - SchemaName: "is_restore", - }, - { - Name: "IsUpgrade", - SchemaName: "is_upgrade", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StorePaymentPurposePremiumSubscription) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumSubscription#4b558114 as nil") - } - b.PutID(StorePaymentPurposePremiumSubscriptionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StorePaymentPurposePremiumSubscription) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumSubscription#4b558114 as nil") - } - b.PutBool(s.IsRestore) - b.PutBool(s.IsUpgrade) - return nil -} - -// Decode implements bin.Decoder. -func (s *StorePaymentPurposePremiumSubscription) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumSubscription#4b558114 to nil") - } - if err := b.ConsumeID(StorePaymentPurposePremiumSubscriptionTypeID); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumSubscription#4b558114: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StorePaymentPurposePremiumSubscription) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumSubscription#4b558114 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumSubscription#4b558114: field is_restore: %w", err) - } - s.IsRestore = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumSubscription#4b558114: field is_upgrade: %w", err) - } - s.IsUpgrade = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StorePaymentPurposePremiumSubscription) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumSubscription#4b558114 as nil") - } - b.ObjStart() - b.PutID("storePaymentPurposePremiumSubscription") - b.Comma() - b.FieldStart("is_restore") - b.PutBool(s.IsRestore) - b.Comma() - b.FieldStart("is_upgrade") - b.PutBool(s.IsUpgrade) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StorePaymentPurposePremiumSubscription) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumSubscription#4b558114 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storePaymentPurposePremiumSubscription"); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumSubscription#4b558114: %w", err) - } - case "is_restore": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumSubscription#4b558114: field is_restore: %w", err) - } - s.IsRestore = value - case "is_upgrade": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumSubscription#4b558114: field is_upgrade: %w", err) - } - s.IsUpgrade = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsRestore returns value of IsRestore field. -func (s *StorePaymentPurposePremiumSubscription) GetIsRestore() (value bool) { - if s == nil { - return - } - return s.IsRestore -} - -// GetIsUpgrade returns value of IsUpgrade field. -func (s *StorePaymentPurposePremiumSubscription) GetIsUpgrade() (value bool) { - if s == nil { - return - } - return s.IsUpgrade -} - -// StorePaymentPurposePremiumGiftCodes represents TL type `storePaymentPurposePremiumGiftCodes#1277b01d`. -type StorePaymentPurposePremiumGiftCodes struct { - // Identifier of the supergroup or channel chat, which will be automatically boosted by - // the users for duration of the Premium subscription and which is administered by the - // user; 0 if none - BoostedChatID int64 - // ISO 4217 currency code of the payment currency - Currency string - // Paid amount, in the smallest units of the currency - Amount int64 - // Identifiers of the users which can activate the gift codes - UserIDs []int64 - // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters - // Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are - // allowed - Text FormattedText -} - -// StorePaymentPurposePremiumGiftCodesTypeID is TL type id of StorePaymentPurposePremiumGiftCodes. -const StorePaymentPurposePremiumGiftCodesTypeID = 0x1277b01d - -// construct implements constructor of StorePaymentPurposeClass. -func (s StorePaymentPurposePremiumGiftCodes) construct() StorePaymentPurposeClass { return &s } - -// Ensuring interfaces in compile-time for StorePaymentPurposePremiumGiftCodes. -var ( - _ bin.Encoder = &StorePaymentPurposePremiumGiftCodes{} - _ bin.Decoder = &StorePaymentPurposePremiumGiftCodes{} - _ bin.BareEncoder = &StorePaymentPurposePremiumGiftCodes{} - _ bin.BareDecoder = &StorePaymentPurposePremiumGiftCodes{} - - _ StorePaymentPurposeClass = &StorePaymentPurposePremiumGiftCodes{} -) - -func (s *StorePaymentPurposePremiumGiftCodes) Zero() bool { - if s == nil { - return true - } - if !(s.BoostedChatID == 0) { - return false - } - if !(s.Currency == "") { - return false - } - if !(s.Amount == 0) { - return false - } - if !(s.UserIDs == nil) { - return false - } - if !(s.Text.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StorePaymentPurposePremiumGiftCodes) String() string { - if s == nil { - return "StorePaymentPurposePremiumGiftCodes(nil)" - } - type Alias StorePaymentPurposePremiumGiftCodes - return fmt.Sprintf("StorePaymentPurposePremiumGiftCodes%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StorePaymentPurposePremiumGiftCodes) TypeID() uint32 { - return StorePaymentPurposePremiumGiftCodesTypeID -} - -// TypeName returns name of type in TL schema. -func (*StorePaymentPurposePremiumGiftCodes) TypeName() string { - return "storePaymentPurposePremiumGiftCodes" -} - -// TypeInfo returns info about TL type. -func (s *StorePaymentPurposePremiumGiftCodes) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storePaymentPurposePremiumGiftCodes", - ID: StorePaymentPurposePremiumGiftCodesTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BoostedChatID", - SchemaName: "boosted_chat_id", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StorePaymentPurposePremiumGiftCodes) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumGiftCodes#1277b01d as nil") - } - b.PutID(StorePaymentPurposePremiumGiftCodesTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StorePaymentPurposePremiumGiftCodes) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumGiftCodes#1277b01d as nil") - } - b.PutInt53(s.BoostedChatID) - b.PutString(s.Currency) - b.PutInt53(s.Amount) - b.PutInt(len(s.UserIDs)) - for _, v := range s.UserIDs { - b.PutInt53(v) - } - if err := s.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode storePaymentPurposePremiumGiftCodes#1277b01d: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StorePaymentPurposePremiumGiftCodes) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumGiftCodes#1277b01d to nil") - } - if err := b.ConsumeID(StorePaymentPurposePremiumGiftCodesTypeID); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StorePaymentPurposePremiumGiftCodes) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumGiftCodes#1277b01d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field boosted_chat_id: %w", err) - } - s.BoostedChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field currency: %w", err) - } - s.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field amount: %w", err) - } - s.Amount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field user_ids: %w", err) - } - - if headerLen > 0 { - s.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field user_ids: %w", err) - } - s.UserIDs = append(s.UserIDs, value) - } - } - { - if err := s.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field text: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StorePaymentPurposePremiumGiftCodes) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumGiftCodes#1277b01d as nil") - } - b.ObjStart() - b.PutID("storePaymentPurposePremiumGiftCodes") - b.Comma() - b.FieldStart("boosted_chat_id") - b.PutInt53(s.BoostedChatID) - b.Comma() - b.FieldStart("currency") - b.PutString(s.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(s.Amount) - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range s.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("text") - if err := s.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storePaymentPurposePremiumGiftCodes#1277b01d: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StorePaymentPurposePremiumGiftCodes) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumGiftCodes#1277b01d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storePaymentPurposePremiumGiftCodes"); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: %w", err) - } - case "boosted_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field boosted_chat_id: %w", err) - } - s.BoostedChatID = value - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field currency: %w", err) - } - s.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field amount: %w", err) - } - s.Amount = value - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field user_ids: %w", err) - } - s.UserIDs = append(s.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field user_ids: %w", err) - } - case "text": - if err := s.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiftCodes#1277b01d: field text: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBoostedChatID returns value of BoostedChatID field. -func (s *StorePaymentPurposePremiumGiftCodes) GetBoostedChatID() (value int64) { - if s == nil { - return - } - return s.BoostedChatID -} - -// GetCurrency returns value of Currency field. -func (s *StorePaymentPurposePremiumGiftCodes) GetCurrency() (value string) { - if s == nil { - return - } - return s.Currency -} - -// GetAmount returns value of Amount field. -func (s *StorePaymentPurposePremiumGiftCodes) GetAmount() (value int64) { - if s == nil { - return - } - return s.Amount -} - -// GetUserIDs returns value of UserIDs field. -func (s *StorePaymentPurposePremiumGiftCodes) GetUserIDs() (value []int64) { - if s == nil { - return - } - return s.UserIDs -} - -// GetText returns value of Text field. -func (s *StorePaymentPurposePremiumGiftCodes) GetText() (value FormattedText) { - if s == nil { - return - } - return s.Text -} - -// StorePaymentPurposePremiumGiveaway represents TL type `storePaymentPurposePremiumGiveaway#4da47aaa`. -type StorePaymentPurposePremiumGiveaway struct { - // Giveaway parameters - Parameters GiveawayParameters - // ISO 4217 currency code of the payment currency - Currency string - // Paid amount, in the smallest units of the currency - Amount int64 -} - -// StorePaymentPurposePremiumGiveawayTypeID is TL type id of StorePaymentPurposePremiumGiveaway. -const StorePaymentPurposePremiumGiveawayTypeID = 0x4da47aaa - -// construct implements constructor of StorePaymentPurposeClass. -func (s StorePaymentPurposePremiumGiveaway) construct() StorePaymentPurposeClass { return &s } - -// Ensuring interfaces in compile-time for StorePaymentPurposePremiumGiveaway. -var ( - _ bin.Encoder = &StorePaymentPurposePremiumGiveaway{} - _ bin.Decoder = &StorePaymentPurposePremiumGiveaway{} - _ bin.BareEncoder = &StorePaymentPurposePremiumGiveaway{} - _ bin.BareDecoder = &StorePaymentPurposePremiumGiveaway{} - - _ StorePaymentPurposeClass = &StorePaymentPurposePremiumGiveaway{} -) - -func (s *StorePaymentPurposePremiumGiveaway) Zero() bool { - if s == nil { - return true - } - if !(s.Parameters.Zero()) { - return false - } - if !(s.Currency == "") { - return false - } - if !(s.Amount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StorePaymentPurposePremiumGiveaway) String() string { - if s == nil { - return "StorePaymentPurposePremiumGiveaway(nil)" - } - type Alias StorePaymentPurposePremiumGiveaway - return fmt.Sprintf("StorePaymentPurposePremiumGiveaway%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StorePaymentPurposePremiumGiveaway) TypeID() uint32 { - return StorePaymentPurposePremiumGiveawayTypeID -} - -// TypeName returns name of type in TL schema. -func (*StorePaymentPurposePremiumGiveaway) TypeName() string { - return "storePaymentPurposePremiumGiveaway" -} - -// TypeInfo returns info about TL type. -func (s *StorePaymentPurposePremiumGiveaway) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storePaymentPurposePremiumGiveaway", - ID: StorePaymentPurposePremiumGiveawayTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Parameters", - SchemaName: "parameters", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StorePaymentPurposePremiumGiveaway) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumGiveaway#4da47aaa as nil") - } - b.PutID(StorePaymentPurposePremiumGiveawayTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StorePaymentPurposePremiumGiveaway) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumGiveaway#4da47aaa as nil") - } - if err := s.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode storePaymentPurposePremiumGiveaway#4da47aaa: field parameters: %w", err) - } - b.PutString(s.Currency) - b.PutInt53(s.Amount) - return nil -} - -// Decode implements bin.Decoder. -func (s *StorePaymentPurposePremiumGiveaway) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumGiveaway#4da47aaa to nil") - } - if err := b.ConsumeID(StorePaymentPurposePremiumGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StorePaymentPurposePremiumGiveaway) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumGiveaway#4da47aaa to nil") - } - { - if err := s.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field parameters: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field currency: %w", err) - } - s.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field amount: %w", err) - } - s.Amount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StorePaymentPurposePremiumGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposePremiumGiveaway#4da47aaa as nil") - } - b.ObjStart() - b.PutID("storePaymentPurposePremiumGiveaway") - b.Comma() - b.FieldStart("parameters") - if err := s.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storePaymentPurposePremiumGiveaway#4da47aaa: field parameters: %w", err) - } - b.Comma() - b.FieldStart("currency") - b.PutString(s.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(s.Amount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StorePaymentPurposePremiumGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposePremiumGiveaway#4da47aaa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storePaymentPurposePremiumGiveaway"); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: %w", err) - } - case "parameters": - if err := s.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field parameters: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field currency: %w", err) - } - s.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposePremiumGiveaway#4da47aaa: field amount: %w", err) - } - s.Amount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetParameters returns value of Parameters field. -func (s *StorePaymentPurposePremiumGiveaway) GetParameters() (value GiveawayParameters) { - if s == nil { - return - } - return s.Parameters -} - -// GetCurrency returns value of Currency field. -func (s *StorePaymentPurposePremiumGiveaway) GetCurrency() (value string) { - if s == nil { - return - } - return s.Currency -} - -// GetAmount returns value of Amount field. -func (s *StorePaymentPurposePremiumGiveaway) GetAmount() (value int64) { - if s == nil { - return - } - return s.Amount -} - -// StorePaymentPurposeStarGiveaway represents TL type `storePaymentPurposeStarGiveaway#c96d899`. -type StorePaymentPurposeStarGiveaway struct { - // Giveaway parameters - Parameters GiveawayParameters - // ISO 4217 currency code of the payment currency - Currency string - // Paid amount, in the smallest units of the currency - Amount int64 - // The number of users to receive Telegram Stars - WinnerCount int32 - // The number of Telegram Stars to be distributed through the giveaway - StarCount int64 -} - -// StorePaymentPurposeStarGiveawayTypeID is TL type id of StorePaymentPurposeStarGiveaway. -const StorePaymentPurposeStarGiveawayTypeID = 0xc96d899 - -// construct implements constructor of StorePaymentPurposeClass. -func (s StorePaymentPurposeStarGiveaway) construct() StorePaymentPurposeClass { return &s } - -// Ensuring interfaces in compile-time for StorePaymentPurposeStarGiveaway. -var ( - _ bin.Encoder = &StorePaymentPurposeStarGiveaway{} - _ bin.Decoder = &StorePaymentPurposeStarGiveaway{} - _ bin.BareEncoder = &StorePaymentPurposeStarGiveaway{} - _ bin.BareDecoder = &StorePaymentPurposeStarGiveaway{} - - _ StorePaymentPurposeClass = &StorePaymentPurposeStarGiveaway{} -) - -func (s *StorePaymentPurposeStarGiveaway) Zero() bool { - if s == nil { - return true - } - if !(s.Parameters.Zero()) { - return false - } - if !(s.Currency == "") { - return false - } - if !(s.Amount == 0) { - return false - } - if !(s.WinnerCount == 0) { - return false - } - if !(s.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StorePaymentPurposeStarGiveaway) String() string { - if s == nil { - return "StorePaymentPurposeStarGiveaway(nil)" - } - type Alias StorePaymentPurposeStarGiveaway - return fmt.Sprintf("StorePaymentPurposeStarGiveaway%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StorePaymentPurposeStarGiveaway) TypeID() uint32 { - return StorePaymentPurposeStarGiveawayTypeID -} - -// TypeName returns name of type in TL schema. -func (*StorePaymentPurposeStarGiveaway) TypeName() string { - return "storePaymentPurposeStarGiveaway" -} - -// TypeInfo returns info about TL type. -func (s *StorePaymentPurposeStarGiveaway) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storePaymentPurposeStarGiveaway", - ID: StorePaymentPurposeStarGiveawayTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Parameters", - SchemaName: "parameters", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StorePaymentPurposeStarGiveaway) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposeStarGiveaway#c96d899 as nil") - } - b.PutID(StorePaymentPurposeStarGiveawayTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StorePaymentPurposeStarGiveaway) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposeStarGiveaway#c96d899 as nil") - } - if err := s.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode storePaymentPurposeStarGiveaway#c96d899: field parameters: %w", err) - } - b.PutString(s.Currency) - b.PutInt53(s.Amount) - b.PutInt32(s.WinnerCount) - b.PutInt53(s.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (s *StorePaymentPurposeStarGiveaway) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposeStarGiveaway#c96d899 to nil") - } - if err := b.ConsumeID(StorePaymentPurposeStarGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StorePaymentPurposeStarGiveaway) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposeStarGiveaway#c96d899 to nil") - } - { - if err := s.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field parameters: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field currency: %w", err) - } - s.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field amount: %w", err) - } - s.Amount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field winner_count: %w", err) - } - s.WinnerCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field star_count: %w", err) - } - s.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StorePaymentPurposeStarGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposeStarGiveaway#c96d899 as nil") - } - b.ObjStart() - b.PutID("storePaymentPurposeStarGiveaway") - b.Comma() - b.FieldStart("parameters") - if err := s.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storePaymentPurposeStarGiveaway#c96d899: field parameters: %w", err) - } - b.Comma() - b.FieldStart("currency") - b.PutString(s.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(s.Amount) - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(s.WinnerCount) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(s.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StorePaymentPurposeStarGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposeStarGiveaway#c96d899 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storePaymentPurposeStarGiveaway"); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: %w", err) - } - case "parameters": - if err := s.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field parameters: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field currency: %w", err) - } - s.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field amount: %w", err) - } - s.Amount = value - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field winner_count: %w", err) - } - s.WinnerCount = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStarGiveaway#c96d899: field star_count: %w", err) - } - s.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetParameters returns value of Parameters field. -func (s *StorePaymentPurposeStarGiveaway) GetParameters() (value GiveawayParameters) { - if s == nil { - return - } - return s.Parameters -} - -// GetCurrency returns value of Currency field. -func (s *StorePaymentPurposeStarGiveaway) GetCurrency() (value string) { - if s == nil { - return - } - return s.Currency -} - -// GetAmount returns value of Amount field. -func (s *StorePaymentPurposeStarGiveaway) GetAmount() (value int64) { - if s == nil { - return - } - return s.Amount -} - -// GetWinnerCount returns value of WinnerCount field. -func (s *StorePaymentPurposeStarGiveaway) GetWinnerCount() (value int32) { - if s == nil { - return - } - return s.WinnerCount -} - -// GetStarCount returns value of StarCount field. -func (s *StorePaymentPurposeStarGiveaway) GetStarCount() (value int64) { - if s == nil { - return - } - return s.StarCount -} - -// StorePaymentPurposeStars represents TL type `storePaymentPurposeStars#9480cf14`. -type StorePaymentPurposeStars struct { - // ISO 4217 currency code of the payment currency - Currency string - // Paid amount, in the smallest units of the currency - Amount int64 - // Number of bought Telegram Stars - StarCount int64 -} - -// StorePaymentPurposeStarsTypeID is TL type id of StorePaymentPurposeStars. -const StorePaymentPurposeStarsTypeID = 0x9480cf14 - -// construct implements constructor of StorePaymentPurposeClass. -func (s StorePaymentPurposeStars) construct() StorePaymentPurposeClass { return &s } - -// Ensuring interfaces in compile-time for StorePaymentPurposeStars. -var ( - _ bin.Encoder = &StorePaymentPurposeStars{} - _ bin.Decoder = &StorePaymentPurposeStars{} - _ bin.BareEncoder = &StorePaymentPurposeStars{} - _ bin.BareDecoder = &StorePaymentPurposeStars{} - - _ StorePaymentPurposeClass = &StorePaymentPurposeStars{} -) - -func (s *StorePaymentPurposeStars) Zero() bool { - if s == nil { - return true - } - if !(s.Currency == "") { - return false - } - if !(s.Amount == 0) { - return false - } - if !(s.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StorePaymentPurposeStars) String() string { - if s == nil { - return "StorePaymentPurposeStars(nil)" - } - type Alias StorePaymentPurposeStars - return fmt.Sprintf("StorePaymentPurposeStars%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StorePaymentPurposeStars) TypeID() uint32 { - return StorePaymentPurposeStarsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StorePaymentPurposeStars) TypeName() string { - return "storePaymentPurposeStars" -} - -// TypeInfo returns info about TL type. -func (s *StorePaymentPurposeStars) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storePaymentPurposeStars", - ID: StorePaymentPurposeStarsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StorePaymentPurposeStars) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposeStars#9480cf14 as nil") - } - b.PutID(StorePaymentPurposeStarsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StorePaymentPurposeStars) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposeStars#9480cf14 as nil") - } - b.PutString(s.Currency) - b.PutInt53(s.Amount) - b.PutInt53(s.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (s *StorePaymentPurposeStars) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposeStars#9480cf14 to nil") - } - if err := b.ConsumeID(StorePaymentPurposeStarsTypeID); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStars#9480cf14: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StorePaymentPurposeStars) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposeStars#9480cf14 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStars#9480cf14: field currency: %w", err) - } - s.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStars#9480cf14: field amount: %w", err) - } - s.Amount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStars#9480cf14: field star_count: %w", err) - } - s.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StorePaymentPurposeStars) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposeStars#9480cf14 as nil") - } - b.ObjStart() - b.PutID("storePaymentPurposeStars") - b.Comma() - b.FieldStart("currency") - b.PutString(s.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(s.Amount) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(s.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StorePaymentPurposeStars) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposeStars#9480cf14 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storePaymentPurposeStars"); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStars#9480cf14: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStars#9480cf14: field currency: %w", err) - } - s.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStars#9480cf14: field amount: %w", err) - } - s.Amount = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeStars#9480cf14: field star_count: %w", err) - } - s.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCurrency returns value of Currency field. -func (s *StorePaymentPurposeStars) GetCurrency() (value string) { - if s == nil { - return - } - return s.Currency -} - -// GetAmount returns value of Amount field. -func (s *StorePaymentPurposeStars) GetAmount() (value int64) { - if s == nil { - return - } - return s.Amount -} - -// GetStarCount returns value of StarCount field. -func (s *StorePaymentPurposeStars) GetStarCount() (value int64) { - if s == nil { - return - } - return s.StarCount -} - -// StorePaymentPurposeGiftedStars represents TL type `storePaymentPurposeGiftedStars#3544a624`. -type StorePaymentPurposeGiftedStars struct { - // Identifier of the user to which Telegram Stars are gifted - UserID int64 - // ISO 4217 currency code of the payment currency - Currency string - // Paid amount, in the smallest units of the currency - Amount int64 - // Number of bought Telegram Stars - StarCount int64 -} - -// StorePaymentPurposeGiftedStarsTypeID is TL type id of StorePaymentPurposeGiftedStars. -const StorePaymentPurposeGiftedStarsTypeID = 0x3544a624 - -// construct implements constructor of StorePaymentPurposeClass. -func (s StorePaymentPurposeGiftedStars) construct() StorePaymentPurposeClass { return &s } - -// Ensuring interfaces in compile-time for StorePaymentPurposeGiftedStars. -var ( - _ bin.Encoder = &StorePaymentPurposeGiftedStars{} - _ bin.Decoder = &StorePaymentPurposeGiftedStars{} - _ bin.BareEncoder = &StorePaymentPurposeGiftedStars{} - _ bin.BareDecoder = &StorePaymentPurposeGiftedStars{} - - _ StorePaymentPurposeClass = &StorePaymentPurposeGiftedStars{} -) - -func (s *StorePaymentPurposeGiftedStars) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Currency == "") { - return false - } - if !(s.Amount == 0) { - return false - } - if !(s.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StorePaymentPurposeGiftedStars) String() string { - if s == nil { - return "StorePaymentPurposeGiftedStars(nil)" - } - type Alias StorePaymentPurposeGiftedStars - return fmt.Sprintf("StorePaymentPurposeGiftedStars%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StorePaymentPurposeGiftedStars) TypeID() uint32 { - return StorePaymentPurposeGiftedStarsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StorePaymentPurposeGiftedStars) TypeName() string { - return "storePaymentPurposeGiftedStars" -} - -// TypeInfo returns info about TL type. -func (s *StorePaymentPurposeGiftedStars) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storePaymentPurposeGiftedStars", - ID: StorePaymentPurposeGiftedStarsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StorePaymentPurposeGiftedStars) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposeGiftedStars#3544a624 as nil") - } - b.PutID(StorePaymentPurposeGiftedStarsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StorePaymentPurposeGiftedStars) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposeGiftedStars#3544a624 as nil") - } - b.PutInt53(s.UserID) - b.PutString(s.Currency) - b.PutInt53(s.Amount) - b.PutInt53(s.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (s *StorePaymentPurposeGiftedStars) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposeGiftedStars#3544a624 to nil") - } - if err := b.ConsumeID(StorePaymentPurposeGiftedStarsTypeID); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StorePaymentPurposeGiftedStars) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposeGiftedStars#3544a624 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field currency: %w", err) - } - s.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field amount: %w", err) - } - s.Amount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field star_count: %w", err) - } - s.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StorePaymentPurposeGiftedStars) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storePaymentPurposeGiftedStars#3544a624 as nil") - } - b.ObjStart() - b.PutID("storePaymentPurposeGiftedStars") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("currency") - b.PutString(s.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(s.Amount) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(s.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StorePaymentPurposeGiftedStars) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storePaymentPurposeGiftedStars#3544a624 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storePaymentPurposeGiftedStars"); err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field user_id: %w", err) - } - s.UserID = value - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field currency: %w", err) - } - s.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field amount: %w", err) - } - s.Amount = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storePaymentPurposeGiftedStars#3544a624: field star_count: %w", err) - } - s.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *StorePaymentPurposeGiftedStars) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetCurrency returns value of Currency field. -func (s *StorePaymentPurposeGiftedStars) GetCurrency() (value string) { - if s == nil { - return - } - return s.Currency -} - -// GetAmount returns value of Amount field. -func (s *StorePaymentPurposeGiftedStars) GetAmount() (value int64) { - if s == nil { - return - } - return s.Amount -} - -// GetStarCount returns value of StarCount field. -func (s *StorePaymentPurposeGiftedStars) GetStarCount() (value int64) { - if s == nil { - return - } - return s.StarCount -} - -// StorePaymentPurposeClassName is schema name of StorePaymentPurposeClass. -const StorePaymentPurposeClassName = "StorePaymentPurpose" - -// StorePaymentPurposeClass represents StorePaymentPurpose generic type. -// -// Example: -// -// g, err := tdapi.DecodeStorePaymentPurpose(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StorePaymentPurposePremiumSubscription: // storePaymentPurposePremiumSubscription#4b558114 -// case *tdapi.StorePaymentPurposePremiumGiftCodes: // storePaymentPurposePremiumGiftCodes#1277b01d -// case *tdapi.StorePaymentPurposePremiumGiveaway: // storePaymentPurposePremiumGiveaway#4da47aaa -// case *tdapi.StorePaymentPurposeStarGiveaway: // storePaymentPurposeStarGiveaway#c96d899 -// case *tdapi.StorePaymentPurposeStars: // storePaymentPurposeStars#9480cf14 -// case *tdapi.StorePaymentPurposeGiftedStars: // storePaymentPurposeGiftedStars#3544a624 -// default: panic(v) -// } -type StorePaymentPurposeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StorePaymentPurposeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStorePaymentPurpose implements binary de-serialization for StorePaymentPurposeClass. -func DecodeStorePaymentPurpose(buf *bin.Buffer) (StorePaymentPurposeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StorePaymentPurposePremiumSubscriptionTypeID: - // Decoding storePaymentPurposePremiumSubscription#4b558114. - v := StorePaymentPurposePremiumSubscription{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - case StorePaymentPurposePremiumGiftCodesTypeID: - // Decoding storePaymentPurposePremiumGiftCodes#1277b01d. - v := StorePaymentPurposePremiumGiftCodes{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - case StorePaymentPurposePremiumGiveawayTypeID: - // Decoding storePaymentPurposePremiumGiveaway#4da47aaa. - v := StorePaymentPurposePremiumGiveaway{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - case StorePaymentPurposeStarGiveawayTypeID: - // Decoding storePaymentPurposeStarGiveaway#c96d899. - v := StorePaymentPurposeStarGiveaway{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - case StorePaymentPurposeStarsTypeID: - // Decoding storePaymentPurposeStars#9480cf14. - v := StorePaymentPurposeStars{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - case StorePaymentPurposeGiftedStarsTypeID: - // Decoding storePaymentPurposeGiftedStars#3544a624. - v := StorePaymentPurposeGiftedStars{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStorePaymentPurpose implements binary de-serialization for StorePaymentPurposeClass. -func DecodeTDLibJSONStorePaymentPurpose(buf tdjson.Decoder) (StorePaymentPurposeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "storePaymentPurposePremiumSubscription": - // Decoding storePaymentPurposePremiumSubscription#4b558114. - v := StorePaymentPurposePremiumSubscription{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - case "storePaymentPurposePremiumGiftCodes": - // Decoding storePaymentPurposePremiumGiftCodes#1277b01d. - v := StorePaymentPurposePremiumGiftCodes{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - case "storePaymentPurposePremiumGiveaway": - // Decoding storePaymentPurposePremiumGiveaway#4da47aaa. - v := StorePaymentPurposePremiumGiveaway{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - case "storePaymentPurposeStarGiveaway": - // Decoding storePaymentPurposeStarGiveaway#c96d899. - v := StorePaymentPurposeStarGiveaway{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - case "storePaymentPurposeStars": - // Decoding storePaymentPurposeStars#9480cf14. - v := StorePaymentPurposeStars{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - case "storePaymentPurposeGiftedStars": - // Decoding storePaymentPurposeGiftedStars#3544a624. - v := StorePaymentPurposeGiftedStars{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StorePaymentPurposeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StorePaymentPurpose boxes the StorePaymentPurposeClass providing a helper. -type StorePaymentPurposeBox struct { - StorePaymentPurpose StorePaymentPurposeClass -} - -// Decode implements bin.Decoder for StorePaymentPurposeBox. -func (b *StorePaymentPurposeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StorePaymentPurposeBox to nil") - } - v, err := DecodeStorePaymentPurpose(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StorePaymentPurpose = v - return nil -} - -// Encode implements bin.Encode for StorePaymentPurposeBox. -func (b *StorePaymentPurposeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StorePaymentPurpose == nil { - return fmt.Errorf("unable to encode StorePaymentPurposeClass as nil") - } - return b.StorePaymentPurpose.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StorePaymentPurposeBox. -func (b *StorePaymentPurposeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StorePaymentPurposeBox to nil") - } - v, err := DecodeTDLibJSONStorePaymentPurpose(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StorePaymentPurpose = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StorePaymentPurposeBox. -func (b *StorePaymentPurposeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StorePaymentPurpose == nil { - return fmt.Errorf("unable to encode StorePaymentPurposeClass as nil") - } - return b.StorePaymentPurpose.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_stories_gen.go b/tdapi/tl_stories_gen.go deleted file mode 100644 index d0b1d71d8..000000000 --- a/tdapi/tl_stories_gen.go +++ /dev/null @@ -1,314 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Stories represents TL type `stories#b88ff8ff`. -type Stories struct { - // Approximate total number of stories found - TotalCount int32 - // The list of stories - Stories []Story - // Identifiers of the pinned stories; returned only in getChatPostedToChatPageStories - // with from_story_id == 0 - PinnedStoryIDs []int32 -} - -// StoriesTypeID is TL type id of Stories. -const StoriesTypeID = 0xb88ff8ff - -// Ensuring interfaces in compile-time for Stories. -var ( - _ bin.Encoder = &Stories{} - _ bin.Decoder = &Stories{} - _ bin.BareEncoder = &Stories{} - _ bin.BareDecoder = &Stories{} -) - -func (s *Stories) Zero() bool { - if s == nil { - return true - } - if !(s.TotalCount == 0) { - return false - } - if !(s.Stories == nil) { - return false - } - if !(s.PinnedStoryIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *Stories) String() string { - if s == nil { - return "Stories(nil)" - } - type Alias Stories - return fmt.Sprintf("Stories%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Stories) TypeID() uint32 { - return StoriesTypeID -} - -// TypeName returns name of type in TL schema. -func (*Stories) TypeName() string { - return "stories" -} - -// TypeInfo returns info about TL type. -func (s *Stories) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "stories", - ID: StoriesTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Stories", - SchemaName: "stories", - }, - { - Name: "PinnedStoryIDs", - SchemaName: "pinned_story_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *Stories) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stories#b88ff8ff as nil") - } - b.PutID(StoriesTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *Stories) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode stories#b88ff8ff as nil") - } - b.PutInt32(s.TotalCount) - b.PutInt(len(s.Stories)) - for idx, v := range s.Stories { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare stories#b88ff8ff: field stories element with index %d: %w", idx, err) - } - } - b.PutInt(len(s.PinnedStoryIDs)) - for _, v := range s.PinnedStoryIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *Stories) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stories#b88ff8ff to nil") - } - if err := b.ConsumeID(StoriesTypeID); err != nil { - return fmt.Errorf("unable to decode stories#b88ff8ff: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *Stories) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode stories#b88ff8ff to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode stories#b88ff8ff: field total_count: %w", err) - } - s.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode stories#b88ff8ff: field stories: %w", err) - } - - if headerLen > 0 { - s.Stories = make([]Story, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Story - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare stories#b88ff8ff: field stories: %w", err) - } - s.Stories = append(s.Stories, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode stories#b88ff8ff: field pinned_story_ids: %w", err) - } - - if headerLen > 0 { - s.PinnedStoryIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode stories#b88ff8ff: field pinned_story_ids: %w", err) - } - s.PinnedStoryIDs = append(s.PinnedStoryIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *Stories) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode stories#b88ff8ff as nil") - } - b.ObjStart() - b.PutID("stories") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(s.TotalCount) - b.Comma() - b.FieldStart("stories") - b.ArrStart() - for idx, v := range s.Stories { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode stories#b88ff8ff: field stories element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("pinned_story_ids") - b.ArrStart() - for _, v := range s.PinnedStoryIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *Stories) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode stories#b88ff8ff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("stories"); err != nil { - return fmt.Errorf("unable to decode stories#b88ff8ff: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode stories#b88ff8ff: field total_count: %w", err) - } - s.TotalCount = value - case "stories": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Story - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode stories#b88ff8ff: field stories: %w", err) - } - s.Stories = append(s.Stories, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode stories#b88ff8ff: field stories: %w", err) - } - case "pinned_story_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode stories#b88ff8ff: field pinned_story_ids: %w", err) - } - s.PinnedStoryIDs = append(s.PinnedStoryIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode stories#b88ff8ff: field pinned_story_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (s *Stories) GetTotalCount() (value int32) { - if s == nil { - return - } - return s.TotalCount -} - -// GetStories returns value of Stories field. -func (s *Stories) GetStories() (value []Story) { - if s == nil { - return - } - return s.Stories -} - -// GetPinnedStoryIDs returns value of PinnedStoryIDs field. -func (s *Stories) GetPinnedStoryIDs() (value []int32) { - if s == nil { - return - } - return s.PinnedStoryIDs -} diff --git a/tdapi/tl_story_area_gen.go b/tdapi/tl_story_area_gen.go deleted file mode 100644 index 1c75b1401..000000000 --- a/tdapi/tl_story_area_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryArea represents TL type `storyArea#c9ff075e`. -type StoryArea struct { - // Position of the area - Position StoryAreaPosition - // Type of the area - Type StoryAreaTypeClass -} - -// StoryAreaTypeID is TL type id of StoryArea. -const StoryAreaTypeID = 0xc9ff075e - -// Ensuring interfaces in compile-time for StoryArea. -var ( - _ bin.Encoder = &StoryArea{} - _ bin.Decoder = &StoryArea{} - _ bin.BareEncoder = &StoryArea{} - _ bin.BareDecoder = &StoryArea{} -) - -func (s *StoryArea) Zero() bool { - if s == nil { - return true - } - if !(s.Position.Zero()) { - return false - } - if !(s.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryArea) String() string { - if s == nil { - return "StoryArea(nil)" - } - type Alias StoryArea - return fmt.Sprintf("StoryArea%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryArea) TypeID() uint32 { - return StoryAreaTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryArea) TypeName() string { - return "storyArea" -} - -// TypeInfo returns info about TL type. -func (s *StoryArea) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyArea", - ID: StoryAreaTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Position", - SchemaName: "position", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryArea) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyArea#c9ff075e as nil") - } - b.PutID(StoryAreaTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryArea) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyArea#c9ff075e as nil") - } - if err := s.Position.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyArea#c9ff075e: field position: %w", err) - } - if s.Type == nil { - return fmt.Errorf("unable to encode storyArea#c9ff075e: field type is nil") - } - if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyArea#c9ff075e: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryArea) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyArea#c9ff075e to nil") - } - if err := b.ConsumeID(StoryAreaTypeID); err != nil { - return fmt.Errorf("unable to decode storyArea#c9ff075e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryArea) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyArea#c9ff075e to nil") - } - { - if err := s.Position.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyArea#c9ff075e: field position: %w", err) - } - } - { - value, err := DecodeStoryAreaType(b) - if err != nil { - return fmt.Errorf("unable to decode storyArea#c9ff075e: field type: %w", err) - } - s.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryArea) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyArea#c9ff075e as nil") - } - b.ObjStart() - b.PutID("storyArea") - b.Comma() - b.FieldStart("position") - if err := s.Position.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyArea#c9ff075e: field position: %w", err) - } - b.Comma() - b.FieldStart("type") - if s.Type == nil { - return fmt.Errorf("unable to encode storyArea#c9ff075e: field type is nil") - } - if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyArea#c9ff075e: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryArea) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyArea#c9ff075e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyArea"); err != nil { - return fmt.Errorf("unable to decode storyArea#c9ff075e: %w", err) - } - case "position": - if err := s.Position.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyArea#c9ff075e: field position: %w", err) - } - case "type": - value, err := DecodeTDLibJSONStoryAreaType(b) - if err != nil { - return fmt.Errorf("unable to decode storyArea#c9ff075e: field type: %w", err) - } - s.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPosition returns value of Position field. -func (s *StoryArea) GetPosition() (value StoryAreaPosition) { - if s == nil { - return - } - return s.Position -} - -// GetType returns value of Type field. -func (s *StoryArea) GetType() (value StoryAreaTypeClass) { - if s == nil { - return - } - return s.Type -} diff --git a/tdapi/tl_story_area_position_gen.go b/tdapi/tl_story_area_position_gen.go deleted file mode 100644 index d7e2427ad..000000000 --- a/tdapi/tl_story_area_position_gen.go +++ /dev/null @@ -1,363 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryAreaPosition represents TL type `storyAreaPosition#a49fec6c`. -type StoryAreaPosition struct { - // The abscissa of the rectangle's center, as a percentage of the media width - XPercentage float64 - // The ordinate of the rectangle's center, as a percentage of the media height - YPercentage float64 - // The width of the rectangle, as a percentage of the media width - WidthPercentage float64 - // The height of the rectangle, as a percentage of the media height - HeightPercentage float64 - // Clockwise rotation angle of the rectangle, in degrees; 0-360 - RotationAngle float64 - // The radius of the rectangle corner rounding, as a percentage of the media width - CornerRadiusPercentage float64 -} - -// StoryAreaPositionTypeID is TL type id of StoryAreaPosition. -const StoryAreaPositionTypeID = 0xa49fec6c - -// Ensuring interfaces in compile-time for StoryAreaPosition. -var ( - _ bin.Encoder = &StoryAreaPosition{} - _ bin.Decoder = &StoryAreaPosition{} - _ bin.BareEncoder = &StoryAreaPosition{} - _ bin.BareDecoder = &StoryAreaPosition{} -) - -func (s *StoryAreaPosition) Zero() bool { - if s == nil { - return true - } - if !(s.XPercentage == 0) { - return false - } - if !(s.YPercentage == 0) { - return false - } - if !(s.WidthPercentage == 0) { - return false - } - if !(s.HeightPercentage == 0) { - return false - } - if !(s.RotationAngle == 0) { - return false - } - if !(s.CornerRadiusPercentage == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryAreaPosition) String() string { - if s == nil { - return "StoryAreaPosition(nil)" - } - type Alias StoryAreaPosition - return fmt.Sprintf("StoryAreaPosition%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryAreaPosition) TypeID() uint32 { - return StoryAreaPositionTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryAreaPosition) TypeName() string { - return "storyAreaPosition" -} - -// TypeInfo returns info about TL type. -func (s *StoryAreaPosition) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyAreaPosition", - ID: StoryAreaPositionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "XPercentage", - SchemaName: "x_percentage", - }, - { - Name: "YPercentage", - SchemaName: "y_percentage", - }, - { - Name: "WidthPercentage", - SchemaName: "width_percentage", - }, - { - Name: "HeightPercentage", - SchemaName: "height_percentage", - }, - { - Name: "RotationAngle", - SchemaName: "rotation_angle", - }, - { - Name: "CornerRadiusPercentage", - SchemaName: "corner_radius_percentage", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryAreaPosition) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaPosition#a49fec6c as nil") - } - b.PutID(StoryAreaPositionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryAreaPosition) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaPosition#a49fec6c as nil") - } - b.PutDouble(s.XPercentage) - b.PutDouble(s.YPercentage) - b.PutDouble(s.WidthPercentage) - b.PutDouble(s.HeightPercentage) - b.PutDouble(s.RotationAngle) - b.PutDouble(s.CornerRadiusPercentage) - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryAreaPosition) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaPosition#a49fec6c to nil") - } - if err := b.ConsumeID(StoryAreaPositionTypeID); err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryAreaPosition) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaPosition#a49fec6c to nil") - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field x_percentage: %w", err) - } - s.XPercentage = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field y_percentage: %w", err) - } - s.YPercentage = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field width_percentage: %w", err) - } - s.WidthPercentage = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field height_percentage: %w", err) - } - s.HeightPercentage = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field rotation_angle: %w", err) - } - s.RotationAngle = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field corner_radius_percentage: %w", err) - } - s.CornerRadiusPercentage = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryAreaPosition) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaPosition#a49fec6c as nil") - } - b.ObjStart() - b.PutID("storyAreaPosition") - b.Comma() - b.FieldStart("x_percentage") - b.PutDouble(s.XPercentage) - b.Comma() - b.FieldStart("y_percentage") - b.PutDouble(s.YPercentage) - b.Comma() - b.FieldStart("width_percentage") - b.PutDouble(s.WidthPercentage) - b.Comma() - b.FieldStart("height_percentage") - b.PutDouble(s.HeightPercentage) - b.Comma() - b.FieldStart("rotation_angle") - b.PutDouble(s.RotationAngle) - b.Comma() - b.FieldStart("corner_radius_percentage") - b.PutDouble(s.CornerRadiusPercentage) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryAreaPosition) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaPosition#a49fec6c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyAreaPosition"); err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: %w", err) - } - case "x_percentage": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field x_percentage: %w", err) - } - s.XPercentage = value - case "y_percentage": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field y_percentage: %w", err) - } - s.YPercentage = value - case "width_percentage": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field width_percentage: %w", err) - } - s.WidthPercentage = value - case "height_percentage": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field height_percentage: %w", err) - } - s.HeightPercentage = value - case "rotation_angle": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field rotation_angle: %w", err) - } - s.RotationAngle = value - case "corner_radius_percentage": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaPosition#a49fec6c: field corner_radius_percentage: %w", err) - } - s.CornerRadiusPercentage = value - default: - return b.Skip() - } - return nil - }) -} - -// GetXPercentage returns value of XPercentage field. -func (s *StoryAreaPosition) GetXPercentage() (value float64) { - if s == nil { - return - } - return s.XPercentage -} - -// GetYPercentage returns value of YPercentage field. -func (s *StoryAreaPosition) GetYPercentage() (value float64) { - if s == nil { - return - } - return s.YPercentage -} - -// GetWidthPercentage returns value of WidthPercentage field. -func (s *StoryAreaPosition) GetWidthPercentage() (value float64) { - if s == nil { - return - } - return s.WidthPercentage -} - -// GetHeightPercentage returns value of HeightPercentage field. -func (s *StoryAreaPosition) GetHeightPercentage() (value float64) { - if s == nil { - return - } - return s.HeightPercentage -} - -// GetRotationAngle returns value of RotationAngle field. -func (s *StoryAreaPosition) GetRotationAngle() (value float64) { - if s == nil { - return - } - return s.RotationAngle -} - -// GetCornerRadiusPercentage returns value of CornerRadiusPercentage field. -func (s *StoryAreaPosition) GetCornerRadiusPercentage() (value float64) { - if s == nil { - return - } - return s.CornerRadiusPercentage -} diff --git a/tdapi/tl_story_area_type_gen.go b/tdapi/tl_story_area_type_gen.go deleted file mode 100644 index c025d7c9f..000000000 --- a/tdapi/tl_story_area_type_gen.go +++ /dev/null @@ -1,1473 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryAreaTypeLocation represents TL type `storyAreaTypeLocation#a8b3caa3`. -type StoryAreaTypeLocation struct { - // The location - Location Location - // Address of the location; may be null if unknown - Address LocationAddress -} - -// StoryAreaTypeLocationTypeID is TL type id of StoryAreaTypeLocation. -const StoryAreaTypeLocationTypeID = 0xa8b3caa3 - -// construct implements constructor of StoryAreaTypeClass. -func (s StoryAreaTypeLocation) construct() StoryAreaTypeClass { return &s } - -// Ensuring interfaces in compile-time for StoryAreaTypeLocation. -var ( - _ bin.Encoder = &StoryAreaTypeLocation{} - _ bin.Decoder = &StoryAreaTypeLocation{} - _ bin.BareEncoder = &StoryAreaTypeLocation{} - _ bin.BareDecoder = &StoryAreaTypeLocation{} - - _ StoryAreaTypeClass = &StoryAreaTypeLocation{} -) - -func (s *StoryAreaTypeLocation) Zero() bool { - if s == nil { - return true - } - if !(s.Location.Zero()) { - return false - } - if !(s.Address.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryAreaTypeLocation) String() string { - if s == nil { - return "StoryAreaTypeLocation(nil)" - } - type Alias StoryAreaTypeLocation - return fmt.Sprintf("StoryAreaTypeLocation%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryAreaTypeLocation) TypeID() uint32 { - return StoryAreaTypeLocationTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryAreaTypeLocation) TypeName() string { - return "storyAreaTypeLocation" -} - -// TypeInfo returns info about TL type. -func (s *StoryAreaTypeLocation) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyAreaTypeLocation", - ID: StoryAreaTypeLocationTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "Address", - SchemaName: "address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryAreaTypeLocation) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeLocation#a8b3caa3 as nil") - } - b.PutID(StoryAreaTypeLocationTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryAreaTypeLocation) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeLocation#a8b3caa3 as nil") - } - if err := s.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyAreaTypeLocation#a8b3caa3: field location: %w", err) - } - if err := s.Address.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyAreaTypeLocation#a8b3caa3: field address: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryAreaTypeLocation) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeLocation#a8b3caa3 to nil") - } - if err := b.ConsumeID(StoryAreaTypeLocationTypeID); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeLocation#a8b3caa3: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryAreaTypeLocation) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeLocation#a8b3caa3 to nil") - } - { - if err := s.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeLocation#a8b3caa3: field location: %w", err) - } - } - { - if err := s.Address.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeLocation#a8b3caa3: field address: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryAreaTypeLocation) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeLocation#a8b3caa3 as nil") - } - b.ObjStart() - b.PutID("storyAreaTypeLocation") - b.Comma() - b.FieldStart("location") - if err := s.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyAreaTypeLocation#a8b3caa3: field location: %w", err) - } - b.Comma() - b.FieldStart("address") - if err := s.Address.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyAreaTypeLocation#a8b3caa3: field address: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryAreaTypeLocation) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeLocation#a8b3caa3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyAreaTypeLocation"); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeLocation#a8b3caa3: %w", err) - } - case "location": - if err := s.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeLocation#a8b3caa3: field location: %w", err) - } - case "address": - if err := s.Address.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeLocation#a8b3caa3: field address: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (s *StoryAreaTypeLocation) GetLocation() (value Location) { - if s == nil { - return - } - return s.Location -} - -// GetAddress returns value of Address field. -func (s *StoryAreaTypeLocation) GetAddress() (value LocationAddress) { - if s == nil { - return - } - return s.Address -} - -// StoryAreaTypeVenue represents TL type `storyAreaTypeVenue#18ae4d06`. -type StoryAreaTypeVenue struct { - // Information about the venue - Venue Venue -} - -// StoryAreaTypeVenueTypeID is TL type id of StoryAreaTypeVenue. -const StoryAreaTypeVenueTypeID = 0x18ae4d06 - -// construct implements constructor of StoryAreaTypeClass. -func (s StoryAreaTypeVenue) construct() StoryAreaTypeClass { return &s } - -// Ensuring interfaces in compile-time for StoryAreaTypeVenue. -var ( - _ bin.Encoder = &StoryAreaTypeVenue{} - _ bin.Decoder = &StoryAreaTypeVenue{} - _ bin.BareEncoder = &StoryAreaTypeVenue{} - _ bin.BareDecoder = &StoryAreaTypeVenue{} - - _ StoryAreaTypeClass = &StoryAreaTypeVenue{} -) - -func (s *StoryAreaTypeVenue) Zero() bool { - if s == nil { - return true - } - if !(s.Venue.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryAreaTypeVenue) String() string { - if s == nil { - return "StoryAreaTypeVenue(nil)" - } - type Alias StoryAreaTypeVenue - return fmt.Sprintf("StoryAreaTypeVenue%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryAreaTypeVenue) TypeID() uint32 { - return StoryAreaTypeVenueTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryAreaTypeVenue) TypeName() string { - return "storyAreaTypeVenue" -} - -// TypeInfo returns info about TL type. -func (s *StoryAreaTypeVenue) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyAreaTypeVenue", - ID: StoryAreaTypeVenueTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Venue", - SchemaName: "venue", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryAreaTypeVenue) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeVenue#18ae4d06 as nil") - } - b.PutID(StoryAreaTypeVenueTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryAreaTypeVenue) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeVenue#18ae4d06 as nil") - } - if err := s.Venue.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyAreaTypeVenue#18ae4d06: field venue: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryAreaTypeVenue) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeVenue#18ae4d06 to nil") - } - if err := b.ConsumeID(StoryAreaTypeVenueTypeID); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeVenue#18ae4d06: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryAreaTypeVenue) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeVenue#18ae4d06 to nil") - } - { - if err := s.Venue.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeVenue#18ae4d06: field venue: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryAreaTypeVenue) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeVenue#18ae4d06 as nil") - } - b.ObjStart() - b.PutID("storyAreaTypeVenue") - b.Comma() - b.FieldStart("venue") - if err := s.Venue.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyAreaTypeVenue#18ae4d06: field venue: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryAreaTypeVenue) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeVenue#18ae4d06 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyAreaTypeVenue"); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeVenue#18ae4d06: %w", err) - } - case "venue": - if err := s.Venue.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeVenue#18ae4d06: field venue: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetVenue returns value of Venue field. -func (s *StoryAreaTypeVenue) GetVenue() (value Venue) { - if s == nil { - return - } - return s.Venue -} - -// StoryAreaTypeSuggestedReaction represents TL type `storyAreaTypeSuggestedReaction#f95f927c`. -type StoryAreaTypeSuggestedReaction struct { - // Type of the reaction - ReactionType ReactionTypeClass - // Number of times the reaction was added - TotalCount int32 - // True, if reaction has a dark background - IsDark bool - // True, if reaction corner is flipped - IsFlipped bool -} - -// StoryAreaTypeSuggestedReactionTypeID is TL type id of StoryAreaTypeSuggestedReaction. -const StoryAreaTypeSuggestedReactionTypeID = 0xf95f927c - -// construct implements constructor of StoryAreaTypeClass. -func (s StoryAreaTypeSuggestedReaction) construct() StoryAreaTypeClass { return &s } - -// Ensuring interfaces in compile-time for StoryAreaTypeSuggestedReaction. -var ( - _ bin.Encoder = &StoryAreaTypeSuggestedReaction{} - _ bin.Decoder = &StoryAreaTypeSuggestedReaction{} - _ bin.BareEncoder = &StoryAreaTypeSuggestedReaction{} - _ bin.BareDecoder = &StoryAreaTypeSuggestedReaction{} - - _ StoryAreaTypeClass = &StoryAreaTypeSuggestedReaction{} -) - -func (s *StoryAreaTypeSuggestedReaction) Zero() bool { - if s == nil { - return true - } - if !(s.ReactionType == nil) { - return false - } - if !(s.TotalCount == 0) { - return false - } - if !(s.IsDark == false) { - return false - } - if !(s.IsFlipped == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryAreaTypeSuggestedReaction) String() string { - if s == nil { - return "StoryAreaTypeSuggestedReaction(nil)" - } - type Alias StoryAreaTypeSuggestedReaction - return fmt.Sprintf("StoryAreaTypeSuggestedReaction%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryAreaTypeSuggestedReaction) TypeID() uint32 { - return StoryAreaTypeSuggestedReactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryAreaTypeSuggestedReaction) TypeName() string { - return "storyAreaTypeSuggestedReaction" -} - -// TypeInfo returns info about TL type. -func (s *StoryAreaTypeSuggestedReaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyAreaTypeSuggestedReaction", - ID: StoryAreaTypeSuggestedReactionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ReactionType", - SchemaName: "reaction_type", - }, - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "IsDark", - SchemaName: "is_dark", - }, - { - Name: "IsFlipped", - SchemaName: "is_flipped", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryAreaTypeSuggestedReaction) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeSuggestedReaction#f95f927c as nil") - } - b.PutID(StoryAreaTypeSuggestedReactionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryAreaTypeSuggestedReaction) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeSuggestedReaction#f95f927c as nil") - } - if s.ReactionType == nil { - return fmt.Errorf("unable to encode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type is nil") - } - if err := s.ReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type: %w", err) - } - b.PutInt32(s.TotalCount) - b.PutBool(s.IsDark) - b.PutBool(s.IsFlipped) - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryAreaTypeSuggestedReaction) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeSuggestedReaction#f95f927c to nil") - } - if err := b.ConsumeID(StoryAreaTypeSuggestedReactionTypeID); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryAreaTypeSuggestedReaction) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeSuggestedReaction#f95f927c to nil") - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type: %w", err) - } - s.ReactionType = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field total_count: %w", err) - } - s.TotalCount = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field is_dark: %w", err) - } - s.IsDark = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field is_flipped: %w", err) - } - s.IsFlipped = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryAreaTypeSuggestedReaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeSuggestedReaction#f95f927c as nil") - } - b.ObjStart() - b.PutID("storyAreaTypeSuggestedReaction") - b.Comma() - b.FieldStart("reaction_type") - if s.ReactionType == nil { - return fmt.Errorf("unable to encode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type is nil") - } - if err := s.ReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type: %w", err) - } - b.Comma() - b.FieldStart("total_count") - b.PutInt32(s.TotalCount) - b.Comma() - b.FieldStart("is_dark") - b.PutBool(s.IsDark) - b.Comma() - b.FieldStart("is_flipped") - b.PutBool(s.IsFlipped) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryAreaTypeSuggestedReaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeSuggestedReaction#f95f927c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyAreaTypeSuggestedReaction"); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: %w", err) - } - case "reaction_type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field reaction_type: %w", err) - } - s.ReactionType = value - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field total_count: %w", err) - } - s.TotalCount = value - case "is_dark": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field is_dark: %w", err) - } - s.IsDark = value - case "is_flipped": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeSuggestedReaction#f95f927c: field is_flipped: %w", err) - } - s.IsFlipped = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReactionType returns value of ReactionType field. -func (s *StoryAreaTypeSuggestedReaction) GetReactionType() (value ReactionTypeClass) { - if s == nil { - return - } - return s.ReactionType -} - -// GetTotalCount returns value of TotalCount field. -func (s *StoryAreaTypeSuggestedReaction) GetTotalCount() (value int32) { - if s == nil { - return - } - return s.TotalCount -} - -// GetIsDark returns value of IsDark field. -func (s *StoryAreaTypeSuggestedReaction) GetIsDark() (value bool) { - if s == nil { - return - } - return s.IsDark -} - -// GetIsFlipped returns value of IsFlipped field. -func (s *StoryAreaTypeSuggestedReaction) GetIsFlipped() (value bool) { - if s == nil { - return - } - return s.IsFlipped -} - -// StoryAreaTypeMessage represents TL type `storyAreaTypeMessage#bfef76b4`. -type StoryAreaTypeMessage struct { - // Identifier of the chat with the message - ChatID int64 - // Identifier of the message - MessageID int64 -} - -// StoryAreaTypeMessageTypeID is TL type id of StoryAreaTypeMessage. -const StoryAreaTypeMessageTypeID = 0xbfef76b4 - -// construct implements constructor of StoryAreaTypeClass. -func (s StoryAreaTypeMessage) construct() StoryAreaTypeClass { return &s } - -// Ensuring interfaces in compile-time for StoryAreaTypeMessage. -var ( - _ bin.Encoder = &StoryAreaTypeMessage{} - _ bin.Decoder = &StoryAreaTypeMessage{} - _ bin.BareEncoder = &StoryAreaTypeMessage{} - _ bin.BareDecoder = &StoryAreaTypeMessage{} - - _ StoryAreaTypeClass = &StoryAreaTypeMessage{} -) - -func (s *StoryAreaTypeMessage) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryAreaTypeMessage) String() string { - if s == nil { - return "StoryAreaTypeMessage(nil)" - } - type Alias StoryAreaTypeMessage - return fmt.Sprintf("StoryAreaTypeMessage%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryAreaTypeMessage) TypeID() uint32 { - return StoryAreaTypeMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryAreaTypeMessage) TypeName() string { - return "storyAreaTypeMessage" -} - -// TypeInfo returns info about TL type. -func (s *StoryAreaTypeMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyAreaTypeMessage", - ID: StoryAreaTypeMessageTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryAreaTypeMessage) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeMessage#bfef76b4 as nil") - } - b.PutID(StoryAreaTypeMessageTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryAreaTypeMessage) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeMessage#bfef76b4 as nil") - } - b.PutInt53(s.ChatID) - b.PutInt53(s.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryAreaTypeMessage) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeMessage#bfef76b4 to nil") - } - if err := b.ConsumeID(StoryAreaTypeMessageTypeID); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeMessage#bfef76b4: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryAreaTypeMessage) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeMessage#bfef76b4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeMessage#bfef76b4: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeMessage#bfef76b4: field message_id: %w", err) - } - s.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryAreaTypeMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeMessage#bfef76b4 as nil") - } - b.ObjStart() - b.PutID("storyAreaTypeMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(s.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryAreaTypeMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeMessage#bfef76b4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyAreaTypeMessage"); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeMessage#bfef76b4: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeMessage#bfef76b4: field chat_id: %w", err) - } - s.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeMessage#bfef76b4: field message_id: %w", err) - } - s.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *StoryAreaTypeMessage) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetMessageID returns value of MessageID field. -func (s *StoryAreaTypeMessage) GetMessageID() (value int64) { - if s == nil { - return - } - return s.MessageID -} - -// StoryAreaTypeLink represents TL type `storyAreaTypeLink#f8626185`. -type StoryAreaTypeLink struct { - // HTTP or tg:// URL to be opened when the area is clicked - URL string -} - -// StoryAreaTypeLinkTypeID is TL type id of StoryAreaTypeLink. -const StoryAreaTypeLinkTypeID = 0xf8626185 - -// construct implements constructor of StoryAreaTypeClass. -func (s StoryAreaTypeLink) construct() StoryAreaTypeClass { return &s } - -// Ensuring interfaces in compile-time for StoryAreaTypeLink. -var ( - _ bin.Encoder = &StoryAreaTypeLink{} - _ bin.Decoder = &StoryAreaTypeLink{} - _ bin.BareEncoder = &StoryAreaTypeLink{} - _ bin.BareDecoder = &StoryAreaTypeLink{} - - _ StoryAreaTypeClass = &StoryAreaTypeLink{} -) - -func (s *StoryAreaTypeLink) Zero() bool { - if s == nil { - return true - } - if !(s.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryAreaTypeLink) String() string { - if s == nil { - return "StoryAreaTypeLink(nil)" - } - type Alias StoryAreaTypeLink - return fmt.Sprintf("StoryAreaTypeLink%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryAreaTypeLink) TypeID() uint32 { - return StoryAreaTypeLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryAreaTypeLink) TypeName() string { - return "storyAreaTypeLink" -} - -// TypeInfo returns info about TL type. -func (s *StoryAreaTypeLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyAreaTypeLink", - ID: StoryAreaTypeLinkTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryAreaTypeLink) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeLink#f8626185 as nil") - } - b.PutID(StoryAreaTypeLinkTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryAreaTypeLink) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeLink#f8626185 as nil") - } - b.PutString(s.URL) - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryAreaTypeLink) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeLink#f8626185 to nil") - } - if err := b.ConsumeID(StoryAreaTypeLinkTypeID); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeLink#f8626185: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryAreaTypeLink) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeLink#f8626185 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeLink#f8626185: field url: %w", err) - } - s.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryAreaTypeLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeLink#f8626185 as nil") - } - b.ObjStart() - b.PutID("storyAreaTypeLink") - b.Comma() - b.FieldStart("url") - b.PutString(s.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryAreaTypeLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeLink#f8626185 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyAreaTypeLink"); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeLink#f8626185: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeLink#f8626185: field url: %w", err) - } - s.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (s *StoryAreaTypeLink) GetURL() (value string) { - if s == nil { - return - } - return s.URL -} - -// StoryAreaTypeWeather represents TL type `storyAreaTypeWeather#a6587dbe`. -type StoryAreaTypeWeather struct { - // Temperature, in degree Celsius - Temperature float64 - // Emoji representing the weather - Emoji string - // A color of the area background in the ARGB format - BackgroundColor int32 -} - -// StoryAreaTypeWeatherTypeID is TL type id of StoryAreaTypeWeather. -const StoryAreaTypeWeatherTypeID = 0xa6587dbe - -// construct implements constructor of StoryAreaTypeClass. -func (s StoryAreaTypeWeather) construct() StoryAreaTypeClass { return &s } - -// Ensuring interfaces in compile-time for StoryAreaTypeWeather. -var ( - _ bin.Encoder = &StoryAreaTypeWeather{} - _ bin.Decoder = &StoryAreaTypeWeather{} - _ bin.BareEncoder = &StoryAreaTypeWeather{} - _ bin.BareDecoder = &StoryAreaTypeWeather{} - - _ StoryAreaTypeClass = &StoryAreaTypeWeather{} -) - -func (s *StoryAreaTypeWeather) Zero() bool { - if s == nil { - return true - } - if !(s.Temperature == 0) { - return false - } - if !(s.Emoji == "") { - return false - } - if !(s.BackgroundColor == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryAreaTypeWeather) String() string { - if s == nil { - return "StoryAreaTypeWeather(nil)" - } - type Alias StoryAreaTypeWeather - return fmt.Sprintf("StoryAreaTypeWeather%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryAreaTypeWeather) TypeID() uint32 { - return StoryAreaTypeWeatherTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryAreaTypeWeather) TypeName() string { - return "storyAreaTypeWeather" -} - -// TypeInfo returns info about TL type. -func (s *StoryAreaTypeWeather) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyAreaTypeWeather", - ID: StoryAreaTypeWeatherTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Temperature", - SchemaName: "temperature", - }, - { - Name: "Emoji", - SchemaName: "emoji", - }, - { - Name: "BackgroundColor", - SchemaName: "background_color", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryAreaTypeWeather) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeWeather#a6587dbe as nil") - } - b.PutID(StoryAreaTypeWeatherTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryAreaTypeWeather) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeWeather#a6587dbe as nil") - } - b.PutDouble(s.Temperature) - b.PutString(s.Emoji) - b.PutInt32(s.BackgroundColor) - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryAreaTypeWeather) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeWeather#a6587dbe to nil") - } - if err := b.ConsumeID(StoryAreaTypeWeatherTypeID); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryAreaTypeWeather) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeWeather#a6587dbe to nil") - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field temperature: %w", err) - } - s.Temperature = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field emoji: %w", err) - } - s.Emoji = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field background_color: %w", err) - } - s.BackgroundColor = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryAreaTypeWeather) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyAreaTypeWeather#a6587dbe as nil") - } - b.ObjStart() - b.PutID("storyAreaTypeWeather") - b.Comma() - b.FieldStart("temperature") - b.PutDouble(s.Temperature) - b.Comma() - b.FieldStart("emoji") - b.PutString(s.Emoji) - b.Comma() - b.FieldStart("background_color") - b.PutInt32(s.BackgroundColor) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryAreaTypeWeather) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyAreaTypeWeather#a6587dbe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyAreaTypeWeather"); err != nil { - return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: %w", err) - } - case "temperature": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field temperature: %w", err) - } - s.Temperature = value - case "emoji": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field emoji: %w", err) - } - s.Emoji = value - case "background_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyAreaTypeWeather#a6587dbe: field background_color: %w", err) - } - s.BackgroundColor = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTemperature returns value of Temperature field. -func (s *StoryAreaTypeWeather) GetTemperature() (value float64) { - if s == nil { - return - } - return s.Temperature -} - -// GetEmoji returns value of Emoji field. -func (s *StoryAreaTypeWeather) GetEmoji() (value string) { - if s == nil { - return - } - return s.Emoji -} - -// GetBackgroundColor returns value of BackgroundColor field. -func (s *StoryAreaTypeWeather) GetBackgroundColor() (value int32) { - if s == nil { - return - } - return s.BackgroundColor -} - -// StoryAreaTypeClassName is schema name of StoryAreaTypeClass. -const StoryAreaTypeClassName = "StoryAreaType" - -// StoryAreaTypeClass represents StoryAreaType generic type. -// -// Example: -// -// g, err := tdapi.DecodeStoryAreaType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StoryAreaTypeLocation: // storyAreaTypeLocation#a8b3caa3 -// case *tdapi.StoryAreaTypeVenue: // storyAreaTypeVenue#18ae4d06 -// case *tdapi.StoryAreaTypeSuggestedReaction: // storyAreaTypeSuggestedReaction#f95f927c -// case *tdapi.StoryAreaTypeMessage: // storyAreaTypeMessage#bfef76b4 -// case *tdapi.StoryAreaTypeLink: // storyAreaTypeLink#f8626185 -// case *tdapi.StoryAreaTypeWeather: // storyAreaTypeWeather#a6587dbe -// default: panic(v) -// } -type StoryAreaTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StoryAreaTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStoryAreaType implements binary de-serialization for StoryAreaTypeClass. -func DecodeStoryAreaType(buf *bin.Buffer) (StoryAreaTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StoryAreaTypeLocationTypeID: - // Decoding storyAreaTypeLocation#a8b3caa3. - v := StoryAreaTypeLocation{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - case StoryAreaTypeVenueTypeID: - // Decoding storyAreaTypeVenue#18ae4d06. - v := StoryAreaTypeVenue{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - case StoryAreaTypeSuggestedReactionTypeID: - // Decoding storyAreaTypeSuggestedReaction#f95f927c. - v := StoryAreaTypeSuggestedReaction{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - case StoryAreaTypeMessageTypeID: - // Decoding storyAreaTypeMessage#bfef76b4. - v := StoryAreaTypeMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - case StoryAreaTypeLinkTypeID: - // Decoding storyAreaTypeLink#f8626185. - v := StoryAreaTypeLink{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - case StoryAreaTypeWeatherTypeID: - // Decoding storyAreaTypeWeather#a6587dbe. - v := StoryAreaTypeWeather{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStoryAreaType implements binary de-serialization for StoryAreaTypeClass. -func DecodeTDLibJSONStoryAreaType(buf tdjson.Decoder) (StoryAreaTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "storyAreaTypeLocation": - // Decoding storyAreaTypeLocation#a8b3caa3. - v := StoryAreaTypeLocation{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - case "storyAreaTypeVenue": - // Decoding storyAreaTypeVenue#18ae4d06. - v := StoryAreaTypeVenue{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - case "storyAreaTypeSuggestedReaction": - // Decoding storyAreaTypeSuggestedReaction#f95f927c. - v := StoryAreaTypeSuggestedReaction{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - case "storyAreaTypeMessage": - // Decoding storyAreaTypeMessage#bfef76b4. - v := StoryAreaTypeMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - case "storyAreaTypeLink": - // Decoding storyAreaTypeLink#f8626185. - v := StoryAreaTypeLink{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - case "storyAreaTypeWeather": - // Decoding storyAreaTypeWeather#a6587dbe. - v := StoryAreaTypeWeather{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryAreaTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StoryAreaType boxes the StoryAreaTypeClass providing a helper. -type StoryAreaTypeBox struct { - StoryAreaType StoryAreaTypeClass -} - -// Decode implements bin.Decoder for StoryAreaTypeBox. -func (b *StoryAreaTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StoryAreaTypeBox to nil") - } - v, err := DecodeStoryAreaType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryAreaType = v - return nil -} - -// Encode implements bin.Encode for StoryAreaTypeBox. -func (b *StoryAreaTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StoryAreaType == nil { - return fmt.Errorf("unable to encode StoryAreaTypeClass as nil") - } - return b.StoryAreaType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StoryAreaTypeBox. -func (b *StoryAreaTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StoryAreaTypeBox to nil") - } - v, err := DecodeTDLibJSONStoryAreaType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryAreaType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StoryAreaTypeBox. -func (b *StoryAreaTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StoryAreaType == nil { - return fmt.Errorf("unable to encode StoryAreaTypeClass as nil") - } - return b.StoryAreaType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_story_content_gen.go b/tdapi/tl_story_content_gen.go deleted file mode 100644 index cc6900b91..000000000 --- a/tdapi/tl_story_content_gen.go +++ /dev/null @@ -1,682 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryContentPhoto represents TL type `storyContentPhoto#d45f0050`. -type StoryContentPhoto struct { - // The photo - Photo Photo -} - -// StoryContentPhotoTypeID is TL type id of StoryContentPhoto. -const StoryContentPhotoTypeID = 0xd45f0050 - -// construct implements constructor of StoryContentClass. -func (s StoryContentPhoto) construct() StoryContentClass { return &s } - -// Ensuring interfaces in compile-time for StoryContentPhoto. -var ( - _ bin.Encoder = &StoryContentPhoto{} - _ bin.Decoder = &StoryContentPhoto{} - _ bin.BareEncoder = &StoryContentPhoto{} - _ bin.BareDecoder = &StoryContentPhoto{} - - _ StoryContentClass = &StoryContentPhoto{} -) - -func (s *StoryContentPhoto) Zero() bool { - if s == nil { - return true - } - if !(s.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryContentPhoto) String() string { - if s == nil { - return "StoryContentPhoto(nil)" - } - type Alias StoryContentPhoto - return fmt.Sprintf("StoryContentPhoto%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryContentPhoto) TypeID() uint32 { - return StoryContentPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryContentPhoto) TypeName() string { - return "storyContentPhoto" -} - -// TypeInfo returns info about TL type. -func (s *StoryContentPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyContentPhoto", - ID: StoryContentPhotoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryContentPhoto) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyContentPhoto#d45f0050 as nil") - } - b.PutID(StoryContentPhotoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryContentPhoto) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyContentPhoto#d45f0050 as nil") - } - if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyContentPhoto#d45f0050: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryContentPhoto) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyContentPhoto#d45f0050 to nil") - } - if err := b.ConsumeID(StoryContentPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode storyContentPhoto#d45f0050: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryContentPhoto) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyContentPhoto#d45f0050 to nil") - } - { - if err := s.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyContentPhoto#d45f0050: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryContentPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyContentPhoto#d45f0050 as nil") - } - b.ObjStart() - b.PutID("storyContentPhoto") - b.Comma() - b.FieldStart("photo") - if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyContentPhoto#d45f0050: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryContentPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyContentPhoto#d45f0050 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyContentPhoto"); err != nil { - return fmt.Errorf("unable to decode storyContentPhoto#d45f0050: %w", err) - } - case "photo": - if err := s.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyContentPhoto#d45f0050: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (s *StoryContentPhoto) GetPhoto() (value Photo) { - if s == nil { - return - } - return s.Photo -} - -// StoryContentVideo represents TL type `storyContentVideo#b30162a6`. -type StoryContentVideo struct { - // The video in MPEG4 format - Video StoryVideo - // Alternative version of the video in MPEG4 format, encoded with H.264 codec; may be - // null - AlternativeVideo StoryVideo -} - -// StoryContentVideoTypeID is TL type id of StoryContentVideo. -const StoryContentVideoTypeID = 0xb30162a6 - -// construct implements constructor of StoryContentClass. -func (s StoryContentVideo) construct() StoryContentClass { return &s } - -// Ensuring interfaces in compile-time for StoryContentVideo. -var ( - _ bin.Encoder = &StoryContentVideo{} - _ bin.Decoder = &StoryContentVideo{} - _ bin.BareEncoder = &StoryContentVideo{} - _ bin.BareDecoder = &StoryContentVideo{} - - _ StoryContentClass = &StoryContentVideo{} -) - -func (s *StoryContentVideo) Zero() bool { - if s == nil { - return true - } - if !(s.Video.Zero()) { - return false - } - if !(s.AlternativeVideo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryContentVideo) String() string { - if s == nil { - return "StoryContentVideo(nil)" - } - type Alias StoryContentVideo - return fmt.Sprintf("StoryContentVideo%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryContentVideo) TypeID() uint32 { - return StoryContentVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryContentVideo) TypeName() string { - return "storyContentVideo" -} - -// TypeInfo returns info about TL type. -func (s *StoryContentVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyContentVideo", - ID: StoryContentVideoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Video", - SchemaName: "video", - }, - { - Name: "AlternativeVideo", - SchemaName: "alternative_video", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryContentVideo) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyContentVideo#b30162a6 as nil") - } - b.PutID(StoryContentVideoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryContentVideo) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyContentVideo#b30162a6 as nil") - } - if err := s.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyContentVideo#b30162a6: field video: %w", err) - } - if err := s.AlternativeVideo.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyContentVideo#b30162a6: field alternative_video: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryContentVideo) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyContentVideo#b30162a6 to nil") - } - if err := b.ConsumeID(StoryContentVideoTypeID); err != nil { - return fmt.Errorf("unable to decode storyContentVideo#b30162a6: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryContentVideo) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyContentVideo#b30162a6 to nil") - } - { - if err := s.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyContentVideo#b30162a6: field video: %w", err) - } - } - { - if err := s.AlternativeVideo.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyContentVideo#b30162a6: field alternative_video: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryContentVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyContentVideo#b30162a6 as nil") - } - b.ObjStart() - b.PutID("storyContentVideo") - b.Comma() - b.FieldStart("video") - if err := s.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyContentVideo#b30162a6: field video: %w", err) - } - b.Comma() - b.FieldStart("alternative_video") - if err := s.AlternativeVideo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyContentVideo#b30162a6: field alternative_video: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryContentVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyContentVideo#b30162a6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyContentVideo"); err != nil { - return fmt.Errorf("unable to decode storyContentVideo#b30162a6: %w", err) - } - case "video": - if err := s.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyContentVideo#b30162a6: field video: %w", err) - } - case "alternative_video": - if err := s.AlternativeVideo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyContentVideo#b30162a6: field alternative_video: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetVideo returns value of Video field. -func (s *StoryContentVideo) GetVideo() (value StoryVideo) { - if s == nil { - return - } - return s.Video -} - -// GetAlternativeVideo returns value of AlternativeVideo field. -func (s *StoryContentVideo) GetAlternativeVideo() (value StoryVideo) { - if s == nil { - return - } - return s.AlternativeVideo -} - -// StoryContentUnsupported represents TL type `storyContentUnsupported#86c7f56e`. -type StoryContentUnsupported struct { -} - -// StoryContentUnsupportedTypeID is TL type id of StoryContentUnsupported. -const StoryContentUnsupportedTypeID = 0x86c7f56e - -// construct implements constructor of StoryContentClass. -func (s StoryContentUnsupported) construct() StoryContentClass { return &s } - -// Ensuring interfaces in compile-time for StoryContentUnsupported. -var ( - _ bin.Encoder = &StoryContentUnsupported{} - _ bin.Decoder = &StoryContentUnsupported{} - _ bin.BareEncoder = &StoryContentUnsupported{} - _ bin.BareDecoder = &StoryContentUnsupported{} - - _ StoryContentClass = &StoryContentUnsupported{} -) - -func (s *StoryContentUnsupported) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryContentUnsupported) String() string { - if s == nil { - return "StoryContentUnsupported(nil)" - } - type Alias StoryContentUnsupported - return fmt.Sprintf("StoryContentUnsupported%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryContentUnsupported) TypeID() uint32 { - return StoryContentUnsupportedTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryContentUnsupported) TypeName() string { - return "storyContentUnsupported" -} - -// TypeInfo returns info about TL type. -func (s *StoryContentUnsupported) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyContentUnsupported", - ID: StoryContentUnsupportedTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryContentUnsupported) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyContentUnsupported#86c7f56e as nil") - } - b.PutID(StoryContentUnsupportedTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryContentUnsupported) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyContentUnsupported#86c7f56e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryContentUnsupported) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyContentUnsupported#86c7f56e to nil") - } - if err := b.ConsumeID(StoryContentUnsupportedTypeID); err != nil { - return fmt.Errorf("unable to decode storyContentUnsupported#86c7f56e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryContentUnsupported) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyContentUnsupported#86c7f56e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryContentUnsupported) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyContentUnsupported#86c7f56e as nil") - } - b.ObjStart() - b.PutID("storyContentUnsupported") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryContentUnsupported) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyContentUnsupported#86c7f56e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyContentUnsupported"); err != nil { - return fmt.Errorf("unable to decode storyContentUnsupported#86c7f56e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StoryContentClassName is schema name of StoryContentClass. -const StoryContentClassName = "StoryContent" - -// StoryContentClass represents StoryContent generic type. -// -// Example: -// -// g, err := tdapi.DecodeStoryContent(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StoryContentPhoto: // storyContentPhoto#d45f0050 -// case *tdapi.StoryContentVideo: // storyContentVideo#b30162a6 -// case *tdapi.StoryContentUnsupported: // storyContentUnsupported#86c7f56e -// default: panic(v) -// } -type StoryContentClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StoryContentClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStoryContent implements binary de-serialization for StoryContentClass. -func DecodeStoryContent(buf *bin.Buffer) (StoryContentClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StoryContentPhotoTypeID: - // Decoding storyContentPhoto#d45f0050. - v := StoryContentPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryContentClass: %w", err) - } - return &v, nil - case StoryContentVideoTypeID: - // Decoding storyContentVideo#b30162a6. - v := StoryContentVideo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryContentClass: %w", err) - } - return &v, nil - case StoryContentUnsupportedTypeID: - // Decoding storyContentUnsupported#86c7f56e. - v := StoryContentUnsupported{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryContentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryContentClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStoryContent implements binary de-serialization for StoryContentClass. -func DecodeTDLibJSONStoryContent(buf tdjson.Decoder) (StoryContentClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "storyContentPhoto": - // Decoding storyContentPhoto#d45f0050. - v := StoryContentPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryContentClass: %w", err) - } - return &v, nil - case "storyContentVideo": - // Decoding storyContentVideo#b30162a6. - v := StoryContentVideo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryContentClass: %w", err) - } - return &v, nil - case "storyContentUnsupported": - // Decoding storyContentUnsupported#86c7f56e. - v := StoryContentUnsupported{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryContentClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryContentClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StoryContent boxes the StoryContentClass providing a helper. -type StoryContentBox struct { - StoryContent StoryContentClass -} - -// Decode implements bin.Decoder for StoryContentBox. -func (b *StoryContentBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StoryContentBox to nil") - } - v, err := DecodeStoryContent(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryContent = v - return nil -} - -// Encode implements bin.Encode for StoryContentBox. -func (b *StoryContentBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StoryContent == nil { - return fmt.Errorf("unable to encode StoryContentClass as nil") - } - return b.StoryContent.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StoryContentBox. -func (b *StoryContentBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StoryContentBox to nil") - } - v, err := DecodeTDLibJSONStoryContent(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryContent = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StoryContentBox. -func (b *StoryContentBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StoryContent == nil { - return fmt.Errorf("unable to encode StoryContentClass as nil") - } - return b.StoryContent.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_story_full_id_gen.go b/tdapi/tl_story_full_id_gen.go deleted file mode 100644 index f9be2d646..000000000 --- a/tdapi/tl_story_full_id_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryFullID represents TL type `storyFullId#701d31f5`. -type StoryFullID struct { - // Identifier of the chat that posted the story - SenderChatID int64 - // Unique story identifier among stories of the given sender - StoryID int32 -} - -// StoryFullIDTypeID is TL type id of StoryFullID. -const StoryFullIDTypeID = 0x701d31f5 - -// Ensuring interfaces in compile-time for StoryFullID. -var ( - _ bin.Encoder = &StoryFullID{} - _ bin.Decoder = &StoryFullID{} - _ bin.BareEncoder = &StoryFullID{} - _ bin.BareDecoder = &StoryFullID{} -) - -func (s *StoryFullID) Zero() bool { - if s == nil { - return true - } - if !(s.SenderChatID == 0) { - return false - } - if !(s.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryFullID) String() string { - if s == nil { - return "StoryFullID(nil)" - } - type Alias StoryFullID - return fmt.Sprintf("StoryFullID%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryFullID) TypeID() uint32 { - return StoryFullIDTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryFullID) TypeName() string { - return "storyFullId" -} - -// TypeInfo returns info about TL type. -func (s *StoryFullID) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyFullId", - ID: StoryFullIDTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderChatID", - SchemaName: "sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryFullID) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyFullId#701d31f5 as nil") - } - b.PutID(StoryFullIDTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryFullID) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyFullId#701d31f5 as nil") - } - b.PutInt53(s.SenderChatID) - b.PutInt32(s.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryFullID) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyFullId#701d31f5 to nil") - } - if err := b.ConsumeID(StoryFullIDTypeID); err != nil { - return fmt.Errorf("unable to decode storyFullId#701d31f5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryFullID) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyFullId#701d31f5 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyFullId#701d31f5: field sender_chat_id: %w", err) - } - s.SenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyFullId#701d31f5: field story_id: %w", err) - } - s.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryFullID) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyFullId#701d31f5 as nil") - } - b.ObjStart() - b.PutID("storyFullId") - b.Comma() - b.FieldStart("sender_chat_id") - b.PutInt53(s.SenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(s.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryFullID) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyFullId#701d31f5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyFullId"); err != nil { - return fmt.Errorf("unable to decode storyFullId#701d31f5: %w", err) - } - case "sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyFullId#701d31f5: field sender_chat_id: %w", err) - } - s.SenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyFullId#701d31f5: field story_id: %w", err) - } - s.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderChatID returns value of SenderChatID field. -func (s *StoryFullID) GetSenderChatID() (value int64) { - if s == nil { - return - } - return s.SenderChatID -} - -// GetStoryID returns value of StoryID field. -func (s *StoryFullID) GetStoryID() (value int32) { - if s == nil { - return - } - return s.StoryID -} diff --git a/tdapi/tl_story_gen.go b/tdapi/tl_story_gen.go deleted file mode 100644 index fb01ca531..000000000 --- a/tdapi/tl_story_gen.go +++ /dev/null @@ -1,1048 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Story represents TL type `story#84cdc9d1`. -type Story struct { - // Unique story identifier among stories of the given sender - ID int32 - // Identifier of the chat that posted the story - SenderChatID int64 - // Identifier of the sender of the story; may be null if the story is posted on behalf of - // the sender_chat_id - SenderID MessageSenderClass - // Point in time (Unix timestamp) when the story was published - Date int32 - // True, if the story is being sent by the current user - IsBeingSent bool - // True, if the story is being edited by the current user - IsBeingEdited bool - // True, if the story was edited - IsEdited bool - // True, if the story is saved in the sender's profile and will be available there after - // expiration - IsPostedToChatPage bool - // True, if the story is visible only for the current user - IsVisibleOnlyForSelf bool - // True, if the story can be deleted - CanBeDeleted bool - // True, if the story can be edited - CanBeEdited bool - // True, if the story can be forwarded as a message. Otherwise, screenshots and saving of - // the story content must be also forbidden - CanBeForwarded bool - // True, if the story can be replied in the chat with the story sender - CanBeReplied bool - // True, if the story's is_posted_to_chat_page value can be changed - CanToggleIsPostedToChatPage bool - // True, if the story statistics are available through getStoryStatistics - CanGetStatistics bool - // True, if interactions with the story can be received through getStoryInteractions - CanGetInteractions bool - // True, if users viewed the story can't be received, because the story has expired more - // than getOption("story_viewers_expiration_delay") seconds ago - HasExpiredViewers bool - // Information about the original story; may be null if the story wasn't reposted - RepostInfo StoryRepostInfo - // Information about interactions with the story; may be null if the story isn't owned or - // there were no interactions - InteractionInfo StoryInteractionInfo - // Type of the chosen reaction; may be null if none - ChosenReactionType ReactionTypeClass - // Privacy rules affecting story visibility; may be approximate for non-owned stories - PrivacySettings StoryPrivacySettingsClass - // Content of the story - Content StoryContentClass - // Clickable areas to be shown on the story content - Areas []StoryArea - // Caption of the story - Caption FormattedText -} - -// StoryTypeID is TL type id of Story. -const StoryTypeID = 0x84cdc9d1 - -// Ensuring interfaces in compile-time for Story. -var ( - _ bin.Encoder = &Story{} - _ bin.Decoder = &Story{} - _ bin.BareEncoder = &Story{} - _ bin.BareDecoder = &Story{} -) - -func (s *Story) Zero() bool { - if s == nil { - return true - } - if !(s.ID == 0) { - return false - } - if !(s.SenderChatID == 0) { - return false - } - if !(s.SenderID == nil) { - return false - } - if !(s.Date == 0) { - return false - } - if !(s.IsBeingSent == false) { - return false - } - if !(s.IsBeingEdited == false) { - return false - } - if !(s.IsEdited == false) { - return false - } - if !(s.IsPostedToChatPage == false) { - return false - } - if !(s.IsVisibleOnlyForSelf == false) { - return false - } - if !(s.CanBeDeleted == false) { - return false - } - if !(s.CanBeEdited == false) { - return false - } - if !(s.CanBeForwarded == false) { - return false - } - if !(s.CanBeReplied == false) { - return false - } - if !(s.CanToggleIsPostedToChatPage == false) { - return false - } - if !(s.CanGetStatistics == false) { - return false - } - if !(s.CanGetInteractions == false) { - return false - } - if !(s.HasExpiredViewers == false) { - return false - } - if !(s.RepostInfo.Zero()) { - return false - } - if !(s.InteractionInfo.Zero()) { - return false - } - if !(s.ChosenReactionType == nil) { - return false - } - if !(s.PrivacySettings == nil) { - return false - } - if !(s.Content == nil) { - return false - } - if !(s.Areas == nil) { - return false - } - if !(s.Caption.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *Story) String() string { - if s == nil { - return "Story(nil)" - } - type Alias Story - return fmt.Sprintf("Story%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Story) TypeID() uint32 { - return StoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*Story) TypeName() string { - return "story" -} - -// TypeInfo returns info about TL type. -func (s *Story) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "story", - ID: StoryTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "SenderChatID", - SchemaName: "sender_chat_id", - }, - { - Name: "SenderID", - SchemaName: "sender_id", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "IsBeingSent", - SchemaName: "is_being_sent", - }, - { - Name: "IsBeingEdited", - SchemaName: "is_being_edited", - }, - { - Name: "IsEdited", - SchemaName: "is_edited", - }, - { - Name: "IsPostedToChatPage", - SchemaName: "is_posted_to_chat_page", - }, - { - Name: "IsVisibleOnlyForSelf", - SchemaName: "is_visible_only_for_self", - }, - { - Name: "CanBeDeleted", - SchemaName: "can_be_deleted", - }, - { - Name: "CanBeEdited", - SchemaName: "can_be_edited", - }, - { - Name: "CanBeForwarded", - SchemaName: "can_be_forwarded", - }, - { - Name: "CanBeReplied", - SchemaName: "can_be_replied", - }, - { - Name: "CanToggleIsPostedToChatPage", - SchemaName: "can_toggle_is_posted_to_chat_page", - }, - { - Name: "CanGetStatistics", - SchemaName: "can_get_statistics", - }, - { - Name: "CanGetInteractions", - SchemaName: "can_get_interactions", - }, - { - Name: "HasExpiredViewers", - SchemaName: "has_expired_viewers", - }, - { - Name: "RepostInfo", - SchemaName: "repost_info", - }, - { - Name: "InteractionInfo", - SchemaName: "interaction_info", - }, - { - Name: "ChosenReactionType", - SchemaName: "chosen_reaction_type", - }, - { - Name: "PrivacySettings", - SchemaName: "privacy_settings", - }, - { - Name: "Content", - SchemaName: "content", - }, - { - Name: "Areas", - SchemaName: "areas", - }, - { - Name: "Caption", - SchemaName: "caption", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *Story) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode story#84cdc9d1 as nil") - } - b.PutID(StoryTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *Story) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode story#84cdc9d1 as nil") - } - b.PutInt32(s.ID) - b.PutInt53(s.SenderChatID) - if s.SenderID == nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field sender_id is nil") - } - if err := s.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field sender_id: %w", err) - } - b.PutInt32(s.Date) - b.PutBool(s.IsBeingSent) - b.PutBool(s.IsBeingEdited) - b.PutBool(s.IsEdited) - b.PutBool(s.IsPostedToChatPage) - b.PutBool(s.IsVisibleOnlyForSelf) - b.PutBool(s.CanBeDeleted) - b.PutBool(s.CanBeEdited) - b.PutBool(s.CanBeForwarded) - b.PutBool(s.CanBeReplied) - b.PutBool(s.CanToggleIsPostedToChatPage) - b.PutBool(s.CanGetStatistics) - b.PutBool(s.CanGetInteractions) - b.PutBool(s.HasExpiredViewers) - if err := s.RepostInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field repost_info: %w", err) - } - if err := s.InteractionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field interaction_info: %w", err) - } - if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field chosen_reaction_type is nil") - } - if err := s.ChosenReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field chosen_reaction_type: %w", err) - } - if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field privacy_settings is nil") - } - if err := s.PrivacySettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field privacy_settings: %w", err) - } - if s.Content == nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field content is nil") - } - if err := s.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field content: %w", err) - } - b.PutInt(len(s.Areas)) - for idx, v := range s.Areas { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare story#84cdc9d1: field areas element with index %d: %w", idx, err) - } - } - if err := s.Caption.Encode(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field caption: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *Story) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode story#84cdc9d1 to nil") - } - if err := b.ConsumeID(StoryTypeID); err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *Story) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode story#84cdc9d1 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field id: %w", err) - } - s.ID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field sender_chat_id: %w", err) - } - s.SenderChatID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field sender_id: %w", err) - } - s.SenderID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field date: %w", err) - } - s.Date = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field is_being_sent: %w", err) - } - s.IsBeingSent = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field is_being_edited: %w", err) - } - s.IsBeingEdited = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field is_edited: %w", err) - } - s.IsEdited = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field is_posted_to_chat_page: %w", err) - } - s.IsPostedToChatPage = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field is_visible_only_for_self: %w", err) - } - s.IsVisibleOnlyForSelf = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_deleted: %w", err) - } - s.CanBeDeleted = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_edited: %w", err) - } - s.CanBeEdited = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_forwarded: %w", err) - } - s.CanBeForwarded = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_replied: %w", err) - } - s.CanBeReplied = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_toggle_is_posted_to_chat_page: %w", err) - } - s.CanToggleIsPostedToChatPage = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_get_statistics: %w", err) - } - s.CanGetStatistics = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_get_interactions: %w", err) - } - s.CanGetInteractions = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field has_expired_viewers: %w", err) - } - s.HasExpiredViewers = value - } - { - if err := s.RepostInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field repost_info: %w", err) - } - } - { - if err := s.InteractionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field interaction_info: %w", err) - } - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field chosen_reaction_type: %w", err) - } - s.ChosenReactionType = value - } - { - value, err := DecodeStoryPrivacySettings(b) - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field privacy_settings: %w", err) - } - s.PrivacySettings = value - } - { - value, err := DecodeStoryContent(b) - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field content: %w", err) - } - s.Content = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field areas: %w", err) - } - - if headerLen > 0 { - s.Areas = make([]StoryArea, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StoryArea - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare story#84cdc9d1: field areas: %w", err) - } - s.Areas = append(s.Areas, value) - } - } - { - if err := s.Caption.Decode(b); err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field caption: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *Story) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode story#84cdc9d1 as nil") - } - b.ObjStart() - b.PutID("story") - b.Comma() - b.FieldStart("id") - b.PutInt32(s.ID) - b.Comma() - b.FieldStart("sender_chat_id") - b.PutInt53(s.SenderChatID) - b.Comma() - b.FieldStart("sender_id") - if s.SenderID == nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field sender_id is nil") - } - if err := s.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field sender_id: %w", err) - } - b.Comma() - b.FieldStart("date") - b.PutInt32(s.Date) - b.Comma() - b.FieldStart("is_being_sent") - b.PutBool(s.IsBeingSent) - b.Comma() - b.FieldStart("is_being_edited") - b.PutBool(s.IsBeingEdited) - b.Comma() - b.FieldStart("is_edited") - b.PutBool(s.IsEdited) - b.Comma() - b.FieldStart("is_posted_to_chat_page") - b.PutBool(s.IsPostedToChatPage) - b.Comma() - b.FieldStart("is_visible_only_for_self") - b.PutBool(s.IsVisibleOnlyForSelf) - b.Comma() - b.FieldStart("can_be_deleted") - b.PutBool(s.CanBeDeleted) - b.Comma() - b.FieldStart("can_be_edited") - b.PutBool(s.CanBeEdited) - b.Comma() - b.FieldStart("can_be_forwarded") - b.PutBool(s.CanBeForwarded) - b.Comma() - b.FieldStart("can_be_replied") - b.PutBool(s.CanBeReplied) - b.Comma() - b.FieldStart("can_toggle_is_posted_to_chat_page") - b.PutBool(s.CanToggleIsPostedToChatPage) - b.Comma() - b.FieldStart("can_get_statistics") - b.PutBool(s.CanGetStatistics) - b.Comma() - b.FieldStart("can_get_interactions") - b.PutBool(s.CanGetInteractions) - b.Comma() - b.FieldStart("has_expired_viewers") - b.PutBool(s.HasExpiredViewers) - b.Comma() - b.FieldStart("repost_info") - if err := s.RepostInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field repost_info: %w", err) - } - b.Comma() - b.FieldStart("interaction_info") - if err := s.InteractionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field interaction_info: %w", err) - } - b.Comma() - b.FieldStart("chosen_reaction_type") - if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field chosen_reaction_type is nil") - } - if err := s.ChosenReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field chosen_reaction_type: %w", err) - } - b.Comma() - b.FieldStart("privacy_settings") - if s.PrivacySettings == nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field privacy_settings is nil") - } - if err := s.PrivacySettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field privacy_settings: %w", err) - } - b.Comma() - b.FieldStart("content") - if s.Content == nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field content is nil") - } - if err := s.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field content: %w", err) - } - b.Comma() - b.FieldStart("areas") - b.ArrStart() - for idx, v := range s.Areas { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field areas element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("caption") - if err := s.Caption.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode story#84cdc9d1: field caption: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *Story) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode story#84cdc9d1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("story"); err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: %w", err) - } - case "id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field id: %w", err) - } - s.ID = value - case "sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field sender_chat_id: %w", err) - } - s.SenderChatID = value - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field sender_id: %w", err) - } - s.SenderID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field date: %w", err) - } - s.Date = value - case "is_being_sent": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field is_being_sent: %w", err) - } - s.IsBeingSent = value - case "is_being_edited": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field is_being_edited: %w", err) - } - s.IsBeingEdited = value - case "is_edited": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field is_edited: %w", err) - } - s.IsEdited = value - case "is_posted_to_chat_page": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field is_posted_to_chat_page: %w", err) - } - s.IsPostedToChatPage = value - case "is_visible_only_for_self": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field is_visible_only_for_self: %w", err) - } - s.IsVisibleOnlyForSelf = value - case "can_be_deleted": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_deleted: %w", err) - } - s.CanBeDeleted = value - case "can_be_edited": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_edited: %w", err) - } - s.CanBeEdited = value - case "can_be_forwarded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_forwarded: %w", err) - } - s.CanBeForwarded = value - case "can_be_replied": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_be_replied: %w", err) - } - s.CanBeReplied = value - case "can_toggle_is_posted_to_chat_page": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_toggle_is_posted_to_chat_page: %w", err) - } - s.CanToggleIsPostedToChatPage = value - case "can_get_statistics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_get_statistics: %w", err) - } - s.CanGetStatistics = value - case "can_get_interactions": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field can_get_interactions: %w", err) - } - s.CanGetInteractions = value - case "has_expired_viewers": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field has_expired_viewers: %w", err) - } - s.HasExpiredViewers = value - case "repost_info": - if err := s.RepostInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field repost_info: %w", err) - } - case "interaction_info": - if err := s.InteractionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field interaction_info: %w", err) - } - case "chosen_reaction_type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field chosen_reaction_type: %w", err) - } - s.ChosenReactionType = value - case "privacy_settings": - value, err := DecodeTDLibJSONStoryPrivacySettings(b) - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field privacy_settings: %w", err) - } - s.PrivacySettings = value - case "content": - value, err := DecodeTDLibJSONStoryContent(b) - if err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field content: %w", err) - } - s.Content = value - case "areas": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StoryArea - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field areas: %w", err) - } - s.Areas = append(s.Areas, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field areas: %w", err) - } - case "caption": - if err := s.Caption.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode story#84cdc9d1: field caption: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *Story) GetID() (value int32) { - if s == nil { - return - } - return s.ID -} - -// GetSenderChatID returns value of SenderChatID field. -func (s *Story) GetSenderChatID() (value int64) { - if s == nil { - return - } - return s.SenderChatID -} - -// GetSenderID returns value of SenderID field. -func (s *Story) GetSenderID() (value MessageSenderClass) { - if s == nil { - return - } - return s.SenderID -} - -// GetDate returns value of Date field. -func (s *Story) GetDate() (value int32) { - if s == nil { - return - } - return s.Date -} - -// GetIsBeingSent returns value of IsBeingSent field. -func (s *Story) GetIsBeingSent() (value bool) { - if s == nil { - return - } - return s.IsBeingSent -} - -// GetIsBeingEdited returns value of IsBeingEdited field. -func (s *Story) GetIsBeingEdited() (value bool) { - if s == nil { - return - } - return s.IsBeingEdited -} - -// GetIsEdited returns value of IsEdited field. -func (s *Story) GetIsEdited() (value bool) { - if s == nil { - return - } - return s.IsEdited -} - -// GetIsPostedToChatPage returns value of IsPostedToChatPage field. -func (s *Story) GetIsPostedToChatPage() (value bool) { - if s == nil { - return - } - return s.IsPostedToChatPage -} - -// GetIsVisibleOnlyForSelf returns value of IsVisibleOnlyForSelf field. -func (s *Story) GetIsVisibleOnlyForSelf() (value bool) { - if s == nil { - return - } - return s.IsVisibleOnlyForSelf -} - -// GetCanBeDeleted returns value of CanBeDeleted field. -func (s *Story) GetCanBeDeleted() (value bool) { - if s == nil { - return - } - return s.CanBeDeleted -} - -// GetCanBeEdited returns value of CanBeEdited field. -func (s *Story) GetCanBeEdited() (value bool) { - if s == nil { - return - } - return s.CanBeEdited -} - -// GetCanBeForwarded returns value of CanBeForwarded field. -func (s *Story) GetCanBeForwarded() (value bool) { - if s == nil { - return - } - return s.CanBeForwarded -} - -// GetCanBeReplied returns value of CanBeReplied field. -func (s *Story) GetCanBeReplied() (value bool) { - if s == nil { - return - } - return s.CanBeReplied -} - -// GetCanToggleIsPostedToChatPage returns value of CanToggleIsPostedToChatPage field. -func (s *Story) GetCanToggleIsPostedToChatPage() (value bool) { - if s == nil { - return - } - return s.CanToggleIsPostedToChatPage -} - -// GetCanGetStatistics returns value of CanGetStatistics field. -func (s *Story) GetCanGetStatistics() (value bool) { - if s == nil { - return - } - return s.CanGetStatistics -} - -// GetCanGetInteractions returns value of CanGetInteractions field. -func (s *Story) GetCanGetInteractions() (value bool) { - if s == nil { - return - } - return s.CanGetInteractions -} - -// GetHasExpiredViewers returns value of HasExpiredViewers field. -func (s *Story) GetHasExpiredViewers() (value bool) { - if s == nil { - return - } - return s.HasExpiredViewers -} - -// GetRepostInfo returns value of RepostInfo field. -func (s *Story) GetRepostInfo() (value StoryRepostInfo) { - if s == nil { - return - } - return s.RepostInfo -} - -// GetInteractionInfo returns value of InteractionInfo field. -func (s *Story) GetInteractionInfo() (value StoryInteractionInfo) { - if s == nil { - return - } - return s.InteractionInfo -} - -// GetChosenReactionType returns value of ChosenReactionType field. -func (s *Story) GetChosenReactionType() (value ReactionTypeClass) { - if s == nil { - return - } - return s.ChosenReactionType -} - -// GetPrivacySettings returns value of PrivacySettings field. -func (s *Story) GetPrivacySettings() (value StoryPrivacySettingsClass) { - if s == nil { - return - } - return s.PrivacySettings -} - -// GetContent returns value of Content field. -func (s *Story) GetContent() (value StoryContentClass) { - if s == nil { - return - } - return s.Content -} - -// GetAreas returns value of Areas field. -func (s *Story) GetAreas() (value []StoryArea) { - if s == nil { - return - } - return s.Areas -} - -// GetCaption returns value of Caption field. -func (s *Story) GetCaption() (value FormattedText) { - if s == nil { - return - } - return s.Caption -} diff --git a/tdapi/tl_story_info_gen.go b/tdapi/tl_story_info_gen.go deleted file mode 100644 index 6c56e200e..000000000 --- a/tdapi/tl_story_info_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryInfo represents TL type `storyInfo#8997c352`. -type StoryInfo struct { - // Unique story identifier among stories of the given sender - StoryID int32 - // Point in time (Unix timestamp) when the story was published - Date int32 - // True, if the story is available only to close friends - IsForCloseFriends bool -} - -// StoryInfoTypeID is TL type id of StoryInfo. -const StoryInfoTypeID = 0x8997c352 - -// Ensuring interfaces in compile-time for StoryInfo. -var ( - _ bin.Encoder = &StoryInfo{} - _ bin.Decoder = &StoryInfo{} - _ bin.BareEncoder = &StoryInfo{} - _ bin.BareDecoder = &StoryInfo{} -) - -func (s *StoryInfo) Zero() bool { - if s == nil { - return true - } - if !(s.StoryID == 0) { - return false - } - if !(s.Date == 0) { - return false - } - if !(s.IsForCloseFriends == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryInfo) String() string { - if s == nil { - return "StoryInfo(nil)" - } - type Alias StoryInfo - return fmt.Sprintf("StoryInfo%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryInfo) TypeID() uint32 { - return StoryInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryInfo) TypeName() string { - return "storyInfo" -} - -// TypeInfo returns info about TL type. -func (s *StoryInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyInfo", - ID: StoryInfoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "IsForCloseFriends", - SchemaName: "is_for_close_friends", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryInfo) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInfo#8997c352 as nil") - } - b.PutID(StoryInfoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryInfo) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInfo#8997c352 as nil") - } - b.PutInt32(s.StoryID) - b.PutInt32(s.Date) - b.PutBool(s.IsForCloseFriends) - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryInfo) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInfo#8997c352 to nil") - } - if err := b.ConsumeID(StoryInfoTypeID); err != nil { - return fmt.Errorf("unable to decode storyInfo#8997c352: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryInfo) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInfo#8997c352 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInfo#8997c352: field story_id: %w", err) - } - s.StoryID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInfo#8997c352: field date: %w", err) - } - s.Date = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyInfo#8997c352: field is_for_close_friends: %w", err) - } - s.IsForCloseFriends = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyInfo#8997c352 as nil") - } - b.ObjStart() - b.PutID("storyInfo") - b.Comma() - b.FieldStart("story_id") - b.PutInt32(s.StoryID) - b.Comma() - b.FieldStart("date") - b.PutInt32(s.Date) - b.Comma() - b.FieldStart("is_for_close_friends") - b.PutBool(s.IsForCloseFriends) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyInfo#8997c352 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyInfo"); err != nil { - return fmt.Errorf("unable to decode storyInfo#8997c352: %w", err) - } - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInfo#8997c352: field story_id: %w", err) - } - s.StoryID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInfo#8997c352: field date: %w", err) - } - s.Date = value - case "is_for_close_friends": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyInfo#8997c352: field is_for_close_friends: %w", err) - } - s.IsForCloseFriends = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStoryID returns value of StoryID field. -func (s *StoryInfo) GetStoryID() (value int32) { - if s == nil { - return - } - return s.StoryID -} - -// GetDate returns value of Date field. -func (s *StoryInfo) GetDate() (value int32) { - if s == nil { - return - } - return s.Date -} - -// GetIsForCloseFriends returns value of IsForCloseFriends field. -func (s *StoryInfo) GetIsForCloseFriends() (value bool) { - if s == nil { - return - } - return s.IsForCloseFriends -} diff --git a/tdapi/tl_story_interaction_gen.go b/tdapi/tl_story_interaction_gen.go deleted file mode 100644 index 0feb3172b..000000000 --- a/tdapi/tl_story_interaction_gen.go +++ /dev/null @@ -1,325 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryInteraction represents TL type `storyInteraction#d624d222`. -type StoryInteraction struct { - // Identifier of the user or chat that made the interaction - ActorID MessageSenderClass - // Approximate point in time (Unix timestamp) when the interaction happened - InteractionDate int32 - // Block list to which the actor is added; may be null if none or for chat stories - BlockList BlockListClass - // Type of the interaction - Type StoryInteractionTypeClass -} - -// StoryInteractionTypeID is TL type id of StoryInteraction. -const StoryInteractionTypeID = 0xd624d222 - -// Ensuring interfaces in compile-time for StoryInteraction. -var ( - _ bin.Encoder = &StoryInteraction{} - _ bin.Decoder = &StoryInteraction{} - _ bin.BareEncoder = &StoryInteraction{} - _ bin.BareDecoder = &StoryInteraction{} -) - -func (s *StoryInteraction) Zero() bool { - if s == nil { - return true - } - if !(s.ActorID == nil) { - return false - } - if !(s.InteractionDate == 0) { - return false - } - if !(s.BlockList == nil) { - return false - } - if !(s.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryInteraction) String() string { - if s == nil { - return "StoryInteraction(nil)" - } - type Alias StoryInteraction - return fmt.Sprintf("StoryInteraction%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryInteraction) TypeID() uint32 { - return StoryInteractionTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryInteraction) TypeName() string { - return "storyInteraction" -} - -// TypeInfo returns info about TL type. -func (s *StoryInteraction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyInteraction", - ID: StoryInteractionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ActorID", - SchemaName: "actor_id", - }, - { - Name: "InteractionDate", - SchemaName: "interaction_date", - }, - { - Name: "BlockList", - SchemaName: "block_list", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryInteraction) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteraction#d624d222 as nil") - } - b.PutID(StoryInteractionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryInteraction) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteraction#d624d222 as nil") - } - if s.ActorID == nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field actor_id is nil") - } - if err := s.ActorID.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field actor_id: %w", err) - } - b.PutInt32(s.InteractionDate) - if s.BlockList == nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field block_list is nil") - } - if err := s.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field block_list: %w", err) - } - if s.Type == nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field type is nil") - } - if err := s.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryInteraction) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteraction#d624d222 to nil") - } - if err := b.ConsumeID(StoryInteractionTypeID); err != nil { - return fmt.Errorf("unable to decode storyInteraction#d624d222: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryInteraction) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteraction#d624d222 to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode storyInteraction#d624d222: field actor_id: %w", err) - } - s.ActorID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteraction#d624d222: field interaction_date: %w", err) - } - s.InteractionDate = value - } - { - value, err := DecodeBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode storyInteraction#d624d222: field block_list: %w", err) - } - s.BlockList = value - } - { - value, err := DecodeStoryInteractionType(b) - if err != nil { - return fmt.Errorf("unable to decode storyInteraction#d624d222: field type: %w", err) - } - s.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryInteraction) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyInteraction#d624d222 as nil") - } - b.ObjStart() - b.PutID("storyInteraction") - b.Comma() - b.FieldStart("actor_id") - if s.ActorID == nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field actor_id is nil") - } - if err := s.ActorID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field actor_id: %w", err) - } - b.Comma() - b.FieldStart("interaction_date") - b.PutInt32(s.InteractionDate) - b.Comma() - b.FieldStart("block_list") - if s.BlockList == nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field block_list is nil") - } - if err := s.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field block_list: %w", err) - } - b.Comma() - b.FieldStart("type") - if s.Type == nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field type is nil") - } - if err := s.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyInteraction#d624d222: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryInteraction) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyInteraction#d624d222 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyInteraction"); err != nil { - return fmt.Errorf("unable to decode storyInteraction#d624d222: %w", err) - } - case "actor_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode storyInteraction#d624d222: field actor_id: %w", err) - } - s.ActorID = value - case "interaction_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteraction#d624d222: field interaction_date: %w", err) - } - s.InteractionDate = value - case "block_list": - value, err := DecodeTDLibJSONBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode storyInteraction#d624d222: field block_list: %w", err) - } - s.BlockList = value - case "type": - value, err := DecodeTDLibJSONStoryInteractionType(b) - if err != nil { - return fmt.Errorf("unable to decode storyInteraction#d624d222: field type: %w", err) - } - s.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetActorID returns value of ActorID field. -func (s *StoryInteraction) GetActorID() (value MessageSenderClass) { - if s == nil { - return - } - return s.ActorID -} - -// GetInteractionDate returns value of InteractionDate field. -func (s *StoryInteraction) GetInteractionDate() (value int32) { - if s == nil { - return - } - return s.InteractionDate -} - -// GetBlockList returns value of BlockList field. -func (s *StoryInteraction) GetBlockList() (value BlockListClass) { - if s == nil { - return - } - return s.BlockList -} - -// GetType returns value of Type field. -func (s *StoryInteraction) GetType() (value StoryInteractionTypeClass) { - if s == nil { - return - } - return s.Type -} diff --git a/tdapi/tl_story_interaction_info_gen.go b/tdapi/tl_story_interaction_info_gen.go deleted file mode 100644 index 6bad4be23..000000000 --- a/tdapi/tl_story_interaction_info_gen.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryInteractionInfo represents TL type `storyInteractionInfo#e1557fc7`. -type StoryInteractionInfo struct { - // Number of times the story was viewed - ViewCount int32 - // Number of times the story was forwarded; 0 if none or unknown - ForwardCount int32 - // Number of reactions added to the story; 0 if none or unknown - ReactionCount int32 - // Identifiers of at most 3 recent viewers of the story - RecentViewerUserIDs []int64 -} - -// StoryInteractionInfoTypeID is TL type id of StoryInteractionInfo. -const StoryInteractionInfoTypeID = 0xe1557fc7 - -// Ensuring interfaces in compile-time for StoryInteractionInfo. -var ( - _ bin.Encoder = &StoryInteractionInfo{} - _ bin.Decoder = &StoryInteractionInfo{} - _ bin.BareEncoder = &StoryInteractionInfo{} - _ bin.BareDecoder = &StoryInteractionInfo{} -) - -func (s *StoryInteractionInfo) Zero() bool { - if s == nil { - return true - } - if !(s.ViewCount == 0) { - return false - } - if !(s.ForwardCount == 0) { - return false - } - if !(s.ReactionCount == 0) { - return false - } - if !(s.RecentViewerUserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryInteractionInfo) String() string { - if s == nil { - return "StoryInteractionInfo(nil)" - } - type Alias StoryInteractionInfo - return fmt.Sprintf("StoryInteractionInfo%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryInteractionInfo) TypeID() uint32 { - return StoryInteractionInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryInteractionInfo) TypeName() string { - return "storyInteractionInfo" -} - -// TypeInfo returns info about TL type. -func (s *StoryInteractionInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyInteractionInfo", - ID: StoryInteractionInfoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ViewCount", - SchemaName: "view_count", - }, - { - Name: "ForwardCount", - SchemaName: "forward_count", - }, - { - Name: "ReactionCount", - SchemaName: "reaction_count", - }, - { - Name: "RecentViewerUserIDs", - SchemaName: "recent_viewer_user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryInteractionInfo) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionInfo#e1557fc7 as nil") - } - b.PutID(StoryInteractionInfoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryInteractionInfo) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionInfo#e1557fc7 as nil") - } - b.PutInt32(s.ViewCount) - b.PutInt32(s.ForwardCount) - b.PutInt32(s.ReactionCount) - b.PutInt(len(s.RecentViewerUserIDs)) - for _, v := range s.RecentViewerUserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryInteractionInfo) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionInfo#e1557fc7 to nil") - } - if err := b.ConsumeID(StoryInteractionInfoTypeID); err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryInteractionInfo) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionInfo#e1557fc7 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field view_count: %w", err) - } - s.ViewCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field forward_count: %w", err) - } - s.ForwardCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field reaction_count: %w", err) - } - s.ReactionCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field recent_viewer_user_ids: %w", err) - } - - if headerLen > 0 { - s.RecentViewerUserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field recent_viewer_user_ids: %w", err) - } - s.RecentViewerUserIDs = append(s.RecentViewerUserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionInfo#e1557fc7 as nil") - } - b.ObjStart() - b.PutID("storyInteractionInfo") - b.Comma() - b.FieldStart("view_count") - b.PutInt32(s.ViewCount) - b.Comma() - b.FieldStart("forward_count") - b.PutInt32(s.ForwardCount) - b.Comma() - b.FieldStart("reaction_count") - b.PutInt32(s.ReactionCount) - b.Comma() - b.FieldStart("recent_viewer_user_ids") - b.ArrStart() - for _, v := range s.RecentViewerUserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryInteractionInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionInfo#e1557fc7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyInteractionInfo"); err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: %w", err) - } - case "view_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field view_count: %w", err) - } - s.ViewCount = value - case "forward_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field forward_count: %w", err) - } - s.ForwardCount = value - case "reaction_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field reaction_count: %w", err) - } - s.ReactionCount = value - case "recent_viewer_user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field recent_viewer_user_ids: %w", err) - } - s.RecentViewerUserIDs = append(s.RecentViewerUserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode storyInteractionInfo#e1557fc7: field recent_viewer_user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetViewCount returns value of ViewCount field. -func (s *StoryInteractionInfo) GetViewCount() (value int32) { - if s == nil { - return - } - return s.ViewCount -} - -// GetForwardCount returns value of ForwardCount field. -func (s *StoryInteractionInfo) GetForwardCount() (value int32) { - if s == nil { - return - } - return s.ForwardCount -} - -// GetReactionCount returns value of ReactionCount field. -func (s *StoryInteractionInfo) GetReactionCount() (value int32) { - if s == nil { - return - } - return s.ReactionCount -} - -// GetRecentViewerUserIDs returns value of RecentViewerUserIDs field. -func (s *StoryInteractionInfo) GetRecentViewerUserIDs() (value []int64) { - if s == nil { - return - } - return s.RecentViewerUserIDs -} diff --git a/tdapi/tl_story_interaction_type_gen.go b/tdapi/tl_story_interaction_type_gen.go deleted file mode 100644 index 9b2c966ee..000000000 --- a/tdapi/tl_story_interaction_type_gen.go +++ /dev/null @@ -1,692 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryInteractionTypeView represents TL type `storyInteractionTypeView#53e337d0`. -type StoryInteractionTypeView struct { - // Type of the reaction that was chosen by the viewer; may be null if none - ChosenReactionType ReactionTypeClass -} - -// StoryInteractionTypeViewTypeID is TL type id of StoryInteractionTypeView. -const StoryInteractionTypeViewTypeID = 0x53e337d0 - -// construct implements constructor of StoryInteractionTypeClass. -func (s StoryInteractionTypeView) construct() StoryInteractionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StoryInteractionTypeView. -var ( - _ bin.Encoder = &StoryInteractionTypeView{} - _ bin.Decoder = &StoryInteractionTypeView{} - _ bin.BareEncoder = &StoryInteractionTypeView{} - _ bin.BareDecoder = &StoryInteractionTypeView{} - - _ StoryInteractionTypeClass = &StoryInteractionTypeView{} -) - -func (s *StoryInteractionTypeView) Zero() bool { - if s == nil { - return true - } - if !(s.ChosenReactionType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryInteractionTypeView) String() string { - if s == nil { - return "StoryInteractionTypeView(nil)" - } - type Alias StoryInteractionTypeView - return fmt.Sprintf("StoryInteractionTypeView%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryInteractionTypeView) TypeID() uint32 { - return StoryInteractionTypeViewTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryInteractionTypeView) TypeName() string { - return "storyInteractionTypeView" -} - -// TypeInfo returns info about TL type. -func (s *StoryInteractionTypeView) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyInteractionTypeView", - ID: StoryInteractionTypeViewTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChosenReactionType", - SchemaName: "chosen_reaction_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryInteractionTypeView) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionTypeView#53e337d0 as nil") - } - b.PutID(StoryInteractionTypeViewTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryInteractionTypeView) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionTypeView#53e337d0 as nil") - } - if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode storyInteractionTypeView#53e337d0: field chosen_reaction_type is nil") - } - if err := s.ChosenReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyInteractionTypeView#53e337d0: field chosen_reaction_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryInteractionTypeView) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionTypeView#53e337d0 to nil") - } - if err := b.ConsumeID(StoryInteractionTypeViewTypeID); err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeView#53e337d0: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryInteractionTypeView) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionTypeView#53e337d0 to nil") - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeView#53e337d0: field chosen_reaction_type: %w", err) - } - s.ChosenReactionType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryInteractionTypeView) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionTypeView#53e337d0 as nil") - } - b.ObjStart() - b.PutID("storyInteractionTypeView") - b.Comma() - b.FieldStart("chosen_reaction_type") - if s.ChosenReactionType == nil { - return fmt.Errorf("unable to encode storyInteractionTypeView#53e337d0: field chosen_reaction_type is nil") - } - if err := s.ChosenReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyInteractionTypeView#53e337d0: field chosen_reaction_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryInteractionTypeView) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionTypeView#53e337d0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyInteractionTypeView"); err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeView#53e337d0: %w", err) - } - case "chosen_reaction_type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeView#53e337d0: field chosen_reaction_type: %w", err) - } - s.ChosenReactionType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChosenReactionType returns value of ChosenReactionType field. -func (s *StoryInteractionTypeView) GetChosenReactionType() (value ReactionTypeClass) { - if s == nil { - return - } - return s.ChosenReactionType -} - -// StoryInteractionTypeForward represents TL type `storyInteractionTypeForward#27d23cff`. -type StoryInteractionTypeForward struct { - // The message with story forward - Message Message -} - -// StoryInteractionTypeForwardTypeID is TL type id of StoryInteractionTypeForward. -const StoryInteractionTypeForwardTypeID = 0x27d23cff - -// construct implements constructor of StoryInteractionTypeClass. -func (s StoryInteractionTypeForward) construct() StoryInteractionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StoryInteractionTypeForward. -var ( - _ bin.Encoder = &StoryInteractionTypeForward{} - _ bin.Decoder = &StoryInteractionTypeForward{} - _ bin.BareEncoder = &StoryInteractionTypeForward{} - _ bin.BareDecoder = &StoryInteractionTypeForward{} - - _ StoryInteractionTypeClass = &StoryInteractionTypeForward{} -) - -func (s *StoryInteractionTypeForward) Zero() bool { - if s == nil { - return true - } - if !(s.Message.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryInteractionTypeForward) String() string { - if s == nil { - return "StoryInteractionTypeForward(nil)" - } - type Alias StoryInteractionTypeForward - return fmt.Sprintf("StoryInteractionTypeForward%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryInteractionTypeForward) TypeID() uint32 { - return StoryInteractionTypeForwardTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryInteractionTypeForward) TypeName() string { - return "storyInteractionTypeForward" -} - -// TypeInfo returns info about TL type. -func (s *StoryInteractionTypeForward) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyInteractionTypeForward", - ID: StoryInteractionTypeForwardTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryInteractionTypeForward) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionTypeForward#27d23cff as nil") - } - b.PutID(StoryInteractionTypeForwardTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryInteractionTypeForward) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionTypeForward#27d23cff as nil") - } - if err := s.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyInteractionTypeForward#27d23cff: field message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryInteractionTypeForward) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionTypeForward#27d23cff to nil") - } - if err := b.ConsumeID(StoryInteractionTypeForwardTypeID); err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeForward#27d23cff: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryInteractionTypeForward) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionTypeForward#27d23cff to nil") - } - { - if err := s.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeForward#27d23cff: field message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryInteractionTypeForward) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionTypeForward#27d23cff as nil") - } - b.ObjStart() - b.PutID("storyInteractionTypeForward") - b.Comma() - b.FieldStart("message") - if err := s.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyInteractionTypeForward#27d23cff: field message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryInteractionTypeForward) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionTypeForward#27d23cff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyInteractionTypeForward"); err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeForward#27d23cff: %w", err) - } - case "message": - if err := s.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeForward#27d23cff: field message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (s *StoryInteractionTypeForward) GetMessage() (value Message) { - if s == nil { - return - } - return s.Message -} - -// StoryInteractionTypeRepost represents TL type `storyInteractionTypeRepost#c32279c4`. -type StoryInteractionTypeRepost struct { - // The reposted story - Story Story -} - -// StoryInteractionTypeRepostTypeID is TL type id of StoryInteractionTypeRepost. -const StoryInteractionTypeRepostTypeID = 0xc32279c4 - -// construct implements constructor of StoryInteractionTypeClass. -func (s StoryInteractionTypeRepost) construct() StoryInteractionTypeClass { return &s } - -// Ensuring interfaces in compile-time for StoryInteractionTypeRepost. -var ( - _ bin.Encoder = &StoryInteractionTypeRepost{} - _ bin.Decoder = &StoryInteractionTypeRepost{} - _ bin.BareEncoder = &StoryInteractionTypeRepost{} - _ bin.BareDecoder = &StoryInteractionTypeRepost{} - - _ StoryInteractionTypeClass = &StoryInteractionTypeRepost{} -) - -func (s *StoryInteractionTypeRepost) Zero() bool { - if s == nil { - return true - } - if !(s.Story.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryInteractionTypeRepost) String() string { - if s == nil { - return "StoryInteractionTypeRepost(nil)" - } - type Alias StoryInteractionTypeRepost - return fmt.Sprintf("StoryInteractionTypeRepost%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryInteractionTypeRepost) TypeID() uint32 { - return StoryInteractionTypeRepostTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryInteractionTypeRepost) TypeName() string { - return "storyInteractionTypeRepost" -} - -// TypeInfo returns info about TL type. -func (s *StoryInteractionTypeRepost) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyInteractionTypeRepost", - ID: StoryInteractionTypeRepostTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Story", - SchemaName: "story", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryInteractionTypeRepost) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionTypeRepost#c32279c4 as nil") - } - b.PutID(StoryInteractionTypeRepostTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryInteractionTypeRepost) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionTypeRepost#c32279c4 as nil") - } - if err := s.Story.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyInteractionTypeRepost#c32279c4: field story: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryInteractionTypeRepost) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionTypeRepost#c32279c4 to nil") - } - if err := b.ConsumeID(StoryInteractionTypeRepostTypeID); err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeRepost#c32279c4: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryInteractionTypeRepost) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionTypeRepost#c32279c4 to nil") - } - { - if err := s.Story.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeRepost#c32279c4: field story: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryInteractionTypeRepost) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractionTypeRepost#c32279c4 as nil") - } - b.ObjStart() - b.PutID("storyInteractionTypeRepost") - b.Comma() - b.FieldStart("story") - if err := s.Story.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyInteractionTypeRepost#c32279c4: field story: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryInteractionTypeRepost) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractionTypeRepost#c32279c4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyInteractionTypeRepost"); err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeRepost#c32279c4: %w", err) - } - case "story": - if err := s.Story.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyInteractionTypeRepost#c32279c4: field story: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStory returns value of Story field. -func (s *StoryInteractionTypeRepost) GetStory() (value Story) { - if s == nil { - return - } - return s.Story -} - -// StoryInteractionTypeClassName is schema name of StoryInteractionTypeClass. -const StoryInteractionTypeClassName = "StoryInteractionType" - -// StoryInteractionTypeClass represents StoryInteractionType generic type. -// -// Example: -// -// g, err := tdapi.DecodeStoryInteractionType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StoryInteractionTypeView: // storyInteractionTypeView#53e337d0 -// case *tdapi.StoryInteractionTypeForward: // storyInteractionTypeForward#27d23cff -// case *tdapi.StoryInteractionTypeRepost: // storyInteractionTypeRepost#c32279c4 -// default: panic(v) -// } -type StoryInteractionTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StoryInteractionTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStoryInteractionType implements binary de-serialization for StoryInteractionTypeClass. -func DecodeStoryInteractionType(buf *bin.Buffer) (StoryInteractionTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StoryInteractionTypeViewTypeID: - // Decoding storyInteractionTypeView#53e337d0. - v := StoryInteractionTypeView{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryInteractionTypeClass: %w", err) - } - return &v, nil - case StoryInteractionTypeForwardTypeID: - // Decoding storyInteractionTypeForward#27d23cff. - v := StoryInteractionTypeForward{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryInteractionTypeClass: %w", err) - } - return &v, nil - case StoryInteractionTypeRepostTypeID: - // Decoding storyInteractionTypeRepost#c32279c4. - v := StoryInteractionTypeRepost{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryInteractionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryInteractionTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStoryInteractionType implements binary de-serialization for StoryInteractionTypeClass. -func DecodeTDLibJSONStoryInteractionType(buf tdjson.Decoder) (StoryInteractionTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "storyInteractionTypeView": - // Decoding storyInteractionTypeView#53e337d0. - v := StoryInteractionTypeView{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryInteractionTypeClass: %w", err) - } - return &v, nil - case "storyInteractionTypeForward": - // Decoding storyInteractionTypeForward#27d23cff. - v := StoryInteractionTypeForward{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryInteractionTypeClass: %w", err) - } - return &v, nil - case "storyInteractionTypeRepost": - // Decoding storyInteractionTypeRepost#c32279c4. - v := StoryInteractionTypeRepost{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryInteractionTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryInteractionTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StoryInteractionType boxes the StoryInteractionTypeClass providing a helper. -type StoryInteractionTypeBox struct { - StoryInteractionType StoryInteractionTypeClass -} - -// Decode implements bin.Decoder for StoryInteractionTypeBox. -func (b *StoryInteractionTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StoryInteractionTypeBox to nil") - } - v, err := DecodeStoryInteractionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryInteractionType = v - return nil -} - -// Encode implements bin.Encode for StoryInteractionTypeBox. -func (b *StoryInteractionTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StoryInteractionType == nil { - return fmt.Errorf("unable to encode StoryInteractionTypeClass as nil") - } - return b.StoryInteractionType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StoryInteractionTypeBox. -func (b *StoryInteractionTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StoryInteractionTypeBox to nil") - } - v, err := DecodeTDLibJSONStoryInteractionType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryInteractionType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StoryInteractionTypeBox. -func (b *StoryInteractionTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StoryInteractionType == nil { - return fmt.Errorf("unable to encode StoryInteractionTypeClass as nil") - } - return b.StoryInteractionType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_story_interactions_gen.go b/tdapi/tl_story_interactions_gen.go deleted file mode 100644 index 9944bb73f..000000000 --- a/tdapi/tl_story_interactions_gen.go +++ /dev/null @@ -1,357 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryInteractions represents TL type `storyInteractions#f9f5d50f`. -type StoryInteractions struct { - // Approximate total number of interactions found - TotalCount int32 - // Approximate total number of found forwards and reposts; always 0 for chat stories - TotalForwardCount int32 - // Approximate total number of found reactions; always 0 for chat stories - TotalReactionCount int32 - // List of story interactions - Interactions []StoryInteraction - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// StoryInteractionsTypeID is TL type id of StoryInteractions. -const StoryInteractionsTypeID = 0xf9f5d50f - -// Ensuring interfaces in compile-time for StoryInteractions. -var ( - _ bin.Encoder = &StoryInteractions{} - _ bin.Decoder = &StoryInteractions{} - _ bin.BareEncoder = &StoryInteractions{} - _ bin.BareDecoder = &StoryInteractions{} -) - -func (s *StoryInteractions) Zero() bool { - if s == nil { - return true - } - if !(s.TotalCount == 0) { - return false - } - if !(s.TotalForwardCount == 0) { - return false - } - if !(s.TotalReactionCount == 0) { - return false - } - if !(s.Interactions == nil) { - return false - } - if !(s.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryInteractions) String() string { - if s == nil { - return "StoryInteractions(nil)" - } - type Alias StoryInteractions - return fmt.Sprintf("StoryInteractions%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryInteractions) TypeID() uint32 { - return StoryInteractionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryInteractions) TypeName() string { - return "storyInteractions" -} - -// TypeInfo returns info about TL type. -func (s *StoryInteractions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyInteractions", - ID: StoryInteractionsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "TotalForwardCount", - SchemaName: "total_forward_count", - }, - { - Name: "TotalReactionCount", - SchemaName: "total_reaction_count", - }, - { - Name: "Interactions", - SchemaName: "interactions", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryInteractions) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractions#f9f5d50f as nil") - } - b.PutID(StoryInteractionsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryInteractions) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractions#f9f5d50f as nil") - } - b.PutInt32(s.TotalCount) - b.PutInt32(s.TotalForwardCount) - b.PutInt32(s.TotalReactionCount) - b.PutInt(len(s.Interactions)) - for idx, v := range s.Interactions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare storyInteractions#f9f5d50f: field interactions element with index %d: %w", idx, err) - } - } - b.PutString(s.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryInteractions) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractions#f9f5d50f to nil") - } - if err := b.ConsumeID(StoryInteractionsTypeID); err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryInteractions) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractions#f9f5d50f to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: field total_count: %w", err) - } - s.TotalCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: field total_forward_count: %w", err) - } - s.TotalForwardCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: field total_reaction_count: %w", err) - } - s.TotalReactionCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: field interactions: %w", err) - } - - if headerLen > 0 { - s.Interactions = make([]StoryInteraction, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StoryInteraction - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare storyInteractions#f9f5d50f: field interactions: %w", err) - } - s.Interactions = append(s.Interactions, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: field next_offset: %w", err) - } - s.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryInteractions) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyInteractions#f9f5d50f as nil") - } - b.ObjStart() - b.PutID("storyInteractions") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(s.TotalCount) - b.Comma() - b.FieldStart("total_forward_count") - b.PutInt32(s.TotalForwardCount) - b.Comma() - b.FieldStart("total_reaction_count") - b.PutInt32(s.TotalReactionCount) - b.Comma() - b.FieldStart("interactions") - b.ArrStart() - for idx, v := range s.Interactions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyInteractions#f9f5d50f: field interactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(s.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryInteractions) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyInteractions#f9f5d50f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyInteractions"); err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: field total_count: %w", err) - } - s.TotalCount = value - case "total_forward_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: field total_forward_count: %w", err) - } - s.TotalForwardCount = value - case "total_reaction_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: field total_reaction_count: %w", err) - } - s.TotalReactionCount = value - case "interactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StoryInteraction - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: field interactions: %w", err) - } - s.Interactions = append(s.Interactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: field interactions: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storyInteractions#f9f5d50f: field next_offset: %w", err) - } - s.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (s *StoryInteractions) GetTotalCount() (value int32) { - if s == nil { - return - } - return s.TotalCount -} - -// GetTotalForwardCount returns value of TotalForwardCount field. -func (s *StoryInteractions) GetTotalForwardCount() (value int32) { - if s == nil { - return - } - return s.TotalForwardCount -} - -// GetTotalReactionCount returns value of TotalReactionCount field. -func (s *StoryInteractions) GetTotalReactionCount() (value int32) { - if s == nil { - return - } - return s.TotalReactionCount -} - -// GetInteractions returns value of Interactions field. -func (s *StoryInteractions) GetInteractions() (value []StoryInteraction) { - if s == nil { - return - } - return s.Interactions -} - -// GetNextOffset returns value of NextOffset field. -func (s *StoryInteractions) GetNextOffset() (value string) { - if s == nil { - return - } - return s.NextOffset -} diff --git a/tdapi/tl_story_list_gen.go b/tdapi/tl_story_list_gen.go deleted file mode 100644 index 4c4e4affc..000000000 --- a/tdapi/tl_story_list_gen.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryListMain represents TL type `storyListMain#d7eeb3ff`. -type StoryListMain struct { -} - -// StoryListMainTypeID is TL type id of StoryListMain. -const StoryListMainTypeID = 0xd7eeb3ff - -// construct implements constructor of StoryListClass. -func (s StoryListMain) construct() StoryListClass { return &s } - -// Ensuring interfaces in compile-time for StoryListMain. -var ( - _ bin.Encoder = &StoryListMain{} - _ bin.Decoder = &StoryListMain{} - _ bin.BareEncoder = &StoryListMain{} - _ bin.BareDecoder = &StoryListMain{} - - _ StoryListClass = &StoryListMain{} -) - -func (s *StoryListMain) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryListMain) String() string { - if s == nil { - return "StoryListMain(nil)" - } - type Alias StoryListMain - return fmt.Sprintf("StoryListMain%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryListMain) TypeID() uint32 { - return StoryListMainTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryListMain) TypeName() string { - return "storyListMain" -} - -// TypeInfo returns info about TL type. -func (s *StoryListMain) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyListMain", - ID: StoryListMainTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryListMain) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyListMain#d7eeb3ff as nil") - } - b.PutID(StoryListMainTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryListMain) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyListMain#d7eeb3ff as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryListMain) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyListMain#d7eeb3ff to nil") - } - if err := b.ConsumeID(StoryListMainTypeID); err != nil { - return fmt.Errorf("unable to decode storyListMain#d7eeb3ff: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryListMain) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyListMain#d7eeb3ff to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryListMain) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyListMain#d7eeb3ff as nil") - } - b.ObjStart() - b.PutID("storyListMain") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryListMain) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyListMain#d7eeb3ff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyListMain"); err != nil { - return fmt.Errorf("unable to decode storyListMain#d7eeb3ff: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StoryListArchive represents TL type `storyListArchive#fd80a741`. -type StoryListArchive struct { -} - -// StoryListArchiveTypeID is TL type id of StoryListArchive. -const StoryListArchiveTypeID = 0xfd80a741 - -// construct implements constructor of StoryListClass. -func (s StoryListArchive) construct() StoryListClass { return &s } - -// Ensuring interfaces in compile-time for StoryListArchive. -var ( - _ bin.Encoder = &StoryListArchive{} - _ bin.Decoder = &StoryListArchive{} - _ bin.BareEncoder = &StoryListArchive{} - _ bin.BareDecoder = &StoryListArchive{} - - _ StoryListClass = &StoryListArchive{} -) - -func (s *StoryListArchive) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryListArchive) String() string { - if s == nil { - return "StoryListArchive(nil)" - } - type Alias StoryListArchive - return fmt.Sprintf("StoryListArchive%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryListArchive) TypeID() uint32 { - return StoryListArchiveTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryListArchive) TypeName() string { - return "storyListArchive" -} - -// TypeInfo returns info about TL type. -func (s *StoryListArchive) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyListArchive", - ID: StoryListArchiveTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryListArchive) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyListArchive#fd80a741 as nil") - } - b.PutID(StoryListArchiveTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryListArchive) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyListArchive#fd80a741 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryListArchive) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyListArchive#fd80a741 to nil") - } - if err := b.ConsumeID(StoryListArchiveTypeID); err != nil { - return fmt.Errorf("unable to decode storyListArchive#fd80a741: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryListArchive) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyListArchive#fd80a741 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryListArchive) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyListArchive#fd80a741 as nil") - } - b.ObjStart() - b.PutID("storyListArchive") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryListArchive) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyListArchive#fd80a741 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyListArchive"); err != nil { - return fmt.Errorf("unable to decode storyListArchive#fd80a741: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StoryListClassName is schema name of StoryListClass. -const StoryListClassName = "StoryList" - -// StoryListClass represents StoryList generic type. -// -// Example: -// -// g, err := tdapi.DecodeStoryList(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StoryListMain: // storyListMain#d7eeb3ff -// case *tdapi.StoryListArchive: // storyListArchive#fd80a741 -// default: panic(v) -// } -type StoryListClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StoryListClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStoryList implements binary de-serialization for StoryListClass. -func DecodeStoryList(buf *bin.Buffer) (StoryListClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StoryListMainTypeID: - // Decoding storyListMain#d7eeb3ff. - v := StoryListMain{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryListClass: %w", err) - } - return &v, nil - case StoryListArchiveTypeID: - // Decoding storyListArchive#fd80a741. - v := StoryListArchive{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryListClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryListClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStoryList implements binary de-serialization for StoryListClass. -func DecodeTDLibJSONStoryList(buf tdjson.Decoder) (StoryListClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "storyListMain": - // Decoding storyListMain#d7eeb3ff. - v := StoryListMain{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryListClass: %w", err) - } - return &v, nil - case "storyListArchive": - // Decoding storyListArchive#fd80a741. - v := StoryListArchive{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryListClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryListClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StoryList boxes the StoryListClass providing a helper. -type StoryListBox struct { - StoryList StoryListClass -} - -// Decode implements bin.Decoder for StoryListBox. -func (b *StoryListBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StoryListBox to nil") - } - v, err := DecodeStoryList(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryList = v - return nil -} - -// Encode implements bin.Encode for StoryListBox. -func (b *StoryListBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StoryList == nil { - return fmt.Errorf("unable to encode StoryListClass as nil") - } - return b.StoryList.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StoryListBox. -func (b *StoryListBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StoryListBox to nil") - } - v, err := DecodeTDLibJSONStoryList(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryList = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StoryListBox. -func (b *StoryListBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StoryList == nil { - return fmt.Errorf("unable to encode StoryListClass as nil") - } - return b.StoryList.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_story_origin_gen.go b/tdapi/tl_story_origin_gen.go deleted file mode 100644 index 5b434f35f..000000000 --- a/tdapi/tl_story_origin_gen.go +++ /dev/null @@ -1,535 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryOriginPublicStory represents TL type `storyOriginPublicStory#2c379fbe`. -type StoryOriginPublicStory struct { - // Identifier of the chat that posted original story - ChatID int64 - // Story identifier of the original story - StoryID int32 -} - -// StoryOriginPublicStoryTypeID is TL type id of StoryOriginPublicStory. -const StoryOriginPublicStoryTypeID = 0x2c379fbe - -// construct implements constructor of StoryOriginClass. -func (s StoryOriginPublicStory) construct() StoryOriginClass { return &s } - -// Ensuring interfaces in compile-time for StoryOriginPublicStory. -var ( - _ bin.Encoder = &StoryOriginPublicStory{} - _ bin.Decoder = &StoryOriginPublicStory{} - _ bin.BareEncoder = &StoryOriginPublicStory{} - _ bin.BareDecoder = &StoryOriginPublicStory{} - - _ StoryOriginClass = &StoryOriginPublicStory{} -) - -func (s *StoryOriginPublicStory) Zero() bool { - if s == nil { - return true - } - if !(s.ChatID == 0) { - return false - } - if !(s.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryOriginPublicStory) String() string { - if s == nil { - return "StoryOriginPublicStory(nil)" - } - type Alias StoryOriginPublicStory - return fmt.Sprintf("StoryOriginPublicStory%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryOriginPublicStory) TypeID() uint32 { - return StoryOriginPublicStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryOriginPublicStory) TypeName() string { - return "storyOriginPublicStory" -} - -// TypeInfo returns info about TL type. -func (s *StoryOriginPublicStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyOriginPublicStory", - ID: StoryOriginPublicStoryTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryOriginPublicStory) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyOriginPublicStory#2c379fbe as nil") - } - b.PutID(StoryOriginPublicStoryTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryOriginPublicStory) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyOriginPublicStory#2c379fbe as nil") - } - b.PutInt53(s.ChatID) - b.PutInt32(s.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryOriginPublicStory) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyOriginPublicStory#2c379fbe to nil") - } - if err := b.ConsumeID(StoryOriginPublicStoryTypeID); err != nil { - return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryOriginPublicStory) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyOriginPublicStory#2c379fbe to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: field chat_id: %w", err) - } - s.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: field story_id: %w", err) - } - s.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryOriginPublicStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyOriginPublicStory#2c379fbe as nil") - } - b.ObjStart() - b.PutID("storyOriginPublicStory") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(s.ChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(s.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryOriginPublicStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyOriginPublicStory#2c379fbe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyOriginPublicStory"); err != nil { - return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: field chat_id: %w", err) - } - s.ChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyOriginPublicStory#2c379fbe: field story_id: %w", err) - } - s.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (s *StoryOriginPublicStory) GetChatID() (value int64) { - if s == nil { - return - } - return s.ChatID -} - -// GetStoryID returns value of StoryID field. -func (s *StoryOriginPublicStory) GetStoryID() (value int32) { - if s == nil { - return - } - return s.StoryID -} - -// StoryOriginHiddenUser represents TL type `storyOriginHiddenUser#5a1f89ec`. -type StoryOriginHiddenUser struct { - // Name of the story sender - SenderName string -} - -// StoryOriginHiddenUserTypeID is TL type id of StoryOriginHiddenUser. -const StoryOriginHiddenUserTypeID = 0x5a1f89ec - -// construct implements constructor of StoryOriginClass. -func (s StoryOriginHiddenUser) construct() StoryOriginClass { return &s } - -// Ensuring interfaces in compile-time for StoryOriginHiddenUser. -var ( - _ bin.Encoder = &StoryOriginHiddenUser{} - _ bin.Decoder = &StoryOriginHiddenUser{} - _ bin.BareEncoder = &StoryOriginHiddenUser{} - _ bin.BareDecoder = &StoryOriginHiddenUser{} - - _ StoryOriginClass = &StoryOriginHiddenUser{} -) - -func (s *StoryOriginHiddenUser) Zero() bool { - if s == nil { - return true - } - if !(s.SenderName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryOriginHiddenUser) String() string { - if s == nil { - return "StoryOriginHiddenUser(nil)" - } - type Alias StoryOriginHiddenUser - return fmt.Sprintf("StoryOriginHiddenUser%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryOriginHiddenUser) TypeID() uint32 { - return StoryOriginHiddenUserTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryOriginHiddenUser) TypeName() string { - return "storyOriginHiddenUser" -} - -// TypeInfo returns info about TL type. -func (s *StoryOriginHiddenUser) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyOriginHiddenUser", - ID: StoryOriginHiddenUserTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderName", - SchemaName: "sender_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryOriginHiddenUser) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyOriginHiddenUser#5a1f89ec as nil") - } - b.PutID(StoryOriginHiddenUserTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryOriginHiddenUser) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyOriginHiddenUser#5a1f89ec as nil") - } - b.PutString(s.SenderName) - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryOriginHiddenUser) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyOriginHiddenUser#5a1f89ec to nil") - } - if err := b.ConsumeID(StoryOriginHiddenUserTypeID); err != nil { - return fmt.Errorf("unable to decode storyOriginHiddenUser#5a1f89ec: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryOriginHiddenUser) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyOriginHiddenUser#5a1f89ec to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storyOriginHiddenUser#5a1f89ec: field sender_name: %w", err) - } - s.SenderName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryOriginHiddenUser) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyOriginHiddenUser#5a1f89ec as nil") - } - b.ObjStart() - b.PutID("storyOriginHiddenUser") - b.Comma() - b.FieldStart("sender_name") - b.PutString(s.SenderName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryOriginHiddenUser) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyOriginHiddenUser#5a1f89ec to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyOriginHiddenUser"); err != nil { - return fmt.Errorf("unable to decode storyOriginHiddenUser#5a1f89ec: %w", err) - } - case "sender_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode storyOriginHiddenUser#5a1f89ec: field sender_name: %w", err) - } - s.SenderName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderName returns value of SenderName field. -func (s *StoryOriginHiddenUser) GetSenderName() (value string) { - if s == nil { - return - } - return s.SenderName -} - -// StoryOriginClassName is schema name of StoryOriginClass. -const StoryOriginClassName = "StoryOrigin" - -// StoryOriginClass represents StoryOrigin generic type. -// -// Example: -// -// g, err := tdapi.DecodeStoryOrigin(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StoryOriginPublicStory: // storyOriginPublicStory#2c379fbe -// case *tdapi.StoryOriginHiddenUser: // storyOriginHiddenUser#5a1f89ec -// default: panic(v) -// } -type StoryOriginClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StoryOriginClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStoryOrigin implements binary de-serialization for StoryOriginClass. -func DecodeStoryOrigin(buf *bin.Buffer) (StoryOriginClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StoryOriginPublicStoryTypeID: - // Decoding storyOriginPublicStory#2c379fbe. - v := StoryOriginPublicStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", err) - } - return &v, nil - case StoryOriginHiddenUserTypeID: - // Decoding storyOriginHiddenUser#5a1f89ec. - v := StoryOriginHiddenUser{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStoryOrigin implements binary de-serialization for StoryOriginClass. -func DecodeTDLibJSONStoryOrigin(buf tdjson.Decoder) (StoryOriginClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "storyOriginPublicStory": - // Decoding storyOriginPublicStory#2c379fbe. - v := StoryOriginPublicStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", err) - } - return &v, nil - case "storyOriginHiddenUser": - // Decoding storyOriginHiddenUser#5a1f89ec. - v := StoryOriginHiddenUser{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryOriginClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StoryOrigin boxes the StoryOriginClass providing a helper. -type StoryOriginBox struct { - StoryOrigin StoryOriginClass -} - -// Decode implements bin.Decoder for StoryOriginBox. -func (b *StoryOriginBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StoryOriginBox to nil") - } - v, err := DecodeStoryOrigin(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryOrigin = v - return nil -} - -// Encode implements bin.Encode for StoryOriginBox. -func (b *StoryOriginBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StoryOrigin == nil { - return fmt.Errorf("unable to encode StoryOriginClass as nil") - } - return b.StoryOrigin.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StoryOriginBox. -func (b *StoryOriginBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StoryOriginBox to nil") - } - v, err := DecodeTDLibJSONStoryOrigin(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryOrigin = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StoryOriginBox. -func (b *StoryOriginBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StoryOrigin == nil { - return fmt.Errorf("unable to encode StoryOriginClass as nil") - } - return b.StoryOrigin.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_story_privacy_settings_gen.go b/tdapi/tl_story_privacy_settings_gen.go deleted file mode 100644 index 83cefa78c..000000000 --- a/tdapi/tl_story_privacy_settings_gen.go +++ /dev/null @@ -1,902 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryPrivacySettingsEveryone represents TL type `storyPrivacySettingsEveryone#22d1053a`. -type StoryPrivacySettingsEveryone struct { - // Identifiers of the users that can't see the story; always unknown and empty for - // non-owned stories - ExceptUserIDs []int64 -} - -// StoryPrivacySettingsEveryoneTypeID is TL type id of StoryPrivacySettingsEveryone. -const StoryPrivacySettingsEveryoneTypeID = 0x22d1053a - -// construct implements constructor of StoryPrivacySettingsClass. -func (s StoryPrivacySettingsEveryone) construct() StoryPrivacySettingsClass { return &s } - -// Ensuring interfaces in compile-time for StoryPrivacySettingsEveryone. -var ( - _ bin.Encoder = &StoryPrivacySettingsEveryone{} - _ bin.Decoder = &StoryPrivacySettingsEveryone{} - _ bin.BareEncoder = &StoryPrivacySettingsEveryone{} - _ bin.BareDecoder = &StoryPrivacySettingsEveryone{} - - _ StoryPrivacySettingsClass = &StoryPrivacySettingsEveryone{} -) - -func (s *StoryPrivacySettingsEveryone) Zero() bool { - if s == nil { - return true - } - if !(s.ExceptUserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryPrivacySettingsEveryone) String() string { - if s == nil { - return "StoryPrivacySettingsEveryone(nil)" - } - type Alias StoryPrivacySettingsEveryone - return fmt.Sprintf("StoryPrivacySettingsEveryone%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryPrivacySettingsEveryone) TypeID() uint32 { - return StoryPrivacySettingsEveryoneTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryPrivacySettingsEveryone) TypeName() string { - return "storyPrivacySettingsEveryone" -} - -// TypeInfo returns info about TL type. -func (s *StoryPrivacySettingsEveryone) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyPrivacySettingsEveryone", - ID: StoryPrivacySettingsEveryoneTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ExceptUserIDs", - SchemaName: "except_user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryPrivacySettingsEveryone) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsEveryone#22d1053a as nil") - } - b.PutID(StoryPrivacySettingsEveryoneTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryPrivacySettingsEveryone) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsEveryone#22d1053a as nil") - } - b.PutInt(len(s.ExceptUserIDs)) - for _, v := range s.ExceptUserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryPrivacySettingsEveryone) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsEveryone#22d1053a to nil") - } - if err := b.ConsumeID(StoryPrivacySettingsEveryoneTypeID); err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsEveryone#22d1053a: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryPrivacySettingsEveryone) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsEveryone#22d1053a to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsEveryone#22d1053a: field except_user_ids: %w", err) - } - - if headerLen > 0 { - s.ExceptUserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsEveryone#22d1053a: field except_user_ids: %w", err) - } - s.ExceptUserIDs = append(s.ExceptUserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryPrivacySettingsEveryone) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsEveryone#22d1053a as nil") - } - b.ObjStart() - b.PutID("storyPrivacySettingsEveryone") - b.Comma() - b.FieldStart("except_user_ids") - b.ArrStart() - for _, v := range s.ExceptUserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryPrivacySettingsEveryone) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsEveryone#22d1053a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyPrivacySettingsEveryone"); err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsEveryone#22d1053a: %w", err) - } - case "except_user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsEveryone#22d1053a: field except_user_ids: %w", err) - } - s.ExceptUserIDs = append(s.ExceptUserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsEveryone#22d1053a: field except_user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetExceptUserIDs returns value of ExceptUserIDs field. -func (s *StoryPrivacySettingsEveryone) GetExceptUserIDs() (value []int64) { - if s == nil { - return - } - return s.ExceptUserIDs -} - -// StoryPrivacySettingsContacts represents TL type `storyPrivacySettingsContacts#35515d71`. -type StoryPrivacySettingsContacts struct { - // User identifiers of the contacts that can't see the story; always unknown and empty - // for non-owned stories - ExceptUserIDs []int64 -} - -// StoryPrivacySettingsContactsTypeID is TL type id of StoryPrivacySettingsContacts. -const StoryPrivacySettingsContactsTypeID = 0x35515d71 - -// construct implements constructor of StoryPrivacySettingsClass. -func (s StoryPrivacySettingsContacts) construct() StoryPrivacySettingsClass { return &s } - -// Ensuring interfaces in compile-time for StoryPrivacySettingsContacts. -var ( - _ bin.Encoder = &StoryPrivacySettingsContacts{} - _ bin.Decoder = &StoryPrivacySettingsContacts{} - _ bin.BareEncoder = &StoryPrivacySettingsContacts{} - _ bin.BareDecoder = &StoryPrivacySettingsContacts{} - - _ StoryPrivacySettingsClass = &StoryPrivacySettingsContacts{} -) - -func (s *StoryPrivacySettingsContacts) Zero() bool { - if s == nil { - return true - } - if !(s.ExceptUserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryPrivacySettingsContacts) String() string { - if s == nil { - return "StoryPrivacySettingsContacts(nil)" - } - type Alias StoryPrivacySettingsContacts - return fmt.Sprintf("StoryPrivacySettingsContacts%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryPrivacySettingsContacts) TypeID() uint32 { - return StoryPrivacySettingsContactsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryPrivacySettingsContacts) TypeName() string { - return "storyPrivacySettingsContacts" -} - -// TypeInfo returns info about TL type. -func (s *StoryPrivacySettingsContacts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyPrivacySettingsContacts", - ID: StoryPrivacySettingsContactsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ExceptUserIDs", - SchemaName: "except_user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryPrivacySettingsContacts) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsContacts#35515d71 as nil") - } - b.PutID(StoryPrivacySettingsContactsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryPrivacySettingsContacts) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsContacts#35515d71 as nil") - } - b.PutInt(len(s.ExceptUserIDs)) - for _, v := range s.ExceptUserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryPrivacySettingsContacts) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsContacts#35515d71 to nil") - } - if err := b.ConsumeID(StoryPrivacySettingsContactsTypeID); err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsContacts#35515d71: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryPrivacySettingsContacts) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsContacts#35515d71 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsContacts#35515d71: field except_user_ids: %w", err) - } - - if headerLen > 0 { - s.ExceptUserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsContacts#35515d71: field except_user_ids: %w", err) - } - s.ExceptUserIDs = append(s.ExceptUserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryPrivacySettingsContacts) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsContacts#35515d71 as nil") - } - b.ObjStart() - b.PutID("storyPrivacySettingsContacts") - b.Comma() - b.FieldStart("except_user_ids") - b.ArrStart() - for _, v := range s.ExceptUserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryPrivacySettingsContacts) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsContacts#35515d71 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyPrivacySettingsContacts"); err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsContacts#35515d71: %w", err) - } - case "except_user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsContacts#35515d71: field except_user_ids: %w", err) - } - s.ExceptUserIDs = append(s.ExceptUserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsContacts#35515d71: field except_user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetExceptUserIDs returns value of ExceptUserIDs field. -func (s *StoryPrivacySettingsContacts) GetExceptUserIDs() (value []int64) { - if s == nil { - return - } - return s.ExceptUserIDs -} - -// StoryPrivacySettingsCloseFriends represents TL type `storyPrivacySettingsCloseFriends#7cff8b60`. -type StoryPrivacySettingsCloseFriends struct { -} - -// StoryPrivacySettingsCloseFriendsTypeID is TL type id of StoryPrivacySettingsCloseFriends. -const StoryPrivacySettingsCloseFriendsTypeID = 0x7cff8b60 - -// construct implements constructor of StoryPrivacySettingsClass. -func (s StoryPrivacySettingsCloseFriends) construct() StoryPrivacySettingsClass { return &s } - -// Ensuring interfaces in compile-time for StoryPrivacySettingsCloseFriends. -var ( - _ bin.Encoder = &StoryPrivacySettingsCloseFriends{} - _ bin.Decoder = &StoryPrivacySettingsCloseFriends{} - _ bin.BareEncoder = &StoryPrivacySettingsCloseFriends{} - _ bin.BareDecoder = &StoryPrivacySettingsCloseFriends{} - - _ StoryPrivacySettingsClass = &StoryPrivacySettingsCloseFriends{} -) - -func (s *StoryPrivacySettingsCloseFriends) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryPrivacySettingsCloseFriends) String() string { - if s == nil { - return "StoryPrivacySettingsCloseFriends(nil)" - } - type Alias StoryPrivacySettingsCloseFriends - return fmt.Sprintf("StoryPrivacySettingsCloseFriends%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryPrivacySettingsCloseFriends) TypeID() uint32 { - return StoryPrivacySettingsCloseFriendsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryPrivacySettingsCloseFriends) TypeName() string { - return "storyPrivacySettingsCloseFriends" -} - -// TypeInfo returns info about TL type. -func (s *StoryPrivacySettingsCloseFriends) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyPrivacySettingsCloseFriends", - ID: StoryPrivacySettingsCloseFriendsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryPrivacySettingsCloseFriends) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsCloseFriends#7cff8b60 as nil") - } - b.PutID(StoryPrivacySettingsCloseFriendsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryPrivacySettingsCloseFriends) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsCloseFriends#7cff8b60 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryPrivacySettingsCloseFriends) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsCloseFriends#7cff8b60 to nil") - } - if err := b.ConsumeID(StoryPrivacySettingsCloseFriendsTypeID); err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsCloseFriends#7cff8b60: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryPrivacySettingsCloseFriends) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsCloseFriends#7cff8b60 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryPrivacySettingsCloseFriends) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsCloseFriends#7cff8b60 as nil") - } - b.ObjStart() - b.PutID("storyPrivacySettingsCloseFriends") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryPrivacySettingsCloseFriends) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsCloseFriends#7cff8b60 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyPrivacySettingsCloseFriends"); err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsCloseFriends#7cff8b60: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// StoryPrivacySettingsSelectedUsers represents TL type `storyPrivacySettingsSelectedUsers#84d7d27b`. -type StoryPrivacySettingsSelectedUsers struct { - // Identifiers of the users; always unknown and empty for non-owned stories - UserIDs []int64 -} - -// StoryPrivacySettingsSelectedUsersTypeID is TL type id of StoryPrivacySettingsSelectedUsers. -const StoryPrivacySettingsSelectedUsersTypeID = 0x84d7d27b - -// construct implements constructor of StoryPrivacySettingsClass. -func (s StoryPrivacySettingsSelectedUsers) construct() StoryPrivacySettingsClass { return &s } - -// Ensuring interfaces in compile-time for StoryPrivacySettingsSelectedUsers. -var ( - _ bin.Encoder = &StoryPrivacySettingsSelectedUsers{} - _ bin.Decoder = &StoryPrivacySettingsSelectedUsers{} - _ bin.BareEncoder = &StoryPrivacySettingsSelectedUsers{} - _ bin.BareDecoder = &StoryPrivacySettingsSelectedUsers{} - - _ StoryPrivacySettingsClass = &StoryPrivacySettingsSelectedUsers{} -) - -func (s *StoryPrivacySettingsSelectedUsers) Zero() bool { - if s == nil { - return true - } - if !(s.UserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryPrivacySettingsSelectedUsers) String() string { - if s == nil { - return "StoryPrivacySettingsSelectedUsers(nil)" - } - type Alias StoryPrivacySettingsSelectedUsers - return fmt.Sprintf("StoryPrivacySettingsSelectedUsers%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryPrivacySettingsSelectedUsers) TypeID() uint32 { - return StoryPrivacySettingsSelectedUsersTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryPrivacySettingsSelectedUsers) TypeName() string { - return "storyPrivacySettingsSelectedUsers" -} - -// TypeInfo returns info about TL type. -func (s *StoryPrivacySettingsSelectedUsers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyPrivacySettingsSelectedUsers", - ID: StoryPrivacySettingsSelectedUsersTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryPrivacySettingsSelectedUsers) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsSelectedUsers#84d7d27b as nil") - } - b.PutID(StoryPrivacySettingsSelectedUsersTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryPrivacySettingsSelectedUsers) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsSelectedUsers#84d7d27b as nil") - } - b.PutInt(len(s.UserIDs)) - for _, v := range s.UserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryPrivacySettingsSelectedUsers) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsSelectedUsers#84d7d27b to nil") - } - if err := b.ConsumeID(StoryPrivacySettingsSelectedUsersTypeID); err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsSelectedUsers#84d7d27b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryPrivacySettingsSelectedUsers) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsSelectedUsers#84d7d27b to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsSelectedUsers#84d7d27b: field user_ids: %w", err) - } - - if headerLen > 0 { - s.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsSelectedUsers#84d7d27b: field user_ids: %w", err) - } - s.UserIDs = append(s.UserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryPrivacySettingsSelectedUsers) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyPrivacySettingsSelectedUsers#84d7d27b as nil") - } - b.ObjStart() - b.PutID("storyPrivacySettingsSelectedUsers") - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range s.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryPrivacySettingsSelectedUsers) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyPrivacySettingsSelectedUsers#84d7d27b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyPrivacySettingsSelectedUsers"); err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsSelectedUsers#84d7d27b: %w", err) - } - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsSelectedUsers#84d7d27b: field user_ids: %w", err) - } - s.UserIDs = append(s.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode storyPrivacySettingsSelectedUsers#84d7d27b: field user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserIDs returns value of UserIDs field. -func (s *StoryPrivacySettingsSelectedUsers) GetUserIDs() (value []int64) { - if s == nil { - return - } - return s.UserIDs -} - -// StoryPrivacySettingsClassName is schema name of StoryPrivacySettingsClass. -const StoryPrivacySettingsClassName = "StoryPrivacySettings" - -// StoryPrivacySettingsClass represents StoryPrivacySettings generic type. -// -// Example: -// -// g, err := tdapi.DecodeStoryPrivacySettings(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.StoryPrivacySettingsEveryone: // storyPrivacySettingsEveryone#22d1053a -// case *tdapi.StoryPrivacySettingsContacts: // storyPrivacySettingsContacts#35515d71 -// case *tdapi.StoryPrivacySettingsCloseFriends: // storyPrivacySettingsCloseFriends#7cff8b60 -// case *tdapi.StoryPrivacySettingsSelectedUsers: // storyPrivacySettingsSelectedUsers#84d7d27b -// default: panic(v) -// } -type StoryPrivacySettingsClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() StoryPrivacySettingsClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeStoryPrivacySettings implements binary de-serialization for StoryPrivacySettingsClass. -func DecodeStoryPrivacySettings(buf *bin.Buffer) (StoryPrivacySettingsClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case StoryPrivacySettingsEveryoneTypeID: - // Decoding storyPrivacySettingsEveryone#22d1053a. - v := StoryPrivacySettingsEveryone{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryPrivacySettingsClass: %w", err) - } - return &v, nil - case StoryPrivacySettingsContactsTypeID: - // Decoding storyPrivacySettingsContacts#35515d71. - v := StoryPrivacySettingsContacts{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryPrivacySettingsClass: %w", err) - } - return &v, nil - case StoryPrivacySettingsCloseFriendsTypeID: - // Decoding storyPrivacySettingsCloseFriends#7cff8b60. - v := StoryPrivacySettingsCloseFriends{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryPrivacySettingsClass: %w", err) - } - return &v, nil - case StoryPrivacySettingsSelectedUsersTypeID: - // Decoding storyPrivacySettingsSelectedUsers#84d7d27b. - v := StoryPrivacySettingsSelectedUsers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryPrivacySettingsClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryPrivacySettingsClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONStoryPrivacySettings implements binary de-serialization for StoryPrivacySettingsClass. -func DecodeTDLibJSONStoryPrivacySettings(buf tdjson.Decoder) (StoryPrivacySettingsClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "storyPrivacySettingsEveryone": - // Decoding storyPrivacySettingsEveryone#22d1053a. - v := StoryPrivacySettingsEveryone{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryPrivacySettingsClass: %w", err) - } - return &v, nil - case "storyPrivacySettingsContacts": - // Decoding storyPrivacySettingsContacts#35515d71. - v := StoryPrivacySettingsContacts{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryPrivacySettingsClass: %w", err) - } - return &v, nil - case "storyPrivacySettingsCloseFriends": - // Decoding storyPrivacySettingsCloseFriends#7cff8b60. - v := StoryPrivacySettingsCloseFriends{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryPrivacySettingsClass: %w", err) - } - return &v, nil - case "storyPrivacySettingsSelectedUsers": - // Decoding storyPrivacySettingsSelectedUsers#84d7d27b. - v := StoryPrivacySettingsSelectedUsers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode StoryPrivacySettingsClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode StoryPrivacySettingsClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// StoryPrivacySettings boxes the StoryPrivacySettingsClass providing a helper. -type StoryPrivacySettingsBox struct { - StoryPrivacySettings StoryPrivacySettingsClass -} - -// Decode implements bin.Decoder for StoryPrivacySettingsBox. -func (b *StoryPrivacySettingsBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode StoryPrivacySettingsBox to nil") - } - v, err := DecodeStoryPrivacySettings(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryPrivacySettings = v - return nil -} - -// Encode implements bin.Encode for StoryPrivacySettingsBox. -func (b *StoryPrivacySettingsBox) Encode(buf *bin.Buffer) error { - if b == nil || b.StoryPrivacySettings == nil { - return fmt.Errorf("unable to encode StoryPrivacySettingsClass as nil") - } - return b.StoryPrivacySettings.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for StoryPrivacySettingsBox. -func (b *StoryPrivacySettingsBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode StoryPrivacySettingsBox to nil") - } - v, err := DecodeTDLibJSONStoryPrivacySettings(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.StoryPrivacySettings = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for StoryPrivacySettingsBox. -func (b *StoryPrivacySettingsBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.StoryPrivacySettings == nil { - return fmt.Errorf("unable to encode StoryPrivacySettingsClass as nil") - } - return b.StoryPrivacySettings.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_story_repost_info_gen.go b/tdapi/tl_story_repost_info_gen.go deleted file mode 100644 index a46f4df49..000000000 --- a/tdapi/tl_story_repost_info_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryRepostInfo represents TL type `storyRepostInfo#ff7fa440`. -type StoryRepostInfo struct { - // Origin of the story that was reposted - Origin StoryOriginClass - // True, if story content was modified during reposting; otherwise, story wasn't modified - IsContentModified bool -} - -// StoryRepostInfoTypeID is TL type id of StoryRepostInfo. -const StoryRepostInfoTypeID = 0xff7fa440 - -// Ensuring interfaces in compile-time for StoryRepostInfo. -var ( - _ bin.Encoder = &StoryRepostInfo{} - _ bin.Decoder = &StoryRepostInfo{} - _ bin.BareEncoder = &StoryRepostInfo{} - _ bin.BareDecoder = &StoryRepostInfo{} -) - -func (s *StoryRepostInfo) Zero() bool { - if s == nil { - return true - } - if !(s.Origin == nil) { - return false - } - if !(s.IsContentModified == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryRepostInfo) String() string { - if s == nil { - return "StoryRepostInfo(nil)" - } - type Alias StoryRepostInfo - return fmt.Sprintf("StoryRepostInfo%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryRepostInfo) TypeID() uint32 { - return StoryRepostInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryRepostInfo) TypeName() string { - return "storyRepostInfo" -} - -// TypeInfo returns info about TL type. -func (s *StoryRepostInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyRepostInfo", - ID: StoryRepostInfoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Origin", - SchemaName: "origin", - }, - { - Name: "IsContentModified", - SchemaName: "is_content_modified", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryRepostInfo) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyRepostInfo#ff7fa440 as nil") - } - b.PutID(StoryRepostInfoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryRepostInfo) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyRepostInfo#ff7fa440 as nil") - } - if s.Origin == nil { - return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin is nil") - } - if err := s.Origin.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin: %w", err) - } - b.PutBool(s.IsContentModified) - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryRepostInfo) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyRepostInfo#ff7fa440 to nil") - } - if err := b.ConsumeID(StoryRepostInfoTypeID); err != nil { - return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryRepostInfo) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyRepostInfo#ff7fa440 to nil") - } - { - value, err := DecodeStoryOrigin(b) - if err != nil { - return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field origin: %w", err) - } - s.Origin = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field is_content_modified: %w", err) - } - s.IsContentModified = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryRepostInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyRepostInfo#ff7fa440 as nil") - } - b.ObjStart() - b.PutID("storyRepostInfo") - b.Comma() - b.FieldStart("origin") - if s.Origin == nil { - return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin is nil") - } - if err := s.Origin.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyRepostInfo#ff7fa440: field origin: %w", err) - } - b.Comma() - b.FieldStart("is_content_modified") - b.PutBool(s.IsContentModified) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryRepostInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyRepostInfo#ff7fa440 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyRepostInfo"); err != nil { - return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: %w", err) - } - case "origin": - value, err := DecodeTDLibJSONStoryOrigin(b) - if err != nil { - return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field origin: %w", err) - } - s.Origin = value - case "is_content_modified": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyRepostInfo#ff7fa440: field is_content_modified: %w", err) - } - s.IsContentModified = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOrigin returns value of Origin field. -func (s *StoryRepostInfo) GetOrigin() (value StoryOriginClass) { - if s == nil { - return - } - return s.Origin -} - -// GetIsContentModified returns value of IsContentModified field. -func (s *StoryRepostInfo) GetIsContentModified() (value bool) { - if s == nil { - return - } - return s.IsContentModified -} diff --git a/tdapi/tl_story_statistics_gen.go b/tdapi/tl_story_statistics_gen.go deleted file mode 100644 index 634c4b8dd..000000000 --- a/tdapi/tl_story_statistics_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryStatistics represents TL type `storyStatistics#46448b6b`. -type StoryStatistics struct { - // A graph containing number of story views and shares - StoryInteractionGraph StatisticalGraphClass - // A graph containing number of story reactions - StoryReactionGraph StatisticalGraphClass -} - -// StoryStatisticsTypeID is TL type id of StoryStatistics. -const StoryStatisticsTypeID = 0x46448b6b - -// Ensuring interfaces in compile-time for StoryStatistics. -var ( - _ bin.Encoder = &StoryStatistics{} - _ bin.Decoder = &StoryStatistics{} - _ bin.BareEncoder = &StoryStatistics{} - _ bin.BareDecoder = &StoryStatistics{} -) - -func (s *StoryStatistics) Zero() bool { - if s == nil { - return true - } - if !(s.StoryInteractionGraph == nil) { - return false - } - if !(s.StoryReactionGraph == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryStatistics) String() string { - if s == nil { - return "StoryStatistics(nil)" - } - type Alias StoryStatistics - return fmt.Sprintf("StoryStatistics%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryStatistics) TypeID() uint32 { - return StoryStatisticsTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryStatistics) TypeName() string { - return "storyStatistics" -} - -// TypeInfo returns info about TL type. -func (s *StoryStatistics) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyStatistics", - ID: StoryStatisticsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StoryInteractionGraph", - SchemaName: "story_interaction_graph", - }, - { - Name: "StoryReactionGraph", - SchemaName: "story_reaction_graph", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryStatistics) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyStatistics#46448b6b as nil") - } - b.PutID(StoryStatisticsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryStatistics) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyStatistics#46448b6b as nil") - } - if s.StoryInteractionGraph == nil { - return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph is nil") - } - if err := s.StoryInteractionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph: %w", err) - } - if s.StoryReactionGraph == nil { - return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph is nil") - } - if err := s.StoryReactionGraph.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryStatistics) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyStatistics#46448b6b to nil") - } - if err := b.ConsumeID(StoryStatisticsTypeID); err != nil { - return fmt.Errorf("unable to decode storyStatistics#46448b6b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryStatistics) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyStatistics#46448b6b to nil") - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_interaction_graph: %w", err) - } - s.StoryInteractionGraph = value - } - { - value, err := DecodeStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_reaction_graph: %w", err) - } - s.StoryReactionGraph = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryStatistics) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyStatistics#46448b6b as nil") - } - b.ObjStart() - b.PutID("storyStatistics") - b.Comma() - b.FieldStart("story_interaction_graph") - if s.StoryInteractionGraph == nil { - return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph is nil") - } - if err := s.StoryInteractionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_interaction_graph: %w", err) - } - b.Comma() - b.FieldStart("story_reaction_graph") - if s.StoryReactionGraph == nil { - return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph is nil") - } - if err := s.StoryReactionGraph.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyStatistics#46448b6b: field story_reaction_graph: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryStatistics) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyStatistics#46448b6b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyStatistics"); err != nil { - return fmt.Errorf("unable to decode storyStatistics#46448b6b: %w", err) - } - case "story_interaction_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_interaction_graph: %w", err) - } - s.StoryInteractionGraph = value - case "story_reaction_graph": - value, err := DecodeTDLibJSONStatisticalGraph(b) - if err != nil { - return fmt.Errorf("unable to decode storyStatistics#46448b6b: field story_reaction_graph: %w", err) - } - s.StoryReactionGraph = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStoryInteractionGraph returns value of StoryInteractionGraph field. -func (s *StoryStatistics) GetStoryInteractionGraph() (value StatisticalGraphClass) { - if s == nil { - return - } - return s.StoryInteractionGraph -} - -// GetStoryReactionGraph returns value of StoryReactionGraph field. -func (s *StoryStatistics) GetStoryReactionGraph() (value StatisticalGraphClass) { - if s == nil { - return - } - return s.StoryReactionGraph -} diff --git a/tdapi/tl_story_video_gen.go b/tdapi/tl_story_video_gen.go deleted file mode 100644 index 14ef9163c..000000000 --- a/tdapi/tl_story_video_gen.go +++ /dev/null @@ -1,500 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// StoryVideo represents TL type `storyVideo#562b0a45`. -type StoryVideo struct { - // Duration of the video, in seconds - Duration float64 - // Video width - Width int32 - // Video height - Height int32 - // True, if stickers were added to the video. The list of corresponding sticker sets can - // be received using getAttachedStickerSets - HasStickers bool - // True, if the video has no sound - IsAnimation bool - // Video minithumbnail; may be null - Minithumbnail Minithumbnail - // Video thumbnail in JPEG or MPEG4 format; may be null - Thumbnail Thumbnail - // Size of file prefix, which is expected to be preloaded, in bytes - PreloadPrefixSize int32 - // Timestamp of the frame used as video thumbnail - CoverFrameTimestamp float64 - // File containing the video - Video File -} - -// StoryVideoTypeID is TL type id of StoryVideo. -const StoryVideoTypeID = 0x562b0a45 - -// Ensuring interfaces in compile-time for StoryVideo. -var ( - _ bin.Encoder = &StoryVideo{} - _ bin.Decoder = &StoryVideo{} - _ bin.BareEncoder = &StoryVideo{} - _ bin.BareDecoder = &StoryVideo{} -) - -func (s *StoryVideo) Zero() bool { - if s == nil { - return true - } - if !(s.Duration == 0) { - return false - } - if !(s.Width == 0) { - return false - } - if !(s.Height == 0) { - return false - } - if !(s.HasStickers == false) { - return false - } - if !(s.IsAnimation == false) { - return false - } - if !(s.Minithumbnail.Zero()) { - return false - } - if !(s.Thumbnail.Zero()) { - return false - } - if !(s.PreloadPrefixSize == 0) { - return false - } - if !(s.CoverFrameTimestamp == 0) { - return false - } - if !(s.Video.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *StoryVideo) String() string { - if s == nil { - return "StoryVideo(nil)" - } - type Alias StoryVideo - return fmt.Sprintf("StoryVideo%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*StoryVideo) TypeID() uint32 { - return StoryVideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*StoryVideo) TypeName() string { - return "storyVideo" -} - -// TypeInfo returns info about TL type. -func (s *StoryVideo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "storyVideo", - ID: StoryVideoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "HasStickers", - SchemaName: "has_stickers", - }, - { - Name: "IsAnimation", - SchemaName: "is_animation", - }, - { - Name: "Minithumbnail", - SchemaName: "minithumbnail", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "PreloadPrefixSize", - SchemaName: "preload_prefix_size", - }, - { - Name: "CoverFrameTimestamp", - SchemaName: "cover_frame_timestamp", - }, - { - Name: "Video", - SchemaName: "video", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *StoryVideo) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyVideo#562b0a45 as nil") - } - b.PutID(StoryVideoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *StoryVideo) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode storyVideo#562b0a45 as nil") - } - b.PutDouble(s.Duration) - b.PutInt32(s.Width) - b.PutInt32(s.Height) - b.PutBool(s.HasStickers) - b.PutBool(s.IsAnimation) - if err := s.Minithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#562b0a45: field minithumbnail: %w", err) - } - if err := s.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#562b0a45: field thumbnail: %w", err) - } - b.PutInt32(s.PreloadPrefixSize) - b.PutDouble(s.CoverFrameTimestamp) - if err := s.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#562b0a45: field video: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *StoryVideo) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyVideo#562b0a45 to nil") - } - if err := b.ConsumeID(StoryVideoTypeID); err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *StoryVideo) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode storyVideo#562b0a45 to nil") - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field duration: %w", err) - } - s.Duration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field width: %w", err) - } - s.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field height: %w", err) - } - s.Height = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field has_stickers: %w", err) - } - s.HasStickers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field is_animation: %w", err) - } - s.IsAnimation = value - } - { - if err := s.Minithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field minithumbnail: %w", err) - } - } - { - if err := s.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field thumbnail: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field preload_prefix_size: %w", err) - } - s.PreloadPrefixSize = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field cover_frame_timestamp: %w", err) - } - s.CoverFrameTimestamp = value - } - { - if err := s.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field video: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *StoryVideo) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode storyVideo#562b0a45 as nil") - } - b.ObjStart() - b.PutID("storyVideo") - b.Comma() - b.FieldStart("duration") - b.PutDouble(s.Duration) - b.Comma() - b.FieldStart("width") - b.PutInt32(s.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(s.Height) - b.Comma() - b.FieldStart("has_stickers") - b.PutBool(s.HasStickers) - b.Comma() - b.FieldStart("is_animation") - b.PutBool(s.IsAnimation) - b.Comma() - b.FieldStart("minithumbnail") - if err := s.Minithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#562b0a45: field minithumbnail: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := s.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#562b0a45: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("preload_prefix_size") - b.PutInt32(s.PreloadPrefixSize) - b.Comma() - b.FieldStart("cover_frame_timestamp") - b.PutDouble(s.CoverFrameTimestamp) - b.Comma() - b.FieldStart("video") - if err := s.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode storyVideo#562b0a45: field video: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *StoryVideo) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode storyVideo#562b0a45 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("storyVideo"); err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: %w", err) - } - case "duration": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field duration: %w", err) - } - s.Duration = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field width: %w", err) - } - s.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field height: %w", err) - } - s.Height = value - case "has_stickers": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field has_stickers: %w", err) - } - s.HasStickers = value - case "is_animation": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field is_animation: %w", err) - } - s.IsAnimation = value - case "minithumbnail": - if err := s.Minithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field minithumbnail: %w", err) - } - case "thumbnail": - if err := s.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field thumbnail: %w", err) - } - case "preload_prefix_size": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field preload_prefix_size: %w", err) - } - s.PreloadPrefixSize = value - case "cover_frame_timestamp": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field cover_frame_timestamp: %w", err) - } - s.CoverFrameTimestamp = value - case "video": - if err := s.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode storyVideo#562b0a45: field video: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDuration returns value of Duration field. -func (s *StoryVideo) GetDuration() (value float64) { - if s == nil { - return - } - return s.Duration -} - -// GetWidth returns value of Width field. -func (s *StoryVideo) GetWidth() (value int32) { - if s == nil { - return - } - return s.Width -} - -// GetHeight returns value of Height field. -func (s *StoryVideo) GetHeight() (value int32) { - if s == nil { - return - } - return s.Height -} - -// GetHasStickers returns value of HasStickers field. -func (s *StoryVideo) GetHasStickers() (value bool) { - if s == nil { - return - } - return s.HasStickers -} - -// GetIsAnimation returns value of IsAnimation field. -func (s *StoryVideo) GetIsAnimation() (value bool) { - if s == nil { - return - } - return s.IsAnimation -} - -// GetMinithumbnail returns value of Minithumbnail field. -func (s *StoryVideo) GetMinithumbnail() (value Minithumbnail) { - if s == nil { - return - } - return s.Minithumbnail -} - -// GetThumbnail returns value of Thumbnail field. -func (s *StoryVideo) GetThumbnail() (value Thumbnail) { - if s == nil { - return - } - return s.Thumbnail -} - -// GetPreloadPrefixSize returns value of PreloadPrefixSize field. -func (s *StoryVideo) GetPreloadPrefixSize() (value int32) { - if s == nil { - return - } - return s.PreloadPrefixSize -} - -// GetCoverFrameTimestamp returns value of CoverFrameTimestamp field. -func (s *StoryVideo) GetCoverFrameTimestamp() (value float64) { - if s == nil { - return - } - return s.CoverFrameTimestamp -} - -// GetVideo returns value of Video field. -func (s *StoryVideo) GetVideo() (value File) { - if s == nil { - return - } - return s.Video -} diff --git a/tdapi/tl_string_gen.go b/tdapi/tl_string_gen.go deleted file mode 100644 index a6ec3bbbe..000000000 --- a/tdapi/tl_string_gen.go +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// String represents TL type `string#b5286e24`. -type String struct { -} - -// StringTypeID is TL type id of String. -const StringTypeID = 0xb5286e24 - -// Ensuring interfaces in compile-time for String. -var ( - _ bin.Encoder = &String{} - _ bin.Decoder = &String{} - _ bin.BareEncoder = &String{} - _ bin.BareDecoder = &String{} -) - -func (s *String) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *String) String() string { - if s == nil { - return "String(nil)" - } - type Alias String - return fmt.Sprintf("String%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*String) TypeID() uint32 { - return StringTypeID -} - -// TypeName returns name of type in TL schema. -func (*String) TypeName() string { - return "string" -} - -// TypeInfo returns info about TL type. -func (s *String) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "string", - ID: StringTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *String) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode string#b5286e24 as nil") - } - b.PutID(StringTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *String) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode string#b5286e24 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *String) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode string#b5286e24 to nil") - } - if err := b.ConsumeID(StringTypeID); err != nil { - return fmt.Errorf("unable to decode string#b5286e24: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *String) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode string#b5286e24 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *String) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode string#b5286e24 as nil") - } - b.ObjStart() - b.PutID("string") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *String) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode string#b5286e24 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("string"); err != nil { - return fmt.Errorf("unable to decode string#b5286e24: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} diff --git a/tdapi/tl_suggest_user_profile_photo_gen.go b/tdapi/tl_suggest_user_profile_photo_gen.go deleted file mode 100644 index e69e67e79..000000000 --- a/tdapi/tl_suggest_user_profile_photo_gen.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SuggestUserProfilePhotoRequest represents TL type `suggestUserProfilePhoto#9561f463`. -type SuggestUserProfilePhotoRequest struct { - // User identifier - UserID int64 - // Profile photo to suggest; inputChatPhotoPrevious isn't supported in this function - Photo InputChatPhotoClass -} - -// SuggestUserProfilePhotoRequestTypeID is TL type id of SuggestUserProfilePhotoRequest. -const SuggestUserProfilePhotoRequestTypeID = 0x9561f463 - -// Ensuring interfaces in compile-time for SuggestUserProfilePhotoRequest. -var ( - _ bin.Encoder = &SuggestUserProfilePhotoRequest{} - _ bin.Decoder = &SuggestUserProfilePhotoRequest{} - _ bin.BareEncoder = &SuggestUserProfilePhotoRequest{} - _ bin.BareDecoder = &SuggestUserProfilePhotoRequest{} -) - -func (s *SuggestUserProfilePhotoRequest) Zero() bool { - if s == nil { - return true - } - if !(s.UserID == 0) { - return false - } - if !(s.Photo == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestUserProfilePhotoRequest) String() string { - if s == nil { - return "SuggestUserProfilePhotoRequest(nil)" - } - type Alias SuggestUserProfilePhotoRequest - return fmt.Sprintf("SuggestUserProfilePhotoRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestUserProfilePhotoRequest) TypeID() uint32 { - return SuggestUserProfilePhotoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestUserProfilePhotoRequest) TypeName() string { - return "suggestUserProfilePhoto" -} - -// TypeInfo returns info about TL type. -func (s *SuggestUserProfilePhotoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestUserProfilePhoto", - ID: SuggestUserProfilePhotoRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestUserProfilePhotoRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestUserProfilePhoto#9561f463 as nil") - } - b.PutID(SuggestUserProfilePhotoRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestUserProfilePhotoRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestUserProfilePhoto#9561f463 as nil") - } - b.PutInt53(s.UserID) - if s.Photo == nil { - return fmt.Errorf("unable to encode suggestUserProfilePhoto#9561f463: field photo is nil") - } - if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode suggestUserProfilePhoto#9561f463: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestUserProfilePhotoRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestUserProfilePhoto#9561f463 to nil") - } - if err := b.ConsumeID(SuggestUserProfilePhotoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode suggestUserProfilePhoto#9561f463: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestUserProfilePhotoRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestUserProfilePhoto#9561f463 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode suggestUserProfilePhoto#9561f463: field user_id: %w", err) - } - s.UserID = value - } - { - value, err := DecodeInputChatPhoto(b) - if err != nil { - return fmt.Errorf("unable to decode suggestUserProfilePhoto#9561f463: field photo: %w", err) - } - s.Photo = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestUserProfilePhotoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestUserProfilePhoto#9561f463 as nil") - } - b.ObjStart() - b.PutID("suggestUserProfilePhoto") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(s.UserID) - b.Comma() - b.FieldStart("photo") - if s.Photo == nil { - return fmt.Errorf("unable to encode suggestUserProfilePhoto#9561f463: field photo is nil") - } - if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode suggestUserProfilePhoto#9561f463: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestUserProfilePhotoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestUserProfilePhoto#9561f463 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestUserProfilePhoto"); err != nil { - return fmt.Errorf("unable to decode suggestUserProfilePhoto#9561f463: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode suggestUserProfilePhoto#9561f463: field user_id: %w", err) - } - s.UserID = value - case "photo": - value, err := DecodeTDLibJSONInputChatPhoto(b) - if err != nil { - return fmt.Errorf("unable to decode suggestUserProfilePhoto#9561f463: field photo: %w", err) - } - s.Photo = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (s *SuggestUserProfilePhotoRequest) GetUserID() (value int64) { - if s == nil { - return - } - return s.UserID -} - -// GetPhoto returns value of Photo field. -func (s *SuggestUserProfilePhotoRequest) GetPhoto() (value InputChatPhotoClass) { - if s == nil { - return - } - return s.Photo -} - -// SuggestUserProfilePhoto invokes method suggestUserProfilePhoto#9561f463 returning error if any. -func (c *Client) SuggestUserProfilePhoto(ctx context.Context, request *SuggestUserProfilePhotoRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_suggested_action_gen.go b/tdapi/tl_suggested_action_gen.go deleted file mode 100644 index 59815ff99..000000000 --- a/tdapi/tl_suggested_action_gen.go +++ /dev/null @@ -1,2289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SuggestedActionEnableArchiveAndMuteNewChats represents TL type `suggestedActionEnableArchiveAndMuteNewChats#7841ec4f`. -type SuggestedActionEnableArchiveAndMuteNewChats struct { -} - -// SuggestedActionEnableArchiveAndMuteNewChatsTypeID is TL type id of SuggestedActionEnableArchiveAndMuteNewChats. -const SuggestedActionEnableArchiveAndMuteNewChatsTypeID = 0x7841ec4f - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionEnableArchiveAndMuteNewChats) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionEnableArchiveAndMuteNewChats. -var ( - _ bin.Encoder = &SuggestedActionEnableArchiveAndMuteNewChats{} - _ bin.Decoder = &SuggestedActionEnableArchiveAndMuteNewChats{} - _ bin.BareEncoder = &SuggestedActionEnableArchiveAndMuteNewChats{} - _ bin.BareDecoder = &SuggestedActionEnableArchiveAndMuteNewChats{} - - _ SuggestedActionClass = &SuggestedActionEnableArchiveAndMuteNewChats{} -) - -func (s *SuggestedActionEnableArchiveAndMuteNewChats) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionEnableArchiveAndMuteNewChats) String() string { - if s == nil { - return "SuggestedActionEnableArchiveAndMuteNewChats(nil)" - } - type Alias SuggestedActionEnableArchiveAndMuteNewChats - return fmt.Sprintf("SuggestedActionEnableArchiveAndMuteNewChats%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionEnableArchiveAndMuteNewChats) TypeID() uint32 { - return SuggestedActionEnableArchiveAndMuteNewChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionEnableArchiveAndMuteNewChats) TypeName() string { - return "suggestedActionEnableArchiveAndMuteNewChats" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionEnableArchiveAndMuteNewChats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionEnableArchiveAndMuteNewChats", - ID: SuggestedActionEnableArchiveAndMuteNewChatsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionEnableArchiveAndMuteNewChats) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f as nil") - } - b.PutID(SuggestedActionEnableArchiveAndMuteNewChatsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionEnableArchiveAndMuteNewChats) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionEnableArchiveAndMuteNewChats) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f to nil") - } - if err := b.ConsumeID(SuggestedActionEnableArchiveAndMuteNewChatsTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionEnableArchiveAndMuteNewChats) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionEnableArchiveAndMuteNewChats) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f as nil") - } - b.ObjStart() - b.PutID("suggestedActionEnableArchiveAndMuteNewChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionEnableArchiveAndMuteNewChats) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionEnableArchiveAndMuteNewChats"); err != nil { - return fmt.Errorf("unable to decode suggestedActionEnableArchiveAndMuteNewChats#7841ec4f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SuggestedActionCheckPassword represents TL type `suggestedActionCheckPassword#71e072b7`. -type SuggestedActionCheckPassword struct { -} - -// SuggestedActionCheckPasswordTypeID is TL type id of SuggestedActionCheckPassword. -const SuggestedActionCheckPasswordTypeID = 0x71e072b7 - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionCheckPassword) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionCheckPassword. -var ( - _ bin.Encoder = &SuggestedActionCheckPassword{} - _ bin.Decoder = &SuggestedActionCheckPassword{} - _ bin.BareEncoder = &SuggestedActionCheckPassword{} - _ bin.BareDecoder = &SuggestedActionCheckPassword{} - - _ SuggestedActionClass = &SuggestedActionCheckPassword{} -) - -func (s *SuggestedActionCheckPassword) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionCheckPassword) String() string { - if s == nil { - return "SuggestedActionCheckPassword(nil)" - } - type Alias SuggestedActionCheckPassword - return fmt.Sprintf("SuggestedActionCheckPassword%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionCheckPassword) TypeID() uint32 { - return SuggestedActionCheckPasswordTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionCheckPassword) TypeName() string { - return "suggestedActionCheckPassword" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionCheckPassword) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionCheckPassword", - ID: SuggestedActionCheckPasswordTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionCheckPassword) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionCheckPassword#71e072b7 as nil") - } - b.PutID(SuggestedActionCheckPasswordTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionCheckPassword) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionCheckPassword#71e072b7 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionCheckPassword) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionCheckPassword#71e072b7 to nil") - } - if err := b.ConsumeID(SuggestedActionCheckPasswordTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionCheckPassword#71e072b7: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionCheckPassword) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionCheckPassword#71e072b7 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionCheckPassword) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionCheckPassword#71e072b7 as nil") - } - b.ObjStart() - b.PutID("suggestedActionCheckPassword") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionCheckPassword) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionCheckPassword#71e072b7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionCheckPassword"); err != nil { - return fmt.Errorf("unable to decode suggestedActionCheckPassword#71e072b7: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SuggestedActionCheckPhoneNumber represents TL type `suggestedActionCheckPhoneNumber#26ab77eb`. -type SuggestedActionCheckPhoneNumber struct { -} - -// SuggestedActionCheckPhoneNumberTypeID is TL type id of SuggestedActionCheckPhoneNumber. -const SuggestedActionCheckPhoneNumberTypeID = 0x26ab77eb - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionCheckPhoneNumber) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionCheckPhoneNumber. -var ( - _ bin.Encoder = &SuggestedActionCheckPhoneNumber{} - _ bin.Decoder = &SuggestedActionCheckPhoneNumber{} - _ bin.BareEncoder = &SuggestedActionCheckPhoneNumber{} - _ bin.BareDecoder = &SuggestedActionCheckPhoneNumber{} - - _ SuggestedActionClass = &SuggestedActionCheckPhoneNumber{} -) - -func (s *SuggestedActionCheckPhoneNumber) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionCheckPhoneNumber) String() string { - if s == nil { - return "SuggestedActionCheckPhoneNumber(nil)" - } - type Alias SuggestedActionCheckPhoneNumber - return fmt.Sprintf("SuggestedActionCheckPhoneNumber%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionCheckPhoneNumber) TypeID() uint32 { - return SuggestedActionCheckPhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionCheckPhoneNumber) TypeName() string { - return "suggestedActionCheckPhoneNumber" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionCheckPhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionCheckPhoneNumber", - ID: SuggestedActionCheckPhoneNumberTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionCheckPhoneNumber) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionCheckPhoneNumber#26ab77eb as nil") - } - b.PutID(SuggestedActionCheckPhoneNumberTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionCheckPhoneNumber) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionCheckPhoneNumber#26ab77eb as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionCheckPhoneNumber) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionCheckPhoneNumber#26ab77eb to nil") - } - if err := b.ConsumeID(SuggestedActionCheckPhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionCheckPhoneNumber#26ab77eb: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionCheckPhoneNumber) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionCheckPhoneNumber#26ab77eb to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionCheckPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionCheckPhoneNumber#26ab77eb as nil") - } - b.ObjStart() - b.PutID("suggestedActionCheckPhoneNumber") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionCheckPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionCheckPhoneNumber#26ab77eb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionCheckPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode suggestedActionCheckPhoneNumber#26ab77eb: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SuggestedActionViewChecksHint represents TL type `suggestedActionViewChecksHint#35203547`. -type SuggestedActionViewChecksHint struct { -} - -// SuggestedActionViewChecksHintTypeID is TL type id of SuggestedActionViewChecksHint. -const SuggestedActionViewChecksHintTypeID = 0x35203547 - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionViewChecksHint) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionViewChecksHint. -var ( - _ bin.Encoder = &SuggestedActionViewChecksHint{} - _ bin.Decoder = &SuggestedActionViewChecksHint{} - _ bin.BareEncoder = &SuggestedActionViewChecksHint{} - _ bin.BareDecoder = &SuggestedActionViewChecksHint{} - - _ SuggestedActionClass = &SuggestedActionViewChecksHint{} -) - -func (s *SuggestedActionViewChecksHint) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionViewChecksHint) String() string { - if s == nil { - return "SuggestedActionViewChecksHint(nil)" - } - type Alias SuggestedActionViewChecksHint - return fmt.Sprintf("SuggestedActionViewChecksHint%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionViewChecksHint) TypeID() uint32 { - return SuggestedActionViewChecksHintTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionViewChecksHint) TypeName() string { - return "suggestedActionViewChecksHint" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionViewChecksHint) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionViewChecksHint", - ID: SuggestedActionViewChecksHintTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionViewChecksHint) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionViewChecksHint#35203547 as nil") - } - b.PutID(SuggestedActionViewChecksHintTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionViewChecksHint) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionViewChecksHint#35203547 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionViewChecksHint) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionViewChecksHint#35203547 to nil") - } - if err := b.ConsumeID(SuggestedActionViewChecksHintTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionViewChecksHint#35203547: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionViewChecksHint) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionViewChecksHint#35203547 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionViewChecksHint) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionViewChecksHint#35203547 as nil") - } - b.ObjStart() - b.PutID("suggestedActionViewChecksHint") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionViewChecksHint) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionViewChecksHint#35203547 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionViewChecksHint"); err != nil { - return fmt.Errorf("unable to decode suggestedActionViewChecksHint#35203547: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SuggestedActionConvertToBroadcastGroup represents TL type `suggestedActionConvertToBroadcastGroup#c67a2e38`. -type SuggestedActionConvertToBroadcastGroup struct { - // Supergroup identifier - SupergroupID int64 -} - -// SuggestedActionConvertToBroadcastGroupTypeID is TL type id of SuggestedActionConvertToBroadcastGroup. -const SuggestedActionConvertToBroadcastGroupTypeID = 0xc67a2e38 - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionConvertToBroadcastGroup) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionConvertToBroadcastGroup. -var ( - _ bin.Encoder = &SuggestedActionConvertToBroadcastGroup{} - _ bin.Decoder = &SuggestedActionConvertToBroadcastGroup{} - _ bin.BareEncoder = &SuggestedActionConvertToBroadcastGroup{} - _ bin.BareDecoder = &SuggestedActionConvertToBroadcastGroup{} - - _ SuggestedActionClass = &SuggestedActionConvertToBroadcastGroup{} -) - -func (s *SuggestedActionConvertToBroadcastGroup) Zero() bool { - if s == nil { - return true - } - if !(s.SupergroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionConvertToBroadcastGroup) String() string { - if s == nil { - return "SuggestedActionConvertToBroadcastGroup(nil)" - } - type Alias SuggestedActionConvertToBroadcastGroup - return fmt.Sprintf("SuggestedActionConvertToBroadcastGroup%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionConvertToBroadcastGroup) TypeID() uint32 { - return SuggestedActionConvertToBroadcastGroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionConvertToBroadcastGroup) TypeName() string { - return "suggestedActionConvertToBroadcastGroup" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionConvertToBroadcastGroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionConvertToBroadcastGroup", - ID: SuggestedActionConvertToBroadcastGroupTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionConvertToBroadcastGroup) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionConvertToBroadcastGroup#c67a2e38 as nil") - } - b.PutID(SuggestedActionConvertToBroadcastGroupTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionConvertToBroadcastGroup) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionConvertToBroadcastGroup#c67a2e38 as nil") - } - b.PutInt53(s.SupergroupID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionConvertToBroadcastGroup) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionConvertToBroadcastGroup#c67a2e38 to nil") - } - if err := b.ConsumeID(SuggestedActionConvertToBroadcastGroupTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionConvertToBroadcastGroup#c67a2e38: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionConvertToBroadcastGroup) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionConvertToBroadcastGroup#c67a2e38 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode suggestedActionConvertToBroadcastGroup#c67a2e38: field supergroup_id: %w", err) - } - s.SupergroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionConvertToBroadcastGroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionConvertToBroadcastGroup#c67a2e38 as nil") - } - b.ObjStart() - b.PutID("suggestedActionConvertToBroadcastGroup") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(s.SupergroupID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionConvertToBroadcastGroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionConvertToBroadcastGroup#c67a2e38 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionConvertToBroadcastGroup"); err != nil { - return fmt.Errorf("unable to decode suggestedActionConvertToBroadcastGroup#c67a2e38: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode suggestedActionConvertToBroadcastGroup#c67a2e38: field supergroup_id: %w", err) - } - s.SupergroupID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (s *SuggestedActionConvertToBroadcastGroup) GetSupergroupID() (value int64) { - if s == nil { - return - } - return s.SupergroupID -} - -// SuggestedActionSetPassword represents TL type `suggestedActionSetPassword#6f147d98`. -type SuggestedActionSetPassword struct { - // The number of days to pass between consecutive authorizations if the user declines to - // set password; if 0, then the user is advised to set the password for security reasons - AuthorizationDelay int32 -} - -// SuggestedActionSetPasswordTypeID is TL type id of SuggestedActionSetPassword. -const SuggestedActionSetPasswordTypeID = 0x6f147d98 - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionSetPassword) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionSetPassword. -var ( - _ bin.Encoder = &SuggestedActionSetPassword{} - _ bin.Decoder = &SuggestedActionSetPassword{} - _ bin.BareEncoder = &SuggestedActionSetPassword{} - _ bin.BareDecoder = &SuggestedActionSetPassword{} - - _ SuggestedActionClass = &SuggestedActionSetPassword{} -) - -func (s *SuggestedActionSetPassword) Zero() bool { - if s == nil { - return true - } - if !(s.AuthorizationDelay == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionSetPassword) String() string { - if s == nil { - return "SuggestedActionSetPassword(nil)" - } - type Alias SuggestedActionSetPassword - return fmt.Sprintf("SuggestedActionSetPassword%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionSetPassword) TypeID() uint32 { - return SuggestedActionSetPasswordTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionSetPassword) TypeName() string { - return "suggestedActionSetPassword" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionSetPassword) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionSetPassword", - ID: SuggestedActionSetPasswordTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AuthorizationDelay", - SchemaName: "authorization_delay", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionSetPassword) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSetPassword#6f147d98 as nil") - } - b.PutID(SuggestedActionSetPasswordTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionSetPassword) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSetPassword#6f147d98 as nil") - } - b.PutInt32(s.AuthorizationDelay) - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionSetPassword) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSetPassword#6f147d98 to nil") - } - if err := b.ConsumeID(SuggestedActionSetPasswordTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionSetPassword#6f147d98: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionSetPassword) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSetPassword#6f147d98 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode suggestedActionSetPassword#6f147d98: field authorization_delay: %w", err) - } - s.AuthorizationDelay = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionSetPassword) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSetPassword#6f147d98 as nil") - } - b.ObjStart() - b.PutID("suggestedActionSetPassword") - b.Comma() - b.FieldStart("authorization_delay") - b.PutInt32(s.AuthorizationDelay) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionSetPassword) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSetPassword#6f147d98 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionSetPassword"); err != nil { - return fmt.Errorf("unable to decode suggestedActionSetPassword#6f147d98: %w", err) - } - case "authorization_delay": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode suggestedActionSetPassword#6f147d98: field authorization_delay: %w", err) - } - s.AuthorizationDelay = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAuthorizationDelay returns value of AuthorizationDelay field. -func (s *SuggestedActionSetPassword) GetAuthorizationDelay() (value int32) { - if s == nil { - return - } - return s.AuthorizationDelay -} - -// SuggestedActionUpgradePremium represents TL type `suggestedActionUpgradePremium#70aa79fb`. -type SuggestedActionUpgradePremium struct { -} - -// SuggestedActionUpgradePremiumTypeID is TL type id of SuggestedActionUpgradePremium. -const SuggestedActionUpgradePremiumTypeID = 0x70aa79fb - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionUpgradePremium) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionUpgradePremium. -var ( - _ bin.Encoder = &SuggestedActionUpgradePremium{} - _ bin.Decoder = &SuggestedActionUpgradePremium{} - _ bin.BareEncoder = &SuggestedActionUpgradePremium{} - _ bin.BareDecoder = &SuggestedActionUpgradePremium{} - - _ SuggestedActionClass = &SuggestedActionUpgradePremium{} -) - -func (s *SuggestedActionUpgradePremium) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionUpgradePremium) String() string { - if s == nil { - return "SuggestedActionUpgradePremium(nil)" - } - type Alias SuggestedActionUpgradePremium - return fmt.Sprintf("SuggestedActionUpgradePremium%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionUpgradePremium) TypeID() uint32 { - return SuggestedActionUpgradePremiumTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionUpgradePremium) TypeName() string { - return "suggestedActionUpgradePremium" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionUpgradePremium) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionUpgradePremium", - ID: SuggestedActionUpgradePremiumTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionUpgradePremium) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionUpgradePremium#70aa79fb as nil") - } - b.PutID(SuggestedActionUpgradePremiumTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionUpgradePremium) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionUpgradePremium#70aa79fb as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionUpgradePremium) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionUpgradePremium#70aa79fb to nil") - } - if err := b.ConsumeID(SuggestedActionUpgradePremiumTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionUpgradePremium#70aa79fb: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionUpgradePremium) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionUpgradePremium#70aa79fb to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionUpgradePremium) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionUpgradePremium#70aa79fb as nil") - } - b.ObjStart() - b.PutID("suggestedActionUpgradePremium") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionUpgradePremium) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionUpgradePremium#70aa79fb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionUpgradePremium"); err != nil { - return fmt.Errorf("unable to decode suggestedActionUpgradePremium#70aa79fb: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SuggestedActionRestorePremium represents TL type `suggestedActionRestorePremium#e909dd64`. -type SuggestedActionRestorePremium struct { -} - -// SuggestedActionRestorePremiumTypeID is TL type id of SuggestedActionRestorePremium. -const SuggestedActionRestorePremiumTypeID = 0xe909dd64 - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionRestorePremium) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionRestorePremium. -var ( - _ bin.Encoder = &SuggestedActionRestorePremium{} - _ bin.Decoder = &SuggestedActionRestorePremium{} - _ bin.BareEncoder = &SuggestedActionRestorePremium{} - _ bin.BareDecoder = &SuggestedActionRestorePremium{} - - _ SuggestedActionClass = &SuggestedActionRestorePremium{} -) - -func (s *SuggestedActionRestorePremium) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionRestorePremium) String() string { - if s == nil { - return "SuggestedActionRestorePremium(nil)" - } - type Alias SuggestedActionRestorePremium - return fmt.Sprintf("SuggestedActionRestorePremium%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionRestorePremium) TypeID() uint32 { - return SuggestedActionRestorePremiumTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionRestorePremium) TypeName() string { - return "suggestedActionRestorePremium" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionRestorePremium) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionRestorePremium", - ID: SuggestedActionRestorePremiumTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionRestorePremium) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionRestorePremium#e909dd64 as nil") - } - b.PutID(SuggestedActionRestorePremiumTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionRestorePremium) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionRestorePremium#e909dd64 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionRestorePremium) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionRestorePremium#e909dd64 to nil") - } - if err := b.ConsumeID(SuggestedActionRestorePremiumTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionRestorePremium#e909dd64: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionRestorePremium) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionRestorePremium#e909dd64 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionRestorePremium) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionRestorePremium#e909dd64 as nil") - } - b.ObjStart() - b.PutID("suggestedActionRestorePremium") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionRestorePremium) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionRestorePremium#e909dd64 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionRestorePremium"); err != nil { - return fmt.Errorf("unable to decode suggestedActionRestorePremium#e909dd64: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SuggestedActionSubscribeToAnnualPremium represents TL type `suggestedActionSubscribeToAnnualPremium#164978bb`. -type SuggestedActionSubscribeToAnnualPremium struct { -} - -// SuggestedActionSubscribeToAnnualPremiumTypeID is TL type id of SuggestedActionSubscribeToAnnualPremium. -const SuggestedActionSubscribeToAnnualPremiumTypeID = 0x164978bb - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionSubscribeToAnnualPremium) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionSubscribeToAnnualPremium. -var ( - _ bin.Encoder = &SuggestedActionSubscribeToAnnualPremium{} - _ bin.Decoder = &SuggestedActionSubscribeToAnnualPremium{} - _ bin.BareEncoder = &SuggestedActionSubscribeToAnnualPremium{} - _ bin.BareDecoder = &SuggestedActionSubscribeToAnnualPremium{} - - _ SuggestedActionClass = &SuggestedActionSubscribeToAnnualPremium{} -) - -func (s *SuggestedActionSubscribeToAnnualPremium) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionSubscribeToAnnualPremium) String() string { - if s == nil { - return "SuggestedActionSubscribeToAnnualPremium(nil)" - } - type Alias SuggestedActionSubscribeToAnnualPremium - return fmt.Sprintf("SuggestedActionSubscribeToAnnualPremium%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionSubscribeToAnnualPremium) TypeID() uint32 { - return SuggestedActionSubscribeToAnnualPremiumTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionSubscribeToAnnualPremium) TypeName() string { - return "suggestedActionSubscribeToAnnualPremium" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionSubscribeToAnnualPremium) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionSubscribeToAnnualPremium", - ID: SuggestedActionSubscribeToAnnualPremiumTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionSubscribeToAnnualPremium) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSubscribeToAnnualPremium#164978bb as nil") - } - b.PutID(SuggestedActionSubscribeToAnnualPremiumTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionSubscribeToAnnualPremium) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSubscribeToAnnualPremium#164978bb as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionSubscribeToAnnualPremium) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSubscribeToAnnualPremium#164978bb to nil") - } - if err := b.ConsumeID(SuggestedActionSubscribeToAnnualPremiumTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionSubscribeToAnnualPremium#164978bb: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionSubscribeToAnnualPremium) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSubscribeToAnnualPremium#164978bb to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionSubscribeToAnnualPremium) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSubscribeToAnnualPremium#164978bb as nil") - } - b.ObjStart() - b.PutID("suggestedActionSubscribeToAnnualPremium") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionSubscribeToAnnualPremium) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSubscribeToAnnualPremium#164978bb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionSubscribeToAnnualPremium"); err != nil { - return fmt.Errorf("unable to decode suggestedActionSubscribeToAnnualPremium#164978bb: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SuggestedActionGiftPremiumForChristmas represents TL type `suggestedActionGiftPremiumForChristmas#93b3ee6f`. -type SuggestedActionGiftPremiumForChristmas struct { -} - -// SuggestedActionGiftPremiumForChristmasTypeID is TL type id of SuggestedActionGiftPremiumForChristmas. -const SuggestedActionGiftPremiumForChristmasTypeID = 0x93b3ee6f - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionGiftPremiumForChristmas) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionGiftPremiumForChristmas. -var ( - _ bin.Encoder = &SuggestedActionGiftPremiumForChristmas{} - _ bin.Decoder = &SuggestedActionGiftPremiumForChristmas{} - _ bin.BareEncoder = &SuggestedActionGiftPremiumForChristmas{} - _ bin.BareDecoder = &SuggestedActionGiftPremiumForChristmas{} - - _ SuggestedActionClass = &SuggestedActionGiftPremiumForChristmas{} -) - -func (s *SuggestedActionGiftPremiumForChristmas) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionGiftPremiumForChristmas) String() string { - if s == nil { - return "SuggestedActionGiftPremiumForChristmas(nil)" - } - type Alias SuggestedActionGiftPremiumForChristmas - return fmt.Sprintf("SuggestedActionGiftPremiumForChristmas%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionGiftPremiumForChristmas) TypeID() uint32 { - return SuggestedActionGiftPremiumForChristmasTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionGiftPremiumForChristmas) TypeName() string { - return "suggestedActionGiftPremiumForChristmas" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionGiftPremiumForChristmas) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionGiftPremiumForChristmas", - ID: SuggestedActionGiftPremiumForChristmasTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionGiftPremiumForChristmas) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionGiftPremiumForChristmas#93b3ee6f as nil") - } - b.PutID(SuggestedActionGiftPremiumForChristmasTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionGiftPremiumForChristmas) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionGiftPremiumForChristmas#93b3ee6f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionGiftPremiumForChristmas) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionGiftPremiumForChristmas#93b3ee6f to nil") - } - if err := b.ConsumeID(SuggestedActionGiftPremiumForChristmasTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionGiftPremiumForChristmas#93b3ee6f: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionGiftPremiumForChristmas) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionGiftPremiumForChristmas#93b3ee6f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionGiftPremiumForChristmas) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionGiftPremiumForChristmas#93b3ee6f as nil") - } - b.ObjStart() - b.PutID("suggestedActionGiftPremiumForChristmas") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionGiftPremiumForChristmas) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionGiftPremiumForChristmas#93b3ee6f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionGiftPremiumForChristmas"); err != nil { - return fmt.Errorf("unable to decode suggestedActionGiftPremiumForChristmas#93b3ee6f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SuggestedActionSetBirthdate represents TL type `suggestedActionSetBirthdate#eabd9b02`. -type SuggestedActionSetBirthdate struct { -} - -// SuggestedActionSetBirthdateTypeID is TL type id of SuggestedActionSetBirthdate. -const SuggestedActionSetBirthdateTypeID = 0xeabd9b02 - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionSetBirthdate) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionSetBirthdate. -var ( - _ bin.Encoder = &SuggestedActionSetBirthdate{} - _ bin.Decoder = &SuggestedActionSetBirthdate{} - _ bin.BareEncoder = &SuggestedActionSetBirthdate{} - _ bin.BareDecoder = &SuggestedActionSetBirthdate{} - - _ SuggestedActionClass = &SuggestedActionSetBirthdate{} -) - -func (s *SuggestedActionSetBirthdate) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionSetBirthdate) String() string { - if s == nil { - return "SuggestedActionSetBirthdate(nil)" - } - type Alias SuggestedActionSetBirthdate - return fmt.Sprintf("SuggestedActionSetBirthdate%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionSetBirthdate) TypeID() uint32 { - return SuggestedActionSetBirthdateTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionSetBirthdate) TypeName() string { - return "suggestedActionSetBirthdate" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionSetBirthdate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionSetBirthdate", - ID: SuggestedActionSetBirthdateTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionSetBirthdate) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSetBirthdate#eabd9b02 as nil") - } - b.PutID(SuggestedActionSetBirthdateTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionSetBirthdate) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSetBirthdate#eabd9b02 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionSetBirthdate) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSetBirthdate#eabd9b02 to nil") - } - if err := b.ConsumeID(SuggestedActionSetBirthdateTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionSetBirthdate#eabd9b02: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionSetBirthdate) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSetBirthdate#eabd9b02 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionSetBirthdate) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSetBirthdate#eabd9b02 as nil") - } - b.ObjStart() - b.PutID("suggestedActionSetBirthdate") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionSetBirthdate) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSetBirthdate#eabd9b02 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionSetBirthdate"); err != nil { - return fmt.Errorf("unable to decode suggestedActionSetBirthdate#eabd9b02: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SuggestedActionSetProfilePhoto represents TL type `suggestedActionSetProfilePhoto#9fe23d6b`. -type SuggestedActionSetProfilePhoto struct { -} - -// SuggestedActionSetProfilePhotoTypeID is TL type id of SuggestedActionSetProfilePhoto. -const SuggestedActionSetProfilePhotoTypeID = 0x9fe23d6b - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionSetProfilePhoto) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionSetProfilePhoto. -var ( - _ bin.Encoder = &SuggestedActionSetProfilePhoto{} - _ bin.Decoder = &SuggestedActionSetProfilePhoto{} - _ bin.BareEncoder = &SuggestedActionSetProfilePhoto{} - _ bin.BareDecoder = &SuggestedActionSetProfilePhoto{} - - _ SuggestedActionClass = &SuggestedActionSetProfilePhoto{} -) - -func (s *SuggestedActionSetProfilePhoto) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionSetProfilePhoto) String() string { - if s == nil { - return "SuggestedActionSetProfilePhoto(nil)" - } - type Alias SuggestedActionSetProfilePhoto - return fmt.Sprintf("SuggestedActionSetProfilePhoto%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionSetProfilePhoto) TypeID() uint32 { - return SuggestedActionSetProfilePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionSetProfilePhoto) TypeName() string { - return "suggestedActionSetProfilePhoto" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionSetProfilePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionSetProfilePhoto", - ID: SuggestedActionSetProfilePhotoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionSetProfilePhoto) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSetProfilePhoto#9fe23d6b as nil") - } - b.PutID(SuggestedActionSetProfilePhotoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionSetProfilePhoto) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSetProfilePhoto#9fe23d6b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionSetProfilePhoto) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSetProfilePhoto#9fe23d6b to nil") - } - if err := b.ConsumeID(SuggestedActionSetProfilePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionSetProfilePhoto#9fe23d6b: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionSetProfilePhoto) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSetProfilePhoto#9fe23d6b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionSetProfilePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionSetProfilePhoto#9fe23d6b as nil") - } - b.ObjStart() - b.PutID("suggestedActionSetProfilePhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionSetProfilePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionSetProfilePhoto#9fe23d6b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionSetProfilePhoto"); err != nil { - return fmt.Errorf("unable to decode suggestedActionSetProfilePhoto#9fe23d6b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SuggestedActionExtendPremium represents TL type `suggestedActionExtendPremium#de405cca`. -type SuggestedActionExtendPremium struct { - // A URL for managing Telegram Premium subscription - ManagePremiumSubscriptionURL string -} - -// SuggestedActionExtendPremiumTypeID is TL type id of SuggestedActionExtendPremium. -const SuggestedActionExtendPremiumTypeID = 0xde405cca - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionExtendPremium) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionExtendPremium. -var ( - _ bin.Encoder = &SuggestedActionExtendPremium{} - _ bin.Decoder = &SuggestedActionExtendPremium{} - _ bin.BareEncoder = &SuggestedActionExtendPremium{} - _ bin.BareDecoder = &SuggestedActionExtendPremium{} - - _ SuggestedActionClass = &SuggestedActionExtendPremium{} -) - -func (s *SuggestedActionExtendPremium) Zero() bool { - if s == nil { - return true - } - if !(s.ManagePremiumSubscriptionURL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionExtendPremium) String() string { - if s == nil { - return "SuggestedActionExtendPremium(nil)" - } - type Alias SuggestedActionExtendPremium - return fmt.Sprintf("SuggestedActionExtendPremium%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionExtendPremium) TypeID() uint32 { - return SuggestedActionExtendPremiumTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionExtendPremium) TypeName() string { - return "suggestedActionExtendPremium" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionExtendPremium) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionExtendPremium", - ID: SuggestedActionExtendPremiumTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ManagePremiumSubscriptionURL", - SchemaName: "manage_premium_subscription_url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionExtendPremium) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionExtendPremium#de405cca as nil") - } - b.PutID(SuggestedActionExtendPremiumTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionExtendPremium) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionExtendPremium#de405cca as nil") - } - b.PutString(s.ManagePremiumSubscriptionURL) - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionExtendPremium) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionExtendPremium#de405cca to nil") - } - if err := b.ConsumeID(SuggestedActionExtendPremiumTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionExtendPremium) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionExtendPremium#de405cca to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: field manage_premium_subscription_url: %w", err) - } - s.ManagePremiumSubscriptionURL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionExtendPremium) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionExtendPremium#de405cca as nil") - } - b.ObjStart() - b.PutID("suggestedActionExtendPremium") - b.Comma() - b.FieldStart("manage_premium_subscription_url") - b.PutString(s.ManagePremiumSubscriptionURL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionExtendPremium) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionExtendPremium#de405cca to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionExtendPremium"); err != nil { - return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: %w", err) - } - case "manage_premium_subscription_url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode suggestedActionExtendPremium#de405cca: field manage_premium_subscription_url: %w", err) - } - s.ManagePremiumSubscriptionURL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetManagePremiumSubscriptionURL returns value of ManagePremiumSubscriptionURL field. -func (s *SuggestedActionExtendPremium) GetManagePremiumSubscriptionURL() (value string) { - if s == nil { - return - } - return s.ManagePremiumSubscriptionURL -} - -// SuggestedActionExtendStarSubscriptions represents TL type `suggestedActionExtendStarSubscriptions#fd32d556`. -type SuggestedActionExtendStarSubscriptions struct { -} - -// SuggestedActionExtendStarSubscriptionsTypeID is TL type id of SuggestedActionExtendStarSubscriptions. -const SuggestedActionExtendStarSubscriptionsTypeID = 0xfd32d556 - -// construct implements constructor of SuggestedActionClass. -func (s SuggestedActionExtendStarSubscriptions) construct() SuggestedActionClass { return &s } - -// Ensuring interfaces in compile-time for SuggestedActionExtendStarSubscriptions. -var ( - _ bin.Encoder = &SuggestedActionExtendStarSubscriptions{} - _ bin.Decoder = &SuggestedActionExtendStarSubscriptions{} - _ bin.BareEncoder = &SuggestedActionExtendStarSubscriptions{} - _ bin.BareDecoder = &SuggestedActionExtendStarSubscriptions{} - - _ SuggestedActionClass = &SuggestedActionExtendStarSubscriptions{} -) - -func (s *SuggestedActionExtendStarSubscriptions) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SuggestedActionExtendStarSubscriptions) String() string { - if s == nil { - return "SuggestedActionExtendStarSubscriptions(nil)" - } - type Alias SuggestedActionExtendStarSubscriptions - return fmt.Sprintf("SuggestedActionExtendStarSubscriptions%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SuggestedActionExtendStarSubscriptions) TypeID() uint32 { - return SuggestedActionExtendStarSubscriptionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*SuggestedActionExtendStarSubscriptions) TypeName() string { - return "suggestedActionExtendStarSubscriptions" -} - -// TypeInfo returns info about TL type. -func (s *SuggestedActionExtendStarSubscriptions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "suggestedActionExtendStarSubscriptions", - ID: SuggestedActionExtendStarSubscriptionsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SuggestedActionExtendStarSubscriptions) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionExtendStarSubscriptions#fd32d556 as nil") - } - b.PutID(SuggestedActionExtendStarSubscriptionsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SuggestedActionExtendStarSubscriptions) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionExtendStarSubscriptions#fd32d556 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SuggestedActionExtendStarSubscriptions) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionExtendStarSubscriptions#fd32d556 to nil") - } - if err := b.ConsumeID(SuggestedActionExtendStarSubscriptionsTypeID); err != nil { - return fmt.Errorf("unable to decode suggestedActionExtendStarSubscriptions#fd32d556: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SuggestedActionExtendStarSubscriptions) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionExtendStarSubscriptions#fd32d556 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SuggestedActionExtendStarSubscriptions) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode suggestedActionExtendStarSubscriptions#fd32d556 as nil") - } - b.ObjStart() - b.PutID("suggestedActionExtendStarSubscriptions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SuggestedActionExtendStarSubscriptions) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode suggestedActionExtendStarSubscriptions#fd32d556 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("suggestedActionExtendStarSubscriptions"); err != nil { - return fmt.Errorf("unable to decode suggestedActionExtendStarSubscriptions#fd32d556: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SuggestedActionClassName is schema name of SuggestedActionClass. -const SuggestedActionClassName = "SuggestedAction" - -// SuggestedActionClass represents SuggestedAction generic type. -// -// Example: -// -// g, err := tdapi.DecodeSuggestedAction(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.SuggestedActionEnableArchiveAndMuteNewChats: // suggestedActionEnableArchiveAndMuteNewChats#7841ec4f -// case *tdapi.SuggestedActionCheckPassword: // suggestedActionCheckPassword#71e072b7 -// case *tdapi.SuggestedActionCheckPhoneNumber: // suggestedActionCheckPhoneNumber#26ab77eb -// case *tdapi.SuggestedActionViewChecksHint: // suggestedActionViewChecksHint#35203547 -// case *tdapi.SuggestedActionConvertToBroadcastGroup: // suggestedActionConvertToBroadcastGroup#c67a2e38 -// case *tdapi.SuggestedActionSetPassword: // suggestedActionSetPassword#6f147d98 -// case *tdapi.SuggestedActionUpgradePremium: // suggestedActionUpgradePremium#70aa79fb -// case *tdapi.SuggestedActionRestorePremium: // suggestedActionRestorePremium#e909dd64 -// case *tdapi.SuggestedActionSubscribeToAnnualPremium: // suggestedActionSubscribeToAnnualPremium#164978bb -// case *tdapi.SuggestedActionGiftPremiumForChristmas: // suggestedActionGiftPremiumForChristmas#93b3ee6f -// case *tdapi.SuggestedActionSetBirthdate: // suggestedActionSetBirthdate#eabd9b02 -// case *tdapi.SuggestedActionSetProfilePhoto: // suggestedActionSetProfilePhoto#9fe23d6b -// case *tdapi.SuggestedActionExtendPremium: // suggestedActionExtendPremium#de405cca -// case *tdapi.SuggestedActionExtendStarSubscriptions: // suggestedActionExtendStarSubscriptions#fd32d556 -// default: panic(v) -// } -type SuggestedActionClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() SuggestedActionClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeSuggestedAction implements binary de-serialization for SuggestedActionClass. -func DecodeSuggestedAction(buf *bin.Buffer) (SuggestedActionClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case SuggestedActionEnableArchiveAndMuteNewChatsTypeID: - // Decoding suggestedActionEnableArchiveAndMuteNewChats#7841ec4f. - v := SuggestedActionEnableArchiveAndMuteNewChats{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionCheckPasswordTypeID: - // Decoding suggestedActionCheckPassword#71e072b7. - v := SuggestedActionCheckPassword{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionCheckPhoneNumberTypeID: - // Decoding suggestedActionCheckPhoneNumber#26ab77eb. - v := SuggestedActionCheckPhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionViewChecksHintTypeID: - // Decoding suggestedActionViewChecksHint#35203547. - v := SuggestedActionViewChecksHint{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionConvertToBroadcastGroupTypeID: - // Decoding suggestedActionConvertToBroadcastGroup#c67a2e38. - v := SuggestedActionConvertToBroadcastGroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionSetPasswordTypeID: - // Decoding suggestedActionSetPassword#6f147d98. - v := SuggestedActionSetPassword{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionUpgradePremiumTypeID: - // Decoding suggestedActionUpgradePremium#70aa79fb. - v := SuggestedActionUpgradePremium{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionRestorePremiumTypeID: - // Decoding suggestedActionRestorePremium#e909dd64. - v := SuggestedActionRestorePremium{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionSubscribeToAnnualPremiumTypeID: - // Decoding suggestedActionSubscribeToAnnualPremium#164978bb. - v := SuggestedActionSubscribeToAnnualPremium{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionGiftPremiumForChristmasTypeID: - // Decoding suggestedActionGiftPremiumForChristmas#93b3ee6f. - v := SuggestedActionGiftPremiumForChristmas{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionSetBirthdateTypeID: - // Decoding suggestedActionSetBirthdate#eabd9b02. - v := SuggestedActionSetBirthdate{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionSetProfilePhotoTypeID: - // Decoding suggestedActionSetProfilePhoto#9fe23d6b. - v := SuggestedActionSetProfilePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionExtendPremiumTypeID: - // Decoding suggestedActionExtendPremium#de405cca. - v := SuggestedActionExtendPremium{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case SuggestedActionExtendStarSubscriptionsTypeID: - // Decoding suggestedActionExtendStarSubscriptions#fd32d556. - v := SuggestedActionExtendStarSubscriptions{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONSuggestedAction implements binary de-serialization for SuggestedActionClass. -func DecodeTDLibJSONSuggestedAction(buf tdjson.Decoder) (SuggestedActionClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "suggestedActionEnableArchiveAndMuteNewChats": - // Decoding suggestedActionEnableArchiveAndMuteNewChats#7841ec4f. - v := SuggestedActionEnableArchiveAndMuteNewChats{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionCheckPassword": - // Decoding suggestedActionCheckPassword#71e072b7. - v := SuggestedActionCheckPassword{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionCheckPhoneNumber": - // Decoding suggestedActionCheckPhoneNumber#26ab77eb. - v := SuggestedActionCheckPhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionViewChecksHint": - // Decoding suggestedActionViewChecksHint#35203547. - v := SuggestedActionViewChecksHint{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionConvertToBroadcastGroup": - // Decoding suggestedActionConvertToBroadcastGroup#c67a2e38. - v := SuggestedActionConvertToBroadcastGroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionSetPassword": - // Decoding suggestedActionSetPassword#6f147d98. - v := SuggestedActionSetPassword{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionUpgradePremium": - // Decoding suggestedActionUpgradePremium#70aa79fb. - v := SuggestedActionUpgradePremium{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionRestorePremium": - // Decoding suggestedActionRestorePremium#e909dd64. - v := SuggestedActionRestorePremium{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionSubscribeToAnnualPremium": - // Decoding suggestedActionSubscribeToAnnualPremium#164978bb. - v := SuggestedActionSubscribeToAnnualPremium{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionGiftPremiumForChristmas": - // Decoding suggestedActionGiftPremiumForChristmas#93b3ee6f. - v := SuggestedActionGiftPremiumForChristmas{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionSetBirthdate": - // Decoding suggestedActionSetBirthdate#eabd9b02. - v := SuggestedActionSetBirthdate{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionSetProfilePhoto": - // Decoding suggestedActionSetProfilePhoto#9fe23d6b. - v := SuggestedActionSetProfilePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionExtendPremium": - // Decoding suggestedActionExtendPremium#de405cca. - v := SuggestedActionExtendPremium{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - case "suggestedActionExtendStarSubscriptions": - // Decoding suggestedActionExtendStarSubscriptions#fd32d556. - v := SuggestedActionExtendStarSubscriptions{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SuggestedActionClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// SuggestedAction boxes the SuggestedActionClass providing a helper. -type SuggestedActionBox struct { - SuggestedAction SuggestedActionClass -} - -// Decode implements bin.Decoder for SuggestedActionBox. -func (b *SuggestedActionBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode SuggestedActionBox to nil") - } - v, err := DecodeSuggestedAction(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SuggestedAction = v - return nil -} - -// Encode implements bin.Encode for SuggestedActionBox. -func (b *SuggestedActionBox) Encode(buf *bin.Buffer) error { - if b == nil || b.SuggestedAction == nil { - return fmt.Errorf("unable to encode SuggestedActionClass as nil") - } - return b.SuggestedAction.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for SuggestedActionBox. -func (b *SuggestedActionBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode SuggestedActionBox to nil") - } - v, err := DecodeTDLibJSONSuggestedAction(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SuggestedAction = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for SuggestedActionBox. -func (b *SuggestedActionBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.SuggestedAction == nil { - return fmt.Errorf("unable to encode SuggestedActionClass as nil") - } - return b.SuggestedAction.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_supergroup_full_info_gen.go b/tdapi/tl_supergroup_full_info_gen.go deleted file mode 100644 index 39b2d0dfd..000000000 --- a/tdapi/tl_supergroup_full_info_gen.go +++ /dev/null @@ -1,1360 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SupergroupFullInfo represents TL type `supergroupFullInfo#f763d79d`. -type SupergroupFullInfo struct { - // Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as - // in chat.photo - Photo ChatPhoto - // Contains full information about a supergroup or channel - Description string - // Number of members in the supergroup or channel; 0 if unknown - MemberCount int32 - // Number of privileged users in the supergroup or channel; 0 if unknown - AdministratorCount int32 - // Number of restricted users in the supergroup; 0 if unknown - RestrictedCount int32 - // Number of users banned from chat; 0 if unknown - BannedCount int32 - // Chat identifier of a discussion group for the channel, or a channel, for which the - // supergroup is the designated discussion group; 0 if none or unknown - LinkedChatID int64 - // Delay between consecutive sent messages for non-administrator supergroup members, in - // seconds - SlowModeDelay int32 - // Time left before next message can be sent in the supergroup, in seconds. An - // updateSupergroupFullInfo update is not triggered when value of this field changes, but - // both new and old values are non-zero - SlowModeDelayExpiresIn float64 - // True, if paid reaction can be enabled in the channel chat; for channels only - CanEnablePaidReaction bool - // True, if members of the chat can be retrieved via getSupergroupMembers or - // searchChatMembers - CanGetMembers bool - // True, if non-administrators can receive only administrators and bots using - // getSupergroupMembers or searchChatMembers - HasHiddenMembers bool - // True, if non-administrators and non-bots can be hidden in responses to - // getSupergroupMembers and searchChatMembers for non-administrators - CanHideMembers bool - // True, if the supergroup sticker set can be changed - CanSetStickerSet bool - // True, if the supergroup location can be changed - CanSetLocation bool - // True, if the supergroup or channel statistics are available - CanGetStatistics bool - // True, if the supergroup or channel revenue statistics are available - CanGetRevenueStatistics bool - // True, if the supergroup or channel Telegram Star revenue statistics are available - CanGetStarRevenueStatistics bool - // True, if aggressive anti-spam checks can be enabled or disabled in the supergroup - CanToggleAggressiveAntiSpam bool - // True, if new chat members will have access to old messages. In public, discussion, of - // forum groups and all channels, old messages are always available, - IsAllHistoryAvailable bool - // True, if the chat can have sponsored messages. The value of this field is only - // available to the owner of the chat - CanHaveSponsoredMessages bool - // True, if aggressive anti-spam checks are enabled in the supergroup. The value of this - // field is only available to chat administrators - HasAggressiveAntiSpamEnabled bool - // True, if paid media can be sent and forwarded to the channel chat; for channels only - HasPaidMediaAllowed bool - // True, if the supergroup or channel has pinned stories - HasPinnedStories bool - // Number of times the current user boosted the supergroup or channel - MyBoostCount int32 - // Number of times the supergroup must be boosted by a user to ignore slow mode and chat - // permission restrictions; 0 if unspecified - UnrestrictBoostCount int32 - // Identifier of the supergroup sticker set that must be shown before user sticker sets; - // 0 if none - StickerSetID int64 - // Identifier of the custom emoji sticker set that can be used in the supergroup without - // Telegram Premium subscription; 0 if none - CustomEmojiStickerSetID int64 - // Location to which the supergroup is connected; may be null if none - Location ChatLocation - // Primary invite link for the chat; may be null. For chat administrators with - // can_invite_users right only - InviteLink ChatInviteLink - // List of commands of bots in the group - BotCommands []BotCommands - // Information about verification status of the supergroup or the channel provided by a - // bot; may be null if none or unknown - BotVerification BotVerification - // Identifier of the basic group from which supergroup was upgraded; 0 if none - UpgradedFromBasicGroupID int64 - // Identifier of the last message in the basic group from which supergroup was upgraded; - // 0 if none - UpgradedFromMaxMessageID int64 -} - -// SupergroupFullInfoTypeID is TL type id of SupergroupFullInfo. -const SupergroupFullInfoTypeID = 0xf763d79d - -// Ensuring interfaces in compile-time for SupergroupFullInfo. -var ( - _ bin.Encoder = &SupergroupFullInfo{} - _ bin.Decoder = &SupergroupFullInfo{} - _ bin.BareEncoder = &SupergroupFullInfo{} - _ bin.BareDecoder = &SupergroupFullInfo{} -) - -func (s *SupergroupFullInfo) Zero() bool { - if s == nil { - return true - } - if !(s.Photo.Zero()) { - return false - } - if !(s.Description == "") { - return false - } - if !(s.MemberCount == 0) { - return false - } - if !(s.AdministratorCount == 0) { - return false - } - if !(s.RestrictedCount == 0) { - return false - } - if !(s.BannedCount == 0) { - return false - } - if !(s.LinkedChatID == 0) { - return false - } - if !(s.SlowModeDelay == 0) { - return false - } - if !(s.SlowModeDelayExpiresIn == 0) { - return false - } - if !(s.CanEnablePaidReaction == false) { - return false - } - if !(s.CanGetMembers == false) { - return false - } - if !(s.HasHiddenMembers == false) { - return false - } - if !(s.CanHideMembers == false) { - return false - } - if !(s.CanSetStickerSet == false) { - return false - } - if !(s.CanSetLocation == false) { - return false - } - if !(s.CanGetStatistics == false) { - return false - } - if !(s.CanGetRevenueStatistics == false) { - return false - } - if !(s.CanGetStarRevenueStatistics == false) { - return false - } - if !(s.CanToggleAggressiveAntiSpam == false) { - return false - } - if !(s.IsAllHistoryAvailable == false) { - return false - } - if !(s.CanHaveSponsoredMessages == false) { - return false - } - if !(s.HasAggressiveAntiSpamEnabled == false) { - return false - } - if !(s.HasPaidMediaAllowed == false) { - return false - } - if !(s.HasPinnedStories == false) { - return false - } - if !(s.MyBoostCount == 0) { - return false - } - if !(s.UnrestrictBoostCount == 0) { - return false - } - if !(s.StickerSetID == 0) { - return false - } - if !(s.CustomEmojiStickerSetID == 0) { - return false - } - if !(s.Location.Zero()) { - return false - } - if !(s.InviteLink.Zero()) { - return false - } - if !(s.BotCommands == nil) { - return false - } - if !(s.BotVerification.Zero()) { - return false - } - if !(s.UpgradedFromBasicGroupID == 0) { - return false - } - if !(s.UpgradedFromMaxMessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SupergroupFullInfo) String() string { - if s == nil { - return "SupergroupFullInfo(nil)" - } - type Alias SupergroupFullInfo - return fmt.Sprintf("SupergroupFullInfo%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SupergroupFullInfo) TypeID() uint32 { - return SupergroupFullInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*SupergroupFullInfo) TypeName() string { - return "supergroupFullInfo" -} - -// TypeInfo returns info about TL type. -func (s *SupergroupFullInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "supergroupFullInfo", - ID: SupergroupFullInfoTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "MemberCount", - SchemaName: "member_count", - }, - { - Name: "AdministratorCount", - SchemaName: "administrator_count", - }, - { - Name: "RestrictedCount", - SchemaName: "restricted_count", - }, - { - Name: "BannedCount", - SchemaName: "banned_count", - }, - { - Name: "LinkedChatID", - SchemaName: "linked_chat_id", - }, - { - Name: "SlowModeDelay", - SchemaName: "slow_mode_delay", - }, - { - Name: "SlowModeDelayExpiresIn", - SchemaName: "slow_mode_delay_expires_in", - }, - { - Name: "CanEnablePaidReaction", - SchemaName: "can_enable_paid_reaction", - }, - { - Name: "CanGetMembers", - SchemaName: "can_get_members", - }, - { - Name: "HasHiddenMembers", - SchemaName: "has_hidden_members", - }, - { - Name: "CanHideMembers", - SchemaName: "can_hide_members", - }, - { - Name: "CanSetStickerSet", - SchemaName: "can_set_sticker_set", - }, - { - Name: "CanSetLocation", - SchemaName: "can_set_location", - }, - { - Name: "CanGetStatistics", - SchemaName: "can_get_statistics", - }, - { - Name: "CanGetRevenueStatistics", - SchemaName: "can_get_revenue_statistics", - }, - { - Name: "CanGetStarRevenueStatistics", - SchemaName: "can_get_star_revenue_statistics", - }, - { - Name: "CanToggleAggressiveAntiSpam", - SchemaName: "can_toggle_aggressive_anti_spam", - }, - { - Name: "IsAllHistoryAvailable", - SchemaName: "is_all_history_available", - }, - { - Name: "CanHaveSponsoredMessages", - SchemaName: "can_have_sponsored_messages", - }, - { - Name: "HasAggressiveAntiSpamEnabled", - SchemaName: "has_aggressive_anti_spam_enabled", - }, - { - Name: "HasPaidMediaAllowed", - SchemaName: "has_paid_media_allowed", - }, - { - Name: "HasPinnedStories", - SchemaName: "has_pinned_stories", - }, - { - Name: "MyBoostCount", - SchemaName: "my_boost_count", - }, - { - Name: "UnrestrictBoostCount", - SchemaName: "unrestrict_boost_count", - }, - { - Name: "StickerSetID", - SchemaName: "sticker_set_id", - }, - { - Name: "CustomEmojiStickerSetID", - SchemaName: "custom_emoji_sticker_set_id", - }, - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "BotCommands", - SchemaName: "bot_commands", - }, - { - Name: "BotVerification", - SchemaName: "bot_verification", - }, - { - Name: "UpgradedFromBasicGroupID", - SchemaName: "upgraded_from_basic_group_id", - }, - { - Name: "UpgradedFromMaxMessageID", - SchemaName: "upgraded_from_max_message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SupergroupFullInfo) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupFullInfo#f763d79d as nil") - } - b.PutID(SupergroupFullInfoTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SupergroupFullInfo) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupFullInfo#f763d79d as nil") - } - if err := s.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field photo: %w", err) - } - b.PutString(s.Description) - b.PutInt32(s.MemberCount) - b.PutInt32(s.AdministratorCount) - b.PutInt32(s.RestrictedCount) - b.PutInt32(s.BannedCount) - b.PutInt53(s.LinkedChatID) - b.PutInt32(s.SlowModeDelay) - b.PutDouble(s.SlowModeDelayExpiresIn) - b.PutBool(s.CanEnablePaidReaction) - b.PutBool(s.CanGetMembers) - b.PutBool(s.HasHiddenMembers) - b.PutBool(s.CanHideMembers) - b.PutBool(s.CanSetStickerSet) - b.PutBool(s.CanSetLocation) - b.PutBool(s.CanGetStatistics) - b.PutBool(s.CanGetRevenueStatistics) - b.PutBool(s.CanGetStarRevenueStatistics) - b.PutBool(s.CanToggleAggressiveAntiSpam) - b.PutBool(s.IsAllHistoryAvailable) - b.PutBool(s.CanHaveSponsoredMessages) - b.PutBool(s.HasAggressiveAntiSpamEnabled) - b.PutBool(s.HasPaidMediaAllowed) - b.PutBool(s.HasPinnedStories) - b.PutInt32(s.MyBoostCount) - b.PutInt32(s.UnrestrictBoostCount) - b.PutLong(s.StickerSetID) - b.PutLong(s.CustomEmojiStickerSetID) - if err := s.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field location: %w", err) - } - if err := s.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field invite_link: %w", err) - } - b.PutInt(len(s.BotCommands)) - for idx, v := range s.BotCommands { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare supergroupFullInfo#f763d79d: field bot_commands element with index %d: %w", idx, err) - } - } - if err := s.BotVerification.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field bot_verification: %w", err) - } - b.PutInt53(s.UpgradedFromBasicGroupID) - b.PutInt53(s.UpgradedFromMaxMessageID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SupergroupFullInfo) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupFullInfo#f763d79d to nil") - } - if err := b.ConsumeID(SupergroupFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SupergroupFullInfo) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupFullInfo#f763d79d to nil") - } - { - if err := s.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field photo: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field description: %w", err) - } - s.Description = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field member_count: %w", err) - } - s.MemberCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field administrator_count: %w", err) - } - s.AdministratorCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field restricted_count: %w", err) - } - s.RestrictedCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field banned_count: %w", err) - } - s.BannedCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field linked_chat_id: %w", err) - } - s.LinkedChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field slow_mode_delay: %w", err) - } - s.SlowModeDelay = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field slow_mode_delay_expires_in: %w", err) - } - s.SlowModeDelayExpiresIn = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_enable_paid_reaction: %w", err) - } - s.CanEnablePaidReaction = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_members: %w", err) - } - s.CanGetMembers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_hidden_members: %w", err) - } - s.HasHiddenMembers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_hide_members: %w", err) - } - s.CanHideMembers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_set_sticker_set: %w", err) - } - s.CanSetStickerSet = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_set_location: %w", err) - } - s.CanSetLocation = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_statistics: %w", err) - } - s.CanGetStatistics = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_revenue_statistics: %w", err) - } - s.CanGetRevenueStatistics = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_star_revenue_statistics: %w", err) - } - s.CanGetStarRevenueStatistics = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_toggle_aggressive_anti_spam: %w", err) - } - s.CanToggleAggressiveAntiSpam = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field is_all_history_available: %w", err) - } - s.IsAllHistoryAvailable = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_have_sponsored_messages: %w", err) - } - s.CanHaveSponsoredMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_aggressive_anti_spam_enabled: %w", err) - } - s.HasAggressiveAntiSpamEnabled = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_paid_media_allowed: %w", err) - } - s.HasPaidMediaAllowed = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_pinned_stories: %w", err) - } - s.HasPinnedStories = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field my_boost_count: %w", err) - } - s.MyBoostCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field unrestrict_boost_count: %w", err) - } - s.UnrestrictBoostCount = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field sticker_set_id: %w", err) - } - s.StickerSetID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field custom_emoji_sticker_set_id: %w", err) - } - s.CustomEmojiStickerSetID = value - } - { - if err := s.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field location: %w", err) - } - } - { - if err := s.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field invite_link: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field bot_commands: %w", err) - } - - if headerLen > 0 { - s.BotCommands = make([]BotCommands, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value BotCommands - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare supergroupFullInfo#f763d79d: field bot_commands: %w", err) - } - s.BotCommands = append(s.BotCommands, value) - } - } - { - if err := s.BotVerification.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field bot_verification: %w", err) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field upgraded_from_basic_group_id: %w", err) - } - s.UpgradedFromBasicGroupID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field upgraded_from_max_message_id: %w", err) - } - s.UpgradedFromMaxMessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SupergroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode supergroupFullInfo#f763d79d as nil") - } - b.ObjStart() - b.PutID("supergroupFullInfo") - b.Comma() - b.FieldStart("photo") - if err := s.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field photo: %w", err) - } - b.Comma() - b.FieldStart("description") - b.PutString(s.Description) - b.Comma() - b.FieldStart("member_count") - b.PutInt32(s.MemberCount) - b.Comma() - b.FieldStart("administrator_count") - b.PutInt32(s.AdministratorCount) - b.Comma() - b.FieldStart("restricted_count") - b.PutInt32(s.RestrictedCount) - b.Comma() - b.FieldStart("banned_count") - b.PutInt32(s.BannedCount) - b.Comma() - b.FieldStart("linked_chat_id") - b.PutInt53(s.LinkedChatID) - b.Comma() - b.FieldStart("slow_mode_delay") - b.PutInt32(s.SlowModeDelay) - b.Comma() - b.FieldStart("slow_mode_delay_expires_in") - b.PutDouble(s.SlowModeDelayExpiresIn) - b.Comma() - b.FieldStart("can_enable_paid_reaction") - b.PutBool(s.CanEnablePaidReaction) - b.Comma() - b.FieldStart("can_get_members") - b.PutBool(s.CanGetMembers) - b.Comma() - b.FieldStart("has_hidden_members") - b.PutBool(s.HasHiddenMembers) - b.Comma() - b.FieldStart("can_hide_members") - b.PutBool(s.CanHideMembers) - b.Comma() - b.FieldStart("can_set_sticker_set") - b.PutBool(s.CanSetStickerSet) - b.Comma() - b.FieldStart("can_set_location") - b.PutBool(s.CanSetLocation) - b.Comma() - b.FieldStart("can_get_statistics") - b.PutBool(s.CanGetStatistics) - b.Comma() - b.FieldStart("can_get_revenue_statistics") - b.PutBool(s.CanGetRevenueStatistics) - b.Comma() - b.FieldStart("can_get_star_revenue_statistics") - b.PutBool(s.CanGetStarRevenueStatistics) - b.Comma() - b.FieldStart("can_toggle_aggressive_anti_spam") - b.PutBool(s.CanToggleAggressiveAntiSpam) - b.Comma() - b.FieldStart("is_all_history_available") - b.PutBool(s.IsAllHistoryAvailable) - b.Comma() - b.FieldStart("can_have_sponsored_messages") - b.PutBool(s.CanHaveSponsoredMessages) - b.Comma() - b.FieldStart("has_aggressive_anti_spam_enabled") - b.PutBool(s.HasAggressiveAntiSpamEnabled) - b.Comma() - b.FieldStart("has_paid_media_allowed") - b.PutBool(s.HasPaidMediaAllowed) - b.Comma() - b.FieldStart("has_pinned_stories") - b.PutBool(s.HasPinnedStories) - b.Comma() - b.FieldStart("my_boost_count") - b.PutInt32(s.MyBoostCount) - b.Comma() - b.FieldStart("unrestrict_boost_count") - b.PutInt32(s.UnrestrictBoostCount) - b.Comma() - b.FieldStart("sticker_set_id") - b.PutLong(s.StickerSetID) - b.Comma() - b.FieldStart("custom_emoji_sticker_set_id") - b.PutLong(s.CustomEmojiStickerSetID) - b.Comma() - b.FieldStart("location") - if err := s.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field location: %w", err) - } - b.Comma() - b.FieldStart("invite_link") - if err := s.InviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field invite_link: %w", err) - } - b.Comma() - b.FieldStart("bot_commands") - b.ArrStart() - for idx, v := range s.BotCommands { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field bot_commands element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("bot_verification") - if err := s.BotVerification.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroupFullInfo#f763d79d: field bot_verification: %w", err) - } - b.Comma() - b.FieldStart("upgraded_from_basic_group_id") - b.PutInt53(s.UpgradedFromBasicGroupID) - b.Comma() - b.FieldStart("upgraded_from_max_message_id") - b.PutInt53(s.UpgradedFromMaxMessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SupergroupFullInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode supergroupFullInfo#f763d79d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("supergroupFullInfo"); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: %w", err) - } - case "photo": - if err := s.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field photo: %w", err) - } - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field description: %w", err) - } - s.Description = value - case "member_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field member_count: %w", err) - } - s.MemberCount = value - case "administrator_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field administrator_count: %w", err) - } - s.AdministratorCount = value - case "restricted_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field restricted_count: %w", err) - } - s.RestrictedCount = value - case "banned_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field banned_count: %w", err) - } - s.BannedCount = value - case "linked_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field linked_chat_id: %w", err) - } - s.LinkedChatID = value - case "slow_mode_delay": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field slow_mode_delay: %w", err) - } - s.SlowModeDelay = value - case "slow_mode_delay_expires_in": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field slow_mode_delay_expires_in: %w", err) - } - s.SlowModeDelayExpiresIn = value - case "can_enable_paid_reaction": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_enable_paid_reaction: %w", err) - } - s.CanEnablePaidReaction = value - case "can_get_members": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_members: %w", err) - } - s.CanGetMembers = value - case "has_hidden_members": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_hidden_members: %w", err) - } - s.HasHiddenMembers = value - case "can_hide_members": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_hide_members: %w", err) - } - s.CanHideMembers = value - case "can_set_sticker_set": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_set_sticker_set: %w", err) - } - s.CanSetStickerSet = value - case "can_set_location": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_set_location: %w", err) - } - s.CanSetLocation = value - case "can_get_statistics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_statistics: %w", err) - } - s.CanGetStatistics = value - case "can_get_revenue_statistics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_revenue_statistics: %w", err) - } - s.CanGetRevenueStatistics = value - case "can_get_star_revenue_statistics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_get_star_revenue_statistics: %w", err) - } - s.CanGetStarRevenueStatistics = value - case "can_toggle_aggressive_anti_spam": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_toggle_aggressive_anti_spam: %w", err) - } - s.CanToggleAggressiveAntiSpam = value - case "is_all_history_available": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field is_all_history_available: %w", err) - } - s.IsAllHistoryAvailable = value - case "can_have_sponsored_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field can_have_sponsored_messages: %w", err) - } - s.CanHaveSponsoredMessages = value - case "has_aggressive_anti_spam_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_aggressive_anti_spam_enabled: %w", err) - } - s.HasAggressiveAntiSpamEnabled = value - case "has_paid_media_allowed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_paid_media_allowed: %w", err) - } - s.HasPaidMediaAllowed = value - case "has_pinned_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field has_pinned_stories: %w", err) - } - s.HasPinnedStories = value - case "my_boost_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field my_boost_count: %w", err) - } - s.MyBoostCount = value - case "unrestrict_boost_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field unrestrict_boost_count: %w", err) - } - s.UnrestrictBoostCount = value - case "sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field sticker_set_id: %w", err) - } - s.StickerSetID = value - case "custom_emoji_sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field custom_emoji_sticker_set_id: %w", err) - } - s.CustomEmojiStickerSetID = value - case "location": - if err := s.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field location: %w", err) - } - case "invite_link": - if err := s.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field invite_link: %w", err) - } - case "bot_commands": - if err := b.Arr(func(b tdjson.Decoder) error { - var value BotCommands - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field bot_commands: %w", err) - } - s.BotCommands = append(s.BotCommands, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field bot_commands: %w", err) - } - case "bot_verification": - if err := s.BotVerification.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field bot_verification: %w", err) - } - case "upgraded_from_basic_group_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field upgraded_from_basic_group_id: %w", err) - } - s.UpgradedFromBasicGroupID = value - case "upgraded_from_max_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode supergroupFullInfo#f763d79d: field upgraded_from_max_message_id: %w", err) - } - s.UpgradedFromMaxMessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPhoto returns value of Photo field. -func (s *SupergroupFullInfo) GetPhoto() (value ChatPhoto) { - if s == nil { - return - } - return s.Photo -} - -// GetDescription returns value of Description field. -func (s *SupergroupFullInfo) GetDescription() (value string) { - if s == nil { - return - } - return s.Description -} - -// GetMemberCount returns value of MemberCount field. -func (s *SupergroupFullInfo) GetMemberCount() (value int32) { - if s == nil { - return - } - return s.MemberCount -} - -// GetAdministratorCount returns value of AdministratorCount field. -func (s *SupergroupFullInfo) GetAdministratorCount() (value int32) { - if s == nil { - return - } - return s.AdministratorCount -} - -// GetRestrictedCount returns value of RestrictedCount field. -func (s *SupergroupFullInfo) GetRestrictedCount() (value int32) { - if s == nil { - return - } - return s.RestrictedCount -} - -// GetBannedCount returns value of BannedCount field. -func (s *SupergroupFullInfo) GetBannedCount() (value int32) { - if s == nil { - return - } - return s.BannedCount -} - -// GetLinkedChatID returns value of LinkedChatID field. -func (s *SupergroupFullInfo) GetLinkedChatID() (value int64) { - if s == nil { - return - } - return s.LinkedChatID -} - -// GetSlowModeDelay returns value of SlowModeDelay field. -func (s *SupergroupFullInfo) GetSlowModeDelay() (value int32) { - if s == nil { - return - } - return s.SlowModeDelay -} - -// GetSlowModeDelayExpiresIn returns value of SlowModeDelayExpiresIn field. -func (s *SupergroupFullInfo) GetSlowModeDelayExpiresIn() (value float64) { - if s == nil { - return - } - return s.SlowModeDelayExpiresIn -} - -// GetCanEnablePaidReaction returns value of CanEnablePaidReaction field. -func (s *SupergroupFullInfo) GetCanEnablePaidReaction() (value bool) { - if s == nil { - return - } - return s.CanEnablePaidReaction -} - -// GetCanGetMembers returns value of CanGetMembers field. -func (s *SupergroupFullInfo) GetCanGetMembers() (value bool) { - if s == nil { - return - } - return s.CanGetMembers -} - -// GetHasHiddenMembers returns value of HasHiddenMembers field. -func (s *SupergroupFullInfo) GetHasHiddenMembers() (value bool) { - if s == nil { - return - } - return s.HasHiddenMembers -} - -// GetCanHideMembers returns value of CanHideMembers field. -func (s *SupergroupFullInfo) GetCanHideMembers() (value bool) { - if s == nil { - return - } - return s.CanHideMembers -} - -// GetCanSetStickerSet returns value of CanSetStickerSet field. -func (s *SupergroupFullInfo) GetCanSetStickerSet() (value bool) { - if s == nil { - return - } - return s.CanSetStickerSet -} - -// GetCanSetLocation returns value of CanSetLocation field. -func (s *SupergroupFullInfo) GetCanSetLocation() (value bool) { - if s == nil { - return - } - return s.CanSetLocation -} - -// GetCanGetStatistics returns value of CanGetStatistics field. -func (s *SupergroupFullInfo) GetCanGetStatistics() (value bool) { - if s == nil { - return - } - return s.CanGetStatistics -} - -// GetCanGetRevenueStatistics returns value of CanGetRevenueStatistics field. -func (s *SupergroupFullInfo) GetCanGetRevenueStatistics() (value bool) { - if s == nil { - return - } - return s.CanGetRevenueStatistics -} - -// GetCanGetStarRevenueStatistics returns value of CanGetStarRevenueStatistics field. -func (s *SupergroupFullInfo) GetCanGetStarRevenueStatistics() (value bool) { - if s == nil { - return - } - return s.CanGetStarRevenueStatistics -} - -// GetCanToggleAggressiveAntiSpam returns value of CanToggleAggressiveAntiSpam field. -func (s *SupergroupFullInfo) GetCanToggleAggressiveAntiSpam() (value bool) { - if s == nil { - return - } - return s.CanToggleAggressiveAntiSpam -} - -// GetIsAllHistoryAvailable returns value of IsAllHistoryAvailable field. -func (s *SupergroupFullInfo) GetIsAllHistoryAvailable() (value bool) { - if s == nil { - return - } - return s.IsAllHistoryAvailable -} - -// GetCanHaveSponsoredMessages returns value of CanHaveSponsoredMessages field. -func (s *SupergroupFullInfo) GetCanHaveSponsoredMessages() (value bool) { - if s == nil { - return - } - return s.CanHaveSponsoredMessages -} - -// GetHasAggressiveAntiSpamEnabled returns value of HasAggressiveAntiSpamEnabled field. -func (s *SupergroupFullInfo) GetHasAggressiveAntiSpamEnabled() (value bool) { - if s == nil { - return - } - return s.HasAggressiveAntiSpamEnabled -} - -// GetHasPaidMediaAllowed returns value of HasPaidMediaAllowed field. -func (s *SupergroupFullInfo) GetHasPaidMediaAllowed() (value bool) { - if s == nil { - return - } - return s.HasPaidMediaAllowed -} - -// GetHasPinnedStories returns value of HasPinnedStories field. -func (s *SupergroupFullInfo) GetHasPinnedStories() (value bool) { - if s == nil { - return - } - return s.HasPinnedStories -} - -// GetMyBoostCount returns value of MyBoostCount field. -func (s *SupergroupFullInfo) GetMyBoostCount() (value int32) { - if s == nil { - return - } - return s.MyBoostCount -} - -// GetUnrestrictBoostCount returns value of UnrestrictBoostCount field. -func (s *SupergroupFullInfo) GetUnrestrictBoostCount() (value int32) { - if s == nil { - return - } - return s.UnrestrictBoostCount -} - -// GetStickerSetID returns value of StickerSetID field. -func (s *SupergroupFullInfo) GetStickerSetID() (value int64) { - if s == nil { - return - } - return s.StickerSetID -} - -// GetCustomEmojiStickerSetID returns value of CustomEmojiStickerSetID field. -func (s *SupergroupFullInfo) GetCustomEmojiStickerSetID() (value int64) { - if s == nil { - return - } - return s.CustomEmojiStickerSetID -} - -// GetLocation returns value of Location field. -func (s *SupergroupFullInfo) GetLocation() (value ChatLocation) { - if s == nil { - return - } - return s.Location -} - -// GetInviteLink returns value of InviteLink field. -func (s *SupergroupFullInfo) GetInviteLink() (value ChatInviteLink) { - if s == nil { - return - } - return s.InviteLink -} - -// GetBotCommands returns value of BotCommands field. -func (s *SupergroupFullInfo) GetBotCommands() (value []BotCommands) { - if s == nil { - return - } - return s.BotCommands -} - -// GetBotVerification returns value of BotVerification field. -func (s *SupergroupFullInfo) GetBotVerification() (value BotVerification) { - if s == nil { - return - } - return s.BotVerification -} - -// GetUpgradedFromBasicGroupID returns value of UpgradedFromBasicGroupID field. -func (s *SupergroupFullInfo) GetUpgradedFromBasicGroupID() (value int64) { - if s == nil { - return - } - return s.UpgradedFromBasicGroupID -} - -// GetUpgradedFromMaxMessageID returns value of UpgradedFromMaxMessageID field. -func (s *SupergroupFullInfo) GetUpgradedFromMaxMessageID() (value int64) { - if s == nil { - return - } - return s.UpgradedFromMaxMessageID -} diff --git a/tdapi/tl_supergroup_gen.go b/tdapi/tl_supergroup_gen.go deleted file mode 100644 index e107ecf15..000000000 --- a/tdapi/tl_supergroup_gen.go +++ /dev/null @@ -1,899 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Supergroup represents TL type `supergroup#9ebc0c42`. -type Supergroup struct { - // Supergroup or channel identifier - ID int64 - // Usernames of the supergroup or channel; may be null - Usernames Usernames - // Point in time (Unix timestamp) when the current user joined, or the point in time when - // the supergroup or channel was created, in case the user is not a member - Date int32 - // Status of the current user in the supergroup or channel; custom title will always be - // empty - Status ChatMemberStatusClass - // Number of members in the supergroup or channel; 0 if unknown. Currently, it is - // guaranteed to be known only if the supergroup or channel was received through - MemberCount int32 - // Approximate boost level for the chat - BoostLevel int32 - // True, if the channel has a discussion group, or the supergroup is the designated - // discussion group for a channel - HasLinkedChat bool - // True, if the supergroup is connected to a location, i.e. the supergroup is a - // location-based supergroup - HasLocation bool - // True, if messages sent to the channel contains name of the sender. This field is only - // applicable to channels - SignMessages bool - // True, if messages sent to the channel have information about the sender user. This - // field is only applicable to channels - ShowMessageSender bool - // True, if users need to join the supergroup before they can send messages. Always true - // for channels and non-discussion supergroups - JoinToSendMessages bool - // True, if all users directly joining the supergroup need to be approved by supergroup - // administrators. Always false for channels and supergroups without username, location, - // or a linked chat - JoinByRequest bool - // True, if the slow mode is enabled in the supergroup - IsSlowModeEnabled bool - // True, if the supergroup is a channel - IsChannel bool - // True, if the supergroup is a broadcast group, i.e. only administrators can send - // messages and there is no limit on the number of members - IsBroadcastGroup bool - // True, if the supergroup is a forum with topics - IsForum bool - // Information about verification status of the supergroup or channel; may be null if - // none - VerificationStatus VerificationStatus - // True, if content of media messages in the supergroup or channel chat must be hidden - // with 18+ spoiler - HasSensitiveContent bool - // If non-empty, contains a human-readable description of the reason why access to this - // supergroup or channel must be restricted - RestrictionReason string - // True, if the supergroup or channel has non-expired stories available to the current - // user - HasActiveStories bool - // True, if the supergroup or channel has unread non-expired stories available to the - // current user - HasUnreadActiveStories bool -} - -// SupergroupTypeID is TL type id of Supergroup. -const SupergroupTypeID = 0x9ebc0c42 - -// Ensuring interfaces in compile-time for Supergroup. -var ( - _ bin.Encoder = &Supergroup{} - _ bin.Decoder = &Supergroup{} - _ bin.BareEncoder = &Supergroup{} - _ bin.BareDecoder = &Supergroup{} -) - -func (s *Supergroup) Zero() bool { - if s == nil { - return true - } - if !(s.ID == 0) { - return false - } - if !(s.Usernames.Zero()) { - return false - } - if !(s.Date == 0) { - return false - } - if !(s.Status == nil) { - return false - } - if !(s.MemberCount == 0) { - return false - } - if !(s.BoostLevel == 0) { - return false - } - if !(s.HasLinkedChat == false) { - return false - } - if !(s.HasLocation == false) { - return false - } - if !(s.SignMessages == false) { - return false - } - if !(s.ShowMessageSender == false) { - return false - } - if !(s.JoinToSendMessages == false) { - return false - } - if !(s.JoinByRequest == false) { - return false - } - if !(s.IsSlowModeEnabled == false) { - return false - } - if !(s.IsChannel == false) { - return false - } - if !(s.IsBroadcastGroup == false) { - return false - } - if !(s.IsForum == false) { - return false - } - if !(s.VerificationStatus.Zero()) { - return false - } - if !(s.HasSensitiveContent == false) { - return false - } - if !(s.RestrictionReason == "") { - return false - } - if !(s.HasActiveStories == false) { - return false - } - if !(s.HasUnreadActiveStories == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *Supergroup) String() string { - if s == nil { - return "Supergroup(nil)" - } - type Alias Supergroup - return fmt.Sprintf("Supergroup%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Supergroup) TypeID() uint32 { - return SupergroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*Supergroup) TypeName() string { - return "supergroup" -} - -// TypeInfo returns info about TL type. -func (s *Supergroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "supergroup", - ID: SupergroupTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Usernames", - SchemaName: "usernames", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "Status", - SchemaName: "status", - }, - { - Name: "MemberCount", - SchemaName: "member_count", - }, - { - Name: "BoostLevel", - SchemaName: "boost_level", - }, - { - Name: "HasLinkedChat", - SchemaName: "has_linked_chat", - }, - { - Name: "HasLocation", - SchemaName: "has_location", - }, - { - Name: "SignMessages", - SchemaName: "sign_messages", - }, - { - Name: "ShowMessageSender", - SchemaName: "show_message_sender", - }, - { - Name: "JoinToSendMessages", - SchemaName: "join_to_send_messages", - }, - { - Name: "JoinByRequest", - SchemaName: "join_by_request", - }, - { - Name: "IsSlowModeEnabled", - SchemaName: "is_slow_mode_enabled", - }, - { - Name: "IsChannel", - SchemaName: "is_channel", - }, - { - Name: "IsBroadcastGroup", - SchemaName: "is_broadcast_group", - }, - { - Name: "IsForum", - SchemaName: "is_forum", - }, - { - Name: "VerificationStatus", - SchemaName: "verification_status", - }, - { - Name: "HasSensitiveContent", - SchemaName: "has_sensitive_content", - }, - { - Name: "RestrictionReason", - SchemaName: "restriction_reason", - }, - { - Name: "HasActiveStories", - SchemaName: "has_active_stories", - }, - { - Name: "HasUnreadActiveStories", - SchemaName: "has_unread_active_stories", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *Supergroup) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroup#9ebc0c42 as nil") - } - b.PutID(SupergroupTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *Supergroup) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroup#9ebc0c42 as nil") - } - b.PutInt53(s.ID) - if err := s.Usernames.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroup#9ebc0c42: field usernames: %w", err) - } - b.PutInt32(s.Date) - if s.Status == nil { - return fmt.Errorf("unable to encode supergroup#9ebc0c42: field status is nil") - } - if err := s.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroup#9ebc0c42: field status: %w", err) - } - b.PutInt32(s.MemberCount) - b.PutInt32(s.BoostLevel) - b.PutBool(s.HasLinkedChat) - b.PutBool(s.HasLocation) - b.PutBool(s.SignMessages) - b.PutBool(s.ShowMessageSender) - b.PutBool(s.JoinToSendMessages) - b.PutBool(s.JoinByRequest) - b.PutBool(s.IsSlowModeEnabled) - b.PutBool(s.IsChannel) - b.PutBool(s.IsBroadcastGroup) - b.PutBool(s.IsForum) - if err := s.VerificationStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode supergroup#9ebc0c42: field verification_status: %w", err) - } - b.PutBool(s.HasSensitiveContent) - b.PutString(s.RestrictionReason) - b.PutBool(s.HasActiveStories) - b.PutBool(s.HasUnreadActiveStories) - return nil -} - -// Decode implements bin.Decoder. -func (s *Supergroup) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroup#9ebc0c42 to nil") - } - if err := b.ConsumeID(SupergroupTypeID); err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *Supergroup) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroup#9ebc0c42 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field id: %w", err) - } - s.ID = value - } - { - if err := s.Usernames.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field usernames: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field date: %w", err) - } - s.Date = value - } - { - value, err := DecodeChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field status: %w", err) - } - s.Status = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field member_count: %w", err) - } - s.MemberCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field boost_level: %w", err) - } - s.BoostLevel = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_linked_chat: %w", err) - } - s.HasLinkedChat = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_location: %w", err) - } - s.HasLocation = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field sign_messages: %w", err) - } - s.SignMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field show_message_sender: %w", err) - } - s.ShowMessageSender = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field join_to_send_messages: %w", err) - } - s.JoinToSendMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field join_by_request: %w", err) - } - s.JoinByRequest = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_slow_mode_enabled: %w", err) - } - s.IsSlowModeEnabled = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_channel: %w", err) - } - s.IsChannel = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_broadcast_group: %w", err) - } - s.IsBroadcastGroup = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_forum: %w", err) - } - s.IsForum = value - } - { - if err := s.VerificationStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field verification_status: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_sensitive_content: %w", err) - } - s.HasSensitiveContent = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field restriction_reason: %w", err) - } - s.RestrictionReason = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_active_stories: %w", err) - } - s.HasActiveStories = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_unread_active_stories: %w", err) - } - s.HasUnreadActiveStories = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *Supergroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode supergroup#9ebc0c42 as nil") - } - b.ObjStart() - b.PutID("supergroup") - b.Comma() - b.FieldStart("id") - b.PutInt53(s.ID) - b.Comma() - b.FieldStart("usernames") - if err := s.Usernames.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroup#9ebc0c42: field usernames: %w", err) - } - b.Comma() - b.FieldStart("date") - b.PutInt32(s.Date) - b.Comma() - b.FieldStart("status") - if s.Status == nil { - return fmt.Errorf("unable to encode supergroup#9ebc0c42: field status is nil") - } - if err := s.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroup#9ebc0c42: field status: %w", err) - } - b.Comma() - b.FieldStart("member_count") - b.PutInt32(s.MemberCount) - b.Comma() - b.FieldStart("boost_level") - b.PutInt32(s.BoostLevel) - b.Comma() - b.FieldStart("has_linked_chat") - b.PutBool(s.HasLinkedChat) - b.Comma() - b.FieldStart("has_location") - b.PutBool(s.HasLocation) - b.Comma() - b.FieldStart("sign_messages") - b.PutBool(s.SignMessages) - b.Comma() - b.FieldStart("show_message_sender") - b.PutBool(s.ShowMessageSender) - b.Comma() - b.FieldStart("join_to_send_messages") - b.PutBool(s.JoinToSendMessages) - b.Comma() - b.FieldStart("join_by_request") - b.PutBool(s.JoinByRequest) - b.Comma() - b.FieldStart("is_slow_mode_enabled") - b.PutBool(s.IsSlowModeEnabled) - b.Comma() - b.FieldStart("is_channel") - b.PutBool(s.IsChannel) - b.Comma() - b.FieldStart("is_broadcast_group") - b.PutBool(s.IsBroadcastGroup) - b.Comma() - b.FieldStart("is_forum") - b.PutBool(s.IsForum) - b.Comma() - b.FieldStart("verification_status") - if err := s.VerificationStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode supergroup#9ebc0c42: field verification_status: %w", err) - } - b.Comma() - b.FieldStart("has_sensitive_content") - b.PutBool(s.HasSensitiveContent) - b.Comma() - b.FieldStart("restriction_reason") - b.PutString(s.RestrictionReason) - b.Comma() - b.FieldStart("has_active_stories") - b.PutBool(s.HasActiveStories) - b.Comma() - b.FieldStart("has_unread_active_stories") - b.PutBool(s.HasUnreadActiveStories) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *Supergroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode supergroup#9ebc0c42 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("supergroup"); err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: %w", err) - } - case "id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field id: %w", err) - } - s.ID = value - case "usernames": - if err := s.Usernames.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field usernames: %w", err) - } - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field date: %w", err) - } - s.Date = value - case "status": - value, err := DecodeTDLibJSONChatMemberStatus(b) - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field status: %w", err) - } - s.Status = value - case "member_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field member_count: %w", err) - } - s.MemberCount = value - case "boost_level": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field boost_level: %w", err) - } - s.BoostLevel = value - case "has_linked_chat": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_linked_chat: %w", err) - } - s.HasLinkedChat = value - case "has_location": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_location: %w", err) - } - s.HasLocation = value - case "sign_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field sign_messages: %w", err) - } - s.SignMessages = value - case "show_message_sender": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field show_message_sender: %w", err) - } - s.ShowMessageSender = value - case "join_to_send_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field join_to_send_messages: %w", err) - } - s.JoinToSendMessages = value - case "join_by_request": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field join_by_request: %w", err) - } - s.JoinByRequest = value - case "is_slow_mode_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_slow_mode_enabled: %w", err) - } - s.IsSlowModeEnabled = value - case "is_channel": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_channel: %w", err) - } - s.IsChannel = value - case "is_broadcast_group": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_broadcast_group: %w", err) - } - s.IsBroadcastGroup = value - case "is_forum": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field is_forum: %w", err) - } - s.IsForum = value - case "verification_status": - if err := s.VerificationStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field verification_status: %w", err) - } - case "has_sensitive_content": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_sensitive_content: %w", err) - } - s.HasSensitiveContent = value - case "restriction_reason": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field restriction_reason: %w", err) - } - s.RestrictionReason = value - case "has_active_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_active_stories: %w", err) - } - s.HasActiveStories = value - case "has_unread_active_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode supergroup#9ebc0c42: field has_unread_active_stories: %w", err) - } - s.HasUnreadActiveStories = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (s *Supergroup) GetID() (value int64) { - if s == nil { - return - } - return s.ID -} - -// GetUsernames returns value of Usernames field. -func (s *Supergroup) GetUsernames() (value Usernames) { - if s == nil { - return - } - return s.Usernames -} - -// GetDate returns value of Date field. -func (s *Supergroup) GetDate() (value int32) { - if s == nil { - return - } - return s.Date -} - -// GetStatus returns value of Status field. -func (s *Supergroup) GetStatus() (value ChatMemberStatusClass) { - if s == nil { - return - } - return s.Status -} - -// GetMemberCount returns value of MemberCount field. -func (s *Supergroup) GetMemberCount() (value int32) { - if s == nil { - return - } - return s.MemberCount -} - -// GetBoostLevel returns value of BoostLevel field. -func (s *Supergroup) GetBoostLevel() (value int32) { - if s == nil { - return - } - return s.BoostLevel -} - -// GetHasLinkedChat returns value of HasLinkedChat field. -func (s *Supergroup) GetHasLinkedChat() (value bool) { - if s == nil { - return - } - return s.HasLinkedChat -} - -// GetHasLocation returns value of HasLocation field. -func (s *Supergroup) GetHasLocation() (value bool) { - if s == nil { - return - } - return s.HasLocation -} - -// GetSignMessages returns value of SignMessages field. -func (s *Supergroup) GetSignMessages() (value bool) { - if s == nil { - return - } - return s.SignMessages -} - -// GetShowMessageSender returns value of ShowMessageSender field. -func (s *Supergroup) GetShowMessageSender() (value bool) { - if s == nil { - return - } - return s.ShowMessageSender -} - -// GetJoinToSendMessages returns value of JoinToSendMessages field. -func (s *Supergroup) GetJoinToSendMessages() (value bool) { - if s == nil { - return - } - return s.JoinToSendMessages -} - -// GetJoinByRequest returns value of JoinByRequest field. -func (s *Supergroup) GetJoinByRequest() (value bool) { - if s == nil { - return - } - return s.JoinByRequest -} - -// GetIsSlowModeEnabled returns value of IsSlowModeEnabled field. -func (s *Supergroup) GetIsSlowModeEnabled() (value bool) { - if s == nil { - return - } - return s.IsSlowModeEnabled -} - -// GetIsChannel returns value of IsChannel field. -func (s *Supergroup) GetIsChannel() (value bool) { - if s == nil { - return - } - return s.IsChannel -} - -// GetIsBroadcastGroup returns value of IsBroadcastGroup field. -func (s *Supergroup) GetIsBroadcastGroup() (value bool) { - if s == nil { - return - } - return s.IsBroadcastGroup -} - -// GetIsForum returns value of IsForum field. -func (s *Supergroup) GetIsForum() (value bool) { - if s == nil { - return - } - return s.IsForum -} - -// GetVerificationStatus returns value of VerificationStatus field. -func (s *Supergroup) GetVerificationStatus() (value VerificationStatus) { - if s == nil { - return - } - return s.VerificationStatus -} - -// GetHasSensitiveContent returns value of HasSensitiveContent field. -func (s *Supergroup) GetHasSensitiveContent() (value bool) { - if s == nil { - return - } - return s.HasSensitiveContent -} - -// GetRestrictionReason returns value of RestrictionReason field. -func (s *Supergroup) GetRestrictionReason() (value string) { - if s == nil { - return - } - return s.RestrictionReason -} - -// GetHasActiveStories returns value of HasActiveStories field. -func (s *Supergroup) GetHasActiveStories() (value bool) { - if s == nil { - return - } - return s.HasActiveStories -} - -// GetHasUnreadActiveStories returns value of HasUnreadActiveStories field. -func (s *Supergroup) GetHasUnreadActiveStories() (value bool) { - if s == nil { - return - } - return s.HasUnreadActiveStories -} diff --git a/tdapi/tl_supergroup_members_filter_gen.go b/tdapi/tl_supergroup_members_filter_gen.go deleted file mode 100644 index 16e9323e9..000000000 --- a/tdapi/tl_supergroup_members_filter_gen.go +++ /dev/null @@ -1,1516 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SupergroupMembersFilterRecent represents TL type `supergroupMembersFilterRecent#4639e5d5`. -type SupergroupMembersFilterRecent struct { -} - -// SupergroupMembersFilterRecentTypeID is TL type id of SupergroupMembersFilterRecent. -const SupergroupMembersFilterRecentTypeID = 0x4639e5d5 - -// construct implements constructor of SupergroupMembersFilterClass. -func (s SupergroupMembersFilterRecent) construct() SupergroupMembersFilterClass { return &s } - -// Ensuring interfaces in compile-time for SupergroupMembersFilterRecent. -var ( - _ bin.Encoder = &SupergroupMembersFilterRecent{} - _ bin.Decoder = &SupergroupMembersFilterRecent{} - _ bin.BareEncoder = &SupergroupMembersFilterRecent{} - _ bin.BareDecoder = &SupergroupMembersFilterRecent{} - - _ SupergroupMembersFilterClass = &SupergroupMembersFilterRecent{} -) - -func (s *SupergroupMembersFilterRecent) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SupergroupMembersFilterRecent) String() string { - if s == nil { - return "SupergroupMembersFilterRecent(nil)" - } - type Alias SupergroupMembersFilterRecent - return fmt.Sprintf("SupergroupMembersFilterRecent%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SupergroupMembersFilterRecent) TypeID() uint32 { - return SupergroupMembersFilterRecentTypeID -} - -// TypeName returns name of type in TL schema. -func (*SupergroupMembersFilterRecent) TypeName() string { - return "supergroupMembersFilterRecent" -} - -// TypeInfo returns info about TL type. -func (s *SupergroupMembersFilterRecent) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "supergroupMembersFilterRecent", - ID: SupergroupMembersFilterRecentTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SupergroupMembersFilterRecent) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterRecent#4639e5d5 as nil") - } - b.PutID(SupergroupMembersFilterRecentTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SupergroupMembersFilterRecent) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterRecent#4639e5d5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SupergroupMembersFilterRecent) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterRecent#4639e5d5 to nil") - } - if err := b.ConsumeID(SupergroupMembersFilterRecentTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterRecent#4639e5d5: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SupergroupMembersFilterRecent) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterRecent#4639e5d5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SupergroupMembersFilterRecent) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterRecent#4639e5d5 as nil") - } - b.ObjStart() - b.PutID("supergroupMembersFilterRecent") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SupergroupMembersFilterRecent) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterRecent#4639e5d5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("supergroupMembersFilterRecent"); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterRecent#4639e5d5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SupergroupMembersFilterContacts represents TL type `supergroupMembersFilterContacts#b3885578`. -type SupergroupMembersFilterContacts struct { - // Query to search for - Query string -} - -// SupergroupMembersFilterContactsTypeID is TL type id of SupergroupMembersFilterContacts. -const SupergroupMembersFilterContactsTypeID = 0xb3885578 - -// construct implements constructor of SupergroupMembersFilterClass. -func (s SupergroupMembersFilterContacts) construct() SupergroupMembersFilterClass { return &s } - -// Ensuring interfaces in compile-time for SupergroupMembersFilterContacts. -var ( - _ bin.Encoder = &SupergroupMembersFilterContacts{} - _ bin.Decoder = &SupergroupMembersFilterContacts{} - _ bin.BareEncoder = &SupergroupMembersFilterContacts{} - _ bin.BareDecoder = &SupergroupMembersFilterContacts{} - - _ SupergroupMembersFilterClass = &SupergroupMembersFilterContacts{} -) - -func (s *SupergroupMembersFilterContacts) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SupergroupMembersFilterContacts) String() string { - if s == nil { - return "SupergroupMembersFilterContacts(nil)" - } - type Alias SupergroupMembersFilterContacts - return fmt.Sprintf("SupergroupMembersFilterContacts%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SupergroupMembersFilterContacts) TypeID() uint32 { - return SupergroupMembersFilterContactsTypeID -} - -// TypeName returns name of type in TL schema. -func (*SupergroupMembersFilterContacts) TypeName() string { - return "supergroupMembersFilterContacts" -} - -// TypeInfo returns info about TL type. -func (s *SupergroupMembersFilterContacts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "supergroupMembersFilterContacts", - ID: SupergroupMembersFilterContactsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SupergroupMembersFilterContacts) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterContacts#b3885578 as nil") - } - b.PutID(SupergroupMembersFilterContactsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SupergroupMembersFilterContacts) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterContacts#b3885578 as nil") - } - b.PutString(s.Query) - return nil -} - -// Decode implements bin.Decoder. -func (s *SupergroupMembersFilterContacts) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterContacts#b3885578 to nil") - } - if err := b.ConsumeID(SupergroupMembersFilterContactsTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterContacts#b3885578: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SupergroupMembersFilterContacts) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterContacts#b3885578 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterContacts#b3885578: field query: %w", err) - } - s.Query = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SupergroupMembersFilterContacts) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterContacts#b3885578 as nil") - } - b.ObjStart() - b.PutID("supergroupMembersFilterContacts") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SupergroupMembersFilterContacts) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterContacts#b3885578 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("supergroupMembersFilterContacts"); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterContacts#b3885578: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterContacts#b3885578: field query: %w", err) - } - s.Query = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SupergroupMembersFilterContacts) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// SupergroupMembersFilterAdministrators represents TL type `supergroupMembersFilterAdministrators#82fc8457`. -type SupergroupMembersFilterAdministrators struct { -} - -// SupergroupMembersFilterAdministratorsTypeID is TL type id of SupergroupMembersFilterAdministrators. -const SupergroupMembersFilterAdministratorsTypeID = 0x82fc8457 - -// construct implements constructor of SupergroupMembersFilterClass. -func (s SupergroupMembersFilterAdministrators) construct() SupergroupMembersFilterClass { return &s } - -// Ensuring interfaces in compile-time for SupergroupMembersFilterAdministrators. -var ( - _ bin.Encoder = &SupergroupMembersFilterAdministrators{} - _ bin.Decoder = &SupergroupMembersFilterAdministrators{} - _ bin.BareEncoder = &SupergroupMembersFilterAdministrators{} - _ bin.BareDecoder = &SupergroupMembersFilterAdministrators{} - - _ SupergroupMembersFilterClass = &SupergroupMembersFilterAdministrators{} -) - -func (s *SupergroupMembersFilterAdministrators) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SupergroupMembersFilterAdministrators) String() string { - if s == nil { - return "SupergroupMembersFilterAdministrators(nil)" - } - type Alias SupergroupMembersFilterAdministrators - return fmt.Sprintf("SupergroupMembersFilterAdministrators%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SupergroupMembersFilterAdministrators) TypeID() uint32 { - return SupergroupMembersFilterAdministratorsTypeID -} - -// TypeName returns name of type in TL schema. -func (*SupergroupMembersFilterAdministrators) TypeName() string { - return "supergroupMembersFilterAdministrators" -} - -// TypeInfo returns info about TL type. -func (s *SupergroupMembersFilterAdministrators) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "supergroupMembersFilterAdministrators", - ID: SupergroupMembersFilterAdministratorsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SupergroupMembersFilterAdministrators) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterAdministrators#82fc8457 as nil") - } - b.PutID(SupergroupMembersFilterAdministratorsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SupergroupMembersFilterAdministrators) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterAdministrators#82fc8457 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SupergroupMembersFilterAdministrators) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterAdministrators#82fc8457 to nil") - } - if err := b.ConsumeID(SupergroupMembersFilterAdministratorsTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterAdministrators#82fc8457: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SupergroupMembersFilterAdministrators) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterAdministrators#82fc8457 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SupergroupMembersFilterAdministrators) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterAdministrators#82fc8457 as nil") - } - b.ObjStart() - b.PutID("supergroupMembersFilterAdministrators") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SupergroupMembersFilterAdministrators) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterAdministrators#82fc8457 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("supergroupMembersFilterAdministrators"); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterAdministrators#82fc8457: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SupergroupMembersFilterSearch represents TL type `supergroupMembersFilterSearch#9ae39fbb`. -type SupergroupMembersFilterSearch struct { - // Query to search for - Query string -} - -// SupergroupMembersFilterSearchTypeID is TL type id of SupergroupMembersFilterSearch. -const SupergroupMembersFilterSearchTypeID = 0x9ae39fbb - -// construct implements constructor of SupergroupMembersFilterClass. -func (s SupergroupMembersFilterSearch) construct() SupergroupMembersFilterClass { return &s } - -// Ensuring interfaces in compile-time for SupergroupMembersFilterSearch. -var ( - _ bin.Encoder = &SupergroupMembersFilterSearch{} - _ bin.Decoder = &SupergroupMembersFilterSearch{} - _ bin.BareEncoder = &SupergroupMembersFilterSearch{} - _ bin.BareDecoder = &SupergroupMembersFilterSearch{} - - _ SupergroupMembersFilterClass = &SupergroupMembersFilterSearch{} -) - -func (s *SupergroupMembersFilterSearch) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SupergroupMembersFilterSearch) String() string { - if s == nil { - return "SupergroupMembersFilterSearch(nil)" - } - type Alias SupergroupMembersFilterSearch - return fmt.Sprintf("SupergroupMembersFilterSearch%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SupergroupMembersFilterSearch) TypeID() uint32 { - return SupergroupMembersFilterSearchTypeID -} - -// TypeName returns name of type in TL schema. -func (*SupergroupMembersFilterSearch) TypeName() string { - return "supergroupMembersFilterSearch" -} - -// TypeInfo returns info about TL type. -func (s *SupergroupMembersFilterSearch) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "supergroupMembersFilterSearch", - ID: SupergroupMembersFilterSearchTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SupergroupMembersFilterSearch) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterSearch#9ae39fbb as nil") - } - b.PutID(SupergroupMembersFilterSearchTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SupergroupMembersFilterSearch) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterSearch#9ae39fbb as nil") - } - b.PutString(s.Query) - return nil -} - -// Decode implements bin.Decoder. -func (s *SupergroupMembersFilterSearch) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterSearch#9ae39fbb to nil") - } - if err := b.ConsumeID(SupergroupMembersFilterSearchTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterSearch#9ae39fbb: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SupergroupMembersFilterSearch) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterSearch#9ae39fbb to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterSearch#9ae39fbb: field query: %w", err) - } - s.Query = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SupergroupMembersFilterSearch) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterSearch#9ae39fbb as nil") - } - b.ObjStart() - b.PutID("supergroupMembersFilterSearch") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SupergroupMembersFilterSearch) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterSearch#9ae39fbb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("supergroupMembersFilterSearch"); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterSearch#9ae39fbb: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterSearch#9ae39fbb: field query: %w", err) - } - s.Query = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SupergroupMembersFilterSearch) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// SupergroupMembersFilterRestricted represents TL type `supergroupMembersFilterRestricted#bdf8501e`. -type SupergroupMembersFilterRestricted struct { - // Query to search for - Query string -} - -// SupergroupMembersFilterRestrictedTypeID is TL type id of SupergroupMembersFilterRestricted. -const SupergroupMembersFilterRestrictedTypeID = 0xbdf8501e - -// construct implements constructor of SupergroupMembersFilterClass. -func (s SupergroupMembersFilterRestricted) construct() SupergroupMembersFilterClass { return &s } - -// Ensuring interfaces in compile-time for SupergroupMembersFilterRestricted. -var ( - _ bin.Encoder = &SupergroupMembersFilterRestricted{} - _ bin.Decoder = &SupergroupMembersFilterRestricted{} - _ bin.BareEncoder = &SupergroupMembersFilterRestricted{} - _ bin.BareDecoder = &SupergroupMembersFilterRestricted{} - - _ SupergroupMembersFilterClass = &SupergroupMembersFilterRestricted{} -) - -func (s *SupergroupMembersFilterRestricted) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SupergroupMembersFilterRestricted) String() string { - if s == nil { - return "SupergroupMembersFilterRestricted(nil)" - } - type Alias SupergroupMembersFilterRestricted - return fmt.Sprintf("SupergroupMembersFilterRestricted%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SupergroupMembersFilterRestricted) TypeID() uint32 { - return SupergroupMembersFilterRestrictedTypeID -} - -// TypeName returns name of type in TL schema. -func (*SupergroupMembersFilterRestricted) TypeName() string { - return "supergroupMembersFilterRestricted" -} - -// TypeInfo returns info about TL type. -func (s *SupergroupMembersFilterRestricted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "supergroupMembersFilterRestricted", - ID: SupergroupMembersFilterRestrictedTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SupergroupMembersFilterRestricted) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterRestricted#bdf8501e as nil") - } - b.PutID(SupergroupMembersFilterRestrictedTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SupergroupMembersFilterRestricted) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterRestricted#bdf8501e as nil") - } - b.PutString(s.Query) - return nil -} - -// Decode implements bin.Decoder. -func (s *SupergroupMembersFilterRestricted) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterRestricted#bdf8501e to nil") - } - if err := b.ConsumeID(SupergroupMembersFilterRestrictedTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterRestricted#bdf8501e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SupergroupMembersFilterRestricted) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterRestricted#bdf8501e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterRestricted#bdf8501e: field query: %w", err) - } - s.Query = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SupergroupMembersFilterRestricted) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterRestricted#bdf8501e as nil") - } - b.ObjStart() - b.PutID("supergroupMembersFilterRestricted") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SupergroupMembersFilterRestricted) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterRestricted#bdf8501e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("supergroupMembersFilterRestricted"); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterRestricted#bdf8501e: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterRestricted#bdf8501e: field query: %w", err) - } - s.Query = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SupergroupMembersFilterRestricted) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// SupergroupMembersFilterBanned represents TL type `supergroupMembersFilterBanned#b7d7610d`. -type SupergroupMembersFilterBanned struct { - // Query to search for - Query string -} - -// SupergroupMembersFilterBannedTypeID is TL type id of SupergroupMembersFilterBanned. -const SupergroupMembersFilterBannedTypeID = 0xb7d7610d - -// construct implements constructor of SupergroupMembersFilterClass. -func (s SupergroupMembersFilterBanned) construct() SupergroupMembersFilterClass { return &s } - -// Ensuring interfaces in compile-time for SupergroupMembersFilterBanned. -var ( - _ bin.Encoder = &SupergroupMembersFilterBanned{} - _ bin.Decoder = &SupergroupMembersFilterBanned{} - _ bin.BareEncoder = &SupergroupMembersFilterBanned{} - _ bin.BareDecoder = &SupergroupMembersFilterBanned{} - - _ SupergroupMembersFilterClass = &SupergroupMembersFilterBanned{} -) - -func (s *SupergroupMembersFilterBanned) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SupergroupMembersFilterBanned) String() string { - if s == nil { - return "SupergroupMembersFilterBanned(nil)" - } - type Alias SupergroupMembersFilterBanned - return fmt.Sprintf("SupergroupMembersFilterBanned%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SupergroupMembersFilterBanned) TypeID() uint32 { - return SupergroupMembersFilterBannedTypeID -} - -// TypeName returns name of type in TL schema. -func (*SupergroupMembersFilterBanned) TypeName() string { - return "supergroupMembersFilterBanned" -} - -// TypeInfo returns info about TL type. -func (s *SupergroupMembersFilterBanned) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "supergroupMembersFilterBanned", - ID: SupergroupMembersFilterBannedTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SupergroupMembersFilterBanned) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterBanned#b7d7610d as nil") - } - b.PutID(SupergroupMembersFilterBannedTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SupergroupMembersFilterBanned) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterBanned#b7d7610d as nil") - } - b.PutString(s.Query) - return nil -} - -// Decode implements bin.Decoder. -func (s *SupergroupMembersFilterBanned) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterBanned#b7d7610d to nil") - } - if err := b.ConsumeID(SupergroupMembersFilterBannedTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterBanned#b7d7610d: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SupergroupMembersFilterBanned) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterBanned#b7d7610d to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterBanned#b7d7610d: field query: %w", err) - } - s.Query = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SupergroupMembersFilterBanned) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterBanned#b7d7610d as nil") - } - b.ObjStart() - b.PutID("supergroupMembersFilterBanned") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SupergroupMembersFilterBanned) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterBanned#b7d7610d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("supergroupMembersFilterBanned"); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterBanned#b7d7610d: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterBanned#b7d7610d: field query: %w", err) - } - s.Query = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SupergroupMembersFilterBanned) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// SupergroupMembersFilterMention represents TL type `supergroupMembersFilterMention#3880091c`. -type SupergroupMembersFilterMention struct { - // Query to search for - Query string - // If non-zero, the identifier of the current message thread - MessageThreadID int64 -} - -// SupergroupMembersFilterMentionTypeID is TL type id of SupergroupMembersFilterMention. -const SupergroupMembersFilterMentionTypeID = 0x3880091c - -// construct implements constructor of SupergroupMembersFilterClass. -func (s SupergroupMembersFilterMention) construct() SupergroupMembersFilterClass { return &s } - -// Ensuring interfaces in compile-time for SupergroupMembersFilterMention. -var ( - _ bin.Encoder = &SupergroupMembersFilterMention{} - _ bin.Decoder = &SupergroupMembersFilterMention{} - _ bin.BareEncoder = &SupergroupMembersFilterMention{} - _ bin.BareDecoder = &SupergroupMembersFilterMention{} - - _ SupergroupMembersFilterClass = &SupergroupMembersFilterMention{} -) - -func (s *SupergroupMembersFilterMention) Zero() bool { - if s == nil { - return true - } - if !(s.Query == "") { - return false - } - if !(s.MessageThreadID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SupergroupMembersFilterMention) String() string { - if s == nil { - return "SupergroupMembersFilterMention(nil)" - } - type Alias SupergroupMembersFilterMention - return fmt.Sprintf("SupergroupMembersFilterMention%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SupergroupMembersFilterMention) TypeID() uint32 { - return SupergroupMembersFilterMentionTypeID -} - -// TypeName returns name of type in TL schema. -func (*SupergroupMembersFilterMention) TypeName() string { - return "supergroupMembersFilterMention" -} - -// TypeInfo returns info about TL type. -func (s *SupergroupMembersFilterMention) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "supergroupMembersFilterMention", - ID: SupergroupMembersFilterMentionTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SupergroupMembersFilterMention) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterMention#3880091c as nil") - } - b.PutID(SupergroupMembersFilterMentionTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SupergroupMembersFilterMention) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterMention#3880091c as nil") - } - b.PutString(s.Query) - b.PutInt53(s.MessageThreadID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SupergroupMembersFilterMention) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterMention#3880091c to nil") - } - if err := b.ConsumeID(SupergroupMembersFilterMentionTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterMention#3880091c: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SupergroupMembersFilterMention) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterMention#3880091c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterMention#3880091c: field query: %w", err) - } - s.Query = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterMention#3880091c: field message_thread_id: %w", err) - } - s.MessageThreadID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SupergroupMembersFilterMention) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterMention#3880091c as nil") - } - b.ObjStart() - b.PutID("supergroupMembersFilterMention") - b.Comma() - b.FieldStart("query") - b.PutString(s.Query) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(s.MessageThreadID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SupergroupMembersFilterMention) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterMention#3880091c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("supergroupMembersFilterMention"); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterMention#3880091c: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterMention#3880091c: field query: %w", err) - } - s.Query = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterMention#3880091c: field message_thread_id: %w", err) - } - s.MessageThreadID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetQuery returns value of Query field. -func (s *SupergroupMembersFilterMention) GetQuery() (value string) { - if s == nil { - return - } - return s.Query -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (s *SupergroupMembersFilterMention) GetMessageThreadID() (value int64) { - if s == nil { - return - } - return s.MessageThreadID -} - -// SupergroupMembersFilterBots represents TL type `supergroupMembersFilterBots#1d5571a6`. -type SupergroupMembersFilterBots struct { -} - -// SupergroupMembersFilterBotsTypeID is TL type id of SupergroupMembersFilterBots. -const SupergroupMembersFilterBotsTypeID = 0x1d5571a6 - -// construct implements constructor of SupergroupMembersFilterClass. -func (s SupergroupMembersFilterBots) construct() SupergroupMembersFilterClass { return &s } - -// Ensuring interfaces in compile-time for SupergroupMembersFilterBots. -var ( - _ bin.Encoder = &SupergroupMembersFilterBots{} - _ bin.Decoder = &SupergroupMembersFilterBots{} - _ bin.BareEncoder = &SupergroupMembersFilterBots{} - _ bin.BareDecoder = &SupergroupMembersFilterBots{} - - _ SupergroupMembersFilterClass = &SupergroupMembersFilterBots{} -) - -func (s *SupergroupMembersFilterBots) Zero() bool { - if s == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (s *SupergroupMembersFilterBots) String() string { - if s == nil { - return "SupergroupMembersFilterBots(nil)" - } - type Alias SupergroupMembersFilterBots - return fmt.Sprintf("SupergroupMembersFilterBots%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SupergroupMembersFilterBots) TypeID() uint32 { - return SupergroupMembersFilterBotsTypeID -} - -// TypeName returns name of type in TL schema. -func (*SupergroupMembersFilterBots) TypeName() string { - return "supergroupMembersFilterBots" -} - -// TypeInfo returns info about TL type. -func (s *SupergroupMembersFilterBots) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "supergroupMembersFilterBots", - ID: SupergroupMembersFilterBotsTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (s *SupergroupMembersFilterBots) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterBots#1d5571a6 as nil") - } - b.PutID(SupergroupMembersFilterBotsTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SupergroupMembersFilterBots) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterBots#1d5571a6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (s *SupergroupMembersFilterBots) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterBots#1d5571a6 to nil") - } - if err := b.ConsumeID(SupergroupMembersFilterBotsTypeID); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterBots#1d5571a6: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SupergroupMembersFilterBots) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterBots#1d5571a6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SupergroupMembersFilterBots) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode supergroupMembersFilterBots#1d5571a6 as nil") - } - b.ObjStart() - b.PutID("supergroupMembersFilterBots") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SupergroupMembersFilterBots) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode supergroupMembersFilterBots#1d5571a6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("supergroupMembersFilterBots"); err != nil { - return fmt.Errorf("unable to decode supergroupMembersFilterBots#1d5571a6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// SupergroupMembersFilterClassName is schema name of SupergroupMembersFilterClass. -const SupergroupMembersFilterClassName = "SupergroupMembersFilter" - -// SupergroupMembersFilterClass represents SupergroupMembersFilter generic type. -// -// Example: -// -// g, err := tdapi.DecodeSupergroupMembersFilter(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.SupergroupMembersFilterRecent: // supergroupMembersFilterRecent#4639e5d5 -// case *tdapi.SupergroupMembersFilterContacts: // supergroupMembersFilterContacts#b3885578 -// case *tdapi.SupergroupMembersFilterAdministrators: // supergroupMembersFilterAdministrators#82fc8457 -// case *tdapi.SupergroupMembersFilterSearch: // supergroupMembersFilterSearch#9ae39fbb -// case *tdapi.SupergroupMembersFilterRestricted: // supergroupMembersFilterRestricted#bdf8501e -// case *tdapi.SupergroupMembersFilterBanned: // supergroupMembersFilterBanned#b7d7610d -// case *tdapi.SupergroupMembersFilterMention: // supergroupMembersFilterMention#3880091c -// case *tdapi.SupergroupMembersFilterBots: // supergroupMembersFilterBots#1d5571a6 -// default: panic(v) -// } -type SupergroupMembersFilterClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() SupergroupMembersFilterClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeSupergroupMembersFilter implements binary de-serialization for SupergroupMembersFilterClass. -func DecodeSupergroupMembersFilter(buf *bin.Buffer) (SupergroupMembersFilterClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case SupergroupMembersFilterRecentTypeID: - // Decoding supergroupMembersFilterRecent#4639e5d5. - v := SupergroupMembersFilterRecent{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case SupergroupMembersFilterContactsTypeID: - // Decoding supergroupMembersFilterContacts#b3885578. - v := SupergroupMembersFilterContacts{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case SupergroupMembersFilterAdministratorsTypeID: - // Decoding supergroupMembersFilterAdministrators#82fc8457. - v := SupergroupMembersFilterAdministrators{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case SupergroupMembersFilterSearchTypeID: - // Decoding supergroupMembersFilterSearch#9ae39fbb. - v := SupergroupMembersFilterSearch{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case SupergroupMembersFilterRestrictedTypeID: - // Decoding supergroupMembersFilterRestricted#bdf8501e. - v := SupergroupMembersFilterRestricted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case SupergroupMembersFilterBannedTypeID: - // Decoding supergroupMembersFilterBanned#b7d7610d. - v := SupergroupMembersFilterBanned{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case SupergroupMembersFilterMentionTypeID: - // Decoding supergroupMembersFilterMention#3880091c. - v := SupergroupMembersFilterMention{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case SupergroupMembersFilterBotsTypeID: - // Decoding supergroupMembersFilterBots#1d5571a6. - v := SupergroupMembersFilterBots{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONSupergroupMembersFilter implements binary de-serialization for SupergroupMembersFilterClass. -func DecodeTDLibJSONSupergroupMembersFilter(buf tdjson.Decoder) (SupergroupMembersFilterClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "supergroupMembersFilterRecent": - // Decoding supergroupMembersFilterRecent#4639e5d5. - v := SupergroupMembersFilterRecent{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case "supergroupMembersFilterContacts": - // Decoding supergroupMembersFilterContacts#b3885578. - v := SupergroupMembersFilterContacts{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case "supergroupMembersFilterAdministrators": - // Decoding supergroupMembersFilterAdministrators#82fc8457. - v := SupergroupMembersFilterAdministrators{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case "supergroupMembersFilterSearch": - // Decoding supergroupMembersFilterSearch#9ae39fbb. - v := SupergroupMembersFilterSearch{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case "supergroupMembersFilterRestricted": - // Decoding supergroupMembersFilterRestricted#bdf8501e. - v := SupergroupMembersFilterRestricted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case "supergroupMembersFilterBanned": - // Decoding supergroupMembersFilterBanned#b7d7610d. - v := SupergroupMembersFilterBanned{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case "supergroupMembersFilterMention": - // Decoding supergroupMembersFilterMention#3880091c. - v := SupergroupMembersFilterMention{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - case "supergroupMembersFilterBots": - // Decoding supergroupMembersFilterBots#1d5571a6. - v := SupergroupMembersFilterBots{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode SupergroupMembersFilterClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// SupergroupMembersFilter boxes the SupergroupMembersFilterClass providing a helper. -type SupergroupMembersFilterBox struct { - SupergroupMembersFilter SupergroupMembersFilterClass -} - -// Decode implements bin.Decoder for SupergroupMembersFilterBox. -func (b *SupergroupMembersFilterBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode SupergroupMembersFilterBox to nil") - } - v, err := DecodeSupergroupMembersFilter(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SupergroupMembersFilter = v - return nil -} - -// Encode implements bin.Encode for SupergroupMembersFilterBox. -func (b *SupergroupMembersFilterBox) Encode(buf *bin.Buffer) error { - if b == nil || b.SupergroupMembersFilter == nil { - return fmt.Errorf("unable to encode SupergroupMembersFilterClass as nil") - } - return b.SupergroupMembersFilter.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for SupergroupMembersFilterBox. -func (b *SupergroupMembersFilterBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode SupergroupMembersFilterBox to nil") - } - v, err := DecodeTDLibJSONSupergroupMembersFilter(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.SupergroupMembersFilter = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for SupergroupMembersFilterBox. -func (b *SupergroupMembersFilterBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.SupergroupMembersFilter == nil { - return fmt.Errorf("unable to encode SupergroupMembersFilterClass as nil") - } - return b.SupergroupMembersFilter.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_synchronize_language_pack_gen.go b/tdapi/tl_synchronize_language_pack_gen.go deleted file mode 100644 index da0de97ea..000000000 --- a/tdapi/tl_synchronize_language_pack_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// SynchronizeLanguagePackRequest represents TL type `synchronizeLanguagePack#84e5e72e`. -type SynchronizeLanguagePackRequest struct { - // Language pack identifier - LanguagePackID string -} - -// SynchronizeLanguagePackRequestTypeID is TL type id of SynchronizeLanguagePackRequest. -const SynchronizeLanguagePackRequestTypeID = 0x84e5e72e - -// Ensuring interfaces in compile-time for SynchronizeLanguagePackRequest. -var ( - _ bin.Encoder = &SynchronizeLanguagePackRequest{} - _ bin.Decoder = &SynchronizeLanguagePackRequest{} - _ bin.BareEncoder = &SynchronizeLanguagePackRequest{} - _ bin.BareDecoder = &SynchronizeLanguagePackRequest{} -) - -func (s *SynchronizeLanguagePackRequest) Zero() bool { - if s == nil { - return true - } - if !(s.LanguagePackID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (s *SynchronizeLanguagePackRequest) String() string { - if s == nil { - return "SynchronizeLanguagePackRequest(nil)" - } - type Alias SynchronizeLanguagePackRequest - return fmt.Sprintf("SynchronizeLanguagePackRequest%+v", Alias(*s)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*SynchronizeLanguagePackRequest) TypeID() uint32 { - return SynchronizeLanguagePackRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*SynchronizeLanguagePackRequest) TypeName() string { - return "synchronizeLanguagePack" -} - -// TypeInfo returns info about TL type. -func (s *SynchronizeLanguagePackRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "synchronizeLanguagePack", - ID: SynchronizeLanguagePackRequestTypeID, - } - if s == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LanguagePackID", - SchemaName: "language_pack_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (s *SynchronizeLanguagePackRequest) Encode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode synchronizeLanguagePack#84e5e72e as nil") - } - b.PutID(SynchronizeLanguagePackRequestTypeID) - return s.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (s *SynchronizeLanguagePackRequest) EncodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't encode synchronizeLanguagePack#84e5e72e as nil") - } - b.PutString(s.LanguagePackID) - return nil -} - -// Decode implements bin.Decoder. -func (s *SynchronizeLanguagePackRequest) Decode(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode synchronizeLanguagePack#84e5e72e to nil") - } - if err := b.ConsumeID(SynchronizeLanguagePackRequestTypeID); err != nil { - return fmt.Errorf("unable to decode synchronizeLanguagePack#84e5e72e: %w", err) - } - return s.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (s *SynchronizeLanguagePackRequest) DecodeBare(b *bin.Buffer) error { - if s == nil { - return fmt.Errorf("can't decode synchronizeLanguagePack#84e5e72e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode synchronizeLanguagePack#84e5e72e: field language_pack_id: %w", err) - } - s.LanguagePackID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (s *SynchronizeLanguagePackRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if s == nil { - return fmt.Errorf("can't encode synchronizeLanguagePack#84e5e72e as nil") - } - b.ObjStart() - b.PutID("synchronizeLanguagePack") - b.Comma() - b.FieldStart("language_pack_id") - b.PutString(s.LanguagePackID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (s *SynchronizeLanguagePackRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if s == nil { - return fmt.Errorf("can't decode synchronizeLanguagePack#84e5e72e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("synchronizeLanguagePack"); err != nil { - return fmt.Errorf("unable to decode synchronizeLanguagePack#84e5e72e: %w", err) - } - case "language_pack_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode synchronizeLanguagePack#84e5e72e: field language_pack_id: %w", err) - } - s.LanguagePackID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguagePackID returns value of LanguagePackID field. -func (s *SynchronizeLanguagePackRequest) GetLanguagePackID() (value string) { - if s == nil { - return - } - return s.LanguagePackID -} - -// SynchronizeLanguagePack invokes method synchronizeLanguagePack#84e5e72e returning error if any. -func (c *Client) SynchronizeLanguagePack(ctx context.Context, languagepackid string) error { - var ok Ok - - request := &SynchronizeLanguagePackRequest{ - LanguagePackID: languagepackid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_t_me_url_gen.go b/tdapi/tl_t_me_url_gen.go deleted file mode 100644 index cf3baf691..000000000 --- a/tdapi/tl_t_me_url_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TMeURL represents TL type `tMeUrl#bc00fa42`. -type TMeURL struct { - // URL - URL string - // Type of the URL - Type TMeURLTypeClass -} - -// TMeURLTypeID is TL type id of TMeURL. -const TMeURLTypeID = 0xbc00fa42 - -// Ensuring interfaces in compile-time for TMeURL. -var ( - _ bin.Encoder = &TMeURL{} - _ bin.Decoder = &TMeURL{} - _ bin.BareEncoder = &TMeURL{} - _ bin.BareDecoder = &TMeURL{} -) - -func (t *TMeURL) Zero() bool { - if t == nil { - return true - } - if !(t.URL == "") { - return false - } - if !(t.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TMeURL) String() string { - if t == nil { - return "TMeURL(nil)" - } - type Alias TMeURL - return fmt.Sprintf("TMeURL%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TMeURL) TypeID() uint32 { - return TMeURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*TMeURL) TypeName() string { - return "tMeUrl" -} - -// TypeInfo returns info about TL type. -func (t *TMeURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "tMeUrl", - ID: TMeURLTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TMeURL) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrl#bc00fa42 as nil") - } - b.PutID(TMeURLTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TMeURL) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrl#bc00fa42 as nil") - } - b.PutString(t.URL) - if t.Type == nil { - return fmt.Errorf("unable to encode tMeUrl#bc00fa42: field type is nil") - } - if err := t.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode tMeUrl#bc00fa42: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TMeURL) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrl#bc00fa42 to nil") - } - if err := b.ConsumeID(TMeURLTypeID); err != nil { - return fmt.Errorf("unable to decode tMeUrl#bc00fa42: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TMeURL) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrl#bc00fa42 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode tMeUrl#bc00fa42: field url: %w", err) - } - t.URL = value - } - { - value, err := DecodeTMeURLType(b) - if err != nil { - return fmt.Errorf("unable to decode tMeUrl#bc00fa42: field type: %w", err) - } - t.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TMeURL) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrl#bc00fa42 as nil") - } - b.ObjStart() - b.PutID("tMeUrl") - b.Comma() - b.FieldStart("url") - b.PutString(t.URL) - b.Comma() - b.FieldStart("type") - if t.Type == nil { - return fmt.Errorf("unable to encode tMeUrl#bc00fa42: field type is nil") - } - if err := t.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode tMeUrl#bc00fa42: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TMeURL) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrl#bc00fa42 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("tMeUrl"); err != nil { - return fmt.Errorf("unable to decode tMeUrl#bc00fa42: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode tMeUrl#bc00fa42: field url: %w", err) - } - t.URL = value - case "type": - value, err := DecodeTDLibJSONTMeURLType(b) - if err != nil { - return fmt.Errorf("unable to decode tMeUrl#bc00fa42: field type: %w", err) - } - t.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (t *TMeURL) GetURL() (value string) { - if t == nil { - return - } - return t.URL -} - -// GetType returns value of Type field. -func (t *TMeURL) GetType() (value TMeURLTypeClass) { - if t == nil { - return - } - return t.Type -} diff --git a/tdapi/tl_t_me_url_type_gen.go b/tdapi/tl_t_me_url_type_gen.go deleted file mode 100644 index 8837c240f..000000000 --- a/tdapi/tl_t_me_url_type_gen.go +++ /dev/null @@ -1,863 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TMeURLTypeUser represents TL type `tMeUrlTypeUser#7787c1a`. -type TMeURLTypeUser struct { - // Identifier of the user - UserID int64 -} - -// TMeURLTypeUserTypeID is TL type id of TMeURLTypeUser. -const TMeURLTypeUserTypeID = 0x7787c1a - -// construct implements constructor of TMeURLTypeClass. -func (t TMeURLTypeUser) construct() TMeURLTypeClass { return &t } - -// Ensuring interfaces in compile-time for TMeURLTypeUser. -var ( - _ bin.Encoder = &TMeURLTypeUser{} - _ bin.Decoder = &TMeURLTypeUser{} - _ bin.BareEncoder = &TMeURLTypeUser{} - _ bin.BareDecoder = &TMeURLTypeUser{} - - _ TMeURLTypeClass = &TMeURLTypeUser{} -) - -func (t *TMeURLTypeUser) Zero() bool { - if t == nil { - return true - } - if !(t.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TMeURLTypeUser) String() string { - if t == nil { - return "TMeURLTypeUser(nil)" - } - type Alias TMeURLTypeUser - return fmt.Sprintf("TMeURLTypeUser%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TMeURLTypeUser) TypeID() uint32 { - return TMeURLTypeUserTypeID -} - -// TypeName returns name of type in TL schema. -func (*TMeURLTypeUser) TypeName() string { - return "tMeUrlTypeUser" -} - -// TypeInfo returns info about TL type. -func (t *TMeURLTypeUser) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "tMeUrlTypeUser", - ID: TMeURLTypeUserTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TMeURLTypeUser) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeUser#7787c1a as nil") - } - b.PutID(TMeURLTypeUserTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TMeURLTypeUser) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeUser#7787c1a as nil") - } - b.PutInt53(t.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (t *TMeURLTypeUser) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeUser#7787c1a to nil") - } - if err := b.ConsumeID(TMeURLTypeUserTypeID); err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeUser#7787c1a: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TMeURLTypeUser) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeUser#7787c1a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeUser#7787c1a: field user_id: %w", err) - } - t.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TMeURLTypeUser) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeUser#7787c1a as nil") - } - b.ObjStart() - b.PutID("tMeUrlTypeUser") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(t.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TMeURLTypeUser) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeUser#7787c1a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("tMeUrlTypeUser"); err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeUser#7787c1a: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeUser#7787c1a: field user_id: %w", err) - } - t.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (t *TMeURLTypeUser) GetUserID() (value int64) { - if t == nil { - return - } - return t.UserID -} - -// TMeURLTypeSupergroup represents TL type `tMeUrlTypeSupergroup#af5536a8`. -type TMeURLTypeSupergroup struct { - // Identifier of the supergroup or channel - SupergroupID int64 -} - -// TMeURLTypeSupergroupTypeID is TL type id of TMeURLTypeSupergroup. -const TMeURLTypeSupergroupTypeID = 0xaf5536a8 - -// construct implements constructor of TMeURLTypeClass. -func (t TMeURLTypeSupergroup) construct() TMeURLTypeClass { return &t } - -// Ensuring interfaces in compile-time for TMeURLTypeSupergroup. -var ( - _ bin.Encoder = &TMeURLTypeSupergroup{} - _ bin.Decoder = &TMeURLTypeSupergroup{} - _ bin.BareEncoder = &TMeURLTypeSupergroup{} - _ bin.BareDecoder = &TMeURLTypeSupergroup{} - - _ TMeURLTypeClass = &TMeURLTypeSupergroup{} -) - -func (t *TMeURLTypeSupergroup) Zero() bool { - if t == nil { - return true - } - if !(t.SupergroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TMeURLTypeSupergroup) String() string { - if t == nil { - return "TMeURLTypeSupergroup(nil)" - } - type Alias TMeURLTypeSupergroup - return fmt.Sprintf("TMeURLTypeSupergroup%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TMeURLTypeSupergroup) TypeID() uint32 { - return TMeURLTypeSupergroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*TMeURLTypeSupergroup) TypeName() string { - return "tMeUrlTypeSupergroup" -} - -// TypeInfo returns info about TL type. -func (t *TMeURLTypeSupergroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "tMeUrlTypeSupergroup", - ID: TMeURLTypeSupergroupTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TMeURLTypeSupergroup) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeSupergroup#af5536a8 as nil") - } - b.PutID(TMeURLTypeSupergroupTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TMeURLTypeSupergroup) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeSupergroup#af5536a8 as nil") - } - b.PutInt53(t.SupergroupID) - return nil -} - -// Decode implements bin.Decoder. -func (t *TMeURLTypeSupergroup) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeSupergroup#af5536a8 to nil") - } - if err := b.ConsumeID(TMeURLTypeSupergroupTypeID); err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeSupergroup#af5536a8: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TMeURLTypeSupergroup) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeSupergroup#af5536a8 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeSupergroup#af5536a8: field supergroup_id: %w", err) - } - t.SupergroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TMeURLTypeSupergroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeSupergroup#af5536a8 as nil") - } - b.ObjStart() - b.PutID("tMeUrlTypeSupergroup") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(t.SupergroupID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TMeURLTypeSupergroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeSupergroup#af5536a8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("tMeUrlTypeSupergroup"); err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeSupergroup#af5536a8: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeSupergroup#af5536a8: field supergroup_id: %w", err) - } - t.SupergroupID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (t *TMeURLTypeSupergroup) GetSupergroupID() (value int64) { - if t == nil { - return - } - return t.SupergroupID -} - -// TMeURLTypeChatInvite represents TL type `tMeUrlTypeChatInvite#12b5da49`. -type TMeURLTypeChatInvite struct { - // Information about the chat invite link - Info ChatInviteLinkInfo -} - -// TMeURLTypeChatInviteTypeID is TL type id of TMeURLTypeChatInvite. -const TMeURLTypeChatInviteTypeID = 0x12b5da49 - -// construct implements constructor of TMeURLTypeClass. -func (t TMeURLTypeChatInvite) construct() TMeURLTypeClass { return &t } - -// Ensuring interfaces in compile-time for TMeURLTypeChatInvite. -var ( - _ bin.Encoder = &TMeURLTypeChatInvite{} - _ bin.Decoder = &TMeURLTypeChatInvite{} - _ bin.BareEncoder = &TMeURLTypeChatInvite{} - _ bin.BareDecoder = &TMeURLTypeChatInvite{} - - _ TMeURLTypeClass = &TMeURLTypeChatInvite{} -) - -func (t *TMeURLTypeChatInvite) Zero() bool { - if t == nil { - return true - } - if !(t.Info.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TMeURLTypeChatInvite) String() string { - if t == nil { - return "TMeURLTypeChatInvite(nil)" - } - type Alias TMeURLTypeChatInvite - return fmt.Sprintf("TMeURLTypeChatInvite%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TMeURLTypeChatInvite) TypeID() uint32 { - return TMeURLTypeChatInviteTypeID -} - -// TypeName returns name of type in TL schema. -func (*TMeURLTypeChatInvite) TypeName() string { - return "tMeUrlTypeChatInvite" -} - -// TypeInfo returns info about TL type. -func (t *TMeURLTypeChatInvite) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "tMeUrlTypeChatInvite", - ID: TMeURLTypeChatInviteTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Info", - SchemaName: "info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TMeURLTypeChatInvite) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeChatInvite#12b5da49 as nil") - } - b.PutID(TMeURLTypeChatInviteTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TMeURLTypeChatInvite) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeChatInvite#12b5da49 as nil") - } - if err := t.Info.Encode(b); err != nil { - return fmt.Errorf("unable to encode tMeUrlTypeChatInvite#12b5da49: field info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TMeURLTypeChatInvite) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeChatInvite#12b5da49 to nil") - } - if err := b.ConsumeID(TMeURLTypeChatInviteTypeID); err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeChatInvite#12b5da49: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TMeURLTypeChatInvite) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeChatInvite#12b5da49 to nil") - } - { - if err := t.Info.Decode(b); err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeChatInvite#12b5da49: field info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TMeURLTypeChatInvite) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeChatInvite#12b5da49 as nil") - } - b.ObjStart() - b.PutID("tMeUrlTypeChatInvite") - b.Comma() - b.FieldStart("info") - if err := t.Info.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode tMeUrlTypeChatInvite#12b5da49: field info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TMeURLTypeChatInvite) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeChatInvite#12b5da49 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("tMeUrlTypeChatInvite"); err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeChatInvite#12b5da49: %w", err) - } - case "info": - if err := t.Info.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeChatInvite#12b5da49: field info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetInfo returns value of Info field. -func (t *TMeURLTypeChatInvite) GetInfo() (value ChatInviteLinkInfo) { - if t == nil { - return - } - return t.Info -} - -// TMeURLTypeStickerSet represents TL type `tMeUrlTypeStickerSet#5f83ccec`. -type TMeURLTypeStickerSet struct { - // Identifier of the sticker set - StickerSetID int64 -} - -// TMeURLTypeStickerSetTypeID is TL type id of TMeURLTypeStickerSet. -const TMeURLTypeStickerSetTypeID = 0x5f83ccec - -// construct implements constructor of TMeURLTypeClass. -func (t TMeURLTypeStickerSet) construct() TMeURLTypeClass { return &t } - -// Ensuring interfaces in compile-time for TMeURLTypeStickerSet. -var ( - _ bin.Encoder = &TMeURLTypeStickerSet{} - _ bin.Decoder = &TMeURLTypeStickerSet{} - _ bin.BareEncoder = &TMeURLTypeStickerSet{} - _ bin.BareDecoder = &TMeURLTypeStickerSet{} - - _ TMeURLTypeClass = &TMeURLTypeStickerSet{} -) - -func (t *TMeURLTypeStickerSet) Zero() bool { - if t == nil { - return true - } - if !(t.StickerSetID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TMeURLTypeStickerSet) String() string { - if t == nil { - return "TMeURLTypeStickerSet(nil)" - } - type Alias TMeURLTypeStickerSet - return fmt.Sprintf("TMeURLTypeStickerSet%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TMeURLTypeStickerSet) TypeID() uint32 { - return TMeURLTypeStickerSetTypeID -} - -// TypeName returns name of type in TL schema. -func (*TMeURLTypeStickerSet) TypeName() string { - return "tMeUrlTypeStickerSet" -} - -// TypeInfo returns info about TL type. -func (t *TMeURLTypeStickerSet) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "tMeUrlTypeStickerSet", - ID: TMeURLTypeStickerSetTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerSetID", - SchemaName: "sticker_set_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TMeURLTypeStickerSet) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeStickerSet#5f83ccec as nil") - } - b.PutID(TMeURLTypeStickerSetTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TMeURLTypeStickerSet) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeStickerSet#5f83ccec as nil") - } - b.PutLong(t.StickerSetID) - return nil -} - -// Decode implements bin.Decoder. -func (t *TMeURLTypeStickerSet) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeStickerSet#5f83ccec to nil") - } - if err := b.ConsumeID(TMeURLTypeStickerSetTypeID); err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeStickerSet#5f83ccec: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TMeURLTypeStickerSet) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeStickerSet#5f83ccec to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeStickerSet#5f83ccec: field sticker_set_id: %w", err) - } - t.StickerSetID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TMeURLTypeStickerSet) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrlTypeStickerSet#5f83ccec as nil") - } - b.ObjStart() - b.PutID("tMeUrlTypeStickerSet") - b.Comma() - b.FieldStart("sticker_set_id") - b.PutLong(t.StickerSetID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TMeURLTypeStickerSet) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrlTypeStickerSet#5f83ccec to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("tMeUrlTypeStickerSet"); err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeStickerSet#5f83ccec: %w", err) - } - case "sticker_set_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode tMeUrlTypeStickerSet#5f83ccec: field sticker_set_id: %w", err) - } - t.StickerSetID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerSetID returns value of StickerSetID field. -func (t *TMeURLTypeStickerSet) GetStickerSetID() (value int64) { - if t == nil { - return - } - return t.StickerSetID -} - -// TMeURLTypeClassName is schema name of TMeURLTypeClass. -const TMeURLTypeClassName = "TMeUrlType" - -// TMeURLTypeClass represents TMeUrlType generic type. -// -// Example: -// -// g, err := tdapi.DecodeTMeURLType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.TMeURLTypeUser: // tMeUrlTypeUser#7787c1a -// case *tdapi.TMeURLTypeSupergroup: // tMeUrlTypeSupergroup#af5536a8 -// case *tdapi.TMeURLTypeChatInvite: // tMeUrlTypeChatInvite#12b5da49 -// case *tdapi.TMeURLTypeStickerSet: // tMeUrlTypeStickerSet#5f83ccec -// default: panic(v) -// } -type TMeURLTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() TMeURLTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeTMeURLType implements binary de-serialization for TMeURLTypeClass. -func DecodeTMeURLType(buf *bin.Buffer) (TMeURLTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case TMeURLTypeUserTypeID: - // Decoding tMeUrlTypeUser#7787c1a. - v := TMeURLTypeUser{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TMeURLTypeClass: %w", err) - } - return &v, nil - case TMeURLTypeSupergroupTypeID: - // Decoding tMeUrlTypeSupergroup#af5536a8. - v := TMeURLTypeSupergroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TMeURLTypeClass: %w", err) - } - return &v, nil - case TMeURLTypeChatInviteTypeID: - // Decoding tMeUrlTypeChatInvite#12b5da49. - v := TMeURLTypeChatInvite{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TMeURLTypeClass: %w", err) - } - return &v, nil - case TMeURLTypeStickerSetTypeID: - // Decoding tMeUrlTypeStickerSet#5f83ccec. - v := TMeURLTypeStickerSet{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TMeURLTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TMeURLTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONTMeURLType implements binary de-serialization for TMeURLTypeClass. -func DecodeTDLibJSONTMeURLType(buf tdjson.Decoder) (TMeURLTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "tMeUrlTypeUser": - // Decoding tMeUrlTypeUser#7787c1a. - v := TMeURLTypeUser{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TMeURLTypeClass: %w", err) - } - return &v, nil - case "tMeUrlTypeSupergroup": - // Decoding tMeUrlTypeSupergroup#af5536a8. - v := TMeURLTypeSupergroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TMeURLTypeClass: %w", err) - } - return &v, nil - case "tMeUrlTypeChatInvite": - // Decoding tMeUrlTypeChatInvite#12b5da49. - v := TMeURLTypeChatInvite{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TMeURLTypeClass: %w", err) - } - return &v, nil - case "tMeUrlTypeStickerSet": - // Decoding tMeUrlTypeStickerSet#5f83ccec. - v := TMeURLTypeStickerSet{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TMeURLTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TMeURLTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// TMeURLType boxes the TMeURLTypeClass providing a helper. -type TMeURLTypeBox struct { - TMeUrlType TMeURLTypeClass -} - -// Decode implements bin.Decoder for TMeURLTypeBox. -func (b *TMeURLTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode TMeURLTypeBox to nil") - } - v, err := DecodeTMeURLType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TMeUrlType = v - return nil -} - -// Encode implements bin.Encode for TMeURLTypeBox. -func (b *TMeURLTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.TMeUrlType == nil { - return fmt.Errorf("unable to encode TMeURLTypeClass as nil") - } - return b.TMeUrlType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for TMeURLTypeBox. -func (b *TMeURLTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode TMeURLTypeBox to nil") - } - v, err := DecodeTDLibJSONTMeURLType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TMeUrlType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for TMeURLTypeBox. -func (b *TMeURLTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.TMeUrlType == nil { - return fmt.Errorf("unable to encode TMeURLTypeClass as nil") - } - return b.TMeUrlType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_t_me_urls_gen.go b/tdapi/tl_t_me_urls_gen.go deleted file mode 100644 index c58175f1d..000000000 --- a/tdapi/tl_t_me_urls_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TMeURLs represents TL type `tMeUrls#655b1f52`. -type TMeURLs struct { - // List of URLs - URLs []TMeURL -} - -// TMeURLsTypeID is TL type id of TMeURLs. -const TMeURLsTypeID = 0x655b1f52 - -// Ensuring interfaces in compile-time for TMeURLs. -var ( - _ bin.Encoder = &TMeURLs{} - _ bin.Decoder = &TMeURLs{} - _ bin.BareEncoder = &TMeURLs{} - _ bin.BareDecoder = &TMeURLs{} -) - -func (t *TMeURLs) Zero() bool { - if t == nil { - return true - } - if !(t.URLs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TMeURLs) String() string { - if t == nil { - return "TMeURLs(nil)" - } - type Alias TMeURLs - return fmt.Sprintf("TMeURLs%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TMeURLs) TypeID() uint32 { - return TMeURLsTypeID -} - -// TypeName returns name of type in TL schema. -func (*TMeURLs) TypeName() string { - return "tMeUrls" -} - -// TypeInfo returns info about TL type. -func (t *TMeURLs) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "tMeUrls", - ID: TMeURLsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URLs", - SchemaName: "urls", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TMeURLs) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrls#655b1f52 as nil") - } - b.PutID(TMeURLsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TMeURLs) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrls#655b1f52 as nil") - } - b.PutInt(len(t.URLs)) - for idx, v := range t.URLs { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare tMeUrls#655b1f52: field urls element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TMeURLs) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrls#655b1f52 to nil") - } - if err := b.ConsumeID(TMeURLsTypeID); err != nil { - return fmt.Errorf("unable to decode tMeUrls#655b1f52: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TMeURLs) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrls#655b1f52 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode tMeUrls#655b1f52: field urls: %w", err) - } - - if headerLen > 0 { - t.URLs = make([]TMeURL, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value TMeURL - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare tMeUrls#655b1f52: field urls: %w", err) - } - t.URLs = append(t.URLs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TMeURLs) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode tMeUrls#655b1f52 as nil") - } - b.ObjStart() - b.PutID("tMeUrls") - b.Comma() - b.FieldStart("urls") - b.ArrStart() - for idx, v := range t.URLs { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode tMeUrls#655b1f52: field urls element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TMeURLs) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode tMeUrls#655b1f52 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("tMeUrls"); err != nil { - return fmt.Errorf("unable to decode tMeUrls#655b1f52: %w", err) - } - case "urls": - if err := b.Arr(func(b tdjson.Decoder) error { - var value TMeURL - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode tMeUrls#655b1f52: field urls: %w", err) - } - t.URLs = append(t.URLs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode tMeUrls#655b1f52: field urls: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetURLs returns value of URLs field. -func (t *TMeURLs) GetURLs() (value []TMeURL) { - if t == nil { - return - } - return t.URLs -} diff --git a/tdapi/tl_target_chat_gen.go b/tdapi/tl_target_chat_gen.go deleted file mode 100644 index c333bf9ea..000000000 --- a/tdapi/tl_target_chat_gen.go +++ /dev/null @@ -1,657 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TargetChatCurrent represents TL type `targetChatCurrent#e729d110`. -type TargetChatCurrent struct { -} - -// TargetChatCurrentTypeID is TL type id of TargetChatCurrent. -const TargetChatCurrentTypeID = 0xe729d110 - -// construct implements constructor of TargetChatClass. -func (t TargetChatCurrent) construct() TargetChatClass { return &t } - -// Ensuring interfaces in compile-time for TargetChatCurrent. -var ( - _ bin.Encoder = &TargetChatCurrent{} - _ bin.Decoder = &TargetChatCurrent{} - _ bin.BareEncoder = &TargetChatCurrent{} - _ bin.BareDecoder = &TargetChatCurrent{} - - _ TargetChatClass = &TargetChatCurrent{} -) - -func (t *TargetChatCurrent) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TargetChatCurrent) String() string { - if t == nil { - return "TargetChatCurrent(nil)" - } - type Alias TargetChatCurrent - return fmt.Sprintf("TargetChatCurrent%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TargetChatCurrent) TypeID() uint32 { - return TargetChatCurrentTypeID -} - -// TypeName returns name of type in TL schema. -func (*TargetChatCurrent) TypeName() string { - return "targetChatCurrent" -} - -// TypeInfo returns info about TL type. -func (t *TargetChatCurrent) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "targetChatCurrent", - ID: TargetChatCurrentTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TargetChatCurrent) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode targetChatCurrent#e729d110 as nil") - } - b.PutID(TargetChatCurrentTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TargetChatCurrent) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode targetChatCurrent#e729d110 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TargetChatCurrent) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode targetChatCurrent#e729d110 to nil") - } - if err := b.ConsumeID(TargetChatCurrentTypeID); err != nil { - return fmt.Errorf("unable to decode targetChatCurrent#e729d110: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TargetChatCurrent) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode targetChatCurrent#e729d110 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TargetChatCurrent) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode targetChatCurrent#e729d110 as nil") - } - b.ObjStart() - b.PutID("targetChatCurrent") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TargetChatCurrent) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode targetChatCurrent#e729d110 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("targetChatCurrent"); err != nil { - return fmt.Errorf("unable to decode targetChatCurrent#e729d110: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TargetChatChosen represents TL type `targetChatChosen#acf8d5a6`. -type TargetChatChosen struct { - // Allowed types for the chat - Types TargetChatTypes -} - -// TargetChatChosenTypeID is TL type id of TargetChatChosen. -const TargetChatChosenTypeID = 0xacf8d5a6 - -// construct implements constructor of TargetChatClass. -func (t TargetChatChosen) construct() TargetChatClass { return &t } - -// Ensuring interfaces in compile-time for TargetChatChosen. -var ( - _ bin.Encoder = &TargetChatChosen{} - _ bin.Decoder = &TargetChatChosen{} - _ bin.BareEncoder = &TargetChatChosen{} - _ bin.BareDecoder = &TargetChatChosen{} - - _ TargetChatClass = &TargetChatChosen{} -) - -func (t *TargetChatChosen) Zero() bool { - if t == nil { - return true - } - if !(t.Types.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TargetChatChosen) String() string { - if t == nil { - return "TargetChatChosen(nil)" - } - type Alias TargetChatChosen - return fmt.Sprintf("TargetChatChosen%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TargetChatChosen) TypeID() uint32 { - return TargetChatChosenTypeID -} - -// TypeName returns name of type in TL schema. -func (*TargetChatChosen) TypeName() string { - return "targetChatChosen" -} - -// TypeInfo returns info about TL type. -func (t *TargetChatChosen) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "targetChatChosen", - ID: TargetChatChosenTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Types", - SchemaName: "types", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TargetChatChosen) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode targetChatChosen#acf8d5a6 as nil") - } - b.PutID(TargetChatChosenTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TargetChatChosen) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode targetChatChosen#acf8d5a6 as nil") - } - if err := t.Types.Encode(b); err != nil { - return fmt.Errorf("unable to encode targetChatChosen#acf8d5a6: field types: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TargetChatChosen) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode targetChatChosen#acf8d5a6 to nil") - } - if err := b.ConsumeID(TargetChatChosenTypeID); err != nil { - return fmt.Errorf("unable to decode targetChatChosen#acf8d5a6: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TargetChatChosen) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode targetChatChosen#acf8d5a6 to nil") - } - { - if err := t.Types.Decode(b); err != nil { - return fmt.Errorf("unable to decode targetChatChosen#acf8d5a6: field types: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TargetChatChosen) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode targetChatChosen#acf8d5a6 as nil") - } - b.ObjStart() - b.PutID("targetChatChosen") - b.Comma() - b.FieldStart("types") - if err := t.Types.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode targetChatChosen#acf8d5a6: field types: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TargetChatChosen) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode targetChatChosen#acf8d5a6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("targetChatChosen"); err != nil { - return fmt.Errorf("unable to decode targetChatChosen#acf8d5a6: %w", err) - } - case "types": - if err := t.Types.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode targetChatChosen#acf8d5a6: field types: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTypes returns value of Types field. -func (t *TargetChatChosen) GetTypes() (value TargetChatTypes) { - if t == nil { - return - } - return t.Types -} - -// TargetChatInternalLink represents TL type `targetChatInternalLink#dd788fe0`. -type TargetChatInternalLink struct { - // An internal link pointing to the chat - Link InternalLinkTypeClass -} - -// TargetChatInternalLinkTypeID is TL type id of TargetChatInternalLink. -const TargetChatInternalLinkTypeID = 0xdd788fe0 - -// construct implements constructor of TargetChatClass. -func (t TargetChatInternalLink) construct() TargetChatClass { return &t } - -// Ensuring interfaces in compile-time for TargetChatInternalLink. -var ( - _ bin.Encoder = &TargetChatInternalLink{} - _ bin.Decoder = &TargetChatInternalLink{} - _ bin.BareEncoder = &TargetChatInternalLink{} - _ bin.BareDecoder = &TargetChatInternalLink{} - - _ TargetChatClass = &TargetChatInternalLink{} -) - -func (t *TargetChatInternalLink) Zero() bool { - if t == nil { - return true - } - if !(t.Link == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TargetChatInternalLink) String() string { - if t == nil { - return "TargetChatInternalLink(nil)" - } - type Alias TargetChatInternalLink - return fmt.Sprintf("TargetChatInternalLink%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TargetChatInternalLink) TypeID() uint32 { - return TargetChatInternalLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*TargetChatInternalLink) TypeName() string { - return "targetChatInternalLink" -} - -// TypeInfo returns info about TL type. -func (t *TargetChatInternalLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "targetChatInternalLink", - ID: TargetChatInternalLinkTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Link", - SchemaName: "link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TargetChatInternalLink) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode targetChatInternalLink#dd788fe0 as nil") - } - b.PutID(TargetChatInternalLinkTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TargetChatInternalLink) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode targetChatInternalLink#dd788fe0 as nil") - } - if t.Link == nil { - return fmt.Errorf("unable to encode targetChatInternalLink#dd788fe0: field link is nil") - } - if err := t.Link.Encode(b); err != nil { - return fmt.Errorf("unable to encode targetChatInternalLink#dd788fe0: field link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TargetChatInternalLink) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode targetChatInternalLink#dd788fe0 to nil") - } - if err := b.ConsumeID(TargetChatInternalLinkTypeID); err != nil { - return fmt.Errorf("unable to decode targetChatInternalLink#dd788fe0: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TargetChatInternalLink) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode targetChatInternalLink#dd788fe0 to nil") - } - { - value, err := DecodeInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode targetChatInternalLink#dd788fe0: field link: %w", err) - } - t.Link = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TargetChatInternalLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode targetChatInternalLink#dd788fe0 as nil") - } - b.ObjStart() - b.PutID("targetChatInternalLink") - b.Comma() - b.FieldStart("link") - if t.Link == nil { - return fmt.Errorf("unable to encode targetChatInternalLink#dd788fe0: field link is nil") - } - if err := t.Link.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode targetChatInternalLink#dd788fe0: field link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TargetChatInternalLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode targetChatInternalLink#dd788fe0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("targetChatInternalLink"); err != nil { - return fmt.Errorf("unable to decode targetChatInternalLink#dd788fe0: %w", err) - } - case "link": - value, err := DecodeTDLibJSONInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode targetChatInternalLink#dd788fe0: field link: %w", err) - } - t.Link = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLink returns value of Link field. -func (t *TargetChatInternalLink) GetLink() (value InternalLinkTypeClass) { - if t == nil { - return - } - return t.Link -} - -// TargetChatClassName is schema name of TargetChatClass. -const TargetChatClassName = "TargetChat" - -// TargetChatClass represents TargetChat generic type. -// -// Example: -// -// g, err := tdapi.DecodeTargetChat(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.TargetChatCurrent: // targetChatCurrent#e729d110 -// case *tdapi.TargetChatChosen: // targetChatChosen#acf8d5a6 -// case *tdapi.TargetChatInternalLink: // targetChatInternalLink#dd788fe0 -// default: panic(v) -// } -type TargetChatClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() TargetChatClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeTargetChat implements binary de-serialization for TargetChatClass. -func DecodeTargetChat(buf *bin.Buffer) (TargetChatClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case TargetChatCurrentTypeID: - // Decoding targetChatCurrent#e729d110. - v := TargetChatCurrent{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TargetChatClass: %w", err) - } - return &v, nil - case TargetChatChosenTypeID: - // Decoding targetChatChosen#acf8d5a6. - v := TargetChatChosen{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TargetChatClass: %w", err) - } - return &v, nil - case TargetChatInternalLinkTypeID: - // Decoding targetChatInternalLink#dd788fe0. - v := TargetChatInternalLink{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TargetChatClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TargetChatClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONTargetChat implements binary de-serialization for TargetChatClass. -func DecodeTDLibJSONTargetChat(buf tdjson.Decoder) (TargetChatClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "targetChatCurrent": - // Decoding targetChatCurrent#e729d110. - v := TargetChatCurrent{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TargetChatClass: %w", err) - } - return &v, nil - case "targetChatChosen": - // Decoding targetChatChosen#acf8d5a6. - v := TargetChatChosen{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TargetChatClass: %w", err) - } - return &v, nil - case "targetChatInternalLink": - // Decoding targetChatInternalLink#dd788fe0. - v := TargetChatInternalLink{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TargetChatClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TargetChatClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// TargetChat boxes the TargetChatClass providing a helper. -type TargetChatBox struct { - TargetChat TargetChatClass -} - -// Decode implements bin.Decoder for TargetChatBox. -func (b *TargetChatBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode TargetChatBox to nil") - } - v, err := DecodeTargetChat(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TargetChat = v - return nil -} - -// Encode implements bin.Encode for TargetChatBox. -func (b *TargetChatBox) Encode(buf *bin.Buffer) error { - if b == nil || b.TargetChat == nil { - return fmt.Errorf("unable to encode TargetChatClass as nil") - } - return b.TargetChat.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for TargetChatBox. -func (b *TargetChatBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode TargetChatBox to nil") - } - v, err := DecodeTDLibJSONTargetChat(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TargetChat = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for TargetChatBox. -func (b *TargetChatBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.TargetChat == nil { - return fmt.Errorf("unable to encode TargetChatClass as nil") - } - return b.TargetChat.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_target_chat_types_gen.go b/tdapi/tl_target_chat_types_gen.go deleted file mode 100644 index 86da589f7..000000000 --- a/tdapi/tl_target_chat_types_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TargetChatTypes represents TL type `targetChatTypes#5a300e51`. -type TargetChatTypes struct { - // True, if private chats with ordinary users are allowed - AllowUserChats bool - // True, if private chats with other bots are allowed - AllowBotChats bool - // True, if basic group and supergroup chats are allowed - AllowGroupChats bool - // True, if channel chats are allowed - AllowChannelChats bool -} - -// TargetChatTypesTypeID is TL type id of TargetChatTypes. -const TargetChatTypesTypeID = 0x5a300e51 - -// Ensuring interfaces in compile-time for TargetChatTypes. -var ( - _ bin.Encoder = &TargetChatTypes{} - _ bin.Decoder = &TargetChatTypes{} - _ bin.BareEncoder = &TargetChatTypes{} - _ bin.BareDecoder = &TargetChatTypes{} -) - -func (t *TargetChatTypes) Zero() bool { - if t == nil { - return true - } - if !(t.AllowUserChats == false) { - return false - } - if !(t.AllowBotChats == false) { - return false - } - if !(t.AllowGroupChats == false) { - return false - } - if !(t.AllowChannelChats == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TargetChatTypes) String() string { - if t == nil { - return "TargetChatTypes(nil)" - } - type Alias TargetChatTypes - return fmt.Sprintf("TargetChatTypes%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TargetChatTypes) TypeID() uint32 { - return TargetChatTypesTypeID -} - -// TypeName returns name of type in TL schema. -func (*TargetChatTypes) TypeName() string { - return "targetChatTypes" -} - -// TypeInfo returns info about TL type. -func (t *TargetChatTypes) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "targetChatTypes", - ID: TargetChatTypesTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AllowUserChats", - SchemaName: "allow_user_chats", - }, - { - Name: "AllowBotChats", - SchemaName: "allow_bot_chats", - }, - { - Name: "AllowGroupChats", - SchemaName: "allow_group_chats", - }, - { - Name: "AllowChannelChats", - SchemaName: "allow_channel_chats", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TargetChatTypes) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode targetChatTypes#5a300e51 as nil") - } - b.PutID(TargetChatTypesTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TargetChatTypes) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode targetChatTypes#5a300e51 as nil") - } - b.PutBool(t.AllowUserChats) - b.PutBool(t.AllowBotChats) - b.PutBool(t.AllowGroupChats) - b.PutBool(t.AllowChannelChats) - return nil -} - -// Decode implements bin.Decoder. -func (t *TargetChatTypes) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode targetChatTypes#5a300e51 to nil") - } - if err := b.ConsumeID(TargetChatTypesTypeID); err != nil { - return fmt.Errorf("unable to decode targetChatTypes#5a300e51: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TargetChatTypes) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode targetChatTypes#5a300e51 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode targetChatTypes#5a300e51: field allow_user_chats: %w", err) - } - t.AllowUserChats = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode targetChatTypes#5a300e51: field allow_bot_chats: %w", err) - } - t.AllowBotChats = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode targetChatTypes#5a300e51: field allow_group_chats: %w", err) - } - t.AllowGroupChats = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode targetChatTypes#5a300e51: field allow_channel_chats: %w", err) - } - t.AllowChannelChats = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TargetChatTypes) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode targetChatTypes#5a300e51 as nil") - } - b.ObjStart() - b.PutID("targetChatTypes") - b.Comma() - b.FieldStart("allow_user_chats") - b.PutBool(t.AllowUserChats) - b.Comma() - b.FieldStart("allow_bot_chats") - b.PutBool(t.AllowBotChats) - b.Comma() - b.FieldStart("allow_group_chats") - b.PutBool(t.AllowGroupChats) - b.Comma() - b.FieldStart("allow_channel_chats") - b.PutBool(t.AllowChannelChats) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TargetChatTypes) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode targetChatTypes#5a300e51 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("targetChatTypes"); err != nil { - return fmt.Errorf("unable to decode targetChatTypes#5a300e51: %w", err) - } - case "allow_user_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode targetChatTypes#5a300e51: field allow_user_chats: %w", err) - } - t.AllowUserChats = value - case "allow_bot_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode targetChatTypes#5a300e51: field allow_bot_chats: %w", err) - } - t.AllowBotChats = value - case "allow_group_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode targetChatTypes#5a300e51: field allow_group_chats: %w", err) - } - t.AllowGroupChats = value - case "allow_channel_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode targetChatTypes#5a300e51: field allow_channel_chats: %w", err) - } - t.AllowChannelChats = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAllowUserChats returns value of AllowUserChats field. -func (t *TargetChatTypes) GetAllowUserChats() (value bool) { - if t == nil { - return - } - return t.AllowUserChats -} - -// GetAllowBotChats returns value of AllowBotChats field. -func (t *TargetChatTypes) GetAllowBotChats() (value bool) { - if t == nil { - return - } - return t.AllowBotChats -} - -// GetAllowGroupChats returns value of AllowGroupChats field. -func (t *TargetChatTypes) GetAllowGroupChats() (value bool) { - if t == nil { - return - } - return t.AllowGroupChats -} - -// GetAllowChannelChats returns value of AllowChannelChats field. -func (t *TargetChatTypes) GetAllowChannelChats() (value bool) { - if t == nil { - return - } - return t.AllowChannelChats -} diff --git a/tdapi/tl_telegram_payment_purpose_gen.go b/tdapi/tl_telegram_payment_purpose_gen.go deleted file mode 100644 index 3c963be40..000000000 --- a/tdapi/tl_telegram_payment_purpose_gen.go +++ /dev/null @@ -1,1865 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TelegramPaymentPurposePremiumGiftCodes represents TL type `telegramPaymentPurposePremiumGiftCodes#b13f14a9`. -type TelegramPaymentPurposePremiumGiftCodes struct { - // Identifier of the supergroup or channel chat, which will be automatically boosted by - // the users for duration of the Premium subscription and which is administered by the - // user; 0 if none - BoostedChatID int64 - // ISO 4217 currency code of the payment currency - Currency string - // Paid amount, in the smallest units of the currency - Amount int64 - // Identifiers of the users which can activate the gift codes - UserIDs []int64 - // Number of months the Telegram Premium subscription will be active for the users - MonthCount int32 - // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters - // Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are - // allowed - Text FormattedText -} - -// TelegramPaymentPurposePremiumGiftCodesTypeID is TL type id of TelegramPaymentPurposePremiumGiftCodes. -const TelegramPaymentPurposePremiumGiftCodesTypeID = 0xb13f14a9 - -// construct implements constructor of TelegramPaymentPurposeClass. -func (t TelegramPaymentPurposePremiumGiftCodes) construct() TelegramPaymentPurposeClass { return &t } - -// Ensuring interfaces in compile-time for TelegramPaymentPurposePremiumGiftCodes. -var ( - _ bin.Encoder = &TelegramPaymentPurposePremiumGiftCodes{} - _ bin.Decoder = &TelegramPaymentPurposePremiumGiftCodes{} - _ bin.BareEncoder = &TelegramPaymentPurposePremiumGiftCodes{} - _ bin.BareDecoder = &TelegramPaymentPurposePremiumGiftCodes{} - - _ TelegramPaymentPurposeClass = &TelegramPaymentPurposePremiumGiftCodes{} -) - -func (t *TelegramPaymentPurposePremiumGiftCodes) Zero() bool { - if t == nil { - return true - } - if !(t.BoostedChatID == 0) { - return false - } - if !(t.Currency == "") { - return false - } - if !(t.Amount == 0) { - return false - } - if !(t.UserIDs == nil) { - return false - } - if !(t.MonthCount == 0) { - return false - } - if !(t.Text.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TelegramPaymentPurposePremiumGiftCodes) String() string { - if t == nil { - return "TelegramPaymentPurposePremiumGiftCodes(nil)" - } - type Alias TelegramPaymentPurposePremiumGiftCodes - return fmt.Sprintf("TelegramPaymentPurposePremiumGiftCodes%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TelegramPaymentPurposePremiumGiftCodes) TypeID() uint32 { - return TelegramPaymentPurposePremiumGiftCodesTypeID -} - -// TypeName returns name of type in TL schema. -func (*TelegramPaymentPurposePremiumGiftCodes) TypeName() string { - return "telegramPaymentPurposePremiumGiftCodes" -} - -// TypeInfo returns info about TL type. -func (t *TelegramPaymentPurposePremiumGiftCodes) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "telegramPaymentPurposePremiumGiftCodes", - ID: TelegramPaymentPurposePremiumGiftCodesTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BoostedChatID", - SchemaName: "boosted_chat_id", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - { - Name: "MonthCount", - SchemaName: "month_count", - }, - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TelegramPaymentPurposePremiumGiftCodes) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiftCodes#b13f14a9 as nil") - } - b.PutID(TelegramPaymentPurposePremiumGiftCodesTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TelegramPaymentPurposePremiumGiftCodes) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiftCodes#b13f14a9 as nil") - } - b.PutInt53(t.BoostedChatID) - b.PutString(t.Currency) - b.PutInt53(t.Amount) - b.PutInt(len(t.UserIDs)) - for _, v := range t.UserIDs { - b.PutInt53(v) - } - b.PutInt32(t.MonthCount) - if err := t.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field text: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TelegramPaymentPurposePremiumGiftCodes) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiftCodes#b13f14a9 to nil") - } - if err := b.ConsumeID(TelegramPaymentPurposePremiumGiftCodesTypeID); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TelegramPaymentPurposePremiumGiftCodes) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiftCodes#b13f14a9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field boosted_chat_id: %w", err) - } - t.BoostedChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field currency: %w", err) - } - t.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field amount: %w", err) - } - t.Amount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field user_ids: %w", err) - } - - if headerLen > 0 { - t.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field user_ids: %w", err) - } - t.UserIDs = append(t.UserIDs, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field month_count: %w", err) - } - t.MonthCount = value - } - { - if err := t.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field text: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TelegramPaymentPurposePremiumGiftCodes) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiftCodes#b13f14a9 as nil") - } - b.ObjStart() - b.PutID("telegramPaymentPurposePremiumGiftCodes") - b.Comma() - b.FieldStart("boosted_chat_id") - b.PutInt53(t.BoostedChatID) - b.Comma() - b.FieldStart("currency") - b.PutString(t.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(t.Amount) - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range t.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("month_count") - b.PutInt32(t.MonthCount) - b.Comma() - b.FieldStart("text") - if err := t.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field text: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TelegramPaymentPurposePremiumGiftCodes) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiftCodes#b13f14a9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("telegramPaymentPurposePremiumGiftCodes"); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: %w", err) - } - case "boosted_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field boosted_chat_id: %w", err) - } - t.BoostedChatID = value - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field currency: %w", err) - } - t.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field amount: %w", err) - } - t.Amount = value - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field user_ids: %w", err) - } - t.UserIDs = append(t.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field user_ids: %w", err) - } - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field month_count: %w", err) - } - t.MonthCount = value - case "text": - if err := t.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiftCodes#b13f14a9: field text: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBoostedChatID returns value of BoostedChatID field. -func (t *TelegramPaymentPurposePremiumGiftCodes) GetBoostedChatID() (value int64) { - if t == nil { - return - } - return t.BoostedChatID -} - -// GetCurrency returns value of Currency field. -func (t *TelegramPaymentPurposePremiumGiftCodes) GetCurrency() (value string) { - if t == nil { - return - } - return t.Currency -} - -// GetAmount returns value of Amount field. -func (t *TelegramPaymentPurposePremiumGiftCodes) GetAmount() (value int64) { - if t == nil { - return - } - return t.Amount -} - -// GetUserIDs returns value of UserIDs field. -func (t *TelegramPaymentPurposePremiumGiftCodes) GetUserIDs() (value []int64) { - if t == nil { - return - } - return t.UserIDs -} - -// GetMonthCount returns value of MonthCount field. -func (t *TelegramPaymentPurposePremiumGiftCodes) GetMonthCount() (value int32) { - if t == nil { - return - } - return t.MonthCount -} - -// GetText returns value of Text field. -func (t *TelegramPaymentPurposePremiumGiftCodes) GetText() (value FormattedText) { - if t == nil { - return - } - return t.Text -} - -// TelegramPaymentPurposePremiumGiveaway represents TL type `telegramPaymentPurposePremiumGiveaway#d2a7c33f`. -type TelegramPaymentPurposePremiumGiveaway struct { - // Giveaway parameters - Parameters GiveawayParameters - // ISO 4217 currency code of the payment currency - Currency string - // Paid amount, in the smallest units of the currency - Amount int64 - // Number of users which will be able to activate the gift codes - WinnerCount int32 - // Number of months the Telegram Premium subscription will be active for the users - MonthCount int32 -} - -// TelegramPaymentPurposePremiumGiveawayTypeID is TL type id of TelegramPaymentPurposePremiumGiveaway. -const TelegramPaymentPurposePremiumGiveawayTypeID = 0xd2a7c33f - -// construct implements constructor of TelegramPaymentPurposeClass. -func (t TelegramPaymentPurposePremiumGiveaway) construct() TelegramPaymentPurposeClass { return &t } - -// Ensuring interfaces in compile-time for TelegramPaymentPurposePremiumGiveaway. -var ( - _ bin.Encoder = &TelegramPaymentPurposePremiumGiveaway{} - _ bin.Decoder = &TelegramPaymentPurposePremiumGiveaway{} - _ bin.BareEncoder = &TelegramPaymentPurposePremiumGiveaway{} - _ bin.BareDecoder = &TelegramPaymentPurposePremiumGiveaway{} - - _ TelegramPaymentPurposeClass = &TelegramPaymentPurposePremiumGiveaway{} -) - -func (t *TelegramPaymentPurposePremiumGiveaway) Zero() bool { - if t == nil { - return true - } - if !(t.Parameters.Zero()) { - return false - } - if !(t.Currency == "") { - return false - } - if !(t.Amount == 0) { - return false - } - if !(t.WinnerCount == 0) { - return false - } - if !(t.MonthCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TelegramPaymentPurposePremiumGiveaway) String() string { - if t == nil { - return "TelegramPaymentPurposePremiumGiveaway(nil)" - } - type Alias TelegramPaymentPurposePremiumGiveaway - return fmt.Sprintf("TelegramPaymentPurposePremiumGiveaway%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TelegramPaymentPurposePremiumGiveaway) TypeID() uint32 { - return TelegramPaymentPurposePremiumGiveawayTypeID -} - -// TypeName returns name of type in TL schema. -func (*TelegramPaymentPurposePremiumGiveaway) TypeName() string { - return "telegramPaymentPurposePremiumGiveaway" -} - -// TypeInfo returns info about TL type. -func (t *TelegramPaymentPurposePremiumGiveaway) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "telegramPaymentPurposePremiumGiveaway", - ID: TelegramPaymentPurposePremiumGiveawayTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Parameters", - SchemaName: "parameters", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "MonthCount", - SchemaName: "month_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TelegramPaymentPurposePremiumGiveaway) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiveaway#d2a7c33f as nil") - } - b.PutID(TelegramPaymentPurposePremiumGiveawayTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TelegramPaymentPurposePremiumGiveaway) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiveaway#d2a7c33f as nil") - } - if err := t.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field parameters: %w", err) - } - b.PutString(t.Currency) - b.PutInt53(t.Amount) - b.PutInt32(t.WinnerCount) - b.PutInt32(t.MonthCount) - return nil -} - -// Decode implements bin.Decoder. -func (t *TelegramPaymentPurposePremiumGiveaway) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiveaway#d2a7c33f to nil") - } - if err := b.ConsumeID(TelegramPaymentPurposePremiumGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TelegramPaymentPurposePremiumGiveaway) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiveaway#d2a7c33f to nil") - } - { - if err := t.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field parameters: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field currency: %w", err) - } - t.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field amount: %w", err) - } - t.Amount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field winner_count: %w", err) - } - t.WinnerCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field month_count: %w", err) - } - t.MonthCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TelegramPaymentPurposePremiumGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposePremiumGiveaway#d2a7c33f as nil") - } - b.ObjStart() - b.PutID("telegramPaymentPurposePremiumGiveaway") - b.Comma() - b.FieldStart("parameters") - if err := t.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field parameters: %w", err) - } - b.Comma() - b.FieldStart("currency") - b.PutString(t.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(t.Amount) - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(t.WinnerCount) - b.Comma() - b.FieldStart("month_count") - b.PutInt32(t.MonthCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TelegramPaymentPurposePremiumGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposePremiumGiveaway#d2a7c33f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("telegramPaymentPurposePremiumGiveaway"); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: %w", err) - } - case "parameters": - if err := t.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field parameters: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field currency: %w", err) - } - t.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field amount: %w", err) - } - t.Amount = value - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field winner_count: %w", err) - } - t.WinnerCount = value - case "month_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposePremiumGiveaway#d2a7c33f: field month_count: %w", err) - } - t.MonthCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetParameters returns value of Parameters field. -func (t *TelegramPaymentPurposePremiumGiveaway) GetParameters() (value GiveawayParameters) { - if t == nil { - return - } - return t.Parameters -} - -// GetCurrency returns value of Currency field. -func (t *TelegramPaymentPurposePremiumGiveaway) GetCurrency() (value string) { - if t == nil { - return - } - return t.Currency -} - -// GetAmount returns value of Amount field. -func (t *TelegramPaymentPurposePremiumGiveaway) GetAmount() (value int64) { - if t == nil { - return - } - return t.Amount -} - -// GetWinnerCount returns value of WinnerCount field. -func (t *TelegramPaymentPurposePremiumGiveaway) GetWinnerCount() (value int32) { - if t == nil { - return - } - return t.WinnerCount -} - -// GetMonthCount returns value of MonthCount field. -func (t *TelegramPaymentPurposePremiumGiveaway) GetMonthCount() (value int32) { - if t == nil { - return - } - return t.MonthCount -} - -// TelegramPaymentPurposeStars represents TL type `telegramPaymentPurposeStars#e273ee52`. -type TelegramPaymentPurposeStars struct { - // ISO 4217 currency code of the payment currency - Currency string - // Paid amount, in the smallest units of the currency - Amount int64 - // Number of bought Telegram Stars - StarCount int64 -} - -// TelegramPaymentPurposeStarsTypeID is TL type id of TelegramPaymentPurposeStars. -const TelegramPaymentPurposeStarsTypeID = 0xe273ee52 - -// construct implements constructor of TelegramPaymentPurposeClass. -func (t TelegramPaymentPurposeStars) construct() TelegramPaymentPurposeClass { return &t } - -// Ensuring interfaces in compile-time for TelegramPaymentPurposeStars. -var ( - _ bin.Encoder = &TelegramPaymentPurposeStars{} - _ bin.Decoder = &TelegramPaymentPurposeStars{} - _ bin.BareEncoder = &TelegramPaymentPurposeStars{} - _ bin.BareDecoder = &TelegramPaymentPurposeStars{} - - _ TelegramPaymentPurposeClass = &TelegramPaymentPurposeStars{} -) - -func (t *TelegramPaymentPurposeStars) Zero() bool { - if t == nil { - return true - } - if !(t.Currency == "") { - return false - } - if !(t.Amount == 0) { - return false - } - if !(t.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TelegramPaymentPurposeStars) String() string { - if t == nil { - return "TelegramPaymentPurposeStars(nil)" - } - type Alias TelegramPaymentPurposeStars - return fmt.Sprintf("TelegramPaymentPurposeStars%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TelegramPaymentPurposeStars) TypeID() uint32 { - return TelegramPaymentPurposeStarsTypeID -} - -// TypeName returns name of type in TL schema. -func (*TelegramPaymentPurposeStars) TypeName() string { - return "telegramPaymentPurposeStars" -} - -// TypeInfo returns info about TL type. -func (t *TelegramPaymentPurposeStars) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "telegramPaymentPurposeStars", - ID: TelegramPaymentPurposeStarsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TelegramPaymentPurposeStars) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeStars#e273ee52 as nil") - } - b.PutID(TelegramPaymentPurposeStarsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TelegramPaymentPurposeStars) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeStars#e273ee52 as nil") - } - b.PutString(t.Currency) - b.PutInt53(t.Amount) - b.PutInt53(t.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (t *TelegramPaymentPurposeStars) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeStars#e273ee52 to nil") - } - if err := b.ConsumeID(TelegramPaymentPurposeStarsTypeID); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStars#e273ee52: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TelegramPaymentPurposeStars) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeStars#e273ee52 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStars#e273ee52: field currency: %w", err) - } - t.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStars#e273ee52: field amount: %w", err) - } - t.Amount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStars#e273ee52: field star_count: %w", err) - } - t.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TelegramPaymentPurposeStars) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeStars#e273ee52 as nil") - } - b.ObjStart() - b.PutID("telegramPaymentPurposeStars") - b.Comma() - b.FieldStart("currency") - b.PutString(t.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(t.Amount) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(t.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TelegramPaymentPurposeStars) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeStars#e273ee52 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("telegramPaymentPurposeStars"); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStars#e273ee52: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStars#e273ee52: field currency: %w", err) - } - t.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStars#e273ee52: field amount: %w", err) - } - t.Amount = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStars#e273ee52: field star_count: %w", err) - } - t.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCurrency returns value of Currency field. -func (t *TelegramPaymentPurposeStars) GetCurrency() (value string) { - if t == nil { - return - } - return t.Currency -} - -// GetAmount returns value of Amount field. -func (t *TelegramPaymentPurposeStars) GetAmount() (value int64) { - if t == nil { - return - } - return t.Amount -} - -// GetStarCount returns value of StarCount field. -func (t *TelegramPaymentPurposeStars) GetStarCount() (value int64) { - if t == nil { - return - } - return t.StarCount -} - -// TelegramPaymentPurposeGiftedStars represents TL type `telegramPaymentPurposeGiftedStars#91b68a36`. -type TelegramPaymentPurposeGiftedStars struct { - // Identifier of the user to which Telegram Stars are gifted - UserID int64 - // ISO 4217 currency code of the payment currency - Currency string - // Paid amount, in the smallest units of the currency - Amount int64 - // Number of bought Telegram Stars - StarCount int64 -} - -// TelegramPaymentPurposeGiftedStarsTypeID is TL type id of TelegramPaymentPurposeGiftedStars. -const TelegramPaymentPurposeGiftedStarsTypeID = 0x91b68a36 - -// construct implements constructor of TelegramPaymentPurposeClass. -func (t TelegramPaymentPurposeGiftedStars) construct() TelegramPaymentPurposeClass { return &t } - -// Ensuring interfaces in compile-time for TelegramPaymentPurposeGiftedStars. -var ( - _ bin.Encoder = &TelegramPaymentPurposeGiftedStars{} - _ bin.Decoder = &TelegramPaymentPurposeGiftedStars{} - _ bin.BareEncoder = &TelegramPaymentPurposeGiftedStars{} - _ bin.BareDecoder = &TelegramPaymentPurposeGiftedStars{} - - _ TelegramPaymentPurposeClass = &TelegramPaymentPurposeGiftedStars{} -) - -func (t *TelegramPaymentPurposeGiftedStars) Zero() bool { - if t == nil { - return true - } - if !(t.UserID == 0) { - return false - } - if !(t.Currency == "") { - return false - } - if !(t.Amount == 0) { - return false - } - if !(t.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TelegramPaymentPurposeGiftedStars) String() string { - if t == nil { - return "TelegramPaymentPurposeGiftedStars(nil)" - } - type Alias TelegramPaymentPurposeGiftedStars - return fmt.Sprintf("TelegramPaymentPurposeGiftedStars%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TelegramPaymentPurposeGiftedStars) TypeID() uint32 { - return TelegramPaymentPurposeGiftedStarsTypeID -} - -// TypeName returns name of type in TL schema. -func (*TelegramPaymentPurposeGiftedStars) TypeName() string { - return "telegramPaymentPurposeGiftedStars" -} - -// TypeInfo returns info about TL type. -func (t *TelegramPaymentPurposeGiftedStars) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "telegramPaymentPurposeGiftedStars", - ID: TelegramPaymentPurposeGiftedStarsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TelegramPaymentPurposeGiftedStars) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeGiftedStars#91b68a36 as nil") - } - b.PutID(TelegramPaymentPurposeGiftedStarsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TelegramPaymentPurposeGiftedStars) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeGiftedStars#91b68a36 as nil") - } - b.PutInt53(t.UserID) - b.PutString(t.Currency) - b.PutInt53(t.Amount) - b.PutInt53(t.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (t *TelegramPaymentPurposeGiftedStars) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeGiftedStars#91b68a36 to nil") - } - if err := b.ConsumeID(TelegramPaymentPurposeGiftedStarsTypeID); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TelegramPaymentPurposeGiftedStars) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeGiftedStars#91b68a36 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field user_id: %w", err) - } - t.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field currency: %w", err) - } - t.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field amount: %w", err) - } - t.Amount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field star_count: %w", err) - } - t.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TelegramPaymentPurposeGiftedStars) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeGiftedStars#91b68a36 as nil") - } - b.ObjStart() - b.PutID("telegramPaymentPurposeGiftedStars") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(t.UserID) - b.Comma() - b.FieldStart("currency") - b.PutString(t.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(t.Amount) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(t.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TelegramPaymentPurposeGiftedStars) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeGiftedStars#91b68a36 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("telegramPaymentPurposeGiftedStars"); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field user_id: %w", err) - } - t.UserID = value - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field currency: %w", err) - } - t.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field amount: %w", err) - } - t.Amount = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeGiftedStars#91b68a36: field star_count: %w", err) - } - t.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (t *TelegramPaymentPurposeGiftedStars) GetUserID() (value int64) { - if t == nil { - return - } - return t.UserID -} - -// GetCurrency returns value of Currency field. -func (t *TelegramPaymentPurposeGiftedStars) GetCurrency() (value string) { - if t == nil { - return - } - return t.Currency -} - -// GetAmount returns value of Amount field. -func (t *TelegramPaymentPurposeGiftedStars) GetAmount() (value int64) { - if t == nil { - return - } - return t.Amount -} - -// GetStarCount returns value of StarCount field. -func (t *TelegramPaymentPurposeGiftedStars) GetStarCount() (value int64) { - if t == nil { - return - } - return t.StarCount -} - -// TelegramPaymentPurposeStarGiveaway represents TL type `telegramPaymentPurposeStarGiveaway#3c79a391`. -type TelegramPaymentPurposeStarGiveaway struct { - // Giveaway parameters - Parameters GiveawayParameters - // ISO 4217 currency code of the payment currency - Currency string - // Paid amount, in the smallest units of the currency - Amount int64 - // The number of users to receive Telegram Stars - WinnerCount int32 - // The number of Telegram Stars to be distributed through the giveaway - StarCount int64 -} - -// TelegramPaymentPurposeStarGiveawayTypeID is TL type id of TelegramPaymentPurposeStarGiveaway. -const TelegramPaymentPurposeStarGiveawayTypeID = 0x3c79a391 - -// construct implements constructor of TelegramPaymentPurposeClass. -func (t TelegramPaymentPurposeStarGiveaway) construct() TelegramPaymentPurposeClass { return &t } - -// Ensuring interfaces in compile-time for TelegramPaymentPurposeStarGiveaway. -var ( - _ bin.Encoder = &TelegramPaymentPurposeStarGiveaway{} - _ bin.Decoder = &TelegramPaymentPurposeStarGiveaway{} - _ bin.BareEncoder = &TelegramPaymentPurposeStarGiveaway{} - _ bin.BareDecoder = &TelegramPaymentPurposeStarGiveaway{} - - _ TelegramPaymentPurposeClass = &TelegramPaymentPurposeStarGiveaway{} -) - -func (t *TelegramPaymentPurposeStarGiveaway) Zero() bool { - if t == nil { - return true - } - if !(t.Parameters.Zero()) { - return false - } - if !(t.Currency == "") { - return false - } - if !(t.Amount == 0) { - return false - } - if !(t.WinnerCount == 0) { - return false - } - if !(t.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TelegramPaymentPurposeStarGiveaway) String() string { - if t == nil { - return "TelegramPaymentPurposeStarGiveaway(nil)" - } - type Alias TelegramPaymentPurposeStarGiveaway - return fmt.Sprintf("TelegramPaymentPurposeStarGiveaway%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TelegramPaymentPurposeStarGiveaway) TypeID() uint32 { - return TelegramPaymentPurposeStarGiveawayTypeID -} - -// TypeName returns name of type in TL schema. -func (*TelegramPaymentPurposeStarGiveaway) TypeName() string { - return "telegramPaymentPurposeStarGiveaway" -} - -// TypeInfo returns info about TL type. -func (t *TelegramPaymentPurposeStarGiveaway) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "telegramPaymentPurposeStarGiveaway", - ID: TelegramPaymentPurposeStarGiveawayTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Parameters", - SchemaName: "parameters", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "Amount", - SchemaName: "amount", - }, - { - Name: "WinnerCount", - SchemaName: "winner_count", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TelegramPaymentPurposeStarGiveaway) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeStarGiveaway#3c79a391 as nil") - } - b.PutID(TelegramPaymentPurposeStarGiveawayTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TelegramPaymentPurposeStarGiveaway) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeStarGiveaway#3c79a391 as nil") - } - if err := t.Parameters.Encode(b); err != nil { - return fmt.Errorf("unable to encode telegramPaymentPurposeStarGiveaway#3c79a391: field parameters: %w", err) - } - b.PutString(t.Currency) - b.PutInt53(t.Amount) - b.PutInt32(t.WinnerCount) - b.PutInt53(t.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (t *TelegramPaymentPurposeStarGiveaway) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeStarGiveaway#3c79a391 to nil") - } - if err := b.ConsumeID(TelegramPaymentPurposeStarGiveawayTypeID); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TelegramPaymentPurposeStarGiveaway) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeStarGiveaway#3c79a391 to nil") - } - { - if err := t.Parameters.Decode(b); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field parameters: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field currency: %w", err) - } - t.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field amount: %w", err) - } - t.Amount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field winner_count: %w", err) - } - t.WinnerCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field star_count: %w", err) - } - t.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TelegramPaymentPurposeStarGiveaway) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeStarGiveaway#3c79a391 as nil") - } - b.ObjStart() - b.PutID("telegramPaymentPurposeStarGiveaway") - b.Comma() - b.FieldStart("parameters") - if err := t.Parameters.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode telegramPaymentPurposeStarGiveaway#3c79a391: field parameters: %w", err) - } - b.Comma() - b.FieldStart("currency") - b.PutString(t.Currency) - b.Comma() - b.FieldStart("amount") - b.PutInt53(t.Amount) - b.Comma() - b.FieldStart("winner_count") - b.PutInt32(t.WinnerCount) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(t.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TelegramPaymentPurposeStarGiveaway) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeStarGiveaway#3c79a391 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("telegramPaymentPurposeStarGiveaway"); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: %w", err) - } - case "parameters": - if err := t.Parameters.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field parameters: %w", err) - } - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field currency: %w", err) - } - t.Currency = value - case "amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field amount: %w", err) - } - t.Amount = value - case "winner_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field winner_count: %w", err) - } - t.WinnerCount = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeStarGiveaway#3c79a391: field star_count: %w", err) - } - t.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetParameters returns value of Parameters field. -func (t *TelegramPaymentPurposeStarGiveaway) GetParameters() (value GiveawayParameters) { - if t == nil { - return - } - return t.Parameters -} - -// GetCurrency returns value of Currency field. -func (t *TelegramPaymentPurposeStarGiveaway) GetCurrency() (value string) { - if t == nil { - return - } - return t.Currency -} - -// GetAmount returns value of Amount field. -func (t *TelegramPaymentPurposeStarGiveaway) GetAmount() (value int64) { - if t == nil { - return - } - return t.Amount -} - -// GetWinnerCount returns value of WinnerCount field. -func (t *TelegramPaymentPurposeStarGiveaway) GetWinnerCount() (value int32) { - if t == nil { - return - } - return t.WinnerCount -} - -// GetStarCount returns value of StarCount field. -func (t *TelegramPaymentPurposeStarGiveaway) GetStarCount() (value int64) { - if t == nil { - return - } - return t.StarCount -} - -// TelegramPaymentPurposeJoinChat represents TL type `telegramPaymentPurposeJoinChat#8ddd6788`. -type TelegramPaymentPurposeJoinChat struct { - // Invite link to use - InviteLink string -} - -// TelegramPaymentPurposeJoinChatTypeID is TL type id of TelegramPaymentPurposeJoinChat. -const TelegramPaymentPurposeJoinChatTypeID = 0x8ddd6788 - -// construct implements constructor of TelegramPaymentPurposeClass. -func (t TelegramPaymentPurposeJoinChat) construct() TelegramPaymentPurposeClass { return &t } - -// Ensuring interfaces in compile-time for TelegramPaymentPurposeJoinChat. -var ( - _ bin.Encoder = &TelegramPaymentPurposeJoinChat{} - _ bin.Decoder = &TelegramPaymentPurposeJoinChat{} - _ bin.BareEncoder = &TelegramPaymentPurposeJoinChat{} - _ bin.BareDecoder = &TelegramPaymentPurposeJoinChat{} - - _ TelegramPaymentPurposeClass = &TelegramPaymentPurposeJoinChat{} -) - -func (t *TelegramPaymentPurposeJoinChat) Zero() bool { - if t == nil { - return true - } - if !(t.InviteLink == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TelegramPaymentPurposeJoinChat) String() string { - if t == nil { - return "TelegramPaymentPurposeJoinChat(nil)" - } - type Alias TelegramPaymentPurposeJoinChat - return fmt.Sprintf("TelegramPaymentPurposeJoinChat%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TelegramPaymentPurposeJoinChat) TypeID() uint32 { - return TelegramPaymentPurposeJoinChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*TelegramPaymentPurposeJoinChat) TypeName() string { - return "telegramPaymentPurposeJoinChat" -} - -// TypeInfo returns info about TL type. -func (t *TelegramPaymentPurposeJoinChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "telegramPaymentPurposeJoinChat", - ID: TelegramPaymentPurposeJoinChatTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TelegramPaymentPurposeJoinChat) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeJoinChat#8ddd6788 as nil") - } - b.PutID(TelegramPaymentPurposeJoinChatTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TelegramPaymentPurposeJoinChat) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeJoinChat#8ddd6788 as nil") - } - b.PutString(t.InviteLink) - return nil -} - -// Decode implements bin.Decoder. -func (t *TelegramPaymentPurposeJoinChat) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeJoinChat#8ddd6788 to nil") - } - if err := b.ConsumeID(TelegramPaymentPurposeJoinChatTypeID); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeJoinChat#8ddd6788: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TelegramPaymentPurposeJoinChat) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeJoinChat#8ddd6788 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeJoinChat#8ddd6788: field invite_link: %w", err) - } - t.InviteLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TelegramPaymentPurposeJoinChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode telegramPaymentPurposeJoinChat#8ddd6788 as nil") - } - b.ObjStart() - b.PutID("telegramPaymentPurposeJoinChat") - b.Comma() - b.FieldStart("invite_link") - b.PutString(t.InviteLink) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TelegramPaymentPurposeJoinChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode telegramPaymentPurposeJoinChat#8ddd6788 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("telegramPaymentPurposeJoinChat"); err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeJoinChat#8ddd6788: %w", err) - } - case "invite_link": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode telegramPaymentPurposeJoinChat#8ddd6788: field invite_link: %w", err) - } - t.InviteLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInviteLink returns value of InviteLink field. -func (t *TelegramPaymentPurposeJoinChat) GetInviteLink() (value string) { - if t == nil { - return - } - return t.InviteLink -} - -// TelegramPaymentPurposeClassName is schema name of TelegramPaymentPurposeClass. -const TelegramPaymentPurposeClassName = "TelegramPaymentPurpose" - -// TelegramPaymentPurposeClass represents TelegramPaymentPurpose generic type. -// -// Example: -// -// g, err := tdapi.DecodeTelegramPaymentPurpose(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.TelegramPaymentPurposePremiumGiftCodes: // telegramPaymentPurposePremiumGiftCodes#b13f14a9 -// case *tdapi.TelegramPaymentPurposePremiumGiveaway: // telegramPaymentPurposePremiumGiveaway#d2a7c33f -// case *tdapi.TelegramPaymentPurposeStars: // telegramPaymentPurposeStars#e273ee52 -// case *tdapi.TelegramPaymentPurposeGiftedStars: // telegramPaymentPurposeGiftedStars#91b68a36 -// case *tdapi.TelegramPaymentPurposeStarGiveaway: // telegramPaymentPurposeStarGiveaway#3c79a391 -// case *tdapi.TelegramPaymentPurposeJoinChat: // telegramPaymentPurposeJoinChat#8ddd6788 -// default: panic(v) -// } -type TelegramPaymentPurposeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() TelegramPaymentPurposeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeTelegramPaymentPurpose implements binary de-serialization for TelegramPaymentPurposeClass. -func DecodeTelegramPaymentPurpose(buf *bin.Buffer) (TelegramPaymentPurposeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case TelegramPaymentPurposePremiumGiftCodesTypeID: - // Decoding telegramPaymentPurposePremiumGiftCodes#b13f14a9. - v := TelegramPaymentPurposePremiumGiftCodes{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - case TelegramPaymentPurposePremiumGiveawayTypeID: - // Decoding telegramPaymentPurposePremiumGiveaway#d2a7c33f. - v := TelegramPaymentPurposePremiumGiveaway{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - case TelegramPaymentPurposeStarsTypeID: - // Decoding telegramPaymentPurposeStars#e273ee52. - v := TelegramPaymentPurposeStars{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - case TelegramPaymentPurposeGiftedStarsTypeID: - // Decoding telegramPaymentPurposeGiftedStars#91b68a36. - v := TelegramPaymentPurposeGiftedStars{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - case TelegramPaymentPurposeStarGiveawayTypeID: - // Decoding telegramPaymentPurposeStarGiveaway#3c79a391. - v := TelegramPaymentPurposeStarGiveaway{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - case TelegramPaymentPurposeJoinChatTypeID: - // Decoding telegramPaymentPurposeJoinChat#8ddd6788. - v := TelegramPaymentPurposeJoinChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONTelegramPaymentPurpose implements binary de-serialization for TelegramPaymentPurposeClass. -func DecodeTDLibJSONTelegramPaymentPurpose(buf tdjson.Decoder) (TelegramPaymentPurposeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "telegramPaymentPurposePremiumGiftCodes": - // Decoding telegramPaymentPurposePremiumGiftCodes#b13f14a9. - v := TelegramPaymentPurposePremiumGiftCodes{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - case "telegramPaymentPurposePremiumGiveaway": - // Decoding telegramPaymentPurposePremiumGiveaway#d2a7c33f. - v := TelegramPaymentPurposePremiumGiveaway{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - case "telegramPaymentPurposeStars": - // Decoding telegramPaymentPurposeStars#e273ee52. - v := TelegramPaymentPurposeStars{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - case "telegramPaymentPurposeGiftedStars": - // Decoding telegramPaymentPurposeGiftedStars#91b68a36. - v := TelegramPaymentPurposeGiftedStars{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - case "telegramPaymentPurposeStarGiveaway": - // Decoding telegramPaymentPurposeStarGiveaway#3c79a391. - v := TelegramPaymentPurposeStarGiveaway{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - case "telegramPaymentPurposeJoinChat": - // Decoding telegramPaymentPurposeJoinChat#8ddd6788. - v := TelegramPaymentPurposeJoinChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TelegramPaymentPurposeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// TelegramPaymentPurpose boxes the TelegramPaymentPurposeClass providing a helper. -type TelegramPaymentPurposeBox struct { - TelegramPaymentPurpose TelegramPaymentPurposeClass -} - -// Decode implements bin.Decoder for TelegramPaymentPurposeBox. -func (b *TelegramPaymentPurposeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode TelegramPaymentPurposeBox to nil") - } - v, err := DecodeTelegramPaymentPurpose(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TelegramPaymentPurpose = v - return nil -} - -// Encode implements bin.Encode for TelegramPaymentPurposeBox. -func (b *TelegramPaymentPurposeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.TelegramPaymentPurpose == nil { - return fmt.Errorf("unable to encode TelegramPaymentPurposeClass as nil") - } - return b.TelegramPaymentPurpose.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for TelegramPaymentPurposeBox. -func (b *TelegramPaymentPurposeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode TelegramPaymentPurposeBox to nil") - } - v, err := DecodeTDLibJSONTelegramPaymentPurpose(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TelegramPaymentPurpose = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for TelegramPaymentPurposeBox. -func (b *TelegramPaymentPurposeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.TelegramPaymentPurpose == nil { - return fmt.Errorf("unable to encode TelegramPaymentPurposeClass as nil") - } - return b.TelegramPaymentPurpose.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_temporary_password_state_gen.go b/tdapi/tl_temporary_password_state_gen.go deleted file mode 100644 index 2201b276e..000000000 --- a/tdapi/tl_temporary_password_state_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TemporaryPasswordState represents TL type `temporaryPasswordState#3804c7e2`. -type TemporaryPasswordState struct { - // True, if a temporary password is available - HasPassword bool - // Time left before the temporary password expires, in seconds - ValidFor int32 -} - -// TemporaryPasswordStateTypeID is TL type id of TemporaryPasswordState. -const TemporaryPasswordStateTypeID = 0x3804c7e2 - -// Ensuring interfaces in compile-time for TemporaryPasswordState. -var ( - _ bin.Encoder = &TemporaryPasswordState{} - _ bin.Decoder = &TemporaryPasswordState{} - _ bin.BareEncoder = &TemporaryPasswordState{} - _ bin.BareDecoder = &TemporaryPasswordState{} -) - -func (t *TemporaryPasswordState) Zero() bool { - if t == nil { - return true - } - if !(t.HasPassword == false) { - return false - } - if !(t.ValidFor == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TemporaryPasswordState) String() string { - if t == nil { - return "TemporaryPasswordState(nil)" - } - type Alias TemporaryPasswordState - return fmt.Sprintf("TemporaryPasswordState%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TemporaryPasswordState) TypeID() uint32 { - return TemporaryPasswordStateTypeID -} - -// TypeName returns name of type in TL schema. -func (*TemporaryPasswordState) TypeName() string { - return "temporaryPasswordState" -} - -// TypeInfo returns info about TL type. -func (t *TemporaryPasswordState) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "temporaryPasswordState", - ID: TemporaryPasswordStateTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "HasPassword", - SchemaName: "has_password", - }, - { - Name: "ValidFor", - SchemaName: "valid_for", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TemporaryPasswordState) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode temporaryPasswordState#3804c7e2 as nil") - } - b.PutID(TemporaryPasswordStateTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TemporaryPasswordState) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode temporaryPasswordState#3804c7e2 as nil") - } - b.PutBool(t.HasPassword) - b.PutInt32(t.ValidFor) - return nil -} - -// Decode implements bin.Decoder. -func (t *TemporaryPasswordState) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode temporaryPasswordState#3804c7e2 to nil") - } - if err := b.ConsumeID(TemporaryPasswordStateTypeID); err != nil { - return fmt.Errorf("unable to decode temporaryPasswordState#3804c7e2: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TemporaryPasswordState) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode temporaryPasswordState#3804c7e2 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode temporaryPasswordState#3804c7e2: field has_password: %w", err) - } - t.HasPassword = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode temporaryPasswordState#3804c7e2: field valid_for: %w", err) - } - t.ValidFor = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TemporaryPasswordState) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode temporaryPasswordState#3804c7e2 as nil") - } - b.ObjStart() - b.PutID("temporaryPasswordState") - b.Comma() - b.FieldStart("has_password") - b.PutBool(t.HasPassword) - b.Comma() - b.FieldStart("valid_for") - b.PutInt32(t.ValidFor) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TemporaryPasswordState) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode temporaryPasswordState#3804c7e2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("temporaryPasswordState"); err != nil { - return fmt.Errorf("unable to decode temporaryPasswordState#3804c7e2: %w", err) - } - case "has_password": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode temporaryPasswordState#3804c7e2: field has_password: %w", err) - } - t.HasPassword = value - case "valid_for": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode temporaryPasswordState#3804c7e2: field valid_for: %w", err) - } - t.ValidFor = value - default: - return b.Skip() - } - return nil - }) -} - -// GetHasPassword returns value of HasPassword field. -func (t *TemporaryPasswordState) GetHasPassword() (value bool) { - if t == nil { - return - } - return t.HasPassword -} - -// GetValidFor returns value of ValidFor field. -func (t *TemporaryPasswordState) GetValidFor() (value int32) { - if t == nil { - return - } - return t.ValidFor -} diff --git a/tdapi/tl_terminate_all_other_sessions_gen.go b/tdapi/tl_terminate_all_other_sessions_gen.go deleted file mode 100644 index 849debe57..000000000 --- a/tdapi/tl_terminate_all_other_sessions_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TerminateAllOtherSessionsRequest represents TL type `terminateAllOtherSessions#6fba6113`. -type TerminateAllOtherSessionsRequest struct { -} - -// TerminateAllOtherSessionsRequestTypeID is TL type id of TerminateAllOtherSessionsRequest. -const TerminateAllOtherSessionsRequestTypeID = 0x6fba6113 - -// Ensuring interfaces in compile-time for TerminateAllOtherSessionsRequest. -var ( - _ bin.Encoder = &TerminateAllOtherSessionsRequest{} - _ bin.Decoder = &TerminateAllOtherSessionsRequest{} - _ bin.BareEncoder = &TerminateAllOtherSessionsRequest{} - _ bin.BareDecoder = &TerminateAllOtherSessionsRequest{} -) - -func (t *TerminateAllOtherSessionsRequest) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TerminateAllOtherSessionsRequest) String() string { - if t == nil { - return "TerminateAllOtherSessionsRequest(nil)" - } - type Alias TerminateAllOtherSessionsRequest - return fmt.Sprintf("TerminateAllOtherSessionsRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TerminateAllOtherSessionsRequest) TypeID() uint32 { - return TerminateAllOtherSessionsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TerminateAllOtherSessionsRequest) TypeName() string { - return "terminateAllOtherSessions" -} - -// TypeInfo returns info about TL type. -func (t *TerminateAllOtherSessionsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "terminateAllOtherSessions", - ID: TerminateAllOtherSessionsRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TerminateAllOtherSessionsRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode terminateAllOtherSessions#6fba6113 as nil") - } - b.PutID(TerminateAllOtherSessionsRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TerminateAllOtherSessionsRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode terminateAllOtherSessions#6fba6113 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TerminateAllOtherSessionsRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode terminateAllOtherSessions#6fba6113 to nil") - } - if err := b.ConsumeID(TerminateAllOtherSessionsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode terminateAllOtherSessions#6fba6113: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TerminateAllOtherSessionsRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode terminateAllOtherSessions#6fba6113 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TerminateAllOtherSessionsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode terminateAllOtherSessions#6fba6113 as nil") - } - b.ObjStart() - b.PutID("terminateAllOtherSessions") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TerminateAllOtherSessionsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode terminateAllOtherSessions#6fba6113 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("terminateAllOtherSessions"); err != nil { - return fmt.Errorf("unable to decode terminateAllOtherSessions#6fba6113: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TerminateAllOtherSessions invokes method terminateAllOtherSessions#6fba6113 returning error if any. -func (c *Client) TerminateAllOtherSessions(ctx context.Context) error { - var ok Ok - - request := &TerminateAllOtherSessionsRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_terminate_session_gen.go b/tdapi/tl_terminate_session_gen.go deleted file mode 100644 index 8199b68bd..000000000 --- a/tdapi/tl_terminate_session_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TerminateSessionRequest represents TL type `terminateSession#e7b7c92c`. -type TerminateSessionRequest struct { - // Session identifier - SessionID int64 -} - -// TerminateSessionRequestTypeID is TL type id of TerminateSessionRequest. -const TerminateSessionRequestTypeID = 0xe7b7c92c - -// Ensuring interfaces in compile-time for TerminateSessionRequest. -var ( - _ bin.Encoder = &TerminateSessionRequest{} - _ bin.Decoder = &TerminateSessionRequest{} - _ bin.BareEncoder = &TerminateSessionRequest{} - _ bin.BareDecoder = &TerminateSessionRequest{} -) - -func (t *TerminateSessionRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SessionID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TerminateSessionRequest) String() string { - if t == nil { - return "TerminateSessionRequest(nil)" - } - type Alias TerminateSessionRequest - return fmt.Sprintf("TerminateSessionRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TerminateSessionRequest) TypeID() uint32 { - return TerminateSessionRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TerminateSessionRequest) TypeName() string { - return "terminateSession" -} - -// TypeInfo returns info about TL type. -func (t *TerminateSessionRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "terminateSession", - ID: TerminateSessionRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SessionID", - SchemaName: "session_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TerminateSessionRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode terminateSession#e7b7c92c as nil") - } - b.PutID(TerminateSessionRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TerminateSessionRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode terminateSession#e7b7c92c as nil") - } - b.PutLong(t.SessionID) - return nil -} - -// Decode implements bin.Decoder. -func (t *TerminateSessionRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode terminateSession#e7b7c92c to nil") - } - if err := b.ConsumeID(TerminateSessionRequestTypeID); err != nil { - return fmt.Errorf("unable to decode terminateSession#e7b7c92c: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TerminateSessionRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode terminateSession#e7b7c92c to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode terminateSession#e7b7c92c: field session_id: %w", err) - } - t.SessionID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TerminateSessionRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode terminateSession#e7b7c92c as nil") - } - b.ObjStart() - b.PutID("terminateSession") - b.Comma() - b.FieldStart("session_id") - b.PutLong(t.SessionID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TerminateSessionRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode terminateSession#e7b7c92c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("terminateSession"); err != nil { - return fmt.Errorf("unable to decode terminateSession#e7b7c92c: %w", err) - } - case "session_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode terminateSession#e7b7c92c: field session_id: %w", err) - } - t.SessionID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSessionID returns value of SessionID field. -func (t *TerminateSessionRequest) GetSessionID() (value int64) { - if t == nil { - return - } - return t.SessionID -} - -// TerminateSession invokes method terminateSession#e7b7c92c returning error if any. -func (c *Client) TerminateSession(ctx context.Context, sessionid int64) error { - var ok Ok - - request := &TerminateSessionRequest{ - SessionID: sessionid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_terms_of_service_gen.go b/tdapi/tl_terms_of_service_gen.go deleted file mode 100644 index 71116c273..000000000 --- a/tdapi/tl_terms_of_service_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TermsOfService represents TL type `termsOfService#2c12b185`. -type TermsOfService struct { - // Text of the terms of service - Text FormattedText - // The minimum age of a user to be able to accept the terms; 0 if age isn't restricted - MinUserAge int32 - // True, if a blocking popup with terms of service must be shown to the user - ShowPopup bool -} - -// TermsOfServiceTypeID is TL type id of TermsOfService. -const TermsOfServiceTypeID = 0x2c12b185 - -// Ensuring interfaces in compile-time for TermsOfService. -var ( - _ bin.Encoder = &TermsOfService{} - _ bin.Decoder = &TermsOfService{} - _ bin.BareEncoder = &TermsOfService{} - _ bin.BareDecoder = &TermsOfService{} -) - -func (t *TermsOfService) Zero() bool { - if t == nil { - return true - } - if !(t.Text.Zero()) { - return false - } - if !(t.MinUserAge == 0) { - return false - } - if !(t.ShowPopup == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TermsOfService) String() string { - if t == nil { - return "TermsOfService(nil)" - } - type Alias TermsOfService - return fmt.Sprintf("TermsOfService%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TermsOfService) TypeID() uint32 { - return TermsOfServiceTypeID -} - -// TypeName returns name of type in TL schema. -func (*TermsOfService) TypeName() string { - return "termsOfService" -} - -// TypeInfo returns info about TL type. -func (t *TermsOfService) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "termsOfService", - ID: TermsOfServiceTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "MinUserAge", - SchemaName: "min_user_age", - }, - { - Name: "ShowPopup", - SchemaName: "show_popup", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TermsOfService) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode termsOfService#2c12b185 as nil") - } - b.PutID(TermsOfServiceTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TermsOfService) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode termsOfService#2c12b185 as nil") - } - if err := t.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode termsOfService#2c12b185: field text: %w", err) - } - b.PutInt32(t.MinUserAge) - b.PutBool(t.ShowPopup) - return nil -} - -// Decode implements bin.Decoder. -func (t *TermsOfService) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode termsOfService#2c12b185 to nil") - } - if err := b.ConsumeID(TermsOfServiceTypeID); err != nil { - return fmt.Errorf("unable to decode termsOfService#2c12b185: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TermsOfService) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode termsOfService#2c12b185 to nil") - } - { - if err := t.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode termsOfService#2c12b185: field text: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode termsOfService#2c12b185: field min_user_age: %w", err) - } - t.MinUserAge = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode termsOfService#2c12b185: field show_popup: %w", err) - } - t.ShowPopup = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TermsOfService) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode termsOfService#2c12b185 as nil") - } - b.ObjStart() - b.PutID("termsOfService") - b.Comma() - b.FieldStart("text") - if err := t.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode termsOfService#2c12b185: field text: %w", err) - } - b.Comma() - b.FieldStart("min_user_age") - b.PutInt32(t.MinUserAge) - b.Comma() - b.FieldStart("show_popup") - b.PutBool(t.ShowPopup) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TermsOfService) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode termsOfService#2c12b185 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("termsOfService"); err != nil { - return fmt.Errorf("unable to decode termsOfService#2c12b185: %w", err) - } - case "text": - if err := t.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode termsOfService#2c12b185: field text: %w", err) - } - case "min_user_age": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode termsOfService#2c12b185: field min_user_age: %w", err) - } - t.MinUserAge = value - case "show_popup": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode termsOfService#2c12b185: field show_popup: %w", err) - } - t.ShowPopup = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (t *TermsOfService) GetText() (value FormattedText) { - if t == nil { - return - } - return t.Text -} - -// GetMinUserAge returns value of MinUserAge field. -func (t *TermsOfService) GetMinUserAge() (value int32) { - if t == nil { - return - } - return t.MinUserAge -} - -// GetShowPopup returns value of ShowPopup field. -func (t *TermsOfService) GetShowPopup() (value bool) { - if t == nil { - return - } - return t.ShowPopup -} diff --git a/tdapi/tl_test_bytes_gen.go b/tdapi/tl_test_bytes_gen.go deleted file mode 100644 index 8cb028440..000000000 --- a/tdapi/tl_test_bytes_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestBytes represents TL type `testBytes#a422c4de`. -type TestBytes struct { - // Bytes - Value []byte -} - -// TestBytesTypeID is TL type id of TestBytes. -const TestBytesTypeID = 0xa422c4de - -// Ensuring interfaces in compile-time for TestBytes. -var ( - _ bin.Encoder = &TestBytes{} - _ bin.Decoder = &TestBytes{} - _ bin.BareEncoder = &TestBytes{} - _ bin.BareDecoder = &TestBytes{} -) - -func (t *TestBytes) Zero() bool { - if t == nil { - return true - } - if !(t.Value == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestBytes) String() string { - if t == nil { - return "TestBytes(nil)" - } - type Alias TestBytes - return fmt.Sprintf("TestBytes%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestBytes) TypeID() uint32 { - return TestBytesTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestBytes) TypeName() string { - return "testBytes" -} - -// TypeInfo returns info about TL type. -func (t *TestBytes) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testBytes", - ID: TestBytesTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestBytes) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testBytes#a422c4de as nil") - } - b.PutID(TestBytesTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestBytes) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testBytes#a422c4de as nil") - } - b.PutBytes(t.Value) - return nil -} - -// Decode implements bin.Decoder. -func (t *TestBytes) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testBytes#a422c4de to nil") - } - if err := b.ConsumeID(TestBytesTypeID); err != nil { - return fmt.Errorf("unable to decode testBytes#a422c4de: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestBytes) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testBytes#a422c4de to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode testBytes#a422c4de: field value: %w", err) - } - t.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestBytes) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testBytes#a422c4de as nil") - } - b.ObjStart() - b.PutID("testBytes") - b.Comma() - b.FieldStart("value") - b.PutBytes(t.Value) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestBytes) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testBytes#a422c4de to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testBytes"); err != nil { - return fmt.Errorf("unable to decode testBytes#a422c4de: %w", err) - } - case "value": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode testBytes#a422c4de: field value: %w", err) - } - t.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (t *TestBytes) GetValue() (value []byte) { - if t == nil { - return - } - return t.Value -} diff --git a/tdapi/tl_test_call_bytes_gen.go b/tdapi/tl_test_call_bytes_gen.go deleted file mode 100644 index 57dc5bd8d..000000000 --- a/tdapi/tl_test_call_bytes_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestCallBytesRequest represents TL type `testCallBytes#d4215aa9`. -type TestCallBytesRequest struct { - // Bytes to return - X []byte -} - -// TestCallBytesRequestTypeID is TL type id of TestCallBytesRequest. -const TestCallBytesRequestTypeID = 0xd4215aa9 - -// Ensuring interfaces in compile-time for TestCallBytesRequest. -var ( - _ bin.Encoder = &TestCallBytesRequest{} - _ bin.Decoder = &TestCallBytesRequest{} - _ bin.BareEncoder = &TestCallBytesRequest{} - _ bin.BareDecoder = &TestCallBytesRequest{} -) - -func (t *TestCallBytesRequest) Zero() bool { - if t == nil { - return true - } - if !(t.X == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestCallBytesRequest) String() string { - if t == nil { - return "TestCallBytesRequest(nil)" - } - type Alias TestCallBytesRequest - return fmt.Sprintf("TestCallBytesRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestCallBytesRequest) TypeID() uint32 { - return TestCallBytesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestCallBytesRequest) TypeName() string { - return "testCallBytes" -} - -// TypeInfo returns info about TL type. -func (t *TestCallBytesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testCallBytes", - ID: TestCallBytesRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "X", - SchemaName: "x", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestCallBytesRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallBytes#d4215aa9 as nil") - } - b.PutID(TestCallBytesRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestCallBytesRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallBytes#d4215aa9 as nil") - } - b.PutBytes(t.X) - return nil -} - -// Decode implements bin.Decoder. -func (t *TestCallBytesRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallBytes#d4215aa9 to nil") - } - if err := b.ConsumeID(TestCallBytesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testCallBytes#d4215aa9: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestCallBytesRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallBytes#d4215aa9 to nil") - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode testCallBytes#d4215aa9: field x: %w", err) - } - t.X = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestCallBytesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testCallBytes#d4215aa9 as nil") - } - b.ObjStart() - b.PutID("testCallBytes") - b.Comma() - b.FieldStart("x") - b.PutBytes(t.X) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestCallBytesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testCallBytes#d4215aa9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testCallBytes"); err != nil { - return fmt.Errorf("unable to decode testCallBytes#d4215aa9: %w", err) - } - case "x": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode testCallBytes#d4215aa9: field x: %w", err) - } - t.X = value - default: - return b.Skip() - } - return nil - }) -} - -// GetX returns value of X field. -func (t *TestCallBytesRequest) GetX() (value []byte) { - if t == nil { - return - } - return t.X -} - -// TestCallBytes invokes method testCallBytes#d4215aa9 returning error if any. -func (c *Client) TestCallBytes(ctx context.Context, x []byte) (*TestBytes, error) { - var result TestBytes - - request := &TestCallBytesRequest{ - X: x, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_test_call_empty_gen.go b/tdapi/tl_test_call_empty_gen.go deleted file mode 100644 index be96eaaf9..000000000 --- a/tdapi/tl_test_call_empty_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestCallEmptyRequest represents TL type `testCallEmpty#da9c4a16`. -type TestCallEmptyRequest struct { -} - -// TestCallEmptyRequestTypeID is TL type id of TestCallEmptyRequest. -const TestCallEmptyRequestTypeID = 0xda9c4a16 - -// Ensuring interfaces in compile-time for TestCallEmptyRequest. -var ( - _ bin.Encoder = &TestCallEmptyRequest{} - _ bin.Decoder = &TestCallEmptyRequest{} - _ bin.BareEncoder = &TestCallEmptyRequest{} - _ bin.BareDecoder = &TestCallEmptyRequest{} -) - -func (t *TestCallEmptyRequest) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestCallEmptyRequest) String() string { - if t == nil { - return "TestCallEmptyRequest(nil)" - } - type Alias TestCallEmptyRequest - return fmt.Sprintf("TestCallEmptyRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestCallEmptyRequest) TypeID() uint32 { - return TestCallEmptyRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestCallEmptyRequest) TypeName() string { - return "testCallEmpty" -} - -// TypeInfo returns info about TL type. -func (t *TestCallEmptyRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testCallEmpty", - ID: TestCallEmptyRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TestCallEmptyRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallEmpty#da9c4a16 as nil") - } - b.PutID(TestCallEmptyRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestCallEmptyRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallEmpty#da9c4a16 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestCallEmptyRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallEmpty#da9c4a16 to nil") - } - if err := b.ConsumeID(TestCallEmptyRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testCallEmpty#da9c4a16: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestCallEmptyRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallEmpty#da9c4a16 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestCallEmptyRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testCallEmpty#da9c4a16 as nil") - } - b.ObjStart() - b.PutID("testCallEmpty") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestCallEmptyRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testCallEmpty#da9c4a16 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testCallEmpty"); err != nil { - return fmt.Errorf("unable to decode testCallEmpty#da9c4a16: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TestCallEmpty invokes method testCallEmpty#da9c4a16 returning error if any. -func (c *Client) TestCallEmpty(ctx context.Context) error { - var ok Ok - - request := &TestCallEmptyRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_test_call_string_gen.go b/tdapi/tl_test_call_string_gen.go deleted file mode 100644 index e7e384605..000000000 --- a/tdapi/tl_test_call_string_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestCallStringRequest represents TL type `testCallString#98b74a2f`. -type TestCallStringRequest struct { - // String to return - X string -} - -// TestCallStringRequestTypeID is TL type id of TestCallStringRequest. -const TestCallStringRequestTypeID = 0x98b74a2f - -// Ensuring interfaces in compile-time for TestCallStringRequest. -var ( - _ bin.Encoder = &TestCallStringRequest{} - _ bin.Decoder = &TestCallStringRequest{} - _ bin.BareEncoder = &TestCallStringRequest{} - _ bin.BareDecoder = &TestCallStringRequest{} -) - -func (t *TestCallStringRequest) Zero() bool { - if t == nil { - return true - } - if !(t.X == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestCallStringRequest) String() string { - if t == nil { - return "TestCallStringRequest(nil)" - } - type Alias TestCallStringRequest - return fmt.Sprintf("TestCallStringRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestCallStringRequest) TypeID() uint32 { - return TestCallStringRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestCallStringRequest) TypeName() string { - return "testCallString" -} - -// TypeInfo returns info about TL type. -func (t *TestCallStringRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testCallString", - ID: TestCallStringRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "X", - SchemaName: "x", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestCallStringRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallString#98b74a2f as nil") - } - b.PutID(TestCallStringRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestCallStringRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallString#98b74a2f as nil") - } - b.PutString(t.X) - return nil -} - -// Decode implements bin.Decoder. -func (t *TestCallStringRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallString#98b74a2f to nil") - } - if err := b.ConsumeID(TestCallStringRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testCallString#98b74a2f: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestCallStringRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallString#98b74a2f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode testCallString#98b74a2f: field x: %w", err) - } - t.X = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestCallStringRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testCallString#98b74a2f as nil") - } - b.ObjStart() - b.PutID("testCallString") - b.Comma() - b.FieldStart("x") - b.PutString(t.X) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestCallStringRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testCallString#98b74a2f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testCallString"); err != nil { - return fmt.Errorf("unable to decode testCallString#98b74a2f: %w", err) - } - case "x": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode testCallString#98b74a2f: field x: %w", err) - } - t.X = value - default: - return b.Skip() - } - return nil - }) -} - -// GetX returns value of X field. -func (t *TestCallStringRequest) GetX() (value string) { - if t == nil { - return - } - return t.X -} - -// TestCallString invokes method testCallString#98b74a2f returning error if any. -func (c *Client) TestCallString(ctx context.Context, x string) (*TestString, error) { - var result TestString - - request := &TestCallStringRequest{ - X: x, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_test_call_vector_int_gen.go b/tdapi/tl_test_call_vector_int_gen.go deleted file mode 100644 index e62f44d00..000000000 --- a/tdapi/tl_test_call_vector_int_gen.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestCallVectorIntRequest represents TL type `testCallVectorInt#65ed7e72`. -type TestCallVectorIntRequest struct { - // Vector of numbers to return - X []int32 -} - -// TestCallVectorIntRequestTypeID is TL type id of TestCallVectorIntRequest. -const TestCallVectorIntRequestTypeID = 0x65ed7e72 - -// Ensuring interfaces in compile-time for TestCallVectorIntRequest. -var ( - _ bin.Encoder = &TestCallVectorIntRequest{} - _ bin.Decoder = &TestCallVectorIntRequest{} - _ bin.BareEncoder = &TestCallVectorIntRequest{} - _ bin.BareDecoder = &TestCallVectorIntRequest{} -) - -func (t *TestCallVectorIntRequest) Zero() bool { - if t == nil { - return true - } - if !(t.X == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestCallVectorIntRequest) String() string { - if t == nil { - return "TestCallVectorIntRequest(nil)" - } - type Alias TestCallVectorIntRequest - return fmt.Sprintf("TestCallVectorIntRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestCallVectorIntRequest) TypeID() uint32 { - return TestCallVectorIntRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestCallVectorIntRequest) TypeName() string { - return "testCallVectorInt" -} - -// TypeInfo returns info about TL type. -func (t *TestCallVectorIntRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testCallVectorInt", - ID: TestCallVectorIntRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "X", - SchemaName: "x", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestCallVectorIntRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorInt#65ed7e72 as nil") - } - b.PutID(TestCallVectorIntRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestCallVectorIntRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorInt#65ed7e72 as nil") - } - b.PutInt(len(t.X)) - for _, v := range t.X { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestCallVectorIntRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorInt#65ed7e72 to nil") - } - if err := b.ConsumeID(TestCallVectorIntRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testCallVectorInt#65ed7e72: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestCallVectorIntRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorInt#65ed7e72 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode testCallVectorInt#65ed7e72: field x: %w", err) - } - - if headerLen > 0 { - t.X = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testCallVectorInt#65ed7e72: field x: %w", err) - } - t.X = append(t.X, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestCallVectorIntRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorInt#65ed7e72 as nil") - } - b.ObjStart() - b.PutID("testCallVectorInt") - b.Comma() - b.FieldStart("x") - b.ArrStart() - for _, v := range t.X { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestCallVectorIntRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorInt#65ed7e72 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testCallVectorInt"); err != nil { - return fmt.Errorf("unable to decode testCallVectorInt#65ed7e72: %w", err) - } - case "x": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testCallVectorInt#65ed7e72: field x: %w", err) - } - t.X = append(t.X, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode testCallVectorInt#65ed7e72: field x: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetX returns value of X field. -func (t *TestCallVectorIntRequest) GetX() (value []int32) { - if t == nil { - return - } - return t.X -} - -// TestCallVectorInt invokes method testCallVectorInt#65ed7e72 returning error if any. -func (c *Client) TestCallVectorInt(ctx context.Context, x []int32) (*TestVectorInt, error) { - var result TestVectorInt - - request := &TestCallVectorIntRequest{ - X: x, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_test_call_vector_int_object_gen.go b/tdapi/tl_test_call_vector_int_object_gen.go deleted file mode 100644 index fb9345e84..000000000 --- a/tdapi/tl_test_call_vector_int_object_gen.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestCallVectorIntObjectRequest represents TL type `testCallVectorIntObject#ca57f472`. -type TestCallVectorIntObjectRequest struct { - // Vector of objects to return - X []TestInt -} - -// TestCallVectorIntObjectRequestTypeID is TL type id of TestCallVectorIntObjectRequest. -const TestCallVectorIntObjectRequestTypeID = 0xca57f472 - -// Ensuring interfaces in compile-time for TestCallVectorIntObjectRequest. -var ( - _ bin.Encoder = &TestCallVectorIntObjectRequest{} - _ bin.Decoder = &TestCallVectorIntObjectRequest{} - _ bin.BareEncoder = &TestCallVectorIntObjectRequest{} - _ bin.BareDecoder = &TestCallVectorIntObjectRequest{} -) - -func (t *TestCallVectorIntObjectRequest) Zero() bool { - if t == nil { - return true - } - if !(t.X == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestCallVectorIntObjectRequest) String() string { - if t == nil { - return "TestCallVectorIntObjectRequest(nil)" - } - type Alias TestCallVectorIntObjectRequest - return fmt.Sprintf("TestCallVectorIntObjectRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestCallVectorIntObjectRequest) TypeID() uint32 { - return TestCallVectorIntObjectRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestCallVectorIntObjectRequest) TypeName() string { - return "testCallVectorIntObject" -} - -// TypeInfo returns info about TL type. -func (t *TestCallVectorIntObjectRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testCallVectorIntObject", - ID: TestCallVectorIntObjectRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "X", - SchemaName: "x", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestCallVectorIntObjectRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorIntObject#ca57f472 as nil") - } - b.PutID(TestCallVectorIntObjectRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestCallVectorIntObjectRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorIntObject#ca57f472 as nil") - } - b.PutInt(len(t.X)) - for idx, v := range t.X { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare testCallVectorIntObject#ca57f472: field x element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestCallVectorIntObjectRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorIntObject#ca57f472 to nil") - } - if err := b.ConsumeID(TestCallVectorIntObjectRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testCallVectorIntObject#ca57f472: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestCallVectorIntObjectRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorIntObject#ca57f472 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode testCallVectorIntObject#ca57f472: field x: %w", err) - } - - if headerLen > 0 { - t.X = make([]TestInt, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value TestInt - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare testCallVectorIntObject#ca57f472: field x: %w", err) - } - t.X = append(t.X, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestCallVectorIntObjectRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorIntObject#ca57f472 as nil") - } - b.ObjStart() - b.PutID("testCallVectorIntObject") - b.Comma() - b.FieldStart("x") - b.ArrStart() - for idx, v := range t.X { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode testCallVectorIntObject#ca57f472: field x element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestCallVectorIntObjectRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorIntObject#ca57f472 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testCallVectorIntObject"); err != nil { - return fmt.Errorf("unable to decode testCallVectorIntObject#ca57f472: %w", err) - } - case "x": - if err := b.Arr(func(b tdjson.Decoder) error { - var value TestInt - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode testCallVectorIntObject#ca57f472: field x: %w", err) - } - t.X = append(t.X, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode testCallVectorIntObject#ca57f472: field x: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetX returns value of X field. -func (t *TestCallVectorIntObjectRequest) GetX() (value []TestInt) { - if t == nil { - return - } - return t.X -} - -// TestCallVectorIntObject invokes method testCallVectorIntObject#ca57f472 returning error if any. -func (c *Client) TestCallVectorIntObject(ctx context.Context, x []TestInt) (*TestVectorIntObject, error) { - var result TestVectorIntObject - - request := &TestCallVectorIntObjectRequest{ - X: x, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_test_call_vector_string_gen.go b/tdapi/tl_test_call_vector_string_gen.go deleted file mode 100644 index ade36c4ea..000000000 --- a/tdapi/tl_test_call_vector_string_gen.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestCallVectorStringRequest represents TL type `testCallVectorString#8e5a6ed8`. -type TestCallVectorStringRequest struct { - // Vector of strings to return - X []string -} - -// TestCallVectorStringRequestTypeID is TL type id of TestCallVectorStringRequest. -const TestCallVectorStringRequestTypeID = 0x8e5a6ed8 - -// Ensuring interfaces in compile-time for TestCallVectorStringRequest. -var ( - _ bin.Encoder = &TestCallVectorStringRequest{} - _ bin.Decoder = &TestCallVectorStringRequest{} - _ bin.BareEncoder = &TestCallVectorStringRequest{} - _ bin.BareDecoder = &TestCallVectorStringRequest{} -) - -func (t *TestCallVectorStringRequest) Zero() bool { - if t == nil { - return true - } - if !(t.X == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestCallVectorStringRequest) String() string { - if t == nil { - return "TestCallVectorStringRequest(nil)" - } - type Alias TestCallVectorStringRequest - return fmt.Sprintf("TestCallVectorStringRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestCallVectorStringRequest) TypeID() uint32 { - return TestCallVectorStringRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestCallVectorStringRequest) TypeName() string { - return "testCallVectorString" -} - -// TypeInfo returns info about TL type. -func (t *TestCallVectorStringRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testCallVectorString", - ID: TestCallVectorStringRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "X", - SchemaName: "x", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestCallVectorStringRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorString#8e5a6ed8 as nil") - } - b.PutID(TestCallVectorStringRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestCallVectorStringRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorString#8e5a6ed8 as nil") - } - b.PutInt(len(t.X)) - for _, v := range t.X { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestCallVectorStringRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorString#8e5a6ed8 to nil") - } - if err := b.ConsumeID(TestCallVectorStringRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testCallVectorString#8e5a6ed8: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestCallVectorStringRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorString#8e5a6ed8 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode testCallVectorString#8e5a6ed8: field x: %w", err) - } - - if headerLen > 0 { - t.X = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode testCallVectorString#8e5a6ed8: field x: %w", err) - } - t.X = append(t.X, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestCallVectorStringRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorString#8e5a6ed8 as nil") - } - b.ObjStart() - b.PutID("testCallVectorString") - b.Comma() - b.FieldStart("x") - b.ArrStart() - for _, v := range t.X { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestCallVectorStringRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorString#8e5a6ed8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testCallVectorString"); err != nil { - return fmt.Errorf("unable to decode testCallVectorString#8e5a6ed8: %w", err) - } - case "x": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode testCallVectorString#8e5a6ed8: field x: %w", err) - } - t.X = append(t.X, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode testCallVectorString#8e5a6ed8: field x: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetX returns value of X field. -func (t *TestCallVectorStringRequest) GetX() (value []string) { - if t == nil { - return - } - return t.X -} - -// TestCallVectorString invokes method testCallVectorString#8e5a6ed8 returning error if any. -func (c *Client) TestCallVectorString(ctx context.Context, x []string) (*TestVectorString, error) { - var result TestVectorString - - request := &TestCallVectorStringRequest{ - X: x, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_test_call_vector_string_object_gen.go b/tdapi/tl_test_call_vector_string_object_gen.go deleted file mode 100644 index d397107f8..000000000 --- a/tdapi/tl_test_call_vector_string_object_gen.go +++ /dev/null @@ -1,234 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestCallVectorStringObjectRequest represents TL type `testCallVectorStringObject#96cd6de`. -type TestCallVectorStringObjectRequest struct { - // Vector of objects to return - X []TestString -} - -// TestCallVectorStringObjectRequestTypeID is TL type id of TestCallVectorStringObjectRequest. -const TestCallVectorStringObjectRequestTypeID = 0x96cd6de - -// Ensuring interfaces in compile-time for TestCallVectorStringObjectRequest. -var ( - _ bin.Encoder = &TestCallVectorStringObjectRequest{} - _ bin.Decoder = &TestCallVectorStringObjectRequest{} - _ bin.BareEncoder = &TestCallVectorStringObjectRequest{} - _ bin.BareDecoder = &TestCallVectorStringObjectRequest{} -) - -func (t *TestCallVectorStringObjectRequest) Zero() bool { - if t == nil { - return true - } - if !(t.X == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestCallVectorStringObjectRequest) String() string { - if t == nil { - return "TestCallVectorStringObjectRequest(nil)" - } - type Alias TestCallVectorStringObjectRequest - return fmt.Sprintf("TestCallVectorStringObjectRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestCallVectorStringObjectRequest) TypeID() uint32 { - return TestCallVectorStringObjectRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestCallVectorStringObjectRequest) TypeName() string { - return "testCallVectorStringObject" -} - -// TypeInfo returns info about TL type. -func (t *TestCallVectorStringObjectRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testCallVectorStringObject", - ID: TestCallVectorStringObjectRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "X", - SchemaName: "x", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestCallVectorStringObjectRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorStringObject#96cd6de as nil") - } - b.PutID(TestCallVectorStringObjectRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestCallVectorStringObjectRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorStringObject#96cd6de as nil") - } - b.PutInt(len(t.X)) - for idx, v := range t.X { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare testCallVectorStringObject#96cd6de: field x element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestCallVectorStringObjectRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorStringObject#96cd6de to nil") - } - if err := b.ConsumeID(TestCallVectorStringObjectRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testCallVectorStringObject#96cd6de: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestCallVectorStringObjectRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorStringObject#96cd6de to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode testCallVectorStringObject#96cd6de: field x: %w", err) - } - - if headerLen > 0 { - t.X = make([]TestString, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value TestString - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare testCallVectorStringObject#96cd6de: field x: %w", err) - } - t.X = append(t.X, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestCallVectorStringObjectRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testCallVectorStringObject#96cd6de as nil") - } - b.ObjStart() - b.PutID("testCallVectorStringObject") - b.Comma() - b.FieldStart("x") - b.ArrStart() - for idx, v := range t.X { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode testCallVectorStringObject#96cd6de: field x element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestCallVectorStringObjectRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testCallVectorStringObject#96cd6de to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testCallVectorStringObject"); err != nil { - return fmt.Errorf("unable to decode testCallVectorStringObject#96cd6de: %w", err) - } - case "x": - if err := b.Arr(func(b tdjson.Decoder) error { - var value TestString - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode testCallVectorStringObject#96cd6de: field x: %w", err) - } - t.X = append(t.X, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode testCallVectorStringObject#96cd6de: field x: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetX returns value of X field. -func (t *TestCallVectorStringObjectRequest) GetX() (value []TestString) { - if t == nil { - return - } - return t.X -} - -// TestCallVectorStringObject invokes method testCallVectorStringObject#96cd6de returning error if any. -func (c *Client) TestCallVectorStringObject(ctx context.Context, x []TestString) (*TestVectorStringObject, error) { - var result TestVectorStringObject - - request := &TestCallVectorStringObjectRequest{ - X: x, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_test_get_difference_gen.go b/tdapi/tl_test_get_difference_gen.go deleted file mode 100644 index 32ea6bd2a..000000000 --- a/tdapi/tl_test_get_difference_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestGetDifferenceRequest represents TL type `testGetDifference#68226325`. -type TestGetDifferenceRequest struct { -} - -// TestGetDifferenceRequestTypeID is TL type id of TestGetDifferenceRequest. -const TestGetDifferenceRequestTypeID = 0x68226325 - -// Ensuring interfaces in compile-time for TestGetDifferenceRequest. -var ( - _ bin.Encoder = &TestGetDifferenceRequest{} - _ bin.Decoder = &TestGetDifferenceRequest{} - _ bin.BareEncoder = &TestGetDifferenceRequest{} - _ bin.BareDecoder = &TestGetDifferenceRequest{} -) - -func (t *TestGetDifferenceRequest) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestGetDifferenceRequest) String() string { - if t == nil { - return "TestGetDifferenceRequest(nil)" - } - type Alias TestGetDifferenceRequest - return fmt.Sprintf("TestGetDifferenceRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestGetDifferenceRequest) TypeID() uint32 { - return TestGetDifferenceRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestGetDifferenceRequest) TypeName() string { - return "testGetDifference" -} - -// TypeInfo returns info about TL type. -func (t *TestGetDifferenceRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testGetDifference", - ID: TestGetDifferenceRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TestGetDifferenceRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testGetDifference#68226325 as nil") - } - b.PutID(TestGetDifferenceRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestGetDifferenceRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testGetDifference#68226325 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestGetDifferenceRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testGetDifference#68226325 to nil") - } - if err := b.ConsumeID(TestGetDifferenceRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testGetDifference#68226325: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestGetDifferenceRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testGetDifference#68226325 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestGetDifferenceRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testGetDifference#68226325 as nil") - } - b.ObjStart() - b.PutID("testGetDifference") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestGetDifferenceRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testGetDifference#68226325 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testGetDifference"); err != nil { - return fmt.Errorf("unable to decode testGetDifference#68226325: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TestGetDifference invokes method testGetDifference#68226325 returning error if any. -func (c *Client) TestGetDifference(ctx context.Context) error { - var ok Ok - - request := &TestGetDifferenceRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_test_int_gen.go b/tdapi/tl_test_int_gen.go deleted file mode 100644 index 555c8ab4a..000000000 --- a/tdapi/tl_test_int_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestInt represents TL type `testInt#ddbd2c09`. -type TestInt struct { - // Number - Value int32 -} - -// TestIntTypeID is TL type id of TestInt. -const TestIntTypeID = 0xddbd2c09 - -// Ensuring interfaces in compile-time for TestInt. -var ( - _ bin.Encoder = &TestInt{} - _ bin.Decoder = &TestInt{} - _ bin.BareEncoder = &TestInt{} - _ bin.BareDecoder = &TestInt{} -) - -func (t *TestInt) Zero() bool { - if t == nil { - return true - } - if !(t.Value == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestInt) String() string { - if t == nil { - return "TestInt(nil)" - } - type Alias TestInt - return fmt.Sprintf("TestInt%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestInt) TypeID() uint32 { - return TestIntTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestInt) TypeName() string { - return "testInt" -} - -// TypeInfo returns info about TL type. -func (t *TestInt) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testInt", - ID: TestIntTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestInt) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testInt#ddbd2c09 as nil") - } - b.PutID(TestIntTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestInt) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testInt#ddbd2c09 as nil") - } - b.PutInt32(t.Value) - return nil -} - -// Decode implements bin.Decoder. -func (t *TestInt) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testInt#ddbd2c09 to nil") - } - if err := b.ConsumeID(TestIntTypeID); err != nil { - return fmt.Errorf("unable to decode testInt#ddbd2c09: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestInt) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testInt#ddbd2c09 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testInt#ddbd2c09: field value: %w", err) - } - t.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestInt) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testInt#ddbd2c09 as nil") - } - b.ObjStart() - b.PutID("testInt") - b.Comma() - b.FieldStart("value") - b.PutInt32(t.Value) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestInt) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testInt#ddbd2c09 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testInt"); err != nil { - return fmt.Errorf("unable to decode testInt#ddbd2c09: %w", err) - } - case "value": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testInt#ddbd2c09: field value: %w", err) - } - t.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (t *TestInt) GetValue() (value int32) { - if t == nil { - return - } - return t.Value -} diff --git a/tdapi/tl_test_network_gen.go b/tdapi/tl_test_network_gen.go deleted file mode 100644 index a493902cf..000000000 --- a/tdapi/tl_test_network_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestNetworkRequest represents TL type `testNetwork#afe4344b`. -type TestNetworkRequest struct { -} - -// TestNetworkRequestTypeID is TL type id of TestNetworkRequest. -const TestNetworkRequestTypeID = 0xafe4344b - -// Ensuring interfaces in compile-time for TestNetworkRequest. -var ( - _ bin.Encoder = &TestNetworkRequest{} - _ bin.Decoder = &TestNetworkRequest{} - _ bin.BareEncoder = &TestNetworkRequest{} - _ bin.BareDecoder = &TestNetworkRequest{} -) - -func (t *TestNetworkRequest) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestNetworkRequest) String() string { - if t == nil { - return "TestNetworkRequest(nil)" - } - type Alias TestNetworkRequest - return fmt.Sprintf("TestNetworkRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestNetworkRequest) TypeID() uint32 { - return TestNetworkRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestNetworkRequest) TypeName() string { - return "testNetwork" -} - -// TypeInfo returns info about TL type. -func (t *TestNetworkRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testNetwork", - ID: TestNetworkRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TestNetworkRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testNetwork#afe4344b as nil") - } - b.PutID(TestNetworkRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestNetworkRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testNetwork#afe4344b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestNetworkRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testNetwork#afe4344b to nil") - } - if err := b.ConsumeID(TestNetworkRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testNetwork#afe4344b: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestNetworkRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testNetwork#afe4344b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestNetworkRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testNetwork#afe4344b as nil") - } - b.ObjStart() - b.PutID("testNetwork") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestNetworkRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testNetwork#afe4344b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testNetwork"); err != nil { - return fmt.Errorf("unable to decode testNetwork#afe4344b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TestNetwork invokes method testNetwork#afe4344b returning error if any. -func (c *Client) TestNetwork(ctx context.Context) error { - var ok Ok - - request := &TestNetworkRequest{} - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_test_proxy_gen.go b/tdapi/tl_test_proxy_gen.go deleted file mode 100644 index 13bbecf0f..000000000 --- a/tdapi/tl_test_proxy_gen.go +++ /dev/null @@ -1,349 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestProxyRequest represents TL type `testProxy#b8a1a29e`. -type TestProxyRequest struct { - // Proxy server domain or IP address - Server string - // Proxy server port - Port int32 - // Proxy type - Type ProxyTypeClass - // Identifier of a datacenter with which to test connection - DCID int32 - // The maximum overall timeout for the request - Timeout float64 -} - -// TestProxyRequestTypeID is TL type id of TestProxyRequest. -const TestProxyRequestTypeID = 0xb8a1a29e - -// Ensuring interfaces in compile-time for TestProxyRequest. -var ( - _ bin.Encoder = &TestProxyRequest{} - _ bin.Decoder = &TestProxyRequest{} - _ bin.BareEncoder = &TestProxyRequest{} - _ bin.BareDecoder = &TestProxyRequest{} -) - -func (t *TestProxyRequest) Zero() bool { - if t == nil { - return true - } - if !(t.Server == "") { - return false - } - if !(t.Port == 0) { - return false - } - if !(t.Type == nil) { - return false - } - if !(t.DCID == 0) { - return false - } - if !(t.Timeout == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestProxyRequest) String() string { - if t == nil { - return "TestProxyRequest(nil)" - } - type Alias TestProxyRequest - return fmt.Sprintf("TestProxyRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestProxyRequest) TypeID() uint32 { - return TestProxyRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestProxyRequest) TypeName() string { - return "testProxy" -} - -// TypeInfo returns info about TL type. -func (t *TestProxyRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testProxy", - ID: TestProxyRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Server", - SchemaName: "server", - }, - { - Name: "Port", - SchemaName: "port", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "DCID", - SchemaName: "dc_id", - }, - { - Name: "Timeout", - SchemaName: "timeout", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestProxyRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testProxy#b8a1a29e as nil") - } - b.PutID(TestProxyRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestProxyRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testProxy#b8a1a29e as nil") - } - b.PutString(t.Server) - b.PutInt32(t.Port) - if t.Type == nil { - return fmt.Errorf("unable to encode testProxy#b8a1a29e: field type is nil") - } - if err := t.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode testProxy#b8a1a29e: field type: %w", err) - } - b.PutInt32(t.DCID) - b.PutDouble(t.Timeout) - return nil -} - -// Decode implements bin.Decoder. -func (t *TestProxyRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testProxy#b8a1a29e to nil") - } - if err := b.ConsumeID(TestProxyRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestProxyRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testProxy#b8a1a29e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: field server: %w", err) - } - t.Server = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: field port: %w", err) - } - t.Port = value - } - { - value, err := DecodeProxyType(b) - if err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: field type: %w", err) - } - t.Type = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: field dc_id: %w", err) - } - t.DCID = value - } - { - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: field timeout: %w", err) - } - t.Timeout = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestProxyRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testProxy#b8a1a29e as nil") - } - b.ObjStart() - b.PutID("testProxy") - b.Comma() - b.FieldStart("server") - b.PutString(t.Server) - b.Comma() - b.FieldStart("port") - b.PutInt32(t.Port) - b.Comma() - b.FieldStart("type") - if t.Type == nil { - return fmt.Errorf("unable to encode testProxy#b8a1a29e: field type is nil") - } - if err := t.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode testProxy#b8a1a29e: field type: %w", err) - } - b.Comma() - b.FieldStart("dc_id") - b.PutInt32(t.DCID) - b.Comma() - b.FieldStart("timeout") - b.PutDouble(t.Timeout) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestProxyRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testProxy#b8a1a29e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testProxy"); err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: %w", err) - } - case "server": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: field server: %w", err) - } - t.Server = value - case "port": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: field port: %w", err) - } - t.Port = value - case "type": - value, err := DecodeTDLibJSONProxyType(b) - if err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: field type: %w", err) - } - t.Type = value - case "dc_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: field dc_id: %w", err) - } - t.DCID = value - case "timeout": - value, err := b.Double() - if err != nil { - return fmt.Errorf("unable to decode testProxy#b8a1a29e: field timeout: %w", err) - } - t.Timeout = value - default: - return b.Skip() - } - return nil - }) -} - -// GetServer returns value of Server field. -func (t *TestProxyRequest) GetServer() (value string) { - if t == nil { - return - } - return t.Server -} - -// GetPort returns value of Port field. -func (t *TestProxyRequest) GetPort() (value int32) { - if t == nil { - return - } - return t.Port -} - -// GetType returns value of Type field. -func (t *TestProxyRequest) GetType() (value ProxyTypeClass) { - if t == nil { - return - } - return t.Type -} - -// GetDCID returns value of DCID field. -func (t *TestProxyRequest) GetDCID() (value int32) { - if t == nil { - return - } - return t.DCID -} - -// GetTimeout returns value of Timeout field. -func (t *TestProxyRequest) GetTimeout() (value float64) { - if t == nil { - return - } - return t.Timeout -} - -// TestProxy invokes method testProxy#b8a1a29e returning error if any. -func (c *Client) TestProxy(ctx context.Context, request *TestProxyRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_test_return_error_gen.go b/tdapi/tl_test_return_error_gen.go deleted file mode 100644 index f315c96a8..000000000 --- a/tdapi/tl_test_return_error_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestReturnErrorRequest represents TL type `testReturnError#1b217cf2`. -type TestReturnErrorRequest struct { - // The error to be returned - Error Error -} - -// TestReturnErrorRequestTypeID is TL type id of TestReturnErrorRequest. -const TestReturnErrorRequestTypeID = 0x1b217cf2 - -// Ensuring interfaces in compile-time for TestReturnErrorRequest. -var ( - _ bin.Encoder = &TestReturnErrorRequest{} - _ bin.Decoder = &TestReturnErrorRequest{} - _ bin.BareEncoder = &TestReturnErrorRequest{} - _ bin.BareDecoder = &TestReturnErrorRequest{} -) - -func (t *TestReturnErrorRequest) Zero() bool { - if t == nil { - return true - } - if !(t.Error.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestReturnErrorRequest) String() string { - if t == nil { - return "TestReturnErrorRequest(nil)" - } - type Alias TestReturnErrorRequest - return fmt.Sprintf("TestReturnErrorRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestReturnErrorRequest) TypeID() uint32 { - return TestReturnErrorRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestReturnErrorRequest) TypeName() string { - return "testReturnError" -} - -// TypeInfo returns info about TL type. -func (t *TestReturnErrorRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testReturnError", - ID: TestReturnErrorRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Error", - SchemaName: "error", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestReturnErrorRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testReturnError#1b217cf2 as nil") - } - b.PutID(TestReturnErrorRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestReturnErrorRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testReturnError#1b217cf2 as nil") - } - if err := t.Error.Encode(b); err != nil { - return fmt.Errorf("unable to encode testReturnError#1b217cf2: field error: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestReturnErrorRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testReturnError#1b217cf2 to nil") - } - if err := b.ConsumeID(TestReturnErrorRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testReturnError#1b217cf2: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestReturnErrorRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testReturnError#1b217cf2 to nil") - } - { - if err := t.Error.Decode(b); err != nil { - return fmt.Errorf("unable to decode testReturnError#1b217cf2: field error: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestReturnErrorRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testReturnError#1b217cf2 as nil") - } - b.ObjStart() - b.PutID("testReturnError") - b.Comma() - b.FieldStart("error") - if err := t.Error.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode testReturnError#1b217cf2: field error: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestReturnErrorRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testReturnError#1b217cf2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testReturnError"); err != nil { - return fmt.Errorf("unable to decode testReturnError#1b217cf2: %w", err) - } - case "error": - if err := t.Error.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode testReturnError#1b217cf2: field error: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetError returns value of Error field. -func (t *TestReturnErrorRequest) GetError() (value Error) { - if t == nil { - return - } - return t.Error -} - -// TestReturnError invokes method testReturnError#1b217cf2 returning error if any. -func (c *Client) TestReturnError(ctx context.Context, error Error) (*Error, error) { - var result Error - - request := &TestReturnErrorRequest{ - Error: error, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_test_square_int_gen.go b/tdapi/tl_test_square_int_gen.go deleted file mode 100644 index d30e691f5..000000000 --- a/tdapi/tl_test_square_int_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestSquareIntRequest represents TL type `testSquareInt#fc6a6990`. -type TestSquareIntRequest struct { - // Number to square - X int32 -} - -// TestSquareIntRequestTypeID is TL type id of TestSquareIntRequest. -const TestSquareIntRequestTypeID = 0xfc6a6990 - -// Ensuring interfaces in compile-time for TestSquareIntRequest. -var ( - _ bin.Encoder = &TestSquareIntRequest{} - _ bin.Decoder = &TestSquareIntRequest{} - _ bin.BareEncoder = &TestSquareIntRequest{} - _ bin.BareDecoder = &TestSquareIntRequest{} -) - -func (t *TestSquareIntRequest) Zero() bool { - if t == nil { - return true - } - if !(t.X == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestSquareIntRequest) String() string { - if t == nil { - return "TestSquareIntRequest(nil)" - } - type Alias TestSquareIntRequest - return fmt.Sprintf("TestSquareIntRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestSquareIntRequest) TypeID() uint32 { - return TestSquareIntRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestSquareIntRequest) TypeName() string { - return "testSquareInt" -} - -// TypeInfo returns info about TL type. -func (t *TestSquareIntRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testSquareInt", - ID: TestSquareIntRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "X", - SchemaName: "x", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestSquareIntRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testSquareInt#fc6a6990 as nil") - } - b.PutID(TestSquareIntRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestSquareIntRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testSquareInt#fc6a6990 as nil") - } - b.PutInt32(t.X) - return nil -} - -// Decode implements bin.Decoder. -func (t *TestSquareIntRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testSquareInt#fc6a6990 to nil") - } - if err := b.ConsumeID(TestSquareIntRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testSquareInt#fc6a6990: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestSquareIntRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testSquareInt#fc6a6990 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testSquareInt#fc6a6990: field x: %w", err) - } - t.X = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestSquareIntRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testSquareInt#fc6a6990 as nil") - } - b.ObjStart() - b.PutID("testSquareInt") - b.Comma() - b.FieldStart("x") - b.PutInt32(t.X) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestSquareIntRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testSquareInt#fc6a6990 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testSquareInt"); err != nil { - return fmt.Errorf("unable to decode testSquareInt#fc6a6990: %w", err) - } - case "x": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testSquareInt#fc6a6990: field x: %w", err) - } - t.X = value - default: - return b.Skip() - } - return nil - }) -} - -// GetX returns value of X field. -func (t *TestSquareIntRequest) GetX() (value int32) { - if t == nil { - return - } - return t.X -} - -// TestSquareInt invokes method testSquareInt#fc6a6990 returning error if any. -func (c *Client) TestSquareInt(ctx context.Context, x int32) (*TestInt, error) { - var result TestInt - - request := &TestSquareIntRequest{ - X: x, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_test_string_gen.go b/tdapi/tl_test_string_gen.go deleted file mode 100644 index d99c47afd..000000000 --- a/tdapi/tl_test_string_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestString represents TL type `testString#fe56688c`. -type TestString struct { - // String - Value string -} - -// TestStringTypeID is TL type id of TestString. -const TestStringTypeID = 0xfe56688c - -// Ensuring interfaces in compile-time for TestString. -var ( - _ bin.Encoder = &TestString{} - _ bin.Decoder = &TestString{} - _ bin.BareEncoder = &TestString{} - _ bin.BareDecoder = &TestString{} -) - -func (t *TestString) Zero() bool { - if t == nil { - return true - } - if !(t.Value == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestString) String() string { - if t == nil { - return "TestString(nil)" - } - type Alias TestString - return fmt.Sprintf("TestString%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestString) TypeID() uint32 { - return TestStringTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestString) TypeName() string { - return "testString" -} - -// TypeInfo returns info about TL type. -func (t *TestString) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testString", - ID: TestStringTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestString) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testString#fe56688c as nil") - } - b.PutID(TestStringTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestString) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testString#fe56688c as nil") - } - b.PutString(t.Value) - return nil -} - -// Decode implements bin.Decoder. -func (t *TestString) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testString#fe56688c to nil") - } - if err := b.ConsumeID(TestStringTypeID); err != nil { - return fmt.Errorf("unable to decode testString#fe56688c: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestString) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testString#fe56688c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode testString#fe56688c: field value: %w", err) - } - t.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestString) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testString#fe56688c as nil") - } - b.ObjStart() - b.PutID("testString") - b.Comma() - b.FieldStart("value") - b.PutString(t.Value) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestString) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testString#fe56688c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testString"); err != nil { - return fmt.Errorf("unable to decode testString#fe56688c: %w", err) - } - case "value": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode testString#fe56688c: field value: %w", err) - } - t.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (t *TestString) GetValue() (value string) { - if t == nil { - return - } - return t.Value -} diff --git a/tdapi/tl_test_use_update_gen.go b/tdapi/tl_test_use_update_gen.go deleted file mode 100644 index df4b7b9e2..000000000 --- a/tdapi/tl_test_use_update_gen.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestUseUpdateRequest represents TL type `testUseUpdate#2abdff1e`. -type TestUseUpdateRequest struct { -} - -// TestUseUpdateRequestTypeID is TL type id of TestUseUpdateRequest. -const TestUseUpdateRequestTypeID = 0x2abdff1e - -// Ensuring interfaces in compile-time for TestUseUpdateRequest. -var ( - _ bin.Encoder = &TestUseUpdateRequest{} - _ bin.Decoder = &TestUseUpdateRequest{} - _ bin.BareEncoder = &TestUseUpdateRequest{} - _ bin.BareDecoder = &TestUseUpdateRequest{} -) - -func (t *TestUseUpdateRequest) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestUseUpdateRequest) String() string { - if t == nil { - return "TestUseUpdateRequest(nil)" - } - type Alias TestUseUpdateRequest - return fmt.Sprintf("TestUseUpdateRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestUseUpdateRequest) TypeID() uint32 { - return TestUseUpdateRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestUseUpdateRequest) TypeName() string { - return "testUseUpdate" -} - -// TypeInfo returns info about TL type. -func (t *TestUseUpdateRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testUseUpdate", - ID: TestUseUpdateRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TestUseUpdateRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testUseUpdate#2abdff1e as nil") - } - b.PutID(TestUseUpdateRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestUseUpdateRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testUseUpdate#2abdff1e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestUseUpdateRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testUseUpdate#2abdff1e to nil") - } - if err := b.ConsumeID(TestUseUpdateRequestTypeID); err != nil { - return fmt.Errorf("unable to decode testUseUpdate#2abdff1e: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestUseUpdateRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testUseUpdate#2abdff1e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestUseUpdateRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testUseUpdate#2abdff1e as nil") - } - b.ObjStart() - b.PutID("testUseUpdate") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestUseUpdateRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testUseUpdate#2abdff1e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testUseUpdate"); err != nil { - return fmt.Errorf("unable to decode testUseUpdate#2abdff1e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TestUseUpdate invokes method testUseUpdate#2abdff1e returning error if any. -func (c *Client) TestUseUpdate(ctx context.Context) (UpdateClass, error) { - var result UpdateBox - - request := &TestUseUpdateRequest{} - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return result.Update, nil -} diff --git a/tdapi/tl_test_vector_int_gen.go b/tdapi/tl_test_vector_int_gen.go deleted file mode 100644 index 8683bb64d..000000000 --- a/tdapi/tl_test_vector_int_gen.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestVectorInt represents TL type `testVectorInt#df9eb113`. -type TestVectorInt struct { - // Vector of numbers - Value []int32 -} - -// TestVectorIntTypeID is TL type id of TestVectorInt. -const TestVectorIntTypeID = 0xdf9eb113 - -// Ensuring interfaces in compile-time for TestVectorInt. -var ( - _ bin.Encoder = &TestVectorInt{} - _ bin.Decoder = &TestVectorInt{} - _ bin.BareEncoder = &TestVectorInt{} - _ bin.BareDecoder = &TestVectorInt{} -) - -func (t *TestVectorInt) Zero() bool { - if t == nil { - return true - } - if !(t.Value == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestVectorInt) String() string { - if t == nil { - return "TestVectorInt(nil)" - } - type Alias TestVectorInt - return fmt.Sprintf("TestVectorInt%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestVectorInt) TypeID() uint32 { - return TestVectorIntTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestVectorInt) TypeName() string { - return "testVectorInt" -} - -// TypeInfo returns info about TL type. -func (t *TestVectorInt) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testVectorInt", - ID: TestVectorIntTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestVectorInt) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testVectorInt#df9eb113 as nil") - } - b.PutID(TestVectorIntTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestVectorInt) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testVectorInt#df9eb113 as nil") - } - b.PutInt(len(t.Value)) - for _, v := range t.Value { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestVectorInt) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testVectorInt#df9eb113 to nil") - } - if err := b.ConsumeID(TestVectorIntTypeID); err != nil { - return fmt.Errorf("unable to decode testVectorInt#df9eb113: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestVectorInt) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testVectorInt#df9eb113 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode testVectorInt#df9eb113: field value: %w", err) - } - - if headerLen > 0 { - t.Value = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testVectorInt#df9eb113: field value: %w", err) - } - t.Value = append(t.Value, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestVectorInt) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testVectorInt#df9eb113 as nil") - } - b.ObjStart() - b.PutID("testVectorInt") - b.Comma() - b.FieldStart("value") - b.ArrStart() - for _, v := range t.Value { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestVectorInt) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testVectorInt#df9eb113 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testVectorInt"); err != nil { - return fmt.Errorf("unable to decode testVectorInt#df9eb113: %w", err) - } - case "value": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode testVectorInt#df9eb113: field value: %w", err) - } - t.Value = append(t.Value, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode testVectorInt#df9eb113: field value: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (t *TestVectorInt) GetValue() (value []int32) { - if t == nil { - return - } - return t.Value -} diff --git a/tdapi/tl_test_vector_int_object_gen.go b/tdapi/tl_test_vector_int_object_gen.go deleted file mode 100644 index 9542815e9..000000000 --- a/tdapi/tl_test_vector_int_object_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestVectorIntObject represents TL type `testVectorIntObject#f152999b`. -type TestVectorIntObject struct { - // Vector of objects - Value []TestInt -} - -// TestVectorIntObjectTypeID is TL type id of TestVectorIntObject. -const TestVectorIntObjectTypeID = 0xf152999b - -// Ensuring interfaces in compile-time for TestVectorIntObject. -var ( - _ bin.Encoder = &TestVectorIntObject{} - _ bin.Decoder = &TestVectorIntObject{} - _ bin.BareEncoder = &TestVectorIntObject{} - _ bin.BareDecoder = &TestVectorIntObject{} -) - -func (t *TestVectorIntObject) Zero() bool { - if t == nil { - return true - } - if !(t.Value == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestVectorIntObject) String() string { - if t == nil { - return "TestVectorIntObject(nil)" - } - type Alias TestVectorIntObject - return fmt.Sprintf("TestVectorIntObject%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestVectorIntObject) TypeID() uint32 { - return TestVectorIntObjectTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestVectorIntObject) TypeName() string { - return "testVectorIntObject" -} - -// TypeInfo returns info about TL type. -func (t *TestVectorIntObject) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testVectorIntObject", - ID: TestVectorIntObjectTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestVectorIntObject) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testVectorIntObject#f152999b as nil") - } - b.PutID(TestVectorIntObjectTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestVectorIntObject) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testVectorIntObject#f152999b as nil") - } - b.PutInt(len(t.Value)) - for idx, v := range t.Value { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare testVectorIntObject#f152999b: field value element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestVectorIntObject) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testVectorIntObject#f152999b to nil") - } - if err := b.ConsumeID(TestVectorIntObjectTypeID); err != nil { - return fmt.Errorf("unable to decode testVectorIntObject#f152999b: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestVectorIntObject) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testVectorIntObject#f152999b to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode testVectorIntObject#f152999b: field value: %w", err) - } - - if headerLen > 0 { - t.Value = make([]TestInt, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value TestInt - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare testVectorIntObject#f152999b: field value: %w", err) - } - t.Value = append(t.Value, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestVectorIntObject) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testVectorIntObject#f152999b as nil") - } - b.ObjStart() - b.PutID("testVectorIntObject") - b.Comma() - b.FieldStart("value") - b.ArrStart() - for idx, v := range t.Value { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode testVectorIntObject#f152999b: field value element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestVectorIntObject) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testVectorIntObject#f152999b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testVectorIntObject"); err != nil { - return fmt.Errorf("unable to decode testVectorIntObject#f152999b: %w", err) - } - case "value": - if err := b.Arr(func(b tdjson.Decoder) error { - var value TestInt - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode testVectorIntObject#f152999b: field value: %w", err) - } - t.Value = append(t.Value, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode testVectorIntObject#f152999b: field value: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (t *TestVectorIntObject) GetValue() (value []TestInt) { - if t == nil { - return - } - return t.Value -} diff --git a/tdapi/tl_test_vector_string_gen.go b/tdapi/tl_test_vector_string_gen.go deleted file mode 100644 index a276f55ff..000000000 --- a/tdapi/tl_test_vector_string_gen.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestVectorString represents TL type `testVectorString#5d6f85bc`. -type TestVectorString struct { - // Vector of strings - Value []string -} - -// TestVectorStringTypeID is TL type id of TestVectorString. -const TestVectorStringTypeID = 0x5d6f85bc - -// Ensuring interfaces in compile-time for TestVectorString. -var ( - _ bin.Encoder = &TestVectorString{} - _ bin.Decoder = &TestVectorString{} - _ bin.BareEncoder = &TestVectorString{} - _ bin.BareDecoder = &TestVectorString{} -) - -func (t *TestVectorString) Zero() bool { - if t == nil { - return true - } - if !(t.Value == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestVectorString) String() string { - if t == nil { - return "TestVectorString(nil)" - } - type Alias TestVectorString - return fmt.Sprintf("TestVectorString%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestVectorString) TypeID() uint32 { - return TestVectorStringTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestVectorString) TypeName() string { - return "testVectorString" -} - -// TypeInfo returns info about TL type. -func (t *TestVectorString) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testVectorString", - ID: TestVectorStringTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestVectorString) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testVectorString#5d6f85bc as nil") - } - b.PutID(TestVectorStringTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestVectorString) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testVectorString#5d6f85bc as nil") - } - b.PutInt(len(t.Value)) - for _, v := range t.Value { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestVectorString) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testVectorString#5d6f85bc to nil") - } - if err := b.ConsumeID(TestVectorStringTypeID); err != nil { - return fmt.Errorf("unable to decode testVectorString#5d6f85bc: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestVectorString) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testVectorString#5d6f85bc to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode testVectorString#5d6f85bc: field value: %w", err) - } - - if headerLen > 0 { - t.Value = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode testVectorString#5d6f85bc: field value: %w", err) - } - t.Value = append(t.Value, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestVectorString) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testVectorString#5d6f85bc as nil") - } - b.ObjStart() - b.PutID("testVectorString") - b.Comma() - b.FieldStart("value") - b.ArrStart() - for _, v := range t.Value { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestVectorString) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testVectorString#5d6f85bc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testVectorString"); err != nil { - return fmt.Errorf("unable to decode testVectorString#5d6f85bc: %w", err) - } - case "value": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode testVectorString#5d6f85bc: field value: %w", err) - } - t.Value = append(t.Value, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode testVectorString#5d6f85bc: field value: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (t *TestVectorString) GetValue() (value []string) { - if t == nil { - return - } - return t.Value -} diff --git a/tdapi/tl_test_vector_string_object_gen.go b/tdapi/tl_test_vector_string_object_gen.go deleted file mode 100644 index 1e923c6f5..000000000 --- a/tdapi/tl_test_vector_string_object_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TestVectorStringObject represents TL type `testVectorStringObject#e5ecc0d`. -type TestVectorStringObject struct { - // Vector of objects - Value []TestString -} - -// TestVectorStringObjectTypeID is TL type id of TestVectorStringObject. -const TestVectorStringObjectTypeID = 0xe5ecc0d - -// Ensuring interfaces in compile-time for TestVectorStringObject. -var ( - _ bin.Encoder = &TestVectorStringObject{} - _ bin.Decoder = &TestVectorStringObject{} - _ bin.BareEncoder = &TestVectorStringObject{} - _ bin.BareDecoder = &TestVectorStringObject{} -) - -func (t *TestVectorStringObject) Zero() bool { - if t == nil { - return true - } - if !(t.Value == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TestVectorStringObject) String() string { - if t == nil { - return "TestVectorStringObject(nil)" - } - type Alias TestVectorStringObject - return fmt.Sprintf("TestVectorStringObject%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TestVectorStringObject) TypeID() uint32 { - return TestVectorStringObjectTypeID -} - -// TypeName returns name of type in TL schema. -func (*TestVectorStringObject) TypeName() string { - return "testVectorStringObject" -} - -// TypeInfo returns info about TL type. -func (t *TestVectorStringObject) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "testVectorStringObject", - ID: TestVectorStringObjectTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TestVectorStringObject) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testVectorStringObject#e5ecc0d as nil") - } - b.PutID(TestVectorStringObjectTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TestVectorStringObject) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode testVectorStringObject#e5ecc0d as nil") - } - b.PutInt(len(t.Value)) - for idx, v := range t.Value { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare testVectorStringObject#e5ecc0d: field value element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TestVectorStringObject) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testVectorStringObject#e5ecc0d to nil") - } - if err := b.ConsumeID(TestVectorStringObjectTypeID); err != nil { - return fmt.Errorf("unable to decode testVectorStringObject#e5ecc0d: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TestVectorStringObject) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode testVectorStringObject#e5ecc0d to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode testVectorStringObject#e5ecc0d: field value: %w", err) - } - - if headerLen > 0 { - t.Value = make([]TestString, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value TestString - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare testVectorStringObject#e5ecc0d: field value: %w", err) - } - t.Value = append(t.Value, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TestVectorStringObject) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode testVectorStringObject#e5ecc0d as nil") - } - b.ObjStart() - b.PutID("testVectorStringObject") - b.Comma() - b.FieldStart("value") - b.ArrStart() - for idx, v := range t.Value { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode testVectorStringObject#e5ecc0d: field value element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TestVectorStringObject) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode testVectorStringObject#e5ecc0d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("testVectorStringObject"); err != nil { - return fmt.Errorf("unable to decode testVectorStringObject#e5ecc0d: %w", err) - } - case "value": - if err := b.Arr(func(b tdjson.Decoder) error { - var value TestString - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode testVectorStringObject#e5ecc0d: field value: %w", err) - } - t.Value = append(t.Value, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode testVectorStringObject#e5ecc0d: field value: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetValue returns value of Value field. -func (t *TestVectorStringObject) GetValue() (value []TestString) { - if t == nil { - return - } - return t.Value -} diff --git a/tdapi/tl_text_entities_gen.go b/tdapi/tl_text_entities_gen.go deleted file mode 100644 index c5e234107..000000000 --- a/tdapi/tl_text_entities_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TextEntities represents TL type `textEntities#cf89c258`. -type TextEntities struct { - // List of text entities - Entities []TextEntity -} - -// TextEntitiesTypeID is TL type id of TextEntities. -const TextEntitiesTypeID = 0xcf89c258 - -// Ensuring interfaces in compile-time for TextEntities. -var ( - _ bin.Encoder = &TextEntities{} - _ bin.Decoder = &TextEntities{} - _ bin.BareEncoder = &TextEntities{} - _ bin.BareDecoder = &TextEntities{} -) - -func (t *TextEntities) Zero() bool { - if t == nil { - return true - } - if !(t.Entities == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntities) String() string { - if t == nil { - return "TextEntities(nil)" - } - type Alias TextEntities - return fmt.Sprintf("TextEntities%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntities) TypeID() uint32 { - return TextEntitiesTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntities) TypeName() string { - return "textEntities" -} - -// TypeInfo returns info about TL type. -func (t *TextEntities) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntities", - ID: TextEntitiesTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Entities", - SchemaName: "entities", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntities) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntities#cf89c258 as nil") - } - b.PutID(TextEntitiesTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntities) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntities#cf89c258 as nil") - } - b.PutInt(len(t.Entities)) - for idx, v := range t.Entities { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare textEntities#cf89c258: field entities element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntities) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntities#cf89c258 to nil") - } - if err := b.ConsumeID(TextEntitiesTypeID); err != nil { - return fmt.Errorf("unable to decode textEntities#cf89c258: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntities) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntities#cf89c258 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode textEntities#cf89c258: field entities: %w", err) - } - - if headerLen > 0 { - t.Entities = make([]TextEntity, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value TextEntity - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare textEntities#cf89c258: field entities: %w", err) - } - t.Entities = append(t.Entities, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntities) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntities#cf89c258 as nil") - } - b.ObjStart() - b.PutID("textEntities") - b.Comma() - b.FieldStart("entities") - b.ArrStart() - for idx, v := range t.Entities { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode textEntities#cf89c258: field entities element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntities) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntities#cf89c258 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntities"); err != nil { - return fmt.Errorf("unable to decode textEntities#cf89c258: %w", err) - } - case "entities": - if err := b.Arr(func(b tdjson.Decoder) error { - var value TextEntity - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode textEntities#cf89c258: field entities: %w", err) - } - t.Entities = append(t.Entities, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode textEntities#cf89c258: field entities: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetEntities returns value of Entities field. -func (t *TextEntities) GetEntities() (value []TextEntity) { - if t == nil { - return - } - return t.Entities -} diff --git a/tdapi/tl_text_entity_gen.go b/tdapi/tl_text_entity_gen.go deleted file mode 100644 index f53b8f2e2..000000000 --- a/tdapi/tl_text_entity_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TextEntity represents TL type `textEntity#8bab99a8`. -type TextEntity struct { - // Offset of the entity, in UTF-16 code units - Offset int32 - // Length of the entity, in UTF-16 code units - Length int32 - // Type of the entity - Type TextEntityTypeClass -} - -// TextEntityTypeID is TL type id of TextEntity. -const TextEntityTypeID = 0x8bab99a8 - -// Ensuring interfaces in compile-time for TextEntity. -var ( - _ bin.Encoder = &TextEntity{} - _ bin.Decoder = &TextEntity{} - _ bin.BareEncoder = &TextEntity{} - _ bin.BareDecoder = &TextEntity{} -) - -func (t *TextEntity) Zero() bool { - if t == nil { - return true - } - if !(t.Offset == 0) { - return false - } - if !(t.Length == 0) { - return false - } - if !(t.Type == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntity) String() string { - if t == nil { - return "TextEntity(nil)" - } - type Alias TextEntity - return fmt.Sprintf("TextEntity%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntity) TypeID() uint32 { - return TextEntityTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntity) TypeName() string { - return "textEntity" -} - -// TypeInfo returns info about TL type. -func (t *TextEntity) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntity", - ID: TextEntityTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Length", - SchemaName: "length", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntity) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntity#8bab99a8 as nil") - } - b.PutID(TextEntityTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntity) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntity#8bab99a8 as nil") - } - b.PutInt32(t.Offset) - b.PutInt32(t.Length) - if t.Type == nil { - return fmt.Errorf("unable to encode textEntity#8bab99a8: field type is nil") - } - if err := t.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode textEntity#8bab99a8: field type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntity) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntity#8bab99a8 to nil") - } - if err := b.ConsumeID(TextEntityTypeID); err != nil { - return fmt.Errorf("unable to decode textEntity#8bab99a8: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntity) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntity#8bab99a8 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode textEntity#8bab99a8: field offset: %w", err) - } - t.Offset = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode textEntity#8bab99a8: field length: %w", err) - } - t.Length = value - } - { - value, err := DecodeTextEntityType(b) - if err != nil { - return fmt.Errorf("unable to decode textEntity#8bab99a8: field type: %w", err) - } - t.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntity) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntity#8bab99a8 as nil") - } - b.ObjStart() - b.PutID("textEntity") - b.Comma() - b.FieldStart("offset") - b.PutInt32(t.Offset) - b.Comma() - b.FieldStart("length") - b.PutInt32(t.Length) - b.Comma() - b.FieldStart("type") - if t.Type == nil { - return fmt.Errorf("unable to encode textEntity#8bab99a8: field type is nil") - } - if err := t.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode textEntity#8bab99a8: field type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntity) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntity#8bab99a8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntity"); err != nil { - return fmt.Errorf("unable to decode textEntity#8bab99a8: %w", err) - } - case "offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode textEntity#8bab99a8: field offset: %w", err) - } - t.Offset = value - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode textEntity#8bab99a8: field length: %w", err) - } - t.Length = value - case "type": - value, err := DecodeTDLibJSONTextEntityType(b) - if err != nil { - return fmt.Errorf("unable to decode textEntity#8bab99a8: field type: %w", err) - } - t.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetOffset returns value of Offset field. -func (t *TextEntity) GetOffset() (value int32) { - if t == nil { - return - } - return t.Offset -} - -// GetLength returns value of Length field. -func (t *TextEntity) GetLength() (value int32) { - if t == nil { - return - } - return t.Length -} - -// GetType returns value of Type field. -func (t *TextEntity) GetType() (value TextEntityTypeClass) { - if t == nil { - return - } - return t.Type -} diff --git a/tdapi/tl_text_entity_type_gen.go b/tdapi/tl_text_entity_type_gen.go deleted file mode 100644 index 9b0575845..000000000 --- a/tdapi/tl_text_entity_type_gen.go +++ /dev/null @@ -1,3528 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TextEntityTypeMention represents TL type `textEntityTypeMention#37b3df65`. -type TextEntityTypeMention struct { -} - -// TextEntityTypeMentionTypeID is TL type id of TextEntityTypeMention. -const TextEntityTypeMentionTypeID = 0x37b3df65 - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeMention) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeMention. -var ( - _ bin.Encoder = &TextEntityTypeMention{} - _ bin.Decoder = &TextEntityTypeMention{} - _ bin.BareEncoder = &TextEntityTypeMention{} - _ bin.BareDecoder = &TextEntityTypeMention{} - - _ TextEntityTypeClass = &TextEntityTypeMention{} -) - -func (t *TextEntityTypeMention) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeMention) String() string { - if t == nil { - return "TextEntityTypeMention(nil)" - } - type Alias TextEntityTypeMention - return fmt.Sprintf("TextEntityTypeMention%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeMention) TypeID() uint32 { - return TextEntityTypeMentionTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeMention) TypeName() string { - return "textEntityTypeMention" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeMention) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeMention", - ID: TextEntityTypeMentionTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeMention) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeMention#37b3df65 as nil") - } - b.PutID(TextEntityTypeMentionTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeMention) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeMention#37b3df65 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeMention) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeMention#37b3df65 to nil") - } - if err := b.ConsumeID(TextEntityTypeMentionTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeMention#37b3df65: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeMention) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeMention#37b3df65 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeMention) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeMention#37b3df65 as nil") - } - b.ObjStart() - b.PutID("textEntityTypeMention") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeMention) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeMention#37b3df65 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeMention"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeMention#37b3df65: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeHashtag represents TL type `textEntityTypeHashtag#c2f7a2dd`. -type TextEntityTypeHashtag struct { -} - -// TextEntityTypeHashtagTypeID is TL type id of TextEntityTypeHashtag. -const TextEntityTypeHashtagTypeID = 0xc2f7a2dd - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeHashtag) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeHashtag. -var ( - _ bin.Encoder = &TextEntityTypeHashtag{} - _ bin.Decoder = &TextEntityTypeHashtag{} - _ bin.BareEncoder = &TextEntityTypeHashtag{} - _ bin.BareDecoder = &TextEntityTypeHashtag{} - - _ TextEntityTypeClass = &TextEntityTypeHashtag{} -) - -func (t *TextEntityTypeHashtag) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeHashtag) String() string { - if t == nil { - return "TextEntityTypeHashtag(nil)" - } - type Alias TextEntityTypeHashtag - return fmt.Sprintf("TextEntityTypeHashtag%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeHashtag) TypeID() uint32 { - return TextEntityTypeHashtagTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeHashtag) TypeName() string { - return "textEntityTypeHashtag" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeHashtag) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeHashtag", - ID: TextEntityTypeHashtagTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeHashtag) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeHashtag#c2f7a2dd as nil") - } - b.PutID(TextEntityTypeHashtagTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeHashtag) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeHashtag#c2f7a2dd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeHashtag) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeHashtag#c2f7a2dd to nil") - } - if err := b.ConsumeID(TextEntityTypeHashtagTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeHashtag#c2f7a2dd: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeHashtag) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeHashtag#c2f7a2dd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeHashtag) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeHashtag#c2f7a2dd as nil") - } - b.ObjStart() - b.PutID("textEntityTypeHashtag") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeHashtag) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeHashtag#c2f7a2dd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeHashtag"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeHashtag#c2f7a2dd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeCashtag represents TL type `textEntityTypeCashtag#48e4374b`. -type TextEntityTypeCashtag struct { -} - -// TextEntityTypeCashtagTypeID is TL type id of TextEntityTypeCashtag. -const TextEntityTypeCashtagTypeID = 0x48e4374b - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeCashtag) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeCashtag. -var ( - _ bin.Encoder = &TextEntityTypeCashtag{} - _ bin.Decoder = &TextEntityTypeCashtag{} - _ bin.BareEncoder = &TextEntityTypeCashtag{} - _ bin.BareDecoder = &TextEntityTypeCashtag{} - - _ TextEntityTypeClass = &TextEntityTypeCashtag{} -) - -func (t *TextEntityTypeCashtag) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeCashtag) String() string { - if t == nil { - return "TextEntityTypeCashtag(nil)" - } - type Alias TextEntityTypeCashtag - return fmt.Sprintf("TextEntityTypeCashtag%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeCashtag) TypeID() uint32 { - return TextEntityTypeCashtagTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeCashtag) TypeName() string { - return "textEntityTypeCashtag" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeCashtag) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeCashtag", - ID: TextEntityTypeCashtagTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeCashtag) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeCashtag#48e4374b as nil") - } - b.PutID(TextEntityTypeCashtagTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeCashtag) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeCashtag#48e4374b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeCashtag) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeCashtag#48e4374b to nil") - } - if err := b.ConsumeID(TextEntityTypeCashtagTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeCashtag#48e4374b: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeCashtag) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeCashtag#48e4374b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeCashtag) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeCashtag#48e4374b as nil") - } - b.ObjStart() - b.PutID("textEntityTypeCashtag") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeCashtag) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeCashtag#48e4374b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeCashtag"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeCashtag#48e4374b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeBotCommand represents TL type `textEntityTypeBotCommand#bb652bb3`. -type TextEntityTypeBotCommand struct { -} - -// TextEntityTypeBotCommandTypeID is TL type id of TextEntityTypeBotCommand. -const TextEntityTypeBotCommandTypeID = 0xbb652bb3 - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeBotCommand) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeBotCommand. -var ( - _ bin.Encoder = &TextEntityTypeBotCommand{} - _ bin.Decoder = &TextEntityTypeBotCommand{} - _ bin.BareEncoder = &TextEntityTypeBotCommand{} - _ bin.BareDecoder = &TextEntityTypeBotCommand{} - - _ TextEntityTypeClass = &TextEntityTypeBotCommand{} -) - -func (t *TextEntityTypeBotCommand) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeBotCommand) String() string { - if t == nil { - return "TextEntityTypeBotCommand(nil)" - } - type Alias TextEntityTypeBotCommand - return fmt.Sprintf("TextEntityTypeBotCommand%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeBotCommand) TypeID() uint32 { - return TextEntityTypeBotCommandTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeBotCommand) TypeName() string { - return "textEntityTypeBotCommand" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeBotCommand) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeBotCommand", - ID: TextEntityTypeBotCommandTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeBotCommand) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBotCommand#bb652bb3 as nil") - } - b.PutID(TextEntityTypeBotCommandTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeBotCommand) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBotCommand#bb652bb3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeBotCommand) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBotCommand#bb652bb3 to nil") - } - if err := b.ConsumeID(TextEntityTypeBotCommandTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeBotCommand#bb652bb3: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeBotCommand) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBotCommand#bb652bb3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeBotCommand) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBotCommand#bb652bb3 as nil") - } - b.ObjStart() - b.PutID("textEntityTypeBotCommand") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeBotCommand) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBotCommand#bb652bb3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeBotCommand"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeBotCommand#bb652bb3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeURL represents TL type `textEntityTypeUrl#b1c0d47c`. -type TextEntityTypeURL struct { -} - -// TextEntityTypeURLTypeID is TL type id of TextEntityTypeURL. -const TextEntityTypeURLTypeID = 0xb1c0d47c - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeURL) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeURL. -var ( - _ bin.Encoder = &TextEntityTypeURL{} - _ bin.Decoder = &TextEntityTypeURL{} - _ bin.BareEncoder = &TextEntityTypeURL{} - _ bin.BareDecoder = &TextEntityTypeURL{} - - _ TextEntityTypeClass = &TextEntityTypeURL{} -) - -func (t *TextEntityTypeURL) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeURL) String() string { - if t == nil { - return "TextEntityTypeURL(nil)" - } - type Alias TextEntityTypeURL - return fmt.Sprintf("TextEntityTypeURL%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeURL) TypeID() uint32 { - return TextEntityTypeURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeURL) TypeName() string { - return "textEntityTypeUrl" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeUrl", - ID: TextEntityTypeURLTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeURL) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeUrl#b1c0d47c as nil") - } - b.PutID(TextEntityTypeURLTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeURL) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeUrl#b1c0d47c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeURL) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeUrl#b1c0d47c to nil") - } - if err := b.ConsumeID(TextEntityTypeURLTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeUrl#b1c0d47c: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeURL) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeUrl#b1c0d47c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeURL) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeUrl#b1c0d47c as nil") - } - b.ObjStart() - b.PutID("textEntityTypeUrl") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeURL) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeUrl#b1c0d47c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeUrl"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeUrl#b1c0d47c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeEmailAddress represents TL type `textEntityTypeEmailAddress#54f81821`. -type TextEntityTypeEmailAddress struct { -} - -// TextEntityTypeEmailAddressTypeID is TL type id of TextEntityTypeEmailAddress. -const TextEntityTypeEmailAddressTypeID = 0x54f81821 - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeEmailAddress) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeEmailAddress. -var ( - _ bin.Encoder = &TextEntityTypeEmailAddress{} - _ bin.Decoder = &TextEntityTypeEmailAddress{} - _ bin.BareEncoder = &TextEntityTypeEmailAddress{} - _ bin.BareDecoder = &TextEntityTypeEmailAddress{} - - _ TextEntityTypeClass = &TextEntityTypeEmailAddress{} -) - -func (t *TextEntityTypeEmailAddress) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeEmailAddress) String() string { - if t == nil { - return "TextEntityTypeEmailAddress(nil)" - } - type Alias TextEntityTypeEmailAddress - return fmt.Sprintf("TextEntityTypeEmailAddress%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeEmailAddress) TypeID() uint32 { - return TextEntityTypeEmailAddressTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeEmailAddress) TypeName() string { - return "textEntityTypeEmailAddress" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeEmailAddress) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeEmailAddress", - ID: TextEntityTypeEmailAddressTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeEmailAddress) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeEmailAddress#54f81821 as nil") - } - b.PutID(TextEntityTypeEmailAddressTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeEmailAddress) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeEmailAddress#54f81821 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeEmailAddress) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeEmailAddress#54f81821 to nil") - } - if err := b.ConsumeID(TextEntityTypeEmailAddressTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeEmailAddress#54f81821: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeEmailAddress) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeEmailAddress#54f81821 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeEmailAddress) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeEmailAddress#54f81821 as nil") - } - b.ObjStart() - b.PutID("textEntityTypeEmailAddress") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeEmailAddress) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeEmailAddress#54f81821 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeEmailAddress"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeEmailAddress#54f81821: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypePhoneNumber represents TL type `textEntityTypePhoneNumber#bad9aa2a`. -type TextEntityTypePhoneNumber struct { -} - -// TextEntityTypePhoneNumberTypeID is TL type id of TextEntityTypePhoneNumber. -const TextEntityTypePhoneNumberTypeID = 0xbad9aa2a - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypePhoneNumber) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypePhoneNumber. -var ( - _ bin.Encoder = &TextEntityTypePhoneNumber{} - _ bin.Decoder = &TextEntityTypePhoneNumber{} - _ bin.BareEncoder = &TextEntityTypePhoneNumber{} - _ bin.BareDecoder = &TextEntityTypePhoneNumber{} - - _ TextEntityTypeClass = &TextEntityTypePhoneNumber{} -) - -func (t *TextEntityTypePhoneNumber) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypePhoneNumber) String() string { - if t == nil { - return "TextEntityTypePhoneNumber(nil)" - } - type Alias TextEntityTypePhoneNumber - return fmt.Sprintf("TextEntityTypePhoneNumber%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypePhoneNumber) TypeID() uint32 { - return TextEntityTypePhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypePhoneNumber) TypeName() string { - return "textEntityTypePhoneNumber" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypePhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypePhoneNumber", - ID: TextEntityTypePhoneNumberTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypePhoneNumber) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypePhoneNumber#bad9aa2a as nil") - } - b.PutID(TextEntityTypePhoneNumberTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypePhoneNumber) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypePhoneNumber#bad9aa2a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypePhoneNumber) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypePhoneNumber#bad9aa2a to nil") - } - if err := b.ConsumeID(TextEntityTypePhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypePhoneNumber#bad9aa2a: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypePhoneNumber) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypePhoneNumber#bad9aa2a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypePhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypePhoneNumber#bad9aa2a as nil") - } - b.ObjStart() - b.PutID("textEntityTypePhoneNumber") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypePhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypePhoneNumber#bad9aa2a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypePhoneNumber"); err != nil { - return fmt.Errorf("unable to decode textEntityTypePhoneNumber#bad9aa2a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeBankCardNumber represents TL type `textEntityTypeBankCardNumber#6513910`. -type TextEntityTypeBankCardNumber struct { -} - -// TextEntityTypeBankCardNumberTypeID is TL type id of TextEntityTypeBankCardNumber. -const TextEntityTypeBankCardNumberTypeID = 0x6513910 - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeBankCardNumber) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeBankCardNumber. -var ( - _ bin.Encoder = &TextEntityTypeBankCardNumber{} - _ bin.Decoder = &TextEntityTypeBankCardNumber{} - _ bin.BareEncoder = &TextEntityTypeBankCardNumber{} - _ bin.BareDecoder = &TextEntityTypeBankCardNumber{} - - _ TextEntityTypeClass = &TextEntityTypeBankCardNumber{} -) - -func (t *TextEntityTypeBankCardNumber) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeBankCardNumber) String() string { - if t == nil { - return "TextEntityTypeBankCardNumber(nil)" - } - type Alias TextEntityTypeBankCardNumber - return fmt.Sprintf("TextEntityTypeBankCardNumber%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeBankCardNumber) TypeID() uint32 { - return TextEntityTypeBankCardNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeBankCardNumber) TypeName() string { - return "textEntityTypeBankCardNumber" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeBankCardNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeBankCardNumber", - ID: TextEntityTypeBankCardNumberTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeBankCardNumber) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBankCardNumber#6513910 as nil") - } - b.PutID(TextEntityTypeBankCardNumberTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeBankCardNumber) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBankCardNumber#6513910 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeBankCardNumber) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBankCardNumber#6513910 to nil") - } - if err := b.ConsumeID(TextEntityTypeBankCardNumberTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeBankCardNumber#6513910: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeBankCardNumber) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBankCardNumber#6513910 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeBankCardNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBankCardNumber#6513910 as nil") - } - b.ObjStart() - b.PutID("textEntityTypeBankCardNumber") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeBankCardNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBankCardNumber#6513910 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeBankCardNumber"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeBankCardNumber#6513910: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeBold represents TL type `textEntityTypeBold#bcc0e1b0`. -type TextEntityTypeBold struct { -} - -// TextEntityTypeBoldTypeID is TL type id of TextEntityTypeBold. -const TextEntityTypeBoldTypeID = 0xbcc0e1b0 - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeBold) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeBold. -var ( - _ bin.Encoder = &TextEntityTypeBold{} - _ bin.Decoder = &TextEntityTypeBold{} - _ bin.BareEncoder = &TextEntityTypeBold{} - _ bin.BareDecoder = &TextEntityTypeBold{} - - _ TextEntityTypeClass = &TextEntityTypeBold{} -) - -func (t *TextEntityTypeBold) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeBold) String() string { - if t == nil { - return "TextEntityTypeBold(nil)" - } - type Alias TextEntityTypeBold - return fmt.Sprintf("TextEntityTypeBold%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeBold) TypeID() uint32 { - return TextEntityTypeBoldTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeBold) TypeName() string { - return "textEntityTypeBold" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeBold) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeBold", - ID: TextEntityTypeBoldTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeBold) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBold#bcc0e1b0 as nil") - } - b.PutID(TextEntityTypeBoldTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeBold) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBold#bcc0e1b0 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeBold) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBold#bcc0e1b0 to nil") - } - if err := b.ConsumeID(TextEntityTypeBoldTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeBold#bcc0e1b0: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeBold) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBold#bcc0e1b0 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeBold) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBold#bcc0e1b0 as nil") - } - b.ObjStart() - b.PutID("textEntityTypeBold") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeBold) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBold#bcc0e1b0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeBold"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeBold#bcc0e1b0: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeItalic represents TL type `textEntityTypeItalic#f8f3965d`. -type TextEntityTypeItalic struct { -} - -// TextEntityTypeItalicTypeID is TL type id of TextEntityTypeItalic. -const TextEntityTypeItalicTypeID = 0xf8f3965d - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeItalic) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeItalic. -var ( - _ bin.Encoder = &TextEntityTypeItalic{} - _ bin.Decoder = &TextEntityTypeItalic{} - _ bin.BareEncoder = &TextEntityTypeItalic{} - _ bin.BareDecoder = &TextEntityTypeItalic{} - - _ TextEntityTypeClass = &TextEntityTypeItalic{} -) - -func (t *TextEntityTypeItalic) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeItalic) String() string { - if t == nil { - return "TextEntityTypeItalic(nil)" - } - type Alias TextEntityTypeItalic - return fmt.Sprintf("TextEntityTypeItalic%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeItalic) TypeID() uint32 { - return TextEntityTypeItalicTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeItalic) TypeName() string { - return "textEntityTypeItalic" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeItalic) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeItalic", - ID: TextEntityTypeItalicTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeItalic) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeItalic#f8f3965d as nil") - } - b.PutID(TextEntityTypeItalicTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeItalic) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeItalic#f8f3965d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeItalic) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeItalic#f8f3965d to nil") - } - if err := b.ConsumeID(TextEntityTypeItalicTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeItalic#f8f3965d: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeItalic) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeItalic#f8f3965d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeItalic) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeItalic#f8f3965d as nil") - } - b.ObjStart() - b.PutID("textEntityTypeItalic") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeItalic) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeItalic#f8f3965d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeItalic"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeItalic#f8f3965d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeUnderline represents TL type `textEntityTypeUnderline#2f39cf92`. -type TextEntityTypeUnderline struct { -} - -// TextEntityTypeUnderlineTypeID is TL type id of TextEntityTypeUnderline. -const TextEntityTypeUnderlineTypeID = 0x2f39cf92 - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeUnderline) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeUnderline. -var ( - _ bin.Encoder = &TextEntityTypeUnderline{} - _ bin.Decoder = &TextEntityTypeUnderline{} - _ bin.BareEncoder = &TextEntityTypeUnderline{} - _ bin.BareDecoder = &TextEntityTypeUnderline{} - - _ TextEntityTypeClass = &TextEntityTypeUnderline{} -) - -func (t *TextEntityTypeUnderline) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeUnderline) String() string { - if t == nil { - return "TextEntityTypeUnderline(nil)" - } - type Alias TextEntityTypeUnderline - return fmt.Sprintf("TextEntityTypeUnderline%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeUnderline) TypeID() uint32 { - return TextEntityTypeUnderlineTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeUnderline) TypeName() string { - return "textEntityTypeUnderline" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeUnderline) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeUnderline", - ID: TextEntityTypeUnderlineTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeUnderline) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeUnderline#2f39cf92 as nil") - } - b.PutID(TextEntityTypeUnderlineTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeUnderline) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeUnderline#2f39cf92 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeUnderline) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeUnderline#2f39cf92 to nil") - } - if err := b.ConsumeID(TextEntityTypeUnderlineTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeUnderline#2f39cf92: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeUnderline) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeUnderline#2f39cf92 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeUnderline) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeUnderline#2f39cf92 as nil") - } - b.ObjStart() - b.PutID("textEntityTypeUnderline") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeUnderline) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeUnderline#2f39cf92 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeUnderline"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeUnderline#2f39cf92: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeStrikethrough represents TL type `textEntityTypeStrikethrough#394fc4fa`. -type TextEntityTypeStrikethrough struct { -} - -// TextEntityTypeStrikethroughTypeID is TL type id of TextEntityTypeStrikethrough. -const TextEntityTypeStrikethroughTypeID = 0x394fc4fa - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeStrikethrough) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeStrikethrough. -var ( - _ bin.Encoder = &TextEntityTypeStrikethrough{} - _ bin.Decoder = &TextEntityTypeStrikethrough{} - _ bin.BareEncoder = &TextEntityTypeStrikethrough{} - _ bin.BareDecoder = &TextEntityTypeStrikethrough{} - - _ TextEntityTypeClass = &TextEntityTypeStrikethrough{} -) - -func (t *TextEntityTypeStrikethrough) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeStrikethrough) String() string { - if t == nil { - return "TextEntityTypeStrikethrough(nil)" - } - type Alias TextEntityTypeStrikethrough - return fmt.Sprintf("TextEntityTypeStrikethrough%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeStrikethrough) TypeID() uint32 { - return TextEntityTypeStrikethroughTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeStrikethrough) TypeName() string { - return "textEntityTypeStrikethrough" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeStrikethrough) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeStrikethrough", - ID: TextEntityTypeStrikethroughTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeStrikethrough) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeStrikethrough#394fc4fa as nil") - } - b.PutID(TextEntityTypeStrikethroughTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeStrikethrough) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeStrikethrough#394fc4fa as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeStrikethrough) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeStrikethrough#394fc4fa to nil") - } - if err := b.ConsumeID(TextEntityTypeStrikethroughTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeStrikethrough#394fc4fa: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeStrikethrough) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeStrikethrough#394fc4fa to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeStrikethrough) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeStrikethrough#394fc4fa as nil") - } - b.ObjStart() - b.PutID("textEntityTypeStrikethrough") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeStrikethrough) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeStrikethrough#394fc4fa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeStrikethrough"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeStrikethrough#394fc4fa: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeSpoiler represents TL type `textEntityTypeSpoiler#206d15bb`. -type TextEntityTypeSpoiler struct { -} - -// TextEntityTypeSpoilerTypeID is TL type id of TextEntityTypeSpoiler. -const TextEntityTypeSpoilerTypeID = 0x206d15bb - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeSpoiler) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeSpoiler. -var ( - _ bin.Encoder = &TextEntityTypeSpoiler{} - _ bin.Decoder = &TextEntityTypeSpoiler{} - _ bin.BareEncoder = &TextEntityTypeSpoiler{} - _ bin.BareDecoder = &TextEntityTypeSpoiler{} - - _ TextEntityTypeClass = &TextEntityTypeSpoiler{} -) - -func (t *TextEntityTypeSpoiler) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeSpoiler) String() string { - if t == nil { - return "TextEntityTypeSpoiler(nil)" - } - type Alias TextEntityTypeSpoiler - return fmt.Sprintf("TextEntityTypeSpoiler%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeSpoiler) TypeID() uint32 { - return TextEntityTypeSpoilerTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeSpoiler) TypeName() string { - return "textEntityTypeSpoiler" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeSpoiler) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeSpoiler", - ID: TextEntityTypeSpoilerTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeSpoiler) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeSpoiler#206d15bb as nil") - } - b.PutID(TextEntityTypeSpoilerTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeSpoiler) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeSpoiler#206d15bb as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeSpoiler) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeSpoiler#206d15bb to nil") - } - if err := b.ConsumeID(TextEntityTypeSpoilerTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeSpoiler#206d15bb: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeSpoiler) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeSpoiler#206d15bb to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeSpoiler) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeSpoiler#206d15bb as nil") - } - b.ObjStart() - b.PutID("textEntityTypeSpoiler") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeSpoiler) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeSpoiler#206d15bb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeSpoiler"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeSpoiler#206d15bb: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeCode represents TL type `textEntityTypeCode#c5e9c94a`. -type TextEntityTypeCode struct { -} - -// TextEntityTypeCodeTypeID is TL type id of TextEntityTypeCode. -const TextEntityTypeCodeTypeID = 0xc5e9c94a - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeCode) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeCode. -var ( - _ bin.Encoder = &TextEntityTypeCode{} - _ bin.Decoder = &TextEntityTypeCode{} - _ bin.BareEncoder = &TextEntityTypeCode{} - _ bin.BareDecoder = &TextEntityTypeCode{} - - _ TextEntityTypeClass = &TextEntityTypeCode{} -) - -func (t *TextEntityTypeCode) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeCode) String() string { - if t == nil { - return "TextEntityTypeCode(nil)" - } - type Alias TextEntityTypeCode - return fmt.Sprintf("TextEntityTypeCode%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeCode) TypeID() uint32 { - return TextEntityTypeCodeTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeCode) TypeName() string { - return "textEntityTypeCode" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeCode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeCode", - ID: TextEntityTypeCodeTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeCode) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeCode#c5e9c94a as nil") - } - b.PutID(TextEntityTypeCodeTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeCode) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeCode#c5e9c94a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeCode) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeCode#c5e9c94a to nil") - } - if err := b.ConsumeID(TextEntityTypeCodeTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeCode#c5e9c94a: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeCode) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeCode#c5e9c94a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeCode) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeCode#c5e9c94a as nil") - } - b.ObjStart() - b.PutID("textEntityTypeCode") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeCode) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeCode#c5e9c94a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeCode"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeCode#c5e9c94a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypePre represents TL type `textEntityTypePre#62491c8e`. -type TextEntityTypePre struct { -} - -// TextEntityTypePreTypeID is TL type id of TextEntityTypePre. -const TextEntityTypePreTypeID = 0x62491c8e - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypePre) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypePre. -var ( - _ bin.Encoder = &TextEntityTypePre{} - _ bin.Decoder = &TextEntityTypePre{} - _ bin.BareEncoder = &TextEntityTypePre{} - _ bin.BareDecoder = &TextEntityTypePre{} - - _ TextEntityTypeClass = &TextEntityTypePre{} -) - -func (t *TextEntityTypePre) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypePre) String() string { - if t == nil { - return "TextEntityTypePre(nil)" - } - type Alias TextEntityTypePre - return fmt.Sprintf("TextEntityTypePre%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypePre) TypeID() uint32 { - return TextEntityTypePreTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypePre) TypeName() string { - return "textEntityTypePre" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypePre) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypePre", - ID: TextEntityTypePreTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypePre) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypePre#62491c8e as nil") - } - b.PutID(TextEntityTypePreTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypePre) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypePre#62491c8e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypePre) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypePre#62491c8e to nil") - } - if err := b.ConsumeID(TextEntityTypePreTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypePre#62491c8e: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypePre) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypePre#62491c8e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypePre) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypePre#62491c8e as nil") - } - b.ObjStart() - b.PutID("textEntityTypePre") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypePre) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypePre#62491c8e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypePre"); err != nil { - return fmt.Errorf("unable to decode textEntityTypePre#62491c8e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypePreCode represents TL type `textEntityTypePreCode#c7a77aab`. -type TextEntityTypePreCode struct { - // Programming language of the code; as defined by the sender - Language string -} - -// TextEntityTypePreCodeTypeID is TL type id of TextEntityTypePreCode. -const TextEntityTypePreCodeTypeID = 0xc7a77aab - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypePreCode) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypePreCode. -var ( - _ bin.Encoder = &TextEntityTypePreCode{} - _ bin.Decoder = &TextEntityTypePreCode{} - _ bin.BareEncoder = &TextEntityTypePreCode{} - _ bin.BareDecoder = &TextEntityTypePreCode{} - - _ TextEntityTypeClass = &TextEntityTypePreCode{} -) - -func (t *TextEntityTypePreCode) Zero() bool { - if t == nil { - return true - } - if !(t.Language == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypePreCode) String() string { - if t == nil { - return "TextEntityTypePreCode(nil)" - } - type Alias TextEntityTypePreCode - return fmt.Sprintf("TextEntityTypePreCode%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypePreCode) TypeID() uint32 { - return TextEntityTypePreCodeTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypePreCode) TypeName() string { - return "textEntityTypePreCode" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypePreCode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypePreCode", - ID: TextEntityTypePreCodeTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Language", - SchemaName: "language", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypePreCode) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypePreCode#c7a77aab as nil") - } - b.PutID(TextEntityTypePreCodeTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypePreCode) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypePreCode#c7a77aab as nil") - } - b.PutString(t.Language) - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypePreCode) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypePreCode#c7a77aab to nil") - } - if err := b.ConsumeID(TextEntityTypePreCodeTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypePreCode#c7a77aab: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypePreCode) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypePreCode#c7a77aab to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode textEntityTypePreCode#c7a77aab: field language: %w", err) - } - t.Language = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypePreCode) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypePreCode#c7a77aab as nil") - } - b.ObjStart() - b.PutID("textEntityTypePreCode") - b.Comma() - b.FieldStart("language") - b.PutString(t.Language) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypePreCode) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypePreCode#c7a77aab to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypePreCode"); err != nil { - return fmt.Errorf("unable to decode textEntityTypePreCode#c7a77aab: %w", err) - } - case "language": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode textEntityTypePreCode#c7a77aab: field language: %w", err) - } - t.Language = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLanguage returns value of Language field. -func (t *TextEntityTypePreCode) GetLanguage() (value string) { - if t == nil { - return - } - return t.Language -} - -// TextEntityTypeBlockQuote represents TL type `textEntityTypeBlockQuote#c42830c8`. -type TextEntityTypeBlockQuote struct { -} - -// TextEntityTypeBlockQuoteTypeID is TL type id of TextEntityTypeBlockQuote. -const TextEntityTypeBlockQuoteTypeID = 0xc42830c8 - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeBlockQuote) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeBlockQuote. -var ( - _ bin.Encoder = &TextEntityTypeBlockQuote{} - _ bin.Decoder = &TextEntityTypeBlockQuote{} - _ bin.BareEncoder = &TextEntityTypeBlockQuote{} - _ bin.BareDecoder = &TextEntityTypeBlockQuote{} - - _ TextEntityTypeClass = &TextEntityTypeBlockQuote{} -) - -func (t *TextEntityTypeBlockQuote) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeBlockQuote) String() string { - if t == nil { - return "TextEntityTypeBlockQuote(nil)" - } - type Alias TextEntityTypeBlockQuote - return fmt.Sprintf("TextEntityTypeBlockQuote%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeBlockQuote) TypeID() uint32 { - return TextEntityTypeBlockQuoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeBlockQuote) TypeName() string { - return "textEntityTypeBlockQuote" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeBlockQuote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeBlockQuote", - ID: TextEntityTypeBlockQuoteTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeBlockQuote) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBlockQuote#c42830c8 as nil") - } - b.PutID(TextEntityTypeBlockQuoteTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeBlockQuote) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBlockQuote#c42830c8 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeBlockQuote) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBlockQuote#c42830c8 to nil") - } - if err := b.ConsumeID(TextEntityTypeBlockQuoteTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeBlockQuote#c42830c8: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeBlockQuote) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBlockQuote#c42830c8 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeBlockQuote) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeBlockQuote#c42830c8 as nil") - } - b.ObjStart() - b.PutID("textEntityTypeBlockQuote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeBlockQuote) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeBlockQuote#c42830c8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeBlockQuote"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeBlockQuote#c42830c8: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeExpandableBlockQuote represents TL type `textEntityTypeExpandableBlockQuote#22e0c65`. -type TextEntityTypeExpandableBlockQuote struct { -} - -// TextEntityTypeExpandableBlockQuoteTypeID is TL type id of TextEntityTypeExpandableBlockQuote. -const TextEntityTypeExpandableBlockQuoteTypeID = 0x22e0c65 - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeExpandableBlockQuote) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeExpandableBlockQuote. -var ( - _ bin.Encoder = &TextEntityTypeExpandableBlockQuote{} - _ bin.Decoder = &TextEntityTypeExpandableBlockQuote{} - _ bin.BareEncoder = &TextEntityTypeExpandableBlockQuote{} - _ bin.BareDecoder = &TextEntityTypeExpandableBlockQuote{} - - _ TextEntityTypeClass = &TextEntityTypeExpandableBlockQuote{} -) - -func (t *TextEntityTypeExpandableBlockQuote) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeExpandableBlockQuote) String() string { - if t == nil { - return "TextEntityTypeExpandableBlockQuote(nil)" - } - type Alias TextEntityTypeExpandableBlockQuote - return fmt.Sprintf("TextEntityTypeExpandableBlockQuote%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeExpandableBlockQuote) TypeID() uint32 { - return TextEntityTypeExpandableBlockQuoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeExpandableBlockQuote) TypeName() string { - return "textEntityTypeExpandableBlockQuote" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeExpandableBlockQuote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeExpandableBlockQuote", - ID: TextEntityTypeExpandableBlockQuoteTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeExpandableBlockQuote) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeExpandableBlockQuote#22e0c65 as nil") - } - b.PutID(TextEntityTypeExpandableBlockQuoteTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeExpandableBlockQuote) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeExpandableBlockQuote#22e0c65 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeExpandableBlockQuote) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeExpandableBlockQuote#22e0c65 to nil") - } - if err := b.ConsumeID(TextEntityTypeExpandableBlockQuoteTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeExpandableBlockQuote#22e0c65: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeExpandableBlockQuote) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeExpandableBlockQuote#22e0c65 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeExpandableBlockQuote) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeExpandableBlockQuote#22e0c65 as nil") - } - b.ObjStart() - b.PutID("textEntityTypeExpandableBlockQuote") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeExpandableBlockQuote) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeExpandableBlockQuote#22e0c65 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeExpandableBlockQuote"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeExpandableBlockQuote#22e0c65: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextEntityTypeTextURL represents TL type `textEntityTypeTextUrl#1a912463`. -type TextEntityTypeTextURL struct { - // HTTP or tg:// URL to be opened when the link is clicked - URL string -} - -// TextEntityTypeTextURLTypeID is TL type id of TextEntityTypeTextURL. -const TextEntityTypeTextURLTypeID = 0x1a912463 - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeTextURL) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeTextURL. -var ( - _ bin.Encoder = &TextEntityTypeTextURL{} - _ bin.Decoder = &TextEntityTypeTextURL{} - _ bin.BareEncoder = &TextEntityTypeTextURL{} - _ bin.BareDecoder = &TextEntityTypeTextURL{} - - _ TextEntityTypeClass = &TextEntityTypeTextURL{} -) - -func (t *TextEntityTypeTextURL) Zero() bool { - if t == nil { - return true - } - if !(t.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeTextURL) String() string { - if t == nil { - return "TextEntityTypeTextURL(nil)" - } - type Alias TextEntityTypeTextURL - return fmt.Sprintf("TextEntityTypeTextURL%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeTextURL) TypeID() uint32 { - return TextEntityTypeTextURLTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeTextURL) TypeName() string { - return "textEntityTypeTextUrl" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeTextURL) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeTextUrl", - ID: TextEntityTypeTextURLTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeTextURL) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeTextUrl#1a912463 as nil") - } - b.PutID(TextEntityTypeTextURLTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeTextURL) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeTextUrl#1a912463 as nil") - } - b.PutString(t.URL) - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeTextURL) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeTextUrl#1a912463 to nil") - } - if err := b.ConsumeID(TextEntityTypeTextURLTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeTextUrl#1a912463: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeTextURL) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeTextUrl#1a912463 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode textEntityTypeTextUrl#1a912463: field url: %w", err) - } - t.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeTextURL) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeTextUrl#1a912463 as nil") - } - b.ObjStart() - b.PutID("textEntityTypeTextUrl") - b.Comma() - b.FieldStart("url") - b.PutString(t.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeTextURL) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeTextUrl#1a912463 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeTextUrl"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeTextUrl#1a912463: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode textEntityTypeTextUrl#1a912463: field url: %w", err) - } - t.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (t *TextEntityTypeTextURL) GetURL() (value string) { - if t == nil { - return - } - return t.URL -} - -// TextEntityTypeMentionName represents TL type `textEntityTypeMentionName#a25cd5af`. -type TextEntityTypeMentionName struct { - // Identifier of the mentioned user - UserID int64 -} - -// TextEntityTypeMentionNameTypeID is TL type id of TextEntityTypeMentionName. -const TextEntityTypeMentionNameTypeID = 0xa25cd5af - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeMentionName) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeMentionName. -var ( - _ bin.Encoder = &TextEntityTypeMentionName{} - _ bin.Decoder = &TextEntityTypeMentionName{} - _ bin.BareEncoder = &TextEntityTypeMentionName{} - _ bin.BareDecoder = &TextEntityTypeMentionName{} - - _ TextEntityTypeClass = &TextEntityTypeMentionName{} -) - -func (t *TextEntityTypeMentionName) Zero() bool { - if t == nil { - return true - } - if !(t.UserID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeMentionName) String() string { - if t == nil { - return "TextEntityTypeMentionName(nil)" - } - type Alias TextEntityTypeMentionName - return fmt.Sprintf("TextEntityTypeMentionName%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeMentionName) TypeID() uint32 { - return TextEntityTypeMentionNameTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeMentionName) TypeName() string { - return "textEntityTypeMentionName" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeMentionName) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeMentionName", - ID: TextEntityTypeMentionNameTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeMentionName) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeMentionName#a25cd5af as nil") - } - b.PutID(TextEntityTypeMentionNameTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeMentionName) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeMentionName#a25cd5af as nil") - } - b.PutInt53(t.UserID) - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeMentionName) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeMentionName#a25cd5af to nil") - } - if err := b.ConsumeID(TextEntityTypeMentionNameTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeMentionName#a25cd5af: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeMentionName) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeMentionName#a25cd5af to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode textEntityTypeMentionName#a25cd5af: field user_id: %w", err) - } - t.UserID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeMentionName) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeMentionName#a25cd5af as nil") - } - b.ObjStart() - b.PutID("textEntityTypeMentionName") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(t.UserID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeMentionName) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeMentionName#a25cd5af to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeMentionName"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeMentionName#a25cd5af: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode textEntityTypeMentionName#a25cd5af: field user_id: %w", err) - } - t.UserID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (t *TextEntityTypeMentionName) GetUserID() (value int64) { - if t == nil { - return - } - return t.UserID -} - -// TextEntityTypeCustomEmoji represents TL type `textEntityTypeCustomEmoji#66ceacc5`. -type TextEntityTypeCustomEmoji struct { - // Unique identifier of the custom emoji - CustomEmojiID int64 -} - -// TextEntityTypeCustomEmojiTypeID is TL type id of TextEntityTypeCustomEmoji. -const TextEntityTypeCustomEmojiTypeID = 0x66ceacc5 - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeCustomEmoji) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeCustomEmoji. -var ( - _ bin.Encoder = &TextEntityTypeCustomEmoji{} - _ bin.Decoder = &TextEntityTypeCustomEmoji{} - _ bin.BareEncoder = &TextEntityTypeCustomEmoji{} - _ bin.BareDecoder = &TextEntityTypeCustomEmoji{} - - _ TextEntityTypeClass = &TextEntityTypeCustomEmoji{} -) - -func (t *TextEntityTypeCustomEmoji) Zero() bool { - if t == nil { - return true - } - if !(t.CustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeCustomEmoji) String() string { - if t == nil { - return "TextEntityTypeCustomEmoji(nil)" - } - type Alias TextEntityTypeCustomEmoji - return fmt.Sprintf("TextEntityTypeCustomEmoji%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeCustomEmoji) TypeID() uint32 { - return TextEntityTypeCustomEmojiTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeCustomEmoji) TypeName() string { - return "textEntityTypeCustomEmoji" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeCustomEmoji) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeCustomEmoji", - ID: TextEntityTypeCustomEmojiTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CustomEmojiID", - SchemaName: "custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeCustomEmoji) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeCustomEmoji#66ceacc5 as nil") - } - b.PutID(TextEntityTypeCustomEmojiTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeCustomEmoji) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeCustomEmoji#66ceacc5 as nil") - } - b.PutLong(t.CustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeCustomEmoji) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeCustomEmoji#66ceacc5 to nil") - } - if err := b.ConsumeID(TextEntityTypeCustomEmojiTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeCustomEmoji#66ceacc5: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeCustomEmoji) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeCustomEmoji#66ceacc5 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode textEntityTypeCustomEmoji#66ceacc5: field custom_emoji_id: %w", err) - } - t.CustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeCustomEmoji) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeCustomEmoji#66ceacc5 as nil") - } - b.ObjStart() - b.PutID("textEntityTypeCustomEmoji") - b.Comma() - b.FieldStart("custom_emoji_id") - b.PutLong(t.CustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeCustomEmoji) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeCustomEmoji#66ceacc5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeCustomEmoji"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeCustomEmoji#66ceacc5: %w", err) - } - case "custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode textEntityTypeCustomEmoji#66ceacc5: field custom_emoji_id: %w", err) - } - t.CustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCustomEmojiID returns value of CustomEmojiID field. -func (t *TextEntityTypeCustomEmoji) GetCustomEmojiID() (value int64) { - if t == nil { - return - } - return t.CustomEmojiID -} - -// TextEntityTypeMediaTimestamp represents TL type `textEntityTypeMediaTimestamp#9236da10`. -type TextEntityTypeMediaTimestamp struct { - // Timestamp from which a video/audio/video note/voice note/story playing must start, in - // seconds. The media can be in the content or the link preview of the current message, - // or in the same places in the replied message - MediaTimestamp int32 -} - -// TextEntityTypeMediaTimestampTypeID is TL type id of TextEntityTypeMediaTimestamp. -const TextEntityTypeMediaTimestampTypeID = 0x9236da10 - -// construct implements constructor of TextEntityTypeClass. -func (t TextEntityTypeMediaTimestamp) construct() TextEntityTypeClass { return &t } - -// Ensuring interfaces in compile-time for TextEntityTypeMediaTimestamp. -var ( - _ bin.Encoder = &TextEntityTypeMediaTimestamp{} - _ bin.Decoder = &TextEntityTypeMediaTimestamp{} - _ bin.BareEncoder = &TextEntityTypeMediaTimestamp{} - _ bin.BareDecoder = &TextEntityTypeMediaTimestamp{} - - _ TextEntityTypeClass = &TextEntityTypeMediaTimestamp{} -) - -func (t *TextEntityTypeMediaTimestamp) Zero() bool { - if t == nil { - return true - } - if !(t.MediaTimestamp == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextEntityTypeMediaTimestamp) String() string { - if t == nil { - return "TextEntityTypeMediaTimestamp(nil)" - } - type Alias TextEntityTypeMediaTimestamp - return fmt.Sprintf("TextEntityTypeMediaTimestamp%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextEntityTypeMediaTimestamp) TypeID() uint32 { - return TextEntityTypeMediaTimestampTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextEntityTypeMediaTimestamp) TypeName() string { - return "textEntityTypeMediaTimestamp" -} - -// TypeInfo returns info about TL type. -func (t *TextEntityTypeMediaTimestamp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textEntityTypeMediaTimestamp", - ID: TextEntityTypeMediaTimestampTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MediaTimestamp", - SchemaName: "media_timestamp", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TextEntityTypeMediaTimestamp) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeMediaTimestamp#9236da10 as nil") - } - b.PutID(TextEntityTypeMediaTimestampTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextEntityTypeMediaTimestamp) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeMediaTimestamp#9236da10 as nil") - } - b.PutInt32(t.MediaTimestamp) - return nil -} - -// Decode implements bin.Decoder. -func (t *TextEntityTypeMediaTimestamp) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeMediaTimestamp#9236da10 to nil") - } - if err := b.ConsumeID(TextEntityTypeMediaTimestampTypeID); err != nil { - return fmt.Errorf("unable to decode textEntityTypeMediaTimestamp#9236da10: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextEntityTypeMediaTimestamp) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeMediaTimestamp#9236da10 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode textEntityTypeMediaTimestamp#9236da10: field media_timestamp: %w", err) - } - t.MediaTimestamp = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextEntityTypeMediaTimestamp) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textEntityTypeMediaTimestamp#9236da10 as nil") - } - b.ObjStart() - b.PutID("textEntityTypeMediaTimestamp") - b.Comma() - b.FieldStart("media_timestamp") - b.PutInt32(t.MediaTimestamp) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextEntityTypeMediaTimestamp) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textEntityTypeMediaTimestamp#9236da10 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textEntityTypeMediaTimestamp"); err != nil { - return fmt.Errorf("unable to decode textEntityTypeMediaTimestamp#9236da10: %w", err) - } - case "media_timestamp": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode textEntityTypeMediaTimestamp#9236da10: field media_timestamp: %w", err) - } - t.MediaTimestamp = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMediaTimestamp returns value of MediaTimestamp field. -func (t *TextEntityTypeMediaTimestamp) GetMediaTimestamp() (value int32) { - if t == nil { - return - } - return t.MediaTimestamp -} - -// TextEntityTypeClassName is schema name of TextEntityTypeClass. -const TextEntityTypeClassName = "TextEntityType" - -// TextEntityTypeClass represents TextEntityType generic type. -// -// Example: -// -// g, err := tdapi.DecodeTextEntityType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.TextEntityTypeMention: // textEntityTypeMention#37b3df65 -// case *tdapi.TextEntityTypeHashtag: // textEntityTypeHashtag#c2f7a2dd -// case *tdapi.TextEntityTypeCashtag: // textEntityTypeCashtag#48e4374b -// case *tdapi.TextEntityTypeBotCommand: // textEntityTypeBotCommand#bb652bb3 -// case *tdapi.TextEntityTypeURL: // textEntityTypeUrl#b1c0d47c -// case *tdapi.TextEntityTypeEmailAddress: // textEntityTypeEmailAddress#54f81821 -// case *tdapi.TextEntityTypePhoneNumber: // textEntityTypePhoneNumber#bad9aa2a -// case *tdapi.TextEntityTypeBankCardNumber: // textEntityTypeBankCardNumber#6513910 -// case *tdapi.TextEntityTypeBold: // textEntityTypeBold#bcc0e1b0 -// case *tdapi.TextEntityTypeItalic: // textEntityTypeItalic#f8f3965d -// case *tdapi.TextEntityTypeUnderline: // textEntityTypeUnderline#2f39cf92 -// case *tdapi.TextEntityTypeStrikethrough: // textEntityTypeStrikethrough#394fc4fa -// case *tdapi.TextEntityTypeSpoiler: // textEntityTypeSpoiler#206d15bb -// case *tdapi.TextEntityTypeCode: // textEntityTypeCode#c5e9c94a -// case *tdapi.TextEntityTypePre: // textEntityTypePre#62491c8e -// case *tdapi.TextEntityTypePreCode: // textEntityTypePreCode#c7a77aab -// case *tdapi.TextEntityTypeBlockQuote: // textEntityTypeBlockQuote#c42830c8 -// case *tdapi.TextEntityTypeExpandableBlockQuote: // textEntityTypeExpandableBlockQuote#22e0c65 -// case *tdapi.TextEntityTypeTextURL: // textEntityTypeTextUrl#1a912463 -// case *tdapi.TextEntityTypeMentionName: // textEntityTypeMentionName#a25cd5af -// case *tdapi.TextEntityTypeCustomEmoji: // textEntityTypeCustomEmoji#66ceacc5 -// case *tdapi.TextEntityTypeMediaTimestamp: // textEntityTypeMediaTimestamp#9236da10 -// default: panic(v) -// } -type TextEntityTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() TextEntityTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeTextEntityType implements binary de-serialization for TextEntityTypeClass. -func DecodeTextEntityType(buf *bin.Buffer) (TextEntityTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case TextEntityTypeMentionTypeID: - // Decoding textEntityTypeMention#37b3df65. - v := TextEntityTypeMention{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeHashtagTypeID: - // Decoding textEntityTypeHashtag#c2f7a2dd. - v := TextEntityTypeHashtag{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeCashtagTypeID: - // Decoding textEntityTypeCashtag#48e4374b. - v := TextEntityTypeCashtag{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeBotCommandTypeID: - // Decoding textEntityTypeBotCommand#bb652bb3. - v := TextEntityTypeBotCommand{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeURLTypeID: - // Decoding textEntityTypeUrl#b1c0d47c. - v := TextEntityTypeURL{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeEmailAddressTypeID: - // Decoding textEntityTypeEmailAddress#54f81821. - v := TextEntityTypeEmailAddress{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypePhoneNumberTypeID: - // Decoding textEntityTypePhoneNumber#bad9aa2a. - v := TextEntityTypePhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeBankCardNumberTypeID: - // Decoding textEntityTypeBankCardNumber#6513910. - v := TextEntityTypeBankCardNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeBoldTypeID: - // Decoding textEntityTypeBold#bcc0e1b0. - v := TextEntityTypeBold{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeItalicTypeID: - // Decoding textEntityTypeItalic#f8f3965d. - v := TextEntityTypeItalic{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeUnderlineTypeID: - // Decoding textEntityTypeUnderline#2f39cf92. - v := TextEntityTypeUnderline{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeStrikethroughTypeID: - // Decoding textEntityTypeStrikethrough#394fc4fa. - v := TextEntityTypeStrikethrough{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeSpoilerTypeID: - // Decoding textEntityTypeSpoiler#206d15bb. - v := TextEntityTypeSpoiler{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeCodeTypeID: - // Decoding textEntityTypeCode#c5e9c94a. - v := TextEntityTypeCode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypePreTypeID: - // Decoding textEntityTypePre#62491c8e. - v := TextEntityTypePre{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypePreCodeTypeID: - // Decoding textEntityTypePreCode#c7a77aab. - v := TextEntityTypePreCode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeBlockQuoteTypeID: - // Decoding textEntityTypeBlockQuote#c42830c8. - v := TextEntityTypeBlockQuote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeExpandableBlockQuoteTypeID: - // Decoding textEntityTypeExpandableBlockQuote#22e0c65. - v := TextEntityTypeExpandableBlockQuote{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeTextURLTypeID: - // Decoding textEntityTypeTextUrl#1a912463. - v := TextEntityTypeTextURL{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeMentionNameTypeID: - // Decoding textEntityTypeMentionName#a25cd5af. - v := TextEntityTypeMentionName{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeCustomEmojiTypeID: - // Decoding textEntityTypeCustomEmoji#66ceacc5. - v := TextEntityTypeCustomEmoji{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case TextEntityTypeMediaTimestampTypeID: - // Decoding textEntityTypeMediaTimestamp#9236da10. - v := TextEntityTypeMediaTimestamp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONTextEntityType implements binary de-serialization for TextEntityTypeClass. -func DecodeTDLibJSONTextEntityType(buf tdjson.Decoder) (TextEntityTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "textEntityTypeMention": - // Decoding textEntityTypeMention#37b3df65. - v := TextEntityTypeMention{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeHashtag": - // Decoding textEntityTypeHashtag#c2f7a2dd. - v := TextEntityTypeHashtag{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeCashtag": - // Decoding textEntityTypeCashtag#48e4374b. - v := TextEntityTypeCashtag{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeBotCommand": - // Decoding textEntityTypeBotCommand#bb652bb3. - v := TextEntityTypeBotCommand{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeUrl": - // Decoding textEntityTypeUrl#b1c0d47c. - v := TextEntityTypeURL{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeEmailAddress": - // Decoding textEntityTypeEmailAddress#54f81821. - v := TextEntityTypeEmailAddress{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypePhoneNumber": - // Decoding textEntityTypePhoneNumber#bad9aa2a. - v := TextEntityTypePhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeBankCardNumber": - // Decoding textEntityTypeBankCardNumber#6513910. - v := TextEntityTypeBankCardNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeBold": - // Decoding textEntityTypeBold#bcc0e1b0. - v := TextEntityTypeBold{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeItalic": - // Decoding textEntityTypeItalic#f8f3965d. - v := TextEntityTypeItalic{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeUnderline": - // Decoding textEntityTypeUnderline#2f39cf92. - v := TextEntityTypeUnderline{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeStrikethrough": - // Decoding textEntityTypeStrikethrough#394fc4fa. - v := TextEntityTypeStrikethrough{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeSpoiler": - // Decoding textEntityTypeSpoiler#206d15bb. - v := TextEntityTypeSpoiler{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeCode": - // Decoding textEntityTypeCode#c5e9c94a. - v := TextEntityTypeCode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypePre": - // Decoding textEntityTypePre#62491c8e. - v := TextEntityTypePre{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypePreCode": - // Decoding textEntityTypePreCode#c7a77aab. - v := TextEntityTypePreCode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeBlockQuote": - // Decoding textEntityTypeBlockQuote#c42830c8. - v := TextEntityTypeBlockQuote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeExpandableBlockQuote": - // Decoding textEntityTypeExpandableBlockQuote#22e0c65. - v := TextEntityTypeExpandableBlockQuote{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeTextUrl": - // Decoding textEntityTypeTextUrl#1a912463. - v := TextEntityTypeTextURL{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeMentionName": - // Decoding textEntityTypeMentionName#a25cd5af. - v := TextEntityTypeMentionName{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeCustomEmoji": - // Decoding textEntityTypeCustomEmoji#66ceacc5. - v := TextEntityTypeCustomEmoji{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - case "textEntityTypeMediaTimestamp": - // Decoding textEntityTypeMediaTimestamp#9236da10. - v := TextEntityTypeMediaTimestamp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TextEntityTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// TextEntityType boxes the TextEntityTypeClass providing a helper. -type TextEntityTypeBox struct { - TextEntityType TextEntityTypeClass -} - -// Decode implements bin.Decoder for TextEntityTypeBox. -func (b *TextEntityTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode TextEntityTypeBox to nil") - } - v, err := DecodeTextEntityType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TextEntityType = v - return nil -} - -// Encode implements bin.Encode for TextEntityTypeBox. -func (b *TextEntityTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.TextEntityType == nil { - return fmt.Errorf("unable to encode TextEntityTypeClass as nil") - } - return b.TextEntityType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for TextEntityTypeBox. -func (b *TextEntityTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode TextEntityTypeBox to nil") - } - v, err := DecodeTDLibJSONTextEntityType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TextEntityType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for TextEntityTypeBox. -func (b *TextEntityTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.TextEntityType == nil { - return fmt.Errorf("unable to encode TextEntityTypeClass as nil") - } - return b.TextEntityType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_text_gen.go b/tdapi/tl_text_gen.go deleted file mode 100644 index 80a81403f..000000000 --- a/tdapi/tl_text_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Text represents TL type `text#22765898`. -type Text struct { - // Text - Text string -} - -// TextTypeID is TL type id of Text. -const TextTypeID = 0x22765898 - -// Ensuring interfaces in compile-time for Text. -var ( - _ bin.Encoder = &Text{} - _ bin.Decoder = &Text{} - _ bin.BareEncoder = &Text{} - _ bin.BareDecoder = &Text{} -) - -func (t *Text) Zero() bool { - if t == nil { - return true - } - if !(t.Text == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *Text) String() string { - if t == nil { - return "Text(nil)" - } - type Alias Text - return fmt.Sprintf("Text%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Text) TypeID() uint32 { - return TextTypeID -} - -// TypeName returns name of type in TL schema. -func (*Text) TypeName() string { - return "text" -} - -// TypeInfo returns info about TL type. -func (t *Text) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "text", - ID: TextTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *Text) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode text#22765898 as nil") - } - b.PutID(TextTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *Text) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode text#22765898 as nil") - } - b.PutString(t.Text) - return nil -} - -// Decode implements bin.Decoder. -func (t *Text) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode text#22765898 to nil") - } - if err := b.ConsumeID(TextTypeID); err != nil { - return fmt.Errorf("unable to decode text#22765898: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *Text) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode text#22765898 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode text#22765898: field text: %w", err) - } - t.Text = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *Text) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode text#22765898 as nil") - } - b.ObjStart() - b.PutID("text") - b.Comma() - b.FieldStart("text") - b.PutString(t.Text) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *Text) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode text#22765898 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("text"); err != nil { - return fmt.Errorf("unable to decode text#22765898: %w", err) - } - case "text": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode text#22765898: field text: %w", err) - } - t.Text = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (t *Text) GetText() (value string) { - if t == nil { - return - } - return t.Text -} diff --git a/tdapi/tl_text_parse_mode_gen.go b/tdapi/tl_text_parse_mode_gen.go deleted file mode 100644 index 3a58a357b..000000000 --- a/tdapi/tl_text_parse_mode_gen.go +++ /dev/null @@ -1,467 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TextParseModeMarkdown represents TL type `textParseModeMarkdown#157648bf`. -type TextParseModeMarkdown struct { - // Version of the parser: 0 or 1 - Telegram Bot API "Markdown" parse mode, 2 - Telegram - // Bot API "MarkdownV2" parse mode - Version int32 -} - -// TextParseModeMarkdownTypeID is TL type id of TextParseModeMarkdown. -const TextParseModeMarkdownTypeID = 0x157648bf - -// construct implements constructor of TextParseModeClass. -func (t TextParseModeMarkdown) construct() TextParseModeClass { return &t } - -// Ensuring interfaces in compile-time for TextParseModeMarkdown. -var ( - _ bin.Encoder = &TextParseModeMarkdown{} - _ bin.Decoder = &TextParseModeMarkdown{} - _ bin.BareEncoder = &TextParseModeMarkdown{} - _ bin.BareDecoder = &TextParseModeMarkdown{} - - _ TextParseModeClass = &TextParseModeMarkdown{} -) - -func (t *TextParseModeMarkdown) Zero() bool { - if t == nil { - return true - } - if !(t.Version == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextParseModeMarkdown) String() string { - if t == nil { - return "TextParseModeMarkdown(nil)" - } - type Alias TextParseModeMarkdown - return fmt.Sprintf("TextParseModeMarkdown%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextParseModeMarkdown) TypeID() uint32 { - return TextParseModeMarkdownTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextParseModeMarkdown) TypeName() string { - return "textParseModeMarkdown" -} - -// TypeInfo returns info about TL type. -func (t *TextParseModeMarkdown) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textParseModeMarkdown", - ID: TextParseModeMarkdownTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Version", - SchemaName: "version", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TextParseModeMarkdown) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textParseModeMarkdown#157648bf as nil") - } - b.PutID(TextParseModeMarkdownTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextParseModeMarkdown) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textParseModeMarkdown#157648bf as nil") - } - b.PutInt32(t.Version) - return nil -} - -// Decode implements bin.Decoder. -func (t *TextParseModeMarkdown) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textParseModeMarkdown#157648bf to nil") - } - if err := b.ConsumeID(TextParseModeMarkdownTypeID); err != nil { - return fmt.Errorf("unable to decode textParseModeMarkdown#157648bf: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextParseModeMarkdown) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textParseModeMarkdown#157648bf to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode textParseModeMarkdown#157648bf: field version: %w", err) - } - t.Version = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextParseModeMarkdown) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textParseModeMarkdown#157648bf as nil") - } - b.ObjStart() - b.PutID("textParseModeMarkdown") - b.Comma() - b.FieldStart("version") - b.PutInt32(t.Version) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextParseModeMarkdown) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textParseModeMarkdown#157648bf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textParseModeMarkdown"); err != nil { - return fmt.Errorf("unable to decode textParseModeMarkdown#157648bf: %w", err) - } - case "version": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode textParseModeMarkdown#157648bf: field version: %w", err) - } - t.Version = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVersion returns value of Version field. -func (t *TextParseModeMarkdown) GetVersion() (value int32) { - if t == nil { - return - } - return t.Version -} - -// TextParseModeHTML represents TL type `textParseModeHTML#62f4c5f3`. -type TextParseModeHTML struct { -} - -// TextParseModeHTMLTypeID is TL type id of TextParseModeHTML. -const TextParseModeHTMLTypeID = 0x62f4c5f3 - -// construct implements constructor of TextParseModeClass. -func (t TextParseModeHTML) construct() TextParseModeClass { return &t } - -// Ensuring interfaces in compile-time for TextParseModeHTML. -var ( - _ bin.Encoder = &TextParseModeHTML{} - _ bin.Decoder = &TextParseModeHTML{} - _ bin.BareEncoder = &TextParseModeHTML{} - _ bin.BareDecoder = &TextParseModeHTML{} - - _ TextParseModeClass = &TextParseModeHTML{} -) - -func (t *TextParseModeHTML) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextParseModeHTML) String() string { - if t == nil { - return "TextParseModeHTML(nil)" - } - type Alias TextParseModeHTML - return fmt.Sprintf("TextParseModeHTML%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextParseModeHTML) TypeID() uint32 { - return TextParseModeHTMLTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextParseModeHTML) TypeName() string { - return "textParseModeHTML" -} - -// TypeInfo returns info about TL type. -func (t *TextParseModeHTML) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textParseModeHTML", - ID: TextParseModeHTMLTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TextParseModeHTML) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textParseModeHTML#62f4c5f3 as nil") - } - b.PutID(TextParseModeHTMLTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextParseModeHTML) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textParseModeHTML#62f4c5f3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TextParseModeHTML) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textParseModeHTML#62f4c5f3 to nil") - } - if err := b.ConsumeID(TextParseModeHTMLTypeID); err != nil { - return fmt.Errorf("unable to decode textParseModeHTML#62f4c5f3: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextParseModeHTML) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textParseModeHTML#62f4c5f3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextParseModeHTML) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textParseModeHTML#62f4c5f3 as nil") - } - b.ObjStart() - b.PutID("textParseModeHTML") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextParseModeHTML) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textParseModeHTML#62f4c5f3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textParseModeHTML"); err != nil { - return fmt.Errorf("unable to decode textParseModeHTML#62f4c5f3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TextParseModeClassName is schema name of TextParseModeClass. -const TextParseModeClassName = "TextParseMode" - -// TextParseModeClass represents TextParseMode generic type. -// -// Example: -// -// g, err := tdapi.DecodeTextParseMode(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.TextParseModeMarkdown: // textParseModeMarkdown#157648bf -// case *tdapi.TextParseModeHTML: // textParseModeHTML#62f4c5f3 -// default: panic(v) -// } -type TextParseModeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() TextParseModeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeTextParseMode implements binary de-serialization for TextParseModeClass. -func DecodeTextParseMode(buf *bin.Buffer) (TextParseModeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case TextParseModeMarkdownTypeID: - // Decoding textParseModeMarkdown#157648bf. - v := TextParseModeMarkdown{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextParseModeClass: %w", err) - } - return &v, nil - case TextParseModeHTMLTypeID: - // Decoding textParseModeHTML#62f4c5f3. - v := TextParseModeHTML{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextParseModeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TextParseModeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONTextParseMode implements binary de-serialization for TextParseModeClass. -func DecodeTDLibJSONTextParseMode(buf tdjson.Decoder) (TextParseModeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "textParseModeMarkdown": - // Decoding textParseModeMarkdown#157648bf. - v := TextParseModeMarkdown{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextParseModeClass: %w", err) - } - return &v, nil - case "textParseModeHTML": - // Decoding textParseModeHTML#62f4c5f3. - v := TextParseModeHTML{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TextParseModeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TextParseModeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// TextParseMode boxes the TextParseModeClass providing a helper. -type TextParseModeBox struct { - TextParseMode TextParseModeClass -} - -// Decode implements bin.Decoder for TextParseModeBox. -func (b *TextParseModeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode TextParseModeBox to nil") - } - v, err := DecodeTextParseMode(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TextParseMode = v - return nil -} - -// Encode implements bin.Encode for TextParseModeBox. -func (b *TextParseModeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.TextParseMode == nil { - return fmt.Errorf("unable to encode TextParseModeClass as nil") - } - return b.TextParseMode.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for TextParseModeBox. -func (b *TextParseModeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode TextParseModeBox to nil") - } - v, err := DecodeTDLibJSONTextParseMode(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TextParseMode = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for TextParseModeBox. -func (b *TextParseModeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.TextParseMode == nil { - return fmt.Errorf("unable to encode TextParseModeClass as nil") - } - return b.TextParseMode.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_text_quote_gen.go b/tdapi/tl_text_quote_gen.go deleted file mode 100644 index 6f7afc9ec..000000000 --- a/tdapi/tl_text_quote_gen.go +++ /dev/null @@ -1,263 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TextQuote represents TL type `textQuote#8675b8b2`. -type TextQuote struct { - // Text of the quote. Only Bold, Italic, Underline, Strikethrough, Spoiler, and - // CustomEmoji entities can be present in the text - Text FormattedText - // Approximate quote position in the original message in UTF-16 code units as specified - // by the message sender - Position int32 - // True, if the quote was manually chosen by the message sender - IsManual bool -} - -// TextQuoteTypeID is TL type id of TextQuote. -const TextQuoteTypeID = 0x8675b8b2 - -// Ensuring interfaces in compile-time for TextQuote. -var ( - _ bin.Encoder = &TextQuote{} - _ bin.Decoder = &TextQuote{} - _ bin.BareEncoder = &TextQuote{} - _ bin.BareDecoder = &TextQuote{} -) - -func (t *TextQuote) Zero() bool { - if t == nil { - return true - } - if !(t.Text.Zero()) { - return false - } - if !(t.Position == 0) { - return false - } - if !(t.IsManual == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TextQuote) String() string { - if t == nil { - return "TextQuote(nil)" - } - type Alias TextQuote - return fmt.Sprintf("TextQuote%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TextQuote) TypeID() uint32 { - return TextQuoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*TextQuote) TypeName() string { - return "textQuote" -} - -// TypeInfo returns info about TL type. -func (t *TextQuote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "textQuote", - ID: TextQuoteTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Position", - SchemaName: "position", - }, - { - Name: "IsManual", - SchemaName: "is_manual", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TextQuote) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textQuote#8675b8b2 as nil") - } - b.PutID(TextQuoteTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TextQuote) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode textQuote#8675b8b2 as nil") - } - if err := t.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode textQuote#8675b8b2: field text: %w", err) - } - b.PutInt32(t.Position) - b.PutBool(t.IsManual) - return nil -} - -// Decode implements bin.Decoder. -func (t *TextQuote) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textQuote#8675b8b2 to nil") - } - if err := b.ConsumeID(TextQuoteTypeID); err != nil { - return fmt.Errorf("unable to decode textQuote#8675b8b2: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TextQuote) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode textQuote#8675b8b2 to nil") - } - { - if err := t.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode textQuote#8675b8b2: field text: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode textQuote#8675b8b2: field position: %w", err) - } - t.Position = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode textQuote#8675b8b2: field is_manual: %w", err) - } - t.IsManual = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TextQuote) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode textQuote#8675b8b2 as nil") - } - b.ObjStart() - b.PutID("textQuote") - b.Comma() - b.FieldStart("text") - if err := t.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode textQuote#8675b8b2: field text: %w", err) - } - b.Comma() - b.FieldStart("position") - b.PutInt32(t.Position) - b.Comma() - b.FieldStart("is_manual") - b.PutBool(t.IsManual) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TextQuote) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode textQuote#8675b8b2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("textQuote"); err != nil { - return fmt.Errorf("unable to decode textQuote#8675b8b2: %w", err) - } - case "text": - if err := t.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode textQuote#8675b8b2: field text: %w", err) - } - case "position": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode textQuote#8675b8b2: field position: %w", err) - } - t.Position = value - case "is_manual": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode textQuote#8675b8b2: field is_manual: %w", err) - } - t.IsManual = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (t *TextQuote) GetText() (value FormattedText) { - if t == nil { - return - } - return t.Text -} - -// GetPosition returns value of Position field. -func (t *TextQuote) GetPosition() (value int32) { - if t == nil { - return - } - return t.Position -} - -// GetIsManual returns value of IsManual field. -func (t *TextQuote) GetIsManual() (value bool) { - if t == nil { - return - } - return t.IsManual -} diff --git a/tdapi/tl_theme_parameters_gen.go b/tdapi/tl_theme_parameters_gen.go deleted file mode 100644 index 8af141d15..000000000 --- a/tdapi/tl_theme_parameters_gen.go +++ /dev/null @@ -1,669 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ThemeParameters represents TL type `themeParameters#ef8395af`. -type ThemeParameters struct { - // A color of the background in the RGB format - BackgroundColor int32 - // A secondary color for the background in the RGB format - SecondaryBackgroundColor int32 - // A color of the header background in the RGB format - HeaderBackgroundColor int32 - // A color of the bottom bar background in the RGB format - BottomBarBackgroundColor int32 - // A color of the section background in the RGB format - SectionBackgroundColor int32 - // A color of the section separator in the RGB format - SectionSeparatorColor int32 - // A color of text in the RGB format - TextColor int32 - // An accent color of the text in the RGB format - AccentTextColor int32 - // A color of text on the section headers in the RGB format - SectionHeaderTextColor int32 - // A color of the subtitle text in the RGB format - SubtitleTextColor int32 - // A color of the text for destructive actions in the RGB format - DestructiveTextColor int32 - // A color of hints in the RGB format - HintColor int32 - // A color of links in the RGB format - LinkColor int32 - // A color of the buttons in the RGB format - ButtonColor int32 - // A color of text on the buttons in the RGB format - ButtonTextColor int32 -} - -// ThemeParametersTypeID is TL type id of ThemeParameters. -const ThemeParametersTypeID = 0xef8395af - -// Ensuring interfaces in compile-time for ThemeParameters. -var ( - _ bin.Encoder = &ThemeParameters{} - _ bin.Decoder = &ThemeParameters{} - _ bin.BareEncoder = &ThemeParameters{} - _ bin.BareDecoder = &ThemeParameters{} -) - -func (t *ThemeParameters) Zero() bool { - if t == nil { - return true - } - if !(t.BackgroundColor == 0) { - return false - } - if !(t.SecondaryBackgroundColor == 0) { - return false - } - if !(t.HeaderBackgroundColor == 0) { - return false - } - if !(t.BottomBarBackgroundColor == 0) { - return false - } - if !(t.SectionBackgroundColor == 0) { - return false - } - if !(t.SectionSeparatorColor == 0) { - return false - } - if !(t.TextColor == 0) { - return false - } - if !(t.AccentTextColor == 0) { - return false - } - if !(t.SectionHeaderTextColor == 0) { - return false - } - if !(t.SubtitleTextColor == 0) { - return false - } - if !(t.DestructiveTextColor == 0) { - return false - } - if !(t.HintColor == 0) { - return false - } - if !(t.LinkColor == 0) { - return false - } - if !(t.ButtonColor == 0) { - return false - } - if !(t.ButtonTextColor == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ThemeParameters) String() string { - if t == nil { - return "ThemeParameters(nil)" - } - type Alias ThemeParameters - return fmt.Sprintf("ThemeParameters%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThemeParameters) TypeID() uint32 { - return ThemeParametersTypeID -} - -// TypeName returns name of type in TL schema. -func (*ThemeParameters) TypeName() string { - return "themeParameters" -} - -// TypeInfo returns info about TL type. -func (t *ThemeParameters) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "themeParameters", - ID: ThemeParametersTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BackgroundColor", - SchemaName: "background_color", - }, - { - Name: "SecondaryBackgroundColor", - SchemaName: "secondary_background_color", - }, - { - Name: "HeaderBackgroundColor", - SchemaName: "header_background_color", - }, - { - Name: "BottomBarBackgroundColor", - SchemaName: "bottom_bar_background_color", - }, - { - Name: "SectionBackgroundColor", - SchemaName: "section_background_color", - }, - { - Name: "SectionSeparatorColor", - SchemaName: "section_separator_color", - }, - { - Name: "TextColor", - SchemaName: "text_color", - }, - { - Name: "AccentTextColor", - SchemaName: "accent_text_color", - }, - { - Name: "SectionHeaderTextColor", - SchemaName: "section_header_text_color", - }, - { - Name: "SubtitleTextColor", - SchemaName: "subtitle_text_color", - }, - { - Name: "DestructiveTextColor", - SchemaName: "destructive_text_color", - }, - { - Name: "HintColor", - SchemaName: "hint_color", - }, - { - Name: "LinkColor", - SchemaName: "link_color", - }, - { - Name: "ButtonColor", - SchemaName: "button_color", - }, - { - Name: "ButtonTextColor", - SchemaName: "button_text_color", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ThemeParameters) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode themeParameters#ef8395af as nil") - } - b.PutID(ThemeParametersTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ThemeParameters) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode themeParameters#ef8395af as nil") - } - b.PutInt32(t.BackgroundColor) - b.PutInt32(t.SecondaryBackgroundColor) - b.PutInt32(t.HeaderBackgroundColor) - b.PutInt32(t.BottomBarBackgroundColor) - b.PutInt32(t.SectionBackgroundColor) - b.PutInt32(t.SectionSeparatorColor) - b.PutInt32(t.TextColor) - b.PutInt32(t.AccentTextColor) - b.PutInt32(t.SectionHeaderTextColor) - b.PutInt32(t.SubtitleTextColor) - b.PutInt32(t.DestructiveTextColor) - b.PutInt32(t.HintColor) - b.PutInt32(t.LinkColor) - b.PutInt32(t.ButtonColor) - b.PutInt32(t.ButtonTextColor) - return nil -} - -// Decode implements bin.Decoder. -func (t *ThemeParameters) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode themeParameters#ef8395af to nil") - } - if err := b.ConsumeID(ThemeParametersTypeID); err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ThemeParameters) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode themeParameters#ef8395af to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field background_color: %w", err) - } - t.BackgroundColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field secondary_background_color: %w", err) - } - t.SecondaryBackgroundColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field header_background_color: %w", err) - } - t.HeaderBackgroundColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field bottom_bar_background_color: %w", err) - } - t.BottomBarBackgroundColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_background_color: %w", err) - } - t.SectionBackgroundColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_separator_color: %w", err) - } - t.SectionSeparatorColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field text_color: %w", err) - } - t.TextColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field accent_text_color: %w", err) - } - t.AccentTextColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_header_text_color: %w", err) - } - t.SectionHeaderTextColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field subtitle_text_color: %w", err) - } - t.SubtitleTextColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field destructive_text_color: %w", err) - } - t.DestructiveTextColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field hint_color: %w", err) - } - t.HintColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field link_color: %w", err) - } - t.LinkColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field button_color: %w", err) - } - t.ButtonColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field button_text_color: %w", err) - } - t.ButtonTextColor = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThemeParameters) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode themeParameters#ef8395af as nil") - } - b.ObjStart() - b.PutID("themeParameters") - b.Comma() - b.FieldStart("background_color") - b.PutInt32(t.BackgroundColor) - b.Comma() - b.FieldStart("secondary_background_color") - b.PutInt32(t.SecondaryBackgroundColor) - b.Comma() - b.FieldStart("header_background_color") - b.PutInt32(t.HeaderBackgroundColor) - b.Comma() - b.FieldStart("bottom_bar_background_color") - b.PutInt32(t.BottomBarBackgroundColor) - b.Comma() - b.FieldStart("section_background_color") - b.PutInt32(t.SectionBackgroundColor) - b.Comma() - b.FieldStart("section_separator_color") - b.PutInt32(t.SectionSeparatorColor) - b.Comma() - b.FieldStart("text_color") - b.PutInt32(t.TextColor) - b.Comma() - b.FieldStart("accent_text_color") - b.PutInt32(t.AccentTextColor) - b.Comma() - b.FieldStart("section_header_text_color") - b.PutInt32(t.SectionHeaderTextColor) - b.Comma() - b.FieldStart("subtitle_text_color") - b.PutInt32(t.SubtitleTextColor) - b.Comma() - b.FieldStart("destructive_text_color") - b.PutInt32(t.DestructiveTextColor) - b.Comma() - b.FieldStart("hint_color") - b.PutInt32(t.HintColor) - b.Comma() - b.FieldStart("link_color") - b.PutInt32(t.LinkColor) - b.Comma() - b.FieldStart("button_color") - b.PutInt32(t.ButtonColor) - b.Comma() - b.FieldStart("button_text_color") - b.PutInt32(t.ButtonTextColor) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThemeParameters) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode themeParameters#ef8395af to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("themeParameters"); err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: %w", err) - } - case "background_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field background_color: %w", err) - } - t.BackgroundColor = value - case "secondary_background_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field secondary_background_color: %w", err) - } - t.SecondaryBackgroundColor = value - case "header_background_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field header_background_color: %w", err) - } - t.HeaderBackgroundColor = value - case "bottom_bar_background_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field bottom_bar_background_color: %w", err) - } - t.BottomBarBackgroundColor = value - case "section_background_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_background_color: %w", err) - } - t.SectionBackgroundColor = value - case "section_separator_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_separator_color: %w", err) - } - t.SectionSeparatorColor = value - case "text_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field text_color: %w", err) - } - t.TextColor = value - case "accent_text_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field accent_text_color: %w", err) - } - t.AccentTextColor = value - case "section_header_text_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field section_header_text_color: %w", err) - } - t.SectionHeaderTextColor = value - case "subtitle_text_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field subtitle_text_color: %w", err) - } - t.SubtitleTextColor = value - case "destructive_text_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field destructive_text_color: %w", err) - } - t.DestructiveTextColor = value - case "hint_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field hint_color: %w", err) - } - t.HintColor = value - case "link_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field link_color: %w", err) - } - t.LinkColor = value - case "button_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field button_color: %w", err) - } - t.ButtonColor = value - case "button_text_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeParameters#ef8395af: field button_text_color: %w", err) - } - t.ButtonTextColor = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBackgroundColor returns value of BackgroundColor field. -func (t *ThemeParameters) GetBackgroundColor() (value int32) { - if t == nil { - return - } - return t.BackgroundColor -} - -// GetSecondaryBackgroundColor returns value of SecondaryBackgroundColor field. -func (t *ThemeParameters) GetSecondaryBackgroundColor() (value int32) { - if t == nil { - return - } - return t.SecondaryBackgroundColor -} - -// GetHeaderBackgroundColor returns value of HeaderBackgroundColor field. -func (t *ThemeParameters) GetHeaderBackgroundColor() (value int32) { - if t == nil { - return - } - return t.HeaderBackgroundColor -} - -// GetBottomBarBackgroundColor returns value of BottomBarBackgroundColor field. -func (t *ThemeParameters) GetBottomBarBackgroundColor() (value int32) { - if t == nil { - return - } - return t.BottomBarBackgroundColor -} - -// GetSectionBackgroundColor returns value of SectionBackgroundColor field. -func (t *ThemeParameters) GetSectionBackgroundColor() (value int32) { - if t == nil { - return - } - return t.SectionBackgroundColor -} - -// GetSectionSeparatorColor returns value of SectionSeparatorColor field. -func (t *ThemeParameters) GetSectionSeparatorColor() (value int32) { - if t == nil { - return - } - return t.SectionSeparatorColor -} - -// GetTextColor returns value of TextColor field. -func (t *ThemeParameters) GetTextColor() (value int32) { - if t == nil { - return - } - return t.TextColor -} - -// GetAccentTextColor returns value of AccentTextColor field. -func (t *ThemeParameters) GetAccentTextColor() (value int32) { - if t == nil { - return - } - return t.AccentTextColor -} - -// GetSectionHeaderTextColor returns value of SectionHeaderTextColor field. -func (t *ThemeParameters) GetSectionHeaderTextColor() (value int32) { - if t == nil { - return - } - return t.SectionHeaderTextColor -} - -// GetSubtitleTextColor returns value of SubtitleTextColor field. -func (t *ThemeParameters) GetSubtitleTextColor() (value int32) { - if t == nil { - return - } - return t.SubtitleTextColor -} - -// GetDestructiveTextColor returns value of DestructiveTextColor field. -func (t *ThemeParameters) GetDestructiveTextColor() (value int32) { - if t == nil { - return - } - return t.DestructiveTextColor -} - -// GetHintColor returns value of HintColor field. -func (t *ThemeParameters) GetHintColor() (value int32) { - if t == nil { - return - } - return t.HintColor -} - -// GetLinkColor returns value of LinkColor field. -func (t *ThemeParameters) GetLinkColor() (value int32) { - if t == nil { - return - } - return t.LinkColor -} - -// GetButtonColor returns value of ButtonColor field. -func (t *ThemeParameters) GetButtonColor() (value int32) { - if t == nil { - return - } - return t.ButtonColor -} - -// GetButtonTextColor returns value of ButtonTextColor field. -func (t *ThemeParameters) GetButtonTextColor() (value int32) { - if t == nil { - return - } - return t.ButtonTextColor -} diff --git a/tdapi/tl_theme_settings_gen.go b/tdapi/tl_theme_settings_gen.go deleted file mode 100644 index fcaa31647..000000000 --- a/tdapi/tl_theme_settings_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ThemeSettings represents TL type `themeSettings#fc4c1c12`. -type ThemeSettings struct { - // Theme accent color in ARGB format - AccentColor int32 - // The background to be used in chats; may be null - Background Background - // The fill to be used as a background for outgoing messages - OutgoingMessageFill BackgroundFillClass - // If true, the freeform gradient fill needs to be animated on every sent message - AnimateOutgoingMessageFill bool - // Accent color of outgoing messages in ARGB format - OutgoingMessageAccentColor int32 -} - -// ThemeSettingsTypeID is TL type id of ThemeSettings. -const ThemeSettingsTypeID = 0xfc4c1c12 - -// Ensuring interfaces in compile-time for ThemeSettings. -var ( - _ bin.Encoder = &ThemeSettings{} - _ bin.Decoder = &ThemeSettings{} - _ bin.BareEncoder = &ThemeSettings{} - _ bin.BareDecoder = &ThemeSettings{} -) - -func (t *ThemeSettings) Zero() bool { - if t == nil { - return true - } - if !(t.AccentColor == 0) { - return false - } - if !(t.Background.Zero()) { - return false - } - if !(t.OutgoingMessageFill == nil) { - return false - } - if !(t.AnimateOutgoingMessageFill == false) { - return false - } - if !(t.OutgoingMessageAccentColor == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ThemeSettings) String() string { - if t == nil { - return "ThemeSettings(nil)" - } - type Alias ThemeSettings - return fmt.Sprintf("ThemeSettings%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThemeSettings) TypeID() uint32 { - return ThemeSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ThemeSettings) TypeName() string { - return "themeSettings" -} - -// TypeInfo returns info about TL type. -func (t *ThemeSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "themeSettings", - ID: ThemeSettingsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AccentColor", - SchemaName: "accent_color", - }, - { - Name: "Background", - SchemaName: "background", - }, - { - Name: "OutgoingMessageFill", - SchemaName: "outgoing_message_fill", - }, - { - Name: "AnimateOutgoingMessageFill", - SchemaName: "animate_outgoing_message_fill", - }, - { - Name: "OutgoingMessageAccentColor", - SchemaName: "outgoing_message_accent_color", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ThemeSettings) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode themeSettings#fc4c1c12 as nil") - } - b.PutID(ThemeSettingsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ThemeSettings) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode themeSettings#fc4c1c12 as nil") - } - b.PutInt32(t.AccentColor) - if err := t.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode themeSettings#fc4c1c12: field background: %w", err) - } - if t.OutgoingMessageFill == nil { - return fmt.Errorf("unable to encode themeSettings#fc4c1c12: field outgoing_message_fill is nil") - } - if err := t.OutgoingMessageFill.Encode(b); err != nil { - return fmt.Errorf("unable to encode themeSettings#fc4c1c12: field outgoing_message_fill: %w", err) - } - b.PutBool(t.AnimateOutgoingMessageFill) - b.PutInt32(t.OutgoingMessageAccentColor) - return nil -} - -// Decode implements bin.Decoder. -func (t *ThemeSettings) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode themeSettings#fc4c1c12 to nil") - } - if err := b.ConsumeID(ThemeSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ThemeSettings) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode themeSettings#fc4c1c12 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: field accent_color: %w", err) - } - t.AccentColor = value - } - { - if err := t.Background.Decode(b); err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: field background: %w", err) - } - } - { - value, err := DecodeBackgroundFill(b) - if err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: field outgoing_message_fill: %w", err) - } - t.OutgoingMessageFill = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: field animate_outgoing_message_fill: %w", err) - } - t.AnimateOutgoingMessageFill = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: field outgoing_message_accent_color: %w", err) - } - t.OutgoingMessageAccentColor = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThemeSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode themeSettings#fc4c1c12 as nil") - } - b.ObjStart() - b.PutID("themeSettings") - b.Comma() - b.FieldStart("accent_color") - b.PutInt32(t.AccentColor) - b.Comma() - b.FieldStart("background") - if err := t.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode themeSettings#fc4c1c12: field background: %w", err) - } - b.Comma() - b.FieldStart("outgoing_message_fill") - if t.OutgoingMessageFill == nil { - return fmt.Errorf("unable to encode themeSettings#fc4c1c12: field outgoing_message_fill is nil") - } - if err := t.OutgoingMessageFill.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode themeSettings#fc4c1c12: field outgoing_message_fill: %w", err) - } - b.Comma() - b.FieldStart("animate_outgoing_message_fill") - b.PutBool(t.AnimateOutgoingMessageFill) - b.Comma() - b.FieldStart("outgoing_message_accent_color") - b.PutInt32(t.OutgoingMessageAccentColor) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThemeSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode themeSettings#fc4c1c12 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("themeSettings"); err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: %w", err) - } - case "accent_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: field accent_color: %w", err) - } - t.AccentColor = value - case "background": - if err := t.Background.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: field background: %w", err) - } - case "outgoing_message_fill": - value, err := DecodeTDLibJSONBackgroundFill(b) - if err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: field outgoing_message_fill: %w", err) - } - t.OutgoingMessageFill = value - case "animate_outgoing_message_fill": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: field animate_outgoing_message_fill: %w", err) - } - t.AnimateOutgoingMessageFill = value - case "outgoing_message_accent_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode themeSettings#fc4c1c12: field outgoing_message_accent_color: %w", err) - } - t.OutgoingMessageAccentColor = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAccentColor returns value of AccentColor field. -func (t *ThemeSettings) GetAccentColor() (value int32) { - if t == nil { - return - } - return t.AccentColor -} - -// GetBackground returns value of Background field. -func (t *ThemeSettings) GetBackground() (value Background) { - if t == nil { - return - } - return t.Background -} - -// GetOutgoingMessageFill returns value of OutgoingMessageFill field. -func (t *ThemeSettings) GetOutgoingMessageFill() (value BackgroundFillClass) { - if t == nil { - return - } - return t.OutgoingMessageFill -} - -// GetAnimateOutgoingMessageFill returns value of AnimateOutgoingMessageFill field. -func (t *ThemeSettings) GetAnimateOutgoingMessageFill() (value bool) { - if t == nil { - return - } - return t.AnimateOutgoingMessageFill -} - -// GetOutgoingMessageAccentColor returns value of OutgoingMessageAccentColor field. -func (t *ThemeSettings) GetOutgoingMessageAccentColor() (value int32) { - if t == nil { - return - } - return t.OutgoingMessageAccentColor -} diff --git a/tdapi/tl_thumbnail_format_gen.go b/tdapi/tl_thumbnail_format_gen.go deleted file mode 100644 index ea9e30281..000000000 --- a/tdapi/tl_thumbnail_format_gen.go +++ /dev/null @@ -1,1161 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ThumbnailFormatJpeg represents TL type `thumbnailFormatJpeg#d90c5488`. -type ThumbnailFormatJpeg struct { -} - -// ThumbnailFormatJpegTypeID is TL type id of ThumbnailFormatJpeg. -const ThumbnailFormatJpegTypeID = 0xd90c5488 - -// construct implements constructor of ThumbnailFormatClass. -func (t ThumbnailFormatJpeg) construct() ThumbnailFormatClass { return &t } - -// Ensuring interfaces in compile-time for ThumbnailFormatJpeg. -var ( - _ bin.Encoder = &ThumbnailFormatJpeg{} - _ bin.Decoder = &ThumbnailFormatJpeg{} - _ bin.BareEncoder = &ThumbnailFormatJpeg{} - _ bin.BareDecoder = &ThumbnailFormatJpeg{} - - _ ThumbnailFormatClass = &ThumbnailFormatJpeg{} -) - -func (t *ThumbnailFormatJpeg) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *ThumbnailFormatJpeg) String() string { - if t == nil { - return "ThumbnailFormatJpeg(nil)" - } - type Alias ThumbnailFormatJpeg - return fmt.Sprintf("ThumbnailFormatJpeg%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThumbnailFormatJpeg) TypeID() uint32 { - return ThumbnailFormatJpegTypeID -} - -// TypeName returns name of type in TL schema. -func (*ThumbnailFormatJpeg) TypeName() string { - return "thumbnailFormatJpeg" -} - -// TypeInfo returns info about TL type. -func (t *ThumbnailFormatJpeg) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "thumbnailFormatJpeg", - ID: ThumbnailFormatJpegTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *ThumbnailFormatJpeg) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatJpeg#d90c5488 as nil") - } - b.PutID(ThumbnailFormatJpegTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ThumbnailFormatJpeg) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatJpeg#d90c5488 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *ThumbnailFormatJpeg) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatJpeg#d90c5488 to nil") - } - if err := b.ConsumeID(ThumbnailFormatJpegTypeID); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatJpeg#d90c5488: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ThumbnailFormatJpeg) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatJpeg#d90c5488 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThumbnailFormatJpeg) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatJpeg#d90c5488 as nil") - } - b.ObjStart() - b.PutID("thumbnailFormatJpeg") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThumbnailFormatJpeg) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatJpeg#d90c5488 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("thumbnailFormatJpeg"); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatJpeg#d90c5488: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ThumbnailFormatGif represents TL type `thumbnailFormatGif#4aa3258a`. -type ThumbnailFormatGif struct { -} - -// ThumbnailFormatGifTypeID is TL type id of ThumbnailFormatGif. -const ThumbnailFormatGifTypeID = 0x4aa3258a - -// construct implements constructor of ThumbnailFormatClass. -func (t ThumbnailFormatGif) construct() ThumbnailFormatClass { return &t } - -// Ensuring interfaces in compile-time for ThumbnailFormatGif. -var ( - _ bin.Encoder = &ThumbnailFormatGif{} - _ bin.Decoder = &ThumbnailFormatGif{} - _ bin.BareEncoder = &ThumbnailFormatGif{} - _ bin.BareDecoder = &ThumbnailFormatGif{} - - _ ThumbnailFormatClass = &ThumbnailFormatGif{} -) - -func (t *ThumbnailFormatGif) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *ThumbnailFormatGif) String() string { - if t == nil { - return "ThumbnailFormatGif(nil)" - } - type Alias ThumbnailFormatGif - return fmt.Sprintf("ThumbnailFormatGif%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThumbnailFormatGif) TypeID() uint32 { - return ThumbnailFormatGifTypeID -} - -// TypeName returns name of type in TL schema. -func (*ThumbnailFormatGif) TypeName() string { - return "thumbnailFormatGif" -} - -// TypeInfo returns info about TL type. -func (t *ThumbnailFormatGif) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "thumbnailFormatGif", - ID: ThumbnailFormatGifTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *ThumbnailFormatGif) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatGif#4aa3258a as nil") - } - b.PutID(ThumbnailFormatGifTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ThumbnailFormatGif) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatGif#4aa3258a as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *ThumbnailFormatGif) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatGif#4aa3258a to nil") - } - if err := b.ConsumeID(ThumbnailFormatGifTypeID); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatGif#4aa3258a: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ThumbnailFormatGif) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatGif#4aa3258a to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThumbnailFormatGif) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatGif#4aa3258a as nil") - } - b.ObjStart() - b.PutID("thumbnailFormatGif") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThumbnailFormatGif) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatGif#4aa3258a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("thumbnailFormatGif"); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatGif#4aa3258a: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ThumbnailFormatMpeg4 represents TL type `thumbnailFormatMpeg4#109b57fe`. -type ThumbnailFormatMpeg4 struct { -} - -// ThumbnailFormatMpeg4TypeID is TL type id of ThumbnailFormatMpeg4. -const ThumbnailFormatMpeg4TypeID = 0x109b57fe - -// construct implements constructor of ThumbnailFormatClass. -func (t ThumbnailFormatMpeg4) construct() ThumbnailFormatClass { return &t } - -// Ensuring interfaces in compile-time for ThumbnailFormatMpeg4. -var ( - _ bin.Encoder = &ThumbnailFormatMpeg4{} - _ bin.Decoder = &ThumbnailFormatMpeg4{} - _ bin.BareEncoder = &ThumbnailFormatMpeg4{} - _ bin.BareDecoder = &ThumbnailFormatMpeg4{} - - _ ThumbnailFormatClass = &ThumbnailFormatMpeg4{} -) - -func (t *ThumbnailFormatMpeg4) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *ThumbnailFormatMpeg4) String() string { - if t == nil { - return "ThumbnailFormatMpeg4(nil)" - } - type Alias ThumbnailFormatMpeg4 - return fmt.Sprintf("ThumbnailFormatMpeg4%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThumbnailFormatMpeg4) TypeID() uint32 { - return ThumbnailFormatMpeg4TypeID -} - -// TypeName returns name of type in TL schema. -func (*ThumbnailFormatMpeg4) TypeName() string { - return "thumbnailFormatMpeg4" -} - -// TypeInfo returns info about TL type. -func (t *ThumbnailFormatMpeg4) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "thumbnailFormatMpeg4", - ID: ThumbnailFormatMpeg4TypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *ThumbnailFormatMpeg4) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatMpeg4#109b57fe as nil") - } - b.PutID(ThumbnailFormatMpeg4TypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ThumbnailFormatMpeg4) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatMpeg4#109b57fe as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *ThumbnailFormatMpeg4) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatMpeg4#109b57fe to nil") - } - if err := b.ConsumeID(ThumbnailFormatMpeg4TypeID); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatMpeg4#109b57fe: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ThumbnailFormatMpeg4) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatMpeg4#109b57fe to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThumbnailFormatMpeg4) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatMpeg4#109b57fe as nil") - } - b.ObjStart() - b.PutID("thumbnailFormatMpeg4") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThumbnailFormatMpeg4) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatMpeg4#109b57fe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("thumbnailFormatMpeg4"); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatMpeg4#109b57fe: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ThumbnailFormatPng represents TL type `thumbnailFormatPng#5e0697f5`. -type ThumbnailFormatPng struct { -} - -// ThumbnailFormatPngTypeID is TL type id of ThumbnailFormatPng. -const ThumbnailFormatPngTypeID = 0x5e0697f5 - -// construct implements constructor of ThumbnailFormatClass. -func (t ThumbnailFormatPng) construct() ThumbnailFormatClass { return &t } - -// Ensuring interfaces in compile-time for ThumbnailFormatPng. -var ( - _ bin.Encoder = &ThumbnailFormatPng{} - _ bin.Decoder = &ThumbnailFormatPng{} - _ bin.BareEncoder = &ThumbnailFormatPng{} - _ bin.BareDecoder = &ThumbnailFormatPng{} - - _ ThumbnailFormatClass = &ThumbnailFormatPng{} -) - -func (t *ThumbnailFormatPng) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *ThumbnailFormatPng) String() string { - if t == nil { - return "ThumbnailFormatPng(nil)" - } - type Alias ThumbnailFormatPng - return fmt.Sprintf("ThumbnailFormatPng%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThumbnailFormatPng) TypeID() uint32 { - return ThumbnailFormatPngTypeID -} - -// TypeName returns name of type in TL schema. -func (*ThumbnailFormatPng) TypeName() string { - return "thumbnailFormatPng" -} - -// TypeInfo returns info about TL type. -func (t *ThumbnailFormatPng) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "thumbnailFormatPng", - ID: ThumbnailFormatPngTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *ThumbnailFormatPng) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatPng#5e0697f5 as nil") - } - b.PutID(ThumbnailFormatPngTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ThumbnailFormatPng) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatPng#5e0697f5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *ThumbnailFormatPng) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatPng#5e0697f5 to nil") - } - if err := b.ConsumeID(ThumbnailFormatPngTypeID); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatPng#5e0697f5: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ThumbnailFormatPng) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatPng#5e0697f5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThumbnailFormatPng) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatPng#5e0697f5 as nil") - } - b.ObjStart() - b.PutID("thumbnailFormatPng") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThumbnailFormatPng) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatPng#5e0697f5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("thumbnailFormatPng"); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatPng#5e0697f5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ThumbnailFormatTgs represents TL type `thumbnailFormatTgs#4e694852`. -type ThumbnailFormatTgs struct { -} - -// ThumbnailFormatTgsTypeID is TL type id of ThumbnailFormatTgs. -const ThumbnailFormatTgsTypeID = 0x4e694852 - -// construct implements constructor of ThumbnailFormatClass. -func (t ThumbnailFormatTgs) construct() ThumbnailFormatClass { return &t } - -// Ensuring interfaces in compile-time for ThumbnailFormatTgs. -var ( - _ bin.Encoder = &ThumbnailFormatTgs{} - _ bin.Decoder = &ThumbnailFormatTgs{} - _ bin.BareEncoder = &ThumbnailFormatTgs{} - _ bin.BareDecoder = &ThumbnailFormatTgs{} - - _ ThumbnailFormatClass = &ThumbnailFormatTgs{} -) - -func (t *ThumbnailFormatTgs) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *ThumbnailFormatTgs) String() string { - if t == nil { - return "ThumbnailFormatTgs(nil)" - } - type Alias ThumbnailFormatTgs - return fmt.Sprintf("ThumbnailFormatTgs%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThumbnailFormatTgs) TypeID() uint32 { - return ThumbnailFormatTgsTypeID -} - -// TypeName returns name of type in TL schema. -func (*ThumbnailFormatTgs) TypeName() string { - return "thumbnailFormatTgs" -} - -// TypeInfo returns info about TL type. -func (t *ThumbnailFormatTgs) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "thumbnailFormatTgs", - ID: ThumbnailFormatTgsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *ThumbnailFormatTgs) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatTgs#4e694852 as nil") - } - b.PutID(ThumbnailFormatTgsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ThumbnailFormatTgs) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatTgs#4e694852 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *ThumbnailFormatTgs) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatTgs#4e694852 to nil") - } - if err := b.ConsumeID(ThumbnailFormatTgsTypeID); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatTgs#4e694852: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ThumbnailFormatTgs) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatTgs#4e694852 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThumbnailFormatTgs) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatTgs#4e694852 as nil") - } - b.ObjStart() - b.PutID("thumbnailFormatTgs") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThumbnailFormatTgs) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatTgs#4e694852 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("thumbnailFormatTgs"); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatTgs#4e694852: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ThumbnailFormatWebm represents TL type `thumbnailFormatWebm#d8a7e727`. -type ThumbnailFormatWebm struct { -} - -// ThumbnailFormatWebmTypeID is TL type id of ThumbnailFormatWebm. -const ThumbnailFormatWebmTypeID = 0xd8a7e727 - -// construct implements constructor of ThumbnailFormatClass. -func (t ThumbnailFormatWebm) construct() ThumbnailFormatClass { return &t } - -// Ensuring interfaces in compile-time for ThumbnailFormatWebm. -var ( - _ bin.Encoder = &ThumbnailFormatWebm{} - _ bin.Decoder = &ThumbnailFormatWebm{} - _ bin.BareEncoder = &ThumbnailFormatWebm{} - _ bin.BareDecoder = &ThumbnailFormatWebm{} - - _ ThumbnailFormatClass = &ThumbnailFormatWebm{} -) - -func (t *ThumbnailFormatWebm) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *ThumbnailFormatWebm) String() string { - if t == nil { - return "ThumbnailFormatWebm(nil)" - } - type Alias ThumbnailFormatWebm - return fmt.Sprintf("ThumbnailFormatWebm%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThumbnailFormatWebm) TypeID() uint32 { - return ThumbnailFormatWebmTypeID -} - -// TypeName returns name of type in TL schema. -func (*ThumbnailFormatWebm) TypeName() string { - return "thumbnailFormatWebm" -} - -// TypeInfo returns info about TL type. -func (t *ThumbnailFormatWebm) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "thumbnailFormatWebm", - ID: ThumbnailFormatWebmTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *ThumbnailFormatWebm) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatWebm#d8a7e727 as nil") - } - b.PutID(ThumbnailFormatWebmTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ThumbnailFormatWebm) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatWebm#d8a7e727 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *ThumbnailFormatWebm) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatWebm#d8a7e727 to nil") - } - if err := b.ConsumeID(ThumbnailFormatWebmTypeID); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatWebm#d8a7e727: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ThumbnailFormatWebm) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatWebm#d8a7e727 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThumbnailFormatWebm) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatWebm#d8a7e727 as nil") - } - b.ObjStart() - b.PutID("thumbnailFormatWebm") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThumbnailFormatWebm) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatWebm#d8a7e727 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("thumbnailFormatWebm"); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatWebm#d8a7e727: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ThumbnailFormatWebp represents TL type `thumbnailFormatWebp#fcce4c12`. -type ThumbnailFormatWebp struct { -} - -// ThumbnailFormatWebpTypeID is TL type id of ThumbnailFormatWebp. -const ThumbnailFormatWebpTypeID = 0xfcce4c12 - -// construct implements constructor of ThumbnailFormatClass. -func (t ThumbnailFormatWebp) construct() ThumbnailFormatClass { return &t } - -// Ensuring interfaces in compile-time for ThumbnailFormatWebp. -var ( - _ bin.Encoder = &ThumbnailFormatWebp{} - _ bin.Decoder = &ThumbnailFormatWebp{} - _ bin.BareEncoder = &ThumbnailFormatWebp{} - _ bin.BareDecoder = &ThumbnailFormatWebp{} - - _ ThumbnailFormatClass = &ThumbnailFormatWebp{} -) - -func (t *ThumbnailFormatWebp) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *ThumbnailFormatWebp) String() string { - if t == nil { - return "ThumbnailFormatWebp(nil)" - } - type Alias ThumbnailFormatWebp - return fmt.Sprintf("ThumbnailFormatWebp%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ThumbnailFormatWebp) TypeID() uint32 { - return ThumbnailFormatWebpTypeID -} - -// TypeName returns name of type in TL schema. -func (*ThumbnailFormatWebp) TypeName() string { - return "thumbnailFormatWebp" -} - -// TypeInfo returns info about TL type. -func (t *ThumbnailFormatWebp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "thumbnailFormatWebp", - ID: ThumbnailFormatWebpTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *ThumbnailFormatWebp) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatWebp#fcce4c12 as nil") - } - b.PutID(ThumbnailFormatWebpTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ThumbnailFormatWebp) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatWebp#fcce4c12 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *ThumbnailFormatWebp) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatWebp#fcce4c12 to nil") - } - if err := b.ConsumeID(ThumbnailFormatWebpTypeID); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatWebp#fcce4c12: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ThumbnailFormatWebp) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatWebp#fcce4c12 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ThumbnailFormatWebp) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode thumbnailFormatWebp#fcce4c12 as nil") - } - b.ObjStart() - b.PutID("thumbnailFormatWebp") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ThumbnailFormatWebp) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode thumbnailFormatWebp#fcce4c12 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("thumbnailFormatWebp"); err != nil { - return fmt.Errorf("unable to decode thumbnailFormatWebp#fcce4c12: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// ThumbnailFormatClassName is schema name of ThumbnailFormatClass. -const ThumbnailFormatClassName = "ThumbnailFormat" - -// ThumbnailFormatClass represents ThumbnailFormat generic type. -// -// Example: -// -// g, err := tdapi.DecodeThumbnailFormat(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.ThumbnailFormatJpeg: // thumbnailFormatJpeg#d90c5488 -// case *tdapi.ThumbnailFormatGif: // thumbnailFormatGif#4aa3258a -// case *tdapi.ThumbnailFormatMpeg4: // thumbnailFormatMpeg4#109b57fe -// case *tdapi.ThumbnailFormatPng: // thumbnailFormatPng#5e0697f5 -// case *tdapi.ThumbnailFormatTgs: // thumbnailFormatTgs#4e694852 -// case *tdapi.ThumbnailFormatWebm: // thumbnailFormatWebm#d8a7e727 -// case *tdapi.ThumbnailFormatWebp: // thumbnailFormatWebp#fcce4c12 -// default: panic(v) -// } -type ThumbnailFormatClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() ThumbnailFormatClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeThumbnailFormat implements binary de-serialization for ThumbnailFormatClass. -func DecodeThumbnailFormat(buf *bin.Buffer) (ThumbnailFormatClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case ThumbnailFormatJpegTypeID: - // Decoding thumbnailFormatJpeg#d90c5488. - v := ThumbnailFormatJpeg{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case ThumbnailFormatGifTypeID: - // Decoding thumbnailFormatGif#4aa3258a. - v := ThumbnailFormatGif{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case ThumbnailFormatMpeg4TypeID: - // Decoding thumbnailFormatMpeg4#109b57fe. - v := ThumbnailFormatMpeg4{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case ThumbnailFormatPngTypeID: - // Decoding thumbnailFormatPng#5e0697f5. - v := ThumbnailFormatPng{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case ThumbnailFormatTgsTypeID: - // Decoding thumbnailFormatTgs#4e694852. - v := ThumbnailFormatTgs{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case ThumbnailFormatWebmTypeID: - // Decoding thumbnailFormatWebm#d8a7e727. - v := ThumbnailFormatWebm{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case ThumbnailFormatWebpTypeID: - // Decoding thumbnailFormatWebp#fcce4c12. - v := ThumbnailFormatWebp{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONThumbnailFormat implements binary de-serialization for ThumbnailFormatClass. -func DecodeTDLibJSONThumbnailFormat(buf tdjson.Decoder) (ThumbnailFormatClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "thumbnailFormatJpeg": - // Decoding thumbnailFormatJpeg#d90c5488. - v := ThumbnailFormatJpeg{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case "thumbnailFormatGif": - // Decoding thumbnailFormatGif#4aa3258a. - v := ThumbnailFormatGif{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case "thumbnailFormatMpeg4": - // Decoding thumbnailFormatMpeg4#109b57fe. - v := ThumbnailFormatMpeg4{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case "thumbnailFormatPng": - // Decoding thumbnailFormatPng#5e0697f5. - v := ThumbnailFormatPng{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case "thumbnailFormatTgs": - // Decoding thumbnailFormatTgs#4e694852. - v := ThumbnailFormatTgs{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case "thumbnailFormatWebm": - // Decoding thumbnailFormatWebm#d8a7e727. - v := ThumbnailFormatWebm{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - case "thumbnailFormatWebp": - // Decoding thumbnailFormatWebp#fcce4c12. - v := ThumbnailFormatWebp{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode ThumbnailFormatClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// ThumbnailFormat boxes the ThumbnailFormatClass providing a helper. -type ThumbnailFormatBox struct { - ThumbnailFormat ThumbnailFormatClass -} - -// Decode implements bin.Decoder for ThumbnailFormatBox. -func (b *ThumbnailFormatBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode ThumbnailFormatBox to nil") - } - v, err := DecodeThumbnailFormat(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ThumbnailFormat = v - return nil -} - -// Encode implements bin.Encode for ThumbnailFormatBox. -func (b *ThumbnailFormatBox) Encode(buf *bin.Buffer) error { - if b == nil || b.ThumbnailFormat == nil { - return fmt.Errorf("unable to encode ThumbnailFormatClass as nil") - } - return b.ThumbnailFormat.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for ThumbnailFormatBox. -func (b *ThumbnailFormatBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode ThumbnailFormatBox to nil") - } - v, err := DecodeTDLibJSONThumbnailFormat(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.ThumbnailFormat = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for ThumbnailFormatBox. -func (b *ThumbnailFormatBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.ThumbnailFormat == nil { - return fmt.Errorf("unable to encode ThumbnailFormatClass as nil") - } - return b.ThumbnailFormat.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_thumbnail_gen.go b/tdapi/tl_thumbnail_gen.go deleted file mode 100644 index a340f6f0b..000000000 --- a/tdapi/tl_thumbnail_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Thumbnail represents TL type `thumbnail#4a1ae06b`. -type Thumbnail struct { - // Thumbnail format - Format ThumbnailFormatClass - // Thumbnail width - Width int32 - // Thumbnail height - Height int32 - // The thumbnail - File File -} - -// ThumbnailTypeID is TL type id of Thumbnail. -const ThumbnailTypeID = 0x4a1ae06b - -// Ensuring interfaces in compile-time for Thumbnail. -var ( - _ bin.Encoder = &Thumbnail{} - _ bin.Decoder = &Thumbnail{} - _ bin.BareEncoder = &Thumbnail{} - _ bin.BareDecoder = &Thumbnail{} -) - -func (t *Thumbnail) Zero() bool { - if t == nil { - return true - } - if !(t.Format == nil) { - return false - } - if !(t.Width == 0) { - return false - } - if !(t.Height == 0) { - return false - } - if !(t.File.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *Thumbnail) String() string { - if t == nil { - return "Thumbnail(nil)" - } - type Alias Thumbnail - return fmt.Sprintf("Thumbnail%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Thumbnail) TypeID() uint32 { - return ThumbnailTypeID -} - -// TypeName returns name of type in TL schema. -func (*Thumbnail) TypeName() string { - return "thumbnail" -} - -// TypeInfo returns info about TL type. -func (t *Thumbnail) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "thumbnail", - ID: ThumbnailTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Format", - SchemaName: "format", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "File", - SchemaName: "file", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *Thumbnail) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnail#4a1ae06b as nil") - } - b.PutID(ThumbnailTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *Thumbnail) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode thumbnail#4a1ae06b as nil") - } - if t.Format == nil { - return fmt.Errorf("unable to encode thumbnail#4a1ae06b: field format is nil") - } - if err := t.Format.Encode(b); err != nil { - return fmt.Errorf("unable to encode thumbnail#4a1ae06b: field format: %w", err) - } - b.PutInt32(t.Width) - b.PutInt32(t.Height) - if err := t.File.Encode(b); err != nil { - return fmt.Errorf("unable to encode thumbnail#4a1ae06b: field file: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (t *Thumbnail) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnail#4a1ae06b to nil") - } - if err := b.ConsumeID(ThumbnailTypeID); err != nil { - return fmt.Errorf("unable to decode thumbnail#4a1ae06b: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *Thumbnail) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode thumbnail#4a1ae06b to nil") - } - { - value, err := DecodeThumbnailFormat(b) - if err != nil { - return fmt.Errorf("unable to decode thumbnail#4a1ae06b: field format: %w", err) - } - t.Format = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode thumbnail#4a1ae06b: field width: %w", err) - } - t.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode thumbnail#4a1ae06b: field height: %w", err) - } - t.Height = value - } - { - if err := t.File.Decode(b); err != nil { - return fmt.Errorf("unable to decode thumbnail#4a1ae06b: field file: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *Thumbnail) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode thumbnail#4a1ae06b as nil") - } - b.ObjStart() - b.PutID("thumbnail") - b.Comma() - b.FieldStart("format") - if t.Format == nil { - return fmt.Errorf("unable to encode thumbnail#4a1ae06b: field format is nil") - } - if err := t.Format.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode thumbnail#4a1ae06b: field format: %w", err) - } - b.Comma() - b.FieldStart("width") - b.PutInt32(t.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(t.Height) - b.Comma() - b.FieldStart("file") - if err := t.File.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode thumbnail#4a1ae06b: field file: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *Thumbnail) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode thumbnail#4a1ae06b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("thumbnail"); err != nil { - return fmt.Errorf("unable to decode thumbnail#4a1ae06b: %w", err) - } - case "format": - value, err := DecodeTDLibJSONThumbnailFormat(b) - if err != nil { - return fmt.Errorf("unable to decode thumbnail#4a1ae06b: field format: %w", err) - } - t.Format = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode thumbnail#4a1ae06b: field width: %w", err) - } - t.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode thumbnail#4a1ae06b: field height: %w", err) - } - t.Height = value - case "file": - if err := t.File.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode thumbnail#4a1ae06b: field file: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFormat returns value of Format field. -func (t *Thumbnail) GetFormat() (value ThumbnailFormatClass) { - if t == nil { - return - } - return t.Format -} - -// GetWidth returns value of Width field. -func (t *Thumbnail) GetWidth() (value int32) { - if t == nil { - return - } - return t.Width -} - -// GetHeight returns value of Height field. -func (t *Thumbnail) GetHeight() (value int32) { - if t == nil { - return - } - return t.Height -} - -// GetFile returns value of File field. -func (t *Thumbnail) GetFile() (value File) { - if t == nil { - return - } - return t.File -} diff --git a/tdapi/tl_time_zone_gen.go b/tdapi/tl_time_zone_gen.go deleted file mode 100644 index 50442d6c1..000000000 --- a/tdapi/tl_time_zone_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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#b919f2dd`. -type TimeZone struct { - // Unique time zone identifier - ID string - // Time zone name - Name string - // Current UTC time offset for the time zone - UtcTimeOffset int32 -} - -// TimeZoneTypeID is TL type id of TimeZone. -const TimeZoneTypeID = 0xb919f2dd - -// 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.UtcTimeOffset == 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)) -} - -// 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: "UtcTimeOffset", - SchemaName: "utc_time_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#b919f2dd 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#b919f2dd as nil") - } - b.PutString(t.ID) - b.PutString(t.Name) - b.PutInt32(t.UtcTimeOffset) - return nil -} - -// Decode implements bin.Decoder. -func (t *TimeZone) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode timeZone#b919f2dd to nil") - } - if err := b.ConsumeID(TimeZoneTypeID); err != nil { - return fmt.Errorf("unable to decode timeZone#b919f2dd: %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#b919f2dd to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode timeZone#b919f2dd: field id: %w", err) - } - t.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode timeZone#b919f2dd: field name: %w", err) - } - t.Name = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode timeZone#b919f2dd: field utc_time_offset: %w", err) - } - t.UtcTimeOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TimeZone) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode timeZone#b919f2dd as nil") - } - b.ObjStart() - b.PutID("timeZone") - b.Comma() - b.FieldStart("id") - b.PutString(t.ID) - b.Comma() - b.FieldStart("name") - b.PutString(t.Name) - b.Comma() - b.FieldStart("utc_time_offset") - b.PutInt32(t.UtcTimeOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TimeZone) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode timeZone#b919f2dd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("timeZone"); err != nil { - return fmt.Errorf("unable to decode timeZone#b919f2dd: %w", err) - } - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode timeZone#b919f2dd: field id: %w", err) - } - t.ID = value - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode timeZone#b919f2dd: field name: %w", err) - } - t.Name = value - case "utc_time_offset": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode timeZone#b919f2dd: field utc_time_offset: %w", err) - } - t.UtcTimeOffset = value - default: - return b.Skip() - } - 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 -} - -// GetUtcTimeOffset returns value of UtcTimeOffset field. -func (t *TimeZone) GetUtcTimeOffset() (value int32) { - if t == nil { - return - } - return t.UtcTimeOffset -} diff --git a/tdapi/tl_time_zones_gen.go b/tdapi/tl_time_zones_gen.go deleted file mode 100644 index e7ce81187..000000000 --- a/tdapi/tl_time_zones_gen.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TimeZones represents TL type `timeZones#7c4881b9`. -type TimeZones struct { - // A list of time zones - TimeZones []TimeZone -} - -// TimeZonesTypeID is TL type id of TimeZones. -const TimeZonesTypeID = 0x7c4881b9 - -// Ensuring interfaces in compile-time for TimeZones. -var ( - _ bin.Encoder = &TimeZones{} - _ bin.Decoder = &TimeZones{} - _ bin.BareEncoder = &TimeZones{} - _ bin.BareDecoder = &TimeZones{} -) - -func (t *TimeZones) Zero() bool { - if t == nil { - return true - } - if !(t.TimeZones == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TimeZones) String() string { - if t == nil { - return "TimeZones(nil)" - } - type Alias TimeZones - return fmt.Sprintf("TimeZones%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TimeZones) TypeID() uint32 { - return TimeZonesTypeID -} - -// TypeName returns name of type in TL schema. -func (*TimeZones) TypeName() string { - return "timeZones" -} - -// TypeInfo returns info about TL type. -func (t *TimeZones) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "timeZones", - ID: TimeZonesTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TimeZones", - SchemaName: "time_zones", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TimeZones) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode timeZones#7c4881b9 as nil") - } - b.PutID(TimeZonesTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TimeZones) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode timeZones#7c4881b9 as nil") - } - b.PutInt(len(t.TimeZones)) - for idx, v := range t.TimeZones { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare timeZones#7c4881b9: field time_zones element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TimeZones) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode timeZones#7c4881b9 to nil") - } - if err := b.ConsumeID(TimeZonesTypeID); err != nil { - return fmt.Errorf("unable to decode timeZones#7c4881b9: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TimeZones) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode timeZones#7c4881b9 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode timeZones#7c4881b9: field time_zones: %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.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare timeZones#7c4881b9: field time_zones: %w", err) - } - t.TimeZones = append(t.TimeZones, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TimeZones) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode timeZones#7c4881b9 as nil") - } - b.ObjStart() - b.PutID("timeZones") - b.Comma() - b.FieldStart("time_zones") - b.ArrStart() - for idx, v := range t.TimeZones { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode timeZones#7c4881b9: field time_zones element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TimeZones) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode timeZones#7c4881b9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("timeZones"); err != nil { - return fmt.Errorf("unable to decode timeZones#7c4881b9: %w", err) - } - case "time_zones": - if err := b.Arr(func(b tdjson.Decoder) error { - var value TimeZone - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode timeZones#7c4881b9: field time_zones: %w", err) - } - t.TimeZones = append(t.TimeZones, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode timeZones#7c4881b9: field time_zones: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTimeZones returns value of TimeZones field. -func (t *TimeZones) GetTimeZones() (value []TimeZone) { - if t == nil { - return - } - return t.TimeZones -} diff --git a/tdapi/tl_toggle_all_downloads_are_paused_gen.go b/tdapi/tl_toggle_all_downloads_are_paused_gen.go deleted file mode 100644 index f67d6fa03..000000000 --- a/tdapi/tl_toggle_all_downloads_are_paused_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleAllDownloadsArePausedRequest represents TL type `toggleAllDownloadsArePaused#4a989002`. -type ToggleAllDownloadsArePausedRequest struct { - // Pass true to pause all downloads; pass false to unpause them - ArePaused bool -} - -// ToggleAllDownloadsArePausedRequestTypeID is TL type id of ToggleAllDownloadsArePausedRequest. -const ToggleAllDownloadsArePausedRequestTypeID = 0x4a989002 - -// Ensuring interfaces in compile-time for ToggleAllDownloadsArePausedRequest. -var ( - _ bin.Encoder = &ToggleAllDownloadsArePausedRequest{} - _ bin.Decoder = &ToggleAllDownloadsArePausedRequest{} - _ bin.BareEncoder = &ToggleAllDownloadsArePausedRequest{} - _ bin.BareDecoder = &ToggleAllDownloadsArePausedRequest{} -) - -func (t *ToggleAllDownloadsArePausedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ArePaused == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleAllDownloadsArePausedRequest) String() string { - if t == nil { - return "ToggleAllDownloadsArePausedRequest(nil)" - } - type Alias ToggleAllDownloadsArePausedRequest - return fmt.Sprintf("ToggleAllDownloadsArePausedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleAllDownloadsArePausedRequest) TypeID() uint32 { - return ToggleAllDownloadsArePausedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleAllDownloadsArePausedRequest) TypeName() string { - return "toggleAllDownloadsArePaused" -} - -// TypeInfo returns info about TL type. -func (t *ToggleAllDownloadsArePausedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleAllDownloadsArePaused", - ID: ToggleAllDownloadsArePausedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ArePaused", - SchemaName: "are_paused", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleAllDownloadsArePausedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleAllDownloadsArePaused#4a989002 as nil") - } - b.PutID(ToggleAllDownloadsArePausedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleAllDownloadsArePausedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleAllDownloadsArePaused#4a989002 as nil") - } - b.PutBool(t.ArePaused) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleAllDownloadsArePausedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleAllDownloadsArePaused#4a989002 to nil") - } - if err := b.ConsumeID(ToggleAllDownloadsArePausedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleAllDownloadsArePaused#4a989002: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleAllDownloadsArePausedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleAllDownloadsArePaused#4a989002 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleAllDownloadsArePaused#4a989002: field are_paused: %w", err) - } - t.ArePaused = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleAllDownloadsArePausedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleAllDownloadsArePaused#4a989002 as nil") - } - b.ObjStart() - b.PutID("toggleAllDownloadsArePaused") - b.Comma() - b.FieldStart("are_paused") - b.PutBool(t.ArePaused) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleAllDownloadsArePausedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleAllDownloadsArePaused#4a989002 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleAllDownloadsArePaused"); err != nil { - return fmt.Errorf("unable to decode toggleAllDownloadsArePaused#4a989002: %w", err) - } - case "are_paused": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleAllDownloadsArePaused#4a989002: field are_paused: %w", err) - } - t.ArePaused = value - default: - return b.Skip() - } - return nil - }) -} - -// GetArePaused returns value of ArePaused field. -func (t *ToggleAllDownloadsArePausedRequest) GetArePaused() (value bool) { - if t == nil { - return - } - return t.ArePaused -} - -// ToggleAllDownloadsArePaused invokes method toggleAllDownloadsArePaused#4a989002 returning error if any. -func (c *Client) ToggleAllDownloadsArePaused(ctx context.Context, arepaused bool) error { - var ok Ok - - request := &ToggleAllDownloadsArePausedRequest{ - ArePaused: arepaused, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_bot_can_manage_emoji_status_gen.go b/tdapi/tl_toggle_bot_can_manage_emoji_status_gen.go deleted file mode 100644 index 1ca529f33..000000000 --- a/tdapi/tl_toggle_bot_can_manage_emoji_status_gen.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleBotCanManageEmojiStatusRequest represents TL type `toggleBotCanManageEmojiStatus#251a881a`. -type ToggleBotCanManageEmojiStatusRequest struct { - // User identifier of the bot - BotUserID int64 - // Pass true if the bot is allowed to change emoji status of the user; pass false - // otherwise - CanManageEmojiStatus bool -} - -// ToggleBotCanManageEmojiStatusRequestTypeID is TL type id of ToggleBotCanManageEmojiStatusRequest. -const ToggleBotCanManageEmojiStatusRequestTypeID = 0x251a881a - -// Ensuring interfaces in compile-time for ToggleBotCanManageEmojiStatusRequest. -var ( - _ bin.Encoder = &ToggleBotCanManageEmojiStatusRequest{} - _ bin.Decoder = &ToggleBotCanManageEmojiStatusRequest{} - _ bin.BareEncoder = &ToggleBotCanManageEmojiStatusRequest{} - _ bin.BareDecoder = &ToggleBotCanManageEmojiStatusRequest{} -) - -func (t *ToggleBotCanManageEmojiStatusRequest) Zero() bool { - if t == nil { - return true - } - if !(t.BotUserID == 0) { - return false - } - if !(t.CanManageEmojiStatus == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleBotCanManageEmojiStatusRequest) String() string { - if t == nil { - return "ToggleBotCanManageEmojiStatusRequest(nil)" - } - type Alias ToggleBotCanManageEmojiStatusRequest - return fmt.Sprintf("ToggleBotCanManageEmojiStatusRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleBotCanManageEmojiStatusRequest) TypeID() uint32 { - return ToggleBotCanManageEmojiStatusRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleBotCanManageEmojiStatusRequest) TypeName() string { - return "toggleBotCanManageEmojiStatus" -} - -// TypeInfo returns info about TL type. -func (t *ToggleBotCanManageEmojiStatusRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleBotCanManageEmojiStatus", - ID: ToggleBotCanManageEmojiStatusRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "CanManageEmojiStatus", - SchemaName: "can_manage_emoji_status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleBotCanManageEmojiStatusRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleBotCanManageEmojiStatus#251a881a as nil") - } - b.PutID(ToggleBotCanManageEmojiStatusRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleBotCanManageEmojiStatusRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleBotCanManageEmojiStatus#251a881a as nil") - } - b.PutInt53(t.BotUserID) - b.PutBool(t.CanManageEmojiStatus) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleBotCanManageEmojiStatusRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleBotCanManageEmojiStatus#251a881a to nil") - } - if err := b.ConsumeID(ToggleBotCanManageEmojiStatusRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleBotCanManageEmojiStatus#251a881a: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleBotCanManageEmojiStatusRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleBotCanManageEmojiStatus#251a881a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleBotCanManageEmojiStatus#251a881a: field bot_user_id: %w", err) - } - t.BotUserID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleBotCanManageEmojiStatus#251a881a: field can_manage_emoji_status: %w", err) - } - t.CanManageEmojiStatus = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleBotCanManageEmojiStatusRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleBotCanManageEmojiStatus#251a881a as nil") - } - b.ObjStart() - b.PutID("toggleBotCanManageEmojiStatus") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(t.BotUserID) - b.Comma() - b.FieldStart("can_manage_emoji_status") - b.PutBool(t.CanManageEmojiStatus) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleBotCanManageEmojiStatusRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleBotCanManageEmojiStatus#251a881a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleBotCanManageEmojiStatus"); err != nil { - return fmt.Errorf("unable to decode toggleBotCanManageEmojiStatus#251a881a: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleBotCanManageEmojiStatus#251a881a: field bot_user_id: %w", err) - } - t.BotUserID = value - case "can_manage_emoji_status": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleBotCanManageEmojiStatus#251a881a: field can_manage_emoji_status: %w", err) - } - t.CanManageEmojiStatus = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (t *ToggleBotCanManageEmojiStatusRequest) GetBotUserID() (value int64) { - if t == nil { - return - } - return t.BotUserID -} - -// GetCanManageEmojiStatus returns value of CanManageEmojiStatus field. -func (t *ToggleBotCanManageEmojiStatusRequest) GetCanManageEmojiStatus() (value bool) { - if t == nil { - return - } - return t.CanManageEmojiStatus -} - -// ToggleBotCanManageEmojiStatus invokes method toggleBotCanManageEmojiStatus#251a881a returning error if any. -func (c *Client) ToggleBotCanManageEmojiStatus(ctx context.Context, request *ToggleBotCanManageEmojiStatusRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_bot_is_added_to_attachment_menu_gen.go b/tdapi/tl_toggle_bot_is_added_to_attachment_menu_gen.go deleted file mode 100644 index b752fd956..000000000 --- a/tdapi/tl_toggle_bot_is_added_to_attachment_menu_gen.go +++ /dev/null @@ -1,273 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleBotIsAddedToAttachmentMenuRequest represents TL type `toggleBotIsAddedToAttachmentMenu#8e59de9a`. -type ToggleBotIsAddedToAttachmentMenuRequest struct { - // Bot's user identifier - BotUserID int64 - // Pass true to add the bot to attachment menu; pass false to remove the bot from - // attachment menu - IsAdded bool - // Pass true if the current user allowed the bot to send them messages. Ignored if - // is_added is false - AllowWriteAccess bool -} - -// ToggleBotIsAddedToAttachmentMenuRequestTypeID is TL type id of ToggleBotIsAddedToAttachmentMenuRequest. -const ToggleBotIsAddedToAttachmentMenuRequestTypeID = 0x8e59de9a - -// Ensuring interfaces in compile-time for ToggleBotIsAddedToAttachmentMenuRequest. -var ( - _ bin.Encoder = &ToggleBotIsAddedToAttachmentMenuRequest{} - _ bin.Decoder = &ToggleBotIsAddedToAttachmentMenuRequest{} - _ bin.BareEncoder = &ToggleBotIsAddedToAttachmentMenuRequest{} - _ bin.BareDecoder = &ToggleBotIsAddedToAttachmentMenuRequest{} -) - -func (t *ToggleBotIsAddedToAttachmentMenuRequest) Zero() bool { - if t == nil { - return true - } - if !(t.BotUserID == 0) { - return false - } - if !(t.IsAdded == false) { - return false - } - if !(t.AllowWriteAccess == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleBotIsAddedToAttachmentMenuRequest) String() string { - if t == nil { - return "ToggleBotIsAddedToAttachmentMenuRequest(nil)" - } - type Alias ToggleBotIsAddedToAttachmentMenuRequest - return fmt.Sprintf("ToggleBotIsAddedToAttachmentMenuRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleBotIsAddedToAttachmentMenuRequest) TypeID() uint32 { - return ToggleBotIsAddedToAttachmentMenuRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleBotIsAddedToAttachmentMenuRequest) TypeName() string { - return "toggleBotIsAddedToAttachmentMenu" -} - -// TypeInfo returns info about TL type. -func (t *ToggleBotIsAddedToAttachmentMenuRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleBotIsAddedToAttachmentMenu", - ID: ToggleBotIsAddedToAttachmentMenuRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "IsAdded", - SchemaName: "is_added", - }, - { - Name: "AllowWriteAccess", - SchemaName: "allow_write_access", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleBotIsAddedToAttachmentMenuRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleBotIsAddedToAttachmentMenu#8e59de9a as nil") - } - b.PutID(ToggleBotIsAddedToAttachmentMenuRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleBotIsAddedToAttachmentMenuRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleBotIsAddedToAttachmentMenu#8e59de9a as nil") - } - b.PutInt53(t.BotUserID) - b.PutBool(t.IsAdded) - b.PutBool(t.AllowWriteAccess) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleBotIsAddedToAttachmentMenuRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleBotIsAddedToAttachmentMenu#8e59de9a to nil") - } - if err := b.ConsumeID(ToggleBotIsAddedToAttachmentMenuRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleBotIsAddedToAttachmentMenu#8e59de9a: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleBotIsAddedToAttachmentMenuRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleBotIsAddedToAttachmentMenu#8e59de9a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleBotIsAddedToAttachmentMenu#8e59de9a: field bot_user_id: %w", err) - } - t.BotUserID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleBotIsAddedToAttachmentMenu#8e59de9a: field is_added: %w", err) - } - t.IsAdded = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleBotIsAddedToAttachmentMenu#8e59de9a: field allow_write_access: %w", err) - } - t.AllowWriteAccess = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleBotIsAddedToAttachmentMenuRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleBotIsAddedToAttachmentMenu#8e59de9a as nil") - } - b.ObjStart() - b.PutID("toggleBotIsAddedToAttachmentMenu") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(t.BotUserID) - b.Comma() - b.FieldStart("is_added") - b.PutBool(t.IsAdded) - b.Comma() - b.FieldStart("allow_write_access") - b.PutBool(t.AllowWriteAccess) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleBotIsAddedToAttachmentMenuRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleBotIsAddedToAttachmentMenu#8e59de9a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleBotIsAddedToAttachmentMenu"); err != nil { - return fmt.Errorf("unable to decode toggleBotIsAddedToAttachmentMenu#8e59de9a: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleBotIsAddedToAttachmentMenu#8e59de9a: field bot_user_id: %w", err) - } - t.BotUserID = value - case "is_added": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleBotIsAddedToAttachmentMenu#8e59de9a: field is_added: %w", err) - } - t.IsAdded = value - case "allow_write_access": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleBotIsAddedToAttachmentMenu#8e59de9a: field allow_write_access: %w", err) - } - t.AllowWriteAccess = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (t *ToggleBotIsAddedToAttachmentMenuRequest) GetBotUserID() (value int64) { - if t == nil { - return - } - return t.BotUserID -} - -// GetIsAdded returns value of IsAdded field. -func (t *ToggleBotIsAddedToAttachmentMenuRequest) GetIsAdded() (value bool) { - if t == nil { - return - } - return t.IsAdded -} - -// GetAllowWriteAccess returns value of AllowWriteAccess field. -func (t *ToggleBotIsAddedToAttachmentMenuRequest) GetAllowWriteAccess() (value bool) { - if t == nil { - return - } - return t.AllowWriteAccess -} - -// ToggleBotIsAddedToAttachmentMenu invokes method toggleBotIsAddedToAttachmentMenu#8e59de9a returning error if any. -func (c *Client) ToggleBotIsAddedToAttachmentMenu(ctx context.Context, request *ToggleBotIsAddedToAttachmentMenuRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_bot_username_is_active_gen.go b/tdapi/tl_toggle_bot_username_is_active_gen.go deleted file mode 100644 index 0a0f698c6..000000000 --- a/tdapi/tl_toggle_bot_username_is_active_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleBotUsernameIsActiveRequest represents TL type `toggleBotUsernameIsActive#79639409`. -type ToggleBotUsernameIsActiveRequest struct { - // Identifier of the target bot - BotUserID int64 - // The username to change - Username string - // Pass true to activate the username; pass false to disable it - IsActive bool -} - -// ToggleBotUsernameIsActiveRequestTypeID is TL type id of ToggleBotUsernameIsActiveRequest. -const ToggleBotUsernameIsActiveRequestTypeID = 0x79639409 - -// Ensuring interfaces in compile-time for ToggleBotUsernameIsActiveRequest. -var ( - _ bin.Encoder = &ToggleBotUsernameIsActiveRequest{} - _ bin.Decoder = &ToggleBotUsernameIsActiveRequest{} - _ bin.BareEncoder = &ToggleBotUsernameIsActiveRequest{} - _ bin.BareDecoder = &ToggleBotUsernameIsActiveRequest{} -) - -func (t *ToggleBotUsernameIsActiveRequest) Zero() bool { - if t == nil { - return true - } - if !(t.BotUserID == 0) { - return false - } - if !(t.Username == "") { - return false - } - if !(t.IsActive == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleBotUsernameIsActiveRequest) String() string { - if t == nil { - return "ToggleBotUsernameIsActiveRequest(nil)" - } - type Alias ToggleBotUsernameIsActiveRequest - return fmt.Sprintf("ToggleBotUsernameIsActiveRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleBotUsernameIsActiveRequest) TypeID() uint32 { - return ToggleBotUsernameIsActiveRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleBotUsernameIsActiveRequest) TypeName() string { - return "toggleBotUsernameIsActive" -} - -// TypeInfo returns info about TL type. -func (t *ToggleBotUsernameIsActiveRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleBotUsernameIsActive", - ID: ToggleBotUsernameIsActiveRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BotUserID", - SchemaName: "bot_user_id", - }, - { - Name: "Username", - SchemaName: "username", - }, - { - Name: "IsActive", - SchemaName: "is_active", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleBotUsernameIsActiveRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleBotUsernameIsActive#79639409 as nil") - } - b.PutID(ToggleBotUsernameIsActiveRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleBotUsernameIsActiveRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleBotUsernameIsActive#79639409 as nil") - } - b.PutInt53(t.BotUserID) - b.PutString(t.Username) - b.PutBool(t.IsActive) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleBotUsernameIsActiveRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleBotUsernameIsActive#79639409 to nil") - } - if err := b.ConsumeID(ToggleBotUsernameIsActiveRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleBotUsernameIsActive#79639409: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleBotUsernameIsActiveRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleBotUsernameIsActive#79639409 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleBotUsernameIsActive#79639409: field bot_user_id: %w", err) - } - t.BotUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode toggleBotUsernameIsActive#79639409: field username: %w", err) - } - t.Username = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleBotUsernameIsActive#79639409: field is_active: %w", err) - } - t.IsActive = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleBotUsernameIsActiveRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleBotUsernameIsActive#79639409 as nil") - } - b.ObjStart() - b.PutID("toggleBotUsernameIsActive") - b.Comma() - b.FieldStart("bot_user_id") - b.PutInt53(t.BotUserID) - b.Comma() - b.FieldStart("username") - b.PutString(t.Username) - b.Comma() - b.FieldStart("is_active") - b.PutBool(t.IsActive) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleBotUsernameIsActiveRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleBotUsernameIsActive#79639409 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleBotUsernameIsActive"); err != nil { - return fmt.Errorf("unable to decode toggleBotUsernameIsActive#79639409: %w", err) - } - case "bot_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleBotUsernameIsActive#79639409: field bot_user_id: %w", err) - } - t.BotUserID = value - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode toggleBotUsernameIsActive#79639409: field username: %w", err) - } - t.Username = value - case "is_active": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleBotUsernameIsActive#79639409: field is_active: %w", err) - } - t.IsActive = value - default: - return b.Skip() - } - return nil - }) -} - -// GetBotUserID returns value of BotUserID field. -func (t *ToggleBotUsernameIsActiveRequest) GetBotUserID() (value int64) { - if t == nil { - return - } - return t.BotUserID -} - -// GetUsername returns value of Username field. -func (t *ToggleBotUsernameIsActiveRequest) GetUsername() (value string) { - if t == nil { - return - } - return t.Username -} - -// GetIsActive returns value of IsActive field. -func (t *ToggleBotUsernameIsActiveRequest) GetIsActive() (value bool) { - if t == nil { - return - } - return t.IsActive -} - -// ToggleBotUsernameIsActive invokes method toggleBotUsernameIsActive#79639409 returning error if any. -func (c *Client) ToggleBotUsernameIsActive(ctx context.Context, request *ToggleBotUsernameIsActiveRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_business_connected_bot_chat_is_paused_gen.go b/tdapi/tl_toggle_business_connected_bot_chat_is_paused_gen.go deleted file mode 100644 index 137867a37..000000000 --- a/tdapi/tl_toggle_business_connected_bot_chat_is_paused_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleBusinessConnectedBotChatIsPausedRequest represents TL type `toggleBusinessConnectedBotChatIsPaused#4f364845`. -type ToggleBusinessConnectedBotChatIsPausedRequest struct { - // Chat identifier - ChatID int64 - // Pass true to pause the connected bot in the chat; pass false to resume the bot - IsPaused bool -} - -// ToggleBusinessConnectedBotChatIsPausedRequestTypeID is TL type id of ToggleBusinessConnectedBotChatIsPausedRequest. -const ToggleBusinessConnectedBotChatIsPausedRequestTypeID = 0x4f364845 - -// Ensuring interfaces in compile-time for ToggleBusinessConnectedBotChatIsPausedRequest. -var ( - _ bin.Encoder = &ToggleBusinessConnectedBotChatIsPausedRequest{} - _ bin.Decoder = &ToggleBusinessConnectedBotChatIsPausedRequest{} - _ bin.BareEncoder = &ToggleBusinessConnectedBotChatIsPausedRequest{} - _ bin.BareDecoder = &ToggleBusinessConnectedBotChatIsPausedRequest{} -) - -func (t *ToggleBusinessConnectedBotChatIsPausedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.IsPaused == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleBusinessConnectedBotChatIsPausedRequest) String() string { - if t == nil { - return "ToggleBusinessConnectedBotChatIsPausedRequest(nil)" - } - type Alias ToggleBusinessConnectedBotChatIsPausedRequest - return fmt.Sprintf("ToggleBusinessConnectedBotChatIsPausedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleBusinessConnectedBotChatIsPausedRequest) TypeID() uint32 { - return ToggleBusinessConnectedBotChatIsPausedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleBusinessConnectedBotChatIsPausedRequest) TypeName() string { - return "toggleBusinessConnectedBotChatIsPaused" -} - -// TypeInfo returns info about TL type. -func (t *ToggleBusinessConnectedBotChatIsPausedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleBusinessConnectedBotChatIsPaused", - ID: ToggleBusinessConnectedBotChatIsPausedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "IsPaused", - SchemaName: "is_paused", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleBusinessConnectedBotChatIsPausedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleBusinessConnectedBotChatIsPaused#4f364845 as nil") - } - b.PutID(ToggleBusinessConnectedBotChatIsPausedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleBusinessConnectedBotChatIsPausedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleBusinessConnectedBotChatIsPaused#4f364845 as nil") - } - b.PutInt53(t.ChatID) - b.PutBool(t.IsPaused) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleBusinessConnectedBotChatIsPausedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleBusinessConnectedBotChatIsPaused#4f364845 to nil") - } - if err := b.ConsumeID(ToggleBusinessConnectedBotChatIsPausedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleBusinessConnectedBotChatIsPaused#4f364845: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleBusinessConnectedBotChatIsPausedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleBusinessConnectedBotChatIsPaused#4f364845 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleBusinessConnectedBotChatIsPaused#4f364845: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleBusinessConnectedBotChatIsPaused#4f364845: field is_paused: %w", err) - } - t.IsPaused = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleBusinessConnectedBotChatIsPausedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleBusinessConnectedBotChatIsPaused#4f364845 as nil") - } - b.ObjStart() - b.PutID("toggleBusinessConnectedBotChatIsPaused") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("is_paused") - b.PutBool(t.IsPaused) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleBusinessConnectedBotChatIsPausedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleBusinessConnectedBotChatIsPaused#4f364845 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleBusinessConnectedBotChatIsPaused"); err != nil { - return fmt.Errorf("unable to decode toggleBusinessConnectedBotChatIsPaused#4f364845: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleBusinessConnectedBotChatIsPaused#4f364845: field chat_id: %w", err) - } - t.ChatID = value - case "is_paused": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleBusinessConnectedBotChatIsPaused#4f364845: field is_paused: %w", err) - } - t.IsPaused = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *ToggleBusinessConnectedBotChatIsPausedRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetIsPaused returns value of IsPaused field. -func (t *ToggleBusinessConnectedBotChatIsPausedRequest) GetIsPaused() (value bool) { - if t == nil { - return - } - return t.IsPaused -} - -// ToggleBusinessConnectedBotChatIsPaused invokes method toggleBusinessConnectedBotChatIsPaused#4f364845 returning error if any. -func (c *Client) ToggleBusinessConnectedBotChatIsPaused(ctx context.Context, request *ToggleBusinessConnectedBotChatIsPausedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_chat_default_disable_notification_gen.go b/tdapi/tl_toggle_chat_default_disable_notification_gen.go deleted file mode 100644 index d255b9760..000000000 --- a/tdapi/tl_toggle_chat_default_disable_notification_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleChatDefaultDisableNotificationRequest represents TL type `toggleChatDefaultDisableNotification#12c36012`. -type ToggleChatDefaultDisableNotificationRequest struct { - // Chat identifier - ChatID int64 - // New value of default_disable_notification - DefaultDisableNotification bool -} - -// ToggleChatDefaultDisableNotificationRequestTypeID is TL type id of ToggleChatDefaultDisableNotificationRequest. -const ToggleChatDefaultDisableNotificationRequestTypeID = 0x12c36012 - -// Ensuring interfaces in compile-time for ToggleChatDefaultDisableNotificationRequest. -var ( - _ bin.Encoder = &ToggleChatDefaultDisableNotificationRequest{} - _ bin.Decoder = &ToggleChatDefaultDisableNotificationRequest{} - _ bin.BareEncoder = &ToggleChatDefaultDisableNotificationRequest{} - _ bin.BareDecoder = &ToggleChatDefaultDisableNotificationRequest{} -) - -func (t *ToggleChatDefaultDisableNotificationRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.DefaultDisableNotification == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleChatDefaultDisableNotificationRequest) String() string { - if t == nil { - return "ToggleChatDefaultDisableNotificationRequest(nil)" - } - type Alias ToggleChatDefaultDisableNotificationRequest - return fmt.Sprintf("ToggleChatDefaultDisableNotificationRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleChatDefaultDisableNotificationRequest) TypeID() uint32 { - return ToggleChatDefaultDisableNotificationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleChatDefaultDisableNotificationRequest) TypeName() string { - return "toggleChatDefaultDisableNotification" -} - -// TypeInfo returns info about TL type. -func (t *ToggleChatDefaultDisableNotificationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleChatDefaultDisableNotification", - ID: ToggleChatDefaultDisableNotificationRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "DefaultDisableNotification", - SchemaName: "default_disable_notification", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleChatDefaultDisableNotificationRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatDefaultDisableNotification#12c36012 as nil") - } - b.PutID(ToggleChatDefaultDisableNotificationRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleChatDefaultDisableNotificationRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatDefaultDisableNotification#12c36012 as nil") - } - b.PutInt53(t.ChatID) - b.PutBool(t.DefaultDisableNotification) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleChatDefaultDisableNotificationRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatDefaultDisableNotification#12c36012 to nil") - } - if err := b.ConsumeID(ToggleChatDefaultDisableNotificationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleChatDefaultDisableNotification#12c36012: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleChatDefaultDisableNotificationRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatDefaultDisableNotification#12c36012 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatDefaultDisableNotification#12c36012: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatDefaultDisableNotification#12c36012: field default_disable_notification: %w", err) - } - t.DefaultDisableNotification = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleChatDefaultDisableNotificationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatDefaultDisableNotification#12c36012 as nil") - } - b.ObjStart() - b.PutID("toggleChatDefaultDisableNotification") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("default_disable_notification") - b.PutBool(t.DefaultDisableNotification) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleChatDefaultDisableNotificationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatDefaultDisableNotification#12c36012 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleChatDefaultDisableNotification"); err != nil { - return fmt.Errorf("unable to decode toggleChatDefaultDisableNotification#12c36012: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatDefaultDisableNotification#12c36012: field chat_id: %w", err) - } - t.ChatID = value - case "default_disable_notification": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatDefaultDisableNotification#12c36012: field default_disable_notification: %w", err) - } - t.DefaultDisableNotification = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *ToggleChatDefaultDisableNotificationRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetDefaultDisableNotification returns value of DefaultDisableNotification field. -func (t *ToggleChatDefaultDisableNotificationRequest) GetDefaultDisableNotification() (value bool) { - if t == nil { - return - } - return t.DefaultDisableNotification -} - -// ToggleChatDefaultDisableNotification invokes method toggleChatDefaultDisableNotification#12c36012 returning error if any. -func (c *Client) ToggleChatDefaultDisableNotification(ctx context.Context, request *ToggleChatDefaultDisableNotificationRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_chat_folder_tags_gen.go b/tdapi/tl_toggle_chat_folder_tags_gen.go deleted file mode 100644 index e61278359..000000000 --- a/tdapi/tl_toggle_chat_folder_tags_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleChatFolderTagsRequest represents TL type `toggleChatFolderTags#834b6c44`. -type ToggleChatFolderTagsRequest struct { - // Pass true to enable folder tags; pass false to disable them - AreTagsEnabled bool -} - -// ToggleChatFolderTagsRequestTypeID is TL type id of ToggleChatFolderTagsRequest. -const ToggleChatFolderTagsRequestTypeID = 0x834b6c44 - -// Ensuring interfaces in compile-time for ToggleChatFolderTagsRequest. -var ( - _ bin.Encoder = &ToggleChatFolderTagsRequest{} - _ bin.Decoder = &ToggleChatFolderTagsRequest{} - _ bin.BareEncoder = &ToggleChatFolderTagsRequest{} - _ bin.BareDecoder = &ToggleChatFolderTagsRequest{} -) - -func (t *ToggleChatFolderTagsRequest) Zero() bool { - if t == nil { - return true - } - if !(t.AreTagsEnabled == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleChatFolderTagsRequest) String() string { - if t == nil { - return "ToggleChatFolderTagsRequest(nil)" - } - type Alias ToggleChatFolderTagsRequest - return fmt.Sprintf("ToggleChatFolderTagsRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleChatFolderTagsRequest) TypeID() uint32 { - return ToggleChatFolderTagsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleChatFolderTagsRequest) TypeName() string { - return "toggleChatFolderTags" -} - -// TypeInfo returns info about TL type. -func (t *ToggleChatFolderTagsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleChatFolderTags", - ID: ToggleChatFolderTagsRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AreTagsEnabled", - SchemaName: "are_tags_enabled", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleChatFolderTagsRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatFolderTags#834b6c44 as nil") - } - b.PutID(ToggleChatFolderTagsRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleChatFolderTagsRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatFolderTags#834b6c44 as nil") - } - b.PutBool(t.AreTagsEnabled) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleChatFolderTagsRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatFolderTags#834b6c44 to nil") - } - if err := b.ConsumeID(ToggleChatFolderTagsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleChatFolderTags#834b6c44: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleChatFolderTagsRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatFolderTags#834b6c44 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatFolderTags#834b6c44: field are_tags_enabled: %w", err) - } - t.AreTagsEnabled = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleChatFolderTagsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatFolderTags#834b6c44 as nil") - } - b.ObjStart() - b.PutID("toggleChatFolderTags") - b.Comma() - b.FieldStart("are_tags_enabled") - b.PutBool(t.AreTagsEnabled) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleChatFolderTagsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatFolderTags#834b6c44 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleChatFolderTags"); err != nil { - return fmt.Errorf("unable to decode toggleChatFolderTags#834b6c44: %w", err) - } - case "are_tags_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatFolderTags#834b6c44: field are_tags_enabled: %w", err) - } - t.AreTagsEnabled = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAreTagsEnabled returns value of AreTagsEnabled field. -func (t *ToggleChatFolderTagsRequest) GetAreTagsEnabled() (value bool) { - if t == nil { - return - } - return t.AreTagsEnabled -} - -// ToggleChatFolderTags invokes method toggleChatFolderTags#834b6c44 returning error if any. -func (c *Client) ToggleChatFolderTags(ctx context.Context, aretagsenabled bool) error { - var ok Ok - - request := &ToggleChatFolderTagsRequest{ - AreTagsEnabled: aretagsenabled, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_chat_has_protected_content_gen.go b/tdapi/tl_toggle_chat_has_protected_content_gen.go deleted file mode 100644 index a0db569bb..000000000 --- a/tdapi/tl_toggle_chat_has_protected_content_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleChatHasProtectedContentRequest represents TL type `toggleChatHasProtectedContent#3a20d94d`. -type ToggleChatHasProtectedContentRequest struct { - // Chat identifier - ChatID int64 - // New value of has_protected_content - HasProtectedContent bool -} - -// ToggleChatHasProtectedContentRequestTypeID is TL type id of ToggleChatHasProtectedContentRequest. -const ToggleChatHasProtectedContentRequestTypeID = 0x3a20d94d - -// Ensuring interfaces in compile-time for ToggleChatHasProtectedContentRequest. -var ( - _ bin.Encoder = &ToggleChatHasProtectedContentRequest{} - _ bin.Decoder = &ToggleChatHasProtectedContentRequest{} - _ bin.BareEncoder = &ToggleChatHasProtectedContentRequest{} - _ bin.BareDecoder = &ToggleChatHasProtectedContentRequest{} -) - -func (t *ToggleChatHasProtectedContentRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.HasProtectedContent == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleChatHasProtectedContentRequest) String() string { - if t == nil { - return "ToggleChatHasProtectedContentRequest(nil)" - } - type Alias ToggleChatHasProtectedContentRequest - return fmt.Sprintf("ToggleChatHasProtectedContentRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleChatHasProtectedContentRequest) TypeID() uint32 { - return ToggleChatHasProtectedContentRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleChatHasProtectedContentRequest) TypeName() string { - return "toggleChatHasProtectedContent" -} - -// TypeInfo returns info about TL type. -func (t *ToggleChatHasProtectedContentRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleChatHasProtectedContent", - ID: ToggleChatHasProtectedContentRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "HasProtectedContent", - SchemaName: "has_protected_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleChatHasProtectedContentRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatHasProtectedContent#3a20d94d as nil") - } - b.PutID(ToggleChatHasProtectedContentRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleChatHasProtectedContentRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatHasProtectedContent#3a20d94d as nil") - } - b.PutInt53(t.ChatID) - b.PutBool(t.HasProtectedContent) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleChatHasProtectedContentRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatHasProtectedContent#3a20d94d to nil") - } - if err := b.ConsumeID(ToggleChatHasProtectedContentRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleChatHasProtectedContent#3a20d94d: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleChatHasProtectedContentRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatHasProtectedContent#3a20d94d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatHasProtectedContent#3a20d94d: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatHasProtectedContent#3a20d94d: field has_protected_content: %w", err) - } - t.HasProtectedContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleChatHasProtectedContentRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatHasProtectedContent#3a20d94d as nil") - } - b.ObjStart() - b.PutID("toggleChatHasProtectedContent") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("has_protected_content") - b.PutBool(t.HasProtectedContent) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleChatHasProtectedContentRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatHasProtectedContent#3a20d94d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleChatHasProtectedContent"); err != nil { - return fmt.Errorf("unable to decode toggleChatHasProtectedContent#3a20d94d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatHasProtectedContent#3a20d94d: field chat_id: %w", err) - } - t.ChatID = value - case "has_protected_content": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatHasProtectedContent#3a20d94d: field has_protected_content: %w", err) - } - t.HasProtectedContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *ToggleChatHasProtectedContentRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetHasProtectedContent returns value of HasProtectedContent field. -func (t *ToggleChatHasProtectedContentRequest) GetHasProtectedContent() (value bool) { - if t == nil { - return - } - return t.HasProtectedContent -} - -// ToggleChatHasProtectedContent invokes method toggleChatHasProtectedContent#3a20d94d returning error if any. -func (c *Client) ToggleChatHasProtectedContent(ctx context.Context, request *ToggleChatHasProtectedContentRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_chat_is_marked_as_unread_gen.go b/tdapi/tl_toggle_chat_is_marked_as_unread_gen.go deleted file mode 100644 index cb88abdcf..000000000 --- a/tdapi/tl_toggle_chat_is_marked_as_unread_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleChatIsMarkedAsUnreadRequest represents TL type `toggleChatIsMarkedAsUnread#c538dadf`. -type ToggleChatIsMarkedAsUnreadRequest struct { - // Chat identifier - ChatID int64 - // New value of is_marked_as_unread - IsMarkedAsUnread bool -} - -// ToggleChatIsMarkedAsUnreadRequestTypeID is TL type id of ToggleChatIsMarkedAsUnreadRequest. -const ToggleChatIsMarkedAsUnreadRequestTypeID = 0xc538dadf - -// Ensuring interfaces in compile-time for ToggleChatIsMarkedAsUnreadRequest. -var ( - _ bin.Encoder = &ToggleChatIsMarkedAsUnreadRequest{} - _ bin.Decoder = &ToggleChatIsMarkedAsUnreadRequest{} - _ bin.BareEncoder = &ToggleChatIsMarkedAsUnreadRequest{} - _ bin.BareDecoder = &ToggleChatIsMarkedAsUnreadRequest{} -) - -func (t *ToggleChatIsMarkedAsUnreadRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.IsMarkedAsUnread == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleChatIsMarkedAsUnreadRequest) String() string { - if t == nil { - return "ToggleChatIsMarkedAsUnreadRequest(nil)" - } - type Alias ToggleChatIsMarkedAsUnreadRequest - return fmt.Sprintf("ToggleChatIsMarkedAsUnreadRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleChatIsMarkedAsUnreadRequest) TypeID() uint32 { - return ToggleChatIsMarkedAsUnreadRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleChatIsMarkedAsUnreadRequest) TypeName() string { - return "toggleChatIsMarkedAsUnread" -} - -// TypeInfo returns info about TL type. -func (t *ToggleChatIsMarkedAsUnreadRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleChatIsMarkedAsUnread", - ID: ToggleChatIsMarkedAsUnreadRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "IsMarkedAsUnread", - SchemaName: "is_marked_as_unread", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleChatIsMarkedAsUnreadRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatIsMarkedAsUnread#c538dadf as nil") - } - b.PutID(ToggleChatIsMarkedAsUnreadRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleChatIsMarkedAsUnreadRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatIsMarkedAsUnread#c538dadf as nil") - } - b.PutInt53(t.ChatID) - b.PutBool(t.IsMarkedAsUnread) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleChatIsMarkedAsUnreadRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatIsMarkedAsUnread#c538dadf to nil") - } - if err := b.ConsumeID(ToggleChatIsMarkedAsUnreadRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleChatIsMarkedAsUnread#c538dadf: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleChatIsMarkedAsUnreadRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatIsMarkedAsUnread#c538dadf to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsMarkedAsUnread#c538dadf: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsMarkedAsUnread#c538dadf: field is_marked_as_unread: %w", err) - } - t.IsMarkedAsUnread = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleChatIsMarkedAsUnreadRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatIsMarkedAsUnread#c538dadf as nil") - } - b.ObjStart() - b.PutID("toggleChatIsMarkedAsUnread") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("is_marked_as_unread") - b.PutBool(t.IsMarkedAsUnread) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleChatIsMarkedAsUnreadRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatIsMarkedAsUnread#c538dadf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleChatIsMarkedAsUnread"); err != nil { - return fmt.Errorf("unable to decode toggleChatIsMarkedAsUnread#c538dadf: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsMarkedAsUnread#c538dadf: field chat_id: %w", err) - } - t.ChatID = value - case "is_marked_as_unread": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsMarkedAsUnread#c538dadf: field is_marked_as_unread: %w", err) - } - t.IsMarkedAsUnread = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *ToggleChatIsMarkedAsUnreadRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetIsMarkedAsUnread returns value of IsMarkedAsUnread field. -func (t *ToggleChatIsMarkedAsUnreadRequest) GetIsMarkedAsUnread() (value bool) { - if t == nil { - return - } - return t.IsMarkedAsUnread -} - -// ToggleChatIsMarkedAsUnread invokes method toggleChatIsMarkedAsUnread#c538dadf returning error if any. -func (c *Client) ToggleChatIsMarkedAsUnread(ctx context.Context, request *ToggleChatIsMarkedAsUnreadRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_chat_is_pinned_gen.go b/tdapi/tl_toggle_chat_is_pinned_gen.go deleted file mode 100644 index 7756d8f66..000000000 --- a/tdapi/tl_toggle_chat_is_pinned_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleChatIsPinnedRequest represents TL type `toggleChatIsPinned#a776263e`. -type ToggleChatIsPinnedRequest struct { - // Chat list in which to change the pinned state of the chat - ChatList ChatListClass - // Chat identifier - ChatID int64 - // Pass true to pin the chat; pass false to unpin it - IsPinned bool -} - -// ToggleChatIsPinnedRequestTypeID is TL type id of ToggleChatIsPinnedRequest. -const ToggleChatIsPinnedRequestTypeID = 0xa776263e - -// Ensuring interfaces in compile-time for ToggleChatIsPinnedRequest. -var ( - _ bin.Encoder = &ToggleChatIsPinnedRequest{} - _ bin.Decoder = &ToggleChatIsPinnedRequest{} - _ bin.BareEncoder = &ToggleChatIsPinnedRequest{} - _ bin.BareDecoder = &ToggleChatIsPinnedRequest{} -) - -func (t *ToggleChatIsPinnedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatList == nil) { - return false - } - if !(t.ChatID == 0) { - return false - } - if !(t.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleChatIsPinnedRequest) String() string { - if t == nil { - return "ToggleChatIsPinnedRequest(nil)" - } - type Alias ToggleChatIsPinnedRequest - return fmt.Sprintf("ToggleChatIsPinnedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleChatIsPinnedRequest) TypeID() uint32 { - return ToggleChatIsPinnedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleChatIsPinnedRequest) TypeName() string { - return "toggleChatIsPinned" -} - -// TypeInfo returns info about TL type. -func (t *ToggleChatIsPinnedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleChatIsPinned", - ID: ToggleChatIsPinnedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatList", - SchemaName: "chat_list", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleChatIsPinnedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatIsPinned#a776263e as nil") - } - b.PutID(ToggleChatIsPinnedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleChatIsPinnedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatIsPinned#a776263e as nil") - } - if t.ChatList == nil { - return fmt.Errorf("unable to encode toggleChatIsPinned#a776263e: field chat_list is nil") - } - if err := t.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode toggleChatIsPinned#a776263e: field chat_list: %w", err) - } - b.PutInt53(t.ChatID) - b.PutBool(t.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleChatIsPinnedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatIsPinned#a776263e to nil") - } - if err := b.ConsumeID(ToggleChatIsPinnedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleChatIsPinned#a776263e: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleChatIsPinnedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatIsPinned#a776263e to nil") - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsPinned#a776263e: field chat_list: %w", err) - } - t.ChatList = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsPinned#a776263e: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsPinned#a776263e: field is_pinned: %w", err) - } - t.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleChatIsPinnedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatIsPinned#a776263e as nil") - } - b.ObjStart() - b.PutID("toggleChatIsPinned") - b.Comma() - b.FieldStart("chat_list") - if t.ChatList == nil { - return fmt.Errorf("unable to encode toggleChatIsPinned#a776263e: field chat_list is nil") - } - if err := t.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode toggleChatIsPinned#a776263e: field chat_list: %w", err) - } - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(t.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleChatIsPinnedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatIsPinned#a776263e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleChatIsPinned"); err != nil { - return fmt.Errorf("unable to decode toggleChatIsPinned#a776263e: %w", err) - } - case "chat_list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsPinned#a776263e: field chat_list: %w", err) - } - t.ChatList = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsPinned#a776263e: field chat_id: %w", err) - } - t.ChatID = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsPinned#a776263e: field is_pinned: %w", err) - } - t.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatList returns value of ChatList field. -func (t *ToggleChatIsPinnedRequest) GetChatList() (value ChatListClass) { - if t == nil { - return - } - return t.ChatList -} - -// GetChatID returns value of ChatID field. -func (t *ToggleChatIsPinnedRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetIsPinned returns value of IsPinned field. -func (t *ToggleChatIsPinnedRequest) GetIsPinned() (value bool) { - if t == nil { - return - } - return t.IsPinned -} - -// ToggleChatIsPinned invokes method toggleChatIsPinned#a776263e returning error if any. -func (c *Client) ToggleChatIsPinned(ctx context.Context, request *ToggleChatIsPinnedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_chat_is_translatable_gen.go b/tdapi/tl_toggle_chat_is_translatable_gen.go deleted file mode 100644 index e47c71e96..000000000 --- a/tdapi/tl_toggle_chat_is_translatable_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleChatIsTranslatableRequest represents TL type `toggleChatIsTranslatable#93f9cbdf`. -type ToggleChatIsTranslatableRequest struct { - // Chat identifier - ChatID int64 - // New value of is_translatable - IsTranslatable bool -} - -// ToggleChatIsTranslatableRequestTypeID is TL type id of ToggleChatIsTranslatableRequest. -const ToggleChatIsTranslatableRequestTypeID = 0x93f9cbdf - -// Ensuring interfaces in compile-time for ToggleChatIsTranslatableRequest. -var ( - _ bin.Encoder = &ToggleChatIsTranslatableRequest{} - _ bin.Decoder = &ToggleChatIsTranslatableRequest{} - _ bin.BareEncoder = &ToggleChatIsTranslatableRequest{} - _ bin.BareDecoder = &ToggleChatIsTranslatableRequest{} -) - -func (t *ToggleChatIsTranslatableRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.IsTranslatable == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleChatIsTranslatableRequest) String() string { - if t == nil { - return "ToggleChatIsTranslatableRequest(nil)" - } - type Alias ToggleChatIsTranslatableRequest - return fmt.Sprintf("ToggleChatIsTranslatableRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleChatIsTranslatableRequest) TypeID() uint32 { - return ToggleChatIsTranslatableRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleChatIsTranslatableRequest) TypeName() string { - return "toggleChatIsTranslatable" -} - -// TypeInfo returns info about TL type. -func (t *ToggleChatIsTranslatableRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleChatIsTranslatable", - ID: ToggleChatIsTranslatableRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "IsTranslatable", - SchemaName: "is_translatable", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleChatIsTranslatableRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatIsTranslatable#93f9cbdf as nil") - } - b.PutID(ToggleChatIsTranslatableRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleChatIsTranslatableRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatIsTranslatable#93f9cbdf as nil") - } - b.PutInt53(t.ChatID) - b.PutBool(t.IsTranslatable) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleChatIsTranslatableRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatIsTranslatable#93f9cbdf to nil") - } - if err := b.ConsumeID(ToggleChatIsTranslatableRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleChatIsTranslatable#93f9cbdf: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleChatIsTranslatableRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatIsTranslatable#93f9cbdf to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsTranslatable#93f9cbdf: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsTranslatable#93f9cbdf: field is_translatable: %w", err) - } - t.IsTranslatable = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleChatIsTranslatableRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatIsTranslatable#93f9cbdf as nil") - } - b.ObjStart() - b.PutID("toggleChatIsTranslatable") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("is_translatable") - b.PutBool(t.IsTranslatable) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleChatIsTranslatableRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatIsTranslatable#93f9cbdf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleChatIsTranslatable"); err != nil { - return fmt.Errorf("unable to decode toggleChatIsTranslatable#93f9cbdf: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsTranslatable#93f9cbdf: field chat_id: %w", err) - } - t.ChatID = value - case "is_translatable": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatIsTranslatable#93f9cbdf: field is_translatable: %w", err) - } - t.IsTranslatable = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *ToggleChatIsTranslatableRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetIsTranslatable returns value of IsTranslatable field. -func (t *ToggleChatIsTranslatableRequest) GetIsTranslatable() (value bool) { - if t == nil { - return - } - return t.IsTranslatable -} - -// ToggleChatIsTranslatable invokes method toggleChatIsTranslatable#93f9cbdf returning error if any. -func (c *Client) ToggleChatIsTranslatable(ctx context.Context, request *ToggleChatIsTranslatableRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_chat_view_as_topics_gen.go b/tdapi/tl_toggle_chat_view_as_topics_gen.go deleted file mode 100644 index c4fc61947..000000000 --- a/tdapi/tl_toggle_chat_view_as_topics_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleChatViewAsTopicsRequest represents TL type `toggleChatViewAsTopics#2b2783dc`. -type ToggleChatViewAsTopicsRequest struct { - // Chat identifier - ChatID int64 - // New value of view_as_topics - ViewAsTopics bool -} - -// ToggleChatViewAsTopicsRequestTypeID is TL type id of ToggleChatViewAsTopicsRequest. -const ToggleChatViewAsTopicsRequestTypeID = 0x2b2783dc - -// Ensuring interfaces in compile-time for ToggleChatViewAsTopicsRequest. -var ( - _ bin.Encoder = &ToggleChatViewAsTopicsRequest{} - _ bin.Decoder = &ToggleChatViewAsTopicsRequest{} - _ bin.BareEncoder = &ToggleChatViewAsTopicsRequest{} - _ bin.BareDecoder = &ToggleChatViewAsTopicsRequest{} -) - -func (t *ToggleChatViewAsTopicsRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.ViewAsTopics == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleChatViewAsTopicsRequest) String() string { - if t == nil { - return "ToggleChatViewAsTopicsRequest(nil)" - } - type Alias ToggleChatViewAsTopicsRequest - return fmt.Sprintf("ToggleChatViewAsTopicsRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleChatViewAsTopicsRequest) TypeID() uint32 { - return ToggleChatViewAsTopicsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleChatViewAsTopicsRequest) TypeName() string { - return "toggleChatViewAsTopics" -} - -// TypeInfo returns info about TL type. -func (t *ToggleChatViewAsTopicsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleChatViewAsTopics", - ID: ToggleChatViewAsTopicsRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ViewAsTopics", - SchemaName: "view_as_topics", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleChatViewAsTopicsRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatViewAsTopics#2b2783dc as nil") - } - b.PutID(ToggleChatViewAsTopicsRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleChatViewAsTopicsRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatViewAsTopics#2b2783dc as nil") - } - b.PutInt53(t.ChatID) - b.PutBool(t.ViewAsTopics) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleChatViewAsTopicsRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatViewAsTopics#2b2783dc to nil") - } - if err := b.ConsumeID(ToggleChatViewAsTopicsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleChatViewAsTopicsRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatViewAsTopics#2b2783dc to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: field view_as_topics: %w", err) - } - t.ViewAsTopics = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleChatViewAsTopicsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleChatViewAsTopics#2b2783dc as nil") - } - b.ObjStart() - b.PutID("toggleChatViewAsTopics") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("view_as_topics") - b.PutBool(t.ViewAsTopics) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleChatViewAsTopicsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleChatViewAsTopics#2b2783dc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleChatViewAsTopics"); err != nil { - return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: field chat_id: %w", err) - } - t.ChatID = value - case "view_as_topics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleChatViewAsTopics#2b2783dc: field view_as_topics: %w", err) - } - t.ViewAsTopics = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *ToggleChatViewAsTopicsRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetViewAsTopics returns value of ViewAsTopics field. -func (t *ToggleChatViewAsTopicsRequest) GetViewAsTopics() (value bool) { - if t == nil { - return - } - return t.ViewAsTopics -} - -// ToggleChatViewAsTopics invokes method toggleChatViewAsTopics#2b2783dc returning error if any. -func (c *Client) ToggleChatViewAsTopics(ctx context.Context, request *ToggleChatViewAsTopicsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_download_is_paused_gen.go b/tdapi/tl_toggle_download_is_paused_gen.go deleted file mode 100644 index 1b35fe5d6..000000000 --- a/tdapi/tl_toggle_download_is_paused_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleDownloadIsPausedRequest represents TL type `toggleDownloadIsPaused#c7866715`. -type ToggleDownloadIsPausedRequest struct { - // Identifier of the downloaded file - FileID int32 - // Pass true if the download is paused - IsPaused bool -} - -// ToggleDownloadIsPausedRequestTypeID is TL type id of ToggleDownloadIsPausedRequest. -const ToggleDownloadIsPausedRequestTypeID = 0xc7866715 - -// Ensuring interfaces in compile-time for ToggleDownloadIsPausedRequest. -var ( - _ bin.Encoder = &ToggleDownloadIsPausedRequest{} - _ bin.Decoder = &ToggleDownloadIsPausedRequest{} - _ bin.BareEncoder = &ToggleDownloadIsPausedRequest{} - _ bin.BareDecoder = &ToggleDownloadIsPausedRequest{} -) - -func (t *ToggleDownloadIsPausedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.FileID == 0) { - return false - } - if !(t.IsPaused == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleDownloadIsPausedRequest) String() string { - if t == nil { - return "ToggleDownloadIsPausedRequest(nil)" - } - type Alias ToggleDownloadIsPausedRequest - return fmt.Sprintf("ToggleDownloadIsPausedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleDownloadIsPausedRequest) TypeID() uint32 { - return ToggleDownloadIsPausedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleDownloadIsPausedRequest) TypeName() string { - return "toggleDownloadIsPaused" -} - -// TypeInfo returns info about TL type. -func (t *ToggleDownloadIsPausedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleDownloadIsPaused", - ID: ToggleDownloadIsPausedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "IsPaused", - SchemaName: "is_paused", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleDownloadIsPausedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleDownloadIsPaused#c7866715 as nil") - } - b.PutID(ToggleDownloadIsPausedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleDownloadIsPausedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleDownloadIsPaused#c7866715 as nil") - } - b.PutInt32(t.FileID) - b.PutBool(t.IsPaused) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleDownloadIsPausedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleDownloadIsPaused#c7866715 to nil") - } - if err := b.ConsumeID(ToggleDownloadIsPausedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleDownloadIsPaused#c7866715: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleDownloadIsPausedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleDownloadIsPaused#c7866715 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleDownloadIsPaused#c7866715: field file_id: %w", err) - } - t.FileID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleDownloadIsPaused#c7866715: field is_paused: %w", err) - } - t.IsPaused = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleDownloadIsPausedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleDownloadIsPaused#c7866715 as nil") - } - b.ObjStart() - b.PutID("toggleDownloadIsPaused") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(t.FileID) - b.Comma() - b.FieldStart("is_paused") - b.PutBool(t.IsPaused) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleDownloadIsPausedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleDownloadIsPaused#c7866715 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleDownloadIsPaused"); err != nil { - return fmt.Errorf("unable to decode toggleDownloadIsPaused#c7866715: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleDownloadIsPaused#c7866715: field file_id: %w", err) - } - t.FileID = value - case "is_paused": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleDownloadIsPaused#c7866715: field is_paused: %w", err) - } - t.IsPaused = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (t *ToggleDownloadIsPausedRequest) GetFileID() (value int32) { - if t == nil { - return - } - return t.FileID -} - -// GetIsPaused returns value of IsPaused field. -func (t *ToggleDownloadIsPausedRequest) GetIsPaused() (value bool) { - if t == nil { - return - } - return t.IsPaused -} - -// ToggleDownloadIsPaused invokes method toggleDownloadIsPaused#c7866715 returning error if any. -func (c *Client) ToggleDownloadIsPaused(ctx context.Context, request *ToggleDownloadIsPausedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_forum_topic_is_closed_gen.go b/tdapi/tl_toggle_forum_topic_is_closed_gen.go deleted file mode 100644 index 8a564ddb5..000000000 --- a/tdapi/tl_toggle_forum_topic_is_closed_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleForumTopicIsClosedRequest represents TL type `toggleForumTopicIsClosed#c7648af3`. -type ToggleForumTopicIsClosedRequest struct { - // Identifier of the chat - ChatID int64 - // Message thread identifier of the forum topic - MessageThreadID int64 - // Pass true to close the topic; pass false to reopen it - IsClosed bool -} - -// ToggleForumTopicIsClosedRequestTypeID is TL type id of ToggleForumTopicIsClosedRequest. -const ToggleForumTopicIsClosedRequestTypeID = 0xc7648af3 - -// Ensuring interfaces in compile-time for ToggleForumTopicIsClosedRequest. -var ( - _ bin.Encoder = &ToggleForumTopicIsClosedRequest{} - _ bin.Decoder = &ToggleForumTopicIsClosedRequest{} - _ bin.BareEncoder = &ToggleForumTopicIsClosedRequest{} - _ bin.BareDecoder = &ToggleForumTopicIsClosedRequest{} -) - -func (t *ToggleForumTopicIsClosedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.MessageThreadID == 0) { - return false - } - if !(t.IsClosed == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleForumTopicIsClosedRequest) String() string { - if t == nil { - return "ToggleForumTopicIsClosedRequest(nil)" - } - type Alias ToggleForumTopicIsClosedRequest - return fmt.Sprintf("ToggleForumTopicIsClosedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleForumTopicIsClosedRequest) TypeID() uint32 { - return ToggleForumTopicIsClosedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleForumTopicIsClosedRequest) TypeName() string { - return "toggleForumTopicIsClosed" -} - -// TypeInfo returns info about TL type. -func (t *ToggleForumTopicIsClosedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleForumTopicIsClosed", - ID: ToggleForumTopicIsClosedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "IsClosed", - SchemaName: "is_closed", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleForumTopicIsClosedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleForumTopicIsClosed#c7648af3 as nil") - } - b.PutID(ToggleForumTopicIsClosedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleForumTopicIsClosedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleForumTopicIsClosed#c7648af3 as nil") - } - b.PutInt53(t.ChatID) - b.PutInt53(t.MessageThreadID) - b.PutBool(t.IsClosed) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleForumTopicIsClosedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleForumTopicIsClosed#c7648af3 to nil") - } - if err := b.ConsumeID(ToggleForumTopicIsClosedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsClosed#c7648af3: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleForumTopicIsClosedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleForumTopicIsClosed#c7648af3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsClosed#c7648af3: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsClosed#c7648af3: field message_thread_id: %w", err) - } - t.MessageThreadID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsClosed#c7648af3: field is_closed: %w", err) - } - t.IsClosed = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleForumTopicIsClosedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleForumTopicIsClosed#c7648af3 as nil") - } - b.ObjStart() - b.PutID("toggleForumTopicIsClosed") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(t.MessageThreadID) - b.Comma() - b.FieldStart("is_closed") - b.PutBool(t.IsClosed) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleForumTopicIsClosedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleForumTopicIsClosed#c7648af3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleForumTopicIsClosed"); err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsClosed#c7648af3: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsClosed#c7648af3: field chat_id: %w", err) - } - t.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsClosed#c7648af3: field message_thread_id: %w", err) - } - t.MessageThreadID = value - case "is_closed": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsClosed#c7648af3: field is_closed: %w", err) - } - t.IsClosed = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *ToggleForumTopicIsClosedRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (t *ToggleForumTopicIsClosedRequest) GetMessageThreadID() (value int64) { - if t == nil { - return - } - return t.MessageThreadID -} - -// GetIsClosed returns value of IsClosed field. -func (t *ToggleForumTopicIsClosedRequest) GetIsClosed() (value bool) { - if t == nil { - return - } - return t.IsClosed -} - -// ToggleForumTopicIsClosed invokes method toggleForumTopicIsClosed#c7648af3 returning error if any. -func (c *Client) ToggleForumTopicIsClosed(ctx context.Context, request *ToggleForumTopicIsClosedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_forum_topic_is_pinned_gen.go b/tdapi/tl_toggle_forum_topic_is_pinned_gen.go deleted file mode 100644 index c5406d0d1..000000000 --- a/tdapi/tl_toggle_forum_topic_is_pinned_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleForumTopicIsPinnedRequest represents TL type `toggleForumTopicIsPinned#466ceab4`. -type ToggleForumTopicIsPinnedRequest struct { - // Chat identifier - ChatID int64 - // Message thread identifier of the forum topic - MessageThreadID int64 - // Pass true to pin the topic; pass false to unpin it - IsPinned bool -} - -// ToggleForumTopicIsPinnedRequestTypeID is TL type id of ToggleForumTopicIsPinnedRequest. -const ToggleForumTopicIsPinnedRequestTypeID = 0x466ceab4 - -// Ensuring interfaces in compile-time for ToggleForumTopicIsPinnedRequest. -var ( - _ bin.Encoder = &ToggleForumTopicIsPinnedRequest{} - _ bin.Decoder = &ToggleForumTopicIsPinnedRequest{} - _ bin.BareEncoder = &ToggleForumTopicIsPinnedRequest{} - _ bin.BareDecoder = &ToggleForumTopicIsPinnedRequest{} -) - -func (t *ToggleForumTopicIsPinnedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.MessageThreadID == 0) { - return false - } - if !(t.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleForumTopicIsPinnedRequest) String() string { - if t == nil { - return "ToggleForumTopicIsPinnedRequest(nil)" - } - type Alias ToggleForumTopicIsPinnedRequest - return fmt.Sprintf("ToggleForumTopicIsPinnedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleForumTopicIsPinnedRequest) TypeID() uint32 { - return ToggleForumTopicIsPinnedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleForumTopicIsPinnedRequest) TypeName() string { - return "toggleForumTopicIsPinned" -} - -// TypeInfo returns info about TL type. -func (t *ToggleForumTopicIsPinnedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleForumTopicIsPinned", - ID: ToggleForumTopicIsPinnedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleForumTopicIsPinnedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleForumTopicIsPinned#466ceab4 as nil") - } - b.PutID(ToggleForumTopicIsPinnedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleForumTopicIsPinnedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleForumTopicIsPinned#466ceab4 as nil") - } - b.PutInt53(t.ChatID) - b.PutInt53(t.MessageThreadID) - b.PutBool(t.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleForumTopicIsPinnedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleForumTopicIsPinned#466ceab4 to nil") - } - if err := b.ConsumeID(ToggleForumTopicIsPinnedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsPinned#466ceab4: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleForumTopicIsPinnedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleForumTopicIsPinned#466ceab4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsPinned#466ceab4: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsPinned#466ceab4: field message_thread_id: %w", err) - } - t.MessageThreadID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsPinned#466ceab4: field is_pinned: %w", err) - } - t.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleForumTopicIsPinnedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleForumTopicIsPinned#466ceab4 as nil") - } - b.ObjStart() - b.PutID("toggleForumTopicIsPinned") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(t.MessageThreadID) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(t.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleForumTopicIsPinnedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleForumTopicIsPinned#466ceab4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleForumTopicIsPinned"); err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsPinned#466ceab4: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsPinned#466ceab4: field chat_id: %w", err) - } - t.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsPinned#466ceab4: field message_thread_id: %w", err) - } - t.MessageThreadID = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleForumTopicIsPinned#466ceab4: field is_pinned: %w", err) - } - t.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *ToggleForumTopicIsPinnedRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (t *ToggleForumTopicIsPinnedRequest) GetMessageThreadID() (value int64) { - if t == nil { - return - } - return t.MessageThreadID -} - -// GetIsPinned returns value of IsPinned field. -func (t *ToggleForumTopicIsPinnedRequest) GetIsPinned() (value bool) { - if t == nil { - return - } - return t.IsPinned -} - -// ToggleForumTopicIsPinned invokes method toggleForumTopicIsPinned#466ceab4 returning error if any. -func (c *Client) ToggleForumTopicIsPinned(ctx context.Context, request *ToggleForumTopicIsPinnedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_general_forum_topic_is_hidden_gen.go b/tdapi/tl_toggle_general_forum_topic_is_hidden_gen.go deleted file mode 100644 index b33cfcea2..000000000 --- a/tdapi/tl_toggle_general_forum_topic_is_hidden_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleGeneralForumTopicIsHiddenRequest represents TL type `toggleGeneralForumTopicIsHidden#5f1d1448`. -type ToggleGeneralForumTopicIsHiddenRequest struct { - // Identifier of the chat - ChatID int64 - // Pass true to hide and close the General topic; pass false to unhide it - IsHidden bool -} - -// ToggleGeneralForumTopicIsHiddenRequestTypeID is TL type id of ToggleGeneralForumTopicIsHiddenRequest. -const ToggleGeneralForumTopicIsHiddenRequestTypeID = 0x5f1d1448 - -// Ensuring interfaces in compile-time for ToggleGeneralForumTopicIsHiddenRequest. -var ( - _ bin.Encoder = &ToggleGeneralForumTopicIsHiddenRequest{} - _ bin.Decoder = &ToggleGeneralForumTopicIsHiddenRequest{} - _ bin.BareEncoder = &ToggleGeneralForumTopicIsHiddenRequest{} - _ bin.BareDecoder = &ToggleGeneralForumTopicIsHiddenRequest{} -) - -func (t *ToggleGeneralForumTopicIsHiddenRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.IsHidden == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleGeneralForumTopicIsHiddenRequest) String() string { - if t == nil { - return "ToggleGeneralForumTopicIsHiddenRequest(nil)" - } - type Alias ToggleGeneralForumTopicIsHiddenRequest - return fmt.Sprintf("ToggleGeneralForumTopicIsHiddenRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleGeneralForumTopicIsHiddenRequest) TypeID() uint32 { - return ToggleGeneralForumTopicIsHiddenRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleGeneralForumTopicIsHiddenRequest) TypeName() string { - return "toggleGeneralForumTopicIsHidden" -} - -// TypeInfo returns info about TL type. -func (t *ToggleGeneralForumTopicIsHiddenRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleGeneralForumTopicIsHidden", - ID: ToggleGeneralForumTopicIsHiddenRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "IsHidden", - SchemaName: "is_hidden", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleGeneralForumTopicIsHiddenRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGeneralForumTopicIsHidden#5f1d1448 as nil") - } - b.PutID(ToggleGeneralForumTopicIsHiddenRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleGeneralForumTopicIsHiddenRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGeneralForumTopicIsHidden#5f1d1448 as nil") - } - b.PutInt53(t.ChatID) - b.PutBool(t.IsHidden) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleGeneralForumTopicIsHiddenRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGeneralForumTopicIsHidden#5f1d1448 to nil") - } - if err := b.ConsumeID(ToggleGeneralForumTopicIsHiddenRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleGeneralForumTopicIsHiddenRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGeneralForumTopicIsHidden#5f1d1448 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: field is_hidden: %w", err) - } - t.IsHidden = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleGeneralForumTopicIsHiddenRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleGeneralForumTopicIsHidden#5f1d1448 as nil") - } - b.ObjStart() - b.PutID("toggleGeneralForumTopicIsHidden") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("is_hidden") - b.PutBool(t.IsHidden) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleGeneralForumTopicIsHiddenRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleGeneralForumTopicIsHidden#5f1d1448 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleGeneralForumTopicIsHidden"); err != nil { - return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: field chat_id: %w", err) - } - t.ChatID = value - case "is_hidden": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGeneralForumTopicIsHidden#5f1d1448: field is_hidden: %w", err) - } - t.IsHidden = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *ToggleGeneralForumTopicIsHiddenRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetIsHidden returns value of IsHidden field. -func (t *ToggleGeneralForumTopicIsHiddenRequest) GetIsHidden() (value bool) { - if t == nil { - return - } - return t.IsHidden -} - -// ToggleGeneralForumTopicIsHidden invokes method toggleGeneralForumTopicIsHidden#5f1d1448 returning error if any. -func (c *Client) ToggleGeneralForumTopicIsHidden(ctx context.Context, request *ToggleGeneralForumTopicIsHiddenRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_gift_is_saved_gen.go b/tdapi/tl_toggle_gift_is_saved_gen.go deleted file mode 100644 index cd0baf24f..000000000 --- a/tdapi/tl_toggle_gift_is_saved_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleGiftIsSavedRequest represents TL type `toggleGiftIsSaved#91c2f183`. -type ToggleGiftIsSavedRequest struct { - // Identifier of the user that sent the gift - SenderUserID int64 - // Identifier of the message with the gift in the chat with the user - MessageID int64 - // Pass true to display the gift on the user's profile page; pass false to remove it from - // the profile page - IsSaved bool -} - -// ToggleGiftIsSavedRequestTypeID is TL type id of ToggleGiftIsSavedRequest. -const ToggleGiftIsSavedRequestTypeID = 0x91c2f183 - -// Ensuring interfaces in compile-time for ToggleGiftIsSavedRequest. -var ( - _ bin.Encoder = &ToggleGiftIsSavedRequest{} - _ bin.Decoder = &ToggleGiftIsSavedRequest{} - _ bin.BareEncoder = &ToggleGiftIsSavedRequest{} - _ bin.BareDecoder = &ToggleGiftIsSavedRequest{} -) - -func (t *ToggleGiftIsSavedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SenderUserID == 0) { - return false - } - if !(t.MessageID == 0) { - return false - } - if !(t.IsSaved == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleGiftIsSavedRequest) String() string { - if t == nil { - return "ToggleGiftIsSavedRequest(nil)" - } - type Alias ToggleGiftIsSavedRequest - return fmt.Sprintf("ToggleGiftIsSavedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleGiftIsSavedRequest) TypeID() uint32 { - return ToggleGiftIsSavedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleGiftIsSavedRequest) TypeName() string { - return "toggleGiftIsSaved" -} - -// TypeInfo returns info about TL type. -func (t *ToggleGiftIsSavedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleGiftIsSaved", - ID: ToggleGiftIsSavedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "IsSaved", - SchemaName: "is_saved", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleGiftIsSavedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGiftIsSaved#91c2f183 as nil") - } - b.PutID(ToggleGiftIsSavedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleGiftIsSavedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGiftIsSaved#91c2f183 as nil") - } - b.PutInt53(t.SenderUserID) - b.PutInt53(t.MessageID) - b.PutBool(t.IsSaved) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleGiftIsSavedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGiftIsSaved#91c2f183 to nil") - } - if err := b.ConsumeID(ToggleGiftIsSavedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleGiftIsSaved#91c2f183: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleGiftIsSavedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGiftIsSaved#91c2f183 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleGiftIsSaved#91c2f183: field sender_user_id: %w", err) - } - t.SenderUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleGiftIsSaved#91c2f183: field message_id: %w", err) - } - t.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGiftIsSaved#91c2f183: field is_saved: %w", err) - } - t.IsSaved = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleGiftIsSavedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleGiftIsSaved#91c2f183 as nil") - } - b.ObjStart() - b.PutID("toggleGiftIsSaved") - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(t.SenderUserID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(t.MessageID) - b.Comma() - b.FieldStart("is_saved") - b.PutBool(t.IsSaved) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleGiftIsSavedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleGiftIsSaved#91c2f183 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleGiftIsSaved"); err != nil { - return fmt.Errorf("unable to decode toggleGiftIsSaved#91c2f183: %w", err) - } - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleGiftIsSaved#91c2f183: field sender_user_id: %w", err) - } - t.SenderUserID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleGiftIsSaved#91c2f183: field message_id: %w", err) - } - t.MessageID = value - case "is_saved": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGiftIsSaved#91c2f183: field is_saved: %w", err) - } - t.IsSaved = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderUserID returns value of SenderUserID field. -func (t *ToggleGiftIsSavedRequest) GetSenderUserID() (value int64) { - if t == nil { - return - } - return t.SenderUserID -} - -// GetMessageID returns value of MessageID field. -func (t *ToggleGiftIsSavedRequest) GetMessageID() (value int64) { - if t == nil { - return - } - return t.MessageID -} - -// GetIsSaved returns value of IsSaved field. -func (t *ToggleGiftIsSavedRequest) GetIsSaved() (value bool) { - if t == nil { - return - } - return t.IsSaved -} - -// ToggleGiftIsSaved invokes method toggleGiftIsSaved#91c2f183 returning error if any. -func (c *Client) ToggleGiftIsSaved(ctx context.Context, request *ToggleGiftIsSavedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_group_call_enabled_start_notification_gen.go b/tdapi/tl_toggle_group_call_enabled_start_notification_gen.go deleted file mode 100644 index e1ae15b9e..000000000 --- a/tdapi/tl_toggle_group_call_enabled_start_notification_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleGroupCallEnabledStartNotificationRequest represents TL type `toggleGroupCallEnabledStartNotification#2a30c752`. -type ToggleGroupCallEnabledStartNotificationRequest struct { - // Group call identifier - GroupCallID int32 - // New value of the enabled_start_notification setting - EnabledStartNotification bool -} - -// ToggleGroupCallEnabledStartNotificationRequestTypeID is TL type id of ToggleGroupCallEnabledStartNotificationRequest. -const ToggleGroupCallEnabledStartNotificationRequestTypeID = 0x2a30c752 - -// Ensuring interfaces in compile-time for ToggleGroupCallEnabledStartNotificationRequest. -var ( - _ bin.Encoder = &ToggleGroupCallEnabledStartNotificationRequest{} - _ bin.Decoder = &ToggleGroupCallEnabledStartNotificationRequest{} - _ bin.BareEncoder = &ToggleGroupCallEnabledStartNotificationRequest{} - _ bin.BareDecoder = &ToggleGroupCallEnabledStartNotificationRequest{} -) - -func (t *ToggleGroupCallEnabledStartNotificationRequest) Zero() bool { - if t == nil { - return true - } - if !(t.GroupCallID == 0) { - return false - } - if !(t.EnabledStartNotification == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleGroupCallEnabledStartNotificationRequest) String() string { - if t == nil { - return "ToggleGroupCallEnabledStartNotificationRequest(nil)" - } - type Alias ToggleGroupCallEnabledStartNotificationRequest - return fmt.Sprintf("ToggleGroupCallEnabledStartNotificationRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleGroupCallEnabledStartNotificationRequest) TypeID() uint32 { - return ToggleGroupCallEnabledStartNotificationRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleGroupCallEnabledStartNotificationRequest) TypeName() string { - return "toggleGroupCallEnabledStartNotification" -} - -// TypeInfo returns info about TL type. -func (t *ToggleGroupCallEnabledStartNotificationRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleGroupCallEnabledStartNotification", - ID: ToggleGroupCallEnabledStartNotificationRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "EnabledStartNotification", - SchemaName: "enabled_start_notification", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleGroupCallEnabledStartNotificationRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallEnabledStartNotification#2a30c752 as nil") - } - b.PutID(ToggleGroupCallEnabledStartNotificationRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleGroupCallEnabledStartNotificationRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallEnabledStartNotification#2a30c752 as nil") - } - b.PutInt32(t.GroupCallID) - b.PutBool(t.EnabledStartNotification) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleGroupCallEnabledStartNotificationRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallEnabledStartNotification#2a30c752 to nil") - } - if err := b.ConsumeID(ToggleGroupCallEnabledStartNotificationRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallEnabledStartNotification#2a30c752: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleGroupCallEnabledStartNotificationRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallEnabledStartNotification#2a30c752 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallEnabledStartNotification#2a30c752: field group_call_id: %w", err) - } - t.GroupCallID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallEnabledStartNotification#2a30c752: field enabled_start_notification: %w", err) - } - t.EnabledStartNotification = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleGroupCallEnabledStartNotificationRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallEnabledStartNotification#2a30c752 as nil") - } - b.ObjStart() - b.PutID("toggleGroupCallEnabledStartNotification") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(t.GroupCallID) - b.Comma() - b.FieldStart("enabled_start_notification") - b.PutBool(t.EnabledStartNotification) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleGroupCallEnabledStartNotificationRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallEnabledStartNotification#2a30c752 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleGroupCallEnabledStartNotification"); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallEnabledStartNotification#2a30c752: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallEnabledStartNotification#2a30c752: field group_call_id: %w", err) - } - t.GroupCallID = value - case "enabled_start_notification": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallEnabledStartNotification#2a30c752: field enabled_start_notification: %w", err) - } - t.EnabledStartNotification = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (t *ToggleGroupCallEnabledStartNotificationRequest) GetGroupCallID() (value int32) { - if t == nil { - return - } - return t.GroupCallID -} - -// GetEnabledStartNotification returns value of EnabledStartNotification field. -func (t *ToggleGroupCallEnabledStartNotificationRequest) GetEnabledStartNotification() (value bool) { - if t == nil { - return - } - return t.EnabledStartNotification -} - -// ToggleGroupCallEnabledStartNotification invokes method toggleGroupCallEnabledStartNotification#2a30c752 returning error if any. -func (c *Client) ToggleGroupCallEnabledStartNotification(ctx context.Context, request *ToggleGroupCallEnabledStartNotificationRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_group_call_is_my_video_enabled_gen.go b/tdapi/tl_toggle_group_call_is_my_video_enabled_gen.go deleted file mode 100644 index e174956c1..000000000 --- a/tdapi/tl_toggle_group_call_is_my_video_enabled_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleGroupCallIsMyVideoEnabledRequest represents TL type `toggleGroupCallIsMyVideoEnabled#9f2f50fa`. -type ToggleGroupCallIsMyVideoEnabledRequest struct { - // Group call identifier - GroupCallID int32 - // Pass true if the current user's video is enabled - IsMyVideoEnabled bool -} - -// ToggleGroupCallIsMyVideoEnabledRequestTypeID is TL type id of ToggleGroupCallIsMyVideoEnabledRequest. -const ToggleGroupCallIsMyVideoEnabledRequestTypeID = 0x9f2f50fa - -// Ensuring interfaces in compile-time for ToggleGroupCallIsMyVideoEnabledRequest. -var ( - _ bin.Encoder = &ToggleGroupCallIsMyVideoEnabledRequest{} - _ bin.Decoder = &ToggleGroupCallIsMyVideoEnabledRequest{} - _ bin.BareEncoder = &ToggleGroupCallIsMyVideoEnabledRequest{} - _ bin.BareDecoder = &ToggleGroupCallIsMyVideoEnabledRequest{} -) - -func (t *ToggleGroupCallIsMyVideoEnabledRequest) Zero() bool { - if t == nil { - return true - } - if !(t.GroupCallID == 0) { - return false - } - if !(t.IsMyVideoEnabled == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleGroupCallIsMyVideoEnabledRequest) String() string { - if t == nil { - return "ToggleGroupCallIsMyVideoEnabledRequest(nil)" - } - type Alias ToggleGroupCallIsMyVideoEnabledRequest - return fmt.Sprintf("ToggleGroupCallIsMyVideoEnabledRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleGroupCallIsMyVideoEnabledRequest) TypeID() uint32 { - return ToggleGroupCallIsMyVideoEnabledRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleGroupCallIsMyVideoEnabledRequest) TypeName() string { - return "toggleGroupCallIsMyVideoEnabled" -} - -// TypeInfo returns info about TL type. -func (t *ToggleGroupCallIsMyVideoEnabledRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleGroupCallIsMyVideoEnabled", - ID: ToggleGroupCallIsMyVideoEnabledRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "IsMyVideoEnabled", - SchemaName: "is_my_video_enabled", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleGroupCallIsMyVideoEnabledRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallIsMyVideoEnabled#9f2f50fa as nil") - } - b.PutID(ToggleGroupCallIsMyVideoEnabledRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleGroupCallIsMyVideoEnabledRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallIsMyVideoEnabled#9f2f50fa as nil") - } - b.PutInt32(t.GroupCallID) - b.PutBool(t.IsMyVideoEnabled) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleGroupCallIsMyVideoEnabledRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallIsMyVideoEnabled#9f2f50fa to nil") - } - if err := b.ConsumeID(ToggleGroupCallIsMyVideoEnabledRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoEnabled#9f2f50fa: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleGroupCallIsMyVideoEnabledRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallIsMyVideoEnabled#9f2f50fa to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoEnabled#9f2f50fa: field group_call_id: %w", err) - } - t.GroupCallID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoEnabled#9f2f50fa: field is_my_video_enabled: %w", err) - } - t.IsMyVideoEnabled = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleGroupCallIsMyVideoEnabledRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallIsMyVideoEnabled#9f2f50fa as nil") - } - b.ObjStart() - b.PutID("toggleGroupCallIsMyVideoEnabled") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(t.GroupCallID) - b.Comma() - b.FieldStart("is_my_video_enabled") - b.PutBool(t.IsMyVideoEnabled) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleGroupCallIsMyVideoEnabledRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallIsMyVideoEnabled#9f2f50fa to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleGroupCallIsMyVideoEnabled"); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoEnabled#9f2f50fa: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoEnabled#9f2f50fa: field group_call_id: %w", err) - } - t.GroupCallID = value - case "is_my_video_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoEnabled#9f2f50fa: field is_my_video_enabled: %w", err) - } - t.IsMyVideoEnabled = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (t *ToggleGroupCallIsMyVideoEnabledRequest) GetGroupCallID() (value int32) { - if t == nil { - return - } - return t.GroupCallID -} - -// GetIsMyVideoEnabled returns value of IsMyVideoEnabled field. -func (t *ToggleGroupCallIsMyVideoEnabledRequest) GetIsMyVideoEnabled() (value bool) { - if t == nil { - return - } - return t.IsMyVideoEnabled -} - -// ToggleGroupCallIsMyVideoEnabled invokes method toggleGroupCallIsMyVideoEnabled#9f2f50fa returning error if any. -func (c *Client) ToggleGroupCallIsMyVideoEnabled(ctx context.Context, request *ToggleGroupCallIsMyVideoEnabledRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_group_call_is_my_video_paused_gen.go b/tdapi/tl_toggle_group_call_is_my_video_paused_gen.go deleted file mode 100644 index a192312ea..000000000 --- a/tdapi/tl_toggle_group_call_is_my_video_paused_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleGroupCallIsMyVideoPausedRequest represents TL type `toggleGroupCallIsMyVideoPaused#e374f199`. -type ToggleGroupCallIsMyVideoPausedRequest struct { - // Group call identifier - GroupCallID int32 - // Pass true if the current user's video is paused - IsMyVideoPaused bool -} - -// ToggleGroupCallIsMyVideoPausedRequestTypeID is TL type id of ToggleGroupCallIsMyVideoPausedRequest. -const ToggleGroupCallIsMyVideoPausedRequestTypeID = 0xe374f199 - -// Ensuring interfaces in compile-time for ToggleGroupCallIsMyVideoPausedRequest. -var ( - _ bin.Encoder = &ToggleGroupCallIsMyVideoPausedRequest{} - _ bin.Decoder = &ToggleGroupCallIsMyVideoPausedRequest{} - _ bin.BareEncoder = &ToggleGroupCallIsMyVideoPausedRequest{} - _ bin.BareDecoder = &ToggleGroupCallIsMyVideoPausedRequest{} -) - -func (t *ToggleGroupCallIsMyVideoPausedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.GroupCallID == 0) { - return false - } - if !(t.IsMyVideoPaused == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleGroupCallIsMyVideoPausedRequest) String() string { - if t == nil { - return "ToggleGroupCallIsMyVideoPausedRequest(nil)" - } - type Alias ToggleGroupCallIsMyVideoPausedRequest - return fmt.Sprintf("ToggleGroupCallIsMyVideoPausedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleGroupCallIsMyVideoPausedRequest) TypeID() uint32 { - return ToggleGroupCallIsMyVideoPausedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleGroupCallIsMyVideoPausedRequest) TypeName() string { - return "toggleGroupCallIsMyVideoPaused" -} - -// TypeInfo returns info about TL type. -func (t *ToggleGroupCallIsMyVideoPausedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleGroupCallIsMyVideoPaused", - ID: ToggleGroupCallIsMyVideoPausedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "IsMyVideoPaused", - SchemaName: "is_my_video_paused", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleGroupCallIsMyVideoPausedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallIsMyVideoPaused#e374f199 as nil") - } - b.PutID(ToggleGroupCallIsMyVideoPausedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleGroupCallIsMyVideoPausedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallIsMyVideoPaused#e374f199 as nil") - } - b.PutInt32(t.GroupCallID) - b.PutBool(t.IsMyVideoPaused) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleGroupCallIsMyVideoPausedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallIsMyVideoPaused#e374f199 to nil") - } - if err := b.ConsumeID(ToggleGroupCallIsMyVideoPausedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoPaused#e374f199: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleGroupCallIsMyVideoPausedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallIsMyVideoPaused#e374f199 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoPaused#e374f199: field group_call_id: %w", err) - } - t.GroupCallID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoPaused#e374f199: field is_my_video_paused: %w", err) - } - t.IsMyVideoPaused = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleGroupCallIsMyVideoPausedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallIsMyVideoPaused#e374f199 as nil") - } - b.ObjStart() - b.PutID("toggleGroupCallIsMyVideoPaused") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(t.GroupCallID) - b.Comma() - b.FieldStart("is_my_video_paused") - b.PutBool(t.IsMyVideoPaused) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleGroupCallIsMyVideoPausedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallIsMyVideoPaused#e374f199 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleGroupCallIsMyVideoPaused"); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoPaused#e374f199: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoPaused#e374f199: field group_call_id: %w", err) - } - t.GroupCallID = value - case "is_my_video_paused": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallIsMyVideoPaused#e374f199: field is_my_video_paused: %w", err) - } - t.IsMyVideoPaused = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (t *ToggleGroupCallIsMyVideoPausedRequest) GetGroupCallID() (value int32) { - if t == nil { - return - } - return t.GroupCallID -} - -// GetIsMyVideoPaused returns value of IsMyVideoPaused field. -func (t *ToggleGroupCallIsMyVideoPausedRequest) GetIsMyVideoPaused() (value bool) { - if t == nil { - return - } - return t.IsMyVideoPaused -} - -// ToggleGroupCallIsMyVideoPaused invokes method toggleGroupCallIsMyVideoPaused#e374f199 returning error if any. -func (c *Client) ToggleGroupCallIsMyVideoPaused(ctx context.Context, request *ToggleGroupCallIsMyVideoPausedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_group_call_mute_new_participants_gen.go b/tdapi/tl_toggle_group_call_mute_new_participants_gen.go deleted file mode 100644 index 78f97c25d..000000000 --- a/tdapi/tl_toggle_group_call_mute_new_participants_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleGroupCallMuteNewParticipantsRequest represents TL type `toggleGroupCallMuteNewParticipants#10eec1c2`. -type ToggleGroupCallMuteNewParticipantsRequest struct { - // Group call identifier - GroupCallID int32 - // New value of the mute_new_participants setting - MuteNewParticipants bool -} - -// ToggleGroupCallMuteNewParticipantsRequestTypeID is TL type id of ToggleGroupCallMuteNewParticipantsRequest. -const ToggleGroupCallMuteNewParticipantsRequestTypeID = 0x10eec1c2 - -// Ensuring interfaces in compile-time for ToggleGroupCallMuteNewParticipantsRequest. -var ( - _ bin.Encoder = &ToggleGroupCallMuteNewParticipantsRequest{} - _ bin.Decoder = &ToggleGroupCallMuteNewParticipantsRequest{} - _ bin.BareEncoder = &ToggleGroupCallMuteNewParticipantsRequest{} - _ bin.BareDecoder = &ToggleGroupCallMuteNewParticipantsRequest{} -) - -func (t *ToggleGroupCallMuteNewParticipantsRequest) Zero() bool { - if t == nil { - return true - } - if !(t.GroupCallID == 0) { - return false - } - if !(t.MuteNewParticipants == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleGroupCallMuteNewParticipantsRequest) String() string { - if t == nil { - return "ToggleGroupCallMuteNewParticipantsRequest(nil)" - } - type Alias ToggleGroupCallMuteNewParticipantsRequest - return fmt.Sprintf("ToggleGroupCallMuteNewParticipantsRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleGroupCallMuteNewParticipantsRequest) TypeID() uint32 { - return ToggleGroupCallMuteNewParticipantsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleGroupCallMuteNewParticipantsRequest) TypeName() string { - return "toggleGroupCallMuteNewParticipants" -} - -// TypeInfo returns info about TL type. -func (t *ToggleGroupCallMuteNewParticipantsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleGroupCallMuteNewParticipants", - ID: ToggleGroupCallMuteNewParticipantsRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "MuteNewParticipants", - SchemaName: "mute_new_participants", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleGroupCallMuteNewParticipantsRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallMuteNewParticipants#10eec1c2 as nil") - } - b.PutID(ToggleGroupCallMuteNewParticipantsRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleGroupCallMuteNewParticipantsRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallMuteNewParticipants#10eec1c2 as nil") - } - b.PutInt32(t.GroupCallID) - b.PutBool(t.MuteNewParticipants) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleGroupCallMuteNewParticipantsRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallMuteNewParticipants#10eec1c2 to nil") - } - if err := b.ConsumeID(ToggleGroupCallMuteNewParticipantsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallMuteNewParticipants#10eec1c2: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleGroupCallMuteNewParticipantsRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallMuteNewParticipants#10eec1c2 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallMuteNewParticipants#10eec1c2: field group_call_id: %w", err) - } - t.GroupCallID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallMuteNewParticipants#10eec1c2: field mute_new_participants: %w", err) - } - t.MuteNewParticipants = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleGroupCallMuteNewParticipantsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallMuteNewParticipants#10eec1c2 as nil") - } - b.ObjStart() - b.PutID("toggleGroupCallMuteNewParticipants") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(t.GroupCallID) - b.Comma() - b.FieldStart("mute_new_participants") - b.PutBool(t.MuteNewParticipants) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleGroupCallMuteNewParticipantsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallMuteNewParticipants#10eec1c2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleGroupCallMuteNewParticipants"); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallMuteNewParticipants#10eec1c2: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallMuteNewParticipants#10eec1c2: field group_call_id: %w", err) - } - t.GroupCallID = value - case "mute_new_participants": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallMuteNewParticipants#10eec1c2: field mute_new_participants: %w", err) - } - t.MuteNewParticipants = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (t *ToggleGroupCallMuteNewParticipantsRequest) GetGroupCallID() (value int32) { - if t == nil { - return - } - return t.GroupCallID -} - -// GetMuteNewParticipants returns value of MuteNewParticipants field. -func (t *ToggleGroupCallMuteNewParticipantsRequest) GetMuteNewParticipants() (value bool) { - if t == nil { - return - } - return t.MuteNewParticipants -} - -// ToggleGroupCallMuteNewParticipants invokes method toggleGroupCallMuteNewParticipants#10eec1c2 returning error if any. -func (c *Client) ToggleGroupCallMuteNewParticipants(ctx context.Context, request *ToggleGroupCallMuteNewParticipantsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_group_call_participant_is_hand_raised_gen.go b/tdapi/tl_toggle_group_call_participant_is_hand_raised_gen.go deleted file mode 100644 index a7e400977..000000000 --- a/tdapi/tl_toggle_group_call_participant_is_hand_raised_gen.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleGroupCallParticipantIsHandRaisedRequest represents TL type `toggleGroupCallParticipantIsHandRaised#8efb63e1`. -type ToggleGroupCallParticipantIsHandRaisedRequest struct { - // Group call identifier - GroupCallID int32 - // Participant identifier - ParticipantID MessageSenderClass - // Pass true if the user's hand needs to be raised. Only self hand can be raised. - // Requires groupCall.can_be_managed group call flag to lower other's hand - IsHandRaised bool -} - -// ToggleGroupCallParticipantIsHandRaisedRequestTypeID is TL type id of ToggleGroupCallParticipantIsHandRaisedRequest. -const ToggleGroupCallParticipantIsHandRaisedRequestTypeID = 0x8efb63e1 - -// Ensuring interfaces in compile-time for ToggleGroupCallParticipantIsHandRaisedRequest. -var ( - _ bin.Encoder = &ToggleGroupCallParticipantIsHandRaisedRequest{} - _ bin.Decoder = &ToggleGroupCallParticipantIsHandRaisedRequest{} - _ bin.BareEncoder = &ToggleGroupCallParticipantIsHandRaisedRequest{} - _ bin.BareDecoder = &ToggleGroupCallParticipantIsHandRaisedRequest{} -) - -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.GroupCallID == 0) { - return false - } - if !(t.ParticipantID == nil) { - return false - } - if !(t.IsHandRaised == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) String() string { - if t == nil { - return "ToggleGroupCallParticipantIsHandRaisedRequest(nil)" - } - type Alias ToggleGroupCallParticipantIsHandRaisedRequest - return fmt.Sprintf("ToggleGroupCallParticipantIsHandRaisedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleGroupCallParticipantIsHandRaisedRequest) TypeID() uint32 { - return ToggleGroupCallParticipantIsHandRaisedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleGroupCallParticipantIsHandRaisedRequest) TypeName() string { - return "toggleGroupCallParticipantIsHandRaised" -} - -// TypeInfo returns info about TL type. -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleGroupCallParticipantIsHandRaised", - ID: ToggleGroupCallParticipantIsHandRaisedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "ParticipantID", - SchemaName: "participant_id", - }, - { - Name: "IsHandRaised", - SchemaName: "is_hand_raised", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallParticipantIsHandRaised#8efb63e1 as nil") - } - b.PutID(ToggleGroupCallParticipantIsHandRaisedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallParticipantIsHandRaised#8efb63e1 as nil") - } - b.PutInt32(t.GroupCallID) - if t.ParticipantID == nil { - return fmt.Errorf("unable to encode toggleGroupCallParticipantIsHandRaised#8efb63e1: field participant_id is nil") - } - if err := t.ParticipantID.Encode(b); err != nil { - return fmt.Errorf("unable to encode toggleGroupCallParticipantIsHandRaised#8efb63e1: field participant_id: %w", err) - } - b.PutBool(t.IsHandRaised) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallParticipantIsHandRaised#8efb63e1 to nil") - } - if err := b.ConsumeID(ToggleGroupCallParticipantIsHandRaisedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsHandRaised#8efb63e1: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallParticipantIsHandRaised#8efb63e1 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsHandRaised#8efb63e1: field group_call_id: %w", err) - } - t.GroupCallID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsHandRaised#8efb63e1: field participant_id: %w", err) - } - t.ParticipantID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsHandRaised#8efb63e1: field is_hand_raised: %w", err) - } - t.IsHandRaised = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallParticipantIsHandRaised#8efb63e1 as nil") - } - b.ObjStart() - b.PutID("toggleGroupCallParticipantIsHandRaised") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(t.GroupCallID) - b.Comma() - b.FieldStart("participant_id") - if t.ParticipantID == nil { - return fmt.Errorf("unable to encode toggleGroupCallParticipantIsHandRaised#8efb63e1: field participant_id is nil") - } - if err := t.ParticipantID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode toggleGroupCallParticipantIsHandRaised#8efb63e1: field participant_id: %w", err) - } - b.Comma() - b.FieldStart("is_hand_raised") - b.PutBool(t.IsHandRaised) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallParticipantIsHandRaised#8efb63e1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleGroupCallParticipantIsHandRaised"); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsHandRaised#8efb63e1: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsHandRaised#8efb63e1: field group_call_id: %w", err) - } - t.GroupCallID = value - case "participant_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsHandRaised#8efb63e1: field participant_id: %w", err) - } - t.ParticipantID = value - case "is_hand_raised": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsHandRaised#8efb63e1: field is_hand_raised: %w", err) - } - t.IsHandRaised = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) GetGroupCallID() (value int32) { - if t == nil { - return - } - return t.GroupCallID -} - -// GetParticipantID returns value of ParticipantID field. -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) GetParticipantID() (value MessageSenderClass) { - if t == nil { - return - } - return t.ParticipantID -} - -// GetIsHandRaised returns value of IsHandRaised field. -func (t *ToggleGroupCallParticipantIsHandRaisedRequest) GetIsHandRaised() (value bool) { - if t == nil { - return - } - return t.IsHandRaised -} - -// ToggleGroupCallParticipantIsHandRaised invokes method toggleGroupCallParticipantIsHandRaised#8efb63e1 returning error if any. -func (c *Client) ToggleGroupCallParticipantIsHandRaised(ctx context.Context, request *ToggleGroupCallParticipantIsHandRaisedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_group_call_participant_is_muted_gen.go b/tdapi/tl_toggle_group_call_participant_is_muted_gen.go deleted file mode 100644 index 57d11f856..000000000 --- a/tdapi/tl_toggle_group_call_participant_is_muted_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleGroupCallParticipantIsMutedRequest represents TL type `toggleGroupCallParticipantIsMuted#b2081407`. -type ToggleGroupCallParticipantIsMutedRequest struct { - // Group call identifier - GroupCallID int32 - // Participant identifier - ParticipantID MessageSenderClass - // Pass true to mute the user; pass false to unmute them - IsMuted bool -} - -// ToggleGroupCallParticipantIsMutedRequestTypeID is TL type id of ToggleGroupCallParticipantIsMutedRequest. -const ToggleGroupCallParticipantIsMutedRequestTypeID = 0xb2081407 - -// Ensuring interfaces in compile-time for ToggleGroupCallParticipantIsMutedRequest. -var ( - _ bin.Encoder = &ToggleGroupCallParticipantIsMutedRequest{} - _ bin.Decoder = &ToggleGroupCallParticipantIsMutedRequest{} - _ bin.BareEncoder = &ToggleGroupCallParticipantIsMutedRequest{} - _ bin.BareDecoder = &ToggleGroupCallParticipantIsMutedRequest{} -) - -func (t *ToggleGroupCallParticipantIsMutedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.GroupCallID == 0) { - return false - } - if !(t.ParticipantID == nil) { - return false - } - if !(t.IsMuted == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleGroupCallParticipantIsMutedRequest) String() string { - if t == nil { - return "ToggleGroupCallParticipantIsMutedRequest(nil)" - } - type Alias ToggleGroupCallParticipantIsMutedRequest - return fmt.Sprintf("ToggleGroupCallParticipantIsMutedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleGroupCallParticipantIsMutedRequest) TypeID() uint32 { - return ToggleGroupCallParticipantIsMutedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleGroupCallParticipantIsMutedRequest) TypeName() string { - return "toggleGroupCallParticipantIsMuted" -} - -// TypeInfo returns info about TL type. -func (t *ToggleGroupCallParticipantIsMutedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleGroupCallParticipantIsMuted", - ID: ToggleGroupCallParticipantIsMutedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "ParticipantID", - SchemaName: "participant_id", - }, - { - Name: "IsMuted", - SchemaName: "is_muted", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleGroupCallParticipantIsMutedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallParticipantIsMuted#b2081407 as nil") - } - b.PutID(ToggleGroupCallParticipantIsMutedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleGroupCallParticipantIsMutedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallParticipantIsMuted#b2081407 as nil") - } - b.PutInt32(t.GroupCallID) - if t.ParticipantID == nil { - return fmt.Errorf("unable to encode toggleGroupCallParticipantIsMuted#b2081407: field participant_id is nil") - } - if err := t.ParticipantID.Encode(b); err != nil { - return fmt.Errorf("unable to encode toggleGroupCallParticipantIsMuted#b2081407: field participant_id: %w", err) - } - b.PutBool(t.IsMuted) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleGroupCallParticipantIsMutedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallParticipantIsMuted#b2081407 to nil") - } - if err := b.ConsumeID(ToggleGroupCallParticipantIsMutedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsMuted#b2081407: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleGroupCallParticipantIsMutedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallParticipantIsMuted#b2081407 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsMuted#b2081407: field group_call_id: %w", err) - } - t.GroupCallID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsMuted#b2081407: field participant_id: %w", err) - } - t.ParticipantID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsMuted#b2081407: field is_muted: %w", err) - } - t.IsMuted = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleGroupCallParticipantIsMutedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallParticipantIsMuted#b2081407 as nil") - } - b.ObjStart() - b.PutID("toggleGroupCallParticipantIsMuted") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(t.GroupCallID) - b.Comma() - b.FieldStart("participant_id") - if t.ParticipantID == nil { - return fmt.Errorf("unable to encode toggleGroupCallParticipantIsMuted#b2081407: field participant_id is nil") - } - if err := t.ParticipantID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode toggleGroupCallParticipantIsMuted#b2081407: field participant_id: %w", err) - } - b.Comma() - b.FieldStart("is_muted") - b.PutBool(t.IsMuted) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleGroupCallParticipantIsMutedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallParticipantIsMuted#b2081407 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleGroupCallParticipantIsMuted"); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsMuted#b2081407: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsMuted#b2081407: field group_call_id: %w", err) - } - t.GroupCallID = value - case "participant_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsMuted#b2081407: field participant_id: %w", err) - } - t.ParticipantID = value - case "is_muted": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallParticipantIsMuted#b2081407: field is_muted: %w", err) - } - t.IsMuted = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (t *ToggleGroupCallParticipantIsMutedRequest) GetGroupCallID() (value int32) { - if t == nil { - return - } - return t.GroupCallID -} - -// GetParticipantID returns value of ParticipantID field. -func (t *ToggleGroupCallParticipantIsMutedRequest) GetParticipantID() (value MessageSenderClass) { - if t == nil { - return - } - return t.ParticipantID -} - -// GetIsMuted returns value of IsMuted field. -func (t *ToggleGroupCallParticipantIsMutedRequest) GetIsMuted() (value bool) { - if t == nil { - return - } - return t.IsMuted -} - -// ToggleGroupCallParticipantIsMuted invokes method toggleGroupCallParticipantIsMuted#b2081407 returning error if any. -func (c *Client) ToggleGroupCallParticipantIsMuted(ctx context.Context, request *ToggleGroupCallParticipantIsMutedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_group_call_screen_sharing_is_paused_gen.go b/tdapi/tl_toggle_group_call_screen_sharing_is_paused_gen.go deleted file mode 100644 index 0959c0fed..000000000 --- a/tdapi/tl_toggle_group_call_screen_sharing_is_paused_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleGroupCallScreenSharingIsPausedRequest represents TL type `toggleGroupCallScreenSharingIsPaused#a07b5360`. -type ToggleGroupCallScreenSharingIsPausedRequest struct { - // Group call identifier - GroupCallID int32 - // Pass true to pause screen sharing; pass false to unpause it - IsPaused bool -} - -// ToggleGroupCallScreenSharingIsPausedRequestTypeID is TL type id of ToggleGroupCallScreenSharingIsPausedRequest. -const ToggleGroupCallScreenSharingIsPausedRequestTypeID = 0xa07b5360 - -// Ensuring interfaces in compile-time for ToggleGroupCallScreenSharingIsPausedRequest. -var ( - _ bin.Encoder = &ToggleGroupCallScreenSharingIsPausedRequest{} - _ bin.Decoder = &ToggleGroupCallScreenSharingIsPausedRequest{} - _ bin.BareEncoder = &ToggleGroupCallScreenSharingIsPausedRequest{} - _ bin.BareDecoder = &ToggleGroupCallScreenSharingIsPausedRequest{} -) - -func (t *ToggleGroupCallScreenSharingIsPausedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.GroupCallID == 0) { - return false - } - if !(t.IsPaused == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleGroupCallScreenSharingIsPausedRequest) String() string { - if t == nil { - return "ToggleGroupCallScreenSharingIsPausedRequest(nil)" - } - type Alias ToggleGroupCallScreenSharingIsPausedRequest - return fmt.Sprintf("ToggleGroupCallScreenSharingIsPausedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleGroupCallScreenSharingIsPausedRequest) TypeID() uint32 { - return ToggleGroupCallScreenSharingIsPausedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleGroupCallScreenSharingIsPausedRequest) TypeName() string { - return "toggleGroupCallScreenSharingIsPaused" -} - -// TypeInfo returns info about TL type. -func (t *ToggleGroupCallScreenSharingIsPausedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleGroupCallScreenSharingIsPaused", - ID: ToggleGroupCallScreenSharingIsPausedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "IsPaused", - SchemaName: "is_paused", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleGroupCallScreenSharingIsPausedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallScreenSharingIsPaused#a07b5360 as nil") - } - b.PutID(ToggleGroupCallScreenSharingIsPausedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleGroupCallScreenSharingIsPausedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallScreenSharingIsPaused#a07b5360 as nil") - } - b.PutInt32(t.GroupCallID) - b.PutBool(t.IsPaused) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleGroupCallScreenSharingIsPausedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallScreenSharingIsPaused#a07b5360 to nil") - } - if err := b.ConsumeID(ToggleGroupCallScreenSharingIsPausedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallScreenSharingIsPaused#a07b5360: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleGroupCallScreenSharingIsPausedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallScreenSharingIsPaused#a07b5360 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallScreenSharingIsPaused#a07b5360: field group_call_id: %w", err) - } - t.GroupCallID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallScreenSharingIsPaused#a07b5360: field is_paused: %w", err) - } - t.IsPaused = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleGroupCallScreenSharingIsPausedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleGroupCallScreenSharingIsPaused#a07b5360 as nil") - } - b.ObjStart() - b.PutID("toggleGroupCallScreenSharingIsPaused") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(t.GroupCallID) - b.Comma() - b.FieldStart("is_paused") - b.PutBool(t.IsPaused) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleGroupCallScreenSharingIsPausedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleGroupCallScreenSharingIsPaused#a07b5360 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleGroupCallScreenSharingIsPaused"); err != nil { - return fmt.Errorf("unable to decode toggleGroupCallScreenSharingIsPaused#a07b5360: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallScreenSharingIsPaused#a07b5360: field group_call_id: %w", err) - } - t.GroupCallID = value - case "is_paused": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleGroupCallScreenSharingIsPaused#a07b5360: field is_paused: %w", err) - } - t.IsPaused = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (t *ToggleGroupCallScreenSharingIsPausedRequest) GetGroupCallID() (value int32) { - if t == nil { - return - } - return t.GroupCallID -} - -// GetIsPaused returns value of IsPaused field. -func (t *ToggleGroupCallScreenSharingIsPausedRequest) GetIsPaused() (value bool) { - if t == nil { - return - } - return t.IsPaused -} - -// ToggleGroupCallScreenSharingIsPaused invokes method toggleGroupCallScreenSharingIsPaused#a07b5360 returning error if any. -func (c *Client) ToggleGroupCallScreenSharingIsPaused(ctx context.Context, request *ToggleGroupCallScreenSharingIsPausedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_has_sponsored_messages_enabled_gen.go b/tdapi/tl_toggle_has_sponsored_messages_enabled_gen.go deleted file mode 100644 index 5cfe4abb1..000000000 --- a/tdapi/tl_toggle_has_sponsored_messages_enabled_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleHasSponsoredMessagesEnabledRequest represents TL type `toggleHasSponsoredMessagesEnabled#75055cec`. -type ToggleHasSponsoredMessagesEnabledRequest struct { - // Pass true to enable sponsored messages for the current user; false to disable them - HasSponsoredMessagesEnabled bool -} - -// ToggleHasSponsoredMessagesEnabledRequestTypeID is TL type id of ToggleHasSponsoredMessagesEnabledRequest. -const ToggleHasSponsoredMessagesEnabledRequestTypeID = 0x75055cec - -// Ensuring interfaces in compile-time for ToggleHasSponsoredMessagesEnabledRequest. -var ( - _ bin.Encoder = &ToggleHasSponsoredMessagesEnabledRequest{} - _ bin.Decoder = &ToggleHasSponsoredMessagesEnabledRequest{} - _ bin.BareEncoder = &ToggleHasSponsoredMessagesEnabledRequest{} - _ bin.BareDecoder = &ToggleHasSponsoredMessagesEnabledRequest{} -) - -func (t *ToggleHasSponsoredMessagesEnabledRequest) Zero() bool { - if t == nil { - return true - } - if !(t.HasSponsoredMessagesEnabled == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleHasSponsoredMessagesEnabledRequest) String() string { - if t == nil { - return "ToggleHasSponsoredMessagesEnabledRequest(nil)" - } - type Alias ToggleHasSponsoredMessagesEnabledRequest - return fmt.Sprintf("ToggleHasSponsoredMessagesEnabledRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleHasSponsoredMessagesEnabledRequest) TypeID() uint32 { - return ToggleHasSponsoredMessagesEnabledRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleHasSponsoredMessagesEnabledRequest) TypeName() string { - return "toggleHasSponsoredMessagesEnabled" -} - -// TypeInfo returns info about TL type. -func (t *ToggleHasSponsoredMessagesEnabledRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleHasSponsoredMessagesEnabled", - ID: ToggleHasSponsoredMessagesEnabledRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "HasSponsoredMessagesEnabled", - SchemaName: "has_sponsored_messages_enabled", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleHasSponsoredMessagesEnabledRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleHasSponsoredMessagesEnabled#75055cec as nil") - } - b.PutID(ToggleHasSponsoredMessagesEnabledRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleHasSponsoredMessagesEnabledRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleHasSponsoredMessagesEnabled#75055cec as nil") - } - b.PutBool(t.HasSponsoredMessagesEnabled) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleHasSponsoredMessagesEnabledRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleHasSponsoredMessagesEnabled#75055cec to nil") - } - if err := b.ConsumeID(ToggleHasSponsoredMessagesEnabledRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleHasSponsoredMessagesEnabled#75055cec: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleHasSponsoredMessagesEnabledRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleHasSponsoredMessagesEnabled#75055cec to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleHasSponsoredMessagesEnabled#75055cec: field has_sponsored_messages_enabled: %w", err) - } - t.HasSponsoredMessagesEnabled = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleHasSponsoredMessagesEnabledRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleHasSponsoredMessagesEnabled#75055cec as nil") - } - b.ObjStart() - b.PutID("toggleHasSponsoredMessagesEnabled") - b.Comma() - b.FieldStart("has_sponsored_messages_enabled") - b.PutBool(t.HasSponsoredMessagesEnabled) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleHasSponsoredMessagesEnabledRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleHasSponsoredMessagesEnabled#75055cec to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleHasSponsoredMessagesEnabled"); err != nil { - return fmt.Errorf("unable to decode toggleHasSponsoredMessagesEnabled#75055cec: %w", err) - } - case "has_sponsored_messages_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleHasSponsoredMessagesEnabled#75055cec: field has_sponsored_messages_enabled: %w", err) - } - t.HasSponsoredMessagesEnabled = value - default: - return b.Skip() - } - return nil - }) -} - -// GetHasSponsoredMessagesEnabled returns value of HasSponsoredMessagesEnabled field. -func (t *ToggleHasSponsoredMessagesEnabledRequest) GetHasSponsoredMessagesEnabled() (value bool) { - if t == nil { - return - } - return t.HasSponsoredMessagesEnabled -} - -// ToggleHasSponsoredMessagesEnabled invokes method toggleHasSponsoredMessagesEnabled#75055cec returning error if any. -func (c *Client) ToggleHasSponsoredMessagesEnabled(ctx context.Context, hassponsoredmessagesenabled bool) error { - var ok Ok - - request := &ToggleHasSponsoredMessagesEnabledRequest{ - HasSponsoredMessagesEnabled: hassponsoredmessagesenabled, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_paid_message_reaction_is_anonymous_gen.go b/tdapi/tl_toggle_paid_message_reaction_is_anonymous_gen.go deleted file mode 100644 index a67950ba3..000000000 --- a/tdapi/tl_toggle_paid_message_reaction_is_anonymous_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TogglePaidMessageReactionIsAnonymousRequest represents TL type `togglePaidMessageReactionIsAnonymous#9774db11`. -type TogglePaidMessageReactionIsAnonymousRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // Pass true to make paid reaction of the user on the message anonymous; pass false to - // make the user's profile visible among top reactors - IsAnonymous bool -} - -// TogglePaidMessageReactionIsAnonymousRequestTypeID is TL type id of TogglePaidMessageReactionIsAnonymousRequest. -const TogglePaidMessageReactionIsAnonymousRequestTypeID = 0x9774db11 - -// Ensuring interfaces in compile-time for TogglePaidMessageReactionIsAnonymousRequest. -var ( - _ bin.Encoder = &TogglePaidMessageReactionIsAnonymousRequest{} - _ bin.Decoder = &TogglePaidMessageReactionIsAnonymousRequest{} - _ bin.BareEncoder = &TogglePaidMessageReactionIsAnonymousRequest{} - _ bin.BareDecoder = &TogglePaidMessageReactionIsAnonymousRequest{} -) - -func (t *TogglePaidMessageReactionIsAnonymousRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.MessageID == 0) { - return false - } - if !(t.IsAnonymous == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TogglePaidMessageReactionIsAnonymousRequest) String() string { - if t == nil { - return "TogglePaidMessageReactionIsAnonymousRequest(nil)" - } - type Alias TogglePaidMessageReactionIsAnonymousRequest - return fmt.Sprintf("TogglePaidMessageReactionIsAnonymousRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TogglePaidMessageReactionIsAnonymousRequest) TypeID() uint32 { - return TogglePaidMessageReactionIsAnonymousRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TogglePaidMessageReactionIsAnonymousRequest) TypeName() string { - return "togglePaidMessageReactionIsAnonymous" -} - -// TypeInfo returns info about TL type. -func (t *TogglePaidMessageReactionIsAnonymousRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "togglePaidMessageReactionIsAnonymous", - ID: TogglePaidMessageReactionIsAnonymousRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "IsAnonymous", - SchemaName: "is_anonymous", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TogglePaidMessageReactionIsAnonymousRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode togglePaidMessageReactionIsAnonymous#9774db11 as nil") - } - b.PutID(TogglePaidMessageReactionIsAnonymousRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TogglePaidMessageReactionIsAnonymousRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode togglePaidMessageReactionIsAnonymous#9774db11 as nil") - } - b.PutInt53(t.ChatID) - b.PutInt53(t.MessageID) - b.PutBool(t.IsAnonymous) - return nil -} - -// Decode implements bin.Decoder. -func (t *TogglePaidMessageReactionIsAnonymousRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode togglePaidMessageReactionIsAnonymous#9774db11 to nil") - } - if err := b.ConsumeID(TogglePaidMessageReactionIsAnonymousRequestTypeID); err != nil { - return fmt.Errorf("unable to decode togglePaidMessageReactionIsAnonymous#9774db11: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TogglePaidMessageReactionIsAnonymousRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode togglePaidMessageReactionIsAnonymous#9774db11 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode togglePaidMessageReactionIsAnonymous#9774db11: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode togglePaidMessageReactionIsAnonymous#9774db11: field message_id: %w", err) - } - t.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode togglePaidMessageReactionIsAnonymous#9774db11: field is_anonymous: %w", err) - } - t.IsAnonymous = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TogglePaidMessageReactionIsAnonymousRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode togglePaidMessageReactionIsAnonymous#9774db11 as nil") - } - b.ObjStart() - b.PutID("togglePaidMessageReactionIsAnonymous") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(t.MessageID) - b.Comma() - b.FieldStart("is_anonymous") - b.PutBool(t.IsAnonymous) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TogglePaidMessageReactionIsAnonymousRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode togglePaidMessageReactionIsAnonymous#9774db11 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("togglePaidMessageReactionIsAnonymous"); err != nil { - return fmt.Errorf("unable to decode togglePaidMessageReactionIsAnonymous#9774db11: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode togglePaidMessageReactionIsAnonymous#9774db11: field chat_id: %w", err) - } - t.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode togglePaidMessageReactionIsAnonymous#9774db11: field message_id: %w", err) - } - t.MessageID = value - case "is_anonymous": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode togglePaidMessageReactionIsAnonymous#9774db11: field is_anonymous: %w", err) - } - t.IsAnonymous = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *TogglePaidMessageReactionIsAnonymousRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetMessageID returns value of MessageID field. -func (t *TogglePaidMessageReactionIsAnonymousRequest) GetMessageID() (value int64) { - if t == nil { - return - } - return t.MessageID -} - -// GetIsAnonymous returns value of IsAnonymous field. -func (t *TogglePaidMessageReactionIsAnonymousRequest) GetIsAnonymous() (value bool) { - if t == nil { - return - } - return t.IsAnonymous -} - -// TogglePaidMessageReactionIsAnonymous invokes method togglePaidMessageReactionIsAnonymous#9774db11 returning error if any. -func (c *Client) TogglePaidMessageReactionIsAnonymous(ctx context.Context, request *TogglePaidMessageReactionIsAnonymousRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_saved_messages_topic_is_pinned_gen.go b/tdapi/tl_toggle_saved_messages_topic_is_pinned_gen.go deleted file mode 100644 index 3f931a4ff..000000000 --- a/tdapi/tl_toggle_saved_messages_topic_is_pinned_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSavedMessagesTopicIsPinnedRequest represents TL type `toggleSavedMessagesTopicIsPinned#a15345cc`. -type ToggleSavedMessagesTopicIsPinnedRequest struct { - // Identifier of Saved Messages topic to pin or unpin - SavedMessagesTopicID int64 - // Pass true to pin the topic; pass false to unpin it - IsPinned bool -} - -// ToggleSavedMessagesTopicIsPinnedRequestTypeID is TL type id of ToggleSavedMessagesTopicIsPinnedRequest. -const ToggleSavedMessagesTopicIsPinnedRequestTypeID = 0xa15345cc - -// Ensuring interfaces in compile-time for ToggleSavedMessagesTopicIsPinnedRequest. -var ( - _ bin.Encoder = &ToggleSavedMessagesTopicIsPinnedRequest{} - _ bin.Decoder = &ToggleSavedMessagesTopicIsPinnedRequest{} - _ bin.BareEncoder = &ToggleSavedMessagesTopicIsPinnedRequest{} - _ bin.BareDecoder = &ToggleSavedMessagesTopicIsPinnedRequest{} -) - -func (t *ToggleSavedMessagesTopicIsPinnedRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SavedMessagesTopicID == 0) { - return false - } - if !(t.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSavedMessagesTopicIsPinnedRequest) String() string { - if t == nil { - return "ToggleSavedMessagesTopicIsPinnedRequest(nil)" - } - type Alias ToggleSavedMessagesTopicIsPinnedRequest - return fmt.Sprintf("ToggleSavedMessagesTopicIsPinnedRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSavedMessagesTopicIsPinnedRequest) TypeID() uint32 { - return ToggleSavedMessagesTopicIsPinnedRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSavedMessagesTopicIsPinnedRequest) TypeName() string { - return "toggleSavedMessagesTopicIsPinned" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSavedMessagesTopicIsPinnedRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSavedMessagesTopicIsPinned", - ID: ToggleSavedMessagesTopicIsPinnedRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSavedMessagesTopicIsPinnedRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSavedMessagesTopicIsPinned#a15345cc as nil") - } - b.PutID(ToggleSavedMessagesTopicIsPinnedRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSavedMessagesTopicIsPinnedRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSavedMessagesTopicIsPinned#a15345cc as nil") - } - b.PutInt53(t.SavedMessagesTopicID) - b.PutBool(t.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSavedMessagesTopicIsPinnedRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSavedMessagesTopicIsPinned#a15345cc to nil") - } - if err := b.ConsumeID(ToggleSavedMessagesTopicIsPinnedRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSavedMessagesTopicIsPinnedRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSavedMessagesTopicIsPinned#a15345cc to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: field saved_messages_topic_id: %w", err) - } - t.SavedMessagesTopicID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: field is_pinned: %w", err) - } - t.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSavedMessagesTopicIsPinnedRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSavedMessagesTopicIsPinned#a15345cc as nil") - } - b.ObjStart() - b.PutID("toggleSavedMessagesTopicIsPinned") - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(t.SavedMessagesTopicID) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(t.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSavedMessagesTopicIsPinnedRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSavedMessagesTopicIsPinned#a15345cc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSavedMessagesTopicIsPinned"); err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: %w", err) - } - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: field saved_messages_topic_id: %w", err) - } - t.SavedMessagesTopicID = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSavedMessagesTopicIsPinned#a15345cc: field is_pinned: %w", err) - } - t.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (t *ToggleSavedMessagesTopicIsPinnedRequest) GetSavedMessagesTopicID() (value int64) { - if t == nil { - return - } - return t.SavedMessagesTopicID -} - -// GetIsPinned returns value of IsPinned field. -func (t *ToggleSavedMessagesTopicIsPinnedRequest) GetIsPinned() (value bool) { - if t == nil { - return - } - return t.IsPinned -} - -// ToggleSavedMessagesTopicIsPinned invokes method toggleSavedMessagesTopicIsPinned#a15345cc returning error if any. -func (c *Client) ToggleSavedMessagesTopicIsPinned(ctx context.Context, request *ToggleSavedMessagesTopicIsPinnedRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_session_can_accept_calls_gen.go b/tdapi/tl_toggle_session_can_accept_calls_gen.go deleted file mode 100644 index f4261b7de..000000000 --- a/tdapi/tl_toggle_session_can_accept_calls_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSessionCanAcceptCallsRequest represents TL type `toggleSessionCanAcceptCalls#6c6c2708`. -type ToggleSessionCanAcceptCallsRequest struct { - // Session identifier - SessionID int64 - // Pass true to allow accepting incoming calls by the session; pass false otherwise - CanAcceptCalls bool -} - -// ToggleSessionCanAcceptCallsRequestTypeID is TL type id of ToggleSessionCanAcceptCallsRequest. -const ToggleSessionCanAcceptCallsRequestTypeID = 0x6c6c2708 - -// Ensuring interfaces in compile-time for ToggleSessionCanAcceptCallsRequest. -var ( - _ bin.Encoder = &ToggleSessionCanAcceptCallsRequest{} - _ bin.Decoder = &ToggleSessionCanAcceptCallsRequest{} - _ bin.BareEncoder = &ToggleSessionCanAcceptCallsRequest{} - _ bin.BareDecoder = &ToggleSessionCanAcceptCallsRequest{} -) - -func (t *ToggleSessionCanAcceptCallsRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SessionID == 0) { - return false - } - if !(t.CanAcceptCalls == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSessionCanAcceptCallsRequest) String() string { - if t == nil { - return "ToggleSessionCanAcceptCallsRequest(nil)" - } - type Alias ToggleSessionCanAcceptCallsRequest - return fmt.Sprintf("ToggleSessionCanAcceptCallsRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSessionCanAcceptCallsRequest) TypeID() uint32 { - return ToggleSessionCanAcceptCallsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSessionCanAcceptCallsRequest) TypeName() string { - return "toggleSessionCanAcceptCalls" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSessionCanAcceptCallsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSessionCanAcceptCalls", - ID: ToggleSessionCanAcceptCallsRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SessionID", - SchemaName: "session_id", - }, - { - Name: "CanAcceptCalls", - SchemaName: "can_accept_calls", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSessionCanAcceptCallsRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSessionCanAcceptCalls#6c6c2708 as nil") - } - b.PutID(ToggleSessionCanAcceptCallsRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSessionCanAcceptCallsRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSessionCanAcceptCalls#6c6c2708 as nil") - } - b.PutLong(t.SessionID) - b.PutBool(t.CanAcceptCalls) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSessionCanAcceptCallsRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSessionCanAcceptCalls#6c6c2708 to nil") - } - if err := b.ConsumeID(ToggleSessionCanAcceptCallsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptCalls#6c6c2708: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSessionCanAcceptCallsRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSessionCanAcceptCalls#6c6c2708 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptCalls#6c6c2708: field session_id: %w", err) - } - t.SessionID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptCalls#6c6c2708: field can_accept_calls: %w", err) - } - t.CanAcceptCalls = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSessionCanAcceptCallsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSessionCanAcceptCalls#6c6c2708 as nil") - } - b.ObjStart() - b.PutID("toggleSessionCanAcceptCalls") - b.Comma() - b.FieldStart("session_id") - b.PutLong(t.SessionID) - b.Comma() - b.FieldStart("can_accept_calls") - b.PutBool(t.CanAcceptCalls) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSessionCanAcceptCallsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSessionCanAcceptCalls#6c6c2708 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSessionCanAcceptCalls"); err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptCalls#6c6c2708: %w", err) - } - case "session_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptCalls#6c6c2708: field session_id: %w", err) - } - t.SessionID = value - case "can_accept_calls": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptCalls#6c6c2708: field can_accept_calls: %w", err) - } - t.CanAcceptCalls = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSessionID returns value of SessionID field. -func (t *ToggleSessionCanAcceptCallsRequest) GetSessionID() (value int64) { - if t == nil { - return - } - return t.SessionID -} - -// GetCanAcceptCalls returns value of CanAcceptCalls field. -func (t *ToggleSessionCanAcceptCallsRequest) GetCanAcceptCalls() (value bool) { - if t == nil { - return - } - return t.CanAcceptCalls -} - -// ToggleSessionCanAcceptCalls invokes method toggleSessionCanAcceptCalls#6c6c2708 returning error if any. -func (c *Client) ToggleSessionCanAcceptCalls(ctx context.Context, request *ToggleSessionCanAcceptCallsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_session_can_accept_secret_chats_gen.go b/tdapi/tl_toggle_session_can_accept_secret_chats_gen.go deleted file mode 100644 index 5e2076287..000000000 --- a/tdapi/tl_toggle_session_can_accept_secret_chats_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSessionCanAcceptSecretChatsRequest represents TL type `toggleSessionCanAcceptSecretChats#3ba7a87e`. -type ToggleSessionCanAcceptSecretChatsRequest struct { - // Session identifier - SessionID int64 - // Pass true to allow accepting secret chats by the session; pass false otherwise - CanAcceptSecretChats bool -} - -// ToggleSessionCanAcceptSecretChatsRequestTypeID is TL type id of ToggleSessionCanAcceptSecretChatsRequest. -const ToggleSessionCanAcceptSecretChatsRequestTypeID = 0x3ba7a87e - -// Ensuring interfaces in compile-time for ToggleSessionCanAcceptSecretChatsRequest. -var ( - _ bin.Encoder = &ToggleSessionCanAcceptSecretChatsRequest{} - _ bin.Decoder = &ToggleSessionCanAcceptSecretChatsRequest{} - _ bin.BareEncoder = &ToggleSessionCanAcceptSecretChatsRequest{} - _ bin.BareDecoder = &ToggleSessionCanAcceptSecretChatsRequest{} -) - -func (t *ToggleSessionCanAcceptSecretChatsRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SessionID == 0) { - return false - } - if !(t.CanAcceptSecretChats == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSessionCanAcceptSecretChatsRequest) String() string { - if t == nil { - return "ToggleSessionCanAcceptSecretChatsRequest(nil)" - } - type Alias ToggleSessionCanAcceptSecretChatsRequest - return fmt.Sprintf("ToggleSessionCanAcceptSecretChatsRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSessionCanAcceptSecretChatsRequest) TypeID() uint32 { - return ToggleSessionCanAcceptSecretChatsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSessionCanAcceptSecretChatsRequest) TypeName() string { - return "toggleSessionCanAcceptSecretChats" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSessionCanAcceptSecretChatsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSessionCanAcceptSecretChats", - ID: ToggleSessionCanAcceptSecretChatsRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SessionID", - SchemaName: "session_id", - }, - { - Name: "CanAcceptSecretChats", - SchemaName: "can_accept_secret_chats", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSessionCanAcceptSecretChatsRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSessionCanAcceptSecretChats#3ba7a87e as nil") - } - b.PutID(ToggleSessionCanAcceptSecretChatsRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSessionCanAcceptSecretChatsRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSessionCanAcceptSecretChats#3ba7a87e as nil") - } - b.PutLong(t.SessionID) - b.PutBool(t.CanAcceptSecretChats) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSessionCanAcceptSecretChatsRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSessionCanAcceptSecretChats#3ba7a87e to nil") - } - if err := b.ConsumeID(ToggleSessionCanAcceptSecretChatsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptSecretChats#3ba7a87e: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSessionCanAcceptSecretChatsRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSessionCanAcceptSecretChats#3ba7a87e to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptSecretChats#3ba7a87e: field session_id: %w", err) - } - t.SessionID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptSecretChats#3ba7a87e: field can_accept_secret_chats: %w", err) - } - t.CanAcceptSecretChats = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSessionCanAcceptSecretChatsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSessionCanAcceptSecretChats#3ba7a87e as nil") - } - b.ObjStart() - b.PutID("toggleSessionCanAcceptSecretChats") - b.Comma() - b.FieldStart("session_id") - b.PutLong(t.SessionID) - b.Comma() - b.FieldStart("can_accept_secret_chats") - b.PutBool(t.CanAcceptSecretChats) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSessionCanAcceptSecretChatsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSessionCanAcceptSecretChats#3ba7a87e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSessionCanAcceptSecretChats"); err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptSecretChats#3ba7a87e: %w", err) - } - case "session_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptSecretChats#3ba7a87e: field session_id: %w", err) - } - t.SessionID = value - case "can_accept_secret_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSessionCanAcceptSecretChats#3ba7a87e: field can_accept_secret_chats: %w", err) - } - t.CanAcceptSecretChats = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSessionID returns value of SessionID field. -func (t *ToggleSessionCanAcceptSecretChatsRequest) GetSessionID() (value int64) { - if t == nil { - return - } - return t.SessionID -} - -// GetCanAcceptSecretChats returns value of CanAcceptSecretChats field. -func (t *ToggleSessionCanAcceptSecretChatsRequest) GetCanAcceptSecretChats() (value bool) { - if t == nil { - return - } - return t.CanAcceptSecretChats -} - -// ToggleSessionCanAcceptSecretChats invokes method toggleSessionCanAcceptSecretChats#3ba7a87e returning error if any. -func (c *Client) ToggleSessionCanAcceptSecretChats(ctx context.Context, request *ToggleSessionCanAcceptSecretChatsRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_story_is_posted_to_chat_page_gen.go b/tdapi/tl_toggle_story_is_posted_to_chat_page_gen.go deleted file mode 100644 index e7034ca36..000000000 --- a/tdapi/tl_toggle_story_is_posted_to_chat_page_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleStoryIsPostedToChatPageRequest represents TL type `toggleStoryIsPostedToChatPage#ee0f4aff`. -type ToggleStoryIsPostedToChatPageRequest struct { - // Identifier of the chat that posted the story - StorySenderChatID int64 - // Identifier of the story - StoryID int32 - // Pass true to make the story accessible after expiration; pass false to make it private - IsPostedToChatPage bool -} - -// ToggleStoryIsPostedToChatPageRequestTypeID is TL type id of ToggleStoryIsPostedToChatPageRequest. -const ToggleStoryIsPostedToChatPageRequestTypeID = 0xee0f4aff - -// Ensuring interfaces in compile-time for ToggleStoryIsPostedToChatPageRequest. -var ( - _ bin.Encoder = &ToggleStoryIsPostedToChatPageRequest{} - _ bin.Decoder = &ToggleStoryIsPostedToChatPageRequest{} - _ bin.BareEncoder = &ToggleStoryIsPostedToChatPageRequest{} - _ bin.BareDecoder = &ToggleStoryIsPostedToChatPageRequest{} -) - -func (t *ToggleStoryIsPostedToChatPageRequest) Zero() bool { - if t == nil { - return true - } - if !(t.StorySenderChatID == 0) { - return false - } - if !(t.StoryID == 0) { - return false - } - if !(t.IsPostedToChatPage == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleStoryIsPostedToChatPageRequest) String() string { - if t == nil { - return "ToggleStoryIsPostedToChatPageRequest(nil)" - } - type Alias ToggleStoryIsPostedToChatPageRequest - return fmt.Sprintf("ToggleStoryIsPostedToChatPageRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleStoryIsPostedToChatPageRequest) TypeID() uint32 { - return ToggleStoryIsPostedToChatPageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleStoryIsPostedToChatPageRequest) TypeName() string { - return "toggleStoryIsPostedToChatPage" -} - -// TypeInfo returns info about TL type. -func (t *ToggleStoryIsPostedToChatPageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleStoryIsPostedToChatPage", - ID: ToggleStoryIsPostedToChatPageRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - { - Name: "IsPostedToChatPage", - SchemaName: "is_posted_to_chat_page", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleStoryIsPostedToChatPageRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleStoryIsPostedToChatPage#ee0f4aff as nil") - } - b.PutID(ToggleStoryIsPostedToChatPageRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleStoryIsPostedToChatPageRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleStoryIsPostedToChatPage#ee0f4aff as nil") - } - b.PutInt53(t.StorySenderChatID) - b.PutInt32(t.StoryID) - b.PutBool(t.IsPostedToChatPage) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleStoryIsPostedToChatPageRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleStoryIsPostedToChatPage#ee0f4aff to nil") - } - if err := b.ConsumeID(ToggleStoryIsPostedToChatPageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleStoryIsPostedToChatPageRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleStoryIsPostedToChatPage#ee0f4aff to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field story_sender_chat_id: %w", err) - } - t.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field story_id: %w", err) - } - t.StoryID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field is_posted_to_chat_page: %w", err) - } - t.IsPostedToChatPage = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleStoryIsPostedToChatPageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleStoryIsPostedToChatPage#ee0f4aff as nil") - } - b.ObjStart() - b.PutID("toggleStoryIsPostedToChatPage") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(t.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(t.StoryID) - b.Comma() - b.FieldStart("is_posted_to_chat_page") - b.PutBool(t.IsPostedToChatPage) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleStoryIsPostedToChatPageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleStoryIsPostedToChatPage#ee0f4aff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleStoryIsPostedToChatPage"); err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field story_sender_chat_id: %w", err) - } - t.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field story_id: %w", err) - } - t.StoryID = value - case "is_posted_to_chat_page": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleStoryIsPostedToChatPage#ee0f4aff: field is_posted_to_chat_page: %w", err) - } - t.IsPostedToChatPage = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (t *ToggleStoryIsPostedToChatPageRequest) GetStorySenderChatID() (value int64) { - if t == nil { - return - } - return t.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (t *ToggleStoryIsPostedToChatPageRequest) GetStoryID() (value int32) { - if t == nil { - return - } - return t.StoryID -} - -// GetIsPostedToChatPage returns value of IsPostedToChatPage field. -func (t *ToggleStoryIsPostedToChatPageRequest) GetIsPostedToChatPage() (value bool) { - if t == nil { - return - } - return t.IsPostedToChatPage -} - -// ToggleStoryIsPostedToChatPage invokes method toggleStoryIsPostedToChatPage#ee0f4aff returning error if any. -func (c *Client) ToggleStoryIsPostedToChatPage(ctx context.Context, request *ToggleStoryIsPostedToChatPageRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_supergroup_can_have_sponsored_messages_gen.go b/tdapi/tl_toggle_supergroup_can_have_sponsored_messages_gen.go deleted file mode 100644 index c76cd2fed..000000000 --- a/tdapi/tl_toggle_supergroup_can_have_sponsored_messages_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSupergroupCanHaveSponsoredMessagesRequest represents TL type `toggleSupergroupCanHaveSponsoredMessages#be8abb72`. -type ToggleSupergroupCanHaveSponsoredMessagesRequest struct { - // The identifier of the channel - SupergroupID int64 - // The new value of can_have_sponsored_messages - CanHaveSponsoredMessages bool -} - -// ToggleSupergroupCanHaveSponsoredMessagesRequestTypeID is TL type id of ToggleSupergroupCanHaveSponsoredMessagesRequest. -const ToggleSupergroupCanHaveSponsoredMessagesRequestTypeID = 0xbe8abb72 - -// Ensuring interfaces in compile-time for ToggleSupergroupCanHaveSponsoredMessagesRequest. -var ( - _ bin.Encoder = &ToggleSupergroupCanHaveSponsoredMessagesRequest{} - _ bin.Decoder = &ToggleSupergroupCanHaveSponsoredMessagesRequest{} - _ bin.BareEncoder = &ToggleSupergroupCanHaveSponsoredMessagesRequest{} - _ bin.BareDecoder = &ToggleSupergroupCanHaveSponsoredMessagesRequest{} -) - -func (t *ToggleSupergroupCanHaveSponsoredMessagesRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SupergroupID == 0) { - return false - } - if !(t.CanHaveSponsoredMessages == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSupergroupCanHaveSponsoredMessagesRequest) String() string { - if t == nil { - return "ToggleSupergroupCanHaveSponsoredMessagesRequest(nil)" - } - type Alias ToggleSupergroupCanHaveSponsoredMessagesRequest - return fmt.Sprintf("ToggleSupergroupCanHaveSponsoredMessagesRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSupergroupCanHaveSponsoredMessagesRequest) TypeID() uint32 { - return ToggleSupergroupCanHaveSponsoredMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSupergroupCanHaveSponsoredMessagesRequest) TypeName() string { - return "toggleSupergroupCanHaveSponsoredMessages" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSupergroupCanHaveSponsoredMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSupergroupCanHaveSponsoredMessages", - ID: ToggleSupergroupCanHaveSponsoredMessagesRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "CanHaveSponsoredMessages", - SchemaName: "can_have_sponsored_messages", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSupergroupCanHaveSponsoredMessagesRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupCanHaveSponsoredMessages#be8abb72 as nil") - } - b.PutID(ToggleSupergroupCanHaveSponsoredMessagesRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSupergroupCanHaveSponsoredMessagesRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupCanHaveSponsoredMessages#be8abb72 as nil") - } - b.PutInt53(t.SupergroupID) - b.PutBool(t.CanHaveSponsoredMessages) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSupergroupCanHaveSponsoredMessagesRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupCanHaveSponsoredMessages#be8abb72 to nil") - } - if err := b.ConsumeID(ToggleSupergroupCanHaveSponsoredMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupCanHaveSponsoredMessages#be8abb72: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSupergroupCanHaveSponsoredMessagesRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupCanHaveSponsoredMessages#be8abb72 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupCanHaveSponsoredMessages#be8abb72: field supergroup_id: %w", err) - } - t.SupergroupID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupCanHaveSponsoredMessages#be8abb72: field can_have_sponsored_messages: %w", err) - } - t.CanHaveSponsoredMessages = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSupergroupCanHaveSponsoredMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupCanHaveSponsoredMessages#be8abb72 as nil") - } - b.ObjStart() - b.PutID("toggleSupergroupCanHaveSponsoredMessages") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(t.SupergroupID) - b.Comma() - b.FieldStart("can_have_sponsored_messages") - b.PutBool(t.CanHaveSponsoredMessages) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSupergroupCanHaveSponsoredMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupCanHaveSponsoredMessages#be8abb72 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSupergroupCanHaveSponsoredMessages"); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupCanHaveSponsoredMessages#be8abb72: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupCanHaveSponsoredMessages#be8abb72: field supergroup_id: %w", err) - } - t.SupergroupID = value - case "can_have_sponsored_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupCanHaveSponsoredMessages#be8abb72: field can_have_sponsored_messages: %w", err) - } - t.CanHaveSponsoredMessages = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (t *ToggleSupergroupCanHaveSponsoredMessagesRequest) GetSupergroupID() (value int64) { - if t == nil { - return - } - return t.SupergroupID -} - -// GetCanHaveSponsoredMessages returns value of CanHaveSponsoredMessages field. -func (t *ToggleSupergroupCanHaveSponsoredMessagesRequest) GetCanHaveSponsoredMessages() (value bool) { - if t == nil { - return - } - return t.CanHaveSponsoredMessages -} - -// ToggleSupergroupCanHaveSponsoredMessages invokes method toggleSupergroupCanHaveSponsoredMessages#be8abb72 returning error if any. -func (c *Client) ToggleSupergroupCanHaveSponsoredMessages(ctx context.Context, request *ToggleSupergroupCanHaveSponsoredMessagesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_supergroup_has_aggressive_anti_spam_enabled_gen.go b/tdapi/tl_toggle_supergroup_has_aggressive_anti_spam_enabled_gen.go deleted file mode 100644 index 416067b00..000000000 --- a/tdapi/tl_toggle_supergroup_has_aggressive_anti_spam_enabled_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSupergroupHasAggressiveAntiSpamEnabledRequest represents TL type `toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f`. -type ToggleSupergroupHasAggressiveAntiSpamEnabledRequest struct { - // The identifier of the supergroup, which isn't a broadcast group - SupergroupID int64 - // The new value of has_aggressive_anti_spam_enabled - HasAggressiveAntiSpamEnabled bool -} - -// ToggleSupergroupHasAggressiveAntiSpamEnabledRequestTypeID is TL type id of ToggleSupergroupHasAggressiveAntiSpamEnabledRequest. -const ToggleSupergroupHasAggressiveAntiSpamEnabledRequestTypeID = 0x683ef70f - -// Ensuring interfaces in compile-time for ToggleSupergroupHasAggressiveAntiSpamEnabledRequest. -var ( - _ bin.Encoder = &ToggleSupergroupHasAggressiveAntiSpamEnabledRequest{} - _ bin.Decoder = &ToggleSupergroupHasAggressiveAntiSpamEnabledRequest{} - _ bin.BareEncoder = &ToggleSupergroupHasAggressiveAntiSpamEnabledRequest{} - _ bin.BareDecoder = &ToggleSupergroupHasAggressiveAntiSpamEnabledRequest{} -) - -func (t *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SupergroupID == 0) { - return false - } - if !(t.HasAggressiveAntiSpamEnabled == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) String() string { - if t == nil { - return "ToggleSupergroupHasAggressiveAntiSpamEnabledRequest(nil)" - } - type Alias ToggleSupergroupHasAggressiveAntiSpamEnabledRequest - return fmt.Sprintf("ToggleSupergroupHasAggressiveAntiSpamEnabledRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) TypeID() uint32 { - return ToggleSupergroupHasAggressiveAntiSpamEnabledRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) TypeName() string { - return "toggleSupergroupHasAggressiveAntiSpamEnabled" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSupergroupHasAggressiveAntiSpamEnabled", - ID: ToggleSupergroupHasAggressiveAntiSpamEnabledRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "HasAggressiveAntiSpamEnabled", - SchemaName: "has_aggressive_anti_spam_enabled", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f as nil") - } - b.PutID(ToggleSupergroupHasAggressiveAntiSpamEnabledRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f as nil") - } - b.PutInt53(t.SupergroupID) - b.PutBool(t.HasAggressiveAntiSpamEnabled) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f to nil") - } - if err := b.ConsumeID(ToggleSupergroupHasAggressiveAntiSpamEnabledRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f: field supergroup_id: %w", err) - } - t.SupergroupID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f: field has_aggressive_anti_spam_enabled: %w", err) - } - t.HasAggressiveAntiSpamEnabled = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f as nil") - } - b.ObjStart() - b.PutID("toggleSupergroupHasAggressiveAntiSpamEnabled") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(t.SupergroupID) - b.Comma() - b.FieldStart("has_aggressive_anti_spam_enabled") - b.PutBool(t.HasAggressiveAntiSpamEnabled) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSupergroupHasAggressiveAntiSpamEnabled"); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f: field supergroup_id: %w", err) - } - t.SupergroupID = value - case "has_aggressive_anti_spam_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f: field has_aggressive_anti_spam_enabled: %w", err) - } - t.HasAggressiveAntiSpamEnabled = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (t *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) GetSupergroupID() (value int64) { - if t == nil { - return - } - return t.SupergroupID -} - -// GetHasAggressiveAntiSpamEnabled returns value of HasAggressiveAntiSpamEnabled field. -func (t *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) GetHasAggressiveAntiSpamEnabled() (value bool) { - if t == nil { - return - } - return t.HasAggressiveAntiSpamEnabled -} - -// ToggleSupergroupHasAggressiveAntiSpamEnabled invokes method toggleSupergroupHasAggressiveAntiSpamEnabled#683ef70f returning error if any. -func (c *Client) ToggleSupergroupHasAggressiveAntiSpamEnabled(ctx context.Context, request *ToggleSupergroupHasAggressiveAntiSpamEnabledRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_supergroup_has_hidden_members_gen.go b/tdapi/tl_toggle_supergroup_has_hidden_members_gen.go deleted file mode 100644 index 21407b461..000000000 --- a/tdapi/tl_toggle_supergroup_has_hidden_members_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSupergroupHasHiddenMembersRequest represents TL type `toggleSupergroupHasHiddenMembers#a4559dca`. -type ToggleSupergroupHasHiddenMembersRequest struct { - // Identifier of the supergroup - SupergroupID int64 - // New value of has_hidden_members - HasHiddenMembers bool -} - -// ToggleSupergroupHasHiddenMembersRequestTypeID is TL type id of ToggleSupergroupHasHiddenMembersRequest. -const ToggleSupergroupHasHiddenMembersRequestTypeID = 0xa4559dca - -// Ensuring interfaces in compile-time for ToggleSupergroupHasHiddenMembersRequest. -var ( - _ bin.Encoder = &ToggleSupergroupHasHiddenMembersRequest{} - _ bin.Decoder = &ToggleSupergroupHasHiddenMembersRequest{} - _ bin.BareEncoder = &ToggleSupergroupHasHiddenMembersRequest{} - _ bin.BareDecoder = &ToggleSupergroupHasHiddenMembersRequest{} -) - -func (t *ToggleSupergroupHasHiddenMembersRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SupergroupID == 0) { - return false - } - if !(t.HasHiddenMembers == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSupergroupHasHiddenMembersRequest) String() string { - if t == nil { - return "ToggleSupergroupHasHiddenMembersRequest(nil)" - } - type Alias ToggleSupergroupHasHiddenMembersRequest - return fmt.Sprintf("ToggleSupergroupHasHiddenMembersRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSupergroupHasHiddenMembersRequest) TypeID() uint32 { - return ToggleSupergroupHasHiddenMembersRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSupergroupHasHiddenMembersRequest) TypeName() string { - return "toggleSupergroupHasHiddenMembers" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSupergroupHasHiddenMembersRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSupergroupHasHiddenMembers", - ID: ToggleSupergroupHasHiddenMembersRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "HasHiddenMembers", - SchemaName: "has_hidden_members", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSupergroupHasHiddenMembersRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupHasHiddenMembers#a4559dca as nil") - } - b.PutID(ToggleSupergroupHasHiddenMembersRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSupergroupHasHiddenMembersRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupHasHiddenMembers#a4559dca as nil") - } - b.PutInt53(t.SupergroupID) - b.PutBool(t.HasHiddenMembers) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSupergroupHasHiddenMembersRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupHasHiddenMembers#a4559dca to nil") - } - if err := b.ConsumeID(ToggleSupergroupHasHiddenMembersRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasHiddenMembers#a4559dca: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSupergroupHasHiddenMembersRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupHasHiddenMembers#a4559dca to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasHiddenMembers#a4559dca: field supergroup_id: %w", err) - } - t.SupergroupID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasHiddenMembers#a4559dca: field has_hidden_members: %w", err) - } - t.HasHiddenMembers = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSupergroupHasHiddenMembersRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupHasHiddenMembers#a4559dca as nil") - } - b.ObjStart() - b.PutID("toggleSupergroupHasHiddenMembers") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(t.SupergroupID) - b.Comma() - b.FieldStart("has_hidden_members") - b.PutBool(t.HasHiddenMembers) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSupergroupHasHiddenMembersRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupHasHiddenMembers#a4559dca to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSupergroupHasHiddenMembers"); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasHiddenMembers#a4559dca: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasHiddenMembers#a4559dca: field supergroup_id: %w", err) - } - t.SupergroupID = value - case "has_hidden_members": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupHasHiddenMembers#a4559dca: field has_hidden_members: %w", err) - } - t.HasHiddenMembers = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (t *ToggleSupergroupHasHiddenMembersRequest) GetSupergroupID() (value int64) { - if t == nil { - return - } - return t.SupergroupID -} - -// GetHasHiddenMembers returns value of HasHiddenMembers field. -func (t *ToggleSupergroupHasHiddenMembersRequest) GetHasHiddenMembers() (value bool) { - if t == nil { - return - } - return t.HasHiddenMembers -} - -// ToggleSupergroupHasHiddenMembers invokes method toggleSupergroupHasHiddenMembers#a4559dca returning error if any. -func (c *Client) ToggleSupergroupHasHiddenMembers(ctx context.Context, request *ToggleSupergroupHasHiddenMembersRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_supergroup_is_all_history_available_gen.go b/tdapi/tl_toggle_supergroup_is_all_history_available_gen.go deleted file mode 100644 index cc639a4b5..000000000 --- a/tdapi/tl_toggle_supergroup_is_all_history_available_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSupergroupIsAllHistoryAvailableRequest represents TL type `toggleSupergroupIsAllHistoryAvailable#44d9964e`. -type ToggleSupergroupIsAllHistoryAvailableRequest struct { - // The identifier of the supergroup - SupergroupID int64 - // The new value of is_all_history_available - IsAllHistoryAvailable bool -} - -// ToggleSupergroupIsAllHistoryAvailableRequestTypeID is TL type id of ToggleSupergroupIsAllHistoryAvailableRequest. -const ToggleSupergroupIsAllHistoryAvailableRequestTypeID = 0x44d9964e - -// Ensuring interfaces in compile-time for ToggleSupergroupIsAllHistoryAvailableRequest. -var ( - _ bin.Encoder = &ToggleSupergroupIsAllHistoryAvailableRequest{} - _ bin.Decoder = &ToggleSupergroupIsAllHistoryAvailableRequest{} - _ bin.BareEncoder = &ToggleSupergroupIsAllHistoryAvailableRequest{} - _ bin.BareDecoder = &ToggleSupergroupIsAllHistoryAvailableRequest{} -) - -func (t *ToggleSupergroupIsAllHistoryAvailableRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SupergroupID == 0) { - return false - } - if !(t.IsAllHistoryAvailable == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSupergroupIsAllHistoryAvailableRequest) String() string { - if t == nil { - return "ToggleSupergroupIsAllHistoryAvailableRequest(nil)" - } - type Alias ToggleSupergroupIsAllHistoryAvailableRequest - return fmt.Sprintf("ToggleSupergroupIsAllHistoryAvailableRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSupergroupIsAllHistoryAvailableRequest) TypeID() uint32 { - return ToggleSupergroupIsAllHistoryAvailableRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSupergroupIsAllHistoryAvailableRequest) TypeName() string { - return "toggleSupergroupIsAllHistoryAvailable" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSupergroupIsAllHistoryAvailableRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSupergroupIsAllHistoryAvailable", - ID: ToggleSupergroupIsAllHistoryAvailableRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "IsAllHistoryAvailable", - SchemaName: "is_all_history_available", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSupergroupIsAllHistoryAvailableRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupIsAllHistoryAvailable#44d9964e as nil") - } - b.PutID(ToggleSupergroupIsAllHistoryAvailableRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSupergroupIsAllHistoryAvailableRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupIsAllHistoryAvailable#44d9964e as nil") - } - b.PutInt53(t.SupergroupID) - b.PutBool(t.IsAllHistoryAvailable) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSupergroupIsAllHistoryAvailableRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupIsAllHistoryAvailable#44d9964e to nil") - } - if err := b.ConsumeID(ToggleSupergroupIsAllHistoryAvailableRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsAllHistoryAvailable#44d9964e: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSupergroupIsAllHistoryAvailableRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupIsAllHistoryAvailable#44d9964e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsAllHistoryAvailable#44d9964e: field supergroup_id: %w", err) - } - t.SupergroupID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsAllHistoryAvailable#44d9964e: field is_all_history_available: %w", err) - } - t.IsAllHistoryAvailable = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSupergroupIsAllHistoryAvailableRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupIsAllHistoryAvailable#44d9964e as nil") - } - b.ObjStart() - b.PutID("toggleSupergroupIsAllHistoryAvailable") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(t.SupergroupID) - b.Comma() - b.FieldStart("is_all_history_available") - b.PutBool(t.IsAllHistoryAvailable) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSupergroupIsAllHistoryAvailableRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupIsAllHistoryAvailable#44d9964e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSupergroupIsAllHistoryAvailable"); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsAllHistoryAvailable#44d9964e: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsAllHistoryAvailable#44d9964e: field supergroup_id: %w", err) - } - t.SupergroupID = value - case "is_all_history_available": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsAllHistoryAvailable#44d9964e: field is_all_history_available: %w", err) - } - t.IsAllHistoryAvailable = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (t *ToggleSupergroupIsAllHistoryAvailableRequest) GetSupergroupID() (value int64) { - if t == nil { - return - } - return t.SupergroupID -} - -// GetIsAllHistoryAvailable returns value of IsAllHistoryAvailable field. -func (t *ToggleSupergroupIsAllHistoryAvailableRequest) GetIsAllHistoryAvailable() (value bool) { - if t == nil { - return - } - return t.IsAllHistoryAvailable -} - -// ToggleSupergroupIsAllHistoryAvailable invokes method toggleSupergroupIsAllHistoryAvailable#44d9964e returning error if any. -func (c *Client) ToggleSupergroupIsAllHistoryAvailable(ctx context.Context, request *ToggleSupergroupIsAllHistoryAvailableRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_supergroup_is_broadcast_group_gen.go b/tdapi/tl_toggle_supergroup_is_broadcast_group_gen.go deleted file mode 100644 index 18e7bf9ef..000000000 --- a/tdapi/tl_toggle_supergroup_is_broadcast_group_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSupergroupIsBroadcastGroupRequest represents TL type `toggleSupergroupIsBroadcastGroup#34b22215`. -type ToggleSupergroupIsBroadcastGroupRequest struct { - // Identifier of the supergroup - SupergroupID int64 -} - -// ToggleSupergroupIsBroadcastGroupRequestTypeID is TL type id of ToggleSupergroupIsBroadcastGroupRequest. -const ToggleSupergroupIsBroadcastGroupRequestTypeID = 0x34b22215 - -// Ensuring interfaces in compile-time for ToggleSupergroupIsBroadcastGroupRequest. -var ( - _ bin.Encoder = &ToggleSupergroupIsBroadcastGroupRequest{} - _ bin.Decoder = &ToggleSupergroupIsBroadcastGroupRequest{} - _ bin.BareEncoder = &ToggleSupergroupIsBroadcastGroupRequest{} - _ bin.BareDecoder = &ToggleSupergroupIsBroadcastGroupRequest{} -) - -func (t *ToggleSupergroupIsBroadcastGroupRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SupergroupID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSupergroupIsBroadcastGroupRequest) String() string { - if t == nil { - return "ToggleSupergroupIsBroadcastGroupRequest(nil)" - } - type Alias ToggleSupergroupIsBroadcastGroupRequest - return fmt.Sprintf("ToggleSupergroupIsBroadcastGroupRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSupergroupIsBroadcastGroupRequest) TypeID() uint32 { - return ToggleSupergroupIsBroadcastGroupRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSupergroupIsBroadcastGroupRequest) TypeName() string { - return "toggleSupergroupIsBroadcastGroup" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSupergroupIsBroadcastGroupRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSupergroupIsBroadcastGroup", - ID: ToggleSupergroupIsBroadcastGroupRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSupergroupIsBroadcastGroupRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupIsBroadcastGroup#34b22215 as nil") - } - b.PutID(ToggleSupergroupIsBroadcastGroupRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSupergroupIsBroadcastGroupRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupIsBroadcastGroup#34b22215 as nil") - } - b.PutInt53(t.SupergroupID) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSupergroupIsBroadcastGroupRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupIsBroadcastGroup#34b22215 to nil") - } - if err := b.ConsumeID(ToggleSupergroupIsBroadcastGroupRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsBroadcastGroup#34b22215: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSupergroupIsBroadcastGroupRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupIsBroadcastGroup#34b22215 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsBroadcastGroup#34b22215: field supergroup_id: %w", err) - } - t.SupergroupID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSupergroupIsBroadcastGroupRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupIsBroadcastGroup#34b22215 as nil") - } - b.ObjStart() - b.PutID("toggleSupergroupIsBroadcastGroup") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(t.SupergroupID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSupergroupIsBroadcastGroupRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupIsBroadcastGroup#34b22215 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSupergroupIsBroadcastGroup"); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsBroadcastGroup#34b22215: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsBroadcastGroup#34b22215: field supergroup_id: %w", err) - } - t.SupergroupID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (t *ToggleSupergroupIsBroadcastGroupRequest) GetSupergroupID() (value int64) { - if t == nil { - return - } - return t.SupergroupID -} - -// ToggleSupergroupIsBroadcastGroup invokes method toggleSupergroupIsBroadcastGroup#34b22215 returning error if any. -func (c *Client) ToggleSupergroupIsBroadcastGroup(ctx context.Context, supergroupid int64) error { - var ok Ok - - request := &ToggleSupergroupIsBroadcastGroupRequest{ - SupergroupID: supergroupid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_supergroup_is_forum_gen.go b/tdapi/tl_toggle_supergroup_is_forum_gen.go deleted file mode 100644 index ff4007822..000000000 --- a/tdapi/tl_toggle_supergroup_is_forum_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSupergroupIsForumRequest represents TL type `toggleSupergroupIsForum#966f960a`. -type ToggleSupergroupIsForumRequest struct { - // Identifier of the supergroup - SupergroupID int64 - // New value of is_forum - IsForum bool -} - -// ToggleSupergroupIsForumRequestTypeID is TL type id of ToggleSupergroupIsForumRequest. -const ToggleSupergroupIsForumRequestTypeID = 0x966f960a - -// Ensuring interfaces in compile-time for ToggleSupergroupIsForumRequest. -var ( - _ bin.Encoder = &ToggleSupergroupIsForumRequest{} - _ bin.Decoder = &ToggleSupergroupIsForumRequest{} - _ bin.BareEncoder = &ToggleSupergroupIsForumRequest{} - _ bin.BareDecoder = &ToggleSupergroupIsForumRequest{} -) - -func (t *ToggleSupergroupIsForumRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SupergroupID == 0) { - return false - } - if !(t.IsForum == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSupergroupIsForumRequest) String() string { - if t == nil { - return "ToggleSupergroupIsForumRequest(nil)" - } - type Alias ToggleSupergroupIsForumRequest - return fmt.Sprintf("ToggleSupergroupIsForumRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSupergroupIsForumRequest) TypeID() uint32 { - return ToggleSupergroupIsForumRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSupergroupIsForumRequest) TypeName() string { - return "toggleSupergroupIsForum" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSupergroupIsForumRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSupergroupIsForum", - ID: ToggleSupergroupIsForumRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "IsForum", - SchemaName: "is_forum", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSupergroupIsForumRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupIsForum#966f960a as nil") - } - b.PutID(ToggleSupergroupIsForumRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSupergroupIsForumRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupIsForum#966f960a as nil") - } - b.PutInt53(t.SupergroupID) - b.PutBool(t.IsForum) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSupergroupIsForumRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupIsForum#966f960a to nil") - } - if err := b.ConsumeID(ToggleSupergroupIsForumRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsForum#966f960a: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSupergroupIsForumRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupIsForum#966f960a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsForum#966f960a: field supergroup_id: %w", err) - } - t.SupergroupID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsForum#966f960a: field is_forum: %w", err) - } - t.IsForum = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSupergroupIsForumRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupIsForum#966f960a as nil") - } - b.ObjStart() - b.PutID("toggleSupergroupIsForum") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(t.SupergroupID) - b.Comma() - b.FieldStart("is_forum") - b.PutBool(t.IsForum) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSupergroupIsForumRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupIsForum#966f960a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSupergroupIsForum"); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsForum#966f960a: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsForum#966f960a: field supergroup_id: %w", err) - } - t.SupergroupID = value - case "is_forum": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupIsForum#966f960a: field is_forum: %w", err) - } - t.IsForum = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (t *ToggleSupergroupIsForumRequest) GetSupergroupID() (value int64) { - if t == nil { - return - } - return t.SupergroupID -} - -// GetIsForum returns value of IsForum field. -func (t *ToggleSupergroupIsForumRequest) GetIsForum() (value bool) { - if t == nil { - return - } - return t.IsForum -} - -// ToggleSupergroupIsForum invokes method toggleSupergroupIsForum#966f960a returning error if any. -func (c *Client) ToggleSupergroupIsForum(ctx context.Context, request *ToggleSupergroupIsForumRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_supergroup_join_by_request_gen.go b/tdapi/tl_toggle_supergroup_join_by_request_gen.go deleted file mode 100644 index b2c23ae50..000000000 --- a/tdapi/tl_toggle_supergroup_join_by_request_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSupergroupJoinByRequestRequest represents TL type `toggleSupergroupJoinByRequest#7ddf9fde`. -type ToggleSupergroupJoinByRequestRequest struct { - // Identifier of the supergroup that isn't a broadcast group - SupergroupID int64 - // New value of join_by_request - JoinByRequest bool -} - -// ToggleSupergroupJoinByRequestRequestTypeID is TL type id of ToggleSupergroupJoinByRequestRequest. -const ToggleSupergroupJoinByRequestRequestTypeID = 0x7ddf9fde - -// Ensuring interfaces in compile-time for ToggleSupergroupJoinByRequestRequest. -var ( - _ bin.Encoder = &ToggleSupergroupJoinByRequestRequest{} - _ bin.Decoder = &ToggleSupergroupJoinByRequestRequest{} - _ bin.BareEncoder = &ToggleSupergroupJoinByRequestRequest{} - _ bin.BareDecoder = &ToggleSupergroupJoinByRequestRequest{} -) - -func (t *ToggleSupergroupJoinByRequestRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SupergroupID == 0) { - return false - } - if !(t.JoinByRequest == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSupergroupJoinByRequestRequest) String() string { - if t == nil { - return "ToggleSupergroupJoinByRequestRequest(nil)" - } - type Alias ToggleSupergroupJoinByRequestRequest - return fmt.Sprintf("ToggleSupergroupJoinByRequestRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSupergroupJoinByRequestRequest) TypeID() uint32 { - return ToggleSupergroupJoinByRequestRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSupergroupJoinByRequestRequest) TypeName() string { - return "toggleSupergroupJoinByRequest" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSupergroupJoinByRequestRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSupergroupJoinByRequest", - ID: ToggleSupergroupJoinByRequestRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "JoinByRequest", - SchemaName: "join_by_request", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSupergroupJoinByRequestRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupJoinByRequest#7ddf9fde as nil") - } - b.PutID(ToggleSupergroupJoinByRequestRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSupergroupJoinByRequestRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupJoinByRequest#7ddf9fde as nil") - } - b.PutInt53(t.SupergroupID) - b.PutBool(t.JoinByRequest) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSupergroupJoinByRequestRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupJoinByRequest#7ddf9fde to nil") - } - if err := b.ConsumeID(ToggleSupergroupJoinByRequestRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinByRequest#7ddf9fde: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSupergroupJoinByRequestRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupJoinByRequest#7ddf9fde to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinByRequest#7ddf9fde: field supergroup_id: %w", err) - } - t.SupergroupID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinByRequest#7ddf9fde: field join_by_request: %w", err) - } - t.JoinByRequest = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSupergroupJoinByRequestRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupJoinByRequest#7ddf9fde as nil") - } - b.ObjStart() - b.PutID("toggleSupergroupJoinByRequest") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(t.SupergroupID) - b.Comma() - b.FieldStart("join_by_request") - b.PutBool(t.JoinByRequest) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSupergroupJoinByRequestRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupJoinByRequest#7ddf9fde to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSupergroupJoinByRequest"); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinByRequest#7ddf9fde: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinByRequest#7ddf9fde: field supergroup_id: %w", err) - } - t.SupergroupID = value - case "join_by_request": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinByRequest#7ddf9fde: field join_by_request: %w", err) - } - t.JoinByRequest = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (t *ToggleSupergroupJoinByRequestRequest) GetSupergroupID() (value int64) { - if t == nil { - return - } - return t.SupergroupID -} - -// GetJoinByRequest returns value of JoinByRequest field. -func (t *ToggleSupergroupJoinByRequestRequest) GetJoinByRequest() (value bool) { - if t == nil { - return - } - return t.JoinByRequest -} - -// ToggleSupergroupJoinByRequest invokes method toggleSupergroupJoinByRequest#7ddf9fde returning error if any. -func (c *Client) ToggleSupergroupJoinByRequest(ctx context.Context, request *ToggleSupergroupJoinByRequestRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_supergroup_join_to_send_messages_gen.go b/tdapi/tl_toggle_supergroup_join_to_send_messages_gen.go deleted file mode 100644 index 543de71ae..000000000 --- a/tdapi/tl_toggle_supergroup_join_to_send_messages_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSupergroupJoinToSendMessagesRequest represents TL type `toggleSupergroupJoinToSendMessages#f5268e0e`. -type ToggleSupergroupJoinToSendMessagesRequest struct { - // Identifier of the supergroup that isn't a broadcast group - SupergroupID int64 - // New value of join_to_send_messages - JoinToSendMessages bool -} - -// ToggleSupergroupJoinToSendMessagesRequestTypeID is TL type id of ToggleSupergroupJoinToSendMessagesRequest. -const ToggleSupergroupJoinToSendMessagesRequestTypeID = 0xf5268e0e - -// Ensuring interfaces in compile-time for ToggleSupergroupJoinToSendMessagesRequest. -var ( - _ bin.Encoder = &ToggleSupergroupJoinToSendMessagesRequest{} - _ bin.Decoder = &ToggleSupergroupJoinToSendMessagesRequest{} - _ bin.BareEncoder = &ToggleSupergroupJoinToSendMessagesRequest{} - _ bin.BareDecoder = &ToggleSupergroupJoinToSendMessagesRequest{} -) - -func (t *ToggleSupergroupJoinToSendMessagesRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SupergroupID == 0) { - return false - } - if !(t.JoinToSendMessages == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSupergroupJoinToSendMessagesRequest) String() string { - if t == nil { - return "ToggleSupergroupJoinToSendMessagesRequest(nil)" - } - type Alias ToggleSupergroupJoinToSendMessagesRequest - return fmt.Sprintf("ToggleSupergroupJoinToSendMessagesRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSupergroupJoinToSendMessagesRequest) TypeID() uint32 { - return ToggleSupergroupJoinToSendMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSupergroupJoinToSendMessagesRequest) TypeName() string { - return "toggleSupergroupJoinToSendMessages" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSupergroupJoinToSendMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSupergroupJoinToSendMessages", - ID: ToggleSupergroupJoinToSendMessagesRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "JoinToSendMessages", - SchemaName: "join_to_send_messages", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSupergroupJoinToSendMessagesRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupJoinToSendMessages#f5268e0e as nil") - } - b.PutID(ToggleSupergroupJoinToSendMessagesRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSupergroupJoinToSendMessagesRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupJoinToSendMessages#f5268e0e as nil") - } - b.PutInt53(t.SupergroupID) - b.PutBool(t.JoinToSendMessages) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSupergroupJoinToSendMessagesRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupJoinToSendMessages#f5268e0e to nil") - } - if err := b.ConsumeID(ToggleSupergroupJoinToSendMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinToSendMessages#f5268e0e: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSupergroupJoinToSendMessagesRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupJoinToSendMessages#f5268e0e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinToSendMessages#f5268e0e: field supergroup_id: %w", err) - } - t.SupergroupID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinToSendMessages#f5268e0e: field join_to_send_messages: %w", err) - } - t.JoinToSendMessages = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSupergroupJoinToSendMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupJoinToSendMessages#f5268e0e as nil") - } - b.ObjStart() - b.PutID("toggleSupergroupJoinToSendMessages") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(t.SupergroupID) - b.Comma() - b.FieldStart("join_to_send_messages") - b.PutBool(t.JoinToSendMessages) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSupergroupJoinToSendMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupJoinToSendMessages#f5268e0e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSupergroupJoinToSendMessages"); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinToSendMessages#f5268e0e: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinToSendMessages#f5268e0e: field supergroup_id: %w", err) - } - t.SupergroupID = value - case "join_to_send_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupJoinToSendMessages#f5268e0e: field join_to_send_messages: %w", err) - } - t.JoinToSendMessages = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (t *ToggleSupergroupJoinToSendMessagesRequest) GetSupergroupID() (value int64) { - if t == nil { - return - } - return t.SupergroupID -} - -// GetJoinToSendMessages returns value of JoinToSendMessages field. -func (t *ToggleSupergroupJoinToSendMessagesRequest) GetJoinToSendMessages() (value bool) { - if t == nil { - return - } - return t.JoinToSendMessages -} - -// ToggleSupergroupJoinToSendMessages invokes method toggleSupergroupJoinToSendMessages#f5268e0e returning error if any. -func (c *Client) ToggleSupergroupJoinToSendMessages(ctx context.Context, request *ToggleSupergroupJoinToSendMessagesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_supergroup_sign_messages_gen.go b/tdapi/tl_toggle_supergroup_sign_messages_gen.go deleted file mode 100644 index 7da231f50..000000000 --- a/tdapi/tl_toggle_supergroup_sign_messages_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSupergroupSignMessagesRequest represents TL type `toggleSupergroupSignMessages#221c1fcb`. -type ToggleSupergroupSignMessagesRequest struct { - // Identifier of the channel - SupergroupID int64 - // New value of sign_messages - SignMessages bool - // New value of show_message_sender - ShowMessageSender bool -} - -// ToggleSupergroupSignMessagesRequestTypeID is TL type id of ToggleSupergroupSignMessagesRequest. -const ToggleSupergroupSignMessagesRequestTypeID = 0x221c1fcb - -// Ensuring interfaces in compile-time for ToggleSupergroupSignMessagesRequest. -var ( - _ bin.Encoder = &ToggleSupergroupSignMessagesRequest{} - _ bin.Decoder = &ToggleSupergroupSignMessagesRequest{} - _ bin.BareEncoder = &ToggleSupergroupSignMessagesRequest{} - _ bin.BareDecoder = &ToggleSupergroupSignMessagesRequest{} -) - -func (t *ToggleSupergroupSignMessagesRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SupergroupID == 0) { - return false - } - if !(t.SignMessages == false) { - return false - } - if !(t.ShowMessageSender == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSupergroupSignMessagesRequest) String() string { - if t == nil { - return "ToggleSupergroupSignMessagesRequest(nil)" - } - type Alias ToggleSupergroupSignMessagesRequest - return fmt.Sprintf("ToggleSupergroupSignMessagesRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSupergroupSignMessagesRequest) TypeID() uint32 { - return ToggleSupergroupSignMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSupergroupSignMessagesRequest) TypeName() string { - return "toggleSupergroupSignMessages" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSupergroupSignMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSupergroupSignMessages", - ID: ToggleSupergroupSignMessagesRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "SignMessages", - SchemaName: "sign_messages", - }, - { - Name: "ShowMessageSender", - SchemaName: "show_message_sender", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSupergroupSignMessagesRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupSignMessages#221c1fcb as nil") - } - b.PutID(ToggleSupergroupSignMessagesRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSupergroupSignMessagesRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupSignMessages#221c1fcb as nil") - } - b.PutInt53(t.SupergroupID) - b.PutBool(t.SignMessages) - b.PutBool(t.ShowMessageSender) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSupergroupSignMessagesRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupSignMessages#221c1fcb to nil") - } - if err := b.ConsumeID(ToggleSupergroupSignMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupSignMessages#221c1fcb: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSupergroupSignMessagesRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupSignMessages#221c1fcb to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupSignMessages#221c1fcb: field supergroup_id: %w", err) - } - t.SupergroupID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupSignMessages#221c1fcb: field sign_messages: %w", err) - } - t.SignMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupSignMessages#221c1fcb: field show_message_sender: %w", err) - } - t.ShowMessageSender = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSupergroupSignMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupSignMessages#221c1fcb as nil") - } - b.ObjStart() - b.PutID("toggleSupergroupSignMessages") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(t.SupergroupID) - b.Comma() - b.FieldStart("sign_messages") - b.PutBool(t.SignMessages) - b.Comma() - b.FieldStart("show_message_sender") - b.PutBool(t.ShowMessageSender) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSupergroupSignMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupSignMessages#221c1fcb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSupergroupSignMessages"); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupSignMessages#221c1fcb: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupSignMessages#221c1fcb: field supergroup_id: %w", err) - } - t.SupergroupID = value - case "sign_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupSignMessages#221c1fcb: field sign_messages: %w", err) - } - t.SignMessages = value - case "show_message_sender": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupSignMessages#221c1fcb: field show_message_sender: %w", err) - } - t.ShowMessageSender = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (t *ToggleSupergroupSignMessagesRequest) GetSupergroupID() (value int64) { - if t == nil { - return - } - return t.SupergroupID -} - -// GetSignMessages returns value of SignMessages field. -func (t *ToggleSupergroupSignMessagesRequest) GetSignMessages() (value bool) { - if t == nil { - return - } - return t.SignMessages -} - -// GetShowMessageSender returns value of ShowMessageSender field. -func (t *ToggleSupergroupSignMessagesRequest) GetShowMessageSender() (value bool) { - if t == nil { - return - } - return t.ShowMessageSender -} - -// ToggleSupergroupSignMessages invokes method toggleSupergroupSignMessages#221c1fcb returning error if any. -func (c *Client) ToggleSupergroupSignMessages(ctx context.Context, request *ToggleSupergroupSignMessagesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_supergroup_username_is_active_gen.go b/tdapi/tl_toggle_supergroup_username_is_active_gen.go deleted file mode 100644 index a6044f7cf..000000000 --- a/tdapi/tl_toggle_supergroup_username_is_active_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleSupergroupUsernameIsActiveRequest represents TL type `toggleSupergroupUsernameIsActive#a68b6dff`. -type ToggleSupergroupUsernameIsActiveRequest struct { - // Identifier of the supergroup or channel - SupergroupID int64 - // The username to change - Username string - // Pass true to activate the username; pass false to disable it - IsActive bool -} - -// ToggleSupergroupUsernameIsActiveRequestTypeID is TL type id of ToggleSupergroupUsernameIsActiveRequest. -const ToggleSupergroupUsernameIsActiveRequestTypeID = 0xa68b6dff - -// Ensuring interfaces in compile-time for ToggleSupergroupUsernameIsActiveRequest. -var ( - _ bin.Encoder = &ToggleSupergroupUsernameIsActiveRequest{} - _ bin.Decoder = &ToggleSupergroupUsernameIsActiveRequest{} - _ bin.BareEncoder = &ToggleSupergroupUsernameIsActiveRequest{} - _ bin.BareDecoder = &ToggleSupergroupUsernameIsActiveRequest{} -) - -func (t *ToggleSupergroupUsernameIsActiveRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SupergroupID == 0) { - return false - } - if !(t.Username == "") { - return false - } - if !(t.IsActive == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleSupergroupUsernameIsActiveRequest) String() string { - if t == nil { - return "ToggleSupergroupUsernameIsActiveRequest(nil)" - } - type Alias ToggleSupergroupUsernameIsActiveRequest - return fmt.Sprintf("ToggleSupergroupUsernameIsActiveRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleSupergroupUsernameIsActiveRequest) TypeID() uint32 { - return ToggleSupergroupUsernameIsActiveRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleSupergroupUsernameIsActiveRequest) TypeName() string { - return "toggleSupergroupUsernameIsActive" -} - -// TypeInfo returns info about TL type. -func (t *ToggleSupergroupUsernameIsActiveRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleSupergroupUsernameIsActive", - ID: ToggleSupergroupUsernameIsActiveRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "Username", - SchemaName: "username", - }, - { - Name: "IsActive", - SchemaName: "is_active", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleSupergroupUsernameIsActiveRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupUsernameIsActive#a68b6dff as nil") - } - b.PutID(ToggleSupergroupUsernameIsActiveRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleSupergroupUsernameIsActiveRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupUsernameIsActive#a68b6dff as nil") - } - b.PutInt53(t.SupergroupID) - b.PutString(t.Username) - b.PutBool(t.IsActive) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleSupergroupUsernameIsActiveRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupUsernameIsActive#a68b6dff to nil") - } - if err := b.ConsumeID(ToggleSupergroupUsernameIsActiveRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupUsernameIsActive#a68b6dff: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleSupergroupUsernameIsActiveRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupUsernameIsActive#a68b6dff to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupUsernameIsActive#a68b6dff: field supergroup_id: %w", err) - } - t.SupergroupID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupUsernameIsActive#a68b6dff: field username: %w", err) - } - t.Username = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupUsernameIsActive#a68b6dff: field is_active: %w", err) - } - t.IsActive = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleSupergroupUsernameIsActiveRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleSupergroupUsernameIsActive#a68b6dff as nil") - } - b.ObjStart() - b.PutID("toggleSupergroupUsernameIsActive") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(t.SupergroupID) - b.Comma() - b.FieldStart("username") - b.PutString(t.Username) - b.Comma() - b.FieldStart("is_active") - b.PutBool(t.IsActive) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleSupergroupUsernameIsActiveRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleSupergroupUsernameIsActive#a68b6dff to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleSupergroupUsernameIsActive"); err != nil { - return fmt.Errorf("unable to decode toggleSupergroupUsernameIsActive#a68b6dff: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupUsernameIsActive#a68b6dff: field supergroup_id: %w", err) - } - t.SupergroupID = value - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupUsernameIsActive#a68b6dff: field username: %w", err) - } - t.Username = value - case "is_active": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleSupergroupUsernameIsActive#a68b6dff: field is_active: %w", err) - } - t.IsActive = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (t *ToggleSupergroupUsernameIsActiveRequest) GetSupergroupID() (value int64) { - if t == nil { - return - } - return t.SupergroupID -} - -// GetUsername returns value of Username field. -func (t *ToggleSupergroupUsernameIsActiveRequest) GetUsername() (value string) { - if t == nil { - return - } - return t.Username -} - -// GetIsActive returns value of IsActive field. -func (t *ToggleSupergroupUsernameIsActiveRequest) GetIsActive() (value bool) { - if t == nil { - return - } - return t.IsActive -} - -// ToggleSupergroupUsernameIsActive invokes method toggleSupergroupUsernameIsActive#a68b6dff returning error if any. -func (c *Client) ToggleSupergroupUsernameIsActive(ctx context.Context, request *ToggleSupergroupUsernameIsActiveRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_toggle_username_is_active_gen.go b/tdapi/tl_toggle_username_is_active_gen.go deleted file mode 100644 index f0e97a4be..000000000 --- a/tdapi/tl_toggle_username_is_active_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ToggleUsernameIsActiveRequest represents TL type `toggleUsernameIsActive#4a276de3`. -type ToggleUsernameIsActiveRequest struct { - // The username to change - Username string - // Pass true to activate the username; pass false to disable it - IsActive bool -} - -// ToggleUsernameIsActiveRequestTypeID is TL type id of ToggleUsernameIsActiveRequest. -const ToggleUsernameIsActiveRequestTypeID = 0x4a276de3 - -// Ensuring interfaces in compile-time for ToggleUsernameIsActiveRequest. -var ( - _ bin.Encoder = &ToggleUsernameIsActiveRequest{} - _ bin.Decoder = &ToggleUsernameIsActiveRequest{} - _ bin.BareEncoder = &ToggleUsernameIsActiveRequest{} - _ bin.BareDecoder = &ToggleUsernameIsActiveRequest{} -) - -func (t *ToggleUsernameIsActiveRequest) Zero() bool { - if t == nil { - return true - } - if !(t.Username == "") { - return false - } - if !(t.IsActive == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *ToggleUsernameIsActiveRequest) String() string { - if t == nil { - return "ToggleUsernameIsActiveRequest(nil)" - } - type Alias ToggleUsernameIsActiveRequest - return fmt.Sprintf("ToggleUsernameIsActiveRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ToggleUsernameIsActiveRequest) TypeID() uint32 { - return ToggleUsernameIsActiveRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ToggleUsernameIsActiveRequest) TypeName() string { - return "toggleUsernameIsActive" -} - -// TypeInfo returns info about TL type. -func (t *ToggleUsernameIsActiveRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "toggleUsernameIsActive", - ID: ToggleUsernameIsActiveRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Username", - SchemaName: "username", - }, - { - Name: "IsActive", - SchemaName: "is_active", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *ToggleUsernameIsActiveRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleUsernameIsActive#4a276de3 as nil") - } - b.PutID(ToggleUsernameIsActiveRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *ToggleUsernameIsActiveRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode toggleUsernameIsActive#4a276de3 as nil") - } - b.PutString(t.Username) - b.PutBool(t.IsActive) - return nil -} - -// Decode implements bin.Decoder. -func (t *ToggleUsernameIsActiveRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleUsernameIsActive#4a276de3 to nil") - } - if err := b.ConsumeID(ToggleUsernameIsActiveRequestTypeID); err != nil { - return fmt.Errorf("unable to decode toggleUsernameIsActive#4a276de3: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *ToggleUsernameIsActiveRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode toggleUsernameIsActive#4a276de3 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode toggleUsernameIsActive#4a276de3: field username: %w", err) - } - t.Username = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleUsernameIsActive#4a276de3: field is_active: %w", err) - } - t.IsActive = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *ToggleUsernameIsActiveRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode toggleUsernameIsActive#4a276de3 as nil") - } - b.ObjStart() - b.PutID("toggleUsernameIsActive") - b.Comma() - b.FieldStart("username") - b.PutString(t.Username) - b.Comma() - b.FieldStart("is_active") - b.PutBool(t.IsActive) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *ToggleUsernameIsActiveRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode toggleUsernameIsActive#4a276de3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("toggleUsernameIsActive"); err != nil { - return fmt.Errorf("unable to decode toggleUsernameIsActive#4a276de3: %w", err) - } - case "username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode toggleUsernameIsActive#4a276de3: field username: %w", err) - } - t.Username = value - case "is_active": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode toggleUsernameIsActive#4a276de3: field is_active: %w", err) - } - t.IsActive = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUsername returns value of Username field. -func (t *ToggleUsernameIsActiveRequest) GetUsername() (value string) { - if t == nil { - return - } - return t.Username -} - -// GetIsActive returns value of IsActive field. -func (t *ToggleUsernameIsActiveRequest) GetIsActive() (value bool) { - if t == nil { - return - } - return t.IsActive -} - -// ToggleUsernameIsActive invokes method toggleUsernameIsActive#4a276de3 returning error if any. -func (c *Client) ToggleUsernameIsActive(ctx context.Context, request *ToggleUsernameIsActiveRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_top_chat_category_gen.go b/tdapi/tl_top_chat_category_gen.go deleted file mode 100644 index 83a218ac4..000000000 --- a/tdapi/tl_top_chat_category_gen.go +++ /dev/null @@ -1,1307 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TopChatCategoryUsers represents TL type `topChatCategoryUsers#3d324d80`. -type TopChatCategoryUsers struct { -} - -// TopChatCategoryUsersTypeID is TL type id of TopChatCategoryUsers. -const TopChatCategoryUsersTypeID = 0x3d324d80 - -// construct implements constructor of TopChatCategoryClass. -func (t TopChatCategoryUsers) construct() TopChatCategoryClass { return &t } - -// Ensuring interfaces in compile-time for TopChatCategoryUsers. -var ( - _ bin.Encoder = &TopChatCategoryUsers{} - _ bin.Decoder = &TopChatCategoryUsers{} - _ bin.BareEncoder = &TopChatCategoryUsers{} - _ bin.BareDecoder = &TopChatCategoryUsers{} - - _ TopChatCategoryClass = &TopChatCategoryUsers{} -) - -func (t *TopChatCategoryUsers) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TopChatCategoryUsers) String() string { - if t == nil { - return "TopChatCategoryUsers(nil)" - } - type Alias TopChatCategoryUsers - return fmt.Sprintf("TopChatCategoryUsers%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TopChatCategoryUsers) TypeID() uint32 { - return TopChatCategoryUsersTypeID -} - -// TypeName returns name of type in TL schema. -func (*TopChatCategoryUsers) TypeName() string { - return "topChatCategoryUsers" -} - -// TypeInfo returns info about TL type. -func (t *TopChatCategoryUsers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "topChatCategoryUsers", - ID: TopChatCategoryUsersTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TopChatCategoryUsers) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryUsers#3d324d80 as nil") - } - b.PutID(TopChatCategoryUsersTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TopChatCategoryUsers) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryUsers#3d324d80 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TopChatCategoryUsers) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryUsers#3d324d80 to nil") - } - if err := b.ConsumeID(TopChatCategoryUsersTypeID); err != nil { - return fmt.Errorf("unable to decode topChatCategoryUsers#3d324d80: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TopChatCategoryUsers) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryUsers#3d324d80 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TopChatCategoryUsers) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryUsers#3d324d80 as nil") - } - b.ObjStart() - b.PutID("topChatCategoryUsers") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TopChatCategoryUsers) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryUsers#3d324d80 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("topChatCategoryUsers"); err != nil { - return fmt.Errorf("unable to decode topChatCategoryUsers#3d324d80: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TopChatCategoryBots represents TL type `topChatCategoryBots#a1feeb15`. -type TopChatCategoryBots struct { -} - -// TopChatCategoryBotsTypeID is TL type id of TopChatCategoryBots. -const TopChatCategoryBotsTypeID = 0xa1feeb15 - -// construct implements constructor of TopChatCategoryClass. -func (t TopChatCategoryBots) construct() TopChatCategoryClass { return &t } - -// Ensuring interfaces in compile-time for TopChatCategoryBots. -var ( - _ bin.Encoder = &TopChatCategoryBots{} - _ bin.Decoder = &TopChatCategoryBots{} - _ bin.BareEncoder = &TopChatCategoryBots{} - _ bin.BareDecoder = &TopChatCategoryBots{} - - _ TopChatCategoryClass = &TopChatCategoryBots{} -) - -func (t *TopChatCategoryBots) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TopChatCategoryBots) String() string { - if t == nil { - return "TopChatCategoryBots(nil)" - } - type Alias TopChatCategoryBots - return fmt.Sprintf("TopChatCategoryBots%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TopChatCategoryBots) TypeID() uint32 { - return TopChatCategoryBotsTypeID -} - -// TypeName returns name of type in TL schema. -func (*TopChatCategoryBots) TypeName() string { - return "topChatCategoryBots" -} - -// TypeInfo returns info about TL type. -func (t *TopChatCategoryBots) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "topChatCategoryBots", - ID: TopChatCategoryBotsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TopChatCategoryBots) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryBots#a1feeb15 as nil") - } - b.PutID(TopChatCategoryBotsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TopChatCategoryBots) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryBots#a1feeb15 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TopChatCategoryBots) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryBots#a1feeb15 to nil") - } - if err := b.ConsumeID(TopChatCategoryBotsTypeID); err != nil { - return fmt.Errorf("unable to decode topChatCategoryBots#a1feeb15: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TopChatCategoryBots) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryBots#a1feeb15 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TopChatCategoryBots) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryBots#a1feeb15 as nil") - } - b.ObjStart() - b.PutID("topChatCategoryBots") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TopChatCategoryBots) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryBots#a1feeb15 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("topChatCategoryBots"); err != nil { - return fmt.Errorf("unable to decode topChatCategoryBots#a1feeb15: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TopChatCategoryGroups represents TL type `topChatCategoryGroups#5b32d08e`. -type TopChatCategoryGroups struct { -} - -// TopChatCategoryGroupsTypeID is TL type id of TopChatCategoryGroups. -const TopChatCategoryGroupsTypeID = 0x5b32d08e - -// construct implements constructor of TopChatCategoryClass. -func (t TopChatCategoryGroups) construct() TopChatCategoryClass { return &t } - -// Ensuring interfaces in compile-time for TopChatCategoryGroups. -var ( - _ bin.Encoder = &TopChatCategoryGroups{} - _ bin.Decoder = &TopChatCategoryGroups{} - _ bin.BareEncoder = &TopChatCategoryGroups{} - _ bin.BareDecoder = &TopChatCategoryGroups{} - - _ TopChatCategoryClass = &TopChatCategoryGroups{} -) - -func (t *TopChatCategoryGroups) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TopChatCategoryGroups) String() string { - if t == nil { - return "TopChatCategoryGroups(nil)" - } - type Alias TopChatCategoryGroups - return fmt.Sprintf("TopChatCategoryGroups%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TopChatCategoryGroups) TypeID() uint32 { - return TopChatCategoryGroupsTypeID -} - -// TypeName returns name of type in TL schema. -func (*TopChatCategoryGroups) TypeName() string { - return "topChatCategoryGroups" -} - -// TypeInfo returns info about TL type. -func (t *TopChatCategoryGroups) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "topChatCategoryGroups", - ID: TopChatCategoryGroupsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TopChatCategoryGroups) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryGroups#5b32d08e as nil") - } - b.PutID(TopChatCategoryGroupsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TopChatCategoryGroups) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryGroups#5b32d08e as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TopChatCategoryGroups) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryGroups#5b32d08e to nil") - } - if err := b.ConsumeID(TopChatCategoryGroupsTypeID); err != nil { - return fmt.Errorf("unable to decode topChatCategoryGroups#5b32d08e: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TopChatCategoryGroups) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryGroups#5b32d08e to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TopChatCategoryGroups) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryGroups#5b32d08e as nil") - } - b.ObjStart() - b.PutID("topChatCategoryGroups") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TopChatCategoryGroups) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryGroups#5b32d08e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("topChatCategoryGroups"); err != nil { - return fmt.Errorf("unable to decode topChatCategoryGroups#5b32d08e: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TopChatCategoryChannels represents TL type `topChatCategoryChannels#e22600e3`. -type TopChatCategoryChannels struct { -} - -// TopChatCategoryChannelsTypeID is TL type id of TopChatCategoryChannels. -const TopChatCategoryChannelsTypeID = 0xe22600e3 - -// construct implements constructor of TopChatCategoryClass. -func (t TopChatCategoryChannels) construct() TopChatCategoryClass { return &t } - -// Ensuring interfaces in compile-time for TopChatCategoryChannels. -var ( - _ bin.Encoder = &TopChatCategoryChannels{} - _ bin.Decoder = &TopChatCategoryChannels{} - _ bin.BareEncoder = &TopChatCategoryChannels{} - _ bin.BareDecoder = &TopChatCategoryChannels{} - - _ TopChatCategoryClass = &TopChatCategoryChannels{} -) - -func (t *TopChatCategoryChannels) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TopChatCategoryChannels) String() string { - if t == nil { - return "TopChatCategoryChannels(nil)" - } - type Alias TopChatCategoryChannels - return fmt.Sprintf("TopChatCategoryChannels%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TopChatCategoryChannels) TypeID() uint32 { - return TopChatCategoryChannelsTypeID -} - -// TypeName returns name of type in TL schema. -func (*TopChatCategoryChannels) TypeName() string { - return "topChatCategoryChannels" -} - -// TypeInfo returns info about TL type. -func (t *TopChatCategoryChannels) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "topChatCategoryChannels", - ID: TopChatCategoryChannelsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TopChatCategoryChannels) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryChannels#e22600e3 as nil") - } - b.PutID(TopChatCategoryChannelsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TopChatCategoryChannels) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryChannels#e22600e3 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TopChatCategoryChannels) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryChannels#e22600e3 to nil") - } - if err := b.ConsumeID(TopChatCategoryChannelsTypeID); err != nil { - return fmt.Errorf("unable to decode topChatCategoryChannels#e22600e3: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TopChatCategoryChannels) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryChannels#e22600e3 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TopChatCategoryChannels) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryChannels#e22600e3 as nil") - } - b.ObjStart() - b.PutID("topChatCategoryChannels") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TopChatCategoryChannels) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryChannels#e22600e3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("topChatCategoryChannels"); err != nil { - return fmt.Errorf("unable to decode topChatCategoryChannels#e22600e3: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TopChatCategoryInlineBots represents TL type `topChatCategoryInlineBots#1678eb7c`. -type TopChatCategoryInlineBots struct { -} - -// TopChatCategoryInlineBotsTypeID is TL type id of TopChatCategoryInlineBots. -const TopChatCategoryInlineBotsTypeID = 0x1678eb7c - -// construct implements constructor of TopChatCategoryClass. -func (t TopChatCategoryInlineBots) construct() TopChatCategoryClass { return &t } - -// Ensuring interfaces in compile-time for TopChatCategoryInlineBots. -var ( - _ bin.Encoder = &TopChatCategoryInlineBots{} - _ bin.Decoder = &TopChatCategoryInlineBots{} - _ bin.BareEncoder = &TopChatCategoryInlineBots{} - _ bin.BareDecoder = &TopChatCategoryInlineBots{} - - _ TopChatCategoryClass = &TopChatCategoryInlineBots{} -) - -func (t *TopChatCategoryInlineBots) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TopChatCategoryInlineBots) String() string { - if t == nil { - return "TopChatCategoryInlineBots(nil)" - } - type Alias TopChatCategoryInlineBots - return fmt.Sprintf("TopChatCategoryInlineBots%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TopChatCategoryInlineBots) TypeID() uint32 { - return TopChatCategoryInlineBotsTypeID -} - -// TypeName returns name of type in TL schema. -func (*TopChatCategoryInlineBots) TypeName() string { - return "topChatCategoryInlineBots" -} - -// TypeInfo returns info about TL type. -func (t *TopChatCategoryInlineBots) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "topChatCategoryInlineBots", - ID: TopChatCategoryInlineBotsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TopChatCategoryInlineBots) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryInlineBots#1678eb7c as nil") - } - b.PutID(TopChatCategoryInlineBotsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TopChatCategoryInlineBots) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryInlineBots#1678eb7c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TopChatCategoryInlineBots) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryInlineBots#1678eb7c to nil") - } - if err := b.ConsumeID(TopChatCategoryInlineBotsTypeID); err != nil { - return fmt.Errorf("unable to decode topChatCategoryInlineBots#1678eb7c: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TopChatCategoryInlineBots) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryInlineBots#1678eb7c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TopChatCategoryInlineBots) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryInlineBots#1678eb7c as nil") - } - b.ObjStart() - b.PutID("topChatCategoryInlineBots") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TopChatCategoryInlineBots) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryInlineBots#1678eb7c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("topChatCategoryInlineBots"); err != nil { - return fmt.Errorf("unable to decode topChatCategoryInlineBots#1678eb7c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TopChatCategoryWebAppBots represents TL type `topChatCategoryWebAppBots#5f6d6fd`. -type TopChatCategoryWebAppBots struct { -} - -// TopChatCategoryWebAppBotsTypeID is TL type id of TopChatCategoryWebAppBots. -const TopChatCategoryWebAppBotsTypeID = 0x5f6d6fd - -// construct implements constructor of TopChatCategoryClass. -func (t TopChatCategoryWebAppBots) construct() TopChatCategoryClass { return &t } - -// Ensuring interfaces in compile-time for TopChatCategoryWebAppBots. -var ( - _ bin.Encoder = &TopChatCategoryWebAppBots{} - _ bin.Decoder = &TopChatCategoryWebAppBots{} - _ bin.BareEncoder = &TopChatCategoryWebAppBots{} - _ bin.BareDecoder = &TopChatCategoryWebAppBots{} - - _ TopChatCategoryClass = &TopChatCategoryWebAppBots{} -) - -func (t *TopChatCategoryWebAppBots) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TopChatCategoryWebAppBots) String() string { - if t == nil { - return "TopChatCategoryWebAppBots(nil)" - } - type Alias TopChatCategoryWebAppBots - return fmt.Sprintf("TopChatCategoryWebAppBots%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TopChatCategoryWebAppBots) TypeID() uint32 { - return TopChatCategoryWebAppBotsTypeID -} - -// TypeName returns name of type in TL schema. -func (*TopChatCategoryWebAppBots) TypeName() string { - return "topChatCategoryWebAppBots" -} - -// TypeInfo returns info about TL type. -func (t *TopChatCategoryWebAppBots) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "topChatCategoryWebAppBots", - ID: TopChatCategoryWebAppBotsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TopChatCategoryWebAppBots) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryWebAppBots#5f6d6fd as nil") - } - b.PutID(TopChatCategoryWebAppBotsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TopChatCategoryWebAppBots) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryWebAppBots#5f6d6fd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TopChatCategoryWebAppBots) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryWebAppBots#5f6d6fd to nil") - } - if err := b.ConsumeID(TopChatCategoryWebAppBotsTypeID); err != nil { - return fmt.Errorf("unable to decode topChatCategoryWebAppBots#5f6d6fd: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TopChatCategoryWebAppBots) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryWebAppBots#5f6d6fd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TopChatCategoryWebAppBots) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryWebAppBots#5f6d6fd as nil") - } - b.ObjStart() - b.PutID("topChatCategoryWebAppBots") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TopChatCategoryWebAppBots) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryWebAppBots#5f6d6fd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("topChatCategoryWebAppBots"); err != nil { - return fmt.Errorf("unable to decode topChatCategoryWebAppBots#5f6d6fd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TopChatCategoryCalls represents TL type `topChatCategoryCalls#153b50dd`. -type TopChatCategoryCalls struct { -} - -// TopChatCategoryCallsTypeID is TL type id of TopChatCategoryCalls. -const TopChatCategoryCallsTypeID = 0x153b50dd - -// construct implements constructor of TopChatCategoryClass. -func (t TopChatCategoryCalls) construct() TopChatCategoryClass { return &t } - -// Ensuring interfaces in compile-time for TopChatCategoryCalls. -var ( - _ bin.Encoder = &TopChatCategoryCalls{} - _ bin.Decoder = &TopChatCategoryCalls{} - _ bin.BareEncoder = &TopChatCategoryCalls{} - _ bin.BareDecoder = &TopChatCategoryCalls{} - - _ TopChatCategoryClass = &TopChatCategoryCalls{} -) - -func (t *TopChatCategoryCalls) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TopChatCategoryCalls) String() string { - if t == nil { - return "TopChatCategoryCalls(nil)" - } - type Alias TopChatCategoryCalls - return fmt.Sprintf("TopChatCategoryCalls%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TopChatCategoryCalls) TypeID() uint32 { - return TopChatCategoryCallsTypeID -} - -// TypeName returns name of type in TL schema. -func (*TopChatCategoryCalls) TypeName() string { - return "topChatCategoryCalls" -} - -// TypeInfo returns info about TL type. -func (t *TopChatCategoryCalls) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "topChatCategoryCalls", - ID: TopChatCategoryCallsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TopChatCategoryCalls) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryCalls#153b50dd as nil") - } - b.PutID(TopChatCategoryCallsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TopChatCategoryCalls) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryCalls#153b50dd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TopChatCategoryCalls) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryCalls#153b50dd to nil") - } - if err := b.ConsumeID(TopChatCategoryCallsTypeID); err != nil { - return fmt.Errorf("unable to decode topChatCategoryCalls#153b50dd: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TopChatCategoryCalls) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryCalls#153b50dd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TopChatCategoryCalls) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryCalls#153b50dd as nil") - } - b.ObjStart() - b.PutID("topChatCategoryCalls") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TopChatCategoryCalls) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryCalls#153b50dd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("topChatCategoryCalls"); err != nil { - return fmt.Errorf("unable to decode topChatCategoryCalls#153b50dd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TopChatCategoryForwardChats represents TL type `topChatCategoryForwardChats#6515b7d5`. -type TopChatCategoryForwardChats struct { -} - -// TopChatCategoryForwardChatsTypeID is TL type id of TopChatCategoryForwardChats. -const TopChatCategoryForwardChatsTypeID = 0x6515b7d5 - -// construct implements constructor of TopChatCategoryClass. -func (t TopChatCategoryForwardChats) construct() TopChatCategoryClass { return &t } - -// Ensuring interfaces in compile-time for TopChatCategoryForwardChats. -var ( - _ bin.Encoder = &TopChatCategoryForwardChats{} - _ bin.Decoder = &TopChatCategoryForwardChats{} - _ bin.BareEncoder = &TopChatCategoryForwardChats{} - _ bin.BareDecoder = &TopChatCategoryForwardChats{} - - _ TopChatCategoryClass = &TopChatCategoryForwardChats{} -) - -func (t *TopChatCategoryForwardChats) Zero() bool { - if t == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (t *TopChatCategoryForwardChats) String() string { - if t == nil { - return "TopChatCategoryForwardChats(nil)" - } - type Alias TopChatCategoryForwardChats - return fmt.Sprintf("TopChatCategoryForwardChats%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TopChatCategoryForwardChats) TypeID() uint32 { - return TopChatCategoryForwardChatsTypeID -} - -// TypeName returns name of type in TL schema. -func (*TopChatCategoryForwardChats) TypeName() string { - return "topChatCategoryForwardChats" -} - -// TypeInfo returns info about TL type. -func (t *TopChatCategoryForwardChats) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "topChatCategoryForwardChats", - ID: TopChatCategoryForwardChatsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (t *TopChatCategoryForwardChats) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryForwardChats#6515b7d5 as nil") - } - b.PutID(TopChatCategoryForwardChatsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TopChatCategoryForwardChats) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryForwardChats#6515b7d5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (t *TopChatCategoryForwardChats) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryForwardChats#6515b7d5 to nil") - } - if err := b.ConsumeID(TopChatCategoryForwardChatsTypeID); err != nil { - return fmt.Errorf("unable to decode topChatCategoryForwardChats#6515b7d5: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TopChatCategoryForwardChats) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryForwardChats#6515b7d5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TopChatCategoryForwardChats) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode topChatCategoryForwardChats#6515b7d5 as nil") - } - b.ObjStart() - b.PutID("topChatCategoryForwardChats") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TopChatCategoryForwardChats) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode topChatCategoryForwardChats#6515b7d5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("topChatCategoryForwardChats"); err != nil { - return fmt.Errorf("unable to decode topChatCategoryForwardChats#6515b7d5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// TopChatCategoryClassName is schema name of TopChatCategoryClass. -const TopChatCategoryClassName = "TopChatCategory" - -// TopChatCategoryClass represents TopChatCategory generic type. -// -// Example: -// -// g, err := tdapi.DecodeTopChatCategory(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.TopChatCategoryUsers: // topChatCategoryUsers#3d324d80 -// case *tdapi.TopChatCategoryBots: // topChatCategoryBots#a1feeb15 -// case *tdapi.TopChatCategoryGroups: // topChatCategoryGroups#5b32d08e -// case *tdapi.TopChatCategoryChannels: // topChatCategoryChannels#e22600e3 -// case *tdapi.TopChatCategoryInlineBots: // topChatCategoryInlineBots#1678eb7c -// case *tdapi.TopChatCategoryWebAppBots: // topChatCategoryWebAppBots#5f6d6fd -// case *tdapi.TopChatCategoryCalls: // topChatCategoryCalls#153b50dd -// case *tdapi.TopChatCategoryForwardChats: // topChatCategoryForwardChats#6515b7d5 -// default: panic(v) -// } -type TopChatCategoryClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() TopChatCategoryClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeTopChatCategory implements binary de-serialization for TopChatCategoryClass. -func DecodeTopChatCategory(buf *bin.Buffer) (TopChatCategoryClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case TopChatCategoryUsersTypeID: - // Decoding topChatCategoryUsers#3d324d80. - v := TopChatCategoryUsers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case TopChatCategoryBotsTypeID: - // Decoding topChatCategoryBots#a1feeb15. - v := TopChatCategoryBots{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case TopChatCategoryGroupsTypeID: - // Decoding topChatCategoryGroups#5b32d08e. - v := TopChatCategoryGroups{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case TopChatCategoryChannelsTypeID: - // Decoding topChatCategoryChannels#e22600e3. - v := TopChatCategoryChannels{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case TopChatCategoryInlineBotsTypeID: - // Decoding topChatCategoryInlineBots#1678eb7c. - v := TopChatCategoryInlineBots{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case TopChatCategoryWebAppBotsTypeID: - // Decoding topChatCategoryWebAppBots#5f6d6fd. - v := TopChatCategoryWebAppBots{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case TopChatCategoryCallsTypeID: - // Decoding topChatCategoryCalls#153b50dd. - v := TopChatCategoryCalls{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case TopChatCategoryForwardChatsTypeID: - // Decoding topChatCategoryForwardChats#6515b7d5. - v := TopChatCategoryForwardChats{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONTopChatCategory implements binary de-serialization for TopChatCategoryClass. -func DecodeTDLibJSONTopChatCategory(buf tdjson.Decoder) (TopChatCategoryClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "topChatCategoryUsers": - // Decoding topChatCategoryUsers#3d324d80. - v := TopChatCategoryUsers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case "topChatCategoryBots": - // Decoding topChatCategoryBots#a1feeb15. - v := TopChatCategoryBots{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case "topChatCategoryGroups": - // Decoding topChatCategoryGroups#5b32d08e. - v := TopChatCategoryGroups{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case "topChatCategoryChannels": - // Decoding topChatCategoryChannels#e22600e3. - v := TopChatCategoryChannels{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case "topChatCategoryInlineBots": - // Decoding topChatCategoryInlineBots#1678eb7c. - v := TopChatCategoryInlineBots{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case "topChatCategoryWebAppBots": - // Decoding topChatCategoryWebAppBots#5f6d6fd. - v := TopChatCategoryWebAppBots{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case "topChatCategoryCalls": - // Decoding topChatCategoryCalls#153b50dd. - v := TopChatCategoryCalls{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - case "topChatCategoryForwardChats": - // Decoding topChatCategoryForwardChats#6515b7d5. - v := TopChatCategoryForwardChats{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode TopChatCategoryClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// TopChatCategory boxes the TopChatCategoryClass providing a helper. -type TopChatCategoryBox struct { - TopChatCategory TopChatCategoryClass -} - -// Decode implements bin.Decoder for TopChatCategoryBox. -func (b *TopChatCategoryBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode TopChatCategoryBox to nil") - } - v, err := DecodeTopChatCategory(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TopChatCategory = v - return nil -} - -// Encode implements bin.Encode for TopChatCategoryBox. -func (b *TopChatCategoryBox) Encode(buf *bin.Buffer) error { - if b == nil || b.TopChatCategory == nil { - return fmt.Errorf("unable to encode TopChatCategoryClass as nil") - } - return b.TopChatCategory.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for TopChatCategoryBox. -func (b *TopChatCategoryBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode TopChatCategoryBox to nil") - } - v, err := DecodeTDLibJSONTopChatCategory(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.TopChatCategory = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for TopChatCategoryBox. -func (b *TopChatCategoryBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.TopChatCategory == nil { - return fmt.Errorf("unable to encode TopChatCategoryClass as nil") - } - return b.TopChatCategory.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_transfer_chat_ownership_gen.go b/tdapi/tl_transfer_chat_ownership_gen.go deleted file mode 100644 index b1517fe2b..000000000 --- a/tdapi/tl_transfer_chat_ownership_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TransferChatOwnershipRequest represents TL type `transferChatOwnership#77a00a13`. -type TransferChatOwnershipRequest struct { - // Chat identifier - ChatID int64 - // Identifier of the user to which transfer the ownership. The ownership can't be - // transferred to a bot or to a deleted user - UserID int64 - // The 2-step verification password of the current user - Password string -} - -// TransferChatOwnershipRequestTypeID is TL type id of TransferChatOwnershipRequest. -const TransferChatOwnershipRequestTypeID = 0x77a00a13 - -// Ensuring interfaces in compile-time for TransferChatOwnershipRequest. -var ( - _ bin.Encoder = &TransferChatOwnershipRequest{} - _ bin.Decoder = &TransferChatOwnershipRequest{} - _ bin.BareEncoder = &TransferChatOwnershipRequest{} - _ bin.BareDecoder = &TransferChatOwnershipRequest{} -) - -func (t *TransferChatOwnershipRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.UserID == 0) { - return false - } - if !(t.Password == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TransferChatOwnershipRequest) String() string { - if t == nil { - return "TransferChatOwnershipRequest(nil)" - } - type Alias TransferChatOwnershipRequest - return fmt.Sprintf("TransferChatOwnershipRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TransferChatOwnershipRequest) TypeID() uint32 { - return TransferChatOwnershipRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TransferChatOwnershipRequest) TypeName() string { - return "transferChatOwnership" -} - -// TypeInfo returns info about TL type. -func (t *TransferChatOwnershipRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "transferChatOwnership", - ID: TransferChatOwnershipRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Password", - SchemaName: "password", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TransferChatOwnershipRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode transferChatOwnership#77a00a13 as nil") - } - b.PutID(TransferChatOwnershipRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TransferChatOwnershipRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode transferChatOwnership#77a00a13 as nil") - } - b.PutInt53(t.ChatID) - b.PutInt53(t.UserID) - b.PutString(t.Password) - return nil -} - -// Decode implements bin.Decoder. -func (t *TransferChatOwnershipRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode transferChatOwnership#77a00a13 to nil") - } - if err := b.ConsumeID(TransferChatOwnershipRequestTypeID); err != nil { - return fmt.Errorf("unable to decode transferChatOwnership#77a00a13: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TransferChatOwnershipRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode transferChatOwnership#77a00a13 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferChatOwnership#77a00a13: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferChatOwnership#77a00a13: field user_id: %w", err) - } - t.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode transferChatOwnership#77a00a13: field password: %w", err) - } - t.Password = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TransferChatOwnershipRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode transferChatOwnership#77a00a13 as nil") - } - b.ObjStart() - b.PutID("transferChatOwnership") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("user_id") - b.PutInt53(t.UserID) - b.Comma() - b.FieldStart("password") - b.PutString(t.Password) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TransferChatOwnershipRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode transferChatOwnership#77a00a13 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("transferChatOwnership"); err != nil { - return fmt.Errorf("unable to decode transferChatOwnership#77a00a13: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferChatOwnership#77a00a13: field chat_id: %w", err) - } - t.ChatID = value - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferChatOwnership#77a00a13: field user_id: %w", err) - } - t.UserID = value - case "password": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode transferChatOwnership#77a00a13: field password: %w", err) - } - t.Password = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *TransferChatOwnershipRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetUserID returns value of UserID field. -func (t *TransferChatOwnershipRequest) GetUserID() (value int64) { - if t == nil { - return - } - return t.UserID -} - -// GetPassword returns value of Password field. -func (t *TransferChatOwnershipRequest) GetPassword() (value string) { - if t == nil { - return - } - return t.Password -} - -// TransferChatOwnership invokes method transferChatOwnership#77a00a13 returning error if any. -func (c *Client) TransferChatOwnership(ctx context.Context, request *TransferChatOwnershipRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_transfer_gift_gen.go b/tdapi/tl_transfer_gift_gen.go deleted file mode 100644 index 238979990..000000000 --- a/tdapi/tl_transfer_gift_gen.go +++ /dev/null @@ -1,305 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TransferGiftRequest represents TL type `transferGift#7f379a4e`. -type TransferGiftRequest struct { - // Identifier of the user that sent the gift - SenderUserID int64 - // Identifier of the message with the upgraded gift in the chat with the user - MessageID int64 - // Identifier of the user that will receive the gift - ReceiverUserID int64 - // The amount of Telegram Stars required for the transfer - StarCount int64 -} - -// TransferGiftRequestTypeID is TL type id of TransferGiftRequest. -const TransferGiftRequestTypeID = 0x7f379a4e - -// Ensuring interfaces in compile-time for TransferGiftRequest. -var ( - _ bin.Encoder = &TransferGiftRequest{} - _ bin.Decoder = &TransferGiftRequest{} - _ bin.BareEncoder = &TransferGiftRequest{} - _ bin.BareDecoder = &TransferGiftRequest{} -) - -func (t *TransferGiftRequest) Zero() bool { - if t == nil { - return true - } - if !(t.SenderUserID == 0) { - return false - } - if !(t.MessageID == 0) { - return false - } - if !(t.ReceiverUserID == 0) { - return false - } - if !(t.StarCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TransferGiftRequest) String() string { - if t == nil { - return "TransferGiftRequest(nil)" - } - type Alias TransferGiftRequest - return fmt.Sprintf("TransferGiftRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TransferGiftRequest) TypeID() uint32 { - return TransferGiftRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TransferGiftRequest) TypeName() string { - return "transferGift" -} - -// TypeInfo returns info about TL type. -func (t *TransferGiftRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "transferGift", - ID: TransferGiftRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ReceiverUserID", - SchemaName: "receiver_user_id", - }, - { - Name: "StarCount", - SchemaName: "star_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TransferGiftRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode transferGift#7f379a4e as nil") - } - b.PutID(TransferGiftRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TransferGiftRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode transferGift#7f379a4e as nil") - } - b.PutInt53(t.SenderUserID) - b.PutInt53(t.MessageID) - b.PutInt53(t.ReceiverUserID) - b.PutInt53(t.StarCount) - return nil -} - -// Decode implements bin.Decoder. -func (t *TransferGiftRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode transferGift#7f379a4e to nil") - } - if err := b.ConsumeID(TransferGiftRequestTypeID); err != nil { - return fmt.Errorf("unable to decode transferGift#7f379a4e: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TransferGiftRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode transferGift#7f379a4e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferGift#7f379a4e: field sender_user_id: %w", err) - } - t.SenderUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferGift#7f379a4e: field message_id: %w", err) - } - t.MessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferGift#7f379a4e: field receiver_user_id: %w", err) - } - t.ReceiverUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferGift#7f379a4e: field star_count: %w", err) - } - t.StarCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TransferGiftRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode transferGift#7f379a4e as nil") - } - b.ObjStart() - b.PutID("transferGift") - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(t.SenderUserID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(t.MessageID) - b.Comma() - b.FieldStart("receiver_user_id") - b.PutInt53(t.ReceiverUserID) - b.Comma() - b.FieldStart("star_count") - b.PutInt53(t.StarCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TransferGiftRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode transferGift#7f379a4e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("transferGift"); err != nil { - return fmt.Errorf("unable to decode transferGift#7f379a4e: %w", err) - } - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferGift#7f379a4e: field sender_user_id: %w", err) - } - t.SenderUserID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferGift#7f379a4e: field message_id: %w", err) - } - t.MessageID = value - case "receiver_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferGift#7f379a4e: field receiver_user_id: %w", err) - } - t.ReceiverUserID = value - case "star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode transferGift#7f379a4e: field star_count: %w", err) - } - t.StarCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderUserID returns value of SenderUserID field. -func (t *TransferGiftRequest) GetSenderUserID() (value int64) { - if t == nil { - return - } - return t.SenderUserID -} - -// GetMessageID returns value of MessageID field. -func (t *TransferGiftRequest) GetMessageID() (value int64) { - if t == nil { - return - } - return t.MessageID -} - -// GetReceiverUserID returns value of ReceiverUserID field. -func (t *TransferGiftRequest) GetReceiverUserID() (value int64) { - if t == nil { - return - } - return t.ReceiverUserID -} - -// GetStarCount returns value of StarCount field. -func (t *TransferGiftRequest) GetStarCount() (value int64) { - if t == nil { - return - } - return t.StarCount -} - -// TransferGift invokes method transferGift#7f379a4e returning error if any. -func (c *Client) TransferGift(ctx context.Context, request *TransferGiftRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_translate_message_text_gen.go b/tdapi/tl_translate_message_text_gen.go deleted file mode 100644 index 6e81cf92b..000000000 --- a/tdapi/tl_translate_message_text_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TranslateMessageTextRequest represents TL type `translateMessageText#53c51ed2`. -type TranslateMessageTextRequest struct { - // Identifier of the chat to which the message belongs - ChatID int64 - // Identifier of the message - MessageID int64 - // Language code of the language to which the message is translated. Must be one of - ToLanguageCode string -} - -// TranslateMessageTextRequestTypeID is TL type id of TranslateMessageTextRequest. -const TranslateMessageTextRequestTypeID = 0x53c51ed2 - -// Ensuring interfaces in compile-time for TranslateMessageTextRequest. -var ( - _ bin.Encoder = &TranslateMessageTextRequest{} - _ bin.Decoder = &TranslateMessageTextRequest{} - _ bin.BareEncoder = &TranslateMessageTextRequest{} - _ bin.BareDecoder = &TranslateMessageTextRequest{} -) - -func (t *TranslateMessageTextRequest) Zero() bool { - if t == nil { - return true - } - if !(t.ChatID == 0) { - return false - } - if !(t.MessageID == 0) { - return false - } - if !(t.ToLanguageCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TranslateMessageTextRequest) String() string { - if t == nil { - return "TranslateMessageTextRequest(nil)" - } - type Alias TranslateMessageTextRequest - return fmt.Sprintf("TranslateMessageTextRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TranslateMessageTextRequest) TypeID() uint32 { - return TranslateMessageTextRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TranslateMessageTextRequest) TypeName() string { - return "translateMessageText" -} - -// TypeInfo returns info about TL type. -func (t *TranslateMessageTextRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "translateMessageText", - ID: TranslateMessageTextRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ToLanguageCode", - SchemaName: "to_language_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TranslateMessageTextRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode translateMessageText#53c51ed2 as nil") - } - b.PutID(TranslateMessageTextRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TranslateMessageTextRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode translateMessageText#53c51ed2 as nil") - } - b.PutInt53(t.ChatID) - b.PutInt53(t.MessageID) - b.PutString(t.ToLanguageCode) - return nil -} - -// Decode implements bin.Decoder. -func (t *TranslateMessageTextRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode translateMessageText#53c51ed2 to nil") - } - if err := b.ConsumeID(TranslateMessageTextRequestTypeID); err != nil { - return fmt.Errorf("unable to decode translateMessageText#53c51ed2: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TranslateMessageTextRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode translateMessageText#53c51ed2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode translateMessageText#53c51ed2: field chat_id: %w", err) - } - t.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode translateMessageText#53c51ed2: field message_id: %w", err) - } - t.MessageID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode translateMessageText#53c51ed2: field to_language_code: %w", err) - } - t.ToLanguageCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TranslateMessageTextRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode translateMessageText#53c51ed2 as nil") - } - b.ObjStart() - b.PutID("translateMessageText") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(t.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(t.MessageID) - b.Comma() - b.FieldStart("to_language_code") - b.PutString(t.ToLanguageCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TranslateMessageTextRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode translateMessageText#53c51ed2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("translateMessageText"); err != nil { - return fmt.Errorf("unable to decode translateMessageText#53c51ed2: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode translateMessageText#53c51ed2: field chat_id: %w", err) - } - t.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode translateMessageText#53c51ed2: field message_id: %w", err) - } - t.MessageID = value - case "to_language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode translateMessageText#53c51ed2: field to_language_code: %w", err) - } - t.ToLanguageCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (t *TranslateMessageTextRequest) GetChatID() (value int64) { - if t == nil { - return - } - return t.ChatID -} - -// GetMessageID returns value of MessageID field. -func (t *TranslateMessageTextRequest) GetMessageID() (value int64) { - if t == nil { - return - } - return t.MessageID -} - -// GetToLanguageCode returns value of ToLanguageCode field. -func (t *TranslateMessageTextRequest) GetToLanguageCode() (value string) { - if t == nil { - return - } - return t.ToLanguageCode -} - -// TranslateMessageText invokes method translateMessageText#53c51ed2 returning error if any. -func (c *Client) TranslateMessageText(ctx context.Context, request *TranslateMessageTextRequest) (*FormattedText, error) { - var result FormattedText - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_translate_text_gen.go b/tdapi/tl_translate_text_gen.go deleted file mode 100644 index eb55ef676..000000000 --- a/tdapi/tl_translate_text_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TranslateTextRequest represents TL type `translateText#252264f2`. -type TranslateTextRequest struct { - // Text to translate - Text FormattedText - // Language code of the language to which the message is translated. Must be one of - ToLanguageCode string -} - -// TranslateTextRequestTypeID is TL type id of TranslateTextRequest. -const TranslateTextRequestTypeID = 0x252264f2 - -// Ensuring interfaces in compile-time for TranslateTextRequest. -var ( - _ bin.Encoder = &TranslateTextRequest{} - _ bin.Decoder = &TranslateTextRequest{} - _ bin.BareEncoder = &TranslateTextRequest{} - _ bin.BareDecoder = &TranslateTextRequest{} -) - -func (t *TranslateTextRequest) Zero() bool { - if t == nil { - return true - } - if !(t.Text.Zero()) { - return false - } - if !(t.ToLanguageCode == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TranslateTextRequest) String() string { - if t == nil { - return "TranslateTextRequest(nil)" - } - type Alias TranslateTextRequest - return fmt.Sprintf("TranslateTextRequest%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TranslateTextRequest) TypeID() uint32 { - return TranslateTextRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*TranslateTextRequest) TypeName() string { - return "translateText" -} - -// TypeInfo returns info about TL type. -func (t *TranslateTextRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "translateText", - ID: TranslateTextRequestTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "ToLanguageCode", - SchemaName: "to_language_code", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TranslateTextRequest) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode translateText#252264f2 as nil") - } - b.PutID(TranslateTextRequestTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TranslateTextRequest) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode translateText#252264f2 as nil") - } - if err := t.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode translateText#252264f2: field text: %w", err) - } - b.PutString(t.ToLanguageCode) - return nil -} - -// Decode implements bin.Decoder. -func (t *TranslateTextRequest) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode translateText#252264f2 to nil") - } - if err := b.ConsumeID(TranslateTextRequestTypeID); err != nil { - return fmt.Errorf("unable to decode translateText#252264f2: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TranslateTextRequest) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode translateText#252264f2 to nil") - } - { - if err := t.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode translateText#252264f2: field text: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode translateText#252264f2: field to_language_code: %w", err) - } - t.ToLanguageCode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TranslateTextRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode translateText#252264f2 as nil") - } - b.ObjStart() - b.PutID("translateText") - b.Comma() - b.FieldStart("text") - if err := t.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode translateText#252264f2: field text: %w", err) - } - b.Comma() - b.FieldStart("to_language_code") - b.PutString(t.ToLanguageCode) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TranslateTextRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode translateText#252264f2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("translateText"); err != nil { - return fmt.Errorf("unable to decode translateText#252264f2: %w", err) - } - case "text": - if err := t.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode translateText#252264f2: field text: %w", err) - } - case "to_language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode translateText#252264f2: field to_language_code: %w", err) - } - t.ToLanguageCode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetText returns value of Text field. -func (t *TranslateTextRequest) GetText() (value FormattedText) { - if t == nil { - return - } - return t.Text -} - -// GetToLanguageCode returns value of ToLanguageCode field. -func (t *TranslateTextRequest) GetToLanguageCode() (value string) { - if t == nil { - return - } - return t.ToLanguageCode -} - -// TranslateText invokes method translateText#252264f2 returning error if any. -func (c *Client) TranslateText(ctx context.Context, request *TranslateTextRequest) (*FormattedText, error) { - var result FormattedText - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_trending_sticker_sets_gen.go b/tdapi/tl_trending_sticker_sets_gen.go deleted file mode 100644 index 72d2d841e..000000000 --- a/tdapi/tl_trending_sticker_sets_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// TrendingStickerSets represents TL type `trendingStickerSets#298f12cc`. -type TrendingStickerSets struct { - // Approximate total number of trending sticker sets - TotalCount int32 - // List of trending sticker sets - Sets []StickerSetInfo - // True, if the list contains sticker sets with premium stickers - IsPremium bool -} - -// TrendingStickerSetsTypeID is TL type id of TrendingStickerSets. -const TrendingStickerSetsTypeID = 0x298f12cc - -// Ensuring interfaces in compile-time for TrendingStickerSets. -var ( - _ bin.Encoder = &TrendingStickerSets{} - _ bin.Decoder = &TrendingStickerSets{} - _ bin.BareEncoder = &TrendingStickerSets{} - _ bin.BareDecoder = &TrendingStickerSets{} -) - -func (t *TrendingStickerSets) Zero() bool { - if t == nil { - return true - } - if !(t.TotalCount == 0) { - return false - } - if !(t.Sets == nil) { - return false - } - if !(t.IsPremium == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (t *TrendingStickerSets) String() string { - if t == nil { - return "TrendingStickerSets(nil)" - } - type Alias TrendingStickerSets - return fmt.Sprintf("TrendingStickerSets%+v", Alias(*t)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*TrendingStickerSets) TypeID() uint32 { - return TrendingStickerSetsTypeID -} - -// TypeName returns name of type in TL schema. -func (*TrendingStickerSets) TypeName() string { - return "trendingStickerSets" -} - -// TypeInfo returns info about TL type. -func (t *TrendingStickerSets) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "trendingStickerSets", - ID: TrendingStickerSetsTypeID, - } - if t == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Sets", - SchemaName: "sets", - }, - { - Name: "IsPremium", - SchemaName: "is_premium", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (t *TrendingStickerSets) Encode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode trendingStickerSets#298f12cc as nil") - } - b.PutID(TrendingStickerSetsTypeID) - return t.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (t *TrendingStickerSets) EncodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't encode trendingStickerSets#298f12cc as nil") - } - b.PutInt32(t.TotalCount) - b.PutInt(len(t.Sets)) - for idx, v := range t.Sets { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare trendingStickerSets#298f12cc: field sets element with index %d: %w", idx, err) - } - } - b.PutBool(t.IsPremium) - return nil -} - -// Decode implements bin.Decoder. -func (t *TrendingStickerSets) Decode(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode trendingStickerSets#298f12cc to nil") - } - if err := b.ConsumeID(TrendingStickerSetsTypeID); err != nil { - return fmt.Errorf("unable to decode trendingStickerSets#298f12cc: %w", err) - } - return t.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (t *TrendingStickerSets) DecodeBare(b *bin.Buffer) error { - if t == nil { - return fmt.Errorf("can't decode trendingStickerSets#298f12cc to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode trendingStickerSets#298f12cc: field total_count: %w", err) - } - t.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode trendingStickerSets#298f12cc: field sets: %w", err) - } - - if headerLen > 0 { - t.Sets = make([]StickerSetInfo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value StickerSetInfo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare trendingStickerSets#298f12cc: field sets: %w", err) - } - t.Sets = append(t.Sets, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode trendingStickerSets#298f12cc: field is_premium: %w", err) - } - t.IsPremium = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (t *TrendingStickerSets) EncodeTDLibJSON(b tdjson.Encoder) error { - if t == nil { - return fmt.Errorf("can't encode trendingStickerSets#298f12cc as nil") - } - b.ObjStart() - b.PutID("trendingStickerSets") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(t.TotalCount) - b.Comma() - b.FieldStart("sets") - b.ArrStart() - for idx, v := range t.Sets { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode trendingStickerSets#298f12cc: field sets element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("is_premium") - b.PutBool(t.IsPremium) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (t *TrendingStickerSets) DecodeTDLibJSON(b tdjson.Decoder) error { - if t == nil { - return fmt.Errorf("can't decode trendingStickerSets#298f12cc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("trendingStickerSets"); err != nil { - return fmt.Errorf("unable to decode trendingStickerSets#298f12cc: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode trendingStickerSets#298f12cc: field total_count: %w", err) - } - t.TotalCount = value - case "sets": - if err := b.Arr(func(b tdjson.Decoder) error { - var value StickerSetInfo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode trendingStickerSets#298f12cc: field sets: %w", err) - } - t.Sets = append(t.Sets, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode trendingStickerSets#298f12cc: field sets: %w", err) - } - case "is_premium": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode trendingStickerSets#298f12cc: field is_premium: %w", err) - } - t.IsPremium = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (t *TrendingStickerSets) GetTotalCount() (value int32) { - if t == nil { - return - } - return t.TotalCount -} - -// GetSets returns value of Sets field. -func (t *TrendingStickerSets) GetSets() (value []StickerSetInfo) { - if t == nil { - return - } - return t.Sets -} - -// GetIsPremium returns value of IsPremium field. -func (t *TrendingStickerSets) GetIsPremium() (value bool) { - if t == nil { - return - } - return t.IsPremium -} diff --git a/tdapi/tl_unconfirmed_session_gen.go b/tdapi/tl_unconfirmed_session_gen.go deleted file mode 100644 index 0c54cee5a..000000000 --- a/tdapi/tl_unconfirmed_session_gen.go +++ /dev/null @@ -1,297 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UnconfirmedSession represents TL type `unconfirmedSession#850d49f9`. -type UnconfirmedSession struct { - // Session identifier - ID int64 - // Point in time (Unix timestamp) when the user has logged in - LogInDate int32 - // Model of the device that was used for the session creation, as provided by the - // application - DeviceModel string - // A human-readable description of the location from which the session was created, based - // on the IP address - Location string -} - -// UnconfirmedSessionTypeID is TL type id of UnconfirmedSession. -const UnconfirmedSessionTypeID = 0x850d49f9 - -// Ensuring interfaces in compile-time for UnconfirmedSession. -var ( - _ bin.Encoder = &UnconfirmedSession{} - _ bin.Decoder = &UnconfirmedSession{} - _ bin.BareEncoder = &UnconfirmedSession{} - _ bin.BareDecoder = &UnconfirmedSession{} -) - -func (u *UnconfirmedSession) Zero() bool { - if u == nil { - return true - } - if !(u.ID == 0) { - return false - } - if !(u.LogInDate == 0) { - return false - } - if !(u.DeviceModel == "") { - return false - } - if !(u.Location == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UnconfirmedSession) String() string { - if u == nil { - return "UnconfirmedSession(nil)" - } - type Alias UnconfirmedSession - return fmt.Sprintf("UnconfirmedSession%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UnconfirmedSession) TypeID() uint32 { - return UnconfirmedSessionTypeID -} - -// TypeName returns name of type in TL schema. -func (*UnconfirmedSession) TypeName() string { - return "unconfirmedSession" -} - -// TypeInfo returns info about TL type. -func (u *UnconfirmedSession) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "unconfirmedSession", - ID: UnconfirmedSessionTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "LogInDate", - SchemaName: "log_in_date", - }, - { - Name: "DeviceModel", - SchemaName: "device_model", - }, - { - Name: "Location", - SchemaName: "location", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UnconfirmedSession) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode unconfirmedSession#850d49f9 as nil") - } - b.PutID(UnconfirmedSessionTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UnconfirmedSession) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode unconfirmedSession#850d49f9 as nil") - } - b.PutLong(u.ID) - b.PutInt32(u.LogInDate) - b.PutString(u.DeviceModel) - b.PutString(u.Location) - return nil -} - -// Decode implements bin.Decoder. -func (u *UnconfirmedSession) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode unconfirmedSession#850d49f9 to nil") - } - if err := b.ConsumeID(UnconfirmedSessionTypeID); err != nil { - return fmt.Errorf("unable to decode unconfirmedSession#850d49f9: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UnconfirmedSession) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode unconfirmedSession#850d49f9 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode unconfirmedSession#850d49f9: field id: %w", err) - } - u.ID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode unconfirmedSession#850d49f9: field log_in_date: %w", err) - } - u.LogInDate = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode unconfirmedSession#850d49f9: field device_model: %w", err) - } - u.DeviceModel = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode unconfirmedSession#850d49f9: field location: %w", err) - } - u.Location = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UnconfirmedSession) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode unconfirmedSession#850d49f9 as nil") - } - b.ObjStart() - b.PutID("unconfirmedSession") - b.Comma() - b.FieldStart("id") - b.PutLong(u.ID) - b.Comma() - b.FieldStart("log_in_date") - b.PutInt32(u.LogInDate) - b.Comma() - b.FieldStart("device_model") - b.PutString(u.DeviceModel) - b.Comma() - b.FieldStart("location") - b.PutString(u.Location) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UnconfirmedSession) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode unconfirmedSession#850d49f9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("unconfirmedSession"); err != nil { - return fmt.Errorf("unable to decode unconfirmedSession#850d49f9: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode unconfirmedSession#850d49f9: field id: %w", err) - } - u.ID = value - case "log_in_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode unconfirmedSession#850d49f9: field log_in_date: %w", err) - } - u.LogInDate = value - case "device_model": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode unconfirmedSession#850d49f9: field device_model: %w", err) - } - u.DeviceModel = value - case "location": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode unconfirmedSession#850d49f9: field location: %w", err) - } - u.Location = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (u *UnconfirmedSession) GetID() (value int64) { - if u == nil { - return - } - return u.ID -} - -// GetLogInDate returns value of LogInDate field. -func (u *UnconfirmedSession) GetLogInDate() (value int32) { - if u == nil { - return - } - return u.LogInDate -} - -// GetDeviceModel returns value of DeviceModel field. -func (u *UnconfirmedSession) GetDeviceModel() (value string) { - if u == nil { - return - } - return u.DeviceModel -} - -// GetLocation returns value of Location field. -func (u *UnconfirmedSession) GetLocation() (value string) { - if u == nil { - return - } - return u.Location -} diff --git a/tdapi/tl_unpin_all_chat_messages_gen.go b/tdapi/tl_unpin_all_chat_messages_gen.go deleted file mode 100644 index 9dfbf18f0..000000000 --- a/tdapi/tl_unpin_all_chat_messages_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UnpinAllChatMessagesRequest represents TL type `unpinAllChatMessages#aa4cd4b7`. -type UnpinAllChatMessagesRequest struct { - // Identifier of the chat - ChatID int64 -} - -// UnpinAllChatMessagesRequestTypeID is TL type id of UnpinAllChatMessagesRequest. -const UnpinAllChatMessagesRequestTypeID = 0xaa4cd4b7 - -// Ensuring interfaces in compile-time for UnpinAllChatMessagesRequest. -var ( - _ bin.Encoder = &UnpinAllChatMessagesRequest{} - _ bin.Decoder = &UnpinAllChatMessagesRequest{} - _ bin.BareEncoder = &UnpinAllChatMessagesRequest{} - _ bin.BareDecoder = &UnpinAllChatMessagesRequest{} -) - -func (u *UnpinAllChatMessagesRequest) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UnpinAllChatMessagesRequest) String() string { - if u == nil { - return "UnpinAllChatMessagesRequest(nil)" - } - type Alias UnpinAllChatMessagesRequest - return fmt.Sprintf("UnpinAllChatMessagesRequest%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UnpinAllChatMessagesRequest) TypeID() uint32 { - return UnpinAllChatMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*UnpinAllChatMessagesRequest) TypeName() string { - return "unpinAllChatMessages" -} - -// TypeInfo returns info about TL type. -func (u *UnpinAllChatMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "unpinAllChatMessages", - ID: UnpinAllChatMessagesRequestTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UnpinAllChatMessagesRequest) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode unpinAllChatMessages#aa4cd4b7 as nil") - } - b.PutID(UnpinAllChatMessagesRequestTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UnpinAllChatMessagesRequest) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode unpinAllChatMessages#aa4cd4b7 as nil") - } - b.PutInt53(u.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UnpinAllChatMessagesRequest) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode unpinAllChatMessages#aa4cd4b7 to nil") - } - if err := b.ConsumeID(UnpinAllChatMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode unpinAllChatMessages#aa4cd4b7: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UnpinAllChatMessagesRequest) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode unpinAllChatMessages#aa4cd4b7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode unpinAllChatMessages#aa4cd4b7: field chat_id: %w", err) - } - u.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UnpinAllChatMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode unpinAllChatMessages#aa4cd4b7 as nil") - } - b.ObjStart() - b.PutID("unpinAllChatMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UnpinAllChatMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode unpinAllChatMessages#aa4cd4b7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("unpinAllChatMessages"); err != nil { - return fmt.Errorf("unable to decode unpinAllChatMessages#aa4cd4b7: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode unpinAllChatMessages#aa4cd4b7: field chat_id: %w", err) - } - u.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UnpinAllChatMessagesRequest) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// UnpinAllChatMessages invokes method unpinAllChatMessages#aa4cd4b7 returning error if any. -func (c *Client) UnpinAllChatMessages(ctx context.Context, chatid int64) error { - var ok Ok - - request := &UnpinAllChatMessagesRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_unpin_all_message_thread_messages_gen.go b/tdapi/tl_unpin_all_message_thread_messages_gen.go deleted file mode 100644 index fd15d02f7..000000000 --- a/tdapi/tl_unpin_all_message_thread_messages_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UnpinAllMessageThreadMessagesRequest represents TL type `unpinAllMessageThreadMessages#b7c69f00`. -type UnpinAllMessageThreadMessagesRequest struct { - // Identifier of the chat - ChatID int64 - // Message thread identifier in which messages will be unpinned - MessageThreadID int64 -} - -// UnpinAllMessageThreadMessagesRequestTypeID is TL type id of UnpinAllMessageThreadMessagesRequest. -const UnpinAllMessageThreadMessagesRequestTypeID = 0xb7c69f00 - -// Ensuring interfaces in compile-time for UnpinAllMessageThreadMessagesRequest. -var ( - _ bin.Encoder = &UnpinAllMessageThreadMessagesRequest{} - _ bin.Decoder = &UnpinAllMessageThreadMessagesRequest{} - _ bin.BareEncoder = &UnpinAllMessageThreadMessagesRequest{} - _ bin.BareDecoder = &UnpinAllMessageThreadMessagesRequest{} -) - -func (u *UnpinAllMessageThreadMessagesRequest) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageThreadID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UnpinAllMessageThreadMessagesRequest) String() string { - if u == nil { - return "UnpinAllMessageThreadMessagesRequest(nil)" - } - type Alias UnpinAllMessageThreadMessagesRequest - return fmt.Sprintf("UnpinAllMessageThreadMessagesRequest%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UnpinAllMessageThreadMessagesRequest) TypeID() uint32 { - return UnpinAllMessageThreadMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*UnpinAllMessageThreadMessagesRequest) TypeName() string { - return "unpinAllMessageThreadMessages" -} - -// TypeInfo returns info about TL type. -func (u *UnpinAllMessageThreadMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "unpinAllMessageThreadMessages", - ID: UnpinAllMessageThreadMessagesRequestTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UnpinAllMessageThreadMessagesRequest) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode unpinAllMessageThreadMessages#b7c69f00 as nil") - } - b.PutID(UnpinAllMessageThreadMessagesRequestTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UnpinAllMessageThreadMessagesRequest) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode unpinAllMessageThreadMessages#b7c69f00 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageThreadID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UnpinAllMessageThreadMessagesRequest) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode unpinAllMessageThreadMessages#b7c69f00 to nil") - } - if err := b.ConsumeID(UnpinAllMessageThreadMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode unpinAllMessageThreadMessages#b7c69f00: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UnpinAllMessageThreadMessagesRequest) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode unpinAllMessageThreadMessages#b7c69f00 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode unpinAllMessageThreadMessages#b7c69f00: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode unpinAllMessageThreadMessages#b7c69f00: field message_thread_id: %w", err) - } - u.MessageThreadID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UnpinAllMessageThreadMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode unpinAllMessageThreadMessages#b7c69f00 as nil") - } - b.ObjStart() - b.PutID("unpinAllMessageThreadMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(u.MessageThreadID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UnpinAllMessageThreadMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode unpinAllMessageThreadMessages#b7c69f00 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("unpinAllMessageThreadMessages"); err != nil { - return fmt.Errorf("unable to decode unpinAllMessageThreadMessages#b7c69f00: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode unpinAllMessageThreadMessages#b7c69f00: field chat_id: %w", err) - } - u.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode unpinAllMessageThreadMessages#b7c69f00: field message_thread_id: %w", err) - } - u.MessageThreadID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UnpinAllMessageThreadMessagesRequest) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (u *UnpinAllMessageThreadMessagesRequest) GetMessageThreadID() (value int64) { - if u == nil { - return - } - return u.MessageThreadID -} - -// UnpinAllMessageThreadMessages invokes method unpinAllMessageThreadMessages#b7c69f00 returning error if any. -func (c *Client) UnpinAllMessageThreadMessages(ctx context.Context, request *UnpinAllMessageThreadMessagesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_unpin_chat_message_gen.go b/tdapi/tl_unpin_chat_message_gen.go deleted file mode 100644 index 25bc7a10b..000000000 --- a/tdapi/tl_unpin_chat_message_gen.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UnpinChatMessageRequest represents TL type `unpinChatMessage#7b1c3ede`. -type UnpinChatMessageRequest struct { - // Identifier of the chat - ChatID int64 - // Identifier of the removed pinned message - MessageID int64 -} - -// UnpinChatMessageRequestTypeID is TL type id of UnpinChatMessageRequest. -const UnpinChatMessageRequestTypeID = 0x7b1c3ede - -// Ensuring interfaces in compile-time for UnpinChatMessageRequest. -var ( - _ bin.Encoder = &UnpinChatMessageRequest{} - _ bin.Decoder = &UnpinChatMessageRequest{} - _ bin.BareEncoder = &UnpinChatMessageRequest{} - _ bin.BareDecoder = &UnpinChatMessageRequest{} -) - -func (u *UnpinChatMessageRequest) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UnpinChatMessageRequest) String() string { - if u == nil { - return "UnpinChatMessageRequest(nil)" - } - type Alias UnpinChatMessageRequest - return fmt.Sprintf("UnpinChatMessageRequest%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UnpinChatMessageRequest) TypeID() uint32 { - return UnpinChatMessageRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*UnpinChatMessageRequest) TypeName() string { - return "unpinChatMessage" -} - -// TypeInfo returns info about TL type. -func (u *UnpinChatMessageRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "unpinChatMessage", - ID: UnpinChatMessageRequestTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UnpinChatMessageRequest) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode unpinChatMessage#7b1c3ede as nil") - } - b.PutID(UnpinChatMessageRequestTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UnpinChatMessageRequest) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode unpinChatMessage#7b1c3ede as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UnpinChatMessageRequest) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode unpinChatMessage#7b1c3ede to nil") - } - if err := b.ConsumeID(UnpinChatMessageRequestTypeID); err != nil { - return fmt.Errorf("unable to decode unpinChatMessage#7b1c3ede: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UnpinChatMessageRequest) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode unpinChatMessage#7b1c3ede to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode unpinChatMessage#7b1c3ede: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode unpinChatMessage#7b1c3ede: field message_id: %w", err) - } - u.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UnpinChatMessageRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode unpinChatMessage#7b1c3ede as nil") - } - b.ObjStart() - b.PutID("unpinChatMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UnpinChatMessageRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode unpinChatMessage#7b1c3ede to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("unpinChatMessage"); err != nil { - return fmt.Errorf("unable to decode unpinChatMessage#7b1c3ede: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode unpinChatMessage#7b1c3ede: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode unpinChatMessage#7b1c3ede: field message_id: %w", err) - } - u.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UnpinChatMessageRequest) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UnpinChatMessageRequest) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// UnpinChatMessage invokes method unpinChatMessage#7b1c3ede returning error if any. -func (c *Client) UnpinChatMessage(ctx context.Context, request *UnpinChatMessageRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_unread_reaction_gen.go b/tdapi/tl_unread_reaction_gen.go deleted file mode 100644 index 52b3482d3..000000000 --- a/tdapi/tl_unread_reaction_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UnreadReaction represents TL type `unreadReaction#8c5b3b82`. -type UnreadReaction struct { - // Type of the reaction - Type ReactionTypeClass - // Identifier of the sender, added the reaction - SenderID MessageSenderClass - // True, if the reaction was added with a big animation - IsBig bool -} - -// UnreadReactionTypeID is TL type id of UnreadReaction. -const UnreadReactionTypeID = 0x8c5b3b82 - -// Ensuring interfaces in compile-time for UnreadReaction. -var ( - _ bin.Encoder = &UnreadReaction{} - _ bin.Decoder = &UnreadReaction{} - _ bin.BareEncoder = &UnreadReaction{} - _ bin.BareDecoder = &UnreadReaction{} -) - -func (u *UnreadReaction) Zero() bool { - if u == nil { - return true - } - if !(u.Type == nil) { - return false - } - if !(u.SenderID == nil) { - return false - } - if !(u.IsBig == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UnreadReaction) String() string { - if u == nil { - return "UnreadReaction(nil)" - } - type Alias UnreadReaction - return fmt.Sprintf("UnreadReaction%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UnreadReaction) TypeID() uint32 { - return UnreadReactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*UnreadReaction) TypeName() string { - return "unreadReaction" -} - -// TypeInfo returns info about TL type. -func (u *UnreadReaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "unreadReaction", - ID: UnreadReactionTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "SenderID", - SchemaName: "sender_id", - }, - { - Name: "IsBig", - SchemaName: "is_big", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UnreadReaction) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode unreadReaction#8c5b3b82 as nil") - } - b.PutID(UnreadReactionTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UnreadReaction) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode unreadReaction#8c5b3b82 as nil") - } - if u.Type == nil { - return fmt.Errorf("unable to encode unreadReaction#8c5b3b82: field type is nil") - } - if err := u.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode unreadReaction#8c5b3b82: field type: %w", err) - } - if u.SenderID == nil { - return fmt.Errorf("unable to encode unreadReaction#8c5b3b82: field sender_id is nil") - } - if err := u.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode unreadReaction#8c5b3b82: field sender_id: %w", err) - } - b.PutBool(u.IsBig) - return nil -} - -// Decode implements bin.Decoder. -func (u *UnreadReaction) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode unreadReaction#8c5b3b82 to nil") - } - if err := b.ConsumeID(UnreadReactionTypeID); err != nil { - return fmt.Errorf("unable to decode unreadReaction#8c5b3b82: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UnreadReaction) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode unreadReaction#8c5b3b82 to nil") - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode unreadReaction#8c5b3b82: field type: %w", err) - } - u.Type = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode unreadReaction#8c5b3b82: field sender_id: %w", err) - } - u.SenderID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode unreadReaction#8c5b3b82: field is_big: %w", err) - } - u.IsBig = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UnreadReaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode unreadReaction#8c5b3b82 as nil") - } - b.ObjStart() - b.PutID("unreadReaction") - b.Comma() - b.FieldStart("type") - if u.Type == nil { - return fmt.Errorf("unable to encode unreadReaction#8c5b3b82: field type is nil") - } - if err := u.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode unreadReaction#8c5b3b82: field type: %w", err) - } - b.Comma() - b.FieldStart("sender_id") - if u.SenderID == nil { - return fmt.Errorf("unable to encode unreadReaction#8c5b3b82: field sender_id is nil") - } - if err := u.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode unreadReaction#8c5b3b82: field sender_id: %w", err) - } - b.Comma() - b.FieldStart("is_big") - b.PutBool(u.IsBig) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UnreadReaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode unreadReaction#8c5b3b82 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("unreadReaction"); err != nil { - return fmt.Errorf("unable to decode unreadReaction#8c5b3b82: %w", err) - } - case "type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode unreadReaction#8c5b3b82: field type: %w", err) - } - u.Type = value - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode unreadReaction#8c5b3b82: field sender_id: %w", err) - } - u.SenderID = value - case "is_big": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode unreadReaction#8c5b3b82: field is_big: %w", err) - } - u.IsBig = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (u *UnreadReaction) GetType() (value ReactionTypeClass) { - if u == nil { - return - } - return u.Type -} - -// GetSenderID returns value of SenderID field. -func (u *UnreadReaction) GetSenderID() (value MessageSenderClass) { - if u == nil { - return - } - return u.SenderID -} - -// GetIsBig returns value of IsBig field. -func (u *UnreadReaction) GetIsBig() (value bool) { - if u == nil { - return - } - return u.IsBig -} diff --git a/tdapi/tl_update_gen.go b/tdapi/tl_update_gen.go deleted file mode 100644 index 54f330e2a..000000000 --- a/tdapi/tl_update_gen.go +++ /dev/null @@ -1,35488 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UpdateAuthorizationState represents TL type `updateAuthorizationState#60b30ee2`. -type UpdateAuthorizationState struct { - // New authorization state - AuthorizationState AuthorizationStateClass -} - -// UpdateAuthorizationStateTypeID is TL type id of UpdateAuthorizationState. -const UpdateAuthorizationStateTypeID = 0x60b30ee2 - -// construct implements constructor of UpdateClass. -func (u UpdateAuthorizationState) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateAuthorizationState. -var ( - _ bin.Encoder = &UpdateAuthorizationState{} - _ bin.Decoder = &UpdateAuthorizationState{} - _ bin.BareEncoder = &UpdateAuthorizationState{} - _ bin.BareDecoder = &UpdateAuthorizationState{} - - _ UpdateClass = &UpdateAuthorizationState{} -) - -func (u *UpdateAuthorizationState) Zero() bool { - if u == nil { - return true - } - if !(u.AuthorizationState == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateAuthorizationState) String() string { - if u == nil { - return "UpdateAuthorizationState(nil)" - } - type Alias UpdateAuthorizationState - return fmt.Sprintf("UpdateAuthorizationState%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateAuthorizationState) TypeID() uint32 { - return UpdateAuthorizationStateTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateAuthorizationState) TypeName() string { - return "updateAuthorizationState" -} - -// TypeInfo returns info about TL type. -func (u *UpdateAuthorizationState) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateAuthorizationState", - ID: UpdateAuthorizationStateTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AuthorizationState", - SchemaName: "authorization_state", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateAuthorizationState) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAuthorizationState#60b30ee2 as nil") - } - b.PutID(UpdateAuthorizationStateTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateAuthorizationState) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAuthorizationState#60b30ee2 as nil") - } - if u.AuthorizationState == nil { - return fmt.Errorf("unable to encode updateAuthorizationState#60b30ee2: field authorization_state is nil") - } - if err := u.AuthorizationState.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateAuthorizationState#60b30ee2: field authorization_state: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateAuthorizationState) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAuthorizationState#60b30ee2 to nil") - } - if err := b.ConsumeID(UpdateAuthorizationStateTypeID); err != nil { - return fmt.Errorf("unable to decode updateAuthorizationState#60b30ee2: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateAuthorizationState) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAuthorizationState#60b30ee2 to nil") - } - { - value, err := DecodeAuthorizationState(b) - if err != nil { - return fmt.Errorf("unable to decode updateAuthorizationState#60b30ee2: field authorization_state: %w", err) - } - u.AuthorizationState = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateAuthorizationState) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateAuthorizationState#60b30ee2 as nil") - } - b.ObjStart() - b.PutID("updateAuthorizationState") - b.Comma() - b.FieldStart("authorization_state") - if u.AuthorizationState == nil { - return fmt.Errorf("unable to encode updateAuthorizationState#60b30ee2: field authorization_state is nil") - } - if err := u.AuthorizationState.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateAuthorizationState#60b30ee2: field authorization_state: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateAuthorizationState) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateAuthorizationState#60b30ee2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateAuthorizationState"); err != nil { - return fmt.Errorf("unable to decode updateAuthorizationState#60b30ee2: %w", err) - } - case "authorization_state": - value, err := DecodeTDLibJSONAuthorizationState(b) - if err != nil { - return fmt.Errorf("unable to decode updateAuthorizationState#60b30ee2: field authorization_state: %w", err) - } - u.AuthorizationState = value - default: - return b.Skip() - } - return nil - }) -} - -// GetAuthorizationState returns value of AuthorizationState field. -func (u *UpdateAuthorizationState) GetAuthorizationState() (value AuthorizationStateClass) { - if u == nil { - return - } - return u.AuthorizationState -} - -// UpdateNewMessage represents TL type `updateNewMessage#de6fb20e`. -type UpdateNewMessage struct { - // The new message - Message Message -} - -// UpdateNewMessageTypeID is TL type id of UpdateNewMessage. -const UpdateNewMessageTypeID = 0xde6fb20e - -// construct implements constructor of UpdateClass. -func (u UpdateNewMessage) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewMessage. -var ( - _ bin.Encoder = &UpdateNewMessage{} - _ bin.Decoder = &UpdateNewMessage{} - _ bin.BareEncoder = &UpdateNewMessage{} - _ bin.BareDecoder = &UpdateNewMessage{} - - _ UpdateClass = &UpdateNewMessage{} -) - -func (u *UpdateNewMessage) Zero() bool { - if u == nil { - return true - } - if !(u.Message.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewMessage) String() string { - if u == nil { - return "UpdateNewMessage(nil)" - } - type Alias UpdateNewMessage - return fmt.Sprintf("UpdateNewMessage%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewMessage) TypeID() uint32 { - return UpdateNewMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewMessage) TypeName() string { - return "updateNewMessage" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewMessage", - ID: UpdateNewMessageTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewMessage) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewMessage#de6fb20e as nil") - } - b.PutID(UpdateNewMessageTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewMessage) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewMessage#de6fb20e as nil") - } - if err := u.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewMessage#de6fb20e: field message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewMessage) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewMessage#de6fb20e to nil") - } - if err := b.ConsumeID(UpdateNewMessageTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewMessage#de6fb20e: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewMessage) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewMessage#de6fb20e to nil") - } - { - if err := u.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateNewMessage#de6fb20e: field message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewMessage#de6fb20e as nil") - } - b.ObjStart() - b.PutID("updateNewMessage") - b.Comma() - b.FieldStart("message") - if err := u.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewMessage#de6fb20e: field message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewMessage#de6fb20e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewMessage"); err != nil { - return fmt.Errorf("unable to decode updateNewMessage#de6fb20e: %w", err) - } - case "message": - if err := u.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNewMessage#de6fb20e: field message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (u *UpdateNewMessage) GetMessage() (value Message) { - if u == nil { - return - } - return u.Message -} - -// UpdateMessageSendAcknowledged represents TL type `updateMessageSendAcknowledged#4da7d239`. -type UpdateMessageSendAcknowledged struct { - // The chat identifier of the sent message - ChatID int64 - // A temporary message identifier - MessageID int64 -} - -// UpdateMessageSendAcknowledgedTypeID is TL type id of UpdateMessageSendAcknowledged. -const UpdateMessageSendAcknowledgedTypeID = 0x4da7d239 - -// construct implements constructor of UpdateClass. -func (u UpdateMessageSendAcknowledged) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageSendAcknowledged. -var ( - _ bin.Encoder = &UpdateMessageSendAcknowledged{} - _ bin.Decoder = &UpdateMessageSendAcknowledged{} - _ bin.BareEncoder = &UpdateMessageSendAcknowledged{} - _ bin.BareDecoder = &UpdateMessageSendAcknowledged{} - - _ UpdateClass = &UpdateMessageSendAcknowledged{} -) - -func (u *UpdateMessageSendAcknowledged) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageSendAcknowledged) String() string { - if u == nil { - return "UpdateMessageSendAcknowledged(nil)" - } - type Alias UpdateMessageSendAcknowledged - return fmt.Sprintf("UpdateMessageSendAcknowledged%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageSendAcknowledged) TypeID() uint32 { - return UpdateMessageSendAcknowledgedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageSendAcknowledged) TypeName() string { - return "updateMessageSendAcknowledged" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageSendAcknowledged) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageSendAcknowledged", - ID: UpdateMessageSendAcknowledgedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageSendAcknowledged) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageSendAcknowledged#4da7d239 as nil") - } - b.PutID(UpdateMessageSendAcknowledgedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageSendAcknowledged) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageSendAcknowledged#4da7d239 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageSendAcknowledged) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageSendAcknowledged#4da7d239 to nil") - } - if err := b.ConsumeID(UpdateMessageSendAcknowledgedTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageSendAcknowledged#4da7d239: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageSendAcknowledged) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageSendAcknowledged#4da7d239 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendAcknowledged#4da7d239: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendAcknowledged#4da7d239: field message_id: %w", err) - } - u.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageSendAcknowledged) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageSendAcknowledged#4da7d239 as nil") - } - b.ObjStart() - b.PutID("updateMessageSendAcknowledged") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageSendAcknowledged) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageSendAcknowledged#4da7d239 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageSendAcknowledged"); err != nil { - return fmt.Errorf("unable to decode updateMessageSendAcknowledged#4da7d239: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendAcknowledged#4da7d239: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendAcknowledged#4da7d239: field message_id: %w", err) - } - u.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageSendAcknowledged) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageSendAcknowledged) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// UpdateMessageSendSucceeded represents TL type `updateMessageSendSucceeded#6c399d7d`. -type UpdateMessageSendSucceeded struct { - // The sent message. Almost any field of the new message can be different from the - // corresponding field of the original message. - Message Message - // The previous temporary message identifier - OldMessageID int64 -} - -// UpdateMessageSendSucceededTypeID is TL type id of UpdateMessageSendSucceeded. -const UpdateMessageSendSucceededTypeID = 0x6c399d7d - -// construct implements constructor of UpdateClass. -func (u UpdateMessageSendSucceeded) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageSendSucceeded. -var ( - _ bin.Encoder = &UpdateMessageSendSucceeded{} - _ bin.Decoder = &UpdateMessageSendSucceeded{} - _ bin.BareEncoder = &UpdateMessageSendSucceeded{} - _ bin.BareDecoder = &UpdateMessageSendSucceeded{} - - _ UpdateClass = &UpdateMessageSendSucceeded{} -) - -func (u *UpdateMessageSendSucceeded) Zero() bool { - if u == nil { - return true - } - if !(u.Message.Zero()) { - return false - } - if !(u.OldMessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageSendSucceeded) String() string { - if u == nil { - return "UpdateMessageSendSucceeded(nil)" - } - type Alias UpdateMessageSendSucceeded - return fmt.Sprintf("UpdateMessageSendSucceeded%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageSendSucceeded) TypeID() uint32 { - return UpdateMessageSendSucceededTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageSendSucceeded) TypeName() string { - return "updateMessageSendSucceeded" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageSendSucceeded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageSendSucceeded", - ID: UpdateMessageSendSucceededTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "OldMessageID", - SchemaName: "old_message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageSendSucceeded) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageSendSucceeded#6c399d7d as nil") - } - b.PutID(UpdateMessageSendSucceededTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageSendSucceeded) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageSendSucceeded#6c399d7d as nil") - } - if err := u.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateMessageSendSucceeded#6c399d7d: field message: %w", err) - } - b.PutInt53(u.OldMessageID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageSendSucceeded) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageSendSucceeded#6c399d7d to nil") - } - if err := b.ConsumeID(UpdateMessageSendSucceededTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageSendSucceeded#6c399d7d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageSendSucceeded) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageSendSucceeded#6c399d7d to nil") - } - { - if err := u.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateMessageSendSucceeded#6c399d7d: field message: %w", err) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendSucceeded#6c399d7d: field old_message_id: %w", err) - } - u.OldMessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageSendSucceeded) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageSendSucceeded#6c399d7d as nil") - } - b.ObjStart() - b.PutID("updateMessageSendSucceeded") - b.Comma() - b.FieldStart("message") - if err := u.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageSendSucceeded#6c399d7d: field message: %w", err) - } - b.Comma() - b.FieldStart("old_message_id") - b.PutInt53(u.OldMessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageSendSucceeded) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageSendSucceeded#6c399d7d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageSendSucceeded"); err != nil { - return fmt.Errorf("unable to decode updateMessageSendSucceeded#6c399d7d: %w", err) - } - case "message": - if err := u.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateMessageSendSucceeded#6c399d7d: field message: %w", err) - } - case "old_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendSucceeded#6c399d7d: field old_message_id: %w", err) - } - u.OldMessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (u *UpdateMessageSendSucceeded) GetMessage() (value Message) { - if u == nil { - return - } - return u.Message -} - -// GetOldMessageID returns value of OldMessageID field. -func (u *UpdateMessageSendSucceeded) GetOldMessageID() (value int64) { - if u == nil { - return - } - return u.OldMessageID -} - -// UpdateMessageSendFailed represents TL type `updateMessageSendFailed#da1bf8e7`. -type UpdateMessageSendFailed struct { - // The failed to send message - Message Message - // The previous temporary message identifier - OldMessageID int64 - // The cause of the message sending failure - Error Error -} - -// UpdateMessageSendFailedTypeID is TL type id of UpdateMessageSendFailed. -const UpdateMessageSendFailedTypeID = 0xda1bf8e7 - -// construct implements constructor of UpdateClass. -func (u UpdateMessageSendFailed) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageSendFailed. -var ( - _ bin.Encoder = &UpdateMessageSendFailed{} - _ bin.Decoder = &UpdateMessageSendFailed{} - _ bin.BareEncoder = &UpdateMessageSendFailed{} - _ bin.BareDecoder = &UpdateMessageSendFailed{} - - _ UpdateClass = &UpdateMessageSendFailed{} -) - -func (u *UpdateMessageSendFailed) Zero() bool { - if u == nil { - return true - } - if !(u.Message.Zero()) { - return false - } - if !(u.OldMessageID == 0) { - return false - } - if !(u.Error.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageSendFailed) String() string { - if u == nil { - return "UpdateMessageSendFailed(nil)" - } - type Alias UpdateMessageSendFailed - return fmt.Sprintf("UpdateMessageSendFailed%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageSendFailed) TypeID() uint32 { - return UpdateMessageSendFailedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageSendFailed) TypeName() string { - return "updateMessageSendFailed" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageSendFailed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageSendFailed", - ID: UpdateMessageSendFailedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "OldMessageID", - SchemaName: "old_message_id", - }, - { - Name: "Error", - SchemaName: "error", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageSendFailed) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageSendFailed#da1bf8e7 as nil") - } - b.PutID(UpdateMessageSendFailedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageSendFailed) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageSendFailed#da1bf8e7 as nil") - } - if err := u.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateMessageSendFailed#da1bf8e7: field message: %w", err) - } - b.PutInt53(u.OldMessageID) - if err := u.Error.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateMessageSendFailed#da1bf8e7: field error: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageSendFailed) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageSendFailed#da1bf8e7 to nil") - } - if err := b.ConsumeID(UpdateMessageSendFailedTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageSendFailed) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageSendFailed#da1bf8e7 to nil") - } - { - if err := u.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field message: %w", err) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field old_message_id: %w", err) - } - u.OldMessageID = value - } - { - if err := u.Error.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field error: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageSendFailed) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageSendFailed#da1bf8e7 as nil") - } - b.ObjStart() - b.PutID("updateMessageSendFailed") - b.Comma() - b.FieldStart("message") - if err := u.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageSendFailed#da1bf8e7: field message: %w", err) - } - b.Comma() - b.FieldStart("old_message_id") - b.PutInt53(u.OldMessageID) - b.Comma() - b.FieldStart("error") - if err := u.Error.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageSendFailed#da1bf8e7: field error: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageSendFailed) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageSendFailed#da1bf8e7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageSendFailed"); err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: %w", err) - } - case "message": - if err := u.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field message: %w", err) - } - case "old_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field old_message_id: %w", err) - } - u.OldMessageID = value - case "error": - if err := u.Error.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateMessageSendFailed#da1bf8e7: field error: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (u *UpdateMessageSendFailed) GetMessage() (value Message) { - if u == nil { - return - } - return u.Message -} - -// GetOldMessageID returns value of OldMessageID field. -func (u *UpdateMessageSendFailed) GetOldMessageID() (value int64) { - if u == nil { - return - } - return u.OldMessageID -} - -// GetError returns value of Error field. -func (u *UpdateMessageSendFailed) GetError() (value Error) { - if u == nil { - return - } - return u.Error -} - -// UpdateMessageContent represents TL type `updateMessageContent#1e36bb24`. -type UpdateMessageContent struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 - // New message content - NewContent MessageContentClass -} - -// UpdateMessageContentTypeID is TL type id of UpdateMessageContent. -const UpdateMessageContentTypeID = 0x1e36bb24 - -// construct implements constructor of UpdateClass. -func (u UpdateMessageContent) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageContent. -var ( - _ bin.Encoder = &UpdateMessageContent{} - _ bin.Decoder = &UpdateMessageContent{} - _ bin.BareEncoder = &UpdateMessageContent{} - _ bin.BareDecoder = &UpdateMessageContent{} - - _ UpdateClass = &UpdateMessageContent{} -) - -func (u *UpdateMessageContent) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.NewContent == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageContent) String() string { - if u == nil { - return "UpdateMessageContent(nil)" - } - type Alias UpdateMessageContent - return fmt.Sprintf("UpdateMessageContent%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageContent) TypeID() uint32 { - return UpdateMessageContentTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageContent) TypeName() string { - return "updateMessageContent" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageContent) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageContent", - ID: UpdateMessageContentTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "NewContent", - SchemaName: "new_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageContent) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageContent#1e36bb24 as nil") - } - b.PutID(UpdateMessageContentTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageContent) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageContent#1e36bb24 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - if u.NewContent == nil { - return fmt.Errorf("unable to encode updateMessageContent#1e36bb24: field new_content is nil") - } - if err := u.NewContent.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateMessageContent#1e36bb24: field new_content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageContent) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageContent#1e36bb24 to nil") - } - if err := b.ConsumeID(UpdateMessageContentTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageContent#1e36bb24: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageContent) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageContent#1e36bb24 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageContent#1e36bb24: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageContent#1e36bb24: field message_id: %w", err) - } - u.MessageID = value - } - { - value, err := DecodeMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode updateMessageContent#1e36bb24: field new_content: %w", err) - } - u.NewContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageContent) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageContent#1e36bb24 as nil") - } - b.ObjStart() - b.PutID("updateMessageContent") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("new_content") - if u.NewContent == nil { - return fmt.Errorf("unable to encode updateMessageContent#1e36bb24: field new_content is nil") - } - if err := u.NewContent.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageContent#1e36bb24: field new_content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageContent) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageContent#1e36bb24 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageContent"); err != nil { - return fmt.Errorf("unable to decode updateMessageContent#1e36bb24: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageContent#1e36bb24: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageContent#1e36bb24: field message_id: %w", err) - } - u.MessageID = value - case "new_content": - value, err := DecodeTDLibJSONMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode updateMessageContent#1e36bb24: field new_content: %w", err) - } - u.NewContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageContent) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageContent) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetNewContent returns value of NewContent field. -func (u *UpdateMessageContent) GetNewContent() (value MessageContentClass) { - if u == nil { - return - } - return u.NewContent -} - -// UpdateMessageEdited represents TL type `updateMessageEdited#dea602e6`. -type UpdateMessageEdited struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 - // Point in time (Unix timestamp) when the message was edited - EditDate int32 - // New message reply markup; may be null - ReplyMarkup ReplyMarkupClass -} - -// UpdateMessageEditedTypeID is TL type id of UpdateMessageEdited. -const UpdateMessageEditedTypeID = 0xdea602e6 - -// construct implements constructor of UpdateClass. -func (u UpdateMessageEdited) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageEdited. -var ( - _ bin.Encoder = &UpdateMessageEdited{} - _ bin.Decoder = &UpdateMessageEdited{} - _ bin.BareEncoder = &UpdateMessageEdited{} - _ bin.BareDecoder = &UpdateMessageEdited{} - - _ UpdateClass = &UpdateMessageEdited{} -) - -func (u *UpdateMessageEdited) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.EditDate == 0) { - return false - } - if !(u.ReplyMarkup == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageEdited) String() string { - if u == nil { - return "UpdateMessageEdited(nil)" - } - type Alias UpdateMessageEdited - return fmt.Sprintf("UpdateMessageEdited%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageEdited) TypeID() uint32 { - return UpdateMessageEditedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageEdited) TypeName() string { - return "updateMessageEdited" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageEdited) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageEdited", - ID: UpdateMessageEditedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "EditDate", - SchemaName: "edit_date", - }, - { - Name: "ReplyMarkup", - SchemaName: "reply_markup", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageEdited) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageEdited#dea602e6 as nil") - } - b.PutID(UpdateMessageEditedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageEdited) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageEdited#dea602e6 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - b.PutInt32(u.EditDate) - if u.ReplyMarkup == nil { - return fmt.Errorf("unable to encode updateMessageEdited#dea602e6: field reply_markup is nil") - } - if err := u.ReplyMarkup.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateMessageEdited#dea602e6: field reply_markup: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageEdited) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageEdited#dea602e6 to nil") - } - if err := b.ConsumeID(UpdateMessageEditedTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageEdited#dea602e6: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageEdited) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageEdited#dea602e6 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageEdited#dea602e6: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageEdited#dea602e6: field message_id: %w", err) - } - u.MessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageEdited#dea602e6: field edit_date: %w", err) - } - u.EditDate = value - } - { - value, err := DecodeReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode updateMessageEdited#dea602e6: field reply_markup: %w", err) - } - u.ReplyMarkup = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageEdited) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageEdited#dea602e6 as nil") - } - b.ObjStart() - b.PutID("updateMessageEdited") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("edit_date") - b.PutInt32(u.EditDate) - b.Comma() - b.FieldStart("reply_markup") - if u.ReplyMarkup == nil { - return fmt.Errorf("unable to encode updateMessageEdited#dea602e6: field reply_markup is nil") - } - if err := u.ReplyMarkup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageEdited#dea602e6: field reply_markup: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageEdited) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageEdited#dea602e6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageEdited"); err != nil { - return fmt.Errorf("unable to decode updateMessageEdited#dea602e6: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageEdited#dea602e6: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageEdited#dea602e6: field message_id: %w", err) - } - u.MessageID = value - case "edit_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageEdited#dea602e6: field edit_date: %w", err) - } - u.EditDate = value - case "reply_markup": - value, err := DecodeTDLibJSONReplyMarkup(b) - if err != nil { - return fmt.Errorf("unable to decode updateMessageEdited#dea602e6: field reply_markup: %w", err) - } - u.ReplyMarkup = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageEdited) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageEdited) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetEditDate returns value of EditDate field. -func (u *UpdateMessageEdited) GetEditDate() (value int32) { - if u == nil { - return - } - return u.EditDate -} - -// GetReplyMarkup returns value of ReplyMarkup field. -func (u *UpdateMessageEdited) GetReplyMarkup() (value ReplyMarkupClass) { - if u == nil { - return - } - return u.ReplyMarkup -} - -// UpdateMessageIsPinned represents TL type `updateMessageIsPinned#41bc233d`. -type UpdateMessageIsPinned struct { - // Chat identifier - ChatID int64 - // The message identifier - MessageID int64 - // True, if the message is pinned - IsPinned bool -} - -// UpdateMessageIsPinnedTypeID is TL type id of UpdateMessageIsPinned. -const UpdateMessageIsPinnedTypeID = 0x41bc233d - -// construct implements constructor of UpdateClass. -func (u UpdateMessageIsPinned) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageIsPinned. -var ( - _ bin.Encoder = &UpdateMessageIsPinned{} - _ bin.Decoder = &UpdateMessageIsPinned{} - _ bin.BareEncoder = &UpdateMessageIsPinned{} - _ bin.BareDecoder = &UpdateMessageIsPinned{} - - _ UpdateClass = &UpdateMessageIsPinned{} -) - -func (u *UpdateMessageIsPinned) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.IsPinned == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageIsPinned) String() string { - if u == nil { - return "UpdateMessageIsPinned(nil)" - } - type Alias UpdateMessageIsPinned - return fmt.Sprintf("UpdateMessageIsPinned%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageIsPinned) TypeID() uint32 { - return UpdateMessageIsPinnedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageIsPinned) TypeName() string { - return "updateMessageIsPinned" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageIsPinned) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageIsPinned", - ID: UpdateMessageIsPinnedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "IsPinned", - SchemaName: "is_pinned", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageIsPinned) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageIsPinned#41bc233d as nil") - } - b.PutID(UpdateMessageIsPinnedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageIsPinned) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageIsPinned#41bc233d as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - b.PutBool(u.IsPinned) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageIsPinned) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageIsPinned#41bc233d to nil") - } - if err := b.ConsumeID(UpdateMessageIsPinnedTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageIsPinned#41bc233d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageIsPinned) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageIsPinned#41bc233d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageIsPinned#41bc233d: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageIsPinned#41bc233d: field message_id: %w", err) - } - u.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateMessageIsPinned#41bc233d: field is_pinned: %w", err) - } - u.IsPinned = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageIsPinned) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageIsPinned#41bc233d as nil") - } - b.ObjStart() - b.PutID("updateMessageIsPinned") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("is_pinned") - b.PutBool(u.IsPinned) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageIsPinned) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageIsPinned#41bc233d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageIsPinned"); err != nil { - return fmt.Errorf("unable to decode updateMessageIsPinned#41bc233d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageIsPinned#41bc233d: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageIsPinned#41bc233d: field message_id: %w", err) - } - u.MessageID = value - case "is_pinned": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateMessageIsPinned#41bc233d: field is_pinned: %w", err) - } - u.IsPinned = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageIsPinned) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageIsPinned) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetIsPinned returns value of IsPinned field. -func (u *UpdateMessageIsPinned) GetIsPinned() (value bool) { - if u == nil { - return - } - return u.IsPinned -} - -// UpdateMessageInteractionInfo represents TL type `updateMessageInteractionInfo#ab803bfe`. -type UpdateMessageInteractionInfo struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 - // New information about interactions with the message; may be null - InteractionInfo MessageInteractionInfo -} - -// UpdateMessageInteractionInfoTypeID is TL type id of UpdateMessageInteractionInfo. -const UpdateMessageInteractionInfoTypeID = 0xab803bfe - -// construct implements constructor of UpdateClass. -func (u UpdateMessageInteractionInfo) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageInteractionInfo. -var ( - _ bin.Encoder = &UpdateMessageInteractionInfo{} - _ bin.Decoder = &UpdateMessageInteractionInfo{} - _ bin.BareEncoder = &UpdateMessageInteractionInfo{} - _ bin.BareDecoder = &UpdateMessageInteractionInfo{} - - _ UpdateClass = &UpdateMessageInteractionInfo{} -) - -func (u *UpdateMessageInteractionInfo) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.InteractionInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageInteractionInfo) String() string { - if u == nil { - return "UpdateMessageInteractionInfo(nil)" - } - type Alias UpdateMessageInteractionInfo - return fmt.Sprintf("UpdateMessageInteractionInfo%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageInteractionInfo) TypeID() uint32 { - return UpdateMessageInteractionInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageInteractionInfo) TypeName() string { - return "updateMessageInteractionInfo" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageInteractionInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageInteractionInfo", - ID: UpdateMessageInteractionInfoTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "InteractionInfo", - SchemaName: "interaction_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageInteractionInfo) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageInteractionInfo#ab803bfe as nil") - } - b.PutID(UpdateMessageInteractionInfoTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageInteractionInfo) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageInteractionInfo#ab803bfe as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - if err := u.InteractionInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateMessageInteractionInfo#ab803bfe: field interaction_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageInteractionInfo) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageInteractionInfo#ab803bfe to nil") - } - if err := b.ConsumeID(UpdateMessageInteractionInfoTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageInteractionInfo#ab803bfe: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageInteractionInfo) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageInteractionInfo#ab803bfe to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageInteractionInfo#ab803bfe: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageInteractionInfo#ab803bfe: field message_id: %w", err) - } - u.MessageID = value - } - { - if err := u.InteractionInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateMessageInteractionInfo#ab803bfe: field interaction_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageInteractionInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageInteractionInfo#ab803bfe as nil") - } - b.ObjStart() - b.PutID("updateMessageInteractionInfo") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("interaction_info") - if err := u.InteractionInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageInteractionInfo#ab803bfe: field interaction_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageInteractionInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageInteractionInfo#ab803bfe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageInteractionInfo"); err != nil { - return fmt.Errorf("unable to decode updateMessageInteractionInfo#ab803bfe: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageInteractionInfo#ab803bfe: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageInteractionInfo#ab803bfe: field message_id: %w", err) - } - u.MessageID = value - case "interaction_info": - if err := u.InteractionInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateMessageInteractionInfo#ab803bfe: field interaction_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageInteractionInfo) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageInteractionInfo) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetInteractionInfo returns value of InteractionInfo field. -func (u *UpdateMessageInteractionInfo) GetInteractionInfo() (value MessageInteractionInfo) { - if u == nil { - return - } - return u.InteractionInfo -} - -// UpdateMessageContentOpened represents TL type `updateMessageContentOpened#a55ea885`. -type UpdateMessageContentOpened struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 -} - -// UpdateMessageContentOpenedTypeID is TL type id of UpdateMessageContentOpened. -const UpdateMessageContentOpenedTypeID = 0xa55ea885 - -// construct implements constructor of UpdateClass. -func (u UpdateMessageContentOpened) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageContentOpened. -var ( - _ bin.Encoder = &UpdateMessageContentOpened{} - _ bin.Decoder = &UpdateMessageContentOpened{} - _ bin.BareEncoder = &UpdateMessageContentOpened{} - _ bin.BareDecoder = &UpdateMessageContentOpened{} - - _ UpdateClass = &UpdateMessageContentOpened{} -) - -func (u *UpdateMessageContentOpened) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageContentOpened) String() string { - if u == nil { - return "UpdateMessageContentOpened(nil)" - } - type Alias UpdateMessageContentOpened - return fmt.Sprintf("UpdateMessageContentOpened%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageContentOpened) TypeID() uint32 { - return UpdateMessageContentOpenedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageContentOpened) TypeName() string { - return "updateMessageContentOpened" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageContentOpened) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageContentOpened", - ID: UpdateMessageContentOpenedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageContentOpened) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageContentOpened#a55ea885 as nil") - } - b.PutID(UpdateMessageContentOpenedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageContentOpened) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageContentOpened#a55ea885 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageContentOpened) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageContentOpened#a55ea885 to nil") - } - if err := b.ConsumeID(UpdateMessageContentOpenedTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageContentOpened#a55ea885: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageContentOpened) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageContentOpened#a55ea885 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageContentOpened#a55ea885: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageContentOpened#a55ea885: field message_id: %w", err) - } - u.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageContentOpened) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageContentOpened#a55ea885 as nil") - } - b.ObjStart() - b.PutID("updateMessageContentOpened") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageContentOpened) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageContentOpened#a55ea885 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageContentOpened"); err != nil { - return fmt.Errorf("unable to decode updateMessageContentOpened#a55ea885: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageContentOpened#a55ea885: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageContentOpened#a55ea885: field message_id: %w", err) - } - u.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageContentOpened) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageContentOpened) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// UpdateMessageMentionRead represents TL type `updateMessageMentionRead#f0f74d46`. -type UpdateMessageMentionRead struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 - // The new number of unread mention messages left in the chat - UnreadMentionCount int32 -} - -// UpdateMessageMentionReadTypeID is TL type id of UpdateMessageMentionRead. -const UpdateMessageMentionReadTypeID = 0xf0f74d46 - -// construct implements constructor of UpdateClass. -func (u UpdateMessageMentionRead) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageMentionRead. -var ( - _ bin.Encoder = &UpdateMessageMentionRead{} - _ bin.Decoder = &UpdateMessageMentionRead{} - _ bin.BareEncoder = &UpdateMessageMentionRead{} - _ bin.BareDecoder = &UpdateMessageMentionRead{} - - _ UpdateClass = &UpdateMessageMentionRead{} -) - -func (u *UpdateMessageMentionRead) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.UnreadMentionCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageMentionRead) String() string { - if u == nil { - return "UpdateMessageMentionRead(nil)" - } - type Alias UpdateMessageMentionRead - return fmt.Sprintf("UpdateMessageMentionRead%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageMentionRead) TypeID() uint32 { - return UpdateMessageMentionReadTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageMentionRead) TypeName() string { - return "updateMessageMentionRead" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageMentionRead) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageMentionRead", - ID: UpdateMessageMentionReadTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "UnreadMentionCount", - SchemaName: "unread_mention_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageMentionRead) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageMentionRead#f0f74d46 as nil") - } - b.PutID(UpdateMessageMentionReadTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageMentionRead) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageMentionRead#f0f74d46 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - b.PutInt32(u.UnreadMentionCount) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageMentionRead) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageMentionRead#f0f74d46 to nil") - } - if err := b.ConsumeID(UpdateMessageMentionReadTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageMentionRead#f0f74d46: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageMentionRead) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageMentionRead#f0f74d46 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageMentionRead#f0f74d46: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageMentionRead#f0f74d46: field message_id: %w", err) - } - u.MessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageMentionRead#f0f74d46: field unread_mention_count: %w", err) - } - u.UnreadMentionCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageMentionRead) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageMentionRead#f0f74d46 as nil") - } - b.ObjStart() - b.PutID("updateMessageMentionRead") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("unread_mention_count") - b.PutInt32(u.UnreadMentionCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageMentionRead) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageMentionRead#f0f74d46 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageMentionRead"); err != nil { - return fmt.Errorf("unable to decode updateMessageMentionRead#f0f74d46: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageMentionRead#f0f74d46: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageMentionRead#f0f74d46: field message_id: %w", err) - } - u.MessageID = value - case "unread_mention_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageMentionRead#f0f74d46: field unread_mention_count: %w", err) - } - u.UnreadMentionCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageMentionRead) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageMentionRead) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetUnreadMentionCount returns value of UnreadMentionCount field. -func (u *UpdateMessageMentionRead) GetUnreadMentionCount() (value int32) { - if u == nil { - return - } - return u.UnreadMentionCount -} - -// UpdateMessageUnreadReactions represents TL type `updateMessageUnreadReactions#12a7220a`. -type UpdateMessageUnreadReactions struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 - // The new list of unread reactions - UnreadReactions []UnreadReaction - // The new number of messages with unread reactions left in the chat - UnreadReactionCount int32 -} - -// UpdateMessageUnreadReactionsTypeID is TL type id of UpdateMessageUnreadReactions. -const UpdateMessageUnreadReactionsTypeID = 0x12a7220a - -// construct implements constructor of UpdateClass. -func (u UpdateMessageUnreadReactions) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageUnreadReactions. -var ( - _ bin.Encoder = &UpdateMessageUnreadReactions{} - _ bin.Decoder = &UpdateMessageUnreadReactions{} - _ bin.BareEncoder = &UpdateMessageUnreadReactions{} - _ bin.BareDecoder = &UpdateMessageUnreadReactions{} - - _ UpdateClass = &UpdateMessageUnreadReactions{} -) - -func (u *UpdateMessageUnreadReactions) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.UnreadReactions == nil) { - return false - } - if !(u.UnreadReactionCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageUnreadReactions) String() string { - if u == nil { - return "UpdateMessageUnreadReactions(nil)" - } - type Alias UpdateMessageUnreadReactions - return fmt.Sprintf("UpdateMessageUnreadReactions%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageUnreadReactions) TypeID() uint32 { - return UpdateMessageUnreadReactionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageUnreadReactions) TypeName() string { - return "updateMessageUnreadReactions" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageUnreadReactions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageUnreadReactions", - ID: UpdateMessageUnreadReactionsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "UnreadReactions", - SchemaName: "unread_reactions", - }, - { - Name: "UnreadReactionCount", - SchemaName: "unread_reaction_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageUnreadReactions) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageUnreadReactions#12a7220a as nil") - } - b.PutID(UpdateMessageUnreadReactionsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageUnreadReactions) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageUnreadReactions#12a7220a as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - b.PutInt(len(u.UnreadReactions)) - for idx, v := range u.UnreadReactions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateMessageUnreadReactions#12a7220a: field unread_reactions element with index %d: %w", idx, err) - } - } - b.PutInt32(u.UnreadReactionCount) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageUnreadReactions) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageUnreadReactions#12a7220a to nil") - } - if err := b.ConsumeID(UpdateMessageUnreadReactionsTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageUnreadReactions) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageUnreadReactions#12a7220a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field message_id: %w", err) - } - u.MessageID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field unread_reactions: %w", err) - } - - if headerLen > 0 { - u.UnreadReactions = make([]UnreadReaction, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value UnreadReaction - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateMessageUnreadReactions#12a7220a: field unread_reactions: %w", err) - } - u.UnreadReactions = append(u.UnreadReactions, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field unread_reaction_count: %w", err) - } - u.UnreadReactionCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageUnreadReactions) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageUnreadReactions#12a7220a as nil") - } - b.ObjStart() - b.PutID("updateMessageUnreadReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("unread_reactions") - b.ArrStart() - for idx, v := range u.UnreadReactions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageUnreadReactions#12a7220a: field unread_reactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("unread_reaction_count") - b.PutInt32(u.UnreadReactionCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageUnreadReactions) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageUnreadReactions#12a7220a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageUnreadReactions"); err != nil { - return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field message_id: %w", err) - } - u.MessageID = value - case "unread_reactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value UnreadReaction - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field unread_reactions: %w", err) - } - u.UnreadReactions = append(u.UnreadReactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field unread_reactions: %w", err) - } - case "unread_reaction_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageUnreadReactions#12a7220a: field unread_reaction_count: %w", err) - } - u.UnreadReactionCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageUnreadReactions) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageUnreadReactions) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetUnreadReactions returns value of UnreadReactions field. -func (u *UpdateMessageUnreadReactions) GetUnreadReactions() (value []UnreadReaction) { - if u == nil { - return - } - return u.UnreadReactions -} - -// GetUnreadReactionCount returns value of UnreadReactionCount field. -func (u *UpdateMessageUnreadReactions) GetUnreadReactionCount() (value int32) { - if u == nil { - return - } - return u.UnreadReactionCount -} - -// UpdateMessageFactCheck represents TL type `updateMessageFactCheck#3c78fb02`. -type UpdateMessageFactCheck struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 - // The new fact-check - FactCheck FactCheck -} - -// UpdateMessageFactCheckTypeID is TL type id of UpdateMessageFactCheck. -const UpdateMessageFactCheckTypeID = 0x3c78fb02 - -// construct implements constructor of UpdateClass. -func (u UpdateMessageFactCheck) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageFactCheck. -var ( - _ bin.Encoder = &UpdateMessageFactCheck{} - _ bin.Decoder = &UpdateMessageFactCheck{} - _ bin.BareEncoder = &UpdateMessageFactCheck{} - _ bin.BareDecoder = &UpdateMessageFactCheck{} - - _ UpdateClass = &UpdateMessageFactCheck{} -) - -func (u *UpdateMessageFactCheck) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.FactCheck.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageFactCheck) String() string { - if u == nil { - return "UpdateMessageFactCheck(nil)" - } - type Alias UpdateMessageFactCheck - return fmt.Sprintf("UpdateMessageFactCheck%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageFactCheck) TypeID() uint32 { - return UpdateMessageFactCheckTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageFactCheck) TypeName() string { - return "updateMessageFactCheck" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageFactCheck) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageFactCheck", - ID: UpdateMessageFactCheckTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "FactCheck", - SchemaName: "fact_check", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageFactCheck) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageFactCheck#3c78fb02 as nil") - } - b.PutID(UpdateMessageFactCheckTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageFactCheck) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageFactCheck#3c78fb02 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - if err := u.FactCheck.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateMessageFactCheck#3c78fb02: field fact_check: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageFactCheck) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageFactCheck#3c78fb02 to nil") - } - if err := b.ConsumeID(UpdateMessageFactCheckTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageFactCheck#3c78fb02: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageFactCheck) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageFactCheck#3c78fb02 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageFactCheck#3c78fb02: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageFactCheck#3c78fb02: field message_id: %w", err) - } - u.MessageID = value - } - { - if err := u.FactCheck.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateMessageFactCheck#3c78fb02: field fact_check: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageFactCheck) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageFactCheck#3c78fb02 as nil") - } - b.ObjStart() - b.PutID("updateMessageFactCheck") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("fact_check") - if err := u.FactCheck.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageFactCheck#3c78fb02: field fact_check: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageFactCheck) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageFactCheck#3c78fb02 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageFactCheck"); err != nil { - return fmt.Errorf("unable to decode updateMessageFactCheck#3c78fb02: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageFactCheck#3c78fb02: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageFactCheck#3c78fb02: field message_id: %w", err) - } - u.MessageID = value - case "fact_check": - if err := u.FactCheck.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateMessageFactCheck#3c78fb02: field fact_check: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageFactCheck) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageFactCheck) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetFactCheck returns value of FactCheck field. -func (u *UpdateMessageFactCheck) GetFactCheck() (value FactCheck) { - if u == nil { - return - } - return u.FactCheck -} - -// UpdateMessageLiveLocationViewed represents TL type `updateMessageLiveLocationViewed#b2058595`. -type UpdateMessageLiveLocationViewed struct { - // Identifier of the chat with the live location message - ChatID int64 - // Identifier of the message with live location - MessageID int64 -} - -// UpdateMessageLiveLocationViewedTypeID is TL type id of UpdateMessageLiveLocationViewed. -const UpdateMessageLiveLocationViewedTypeID = 0xb2058595 - -// construct implements constructor of UpdateClass. -func (u UpdateMessageLiveLocationViewed) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageLiveLocationViewed. -var ( - _ bin.Encoder = &UpdateMessageLiveLocationViewed{} - _ bin.Decoder = &UpdateMessageLiveLocationViewed{} - _ bin.BareEncoder = &UpdateMessageLiveLocationViewed{} - _ bin.BareDecoder = &UpdateMessageLiveLocationViewed{} - - _ UpdateClass = &UpdateMessageLiveLocationViewed{} -) - -func (u *UpdateMessageLiveLocationViewed) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageLiveLocationViewed) String() string { - if u == nil { - return "UpdateMessageLiveLocationViewed(nil)" - } - type Alias UpdateMessageLiveLocationViewed - return fmt.Sprintf("UpdateMessageLiveLocationViewed%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageLiveLocationViewed) TypeID() uint32 { - return UpdateMessageLiveLocationViewedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageLiveLocationViewed) TypeName() string { - return "updateMessageLiveLocationViewed" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageLiveLocationViewed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageLiveLocationViewed", - ID: UpdateMessageLiveLocationViewedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageLiveLocationViewed) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageLiveLocationViewed#b2058595 as nil") - } - b.PutID(UpdateMessageLiveLocationViewedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageLiveLocationViewed) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageLiveLocationViewed#b2058595 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageLiveLocationViewed) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageLiveLocationViewed#b2058595 to nil") - } - if err := b.ConsumeID(UpdateMessageLiveLocationViewedTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageLiveLocationViewed#b2058595: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageLiveLocationViewed) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageLiveLocationViewed#b2058595 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageLiveLocationViewed#b2058595: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageLiveLocationViewed#b2058595: field message_id: %w", err) - } - u.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageLiveLocationViewed) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageLiveLocationViewed#b2058595 as nil") - } - b.ObjStart() - b.PutID("updateMessageLiveLocationViewed") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageLiveLocationViewed) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageLiveLocationViewed#b2058595 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageLiveLocationViewed"); err != nil { - return fmt.Errorf("unable to decode updateMessageLiveLocationViewed#b2058595: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageLiveLocationViewed#b2058595: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageLiveLocationViewed#b2058595: field message_id: %w", err) - } - u.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageLiveLocationViewed) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageLiveLocationViewed) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// UpdateVideoPublished represents TL type `updateVideoPublished#eafc2052`. -type UpdateVideoPublished struct { - // Identifier of the chat with the message - ChatID int64 - // Identifier of the sent message - MessageID int64 -} - -// UpdateVideoPublishedTypeID is TL type id of UpdateVideoPublished. -const UpdateVideoPublishedTypeID = 0xeafc2052 - -// construct implements constructor of UpdateClass. -func (u UpdateVideoPublished) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateVideoPublished. -var ( - _ bin.Encoder = &UpdateVideoPublished{} - _ bin.Decoder = &UpdateVideoPublished{} - _ bin.BareEncoder = &UpdateVideoPublished{} - _ bin.BareDecoder = &UpdateVideoPublished{} - - _ UpdateClass = &UpdateVideoPublished{} -) - -func (u *UpdateVideoPublished) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateVideoPublished) String() string { - if u == nil { - return "UpdateVideoPublished(nil)" - } - type Alias UpdateVideoPublished - return fmt.Sprintf("UpdateVideoPublished%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateVideoPublished) TypeID() uint32 { - return UpdateVideoPublishedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateVideoPublished) TypeName() string { - return "updateVideoPublished" -} - -// TypeInfo returns info about TL type. -func (u *UpdateVideoPublished) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateVideoPublished", - ID: UpdateVideoPublishedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateVideoPublished) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateVideoPublished#eafc2052 as nil") - } - b.PutID(UpdateVideoPublishedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateVideoPublished) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateVideoPublished#eafc2052 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateVideoPublished) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateVideoPublished#eafc2052 to nil") - } - if err := b.ConsumeID(UpdateVideoPublishedTypeID); err != nil { - return fmt.Errorf("unable to decode updateVideoPublished#eafc2052: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateVideoPublished) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateVideoPublished#eafc2052 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateVideoPublished#eafc2052: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateVideoPublished#eafc2052: field message_id: %w", err) - } - u.MessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateVideoPublished) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateVideoPublished#eafc2052 as nil") - } - b.ObjStart() - b.PutID("updateVideoPublished") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateVideoPublished) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateVideoPublished#eafc2052 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateVideoPublished"); err != nil { - return fmt.Errorf("unable to decode updateVideoPublished#eafc2052: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateVideoPublished#eafc2052: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateVideoPublished#eafc2052: field message_id: %w", err) - } - u.MessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateVideoPublished) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateVideoPublished) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// UpdateNewChat represents TL type `updateNewChat#7bb98ccd`. -type UpdateNewChat struct { - // The chat - Chat Chat -} - -// UpdateNewChatTypeID is TL type id of UpdateNewChat. -const UpdateNewChatTypeID = 0x7bb98ccd - -// construct implements constructor of UpdateClass. -func (u UpdateNewChat) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewChat. -var ( - _ bin.Encoder = &UpdateNewChat{} - _ bin.Decoder = &UpdateNewChat{} - _ bin.BareEncoder = &UpdateNewChat{} - _ bin.BareDecoder = &UpdateNewChat{} - - _ UpdateClass = &UpdateNewChat{} -) - -func (u *UpdateNewChat) Zero() bool { - if u == nil { - return true - } - if !(u.Chat.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewChat) String() string { - if u == nil { - return "UpdateNewChat(nil)" - } - type Alias UpdateNewChat - return fmt.Sprintf("UpdateNewChat%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewChat) TypeID() uint32 { - return UpdateNewChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewChat) TypeName() string { - return "updateNewChat" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewChat", - ID: UpdateNewChatTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Chat", - SchemaName: "chat", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewChat) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewChat#7bb98ccd as nil") - } - b.PutID(UpdateNewChatTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewChat) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewChat#7bb98ccd as nil") - } - if err := u.Chat.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewChat#7bb98ccd: field chat: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewChat) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewChat#7bb98ccd to nil") - } - if err := b.ConsumeID(UpdateNewChatTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewChat#7bb98ccd: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewChat) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewChat#7bb98ccd to nil") - } - { - if err := u.Chat.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateNewChat#7bb98ccd: field chat: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewChat#7bb98ccd as nil") - } - b.ObjStart() - b.PutID("updateNewChat") - b.Comma() - b.FieldStart("chat") - if err := u.Chat.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewChat#7bb98ccd: field chat: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewChat#7bb98ccd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewChat"); err != nil { - return fmt.Errorf("unable to decode updateNewChat#7bb98ccd: %w", err) - } - case "chat": - if err := u.Chat.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNewChat#7bb98ccd: field chat: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChat returns value of Chat field. -func (u *UpdateNewChat) GetChat() (value Chat) { - if u == nil { - return - } - return u.Chat -} - -// UpdateChatTitle represents TL type `updateChatTitle#f58b85a4`. -type UpdateChatTitle struct { - // Chat identifier - ChatID int64 - // The new chat title - Title string -} - -// UpdateChatTitleTypeID is TL type id of UpdateChatTitle. -const UpdateChatTitleTypeID = 0xf58b85a4 - -// construct implements constructor of UpdateClass. -func (u UpdateChatTitle) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatTitle. -var ( - _ bin.Encoder = &UpdateChatTitle{} - _ bin.Decoder = &UpdateChatTitle{} - _ bin.BareEncoder = &UpdateChatTitle{} - _ bin.BareDecoder = &UpdateChatTitle{} - - _ UpdateClass = &UpdateChatTitle{} -) - -func (u *UpdateChatTitle) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.Title == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatTitle) String() string { - if u == nil { - return "UpdateChatTitle(nil)" - } - type Alias UpdateChatTitle - return fmt.Sprintf("UpdateChatTitle%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatTitle) TypeID() uint32 { - return UpdateChatTitleTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatTitle) TypeName() string { - return "updateChatTitle" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatTitle) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatTitle", - ID: UpdateChatTitleTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Title", - SchemaName: "title", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatTitle) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatTitle#f58b85a4 as nil") - } - b.PutID(UpdateChatTitleTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatTitle) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatTitle#f58b85a4 as nil") - } - b.PutInt53(u.ChatID) - b.PutString(u.Title) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatTitle) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatTitle#f58b85a4 to nil") - } - if err := b.ConsumeID(UpdateChatTitleTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatTitle#f58b85a4: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatTitle) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatTitle#f58b85a4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatTitle#f58b85a4: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateChatTitle#f58b85a4: field title: %w", err) - } - u.Title = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatTitle) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatTitle#f58b85a4 as nil") - } - b.ObjStart() - b.PutID("updateChatTitle") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("title") - b.PutString(u.Title) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatTitle) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatTitle#f58b85a4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatTitle"); err != nil { - return fmt.Errorf("unable to decode updateChatTitle#f58b85a4: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatTitle#f58b85a4: field chat_id: %w", err) - } - u.ChatID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateChatTitle#f58b85a4: field title: %w", err) - } - u.Title = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatTitle) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetTitle returns value of Title field. -func (u *UpdateChatTitle) GetTitle() (value string) { - if u == nil { - return - } - return u.Title -} - -// UpdateChatPhoto represents TL type `updateChatPhoto#eca5423f`. -type UpdateChatPhoto struct { - // Chat identifier - ChatID int64 - // The new chat photo; may be null - Photo ChatPhotoInfo -} - -// UpdateChatPhotoTypeID is TL type id of UpdateChatPhoto. -const UpdateChatPhotoTypeID = 0xeca5423f - -// construct implements constructor of UpdateClass. -func (u UpdateChatPhoto) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatPhoto. -var ( - _ bin.Encoder = &UpdateChatPhoto{} - _ bin.Decoder = &UpdateChatPhoto{} - _ bin.BareEncoder = &UpdateChatPhoto{} - _ bin.BareDecoder = &UpdateChatPhoto{} - - _ UpdateClass = &UpdateChatPhoto{} -) - -func (u *UpdateChatPhoto) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.Photo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatPhoto) String() string { - if u == nil { - return "UpdateChatPhoto(nil)" - } - type Alias UpdateChatPhoto - return fmt.Sprintf("UpdateChatPhoto%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatPhoto) TypeID() uint32 { - return UpdateChatPhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatPhoto) TypeName() string { - return "updateChatPhoto" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatPhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatPhoto", - ID: UpdateChatPhotoTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatPhoto) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPhoto#eca5423f as nil") - } - b.PutID(UpdateChatPhotoTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatPhoto) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPhoto#eca5423f as nil") - } - b.PutInt53(u.ChatID) - if err := u.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatPhoto#eca5423f: field photo: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatPhoto) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPhoto#eca5423f to nil") - } - if err := b.ConsumeID(UpdateChatPhotoTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatPhoto#eca5423f: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatPhoto) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPhoto#eca5423f to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatPhoto#eca5423f: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatPhoto#eca5423f: field photo: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatPhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPhoto#eca5423f as nil") - } - b.ObjStart() - b.PutID("updateChatPhoto") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("photo") - if err := u.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatPhoto#eca5423f: field photo: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatPhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPhoto#eca5423f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatPhoto"); err != nil { - return fmt.Errorf("unable to decode updateChatPhoto#eca5423f: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatPhoto#eca5423f: field chat_id: %w", err) - } - u.ChatID = value - case "photo": - if err := u.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatPhoto#eca5423f: field photo: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatPhoto) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetPhoto returns value of Photo field. -func (u *UpdateChatPhoto) GetPhoto() (value ChatPhotoInfo) { - if u == nil { - return - } - return u.Photo -} - -// UpdateChatAccentColors represents TL type `updateChatAccentColors#b7b8f8f9`. -type UpdateChatAccentColors struct { - // Chat identifier - ChatID int64 - // The new chat accent color identifier - AccentColorID int32 - // The new identifier of a custom emoji to be shown on the reply header and link preview - // background; 0 if none - BackgroundCustomEmojiID int64 - // The new chat profile accent color identifier; -1 if none - ProfileAccentColorID int32 - // The new identifier of a custom emoji to be shown on the profile background; 0 if none - ProfileBackgroundCustomEmojiID int64 -} - -// UpdateChatAccentColorsTypeID is TL type id of UpdateChatAccentColors. -const UpdateChatAccentColorsTypeID = 0xb7b8f8f9 - -// construct implements constructor of UpdateClass. -func (u UpdateChatAccentColors) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatAccentColors. -var ( - _ bin.Encoder = &UpdateChatAccentColors{} - _ bin.Decoder = &UpdateChatAccentColors{} - _ bin.BareEncoder = &UpdateChatAccentColors{} - _ bin.BareDecoder = &UpdateChatAccentColors{} - - _ UpdateClass = &UpdateChatAccentColors{} -) - -func (u *UpdateChatAccentColors) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.AccentColorID == 0) { - return false - } - if !(u.BackgroundCustomEmojiID == 0) { - return false - } - if !(u.ProfileAccentColorID == 0) { - return false - } - if !(u.ProfileBackgroundCustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatAccentColors) String() string { - if u == nil { - return "UpdateChatAccentColors(nil)" - } - type Alias UpdateChatAccentColors - return fmt.Sprintf("UpdateChatAccentColors%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatAccentColors) TypeID() uint32 { - return UpdateChatAccentColorsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatAccentColors) TypeName() string { - return "updateChatAccentColors" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatAccentColors) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatAccentColors", - ID: UpdateChatAccentColorsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "AccentColorID", - SchemaName: "accent_color_id", - }, - { - Name: "BackgroundCustomEmojiID", - SchemaName: "background_custom_emoji_id", - }, - { - Name: "ProfileAccentColorID", - SchemaName: "profile_accent_color_id", - }, - { - Name: "ProfileBackgroundCustomEmojiID", - SchemaName: "profile_background_custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatAccentColors) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAccentColors#b7b8f8f9 as nil") - } - b.PutID(UpdateChatAccentColorsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatAccentColors) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAccentColors#b7b8f8f9 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt32(u.AccentColorID) - b.PutLong(u.BackgroundCustomEmojiID) - b.PutInt32(u.ProfileAccentColorID) - b.PutLong(u.ProfileBackgroundCustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatAccentColors) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAccentColors#b7b8f8f9 to nil") - } - if err := b.ConsumeID(UpdateChatAccentColorsTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatAccentColors) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAccentColors#b7b8f8f9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: field accent_color_id: %w", err) - } - u.AccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: field background_custom_emoji_id: %w", err) - } - u.BackgroundCustomEmojiID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: field profile_accent_color_id: %w", err) - } - u.ProfileAccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: field profile_background_custom_emoji_id: %w", err) - } - u.ProfileBackgroundCustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatAccentColors) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAccentColors#b7b8f8f9 as nil") - } - b.ObjStart() - b.PutID("updateChatAccentColors") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("accent_color_id") - b.PutInt32(u.AccentColorID) - b.Comma() - b.FieldStart("background_custom_emoji_id") - b.PutLong(u.BackgroundCustomEmojiID) - b.Comma() - b.FieldStart("profile_accent_color_id") - b.PutInt32(u.ProfileAccentColorID) - b.Comma() - b.FieldStart("profile_background_custom_emoji_id") - b.PutLong(u.ProfileBackgroundCustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatAccentColors) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAccentColors#b7b8f8f9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatAccentColors"); err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: field chat_id: %w", err) - } - u.ChatID = value - case "accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: field accent_color_id: %w", err) - } - u.AccentColorID = value - case "background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: field background_custom_emoji_id: %w", err) - } - u.BackgroundCustomEmojiID = value - case "profile_accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: field profile_accent_color_id: %w", err) - } - u.ProfileAccentColorID = value - case "profile_background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateChatAccentColors#b7b8f8f9: field profile_background_custom_emoji_id: %w", err) - } - u.ProfileBackgroundCustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatAccentColors) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetAccentColorID returns value of AccentColorID field. -func (u *UpdateChatAccentColors) GetAccentColorID() (value int32) { - if u == nil { - return - } - return u.AccentColorID -} - -// GetBackgroundCustomEmojiID returns value of BackgroundCustomEmojiID field. -func (u *UpdateChatAccentColors) GetBackgroundCustomEmojiID() (value int64) { - if u == nil { - return - } - return u.BackgroundCustomEmojiID -} - -// GetProfileAccentColorID returns value of ProfileAccentColorID field. -func (u *UpdateChatAccentColors) GetProfileAccentColorID() (value int32) { - if u == nil { - return - } - return u.ProfileAccentColorID -} - -// GetProfileBackgroundCustomEmojiID returns value of ProfileBackgroundCustomEmojiID field. -func (u *UpdateChatAccentColors) GetProfileBackgroundCustomEmojiID() (value int64) { - if u == nil { - return - } - return u.ProfileBackgroundCustomEmojiID -} - -// UpdateChatPermissions represents TL type `updateChatPermissions#9f52176d`. -type UpdateChatPermissions struct { - // Chat identifier - ChatID int64 - // The new chat permissions - Permissions ChatPermissions -} - -// UpdateChatPermissionsTypeID is TL type id of UpdateChatPermissions. -const UpdateChatPermissionsTypeID = 0x9f52176d - -// construct implements constructor of UpdateClass. -func (u UpdateChatPermissions) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatPermissions. -var ( - _ bin.Encoder = &UpdateChatPermissions{} - _ bin.Decoder = &UpdateChatPermissions{} - _ bin.BareEncoder = &UpdateChatPermissions{} - _ bin.BareDecoder = &UpdateChatPermissions{} - - _ UpdateClass = &UpdateChatPermissions{} -) - -func (u *UpdateChatPermissions) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.Permissions.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatPermissions) String() string { - if u == nil { - return "UpdateChatPermissions(nil)" - } - type Alias UpdateChatPermissions - return fmt.Sprintf("UpdateChatPermissions%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatPermissions) TypeID() uint32 { - return UpdateChatPermissionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatPermissions) TypeName() string { - return "updateChatPermissions" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatPermissions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatPermissions", - ID: UpdateChatPermissionsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Permissions", - SchemaName: "permissions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatPermissions) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPermissions#9f52176d as nil") - } - b.PutID(UpdateChatPermissionsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatPermissions) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPermissions#9f52176d as nil") - } - b.PutInt53(u.ChatID) - if err := u.Permissions.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatPermissions#9f52176d: field permissions: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatPermissions) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPermissions#9f52176d to nil") - } - if err := b.ConsumeID(UpdateChatPermissionsTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatPermissions#9f52176d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatPermissions) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPermissions#9f52176d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatPermissions#9f52176d: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.Permissions.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatPermissions#9f52176d: field permissions: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatPermissions) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPermissions#9f52176d as nil") - } - b.ObjStart() - b.PutID("updateChatPermissions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("permissions") - if err := u.Permissions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatPermissions#9f52176d: field permissions: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatPermissions) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPermissions#9f52176d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatPermissions"); err != nil { - return fmt.Errorf("unable to decode updateChatPermissions#9f52176d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatPermissions#9f52176d: field chat_id: %w", err) - } - u.ChatID = value - case "permissions": - if err := u.Permissions.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatPermissions#9f52176d: field permissions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatPermissions) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetPermissions returns value of Permissions field. -func (u *UpdateChatPermissions) GetPermissions() (value ChatPermissions) { - if u == nil { - return - } - return u.Permissions -} - -// UpdateChatLastMessage represents TL type `updateChatLastMessage#f10cab1d`. -type UpdateChatLastMessage struct { - // Chat identifier - ChatID int64 - // The new last message in the chat; may be null if the last message became unknown. - // While the last message is unknown, new messages can be added to the chat without - // corresponding updateNewMessage update - LastMessage Message - // The new chat positions in the chat lists - Positions []ChatPosition -} - -// UpdateChatLastMessageTypeID is TL type id of UpdateChatLastMessage. -const UpdateChatLastMessageTypeID = 0xf10cab1d - -// construct implements constructor of UpdateClass. -func (u UpdateChatLastMessage) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatLastMessage. -var ( - _ bin.Encoder = &UpdateChatLastMessage{} - _ bin.Decoder = &UpdateChatLastMessage{} - _ bin.BareEncoder = &UpdateChatLastMessage{} - _ bin.BareDecoder = &UpdateChatLastMessage{} - - _ UpdateClass = &UpdateChatLastMessage{} -) - -func (u *UpdateChatLastMessage) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.LastMessage.Zero()) { - return false - } - if !(u.Positions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatLastMessage) String() string { - if u == nil { - return "UpdateChatLastMessage(nil)" - } - type Alias UpdateChatLastMessage - return fmt.Sprintf("UpdateChatLastMessage%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatLastMessage) TypeID() uint32 { - return UpdateChatLastMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatLastMessage) TypeName() string { - return "updateChatLastMessage" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatLastMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatLastMessage", - ID: UpdateChatLastMessageTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "LastMessage", - SchemaName: "last_message", - }, - { - Name: "Positions", - SchemaName: "positions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatLastMessage) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatLastMessage#f10cab1d as nil") - } - b.PutID(UpdateChatLastMessageTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatLastMessage) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatLastMessage#f10cab1d as nil") - } - b.PutInt53(u.ChatID) - if err := u.LastMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatLastMessage#f10cab1d: field last_message: %w", err) - } - b.PutInt(len(u.Positions)) - for idx, v := range u.Positions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateChatLastMessage#f10cab1d: field positions element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatLastMessage) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatLastMessage#f10cab1d to nil") - } - if err := b.ConsumeID(UpdateChatLastMessageTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatLastMessage#f10cab1d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatLastMessage) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatLastMessage#f10cab1d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatLastMessage#f10cab1d: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.LastMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatLastMessage#f10cab1d: field last_message: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateChatLastMessage#f10cab1d: field positions: %w", err) - } - - if headerLen > 0 { - u.Positions = make([]ChatPosition, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatPosition - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateChatLastMessage#f10cab1d: field positions: %w", err) - } - u.Positions = append(u.Positions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatLastMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatLastMessage#f10cab1d as nil") - } - b.ObjStart() - b.PutID("updateChatLastMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("last_message") - if err := u.LastMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatLastMessage#f10cab1d: field last_message: %w", err) - } - b.Comma() - b.FieldStart("positions") - b.ArrStart() - for idx, v := range u.Positions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatLastMessage#f10cab1d: field positions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatLastMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatLastMessage#f10cab1d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatLastMessage"); err != nil { - return fmt.Errorf("unable to decode updateChatLastMessage#f10cab1d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatLastMessage#f10cab1d: field chat_id: %w", err) - } - u.ChatID = value - case "last_message": - if err := u.LastMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatLastMessage#f10cab1d: field last_message: %w", err) - } - case "positions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatPosition - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatLastMessage#f10cab1d: field positions: %w", err) - } - u.Positions = append(u.Positions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateChatLastMessage#f10cab1d: field positions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatLastMessage) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetLastMessage returns value of LastMessage field. -func (u *UpdateChatLastMessage) GetLastMessage() (value Message) { - if u == nil { - return - } - return u.LastMessage -} - -// GetPositions returns value of Positions field. -func (u *UpdateChatLastMessage) GetPositions() (value []ChatPosition) { - if u == nil { - return - } - return u.Positions -} - -// UpdateChatPosition represents TL type `updateChatPosition#ff76fa77`. -type UpdateChatPosition struct { - // Chat identifier - ChatID int64 - // New chat position. If new order is 0, then the chat needs to be removed from the list - Position ChatPosition -} - -// UpdateChatPositionTypeID is TL type id of UpdateChatPosition. -const UpdateChatPositionTypeID = 0xff76fa77 - -// construct implements constructor of UpdateClass. -func (u UpdateChatPosition) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatPosition. -var ( - _ bin.Encoder = &UpdateChatPosition{} - _ bin.Decoder = &UpdateChatPosition{} - _ bin.BareEncoder = &UpdateChatPosition{} - _ bin.BareDecoder = &UpdateChatPosition{} - - _ UpdateClass = &UpdateChatPosition{} -) - -func (u *UpdateChatPosition) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.Position.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatPosition) String() string { - if u == nil { - return "UpdateChatPosition(nil)" - } - type Alias UpdateChatPosition - return fmt.Sprintf("UpdateChatPosition%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatPosition) TypeID() uint32 { - return UpdateChatPositionTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatPosition) TypeName() string { - return "updateChatPosition" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatPosition) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatPosition", - ID: UpdateChatPositionTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Position", - SchemaName: "position", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatPosition) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPosition#ff76fa77 as nil") - } - b.PutID(UpdateChatPositionTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatPosition) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPosition#ff76fa77 as nil") - } - b.PutInt53(u.ChatID) - if err := u.Position.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatPosition#ff76fa77: field position: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatPosition) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPosition#ff76fa77 to nil") - } - if err := b.ConsumeID(UpdateChatPositionTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatPosition#ff76fa77: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatPosition) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPosition#ff76fa77 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatPosition#ff76fa77: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.Position.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatPosition#ff76fa77: field position: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatPosition) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPosition#ff76fa77 as nil") - } - b.ObjStart() - b.PutID("updateChatPosition") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("position") - if err := u.Position.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatPosition#ff76fa77: field position: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatPosition) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPosition#ff76fa77 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatPosition"); err != nil { - return fmt.Errorf("unable to decode updateChatPosition#ff76fa77: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatPosition#ff76fa77: field chat_id: %w", err) - } - u.ChatID = value - case "position": - if err := u.Position.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatPosition#ff76fa77: field position: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatPosition) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetPosition returns value of Position field. -func (u *UpdateChatPosition) GetPosition() (value ChatPosition) { - if u == nil { - return - } - return u.Position -} - -// UpdateChatAddedToList represents TL type `updateChatAddedToList#ab7004ec`. -type UpdateChatAddedToList struct { - // Chat identifier - ChatID int64 - // The chat list to which the chat was added - ChatList ChatListClass -} - -// UpdateChatAddedToListTypeID is TL type id of UpdateChatAddedToList. -const UpdateChatAddedToListTypeID = 0xab7004ec - -// construct implements constructor of UpdateClass. -func (u UpdateChatAddedToList) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatAddedToList. -var ( - _ bin.Encoder = &UpdateChatAddedToList{} - _ bin.Decoder = &UpdateChatAddedToList{} - _ bin.BareEncoder = &UpdateChatAddedToList{} - _ bin.BareDecoder = &UpdateChatAddedToList{} - - _ UpdateClass = &UpdateChatAddedToList{} -) - -func (u *UpdateChatAddedToList) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.ChatList == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatAddedToList) String() string { - if u == nil { - return "UpdateChatAddedToList(nil)" - } - type Alias UpdateChatAddedToList - return fmt.Sprintf("UpdateChatAddedToList%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatAddedToList) TypeID() uint32 { - return UpdateChatAddedToListTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatAddedToList) TypeName() string { - return "updateChatAddedToList" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatAddedToList) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatAddedToList", - ID: UpdateChatAddedToListTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ChatList", - SchemaName: "chat_list", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatAddedToList) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAddedToList#ab7004ec as nil") - } - b.PutID(UpdateChatAddedToListTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatAddedToList) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAddedToList#ab7004ec as nil") - } - b.PutInt53(u.ChatID) - if u.ChatList == nil { - return fmt.Errorf("unable to encode updateChatAddedToList#ab7004ec: field chat_list is nil") - } - if err := u.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatAddedToList#ab7004ec: field chat_list: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatAddedToList) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAddedToList#ab7004ec to nil") - } - if err := b.ConsumeID(UpdateChatAddedToListTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatAddedToList) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAddedToList#ab7004ec to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: field chat_list: %w", err) - } - u.ChatList = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatAddedToList) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAddedToList#ab7004ec as nil") - } - b.ObjStart() - b.PutID("updateChatAddedToList") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("chat_list") - if u.ChatList == nil { - return fmt.Errorf("unable to encode updateChatAddedToList#ab7004ec: field chat_list is nil") - } - if err := u.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatAddedToList#ab7004ec: field chat_list: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatAddedToList) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAddedToList#ab7004ec to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatAddedToList"); err != nil { - return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: field chat_id: %w", err) - } - u.ChatID = value - case "chat_list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatAddedToList#ab7004ec: field chat_list: %w", err) - } - u.ChatList = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatAddedToList) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetChatList returns value of ChatList field. -func (u *UpdateChatAddedToList) GetChatList() (value ChatListClass) { - if u == nil { - return - } - return u.ChatList -} - -// UpdateChatRemovedFromList represents TL type `updateChatRemovedFromList#4d2ac21c`. -type UpdateChatRemovedFromList struct { - // Chat identifier - ChatID int64 - // The chat list from which the chat was removed - ChatList ChatListClass -} - -// UpdateChatRemovedFromListTypeID is TL type id of UpdateChatRemovedFromList. -const UpdateChatRemovedFromListTypeID = 0x4d2ac21c - -// construct implements constructor of UpdateClass. -func (u UpdateChatRemovedFromList) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatRemovedFromList. -var ( - _ bin.Encoder = &UpdateChatRemovedFromList{} - _ bin.Decoder = &UpdateChatRemovedFromList{} - _ bin.BareEncoder = &UpdateChatRemovedFromList{} - _ bin.BareDecoder = &UpdateChatRemovedFromList{} - - _ UpdateClass = &UpdateChatRemovedFromList{} -) - -func (u *UpdateChatRemovedFromList) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.ChatList == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatRemovedFromList) String() string { - if u == nil { - return "UpdateChatRemovedFromList(nil)" - } - type Alias UpdateChatRemovedFromList - return fmt.Sprintf("UpdateChatRemovedFromList%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatRemovedFromList) TypeID() uint32 { - return UpdateChatRemovedFromListTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatRemovedFromList) TypeName() string { - return "updateChatRemovedFromList" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatRemovedFromList) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatRemovedFromList", - ID: UpdateChatRemovedFromListTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ChatList", - SchemaName: "chat_list", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatRemovedFromList) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatRemovedFromList#4d2ac21c as nil") - } - b.PutID(UpdateChatRemovedFromListTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatRemovedFromList) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatRemovedFromList#4d2ac21c as nil") - } - b.PutInt53(u.ChatID) - if u.ChatList == nil { - return fmt.Errorf("unable to encode updateChatRemovedFromList#4d2ac21c: field chat_list is nil") - } - if err := u.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatRemovedFromList#4d2ac21c: field chat_list: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatRemovedFromList) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatRemovedFromList#4d2ac21c to nil") - } - if err := b.ConsumeID(UpdateChatRemovedFromListTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatRemovedFromList) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatRemovedFromList#4d2ac21c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: field chat_list: %w", err) - } - u.ChatList = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatRemovedFromList) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatRemovedFromList#4d2ac21c as nil") - } - b.ObjStart() - b.PutID("updateChatRemovedFromList") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("chat_list") - if u.ChatList == nil { - return fmt.Errorf("unable to encode updateChatRemovedFromList#4d2ac21c: field chat_list is nil") - } - if err := u.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatRemovedFromList#4d2ac21c: field chat_list: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatRemovedFromList) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatRemovedFromList#4d2ac21c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatRemovedFromList"); err != nil { - return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: field chat_id: %w", err) - } - u.ChatID = value - case "chat_list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatRemovedFromList#4d2ac21c: field chat_list: %w", err) - } - u.ChatList = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatRemovedFromList) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetChatList returns value of ChatList field. -func (u *UpdateChatRemovedFromList) GetChatList() (value ChatListClass) { - if u == nil { - return - } - return u.ChatList -} - -// UpdateChatReadInbox represents TL type `updateChatReadInbox#d07036e7`. -type UpdateChatReadInbox struct { - // Chat identifier - ChatID int64 - // Identifier of the last read incoming message - LastReadInboxMessageID int64 - // The number of unread messages left in the chat - UnreadCount int32 -} - -// UpdateChatReadInboxTypeID is TL type id of UpdateChatReadInbox. -const UpdateChatReadInboxTypeID = 0xd07036e7 - -// construct implements constructor of UpdateClass. -func (u UpdateChatReadInbox) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatReadInbox. -var ( - _ bin.Encoder = &UpdateChatReadInbox{} - _ bin.Decoder = &UpdateChatReadInbox{} - _ bin.BareEncoder = &UpdateChatReadInbox{} - _ bin.BareDecoder = &UpdateChatReadInbox{} - - _ UpdateClass = &UpdateChatReadInbox{} -) - -func (u *UpdateChatReadInbox) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.LastReadInboxMessageID == 0) { - return false - } - if !(u.UnreadCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatReadInbox) String() string { - if u == nil { - return "UpdateChatReadInbox(nil)" - } - type Alias UpdateChatReadInbox - return fmt.Sprintf("UpdateChatReadInbox%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatReadInbox) TypeID() uint32 { - return UpdateChatReadInboxTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatReadInbox) TypeName() string { - return "updateChatReadInbox" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatReadInbox) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatReadInbox", - ID: UpdateChatReadInboxTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "LastReadInboxMessageID", - SchemaName: "last_read_inbox_message_id", - }, - { - Name: "UnreadCount", - SchemaName: "unread_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatReadInbox) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatReadInbox#d07036e7 as nil") - } - b.PutID(UpdateChatReadInboxTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatReadInbox) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatReadInbox#d07036e7 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.LastReadInboxMessageID) - b.PutInt32(u.UnreadCount) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatReadInbox) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatReadInbox#d07036e7 to nil") - } - if err := b.ConsumeID(UpdateChatReadInboxTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatReadInbox) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatReadInbox#d07036e7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field last_read_inbox_message_id: %w", err) - } - u.LastReadInboxMessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field unread_count: %w", err) - } - u.UnreadCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatReadInbox) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatReadInbox#d07036e7 as nil") - } - b.ObjStart() - b.PutID("updateChatReadInbox") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("last_read_inbox_message_id") - b.PutInt53(u.LastReadInboxMessageID) - b.Comma() - b.FieldStart("unread_count") - b.PutInt32(u.UnreadCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatReadInbox) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatReadInbox#d07036e7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatReadInbox"); err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field chat_id: %w", err) - } - u.ChatID = value - case "last_read_inbox_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field last_read_inbox_message_id: %w", err) - } - u.LastReadInboxMessageID = value - case "unread_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadInbox#d07036e7: field unread_count: %w", err) - } - u.UnreadCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatReadInbox) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetLastReadInboxMessageID returns value of LastReadInboxMessageID field. -func (u *UpdateChatReadInbox) GetLastReadInboxMessageID() (value int64) { - if u == nil { - return - } - return u.LastReadInboxMessageID -} - -// GetUnreadCount returns value of UnreadCount field. -func (u *UpdateChatReadInbox) GetUnreadCount() (value int32) { - if u == nil { - return - } - return u.UnreadCount -} - -// UpdateChatReadOutbox represents TL type `updateChatReadOutbox#2a385285`. -type UpdateChatReadOutbox struct { - // Chat identifier - ChatID int64 - // Identifier of last read outgoing message - LastReadOutboxMessageID int64 -} - -// UpdateChatReadOutboxTypeID is TL type id of UpdateChatReadOutbox. -const UpdateChatReadOutboxTypeID = 0x2a385285 - -// construct implements constructor of UpdateClass. -func (u UpdateChatReadOutbox) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatReadOutbox. -var ( - _ bin.Encoder = &UpdateChatReadOutbox{} - _ bin.Decoder = &UpdateChatReadOutbox{} - _ bin.BareEncoder = &UpdateChatReadOutbox{} - _ bin.BareDecoder = &UpdateChatReadOutbox{} - - _ UpdateClass = &UpdateChatReadOutbox{} -) - -func (u *UpdateChatReadOutbox) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.LastReadOutboxMessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatReadOutbox) String() string { - if u == nil { - return "UpdateChatReadOutbox(nil)" - } - type Alias UpdateChatReadOutbox - return fmt.Sprintf("UpdateChatReadOutbox%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatReadOutbox) TypeID() uint32 { - return UpdateChatReadOutboxTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatReadOutbox) TypeName() string { - return "updateChatReadOutbox" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatReadOutbox) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatReadOutbox", - ID: UpdateChatReadOutboxTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "LastReadOutboxMessageID", - SchemaName: "last_read_outbox_message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatReadOutbox) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatReadOutbox#2a385285 as nil") - } - b.PutID(UpdateChatReadOutboxTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatReadOutbox) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatReadOutbox#2a385285 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.LastReadOutboxMessageID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatReadOutbox) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatReadOutbox#2a385285 to nil") - } - if err := b.ConsumeID(UpdateChatReadOutboxTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatReadOutbox) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatReadOutbox#2a385285 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field last_read_outbox_message_id: %w", err) - } - u.LastReadOutboxMessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatReadOutbox) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatReadOutbox#2a385285 as nil") - } - b.ObjStart() - b.PutID("updateChatReadOutbox") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("last_read_outbox_message_id") - b.PutInt53(u.LastReadOutboxMessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatReadOutbox) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatReadOutbox#2a385285 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatReadOutbox"); err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field chat_id: %w", err) - } - u.ChatID = value - case "last_read_outbox_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReadOutbox#2a385285: field last_read_outbox_message_id: %w", err) - } - u.LastReadOutboxMessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatReadOutbox) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetLastReadOutboxMessageID returns value of LastReadOutboxMessageID field. -func (u *UpdateChatReadOutbox) GetLastReadOutboxMessageID() (value int64) { - if u == nil { - return - } - return u.LastReadOutboxMessageID -} - -// UpdateChatActionBar represents TL type `updateChatActionBar#d9a258c2`. -type UpdateChatActionBar struct { - // Chat identifier - ChatID int64 - // The new value of the action bar; may be null - ActionBar ChatActionBarClass -} - -// UpdateChatActionBarTypeID is TL type id of UpdateChatActionBar. -const UpdateChatActionBarTypeID = 0xd9a258c2 - -// construct implements constructor of UpdateClass. -func (u UpdateChatActionBar) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatActionBar. -var ( - _ bin.Encoder = &UpdateChatActionBar{} - _ bin.Decoder = &UpdateChatActionBar{} - _ bin.BareEncoder = &UpdateChatActionBar{} - _ bin.BareDecoder = &UpdateChatActionBar{} - - _ UpdateClass = &UpdateChatActionBar{} -) - -func (u *UpdateChatActionBar) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.ActionBar == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatActionBar) String() string { - if u == nil { - return "UpdateChatActionBar(nil)" - } - type Alias UpdateChatActionBar - return fmt.Sprintf("UpdateChatActionBar%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatActionBar) TypeID() uint32 { - return UpdateChatActionBarTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatActionBar) TypeName() string { - return "updateChatActionBar" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatActionBar) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatActionBar", - ID: UpdateChatActionBarTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ActionBar", - SchemaName: "action_bar", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatActionBar) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatActionBar#d9a258c2 as nil") - } - b.PutID(UpdateChatActionBarTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatActionBar) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatActionBar#d9a258c2 as nil") - } - b.PutInt53(u.ChatID) - if u.ActionBar == nil { - return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar is nil") - } - if err := u.ActionBar.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatActionBar) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatActionBar#d9a258c2 to nil") - } - if err := b.ConsumeID(UpdateChatActionBarTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatActionBar) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatActionBar#d9a258c2 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := DecodeChatActionBar(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field action_bar: %w", err) - } - u.ActionBar = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatActionBar) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatActionBar#d9a258c2 as nil") - } - b.ObjStart() - b.PutID("updateChatActionBar") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("action_bar") - if u.ActionBar == nil { - return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar is nil") - } - if err := u.ActionBar.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatActionBar#d9a258c2: field action_bar: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatActionBar) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatActionBar#d9a258c2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatActionBar"); err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field chat_id: %w", err) - } - u.ChatID = value - case "action_bar": - value, err := DecodeTDLibJSONChatActionBar(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatActionBar#d9a258c2: field action_bar: %w", err) - } - u.ActionBar = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatActionBar) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetActionBar returns value of ActionBar field. -func (u *UpdateChatActionBar) GetActionBar() (value ChatActionBarClass) { - if u == nil { - return - } - return u.ActionBar -} - -// UpdateChatBusinessBotManageBar represents TL type `updateChatBusinessBotManageBar#be30e7f7`. -type UpdateChatBusinessBotManageBar struct { - // Chat identifier - ChatID int64 - // The new value of the business bot manage bar; may be null - BusinessBotManageBar BusinessBotManageBar -} - -// UpdateChatBusinessBotManageBarTypeID is TL type id of UpdateChatBusinessBotManageBar. -const UpdateChatBusinessBotManageBarTypeID = 0xbe30e7f7 - -// construct implements constructor of UpdateClass. -func (u UpdateChatBusinessBotManageBar) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatBusinessBotManageBar. -var ( - _ bin.Encoder = &UpdateChatBusinessBotManageBar{} - _ bin.Decoder = &UpdateChatBusinessBotManageBar{} - _ bin.BareEncoder = &UpdateChatBusinessBotManageBar{} - _ bin.BareDecoder = &UpdateChatBusinessBotManageBar{} - - _ UpdateClass = &UpdateChatBusinessBotManageBar{} -) - -func (u *UpdateChatBusinessBotManageBar) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.BusinessBotManageBar.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatBusinessBotManageBar) String() string { - if u == nil { - return "UpdateChatBusinessBotManageBar(nil)" - } - type Alias UpdateChatBusinessBotManageBar - return fmt.Sprintf("UpdateChatBusinessBotManageBar%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatBusinessBotManageBar) TypeID() uint32 { - return UpdateChatBusinessBotManageBarTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatBusinessBotManageBar) TypeName() string { - return "updateChatBusinessBotManageBar" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatBusinessBotManageBar) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatBusinessBotManageBar", - ID: UpdateChatBusinessBotManageBarTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "BusinessBotManageBar", - SchemaName: "business_bot_manage_bar", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatBusinessBotManageBar) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBusinessBotManageBar#be30e7f7 as nil") - } - b.PutID(UpdateChatBusinessBotManageBarTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatBusinessBotManageBar) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBusinessBotManageBar#be30e7f7 as nil") - } - b.PutInt53(u.ChatID) - if err := u.BusinessBotManageBar.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatBusinessBotManageBar#be30e7f7: field business_bot_manage_bar: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatBusinessBotManageBar) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBusinessBotManageBar#be30e7f7 to nil") - } - if err := b.ConsumeID(UpdateChatBusinessBotManageBarTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatBusinessBotManageBar#be30e7f7: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatBusinessBotManageBar) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBusinessBotManageBar#be30e7f7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatBusinessBotManageBar#be30e7f7: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.BusinessBotManageBar.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatBusinessBotManageBar#be30e7f7: field business_bot_manage_bar: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatBusinessBotManageBar) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBusinessBotManageBar#be30e7f7 as nil") - } - b.ObjStart() - b.PutID("updateChatBusinessBotManageBar") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("business_bot_manage_bar") - if err := u.BusinessBotManageBar.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatBusinessBotManageBar#be30e7f7: field business_bot_manage_bar: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatBusinessBotManageBar) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBusinessBotManageBar#be30e7f7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatBusinessBotManageBar"); err != nil { - return fmt.Errorf("unable to decode updateChatBusinessBotManageBar#be30e7f7: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatBusinessBotManageBar#be30e7f7: field chat_id: %w", err) - } - u.ChatID = value - case "business_bot_manage_bar": - if err := u.BusinessBotManageBar.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatBusinessBotManageBar#be30e7f7: field business_bot_manage_bar: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatBusinessBotManageBar) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetBusinessBotManageBar returns value of BusinessBotManageBar field. -func (u *UpdateChatBusinessBotManageBar) GetBusinessBotManageBar() (value BusinessBotManageBar) { - if u == nil { - return - } - return u.BusinessBotManageBar -} - -// UpdateChatAvailableReactions represents TL type `updateChatAvailableReactions#8ab413f9`. -type UpdateChatAvailableReactions struct { - // Chat identifier - ChatID int64 - // The new reactions, available in the chat - AvailableReactions ChatAvailableReactionsClass -} - -// UpdateChatAvailableReactionsTypeID is TL type id of UpdateChatAvailableReactions. -const UpdateChatAvailableReactionsTypeID = 0x8ab413f9 - -// construct implements constructor of UpdateClass. -func (u UpdateChatAvailableReactions) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatAvailableReactions. -var ( - _ bin.Encoder = &UpdateChatAvailableReactions{} - _ bin.Decoder = &UpdateChatAvailableReactions{} - _ bin.BareEncoder = &UpdateChatAvailableReactions{} - _ bin.BareDecoder = &UpdateChatAvailableReactions{} - - _ UpdateClass = &UpdateChatAvailableReactions{} -) - -func (u *UpdateChatAvailableReactions) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.AvailableReactions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatAvailableReactions) String() string { - if u == nil { - return "UpdateChatAvailableReactions(nil)" - } - type Alias UpdateChatAvailableReactions - return fmt.Sprintf("UpdateChatAvailableReactions%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatAvailableReactions) TypeID() uint32 { - return UpdateChatAvailableReactionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatAvailableReactions) TypeName() string { - return "updateChatAvailableReactions" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatAvailableReactions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatAvailableReactions", - ID: UpdateChatAvailableReactionsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "AvailableReactions", - SchemaName: "available_reactions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatAvailableReactions) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAvailableReactions#8ab413f9 as nil") - } - b.PutID(UpdateChatAvailableReactionsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatAvailableReactions) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAvailableReactions#8ab413f9 as nil") - } - b.PutInt53(u.ChatID) - if u.AvailableReactions == nil { - return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions is nil") - } - if err := u.AvailableReactions.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatAvailableReactions) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAvailableReactions#8ab413f9 to nil") - } - if err := b.ConsumeID(UpdateChatAvailableReactionsTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatAvailableReactions) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAvailableReactions#8ab413f9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := DecodeChatAvailableReactions(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) - } - u.AvailableReactions = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatAvailableReactions) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAvailableReactions#8ab413f9 as nil") - } - b.ObjStart() - b.PutID("updateChatAvailableReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("available_reactions") - if u.AvailableReactions == nil { - return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions is nil") - } - if err := u.AvailableReactions.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatAvailableReactions) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAvailableReactions#8ab413f9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatAvailableReactions"); err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field chat_id: %w", err) - } - u.ChatID = value - case "available_reactions": - value, err := DecodeTDLibJSONChatAvailableReactions(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatAvailableReactions#8ab413f9: field available_reactions: %w", err) - } - u.AvailableReactions = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatAvailableReactions) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetAvailableReactions returns value of AvailableReactions field. -func (u *UpdateChatAvailableReactions) GetAvailableReactions() (value ChatAvailableReactionsClass) { - if u == nil { - return - } - return u.AvailableReactions -} - -// UpdateChatDraftMessage represents TL type `updateChatDraftMessage#2bf257d4`. -type UpdateChatDraftMessage struct { - // Chat identifier - ChatID int64 - // The new draft message; may be null if none - DraftMessage DraftMessage - // The new chat positions in the chat lists - Positions []ChatPosition -} - -// UpdateChatDraftMessageTypeID is TL type id of UpdateChatDraftMessage. -const UpdateChatDraftMessageTypeID = 0x2bf257d4 - -// construct implements constructor of UpdateClass. -func (u UpdateChatDraftMessage) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatDraftMessage. -var ( - _ bin.Encoder = &UpdateChatDraftMessage{} - _ bin.Decoder = &UpdateChatDraftMessage{} - _ bin.BareEncoder = &UpdateChatDraftMessage{} - _ bin.BareDecoder = &UpdateChatDraftMessage{} - - _ UpdateClass = &UpdateChatDraftMessage{} -) - -func (u *UpdateChatDraftMessage) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.DraftMessage.Zero()) { - return false - } - if !(u.Positions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatDraftMessage) String() string { - if u == nil { - return "UpdateChatDraftMessage(nil)" - } - type Alias UpdateChatDraftMessage - return fmt.Sprintf("UpdateChatDraftMessage%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatDraftMessage) TypeID() uint32 { - return UpdateChatDraftMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatDraftMessage) TypeName() string { - return "updateChatDraftMessage" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatDraftMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatDraftMessage", - ID: UpdateChatDraftMessageTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "DraftMessage", - SchemaName: "draft_message", - }, - { - Name: "Positions", - SchemaName: "positions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatDraftMessage) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") - } - b.PutID(UpdateChatDraftMessageTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatDraftMessage) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") - } - b.PutInt53(u.ChatID) - if err := u.DraftMessage.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) - } - b.PutInt(len(u.Positions)) - for idx, v := range u.Positions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateChatDraftMessage#2bf257d4: field positions element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatDraftMessage) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatDraftMessage#2bf257d4 to nil") - } - if err := b.ConsumeID(UpdateChatDraftMessageTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatDraftMessage) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatDraftMessage#2bf257d4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.DraftMessage.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field positions: %w", err) - } - - if headerLen > 0 { - u.Positions = make([]ChatPosition, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatPosition - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateChatDraftMessage#2bf257d4: field positions: %w", err) - } - u.Positions = append(u.Positions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatDraftMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatDraftMessage#2bf257d4 as nil") - } - b.ObjStart() - b.PutID("updateChatDraftMessage") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("draft_message") - if err := u.DraftMessage.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) - } - b.Comma() - b.FieldStart("positions") - b.ArrStart() - for idx, v := range u.Positions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatDraftMessage#2bf257d4: field positions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatDraftMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatDraftMessage#2bf257d4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatDraftMessage"); err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field chat_id: %w", err) - } - u.ChatID = value - case "draft_message": - if err := u.DraftMessage.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field draft_message: %w", err) - } - case "positions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatPosition - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field positions: %w", err) - } - u.Positions = append(u.Positions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateChatDraftMessage#2bf257d4: field positions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatDraftMessage) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetDraftMessage returns value of DraftMessage field. -func (u *UpdateChatDraftMessage) GetDraftMessage() (value DraftMessage) { - if u == nil { - return - } - return u.DraftMessage -} - -// GetPositions returns value of Positions field. -func (u *UpdateChatDraftMessage) GetPositions() (value []ChatPosition) { - if u == nil { - return - } - return u.Positions -} - -// UpdateChatEmojiStatus represents TL type `updateChatEmojiStatus#77796510`. -type UpdateChatEmojiStatus struct { - // Chat identifier - ChatID int64 - // The new chat emoji status; may be null - EmojiStatus EmojiStatus -} - -// UpdateChatEmojiStatusTypeID is TL type id of UpdateChatEmojiStatus. -const UpdateChatEmojiStatusTypeID = 0x77796510 - -// construct implements constructor of UpdateClass. -func (u UpdateChatEmojiStatus) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatEmojiStatus. -var ( - _ bin.Encoder = &UpdateChatEmojiStatus{} - _ bin.Decoder = &UpdateChatEmojiStatus{} - _ bin.BareEncoder = &UpdateChatEmojiStatus{} - _ bin.BareDecoder = &UpdateChatEmojiStatus{} - - _ UpdateClass = &UpdateChatEmojiStatus{} -) - -func (u *UpdateChatEmojiStatus) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.EmojiStatus.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatEmojiStatus) String() string { - if u == nil { - return "UpdateChatEmojiStatus(nil)" - } - type Alias UpdateChatEmojiStatus - return fmt.Sprintf("UpdateChatEmojiStatus%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatEmojiStatus) TypeID() uint32 { - return UpdateChatEmojiStatusTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatEmojiStatus) TypeName() string { - return "updateChatEmojiStatus" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatEmojiStatus) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatEmojiStatus", - ID: UpdateChatEmojiStatusTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "EmojiStatus", - SchemaName: "emoji_status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatEmojiStatus) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatEmojiStatus#77796510 as nil") - } - b.PutID(UpdateChatEmojiStatusTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatEmojiStatus) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatEmojiStatus#77796510 as nil") - } - b.PutInt53(u.ChatID) - if err := u.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatEmojiStatus#77796510: field emoji_status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatEmojiStatus) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatEmojiStatus#77796510 to nil") - } - if err := b.ConsumeID(UpdateChatEmojiStatusTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatEmojiStatus) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatEmojiStatus#77796510 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.EmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field emoji_status: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatEmojiStatus) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatEmojiStatus#77796510 as nil") - } - b.ObjStart() - b.PutID("updateChatEmojiStatus") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("emoji_status") - if err := u.EmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatEmojiStatus#77796510: field emoji_status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatEmojiStatus) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatEmojiStatus#77796510 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatEmojiStatus"); err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field chat_id: %w", err) - } - u.ChatID = value - case "emoji_status": - if err := u.EmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatEmojiStatus#77796510: field emoji_status: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatEmojiStatus) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetEmojiStatus returns value of EmojiStatus field. -func (u *UpdateChatEmojiStatus) GetEmojiStatus() (value EmojiStatus) { - if u == nil { - return - } - return u.EmojiStatus -} - -// UpdateChatMessageSender represents TL type `updateChatMessageSender#77705241`. -type UpdateChatMessageSender struct { - // Chat identifier - ChatID int64 - // New value of message_sender_id; may be null if the user can't change message sender - MessageSenderID MessageSenderClass -} - -// UpdateChatMessageSenderTypeID is TL type id of UpdateChatMessageSender. -const UpdateChatMessageSenderTypeID = 0x77705241 - -// construct implements constructor of UpdateClass. -func (u UpdateChatMessageSender) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatMessageSender. -var ( - _ bin.Encoder = &UpdateChatMessageSender{} - _ bin.Decoder = &UpdateChatMessageSender{} - _ bin.BareEncoder = &UpdateChatMessageSender{} - _ bin.BareDecoder = &UpdateChatMessageSender{} - - _ UpdateClass = &UpdateChatMessageSender{} -) - -func (u *UpdateChatMessageSender) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageSenderID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatMessageSender) String() string { - if u == nil { - return "UpdateChatMessageSender(nil)" - } - type Alias UpdateChatMessageSender - return fmt.Sprintf("UpdateChatMessageSender%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatMessageSender) TypeID() uint32 { - return UpdateChatMessageSenderTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatMessageSender) TypeName() string { - return "updateChatMessageSender" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatMessageSender) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatMessageSender", - ID: UpdateChatMessageSenderTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageSenderID", - SchemaName: "message_sender_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatMessageSender) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatMessageSender#77705241 as nil") - } - b.PutID(UpdateChatMessageSenderTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatMessageSender) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatMessageSender#77705241 as nil") - } - b.PutInt53(u.ChatID) - if u.MessageSenderID == nil { - return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id is nil") - } - if err := u.MessageSenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatMessageSender) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatMessageSender#77705241 to nil") - } - if err := b.ConsumeID(UpdateChatMessageSenderTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatMessageSender) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatMessageSender#77705241 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field message_sender_id: %w", err) - } - u.MessageSenderID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatMessageSender) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatMessageSender#77705241 as nil") - } - b.ObjStart() - b.PutID("updateChatMessageSender") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_sender_id") - if u.MessageSenderID == nil { - return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id is nil") - } - if err := u.MessageSenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatMessageSender#77705241: field message_sender_id: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatMessageSender) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatMessageSender#77705241 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatMessageSender"); err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field chat_id: %w", err) - } - u.ChatID = value - case "message_sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatMessageSender#77705241: field message_sender_id: %w", err) - } - u.MessageSenderID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatMessageSender) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageSenderID returns value of MessageSenderID field. -func (u *UpdateChatMessageSender) GetMessageSenderID() (value MessageSenderClass) { - if u == nil { - return - } - return u.MessageSenderID -} - -// UpdateChatMessageAutoDeleteTime represents TL type `updateChatMessageAutoDeleteTime#71425de5`. -type UpdateChatMessageAutoDeleteTime struct { - // Chat identifier - ChatID int64 - // New value of message_auto_delete_time - MessageAutoDeleteTime int32 -} - -// UpdateChatMessageAutoDeleteTimeTypeID is TL type id of UpdateChatMessageAutoDeleteTime. -const UpdateChatMessageAutoDeleteTimeTypeID = 0x71425de5 - -// construct implements constructor of UpdateClass. -func (u UpdateChatMessageAutoDeleteTime) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatMessageAutoDeleteTime. -var ( - _ bin.Encoder = &UpdateChatMessageAutoDeleteTime{} - _ bin.Decoder = &UpdateChatMessageAutoDeleteTime{} - _ bin.BareEncoder = &UpdateChatMessageAutoDeleteTime{} - _ bin.BareDecoder = &UpdateChatMessageAutoDeleteTime{} - - _ UpdateClass = &UpdateChatMessageAutoDeleteTime{} -) - -func (u *UpdateChatMessageAutoDeleteTime) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageAutoDeleteTime == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatMessageAutoDeleteTime) String() string { - if u == nil { - return "UpdateChatMessageAutoDeleteTime(nil)" - } - type Alias UpdateChatMessageAutoDeleteTime - return fmt.Sprintf("UpdateChatMessageAutoDeleteTime%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatMessageAutoDeleteTime) TypeID() uint32 { - return UpdateChatMessageAutoDeleteTimeTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatMessageAutoDeleteTime) TypeName() string { - return "updateChatMessageAutoDeleteTime" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatMessageAutoDeleteTime) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatMessageAutoDeleteTime", - ID: UpdateChatMessageAutoDeleteTimeTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageAutoDeleteTime", - SchemaName: "message_auto_delete_time", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatMessageAutoDeleteTime) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatMessageAutoDeleteTime#71425de5 as nil") - } - b.PutID(UpdateChatMessageAutoDeleteTimeTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatMessageAutoDeleteTime) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatMessageAutoDeleteTime#71425de5 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt32(u.MessageAutoDeleteTime) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatMessageAutoDeleteTime) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatMessageAutoDeleteTime#71425de5 to nil") - } - if err := b.ConsumeID(UpdateChatMessageAutoDeleteTimeTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatMessageAutoDeleteTime) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatMessageAutoDeleteTime#71425de5 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field message_auto_delete_time: %w", err) - } - u.MessageAutoDeleteTime = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatMessageAutoDeleteTime) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatMessageAutoDeleteTime#71425de5 as nil") - } - b.ObjStart() - b.PutID("updateChatMessageAutoDeleteTime") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_auto_delete_time") - b.PutInt32(u.MessageAutoDeleteTime) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatMessageAutoDeleteTime) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatMessageAutoDeleteTime#71425de5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatMessageAutoDeleteTime"); err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field chat_id: %w", err) - } - u.ChatID = value - case "message_auto_delete_time": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatMessageAutoDeleteTime#71425de5: field message_auto_delete_time: %w", err) - } - u.MessageAutoDeleteTime = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatMessageAutoDeleteTime) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageAutoDeleteTime returns value of MessageAutoDeleteTime field. -func (u *UpdateChatMessageAutoDeleteTime) GetMessageAutoDeleteTime() (value int32) { - if u == nil { - return - } - return u.MessageAutoDeleteTime -} - -// UpdateChatNotificationSettings represents TL type `updateChatNotificationSettings#d020b456`. -type UpdateChatNotificationSettings struct { - // Chat identifier - ChatID int64 - // The new notification settings - NotificationSettings ChatNotificationSettings -} - -// UpdateChatNotificationSettingsTypeID is TL type id of UpdateChatNotificationSettings. -const UpdateChatNotificationSettingsTypeID = 0xd020b456 - -// construct implements constructor of UpdateClass. -func (u UpdateChatNotificationSettings) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatNotificationSettings. -var ( - _ bin.Encoder = &UpdateChatNotificationSettings{} - _ bin.Decoder = &UpdateChatNotificationSettings{} - _ bin.BareEncoder = &UpdateChatNotificationSettings{} - _ bin.BareDecoder = &UpdateChatNotificationSettings{} - - _ UpdateClass = &UpdateChatNotificationSettings{} -) - -func (u *UpdateChatNotificationSettings) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.NotificationSettings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatNotificationSettings) String() string { - if u == nil { - return "UpdateChatNotificationSettings(nil)" - } - type Alias UpdateChatNotificationSettings - return fmt.Sprintf("UpdateChatNotificationSettings%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatNotificationSettings) TypeID() uint32 { - return UpdateChatNotificationSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatNotificationSettings) TypeName() string { - return "updateChatNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatNotificationSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatNotificationSettings", - ID: UpdateChatNotificationSettingsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "NotificationSettings", - SchemaName: "notification_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatNotificationSettings) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatNotificationSettings#d020b456 as nil") - } - b.PutID(UpdateChatNotificationSettingsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatNotificationSettings) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatNotificationSettings#d020b456 as nil") - } - b.PutInt53(u.ChatID) - if err := u.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatNotificationSettings) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatNotificationSettings#d020b456 to nil") - } - if err := b.ConsumeID(UpdateChatNotificationSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatNotificationSettings) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatNotificationSettings#d020b456 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatNotificationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatNotificationSettings#d020b456 as nil") - } - b.ObjStart() - b.PutID("updateChatNotificationSettings") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("notification_settings") - if err := u.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatNotificationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatNotificationSettings#d020b456 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field chat_id: %w", err) - } - u.ChatID = value - case "notification_settings": - if err := u.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatNotificationSettings#d020b456: field notification_settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatNotificationSettings) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetNotificationSettings returns value of NotificationSettings field. -func (u *UpdateChatNotificationSettings) GetNotificationSettings() (value ChatNotificationSettings) { - if u == nil { - return - } - return u.NotificationSettings -} - -// UpdateChatPendingJoinRequests represents TL type `updateChatPendingJoinRequests#14c6e3e1`. -type UpdateChatPendingJoinRequests struct { - // Chat identifier - ChatID int64 - // The new data about pending join requests; may be null - PendingJoinRequests ChatJoinRequestsInfo -} - -// UpdateChatPendingJoinRequestsTypeID is TL type id of UpdateChatPendingJoinRequests. -const UpdateChatPendingJoinRequestsTypeID = 0x14c6e3e1 - -// construct implements constructor of UpdateClass. -func (u UpdateChatPendingJoinRequests) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatPendingJoinRequests. -var ( - _ bin.Encoder = &UpdateChatPendingJoinRequests{} - _ bin.Decoder = &UpdateChatPendingJoinRequests{} - _ bin.BareEncoder = &UpdateChatPendingJoinRequests{} - _ bin.BareDecoder = &UpdateChatPendingJoinRequests{} - - _ UpdateClass = &UpdateChatPendingJoinRequests{} -) - -func (u *UpdateChatPendingJoinRequests) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.PendingJoinRequests.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatPendingJoinRequests) String() string { - if u == nil { - return "UpdateChatPendingJoinRequests(nil)" - } - type Alias UpdateChatPendingJoinRequests - return fmt.Sprintf("UpdateChatPendingJoinRequests%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatPendingJoinRequests) TypeID() uint32 { - return UpdateChatPendingJoinRequestsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatPendingJoinRequests) TypeName() string { - return "updateChatPendingJoinRequests" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatPendingJoinRequests) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatPendingJoinRequests", - ID: UpdateChatPendingJoinRequestsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "PendingJoinRequests", - SchemaName: "pending_join_requests", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatPendingJoinRequests) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPendingJoinRequests#14c6e3e1 as nil") - } - b.PutID(UpdateChatPendingJoinRequestsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatPendingJoinRequests) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPendingJoinRequests#14c6e3e1 as nil") - } - b.PutInt53(u.ChatID) - if err := u.PendingJoinRequests.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatPendingJoinRequests) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPendingJoinRequests#14c6e3e1 to nil") - } - if err := b.ConsumeID(UpdateChatPendingJoinRequestsTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatPendingJoinRequests) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPendingJoinRequests#14c6e3e1 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.PendingJoinRequests.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatPendingJoinRequests) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatPendingJoinRequests#14c6e3e1 as nil") - } - b.ObjStart() - b.PutID("updateChatPendingJoinRequests") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("pending_join_requests") - if err := u.PendingJoinRequests.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatPendingJoinRequests) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatPendingJoinRequests#14c6e3e1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatPendingJoinRequests"); err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field chat_id: %w", err) - } - u.ChatID = value - case "pending_join_requests": - if err := u.PendingJoinRequests.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatPendingJoinRequests#14c6e3e1: field pending_join_requests: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatPendingJoinRequests) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetPendingJoinRequests returns value of PendingJoinRequests field. -func (u *UpdateChatPendingJoinRequests) GetPendingJoinRequests() (value ChatJoinRequestsInfo) { - if u == nil { - return - } - return u.PendingJoinRequests -} - -// UpdateChatReplyMarkup represents TL type `updateChatReplyMarkup#4e0ba5a0`. -type UpdateChatReplyMarkup struct { - // Chat identifier - ChatID int64 - // Identifier of the message from which reply markup needs to be used; 0 if there is no - // default custom reply markup in the chat - ReplyMarkupMessageID int64 -} - -// UpdateChatReplyMarkupTypeID is TL type id of UpdateChatReplyMarkup. -const UpdateChatReplyMarkupTypeID = 0x4e0ba5a0 - -// construct implements constructor of UpdateClass. -func (u UpdateChatReplyMarkup) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatReplyMarkup. -var ( - _ bin.Encoder = &UpdateChatReplyMarkup{} - _ bin.Decoder = &UpdateChatReplyMarkup{} - _ bin.BareEncoder = &UpdateChatReplyMarkup{} - _ bin.BareDecoder = &UpdateChatReplyMarkup{} - - _ UpdateClass = &UpdateChatReplyMarkup{} -) - -func (u *UpdateChatReplyMarkup) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.ReplyMarkupMessageID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatReplyMarkup) String() string { - if u == nil { - return "UpdateChatReplyMarkup(nil)" - } - type Alias UpdateChatReplyMarkup - return fmt.Sprintf("UpdateChatReplyMarkup%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatReplyMarkup) TypeID() uint32 { - return UpdateChatReplyMarkupTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatReplyMarkup) TypeName() string { - return "updateChatReplyMarkup" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatReplyMarkup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatReplyMarkup", - ID: UpdateChatReplyMarkupTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ReplyMarkupMessageID", - SchemaName: "reply_markup_message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatReplyMarkup) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatReplyMarkup#4e0ba5a0 as nil") - } - b.PutID(UpdateChatReplyMarkupTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatReplyMarkup) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatReplyMarkup#4e0ba5a0 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.ReplyMarkupMessageID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatReplyMarkup) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatReplyMarkup#4e0ba5a0 to nil") - } - if err := b.ConsumeID(UpdateChatReplyMarkupTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatReplyMarkup) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatReplyMarkup#4e0ba5a0 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field reply_markup_message_id: %w", err) - } - u.ReplyMarkupMessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatReplyMarkup) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatReplyMarkup#4e0ba5a0 as nil") - } - b.ObjStart() - b.PutID("updateChatReplyMarkup") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("reply_markup_message_id") - b.PutInt53(u.ReplyMarkupMessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatReplyMarkup) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatReplyMarkup#4e0ba5a0 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatReplyMarkup"); err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field chat_id: %w", err) - } - u.ChatID = value - case "reply_markup_message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatReplyMarkup#4e0ba5a0: field reply_markup_message_id: %w", err) - } - u.ReplyMarkupMessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatReplyMarkup) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetReplyMarkupMessageID returns value of ReplyMarkupMessageID field. -func (u *UpdateChatReplyMarkup) GetReplyMarkupMessageID() (value int64) { - if u == nil { - return - } - return u.ReplyMarkupMessageID -} - -// UpdateChatBackground represents TL type `updateChatBackground#ff9d38b3`. -type UpdateChatBackground struct { - // Chat identifier - ChatID int64 - // The new chat background; may be null if background was reset to default - Background ChatBackground -} - -// UpdateChatBackgroundTypeID is TL type id of UpdateChatBackground. -const UpdateChatBackgroundTypeID = 0xff9d38b3 - -// construct implements constructor of UpdateClass. -func (u UpdateChatBackground) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatBackground. -var ( - _ bin.Encoder = &UpdateChatBackground{} - _ bin.Decoder = &UpdateChatBackground{} - _ bin.BareEncoder = &UpdateChatBackground{} - _ bin.BareDecoder = &UpdateChatBackground{} - - _ UpdateClass = &UpdateChatBackground{} -) - -func (u *UpdateChatBackground) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.Background.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatBackground) String() string { - if u == nil { - return "UpdateChatBackground(nil)" - } - type Alias UpdateChatBackground - return fmt.Sprintf("UpdateChatBackground%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatBackground) TypeID() uint32 { - return UpdateChatBackgroundTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatBackground) TypeName() string { - return "updateChatBackground" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatBackground) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatBackground", - ID: UpdateChatBackgroundTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Background", - SchemaName: "background", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatBackground) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBackground#ff9d38b3 as nil") - } - b.PutID(UpdateChatBackgroundTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatBackground) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBackground#ff9d38b3 as nil") - } - b.PutInt53(u.ChatID) - if err := u.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatBackground#ff9d38b3: field background: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatBackground) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBackground#ff9d38b3 to nil") - } - if err := b.ConsumeID(UpdateChatBackgroundTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatBackground) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBackground#ff9d38b3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.Background.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field background: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatBackground) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBackground#ff9d38b3 as nil") - } - b.ObjStart() - b.PutID("updateChatBackground") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("background") - if err := u.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatBackground#ff9d38b3: field background: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatBackground) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBackground#ff9d38b3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatBackground"); err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field chat_id: %w", err) - } - u.ChatID = value - case "background": - if err := u.Background.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatBackground#ff9d38b3: field background: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatBackground) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetBackground returns value of Background field. -func (u *UpdateChatBackground) GetBackground() (value ChatBackground) { - if u == nil { - return - } - return u.Background -} - -// UpdateChatTheme represents TL type `updateChatTheme#31f3d465`. -type UpdateChatTheme struct { - // Chat identifier - ChatID int64 - // The new name of the chat theme; may be empty if theme was reset to default - ThemeName string -} - -// UpdateChatThemeTypeID is TL type id of UpdateChatTheme. -const UpdateChatThemeTypeID = 0x31f3d465 - -// construct implements constructor of UpdateClass. -func (u UpdateChatTheme) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatTheme. -var ( - _ bin.Encoder = &UpdateChatTheme{} - _ bin.Decoder = &UpdateChatTheme{} - _ bin.BareEncoder = &UpdateChatTheme{} - _ bin.BareDecoder = &UpdateChatTheme{} - - _ UpdateClass = &UpdateChatTheme{} -) - -func (u *UpdateChatTheme) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.ThemeName == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatTheme) String() string { - if u == nil { - return "UpdateChatTheme(nil)" - } - type Alias UpdateChatTheme - return fmt.Sprintf("UpdateChatTheme%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatTheme) TypeID() uint32 { - return UpdateChatThemeTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatTheme) TypeName() string { - return "updateChatTheme" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatTheme) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatTheme", - ID: UpdateChatThemeTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ThemeName", - SchemaName: "theme_name", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatTheme) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatTheme#31f3d465 as nil") - } - b.PutID(UpdateChatThemeTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatTheme) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatTheme#31f3d465 as nil") - } - b.PutInt53(u.ChatID) - b.PutString(u.ThemeName) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatTheme) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatTheme#31f3d465 to nil") - } - if err := b.ConsumeID(UpdateChatThemeTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatTheme) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatTheme#31f3d465 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field theme_name: %w", err) - } - u.ThemeName = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatTheme) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatTheme#31f3d465 as nil") - } - b.ObjStart() - b.PutID("updateChatTheme") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("theme_name") - b.PutString(u.ThemeName) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatTheme) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatTheme#31f3d465 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatTheme"); err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field chat_id: %w", err) - } - u.ChatID = value - case "theme_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateChatTheme#31f3d465: field theme_name: %w", err) - } - u.ThemeName = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatTheme) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetThemeName returns value of ThemeName field. -func (u *UpdateChatTheme) GetThemeName() (value string) { - if u == nil { - return - } - return u.ThemeName -} - -// UpdateChatUnreadMentionCount represents TL type `updateChatUnreadMentionCount#80f47b1c`. -type UpdateChatUnreadMentionCount struct { - // Chat identifier - ChatID int64 - // The number of unread mention messages left in the chat - UnreadMentionCount int32 -} - -// UpdateChatUnreadMentionCountTypeID is TL type id of UpdateChatUnreadMentionCount. -const UpdateChatUnreadMentionCountTypeID = 0x80f47b1c - -// construct implements constructor of UpdateClass. -func (u UpdateChatUnreadMentionCount) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatUnreadMentionCount. -var ( - _ bin.Encoder = &UpdateChatUnreadMentionCount{} - _ bin.Decoder = &UpdateChatUnreadMentionCount{} - _ bin.BareEncoder = &UpdateChatUnreadMentionCount{} - _ bin.BareDecoder = &UpdateChatUnreadMentionCount{} - - _ UpdateClass = &UpdateChatUnreadMentionCount{} -) - -func (u *UpdateChatUnreadMentionCount) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.UnreadMentionCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatUnreadMentionCount) String() string { - if u == nil { - return "UpdateChatUnreadMentionCount(nil)" - } - type Alias UpdateChatUnreadMentionCount - return fmt.Sprintf("UpdateChatUnreadMentionCount%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatUnreadMentionCount) TypeID() uint32 { - return UpdateChatUnreadMentionCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatUnreadMentionCount) TypeName() string { - return "updateChatUnreadMentionCount" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatUnreadMentionCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatUnreadMentionCount", - ID: UpdateChatUnreadMentionCountTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "UnreadMentionCount", - SchemaName: "unread_mention_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatUnreadMentionCount) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") - } - b.PutID(UpdateChatUnreadMentionCountTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatUnreadMentionCount) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") - } - b.PutInt53(u.ChatID) - b.PutInt32(u.UnreadMentionCount) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatUnreadMentionCount) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") - } - if err := b.ConsumeID(UpdateChatUnreadMentionCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatUnreadMentionCount) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field unread_mention_count: %w", err) - } - u.UnreadMentionCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatUnreadMentionCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatUnreadMentionCount#80f47b1c as nil") - } - b.ObjStart() - b.PutID("updateChatUnreadMentionCount") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("unread_mention_count") - b.PutInt32(u.UnreadMentionCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatUnreadMentionCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatUnreadMentionCount#80f47b1c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatUnreadMentionCount"); err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field chat_id: %w", err) - } - u.ChatID = value - case "unread_mention_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadMentionCount#80f47b1c: field unread_mention_count: %w", err) - } - u.UnreadMentionCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatUnreadMentionCount) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetUnreadMentionCount returns value of UnreadMentionCount field. -func (u *UpdateChatUnreadMentionCount) GetUnreadMentionCount() (value int32) { - if u == nil { - return - } - return u.UnreadMentionCount -} - -// UpdateChatUnreadReactionCount represents TL type `updateChatUnreadReactionCount#81603cdd`. -type UpdateChatUnreadReactionCount struct { - // Chat identifier - ChatID int64 - // The number of messages with unread reactions left in the chat - UnreadReactionCount int32 -} - -// UpdateChatUnreadReactionCountTypeID is TL type id of UpdateChatUnreadReactionCount. -const UpdateChatUnreadReactionCountTypeID = 0x81603cdd - -// construct implements constructor of UpdateClass. -func (u UpdateChatUnreadReactionCount) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatUnreadReactionCount. -var ( - _ bin.Encoder = &UpdateChatUnreadReactionCount{} - _ bin.Decoder = &UpdateChatUnreadReactionCount{} - _ bin.BareEncoder = &UpdateChatUnreadReactionCount{} - _ bin.BareDecoder = &UpdateChatUnreadReactionCount{} - - _ UpdateClass = &UpdateChatUnreadReactionCount{} -) - -func (u *UpdateChatUnreadReactionCount) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.UnreadReactionCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatUnreadReactionCount) String() string { - if u == nil { - return "UpdateChatUnreadReactionCount(nil)" - } - type Alias UpdateChatUnreadReactionCount - return fmt.Sprintf("UpdateChatUnreadReactionCount%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatUnreadReactionCount) TypeID() uint32 { - return UpdateChatUnreadReactionCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatUnreadReactionCount) TypeName() string { - return "updateChatUnreadReactionCount" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatUnreadReactionCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatUnreadReactionCount", - ID: UpdateChatUnreadReactionCountTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "UnreadReactionCount", - SchemaName: "unread_reaction_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatUnreadReactionCount) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") - } - b.PutID(UpdateChatUnreadReactionCountTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatUnreadReactionCount) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") - } - b.PutInt53(u.ChatID) - b.PutInt32(u.UnreadReactionCount) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatUnreadReactionCount) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") - } - if err := b.ConsumeID(UpdateChatUnreadReactionCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatUnreadReactionCount) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field unread_reaction_count: %w", err) - } - u.UnreadReactionCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatUnreadReactionCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatUnreadReactionCount#81603cdd as nil") - } - b.ObjStart() - b.PutID("updateChatUnreadReactionCount") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("unread_reaction_count") - b.PutInt32(u.UnreadReactionCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatUnreadReactionCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatUnreadReactionCount#81603cdd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatUnreadReactionCount"); err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field chat_id: %w", err) - } - u.ChatID = value - case "unread_reaction_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatUnreadReactionCount#81603cdd: field unread_reaction_count: %w", err) - } - u.UnreadReactionCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatUnreadReactionCount) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetUnreadReactionCount returns value of UnreadReactionCount field. -func (u *UpdateChatUnreadReactionCount) GetUnreadReactionCount() (value int32) { - if u == nil { - return - } - return u.UnreadReactionCount -} - -// UpdateChatVideoChat represents TL type `updateChatVideoChat#25fb4ca6`. -type UpdateChatVideoChat struct { - // Chat identifier - ChatID int64 - // New value of video_chat - VideoChat VideoChat -} - -// UpdateChatVideoChatTypeID is TL type id of UpdateChatVideoChat. -const UpdateChatVideoChatTypeID = 0x25fb4ca6 - -// construct implements constructor of UpdateClass. -func (u UpdateChatVideoChat) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatVideoChat. -var ( - _ bin.Encoder = &UpdateChatVideoChat{} - _ bin.Decoder = &UpdateChatVideoChat{} - _ bin.BareEncoder = &UpdateChatVideoChat{} - _ bin.BareDecoder = &UpdateChatVideoChat{} - - _ UpdateClass = &UpdateChatVideoChat{} -) - -func (u *UpdateChatVideoChat) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.VideoChat.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatVideoChat) String() string { - if u == nil { - return "UpdateChatVideoChat(nil)" - } - type Alias UpdateChatVideoChat - return fmt.Sprintf("UpdateChatVideoChat%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatVideoChat) TypeID() uint32 { - return UpdateChatVideoChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatVideoChat) TypeName() string { - return "updateChatVideoChat" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatVideoChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatVideoChat", - ID: UpdateChatVideoChatTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "VideoChat", - SchemaName: "video_chat", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatVideoChat) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatVideoChat#25fb4ca6 as nil") - } - b.PutID(UpdateChatVideoChatTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatVideoChat) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatVideoChat#25fb4ca6 as nil") - } - b.PutInt53(u.ChatID) - if err := u.VideoChat.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatVideoChat) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatVideoChat#25fb4ca6 to nil") - } - if err := b.ConsumeID(UpdateChatVideoChatTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatVideoChat) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatVideoChat#25fb4ca6 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.VideoChat.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatVideoChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatVideoChat#25fb4ca6 as nil") - } - b.ObjStart() - b.PutID("updateChatVideoChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("video_chat") - if err := u.VideoChat.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatVideoChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatVideoChat#25fb4ca6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatVideoChat"); err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field chat_id: %w", err) - } - u.ChatID = value - case "video_chat": - if err := u.VideoChat.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatVideoChat#25fb4ca6: field video_chat: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatVideoChat) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetVideoChat returns value of VideoChat field. -func (u *UpdateChatVideoChat) GetVideoChat() (value VideoChat) { - if u == nil { - return - } - return u.VideoChat -} - -// UpdateChatDefaultDisableNotification represents TL type `updateChatDefaultDisableNotification#1ba96a9b`. -type UpdateChatDefaultDisableNotification struct { - // Chat identifier - ChatID int64 - // The new default_disable_notification value - DefaultDisableNotification bool -} - -// UpdateChatDefaultDisableNotificationTypeID is TL type id of UpdateChatDefaultDisableNotification. -const UpdateChatDefaultDisableNotificationTypeID = 0x1ba96a9b - -// construct implements constructor of UpdateClass. -func (u UpdateChatDefaultDisableNotification) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatDefaultDisableNotification. -var ( - _ bin.Encoder = &UpdateChatDefaultDisableNotification{} - _ bin.Decoder = &UpdateChatDefaultDisableNotification{} - _ bin.BareEncoder = &UpdateChatDefaultDisableNotification{} - _ bin.BareDecoder = &UpdateChatDefaultDisableNotification{} - - _ UpdateClass = &UpdateChatDefaultDisableNotification{} -) - -func (u *UpdateChatDefaultDisableNotification) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.DefaultDisableNotification == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatDefaultDisableNotification) String() string { - if u == nil { - return "UpdateChatDefaultDisableNotification(nil)" - } - type Alias UpdateChatDefaultDisableNotification - return fmt.Sprintf("UpdateChatDefaultDisableNotification%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatDefaultDisableNotification) TypeID() uint32 { - return UpdateChatDefaultDisableNotificationTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatDefaultDisableNotification) TypeName() string { - return "updateChatDefaultDisableNotification" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatDefaultDisableNotification) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatDefaultDisableNotification", - ID: UpdateChatDefaultDisableNotificationTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "DefaultDisableNotification", - SchemaName: "default_disable_notification", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatDefaultDisableNotification) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatDefaultDisableNotification#1ba96a9b as nil") - } - b.PutID(UpdateChatDefaultDisableNotificationTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatDefaultDisableNotification) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatDefaultDisableNotification#1ba96a9b as nil") - } - b.PutInt53(u.ChatID) - b.PutBool(u.DefaultDisableNotification) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatDefaultDisableNotification) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatDefaultDisableNotification#1ba96a9b to nil") - } - if err := b.ConsumeID(UpdateChatDefaultDisableNotificationTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatDefaultDisableNotification) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatDefaultDisableNotification#1ba96a9b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field default_disable_notification: %w", err) - } - u.DefaultDisableNotification = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatDefaultDisableNotification) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatDefaultDisableNotification#1ba96a9b as nil") - } - b.ObjStart() - b.PutID("updateChatDefaultDisableNotification") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("default_disable_notification") - b.PutBool(u.DefaultDisableNotification) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatDefaultDisableNotification) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatDefaultDisableNotification#1ba96a9b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatDefaultDisableNotification"); err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field chat_id: %w", err) - } - u.ChatID = value - case "default_disable_notification": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatDefaultDisableNotification#1ba96a9b: field default_disable_notification: %w", err) - } - u.DefaultDisableNotification = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatDefaultDisableNotification) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetDefaultDisableNotification returns value of DefaultDisableNotification field. -func (u *UpdateChatDefaultDisableNotification) GetDefaultDisableNotification() (value bool) { - if u == nil { - return - } - return u.DefaultDisableNotification -} - -// UpdateChatHasProtectedContent represents TL type `updateChatHasProtectedContent#6b50071b`. -type UpdateChatHasProtectedContent struct { - // Chat identifier - ChatID int64 - // New value of has_protected_content - HasProtectedContent bool -} - -// UpdateChatHasProtectedContentTypeID is TL type id of UpdateChatHasProtectedContent. -const UpdateChatHasProtectedContentTypeID = 0x6b50071b - -// construct implements constructor of UpdateClass. -func (u UpdateChatHasProtectedContent) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatHasProtectedContent. -var ( - _ bin.Encoder = &UpdateChatHasProtectedContent{} - _ bin.Decoder = &UpdateChatHasProtectedContent{} - _ bin.BareEncoder = &UpdateChatHasProtectedContent{} - _ bin.BareDecoder = &UpdateChatHasProtectedContent{} - - _ UpdateClass = &UpdateChatHasProtectedContent{} -) - -func (u *UpdateChatHasProtectedContent) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.HasProtectedContent == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatHasProtectedContent) String() string { - if u == nil { - return "UpdateChatHasProtectedContent(nil)" - } - type Alias UpdateChatHasProtectedContent - return fmt.Sprintf("UpdateChatHasProtectedContent%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatHasProtectedContent) TypeID() uint32 { - return UpdateChatHasProtectedContentTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatHasProtectedContent) TypeName() string { - return "updateChatHasProtectedContent" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatHasProtectedContent) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatHasProtectedContent", - ID: UpdateChatHasProtectedContentTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "HasProtectedContent", - SchemaName: "has_protected_content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatHasProtectedContent) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatHasProtectedContent#6b50071b as nil") - } - b.PutID(UpdateChatHasProtectedContentTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatHasProtectedContent) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatHasProtectedContent#6b50071b as nil") - } - b.PutInt53(u.ChatID) - b.PutBool(u.HasProtectedContent) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatHasProtectedContent) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatHasProtectedContent#6b50071b to nil") - } - if err := b.ConsumeID(UpdateChatHasProtectedContentTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatHasProtectedContent) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatHasProtectedContent#6b50071b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field has_protected_content: %w", err) - } - u.HasProtectedContent = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatHasProtectedContent) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatHasProtectedContent#6b50071b as nil") - } - b.ObjStart() - b.PutID("updateChatHasProtectedContent") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("has_protected_content") - b.PutBool(u.HasProtectedContent) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatHasProtectedContent) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatHasProtectedContent#6b50071b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatHasProtectedContent"); err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field chat_id: %w", err) - } - u.ChatID = value - case "has_protected_content": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasProtectedContent#6b50071b: field has_protected_content: %w", err) - } - u.HasProtectedContent = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatHasProtectedContent) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetHasProtectedContent returns value of HasProtectedContent field. -func (u *UpdateChatHasProtectedContent) GetHasProtectedContent() (value bool) { - if u == nil { - return - } - return u.HasProtectedContent -} - -// UpdateChatIsTranslatable represents TL type `updateChatIsTranslatable#7b031617`. -type UpdateChatIsTranslatable struct { - // Chat identifier - ChatID int64 - // New value of is_translatable - IsTranslatable bool -} - -// UpdateChatIsTranslatableTypeID is TL type id of UpdateChatIsTranslatable. -const UpdateChatIsTranslatableTypeID = 0x7b031617 - -// construct implements constructor of UpdateClass. -func (u UpdateChatIsTranslatable) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatIsTranslatable. -var ( - _ bin.Encoder = &UpdateChatIsTranslatable{} - _ bin.Decoder = &UpdateChatIsTranslatable{} - _ bin.BareEncoder = &UpdateChatIsTranslatable{} - _ bin.BareDecoder = &UpdateChatIsTranslatable{} - - _ UpdateClass = &UpdateChatIsTranslatable{} -) - -func (u *UpdateChatIsTranslatable) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.IsTranslatable == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatIsTranslatable) String() string { - if u == nil { - return "UpdateChatIsTranslatable(nil)" - } - type Alias UpdateChatIsTranslatable - return fmt.Sprintf("UpdateChatIsTranslatable%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatIsTranslatable) TypeID() uint32 { - return UpdateChatIsTranslatableTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatIsTranslatable) TypeName() string { - return "updateChatIsTranslatable" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatIsTranslatable) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatIsTranslatable", - ID: UpdateChatIsTranslatableTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "IsTranslatable", - SchemaName: "is_translatable", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatIsTranslatable) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatIsTranslatable#7b031617 as nil") - } - b.PutID(UpdateChatIsTranslatableTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatIsTranslatable) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatIsTranslatable#7b031617 as nil") - } - b.PutInt53(u.ChatID) - b.PutBool(u.IsTranslatable) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatIsTranslatable) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatIsTranslatable#7b031617 to nil") - } - if err := b.ConsumeID(UpdateChatIsTranslatableTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatIsTranslatable) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatIsTranslatable#7b031617 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: field is_translatable: %w", err) - } - u.IsTranslatable = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatIsTranslatable) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatIsTranslatable#7b031617 as nil") - } - b.ObjStart() - b.PutID("updateChatIsTranslatable") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("is_translatable") - b.PutBool(u.IsTranslatable) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatIsTranslatable) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatIsTranslatable#7b031617 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatIsTranslatable"); err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: field chat_id: %w", err) - } - u.ChatID = value - case "is_translatable": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatIsTranslatable#7b031617: field is_translatable: %w", err) - } - u.IsTranslatable = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatIsTranslatable) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetIsTranslatable returns value of IsTranslatable field. -func (u *UpdateChatIsTranslatable) GetIsTranslatable() (value bool) { - if u == nil { - return - } - return u.IsTranslatable -} - -// UpdateChatIsMarkedAsUnread represents TL type `updateChatIsMarkedAsUnread#57853334`. -type UpdateChatIsMarkedAsUnread struct { - // Chat identifier - ChatID int64 - // New value of is_marked_as_unread - IsMarkedAsUnread bool -} - -// UpdateChatIsMarkedAsUnreadTypeID is TL type id of UpdateChatIsMarkedAsUnread. -const UpdateChatIsMarkedAsUnreadTypeID = 0x57853334 - -// construct implements constructor of UpdateClass. -func (u UpdateChatIsMarkedAsUnread) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatIsMarkedAsUnread. -var ( - _ bin.Encoder = &UpdateChatIsMarkedAsUnread{} - _ bin.Decoder = &UpdateChatIsMarkedAsUnread{} - _ bin.BareEncoder = &UpdateChatIsMarkedAsUnread{} - _ bin.BareDecoder = &UpdateChatIsMarkedAsUnread{} - - _ UpdateClass = &UpdateChatIsMarkedAsUnread{} -) - -func (u *UpdateChatIsMarkedAsUnread) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.IsMarkedAsUnread == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatIsMarkedAsUnread) String() string { - if u == nil { - return "UpdateChatIsMarkedAsUnread(nil)" - } - type Alias UpdateChatIsMarkedAsUnread - return fmt.Sprintf("UpdateChatIsMarkedAsUnread%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatIsMarkedAsUnread) TypeID() uint32 { - return UpdateChatIsMarkedAsUnreadTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatIsMarkedAsUnread) TypeName() string { - return "updateChatIsMarkedAsUnread" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatIsMarkedAsUnread) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatIsMarkedAsUnread", - ID: UpdateChatIsMarkedAsUnreadTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "IsMarkedAsUnread", - SchemaName: "is_marked_as_unread", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatIsMarkedAsUnread) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatIsMarkedAsUnread#57853334 as nil") - } - b.PutID(UpdateChatIsMarkedAsUnreadTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatIsMarkedAsUnread) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatIsMarkedAsUnread#57853334 as nil") - } - b.PutInt53(u.ChatID) - b.PutBool(u.IsMarkedAsUnread) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatIsMarkedAsUnread) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatIsMarkedAsUnread#57853334 to nil") - } - if err := b.ConsumeID(UpdateChatIsMarkedAsUnreadTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatIsMarkedAsUnread) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatIsMarkedAsUnread#57853334 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field is_marked_as_unread: %w", err) - } - u.IsMarkedAsUnread = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatIsMarkedAsUnread) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatIsMarkedAsUnread#57853334 as nil") - } - b.ObjStart() - b.PutID("updateChatIsMarkedAsUnread") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("is_marked_as_unread") - b.PutBool(u.IsMarkedAsUnread) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatIsMarkedAsUnread) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatIsMarkedAsUnread#57853334 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatIsMarkedAsUnread"); err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field chat_id: %w", err) - } - u.ChatID = value - case "is_marked_as_unread": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatIsMarkedAsUnread#57853334: field is_marked_as_unread: %w", err) - } - u.IsMarkedAsUnread = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatIsMarkedAsUnread) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetIsMarkedAsUnread returns value of IsMarkedAsUnread field. -func (u *UpdateChatIsMarkedAsUnread) GetIsMarkedAsUnread() (value bool) { - if u == nil { - return - } - return u.IsMarkedAsUnread -} - -// UpdateChatViewAsTopics represents TL type `updateChatViewAsTopics#5bff163d`. -type UpdateChatViewAsTopics struct { - // Chat identifier - ChatID int64 - // New value of view_as_topics - ViewAsTopics bool -} - -// UpdateChatViewAsTopicsTypeID is TL type id of UpdateChatViewAsTopics. -const UpdateChatViewAsTopicsTypeID = 0x5bff163d - -// construct implements constructor of UpdateClass. -func (u UpdateChatViewAsTopics) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatViewAsTopics. -var ( - _ bin.Encoder = &UpdateChatViewAsTopics{} - _ bin.Decoder = &UpdateChatViewAsTopics{} - _ bin.BareEncoder = &UpdateChatViewAsTopics{} - _ bin.BareDecoder = &UpdateChatViewAsTopics{} - - _ UpdateClass = &UpdateChatViewAsTopics{} -) - -func (u *UpdateChatViewAsTopics) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.ViewAsTopics == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatViewAsTopics) String() string { - if u == nil { - return "UpdateChatViewAsTopics(nil)" - } - type Alias UpdateChatViewAsTopics - return fmt.Sprintf("UpdateChatViewAsTopics%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatViewAsTopics) TypeID() uint32 { - return UpdateChatViewAsTopicsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatViewAsTopics) TypeName() string { - return "updateChatViewAsTopics" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatViewAsTopics) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatViewAsTopics", - ID: UpdateChatViewAsTopicsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ViewAsTopics", - SchemaName: "view_as_topics", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatViewAsTopics) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatViewAsTopics#5bff163d as nil") - } - b.PutID(UpdateChatViewAsTopicsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatViewAsTopics) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatViewAsTopics#5bff163d as nil") - } - b.PutInt53(u.ChatID) - b.PutBool(u.ViewAsTopics) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatViewAsTopics) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatViewAsTopics#5bff163d to nil") - } - if err := b.ConsumeID(UpdateChatViewAsTopicsTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatViewAsTopics) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatViewAsTopics#5bff163d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: field view_as_topics: %w", err) - } - u.ViewAsTopics = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatViewAsTopics) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatViewAsTopics#5bff163d as nil") - } - b.ObjStart() - b.PutID("updateChatViewAsTopics") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("view_as_topics") - b.PutBool(u.ViewAsTopics) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatViewAsTopics) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatViewAsTopics#5bff163d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatViewAsTopics"); err != nil { - return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: field chat_id: %w", err) - } - u.ChatID = value - case "view_as_topics": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatViewAsTopics#5bff163d: field view_as_topics: %w", err) - } - u.ViewAsTopics = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatViewAsTopics) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetViewAsTopics returns value of ViewAsTopics field. -func (u *UpdateChatViewAsTopics) GetViewAsTopics() (value bool) { - if u == nil { - return - } - return u.ViewAsTopics -} - -// UpdateChatBlockList represents TL type `updateChatBlockList#872af48e`. -type UpdateChatBlockList struct { - // Chat identifier - ChatID int64 - // Block list to which the chat is added; may be null if none - BlockList BlockListClass -} - -// UpdateChatBlockListTypeID is TL type id of UpdateChatBlockList. -const UpdateChatBlockListTypeID = 0x872af48e - -// construct implements constructor of UpdateClass. -func (u UpdateChatBlockList) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatBlockList. -var ( - _ bin.Encoder = &UpdateChatBlockList{} - _ bin.Decoder = &UpdateChatBlockList{} - _ bin.BareEncoder = &UpdateChatBlockList{} - _ bin.BareDecoder = &UpdateChatBlockList{} - - _ UpdateClass = &UpdateChatBlockList{} -) - -func (u *UpdateChatBlockList) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.BlockList == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatBlockList) String() string { - if u == nil { - return "UpdateChatBlockList(nil)" - } - type Alias UpdateChatBlockList - return fmt.Sprintf("UpdateChatBlockList%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatBlockList) TypeID() uint32 { - return UpdateChatBlockListTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatBlockList) TypeName() string { - return "updateChatBlockList" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatBlockList) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatBlockList", - ID: UpdateChatBlockListTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "BlockList", - SchemaName: "block_list", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatBlockList) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBlockList#872af48e as nil") - } - b.PutID(UpdateChatBlockListTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatBlockList) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBlockList#872af48e as nil") - } - b.PutInt53(u.ChatID) - if u.BlockList == nil { - return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list is nil") - } - if err := u.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatBlockList) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBlockList#872af48e to nil") - } - if err := b.ConsumeID(UpdateChatBlockListTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatBlockList) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBlockList#872af48e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := DecodeBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field block_list: %w", err) - } - u.BlockList = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatBlockList) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBlockList#872af48e as nil") - } - b.ObjStart() - b.PutID("updateChatBlockList") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("block_list") - if u.BlockList == nil { - return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list is nil") - } - if err := u.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatBlockList#872af48e: field block_list: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatBlockList) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBlockList#872af48e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatBlockList"); err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field chat_id: %w", err) - } - u.ChatID = value - case "block_list": - value, err := DecodeTDLibJSONBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatBlockList#872af48e: field block_list: %w", err) - } - u.BlockList = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatBlockList) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetBlockList returns value of BlockList field. -func (u *UpdateChatBlockList) GetBlockList() (value BlockListClass) { - if u == nil { - return - } - return u.BlockList -} - -// UpdateChatHasScheduledMessages represents TL type `updateChatHasScheduledMessages#7b14c2d7`. -type UpdateChatHasScheduledMessages struct { - // Chat identifier - ChatID int64 - // New value of has_scheduled_messages - HasScheduledMessages bool -} - -// UpdateChatHasScheduledMessagesTypeID is TL type id of UpdateChatHasScheduledMessages. -const UpdateChatHasScheduledMessagesTypeID = 0x7b14c2d7 - -// construct implements constructor of UpdateClass. -func (u UpdateChatHasScheduledMessages) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatHasScheduledMessages. -var ( - _ bin.Encoder = &UpdateChatHasScheduledMessages{} - _ bin.Decoder = &UpdateChatHasScheduledMessages{} - _ bin.BareEncoder = &UpdateChatHasScheduledMessages{} - _ bin.BareDecoder = &UpdateChatHasScheduledMessages{} - - _ UpdateClass = &UpdateChatHasScheduledMessages{} -) - -func (u *UpdateChatHasScheduledMessages) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.HasScheduledMessages == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatHasScheduledMessages) String() string { - if u == nil { - return "UpdateChatHasScheduledMessages(nil)" - } - type Alias UpdateChatHasScheduledMessages - return fmt.Sprintf("UpdateChatHasScheduledMessages%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatHasScheduledMessages) TypeID() uint32 { - return UpdateChatHasScheduledMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatHasScheduledMessages) TypeName() string { - return "updateChatHasScheduledMessages" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatHasScheduledMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatHasScheduledMessages", - ID: UpdateChatHasScheduledMessagesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "HasScheduledMessages", - SchemaName: "has_scheduled_messages", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatHasScheduledMessages) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatHasScheduledMessages#7b14c2d7 as nil") - } - b.PutID(UpdateChatHasScheduledMessagesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatHasScheduledMessages) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatHasScheduledMessages#7b14c2d7 as nil") - } - b.PutInt53(u.ChatID) - b.PutBool(u.HasScheduledMessages) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatHasScheduledMessages) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatHasScheduledMessages#7b14c2d7 to nil") - } - if err := b.ConsumeID(UpdateChatHasScheduledMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatHasScheduledMessages) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatHasScheduledMessages#7b14c2d7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field has_scheduled_messages: %w", err) - } - u.HasScheduledMessages = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatHasScheduledMessages) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatHasScheduledMessages#7b14c2d7 as nil") - } - b.ObjStart() - b.PutID("updateChatHasScheduledMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("has_scheduled_messages") - b.PutBool(u.HasScheduledMessages) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatHasScheduledMessages) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatHasScheduledMessages#7b14c2d7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatHasScheduledMessages"); err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field chat_id: %w", err) - } - u.ChatID = value - case "has_scheduled_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatHasScheduledMessages#7b14c2d7: field has_scheduled_messages: %w", err) - } - u.HasScheduledMessages = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatHasScheduledMessages) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetHasScheduledMessages returns value of HasScheduledMessages field. -func (u *UpdateChatHasScheduledMessages) GetHasScheduledMessages() (value bool) { - if u == nil { - return - } - return u.HasScheduledMessages -} - -// UpdateChatFolders represents TL type `updateChatFolders#e110242a`. -type UpdateChatFolders struct { - // The new list of chat folders - ChatFolders []ChatFolderInfo - // Position of the main chat list among chat folders, 0-based - MainChatListPosition int32 - // True, if folder tags are enabled - AreTagsEnabled bool -} - -// UpdateChatFoldersTypeID is TL type id of UpdateChatFolders. -const UpdateChatFoldersTypeID = 0xe110242a - -// construct implements constructor of UpdateClass. -func (u UpdateChatFolders) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatFolders. -var ( - _ bin.Encoder = &UpdateChatFolders{} - _ bin.Decoder = &UpdateChatFolders{} - _ bin.BareEncoder = &UpdateChatFolders{} - _ bin.BareDecoder = &UpdateChatFolders{} - - _ UpdateClass = &UpdateChatFolders{} -) - -func (u *UpdateChatFolders) Zero() bool { - if u == nil { - return true - } - if !(u.ChatFolders == nil) { - return false - } - if !(u.MainChatListPosition == 0) { - return false - } - if !(u.AreTagsEnabled == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatFolders) String() string { - if u == nil { - return "UpdateChatFolders(nil)" - } - type Alias UpdateChatFolders - return fmt.Sprintf("UpdateChatFolders%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatFolders) TypeID() uint32 { - return UpdateChatFoldersTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatFolders) TypeName() string { - return "updateChatFolders" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatFolders) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatFolders", - ID: UpdateChatFoldersTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatFolders", - SchemaName: "chat_folders", - }, - { - Name: "MainChatListPosition", - SchemaName: "main_chat_list_position", - }, - { - Name: "AreTagsEnabled", - SchemaName: "are_tags_enabled", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatFolders) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatFolders#e110242a as nil") - } - b.PutID(UpdateChatFoldersTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatFolders) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatFolders#e110242a as nil") - } - b.PutInt(len(u.ChatFolders)) - for idx, v := range u.ChatFolders { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateChatFolders#e110242a: field chat_folders element with index %d: %w", idx, err) - } - } - b.PutInt32(u.MainChatListPosition) - b.PutBool(u.AreTagsEnabled) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatFolders) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatFolders#e110242a to nil") - } - if err := b.ConsumeID(UpdateChatFoldersTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatFolders#e110242a: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatFolders) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatFolders#e110242a to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateChatFolders#e110242a: field chat_folders: %w", err) - } - - if headerLen > 0 { - u.ChatFolders = make([]ChatFolderInfo, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatFolderInfo - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateChatFolders#e110242a: field chat_folders: %w", err) - } - u.ChatFolders = append(u.ChatFolders, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatFolders#e110242a: field main_chat_list_position: %w", err) - } - u.MainChatListPosition = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatFolders#e110242a: field are_tags_enabled: %w", err) - } - u.AreTagsEnabled = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatFolders) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatFolders#e110242a as nil") - } - b.ObjStart() - b.PutID("updateChatFolders") - b.Comma() - b.FieldStart("chat_folders") - b.ArrStart() - for idx, v := range u.ChatFolders { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatFolders#e110242a: field chat_folders element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("main_chat_list_position") - b.PutInt32(u.MainChatListPosition) - b.Comma() - b.FieldStart("are_tags_enabled") - b.PutBool(u.AreTagsEnabled) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatFolders) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatFolders#e110242a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatFolders"); err != nil { - return fmt.Errorf("unable to decode updateChatFolders#e110242a: %w", err) - } - case "chat_folders": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatFolderInfo - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatFolders#e110242a: field chat_folders: %w", err) - } - u.ChatFolders = append(u.ChatFolders, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateChatFolders#e110242a: field chat_folders: %w", err) - } - case "main_chat_list_position": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatFolders#e110242a: field main_chat_list_position: %w", err) - } - u.MainChatListPosition = value - case "are_tags_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatFolders#e110242a: field are_tags_enabled: %w", err) - } - u.AreTagsEnabled = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatFolders returns value of ChatFolders field. -func (u *UpdateChatFolders) GetChatFolders() (value []ChatFolderInfo) { - if u == nil { - return - } - return u.ChatFolders -} - -// GetMainChatListPosition returns value of MainChatListPosition field. -func (u *UpdateChatFolders) GetMainChatListPosition() (value int32) { - if u == nil { - return - } - return u.MainChatListPosition -} - -// GetAreTagsEnabled returns value of AreTagsEnabled field. -func (u *UpdateChatFolders) GetAreTagsEnabled() (value bool) { - if u == nil { - return - } - return u.AreTagsEnabled -} - -// UpdateChatOnlineMemberCount represents TL type `updateChatOnlineMemberCount#1d0caa9d`. -type UpdateChatOnlineMemberCount struct { - // Identifier of the chat - ChatID int64 - // New number of online members in the chat, or 0 if unknown - OnlineMemberCount int32 -} - -// UpdateChatOnlineMemberCountTypeID is TL type id of UpdateChatOnlineMemberCount. -const UpdateChatOnlineMemberCountTypeID = 0x1d0caa9d - -// construct implements constructor of UpdateClass. -func (u UpdateChatOnlineMemberCount) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatOnlineMemberCount. -var ( - _ bin.Encoder = &UpdateChatOnlineMemberCount{} - _ bin.Decoder = &UpdateChatOnlineMemberCount{} - _ bin.BareEncoder = &UpdateChatOnlineMemberCount{} - _ bin.BareDecoder = &UpdateChatOnlineMemberCount{} - - _ UpdateClass = &UpdateChatOnlineMemberCount{} -) - -func (u *UpdateChatOnlineMemberCount) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.OnlineMemberCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatOnlineMemberCount) String() string { - if u == nil { - return "UpdateChatOnlineMemberCount(nil)" - } - type Alias UpdateChatOnlineMemberCount - return fmt.Sprintf("UpdateChatOnlineMemberCount%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatOnlineMemberCount) TypeID() uint32 { - return UpdateChatOnlineMemberCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatOnlineMemberCount) TypeName() string { - return "updateChatOnlineMemberCount" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatOnlineMemberCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatOnlineMemberCount", - ID: UpdateChatOnlineMemberCountTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "OnlineMemberCount", - SchemaName: "online_member_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatOnlineMemberCount) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatOnlineMemberCount#1d0caa9d as nil") - } - b.PutID(UpdateChatOnlineMemberCountTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatOnlineMemberCount) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatOnlineMemberCount#1d0caa9d as nil") - } - b.PutInt53(u.ChatID) - b.PutInt32(u.OnlineMemberCount) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatOnlineMemberCount) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatOnlineMemberCount#1d0caa9d to nil") - } - if err := b.ConsumeID(UpdateChatOnlineMemberCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatOnlineMemberCount) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatOnlineMemberCount#1d0caa9d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field online_member_count: %w", err) - } - u.OnlineMemberCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatOnlineMemberCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatOnlineMemberCount#1d0caa9d as nil") - } - b.ObjStart() - b.PutID("updateChatOnlineMemberCount") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("online_member_count") - b.PutInt32(u.OnlineMemberCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatOnlineMemberCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatOnlineMemberCount#1d0caa9d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatOnlineMemberCount"); err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field chat_id: %w", err) - } - u.ChatID = value - case "online_member_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatOnlineMemberCount#1d0caa9d: field online_member_count: %w", err) - } - u.OnlineMemberCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatOnlineMemberCount) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetOnlineMemberCount returns value of OnlineMemberCount field. -func (u *UpdateChatOnlineMemberCount) GetOnlineMemberCount() (value int32) { - if u == nil { - return - } - return u.OnlineMemberCount -} - -// UpdateSavedMessagesTopic represents TL type `updateSavedMessagesTopic#9f823b30`. -type UpdateSavedMessagesTopic struct { - // New data about the topic - Topic SavedMessagesTopic -} - -// UpdateSavedMessagesTopicTypeID is TL type id of UpdateSavedMessagesTopic. -const UpdateSavedMessagesTopicTypeID = 0x9f823b30 - -// construct implements constructor of UpdateClass. -func (u UpdateSavedMessagesTopic) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateSavedMessagesTopic. -var ( - _ bin.Encoder = &UpdateSavedMessagesTopic{} - _ bin.Decoder = &UpdateSavedMessagesTopic{} - _ bin.BareEncoder = &UpdateSavedMessagesTopic{} - _ bin.BareDecoder = &UpdateSavedMessagesTopic{} - - _ UpdateClass = &UpdateSavedMessagesTopic{} -) - -func (u *UpdateSavedMessagesTopic) Zero() bool { - if u == nil { - return true - } - if !(u.Topic.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateSavedMessagesTopic) String() string { - if u == nil { - return "UpdateSavedMessagesTopic(nil)" - } - type Alias UpdateSavedMessagesTopic - return fmt.Sprintf("UpdateSavedMessagesTopic%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSavedMessagesTopic) TypeID() uint32 { - return UpdateSavedMessagesTopicTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateSavedMessagesTopic) TypeName() string { - return "updateSavedMessagesTopic" -} - -// TypeInfo returns info about TL type. -func (u *UpdateSavedMessagesTopic) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateSavedMessagesTopic", - ID: UpdateSavedMessagesTopicTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Topic", - SchemaName: "topic", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateSavedMessagesTopic) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") - } - b.PutID(UpdateSavedMessagesTopicTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateSavedMessagesTopic) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") - } - if err := u.Topic.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateSavedMessagesTopic#9f823b30: field topic: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateSavedMessagesTopic) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") - } - if err := b.ConsumeID(UpdateSavedMessagesTopicTypeID); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateSavedMessagesTopic) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") - } - { - if err := u.Topic.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: field topic: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSavedMessagesTopic) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopic#9f823b30 as nil") - } - b.ObjStart() - b.PutID("updateSavedMessagesTopic") - b.Comma() - b.FieldStart("topic") - if err := u.Topic.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateSavedMessagesTopic#9f823b30: field topic: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSavedMessagesTopic) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopic#9f823b30 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateSavedMessagesTopic"); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: %w", err) - } - case "topic": - if err := u.Topic.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopic#9f823b30: field topic: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTopic returns value of Topic field. -func (u *UpdateSavedMessagesTopic) GetTopic() (value SavedMessagesTopic) { - if u == nil { - return - } - return u.Topic -} - -// UpdateSavedMessagesTopicCount represents TL type `updateSavedMessagesTopicCount#fbd279d1`. -type UpdateSavedMessagesTopicCount struct { - // Approximate total number of Saved Messages topics - TopicCount int32 -} - -// UpdateSavedMessagesTopicCountTypeID is TL type id of UpdateSavedMessagesTopicCount. -const UpdateSavedMessagesTopicCountTypeID = 0xfbd279d1 - -// construct implements constructor of UpdateClass. -func (u UpdateSavedMessagesTopicCount) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateSavedMessagesTopicCount. -var ( - _ bin.Encoder = &UpdateSavedMessagesTopicCount{} - _ bin.Decoder = &UpdateSavedMessagesTopicCount{} - _ bin.BareEncoder = &UpdateSavedMessagesTopicCount{} - _ bin.BareDecoder = &UpdateSavedMessagesTopicCount{} - - _ UpdateClass = &UpdateSavedMessagesTopicCount{} -) - -func (u *UpdateSavedMessagesTopicCount) Zero() bool { - if u == nil { - return true - } - if !(u.TopicCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateSavedMessagesTopicCount) String() string { - if u == nil { - return "UpdateSavedMessagesTopicCount(nil)" - } - type Alias UpdateSavedMessagesTopicCount - return fmt.Sprintf("UpdateSavedMessagesTopicCount%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSavedMessagesTopicCount) TypeID() uint32 { - return UpdateSavedMessagesTopicCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateSavedMessagesTopicCount) TypeName() string { - return "updateSavedMessagesTopicCount" -} - -// TypeInfo returns info about TL type. -func (u *UpdateSavedMessagesTopicCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateSavedMessagesTopicCount", - ID: UpdateSavedMessagesTopicCountTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TopicCount", - SchemaName: "topic_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateSavedMessagesTopicCount) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") - } - b.PutID(UpdateSavedMessagesTopicCountTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateSavedMessagesTopicCount) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") - } - b.PutInt32(u.TopicCount) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateSavedMessagesTopicCount) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") - } - if err := b.ConsumeID(UpdateSavedMessagesTopicCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateSavedMessagesTopicCount) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: field topic_count: %w", err) - } - u.TopicCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSavedMessagesTopicCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTopicCount#fbd279d1 as nil") - } - b.ObjStart() - b.PutID("updateSavedMessagesTopicCount") - b.Comma() - b.FieldStart("topic_count") - b.PutInt32(u.TopicCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSavedMessagesTopicCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTopicCount#fbd279d1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateSavedMessagesTopicCount"); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: %w", err) - } - case "topic_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTopicCount#fbd279d1: field topic_count: %w", err) - } - u.TopicCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTopicCount returns value of TopicCount field. -func (u *UpdateSavedMessagesTopicCount) GetTopicCount() (value int32) { - if u == nil { - return - } - return u.TopicCount -} - -// UpdateQuickReplyShortcut represents TL type `updateQuickReplyShortcut#c69338cf`. -type UpdateQuickReplyShortcut struct { - // New data about the shortcut - Shortcut QuickReplyShortcut -} - -// UpdateQuickReplyShortcutTypeID is TL type id of UpdateQuickReplyShortcut. -const UpdateQuickReplyShortcutTypeID = 0xc69338cf - -// construct implements constructor of UpdateClass. -func (u UpdateQuickReplyShortcut) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateQuickReplyShortcut. -var ( - _ bin.Encoder = &UpdateQuickReplyShortcut{} - _ bin.Decoder = &UpdateQuickReplyShortcut{} - _ bin.BareEncoder = &UpdateQuickReplyShortcut{} - _ bin.BareDecoder = &UpdateQuickReplyShortcut{} - - _ UpdateClass = &UpdateQuickReplyShortcut{} -) - -func (u *UpdateQuickReplyShortcut) Zero() bool { - if u == nil { - return true - } - if !(u.Shortcut.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateQuickReplyShortcut) String() string { - if u == nil { - return "UpdateQuickReplyShortcut(nil)" - } - type Alias UpdateQuickReplyShortcut - return fmt.Sprintf("UpdateQuickReplyShortcut%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateQuickReplyShortcut) TypeID() uint32 { - return UpdateQuickReplyShortcutTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateQuickReplyShortcut) TypeName() string { - return "updateQuickReplyShortcut" -} - -// TypeInfo returns info about TL type. -func (u *UpdateQuickReplyShortcut) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateQuickReplyShortcut", - ID: UpdateQuickReplyShortcutTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Shortcut", - SchemaName: "shortcut", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateQuickReplyShortcut) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcut#c69338cf as nil") - } - b.PutID(UpdateQuickReplyShortcutTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateQuickReplyShortcut) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcut#c69338cf as nil") - } - if err := u.Shortcut.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateQuickReplyShortcut#c69338cf: field shortcut: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateQuickReplyShortcut) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcut#c69338cf to nil") - } - if err := b.ConsumeID(UpdateQuickReplyShortcutTypeID); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcut#c69338cf: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateQuickReplyShortcut) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcut#c69338cf to nil") - } - { - if err := u.Shortcut.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcut#c69338cf: field shortcut: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateQuickReplyShortcut) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcut#c69338cf as nil") - } - b.ObjStart() - b.PutID("updateQuickReplyShortcut") - b.Comma() - b.FieldStart("shortcut") - if err := u.Shortcut.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateQuickReplyShortcut#c69338cf: field shortcut: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateQuickReplyShortcut) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcut#c69338cf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateQuickReplyShortcut"); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcut#c69338cf: %w", err) - } - case "shortcut": - if err := u.Shortcut.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcut#c69338cf: field shortcut: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcut returns value of Shortcut field. -func (u *UpdateQuickReplyShortcut) GetShortcut() (value QuickReplyShortcut) { - if u == nil { - return - } - return u.Shortcut -} - -// UpdateQuickReplyShortcutDeleted represents TL type `updateQuickReplyShortcutDeleted#e8b9bc3a`. -type UpdateQuickReplyShortcutDeleted struct { - // The identifier of the deleted shortcut - ShortcutID int32 -} - -// UpdateQuickReplyShortcutDeletedTypeID is TL type id of UpdateQuickReplyShortcutDeleted. -const UpdateQuickReplyShortcutDeletedTypeID = 0xe8b9bc3a - -// construct implements constructor of UpdateClass. -func (u UpdateQuickReplyShortcutDeleted) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateQuickReplyShortcutDeleted. -var ( - _ bin.Encoder = &UpdateQuickReplyShortcutDeleted{} - _ bin.Decoder = &UpdateQuickReplyShortcutDeleted{} - _ bin.BareEncoder = &UpdateQuickReplyShortcutDeleted{} - _ bin.BareDecoder = &UpdateQuickReplyShortcutDeleted{} - - _ UpdateClass = &UpdateQuickReplyShortcutDeleted{} -) - -func (u *UpdateQuickReplyShortcutDeleted) Zero() bool { - if u == nil { - return true - } - if !(u.ShortcutID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateQuickReplyShortcutDeleted) String() string { - if u == nil { - return "UpdateQuickReplyShortcutDeleted(nil)" - } - type Alias UpdateQuickReplyShortcutDeleted - return fmt.Sprintf("UpdateQuickReplyShortcutDeleted%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateQuickReplyShortcutDeleted) TypeID() uint32 { - return UpdateQuickReplyShortcutDeletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateQuickReplyShortcutDeleted) TypeName() string { - return "updateQuickReplyShortcutDeleted" -} - -// TypeInfo returns info about TL type. -func (u *UpdateQuickReplyShortcutDeleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateQuickReplyShortcutDeleted", - ID: UpdateQuickReplyShortcutDeletedTypeID, - } - 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 *UpdateQuickReplyShortcutDeleted) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcutDeleted#e8b9bc3a as nil") - } - b.PutID(UpdateQuickReplyShortcutDeletedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateQuickReplyShortcutDeleted) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcutDeleted#e8b9bc3a as nil") - } - b.PutInt32(u.ShortcutID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateQuickReplyShortcutDeleted) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcutDeleted#e8b9bc3a to nil") - } - if err := b.ConsumeID(UpdateQuickReplyShortcutDeletedTypeID); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcutDeleted#e8b9bc3a: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateQuickReplyShortcutDeleted) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcutDeleted#e8b9bc3a to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcutDeleted#e8b9bc3a: field shortcut_id: %w", err) - } - u.ShortcutID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateQuickReplyShortcutDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcutDeleted#e8b9bc3a as nil") - } - b.ObjStart() - b.PutID("updateQuickReplyShortcutDeleted") - b.Comma() - b.FieldStart("shortcut_id") - b.PutInt32(u.ShortcutID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateQuickReplyShortcutDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcutDeleted#e8b9bc3a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateQuickReplyShortcutDeleted"); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcutDeleted#e8b9bc3a: %w", err) - } - case "shortcut_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcutDeleted#e8b9bc3a: field shortcut_id: %w", err) - } - u.ShortcutID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutID returns value of ShortcutID field. -func (u *UpdateQuickReplyShortcutDeleted) GetShortcutID() (value int32) { - if u == nil { - return - } - return u.ShortcutID -} - -// UpdateQuickReplyShortcuts represents TL type `updateQuickReplyShortcuts#77d31a6a`. -type UpdateQuickReplyShortcuts struct { - // The new list of identifiers of quick reply shortcuts - ShortcutIDs []int32 -} - -// UpdateQuickReplyShortcutsTypeID is TL type id of UpdateQuickReplyShortcuts. -const UpdateQuickReplyShortcutsTypeID = 0x77d31a6a - -// construct implements constructor of UpdateClass. -func (u UpdateQuickReplyShortcuts) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateQuickReplyShortcuts. -var ( - _ bin.Encoder = &UpdateQuickReplyShortcuts{} - _ bin.Decoder = &UpdateQuickReplyShortcuts{} - _ bin.BareEncoder = &UpdateQuickReplyShortcuts{} - _ bin.BareDecoder = &UpdateQuickReplyShortcuts{} - - _ UpdateClass = &UpdateQuickReplyShortcuts{} -) - -func (u *UpdateQuickReplyShortcuts) Zero() bool { - if u == nil { - return true - } - if !(u.ShortcutIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateQuickReplyShortcuts) String() string { - if u == nil { - return "UpdateQuickReplyShortcuts(nil)" - } - type Alias UpdateQuickReplyShortcuts - return fmt.Sprintf("UpdateQuickReplyShortcuts%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateQuickReplyShortcuts) TypeID() uint32 { - return UpdateQuickReplyShortcutsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateQuickReplyShortcuts) TypeName() string { - return "updateQuickReplyShortcuts" -} - -// TypeInfo returns info about TL type. -func (u *UpdateQuickReplyShortcuts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateQuickReplyShortcuts", - ID: UpdateQuickReplyShortcutsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortcutIDs", - SchemaName: "shortcut_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateQuickReplyShortcuts) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcuts#77d31a6a as nil") - } - b.PutID(UpdateQuickReplyShortcutsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateQuickReplyShortcuts) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcuts#77d31a6a as nil") - } - b.PutInt(len(u.ShortcutIDs)) - for _, v := range u.ShortcutIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateQuickReplyShortcuts) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcuts#77d31a6a to nil") - } - if err := b.ConsumeID(UpdateQuickReplyShortcutsTypeID); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcuts#77d31a6a: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateQuickReplyShortcuts) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcuts#77d31a6a to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcuts#77d31a6a: field shortcut_ids: %w", err) - } - - if headerLen > 0 { - u.ShortcutIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcuts#77d31a6a: field shortcut_ids: %w", err) - } - u.ShortcutIDs = append(u.ShortcutIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateQuickReplyShortcuts) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcuts#77d31a6a as nil") - } - b.ObjStart() - b.PutID("updateQuickReplyShortcuts") - b.Comma() - b.FieldStart("shortcut_ids") - b.ArrStart() - for _, v := range u.ShortcutIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateQuickReplyShortcuts) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcuts#77d31a6a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateQuickReplyShortcuts"); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcuts#77d31a6a: %w", err) - } - case "shortcut_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcuts#77d31a6a: field shortcut_ids: %w", err) - } - u.ShortcutIDs = append(u.ShortcutIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcuts#77d31a6a: field shortcut_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutIDs returns value of ShortcutIDs field. -func (u *UpdateQuickReplyShortcuts) GetShortcutIDs() (value []int32) { - if u == nil { - return - } - return u.ShortcutIDs -} - -// UpdateQuickReplyShortcutMessages represents TL type `updateQuickReplyShortcutMessages#8bb36b72`. -type UpdateQuickReplyShortcutMessages struct { - // The identifier of the shortcut - ShortcutID int32 - // The new list of quick reply messages for the shortcut in order from the first to the - // last sent - Messages []QuickReplyMessage -} - -// UpdateQuickReplyShortcutMessagesTypeID is TL type id of UpdateQuickReplyShortcutMessages. -const UpdateQuickReplyShortcutMessagesTypeID = 0x8bb36b72 - -// construct implements constructor of UpdateClass. -func (u UpdateQuickReplyShortcutMessages) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateQuickReplyShortcutMessages. -var ( - _ bin.Encoder = &UpdateQuickReplyShortcutMessages{} - _ bin.Decoder = &UpdateQuickReplyShortcutMessages{} - _ bin.BareEncoder = &UpdateQuickReplyShortcutMessages{} - _ bin.BareDecoder = &UpdateQuickReplyShortcutMessages{} - - _ UpdateClass = &UpdateQuickReplyShortcutMessages{} -) - -func (u *UpdateQuickReplyShortcutMessages) 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 *UpdateQuickReplyShortcutMessages) String() string { - if u == nil { - return "UpdateQuickReplyShortcutMessages(nil)" - } - type Alias UpdateQuickReplyShortcutMessages - return fmt.Sprintf("UpdateQuickReplyShortcutMessages%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateQuickReplyShortcutMessages) TypeID() uint32 { - return UpdateQuickReplyShortcutMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateQuickReplyShortcutMessages) TypeName() string { - return "updateQuickReplyShortcutMessages" -} - -// TypeInfo returns info about TL type. -func (u *UpdateQuickReplyShortcutMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateQuickReplyShortcutMessages", - ID: UpdateQuickReplyShortcutMessagesTypeID, - } - 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 *UpdateQuickReplyShortcutMessages) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcutMessages#8bb36b72 as nil") - } - b.PutID(UpdateQuickReplyShortcutMessagesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateQuickReplyShortcutMessages) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcutMessages#8bb36b72 as nil") - } - b.PutInt32(u.ShortcutID) - b.PutInt(len(u.Messages)) - for idx, v := range u.Messages { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateQuickReplyShortcutMessages#8bb36b72: field messages element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateQuickReplyShortcutMessages) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcutMessages#8bb36b72 to nil") - } - if err := b.ConsumeID(UpdateQuickReplyShortcutMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateQuickReplyShortcutMessages) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcutMessages#8bb36b72 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: field shortcut_id: %w", err) - } - u.ShortcutID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: field messages: %w", err) - } - - if headerLen > 0 { - u.Messages = make([]QuickReplyMessage, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value QuickReplyMessage - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateQuickReplyShortcutMessages#8bb36b72: field messages: %w", err) - } - u.Messages = append(u.Messages, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateQuickReplyShortcutMessages) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateQuickReplyShortcutMessages#8bb36b72 as nil") - } - b.ObjStart() - b.PutID("updateQuickReplyShortcutMessages") - b.Comma() - b.FieldStart("shortcut_id") - b.PutInt32(u.ShortcutID) - b.Comma() - b.FieldStart("messages") - b.ArrStart() - for idx, v := range u.Messages { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateQuickReplyShortcutMessages#8bb36b72: field messages element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateQuickReplyShortcutMessages) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateQuickReplyShortcutMessages#8bb36b72 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateQuickReplyShortcutMessages"); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: %w", err) - } - case "shortcut_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: field shortcut_id: %w", err) - } - u.ShortcutID = value - case "messages": - if err := b.Arr(func(b tdjson.Decoder) error { - var value QuickReplyMessage - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: field messages: %w", err) - } - u.Messages = append(u.Messages, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateQuickReplyShortcutMessages#8bb36b72: field messages: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetShortcutID returns value of ShortcutID field. -func (u *UpdateQuickReplyShortcutMessages) GetShortcutID() (value int32) { - if u == nil { - return - } - return u.ShortcutID -} - -// GetMessages returns value of Messages field. -func (u *UpdateQuickReplyShortcutMessages) GetMessages() (value []QuickReplyMessage) { - if u == nil { - return - } - return u.Messages -} - -// UpdateForumTopicInfo represents TL type `updateForumTopicInfo#6b6f2cc9`. -type UpdateForumTopicInfo struct { - // Chat identifier - ChatID int64 - // New information about the topic - Info ForumTopicInfo -} - -// UpdateForumTopicInfoTypeID is TL type id of UpdateForumTopicInfo. -const UpdateForumTopicInfoTypeID = 0x6b6f2cc9 - -// construct implements constructor of UpdateClass. -func (u UpdateForumTopicInfo) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateForumTopicInfo. -var ( - _ bin.Encoder = &UpdateForumTopicInfo{} - _ bin.Decoder = &UpdateForumTopicInfo{} - _ bin.BareEncoder = &UpdateForumTopicInfo{} - _ bin.BareDecoder = &UpdateForumTopicInfo{} - - _ UpdateClass = &UpdateForumTopicInfo{} -) - -func (u *UpdateForumTopicInfo) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.Info.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateForumTopicInfo) String() string { - if u == nil { - return "UpdateForumTopicInfo(nil)" - } - type Alias UpdateForumTopicInfo - return fmt.Sprintf("UpdateForumTopicInfo%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateForumTopicInfo) TypeID() uint32 { - return UpdateForumTopicInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateForumTopicInfo) TypeName() string { - return "updateForumTopicInfo" -} - -// TypeInfo returns info about TL type. -func (u *UpdateForumTopicInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateForumTopicInfo", - ID: UpdateForumTopicInfoTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Info", - SchemaName: "info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateForumTopicInfo) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateForumTopicInfo#6b6f2cc9 as nil") - } - b.PutID(UpdateForumTopicInfoTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateForumTopicInfo) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateForumTopicInfo#6b6f2cc9 as nil") - } - b.PutInt53(u.ChatID) - if err := u.Info.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateForumTopicInfo#6b6f2cc9: field info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateForumTopicInfo) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateForumTopicInfo#6b6f2cc9 to nil") - } - if err := b.ConsumeID(UpdateForumTopicInfoTypeID); err != nil { - return fmt.Errorf("unable to decode updateForumTopicInfo#6b6f2cc9: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateForumTopicInfo) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateForumTopicInfo#6b6f2cc9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateForumTopicInfo#6b6f2cc9: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.Info.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateForumTopicInfo#6b6f2cc9: field info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateForumTopicInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateForumTopicInfo#6b6f2cc9 as nil") - } - b.ObjStart() - b.PutID("updateForumTopicInfo") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("info") - if err := u.Info.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateForumTopicInfo#6b6f2cc9: field info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateForumTopicInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateForumTopicInfo#6b6f2cc9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateForumTopicInfo"); err != nil { - return fmt.Errorf("unable to decode updateForumTopicInfo#6b6f2cc9: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateForumTopicInfo#6b6f2cc9: field chat_id: %w", err) - } - u.ChatID = value - case "info": - if err := u.Info.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateForumTopicInfo#6b6f2cc9: field info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateForumTopicInfo) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetInfo returns value of Info field. -func (u *UpdateForumTopicInfo) GetInfo() (value ForumTopicInfo) { - if u == nil { - return - } - return u.Info -} - -// UpdateScopeNotificationSettings represents TL type `updateScopeNotificationSettings#b83ccb73`. -type UpdateScopeNotificationSettings struct { - // Types of chats for which notification settings were updated - Scope NotificationSettingsScopeClass - // The new notification settings - NotificationSettings ScopeNotificationSettings -} - -// UpdateScopeNotificationSettingsTypeID is TL type id of UpdateScopeNotificationSettings. -const UpdateScopeNotificationSettingsTypeID = 0xb83ccb73 - -// construct implements constructor of UpdateClass. -func (u UpdateScopeNotificationSettings) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateScopeNotificationSettings. -var ( - _ bin.Encoder = &UpdateScopeNotificationSettings{} - _ bin.Decoder = &UpdateScopeNotificationSettings{} - _ bin.BareEncoder = &UpdateScopeNotificationSettings{} - _ bin.BareDecoder = &UpdateScopeNotificationSettings{} - - _ UpdateClass = &UpdateScopeNotificationSettings{} -) - -func (u *UpdateScopeNotificationSettings) Zero() bool { - if u == nil { - return true - } - if !(u.Scope == nil) { - return false - } - if !(u.NotificationSettings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateScopeNotificationSettings) String() string { - if u == nil { - return "UpdateScopeNotificationSettings(nil)" - } - type Alias UpdateScopeNotificationSettings - return fmt.Sprintf("UpdateScopeNotificationSettings%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateScopeNotificationSettings) TypeID() uint32 { - return UpdateScopeNotificationSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateScopeNotificationSettings) TypeName() string { - return "updateScopeNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (u *UpdateScopeNotificationSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateScopeNotificationSettings", - ID: UpdateScopeNotificationSettingsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Scope", - SchemaName: "scope", - }, - { - Name: "NotificationSettings", - SchemaName: "notification_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateScopeNotificationSettings) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateScopeNotificationSettings#b83ccb73 as nil") - } - b.PutID(UpdateScopeNotificationSettingsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateScopeNotificationSettings) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateScopeNotificationSettings#b83ccb73 as nil") - } - if u.Scope == nil { - return fmt.Errorf("unable to encode updateScopeNotificationSettings#b83ccb73: field scope is nil") - } - if err := u.Scope.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateScopeNotificationSettings#b83ccb73: field scope: %w", err) - } - if err := u.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateScopeNotificationSettings#b83ccb73: field notification_settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateScopeNotificationSettings) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateScopeNotificationSettings#b83ccb73 to nil") - } - if err := b.ConsumeID(UpdateScopeNotificationSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode updateScopeNotificationSettings#b83ccb73: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateScopeNotificationSettings) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateScopeNotificationSettings#b83ccb73 to nil") - } - { - value, err := DecodeNotificationSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode updateScopeNotificationSettings#b83ccb73: field scope: %w", err) - } - u.Scope = value - } - { - if err := u.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateScopeNotificationSettings#b83ccb73: field notification_settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateScopeNotificationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateScopeNotificationSettings#b83ccb73 as nil") - } - b.ObjStart() - b.PutID("updateScopeNotificationSettings") - b.Comma() - b.FieldStart("scope") - if u.Scope == nil { - return fmt.Errorf("unable to encode updateScopeNotificationSettings#b83ccb73: field scope is nil") - } - if err := u.Scope.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateScopeNotificationSettings#b83ccb73: field scope: %w", err) - } - b.Comma() - b.FieldStart("notification_settings") - if err := u.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateScopeNotificationSettings#b83ccb73: field notification_settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateScopeNotificationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateScopeNotificationSettings#b83ccb73 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateScopeNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode updateScopeNotificationSettings#b83ccb73: %w", err) - } - case "scope": - value, err := DecodeTDLibJSONNotificationSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode updateScopeNotificationSettings#b83ccb73: field scope: %w", err) - } - u.Scope = value - case "notification_settings": - if err := u.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateScopeNotificationSettings#b83ccb73: field notification_settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetScope returns value of Scope field. -func (u *UpdateScopeNotificationSettings) GetScope() (value NotificationSettingsScopeClass) { - if u == nil { - return - } - return u.Scope -} - -// GetNotificationSettings returns value of NotificationSettings field. -func (u *UpdateScopeNotificationSettings) GetNotificationSettings() (value ScopeNotificationSettings) { - if u == nil { - return - } - return u.NotificationSettings -} - -// UpdateReactionNotificationSettings represents TL type `updateReactionNotificationSettings#e54d17ec`. -type UpdateReactionNotificationSettings struct { - // The new notification settings - NotificationSettings ReactionNotificationSettings -} - -// UpdateReactionNotificationSettingsTypeID is TL type id of UpdateReactionNotificationSettings. -const UpdateReactionNotificationSettingsTypeID = 0xe54d17ec - -// construct implements constructor of UpdateClass. -func (u UpdateReactionNotificationSettings) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateReactionNotificationSettings. -var ( - _ bin.Encoder = &UpdateReactionNotificationSettings{} - _ bin.Decoder = &UpdateReactionNotificationSettings{} - _ bin.BareEncoder = &UpdateReactionNotificationSettings{} - _ bin.BareDecoder = &UpdateReactionNotificationSettings{} - - _ UpdateClass = &UpdateReactionNotificationSettings{} -) - -func (u *UpdateReactionNotificationSettings) Zero() bool { - if u == nil { - return true - } - if !(u.NotificationSettings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateReactionNotificationSettings) String() string { - if u == nil { - return "UpdateReactionNotificationSettings(nil)" - } - type Alias UpdateReactionNotificationSettings - return fmt.Sprintf("UpdateReactionNotificationSettings%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateReactionNotificationSettings) TypeID() uint32 { - return UpdateReactionNotificationSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateReactionNotificationSettings) TypeName() string { - return "updateReactionNotificationSettings" -} - -// TypeInfo returns info about TL type. -func (u *UpdateReactionNotificationSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateReactionNotificationSettings", - ID: UpdateReactionNotificationSettingsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NotificationSettings", - SchemaName: "notification_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateReactionNotificationSettings) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateReactionNotificationSettings#e54d17ec as nil") - } - b.PutID(UpdateReactionNotificationSettingsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateReactionNotificationSettings) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateReactionNotificationSettings#e54d17ec as nil") - } - if err := u.NotificationSettings.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateReactionNotificationSettings#e54d17ec: field notification_settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateReactionNotificationSettings) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateReactionNotificationSettings#e54d17ec to nil") - } - if err := b.ConsumeID(UpdateReactionNotificationSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode updateReactionNotificationSettings#e54d17ec: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateReactionNotificationSettings) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateReactionNotificationSettings#e54d17ec to nil") - } - { - if err := u.NotificationSettings.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateReactionNotificationSettings#e54d17ec: field notification_settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateReactionNotificationSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateReactionNotificationSettings#e54d17ec as nil") - } - b.ObjStart() - b.PutID("updateReactionNotificationSettings") - b.Comma() - b.FieldStart("notification_settings") - if err := u.NotificationSettings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateReactionNotificationSettings#e54d17ec: field notification_settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateReactionNotificationSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateReactionNotificationSettings#e54d17ec to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateReactionNotificationSettings"); err != nil { - return fmt.Errorf("unable to decode updateReactionNotificationSettings#e54d17ec: %w", err) - } - case "notification_settings": - if err := u.NotificationSettings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateReactionNotificationSettings#e54d17ec: field notification_settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetNotificationSettings returns value of NotificationSettings field. -func (u *UpdateReactionNotificationSettings) GetNotificationSettings() (value ReactionNotificationSettings) { - if u == nil { - return - } - return u.NotificationSettings -} - -// UpdateNotification represents TL type `updateNotification#8ee67ed4`. -type UpdateNotification struct { - // Unique notification group identifier - NotificationGroupID int32 - // Changed notification - Notification Notification -} - -// UpdateNotificationTypeID is TL type id of UpdateNotification. -const UpdateNotificationTypeID = 0x8ee67ed4 - -// construct implements constructor of UpdateClass. -func (u UpdateNotification) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNotification. -var ( - _ bin.Encoder = &UpdateNotification{} - _ bin.Decoder = &UpdateNotification{} - _ bin.BareEncoder = &UpdateNotification{} - _ bin.BareDecoder = &UpdateNotification{} - - _ UpdateClass = &UpdateNotification{} -) - -func (u *UpdateNotification) Zero() bool { - if u == nil { - return true - } - if !(u.NotificationGroupID == 0) { - return false - } - if !(u.Notification.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNotification) String() string { - if u == nil { - return "UpdateNotification(nil)" - } - type Alias UpdateNotification - return fmt.Sprintf("UpdateNotification%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNotification) TypeID() uint32 { - return UpdateNotificationTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNotification) TypeName() string { - return "updateNotification" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNotification) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNotification", - ID: UpdateNotificationTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NotificationGroupID", - SchemaName: "notification_group_id", - }, - { - Name: "Notification", - SchemaName: "notification", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNotification) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNotification#8ee67ed4 as nil") - } - b.PutID(UpdateNotificationTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNotification) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNotification#8ee67ed4 as nil") - } - b.PutInt32(u.NotificationGroupID) - if err := u.Notification.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNotification#8ee67ed4: field notification: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNotification) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNotification#8ee67ed4 to nil") - } - if err := b.ConsumeID(UpdateNotificationTypeID); err != nil { - return fmt.Errorf("unable to decode updateNotification#8ee67ed4: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNotification) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNotification#8ee67ed4 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNotification#8ee67ed4: field notification_group_id: %w", err) - } - u.NotificationGroupID = value - } - { - if err := u.Notification.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateNotification#8ee67ed4: field notification: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNotification) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNotification#8ee67ed4 as nil") - } - b.ObjStart() - b.PutID("updateNotification") - b.Comma() - b.FieldStart("notification_group_id") - b.PutInt32(u.NotificationGroupID) - b.Comma() - b.FieldStart("notification") - if err := u.Notification.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNotification#8ee67ed4: field notification: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNotification) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNotification#8ee67ed4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNotification"); err != nil { - return fmt.Errorf("unable to decode updateNotification#8ee67ed4: %w", err) - } - case "notification_group_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNotification#8ee67ed4: field notification_group_id: %w", err) - } - u.NotificationGroupID = value - case "notification": - if err := u.Notification.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNotification#8ee67ed4: field notification: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetNotificationGroupID returns value of NotificationGroupID field. -func (u *UpdateNotification) GetNotificationGroupID() (value int32) { - if u == nil { - return - } - return u.NotificationGroupID -} - -// GetNotification returns value of Notification field. -func (u *UpdateNotification) GetNotification() (value Notification) { - if u == nil { - return - } - return u.Notification -} - -// UpdateNotificationGroup represents TL type `updateNotificationGroup#96cd9e06`. -type UpdateNotificationGroup struct { - // Unique notification group identifier - NotificationGroupID int32 - // New type of the notification group - Type NotificationGroupTypeClass - // Identifier of a chat to which all notifications in the group belong - ChatID int64 - // Chat identifier, which notification settings must be applied to the added - // notifications - NotificationSettingsChatID int64 - // Identifier of the notification sound to be played; 0 if sound is disabled - NotificationSoundID int64 - // Total number of unread notifications in the group, can be bigger than number of active - // notifications - TotalCount int32 - // List of added group notifications, sorted by notification identifier - AddedNotifications []Notification - // Identifiers of removed group notifications, sorted by notification identifier - RemovedNotificationIDs []int32 -} - -// UpdateNotificationGroupTypeID is TL type id of UpdateNotificationGroup. -const UpdateNotificationGroupTypeID = 0x96cd9e06 - -// construct implements constructor of UpdateClass. -func (u UpdateNotificationGroup) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNotificationGroup. -var ( - _ bin.Encoder = &UpdateNotificationGroup{} - _ bin.Decoder = &UpdateNotificationGroup{} - _ bin.BareEncoder = &UpdateNotificationGroup{} - _ bin.BareDecoder = &UpdateNotificationGroup{} - - _ UpdateClass = &UpdateNotificationGroup{} -) - -func (u *UpdateNotificationGroup) Zero() bool { - if u == nil { - return true - } - if !(u.NotificationGroupID == 0) { - return false - } - if !(u.Type == nil) { - return false - } - if !(u.ChatID == 0) { - return false - } - if !(u.NotificationSettingsChatID == 0) { - return false - } - if !(u.NotificationSoundID == 0) { - return false - } - if !(u.TotalCount == 0) { - return false - } - if !(u.AddedNotifications == nil) { - return false - } - if !(u.RemovedNotificationIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNotificationGroup) String() string { - if u == nil { - return "UpdateNotificationGroup(nil)" - } - type Alias UpdateNotificationGroup - return fmt.Sprintf("UpdateNotificationGroup%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNotificationGroup) TypeID() uint32 { - return UpdateNotificationGroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNotificationGroup) TypeName() string { - return "updateNotificationGroup" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNotificationGroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNotificationGroup", - ID: UpdateNotificationGroupTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NotificationGroupID", - SchemaName: "notification_group_id", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "NotificationSettingsChatID", - SchemaName: "notification_settings_chat_id", - }, - { - Name: "NotificationSoundID", - SchemaName: "notification_sound_id", - }, - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "AddedNotifications", - SchemaName: "added_notifications", - }, - { - Name: "RemovedNotificationIDs", - SchemaName: "removed_notification_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNotificationGroup) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNotificationGroup#96cd9e06 as nil") - } - b.PutID(UpdateNotificationGroupTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNotificationGroup) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNotificationGroup#96cd9e06 as nil") - } - b.PutInt32(u.NotificationGroupID) - if u.Type == nil { - return fmt.Errorf("unable to encode updateNotificationGroup#96cd9e06: field type is nil") - } - if err := u.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNotificationGroup#96cd9e06: field type: %w", err) - } - b.PutInt53(u.ChatID) - b.PutInt53(u.NotificationSettingsChatID) - b.PutLong(u.NotificationSoundID) - b.PutInt32(u.TotalCount) - b.PutInt(len(u.AddedNotifications)) - for idx, v := range u.AddedNotifications { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateNotificationGroup#96cd9e06: field added_notifications element with index %d: %w", idx, err) - } - } - b.PutInt(len(u.RemovedNotificationIDs)) - for _, v := range u.RemovedNotificationIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNotificationGroup) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNotificationGroup#96cd9e06 to nil") - } - if err := b.ConsumeID(UpdateNotificationGroupTypeID); err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNotificationGroup) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNotificationGroup#96cd9e06 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field notification_group_id: %w", err) - } - u.NotificationGroupID = value - } - { - value, err := DecodeNotificationGroupType(b) - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field type: %w", err) - } - u.Type = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field notification_settings_chat_id: %w", err) - } - u.NotificationSettingsChatID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field notification_sound_id: %w", err) - } - u.NotificationSoundID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field total_count: %w", err) - } - u.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field added_notifications: %w", err) - } - - if headerLen > 0 { - u.AddedNotifications = make([]Notification, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Notification - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateNotificationGroup#96cd9e06: field added_notifications: %w", err) - } - u.AddedNotifications = append(u.AddedNotifications, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field removed_notification_ids: %w", err) - } - - if headerLen > 0 { - u.RemovedNotificationIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field removed_notification_ids: %w", err) - } - u.RemovedNotificationIDs = append(u.RemovedNotificationIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNotificationGroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNotificationGroup#96cd9e06 as nil") - } - b.ObjStart() - b.PutID("updateNotificationGroup") - b.Comma() - b.FieldStart("notification_group_id") - b.PutInt32(u.NotificationGroupID) - b.Comma() - b.FieldStart("type") - if u.Type == nil { - return fmt.Errorf("unable to encode updateNotificationGroup#96cd9e06: field type is nil") - } - if err := u.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNotificationGroup#96cd9e06: field type: %w", err) - } - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("notification_settings_chat_id") - b.PutInt53(u.NotificationSettingsChatID) - b.Comma() - b.FieldStart("notification_sound_id") - b.PutLong(u.NotificationSoundID) - b.Comma() - b.FieldStart("total_count") - b.PutInt32(u.TotalCount) - b.Comma() - b.FieldStart("added_notifications") - b.ArrStart() - for idx, v := range u.AddedNotifications { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNotificationGroup#96cd9e06: field added_notifications element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("removed_notification_ids") - b.ArrStart() - for _, v := range u.RemovedNotificationIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNotificationGroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNotificationGroup#96cd9e06 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNotificationGroup"); err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: %w", err) - } - case "notification_group_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field notification_group_id: %w", err) - } - u.NotificationGroupID = value - case "type": - value, err := DecodeTDLibJSONNotificationGroupType(b) - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field type: %w", err) - } - u.Type = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field chat_id: %w", err) - } - u.ChatID = value - case "notification_settings_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field notification_settings_chat_id: %w", err) - } - u.NotificationSettingsChatID = value - case "notification_sound_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field notification_sound_id: %w", err) - } - u.NotificationSoundID = value - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field total_count: %w", err) - } - u.TotalCount = value - case "added_notifications": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Notification - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field added_notifications: %w", err) - } - u.AddedNotifications = append(u.AddedNotifications, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field added_notifications: %w", err) - } - case "removed_notification_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field removed_notification_ids: %w", err) - } - u.RemovedNotificationIDs = append(u.RemovedNotificationIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateNotificationGroup#96cd9e06: field removed_notification_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetNotificationGroupID returns value of NotificationGroupID field. -func (u *UpdateNotificationGroup) GetNotificationGroupID() (value int32) { - if u == nil { - return - } - return u.NotificationGroupID -} - -// GetType returns value of Type field. -func (u *UpdateNotificationGroup) GetType() (value NotificationGroupTypeClass) { - if u == nil { - return - } - return u.Type -} - -// GetChatID returns value of ChatID field. -func (u *UpdateNotificationGroup) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetNotificationSettingsChatID returns value of NotificationSettingsChatID field. -func (u *UpdateNotificationGroup) GetNotificationSettingsChatID() (value int64) { - if u == nil { - return - } - return u.NotificationSettingsChatID -} - -// GetNotificationSoundID returns value of NotificationSoundID field. -func (u *UpdateNotificationGroup) GetNotificationSoundID() (value int64) { - if u == nil { - return - } - return u.NotificationSoundID -} - -// GetTotalCount returns value of TotalCount field. -func (u *UpdateNotificationGroup) GetTotalCount() (value int32) { - if u == nil { - return - } - return u.TotalCount -} - -// GetAddedNotifications returns value of AddedNotifications field. -func (u *UpdateNotificationGroup) GetAddedNotifications() (value []Notification) { - if u == nil { - return - } - return u.AddedNotifications -} - -// GetRemovedNotificationIDs returns value of RemovedNotificationIDs field. -func (u *UpdateNotificationGroup) GetRemovedNotificationIDs() (value []int32) { - if u == nil { - return - } - return u.RemovedNotificationIDs -} - -// UpdateActiveNotifications represents TL type `updateActiveNotifications#317d80f2`. -type UpdateActiveNotifications struct { - // Lists of active notification groups - Groups []NotificationGroup -} - -// UpdateActiveNotificationsTypeID is TL type id of UpdateActiveNotifications. -const UpdateActiveNotificationsTypeID = 0x317d80f2 - -// construct implements constructor of UpdateClass. -func (u UpdateActiveNotifications) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateActiveNotifications. -var ( - _ bin.Encoder = &UpdateActiveNotifications{} - _ bin.Decoder = &UpdateActiveNotifications{} - _ bin.BareEncoder = &UpdateActiveNotifications{} - _ bin.BareDecoder = &UpdateActiveNotifications{} - - _ UpdateClass = &UpdateActiveNotifications{} -) - -func (u *UpdateActiveNotifications) Zero() bool { - if u == nil { - return true - } - if !(u.Groups == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateActiveNotifications) String() string { - if u == nil { - return "UpdateActiveNotifications(nil)" - } - type Alias UpdateActiveNotifications - return fmt.Sprintf("UpdateActiveNotifications%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateActiveNotifications) TypeID() uint32 { - return UpdateActiveNotificationsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateActiveNotifications) TypeName() string { - return "updateActiveNotifications" -} - -// TypeInfo returns info about TL type. -func (u *UpdateActiveNotifications) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateActiveNotifications", - ID: UpdateActiveNotificationsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Groups", - SchemaName: "groups", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateActiveNotifications) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateActiveNotifications#317d80f2 as nil") - } - b.PutID(UpdateActiveNotificationsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateActiveNotifications) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateActiveNotifications#317d80f2 as nil") - } - b.PutInt(len(u.Groups)) - for idx, v := range u.Groups { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateActiveNotifications#317d80f2: field groups element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateActiveNotifications) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateActiveNotifications#317d80f2 to nil") - } - if err := b.ConsumeID(UpdateActiveNotificationsTypeID); err != nil { - return fmt.Errorf("unable to decode updateActiveNotifications#317d80f2: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateActiveNotifications) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateActiveNotifications#317d80f2 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateActiveNotifications#317d80f2: field groups: %w", err) - } - - if headerLen > 0 { - u.Groups = make([]NotificationGroup, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value NotificationGroup - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateActiveNotifications#317d80f2: field groups: %w", err) - } - u.Groups = append(u.Groups, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateActiveNotifications) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateActiveNotifications#317d80f2 as nil") - } - b.ObjStart() - b.PutID("updateActiveNotifications") - b.Comma() - b.FieldStart("groups") - b.ArrStart() - for idx, v := range u.Groups { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateActiveNotifications#317d80f2: field groups element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateActiveNotifications) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateActiveNotifications#317d80f2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateActiveNotifications"); err != nil { - return fmt.Errorf("unable to decode updateActiveNotifications#317d80f2: %w", err) - } - case "groups": - if err := b.Arr(func(b tdjson.Decoder) error { - var value NotificationGroup - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateActiveNotifications#317d80f2: field groups: %w", err) - } - u.Groups = append(u.Groups, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateActiveNotifications#317d80f2: field groups: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGroups returns value of Groups field. -func (u *UpdateActiveNotifications) GetGroups() (value []NotificationGroup) { - if u == nil { - return - } - return u.Groups -} - -// UpdateHavePendingNotifications represents TL type `updateHavePendingNotifications#aaee1db`. -type UpdateHavePendingNotifications struct { - // True, if there are some delayed notification updates, which will be sent soon - HaveDelayedNotifications bool - // True, if there can be some yet unreceived notifications, which are being fetched from - // the server - HaveUnreceivedNotifications bool -} - -// UpdateHavePendingNotificationsTypeID is TL type id of UpdateHavePendingNotifications. -const UpdateHavePendingNotificationsTypeID = 0xaaee1db - -// construct implements constructor of UpdateClass. -func (u UpdateHavePendingNotifications) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateHavePendingNotifications. -var ( - _ bin.Encoder = &UpdateHavePendingNotifications{} - _ bin.Decoder = &UpdateHavePendingNotifications{} - _ bin.BareEncoder = &UpdateHavePendingNotifications{} - _ bin.BareDecoder = &UpdateHavePendingNotifications{} - - _ UpdateClass = &UpdateHavePendingNotifications{} -) - -func (u *UpdateHavePendingNotifications) Zero() bool { - if u == nil { - return true - } - if !(u.HaveDelayedNotifications == false) { - return false - } - if !(u.HaveUnreceivedNotifications == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateHavePendingNotifications) String() string { - if u == nil { - return "UpdateHavePendingNotifications(nil)" - } - type Alias UpdateHavePendingNotifications - return fmt.Sprintf("UpdateHavePendingNotifications%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateHavePendingNotifications) TypeID() uint32 { - return UpdateHavePendingNotificationsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateHavePendingNotifications) TypeName() string { - return "updateHavePendingNotifications" -} - -// TypeInfo returns info about TL type. -func (u *UpdateHavePendingNotifications) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateHavePendingNotifications", - ID: UpdateHavePendingNotificationsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "HaveDelayedNotifications", - SchemaName: "have_delayed_notifications", - }, - { - Name: "HaveUnreceivedNotifications", - SchemaName: "have_unreceived_notifications", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateHavePendingNotifications) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateHavePendingNotifications#aaee1db as nil") - } - b.PutID(UpdateHavePendingNotificationsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateHavePendingNotifications) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateHavePendingNotifications#aaee1db as nil") - } - b.PutBool(u.HaveDelayedNotifications) - b.PutBool(u.HaveUnreceivedNotifications) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateHavePendingNotifications) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateHavePendingNotifications#aaee1db to nil") - } - if err := b.ConsumeID(UpdateHavePendingNotificationsTypeID); err != nil { - return fmt.Errorf("unable to decode updateHavePendingNotifications#aaee1db: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateHavePendingNotifications) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateHavePendingNotifications#aaee1db to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateHavePendingNotifications#aaee1db: field have_delayed_notifications: %w", err) - } - u.HaveDelayedNotifications = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateHavePendingNotifications#aaee1db: field have_unreceived_notifications: %w", err) - } - u.HaveUnreceivedNotifications = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateHavePendingNotifications) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateHavePendingNotifications#aaee1db as nil") - } - b.ObjStart() - b.PutID("updateHavePendingNotifications") - b.Comma() - b.FieldStart("have_delayed_notifications") - b.PutBool(u.HaveDelayedNotifications) - b.Comma() - b.FieldStart("have_unreceived_notifications") - b.PutBool(u.HaveUnreceivedNotifications) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateHavePendingNotifications) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateHavePendingNotifications#aaee1db to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateHavePendingNotifications"); err != nil { - return fmt.Errorf("unable to decode updateHavePendingNotifications#aaee1db: %w", err) - } - case "have_delayed_notifications": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateHavePendingNotifications#aaee1db: field have_delayed_notifications: %w", err) - } - u.HaveDelayedNotifications = value - case "have_unreceived_notifications": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateHavePendingNotifications#aaee1db: field have_unreceived_notifications: %w", err) - } - u.HaveUnreceivedNotifications = value - default: - return b.Skip() - } - return nil - }) -} - -// GetHaveDelayedNotifications returns value of HaveDelayedNotifications field. -func (u *UpdateHavePendingNotifications) GetHaveDelayedNotifications() (value bool) { - if u == nil { - return - } - return u.HaveDelayedNotifications -} - -// GetHaveUnreceivedNotifications returns value of HaveUnreceivedNotifications field. -func (u *UpdateHavePendingNotifications) GetHaveUnreceivedNotifications() (value bool) { - if u == nil { - return - } - return u.HaveUnreceivedNotifications -} - -// UpdateDeleteMessages represents TL type `updateDeleteMessages#6a05bf9`. -type UpdateDeleteMessages struct { - // Chat identifier - ChatID int64 - // Identifiers of the deleted messages - MessageIDs []int64 - // True, if the messages are permanently deleted by a user (as opposed to just becoming - // inaccessible) - IsPermanent bool - // True, if the messages are deleted only from the cache and can possibly be retrieved - // again in the future - FromCache bool -} - -// UpdateDeleteMessagesTypeID is TL type id of UpdateDeleteMessages. -const UpdateDeleteMessagesTypeID = 0x6a05bf9 - -// construct implements constructor of UpdateClass. -func (u UpdateDeleteMessages) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateDeleteMessages. -var ( - _ bin.Encoder = &UpdateDeleteMessages{} - _ bin.Decoder = &UpdateDeleteMessages{} - _ bin.BareEncoder = &UpdateDeleteMessages{} - _ bin.BareDecoder = &UpdateDeleteMessages{} - - _ UpdateClass = &UpdateDeleteMessages{} -) - -func (u *UpdateDeleteMessages) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageIDs == nil) { - return false - } - if !(u.IsPermanent == false) { - return false - } - if !(u.FromCache == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateDeleteMessages) String() string { - if u == nil { - return "UpdateDeleteMessages(nil)" - } - type Alias UpdateDeleteMessages - return fmt.Sprintf("UpdateDeleteMessages%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateDeleteMessages) TypeID() uint32 { - return UpdateDeleteMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateDeleteMessages) TypeName() string { - return "updateDeleteMessages" -} - -// TypeInfo returns info about TL type. -func (u *UpdateDeleteMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateDeleteMessages", - ID: UpdateDeleteMessagesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageIDs", - SchemaName: "message_ids", - }, - { - Name: "IsPermanent", - SchemaName: "is_permanent", - }, - { - Name: "FromCache", - SchemaName: "from_cache", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateDeleteMessages) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateDeleteMessages#6a05bf9 as nil") - } - b.PutID(UpdateDeleteMessagesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateDeleteMessages) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateDeleteMessages#6a05bf9 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt(len(u.MessageIDs)) - for _, v := range u.MessageIDs { - b.PutInt53(v) - } - b.PutBool(u.IsPermanent) - b.PutBool(u.FromCache) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateDeleteMessages) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateDeleteMessages#6a05bf9 to nil") - } - if err := b.ConsumeID(UpdateDeleteMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateDeleteMessages) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateDeleteMessages#6a05bf9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: field chat_id: %w", err) - } - u.ChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: field message_ids: %w", err) - } - - if headerLen > 0 { - u.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: field message_ids: %w", err) - } - u.MessageIDs = append(u.MessageIDs, value) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: field is_permanent: %w", err) - } - u.IsPermanent = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: field from_cache: %w", err) - } - u.FromCache = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateDeleteMessages) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateDeleteMessages#6a05bf9 as nil") - } - b.ObjStart() - b.PutID("updateDeleteMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_ids") - b.ArrStart() - for _, v := range u.MessageIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("is_permanent") - b.PutBool(u.IsPermanent) - b.Comma() - b.FieldStart("from_cache") - b.PutBool(u.FromCache) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateDeleteMessages) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateDeleteMessages#6a05bf9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateDeleteMessages"); err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: field chat_id: %w", err) - } - u.ChatID = value - case "message_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: field message_ids: %w", err) - } - u.MessageIDs = append(u.MessageIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: field message_ids: %w", err) - } - case "is_permanent": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: field is_permanent: %w", err) - } - u.IsPermanent = value - case "from_cache": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateDeleteMessages#6a05bf9: field from_cache: %w", err) - } - u.FromCache = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateDeleteMessages) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageIDs returns value of MessageIDs field. -func (u *UpdateDeleteMessages) GetMessageIDs() (value []int64) { - if u == nil { - return - } - return u.MessageIDs -} - -// GetIsPermanent returns value of IsPermanent field. -func (u *UpdateDeleteMessages) GetIsPermanent() (value bool) { - if u == nil { - return - } - return u.IsPermanent -} - -// GetFromCache returns value of FromCache field. -func (u *UpdateDeleteMessages) GetFromCache() (value bool) { - if u == nil { - return - } - return u.FromCache -} - -// UpdateChatAction represents TL type `updateChatAction#9abfd628`. -type UpdateChatAction struct { - // Chat identifier - ChatID int64 - // If not 0, the message thread identifier in which the action was performed - MessageThreadID int64 - // Identifier of a message sender performing the action - SenderID MessageSenderClass - // The action - Action ChatActionClass -} - -// UpdateChatActionTypeID is TL type id of UpdateChatAction. -const UpdateChatActionTypeID = 0x9abfd628 - -// construct implements constructor of UpdateClass. -func (u UpdateChatAction) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatAction. -var ( - _ bin.Encoder = &UpdateChatAction{} - _ bin.Decoder = &UpdateChatAction{} - _ bin.BareEncoder = &UpdateChatAction{} - _ bin.BareDecoder = &UpdateChatAction{} - - _ UpdateClass = &UpdateChatAction{} -) - -func (u *UpdateChatAction) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageThreadID == 0) { - return false - } - if !(u.SenderID == nil) { - return false - } - if !(u.Action == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatAction) String() string { - if u == nil { - return "UpdateChatAction(nil)" - } - type Alias UpdateChatAction - return fmt.Sprintf("UpdateChatAction%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatAction) TypeID() uint32 { - return UpdateChatActionTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatAction) TypeName() string { - return "updateChatAction" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatAction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatAction", - ID: UpdateChatActionTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageThreadID", - SchemaName: "message_thread_id", - }, - { - Name: "SenderID", - SchemaName: "sender_id", - }, - { - Name: "Action", - SchemaName: "action", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatAction) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAction#9abfd628 as nil") - } - b.PutID(UpdateChatActionTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatAction) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAction#9abfd628 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageThreadID) - if u.SenderID == nil { - return fmt.Errorf("unable to encode updateChatAction#9abfd628: field sender_id is nil") - } - if err := u.SenderID.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatAction#9abfd628: field sender_id: %w", err) - } - if u.Action == nil { - return fmt.Errorf("unable to encode updateChatAction#9abfd628: field action is nil") - } - if err := u.Action.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatAction#9abfd628: field action: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatAction) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAction#9abfd628 to nil") - } - if err := b.ConsumeID(UpdateChatActionTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatAction#9abfd628: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatAction) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAction#9abfd628 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatAction#9abfd628: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatAction#9abfd628: field message_thread_id: %w", err) - } - u.MessageThreadID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatAction#9abfd628: field sender_id: %w", err) - } - u.SenderID = value - } - { - value, err := DecodeChatAction(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatAction#9abfd628: field action: %w", err) - } - u.Action = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatAction) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatAction#9abfd628 as nil") - } - b.ObjStart() - b.PutID("updateChatAction") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_thread_id") - b.PutInt53(u.MessageThreadID) - b.Comma() - b.FieldStart("sender_id") - if u.SenderID == nil { - return fmt.Errorf("unable to encode updateChatAction#9abfd628: field sender_id is nil") - } - if err := u.SenderID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatAction#9abfd628: field sender_id: %w", err) - } - b.Comma() - b.FieldStart("action") - if u.Action == nil { - return fmt.Errorf("unable to encode updateChatAction#9abfd628: field action is nil") - } - if err := u.Action.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatAction#9abfd628: field action: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatAction) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatAction#9abfd628 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatAction"); err != nil { - return fmt.Errorf("unable to decode updateChatAction#9abfd628: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatAction#9abfd628: field chat_id: %w", err) - } - u.ChatID = value - case "message_thread_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatAction#9abfd628: field message_thread_id: %w", err) - } - u.MessageThreadID = value - case "sender_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatAction#9abfd628: field sender_id: %w", err) - } - u.SenderID = value - case "action": - value, err := DecodeTDLibJSONChatAction(b) - if err != nil { - return fmt.Errorf("unable to decode updateChatAction#9abfd628: field action: %w", err) - } - u.Action = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatAction) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageThreadID returns value of MessageThreadID field. -func (u *UpdateChatAction) GetMessageThreadID() (value int64) { - if u == nil { - return - } - return u.MessageThreadID -} - -// GetSenderID returns value of SenderID field. -func (u *UpdateChatAction) GetSenderID() (value MessageSenderClass) { - if u == nil { - return - } - return u.SenderID -} - -// GetAction returns value of Action field. -func (u *UpdateChatAction) GetAction() (value ChatActionClass) { - if u == nil { - return - } - return u.Action -} - -// UpdateUserStatus represents TL type `updateUserStatus#39211211`. -type UpdateUserStatus struct { - // User identifier - UserID int64 - // New status of the user - Status UserStatusClass -} - -// UpdateUserStatusTypeID is TL type id of UpdateUserStatus. -const UpdateUserStatusTypeID = 0x39211211 - -// construct implements constructor of UpdateClass. -func (u UpdateUserStatus) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateUserStatus. -var ( - _ bin.Encoder = &UpdateUserStatus{} - _ bin.Decoder = &UpdateUserStatus{} - _ bin.BareEncoder = &UpdateUserStatus{} - _ bin.BareDecoder = &UpdateUserStatus{} - - _ UpdateClass = &UpdateUserStatus{} -) - -func (u *UpdateUserStatus) Zero() bool { - if u == nil { - return true - } - if !(u.UserID == 0) { - return false - } - if !(u.Status == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateUserStatus) String() string { - if u == nil { - return "UpdateUserStatus(nil)" - } - type Alias UpdateUserStatus - return fmt.Sprintf("UpdateUserStatus%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateUserStatus) TypeID() uint32 { - return UpdateUserStatusTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateUserStatus) TypeName() string { - return "updateUserStatus" -} - -// TypeInfo returns info about TL type. -func (u *UpdateUserStatus) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateUserStatus", - ID: UpdateUserStatusTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Status", - SchemaName: "status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateUserStatus) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUserStatus#39211211 as nil") - } - b.PutID(UpdateUserStatusTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateUserStatus) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUserStatus#39211211 as nil") - } - b.PutInt53(u.UserID) - if u.Status == nil { - return fmt.Errorf("unable to encode updateUserStatus#39211211: field status is nil") - } - if err := u.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateUserStatus#39211211: field status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateUserStatus) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUserStatus#39211211 to nil") - } - if err := b.ConsumeID(UpdateUserStatusTypeID); err != nil { - return fmt.Errorf("unable to decode updateUserStatus#39211211: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateUserStatus) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUserStatus#39211211 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateUserStatus#39211211: field user_id: %w", err) - } - u.UserID = value - } - { - value, err := DecodeUserStatus(b) - if err != nil { - return fmt.Errorf("unable to decode updateUserStatus#39211211: field status: %w", err) - } - u.Status = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateUserStatus) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateUserStatus#39211211 as nil") - } - b.ObjStart() - b.PutID("updateUserStatus") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(u.UserID) - b.Comma() - b.FieldStart("status") - if u.Status == nil { - return fmt.Errorf("unable to encode updateUserStatus#39211211: field status is nil") - } - if err := u.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateUserStatus#39211211: field status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateUserStatus) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateUserStatus#39211211 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateUserStatus"); err != nil { - return fmt.Errorf("unable to decode updateUserStatus#39211211: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateUserStatus#39211211: field user_id: %w", err) - } - u.UserID = value - case "status": - value, err := DecodeTDLibJSONUserStatus(b) - if err != nil { - return fmt.Errorf("unable to decode updateUserStatus#39211211: field status: %w", err) - } - u.Status = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (u *UpdateUserStatus) GetUserID() (value int64) { - if u == nil { - return - } - return u.UserID -} - -// GetStatus returns value of Status field. -func (u *UpdateUserStatus) GetStatus() (value UserStatusClass) { - if u == nil { - return - } - return u.Status -} - -// UpdateUser represents TL type `updateUser#468928f9`. -type UpdateUser struct { - // New data about the user - User User -} - -// UpdateUserTypeID is TL type id of UpdateUser. -const UpdateUserTypeID = 0x468928f9 - -// construct implements constructor of UpdateClass. -func (u UpdateUser) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateUser. -var ( - _ bin.Encoder = &UpdateUser{} - _ bin.Decoder = &UpdateUser{} - _ bin.BareEncoder = &UpdateUser{} - _ bin.BareDecoder = &UpdateUser{} - - _ UpdateClass = &UpdateUser{} -) - -func (u *UpdateUser) Zero() bool { - if u == nil { - return true - } - if !(u.User.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateUser) String() string { - if u == nil { - return "UpdateUser(nil)" - } - type Alias UpdateUser - return fmt.Sprintf("UpdateUser%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateUser) TypeID() uint32 { - return UpdateUserTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateUser) TypeName() string { - return "updateUser" -} - -// TypeInfo returns info about TL type. -func (u *UpdateUser) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateUser", - ID: UpdateUserTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "User", - SchemaName: "user", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateUser) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUser#468928f9 as nil") - } - b.PutID(UpdateUserTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateUser) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUser#468928f9 as nil") - } - if err := u.User.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateUser#468928f9: field user: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateUser) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUser#468928f9 to nil") - } - if err := b.ConsumeID(UpdateUserTypeID); err != nil { - return fmt.Errorf("unable to decode updateUser#468928f9: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateUser) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUser#468928f9 to nil") - } - { - if err := u.User.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateUser#468928f9: field user: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateUser) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateUser#468928f9 as nil") - } - b.ObjStart() - b.PutID("updateUser") - b.Comma() - b.FieldStart("user") - if err := u.User.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateUser#468928f9: field user: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateUser) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateUser#468928f9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateUser"); err != nil { - return fmt.Errorf("unable to decode updateUser#468928f9: %w", err) - } - case "user": - if err := u.User.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateUser#468928f9: field user: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUser returns value of User field. -func (u *UpdateUser) GetUser() (value User) { - if u == nil { - return - } - return u.User -} - -// UpdateBasicGroup represents TL type `updateBasicGroup#c433c763`. -type UpdateBasicGroup struct { - // New data about the group - BasicGroup BasicGroup -} - -// UpdateBasicGroupTypeID is TL type id of UpdateBasicGroup. -const UpdateBasicGroupTypeID = 0xc433c763 - -// construct implements constructor of UpdateClass. -func (u UpdateBasicGroup) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateBasicGroup. -var ( - _ bin.Encoder = &UpdateBasicGroup{} - _ bin.Decoder = &UpdateBasicGroup{} - _ bin.BareEncoder = &UpdateBasicGroup{} - _ bin.BareDecoder = &UpdateBasicGroup{} - - _ UpdateClass = &UpdateBasicGroup{} -) - -func (u *UpdateBasicGroup) Zero() bool { - if u == nil { - return true - } - if !(u.BasicGroup.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateBasicGroup) String() string { - if u == nil { - return "UpdateBasicGroup(nil)" - } - type Alias UpdateBasicGroup - return fmt.Sprintf("UpdateBasicGroup%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateBasicGroup) TypeID() uint32 { - return UpdateBasicGroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateBasicGroup) TypeName() string { - return "updateBasicGroup" -} - -// TypeInfo returns info about TL type. -func (u *UpdateBasicGroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateBasicGroup", - ID: UpdateBasicGroupTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BasicGroup", - SchemaName: "basic_group", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateBasicGroup) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateBasicGroup#c433c763 as nil") - } - b.PutID(UpdateBasicGroupTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateBasicGroup) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateBasicGroup#c433c763 as nil") - } - if err := u.BasicGroup.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateBasicGroup#c433c763: field basic_group: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateBasicGroup) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateBasicGroup#c433c763 to nil") - } - if err := b.ConsumeID(UpdateBasicGroupTypeID); err != nil { - return fmt.Errorf("unable to decode updateBasicGroup#c433c763: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateBasicGroup) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateBasicGroup#c433c763 to nil") - } - { - if err := u.BasicGroup.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateBasicGroup#c433c763: field basic_group: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateBasicGroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateBasicGroup#c433c763 as nil") - } - b.ObjStart() - b.PutID("updateBasicGroup") - b.Comma() - b.FieldStart("basic_group") - if err := u.BasicGroup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateBasicGroup#c433c763: field basic_group: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateBasicGroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateBasicGroup#c433c763 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateBasicGroup"); err != nil { - return fmt.Errorf("unable to decode updateBasicGroup#c433c763: %w", err) - } - case "basic_group": - if err := u.BasicGroup.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateBasicGroup#c433c763: field basic_group: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBasicGroup returns value of BasicGroup field. -func (u *UpdateBasicGroup) GetBasicGroup() (value BasicGroup) { - if u == nil { - return - } - return u.BasicGroup -} - -// UpdateSupergroup represents TL type `updateSupergroup#fb6c6524`. -type UpdateSupergroup struct { - // New data about the supergroup - Supergroup Supergroup -} - -// UpdateSupergroupTypeID is TL type id of UpdateSupergroup. -const UpdateSupergroupTypeID = 0xfb6c6524 - -// construct implements constructor of UpdateClass. -func (u UpdateSupergroup) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateSupergroup. -var ( - _ bin.Encoder = &UpdateSupergroup{} - _ bin.Decoder = &UpdateSupergroup{} - _ bin.BareEncoder = &UpdateSupergroup{} - _ bin.BareDecoder = &UpdateSupergroup{} - - _ UpdateClass = &UpdateSupergroup{} -) - -func (u *UpdateSupergroup) Zero() bool { - if u == nil { - return true - } - if !(u.Supergroup.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateSupergroup) String() string { - if u == nil { - return "UpdateSupergroup(nil)" - } - type Alias UpdateSupergroup - return fmt.Sprintf("UpdateSupergroup%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSupergroup) TypeID() uint32 { - return UpdateSupergroupTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateSupergroup) TypeName() string { - return "updateSupergroup" -} - -// TypeInfo returns info about TL type. -func (u *UpdateSupergroup) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateSupergroup", - ID: UpdateSupergroupTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Supergroup", - SchemaName: "supergroup", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateSupergroup) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSupergroup#fb6c6524 as nil") - } - b.PutID(UpdateSupergroupTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateSupergroup) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSupergroup#fb6c6524 as nil") - } - if err := u.Supergroup.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateSupergroup#fb6c6524: field supergroup: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateSupergroup) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSupergroup#fb6c6524 to nil") - } - if err := b.ConsumeID(UpdateSupergroupTypeID); err != nil { - return fmt.Errorf("unable to decode updateSupergroup#fb6c6524: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateSupergroup) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSupergroup#fb6c6524 to nil") - } - { - if err := u.Supergroup.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateSupergroup#fb6c6524: field supergroup: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSupergroup) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateSupergroup#fb6c6524 as nil") - } - b.ObjStart() - b.PutID("updateSupergroup") - b.Comma() - b.FieldStart("supergroup") - if err := u.Supergroup.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateSupergroup#fb6c6524: field supergroup: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSupergroup) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateSupergroup#fb6c6524 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateSupergroup"); err != nil { - return fmt.Errorf("unable to decode updateSupergroup#fb6c6524: %w", err) - } - case "supergroup": - if err := u.Supergroup.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateSupergroup#fb6c6524: field supergroup: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroup returns value of Supergroup field. -func (u *UpdateSupergroup) GetSupergroup() (value Supergroup) { - if u == nil { - return - } - return u.Supergroup -} - -// UpdateSecretChat represents TL type `updateSecretChat#9ca5132b`. -type UpdateSecretChat struct { - // New data about the secret chat - SecretChat SecretChat -} - -// UpdateSecretChatTypeID is TL type id of UpdateSecretChat. -const UpdateSecretChatTypeID = 0x9ca5132b - -// construct implements constructor of UpdateClass. -func (u UpdateSecretChat) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateSecretChat. -var ( - _ bin.Encoder = &UpdateSecretChat{} - _ bin.Decoder = &UpdateSecretChat{} - _ bin.BareEncoder = &UpdateSecretChat{} - _ bin.BareDecoder = &UpdateSecretChat{} - - _ UpdateClass = &UpdateSecretChat{} -) - -func (u *UpdateSecretChat) Zero() bool { - if u == nil { - return true - } - if !(u.SecretChat.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateSecretChat) String() string { - if u == nil { - return "UpdateSecretChat(nil)" - } - type Alias UpdateSecretChat - return fmt.Sprintf("UpdateSecretChat%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSecretChat) TypeID() uint32 { - return UpdateSecretChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateSecretChat) TypeName() string { - return "updateSecretChat" -} - -// TypeInfo returns info about TL type. -func (u *UpdateSecretChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateSecretChat", - ID: UpdateSecretChatTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SecretChat", - SchemaName: "secret_chat", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateSecretChat) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSecretChat#9ca5132b as nil") - } - b.PutID(UpdateSecretChatTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateSecretChat) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSecretChat#9ca5132b as nil") - } - if err := u.SecretChat.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateSecretChat#9ca5132b: field secret_chat: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateSecretChat) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSecretChat#9ca5132b to nil") - } - if err := b.ConsumeID(UpdateSecretChatTypeID); err != nil { - return fmt.Errorf("unable to decode updateSecretChat#9ca5132b: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateSecretChat) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSecretChat#9ca5132b to nil") - } - { - if err := u.SecretChat.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateSecretChat#9ca5132b: field secret_chat: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSecretChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateSecretChat#9ca5132b as nil") - } - b.ObjStart() - b.PutID("updateSecretChat") - b.Comma() - b.FieldStart("secret_chat") - if err := u.SecretChat.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateSecretChat#9ca5132b: field secret_chat: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSecretChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateSecretChat#9ca5132b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateSecretChat"); err != nil { - return fmt.Errorf("unable to decode updateSecretChat#9ca5132b: %w", err) - } - case "secret_chat": - if err := u.SecretChat.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateSecretChat#9ca5132b: field secret_chat: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSecretChat returns value of SecretChat field. -func (u *UpdateSecretChat) GetSecretChat() (value SecretChat) { - if u == nil { - return - } - return u.SecretChat -} - -// UpdateUserFullInfo represents TL type `updateUserFullInfo#fcf2cb17`. -type UpdateUserFullInfo struct { - // User identifier - UserID int64 - // New full information about the user - UserFullInfo UserFullInfo -} - -// UpdateUserFullInfoTypeID is TL type id of UpdateUserFullInfo. -const UpdateUserFullInfoTypeID = 0xfcf2cb17 - -// construct implements constructor of UpdateClass. -func (u UpdateUserFullInfo) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateUserFullInfo. -var ( - _ bin.Encoder = &UpdateUserFullInfo{} - _ bin.Decoder = &UpdateUserFullInfo{} - _ bin.BareEncoder = &UpdateUserFullInfo{} - _ bin.BareDecoder = &UpdateUserFullInfo{} - - _ UpdateClass = &UpdateUserFullInfo{} -) - -func (u *UpdateUserFullInfo) Zero() bool { - if u == nil { - return true - } - if !(u.UserID == 0) { - return false - } - if !(u.UserFullInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateUserFullInfo) String() string { - if u == nil { - return "UpdateUserFullInfo(nil)" - } - type Alias UpdateUserFullInfo - return fmt.Sprintf("UpdateUserFullInfo%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateUserFullInfo) TypeID() uint32 { - return UpdateUserFullInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateUserFullInfo) TypeName() string { - return "updateUserFullInfo" -} - -// TypeInfo returns info about TL type. -func (u *UpdateUserFullInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateUserFullInfo", - ID: UpdateUserFullInfoTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "UserFullInfo", - SchemaName: "user_full_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateUserFullInfo) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUserFullInfo#fcf2cb17 as nil") - } - b.PutID(UpdateUserFullInfoTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateUserFullInfo) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUserFullInfo#fcf2cb17 as nil") - } - b.PutInt53(u.UserID) - if err := u.UserFullInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateUserFullInfo#fcf2cb17: field user_full_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateUserFullInfo) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUserFullInfo#fcf2cb17 to nil") - } - if err := b.ConsumeID(UpdateUserFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode updateUserFullInfo#fcf2cb17: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateUserFullInfo) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUserFullInfo#fcf2cb17 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateUserFullInfo#fcf2cb17: field user_id: %w", err) - } - u.UserID = value - } - { - if err := u.UserFullInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateUserFullInfo#fcf2cb17: field user_full_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateUserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateUserFullInfo#fcf2cb17 as nil") - } - b.ObjStart() - b.PutID("updateUserFullInfo") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(u.UserID) - b.Comma() - b.FieldStart("user_full_info") - if err := u.UserFullInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateUserFullInfo#fcf2cb17: field user_full_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateUserFullInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateUserFullInfo#fcf2cb17 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateUserFullInfo"); err != nil { - return fmt.Errorf("unable to decode updateUserFullInfo#fcf2cb17: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateUserFullInfo#fcf2cb17: field user_id: %w", err) - } - u.UserID = value - case "user_full_info": - if err := u.UserFullInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateUserFullInfo#fcf2cb17: field user_full_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (u *UpdateUserFullInfo) GetUserID() (value int64) { - if u == nil { - return - } - return u.UserID -} - -// GetUserFullInfo returns value of UserFullInfo field. -func (u *UpdateUserFullInfo) GetUserFullInfo() (value UserFullInfo) { - if u == nil { - return - } - return u.UserFullInfo -} - -// UpdateBasicGroupFullInfo represents TL type `updateBasicGroupFullInfo#52f66bbf`. -type UpdateBasicGroupFullInfo struct { - // Identifier of a basic group - BasicGroupID int64 - // New full information about the group - BasicGroupFullInfo BasicGroupFullInfo -} - -// UpdateBasicGroupFullInfoTypeID is TL type id of UpdateBasicGroupFullInfo. -const UpdateBasicGroupFullInfoTypeID = 0x52f66bbf - -// construct implements constructor of UpdateClass. -func (u UpdateBasicGroupFullInfo) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateBasicGroupFullInfo. -var ( - _ bin.Encoder = &UpdateBasicGroupFullInfo{} - _ bin.Decoder = &UpdateBasicGroupFullInfo{} - _ bin.BareEncoder = &UpdateBasicGroupFullInfo{} - _ bin.BareDecoder = &UpdateBasicGroupFullInfo{} - - _ UpdateClass = &UpdateBasicGroupFullInfo{} -) - -func (u *UpdateBasicGroupFullInfo) Zero() bool { - if u == nil { - return true - } - if !(u.BasicGroupID == 0) { - return false - } - if !(u.BasicGroupFullInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateBasicGroupFullInfo) String() string { - if u == nil { - return "UpdateBasicGroupFullInfo(nil)" - } - type Alias UpdateBasicGroupFullInfo - return fmt.Sprintf("UpdateBasicGroupFullInfo%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateBasicGroupFullInfo) TypeID() uint32 { - return UpdateBasicGroupFullInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateBasicGroupFullInfo) TypeName() string { - return "updateBasicGroupFullInfo" -} - -// TypeInfo returns info about TL type. -func (u *UpdateBasicGroupFullInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateBasicGroupFullInfo", - ID: UpdateBasicGroupFullInfoTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "BasicGroupID", - SchemaName: "basic_group_id", - }, - { - Name: "BasicGroupFullInfo", - SchemaName: "basic_group_full_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateBasicGroupFullInfo) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateBasicGroupFullInfo#52f66bbf as nil") - } - b.PutID(UpdateBasicGroupFullInfoTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateBasicGroupFullInfo) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateBasicGroupFullInfo#52f66bbf as nil") - } - b.PutInt53(u.BasicGroupID) - if err := u.BasicGroupFullInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateBasicGroupFullInfo#52f66bbf: field basic_group_full_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateBasicGroupFullInfo) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateBasicGroupFullInfo#52f66bbf to nil") - } - if err := b.ConsumeID(UpdateBasicGroupFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode updateBasicGroupFullInfo#52f66bbf: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateBasicGroupFullInfo) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateBasicGroupFullInfo#52f66bbf to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateBasicGroupFullInfo#52f66bbf: field basic_group_id: %w", err) - } - u.BasicGroupID = value - } - { - if err := u.BasicGroupFullInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateBasicGroupFullInfo#52f66bbf: field basic_group_full_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateBasicGroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateBasicGroupFullInfo#52f66bbf as nil") - } - b.ObjStart() - b.PutID("updateBasicGroupFullInfo") - b.Comma() - b.FieldStart("basic_group_id") - b.PutInt53(u.BasicGroupID) - b.Comma() - b.FieldStart("basic_group_full_info") - if err := u.BasicGroupFullInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateBasicGroupFullInfo#52f66bbf: field basic_group_full_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateBasicGroupFullInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateBasicGroupFullInfo#52f66bbf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateBasicGroupFullInfo"); err != nil { - return fmt.Errorf("unable to decode updateBasicGroupFullInfo#52f66bbf: %w", err) - } - case "basic_group_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateBasicGroupFullInfo#52f66bbf: field basic_group_id: %w", err) - } - u.BasicGroupID = value - case "basic_group_full_info": - if err := u.BasicGroupFullInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateBasicGroupFullInfo#52f66bbf: field basic_group_full_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBasicGroupID returns value of BasicGroupID field. -func (u *UpdateBasicGroupFullInfo) GetBasicGroupID() (value int64) { - if u == nil { - return - } - return u.BasicGroupID -} - -// GetBasicGroupFullInfo returns value of BasicGroupFullInfo field. -func (u *UpdateBasicGroupFullInfo) GetBasicGroupFullInfo() (value BasicGroupFullInfo) { - if u == nil { - return - } - return u.BasicGroupFullInfo -} - -// UpdateSupergroupFullInfo represents TL type `updateSupergroupFullInfo#19f5cd0e`. -type UpdateSupergroupFullInfo struct { - // Identifier of the supergroup or channel - SupergroupID int64 - // New full information about the supergroup - SupergroupFullInfo SupergroupFullInfo -} - -// UpdateSupergroupFullInfoTypeID is TL type id of UpdateSupergroupFullInfo. -const UpdateSupergroupFullInfoTypeID = 0x19f5cd0e - -// construct implements constructor of UpdateClass. -func (u UpdateSupergroupFullInfo) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateSupergroupFullInfo. -var ( - _ bin.Encoder = &UpdateSupergroupFullInfo{} - _ bin.Decoder = &UpdateSupergroupFullInfo{} - _ bin.BareEncoder = &UpdateSupergroupFullInfo{} - _ bin.BareDecoder = &UpdateSupergroupFullInfo{} - - _ UpdateClass = &UpdateSupergroupFullInfo{} -) - -func (u *UpdateSupergroupFullInfo) Zero() bool { - if u == nil { - return true - } - if !(u.SupergroupID == 0) { - return false - } - if !(u.SupergroupFullInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateSupergroupFullInfo) String() string { - if u == nil { - return "UpdateSupergroupFullInfo(nil)" - } - type Alias UpdateSupergroupFullInfo - return fmt.Sprintf("UpdateSupergroupFullInfo%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSupergroupFullInfo) TypeID() uint32 { - return UpdateSupergroupFullInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateSupergroupFullInfo) TypeName() string { - return "updateSupergroupFullInfo" -} - -// TypeInfo returns info about TL type. -func (u *UpdateSupergroupFullInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateSupergroupFullInfo", - ID: UpdateSupergroupFullInfoTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SupergroupID", - SchemaName: "supergroup_id", - }, - { - Name: "SupergroupFullInfo", - SchemaName: "supergroup_full_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateSupergroupFullInfo) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSupergroupFullInfo#19f5cd0e as nil") - } - b.PutID(UpdateSupergroupFullInfoTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateSupergroupFullInfo) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSupergroupFullInfo#19f5cd0e as nil") - } - b.PutInt53(u.SupergroupID) - if err := u.SupergroupFullInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateSupergroupFullInfo#19f5cd0e: field supergroup_full_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateSupergroupFullInfo) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSupergroupFullInfo#19f5cd0e to nil") - } - if err := b.ConsumeID(UpdateSupergroupFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode updateSupergroupFullInfo#19f5cd0e: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateSupergroupFullInfo) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSupergroupFullInfo#19f5cd0e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateSupergroupFullInfo#19f5cd0e: field supergroup_id: %w", err) - } - u.SupergroupID = value - } - { - if err := u.SupergroupFullInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateSupergroupFullInfo#19f5cd0e: field supergroup_full_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSupergroupFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateSupergroupFullInfo#19f5cd0e as nil") - } - b.ObjStart() - b.PutID("updateSupergroupFullInfo") - b.Comma() - b.FieldStart("supergroup_id") - b.PutInt53(u.SupergroupID) - b.Comma() - b.FieldStart("supergroup_full_info") - if err := u.SupergroupFullInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateSupergroupFullInfo#19f5cd0e: field supergroup_full_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSupergroupFullInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateSupergroupFullInfo#19f5cd0e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateSupergroupFullInfo"); err != nil { - return fmt.Errorf("unable to decode updateSupergroupFullInfo#19f5cd0e: %w", err) - } - case "supergroup_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateSupergroupFullInfo#19f5cd0e: field supergroup_id: %w", err) - } - u.SupergroupID = value - case "supergroup_full_info": - if err := u.SupergroupFullInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateSupergroupFullInfo#19f5cd0e: field supergroup_full_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSupergroupID returns value of SupergroupID field. -func (u *UpdateSupergroupFullInfo) GetSupergroupID() (value int64) { - if u == nil { - return - } - return u.SupergroupID -} - -// GetSupergroupFullInfo returns value of SupergroupFullInfo field. -func (u *UpdateSupergroupFullInfo) GetSupergroupFullInfo() (value SupergroupFullInfo) { - if u == nil { - return - } - return u.SupergroupFullInfo -} - -// UpdateServiceNotification represents TL type `updateServiceNotification#4e9895ad`. -type UpdateServiceNotification struct { - // Notification type. If type begins with "AUTH_KEY_DROP_", then two buttons "Cancel" and - // "Log out" must be shown under notification; if user presses the second, all local data - // must be destroyed using Destroy method - Type string - // Notification content - Content MessageContentClass -} - -// UpdateServiceNotificationTypeID is TL type id of UpdateServiceNotification. -const UpdateServiceNotificationTypeID = 0x4e9895ad - -// construct implements constructor of UpdateClass. -func (u UpdateServiceNotification) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateServiceNotification. -var ( - _ bin.Encoder = &UpdateServiceNotification{} - _ bin.Decoder = &UpdateServiceNotification{} - _ bin.BareEncoder = &UpdateServiceNotification{} - _ bin.BareDecoder = &UpdateServiceNotification{} - - _ UpdateClass = &UpdateServiceNotification{} -) - -func (u *UpdateServiceNotification) Zero() bool { - if u == nil { - return true - } - if !(u.Type == "") { - return false - } - if !(u.Content == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateServiceNotification) String() string { - if u == nil { - return "UpdateServiceNotification(nil)" - } - type Alias UpdateServiceNotification - return fmt.Sprintf("UpdateServiceNotification%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateServiceNotification) TypeID() uint32 { - return UpdateServiceNotificationTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateServiceNotification) TypeName() string { - return "updateServiceNotification" -} - -// TypeInfo returns info about TL type. -func (u *UpdateServiceNotification) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateServiceNotification", - ID: UpdateServiceNotificationTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "Content", - SchemaName: "content", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateServiceNotification) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateServiceNotification#4e9895ad as nil") - } - b.PutID(UpdateServiceNotificationTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateServiceNotification) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateServiceNotification#4e9895ad as nil") - } - b.PutString(u.Type) - if u.Content == nil { - return fmt.Errorf("unable to encode updateServiceNotification#4e9895ad: field content is nil") - } - if err := u.Content.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateServiceNotification#4e9895ad: field content: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateServiceNotification) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateServiceNotification#4e9895ad to nil") - } - if err := b.ConsumeID(UpdateServiceNotificationTypeID); err != nil { - return fmt.Errorf("unable to decode updateServiceNotification#4e9895ad: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateServiceNotification) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateServiceNotification#4e9895ad to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateServiceNotification#4e9895ad: field type: %w", err) - } - u.Type = value - } - { - value, err := DecodeMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode updateServiceNotification#4e9895ad: field content: %w", err) - } - u.Content = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateServiceNotification) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateServiceNotification#4e9895ad as nil") - } - b.ObjStart() - b.PutID("updateServiceNotification") - b.Comma() - b.FieldStart("type") - b.PutString(u.Type) - b.Comma() - b.FieldStart("content") - if u.Content == nil { - return fmt.Errorf("unable to encode updateServiceNotification#4e9895ad: field content is nil") - } - if err := u.Content.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateServiceNotification#4e9895ad: field content: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateServiceNotification) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateServiceNotification#4e9895ad to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateServiceNotification"); err != nil { - return fmt.Errorf("unable to decode updateServiceNotification#4e9895ad: %w", err) - } - case "type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateServiceNotification#4e9895ad: field type: %w", err) - } - u.Type = value - case "content": - value, err := DecodeTDLibJSONMessageContent(b) - if err != nil { - return fmt.Errorf("unable to decode updateServiceNotification#4e9895ad: field content: %w", err) - } - u.Content = value - default: - return b.Skip() - } - return nil - }) -} - -// GetType returns value of Type field. -func (u *UpdateServiceNotification) GetType() (value string) { - if u == nil { - return - } - return u.Type -} - -// GetContent returns value of Content field. -func (u *UpdateServiceNotification) GetContent() (value MessageContentClass) { - if u == nil { - return - } - return u.Content -} - -// UpdateFile represents TL type `updateFile#6cd875f`. -type UpdateFile struct { - // New data about the file - File File -} - -// UpdateFileTypeID is TL type id of UpdateFile. -const UpdateFileTypeID = 0x6cd875f - -// construct implements constructor of UpdateClass. -func (u UpdateFile) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateFile. -var ( - _ bin.Encoder = &UpdateFile{} - _ bin.Decoder = &UpdateFile{} - _ bin.BareEncoder = &UpdateFile{} - _ bin.BareDecoder = &UpdateFile{} - - _ UpdateClass = &UpdateFile{} -) - -func (u *UpdateFile) Zero() bool { - if u == nil { - return true - } - if !(u.File.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateFile) String() string { - if u == nil { - return "UpdateFile(nil)" - } - type Alias UpdateFile - return fmt.Sprintf("UpdateFile%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateFile) TypeID() uint32 { - return UpdateFileTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateFile) TypeName() string { - return "updateFile" -} - -// TypeInfo returns info about TL type. -func (u *UpdateFile) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateFile", - ID: UpdateFileTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "File", - SchemaName: "file", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateFile) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFile#6cd875f as nil") - } - b.PutID(UpdateFileTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateFile) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFile#6cd875f as nil") - } - if err := u.File.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateFile#6cd875f: field file: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateFile) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFile#6cd875f to nil") - } - if err := b.ConsumeID(UpdateFileTypeID); err != nil { - return fmt.Errorf("unable to decode updateFile#6cd875f: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateFile) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFile#6cd875f to nil") - } - { - if err := u.File.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateFile#6cd875f: field file: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateFile) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateFile#6cd875f as nil") - } - b.ObjStart() - b.PutID("updateFile") - b.Comma() - b.FieldStart("file") - if err := u.File.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateFile#6cd875f: field file: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateFile) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateFile#6cd875f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateFile"); err != nil { - return fmt.Errorf("unable to decode updateFile#6cd875f: %w", err) - } - case "file": - if err := u.File.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateFile#6cd875f: field file: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFile returns value of File field. -func (u *UpdateFile) GetFile() (value File) { - if u == nil { - return - } - return u.File -} - -// UpdateFileGenerationStart represents TL type `updateFileGenerationStart#cec5eec`. -type UpdateFileGenerationStart struct { - // Unique identifier for the generation process - GenerationID int64 - // The original path specified by the application in inputFileGenerated - OriginalPath string - // The path to a file that must be created and where the new file must be generated by - // the application. - DestinationPath string - // If the conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file - // that must be downloaded by the application. - Conversion string -} - -// UpdateFileGenerationStartTypeID is TL type id of UpdateFileGenerationStart. -const UpdateFileGenerationStartTypeID = 0xcec5eec - -// construct implements constructor of UpdateClass. -func (u UpdateFileGenerationStart) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateFileGenerationStart. -var ( - _ bin.Encoder = &UpdateFileGenerationStart{} - _ bin.Decoder = &UpdateFileGenerationStart{} - _ bin.BareEncoder = &UpdateFileGenerationStart{} - _ bin.BareDecoder = &UpdateFileGenerationStart{} - - _ UpdateClass = &UpdateFileGenerationStart{} -) - -func (u *UpdateFileGenerationStart) Zero() bool { - if u == nil { - return true - } - if !(u.GenerationID == 0) { - return false - } - if !(u.OriginalPath == "") { - return false - } - if !(u.DestinationPath == "") { - return false - } - if !(u.Conversion == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateFileGenerationStart) String() string { - if u == nil { - return "UpdateFileGenerationStart(nil)" - } - type Alias UpdateFileGenerationStart - return fmt.Sprintf("UpdateFileGenerationStart%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateFileGenerationStart) TypeID() uint32 { - return UpdateFileGenerationStartTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateFileGenerationStart) TypeName() string { - return "updateFileGenerationStart" -} - -// TypeInfo returns info about TL type. -func (u *UpdateFileGenerationStart) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateFileGenerationStart", - ID: UpdateFileGenerationStartTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GenerationID", - SchemaName: "generation_id", - }, - { - Name: "OriginalPath", - SchemaName: "original_path", - }, - { - Name: "DestinationPath", - SchemaName: "destination_path", - }, - { - Name: "Conversion", - SchemaName: "conversion", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateFileGenerationStart) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileGenerationStart#cec5eec as nil") - } - b.PutID(UpdateFileGenerationStartTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateFileGenerationStart) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileGenerationStart#cec5eec as nil") - } - b.PutLong(u.GenerationID) - b.PutString(u.OriginalPath) - b.PutString(u.DestinationPath) - b.PutString(u.Conversion) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateFileGenerationStart) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileGenerationStart#cec5eec to nil") - } - if err := b.ConsumeID(UpdateFileGenerationStartTypeID); err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStart#cec5eec: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateFileGenerationStart) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileGenerationStart#cec5eec to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStart#cec5eec: field generation_id: %w", err) - } - u.GenerationID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStart#cec5eec: field original_path: %w", err) - } - u.OriginalPath = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStart#cec5eec: field destination_path: %w", err) - } - u.DestinationPath = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStart#cec5eec: field conversion: %w", err) - } - u.Conversion = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateFileGenerationStart) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateFileGenerationStart#cec5eec as nil") - } - b.ObjStart() - b.PutID("updateFileGenerationStart") - b.Comma() - b.FieldStart("generation_id") - b.PutLong(u.GenerationID) - b.Comma() - b.FieldStart("original_path") - b.PutString(u.OriginalPath) - b.Comma() - b.FieldStart("destination_path") - b.PutString(u.DestinationPath) - b.Comma() - b.FieldStart("conversion") - b.PutString(u.Conversion) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateFileGenerationStart) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateFileGenerationStart#cec5eec to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateFileGenerationStart"); err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStart#cec5eec: %w", err) - } - case "generation_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStart#cec5eec: field generation_id: %w", err) - } - u.GenerationID = value - case "original_path": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStart#cec5eec: field original_path: %w", err) - } - u.OriginalPath = value - case "destination_path": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStart#cec5eec: field destination_path: %w", err) - } - u.DestinationPath = value - case "conversion": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStart#cec5eec: field conversion: %w", err) - } - u.Conversion = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGenerationID returns value of GenerationID field. -func (u *UpdateFileGenerationStart) GetGenerationID() (value int64) { - if u == nil { - return - } - return u.GenerationID -} - -// GetOriginalPath returns value of OriginalPath field. -func (u *UpdateFileGenerationStart) GetOriginalPath() (value string) { - if u == nil { - return - } - return u.OriginalPath -} - -// GetDestinationPath returns value of DestinationPath field. -func (u *UpdateFileGenerationStart) GetDestinationPath() (value string) { - if u == nil { - return - } - return u.DestinationPath -} - -// GetConversion returns value of Conversion field. -func (u *UpdateFileGenerationStart) GetConversion() (value string) { - if u == nil { - return - } - return u.Conversion -} - -// UpdateFileGenerationStop represents TL type `updateFileGenerationStop#8f14fdeb`. -type UpdateFileGenerationStop struct { - // Unique identifier for the generation process - GenerationID int64 -} - -// UpdateFileGenerationStopTypeID is TL type id of UpdateFileGenerationStop. -const UpdateFileGenerationStopTypeID = 0x8f14fdeb - -// construct implements constructor of UpdateClass. -func (u UpdateFileGenerationStop) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateFileGenerationStop. -var ( - _ bin.Encoder = &UpdateFileGenerationStop{} - _ bin.Decoder = &UpdateFileGenerationStop{} - _ bin.BareEncoder = &UpdateFileGenerationStop{} - _ bin.BareDecoder = &UpdateFileGenerationStop{} - - _ UpdateClass = &UpdateFileGenerationStop{} -) - -func (u *UpdateFileGenerationStop) Zero() bool { - if u == nil { - return true - } - if !(u.GenerationID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateFileGenerationStop) String() string { - if u == nil { - return "UpdateFileGenerationStop(nil)" - } - type Alias UpdateFileGenerationStop - return fmt.Sprintf("UpdateFileGenerationStop%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateFileGenerationStop) TypeID() uint32 { - return UpdateFileGenerationStopTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateFileGenerationStop) TypeName() string { - return "updateFileGenerationStop" -} - -// TypeInfo returns info about TL type. -func (u *UpdateFileGenerationStop) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateFileGenerationStop", - ID: UpdateFileGenerationStopTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GenerationID", - SchemaName: "generation_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateFileGenerationStop) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileGenerationStop#8f14fdeb as nil") - } - b.PutID(UpdateFileGenerationStopTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateFileGenerationStop) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileGenerationStop#8f14fdeb as nil") - } - b.PutLong(u.GenerationID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateFileGenerationStop) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileGenerationStop#8f14fdeb to nil") - } - if err := b.ConsumeID(UpdateFileGenerationStopTypeID); err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStop#8f14fdeb: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateFileGenerationStop) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileGenerationStop#8f14fdeb to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStop#8f14fdeb: field generation_id: %w", err) - } - u.GenerationID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateFileGenerationStop) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateFileGenerationStop#8f14fdeb as nil") - } - b.ObjStart() - b.PutID("updateFileGenerationStop") - b.Comma() - b.FieldStart("generation_id") - b.PutLong(u.GenerationID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateFileGenerationStop) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateFileGenerationStop#8f14fdeb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateFileGenerationStop"); err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStop#8f14fdeb: %w", err) - } - case "generation_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateFileGenerationStop#8f14fdeb: field generation_id: %w", err) - } - u.GenerationID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGenerationID returns value of GenerationID field. -func (u *UpdateFileGenerationStop) GetGenerationID() (value int64) { - if u == nil { - return - } - return u.GenerationID -} - -// UpdateFileDownloads represents TL type `updateFileDownloads#e8cd12c7`. -type UpdateFileDownloads struct { - // Total size of files in the file download list, in bytes - TotalSize int64 - // Total number of files in the file download list - TotalCount int32 - // Total downloaded size of files in the file download list, in bytes - DownloadedSize int64 -} - -// UpdateFileDownloadsTypeID is TL type id of UpdateFileDownloads. -const UpdateFileDownloadsTypeID = 0xe8cd12c7 - -// construct implements constructor of UpdateClass. -func (u UpdateFileDownloads) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateFileDownloads. -var ( - _ bin.Encoder = &UpdateFileDownloads{} - _ bin.Decoder = &UpdateFileDownloads{} - _ bin.BareEncoder = &UpdateFileDownloads{} - _ bin.BareDecoder = &UpdateFileDownloads{} - - _ UpdateClass = &UpdateFileDownloads{} -) - -func (u *UpdateFileDownloads) Zero() bool { - if u == nil { - return true - } - if !(u.TotalSize == 0) { - return false - } - if !(u.TotalCount == 0) { - return false - } - if !(u.DownloadedSize == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateFileDownloads) String() string { - if u == nil { - return "UpdateFileDownloads(nil)" - } - type Alias UpdateFileDownloads - return fmt.Sprintf("UpdateFileDownloads%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateFileDownloads) TypeID() uint32 { - return UpdateFileDownloadsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateFileDownloads) TypeName() string { - return "updateFileDownloads" -} - -// TypeInfo returns info about TL type. -func (u *UpdateFileDownloads) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateFileDownloads", - ID: UpdateFileDownloadsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalSize", - SchemaName: "total_size", - }, - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "DownloadedSize", - SchemaName: "downloaded_size", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateFileDownloads) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileDownloads#e8cd12c7 as nil") - } - b.PutID(UpdateFileDownloadsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateFileDownloads) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileDownloads#e8cd12c7 as nil") - } - b.PutInt53(u.TotalSize) - b.PutInt32(u.TotalCount) - b.PutInt53(u.DownloadedSize) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateFileDownloads) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileDownloads#e8cd12c7 to nil") - } - if err := b.ConsumeID(UpdateFileDownloadsTypeID); err != nil { - return fmt.Errorf("unable to decode updateFileDownloads#e8cd12c7: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateFileDownloads) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileDownloads#e8cd12c7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownloads#e8cd12c7: field total_size: %w", err) - } - u.TotalSize = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownloads#e8cd12c7: field total_count: %w", err) - } - u.TotalCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownloads#e8cd12c7: field downloaded_size: %w", err) - } - u.DownloadedSize = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateFileDownloads) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateFileDownloads#e8cd12c7 as nil") - } - b.ObjStart() - b.PutID("updateFileDownloads") - b.Comma() - b.FieldStart("total_size") - b.PutInt53(u.TotalSize) - b.Comma() - b.FieldStart("total_count") - b.PutInt32(u.TotalCount) - b.Comma() - b.FieldStart("downloaded_size") - b.PutInt53(u.DownloadedSize) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateFileDownloads) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateFileDownloads#e8cd12c7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateFileDownloads"); err != nil { - return fmt.Errorf("unable to decode updateFileDownloads#e8cd12c7: %w", err) - } - case "total_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownloads#e8cd12c7: field total_size: %w", err) - } - u.TotalSize = value - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownloads#e8cd12c7: field total_count: %w", err) - } - u.TotalCount = value - case "downloaded_size": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownloads#e8cd12c7: field downloaded_size: %w", err) - } - u.DownloadedSize = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalSize returns value of TotalSize field. -func (u *UpdateFileDownloads) GetTotalSize() (value int64) { - if u == nil { - return - } - return u.TotalSize -} - -// GetTotalCount returns value of TotalCount field. -func (u *UpdateFileDownloads) GetTotalCount() (value int32) { - if u == nil { - return - } - return u.TotalCount -} - -// GetDownloadedSize returns value of DownloadedSize field. -func (u *UpdateFileDownloads) GetDownloadedSize() (value int64) { - if u == nil { - return - } - return u.DownloadedSize -} - -// UpdateFileAddedToDownloads represents TL type `updateFileAddedToDownloads#5ff5921a`. -type UpdateFileAddedToDownloads struct { - // The added file download - FileDownload FileDownload - // New number of being downloaded and recently downloaded files found - Counts DownloadedFileCounts -} - -// UpdateFileAddedToDownloadsTypeID is TL type id of UpdateFileAddedToDownloads. -const UpdateFileAddedToDownloadsTypeID = 0x5ff5921a - -// construct implements constructor of UpdateClass. -func (u UpdateFileAddedToDownloads) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateFileAddedToDownloads. -var ( - _ bin.Encoder = &UpdateFileAddedToDownloads{} - _ bin.Decoder = &UpdateFileAddedToDownloads{} - _ bin.BareEncoder = &UpdateFileAddedToDownloads{} - _ bin.BareDecoder = &UpdateFileAddedToDownloads{} - - _ UpdateClass = &UpdateFileAddedToDownloads{} -) - -func (u *UpdateFileAddedToDownloads) Zero() bool { - if u == nil { - return true - } - if !(u.FileDownload.Zero()) { - return false - } - if !(u.Counts.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateFileAddedToDownloads) String() string { - if u == nil { - return "UpdateFileAddedToDownloads(nil)" - } - type Alias UpdateFileAddedToDownloads - return fmt.Sprintf("UpdateFileAddedToDownloads%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateFileAddedToDownloads) TypeID() uint32 { - return UpdateFileAddedToDownloadsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateFileAddedToDownloads) TypeName() string { - return "updateFileAddedToDownloads" -} - -// TypeInfo returns info about TL type. -func (u *UpdateFileAddedToDownloads) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateFileAddedToDownloads", - ID: UpdateFileAddedToDownloadsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileDownload", - SchemaName: "file_download", - }, - { - Name: "Counts", - SchemaName: "counts", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateFileAddedToDownloads) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileAddedToDownloads#5ff5921a as nil") - } - b.PutID(UpdateFileAddedToDownloadsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateFileAddedToDownloads) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileAddedToDownloads#5ff5921a as nil") - } - if err := u.FileDownload.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateFileAddedToDownloads#5ff5921a: field file_download: %w", err) - } - if err := u.Counts.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateFileAddedToDownloads#5ff5921a: field counts: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateFileAddedToDownloads) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileAddedToDownloads#5ff5921a to nil") - } - if err := b.ConsumeID(UpdateFileAddedToDownloadsTypeID); err != nil { - return fmt.Errorf("unable to decode updateFileAddedToDownloads#5ff5921a: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateFileAddedToDownloads) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileAddedToDownloads#5ff5921a to nil") - } - { - if err := u.FileDownload.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateFileAddedToDownloads#5ff5921a: field file_download: %w", err) - } - } - { - if err := u.Counts.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateFileAddedToDownloads#5ff5921a: field counts: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateFileAddedToDownloads) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateFileAddedToDownloads#5ff5921a as nil") - } - b.ObjStart() - b.PutID("updateFileAddedToDownloads") - b.Comma() - b.FieldStart("file_download") - if err := u.FileDownload.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateFileAddedToDownloads#5ff5921a: field file_download: %w", err) - } - b.Comma() - b.FieldStart("counts") - if err := u.Counts.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateFileAddedToDownloads#5ff5921a: field counts: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateFileAddedToDownloads) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateFileAddedToDownloads#5ff5921a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateFileAddedToDownloads"); err != nil { - return fmt.Errorf("unable to decode updateFileAddedToDownloads#5ff5921a: %w", err) - } - case "file_download": - if err := u.FileDownload.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateFileAddedToDownloads#5ff5921a: field file_download: %w", err) - } - case "counts": - if err := u.Counts.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateFileAddedToDownloads#5ff5921a: field counts: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFileDownload returns value of FileDownload field. -func (u *UpdateFileAddedToDownloads) GetFileDownload() (value FileDownload) { - if u == nil { - return - } - return u.FileDownload -} - -// GetCounts returns value of Counts field. -func (u *UpdateFileAddedToDownloads) GetCounts() (value DownloadedFileCounts) { - if u == nil { - return - } - return u.Counts -} - -// UpdateFileDownload represents TL type `updateFileDownload#342f83ca`. -type UpdateFileDownload struct { - // File identifier - FileID int32 - // Point in time (Unix timestamp) when the file downloading was completed; 0 if the file - // downloading isn't completed - CompleteDate int32 - // True, if downloading of the file is paused - IsPaused bool - // New number of being downloaded and recently downloaded files found - Counts DownloadedFileCounts -} - -// UpdateFileDownloadTypeID is TL type id of UpdateFileDownload. -const UpdateFileDownloadTypeID = 0x342f83ca - -// construct implements constructor of UpdateClass. -func (u UpdateFileDownload) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateFileDownload. -var ( - _ bin.Encoder = &UpdateFileDownload{} - _ bin.Decoder = &UpdateFileDownload{} - _ bin.BareEncoder = &UpdateFileDownload{} - _ bin.BareDecoder = &UpdateFileDownload{} - - _ UpdateClass = &UpdateFileDownload{} -) - -func (u *UpdateFileDownload) Zero() bool { - if u == nil { - return true - } - if !(u.FileID == 0) { - return false - } - if !(u.CompleteDate == 0) { - return false - } - if !(u.IsPaused == false) { - return false - } - if !(u.Counts.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateFileDownload) String() string { - if u == nil { - return "UpdateFileDownload(nil)" - } - type Alias UpdateFileDownload - return fmt.Sprintf("UpdateFileDownload%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateFileDownload) TypeID() uint32 { - return UpdateFileDownloadTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateFileDownload) TypeName() string { - return "updateFileDownload" -} - -// TypeInfo returns info about TL type. -func (u *UpdateFileDownload) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateFileDownload", - ID: UpdateFileDownloadTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "CompleteDate", - SchemaName: "complete_date", - }, - { - Name: "IsPaused", - SchemaName: "is_paused", - }, - { - Name: "Counts", - SchemaName: "counts", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateFileDownload) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileDownload#342f83ca as nil") - } - b.PutID(UpdateFileDownloadTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateFileDownload) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileDownload#342f83ca as nil") - } - b.PutInt32(u.FileID) - b.PutInt32(u.CompleteDate) - b.PutBool(u.IsPaused) - if err := u.Counts.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateFileDownload#342f83ca: field counts: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateFileDownload) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileDownload#342f83ca to nil") - } - if err := b.ConsumeID(UpdateFileDownloadTypeID); err != nil { - return fmt.Errorf("unable to decode updateFileDownload#342f83ca: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateFileDownload) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileDownload#342f83ca to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownload#342f83ca: field file_id: %w", err) - } - u.FileID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownload#342f83ca: field complete_date: %w", err) - } - u.CompleteDate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownload#342f83ca: field is_paused: %w", err) - } - u.IsPaused = value - } - { - if err := u.Counts.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateFileDownload#342f83ca: field counts: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateFileDownload) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateFileDownload#342f83ca as nil") - } - b.ObjStart() - b.PutID("updateFileDownload") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(u.FileID) - b.Comma() - b.FieldStart("complete_date") - b.PutInt32(u.CompleteDate) - b.Comma() - b.FieldStart("is_paused") - b.PutBool(u.IsPaused) - b.Comma() - b.FieldStart("counts") - if err := u.Counts.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateFileDownload#342f83ca: field counts: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateFileDownload) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateFileDownload#342f83ca to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateFileDownload"); err != nil { - return fmt.Errorf("unable to decode updateFileDownload#342f83ca: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownload#342f83ca: field file_id: %w", err) - } - u.FileID = value - case "complete_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownload#342f83ca: field complete_date: %w", err) - } - u.CompleteDate = value - case "is_paused": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateFileDownload#342f83ca: field is_paused: %w", err) - } - u.IsPaused = value - case "counts": - if err := u.Counts.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateFileDownload#342f83ca: field counts: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (u *UpdateFileDownload) GetFileID() (value int32) { - if u == nil { - return - } - return u.FileID -} - -// GetCompleteDate returns value of CompleteDate field. -func (u *UpdateFileDownload) GetCompleteDate() (value int32) { - if u == nil { - return - } - return u.CompleteDate -} - -// GetIsPaused returns value of IsPaused field. -func (u *UpdateFileDownload) GetIsPaused() (value bool) { - if u == nil { - return - } - return u.IsPaused -} - -// GetCounts returns value of Counts field. -func (u *UpdateFileDownload) GetCounts() (value DownloadedFileCounts) { - if u == nil { - return - } - return u.Counts -} - -// UpdateFileRemovedFromDownloads represents TL type `updateFileRemovedFromDownloads#6e7c14e8`. -type UpdateFileRemovedFromDownloads struct { - // File identifier - FileID int32 - // New number of being downloaded and recently downloaded files found - Counts DownloadedFileCounts -} - -// UpdateFileRemovedFromDownloadsTypeID is TL type id of UpdateFileRemovedFromDownloads. -const UpdateFileRemovedFromDownloadsTypeID = 0x6e7c14e8 - -// construct implements constructor of UpdateClass. -func (u UpdateFileRemovedFromDownloads) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateFileRemovedFromDownloads. -var ( - _ bin.Encoder = &UpdateFileRemovedFromDownloads{} - _ bin.Decoder = &UpdateFileRemovedFromDownloads{} - _ bin.BareEncoder = &UpdateFileRemovedFromDownloads{} - _ bin.BareDecoder = &UpdateFileRemovedFromDownloads{} - - _ UpdateClass = &UpdateFileRemovedFromDownloads{} -) - -func (u *UpdateFileRemovedFromDownloads) Zero() bool { - if u == nil { - return true - } - if !(u.FileID == 0) { - return false - } - if !(u.Counts.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateFileRemovedFromDownloads) String() string { - if u == nil { - return "UpdateFileRemovedFromDownloads(nil)" - } - type Alias UpdateFileRemovedFromDownloads - return fmt.Sprintf("UpdateFileRemovedFromDownloads%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateFileRemovedFromDownloads) TypeID() uint32 { - return UpdateFileRemovedFromDownloadsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateFileRemovedFromDownloads) TypeName() string { - return "updateFileRemovedFromDownloads" -} - -// TypeInfo returns info about TL type. -func (u *UpdateFileRemovedFromDownloads) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateFileRemovedFromDownloads", - ID: UpdateFileRemovedFromDownloadsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "FileID", - SchemaName: "file_id", - }, - { - Name: "Counts", - SchemaName: "counts", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateFileRemovedFromDownloads) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileRemovedFromDownloads#6e7c14e8 as nil") - } - b.PutID(UpdateFileRemovedFromDownloadsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateFileRemovedFromDownloads) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFileRemovedFromDownloads#6e7c14e8 as nil") - } - b.PutInt32(u.FileID) - if err := u.Counts.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateFileRemovedFromDownloads#6e7c14e8: field counts: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateFileRemovedFromDownloads) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileRemovedFromDownloads#6e7c14e8 to nil") - } - if err := b.ConsumeID(UpdateFileRemovedFromDownloadsTypeID); err != nil { - return fmt.Errorf("unable to decode updateFileRemovedFromDownloads#6e7c14e8: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateFileRemovedFromDownloads) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFileRemovedFromDownloads#6e7c14e8 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateFileRemovedFromDownloads#6e7c14e8: field file_id: %w", err) - } - u.FileID = value - } - { - if err := u.Counts.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateFileRemovedFromDownloads#6e7c14e8: field counts: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateFileRemovedFromDownloads) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateFileRemovedFromDownloads#6e7c14e8 as nil") - } - b.ObjStart() - b.PutID("updateFileRemovedFromDownloads") - b.Comma() - b.FieldStart("file_id") - b.PutInt32(u.FileID) - b.Comma() - b.FieldStart("counts") - if err := u.Counts.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateFileRemovedFromDownloads#6e7c14e8: field counts: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateFileRemovedFromDownloads) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateFileRemovedFromDownloads#6e7c14e8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateFileRemovedFromDownloads"); err != nil { - return fmt.Errorf("unable to decode updateFileRemovedFromDownloads#6e7c14e8: %w", err) - } - case "file_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateFileRemovedFromDownloads#6e7c14e8: field file_id: %w", err) - } - u.FileID = value - case "counts": - if err := u.Counts.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateFileRemovedFromDownloads#6e7c14e8: field counts: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetFileID returns value of FileID field. -func (u *UpdateFileRemovedFromDownloads) GetFileID() (value int32) { - if u == nil { - return - } - return u.FileID -} - -// GetCounts returns value of Counts field. -func (u *UpdateFileRemovedFromDownloads) GetCounts() (value DownloadedFileCounts) { - if u == nil { - return - } - return u.Counts -} - -// UpdateApplicationVerificationRequired represents TL type `updateApplicationVerificationRequired#c59c61d7`. -type UpdateApplicationVerificationRequired struct { - // Unique identifier for the verification process - VerificationID int64 - // Unique base64url-encoded nonce for the classic Play Integrity verification - // (https://developer.android.com/google/play/integrity/classic) for Android, - Nonce string - // Cloud project number to pass to the Play Integrity API on Android - CloudProjectNumber int64 -} - -// UpdateApplicationVerificationRequiredTypeID is TL type id of UpdateApplicationVerificationRequired. -const UpdateApplicationVerificationRequiredTypeID = 0xc59c61d7 - -// construct implements constructor of UpdateClass. -func (u UpdateApplicationVerificationRequired) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateApplicationVerificationRequired. -var ( - _ bin.Encoder = &UpdateApplicationVerificationRequired{} - _ bin.Decoder = &UpdateApplicationVerificationRequired{} - _ bin.BareEncoder = &UpdateApplicationVerificationRequired{} - _ bin.BareDecoder = &UpdateApplicationVerificationRequired{} - - _ UpdateClass = &UpdateApplicationVerificationRequired{} -) - -func (u *UpdateApplicationVerificationRequired) Zero() bool { - if u == nil { - return true - } - if !(u.VerificationID == 0) { - return false - } - if !(u.Nonce == "") { - return false - } - if !(u.CloudProjectNumber == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateApplicationVerificationRequired) String() string { - if u == nil { - return "UpdateApplicationVerificationRequired(nil)" - } - type Alias UpdateApplicationVerificationRequired - return fmt.Sprintf("UpdateApplicationVerificationRequired%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateApplicationVerificationRequired) TypeID() uint32 { - return UpdateApplicationVerificationRequiredTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateApplicationVerificationRequired) TypeName() string { - return "updateApplicationVerificationRequired" -} - -// TypeInfo returns info about TL type. -func (u *UpdateApplicationVerificationRequired) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateApplicationVerificationRequired", - ID: UpdateApplicationVerificationRequiredTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "VerificationID", - SchemaName: "verification_id", - }, - { - Name: "Nonce", - SchemaName: "nonce", - }, - { - Name: "CloudProjectNumber", - SchemaName: "cloud_project_number", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateApplicationVerificationRequired) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateApplicationVerificationRequired#c59c61d7 as nil") - } - b.PutID(UpdateApplicationVerificationRequiredTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateApplicationVerificationRequired) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateApplicationVerificationRequired#c59c61d7 as nil") - } - b.PutInt53(u.VerificationID) - b.PutString(u.Nonce) - b.PutLong(u.CloudProjectNumber) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateApplicationVerificationRequired) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateApplicationVerificationRequired#c59c61d7 to nil") - } - if err := b.ConsumeID(UpdateApplicationVerificationRequiredTypeID); err != nil { - return fmt.Errorf("unable to decode updateApplicationVerificationRequired#c59c61d7: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateApplicationVerificationRequired) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateApplicationVerificationRequired#c59c61d7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateApplicationVerificationRequired#c59c61d7: field verification_id: %w", err) - } - u.VerificationID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateApplicationVerificationRequired#c59c61d7: field nonce: %w", err) - } - u.Nonce = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateApplicationVerificationRequired#c59c61d7: field cloud_project_number: %w", err) - } - u.CloudProjectNumber = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateApplicationVerificationRequired) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateApplicationVerificationRequired#c59c61d7 as nil") - } - b.ObjStart() - b.PutID("updateApplicationVerificationRequired") - b.Comma() - b.FieldStart("verification_id") - b.PutInt53(u.VerificationID) - b.Comma() - b.FieldStart("nonce") - b.PutString(u.Nonce) - b.Comma() - b.FieldStart("cloud_project_number") - b.PutLong(u.CloudProjectNumber) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateApplicationVerificationRequired) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateApplicationVerificationRequired#c59c61d7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateApplicationVerificationRequired"); err != nil { - return fmt.Errorf("unable to decode updateApplicationVerificationRequired#c59c61d7: %w", err) - } - case "verification_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateApplicationVerificationRequired#c59c61d7: field verification_id: %w", err) - } - u.VerificationID = value - case "nonce": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateApplicationVerificationRequired#c59c61d7: field nonce: %w", err) - } - u.Nonce = value - case "cloud_project_number": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateApplicationVerificationRequired#c59c61d7: field cloud_project_number: %w", err) - } - u.CloudProjectNumber = value - default: - return b.Skip() - } - return nil - }) -} - -// GetVerificationID returns value of VerificationID field. -func (u *UpdateApplicationVerificationRequired) GetVerificationID() (value int64) { - if u == nil { - return - } - return u.VerificationID -} - -// GetNonce returns value of Nonce field. -func (u *UpdateApplicationVerificationRequired) GetNonce() (value string) { - if u == nil { - return - } - return u.Nonce -} - -// GetCloudProjectNumber returns value of CloudProjectNumber field. -func (u *UpdateApplicationVerificationRequired) GetCloudProjectNumber() (value int64) { - if u == nil { - return - } - return u.CloudProjectNumber -} - -// UpdateCall represents TL type `updateCall#4fb3d0dd`. -type UpdateCall struct { - // New data about a call - Call Call -} - -// UpdateCallTypeID is TL type id of UpdateCall. -const UpdateCallTypeID = 0x4fb3d0dd - -// construct implements constructor of UpdateClass. -func (u UpdateCall) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateCall. -var ( - _ bin.Encoder = &UpdateCall{} - _ bin.Decoder = &UpdateCall{} - _ bin.BareEncoder = &UpdateCall{} - _ bin.BareDecoder = &UpdateCall{} - - _ UpdateClass = &UpdateCall{} -) - -func (u *UpdateCall) Zero() bool { - if u == nil { - return true - } - if !(u.Call.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateCall) String() string { - if u == nil { - return "UpdateCall(nil)" - } - type Alias UpdateCall - return fmt.Sprintf("UpdateCall%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateCall) TypeID() uint32 { - return UpdateCallTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateCall) TypeName() string { - return "updateCall" -} - -// TypeInfo returns info about TL type. -func (u *UpdateCall) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateCall", - ID: UpdateCallTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Call", - SchemaName: "call", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateCall) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateCall#4fb3d0dd as nil") - } - b.PutID(UpdateCallTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateCall) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateCall#4fb3d0dd as nil") - } - if err := u.Call.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateCall#4fb3d0dd: field call: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateCall) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateCall#4fb3d0dd to nil") - } - if err := b.ConsumeID(UpdateCallTypeID); err != nil { - return fmt.Errorf("unable to decode updateCall#4fb3d0dd: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateCall) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateCall#4fb3d0dd to nil") - } - { - if err := u.Call.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateCall#4fb3d0dd: field call: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateCall) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateCall#4fb3d0dd as nil") - } - b.ObjStart() - b.PutID("updateCall") - b.Comma() - b.FieldStart("call") - if err := u.Call.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateCall#4fb3d0dd: field call: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateCall) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateCall#4fb3d0dd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateCall"); err != nil { - return fmt.Errorf("unable to decode updateCall#4fb3d0dd: %w", err) - } - case "call": - if err := u.Call.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateCall#4fb3d0dd: field call: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCall returns value of Call field. -func (u *UpdateCall) GetCall() (value Call) { - if u == nil { - return - } - return u.Call -} - -// UpdateGroupCall represents TL type `updateGroupCall#30324e00`. -type UpdateGroupCall struct { - // New data about a group call - GroupCall GroupCall -} - -// UpdateGroupCallTypeID is TL type id of UpdateGroupCall. -const UpdateGroupCallTypeID = 0x30324e00 - -// construct implements constructor of UpdateClass. -func (u UpdateGroupCall) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateGroupCall. -var ( - _ bin.Encoder = &UpdateGroupCall{} - _ bin.Decoder = &UpdateGroupCall{} - _ bin.BareEncoder = &UpdateGroupCall{} - _ bin.BareDecoder = &UpdateGroupCall{} - - _ UpdateClass = &UpdateGroupCall{} -) - -func (u *UpdateGroupCall) Zero() bool { - if u == nil { - return true - } - if !(u.GroupCall.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateGroupCall) String() string { - if u == nil { - return "UpdateGroupCall(nil)" - } - type Alias UpdateGroupCall - return fmt.Sprintf("UpdateGroupCall%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateGroupCall) TypeID() uint32 { - return UpdateGroupCallTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateGroupCall) TypeName() string { - return "updateGroupCall" -} - -// TypeInfo returns info about TL type. -func (u *UpdateGroupCall) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateGroupCall", - ID: UpdateGroupCallTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCall", - SchemaName: "group_call", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateGroupCall) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateGroupCall#30324e00 as nil") - } - b.PutID(UpdateGroupCallTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateGroupCall) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateGroupCall#30324e00 as nil") - } - if err := u.GroupCall.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateGroupCall#30324e00: field group_call: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateGroupCall) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateGroupCall#30324e00 to nil") - } - if err := b.ConsumeID(UpdateGroupCallTypeID); err != nil { - return fmt.Errorf("unable to decode updateGroupCall#30324e00: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateGroupCall) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateGroupCall#30324e00 to nil") - } - { - if err := u.GroupCall.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateGroupCall#30324e00: field group_call: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateGroupCall) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateGroupCall#30324e00 as nil") - } - b.ObjStart() - b.PutID("updateGroupCall") - b.Comma() - b.FieldStart("group_call") - if err := u.GroupCall.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateGroupCall#30324e00: field group_call: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateGroupCall) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateGroupCall#30324e00 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateGroupCall"); err != nil { - return fmt.Errorf("unable to decode updateGroupCall#30324e00: %w", err) - } - case "group_call": - if err := u.GroupCall.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateGroupCall#30324e00: field group_call: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCall returns value of GroupCall field. -func (u *UpdateGroupCall) GetGroupCall() (value GroupCall) { - if u == nil { - return - } - return u.GroupCall -} - -// UpdateGroupCallParticipant represents TL type `updateGroupCallParticipant#d0213cf9`. -type UpdateGroupCallParticipant struct { - // Identifier of group call - GroupCallID int32 - // New data about a participant - Participant GroupCallParticipant -} - -// UpdateGroupCallParticipantTypeID is TL type id of UpdateGroupCallParticipant. -const UpdateGroupCallParticipantTypeID = 0xd0213cf9 - -// construct implements constructor of UpdateClass. -func (u UpdateGroupCallParticipant) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateGroupCallParticipant. -var ( - _ bin.Encoder = &UpdateGroupCallParticipant{} - _ bin.Decoder = &UpdateGroupCallParticipant{} - _ bin.BareEncoder = &UpdateGroupCallParticipant{} - _ bin.BareDecoder = &UpdateGroupCallParticipant{} - - _ UpdateClass = &UpdateGroupCallParticipant{} -) - -func (u *UpdateGroupCallParticipant) Zero() bool { - if u == nil { - return true - } - if !(u.GroupCallID == 0) { - return false - } - if !(u.Participant.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateGroupCallParticipant) String() string { - if u == nil { - return "UpdateGroupCallParticipant(nil)" - } - type Alias UpdateGroupCallParticipant - return fmt.Sprintf("UpdateGroupCallParticipant%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateGroupCallParticipant) TypeID() uint32 { - return UpdateGroupCallParticipantTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateGroupCallParticipant) TypeName() string { - return "updateGroupCallParticipant" -} - -// TypeInfo returns info about TL type. -func (u *UpdateGroupCallParticipant) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateGroupCallParticipant", - ID: UpdateGroupCallParticipantTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "Participant", - SchemaName: "participant", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateGroupCallParticipant) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateGroupCallParticipant#d0213cf9 as nil") - } - b.PutID(UpdateGroupCallParticipantTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateGroupCallParticipant) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateGroupCallParticipant#d0213cf9 as nil") - } - b.PutInt32(u.GroupCallID) - if err := u.Participant.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateGroupCallParticipant#d0213cf9: field participant: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateGroupCallParticipant) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateGroupCallParticipant#d0213cf9 to nil") - } - if err := b.ConsumeID(UpdateGroupCallParticipantTypeID); err != nil { - return fmt.Errorf("unable to decode updateGroupCallParticipant#d0213cf9: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateGroupCallParticipant) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateGroupCallParticipant#d0213cf9 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateGroupCallParticipant#d0213cf9: field group_call_id: %w", err) - } - u.GroupCallID = value - } - { - if err := u.Participant.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateGroupCallParticipant#d0213cf9: field participant: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateGroupCallParticipant) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateGroupCallParticipant#d0213cf9 as nil") - } - b.ObjStart() - b.PutID("updateGroupCallParticipant") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(u.GroupCallID) - b.Comma() - b.FieldStart("participant") - if err := u.Participant.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateGroupCallParticipant#d0213cf9: field participant: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateGroupCallParticipant) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateGroupCallParticipant#d0213cf9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateGroupCallParticipant"); err != nil { - return fmt.Errorf("unable to decode updateGroupCallParticipant#d0213cf9: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateGroupCallParticipant#d0213cf9: field group_call_id: %w", err) - } - u.GroupCallID = value - case "participant": - if err := u.Participant.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateGroupCallParticipant#d0213cf9: field participant: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (u *UpdateGroupCallParticipant) GetGroupCallID() (value int32) { - if u == nil { - return - } - return u.GroupCallID -} - -// GetParticipant returns value of Participant field. -func (u *UpdateGroupCallParticipant) GetParticipant() (value GroupCallParticipant) { - if u == nil { - return - } - return u.Participant -} - -// UpdateNewCallSignalingData represents TL type `updateNewCallSignalingData#22c98d8d`. -type UpdateNewCallSignalingData struct { - // The call identifier - CallID int32 - // The data - Data []byte -} - -// UpdateNewCallSignalingDataTypeID is TL type id of UpdateNewCallSignalingData. -const UpdateNewCallSignalingDataTypeID = 0x22c98d8d - -// construct implements constructor of UpdateClass. -func (u UpdateNewCallSignalingData) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewCallSignalingData. -var ( - _ bin.Encoder = &UpdateNewCallSignalingData{} - _ bin.Decoder = &UpdateNewCallSignalingData{} - _ bin.BareEncoder = &UpdateNewCallSignalingData{} - _ bin.BareDecoder = &UpdateNewCallSignalingData{} - - _ UpdateClass = &UpdateNewCallSignalingData{} -) - -func (u *UpdateNewCallSignalingData) Zero() bool { - if u == nil { - return true - } - if !(u.CallID == 0) { - return false - } - if !(u.Data == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewCallSignalingData) String() string { - if u == nil { - return "UpdateNewCallSignalingData(nil)" - } - type Alias UpdateNewCallSignalingData - return fmt.Sprintf("UpdateNewCallSignalingData%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewCallSignalingData) TypeID() uint32 { - return UpdateNewCallSignalingDataTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewCallSignalingData) TypeName() string { - return "updateNewCallSignalingData" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewCallSignalingData) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewCallSignalingData", - ID: UpdateNewCallSignalingDataTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CallID", - SchemaName: "call_id", - }, - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewCallSignalingData) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCallSignalingData#22c98d8d as nil") - } - b.PutID(UpdateNewCallSignalingDataTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewCallSignalingData) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCallSignalingData#22c98d8d as nil") - } - b.PutInt32(u.CallID) - b.PutBytes(u.Data) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewCallSignalingData) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCallSignalingData#22c98d8d to nil") - } - if err := b.ConsumeID(UpdateNewCallSignalingDataTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewCallSignalingData#22c98d8d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewCallSignalingData) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCallSignalingData#22c98d8d to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallSignalingData#22c98d8d: field call_id: %w", err) - } - u.CallID = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallSignalingData#22c98d8d: field data: %w", err) - } - u.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewCallSignalingData) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCallSignalingData#22c98d8d as nil") - } - b.ObjStart() - b.PutID("updateNewCallSignalingData") - b.Comma() - b.FieldStart("call_id") - b.PutInt32(u.CallID) - b.Comma() - b.FieldStart("data") - b.PutBytes(u.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewCallSignalingData) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCallSignalingData#22c98d8d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewCallSignalingData"); err != nil { - return fmt.Errorf("unable to decode updateNewCallSignalingData#22c98d8d: %w", err) - } - case "call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallSignalingData#22c98d8d: field call_id: %w", err) - } - u.CallID = value - case "data": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallSignalingData#22c98d8d: field data: %w", err) - } - u.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCallID returns value of CallID field. -func (u *UpdateNewCallSignalingData) GetCallID() (value int32) { - if u == nil { - return - } - return u.CallID -} - -// GetData returns value of Data field. -func (u *UpdateNewCallSignalingData) GetData() (value []byte) { - if u == nil { - return - } - return u.Data -} - -// UpdateUserPrivacySettingRules represents TL type `updateUserPrivacySettingRules#c99552f6`. -type UpdateUserPrivacySettingRules struct { - // The privacy setting - Setting UserPrivacySettingClass - // New privacy rules - Rules UserPrivacySettingRules -} - -// UpdateUserPrivacySettingRulesTypeID is TL type id of UpdateUserPrivacySettingRules. -const UpdateUserPrivacySettingRulesTypeID = 0xc99552f6 - -// construct implements constructor of UpdateClass. -func (u UpdateUserPrivacySettingRules) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateUserPrivacySettingRules. -var ( - _ bin.Encoder = &UpdateUserPrivacySettingRules{} - _ bin.Decoder = &UpdateUserPrivacySettingRules{} - _ bin.BareEncoder = &UpdateUserPrivacySettingRules{} - _ bin.BareDecoder = &UpdateUserPrivacySettingRules{} - - _ UpdateClass = &UpdateUserPrivacySettingRules{} -) - -func (u *UpdateUserPrivacySettingRules) Zero() bool { - if u == nil { - return true - } - if !(u.Setting == nil) { - return false - } - if !(u.Rules.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateUserPrivacySettingRules) String() string { - if u == nil { - return "UpdateUserPrivacySettingRules(nil)" - } - type Alias UpdateUserPrivacySettingRules - return fmt.Sprintf("UpdateUserPrivacySettingRules%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateUserPrivacySettingRules) TypeID() uint32 { - return UpdateUserPrivacySettingRulesTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateUserPrivacySettingRules) TypeName() string { - return "updateUserPrivacySettingRules" -} - -// TypeInfo returns info about TL type. -func (u *UpdateUserPrivacySettingRules) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateUserPrivacySettingRules", - ID: UpdateUserPrivacySettingRulesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Setting", - SchemaName: "setting", - }, - { - Name: "Rules", - SchemaName: "rules", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateUserPrivacySettingRules) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUserPrivacySettingRules#c99552f6 as nil") - } - b.PutID(UpdateUserPrivacySettingRulesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateUserPrivacySettingRules) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUserPrivacySettingRules#c99552f6 as nil") - } - if u.Setting == nil { - return fmt.Errorf("unable to encode updateUserPrivacySettingRules#c99552f6: field setting is nil") - } - if err := u.Setting.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateUserPrivacySettingRules#c99552f6: field setting: %w", err) - } - if err := u.Rules.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateUserPrivacySettingRules#c99552f6: field rules: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateUserPrivacySettingRules) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUserPrivacySettingRules#c99552f6 to nil") - } - if err := b.ConsumeID(UpdateUserPrivacySettingRulesTypeID); err != nil { - return fmt.Errorf("unable to decode updateUserPrivacySettingRules#c99552f6: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateUserPrivacySettingRules) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUserPrivacySettingRules#c99552f6 to nil") - } - { - value, err := DecodeUserPrivacySetting(b) - if err != nil { - return fmt.Errorf("unable to decode updateUserPrivacySettingRules#c99552f6: field setting: %w", err) - } - u.Setting = value - } - { - if err := u.Rules.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateUserPrivacySettingRules#c99552f6: field rules: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateUserPrivacySettingRules) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateUserPrivacySettingRules#c99552f6 as nil") - } - b.ObjStart() - b.PutID("updateUserPrivacySettingRules") - b.Comma() - b.FieldStart("setting") - if u.Setting == nil { - return fmt.Errorf("unable to encode updateUserPrivacySettingRules#c99552f6: field setting is nil") - } - if err := u.Setting.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateUserPrivacySettingRules#c99552f6: field setting: %w", err) - } - b.Comma() - b.FieldStart("rules") - if err := u.Rules.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateUserPrivacySettingRules#c99552f6: field rules: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateUserPrivacySettingRules) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateUserPrivacySettingRules#c99552f6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateUserPrivacySettingRules"); err != nil { - return fmt.Errorf("unable to decode updateUserPrivacySettingRules#c99552f6: %w", err) - } - case "setting": - value, err := DecodeTDLibJSONUserPrivacySetting(b) - if err != nil { - return fmt.Errorf("unable to decode updateUserPrivacySettingRules#c99552f6: field setting: %w", err) - } - u.Setting = value - case "rules": - if err := u.Rules.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateUserPrivacySettingRules#c99552f6: field rules: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSetting returns value of Setting field. -func (u *UpdateUserPrivacySettingRules) GetSetting() (value UserPrivacySettingClass) { - if u == nil { - return - } - return u.Setting -} - -// GetRules returns value of Rules field. -func (u *UpdateUserPrivacySettingRules) GetRules() (value UserPrivacySettingRules) { - if u == nil { - return - } - return u.Rules -} - -// UpdateUnreadMessageCount represents TL type `updateUnreadMessageCount#4b541c9`. -type UpdateUnreadMessageCount struct { - // The chat list with changed number of unread messages - ChatList ChatListClass - // Total number of unread messages - UnreadCount int32 - // Total number of unread messages in unmuted chats - UnreadUnmutedCount int32 -} - -// UpdateUnreadMessageCountTypeID is TL type id of UpdateUnreadMessageCount. -const UpdateUnreadMessageCountTypeID = 0x4b541c9 - -// construct implements constructor of UpdateClass. -func (u UpdateUnreadMessageCount) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateUnreadMessageCount. -var ( - _ bin.Encoder = &UpdateUnreadMessageCount{} - _ bin.Decoder = &UpdateUnreadMessageCount{} - _ bin.BareEncoder = &UpdateUnreadMessageCount{} - _ bin.BareDecoder = &UpdateUnreadMessageCount{} - - _ UpdateClass = &UpdateUnreadMessageCount{} -) - -func (u *UpdateUnreadMessageCount) Zero() bool { - if u == nil { - return true - } - if !(u.ChatList == nil) { - return false - } - if !(u.UnreadCount == 0) { - return false - } - if !(u.UnreadUnmutedCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateUnreadMessageCount) String() string { - if u == nil { - return "UpdateUnreadMessageCount(nil)" - } - type Alias UpdateUnreadMessageCount - return fmt.Sprintf("UpdateUnreadMessageCount%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateUnreadMessageCount) TypeID() uint32 { - return UpdateUnreadMessageCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateUnreadMessageCount) TypeName() string { - return "updateUnreadMessageCount" -} - -// TypeInfo returns info about TL type. -func (u *UpdateUnreadMessageCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateUnreadMessageCount", - ID: UpdateUnreadMessageCountTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatList", - SchemaName: "chat_list", - }, - { - Name: "UnreadCount", - SchemaName: "unread_count", - }, - { - Name: "UnreadUnmutedCount", - SchemaName: "unread_unmuted_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateUnreadMessageCount) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUnreadMessageCount#4b541c9 as nil") - } - b.PutID(UpdateUnreadMessageCountTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateUnreadMessageCount) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUnreadMessageCount#4b541c9 as nil") - } - if u.ChatList == nil { - return fmt.Errorf("unable to encode updateUnreadMessageCount#4b541c9: field chat_list is nil") - } - if err := u.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateUnreadMessageCount#4b541c9: field chat_list: %w", err) - } - b.PutInt32(u.UnreadCount) - b.PutInt32(u.UnreadUnmutedCount) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateUnreadMessageCount) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUnreadMessageCount#4b541c9 to nil") - } - if err := b.ConsumeID(UpdateUnreadMessageCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateUnreadMessageCount#4b541c9: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateUnreadMessageCount) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUnreadMessageCount#4b541c9 to nil") - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode updateUnreadMessageCount#4b541c9: field chat_list: %w", err) - } - u.ChatList = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadMessageCount#4b541c9: field unread_count: %w", err) - } - u.UnreadCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadMessageCount#4b541c9: field unread_unmuted_count: %w", err) - } - u.UnreadUnmutedCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateUnreadMessageCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateUnreadMessageCount#4b541c9 as nil") - } - b.ObjStart() - b.PutID("updateUnreadMessageCount") - b.Comma() - b.FieldStart("chat_list") - if u.ChatList == nil { - return fmt.Errorf("unable to encode updateUnreadMessageCount#4b541c9: field chat_list is nil") - } - if err := u.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateUnreadMessageCount#4b541c9: field chat_list: %w", err) - } - b.Comma() - b.FieldStart("unread_count") - b.PutInt32(u.UnreadCount) - b.Comma() - b.FieldStart("unread_unmuted_count") - b.PutInt32(u.UnreadUnmutedCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateUnreadMessageCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateUnreadMessageCount#4b541c9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateUnreadMessageCount"); err != nil { - return fmt.Errorf("unable to decode updateUnreadMessageCount#4b541c9: %w", err) - } - case "chat_list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode updateUnreadMessageCount#4b541c9: field chat_list: %w", err) - } - u.ChatList = value - case "unread_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadMessageCount#4b541c9: field unread_count: %w", err) - } - u.UnreadCount = value - case "unread_unmuted_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadMessageCount#4b541c9: field unread_unmuted_count: %w", err) - } - u.UnreadUnmutedCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatList returns value of ChatList field. -func (u *UpdateUnreadMessageCount) GetChatList() (value ChatListClass) { - if u == nil { - return - } - return u.ChatList -} - -// GetUnreadCount returns value of UnreadCount field. -func (u *UpdateUnreadMessageCount) GetUnreadCount() (value int32) { - if u == nil { - return - } - return u.UnreadCount -} - -// GetUnreadUnmutedCount returns value of UnreadUnmutedCount field. -func (u *UpdateUnreadMessageCount) GetUnreadUnmutedCount() (value int32) { - if u == nil { - return - } - return u.UnreadUnmutedCount -} - -// UpdateUnreadChatCount represents TL type `updateUnreadChatCount#76e19242`. -type UpdateUnreadChatCount struct { - // The chat list with changed number of unread messages - ChatList ChatListClass - // Approximate total number of chats in the chat list - TotalCount int32 - // Total number of unread chats - UnreadCount int32 - // Total number of unread unmuted chats - UnreadUnmutedCount int32 - // Total number of chats marked as unread - MarkedAsUnreadCount int32 - // Total number of unmuted chats marked as unread - MarkedAsUnreadUnmutedCount int32 -} - -// UpdateUnreadChatCountTypeID is TL type id of UpdateUnreadChatCount. -const UpdateUnreadChatCountTypeID = 0x76e19242 - -// construct implements constructor of UpdateClass. -func (u UpdateUnreadChatCount) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateUnreadChatCount. -var ( - _ bin.Encoder = &UpdateUnreadChatCount{} - _ bin.Decoder = &UpdateUnreadChatCount{} - _ bin.BareEncoder = &UpdateUnreadChatCount{} - _ bin.BareDecoder = &UpdateUnreadChatCount{} - - _ UpdateClass = &UpdateUnreadChatCount{} -) - -func (u *UpdateUnreadChatCount) Zero() bool { - if u == nil { - return true - } - if !(u.ChatList == nil) { - return false - } - if !(u.TotalCount == 0) { - return false - } - if !(u.UnreadCount == 0) { - return false - } - if !(u.UnreadUnmutedCount == 0) { - return false - } - if !(u.MarkedAsUnreadCount == 0) { - return false - } - if !(u.MarkedAsUnreadUnmutedCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateUnreadChatCount) String() string { - if u == nil { - return "UpdateUnreadChatCount(nil)" - } - type Alias UpdateUnreadChatCount - return fmt.Sprintf("UpdateUnreadChatCount%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateUnreadChatCount) TypeID() uint32 { - return UpdateUnreadChatCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateUnreadChatCount) TypeName() string { - return "updateUnreadChatCount" -} - -// TypeInfo returns info about TL type. -func (u *UpdateUnreadChatCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateUnreadChatCount", - ID: UpdateUnreadChatCountTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatList", - SchemaName: "chat_list", - }, - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "UnreadCount", - SchemaName: "unread_count", - }, - { - Name: "UnreadUnmutedCount", - SchemaName: "unread_unmuted_count", - }, - { - Name: "MarkedAsUnreadCount", - SchemaName: "marked_as_unread_count", - }, - { - Name: "MarkedAsUnreadUnmutedCount", - SchemaName: "marked_as_unread_unmuted_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateUnreadChatCount) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUnreadChatCount#76e19242 as nil") - } - b.PutID(UpdateUnreadChatCountTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateUnreadChatCount) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUnreadChatCount#76e19242 as nil") - } - if u.ChatList == nil { - return fmt.Errorf("unable to encode updateUnreadChatCount#76e19242: field chat_list is nil") - } - if err := u.ChatList.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateUnreadChatCount#76e19242: field chat_list: %w", err) - } - b.PutInt32(u.TotalCount) - b.PutInt32(u.UnreadCount) - b.PutInt32(u.UnreadUnmutedCount) - b.PutInt32(u.MarkedAsUnreadCount) - b.PutInt32(u.MarkedAsUnreadUnmutedCount) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateUnreadChatCount) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUnreadChatCount#76e19242 to nil") - } - if err := b.ConsumeID(UpdateUnreadChatCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateUnreadChatCount) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUnreadChatCount#76e19242 to nil") - } - { - value, err := DecodeChatList(b) - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field chat_list: %w", err) - } - u.ChatList = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field total_count: %w", err) - } - u.TotalCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field unread_count: %w", err) - } - u.UnreadCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field unread_unmuted_count: %w", err) - } - u.UnreadUnmutedCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field marked_as_unread_count: %w", err) - } - u.MarkedAsUnreadCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field marked_as_unread_unmuted_count: %w", err) - } - u.MarkedAsUnreadUnmutedCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateUnreadChatCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateUnreadChatCount#76e19242 as nil") - } - b.ObjStart() - b.PutID("updateUnreadChatCount") - b.Comma() - b.FieldStart("chat_list") - if u.ChatList == nil { - return fmt.Errorf("unable to encode updateUnreadChatCount#76e19242: field chat_list is nil") - } - if err := u.ChatList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateUnreadChatCount#76e19242: field chat_list: %w", err) - } - b.Comma() - b.FieldStart("total_count") - b.PutInt32(u.TotalCount) - b.Comma() - b.FieldStart("unread_count") - b.PutInt32(u.UnreadCount) - b.Comma() - b.FieldStart("unread_unmuted_count") - b.PutInt32(u.UnreadUnmutedCount) - b.Comma() - b.FieldStart("marked_as_unread_count") - b.PutInt32(u.MarkedAsUnreadCount) - b.Comma() - b.FieldStart("marked_as_unread_unmuted_count") - b.PutInt32(u.MarkedAsUnreadUnmutedCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateUnreadChatCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateUnreadChatCount#76e19242 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateUnreadChatCount"); err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: %w", err) - } - case "chat_list": - value, err := DecodeTDLibJSONChatList(b) - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field chat_list: %w", err) - } - u.ChatList = value - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field total_count: %w", err) - } - u.TotalCount = value - case "unread_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field unread_count: %w", err) - } - u.UnreadCount = value - case "unread_unmuted_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field unread_unmuted_count: %w", err) - } - u.UnreadUnmutedCount = value - case "marked_as_unread_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field marked_as_unread_count: %w", err) - } - u.MarkedAsUnreadCount = value - case "marked_as_unread_unmuted_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateUnreadChatCount#76e19242: field marked_as_unread_unmuted_count: %w", err) - } - u.MarkedAsUnreadUnmutedCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatList returns value of ChatList field. -func (u *UpdateUnreadChatCount) GetChatList() (value ChatListClass) { - if u == nil { - return - } - return u.ChatList -} - -// GetTotalCount returns value of TotalCount field. -func (u *UpdateUnreadChatCount) GetTotalCount() (value int32) { - if u == nil { - return - } - return u.TotalCount -} - -// GetUnreadCount returns value of UnreadCount field. -func (u *UpdateUnreadChatCount) GetUnreadCount() (value int32) { - if u == nil { - return - } - return u.UnreadCount -} - -// GetUnreadUnmutedCount returns value of UnreadUnmutedCount field. -func (u *UpdateUnreadChatCount) GetUnreadUnmutedCount() (value int32) { - if u == nil { - return - } - return u.UnreadUnmutedCount -} - -// GetMarkedAsUnreadCount returns value of MarkedAsUnreadCount field. -func (u *UpdateUnreadChatCount) GetMarkedAsUnreadCount() (value int32) { - if u == nil { - return - } - return u.MarkedAsUnreadCount -} - -// GetMarkedAsUnreadUnmutedCount returns value of MarkedAsUnreadUnmutedCount field. -func (u *UpdateUnreadChatCount) GetMarkedAsUnreadUnmutedCount() (value int32) { - if u == nil { - return - } - return u.MarkedAsUnreadUnmutedCount -} - -// UpdateStory represents TL type `updateStory#1906572f`. -type UpdateStory struct { - // The new information about the story - Story Story -} - -// UpdateStoryTypeID is TL type id of UpdateStory. -const UpdateStoryTypeID = 0x1906572f - -// construct implements constructor of UpdateClass. -func (u UpdateStory) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateStory. -var ( - _ bin.Encoder = &UpdateStory{} - _ bin.Decoder = &UpdateStory{} - _ bin.BareEncoder = &UpdateStory{} - _ bin.BareDecoder = &UpdateStory{} - - _ UpdateClass = &UpdateStory{} -) - -func (u *UpdateStory) Zero() bool { - if u == nil { - return true - } - if !(u.Story.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateStory) String() string { - if u == nil { - return "UpdateStory(nil)" - } - type Alias UpdateStory - return fmt.Sprintf("UpdateStory%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateStory) TypeID() uint32 { - return UpdateStoryTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateStory) TypeName() string { - return "updateStory" -} - -// TypeInfo returns info about TL type. -func (u *UpdateStory) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateStory", - ID: UpdateStoryTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Story", - SchemaName: "story", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateStory) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStory#1906572f as nil") - } - b.PutID(UpdateStoryTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateStory) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStory#1906572f as nil") - } - if err := u.Story.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateStory#1906572f: field story: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateStory) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStory#1906572f to nil") - } - if err := b.ConsumeID(UpdateStoryTypeID); err != nil { - return fmt.Errorf("unable to decode updateStory#1906572f: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateStory) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStory#1906572f to nil") - } - { - if err := u.Story.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateStory#1906572f: field story: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateStory) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateStory#1906572f as nil") - } - b.ObjStart() - b.PutID("updateStory") - b.Comma() - b.FieldStart("story") - if err := u.Story.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateStory#1906572f: field story: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateStory) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateStory#1906572f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateStory"); err != nil { - return fmt.Errorf("unable to decode updateStory#1906572f: %w", err) - } - case "story": - if err := u.Story.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateStory#1906572f: field story: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStory returns value of Story field. -func (u *UpdateStory) GetStory() (value Story) { - if u == nil { - return - } - return u.Story -} - -// UpdateStoryDeleted represents TL type `updateStoryDeleted#7007eb9d`. -type UpdateStoryDeleted struct { - // Identifier of the chat that posted the story - StorySenderChatID int64 - // Story identifier - StoryID int32 -} - -// UpdateStoryDeletedTypeID is TL type id of UpdateStoryDeleted. -const UpdateStoryDeletedTypeID = 0x7007eb9d - -// construct implements constructor of UpdateClass. -func (u UpdateStoryDeleted) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateStoryDeleted. -var ( - _ bin.Encoder = &UpdateStoryDeleted{} - _ bin.Decoder = &UpdateStoryDeleted{} - _ bin.BareEncoder = &UpdateStoryDeleted{} - _ bin.BareDecoder = &UpdateStoryDeleted{} - - _ UpdateClass = &UpdateStoryDeleted{} -) - -func (u *UpdateStoryDeleted) Zero() bool { - if u == nil { - return true - } - if !(u.StorySenderChatID == 0) { - return false - } - if !(u.StoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateStoryDeleted) String() string { - if u == nil { - return "UpdateStoryDeleted(nil)" - } - type Alias UpdateStoryDeleted - return fmt.Sprintf("UpdateStoryDeleted%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateStoryDeleted) TypeID() uint32 { - return UpdateStoryDeletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateStoryDeleted) TypeName() string { - return "updateStoryDeleted" -} - -// TypeInfo returns info about TL type. -func (u *UpdateStoryDeleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateStoryDeleted", - ID: UpdateStoryDeletedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StorySenderChatID", - SchemaName: "story_sender_chat_id", - }, - { - Name: "StoryID", - SchemaName: "story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateStoryDeleted) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStoryDeleted#7007eb9d as nil") - } - b.PutID(UpdateStoryDeletedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateStoryDeleted) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStoryDeleted#7007eb9d as nil") - } - b.PutInt53(u.StorySenderChatID) - b.PutInt32(u.StoryID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateStoryDeleted) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStoryDeleted#7007eb9d to nil") - } - if err := b.ConsumeID(UpdateStoryDeletedTypeID); err != nil { - return fmt.Errorf("unable to decode updateStoryDeleted#7007eb9d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateStoryDeleted) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStoryDeleted#7007eb9d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateStoryDeleted#7007eb9d: field story_sender_chat_id: %w", err) - } - u.StorySenderChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStoryDeleted#7007eb9d: field story_id: %w", err) - } - u.StoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateStoryDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateStoryDeleted#7007eb9d as nil") - } - b.ObjStart() - b.PutID("updateStoryDeleted") - b.Comma() - b.FieldStart("story_sender_chat_id") - b.PutInt53(u.StorySenderChatID) - b.Comma() - b.FieldStart("story_id") - b.PutInt32(u.StoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateStoryDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateStoryDeleted#7007eb9d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateStoryDeleted"); err != nil { - return fmt.Errorf("unable to decode updateStoryDeleted#7007eb9d: %w", err) - } - case "story_sender_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateStoryDeleted#7007eb9d: field story_sender_chat_id: %w", err) - } - u.StorySenderChatID = value - case "story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStoryDeleted#7007eb9d: field story_id: %w", err) - } - u.StoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStorySenderChatID returns value of StorySenderChatID field. -func (u *UpdateStoryDeleted) GetStorySenderChatID() (value int64) { - if u == nil { - return - } - return u.StorySenderChatID -} - -// GetStoryID returns value of StoryID field. -func (u *UpdateStoryDeleted) GetStoryID() (value int32) { - if u == nil { - return - } - return u.StoryID -} - -// UpdateStorySendSucceeded represents TL type `updateStorySendSucceeded#b9269e57`. -type UpdateStorySendSucceeded struct { - // The sent story - Story Story - // The previous temporary story identifier - OldStoryID int32 -} - -// UpdateStorySendSucceededTypeID is TL type id of UpdateStorySendSucceeded. -const UpdateStorySendSucceededTypeID = 0xb9269e57 - -// construct implements constructor of UpdateClass. -func (u UpdateStorySendSucceeded) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateStorySendSucceeded. -var ( - _ bin.Encoder = &UpdateStorySendSucceeded{} - _ bin.Decoder = &UpdateStorySendSucceeded{} - _ bin.BareEncoder = &UpdateStorySendSucceeded{} - _ bin.BareDecoder = &UpdateStorySendSucceeded{} - - _ UpdateClass = &UpdateStorySendSucceeded{} -) - -func (u *UpdateStorySendSucceeded) Zero() bool { - if u == nil { - return true - } - if !(u.Story.Zero()) { - return false - } - if !(u.OldStoryID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateStorySendSucceeded) String() string { - if u == nil { - return "UpdateStorySendSucceeded(nil)" - } - type Alias UpdateStorySendSucceeded - return fmt.Sprintf("UpdateStorySendSucceeded%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateStorySendSucceeded) TypeID() uint32 { - return UpdateStorySendSucceededTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateStorySendSucceeded) TypeName() string { - return "updateStorySendSucceeded" -} - -// TypeInfo returns info about TL type. -func (u *UpdateStorySendSucceeded) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateStorySendSucceeded", - ID: UpdateStorySendSucceededTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Story", - SchemaName: "story", - }, - { - Name: "OldStoryID", - SchemaName: "old_story_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateStorySendSucceeded) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStorySendSucceeded#b9269e57 as nil") - } - b.PutID(UpdateStorySendSucceededTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateStorySendSucceeded) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStorySendSucceeded#b9269e57 as nil") - } - if err := u.Story.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendSucceeded#b9269e57: field story: %w", err) - } - b.PutInt32(u.OldStoryID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateStorySendSucceeded) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStorySendSucceeded#b9269e57 to nil") - } - if err := b.ConsumeID(UpdateStorySendSucceededTypeID); err != nil { - return fmt.Errorf("unable to decode updateStorySendSucceeded#b9269e57: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateStorySendSucceeded) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStorySendSucceeded#b9269e57 to nil") - } - { - if err := u.Story.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateStorySendSucceeded#b9269e57: field story: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStorySendSucceeded#b9269e57: field old_story_id: %w", err) - } - u.OldStoryID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateStorySendSucceeded) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateStorySendSucceeded#b9269e57 as nil") - } - b.ObjStart() - b.PutID("updateStorySendSucceeded") - b.Comma() - b.FieldStart("story") - if err := u.Story.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendSucceeded#b9269e57: field story: %w", err) - } - b.Comma() - b.FieldStart("old_story_id") - b.PutInt32(u.OldStoryID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateStorySendSucceeded) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateStorySendSucceeded#b9269e57 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateStorySendSucceeded"); err != nil { - return fmt.Errorf("unable to decode updateStorySendSucceeded#b9269e57: %w", err) - } - case "story": - if err := u.Story.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateStorySendSucceeded#b9269e57: field story: %w", err) - } - case "old_story_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStorySendSucceeded#b9269e57: field old_story_id: %w", err) - } - u.OldStoryID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStory returns value of Story field. -func (u *UpdateStorySendSucceeded) GetStory() (value Story) { - if u == nil { - return - } - return u.Story -} - -// GetOldStoryID returns value of OldStoryID field. -func (u *UpdateStorySendSucceeded) GetOldStoryID() (value int32) { - if u == nil { - return - } - return u.OldStoryID -} - -// UpdateStorySendFailed represents TL type `updateStorySendFailed#e046f199`. -type UpdateStorySendFailed struct { - // The failed to send story - Story Story - // The cause of the story sending failure - Error Error - // Type of the error; may be null if unknown - ErrorType CanSendStoryResultClass -} - -// UpdateStorySendFailedTypeID is TL type id of UpdateStorySendFailed. -const UpdateStorySendFailedTypeID = 0xe046f199 - -// construct implements constructor of UpdateClass. -func (u UpdateStorySendFailed) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateStorySendFailed. -var ( - _ bin.Encoder = &UpdateStorySendFailed{} - _ bin.Decoder = &UpdateStorySendFailed{} - _ bin.BareEncoder = &UpdateStorySendFailed{} - _ bin.BareDecoder = &UpdateStorySendFailed{} - - _ UpdateClass = &UpdateStorySendFailed{} -) - -func (u *UpdateStorySendFailed) Zero() bool { - if u == nil { - return true - } - if !(u.Story.Zero()) { - return false - } - if !(u.Error.Zero()) { - return false - } - if !(u.ErrorType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateStorySendFailed) String() string { - if u == nil { - return "UpdateStorySendFailed(nil)" - } - type Alias UpdateStorySendFailed - return fmt.Sprintf("UpdateStorySendFailed%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateStorySendFailed) TypeID() uint32 { - return UpdateStorySendFailedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateStorySendFailed) TypeName() string { - return "updateStorySendFailed" -} - -// TypeInfo returns info about TL type. -func (u *UpdateStorySendFailed) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateStorySendFailed", - ID: UpdateStorySendFailedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Story", - SchemaName: "story", - }, - { - Name: "Error", - SchemaName: "error", - }, - { - Name: "ErrorType", - SchemaName: "error_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateStorySendFailed) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStorySendFailed#e046f199 as nil") - } - b.PutID(UpdateStorySendFailedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateStorySendFailed) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStorySendFailed#e046f199 as nil") - } - if err := u.Story.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field story: %w", err) - } - if err := u.Error.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error: %w", err) - } - if u.ErrorType == nil { - return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error_type is nil") - } - if err := u.ErrorType.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateStorySendFailed) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStorySendFailed#e046f199 to nil") - } - if err := b.ConsumeID(UpdateStorySendFailedTypeID); err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateStorySendFailed) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStorySendFailed#e046f199 to nil") - } - { - if err := u.Story.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field story: %w", err) - } - } - { - if err := u.Error.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field error: %w", err) - } - } - { - value, err := DecodeCanSendStoryResult(b) - if err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field error_type: %w", err) - } - u.ErrorType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateStorySendFailed) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateStorySendFailed#e046f199 as nil") - } - b.ObjStart() - b.PutID("updateStorySendFailed") - b.Comma() - b.FieldStart("story") - if err := u.Story.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field story: %w", err) - } - b.Comma() - b.FieldStart("error") - if err := u.Error.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error: %w", err) - } - b.Comma() - b.FieldStart("error_type") - if u.ErrorType == nil { - return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error_type is nil") - } - if err := u.ErrorType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateStorySendFailed#e046f199: field error_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateStorySendFailed) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateStorySendFailed#e046f199 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateStorySendFailed"); err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: %w", err) - } - case "story": - if err := u.Story.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field story: %w", err) - } - case "error": - if err := u.Error.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field error: %w", err) - } - case "error_type": - value, err := DecodeTDLibJSONCanSendStoryResult(b) - if err != nil { - return fmt.Errorf("unable to decode updateStorySendFailed#e046f199: field error_type: %w", err) - } - u.ErrorType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStory returns value of Story field. -func (u *UpdateStorySendFailed) GetStory() (value Story) { - if u == nil { - return - } - return u.Story -} - -// GetError returns value of Error field. -func (u *UpdateStorySendFailed) GetError() (value Error) { - if u == nil { - return - } - return u.Error -} - -// GetErrorType returns value of ErrorType field. -func (u *UpdateStorySendFailed) GetErrorType() (value CanSendStoryResultClass) { - if u == nil { - return - } - return u.ErrorType -} - -// UpdateChatActiveStories represents TL type `updateChatActiveStories#79786c2c`. -type UpdateChatActiveStories struct { - // The new list of active stories - ActiveStories ChatActiveStories -} - -// UpdateChatActiveStoriesTypeID is TL type id of UpdateChatActiveStories. -const UpdateChatActiveStoriesTypeID = 0x79786c2c - -// construct implements constructor of UpdateClass. -func (u UpdateChatActiveStories) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatActiveStories. -var ( - _ bin.Encoder = &UpdateChatActiveStories{} - _ bin.Decoder = &UpdateChatActiveStories{} - _ bin.BareEncoder = &UpdateChatActiveStories{} - _ bin.BareDecoder = &UpdateChatActiveStories{} - - _ UpdateClass = &UpdateChatActiveStories{} -) - -func (u *UpdateChatActiveStories) Zero() bool { - if u == nil { - return true - } - if !(u.ActiveStories.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatActiveStories) String() string { - if u == nil { - return "UpdateChatActiveStories(nil)" - } - type Alias UpdateChatActiveStories - return fmt.Sprintf("UpdateChatActiveStories%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatActiveStories) TypeID() uint32 { - return UpdateChatActiveStoriesTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatActiveStories) TypeName() string { - return "updateChatActiveStories" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatActiveStories) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatActiveStories", - ID: UpdateChatActiveStoriesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ActiveStories", - SchemaName: "active_stories", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatActiveStories) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatActiveStories#79786c2c as nil") - } - b.PutID(UpdateChatActiveStoriesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatActiveStories) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatActiveStories#79786c2c as nil") - } - if err := u.ActiveStories.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatActiveStories#79786c2c: field active_stories: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatActiveStories) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatActiveStories#79786c2c to nil") - } - if err := b.ConsumeID(UpdateChatActiveStoriesTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatActiveStories#79786c2c: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatActiveStories) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatActiveStories#79786c2c to nil") - } - { - if err := u.ActiveStories.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatActiveStories#79786c2c: field active_stories: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatActiveStories) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatActiveStories#79786c2c as nil") - } - b.ObjStart() - b.PutID("updateChatActiveStories") - b.Comma() - b.FieldStart("active_stories") - if err := u.ActiveStories.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatActiveStories#79786c2c: field active_stories: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatActiveStories) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatActiveStories#79786c2c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatActiveStories"); err != nil { - return fmt.Errorf("unable to decode updateChatActiveStories#79786c2c: %w", err) - } - case "active_stories": - if err := u.ActiveStories.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatActiveStories#79786c2c: field active_stories: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetActiveStories returns value of ActiveStories field. -func (u *UpdateChatActiveStories) GetActiveStories() (value ChatActiveStories) { - if u == nil { - return - } - return u.ActiveStories -} - -// UpdateStoryListChatCount represents TL type `updateStoryListChatCount#8833cd3f`. -type UpdateStoryListChatCount struct { - // The story list - StoryList StoryListClass - // Approximate total number of chats with active stories in the list - ChatCount int32 -} - -// UpdateStoryListChatCountTypeID is TL type id of UpdateStoryListChatCount. -const UpdateStoryListChatCountTypeID = 0x8833cd3f - -// construct implements constructor of UpdateClass. -func (u UpdateStoryListChatCount) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateStoryListChatCount. -var ( - _ bin.Encoder = &UpdateStoryListChatCount{} - _ bin.Decoder = &UpdateStoryListChatCount{} - _ bin.BareEncoder = &UpdateStoryListChatCount{} - _ bin.BareDecoder = &UpdateStoryListChatCount{} - - _ UpdateClass = &UpdateStoryListChatCount{} -) - -func (u *UpdateStoryListChatCount) Zero() bool { - if u == nil { - return true - } - if !(u.StoryList == nil) { - return false - } - if !(u.ChatCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateStoryListChatCount) String() string { - if u == nil { - return "UpdateStoryListChatCount(nil)" - } - type Alias UpdateStoryListChatCount - return fmt.Sprintf("UpdateStoryListChatCount%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateStoryListChatCount) TypeID() uint32 { - return UpdateStoryListChatCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateStoryListChatCount) TypeName() string { - return "updateStoryListChatCount" -} - -// TypeInfo returns info about TL type. -func (u *UpdateStoryListChatCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateStoryListChatCount", - ID: UpdateStoryListChatCountTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StoryList", - SchemaName: "story_list", - }, - { - Name: "ChatCount", - SchemaName: "chat_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateStoryListChatCount) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStoryListChatCount#8833cd3f as nil") - } - b.PutID(UpdateStoryListChatCountTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateStoryListChatCount) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStoryListChatCount#8833cd3f as nil") - } - if u.StoryList == nil { - return fmt.Errorf("unable to encode updateStoryListChatCount#8833cd3f: field story_list is nil") - } - if err := u.StoryList.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateStoryListChatCount#8833cd3f: field story_list: %w", err) - } - b.PutInt32(u.ChatCount) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateStoryListChatCount) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStoryListChatCount#8833cd3f to nil") - } - if err := b.ConsumeID(UpdateStoryListChatCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateStoryListChatCount#8833cd3f: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateStoryListChatCount) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStoryListChatCount#8833cd3f to nil") - } - { - value, err := DecodeStoryList(b) - if err != nil { - return fmt.Errorf("unable to decode updateStoryListChatCount#8833cd3f: field story_list: %w", err) - } - u.StoryList = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStoryListChatCount#8833cd3f: field chat_count: %w", err) - } - u.ChatCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateStoryListChatCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateStoryListChatCount#8833cd3f as nil") - } - b.ObjStart() - b.PutID("updateStoryListChatCount") - b.Comma() - b.FieldStart("story_list") - if u.StoryList == nil { - return fmt.Errorf("unable to encode updateStoryListChatCount#8833cd3f: field story_list is nil") - } - if err := u.StoryList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateStoryListChatCount#8833cd3f: field story_list: %w", err) - } - b.Comma() - b.FieldStart("chat_count") - b.PutInt32(u.ChatCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateStoryListChatCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateStoryListChatCount#8833cd3f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateStoryListChatCount"); err != nil { - return fmt.Errorf("unable to decode updateStoryListChatCount#8833cd3f: %w", err) - } - case "story_list": - value, err := DecodeTDLibJSONStoryList(b) - if err != nil { - return fmt.Errorf("unable to decode updateStoryListChatCount#8833cd3f: field story_list: %w", err) - } - u.StoryList = value - case "chat_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStoryListChatCount#8833cd3f: field chat_count: %w", err) - } - u.ChatCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetStoryList returns value of StoryList field. -func (u *UpdateStoryListChatCount) GetStoryList() (value StoryListClass) { - if u == nil { - return - } - return u.StoryList -} - -// GetChatCount returns value of ChatCount field. -func (u *UpdateStoryListChatCount) GetChatCount() (value int32) { - if u == nil { - return - } - return u.ChatCount -} - -// UpdateStoryStealthMode represents TL type `updateStoryStealthMode#6ff7bd1a`. -type UpdateStoryStealthMode struct { - // Point in time (Unix timestamp) until stealth mode is active; 0 if it is disabled - ActiveUntilDate int32 - // Point in time (Unix timestamp) when stealth mode can be enabled again; 0 if there is - // no active cooldown - CooldownUntilDate int32 -} - -// UpdateStoryStealthModeTypeID is TL type id of UpdateStoryStealthMode. -const UpdateStoryStealthModeTypeID = 0x6ff7bd1a - -// construct implements constructor of UpdateClass. -func (u UpdateStoryStealthMode) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateStoryStealthMode. -var ( - _ bin.Encoder = &UpdateStoryStealthMode{} - _ bin.Decoder = &UpdateStoryStealthMode{} - _ bin.BareEncoder = &UpdateStoryStealthMode{} - _ bin.BareDecoder = &UpdateStoryStealthMode{} - - _ UpdateClass = &UpdateStoryStealthMode{} -) - -func (u *UpdateStoryStealthMode) Zero() bool { - if u == nil { - return true - } - if !(u.ActiveUntilDate == 0) { - return false - } - if !(u.CooldownUntilDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateStoryStealthMode) String() string { - if u == nil { - return "UpdateStoryStealthMode(nil)" - } - type Alias UpdateStoryStealthMode - return fmt.Sprintf("UpdateStoryStealthMode%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateStoryStealthMode) TypeID() uint32 { - return UpdateStoryStealthModeTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateStoryStealthMode) TypeName() string { - return "updateStoryStealthMode" -} - -// TypeInfo returns info about TL type. -func (u *UpdateStoryStealthMode) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateStoryStealthMode", - ID: UpdateStoryStealthModeTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ActiveUntilDate", - SchemaName: "active_until_date", - }, - { - Name: "CooldownUntilDate", - SchemaName: "cooldown_until_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateStoryStealthMode) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStoryStealthMode#6ff7bd1a as nil") - } - b.PutID(UpdateStoryStealthModeTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateStoryStealthMode) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStoryStealthMode#6ff7bd1a as nil") - } - b.PutInt32(u.ActiveUntilDate) - b.PutInt32(u.CooldownUntilDate) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateStoryStealthMode) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStoryStealthMode#6ff7bd1a to nil") - } - if err := b.ConsumeID(UpdateStoryStealthModeTypeID); err != nil { - return fmt.Errorf("unable to decode updateStoryStealthMode#6ff7bd1a: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateStoryStealthMode) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStoryStealthMode#6ff7bd1a to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStoryStealthMode#6ff7bd1a: field active_until_date: %w", err) - } - u.ActiveUntilDate = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStoryStealthMode#6ff7bd1a: field cooldown_until_date: %w", err) - } - u.CooldownUntilDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateStoryStealthMode) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateStoryStealthMode#6ff7bd1a as nil") - } - b.ObjStart() - b.PutID("updateStoryStealthMode") - b.Comma() - b.FieldStart("active_until_date") - b.PutInt32(u.ActiveUntilDate) - b.Comma() - b.FieldStart("cooldown_until_date") - b.PutInt32(u.CooldownUntilDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateStoryStealthMode) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateStoryStealthMode#6ff7bd1a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateStoryStealthMode"); err != nil { - return fmt.Errorf("unable to decode updateStoryStealthMode#6ff7bd1a: %w", err) - } - case "active_until_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStoryStealthMode#6ff7bd1a: field active_until_date: %w", err) - } - u.ActiveUntilDate = value - case "cooldown_until_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateStoryStealthMode#6ff7bd1a: field cooldown_until_date: %w", err) - } - u.CooldownUntilDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetActiveUntilDate returns value of ActiveUntilDate field. -func (u *UpdateStoryStealthMode) GetActiveUntilDate() (value int32) { - if u == nil { - return - } - return u.ActiveUntilDate -} - -// GetCooldownUntilDate returns value of CooldownUntilDate field. -func (u *UpdateStoryStealthMode) GetCooldownUntilDate() (value int32) { - if u == nil { - return - } - return u.CooldownUntilDate -} - -// UpdateOption represents TL type `updateOption#35b17404`. -type UpdateOption struct { - // The option name - Name string - // The new option value - Value OptionValueClass -} - -// UpdateOptionTypeID is TL type id of UpdateOption. -const UpdateOptionTypeID = 0x35b17404 - -// construct implements constructor of UpdateClass. -func (u UpdateOption) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateOption. -var ( - _ bin.Encoder = &UpdateOption{} - _ bin.Decoder = &UpdateOption{} - _ bin.BareEncoder = &UpdateOption{} - _ bin.BareDecoder = &UpdateOption{} - - _ UpdateClass = &UpdateOption{} -) - -func (u *UpdateOption) Zero() bool { - if u == nil { - return true - } - if !(u.Name == "") { - return false - } - if !(u.Value == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateOption) String() string { - if u == nil { - return "UpdateOption(nil)" - } - type Alias UpdateOption - return fmt.Sprintf("UpdateOption%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateOption) TypeID() uint32 { - return UpdateOptionTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateOption) TypeName() string { - return "updateOption" -} - -// TypeInfo returns info about TL type. -func (u *UpdateOption) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateOption", - ID: UpdateOptionTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Value", - SchemaName: "value", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateOption) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateOption#35b17404 as nil") - } - b.PutID(UpdateOptionTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateOption) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateOption#35b17404 as nil") - } - b.PutString(u.Name) - if u.Value == nil { - return fmt.Errorf("unable to encode updateOption#35b17404: field value is nil") - } - if err := u.Value.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateOption#35b17404: field value: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateOption) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateOption#35b17404 to nil") - } - if err := b.ConsumeID(UpdateOptionTypeID); err != nil { - return fmt.Errorf("unable to decode updateOption#35b17404: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateOption) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateOption#35b17404 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateOption#35b17404: field name: %w", err) - } - u.Name = value - } - { - value, err := DecodeOptionValue(b) - if err != nil { - return fmt.Errorf("unable to decode updateOption#35b17404: field value: %w", err) - } - u.Value = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateOption) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateOption#35b17404 as nil") - } - b.ObjStart() - b.PutID("updateOption") - b.Comma() - b.FieldStart("name") - b.PutString(u.Name) - b.Comma() - b.FieldStart("value") - if u.Value == nil { - return fmt.Errorf("unable to encode updateOption#35b17404: field value is nil") - } - if err := u.Value.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateOption#35b17404: field value: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateOption) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateOption#35b17404 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateOption"); err != nil { - return fmt.Errorf("unable to decode updateOption#35b17404: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateOption#35b17404: field name: %w", err) - } - u.Name = value - case "value": - value, err := DecodeTDLibJSONOptionValue(b) - if err != nil { - return fmt.Errorf("unable to decode updateOption#35b17404: field value: %w", err) - } - u.Value = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (u *UpdateOption) GetName() (value string) { - if u == nil { - return - } - return u.Name -} - -// GetValue returns value of Value field. -func (u *UpdateOption) GetValue() (value OptionValueClass) { - if u == nil { - return - } - return u.Value -} - -// UpdateStickerSet represents TL type `updateStickerSet#70035dcc`. -type UpdateStickerSet struct { - // The sticker set - StickerSet StickerSet -} - -// UpdateStickerSetTypeID is TL type id of UpdateStickerSet. -const UpdateStickerSetTypeID = 0x70035dcc - -// construct implements constructor of UpdateClass. -func (u UpdateStickerSet) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateStickerSet. -var ( - _ bin.Encoder = &UpdateStickerSet{} - _ bin.Decoder = &UpdateStickerSet{} - _ bin.BareEncoder = &UpdateStickerSet{} - _ bin.BareDecoder = &UpdateStickerSet{} - - _ UpdateClass = &UpdateStickerSet{} -) - -func (u *UpdateStickerSet) Zero() bool { - if u == nil { - return true - } - if !(u.StickerSet.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateStickerSet) String() string { - if u == nil { - return "UpdateStickerSet(nil)" - } - type Alias UpdateStickerSet - return fmt.Sprintf("UpdateStickerSet%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateStickerSet) TypeID() uint32 { - return UpdateStickerSetTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateStickerSet) TypeName() string { - return "updateStickerSet" -} - -// TypeInfo returns info about TL type. -func (u *UpdateStickerSet) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateStickerSet", - ID: UpdateStickerSetTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerSet", - SchemaName: "sticker_set", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateStickerSet) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStickerSet#70035dcc as nil") - } - b.PutID(UpdateStickerSetTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateStickerSet) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStickerSet#70035dcc as nil") - } - if err := u.StickerSet.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateStickerSet#70035dcc: field sticker_set: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateStickerSet) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStickerSet#70035dcc to nil") - } - if err := b.ConsumeID(UpdateStickerSetTypeID); err != nil { - return fmt.Errorf("unable to decode updateStickerSet#70035dcc: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateStickerSet) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStickerSet#70035dcc to nil") - } - { - if err := u.StickerSet.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateStickerSet#70035dcc: field sticker_set: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateStickerSet) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateStickerSet#70035dcc as nil") - } - b.ObjStart() - b.PutID("updateStickerSet") - b.Comma() - b.FieldStart("sticker_set") - if err := u.StickerSet.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateStickerSet#70035dcc: field sticker_set: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateStickerSet) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateStickerSet#70035dcc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateStickerSet"); err != nil { - return fmt.Errorf("unable to decode updateStickerSet#70035dcc: %w", err) - } - case "sticker_set": - if err := u.StickerSet.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateStickerSet#70035dcc: field sticker_set: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerSet returns value of StickerSet field. -func (u *UpdateStickerSet) GetStickerSet() (value StickerSet) { - if u == nil { - return - } - return u.StickerSet -} - -// UpdateInstalledStickerSets represents TL type `updateInstalledStickerSets#82cd5388`. -type UpdateInstalledStickerSets struct { - // Type of the affected stickers - StickerType StickerTypeClass - // The new list of installed ordinary sticker sets - StickerSetIDs []int64 -} - -// UpdateInstalledStickerSetsTypeID is TL type id of UpdateInstalledStickerSets. -const UpdateInstalledStickerSetsTypeID = 0x82cd5388 - -// construct implements constructor of UpdateClass. -func (u UpdateInstalledStickerSets) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateInstalledStickerSets. -var ( - _ bin.Encoder = &UpdateInstalledStickerSets{} - _ bin.Decoder = &UpdateInstalledStickerSets{} - _ bin.BareEncoder = &UpdateInstalledStickerSets{} - _ bin.BareDecoder = &UpdateInstalledStickerSets{} - - _ UpdateClass = &UpdateInstalledStickerSets{} -) - -func (u *UpdateInstalledStickerSets) Zero() bool { - if u == nil { - return true - } - if !(u.StickerType == nil) { - return false - } - if !(u.StickerSetIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateInstalledStickerSets) String() string { - if u == nil { - return "UpdateInstalledStickerSets(nil)" - } - type Alias UpdateInstalledStickerSets - return fmt.Sprintf("UpdateInstalledStickerSets%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateInstalledStickerSets) TypeID() uint32 { - return UpdateInstalledStickerSetsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateInstalledStickerSets) TypeName() string { - return "updateInstalledStickerSets" -} - -// TypeInfo returns info about TL type. -func (u *UpdateInstalledStickerSets) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateInstalledStickerSets", - ID: UpdateInstalledStickerSetsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "StickerSetIDs", - SchemaName: "sticker_set_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateInstalledStickerSets) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateInstalledStickerSets#82cd5388 as nil") - } - b.PutID(UpdateInstalledStickerSetsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateInstalledStickerSets) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateInstalledStickerSets#82cd5388 as nil") - } - if u.StickerType == nil { - return fmt.Errorf("unable to encode updateInstalledStickerSets#82cd5388: field sticker_type is nil") - } - if err := u.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateInstalledStickerSets#82cd5388: field sticker_type: %w", err) - } - b.PutInt(len(u.StickerSetIDs)) - for _, v := range u.StickerSetIDs { - b.PutLong(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateInstalledStickerSets) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateInstalledStickerSets#82cd5388 to nil") - } - if err := b.ConsumeID(UpdateInstalledStickerSetsTypeID); err != nil { - return fmt.Errorf("unable to decode updateInstalledStickerSets#82cd5388: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateInstalledStickerSets) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateInstalledStickerSets#82cd5388 to nil") - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode updateInstalledStickerSets#82cd5388: field sticker_type: %w", err) - } - u.StickerType = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateInstalledStickerSets#82cd5388: field sticker_set_ids: %w", err) - } - - if headerLen > 0 { - u.StickerSetIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateInstalledStickerSets#82cd5388: field sticker_set_ids: %w", err) - } - u.StickerSetIDs = append(u.StickerSetIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateInstalledStickerSets) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateInstalledStickerSets#82cd5388 as nil") - } - b.ObjStart() - b.PutID("updateInstalledStickerSets") - b.Comma() - b.FieldStart("sticker_type") - if u.StickerType == nil { - return fmt.Errorf("unable to encode updateInstalledStickerSets#82cd5388: field sticker_type is nil") - } - if err := u.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateInstalledStickerSets#82cd5388: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("sticker_set_ids") - b.ArrStart() - for _, v := range u.StickerSetIDs { - b.PutLong(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateInstalledStickerSets) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateInstalledStickerSets#82cd5388 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateInstalledStickerSets"); err != nil { - return fmt.Errorf("unable to decode updateInstalledStickerSets#82cd5388: %w", err) - } - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode updateInstalledStickerSets#82cd5388: field sticker_type: %w", err) - } - u.StickerType = value - case "sticker_set_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateInstalledStickerSets#82cd5388: field sticker_set_ids: %w", err) - } - u.StickerSetIDs = append(u.StickerSetIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateInstalledStickerSets#82cd5388: field sticker_set_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerType returns value of StickerType field. -func (u *UpdateInstalledStickerSets) GetStickerType() (value StickerTypeClass) { - if u == nil { - return - } - return u.StickerType -} - -// GetStickerSetIDs returns value of StickerSetIDs field. -func (u *UpdateInstalledStickerSets) GetStickerSetIDs() (value []int64) { - if u == nil { - return - } - return u.StickerSetIDs -} - -// UpdateTrendingStickerSets represents TL type `updateTrendingStickerSets#4b7a50a7`. -type UpdateTrendingStickerSets struct { - // Type of the affected stickers - StickerType StickerTypeClass - // The prefix of the list of trending sticker sets with the newest trending sticker sets - StickerSets TrendingStickerSets -} - -// UpdateTrendingStickerSetsTypeID is TL type id of UpdateTrendingStickerSets. -const UpdateTrendingStickerSetsTypeID = 0x4b7a50a7 - -// construct implements constructor of UpdateClass. -func (u UpdateTrendingStickerSets) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateTrendingStickerSets. -var ( - _ bin.Encoder = &UpdateTrendingStickerSets{} - _ bin.Decoder = &UpdateTrendingStickerSets{} - _ bin.BareEncoder = &UpdateTrendingStickerSets{} - _ bin.BareDecoder = &UpdateTrendingStickerSets{} - - _ UpdateClass = &UpdateTrendingStickerSets{} -) - -func (u *UpdateTrendingStickerSets) Zero() bool { - if u == nil { - return true - } - if !(u.StickerType == nil) { - return false - } - if !(u.StickerSets.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateTrendingStickerSets) String() string { - if u == nil { - return "UpdateTrendingStickerSets(nil)" - } - type Alias UpdateTrendingStickerSets - return fmt.Sprintf("UpdateTrendingStickerSets%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateTrendingStickerSets) TypeID() uint32 { - return UpdateTrendingStickerSetsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateTrendingStickerSets) TypeName() string { - return "updateTrendingStickerSets" -} - -// TypeInfo returns info about TL type. -func (u *UpdateTrendingStickerSets) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateTrendingStickerSets", - ID: UpdateTrendingStickerSetsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerType", - SchemaName: "sticker_type", - }, - { - Name: "StickerSets", - SchemaName: "sticker_sets", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateTrendingStickerSets) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateTrendingStickerSets#4b7a50a7 as nil") - } - b.PutID(UpdateTrendingStickerSetsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateTrendingStickerSets) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateTrendingStickerSets#4b7a50a7 as nil") - } - if u.StickerType == nil { - return fmt.Errorf("unable to encode updateTrendingStickerSets#4b7a50a7: field sticker_type is nil") - } - if err := u.StickerType.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateTrendingStickerSets#4b7a50a7: field sticker_type: %w", err) - } - if err := u.StickerSets.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateTrendingStickerSets#4b7a50a7: field sticker_sets: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateTrendingStickerSets) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateTrendingStickerSets#4b7a50a7 to nil") - } - if err := b.ConsumeID(UpdateTrendingStickerSetsTypeID); err != nil { - return fmt.Errorf("unable to decode updateTrendingStickerSets#4b7a50a7: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateTrendingStickerSets) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateTrendingStickerSets#4b7a50a7 to nil") - } - { - value, err := DecodeStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode updateTrendingStickerSets#4b7a50a7: field sticker_type: %w", err) - } - u.StickerType = value - } - { - if err := u.StickerSets.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateTrendingStickerSets#4b7a50a7: field sticker_sets: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateTrendingStickerSets) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateTrendingStickerSets#4b7a50a7 as nil") - } - b.ObjStart() - b.PutID("updateTrendingStickerSets") - b.Comma() - b.FieldStart("sticker_type") - if u.StickerType == nil { - return fmt.Errorf("unable to encode updateTrendingStickerSets#4b7a50a7: field sticker_type is nil") - } - if err := u.StickerType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateTrendingStickerSets#4b7a50a7: field sticker_type: %w", err) - } - b.Comma() - b.FieldStart("sticker_sets") - if err := u.StickerSets.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateTrendingStickerSets#4b7a50a7: field sticker_sets: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateTrendingStickerSets) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateTrendingStickerSets#4b7a50a7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateTrendingStickerSets"); err != nil { - return fmt.Errorf("unable to decode updateTrendingStickerSets#4b7a50a7: %w", err) - } - case "sticker_type": - value, err := DecodeTDLibJSONStickerType(b) - if err != nil { - return fmt.Errorf("unable to decode updateTrendingStickerSets#4b7a50a7: field sticker_type: %w", err) - } - u.StickerType = value - case "sticker_sets": - if err := u.StickerSets.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateTrendingStickerSets#4b7a50a7: field sticker_sets: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerType returns value of StickerType field. -func (u *UpdateTrendingStickerSets) GetStickerType() (value StickerTypeClass) { - if u == nil { - return - } - return u.StickerType -} - -// GetStickerSets returns value of StickerSets field. -func (u *UpdateTrendingStickerSets) GetStickerSets() (value TrendingStickerSets) { - if u == nil { - return - } - return u.StickerSets -} - -// UpdateRecentStickers represents TL type `updateRecentStickers#aefdf8dc`. -type UpdateRecentStickers struct { - // True, if the list of stickers attached to photo or video files was updated; otherwise, - // the list of sent stickers is updated - IsAttached bool - // The new list of file identifiers of recently used stickers - StickerIDs []int32 -} - -// UpdateRecentStickersTypeID is TL type id of UpdateRecentStickers. -const UpdateRecentStickersTypeID = 0xaefdf8dc - -// construct implements constructor of UpdateClass. -func (u UpdateRecentStickers) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateRecentStickers. -var ( - _ bin.Encoder = &UpdateRecentStickers{} - _ bin.Decoder = &UpdateRecentStickers{} - _ bin.BareEncoder = &UpdateRecentStickers{} - _ bin.BareDecoder = &UpdateRecentStickers{} - - _ UpdateClass = &UpdateRecentStickers{} -) - -func (u *UpdateRecentStickers) Zero() bool { - if u == nil { - return true - } - if !(u.IsAttached == false) { - return false - } - if !(u.StickerIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateRecentStickers) String() string { - if u == nil { - return "UpdateRecentStickers(nil)" - } - type Alias UpdateRecentStickers - return fmt.Sprintf("UpdateRecentStickers%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateRecentStickers) TypeID() uint32 { - return UpdateRecentStickersTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateRecentStickers) TypeName() string { - return "updateRecentStickers" -} - -// TypeInfo returns info about TL type. -func (u *UpdateRecentStickers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateRecentStickers", - ID: UpdateRecentStickersTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsAttached", - SchemaName: "is_attached", - }, - { - Name: "StickerIDs", - SchemaName: "sticker_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateRecentStickers) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateRecentStickers#aefdf8dc as nil") - } - b.PutID(UpdateRecentStickersTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateRecentStickers) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateRecentStickers#aefdf8dc as nil") - } - b.PutBool(u.IsAttached) - b.PutInt(len(u.StickerIDs)) - for _, v := range u.StickerIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateRecentStickers) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateRecentStickers#aefdf8dc to nil") - } - if err := b.ConsumeID(UpdateRecentStickersTypeID); err != nil { - return fmt.Errorf("unable to decode updateRecentStickers#aefdf8dc: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateRecentStickers) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateRecentStickers#aefdf8dc to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateRecentStickers#aefdf8dc: field is_attached: %w", err) - } - u.IsAttached = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateRecentStickers#aefdf8dc: field sticker_ids: %w", err) - } - - if headerLen > 0 { - u.StickerIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateRecentStickers#aefdf8dc: field sticker_ids: %w", err) - } - u.StickerIDs = append(u.StickerIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateRecentStickers) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateRecentStickers#aefdf8dc as nil") - } - b.ObjStart() - b.PutID("updateRecentStickers") - b.Comma() - b.FieldStart("is_attached") - b.PutBool(u.IsAttached) - b.Comma() - b.FieldStart("sticker_ids") - b.ArrStart() - for _, v := range u.StickerIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateRecentStickers) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateRecentStickers#aefdf8dc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateRecentStickers"); err != nil { - return fmt.Errorf("unable to decode updateRecentStickers#aefdf8dc: %w", err) - } - case "is_attached": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateRecentStickers#aefdf8dc: field is_attached: %w", err) - } - u.IsAttached = value - case "sticker_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateRecentStickers#aefdf8dc: field sticker_ids: %w", err) - } - u.StickerIDs = append(u.StickerIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateRecentStickers#aefdf8dc: field sticker_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetIsAttached returns value of IsAttached field. -func (u *UpdateRecentStickers) GetIsAttached() (value bool) { - if u == nil { - return - } - return u.IsAttached -} - -// GetStickerIDs returns value of StickerIDs field. -func (u *UpdateRecentStickers) GetStickerIDs() (value []int32) { - if u == nil { - return - } - return u.StickerIDs -} - -// UpdateFavoriteStickers represents TL type `updateFavoriteStickers#113f2b6a`. -type UpdateFavoriteStickers struct { - // The new list of file identifiers of favorite stickers - StickerIDs []int32 -} - -// UpdateFavoriteStickersTypeID is TL type id of UpdateFavoriteStickers. -const UpdateFavoriteStickersTypeID = 0x113f2b6a - -// construct implements constructor of UpdateClass. -func (u UpdateFavoriteStickers) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateFavoriteStickers. -var ( - _ bin.Encoder = &UpdateFavoriteStickers{} - _ bin.Decoder = &UpdateFavoriteStickers{} - _ bin.BareEncoder = &UpdateFavoriteStickers{} - _ bin.BareDecoder = &UpdateFavoriteStickers{} - - _ UpdateClass = &UpdateFavoriteStickers{} -) - -func (u *UpdateFavoriteStickers) Zero() bool { - if u == nil { - return true - } - if !(u.StickerIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateFavoriteStickers) String() string { - if u == nil { - return "UpdateFavoriteStickers(nil)" - } - type Alias UpdateFavoriteStickers - return fmt.Sprintf("UpdateFavoriteStickers%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateFavoriteStickers) TypeID() uint32 { - return UpdateFavoriteStickersTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateFavoriteStickers) TypeName() string { - return "updateFavoriteStickers" -} - -// TypeInfo returns info about TL type. -func (u *UpdateFavoriteStickers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateFavoriteStickers", - ID: UpdateFavoriteStickersTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerIDs", - SchemaName: "sticker_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateFavoriteStickers) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFavoriteStickers#113f2b6a as nil") - } - b.PutID(UpdateFavoriteStickersTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateFavoriteStickers) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateFavoriteStickers#113f2b6a as nil") - } - b.PutInt(len(u.StickerIDs)) - for _, v := range u.StickerIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateFavoriteStickers) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFavoriteStickers#113f2b6a to nil") - } - if err := b.ConsumeID(UpdateFavoriteStickersTypeID); err != nil { - return fmt.Errorf("unable to decode updateFavoriteStickers#113f2b6a: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateFavoriteStickers) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateFavoriteStickers#113f2b6a to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateFavoriteStickers#113f2b6a: field sticker_ids: %w", err) - } - - if headerLen > 0 { - u.StickerIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateFavoriteStickers#113f2b6a: field sticker_ids: %w", err) - } - u.StickerIDs = append(u.StickerIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateFavoriteStickers) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateFavoriteStickers#113f2b6a as nil") - } - b.ObjStart() - b.PutID("updateFavoriteStickers") - b.Comma() - b.FieldStart("sticker_ids") - b.ArrStart() - for _, v := range u.StickerIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateFavoriteStickers) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateFavoriteStickers#113f2b6a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateFavoriteStickers"); err != nil { - return fmt.Errorf("unable to decode updateFavoriteStickers#113f2b6a: %w", err) - } - case "sticker_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateFavoriteStickers#113f2b6a: field sticker_ids: %w", err) - } - u.StickerIDs = append(u.StickerIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateFavoriteStickers#113f2b6a: field sticker_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerIDs returns value of StickerIDs field. -func (u *UpdateFavoriteStickers) GetStickerIDs() (value []int32) { - if u == nil { - return - } - return u.StickerIDs -} - -// UpdateSavedAnimations represents TL type `updateSavedAnimations#1084a1c8`. -type UpdateSavedAnimations struct { - // The new list of file identifiers of saved animations - AnimationIDs []int32 -} - -// UpdateSavedAnimationsTypeID is TL type id of UpdateSavedAnimations. -const UpdateSavedAnimationsTypeID = 0x1084a1c8 - -// construct implements constructor of UpdateClass. -func (u UpdateSavedAnimations) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateSavedAnimations. -var ( - _ bin.Encoder = &UpdateSavedAnimations{} - _ bin.Decoder = &UpdateSavedAnimations{} - _ bin.BareEncoder = &UpdateSavedAnimations{} - _ bin.BareDecoder = &UpdateSavedAnimations{} - - _ UpdateClass = &UpdateSavedAnimations{} -) - -func (u *UpdateSavedAnimations) Zero() bool { - if u == nil { - return true - } - if !(u.AnimationIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateSavedAnimations) String() string { - if u == nil { - return "UpdateSavedAnimations(nil)" - } - type Alias UpdateSavedAnimations - return fmt.Sprintf("UpdateSavedAnimations%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSavedAnimations) TypeID() uint32 { - return UpdateSavedAnimationsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateSavedAnimations) TypeName() string { - return "updateSavedAnimations" -} - -// TypeInfo returns info about TL type. -func (u *UpdateSavedAnimations) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateSavedAnimations", - ID: UpdateSavedAnimationsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AnimationIDs", - SchemaName: "animation_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateSavedAnimations) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedAnimations#1084a1c8 as nil") - } - b.PutID(UpdateSavedAnimationsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateSavedAnimations) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedAnimations#1084a1c8 as nil") - } - b.PutInt(len(u.AnimationIDs)) - for _, v := range u.AnimationIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateSavedAnimations) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedAnimations#1084a1c8 to nil") - } - if err := b.ConsumeID(UpdateSavedAnimationsTypeID); err != nil { - return fmt.Errorf("unable to decode updateSavedAnimations#1084a1c8: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateSavedAnimations) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedAnimations#1084a1c8 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateSavedAnimations#1084a1c8: field animation_ids: %w", err) - } - - if headerLen > 0 { - u.AnimationIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSavedAnimations#1084a1c8: field animation_ids: %w", err) - } - u.AnimationIDs = append(u.AnimationIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSavedAnimations) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedAnimations#1084a1c8 as nil") - } - b.ObjStart() - b.PutID("updateSavedAnimations") - b.Comma() - b.FieldStart("animation_ids") - b.ArrStart() - for _, v := range u.AnimationIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSavedAnimations) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedAnimations#1084a1c8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateSavedAnimations"); err != nil { - return fmt.Errorf("unable to decode updateSavedAnimations#1084a1c8: %w", err) - } - case "animation_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSavedAnimations#1084a1c8: field animation_ids: %w", err) - } - u.AnimationIDs = append(u.AnimationIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateSavedAnimations#1084a1c8: field animation_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAnimationIDs returns value of AnimationIDs field. -func (u *UpdateSavedAnimations) GetAnimationIDs() (value []int32) { - if u == nil { - return - } - return u.AnimationIDs -} - -// UpdateSavedNotificationSounds represents TL type `updateSavedNotificationSounds#5a6653b4`. -type UpdateSavedNotificationSounds struct { - // The new list of identifiers of saved notification sounds - NotificationSoundIDs []int64 -} - -// UpdateSavedNotificationSoundsTypeID is TL type id of UpdateSavedNotificationSounds. -const UpdateSavedNotificationSoundsTypeID = 0x5a6653b4 - -// construct implements constructor of UpdateClass. -func (u UpdateSavedNotificationSounds) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateSavedNotificationSounds. -var ( - _ bin.Encoder = &UpdateSavedNotificationSounds{} - _ bin.Decoder = &UpdateSavedNotificationSounds{} - _ bin.BareEncoder = &UpdateSavedNotificationSounds{} - _ bin.BareDecoder = &UpdateSavedNotificationSounds{} - - _ UpdateClass = &UpdateSavedNotificationSounds{} -) - -func (u *UpdateSavedNotificationSounds) Zero() bool { - if u == nil { - return true - } - if !(u.NotificationSoundIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateSavedNotificationSounds) String() string { - if u == nil { - return "UpdateSavedNotificationSounds(nil)" - } - type Alias UpdateSavedNotificationSounds - return fmt.Sprintf("UpdateSavedNotificationSounds%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSavedNotificationSounds) TypeID() uint32 { - return UpdateSavedNotificationSoundsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateSavedNotificationSounds) TypeName() string { - return "updateSavedNotificationSounds" -} - -// TypeInfo returns info about TL type. -func (u *UpdateSavedNotificationSounds) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateSavedNotificationSounds", - ID: UpdateSavedNotificationSoundsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "NotificationSoundIDs", - SchemaName: "notification_sound_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateSavedNotificationSounds) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedNotificationSounds#5a6653b4 as nil") - } - b.PutID(UpdateSavedNotificationSoundsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateSavedNotificationSounds) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedNotificationSounds#5a6653b4 as nil") - } - b.PutInt(len(u.NotificationSoundIDs)) - for _, v := range u.NotificationSoundIDs { - b.PutLong(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateSavedNotificationSounds) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedNotificationSounds#5a6653b4 to nil") - } - if err := b.ConsumeID(UpdateSavedNotificationSoundsTypeID); err != nil { - return fmt.Errorf("unable to decode updateSavedNotificationSounds#5a6653b4: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateSavedNotificationSounds) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedNotificationSounds#5a6653b4 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateSavedNotificationSounds#5a6653b4: field notification_sound_ids: %w", err) - } - - if headerLen > 0 { - u.NotificationSoundIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateSavedNotificationSounds#5a6653b4: field notification_sound_ids: %w", err) - } - u.NotificationSoundIDs = append(u.NotificationSoundIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSavedNotificationSounds) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedNotificationSounds#5a6653b4 as nil") - } - b.ObjStart() - b.PutID("updateSavedNotificationSounds") - b.Comma() - b.FieldStart("notification_sound_ids") - b.ArrStart() - for _, v := range u.NotificationSoundIDs { - b.PutLong(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSavedNotificationSounds) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedNotificationSounds#5a6653b4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateSavedNotificationSounds"); err != nil { - return fmt.Errorf("unable to decode updateSavedNotificationSounds#5a6653b4: %w", err) - } - case "notification_sound_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateSavedNotificationSounds#5a6653b4: field notification_sound_ids: %w", err) - } - u.NotificationSoundIDs = append(u.NotificationSoundIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateSavedNotificationSounds#5a6653b4: field notification_sound_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetNotificationSoundIDs returns value of NotificationSoundIDs field. -func (u *UpdateSavedNotificationSounds) GetNotificationSoundIDs() (value []int64) { - if u == nil { - return - } - return u.NotificationSoundIDs -} - -// UpdateDefaultBackground represents TL type `updateDefaultBackground#d550952f`. -type UpdateDefaultBackground struct { - // True, if default background for dark theme has changed - ForDarkTheme bool - // The new default background; may be null - Background Background -} - -// UpdateDefaultBackgroundTypeID is TL type id of UpdateDefaultBackground. -const UpdateDefaultBackgroundTypeID = 0xd550952f - -// construct implements constructor of UpdateClass. -func (u UpdateDefaultBackground) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateDefaultBackground. -var ( - _ bin.Encoder = &UpdateDefaultBackground{} - _ bin.Decoder = &UpdateDefaultBackground{} - _ bin.BareEncoder = &UpdateDefaultBackground{} - _ bin.BareDecoder = &UpdateDefaultBackground{} - - _ UpdateClass = &UpdateDefaultBackground{} -) - -func (u *UpdateDefaultBackground) Zero() bool { - if u == nil { - return true - } - if !(u.ForDarkTheme == false) { - return false - } - if !(u.Background.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateDefaultBackground) String() string { - if u == nil { - return "UpdateDefaultBackground(nil)" - } - type Alias UpdateDefaultBackground - return fmt.Sprintf("UpdateDefaultBackground%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateDefaultBackground) TypeID() uint32 { - return UpdateDefaultBackgroundTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateDefaultBackground) TypeName() string { - return "updateDefaultBackground" -} - -// TypeInfo returns info about TL type. -func (u *UpdateDefaultBackground) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateDefaultBackground", - ID: UpdateDefaultBackgroundTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ForDarkTheme", - SchemaName: "for_dark_theme", - }, - { - Name: "Background", - SchemaName: "background", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateDefaultBackground) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateDefaultBackground#d550952f as nil") - } - b.PutID(UpdateDefaultBackgroundTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateDefaultBackground) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateDefaultBackground#d550952f as nil") - } - b.PutBool(u.ForDarkTheme) - if err := u.Background.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateDefaultBackground#d550952f: field background: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateDefaultBackground) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateDefaultBackground#d550952f to nil") - } - if err := b.ConsumeID(UpdateDefaultBackgroundTypeID); err != nil { - return fmt.Errorf("unable to decode updateDefaultBackground#d550952f: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateDefaultBackground) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateDefaultBackground#d550952f to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateDefaultBackground#d550952f: field for_dark_theme: %w", err) - } - u.ForDarkTheme = value - } - { - if err := u.Background.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateDefaultBackground#d550952f: field background: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateDefaultBackground) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateDefaultBackground#d550952f as nil") - } - b.ObjStart() - b.PutID("updateDefaultBackground") - b.Comma() - b.FieldStart("for_dark_theme") - b.PutBool(u.ForDarkTheme) - b.Comma() - b.FieldStart("background") - if err := u.Background.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateDefaultBackground#d550952f: field background: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateDefaultBackground) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateDefaultBackground#d550952f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateDefaultBackground"); err != nil { - return fmt.Errorf("unable to decode updateDefaultBackground#d550952f: %w", err) - } - case "for_dark_theme": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateDefaultBackground#d550952f: field for_dark_theme: %w", err) - } - u.ForDarkTheme = value - case "background": - if err := u.Background.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateDefaultBackground#d550952f: field background: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetForDarkTheme returns value of ForDarkTheme field. -func (u *UpdateDefaultBackground) GetForDarkTheme() (value bool) { - if u == nil { - return - } - return u.ForDarkTheme -} - -// GetBackground returns value of Background field. -func (u *UpdateDefaultBackground) GetBackground() (value Background) { - if u == nil { - return - } - return u.Background -} - -// UpdateChatThemes represents TL type `updateChatThemes#98dc58d5`. -type UpdateChatThemes struct { - // The new list of chat themes - ChatThemes []ChatTheme -} - -// UpdateChatThemesTypeID is TL type id of UpdateChatThemes. -const UpdateChatThemesTypeID = 0x98dc58d5 - -// construct implements constructor of UpdateClass. -func (u UpdateChatThemes) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatThemes. -var ( - _ bin.Encoder = &UpdateChatThemes{} - _ bin.Decoder = &UpdateChatThemes{} - _ bin.BareEncoder = &UpdateChatThemes{} - _ bin.BareDecoder = &UpdateChatThemes{} - - _ UpdateClass = &UpdateChatThemes{} -) - -func (u *UpdateChatThemes) Zero() bool { - if u == nil { - return true - } - if !(u.ChatThemes == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatThemes) String() string { - if u == nil { - return "UpdateChatThemes(nil)" - } - type Alias UpdateChatThemes - return fmt.Sprintf("UpdateChatThemes%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatThemes) TypeID() uint32 { - return UpdateChatThemesTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatThemes) TypeName() string { - return "updateChatThemes" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatThemes) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatThemes", - ID: UpdateChatThemesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatThemes", - SchemaName: "chat_themes", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatThemes) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatThemes#98dc58d5 as nil") - } - b.PutID(UpdateChatThemesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatThemes) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatThemes#98dc58d5 as nil") - } - b.PutInt(len(u.ChatThemes)) - for idx, v := range u.ChatThemes { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateChatThemes#98dc58d5: field chat_themes element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatThemes) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatThemes#98dc58d5 to nil") - } - if err := b.ConsumeID(UpdateChatThemesTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatThemes#98dc58d5: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatThemes) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatThemes#98dc58d5 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateChatThemes#98dc58d5: field chat_themes: %w", err) - } - - if headerLen > 0 { - u.ChatThemes = make([]ChatTheme, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ChatTheme - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateChatThemes#98dc58d5: field chat_themes: %w", err) - } - u.ChatThemes = append(u.ChatThemes, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatThemes) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatThemes#98dc58d5 as nil") - } - b.ObjStart() - b.PutID("updateChatThemes") - b.Comma() - b.FieldStart("chat_themes") - b.ArrStart() - for idx, v := range u.ChatThemes { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatThemes#98dc58d5: field chat_themes element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatThemes) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatThemes#98dc58d5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatThemes"); err != nil { - return fmt.Errorf("unable to decode updateChatThemes#98dc58d5: %w", err) - } - case "chat_themes": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ChatTheme - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatThemes#98dc58d5: field chat_themes: %w", err) - } - u.ChatThemes = append(u.ChatThemes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateChatThemes#98dc58d5: field chat_themes: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatThemes returns value of ChatThemes field. -func (u *UpdateChatThemes) GetChatThemes() (value []ChatTheme) { - if u == nil { - return - } - return u.ChatThemes -} - -// UpdateAccentColors represents TL type `updateAccentColors#1316555e`. -type UpdateAccentColors struct { - // Information about supported colors; colors with identifiers 0 (red), 1 (orange), 2 - // (purple/violet), 3 (green), 4 (cyan), 5 (blue), 6 (pink) must always be supported - Colors []AccentColor - // The list of accent color identifiers, which can be set through setAccentColor and - // setChatAccentColor. The colors must be shown in the specified order - AvailableAccentColorIDs []int32 -} - -// UpdateAccentColorsTypeID is TL type id of UpdateAccentColors. -const UpdateAccentColorsTypeID = 0x1316555e - -// construct implements constructor of UpdateClass. -func (u UpdateAccentColors) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateAccentColors. -var ( - _ bin.Encoder = &UpdateAccentColors{} - _ bin.Decoder = &UpdateAccentColors{} - _ bin.BareEncoder = &UpdateAccentColors{} - _ bin.BareDecoder = &UpdateAccentColors{} - - _ UpdateClass = &UpdateAccentColors{} -) - -func (u *UpdateAccentColors) Zero() bool { - if u == nil { - return true - } - if !(u.Colors == nil) { - return false - } - if !(u.AvailableAccentColorIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateAccentColors) String() string { - if u == nil { - return "UpdateAccentColors(nil)" - } - type Alias UpdateAccentColors - return fmt.Sprintf("UpdateAccentColors%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateAccentColors) TypeID() uint32 { - return UpdateAccentColorsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateAccentColors) TypeName() string { - return "updateAccentColors" -} - -// TypeInfo returns info about TL type. -func (u *UpdateAccentColors) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateAccentColors", - ID: UpdateAccentColorsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Colors", - SchemaName: "colors", - }, - { - Name: "AvailableAccentColorIDs", - SchemaName: "available_accent_color_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateAccentColors) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAccentColors#1316555e as nil") - } - b.PutID(UpdateAccentColorsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateAccentColors) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAccentColors#1316555e as nil") - } - b.PutInt(len(u.Colors)) - for idx, v := range u.Colors { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateAccentColors#1316555e: field colors element with index %d: %w", idx, err) - } - } - b.PutInt(len(u.AvailableAccentColorIDs)) - for _, v := range u.AvailableAccentColorIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateAccentColors) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAccentColors#1316555e to nil") - } - if err := b.ConsumeID(UpdateAccentColorsTypeID); err != nil { - return fmt.Errorf("unable to decode updateAccentColors#1316555e: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateAccentColors) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAccentColors#1316555e to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateAccentColors#1316555e: field colors: %w", err) - } - - if headerLen > 0 { - u.Colors = make([]AccentColor, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value AccentColor - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateAccentColors#1316555e: field colors: %w", err) - } - u.Colors = append(u.Colors, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateAccentColors#1316555e: field available_accent_color_ids: %w", err) - } - - if headerLen > 0 { - u.AvailableAccentColorIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateAccentColors#1316555e: field available_accent_color_ids: %w", err) - } - u.AvailableAccentColorIDs = append(u.AvailableAccentColorIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateAccentColors) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateAccentColors#1316555e as nil") - } - b.ObjStart() - b.PutID("updateAccentColors") - b.Comma() - b.FieldStart("colors") - b.ArrStart() - for idx, v := range u.Colors { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateAccentColors#1316555e: field colors element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("available_accent_color_ids") - b.ArrStart() - for _, v := range u.AvailableAccentColorIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateAccentColors) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateAccentColors#1316555e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateAccentColors"); err != nil { - return fmt.Errorf("unable to decode updateAccentColors#1316555e: %w", err) - } - case "colors": - if err := b.Arr(func(b tdjson.Decoder) error { - var value AccentColor - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateAccentColors#1316555e: field colors: %w", err) - } - u.Colors = append(u.Colors, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateAccentColors#1316555e: field colors: %w", err) - } - case "available_accent_color_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateAccentColors#1316555e: field available_accent_color_ids: %w", err) - } - u.AvailableAccentColorIDs = append(u.AvailableAccentColorIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateAccentColors#1316555e: field available_accent_color_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetColors returns value of Colors field. -func (u *UpdateAccentColors) GetColors() (value []AccentColor) { - if u == nil { - return - } - return u.Colors -} - -// GetAvailableAccentColorIDs returns value of AvailableAccentColorIDs field. -func (u *UpdateAccentColors) GetAvailableAccentColorIDs() (value []int32) { - if u == nil { - return - } - return u.AvailableAccentColorIDs -} - -// UpdateProfileAccentColors represents TL type `updateProfileAccentColors#bf8e7430`. -type UpdateProfileAccentColors struct { - // Information about supported colors - Colors []ProfileAccentColor - // The list of accent color identifiers, which can be set through setProfileAccentColor - // and setChatProfileAccentColor. The colors must be shown in the specified order - AvailableAccentColorIDs []int32 -} - -// UpdateProfileAccentColorsTypeID is TL type id of UpdateProfileAccentColors. -const UpdateProfileAccentColorsTypeID = 0xbf8e7430 - -// construct implements constructor of UpdateClass. -func (u UpdateProfileAccentColors) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateProfileAccentColors. -var ( - _ bin.Encoder = &UpdateProfileAccentColors{} - _ bin.Decoder = &UpdateProfileAccentColors{} - _ bin.BareEncoder = &UpdateProfileAccentColors{} - _ bin.BareDecoder = &UpdateProfileAccentColors{} - - _ UpdateClass = &UpdateProfileAccentColors{} -) - -func (u *UpdateProfileAccentColors) Zero() bool { - if u == nil { - return true - } - if !(u.Colors == nil) { - return false - } - if !(u.AvailableAccentColorIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateProfileAccentColors) String() string { - if u == nil { - return "UpdateProfileAccentColors(nil)" - } - type Alias UpdateProfileAccentColors - return fmt.Sprintf("UpdateProfileAccentColors%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateProfileAccentColors) TypeID() uint32 { - return UpdateProfileAccentColorsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateProfileAccentColors) TypeName() string { - return "updateProfileAccentColors" -} - -// TypeInfo returns info about TL type. -func (u *UpdateProfileAccentColors) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateProfileAccentColors", - ID: UpdateProfileAccentColorsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Colors", - SchemaName: "colors", - }, - { - Name: "AvailableAccentColorIDs", - SchemaName: "available_accent_color_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateProfileAccentColors) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateProfileAccentColors#bf8e7430 as nil") - } - b.PutID(UpdateProfileAccentColorsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateProfileAccentColors) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateProfileAccentColors#bf8e7430 as nil") - } - b.PutInt(len(u.Colors)) - for idx, v := range u.Colors { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateProfileAccentColors#bf8e7430: field colors element with index %d: %w", idx, err) - } - } - b.PutInt(len(u.AvailableAccentColorIDs)) - for _, v := range u.AvailableAccentColorIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateProfileAccentColors) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateProfileAccentColors#bf8e7430 to nil") - } - if err := b.ConsumeID(UpdateProfileAccentColorsTypeID); err != nil { - return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateProfileAccentColors) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateProfileAccentColors#bf8e7430 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field colors: %w", err) - } - - if headerLen > 0 { - u.Colors = make([]ProfileAccentColor, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ProfileAccentColor - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateProfileAccentColors#bf8e7430: field colors: %w", err) - } - u.Colors = append(u.Colors, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field available_accent_color_ids: %w", err) - } - - if headerLen > 0 { - u.AvailableAccentColorIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field available_accent_color_ids: %w", err) - } - u.AvailableAccentColorIDs = append(u.AvailableAccentColorIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateProfileAccentColors) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateProfileAccentColors#bf8e7430 as nil") - } - b.ObjStart() - b.PutID("updateProfileAccentColors") - b.Comma() - b.FieldStart("colors") - b.ArrStart() - for idx, v := range u.Colors { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateProfileAccentColors#bf8e7430: field colors element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("available_accent_color_ids") - b.ArrStart() - for _, v := range u.AvailableAccentColorIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateProfileAccentColors) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateProfileAccentColors#bf8e7430 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateProfileAccentColors"); err != nil { - return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: %w", err) - } - case "colors": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ProfileAccentColor - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field colors: %w", err) - } - u.Colors = append(u.Colors, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field colors: %w", err) - } - case "available_accent_color_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field available_accent_color_ids: %w", err) - } - u.AvailableAccentColorIDs = append(u.AvailableAccentColorIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateProfileAccentColors#bf8e7430: field available_accent_color_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetColors returns value of Colors field. -func (u *UpdateProfileAccentColors) GetColors() (value []ProfileAccentColor) { - if u == nil { - return - } - return u.Colors -} - -// GetAvailableAccentColorIDs returns value of AvailableAccentColorIDs field. -func (u *UpdateProfileAccentColors) GetAvailableAccentColorIDs() (value []int32) { - if u == nil { - return - } - return u.AvailableAccentColorIDs -} - -// UpdateLanguagePackStrings represents TL type `updateLanguagePackStrings#af87919f`. -type UpdateLanguagePackStrings struct { - // Localization target to which the language pack belongs - LocalizationTarget string - // Identifier of the updated language pack - LanguagePackID string - // List of changed language pack strings; empty if all strings have changed - Strings []LanguagePackString -} - -// UpdateLanguagePackStringsTypeID is TL type id of UpdateLanguagePackStrings. -const UpdateLanguagePackStringsTypeID = 0xaf87919f - -// construct implements constructor of UpdateClass. -func (u UpdateLanguagePackStrings) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateLanguagePackStrings. -var ( - _ bin.Encoder = &UpdateLanguagePackStrings{} - _ bin.Decoder = &UpdateLanguagePackStrings{} - _ bin.BareEncoder = &UpdateLanguagePackStrings{} - _ bin.BareDecoder = &UpdateLanguagePackStrings{} - - _ UpdateClass = &UpdateLanguagePackStrings{} -) - -func (u *UpdateLanguagePackStrings) Zero() bool { - if u == nil { - return true - } - if !(u.LocalizationTarget == "") { - return false - } - if !(u.LanguagePackID == "") { - return false - } - if !(u.Strings == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateLanguagePackStrings) String() string { - if u == nil { - return "UpdateLanguagePackStrings(nil)" - } - type Alias UpdateLanguagePackStrings - return fmt.Sprintf("UpdateLanguagePackStrings%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateLanguagePackStrings) TypeID() uint32 { - return UpdateLanguagePackStringsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateLanguagePackStrings) TypeName() string { - return "updateLanguagePackStrings" -} - -// TypeInfo returns info about TL type. -func (u *UpdateLanguagePackStrings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateLanguagePackStrings", - ID: UpdateLanguagePackStringsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LocalizationTarget", - SchemaName: "localization_target", - }, - { - Name: "LanguagePackID", - SchemaName: "language_pack_id", - }, - { - Name: "Strings", - SchemaName: "strings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateLanguagePackStrings) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateLanguagePackStrings#af87919f as nil") - } - b.PutID(UpdateLanguagePackStringsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateLanguagePackStrings) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateLanguagePackStrings#af87919f as nil") - } - b.PutString(u.LocalizationTarget) - b.PutString(u.LanguagePackID) - b.PutInt(len(u.Strings)) - for idx, v := range u.Strings { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateLanguagePackStrings#af87919f: field strings element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateLanguagePackStrings) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateLanguagePackStrings#af87919f to nil") - } - if err := b.ConsumeID(UpdateLanguagePackStringsTypeID); err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateLanguagePackStrings) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateLanguagePackStrings#af87919f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field localization_target: %w", err) - } - u.LocalizationTarget = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field language_pack_id: %w", err) - } - u.LanguagePackID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field strings: %w", err) - } - - if headerLen > 0 { - u.Strings = make([]LanguagePackString, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value LanguagePackString - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateLanguagePackStrings#af87919f: field strings: %w", err) - } - u.Strings = append(u.Strings, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateLanguagePackStrings) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateLanguagePackStrings#af87919f as nil") - } - b.ObjStart() - b.PutID("updateLanguagePackStrings") - b.Comma() - b.FieldStart("localization_target") - b.PutString(u.LocalizationTarget) - b.Comma() - b.FieldStart("language_pack_id") - b.PutString(u.LanguagePackID) - b.Comma() - b.FieldStart("strings") - b.ArrStart() - for idx, v := range u.Strings { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateLanguagePackStrings#af87919f: field strings element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateLanguagePackStrings) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateLanguagePackStrings#af87919f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateLanguagePackStrings"); err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: %w", err) - } - case "localization_target": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field localization_target: %w", err) - } - u.LocalizationTarget = value - case "language_pack_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field language_pack_id: %w", err) - } - u.LanguagePackID = value - case "strings": - if err := b.Arr(func(b tdjson.Decoder) error { - var value LanguagePackString - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field strings: %w", err) - } - u.Strings = append(u.Strings, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateLanguagePackStrings#af87919f: field strings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetLocalizationTarget returns value of LocalizationTarget field. -func (u *UpdateLanguagePackStrings) GetLocalizationTarget() (value string) { - if u == nil { - return - } - return u.LocalizationTarget -} - -// GetLanguagePackID returns value of LanguagePackID field. -func (u *UpdateLanguagePackStrings) GetLanguagePackID() (value string) { - if u == nil { - return - } - return u.LanguagePackID -} - -// GetStrings returns value of Strings field. -func (u *UpdateLanguagePackStrings) GetStrings() (value []LanguagePackString) { - if u == nil { - return - } - return u.Strings -} - -// UpdateConnectionState represents TL type `updateConnectionState#57939e2e`. -type UpdateConnectionState struct { - // The new connection state - State ConnectionStateClass -} - -// UpdateConnectionStateTypeID is TL type id of UpdateConnectionState. -const UpdateConnectionStateTypeID = 0x57939e2e - -// construct implements constructor of UpdateClass. -func (u UpdateConnectionState) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateConnectionState. -var ( - _ bin.Encoder = &UpdateConnectionState{} - _ bin.Decoder = &UpdateConnectionState{} - _ bin.BareEncoder = &UpdateConnectionState{} - _ bin.BareDecoder = &UpdateConnectionState{} - - _ UpdateClass = &UpdateConnectionState{} -) - -func (u *UpdateConnectionState) Zero() bool { - if u == nil { - return true - } - if !(u.State == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateConnectionState) String() string { - if u == nil { - return "UpdateConnectionState(nil)" - } - type Alias UpdateConnectionState - return fmt.Sprintf("UpdateConnectionState%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateConnectionState) TypeID() uint32 { - return UpdateConnectionStateTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateConnectionState) TypeName() string { - return "updateConnectionState" -} - -// TypeInfo returns info about TL type. -func (u *UpdateConnectionState) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateConnectionState", - ID: UpdateConnectionStateTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "State", - SchemaName: "state", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateConnectionState) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateConnectionState#57939e2e as nil") - } - b.PutID(UpdateConnectionStateTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateConnectionState) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateConnectionState#57939e2e as nil") - } - if u.State == nil { - return fmt.Errorf("unable to encode updateConnectionState#57939e2e: field state is nil") - } - if err := u.State.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateConnectionState#57939e2e: field state: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateConnectionState) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateConnectionState#57939e2e to nil") - } - if err := b.ConsumeID(UpdateConnectionStateTypeID); err != nil { - return fmt.Errorf("unable to decode updateConnectionState#57939e2e: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateConnectionState) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateConnectionState#57939e2e to nil") - } - { - value, err := DecodeConnectionState(b) - if err != nil { - return fmt.Errorf("unable to decode updateConnectionState#57939e2e: field state: %w", err) - } - u.State = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateConnectionState) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateConnectionState#57939e2e as nil") - } - b.ObjStart() - b.PutID("updateConnectionState") - b.Comma() - b.FieldStart("state") - if u.State == nil { - return fmt.Errorf("unable to encode updateConnectionState#57939e2e: field state is nil") - } - if err := u.State.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateConnectionState#57939e2e: field state: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateConnectionState) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateConnectionState#57939e2e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateConnectionState"); err != nil { - return fmt.Errorf("unable to decode updateConnectionState#57939e2e: %w", err) - } - case "state": - value, err := DecodeTDLibJSONConnectionState(b) - if err != nil { - return fmt.Errorf("unable to decode updateConnectionState#57939e2e: field state: %w", err) - } - u.State = value - default: - return b.Skip() - } - return nil - }) -} - -// GetState returns value of State field. -func (u *UpdateConnectionState) GetState() (value ConnectionStateClass) { - if u == nil { - return - } - return u.State -} - -// UpdateTermsOfService represents TL type `updateTermsOfService#b23cc55e`. -type UpdateTermsOfService struct { - // Identifier of the terms of service - TermsOfServiceID string - // The new terms of service - TermsOfService TermsOfService -} - -// UpdateTermsOfServiceTypeID is TL type id of UpdateTermsOfService. -const UpdateTermsOfServiceTypeID = 0xb23cc55e - -// construct implements constructor of UpdateClass. -func (u UpdateTermsOfService) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateTermsOfService. -var ( - _ bin.Encoder = &UpdateTermsOfService{} - _ bin.Decoder = &UpdateTermsOfService{} - _ bin.BareEncoder = &UpdateTermsOfService{} - _ bin.BareDecoder = &UpdateTermsOfService{} - - _ UpdateClass = &UpdateTermsOfService{} -) - -func (u *UpdateTermsOfService) Zero() bool { - if u == nil { - return true - } - if !(u.TermsOfServiceID == "") { - return false - } - if !(u.TermsOfService.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateTermsOfService) String() string { - if u == nil { - return "UpdateTermsOfService(nil)" - } - type Alias UpdateTermsOfService - return fmt.Sprintf("UpdateTermsOfService%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateTermsOfService) TypeID() uint32 { - return UpdateTermsOfServiceTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateTermsOfService) TypeName() string { - return "updateTermsOfService" -} - -// TypeInfo returns info about TL type. -func (u *UpdateTermsOfService) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateTermsOfService", - ID: UpdateTermsOfServiceTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TermsOfServiceID", - SchemaName: "terms_of_service_id", - }, - { - Name: "TermsOfService", - SchemaName: "terms_of_service", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateTermsOfService) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateTermsOfService#b23cc55e as nil") - } - b.PutID(UpdateTermsOfServiceTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateTermsOfService) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateTermsOfService#b23cc55e as nil") - } - b.PutString(u.TermsOfServiceID) - if err := u.TermsOfService.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateTermsOfService#b23cc55e: field terms_of_service: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateTermsOfService) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateTermsOfService#b23cc55e to nil") - } - if err := b.ConsumeID(UpdateTermsOfServiceTypeID); err != nil { - return fmt.Errorf("unable to decode updateTermsOfService#b23cc55e: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateTermsOfService) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateTermsOfService#b23cc55e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateTermsOfService#b23cc55e: field terms_of_service_id: %w", err) - } - u.TermsOfServiceID = value - } - { - if err := u.TermsOfService.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateTermsOfService#b23cc55e: field terms_of_service: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateTermsOfService) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateTermsOfService#b23cc55e as nil") - } - b.ObjStart() - b.PutID("updateTermsOfService") - b.Comma() - b.FieldStart("terms_of_service_id") - b.PutString(u.TermsOfServiceID) - b.Comma() - b.FieldStart("terms_of_service") - if err := u.TermsOfService.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateTermsOfService#b23cc55e: field terms_of_service: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateTermsOfService) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateTermsOfService#b23cc55e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateTermsOfService"); err != nil { - return fmt.Errorf("unable to decode updateTermsOfService#b23cc55e: %w", err) - } - case "terms_of_service_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateTermsOfService#b23cc55e: field terms_of_service_id: %w", err) - } - u.TermsOfServiceID = value - case "terms_of_service": - if err := u.TermsOfService.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateTermsOfService#b23cc55e: field terms_of_service: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTermsOfServiceID returns value of TermsOfServiceID field. -func (u *UpdateTermsOfService) GetTermsOfServiceID() (value string) { - if u == nil { - return - } - return u.TermsOfServiceID -} - -// GetTermsOfService returns value of TermsOfService field. -func (u *UpdateTermsOfService) GetTermsOfService() (value TermsOfService) { - if u == nil { - return - } - return u.TermsOfService -} - -// UpdateUnconfirmedSession represents TL type `updateUnconfirmedSession#fea6088c`. -type UpdateUnconfirmedSession struct { - // The unconfirmed session; may be null if none - Session UnconfirmedSession -} - -// UpdateUnconfirmedSessionTypeID is TL type id of UpdateUnconfirmedSession. -const UpdateUnconfirmedSessionTypeID = 0xfea6088c - -// construct implements constructor of UpdateClass. -func (u UpdateUnconfirmedSession) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateUnconfirmedSession. -var ( - _ bin.Encoder = &UpdateUnconfirmedSession{} - _ bin.Decoder = &UpdateUnconfirmedSession{} - _ bin.BareEncoder = &UpdateUnconfirmedSession{} - _ bin.BareDecoder = &UpdateUnconfirmedSession{} - - _ UpdateClass = &UpdateUnconfirmedSession{} -) - -func (u *UpdateUnconfirmedSession) Zero() bool { - if u == nil { - return true - } - if !(u.Session.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateUnconfirmedSession) String() string { - if u == nil { - return "UpdateUnconfirmedSession(nil)" - } - type Alias UpdateUnconfirmedSession - return fmt.Sprintf("UpdateUnconfirmedSession%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateUnconfirmedSession) TypeID() uint32 { - return UpdateUnconfirmedSessionTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateUnconfirmedSession) TypeName() string { - return "updateUnconfirmedSession" -} - -// TypeInfo returns info about TL type. -func (u *UpdateUnconfirmedSession) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateUnconfirmedSession", - ID: UpdateUnconfirmedSessionTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Session", - SchemaName: "session", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateUnconfirmedSession) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUnconfirmedSession#fea6088c as nil") - } - b.PutID(UpdateUnconfirmedSessionTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateUnconfirmedSession) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateUnconfirmedSession#fea6088c as nil") - } - if err := u.Session.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateUnconfirmedSession#fea6088c: field session: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateUnconfirmedSession) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUnconfirmedSession#fea6088c to nil") - } - if err := b.ConsumeID(UpdateUnconfirmedSessionTypeID); err != nil { - return fmt.Errorf("unable to decode updateUnconfirmedSession#fea6088c: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateUnconfirmedSession) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateUnconfirmedSession#fea6088c to nil") - } - { - if err := u.Session.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateUnconfirmedSession#fea6088c: field session: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateUnconfirmedSession) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateUnconfirmedSession#fea6088c as nil") - } - b.ObjStart() - b.PutID("updateUnconfirmedSession") - b.Comma() - b.FieldStart("session") - if err := u.Session.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateUnconfirmedSession#fea6088c: field session: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateUnconfirmedSession) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateUnconfirmedSession#fea6088c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateUnconfirmedSession"); err != nil { - return fmt.Errorf("unable to decode updateUnconfirmedSession#fea6088c: %w", err) - } - case "session": - if err := u.Session.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateUnconfirmedSession#fea6088c: field session: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSession returns value of Session field. -func (u *UpdateUnconfirmedSession) GetSession() (value UnconfirmedSession) { - if u == nil { - return - } - return u.Session -} - -// UpdateAttachmentMenuBots represents TL type `updateAttachmentMenuBots#b6b910c`. -type UpdateAttachmentMenuBots struct { - // The new list of bots. The bots must not be shown on scheduled messages screen - Bots []AttachmentMenuBot -} - -// UpdateAttachmentMenuBotsTypeID is TL type id of UpdateAttachmentMenuBots. -const UpdateAttachmentMenuBotsTypeID = 0xb6b910c - -// construct implements constructor of UpdateClass. -func (u UpdateAttachmentMenuBots) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateAttachmentMenuBots. -var ( - _ bin.Encoder = &UpdateAttachmentMenuBots{} - _ bin.Decoder = &UpdateAttachmentMenuBots{} - _ bin.BareEncoder = &UpdateAttachmentMenuBots{} - _ bin.BareDecoder = &UpdateAttachmentMenuBots{} - - _ UpdateClass = &UpdateAttachmentMenuBots{} -) - -func (u *UpdateAttachmentMenuBots) Zero() bool { - if u == nil { - return true - } - if !(u.Bots == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateAttachmentMenuBots) String() string { - if u == nil { - return "UpdateAttachmentMenuBots(nil)" - } - type Alias UpdateAttachmentMenuBots - return fmt.Sprintf("UpdateAttachmentMenuBots%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateAttachmentMenuBots) TypeID() uint32 { - return UpdateAttachmentMenuBotsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateAttachmentMenuBots) TypeName() string { - return "updateAttachmentMenuBots" -} - -// TypeInfo returns info about TL type. -func (u *UpdateAttachmentMenuBots) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateAttachmentMenuBots", - ID: UpdateAttachmentMenuBotsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Bots", - SchemaName: "bots", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateAttachmentMenuBots) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAttachmentMenuBots#b6b910c as nil") - } - b.PutID(UpdateAttachmentMenuBotsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateAttachmentMenuBots) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAttachmentMenuBots#b6b910c as nil") - } - b.PutInt(len(u.Bots)) - for idx, v := range u.Bots { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateAttachmentMenuBots#b6b910c: field bots element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateAttachmentMenuBots) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAttachmentMenuBots#b6b910c to nil") - } - if err := b.ConsumeID(UpdateAttachmentMenuBotsTypeID); err != nil { - return fmt.Errorf("unable to decode updateAttachmentMenuBots#b6b910c: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateAttachmentMenuBots) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAttachmentMenuBots#b6b910c to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateAttachmentMenuBots#b6b910c: field bots: %w", err) - } - - if headerLen > 0 { - u.Bots = make([]AttachmentMenuBot, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value AttachmentMenuBot - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateAttachmentMenuBots#b6b910c: field bots: %w", err) - } - u.Bots = append(u.Bots, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateAttachmentMenuBots) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateAttachmentMenuBots#b6b910c as nil") - } - b.ObjStart() - b.PutID("updateAttachmentMenuBots") - b.Comma() - b.FieldStart("bots") - b.ArrStart() - for idx, v := range u.Bots { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateAttachmentMenuBots#b6b910c: field bots element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateAttachmentMenuBots) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateAttachmentMenuBots#b6b910c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateAttachmentMenuBots"); err != nil { - return fmt.Errorf("unable to decode updateAttachmentMenuBots#b6b910c: %w", err) - } - case "bots": - if err := b.Arr(func(b tdjson.Decoder) error { - var value AttachmentMenuBot - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateAttachmentMenuBots#b6b910c: field bots: %w", err) - } - u.Bots = append(u.Bots, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateAttachmentMenuBots#b6b910c: field bots: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetBots returns value of Bots field. -func (u *UpdateAttachmentMenuBots) GetBots() (value []AttachmentMenuBot) { - if u == nil { - return - } - return u.Bots -} - -// UpdateWebAppMessageSent represents TL type `updateWebAppMessageSent#58431229`. -type UpdateWebAppMessageSent struct { - // Identifier of Web App launch - WebAppLaunchID int64 -} - -// UpdateWebAppMessageSentTypeID is TL type id of UpdateWebAppMessageSent. -const UpdateWebAppMessageSentTypeID = 0x58431229 - -// construct implements constructor of UpdateClass. -func (u UpdateWebAppMessageSent) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateWebAppMessageSent. -var ( - _ bin.Encoder = &UpdateWebAppMessageSent{} - _ bin.Decoder = &UpdateWebAppMessageSent{} - _ bin.BareEncoder = &UpdateWebAppMessageSent{} - _ bin.BareDecoder = &UpdateWebAppMessageSent{} - - _ UpdateClass = &UpdateWebAppMessageSent{} -) - -func (u *UpdateWebAppMessageSent) Zero() bool { - if u == nil { - return true - } - if !(u.WebAppLaunchID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateWebAppMessageSent) String() string { - if u == nil { - return "UpdateWebAppMessageSent(nil)" - } - type Alias UpdateWebAppMessageSent - return fmt.Sprintf("UpdateWebAppMessageSent%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateWebAppMessageSent) TypeID() uint32 { - return UpdateWebAppMessageSentTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateWebAppMessageSent) TypeName() string { - return "updateWebAppMessageSent" -} - -// TypeInfo returns info about TL type. -func (u *UpdateWebAppMessageSent) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateWebAppMessageSent", - ID: UpdateWebAppMessageSentTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WebAppLaunchID", - SchemaName: "web_app_launch_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateWebAppMessageSent) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateWebAppMessageSent#58431229 as nil") - } - b.PutID(UpdateWebAppMessageSentTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateWebAppMessageSent) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateWebAppMessageSent#58431229 as nil") - } - b.PutLong(u.WebAppLaunchID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateWebAppMessageSent) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateWebAppMessageSent#58431229 to nil") - } - if err := b.ConsumeID(UpdateWebAppMessageSentTypeID); err != nil { - return fmt.Errorf("unable to decode updateWebAppMessageSent#58431229: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateWebAppMessageSent) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateWebAppMessageSent#58431229 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateWebAppMessageSent#58431229: field web_app_launch_id: %w", err) - } - u.WebAppLaunchID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateWebAppMessageSent) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateWebAppMessageSent#58431229 as nil") - } - b.ObjStart() - b.PutID("updateWebAppMessageSent") - b.Comma() - b.FieldStart("web_app_launch_id") - b.PutLong(u.WebAppLaunchID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateWebAppMessageSent) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateWebAppMessageSent#58431229 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateWebAppMessageSent"); err != nil { - return fmt.Errorf("unable to decode updateWebAppMessageSent#58431229: %w", err) - } - case "web_app_launch_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateWebAppMessageSent#58431229: field web_app_launch_id: %w", err) - } - u.WebAppLaunchID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWebAppLaunchID returns value of WebAppLaunchID field. -func (u *UpdateWebAppMessageSent) GetWebAppLaunchID() (value int64) { - if u == nil { - return - } - return u.WebAppLaunchID -} - -// UpdateActiveEmojiReactions represents TL type `updateActiveEmojiReactions#691ffcb7`. -type UpdateActiveEmojiReactions struct { - // The new list of active emoji reactions - Emojis []string -} - -// UpdateActiveEmojiReactionsTypeID is TL type id of UpdateActiveEmojiReactions. -const UpdateActiveEmojiReactionsTypeID = 0x691ffcb7 - -// construct implements constructor of UpdateClass. -func (u UpdateActiveEmojiReactions) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateActiveEmojiReactions. -var ( - _ bin.Encoder = &UpdateActiveEmojiReactions{} - _ bin.Decoder = &UpdateActiveEmojiReactions{} - _ bin.BareEncoder = &UpdateActiveEmojiReactions{} - _ bin.BareDecoder = &UpdateActiveEmojiReactions{} - - _ UpdateClass = &UpdateActiveEmojiReactions{} -) - -func (u *UpdateActiveEmojiReactions) Zero() bool { - if u == nil { - return true - } - if !(u.Emojis == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateActiveEmojiReactions) String() string { - if u == nil { - return "UpdateActiveEmojiReactions(nil)" - } - type Alias UpdateActiveEmojiReactions - return fmt.Sprintf("UpdateActiveEmojiReactions%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateActiveEmojiReactions) TypeID() uint32 { - return UpdateActiveEmojiReactionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateActiveEmojiReactions) TypeName() string { - return "updateActiveEmojiReactions" -} - -// TypeInfo returns info about TL type. -func (u *UpdateActiveEmojiReactions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateActiveEmojiReactions", - ID: UpdateActiveEmojiReactionsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Emojis", - SchemaName: "emojis", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateActiveEmojiReactions) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateActiveEmojiReactions#691ffcb7 as nil") - } - b.PutID(UpdateActiveEmojiReactionsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateActiveEmojiReactions) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateActiveEmojiReactions#691ffcb7 as nil") - } - b.PutInt(len(u.Emojis)) - for _, v := range u.Emojis { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateActiveEmojiReactions) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateActiveEmojiReactions#691ffcb7 to nil") - } - if err := b.ConsumeID(UpdateActiveEmojiReactionsTypeID); err != nil { - return fmt.Errorf("unable to decode updateActiveEmojiReactions#691ffcb7: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateActiveEmojiReactions) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateActiveEmojiReactions#691ffcb7 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateActiveEmojiReactions#691ffcb7: field emojis: %w", err) - } - - if headerLen > 0 { - u.Emojis = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateActiveEmojiReactions#691ffcb7: field emojis: %w", err) - } - u.Emojis = append(u.Emojis, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateActiveEmojiReactions) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateActiveEmojiReactions#691ffcb7 as nil") - } - b.ObjStart() - b.PutID("updateActiveEmojiReactions") - b.Comma() - b.FieldStart("emojis") - b.ArrStart() - for _, v := range u.Emojis { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateActiveEmojiReactions) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateActiveEmojiReactions#691ffcb7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateActiveEmojiReactions"); err != nil { - return fmt.Errorf("unable to decode updateActiveEmojiReactions#691ffcb7: %w", err) - } - case "emojis": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateActiveEmojiReactions#691ffcb7: field emojis: %w", err) - } - u.Emojis = append(u.Emojis, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateActiveEmojiReactions#691ffcb7: field emojis: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetEmojis returns value of Emojis field. -func (u *UpdateActiveEmojiReactions) GetEmojis() (value []string) { - if u == nil { - return - } - return u.Emojis -} - -// UpdateAvailableMessageEffects represents TL type `updateAvailableMessageEffects#a1cb72b9`. -type UpdateAvailableMessageEffects struct { - // The new list of available message effects from emoji reactions - ReactionEffectIDs []int64 - // The new list of available message effects from Premium stickers - StickerEffectIDs []int64 -} - -// UpdateAvailableMessageEffectsTypeID is TL type id of UpdateAvailableMessageEffects. -const UpdateAvailableMessageEffectsTypeID = 0xa1cb72b9 - -// construct implements constructor of UpdateClass. -func (u UpdateAvailableMessageEffects) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateAvailableMessageEffects. -var ( - _ bin.Encoder = &UpdateAvailableMessageEffects{} - _ bin.Decoder = &UpdateAvailableMessageEffects{} - _ bin.BareEncoder = &UpdateAvailableMessageEffects{} - _ bin.BareDecoder = &UpdateAvailableMessageEffects{} - - _ UpdateClass = &UpdateAvailableMessageEffects{} -) - -func (u *UpdateAvailableMessageEffects) Zero() bool { - if u == nil { - return true - } - if !(u.ReactionEffectIDs == nil) { - return false - } - if !(u.StickerEffectIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateAvailableMessageEffects) String() string { - if u == nil { - return "UpdateAvailableMessageEffects(nil)" - } - type Alias UpdateAvailableMessageEffects - return fmt.Sprintf("UpdateAvailableMessageEffects%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateAvailableMessageEffects) TypeID() uint32 { - return UpdateAvailableMessageEffectsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateAvailableMessageEffects) TypeName() string { - return "updateAvailableMessageEffects" -} - -// TypeInfo returns info about TL type. -func (u *UpdateAvailableMessageEffects) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateAvailableMessageEffects", - ID: UpdateAvailableMessageEffectsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ReactionEffectIDs", - SchemaName: "reaction_effect_ids", - }, - { - Name: "StickerEffectIDs", - SchemaName: "sticker_effect_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateAvailableMessageEffects) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAvailableMessageEffects#a1cb72b9 as nil") - } - b.PutID(UpdateAvailableMessageEffectsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateAvailableMessageEffects) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAvailableMessageEffects#a1cb72b9 as nil") - } - b.PutInt(len(u.ReactionEffectIDs)) - for _, v := range u.ReactionEffectIDs { - b.PutLong(v) - } - b.PutInt(len(u.StickerEffectIDs)) - for _, v := range u.StickerEffectIDs { - b.PutLong(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateAvailableMessageEffects) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAvailableMessageEffects#a1cb72b9 to nil") - } - if err := b.ConsumeID(UpdateAvailableMessageEffectsTypeID); err != nil { - return fmt.Errorf("unable to decode updateAvailableMessageEffects#a1cb72b9: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateAvailableMessageEffects) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAvailableMessageEffects#a1cb72b9 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateAvailableMessageEffects#a1cb72b9: field reaction_effect_ids: %w", err) - } - - if headerLen > 0 { - u.ReactionEffectIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateAvailableMessageEffects#a1cb72b9: field reaction_effect_ids: %w", err) - } - u.ReactionEffectIDs = append(u.ReactionEffectIDs, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateAvailableMessageEffects#a1cb72b9: field sticker_effect_ids: %w", err) - } - - if headerLen > 0 { - u.StickerEffectIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateAvailableMessageEffects#a1cb72b9: field sticker_effect_ids: %w", err) - } - u.StickerEffectIDs = append(u.StickerEffectIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateAvailableMessageEffects) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateAvailableMessageEffects#a1cb72b9 as nil") - } - b.ObjStart() - b.PutID("updateAvailableMessageEffects") - b.Comma() - b.FieldStart("reaction_effect_ids") - b.ArrStart() - for _, v := range u.ReactionEffectIDs { - b.PutLong(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("sticker_effect_ids") - b.ArrStart() - for _, v := range u.StickerEffectIDs { - b.PutLong(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateAvailableMessageEffects) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateAvailableMessageEffects#a1cb72b9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateAvailableMessageEffects"); err != nil { - return fmt.Errorf("unable to decode updateAvailableMessageEffects#a1cb72b9: %w", err) - } - case "reaction_effect_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateAvailableMessageEffects#a1cb72b9: field reaction_effect_ids: %w", err) - } - u.ReactionEffectIDs = append(u.ReactionEffectIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateAvailableMessageEffects#a1cb72b9: field reaction_effect_ids: %w", err) - } - case "sticker_effect_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateAvailableMessageEffects#a1cb72b9: field sticker_effect_ids: %w", err) - } - u.StickerEffectIDs = append(u.StickerEffectIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateAvailableMessageEffects#a1cb72b9: field sticker_effect_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetReactionEffectIDs returns value of ReactionEffectIDs field. -func (u *UpdateAvailableMessageEffects) GetReactionEffectIDs() (value []int64) { - if u == nil { - return - } - return u.ReactionEffectIDs -} - -// GetStickerEffectIDs returns value of StickerEffectIDs field. -func (u *UpdateAvailableMessageEffects) GetStickerEffectIDs() (value []int64) { - if u == nil { - return - } - return u.StickerEffectIDs -} - -// UpdateDefaultReactionType represents TL type `updateDefaultReactionType#4b615105`. -type UpdateDefaultReactionType struct { - // The new type of the default reaction - ReactionType ReactionTypeClass -} - -// UpdateDefaultReactionTypeTypeID is TL type id of UpdateDefaultReactionType. -const UpdateDefaultReactionTypeTypeID = 0x4b615105 - -// construct implements constructor of UpdateClass. -func (u UpdateDefaultReactionType) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateDefaultReactionType. -var ( - _ bin.Encoder = &UpdateDefaultReactionType{} - _ bin.Decoder = &UpdateDefaultReactionType{} - _ bin.BareEncoder = &UpdateDefaultReactionType{} - _ bin.BareDecoder = &UpdateDefaultReactionType{} - - _ UpdateClass = &UpdateDefaultReactionType{} -) - -func (u *UpdateDefaultReactionType) Zero() bool { - if u == nil { - return true - } - if !(u.ReactionType == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateDefaultReactionType) String() string { - if u == nil { - return "UpdateDefaultReactionType(nil)" - } - type Alias UpdateDefaultReactionType - return fmt.Sprintf("UpdateDefaultReactionType%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateDefaultReactionType) TypeID() uint32 { - return UpdateDefaultReactionTypeTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateDefaultReactionType) TypeName() string { - return "updateDefaultReactionType" -} - -// TypeInfo returns info about TL type. -func (u *UpdateDefaultReactionType) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateDefaultReactionType", - ID: UpdateDefaultReactionTypeTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ReactionType", - SchemaName: "reaction_type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateDefaultReactionType) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateDefaultReactionType#4b615105 as nil") - } - b.PutID(UpdateDefaultReactionTypeTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateDefaultReactionType) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateDefaultReactionType#4b615105 as nil") - } - if u.ReactionType == nil { - return fmt.Errorf("unable to encode updateDefaultReactionType#4b615105: field reaction_type is nil") - } - if err := u.ReactionType.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateDefaultReactionType#4b615105: field reaction_type: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateDefaultReactionType) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateDefaultReactionType#4b615105 to nil") - } - if err := b.ConsumeID(UpdateDefaultReactionTypeTypeID); err != nil { - return fmt.Errorf("unable to decode updateDefaultReactionType#4b615105: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateDefaultReactionType) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateDefaultReactionType#4b615105 to nil") - } - { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode updateDefaultReactionType#4b615105: field reaction_type: %w", err) - } - u.ReactionType = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateDefaultReactionType) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateDefaultReactionType#4b615105 as nil") - } - b.ObjStart() - b.PutID("updateDefaultReactionType") - b.Comma() - b.FieldStart("reaction_type") - if u.ReactionType == nil { - return fmt.Errorf("unable to encode updateDefaultReactionType#4b615105: field reaction_type is nil") - } - if err := u.ReactionType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateDefaultReactionType#4b615105: field reaction_type: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateDefaultReactionType) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateDefaultReactionType#4b615105 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateDefaultReactionType"); err != nil { - return fmt.Errorf("unable to decode updateDefaultReactionType#4b615105: %w", err) - } - case "reaction_type": - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode updateDefaultReactionType#4b615105: field reaction_type: %w", err) - } - u.ReactionType = value - default: - return b.Skip() - } - return nil - }) -} - -// GetReactionType returns value of ReactionType field. -func (u *UpdateDefaultReactionType) GetReactionType() (value ReactionTypeClass) { - if u == nil { - return - } - return u.ReactionType -} - -// UpdateSavedMessagesTags represents TL type `updateSavedMessagesTags#7386424a`. -type UpdateSavedMessagesTags struct { - // Identifier of Saved Messages topic which tags were changed; 0 if tags for the whole - // chat has changed - SavedMessagesTopicID int64 - // The new tags - Tags SavedMessagesTags -} - -// UpdateSavedMessagesTagsTypeID is TL type id of UpdateSavedMessagesTags. -const UpdateSavedMessagesTagsTypeID = 0x7386424a - -// construct implements constructor of UpdateClass. -func (u UpdateSavedMessagesTags) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateSavedMessagesTags. -var ( - _ bin.Encoder = &UpdateSavedMessagesTags{} - _ bin.Decoder = &UpdateSavedMessagesTags{} - _ bin.BareEncoder = &UpdateSavedMessagesTags{} - _ bin.BareDecoder = &UpdateSavedMessagesTags{} - - _ UpdateClass = &UpdateSavedMessagesTags{} -) - -func (u *UpdateSavedMessagesTags) Zero() bool { - if u == nil { - return true - } - if !(u.SavedMessagesTopicID == 0) { - return false - } - if !(u.Tags.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateSavedMessagesTags) String() string { - if u == nil { - return "UpdateSavedMessagesTags(nil)" - } - type Alias UpdateSavedMessagesTags - return fmt.Sprintf("UpdateSavedMessagesTags%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSavedMessagesTags) TypeID() uint32 { - return UpdateSavedMessagesTagsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateSavedMessagesTags) TypeName() string { - return "updateSavedMessagesTags" -} - -// TypeInfo returns info about TL type. -func (u *UpdateSavedMessagesTags) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateSavedMessagesTags", - ID: UpdateSavedMessagesTagsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SavedMessagesTopicID", - SchemaName: "saved_messages_topic_id", - }, - { - Name: "Tags", - SchemaName: "tags", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateSavedMessagesTags) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTags#7386424a as nil") - } - b.PutID(UpdateSavedMessagesTagsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateSavedMessagesTags) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTags#7386424a as nil") - } - b.PutInt53(u.SavedMessagesTopicID) - if err := u.Tags.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateSavedMessagesTags#7386424a: field tags: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateSavedMessagesTags) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTags#7386424a to nil") - } - if err := b.ConsumeID(UpdateSavedMessagesTagsTypeID); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateSavedMessagesTags) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTags#7386424a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: field saved_messages_topic_id: %w", err) - } - u.SavedMessagesTopicID = value - } - { - if err := u.Tags.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: field tags: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSavedMessagesTags) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateSavedMessagesTags#7386424a as nil") - } - b.ObjStart() - b.PutID("updateSavedMessagesTags") - b.Comma() - b.FieldStart("saved_messages_topic_id") - b.PutInt53(u.SavedMessagesTopicID) - b.Comma() - b.FieldStart("tags") - if err := u.Tags.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateSavedMessagesTags#7386424a: field tags: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSavedMessagesTags) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateSavedMessagesTags#7386424a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateSavedMessagesTags"); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: %w", err) - } - case "saved_messages_topic_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: field saved_messages_topic_id: %w", err) - } - u.SavedMessagesTopicID = value - case "tags": - if err := u.Tags.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateSavedMessagesTags#7386424a: field tags: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetSavedMessagesTopicID returns value of SavedMessagesTopicID field. -func (u *UpdateSavedMessagesTags) GetSavedMessagesTopicID() (value int64) { - if u == nil { - return - } - return u.SavedMessagesTopicID -} - -// GetTags returns value of Tags field. -func (u *UpdateSavedMessagesTags) GetTags() (value SavedMessagesTags) { - if u == nil { - return - } - return u.Tags -} - -// UpdateActiveLiveLocationMessages represents TL type `updateActiveLiveLocationMessages#a20b9b1f`. -type UpdateActiveLiveLocationMessages struct { - // The list of messages with active live locations - Messages []Message -} - -// UpdateActiveLiveLocationMessagesTypeID is TL type id of UpdateActiveLiveLocationMessages. -const UpdateActiveLiveLocationMessagesTypeID = 0xa20b9b1f - -// construct implements constructor of UpdateClass. -func (u UpdateActiveLiveLocationMessages) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateActiveLiveLocationMessages. -var ( - _ bin.Encoder = &UpdateActiveLiveLocationMessages{} - _ bin.Decoder = &UpdateActiveLiveLocationMessages{} - _ bin.BareEncoder = &UpdateActiveLiveLocationMessages{} - _ bin.BareDecoder = &UpdateActiveLiveLocationMessages{} - - _ UpdateClass = &UpdateActiveLiveLocationMessages{} -) - -func (u *UpdateActiveLiveLocationMessages) Zero() bool { - if u == nil { - return true - } - if !(u.Messages == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateActiveLiveLocationMessages) String() string { - if u == nil { - return "UpdateActiveLiveLocationMessages(nil)" - } - type Alias UpdateActiveLiveLocationMessages - return fmt.Sprintf("UpdateActiveLiveLocationMessages%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateActiveLiveLocationMessages) TypeID() uint32 { - return UpdateActiveLiveLocationMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateActiveLiveLocationMessages) TypeName() string { - return "updateActiveLiveLocationMessages" -} - -// TypeInfo returns info about TL type. -func (u *UpdateActiveLiveLocationMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateActiveLiveLocationMessages", - ID: UpdateActiveLiveLocationMessagesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Messages", - SchemaName: "messages", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateActiveLiveLocationMessages) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateActiveLiveLocationMessages#a20b9b1f as nil") - } - b.PutID(UpdateActiveLiveLocationMessagesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateActiveLiveLocationMessages) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateActiveLiveLocationMessages#a20b9b1f as nil") - } - b.PutInt(len(u.Messages)) - for idx, v := range u.Messages { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateActiveLiveLocationMessages#a20b9b1f: field messages element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateActiveLiveLocationMessages) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateActiveLiveLocationMessages#a20b9b1f to nil") - } - if err := b.ConsumeID(UpdateActiveLiveLocationMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode updateActiveLiveLocationMessages#a20b9b1f: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateActiveLiveLocationMessages) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateActiveLiveLocationMessages#a20b9b1f to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateActiveLiveLocationMessages#a20b9b1f: field messages: %w", err) - } - - if headerLen > 0 { - u.Messages = make([]Message, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value Message - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateActiveLiveLocationMessages#a20b9b1f: field messages: %w", err) - } - u.Messages = append(u.Messages, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateActiveLiveLocationMessages) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateActiveLiveLocationMessages#a20b9b1f as nil") - } - b.ObjStart() - b.PutID("updateActiveLiveLocationMessages") - b.Comma() - b.FieldStart("messages") - b.ArrStart() - for idx, v := range u.Messages { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateActiveLiveLocationMessages#a20b9b1f: field messages element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateActiveLiveLocationMessages) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateActiveLiveLocationMessages#a20b9b1f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateActiveLiveLocationMessages"); err != nil { - return fmt.Errorf("unable to decode updateActiveLiveLocationMessages#a20b9b1f: %w", err) - } - case "messages": - if err := b.Arr(func(b tdjson.Decoder) error { - var value Message - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateActiveLiveLocationMessages#a20b9b1f: field messages: %w", err) - } - u.Messages = append(u.Messages, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateActiveLiveLocationMessages#a20b9b1f: field messages: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetMessages returns value of Messages field. -func (u *UpdateActiveLiveLocationMessages) GetMessages() (value []Message) { - if u == nil { - return - } - return u.Messages -} - -// UpdateOwnedStarCount represents TL type `updateOwnedStarCount#af7ebf88`. -type UpdateOwnedStarCount struct { - // The new amount of owned Telegram Stars - StarAmount StarAmount -} - -// UpdateOwnedStarCountTypeID is TL type id of UpdateOwnedStarCount. -const UpdateOwnedStarCountTypeID = 0xaf7ebf88 - -// construct implements constructor of UpdateClass. -func (u UpdateOwnedStarCount) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateOwnedStarCount. -var ( - _ bin.Encoder = &UpdateOwnedStarCount{} - _ bin.Decoder = &UpdateOwnedStarCount{} - _ bin.BareEncoder = &UpdateOwnedStarCount{} - _ bin.BareDecoder = &UpdateOwnedStarCount{} - - _ UpdateClass = &UpdateOwnedStarCount{} -) - -func (u *UpdateOwnedStarCount) Zero() bool { - if u == nil { - return true - } - if !(u.StarAmount.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateOwnedStarCount) String() string { - if u == nil { - return "UpdateOwnedStarCount(nil)" - } - type Alias UpdateOwnedStarCount - return fmt.Sprintf("UpdateOwnedStarCount%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateOwnedStarCount) TypeID() uint32 { - return UpdateOwnedStarCountTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateOwnedStarCount) TypeName() string { - return "updateOwnedStarCount" -} - -// TypeInfo returns info about TL type. -func (u *UpdateOwnedStarCount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateOwnedStarCount", - ID: UpdateOwnedStarCountTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StarAmount", - SchemaName: "star_amount", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateOwnedStarCount) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateOwnedStarCount#af7ebf88 as nil") - } - b.PutID(UpdateOwnedStarCountTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateOwnedStarCount) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateOwnedStarCount#af7ebf88 as nil") - } - if err := u.StarAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateOwnedStarCount#af7ebf88: field star_amount: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateOwnedStarCount) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateOwnedStarCount#af7ebf88 to nil") - } - if err := b.ConsumeID(UpdateOwnedStarCountTypeID); err != nil { - return fmt.Errorf("unable to decode updateOwnedStarCount#af7ebf88: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateOwnedStarCount) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateOwnedStarCount#af7ebf88 to nil") - } - { - if err := u.StarAmount.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateOwnedStarCount#af7ebf88: field star_amount: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateOwnedStarCount) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateOwnedStarCount#af7ebf88 as nil") - } - b.ObjStart() - b.PutID("updateOwnedStarCount") - b.Comma() - b.FieldStart("star_amount") - if err := u.StarAmount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateOwnedStarCount#af7ebf88: field star_amount: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateOwnedStarCount) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateOwnedStarCount#af7ebf88 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateOwnedStarCount"); err != nil { - return fmt.Errorf("unable to decode updateOwnedStarCount#af7ebf88: %w", err) - } - case "star_amount": - if err := u.StarAmount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateOwnedStarCount#af7ebf88: field star_amount: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStarAmount returns value of StarAmount field. -func (u *UpdateOwnedStarCount) GetStarAmount() (value StarAmount) { - if u == nil { - return - } - return u.StarAmount -} - -// UpdateChatRevenueAmount represents TL type `updateChatRevenueAmount#c6c9bcc4`. -type UpdateChatRevenueAmount struct { - // Identifier of the chat - ChatID int64 - // New amount of earned revenue - RevenueAmount ChatRevenueAmount -} - -// UpdateChatRevenueAmountTypeID is TL type id of UpdateChatRevenueAmount. -const UpdateChatRevenueAmountTypeID = 0xc6c9bcc4 - -// construct implements constructor of UpdateClass. -func (u UpdateChatRevenueAmount) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatRevenueAmount. -var ( - _ bin.Encoder = &UpdateChatRevenueAmount{} - _ bin.Decoder = &UpdateChatRevenueAmount{} - _ bin.BareEncoder = &UpdateChatRevenueAmount{} - _ bin.BareDecoder = &UpdateChatRevenueAmount{} - - _ UpdateClass = &UpdateChatRevenueAmount{} -) - -func (u *UpdateChatRevenueAmount) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.RevenueAmount.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatRevenueAmount) String() string { - if u == nil { - return "UpdateChatRevenueAmount(nil)" - } - type Alias UpdateChatRevenueAmount - return fmt.Sprintf("UpdateChatRevenueAmount%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatRevenueAmount) TypeID() uint32 { - return UpdateChatRevenueAmountTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatRevenueAmount) TypeName() string { - return "updateChatRevenueAmount" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatRevenueAmount) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatRevenueAmount", - ID: UpdateChatRevenueAmountTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "RevenueAmount", - SchemaName: "revenue_amount", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatRevenueAmount) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatRevenueAmount#c6c9bcc4 as nil") - } - b.PutID(UpdateChatRevenueAmountTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatRevenueAmount) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatRevenueAmount#c6c9bcc4 as nil") - } - b.PutInt53(u.ChatID) - if err := u.RevenueAmount.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatRevenueAmount#c6c9bcc4: field revenue_amount: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatRevenueAmount) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatRevenueAmount#c6c9bcc4 to nil") - } - if err := b.ConsumeID(UpdateChatRevenueAmountTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatRevenueAmount#c6c9bcc4: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatRevenueAmount) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatRevenueAmount#c6c9bcc4 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatRevenueAmount#c6c9bcc4: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.RevenueAmount.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatRevenueAmount#c6c9bcc4: field revenue_amount: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatRevenueAmount) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatRevenueAmount#c6c9bcc4 as nil") - } - b.ObjStart() - b.PutID("updateChatRevenueAmount") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("revenue_amount") - if err := u.RevenueAmount.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatRevenueAmount#c6c9bcc4: field revenue_amount: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatRevenueAmount) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatRevenueAmount#c6c9bcc4 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatRevenueAmount"); err != nil { - return fmt.Errorf("unable to decode updateChatRevenueAmount#c6c9bcc4: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatRevenueAmount#c6c9bcc4: field chat_id: %w", err) - } - u.ChatID = value - case "revenue_amount": - if err := u.RevenueAmount.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatRevenueAmount#c6c9bcc4: field revenue_amount: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatRevenueAmount) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetRevenueAmount returns value of RevenueAmount field. -func (u *UpdateChatRevenueAmount) GetRevenueAmount() (value ChatRevenueAmount) { - if u == nil { - return - } - return u.RevenueAmount -} - -// UpdateStarRevenueStatus represents TL type `updateStarRevenueStatus#ef4bfccb`. -type UpdateStarRevenueStatus struct { - // Identifier of the owner of the Telegram Stars - OwnerID MessageSenderClass - // New Telegram Star revenue status - Status StarRevenueStatus -} - -// UpdateStarRevenueStatusTypeID is TL type id of UpdateStarRevenueStatus. -const UpdateStarRevenueStatusTypeID = 0xef4bfccb - -// construct implements constructor of UpdateClass. -func (u UpdateStarRevenueStatus) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateStarRevenueStatus. -var ( - _ bin.Encoder = &UpdateStarRevenueStatus{} - _ bin.Decoder = &UpdateStarRevenueStatus{} - _ bin.BareEncoder = &UpdateStarRevenueStatus{} - _ bin.BareDecoder = &UpdateStarRevenueStatus{} - - _ UpdateClass = &UpdateStarRevenueStatus{} -) - -func (u *UpdateStarRevenueStatus) Zero() bool { - if u == nil { - return true - } - if !(u.OwnerID == nil) { - return false - } - if !(u.Status.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateStarRevenueStatus) String() string { - if u == nil { - return "UpdateStarRevenueStatus(nil)" - } - type Alias UpdateStarRevenueStatus - return fmt.Sprintf("UpdateStarRevenueStatus%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateStarRevenueStatus) TypeID() uint32 { - return UpdateStarRevenueStatusTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateStarRevenueStatus) TypeName() string { - return "updateStarRevenueStatus" -} - -// TypeInfo returns info about TL type. -func (u *UpdateStarRevenueStatus) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateStarRevenueStatus", - ID: UpdateStarRevenueStatusTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OwnerID", - SchemaName: "owner_id", - }, - { - Name: "Status", - SchemaName: "status", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateStarRevenueStatus) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStarRevenueStatus#ef4bfccb as nil") - } - b.PutID(UpdateStarRevenueStatusTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateStarRevenueStatus) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateStarRevenueStatus#ef4bfccb as nil") - } - if u.OwnerID == nil { - return fmt.Errorf("unable to encode updateStarRevenueStatus#ef4bfccb: field owner_id is nil") - } - if err := u.OwnerID.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateStarRevenueStatus#ef4bfccb: field owner_id: %w", err) - } - if err := u.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateStarRevenueStatus#ef4bfccb: field status: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateStarRevenueStatus) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStarRevenueStatus#ef4bfccb to nil") - } - if err := b.ConsumeID(UpdateStarRevenueStatusTypeID); err != nil { - return fmt.Errorf("unable to decode updateStarRevenueStatus#ef4bfccb: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateStarRevenueStatus) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateStarRevenueStatus#ef4bfccb to nil") - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode updateStarRevenueStatus#ef4bfccb: field owner_id: %w", err) - } - u.OwnerID = value - } - { - if err := u.Status.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateStarRevenueStatus#ef4bfccb: field status: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateStarRevenueStatus) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateStarRevenueStatus#ef4bfccb as nil") - } - b.ObjStart() - b.PutID("updateStarRevenueStatus") - b.Comma() - b.FieldStart("owner_id") - if u.OwnerID == nil { - return fmt.Errorf("unable to encode updateStarRevenueStatus#ef4bfccb: field owner_id is nil") - } - if err := u.OwnerID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateStarRevenueStatus#ef4bfccb: field owner_id: %w", err) - } - b.Comma() - b.FieldStart("status") - if err := u.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateStarRevenueStatus#ef4bfccb: field status: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateStarRevenueStatus) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateStarRevenueStatus#ef4bfccb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateStarRevenueStatus"); err != nil { - return fmt.Errorf("unable to decode updateStarRevenueStatus#ef4bfccb: %w", err) - } - case "owner_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode updateStarRevenueStatus#ef4bfccb: field owner_id: %w", err) - } - u.OwnerID = value - case "status": - if err := u.Status.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateStarRevenueStatus#ef4bfccb: field status: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOwnerID returns value of OwnerID field. -func (u *UpdateStarRevenueStatus) GetOwnerID() (value MessageSenderClass) { - if u == nil { - return - } - return u.OwnerID -} - -// GetStatus returns value of Status field. -func (u *UpdateStarRevenueStatus) GetStatus() (value StarRevenueStatus) { - if u == nil { - return - } - return u.Status -} - -// UpdateSpeechRecognitionTrial represents TL type `updateSpeechRecognitionTrial#ff4efcc1`. -type UpdateSpeechRecognitionTrial struct { - // The maximum allowed duration of media for speech recognition without Telegram Premium - // subscription, in seconds - MaxMediaDuration int32 - // The total number of allowed speech recognitions per week; 0 if none - WeeklyCount int32 - // Number of left speech recognition attempts this week - LeftCount int32 - // Point in time (Unix timestamp) when the weekly number of tries will reset; 0 if - // unknown - NextResetDate int32 -} - -// UpdateSpeechRecognitionTrialTypeID is TL type id of UpdateSpeechRecognitionTrial. -const UpdateSpeechRecognitionTrialTypeID = 0xff4efcc1 - -// construct implements constructor of UpdateClass. -func (u UpdateSpeechRecognitionTrial) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateSpeechRecognitionTrial. -var ( - _ bin.Encoder = &UpdateSpeechRecognitionTrial{} - _ bin.Decoder = &UpdateSpeechRecognitionTrial{} - _ bin.BareEncoder = &UpdateSpeechRecognitionTrial{} - _ bin.BareDecoder = &UpdateSpeechRecognitionTrial{} - - _ UpdateClass = &UpdateSpeechRecognitionTrial{} -) - -func (u *UpdateSpeechRecognitionTrial) Zero() bool { - if u == nil { - return true - } - if !(u.MaxMediaDuration == 0) { - return false - } - if !(u.WeeklyCount == 0) { - return false - } - if !(u.LeftCount == 0) { - return false - } - if !(u.NextResetDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateSpeechRecognitionTrial) String() string { - if u == nil { - return "UpdateSpeechRecognitionTrial(nil)" - } - type Alias UpdateSpeechRecognitionTrial - return fmt.Sprintf("UpdateSpeechRecognitionTrial%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSpeechRecognitionTrial) TypeID() uint32 { - return UpdateSpeechRecognitionTrialTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateSpeechRecognitionTrial) TypeName() string { - return "updateSpeechRecognitionTrial" -} - -// TypeInfo returns info about TL type. -func (u *UpdateSpeechRecognitionTrial) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateSpeechRecognitionTrial", - ID: UpdateSpeechRecognitionTrialTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "MaxMediaDuration", - SchemaName: "max_media_duration", - }, - { - Name: "WeeklyCount", - SchemaName: "weekly_count", - }, - { - Name: "LeftCount", - SchemaName: "left_count", - }, - { - Name: "NextResetDate", - SchemaName: "next_reset_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateSpeechRecognitionTrial) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSpeechRecognitionTrial#ff4efcc1 as nil") - } - b.PutID(UpdateSpeechRecognitionTrialTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateSpeechRecognitionTrial) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSpeechRecognitionTrial#ff4efcc1 as nil") - } - b.PutInt32(u.MaxMediaDuration) - b.PutInt32(u.WeeklyCount) - b.PutInt32(u.LeftCount) - b.PutInt32(u.NextResetDate) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateSpeechRecognitionTrial) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSpeechRecognitionTrial#ff4efcc1 to nil") - } - if err := b.ConsumeID(UpdateSpeechRecognitionTrialTypeID); err != nil { - return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateSpeechRecognitionTrial) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSpeechRecognitionTrial#ff4efcc1 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field max_media_duration: %w", err) - } - u.MaxMediaDuration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field weekly_count: %w", err) - } - u.WeeklyCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field left_count: %w", err) - } - u.LeftCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field next_reset_date: %w", err) - } - u.NextResetDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSpeechRecognitionTrial) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateSpeechRecognitionTrial#ff4efcc1 as nil") - } - b.ObjStart() - b.PutID("updateSpeechRecognitionTrial") - b.Comma() - b.FieldStart("max_media_duration") - b.PutInt32(u.MaxMediaDuration) - b.Comma() - b.FieldStart("weekly_count") - b.PutInt32(u.WeeklyCount) - b.Comma() - b.FieldStart("left_count") - b.PutInt32(u.LeftCount) - b.Comma() - b.FieldStart("next_reset_date") - b.PutInt32(u.NextResetDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSpeechRecognitionTrial) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateSpeechRecognitionTrial#ff4efcc1 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateSpeechRecognitionTrial"); err != nil { - return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: %w", err) - } - case "max_media_duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field max_media_duration: %w", err) - } - u.MaxMediaDuration = value - case "weekly_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field weekly_count: %w", err) - } - u.WeeklyCount = value - case "left_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field left_count: %w", err) - } - u.LeftCount = value - case "next_reset_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateSpeechRecognitionTrial#ff4efcc1: field next_reset_date: %w", err) - } - u.NextResetDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMaxMediaDuration returns value of MaxMediaDuration field. -func (u *UpdateSpeechRecognitionTrial) GetMaxMediaDuration() (value int32) { - if u == nil { - return - } - return u.MaxMediaDuration -} - -// GetWeeklyCount returns value of WeeklyCount field. -func (u *UpdateSpeechRecognitionTrial) GetWeeklyCount() (value int32) { - if u == nil { - return - } - return u.WeeklyCount -} - -// GetLeftCount returns value of LeftCount field. -func (u *UpdateSpeechRecognitionTrial) GetLeftCount() (value int32) { - if u == nil { - return - } - return u.LeftCount -} - -// GetNextResetDate returns value of NextResetDate field. -func (u *UpdateSpeechRecognitionTrial) GetNextResetDate() (value int32) { - if u == nil { - return - } - return u.NextResetDate -} - -// UpdateDiceEmojis represents TL type `updateDiceEmojis#9d0f91df`. -type UpdateDiceEmojis struct { - // The new list of supported dice emojis - Emojis []string -} - -// UpdateDiceEmojisTypeID is TL type id of UpdateDiceEmojis. -const UpdateDiceEmojisTypeID = 0x9d0f91df - -// construct implements constructor of UpdateClass. -func (u UpdateDiceEmojis) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateDiceEmojis. -var ( - _ bin.Encoder = &UpdateDiceEmojis{} - _ bin.Decoder = &UpdateDiceEmojis{} - _ bin.BareEncoder = &UpdateDiceEmojis{} - _ bin.BareDecoder = &UpdateDiceEmojis{} - - _ UpdateClass = &UpdateDiceEmojis{} -) - -func (u *UpdateDiceEmojis) Zero() bool { - if u == nil { - return true - } - if !(u.Emojis == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateDiceEmojis) String() string { - if u == nil { - return "UpdateDiceEmojis(nil)" - } - type Alias UpdateDiceEmojis - return fmt.Sprintf("UpdateDiceEmojis%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateDiceEmojis) TypeID() uint32 { - return UpdateDiceEmojisTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateDiceEmojis) TypeName() string { - return "updateDiceEmojis" -} - -// TypeInfo returns info about TL type. -func (u *UpdateDiceEmojis) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateDiceEmojis", - ID: UpdateDiceEmojisTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Emojis", - SchemaName: "emojis", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateDiceEmojis) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateDiceEmojis#9d0f91df as nil") - } - b.PutID(UpdateDiceEmojisTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateDiceEmojis) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateDiceEmojis#9d0f91df as nil") - } - b.PutInt(len(u.Emojis)) - for _, v := range u.Emojis { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateDiceEmojis) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateDiceEmojis#9d0f91df to nil") - } - if err := b.ConsumeID(UpdateDiceEmojisTypeID); err != nil { - return fmt.Errorf("unable to decode updateDiceEmojis#9d0f91df: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateDiceEmojis) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateDiceEmojis#9d0f91df to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateDiceEmojis#9d0f91df: field emojis: %w", err) - } - - if headerLen > 0 { - u.Emojis = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateDiceEmojis#9d0f91df: field emojis: %w", err) - } - u.Emojis = append(u.Emojis, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateDiceEmojis) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateDiceEmojis#9d0f91df as nil") - } - b.ObjStart() - b.PutID("updateDiceEmojis") - b.Comma() - b.FieldStart("emojis") - b.ArrStart() - for _, v := range u.Emojis { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateDiceEmojis) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateDiceEmojis#9d0f91df to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateDiceEmojis"); err != nil { - return fmt.Errorf("unable to decode updateDiceEmojis#9d0f91df: %w", err) - } - case "emojis": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateDiceEmojis#9d0f91df: field emojis: %w", err) - } - u.Emojis = append(u.Emojis, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateDiceEmojis#9d0f91df: field emojis: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetEmojis returns value of Emojis field. -func (u *UpdateDiceEmojis) GetEmojis() (value []string) { - if u == nil { - return - } - return u.Emojis -} - -// UpdateAnimatedEmojiMessageClicked represents TL type `updateAnimatedEmojiMessageClicked#a3167405`. -type UpdateAnimatedEmojiMessageClicked struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 - // The animated sticker to be played - Sticker Sticker -} - -// UpdateAnimatedEmojiMessageClickedTypeID is TL type id of UpdateAnimatedEmojiMessageClicked. -const UpdateAnimatedEmojiMessageClickedTypeID = 0xa3167405 - -// construct implements constructor of UpdateClass. -func (u UpdateAnimatedEmojiMessageClicked) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateAnimatedEmojiMessageClicked. -var ( - _ bin.Encoder = &UpdateAnimatedEmojiMessageClicked{} - _ bin.Decoder = &UpdateAnimatedEmojiMessageClicked{} - _ bin.BareEncoder = &UpdateAnimatedEmojiMessageClicked{} - _ bin.BareDecoder = &UpdateAnimatedEmojiMessageClicked{} - - _ UpdateClass = &UpdateAnimatedEmojiMessageClicked{} -) - -func (u *UpdateAnimatedEmojiMessageClicked) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.Sticker.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateAnimatedEmojiMessageClicked) String() string { - if u == nil { - return "UpdateAnimatedEmojiMessageClicked(nil)" - } - type Alias UpdateAnimatedEmojiMessageClicked - return fmt.Sprintf("UpdateAnimatedEmojiMessageClicked%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateAnimatedEmojiMessageClicked) TypeID() uint32 { - return UpdateAnimatedEmojiMessageClickedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateAnimatedEmojiMessageClicked) TypeName() string { - return "updateAnimatedEmojiMessageClicked" -} - -// TypeInfo returns info about TL type. -func (u *UpdateAnimatedEmojiMessageClicked) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateAnimatedEmojiMessageClicked", - ID: UpdateAnimatedEmojiMessageClickedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateAnimatedEmojiMessageClicked) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAnimatedEmojiMessageClicked#a3167405 as nil") - } - b.PutID(UpdateAnimatedEmojiMessageClickedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateAnimatedEmojiMessageClicked) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAnimatedEmojiMessageClicked#a3167405 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - if err := u.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateAnimatedEmojiMessageClicked#a3167405: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateAnimatedEmojiMessageClicked) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAnimatedEmojiMessageClicked#a3167405 to nil") - } - if err := b.ConsumeID(UpdateAnimatedEmojiMessageClickedTypeID); err != nil { - return fmt.Errorf("unable to decode updateAnimatedEmojiMessageClicked#a3167405: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateAnimatedEmojiMessageClicked) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAnimatedEmojiMessageClicked#a3167405 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateAnimatedEmojiMessageClicked#a3167405: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateAnimatedEmojiMessageClicked#a3167405: field message_id: %w", err) - } - u.MessageID = value - } - { - if err := u.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateAnimatedEmojiMessageClicked#a3167405: field sticker: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateAnimatedEmojiMessageClicked) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateAnimatedEmojiMessageClicked#a3167405 as nil") - } - b.ObjStart() - b.PutID("updateAnimatedEmojiMessageClicked") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("sticker") - if err := u.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateAnimatedEmojiMessageClicked#a3167405: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateAnimatedEmojiMessageClicked) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateAnimatedEmojiMessageClicked#a3167405 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateAnimatedEmojiMessageClicked"); err != nil { - return fmt.Errorf("unable to decode updateAnimatedEmojiMessageClicked#a3167405: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateAnimatedEmojiMessageClicked#a3167405: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateAnimatedEmojiMessageClicked#a3167405: field message_id: %w", err) - } - u.MessageID = value - case "sticker": - if err := u.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateAnimatedEmojiMessageClicked#a3167405: field sticker: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateAnimatedEmojiMessageClicked) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateAnimatedEmojiMessageClicked) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetSticker returns value of Sticker field. -func (u *UpdateAnimatedEmojiMessageClicked) GetSticker() (value Sticker) { - if u == nil { - return - } - return u.Sticker -} - -// UpdateAnimationSearchParameters represents TL type `updateAnimationSearchParameters#6016ef01`. -type UpdateAnimationSearchParameters struct { - // Name of the animation search provider - Provider string - // The new list of emojis suggested for searching - Emojis []string -} - -// UpdateAnimationSearchParametersTypeID is TL type id of UpdateAnimationSearchParameters. -const UpdateAnimationSearchParametersTypeID = 0x6016ef01 - -// construct implements constructor of UpdateClass. -func (u UpdateAnimationSearchParameters) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateAnimationSearchParameters. -var ( - _ bin.Encoder = &UpdateAnimationSearchParameters{} - _ bin.Decoder = &UpdateAnimationSearchParameters{} - _ bin.BareEncoder = &UpdateAnimationSearchParameters{} - _ bin.BareDecoder = &UpdateAnimationSearchParameters{} - - _ UpdateClass = &UpdateAnimationSearchParameters{} -) - -func (u *UpdateAnimationSearchParameters) Zero() bool { - if u == nil { - return true - } - if !(u.Provider == "") { - return false - } - if !(u.Emojis == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateAnimationSearchParameters) String() string { - if u == nil { - return "UpdateAnimationSearchParameters(nil)" - } - type Alias UpdateAnimationSearchParameters - return fmt.Sprintf("UpdateAnimationSearchParameters%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateAnimationSearchParameters) TypeID() uint32 { - return UpdateAnimationSearchParametersTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateAnimationSearchParameters) TypeName() string { - return "updateAnimationSearchParameters" -} - -// TypeInfo returns info about TL type. -func (u *UpdateAnimationSearchParameters) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateAnimationSearchParameters", - ID: UpdateAnimationSearchParametersTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Provider", - SchemaName: "provider", - }, - { - Name: "Emojis", - SchemaName: "emojis", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateAnimationSearchParameters) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAnimationSearchParameters#6016ef01 as nil") - } - b.PutID(UpdateAnimationSearchParametersTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateAnimationSearchParameters) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAnimationSearchParameters#6016ef01 as nil") - } - b.PutString(u.Provider) - b.PutInt(len(u.Emojis)) - for _, v := range u.Emojis { - b.PutString(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateAnimationSearchParameters) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAnimationSearchParameters#6016ef01 to nil") - } - if err := b.ConsumeID(UpdateAnimationSearchParametersTypeID); err != nil { - return fmt.Errorf("unable to decode updateAnimationSearchParameters#6016ef01: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateAnimationSearchParameters) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAnimationSearchParameters#6016ef01 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateAnimationSearchParameters#6016ef01: field provider: %w", err) - } - u.Provider = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateAnimationSearchParameters#6016ef01: field emojis: %w", err) - } - - if headerLen > 0 { - u.Emojis = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateAnimationSearchParameters#6016ef01: field emojis: %w", err) - } - u.Emojis = append(u.Emojis, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateAnimationSearchParameters) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateAnimationSearchParameters#6016ef01 as nil") - } - b.ObjStart() - b.PutID("updateAnimationSearchParameters") - b.Comma() - b.FieldStart("provider") - b.PutString(u.Provider) - b.Comma() - b.FieldStart("emojis") - b.ArrStart() - for _, v := range u.Emojis { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateAnimationSearchParameters) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateAnimationSearchParameters#6016ef01 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateAnimationSearchParameters"); err != nil { - return fmt.Errorf("unable to decode updateAnimationSearchParameters#6016ef01: %w", err) - } - case "provider": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateAnimationSearchParameters#6016ef01: field provider: %w", err) - } - u.Provider = value - case "emojis": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateAnimationSearchParameters#6016ef01: field emojis: %w", err) - } - u.Emojis = append(u.Emojis, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateAnimationSearchParameters#6016ef01: field emojis: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetProvider returns value of Provider field. -func (u *UpdateAnimationSearchParameters) GetProvider() (value string) { - if u == nil { - return - } - return u.Provider -} - -// GetEmojis returns value of Emojis field. -func (u *UpdateAnimationSearchParameters) GetEmojis() (value []string) { - if u == nil { - return - } - return u.Emojis -} - -// UpdateSuggestedActions represents TL type `updateSuggestedActions#c2e5cccb`. -type UpdateSuggestedActions struct { - // Added suggested actions - AddedActions []SuggestedActionClass - // Removed suggested actions - RemovedActions []SuggestedActionClass -} - -// UpdateSuggestedActionsTypeID is TL type id of UpdateSuggestedActions. -const UpdateSuggestedActionsTypeID = 0xc2e5cccb - -// construct implements constructor of UpdateClass. -func (u UpdateSuggestedActions) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateSuggestedActions. -var ( - _ bin.Encoder = &UpdateSuggestedActions{} - _ bin.Decoder = &UpdateSuggestedActions{} - _ bin.BareEncoder = &UpdateSuggestedActions{} - _ bin.BareDecoder = &UpdateSuggestedActions{} - - _ UpdateClass = &UpdateSuggestedActions{} -) - -func (u *UpdateSuggestedActions) Zero() bool { - if u == nil { - return true - } - if !(u.AddedActions == nil) { - return false - } - if !(u.RemovedActions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateSuggestedActions) String() string { - if u == nil { - return "UpdateSuggestedActions(nil)" - } - type Alias UpdateSuggestedActions - return fmt.Sprintf("UpdateSuggestedActions%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSuggestedActions) TypeID() uint32 { - return UpdateSuggestedActionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateSuggestedActions) TypeName() string { - return "updateSuggestedActions" -} - -// TypeInfo returns info about TL type. -func (u *UpdateSuggestedActions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateSuggestedActions", - ID: UpdateSuggestedActionsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "AddedActions", - SchemaName: "added_actions", - }, - { - Name: "RemovedActions", - SchemaName: "removed_actions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateSuggestedActions) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSuggestedActions#c2e5cccb as nil") - } - b.PutID(UpdateSuggestedActionsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateSuggestedActions) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSuggestedActions#c2e5cccb as nil") - } - b.PutInt(len(u.AddedActions)) - for idx, v := range u.AddedActions { - if v == nil { - return fmt.Errorf("unable to encode updateSuggestedActions#c2e5cccb: field added_actions element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateSuggestedActions#c2e5cccb: field added_actions element with index %d: %w", idx, err) - } - } - b.PutInt(len(u.RemovedActions)) - for idx, v := range u.RemovedActions { - if v == nil { - return fmt.Errorf("unable to encode updateSuggestedActions#c2e5cccb: field removed_actions element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateSuggestedActions#c2e5cccb: field removed_actions element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateSuggestedActions) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSuggestedActions#c2e5cccb to nil") - } - if err := b.ConsumeID(UpdateSuggestedActionsTypeID); err != nil { - return fmt.Errorf("unable to decode updateSuggestedActions#c2e5cccb: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateSuggestedActions) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSuggestedActions#c2e5cccb to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateSuggestedActions#c2e5cccb: field added_actions: %w", err) - } - - if headerLen > 0 { - u.AddedActions = make([]SuggestedActionClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeSuggestedAction(b) - if err != nil { - return fmt.Errorf("unable to decode updateSuggestedActions#c2e5cccb: field added_actions: %w", err) - } - u.AddedActions = append(u.AddedActions, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateSuggestedActions#c2e5cccb: field removed_actions: %w", err) - } - - if headerLen > 0 { - u.RemovedActions = make([]SuggestedActionClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeSuggestedAction(b) - if err != nil { - return fmt.Errorf("unable to decode updateSuggestedActions#c2e5cccb: field removed_actions: %w", err) - } - u.RemovedActions = append(u.RemovedActions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSuggestedActions) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateSuggestedActions#c2e5cccb as nil") - } - b.ObjStart() - b.PutID("updateSuggestedActions") - b.Comma() - b.FieldStart("added_actions") - b.ArrStart() - for idx, v := range u.AddedActions { - if v == nil { - return fmt.Errorf("unable to encode updateSuggestedActions#c2e5cccb: field added_actions element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateSuggestedActions#c2e5cccb: field added_actions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("removed_actions") - b.ArrStart() - for idx, v := range u.RemovedActions { - if v == nil { - return fmt.Errorf("unable to encode updateSuggestedActions#c2e5cccb: field removed_actions element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateSuggestedActions#c2e5cccb: field removed_actions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSuggestedActions) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateSuggestedActions#c2e5cccb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateSuggestedActions"); err != nil { - return fmt.Errorf("unable to decode updateSuggestedActions#c2e5cccb: %w", err) - } - case "added_actions": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONSuggestedAction(b) - if err != nil { - return fmt.Errorf("unable to decode updateSuggestedActions#c2e5cccb: field added_actions: %w", err) - } - u.AddedActions = append(u.AddedActions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateSuggestedActions#c2e5cccb: field added_actions: %w", err) - } - case "removed_actions": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONSuggestedAction(b) - if err != nil { - return fmt.Errorf("unable to decode updateSuggestedActions#c2e5cccb: field removed_actions: %w", err) - } - u.RemovedActions = append(u.RemovedActions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateSuggestedActions#c2e5cccb: field removed_actions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetAddedActions returns value of AddedActions field. -func (u *UpdateSuggestedActions) GetAddedActions() (value []SuggestedActionClass) { - if u == nil { - return - } - return u.AddedActions -} - -// GetRemovedActions returns value of RemovedActions field. -func (u *UpdateSuggestedActions) GetRemovedActions() (value []SuggestedActionClass) { - if u == nil { - return - } - return u.RemovedActions -} - -// UpdateSpeedLimitNotification represents TL type `updateSpeedLimitNotification#c683d868`. -type UpdateSpeedLimitNotification struct { - // True, if upload speed was limited; false, if download speed was limited - IsUpload bool -} - -// UpdateSpeedLimitNotificationTypeID is TL type id of UpdateSpeedLimitNotification. -const UpdateSpeedLimitNotificationTypeID = 0xc683d868 - -// construct implements constructor of UpdateClass. -func (u UpdateSpeedLimitNotification) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateSpeedLimitNotification. -var ( - _ bin.Encoder = &UpdateSpeedLimitNotification{} - _ bin.Decoder = &UpdateSpeedLimitNotification{} - _ bin.BareEncoder = &UpdateSpeedLimitNotification{} - _ bin.BareDecoder = &UpdateSpeedLimitNotification{} - - _ UpdateClass = &UpdateSpeedLimitNotification{} -) - -func (u *UpdateSpeedLimitNotification) Zero() bool { - if u == nil { - return true - } - if !(u.IsUpload == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateSpeedLimitNotification) String() string { - if u == nil { - return "UpdateSpeedLimitNotification(nil)" - } - type Alias UpdateSpeedLimitNotification - return fmt.Sprintf("UpdateSpeedLimitNotification%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateSpeedLimitNotification) TypeID() uint32 { - return UpdateSpeedLimitNotificationTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateSpeedLimitNotification) TypeName() string { - return "updateSpeedLimitNotification" -} - -// TypeInfo returns info about TL type. -func (u *UpdateSpeedLimitNotification) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateSpeedLimitNotification", - ID: UpdateSpeedLimitNotificationTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsUpload", - SchemaName: "is_upload", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateSpeedLimitNotification) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSpeedLimitNotification#c683d868 as nil") - } - b.PutID(UpdateSpeedLimitNotificationTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateSpeedLimitNotification) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateSpeedLimitNotification#c683d868 as nil") - } - b.PutBool(u.IsUpload) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateSpeedLimitNotification) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSpeedLimitNotification#c683d868 to nil") - } - if err := b.ConsumeID(UpdateSpeedLimitNotificationTypeID); err != nil { - return fmt.Errorf("unable to decode updateSpeedLimitNotification#c683d868: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateSpeedLimitNotification) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateSpeedLimitNotification#c683d868 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateSpeedLimitNotification#c683d868: field is_upload: %w", err) - } - u.IsUpload = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateSpeedLimitNotification) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateSpeedLimitNotification#c683d868 as nil") - } - b.ObjStart() - b.PutID("updateSpeedLimitNotification") - b.Comma() - b.FieldStart("is_upload") - b.PutBool(u.IsUpload) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateSpeedLimitNotification) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateSpeedLimitNotification#c683d868 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateSpeedLimitNotification"); err != nil { - return fmt.Errorf("unable to decode updateSpeedLimitNotification#c683d868: %w", err) - } - case "is_upload": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateSpeedLimitNotification#c683d868: field is_upload: %w", err) - } - u.IsUpload = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsUpload returns value of IsUpload field. -func (u *UpdateSpeedLimitNotification) GetIsUpload() (value bool) { - if u == nil { - return - } - return u.IsUpload -} - -// UpdateContactCloseBirthdays represents TL type `updateContactCloseBirthdays#c88b98ce`. -type UpdateContactCloseBirthdays struct { - // List of contact users with close birthday - CloseBirthdayUsers []CloseBirthdayUser -} - -// UpdateContactCloseBirthdaysTypeID is TL type id of UpdateContactCloseBirthdays. -const UpdateContactCloseBirthdaysTypeID = 0xc88b98ce - -// construct implements constructor of UpdateClass. -func (u UpdateContactCloseBirthdays) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateContactCloseBirthdays. -var ( - _ bin.Encoder = &UpdateContactCloseBirthdays{} - _ bin.Decoder = &UpdateContactCloseBirthdays{} - _ bin.BareEncoder = &UpdateContactCloseBirthdays{} - _ bin.BareDecoder = &UpdateContactCloseBirthdays{} - - _ UpdateClass = &UpdateContactCloseBirthdays{} -) - -func (u *UpdateContactCloseBirthdays) Zero() bool { - if u == nil { - return true - } - if !(u.CloseBirthdayUsers == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateContactCloseBirthdays) String() string { - if u == nil { - return "UpdateContactCloseBirthdays(nil)" - } - type Alias UpdateContactCloseBirthdays - return fmt.Sprintf("UpdateContactCloseBirthdays%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateContactCloseBirthdays) TypeID() uint32 { - return UpdateContactCloseBirthdaysTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateContactCloseBirthdays) TypeName() string { - return "updateContactCloseBirthdays" -} - -// TypeInfo returns info about TL type. -func (u *UpdateContactCloseBirthdays) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateContactCloseBirthdays", - ID: UpdateContactCloseBirthdaysTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CloseBirthdayUsers", - SchemaName: "close_birthday_users", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateContactCloseBirthdays) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateContactCloseBirthdays#c88b98ce as nil") - } - b.PutID(UpdateContactCloseBirthdaysTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateContactCloseBirthdays) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateContactCloseBirthdays#c88b98ce as nil") - } - b.PutInt(len(u.CloseBirthdayUsers)) - for idx, v := range u.CloseBirthdayUsers { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateContactCloseBirthdays#c88b98ce: field close_birthday_users element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateContactCloseBirthdays) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateContactCloseBirthdays#c88b98ce to nil") - } - if err := b.ConsumeID(UpdateContactCloseBirthdaysTypeID); err != nil { - return fmt.Errorf("unable to decode updateContactCloseBirthdays#c88b98ce: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateContactCloseBirthdays) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateContactCloseBirthdays#c88b98ce to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateContactCloseBirthdays#c88b98ce: field close_birthday_users: %w", err) - } - - if headerLen > 0 { - u.CloseBirthdayUsers = make([]CloseBirthdayUser, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value CloseBirthdayUser - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateContactCloseBirthdays#c88b98ce: field close_birthday_users: %w", err) - } - u.CloseBirthdayUsers = append(u.CloseBirthdayUsers, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateContactCloseBirthdays) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateContactCloseBirthdays#c88b98ce as nil") - } - b.ObjStart() - b.PutID("updateContactCloseBirthdays") - b.Comma() - b.FieldStart("close_birthday_users") - b.ArrStart() - for idx, v := range u.CloseBirthdayUsers { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateContactCloseBirthdays#c88b98ce: field close_birthday_users element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateContactCloseBirthdays) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateContactCloseBirthdays#c88b98ce to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateContactCloseBirthdays"); err != nil { - return fmt.Errorf("unable to decode updateContactCloseBirthdays#c88b98ce: %w", err) - } - case "close_birthday_users": - if err := b.Arr(func(b tdjson.Decoder) error { - var value CloseBirthdayUser - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateContactCloseBirthdays#c88b98ce: field close_birthday_users: %w", err) - } - u.CloseBirthdayUsers = append(u.CloseBirthdayUsers, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateContactCloseBirthdays#c88b98ce: field close_birthday_users: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetCloseBirthdayUsers returns value of CloseBirthdayUsers field. -func (u *UpdateContactCloseBirthdays) GetCloseBirthdayUsers() (value []CloseBirthdayUser) { - if u == nil { - return - } - return u.CloseBirthdayUsers -} - -// UpdateAutosaveSettings represents TL type `updateAutosaveSettings#da274f0b`. -type UpdateAutosaveSettings struct { - // Type of chats for which autosave settings were updated - Scope AutosaveSettingsScopeClass - // The new autosave settings; may be null if the settings are reset to default - Settings ScopeAutosaveSettings -} - -// UpdateAutosaveSettingsTypeID is TL type id of UpdateAutosaveSettings. -const UpdateAutosaveSettingsTypeID = 0xda274f0b - -// construct implements constructor of UpdateClass. -func (u UpdateAutosaveSettings) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateAutosaveSettings. -var ( - _ bin.Encoder = &UpdateAutosaveSettings{} - _ bin.Decoder = &UpdateAutosaveSettings{} - _ bin.BareEncoder = &UpdateAutosaveSettings{} - _ bin.BareDecoder = &UpdateAutosaveSettings{} - - _ UpdateClass = &UpdateAutosaveSettings{} -) - -func (u *UpdateAutosaveSettings) Zero() bool { - if u == nil { - return true - } - if !(u.Scope == nil) { - return false - } - if !(u.Settings.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateAutosaveSettings) String() string { - if u == nil { - return "UpdateAutosaveSettings(nil)" - } - type Alias UpdateAutosaveSettings - return fmt.Sprintf("UpdateAutosaveSettings%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateAutosaveSettings) TypeID() uint32 { - return UpdateAutosaveSettingsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateAutosaveSettings) TypeName() string { - return "updateAutosaveSettings" -} - -// TypeInfo returns info about TL type. -func (u *UpdateAutosaveSettings) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateAutosaveSettings", - ID: UpdateAutosaveSettingsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Scope", - SchemaName: "scope", - }, - { - Name: "Settings", - SchemaName: "settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateAutosaveSettings) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAutosaveSettings#da274f0b as nil") - } - b.PutID(UpdateAutosaveSettingsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateAutosaveSettings) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateAutosaveSettings#da274f0b as nil") - } - if u.Scope == nil { - return fmt.Errorf("unable to encode updateAutosaveSettings#da274f0b: field scope is nil") - } - if err := u.Scope.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateAutosaveSettings#da274f0b: field scope: %w", err) - } - if err := u.Settings.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateAutosaveSettings#da274f0b: field settings: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateAutosaveSettings) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAutosaveSettings#da274f0b to nil") - } - if err := b.ConsumeID(UpdateAutosaveSettingsTypeID); err != nil { - return fmt.Errorf("unable to decode updateAutosaveSettings#da274f0b: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateAutosaveSettings) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateAutosaveSettings#da274f0b to nil") - } - { - value, err := DecodeAutosaveSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode updateAutosaveSettings#da274f0b: field scope: %w", err) - } - u.Scope = value - } - { - if err := u.Settings.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateAutosaveSettings#da274f0b: field settings: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateAutosaveSettings) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateAutosaveSettings#da274f0b as nil") - } - b.ObjStart() - b.PutID("updateAutosaveSettings") - b.Comma() - b.FieldStart("scope") - if u.Scope == nil { - return fmt.Errorf("unable to encode updateAutosaveSettings#da274f0b: field scope is nil") - } - if err := u.Scope.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateAutosaveSettings#da274f0b: field scope: %w", err) - } - b.Comma() - b.FieldStart("settings") - if err := u.Settings.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateAutosaveSettings#da274f0b: field settings: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateAutosaveSettings) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateAutosaveSettings#da274f0b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateAutosaveSettings"); err != nil { - return fmt.Errorf("unable to decode updateAutosaveSettings#da274f0b: %w", err) - } - case "scope": - value, err := DecodeTDLibJSONAutosaveSettingsScope(b) - if err != nil { - return fmt.Errorf("unable to decode updateAutosaveSettings#da274f0b: field scope: %w", err) - } - u.Scope = value - case "settings": - if err := u.Settings.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateAutosaveSettings#da274f0b: field settings: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetScope returns value of Scope field. -func (u *UpdateAutosaveSettings) GetScope() (value AutosaveSettingsScopeClass) { - if u == nil { - return - } - return u.Scope -} - -// GetSettings returns value of Settings field. -func (u *UpdateAutosaveSettings) GetSettings() (value ScopeAutosaveSettings) { - if u == nil { - return - } - return u.Settings -} - -// UpdateBusinessConnection represents TL type `updateBusinessConnection#8632f476`. -type UpdateBusinessConnection struct { - // New data about the connection - Connection BusinessConnection -} - -// UpdateBusinessConnectionTypeID is TL type id of UpdateBusinessConnection. -const UpdateBusinessConnectionTypeID = 0x8632f476 - -// construct implements constructor of UpdateClass. -func (u UpdateBusinessConnection) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateBusinessConnection. -var ( - _ bin.Encoder = &UpdateBusinessConnection{} - _ bin.Decoder = &UpdateBusinessConnection{} - _ bin.BareEncoder = &UpdateBusinessConnection{} - _ bin.BareDecoder = &UpdateBusinessConnection{} - - _ UpdateClass = &UpdateBusinessConnection{} -) - -func (u *UpdateBusinessConnection) Zero() bool { - if u == nil { - return true - } - if !(u.Connection.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateBusinessConnection) String() string { - if u == nil { - return "UpdateBusinessConnection(nil)" - } - type Alias UpdateBusinessConnection - return fmt.Sprintf("UpdateBusinessConnection%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateBusinessConnection) TypeID() uint32 { - return UpdateBusinessConnectionTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateBusinessConnection) TypeName() string { - return "updateBusinessConnection" -} - -// TypeInfo returns info about TL type. -func (u *UpdateBusinessConnection) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateBusinessConnection", - ID: UpdateBusinessConnectionTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Connection", - SchemaName: "connection", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateBusinessConnection) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateBusinessConnection#8632f476 as nil") - } - b.PutID(UpdateBusinessConnectionTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateBusinessConnection) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateBusinessConnection#8632f476 as nil") - } - if err := u.Connection.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateBusinessConnection#8632f476: field connection: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateBusinessConnection) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateBusinessConnection#8632f476 to nil") - } - if err := b.ConsumeID(UpdateBusinessConnectionTypeID); err != nil { - return fmt.Errorf("unable to decode updateBusinessConnection#8632f476: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateBusinessConnection) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateBusinessConnection#8632f476 to nil") - } - { - if err := u.Connection.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateBusinessConnection#8632f476: field connection: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateBusinessConnection) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateBusinessConnection#8632f476 as nil") - } - b.ObjStart() - b.PutID("updateBusinessConnection") - b.Comma() - b.FieldStart("connection") - if err := u.Connection.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateBusinessConnection#8632f476: field connection: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateBusinessConnection) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateBusinessConnection#8632f476 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateBusinessConnection"); err != nil { - return fmt.Errorf("unable to decode updateBusinessConnection#8632f476: %w", err) - } - case "connection": - if err := u.Connection.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateBusinessConnection#8632f476: field connection: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetConnection returns value of Connection field. -func (u *UpdateBusinessConnection) GetConnection() (value BusinessConnection) { - if u == nil { - return - } - return u.Connection -} - -// UpdateNewBusinessMessage represents TL type `updateNewBusinessMessage#86be4644`. -type UpdateNewBusinessMessage struct { - // Unique identifier of the business connection - ConnectionID string - // The new message - Message BusinessMessage -} - -// UpdateNewBusinessMessageTypeID is TL type id of UpdateNewBusinessMessage. -const UpdateNewBusinessMessageTypeID = 0x86be4644 - -// construct implements constructor of UpdateClass. -func (u UpdateNewBusinessMessage) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewBusinessMessage. -var ( - _ bin.Encoder = &UpdateNewBusinessMessage{} - _ bin.Decoder = &UpdateNewBusinessMessage{} - _ bin.BareEncoder = &UpdateNewBusinessMessage{} - _ bin.BareDecoder = &UpdateNewBusinessMessage{} - - _ UpdateClass = &UpdateNewBusinessMessage{} -) - -func (u *UpdateNewBusinessMessage) Zero() bool { - if u == nil { - return true - } - if !(u.ConnectionID == "") { - return false - } - if !(u.Message.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewBusinessMessage) String() string { - if u == nil { - return "UpdateNewBusinessMessage(nil)" - } - type Alias UpdateNewBusinessMessage - return fmt.Sprintf("UpdateNewBusinessMessage%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewBusinessMessage) TypeID() uint32 { - return UpdateNewBusinessMessageTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewBusinessMessage) TypeName() string { - return "updateNewBusinessMessage" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewBusinessMessage) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewBusinessMessage", - ID: UpdateNewBusinessMessageTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ConnectionID", - SchemaName: "connection_id", - }, - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewBusinessMessage) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewBusinessMessage#86be4644 as nil") - } - b.PutID(UpdateNewBusinessMessageTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewBusinessMessage) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewBusinessMessage#86be4644 as nil") - } - b.PutString(u.ConnectionID) - if err := u.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewBusinessMessage#86be4644: field message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewBusinessMessage) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewBusinessMessage#86be4644 to nil") - } - if err := b.ConsumeID(UpdateNewBusinessMessageTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewBusinessMessage#86be4644: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewBusinessMessage) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewBusinessMessage#86be4644 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessMessage#86be4644: field connection_id: %w", err) - } - u.ConnectionID = value - } - { - if err := u.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateNewBusinessMessage#86be4644: field message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewBusinessMessage) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewBusinessMessage#86be4644 as nil") - } - b.ObjStart() - b.PutID("updateNewBusinessMessage") - b.Comma() - b.FieldStart("connection_id") - b.PutString(u.ConnectionID) - b.Comma() - b.FieldStart("message") - if err := u.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewBusinessMessage#86be4644: field message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewBusinessMessage) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewBusinessMessage#86be4644 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewBusinessMessage"); err != nil { - return fmt.Errorf("unable to decode updateNewBusinessMessage#86be4644: %w", err) - } - case "connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessMessage#86be4644: field connection_id: %w", err) - } - u.ConnectionID = value - case "message": - if err := u.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNewBusinessMessage#86be4644: field message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetConnectionID returns value of ConnectionID field. -func (u *UpdateNewBusinessMessage) GetConnectionID() (value string) { - if u == nil { - return - } - return u.ConnectionID -} - -// GetMessage returns value of Message field. -func (u *UpdateNewBusinessMessage) GetMessage() (value BusinessMessage) { - if u == nil { - return - } - return u.Message -} - -// UpdateBusinessMessageEdited represents TL type `updateBusinessMessageEdited#81a66d89`. -type UpdateBusinessMessageEdited struct { - // Unique identifier of the business connection - ConnectionID string - // The edited message - Message BusinessMessage -} - -// UpdateBusinessMessageEditedTypeID is TL type id of UpdateBusinessMessageEdited. -const UpdateBusinessMessageEditedTypeID = 0x81a66d89 - -// construct implements constructor of UpdateClass. -func (u UpdateBusinessMessageEdited) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateBusinessMessageEdited. -var ( - _ bin.Encoder = &UpdateBusinessMessageEdited{} - _ bin.Decoder = &UpdateBusinessMessageEdited{} - _ bin.BareEncoder = &UpdateBusinessMessageEdited{} - _ bin.BareDecoder = &UpdateBusinessMessageEdited{} - - _ UpdateClass = &UpdateBusinessMessageEdited{} -) - -func (u *UpdateBusinessMessageEdited) Zero() bool { - if u == nil { - return true - } - if !(u.ConnectionID == "") { - return false - } - if !(u.Message.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateBusinessMessageEdited) String() string { - if u == nil { - return "UpdateBusinessMessageEdited(nil)" - } - type Alias UpdateBusinessMessageEdited - return fmt.Sprintf("UpdateBusinessMessageEdited%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateBusinessMessageEdited) TypeID() uint32 { - return UpdateBusinessMessageEditedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateBusinessMessageEdited) TypeName() string { - return "updateBusinessMessageEdited" -} - -// TypeInfo returns info about TL type. -func (u *UpdateBusinessMessageEdited) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateBusinessMessageEdited", - ID: UpdateBusinessMessageEditedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ConnectionID", - SchemaName: "connection_id", - }, - { - Name: "Message", - SchemaName: "message", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateBusinessMessageEdited) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateBusinessMessageEdited#81a66d89 as nil") - } - b.PutID(UpdateBusinessMessageEditedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateBusinessMessageEdited) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateBusinessMessageEdited#81a66d89 as nil") - } - b.PutString(u.ConnectionID) - if err := u.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateBusinessMessageEdited#81a66d89: field message: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateBusinessMessageEdited) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateBusinessMessageEdited#81a66d89 to nil") - } - if err := b.ConsumeID(UpdateBusinessMessageEditedTypeID); err != nil { - return fmt.Errorf("unable to decode updateBusinessMessageEdited#81a66d89: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateBusinessMessageEdited) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateBusinessMessageEdited#81a66d89 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateBusinessMessageEdited#81a66d89: field connection_id: %w", err) - } - u.ConnectionID = value - } - { - if err := u.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateBusinessMessageEdited#81a66d89: field message: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateBusinessMessageEdited) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateBusinessMessageEdited#81a66d89 as nil") - } - b.ObjStart() - b.PutID("updateBusinessMessageEdited") - b.Comma() - b.FieldStart("connection_id") - b.PutString(u.ConnectionID) - b.Comma() - b.FieldStart("message") - if err := u.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateBusinessMessageEdited#81a66d89: field message: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateBusinessMessageEdited) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateBusinessMessageEdited#81a66d89 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateBusinessMessageEdited"); err != nil { - return fmt.Errorf("unable to decode updateBusinessMessageEdited#81a66d89: %w", err) - } - case "connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateBusinessMessageEdited#81a66d89: field connection_id: %w", err) - } - u.ConnectionID = value - case "message": - if err := u.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateBusinessMessageEdited#81a66d89: field message: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetConnectionID returns value of ConnectionID field. -func (u *UpdateBusinessMessageEdited) GetConnectionID() (value string) { - if u == nil { - return - } - return u.ConnectionID -} - -// GetMessage returns value of Message field. -func (u *UpdateBusinessMessageEdited) GetMessage() (value BusinessMessage) { - if u == nil { - return - } - return u.Message -} - -// UpdateBusinessMessagesDeleted represents TL type `updateBusinessMessagesDeleted#e036d3ed`. -type UpdateBusinessMessagesDeleted struct { - // Unique identifier of the business connection - ConnectionID string - // Identifier of a chat in the business account in which messages were deleted - ChatID int64 - // Unique message identifiers of the deleted messages - MessageIDs []int64 -} - -// UpdateBusinessMessagesDeletedTypeID is TL type id of UpdateBusinessMessagesDeleted. -const UpdateBusinessMessagesDeletedTypeID = 0xe036d3ed - -// construct implements constructor of UpdateClass. -func (u UpdateBusinessMessagesDeleted) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateBusinessMessagesDeleted. -var ( - _ bin.Encoder = &UpdateBusinessMessagesDeleted{} - _ bin.Decoder = &UpdateBusinessMessagesDeleted{} - _ bin.BareEncoder = &UpdateBusinessMessagesDeleted{} - _ bin.BareDecoder = &UpdateBusinessMessagesDeleted{} - - _ UpdateClass = &UpdateBusinessMessagesDeleted{} -) - -func (u *UpdateBusinessMessagesDeleted) Zero() bool { - if u == nil { - return true - } - if !(u.ConnectionID == "") { - return false - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateBusinessMessagesDeleted) String() string { - if u == nil { - return "UpdateBusinessMessagesDeleted(nil)" - } - type Alias UpdateBusinessMessagesDeleted - return fmt.Sprintf("UpdateBusinessMessagesDeleted%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateBusinessMessagesDeleted) TypeID() uint32 { - return UpdateBusinessMessagesDeletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateBusinessMessagesDeleted) TypeName() string { - return "updateBusinessMessagesDeleted" -} - -// TypeInfo returns info about TL type. -func (u *UpdateBusinessMessagesDeleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateBusinessMessagesDeleted", - ID: UpdateBusinessMessagesDeletedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ConnectionID", - SchemaName: "connection_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageIDs", - SchemaName: "message_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateBusinessMessagesDeleted) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateBusinessMessagesDeleted#e036d3ed as nil") - } - b.PutID(UpdateBusinessMessagesDeletedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateBusinessMessagesDeleted) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateBusinessMessagesDeleted#e036d3ed as nil") - } - b.PutString(u.ConnectionID) - b.PutInt53(u.ChatID) - b.PutInt(len(u.MessageIDs)) - for _, v := range u.MessageIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateBusinessMessagesDeleted) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateBusinessMessagesDeleted#e036d3ed to nil") - } - if err := b.ConsumeID(UpdateBusinessMessagesDeletedTypeID); err != nil { - return fmt.Errorf("unable to decode updateBusinessMessagesDeleted#e036d3ed: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateBusinessMessagesDeleted) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateBusinessMessagesDeleted#e036d3ed to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateBusinessMessagesDeleted#e036d3ed: field connection_id: %w", err) - } - u.ConnectionID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateBusinessMessagesDeleted#e036d3ed: field chat_id: %w", err) - } - u.ChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateBusinessMessagesDeleted#e036d3ed: field message_ids: %w", err) - } - - if headerLen > 0 { - u.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateBusinessMessagesDeleted#e036d3ed: field message_ids: %w", err) - } - u.MessageIDs = append(u.MessageIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateBusinessMessagesDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateBusinessMessagesDeleted#e036d3ed as nil") - } - b.ObjStart() - b.PutID("updateBusinessMessagesDeleted") - b.Comma() - b.FieldStart("connection_id") - b.PutString(u.ConnectionID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_ids") - b.ArrStart() - for _, v := range u.MessageIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateBusinessMessagesDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateBusinessMessagesDeleted#e036d3ed to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateBusinessMessagesDeleted"); err != nil { - return fmt.Errorf("unable to decode updateBusinessMessagesDeleted#e036d3ed: %w", err) - } - case "connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateBusinessMessagesDeleted#e036d3ed: field connection_id: %w", err) - } - u.ConnectionID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateBusinessMessagesDeleted#e036d3ed: field chat_id: %w", err) - } - u.ChatID = value - case "message_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateBusinessMessagesDeleted#e036d3ed: field message_ids: %w", err) - } - u.MessageIDs = append(u.MessageIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateBusinessMessagesDeleted#e036d3ed: field message_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetConnectionID returns value of ConnectionID field. -func (u *UpdateBusinessMessagesDeleted) GetConnectionID() (value string) { - if u == nil { - return - } - return u.ConnectionID -} - -// GetChatID returns value of ChatID field. -func (u *UpdateBusinessMessagesDeleted) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageIDs returns value of MessageIDs field. -func (u *UpdateBusinessMessagesDeleted) GetMessageIDs() (value []int64) { - if u == nil { - return - } - return u.MessageIDs -} - -// UpdateNewInlineQuery represents TL type `updateNewInlineQuery#7171bf34`. -type UpdateNewInlineQuery struct { - // Unique query identifier - ID int64 - // Identifier of the user who sent the query - SenderUserID int64 - // User location; may be null - UserLocation Location - // The type of the chat from which the query originated; may be null if unknown - ChatType ChatTypeClass - // Text of the query - Query string - // Offset of the first entry to return - Offset string -} - -// UpdateNewInlineQueryTypeID is TL type id of UpdateNewInlineQuery. -const UpdateNewInlineQueryTypeID = 0x7171bf34 - -// construct implements constructor of UpdateClass. -func (u UpdateNewInlineQuery) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewInlineQuery. -var ( - _ bin.Encoder = &UpdateNewInlineQuery{} - _ bin.Decoder = &UpdateNewInlineQuery{} - _ bin.BareEncoder = &UpdateNewInlineQuery{} - _ bin.BareDecoder = &UpdateNewInlineQuery{} - - _ UpdateClass = &UpdateNewInlineQuery{} -) - -func (u *UpdateNewInlineQuery) Zero() bool { - if u == nil { - return true - } - if !(u.ID == 0) { - return false - } - if !(u.SenderUserID == 0) { - return false - } - if !(u.UserLocation.Zero()) { - return false - } - if !(u.ChatType == nil) { - return false - } - if !(u.Query == "") { - return false - } - if !(u.Offset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewInlineQuery) String() string { - if u == nil { - return "UpdateNewInlineQuery(nil)" - } - type Alias UpdateNewInlineQuery - return fmt.Sprintf("UpdateNewInlineQuery%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewInlineQuery) TypeID() uint32 { - return UpdateNewInlineQueryTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewInlineQuery) TypeName() string { - return "updateNewInlineQuery" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewInlineQuery) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewInlineQuery", - ID: UpdateNewInlineQueryTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "UserLocation", - SchemaName: "user_location", - }, - { - Name: "ChatType", - SchemaName: "chat_type", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewInlineQuery) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewInlineQuery#7171bf34 as nil") - } - b.PutID(UpdateNewInlineQueryTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewInlineQuery) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewInlineQuery#7171bf34 as nil") - } - b.PutLong(u.ID) - b.PutInt53(u.SenderUserID) - if err := u.UserLocation.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewInlineQuery#7171bf34: field user_location: %w", err) - } - if u.ChatType == nil { - return fmt.Errorf("unable to encode updateNewInlineQuery#7171bf34: field chat_type is nil") - } - if err := u.ChatType.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewInlineQuery#7171bf34: field chat_type: %w", err) - } - b.PutString(u.Query) - b.PutString(u.Offset) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewInlineQuery) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewInlineQuery#7171bf34 to nil") - } - if err := b.ConsumeID(UpdateNewInlineQueryTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewInlineQuery) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewInlineQuery#7171bf34 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field id: %w", err) - } - u.ID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field sender_user_id: %w", err) - } - u.SenderUserID = value - } - { - if err := u.UserLocation.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field user_location: %w", err) - } - } - { - value, err := DecodeChatType(b) - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field chat_type: %w", err) - } - u.ChatType = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field query: %w", err) - } - u.Query = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field offset: %w", err) - } - u.Offset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewInlineQuery) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewInlineQuery#7171bf34 as nil") - } - b.ObjStart() - b.PutID("updateNewInlineQuery") - b.Comma() - b.FieldStart("id") - b.PutLong(u.ID) - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(u.SenderUserID) - b.Comma() - b.FieldStart("user_location") - if err := u.UserLocation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewInlineQuery#7171bf34: field user_location: %w", err) - } - b.Comma() - b.FieldStart("chat_type") - if u.ChatType == nil { - return fmt.Errorf("unable to encode updateNewInlineQuery#7171bf34: field chat_type is nil") - } - if err := u.ChatType.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewInlineQuery#7171bf34: field chat_type: %w", err) - } - b.Comma() - b.FieldStart("query") - b.PutString(u.Query) - b.Comma() - b.FieldStart("offset") - b.PutString(u.Offset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewInlineQuery) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewInlineQuery#7171bf34 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewInlineQuery"); err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field id: %w", err) - } - u.ID = value - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field sender_user_id: %w", err) - } - u.SenderUserID = value - case "user_location": - if err := u.UserLocation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field user_location: %w", err) - } - case "chat_type": - value, err := DecodeTDLibJSONChatType(b) - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field chat_type: %w", err) - } - u.ChatType = value - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field query: %w", err) - } - u.Query = value - case "offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineQuery#7171bf34: field offset: %w", err) - } - u.Offset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (u *UpdateNewInlineQuery) GetID() (value int64) { - if u == nil { - return - } - return u.ID -} - -// GetSenderUserID returns value of SenderUserID field. -func (u *UpdateNewInlineQuery) GetSenderUserID() (value int64) { - if u == nil { - return - } - return u.SenderUserID -} - -// GetUserLocation returns value of UserLocation field. -func (u *UpdateNewInlineQuery) GetUserLocation() (value Location) { - if u == nil { - return - } - return u.UserLocation -} - -// GetChatType returns value of ChatType field. -func (u *UpdateNewInlineQuery) GetChatType() (value ChatTypeClass) { - if u == nil { - return - } - return u.ChatType -} - -// GetQuery returns value of Query field. -func (u *UpdateNewInlineQuery) GetQuery() (value string) { - if u == nil { - return - } - return u.Query -} - -// GetOffset returns value of Offset field. -func (u *UpdateNewInlineQuery) GetOffset() (value string) { - if u == nil { - return - } - return u.Offset -} - -// UpdateNewChosenInlineResult represents TL type `updateNewChosenInlineResult#cb4c4f5d`. -type UpdateNewChosenInlineResult struct { - // Identifier of the user who sent the query - SenderUserID int64 - // User location; may be null - UserLocation Location - // Text of the query - Query string - // Identifier of the chosen result - ResultID string - // Identifier of the sent inline message, if known - InlineMessageID string -} - -// UpdateNewChosenInlineResultTypeID is TL type id of UpdateNewChosenInlineResult. -const UpdateNewChosenInlineResultTypeID = 0xcb4c4f5d - -// construct implements constructor of UpdateClass. -func (u UpdateNewChosenInlineResult) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewChosenInlineResult. -var ( - _ bin.Encoder = &UpdateNewChosenInlineResult{} - _ bin.Decoder = &UpdateNewChosenInlineResult{} - _ bin.BareEncoder = &UpdateNewChosenInlineResult{} - _ bin.BareDecoder = &UpdateNewChosenInlineResult{} - - _ UpdateClass = &UpdateNewChosenInlineResult{} -) - -func (u *UpdateNewChosenInlineResult) Zero() bool { - if u == nil { - return true - } - if !(u.SenderUserID == 0) { - return false - } - if !(u.UserLocation.Zero()) { - return false - } - if !(u.Query == "") { - return false - } - if !(u.ResultID == "") { - return false - } - if !(u.InlineMessageID == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewChosenInlineResult) String() string { - if u == nil { - return "UpdateNewChosenInlineResult(nil)" - } - type Alias UpdateNewChosenInlineResult - return fmt.Sprintf("UpdateNewChosenInlineResult%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewChosenInlineResult) TypeID() uint32 { - return UpdateNewChosenInlineResultTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewChosenInlineResult) TypeName() string { - return "updateNewChosenInlineResult" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewChosenInlineResult) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewChosenInlineResult", - ID: UpdateNewChosenInlineResultTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "UserLocation", - SchemaName: "user_location", - }, - { - Name: "Query", - SchemaName: "query", - }, - { - Name: "ResultID", - SchemaName: "result_id", - }, - { - Name: "InlineMessageID", - SchemaName: "inline_message_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewChosenInlineResult) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewChosenInlineResult#cb4c4f5d as nil") - } - b.PutID(UpdateNewChosenInlineResultTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewChosenInlineResult) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewChosenInlineResult#cb4c4f5d as nil") - } - b.PutInt53(u.SenderUserID) - if err := u.UserLocation.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewChosenInlineResult#cb4c4f5d: field user_location: %w", err) - } - b.PutString(u.Query) - b.PutString(u.ResultID) - b.PutString(u.InlineMessageID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewChosenInlineResult) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewChosenInlineResult#cb4c4f5d to nil") - } - if err := b.ConsumeID(UpdateNewChosenInlineResultTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewChosenInlineResult) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewChosenInlineResult#cb4c4f5d to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: field sender_user_id: %w", err) - } - u.SenderUserID = value - } - { - if err := u.UserLocation.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: field user_location: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: field query: %w", err) - } - u.Query = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: field result_id: %w", err) - } - u.ResultID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: field inline_message_id: %w", err) - } - u.InlineMessageID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewChosenInlineResult) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewChosenInlineResult#cb4c4f5d as nil") - } - b.ObjStart() - b.PutID("updateNewChosenInlineResult") - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(u.SenderUserID) - b.Comma() - b.FieldStart("user_location") - if err := u.UserLocation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewChosenInlineResult#cb4c4f5d: field user_location: %w", err) - } - b.Comma() - b.FieldStart("query") - b.PutString(u.Query) - b.Comma() - b.FieldStart("result_id") - b.PutString(u.ResultID) - b.Comma() - b.FieldStart("inline_message_id") - b.PutString(u.InlineMessageID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewChosenInlineResult) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewChosenInlineResult#cb4c4f5d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewChosenInlineResult"); err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: %w", err) - } - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: field sender_user_id: %w", err) - } - u.SenderUserID = value - case "user_location": - if err := u.UserLocation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: field user_location: %w", err) - } - case "query": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: field query: %w", err) - } - u.Query = value - case "result_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: field result_id: %w", err) - } - u.ResultID = value - case "inline_message_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewChosenInlineResult#cb4c4f5d: field inline_message_id: %w", err) - } - u.InlineMessageID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderUserID returns value of SenderUserID field. -func (u *UpdateNewChosenInlineResult) GetSenderUserID() (value int64) { - if u == nil { - return - } - return u.SenderUserID -} - -// GetUserLocation returns value of UserLocation field. -func (u *UpdateNewChosenInlineResult) GetUserLocation() (value Location) { - if u == nil { - return - } - return u.UserLocation -} - -// GetQuery returns value of Query field. -func (u *UpdateNewChosenInlineResult) GetQuery() (value string) { - if u == nil { - return - } - return u.Query -} - -// GetResultID returns value of ResultID field. -func (u *UpdateNewChosenInlineResult) GetResultID() (value string) { - if u == nil { - return - } - return u.ResultID -} - -// GetInlineMessageID returns value of InlineMessageID field. -func (u *UpdateNewChosenInlineResult) GetInlineMessageID() (value string) { - if u == nil { - return - } - return u.InlineMessageID -} - -// UpdateNewCallbackQuery represents TL type `updateNewCallbackQuery#8964d05e`. -type UpdateNewCallbackQuery struct { - // Unique query identifier - ID int64 - // Identifier of the user who sent the query - SenderUserID int64 - // Identifier of the chat where the query was sent - ChatID int64 - // Identifier of the message from which the query originated - MessageID int64 - // Identifier that uniquely corresponds to the chat to which the message was sent - ChatInstance int64 - // Query payload - Payload CallbackQueryPayloadClass -} - -// UpdateNewCallbackQueryTypeID is TL type id of UpdateNewCallbackQuery. -const UpdateNewCallbackQueryTypeID = 0x8964d05e - -// construct implements constructor of UpdateClass. -func (u UpdateNewCallbackQuery) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewCallbackQuery. -var ( - _ bin.Encoder = &UpdateNewCallbackQuery{} - _ bin.Decoder = &UpdateNewCallbackQuery{} - _ bin.BareEncoder = &UpdateNewCallbackQuery{} - _ bin.BareDecoder = &UpdateNewCallbackQuery{} - - _ UpdateClass = &UpdateNewCallbackQuery{} -) - -func (u *UpdateNewCallbackQuery) Zero() bool { - if u == nil { - return true - } - if !(u.ID == 0) { - return false - } - if !(u.SenderUserID == 0) { - return false - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.ChatInstance == 0) { - return false - } - if !(u.Payload == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewCallbackQuery) String() string { - if u == nil { - return "UpdateNewCallbackQuery(nil)" - } - type Alias UpdateNewCallbackQuery - return fmt.Sprintf("UpdateNewCallbackQuery%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewCallbackQuery) TypeID() uint32 { - return UpdateNewCallbackQueryTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewCallbackQuery) TypeName() string { - return "updateNewCallbackQuery" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewCallbackQuery) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewCallbackQuery", - ID: UpdateNewCallbackQueryTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ChatInstance", - SchemaName: "chat_instance", - }, - { - Name: "Payload", - SchemaName: "payload", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewCallbackQuery) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCallbackQuery#8964d05e as nil") - } - b.PutID(UpdateNewCallbackQueryTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewCallbackQuery) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCallbackQuery#8964d05e as nil") - } - b.PutLong(u.ID) - b.PutInt53(u.SenderUserID) - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - b.PutLong(u.ChatInstance) - if u.Payload == nil { - return fmt.Errorf("unable to encode updateNewCallbackQuery#8964d05e: field payload is nil") - } - if err := u.Payload.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewCallbackQuery#8964d05e: field payload: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewCallbackQuery) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCallbackQuery#8964d05e to nil") - } - if err := b.ConsumeID(UpdateNewCallbackQueryTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewCallbackQuery) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCallbackQuery#8964d05e to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field id: %w", err) - } - u.ID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field sender_user_id: %w", err) - } - u.SenderUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field message_id: %w", err) - } - u.MessageID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field chat_instance: %w", err) - } - u.ChatInstance = value - } - { - value, err := DecodeCallbackQueryPayload(b) - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field payload: %w", err) - } - u.Payload = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewCallbackQuery) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCallbackQuery#8964d05e as nil") - } - b.ObjStart() - b.PutID("updateNewCallbackQuery") - b.Comma() - b.FieldStart("id") - b.PutLong(u.ID) - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(u.SenderUserID) - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("chat_instance") - b.PutLong(u.ChatInstance) - b.Comma() - b.FieldStart("payload") - if u.Payload == nil { - return fmt.Errorf("unable to encode updateNewCallbackQuery#8964d05e: field payload is nil") - } - if err := u.Payload.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewCallbackQuery#8964d05e: field payload: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewCallbackQuery) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCallbackQuery#8964d05e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewCallbackQuery"); err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field id: %w", err) - } - u.ID = value - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field sender_user_id: %w", err) - } - u.SenderUserID = value - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field message_id: %w", err) - } - u.MessageID = value - case "chat_instance": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field chat_instance: %w", err) - } - u.ChatInstance = value - case "payload": - value, err := DecodeTDLibJSONCallbackQueryPayload(b) - if err != nil { - return fmt.Errorf("unable to decode updateNewCallbackQuery#8964d05e: field payload: %w", err) - } - u.Payload = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (u *UpdateNewCallbackQuery) GetID() (value int64) { - if u == nil { - return - } - return u.ID -} - -// GetSenderUserID returns value of SenderUserID field. -func (u *UpdateNewCallbackQuery) GetSenderUserID() (value int64) { - if u == nil { - return - } - return u.SenderUserID -} - -// GetChatID returns value of ChatID field. -func (u *UpdateNewCallbackQuery) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateNewCallbackQuery) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetChatInstance returns value of ChatInstance field. -func (u *UpdateNewCallbackQuery) GetChatInstance() (value int64) { - if u == nil { - return - } - return u.ChatInstance -} - -// GetPayload returns value of Payload field. -func (u *UpdateNewCallbackQuery) GetPayload() (value CallbackQueryPayloadClass) { - if u == nil { - return - } - return u.Payload -} - -// UpdateNewInlineCallbackQuery represents TL type `updateNewInlineCallbackQuery#ecf934ba`. -type UpdateNewInlineCallbackQuery struct { - // Unique query identifier - ID int64 - // Identifier of the user who sent the query - SenderUserID int64 - // Identifier of the inline message from which the query originated - InlineMessageID string - // An identifier uniquely corresponding to the chat a message was sent to - ChatInstance int64 - // Query payload - Payload CallbackQueryPayloadClass -} - -// UpdateNewInlineCallbackQueryTypeID is TL type id of UpdateNewInlineCallbackQuery. -const UpdateNewInlineCallbackQueryTypeID = 0xecf934ba - -// construct implements constructor of UpdateClass. -func (u UpdateNewInlineCallbackQuery) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewInlineCallbackQuery. -var ( - _ bin.Encoder = &UpdateNewInlineCallbackQuery{} - _ bin.Decoder = &UpdateNewInlineCallbackQuery{} - _ bin.BareEncoder = &UpdateNewInlineCallbackQuery{} - _ bin.BareDecoder = &UpdateNewInlineCallbackQuery{} - - _ UpdateClass = &UpdateNewInlineCallbackQuery{} -) - -func (u *UpdateNewInlineCallbackQuery) Zero() bool { - if u == nil { - return true - } - if !(u.ID == 0) { - return false - } - if !(u.SenderUserID == 0) { - return false - } - if !(u.InlineMessageID == "") { - return false - } - if !(u.ChatInstance == 0) { - return false - } - if !(u.Payload == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewInlineCallbackQuery) String() string { - if u == nil { - return "UpdateNewInlineCallbackQuery(nil)" - } - type Alias UpdateNewInlineCallbackQuery - return fmt.Sprintf("UpdateNewInlineCallbackQuery%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewInlineCallbackQuery) TypeID() uint32 { - return UpdateNewInlineCallbackQueryTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewInlineCallbackQuery) TypeName() string { - return "updateNewInlineCallbackQuery" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewInlineCallbackQuery) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewInlineCallbackQuery", - ID: UpdateNewInlineCallbackQueryTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "InlineMessageID", - SchemaName: "inline_message_id", - }, - { - Name: "ChatInstance", - SchemaName: "chat_instance", - }, - { - Name: "Payload", - SchemaName: "payload", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewInlineCallbackQuery) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewInlineCallbackQuery#ecf934ba as nil") - } - b.PutID(UpdateNewInlineCallbackQueryTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewInlineCallbackQuery) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewInlineCallbackQuery#ecf934ba as nil") - } - b.PutLong(u.ID) - b.PutInt53(u.SenderUserID) - b.PutString(u.InlineMessageID) - b.PutLong(u.ChatInstance) - if u.Payload == nil { - return fmt.Errorf("unable to encode updateNewInlineCallbackQuery#ecf934ba: field payload is nil") - } - if err := u.Payload.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewInlineCallbackQuery#ecf934ba: field payload: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewInlineCallbackQuery) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewInlineCallbackQuery#ecf934ba to nil") - } - if err := b.ConsumeID(UpdateNewInlineCallbackQueryTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewInlineCallbackQuery) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewInlineCallbackQuery#ecf934ba to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: field id: %w", err) - } - u.ID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: field sender_user_id: %w", err) - } - u.SenderUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: field inline_message_id: %w", err) - } - u.InlineMessageID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: field chat_instance: %w", err) - } - u.ChatInstance = value - } - { - value, err := DecodeCallbackQueryPayload(b) - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: field payload: %w", err) - } - u.Payload = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewInlineCallbackQuery) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewInlineCallbackQuery#ecf934ba as nil") - } - b.ObjStart() - b.PutID("updateNewInlineCallbackQuery") - b.Comma() - b.FieldStart("id") - b.PutLong(u.ID) - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(u.SenderUserID) - b.Comma() - b.FieldStart("inline_message_id") - b.PutString(u.InlineMessageID) - b.Comma() - b.FieldStart("chat_instance") - b.PutLong(u.ChatInstance) - b.Comma() - b.FieldStart("payload") - if u.Payload == nil { - return fmt.Errorf("unable to encode updateNewInlineCallbackQuery#ecf934ba: field payload is nil") - } - if err := u.Payload.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewInlineCallbackQuery#ecf934ba: field payload: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewInlineCallbackQuery) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewInlineCallbackQuery#ecf934ba to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewInlineCallbackQuery"); err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: field id: %w", err) - } - u.ID = value - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: field sender_user_id: %w", err) - } - u.SenderUserID = value - case "inline_message_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: field inline_message_id: %w", err) - } - u.InlineMessageID = value - case "chat_instance": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: field chat_instance: %w", err) - } - u.ChatInstance = value - case "payload": - value, err := DecodeTDLibJSONCallbackQueryPayload(b) - if err != nil { - return fmt.Errorf("unable to decode updateNewInlineCallbackQuery#ecf934ba: field payload: %w", err) - } - u.Payload = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (u *UpdateNewInlineCallbackQuery) GetID() (value int64) { - if u == nil { - return - } - return u.ID -} - -// GetSenderUserID returns value of SenderUserID field. -func (u *UpdateNewInlineCallbackQuery) GetSenderUserID() (value int64) { - if u == nil { - return - } - return u.SenderUserID -} - -// GetInlineMessageID returns value of InlineMessageID field. -func (u *UpdateNewInlineCallbackQuery) GetInlineMessageID() (value string) { - if u == nil { - return - } - return u.InlineMessageID -} - -// GetChatInstance returns value of ChatInstance field. -func (u *UpdateNewInlineCallbackQuery) GetChatInstance() (value int64) { - if u == nil { - return - } - return u.ChatInstance -} - -// GetPayload returns value of Payload field. -func (u *UpdateNewInlineCallbackQuery) GetPayload() (value CallbackQueryPayloadClass) { - if u == nil { - return - } - return u.Payload -} - -// UpdateNewBusinessCallbackQuery represents TL type `updateNewBusinessCallbackQuery#14125364`. -type UpdateNewBusinessCallbackQuery struct { - // Unique query identifier - ID int64 - // Identifier of the user who sent the query - SenderUserID int64 - // Unique identifier of the business connection - ConnectionID string - // The message from the business account from which the query originated - Message BusinessMessage - // An identifier uniquely corresponding to the chat a message was sent to - ChatInstance int64 - // Query payload - Payload CallbackQueryPayloadClass -} - -// UpdateNewBusinessCallbackQueryTypeID is TL type id of UpdateNewBusinessCallbackQuery. -const UpdateNewBusinessCallbackQueryTypeID = 0x14125364 - -// construct implements constructor of UpdateClass. -func (u UpdateNewBusinessCallbackQuery) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewBusinessCallbackQuery. -var ( - _ bin.Encoder = &UpdateNewBusinessCallbackQuery{} - _ bin.Decoder = &UpdateNewBusinessCallbackQuery{} - _ bin.BareEncoder = &UpdateNewBusinessCallbackQuery{} - _ bin.BareDecoder = &UpdateNewBusinessCallbackQuery{} - - _ UpdateClass = &UpdateNewBusinessCallbackQuery{} -) - -func (u *UpdateNewBusinessCallbackQuery) Zero() bool { - if u == nil { - return true - } - if !(u.ID == 0) { - return false - } - if !(u.SenderUserID == 0) { - return false - } - if !(u.ConnectionID == "") { - return false - } - if !(u.Message.Zero()) { - return false - } - if !(u.ChatInstance == 0) { - return false - } - if !(u.Payload == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewBusinessCallbackQuery) String() string { - if u == nil { - return "UpdateNewBusinessCallbackQuery(nil)" - } - type Alias UpdateNewBusinessCallbackQuery - return fmt.Sprintf("UpdateNewBusinessCallbackQuery%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewBusinessCallbackQuery) TypeID() uint32 { - return UpdateNewBusinessCallbackQueryTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewBusinessCallbackQuery) TypeName() string { - return "updateNewBusinessCallbackQuery" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewBusinessCallbackQuery) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewBusinessCallbackQuery", - ID: UpdateNewBusinessCallbackQueryTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "ConnectionID", - SchemaName: "connection_id", - }, - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "ChatInstance", - SchemaName: "chat_instance", - }, - { - Name: "Payload", - SchemaName: "payload", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewBusinessCallbackQuery) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewBusinessCallbackQuery#14125364 as nil") - } - b.PutID(UpdateNewBusinessCallbackQueryTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewBusinessCallbackQuery) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewBusinessCallbackQuery#14125364 as nil") - } - b.PutLong(u.ID) - b.PutInt53(u.SenderUserID) - b.PutString(u.ConnectionID) - if err := u.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewBusinessCallbackQuery#14125364: field message: %w", err) - } - b.PutLong(u.ChatInstance) - if u.Payload == nil { - return fmt.Errorf("unable to encode updateNewBusinessCallbackQuery#14125364: field payload is nil") - } - if err := u.Payload.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewBusinessCallbackQuery#14125364: field payload: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewBusinessCallbackQuery) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewBusinessCallbackQuery#14125364 to nil") - } - if err := b.ConsumeID(UpdateNewBusinessCallbackQueryTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewBusinessCallbackQuery) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewBusinessCallbackQuery#14125364 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field id: %w", err) - } - u.ID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field sender_user_id: %w", err) - } - u.SenderUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field connection_id: %w", err) - } - u.ConnectionID = value - } - { - if err := u.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field message: %w", err) - } - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field chat_instance: %w", err) - } - u.ChatInstance = value - } - { - value, err := DecodeCallbackQueryPayload(b) - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field payload: %w", err) - } - u.Payload = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewBusinessCallbackQuery) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewBusinessCallbackQuery#14125364 as nil") - } - b.ObjStart() - b.PutID("updateNewBusinessCallbackQuery") - b.Comma() - b.FieldStart("id") - b.PutLong(u.ID) - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(u.SenderUserID) - b.Comma() - b.FieldStart("connection_id") - b.PutString(u.ConnectionID) - b.Comma() - b.FieldStart("message") - if err := u.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewBusinessCallbackQuery#14125364: field message: %w", err) - } - b.Comma() - b.FieldStart("chat_instance") - b.PutLong(u.ChatInstance) - b.Comma() - b.FieldStart("payload") - if u.Payload == nil { - return fmt.Errorf("unable to encode updateNewBusinessCallbackQuery#14125364: field payload is nil") - } - if err := u.Payload.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewBusinessCallbackQuery#14125364: field payload: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewBusinessCallbackQuery) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewBusinessCallbackQuery#14125364 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewBusinessCallbackQuery"); err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field id: %w", err) - } - u.ID = value - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field sender_user_id: %w", err) - } - u.SenderUserID = value - case "connection_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field connection_id: %w", err) - } - u.ConnectionID = value - case "message": - if err := u.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field message: %w", err) - } - case "chat_instance": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field chat_instance: %w", err) - } - u.ChatInstance = value - case "payload": - value, err := DecodeTDLibJSONCallbackQueryPayload(b) - if err != nil { - return fmt.Errorf("unable to decode updateNewBusinessCallbackQuery#14125364: field payload: %w", err) - } - u.Payload = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (u *UpdateNewBusinessCallbackQuery) GetID() (value int64) { - if u == nil { - return - } - return u.ID -} - -// GetSenderUserID returns value of SenderUserID field. -func (u *UpdateNewBusinessCallbackQuery) GetSenderUserID() (value int64) { - if u == nil { - return - } - return u.SenderUserID -} - -// GetConnectionID returns value of ConnectionID field. -func (u *UpdateNewBusinessCallbackQuery) GetConnectionID() (value string) { - if u == nil { - return - } - return u.ConnectionID -} - -// GetMessage returns value of Message field. -func (u *UpdateNewBusinessCallbackQuery) GetMessage() (value BusinessMessage) { - if u == nil { - return - } - return u.Message -} - -// GetChatInstance returns value of ChatInstance field. -func (u *UpdateNewBusinessCallbackQuery) GetChatInstance() (value int64) { - if u == nil { - return - } - return u.ChatInstance -} - -// GetPayload returns value of Payload field. -func (u *UpdateNewBusinessCallbackQuery) GetPayload() (value CallbackQueryPayloadClass) { - if u == nil { - return - } - return u.Payload -} - -// UpdateNewShippingQuery represents TL type `updateNewShippingQuery#29584672`. -type UpdateNewShippingQuery struct { - // Unique query identifier - ID int64 - // Identifier of the user who sent the query - SenderUserID int64 - // Invoice payload - InvoicePayload string - // User shipping address - ShippingAddress Address -} - -// UpdateNewShippingQueryTypeID is TL type id of UpdateNewShippingQuery. -const UpdateNewShippingQueryTypeID = 0x29584672 - -// construct implements constructor of UpdateClass. -func (u UpdateNewShippingQuery) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewShippingQuery. -var ( - _ bin.Encoder = &UpdateNewShippingQuery{} - _ bin.Decoder = &UpdateNewShippingQuery{} - _ bin.BareEncoder = &UpdateNewShippingQuery{} - _ bin.BareDecoder = &UpdateNewShippingQuery{} - - _ UpdateClass = &UpdateNewShippingQuery{} -) - -func (u *UpdateNewShippingQuery) Zero() bool { - if u == nil { - return true - } - if !(u.ID == 0) { - return false - } - if !(u.SenderUserID == 0) { - return false - } - if !(u.InvoicePayload == "") { - return false - } - if !(u.ShippingAddress.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewShippingQuery) String() string { - if u == nil { - return "UpdateNewShippingQuery(nil)" - } - type Alias UpdateNewShippingQuery - return fmt.Sprintf("UpdateNewShippingQuery%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewShippingQuery) TypeID() uint32 { - return UpdateNewShippingQueryTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewShippingQuery) TypeName() string { - return "updateNewShippingQuery" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewShippingQuery) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewShippingQuery", - ID: UpdateNewShippingQueryTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "InvoicePayload", - SchemaName: "invoice_payload", - }, - { - Name: "ShippingAddress", - SchemaName: "shipping_address", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewShippingQuery) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewShippingQuery#29584672 as nil") - } - b.PutID(UpdateNewShippingQueryTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewShippingQuery) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewShippingQuery#29584672 as nil") - } - b.PutLong(u.ID) - b.PutInt53(u.SenderUserID) - b.PutString(u.InvoicePayload) - if err := u.ShippingAddress.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewShippingQuery#29584672: field shipping_address: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewShippingQuery) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewShippingQuery#29584672 to nil") - } - if err := b.ConsumeID(UpdateNewShippingQueryTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewShippingQuery#29584672: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewShippingQuery) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewShippingQuery#29584672 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewShippingQuery#29584672: field id: %w", err) - } - u.ID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewShippingQuery#29584672: field sender_user_id: %w", err) - } - u.SenderUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewShippingQuery#29584672: field invoice_payload: %w", err) - } - u.InvoicePayload = value - } - { - if err := u.ShippingAddress.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateNewShippingQuery#29584672: field shipping_address: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewShippingQuery) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewShippingQuery#29584672 as nil") - } - b.ObjStart() - b.PutID("updateNewShippingQuery") - b.Comma() - b.FieldStart("id") - b.PutLong(u.ID) - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(u.SenderUserID) - b.Comma() - b.FieldStart("invoice_payload") - b.PutString(u.InvoicePayload) - b.Comma() - b.FieldStart("shipping_address") - if err := u.ShippingAddress.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewShippingQuery#29584672: field shipping_address: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewShippingQuery) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewShippingQuery#29584672 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewShippingQuery"); err != nil { - return fmt.Errorf("unable to decode updateNewShippingQuery#29584672: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewShippingQuery#29584672: field id: %w", err) - } - u.ID = value - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewShippingQuery#29584672: field sender_user_id: %w", err) - } - u.SenderUserID = value - case "invoice_payload": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewShippingQuery#29584672: field invoice_payload: %w", err) - } - u.InvoicePayload = value - case "shipping_address": - if err := u.ShippingAddress.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNewShippingQuery#29584672: field shipping_address: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (u *UpdateNewShippingQuery) GetID() (value int64) { - if u == nil { - return - } - return u.ID -} - -// GetSenderUserID returns value of SenderUserID field. -func (u *UpdateNewShippingQuery) GetSenderUserID() (value int64) { - if u == nil { - return - } - return u.SenderUserID -} - -// GetInvoicePayload returns value of InvoicePayload field. -func (u *UpdateNewShippingQuery) GetInvoicePayload() (value string) { - if u == nil { - return - } - return u.InvoicePayload -} - -// GetShippingAddress returns value of ShippingAddress field. -func (u *UpdateNewShippingQuery) GetShippingAddress() (value Address) { - if u == nil { - return - } - return u.ShippingAddress -} - -// UpdateNewPreCheckoutQuery represents TL type `updateNewPreCheckoutQuery#2a3871c9`. -type UpdateNewPreCheckoutQuery struct { - // Unique query identifier - ID int64 - // Identifier of the user who sent the query - SenderUserID int64 - // Currency for the product price - Currency string - // Total price for the product, in the smallest units of the currency - TotalAmount int64 - // Invoice payload - InvoicePayload []byte - // Identifier of a shipping option chosen by the user; may be empty if not applicable - ShippingOptionID string - // Information about the order; may be null - OrderInfo OrderInfo -} - -// UpdateNewPreCheckoutQueryTypeID is TL type id of UpdateNewPreCheckoutQuery. -const UpdateNewPreCheckoutQueryTypeID = 0x2a3871c9 - -// construct implements constructor of UpdateClass. -func (u UpdateNewPreCheckoutQuery) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewPreCheckoutQuery. -var ( - _ bin.Encoder = &UpdateNewPreCheckoutQuery{} - _ bin.Decoder = &UpdateNewPreCheckoutQuery{} - _ bin.BareEncoder = &UpdateNewPreCheckoutQuery{} - _ bin.BareDecoder = &UpdateNewPreCheckoutQuery{} - - _ UpdateClass = &UpdateNewPreCheckoutQuery{} -) - -func (u *UpdateNewPreCheckoutQuery) Zero() bool { - if u == nil { - return true - } - if !(u.ID == 0) { - return false - } - if !(u.SenderUserID == 0) { - return false - } - if !(u.Currency == "") { - return false - } - if !(u.TotalAmount == 0) { - return false - } - if !(u.InvoicePayload == nil) { - return false - } - if !(u.ShippingOptionID == "") { - return false - } - if !(u.OrderInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewPreCheckoutQuery) String() string { - if u == nil { - return "UpdateNewPreCheckoutQuery(nil)" - } - type Alias UpdateNewPreCheckoutQuery - return fmt.Sprintf("UpdateNewPreCheckoutQuery%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewPreCheckoutQuery) TypeID() uint32 { - return UpdateNewPreCheckoutQueryTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewPreCheckoutQuery) TypeName() string { - return "updateNewPreCheckoutQuery" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewPreCheckoutQuery) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewPreCheckoutQuery", - ID: UpdateNewPreCheckoutQueryTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "Currency", - SchemaName: "currency", - }, - { - Name: "TotalAmount", - SchemaName: "total_amount", - }, - { - Name: "InvoicePayload", - SchemaName: "invoice_payload", - }, - { - Name: "ShippingOptionID", - SchemaName: "shipping_option_id", - }, - { - Name: "OrderInfo", - SchemaName: "order_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewPreCheckoutQuery) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewPreCheckoutQuery#2a3871c9 as nil") - } - b.PutID(UpdateNewPreCheckoutQueryTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewPreCheckoutQuery) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewPreCheckoutQuery#2a3871c9 as nil") - } - b.PutLong(u.ID) - b.PutInt53(u.SenderUserID) - b.PutString(u.Currency) - b.PutInt53(u.TotalAmount) - b.PutBytes(u.InvoicePayload) - b.PutString(u.ShippingOptionID) - if err := u.OrderInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewPreCheckoutQuery#2a3871c9: field order_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewPreCheckoutQuery) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewPreCheckoutQuery#2a3871c9 to nil") - } - if err := b.ConsumeID(UpdateNewPreCheckoutQueryTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewPreCheckoutQuery) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewPreCheckoutQuery#2a3871c9 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field id: %w", err) - } - u.ID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field sender_user_id: %w", err) - } - u.SenderUserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field currency: %w", err) - } - u.Currency = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field total_amount: %w", err) - } - u.TotalAmount = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field invoice_payload: %w", err) - } - u.InvoicePayload = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field shipping_option_id: %w", err) - } - u.ShippingOptionID = value - } - { - if err := u.OrderInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field order_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewPreCheckoutQuery) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewPreCheckoutQuery#2a3871c9 as nil") - } - b.ObjStart() - b.PutID("updateNewPreCheckoutQuery") - b.Comma() - b.FieldStart("id") - b.PutLong(u.ID) - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(u.SenderUserID) - b.Comma() - b.FieldStart("currency") - b.PutString(u.Currency) - b.Comma() - b.FieldStart("total_amount") - b.PutInt53(u.TotalAmount) - b.Comma() - b.FieldStart("invoice_payload") - b.PutBytes(u.InvoicePayload) - b.Comma() - b.FieldStart("shipping_option_id") - b.PutString(u.ShippingOptionID) - b.Comma() - b.FieldStart("order_info") - if err := u.OrderInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewPreCheckoutQuery#2a3871c9: field order_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewPreCheckoutQuery) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewPreCheckoutQuery#2a3871c9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewPreCheckoutQuery"); err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field id: %w", err) - } - u.ID = value - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field sender_user_id: %w", err) - } - u.SenderUserID = value - case "currency": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field currency: %w", err) - } - u.Currency = value - case "total_amount": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field total_amount: %w", err) - } - u.TotalAmount = value - case "invoice_payload": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field invoice_payload: %w", err) - } - u.InvoicePayload = value - case "shipping_option_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field shipping_option_id: %w", err) - } - u.ShippingOptionID = value - case "order_info": - if err := u.OrderInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNewPreCheckoutQuery#2a3871c9: field order_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (u *UpdateNewPreCheckoutQuery) GetID() (value int64) { - if u == nil { - return - } - return u.ID -} - -// GetSenderUserID returns value of SenderUserID field. -func (u *UpdateNewPreCheckoutQuery) GetSenderUserID() (value int64) { - if u == nil { - return - } - return u.SenderUserID -} - -// GetCurrency returns value of Currency field. -func (u *UpdateNewPreCheckoutQuery) GetCurrency() (value string) { - if u == nil { - return - } - return u.Currency -} - -// GetTotalAmount returns value of TotalAmount field. -func (u *UpdateNewPreCheckoutQuery) GetTotalAmount() (value int64) { - if u == nil { - return - } - return u.TotalAmount -} - -// GetInvoicePayload returns value of InvoicePayload field. -func (u *UpdateNewPreCheckoutQuery) GetInvoicePayload() (value []byte) { - if u == nil { - return - } - return u.InvoicePayload -} - -// GetShippingOptionID returns value of ShippingOptionID field. -func (u *UpdateNewPreCheckoutQuery) GetShippingOptionID() (value string) { - if u == nil { - return - } - return u.ShippingOptionID -} - -// GetOrderInfo returns value of OrderInfo field. -func (u *UpdateNewPreCheckoutQuery) GetOrderInfo() (value OrderInfo) { - if u == nil { - return - } - return u.OrderInfo -} - -// UpdateNewCustomEvent represents TL type `updateNewCustomEvent#76dd6a0c`. -type UpdateNewCustomEvent struct { - // A JSON-serialized event - Event string -} - -// UpdateNewCustomEventTypeID is TL type id of UpdateNewCustomEvent. -const UpdateNewCustomEventTypeID = 0x76dd6a0c - -// construct implements constructor of UpdateClass. -func (u UpdateNewCustomEvent) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewCustomEvent. -var ( - _ bin.Encoder = &UpdateNewCustomEvent{} - _ bin.Decoder = &UpdateNewCustomEvent{} - _ bin.BareEncoder = &UpdateNewCustomEvent{} - _ bin.BareDecoder = &UpdateNewCustomEvent{} - - _ UpdateClass = &UpdateNewCustomEvent{} -) - -func (u *UpdateNewCustomEvent) Zero() bool { - if u == nil { - return true - } - if !(u.Event == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewCustomEvent) String() string { - if u == nil { - return "UpdateNewCustomEvent(nil)" - } - type Alias UpdateNewCustomEvent - return fmt.Sprintf("UpdateNewCustomEvent%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewCustomEvent) TypeID() uint32 { - return UpdateNewCustomEventTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewCustomEvent) TypeName() string { - return "updateNewCustomEvent" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewCustomEvent) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewCustomEvent", - ID: UpdateNewCustomEventTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Event", - SchemaName: "event", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewCustomEvent) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCustomEvent#76dd6a0c as nil") - } - b.PutID(UpdateNewCustomEventTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewCustomEvent) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCustomEvent#76dd6a0c as nil") - } - b.PutString(u.Event) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewCustomEvent) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCustomEvent#76dd6a0c to nil") - } - if err := b.ConsumeID(UpdateNewCustomEventTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewCustomEvent#76dd6a0c: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewCustomEvent) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCustomEvent#76dd6a0c to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewCustomEvent#76dd6a0c: field event: %w", err) - } - u.Event = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewCustomEvent) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCustomEvent#76dd6a0c as nil") - } - b.ObjStart() - b.PutID("updateNewCustomEvent") - b.Comma() - b.FieldStart("event") - b.PutString(u.Event) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewCustomEvent) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCustomEvent#76dd6a0c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewCustomEvent"); err != nil { - return fmt.Errorf("unable to decode updateNewCustomEvent#76dd6a0c: %w", err) - } - case "event": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewCustomEvent#76dd6a0c: field event: %w", err) - } - u.Event = value - default: - return b.Skip() - } - return nil - }) -} - -// GetEvent returns value of Event field. -func (u *UpdateNewCustomEvent) GetEvent() (value string) { - if u == nil { - return - } - return u.Event -} - -// UpdateNewCustomQuery represents TL type `updateNewCustomQuery#d702f9a6`. -type UpdateNewCustomQuery struct { - // The query identifier - ID int64 - // JSON-serialized query data - Data string - // Query timeout - Timeout int32 -} - -// UpdateNewCustomQueryTypeID is TL type id of UpdateNewCustomQuery. -const UpdateNewCustomQueryTypeID = 0xd702f9a6 - -// construct implements constructor of UpdateClass. -func (u UpdateNewCustomQuery) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewCustomQuery. -var ( - _ bin.Encoder = &UpdateNewCustomQuery{} - _ bin.Decoder = &UpdateNewCustomQuery{} - _ bin.BareEncoder = &UpdateNewCustomQuery{} - _ bin.BareDecoder = &UpdateNewCustomQuery{} - - _ UpdateClass = &UpdateNewCustomQuery{} -) - -func (u *UpdateNewCustomQuery) Zero() bool { - if u == nil { - return true - } - if !(u.ID == 0) { - return false - } - if !(u.Data == "") { - return false - } - if !(u.Timeout == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewCustomQuery) String() string { - if u == nil { - return "UpdateNewCustomQuery(nil)" - } - type Alias UpdateNewCustomQuery - return fmt.Sprintf("UpdateNewCustomQuery%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewCustomQuery) TypeID() uint32 { - return UpdateNewCustomQueryTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewCustomQuery) TypeName() string { - return "updateNewCustomQuery" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewCustomQuery) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewCustomQuery", - ID: UpdateNewCustomQueryTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Data", - SchemaName: "data", - }, - { - Name: "Timeout", - SchemaName: "timeout", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewCustomQuery) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCustomQuery#d702f9a6 as nil") - } - b.PutID(UpdateNewCustomQueryTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewCustomQuery) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCustomQuery#d702f9a6 as nil") - } - b.PutLong(u.ID) - b.PutString(u.Data) - b.PutInt32(u.Timeout) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewCustomQuery) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCustomQuery#d702f9a6 to nil") - } - if err := b.ConsumeID(UpdateNewCustomQueryTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewCustomQuery#d702f9a6: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewCustomQuery) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCustomQuery#d702f9a6 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewCustomQuery#d702f9a6: field id: %w", err) - } - u.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewCustomQuery#d702f9a6: field data: %w", err) - } - u.Data = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNewCustomQuery#d702f9a6: field timeout: %w", err) - } - u.Timeout = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewCustomQuery) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewCustomQuery#d702f9a6 as nil") - } - b.ObjStart() - b.PutID("updateNewCustomQuery") - b.Comma() - b.FieldStart("id") - b.PutLong(u.ID) - b.Comma() - b.FieldStart("data") - b.PutString(u.Data) - b.Comma() - b.FieldStart("timeout") - b.PutInt32(u.Timeout) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewCustomQuery) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewCustomQuery#d702f9a6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewCustomQuery"); err != nil { - return fmt.Errorf("unable to decode updateNewCustomQuery#d702f9a6: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updateNewCustomQuery#d702f9a6: field id: %w", err) - } - u.ID = value - case "data": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updateNewCustomQuery#d702f9a6: field data: %w", err) - } - u.Data = value - case "timeout": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateNewCustomQuery#d702f9a6: field timeout: %w", err) - } - u.Timeout = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (u *UpdateNewCustomQuery) GetID() (value int64) { - if u == nil { - return - } - return u.ID -} - -// GetData returns value of Data field. -func (u *UpdateNewCustomQuery) GetData() (value string) { - if u == nil { - return - } - return u.Data -} - -// GetTimeout returns value of Timeout field. -func (u *UpdateNewCustomQuery) GetTimeout() (value int32) { - if u == nil { - return - } - return u.Timeout -} - -// UpdatePoll represents TL type `updatePoll#966b73ca`. -type UpdatePoll struct { - // New data about the poll - Poll Poll -} - -// UpdatePollTypeID is TL type id of UpdatePoll. -const UpdatePollTypeID = 0x966b73ca - -// construct implements constructor of UpdateClass. -func (u UpdatePoll) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdatePoll. -var ( - _ bin.Encoder = &UpdatePoll{} - _ bin.Decoder = &UpdatePoll{} - _ bin.BareEncoder = &UpdatePoll{} - _ bin.BareDecoder = &UpdatePoll{} - - _ UpdateClass = &UpdatePoll{} -) - -func (u *UpdatePoll) Zero() bool { - if u == nil { - return true - } - if !(u.Poll.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdatePoll) String() string { - if u == nil { - return "UpdatePoll(nil)" - } - type Alias UpdatePoll - return fmt.Sprintf("UpdatePoll%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdatePoll) TypeID() uint32 { - return UpdatePollTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdatePoll) TypeName() string { - return "updatePoll" -} - -// TypeInfo returns info about TL type. -func (u *UpdatePoll) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updatePoll", - ID: UpdatePollTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Poll", - SchemaName: "poll", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdatePoll) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updatePoll#966b73ca as nil") - } - b.PutID(UpdatePollTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdatePoll) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updatePoll#966b73ca as nil") - } - if err := u.Poll.Encode(b); err != nil { - return fmt.Errorf("unable to encode updatePoll#966b73ca: field poll: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdatePoll) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updatePoll#966b73ca to nil") - } - if err := b.ConsumeID(UpdatePollTypeID); err != nil { - return fmt.Errorf("unable to decode updatePoll#966b73ca: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdatePoll) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updatePoll#966b73ca to nil") - } - { - if err := u.Poll.Decode(b); err != nil { - return fmt.Errorf("unable to decode updatePoll#966b73ca: field poll: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdatePoll) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updatePoll#966b73ca as nil") - } - b.ObjStart() - b.PutID("updatePoll") - b.Comma() - b.FieldStart("poll") - if err := u.Poll.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updatePoll#966b73ca: field poll: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdatePoll) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updatePoll#966b73ca to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updatePoll"); err != nil { - return fmt.Errorf("unable to decode updatePoll#966b73ca: %w", err) - } - case "poll": - if err := u.Poll.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updatePoll#966b73ca: field poll: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPoll returns value of Poll field. -func (u *UpdatePoll) GetPoll() (value Poll) { - if u == nil { - return - } - return u.Poll -} - -// UpdatePollAnswer represents TL type `updatePollAnswer#b67ac547`. -type UpdatePollAnswer struct { - // Unique poll identifier - PollID int64 - // Identifier of the message sender that changed the answer to the poll - VoterID MessageSenderClass - // 0-based identifiers of answer options, chosen by the user - OptionIDs []int32 -} - -// UpdatePollAnswerTypeID is TL type id of UpdatePollAnswer. -const UpdatePollAnswerTypeID = 0xb67ac547 - -// construct implements constructor of UpdateClass. -func (u UpdatePollAnswer) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdatePollAnswer. -var ( - _ bin.Encoder = &UpdatePollAnswer{} - _ bin.Decoder = &UpdatePollAnswer{} - _ bin.BareEncoder = &UpdatePollAnswer{} - _ bin.BareDecoder = &UpdatePollAnswer{} - - _ UpdateClass = &UpdatePollAnswer{} -) - -func (u *UpdatePollAnswer) Zero() bool { - if u == nil { - return true - } - if !(u.PollID == 0) { - return false - } - if !(u.VoterID == nil) { - return false - } - if !(u.OptionIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdatePollAnswer) String() string { - if u == nil { - return "UpdatePollAnswer(nil)" - } - type Alias UpdatePollAnswer - return fmt.Sprintf("UpdatePollAnswer%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdatePollAnswer) TypeID() uint32 { - return UpdatePollAnswerTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdatePollAnswer) TypeName() string { - return "updatePollAnswer" -} - -// TypeInfo returns info about TL type. -func (u *UpdatePollAnswer) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updatePollAnswer", - ID: UpdatePollAnswerTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PollID", - SchemaName: "poll_id", - }, - { - Name: "VoterID", - SchemaName: "voter_id", - }, - { - Name: "OptionIDs", - SchemaName: "option_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdatePollAnswer) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updatePollAnswer#b67ac547 as nil") - } - b.PutID(UpdatePollAnswerTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdatePollAnswer) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updatePollAnswer#b67ac547 as nil") - } - b.PutLong(u.PollID) - if u.VoterID == nil { - return fmt.Errorf("unable to encode updatePollAnswer#b67ac547: field voter_id is nil") - } - if err := u.VoterID.Encode(b); err != nil { - return fmt.Errorf("unable to encode updatePollAnswer#b67ac547: field voter_id: %w", err) - } - b.PutInt(len(u.OptionIDs)) - for _, v := range u.OptionIDs { - b.PutInt32(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdatePollAnswer) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updatePollAnswer#b67ac547 to nil") - } - if err := b.ConsumeID(UpdatePollAnswerTypeID); err != nil { - return fmt.Errorf("unable to decode updatePollAnswer#b67ac547: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdatePollAnswer) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updatePollAnswer#b67ac547 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updatePollAnswer#b67ac547: field poll_id: %w", err) - } - u.PollID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode updatePollAnswer#b67ac547: field voter_id: %w", err) - } - u.VoterID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updatePollAnswer#b67ac547: field option_ids: %w", err) - } - - if headerLen > 0 { - u.OptionIDs = make([]int32, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updatePollAnswer#b67ac547: field option_ids: %w", err) - } - u.OptionIDs = append(u.OptionIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdatePollAnswer) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updatePollAnswer#b67ac547 as nil") - } - b.ObjStart() - b.PutID("updatePollAnswer") - b.Comma() - b.FieldStart("poll_id") - b.PutLong(u.PollID) - b.Comma() - b.FieldStart("voter_id") - if u.VoterID == nil { - return fmt.Errorf("unable to encode updatePollAnswer#b67ac547: field voter_id is nil") - } - if err := u.VoterID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updatePollAnswer#b67ac547: field voter_id: %w", err) - } - b.Comma() - b.FieldStart("option_ids") - b.ArrStart() - for _, v := range u.OptionIDs { - b.PutInt32(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdatePollAnswer) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updatePollAnswer#b67ac547 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updatePollAnswer"); err != nil { - return fmt.Errorf("unable to decode updatePollAnswer#b67ac547: %w", err) - } - case "poll_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode updatePollAnswer#b67ac547: field poll_id: %w", err) - } - u.PollID = value - case "voter_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode updatePollAnswer#b67ac547: field voter_id: %w", err) - } - u.VoterID = value - case "option_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updatePollAnswer#b67ac547: field option_ids: %w", err) - } - u.OptionIDs = append(u.OptionIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updatePollAnswer#b67ac547: field option_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPollID returns value of PollID field. -func (u *UpdatePollAnswer) GetPollID() (value int64) { - if u == nil { - return - } - return u.PollID -} - -// GetVoterID returns value of VoterID field. -func (u *UpdatePollAnswer) GetVoterID() (value MessageSenderClass) { - if u == nil { - return - } - return u.VoterID -} - -// GetOptionIDs returns value of OptionIDs field. -func (u *UpdatePollAnswer) GetOptionIDs() (value []int32) { - if u == nil { - return - } - return u.OptionIDs -} - -// UpdateChatMember represents TL type `updateChatMember#98865bc7`. -type UpdateChatMember struct { - // Chat identifier - ChatID int64 - // Identifier of the user, changing the rights - ActorUserID int64 - // Point in time (Unix timestamp) when the user rights were changed - Date int32 - // If user has joined the chat using an invite link, the invite link; may be null - InviteLink ChatInviteLink - // True, if the user has joined the chat after sending a join request and being approved - // by an administrator - ViaJoinRequest bool - // True, if the user has joined the chat using an invite link for a chat folder - ViaChatFolderInviteLink bool - // Previous chat member - OldChatMember ChatMember - // New chat member - NewChatMember ChatMember -} - -// UpdateChatMemberTypeID is TL type id of UpdateChatMember. -const UpdateChatMemberTypeID = 0x98865bc7 - -// construct implements constructor of UpdateClass. -func (u UpdateChatMember) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatMember. -var ( - _ bin.Encoder = &UpdateChatMember{} - _ bin.Decoder = &UpdateChatMember{} - _ bin.BareEncoder = &UpdateChatMember{} - _ bin.BareDecoder = &UpdateChatMember{} - - _ UpdateClass = &UpdateChatMember{} -) - -func (u *UpdateChatMember) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.ActorUserID == 0) { - return false - } - if !(u.Date == 0) { - return false - } - if !(u.InviteLink.Zero()) { - return false - } - if !(u.ViaJoinRequest == false) { - return false - } - if !(u.ViaChatFolderInviteLink == false) { - return false - } - if !(u.OldChatMember.Zero()) { - return false - } - if !(u.NewChatMember.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatMember) String() string { - if u == nil { - return "UpdateChatMember(nil)" - } - type Alias UpdateChatMember - return fmt.Sprintf("UpdateChatMember%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatMember) TypeID() uint32 { - return UpdateChatMemberTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatMember) TypeName() string { - return "updateChatMember" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatMember) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatMember", - ID: UpdateChatMemberTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "ActorUserID", - SchemaName: "actor_user_id", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - { - Name: "ViaJoinRequest", - SchemaName: "via_join_request", - }, - { - Name: "ViaChatFolderInviteLink", - SchemaName: "via_chat_folder_invite_link", - }, - { - Name: "OldChatMember", - SchemaName: "old_chat_member", - }, - { - Name: "NewChatMember", - SchemaName: "new_chat_member", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatMember) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatMember#98865bc7 as nil") - } - b.PutID(UpdateChatMemberTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatMember) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatMember#98865bc7 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.ActorUserID) - b.PutInt32(u.Date) - if err := u.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#98865bc7: field invite_link: %w", err) - } - b.PutBool(u.ViaJoinRequest) - b.PutBool(u.ViaChatFolderInviteLink) - if err := u.OldChatMember.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#98865bc7: field old_chat_member: %w", err) - } - if err := u.NewChatMember.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#98865bc7: field new_chat_member: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatMember) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatMember#98865bc7 to nil") - } - if err := b.ConsumeID(UpdateChatMemberTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatMember) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatMember#98865bc7 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field actor_user_id: %w", err) - } - u.ActorUserID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field date: %w", err) - } - u.Date = value - } - { - if err := u.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field invite_link: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field via_join_request: %w", err) - } - u.ViaJoinRequest = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field via_chat_folder_invite_link: %w", err) - } - u.ViaChatFolderInviteLink = value - } - { - if err := u.OldChatMember.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field old_chat_member: %w", err) - } - } - { - if err := u.NewChatMember.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field new_chat_member: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatMember) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatMember#98865bc7 as nil") - } - b.ObjStart() - b.PutID("updateChatMember") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("actor_user_id") - b.PutInt53(u.ActorUserID) - b.Comma() - b.FieldStart("date") - b.PutInt32(u.Date) - b.Comma() - b.FieldStart("invite_link") - if err := u.InviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#98865bc7: field invite_link: %w", err) - } - b.Comma() - b.FieldStart("via_join_request") - b.PutBool(u.ViaJoinRequest) - b.Comma() - b.FieldStart("via_chat_folder_invite_link") - b.PutBool(u.ViaChatFolderInviteLink) - b.Comma() - b.FieldStart("old_chat_member") - if err := u.OldChatMember.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#98865bc7: field old_chat_member: %w", err) - } - b.Comma() - b.FieldStart("new_chat_member") - if err := u.NewChatMember.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatMember#98865bc7: field new_chat_member: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatMember) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatMember#98865bc7 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatMember"); err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field chat_id: %w", err) - } - u.ChatID = value - case "actor_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field actor_user_id: %w", err) - } - u.ActorUserID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field date: %w", err) - } - u.Date = value - case "invite_link": - if err := u.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field invite_link: %w", err) - } - case "via_join_request": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field via_join_request: %w", err) - } - u.ViaJoinRequest = value - case "via_chat_folder_invite_link": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field via_chat_folder_invite_link: %w", err) - } - u.ViaChatFolderInviteLink = value - case "old_chat_member": - if err := u.OldChatMember.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field old_chat_member: %w", err) - } - case "new_chat_member": - if err := u.NewChatMember.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatMember#98865bc7: field new_chat_member: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatMember) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetActorUserID returns value of ActorUserID field. -func (u *UpdateChatMember) GetActorUserID() (value int64) { - if u == nil { - return - } - return u.ActorUserID -} - -// GetDate returns value of Date field. -func (u *UpdateChatMember) GetDate() (value int32) { - if u == nil { - return - } - return u.Date -} - -// GetInviteLink returns value of InviteLink field. -func (u *UpdateChatMember) GetInviteLink() (value ChatInviteLink) { - if u == nil { - return - } - return u.InviteLink -} - -// GetViaJoinRequest returns value of ViaJoinRequest field. -func (u *UpdateChatMember) GetViaJoinRequest() (value bool) { - if u == nil { - return - } - return u.ViaJoinRequest -} - -// GetViaChatFolderInviteLink returns value of ViaChatFolderInviteLink field. -func (u *UpdateChatMember) GetViaChatFolderInviteLink() (value bool) { - if u == nil { - return - } - return u.ViaChatFolderInviteLink -} - -// GetOldChatMember returns value of OldChatMember field. -func (u *UpdateChatMember) GetOldChatMember() (value ChatMember) { - if u == nil { - return - } - return u.OldChatMember -} - -// GetNewChatMember returns value of NewChatMember field. -func (u *UpdateChatMember) GetNewChatMember() (value ChatMember) { - if u == nil { - return - } - return u.NewChatMember -} - -// UpdateNewChatJoinRequest represents TL type `updateNewChatJoinRequest#7e48b843`. -type UpdateNewChatJoinRequest struct { - // Chat identifier - ChatID int64 - // Join request - Request ChatJoinRequest - // Chat identifier of the private chat with the user - UserChatID int64 - // The invite link, which was used to send join request; may be null - InviteLink ChatInviteLink -} - -// UpdateNewChatJoinRequestTypeID is TL type id of UpdateNewChatJoinRequest. -const UpdateNewChatJoinRequestTypeID = 0x7e48b843 - -// construct implements constructor of UpdateClass. -func (u UpdateNewChatJoinRequest) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateNewChatJoinRequest. -var ( - _ bin.Encoder = &UpdateNewChatJoinRequest{} - _ bin.Decoder = &UpdateNewChatJoinRequest{} - _ bin.BareEncoder = &UpdateNewChatJoinRequest{} - _ bin.BareDecoder = &UpdateNewChatJoinRequest{} - - _ UpdateClass = &UpdateNewChatJoinRequest{} -) - -func (u *UpdateNewChatJoinRequest) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.Request.Zero()) { - return false - } - if !(u.UserChatID == 0) { - return false - } - if !(u.InviteLink.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateNewChatJoinRequest) String() string { - if u == nil { - return "UpdateNewChatJoinRequest(nil)" - } - type Alias UpdateNewChatJoinRequest - return fmt.Sprintf("UpdateNewChatJoinRequest%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateNewChatJoinRequest) TypeID() uint32 { - return UpdateNewChatJoinRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateNewChatJoinRequest) TypeName() string { - return "updateNewChatJoinRequest" -} - -// TypeInfo returns info about TL type. -func (u *UpdateNewChatJoinRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateNewChatJoinRequest", - ID: UpdateNewChatJoinRequestTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Request", - SchemaName: "request", - }, - { - Name: "UserChatID", - SchemaName: "user_chat_id", - }, - { - Name: "InviteLink", - SchemaName: "invite_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateNewChatJoinRequest) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewChatJoinRequest#7e48b843 as nil") - } - b.PutID(UpdateNewChatJoinRequestTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateNewChatJoinRequest) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateNewChatJoinRequest#7e48b843 as nil") - } - b.PutInt53(u.ChatID) - if err := u.Request.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewChatJoinRequest#7e48b843: field request: %w", err) - } - b.PutInt53(u.UserChatID) - if err := u.InviteLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateNewChatJoinRequest#7e48b843: field invite_link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateNewChatJoinRequest) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewChatJoinRequest#7e48b843 to nil") - } - if err := b.ConsumeID(UpdateNewChatJoinRequestTypeID); err != nil { - return fmt.Errorf("unable to decode updateNewChatJoinRequest#7e48b843: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateNewChatJoinRequest) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateNewChatJoinRequest#7e48b843 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewChatJoinRequest#7e48b843: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.Request.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateNewChatJoinRequest#7e48b843: field request: %w", err) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewChatJoinRequest#7e48b843: field user_chat_id: %w", err) - } - u.UserChatID = value - } - { - if err := u.InviteLink.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateNewChatJoinRequest#7e48b843: field invite_link: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateNewChatJoinRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateNewChatJoinRequest#7e48b843 as nil") - } - b.ObjStart() - b.PutID("updateNewChatJoinRequest") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("request") - if err := u.Request.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewChatJoinRequest#7e48b843: field request: %w", err) - } - b.Comma() - b.FieldStart("user_chat_id") - b.PutInt53(u.UserChatID) - b.Comma() - b.FieldStart("invite_link") - if err := u.InviteLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateNewChatJoinRequest#7e48b843: field invite_link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateNewChatJoinRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateNewChatJoinRequest#7e48b843 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateNewChatJoinRequest"); err != nil { - return fmt.Errorf("unable to decode updateNewChatJoinRequest#7e48b843: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewChatJoinRequest#7e48b843: field chat_id: %w", err) - } - u.ChatID = value - case "request": - if err := u.Request.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNewChatJoinRequest#7e48b843: field request: %w", err) - } - case "user_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateNewChatJoinRequest#7e48b843: field user_chat_id: %w", err) - } - u.UserChatID = value - case "invite_link": - if err := u.InviteLink.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateNewChatJoinRequest#7e48b843: field invite_link: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateNewChatJoinRequest) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetRequest returns value of Request field. -func (u *UpdateNewChatJoinRequest) GetRequest() (value ChatJoinRequest) { - if u == nil { - return - } - return u.Request -} - -// GetUserChatID returns value of UserChatID field. -func (u *UpdateNewChatJoinRequest) GetUserChatID() (value int64) { - if u == nil { - return - } - return u.UserChatID -} - -// GetInviteLink returns value of InviteLink field. -func (u *UpdateNewChatJoinRequest) GetInviteLink() (value ChatInviteLink) { - if u == nil { - return - } - return u.InviteLink -} - -// UpdateChatBoost represents TL type `updateChatBoost#50727e24`. -type UpdateChatBoost struct { - // Chat identifier - ChatID int64 - // New information about the boost - Boost ChatBoost -} - -// UpdateChatBoostTypeID is TL type id of UpdateChatBoost. -const UpdateChatBoostTypeID = 0x50727e24 - -// construct implements constructor of UpdateClass. -func (u UpdateChatBoost) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateChatBoost. -var ( - _ bin.Encoder = &UpdateChatBoost{} - _ bin.Decoder = &UpdateChatBoost{} - _ bin.BareEncoder = &UpdateChatBoost{} - _ bin.BareDecoder = &UpdateChatBoost{} - - _ UpdateClass = &UpdateChatBoost{} -) - -func (u *UpdateChatBoost) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.Boost.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateChatBoost) String() string { - if u == nil { - return "UpdateChatBoost(nil)" - } - type Alias UpdateChatBoost - return fmt.Sprintf("UpdateChatBoost%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateChatBoost) TypeID() uint32 { - return UpdateChatBoostTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateChatBoost) TypeName() string { - return "updateChatBoost" -} - -// TypeInfo returns info about TL type. -func (u *UpdateChatBoost) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateChatBoost", - ID: UpdateChatBoostTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "Boost", - SchemaName: "boost", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateChatBoost) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBoost#50727e24 as nil") - } - b.PutID(UpdateChatBoostTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateChatBoost) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBoost#50727e24 as nil") - } - b.PutInt53(u.ChatID) - if err := u.Boost.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateChatBoost#50727e24: field boost: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateChatBoost) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBoost#50727e24 to nil") - } - if err := b.ConsumeID(UpdateChatBoostTypeID); err != nil { - return fmt.Errorf("unable to decode updateChatBoost#50727e24: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateChatBoost) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBoost#50727e24 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatBoost#50727e24: field chat_id: %w", err) - } - u.ChatID = value - } - { - if err := u.Boost.Decode(b); err != nil { - return fmt.Errorf("unable to decode updateChatBoost#50727e24: field boost: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateChatBoost) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateChatBoost#50727e24 as nil") - } - b.ObjStart() - b.PutID("updateChatBoost") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("boost") - if err := u.Boost.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateChatBoost#50727e24: field boost: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateChatBoost) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateChatBoost#50727e24 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateChatBoost"); err != nil { - return fmt.Errorf("unable to decode updateChatBoost#50727e24: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateChatBoost#50727e24: field chat_id: %w", err) - } - u.ChatID = value - case "boost": - if err := u.Boost.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateChatBoost#50727e24: field boost: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateChatBoost) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetBoost returns value of Boost field. -func (u *UpdateChatBoost) GetBoost() (value ChatBoost) { - if u == nil { - return - } - return u.Boost -} - -// UpdateMessageReaction represents TL type `updateMessageReaction#f46c854a`. -type UpdateMessageReaction struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 - // Identifier of the user or chat that changed reactions - ActorID MessageSenderClass - // Point in time (Unix timestamp) when the reactions were changed - Date int32 - // Old list of chosen reactions - OldReactionTypes []ReactionTypeClass - // New list of chosen reactions - NewReactionTypes []ReactionTypeClass -} - -// UpdateMessageReactionTypeID is TL type id of UpdateMessageReaction. -const UpdateMessageReactionTypeID = 0xf46c854a - -// construct implements constructor of UpdateClass. -func (u UpdateMessageReaction) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageReaction. -var ( - _ bin.Encoder = &UpdateMessageReaction{} - _ bin.Decoder = &UpdateMessageReaction{} - _ bin.BareEncoder = &UpdateMessageReaction{} - _ bin.BareDecoder = &UpdateMessageReaction{} - - _ UpdateClass = &UpdateMessageReaction{} -) - -func (u *UpdateMessageReaction) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.ActorID == nil) { - return false - } - if !(u.Date == 0) { - return false - } - if !(u.OldReactionTypes == nil) { - return false - } - if !(u.NewReactionTypes == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageReaction) String() string { - if u == nil { - return "UpdateMessageReaction(nil)" - } - type Alias UpdateMessageReaction - return fmt.Sprintf("UpdateMessageReaction%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageReaction) TypeID() uint32 { - return UpdateMessageReactionTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageReaction) TypeName() string { - return "updateMessageReaction" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageReaction) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageReaction", - ID: UpdateMessageReactionTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "ActorID", - SchemaName: "actor_id", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "OldReactionTypes", - SchemaName: "old_reaction_types", - }, - { - Name: "NewReactionTypes", - SchemaName: "new_reaction_types", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageReaction) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageReaction#f46c854a as nil") - } - b.PutID(UpdateMessageReactionTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageReaction) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageReaction#f46c854a as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - if u.ActorID == nil { - return fmt.Errorf("unable to encode updateMessageReaction#f46c854a: field actor_id is nil") - } - if err := u.ActorID.Encode(b); err != nil { - return fmt.Errorf("unable to encode updateMessageReaction#f46c854a: field actor_id: %w", err) - } - b.PutInt32(u.Date) - b.PutInt(len(u.OldReactionTypes)) - for idx, v := range u.OldReactionTypes { - if v == nil { - return fmt.Errorf("unable to encode updateMessageReaction#f46c854a: field old_reaction_types element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateMessageReaction#f46c854a: field old_reaction_types element with index %d: %w", idx, err) - } - } - b.PutInt(len(u.NewReactionTypes)) - for idx, v := range u.NewReactionTypes { - if v == nil { - return fmt.Errorf("unable to encode updateMessageReaction#f46c854a: field new_reaction_types element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateMessageReaction#f46c854a: field new_reaction_types element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageReaction) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageReaction#f46c854a to nil") - } - if err := b.ConsumeID(UpdateMessageReactionTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageReaction) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageReaction#f46c854a to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field message_id: %w", err) - } - u.MessageID = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field actor_id: %w", err) - } - u.ActorID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field date: %w", err) - } - u.Date = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field old_reaction_types: %w", err) - } - - if headerLen > 0 { - u.OldReactionTypes = make([]ReactionTypeClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field old_reaction_types: %w", err) - } - u.OldReactionTypes = append(u.OldReactionTypes, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field new_reaction_types: %w", err) - } - - if headerLen > 0 { - u.NewReactionTypes = make([]ReactionTypeClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field new_reaction_types: %w", err) - } - u.NewReactionTypes = append(u.NewReactionTypes, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageReaction) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageReaction#f46c854a as nil") - } - b.ObjStart() - b.PutID("updateMessageReaction") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("actor_id") - if u.ActorID == nil { - return fmt.Errorf("unable to encode updateMessageReaction#f46c854a: field actor_id is nil") - } - if err := u.ActorID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageReaction#f46c854a: field actor_id: %w", err) - } - b.Comma() - b.FieldStart("date") - b.PutInt32(u.Date) - b.Comma() - b.FieldStart("old_reaction_types") - b.ArrStart() - for idx, v := range u.OldReactionTypes { - if v == nil { - return fmt.Errorf("unable to encode updateMessageReaction#f46c854a: field old_reaction_types element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageReaction#f46c854a: field old_reaction_types element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("new_reaction_types") - b.ArrStart() - for idx, v := range u.NewReactionTypes { - if v == nil { - return fmt.Errorf("unable to encode updateMessageReaction#f46c854a: field new_reaction_types element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageReaction#f46c854a: field new_reaction_types element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageReaction) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageReaction#f46c854a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageReaction"); err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field message_id: %w", err) - } - u.MessageID = value - case "actor_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field actor_id: %w", err) - } - u.ActorID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field date: %w", err) - } - u.Date = value - case "old_reaction_types": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field old_reaction_types: %w", err) - } - u.OldReactionTypes = append(u.OldReactionTypes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field old_reaction_types: %w", err) - } - case "new_reaction_types": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONReactionType(b) - if err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field new_reaction_types: %w", err) - } - u.NewReactionTypes = append(u.NewReactionTypes, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateMessageReaction#f46c854a: field new_reaction_types: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageReaction) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageReaction) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetActorID returns value of ActorID field. -func (u *UpdateMessageReaction) GetActorID() (value MessageSenderClass) { - if u == nil { - return - } - return u.ActorID -} - -// GetDate returns value of Date field. -func (u *UpdateMessageReaction) GetDate() (value int32) { - if u == nil { - return - } - return u.Date -} - -// GetOldReactionTypes returns value of OldReactionTypes field. -func (u *UpdateMessageReaction) GetOldReactionTypes() (value []ReactionTypeClass) { - if u == nil { - return - } - return u.OldReactionTypes -} - -// GetNewReactionTypes returns value of NewReactionTypes field. -func (u *UpdateMessageReaction) GetNewReactionTypes() (value []ReactionTypeClass) { - if u == nil { - return - } - return u.NewReactionTypes -} - -// UpdateMessageReactions represents TL type `updateMessageReactions#bd5618e9`. -type UpdateMessageReactions struct { - // Chat identifier - ChatID int64 - // Message identifier - MessageID int64 - // Point in time (Unix timestamp) when the reactions were changed - Date int32 - // The list of reactions added to the message - Reactions []MessageReaction -} - -// UpdateMessageReactionsTypeID is TL type id of UpdateMessageReactions. -const UpdateMessageReactionsTypeID = 0xbd5618e9 - -// construct implements constructor of UpdateClass. -func (u UpdateMessageReactions) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdateMessageReactions. -var ( - _ bin.Encoder = &UpdateMessageReactions{} - _ bin.Decoder = &UpdateMessageReactions{} - _ bin.BareEncoder = &UpdateMessageReactions{} - _ bin.BareDecoder = &UpdateMessageReactions{} - - _ UpdateClass = &UpdateMessageReactions{} -) - -func (u *UpdateMessageReactions) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.Date == 0) { - return false - } - if !(u.Reactions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdateMessageReactions) String() string { - if u == nil { - return "UpdateMessageReactions(nil)" - } - type Alias UpdateMessageReactions - return fmt.Sprintf("UpdateMessageReactions%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdateMessageReactions) TypeID() uint32 { - return UpdateMessageReactionsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdateMessageReactions) TypeName() string { - return "updateMessageReactions" -} - -// TypeInfo returns info about TL type. -func (u *UpdateMessageReactions) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updateMessageReactions", - ID: UpdateMessageReactionsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "Reactions", - SchemaName: "reactions", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdateMessageReactions) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageReactions#bd5618e9 as nil") - } - b.PutID(UpdateMessageReactionsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdateMessageReactions) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageReactions#bd5618e9 as nil") - } - b.PutInt53(u.ChatID) - b.PutInt53(u.MessageID) - b.PutInt32(u.Date) - b.PutInt(len(u.Reactions)) - for idx, v := range u.Reactions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updateMessageReactions#bd5618e9: field reactions element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdateMessageReactions) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageReactions#bd5618e9 to nil") - } - if err := b.ConsumeID(UpdateMessageReactionsTypeID); err != nil { - return fmt.Errorf("unable to decode updateMessageReactions#bd5618e9: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdateMessageReactions) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageReactions#bd5618e9 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReactions#bd5618e9: field chat_id: %w", err) - } - u.ChatID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReactions#bd5618e9: field message_id: %w", err) - } - u.MessageID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReactions#bd5618e9: field date: %w", err) - } - u.Date = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReactions#bd5618e9: field reactions: %w", err) - } - - if headerLen > 0 { - u.Reactions = make([]MessageReaction, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value MessageReaction - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare updateMessageReactions#bd5618e9: field reactions: %w", err) - } - u.Reactions = append(u.Reactions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdateMessageReactions) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updateMessageReactions#bd5618e9 as nil") - } - b.ObjStart() - b.PutID("updateMessageReactions") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("date") - b.PutInt32(u.Date) - b.Comma() - b.FieldStart("reactions") - b.ArrStart() - for idx, v := range u.Reactions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updateMessageReactions#bd5618e9: field reactions element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdateMessageReactions) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updateMessageReactions#bd5618e9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updateMessageReactions"); err != nil { - return fmt.Errorf("unable to decode updateMessageReactions#bd5618e9: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReactions#bd5618e9: field chat_id: %w", err) - } - u.ChatID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReactions#bd5618e9: field message_id: %w", err) - } - u.MessageID = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode updateMessageReactions#bd5618e9: field date: %w", err) - } - u.Date = value - case "reactions": - if err := b.Arr(func(b tdjson.Decoder) error { - var value MessageReaction - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode updateMessageReactions#bd5618e9: field reactions: %w", err) - } - u.Reactions = append(u.Reactions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updateMessageReactions#bd5618e9: field reactions: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpdateMessageReactions) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// GetMessageID returns value of MessageID field. -func (u *UpdateMessageReactions) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetDate returns value of Date field. -func (u *UpdateMessageReactions) GetDate() (value int32) { - if u == nil { - return - } - return u.Date -} - -// GetReactions returns value of Reactions field. -func (u *UpdateMessageReactions) GetReactions() (value []MessageReaction) { - if u == nil { - return - } - return u.Reactions -} - -// UpdatePaidMediaPurchased represents TL type `updatePaidMediaPurchased#a410e65b`. -type UpdatePaidMediaPurchased struct { - // User identifier - UserID int64 - // Bot-specified payload for the paid media - Payload string -} - -// UpdatePaidMediaPurchasedTypeID is TL type id of UpdatePaidMediaPurchased. -const UpdatePaidMediaPurchasedTypeID = 0xa410e65b - -// construct implements constructor of UpdateClass. -func (u UpdatePaidMediaPurchased) construct() UpdateClass { return &u } - -// Ensuring interfaces in compile-time for UpdatePaidMediaPurchased. -var ( - _ bin.Encoder = &UpdatePaidMediaPurchased{} - _ bin.Decoder = &UpdatePaidMediaPurchased{} - _ bin.BareEncoder = &UpdatePaidMediaPurchased{} - _ bin.BareDecoder = &UpdatePaidMediaPurchased{} - - _ UpdateClass = &UpdatePaidMediaPurchased{} -) - -func (u *UpdatePaidMediaPurchased) Zero() bool { - if u == nil { - return true - } - if !(u.UserID == 0) { - return false - } - if !(u.Payload == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpdatePaidMediaPurchased) String() string { - if u == nil { - return "UpdatePaidMediaPurchased(nil)" - } - type Alias UpdatePaidMediaPurchased - return fmt.Sprintf("UpdatePaidMediaPurchased%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpdatePaidMediaPurchased) TypeID() uint32 { - return UpdatePaidMediaPurchasedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpdatePaidMediaPurchased) TypeName() string { - return "updatePaidMediaPurchased" -} - -// TypeInfo returns info about TL type. -func (u *UpdatePaidMediaPurchased) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updatePaidMediaPurchased", - ID: UpdatePaidMediaPurchasedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "Payload", - SchemaName: "payload", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpdatePaidMediaPurchased) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updatePaidMediaPurchased#a410e65b as nil") - } - b.PutID(UpdatePaidMediaPurchasedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpdatePaidMediaPurchased) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updatePaidMediaPurchased#a410e65b as nil") - } - b.PutInt53(u.UserID) - b.PutString(u.Payload) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpdatePaidMediaPurchased) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updatePaidMediaPurchased#a410e65b to nil") - } - if err := b.ConsumeID(UpdatePaidMediaPurchasedTypeID); err != nil { - return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpdatePaidMediaPurchased) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updatePaidMediaPurchased#a410e65b to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: field user_id: %w", err) - } - u.UserID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: field payload: %w", err) - } - u.Payload = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpdatePaidMediaPurchased) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updatePaidMediaPurchased#a410e65b as nil") - } - b.ObjStart() - b.PutID("updatePaidMediaPurchased") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(u.UserID) - b.Comma() - b.FieldStart("payload") - b.PutString(u.Payload) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpdatePaidMediaPurchased) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updatePaidMediaPurchased#a410e65b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updatePaidMediaPurchased"); err != nil { - return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: field user_id: %w", err) - } - u.UserID = value - case "payload": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode updatePaidMediaPurchased#a410e65b: field payload: %w", err) - } - u.Payload = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (u *UpdatePaidMediaPurchased) GetUserID() (value int64) { - if u == nil { - return - } - return u.UserID -} - -// GetPayload returns value of Payload field. -func (u *UpdatePaidMediaPurchased) GetPayload() (value string) { - if u == nil { - return - } - return u.Payload -} - -// UpdateClassName is schema name of UpdateClass. -const UpdateClassName = "Update" - -// UpdateClass represents Update generic type. -// -// Example: -// -// g, err := tdapi.DecodeUpdate(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.UpdateAuthorizationState: // updateAuthorizationState#60b30ee2 -// case *tdapi.UpdateNewMessage: // updateNewMessage#de6fb20e -// case *tdapi.UpdateMessageSendAcknowledged: // updateMessageSendAcknowledged#4da7d239 -// case *tdapi.UpdateMessageSendSucceeded: // updateMessageSendSucceeded#6c399d7d -// case *tdapi.UpdateMessageSendFailed: // updateMessageSendFailed#da1bf8e7 -// case *tdapi.UpdateMessageContent: // updateMessageContent#1e36bb24 -// case *tdapi.UpdateMessageEdited: // updateMessageEdited#dea602e6 -// case *tdapi.UpdateMessageIsPinned: // updateMessageIsPinned#41bc233d -// case *tdapi.UpdateMessageInteractionInfo: // updateMessageInteractionInfo#ab803bfe -// case *tdapi.UpdateMessageContentOpened: // updateMessageContentOpened#a55ea885 -// case *tdapi.UpdateMessageMentionRead: // updateMessageMentionRead#f0f74d46 -// case *tdapi.UpdateMessageUnreadReactions: // updateMessageUnreadReactions#12a7220a -// case *tdapi.UpdateMessageFactCheck: // updateMessageFactCheck#3c78fb02 -// case *tdapi.UpdateMessageLiveLocationViewed: // updateMessageLiveLocationViewed#b2058595 -// case *tdapi.UpdateVideoPublished: // updateVideoPublished#eafc2052 -// case *tdapi.UpdateNewChat: // updateNewChat#7bb98ccd -// case *tdapi.UpdateChatTitle: // updateChatTitle#f58b85a4 -// case *tdapi.UpdateChatPhoto: // updateChatPhoto#eca5423f -// case *tdapi.UpdateChatAccentColors: // updateChatAccentColors#b7b8f8f9 -// case *tdapi.UpdateChatPermissions: // updateChatPermissions#9f52176d -// case *tdapi.UpdateChatLastMessage: // updateChatLastMessage#f10cab1d -// case *tdapi.UpdateChatPosition: // updateChatPosition#ff76fa77 -// case *tdapi.UpdateChatAddedToList: // updateChatAddedToList#ab7004ec -// case *tdapi.UpdateChatRemovedFromList: // updateChatRemovedFromList#4d2ac21c -// case *tdapi.UpdateChatReadInbox: // updateChatReadInbox#d07036e7 -// case *tdapi.UpdateChatReadOutbox: // updateChatReadOutbox#2a385285 -// case *tdapi.UpdateChatActionBar: // updateChatActionBar#d9a258c2 -// case *tdapi.UpdateChatBusinessBotManageBar: // updateChatBusinessBotManageBar#be30e7f7 -// case *tdapi.UpdateChatAvailableReactions: // updateChatAvailableReactions#8ab413f9 -// case *tdapi.UpdateChatDraftMessage: // updateChatDraftMessage#2bf257d4 -// case *tdapi.UpdateChatEmojiStatus: // updateChatEmojiStatus#77796510 -// case *tdapi.UpdateChatMessageSender: // updateChatMessageSender#77705241 -// case *tdapi.UpdateChatMessageAutoDeleteTime: // updateChatMessageAutoDeleteTime#71425de5 -// case *tdapi.UpdateChatNotificationSettings: // updateChatNotificationSettings#d020b456 -// case *tdapi.UpdateChatPendingJoinRequests: // updateChatPendingJoinRequests#14c6e3e1 -// case *tdapi.UpdateChatReplyMarkup: // updateChatReplyMarkup#4e0ba5a0 -// case *tdapi.UpdateChatBackground: // updateChatBackground#ff9d38b3 -// case *tdapi.UpdateChatTheme: // updateChatTheme#31f3d465 -// case *tdapi.UpdateChatUnreadMentionCount: // updateChatUnreadMentionCount#80f47b1c -// case *tdapi.UpdateChatUnreadReactionCount: // updateChatUnreadReactionCount#81603cdd -// case *tdapi.UpdateChatVideoChat: // updateChatVideoChat#25fb4ca6 -// case *tdapi.UpdateChatDefaultDisableNotification: // updateChatDefaultDisableNotification#1ba96a9b -// case *tdapi.UpdateChatHasProtectedContent: // updateChatHasProtectedContent#6b50071b -// case *tdapi.UpdateChatIsTranslatable: // updateChatIsTranslatable#7b031617 -// case *tdapi.UpdateChatIsMarkedAsUnread: // updateChatIsMarkedAsUnread#57853334 -// case *tdapi.UpdateChatViewAsTopics: // updateChatViewAsTopics#5bff163d -// case *tdapi.UpdateChatBlockList: // updateChatBlockList#872af48e -// case *tdapi.UpdateChatHasScheduledMessages: // updateChatHasScheduledMessages#7b14c2d7 -// case *tdapi.UpdateChatFolders: // updateChatFolders#e110242a -// case *tdapi.UpdateChatOnlineMemberCount: // updateChatOnlineMemberCount#1d0caa9d -// case *tdapi.UpdateSavedMessagesTopic: // updateSavedMessagesTopic#9f823b30 -// case *tdapi.UpdateSavedMessagesTopicCount: // updateSavedMessagesTopicCount#fbd279d1 -// case *tdapi.UpdateQuickReplyShortcut: // updateQuickReplyShortcut#c69338cf -// case *tdapi.UpdateQuickReplyShortcutDeleted: // updateQuickReplyShortcutDeleted#e8b9bc3a -// case *tdapi.UpdateQuickReplyShortcuts: // updateQuickReplyShortcuts#77d31a6a -// case *tdapi.UpdateQuickReplyShortcutMessages: // updateQuickReplyShortcutMessages#8bb36b72 -// case *tdapi.UpdateForumTopicInfo: // updateForumTopicInfo#6b6f2cc9 -// case *tdapi.UpdateScopeNotificationSettings: // updateScopeNotificationSettings#b83ccb73 -// case *tdapi.UpdateReactionNotificationSettings: // updateReactionNotificationSettings#e54d17ec -// case *tdapi.UpdateNotification: // updateNotification#8ee67ed4 -// case *tdapi.UpdateNotificationGroup: // updateNotificationGroup#96cd9e06 -// case *tdapi.UpdateActiveNotifications: // updateActiveNotifications#317d80f2 -// case *tdapi.UpdateHavePendingNotifications: // updateHavePendingNotifications#aaee1db -// case *tdapi.UpdateDeleteMessages: // updateDeleteMessages#6a05bf9 -// case *tdapi.UpdateChatAction: // updateChatAction#9abfd628 -// case *tdapi.UpdateUserStatus: // updateUserStatus#39211211 -// case *tdapi.UpdateUser: // updateUser#468928f9 -// case *tdapi.UpdateBasicGroup: // updateBasicGroup#c433c763 -// case *tdapi.UpdateSupergroup: // updateSupergroup#fb6c6524 -// case *tdapi.UpdateSecretChat: // updateSecretChat#9ca5132b -// case *tdapi.UpdateUserFullInfo: // updateUserFullInfo#fcf2cb17 -// case *tdapi.UpdateBasicGroupFullInfo: // updateBasicGroupFullInfo#52f66bbf -// case *tdapi.UpdateSupergroupFullInfo: // updateSupergroupFullInfo#19f5cd0e -// case *tdapi.UpdateServiceNotification: // updateServiceNotification#4e9895ad -// case *tdapi.UpdateFile: // updateFile#6cd875f -// case *tdapi.UpdateFileGenerationStart: // updateFileGenerationStart#cec5eec -// case *tdapi.UpdateFileGenerationStop: // updateFileGenerationStop#8f14fdeb -// case *tdapi.UpdateFileDownloads: // updateFileDownloads#e8cd12c7 -// case *tdapi.UpdateFileAddedToDownloads: // updateFileAddedToDownloads#5ff5921a -// case *tdapi.UpdateFileDownload: // updateFileDownload#342f83ca -// case *tdapi.UpdateFileRemovedFromDownloads: // updateFileRemovedFromDownloads#6e7c14e8 -// case *tdapi.UpdateApplicationVerificationRequired: // updateApplicationVerificationRequired#c59c61d7 -// case *tdapi.UpdateCall: // updateCall#4fb3d0dd -// case *tdapi.UpdateGroupCall: // updateGroupCall#30324e00 -// case *tdapi.UpdateGroupCallParticipant: // updateGroupCallParticipant#d0213cf9 -// case *tdapi.UpdateNewCallSignalingData: // updateNewCallSignalingData#22c98d8d -// case *tdapi.UpdateUserPrivacySettingRules: // updateUserPrivacySettingRules#c99552f6 -// case *tdapi.UpdateUnreadMessageCount: // updateUnreadMessageCount#4b541c9 -// case *tdapi.UpdateUnreadChatCount: // updateUnreadChatCount#76e19242 -// case *tdapi.UpdateStory: // updateStory#1906572f -// case *tdapi.UpdateStoryDeleted: // updateStoryDeleted#7007eb9d -// case *tdapi.UpdateStorySendSucceeded: // updateStorySendSucceeded#b9269e57 -// case *tdapi.UpdateStorySendFailed: // updateStorySendFailed#e046f199 -// case *tdapi.UpdateChatActiveStories: // updateChatActiveStories#79786c2c -// case *tdapi.UpdateStoryListChatCount: // updateStoryListChatCount#8833cd3f -// case *tdapi.UpdateStoryStealthMode: // updateStoryStealthMode#6ff7bd1a -// case *tdapi.UpdateOption: // updateOption#35b17404 -// case *tdapi.UpdateStickerSet: // updateStickerSet#70035dcc -// case *tdapi.UpdateInstalledStickerSets: // updateInstalledStickerSets#82cd5388 -// case *tdapi.UpdateTrendingStickerSets: // updateTrendingStickerSets#4b7a50a7 -// case *tdapi.UpdateRecentStickers: // updateRecentStickers#aefdf8dc -// case *tdapi.UpdateFavoriteStickers: // updateFavoriteStickers#113f2b6a -// case *tdapi.UpdateSavedAnimations: // updateSavedAnimations#1084a1c8 -// case *tdapi.UpdateSavedNotificationSounds: // updateSavedNotificationSounds#5a6653b4 -// case *tdapi.UpdateDefaultBackground: // updateDefaultBackground#d550952f -// case *tdapi.UpdateChatThemes: // updateChatThemes#98dc58d5 -// case *tdapi.UpdateAccentColors: // updateAccentColors#1316555e -// case *tdapi.UpdateProfileAccentColors: // updateProfileAccentColors#bf8e7430 -// case *tdapi.UpdateLanguagePackStrings: // updateLanguagePackStrings#af87919f -// case *tdapi.UpdateConnectionState: // updateConnectionState#57939e2e -// case *tdapi.UpdateTermsOfService: // updateTermsOfService#b23cc55e -// case *tdapi.UpdateUnconfirmedSession: // updateUnconfirmedSession#fea6088c -// case *tdapi.UpdateAttachmentMenuBots: // updateAttachmentMenuBots#b6b910c -// case *tdapi.UpdateWebAppMessageSent: // updateWebAppMessageSent#58431229 -// case *tdapi.UpdateActiveEmojiReactions: // updateActiveEmojiReactions#691ffcb7 -// case *tdapi.UpdateAvailableMessageEffects: // updateAvailableMessageEffects#a1cb72b9 -// case *tdapi.UpdateDefaultReactionType: // updateDefaultReactionType#4b615105 -// case *tdapi.UpdateSavedMessagesTags: // updateSavedMessagesTags#7386424a -// case *tdapi.UpdateActiveLiveLocationMessages: // updateActiveLiveLocationMessages#a20b9b1f -// case *tdapi.UpdateOwnedStarCount: // updateOwnedStarCount#af7ebf88 -// case *tdapi.UpdateChatRevenueAmount: // updateChatRevenueAmount#c6c9bcc4 -// case *tdapi.UpdateStarRevenueStatus: // updateStarRevenueStatus#ef4bfccb -// case *tdapi.UpdateSpeechRecognitionTrial: // updateSpeechRecognitionTrial#ff4efcc1 -// case *tdapi.UpdateDiceEmojis: // updateDiceEmojis#9d0f91df -// case *tdapi.UpdateAnimatedEmojiMessageClicked: // updateAnimatedEmojiMessageClicked#a3167405 -// case *tdapi.UpdateAnimationSearchParameters: // updateAnimationSearchParameters#6016ef01 -// case *tdapi.UpdateSuggestedActions: // updateSuggestedActions#c2e5cccb -// case *tdapi.UpdateSpeedLimitNotification: // updateSpeedLimitNotification#c683d868 -// case *tdapi.UpdateContactCloseBirthdays: // updateContactCloseBirthdays#c88b98ce -// case *tdapi.UpdateAutosaveSettings: // updateAutosaveSettings#da274f0b -// case *tdapi.UpdateBusinessConnection: // updateBusinessConnection#8632f476 -// case *tdapi.UpdateNewBusinessMessage: // updateNewBusinessMessage#86be4644 -// case *tdapi.UpdateBusinessMessageEdited: // updateBusinessMessageEdited#81a66d89 -// case *tdapi.UpdateBusinessMessagesDeleted: // updateBusinessMessagesDeleted#e036d3ed -// case *tdapi.UpdateNewInlineQuery: // updateNewInlineQuery#7171bf34 -// case *tdapi.UpdateNewChosenInlineResult: // updateNewChosenInlineResult#cb4c4f5d -// case *tdapi.UpdateNewCallbackQuery: // updateNewCallbackQuery#8964d05e -// case *tdapi.UpdateNewInlineCallbackQuery: // updateNewInlineCallbackQuery#ecf934ba -// case *tdapi.UpdateNewBusinessCallbackQuery: // updateNewBusinessCallbackQuery#14125364 -// case *tdapi.UpdateNewShippingQuery: // updateNewShippingQuery#29584672 -// case *tdapi.UpdateNewPreCheckoutQuery: // updateNewPreCheckoutQuery#2a3871c9 -// case *tdapi.UpdateNewCustomEvent: // updateNewCustomEvent#76dd6a0c -// case *tdapi.UpdateNewCustomQuery: // updateNewCustomQuery#d702f9a6 -// case *tdapi.UpdatePoll: // updatePoll#966b73ca -// case *tdapi.UpdatePollAnswer: // updatePollAnswer#b67ac547 -// case *tdapi.UpdateChatMember: // updateChatMember#98865bc7 -// case *tdapi.UpdateNewChatJoinRequest: // updateNewChatJoinRequest#7e48b843 -// case *tdapi.UpdateChatBoost: // updateChatBoost#50727e24 -// case *tdapi.UpdateMessageReaction: // updateMessageReaction#f46c854a -// case *tdapi.UpdateMessageReactions: // updateMessageReactions#bd5618e9 -// case *tdapi.UpdatePaidMediaPurchased: // updatePaidMediaPurchased#a410e65b -// default: panic(v) -// } -type UpdateClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() UpdateClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeUpdate implements binary de-serialization for UpdateClass. -func DecodeUpdate(buf *bin.Buffer) (UpdateClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case UpdateAuthorizationStateTypeID: - // Decoding updateAuthorizationState#60b30ee2. - v := UpdateAuthorizationState{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewMessageTypeID: - // Decoding updateNewMessage#de6fb20e. - v := UpdateNewMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageSendAcknowledgedTypeID: - // Decoding updateMessageSendAcknowledged#4da7d239. - v := UpdateMessageSendAcknowledged{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageSendSucceededTypeID: - // Decoding updateMessageSendSucceeded#6c399d7d. - v := UpdateMessageSendSucceeded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageSendFailedTypeID: - // Decoding updateMessageSendFailed#da1bf8e7. - v := UpdateMessageSendFailed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageContentTypeID: - // Decoding updateMessageContent#1e36bb24. - v := UpdateMessageContent{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageEditedTypeID: - // Decoding updateMessageEdited#dea602e6. - v := UpdateMessageEdited{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageIsPinnedTypeID: - // Decoding updateMessageIsPinned#41bc233d. - v := UpdateMessageIsPinned{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageInteractionInfoTypeID: - // Decoding updateMessageInteractionInfo#ab803bfe. - v := UpdateMessageInteractionInfo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageContentOpenedTypeID: - // Decoding updateMessageContentOpened#a55ea885. - v := UpdateMessageContentOpened{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageMentionReadTypeID: - // Decoding updateMessageMentionRead#f0f74d46. - v := UpdateMessageMentionRead{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageUnreadReactionsTypeID: - // Decoding updateMessageUnreadReactions#12a7220a. - v := UpdateMessageUnreadReactions{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageFactCheckTypeID: - // Decoding updateMessageFactCheck#3c78fb02. - v := UpdateMessageFactCheck{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageLiveLocationViewedTypeID: - // Decoding updateMessageLiveLocationViewed#b2058595. - v := UpdateMessageLiveLocationViewed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateVideoPublishedTypeID: - // Decoding updateVideoPublished#eafc2052. - v := UpdateVideoPublished{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewChatTypeID: - // Decoding updateNewChat#7bb98ccd. - v := UpdateNewChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatTitleTypeID: - // Decoding updateChatTitle#f58b85a4. - v := UpdateChatTitle{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatPhotoTypeID: - // Decoding updateChatPhoto#eca5423f. - v := UpdateChatPhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatAccentColorsTypeID: - // Decoding updateChatAccentColors#b7b8f8f9. - v := UpdateChatAccentColors{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatPermissionsTypeID: - // Decoding updateChatPermissions#9f52176d. - v := UpdateChatPermissions{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatLastMessageTypeID: - // Decoding updateChatLastMessage#f10cab1d. - v := UpdateChatLastMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatPositionTypeID: - // Decoding updateChatPosition#ff76fa77. - v := UpdateChatPosition{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatAddedToListTypeID: - // Decoding updateChatAddedToList#ab7004ec. - v := UpdateChatAddedToList{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatRemovedFromListTypeID: - // Decoding updateChatRemovedFromList#4d2ac21c. - v := UpdateChatRemovedFromList{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatReadInboxTypeID: - // Decoding updateChatReadInbox#d07036e7. - v := UpdateChatReadInbox{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatReadOutboxTypeID: - // Decoding updateChatReadOutbox#2a385285. - v := UpdateChatReadOutbox{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatActionBarTypeID: - // Decoding updateChatActionBar#d9a258c2. - v := UpdateChatActionBar{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatBusinessBotManageBarTypeID: - // Decoding updateChatBusinessBotManageBar#be30e7f7. - v := UpdateChatBusinessBotManageBar{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatAvailableReactionsTypeID: - // Decoding updateChatAvailableReactions#8ab413f9. - v := UpdateChatAvailableReactions{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatDraftMessageTypeID: - // Decoding updateChatDraftMessage#2bf257d4. - v := UpdateChatDraftMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatEmojiStatusTypeID: - // Decoding updateChatEmojiStatus#77796510. - v := UpdateChatEmojiStatus{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatMessageSenderTypeID: - // Decoding updateChatMessageSender#77705241. - v := UpdateChatMessageSender{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatMessageAutoDeleteTimeTypeID: - // Decoding updateChatMessageAutoDeleteTime#71425de5. - v := UpdateChatMessageAutoDeleteTime{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatNotificationSettingsTypeID: - // Decoding updateChatNotificationSettings#d020b456. - v := UpdateChatNotificationSettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatPendingJoinRequestsTypeID: - // Decoding updateChatPendingJoinRequests#14c6e3e1. - v := UpdateChatPendingJoinRequests{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatReplyMarkupTypeID: - // Decoding updateChatReplyMarkup#4e0ba5a0. - v := UpdateChatReplyMarkup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatBackgroundTypeID: - // Decoding updateChatBackground#ff9d38b3. - v := UpdateChatBackground{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatThemeTypeID: - // Decoding updateChatTheme#31f3d465. - v := UpdateChatTheme{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatUnreadMentionCountTypeID: - // Decoding updateChatUnreadMentionCount#80f47b1c. - v := UpdateChatUnreadMentionCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatUnreadReactionCountTypeID: - // Decoding updateChatUnreadReactionCount#81603cdd. - v := UpdateChatUnreadReactionCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatVideoChatTypeID: - // Decoding updateChatVideoChat#25fb4ca6. - v := UpdateChatVideoChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatDefaultDisableNotificationTypeID: - // Decoding updateChatDefaultDisableNotification#1ba96a9b. - v := UpdateChatDefaultDisableNotification{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatHasProtectedContentTypeID: - // Decoding updateChatHasProtectedContent#6b50071b. - v := UpdateChatHasProtectedContent{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatIsTranslatableTypeID: - // Decoding updateChatIsTranslatable#7b031617. - v := UpdateChatIsTranslatable{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatIsMarkedAsUnreadTypeID: - // Decoding updateChatIsMarkedAsUnread#57853334. - v := UpdateChatIsMarkedAsUnread{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatViewAsTopicsTypeID: - // Decoding updateChatViewAsTopics#5bff163d. - v := UpdateChatViewAsTopics{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatBlockListTypeID: - // Decoding updateChatBlockList#872af48e. - v := UpdateChatBlockList{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatHasScheduledMessagesTypeID: - // Decoding updateChatHasScheduledMessages#7b14c2d7. - v := UpdateChatHasScheduledMessages{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatFoldersTypeID: - // Decoding updateChatFolders#e110242a. - v := UpdateChatFolders{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatOnlineMemberCountTypeID: - // Decoding updateChatOnlineMemberCount#1d0caa9d. - v := UpdateChatOnlineMemberCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateSavedMessagesTopicTypeID: - // Decoding updateSavedMessagesTopic#9f823b30. - v := UpdateSavedMessagesTopic{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateSavedMessagesTopicCountTypeID: - // Decoding updateSavedMessagesTopicCount#fbd279d1. - v := UpdateSavedMessagesTopicCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateQuickReplyShortcutTypeID: - // Decoding updateQuickReplyShortcut#c69338cf. - v := UpdateQuickReplyShortcut{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateQuickReplyShortcutDeletedTypeID: - // Decoding updateQuickReplyShortcutDeleted#e8b9bc3a. - v := UpdateQuickReplyShortcutDeleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateQuickReplyShortcutsTypeID: - // Decoding updateQuickReplyShortcuts#77d31a6a. - v := UpdateQuickReplyShortcuts{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateQuickReplyShortcutMessagesTypeID: - // Decoding updateQuickReplyShortcutMessages#8bb36b72. - v := UpdateQuickReplyShortcutMessages{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateForumTopicInfoTypeID: - // Decoding updateForumTopicInfo#6b6f2cc9. - v := UpdateForumTopicInfo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateScopeNotificationSettingsTypeID: - // Decoding updateScopeNotificationSettings#b83ccb73. - v := UpdateScopeNotificationSettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateReactionNotificationSettingsTypeID: - // Decoding updateReactionNotificationSettings#e54d17ec. - v := UpdateReactionNotificationSettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNotificationTypeID: - // Decoding updateNotification#8ee67ed4. - v := UpdateNotification{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNotificationGroupTypeID: - // Decoding updateNotificationGroup#96cd9e06. - v := UpdateNotificationGroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateActiveNotificationsTypeID: - // Decoding updateActiveNotifications#317d80f2. - v := UpdateActiveNotifications{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateHavePendingNotificationsTypeID: - // Decoding updateHavePendingNotifications#aaee1db. - v := UpdateHavePendingNotifications{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateDeleteMessagesTypeID: - // Decoding updateDeleteMessages#6a05bf9. - v := UpdateDeleteMessages{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatActionTypeID: - // Decoding updateChatAction#9abfd628. - v := UpdateChatAction{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateUserStatusTypeID: - // Decoding updateUserStatus#39211211. - v := UpdateUserStatus{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateUserTypeID: - // Decoding updateUser#468928f9. - v := UpdateUser{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateBasicGroupTypeID: - // Decoding updateBasicGroup#c433c763. - v := UpdateBasicGroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateSupergroupTypeID: - // Decoding updateSupergroup#fb6c6524. - v := UpdateSupergroup{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateSecretChatTypeID: - // Decoding updateSecretChat#9ca5132b. - v := UpdateSecretChat{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateUserFullInfoTypeID: - // Decoding updateUserFullInfo#fcf2cb17. - v := UpdateUserFullInfo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateBasicGroupFullInfoTypeID: - // Decoding updateBasicGroupFullInfo#52f66bbf. - v := UpdateBasicGroupFullInfo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateSupergroupFullInfoTypeID: - // Decoding updateSupergroupFullInfo#19f5cd0e. - v := UpdateSupergroupFullInfo{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateServiceNotificationTypeID: - // Decoding updateServiceNotification#4e9895ad. - v := UpdateServiceNotification{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateFileTypeID: - // Decoding updateFile#6cd875f. - v := UpdateFile{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateFileGenerationStartTypeID: - // Decoding updateFileGenerationStart#cec5eec. - v := UpdateFileGenerationStart{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateFileGenerationStopTypeID: - // Decoding updateFileGenerationStop#8f14fdeb. - v := UpdateFileGenerationStop{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateFileDownloadsTypeID: - // Decoding updateFileDownloads#e8cd12c7. - v := UpdateFileDownloads{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateFileAddedToDownloadsTypeID: - // Decoding updateFileAddedToDownloads#5ff5921a. - v := UpdateFileAddedToDownloads{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateFileDownloadTypeID: - // Decoding updateFileDownload#342f83ca. - v := UpdateFileDownload{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateFileRemovedFromDownloadsTypeID: - // Decoding updateFileRemovedFromDownloads#6e7c14e8. - v := UpdateFileRemovedFromDownloads{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateApplicationVerificationRequiredTypeID: - // Decoding updateApplicationVerificationRequired#c59c61d7. - v := UpdateApplicationVerificationRequired{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateCallTypeID: - // Decoding updateCall#4fb3d0dd. - v := UpdateCall{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateGroupCallTypeID: - // Decoding updateGroupCall#30324e00. - v := UpdateGroupCall{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateGroupCallParticipantTypeID: - // Decoding updateGroupCallParticipant#d0213cf9. - v := UpdateGroupCallParticipant{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewCallSignalingDataTypeID: - // Decoding updateNewCallSignalingData#22c98d8d. - v := UpdateNewCallSignalingData{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateUserPrivacySettingRulesTypeID: - // Decoding updateUserPrivacySettingRules#c99552f6. - v := UpdateUserPrivacySettingRules{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateUnreadMessageCountTypeID: - // Decoding updateUnreadMessageCount#4b541c9. - v := UpdateUnreadMessageCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateUnreadChatCountTypeID: - // Decoding updateUnreadChatCount#76e19242. - v := UpdateUnreadChatCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateStoryTypeID: - // Decoding updateStory#1906572f. - v := UpdateStory{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateStoryDeletedTypeID: - // Decoding updateStoryDeleted#7007eb9d. - v := UpdateStoryDeleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateStorySendSucceededTypeID: - // Decoding updateStorySendSucceeded#b9269e57. - v := UpdateStorySendSucceeded{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateStorySendFailedTypeID: - // Decoding updateStorySendFailed#e046f199. - v := UpdateStorySendFailed{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatActiveStoriesTypeID: - // Decoding updateChatActiveStories#79786c2c. - v := UpdateChatActiveStories{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateStoryListChatCountTypeID: - // Decoding updateStoryListChatCount#8833cd3f. - v := UpdateStoryListChatCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateStoryStealthModeTypeID: - // Decoding updateStoryStealthMode#6ff7bd1a. - v := UpdateStoryStealthMode{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateOptionTypeID: - // Decoding updateOption#35b17404. - v := UpdateOption{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateStickerSetTypeID: - // Decoding updateStickerSet#70035dcc. - v := UpdateStickerSet{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateInstalledStickerSetsTypeID: - // Decoding updateInstalledStickerSets#82cd5388. - v := UpdateInstalledStickerSets{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateTrendingStickerSetsTypeID: - // Decoding updateTrendingStickerSets#4b7a50a7. - v := UpdateTrendingStickerSets{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateRecentStickersTypeID: - // Decoding updateRecentStickers#aefdf8dc. - v := UpdateRecentStickers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateFavoriteStickersTypeID: - // Decoding updateFavoriteStickers#113f2b6a. - v := UpdateFavoriteStickers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateSavedAnimationsTypeID: - // Decoding updateSavedAnimations#1084a1c8. - v := UpdateSavedAnimations{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateSavedNotificationSoundsTypeID: - // Decoding updateSavedNotificationSounds#5a6653b4. - v := UpdateSavedNotificationSounds{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateDefaultBackgroundTypeID: - // Decoding updateDefaultBackground#d550952f. - v := UpdateDefaultBackground{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatThemesTypeID: - // Decoding updateChatThemes#98dc58d5. - v := UpdateChatThemes{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateAccentColorsTypeID: - // Decoding updateAccentColors#1316555e. - v := UpdateAccentColors{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateProfileAccentColorsTypeID: - // Decoding updateProfileAccentColors#bf8e7430. - v := UpdateProfileAccentColors{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateLanguagePackStringsTypeID: - // Decoding updateLanguagePackStrings#af87919f. - v := UpdateLanguagePackStrings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateConnectionStateTypeID: - // Decoding updateConnectionState#57939e2e. - v := UpdateConnectionState{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateTermsOfServiceTypeID: - // Decoding updateTermsOfService#b23cc55e. - v := UpdateTermsOfService{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateUnconfirmedSessionTypeID: - // Decoding updateUnconfirmedSession#fea6088c. - v := UpdateUnconfirmedSession{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateAttachmentMenuBotsTypeID: - // Decoding updateAttachmentMenuBots#b6b910c. - v := UpdateAttachmentMenuBots{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateWebAppMessageSentTypeID: - // Decoding updateWebAppMessageSent#58431229. - v := UpdateWebAppMessageSent{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateActiveEmojiReactionsTypeID: - // Decoding updateActiveEmojiReactions#691ffcb7. - v := UpdateActiveEmojiReactions{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateAvailableMessageEffectsTypeID: - // Decoding updateAvailableMessageEffects#a1cb72b9. - v := UpdateAvailableMessageEffects{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateDefaultReactionTypeTypeID: - // Decoding updateDefaultReactionType#4b615105. - v := UpdateDefaultReactionType{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateSavedMessagesTagsTypeID: - // Decoding updateSavedMessagesTags#7386424a. - v := UpdateSavedMessagesTags{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateActiveLiveLocationMessagesTypeID: - // Decoding updateActiveLiveLocationMessages#a20b9b1f. - v := UpdateActiveLiveLocationMessages{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateOwnedStarCountTypeID: - // Decoding updateOwnedStarCount#af7ebf88. - v := UpdateOwnedStarCount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatRevenueAmountTypeID: - // Decoding updateChatRevenueAmount#c6c9bcc4. - v := UpdateChatRevenueAmount{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateStarRevenueStatusTypeID: - // Decoding updateStarRevenueStatus#ef4bfccb. - v := UpdateStarRevenueStatus{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateSpeechRecognitionTrialTypeID: - // Decoding updateSpeechRecognitionTrial#ff4efcc1. - v := UpdateSpeechRecognitionTrial{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateDiceEmojisTypeID: - // Decoding updateDiceEmojis#9d0f91df. - v := UpdateDiceEmojis{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateAnimatedEmojiMessageClickedTypeID: - // Decoding updateAnimatedEmojiMessageClicked#a3167405. - v := UpdateAnimatedEmojiMessageClicked{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateAnimationSearchParametersTypeID: - // Decoding updateAnimationSearchParameters#6016ef01. - v := UpdateAnimationSearchParameters{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateSuggestedActionsTypeID: - // Decoding updateSuggestedActions#c2e5cccb. - v := UpdateSuggestedActions{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateSpeedLimitNotificationTypeID: - // Decoding updateSpeedLimitNotification#c683d868. - v := UpdateSpeedLimitNotification{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateContactCloseBirthdaysTypeID: - // Decoding updateContactCloseBirthdays#c88b98ce. - v := UpdateContactCloseBirthdays{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateAutosaveSettingsTypeID: - // Decoding updateAutosaveSettings#da274f0b. - v := UpdateAutosaveSettings{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateBusinessConnectionTypeID: - // Decoding updateBusinessConnection#8632f476. - v := UpdateBusinessConnection{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewBusinessMessageTypeID: - // Decoding updateNewBusinessMessage#86be4644. - v := UpdateNewBusinessMessage{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateBusinessMessageEditedTypeID: - // Decoding updateBusinessMessageEdited#81a66d89. - v := UpdateBusinessMessageEdited{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateBusinessMessagesDeletedTypeID: - // Decoding updateBusinessMessagesDeleted#e036d3ed. - v := UpdateBusinessMessagesDeleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewInlineQueryTypeID: - // Decoding updateNewInlineQuery#7171bf34. - v := UpdateNewInlineQuery{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewChosenInlineResultTypeID: - // Decoding updateNewChosenInlineResult#cb4c4f5d. - v := UpdateNewChosenInlineResult{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewCallbackQueryTypeID: - // Decoding updateNewCallbackQuery#8964d05e. - v := UpdateNewCallbackQuery{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewInlineCallbackQueryTypeID: - // Decoding updateNewInlineCallbackQuery#ecf934ba. - v := UpdateNewInlineCallbackQuery{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewBusinessCallbackQueryTypeID: - // Decoding updateNewBusinessCallbackQuery#14125364. - v := UpdateNewBusinessCallbackQuery{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewShippingQueryTypeID: - // Decoding updateNewShippingQuery#29584672. - v := UpdateNewShippingQuery{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewPreCheckoutQueryTypeID: - // Decoding updateNewPreCheckoutQuery#2a3871c9. - v := UpdateNewPreCheckoutQuery{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewCustomEventTypeID: - // Decoding updateNewCustomEvent#76dd6a0c. - v := UpdateNewCustomEvent{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewCustomQueryTypeID: - // Decoding updateNewCustomQuery#d702f9a6. - v := UpdateNewCustomQuery{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdatePollTypeID: - // Decoding updatePoll#966b73ca. - v := UpdatePoll{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdatePollAnswerTypeID: - // Decoding updatePollAnswer#b67ac547. - v := UpdatePollAnswer{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatMemberTypeID: - // Decoding updateChatMember#98865bc7. - v := UpdateChatMember{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateNewChatJoinRequestTypeID: - // Decoding updateNewChatJoinRequest#7e48b843. - v := UpdateNewChatJoinRequest{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateChatBoostTypeID: - // Decoding updateChatBoost#50727e24. - v := UpdateChatBoost{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageReactionTypeID: - // Decoding updateMessageReaction#f46c854a. - v := UpdateMessageReaction{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdateMessageReactionsTypeID: - // Decoding updateMessageReactions#bd5618e9. - v := UpdateMessageReactions{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case UpdatePaidMediaPurchasedTypeID: - // Decoding updatePaidMediaPurchased#a410e65b. - v := UpdatePaidMediaPurchased{} - 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)) - } -} - -// DecodeTDLibJSONUpdate implements binary de-serialization for UpdateClass. -func DecodeTDLibJSONUpdate(buf tdjson.Decoder) (UpdateClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "updateAuthorizationState": - // Decoding updateAuthorizationState#60b30ee2. - v := UpdateAuthorizationState{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewMessage": - // Decoding updateNewMessage#de6fb20e. - v := UpdateNewMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageSendAcknowledged": - // Decoding updateMessageSendAcknowledged#4da7d239. - v := UpdateMessageSendAcknowledged{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageSendSucceeded": - // Decoding updateMessageSendSucceeded#6c399d7d. - v := UpdateMessageSendSucceeded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageSendFailed": - // Decoding updateMessageSendFailed#da1bf8e7. - v := UpdateMessageSendFailed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageContent": - // Decoding updateMessageContent#1e36bb24. - v := UpdateMessageContent{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageEdited": - // Decoding updateMessageEdited#dea602e6. - v := UpdateMessageEdited{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageIsPinned": - // Decoding updateMessageIsPinned#41bc233d. - v := UpdateMessageIsPinned{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageInteractionInfo": - // Decoding updateMessageInteractionInfo#ab803bfe. - v := UpdateMessageInteractionInfo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageContentOpened": - // Decoding updateMessageContentOpened#a55ea885. - v := UpdateMessageContentOpened{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageMentionRead": - // Decoding updateMessageMentionRead#f0f74d46. - v := UpdateMessageMentionRead{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageUnreadReactions": - // Decoding updateMessageUnreadReactions#12a7220a. - v := UpdateMessageUnreadReactions{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageFactCheck": - // Decoding updateMessageFactCheck#3c78fb02. - v := UpdateMessageFactCheck{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageLiveLocationViewed": - // Decoding updateMessageLiveLocationViewed#b2058595. - v := UpdateMessageLiveLocationViewed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateVideoPublished": - // Decoding updateVideoPublished#eafc2052. - v := UpdateVideoPublished{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewChat": - // Decoding updateNewChat#7bb98ccd. - v := UpdateNewChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatTitle": - // Decoding updateChatTitle#f58b85a4. - v := UpdateChatTitle{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatPhoto": - // Decoding updateChatPhoto#eca5423f. - v := UpdateChatPhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatAccentColors": - // Decoding updateChatAccentColors#b7b8f8f9. - v := UpdateChatAccentColors{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatPermissions": - // Decoding updateChatPermissions#9f52176d. - v := UpdateChatPermissions{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatLastMessage": - // Decoding updateChatLastMessage#f10cab1d. - v := UpdateChatLastMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatPosition": - // Decoding updateChatPosition#ff76fa77. - v := UpdateChatPosition{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatAddedToList": - // Decoding updateChatAddedToList#ab7004ec. - v := UpdateChatAddedToList{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatRemovedFromList": - // Decoding updateChatRemovedFromList#4d2ac21c. - v := UpdateChatRemovedFromList{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatReadInbox": - // Decoding updateChatReadInbox#d07036e7. - v := UpdateChatReadInbox{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatReadOutbox": - // Decoding updateChatReadOutbox#2a385285. - v := UpdateChatReadOutbox{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatActionBar": - // Decoding updateChatActionBar#d9a258c2. - v := UpdateChatActionBar{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatBusinessBotManageBar": - // Decoding updateChatBusinessBotManageBar#be30e7f7. - v := UpdateChatBusinessBotManageBar{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatAvailableReactions": - // Decoding updateChatAvailableReactions#8ab413f9. - v := UpdateChatAvailableReactions{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatDraftMessage": - // Decoding updateChatDraftMessage#2bf257d4. - v := UpdateChatDraftMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatEmojiStatus": - // Decoding updateChatEmojiStatus#77796510. - v := UpdateChatEmojiStatus{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatMessageSender": - // Decoding updateChatMessageSender#77705241. - v := UpdateChatMessageSender{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatMessageAutoDeleteTime": - // Decoding updateChatMessageAutoDeleteTime#71425de5. - v := UpdateChatMessageAutoDeleteTime{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatNotificationSettings": - // Decoding updateChatNotificationSettings#d020b456. - v := UpdateChatNotificationSettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatPendingJoinRequests": - // Decoding updateChatPendingJoinRequests#14c6e3e1. - v := UpdateChatPendingJoinRequests{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatReplyMarkup": - // Decoding updateChatReplyMarkup#4e0ba5a0. - v := UpdateChatReplyMarkup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatBackground": - // Decoding updateChatBackground#ff9d38b3. - v := UpdateChatBackground{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatTheme": - // Decoding updateChatTheme#31f3d465. - v := UpdateChatTheme{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatUnreadMentionCount": - // Decoding updateChatUnreadMentionCount#80f47b1c. - v := UpdateChatUnreadMentionCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatUnreadReactionCount": - // Decoding updateChatUnreadReactionCount#81603cdd. - v := UpdateChatUnreadReactionCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatVideoChat": - // Decoding updateChatVideoChat#25fb4ca6. - v := UpdateChatVideoChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatDefaultDisableNotification": - // Decoding updateChatDefaultDisableNotification#1ba96a9b. - v := UpdateChatDefaultDisableNotification{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatHasProtectedContent": - // Decoding updateChatHasProtectedContent#6b50071b. - v := UpdateChatHasProtectedContent{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatIsTranslatable": - // Decoding updateChatIsTranslatable#7b031617. - v := UpdateChatIsTranslatable{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatIsMarkedAsUnread": - // Decoding updateChatIsMarkedAsUnread#57853334. - v := UpdateChatIsMarkedAsUnread{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatViewAsTopics": - // Decoding updateChatViewAsTopics#5bff163d. - v := UpdateChatViewAsTopics{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatBlockList": - // Decoding updateChatBlockList#872af48e. - v := UpdateChatBlockList{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatHasScheduledMessages": - // Decoding updateChatHasScheduledMessages#7b14c2d7. - v := UpdateChatHasScheduledMessages{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatFolders": - // Decoding updateChatFolders#e110242a. - v := UpdateChatFolders{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatOnlineMemberCount": - // Decoding updateChatOnlineMemberCount#1d0caa9d. - v := UpdateChatOnlineMemberCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateSavedMessagesTopic": - // Decoding updateSavedMessagesTopic#9f823b30. - v := UpdateSavedMessagesTopic{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateSavedMessagesTopicCount": - // Decoding updateSavedMessagesTopicCount#fbd279d1. - v := UpdateSavedMessagesTopicCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateQuickReplyShortcut": - // Decoding updateQuickReplyShortcut#c69338cf. - v := UpdateQuickReplyShortcut{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateQuickReplyShortcutDeleted": - // Decoding updateQuickReplyShortcutDeleted#e8b9bc3a. - v := UpdateQuickReplyShortcutDeleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateQuickReplyShortcuts": - // Decoding updateQuickReplyShortcuts#77d31a6a. - v := UpdateQuickReplyShortcuts{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateQuickReplyShortcutMessages": - // Decoding updateQuickReplyShortcutMessages#8bb36b72. - v := UpdateQuickReplyShortcutMessages{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateForumTopicInfo": - // Decoding updateForumTopicInfo#6b6f2cc9. - v := UpdateForumTopicInfo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateScopeNotificationSettings": - // Decoding updateScopeNotificationSettings#b83ccb73. - v := UpdateScopeNotificationSettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateReactionNotificationSettings": - // Decoding updateReactionNotificationSettings#e54d17ec. - v := UpdateReactionNotificationSettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNotification": - // Decoding updateNotification#8ee67ed4. - v := UpdateNotification{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNotificationGroup": - // Decoding updateNotificationGroup#96cd9e06. - v := UpdateNotificationGroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateActiveNotifications": - // Decoding updateActiveNotifications#317d80f2. - v := UpdateActiveNotifications{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateHavePendingNotifications": - // Decoding updateHavePendingNotifications#aaee1db. - v := UpdateHavePendingNotifications{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateDeleteMessages": - // Decoding updateDeleteMessages#6a05bf9. - v := UpdateDeleteMessages{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatAction": - // Decoding updateChatAction#9abfd628. - v := UpdateChatAction{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateUserStatus": - // Decoding updateUserStatus#39211211. - v := UpdateUserStatus{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateUser": - // Decoding updateUser#468928f9. - v := UpdateUser{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateBasicGroup": - // Decoding updateBasicGroup#c433c763. - v := UpdateBasicGroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateSupergroup": - // Decoding updateSupergroup#fb6c6524. - v := UpdateSupergroup{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateSecretChat": - // Decoding updateSecretChat#9ca5132b. - v := UpdateSecretChat{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateUserFullInfo": - // Decoding updateUserFullInfo#fcf2cb17. - v := UpdateUserFullInfo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateBasicGroupFullInfo": - // Decoding updateBasicGroupFullInfo#52f66bbf. - v := UpdateBasicGroupFullInfo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateSupergroupFullInfo": - // Decoding updateSupergroupFullInfo#19f5cd0e. - v := UpdateSupergroupFullInfo{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateServiceNotification": - // Decoding updateServiceNotification#4e9895ad. - v := UpdateServiceNotification{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateFile": - // Decoding updateFile#6cd875f. - v := UpdateFile{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateFileGenerationStart": - // Decoding updateFileGenerationStart#cec5eec. - v := UpdateFileGenerationStart{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateFileGenerationStop": - // Decoding updateFileGenerationStop#8f14fdeb. - v := UpdateFileGenerationStop{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateFileDownloads": - // Decoding updateFileDownloads#e8cd12c7. - v := UpdateFileDownloads{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateFileAddedToDownloads": - // Decoding updateFileAddedToDownloads#5ff5921a. - v := UpdateFileAddedToDownloads{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateFileDownload": - // Decoding updateFileDownload#342f83ca. - v := UpdateFileDownload{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateFileRemovedFromDownloads": - // Decoding updateFileRemovedFromDownloads#6e7c14e8. - v := UpdateFileRemovedFromDownloads{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateApplicationVerificationRequired": - // Decoding updateApplicationVerificationRequired#c59c61d7. - v := UpdateApplicationVerificationRequired{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateCall": - // Decoding updateCall#4fb3d0dd. - v := UpdateCall{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateGroupCall": - // Decoding updateGroupCall#30324e00. - v := UpdateGroupCall{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateGroupCallParticipant": - // Decoding updateGroupCallParticipant#d0213cf9. - v := UpdateGroupCallParticipant{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewCallSignalingData": - // Decoding updateNewCallSignalingData#22c98d8d. - v := UpdateNewCallSignalingData{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateUserPrivacySettingRules": - // Decoding updateUserPrivacySettingRules#c99552f6. - v := UpdateUserPrivacySettingRules{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateUnreadMessageCount": - // Decoding updateUnreadMessageCount#4b541c9. - v := UpdateUnreadMessageCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateUnreadChatCount": - // Decoding updateUnreadChatCount#76e19242. - v := UpdateUnreadChatCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateStory": - // Decoding updateStory#1906572f. - v := UpdateStory{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateStoryDeleted": - // Decoding updateStoryDeleted#7007eb9d. - v := UpdateStoryDeleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateStorySendSucceeded": - // Decoding updateStorySendSucceeded#b9269e57. - v := UpdateStorySendSucceeded{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateStorySendFailed": - // Decoding updateStorySendFailed#e046f199. - v := UpdateStorySendFailed{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatActiveStories": - // Decoding updateChatActiveStories#79786c2c. - v := UpdateChatActiveStories{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateStoryListChatCount": - // Decoding updateStoryListChatCount#8833cd3f. - v := UpdateStoryListChatCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateStoryStealthMode": - // Decoding updateStoryStealthMode#6ff7bd1a. - v := UpdateStoryStealthMode{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateOption": - // Decoding updateOption#35b17404. - v := UpdateOption{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateStickerSet": - // Decoding updateStickerSet#70035dcc. - v := UpdateStickerSet{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateInstalledStickerSets": - // Decoding updateInstalledStickerSets#82cd5388. - v := UpdateInstalledStickerSets{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateTrendingStickerSets": - // Decoding updateTrendingStickerSets#4b7a50a7. - v := UpdateTrendingStickerSets{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateRecentStickers": - // Decoding updateRecentStickers#aefdf8dc. - v := UpdateRecentStickers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateFavoriteStickers": - // Decoding updateFavoriteStickers#113f2b6a. - v := UpdateFavoriteStickers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateSavedAnimations": - // Decoding updateSavedAnimations#1084a1c8. - v := UpdateSavedAnimations{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateSavedNotificationSounds": - // Decoding updateSavedNotificationSounds#5a6653b4. - v := UpdateSavedNotificationSounds{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateDefaultBackground": - // Decoding updateDefaultBackground#d550952f. - v := UpdateDefaultBackground{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatThemes": - // Decoding updateChatThemes#98dc58d5. - v := UpdateChatThemes{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateAccentColors": - // Decoding updateAccentColors#1316555e. - v := UpdateAccentColors{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateProfileAccentColors": - // Decoding updateProfileAccentColors#bf8e7430. - v := UpdateProfileAccentColors{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateLanguagePackStrings": - // Decoding updateLanguagePackStrings#af87919f. - v := UpdateLanguagePackStrings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateConnectionState": - // Decoding updateConnectionState#57939e2e. - v := UpdateConnectionState{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateTermsOfService": - // Decoding updateTermsOfService#b23cc55e. - v := UpdateTermsOfService{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateUnconfirmedSession": - // Decoding updateUnconfirmedSession#fea6088c. - v := UpdateUnconfirmedSession{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateAttachmentMenuBots": - // Decoding updateAttachmentMenuBots#b6b910c. - v := UpdateAttachmentMenuBots{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateWebAppMessageSent": - // Decoding updateWebAppMessageSent#58431229. - v := UpdateWebAppMessageSent{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateActiveEmojiReactions": - // Decoding updateActiveEmojiReactions#691ffcb7. - v := UpdateActiveEmojiReactions{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateAvailableMessageEffects": - // Decoding updateAvailableMessageEffects#a1cb72b9. - v := UpdateAvailableMessageEffects{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateDefaultReactionType": - // Decoding updateDefaultReactionType#4b615105. - v := UpdateDefaultReactionType{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateSavedMessagesTags": - // Decoding updateSavedMessagesTags#7386424a. - v := UpdateSavedMessagesTags{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateActiveLiveLocationMessages": - // Decoding updateActiveLiveLocationMessages#a20b9b1f. - v := UpdateActiveLiveLocationMessages{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateOwnedStarCount": - // Decoding updateOwnedStarCount#af7ebf88. - v := UpdateOwnedStarCount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatRevenueAmount": - // Decoding updateChatRevenueAmount#c6c9bcc4. - v := UpdateChatRevenueAmount{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateStarRevenueStatus": - // Decoding updateStarRevenueStatus#ef4bfccb. - v := UpdateStarRevenueStatus{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateSpeechRecognitionTrial": - // Decoding updateSpeechRecognitionTrial#ff4efcc1. - v := UpdateSpeechRecognitionTrial{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateDiceEmojis": - // Decoding updateDiceEmojis#9d0f91df. - v := UpdateDiceEmojis{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateAnimatedEmojiMessageClicked": - // Decoding updateAnimatedEmojiMessageClicked#a3167405. - v := UpdateAnimatedEmojiMessageClicked{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateAnimationSearchParameters": - // Decoding updateAnimationSearchParameters#6016ef01. - v := UpdateAnimationSearchParameters{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateSuggestedActions": - // Decoding updateSuggestedActions#c2e5cccb. - v := UpdateSuggestedActions{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateSpeedLimitNotification": - // Decoding updateSpeedLimitNotification#c683d868. - v := UpdateSpeedLimitNotification{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateContactCloseBirthdays": - // Decoding updateContactCloseBirthdays#c88b98ce. - v := UpdateContactCloseBirthdays{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateAutosaveSettings": - // Decoding updateAutosaveSettings#da274f0b. - v := UpdateAutosaveSettings{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateBusinessConnection": - // Decoding updateBusinessConnection#8632f476. - v := UpdateBusinessConnection{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewBusinessMessage": - // Decoding updateNewBusinessMessage#86be4644. - v := UpdateNewBusinessMessage{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateBusinessMessageEdited": - // Decoding updateBusinessMessageEdited#81a66d89. - v := UpdateBusinessMessageEdited{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateBusinessMessagesDeleted": - // Decoding updateBusinessMessagesDeleted#e036d3ed. - v := UpdateBusinessMessagesDeleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewInlineQuery": - // Decoding updateNewInlineQuery#7171bf34. - v := UpdateNewInlineQuery{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewChosenInlineResult": - // Decoding updateNewChosenInlineResult#cb4c4f5d. - v := UpdateNewChosenInlineResult{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewCallbackQuery": - // Decoding updateNewCallbackQuery#8964d05e. - v := UpdateNewCallbackQuery{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewInlineCallbackQuery": - // Decoding updateNewInlineCallbackQuery#ecf934ba. - v := UpdateNewInlineCallbackQuery{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewBusinessCallbackQuery": - // Decoding updateNewBusinessCallbackQuery#14125364. - v := UpdateNewBusinessCallbackQuery{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewShippingQuery": - // Decoding updateNewShippingQuery#29584672. - v := UpdateNewShippingQuery{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewPreCheckoutQuery": - // Decoding updateNewPreCheckoutQuery#2a3871c9. - v := UpdateNewPreCheckoutQuery{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewCustomEvent": - // Decoding updateNewCustomEvent#76dd6a0c. - v := UpdateNewCustomEvent{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewCustomQuery": - // Decoding updateNewCustomQuery#d702f9a6. - v := UpdateNewCustomQuery{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updatePoll": - // Decoding updatePoll#966b73ca. - v := UpdatePoll{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updatePollAnswer": - // Decoding updatePollAnswer#b67ac547. - v := UpdatePollAnswer{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatMember": - // Decoding updateChatMember#98865bc7. - v := UpdateChatMember{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateNewChatJoinRequest": - // Decoding updateNewChatJoinRequest#7e48b843. - v := UpdateNewChatJoinRequest{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateChatBoost": - // Decoding updateChatBoost#50727e24. - v := UpdateChatBoost{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageReaction": - // Decoding updateMessageReaction#f46c854a. - v := UpdateMessageReaction{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updateMessageReactions": - // Decoding updateMessageReactions#bd5618e9. - v := UpdateMessageReactions{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UpdateClass: %w", err) - } - return &v, nil - case "updatePaidMediaPurchased": - // Decoding updatePaidMediaPurchased#a410e65b. - v := UpdatePaidMediaPurchased{} - if err := v.DecodeTDLibJSON(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", tdjson.NewUnexpectedID(id)) - } -} - -// Update boxes the UpdateClass providing a helper. -type UpdateBox struct { - Update UpdateClass -} - -// Decode implements bin.Decoder for UpdateBox. -func (b *UpdateBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode UpdateBox to nil") - } - v, err := DecodeUpdate(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.Update = v - return nil -} - -// Encode implements bin.Encode for UpdateBox. -func (b *UpdateBox) Encode(buf *bin.Buffer) error { - if b == nil || b.Update == nil { - return fmt.Errorf("unable to encode UpdateClass as nil") - } - return b.Update.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for UpdateBox. -func (b *UpdateBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode UpdateBox to nil") - } - v, err := DecodeTDLibJSONUpdate(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.Update = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for UpdateBox. -func (b *UpdateBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.Update == nil { - return fmt.Errorf("unable to encode UpdateClass as nil") - } - return b.Update.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_updates_gen.go b/tdapi/tl_updates_gen.go deleted file mode 100644 index cd76002d5..000000000 --- a/tdapi/tl_updates_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Updates represents TL type `updates#b9829222`. -type Updates struct { - // List of updates - Updates []UpdateClass -} - -// UpdatesTypeID is TL type id of Updates. -const UpdatesTypeID = 0xb9829222 - -// Ensuring interfaces in compile-time for Updates. -var ( - _ bin.Encoder = &Updates{} - _ bin.Decoder = &Updates{} - _ bin.BareEncoder = &Updates{} - _ bin.BareDecoder = &Updates{} -) - -func (u *Updates) Zero() bool { - if u == nil { - return true - } - if !(u.Updates == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *Updates) String() string { - if u == nil { - return "Updates(nil)" - } - type Alias Updates - return fmt.Sprintf("Updates%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Updates) TypeID() uint32 { - return UpdatesTypeID -} - -// TypeName returns name of type in TL schema. -func (*Updates) TypeName() string { - return "updates" -} - -// TypeInfo returns info about TL type. -func (u *Updates) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "updates", - ID: UpdatesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Updates", - SchemaName: "updates", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *Updates) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updates#b9829222 as nil") - } - b.PutID(UpdatesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *Updates) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode updates#b9829222 as nil") - } - b.PutInt(len(u.Updates)) - for idx, v := range u.Updates { - if v == nil { - return fmt.Errorf("unable to encode updates#b9829222: field updates element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare updates#b9829222: field updates element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *Updates) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updates#b9829222 to nil") - } - if err := b.ConsumeID(UpdatesTypeID); err != nil { - return fmt.Errorf("unable to decode updates#b9829222: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *Updates) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode updates#b9829222 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode updates#b9829222: field updates: %w", err) - } - - if headerLen > 0 { - u.Updates = make([]UpdateClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeUpdate(b) - if err != nil { - return fmt.Errorf("unable to decode updates#b9829222: field updates: %w", err) - } - u.Updates = append(u.Updates, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *Updates) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode updates#b9829222 as nil") - } - b.ObjStart() - b.PutID("updates") - b.Comma() - b.FieldStart("updates") - b.ArrStart() - for idx, v := range u.Updates { - if v == nil { - return fmt.Errorf("unable to encode updates#b9829222: field updates element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode updates#b9829222: field updates element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *Updates) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode updates#b9829222 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("updates"); err != nil { - return fmt.Errorf("unable to decode updates#b9829222: %w", err) - } - case "updates": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONUpdate(b) - if err != nil { - return fmt.Errorf("unable to decode updates#b9829222: field updates: %w", err) - } - u.Updates = append(u.Updates, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode updates#b9829222: field updates: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUpdates returns value of Updates field. -func (u *Updates) GetUpdates() (value []UpdateClass) { - if u == nil { - return - } - return u.Updates -} diff --git a/tdapi/tl_upgrade_basic_group_chat_to_supergroup_chat_gen.go b/tdapi/tl_upgrade_basic_group_chat_to_supergroup_chat_gen.go deleted file mode 100644 index 4fddfa063..000000000 --- a/tdapi/tl_upgrade_basic_group_chat_to_supergroup_chat_gen.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UpgradeBasicGroupChatToSupergroupChatRequest represents TL type `upgradeBasicGroupChatToSupergroupChat#11e915ba`. -type UpgradeBasicGroupChatToSupergroupChatRequest struct { - // Identifier of the chat to upgrade - ChatID int64 -} - -// UpgradeBasicGroupChatToSupergroupChatRequestTypeID is TL type id of UpgradeBasicGroupChatToSupergroupChatRequest. -const UpgradeBasicGroupChatToSupergroupChatRequestTypeID = 0x11e915ba - -// Ensuring interfaces in compile-time for UpgradeBasicGroupChatToSupergroupChatRequest. -var ( - _ bin.Encoder = &UpgradeBasicGroupChatToSupergroupChatRequest{} - _ bin.Decoder = &UpgradeBasicGroupChatToSupergroupChatRequest{} - _ bin.BareEncoder = &UpgradeBasicGroupChatToSupergroupChatRequest{} - _ bin.BareDecoder = &UpgradeBasicGroupChatToSupergroupChatRequest{} -) - -func (u *UpgradeBasicGroupChatToSupergroupChatRequest) Zero() bool { - if u == nil { - return true - } - if !(u.ChatID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpgradeBasicGroupChatToSupergroupChatRequest) String() string { - if u == nil { - return "UpgradeBasicGroupChatToSupergroupChatRequest(nil)" - } - type Alias UpgradeBasicGroupChatToSupergroupChatRequest - return fmt.Sprintf("UpgradeBasicGroupChatToSupergroupChatRequest%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpgradeBasicGroupChatToSupergroupChatRequest) TypeID() uint32 { - return UpgradeBasicGroupChatToSupergroupChatRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpgradeBasicGroupChatToSupergroupChatRequest) TypeName() string { - return "upgradeBasicGroupChatToSupergroupChat" -} - -// TypeInfo returns info about TL type. -func (u *UpgradeBasicGroupChatToSupergroupChatRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "upgradeBasicGroupChatToSupergroupChat", - ID: UpgradeBasicGroupChatToSupergroupChatRequestTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpgradeBasicGroupChatToSupergroupChatRequest) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradeBasicGroupChatToSupergroupChat#11e915ba as nil") - } - b.PutID(UpgradeBasicGroupChatToSupergroupChatRequestTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpgradeBasicGroupChatToSupergroupChatRequest) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradeBasicGroupChatToSupergroupChat#11e915ba as nil") - } - b.PutInt53(u.ChatID) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpgradeBasicGroupChatToSupergroupChatRequest) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradeBasicGroupChatToSupergroupChat#11e915ba to nil") - } - if err := b.ConsumeID(UpgradeBasicGroupChatToSupergroupChatRequestTypeID); err != nil { - return fmt.Errorf("unable to decode upgradeBasicGroupChatToSupergroupChat#11e915ba: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpgradeBasicGroupChatToSupergroupChatRequest) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradeBasicGroupChatToSupergroupChat#11e915ba to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradeBasicGroupChatToSupergroupChat#11e915ba: field chat_id: %w", err) - } - u.ChatID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpgradeBasicGroupChatToSupergroupChatRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode upgradeBasicGroupChatToSupergroupChat#11e915ba as nil") - } - b.ObjStart() - b.PutID("upgradeBasicGroupChatToSupergroupChat") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(u.ChatID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpgradeBasicGroupChatToSupergroupChatRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode upgradeBasicGroupChatToSupergroupChat#11e915ba to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("upgradeBasicGroupChatToSupergroupChat"); err != nil { - return fmt.Errorf("unable to decode upgradeBasicGroupChatToSupergroupChat#11e915ba: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradeBasicGroupChatToSupergroupChat#11e915ba: field chat_id: %w", err) - } - u.ChatID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (u *UpgradeBasicGroupChatToSupergroupChatRequest) GetChatID() (value int64) { - if u == nil { - return - } - return u.ChatID -} - -// UpgradeBasicGroupChatToSupergroupChat invokes method upgradeBasicGroupChatToSupergroupChat#11e915ba returning error if any. -func (c *Client) UpgradeBasicGroupChatToSupergroupChat(ctx context.Context, chatid int64) (*Chat, error) { - var result Chat - - request := &UpgradeBasicGroupChatToSupergroupChatRequest{ - ChatID: chatid, - } - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_upgrade_gift_gen.go b/tdapi/tl_upgrade_gift_gen.go deleted file mode 100644 index 542c008b1..000000000 --- a/tdapi/tl_upgrade_gift_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UpgradeGiftRequest represents TL type `upgradeGift#e0c0953e`. -type UpgradeGiftRequest struct { - // Identifier of the user that sent the gift - SenderUserID int64 - // Identifier of the message with the gift in the chat with the user - MessageID int64 - // Pass true to keep the original gift text, sender and receiver in the upgraded gift - KeepOriginalDetails bool -} - -// UpgradeGiftRequestTypeID is TL type id of UpgradeGiftRequest. -const UpgradeGiftRequestTypeID = 0xe0c0953e - -// Ensuring interfaces in compile-time for UpgradeGiftRequest. -var ( - _ bin.Encoder = &UpgradeGiftRequest{} - _ bin.Decoder = &UpgradeGiftRequest{} - _ bin.BareEncoder = &UpgradeGiftRequest{} - _ bin.BareDecoder = &UpgradeGiftRequest{} -) - -func (u *UpgradeGiftRequest) Zero() bool { - if u == nil { - return true - } - if !(u.SenderUserID == 0) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.KeepOriginalDetails == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpgradeGiftRequest) String() string { - if u == nil { - return "UpgradeGiftRequest(nil)" - } - type Alias UpgradeGiftRequest - return fmt.Sprintf("UpgradeGiftRequest%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpgradeGiftRequest) TypeID() uint32 { - return UpgradeGiftRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpgradeGiftRequest) TypeName() string { - return "upgradeGift" -} - -// TypeInfo returns info about TL type. -func (u *UpgradeGiftRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "upgradeGift", - ID: UpgradeGiftRequestTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "KeepOriginalDetails", - SchemaName: "keep_original_details", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpgradeGiftRequest) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradeGift#e0c0953e as nil") - } - b.PutID(UpgradeGiftRequestTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpgradeGiftRequest) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradeGift#e0c0953e as nil") - } - b.PutInt53(u.SenderUserID) - b.PutInt53(u.MessageID) - b.PutBool(u.KeepOriginalDetails) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpgradeGiftRequest) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradeGift#e0c0953e to nil") - } - if err := b.ConsumeID(UpgradeGiftRequestTypeID); err != nil { - return fmt.Errorf("unable to decode upgradeGift#e0c0953e: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpgradeGiftRequest) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradeGift#e0c0953e to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field sender_user_id: %w", err) - } - u.SenderUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field message_id: %w", err) - } - u.MessageID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field keep_original_details: %w", err) - } - u.KeepOriginalDetails = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpgradeGiftRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode upgradeGift#e0c0953e as nil") - } - b.ObjStart() - b.PutID("upgradeGift") - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(u.SenderUserID) - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("keep_original_details") - b.PutBool(u.KeepOriginalDetails) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpgradeGiftRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode upgradeGift#e0c0953e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("upgradeGift"); err != nil { - return fmt.Errorf("unable to decode upgradeGift#e0c0953e: %w", err) - } - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field sender_user_id: %w", err) - } - u.SenderUserID = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field message_id: %w", err) - } - u.MessageID = value - case "keep_original_details": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode upgradeGift#e0c0953e: field keep_original_details: %w", err) - } - u.KeepOriginalDetails = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderUserID returns value of SenderUserID field. -func (u *UpgradeGiftRequest) GetSenderUserID() (value int64) { - if u == nil { - return - } - return u.SenderUserID -} - -// GetMessageID returns value of MessageID field. -func (u *UpgradeGiftRequest) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetKeepOriginalDetails returns value of KeepOriginalDetails field. -func (u *UpgradeGiftRequest) GetKeepOriginalDetails() (value bool) { - if u == nil { - return - } - return u.KeepOriginalDetails -} - -// UpgradeGift invokes method upgradeGift#e0c0953e returning error if any. -func (c *Client) UpgradeGift(ctx context.Context, request *UpgradeGiftRequest) (*UpgradeGiftResult, error) { - var result UpgradeGiftResult - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_upgrade_gift_result_gen.go b/tdapi/tl_upgrade_gift_result_gen.go deleted file mode 100644 index 1c7679d92..000000000 --- a/tdapi/tl_upgrade_gift_result_gen.go +++ /dev/null @@ -1,330 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UpgradeGiftResult represents TL type `upgradeGiftResult#3d9e8331`. -type UpgradeGiftResult struct { - // The upgraded gift - Gift UpgradedGift - // True, if the gift is displayed on the user's profile page - IsSaved bool - // True, if the gift can be transferred to another user - CanBeTransferred bool - // Number of Telegram Stars that must be paid to transfer the upgraded gift - TransferStarCount int64 - // Point in time (Unix timestamp) when the gift can be transferred to TON blockchain as - // an NFT - ExportDate int32 -} - -// UpgradeGiftResultTypeID is TL type id of UpgradeGiftResult. -const UpgradeGiftResultTypeID = 0x3d9e8331 - -// Ensuring interfaces in compile-time for UpgradeGiftResult. -var ( - _ bin.Encoder = &UpgradeGiftResult{} - _ bin.Decoder = &UpgradeGiftResult{} - _ bin.BareEncoder = &UpgradeGiftResult{} - _ bin.BareDecoder = &UpgradeGiftResult{} -) - -func (u *UpgradeGiftResult) Zero() bool { - if u == nil { - return true - } - if !(u.Gift.Zero()) { - return false - } - if !(u.IsSaved == false) { - return false - } - if !(u.CanBeTransferred == false) { - return false - } - if !(u.TransferStarCount == 0) { - return false - } - if !(u.ExportDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpgradeGiftResult) String() string { - if u == nil { - return "UpgradeGiftResult(nil)" - } - type Alias UpgradeGiftResult - return fmt.Sprintf("UpgradeGiftResult%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpgradeGiftResult) TypeID() uint32 { - return UpgradeGiftResultTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpgradeGiftResult) TypeName() string { - return "upgradeGiftResult" -} - -// TypeInfo returns info about TL type. -func (u *UpgradeGiftResult) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "upgradeGiftResult", - ID: UpgradeGiftResultTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Gift", - SchemaName: "gift", - }, - { - Name: "IsSaved", - SchemaName: "is_saved", - }, - { - Name: "CanBeTransferred", - SchemaName: "can_be_transferred", - }, - { - Name: "TransferStarCount", - SchemaName: "transfer_star_count", - }, - { - Name: "ExportDate", - SchemaName: "export_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpgradeGiftResult) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradeGiftResult#3d9e8331 as nil") - } - b.PutID(UpgradeGiftResultTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpgradeGiftResult) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradeGiftResult#3d9e8331 as nil") - } - if err := u.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode upgradeGiftResult#3d9e8331: field gift: %w", err) - } - b.PutBool(u.IsSaved) - b.PutBool(u.CanBeTransferred) - b.PutInt53(u.TransferStarCount) - b.PutInt32(u.ExportDate) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpgradeGiftResult) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradeGiftResult#3d9e8331 to nil") - } - if err := b.ConsumeID(UpgradeGiftResultTypeID); err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpgradeGiftResult) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradeGiftResult#3d9e8331 to nil") - } - { - if err := u.Gift.Decode(b); err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field gift: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field is_saved: %w", err) - } - u.IsSaved = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field can_be_transferred: %w", err) - } - u.CanBeTransferred = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field transfer_star_count: %w", err) - } - u.TransferStarCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field export_date: %w", err) - } - u.ExportDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpgradeGiftResult) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode upgradeGiftResult#3d9e8331 as nil") - } - b.ObjStart() - b.PutID("upgradeGiftResult") - b.Comma() - b.FieldStart("gift") - if err := u.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode upgradeGiftResult#3d9e8331: field gift: %w", err) - } - b.Comma() - b.FieldStart("is_saved") - b.PutBool(u.IsSaved) - b.Comma() - b.FieldStart("can_be_transferred") - b.PutBool(u.CanBeTransferred) - b.Comma() - b.FieldStart("transfer_star_count") - b.PutInt53(u.TransferStarCount) - b.Comma() - b.FieldStart("export_date") - b.PutInt32(u.ExportDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpgradeGiftResult) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode upgradeGiftResult#3d9e8331 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("upgradeGiftResult"); err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: %w", err) - } - case "gift": - if err := u.Gift.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field gift: %w", err) - } - case "is_saved": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field is_saved: %w", err) - } - u.IsSaved = value - case "can_be_transferred": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field can_be_transferred: %w", err) - } - u.CanBeTransferred = value - case "transfer_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field transfer_star_count: %w", err) - } - u.TransferStarCount = value - case "export_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradeGiftResult#3d9e8331: field export_date: %w", err) - } - u.ExportDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGift returns value of Gift field. -func (u *UpgradeGiftResult) GetGift() (value UpgradedGift) { - if u == nil { - return - } - return u.Gift -} - -// GetIsSaved returns value of IsSaved field. -func (u *UpgradeGiftResult) GetIsSaved() (value bool) { - if u == nil { - return - } - return u.IsSaved -} - -// GetCanBeTransferred returns value of CanBeTransferred field. -func (u *UpgradeGiftResult) GetCanBeTransferred() (value bool) { - if u == nil { - return - } - return u.CanBeTransferred -} - -// GetTransferStarCount returns value of TransferStarCount field. -func (u *UpgradeGiftResult) GetTransferStarCount() (value int64) { - if u == nil { - return - } - return u.TransferStarCount -} - -// GetExportDate returns value of ExportDate field. -func (u *UpgradeGiftResult) GetExportDate() (value int32) { - if u == nil { - return - } - return u.ExportDate -} diff --git a/tdapi/tl_upgraded_gift_backdrop_gen.go b/tdapi/tl_upgraded_gift_backdrop_gen.go deleted file mode 100644 index 4f3848637..000000000 --- a/tdapi/tl_upgraded_gift_backdrop_gen.go +++ /dev/null @@ -1,363 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UpgradedGiftBackdrop represents TL type `upgradedGiftBackdrop#fc371c7e`. -type UpgradedGiftBackdrop struct { - // Name of the backdrop - Name string - // A color in the center of the backdrop in the RGB format - CenterColor int32 - // A color on the edges of the backdrop in the RGB format - EdgeColor int32 - // A color to be applied for the symbol in the RGB format - SymbolColor int32 - // A color for the text on the backdrop in the RGB format - TextColor int32 - // The number of upgraded gift that receive this backdrop for each 1000 gifts upgraded - RarityPerMille int32 -} - -// UpgradedGiftBackdropTypeID is TL type id of UpgradedGiftBackdrop. -const UpgradedGiftBackdropTypeID = 0xfc371c7e - -// Ensuring interfaces in compile-time for UpgradedGiftBackdrop. -var ( - _ bin.Encoder = &UpgradedGiftBackdrop{} - _ bin.Decoder = &UpgradedGiftBackdrop{} - _ bin.BareEncoder = &UpgradedGiftBackdrop{} - _ bin.BareDecoder = &UpgradedGiftBackdrop{} -) - -func (u *UpgradedGiftBackdrop) Zero() bool { - if u == nil { - return true - } - if !(u.Name == "") { - return false - } - if !(u.CenterColor == 0) { - return false - } - if !(u.EdgeColor == 0) { - return false - } - if !(u.SymbolColor == 0) { - return false - } - if !(u.TextColor == 0) { - return false - } - if !(u.RarityPerMille == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpgradedGiftBackdrop) String() string { - if u == nil { - return "UpgradedGiftBackdrop(nil)" - } - type Alias UpgradedGiftBackdrop - return fmt.Sprintf("UpgradedGiftBackdrop%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpgradedGiftBackdrop) TypeID() uint32 { - return UpgradedGiftBackdropTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpgradedGiftBackdrop) TypeName() string { - return "upgradedGiftBackdrop" -} - -// TypeInfo returns info about TL type. -func (u *UpgradedGiftBackdrop) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "upgradedGiftBackdrop", - ID: UpgradedGiftBackdropTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "CenterColor", - SchemaName: "center_color", - }, - { - Name: "EdgeColor", - SchemaName: "edge_color", - }, - { - Name: "SymbolColor", - SchemaName: "symbol_color", - }, - { - Name: "TextColor", - SchemaName: "text_color", - }, - { - Name: "RarityPerMille", - SchemaName: "rarity_per_mille", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpgradedGiftBackdrop) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftBackdrop#fc371c7e as nil") - } - b.PutID(UpgradedGiftBackdropTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpgradedGiftBackdrop) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftBackdrop#fc371c7e as nil") - } - b.PutString(u.Name) - b.PutInt32(u.CenterColor) - b.PutInt32(u.EdgeColor) - b.PutInt32(u.SymbolColor) - b.PutInt32(u.TextColor) - b.PutInt32(u.RarityPerMille) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpgradedGiftBackdrop) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftBackdrop#fc371c7e to nil") - } - if err := b.ConsumeID(UpgradedGiftBackdropTypeID); err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpgradedGiftBackdrop) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftBackdrop#fc371c7e to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field name: %w", err) - } - u.Name = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field center_color: %w", err) - } - u.CenterColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field edge_color: %w", err) - } - u.EdgeColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field symbol_color: %w", err) - } - u.SymbolColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field text_color: %w", err) - } - u.TextColor = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field rarity_per_mille: %w", err) - } - u.RarityPerMille = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpgradedGiftBackdrop) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftBackdrop#fc371c7e as nil") - } - b.ObjStart() - b.PutID("upgradedGiftBackdrop") - b.Comma() - b.FieldStart("name") - b.PutString(u.Name) - b.Comma() - b.FieldStart("center_color") - b.PutInt32(u.CenterColor) - b.Comma() - b.FieldStart("edge_color") - b.PutInt32(u.EdgeColor) - b.Comma() - b.FieldStart("symbol_color") - b.PutInt32(u.SymbolColor) - b.Comma() - b.FieldStart("text_color") - b.PutInt32(u.TextColor) - b.Comma() - b.FieldStart("rarity_per_mille") - b.PutInt32(u.RarityPerMille) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpgradedGiftBackdrop) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftBackdrop#fc371c7e to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("upgradedGiftBackdrop"); err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field name: %w", err) - } - u.Name = value - case "center_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field center_color: %w", err) - } - u.CenterColor = value - case "edge_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field edge_color: %w", err) - } - u.EdgeColor = value - case "symbol_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field symbol_color: %w", err) - } - u.SymbolColor = value - case "text_color": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field text_color: %w", err) - } - u.TextColor = value - case "rarity_per_mille": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftBackdrop#fc371c7e: field rarity_per_mille: %w", err) - } - u.RarityPerMille = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (u *UpgradedGiftBackdrop) GetName() (value string) { - if u == nil { - return - } - return u.Name -} - -// GetCenterColor returns value of CenterColor field. -func (u *UpgradedGiftBackdrop) GetCenterColor() (value int32) { - if u == nil { - return - } - return u.CenterColor -} - -// GetEdgeColor returns value of EdgeColor field. -func (u *UpgradedGiftBackdrop) GetEdgeColor() (value int32) { - if u == nil { - return - } - return u.EdgeColor -} - -// GetSymbolColor returns value of SymbolColor field. -func (u *UpgradedGiftBackdrop) GetSymbolColor() (value int32) { - if u == nil { - return - } - return u.SymbolColor -} - -// GetTextColor returns value of TextColor field. -func (u *UpgradedGiftBackdrop) GetTextColor() (value int32) { - if u == nil { - return - } - return u.TextColor -} - -// GetRarityPerMille returns value of RarityPerMille field. -func (u *UpgradedGiftBackdrop) GetRarityPerMille() (value int32) { - if u == nil { - return - } - return u.RarityPerMille -} diff --git a/tdapi/tl_upgraded_gift_gen.go b/tdapi/tl_upgraded_gift_gen.go deleted file mode 100644 index 31453be9c..000000000 --- a/tdapi/tl_upgraded_gift_gen.go +++ /dev/null @@ -1,499 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UpgradedGift represents TL type `upgradedGift#e5f50e98`. -type UpgradedGift struct { - // Unique identifier of the gift - ID int64 - // The title of the upgraded gift - Title string - // Unique number of the upgraded gift among gifts upgraded from the same gift - Number int32 - // Total number of gifts that were upgraded from the same gift - TotalUpgradedCount int32 - // The maximum number of gifts that can be upgraded from the same gift - MaxUpgradedCount int32 - // User identifier of the user that owns the upgraded gift; 0 if none - OwnerUserID int64 - // Model of the upgraded gift - Model UpgradedGiftModel - // Symbol of the upgraded gift - Symbol UpgradedGiftSymbol - // Backdrop of the upgraded gift - Backdrop UpgradedGiftBackdrop - // Information about the originally sent gift; may be null if unknown - OriginalDetails UpgradedGiftOriginalDetails -} - -// UpgradedGiftTypeID is TL type id of UpgradedGift. -const UpgradedGiftTypeID = 0xe5f50e98 - -// Ensuring interfaces in compile-time for UpgradedGift. -var ( - _ bin.Encoder = &UpgradedGift{} - _ bin.Decoder = &UpgradedGift{} - _ bin.BareEncoder = &UpgradedGift{} - _ bin.BareDecoder = &UpgradedGift{} -) - -func (u *UpgradedGift) Zero() bool { - if u == nil { - return true - } - if !(u.ID == 0) { - return false - } - if !(u.Title == "") { - return false - } - if !(u.Number == 0) { - return false - } - if !(u.TotalUpgradedCount == 0) { - return false - } - if !(u.MaxUpgradedCount == 0) { - return false - } - if !(u.OwnerUserID == 0) { - return false - } - if !(u.Model.Zero()) { - return false - } - if !(u.Symbol.Zero()) { - return false - } - if !(u.Backdrop.Zero()) { - return false - } - if !(u.OriginalDetails.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpgradedGift) String() string { - if u == nil { - return "UpgradedGift(nil)" - } - type Alias UpgradedGift - return fmt.Sprintf("UpgradedGift%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpgradedGift) TypeID() uint32 { - return UpgradedGiftTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpgradedGift) TypeName() string { - return "upgradedGift" -} - -// TypeInfo returns info about TL type. -func (u *UpgradedGift) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "upgradedGift", - ID: UpgradedGiftTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Number", - SchemaName: "number", - }, - { - Name: "TotalUpgradedCount", - SchemaName: "total_upgraded_count", - }, - { - Name: "MaxUpgradedCount", - SchemaName: "max_upgraded_count", - }, - { - Name: "OwnerUserID", - SchemaName: "owner_user_id", - }, - { - Name: "Model", - SchemaName: "model", - }, - { - Name: "Symbol", - SchemaName: "symbol", - }, - { - Name: "Backdrop", - SchemaName: "backdrop", - }, - { - Name: "OriginalDetails", - SchemaName: "original_details", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpgradedGift) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGift#e5f50e98 as nil") - } - b.PutID(UpgradedGiftTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpgradedGift) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGift#e5f50e98 as nil") - } - b.PutLong(u.ID) - b.PutString(u.Title) - b.PutInt32(u.Number) - b.PutInt32(u.TotalUpgradedCount) - b.PutInt32(u.MaxUpgradedCount) - b.PutInt53(u.OwnerUserID) - if err := u.Model.Encode(b); err != nil { - return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field model: %w", err) - } - if err := u.Symbol.Encode(b); err != nil { - return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field symbol: %w", err) - } - if err := u.Backdrop.Encode(b); err != nil { - return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field backdrop: %w", err) - } - if err := u.OriginalDetails.Encode(b); err != nil { - return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field original_details: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UpgradedGift) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGift#e5f50e98 to nil") - } - if err := b.ConsumeID(UpgradedGiftTypeID); err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpgradedGift) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGift#e5f50e98 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field id: %w", err) - } - u.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field title: %w", err) - } - u.Title = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field number: %w", err) - } - u.Number = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field total_upgraded_count: %w", err) - } - u.TotalUpgradedCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field max_upgraded_count: %w", err) - } - u.MaxUpgradedCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field owner_user_id: %w", err) - } - u.OwnerUserID = value - } - { - if err := u.Model.Decode(b); err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field model: %w", err) - } - } - { - if err := u.Symbol.Decode(b); err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field symbol: %w", err) - } - } - { - if err := u.Backdrop.Decode(b); err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field backdrop: %w", err) - } - } - { - if err := u.OriginalDetails.Decode(b); err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field original_details: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpgradedGift) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGift#e5f50e98 as nil") - } - b.ObjStart() - b.PutID("upgradedGift") - b.Comma() - b.FieldStart("id") - b.PutLong(u.ID) - b.Comma() - b.FieldStart("title") - b.PutString(u.Title) - b.Comma() - b.FieldStart("number") - b.PutInt32(u.Number) - b.Comma() - b.FieldStart("total_upgraded_count") - b.PutInt32(u.TotalUpgradedCount) - b.Comma() - b.FieldStart("max_upgraded_count") - b.PutInt32(u.MaxUpgradedCount) - b.Comma() - b.FieldStart("owner_user_id") - b.PutInt53(u.OwnerUserID) - b.Comma() - b.FieldStart("model") - if err := u.Model.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field model: %w", err) - } - b.Comma() - b.FieldStart("symbol") - if err := u.Symbol.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field symbol: %w", err) - } - b.Comma() - b.FieldStart("backdrop") - if err := u.Backdrop.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field backdrop: %w", err) - } - b.Comma() - b.FieldStart("original_details") - if err := u.OriginalDetails.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode upgradedGift#e5f50e98: field original_details: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpgradedGift) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGift#e5f50e98 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("upgradedGift"); err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: %w", err) - } - case "id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field id: %w", err) - } - u.ID = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field title: %w", err) - } - u.Title = value - case "number": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field number: %w", err) - } - u.Number = value - case "total_upgraded_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field total_upgraded_count: %w", err) - } - u.TotalUpgradedCount = value - case "max_upgraded_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field max_upgraded_count: %w", err) - } - u.MaxUpgradedCount = value - case "owner_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field owner_user_id: %w", err) - } - u.OwnerUserID = value - case "model": - if err := u.Model.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field model: %w", err) - } - case "symbol": - if err := u.Symbol.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field symbol: %w", err) - } - case "backdrop": - if err := u.Backdrop.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field backdrop: %w", err) - } - case "original_details": - if err := u.OriginalDetails.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode upgradedGift#e5f50e98: field original_details: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (u *UpgradedGift) GetID() (value int64) { - if u == nil { - return - } - return u.ID -} - -// GetTitle returns value of Title field. -func (u *UpgradedGift) GetTitle() (value string) { - if u == nil { - return - } - return u.Title -} - -// GetNumber returns value of Number field. -func (u *UpgradedGift) GetNumber() (value int32) { - if u == nil { - return - } - return u.Number -} - -// GetTotalUpgradedCount returns value of TotalUpgradedCount field. -func (u *UpgradedGift) GetTotalUpgradedCount() (value int32) { - if u == nil { - return - } - return u.TotalUpgradedCount -} - -// GetMaxUpgradedCount returns value of MaxUpgradedCount field. -func (u *UpgradedGift) GetMaxUpgradedCount() (value int32) { - if u == nil { - return - } - return u.MaxUpgradedCount -} - -// GetOwnerUserID returns value of OwnerUserID field. -func (u *UpgradedGift) GetOwnerUserID() (value int64) { - if u == nil { - return - } - return u.OwnerUserID -} - -// GetModel returns value of Model field. -func (u *UpgradedGift) GetModel() (value UpgradedGiftModel) { - if u == nil { - return - } - return u.Model -} - -// GetSymbol returns value of Symbol field. -func (u *UpgradedGift) GetSymbol() (value UpgradedGiftSymbol) { - if u == nil { - return - } - return u.Symbol -} - -// GetBackdrop returns value of Backdrop field. -func (u *UpgradedGift) GetBackdrop() (value UpgradedGiftBackdrop) { - if u == nil { - return - } - return u.Backdrop -} - -// GetOriginalDetails returns value of OriginalDetails field. -func (u *UpgradedGift) GetOriginalDetails() (value UpgradedGiftOriginalDetails) { - if u == nil { - return - } - return u.OriginalDetails -} diff --git a/tdapi/tl_upgraded_gift_model_gen.go b/tdapi/tl_upgraded_gift_model_gen.go deleted file mode 100644 index 4178585da..000000000 --- a/tdapi/tl_upgraded_gift_model_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UpgradedGiftModel represents TL type `upgradedGiftModel#5112584f`. -type UpgradedGiftModel struct { - // Name of the model - Name string - // The sticker representing the upgraded gift - Sticker Sticker - // The number of upgraded gift that receive this model for each 1000 gifts upgraded - RarityPerMille int32 -} - -// UpgradedGiftModelTypeID is TL type id of UpgradedGiftModel. -const UpgradedGiftModelTypeID = 0x5112584f - -// Ensuring interfaces in compile-time for UpgradedGiftModel. -var ( - _ bin.Encoder = &UpgradedGiftModel{} - _ bin.Decoder = &UpgradedGiftModel{} - _ bin.BareEncoder = &UpgradedGiftModel{} - _ bin.BareDecoder = &UpgradedGiftModel{} -) - -func (u *UpgradedGiftModel) Zero() bool { - if u == nil { - return true - } - if !(u.Name == "") { - return false - } - if !(u.Sticker.Zero()) { - return false - } - if !(u.RarityPerMille == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpgradedGiftModel) String() string { - if u == nil { - return "UpgradedGiftModel(nil)" - } - type Alias UpgradedGiftModel - return fmt.Sprintf("UpgradedGiftModel%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpgradedGiftModel) TypeID() uint32 { - return UpgradedGiftModelTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpgradedGiftModel) TypeName() string { - return "upgradedGiftModel" -} - -// TypeInfo returns info about TL type. -func (u *UpgradedGiftModel) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "upgradedGiftModel", - ID: UpgradedGiftModelTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "RarityPerMille", - SchemaName: "rarity_per_mille", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpgradedGiftModel) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftModel#5112584f as nil") - } - b.PutID(UpgradedGiftModelTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpgradedGiftModel) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftModel#5112584f as nil") - } - b.PutString(u.Name) - if err := u.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode upgradedGiftModel#5112584f: field sticker: %w", err) - } - b.PutInt32(u.RarityPerMille) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpgradedGiftModel) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftModel#5112584f to nil") - } - if err := b.ConsumeID(UpgradedGiftModelTypeID); err != nil { - return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpgradedGiftModel) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftModel#5112584f to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field name: %w", err) - } - u.Name = value - } - { - if err := u.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field sticker: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field rarity_per_mille: %w", err) - } - u.RarityPerMille = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpgradedGiftModel) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftModel#5112584f as nil") - } - b.ObjStart() - b.PutID("upgradedGiftModel") - b.Comma() - b.FieldStart("name") - b.PutString(u.Name) - b.Comma() - b.FieldStart("sticker") - if err := u.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode upgradedGiftModel#5112584f: field sticker: %w", err) - } - b.Comma() - b.FieldStart("rarity_per_mille") - b.PutInt32(u.RarityPerMille) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpgradedGiftModel) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftModel#5112584f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("upgradedGiftModel"); err != nil { - return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field name: %w", err) - } - u.Name = value - case "sticker": - if err := u.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field sticker: %w", err) - } - case "rarity_per_mille": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftModel#5112584f: field rarity_per_mille: %w", err) - } - u.RarityPerMille = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (u *UpgradedGiftModel) GetName() (value string) { - if u == nil { - return - } - return u.Name -} - -// GetSticker returns value of Sticker field. -func (u *UpgradedGiftModel) GetSticker() (value Sticker) { - if u == nil { - return - } - return u.Sticker -} - -// GetRarityPerMille returns value of RarityPerMille field. -func (u *UpgradedGiftModel) GetRarityPerMille() (value int32) { - if u == nil { - return - } - return u.RarityPerMille -} diff --git a/tdapi/tl_upgraded_gift_original_details_gen.go b/tdapi/tl_upgraded_gift_original_details_gen.go deleted file mode 100644 index 5e6ead7b9..000000000 --- a/tdapi/tl_upgraded_gift_original_details_gen.go +++ /dev/null @@ -1,295 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UpgradedGiftOriginalDetails represents TL type `upgradedGiftOriginalDetails#44d2b2dd`. -type UpgradedGiftOriginalDetails struct { - // Identifier of the user that sent the gift; 0 if the gift was private - SenderUserID int64 - // Identifier of the user that received the gift - ReceiverUserID int64 - // Message added to the gift - Text FormattedText - // Point in time (Unix timestamp) when the gift was sent - Date int32 -} - -// UpgradedGiftOriginalDetailsTypeID is TL type id of UpgradedGiftOriginalDetails. -const UpgradedGiftOriginalDetailsTypeID = 0x44d2b2dd - -// Ensuring interfaces in compile-time for UpgradedGiftOriginalDetails. -var ( - _ bin.Encoder = &UpgradedGiftOriginalDetails{} - _ bin.Decoder = &UpgradedGiftOriginalDetails{} - _ bin.BareEncoder = &UpgradedGiftOriginalDetails{} - _ bin.BareDecoder = &UpgradedGiftOriginalDetails{} -) - -func (u *UpgradedGiftOriginalDetails) Zero() bool { - if u == nil { - return true - } - if !(u.SenderUserID == 0) { - return false - } - if !(u.ReceiverUserID == 0) { - return false - } - if !(u.Text.Zero()) { - return false - } - if !(u.Date == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpgradedGiftOriginalDetails) String() string { - if u == nil { - return "UpgradedGiftOriginalDetails(nil)" - } - type Alias UpgradedGiftOriginalDetails - return fmt.Sprintf("UpgradedGiftOriginalDetails%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpgradedGiftOriginalDetails) TypeID() uint32 { - return UpgradedGiftOriginalDetailsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpgradedGiftOriginalDetails) TypeName() string { - return "upgradedGiftOriginalDetails" -} - -// TypeInfo returns info about TL type. -func (u *UpgradedGiftOriginalDetails) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "upgradedGiftOriginalDetails", - ID: UpgradedGiftOriginalDetailsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "ReceiverUserID", - SchemaName: "receiver_user_id", - }, - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "Date", - SchemaName: "date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpgradedGiftOriginalDetails) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftOriginalDetails#44d2b2dd as nil") - } - b.PutID(UpgradedGiftOriginalDetailsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpgradedGiftOriginalDetails) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftOriginalDetails#44d2b2dd as nil") - } - b.PutInt53(u.SenderUserID) - b.PutInt53(u.ReceiverUserID) - if err := u.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode upgradedGiftOriginalDetails#44d2b2dd: field text: %w", err) - } - b.PutInt32(u.Date) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpgradedGiftOriginalDetails) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftOriginalDetails#44d2b2dd to nil") - } - if err := b.ConsumeID(UpgradedGiftOriginalDetailsTypeID); err != nil { - return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpgradedGiftOriginalDetails) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftOriginalDetails#44d2b2dd to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field sender_user_id: %w", err) - } - u.SenderUserID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field receiver_user_id: %w", err) - } - u.ReceiverUserID = value - } - { - if err := u.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field text: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field date: %w", err) - } - u.Date = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpgradedGiftOriginalDetails) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftOriginalDetails#44d2b2dd as nil") - } - b.ObjStart() - b.PutID("upgradedGiftOriginalDetails") - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(u.SenderUserID) - b.Comma() - b.FieldStart("receiver_user_id") - b.PutInt53(u.ReceiverUserID) - b.Comma() - b.FieldStart("text") - if err := u.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode upgradedGiftOriginalDetails#44d2b2dd: field text: %w", err) - } - b.Comma() - b.FieldStart("date") - b.PutInt32(u.Date) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpgradedGiftOriginalDetails) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftOriginalDetails#44d2b2dd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("upgradedGiftOriginalDetails"); err != nil { - return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: %w", err) - } - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field sender_user_id: %w", err) - } - u.SenderUserID = value - case "receiver_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field receiver_user_id: %w", err) - } - u.ReceiverUserID = value - case "text": - if err := u.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field text: %w", err) - } - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftOriginalDetails#44d2b2dd: field date: %w", err) - } - u.Date = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderUserID returns value of SenderUserID field. -func (u *UpgradedGiftOriginalDetails) GetSenderUserID() (value int64) { - if u == nil { - return - } - return u.SenderUserID -} - -// GetReceiverUserID returns value of ReceiverUserID field. -func (u *UpgradedGiftOriginalDetails) GetReceiverUserID() (value int64) { - if u == nil { - return - } - return u.ReceiverUserID -} - -// GetText returns value of Text field. -func (u *UpgradedGiftOriginalDetails) GetText() (value FormattedText) { - if u == nil { - return - } - return u.Text -} - -// GetDate returns value of Date field. -func (u *UpgradedGiftOriginalDetails) GetDate() (value int32) { - if u == nil { - return - } - return u.Date -} diff --git a/tdapi/tl_upgraded_gift_symbol_gen.go b/tdapi/tl_upgraded_gift_symbol_gen.go deleted file mode 100644 index 601305aaa..000000000 --- a/tdapi/tl_upgraded_gift_symbol_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UpgradedGiftSymbol represents TL type `upgradedGiftSymbol#4340c5af`. -type UpgradedGiftSymbol struct { - // Name of the symbol - Name string - // The sticker representing the upgraded gift - Sticker Sticker - // The number of upgraded gift that receive this symbol for each 1000 gifts upgraded - RarityPerMille int32 -} - -// UpgradedGiftSymbolTypeID is TL type id of UpgradedGiftSymbol. -const UpgradedGiftSymbolTypeID = 0x4340c5af - -// Ensuring interfaces in compile-time for UpgradedGiftSymbol. -var ( - _ bin.Encoder = &UpgradedGiftSymbol{} - _ bin.Decoder = &UpgradedGiftSymbol{} - _ bin.BareEncoder = &UpgradedGiftSymbol{} - _ bin.BareDecoder = &UpgradedGiftSymbol{} -) - -func (u *UpgradedGiftSymbol) Zero() bool { - if u == nil { - return true - } - if !(u.Name == "") { - return false - } - if !(u.Sticker.Zero()) { - return false - } - if !(u.RarityPerMille == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UpgradedGiftSymbol) String() string { - if u == nil { - return "UpgradedGiftSymbol(nil)" - } - type Alias UpgradedGiftSymbol - return fmt.Sprintf("UpgradedGiftSymbol%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UpgradedGiftSymbol) TypeID() uint32 { - return UpgradedGiftSymbolTypeID -} - -// TypeName returns name of type in TL schema. -func (*UpgradedGiftSymbol) TypeName() string { - return "upgradedGiftSymbol" -} - -// TypeInfo returns info about TL type. -func (u *UpgradedGiftSymbol) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "upgradedGiftSymbol", - ID: UpgradedGiftSymbolTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Name", - SchemaName: "name", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - { - Name: "RarityPerMille", - SchemaName: "rarity_per_mille", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UpgradedGiftSymbol) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftSymbol#4340c5af as nil") - } - b.PutID(UpgradedGiftSymbolTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UpgradedGiftSymbol) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftSymbol#4340c5af as nil") - } - b.PutString(u.Name) - if err := u.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode upgradedGiftSymbol#4340c5af: field sticker: %w", err) - } - b.PutInt32(u.RarityPerMille) - return nil -} - -// Decode implements bin.Decoder. -func (u *UpgradedGiftSymbol) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftSymbol#4340c5af to nil") - } - if err := b.ConsumeID(UpgradedGiftSymbolTypeID); err != nil { - return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UpgradedGiftSymbol) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftSymbol#4340c5af to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field name: %w", err) - } - u.Name = value - } - { - if err := u.Sticker.Decode(b); err != nil { - return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field sticker: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field rarity_per_mille: %w", err) - } - u.RarityPerMille = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UpgradedGiftSymbol) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode upgradedGiftSymbol#4340c5af as nil") - } - b.ObjStart() - b.PutID("upgradedGiftSymbol") - b.Comma() - b.FieldStart("name") - b.PutString(u.Name) - b.Comma() - b.FieldStart("sticker") - if err := u.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode upgradedGiftSymbol#4340c5af: field sticker: %w", err) - } - b.Comma() - b.FieldStart("rarity_per_mille") - b.PutInt32(u.RarityPerMille) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UpgradedGiftSymbol) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode upgradedGiftSymbol#4340c5af to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("upgradedGiftSymbol"); err != nil { - return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: %w", err) - } - case "name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field name: %w", err) - } - u.Name = value - case "sticker": - if err := u.Sticker.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field sticker: %w", err) - } - case "rarity_per_mille": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode upgradedGiftSymbol#4340c5af: field rarity_per_mille: %w", err) - } - u.RarityPerMille = value - default: - return b.Skip() - } - return nil - }) -} - -// GetName returns value of Name field. -func (u *UpgradedGiftSymbol) GetName() (value string) { - if u == nil { - return - } - return u.Name -} - -// GetSticker returns value of Sticker field. -func (u *UpgradedGiftSymbol) GetSticker() (value Sticker) { - if u == nil { - return - } - return u.Sticker -} - -// GetRarityPerMille returns value of RarityPerMille field. -func (u *UpgradedGiftSymbol) GetRarityPerMille() (value int32) { - if u == nil { - return - } - return u.RarityPerMille -} diff --git a/tdapi/tl_upload_sticker_file_gen.go b/tdapi/tl_upload_sticker_file_gen.go deleted file mode 100644 index f1eb81deb..000000000 --- a/tdapi/tl_upload_sticker_file_gen.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UploadStickerFileRequest represents TL type `uploadStickerFile#269650c3`. -type UploadStickerFileRequest struct { - // Sticker file owner; ignored for regular users - UserID int64 - // Sticker format - StickerFormat StickerFormatClass - // File file to upload; must fit in a 512x512 square. For WEBP stickers the file must be - // in WEBP or PNG format, which will be converted to WEBP server-side. - Sticker InputFileClass -} - -// UploadStickerFileRequestTypeID is TL type id of UploadStickerFileRequest. -const UploadStickerFileRequestTypeID = 0x269650c3 - -// Ensuring interfaces in compile-time for UploadStickerFileRequest. -var ( - _ bin.Encoder = &UploadStickerFileRequest{} - _ bin.Decoder = &UploadStickerFileRequest{} - _ bin.BareEncoder = &UploadStickerFileRequest{} - _ bin.BareDecoder = &UploadStickerFileRequest{} -) - -func (u *UploadStickerFileRequest) Zero() bool { - if u == nil { - return true - } - if !(u.UserID == 0) { - return false - } - if !(u.StickerFormat == nil) { - return false - } - if !(u.Sticker == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UploadStickerFileRequest) String() string { - if u == nil { - return "UploadStickerFileRequest(nil)" - } - type Alias UploadStickerFileRequest - return fmt.Sprintf("UploadStickerFileRequest%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UploadStickerFileRequest) TypeID() uint32 { - return UploadStickerFileRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*UploadStickerFileRequest) TypeName() string { - return "uploadStickerFile" -} - -// TypeInfo returns info about TL type. -func (u *UploadStickerFileRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "uploadStickerFile", - ID: UploadStickerFileRequestTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserID", - SchemaName: "user_id", - }, - { - Name: "StickerFormat", - SchemaName: "sticker_format", - }, - { - Name: "Sticker", - SchemaName: "sticker", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UploadStickerFileRequest) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode uploadStickerFile#269650c3 as nil") - } - b.PutID(UploadStickerFileRequestTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UploadStickerFileRequest) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode uploadStickerFile#269650c3 as nil") - } - b.PutInt53(u.UserID) - if u.StickerFormat == nil { - return fmt.Errorf("unable to encode uploadStickerFile#269650c3: field sticker_format is nil") - } - if err := u.StickerFormat.Encode(b); err != nil { - return fmt.Errorf("unable to encode uploadStickerFile#269650c3: field sticker_format: %w", err) - } - if u.Sticker == nil { - return fmt.Errorf("unable to encode uploadStickerFile#269650c3: field sticker is nil") - } - if err := u.Sticker.Encode(b); err != nil { - return fmt.Errorf("unable to encode uploadStickerFile#269650c3: field sticker: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UploadStickerFileRequest) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode uploadStickerFile#269650c3 to nil") - } - if err := b.ConsumeID(UploadStickerFileRequestTypeID); err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#269650c3: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UploadStickerFileRequest) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode uploadStickerFile#269650c3 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#269650c3: field user_id: %w", err) - } - u.UserID = value - } - { - value, err := DecodeStickerFormat(b) - if err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#269650c3: field sticker_format: %w", err) - } - u.StickerFormat = value - } - { - value, err := DecodeInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#269650c3: field sticker: %w", err) - } - u.Sticker = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UploadStickerFileRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode uploadStickerFile#269650c3 as nil") - } - b.ObjStart() - b.PutID("uploadStickerFile") - b.Comma() - b.FieldStart("user_id") - b.PutInt53(u.UserID) - b.Comma() - b.FieldStart("sticker_format") - if u.StickerFormat == nil { - return fmt.Errorf("unable to encode uploadStickerFile#269650c3: field sticker_format is nil") - } - if err := u.StickerFormat.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode uploadStickerFile#269650c3: field sticker_format: %w", err) - } - b.Comma() - b.FieldStart("sticker") - if u.Sticker == nil { - return fmt.Errorf("unable to encode uploadStickerFile#269650c3: field sticker is nil") - } - if err := u.Sticker.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode uploadStickerFile#269650c3: field sticker: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UploadStickerFileRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode uploadStickerFile#269650c3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("uploadStickerFile"); err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#269650c3: %w", err) - } - case "user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#269650c3: field user_id: %w", err) - } - u.UserID = value - case "sticker_format": - value, err := DecodeTDLibJSONStickerFormat(b) - if err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#269650c3: field sticker_format: %w", err) - } - u.StickerFormat = value - case "sticker": - value, err := DecodeTDLibJSONInputFile(b) - if err != nil { - return fmt.Errorf("unable to decode uploadStickerFile#269650c3: field sticker: %w", err) - } - u.Sticker = value - default: - return b.Skip() - } - return nil - }) -} - -// GetUserID returns value of UserID field. -func (u *UploadStickerFileRequest) GetUserID() (value int64) { - if u == nil { - return - } - return u.UserID -} - -// GetStickerFormat returns value of StickerFormat field. -func (u *UploadStickerFileRequest) GetStickerFormat() (value StickerFormatClass) { - if u == nil { - return - } - return u.StickerFormat -} - -// GetSticker returns value of Sticker field. -func (u *UploadStickerFileRequest) GetSticker() (value InputFileClass) { - if u == nil { - return - } - return u.Sticker -} - -// UploadStickerFile invokes method uploadStickerFile#269650c3 returning error if any. -func (c *Client) UploadStickerFile(ctx context.Context, request *UploadStickerFileRequest) (*File, error) { - var result File - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_user_full_info_gen.go b/tdapi/tl_user_full_info_gen.go deleted file mode 100644 index 3b767fa21..000000000 --- a/tdapi/tl_user_full_info_gen.go +++ /dev/null @@ -1,891 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UserFullInfo represents TL type `userFullInfo#ae9201c2`. -type UserFullInfo struct { - // User profile photo set by the current user for the contact; may be null. If null and - // user.profile_photo is null, then the photo is empty; otherwise, it is unknown. - PersonalPhoto ChatPhoto - // User profile photo; may be null. If null and user.profile_photo is null, then the - // photo is empty; otherwise, it is unknown. - Photo ChatPhoto - // User profile photo visible if the main photo is hidden by privacy settings; may be - // null. If null and user.profile_photo is null, then the photo is empty; otherwise, it - // is unknown. - PublicPhoto ChatPhoto - // Block list to which the user is added; may be null if none - BlockList BlockListClass - // True, if the user can be called - CanBeCalled bool - // True, if a video call can be created with the user - SupportsVideoCalls bool - // True, if the user can't be called due to their privacy settings - HasPrivateCalls bool - // True, if the user can't be linked in forwarded messages due to their privacy settings - HasPrivateForwards bool - // True, if voice and video notes can't be sent or forwarded to the user - HasRestrictedVoiceAndVideoNoteMessages bool - // True, if the user has posted to profile stories - HasPostedToProfileStories bool - // True, if the user always enabled sponsored messages; known only for the current user - HasSponsoredMessagesEnabled bool - // True, if the current user needs to explicitly allow to share their phone number with - // the user when the method addContact is used - NeedPhoneNumberPrivacyException bool - // True, if the user set chat background for both chat users and it wasn't reverted yet - SetChatBackground bool - // A short user bio; may be null for bots - Bio FormattedText - // Birthdate of the user; may be null if unknown - Birthdate Birthdate - // Identifier of the personal chat of the user; 0 if none - PersonalChatID int64 - // Number of gifts saved to profile by the user - GiftCount int32 - // Number of group chats where both the other user and the current user are a member; 0 - // for the current user - GroupInCommonCount int32 - // Information about verification status of the user provided by a bot; may be null if - // none or unknown - BotVerification BotVerification - // Information about business settings for Telegram Business accounts; may be null if - // none - BusinessInfo BusinessInfo - // For bots, information about the bot; may be null if the user isn't a bot - BotInfo BotInfo -} - -// UserFullInfoTypeID is TL type id of UserFullInfo. -const UserFullInfoTypeID = 0xae9201c2 - -// Ensuring interfaces in compile-time for UserFullInfo. -var ( - _ bin.Encoder = &UserFullInfo{} - _ bin.Decoder = &UserFullInfo{} - _ bin.BareEncoder = &UserFullInfo{} - _ bin.BareDecoder = &UserFullInfo{} -) - -func (u *UserFullInfo) Zero() bool { - if u == nil { - return true - } - if !(u.PersonalPhoto.Zero()) { - return false - } - if !(u.Photo.Zero()) { - return false - } - if !(u.PublicPhoto.Zero()) { - return false - } - if !(u.BlockList == nil) { - return false - } - if !(u.CanBeCalled == false) { - return false - } - if !(u.SupportsVideoCalls == false) { - return false - } - if !(u.HasPrivateCalls == false) { - return false - } - if !(u.HasPrivateForwards == false) { - return false - } - if !(u.HasRestrictedVoiceAndVideoNoteMessages == false) { - return false - } - if !(u.HasPostedToProfileStories == false) { - return false - } - if !(u.HasSponsoredMessagesEnabled == false) { - return false - } - if !(u.NeedPhoneNumberPrivacyException == false) { - return false - } - if !(u.SetChatBackground == false) { - return false - } - if !(u.Bio.Zero()) { - return false - } - if !(u.Birthdate.Zero()) { - return false - } - if !(u.PersonalChatID == 0) { - return false - } - if !(u.GiftCount == 0) { - return false - } - if !(u.GroupInCommonCount == 0) { - return false - } - if !(u.BotVerification.Zero()) { - return false - } - if !(u.BusinessInfo.Zero()) { - return false - } - if !(u.BotInfo.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserFullInfo) String() string { - if u == nil { - return "UserFullInfo(nil)" - } - type Alias UserFullInfo - return fmt.Sprintf("UserFullInfo%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserFullInfo) TypeID() uint32 { - return UserFullInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserFullInfo) TypeName() string { - return "userFullInfo" -} - -// TypeInfo returns info about TL type. -func (u *UserFullInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userFullInfo", - ID: UserFullInfoTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PersonalPhoto", - SchemaName: "personal_photo", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "PublicPhoto", - SchemaName: "public_photo", - }, - { - Name: "BlockList", - SchemaName: "block_list", - }, - { - Name: "CanBeCalled", - SchemaName: "can_be_called", - }, - { - Name: "SupportsVideoCalls", - SchemaName: "supports_video_calls", - }, - { - Name: "HasPrivateCalls", - SchemaName: "has_private_calls", - }, - { - Name: "HasPrivateForwards", - SchemaName: "has_private_forwards", - }, - { - Name: "HasRestrictedVoiceAndVideoNoteMessages", - SchemaName: "has_restricted_voice_and_video_note_messages", - }, - { - Name: "HasPostedToProfileStories", - SchemaName: "has_posted_to_profile_stories", - }, - { - Name: "HasSponsoredMessagesEnabled", - SchemaName: "has_sponsored_messages_enabled", - }, - { - Name: "NeedPhoneNumberPrivacyException", - SchemaName: "need_phone_number_privacy_exception", - }, - { - Name: "SetChatBackground", - SchemaName: "set_chat_background", - }, - { - Name: "Bio", - SchemaName: "bio", - }, - { - Name: "Birthdate", - SchemaName: "birthdate", - }, - { - Name: "PersonalChatID", - SchemaName: "personal_chat_id", - }, - { - Name: "GiftCount", - SchemaName: "gift_count", - }, - { - Name: "GroupInCommonCount", - SchemaName: "group_in_common_count", - }, - { - Name: "BotVerification", - SchemaName: "bot_verification", - }, - { - Name: "BusinessInfo", - SchemaName: "business_info", - }, - { - Name: "BotInfo", - SchemaName: "bot_info", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserFullInfo) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userFullInfo#ae9201c2 as nil") - } - b.PutID(UserFullInfoTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserFullInfo) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userFullInfo#ae9201c2 as nil") - } - if err := u.PersonalPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field personal_photo: %w", err) - } - if err := u.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field photo: %w", err) - } - if err := u.PublicPhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field public_photo: %w", err) - } - if u.BlockList == nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field block_list is nil") - } - if err := u.BlockList.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field block_list: %w", err) - } - b.PutBool(u.CanBeCalled) - b.PutBool(u.SupportsVideoCalls) - b.PutBool(u.HasPrivateCalls) - b.PutBool(u.HasPrivateForwards) - b.PutBool(u.HasRestrictedVoiceAndVideoNoteMessages) - b.PutBool(u.HasPostedToProfileStories) - b.PutBool(u.HasSponsoredMessagesEnabled) - b.PutBool(u.NeedPhoneNumberPrivacyException) - b.PutBool(u.SetChatBackground) - if err := u.Bio.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bio: %w", err) - } - if err := u.Birthdate.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field birthdate: %w", err) - } - b.PutInt53(u.PersonalChatID) - b.PutInt32(u.GiftCount) - b.PutInt32(u.GroupInCommonCount) - if err := u.BotVerification.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bot_verification: %w", err) - } - if err := u.BusinessInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field business_info: %w", err) - } - if err := u.BotInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bot_info: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserFullInfo) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userFullInfo#ae9201c2 to nil") - } - if err := b.ConsumeID(UserFullInfoTypeID); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserFullInfo) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userFullInfo#ae9201c2 to nil") - } - { - if err := u.PersonalPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field personal_photo: %w", err) - } - } - { - if err := u.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field photo: %w", err) - } - } - { - if err := u.PublicPhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field public_photo: %w", err) - } - } - { - value, err := DecodeBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field block_list: %w", err) - } - u.BlockList = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field can_be_called: %w", err) - } - u.CanBeCalled = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field supports_video_calls: %w", err) - } - u.SupportsVideoCalls = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_private_calls: %w", err) - } - u.HasPrivateCalls = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_private_forwards: %w", err) - } - u.HasPrivateForwards = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_restricted_voice_and_video_note_messages: %w", err) - } - u.HasRestrictedVoiceAndVideoNoteMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_posted_to_profile_stories: %w", err) - } - u.HasPostedToProfileStories = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_sponsored_messages_enabled: %w", err) - } - u.HasSponsoredMessagesEnabled = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field need_phone_number_privacy_exception: %w", err) - } - u.NeedPhoneNumberPrivacyException = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field set_chat_background: %w", err) - } - u.SetChatBackground = value - } - { - if err := u.Bio.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bio: %w", err) - } - } - { - if err := u.Birthdate.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field birthdate: %w", err) - } - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field personal_chat_id: %w", err) - } - u.PersonalChatID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field gift_count: %w", err) - } - u.GiftCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field group_in_common_count: %w", err) - } - u.GroupInCommonCount = value - } - { - if err := u.BotVerification.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bot_verification: %w", err) - } - } - { - if err := u.BusinessInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field business_info: %w", err) - } - } - { - if err := u.BotInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bot_info: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserFullInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userFullInfo#ae9201c2 as nil") - } - b.ObjStart() - b.PutID("userFullInfo") - b.Comma() - b.FieldStart("personal_photo") - if err := u.PersonalPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field personal_photo: %w", err) - } - b.Comma() - b.FieldStart("photo") - if err := u.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field photo: %w", err) - } - b.Comma() - b.FieldStart("public_photo") - if err := u.PublicPhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field public_photo: %w", err) - } - b.Comma() - b.FieldStart("block_list") - if u.BlockList == nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field block_list is nil") - } - if err := u.BlockList.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field block_list: %w", err) - } - b.Comma() - b.FieldStart("can_be_called") - b.PutBool(u.CanBeCalled) - b.Comma() - b.FieldStart("supports_video_calls") - b.PutBool(u.SupportsVideoCalls) - b.Comma() - b.FieldStart("has_private_calls") - b.PutBool(u.HasPrivateCalls) - b.Comma() - b.FieldStart("has_private_forwards") - b.PutBool(u.HasPrivateForwards) - b.Comma() - b.FieldStart("has_restricted_voice_and_video_note_messages") - b.PutBool(u.HasRestrictedVoiceAndVideoNoteMessages) - b.Comma() - b.FieldStart("has_posted_to_profile_stories") - b.PutBool(u.HasPostedToProfileStories) - b.Comma() - b.FieldStart("has_sponsored_messages_enabled") - b.PutBool(u.HasSponsoredMessagesEnabled) - b.Comma() - b.FieldStart("need_phone_number_privacy_exception") - b.PutBool(u.NeedPhoneNumberPrivacyException) - b.Comma() - b.FieldStart("set_chat_background") - b.PutBool(u.SetChatBackground) - b.Comma() - b.FieldStart("bio") - if err := u.Bio.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bio: %w", err) - } - b.Comma() - b.FieldStart("birthdate") - if err := u.Birthdate.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field birthdate: %w", err) - } - b.Comma() - b.FieldStart("personal_chat_id") - b.PutInt53(u.PersonalChatID) - b.Comma() - b.FieldStart("gift_count") - b.PutInt32(u.GiftCount) - b.Comma() - b.FieldStart("group_in_common_count") - b.PutInt32(u.GroupInCommonCount) - b.Comma() - b.FieldStart("bot_verification") - if err := u.BotVerification.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bot_verification: %w", err) - } - b.Comma() - b.FieldStart("business_info") - if err := u.BusinessInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field business_info: %w", err) - } - b.Comma() - b.FieldStart("bot_info") - if err := u.BotInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userFullInfo#ae9201c2: field bot_info: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserFullInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userFullInfo#ae9201c2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userFullInfo"); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: %w", err) - } - case "personal_photo": - if err := u.PersonalPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field personal_photo: %w", err) - } - case "photo": - if err := u.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field photo: %w", err) - } - case "public_photo": - if err := u.PublicPhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field public_photo: %w", err) - } - case "block_list": - value, err := DecodeTDLibJSONBlockList(b) - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field block_list: %w", err) - } - u.BlockList = value - case "can_be_called": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field can_be_called: %w", err) - } - u.CanBeCalled = value - case "supports_video_calls": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field supports_video_calls: %w", err) - } - u.SupportsVideoCalls = value - case "has_private_calls": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_private_calls: %w", err) - } - u.HasPrivateCalls = value - case "has_private_forwards": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_private_forwards: %w", err) - } - u.HasPrivateForwards = value - case "has_restricted_voice_and_video_note_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_restricted_voice_and_video_note_messages: %w", err) - } - u.HasRestrictedVoiceAndVideoNoteMessages = value - case "has_posted_to_profile_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_posted_to_profile_stories: %w", err) - } - u.HasPostedToProfileStories = value - case "has_sponsored_messages_enabled": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field has_sponsored_messages_enabled: %w", err) - } - u.HasSponsoredMessagesEnabled = value - case "need_phone_number_privacy_exception": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field need_phone_number_privacy_exception: %w", err) - } - u.NeedPhoneNumberPrivacyException = value - case "set_chat_background": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field set_chat_background: %w", err) - } - u.SetChatBackground = value - case "bio": - if err := u.Bio.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bio: %w", err) - } - case "birthdate": - if err := u.Birthdate.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field birthdate: %w", err) - } - case "personal_chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field personal_chat_id: %w", err) - } - u.PersonalChatID = value - case "gift_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field gift_count: %w", err) - } - u.GiftCount = value - case "group_in_common_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field group_in_common_count: %w", err) - } - u.GroupInCommonCount = value - case "bot_verification": - if err := u.BotVerification.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bot_verification: %w", err) - } - case "business_info": - if err := u.BusinessInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field business_info: %w", err) - } - case "bot_info": - if err := u.BotInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userFullInfo#ae9201c2: field bot_info: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetPersonalPhoto returns value of PersonalPhoto field. -func (u *UserFullInfo) GetPersonalPhoto() (value ChatPhoto) { - if u == nil { - return - } - return u.PersonalPhoto -} - -// GetPhoto returns value of Photo field. -func (u *UserFullInfo) GetPhoto() (value ChatPhoto) { - if u == nil { - return - } - return u.Photo -} - -// GetPublicPhoto returns value of PublicPhoto field. -func (u *UserFullInfo) GetPublicPhoto() (value ChatPhoto) { - if u == nil { - return - } - return u.PublicPhoto -} - -// GetBlockList returns value of BlockList field. -func (u *UserFullInfo) GetBlockList() (value BlockListClass) { - if u == nil { - return - } - return u.BlockList -} - -// GetCanBeCalled returns value of CanBeCalled field. -func (u *UserFullInfo) GetCanBeCalled() (value bool) { - if u == nil { - return - } - return u.CanBeCalled -} - -// GetSupportsVideoCalls returns value of SupportsVideoCalls field. -func (u *UserFullInfo) GetSupportsVideoCalls() (value bool) { - if u == nil { - return - } - return u.SupportsVideoCalls -} - -// GetHasPrivateCalls returns value of HasPrivateCalls field. -func (u *UserFullInfo) GetHasPrivateCalls() (value bool) { - if u == nil { - return - } - return u.HasPrivateCalls -} - -// GetHasPrivateForwards returns value of HasPrivateForwards field. -func (u *UserFullInfo) GetHasPrivateForwards() (value bool) { - if u == nil { - return - } - return u.HasPrivateForwards -} - -// GetHasRestrictedVoiceAndVideoNoteMessages returns value of HasRestrictedVoiceAndVideoNoteMessages field. -func (u *UserFullInfo) GetHasRestrictedVoiceAndVideoNoteMessages() (value bool) { - if u == nil { - return - } - return u.HasRestrictedVoiceAndVideoNoteMessages -} - -// GetHasPostedToProfileStories returns value of HasPostedToProfileStories field. -func (u *UserFullInfo) GetHasPostedToProfileStories() (value bool) { - if u == nil { - return - } - return u.HasPostedToProfileStories -} - -// GetHasSponsoredMessagesEnabled returns value of HasSponsoredMessagesEnabled field. -func (u *UserFullInfo) GetHasSponsoredMessagesEnabled() (value bool) { - if u == nil { - return - } - return u.HasSponsoredMessagesEnabled -} - -// GetNeedPhoneNumberPrivacyException returns value of NeedPhoneNumberPrivacyException field. -func (u *UserFullInfo) GetNeedPhoneNumberPrivacyException() (value bool) { - if u == nil { - return - } - return u.NeedPhoneNumberPrivacyException -} - -// GetSetChatBackground returns value of SetChatBackground field. -func (u *UserFullInfo) GetSetChatBackground() (value bool) { - if u == nil { - return - } - return u.SetChatBackground -} - -// GetBio returns value of Bio field. -func (u *UserFullInfo) GetBio() (value FormattedText) { - if u == nil { - return - } - return u.Bio -} - -// GetBirthdate returns value of Birthdate field. -func (u *UserFullInfo) GetBirthdate() (value Birthdate) { - if u == nil { - return - } - return u.Birthdate -} - -// GetPersonalChatID returns value of PersonalChatID field. -func (u *UserFullInfo) GetPersonalChatID() (value int64) { - if u == nil { - return - } - return u.PersonalChatID -} - -// GetGiftCount returns value of GiftCount field. -func (u *UserFullInfo) GetGiftCount() (value int32) { - if u == nil { - return - } - return u.GiftCount -} - -// GetGroupInCommonCount returns value of GroupInCommonCount field. -func (u *UserFullInfo) GetGroupInCommonCount() (value int32) { - if u == nil { - return - } - return u.GroupInCommonCount -} - -// GetBotVerification returns value of BotVerification field. -func (u *UserFullInfo) GetBotVerification() (value BotVerification) { - if u == nil { - return - } - return u.BotVerification -} - -// GetBusinessInfo returns value of BusinessInfo field. -func (u *UserFullInfo) GetBusinessInfo() (value BusinessInfo) { - if u == nil { - return - } - return u.BusinessInfo -} - -// GetBotInfo returns value of BotInfo field. -func (u *UserFullInfo) GetBotInfo() (value BotInfo) { - if u == nil { - return - } - return u.BotInfo -} diff --git a/tdapi/tl_user_gen.go b/tdapi/tl_user_gen.go deleted file mode 100644 index c674531b1..000000000 --- a/tdapi/tl_user_gen.go +++ /dev/null @@ -1,1071 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// User represents TL type `user#598c3933`. -type User struct { - // User identifier - ID int64 - // First name of the user - FirstName string - // Last name of the user - LastName string - // Usernames of the user; may be null - Usernames Usernames - // Phone number of the user - PhoneNumber string - // Current online status of the user - Status UserStatusClass - // Profile photo of the user; may be null - ProfilePhoto ProfilePhoto - // Identifier of the accent color for name, and backgrounds of profile photo, reply - // header, and link preview - AccentColorID int32 - // Identifier of a custom emoji to be shown on the reply header and link preview - // background; 0 if none - BackgroundCustomEmojiID int64 - // Identifier of the accent color for the user's profile; -1 if none - ProfileAccentColorID int32 - // Identifier of a custom emoji to be shown on the background of the user's profile; 0 if - // none - ProfileBackgroundCustomEmojiID int64 - // Emoji status to be shown instead of the default Telegram Premium badge; may be null - EmojiStatus EmojiStatus - // The user is a contact of the current user - IsContact bool - // The user is a contact of the current user and the current user is a contact of the - // user - IsMutualContact bool - // The user is a close friend of the current user; implies that the user is a contact - IsCloseFriend bool - // Information about verification status of the user; may be null if none - VerificationStatus VerificationStatus - // True, if the user is a Telegram Premium user - IsPremium bool - // True, if the user is Telegram support account - IsSupport bool - // If non-empty, it contains a human-readable description of the reason why access to - // this user must be restricted - RestrictionReason string - // True, if the user has non-expired stories available to the current user - HasActiveStories bool - // True, if the user has unread non-expired stories available to the current user - HasUnreadActiveStories bool - // True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser - // to check whether the current user can message the user or try to create a chat with - // them - RestrictsNewChats bool - // If false, the user is inaccessible, and the only information known about the user is - // inside this class. Identifier of the user can't be passed to any method - HaveAccess bool - // Type of the user - Type UserTypeClass - // IETF language tag of the user's language; only available to bots - LanguageCode string - // True, if the user added the current bot to attachment menu; only available to bots - AddedToAttachmentMenu bool -} - -// UserTypeID is TL type id of User. -const UserTypeID = 0x598c3933 - -// Ensuring interfaces in compile-time for User. -var ( - _ bin.Encoder = &User{} - _ bin.Decoder = &User{} - _ bin.BareEncoder = &User{} - _ bin.BareDecoder = &User{} -) - -func (u *User) Zero() bool { - if u == nil { - return true - } - if !(u.ID == 0) { - return false - } - if !(u.FirstName == "") { - return false - } - if !(u.LastName == "") { - return false - } - if !(u.Usernames.Zero()) { - return false - } - if !(u.PhoneNumber == "") { - return false - } - if !(u.Status == nil) { - return false - } - if !(u.ProfilePhoto.Zero()) { - return false - } - if !(u.AccentColorID == 0) { - return false - } - if !(u.BackgroundCustomEmojiID == 0) { - return false - } - if !(u.ProfileAccentColorID == 0) { - return false - } - if !(u.ProfileBackgroundCustomEmojiID == 0) { - return false - } - if !(u.EmojiStatus.Zero()) { - return false - } - if !(u.IsContact == false) { - return false - } - if !(u.IsMutualContact == false) { - return false - } - if !(u.IsCloseFriend == false) { - return false - } - if !(u.VerificationStatus.Zero()) { - return false - } - if !(u.IsPremium == false) { - return false - } - if !(u.IsSupport == false) { - return false - } - if !(u.RestrictionReason == "") { - return false - } - if !(u.HasActiveStories == false) { - return false - } - if !(u.HasUnreadActiveStories == false) { - return false - } - if !(u.RestrictsNewChats == false) { - return false - } - if !(u.HaveAccess == false) { - return false - } - if !(u.Type == nil) { - return false - } - if !(u.LanguageCode == "") { - return false - } - if !(u.AddedToAttachmentMenu == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *User) String() string { - if u == nil { - return "User(nil)" - } - type Alias User - return fmt.Sprintf("User%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*User) TypeID() uint32 { - return UserTypeID -} - -// TypeName returns name of type in TL schema. -func (*User) TypeName() string { - return "user" -} - -// TypeInfo returns info about TL type. -func (u *User) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "user", - ID: UserTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "FirstName", - SchemaName: "first_name", - }, - { - Name: "LastName", - SchemaName: "last_name", - }, - { - Name: "Usernames", - SchemaName: "usernames", - }, - { - Name: "PhoneNumber", - SchemaName: "phone_number", - }, - { - Name: "Status", - SchemaName: "status", - }, - { - Name: "ProfilePhoto", - SchemaName: "profile_photo", - }, - { - Name: "AccentColorID", - SchemaName: "accent_color_id", - }, - { - Name: "BackgroundCustomEmojiID", - SchemaName: "background_custom_emoji_id", - }, - { - Name: "ProfileAccentColorID", - SchemaName: "profile_accent_color_id", - }, - { - Name: "ProfileBackgroundCustomEmojiID", - SchemaName: "profile_background_custom_emoji_id", - }, - { - Name: "EmojiStatus", - SchemaName: "emoji_status", - }, - { - Name: "IsContact", - SchemaName: "is_contact", - }, - { - Name: "IsMutualContact", - SchemaName: "is_mutual_contact", - }, - { - Name: "IsCloseFriend", - SchemaName: "is_close_friend", - }, - { - Name: "VerificationStatus", - SchemaName: "verification_status", - }, - { - Name: "IsPremium", - SchemaName: "is_premium", - }, - { - Name: "IsSupport", - SchemaName: "is_support", - }, - { - Name: "RestrictionReason", - SchemaName: "restriction_reason", - }, - { - Name: "HasActiveStories", - SchemaName: "has_active_stories", - }, - { - Name: "HasUnreadActiveStories", - SchemaName: "has_unread_active_stories", - }, - { - Name: "RestrictsNewChats", - SchemaName: "restricts_new_chats", - }, - { - Name: "HaveAccess", - SchemaName: "have_access", - }, - { - Name: "Type", - SchemaName: "type", - }, - { - Name: "LanguageCode", - SchemaName: "language_code", - }, - { - Name: "AddedToAttachmentMenu", - SchemaName: "added_to_attachment_menu", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *User) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode user#598c3933 as nil") - } - b.PutID(UserTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *User) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode user#598c3933 as nil") - } - b.PutInt53(u.ID) - b.PutString(u.FirstName) - b.PutString(u.LastName) - if err := u.Usernames.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field usernames: %w", err) - } - b.PutString(u.PhoneNumber) - if u.Status == nil { - return fmt.Errorf("unable to encode user#598c3933: field status is nil") - } - if err := u.Status.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field status: %w", err) - } - if err := u.ProfilePhoto.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field profile_photo: %w", err) - } - b.PutInt32(u.AccentColorID) - b.PutLong(u.BackgroundCustomEmojiID) - b.PutInt32(u.ProfileAccentColorID) - b.PutLong(u.ProfileBackgroundCustomEmojiID) - if err := u.EmojiStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field emoji_status: %w", err) - } - b.PutBool(u.IsContact) - b.PutBool(u.IsMutualContact) - b.PutBool(u.IsCloseFriend) - if err := u.VerificationStatus.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field verification_status: %w", err) - } - b.PutBool(u.IsPremium) - b.PutBool(u.IsSupport) - b.PutString(u.RestrictionReason) - b.PutBool(u.HasActiveStories) - b.PutBool(u.HasUnreadActiveStories) - b.PutBool(u.RestrictsNewChats) - b.PutBool(u.HaveAccess) - if u.Type == nil { - return fmt.Errorf("unable to encode user#598c3933: field type is nil") - } - if err := u.Type.Encode(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field type: %w", err) - } - b.PutString(u.LanguageCode) - b.PutBool(u.AddedToAttachmentMenu) - return nil -} - -// Decode implements bin.Decoder. -func (u *User) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode user#598c3933 to nil") - } - if err := b.ConsumeID(UserTypeID); err != nil { - return fmt.Errorf("unable to decode user#598c3933: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *User) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode user#598c3933 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field id: %w", err) - } - u.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field first_name: %w", err) - } - u.FirstName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field last_name: %w", err) - } - u.LastName = value - } - { - if err := u.Usernames.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#598c3933: field usernames: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field phone_number: %w", err) - } - u.PhoneNumber = value - } - { - value, err := DecodeUserStatus(b) - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field status: %w", err) - } - u.Status = value - } - { - if err := u.ProfilePhoto.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#598c3933: field profile_photo: %w", err) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field accent_color_id: %w", err) - } - u.AccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field background_custom_emoji_id: %w", err) - } - u.BackgroundCustomEmojiID = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field profile_accent_color_id: %w", err) - } - u.ProfileAccentColorID = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field profile_background_custom_emoji_id: %w", err) - } - u.ProfileBackgroundCustomEmojiID = value - } - { - if err := u.EmojiStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#598c3933: field emoji_status: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field is_contact: %w", err) - } - u.IsContact = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field is_mutual_contact: %w", err) - } - u.IsMutualContact = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field is_close_friend: %w", err) - } - u.IsCloseFriend = value - } - { - if err := u.VerificationStatus.Decode(b); err != nil { - return fmt.Errorf("unable to decode user#598c3933: field verification_status: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field is_premium: %w", err) - } - u.IsPremium = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field is_support: %w", err) - } - u.IsSupport = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field restriction_reason: %w", err) - } - u.RestrictionReason = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field has_active_stories: %w", err) - } - u.HasActiveStories = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field has_unread_active_stories: %w", err) - } - u.HasUnreadActiveStories = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field restricts_new_chats: %w", err) - } - u.RestrictsNewChats = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field have_access: %w", err) - } - u.HaveAccess = value - } - { - value, err := DecodeUserType(b) - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field type: %w", err) - } - u.Type = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field language_code: %w", err) - } - u.LanguageCode = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field added_to_attachment_menu: %w", err) - } - u.AddedToAttachmentMenu = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *User) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode user#598c3933 as nil") - } - b.ObjStart() - b.PutID("user") - b.Comma() - b.FieldStart("id") - b.PutInt53(u.ID) - b.Comma() - b.FieldStart("first_name") - b.PutString(u.FirstName) - b.Comma() - b.FieldStart("last_name") - b.PutString(u.LastName) - b.Comma() - b.FieldStart("usernames") - if err := u.Usernames.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field usernames: %w", err) - } - b.Comma() - b.FieldStart("phone_number") - b.PutString(u.PhoneNumber) - b.Comma() - b.FieldStart("status") - if u.Status == nil { - return fmt.Errorf("unable to encode user#598c3933: field status is nil") - } - if err := u.Status.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field status: %w", err) - } - b.Comma() - b.FieldStart("profile_photo") - if err := u.ProfilePhoto.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field profile_photo: %w", err) - } - b.Comma() - b.FieldStart("accent_color_id") - b.PutInt32(u.AccentColorID) - b.Comma() - b.FieldStart("background_custom_emoji_id") - b.PutLong(u.BackgroundCustomEmojiID) - b.Comma() - b.FieldStart("profile_accent_color_id") - b.PutInt32(u.ProfileAccentColorID) - b.Comma() - b.FieldStart("profile_background_custom_emoji_id") - b.PutLong(u.ProfileBackgroundCustomEmojiID) - b.Comma() - b.FieldStart("emoji_status") - if err := u.EmojiStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field emoji_status: %w", err) - } - b.Comma() - b.FieldStart("is_contact") - b.PutBool(u.IsContact) - b.Comma() - b.FieldStart("is_mutual_contact") - b.PutBool(u.IsMutualContact) - b.Comma() - b.FieldStart("is_close_friend") - b.PutBool(u.IsCloseFriend) - b.Comma() - b.FieldStart("verification_status") - if err := u.VerificationStatus.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field verification_status: %w", err) - } - b.Comma() - b.FieldStart("is_premium") - b.PutBool(u.IsPremium) - b.Comma() - b.FieldStart("is_support") - b.PutBool(u.IsSupport) - b.Comma() - b.FieldStart("restriction_reason") - b.PutString(u.RestrictionReason) - b.Comma() - b.FieldStart("has_active_stories") - b.PutBool(u.HasActiveStories) - b.Comma() - b.FieldStart("has_unread_active_stories") - b.PutBool(u.HasUnreadActiveStories) - b.Comma() - b.FieldStart("restricts_new_chats") - b.PutBool(u.RestrictsNewChats) - b.Comma() - b.FieldStart("have_access") - b.PutBool(u.HaveAccess) - b.Comma() - b.FieldStart("type") - if u.Type == nil { - return fmt.Errorf("unable to encode user#598c3933: field type is nil") - } - if err := u.Type.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode user#598c3933: field type: %w", err) - } - b.Comma() - b.FieldStart("language_code") - b.PutString(u.LanguageCode) - b.Comma() - b.FieldStart("added_to_attachment_menu") - b.PutBool(u.AddedToAttachmentMenu) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *User) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode user#598c3933 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("user"); err != nil { - return fmt.Errorf("unable to decode user#598c3933: %w", err) - } - case "id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field id: %w", err) - } - u.ID = value - case "first_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field first_name: %w", err) - } - u.FirstName = value - case "last_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field last_name: %w", err) - } - u.LastName = value - case "usernames": - if err := u.Usernames.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#598c3933: field usernames: %w", err) - } - case "phone_number": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field phone_number: %w", err) - } - u.PhoneNumber = value - case "status": - value, err := DecodeTDLibJSONUserStatus(b) - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field status: %w", err) - } - u.Status = value - case "profile_photo": - if err := u.ProfilePhoto.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#598c3933: field profile_photo: %w", err) - } - case "accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field accent_color_id: %w", err) - } - u.AccentColorID = value - case "background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field background_custom_emoji_id: %w", err) - } - u.BackgroundCustomEmojiID = value - case "profile_accent_color_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field profile_accent_color_id: %w", err) - } - u.ProfileAccentColorID = value - case "profile_background_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field profile_background_custom_emoji_id: %w", err) - } - u.ProfileBackgroundCustomEmojiID = value - case "emoji_status": - if err := u.EmojiStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#598c3933: field emoji_status: %w", err) - } - case "is_contact": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field is_contact: %w", err) - } - u.IsContact = value - case "is_mutual_contact": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field is_mutual_contact: %w", err) - } - u.IsMutualContact = value - case "is_close_friend": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field is_close_friend: %w", err) - } - u.IsCloseFriend = value - case "verification_status": - if err := u.VerificationStatus.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode user#598c3933: field verification_status: %w", err) - } - case "is_premium": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field is_premium: %w", err) - } - u.IsPremium = value - case "is_support": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field is_support: %w", err) - } - u.IsSupport = value - case "restriction_reason": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field restriction_reason: %w", err) - } - u.RestrictionReason = value - case "has_active_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field has_active_stories: %w", err) - } - u.HasActiveStories = value - case "has_unread_active_stories": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field has_unread_active_stories: %w", err) - } - u.HasUnreadActiveStories = value - case "restricts_new_chats": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field restricts_new_chats: %w", err) - } - u.RestrictsNewChats = value - case "have_access": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field have_access: %w", err) - } - u.HaveAccess = value - case "type": - value, err := DecodeTDLibJSONUserType(b) - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field type: %w", err) - } - u.Type = value - case "language_code": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field language_code: %w", err) - } - u.LanguageCode = value - case "added_to_attachment_menu": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode user#598c3933: field added_to_attachment_menu: %w", err) - } - u.AddedToAttachmentMenu = value - default: - return b.Skip() - } - return nil - }) -} - -// GetID returns value of ID field. -func (u *User) GetID() (value int64) { - if u == nil { - return - } - return u.ID -} - -// GetFirstName returns value of FirstName field. -func (u *User) GetFirstName() (value string) { - if u == nil { - return - } - return u.FirstName -} - -// GetLastName returns value of LastName field. -func (u *User) GetLastName() (value string) { - if u == nil { - return - } - return u.LastName -} - -// GetUsernames returns value of Usernames field. -func (u *User) GetUsernames() (value Usernames) { - if u == nil { - return - } - return u.Usernames -} - -// GetPhoneNumber returns value of PhoneNumber field. -func (u *User) GetPhoneNumber() (value string) { - if u == nil { - return - } - return u.PhoneNumber -} - -// GetStatus returns value of Status field. -func (u *User) GetStatus() (value UserStatusClass) { - if u == nil { - return - } - return u.Status -} - -// GetProfilePhoto returns value of ProfilePhoto field. -func (u *User) GetProfilePhoto() (value ProfilePhoto) { - if u == nil { - return - } - return u.ProfilePhoto -} - -// GetAccentColorID returns value of AccentColorID field. -func (u *User) GetAccentColorID() (value int32) { - if u == nil { - return - } - return u.AccentColorID -} - -// GetBackgroundCustomEmojiID returns value of BackgroundCustomEmojiID field. -func (u *User) GetBackgroundCustomEmojiID() (value int64) { - if u == nil { - return - } - return u.BackgroundCustomEmojiID -} - -// GetProfileAccentColorID returns value of ProfileAccentColorID field. -func (u *User) GetProfileAccentColorID() (value int32) { - if u == nil { - return - } - return u.ProfileAccentColorID -} - -// GetProfileBackgroundCustomEmojiID returns value of ProfileBackgroundCustomEmojiID field. -func (u *User) GetProfileBackgroundCustomEmojiID() (value int64) { - if u == nil { - return - } - return u.ProfileBackgroundCustomEmojiID -} - -// GetEmojiStatus returns value of EmojiStatus field. -func (u *User) GetEmojiStatus() (value EmojiStatus) { - if u == nil { - return - } - return u.EmojiStatus -} - -// GetIsContact returns value of IsContact field. -func (u *User) GetIsContact() (value bool) { - if u == nil { - return - } - return u.IsContact -} - -// GetIsMutualContact returns value of IsMutualContact field. -func (u *User) GetIsMutualContact() (value bool) { - if u == nil { - return - } - return u.IsMutualContact -} - -// GetIsCloseFriend returns value of IsCloseFriend field. -func (u *User) GetIsCloseFriend() (value bool) { - if u == nil { - return - } - return u.IsCloseFriend -} - -// GetVerificationStatus returns value of VerificationStatus field. -func (u *User) GetVerificationStatus() (value VerificationStatus) { - if u == nil { - return - } - return u.VerificationStatus -} - -// GetIsPremium returns value of IsPremium field. -func (u *User) GetIsPremium() (value bool) { - if u == nil { - return - } - return u.IsPremium -} - -// GetIsSupport returns value of IsSupport field. -func (u *User) GetIsSupport() (value bool) { - if u == nil { - return - } - return u.IsSupport -} - -// GetRestrictionReason returns value of RestrictionReason field. -func (u *User) GetRestrictionReason() (value string) { - if u == nil { - return - } - return u.RestrictionReason -} - -// GetHasActiveStories returns value of HasActiveStories field. -func (u *User) GetHasActiveStories() (value bool) { - if u == nil { - return - } - return u.HasActiveStories -} - -// GetHasUnreadActiveStories returns value of HasUnreadActiveStories field. -func (u *User) GetHasUnreadActiveStories() (value bool) { - if u == nil { - return - } - return u.HasUnreadActiveStories -} - -// GetRestrictsNewChats returns value of RestrictsNewChats field. -func (u *User) GetRestrictsNewChats() (value bool) { - if u == nil { - return - } - return u.RestrictsNewChats -} - -// GetHaveAccess returns value of HaveAccess field. -func (u *User) GetHaveAccess() (value bool) { - if u == nil { - return - } - return u.HaveAccess -} - -// GetType returns value of Type field. -func (u *User) GetType() (value UserTypeClass) { - if u == nil { - return - } - return u.Type -} - -// GetLanguageCode returns value of LanguageCode field. -func (u *User) GetLanguageCode() (value string) { - if u == nil { - return - } - return u.LanguageCode -} - -// GetAddedToAttachmentMenu returns value of AddedToAttachmentMenu field. -func (u *User) GetAddedToAttachmentMenu() (value bool) { - if u == nil { - return - } - return u.AddedToAttachmentMenu -} diff --git a/tdapi/tl_user_gift_gen.go b/tdapi/tl_user_gift_gen.go deleted file mode 100644 index dc64e079e..000000000 --- a/tdapi/tl_user_gift_gen.go +++ /dev/null @@ -1,655 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UserGift represents TL type `userGift#a39db860`. -type UserGift struct { - // Identifier of the user that sent the gift; 0 if unknown - SenderUserID int64 - // Message added to the gift - Text FormattedText - // True, if the sender and gift text are shown only to the gift receiver; otherwise, - // everyone are able to see them - IsPrivate bool - // True, if the gift is displayed on the user's profile page; only for the receiver of - // the gift - IsSaved bool - // True, if the gift is a regular gift that can be upgraded to a unique gift; only for - // the receiver of the gift - CanBeUpgraded bool - // True, if the gift is an upgraded gift that can be transferred to another user; only - // for the receiver of the gift - CanBeTransferred bool - // True, if the gift was refunded and isn't available anymore - WasRefunded bool - // Point in time (Unix timestamp) when the gift was sent - Date int32 - // The gift - Gift SentGiftClass - // Identifier of the message with the gift in the chat with the sender of the gift; can - // be 0 or an identifier of a deleted message; only for the receiver of the gift - MessageID int64 - // Number of Telegram Stars that can be claimed by the receiver instead of the regular - // gift; 0 if the gift can't be sold by the current user - SellStarCount int64 - // Number of Telegram Stars that were paid by the sender for the ability to upgrade the - // gift - PrepaidUpgradeStarCount int64 - // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the - // receiver of the gift - TransferStarCount int64 - // Point in time (Unix timestamp) when the upgraded gift can be transferred to TON - // blockchain as an NFT; 0 if NFT export isn't possible; only for the receiver of the - // gift - ExportDate int32 -} - -// UserGiftTypeID is TL type id of UserGift. -const UserGiftTypeID = 0xa39db860 - -// Ensuring interfaces in compile-time for UserGift. -var ( - _ bin.Encoder = &UserGift{} - _ bin.Decoder = &UserGift{} - _ bin.BareEncoder = &UserGift{} - _ bin.BareDecoder = &UserGift{} -) - -func (u *UserGift) Zero() bool { - if u == nil { - return true - } - if !(u.SenderUserID == 0) { - return false - } - if !(u.Text.Zero()) { - return false - } - if !(u.IsPrivate == false) { - return false - } - if !(u.IsSaved == false) { - return false - } - if !(u.CanBeUpgraded == false) { - return false - } - if !(u.CanBeTransferred == false) { - return false - } - if !(u.WasRefunded == false) { - return false - } - if !(u.Date == 0) { - return false - } - if !(u.Gift == nil) { - return false - } - if !(u.MessageID == 0) { - return false - } - if !(u.SellStarCount == 0) { - return false - } - if !(u.PrepaidUpgradeStarCount == 0) { - return false - } - if !(u.TransferStarCount == 0) { - return false - } - if !(u.ExportDate == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserGift) String() string { - if u == nil { - return "UserGift(nil)" - } - type Alias UserGift - return fmt.Sprintf("UserGift%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserGift) TypeID() uint32 { - return UserGiftTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserGift) TypeName() string { - return "userGift" -} - -// TypeInfo returns info about TL type. -func (u *UserGift) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userGift", - ID: UserGiftTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "SenderUserID", - SchemaName: "sender_user_id", - }, - { - Name: "Text", - SchemaName: "text", - }, - { - Name: "IsPrivate", - SchemaName: "is_private", - }, - { - Name: "IsSaved", - SchemaName: "is_saved", - }, - { - Name: "CanBeUpgraded", - SchemaName: "can_be_upgraded", - }, - { - Name: "CanBeTransferred", - SchemaName: "can_be_transferred", - }, - { - Name: "WasRefunded", - SchemaName: "was_refunded", - }, - { - Name: "Date", - SchemaName: "date", - }, - { - Name: "Gift", - SchemaName: "gift", - }, - { - Name: "MessageID", - SchemaName: "message_id", - }, - { - Name: "SellStarCount", - SchemaName: "sell_star_count", - }, - { - Name: "PrepaidUpgradeStarCount", - SchemaName: "prepaid_upgrade_star_count", - }, - { - Name: "TransferStarCount", - SchemaName: "transfer_star_count", - }, - { - Name: "ExportDate", - SchemaName: "export_date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserGift) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userGift#a39db860 as nil") - } - b.PutID(UserGiftTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserGift) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userGift#a39db860 as nil") - } - b.PutInt53(u.SenderUserID) - if err := u.Text.Encode(b); err != nil { - return fmt.Errorf("unable to encode userGift#a39db860: field text: %w", err) - } - b.PutBool(u.IsPrivate) - b.PutBool(u.IsSaved) - b.PutBool(u.CanBeUpgraded) - b.PutBool(u.CanBeTransferred) - b.PutBool(u.WasRefunded) - b.PutInt32(u.Date) - if u.Gift == nil { - return fmt.Errorf("unable to encode userGift#a39db860: field gift is nil") - } - if err := u.Gift.Encode(b); err != nil { - return fmt.Errorf("unable to encode userGift#a39db860: field gift: %w", err) - } - b.PutInt53(u.MessageID) - b.PutInt53(u.SellStarCount) - b.PutInt53(u.PrepaidUpgradeStarCount) - b.PutInt53(u.TransferStarCount) - b.PutInt32(u.ExportDate) - return nil -} - -// Decode implements bin.Decoder. -func (u *UserGift) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userGift#a39db860 to nil") - } - if err := b.ConsumeID(UserGiftTypeID); err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserGift) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userGift#a39db860 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field sender_user_id: %w", err) - } - u.SenderUserID = value - } - { - if err := u.Text.Decode(b); err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field text: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field is_private: %w", err) - } - u.IsPrivate = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field is_saved: %w", err) - } - u.IsSaved = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field can_be_upgraded: %w", err) - } - u.CanBeUpgraded = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field can_be_transferred: %w", err) - } - u.CanBeTransferred = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field was_refunded: %w", err) - } - u.WasRefunded = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field date: %w", err) - } - u.Date = value - } - { - value, err := DecodeSentGift(b) - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field gift: %w", err) - } - u.Gift = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field message_id: %w", err) - } - u.MessageID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field sell_star_count: %w", err) - } - u.SellStarCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field prepaid_upgrade_star_count: %w", err) - } - u.PrepaidUpgradeStarCount = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field transfer_star_count: %w", err) - } - u.TransferStarCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field export_date: %w", err) - } - u.ExportDate = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserGift) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userGift#a39db860 as nil") - } - b.ObjStart() - b.PutID("userGift") - b.Comma() - b.FieldStart("sender_user_id") - b.PutInt53(u.SenderUserID) - b.Comma() - b.FieldStart("text") - if err := u.Text.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userGift#a39db860: field text: %w", err) - } - b.Comma() - b.FieldStart("is_private") - b.PutBool(u.IsPrivate) - b.Comma() - b.FieldStart("is_saved") - b.PutBool(u.IsSaved) - b.Comma() - b.FieldStart("can_be_upgraded") - b.PutBool(u.CanBeUpgraded) - b.Comma() - b.FieldStart("can_be_transferred") - b.PutBool(u.CanBeTransferred) - b.Comma() - b.FieldStart("was_refunded") - b.PutBool(u.WasRefunded) - b.Comma() - b.FieldStart("date") - b.PutInt32(u.Date) - b.Comma() - b.FieldStart("gift") - if u.Gift == nil { - return fmt.Errorf("unable to encode userGift#a39db860: field gift is nil") - } - if err := u.Gift.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userGift#a39db860: field gift: %w", err) - } - b.Comma() - b.FieldStart("message_id") - b.PutInt53(u.MessageID) - b.Comma() - b.FieldStart("sell_star_count") - b.PutInt53(u.SellStarCount) - b.Comma() - b.FieldStart("prepaid_upgrade_star_count") - b.PutInt53(u.PrepaidUpgradeStarCount) - b.Comma() - b.FieldStart("transfer_star_count") - b.PutInt53(u.TransferStarCount) - b.Comma() - b.FieldStart("export_date") - b.PutInt32(u.ExportDate) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserGift) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userGift#a39db860 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userGift"); err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: %w", err) - } - case "sender_user_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field sender_user_id: %w", err) - } - u.SenderUserID = value - case "text": - if err := u.Text.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field text: %w", err) - } - case "is_private": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field is_private: %w", err) - } - u.IsPrivate = value - case "is_saved": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field is_saved: %w", err) - } - u.IsSaved = value - case "can_be_upgraded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field can_be_upgraded: %w", err) - } - u.CanBeUpgraded = value - case "can_be_transferred": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field can_be_transferred: %w", err) - } - u.CanBeTransferred = value - case "was_refunded": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field was_refunded: %w", err) - } - u.WasRefunded = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field date: %w", err) - } - u.Date = value - case "gift": - value, err := DecodeTDLibJSONSentGift(b) - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field gift: %w", err) - } - u.Gift = value - case "message_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field message_id: %w", err) - } - u.MessageID = value - case "sell_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field sell_star_count: %w", err) - } - u.SellStarCount = value - case "prepaid_upgrade_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field prepaid_upgrade_star_count: %w", err) - } - u.PrepaidUpgradeStarCount = value - case "transfer_star_count": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field transfer_star_count: %w", err) - } - u.TransferStarCount = value - case "export_date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userGift#a39db860: field export_date: %w", err) - } - u.ExportDate = value - default: - return b.Skip() - } - return nil - }) -} - -// GetSenderUserID returns value of SenderUserID field. -func (u *UserGift) GetSenderUserID() (value int64) { - if u == nil { - return - } - return u.SenderUserID -} - -// GetText returns value of Text field. -func (u *UserGift) GetText() (value FormattedText) { - if u == nil { - return - } - return u.Text -} - -// GetIsPrivate returns value of IsPrivate field. -func (u *UserGift) GetIsPrivate() (value bool) { - if u == nil { - return - } - return u.IsPrivate -} - -// GetIsSaved returns value of IsSaved field. -func (u *UserGift) GetIsSaved() (value bool) { - if u == nil { - return - } - return u.IsSaved -} - -// GetCanBeUpgraded returns value of CanBeUpgraded field. -func (u *UserGift) GetCanBeUpgraded() (value bool) { - if u == nil { - return - } - return u.CanBeUpgraded -} - -// GetCanBeTransferred returns value of CanBeTransferred field. -func (u *UserGift) GetCanBeTransferred() (value bool) { - if u == nil { - return - } - return u.CanBeTransferred -} - -// GetWasRefunded returns value of WasRefunded field. -func (u *UserGift) GetWasRefunded() (value bool) { - if u == nil { - return - } - return u.WasRefunded -} - -// GetDate returns value of Date field. -func (u *UserGift) GetDate() (value int32) { - if u == nil { - return - } - return u.Date -} - -// GetGift returns value of Gift field. -func (u *UserGift) GetGift() (value SentGiftClass) { - if u == nil { - return - } - return u.Gift -} - -// GetMessageID returns value of MessageID field. -func (u *UserGift) GetMessageID() (value int64) { - if u == nil { - return - } - return u.MessageID -} - -// GetSellStarCount returns value of SellStarCount field. -func (u *UserGift) GetSellStarCount() (value int64) { - if u == nil { - return - } - return u.SellStarCount -} - -// GetPrepaidUpgradeStarCount returns value of PrepaidUpgradeStarCount field. -func (u *UserGift) GetPrepaidUpgradeStarCount() (value int64) { - if u == nil { - return - } - return u.PrepaidUpgradeStarCount -} - -// GetTransferStarCount returns value of TransferStarCount field. -func (u *UserGift) GetTransferStarCount() (value int64) { - if u == nil { - return - } - return u.TransferStarCount -} - -// GetExportDate returns value of ExportDate field. -func (u *UserGift) GetExportDate() (value int32) { - if u == nil { - return - } - return u.ExportDate -} diff --git a/tdapi/tl_user_gifts_gen.go b/tdapi/tl_user_gifts_gen.go deleted file mode 100644 index 3853ba9f7..000000000 --- a/tdapi/tl_user_gifts_gen.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UserGifts represents TL type `userGifts#e274219f`. -type UserGifts struct { - // The total number of received gifts - TotalCount int32 - // The list of gifts - Gifts []UserGift - // The offset for the next request. If empty, then there are no more results - NextOffset string -} - -// UserGiftsTypeID is TL type id of UserGifts. -const UserGiftsTypeID = 0xe274219f - -// Ensuring interfaces in compile-time for UserGifts. -var ( - _ bin.Encoder = &UserGifts{} - _ bin.Decoder = &UserGifts{} - _ bin.BareEncoder = &UserGifts{} - _ bin.BareDecoder = &UserGifts{} -) - -func (u *UserGifts) Zero() bool { - if u == nil { - return true - } - if !(u.TotalCount == 0) { - return false - } - if !(u.Gifts == nil) { - return false - } - if !(u.NextOffset == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserGifts) String() string { - if u == nil { - return "UserGifts(nil)" - } - type Alias UserGifts - return fmt.Sprintf("UserGifts%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserGifts) TypeID() uint32 { - return UserGiftsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserGifts) TypeName() string { - return "userGifts" -} - -// TypeInfo returns info about TL type. -func (u *UserGifts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userGifts", - ID: UserGiftsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "Gifts", - SchemaName: "gifts", - }, - { - Name: "NextOffset", - SchemaName: "next_offset", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserGifts) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userGifts#e274219f as nil") - } - b.PutID(UserGiftsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserGifts) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userGifts#e274219f as nil") - } - b.PutInt32(u.TotalCount) - b.PutInt(len(u.Gifts)) - for idx, v := range u.Gifts { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare userGifts#e274219f: field gifts element with index %d: %w", idx, err) - } - } - b.PutString(u.NextOffset) - return nil -} - -// Decode implements bin.Decoder. -func (u *UserGifts) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userGifts#e274219f to nil") - } - if err := b.ConsumeID(UserGiftsTypeID); err != nil { - return fmt.Errorf("unable to decode userGifts#e274219f: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserGifts) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userGifts#e274219f to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userGifts#e274219f: field total_count: %w", err) - } - u.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode userGifts#e274219f: field gifts: %w", err) - } - - if headerLen > 0 { - u.Gifts = make([]UserGift, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value UserGift - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare userGifts#e274219f: field gifts: %w", err) - } - u.Gifts = append(u.Gifts, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode userGifts#e274219f: field next_offset: %w", err) - } - u.NextOffset = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserGifts) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userGifts#e274219f as nil") - } - b.ObjStart() - b.PutID("userGifts") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(u.TotalCount) - b.Comma() - b.FieldStart("gifts") - b.ArrStart() - for idx, v := range u.Gifts { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userGifts#e274219f: field gifts element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("next_offset") - b.PutString(u.NextOffset) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserGifts) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userGifts#e274219f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userGifts"); err != nil { - return fmt.Errorf("unable to decode userGifts#e274219f: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userGifts#e274219f: field total_count: %w", err) - } - u.TotalCount = value - case "gifts": - if err := b.Arr(func(b tdjson.Decoder) error { - var value UserGift - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userGifts#e274219f: field gifts: %w", err) - } - u.Gifts = append(u.Gifts, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode userGifts#e274219f: field gifts: %w", err) - } - case "next_offset": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode userGifts#e274219f: field next_offset: %w", err) - } - u.NextOffset = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (u *UserGifts) GetTotalCount() (value int32) { - if u == nil { - return - } - return u.TotalCount -} - -// GetGifts returns value of Gifts field. -func (u *UserGifts) GetGifts() (value []UserGift) { - if u == nil { - return - } - return u.Gifts -} - -// GetNextOffset returns value of NextOffset field. -func (u *UserGifts) GetNextOffset() (value string) { - if u == nil { - return - } - return u.NextOffset -} diff --git a/tdapi/tl_user_link_gen.go b/tdapi/tl_user_link_gen.go deleted file mode 100644 index 97ae64fed..000000000 --- a/tdapi/tl_user_link_gen.go +++ /dev/null @@ -1,228 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UserLink represents TL type `userLink#1db0fef8`. -type UserLink struct { - // The URL - URL string - // Left time for which the link is valid, in seconds; 0 if the link is a public username - // link - ExpiresIn int32 -} - -// UserLinkTypeID is TL type id of UserLink. -const UserLinkTypeID = 0x1db0fef8 - -// Ensuring interfaces in compile-time for UserLink. -var ( - _ bin.Encoder = &UserLink{} - _ bin.Decoder = &UserLink{} - _ bin.BareEncoder = &UserLink{} - _ bin.BareDecoder = &UserLink{} -) - -func (u *UserLink) Zero() bool { - if u == nil { - return true - } - if !(u.URL == "") { - return false - } - if !(u.ExpiresIn == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserLink) String() string { - if u == nil { - return "UserLink(nil)" - } - type Alias UserLink - return fmt.Sprintf("UserLink%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserLink) TypeID() uint32 { - return UserLinkTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserLink) TypeName() string { - return "userLink" -} - -// TypeInfo returns info about TL type. -func (u *UserLink) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userLink", - ID: UserLinkTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "URL", - SchemaName: "url", - }, - { - Name: "ExpiresIn", - SchemaName: "expires_in", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserLink) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userLink#1db0fef8 as nil") - } - b.PutID(UserLinkTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserLink) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userLink#1db0fef8 as nil") - } - b.PutString(u.URL) - b.PutInt32(u.ExpiresIn) - return nil -} - -// Decode implements bin.Decoder. -func (u *UserLink) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userLink#1db0fef8 to nil") - } - if err := b.ConsumeID(UserLinkTypeID); err != nil { - return fmt.Errorf("unable to decode userLink#1db0fef8: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserLink) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userLink#1db0fef8 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode userLink#1db0fef8: field url: %w", err) - } - u.URL = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userLink#1db0fef8: field expires_in: %w", err) - } - u.ExpiresIn = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserLink) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userLink#1db0fef8 as nil") - } - b.ObjStart() - b.PutID("userLink") - b.Comma() - b.FieldStart("url") - b.PutString(u.URL) - b.Comma() - b.FieldStart("expires_in") - b.PutInt32(u.ExpiresIn) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserLink) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userLink#1db0fef8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userLink"); err != nil { - return fmt.Errorf("unable to decode userLink#1db0fef8: %w", err) - } - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode userLink#1db0fef8: field url: %w", err) - } - u.URL = value - case "expires_in": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userLink#1db0fef8: field expires_in: %w", err) - } - u.ExpiresIn = value - default: - return b.Skip() - } - return nil - }) -} - -// GetURL returns value of URL field. -func (u *UserLink) GetURL() (value string) { - if u == nil { - return - } - return u.URL -} - -// GetExpiresIn returns value of ExpiresIn field. -func (u *UserLink) GetExpiresIn() (value int32) { - if u == nil { - return - } - return u.ExpiresIn -} diff --git a/tdapi/tl_user_privacy_setting_gen.go b/tdapi/tl_user_privacy_setting_gen.go deleted file mode 100644 index ec908f764..000000000 --- a/tdapi/tl_user_privacy_setting_gen.go +++ /dev/null @@ -1,1893 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UserPrivacySettingShowStatus represents TL type `userPrivacySettingShowStatus#6f0884fe`. -type UserPrivacySettingShowStatus struct { -} - -// UserPrivacySettingShowStatusTypeID is TL type id of UserPrivacySettingShowStatus. -const UserPrivacySettingShowStatusTypeID = 0x6f0884fe - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingShowStatus) construct() UserPrivacySettingClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingShowStatus. -var ( - _ bin.Encoder = &UserPrivacySettingShowStatus{} - _ bin.Decoder = &UserPrivacySettingShowStatus{} - _ bin.BareEncoder = &UserPrivacySettingShowStatus{} - _ bin.BareDecoder = &UserPrivacySettingShowStatus{} - - _ UserPrivacySettingClass = &UserPrivacySettingShowStatus{} -) - -func (u *UserPrivacySettingShowStatus) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingShowStatus) String() string { - if u == nil { - return "UserPrivacySettingShowStatus(nil)" - } - type Alias UserPrivacySettingShowStatus - return fmt.Sprintf("UserPrivacySettingShowStatus%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingShowStatus) TypeID() uint32 { - return UserPrivacySettingShowStatusTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingShowStatus) TypeName() string { - return "userPrivacySettingShowStatus" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingShowStatus) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingShowStatus", - ID: UserPrivacySettingShowStatusTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingShowStatus) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowStatus#6f0884fe as nil") - } - b.PutID(UserPrivacySettingShowStatusTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingShowStatus) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowStatus#6f0884fe as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingShowStatus) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowStatus#6f0884fe to nil") - } - if err := b.ConsumeID(UserPrivacySettingShowStatusTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowStatus#6f0884fe: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingShowStatus) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowStatus#6f0884fe to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingShowStatus) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowStatus#6f0884fe as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingShowStatus") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingShowStatus) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowStatus#6f0884fe to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingShowStatus"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowStatus#6f0884fe: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingShowProfilePhoto represents TL type `userPrivacySettingShowProfilePhoto#53f3c9f5`. -type UserPrivacySettingShowProfilePhoto struct { -} - -// UserPrivacySettingShowProfilePhotoTypeID is TL type id of UserPrivacySettingShowProfilePhoto. -const UserPrivacySettingShowProfilePhotoTypeID = 0x53f3c9f5 - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingShowProfilePhoto) construct() UserPrivacySettingClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingShowProfilePhoto. -var ( - _ bin.Encoder = &UserPrivacySettingShowProfilePhoto{} - _ bin.Decoder = &UserPrivacySettingShowProfilePhoto{} - _ bin.BareEncoder = &UserPrivacySettingShowProfilePhoto{} - _ bin.BareDecoder = &UserPrivacySettingShowProfilePhoto{} - - _ UserPrivacySettingClass = &UserPrivacySettingShowProfilePhoto{} -) - -func (u *UserPrivacySettingShowProfilePhoto) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingShowProfilePhoto) String() string { - if u == nil { - return "UserPrivacySettingShowProfilePhoto(nil)" - } - type Alias UserPrivacySettingShowProfilePhoto - return fmt.Sprintf("UserPrivacySettingShowProfilePhoto%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingShowProfilePhoto) TypeID() uint32 { - return UserPrivacySettingShowProfilePhotoTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingShowProfilePhoto) TypeName() string { - return "userPrivacySettingShowProfilePhoto" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingShowProfilePhoto) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingShowProfilePhoto", - ID: UserPrivacySettingShowProfilePhotoTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingShowProfilePhoto) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowProfilePhoto#53f3c9f5 as nil") - } - b.PutID(UserPrivacySettingShowProfilePhotoTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingShowProfilePhoto) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowProfilePhoto#53f3c9f5 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingShowProfilePhoto) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowProfilePhoto#53f3c9f5 to nil") - } - if err := b.ConsumeID(UserPrivacySettingShowProfilePhotoTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowProfilePhoto#53f3c9f5: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingShowProfilePhoto) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowProfilePhoto#53f3c9f5 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingShowProfilePhoto) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowProfilePhoto#53f3c9f5 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingShowProfilePhoto") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingShowProfilePhoto) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowProfilePhoto#53f3c9f5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingShowProfilePhoto"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowProfilePhoto#53f3c9f5: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingShowLinkInForwardedMessages represents TL type `userPrivacySettingShowLinkInForwardedMessages#2353b6e6`. -type UserPrivacySettingShowLinkInForwardedMessages struct { -} - -// UserPrivacySettingShowLinkInForwardedMessagesTypeID is TL type id of UserPrivacySettingShowLinkInForwardedMessages. -const UserPrivacySettingShowLinkInForwardedMessagesTypeID = 0x2353b6e6 - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingShowLinkInForwardedMessages) construct() UserPrivacySettingClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingShowLinkInForwardedMessages. -var ( - _ bin.Encoder = &UserPrivacySettingShowLinkInForwardedMessages{} - _ bin.Decoder = &UserPrivacySettingShowLinkInForwardedMessages{} - _ bin.BareEncoder = &UserPrivacySettingShowLinkInForwardedMessages{} - _ bin.BareDecoder = &UserPrivacySettingShowLinkInForwardedMessages{} - - _ UserPrivacySettingClass = &UserPrivacySettingShowLinkInForwardedMessages{} -) - -func (u *UserPrivacySettingShowLinkInForwardedMessages) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingShowLinkInForwardedMessages) String() string { - if u == nil { - return "UserPrivacySettingShowLinkInForwardedMessages(nil)" - } - type Alias UserPrivacySettingShowLinkInForwardedMessages - return fmt.Sprintf("UserPrivacySettingShowLinkInForwardedMessages%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingShowLinkInForwardedMessages) TypeID() uint32 { - return UserPrivacySettingShowLinkInForwardedMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingShowLinkInForwardedMessages) TypeName() string { - return "userPrivacySettingShowLinkInForwardedMessages" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingShowLinkInForwardedMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingShowLinkInForwardedMessages", - ID: UserPrivacySettingShowLinkInForwardedMessagesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingShowLinkInForwardedMessages) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 as nil") - } - b.PutID(UserPrivacySettingShowLinkInForwardedMessagesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingShowLinkInForwardedMessages) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingShowLinkInForwardedMessages) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 to nil") - } - if err := b.ConsumeID(UserPrivacySettingShowLinkInForwardedMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowLinkInForwardedMessages#2353b6e6: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingShowLinkInForwardedMessages) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingShowLinkInForwardedMessages) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingShowLinkInForwardedMessages") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingShowLinkInForwardedMessages) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowLinkInForwardedMessages#2353b6e6 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingShowLinkInForwardedMessages"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowLinkInForwardedMessages#2353b6e6: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingShowPhoneNumber represents TL type `userPrivacySettingShowPhoneNumber#d0d1a229`. -type UserPrivacySettingShowPhoneNumber struct { -} - -// UserPrivacySettingShowPhoneNumberTypeID is TL type id of UserPrivacySettingShowPhoneNumber. -const UserPrivacySettingShowPhoneNumberTypeID = 0xd0d1a229 - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingShowPhoneNumber) construct() UserPrivacySettingClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingShowPhoneNumber. -var ( - _ bin.Encoder = &UserPrivacySettingShowPhoneNumber{} - _ bin.Decoder = &UserPrivacySettingShowPhoneNumber{} - _ bin.BareEncoder = &UserPrivacySettingShowPhoneNumber{} - _ bin.BareDecoder = &UserPrivacySettingShowPhoneNumber{} - - _ UserPrivacySettingClass = &UserPrivacySettingShowPhoneNumber{} -) - -func (u *UserPrivacySettingShowPhoneNumber) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingShowPhoneNumber) String() string { - if u == nil { - return "UserPrivacySettingShowPhoneNumber(nil)" - } - type Alias UserPrivacySettingShowPhoneNumber - return fmt.Sprintf("UserPrivacySettingShowPhoneNumber%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingShowPhoneNumber) TypeID() uint32 { - return UserPrivacySettingShowPhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingShowPhoneNumber) TypeName() string { - return "userPrivacySettingShowPhoneNumber" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingShowPhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingShowPhoneNumber", - ID: UserPrivacySettingShowPhoneNumberTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingShowPhoneNumber) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowPhoneNumber#d0d1a229 as nil") - } - b.PutID(UserPrivacySettingShowPhoneNumberTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingShowPhoneNumber) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowPhoneNumber#d0d1a229 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingShowPhoneNumber) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowPhoneNumber#d0d1a229 to nil") - } - if err := b.ConsumeID(UserPrivacySettingShowPhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowPhoneNumber#d0d1a229: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingShowPhoneNumber) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowPhoneNumber#d0d1a229 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingShowPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowPhoneNumber#d0d1a229 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingShowPhoneNumber") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingShowPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowPhoneNumber#d0d1a229 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingShowPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowPhoneNumber#d0d1a229: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingShowBio represents TL type `userPrivacySettingShowBio#39382761`. -type UserPrivacySettingShowBio struct { -} - -// UserPrivacySettingShowBioTypeID is TL type id of UserPrivacySettingShowBio. -const UserPrivacySettingShowBioTypeID = 0x39382761 - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingShowBio) construct() UserPrivacySettingClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingShowBio. -var ( - _ bin.Encoder = &UserPrivacySettingShowBio{} - _ bin.Decoder = &UserPrivacySettingShowBio{} - _ bin.BareEncoder = &UserPrivacySettingShowBio{} - _ bin.BareDecoder = &UserPrivacySettingShowBio{} - - _ UserPrivacySettingClass = &UserPrivacySettingShowBio{} -) - -func (u *UserPrivacySettingShowBio) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingShowBio) String() string { - if u == nil { - return "UserPrivacySettingShowBio(nil)" - } - type Alias UserPrivacySettingShowBio - return fmt.Sprintf("UserPrivacySettingShowBio%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingShowBio) TypeID() uint32 { - return UserPrivacySettingShowBioTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingShowBio) TypeName() string { - return "userPrivacySettingShowBio" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingShowBio) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingShowBio", - ID: UserPrivacySettingShowBioTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingShowBio) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowBio#39382761 as nil") - } - b.PutID(UserPrivacySettingShowBioTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingShowBio) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowBio#39382761 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingShowBio) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowBio#39382761 to nil") - } - if err := b.ConsumeID(UserPrivacySettingShowBioTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowBio#39382761: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingShowBio) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowBio#39382761 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingShowBio) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowBio#39382761 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingShowBio") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingShowBio) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowBio#39382761 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingShowBio"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowBio#39382761: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingShowBirthdate represents TL type `userPrivacySettingShowBirthdate#4596b4df`. -type UserPrivacySettingShowBirthdate struct { -} - -// UserPrivacySettingShowBirthdateTypeID is TL type id of UserPrivacySettingShowBirthdate. -const UserPrivacySettingShowBirthdateTypeID = 0x4596b4df - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingShowBirthdate) construct() UserPrivacySettingClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingShowBirthdate. -var ( - _ bin.Encoder = &UserPrivacySettingShowBirthdate{} - _ bin.Decoder = &UserPrivacySettingShowBirthdate{} - _ bin.BareEncoder = &UserPrivacySettingShowBirthdate{} - _ bin.BareDecoder = &UserPrivacySettingShowBirthdate{} - - _ UserPrivacySettingClass = &UserPrivacySettingShowBirthdate{} -) - -func (u *UserPrivacySettingShowBirthdate) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingShowBirthdate) String() string { - if u == nil { - return "UserPrivacySettingShowBirthdate(nil)" - } - type Alias UserPrivacySettingShowBirthdate - return fmt.Sprintf("UserPrivacySettingShowBirthdate%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingShowBirthdate) TypeID() uint32 { - return UserPrivacySettingShowBirthdateTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingShowBirthdate) TypeName() string { - return "userPrivacySettingShowBirthdate" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingShowBirthdate) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingShowBirthdate", - ID: UserPrivacySettingShowBirthdateTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingShowBirthdate) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowBirthdate#4596b4df as nil") - } - b.PutID(UserPrivacySettingShowBirthdateTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingShowBirthdate) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowBirthdate#4596b4df as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingShowBirthdate) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowBirthdate#4596b4df to nil") - } - if err := b.ConsumeID(UserPrivacySettingShowBirthdateTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowBirthdate#4596b4df: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingShowBirthdate) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowBirthdate#4596b4df to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingShowBirthdate) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingShowBirthdate#4596b4df as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingShowBirthdate") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingShowBirthdate) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingShowBirthdate#4596b4df to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingShowBirthdate"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingShowBirthdate#4596b4df: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingAllowChatInvites represents TL type `userPrivacySettingAllowChatInvites#4bcc1d27`. -type UserPrivacySettingAllowChatInvites struct { -} - -// UserPrivacySettingAllowChatInvitesTypeID is TL type id of UserPrivacySettingAllowChatInvites. -const UserPrivacySettingAllowChatInvitesTypeID = 0x4bcc1d27 - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingAllowChatInvites) construct() UserPrivacySettingClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingAllowChatInvites. -var ( - _ bin.Encoder = &UserPrivacySettingAllowChatInvites{} - _ bin.Decoder = &UserPrivacySettingAllowChatInvites{} - _ bin.BareEncoder = &UserPrivacySettingAllowChatInvites{} - _ bin.BareDecoder = &UserPrivacySettingAllowChatInvites{} - - _ UserPrivacySettingClass = &UserPrivacySettingAllowChatInvites{} -) - -func (u *UserPrivacySettingAllowChatInvites) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingAllowChatInvites) String() string { - if u == nil { - return "UserPrivacySettingAllowChatInvites(nil)" - } - type Alias UserPrivacySettingAllowChatInvites - return fmt.Sprintf("UserPrivacySettingAllowChatInvites%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingAllowChatInvites) TypeID() uint32 { - return UserPrivacySettingAllowChatInvitesTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingAllowChatInvites) TypeName() string { - return "userPrivacySettingAllowChatInvites" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingAllowChatInvites) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingAllowChatInvites", - ID: UserPrivacySettingAllowChatInvitesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingAllowChatInvites) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowChatInvites#4bcc1d27 as nil") - } - b.PutID(UserPrivacySettingAllowChatInvitesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingAllowChatInvites) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowChatInvites#4bcc1d27 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingAllowChatInvites) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowChatInvites#4bcc1d27 to nil") - } - if err := b.ConsumeID(UserPrivacySettingAllowChatInvitesTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAllowChatInvites#4bcc1d27: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingAllowChatInvites) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowChatInvites#4bcc1d27 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingAllowChatInvites) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowChatInvites#4bcc1d27 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingAllowChatInvites") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingAllowChatInvites) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowChatInvites#4bcc1d27 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingAllowChatInvites"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAllowChatInvites#4bcc1d27: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingAllowCalls represents TL type `userPrivacySettingAllowCalls#c9f0c705`. -type UserPrivacySettingAllowCalls struct { -} - -// UserPrivacySettingAllowCallsTypeID is TL type id of UserPrivacySettingAllowCalls. -const UserPrivacySettingAllowCallsTypeID = 0xc9f0c705 - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingAllowCalls) construct() UserPrivacySettingClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingAllowCalls. -var ( - _ bin.Encoder = &UserPrivacySettingAllowCalls{} - _ bin.Decoder = &UserPrivacySettingAllowCalls{} - _ bin.BareEncoder = &UserPrivacySettingAllowCalls{} - _ bin.BareDecoder = &UserPrivacySettingAllowCalls{} - - _ UserPrivacySettingClass = &UserPrivacySettingAllowCalls{} -) - -func (u *UserPrivacySettingAllowCalls) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingAllowCalls) String() string { - if u == nil { - return "UserPrivacySettingAllowCalls(nil)" - } - type Alias UserPrivacySettingAllowCalls - return fmt.Sprintf("UserPrivacySettingAllowCalls%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingAllowCalls) TypeID() uint32 { - return UserPrivacySettingAllowCallsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingAllowCalls) TypeName() string { - return "userPrivacySettingAllowCalls" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingAllowCalls) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingAllowCalls", - ID: UserPrivacySettingAllowCallsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingAllowCalls) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowCalls#c9f0c705 as nil") - } - b.PutID(UserPrivacySettingAllowCallsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingAllowCalls) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowCalls#c9f0c705 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingAllowCalls) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowCalls#c9f0c705 to nil") - } - if err := b.ConsumeID(UserPrivacySettingAllowCallsTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAllowCalls#c9f0c705: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingAllowCalls) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowCalls#c9f0c705 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingAllowCalls) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowCalls#c9f0c705 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingAllowCalls") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingAllowCalls) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowCalls#c9f0c705 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingAllowCalls"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAllowCalls#c9f0c705: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingAllowPeerToPeerCalls represents TL type `userPrivacySettingAllowPeerToPeerCalls#1502b940`. -type UserPrivacySettingAllowPeerToPeerCalls struct { -} - -// UserPrivacySettingAllowPeerToPeerCallsTypeID is TL type id of UserPrivacySettingAllowPeerToPeerCalls. -const UserPrivacySettingAllowPeerToPeerCallsTypeID = 0x1502b940 - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingAllowPeerToPeerCalls) construct() UserPrivacySettingClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingAllowPeerToPeerCalls. -var ( - _ bin.Encoder = &UserPrivacySettingAllowPeerToPeerCalls{} - _ bin.Decoder = &UserPrivacySettingAllowPeerToPeerCalls{} - _ bin.BareEncoder = &UserPrivacySettingAllowPeerToPeerCalls{} - _ bin.BareDecoder = &UserPrivacySettingAllowPeerToPeerCalls{} - - _ UserPrivacySettingClass = &UserPrivacySettingAllowPeerToPeerCalls{} -) - -func (u *UserPrivacySettingAllowPeerToPeerCalls) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingAllowPeerToPeerCalls) String() string { - if u == nil { - return "UserPrivacySettingAllowPeerToPeerCalls(nil)" - } - type Alias UserPrivacySettingAllowPeerToPeerCalls - return fmt.Sprintf("UserPrivacySettingAllowPeerToPeerCalls%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingAllowPeerToPeerCalls) TypeID() uint32 { - return UserPrivacySettingAllowPeerToPeerCallsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingAllowPeerToPeerCalls) TypeName() string { - return "userPrivacySettingAllowPeerToPeerCalls" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingAllowPeerToPeerCalls) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingAllowPeerToPeerCalls", - ID: UserPrivacySettingAllowPeerToPeerCallsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingAllowPeerToPeerCalls) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowPeerToPeerCalls#1502b940 as nil") - } - b.PutID(UserPrivacySettingAllowPeerToPeerCallsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingAllowPeerToPeerCalls) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowPeerToPeerCalls#1502b940 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingAllowPeerToPeerCalls) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowPeerToPeerCalls#1502b940 to nil") - } - if err := b.ConsumeID(UserPrivacySettingAllowPeerToPeerCallsTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAllowPeerToPeerCalls#1502b940: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingAllowPeerToPeerCalls) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowPeerToPeerCalls#1502b940 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingAllowPeerToPeerCalls) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowPeerToPeerCalls#1502b940 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingAllowPeerToPeerCalls") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingAllowPeerToPeerCalls) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowPeerToPeerCalls#1502b940 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingAllowPeerToPeerCalls"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAllowPeerToPeerCalls#1502b940: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingAllowFindingByPhoneNumber represents TL type `userPrivacySettingAllowFindingByPhoneNumber#91ee6d51`. -type UserPrivacySettingAllowFindingByPhoneNumber struct { -} - -// UserPrivacySettingAllowFindingByPhoneNumberTypeID is TL type id of UserPrivacySettingAllowFindingByPhoneNumber. -const UserPrivacySettingAllowFindingByPhoneNumberTypeID = 0x91ee6d51 - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingAllowFindingByPhoneNumber) construct() UserPrivacySettingClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingAllowFindingByPhoneNumber. -var ( - _ bin.Encoder = &UserPrivacySettingAllowFindingByPhoneNumber{} - _ bin.Decoder = &UserPrivacySettingAllowFindingByPhoneNumber{} - _ bin.BareEncoder = &UserPrivacySettingAllowFindingByPhoneNumber{} - _ bin.BareDecoder = &UserPrivacySettingAllowFindingByPhoneNumber{} - - _ UserPrivacySettingClass = &UserPrivacySettingAllowFindingByPhoneNumber{} -) - -func (u *UserPrivacySettingAllowFindingByPhoneNumber) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingAllowFindingByPhoneNumber) String() string { - if u == nil { - return "UserPrivacySettingAllowFindingByPhoneNumber(nil)" - } - type Alias UserPrivacySettingAllowFindingByPhoneNumber - return fmt.Sprintf("UserPrivacySettingAllowFindingByPhoneNumber%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingAllowFindingByPhoneNumber) TypeID() uint32 { - return UserPrivacySettingAllowFindingByPhoneNumberTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingAllowFindingByPhoneNumber) TypeName() string { - return "userPrivacySettingAllowFindingByPhoneNumber" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingAllowFindingByPhoneNumber) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingAllowFindingByPhoneNumber", - ID: UserPrivacySettingAllowFindingByPhoneNumberTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingAllowFindingByPhoneNumber) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 as nil") - } - b.PutID(UserPrivacySettingAllowFindingByPhoneNumberTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingAllowFindingByPhoneNumber) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingAllowFindingByPhoneNumber) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 to nil") - } - if err := b.ConsumeID(UserPrivacySettingAllowFindingByPhoneNumberTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingAllowFindingByPhoneNumber) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingAllowFindingByPhoneNumber) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingAllowFindingByPhoneNumber") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingAllowFindingByPhoneNumber) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingAllowFindingByPhoneNumber"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAllowFindingByPhoneNumber#91ee6d51: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages represents TL type `userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c`. -type UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages struct { -} - -// UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID is TL type id of UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages. -const UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID = 0x14272e3c - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) construct() UserPrivacySettingClass { - return &u -} - -// Ensuring interfaces in compile-time for UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages. -var ( - _ bin.Encoder = &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} - _ bin.Decoder = &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} - _ bin.BareEncoder = &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} - _ bin.BareDecoder = &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} - - _ UserPrivacySettingClass = &UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} -) - -func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) String() string { - if u == nil { - return "UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(nil)" - } - type Alias UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages - return fmt.Sprintf("UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) TypeID() uint32 { - return UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) TypeName() string { - return "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages", - ID: UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c as nil") - } - b.PutID(UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c to nil") - } - if err := b.ConsumeID(UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingAutosaveGifts represents TL type `userPrivacySettingAutosaveGifts#709a69cd`. -type UserPrivacySettingAutosaveGifts struct { -} - -// UserPrivacySettingAutosaveGiftsTypeID is TL type id of UserPrivacySettingAutosaveGifts. -const UserPrivacySettingAutosaveGiftsTypeID = 0x709a69cd - -// construct implements constructor of UserPrivacySettingClass. -func (u UserPrivacySettingAutosaveGifts) construct() UserPrivacySettingClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingAutosaveGifts. -var ( - _ bin.Encoder = &UserPrivacySettingAutosaveGifts{} - _ bin.Decoder = &UserPrivacySettingAutosaveGifts{} - _ bin.BareEncoder = &UserPrivacySettingAutosaveGifts{} - _ bin.BareDecoder = &UserPrivacySettingAutosaveGifts{} - - _ UserPrivacySettingClass = &UserPrivacySettingAutosaveGifts{} -) - -func (u *UserPrivacySettingAutosaveGifts) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingAutosaveGifts) String() string { - if u == nil { - return "UserPrivacySettingAutosaveGifts(nil)" - } - type Alias UserPrivacySettingAutosaveGifts - return fmt.Sprintf("UserPrivacySettingAutosaveGifts%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingAutosaveGifts) TypeID() uint32 { - return UserPrivacySettingAutosaveGiftsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingAutosaveGifts) TypeName() string { - return "userPrivacySettingAutosaveGifts" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingAutosaveGifts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingAutosaveGifts", - ID: UserPrivacySettingAutosaveGiftsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingAutosaveGifts) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAutosaveGifts#709a69cd as nil") - } - b.PutID(UserPrivacySettingAutosaveGiftsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingAutosaveGifts) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAutosaveGifts#709a69cd as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingAutosaveGifts) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAutosaveGifts#709a69cd to nil") - } - if err := b.ConsumeID(UserPrivacySettingAutosaveGiftsTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAutosaveGifts#709a69cd: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingAutosaveGifts) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAutosaveGifts#709a69cd to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingAutosaveGifts) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingAutosaveGifts#709a69cd as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingAutosaveGifts") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingAutosaveGifts) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingAutosaveGifts#709a69cd to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingAutosaveGifts"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingAutosaveGifts#709a69cd: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingClassName is schema name of UserPrivacySettingClass. -const UserPrivacySettingClassName = "UserPrivacySetting" - -// UserPrivacySettingClass represents UserPrivacySetting generic type. -// -// Example: -// -// g, err := tdapi.DecodeUserPrivacySetting(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.UserPrivacySettingShowStatus: // userPrivacySettingShowStatus#6f0884fe -// case *tdapi.UserPrivacySettingShowProfilePhoto: // userPrivacySettingShowProfilePhoto#53f3c9f5 -// case *tdapi.UserPrivacySettingShowLinkInForwardedMessages: // userPrivacySettingShowLinkInForwardedMessages#2353b6e6 -// case *tdapi.UserPrivacySettingShowPhoneNumber: // userPrivacySettingShowPhoneNumber#d0d1a229 -// case *tdapi.UserPrivacySettingShowBio: // userPrivacySettingShowBio#39382761 -// case *tdapi.UserPrivacySettingShowBirthdate: // userPrivacySettingShowBirthdate#4596b4df -// case *tdapi.UserPrivacySettingAllowChatInvites: // userPrivacySettingAllowChatInvites#4bcc1d27 -// case *tdapi.UserPrivacySettingAllowCalls: // userPrivacySettingAllowCalls#c9f0c705 -// case *tdapi.UserPrivacySettingAllowPeerToPeerCalls: // userPrivacySettingAllowPeerToPeerCalls#1502b940 -// case *tdapi.UserPrivacySettingAllowFindingByPhoneNumber: // userPrivacySettingAllowFindingByPhoneNumber#91ee6d51 -// case *tdapi.UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages: // userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c -// case *tdapi.UserPrivacySettingAutosaveGifts: // userPrivacySettingAutosaveGifts#709a69cd -// default: panic(v) -// } -type UserPrivacySettingClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() UserPrivacySettingClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeUserPrivacySetting implements binary de-serialization for UserPrivacySettingClass. -func DecodeUserPrivacySetting(buf *bin.Buffer) (UserPrivacySettingClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case UserPrivacySettingShowStatusTypeID: - // Decoding userPrivacySettingShowStatus#6f0884fe. - v := UserPrivacySettingShowStatus{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case UserPrivacySettingShowProfilePhotoTypeID: - // Decoding userPrivacySettingShowProfilePhoto#53f3c9f5. - v := UserPrivacySettingShowProfilePhoto{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case UserPrivacySettingShowLinkInForwardedMessagesTypeID: - // Decoding userPrivacySettingShowLinkInForwardedMessages#2353b6e6. - v := UserPrivacySettingShowLinkInForwardedMessages{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case UserPrivacySettingShowPhoneNumberTypeID: - // Decoding userPrivacySettingShowPhoneNumber#d0d1a229. - v := UserPrivacySettingShowPhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case UserPrivacySettingShowBioTypeID: - // Decoding userPrivacySettingShowBio#39382761. - v := UserPrivacySettingShowBio{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case UserPrivacySettingShowBirthdateTypeID: - // Decoding userPrivacySettingShowBirthdate#4596b4df. - v := UserPrivacySettingShowBirthdate{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case UserPrivacySettingAllowChatInvitesTypeID: - // Decoding userPrivacySettingAllowChatInvites#4bcc1d27. - v := UserPrivacySettingAllowChatInvites{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case UserPrivacySettingAllowCallsTypeID: - // Decoding userPrivacySettingAllowCalls#c9f0c705. - v := UserPrivacySettingAllowCalls{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case UserPrivacySettingAllowPeerToPeerCallsTypeID: - // Decoding userPrivacySettingAllowPeerToPeerCalls#1502b940. - v := UserPrivacySettingAllowPeerToPeerCalls{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case UserPrivacySettingAllowFindingByPhoneNumberTypeID: - // Decoding userPrivacySettingAllowFindingByPhoneNumber#91ee6d51. - v := UserPrivacySettingAllowFindingByPhoneNumber{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessagesTypeID: - // Decoding userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c. - v := UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case UserPrivacySettingAutosaveGiftsTypeID: - // Decoding userPrivacySettingAutosaveGifts#709a69cd. - v := UserPrivacySettingAutosaveGifts{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONUserPrivacySetting implements binary de-serialization for UserPrivacySettingClass. -func DecodeTDLibJSONUserPrivacySetting(buf tdjson.Decoder) (UserPrivacySettingClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "userPrivacySettingShowStatus": - // Decoding userPrivacySettingShowStatus#6f0884fe. - v := UserPrivacySettingShowStatus{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case "userPrivacySettingShowProfilePhoto": - // Decoding userPrivacySettingShowProfilePhoto#53f3c9f5. - v := UserPrivacySettingShowProfilePhoto{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case "userPrivacySettingShowLinkInForwardedMessages": - // Decoding userPrivacySettingShowLinkInForwardedMessages#2353b6e6. - v := UserPrivacySettingShowLinkInForwardedMessages{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case "userPrivacySettingShowPhoneNumber": - // Decoding userPrivacySettingShowPhoneNumber#d0d1a229. - v := UserPrivacySettingShowPhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case "userPrivacySettingShowBio": - // Decoding userPrivacySettingShowBio#39382761. - v := UserPrivacySettingShowBio{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case "userPrivacySettingShowBirthdate": - // Decoding userPrivacySettingShowBirthdate#4596b4df. - v := UserPrivacySettingShowBirthdate{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case "userPrivacySettingAllowChatInvites": - // Decoding userPrivacySettingAllowChatInvites#4bcc1d27. - v := UserPrivacySettingAllowChatInvites{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case "userPrivacySettingAllowCalls": - // Decoding userPrivacySettingAllowCalls#c9f0c705. - v := UserPrivacySettingAllowCalls{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case "userPrivacySettingAllowPeerToPeerCalls": - // Decoding userPrivacySettingAllowPeerToPeerCalls#1502b940. - v := UserPrivacySettingAllowPeerToPeerCalls{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case "userPrivacySettingAllowFindingByPhoneNumber": - // Decoding userPrivacySettingAllowFindingByPhoneNumber#91ee6d51. - v := UserPrivacySettingAllowFindingByPhoneNumber{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages": - // Decoding userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages#14272e3c. - v := UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - case "userPrivacySettingAutosaveGifts": - // Decoding userPrivacySettingAutosaveGifts#709a69cd. - v := UserPrivacySettingAutosaveGifts{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode UserPrivacySettingClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// UserPrivacySetting boxes the UserPrivacySettingClass providing a helper. -type UserPrivacySettingBox struct { - UserPrivacySetting UserPrivacySettingClass -} - -// Decode implements bin.Decoder for UserPrivacySettingBox. -func (b *UserPrivacySettingBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode UserPrivacySettingBox to nil") - } - v, err := DecodeUserPrivacySetting(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.UserPrivacySetting = v - return nil -} - -// Encode implements bin.Encode for UserPrivacySettingBox. -func (b *UserPrivacySettingBox) Encode(buf *bin.Buffer) error { - if b == nil || b.UserPrivacySetting == nil { - return fmt.Errorf("unable to encode UserPrivacySettingClass as nil") - } - return b.UserPrivacySetting.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for UserPrivacySettingBox. -func (b *UserPrivacySettingBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode UserPrivacySettingBox to nil") - } - v, err := DecodeTDLibJSONUserPrivacySetting(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.UserPrivacySetting = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for UserPrivacySettingBox. -func (b *UserPrivacySettingBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.UserPrivacySetting == nil { - return fmt.Errorf("unable to encode UserPrivacySettingClass as nil") - } - return b.UserPrivacySetting.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_user_privacy_setting_rule_gen.go b/tdapi/tl_user_privacy_setting_rule_gen.go deleted file mode 100644 index d35ee63c4..000000000 --- a/tdapi/tl_user_privacy_setting_rule_gen.go +++ /dev/null @@ -1,1981 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UserPrivacySettingRuleAllowAll represents TL type `userPrivacySettingRuleAllowAll#8abf1c3f`. -type UserPrivacySettingRuleAllowAll struct { -} - -// UserPrivacySettingRuleAllowAllTypeID is TL type id of UserPrivacySettingRuleAllowAll. -const UserPrivacySettingRuleAllowAllTypeID = 0x8abf1c3f - -// construct implements constructor of UserPrivacySettingRuleClass. -func (u UserPrivacySettingRuleAllowAll) construct() UserPrivacySettingRuleClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingRuleAllowAll. -var ( - _ bin.Encoder = &UserPrivacySettingRuleAllowAll{} - _ bin.Decoder = &UserPrivacySettingRuleAllowAll{} - _ bin.BareEncoder = &UserPrivacySettingRuleAllowAll{} - _ bin.BareDecoder = &UserPrivacySettingRuleAllowAll{} - - _ UserPrivacySettingRuleClass = &UserPrivacySettingRuleAllowAll{} -) - -func (u *UserPrivacySettingRuleAllowAll) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRuleAllowAll) String() string { - if u == nil { - return "UserPrivacySettingRuleAllowAll(nil)" - } - type Alias UserPrivacySettingRuleAllowAll - return fmt.Sprintf("UserPrivacySettingRuleAllowAll%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRuleAllowAll) TypeID() uint32 { - return UserPrivacySettingRuleAllowAllTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRuleAllowAll) TypeName() string { - return "userPrivacySettingRuleAllowAll" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRuleAllowAll) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRuleAllowAll", - ID: UserPrivacySettingRuleAllowAllTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRuleAllowAll) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowAll#8abf1c3f as nil") - } - b.PutID(UserPrivacySettingRuleAllowAllTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRuleAllowAll) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowAll#8abf1c3f as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRuleAllowAll) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowAll#8abf1c3f to nil") - } - if err := b.ConsumeID(UserPrivacySettingRuleAllowAllTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowAll#8abf1c3f: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRuleAllowAll) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowAll#8abf1c3f to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRuleAllowAll) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowAll#8abf1c3f as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRuleAllowAll") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRuleAllowAll) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowAll#8abf1c3f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRuleAllowAll"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowAll#8abf1c3f: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingRuleAllowContacts represents TL type `userPrivacySettingRuleAllowContacts#8f2f2d10`. -type UserPrivacySettingRuleAllowContacts struct { -} - -// UserPrivacySettingRuleAllowContactsTypeID is TL type id of UserPrivacySettingRuleAllowContacts. -const UserPrivacySettingRuleAllowContactsTypeID = 0x8f2f2d10 - -// construct implements constructor of UserPrivacySettingRuleClass. -func (u UserPrivacySettingRuleAllowContacts) construct() UserPrivacySettingRuleClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingRuleAllowContacts. -var ( - _ bin.Encoder = &UserPrivacySettingRuleAllowContacts{} - _ bin.Decoder = &UserPrivacySettingRuleAllowContacts{} - _ bin.BareEncoder = &UserPrivacySettingRuleAllowContacts{} - _ bin.BareDecoder = &UserPrivacySettingRuleAllowContacts{} - - _ UserPrivacySettingRuleClass = &UserPrivacySettingRuleAllowContacts{} -) - -func (u *UserPrivacySettingRuleAllowContacts) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRuleAllowContacts) String() string { - if u == nil { - return "UserPrivacySettingRuleAllowContacts(nil)" - } - type Alias UserPrivacySettingRuleAllowContacts - return fmt.Sprintf("UserPrivacySettingRuleAllowContacts%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRuleAllowContacts) TypeID() uint32 { - return UserPrivacySettingRuleAllowContactsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRuleAllowContacts) TypeName() string { - return "userPrivacySettingRuleAllowContacts" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRuleAllowContacts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRuleAllowContacts", - ID: UserPrivacySettingRuleAllowContactsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRuleAllowContacts) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowContacts#8f2f2d10 as nil") - } - b.PutID(UserPrivacySettingRuleAllowContactsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRuleAllowContacts) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowContacts#8f2f2d10 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRuleAllowContacts) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowContacts#8f2f2d10 to nil") - } - if err := b.ConsumeID(UserPrivacySettingRuleAllowContactsTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowContacts#8f2f2d10: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRuleAllowContacts) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowContacts#8f2f2d10 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRuleAllowContacts) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowContacts#8f2f2d10 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRuleAllowContacts") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRuleAllowContacts) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowContacts#8f2f2d10 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRuleAllowContacts"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowContacts#8f2f2d10: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingRuleAllowBots represents TL type `userPrivacySettingRuleAllowBots#53b2871d`. -type UserPrivacySettingRuleAllowBots struct { -} - -// UserPrivacySettingRuleAllowBotsTypeID is TL type id of UserPrivacySettingRuleAllowBots. -const UserPrivacySettingRuleAllowBotsTypeID = 0x53b2871d - -// construct implements constructor of UserPrivacySettingRuleClass. -func (u UserPrivacySettingRuleAllowBots) construct() UserPrivacySettingRuleClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingRuleAllowBots. -var ( - _ bin.Encoder = &UserPrivacySettingRuleAllowBots{} - _ bin.Decoder = &UserPrivacySettingRuleAllowBots{} - _ bin.BareEncoder = &UserPrivacySettingRuleAllowBots{} - _ bin.BareDecoder = &UserPrivacySettingRuleAllowBots{} - - _ UserPrivacySettingRuleClass = &UserPrivacySettingRuleAllowBots{} -) - -func (u *UserPrivacySettingRuleAllowBots) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRuleAllowBots) String() string { - if u == nil { - return "UserPrivacySettingRuleAllowBots(nil)" - } - type Alias UserPrivacySettingRuleAllowBots - return fmt.Sprintf("UserPrivacySettingRuleAllowBots%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRuleAllowBots) TypeID() uint32 { - return UserPrivacySettingRuleAllowBotsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRuleAllowBots) TypeName() string { - return "userPrivacySettingRuleAllowBots" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRuleAllowBots) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRuleAllowBots", - ID: UserPrivacySettingRuleAllowBotsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRuleAllowBots) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowBots#53b2871d as nil") - } - b.PutID(UserPrivacySettingRuleAllowBotsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRuleAllowBots) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowBots#53b2871d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRuleAllowBots) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowBots#53b2871d to nil") - } - if err := b.ConsumeID(UserPrivacySettingRuleAllowBotsTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowBots#53b2871d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRuleAllowBots) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowBots#53b2871d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRuleAllowBots) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowBots#53b2871d as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRuleAllowBots") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRuleAllowBots) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowBots#53b2871d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRuleAllowBots"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowBots#53b2871d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingRuleAllowPremiumUsers represents TL type `userPrivacySettingRuleAllowPremiumUsers#60ce8541`. -type UserPrivacySettingRuleAllowPremiumUsers struct { -} - -// UserPrivacySettingRuleAllowPremiumUsersTypeID is TL type id of UserPrivacySettingRuleAllowPremiumUsers. -const UserPrivacySettingRuleAllowPremiumUsersTypeID = 0x60ce8541 - -// construct implements constructor of UserPrivacySettingRuleClass. -func (u UserPrivacySettingRuleAllowPremiumUsers) construct() UserPrivacySettingRuleClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingRuleAllowPremiumUsers. -var ( - _ bin.Encoder = &UserPrivacySettingRuleAllowPremiumUsers{} - _ bin.Decoder = &UserPrivacySettingRuleAllowPremiumUsers{} - _ bin.BareEncoder = &UserPrivacySettingRuleAllowPremiumUsers{} - _ bin.BareDecoder = &UserPrivacySettingRuleAllowPremiumUsers{} - - _ UserPrivacySettingRuleClass = &UserPrivacySettingRuleAllowPremiumUsers{} -) - -func (u *UserPrivacySettingRuleAllowPremiumUsers) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRuleAllowPremiumUsers) String() string { - if u == nil { - return "UserPrivacySettingRuleAllowPremiumUsers(nil)" - } - type Alias UserPrivacySettingRuleAllowPremiumUsers - return fmt.Sprintf("UserPrivacySettingRuleAllowPremiumUsers%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRuleAllowPremiumUsers) TypeID() uint32 { - return UserPrivacySettingRuleAllowPremiumUsersTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRuleAllowPremiumUsers) TypeName() string { - return "userPrivacySettingRuleAllowPremiumUsers" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRuleAllowPremiumUsers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRuleAllowPremiumUsers", - ID: UserPrivacySettingRuleAllowPremiumUsersTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRuleAllowPremiumUsers) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowPremiumUsers#60ce8541 as nil") - } - b.PutID(UserPrivacySettingRuleAllowPremiumUsersTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRuleAllowPremiumUsers) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowPremiumUsers#60ce8541 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRuleAllowPremiumUsers) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowPremiumUsers#60ce8541 to nil") - } - if err := b.ConsumeID(UserPrivacySettingRuleAllowPremiumUsersTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowPremiumUsers#60ce8541: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRuleAllowPremiumUsers) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowPremiumUsers#60ce8541 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRuleAllowPremiumUsers) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowPremiumUsers#60ce8541 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRuleAllowPremiumUsers") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRuleAllowPremiumUsers) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowPremiumUsers#60ce8541 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRuleAllowPremiumUsers"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowPremiumUsers#60ce8541: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingRuleAllowUsers represents TL type `userPrivacySettingRuleAllowUsers#d1570b70`. -type UserPrivacySettingRuleAllowUsers struct { - // The user identifiers, total number of users in all rules must not exceed 1000 - UserIDs []int64 -} - -// UserPrivacySettingRuleAllowUsersTypeID is TL type id of UserPrivacySettingRuleAllowUsers. -const UserPrivacySettingRuleAllowUsersTypeID = 0xd1570b70 - -// construct implements constructor of UserPrivacySettingRuleClass. -func (u UserPrivacySettingRuleAllowUsers) construct() UserPrivacySettingRuleClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingRuleAllowUsers. -var ( - _ bin.Encoder = &UserPrivacySettingRuleAllowUsers{} - _ bin.Decoder = &UserPrivacySettingRuleAllowUsers{} - _ bin.BareEncoder = &UserPrivacySettingRuleAllowUsers{} - _ bin.BareDecoder = &UserPrivacySettingRuleAllowUsers{} - - _ UserPrivacySettingRuleClass = &UserPrivacySettingRuleAllowUsers{} -) - -func (u *UserPrivacySettingRuleAllowUsers) Zero() bool { - if u == nil { - return true - } - if !(u.UserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRuleAllowUsers) String() string { - if u == nil { - return "UserPrivacySettingRuleAllowUsers(nil)" - } - type Alias UserPrivacySettingRuleAllowUsers - return fmt.Sprintf("UserPrivacySettingRuleAllowUsers%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRuleAllowUsers) TypeID() uint32 { - return UserPrivacySettingRuleAllowUsersTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRuleAllowUsers) TypeName() string { - return "userPrivacySettingRuleAllowUsers" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRuleAllowUsers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRuleAllowUsers", - ID: UserPrivacySettingRuleAllowUsersTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRuleAllowUsers) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowUsers#d1570b70 as nil") - } - b.PutID(UserPrivacySettingRuleAllowUsersTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRuleAllowUsers) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowUsers#d1570b70 as nil") - } - b.PutInt(len(u.UserIDs)) - for _, v := range u.UserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRuleAllowUsers) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowUsers#d1570b70 to nil") - } - if err := b.ConsumeID(UserPrivacySettingRuleAllowUsersTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowUsers#d1570b70: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRuleAllowUsers) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowUsers#d1570b70 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowUsers#d1570b70: field user_ids: %w", err) - } - - if headerLen > 0 { - u.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowUsers#d1570b70: field user_ids: %w", err) - } - u.UserIDs = append(u.UserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRuleAllowUsers) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowUsers#d1570b70 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRuleAllowUsers") - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range u.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRuleAllowUsers) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowUsers#d1570b70 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRuleAllowUsers"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowUsers#d1570b70: %w", err) - } - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowUsers#d1570b70: field user_ids: %w", err) - } - u.UserIDs = append(u.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowUsers#d1570b70: field user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserIDs returns value of UserIDs field. -func (u *UserPrivacySettingRuleAllowUsers) GetUserIDs() (value []int64) { - if u == nil { - return - } - return u.UserIDs -} - -// UserPrivacySettingRuleAllowChatMembers represents TL type `userPrivacySettingRuleAllowChatMembers#f249b617`. -type UserPrivacySettingRuleAllowChatMembers struct { - // The chat identifiers, total number of chats in all rules must not exceed 20 - ChatIDs []int64 -} - -// UserPrivacySettingRuleAllowChatMembersTypeID is TL type id of UserPrivacySettingRuleAllowChatMembers. -const UserPrivacySettingRuleAllowChatMembersTypeID = 0xf249b617 - -// construct implements constructor of UserPrivacySettingRuleClass. -func (u UserPrivacySettingRuleAllowChatMembers) construct() UserPrivacySettingRuleClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingRuleAllowChatMembers. -var ( - _ bin.Encoder = &UserPrivacySettingRuleAllowChatMembers{} - _ bin.Decoder = &UserPrivacySettingRuleAllowChatMembers{} - _ bin.BareEncoder = &UserPrivacySettingRuleAllowChatMembers{} - _ bin.BareDecoder = &UserPrivacySettingRuleAllowChatMembers{} - - _ UserPrivacySettingRuleClass = &UserPrivacySettingRuleAllowChatMembers{} -) - -func (u *UserPrivacySettingRuleAllowChatMembers) Zero() bool { - if u == nil { - return true - } - if !(u.ChatIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRuleAllowChatMembers) String() string { - if u == nil { - return "UserPrivacySettingRuleAllowChatMembers(nil)" - } - type Alias UserPrivacySettingRuleAllowChatMembers - return fmt.Sprintf("UserPrivacySettingRuleAllowChatMembers%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRuleAllowChatMembers) TypeID() uint32 { - return UserPrivacySettingRuleAllowChatMembersTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRuleAllowChatMembers) TypeName() string { - return "userPrivacySettingRuleAllowChatMembers" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRuleAllowChatMembers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRuleAllowChatMembers", - ID: UserPrivacySettingRuleAllowChatMembersTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatIDs", - SchemaName: "chat_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRuleAllowChatMembers) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowChatMembers#f249b617 as nil") - } - b.PutID(UserPrivacySettingRuleAllowChatMembersTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRuleAllowChatMembers) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowChatMembers#f249b617 as nil") - } - b.PutInt(len(u.ChatIDs)) - for _, v := range u.ChatIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRuleAllowChatMembers) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowChatMembers#f249b617 to nil") - } - if err := b.ConsumeID(UserPrivacySettingRuleAllowChatMembersTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowChatMembers#f249b617: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRuleAllowChatMembers) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowChatMembers#f249b617 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowChatMembers#f249b617: field chat_ids: %w", err) - } - - if headerLen > 0 { - u.ChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowChatMembers#f249b617: field chat_ids: %w", err) - } - u.ChatIDs = append(u.ChatIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRuleAllowChatMembers) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleAllowChatMembers#f249b617 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRuleAllowChatMembers") - b.Comma() - b.FieldStart("chat_ids") - b.ArrStart() - for _, v := range u.ChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRuleAllowChatMembers) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleAllowChatMembers#f249b617 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRuleAllowChatMembers"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowChatMembers#f249b617: %w", err) - } - case "chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowChatMembers#f249b617: field chat_ids: %w", err) - } - u.ChatIDs = append(u.ChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleAllowChatMembers#f249b617: field chat_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatIDs returns value of ChatIDs field. -func (u *UserPrivacySettingRuleAllowChatMembers) GetChatIDs() (value []int64) { - if u == nil { - return - } - return u.ChatIDs -} - -// UserPrivacySettingRuleRestrictAll represents TL type `userPrivacySettingRuleRestrictAll#ac2a9550`. -type UserPrivacySettingRuleRestrictAll struct { -} - -// UserPrivacySettingRuleRestrictAllTypeID is TL type id of UserPrivacySettingRuleRestrictAll. -const UserPrivacySettingRuleRestrictAllTypeID = 0xac2a9550 - -// construct implements constructor of UserPrivacySettingRuleClass. -func (u UserPrivacySettingRuleRestrictAll) construct() UserPrivacySettingRuleClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingRuleRestrictAll. -var ( - _ bin.Encoder = &UserPrivacySettingRuleRestrictAll{} - _ bin.Decoder = &UserPrivacySettingRuleRestrictAll{} - _ bin.BareEncoder = &UserPrivacySettingRuleRestrictAll{} - _ bin.BareDecoder = &UserPrivacySettingRuleRestrictAll{} - - _ UserPrivacySettingRuleClass = &UserPrivacySettingRuleRestrictAll{} -) - -func (u *UserPrivacySettingRuleRestrictAll) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRuleRestrictAll) String() string { - if u == nil { - return "UserPrivacySettingRuleRestrictAll(nil)" - } - type Alias UserPrivacySettingRuleRestrictAll - return fmt.Sprintf("UserPrivacySettingRuleRestrictAll%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRuleRestrictAll) TypeID() uint32 { - return UserPrivacySettingRuleRestrictAllTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRuleRestrictAll) TypeName() string { - return "userPrivacySettingRuleRestrictAll" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRuleRestrictAll) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRuleRestrictAll", - ID: UserPrivacySettingRuleRestrictAllTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRuleRestrictAll) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictAll#ac2a9550 as nil") - } - b.PutID(UserPrivacySettingRuleRestrictAllTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRuleRestrictAll) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictAll#ac2a9550 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRuleRestrictAll) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictAll#ac2a9550 to nil") - } - if err := b.ConsumeID(UserPrivacySettingRuleRestrictAllTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictAll#ac2a9550: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRuleRestrictAll) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictAll#ac2a9550 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRuleRestrictAll) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictAll#ac2a9550 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRuleRestrictAll") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRuleRestrictAll) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictAll#ac2a9550 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRuleRestrictAll"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictAll#ac2a9550: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingRuleRestrictContacts represents TL type `userPrivacySettingRuleRestrictContacts#3c1acd02`. -type UserPrivacySettingRuleRestrictContacts struct { -} - -// UserPrivacySettingRuleRestrictContactsTypeID is TL type id of UserPrivacySettingRuleRestrictContacts. -const UserPrivacySettingRuleRestrictContactsTypeID = 0x3c1acd02 - -// construct implements constructor of UserPrivacySettingRuleClass. -func (u UserPrivacySettingRuleRestrictContacts) construct() UserPrivacySettingRuleClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingRuleRestrictContacts. -var ( - _ bin.Encoder = &UserPrivacySettingRuleRestrictContacts{} - _ bin.Decoder = &UserPrivacySettingRuleRestrictContacts{} - _ bin.BareEncoder = &UserPrivacySettingRuleRestrictContacts{} - _ bin.BareDecoder = &UserPrivacySettingRuleRestrictContacts{} - - _ UserPrivacySettingRuleClass = &UserPrivacySettingRuleRestrictContacts{} -) - -func (u *UserPrivacySettingRuleRestrictContacts) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRuleRestrictContacts) String() string { - if u == nil { - return "UserPrivacySettingRuleRestrictContacts(nil)" - } - type Alias UserPrivacySettingRuleRestrictContacts - return fmt.Sprintf("UserPrivacySettingRuleRestrictContacts%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRuleRestrictContacts) TypeID() uint32 { - return UserPrivacySettingRuleRestrictContactsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRuleRestrictContacts) TypeName() string { - return "userPrivacySettingRuleRestrictContacts" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRuleRestrictContacts) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRuleRestrictContacts", - ID: UserPrivacySettingRuleRestrictContactsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRuleRestrictContacts) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictContacts#3c1acd02 as nil") - } - b.PutID(UserPrivacySettingRuleRestrictContactsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRuleRestrictContacts) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictContacts#3c1acd02 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRuleRestrictContacts) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictContacts#3c1acd02 to nil") - } - if err := b.ConsumeID(UserPrivacySettingRuleRestrictContactsTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictContacts#3c1acd02: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRuleRestrictContacts) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictContacts#3c1acd02 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRuleRestrictContacts) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictContacts#3c1acd02 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRuleRestrictContacts") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRuleRestrictContacts) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictContacts#3c1acd02 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRuleRestrictContacts"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictContacts#3c1acd02: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingRuleRestrictBots represents TL type `userPrivacySettingRuleRestrictBots#8e996e5d`. -type UserPrivacySettingRuleRestrictBots struct { -} - -// UserPrivacySettingRuleRestrictBotsTypeID is TL type id of UserPrivacySettingRuleRestrictBots. -const UserPrivacySettingRuleRestrictBotsTypeID = 0x8e996e5d - -// construct implements constructor of UserPrivacySettingRuleClass. -func (u UserPrivacySettingRuleRestrictBots) construct() UserPrivacySettingRuleClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingRuleRestrictBots. -var ( - _ bin.Encoder = &UserPrivacySettingRuleRestrictBots{} - _ bin.Decoder = &UserPrivacySettingRuleRestrictBots{} - _ bin.BareEncoder = &UserPrivacySettingRuleRestrictBots{} - _ bin.BareDecoder = &UserPrivacySettingRuleRestrictBots{} - - _ UserPrivacySettingRuleClass = &UserPrivacySettingRuleRestrictBots{} -) - -func (u *UserPrivacySettingRuleRestrictBots) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRuleRestrictBots) String() string { - if u == nil { - return "UserPrivacySettingRuleRestrictBots(nil)" - } - type Alias UserPrivacySettingRuleRestrictBots - return fmt.Sprintf("UserPrivacySettingRuleRestrictBots%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRuleRestrictBots) TypeID() uint32 { - return UserPrivacySettingRuleRestrictBotsTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRuleRestrictBots) TypeName() string { - return "userPrivacySettingRuleRestrictBots" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRuleRestrictBots) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRuleRestrictBots", - ID: UserPrivacySettingRuleRestrictBotsTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRuleRestrictBots) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictBots#8e996e5d as nil") - } - b.PutID(UserPrivacySettingRuleRestrictBotsTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRuleRestrictBots) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictBots#8e996e5d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRuleRestrictBots) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictBots#8e996e5d to nil") - } - if err := b.ConsumeID(UserPrivacySettingRuleRestrictBotsTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictBots#8e996e5d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRuleRestrictBots) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictBots#8e996e5d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRuleRestrictBots) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictBots#8e996e5d as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRuleRestrictBots") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRuleRestrictBots) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictBots#8e996e5d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRuleRestrictBots"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictBots#8e996e5d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserPrivacySettingRuleRestrictUsers represents TL type `userPrivacySettingRuleRestrictUsers#4d392a91`. -type UserPrivacySettingRuleRestrictUsers struct { - // The user identifiers, total number of users in all rules must not exceed 1000 - UserIDs []int64 -} - -// UserPrivacySettingRuleRestrictUsersTypeID is TL type id of UserPrivacySettingRuleRestrictUsers. -const UserPrivacySettingRuleRestrictUsersTypeID = 0x4d392a91 - -// construct implements constructor of UserPrivacySettingRuleClass. -func (u UserPrivacySettingRuleRestrictUsers) construct() UserPrivacySettingRuleClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingRuleRestrictUsers. -var ( - _ bin.Encoder = &UserPrivacySettingRuleRestrictUsers{} - _ bin.Decoder = &UserPrivacySettingRuleRestrictUsers{} - _ bin.BareEncoder = &UserPrivacySettingRuleRestrictUsers{} - _ bin.BareDecoder = &UserPrivacySettingRuleRestrictUsers{} - - _ UserPrivacySettingRuleClass = &UserPrivacySettingRuleRestrictUsers{} -) - -func (u *UserPrivacySettingRuleRestrictUsers) Zero() bool { - if u == nil { - return true - } - if !(u.UserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRuleRestrictUsers) String() string { - if u == nil { - return "UserPrivacySettingRuleRestrictUsers(nil)" - } - type Alias UserPrivacySettingRuleRestrictUsers - return fmt.Sprintf("UserPrivacySettingRuleRestrictUsers%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRuleRestrictUsers) TypeID() uint32 { - return UserPrivacySettingRuleRestrictUsersTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRuleRestrictUsers) TypeName() string { - return "userPrivacySettingRuleRestrictUsers" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRuleRestrictUsers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRuleRestrictUsers", - ID: UserPrivacySettingRuleRestrictUsersTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRuleRestrictUsers) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictUsers#4d392a91 as nil") - } - b.PutID(UserPrivacySettingRuleRestrictUsersTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRuleRestrictUsers) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictUsers#4d392a91 as nil") - } - b.PutInt(len(u.UserIDs)) - for _, v := range u.UserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRuleRestrictUsers) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictUsers#4d392a91 to nil") - } - if err := b.ConsumeID(UserPrivacySettingRuleRestrictUsersTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictUsers#4d392a91: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRuleRestrictUsers) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictUsers#4d392a91 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictUsers#4d392a91: field user_ids: %w", err) - } - - if headerLen > 0 { - u.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictUsers#4d392a91: field user_ids: %w", err) - } - u.UserIDs = append(u.UserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRuleRestrictUsers) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictUsers#4d392a91 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRuleRestrictUsers") - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range u.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRuleRestrictUsers) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictUsers#4d392a91 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRuleRestrictUsers"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictUsers#4d392a91: %w", err) - } - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictUsers#4d392a91: field user_ids: %w", err) - } - u.UserIDs = append(u.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictUsers#4d392a91: field user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetUserIDs returns value of UserIDs field. -func (u *UserPrivacySettingRuleRestrictUsers) GetUserIDs() (value []int64) { - if u == nil { - return - } - return u.UserIDs -} - -// UserPrivacySettingRuleRestrictChatMembers represents TL type `userPrivacySettingRuleRestrictChatMembers#fc00b920`. -type UserPrivacySettingRuleRestrictChatMembers struct { - // The chat identifiers, total number of chats in all rules must not exceed 20 - ChatIDs []int64 -} - -// UserPrivacySettingRuleRestrictChatMembersTypeID is TL type id of UserPrivacySettingRuleRestrictChatMembers. -const UserPrivacySettingRuleRestrictChatMembersTypeID = 0xfc00b920 - -// construct implements constructor of UserPrivacySettingRuleClass. -func (u UserPrivacySettingRuleRestrictChatMembers) construct() UserPrivacySettingRuleClass { return &u } - -// Ensuring interfaces in compile-time for UserPrivacySettingRuleRestrictChatMembers. -var ( - _ bin.Encoder = &UserPrivacySettingRuleRestrictChatMembers{} - _ bin.Decoder = &UserPrivacySettingRuleRestrictChatMembers{} - _ bin.BareEncoder = &UserPrivacySettingRuleRestrictChatMembers{} - _ bin.BareDecoder = &UserPrivacySettingRuleRestrictChatMembers{} - - _ UserPrivacySettingRuleClass = &UserPrivacySettingRuleRestrictChatMembers{} -) - -func (u *UserPrivacySettingRuleRestrictChatMembers) Zero() bool { - if u == nil { - return true - } - if !(u.ChatIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRuleRestrictChatMembers) String() string { - if u == nil { - return "UserPrivacySettingRuleRestrictChatMembers(nil)" - } - type Alias UserPrivacySettingRuleRestrictChatMembers - return fmt.Sprintf("UserPrivacySettingRuleRestrictChatMembers%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRuleRestrictChatMembers) TypeID() uint32 { - return UserPrivacySettingRuleRestrictChatMembersTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRuleRestrictChatMembers) TypeName() string { - return "userPrivacySettingRuleRestrictChatMembers" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRuleRestrictChatMembers) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRuleRestrictChatMembers", - ID: UserPrivacySettingRuleRestrictChatMembersTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatIDs", - SchemaName: "chat_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRuleRestrictChatMembers) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictChatMembers#fc00b920 as nil") - } - b.PutID(UserPrivacySettingRuleRestrictChatMembersTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRuleRestrictChatMembers) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictChatMembers#fc00b920 as nil") - } - b.PutInt(len(u.ChatIDs)) - for _, v := range u.ChatIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRuleRestrictChatMembers) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictChatMembers#fc00b920 to nil") - } - if err := b.ConsumeID(UserPrivacySettingRuleRestrictChatMembersTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictChatMembers#fc00b920: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRuleRestrictChatMembers) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictChatMembers#fc00b920 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictChatMembers#fc00b920: field chat_ids: %w", err) - } - - if headerLen > 0 { - u.ChatIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictChatMembers#fc00b920: field chat_ids: %w", err) - } - u.ChatIDs = append(u.ChatIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRuleRestrictChatMembers) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRuleRestrictChatMembers#fc00b920 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRuleRestrictChatMembers") - b.Comma() - b.FieldStart("chat_ids") - b.ArrStart() - for _, v := range u.ChatIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRuleRestrictChatMembers) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRuleRestrictChatMembers#fc00b920 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRuleRestrictChatMembers"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictChatMembers#fc00b920: %w", err) - } - case "chat_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictChatMembers#fc00b920: field chat_ids: %w", err) - } - u.ChatIDs = append(u.ChatIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRuleRestrictChatMembers#fc00b920: field chat_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetChatIDs returns value of ChatIDs field. -func (u *UserPrivacySettingRuleRestrictChatMembers) GetChatIDs() (value []int64) { - if u == nil { - return - } - return u.ChatIDs -} - -// UserPrivacySettingRuleClassName is schema name of UserPrivacySettingRuleClass. -const UserPrivacySettingRuleClassName = "UserPrivacySettingRule" - -// UserPrivacySettingRuleClass represents UserPrivacySettingRule generic type. -// -// Example: -// -// g, err := tdapi.DecodeUserPrivacySettingRule(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.UserPrivacySettingRuleAllowAll: // userPrivacySettingRuleAllowAll#8abf1c3f -// case *tdapi.UserPrivacySettingRuleAllowContacts: // userPrivacySettingRuleAllowContacts#8f2f2d10 -// case *tdapi.UserPrivacySettingRuleAllowBots: // userPrivacySettingRuleAllowBots#53b2871d -// case *tdapi.UserPrivacySettingRuleAllowPremiumUsers: // userPrivacySettingRuleAllowPremiumUsers#60ce8541 -// case *tdapi.UserPrivacySettingRuleAllowUsers: // userPrivacySettingRuleAllowUsers#d1570b70 -// case *tdapi.UserPrivacySettingRuleAllowChatMembers: // userPrivacySettingRuleAllowChatMembers#f249b617 -// case *tdapi.UserPrivacySettingRuleRestrictAll: // userPrivacySettingRuleRestrictAll#ac2a9550 -// case *tdapi.UserPrivacySettingRuleRestrictContacts: // userPrivacySettingRuleRestrictContacts#3c1acd02 -// case *tdapi.UserPrivacySettingRuleRestrictBots: // userPrivacySettingRuleRestrictBots#8e996e5d -// case *tdapi.UserPrivacySettingRuleRestrictUsers: // userPrivacySettingRuleRestrictUsers#4d392a91 -// case *tdapi.UserPrivacySettingRuleRestrictChatMembers: // userPrivacySettingRuleRestrictChatMembers#fc00b920 -// default: panic(v) -// } -type UserPrivacySettingRuleClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() UserPrivacySettingRuleClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeUserPrivacySettingRule implements binary de-serialization for UserPrivacySettingRuleClass. -func DecodeUserPrivacySettingRule(buf *bin.Buffer) (UserPrivacySettingRuleClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case UserPrivacySettingRuleAllowAllTypeID: - // Decoding userPrivacySettingRuleAllowAll#8abf1c3f. - v := UserPrivacySettingRuleAllowAll{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case UserPrivacySettingRuleAllowContactsTypeID: - // Decoding userPrivacySettingRuleAllowContacts#8f2f2d10. - v := UserPrivacySettingRuleAllowContacts{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case UserPrivacySettingRuleAllowBotsTypeID: - // Decoding userPrivacySettingRuleAllowBots#53b2871d. - v := UserPrivacySettingRuleAllowBots{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case UserPrivacySettingRuleAllowPremiumUsersTypeID: - // Decoding userPrivacySettingRuleAllowPremiumUsers#60ce8541. - v := UserPrivacySettingRuleAllowPremiumUsers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case UserPrivacySettingRuleAllowUsersTypeID: - // Decoding userPrivacySettingRuleAllowUsers#d1570b70. - v := UserPrivacySettingRuleAllowUsers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case UserPrivacySettingRuleAllowChatMembersTypeID: - // Decoding userPrivacySettingRuleAllowChatMembers#f249b617. - v := UserPrivacySettingRuleAllowChatMembers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case UserPrivacySettingRuleRestrictAllTypeID: - // Decoding userPrivacySettingRuleRestrictAll#ac2a9550. - v := UserPrivacySettingRuleRestrictAll{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case UserPrivacySettingRuleRestrictContactsTypeID: - // Decoding userPrivacySettingRuleRestrictContacts#3c1acd02. - v := UserPrivacySettingRuleRestrictContacts{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case UserPrivacySettingRuleRestrictBotsTypeID: - // Decoding userPrivacySettingRuleRestrictBots#8e996e5d. - v := UserPrivacySettingRuleRestrictBots{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case UserPrivacySettingRuleRestrictUsersTypeID: - // Decoding userPrivacySettingRuleRestrictUsers#4d392a91. - v := UserPrivacySettingRuleRestrictUsers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case UserPrivacySettingRuleRestrictChatMembersTypeID: - // Decoding userPrivacySettingRuleRestrictChatMembers#fc00b920. - v := UserPrivacySettingRuleRestrictChatMembers{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONUserPrivacySettingRule implements binary de-serialization for UserPrivacySettingRuleClass. -func DecodeTDLibJSONUserPrivacySettingRule(buf tdjson.Decoder) (UserPrivacySettingRuleClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "userPrivacySettingRuleAllowAll": - // Decoding userPrivacySettingRuleAllowAll#8abf1c3f. - v := UserPrivacySettingRuleAllowAll{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case "userPrivacySettingRuleAllowContacts": - // Decoding userPrivacySettingRuleAllowContacts#8f2f2d10. - v := UserPrivacySettingRuleAllowContacts{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case "userPrivacySettingRuleAllowBots": - // Decoding userPrivacySettingRuleAllowBots#53b2871d. - v := UserPrivacySettingRuleAllowBots{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case "userPrivacySettingRuleAllowPremiumUsers": - // Decoding userPrivacySettingRuleAllowPremiumUsers#60ce8541. - v := UserPrivacySettingRuleAllowPremiumUsers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case "userPrivacySettingRuleAllowUsers": - // Decoding userPrivacySettingRuleAllowUsers#d1570b70. - v := UserPrivacySettingRuleAllowUsers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case "userPrivacySettingRuleAllowChatMembers": - // Decoding userPrivacySettingRuleAllowChatMembers#f249b617. - v := UserPrivacySettingRuleAllowChatMembers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case "userPrivacySettingRuleRestrictAll": - // Decoding userPrivacySettingRuleRestrictAll#ac2a9550. - v := UserPrivacySettingRuleRestrictAll{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case "userPrivacySettingRuleRestrictContacts": - // Decoding userPrivacySettingRuleRestrictContacts#3c1acd02. - v := UserPrivacySettingRuleRestrictContacts{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case "userPrivacySettingRuleRestrictBots": - // Decoding userPrivacySettingRuleRestrictBots#8e996e5d. - v := UserPrivacySettingRuleRestrictBots{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case "userPrivacySettingRuleRestrictUsers": - // Decoding userPrivacySettingRuleRestrictUsers#4d392a91. - v := UserPrivacySettingRuleRestrictUsers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - case "userPrivacySettingRuleRestrictChatMembers": - // Decoding userPrivacySettingRuleRestrictChatMembers#fc00b920. - v := UserPrivacySettingRuleRestrictChatMembers{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode UserPrivacySettingRuleClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// UserPrivacySettingRule boxes the UserPrivacySettingRuleClass providing a helper. -type UserPrivacySettingRuleBox struct { - UserPrivacySettingRule UserPrivacySettingRuleClass -} - -// Decode implements bin.Decoder for UserPrivacySettingRuleBox. -func (b *UserPrivacySettingRuleBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode UserPrivacySettingRuleBox to nil") - } - v, err := DecodeUserPrivacySettingRule(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.UserPrivacySettingRule = v - return nil -} - -// Encode implements bin.Encode for UserPrivacySettingRuleBox. -func (b *UserPrivacySettingRuleBox) Encode(buf *bin.Buffer) error { - if b == nil || b.UserPrivacySettingRule == nil { - return fmt.Errorf("unable to encode UserPrivacySettingRuleClass as nil") - } - return b.UserPrivacySettingRule.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for UserPrivacySettingRuleBox. -func (b *UserPrivacySettingRuleBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode UserPrivacySettingRuleBox to nil") - } - v, err := DecodeTDLibJSONUserPrivacySettingRule(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.UserPrivacySettingRule = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for UserPrivacySettingRuleBox. -func (b *UserPrivacySettingRuleBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.UserPrivacySettingRule == nil { - return fmt.Errorf("unable to encode UserPrivacySettingRuleClass as nil") - } - return b.UserPrivacySettingRule.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_user_privacy_setting_rules_gen.go b/tdapi/tl_user_privacy_setting_rules_gen.go deleted file mode 100644 index 99d079f80..000000000 --- a/tdapi/tl_user_privacy_setting_rules_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UserPrivacySettingRules represents TL type `userPrivacySettingRules#425e6b37`. -type UserPrivacySettingRules struct { - // A list of rules - Rules []UserPrivacySettingRuleClass -} - -// UserPrivacySettingRulesTypeID is TL type id of UserPrivacySettingRules. -const UserPrivacySettingRulesTypeID = 0x425e6b37 - -// Ensuring interfaces in compile-time for UserPrivacySettingRules. -var ( - _ bin.Encoder = &UserPrivacySettingRules{} - _ bin.Decoder = &UserPrivacySettingRules{} - _ bin.BareEncoder = &UserPrivacySettingRules{} - _ bin.BareDecoder = &UserPrivacySettingRules{} -) - -func (u *UserPrivacySettingRules) Zero() bool { - if u == nil { - return true - } - if !(u.Rules == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserPrivacySettingRules) String() string { - if u == nil { - return "UserPrivacySettingRules(nil)" - } - type Alias UserPrivacySettingRules - return fmt.Sprintf("UserPrivacySettingRules%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserPrivacySettingRules) TypeID() uint32 { - return UserPrivacySettingRulesTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserPrivacySettingRules) TypeName() string { - return "userPrivacySettingRules" -} - -// TypeInfo returns info about TL type. -func (u *UserPrivacySettingRules) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userPrivacySettingRules", - ID: UserPrivacySettingRulesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Rules", - SchemaName: "rules", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserPrivacySettingRules) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRules#425e6b37 as nil") - } - b.PutID(UserPrivacySettingRulesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserPrivacySettingRules) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRules#425e6b37 as nil") - } - b.PutInt(len(u.Rules)) - for idx, v := range u.Rules { - if v == nil { - return fmt.Errorf("unable to encode userPrivacySettingRules#425e6b37: field rules element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare userPrivacySettingRules#425e6b37: field rules element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserPrivacySettingRules) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRules#425e6b37 to nil") - } - if err := b.ConsumeID(UserPrivacySettingRulesTypeID); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRules#425e6b37: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserPrivacySettingRules) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRules#425e6b37 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRules#425e6b37: field rules: %w", err) - } - - if headerLen > 0 { - u.Rules = make([]UserPrivacySettingRuleClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodeUserPrivacySettingRule(b) - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRules#425e6b37: field rules: %w", err) - } - u.Rules = append(u.Rules, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserPrivacySettingRules) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userPrivacySettingRules#425e6b37 as nil") - } - b.ObjStart() - b.PutID("userPrivacySettingRules") - b.Comma() - b.FieldStart("rules") - b.ArrStart() - for idx, v := range u.Rules { - if v == nil { - return fmt.Errorf("unable to encode userPrivacySettingRules#425e6b37: field rules element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userPrivacySettingRules#425e6b37: field rules element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserPrivacySettingRules) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userPrivacySettingRules#425e6b37 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userPrivacySettingRules"); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRules#425e6b37: %w", err) - } - case "rules": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONUserPrivacySettingRule(b) - if err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRules#425e6b37: field rules: %w", err) - } - u.Rules = append(u.Rules, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode userPrivacySettingRules#425e6b37: field rules: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetRules returns value of Rules field. -func (u *UserPrivacySettingRules) GetRules() (value []UserPrivacySettingRuleClass) { - if u == nil { - return - } - return u.Rules -} diff --git a/tdapi/tl_user_status_gen.go b/tdapi/tl_user_status_gen.go deleted file mode 100644 index 181beac78..000000000 --- a/tdapi/tl_user_status_gen.go +++ /dev/null @@ -1,1193 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UserStatusEmpty represents TL type `userStatusEmpty#9d05049`. -type UserStatusEmpty struct { -} - -// UserStatusEmptyTypeID is TL type id of UserStatusEmpty. -const UserStatusEmptyTypeID = 0x9d05049 - -// construct implements constructor of UserStatusClass. -func (u UserStatusEmpty) construct() UserStatusClass { return &u } - -// Ensuring interfaces in compile-time for UserStatusEmpty. -var ( - _ bin.Encoder = &UserStatusEmpty{} - _ bin.Decoder = &UserStatusEmpty{} - _ bin.BareEncoder = &UserStatusEmpty{} - _ bin.BareDecoder = &UserStatusEmpty{} - - _ UserStatusClass = &UserStatusEmpty{} -) - -func (u *UserStatusEmpty) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserStatusEmpty) String() string { - if u == nil { - return "UserStatusEmpty(nil)" - } - type Alias UserStatusEmpty - return fmt.Sprintf("UserStatusEmpty%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserStatusEmpty) TypeID() uint32 { - return UserStatusEmptyTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserStatusEmpty) TypeName() string { - return "userStatusEmpty" -} - -// TypeInfo returns info about TL type. -func (u *UserStatusEmpty) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userStatusEmpty", - ID: UserStatusEmptyTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserStatusEmpty) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusEmpty#9d05049 as nil") - } - b.PutID(UserStatusEmptyTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserStatusEmpty) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusEmpty#9d05049 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserStatusEmpty) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusEmpty#9d05049 to nil") - } - if err := b.ConsumeID(UserStatusEmptyTypeID); err != nil { - return fmt.Errorf("unable to decode userStatusEmpty#9d05049: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserStatusEmpty) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusEmpty#9d05049 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserStatusEmpty) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userStatusEmpty#9d05049 as nil") - } - b.ObjStart() - b.PutID("userStatusEmpty") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserStatusEmpty) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userStatusEmpty#9d05049 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userStatusEmpty"); err != nil { - return fmt.Errorf("unable to decode userStatusEmpty#9d05049: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserStatusOnline represents TL type `userStatusOnline#a4d64774`. -type UserStatusOnline struct { - // Point in time (Unix timestamp) when the user's online status will expire - Expires int32 -} - -// UserStatusOnlineTypeID is TL type id of UserStatusOnline. -const UserStatusOnlineTypeID = 0xa4d64774 - -// construct implements constructor of UserStatusClass. -func (u UserStatusOnline) construct() UserStatusClass { return &u } - -// Ensuring interfaces in compile-time for UserStatusOnline. -var ( - _ bin.Encoder = &UserStatusOnline{} - _ bin.Decoder = &UserStatusOnline{} - _ bin.BareEncoder = &UserStatusOnline{} - _ bin.BareDecoder = &UserStatusOnline{} - - _ UserStatusClass = &UserStatusOnline{} -) - -func (u *UserStatusOnline) Zero() bool { - if u == nil { - return true - } - if !(u.Expires == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserStatusOnline) String() string { - if u == nil { - return "UserStatusOnline(nil)" - } - type Alias UserStatusOnline - return fmt.Sprintf("UserStatusOnline%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserStatusOnline) TypeID() uint32 { - return UserStatusOnlineTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserStatusOnline) TypeName() string { - return "userStatusOnline" -} - -// TypeInfo returns info about TL type. -func (u *UserStatusOnline) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userStatusOnline", - ID: UserStatusOnlineTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Expires", - SchemaName: "expires", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserStatusOnline) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusOnline#a4d64774 as nil") - } - b.PutID(UserStatusOnlineTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserStatusOnline) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusOnline#a4d64774 as nil") - } - b.PutInt32(u.Expires) - return nil -} - -// Decode implements bin.Decoder. -func (u *UserStatusOnline) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusOnline#a4d64774 to nil") - } - if err := b.ConsumeID(UserStatusOnlineTypeID); err != nil { - return fmt.Errorf("unable to decode userStatusOnline#a4d64774: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserStatusOnline) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusOnline#a4d64774 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userStatusOnline#a4d64774: field expires: %w", err) - } - u.Expires = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserStatusOnline) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userStatusOnline#a4d64774 as nil") - } - b.ObjStart() - b.PutID("userStatusOnline") - b.Comma() - b.FieldStart("expires") - b.PutInt32(u.Expires) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserStatusOnline) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userStatusOnline#a4d64774 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userStatusOnline"); err != nil { - return fmt.Errorf("unable to decode userStatusOnline#a4d64774: %w", err) - } - case "expires": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userStatusOnline#a4d64774: field expires: %w", err) - } - u.Expires = value - default: - return b.Skip() - } - return nil - }) -} - -// GetExpires returns value of Expires field. -func (u *UserStatusOnline) GetExpires() (value int32) { - if u == nil { - return - } - return u.Expires -} - -// UserStatusOffline represents TL type `userStatusOffline#d2b38d05`. -type UserStatusOffline struct { - // Point in time (Unix timestamp) when the user was last online - WasOnline int32 -} - -// UserStatusOfflineTypeID is TL type id of UserStatusOffline. -const UserStatusOfflineTypeID = 0xd2b38d05 - -// construct implements constructor of UserStatusClass. -func (u UserStatusOffline) construct() UserStatusClass { return &u } - -// Ensuring interfaces in compile-time for UserStatusOffline. -var ( - _ bin.Encoder = &UserStatusOffline{} - _ bin.Decoder = &UserStatusOffline{} - _ bin.BareEncoder = &UserStatusOffline{} - _ bin.BareDecoder = &UserStatusOffline{} - - _ UserStatusClass = &UserStatusOffline{} -) - -func (u *UserStatusOffline) Zero() bool { - if u == nil { - return true - } - if !(u.WasOnline == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserStatusOffline) String() string { - if u == nil { - return "UserStatusOffline(nil)" - } - type Alias UserStatusOffline - return fmt.Sprintf("UserStatusOffline%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserStatusOffline) TypeID() uint32 { - return UserStatusOfflineTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserStatusOffline) TypeName() string { - return "userStatusOffline" -} - -// TypeInfo returns info about TL type. -func (u *UserStatusOffline) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userStatusOffline", - ID: UserStatusOfflineTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "WasOnline", - SchemaName: "was_online", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserStatusOffline) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusOffline#d2b38d05 as nil") - } - b.PutID(UserStatusOfflineTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserStatusOffline) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusOffline#d2b38d05 as nil") - } - b.PutInt32(u.WasOnline) - return nil -} - -// Decode implements bin.Decoder. -func (u *UserStatusOffline) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusOffline#d2b38d05 to nil") - } - if err := b.ConsumeID(UserStatusOfflineTypeID); err != nil { - return fmt.Errorf("unable to decode userStatusOffline#d2b38d05: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserStatusOffline) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusOffline#d2b38d05 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userStatusOffline#d2b38d05: field was_online: %w", err) - } - u.WasOnline = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserStatusOffline) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userStatusOffline#d2b38d05 as nil") - } - b.ObjStart() - b.PutID("userStatusOffline") - b.Comma() - b.FieldStart("was_online") - b.PutInt32(u.WasOnline) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserStatusOffline) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userStatusOffline#d2b38d05 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userStatusOffline"); err != nil { - return fmt.Errorf("unable to decode userStatusOffline#d2b38d05: %w", err) - } - case "was_online": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userStatusOffline#d2b38d05: field was_online: %w", err) - } - u.WasOnline = value - default: - return b.Skip() - } - return nil - }) -} - -// GetWasOnline returns value of WasOnline field. -func (u *UserStatusOffline) GetWasOnline() (value int32) { - if u == nil { - return - } - return u.WasOnline -} - -// UserStatusRecently represents TL type `userStatusRecently#faa60b5`. -type UserStatusRecently struct { - // Exact user's status is hidden because the current user enabled - // userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium - ByMyPrivacySettings bool -} - -// UserStatusRecentlyTypeID is TL type id of UserStatusRecently. -const UserStatusRecentlyTypeID = 0xfaa60b5 - -// construct implements constructor of UserStatusClass. -func (u UserStatusRecently) construct() UserStatusClass { return &u } - -// Ensuring interfaces in compile-time for UserStatusRecently. -var ( - _ bin.Encoder = &UserStatusRecently{} - _ bin.Decoder = &UserStatusRecently{} - _ bin.BareEncoder = &UserStatusRecently{} - _ bin.BareDecoder = &UserStatusRecently{} - - _ UserStatusClass = &UserStatusRecently{} -) - -func (u *UserStatusRecently) Zero() bool { - if u == nil { - return true - } - if !(u.ByMyPrivacySettings == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserStatusRecently) String() string { - if u == nil { - return "UserStatusRecently(nil)" - } - type Alias UserStatusRecently - return fmt.Sprintf("UserStatusRecently%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserStatusRecently) TypeID() uint32 { - return UserStatusRecentlyTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserStatusRecently) TypeName() string { - return "userStatusRecently" -} - -// TypeInfo returns info about TL type. -func (u *UserStatusRecently) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userStatusRecently", - ID: UserStatusRecentlyTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ByMyPrivacySettings", - SchemaName: "by_my_privacy_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserStatusRecently) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusRecently#faa60b5 as nil") - } - b.PutID(UserStatusRecentlyTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserStatusRecently) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusRecently#faa60b5 as nil") - } - b.PutBool(u.ByMyPrivacySettings) - return nil -} - -// Decode implements bin.Decoder. -func (u *UserStatusRecently) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusRecently#faa60b5 to nil") - } - if err := b.ConsumeID(UserStatusRecentlyTypeID); err != nil { - return fmt.Errorf("unable to decode userStatusRecently#faa60b5: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserStatusRecently) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusRecently#faa60b5 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userStatusRecently#faa60b5: field by_my_privacy_settings: %w", err) - } - u.ByMyPrivacySettings = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserStatusRecently) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userStatusRecently#faa60b5 as nil") - } - b.ObjStart() - b.PutID("userStatusRecently") - b.Comma() - b.FieldStart("by_my_privacy_settings") - b.PutBool(u.ByMyPrivacySettings) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserStatusRecently) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userStatusRecently#faa60b5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userStatusRecently"); err != nil { - return fmt.Errorf("unable to decode userStatusRecently#faa60b5: %w", err) - } - case "by_my_privacy_settings": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userStatusRecently#faa60b5: field by_my_privacy_settings: %w", err) - } - u.ByMyPrivacySettings = value - default: - return b.Skip() - } - return nil - }) -} - -// GetByMyPrivacySettings returns value of ByMyPrivacySettings field. -func (u *UserStatusRecently) GetByMyPrivacySettings() (value bool) { - if u == nil { - return - } - return u.ByMyPrivacySettings -} - -// UserStatusLastWeek represents TL type `userStatusLastWeek#12801b57`. -type UserStatusLastWeek struct { - // Exact user's status is hidden because the current user enabled - // userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium - ByMyPrivacySettings bool -} - -// UserStatusLastWeekTypeID is TL type id of UserStatusLastWeek. -const UserStatusLastWeekTypeID = 0x12801b57 - -// construct implements constructor of UserStatusClass. -func (u UserStatusLastWeek) construct() UserStatusClass { return &u } - -// Ensuring interfaces in compile-time for UserStatusLastWeek. -var ( - _ bin.Encoder = &UserStatusLastWeek{} - _ bin.Decoder = &UserStatusLastWeek{} - _ bin.BareEncoder = &UserStatusLastWeek{} - _ bin.BareDecoder = &UserStatusLastWeek{} - - _ UserStatusClass = &UserStatusLastWeek{} -) - -func (u *UserStatusLastWeek) Zero() bool { - if u == nil { - return true - } - if !(u.ByMyPrivacySettings == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserStatusLastWeek) String() string { - if u == nil { - return "UserStatusLastWeek(nil)" - } - type Alias UserStatusLastWeek - return fmt.Sprintf("UserStatusLastWeek%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserStatusLastWeek) TypeID() uint32 { - return UserStatusLastWeekTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserStatusLastWeek) TypeName() string { - return "userStatusLastWeek" -} - -// TypeInfo returns info about TL type. -func (u *UserStatusLastWeek) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userStatusLastWeek", - ID: UserStatusLastWeekTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ByMyPrivacySettings", - SchemaName: "by_my_privacy_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserStatusLastWeek) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusLastWeek#12801b57 as nil") - } - b.PutID(UserStatusLastWeekTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserStatusLastWeek) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusLastWeek#12801b57 as nil") - } - b.PutBool(u.ByMyPrivacySettings) - return nil -} - -// Decode implements bin.Decoder. -func (u *UserStatusLastWeek) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusLastWeek#12801b57 to nil") - } - if err := b.ConsumeID(UserStatusLastWeekTypeID); err != nil { - return fmt.Errorf("unable to decode userStatusLastWeek#12801b57: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserStatusLastWeek) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusLastWeek#12801b57 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userStatusLastWeek#12801b57: field by_my_privacy_settings: %w", err) - } - u.ByMyPrivacySettings = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserStatusLastWeek) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userStatusLastWeek#12801b57 as nil") - } - b.ObjStart() - b.PutID("userStatusLastWeek") - b.Comma() - b.FieldStart("by_my_privacy_settings") - b.PutBool(u.ByMyPrivacySettings) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserStatusLastWeek) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userStatusLastWeek#12801b57 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userStatusLastWeek"); err != nil { - return fmt.Errorf("unable to decode userStatusLastWeek#12801b57: %w", err) - } - case "by_my_privacy_settings": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userStatusLastWeek#12801b57: field by_my_privacy_settings: %w", err) - } - u.ByMyPrivacySettings = value - default: - return b.Skip() - } - return nil - }) -} - -// GetByMyPrivacySettings returns value of ByMyPrivacySettings field. -func (u *UserStatusLastWeek) GetByMyPrivacySettings() (value bool) { - if u == nil { - return - } - return u.ByMyPrivacySettings -} - -// UserStatusLastMonth represents TL type `userStatusLastMonth#b8cb29fc`. -type UserStatusLastMonth struct { - // Exact user's status is hidden because the current user enabled - // userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium - ByMyPrivacySettings bool -} - -// UserStatusLastMonthTypeID is TL type id of UserStatusLastMonth. -const UserStatusLastMonthTypeID = 0xb8cb29fc - -// construct implements constructor of UserStatusClass. -func (u UserStatusLastMonth) construct() UserStatusClass { return &u } - -// Ensuring interfaces in compile-time for UserStatusLastMonth. -var ( - _ bin.Encoder = &UserStatusLastMonth{} - _ bin.Decoder = &UserStatusLastMonth{} - _ bin.BareEncoder = &UserStatusLastMonth{} - _ bin.BareDecoder = &UserStatusLastMonth{} - - _ UserStatusClass = &UserStatusLastMonth{} -) - -func (u *UserStatusLastMonth) Zero() bool { - if u == nil { - return true - } - if !(u.ByMyPrivacySettings == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserStatusLastMonth) String() string { - if u == nil { - return "UserStatusLastMonth(nil)" - } - type Alias UserStatusLastMonth - return fmt.Sprintf("UserStatusLastMonth%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserStatusLastMonth) TypeID() uint32 { - return UserStatusLastMonthTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserStatusLastMonth) TypeName() string { - return "userStatusLastMonth" -} - -// TypeInfo returns info about TL type. -func (u *UserStatusLastMonth) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userStatusLastMonth", - ID: UserStatusLastMonthTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ByMyPrivacySettings", - SchemaName: "by_my_privacy_settings", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserStatusLastMonth) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusLastMonth#b8cb29fc as nil") - } - b.PutID(UserStatusLastMonthTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserStatusLastMonth) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userStatusLastMonth#b8cb29fc as nil") - } - b.PutBool(u.ByMyPrivacySettings) - return nil -} - -// Decode implements bin.Decoder. -func (u *UserStatusLastMonth) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusLastMonth#b8cb29fc to nil") - } - if err := b.ConsumeID(UserStatusLastMonthTypeID); err != nil { - return fmt.Errorf("unable to decode userStatusLastMonth#b8cb29fc: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserStatusLastMonth) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userStatusLastMonth#b8cb29fc to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userStatusLastMonth#b8cb29fc: field by_my_privacy_settings: %w", err) - } - u.ByMyPrivacySettings = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserStatusLastMonth) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userStatusLastMonth#b8cb29fc as nil") - } - b.ObjStart() - b.PutID("userStatusLastMonth") - b.Comma() - b.FieldStart("by_my_privacy_settings") - b.PutBool(u.ByMyPrivacySettings) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserStatusLastMonth) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userStatusLastMonth#b8cb29fc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userStatusLastMonth"); err != nil { - return fmt.Errorf("unable to decode userStatusLastMonth#b8cb29fc: %w", err) - } - case "by_my_privacy_settings": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userStatusLastMonth#b8cb29fc: field by_my_privacy_settings: %w", err) - } - u.ByMyPrivacySettings = value - default: - return b.Skip() - } - return nil - }) -} - -// GetByMyPrivacySettings returns value of ByMyPrivacySettings field. -func (u *UserStatusLastMonth) GetByMyPrivacySettings() (value bool) { - if u == nil { - return - } - return u.ByMyPrivacySettings -} - -// UserStatusClassName is schema name of UserStatusClass. -const UserStatusClassName = "UserStatus" - -// UserStatusClass represents UserStatus generic type. -// -// Example: -// -// g, err := tdapi.DecodeUserStatus(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.UserStatusEmpty: // userStatusEmpty#9d05049 -// case *tdapi.UserStatusOnline: // userStatusOnline#a4d64774 -// case *tdapi.UserStatusOffline: // userStatusOffline#d2b38d05 -// case *tdapi.UserStatusRecently: // userStatusRecently#faa60b5 -// case *tdapi.UserStatusLastWeek: // userStatusLastWeek#12801b57 -// case *tdapi.UserStatusLastMonth: // userStatusLastMonth#b8cb29fc -// default: panic(v) -// } -type UserStatusClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() UserStatusClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeUserStatus implements binary de-serialization for UserStatusClass. -func DecodeUserStatus(buf *bin.Buffer) (UserStatusClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case UserStatusEmptyTypeID: - // Decoding userStatusEmpty#9d05049. - v := UserStatusEmpty{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - case UserStatusOnlineTypeID: - // Decoding userStatusOnline#a4d64774. - v := UserStatusOnline{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - case UserStatusOfflineTypeID: - // Decoding userStatusOffline#d2b38d05. - v := UserStatusOffline{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - case UserStatusRecentlyTypeID: - // Decoding userStatusRecently#faa60b5. - v := UserStatusRecently{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - case UserStatusLastWeekTypeID: - // Decoding userStatusLastWeek#12801b57. - v := UserStatusLastWeek{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - case UserStatusLastMonthTypeID: - // Decoding userStatusLastMonth#b8cb29fc. - v := UserStatusLastMonth{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONUserStatus implements binary de-serialization for UserStatusClass. -func DecodeTDLibJSONUserStatus(buf tdjson.Decoder) (UserStatusClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "userStatusEmpty": - // Decoding userStatusEmpty#9d05049. - v := UserStatusEmpty{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - case "userStatusOnline": - // Decoding userStatusOnline#a4d64774. - v := UserStatusOnline{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - case "userStatusOffline": - // Decoding userStatusOffline#d2b38d05. - v := UserStatusOffline{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - case "userStatusRecently": - // Decoding userStatusRecently#faa60b5. - v := UserStatusRecently{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - case "userStatusLastWeek": - // Decoding userStatusLastWeek#12801b57. - v := UserStatusLastWeek{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - case "userStatusLastMonth": - // Decoding userStatusLastMonth#b8cb29fc. - v := UserStatusLastMonth{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode UserStatusClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// UserStatus boxes the UserStatusClass providing a helper. -type UserStatusBox struct { - UserStatus UserStatusClass -} - -// Decode implements bin.Decoder for UserStatusBox. -func (b *UserStatusBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode UserStatusBox to nil") - } - v, err := DecodeUserStatus(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.UserStatus = v - return nil -} - -// Encode implements bin.Encode for UserStatusBox. -func (b *UserStatusBox) Encode(buf *bin.Buffer) error { - if b == nil || b.UserStatus == nil { - return fmt.Errorf("unable to encode UserStatusClass as nil") - } - return b.UserStatus.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for UserStatusBox. -func (b *UserStatusBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode UserStatusBox to nil") - } - v, err := DecodeTDLibJSONUserStatus(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.UserStatus = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for UserStatusBox. -func (b *UserStatusBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.UserStatus == nil { - return fmt.Errorf("unable to encode UserStatusClass as nil") - } - return b.UserStatus.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_user_support_info_gen.go b/tdapi/tl_user_support_info_gen.go deleted file mode 100644 index 76720bf1e..000000000 --- a/tdapi/tl_user_support_info_gen.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UserSupportInfo represents TL type `userSupportInfo#b50e1c29`. -type UserSupportInfo struct { - // Information message - Message FormattedText - // Information author - Author string - // Information change date - Date int32 -} - -// UserSupportInfoTypeID is TL type id of UserSupportInfo. -const UserSupportInfoTypeID = 0xb50e1c29 - -// Ensuring interfaces in compile-time for UserSupportInfo. -var ( - _ bin.Encoder = &UserSupportInfo{} - _ bin.Decoder = &UserSupportInfo{} - _ bin.BareEncoder = &UserSupportInfo{} - _ bin.BareDecoder = &UserSupportInfo{} -) - -func (u *UserSupportInfo) Zero() bool { - if u == nil { - return true - } - if !(u.Message.Zero()) { - return false - } - if !(u.Author == "") { - return false - } - if !(u.Date == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserSupportInfo) String() string { - if u == nil { - return "UserSupportInfo(nil)" - } - type Alias UserSupportInfo - return fmt.Sprintf("UserSupportInfo%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserSupportInfo) TypeID() uint32 { - return UserSupportInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserSupportInfo) TypeName() string { - return "userSupportInfo" -} - -// TypeInfo returns info about TL type. -func (u *UserSupportInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userSupportInfo", - ID: UserSupportInfoTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Message", - SchemaName: "message", - }, - { - Name: "Author", - SchemaName: "author", - }, - { - Name: "Date", - SchemaName: "date", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserSupportInfo) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userSupportInfo#b50e1c29 as nil") - } - b.PutID(UserSupportInfoTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserSupportInfo) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userSupportInfo#b50e1c29 as nil") - } - if err := u.Message.Encode(b); err != nil { - return fmt.Errorf("unable to encode userSupportInfo#b50e1c29: field message: %w", err) - } - b.PutString(u.Author) - b.PutInt32(u.Date) - return nil -} - -// Decode implements bin.Decoder. -func (u *UserSupportInfo) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userSupportInfo#b50e1c29 to nil") - } - if err := b.ConsumeID(UserSupportInfoTypeID); err != nil { - return fmt.Errorf("unable to decode userSupportInfo#b50e1c29: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserSupportInfo) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userSupportInfo#b50e1c29 to nil") - } - { - if err := u.Message.Decode(b); err != nil { - return fmt.Errorf("unable to decode userSupportInfo#b50e1c29: field message: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode userSupportInfo#b50e1c29: field author: %w", err) - } - u.Author = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userSupportInfo#b50e1c29: field date: %w", err) - } - u.Date = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserSupportInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userSupportInfo#b50e1c29 as nil") - } - b.ObjStart() - b.PutID("userSupportInfo") - b.Comma() - b.FieldStart("message") - if err := u.Message.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode userSupportInfo#b50e1c29: field message: %w", err) - } - b.Comma() - b.FieldStart("author") - b.PutString(u.Author) - b.Comma() - b.FieldStart("date") - b.PutInt32(u.Date) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserSupportInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userSupportInfo#b50e1c29 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userSupportInfo"); err != nil { - return fmt.Errorf("unable to decode userSupportInfo#b50e1c29: %w", err) - } - case "message": - if err := u.Message.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode userSupportInfo#b50e1c29: field message: %w", err) - } - case "author": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode userSupportInfo#b50e1c29: field author: %w", err) - } - u.Author = value - case "date": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userSupportInfo#b50e1c29: field date: %w", err) - } - u.Date = value - default: - return b.Skip() - } - return nil - }) -} - -// GetMessage returns value of Message field. -func (u *UserSupportInfo) GetMessage() (value FormattedText) { - if u == nil { - return - } - return u.Message -} - -// GetAuthor returns value of Author field. -func (u *UserSupportInfo) GetAuthor() (value string) { - if u == nil { - return - } - return u.Author -} - -// GetDate returns value of Date field. -func (u *UserSupportInfo) GetDate() (value int32) { - if u == nil { - return - } - return u.Date -} diff --git a/tdapi/tl_user_type_gen.go b/tdapi/tl_user_type_gen.go deleted file mode 100644 index 6477e16f0..000000000 --- a/tdapi/tl_user_type_gen.go +++ /dev/null @@ -1,1069 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// UserTypeRegular represents TL type `userTypeRegular#dc51699b`. -type UserTypeRegular struct { -} - -// UserTypeRegularTypeID is TL type id of UserTypeRegular. -const UserTypeRegularTypeID = 0xdc51699b - -// construct implements constructor of UserTypeClass. -func (u UserTypeRegular) construct() UserTypeClass { return &u } - -// Ensuring interfaces in compile-time for UserTypeRegular. -var ( - _ bin.Encoder = &UserTypeRegular{} - _ bin.Decoder = &UserTypeRegular{} - _ bin.BareEncoder = &UserTypeRegular{} - _ bin.BareDecoder = &UserTypeRegular{} - - _ UserTypeClass = &UserTypeRegular{} -) - -func (u *UserTypeRegular) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserTypeRegular) String() string { - if u == nil { - return "UserTypeRegular(nil)" - } - type Alias UserTypeRegular - return fmt.Sprintf("UserTypeRegular%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserTypeRegular) TypeID() uint32 { - return UserTypeRegularTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserTypeRegular) TypeName() string { - return "userTypeRegular" -} - -// TypeInfo returns info about TL type. -func (u *UserTypeRegular) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userTypeRegular", - ID: UserTypeRegularTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserTypeRegular) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userTypeRegular#dc51699b as nil") - } - b.PutID(UserTypeRegularTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserTypeRegular) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userTypeRegular#dc51699b as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserTypeRegular) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userTypeRegular#dc51699b to nil") - } - if err := b.ConsumeID(UserTypeRegularTypeID); err != nil { - return fmt.Errorf("unable to decode userTypeRegular#dc51699b: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserTypeRegular) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userTypeRegular#dc51699b to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserTypeRegular) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userTypeRegular#dc51699b as nil") - } - b.ObjStart() - b.PutID("userTypeRegular") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserTypeRegular) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userTypeRegular#dc51699b to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userTypeRegular"); err != nil { - return fmt.Errorf("unable to decode userTypeRegular#dc51699b: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserTypeDeleted represents TL type `userTypeDeleted#94403d24`. -type UserTypeDeleted struct { -} - -// UserTypeDeletedTypeID is TL type id of UserTypeDeleted. -const UserTypeDeletedTypeID = 0x94403d24 - -// construct implements constructor of UserTypeClass. -func (u UserTypeDeleted) construct() UserTypeClass { return &u } - -// Ensuring interfaces in compile-time for UserTypeDeleted. -var ( - _ bin.Encoder = &UserTypeDeleted{} - _ bin.Decoder = &UserTypeDeleted{} - _ bin.BareEncoder = &UserTypeDeleted{} - _ bin.BareDecoder = &UserTypeDeleted{} - - _ UserTypeClass = &UserTypeDeleted{} -) - -func (u *UserTypeDeleted) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserTypeDeleted) String() string { - if u == nil { - return "UserTypeDeleted(nil)" - } - type Alias UserTypeDeleted - return fmt.Sprintf("UserTypeDeleted%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserTypeDeleted) TypeID() uint32 { - return UserTypeDeletedTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserTypeDeleted) TypeName() string { - return "userTypeDeleted" -} - -// TypeInfo returns info about TL type. -func (u *UserTypeDeleted) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userTypeDeleted", - ID: UserTypeDeletedTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserTypeDeleted) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userTypeDeleted#94403d24 as nil") - } - b.PutID(UserTypeDeletedTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserTypeDeleted) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userTypeDeleted#94403d24 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserTypeDeleted) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userTypeDeleted#94403d24 to nil") - } - if err := b.ConsumeID(UserTypeDeletedTypeID); err != nil { - return fmt.Errorf("unable to decode userTypeDeleted#94403d24: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserTypeDeleted) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userTypeDeleted#94403d24 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserTypeDeleted) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userTypeDeleted#94403d24 as nil") - } - b.ObjStart() - b.PutID("userTypeDeleted") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserTypeDeleted) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userTypeDeleted#94403d24 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userTypeDeleted"); err != nil { - return fmt.Errorf("unable to decode userTypeDeleted#94403d24: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserTypeBot represents TL type `userTypeBot#8ba3cc26`. -type UserTypeBot struct { - // True, if the bot is owned by the current user and can be edited using the methods - // toggleBotUsernameIsActive, reorderBotActiveUsernames, setBotProfilePhoto, setBotName, - // setBotInfoDescription, and setBotInfoShortDescription - CanBeEdited bool - // True, if the bot can be invited to basic group and supergroup chats - CanJoinGroups bool - // True, if the bot can read all messages in basic group or supergroup chats and not just - // those addressed to the bot. In private and channel chats a bot can always read all - // messages - CanReadAllGroupMessages bool - // True, if the bot has the main Web App - HasMainWebApp bool - // True, if the bot supports inline queries - IsInline bool - // Placeholder for inline queries (displayed on the application input field) - InlineQueryPlaceholder string - // True, if the location of the user is expected to be sent with every inline query to - // this bot - NeedLocation bool - // True, if the bot supports connection to Telegram Business accounts - CanConnectToBusiness bool - // True, if the bot can be added to attachment or side menu - CanBeAddedToAttachmentMenu bool - // The number of recently active users of the bot - ActiveUserCount int32 -} - -// UserTypeBotTypeID is TL type id of UserTypeBot. -const UserTypeBotTypeID = 0x8ba3cc26 - -// construct implements constructor of UserTypeClass. -func (u UserTypeBot) construct() UserTypeClass { return &u } - -// Ensuring interfaces in compile-time for UserTypeBot. -var ( - _ bin.Encoder = &UserTypeBot{} - _ bin.Decoder = &UserTypeBot{} - _ bin.BareEncoder = &UserTypeBot{} - _ bin.BareDecoder = &UserTypeBot{} - - _ UserTypeClass = &UserTypeBot{} -) - -func (u *UserTypeBot) Zero() bool { - if u == nil { - return true - } - if !(u.CanBeEdited == false) { - return false - } - if !(u.CanJoinGroups == false) { - return false - } - if !(u.CanReadAllGroupMessages == false) { - return false - } - if !(u.HasMainWebApp == false) { - return false - } - if !(u.IsInline == false) { - return false - } - if !(u.InlineQueryPlaceholder == "") { - return false - } - if !(u.NeedLocation == false) { - return false - } - if !(u.CanConnectToBusiness == false) { - return false - } - if !(u.CanBeAddedToAttachmentMenu == false) { - return false - } - if !(u.ActiveUserCount == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserTypeBot) String() string { - if u == nil { - return "UserTypeBot(nil)" - } - type Alias UserTypeBot - return fmt.Sprintf("UserTypeBot%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserTypeBot) TypeID() uint32 { - return UserTypeBotTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserTypeBot) TypeName() string { - return "userTypeBot" -} - -// TypeInfo returns info about TL type. -func (u *UserTypeBot) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userTypeBot", - ID: UserTypeBotTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "CanBeEdited", - SchemaName: "can_be_edited", - }, - { - Name: "CanJoinGroups", - SchemaName: "can_join_groups", - }, - { - Name: "CanReadAllGroupMessages", - SchemaName: "can_read_all_group_messages", - }, - { - Name: "HasMainWebApp", - SchemaName: "has_main_web_app", - }, - { - Name: "IsInline", - SchemaName: "is_inline", - }, - { - Name: "InlineQueryPlaceholder", - SchemaName: "inline_query_placeholder", - }, - { - Name: "NeedLocation", - SchemaName: "need_location", - }, - { - Name: "CanConnectToBusiness", - SchemaName: "can_connect_to_business", - }, - { - Name: "CanBeAddedToAttachmentMenu", - SchemaName: "can_be_added_to_attachment_menu", - }, - { - Name: "ActiveUserCount", - SchemaName: "active_user_count", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *UserTypeBot) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userTypeBot#8ba3cc26 as nil") - } - b.PutID(UserTypeBotTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserTypeBot) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userTypeBot#8ba3cc26 as nil") - } - b.PutBool(u.CanBeEdited) - b.PutBool(u.CanJoinGroups) - b.PutBool(u.CanReadAllGroupMessages) - b.PutBool(u.HasMainWebApp) - b.PutBool(u.IsInline) - b.PutString(u.InlineQueryPlaceholder) - b.PutBool(u.NeedLocation) - b.PutBool(u.CanConnectToBusiness) - b.PutBool(u.CanBeAddedToAttachmentMenu) - b.PutInt32(u.ActiveUserCount) - return nil -} - -// Decode implements bin.Decoder. -func (u *UserTypeBot) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userTypeBot#8ba3cc26 to nil") - } - if err := b.ConsumeID(UserTypeBotTypeID); err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserTypeBot) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userTypeBot#8ba3cc26 to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_be_edited: %w", err) - } - u.CanBeEdited = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_join_groups: %w", err) - } - u.CanJoinGroups = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_read_all_group_messages: %w", err) - } - u.CanReadAllGroupMessages = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field has_main_web_app: %w", err) - } - u.HasMainWebApp = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field is_inline: %w", err) - } - u.IsInline = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field inline_query_placeholder: %w", err) - } - u.InlineQueryPlaceholder = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field need_location: %w", err) - } - u.NeedLocation = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_connect_to_business: %w", err) - } - u.CanConnectToBusiness = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_be_added_to_attachment_menu: %w", err) - } - u.CanBeAddedToAttachmentMenu = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field active_user_count: %w", err) - } - u.ActiveUserCount = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserTypeBot) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userTypeBot#8ba3cc26 as nil") - } - b.ObjStart() - b.PutID("userTypeBot") - b.Comma() - b.FieldStart("can_be_edited") - b.PutBool(u.CanBeEdited) - b.Comma() - b.FieldStart("can_join_groups") - b.PutBool(u.CanJoinGroups) - b.Comma() - b.FieldStart("can_read_all_group_messages") - b.PutBool(u.CanReadAllGroupMessages) - b.Comma() - b.FieldStart("has_main_web_app") - b.PutBool(u.HasMainWebApp) - b.Comma() - b.FieldStart("is_inline") - b.PutBool(u.IsInline) - b.Comma() - b.FieldStart("inline_query_placeholder") - b.PutString(u.InlineQueryPlaceholder) - b.Comma() - b.FieldStart("need_location") - b.PutBool(u.NeedLocation) - b.Comma() - b.FieldStart("can_connect_to_business") - b.PutBool(u.CanConnectToBusiness) - b.Comma() - b.FieldStart("can_be_added_to_attachment_menu") - b.PutBool(u.CanBeAddedToAttachmentMenu) - b.Comma() - b.FieldStart("active_user_count") - b.PutInt32(u.ActiveUserCount) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserTypeBot) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userTypeBot#8ba3cc26 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userTypeBot"); err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: %w", err) - } - case "can_be_edited": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_be_edited: %w", err) - } - u.CanBeEdited = value - case "can_join_groups": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_join_groups: %w", err) - } - u.CanJoinGroups = value - case "can_read_all_group_messages": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_read_all_group_messages: %w", err) - } - u.CanReadAllGroupMessages = value - case "has_main_web_app": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field has_main_web_app: %w", err) - } - u.HasMainWebApp = value - case "is_inline": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field is_inline: %w", err) - } - u.IsInline = value - case "inline_query_placeholder": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field inline_query_placeholder: %w", err) - } - u.InlineQueryPlaceholder = value - case "need_location": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field need_location: %w", err) - } - u.NeedLocation = value - case "can_connect_to_business": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_connect_to_business: %w", err) - } - u.CanConnectToBusiness = value - case "can_be_added_to_attachment_menu": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field can_be_added_to_attachment_menu: %w", err) - } - u.CanBeAddedToAttachmentMenu = value - case "active_user_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode userTypeBot#8ba3cc26: field active_user_count: %w", err) - } - u.ActiveUserCount = value - default: - return b.Skip() - } - return nil - }) -} - -// GetCanBeEdited returns value of CanBeEdited field. -func (u *UserTypeBot) GetCanBeEdited() (value bool) { - if u == nil { - return - } - return u.CanBeEdited -} - -// GetCanJoinGroups returns value of CanJoinGroups field. -func (u *UserTypeBot) GetCanJoinGroups() (value bool) { - if u == nil { - return - } - return u.CanJoinGroups -} - -// GetCanReadAllGroupMessages returns value of CanReadAllGroupMessages field. -func (u *UserTypeBot) GetCanReadAllGroupMessages() (value bool) { - if u == nil { - return - } - return u.CanReadAllGroupMessages -} - -// GetHasMainWebApp returns value of HasMainWebApp field. -func (u *UserTypeBot) GetHasMainWebApp() (value bool) { - if u == nil { - return - } - return u.HasMainWebApp -} - -// GetIsInline returns value of IsInline field. -func (u *UserTypeBot) GetIsInline() (value bool) { - if u == nil { - return - } - return u.IsInline -} - -// GetInlineQueryPlaceholder returns value of InlineQueryPlaceholder field. -func (u *UserTypeBot) GetInlineQueryPlaceholder() (value string) { - if u == nil { - return - } - return u.InlineQueryPlaceholder -} - -// GetNeedLocation returns value of NeedLocation field. -func (u *UserTypeBot) GetNeedLocation() (value bool) { - if u == nil { - return - } - return u.NeedLocation -} - -// GetCanConnectToBusiness returns value of CanConnectToBusiness field. -func (u *UserTypeBot) GetCanConnectToBusiness() (value bool) { - if u == nil { - return - } - return u.CanConnectToBusiness -} - -// GetCanBeAddedToAttachmentMenu returns value of CanBeAddedToAttachmentMenu field. -func (u *UserTypeBot) GetCanBeAddedToAttachmentMenu() (value bool) { - if u == nil { - return - } - return u.CanBeAddedToAttachmentMenu -} - -// GetActiveUserCount returns value of ActiveUserCount field. -func (u *UserTypeBot) GetActiveUserCount() (value int32) { - if u == nil { - return - } - return u.ActiveUserCount -} - -// UserTypeUnknown represents TL type `userTypeUnknown#d4d0613d`. -type UserTypeUnknown struct { -} - -// UserTypeUnknownTypeID is TL type id of UserTypeUnknown. -const UserTypeUnknownTypeID = 0xd4d0613d - -// construct implements constructor of UserTypeClass. -func (u UserTypeUnknown) construct() UserTypeClass { return &u } - -// Ensuring interfaces in compile-time for UserTypeUnknown. -var ( - _ bin.Encoder = &UserTypeUnknown{} - _ bin.Decoder = &UserTypeUnknown{} - _ bin.BareEncoder = &UserTypeUnknown{} - _ bin.BareDecoder = &UserTypeUnknown{} - - _ UserTypeClass = &UserTypeUnknown{} -) - -func (u *UserTypeUnknown) Zero() bool { - if u == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (u *UserTypeUnknown) String() string { - if u == nil { - return "UserTypeUnknown(nil)" - } - type Alias UserTypeUnknown - return fmt.Sprintf("UserTypeUnknown%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*UserTypeUnknown) TypeID() uint32 { - return UserTypeUnknownTypeID -} - -// TypeName returns name of type in TL schema. -func (*UserTypeUnknown) TypeName() string { - return "userTypeUnknown" -} - -// TypeInfo returns info about TL type. -func (u *UserTypeUnknown) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "userTypeUnknown", - ID: UserTypeUnknownTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (u *UserTypeUnknown) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userTypeUnknown#d4d0613d as nil") - } - b.PutID(UserTypeUnknownTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *UserTypeUnknown) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode userTypeUnknown#d4d0613d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (u *UserTypeUnknown) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userTypeUnknown#d4d0613d to nil") - } - if err := b.ConsumeID(UserTypeUnknownTypeID); err != nil { - return fmt.Errorf("unable to decode userTypeUnknown#d4d0613d: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *UserTypeUnknown) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode userTypeUnknown#d4d0613d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *UserTypeUnknown) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode userTypeUnknown#d4d0613d as nil") - } - b.ObjStart() - b.PutID("userTypeUnknown") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *UserTypeUnknown) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode userTypeUnknown#d4d0613d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("userTypeUnknown"); err != nil { - return fmt.Errorf("unable to decode userTypeUnknown#d4d0613d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// UserTypeClassName is schema name of UserTypeClass. -const UserTypeClassName = "UserType" - -// UserTypeClass represents UserType generic type. -// -// Example: -// -// g, err := tdapi.DecodeUserType(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.UserTypeRegular: // userTypeRegular#dc51699b -// case *tdapi.UserTypeDeleted: // userTypeDeleted#94403d24 -// case *tdapi.UserTypeBot: // userTypeBot#8ba3cc26 -// case *tdapi.UserTypeUnknown: // userTypeUnknown#d4d0613d -// default: panic(v) -// } -type UserTypeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() UserTypeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeUserType implements binary de-serialization for UserTypeClass. -func DecodeUserType(buf *bin.Buffer) (UserTypeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case UserTypeRegularTypeID: - // Decoding userTypeRegular#dc51699b. - v := UserTypeRegular{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserTypeClass: %w", err) - } - return &v, nil - case UserTypeDeletedTypeID: - // Decoding userTypeDeleted#94403d24. - v := UserTypeDeleted{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserTypeClass: %w", err) - } - return &v, nil - case UserTypeBotTypeID: - // Decoding userTypeBot#8ba3cc26. - v := UserTypeBot{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserTypeClass: %w", err) - } - return &v, nil - case UserTypeUnknownTypeID: - // Decoding userTypeUnknown#d4d0613d. - v := UserTypeUnknown{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode UserTypeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONUserType implements binary de-serialization for UserTypeClass. -func DecodeTDLibJSONUserType(buf tdjson.Decoder) (UserTypeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "userTypeRegular": - // Decoding userTypeRegular#dc51699b. - v := UserTypeRegular{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserTypeClass: %w", err) - } - return &v, nil - case "userTypeDeleted": - // Decoding userTypeDeleted#94403d24. - v := UserTypeDeleted{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserTypeClass: %w", err) - } - return &v, nil - case "userTypeBot": - // Decoding userTypeBot#8ba3cc26. - v := UserTypeBot{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserTypeClass: %w", err) - } - return &v, nil - case "userTypeUnknown": - // Decoding userTypeUnknown#d4d0613d. - v := UserTypeUnknown{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode UserTypeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode UserTypeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// UserType boxes the UserTypeClass providing a helper. -type UserTypeBox struct { - UserType UserTypeClass -} - -// Decode implements bin.Decoder for UserTypeBox. -func (b *UserTypeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode UserTypeBox to nil") - } - v, err := DecodeUserType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.UserType = v - return nil -} - -// Encode implements bin.Encode for UserTypeBox. -func (b *UserTypeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.UserType == nil { - return fmt.Errorf("unable to encode UserTypeClass as nil") - } - return b.UserType.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for UserTypeBox. -func (b *UserTypeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode UserTypeBox to nil") - } - v, err := DecodeTDLibJSONUserType(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.UserType = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for UserTypeBox. -func (b *UserTypeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.UserType == nil { - return fmt.Errorf("unable to encode UserTypeClass as nil") - } - return b.UserType.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_usernames_gen.go b/tdapi/tl_usernames_gen.go deleted file mode 100644 index 240f3ef34..000000000 --- a/tdapi/tl_usernames_gen.go +++ /dev/null @@ -1,313 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Usernames represents TL type `usernames#bf343063`. -type Usernames struct { - // List of active usernames; the first one must be shown as the primary username. The - // order of active usernames can be changed with reorderActiveUsernames, - // reorderBotActiveUsernames or reorderSupergroupActiveUsernames - ActiveUsernames []string - // List of currently disabled usernames; the username can be activated with - // toggleUsernameIsActive, toggleBotUsernameIsActive, or toggleSupergroupUsernameIsActive - DisabledUsernames []string - // The active username, which can be changed with setUsername or setSupergroupUsername. - // Information about other active usernames can be received using getCollectibleItemInfo - EditableUsername string -} - -// UsernamesTypeID is TL type id of Usernames. -const UsernamesTypeID = 0xbf343063 - -// Ensuring interfaces in compile-time for Usernames. -var ( - _ bin.Encoder = &Usernames{} - _ bin.Decoder = &Usernames{} - _ bin.BareEncoder = &Usernames{} - _ bin.BareDecoder = &Usernames{} -) - -func (u *Usernames) Zero() bool { - if u == nil { - return true - } - if !(u.ActiveUsernames == nil) { - return false - } - if !(u.DisabledUsernames == nil) { - return false - } - if !(u.EditableUsername == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *Usernames) String() string { - if u == nil { - return "Usernames(nil)" - } - type Alias Usernames - return fmt.Sprintf("Usernames%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Usernames) TypeID() uint32 { - return UsernamesTypeID -} - -// TypeName returns name of type in TL schema. -func (*Usernames) TypeName() string { - return "usernames" -} - -// TypeInfo returns info about TL type. -func (u *Usernames) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "usernames", - ID: UsernamesTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ActiveUsernames", - SchemaName: "active_usernames", - }, - { - Name: "DisabledUsernames", - SchemaName: "disabled_usernames", - }, - { - Name: "EditableUsername", - SchemaName: "editable_username", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *Usernames) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode usernames#bf343063 as nil") - } - b.PutID(UsernamesTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *Usernames) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode usernames#bf343063 as nil") - } - b.PutInt(len(u.ActiveUsernames)) - for _, v := range u.ActiveUsernames { - b.PutString(v) - } - b.PutInt(len(u.DisabledUsernames)) - for _, v := range u.DisabledUsernames { - b.PutString(v) - } - b.PutString(u.EditableUsername) - return nil -} - -// Decode implements bin.Decoder. -func (u *Usernames) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode usernames#bf343063 to nil") - } - if err := b.ConsumeID(UsernamesTypeID); err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *Usernames) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode usernames#bf343063 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: field active_usernames: %w", err) - } - - if headerLen > 0 { - u.ActiveUsernames = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: field active_usernames: %w", err) - } - u.ActiveUsernames = append(u.ActiveUsernames, value) - } - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: field disabled_usernames: %w", err) - } - - if headerLen > 0 { - u.DisabledUsernames = make([]string, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: field disabled_usernames: %w", err) - } - u.DisabledUsernames = append(u.DisabledUsernames, value) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: field editable_username: %w", err) - } - u.EditableUsername = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *Usernames) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode usernames#bf343063 as nil") - } - b.ObjStart() - b.PutID("usernames") - b.Comma() - b.FieldStart("active_usernames") - b.ArrStart() - for _, v := range u.ActiveUsernames { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("disabled_usernames") - b.ArrStart() - for _, v := range u.DisabledUsernames { - b.PutString(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("editable_username") - b.PutString(u.EditableUsername) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *Usernames) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode usernames#bf343063 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("usernames"); err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: %w", err) - } - case "active_usernames": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: field active_usernames: %w", err) - } - u.ActiveUsernames = append(u.ActiveUsernames, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: field active_usernames: %w", err) - } - case "disabled_usernames": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: field disabled_usernames: %w", err) - } - u.DisabledUsernames = append(u.DisabledUsernames, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: field disabled_usernames: %w", err) - } - case "editable_username": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode usernames#bf343063: field editable_username: %w", err) - } - u.EditableUsername = value - default: - return b.Skip() - } - return nil - }) -} - -// GetActiveUsernames returns value of ActiveUsernames field. -func (u *Usernames) GetActiveUsernames() (value []string) { - if u == nil { - return - } - return u.ActiveUsernames -} - -// GetDisabledUsernames returns value of DisabledUsernames field. -func (u *Usernames) GetDisabledUsernames() (value []string) { - if u == nil { - return - } - return u.DisabledUsernames -} - -// GetEditableUsername returns value of EditableUsername field. -func (u *Usernames) GetEditableUsername() (value string) { - if u == nil { - return - } - return u.EditableUsername -} diff --git a/tdapi/tl_users_gen.go b/tdapi/tl_users_gen.go deleted file mode 100644 index f8478566a..000000000 --- a/tdapi/tl_users_gen.go +++ /dev/null @@ -1,251 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Users represents TL type `users#9d955a12`. -type Users struct { - // Approximate total number of users found - TotalCount int32 - // A list of user identifiers - UserIDs []int64 -} - -// UsersTypeID is TL type id of Users. -const UsersTypeID = 0x9d955a12 - -// Ensuring interfaces in compile-time for Users. -var ( - _ bin.Encoder = &Users{} - _ bin.Decoder = &Users{} - _ bin.BareEncoder = &Users{} - _ bin.BareDecoder = &Users{} -) - -func (u *Users) Zero() bool { - if u == nil { - return true - } - if !(u.TotalCount == 0) { - return false - } - if !(u.UserIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (u *Users) String() string { - if u == nil { - return "Users(nil)" - } - type Alias Users - return fmt.Sprintf("Users%+v", Alias(*u)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Users) TypeID() uint32 { - return UsersTypeID -} - -// TypeName returns name of type in TL schema. -func (*Users) TypeName() string { - return "users" -} - -// TypeInfo returns info about TL type. -func (u *Users) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "users", - ID: UsersTypeID, - } - if u == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "TotalCount", - SchemaName: "total_count", - }, - { - Name: "UserIDs", - SchemaName: "user_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (u *Users) Encode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode users#9d955a12 as nil") - } - b.PutID(UsersTypeID) - return u.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (u *Users) EncodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't encode users#9d955a12 as nil") - } - b.PutInt32(u.TotalCount) - b.PutInt(len(u.UserIDs)) - for _, v := range u.UserIDs { - b.PutInt53(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (u *Users) Decode(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode users#9d955a12 to nil") - } - if err := b.ConsumeID(UsersTypeID); err != nil { - return fmt.Errorf("unable to decode users#9d955a12: %w", err) - } - return u.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (u *Users) DecodeBare(b *bin.Buffer) error { - if u == nil { - return fmt.Errorf("can't decode users#9d955a12 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode users#9d955a12: field total_count: %w", err) - } - u.TotalCount = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode users#9d955a12: field user_ids: %w", err) - } - - if headerLen > 0 { - u.UserIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode users#9d955a12: field user_ids: %w", err) - } - u.UserIDs = append(u.UserIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (u *Users) EncodeTDLibJSON(b tdjson.Encoder) error { - if u == nil { - return fmt.Errorf("can't encode users#9d955a12 as nil") - } - b.ObjStart() - b.PutID("users") - b.Comma() - b.FieldStart("total_count") - b.PutInt32(u.TotalCount) - b.Comma() - b.FieldStart("user_ids") - b.ArrStart() - for _, v := range u.UserIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (u *Users) DecodeTDLibJSON(b tdjson.Decoder) error { - if u == nil { - return fmt.Errorf("can't decode users#9d955a12 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("users"); err != nil { - return fmt.Errorf("unable to decode users#9d955a12: %w", err) - } - case "total_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode users#9d955a12: field total_count: %w", err) - } - u.TotalCount = value - case "user_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode users#9d955a12: field user_ids: %w", err) - } - u.UserIDs = append(u.UserIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode users#9d955a12: field user_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetTotalCount returns value of TotalCount field. -func (u *Users) GetTotalCount() (value int32) { - if u == nil { - return - } - return u.TotalCount -} - -// GetUserIDs returns value of UserIDs field. -func (u *Users) GetUserIDs() (value []int64) { - if u == nil { - return - } - return u.UserIDs -} diff --git a/tdapi/tl_validate_order_info_gen.go b/tdapi/tl_validate_order_info_gen.go deleted file mode 100644 index 37022be97..000000000 --- a/tdapi/tl_validate_order_info_gen.go +++ /dev/null @@ -1,281 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ValidateOrderInfoRequest represents TL type `validateOrderInfo#b5985fcf`. -type ValidateOrderInfoRequest struct { - // The invoice - InputInvoice InputInvoiceClass - // The order information, provided by the user; pass null if empty - OrderInfo OrderInfo - // Pass true to save the order information - AllowSave bool -} - -// ValidateOrderInfoRequestTypeID is TL type id of ValidateOrderInfoRequest. -const ValidateOrderInfoRequestTypeID = 0xb5985fcf - -// Ensuring interfaces in compile-time for ValidateOrderInfoRequest. -var ( - _ bin.Encoder = &ValidateOrderInfoRequest{} - _ bin.Decoder = &ValidateOrderInfoRequest{} - _ bin.BareEncoder = &ValidateOrderInfoRequest{} - _ bin.BareDecoder = &ValidateOrderInfoRequest{} -) - -func (v *ValidateOrderInfoRequest) Zero() bool { - if v == nil { - return true - } - if !(v.InputInvoice == nil) { - return false - } - if !(v.OrderInfo.Zero()) { - return false - } - if !(v.AllowSave == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *ValidateOrderInfoRequest) String() string { - if v == nil { - return "ValidateOrderInfoRequest(nil)" - } - type Alias ValidateOrderInfoRequest - return fmt.Sprintf("ValidateOrderInfoRequest%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ValidateOrderInfoRequest) TypeID() uint32 { - return ValidateOrderInfoRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ValidateOrderInfoRequest) TypeName() string { - return "validateOrderInfo" -} - -// TypeInfo returns info about TL type. -func (v *ValidateOrderInfoRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "validateOrderInfo", - ID: ValidateOrderInfoRequestTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "InputInvoice", - SchemaName: "input_invoice", - }, - { - Name: "OrderInfo", - SchemaName: "order_info", - }, - { - Name: "AllowSave", - SchemaName: "allow_save", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *ValidateOrderInfoRequest) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode validateOrderInfo#b5985fcf as nil") - } - b.PutID(ValidateOrderInfoRequestTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *ValidateOrderInfoRequest) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode validateOrderInfo#b5985fcf as nil") - } - if v.InputInvoice == nil { - return fmt.Errorf("unable to encode validateOrderInfo#b5985fcf: field input_invoice is nil") - } - if err := v.InputInvoice.Encode(b); err != nil { - return fmt.Errorf("unable to encode validateOrderInfo#b5985fcf: field input_invoice: %w", err) - } - if err := v.OrderInfo.Encode(b); err != nil { - return fmt.Errorf("unable to encode validateOrderInfo#b5985fcf: field order_info: %w", err) - } - b.PutBool(v.AllowSave) - return nil -} - -// Decode implements bin.Decoder. -func (v *ValidateOrderInfoRequest) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode validateOrderInfo#b5985fcf to nil") - } - if err := b.ConsumeID(ValidateOrderInfoRequestTypeID); err != nil { - return fmt.Errorf("unable to decode validateOrderInfo#b5985fcf: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *ValidateOrderInfoRequest) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode validateOrderInfo#b5985fcf to nil") - } - { - value, err := DecodeInputInvoice(b) - if err != nil { - return fmt.Errorf("unable to decode validateOrderInfo#b5985fcf: field input_invoice: %w", err) - } - v.InputInvoice = value - } - { - if err := v.OrderInfo.Decode(b); err != nil { - return fmt.Errorf("unable to decode validateOrderInfo#b5985fcf: field order_info: %w", err) - } - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode validateOrderInfo#b5985fcf: field allow_save: %w", err) - } - v.AllowSave = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *ValidateOrderInfoRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode validateOrderInfo#b5985fcf as nil") - } - b.ObjStart() - b.PutID("validateOrderInfo") - b.Comma() - b.FieldStart("input_invoice") - if v.InputInvoice == nil { - return fmt.Errorf("unable to encode validateOrderInfo#b5985fcf: field input_invoice is nil") - } - if err := v.InputInvoice.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode validateOrderInfo#b5985fcf: field input_invoice: %w", err) - } - b.Comma() - b.FieldStart("order_info") - if err := v.OrderInfo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode validateOrderInfo#b5985fcf: field order_info: %w", err) - } - b.Comma() - b.FieldStart("allow_save") - b.PutBool(v.AllowSave) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *ValidateOrderInfoRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode validateOrderInfo#b5985fcf to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("validateOrderInfo"); err != nil { - return fmt.Errorf("unable to decode validateOrderInfo#b5985fcf: %w", err) - } - case "input_invoice": - value, err := DecodeTDLibJSONInputInvoice(b) - if err != nil { - return fmt.Errorf("unable to decode validateOrderInfo#b5985fcf: field input_invoice: %w", err) - } - v.InputInvoice = value - case "order_info": - if err := v.OrderInfo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode validateOrderInfo#b5985fcf: field order_info: %w", err) - } - case "allow_save": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode validateOrderInfo#b5985fcf: field allow_save: %w", err) - } - v.AllowSave = value - default: - return b.Skip() - } - return nil - }) -} - -// GetInputInvoice returns value of InputInvoice field. -func (v *ValidateOrderInfoRequest) GetInputInvoice() (value InputInvoiceClass) { - if v == nil { - return - } - return v.InputInvoice -} - -// GetOrderInfo returns value of OrderInfo field. -func (v *ValidateOrderInfoRequest) GetOrderInfo() (value OrderInfo) { - if v == nil { - return - } - return v.OrderInfo -} - -// GetAllowSave returns value of AllowSave field. -func (v *ValidateOrderInfoRequest) GetAllowSave() (value bool) { - if v == nil { - return - } - return v.AllowSave -} - -// ValidateOrderInfo invokes method validateOrderInfo#b5985fcf returning error if any. -func (c *Client) ValidateOrderInfo(ctx context.Context, request *ValidateOrderInfoRequest) (*ValidatedOrderInfo, error) { - var result ValidatedOrderInfo - - if err := c.rpc.Invoke(ctx, request, &result); err != nil { - return nil, err - } - return &result, nil -} diff --git a/tdapi/tl_validated_order_info_gen.go b/tdapi/tl_validated_order_info_gen.go deleted file mode 100644 index 15c15cbf8..000000000 --- a/tdapi/tl_validated_order_info_gen.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ValidatedOrderInfo represents TL type `validatedOrderInfo#ac585f14`. -type ValidatedOrderInfo struct { - // Temporary identifier of the order information - OrderInfoID string - // Available shipping options - ShippingOptions []ShippingOption -} - -// ValidatedOrderInfoTypeID is TL type id of ValidatedOrderInfo. -const ValidatedOrderInfoTypeID = 0xac585f14 - -// Ensuring interfaces in compile-time for ValidatedOrderInfo. -var ( - _ bin.Encoder = &ValidatedOrderInfo{} - _ bin.Decoder = &ValidatedOrderInfo{} - _ bin.BareEncoder = &ValidatedOrderInfo{} - _ bin.BareDecoder = &ValidatedOrderInfo{} -) - -func (v *ValidatedOrderInfo) Zero() bool { - if v == nil { - return true - } - if !(v.OrderInfoID == "") { - return false - } - if !(v.ShippingOptions == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *ValidatedOrderInfo) String() string { - if v == nil { - return "ValidatedOrderInfo(nil)" - } - type Alias ValidatedOrderInfo - return fmt.Sprintf("ValidatedOrderInfo%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ValidatedOrderInfo) TypeID() uint32 { - return ValidatedOrderInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*ValidatedOrderInfo) TypeName() string { - return "validatedOrderInfo" -} - -// TypeInfo returns info about TL type. -func (v *ValidatedOrderInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "validatedOrderInfo", - ID: ValidatedOrderInfoTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "OrderInfoID", - SchemaName: "order_info_id", - }, - { - Name: "ShippingOptions", - SchemaName: "shipping_options", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *ValidatedOrderInfo) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode validatedOrderInfo#ac585f14 as nil") - } - b.PutID(ValidatedOrderInfoTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *ValidatedOrderInfo) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode validatedOrderInfo#ac585f14 as nil") - } - b.PutString(v.OrderInfoID) - b.PutInt(len(v.ShippingOptions)) - for idx, v := range v.ShippingOptions { - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare validatedOrderInfo#ac585f14: field shipping_options element with index %d: %w", idx, err) - } - } - return nil -} - -// Decode implements bin.Decoder. -func (v *ValidatedOrderInfo) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode validatedOrderInfo#ac585f14 to nil") - } - if err := b.ConsumeID(ValidatedOrderInfoTypeID); err != nil { - return fmt.Errorf("unable to decode validatedOrderInfo#ac585f14: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *ValidatedOrderInfo) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode validatedOrderInfo#ac585f14 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode validatedOrderInfo#ac585f14: field order_info_id: %w", err) - } - v.OrderInfoID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode validatedOrderInfo#ac585f14: field shipping_options: %w", err) - } - - if headerLen > 0 { - v.ShippingOptions = make([]ShippingOption, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - var value ShippingOption - if err := value.DecodeBare(b); err != nil { - return fmt.Errorf("unable to decode bare validatedOrderInfo#ac585f14: field shipping_options: %w", err) - } - v.ShippingOptions = append(v.ShippingOptions, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *ValidatedOrderInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode validatedOrderInfo#ac585f14 as nil") - } - b.ObjStart() - b.PutID("validatedOrderInfo") - b.Comma() - b.FieldStart("order_info_id") - b.PutString(v.OrderInfoID) - b.Comma() - b.FieldStart("shipping_options") - b.ArrStart() - for idx, v := range v.ShippingOptions { - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode validatedOrderInfo#ac585f14: field shipping_options element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *ValidatedOrderInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode validatedOrderInfo#ac585f14 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("validatedOrderInfo"); err != nil { - return fmt.Errorf("unable to decode validatedOrderInfo#ac585f14: %w", err) - } - case "order_info_id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode validatedOrderInfo#ac585f14: field order_info_id: %w", err) - } - v.OrderInfoID = value - case "shipping_options": - if err := b.Arr(func(b tdjson.Decoder) error { - var value ShippingOption - if err := value.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode validatedOrderInfo#ac585f14: field shipping_options: %w", err) - } - v.ShippingOptions = append(v.ShippingOptions, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode validatedOrderInfo#ac585f14: field shipping_options: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetOrderInfoID returns value of OrderInfoID field. -func (v *ValidatedOrderInfo) GetOrderInfoID() (value string) { - if v == nil { - return - } - return v.OrderInfoID -} - -// GetShippingOptions returns value of ShippingOptions field. -func (v *ValidatedOrderInfo) GetShippingOptions() (value []ShippingOption) { - if v == nil { - return - } - return v.ShippingOptions -} diff --git a/tdapi/tl_vector_path_command_gen.go b/tdapi/tl_vector_path_command_gen.go deleted file mode 100644 index 399bfaf05..000000000 --- a/tdapi/tl_vector_path_command_gen.go +++ /dev/null @@ -1,572 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// VectorPathCommandLine represents TL type `vectorPathCommandLine#db663c8a`. -type VectorPathCommandLine struct { - // The end point of the straight line - EndPoint Point -} - -// VectorPathCommandLineTypeID is TL type id of VectorPathCommandLine. -const VectorPathCommandLineTypeID = 0xdb663c8a - -// construct implements constructor of VectorPathCommandClass. -func (v VectorPathCommandLine) construct() VectorPathCommandClass { return &v } - -// Ensuring interfaces in compile-time for VectorPathCommandLine. -var ( - _ bin.Encoder = &VectorPathCommandLine{} - _ bin.Decoder = &VectorPathCommandLine{} - _ bin.BareEncoder = &VectorPathCommandLine{} - _ bin.BareDecoder = &VectorPathCommandLine{} - - _ VectorPathCommandClass = &VectorPathCommandLine{} -) - -func (v *VectorPathCommandLine) Zero() bool { - if v == nil { - return true - } - if !(v.EndPoint.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *VectorPathCommandLine) String() string { - if v == nil { - return "VectorPathCommandLine(nil)" - } - type Alias VectorPathCommandLine - return fmt.Sprintf("VectorPathCommandLine%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*VectorPathCommandLine) TypeID() uint32 { - return VectorPathCommandLineTypeID -} - -// TypeName returns name of type in TL schema. -func (*VectorPathCommandLine) TypeName() string { - return "vectorPathCommandLine" -} - -// TypeInfo returns info about TL type. -func (v *VectorPathCommandLine) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "vectorPathCommandLine", - ID: VectorPathCommandLineTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "EndPoint", - SchemaName: "end_point", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *VectorPathCommandLine) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode vectorPathCommandLine#db663c8a as nil") - } - b.PutID(VectorPathCommandLineTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *VectorPathCommandLine) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode vectorPathCommandLine#db663c8a as nil") - } - if err := v.EndPoint.Encode(b); err != nil { - return fmt.Errorf("unable to encode vectorPathCommandLine#db663c8a: field end_point: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (v *VectorPathCommandLine) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode vectorPathCommandLine#db663c8a to nil") - } - if err := b.ConsumeID(VectorPathCommandLineTypeID); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandLine#db663c8a: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *VectorPathCommandLine) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode vectorPathCommandLine#db663c8a to nil") - } - { - if err := v.EndPoint.Decode(b); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandLine#db663c8a: field end_point: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *VectorPathCommandLine) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode vectorPathCommandLine#db663c8a as nil") - } - b.ObjStart() - b.PutID("vectorPathCommandLine") - b.Comma() - b.FieldStart("end_point") - if err := v.EndPoint.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode vectorPathCommandLine#db663c8a: field end_point: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *VectorPathCommandLine) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode vectorPathCommandLine#db663c8a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("vectorPathCommandLine"); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandLine#db663c8a: %w", err) - } - case "end_point": - if err := v.EndPoint.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandLine#db663c8a: field end_point: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetEndPoint returns value of EndPoint field. -func (v *VectorPathCommandLine) GetEndPoint() (value Point) { - if v == nil { - return - } - return v.EndPoint -} - -// VectorPathCommandCubicBezierCurve represents TL type `vectorPathCommandCubicBezierCurve#494c3e3a`. -type VectorPathCommandCubicBezierCurve struct { - // The start control point of the curve - StartControlPoint Point - // The end control point of the curve - EndControlPoint Point - // The end point of the curve - EndPoint Point -} - -// VectorPathCommandCubicBezierCurveTypeID is TL type id of VectorPathCommandCubicBezierCurve. -const VectorPathCommandCubicBezierCurveTypeID = 0x494c3e3a - -// construct implements constructor of VectorPathCommandClass. -func (v VectorPathCommandCubicBezierCurve) construct() VectorPathCommandClass { return &v } - -// Ensuring interfaces in compile-time for VectorPathCommandCubicBezierCurve. -var ( - _ bin.Encoder = &VectorPathCommandCubicBezierCurve{} - _ bin.Decoder = &VectorPathCommandCubicBezierCurve{} - _ bin.BareEncoder = &VectorPathCommandCubicBezierCurve{} - _ bin.BareDecoder = &VectorPathCommandCubicBezierCurve{} - - _ VectorPathCommandClass = &VectorPathCommandCubicBezierCurve{} -) - -func (v *VectorPathCommandCubicBezierCurve) Zero() bool { - if v == nil { - return true - } - if !(v.StartControlPoint.Zero()) { - return false - } - if !(v.EndControlPoint.Zero()) { - return false - } - if !(v.EndPoint.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *VectorPathCommandCubicBezierCurve) String() string { - if v == nil { - return "VectorPathCommandCubicBezierCurve(nil)" - } - type Alias VectorPathCommandCubicBezierCurve - return fmt.Sprintf("VectorPathCommandCubicBezierCurve%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*VectorPathCommandCubicBezierCurve) TypeID() uint32 { - return VectorPathCommandCubicBezierCurveTypeID -} - -// TypeName returns name of type in TL schema. -func (*VectorPathCommandCubicBezierCurve) TypeName() string { - return "vectorPathCommandCubicBezierCurve" -} - -// TypeInfo returns info about TL type. -func (v *VectorPathCommandCubicBezierCurve) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "vectorPathCommandCubicBezierCurve", - ID: VectorPathCommandCubicBezierCurveTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StartControlPoint", - SchemaName: "start_control_point", - }, - { - Name: "EndControlPoint", - SchemaName: "end_control_point", - }, - { - Name: "EndPoint", - SchemaName: "end_point", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *VectorPathCommandCubicBezierCurve) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode vectorPathCommandCubicBezierCurve#494c3e3a as nil") - } - b.PutID(VectorPathCommandCubicBezierCurveTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *VectorPathCommandCubicBezierCurve) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode vectorPathCommandCubicBezierCurve#494c3e3a as nil") - } - if err := v.StartControlPoint.Encode(b); err != nil { - return fmt.Errorf("unable to encode vectorPathCommandCubicBezierCurve#494c3e3a: field start_control_point: %w", err) - } - if err := v.EndControlPoint.Encode(b); err != nil { - return fmt.Errorf("unable to encode vectorPathCommandCubicBezierCurve#494c3e3a: field end_control_point: %w", err) - } - if err := v.EndPoint.Encode(b); err != nil { - return fmt.Errorf("unable to encode vectorPathCommandCubicBezierCurve#494c3e3a: field end_point: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (v *VectorPathCommandCubicBezierCurve) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode vectorPathCommandCubicBezierCurve#494c3e3a to nil") - } - if err := b.ConsumeID(VectorPathCommandCubicBezierCurveTypeID); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandCubicBezierCurve#494c3e3a: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *VectorPathCommandCubicBezierCurve) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode vectorPathCommandCubicBezierCurve#494c3e3a to nil") - } - { - if err := v.StartControlPoint.Decode(b); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandCubicBezierCurve#494c3e3a: field start_control_point: %w", err) - } - } - { - if err := v.EndControlPoint.Decode(b); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandCubicBezierCurve#494c3e3a: field end_control_point: %w", err) - } - } - { - if err := v.EndPoint.Decode(b); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandCubicBezierCurve#494c3e3a: field end_point: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *VectorPathCommandCubicBezierCurve) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode vectorPathCommandCubicBezierCurve#494c3e3a as nil") - } - b.ObjStart() - b.PutID("vectorPathCommandCubicBezierCurve") - b.Comma() - b.FieldStart("start_control_point") - if err := v.StartControlPoint.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode vectorPathCommandCubicBezierCurve#494c3e3a: field start_control_point: %w", err) - } - b.Comma() - b.FieldStart("end_control_point") - if err := v.EndControlPoint.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode vectorPathCommandCubicBezierCurve#494c3e3a: field end_control_point: %w", err) - } - b.Comma() - b.FieldStart("end_point") - if err := v.EndPoint.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode vectorPathCommandCubicBezierCurve#494c3e3a: field end_point: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *VectorPathCommandCubicBezierCurve) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode vectorPathCommandCubicBezierCurve#494c3e3a to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("vectorPathCommandCubicBezierCurve"); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandCubicBezierCurve#494c3e3a: %w", err) - } - case "start_control_point": - if err := v.StartControlPoint.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandCubicBezierCurve#494c3e3a: field start_control_point: %w", err) - } - case "end_control_point": - if err := v.EndControlPoint.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandCubicBezierCurve#494c3e3a: field end_control_point: %w", err) - } - case "end_point": - if err := v.EndPoint.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode vectorPathCommandCubicBezierCurve#494c3e3a: field end_point: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStartControlPoint returns value of StartControlPoint field. -func (v *VectorPathCommandCubicBezierCurve) GetStartControlPoint() (value Point) { - if v == nil { - return - } - return v.StartControlPoint -} - -// GetEndControlPoint returns value of EndControlPoint field. -func (v *VectorPathCommandCubicBezierCurve) GetEndControlPoint() (value Point) { - if v == nil { - return - } - return v.EndControlPoint -} - -// GetEndPoint returns value of EndPoint field. -func (v *VectorPathCommandCubicBezierCurve) GetEndPoint() (value Point) { - if v == nil { - return - } - return v.EndPoint -} - -// VectorPathCommandClassName is schema name of VectorPathCommandClass. -const VectorPathCommandClassName = "VectorPathCommand" - -// VectorPathCommandClass represents VectorPathCommand generic type. -// -// Example: -// -// g, err := tdapi.DecodeVectorPathCommand(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.VectorPathCommandLine: // vectorPathCommandLine#db663c8a -// case *tdapi.VectorPathCommandCubicBezierCurve: // vectorPathCommandCubicBezierCurve#494c3e3a -// default: panic(v) -// } -type VectorPathCommandClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() VectorPathCommandClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error - - // The end point of the straight line - GetEndPoint() (value Point) -} - -// DecodeVectorPathCommand implements binary de-serialization for VectorPathCommandClass. -func DecodeVectorPathCommand(buf *bin.Buffer) (VectorPathCommandClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case VectorPathCommandLineTypeID: - // Decoding vectorPathCommandLine#db663c8a. - v := VectorPathCommandLine{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode VectorPathCommandClass: %w", err) - } - return &v, nil - case VectorPathCommandCubicBezierCurveTypeID: - // Decoding vectorPathCommandCubicBezierCurve#494c3e3a. - v := VectorPathCommandCubicBezierCurve{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode VectorPathCommandClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode VectorPathCommandClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONVectorPathCommand implements binary de-serialization for VectorPathCommandClass. -func DecodeTDLibJSONVectorPathCommand(buf tdjson.Decoder) (VectorPathCommandClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "vectorPathCommandLine": - // Decoding vectorPathCommandLine#db663c8a. - v := VectorPathCommandLine{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode VectorPathCommandClass: %w", err) - } - return &v, nil - case "vectorPathCommandCubicBezierCurve": - // Decoding vectorPathCommandCubicBezierCurve#494c3e3a. - v := VectorPathCommandCubicBezierCurve{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode VectorPathCommandClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode VectorPathCommandClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// VectorPathCommand boxes the VectorPathCommandClass providing a helper. -type VectorPathCommandBox struct { - VectorPathCommand VectorPathCommandClass -} - -// Decode implements bin.Decoder for VectorPathCommandBox. -func (b *VectorPathCommandBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode VectorPathCommandBox to nil") - } - v, err := DecodeVectorPathCommand(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.VectorPathCommand = v - return nil -} - -// Encode implements bin.Encode for VectorPathCommandBox. -func (b *VectorPathCommandBox) Encode(buf *bin.Buffer) error { - if b == nil || b.VectorPathCommand == nil { - return fmt.Errorf("unable to encode VectorPathCommandClass as nil") - } - return b.VectorPathCommand.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for VectorPathCommandBox. -func (b *VectorPathCommandBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode VectorPathCommandBox to nil") - } - v, err := DecodeTDLibJSONVectorPathCommand(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.VectorPathCommand = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for VectorPathCommandBox. -func (b *VectorPathCommandBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.VectorPathCommand == nil { - return fmt.Errorf("unable to encode VectorPathCommandClass as nil") - } - return b.VectorPathCommand.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_venue_gen.go b/tdapi/tl_venue_gen.go deleted file mode 100644 index a8ed975aa..000000000 --- a/tdapi/tl_venue_gen.go +++ /dev/null @@ -1,364 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Venue represents TL type `venue#3fcd1af9`. -type Venue struct { - // Venue location; as defined by the sender - Location Location - // Venue name; as defined by the sender - Title string - // Venue address; as defined by the sender - Address string - // Provider of the venue database; as defined by the sender. Currently, only "foursquare" - // and "gplaces" (Google Places) need to be supported - Provider string - // Identifier of the venue in the provider database; as defined by the sender - ID string - // Type of the venue in the provider database; as defined by the sender - Type string -} - -// VenueTypeID is TL type id of Venue. -const VenueTypeID = 0x3fcd1af9 - -// Ensuring interfaces in compile-time for Venue. -var ( - _ bin.Encoder = &Venue{} - _ bin.Decoder = &Venue{} - _ bin.BareEncoder = &Venue{} - _ bin.BareDecoder = &Venue{} -) - -func (v *Venue) Zero() bool { - if v == nil { - return true - } - if !(v.Location.Zero()) { - return false - } - if !(v.Title == "") { - return false - } - if !(v.Address == "") { - return false - } - if !(v.Provider == "") { - return false - } - if !(v.ID == "") { - return false - } - if !(v.Type == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *Venue) String() string { - if v == nil { - return "Venue(nil)" - } - type Alias Venue - return fmt.Sprintf("Venue%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Venue) TypeID() uint32 { - return VenueTypeID -} - -// TypeName returns name of type in TL schema. -func (*Venue) TypeName() string { - return "venue" -} - -// TypeInfo returns info about TL type. -func (v *Venue) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "venue", - ID: VenueTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Location", - SchemaName: "location", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Address", - SchemaName: "address", - }, - { - Name: "Provider", - SchemaName: "provider", - }, - { - Name: "ID", - SchemaName: "id", - }, - { - Name: "Type", - SchemaName: "type", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *Venue) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode venue#3fcd1af9 as nil") - } - b.PutID(VenueTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *Venue) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode venue#3fcd1af9 as nil") - } - if err := v.Location.Encode(b); err != nil { - return fmt.Errorf("unable to encode venue#3fcd1af9: field location: %w", err) - } - b.PutString(v.Title) - b.PutString(v.Address) - b.PutString(v.Provider) - b.PutString(v.ID) - b.PutString(v.Type) - return nil -} - -// Decode implements bin.Decoder. -func (v *Venue) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode venue#3fcd1af9 to nil") - } - if err := b.ConsumeID(VenueTypeID); err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *Venue) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode venue#3fcd1af9 to nil") - } - { - if err := v.Location.Decode(b); err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field location: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field title: %w", err) - } - v.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field address: %w", err) - } - v.Address = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field provider: %w", err) - } - v.Provider = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field id: %w", err) - } - v.ID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field type: %w", err) - } - v.Type = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *Venue) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode venue#3fcd1af9 as nil") - } - b.ObjStart() - b.PutID("venue") - b.Comma() - b.FieldStart("location") - if err := v.Location.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode venue#3fcd1af9: field location: %w", err) - } - b.Comma() - b.FieldStart("title") - b.PutString(v.Title) - b.Comma() - b.FieldStart("address") - b.PutString(v.Address) - b.Comma() - b.FieldStart("provider") - b.PutString(v.Provider) - b.Comma() - b.FieldStart("id") - b.PutString(v.ID) - b.Comma() - b.FieldStart("type") - b.PutString(v.Type) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *Venue) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode venue#3fcd1af9 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("venue"); err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: %w", err) - } - case "location": - if err := v.Location.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field location: %w", err) - } - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field title: %w", err) - } - v.Title = value - case "address": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field address: %w", err) - } - v.Address = value - case "provider": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field provider: %w", err) - } - v.Provider = value - case "id": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field id: %w", err) - } - v.ID = value - case "type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode venue#3fcd1af9: field type: %w", err) - } - v.Type = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLocation returns value of Location field. -func (v *Venue) GetLocation() (value Location) { - if v == nil { - return - } - return v.Location -} - -// GetTitle returns value of Title field. -func (v *Venue) GetTitle() (value string) { - if v == nil { - return - } - return v.Title -} - -// GetAddress returns value of Address field. -func (v *Venue) GetAddress() (value string) { - if v == nil { - return - } - return v.Address -} - -// GetProvider returns value of Provider field. -func (v *Venue) GetProvider() (value string) { - if v == nil { - return - } - return v.Provider -} - -// GetID returns value of ID field. -func (v *Venue) GetID() (value string) { - if v == nil { - return - } - return v.ID -} - -// GetType returns value of Type field. -func (v *Venue) GetType() (value string) { - if v == nil { - return - } - return v.Type -} diff --git a/tdapi/tl_verification_status_gen.go b/tdapi/tl_verification_status_gen.go deleted file mode 100644 index e72ec34aa..000000000 --- a/tdapi/tl_verification_status_gen.go +++ /dev/null @@ -1,296 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// VerificationStatus represents TL type `verificationStatus#3ae6a18c`. -type VerificationStatus struct { - // True, if the chat or the user is verified by Telegram - IsVerified bool - // True, if the chat or the user is marked as scam by Telegram - IsScam bool - // True, if the chat or the user is marked as fake by Telegram - IsFake bool - // Identifier of the custom emoji to be shown as verification sign provided by a bot for - // the user; 0 if none - BotVerificationIconCustomEmojiID int64 -} - -// VerificationStatusTypeID is TL type id of VerificationStatus. -const VerificationStatusTypeID = 0x3ae6a18c - -// Ensuring interfaces in compile-time for VerificationStatus. -var ( - _ bin.Encoder = &VerificationStatus{} - _ bin.Decoder = &VerificationStatus{} - _ bin.BareEncoder = &VerificationStatus{} - _ bin.BareDecoder = &VerificationStatus{} -) - -func (v *VerificationStatus) Zero() bool { - if v == nil { - return true - } - if !(v.IsVerified == false) { - return false - } - if !(v.IsScam == false) { - return false - } - if !(v.IsFake == false) { - return false - } - if !(v.BotVerificationIconCustomEmojiID == 0) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *VerificationStatus) String() string { - if v == nil { - return "VerificationStatus(nil)" - } - type Alias VerificationStatus - return fmt.Sprintf("VerificationStatus%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*VerificationStatus) TypeID() uint32 { - return VerificationStatusTypeID -} - -// TypeName returns name of type in TL schema. -func (*VerificationStatus) TypeName() string { - return "verificationStatus" -} - -// TypeInfo returns info about TL type. -func (v *VerificationStatus) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "verificationStatus", - ID: VerificationStatusTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "IsVerified", - SchemaName: "is_verified", - }, - { - Name: "IsScam", - SchemaName: "is_scam", - }, - { - Name: "IsFake", - SchemaName: "is_fake", - }, - { - Name: "BotVerificationIconCustomEmojiID", - SchemaName: "bot_verification_icon_custom_emoji_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *VerificationStatus) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode verificationStatus#3ae6a18c as nil") - } - b.PutID(VerificationStatusTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *VerificationStatus) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode verificationStatus#3ae6a18c as nil") - } - b.PutBool(v.IsVerified) - b.PutBool(v.IsScam) - b.PutBool(v.IsFake) - b.PutLong(v.BotVerificationIconCustomEmojiID) - return nil -} - -// Decode implements bin.Decoder. -func (v *VerificationStatus) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode verificationStatus#3ae6a18c to nil") - } - if err := b.ConsumeID(VerificationStatusTypeID); err != nil { - return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *VerificationStatus) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode verificationStatus#3ae6a18c to nil") - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_verified: %w", err) - } - v.IsVerified = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_scam: %w", err) - } - v.IsScam = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_fake: %w", err) - } - v.IsFake = value - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field bot_verification_icon_custom_emoji_id: %w", err) - } - v.BotVerificationIconCustomEmojiID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *VerificationStatus) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode verificationStatus#3ae6a18c as nil") - } - b.ObjStart() - b.PutID("verificationStatus") - b.Comma() - b.FieldStart("is_verified") - b.PutBool(v.IsVerified) - b.Comma() - b.FieldStart("is_scam") - b.PutBool(v.IsScam) - b.Comma() - b.FieldStart("is_fake") - b.PutBool(v.IsFake) - b.Comma() - b.FieldStart("bot_verification_icon_custom_emoji_id") - b.PutLong(v.BotVerificationIconCustomEmojiID) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *VerificationStatus) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode verificationStatus#3ae6a18c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("verificationStatus"); err != nil { - return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: %w", err) - } - case "is_verified": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_verified: %w", err) - } - v.IsVerified = value - case "is_scam": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_scam: %w", err) - } - v.IsScam = value - case "is_fake": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field is_fake: %w", err) - } - v.IsFake = value - case "bot_verification_icon_custom_emoji_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode verificationStatus#3ae6a18c: field bot_verification_icon_custom_emoji_id: %w", err) - } - v.BotVerificationIconCustomEmojiID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetIsVerified returns value of IsVerified field. -func (v *VerificationStatus) GetIsVerified() (value bool) { - if v == nil { - return - } - return v.IsVerified -} - -// GetIsScam returns value of IsScam field. -func (v *VerificationStatus) GetIsScam() (value bool) { - if v == nil { - return - } - return v.IsScam -} - -// GetIsFake returns value of IsFake field. -func (v *VerificationStatus) GetIsFake() (value bool) { - if v == nil { - return - } - return v.IsFake -} - -// GetBotVerificationIconCustomEmojiID returns value of BotVerificationIconCustomEmojiID field. -func (v *VerificationStatus) GetBotVerificationIconCustomEmojiID() (value int64) { - if v == nil { - return - } - return v.BotVerificationIconCustomEmojiID -} diff --git a/tdapi/tl_video_chat_gen.go b/tdapi/tl_video_chat_gen.go deleted file mode 100644 index 0bf1de9c8..000000000 --- a/tdapi/tl_video_chat_gen.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// VideoChat represents TL type `videoChat#ae158d28`. -type VideoChat struct { - // Group call identifier of an active video chat; 0 if none. Full information about the - // video chat can be received through the method getGroupCall - GroupCallID int32 - // True, if the video chat has participants - HasParticipants bool - // Default group call participant identifier to join the video chat; may be null - DefaultParticipantID MessageSenderClass -} - -// VideoChatTypeID is TL type id of VideoChat. -const VideoChatTypeID = 0xae158d28 - -// Ensuring interfaces in compile-time for VideoChat. -var ( - _ bin.Encoder = &VideoChat{} - _ bin.Decoder = &VideoChat{} - _ bin.BareEncoder = &VideoChat{} - _ bin.BareDecoder = &VideoChat{} -) - -func (v *VideoChat) Zero() bool { - if v == nil { - return true - } - if !(v.GroupCallID == 0) { - return false - } - if !(v.HasParticipants == false) { - return false - } - if !(v.DefaultParticipantID == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *VideoChat) String() string { - if v == nil { - return "VideoChat(nil)" - } - type Alias VideoChat - return fmt.Sprintf("VideoChat%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*VideoChat) TypeID() uint32 { - return VideoChatTypeID -} - -// TypeName returns name of type in TL schema. -func (*VideoChat) TypeName() string { - return "videoChat" -} - -// TypeInfo returns info about TL type. -func (v *VideoChat) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "videoChat", - ID: VideoChatTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GroupCallID", - SchemaName: "group_call_id", - }, - { - Name: "HasParticipants", - SchemaName: "has_participants", - }, - { - Name: "DefaultParticipantID", - SchemaName: "default_participant_id", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *VideoChat) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode videoChat#ae158d28 as nil") - } - b.PutID(VideoChatTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *VideoChat) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode videoChat#ae158d28 as nil") - } - b.PutInt32(v.GroupCallID) - b.PutBool(v.HasParticipants) - if v.DefaultParticipantID == nil { - return fmt.Errorf("unable to encode videoChat#ae158d28: field default_participant_id is nil") - } - if err := v.DefaultParticipantID.Encode(b); err != nil { - return fmt.Errorf("unable to encode videoChat#ae158d28: field default_participant_id: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (v *VideoChat) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode videoChat#ae158d28 to nil") - } - if err := b.ConsumeID(VideoChatTypeID); err != nil { - return fmt.Errorf("unable to decode videoChat#ae158d28: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *VideoChat) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode videoChat#ae158d28 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode videoChat#ae158d28: field group_call_id: %w", err) - } - v.GroupCallID = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode videoChat#ae158d28: field has_participants: %w", err) - } - v.HasParticipants = value - } - { - value, err := DecodeMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode videoChat#ae158d28: field default_participant_id: %w", err) - } - v.DefaultParticipantID = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *VideoChat) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode videoChat#ae158d28 as nil") - } - b.ObjStart() - b.PutID("videoChat") - b.Comma() - b.FieldStart("group_call_id") - b.PutInt32(v.GroupCallID) - b.Comma() - b.FieldStart("has_participants") - b.PutBool(v.HasParticipants) - b.Comma() - b.FieldStart("default_participant_id") - if v.DefaultParticipantID == nil { - return fmt.Errorf("unable to encode videoChat#ae158d28: field default_participant_id is nil") - } - if err := v.DefaultParticipantID.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode videoChat#ae158d28: field default_participant_id: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *VideoChat) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode videoChat#ae158d28 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("videoChat"); err != nil { - return fmt.Errorf("unable to decode videoChat#ae158d28: %w", err) - } - case "group_call_id": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode videoChat#ae158d28: field group_call_id: %w", err) - } - v.GroupCallID = value - case "has_participants": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode videoChat#ae158d28: field has_participants: %w", err) - } - v.HasParticipants = value - case "default_participant_id": - value, err := DecodeTDLibJSONMessageSender(b) - if err != nil { - return fmt.Errorf("unable to decode videoChat#ae158d28: field default_participant_id: %w", err) - } - v.DefaultParticipantID = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGroupCallID returns value of GroupCallID field. -func (v *VideoChat) GetGroupCallID() (value int32) { - if v == nil { - return - } - return v.GroupCallID -} - -// GetHasParticipants returns value of HasParticipants field. -func (v *VideoChat) GetHasParticipants() (value bool) { - if v == nil { - return - } - return v.HasParticipants -} - -// GetDefaultParticipantID returns value of DefaultParticipantID field. -func (v *VideoChat) GetDefaultParticipantID() (value MessageSenderClass) { - if v == nil { - return - } - return v.DefaultParticipantID -} diff --git a/tdapi/tl_video_gen.go b/tdapi/tl_video_gen.go deleted file mode 100644 index e8d8e8993..000000000 --- a/tdapi/tl_video_gen.go +++ /dev/null @@ -1,500 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// Video represents TL type `video#31a460cc`. -type Video struct { - // Duration of the video, in seconds; as defined by the sender - Duration int32 - // Video width; as defined by the sender - Width int32 - // Video height; as defined by the sender - Height int32 - // Original name of the file; as defined by the sender - FileName string - // MIME type of the file; as defined by the sender - MimeType string - // True, if stickers were added to the video. The list of corresponding sticker sets can - // be received using getAttachedStickerSets - HasStickers bool - // True, if the video is expected to be streamed - SupportsStreaming bool - // Video minithumbnail; may be null - Minithumbnail Minithumbnail - // Video thumbnail in JPEG or MPEG4 format; as defined by the sender; may be null - Thumbnail Thumbnail - // File containing the video - Video File -} - -// VideoTypeID is TL type id of Video. -const VideoTypeID = 0x31a460cc - -// Ensuring interfaces in compile-time for Video. -var ( - _ bin.Encoder = &Video{} - _ bin.Decoder = &Video{} - _ bin.BareEncoder = &Video{} - _ bin.BareDecoder = &Video{} -) - -func (v *Video) Zero() bool { - if v == nil { - return true - } - if !(v.Duration == 0) { - return false - } - if !(v.Width == 0) { - return false - } - if !(v.Height == 0) { - return false - } - if !(v.FileName == "") { - return false - } - if !(v.MimeType == "") { - return false - } - if !(v.HasStickers == false) { - return false - } - if !(v.SupportsStreaming == false) { - return false - } - if !(v.Minithumbnail.Zero()) { - return false - } - if !(v.Thumbnail.Zero()) { - return false - } - if !(v.Video.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *Video) String() string { - if v == nil { - return "Video(nil)" - } - type Alias Video - return fmt.Sprintf("Video%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*Video) TypeID() uint32 { - return VideoTypeID -} - -// TypeName returns name of type in TL schema. -func (*Video) TypeName() string { - return "video" -} - -// TypeInfo returns info about TL type. -func (v *Video) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "video", - ID: VideoTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Width", - SchemaName: "width", - }, - { - Name: "Height", - SchemaName: "height", - }, - { - Name: "FileName", - SchemaName: "file_name", - }, - { - Name: "MimeType", - SchemaName: "mime_type", - }, - { - Name: "HasStickers", - SchemaName: "has_stickers", - }, - { - Name: "SupportsStreaming", - SchemaName: "supports_streaming", - }, - { - Name: "Minithumbnail", - SchemaName: "minithumbnail", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "Video", - SchemaName: "video", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *Video) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode video#31a460cc as nil") - } - b.PutID(VideoTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *Video) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode video#31a460cc as nil") - } - b.PutInt32(v.Duration) - b.PutInt32(v.Width) - b.PutInt32(v.Height) - b.PutString(v.FileName) - b.PutString(v.MimeType) - b.PutBool(v.HasStickers) - b.PutBool(v.SupportsStreaming) - if err := v.Minithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode video#31a460cc: field minithumbnail: %w", err) - } - if err := v.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode video#31a460cc: field thumbnail: %w", err) - } - if err := v.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode video#31a460cc: field video: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (v *Video) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode video#31a460cc to nil") - } - if err := b.ConsumeID(VideoTypeID); err != nil { - return fmt.Errorf("unable to decode video#31a460cc: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *Video) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode video#31a460cc to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field duration: %w", err) - } - v.Duration = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field width: %w", err) - } - v.Width = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field height: %w", err) - } - v.Height = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field file_name: %w", err) - } - v.FileName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field mime_type: %w", err) - } - v.MimeType = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field has_stickers: %w", err) - } - v.HasStickers = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field supports_streaming: %w", err) - } - v.SupportsStreaming = value - } - { - if err := v.Minithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field minithumbnail: %w", err) - } - } - { - if err := v.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field thumbnail: %w", err) - } - } - { - if err := v.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field video: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *Video) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode video#31a460cc as nil") - } - b.ObjStart() - b.PutID("video") - b.Comma() - b.FieldStart("duration") - b.PutInt32(v.Duration) - b.Comma() - b.FieldStart("width") - b.PutInt32(v.Width) - b.Comma() - b.FieldStart("height") - b.PutInt32(v.Height) - b.Comma() - b.FieldStart("file_name") - b.PutString(v.FileName) - b.Comma() - b.FieldStart("mime_type") - b.PutString(v.MimeType) - b.Comma() - b.FieldStart("has_stickers") - b.PutBool(v.HasStickers) - b.Comma() - b.FieldStart("supports_streaming") - b.PutBool(v.SupportsStreaming) - b.Comma() - b.FieldStart("minithumbnail") - if err := v.Minithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode video#31a460cc: field minithumbnail: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := v.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode video#31a460cc: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("video") - if err := v.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode video#31a460cc: field video: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *Video) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode video#31a460cc to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("video"); err != nil { - return fmt.Errorf("unable to decode video#31a460cc: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field duration: %w", err) - } - v.Duration = value - case "width": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field width: %w", err) - } - v.Width = value - case "height": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field height: %w", err) - } - v.Height = value - case "file_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field file_name: %w", err) - } - v.FileName = value - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field mime_type: %w", err) - } - v.MimeType = value - case "has_stickers": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field has_stickers: %w", err) - } - v.HasStickers = value - case "supports_streaming": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field supports_streaming: %w", err) - } - v.SupportsStreaming = value - case "minithumbnail": - if err := v.Minithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field minithumbnail: %w", err) - } - case "thumbnail": - if err := v.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field thumbnail: %w", err) - } - case "video": - if err := v.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode video#31a460cc: field video: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDuration returns value of Duration field. -func (v *Video) GetDuration() (value int32) { - if v == nil { - return - } - return v.Duration -} - -// GetWidth returns value of Width field. -func (v *Video) GetWidth() (value int32) { - if v == nil { - return - } - return v.Width -} - -// GetHeight returns value of Height field. -func (v *Video) GetHeight() (value int32) { - if v == nil { - return - } - return v.Height -} - -// GetFileName returns value of FileName field. -func (v *Video) GetFileName() (value string) { - if v == nil { - return - } - return v.FileName -} - -// GetMimeType returns value of MimeType field. -func (v *Video) GetMimeType() (value string) { - if v == nil { - return - } - return v.MimeType -} - -// GetHasStickers returns value of HasStickers field. -func (v *Video) GetHasStickers() (value bool) { - if v == nil { - return - } - return v.HasStickers -} - -// GetSupportsStreaming returns value of SupportsStreaming field. -func (v *Video) GetSupportsStreaming() (value bool) { - if v == nil { - return - } - return v.SupportsStreaming -} - -// GetMinithumbnail returns value of Minithumbnail field. -func (v *Video) GetMinithumbnail() (value Minithumbnail) { - if v == nil { - return - } - return v.Minithumbnail -} - -// GetThumbnail returns value of Thumbnail field. -func (v *Video) GetThumbnail() (value Thumbnail) { - if v == nil { - return - } - return v.Thumbnail -} - -// GetVideo returns value of Video field. -func (v *Video) GetVideo() (value File) { - if v == nil { - return - } - return v.Video -} diff --git a/tdapi/tl_video_note_gen.go b/tdapi/tl_video_note_gen.go deleted file mode 100644 index 999a6869e..000000000 --- a/tdapi/tl_video_note_gen.go +++ /dev/null @@ -1,408 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// VideoNote represents TL type `videoNote#7ae918c5`. -type VideoNote struct { - // Duration of the video, in seconds; as defined by the sender - Duration int32 - // A waveform representation of the video note's audio in 5-bit format; may be empty if - // unknown - Waveform []byte - // Video width and height; as defined by the sender - Length int32 - // Video minithumbnail; may be null - Minithumbnail Minithumbnail - // Video thumbnail in JPEG format; as defined by the sender; may be null - Thumbnail Thumbnail - // Result of speech recognition in the video note; may be null - SpeechRecognitionResult SpeechRecognitionResultClass - // File containing the video - Video File -} - -// VideoNoteTypeID is TL type id of VideoNote. -const VideoNoteTypeID = 0x7ae918c5 - -// Ensuring interfaces in compile-time for VideoNote. -var ( - _ bin.Encoder = &VideoNote{} - _ bin.Decoder = &VideoNote{} - _ bin.BareEncoder = &VideoNote{} - _ bin.BareDecoder = &VideoNote{} -) - -func (v *VideoNote) Zero() bool { - if v == nil { - return true - } - if !(v.Duration == 0) { - return false - } - if !(v.Waveform == nil) { - return false - } - if !(v.Length == 0) { - return false - } - if !(v.Minithumbnail.Zero()) { - return false - } - if !(v.Thumbnail.Zero()) { - return false - } - if !(v.SpeechRecognitionResult == nil) { - return false - } - if !(v.Video.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *VideoNote) String() string { - if v == nil { - return "VideoNote(nil)" - } - type Alias VideoNote - return fmt.Sprintf("VideoNote%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*VideoNote) TypeID() uint32 { - return VideoNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*VideoNote) TypeName() string { - return "videoNote" -} - -// TypeInfo returns info about TL type. -func (v *VideoNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "videoNote", - ID: VideoNoteTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Waveform", - SchemaName: "waveform", - }, - { - Name: "Length", - SchemaName: "length", - }, - { - Name: "Minithumbnail", - SchemaName: "minithumbnail", - }, - { - Name: "Thumbnail", - SchemaName: "thumbnail", - }, - { - Name: "SpeechRecognitionResult", - SchemaName: "speech_recognition_result", - }, - { - Name: "Video", - SchemaName: "video", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *VideoNote) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode videoNote#7ae918c5 as nil") - } - b.PutID(VideoNoteTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *VideoNote) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode videoNote#7ae918c5 as nil") - } - b.PutInt32(v.Duration) - b.PutBytes(v.Waveform) - b.PutInt32(v.Length) - if err := v.Minithumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode videoNote#7ae918c5: field minithumbnail: %w", err) - } - if err := v.Thumbnail.Encode(b); err != nil { - return fmt.Errorf("unable to encode videoNote#7ae918c5: field thumbnail: %w", err) - } - if v.SpeechRecognitionResult == nil { - return fmt.Errorf("unable to encode videoNote#7ae918c5: field speech_recognition_result is nil") - } - if err := v.SpeechRecognitionResult.Encode(b); err != nil { - return fmt.Errorf("unable to encode videoNote#7ae918c5: field speech_recognition_result: %w", err) - } - if err := v.Video.Encode(b); err != nil { - return fmt.Errorf("unable to encode videoNote#7ae918c5: field video: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (v *VideoNote) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode videoNote#7ae918c5 to nil") - } - if err := b.ConsumeID(VideoNoteTypeID); err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *VideoNote) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode videoNote#7ae918c5 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field duration: %w", err) - } - v.Duration = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field waveform: %w", err) - } - v.Waveform = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field length: %w", err) - } - v.Length = value - } - { - if err := v.Minithumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field minithumbnail: %w", err) - } - } - { - if err := v.Thumbnail.Decode(b); err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field thumbnail: %w", err) - } - } - { - value, err := DecodeSpeechRecognitionResult(b) - if err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field speech_recognition_result: %w", err) - } - v.SpeechRecognitionResult = value - } - { - if err := v.Video.Decode(b); err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field video: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *VideoNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode videoNote#7ae918c5 as nil") - } - b.ObjStart() - b.PutID("videoNote") - b.Comma() - b.FieldStart("duration") - b.PutInt32(v.Duration) - b.Comma() - b.FieldStart("waveform") - b.PutBytes(v.Waveform) - b.Comma() - b.FieldStart("length") - b.PutInt32(v.Length) - b.Comma() - b.FieldStart("minithumbnail") - if err := v.Minithumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode videoNote#7ae918c5: field minithumbnail: %w", err) - } - b.Comma() - b.FieldStart("thumbnail") - if err := v.Thumbnail.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode videoNote#7ae918c5: field thumbnail: %w", err) - } - b.Comma() - b.FieldStart("speech_recognition_result") - if v.SpeechRecognitionResult == nil { - return fmt.Errorf("unable to encode videoNote#7ae918c5: field speech_recognition_result is nil") - } - if err := v.SpeechRecognitionResult.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode videoNote#7ae918c5: field speech_recognition_result: %w", err) - } - b.Comma() - b.FieldStart("video") - if err := v.Video.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode videoNote#7ae918c5: field video: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *VideoNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode videoNote#7ae918c5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("videoNote"); err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field duration: %w", err) - } - v.Duration = value - case "waveform": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field waveform: %w", err) - } - v.Waveform = value - case "length": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field length: %w", err) - } - v.Length = value - case "minithumbnail": - if err := v.Minithumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field minithumbnail: %w", err) - } - case "thumbnail": - if err := v.Thumbnail.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field thumbnail: %w", err) - } - case "speech_recognition_result": - value, err := DecodeTDLibJSONSpeechRecognitionResult(b) - if err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field speech_recognition_result: %w", err) - } - v.SpeechRecognitionResult = value - case "video": - if err := v.Video.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode videoNote#7ae918c5: field video: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDuration returns value of Duration field. -func (v *VideoNote) GetDuration() (value int32) { - if v == nil { - return - } - return v.Duration -} - -// GetWaveform returns value of Waveform field. -func (v *VideoNote) GetWaveform() (value []byte) { - if v == nil { - return - } - return v.Waveform -} - -// GetLength returns value of Length field. -func (v *VideoNote) GetLength() (value int32) { - if v == nil { - return - } - return v.Length -} - -// GetMinithumbnail returns value of Minithumbnail field. -func (v *VideoNote) GetMinithumbnail() (value Minithumbnail) { - if v == nil { - return - } - return v.Minithumbnail -} - -// GetThumbnail returns value of Thumbnail field. -func (v *VideoNote) GetThumbnail() (value Thumbnail) { - if v == nil { - return - } - return v.Thumbnail -} - -// GetSpeechRecognitionResult returns value of SpeechRecognitionResult field. -func (v *VideoNote) GetSpeechRecognitionResult() (value SpeechRecognitionResultClass) { - if v == nil { - return - } - return v.SpeechRecognitionResult -} - -// GetVideo returns value of Video field. -func (v *VideoNote) GetVideo() (value File) { - if v == nil { - return - } - return v.Video -} diff --git a/tdapi/tl_view_messages_gen.go b/tdapi/tl_view_messages_gen.go deleted file mode 100644 index 6a643f0af..000000000 --- a/tdapi/tl_view_messages_gen.go +++ /dev/null @@ -1,339 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ViewMessagesRequest represents TL type `viewMessages#aa2f0438`. -type ViewMessagesRequest struct { - // Chat identifier - ChatID int64 - // The identifiers of the messages being viewed - MessageIDs []int64 - // Source of the message view; pass null to guess the source based on chat open state - Source MessageSourceClass - // Pass true to mark as read the specified messages even the chat is closed - ForceRead bool -} - -// ViewMessagesRequestTypeID is TL type id of ViewMessagesRequest. -const ViewMessagesRequestTypeID = 0xaa2f0438 - -// Ensuring interfaces in compile-time for ViewMessagesRequest. -var ( - _ bin.Encoder = &ViewMessagesRequest{} - _ bin.Decoder = &ViewMessagesRequest{} - _ bin.BareEncoder = &ViewMessagesRequest{} - _ bin.BareDecoder = &ViewMessagesRequest{} -) - -func (v *ViewMessagesRequest) Zero() bool { - if v == nil { - return true - } - if !(v.ChatID == 0) { - return false - } - if !(v.MessageIDs == nil) { - return false - } - if !(v.Source == nil) { - return false - } - if !(v.ForceRead == false) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *ViewMessagesRequest) String() string { - if v == nil { - return "ViewMessagesRequest(nil)" - } - type Alias ViewMessagesRequest - return fmt.Sprintf("ViewMessagesRequest%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ViewMessagesRequest) TypeID() uint32 { - return ViewMessagesRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ViewMessagesRequest) TypeName() string { - return "viewMessages" -} - -// TypeInfo returns info about TL type. -func (v *ViewMessagesRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "viewMessages", - ID: ViewMessagesRequestTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ChatID", - SchemaName: "chat_id", - }, - { - Name: "MessageIDs", - SchemaName: "message_ids", - }, - { - Name: "Source", - SchemaName: "source", - }, - { - Name: "ForceRead", - SchemaName: "force_read", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *ViewMessagesRequest) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode viewMessages#aa2f0438 as nil") - } - b.PutID(ViewMessagesRequestTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *ViewMessagesRequest) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode viewMessages#aa2f0438 as nil") - } - b.PutInt53(v.ChatID) - b.PutInt(len(v.MessageIDs)) - for _, v := range v.MessageIDs { - b.PutInt53(v) - } - if v.Source == nil { - return fmt.Errorf("unable to encode viewMessages#aa2f0438: field source is nil") - } - if err := v.Source.Encode(b); err != nil { - return fmt.Errorf("unable to encode viewMessages#aa2f0438: field source: %w", err) - } - b.PutBool(v.ForceRead) - return nil -} - -// Decode implements bin.Decoder. -func (v *ViewMessagesRequest) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode viewMessages#aa2f0438 to nil") - } - if err := b.ConsumeID(ViewMessagesRequestTypeID); err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *ViewMessagesRequest) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode viewMessages#aa2f0438 to nil") - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: field chat_id: %w", err) - } - v.ChatID = value - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: field message_ids: %w", err) - } - - if headerLen > 0 { - v.MessageIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: field message_ids: %w", err) - } - v.MessageIDs = append(v.MessageIDs, value) - } - } - { - value, err := DecodeMessageSource(b) - if err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: field source: %w", err) - } - v.Source = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: field force_read: %w", err) - } - v.ForceRead = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *ViewMessagesRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode viewMessages#aa2f0438 as nil") - } - b.ObjStart() - b.PutID("viewMessages") - b.Comma() - b.FieldStart("chat_id") - b.PutInt53(v.ChatID) - b.Comma() - b.FieldStart("message_ids") - b.ArrStart() - for _, v := range v.MessageIDs { - b.PutInt53(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("source") - if v.Source == nil { - return fmt.Errorf("unable to encode viewMessages#aa2f0438: field source is nil") - } - if err := v.Source.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode viewMessages#aa2f0438: field source: %w", err) - } - b.Comma() - b.FieldStart("force_read") - b.PutBool(v.ForceRead) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *ViewMessagesRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode viewMessages#aa2f0438 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("viewMessages"); err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: %w", err) - } - case "chat_id": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: field chat_id: %w", err) - } - v.ChatID = value - case "message_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: field message_ids: %w", err) - } - v.MessageIDs = append(v.MessageIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: field message_ids: %w", err) - } - case "source": - value, err := DecodeTDLibJSONMessageSource(b) - if err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: field source: %w", err) - } - v.Source = value - case "force_read": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode viewMessages#aa2f0438: field force_read: %w", err) - } - v.ForceRead = value - default: - return b.Skip() - } - return nil - }) -} - -// GetChatID returns value of ChatID field. -func (v *ViewMessagesRequest) GetChatID() (value int64) { - if v == nil { - return - } - return v.ChatID -} - -// GetMessageIDs returns value of MessageIDs field. -func (v *ViewMessagesRequest) GetMessageIDs() (value []int64) { - if v == nil { - return - } - return v.MessageIDs -} - -// GetSource returns value of Source field. -func (v *ViewMessagesRequest) GetSource() (value MessageSourceClass) { - if v == nil { - return - } - return v.Source -} - -// GetForceRead returns value of ForceRead field. -func (v *ViewMessagesRequest) GetForceRead() (value bool) { - if v == nil { - return - } - return v.ForceRead -} - -// ViewMessages invokes method viewMessages#aa2f0438 returning error if any. -func (c *Client) ViewMessages(ctx context.Context, request *ViewMessagesRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_view_premium_feature_gen.go b/tdapi/tl_view_premium_feature_gen.go deleted file mode 100644 index f80cb702b..000000000 --- a/tdapi/tl_view_premium_feature_gen.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ViewPremiumFeatureRequest represents TL type `viewPremiumFeature#b8031b2`. -type ViewPremiumFeatureRequest struct { - // The viewed premium feature - Feature PremiumFeatureClass -} - -// ViewPremiumFeatureRequestTypeID is TL type id of ViewPremiumFeatureRequest. -const ViewPremiumFeatureRequestTypeID = 0xb8031b2 - -// Ensuring interfaces in compile-time for ViewPremiumFeatureRequest. -var ( - _ bin.Encoder = &ViewPremiumFeatureRequest{} - _ bin.Decoder = &ViewPremiumFeatureRequest{} - _ bin.BareEncoder = &ViewPremiumFeatureRequest{} - _ bin.BareDecoder = &ViewPremiumFeatureRequest{} -) - -func (v *ViewPremiumFeatureRequest) Zero() bool { - if v == nil { - return true - } - if !(v.Feature == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *ViewPremiumFeatureRequest) String() string { - if v == nil { - return "ViewPremiumFeatureRequest(nil)" - } - type Alias ViewPremiumFeatureRequest - return fmt.Sprintf("ViewPremiumFeatureRequest%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ViewPremiumFeatureRequest) TypeID() uint32 { - return ViewPremiumFeatureRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ViewPremiumFeatureRequest) TypeName() string { - return "viewPremiumFeature" -} - -// TypeInfo returns info about TL type. -func (v *ViewPremiumFeatureRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "viewPremiumFeature", - ID: ViewPremiumFeatureRequestTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Feature", - SchemaName: "feature", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *ViewPremiumFeatureRequest) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode viewPremiumFeature#b8031b2 as nil") - } - b.PutID(ViewPremiumFeatureRequestTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *ViewPremiumFeatureRequest) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode viewPremiumFeature#b8031b2 as nil") - } - if v.Feature == nil { - return fmt.Errorf("unable to encode viewPremiumFeature#b8031b2: field feature is nil") - } - if err := v.Feature.Encode(b); err != nil { - return fmt.Errorf("unable to encode viewPremiumFeature#b8031b2: field feature: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (v *ViewPremiumFeatureRequest) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode viewPremiumFeature#b8031b2 to nil") - } - if err := b.ConsumeID(ViewPremiumFeatureRequestTypeID); err != nil { - return fmt.Errorf("unable to decode viewPremiumFeature#b8031b2: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *ViewPremiumFeatureRequest) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode viewPremiumFeature#b8031b2 to nil") - } - { - value, err := DecodePremiumFeature(b) - if err != nil { - return fmt.Errorf("unable to decode viewPremiumFeature#b8031b2: field feature: %w", err) - } - v.Feature = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *ViewPremiumFeatureRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode viewPremiumFeature#b8031b2 as nil") - } - b.ObjStart() - b.PutID("viewPremiumFeature") - b.Comma() - b.FieldStart("feature") - if v.Feature == nil { - return fmt.Errorf("unable to encode viewPremiumFeature#b8031b2: field feature is nil") - } - if err := v.Feature.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode viewPremiumFeature#b8031b2: field feature: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *ViewPremiumFeatureRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode viewPremiumFeature#b8031b2 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("viewPremiumFeature"); err != nil { - return fmt.Errorf("unable to decode viewPremiumFeature#b8031b2: %w", err) - } - case "feature": - value, err := DecodeTDLibJSONPremiumFeature(b) - if err != nil { - return fmt.Errorf("unable to decode viewPremiumFeature#b8031b2: field feature: %w", err) - } - v.Feature = value - default: - return b.Skip() - } - return nil - }) -} - -// GetFeature returns value of Feature field. -func (v *ViewPremiumFeatureRequest) GetFeature() (value PremiumFeatureClass) { - if v == nil { - return - } - return v.Feature -} - -// ViewPremiumFeature invokes method viewPremiumFeature#b8031b2 returning error if any. -func (c *Client) ViewPremiumFeature(ctx context.Context, feature PremiumFeatureClass) error { - var ok Ok - - request := &ViewPremiumFeatureRequest{ - Feature: feature, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_view_trending_sticker_sets_gen.go b/tdapi/tl_view_trending_sticker_sets_gen.go deleted file mode 100644 index ff5eff7d9..000000000 --- a/tdapi/tl_view_trending_sticker_sets_gen.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// ViewTrendingStickerSetsRequest represents TL type `viewTrendingStickerSets#36d6469`. -type ViewTrendingStickerSetsRequest struct { - // Identifiers of viewed trending sticker sets - StickerSetIDs []int64 -} - -// ViewTrendingStickerSetsRequestTypeID is TL type id of ViewTrendingStickerSetsRequest. -const ViewTrendingStickerSetsRequestTypeID = 0x36d6469 - -// Ensuring interfaces in compile-time for ViewTrendingStickerSetsRequest. -var ( - _ bin.Encoder = &ViewTrendingStickerSetsRequest{} - _ bin.Decoder = &ViewTrendingStickerSetsRequest{} - _ bin.BareEncoder = &ViewTrendingStickerSetsRequest{} - _ bin.BareDecoder = &ViewTrendingStickerSetsRequest{} -) - -func (v *ViewTrendingStickerSetsRequest) Zero() bool { - if v == nil { - return true - } - if !(v.StickerSetIDs == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *ViewTrendingStickerSetsRequest) String() string { - if v == nil { - return "ViewTrendingStickerSetsRequest(nil)" - } - type Alias ViewTrendingStickerSetsRequest - return fmt.Sprintf("ViewTrendingStickerSetsRequest%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*ViewTrendingStickerSetsRequest) TypeID() uint32 { - return ViewTrendingStickerSetsRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*ViewTrendingStickerSetsRequest) TypeName() string { - return "viewTrendingStickerSets" -} - -// TypeInfo returns info about TL type. -func (v *ViewTrendingStickerSetsRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "viewTrendingStickerSets", - ID: ViewTrendingStickerSetsRequestTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "StickerSetIDs", - SchemaName: "sticker_set_ids", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *ViewTrendingStickerSetsRequest) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode viewTrendingStickerSets#36d6469 as nil") - } - b.PutID(ViewTrendingStickerSetsRequestTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *ViewTrendingStickerSetsRequest) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode viewTrendingStickerSets#36d6469 as nil") - } - b.PutInt(len(v.StickerSetIDs)) - for _, v := range v.StickerSetIDs { - b.PutLong(v) - } - return nil -} - -// Decode implements bin.Decoder. -func (v *ViewTrendingStickerSetsRequest) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode viewTrendingStickerSets#36d6469 to nil") - } - if err := b.ConsumeID(ViewTrendingStickerSetsRequestTypeID); err != nil { - return fmt.Errorf("unable to decode viewTrendingStickerSets#36d6469: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *ViewTrendingStickerSetsRequest) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode viewTrendingStickerSets#36d6469 to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode viewTrendingStickerSets#36d6469: field sticker_set_ids: %w", err) - } - - if headerLen > 0 { - v.StickerSetIDs = make([]int64, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode viewTrendingStickerSets#36d6469: field sticker_set_ids: %w", err) - } - v.StickerSetIDs = append(v.StickerSetIDs, value) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *ViewTrendingStickerSetsRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode viewTrendingStickerSets#36d6469 as nil") - } - b.ObjStart() - b.PutID("viewTrendingStickerSets") - b.Comma() - b.FieldStart("sticker_set_ids") - b.ArrStart() - for _, v := range v.StickerSetIDs { - b.PutLong(v) - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *ViewTrendingStickerSetsRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode viewTrendingStickerSets#36d6469 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("viewTrendingStickerSets"); err != nil { - return fmt.Errorf("unable to decode viewTrendingStickerSets#36d6469: %w", err) - } - case "sticker_set_ids": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode viewTrendingStickerSets#36d6469: field sticker_set_ids: %w", err) - } - v.StickerSetIDs = append(v.StickerSetIDs, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode viewTrendingStickerSets#36d6469: field sticker_set_ids: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetStickerSetIDs returns value of StickerSetIDs field. -func (v *ViewTrendingStickerSetsRequest) GetStickerSetIDs() (value []int64) { - if v == nil { - return - } - return v.StickerSetIDs -} - -// ViewTrendingStickerSets invokes method viewTrendingStickerSets#36d6469 returning error if any. -func (c *Client) ViewTrendingStickerSets(ctx context.Context, stickersetids []int64) error { - var ok Ok - - request := &ViewTrendingStickerSetsRequest{ - StickerSetIDs: stickersetids, - } - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdapi/tl_voice_note_gen.go b/tdapi/tl_voice_note_gen.go deleted file mode 100644 index 03b5fccfb..000000000 --- a/tdapi/tl_voice_note_gen.go +++ /dev/null @@ -1,340 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// VoiceNote represents TL type `voiceNote#b9f24cf5`. -type VoiceNote struct { - // Duration of the voice note, in seconds; as defined by the sender - Duration int32 - // A waveform representation of the voice note in 5-bit format - Waveform []byte - // MIME type of the file; as defined by the sender. Usually, one of "audio/ogg" for Opus - // in an OGG container, "audio/mpeg" for an MP3 audio, or "audio/mp4" for an M4A audio - MimeType string - // Result of speech recognition in the voice note; may be null - SpeechRecognitionResult SpeechRecognitionResultClass - // File containing the voice note - Voice File -} - -// VoiceNoteTypeID is TL type id of VoiceNote. -const VoiceNoteTypeID = 0xb9f24cf5 - -// Ensuring interfaces in compile-time for VoiceNote. -var ( - _ bin.Encoder = &VoiceNote{} - _ bin.Decoder = &VoiceNote{} - _ bin.BareEncoder = &VoiceNote{} - _ bin.BareDecoder = &VoiceNote{} -) - -func (v *VoiceNote) Zero() bool { - if v == nil { - return true - } - if !(v.Duration == 0) { - return false - } - if !(v.Waveform == nil) { - return false - } - if !(v.MimeType == "") { - return false - } - if !(v.SpeechRecognitionResult == nil) { - return false - } - if !(v.Voice.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (v *VoiceNote) String() string { - if v == nil { - return "VoiceNote(nil)" - } - type Alias VoiceNote - return fmt.Sprintf("VoiceNote%+v", Alias(*v)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*VoiceNote) TypeID() uint32 { - return VoiceNoteTypeID -} - -// TypeName returns name of type in TL schema. -func (*VoiceNote) TypeName() string { - return "voiceNote" -} - -// TypeInfo returns info about TL type. -func (v *VoiceNote) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "voiceNote", - ID: VoiceNoteTypeID, - } - if v == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Duration", - SchemaName: "duration", - }, - { - Name: "Waveform", - SchemaName: "waveform", - }, - { - Name: "MimeType", - SchemaName: "mime_type", - }, - { - Name: "SpeechRecognitionResult", - SchemaName: "speech_recognition_result", - }, - { - Name: "Voice", - SchemaName: "voice", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (v *VoiceNote) Encode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode voiceNote#b9f24cf5 as nil") - } - b.PutID(VoiceNoteTypeID) - return v.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (v *VoiceNote) EncodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't encode voiceNote#b9f24cf5 as nil") - } - b.PutInt32(v.Duration) - b.PutBytes(v.Waveform) - b.PutString(v.MimeType) - if v.SpeechRecognitionResult == nil { - return fmt.Errorf("unable to encode voiceNote#b9f24cf5: field speech_recognition_result is nil") - } - if err := v.SpeechRecognitionResult.Encode(b); err != nil { - return fmt.Errorf("unable to encode voiceNote#b9f24cf5: field speech_recognition_result: %w", err) - } - if err := v.Voice.Encode(b); err != nil { - return fmt.Errorf("unable to encode voiceNote#b9f24cf5: field voice: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (v *VoiceNote) Decode(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode voiceNote#b9f24cf5 to nil") - } - if err := b.ConsumeID(VoiceNoteTypeID); err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: %w", err) - } - return v.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (v *VoiceNote) DecodeBare(b *bin.Buffer) error { - if v == nil { - return fmt.Errorf("can't decode voiceNote#b9f24cf5 to nil") - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: field duration: %w", err) - } - v.Duration = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: field waveform: %w", err) - } - v.Waveform = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: field mime_type: %w", err) - } - v.MimeType = value - } - { - value, err := DecodeSpeechRecognitionResult(b) - if err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: field speech_recognition_result: %w", err) - } - v.SpeechRecognitionResult = value - } - { - if err := v.Voice.Decode(b); err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: field voice: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (v *VoiceNote) EncodeTDLibJSON(b tdjson.Encoder) error { - if v == nil { - return fmt.Errorf("can't encode voiceNote#b9f24cf5 as nil") - } - b.ObjStart() - b.PutID("voiceNote") - b.Comma() - b.FieldStart("duration") - b.PutInt32(v.Duration) - b.Comma() - b.FieldStart("waveform") - b.PutBytes(v.Waveform) - b.Comma() - b.FieldStart("mime_type") - b.PutString(v.MimeType) - b.Comma() - b.FieldStart("speech_recognition_result") - if v.SpeechRecognitionResult == nil { - return fmt.Errorf("unable to encode voiceNote#b9f24cf5: field speech_recognition_result is nil") - } - if err := v.SpeechRecognitionResult.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode voiceNote#b9f24cf5: field speech_recognition_result: %w", err) - } - b.Comma() - b.FieldStart("voice") - if err := v.Voice.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode voiceNote#b9f24cf5: field voice: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (v *VoiceNote) DecodeTDLibJSON(b tdjson.Decoder) error { - if v == nil { - return fmt.Errorf("can't decode voiceNote#b9f24cf5 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("voiceNote"); err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: %w", err) - } - case "duration": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: field duration: %w", err) - } - v.Duration = value - case "waveform": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: field waveform: %w", err) - } - v.Waveform = value - case "mime_type": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: field mime_type: %w", err) - } - v.MimeType = value - case "speech_recognition_result": - value, err := DecodeTDLibJSONSpeechRecognitionResult(b) - if err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: field speech_recognition_result: %w", err) - } - v.SpeechRecognitionResult = value - case "voice": - if err := v.Voice.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode voiceNote#b9f24cf5: field voice: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetDuration returns value of Duration field. -func (v *VoiceNote) GetDuration() (value int32) { - if v == nil { - return - } - return v.Duration -} - -// GetWaveform returns value of Waveform field. -func (v *VoiceNote) GetWaveform() (value []byte) { - if v == nil { - return - } - return v.Waveform -} - -// GetMimeType returns value of MimeType field. -func (v *VoiceNote) GetMimeType() (value string) { - if v == nil { - return - } - return v.MimeType -} - -// GetSpeechRecognitionResult returns value of SpeechRecognitionResult field. -func (v *VoiceNote) GetSpeechRecognitionResult() (value SpeechRecognitionResultClass) { - if v == nil { - return - } - return v.SpeechRecognitionResult -} - -// GetVoice returns value of Voice field. -func (v *VoiceNote) GetVoice() (value File) { - if v == nil { - return - } - return v.Voice -} diff --git a/tdapi/tl_web_app_gen.go b/tdapi/tl_web_app_gen.go deleted file mode 100644 index d511eb467..000000000 --- a/tdapi/tl_web_app_gen.go +++ /dev/null @@ -1,330 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// WebApp represents TL type `webApp#605ba8f3`. -type WebApp struct { - // Web App short name - ShortName string - // Web App title - Title string - // Describes a Web App. Use getInternalLink with internalLinkTypeWebApp to share the Web - // App - Description string - // Web App photo - Photo Photo - // Web App animation; may be null - Animation Animation -} - -// WebAppTypeID is TL type id of WebApp. -const WebAppTypeID = 0x605ba8f3 - -// Ensuring interfaces in compile-time for WebApp. -var ( - _ bin.Encoder = &WebApp{} - _ bin.Decoder = &WebApp{} - _ bin.BareEncoder = &WebApp{} - _ bin.BareDecoder = &WebApp{} -) - -func (w *WebApp) Zero() bool { - if w == nil { - return true - } - if !(w.ShortName == "") { - return false - } - if !(w.Title == "") { - return false - } - if !(w.Description == "") { - return false - } - if !(w.Photo.Zero()) { - return false - } - if !(w.Animation.Zero()) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (w *WebApp) String() string { - if w == nil { - return "WebApp(nil)" - } - type Alias WebApp - return fmt.Sprintf("WebApp%+v", Alias(*w)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*WebApp) TypeID() uint32 { - return WebAppTypeID -} - -// TypeName returns name of type in TL schema. -func (*WebApp) TypeName() string { - return "webApp" -} - -// TypeInfo returns info about TL type. -func (w *WebApp) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "webApp", - ID: WebAppTypeID, - } - if w == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "ShortName", - SchemaName: "short_name", - }, - { - Name: "Title", - SchemaName: "title", - }, - { - Name: "Description", - SchemaName: "description", - }, - { - Name: "Photo", - SchemaName: "photo", - }, - { - Name: "Animation", - SchemaName: "animation", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (w *WebApp) Encode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webApp#605ba8f3 as nil") - } - b.PutID(WebAppTypeID) - return w.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (w *WebApp) EncodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webApp#605ba8f3 as nil") - } - b.PutString(w.ShortName) - b.PutString(w.Title) - b.PutString(w.Description) - if err := w.Photo.Encode(b); err != nil { - return fmt.Errorf("unable to encode webApp#605ba8f3: field photo: %w", err) - } - if err := w.Animation.Encode(b); err != nil { - return fmt.Errorf("unable to encode webApp#605ba8f3: field animation: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (w *WebApp) Decode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webApp#605ba8f3 to nil") - } - if err := b.ConsumeID(WebAppTypeID); err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: %w", err) - } - return w.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (w *WebApp) DecodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webApp#605ba8f3 to nil") - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: field short_name: %w", err) - } - w.ShortName = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: field title: %w", err) - } - w.Title = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: field description: %w", err) - } - w.Description = value - } - { - if err := w.Photo.Decode(b); err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: field photo: %w", err) - } - } - { - if err := w.Animation.Decode(b); err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: field animation: %w", err) - } - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (w *WebApp) EncodeTDLibJSON(b tdjson.Encoder) error { - if w == nil { - return fmt.Errorf("can't encode webApp#605ba8f3 as nil") - } - b.ObjStart() - b.PutID("webApp") - b.Comma() - b.FieldStart("short_name") - b.PutString(w.ShortName) - b.Comma() - b.FieldStart("title") - b.PutString(w.Title) - b.Comma() - b.FieldStart("description") - b.PutString(w.Description) - b.Comma() - b.FieldStart("photo") - if err := w.Photo.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webApp#605ba8f3: field photo: %w", err) - } - b.Comma() - b.FieldStart("animation") - if err := w.Animation.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webApp#605ba8f3: field animation: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (w *WebApp) DecodeTDLibJSON(b tdjson.Decoder) error { - if w == nil { - return fmt.Errorf("can't decode webApp#605ba8f3 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("webApp"); err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: %w", err) - } - case "short_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: field short_name: %w", err) - } - w.ShortName = value - case "title": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: field title: %w", err) - } - w.Title = value - case "description": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: field description: %w", err) - } - w.Description = value - case "photo": - if err := w.Photo.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: field photo: %w", err) - } - case "animation": - if err := w.Animation.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webApp#605ba8f3: field animation: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// GetShortName returns value of ShortName field. -func (w *WebApp) GetShortName() (value string) { - if w == nil { - return - } - return w.ShortName -} - -// GetTitle returns value of Title field. -func (w *WebApp) GetTitle() (value string) { - if w == nil { - return - } - return w.Title -} - -// GetDescription returns value of Description field. -func (w *WebApp) GetDescription() (value string) { - if w == nil { - return - } - return w.Description -} - -// GetPhoto returns value of Photo field. -func (w *WebApp) GetPhoto() (value Photo) { - if w == nil { - return - } - return w.Photo -} - -// GetAnimation returns value of Animation field. -func (w *WebApp) GetAnimation() (value Animation) { - if w == nil { - return - } - return w.Animation -} diff --git a/tdapi/tl_web_app_info_gen.go b/tdapi/tl_web_app_info_gen.go deleted file mode 100644 index b90a2d454..000000000 --- a/tdapi/tl_web_app_info_gen.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// WebAppInfo represents TL type `webAppInfo#2efdb2e8`. -type WebAppInfo struct { - // Unique identifier for the Web App launch - LaunchID int64 - // A Web App URL to open in a web view - URL string -} - -// WebAppInfoTypeID is TL type id of WebAppInfo. -const WebAppInfoTypeID = 0x2efdb2e8 - -// Ensuring interfaces in compile-time for WebAppInfo. -var ( - _ bin.Encoder = &WebAppInfo{} - _ bin.Decoder = &WebAppInfo{} - _ bin.BareEncoder = &WebAppInfo{} - _ bin.BareDecoder = &WebAppInfo{} -) - -func (w *WebAppInfo) Zero() bool { - if w == nil { - return true - } - if !(w.LaunchID == 0) { - return false - } - if !(w.URL == "") { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (w *WebAppInfo) String() string { - if w == nil { - return "WebAppInfo(nil)" - } - type Alias WebAppInfo - return fmt.Sprintf("WebAppInfo%+v", Alias(*w)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*WebAppInfo) TypeID() uint32 { - return WebAppInfoTypeID -} - -// TypeName returns name of type in TL schema. -func (*WebAppInfo) TypeName() string { - return "webAppInfo" -} - -// TypeInfo returns info about TL type. -func (w *WebAppInfo) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "webAppInfo", - ID: WebAppInfoTypeID, - } - if w == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "LaunchID", - SchemaName: "launch_id", - }, - { - Name: "URL", - SchemaName: "url", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (w *WebAppInfo) Encode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webAppInfo#2efdb2e8 as nil") - } - b.PutID(WebAppInfoTypeID) - return w.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (w *WebAppInfo) EncodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webAppInfo#2efdb2e8 as nil") - } - b.PutLong(w.LaunchID) - b.PutString(w.URL) - return nil -} - -// Decode implements bin.Decoder. -func (w *WebAppInfo) Decode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webAppInfo#2efdb2e8 to nil") - } - if err := b.ConsumeID(WebAppInfoTypeID); err != nil { - return fmt.Errorf("unable to decode webAppInfo#2efdb2e8: %w", err) - } - return w.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (w *WebAppInfo) DecodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webAppInfo#2efdb2e8 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode webAppInfo#2efdb2e8: field launch_id: %w", err) - } - w.LaunchID = value - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode webAppInfo#2efdb2e8: field url: %w", err) - } - w.URL = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (w *WebAppInfo) EncodeTDLibJSON(b tdjson.Encoder) error { - if w == nil { - return fmt.Errorf("can't encode webAppInfo#2efdb2e8 as nil") - } - b.ObjStart() - b.PutID("webAppInfo") - b.Comma() - b.FieldStart("launch_id") - b.PutLong(w.LaunchID) - b.Comma() - b.FieldStart("url") - b.PutString(w.URL) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (w *WebAppInfo) DecodeTDLibJSON(b tdjson.Decoder) error { - if w == nil { - return fmt.Errorf("can't decode webAppInfo#2efdb2e8 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("webAppInfo"); err != nil { - return fmt.Errorf("unable to decode webAppInfo#2efdb2e8: %w", err) - } - case "launch_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode webAppInfo#2efdb2e8: field launch_id: %w", err) - } - w.LaunchID = value - case "url": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode webAppInfo#2efdb2e8: field url: %w", err) - } - w.URL = value - default: - return b.Skip() - } - return nil - }) -} - -// GetLaunchID returns value of LaunchID field. -func (w *WebAppInfo) GetLaunchID() (value int64) { - if w == nil { - return - } - return w.LaunchID -} - -// GetURL returns value of URL field. -func (w *WebAppInfo) GetURL() (value string) { - if w == nil { - return - } - return w.URL -} diff --git a/tdapi/tl_web_app_open_mode_gen.go b/tdapi/tl_web_app_open_mode_gen.go deleted file mode 100644 index 20eb7578b..000000000 --- a/tdapi/tl_web_app_open_mode_gen.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// WebAppOpenModeCompact represents TL type `webAppOpenModeCompact#6604ffdb`. -type WebAppOpenModeCompact struct { -} - -// WebAppOpenModeCompactTypeID is TL type id of WebAppOpenModeCompact. -const WebAppOpenModeCompactTypeID = 0x6604ffdb - -// construct implements constructor of WebAppOpenModeClass. -func (w WebAppOpenModeCompact) construct() WebAppOpenModeClass { return &w } - -// Ensuring interfaces in compile-time for WebAppOpenModeCompact. -var ( - _ bin.Encoder = &WebAppOpenModeCompact{} - _ bin.Decoder = &WebAppOpenModeCompact{} - _ bin.BareEncoder = &WebAppOpenModeCompact{} - _ bin.BareDecoder = &WebAppOpenModeCompact{} - - _ WebAppOpenModeClass = &WebAppOpenModeCompact{} -) - -func (w *WebAppOpenModeCompact) Zero() bool { - if w == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (w *WebAppOpenModeCompact) String() string { - if w == nil { - return "WebAppOpenModeCompact(nil)" - } - type Alias WebAppOpenModeCompact - return fmt.Sprintf("WebAppOpenModeCompact%+v", Alias(*w)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*WebAppOpenModeCompact) TypeID() uint32 { - return WebAppOpenModeCompactTypeID -} - -// TypeName returns name of type in TL schema. -func (*WebAppOpenModeCompact) TypeName() string { - return "webAppOpenModeCompact" -} - -// TypeInfo returns info about TL type. -func (w *WebAppOpenModeCompact) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "webAppOpenModeCompact", - ID: WebAppOpenModeCompactTypeID, - } - if w == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (w *WebAppOpenModeCompact) Encode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenModeCompact#6604ffdb as nil") - } - b.PutID(WebAppOpenModeCompactTypeID) - return w.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (w *WebAppOpenModeCompact) EncodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenModeCompact#6604ffdb as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (w *WebAppOpenModeCompact) Decode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenModeCompact#6604ffdb to nil") - } - if err := b.ConsumeID(WebAppOpenModeCompactTypeID); err != nil { - return fmt.Errorf("unable to decode webAppOpenModeCompact#6604ffdb: %w", err) - } - return w.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (w *WebAppOpenModeCompact) DecodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenModeCompact#6604ffdb to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (w *WebAppOpenModeCompact) EncodeTDLibJSON(b tdjson.Encoder) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenModeCompact#6604ffdb as nil") - } - b.ObjStart() - b.PutID("webAppOpenModeCompact") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (w *WebAppOpenModeCompact) DecodeTDLibJSON(b tdjson.Decoder) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenModeCompact#6604ffdb to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("webAppOpenModeCompact"); err != nil { - return fmt.Errorf("unable to decode webAppOpenModeCompact#6604ffdb: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// WebAppOpenModeFullSize represents TL type `webAppOpenModeFullSize#b48cd41`. -type WebAppOpenModeFullSize struct { -} - -// WebAppOpenModeFullSizeTypeID is TL type id of WebAppOpenModeFullSize. -const WebAppOpenModeFullSizeTypeID = 0xb48cd41 - -// construct implements constructor of WebAppOpenModeClass. -func (w WebAppOpenModeFullSize) construct() WebAppOpenModeClass { return &w } - -// Ensuring interfaces in compile-time for WebAppOpenModeFullSize. -var ( - _ bin.Encoder = &WebAppOpenModeFullSize{} - _ bin.Decoder = &WebAppOpenModeFullSize{} - _ bin.BareEncoder = &WebAppOpenModeFullSize{} - _ bin.BareDecoder = &WebAppOpenModeFullSize{} - - _ WebAppOpenModeClass = &WebAppOpenModeFullSize{} -) - -func (w *WebAppOpenModeFullSize) Zero() bool { - if w == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (w *WebAppOpenModeFullSize) String() string { - if w == nil { - return "WebAppOpenModeFullSize(nil)" - } - type Alias WebAppOpenModeFullSize - return fmt.Sprintf("WebAppOpenModeFullSize%+v", Alias(*w)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*WebAppOpenModeFullSize) TypeID() uint32 { - return WebAppOpenModeFullSizeTypeID -} - -// TypeName returns name of type in TL schema. -func (*WebAppOpenModeFullSize) TypeName() string { - return "webAppOpenModeFullSize" -} - -// TypeInfo returns info about TL type. -func (w *WebAppOpenModeFullSize) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "webAppOpenModeFullSize", - ID: WebAppOpenModeFullSizeTypeID, - } - if w == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (w *WebAppOpenModeFullSize) Encode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenModeFullSize#b48cd41 as nil") - } - b.PutID(WebAppOpenModeFullSizeTypeID) - return w.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (w *WebAppOpenModeFullSize) EncodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenModeFullSize#b48cd41 as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (w *WebAppOpenModeFullSize) Decode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenModeFullSize#b48cd41 to nil") - } - if err := b.ConsumeID(WebAppOpenModeFullSizeTypeID); err != nil { - return fmt.Errorf("unable to decode webAppOpenModeFullSize#b48cd41: %w", err) - } - return w.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (w *WebAppOpenModeFullSize) DecodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenModeFullSize#b48cd41 to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (w *WebAppOpenModeFullSize) EncodeTDLibJSON(b tdjson.Encoder) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenModeFullSize#b48cd41 as nil") - } - b.ObjStart() - b.PutID("webAppOpenModeFullSize") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (w *WebAppOpenModeFullSize) DecodeTDLibJSON(b tdjson.Decoder) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenModeFullSize#b48cd41 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("webAppOpenModeFullSize"); err != nil { - return fmt.Errorf("unable to decode webAppOpenModeFullSize#b48cd41: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// WebAppOpenModeFullScreen represents TL type `webAppOpenModeFullScreen#6f8a019d`. -type WebAppOpenModeFullScreen struct { -} - -// WebAppOpenModeFullScreenTypeID is TL type id of WebAppOpenModeFullScreen. -const WebAppOpenModeFullScreenTypeID = 0x6f8a019d - -// construct implements constructor of WebAppOpenModeClass. -func (w WebAppOpenModeFullScreen) construct() WebAppOpenModeClass { return &w } - -// Ensuring interfaces in compile-time for WebAppOpenModeFullScreen. -var ( - _ bin.Encoder = &WebAppOpenModeFullScreen{} - _ bin.Decoder = &WebAppOpenModeFullScreen{} - _ bin.BareEncoder = &WebAppOpenModeFullScreen{} - _ bin.BareDecoder = &WebAppOpenModeFullScreen{} - - _ WebAppOpenModeClass = &WebAppOpenModeFullScreen{} -) - -func (w *WebAppOpenModeFullScreen) Zero() bool { - if w == nil { - return true - } - - return true -} - -// String implements fmt.Stringer. -func (w *WebAppOpenModeFullScreen) String() string { - if w == nil { - return "WebAppOpenModeFullScreen(nil)" - } - type Alias WebAppOpenModeFullScreen - return fmt.Sprintf("WebAppOpenModeFullScreen%+v", Alias(*w)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*WebAppOpenModeFullScreen) TypeID() uint32 { - return WebAppOpenModeFullScreenTypeID -} - -// TypeName returns name of type in TL schema. -func (*WebAppOpenModeFullScreen) TypeName() string { - return "webAppOpenModeFullScreen" -} - -// TypeInfo returns info about TL type. -func (w *WebAppOpenModeFullScreen) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "webAppOpenModeFullScreen", - ID: WebAppOpenModeFullScreenTypeID, - } - if w == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{} - return typ -} - -// Encode implements bin.Encoder. -func (w *WebAppOpenModeFullScreen) Encode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenModeFullScreen#6f8a019d as nil") - } - b.PutID(WebAppOpenModeFullScreenTypeID) - return w.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (w *WebAppOpenModeFullScreen) EncodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenModeFullScreen#6f8a019d as nil") - } - return nil -} - -// Decode implements bin.Decoder. -func (w *WebAppOpenModeFullScreen) Decode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenModeFullScreen#6f8a019d to nil") - } - if err := b.ConsumeID(WebAppOpenModeFullScreenTypeID); err != nil { - return fmt.Errorf("unable to decode webAppOpenModeFullScreen#6f8a019d: %w", err) - } - return w.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (w *WebAppOpenModeFullScreen) DecodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenModeFullScreen#6f8a019d to nil") - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (w *WebAppOpenModeFullScreen) EncodeTDLibJSON(b tdjson.Encoder) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenModeFullScreen#6f8a019d as nil") - } - b.ObjStart() - b.PutID("webAppOpenModeFullScreen") - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (w *WebAppOpenModeFullScreen) DecodeTDLibJSON(b tdjson.Decoder) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenModeFullScreen#6f8a019d to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("webAppOpenModeFullScreen"); err != nil { - return fmt.Errorf("unable to decode webAppOpenModeFullScreen#6f8a019d: %w", err) - } - default: - return b.Skip() - } - return nil - }) -} - -// WebAppOpenModeClassName is schema name of WebAppOpenModeClass. -const WebAppOpenModeClassName = "WebAppOpenMode" - -// WebAppOpenModeClass represents WebAppOpenMode generic type. -// -// Example: -// -// g, err := tdapi.DecodeWebAppOpenMode(buf) -// if err != nil { -// panic(err) -// } -// switch v := g.(type) { -// case *tdapi.WebAppOpenModeCompact: // webAppOpenModeCompact#6604ffdb -// case *tdapi.WebAppOpenModeFullSize: // webAppOpenModeFullSize#b48cd41 -// case *tdapi.WebAppOpenModeFullScreen: // webAppOpenModeFullScreen#6f8a019d -// default: panic(v) -// } -type WebAppOpenModeClass interface { - bin.Encoder - bin.Decoder - bin.BareEncoder - bin.BareDecoder - construct() WebAppOpenModeClass - - // 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 - - EncodeTDLibJSON(b tdjson.Encoder) error - DecodeTDLibJSON(b tdjson.Decoder) error -} - -// DecodeWebAppOpenMode implements binary de-serialization for WebAppOpenModeClass. -func DecodeWebAppOpenMode(buf *bin.Buffer) (WebAppOpenModeClass, error) { - id, err := buf.PeekID() - if err != nil { - return nil, err - } - switch id { - case WebAppOpenModeCompactTypeID: - // Decoding webAppOpenModeCompact#6604ffdb. - v := WebAppOpenModeCompact{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode WebAppOpenModeClass: %w", err) - } - return &v, nil - case WebAppOpenModeFullSizeTypeID: - // Decoding webAppOpenModeFullSize#b48cd41. - v := WebAppOpenModeFullSize{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode WebAppOpenModeClass: %w", err) - } - return &v, nil - case WebAppOpenModeFullScreenTypeID: - // Decoding webAppOpenModeFullScreen#6f8a019d. - v := WebAppOpenModeFullScreen{} - if err := v.Decode(buf); err != nil { - return nil, fmt.Errorf("unable to decode WebAppOpenModeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode WebAppOpenModeClass: %w", bin.NewUnexpectedID(id)) - } -} - -// DecodeTDLibJSONWebAppOpenMode implements binary de-serialization for WebAppOpenModeClass. -func DecodeTDLibJSONWebAppOpenMode(buf tdjson.Decoder) (WebAppOpenModeClass, error) { - id, err := buf.FindTypeID() - if err != nil { - return nil, err - } - switch id { - case "webAppOpenModeCompact": - // Decoding webAppOpenModeCompact#6604ffdb. - v := WebAppOpenModeCompact{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode WebAppOpenModeClass: %w", err) - } - return &v, nil - case "webAppOpenModeFullSize": - // Decoding webAppOpenModeFullSize#b48cd41. - v := WebAppOpenModeFullSize{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode WebAppOpenModeClass: %w", err) - } - return &v, nil - case "webAppOpenModeFullScreen": - // Decoding webAppOpenModeFullScreen#6f8a019d. - v := WebAppOpenModeFullScreen{} - if err := v.DecodeTDLibJSON(buf); err != nil { - return nil, fmt.Errorf("unable to decode WebAppOpenModeClass: %w", err) - } - return &v, nil - default: - return nil, fmt.Errorf("unable to decode WebAppOpenModeClass: %w", tdjson.NewUnexpectedID(id)) - } -} - -// WebAppOpenMode boxes the WebAppOpenModeClass providing a helper. -type WebAppOpenModeBox struct { - WebAppOpenMode WebAppOpenModeClass -} - -// Decode implements bin.Decoder for WebAppOpenModeBox. -func (b *WebAppOpenModeBox) Decode(buf *bin.Buffer) error { - if b == nil { - return fmt.Errorf("unable to decode WebAppOpenModeBox to nil") - } - v, err := DecodeWebAppOpenMode(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.WebAppOpenMode = v - return nil -} - -// Encode implements bin.Encode for WebAppOpenModeBox. -func (b *WebAppOpenModeBox) Encode(buf *bin.Buffer) error { - if b == nil || b.WebAppOpenMode == nil { - return fmt.Errorf("unable to encode WebAppOpenModeClass as nil") - } - return b.WebAppOpenMode.Encode(buf) -} - -// DecodeTDLibJSON implements bin.Decoder for WebAppOpenModeBox. -func (b *WebAppOpenModeBox) DecodeTDLibJSON(buf tdjson.Decoder) error { - if b == nil { - return fmt.Errorf("unable to decode WebAppOpenModeBox to nil") - } - v, err := DecodeTDLibJSONWebAppOpenMode(buf) - if err != nil { - return fmt.Errorf("unable to decode boxed value: %w", err) - } - b.WebAppOpenMode = v - return nil -} - -// EncodeTDLibJSON implements bin.Encode for WebAppOpenModeBox. -func (b *WebAppOpenModeBox) EncodeTDLibJSON(buf tdjson.Encoder) error { - if b == nil || b.WebAppOpenMode == nil { - return fmt.Errorf("unable to encode WebAppOpenModeClass as nil") - } - return b.WebAppOpenMode.EncodeTDLibJSON(buf) -} diff --git a/tdapi/tl_web_app_open_parameters_gen.go b/tdapi/tl_web_app_open_parameters_gen.go deleted file mode 100644 index 62120f0f6..000000000 --- a/tdapi/tl_web_app_open_parameters_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// WebAppOpenParameters represents TL type `webAppOpenParameters#51fa466f`. -type WebAppOpenParameters struct { - // Preferred Web App theme; pass null to use the default theme - Theme ThemeParameters - // Short name of the current application; 0-64 English letters, digits, and underscores - ApplicationName string - // The mode in which the Web App is opened; pass null to open in webAppOpenModeFullSize - Mode WebAppOpenModeClass -} - -// WebAppOpenParametersTypeID is TL type id of WebAppOpenParameters. -const WebAppOpenParametersTypeID = 0x51fa466f - -// Ensuring interfaces in compile-time for WebAppOpenParameters. -var ( - _ bin.Encoder = &WebAppOpenParameters{} - _ bin.Decoder = &WebAppOpenParameters{} - _ bin.BareEncoder = &WebAppOpenParameters{} - _ bin.BareDecoder = &WebAppOpenParameters{} -) - -func (w *WebAppOpenParameters) Zero() bool { - if w == nil { - return true - } - if !(w.Theme.Zero()) { - return false - } - if !(w.ApplicationName == "") { - return false - } - if !(w.Mode == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (w *WebAppOpenParameters) String() string { - if w == nil { - return "WebAppOpenParameters(nil)" - } - type Alias WebAppOpenParameters - return fmt.Sprintf("WebAppOpenParameters%+v", Alias(*w)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*WebAppOpenParameters) TypeID() uint32 { - return WebAppOpenParametersTypeID -} - -// TypeName returns name of type in TL schema. -func (*WebAppOpenParameters) TypeName() string { - return "webAppOpenParameters" -} - -// TypeInfo returns info about TL type. -func (w *WebAppOpenParameters) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "webAppOpenParameters", - ID: WebAppOpenParametersTypeID, - } - if w == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "Theme", - SchemaName: "theme", - }, - { - Name: "ApplicationName", - SchemaName: "application_name", - }, - { - Name: "Mode", - SchemaName: "mode", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (w *WebAppOpenParameters) Encode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenParameters#51fa466f as nil") - } - b.PutID(WebAppOpenParametersTypeID) - return w.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (w *WebAppOpenParameters) EncodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenParameters#51fa466f as nil") - } - if err := w.Theme.Encode(b); err != nil { - return fmt.Errorf("unable to encode webAppOpenParameters#51fa466f: field theme: %w", err) - } - b.PutString(w.ApplicationName) - if w.Mode == nil { - return fmt.Errorf("unable to encode webAppOpenParameters#51fa466f: field mode is nil") - } - if err := w.Mode.Encode(b); err != nil { - return fmt.Errorf("unable to encode webAppOpenParameters#51fa466f: field mode: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (w *WebAppOpenParameters) Decode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenParameters#51fa466f to nil") - } - if err := b.ConsumeID(WebAppOpenParametersTypeID); err != nil { - return fmt.Errorf("unable to decode webAppOpenParameters#51fa466f: %w", err) - } - return w.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (w *WebAppOpenParameters) DecodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenParameters#51fa466f to nil") - } - { - if err := w.Theme.Decode(b); err != nil { - return fmt.Errorf("unable to decode webAppOpenParameters#51fa466f: field theme: %w", err) - } - } - { - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode webAppOpenParameters#51fa466f: field application_name: %w", err) - } - w.ApplicationName = value - } - { - value, err := DecodeWebAppOpenMode(b) - if err != nil { - return fmt.Errorf("unable to decode webAppOpenParameters#51fa466f: field mode: %w", err) - } - w.Mode = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (w *WebAppOpenParameters) EncodeTDLibJSON(b tdjson.Encoder) error { - if w == nil { - return fmt.Errorf("can't encode webAppOpenParameters#51fa466f as nil") - } - b.ObjStart() - b.PutID("webAppOpenParameters") - b.Comma() - b.FieldStart("theme") - if err := w.Theme.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webAppOpenParameters#51fa466f: field theme: %w", err) - } - b.Comma() - b.FieldStart("application_name") - b.PutString(w.ApplicationName) - b.Comma() - b.FieldStart("mode") - if w.Mode == nil { - return fmt.Errorf("unable to encode webAppOpenParameters#51fa466f: field mode is nil") - } - if err := w.Mode.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webAppOpenParameters#51fa466f: field mode: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (w *WebAppOpenParameters) DecodeTDLibJSON(b tdjson.Decoder) error { - if w == nil { - return fmt.Errorf("can't decode webAppOpenParameters#51fa466f to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("webAppOpenParameters"); err != nil { - return fmt.Errorf("unable to decode webAppOpenParameters#51fa466f: %w", err) - } - case "theme": - if err := w.Theme.DecodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to decode webAppOpenParameters#51fa466f: field theme: %w", err) - } - case "application_name": - value, err := b.String() - if err != nil { - return fmt.Errorf("unable to decode webAppOpenParameters#51fa466f: field application_name: %w", err) - } - w.ApplicationName = value - case "mode": - value, err := DecodeTDLibJSONWebAppOpenMode(b) - if err != nil { - return fmt.Errorf("unable to decode webAppOpenParameters#51fa466f: field mode: %w", err) - } - w.Mode = value - default: - return b.Skip() - } - return nil - }) -} - -// GetTheme returns value of Theme field. -func (w *WebAppOpenParameters) GetTheme() (value ThemeParameters) { - if w == nil { - return - } - return w.Theme -} - -// GetApplicationName returns value of ApplicationName field. -func (w *WebAppOpenParameters) GetApplicationName() (value string) { - if w == nil { - return - } - return w.ApplicationName -} - -// GetMode returns value of Mode field. -func (w *WebAppOpenParameters) GetMode() (value WebAppOpenModeClass) { - if w == nil { - return - } - return w.Mode -} diff --git a/tdapi/tl_web_page_instant_view_gen.go b/tdapi/tl_web_page_instant_view_gen.go deleted file mode 100644 index e340d3a2c..000000000 --- a/tdapi/tl_web_page_instant_view_gen.go +++ /dev/null @@ -1,408 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// WebPageInstantView represents TL type `webPageInstantView#2c0ec99c`. -type WebPageInstantView struct { - // Content of the instant view page - PageBlocks []PageBlockClass - // Number of the instant view views; 0 if unknown - ViewCount int32 - // Version of the instant view; currently, can be 1 or 2 - Version int32 - // True, if the instant view must be shown from right to left - IsRtl bool - // True, if the instant view contains the full page. A network request might be needed to - // get the full instant view - IsFull bool - // An internal link to be opened to leave feedback about the instant view - FeedbackLink InternalLinkTypeClass -} - -// WebPageInstantViewTypeID is TL type id of WebPageInstantView. -const WebPageInstantViewTypeID = 0x2c0ec99c - -// Ensuring interfaces in compile-time for WebPageInstantView. -var ( - _ bin.Encoder = &WebPageInstantView{} - _ bin.Decoder = &WebPageInstantView{} - _ bin.BareEncoder = &WebPageInstantView{} - _ bin.BareDecoder = &WebPageInstantView{} -) - -func (w *WebPageInstantView) Zero() bool { - if w == nil { - return true - } - if !(w.PageBlocks == nil) { - return false - } - if !(w.ViewCount == 0) { - return false - } - if !(w.Version == 0) { - return false - } - if !(w.IsRtl == false) { - return false - } - if !(w.IsFull == false) { - return false - } - if !(w.FeedbackLink == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (w *WebPageInstantView) String() string { - if w == nil { - return "WebPageInstantView(nil)" - } - type Alias WebPageInstantView - return fmt.Sprintf("WebPageInstantView%+v", Alias(*w)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*WebPageInstantView) TypeID() uint32 { - return WebPageInstantViewTypeID -} - -// TypeName returns name of type in TL schema. -func (*WebPageInstantView) TypeName() string { - return "webPageInstantView" -} - -// TypeInfo returns info about TL type. -func (w *WebPageInstantView) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "webPageInstantView", - ID: WebPageInstantViewTypeID, - } - if w == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "PageBlocks", - SchemaName: "page_blocks", - }, - { - Name: "ViewCount", - SchemaName: "view_count", - }, - { - Name: "Version", - SchemaName: "version", - }, - { - Name: "IsRtl", - SchemaName: "is_rtl", - }, - { - Name: "IsFull", - SchemaName: "is_full", - }, - { - Name: "FeedbackLink", - SchemaName: "feedback_link", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (w *WebPageInstantView) Encode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webPageInstantView#2c0ec99c as nil") - } - b.PutID(WebPageInstantViewTypeID) - return w.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (w *WebPageInstantView) EncodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode webPageInstantView#2c0ec99c as nil") - } - b.PutInt(len(w.PageBlocks)) - for idx, v := range w.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode webPageInstantView#2c0ec99c: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeBare(b); err != nil { - return fmt.Errorf("unable to encode bare webPageInstantView#2c0ec99c: field page_blocks element with index %d: %w", idx, err) - } - } - b.PutInt32(w.ViewCount) - b.PutInt32(w.Version) - b.PutBool(w.IsRtl) - b.PutBool(w.IsFull) - if w.FeedbackLink == nil { - return fmt.Errorf("unable to encode webPageInstantView#2c0ec99c: field feedback_link is nil") - } - if err := w.FeedbackLink.Encode(b); err != nil { - return fmt.Errorf("unable to encode webPageInstantView#2c0ec99c: field feedback_link: %w", err) - } - return nil -} - -// Decode implements bin.Decoder. -func (w *WebPageInstantView) Decode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webPageInstantView#2c0ec99c to nil") - } - if err := b.ConsumeID(WebPageInstantViewTypeID); err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: %w", err) - } - return w.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (w *WebPageInstantView) DecodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode webPageInstantView#2c0ec99c to nil") - } - { - headerLen, err := b.Int() - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field page_blocks: %w", err) - } - - if headerLen > 0 { - w.PageBlocks = make([]PageBlockClass, 0, headerLen%bin.PreallocateLimit) - } - for idx := 0; idx < headerLen; idx++ { - value, err := DecodePageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field page_blocks: %w", err) - } - w.PageBlocks = append(w.PageBlocks, value) - } - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field view_count: %w", err) - } - w.ViewCount = value - } - { - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field version: %w", err) - } - w.Version = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field is_rtl: %w", err) - } - w.IsRtl = value - } - { - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field is_full: %w", err) - } - w.IsFull = value - } - { - value, err := DecodeInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field feedback_link: %w", err) - } - w.FeedbackLink = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (w *WebPageInstantView) EncodeTDLibJSON(b tdjson.Encoder) error { - if w == nil { - return fmt.Errorf("can't encode webPageInstantView#2c0ec99c as nil") - } - b.ObjStart() - b.PutID("webPageInstantView") - b.Comma() - b.FieldStart("page_blocks") - b.ArrStart() - for idx, v := range w.PageBlocks { - if v == nil { - return fmt.Errorf("unable to encode webPageInstantView#2c0ec99c: field page_blocks element with index %d is nil", idx) - } - if err := v.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webPageInstantView#2c0ec99c: field page_blocks element with index %d: %w", idx, err) - } - b.Comma() - } - b.StripComma() - b.ArrEnd() - b.Comma() - b.FieldStart("view_count") - b.PutInt32(w.ViewCount) - b.Comma() - b.FieldStart("version") - b.PutInt32(w.Version) - b.Comma() - b.FieldStart("is_rtl") - b.PutBool(w.IsRtl) - b.Comma() - b.FieldStart("is_full") - b.PutBool(w.IsFull) - b.Comma() - b.FieldStart("feedback_link") - if w.FeedbackLink == nil { - return fmt.Errorf("unable to encode webPageInstantView#2c0ec99c: field feedback_link is nil") - } - if err := w.FeedbackLink.EncodeTDLibJSON(b); err != nil { - return fmt.Errorf("unable to encode webPageInstantView#2c0ec99c: field feedback_link: %w", err) - } - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (w *WebPageInstantView) DecodeTDLibJSON(b tdjson.Decoder) error { - if w == nil { - return fmt.Errorf("can't decode webPageInstantView#2c0ec99c to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("webPageInstantView"); err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: %w", err) - } - case "page_blocks": - if err := b.Arr(func(b tdjson.Decoder) error { - value, err := DecodeTDLibJSONPageBlock(b) - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field page_blocks: %w", err) - } - w.PageBlocks = append(w.PageBlocks, value) - return nil - }); err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field page_blocks: %w", err) - } - case "view_count": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field view_count: %w", err) - } - w.ViewCount = value - case "version": - value, err := b.Int32() - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field version: %w", err) - } - w.Version = value - case "is_rtl": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field is_rtl: %w", err) - } - w.IsRtl = value - case "is_full": - value, err := b.Bool() - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field is_full: %w", err) - } - w.IsFull = value - case "feedback_link": - value, err := DecodeTDLibJSONInternalLinkType(b) - if err != nil { - return fmt.Errorf("unable to decode webPageInstantView#2c0ec99c: field feedback_link: %w", err) - } - w.FeedbackLink = value - default: - return b.Skip() - } - return nil - }) -} - -// GetPageBlocks returns value of PageBlocks field. -func (w *WebPageInstantView) GetPageBlocks() (value []PageBlockClass) { - if w == nil { - return - } - return w.PageBlocks -} - -// GetViewCount returns value of ViewCount field. -func (w *WebPageInstantView) GetViewCount() (value int32) { - if w == nil { - return - } - return w.ViewCount -} - -// GetVersion returns value of Version field. -func (w *WebPageInstantView) GetVersion() (value int32) { - if w == nil { - return - } - return w.Version -} - -// GetIsRtl returns value of IsRtl field. -func (w *WebPageInstantView) GetIsRtl() (value bool) { - if w == nil { - return - } - return w.IsRtl -} - -// GetIsFull returns value of IsFull field. -func (w *WebPageInstantView) GetIsFull() (value bool) { - if w == nil { - return - } - return w.IsFull -} - -// GetFeedbackLink returns value of FeedbackLink field. -func (w *WebPageInstantView) GetFeedbackLink() (value InternalLinkTypeClass) { - if w == nil { - return - } - return w.FeedbackLink -} diff --git a/tdapi/tl_write_generated_file_part_gen.go b/tdapi/tl_write_generated_file_part_gen.go deleted file mode 100644 index 2e672e927..000000000 --- a/tdapi/tl_write_generated_file_part_gen.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by gotdgen, DO NOT EDIT. - -package tdapi - -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{} -) - -// WriteGeneratedFilePartRequest represents TL type `writeGeneratedFilePart#cc89e95`. -type WriteGeneratedFilePartRequest struct { - // The identifier of the generation process - GenerationID int64 - // The offset from which to write the data to the file - Offset int64 - // The data to write - Data []byte -} - -// WriteGeneratedFilePartRequestTypeID is TL type id of WriteGeneratedFilePartRequest. -const WriteGeneratedFilePartRequestTypeID = 0xcc89e95 - -// Ensuring interfaces in compile-time for WriteGeneratedFilePartRequest. -var ( - _ bin.Encoder = &WriteGeneratedFilePartRequest{} - _ bin.Decoder = &WriteGeneratedFilePartRequest{} - _ bin.BareEncoder = &WriteGeneratedFilePartRequest{} - _ bin.BareDecoder = &WriteGeneratedFilePartRequest{} -) - -func (w *WriteGeneratedFilePartRequest) Zero() bool { - if w == nil { - return true - } - if !(w.GenerationID == 0) { - return false - } - if !(w.Offset == 0) { - return false - } - if !(w.Data == nil) { - return false - } - - return true -} - -// String implements fmt.Stringer. -func (w *WriteGeneratedFilePartRequest) String() string { - if w == nil { - return "WriteGeneratedFilePartRequest(nil)" - } - type Alias WriteGeneratedFilePartRequest - return fmt.Sprintf("WriteGeneratedFilePartRequest%+v", Alias(*w)) -} - -// TypeID returns type id in TL schema. -// -// See https://core.telegram.org/mtproto/TL-tl#remarks. -func (*WriteGeneratedFilePartRequest) TypeID() uint32 { - return WriteGeneratedFilePartRequestTypeID -} - -// TypeName returns name of type in TL schema. -func (*WriteGeneratedFilePartRequest) TypeName() string { - return "writeGeneratedFilePart" -} - -// TypeInfo returns info about TL type. -func (w *WriteGeneratedFilePartRequest) TypeInfo() tdp.Type { - typ := tdp.Type{ - Name: "writeGeneratedFilePart", - ID: WriteGeneratedFilePartRequestTypeID, - } - if w == nil { - typ.Null = true - return typ - } - typ.Fields = []tdp.Field{ - { - Name: "GenerationID", - SchemaName: "generation_id", - }, - { - Name: "Offset", - SchemaName: "offset", - }, - { - Name: "Data", - SchemaName: "data", - }, - } - return typ -} - -// Encode implements bin.Encoder. -func (w *WriteGeneratedFilePartRequest) Encode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode writeGeneratedFilePart#cc89e95 as nil") - } - b.PutID(WriteGeneratedFilePartRequestTypeID) - return w.EncodeBare(b) -} - -// EncodeBare implements bin.BareEncoder. -func (w *WriteGeneratedFilePartRequest) EncodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't encode writeGeneratedFilePart#cc89e95 as nil") - } - b.PutLong(w.GenerationID) - b.PutInt53(w.Offset) - b.PutBytes(w.Data) - return nil -} - -// Decode implements bin.Decoder. -func (w *WriteGeneratedFilePartRequest) Decode(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode writeGeneratedFilePart#cc89e95 to nil") - } - if err := b.ConsumeID(WriteGeneratedFilePartRequestTypeID); err != nil { - return fmt.Errorf("unable to decode writeGeneratedFilePart#cc89e95: %w", err) - } - return w.DecodeBare(b) -} - -// DecodeBare implements bin.BareDecoder. -func (w *WriteGeneratedFilePartRequest) DecodeBare(b *bin.Buffer) error { - if w == nil { - return fmt.Errorf("can't decode writeGeneratedFilePart#cc89e95 to nil") - } - { - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode writeGeneratedFilePart#cc89e95: field generation_id: %w", err) - } - w.GenerationID = value - } - { - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode writeGeneratedFilePart#cc89e95: field offset: %w", err) - } - w.Offset = value - } - { - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode writeGeneratedFilePart#cc89e95: field data: %w", err) - } - w.Data = value - } - return nil -} - -// EncodeTDLibJSON implements tdjson.TDLibEncoder. -func (w *WriteGeneratedFilePartRequest) EncodeTDLibJSON(b tdjson.Encoder) error { - if w == nil { - return fmt.Errorf("can't encode writeGeneratedFilePart#cc89e95 as nil") - } - b.ObjStart() - b.PutID("writeGeneratedFilePart") - b.Comma() - b.FieldStart("generation_id") - b.PutLong(w.GenerationID) - b.Comma() - b.FieldStart("offset") - b.PutInt53(w.Offset) - b.Comma() - b.FieldStart("data") - b.PutBytes(w.Data) - b.Comma() - b.StripComma() - b.ObjEnd() - return nil -} - -// DecodeTDLibJSON implements tdjson.TDLibDecoder. -func (w *WriteGeneratedFilePartRequest) DecodeTDLibJSON(b tdjson.Decoder) error { - if w == nil { - return fmt.Errorf("can't decode writeGeneratedFilePart#cc89e95 to nil") - } - - return b.Obj(func(b tdjson.Decoder, key []byte) error { - switch string(key) { - case tdjson.TypeField: - if err := b.ConsumeID("writeGeneratedFilePart"); err != nil { - return fmt.Errorf("unable to decode writeGeneratedFilePart#cc89e95: %w", err) - } - case "generation_id": - value, err := b.Long() - if err != nil { - return fmt.Errorf("unable to decode writeGeneratedFilePart#cc89e95: field generation_id: %w", err) - } - w.GenerationID = value - case "offset": - value, err := b.Int53() - if err != nil { - return fmt.Errorf("unable to decode writeGeneratedFilePart#cc89e95: field offset: %w", err) - } - w.Offset = value - case "data": - value, err := b.Bytes() - if err != nil { - return fmt.Errorf("unable to decode writeGeneratedFilePart#cc89e95: field data: %w", err) - } - w.Data = value - default: - return b.Skip() - } - return nil - }) -} - -// GetGenerationID returns value of GenerationID field. -func (w *WriteGeneratedFilePartRequest) GetGenerationID() (value int64) { - if w == nil { - return - } - return w.GenerationID -} - -// GetOffset returns value of Offset field. -func (w *WriteGeneratedFilePartRequest) GetOffset() (value int64) { - if w == nil { - return - } - return w.Offset -} - -// GetData returns value of Data field. -func (w *WriteGeneratedFilePartRequest) GetData() (value []byte) { - if w == nil { - return - } - return w.Data -} - -// WriteGeneratedFilePart invokes method writeGeneratedFilePart#cc89e95 returning error if any. -func (c *Client) WriteGeneratedFilePart(ctx context.Context, request *WriteGeneratedFilePartRequest) error { - var ok Ok - - if err := c.rpc.Invoke(ctx, request, &ok); err != nil { - return err - } - return nil -} diff --git a/tdjson/encoder_test.go b/tdjson/encoder_test.go index e43ccd60d..ac82d9803 100644 --- a/tdjson/encoder_test.go +++ b/tdjson/encoder_test.go @@ -9,7 +9,6 @@ import ( "github.com/go-faster/jx" "github.com/stretchr/testify/require" - "github.com/gotd/td/tdapi" "github.com/gotd/td/tdjson" "github.com/gotd/td/tdp" ) @@ -40,53 +39,10 @@ func TestEncodeDecode(t *testing.T) { } types := []obj{ - &tdapi.SetTdlibParametersRequest{ - UseTestDC: true, - DatabaseDirectory: "database", - FilesDirectory: "files", - UseFileDatabase: true, - UseChatInfoDatabase: true, - UseMessageDatabase: true, - UseSecretChats: true, - APIID: 10, - APIHash: "russcox", - SystemLanguageCode: "ru", - DeviceModel: "gotd", - SystemVersion: "10", - ApplicationVersion: "10", - }, - &tdapi.ProfilePhoto{ - ID: 1, - }, - &tdapi.ReplyMarkupInlineKeyboard{ - Rows: [][]tdapi.InlineKeyboardButton{ - { - { - Text: "text", - Type: &tdapi.InlineKeyboardButtonTypeCallback{ - Data: []byte("a"), - }, - }, - { - Text: "text2", - Type: &tdapi.InlineKeyboardButtonTypeCallback{ - Data: []byte("b"), - }, - }, - }, - { - { - Text: "text3", - Type: &tdapi.InlineKeyboardButtonTypeCallback{ - Data: []byte("c"), - }, - }, - }, - }, - }, - // Test empty array. - &tdapi.ReplyMarkupInlineKeyboard{ - Rows: [][]tdapi.InlineKeyboardButton{}, + &Minithumbnail{ + Data: []byte("foobar"), + Height: 1024, + Width: 2048, }, } diff --git a/tdapi/tl_minithumbnail_gen.go b/tdjson/tl_minithumbnail_gen_test.go similarity index 99% rename from tdapi/tl_minithumbnail_gen.go rename to tdjson/tl_minithumbnail_gen_test.go index 80ae0ecfd..fc1d8b008 100644 --- a/tdapi/tl_minithumbnail_gen.go +++ b/tdjson/tl_minithumbnail_gen_test.go @@ -1,6 +1,6 @@ // Code generated by gotdgen, DO NOT EDIT. -package tdapi +package tdjson_test import ( "context"